From: Cris Di Sclafani Date: Tue, 3 Nov 2020 15:16:34 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.6 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=f88fb5b94ce757eddf6b85c5f1dab8caa86a5a97;p=motion2.git Built motion from commit (unavailable).|2.5.6 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 25f4429..c5ab7aa 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T11:49:27.920Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T14:55:45.468Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index abe18a6..424f4a7 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T11:49:27.920Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.6", "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-11-03T14:55:45.468Z", "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 3976216..d27db62 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 _0xec84=['motionbar[NULL,NULL,WinAppArguments]','TEXT','exports','getDataValue','action','contactManager','integration','jscripty','urlForward','browser','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)]','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x36b603,_0x23d108){var _0x2f1b71=function(_0x3f6e10){while(--_0x3f6e10){_0x36b603['push'](_0x36b603['shift']());}};_0x2f1b71(++_0x23d108);}(_0xec84,0x17c));var _0x4ec8=function(_0x3ab0c3,_0x214fce){_0x3ab0c3=_0x3ab0c3-0x0;var _0x37df7a=_0xec84[_0x3ab0c3];return _0x37df7a;};'use strict';var Sequelize=require('sequelize');module[_0x4ec8('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4ce91d){return this[_0x4ec8('0x1')](_0x4ec8('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x4ec8('0x3'),_0x4ec8('0x4'),'motionbar',_0x4ec8('0x5'),_0x4ec8('0x6'),_0x4ec8('0x7'),'bot','script']],'msg':_0x4ec8('0x8')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4ec8('0x9')},'data2':{'type':Sequelize[_0x4ec8('0xa')](0x1000),'comment':_0x4ec8('0xb')},'data3':{'type':Sequelize[_0x4ec8('0xa')](0x1000),'comment':_0x4ec8('0xc')},'data4':{'type':Sequelize[_0x4ec8('0xa')](0x1000)},'data5':{'type':Sequelize[_0x4ec8('0xa')](0x1000)},'data6':{'type':Sequelize[_0x4ec8('0xa')]},'data7':{'type':Sequelize[_0x4ec8('0xd')]}}; \ No newline at end of file +var _0xdb5d=['jscripty','browser','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','exports','VIRTUAL','STRING','contactManager','integration'];(function(_0x535aca,_0x3ab159){var _0x1cf84c=function(_0x5b643d){while(--_0x5b643d){_0x535aca['push'](_0x535aca['shift']());}};_0x1cf84c(++_0x3ab159);}(_0xdb5d,0x18f));var _0xddb5=function(_0x2a7169,_0x2fa89a){_0x2a7169=_0x2a7169-0x0;var _0x282cfb=_0xdb5d[_0x2a7169];return _0x282cfb;};'use strict';var Sequelize=require(_0xddb5('0x0'));module[_0xddb5('0x1')]={'name':{'type':Sequelize[_0xddb5('0x2')],'get':function(_0x4f7871){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0xddb5('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xddb5('0x4'),_0xddb5('0x5'),'motionbar',_0xddb5('0x6'),'urlForward',_0xddb5('0x7'),_0xddb5('0x8'),_0xddb5('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xddb5('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xddb5('0xb')},'data2':{'type':Sequelize[_0xddb5('0x3')](0x1000),'comment':_0xddb5('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xddb5('0xd')},'data4':{'type':Sequelize[_0xddb5('0x3')](0x1000)},'data5':{'type':Sequelize[_0xddb5('0x3')](0x1000)},'data6':{'type':Sequelize[_0xddb5('0x3')]},'data7':{'type':Sequelize[_0xddb5('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 00e89a4..bf57f95 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 _0xbd0a=['ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','Content-Range','json','reject','then','destroy','status','error','stack','name','send','update','body','Action','find','params','catch','html-pdf','rimraf','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x4b366e,_0x479e1f){var _0x464dff=function(_0x5ac61c){while(--_0x5ac61c){_0x4b366e['push'](_0x4b366e['shift']());}};_0x464dff(++_0x479e1f);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x34193a,_0x1e18c9){_0x34193a=_0x34193a-0x0;var _0x3d9b24=_0xbd0a[_0x34193a];return _0x3d9b24;};'use strict';var pdf=require(_0xabd0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xabd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabd0('0x2'));var BPromise=require(_0xabd0('0x3'));var Mustache=require(_0xabd0('0x4'));var util=require(_0xabd0('0x5'));var path=require(_0xabd0('0x6'));var sox=require(_0xabd0('0x7'));var csv=require(_0xabd0('0x8'));var ejs=require(_0xabd0('0x9'));var fs=require('fs');var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];function respondWithStatusCode(_0x3bf33,_0xd66d68){_0xd66d68=_0xd66d68||0xcc;return function(_0x5b0f34){if(_0x5b0f34){return _0x3bf33[_0xabd0('0x18')](_0xd66d68);}return _0x3bf33['status'](_0xd66d68)[_0xabd0('0x19')]();};}function respondWithResult(_0x145f76,_0x5ceb94){_0x5ceb94=_0x5ceb94||0xc8;return function(_0x56ba31){if(_0x56ba31){return _0x145f76['status'](_0x5ceb94)['json'](_0x56ba31);}};}function respondWithFilteredResult(_0x679d0b,_0x26d8fd){return function(_0x97f4ec){if(_0x97f4ec){var _0xdb7a40=_0x97f4ec[_0xabd0('0x1a')],_0x169611=_0x26d8fd[_0xabd0('0x1b')],_0x28ddcf=_0x26d8fd['offset']+_0x26d8fd[_0xabd0('0x1c')],_0x389e1e;if(_0x28ddcf>=_0xdb7a40){_0x28ddcf=_0xdb7a40;_0x389e1e=0xc8;}else{_0x389e1e=0xce;}_0x679d0b['status'](_0x389e1e);return _0x679d0b['set'](_0xabd0('0x1d'),_0x169611+'-'+_0x28ddcf+'/'+_0xdb7a40)[_0xabd0('0x1e')](_0x97f4ec);}return null;};}function patchUpdates(_0x3c5886){return function(_0x23f955){try{jsonpatch['apply'](_0x23f955,_0x3c5886,!![]);}catch(_0x862492){return BPromise[_0xabd0('0x1f')](_0x862492);}return _0x23f955['save']();};}function saveUpdates(_0x56c2f5,_0x1c955e){return function(_0x29a6f0){if(_0x29a6f0){return _0x29a6f0['update'](_0x56c2f5)[_0xabd0('0x20')](function(_0x41718f){return _0x41718f;});}return null;};}function removeEntity(_0xa1ebf,_0x1e077e){return function(_0x4c9f3a){if(_0x4c9f3a){return _0x4c9f3a[_0xabd0('0x21')]()[_0xabd0('0x20')](function(){_0xa1ebf[_0xabd0('0x22')](0xcc)[_0xabd0('0x19')]();});}};}function handleEntityNotFound(_0x264167,_0xf6dbad){return function(_0x48c4a1){if(!_0x48c4a1){_0x264167[_0xabd0('0x18')](0x194);}return _0x48c4a1;};}function handleError(_0x187fc5,_0x20b73d){_0x20b73d=_0x20b73d||0x1f4;return function(_0x52c8be){logger[_0xabd0('0x23')](_0x52c8be[_0xabd0('0x24')]);if(_0x52c8be[_0xabd0('0x25')]){delete _0x52c8be[_0xabd0('0x25')];}_0x187fc5[_0xabd0('0x22')](_0x20b73d)[_0xabd0('0x26')](_0x52c8be);};}exports[_0xabd0('0x27')]=function(_0x3a10d6,_0x392b05){if(_0x3a10d6[_0xabd0('0x28')]['id']){delete _0x3a10d6[_0xabd0('0x28')]['id'];}return db[_0xabd0('0x29')][_0xabd0('0x2a')]({'where':{'id':_0x3a10d6[_0xabd0('0x2b')]['id']}})[_0xabd0('0x20')](handleEntityNotFound(_0x392b05,null))[_0xabd0('0x20')](saveUpdates(_0x3a10d6['body'],null))[_0xabd0('0x20')](respondWithResult(_0x392b05,null))[_0xabd0('0x2c')](handleError(_0x392b05,null));};exports[_0xabd0('0x21')]=function(_0x10b4ab,_0x58f687){return db[_0xabd0('0x29')][_0xabd0('0x2a')]({'where':{'id':_0x10b4ab[_0xabd0('0x2b')]['id']}})['then'](handleEntityNotFound(_0x58f687,null))[_0xabd0('0x20')](removeEntity(_0x58f687,null))[_0xabd0('0x2c')](handleError(_0x58f687,null));}; \ No newline at end of file +var _0xe1d3=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','end','error','send','body','Action','catch','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2406a3,_0x132ff7){var _0x5c6d13=function(_0x1fea69){while(--_0x1fea69){_0x2406a3['push'](_0x2406a3['shift']());}};_0x5c6d13(++_0x132ff7);}(_0xe1d3,0x159));var _0x3e1d=function(_0x567170,_0x385160){_0x567170=_0x567170-0x0;var _0x554b45=_0xe1d3[_0x567170];return _0x554b45;};'use strict';var pdf=require(_0x3e1d('0x0'));var emlformat=require(_0x3e1d('0x1'));var rimraf=require(_0x3e1d('0x2'));var zipdir=require(_0x3e1d('0x3'));var jsonpatch=require(_0x3e1d('0x4'));var rp=require('request-promise');var moment=require(_0x3e1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3e1d('0x6'));var util=require(_0x3e1d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3e1d('0x8'));var ejs=require(_0x3e1d('0x9'));var fs=require('fs');var _=require(_0x3e1d('0xa'));var squel=require(_0x3e1d('0xb'));var crypto=require(_0x3e1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3e1d('0xd'));var toCsv=require(_0x3e1d('0x8'));var querystring=require('querystring');var Papa=require(_0x3e1d('0xe'));var Redis=require(_0x3e1d('0xf'));var authService=require(_0x3e1d('0x10'));var qs=require(_0x3e1d('0x11'));var as=require(_0x3e1d('0x12'));var hardwareService=require(_0x3e1d('0x13'));var logger=require(_0x3e1d('0x14'))(_0x3e1d('0x15'));var utils=require(_0x3e1d('0x16'));var config=require(_0x3e1d('0x17'));var licenseUtil=require(_0x3e1d('0x18'));var db=require(_0x3e1d('0x19'))['db'];function respondWithStatusCode(_0x1b3608,_0x2fbe67){_0x2fbe67=_0x2fbe67||0xcc;return function(_0x591143){if(_0x591143){return _0x1b3608[_0x3e1d('0x1a')](_0x2fbe67);}return _0x1b3608[_0x3e1d('0x1b')](_0x2fbe67)['end']();};}function respondWithResult(_0x35dec5,_0x344be5){_0x344be5=_0x344be5||0xc8;return function(_0x4e77a6){if(_0x4e77a6){return _0x35dec5[_0x3e1d('0x1b')](_0x344be5)[_0x3e1d('0x1c')](_0x4e77a6);}};}function respondWithFilteredResult(_0x99c3fd,_0x2fb109){return function(_0x2c8b09){if(_0x2c8b09){var _0x5a6513=_0x2c8b09[_0x3e1d('0x1d')],_0x26626c=_0x2fb109[_0x3e1d('0x1e')],_0x2721e5=_0x2fb109['offset']+_0x2fb109[_0x3e1d('0x1f')],_0x5549be;if(_0x2721e5>=_0x5a6513){_0x2721e5=_0x5a6513;_0x5549be=0xc8;}else{_0x5549be=0xce;}_0x99c3fd[_0x3e1d('0x1b')](_0x5549be);return _0x99c3fd[_0x3e1d('0x20')](_0x3e1d('0x21'),_0x26626c+'-'+_0x2721e5+'/'+_0x5a6513)[_0x3e1d('0x1c')](_0x2c8b09);}return null;};}function patchUpdates(_0x22b509){return function(_0x4bc1a4){try{jsonpatch[_0x3e1d('0x22')](_0x4bc1a4,_0x22b509,!![]);}catch(_0x37a676){return BPromise['reject'](_0x37a676);}return _0x4bc1a4[_0x3e1d('0x23')]();};}function saveUpdates(_0x17a64a,_0x184ee4){return function(_0x5600a1){if(_0x5600a1){return _0x5600a1[_0x3e1d('0x24')](_0x17a64a)['then'](function(_0x25a96e){return _0x25a96e;});}return null;};}function removeEntity(_0x2259ee,_0x296d3b){return function(_0x34b191){if(_0x34b191){return _0x34b191[_0x3e1d('0x25')]()[_0x3e1d('0x26')](function(){_0x2259ee[_0x3e1d('0x1b')](0xcc)[_0x3e1d('0x27')]();});}};}function handleEntityNotFound(_0x2f4abb,_0x5291c4){return function(_0x3d7e21){if(!_0x3d7e21){_0x2f4abb[_0x3e1d('0x1a')](0x194);}return _0x3d7e21;};}function handleError(_0x2afbdf,_0x14687e){_0x14687e=_0x14687e||0x1f4;return function(_0x212c45){logger[_0x3e1d('0x28')](_0x212c45['stack']);if(_0x212c45['name']){delete _0x212c45['name'];}_0x2afbdf[_0x3e1d('0x1b')](_0x14687e)[_0x3e1d('0x29')](_0x212c45);};}exports[_0x3e1d('0x24')]=function(_0x438bd4,_0x49c9b3){if(_0x438bd4[_0x3e1d('0x2a')]['id']){delete _0x438bd4[_0x3e1d('0x2a')]['id'];}return db[_0x3e1d('0x2b')]['find']({'where':{'id':_0x438bd4['params']['id']}})['then'](handleEntityNotFound(_0x49c9b3,null))[_0x3e1d('0x26')](saveUpdates(_0x438bd4[_0x3e1d('0x2a')],null))[_0x3e1d('0x26')](respondWithResult(_0x49c9b3,null))[_0x3e1d('0x2c')](handleError(_0x49c9b3,null));};exports['destroy']=function(_0x384911,_0xa4768c){return db[_0x3e1d('0x2b')][_0x3e1d('0x2d')]({'where':{'id':_0x384911['params']['id']}})[_0x3e1d('0x26')](handleEntityNotFound(_0xa4768c,null))['then'](removeEntity(_0xa4768c,null))[_0x3e1d('0x2c')](handleError(_0xa4768c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5af20fb..ed3b93e 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 _0x11db=['bluebird','request-promise','path','../../config/environment','exports','define','tools_actions','lodash','util','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x11db,0xac));var _0xb11d=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0x11db[_0x403cff];return _0x5a7c56;};'use strict';var _=require(_0xb11d('0x0'));var util=require(_0xb11d('0x1'));var logger=require('../../config/logger')(_0xb11d('0x2'));var moment=require(_0xb11d('0x3'));var BPromise=require(_0xb11d('0x4'));var rp=require(_0xb11d('0x5'));var fs=require('fs');var path=require(_0xb11d('0x6'));var rimraf=require('rimraf');var config=require(_0xb11d('0x7'));var attributes=require('./action.attributes');module[_0xb11d('0x8')]=function(_0x11f475,_0x4194ec){return _0x11f475[_0xb11d('0x9')]('Action',attributes,{'tableName':_0xb11d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0ee=['define','Action','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2bc326,_0x473cf8){var _0x43722e=function(_0x4dd559){while(--_0x4dd559){_0x2bc326['push'](_0x2bc326['shift']());}};_0x43722e(++_0x473cf8);}(_0xb0ee,0x6e));var _0xeb0e=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xb0ee[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0xeb0e('0x0'));var util=require(_0xeb0e('0x1'));var logger=require(_0xeb0e('0x2'))('api');var moment=require(_0xeb0e('0x3'));var BPromise=require(_0xeb0e('0x4'));var rp=require(_0xeb0e('0x5'));var fs=require('fs');var path=require(_0xeb0e('0x6'));var rimraf=require(_0xeb0e('0x7'));var config=require(_0xeb0e('0x8'));var attributes=require('./action.attributes');module[_0xeb0e('0x9')]=function(_0x26a9b,_0x4735a8){return _0x26a9b[_0xeb0e('0xa')](_0xeb0e('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 23396a2..dec49fe 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 _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x3406b0,_0x2fa90b){var _0x1bbc48=function(_0xc56f13){while(--_0xc56f13){_0x3406b0['push'](_0x3406b0['shift']());}};_0x1bbc48(++_0x2fa90b);}(_0xe706,0xa3));var _0x6e70=function(_0x1ef4ee,_0xd87a11){_0x1ef4ee=_0x1ef4ee-0x0;var _0xabf86f=_0xe706[_0x1ef4ee];return _0xabf86f;};'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']('Action,\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']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ 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(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('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 d950706..7088ae2 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 _0xc6bf=['../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','multer','../../components/auth/service'];(function(_0x151c61,_0x5ba70b){var _0x26a861=function(_0x5928d0){while(--_0x5928d0){_0x151c61['push'](_0x151c61['shift']());}};_0x26a861(++_0x5ba70b);}(_0xc6bf,0x1ac));var _0xfc6b=function(_0x552284,_0x4ddb09){_0x552284=_0x552284-0x0;var _0x4ac092=_0xc6bf[_0x552284];return _0x4ac092;};'use strict';var multer=require(_0xfc6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xfc6b('0x1'));var interaction=require(_0xfc6b('0x2'));var config=require(_0xfc6b('0x3'));var controller=require('./action.controller');router[_0xfc6b('0x4')](_0xfc6b('0x5'),auth[_0xfc6b('0x6')](),controller['update']);router[_0xfc6b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xfc6b('0x8')]);module[_0xfc6b('0x9')]=router; \ No newline at end of file +var _0xc604=['put','isAuthenticated','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0xf21887,_0x26ec47){var _0x48d5f7=function(_0x3c2480){while(--_0x3c2480){_0xf21887['push'](_0xf21887['shift']());}};_0x48d5f7(++_0x26ec47);}(_0xc604,0xc6));var _0x4c60=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc604[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4c60('0x0'));var util=require(_0x4c60('0x1'));var path=require(_0x4c60('0x2'));var timeout=require(_0x4c60('0x3'));var express=require(_0x4c60('0x4'));var router=express[_0x4c60('0x5')]();var auth=require(_0x4c60('0x6'));var interaction=require(_0x4c60('0x7'));var config=require(_0x4c60('0x8'));var controller=require(_0x4c60('0x9'));router[_0x4c60('0xa')]('/:id',auth[_0x4c60('0xb')](),controller[_0x4c60('0xc')]);router[_0x4c60('0xd')](_0x4c60('0xe'),auth[_0x4c60('0xb')](),controller[_0x4c60('0xf')]);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 c620ee4..12a5e04 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 _0x1873=['TEXT','exports','STRING'];(function(_0x43c33a,_0x3793d8){var _0x227317=function(_0x3f7130){while(--_0x3f7130){_0x43c33a['push'](_0x43c33a['shift']());}};_0x227317(++_0x3793d8);}(_0x1873,0x121));var _0x3187=function(_0x3bd6cc,_0xd38d81){_0x3bd6cc=_0x3bd6cc-0x0;var _0x44f1dd=_0x1873[_0x3bd6cc];return _0x44f1dd;};'use strict';var Sequelize=require('sequelize');module[_0x3187('0x0')]={'name':{'type':Sequelize[_0x3187('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3187('0x1')]},'parent':{'type':Sequelize[_0x3187('0x1')]},'table':{'type':Sequelize[_0x3187('0x1')]},'conditions':{'type':Sequelize[_0x3187('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfb6f=['TEXT','sequelize','exports','STRING'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0xfb6f,0x129));var _0xffb6=function(_0x4ee6e1,_0x53a113){_0x4ee6e1=_0x4ee6e1-0x0;var _0x18bfff=_0xfb6f[_0x4ee6e1];return _0x18bfff;};'use strict';var Sequelize=require(_0xffb6('0x0'));module[_0xffb6('0x1')]={'name':{'type':Sequelize[_0xffb6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xffb6('0x2')]},'parent':{'type':Sequelize[_0xffb6('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xffb6('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7517a62..008e949 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 _0xd64b=['QueryTypes','SELECT','AVG(%s)','SEC_TO_TIME(%s)','ROUND(%s)','operator','value','Sequelize','ValidationErrorItem','%s.%s\x20=\x20%s.%s','No\x20available\x20data','output','fullPath','%s-%s.%s','generate','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','order','Limited\x20Query:','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','reject','save','UserProfileResource','destroy','then','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filters','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','filtears','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','sequelize','toString'];(function(_0x2809c1,_0xb72d58){var _0x5b44d8=function(_0x5720d0){while(--_0x5720d0){_0x2809c1['push'](_0x2809c1['shift']());}};_0x5b44d8(++_0xb72d58);}(_0xd64b,0xc1));var _0xbd64=function(_0x3093fe,_0x5a0cff){_0x3093fe=_0x3093fe-0x0;var _0x31517d=_0xd64b[_0x3093fe];return _0x31517d;};'use strict';var pdf=require(_0xbd64('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbd64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd64('0x2'));var rp=require(_0xbd64('0x3'));var moment=require(_0xbd64('0x4'));var BPromise=require(_0xbd64('0x5'));var Mustache=require(_0xbd64('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd64('0x7'));var fs=require('fs');var _=require(_0xbd64('0x8'));var squel=require(_0xbd64('0x9'));var crypto=require(_0xbd64('0xa'));var jsforce=require(_0xbd64('0xb'));var deskjs=require(_0xbd64('0xc'));var toCsv=require(_0xbd64('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd64('0xe'));var authService=require(_0xbd64('0xf'));var qs=require(_0xbd64('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd64('0x11'));var logger=require(_0xbd64('0x12'))(_0xbd64('0x13'));var utils=require(_0xbd64('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbd64('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbd64('0x16'))[_0xbd64('0x17')];function respondWithStatusCode(_0x3a941c,_0x2183e2){_0x2183e2=_0x2183e2||0xcc;return function(_0x367824){if(_0x367824){return _0x3a941c[_0xbd64('0x18')](_0x2183e2);}return _0x3a941c[_0xbd64('0x19')](_0x2183e2)[_0xbd64('0x1a')]();};}function respondWithResult(_0x2b5808,_0x4ae471){_0x4ae471=_0x4ae471||0xc8;return function(_0x2d1159){if(_0x2d1159){return _0x2b5808[_0xbd64('0x19')](_0x4ae471)[_0xbd64('0x1b')](_0x2d1159);}};}function respondWithFilteredResult(_0x32fd34,_0x29fc16){return function(_0x49a914){if(_0x49a914){var _0x352e6b=_0x49a914[_0xbd64('0x1c')],_0x5332e0=_0x29fc16[_0xbd64('0x1d')],_0xccb0d5=_0x29fc16[_0xbd64('0x1d')]+_0x29fc16[_0xbd64('0x1e')],_0x1432a6;if(_0xccb0d5>=_0x352e6b){_0xccb0d5=_0x352e6b;_0x1432a6=0xc8;}else{_0x1432a6=0xce;}_0x32fd34[_0xbd64('0x19')](_0x1432a6);return _0x32fd34[_0xbd64('0x1f')]('Content-Range',_0x5332e0+'-'+_0xccb0d5+'/'+_0x352e6b)[_0xbd64('0x1b')](_0x49a914);}return null;};}function patchUpdates(_0x1f618b){return function(_0x575b14){try{jsonpatch['apply'](_0x575b14,_0x1f618b,!![]);}catch(_0xa4647f){return BPromise[_0xbd64('0x20')](_0xa4647f);}return _0x575b14[_0xbd64('0x21')]();};}function saveUpdates(_0x39e2eb,_0x2c5551){return function(_0x816e00){if(_0x816e00){return _0x816e00['update'](_0x39e2eb)['then'](function(_0x6038f){return _0x6038f;});}return null;};}function removeEntity(_0x41f2f,_0x12f67b){return function(_0x365d88){if(_0x365d88){return _0x365d88['destroy']()['then'](function(){var _0x28497c=_0x365d88['get']({'plain':!![]});var _0x46ab38='CustomReports';return db[_0xbd64('0x22')][_0xbd64('0x23')]({'where':{'type':_0x46ab38,'resourceId':_0x28497c['id']}})[_0xbd64('0x24')](function(){return _0x365d88;});})[_0xbd64('0x24')](function(){_0x41f2f['status'](0xcc)[_0xbd64('0x1a')]();});}};}function handleEntityNotFound(_0x3bbfbe,_0x13f527){return function(_0x2a44d0){if(!_0x2a44d0){_0x3bbfbe['sendStatus'](0x194);}return _0x2a44d0;};}function handleError(_0x4e8719,_0x29c9c8){_0x29c9c8=_0x29c9c8||0x1f4;return function(_0x49eac5){logger['error'](_0x49eac5[_0xbd64('0x25')]);if(_0x49eac5['name']){delete _0x49eac5[_0xbd64('0x26')];}_0x4e8719['status'](_0x29c9c8)[_0xbd64('0x27')](_0x49eac5);};}exports['index']=function(_0x1db9f3,_0x3c0eaf){var _0x3be63a={},_0x210fff={},_0x306f19={'count':0x0,'rows':[]};var _0x207ffc=_['map'](db[_0xbd64('0x28')][_0xbd64('0x29')],function(_0xc44280){return{'name':_0xc44280[_0xbd64('0x2a')],'type':_0xc44280[_0xbd64('0x2b')][_0xbd64('0x2c')]};});_0x210fff['model']=_['map'](_0x207ffc,_0xbd64('0x26'));_0x210fff['query']=_[_0xbd64('0x2d')](_0x1db9f3[_0xbd64('0x2e')]);_0x210fff['filters']=_['intersection'](_0x210fff[_0xbd64('0x2f')],_0x210fff['query']);_0x3be63a['attributes']=_[_0xbd64('0x30')](_0x210fff[_0xbd64('0x2f')],qs[_0xbd64('0x31')](_0x1db9f3['query'][_0xbd64('0x31')]));_0x3be63a['attributes']=_0x3be63a[_0xbd64('0x32')][_0xbd64('0x33')]?_0x3be63a[_0xbd64('0x32')]:_0x210fff[_0xbd64('0x2f')];if(!_0x1db9f3[_0xbd64('0x2e')][_0xbd64('0x34')]('nolimit')){_0x3be63a['limit']=qs[_0xbd64('0x1e')](_0x1db9f3[_0xbd64('0x2e')][_0xbd64('0x1e')]);_0x3be63a[_0xbd64('0x1d')]=qs[_0xbd64('0x1d')](_0x1db9f3[_0xbd64('0x2e')]['offset']);}_0x3be63a['order']=qs[_0xbd64('0x35')](_0x1db9f3[_0xbd64('0x2e')][_0xbd64('0x35')]);_0x3be63a['where']=qs['filters'](_[_0xbd64('0x36')](_0x1db9f3['query'],_0x210fff[_0xbd64('0x37')]),_0x207ffc);if(_0x1db9f3['query'][_0xbd64('0x38')]){_0x3be63a[_0xbd64('0x39')]=_['merge'](_0x3be63a[_0xbd64('0x39')],{'$or':_['map'](_0x207ffc,function(_0x534091){if(_0x534091[_0xbd64('0x2b')]!==_0xbd64('0x3a')){var _0x252fc4={};_0x252fc4[_0x534091['name']]={'$like':'%'+_0x1db9f3['query']['filter']+'%'};return _0x252fc4;}})});}_0x3be63a=_[_0xbd64('0x3b')]({},_0x3be63a,_0x1db9f3[_0xbd64('0x3c')]);var _0x51d54b={'where':_0x3be63a[_0xbd64('0x39')]};return db[_0xbd64('0x28')][_0xbd64('0x1c')](_0x51d54b)[_0xbd64('0x24')](function(_0x4e83e0){_0x306f19['count']=_0x4e83e0;if(_0x1db9f3[_0xbd64('0x2e')]['includeAll']){_0x3be63a['include']=[{'all':!![]}];}return db[_0xbd64('0x28')][_0xbd64('0x3d')](_0x3be63a);})[_0xbd64('0x24')](function(_0x1794d0){_0x306f19[_0xbd64('0x3e')]=_0x1794d0;return _0x306f19;})[_0xbd64('0x24')](respondWithFilteredResult(_0x3c0eaf,_0x3be63a))[_0xbd64('0x3f')](handleError(_0x3c0eaf,null));};exports[_0xbd64('0x40')]=function(_0x4870fd,_0x21df6e){var _0x45b3a6={'raw':![],'where':{'id':_0x4870fd[_0xbd64('0x41')]['id']}},_0x54b659={};_0x54b659[_0xbd64('0x2f')]=_[_0xbd64('0x2d')](db[_0xbd64('0x28')][_0xbd64('0x29')]);_0x54b659[_0xbd64('0x2e')]=_[_0xbd64('0x2d')](_0x4870fd['query']);_0x54b659[_0xbd64('0x42')]=_['intersection'](_0x54b659[_0xbd64('0x2f')],_0x54b659['query']);_0x45b3a6[_0xbd64('0x32')]=_[_0xbd64('0x30')](_0x54b659[_0xbd64('0x2f')],qs['fields'](_0x4870fd[_0xbd64('0x2e')]['fields']));_0x45b3a6['attributes']=_0x45b3a6['attributes'][_0xbd64('0x33')]?_0x45b3a6[_0xbd64('0x32')]:_0x54b659[_0xbd64('0x2f')];if(_0x4870fd[_0xbd64('0x2e')][_0xbd64('0x43')]){_0x45b3a6[_0xbd64('0x44')]=[{'all':!![]}];}_0x45b3a6=_[_0xbd64('0x3b')]({},_0x45b3a6,_0x4870fd['options']);return db[_0xbd64('0x28')][_0xbd64('0x45')](_0x45b3a6)[_0xbd64('0x24')](handleEntityNotFound(_0x21df6e,null))['then'](respondWithResult(_0x21df6e,null))[_0xbd64('0x3f')](handleError(_0x21df6e,null));};exports[_0xbd64('0x46')]=function(_0x11cdd4,_0x44812a){return db[_0xbd64('0x28')]['create'](_0x11cdd4[_0xbd64('0x47')],{})[_0xbd64('0x24')](function(_0x2a8011){var _0x2d86d3=_0x11cdd4['user']['get']({'plain':!![]});if(!_0x2d86d3)throw new Error(_0xbd64('0x48'));if(_0x2d86d3[_0xbd64('0x49')]===_0xbd64('0x4a')){var _0x4700a7=_0x2a8011[_0xbd64('0x4b')]({'plain':!![]});var _0x306f6a=_0xbd64('0x4c');return db[_0xbd64('0x4d')][_0xbd64('0x45')]({'where':{'name':_0x306f6a,'userProfileId':_0x2d86d3[_0xbd64('0x4e')]},'raw':!![]})[_0xbd64('0x24')](function(_0x3027bb){if(_0x3027bb&&_0x3027bb[_0xbd64('0x4f')]===0x0){return db[_0xbd64('0x22')][_0xbd64('0x46')]({'name':_0x4700a7['name'],'resourceId':_0x4700a7['id'],'type':_0xbd64('0x50'),'sectionId':_0x3027bb['id']},{})['then'](function(){return _0x2a8011;});}else{return _0x2a8011;}})['catch'](function(_0x552c95){logger['error'](_0xbd64('0x51'),_0x552c95);throw _0x552c95;});}return _0x2a8011;})[_0xbd64('0x24')](respondWithResult(_0x44812a,0xc9))['catch'](handleError(_0x44812a,null));};exports[_0xbd64('0x52')]=function(_0x1b0a0b,_0x46a3af){if(_0x1b0a0b['body']['id']){delete _0x1b0a0b[_0xbd64('0x47')]['id'];}return db[_0xbd64('0x28')][_0xbd64('0x45')]({'where':{'id':_0x1b0a0b[_0xbd64('0x41')]['id']}})[_0xbd64('0x24')](handleEntityNotFound(_0x46a3af,null))[_0xbd64('0x24')](saveUpdates(_0x1b0a0b['body'],null))['then'](respondWithResult(_0x46a3af,null))['catch'](handleError(_0x46a3af,null));};exports[_0xbd64('0x23')]=function(_0x15c0de,_0x3548fe){return db[_0xbd64('0x28')]['find']({'where':{'id':_0x15c0de[_0xbd64('0x41')]['id']}})[_0xbd64('0x24')](handleEntityNotFound(_0x3548fe,null))[_0xbd64('0x24')](removeEntity(_0x3548fe,null))[_0xbd64('0x3f')](handleError(_0x3548fe,null));};exports[_0xbd64('0x53')]=function(_0xe24e44,_0x546790){var _0x270910=0xa;var _0x671176=[_0xbd64('0x54'),_0xbd64('0x55'),_0xbd64('0x56'),_0xbd64('0x57')];var _0xeab5c7={'SUM':_0xbd64('0x58'),'COUNT':_0xbd64('0x59'),'COUNT DISTINCT':_0xbd64('0x5a'),'MAX':_0xbd64('0x5b'),'MIN':_0xbd64('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbd64('0x5d'),'GROUP_CONCAT DESC':_0xbd64('0x5e')};var _0x5ab7b3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbd64('0x5f'),'HOUR':_0xbd64('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbd64('0x61')};var _0x13f083=function(_0x45573c){return!_[_0xbd64('0x62')]([_0xbd64('0x63'),_0xbd64('0x64'),_0xbd64('0x65'),_0xbd64('0x66')],_0x45573c);};var _0x3174ec=function(_0x4d9cd6){if(!_0x4d9cd6||!_0x4d9cd6[_0xbd64('0x67')][_0xbd64('0x33')]){return'';}for(var _0x166783='(',_0x5054a6=0x0;_0x5054a6<_0x4d9cd6[_0xbd64('0x67')][_0xbd64('0x33')];_0x5054a6+=0x1){_0x5054a6>0x0&&(_0x166783+='\x20'+_0x4d9cd6['operator']+'\x20');_0x166783+=_0x4d9cd6[_0xbd64('0x67')][_0x5054a6][_0xbd64('0x68')]?_0x3174ec(_0x4d9cd6[_0xbd64('0x67')][_0x5054a6][_0xbd64('0x68')]):_0x4d9cd6[_0xbd64('0x67')][_0x5054a6][_0xbd64('0x69')]+'\x20'+_0x4d9cd6['rules'][_0x5054a6][_0xbd64('0x6a')]+(_0x13f083(_0x4d9cd6[_0xbd64('0x67')][_0x5054a6][_0xbd64('0x6a')])?'\x20'+_0x4d9cd6[_0xbd64('0x67')][_0x5054a6]['value']:'');}return _0x166783+')';};var _0xff862e={'where':{'id':_0xe24e44[_0xbd64('0x41')]['id']}},_0x1c8b40,_0x502d84,_0x78d88,_0x4e62c2,_0x26e0bc;_0xff862e=_[_0xbd64('0x3b')]({},_0xff862e,_0xe24e44[_0xbd64('0x3c')]);return db['AnalyticCustomReport'][_0xbd64('0x45')](_0xff862e)[_0xbd64('0x24')](function(_0x30bdef){if(_0x30bdef){_0x1c8b40=_0x30bdef;return _0x30bdef[_0xbd64('0x6b')]();}return null;})[_0xbd64('0x24')](function(_0x1a6e95){if(_0x1a6e95){if(!_0x1a6e95['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xbd64('0x6c'),0x193);}_0x502d84=_0x1a6e95;return db[_0xbd64('0x6d')][_0xbd64('0x3d')]({'raw':!![]});}return null;})[_0xbd64('0x24')](function(_0x1a8e6f){if(_0x1a8e6f){_0x78d88=_[_0xbd64('0x6e')](_0x1a8e6f,'id');var _0x53b6f4;var _0x30eddc=squel[_0xbd64('0x6f')]();_0x30eddc[_0xbd64('0x70')](_0x1c8b40[_0xbd64('0x71')]);for(var _0x12f171=0x0;_0x12f171<_0x502d84[_0xbd64('0x33')];_0x12f171+=0x1){_0x53b6f4=_0x502d84[_0x12f171][_0xbd64('0x72')]?_0x78d88[_0x502d84[_0x12f171][_0xbd64('0x72')]][_0xbd64('0x73')]:_0x502d84[_0x12f171][_0xbd64('0x69')];_0x53b6f4=_0x502d84[_0x12f171][_0xbd64('0x74')]?_[_0xbd64('0x75')](_0xeab5c7[_0x502d84[_0x12f171]['function']],'%s',_0x53b6f4):_0x53b6f4;_0x53b6f4=_0x502d84[_0x12f171]['format']?_[_0xbd64('0x75')](_0x5ab7b3[_0x502d84[_0x12f171][_0xbd64('0x76')]],'%s',_0x53b6f4):_0x53b6f4;if(_0x502d84[_0x12f171][_0xbd64('0x77')]){_0x30eddc['group'](_0x53b6f4);}_0x502d84[_0x12f171][_0xbd64('0x78')]&&_0x30eddc['order'](_0x53b6f4,_0x502d84[_0x12f171][_0xbd64('0x78')]===_0xbd64('0x79')?![]:!![]);_0x30eddc[_0xbd64('0x69')](_0x53b6f4,_0x502d84[_0x12f171][_0xbd64('0x7a')]||_0x53b6f4);}if(_0x1c8b40['joins']){_0x1c8b40[_0xbd64('0x7b')]=JSON['parse'](_0x1c8b40[_0xbd64('0x7b')]);for(var _0x3929d9=0x0;_0x3929d9<_0x1c8b40[_0xbd64('0x7b')][_0xbd64('0x33')];_0x3929d9+=0x1){if(_0x1c8b40[_0xbd64('0x7b')][_0x3929d9]['type']&&_[_0xbd64('0x62')](_0x671176,_0x1c8b40[_0xbd64('0x7b')][_0x3929d9]['type'])&&_0x1c8b40[_0xbd64('0x7b')][_0x3929d9][_0xbd64('0x7c')]&&_0x1c8b40[_0xbd64('0x7b')][_0x3929d9][_0xbd64('0x7d')]&&_0x1c8b40['joins'][_0x3929d9][_0xbd64('0x7e')]){_0x30eddc[_0x1c8b40['joins'][_0x3929d9][_0xbd64('0x2b')]](_0x1c8b40[_0xbd64('0x7b')][_0x3929d9][_0xbd64('0x7d')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1c8b40['table'],_0x1c8b40['joins'][_0x3929d9][_0xbd64('0x7c')],_0x1c8b40[_0xbd64('0x7b')][_0x3929d9][_0xbd64('0x7d')],_0x1c8b40[_0xbd64('0x7b')][_0x3929d9][_0xbd64('0x7e')]));}}}if(_0x1c8b40['conditions']){_0x1c8b40[_0xbd64('0x7f')]=JSON[_0xbd64('0x80')](_0x1c8b40[_0xbd64('0x7f')]);_0x30eddc[_0xbd64('0x39')](_0x3174ec(_0x1c8b40[_0xbd64('0x7f')]['group']));}_0x26e0bc=_0x30eddc[_0xbd64('0x81')]();_0x30eddc[_0xbd64('0x1e')](_0x270910);_0x30eddc[_0xbd64('0x1d')](0x0);logger[_0xbd64('0x82')]('Limited\x20Query:',_0x30eddc['toString']());return db[_0xbd64('0x83')][_0xbd64('0x2e')](_0x30eddc[_0xbd64('0x84')](),{'type':db[_0xbd64('0x83')][_0xbd64('0x85')][_0xbd64('0x86')]});}})[_0xbd64('0x24')](respondWithResult(_0x546790,null))[_0xbd64('0x3f')](handleError(_0x546790,null));};function runReport(_0x499831,_0x34bdad,_0x4be31a){var _0x1be9da=_0x34bdad[_0xbd64('0x26')];var _0x1aca4d=0xa;var _0x4994c9=[_0xbd64('0x54'),'left_join','right_join',_0xbd64('0x57')];var _0x44d162={'SUM':_0xbd64('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbd64('0x5a'),'MAX':_0xbd64('0x5b'),'MIN':_0xbd64('0x5c'),'AVG':_0xbd64('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbd64('0x5d'),'GROUP_CONCAT DESC':_0xbd64('0x5e')};var _0x355b87={'SEC_TO_TIME':_0xbd64('0x88'),'DATE':_0xbd64('0x5f'),'HOUR':_0xbd64('0x60'),'ROUND':_0xbd64('0x89'),'UNIX_TIMESTAMP':_0xbd64('0x61')};var _0x8a6280=function(_0x39a803){return!_[_0xbd64('0x62')]([_0xbd64('0x63'),_0xbd64('0x64'),_0xbd64('0x65'),'IS\x20NOT\x20EMPTY'],_0x39a803);};var _0x56d681=function(_0x11f9b2){if(!_0x11f9b2||!_0x11f9b2[_0xbd64('0x67')][_0xbd64('0x33')]){return'';}for(var _0x586056='(',_0x2b1c21=0x0;_0x2b1c21<_0x11f9b2['rules'][_0xbd64('0x33')];_0x2b1c21+=0x1){_0x2b1c21>0x0&&(_0x586056+='\x20'+_0x11f9b2[_0xbd64('0x8a')]+'\x20');_0x586056+=_0x11f9b2[_0xbd64('0x67')][_0x2b1c21][_0xbd64('0x68')]?_0x56d681(_0x11f9b2['rules'][_0x2b1c21][_0xbd64('0x68')]):_0x11f9b2[_0xbd64('0x67')][_0x2b1c21]['field']+'\x20'+_0x11f9b2[_0xbd64('0x67')][_0x2b1c21]['condition']+(_0x8a6280(_0x11f9b2[_0xbd64('0x67')][_0x2b1c21][_0xbd64('0x6a')])?'\x20'+_0x11f9b2[_0xbd64('0x67')][_0x2b1c21][_0xbd64('0x8b')]:'');}return _0x586056+')';};var _0x30b3a1={'where':{'id':_0x499831['id']}},_0x38b974,_0x53717e,_0x4190a3,_0x588452,_0x366672;_0x30b3a1=_[_0xbd64('0x3b')]({},_0x30b3a1,_0x4be31a);return db['AnalyticCustomReport'][_0xbd64('0x45')](_0x30b3a1)['then'](function(_0x2799cc){if(_0x2799cc){_0x38b974=_0x2799cc;return _0x2799cc[_0xbd64('0x6b')]();}return null;})[_0xbd64('0x24')](function(_0x4bf21a){if(_0x4bf21a){if(!_0x4bf21a[_0xbd64('0x33')]){throw new db[(_0xbd64('0x8c'))][(_0xbd64('0x8d'))](_0xbd64('0x6c'),0x193);}_0x53717e=_0x4bf21a;return db[_0xbd64('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x42feee){if(_0x42feee){_0x4190a3=_[_0xbd64('0x6e')](_0x42feee,'id');var _0xeb9c51;var _0x1f1170=squel[_0xbd64('0x6f')]();_0x1f1170[_0xbd64('0x70')](_0x38b974[_0xbd64('0x71')]);for(var _0xd8f344=0x0;_0xd8f344<_0x53717e[_0xbd64('0x33')];_0xd8f344+=0x1){_0xeb9c51=_0x53717e[_0xd8f344][_0xbd64('0x72')]?_0x4190a3[_0x53717e[_0xd8f344][_0xbd64('0x72')]][_0xbd64('0x73')]:_0x53717e[_0xd8f344][_0xbd64('0x69')];_0xeb9c51=_0x53717e[_0xd8f344]['function']?_[_0xbd64('0x75')](_0x44d162[_0x53717e[_0xd8f344][_0xbd64('0x74')]],'%s',_0xeb9c51):_0xeb9c51;_0xeb9c51=_0x53717e[_0xd8f344]['format']?_[_0xbd64('0x75')](_0x355b87[_0x53717e[_0xd8f344][_0xbd64('0x76')]],'%s',_0xeb9c51):_0xeb9c51;if(_0x53717e[_0xd8f344][_0xbd64('0x77')]){_0x1f1170[_0xbd64('0x68')](_0xeb9c51);}_0x53717e[_0xd8f344]['orderBy']&&_0x1f1170['order'](_0xeb9c51,_0x53717e[_0xd8f344][_0xbd64('0x78')]===_0xbd64('0x79')?![]:!![]);_0x1f1170[_0xbd64('0x69')](_0xeb9c51,_0x53717e[_0xd8f344][_0xbd64('0x7a')]||_0xeb9c51);}if(_0x38b974[_0xbd64('0x7b')]){_0x38b974[_0xbd64('0x7b')]=JSON[_0xbd64('0x80')](_0x38b974[_0xbd64('0x7b')]);for(var _0x1cb98a=0x0;_0x1cb98a<_0x38b974[_0xbd64('0x7b')][_0xbd64('0x33')];_0x1cb98a+=0x1){if(_0x38b974[_0xbd64('0x7b')][_0x1cb98a]['type']&&_[_0xbd64('0x62')](_0x4994c9,_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x2b')])&&_0x38b974['joins'][_0x1cb98a]['parentKey']&&_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x7d')]&&_0x38b974['joins'][_0x1cb98a][_0xbd64('0x7e')]){_0x1f1170[_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x2b')]](_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x7d')],null,util[_0xbd64('0x76')](_0xbd64('0x8e'),_0x38b974[_0xbd64('0x71')],_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x7c')],_0x38b974[_0xbd64('0x7b')][_0x1cb98a][_0xbd64('0x7d')],_0x38b974['joins'][_0x1cb98a][_0xbd64('0x7e')]));}}}if(_0x38b974['conditions']){_0x38b974[_0xbd64('0x7f')]=JSON[_0xbd64('0x80')](_0x38b974[_0xbd64('0x7f')]);_0x1f1170[_0xbd64('0x39')](_0x56d681(_0x38b974[_0xbd64('0x7f')]['group']));}_0x366672=_0x1f1170[_0xbd64('0x81')]();_0x1f1170[_0xbd64('0x1e')](_0x1aca4d);_0x1f1170[_0xbd64('0x1d')](0x0);logger[_0xbd64('0x82')]('Limited\x20Query:',_0x1f1170[_0xbd64('0x84')]());return db['sequelize'][_0xbd64('0x2e')](_0x1f1170[_0xbd64('0x84')](),{'type':db[_0xbd64('0x83')][_0xbd64('0x85')][_0xbd64('0x86')]});}})[_0xbd64('0x24')](function(_0x42a94b){if(!_0x42a94b['length']){throw new db[(_0xbd64('0x8c'))][(_0xbd64('0x8d'))](_0xbd64('0x8f'),0xcc);}if(_0x34bdad[_0xbd64('0x90')]==='web'){return null;}var _0x38b2b3=_[_0xbd64('0x3b')](_0x34bdad,{'name':_0x34bdad[_0xbd64('0x91')]||_0x34bdad[_0xbd64('0x26')]||_0x38b974[_0xbd64('0x26')],'basename':_0x1be9da,'savename':util[_0xbd64('0x76')](_0xbd64('0x92'),_0x34bdad['name']||_0x38b974[_0xbd64('0x26')],require('randomstring')[_0xbd64('0x93')](0x4),_0x34bdad['output']||'csv'),'reportId':_0x38b974['id'],'reportType':_0xbd64('0x94')});return db[_0xbd64('0x95')][_0xbd64('0x46')](_0x38b2b3,{'raw':!![]});})['then'](function(_0x3773e8){if(_0x38b974['table']===_0xbd64('0x96')){_0x366672['where'](_0x38b974['table']+_0xbd64('0x97'),_0x34bdad[_0xbd64('0x98')],_0x34bdad[_0xbd64('0x99')]);}else{_0x366672[_0xbd64('0x39')](_0x38b974[_0xbd64('0x71')]+_0xbd64('0x9a'),_0x34bdad[_0xbd64('0x98')],_0x34bdad[_0xbd64('0x99')]);}if(_0x3773e8){logger['info']('Run\x20Query:',_0x366672[_0xbd64('0x84')]());require('child_process')[_0xbd64('0x9b')](path[_0xbd64('0x54')](__dirname,_0xbd64('0x9c'),_0x3773e8['output']),[_0x3773e8['id'],_0x366672[_0xbd64('0x84')](),path[_0xbd64('0x54')](__dirname,'../../files/reports',_0x3773e8[_0xbd64('0x9d')]),_0x1be9da]);return _0x3773e8;}else{var _0x35804f=squel['select']();_0x35804f['from']('('+_0x366672[_0xbd64('0x84')]()+')',_0xbd64('0x9e'));_0x35804f[_0xbd64('0x69')](_0xbd64('0x9f'),_0xbd64('0x1c'));_0x366672[_0xbd64('0x1e')](_0x34bdad[_0xbd64('0x1e')]||_0x1aca4d);_0x366672[_0xbd64('0x1d')](_0x34bdad[_0xbd64('0x1d')]||0x0);return dbH[_0xbd64('0x83')][_0xbd64('0x2e')](_0x35804f[_0xbd64('0x84')](),{'type':dbH[_0xbd64('0x83')][_0xbd64('0x85')][_0xbd64('0x86')]})['then'](function(_0x2a6b2f){if(!_0x2a6b2f['length']){_0x588452=0x0;}else{_0x588452=_0x2a6b2f[0x0][_0xbd64('0x1c')]||0x0;}return dbH[_0xbd64('0x83')]['query'](_0x366672[_0xbd64('0x84')](),{'type':dbH['sequelize'][_0xbd64('0x85')][_0xbd64('0x86')]});})[_0xbd64('0x24')](function(_0x32ba67){return{'rows':_0x32ba67||[],'count':_0x588452};});}});}exports['run']=function(_0xd277e3,_0x775537){return runReport(_0xd277e3[_0xbd64('0x41')],_0xd277e3[_0xbd64('0x2e')],_0xd277e3['options'])['then'](respondWithResult(_0x775537,null))[_0xbd64('0x3f')](handleError(_0x775537,null));};exports[_0xbd64('0xa0')]=runReport;exports[_0xbd64('0x2e')]=function(_0x498c7e,_0x16d7a9){var _0x56842b=0xa;var _0xa11c33=[_0xbd64('0x54'),_0xbd64('0x55'),_0xbd64('0x56'),_0xbd64('0x57')];var _0x4e20e9={'SUM':'SUM(%s)','COUNT':_0xbd64('0x59'),'COUNT DISTINCT':_0xbd64('0x5a'),'MAX':_0xbd64('0x5b'),'MIN':'MIN(%s)','AVG':_0xbd64('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbd64('0x5d'),'GROUP_CONCAT DESC':_0xbd64('0x5e')};var _0x1ab320={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbd64('0x5f'),'HOUR':_0xbd64('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x13be0b=function(_0x4dd76f){return!_['includes']([_0xbd64('0x63'),_0xbd64('0x64'),'IS\x20EMPTY',_0xbd64('0x66')],_0x4dd76f);};var _0x540513=function(_0x4011c5){if(!_0x4011c5||!_0x4011c5[_0xbd64('0x67')][_0xbd64('0x33')]){return'';}for(var _0x4a93c2='(',_0x2e8851=0x0;_0x2e8851<_0x4011c5['rules']['length'];_0x2e8851+=0x1){_0x2e8851>0x0&&(_0x4a93c2+='\x20'+_0x4011c5['operator']+'\x20');_0x4a93c2+=_0x4011c5[_0xbd64('0x67')][_0x2e8851][_0xbd64('0x68')]?_0x540513(_0x4011c5[_0xbd64('0x67')][_0x2e8851]['group']):_0x4011c5[_0xbd64('0x67')][_0x2e8851]['field']+'\x20'+_0x4011c5[_0xbd64('0x67')][_0x2e8851]['condition']+(_0x13be0b(_0x4011c5['rules'][_0x2e8851]['condition'])?'\x20'+_0x4011c5[_0xbd64('0x67')][_0x2e8851][_0xbd64('0x8b')]:'');}return _0x4a93c2+')';};var _0x986e85={'where':{'id':_0x498c7e['params']['id']}},_0x2ccf8d,_0x4d6781,_0x4094b8,_0x13e3cb,_0xef51de;_0x986e85=_[_0xbd64('0x3b')]({},_0x986e85,_0x498c7e['options']);return db[_0xbd64('0x28')][_0xbd64('0x45')](_0x986e85)[_0xbd64('0x24')](function(_0x27ae4b){if(_0x27ae4b){_0x2ccf8d=_0x27ae4b;return _0x27ae4b[_0xbd64('0x6b')]();}return null;})[_0xbd64('0x24')](function(_0x1f93f9){if(_0x1f93f9){if(!_0x1f93f9[_0xbd64('0x33')]){throw new db[(_0xbd64('0x8c'))][(_0xbd64('0x8d'))](_0xbd64('0x6c'),0x193);}_0x4d6781=_0x1f93f9;return db[_0xbd64('0x6d')][_0xbd64('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x5417af){if(_0x5417af){_0x4094b8=_[_0xbd64('0x6e')](_0x5417af,'id');var _0x30b845;var _0x424f0f=squel[_0xbd64('0x6f')]();_0x424f0f['from'](_0x2ccf8d[_0xbd64('0x71')]);for(var _0x4aa260=0x0;_0x4aa260<_0x4d6781[_0xbd64('0x33')];_0x4aa260+=0x1){_0x30b845=_0x4d6781[_0x4aa260]['MetricId']?_0x4094b8[_0x4d6781[_0x4aa260]['MetricId']][_0xbd64('0x73')]:_0x4d6781[_0x4aa260][_0xbd64('0x69')];_0x30b845=_0x4d6781[_0x4aa260]['function']?_[_0xbd64('0x75')](_0x4e20e9[_0x4d6781[_0x4aa260]['function']],'%s',_0x30b845):_0x30b845;_0x30b845=_0x4d6781[_0x4aa260][_0xbd64('0x76')]?_['replace'](_0x1ab320[_0x4d6781[_0x4aa260][_0xbd64('0x76')]],'%s',_0x30b845):_0x30b845;if(_0x4d6781[_0x4aa260][_0xbd64('0x77')]){_0x424f0f[_0xbd64('0x68')](_0x30b845);}_0x4d6781[_0x4aa260]['orderBy']&&_0x424f0f[_0xbd64('0xa1')](_0x30b845,_0x4d6781[_0x4aa260][_0xbd64('0x78')]===_0xbd64('0x79')?![]:!![]);_0x424f0f[_0xbd64('0x69')](_0x30b845,_0x4d6781[_0x4aa260][_0xbd64('0x7a')]||_0x30b845);}if(_0x2ccf8d[_0xbd64('0x7b')]){_0x2ccf8d[_0xbd64('0x7b')]=JSON['parse'](_0x2ccf8d[_0xbd64('0x7b')]);for(var _0x38ed53=0x0;_0x38ed53<_0x2ccf8d['joins']['length'];_0x38ed53+=0x1){if(_0x2ccf8d['joins'][_0x38ed53][_0xbd64('0x2b')]&&_[_0xbd64('0x62')](_0xa11c33,_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53]['type'])&&_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53]['parentKey']&&_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53]['foreignTable']&&_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53][_0xbd64('0x7e')]){_0x424f0f[_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53][_0xbd64('0x2b')]](_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53][_0xbd64('0x7d')],null,util[_0xbd64('0x76')](_0xbd64('0x8e'),_0x2ccf8d[_0xbd64('0x71')],_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53][_0xbd64('0x7c')],_0x2ccf8d['joins'][_0x38ed53][_0xbd64('0x7d')],_0x2ccf8d[_0xbd64('0x7b')][_0x38ed53][_0xbd64('0x7e')]));}}}if(_0x2ccf8d[_0xbd64('0x7f')]){_0x2ccf8d[_0xbd64('0x7f')]=JSON[_0xbd64('0x80')](_0x2ccf8d[_0xbd64('0x7f')]);_0x424f0f[_0xbd64('0x39')](_0x540513(_0x2ccf8d[_0xbd64('0x7f')]['group']));}_0xef51de=_0x424f0f['clone']();_0x424f0f[_0xbd64('0x1e')](_0x56842b);_0x424f0f[_0xbd64('0x1d')](0x0);logger['debug'](_0xbd64('0xa2'),_0x424f0f[_0xbd64('0x84')]());return db['sequelize'][_0xbd64('0x2e')](_0x424f0f['toString'](),{'type':db[_0xbd64('0x83')][_0xbd64('0x85')][_0xbd64('0x86')]});}})[_0xbd64('0x24')](function(){return{'sql':_0xef51de[_0xbd64('0x84')]()};})['then'](respondWithResult(_0x16d7a9,null))['catch'](handleError(_0x16d7a9,null));}; \ No newline at end of file +var _0xb43b=['options','includeAll','include','findAll','rows','catch','show','rawAttributes','filtears','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','AnalyticMetric','keyBy','select','from','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','AVG(%s)','order','alias','debug','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','MIN(%s)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','error','stack','name','status','send','AnalyticCustomReport','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3851a3,_0x12fc6a){_0x3851a3=_0x3851a3-0x0;var _0x1b18c2=_0xb43b[_0x3851a3];return _0x1b18c2;};'use strict';var pdf=require(_0xbb43('0x0'));var emlformat=require(_0xbb43('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb43('0x2'));var jsonpatch=require(_0xbb43('0x3'));var rp=require(_0xbb43('0x4'));var moment=require('moment');var BPromise=require(_0xbb43('0x5'));var Mustache=require(_0xbb43('0x6'));var util=require(_0xbb43('0x7'));var path=require(_0xbb43('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb43('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x41e7e5,_0x4a3714){_0x4a3714=_0x4a3714||0xcc;return function(_0x593d0b){if(_0x593d0b){return _0x41e7e5[_0xbb43('0x19')](_0x4a3714);}return _0x41e7e5['status'](_0x4a3714)[_0xbb43('0x1a')]();};}function respondWithResult(_0x43021d,_0x55926f){_0x55926f=_0x55926f||0xc8;return function(_0x4a6e18){if(_0x4a6e18){return _0x43021d['status'](_0x55926f)[_0xbb43('0x1b')](_0x4a6e18);}};}function respondWithFilteredResult(_0x2abce0,_0x57bd1d){return function(_0x526330){if(_0x526330){var _0x202980=_0x526330[_0xbb43('0x1c')],_0x563ce1=_0x57bd1d[_0xbb43('0x1d')],_0x5923dc=_0x57bd1d['offset']+_0x57bd1d[_0xbb43('0x1e')],_0x2b0797;if(_0x5923dc>=_0x202980){_0x5923dc=_0x202980;_0x2b0797=0xc8;}else{_0x2b0797=0xce;}_0x2abce0['status'](_0x2b0797);return _0x2abce0[_0xbb43('0x1f')](_0xbb43('0x20'),_0x563ce1+'-'+_0x5923dc+'/'+_0x202980)['json'](_0x526330);}return null;};}function patchUpdates(_0x5d765b){return function(_0xf8f3ef){try{jsonpatch[_0xbb43('0x21')](_0xf8f3ef,_0x5d765b,!![]);}catch(_0xdb7f2e){return BPromise[_0xbb43('0x22')](_0xdb7f2e);}return _0xf8f3ef['save']();};}function saveUpdates(_0x40a650,_0x5f4416){return function(_0x3a257d){if(_0x3a257d){return _0x3a257d['update'](_0x40a650)[_0xbb43('0x23')](function(_0x565256){return _0x565256;});}return null;};}function removeEntity(_0x3f323e,_0x451cbd){return function(_0x577ddd){if(_0x577ddd){return _0x577ddd[_0xbb43('0x24')]()['then'](function(){var _0xf24e60=_0x577ddd[_0xbb43('0x25')]({'plain':!![]});var _0x16384e='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x16384e,'resourceId':_0xf24e60['id']}})[_0xbb43('0x23')](function(){return _0x577ddd;});})[_0xbb43('0x23')](function(){_0x3f323e['status'](0xcc)[_0xbb43('0x1a')]();});}};}function handleEntityNotFound(_0x2da653,_0x226827){return function(_0x3874fb){if(!_0x3874fb){_0x2da653['sendStatus'](0x194);}return _0x3874fb;};}function handleError(_0x4b5342,_0x27fd7a){_0x27fd7a=_0x27fd7a||0x1f4;return function(_0x42800f){logger[_0xbb43('0x26')](_0x42800f[_0xbb43('0x27')]);if(_0x42800f[_0xbb43('0x28')]){delete _0x42800f[_0xbb43('0x28')];}_0x4b5342[_0xbb43('0x29')](_0x27fd7a)[_0xbb43('0x2a')](_0x42800f);};}exports['index']=function(_0x2ad6da,_0x56fe33){var _0x31fbc8={},_0x436fd5={},_0x34f5b2={'count':0x0,'rows':[]};var _0x1880cd=_['map'](db[_0xbb43('0x2b')]['rawAttributes'],function(_0x5566cf){return{'name':_0x5566cf['fieldName'],'type':_0x5566cf[_0xbb43('0x2c')]['key']};});_0x436fd5[_0xbb43('0x2d')]=_[_0xbb43('0x2e')](_0x1880cd,_0xbb43('0x28'));_0x436fd5['query']=_[_0xbb43('0x2f')](_0x2ad6da[_0xbb43('0x30')]);_0x436fd5[_0xbb43('0x31')]=_[_0xbb43('0x32')](_0x436fd5[_0xbb43('0x2d')],_0x436fd5[_0xbb43('0x30')]);_0x31fbc8[_0xbb43('0x33')]=_[_0xbb43('0x32')](_0x436fd5['model'],qs[_0xbb43('0x34')](_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x34')]));_0x31fbc8[_0xbb43('0x33')]=_0x31fbc8[_0xbb43('0x33')][_0xbb43('0x35')]?_0x31fbc8[_0xbb43('0x33')]:_0x436fd5[_0xbb43('0x2d')];if(!_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x36')](_0xbb43('0x37'))){_0x31fbc8[_0xbb43('0x1e')]=qs[_0xbb43('0x1e')](_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x1e')]);_0x31fbc8[_0xbb43('0x1d')]=qs['offset'](_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x1d')]);}_0x31fbc8['order']=qs[_0xbb43('0x38')](_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x38')]);_0x31fbc8['where']=qs['filters'](_['pick'](_0x2ad6da[_0xbb43('0x30')],_0x436fd5[_0xbb43('0x31')]),_0x1880cd);if(_0x2ad6da['query']['filter']){_0x31fbc8[_0xbb43('0x39')]=_[_0xbb43('0x3a')](_0x31fbc8[_0xbb43('0x39')],{'$or':_[_0xbb43('0x2e')](_0x1880cd,function(_0x3f9e7f){if(_0x3f9e7f['type']!==_0xbb43('0x3b')){var _0x526cb8={};_0x526cb8[_0x3f9e7f[_0xbb43('0x28')]]={'$like':'%'+_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x3c')]+'%'};return _0x526cb8;}})});}_0x31fbc8=_['merge']({},_0x31fbc8,_0x2ad6da[_0xbb43('0x3d')]);var _0x4f0f13={'where':_0x31fbc8[_0xbb43('0x39')]};return db[_0xbb43('0x2b')]['count'](_0x4f0f13)[_0xbb43('0x23')](function(_0x5e854b){_0x34f5b2[_0xbb43('0x1c')]=_0x5e854b;if(_0x2ad6da[_0xbb43('0x30')][_0xbb43('0x3e')]){_0x31fbc8[_0xbb43('0x3f')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xbb43('0x40')](_0x31fbc8);})[_0xbb43('0x23')](function(_0x59750b){_0x34f5b2[_0xbb43('0x41')]=_0x59750b;return _0x34f5b2;})['then'](respondWithFilteredResult(_0x56fe33,_0x31fbc8))[_0xbb43('0x42')](handleError(_0x56fe33,null));};exports[_0xbb43('0x43')]=function(_0xcb5000,_0x14e57e){var _0x37ffb7={'raw':![],'where':{'id':_0xcb5000['params']['id']}},_0x1e762c={};_0x1e762c[_0xbb43('0x2d')]=_['keys'](db[_0xbb43('0x2b')][_0xbb43('0x44')]);_0x1e762c[_0xbb43('0x30')]=_[_0xbb43('0x2f')](_0xcb5000['query']);_0x1e762c[_0xbb43('0x45')]=_[_0xbb43('0x32')](_0x1e762c[_0xbb43('0x2d')],_0x1e762c[_0xbb43('0x30')]);_0x37ffb7[_0xbb43('0x33')]=_[_0xbb43('0x32')](_0x1e762c[_0xbb43('0x2d')],qs[_0xbb43('0x34')](_0xcb5000['query'][_0xbb43('0x34')]));_0x37ffb7[_0xbb43('0x33')]=_0x37ffb7['attributes'][_0xbb43('0x35')]?_0x37ffb7['attributes']:_0x1e762c['model'];if(_0xcb5000['query']['includeAll']){_0x37ffb7[_0xbb43('0x3f')]=[{'all':!![]}];}_0x37ffb7=_['merge']({},_0x37ffb7,_0xcb5000[_0xbb43('0x3d')]);return db['AnalyticCustomReport'][_0xbb43('0x46')](_0x37ffb7)[_0xbb43('0x23')](handleEntityNotFound(_0x14e57e,null))[_0xbb43('0x23')](respondWithResult(_0x14e57e,null))['catch'](handleError(_0x14e57e,null));};exports[_0xbb43('0x47')]=function(_0x4d9f18,_0x3edc65){return db[_0xbb43('0x2b')][_0xbb43('0x47')](_0x4d9f18[_0xbb43('0x48')],{})[_0xbb43('0x23')](function(_0x13d0a5){var _0x37d8d3=_0x4d9f18['user'][_0xbb43('0x25')]({'plain':!![]});if(!_0x37d8d3)throw new Error(_0xbb43('0x49'));if(_0x37d8d3[_0xbb43('0x4a')]===_0xbb43('0x4b')){var _0x4bea2a=_0x13d0a5[_0xbb43('0x25')]({'plain':!![]});var _0x3233b7=_0xbb43('0x4c');return db[_0xbb43('0x4d')]['find']({'where':{'name':_0x3233b7,'userProfileId':_0x37d8d3[_0xbb43('0x4e')]},'raw':!![]})[_0xbb43('0x23')](function(_0x427618){if(_0x427618&&_0x427618['autoAssociation']===0x0){return db[_0xbb43('0x4f')][_0xbb43('0x47')]({'name':_0x4bea2a[_0xbb43('0x28')],'resourceId':_0x4bea2a['id'],'type':_0xbb43('0x50'),'sectionId':_0x427618['id']},{})[_0xbb43('0x23')](function(){return _0x13d0a5;});}else{return _0x13d0a5;}})['catch'](function(_0x4cd4cd){logger[_0xbb43('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cd4cd);throw _0x4cd4cd;});}return _0x13d0a5;})[_0xbb43('0x23')](respondWithResult(_0x3edc65,0xc9))[_0xbb43('0x42')](handleError(_0x3edc65,null));};exports['update']=function(_0x29aea0,_0x3719dc){if(_0x29aea0[_0xbb43('0x48')]['id']){delete _0x29aea0[_0xbb43('0x48')]['id'];}return db[_0xbb43('0x2b')]['find']({'where':{'id':_0x29aea0[_0xbb43('0x51')]['id']}})['then'](handleEntityNotFound(_0x3719dc,null))['then'](saveUpdates(_0x29aea0[_0xbb43('0x48')],null))[_0xbb43('0x23')](respondWithResult(_0x3719dc,null))[_0xbb43('0x42')](handleError(_0x3719dc,null));};exports[_0xbb43('0x24')]=function(_0x129ee6,_0x5db053){return db['AnalyticCustomReport'][_0xbb43('0x46')]({'where':{'id':_0x129ee6[_0xbb43('0x51')]['id']}})[_0xbb43('0x23')](handleEntityNotFound(_0x5db053,null))[_0xbb43('0x23')](removeEntity(_0x5db053,null))[_0xbb43('0x42')](handleError(_0x5db053,null));};exports[_0xbb43('0x52')]=function(_0x44691b,_0x14fce0){var _0x1a3f98=0xa;var _0x578b85=[_0xbb43('0x53'),_0xbb43('0x54'),_0xbb43('0x55'),_0xbb43('0x56')];var _0x22bceb={'SUM':_0xbb43('0x57'),'COUNT':_0xbb43('0x58'),'COUNT DISTINCT':_0xbb43('0x59'),'MAX':_0xbb43('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbb43('0x5b'),'GROUP_CONCAT ASC':_0xbb43('0x5c'),'GROUP_CONCAT DESC':_0xbb43('0x5d')};var _0x3d4692={'SEC_TO_TIME':_0xbb43('0x5e'),'DATE':_0xbb43('0x5f'),'HOUR':_0xbb43('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbb43('0x61')};var _0x599eec=function(_0x5a6ff0){return!_[_0xbb43('0x62')]([_0xbb43('0x63'),_0xbb43('0x64'),_0xbb43('0x65'),_0xbb43('0x66')],_0x5a6ff0);};var _0x4347b6=function(_0x18ee1a){if(!_0x18ee1a||!_0x18ee1a[_0xbb43('0x67')]['length']){return'';}for(var _0x4f2631='(',_0x21a94e=0x0;_0x21a94e<_0x18ee1a[_0xbb43('0x67')][_0xbb43('0x35')];_0x21a94e+=0x1){_0x21a94e>0x0&&(_0x4f2631+='\x20'+_0x18ee1a[_0xbb43('0x68')]+'\x20');_0x4f2631+=_0x18ee1a[_0xbb43('0x67')][_0x21a94e][_0xbb43('0x69')]?_0x4347b6(_0x18ee1a[_0xbb43('0x67')][_0x21a94e][_0xbb43('0x69')]):_0x18ee1a[_0xbb43('0x67')][_0x21a94e]['field']+'\x20'+_0x18ee1a[_0xbb43('0x67')][_0x21a94e][_0xbb43('0x6a')]+(_0x599eec(_0x18ee1a[_0xbb43('0x67')][_0x21a94e][_0xbb43('0x6a')])?'\x20'+_0x18ee1a[_0xbb43('0x67')][_0x21a94e][_0xbb43('0x6b')]:'');}return _0x4f2631+')';};var _0x5745eb={'where':{'id':_0x44691b['params']['id']}},_0x5accd6,_0xb48be2,_0x42e437,_0x6d3bb1,_0xc34a02;_0x5745eb=_[_0xbb43('0x3a')]({},_0x5745eb,_0x44691b[_0xbb43('0x3d')]);return db[_0xbb43('0x2b')][_0xbb43('0x46')](_0x5745eb)[_0xbb43('0x23')](function(_0x262c91){if(_0x262c91){_0x5accd6=_0x262c91;return _0x262c91[_0xbb43('0x6c')]();}return null;})[_0xbb43('0x23')](function(_0x10fd8b){if(_0x10fd8b){if(!_0x10fd8b[_0xbb43('0x35')]){throw new db['Sequelize'][(_0xbb43('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xb48be2=_0x10fd8b;return db[_0xbb43('0x6e')][_0xbb43('0x40')]({'raw':!![]});}return null;})[_0xbb43('0x23')](function(_0x3dbcd9){if(_0x3dbcd9){_0x42e437=_[_0xbb43('0x6f')](_0x3dbcd9,'id');var _0x5cbdb4;var _0x59a665=squel[_0xbb43('0x70')]();_0x59a665[_0xbb43('0x71')](_0x5accd6['table']);for(var _0x3cccda=0x0;_0x3cccda<_0xb48be2[_0xbb43('0x35')];_0x3cccda+=0x1){_0x5cbdb4=_0xb48be2[_0x3cccda][_0xbb43('0x72')]?_0x42e437[_0xb48be2[_0x3cccda][_0xbb43('0x72')]][_0xbb43('0x73')]:_0xb48be2[_0x3cccda][_0xbb43('0x74')];_0x5cbdb4=_0xb48be2[_0x3cccda][_0xbb43('0x75')]?_[_0xbb43('0x76')](_0x22bceb[_0xb48be2[_0x3cccda][_0xbb43('0x75')]],'%s',_0x5cbdb4):_0x5cbdb4;_0x5cbdb4=_0xb48be2[_0x3cccda][_0xbb43('0x77')]?_[_0xbb43('0x76')](_0x3d4692[_0xb48be2[_0x3cccda][_0xbb43('0x77')]],'%s',_0x5cbdb4):_0x5cbdb4;if(_0xb48be2[_0x3cccda][_0xbb43('0x78')]){_0x59a665[_0xbb43('0x69')](_0x5cbdb4);}_0xb48be2[_0x3cccda]['orderBy']&&_0x59a665['order'](_0x5cbdb4,_0xb48be2[_0x3cccda][_0xbb43('0x79')]===_0xbb43('0x7a')?![]:!![]);_0x59a665[_0xbb43('0x74')](_0x5cbdb4,_0xb48be2[_0x3cccda]['alias']||_0x5cbdb4);}if(_0x5accd6[_0xbb43('0x7b')]){_0x5accd6[_0xbb43('0x7b')]=JSON[_0xbb43('0x7c')](_0x5accd6[_0xbb43('0x7b')]);for(var _0x9b7984=0x0;_0x9b7984<_0x5accd6['joins'][_0xbb43('0x35')];_0x9b7984+=0x1){if(_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x2c')]&&_['includes'](_0x578b85,_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x2c')])&&_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x7d')]&&_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x7e')]&&_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x7f')]){_0x59a665[_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x2c')]](_0x5accd6[_0xbb43('0x7b')][_0x9b7984]['foreignTable'],null,util[_0xbb43('0x77')](_0xbb43('0x80'),_0x5accd6[_0xbb43('0x81')],_0x5accd6[_0xbb43('0x7b')][_0x9b7984][_0xbb43('0x7d')],_0x5accd6['joins'][_0x9b7984]['foreignTable'],_0x5accd6['joins'][_0x9b7984][_0xbb43('0x7f')]));}}}if(_0x5accd6[_0xbb43('0x82')]){_0x5accd6[_0xbb43('0x82')]=JSON[_0xbb43('0x7c')](_0x5accd6[_0xbb43('0x82')]);_0x59a665[_0xbb43('0x39')](_0x4347b6(_0x5accd6[_0xbb43('0x82')]['group']));}_0xc34a02=_0x59a665[_0xbb43('0x83')]();_0x59a665[_0xbb43('0x1e')](_0x1a3f98);_0x59a665[_0xbb43('0x1d')](0x0);logger['debug'](_0xbb43('0x84'),_0x59a665['toString']());return db[_0xbb43('0x85')]['query'](_0x59a665[_0xbb43('0x86')](),{'type':db[_0xbb43('0x85')][_0xbb43('0x87')][_0xbb43('0x88')]});}})[_0xbb43('0x23')](respondWithResult(_0x14fce0,null))[_0xbb43('0x42')](handleError(_0x14fce0,null));};function runReport(_0x31cca9,_0x2a2e7d,_0x4c4edb){var _0x708327=_0x2a2e7d[_0xbb43('0x28')];var _0x4ca343=0xa;var _0x179777=[_0xbb43('0x53'),_0xbb43('0x54'),'right_join',_0xbb43('0x56')];var _0x15b7ad={'SUM':_0xbb43('0x57'),'COUNT':_0xbb43('0x58'),'COUNT DISTINCT':_0xbb43('0x59'),'MAX':_0xbb43('0x5a'),'MIN':'MIN(%s)','AVG':_0xbb43('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbb43('0x5c'),'GROUP_CONCAT DESC':_0xbb43('0x5d')};var _0x4b2a47={'SEC_TO_TIME':_0xbb43('0x5e'),'DATE':_0xbb43('0x5f'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbb43('0x61')};var _0x3529ed=function(_0x29c80c){return!_[_0xbb43('0x62')]([_0xbb43('0x63'),_0xbb43('0x64'),_0xbb43('0x65'),_0xbb43('0x66')],_0x29c80c);};var _0x1ea196=function(_0xe568a3){if(!_0xe568a3||!_0xe568a3['rules'][_0xbb43('0x35')]){return'';}for(var _0x104ce3='(',_0xdaeb62=0x0;_0xdaeb62<_0xe568a3['rules']['length'];_0xdaeb62+=0x1){_0xdaeb62>0x0&&(_0x104ce3+='\x20'+_0xe568a3[_0xbb43('0x68')]+'\x20');_0x104ce3+=_0xe568a3[_0xbb43('0x67')][_0xdaeb62][_0xbb43('0x69')]?_0x1ea196(_0xe568a3[_0xbb43('0x67')][_0xdaeb62]['group']):_0xe568a3[_0xbb43('0x67')][_0xdaeb62]['field']+'\x20'+_0xe568a3[_0xbb43('0x67')][_0xdaeb62][_0xbb43('0x6a')]+(_0x3529ed(_0xe568a3[_0xbb43('0x67')][_0xdaeb62]['condition'])?'\x20'+_0xe568a3[_0xbb43('0x67')][_0xdaeb62][_0xbb43('0x6b')]:'');}return _0x104ce3+')';};var _0x47b468={'where':{'id':_0x31cca9['id']}},_0x4abc69,_0x2810b4,_0x2a2c1c,_0x140dc1,_0x91e289;_0x47b468=_[_0xbb43('0x3a')]({},_0x47b468,_0x4c4edb);return db[_0xbb43('0x2b')][_0xbb43('0x46')](_0x47b468)[_0xbb43('0x23')](function(_0x59f0a4){if(_0x59f0a4){_0x4abc69=_0x59f0a4;return _0x59f0a4[_0xbb43('0x6c')]();}return null;})[_0xbb43('0x23')](function(_0xd5dfc8){if(_0xd5dfc8){if(!_0xd5dfc8[_0xbb43('0x35')]){throw new db['Sequelize'][(_0xbb43('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2810b4=_0xd5dfc8;return db['AnalyticMetric'][_0xbb43('0x40')]({'raw':!![]});}return null;})[_0xbb43('0x23')](function(_0x7f4564){if(_0x7f4564){_0x2a2c1c=_['keyBy'](_0x7f4564,'id');var _0x4f754a;var _0x4ef475=squel[_0xbb43('0x70')]();_0x4ef475[_0xbb43('0x71')](_0x4abc69[_0xbb43('0x81')]);for(var _0x27a870=0x0;_0x27a870<_0x2810b4[_0xbb43('0x35')];_0x27a870+=0x1){_0x4f754a=_0x2810b4[_0x27a870]['MetricId']?_0x2a2c1c[_0x2810b4[_0x27a870][_0xbb43('0x72')]]['metric']:_0x2810b4[_0x27a870][_0xbb43('0x74')];_0x4f754a=_0x2810b4[_0x27a870]['function']?_['replace'](_0x15b7ad[_0x2810b4[_0x27a870]['function']],'%s',_0x4f754a):_0x4f754a;_0x4f754a=_0x2810b4[_0x27a870][_0xbb43('0x77')]?_[_0xbb43('0x76')](_0x4b2a47[_0x2810b4[_0x27a870]['format']],'%s',_0x4f754a):_0x4f754a;if(_0x2810b4[_0x27a870][_0xbb43('0x78')]){_0x4ef475[_0xbb43('0x69')](_0x4f754a);}_0x2810b4[_0x27a870][_0xbb43('0x79')]&&_0x4ef475[_0xbb43('0x8a')](_0x4f754a,_0x2810b4[_0x27a870][_0xbb43('0x79')]===_0xbb43('0x7a')?![]:!![]);_0x4ef475[_0xbb43('0x74')](_0x4f754a,_0x2810b4[_0x27a870][_0xbb43('0x8b')]||_0x4f754a);}if(_0x4abc69[_0xbb43('0x7b')]){_0x4abc69[_0xbb43('0x7b')]=JSON[_0xbb43('0x7c')](_0x4abc69['joins']);for(var _0x3c5455=0x0;_0x3c5455<_0x4abc69[_0xbb43('0x7b')][_0xbb43('0x35')];_0x3c5455+=0x1){if(_0x4abc69[_0xbb43('0x7b')][_0x3c5455][_0xbb43('0x2c')]&&_[_0xbb43('0x62')](_0x179777,_0x4abc69[_0xbb43('0x7b')][_0x3c5455][_0xbb43('0x2c')])&&_0x4abc69[_0xbb43('0x7b')][_0x3c5455][_0xbb43('0x7d')]&&_0x4abc69[_0xbb43('0x7b')][_0x3c5455]['foreignTable']&&_0x4abc69['joins'][_0x3c5455][_0xbb43('0x7f')]){_0x4ef475[_0x4abc69[_0xbb43('0x7b')][_0x3c5455]['type']](_0x4abc69[_0xbb43('0x7b')][_0x3c5455]['foreignTable'],null,util[_0xbb43('0x77')](_0xbb43('0x80'),_0x4abc69[_0xbb43('0x81')],_0x4abc69[_0xbb43('0x7b')][_0x3c5455][_0xbb43('0x7d')],_0x4abc69[_0xbb43('0x7b')][_0x3c5455]['foreignTable'],_0x4abc69[_0xbb43('0x7b')][_0x3c5455][_0xbb43('0x7f')]));}}}if(_0x4abc69[_0xbb43('0x82')]){_0x4abc69[_0xbb43('0x82')]=JSON[_0xbb43('0x7c')](_0x4abc69[_0xbb43('0x82')]);_0x4ef475[_0xbb43('0x39')](_0x1ea196(_0x4abc69[_0xbb43('0x82')][_0xbb43('0x69')]));}_0x91e289=_0x4ef475[_0xbb43('0x83')]();_0x4ef475[_0xbb43('0x1e')](_0x4ca343);_0x4ef475[_0xbb43('0x1d')](0x0);logger[_0xbb43('0x8c')](_0xbb43('0x84'),_0x4ef475[_0xbb43('0x86')]());return db['sequelize'][_0xbb43('0x30')](_0x4ef475[_0xbb43('0x86')](),{'type':db['sequelize']['QueryTypes'][_0xbb43('0x88')]});}})['then'](function(_0x4ae16b){if(!_0x4ae16b[_0xbb43('0x35')]){throw new db['Sequelize'][(_0xbb43('0x6d'))](_0xbb43('0x8d'),0xcc);}if(_0x2a2e7d[_0xbb43('0x8e')]===_0xbb43('0x8f')){return null;}var _0x59b684=_[_0xbb43('0x3a')](_0x2a2e7d,{'name':_0x2a2e7d[_0xbb43('0x90')]||_0x2a2e7d[_0xbb43('0x28')]||_0x4abc69['name'],'basename':_0x708327,'savename':util[_0xbb43('0x77')](_0xbb43('0x91'),_0x2a2e7d['name']||_0x4abc69[_0xbb43('0x28')],require(_0xbb43('0x92'))[_0xbb43('0x93')](0x4),_0x2a2e7d[_0xbb43('0x8e')]||_0xbb43('0x94')),'reportId':_0x4abc69['id'],'reportType':_0xbb43('0x95')});return db[_0xbb43('0x96')][_0xbb43('0x47')](_0x59b684,{'raw':!![]});})[_0xbb43('0x23')](function(_0x2703cf){if(_0x4abc69[_0xbb43('0x81')]===_0xbb43('0x97')){_0x91e289[_0xbb43('0x39')](_0x4abc69[_0xbb43('0x81')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x2a2e7d[_0xbb43('0x98')],_0x2a2e7d[_0xbb43('0x99')]);}else{_0x91e289[_0xbb43('0x39')](_0x4abc69[_0xbb43('0x81')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a2e7d[_0xbb43('0x98')],_0x2a2e7d[_0xbb43('0x99')]);}if(_0x2703cf){logger[_0xbb43('0x9a')](_0xbb43('0x9b'),_0x91e289[_0xbb43('0x86')]());require('child_process')[_0xbb43('0x9c')](path[_0xbb43('0x53')](__dirname,'../../components/export/',_0x2703cf[_0xbb43('0x8e')]),[_0x2703cf['id'],_0x91e289[_0xbb43('0x86')](),path['join'](__dirname,_0xbb43('0x9d'),_0x2703cf[_0xbb43('0x9e')]),_0x708327]);return _0x2703cf;}else{var _0x314faa=squel[_0xbb43('0x70')]();_0x314faa[_0xbb43('0x71')]('('+_0x91e289['toString']()+')',_0xbb43('0x9f'));_0x314faa[_0xbb43('0x74')](_0xbb43('0xa0'),_0xbb43('0x1c'));_0x91e289[_0xbb43('0x1e')](_0x2a2e7d['limit']||_0x4ca343);_0x91e289[_0xbb43('0x1d')](_0x2a2e7d['offset']||0x0);return dbH['sequelize'][_0xbb43('0x30')](_0x314faa[_0xbb43('0x86')](),{'type':dbH[_0xbb43('0x85')][_0xbb43('0x87')][_0xbb43('0x88')]})[_0xbb43('0x23')](function(_0x5f25f3){if(!_0x5f25f3['length']){_0x140dc1=0x0;}else{_0x140dc1=_0x5f25f3[0x0]['count']||0x0;}return dbH[_0xbb43('0x85')][_0xbb43('0x30')](_0x91e289[_0xbb43('0x86')](),{'type':dbH[_0xbb43('0x85')][_0xbb43('0x87')][_0xbb43('0x88')]});})[_0xbb43('0x23')](function(_0x1c6d98){return{'rows':_0x1c6d98||[],'count':_0x140dc1};});}});}exports['run']=function(_0x1c5950,_0x5be405){return runReport(_0x1c5950[_0xbb43('0x51')],_0x1c5950[_0xbb43('0x30')],_0x1c5950[_0xbb43('0x3d')])[_0xbb43('0x23')](respondWithResult(_0x5be405,null))[_0xbb43('0x42')](handleError(_0x5be405,null));};exports[_0xbb43('0xa1')]=runReport;exports[_0xbb43('0x30')]=function(_0x3b1d17,_0x1be5c1){var _0x55b883=0xa;var _0x115fef=[_0xbb43('0x53'),_0xbb43('0x54'),_0xbb43('0x55'),_0xbb43('0x56')];var _0xf9973e={'SUM':'SUM(%s)','COUNT':_0xbb43('0x58'),'COUNT DISTINCT':_0xbb43('0x59'),'MAX':_0xbb43('0x5a'),'MIN':_0xbb43('0xa2'),'AVG':_0xbb43('0x89'),'GROUP_CONCAT':_0xbb43('0x5b'),'GROUP_CONCAT ASC':_0xbb43('0x5c'),'GROUP_CONCAT DESC':_0xbb43('0x5d')};var _0xc4893f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbb43('0x5f'),'HOUR':_0xbb43('0x60'),'ROUND':_0xbb43('0xa3'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3e1bc0=function(_0x4c00d1){return!_['includes']([_0xbb43('0x63'),_0xbb43('0x64'),'IS\x20EMPTY',_0xbb43('0x66')],_0x4c00d1);};var _0x48d864=function(_0x2d1b62){if(!_0x2d1b62||!_0x2d1b62[_0xbb43('0x67')][_0xbb43('0x35')]){return'';}for(var _0x58e1d6='(',_0x5ec13f=0x0;_0x5ec13f<_0x2d1b62['rules'][_0xbb43('0x35')];_0x5ec13f+=0x1){_0x5ec13f>0x0&&(_0x58e1d6+='\x20'+_0x2d1b62[_0xbb43('0x68')]+'\x20');_0x58e1d6+=_0x2d1b62[_0xbb43('0x67')][_0x5ec13f][_0xbb43('0x69')]?_0x48d864(_0x2d1b62[_0xbb43('0x67')][_0x5ec13f]['group']):_0x2d1b62[_0xbb43('0x67')][_0x5ec13f][_0xbb43('0x74')]+'\x20'+_0x2d1b62[_0xbb43('0x67')][_0x5ec13f][_0xbb43('0x6a')]+(_0x3e1bc0(_0x2d1b62[_0xbb43('0x67')][_0x5ec13f][_0xbb43('0x6a')])?'\x20'+_0x2d1b62['rules'][_0x5ec13f]['value']:'');}return _0x58e1d6+')';};var _0xdf285b={'where':{'id':_0x3b1d17[_0xbb43('0x51')]['id']}},_0x306b1c,_0x4c6b2b,_0x4879b1,_0x369f54,_0x543bd5;_0xdf285b=_[_0xbb43('0x3a')]({},_0xdf285b,_0x3b1d17[_0xbb43('0x3d')]);return db[_0xbb43('0x2b')]['find'](_0xdf285b)[_0xbb43('0x23')](function(_0xaf740c){if(_0xaf740c){_0x306b1c=_0xaf740c;return _0xaf740c[_0xbb43('0x6c')]();}return null;})[_0xbb43('0x23')](function(_0x195549){if(_0x195549){if(!_0x195549[_0xbb43('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0xbb43('0xa4'),0x193);}_0x4c6b2b=_0x195549;return db[_0xbb43('0x6e')][_0xbb43('0x40')]({'raw':!![]});}return null;})[_0xbb43('0x23')](function(_0x2968a7){if(_0x2968a7){_0x4879b1=_['keyBy'](_0x2968a7,'id');var _0x5b27b5;var _0x466558=squel[_0xbb43('0x70')]();_0x466558[_0xbb43('0x71')](_0x306b1c['table']);for(var _0x1e7b78=0x0;_0x1e7b78<_0x4c6b2b[_0xbb43('0x35')];_0x1e7b78+=0x1){_0x5b27b5=_0x4c6b2b[_0x1e7b78][_0xbb43('0x72')]?_0x4879b1[_0x4c6b2b[_0x1e7b78]['MetricId']][_0xbb43('0x73')]:_0x4c6b2b[_0x1e7b78]['field'];_0x5b27b5=_0x4c6b2b[_0x1e7b78][_0xbb43('0x75')]?_[_0xbb43('0x76')](_0xf9973e[_0x4c6b2b[_0x1e7b78][_0xbb43('0x75')]],'%s',_0x5b27b5):_0x5b27b5;_0x5b27b5=_0x4c6b2b[_0x1e7b78]['format']?_[_0xbb43('0x76')](_0xc4893f[_0x4c6b2b[_0x1e7b78][_0xbb43('0x77')]],'%s',_0x5b27b5):_0x5b27b5;if(_0x4c6b2b[_0x1e7b78][_0xbb43('0x78')]){_0x466558[_0xbb43('0x69')](_0x5b27b5);}_0x4c6b2b[_0x1e7b78][_0xbb43('0x79')]&&_0x466558[_0xbb43('0x8a')](_0x5b27b5,_0x4c6b2b[_0x1e7b78][_0xbb43('0x79')]===_0xbb43('0x7a')?![]:!![]);_0x466558[_0xbb43('0x74')](_0x5b27b5,_0x4c6b2b[_0x1e7b78][_0xbb43('0x8b')]||_0x5b27b5);}if(_0x306b1c[_0xbb43('0x7b')]){_0x306b1c[_0xbb43('0x7b')]=JSON[_0xbb43('0x7c')](_0x306b1c[_0xbb43('0x7b')]);for(var _0x5e2afe=0x0;_0x5e2afe<_0x306b1c[_0xbb43('0x7b')][_0xbb43('0x35')];_0x5e2afe+=0x1){if(_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x2c')]&&_[_0xbb43('0x62')](_0x115fef,_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x2c')])&&_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x7d')]&&_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x7e')]&&_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x7f')]){_0x466558[_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x2c')]](_0x306b1c[_0xbb43('0x7b')][_0x5e2afe][_0xbb43('0x7e')],null,util['format'](_0xbb43('0x80'),_0x306b1c['table'],_0x306b1c['joins'][_0x5e2afe][_0xbb43('0x7d')],_0x306b1c[_0xbb43('0x7b')][_0x5e2afe]['foreignTable'],_0x306b1c['joins'][_0x5e2afe][_0xbb43('0x7f')]));}}}if(_0x306b1c[_0xbb43('0x82')]){_0x306b1c['conditions']=JSON[_0xbb43('0x7c')](_0x306b1c['conditions']);_0x466558[_0xbb43('0x39')](_0x48d864(_0x306b1c['conditions'][_0xbb43('0x69')]));}_0x543bd5=_0x466558[_0xbb43('0x83')]();_0x466558['limit'](_0x55b883);_0x466558[_0xbb43('0x1d')](0x0);logger[_0xbb43('0x8c')](_0xbb43('0x84'),_0x466558[_0xbb43('0x86')]());return db[_0xbb43('0x85')]['query'](_0x466558[_0xbb43('0x86')](),{'type':db[_0xbb43('0x85')][_0xbb43('0x87')][_0xbb43('0x88')]});}})[_0xbb43('0x23')](function(){return{'sql':_0x543bd5['toString']()};})[_0xbb43('0x23')](respondWithResult(_0x1be5c1,null))[_0xbb43('0x42')](handleError(_0x1be5c1,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 73d63c8..15bd5e0 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 _0x285e=['api','moment','bluebird','request-promise','path','../../config/environment','AnalyticCustomReport','lodash','util','../../config/logger'];(function(_0x1901f2,_0x24c728){var _0x4ce458=function(_0x404958){while(--_0x404958){_0x1901f2['push'](_0x1901f2['shift']());}};_0x4ce458(++_0x24c728);}(_0x285e,0x75));var _0xe285=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x285e[_0x9e0cb3];return _0x5926b7;};'use strict';var _=require(_0xe285('0x0'));var util=require(_0xe285('0x1'));var logger=require(_0xe285('0x2'))(_0xe285('0x3'));var moment=require(_0xe285('0x4'));var BPromise=require(_0xe285('0x5'));var rp=require(_0xe285('0x6'));var fs=require('fs');var path=require(_0xe285('0x7'));var rimraf=require('rimraf');var config=require(_0xe285('0x8'));var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x23e13f,_0x26649a){return _0x23e13f['define'](_0xe285('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe751=['moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','util','api'];(function(_0x55a89e,_0x1a05ab){var _0x3aa2bd=function(_0x4b9d09){while(--_0x4b9d09){_0x55a89e['push'](_0x55a89e['shift']());}};_0x3aa2bd(++_0x1a05ab);}(_0xe751,0xd5));var _0x1e75=function(_0x1226b2,_0x2d1c56){_0x1226b2=_0x1226b2-0x0;var _0x3c45ee=_0xe751[_0x1226b2];return _0x3c45ee;};'use strict';var _=require(_0x1e75('0x0'));var util=require(_0x1e75('0x1'));var logger=require('../../config/logger')(_0x1e75('0x2'));var moment=require(_0x1e75('0x3'));var BPromise=require(_0x1e75('0x4'));var rp=require(_0x1e75('0x5'));var fs=require('fs');var path=require(_0x1e75('0x6'));var rimraf=require(_0x1e75('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e75('0x8'));module[_0x1e75('0x9')]=function(_0x4bffaa,_0x34d531){return _0x4bffaa['define'](_0x1e75('0xa'),attributes,{'tableName':_0x1e75('0xb'),'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 c26bc91..12ee0ee 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 _0xbe9a=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','then','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x15d916,_0x75d028){var _0x2f5dd7=function(_0x20adef){while(--_0x20adef){_0x15d916['push'](_0x15d916['shift']());}};_0x2f5dd7(++_0x75d028);}(_0xbe9a,0xc1));var _0xabe9=function(_0x1d93cf,_0x28ee10){_0x1d93cf=_0x1d93cf-0x0;var _0x160fa1=_0xbe9a[_0x1d93cf];return _0x160fa1;};'use strict';var _=require(_0xabe9('0x0'));var util=require(_0xabe9('0x1'));var moment=require(_0xabe9('0x2'));var BPromise=require(_0xabe9('0x3'));var rs=require(_0xabe9('0x4'));var fs=require('fs');var Redis=require(_0xabe9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabe9('0x6'));var logger=require(_0xabe9('0x7'))(_0xabe9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a3f4d,_0x24ede7,_0x4e5b59){return new BPromise(function(_0x2a3a44,_0x40b5c){return client['request'](_0x5a3f4d,_0x4e5b59)[_0xabe9('0x9')](function(_0x5b2d33){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x24ede7,_0xabe9('0xa'));logger[_0xabe9('0xb')](_0xabe9('0xc'),_0x24ede7,_0xabe9('0xa'),JSON[_0xabe9('0xd')](_0x5b2d33));if(_0x5b2d33[_0xabe9('0xe')]){if(_0x5b2d33[_0xabe9('0xe')][_0xabe9('0xf')]===0x1f4){logger[_0xabe9('0xe')](_0xabe9('0x10'),_0x24ede7,_0x5b2d33[_0xabe9('0xe')][_0xabe9('0x11')]);return _0x40b5c(_0x5b2d33['error'][_0xabe9('0x11')]);}logger[_0xabe9('0xe')](_0xabe9('0x10'),_0x24ede7,_0x5b2d33['error'][_0xabe9('0x11')]);return _0x2a3a44(_0x5b2d33[_0xabe9('0xe')][_0xabe9('0x11')]);}else{logger[_0xabe9('0x12')](_0xabe9('0x10'),_0x24ede7,_0xabe9('0xa'));_0x2a3a44(_0x5b2d33[_0xabe9('0x13')][_0xabe9('0x11')]);}})[_0xabe9('0x14')](function(_0x159ea1){logger[_0xabe9('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x24ede7,_0x159ea1);_0x40b5c(_0x159ea1);});});} \ No newline at end of file +var _0x76a0=['client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x4eb3cf,_0x23ba85){var _0x47b294=function(_0x511f22){while(--_0x511f22){_0x4eb3cf['push'](_0x4eb3cf['shift']());}};_0x47b294(++_0x23ba85);}(_0x76a0,0xf4));var _0x076a=function(_0xea81a1,_0xb28e9e){_0xea81a1=_0xea81a1-0x0;var _0x2cd030=_0x76a0[_0xea81a1];return _0x2cd030;};'use strict';var _=require('lodash');var util=require(_0x076a('0x0'));var moment=require(_0x076a('0x1'));var BPromise=require(_0x076a('0x2'));var rs=require(_0x076a('0x3'));var fs=require('fs');var Redis=require(_0x076a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x076a('0x5'))(_0x076a('0x6'));var config=require(_0x076a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x076a('0x8')][_0x076a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x339789,_0x229c0e,_0xbed35b){return new BPromise(function(_0x39837d,_0xf8e2dd){return client['request'](_0x339789,_0xbed35b)[_0x076a('0xa')](function(_0x45b2ea){logger[_0x076a('0xb')](_0x076a('0xc'),_0x229c0e,_0x076a('0xd'));logger[_0x076a('0xe')](_0x076a('0xf'),_0x229c0e,_0x076a('0xd'),JSON[_0x076a('0x10')](_0x45b2ea));if(_0x45b2ea[_0x076a('0x11')]){if(_0x45b2ea['error'][_0x076a('0x12')]===0x1f4){logger[_0x076a('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x229c0e,_0x45b2ea[_0x076a('0x11')][_0x076a('0x13')]);return _0xf8e2dd(_0x45b2ea['error'][_0x076a('0x13')]);}logger['error'](_0x076a('0xc'),_0x229c0e,_0x45b2ea['error'][_0x076a('0x13')]);return _0x39837d(_0x45b2ea[_0x076a('0x11')][_0x076a('0x13')]);}else{logger[_0x076a('0xb')](_0x076a('0xc'),_0x229c0e,_0x076a('0xd'));_0x39837d(_0x45b2ea[_0x076a('0x14')][_0x076a('0x13')]);}})['catch'](function(_0x47cad4){logger[_0x076a('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x229c0e,_0x47cad4);_0xf8e2dd(_0x47cad4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 3c2c2a5..f711e49 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 _0xf948=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/preview','run','/:id/query','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf948,0x126));var _0x8f94=function(_0x32b9b4,_0x22acad){_0x32b9b4=_0x32b9b4-0x0;var _0x18810c=_0xf948[_0x32b9b4];return _0x18810c;};'use strict';var multer=require(_0x8f94('0x0'));var util=require(_0x8f94('0x1'));var path=require(_0x8f94('0x2'));var timeout=require(_0x8f94('0x3'));var express=require(_0x8f94('0x4'));var router=express[_0x8f94('0x5')]();var auth=require(_0x8f94('0x6'));var interaction=require(_0x8f94('0x7'));var config=require(_0x8f94('0x8'));var controller=require(_0x8f94('0x9'));router[_0x8f94('0xa')]('/',auth[_0x8f94('0xb')](),controller['index']);router['get']('/:id',auth[_0x8f94('0xb')](),controller[_0x8f94('0xc')]);router[_0x8f94('0xa')](_0x8f94('0xd'),auth[_0x8f94('0xb')](),controller['preview']);router[_0x8f94('0xa')]('/:id/run',auth[_0x8f94('0xb')](),controller[_0x8f94('0xe')]);router[_0x8f94('0xa')](_0x8f94('0xf'),auth['isAuthenticated'](),controller['query']);router[_0x8f94('0x10')]('/',auth['isAuthenticated'](),controller[_0x8f94('0x11')]);router['put'](_0x8f94('0x12'),auth[_0x8f94('0xb')](),controller[_0x8f94('0x13')]);router[_0x8f94('0x14')](_0x8f94('0x12'),auth[_0x8f94('0xb')](),controller[_0x8f94('0x15')]);module[_0x8f94('0x16')]=router; \ No newline at end of file +var _0xa2d0=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','show','/:id/preview','isAuthenticated','get','run','query','post','put','/:id','update','destroy','multer'];(function(_0x2a339d,_0x4d3afc){var _0x58a3c9=function(_0x20c72e){while(--_0x20c72e){_0x2a339d['push'](_0x2a339d['shift']());}};_0x58a3c9(++_0x4d3afc);}(_0xa2d0,0x77));var _0x0a2d=function(_0x441df5,_0xc083b8){_0x441df5=_0x441df5-0x0;var _0x3fb667=_0xa2d0[_0x441df5];return _0x3fb667;};'use strict';var multer=require(_0x0a2d('0x0'));var util=require('util');var path=require(_0x0a2d('0x1'));var timeout=require(_0x0a2d('0x2'));var express=require(_0x0a2d('0x3'));var router=express[_0x0a2d('0x4')]();var auth=require(_0x0a2d('0x5'));var interaction=require(_0x0a2d('0x6'));var config=require(_0x0a2d('0x7'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0a2d('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x0a2d('0x9')]);router['get'](_0x0a2d('0xa'),auth[_0x0a2d('0xb')](),controller['preview']);router[_0x0a2d('0xc')]('/:id/run',auth[_0x0a2d('0xb')](),controller[_0x0a2d('0xd')]);router[_0x0a2d('0xc')]('/:id/query',auth[_0x0a2d('0xb')](),controller[_0x0a2d('0xe')]);router[_0x0a2d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a2d('0x10')](_0x0a2d('0x11'),auth[_0x0a2d('0xb')](),controller[_0x0a2d('0x12')]);router['delete'](_0x0a2d('0x11'),auth['isAuthenticated'](),controller[_0x0a2d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 83e339a..a0f19eb 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 _0x2d53=['STRING','TEXT','sequelize'];(function(_0x40d79b,_0x22a83d){var _0x3ff7a7=function(_0x48e8ae){while(--_0x48e8ae){_0x40d79b['push'](_0x40d79b['shift']());}};_0x3ff7a7(++_0x22a83d);}(_0x2d53,0x1c7));var _0x32d5=function(_0x3a9815,_0x47eb16){_0x3a9815=_0x3a9815-0x0;var _0x188653=_0x2d53[_0x3a9815];return _0x188653;};'use strict';var Sequelize=require(_0x32d5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x32d5('0x1')]},'parent':{'type':Sequelize[_0x32d5('0x1')]},'table':{'type':Sequelize[_0x32d5('0x1')]},'conditions':{'type':Sequelize[_0x32d5('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x280d=['TEXT','sequelize','exports','STRING'];(function(_0x405f3b,_0x5b6c21){var _0x397e1f=function(_0x3205c8){while(--_0x3205c8){_0x405f3b['push'](_0x405f3b['shift']());}};_0x397e1f(++_0x5b6c21);}(_0x280d,0x1b9));var _0xd280=function(_0x5bed74,_0x52ed55){_0x5bed74=_0x5bed74-0x0;var _0x3000ec=_0x280d[_0x5bed74];return _0x3000ec;};'use strict';var Sequelize=require(_0xd280('0x0'));module[_0xd280('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd280('0x2')]},'parent':{'type':Sequelize[_0xd280('0x2')]},'table':{'type':Sequelize[_0xd280('0x2')]},'conditions':{'type':Sequelize[_0xd280('0x3')]},'joins':{'type':Sequelize[_0xd280('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d8af1c7..c4eddd3 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 _0x9db9=['offset','limit','Content-Range','apply','save','update','destroy','then','get','DefaultReports','UserProfileResource','stack','name','send','index','AnalyticDefaultReport','rawAttributes','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','type','filter','merge','options','includeAll','include','findAll','rows','catch','params','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_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)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','select','table','MetricId','function','replace','format','groupBy','group','DESC','alias','parse','joins','parentKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','HOUR(%s)','keyBy','from','orderBy','%s.%s\x20=\x20%s.%s','No\x20available\x20data','output','%s-%s.%s','generate','default','AnalyticExtractedReport','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','GROUP_CONCAT(%s)','DATE(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','metric','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x2f60fb,_0x326a94){var _0x2f3d04=function(_0xb3f4f){while(--_0xb3f4f){_0x2f60fb['push'](_0x2f60fb['shift']());}};_0x2f3d04(++_0x326a94);}(_0x9db9,0x11d));var _0x99db=function(_0x58fea7,_0x2d33db){_0x58fea7=_0x58fea7-0x0;var _0x5d9226=_0x9db9[_0x58fea7];return _0x5d9226;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x99db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x99db('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99db('0x2'));var moment=require(_0x99db('0x3'));var BPromise=require(_0x99db('0x4'));var Mustache=require(_0x99db('0x5'));var util=require(_0x99db('0x6'));var path=require('path');var sox=require(_0x99db('0x7'));var csv=require(_0x99db('0x8'));var ejs=require(_0x99db('0x9'));var fs=require('fs');var _=require(_0x99db('0xa'));var squel=require(_0x99db('0xb'));var crypto=require(_0x99db('0xc'));var jsforce=require(_0x99db('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x99db('0x8'));var querystring=require(_0x99db('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99db('0xf'));var logger=require(_0x99db('0x10'))(_0x99db('0x11'));var utils=require(_0x99db('0x12'));var config=require(_0x99db('0x13'));var licenseUtil=require(_0x99db('0x14'));var db=require(_0x99db('0x15'))['db'];var dbH=require(_0x99db('0x15'))['dbH'];function respondWithStatusCode(_0x5be60f,_0xec08e9){_0xec08e9=_0xec08e9||0xcc;return function(_0x51124f){if(_0x51124f){return _0x5be60f[_0x99db('0x16')](_0xec08e9);}return _0x5be60f[_0x99db('0x17')](_0xec08e9)[_0x99db('0x18')]();};}function respondWithResult(_0x7b821c,_0x2f03fc){_0x2f03fc=_0x2f03fc||0xc8;return function(_0x24b38b){if(_0x24b38b){return _0x7b821c[_0x99db('0x17')](_0x2f03fc)[_0x99db('0x19')](_0x24b38b);}};}function respondWithFilteredResult(_0x5cf985,_0x2b98ba){return function(_0x20d1c1){if(_0x20d1c1){var _0xf9db48=_0x20d1c1[_0x99db('0x1a')],_0x2af53e=_0x2b98ba[_0x99db('0x1b')],_0x5ba205=_0x2b98ba['offset']+_0x2b98ba[_0x99db('0x1c')],_0x3e476f;if(_0x5ba205>=_0xf9db48){_0x5ba205=_0xf9db48;_0x3e476f=0xc8;}else{_0x3e476f=0xce;}_0x5cf985[_0x99db('0x17')](_0x3e476f);return _0x5cf985['set'](_0x99db('0x1d'),_0x2af53e+'-'+_0x5ba205+'/'+_0xf9db48)[_0x99db('0x19')](_0x20d1c1);}return null;};}function patchUpdates(_0x1656b5){return function(_0x14d4d4){try{jsonpatch[_0x99db('0x1e')](_0x14d4d4,_0x1656b5,!![]);}catch(_0x2bb6b0){return BPromise['reject'](_0x2bb6b0);}return _0x14d4d4[_0x99db('0x1f')]();};}function saveUpdates(_0x43d8f9,_0x214d85){return function(_0x3dd831){if(_0x3dd831){return _0x3dd831[_0x99db('0x20')](_0x43d8f9)['then'](function(_0x2b2fa3){return _0x2b2fa3;});}return null;};}function removeEntity(_0x191f26,_0x52653f){return function(_0x3ec5e5){if(_0x3ec5e5){return _0x3ec5e5[_0x99db('0x21')]()[_0x99db('0x22')](function(){var _0xb04c39=_0x3ec5e5[_0x99db('0x23')]({'plain':!![]});var _0x1d53f7=_0x99db('0x24');return db[_0x99db('0x25')][_0x99db('0x21')]({'where':{'type':_0x1d53f7,'resourceId':_0xb04c39['id']}})[_0x99db('0x22')](function(){return _0x3ec5e5;});})[_0x99db('0x22')](function(){_0x191f26['status'](0xcc)[_0x99db('0x18')]();});}};}function handleEntityNotFound(_0x507607,_0x4fa62b){return function(_0x4f8ba3){if(!_0x4f8ba3){_0x507607[_0x99db('0x16')](0x194);}return _0x4f8ba3;};}function handleError(_0x12073b,_0x13b35a){_0x13b35a=_0x13b35a||0x1f4;return function(_0x99cd6c){logger['error'](_0x99cd6c[_0x99db('0x26')]);if(_0x99cd6c[_0x99db('0x27')]){delete _0x99cd6c[_0x99db('0x27')];}_0x12073b['status'](_0x13b35a)[_0x99db('0x28')](_0x99cd6c);};}exports[_0x99db('0x29')]=function(_0x8829ec,_0x3a879b){var _0x22f774={},_0x8fa692={},_0x215a6b={'count':0x0,'rows':[]};var _0x54ee26=_['map'](db[_0x99db('0x2a')][_0x99db('0x2b')],function(_0x2afaaf){return{'name':_0x2afaaf['fieldName'],'type':_0x2afaaf['type'][_0x99db('0x2c')]};});_0x8fa692[_0x99db('0x2d')]=_[_0x99db('0x2e')](_0x54ee26,_0x99db('0x27'));_0x8fa692['query']=_[_0x99db('0x2f')](_0x8829ec[_0x99db('0x30')]);_0x8fa692[_0x99db('0x31')]=_[_0x99db('0x32')](_0x8fa692[_0x99db('0x2d')],_0x8fa692[_0x99db('0x30')]);_0x22f774[_0x99db('0x33')]=_[_0x99db('0x32')](_0x8fa692['model'],qs[_0x99db('0x34')](_0x8829ec[_0x99db('0x30')][_0x99db('0x34')]));_0x22f774[_0x99db('0x33')]=_0x22f774[_0x99db('0x33')][_0x99db('0x35')]?_0x22f774[_0x99db('0x33')]:_0x8fa692[_0x99db('0x2d')];if(!_0x8829ec[_0x99db('0x30')][_0x99db('0x36')]('nolimit')){_0x22f774[_0x99db('0x1c')]=qs[_0x99db('0x1c')](_0x8829ec[_0x99db('0x30')][_0x99db('0x1c')]);_0x22f774[_0x99db('0x1b')]=qs[_0x99db('0x1b')](_0x8829ec[_0x99db('0x30')][_0x99db('0x1b')]);}_0x22f774[_0x99db('0x37')]=qs[_0x99db('0x38')](_0x8829ec[_0x99db('0x30')][_0x99db('0x38')]);_0x22f774['where']=qs[_0x99db('0x31')](_['pick'](_0x8829ec['query'],_0x8fa692[_0x99db('0x31')]),_0x54ee26);if(_0x8829ec['query']['filter']){_0x22f774['where']=_['merge'](_0x22f774[_0x99db('0x39')],{'$or':_[_0x99db('0x2e')](_0x54ee26,function(_0x2a32c8){if(_0x2a32c8[_0x99db('0x3a')]!=='VIRTUAL'){var _0x1a3efc={};_0x1a3efc[_0x2a32c8[_0x99db('0x27')]]={'$like':'%'+_0x8829ec[_0x99db('0x30')][_0x99db('0x3b')]+'%'};return _0x1a3efc;}})});}_0x22f774=_[_0x99db('0x3c')]({},_0x22f774,_0x8829ec[_0x99db('0x3d')]);var _0x533db2={'where':_0x22f774[_0x99db('0x39')]};return db[_0x99db('0x2a')][_0x99db('0x1a')](_0x533db2)[_0x99db('0x22')](function(_0x1dd3f3){_0x215a6b[_0x99db('0x1a')]=_0x1dd3f3;if(_0x8829ec[_0x99db('0x30')][_0x99db('0x3e')]){_0x22f774[_0x99db('0x3f')]=[{'all':!![]}];}return db[_0x99db('0x2a')][_0x99db('0x40')](_0x22f774);})[_0x99db('0x22')](function(_0x252250){_0x215a6b[_0x99db('0x41')]=_0x252250;return _0x215a6b;})['then'](respondWithFilteredResult(_0x3a879b,_0x22f774))[_0x99db('0x42')](handleError(_0x3a879b,null));};exports['show']=function(_0x4dc883,_0x105441){var _0x5348db={'raw':!![],'where':{'id':_0x4dc883[_0x99db('0x43')]['id']}},_0x465778={};_0x465778[_0x99db('0x2d')]=_[_0x99db('0x2f')](db[_0x99db('0x2a')][_0x99db('0x2b')]);_0x465778[_0x99db('0x30')]=_[_0x99db('0x2f')](_0x4dc883[_0x99db('0x30')]);_0x465778[_0x99db('0x44')]=_[_0x99db('0x32')](_0x465778[_0x99db('0x2d')],_0x465778[_0x99db('0x30')]);_0x5348db[_0x99db('0x33')]=_['intersection'](_0x465778['model'],qs['fields'](_0x4dc883[_0x99db('0x30')]['fields']));_0x5348db[_0x99db('0x33')]=_0x5348db[_0x99db('0x33')][_0x99db('0x35')]?_0x5348db[_0x99db('0x33')]:_0x465778[_0x99db('0x2d')];if(_0x4dc883[_0x99db('0x30')][_0x99db('0x3e')]){_0x5348db['include']=[{'all':!![]}];}_0x5348db=_[_0x99db('0x3c')]({},_0x5348db,_0x4dc883[_0x99db('0x3d')]);return db[_0x99db('0x2a')][_0x99db('0x45')](_0x5348db)[_0x99db('0x22')](handleEntityNotFound(_0x105441,null))[_0x99db('0x22')](respondWithResult(_0x105441,null))[_0x99db('0x42')](handleError(_0x105441,null));};exports['create']=function(_0x14b695,_0x19763e){return db[_0x99db('0x2a')][_0x99db('0x46')](_0x14b695[_0x99db('0x47')],{})[_0x99db('0x22')](function(_0x517184){var _0x373df1=_0x14b695[_0x99db('0x48')][_0x99db('0x23')]({'plain':!![]});if(!_0x373df1)throw new Error(_0x99db('0x49'));if(_0x373df1[_0x99db('0x4a')]===_0x99db('0x48')){var _0x53167a=_0x517184[_0x99db('0x23')]({'plain':!![]});var _0x5d22a5=_0x99db('0x4b');return db[_0x99db('0x4c')][_0x99db('0x45')]({'where':{'name':_0x5d22a5,'userProfileId':_0x373df1['userProfileId']},'raw':!![]})[_0x99db('0x22')](function(_0x5d4bd0){if(_0x5d4bd0&&_0x5d4bd0[_0x99db('0x4d')]===0x0){return db[_0x99db('0x25')][_0x99db('0x46')]({'name':_0x53167a['name'],'resourceId':_0x53167a['id'],'type':_0x99db('0x24'),'sectionId':_0x5d4bd0['id']},{})[_0x99db('0x22')](function(){return _0x517184;});}else{return _0x517184;}})[_0x99db('0x42')](function(_0xa78ab3){logger[_0x99db('0x4e')](_0x99db('0x4f'),_0xa78ab3);throw _0xa78ab3;});}return _0x517184;})[_0x99db('0x22')](respondWithResult(_0x19763e,0xc9))[_0x99db('0x42')](handleError(_0x19763e,null));};exports[_0x99db('0x20')]=function(_0x6407cb,_0x385d65){if(_0x6407cb['body']['id']){delete _0x6407cb['body']['id'];}return db[_0x99db('0x2a')][_0x99db('0x45')]({'where':{'id':_0x6407cb[_0x99db('0x43')]['id']}})[_0x99db('0x22')](handleEntityNotFound(_0x385d65,null))[_0x99db('0x22')](saveUpdates(_0x6407cb[_0x99db('0x47')],null))['then'](respondWithResult(_0x385d65,null))['catch'](handleError(_0x385d65,null));};exports[_0x99db('0x21')]=function(_0xc7b1fd,_0x22398e){return db[_0x99db('0x2a')][_0x99db('0x45')]({'where':{'id':_0xc7b1fd[_0x99db('0x43')]['id']}})[_0x99db('0x22')](handleEntityNotFound(_0x22398e,null))[_0x99db('0x22')](removeEntity(_0x22398e,null))[_0x99db('0x42')](handleError(_0x22398e,null));};exports['preview']=function(_0x3d343e,_0x260367){var _0x5f41b4=0xa;var _0x390d6b=[_0x99db('0x50'),_0x99db('0x51'),_0x99db('0x52'),_0x99db('0x53')];var _0x464be0={'SUM':_0x99db('0x54'),'COUNT':_0x99db('0x55'),'COUNT DISTINCT':_0x99db('0x56'),'MAX':_0x99db('0x57'),'MIN':_0x99db('0x58'),'AVG':_0x99db('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x99db('0x5a'),'GROUP_CONCAT DESC':_0x99db('0x5b')};var _0x4b9515={'SEC_TO_TIME':_0x99db('0x5c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x99db('0x5d'),'UNIX_TIMESTAMP':_0x99db('0x5e')};var _0x350737=function(_0x4ab6e4){return!_[_0x99db('0x5f')]([_0x99db('0x60'),_0x99db('0x61'),_0x99db('0x62'),_0x99db('0x63')],_0x4ab6e4);};var _0x162c16=function(_0x2f623f){if(!_0x2f623f||!_0x2f623f[_0x99db('0x64')]['length']){return'';}for(var _0x23c357='(',_0x3eddb0=0x0;_0x3eddb0<_0x2f623f['rules'][_0x99db('0x35')];_0x3eddb0+=0x1){_0x3eddb0>0x0&&(_0x23c357+='\x20'+_0x2f623f[_0x99db('0x65')]+'\x20');_0x23c357+=_0x2f623f[_0x99db('0x64')][_0x3eddb0]['group']?_0x162c16(_0x2f623f[_0x99db('0x64')][_0x3eddb0]['group']):_0x2f623f[_0x99db('0x64')][_0x3eddb0][_0x99db('0x66')]+'\x20'+_0x2f623f['rules'][_0x3eddb0][_0x99db('0x67')]+(_0x350737(_0x2f623f[_0x99db('0x64')][_0x3eddb0][_0x99db('0x67')])?'\x20'+_0x2f623f[_0x99db('0x64')][_0x3eddb0][_0x99db('0x68')]:'');}return _0x23c357+')';};var _0x1fa12d={'where':{'id':_0x3d343e['params']['id']}},_0x376cb5,_0x3dc747,_0x1c1d96,_0x48b9af,_0x2b69d3;_0x1fa12d=_['merge']({},_0x1fa12d,_0x3d343e['options']);return db['AnalyticDefaultReport'][_0x99db('0x45')](_0x1fa12d)[_0x99db('0x22')](function(_0xbe6a5e){if(_0xbe6a5e){_0x376cb5=_0xbe6a5e;return _0xbe6a5e['getFields']();}return null;})[_0x99db('0x22')](function(_0x380a12){if(_0x380a12){if(!_0x380a12['length']){throw new db[(_0x99db('0x69'))][(_0x99db('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3dc747=_0x380a12;return db[_0x99db('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x474209){if(_0x474209){_0x1c1d96=_['keyBy'](_0x474209,'id');var _0x2136d2;var _0x216824=squel[_0x99db('0x6c')]();_0x216824['from'](_0x376cb5[_0x99db('0x6d')]);for(var _0x3b9fb4=0x0;_0x3b9fb4<_0x3dc747[_0x99db('0x35')];_0x3b9fb4+=0x1){_0x2136d2=_0x3dc747[_0x3b9fb4][_0x99db('0x6e')]?_0x1c1d96[_0x3dc747[_0x3b9fb4][_0x99db('0x6e')]]['metric']:_0x3dc747[_0x3b9fb4][_0x99db('0x66')];_0x2136d2=_0x3dc747[_0x3b9fb4][_0x99db('0x6f')]?_[_0x99db('0x70')](_0x464be0[_0x3dc747[_0x3b9fb4]['function']],'%s',_0x2136d2):_0x2136d2;_0x2136d2=_0x3dc747[_0x3b9fb4][_0x99db('0x71')]?_[_0x99db('0x70')](_0x4b9515[_0x3dc747[_0x3b9fb4][_0x99db('0x71')]],'%s',_0x2136d2):_0x2136d2;if(_0x3dc747[_0x3b9fb4][_0x99db('0x72')]){_0x216824[_0x99db('0x73')](_0x2136d2);}_0x3dc747[_0x3b9fb4]['orderBy']&&_0x216824[_0x99db('0x37')](_0x2136d2,_0x3dc747[_0x3b9fb4]['orderBy']===_0x99db('0x74')?![]:!![]);_0x216824[_0x99db('0x66')](_0x2136d2,_0x3dc747[_0x3b9fb4][_0x99db('0x75')]||_0x2136d2);}if(_0x376cb5['joins']){_0x376cb5['joins']=JSON[_0x99db('0x76')](_0x376cb5[_0x99db('0x77')]);for(var _0x2c6154=0x0;_0x2c6154<_0x376cb5[_0x99db('0x77')][_0x99db('0x35')];_0x2c6154+=0x1){if(_0x376cb5[_0x99db('0x77')][_0x2c6154][_0x99db('0x3a')]&&_[_0x99db('0x5f')](_0x390d6b,_0x376cb5[_0x99db('0x77')][_0x2c6154]['type'])&&_0x376cb5['joins'][_0x2c6154][_0x99db('0x78')]&&_0x376cb5[_0x99db('0x77')][_0x2c6154]['foreignTable']&&_0x376cb5[_0x99db('0x77')][_0x2c6154]['foreignKey']){_0x216824[_0x376cb5['joins'][_0x2c6154][_0x99db('0x3a')]](_0x376cb5[_0x99db('0x77')][_0x2c6154][_0x99db('0x79')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x376cb5[_0x99db('0x6d')],_0x376cb5[_0x99db('0x77')][_0x2c6154][_0x99db('0x78')],_0x376cb5['joins'][_0x2c6154][_0x99db('0x79')],_0x376cb5[_0x99db('0x77')][_0x2c6154]['foreignKey']));}}}if(_0x376cb5[_0x99db('0x7a')]){_0x376cb5[_0x99db('0x7a')]=JSON[_0x99db('0x76')](_0x376cb5[_0x99db('0x7a')]);_0x216824[_0x99db('0x39')](_0x162c16(_0x376cb5['conditions'][_0x99db('0x73')]));}_0x2b69d3=_0x216824[_0x99db('0x7b')]();_0x216824[_0x99db('0x1c')](_0x5f41b4);_0x216824[_0x99db('0x1b')](0x0);logger[_0x99db('0x7c')](_0x99db('0x7d'),_0x216824[_0x99db('0x7e')]());return db[_0x99db('0x7f')]['query'](_0x216824[_0x99db('0x7e')](),{'type':db[_0x99db('0x7f')][_0x99db('0x80')][_0x99db('0x81')]});}})[_0x99db('0x22')](respondWithResult(_0x260367,null))[_0x99db('0x42')](handleError(_0x260367,null));};function runReport(_0x175dc2,_0x3399d8,_0x9ee207){var _0x469b5f=_0x3399d8['name'];var _0x3bb290=0xa;var _0x4b8b5e=[_0x99db('0x50'),_0x99db('0x51'),_0x99db('0x52'),_0x99db('0x53')];var _0x55e76f={'SUM':_0x99db('0x54'),'COUNT':_0x99db('0x55'),'COUNT DISTINCT':_0x99db('0x56'),'MAX':_0x99db('0x57'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x99db('0x5a'),'GROUP_CONCAT DESC':_0x99db('0x5b')};var _0x1cf49d={'SEC_TO_TIME':_0x99db('0x5c'),'DATE':'DATE(%s)','HOUR':_0x99db('0x82'),'ROUND':_0x99db('0x5d'),'UNIX_TIMESTAMP':_0x99db('0x5e')};var _0x118eff=function(_0x351339){return!_[_0x99db('0x5f')]([_0x99db('0x60'),_0x99db('0x61'),_0x99db('0x62'),_0x99db('0x63')],_0x351339);};var _0x3767f6=function(_0x29214b){if(!_0x29214b||!_0x29214b[_0x99db('0x64')][_0x99db('0x35')]){return'';}for(var _0x590467='(',_0x11cb96=0x0;_0x11cb96<_0x29214b[_0x99db('0x64')][_0x99db('0x35')];_0x11cb96+=0x1){_0x11cb96>0x0&&(_0x590467+='\x20'+_0x29214b['operator']+'\x20');_0x590467+=_0x29214b[_0x99db('0x64')][_0x11cb96][_0x99db('0x73')]?_0x3767f6(_0x29214b['rules'][_0x11cb96][_0x99db('0x73')]):_0x29214b[_0x99db('0x64')][_0x11cb96]['field']+'\x20'+_0x29214b['rules'][_0x11cb96][_0x99db('0x67')]+(_0x118eff(_0x29214b[_0x99db('0x64')][_0x11cb96][_0x99db('0x67')])?'\x20'+_0x29214b[_0x99db('0x64')][_0x11cb96]['value']:'');}return _0x590467+')';};var _0x2a10a0={'where':{'id':_0x175dc2['id']}},_0x2e422c,_0x17dea7,_0x48cfbd,_0x531463,_0x25cc58;_0x2a10a0=_[_0x99db('0x3c')]({},_0x2a10a0,_0x9ee207);return db[_0x99db('0x2a')][_0x99db('0x45')](_0x2a10a0)[_0x99db('0x22')](function(_0x27de6f){if(_0x27de6f){_0x2e422c=_0x27de6f;return _0x27de6f['getFields']();}return null;})[_0x99db('0x22')](function(_0x407240){if(_0x407240){if(!_0x407240[_0x99db('0x35')]){throw new db[(_0x99db('0x69'))][(_0x99db('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x17dea7=_0x407240;return db['AnalyticMetric'][_0x99db('0x40')]({'raw':!![]});}return null;})[_0x99db('0x22')](function(_0x19a25d){if(_0x19a25d){_0x48cfbd=_[_0x99db('0x83')](_0x19a25d,'id');var _0x301936;var _0x315d7a=squel[_0x99db('0x6c')]();_0x315d7a[_0x99db('0x84')](_0x2e422c[_0x99db('0x6d')]);for(var _0x4edf2d=0x0;_0x4edf2d<_0x17dea7[_0x99db('0x35')];_0x4edf2d+=0x1){_0x301936=_0x17dea7[_0x4edf2d]['MetricId']?_0x48cfbd[_0x17dea7[_0x4edf2d][_0x99db('0x6e')]]['metric']:_0x17dea7[_0x4edf2d][_0x99db('0x66')];_0x301936=_0x17dea7[_0x4edf2d][_0x99db('0x6f')]?_[_0x99db('0x70')](_0x55e76f[_0x17dea7[_0x4edf2d][_0x99db('0x6f')]],'%s',_0x301936):_0x301936;_0x301936=_0x17dea7[_0x4edf2d][_0x99db('0x71')]?_['replace'](_0x1cf49d[_0x17dea7[_0x4edf2d][_0x99db('0x71')]],'%s',_0x301936):_0x301936;if(_0x17dea7[_0x4edf2d][_0x99db('0x72')]){_0x315d7a['group'](_0x301936);}_0x17dea7[_0x4edf2d][_0x99db('0x85')]&&_0x315d7a[_0x99db('0x37')](_0x301936,_0x17dea7[_0x4edf2d][_0x99db('0x85')]===_0x99db('0x74')?![]:!![]);_0x315d7a['field'](_0x301936,_0x17dea7[_0x4edf2d][_0x99db('0x75')]||_0x301936);}if(_0x2e422c['joins']){_0x2e422c['joins']=JSON[_0x99db('0x76')](_0x2e422c[_0x99db('0x77')]);for(var _0x56c04d=0x0;_0x56c04d<_0x2e422c[_0x99db('0x77')]['length'];_0x56c04d+=0x1){if(_0x2e422c['joins'][_0x56c04d][_0x99db('0x3a')]&&_[_0x99db('0x5f')](_0x4b8b5e,_0x2e422c[_0x99db('0x77')][_0x56c04d]['type'])&&_0x2e422c['joins'][_0x56c04d][_0x99db('0x78')]&&_0x2e422c[_0x99db('0x77')][_0x56c04d]['foreignTable']&&_0x2e422c['joins'][_0x56c04d]['foreignKey']){_0x315d7a[_0x2e422c[_0x99db('0x77')][_0x56c04d][_0x99db('0x3a')]](_0x2e422c['joins'][_0x56c04d][_0x99db('0x79')],null,util[_0x99db('0x71')](_0x99db('0x86'),_0x2e422c[_0x99db('0x6d')],_0x2e422c[_0x99db('0x77')][_0x56c04d][_0x99db('0x78')],_0x2e422c[_0x99db('0x77')][_0x56c04d][_0x99db('0x79')],_0x2e422c[_0x99db('0x77')][_0x56c04d]['foreignKey']));}}}if(_0x2e422c[_0x99db('0x7a')]){_0x2e422c['conditions']=JSON[_0x99db('0x76')](_0x2e422c[_0x99db('0x7a')]);_0x315d7a['where'](_0x3767f6(_0x2e422c[_0x99db('0x7a')][_0x99db('0x73')]));}_0x25cc58=_0x315d7a['clone']();_0x315d7a[_0x99db('0x1c')](_0x3bb290);_0x315d7a[_0x99db('0x1b')](0x0);logger[_0x99db('0x7c')](_0x99db('0x7d'),_0x315d7a[_0x99db('0x7e')]());return db[_0x99db('0x7f')]['query'](_0x315d7a[_0x99db('0x7e')](),{'type':db[_0x99db('0x7f')][_0x99db('0x80')][_0x99db('0x81')]});}})[_0x99db('0x22')](function(_0x34f006){if(!_0x34f006['length']){throw new db[(_0x99db('0x69'))][(_0x99db('0x6a'))](_0x99db('0x87'),0xcc);}if(_0x3399d8[_0x99db('0x88')]==='web'){return null;}var _0x22dfaa=_[_0x99db('0x3c')](_0x3399d8,{'name':_0x3399d8['fullPath']||_0x3399d8[_0x99db('0x27')]||_0x2e422c['name'],'basename':_0x469b5f,'savename':util['format'](_0x99db('0x89'),_0x3399d8[_0x99db('0x27')]||_0x2e422c[_0x99db('0x27')],require('randomstring')[_0x99db('0x8a')](0x4),_0x3399d8[_0x99db('0x88')]||'csv'),'reportId':_0x2e422c['id'],'reportType':_0x99db('0x8b')});return db[_0x99db('0x8c')]['create'](_0x22dfaa,{'raw':!![]});})[_0x99db('0x22')](function(_0x136254){if(_0x2e422c[_0x99db('0x6d')]==='cdr'){_0x25cc58[_0x99db('0x39')](_0x2e422c['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3399d8['startDate'],_0x3399d8[_0x99db('0x8d')]);}else{_0x25cc58[_0x99db('0x39')](_0x2e422c['table']+_0x99db('0x8e'),_0x3399d8['startDate'],_0x3399d8[_0x99db('0x8d')]);}if(_0x136254){logger['info'](_0x99db('0x8f'),_0x25cc58[_0x99db('0x7e')]());require(_0x99db('0x90'))['fork'](path[_0x99db('0x50')](__dirname,_0x99db('0x91'),_0x136254[_0x99db('0x88')]),[_0x136254['id'],_0x25cc58['toString'](),path['join'](__dirname,_0x99db('0x92'),_0x136254[_0x99db('0x93')]),_0x469b5f]);return _0x136254;}else{var _0x3d8a22=squel['select']();_0x3d8a22[_0x99db('0x84')]('('+_0x25cc58[_0x99db('0x7e')]()+')',_0x99db('0x94'));_0x3d8a22['field'](_0x99db('0x95'),_0x99db('0x1a'));_0x25cc58[_0x99db('0x1c')](_0x3399d8[_0x99db('0x1c')]||_0x3bb290);_0x25cc58[_0x99db('0x1b')](_0x3399d8[_0x99db('0x1b')]||0x0);return dbH[_0x99db('0x7f')][_0x99db('0x30')](_0x3d8a22['toString'](),{'type':dbH['sequelize'][_0x99db('0x80')][_0x99db('0x81')]})[_0x99db('0x22')](function(_0x1bc27b){if(!_0x1bc27b[_0x99db('0x35')]){_0x531463=0x0;}else{_0x531463=_0x1bc27b[0x0][_0x99db('0x1a')]||0x0;}return dbH['sequelize'][_0x99db('0x30')](_0x25cc58[_0x99db('0x7e')](),{'type':dbH[_0x99db('0x7f')][_0x99db('0x80')][_0x99db('0x81')]});})[_0x99db('0x22')](function(_0x99db5d){return{'rows':_0x99db5d||[],'count':_0x531463};});}});}exports[_0x99db('0x96')]=function(_0x21a255,_0x17ea0d){return runReport(_0x21a255['params'],_0x21a255[_0x99db('0x30')],_0x21a255[_0x99db('0x3d')])[_0x99db('0x22')](respondWithResult(_0x17ea0d,null))[_0x99db('0x42')](handleError(_0x17ea0d,null));};exports['runReport']=runReport;exports[_0x99db('0x30')]=function(_0x46b602,_0x764b44){var _0xa50420=0xa;var _0x42813c=[_0x99db('0x50'),'left_join',_0x99db('0x52'),_0x99db('0x53')];var _0x428630={'SUM':_0x99db('0x54'),'COUNT':_0x99db('0x55'),'COUNT DISTINCT':_0x99db('0x56'),'MAX':'MAX(%s)','MIN':_0x99db('0x58'),'AVG':_0x99db('0x59'),'GROUP_CONCAT':_0x99db('0x97'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x99db('0x5b')};var _0x4cebdf={'SEC_TO_TIME':_0x99db('0x5c'),'DATE':_0x99db('0x98'),'HOUR':_0x99db('0x82'),'ROUND':_0x99db('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xb164de=function(_0x199ba4){return!_[_0x99db('0x5f')]([_0x99db('0x60'),_0x99db('0x61'),_0x99db('0x62'),_0x99db('0x63')],_0x199ba4);};var _0x24dfdc=function(_0x4dfbfc){if(!_0x4dfbfc||!_0x4dfbfc[_0x99db('0x64')][_0x99db('0x35')]){return'';}for(var _0x14421f='(',_0x358631=0x0;_0x358631<_0x4dfbfc['rules'][_0x99db('0x35')];_0x358631+=0x1){_0x358631>0x0&&(_0x14421f+='\x20'+_0x4dfbfc[_0x99db('0x65')]+'\x20');_0x14421f+=_0x4dfbfc[_0x99db('0x64')][_0x358631]['group']?_0x24dfdc(_0x4dfbfc[_0x99db('0x64')][_0x358631][_0x99db('0x73')]):_0x4dfbfc[_0x99db('0x64')][_0x358631][_0x99db('0x66')]+'\x20'+_0x4dfbfc['rules'][_0x358631][_0x99db('0x67')]+(_0xb164de(_0x4dfbfc[_0x99db('0x64')][_0x358631]['condition'])?'\x20'+_0x4dfbfc[_0x99db('0x64')][_0x358631][_0x99db('0x68')]:'');}return _0x14421f+')';};var _0x1ab382={'where':{'id':_0x46b602[_0x99db('0x43')]['id']}},_0x477ff6,_0x53ed7d,_0x167820,_0x221aa5,_0x1efa6e;_0x1ab382=_[_0x99db('0x3c')]({},_0x1ab382,_0x46b602[_0x99db('0x3d')]);return db[_0x99db('0x2a')][_0x99db('0x45')](_0x1ab382)[_0x99db('0x22')](function(_0x8e9b6){if(_0x8e9b6){_0x477ff6=_0x8e9b6;return _0x8e9b6[_0x99db('0x99')]();}return null;})[_0x99db('0x22')](function(_0x59efa2){if(_0x59efa2){if(!_0x59efa2[_0x99db('0x35')]){throw new db[(_0x99db('0x69'))][(_0x99db('0x6a'))](_0x99db('0x9a'),0x193);}_0x53ed7d=_0x59efa2;return db[_0x99db('0x6b')][_0x99db('0x40')]({'raw':!![]});}return null;})['then'](function(_0xe5746a){if(_0xe5746a){_0x167820=_[_0x99db('0x83')](_0xe5746a,'id');var _0x3884f3;var _0x56038b=squel[_0x99db('0x6c')]();_0x56038b[_0x99db('0x84')](_0x477ff6['table']);for(var _0x3ba09c=0x0;_0x3ba09c<_0x53ed7d[_0x99db('0x35')];_0x3ba09c+=0x1){_0x3884f3=_0x53ed7d[_0x3ba09c][_0x99db('0x6e')]?_0x167820[_0x53ed7d[_0x3ba09c][_0x99db('0x6e')]][_0x99db('0x9b')]:_0x53ed7d[_0x3ba09c][_0x99db('0x66')];_0x3884f3=_0x53ed7d[_0x3ba09c][_0x99db('0x6f')]?_['replace'](_0x428630[_0x53ed7d[_0x3ba09c][_0x99db('0x6f')]],'%s',_0x3884f3):_0x3884f3;_0x3884f3=_0x53ed7d[_0x3ba09c][_0x99db('0x71')]?_[_0x99db('0x70')](_0x4cebdf[_0x53ed7d[_0x3ba09c][_0x99db('0x71')]],'%s',_0x3884f3):_0x3884f3;if(_0x53ed7d[_0x3ba09c][_0x99db('0x72')]){_0x56038b['group'](_0x3884f3);}_0x53ed7d[_0x3ba09c][_0x99db('0x85')]&&_0x56038b[_0x99db('0x37')](_0x3884f3,_0x53ed7d[_0x3ba09c]['orderBy']===_0x99db('0x74')?![]:!![]);_0x56038b[_0x99db('0x66')](_0x3884f3,_0x53ed7d[_0x3ba09c][_0x99db('0x75')]||_0x3884f3);}if(_0x477ff6[_0x99db('0x77')]){_0x477ff6[_0x99db('0x77')]=JSON['parse'](_0x477ff6[_0x99db('0x77')]);for(var _0xbd6268=0x0;_0xbd6268<_0x477ff6[_0x99db('0x77')][_0x99db('0x35')];_0xbd6268+=0x1){if(_0x477ff6['joins'][_0xbd6268][_0x99db('0x3a')]&&_['includes'](_0x42813c,_0x477ff6['joins'][_0xbd6268][_0x99db('0x3a')])&&_0x477ff6[_0x99db('0x77')][_0xbd6268][_0x99db('0x78')]&&_0x477ff6[_0x99db('0x77')][_0xbd6268][_0x99db('0x79')]&&_0x477ff6[_0x99db('0x77')][_0xbd6268]['foreignKey']){_0x56038b[_0x477ff6[_0x99db('0x77')][_0xbd6268][_0x99db('0x3a')]](_0x477ff6['joins'][_0xbd6268]['foreignTable'],null,util[_0x99db('0x71')]('%s.%s\x20=\x20%s.%s',_0x477ff6[_0x99db('0x6d')],_0x477ff6[_0x99db('0x77')][_0xbd6268][_0x99db('0x78')],_0x477ff6['joins'][_0xbd6268][_0x99db('0x79')],_0x477ff6[_0x99db('0x77')][_0xbd6268]['foreignKey']));}}}if(_0x477ff6['conditions']){_0x477ff6[_0x99db('0x7a')]=JSON[_0x99db('0x76')](_0x477ff6['conditions']);_0x56038b[_0x99db('0x39')](_0x24dfdc(_0x477ff6[_0x99db('0x7a')][_0x99db('0x73')]));}_0x1efa6e=_0x56038b[_0x99db('0x7b')]();_0x56038b[_0x99db('0x1c')](_0xa50420);_0x56038b[_0x99db('0x1b')](0x0);logger[_0x99db('0x7c')](_0x99db('0x7d'),_0x56038b[_0x99db('0x7e')]());return db['sequelize']['query'](_0x56038b[_0x99db('0x7e')](),{'type':db[_0x99db('0x7f')][_0x99db('0x80')][_0x99db('0x81')]});}})['then'](function(){return{'sql':_0x1efa6e['toString']()};})['then'](respondWithResult(_0x764b44,null))['catch'](handleError(_0x764b44,null));}; \ No newline at end of file +var _0x0de1=['VIRTUAL','options','count','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','select','from','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','toString','SELECT','right_join','cross_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','getFields','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','Limited\x20Query:','No\x20available\x20data','fullPath','%s-%s.%s','generate','output','csv','default','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','sequelize','QueryTypes','run','runReport','MIN(%s)','GROUP_CONCAT(%s)','IS\x20EMPTY','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','dbH','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0de1,0x107));var _0x10de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x10de('0x0'));var rimraf=require(_0x10de('0x1'));var zipdir=require(_0x10de('0x2'));var jsonpatch=require(_0x10de('0x3'));var rp=require(_0x10de('0x4'));var moment=require(_0x10de('0x5'));var BPromise=require(_0x10de('0x6'));var Mustache=require(_0x10de('0x7'));var util=require(_0x10de('0x8'));var path=require(_0x10de('0x9'));var sox=require(_0x10de('0xa'));var csv=require(_0x10de('0xb'));var ejs=require(_0x10de('0xc'));var fs=require('fs');var _=require(_0x10de('0xd'));var squel=require('squel');var crypto=require(_0x10de('0xe'));var jsforce=require(_0x10de('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x10de('0xb'));var querystring=require(_0x10de('0x10'));var Papa=require('papaparse');var Redis=require(_0x10de('0x11'));var authService=require(_0x10de('0x12'));var qs=require(_0x10de('0x13'));var as=require(_0x10de('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x10de('0x15'))(_0x10de('0x16'));var utils=require(_0x10de('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x10de('0x18'))[_0x10de('0x19')];function respondWithStatusCode(_0x296ab4,_0x38910e){_0x38910e=_0x38910e||0xcc;return function(_0x46a564){if(_0x46a564){return _0x296ab4['sendStatus'](_0x38910e);}return _0x296ab4[_0x10de('0x1a')](_0x38910e)[_0x10de('0x1b')]();};}function respondWithResult(_0x3287fe,_0x106bbe){_0x106bbe=_0x106bbe||0xc8;return function(_0x10c56d){if(_0x10c56d){return _0x3287fe[_0x10de('0x1a')](_0x106bbe)['json'](_0x10c56d);}};}function respondWithFilteredResult(_0x4067be,_0x24c857){return function(_0x26c1de){if(_0x26c1de){var _0x75a2a6=_0x26c1de['count'],_0x43604b=_0x24c857[_0x10de('0x1c')],_0x2b7a59=_0x24c857[_0x10de('0x1c')]+_0x24c857[_0x10de('0x1d')],_0x49a725;if(_0x2b7a59>=_0x75a2a6){_0x2b7a59=_0x75a2a6;_0x49a725=0xc8;}else{_0x49a725=0xce;}_0x4067be[_0x10de('0x1a')](_0x49a725);return _0x4067be[_0x10de('0x1e')](_0x10de('0x1f'),_0x43604b+'-'+_0x2b7a59+'/'+_0x75a2a6)[_0x10de('0x20')](_0x26c1de);}return null;};}function patchUpdates(_0x1b357b){return function(_0x514315){try{jsonpatch[_0x10de('0x21')](_0x514315,_0x1b357b,!![]);}catch(_0x2467de){return BPromise[_0x10de('0x22')](_0x2467de);}return _0x514315[_0x10de('0x23')]();};}function saveUpdates(_0x5b42a4,_0x49921c){return function(_0x425429){if(_0x425429){return _0x425429[_0x10de('0x24')](_0x5b42a4)['then'](function(_0x6a26f4){return _0x6a26f4;});}return null;};}function removeEntity(_0x29ded0,_0x881395){return function(_0x4518dc){if(_0x4518dc){return _0x4518dc[_0x10de('0x25')]()[_0x10de('0x26')](function(){var _0x58d149=_0x4518dc[_0x10de('0x27')]({'plain':!![]});var _0x5afdb8=_0x10de('0x28');return db[_0x10de('0x29')][_0x10de('0x25')]({'where':{'type':_0x5afdb8,'resourceId':_0x58d149['id']}})[_0x10de('0x26')](function(){return _0x4518dc;});})[_0x10de('0x26')](function(){_0x29ded0[_0x10de('0x1a')](0xcc)[_0x10de('0x1b')]();});}};}function handleEntityNotFound(_0x3726ef,_0x237408){return function(_0x54efe1){if(!_0x54efe1){_0x3726ef[_0x10de('0x2a')](0x194);}return _0x54efe1;};}function handleError(_0x2e87ba,_0x393b8f){_0x393b8f=_0x393b8f||0x1f4;return function(_0x172be0){logger[_0x10de('0x2b')](_0x172be0[_0x10de('0x2c')]);if(_0x172be0[_0x10de('0x2d')]){delete _0x172be0[_0x10de('0x2d')];}_0x2e87ba[_0x10de('0x1a')](_0x393b8f)['send'](_0x172be0);};}exports['index']=function(_0x10b6ac,_0x2aa54c){var _0x328bca={},_0x210545={},_0xeb6f97={'count':0x0,'rows':[]};var _0x514069=_[_0x10de('0x2e')](db[_0x10de('0x2f')][_0x10de('0x30')],function(_0x558bfc){return{'name':_0x558bfc[_0x10de('0x31')],'type':_0x558bfc[_0x10de('0x32')][_0x10de('0x33')]};});_0x210545['model']=_['map'](_0x514069,'name');_0x210545[_0x10de('0x34')]=_[_0x10de('0x35')](_0x10b6ac['query']);_0x210545[_0x10de('0x36')]=_[_0x10de('0x37')](_0x210545[_0x10de('0x38')],_0x210545['query']);_0x328bca[_0x10de('0x39')]=_[_0x10de('0x37')](_0x210545['model'],qs['fields'](_0x10b6ac[_0x10de('0x34')]['fields']));_0x328bca[_0x10de('0x39')]=_0x328bca[_0x10de('0x39')][_0x10de('0x3a')]?_0x328bca[_0x10de('0x39')]:_0x210545['model'];if(!_0x10b6ac[_0x10de('0x34')][_0x10de('0x3b')](_0x10de('0x3c'))){_0x328bca[_0x10de('0x1d')]=qs[_0x10de('0x1d')](_0x10b6ac['query'][_0x10de('0x1d')]);_0x328bca[_0x10de('0x1c')]=qs['offset'](_0x10b6ac[_0x10de('0x34')][_0x10de('0x1c')]);}_0x328bca[_0x10de('0x3d')]=qs[_0x10de('0x3e')](_0x10b6ac[_0x10de('0x34')][_0x10de('0x3e')]);_0x328bca[_0x10de('0x3f')]=qs[_0x10de('0x36')](_[_0x10de('0x40')](_0x10b6ac[_0x10de('0x34')],_0x210545[_0x10de('0x36')]),_0x514069);if(_0x10b6ac[_0x10de('0x34')][_0x10de('0x41')]){_0x328bca[_0x10de('0x3f')]=_[_0x10de('0x42')](_0x328bca[_0x10de('0x3f')],{'$or':_['map'](_0x514069,function(_0x35712e){if(_0x35712e['type']!==_0x10de('0x43')){var _0x2298aa={};_0x2298aa[_0x35712e[_0x10de('0x2d')]]={'$like':'%'+_0x10b6ac[_0x10de('0x34')]['filter']+'%'};return _0x2298aa;}})});}_0x328bca=_[_0x10de('0x42')]({},_0x328bca,_0x10b6ac[_0x10de('0x44')]);var _0x3e47eb={'where':_0x328bca[_0x10de('0x3f')]};return db[_0x10de('0x2f')][_0x10de('0x45')](_0x3e47eb)[_0x10de('0x26')](function(_0x2da8bc){_0xeb6f97[_0x10de('0x45')]=_0x2da8bc;if(_0x10b6ac[_0x10de('0x34')][_0x10de('0x46')]){_0x328bca['include']=[{'all':!![]}];}return db[_0x10de('0x2f')][_0x10de('0x47')](_0x328bca);})[_0x10de('0x26')](function(_0x1278bd){_0xeb6f97['rows']=_0x1278bd;return _0xeb6f97;})[_0x10de('0x26')](respondWithFilteredResult(_0x2aa54c,_0x328bca))[_0x10de('0x48')](handleError(_0x2aa54c,null));};exports[_0x10de('0x49')]=function(_0x8e05fc,_0x24c49a){var _0x2b2c9b={'raw':!![],'where':{'id':_0x8e05fc[_0x10de('0x4a')]['id']}},_0x3472d4={};_0x3472d4[_0x10de('0x38')]=_[_0x10de('0x35')](db['AnalyticDefaultReport'][_0x10de('0x30')]);_0x3472d4[_0x10de('0x34')]=_[_0x10de('0x35')](_0x8e05fc['query']);_0x3472d4['filtears']=_[_0x10de('0x37')](_0x3472d4[_0x10de('0x38')],_0x3472d4['query']);_0x2b2c9b[_0x10de('0x39')]=_[_0x10de('0x37')](_0x3472d4[_0x10de('0x38')],qs[_0x10de('0x4b')](_0x8e05fc[_0x10de('0x34')][_0x10de('0x4b')]));_0x2b2c9b[_0x10de('0x39')]=_0x2b2c9b[_0x10de('0x39')][_0x10de('0x3a')]?_0x2b2c9b[_0x10de('0x39')]:_0x3472d4[_0x10de('0x38')];if(_0x8e05fc['query'][_0x10de('0x46')]){_0x2b2c9b[_0x10de('0x4c')]=[{'all':!![]}];}_0x2b2c9b=_[_0x10de('0x42')]({},_0x2b2c9b,_0x8e05fc['options']);return db['AnalyticDefaultReport'][_0x10de('0x4d')](_0x2b2c9b)[_0x10de('0x26')](handleEntityNotFound(_0x24c49a,null))[_0x10de('0x26')](respondWithResult(_0x24c49a,null))[_0x10de('0x48')](handleError(_0x24c49a,null));};exports[_0x10de('0x4e')]=function(_0x583913,_0x514d2b){return db['AnalyticDefaultReport'][_0x10de('0x4e')](_0x583913[_0x10de('0x4f')],{})['then'](function(_0x43b82b){var _0x5ccd01=_0x583913[_0x10de('0x50')][_0x10de('0x27')]({'plain':!![]});if(!_0x5ccd01)throw new Error(_0x10de('0x51'));if(_0x5ccd01['role']===_0x10de('0x50')){var _0x4d6477=_0x43b82b[_0x10de('0x27')]({'plain':!![]});var _0x242996='Reports';return db[_0x10de('0x52')]['find']({'where':{'name':_0x242996,'userProfileId':_0x5ccd01[_0x10de('0x53')]},'raw':!![]})['then'](function(_0x7560a){if(_0x7560a&&_0x7560a['autoAssociation']===0x0){return db[_0x10de('0x29')][_0x10de('0x4e')]({'name':_0x4d6477[_0x10de('0x2d')],'resourceId':_0x4d6477['id'],'type':_0x10de('0x28'),'sectionId':_0x7560a['id']},{})['then'](function(){return _0x43b82b;});}else{return _0x43b82b;}})[_0x10de('0x48')](function(_0x24863b){logger[_0x10de('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24863b);throw _0x24863b;});}return _0x43b82b;})[_0x10de('0x26')](respondWithResult(_0x514d2b,0xc9))[_0x10de('0x48')](handleError(_0x514d2b,null));};exports[_0x10de('0x24')]=function(_0x18b6e3,_0x4ed327){if(_0x18b6e3[_0x10de('0x4f')]['id']){delete _0x18b6e3['body']['id'];}return db[_0x10de('0x2f')][_0x10de('0x4d')]({'where':{'id':_0x18b6e3[_0x10de('0x4a')]['id']}})[_0x10de('0x26')](handleEntityNotFound(_0x4ed327,null))[_0x10de('0x26')](saveUpdates(_0x18b6e3['body'],null))[_0x10de('0x26')](respondWithResult(_0x4ed327,null))[_0x10de('0x48')](handleError(_0x4ed327,null));};exports[_0x10de('0x25')]=function(_0x228908,_0x43e2d1){return db[_0x10de('0x2f')][_0x10de('0x4d')]({'where':{'id':_0x228908[_0x10de('0x4a')]['id']}})[_0x10de('0x26')](handleEntityNotFound(_0x43e2d1,null))[_0x10de('0x26')](removeEntity(_0x43e2d1,null))['catch'](handleError(_0x43e2d1,null));};exports[_0x10de('0x54')]=function(_0xf8b645,_0x87d03b){var _0x5de428=0xa;var _0x5b5410=[_0x10de('0x55'),_0x10de('0x56'),'right_join','cross_join'];var _0x246722={'SUM':_0x10de('0x57'),'COUNT':_0x10de('0x58'),'COUNT DISTINCT':_0x10de('0x59'),'MAX':_0x10de('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x10de('0x5b')};var _0x4f89c0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x10de('0x5c'),'HOUR':_0x10de('0x5d'),'ROUND':_0x10de('0x5e'),'UNIX_TIMESTAMP':_0x10de('0x5f')};var _0x4b2b93=function(_0x5ddf73){return!_[_0x10de('0x60')]([_0x10de('0x61'),_0x10de('0x62'),'IS\x20EMPTY',_0x10de('0x63')],_0x5ddf73);};var _0x584a1d=function(_0x1916ca){if(!_0x1916ca||!_0x1916ca[_0x10de('0x64')]['length']){return'';}for(var _0xae2175='(',_0x4b801c=0x0;_0x4b801c<_0x1916ca['rules'][_0x10de('0x3a')];_0x4b801c+=0x1){_0x4b801c>0x0&&(_0xae2175+='\x20'+_0x1916ca[_0x10de('0x65')]+'\x20');_0xae2175+=_0x1916ca[_0x10de('0x64')][_0x4b801c][_0x10de('0x66')]?_0x584a1d(_0x1916ca[_0x10de('0x64')][_0x4b801c][_0x10de('0x66')]):_0x1916ca[_0x10de('0x64')][_0x4b801c][_0x10de('0x67')]+'\x20'+_0x1916ca[_0x10de('0x64')][_0x4b801c][_0x10de('0x68')]+(_0x4b2b93(_0x1916ca[_0x10de('0x64')][_0x4b801c][_0x10de('0x68')])?'\x20'+_0x1916ca['rules'][_0x4b801c][_0x10de('0x69')]:'');}return _0xae2175+')';};var _0x219d7b={'where':{'id':_0xf8b645[_0x10de('0x4a')]['id']}},_0x18a6a9,_0x5351a0,_0x15d9ea,_0x200b5a,_0xf42759;_0x219d7b=_[_0x10de('0x42')]({},_0x219d7b,_0xf8b645[_0x10de('0x44')]);return db[_0x10de('0x2f')]['find'](_0x219d7b)[_0x10de('0x26')](function(_0x3feecc){if(_0x3feecc){_0x18a6a9=_0x3feecc;return _0x3feecc['getFields']();}return null;})[_0x10de('0x26')](function(_0x272d77){if(_0x272d77){if(!_0x272d77[_0x10de('0x3a')]){throw new db[(_0x10de('0x6a'))][(_0x10de('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5351a0=_0x272d77;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x10de('0x26')](function(_0x4fe4f9){if(_0x4fe4f9){_0x15d9ea=_['keyBy'](_0x4fe4f9,'id');var _0x2d099d;var _0x16a63d=squel[_0x10de('0x6c')]();_0x16a63d[_0x10de('0x6d')](_0x18a6a9['table']);for(var _0x9b1a01=0x0;_0x9b1a01<_0x5351a0[_0x10de('0x3a')];_0x9b1a01+=0x1){_0x2d099d=_0x5351a0[_0x9b1a01][_0x10de('0x6e')]?_0x15d9ea[_0x5351a0[_0x9b1a01]['MetricId']][_0x10de('0x6f')]:_0x5351a0[_0x9b1a01][_0x10de('0x67')];_0x2d099d=_0x5351a0[_0x9b1a01][_0x10de('0x70')]?_['replace'](_0x246722[_0x5351a0[_0x9b1a01][_0x10de('0x70')]],'%s',_0x2d099d):_0x2d099d;_0x2d099d=_0x5351a0[_0x9b1a01][_0x10de('0x71')]?_[_0x10de('0x72')](_0x4f89c0[_0x5351a0[_0x9b1a01]['format']],'%s',_0x2d099d):_0x2d099d;if(_0x5351a0[_0x9b1a01][_0x10de('0x73')]){_0x16a63d[_0x10de('0x66')](_0x2d099d);}_0x5351a0[_0x9b1a01]['orderBy']&&_0x16a63d[_0x10de('0x3d')](_0x2d099d,_0x5351a0[_0x9b1a01][_0x10de('0x74')]===_0x10de('0x75')?![]:!![]);_0x16a63d[_0x10de('0x67')](_0x2d099d,_0x5351a0[_0x9b1a01][_0x10de('0x76')]||_0x2d099d);}if(_0x18a6a9['joins']){_0x18a6a9[_0x10de('0x77')]=JSON[_0x10de('0x78')](_0x18a6a9[_0x10de('0x77')]);for(var _0x2378b4=0x0;_0x2378b4<_0x18a6a9[_0x10de('0x77')][_0x10de('0x3a')];_0x2378b4+=0x1){if(_0x18a6a9[_0x10de('0x77')][_0x2378b4][_0x10de('0x32')]&&_[_0x10de('0x60')](_0x5b5410,_0x18a6a9[_0x10de('0x77')][_0x2378b4]['type'])&&_0x18a6a9[_0x10de('0x77')][_0x2378b4]['parentKey']&&_0x18a6a9['joins'][_0x2378b4][_0x10de('0x79')]&&_0x18a6a9['joins'][_0x2378b4][_0x10de('0x7a')]){_0x16a63d[_0x18a6a9['joins'][_0x2378b4][_0x10de('0x32')]](_0x18a6a9['joins'][_0x2378b4][_0x10de('0x79')],null,util[_0x10de('0x71')](_0x10de('0x7b'),_0x18a6a9['table'],_0x18a6a9[_0x10de('0x77')][_0x2378b4][_0x10de('0x7c')],_0x18a6a9['joins'][_0x2378b4][_0x10de('0x79')],_0x18a6a9[_0x10de('0x77')][_0x2378b4][_0x10de('0x7a')]));}}}if(_0x18a6a9[_0x10de('0x7d')]){_0x18a6a9[_0x10de('0x7d')]=JSON[_0x10de('0x78')](_0x18a6a9[_0x10de('0x7d')]);_0x16a63d[_0x10de('0x3f')](_0x584a1d(_0x18a6a9[_0x10de('0x7d')][_0x10de('0x66')]));}_0xf42759=_0x16a63d[_0x10de('0x7e')]();_0x16a63d[_0x10de('0x1d')](_0x5de428);_0x16a63d['offset'](0x0);logger[_0x10de('0x7f')]('Limited\x20Query:',_0x16a63d[_0x10de('0x80')]());return db['sequelize'][_0x10de('0x34')](_0x16a63d[_0x10de('0x80')](),{'type':db['sequelize']['QueryTypes'][_0x10de('0x81')]});}})[_0x10de('0x26')](respondWithResult(_0x87d03b,null))['catch'](handleError(_0x87d03b,null));};function runReport(_0xfe1466,_0x5ddfcd,_0x1404d7){var _0x289fe9=_0x5ddfcd[_0x10de('0x2d')];var _0x233307=0xa;var _0x4a38cc=[_0x10de('0x55'),'left_join',_0x10de('0x82'),_0x10de('0x83')];var _0x5b695e={'SUM':_0x10de('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x10de('0x5a'),'MIN':'MIN(%s)','AVG':_0x10de('0x84'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x10de('0x85'),'GROUP_CONCAT DESC':_0x10de('0x5b')};var _0x533d19={'SEC_TO_TIME':_0x10de('0x86'),'DATE':_0x10de('0x5c'),'HOUR':_0x10de('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x10de('0x5f')};var _0x190c4f=function(_0x2c68b1){return!_['includes']([_0x10de('0x61'),_0x10de('0x62'),'IS\x20EMPTY',_0x10de('0x63')],_0x2c68b1);};var _0x42f60c=function(_0x4506d3){if(!_0x4506d3||!_0x4506d3[_0x10de('0x64')][_0x10de('0x3a')]){return'';}for(var _0x3d3871='(',_0x295a28=0x0;_0x295a28<_0x4506d3['rules']['length'];_0x295a28+=0x1){_0x295a28>0x0&&(_0x3d3871+='\x20'+_0x4506d3[_0x10de('0x65')]+'\x20');_0x3d3871+=_0x4506d3['rules'][_0x295a28][_0x10de('0x66')]?_0x42f60c(_0x4506d3[_0x10de('0x64')][_0x295a28][_0x10de('0x66')]):_0x4506d3[_0x10de('0x64')][_0x295a28][_0x10de('0x67')]+'\x20'+_0x4506d3[_0x10de('0x64')][_0x295a28][_0x10de('0x68')]+(_0x190c4f(_0x4506d3[_0x10de('0x64')][_0x295a28]['condition'])?'\x20'+_0x4506d3[_0x10de('0x64')][_0x295a28][_0x10de('0x69')]:'');}return _0x3d3871+')';};var _0x1ea50f={'where':{'id':_0xfe1466['id']}},_0x233d0c,_0x54a216,_0x3493af,_0x300e56,_0x2b2079;_0x1ea50f=_[_0x10de('0x42')]({},_0x1ea50f,_0x1404d7);return db['AnalyticDefaultReport'][_0x10de('0x4d')](_0x1ea50f)[_0x10de('0x26')](function(_0x39e901){if(_0x39e901){_0x233d0c=_0x39e901;return _0x39e901[_0x10de('0x87')]();}return null;})[_0x10de('0x26')](function(_0x3e343d){if(_0x3e343d){if(!_0x3e343d[_0x10de('0x3a')]){throw new db[(_0x10de('0x6a'))]['ValidationErrorItem'](_0x10de('0x88'),0x193);}_0x54a216=_0x3e343d;return db['AnalyticMetric'][_0x10de('0x47')]({'raw':!![]});}return null;})[_0x10de('0x26')](function(_0x43dfe4){if(_0x43dfe4){_0x3493af=_[_0x10de('0x89')](_0x43dfe4,'id');var _0x3b1064;var _0x37afcf=squel[_0x10de('0x6c')]();_0x37afcf['from'](_0x233d0c[_0x10de('0x8a')]);for(var _0x399fc9=0x0;_0x399fc9<_0x54a216[_0x10de('0x3a')];_0x399fc9+=0x1){_0x3b1064=_0x54a216[_0x399fc9][_0x10de('0x6e')]?_0x3493af[_0x54a216[_0x399fc9][_0x10de('0x6e')]][_0x10de('0x6f')]:_0x54a216[_0x399fc9]['field'];_0x3b1064=_0x54a216[_0x399fc9]['function']?_['replace'](_0x5b695e[_0x54a216[_0x399fc9][_0x10de('0x70')]],'%s',_0x3b1064):_0x3b1064;_0x3b1064=_0x54a216[_0x399fc9][_0x10de('0x71')]?_['replace'](_0x533d19[_0x54a216[_0x399fc9][_0x10de('0x71')]],'%s',_0x3b1064):_0x3b1064;if(_0x54a216[_0x399fc9][_0x10de('0x73')]){_0x37afcf[_0x10de('0x66')](_0x3b1064);}_0x54a216[_0x399fc9][_0x10de('0x74')]&&_0x37afcf[_0x10de('0x3d')](_0x3b1064,_0x54a216[_0x399fc9][_0x10de('0x74')]===_0x10de('0x75')?![]:!![]);_0x37afcf[_0x10de('0x67')](_0x3b1064,_0x54a216[_0x399fc9][_0x10de('0x76')]||_0x3b1064);}if(_0x233d0c['joins']){_0x233d0c[_0x10de('0x77')]=JSON[_0x10de('0x78')](_0x233d0c[_0x10de('0x77')]);for(var _0x5f5294=0x0;_0x5f5294<_0x233d0c[_0x10de('0x77')][_0x10de('0x3a')];_0x5f5294+=0x1){if(_0x233d0c['joins'][_0x5f5294][_0x10de('0x32')]&&_['includes'](_0x4a38cc,_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x32')])&&_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x7c')]&&_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x79')]&&_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x7a')]){_0x37afcf[_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x32')]](_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x79')],null,util[_0x10de('0x71')](_0x10de('0x7b'),_0x233d0c[_0x10de('0x8a')],_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x7c')],_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x79')],_0x233d0c[_0x10de('0x77')][_0x5f5294][_0x10de('0x7a')]));}}}if(_0x233d0c['conditions']){_0x233d0c[_0x10de('0x7d')]=JSON[_0x10de('0x78')](_0x233d0c['conditions']);_0x37afcf[_0x10de('0x3f')](_0x42f60c(_0x233d0c['conditions']['group']));}_0x2b2079=_0x37afcf[_0x10de('0x7e')]();_0x37afcf[_0x10de('0x1d')](_0x233307);_0x37afcf[_0x10de('0x1c')](0x0);logger[_0x10de('0x7f')](_0x10de('0x8b'),_0x37afcf[_0x10de('0x80')]());return db['sequelize'][_0x10de('0x34')](_0x37afcf[_0x10de('0x80')](),{'type':db['sequelize']['QueryTypes']['SELECT']});}})['then'](function(_0x438660){if(!_0x438660[_0x10de('0x3a')]){throw new db[(_0x10de('0x6a'))][(_0x10de('0x6b'))](_0x10de('0x8c'),0xcc);}if(_0x5ddfcd['output']==='web'){return null;}var _0x371d62=_[_0x10de('0x42')](_0x5ddfcd,{'name':_0x5ddfcd[_0x10de('0x8d')]||_0x5ddfcd[_0x10de('0x2d')]||_0x233d0c[_0x10de('0x2d')],'basename':_0x289fe9,'savename':util[_0x10de('0x71')](_0x10de('0x8e'),_0x5ddfcd[_0x10de('0x2d')]||_0x233d0c[_0x10de('0x2d')],require('randomstring')[_0x10de('0x8f')](0x4),_0x5ddfcd[_0x10de('0x90')]||_0x10de('0x91')),'reportId':_0x233d0c['id'],'reportType':_0x10de('0x92')});return db['AnalyticExtractedReport'][_0x10de('0x4e')](_0x371d62,{'raw':!![]});})[_0x10de('0x26')](function(_0x78c208){if(_0x233d0c[_0x10de('0x8a')]==='cdr'){_0x2b2079[_0x10de('0x3f')](_0x233d0c[_0x10de('0x8a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5ddfcd[_0x10de('0x93')],_0x5ddfcd[_0x10de('0x94')]);}else{_0x2b2079[_0x10de('0x3f')](_0x233d0c['table']+_0x10de('0x95'),_0x5ddfcd[_0x10de('0x93')],_0x5ddfcd['endDate']);}if(_0x78c208){logger['info'](_0x10de('0x96'),_0x2b2079[_0x10de('0x80')]());require(_0x10de('0x97'))[_0x10de('0x98')](path['join'](__dirname,_0x10de('0x99'),_0x78c208[_0x10de('0x90')]),[_0x78c208['id'],_0x2b2079[_0x10de('0x80')](),path[_0x10de('0x55')](__dirname,_0x10de('0x9a'),_0x78c208[_0x10de('0x9b')]),_0x289fe9]);return _0x78c208;}else{var _0x1c3980=squel[_0x10de('0x6c')]();_0x1c3980['from']('('+_0x2b2079['toString']()+')','countTable');_0x1c3980['field'](_0x10de('0x9c'),_0x10de('0x45'));_0x2b2079[_0x10de('0x1d')](_0x5ddfcd[_0x10de('0x1d')]||_0x233307);_0x2b2079[_0x10de('0x1c')](_0x5ddfcd[_0x10de('0x1c')]||0x0);return dbH[_0x10de('0x9d')]['query'](_0x1c3980[_0x10de('0x80')](),{'type':dbH[_0x10de('0x9d')][_0x10de('0x9e')][_0x10de('0x81')]})[_0x10de('0x26')](function(_0xa93ce7){if(!_0xa93ce7[_0x10de('0x3a')]){_0x300e56=0x0;}else{_0x300e56=_0xa93ce7[0x0]['count']||0x0;}return dbH[_0x10de('0x9d')][_0x10de('0x34')](_0x2b2079[_0x10de('0x80')](),{'type':dbH['sequelize'][_0x10de('0x9e')][_0x10de('0x81')]});})[_0x10de('0x26')](function(_0x472597){return{'rows':_0x472597||[],'count':_0x300e56};});}});}exports[_0x10de('0x9f')]=function(_0x5066d6,_0x3f61a5){return runReport(_0x5066d6['params'],_0x5066d6[_0x10de('0x34')],_0x5066d6['options'])['then'](respondWithResult(_0x3f61a5,null))['catch'](handleError(_0x3f61a5,null));};exports[_0x10de('0xa0')]=runReport;exports[_0x10de('0x34')]=function(_0x18d45d,_0x37928a){var _0x1fc3f6=0xa;var _0x5e679b=[_0x10de('0x55'),_0x10de('0x56'),'right_join',_0x10de('0x83')];var _0x3d780f={'SUM':_0x10de('0x57'),'COUNT':_0x10de('0x58'),'COUNT DISTINCT':_0x10de('0x59'),'MAX':_0x10de('0x5a'),'MIN':_0x10de('0xa1'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x10de('0xa2'),'GROUP_CONCAT ASC':_0x10de('0x85'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x302c33={'SEC_TO_TIME':_0x10de('0x86'),'DATE':'DATE(%s)','HOUR':_0x10de('0x5d'),'ROUND':_0x10de('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x24e6d5=function(_0x42cc8b){return!_[_0x10de('0x60')]([_0x10de('0x61'),'IS\x20NOT\x20NULL',_0x10de('0xa3'),_0x10de('0x63')],_0x42cc8b);};var _0x324046=function(_0x197de0){if(!_0x197de0||!_0x197de0['rules'][_0x10de('0x3a')]){return'';}for(var _0x1a796c='(',_0x9d38fc=0x0;_0x9d38fc<_0x197de0[_0x10de('0x64')][_0x10de('0x3a')];_0x9d38fc+=0x1){_0x9d38fc>0x0&&(_0x1a796c+='\x20'+_0x197de0['operator']+'\x20');_0x1a796c+=_0x197de0[_0x10de('0x64')][_0x9d38fc][_0x10de('0x66')]?_0x324046(_0x197de0['rules'][_0x9d38fc][_0x10de('0x66')]):_0x197de0['rules'][_0x9d38fc][_0x10de('0x67')]+'\x20'+_0x197de0[_0x10de('0x64')][_0x9d38fc][_0x10de('0x68')]+(_0x24e6d5(_0x197de0[_0x10de('0x64')][_0x9d38fc][_0x10de('0x68')])?'\x20'+_0x197de0['rules'][_0x9d38fc][_0x10de('0x69')]:'');}return _0x1a796c+')';};var _0x229f04={'where':{'id':_0x18d45d['params']['id']}},_0x2c76c0,_0x378001,_0x2bc529,_0x1ac314,_0x3a8c95;_0x229f04=_[_0x10de('0x42')]({},_0x229f04,_0x18d45d['options']);return db[_0x10de('0x2f')][_0x10de('0x4d')](_0x229f04)['then'](function(_0x250da5){if(_0x250da5){_0x2c76c0=_0x250da5;return _0x250da5[_0x10de('0x87')]();}return null;})['then'](function(_0xce76cd){if(_0xce76cd){if(!_0xce76cd[_0x10de('0x3a')]){throw new db[(_0x10de('0x6a'))][(_0x10de('0x6b'))](_0x10de('0x88'),0x193);}_0x378001=_0xce76cd;return db[_0x10de('0xa4')][_0x10de('0x47')]({'raw':!![]});}return null;})[_0x10de('0x26')](function(_0x1de9bf){if(_0x1de9bf){_0x2bc529=_[_0x10de('0x89')](_0x1de9bf,'id');var _0x7edb06;var _0x395e48=squel['select']();_0x395e48[_0x10de('0x6d')](_0x2c76c0[_0x10de('0x8a')]);for(var _0x396cbc=0x0;_0x396cbc<_0x378001[_0x10de('0x3a')];_0x396cbc+=0x1){_0x7edb06=_0x378001[_0x396cbc][_0x10de('0x6e')]?_0x2bc529[_0x378001[_0x396cbc][_0x10de('0x6e')]]['metric']:_0x378001[_0x396cbc][_0x10de('0x67')];_0x7edb06=_0x378001[_0x396cbc][_0x10de('0x70')]?_[_0x10de('0x72')](_0x3d780f[_0x378001[_0x396cbc][_0x10de('0x70')]],'%s',_0x7edb06):_0x7edb06;_0x7edb06=_0x378001[_0x396cbc]['format']?_[_0x10de('0x72')](_0x302c33[_0x378001[_0x396cbc]['format']],'%s',_0x7edb06):_0x7edb06;if(_0x378001[_0x396cbc][_0x10de('0x73')]){_0x395e48[_0x10de('0x66')](_0x7edb06);}_0x378001[_0x396cbc][_0x10de('0x74')]&&_0x395e48['order'](_0x7edb06,_0x378001[_0x396cbc][_0x10de('0x74')]===_0x10de('0x75')?![]:!![]);_0x395e48[_0x10de('0x67')](_0x7edb06,_0x378001[_0x396cbc]['alias']||_0x7edb06);}if(_0x2c76c0[_0x10de('0x77')]){_0x2c76c0[_0x10de('0x77')]=JSON['parse'](_0x2c76c0[_0x10de('0x77')]);for(var _0x41498e=0x0;_0x41498e<_0x2c76c0[_0x10de('0x77')][_0x10de('0x3a')];_0x41498e+=0x1){if(_0x2c76c0[_0x10de('0x77')][_0x41498e][_0x10de('0x32')]&&_[_0x10de('0x60')](_0x5e679b,_0x2c76c0[_0x10de('0x77')][_0x41498e][_0x10de('0x32')])&&_0x2c76c0[_0x10de('0x77')][_0x41498e][_0x10de('0x7c')]&&_0x2c76c0[_0x10de('0x77')][_0x41498e]['foreignTable']&&_0x2c76c0[_0x10de('0x77')][_0x41498e]['foreignKey']){_0x395e48[_0x2c76c0[_0x10de('0x77')][_0x41498e][_0x10de('0x32')]](_0x2c76c0[_0x10de('0x77')][_0x41498e][_0x10de('0x79')],null,util[_0x10de('0x71')](_0x10de('0x7b'),_0x2c76c0['table'],_0x2c76c0['joins'][_0x41498e][_0x10de('0x7c')],_0x2c76c0['joins'][_0x41498e][_0x10de('0x79')],_0x2c76c0[_0x10de('0x77')][_0x41498e]['foreignKey']));}}}if(_0x2c76c0[_0x10de('0x7d')]){_0x2c76c0['conditions']=JSON[_0x10de('0x78')](_0x2c76c0[_0x10de('0x7d')]);_0x395e48[_0x10de('0x3f')](_0x324046(_0x2c76c0['conditions'][_0x10de('0x66')]));}_0x3a8c95=_0x395e48[_0x10de('0x7e')]();_0x395e48[_0x10de('0x1d')](_0x1fc3f6);_0x395e48['offset'](0x0);logger['debug'](_0x10de('0x8b'),_0x395e48['toString']());return db[_0x10de('0x9d')]['query'](_0x395e48[_0x10de('0x80')](),{'type':db[_0x10de('0x9d')][_0x10de('0x9e')][_0x10de('0x81')]});}})['then'](function(){return{'sql':_0x3a8c95[_0x10de('0x80')]()};})['then'](respondWithResult(_0x37928a,null))[_0x10de('0x48')](handleError(_0x37928a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 61aa1c9..06094ca 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 _0xb541=['../../config/environment','./analyticDefaultReport.attributes','analytics_default_reports','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x1038bf,_0x237586){var _0x147548=function(_0x3c855d){while(--_0x3c855d){_0x1038bf['push'](_0x1038bf['shift']());}};_0x147548(++_0x237586);}(_0xb541,0x19d));var _0x1b54=function(_0x4caa02,_0x222d75){_0x4caa02=_0x4caa02-0x0;var _0x53dfe3=_0xb541[_0x4caa02];return _0x53dfe3;};'use strict';var _=require(_0x1b54('0x0'));var util=require(_0x1b54('0x1'));var logger=require(_0x1b54('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1b54('0x3'));var rp=require(_0x1b54('0x4'));var fs=require('fs');var path=require(_0x1b54('0x5'));var rimraf=require(_0x1b54('0x6'));var config=require(_0x1b54('0x7'));var attributes=require(_0x1b54('0x8'));module['exports']=function(_0x412fad,_0x12eebd){return _0x412fad['define']('AnalyticDefaultReport',attributes,{'tableName':_0x1b54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89b7=['request-promise','rimraf','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports','../../config/logger','api','moment','bluebird'];(function(_0x3b3295,_0x5d28d9){var _0x28f5e6=function(_0x4403ec){while(--_0x4403ec){_0x3b3295['push'](_0x3b3295['shift']());}};_0x28f5e6(++_0x5d28d9);}(_0x89b7,0x1dc));var _0x789b=function(_0x1c1172,_0x27c3c4){_0x1c1172=_0x1c1172-0x0;var _0x300943=_0x89b7[_0x1c1172];return _0x300943;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x789b('0x0'))(_0x789b('0x1'));var moment=require(_0x789b('0x2'));var BPromise=require(_0x789b('0x3'));var rp=require(_0x789b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789b('0x5'));var config=require(_0x789b('0x6'));var attributes=require('./analyticDefaultReport.attributes');module[_0x789b('0x7')]=function(_0x53d7cf,_0x55b32f){return _0x53d7cf['define'](_0x789b('0x8'),attributes,{'tableName':_0x789b('0x9'),'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 5e15622..9abbbfd 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 _0x0427=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','AnalyticDefaultReport,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x51da41,_0x7a9e11){var _0x454afb=function(_0x5c3b21){while(--_0x5c3b21){_0x51da41['push'](_0x51da41['shift']());}};_0x454afb(++_0x7a9e11);}(_0x0427,0x137));var _0x7042=function(_0x348c37,_0x49667e){_0x348c37=_0x348c37-0x0;var _0x5ecda0=_0x0427[_0x348c37];return _0x5ecda0;};'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']('AnalyticDefaultReport,\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')]('AnalyticDefaultReport,\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')]('AnalyticDefaultReport,\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 _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x37c969,_0x27ae1a){var _0x36c585=function(_0x18db2c){while(--_0x18db2c){_0x37c969['push'](_0x37c969['shift']());}};_0x36c585(++_0x27ae1a);}(_0x0439,0xdd));var _0x9043=function(_0x358e3b,_0x72233f){_0x358e3b=_0x358e3b-0x0;var _0x4906c0=_0x0439[_0x358e3b];return _0x4906c0;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index eb789a0..5ed9eec 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 _0x973e=['/:id/query','query','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x1d2613,_0xf15e8c){var _0x4ae9c1=function(_0x186a96){while(--_0x186a96){_0x1d2613['push'](_0x1d2613['shift']());}};_0x4ae9c1(++_0xf15e8c);}(_0x973e,0x7a));var _0xe973=function(_0x2341bd,_0x580511){_0x2341bd=_0x2341bd-0x0;var _0x5de0f5=_0x973e[_0x2341bd];return _0x5de0f5;};'use strict';var multer=require(_0xe973('0x0'));var util=require('util');var path=require(_0xe973('0x1'));var timeout=require(_0xe973('0x2'));var express=require(_0xe973('0x3'));var router=express[_0xe973('0x4')]();var auth=require(_0xe973('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe973('0x6'));var controller=require(_0xe973('0x7'));router[_0xe973('0x8')]('/',auth[_0xe973('0x9')](),controller[_0xe973('0xa')]);router['get'](_0xe973('0xb'),auth[_0xe973('0x9')](),controller[_0xe973('0xc')]);router[_0xe973('0x8')](_0xe973('0xd'),auth[_0xe973('0x9')](),controller[_0xe973('0xe')]);router[_0xe973('0x8')](_0xe973('0xf'),auth[_0xe973('0x9')](),controller['run']);router[_0xe973('0x8')](_0xe973('0x10'),auth[_0xe973('0x9')](),controller[_0xe973('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe973('0x12')]);router[_0xe973('0x13')](_0xe973('0xb'),auth[_0xe973('0x9')](),controller[_0xe973('0x14')]);router[_0xe973('0x15')](_0xe973('0xb'),auth[_0xe973('0x9')](),controller['destroy']);module[_0xe973('0x16')]=router; \ No newline at end of file +var _0x03c6=['/:id','show','/:id/run','/:id/query','query','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index'];(function(_0x83131e,_0x56b542){var _0x285644=function(_0x29a8a7){while(--_0x29a8a7){_0x83131e['push'](_0x83131e['shift']());}};_0x285644(++_0x56b542);}(_0x03c6,0x97));var _0x603c=function(_0x1acd9c,_0x3797b1){_0x1acd9c=_0x1acd9c-0x0;var _0x5bd0f9=_0x03c6[_0x1acd9c];return _0x5bd0f9;};'use strict';var multer=require(_0x603c('0x0'));var util=require(_0x603c('0x1'));var path=require(_0x603c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x603c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x603c('0x4'));var config=require('../../config/environment');var controller=require(_0x603c('0x5'));router[_0x603c('0x6')]('/',auth[_0x603c('0x7')](),controller[_0x603c('0x8')]);router['get'](_0x603c('0x9'),auth[_0x603c('0x7')](),controller[_0x603c('0xa')]);router[_0x603c('0x6')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router['get'](_0x603c('0xb'),auth[_0x603c('0x7')](),controller['run']);router[_0x603c('0x6')](_0x603c('0xc'),auth[_0x603c('0x7')](),controller[_0x603c('0xd')]);router[_0x603c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x603c('0xf')]('/:id',auth[_0x603c('0x7')](),controller[_0x603c('0x10')]);router[_0x603c('0x11')](_0x603c('0x9'),auth[_0x603c('0x7')](),controller[_0x603c('0x12')]);module[_0x603c('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 8f104da..cbbc056 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 _0x9c94=['manual','scheduled','INTEGER','sequelize','moment','exports','STRING','ENUM','csv','xlsx','DATE','Loading'];(function(_0x2a6415,_0x6c94d6){var _0x121cfd=function(_0x504270){while(--_0x504270){_0x2a6415['push'](_0x2a6415['shift']());}};_0x121cfd(++_0x6c94d6);}(_0x9c94,0xff));var _0x49c9=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x9c94[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0x49c9('0x0'));var moment=require(_0x49c9('0x1'));module[_0x49c9('0x2')]={'name':{'type':Sequelize[_0x49c9('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x49c9('0x4')](_0x49c9('0x5'),'pdf',_0x49c9('0x6')),'allowNull':![],'defaultValue':_0x49c9('0x5')},'savename':{'type':Sequelize[_0x49c9('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x49c9('0x7')]},'endDate':{'type':Sequelize[_0x49c9('0x7')]},'status':{'type':Sequelize[_0x49c9('0x3')],'defaultValue':_0x49c9('0x8')},'type':{'type':Sequelize['ENUM'](_0x49c9('0x9'),_0x49c9('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x49c9('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x49c9('0x3')]}}; \ No newline at end of file +var _0x57d0=['exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x419cb0,_0x101bab){var _0xe63e3d=function(_0xbfb24c){while(--_0xbfb24c){_0x419cb0['push'](_0x419cb0['shift']());}};_0xe63e3d(++_0x101bab);}(_0x57d0,0x11e));var _0x057d=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x57d0[_0x47e309];return _0x2e1900;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x057d('0x0')]={'name':{'type':Sequelize[_0x057d('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x057d('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x057d('0x2')](_0x057d('0x3'),_0x057d('0x4'),_0x057d('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x057d('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x057d('0x6')]},'endDate':{'type':Sequelize[_0x057d('0x6')]},'status':{'type':Sequelize[_0x057d('0x1')],'defaultValue':_0x057d('0x7')},'type':{'type':Sequelize[_0x057d('0x2')](_0x057d('0x8'),_0x057d('0x9')),'allowNull':![],'defaultValue':_0x057d('0x8')},'reportId':{'type':Sequelize[_0x057d('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x057d('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 86157a0..a801e57 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 _0x7a54=['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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','output','join','root','savename','Sequelize','exists','download','server/files/reports','%s.%s','toLowerCase','html-pdf','eml-format'];(function(_0x2e6860,_0x209030){var _0x514eb0=function(_0x2052ff){while(--_0x2052ff){_0x2e6860['push'](_0x2e6860['shift']());}};_0x514eb0(++_0x209030);}(_0x7a54,0x106));var _0x47a5=function(_0x5cc665,_0x506100){_0x5cc665=_0x5cc665-0x0;var _0x4f0a88=_0x7a54[_0x5cc665];return _0x4f0a88;};'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 licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='ExtractedReports';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filtears']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));};exports['download']=function(_0x4c5ed,_0x3c78b7,_0x183b3c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4c5ed[_0x47a5('0x4d')]['id']},'attributes':[_0x47a5('0x26'),'basename','savename',_0x47a5('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x3c78b7,null))[_0x47a5('0x20')](function(_0x5d383d){if(_0x5d383d){if(!fs['existsSync'](path[_0x47a5('0x4f')](config[_0x47a5('0x50')],'server/files/reports',_0x5d383d[_0x47a5('0x51')]))){throw new db[(_0x47a5('0x52'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x4c5ed[_0x47a5('0x30')][_0x47a5('0x53')]){return _0x3c78b7[_0x47a5('0x16')](0xc8);}return _0x3c78b7[_0x47a5('0x54')](path['join'](config[_0x47a5('0x50')],_0x47a5('0x55'),_0x5d383d[_0x47a5('0x51')]),util['format'](_0x47a5('0x56'),_0x5d383d['basename']||_0x5d383d[_0x47a5('0x26')],_0x5d383d[_0x47a5('0x4e')][_0x47a5('0x57')]()));}})[_0x47a5('0x40')](handleError(_0x3c78b7,null));}; \ No newline at end of file +var _0x7a54=['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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','model','map','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','output','join','root','savename','Sequelize','exists','download','server/files/reports','%s.%s','toLowerCase','html-pdf','eml-format'];(function(_0x550bb4,_0x71e2e0){var _0x4a421a=function(_0x14e77d){while(--_0x14e77d){_0x550bb4['push'](_0x550bb4['shift']());}};_0x4a421a(++_0x71e2e0);}(_0x7a54,0x106));var _0x47a5=function(_0x450e2a,_0x532824){_0x450e2a=_0x450e2a-0x0;var _0x5c44ae=_0x7a54[_0x450e2a];return _0x5c44ae;};'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 licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){var _0x5ef1b1=_0x2f142b[_0x47a5('0x22')]({'plain':!![]});var _0x385687='ExtractedReports';return db[_0x47a5('0x23')][_0x47a5('0x21')]({'where':{'type':_0x385687,'resourceId':_0x5ef1b1['id']}})[_0x47a5('0x20')](function(){return _0x2f142b;});})[_0x47a5('0x20')](function(){_0x4c5910[_0x47a5('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53078a,_0x136745){return function(_0x5686db){if(!_0x5686db){_0x53078a[_0x47a5('0x16')](0x194);}return _0x5686db;};}function handleError(_0x5b6c4e,_0x23cb77){_0x23cb77=_0x23cb77||0x1f4;return function(_0x378208){logger[_0x47a5('0x24')](_0x378208[_0x47a5('0x25')]);if(_0x378208[_0x47a5('0x26')]){delete _0x378208[_0x47a5('0x26')];}_0x5b6c4e[_0x47a5('0x17')](_0x23cb77)[_0x47a5('0x27')](_0x378208);};}exports[_0x47a5('0x28')]=function(_0x361bfa,_0x1127f8){var _0x11a4fa={},_0x3ad507={},_0x528582={'count':0x0,'rows':[]};var _0x243210=_['map'](db[_0x47a5('0x29')][_0x47a5('0x2a')],function(_0x16901f){return{'name':_0x16901f['fieldName'],'type':_0x16901f[_0x47a5('0x2b')][_0x47a5('0x2c')]};});_0x3ad507[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x243210,'name');_0x3ad507['query']=_[_0x47a5('0x2f')](_0x361bfa[_0x47a5('0x30')]);_0x3ad507['filters']=_['intersection'](_0x3ad507[_0x47a5('0x2d')],_0x3ad507[_0x47a5('0x30')]);_0x11a4fa['attributes']=_[_0x47a5('0x31')](_0x3ad507['model'],qs[_0x47a5('0x32')](_0x361bfa[_0x47a5('0x30')]['fields']));_0x11a4fa['attributes']=_0x11a4fa[_0x47a5('0x33')]['length']?_0x11a4fa[_0x47a5('0x33')]:_0x3ad507[_0x47a5('0x2d')];if(!_0x361bfa[_0x47a5('0x30')]['hasOwnProperty'](_0x47a5('0x34'))){_0x11a4fa['limit']=qs['limit'](_0x361bfa[_0x47a5('0x30')]['limit']);_0x11a4fa[_0x47a5('0x1a')]=qs['offset'](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x1a')]);}_0x11a4fa[_0x47a5('0x35')]=qs[_0x47a5('0x36')](_0x361bfa[_0x47a5('0x30')][_0x47a5('0x36')]);_0x11a4fa[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_[_0x47a5('0x39')](_0x361bfa['query'],_0x3ad507[_0x47a5('0x38')]),_0x243210);if(_0x361bfa[_0x47a5('0x30')]['filter']){_0x11a4fa[_0x47a5('0x37')]=_[_0x47a5('0x3a')](_0x11a4fa[_0x47a5('0x37')],{'$or':_['map'](_0x243210,function(_0x101f70){if(_0x101f70[_0x47a5('0x2b')]!=='VIRTUAL'){var _0x2ebba0={};_0x2ebba0[_0x101f70[_0x47a5('0x26')]]={'$like':'%'+_0x361bfa['query']['filter']+'%'};return _0x2ebba0;}})});}_0x11a4fa=_['merge']({},_0x11a4fa,_0x361bfa[_0x47a5('0x3b')]);var _0x5c569e={'where':_0x11a4fa[_0x47a5('0x37')]};return db[_0x47a5('0x29')][_0x47a5('0x3c')](_0x5c569e)[_0x47a5('0x20')](function(_0x1b2c80){_0x528582[_0x47a5('0x3c')]=_0x1b2c80;if(_0x361bfa[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x11a4fa[_0x47a5('0x3e')]=[{'all':!![]}];}return db[_0x47a5('0x29')][_0x47a5('0x3f')](_0x11a4fa);})[_0x47a5('0x20')](function(_0x23d6d8){_0x528582['rows']=_0x23d6d8;return _0x528582;})[_0x47a5('0x20')](respondWithFilteredResult(_0x1127f8,_0x11a4fa))[_0x47a5('0x40')](handleError(_0x1127f8,null));};exports[_0x47a5('0x41')]=function(_0x23bd8d,_0x586f4f){var _0x7de536={'raw':!![],'where':{'id':_0x23bd8d['params']['id']}},_0x528ef3={};_0x528ef3['model']=_['keys'](db[_0x47a5('0x29')]['rawAttributes']);_0x528ef3[_0x47a5('0x30')]=_[_0x47a5('0x2f')](_0x23bd8d[_0x47a5('0x30')]);_0x528ef3['filtears']=_[_0x47a5('0x31')](_0x528ef3[_0x47a5('0x2d')],_0x528ef3['query']);_0x7de536['attributes']=_[_0x47a5('0x31')](_0x528ef3['model'],qs[_0x47a5('0x32')](_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x32')]));_0x7de536[_0x47a5('0x33')]=_0x7de536[_0x47a5('0x33')][_0x47a5('0x42')]?_0x7de536[_0x47a5('0x33')]:_0x528ef3[_0x47a5('0x2d')];if(_0x23bd8d[_0x47a5('0x30')][_0x47a5('0x3d')]){_0x7de536[_0x47a5('0x3e')]=[{'all':!![]}];}_0x7de536=_[_0x47a5('0x3a')]({},_0x7de536,_0x23bd8d[_0x47a5('0x3b')]);return db[_0x47a5('0x29')][_0x47a5('0x43')](_0x7de536)[_0x47a5('0x20')](handleEntityNotFound(_0x586f4f,null))['then'](respondWithResult(_0x586f4f,null))[_0x47a5('0x40')](handleError(_0x586f4f,null));};exports[_0x47a5('0x44')]=function(_0x49eab1,_0x52b3a8){return db[_0x47a5('0x29')]['create'](_0x49eab1[_0x47a5('0x45')],{})[_0x47a5('0x20')](function(_0x54c35f){var _0x4f62d3=_0x49eab1[_0x47a5('0x46')]['get']({'plain':!![]});if(!_0x4f62d3)throw new Error(_0x47a5('0x47'));if(_0x4f62d3[_0x47a5('0x48')]===_0x47a5('0x46')){var _0x3e12a7=_0x54c35f[_0x47a5('0x22')]({'plain':!![]});var _0x26acd2=_0x47a5('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x26acd2,'userProfileId':_0x4f62d3[_0x47a5('0x4a')]},'raw':!![]})[_0x47a5('0x20')](function(_0x1163e3){if(_0x1163e3&&_0x1163e3[_0x47a5('0x4b')]===0x0){return db[_0x47a5('0x23')][_0x47a5('0x44')]({'name':_0x3e12a7[_0x47a5('0x26')],'resourceId':_0x3e12a7['id'],'type':_0x1163e3['name'],'sectionId':_0x1163e3['id']},{})[_0x47a5('0x20')](function(){return _0x54c35f;});}else{return _0x54c35f;}})[_0x47a5('0x40')](function(_0x5f6a){logger['error'](_0x47a5('0x4c'),_0x5f6a);throw _0x5f6a;});}return _0x54c35f;})['then'](respondWithResult(_0x52b3a8,0xc9))[_0x47a5('0x40')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x1f')]=function(_0x46e90b,_0xf03bd5){if(_0x46e90b['body']['id']){delete _0x46e90b[_0x47a5('0x45')]['id'];}return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x46e90b[_0x47a5('0x4d')]['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0xf03bd5,null))[_0x47a5('0x20')](saveUpdates(_0x46e90b[_0x47a5('0x45')],null))['then'](respondWithResult(_0xf03bd5,null))[_0x47a5('0x40')](handleError(_0xf03bd5,null));};exports[_0x47a5('0x21')]=function(_0x187d7e,_0x8da9fb){return db[_0x47a5('0x29')][_0x47a5('0x43')]({'where':{'id':_0x187d7e['params']['id']}})[_0x47a5('0x20')](handleEntityNotFound(_0x8da9fb,null))[_0x47a5('0x20')](removeEntity(_0x8da9fb,null))[_0x47a5('0x40')](handleError(_0x8da9fb,null));};exports['download']=function(_0x4c5ed,_0x3c78b7,_0x183b3c){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4c5ed[_0x47a5('0x4d')]['id']},'attributes':[_0x47a5('0x26'),'basename','savename',_0x47a5('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x3c78b7,null))[_0x47a5('0x20')](function(_0x5d383d){if(_0x5d383d){if(!fs['existsSync'](path[_0x47a5('0x4f')](config[_0x47a5('0x50')],'server/files/reports',_0x5d383d[_0x47a5('0x51')]))){throw new db[(_0x47a5('0x52'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x4c5ed[_0x47a5('0x30')][_0x47a5('0x53')]){return _0x3c78b7[_0x47a5('0x16')](0xc8);}return _0x3c78b7[_0x47a5('0x54')](path['join'](config[_0x47a5('0x50')],_0x47a5('0x55'),_0x5d383d[_0x47a5('0x51')]),util['format'](_0x47a5('0x56'),_0x5d383d['basename']||_0x5d383d[_0x47a5('0x26')],_0x5d383d[_0x47a5('0x4e')][_0x47a5('0x57')]()));}})[_0x47a5('0x40')](handleError(_0x3c78b7,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 64ee0bf..38d6a5a 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 _0xc9a4=['lodash','../../config/logger','api','path','../../config/environment','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x59134f,_0x695437){var _0x43814e=function(_0x5751e6){while(--_0x5751e6){_0x59134f['push'](_0x59134f['shift']());}};_0x43814e(++_0x695437);}(_0xc9a4,0x170));var _0x4c9a=function(_0x155454,_0x3f55ff){_0x155454=_0x155454-0x0;var _0x52257f=_0xc9a4[_0x155454];return _0x52257f;};'use strict';var _=require(_0x4c9a('0x0'));var util=require('util');var logger=require(_0x4c9a('0x1'))(_0x4c9a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c9a('0x3'));var rimraf=require('rimraf');var config=require(_0x4c9a('0x4'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x367784,_0x5cf934){return _0x367784[_0x4c9a('0x5')](_0x4c9a('0x6'),attributes,{'tableName':_0x4c9a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7dc=['analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x53bf96,_0x2ae51d){var _0x4ab349=function(_0x3ee225){while(--_0x3ee225){_0x53bf96['push'](_0x53bf96['shift']());}};_0x4ab349(++_0x2ae51d);}(_0xd7dc,0x1ed));var _0xcd7d=function(_0x409251,_0x40f525){_0x409251=_0x409251-0x0;var _0x216f47=_0xd7dc[_0x409251];return _0x216f47;};'use strict';var _=require(_0xcd7d('0x0'));var util=require(_0xcd7d('0x1'));var logger=require(_0xcd7d('0x2'))('api');var moment=require(_0xcd7d('0x3'));var BPromise=require(_0xcd7d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcd7d('0x5'));var config=require(_0xcd7d('0x6'));var attributes=require(_0xcd7d('0x7'));module[_0xcd7d('0x8')]=function(_0x1046cd,_0x54251c){return _0x1046cd[_0xcd7d('0x9')](_0xcd7d('0xa'),attributes,{'tableName':_0xcd7d('0xb'),'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 16e3715..633abbd 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 _0xc066=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x55b32b,_0x453ec2){var _0x527c07=function(_0x474d53){while(--_0x474d53){_0x55b32b['push'](_0x55b32b['shift']());}};_0x527c07(++_0x453ec2);}(_0xc066,0x1de));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c06('0x0'));var BPromise=require(_0x6c06('0x1'));var rs=require(_0x6c06('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6c06('0x3'));var logger=require(_0x6c06('0x4'))(_0x6c06('0x5'));var config=require(_0x6c06('0x6'));var jayson=require(_0x6c06('0x7'));var client=jayson[_0x6c06('0x8')][_0x6c06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b854a,_0x4c56f1,_0x29d706){return new BPromise(function(_0x2944d7,_0x448e79){return client[_0x6c06('0xa')](_0x4b854a,_0x29d706)[_0x6c06('0xb')](function(_0x321dd2){logger[_0x6c06('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4c56f1,_0x6c06('0xd'));logger[_0x6c06('0xe')](_0x6c06('0xf'),_0x4c56f1,'request\x20sent',JSON['stringify'](_0x321dd2));if(_0x321dd2['error']){if(_0x321dd2[_0x6c06('0x10')][_0x6c06('0x11')]===0x1f4){logger[_0x6c06('0x10')](_0x6c06('0x12'),_0x4c56f1,_0x321dd2['error'][_0x6c06('0x13')]);return _0x448e79(_0x321dd2[_0x6c06('0x10')][_0x6c06('0x13')]);}logger['error'](_0x6c06('0x12'),_0x4c56f1,_0x321dd2[_0x6c06('0x10')]['message']);return _0x2944d7(_0x321dd2[_0x6c06('0x10')][_0x6c06('0x13')]);}else{logger[_0x6c06('0xc')](_0x6c06('0x12'),_0x4c56f1,'request\x20sent');_0x2944d7(_0x321dd2[_0x6c06('0x14')][_0x6c06('0x13')]);}})['catch'](function(_0x478943){logger[_0x6c06('0x10')](_0x6c06('0x12'),_0x4c56f1,_0x478943);_0x448e79(_0x478943);});});} \ No newline at end of file +var _0x4653=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','ioredis','../../mysqldb'];(function(_0x5436c0,_0x45beac){var _0x51a455=function(_0x3502f7){while(--_0x3502f7){_0x5436c0['push'](_0x5436c0['shift']());}};_0x51a455(++_0x45beac);}(_0x4653,0x1a0));var _0x3465=function(_0x17630e,_0x43abb2){_0x17630e=_0x17630e-0x0;var _0x4f2bcb=_0x4653[_0x17630e];return _0x4f2bcb;};'use strict';var _=require(_0x3465('0x0'));var util=require(_0x3465('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3465('0x2'));var db=require(_0x3465('0x3'))['db'];var utils=require(_0x3465('0x4'));var logger=require(_0x3465('0x5'))('rpc');var config=require(_0x3465('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3465('0x7')][_0x3465('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45bb23,_0x3fead2,_0xaf4b44){return new BPromise(function(_0x34fb20,_0x432996){return client[_0x3465('0x9')](_0x45bb23,_0xaf4b44)[_0x3465('0xa')](function(_0x4a41b6){logger[_0x3465('0xb')](_0x3465('0xc'),_0x3fead2,_0x3465('0xd'));logger[_0x3465('0xe')](_0x3465('0xf'),_0x3fead2,_0x3465('0xd'),JSON[_0x3465('0x10')](_0x4a41b6));if(_0x4a41b6[_0x3465('0x11')]){if(_0x4a41b6[_0x3465('0x11')]['code']===0x1f4){logger[_0x3465('0x11')](_0x3465('0xc'),_0x3fead2,_0x4a41b6[_0x3465('0x11')][_0x3465('0x12')]);return _0x432996(_0x4a41b6[_0x3465('0x11')]['message']);}logger[_0x3465('0x11')](_0x3465('0xc'),_0x3fead2,_0x4a41b6[_0x3465('0x11')][_0x3465('0x12')]);return _0x34fb20(_0x4a41b6[_0x3465('0x11')][_0x3465('0x12')]);}else{logger[_0x3465('0xb')](_0x3465('0xc'),_0x3fead2,_0x3465('0xd'));_0x34fb20(_0x4a41b6[_0x3465('0x13')][_0x3465('0x12')]);}})[_0x3465('0x14')](function(_0x51eb6b){logger[_0x3465('0x11')](_0x3465('0xc'),_0x3fead2,_0x51eb6b);_0x432996(_0x51eb6b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 493931b..2cefcb3 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 _0x1aac=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x16983e,_0x18cb58){var _0x342e8f=function(_0x553d29){while(--_0x553d29){_0x16983e['push'](_0x16983e['shift']());}};_0x342e8f(++_0x18cb58);}(_0x1aac,0xf7));var _0xc1aa=function(_0x191629,_0x32b99a){_0x191629=_0x191629-0x0;var _0x45c9ad=_0x1aac[_0x191629];return _0x45c9ad;};'use strict';var multer=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var path=require(_0xc1aa('0x2'));var timeout=require(_0xc1aa('0x3'));var express=require(_0xc1aa('0x4'));var router=express['Router']();var auth=require(_0xc1aa('0x5'));var interaction=require(_0xc1aa('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xc1aa('0x7')]('/',auth[_0xc1aa('0x8')](),controller['index']);router['get'](_0xc1aa('0x9'),auth['isAuthenticated'](),controller[_0xc1aa('0xa')]);router['get']('/:id/download',auth[_0xc1aa('0x8')](),controller[_0xc1aa('0xb')]);router[_0xc1aa('0xc')]('/',auth[_0xc1aa('0x8')](),controller[_0xc1aa('0xd')]);router['put']('/:id',auth[_0xc1aa('0x8')](),controller[_0xc1aa('0xe')]);router[_0xc1aa('0xf')](_0xc1aa('0x9'),auth[_0xc1aa('0x8')](),controller[_0xc1aa('0x10')]);module[_0xc1aa('0x11')]=router; \ No newline at end of file +var _0xb95d=['express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','index','show','/:id/download','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0xb95d,0x1c5));var _0xdb95=function(_0x5ef80b,_0x4d2a07){_0x5ef80b=_0x5ef80b-0x0;var _0x2c9776=_0xb95d[_0x5ef80b];return _0x2c9776;};'use strict';var multer=require(_0xdb95('0x0'));var util=require('util');var path=require(_0xdb95('0x1'));var timeout=require(_0xdb95('0x2'));var express=require(_0xdb95('0x3'));var router=express[_0xdb95('0x4')]();var auth=require(_0xdb95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb95('0x6'));var controller=require(_0xdb95('0x7'));router[_0xdb95('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb95('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdb95('0xa')]);router[_0xdb95('0x8')](_0xdb95('0xb'),auth[_0xdb95('0xc')](),controller['download']);router[_0xdb95('0xd')]('/',auth[_0xdb95('0xc')](),controller['create']);router['put'](_0xdb95('0xe'),auth['isAuthenticated'](),controller[_0xdb95('0xf')]);router[_0xdb95('0x10')](_0xdb95('0xe'),auth[_0xdb95('0xc')](),controller[_0xdb95('0x11')]);module[_0xdb95('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 8bb3e65..d9cb055 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 _0xe14b=['sequelize','exports','STRING'];(function(_0x47b2e6,_0x496527){var _0x34441e=function(_0x2c596d){while(--_0x2c596d){_0x47b2e6['push'](_0x47b2e6['shift']());}};_0x34441e(++_0x496527);}(_0xe14b,0x93));var _0xbe14=function(_0x3befd3,_0x45bd8a){_0x3befd3=_0x3befd3-0x0;var _0x1218bf=_0xe14b[_0x3befd3];return _0x1218bf;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xbe14('0x2')]},'format':{'type':Sequelize[_0xbe14('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbe14('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x9f3e28,_0x1f8595){var _0x171ceb=function(_0x164c41){while(--_0x164c41){_0x9f3e28['push'](_0x9f3e28['shift']());}};_0x171ceb(++_0x1f8595);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x5fc3[_0x13c70c];return _0x50f0f2;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 2214bea..8e68684 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 _0xb7aa=['sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','filtears','find','create','bulkCreate','body','params','ids','addFields','findOne','sequelize','transaction','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','limit','order'];(function(_0xf82f83,_0x5a9045){var _0x202583=function(_0x68cf55){while(--_0x68cf55){_0xf82f83['push'](_0xf82f83['shift']());}};_0x202583(++_0x5a9045);}(_0xb7aa,0x160));var _0xab7a=function(_0x28af3c,_0x2d6abf){_0x28af3c=_0x28af3c-0x0;var _0x2fcdc8=_0xb7aa[_0x28af3c];return _0x2fcdc8;};'use strict';var pdf=require(_0xab7a('0x0'));var emlformat=require(_0xab7a('0x1'));var rimraf=require(_0xab7a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab7a('0x3'));var rp=require(_0xab7a('0x4'));var moment=require('moment');var BPromise=require(_0xab7a('0x5'));var Mustache=require(_0xab7a('0x6'));var util=require('util');var path=require(_0xab7a('0x7'));var sox=require(_0xab7a('0x8'));var csv=require('to-csv');var ejs=require(_0xab7a('0x9'));var fs=require('fs');var _=require(_0xab7a('0xa'));var squel=require(_0xab7a('0xb'));var crypto=require('crypto');var jsforce=require(_0xab7a('0xc'));var deskjs=require(_0xab7a('0xd'));var toCsv=require(_0xab7a('0xe'));var querystring=require(_0xab7a('0xf'));var Papa=require(_0xab7a('0x10'));var Redis=require(_0xab7a('0x11'));var authService=require(_0xab7a('0x12'));var qs=require(_0xab7a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab7a('0x14'));var logger=require(_0xab7a('0x15'))(_0xab7a('0x16'));var utils=require(_0xab7a('0x17'));var config=require(_0xab7a('0x18'));var licenseUtil=require(_0xab7a('0x19'));var db=require(_0xab7a('0x1a'))['db'];function respondWithStatusCode(_0x11bee1,_0x43205f){_0x43205f=_0x43205f||0xcc;return function(_0x16da25){if(_0x16da25){return _0x11bee1[_0xab7a('0x1b')](_0x43205f);}return _0x11bee1['status'](_0x43205f)['end']();};}function respondWithResult(_0x3c01a8,_0x1c10d4){_0x1c10d4=_0x1c10d4||0xc8;return function(_0x1a6b68){if(_0x1a6b68){return _0x3c01a8['status'](_0x1c10d4)[_0xab7a('0x1c')](_0x1a6b68);}};}function respondWithFilteredResult(_0x5c34fb,_0x99b985){return function(_0x54704f){if(_0x54704f){var _0x28aa0d=_0x54704f[_0xab7a('0x1d')],_0x55dc0c=_0x99b985[_0xab7a('0x1e')],_0x463d31=_0x99b985[_0xab7a('0x1e')]+_0x99b985['limit'],_0x1298d9;if(_0x463d31>=_0x28aa0d){_0x463d31=_0x28aa0d;_0x1298d9=0xc8;}else{_0x1298d9=0xce;}_0x5c34fb[_0xab7a('0x1f')](_0x1298d9);return _0x5c34fb[_0xab7a('0x20')](_0xab7a('0x21'),_0x55dc0c+'-'+_0x463d31+'/'+_0x28aa0d)[_0xab7a('0x1c')](_0x54704f);}return null;};}function patchUpdates(_0x43d817){return function(_0x1250b0){try{jsonpatch[_0xab7a('0x22')](_0x1250b0,_0x43d817,!![]);}catch(_0x2921f2){return BPromise['reject'](_0x2921f2);}return _0x1250b0[_0xab7a('0x23')]();};}function saveUpdates(_0x361b39,_0x350428){return function(_0x41b207){if(_0x41b207){return _0x41b207[_0xab7a('0x24')](_0x361b39)[_0xab7a('0x25')](function(_0x3b69d6){return _0x3b69d6;});}return null;};}function removeEntity(_0x47d8f4,_0x3d9548){return function(_0x57eee4){if(_0x57eee4){return _0x57eee4[_0xab7a('0x26')]()[_0xab7a('0x25')](function(){_0x47d8f4[_0xab7a('0x1f')](0xcc)[_0xab7a('0x27')]();});}};}function handleEntityNotFound(_0x5cfba7,_0x2a1bce){return function(_0x2d8d33){if(!_0x2d8d33){_0x5cfba7[_0xab7a('0x1b')](0x194);}return _0x2d8d33;};}function handleError(_0x286332,_0x3d9d1c){_0x3d9d1c=_0x3d9d1c||0x1f4;return function(_0x136adc){logger['error'](_0x136adc[_0xab7a('0x28')]);if(_0x136adc[_0xab7a('0x29')]){delete _0x136adc['name'];}_0x286332[_0xab7a('0x1f')](_0x3d9d1c)['send'](_0x136adc);};}exports[_0xab7a('0x2a')]=function(_0x3115dc,_0x49fc71){var _0x6e756a={},_0x1da8bc={},_0x57e6b1={'count':0x0,'rows':[]};var _0x45e338=_[_0xab7a('0x2b')](db[_0xab7a('0x2c')][_0xab7a('0x2d')],function(_0x2116b0){return{'name':_0x2116b0[_0xab7a('0x2e')],'type':_0x2116b0['type'][_0xab7a('0x2f')]};});_0x1da8bc[_0xab7a('0x30')]=_[_0xab7a('0x2b')](_0x45e338,_0xab7a('0x29'));_0x1da8bc['query']=_[_0xab7a('0x31')](_0x3115dc[_0xab7a('0x32')]);_0x1da8bc[_0xab7a('0x33')]=_[_0xab7a('0x34')](_0x1da8bc[_0xab7a('0x30')],_0x1da8bc[_0xab7a('0x32')]);_0x6e756a[_0xab7a('0x35')]=_['intersection'](_0x1da8bc['model'],qs[_0xab7a('0x36')](_0x3115dc[_0xab7a('0x32')][_0xab7a('0x36')]));_0x6e756a[_0xab7a('0x35')]=_0x6e756a['attributes'][_0xab7a('0x37')]?_0x6e756a[_0xab7a('0x35')]:_0x1da8bc[_0xab7a('0x30')];if(!_0x3115dc[_0xab7a('0x32')]['hasOwnProperty']('nolimit')){_0x6e756a[_0xab7a('0x38')]=qs[_0xab7a('0x38')](_0x3115dc[_0xab7a('0x32')]['limit']);_0x6e756a[_0xab7a('0x1e')]=qs['offset'](_0x3115dc[_0xab7a('0x32')]['offset']);}_0x6e756a[_0xab7a('0x39')]=qs[_0xab7a('0x3a')](_0x3115dc[_0xab7a('0x32')][_0xab7a('0x3a')]);_0x6e756a[_0xab7a('0x3b')]=qs[_0xab7a('0x33')](_['pick'](_0x3115dc['query'],_0x1da8bc['filters']),_0x45e338);if(_0x3115dc[_0xab7a('0x32')][_0xab7a('0x3c')]){_0x6e756a['where']=_['merge'](_0x6e756a[_0xab7a('0x3b')],{'$or':_[_0xab7a('0x2b')](_0x45e338,function(_0x204391){if(_0x204391[_0xab7a('0x3d')]!==_0xab7a('0x3e')){var _0x588a3b={};_0x588a3b[_0x204391[_0xab7a('0x29')]]={'$like':'%'+_0x3115dc[_0xab7a('0x32')]['filter']+'%'};return _0x588a3b;}})});}_0x6e756a=_[_0xab7a('0x3f')]({},_0x6e756a,_0x3115dc[_0xab7a('0x40')]);var _0x59ea6c={'where':_0x6e756a[_0xab7a('0x3b')]};return db['AnalyticFieldReport'][_0xab7a('0x1d')](_0x59ea6c)['then'](function(_0x449aa1){_0x57e6b1['count']=_0x449aa1;if(_0x3115dc[_0xab7a('0x32')][_0xab7a('0x41')]){_0x6e756a[_0xab7a('0x42')]=[{'all':!![]}];}return db[_0xab7a('0x2c')][_0xab7a('0x43')](_0x6e756a);})[_0xab7a('0x25')](function(_0x389344){_0x57e6b1[_0xab7a('0x44')]=_0x389344;return _0x57e6b1;})[_0xab7a('0x25')](respondWithFilteredResult(_0x49fc71,_0x6e756a))[_0xab7a('0x45')](handleError(_0x49fc71,null));};exports[_0xab7a('0x46')]=function(_0x4ca0e9,_0x276c0a){var _0x2c7f02={'raw':![],'where':{'id':_0x4ca0e9['params']['id']}},_0x1623f0={};_0x1623f0[_0xab7a('0x30')]=_[_0xab7a('0x31')](db[_0xab7a('0x2c')][_0xab7a('0x2d')]);_0x1623f0[_0xab7a('0x32')]=_['keys'](_0x4ca0e9['query']);_0x1623f0[_0xab7a('0x47')]=_[_0xab7a('0x34')](_0x1623f0[_0xab7a('0x30')],_0x1623f0[_0xab7a('0x32')]);_0x2c7f02[_0xab7a('0x35')]=_[_0xab7a('0x34')](_0x1623f0['model'],qs[_0xab7a('0x36')](_0x4ca0e9[_0xab7a('0x32')][_0xab7a('0x36')]));_0x2c7f02['attributes']=_0x2c7f02['attributes'][_0xab7a('0x37')]?_0x2c7f02['attributes']:_0x1623f0[_0xab7a('0x30')];if(_0x4ca0e9['query'][_0xab7a('0x41')]){_0x2c7f02[_0xab7a('0x42')]=[{'all':!![]}];}_0x2c7f02=_[_0xab7a('0x3f')]({},_0x2c7f02,_0x4ca0e9[_0xab7a('0x40')]);return db[_0xab7a('0x2c')][_0xab7a('0x48')](_0x2c7f02)[_0xab7a('0x25')](handleEntityNotFound(_0x276c0a,null))[_0xab7a('0x25')](respondWithResult(_0x276c0a,null))['catch'](handleError(_0x276c0a,null));};exports['create']=function(_0x584960,_0x411ad0){return db[_0xab7a('0x2c')][_0xab7a('0x49')](_0x584960['body'],{})[_0xab7a('0x25')](respondWithResult(_0x411ad0,0xc9))[_0xab7a('0x45')](handleError(_0x411ad0,null));};exports[_0xab7a('0x4a')]=function(_0x5ae616,_0x3abc63){return db['AnalyticFieldReport'][_0xab7a('0x4a')](_0x5ae616[_0xab7a('0x4b')],{'raw':![],'individualHooks':!![]})[_0xab7a('0x25')](respondWithResult(_0x3abc63,0xc9))['catch'](handleError(_0x3abc63,null));};exports[_0xab7a('0x24')]=function(_0x50f13f,_0xa37f25){if(_0x50f13f[_0xab7a('0x4b')]['id']){delete _0x50f13f['body']['id'];}return db[_0xab7a('0x2c')][_0xab7a('0x48')]({'where':{'id':_0x50f13f['params']['id']}})[_0xab7a('0x25')](handleEntityNotFound(_0xa37f25,null))[_0xab7a('0x25')](saveUpdates(_0x50f13f[_0xab7a('0x4b')],null))['then'](respondWithResult(_0xa37f25,null))[_0xab7a('0x45')](handleError(_0xa37f25,null));};exports[_0xab7a('0x26')]=function(_0x421fe6,_0x41319a){return db[_0xab7a('0x2c')][_0xab7a('0x48')]({'where':{'id':_0x421fe6[_0xab7a('0x4c')]['id']}})[_0xab7a('0x25')](handleEntityNotFound(_0x41319a,null))[_0xab7a('0x25')](removeEntity(_0x41319a,null))[_0xab7a('0x45')](handleError(_0x41319a,null));};exports['bulkDestroy']=function(_0x73e2ec,_0x424a11){return db[_0xab7a('0x2c')]['destroy']({'where':{'id':_0x73e2ec[_0xab7a('0x32')][_0xab7a('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xab7a('0x25')](respondWithResult(_0x424a11,0xcc))[_0xab7a('0x45')](handleError(_0x424a11,null));};exports[_0xab7a('0x4e')]=function(_0x1874bd,_0x5d0a92,_0x22f3f3){return db['AnalyticCustomReport'][_0xab7a('0x4f')]({'where':{'id':_0x1874bd['params']['id']}})[_0xab7a('0x25')](handleEntityNotFound(_0x5d0a92,null))[_0xab7a('0x25')](function(_0x3fa1f9){if(_0x3fa1f9){return db[_0xab7a('0x50')][_0xab7a('0x51')](function(_0x26f20c){return db['AnalyticFieldReport'][_0xab7a('0x26')]({'where':{'CustomReportId':_0x1874bd['params']['id']},'transaction':_0x26f20c})[_0xab7a('0x25')](function(_0x48b0ed){var _0x17083d=_[_0xab7a('0x2b')](_0x1874bd[_0xab7a('0x4b')],function(_0x1008e2){delete _0x1008e2['id'];_0x1008e2['CustomReportId']=_0x1874bd['params']['id'];return _0x1008e2;});return db['AnalyticFieldReport'][_0xab7a('0x4a')](_0x17083d,{'transaction':_0x26f20c});});})[_0xab7a('0x25')](function(){return db[_0xab7a('0x2c')][_0xab7a('0x43')]({'where':{'CustomReportId':_0x1874bd['params']['id']}});});}})[_0xab7a('0x25')](respondWithResult(_0x5d0a92,null))['catch'](handleError(_0x5d0a92,null));}; \ No newline at end of file +var _0xbcda=['../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticFieldReport','includeAll','include','findAll','rows','catch','show','params','filtears','options','find','create','body','bulkCreate','update','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x352f63,_0x4bbe67){var _0x4e883b=function(_0x134d96){while(--_0x134d96){_0x352f63['push'](_0x352f63['shift']());}};_0x4e883b(++_0x4bbe67);}(_0xbcda,0xe1));var _0xabcd=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xbcda[_0x45e98e];return _0x374dba;};'use strict';var pdf=require(_0xabcd('0x0'));var emlformat=require(_0xabcd('0x1'));var rimraf=require(_0xabcd('0x2'));var zipdir=require(_0xabcd('0x3'));var jsonpatch=require(_0xabcd('0x4'));var rp=require('request-promise');var moment=require(_0xabcd('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xabcd('0x6'));var csv=require(_0xabcd('0x7'));var ejs=require(_0xabcd('0x8'));var fs=require('fs');var _=require(_0xabcd('0x9'));var squel=require('squel');var crypto=require(_0xabcd('0xa'));var jsforce=require(_0xabcd('0xb'));var deskjs=require(_0xabcd('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabcd('0xd'));var Redis=require('ioredis');var authService=require(_0xabcd('0xe'));var qs=require(_0xabcd('0xf'));var as=require(_0xabcd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabcd('0x11'))(_0xabcd('0x12'));var utils=require(_0xabcd('0x13'));var config=require(_0xabcd('0x14'));var licenseUtil=require(_0xabcd('0x15'));var db=require(_0xabcd('0x16'))['db'];function respondWithStatusCode(_0x433102,_0x579d0f){_0x579d0f=_0x579d0f||0xcc;return function(_0x222211){if(_0x222211){return _0x433102[_0xabcd('0x17')](_0x579d0f);}return _0x433102[_0xabcd('0x18')](_0x579d0f)[_0xabcd('0x19')]();};}function respondWithResult(_0x1cfd64,_0x1d762b){_0x1d762b=_0x1d762b||0xc8;return function(_0x4a4512){if(_0x4a4512){return _0x1cfd64[_0xabcd('0x18')](_0x1d762b)['json'](_0x4a4512);}};}function respondWithFilteredResult(_0x47c9bd,_0x42cfab){return function(_0x5383c6){if(_0x5383c6){var _0x1b9ed7=_0x5383c6[_0xabcd('0x1a')],_0x47a9b1=_0x42cfab[_0xabcd('0x1b')],_0x441291=_0x42cfab[_0xabcd('0x1b')]+_0x42cfab[_0xabcd('0x1c')],_0x5e106f;if(_0x441291>=_0x1b9ed7){_0x441291=_0x1b9ed7;_0x5e106f=0xc8;}else{_0x5e106f=0xce;}_0x47c9bd['status'](_0x5e106f);return _0x47c9bd[_0xabcd('0x1d')](_0xabcd('0x1e'),_0x47a9b1+'-'+_0x441291+'/'+_0x1b9ed7)[_0xabcd('0x1f')](_0x5383c6);}return null;};}function patchUpdates(_0x3add90){return function(_0x25f83b){try{jsonpatch[_0xabcd('0x20')](_0x25f83b,_0x3add90,!![]);}catch(_0x203e78){return BPromise[_0xabcd('0x21')](_0x203e78);}return _0x25f83b['save']();};}function saveUpdates(_0x289e08,_0x5d94c8){return function(_0x592426){if(_0x592426){return _0x592426['update'](_0x289e08)[_0xabcd('0x22')](function(_0x4031fc){return _0x4031fc;});}return null;};}function removeEntity(_0x3810b5,_0x3cb9a1){return function(_0x4d1718){if(_0x4d1718){return _0x4d1718[_0xabcd('0x23')]()[_0xabcd('0x22')](function(){_0x3810b5[_0xabcd('0x18')](0xcc)[_0xabcd('0x19')]();});}};}function handleEntityNotFound(_0x30f7b0,_0x459521){return function(_0x15016b){if(!_0x15016b){_0x30f7b0[_0xabcd('0x17')](0x194);}return _0x15016b;};}function handleError(_0x1b2633,_0x353a53){_0x353a53=_0x353a53||0x1f4;return function(_0x4f077f){logger[_0xabcd('0x24')](_0x4f077f['stack']);if(_0x4f077f[_0xabcd('0x25')]){delete _0x4f077f[_0xabcd('0x25')];}_0x1b2633[_0xabcd('0x18')](_0x353a53)[_0xabcd('0x26')](_0x4f077f);};}exports[_0xabcd('0x27')]=function(_0x3d1cb9,_0x3abb19){var _0x71b300={},_0x71aa64={},_0x123f6c={'count':0x0,'rows':[]};var _0x5649de=_[_0xabcd('0x28')](db['AnalyticFieldReport'][_0xabcd('0x29')],function(_0x4bdc09){return{'name':_0x4bdc09['fieldName'],'type':_0x4bdc09[_0xabcd('0x2a')][_0xabcd('0x2b')]};});_0x71aa64[_0xabcd('0x2c')]=_['map'](_0x5649de,_0xabcd('0x25'));_0x71aa64['query']=_[_0xabcd('0x2d')](_0x3d1cb9[_0xabcd('0x2e')]);_0x71aa64[_0xabcd('0x2f')]=_[_0xabcd('0x30')](_0x71aa64[_0xabcd('0x2c')],_0x71aa64[_0xabcd('0x2e')]);_0x71b300['attributes']=_[_0xabcd('0x30')](_0x71aa64[_0xabcd('0x2c')],qs[_0xabcd('0x31')](_0x3d1cb9[_0xabcd('0x2e')]['fields']));_0x71b300[_0xabcd('0x32')]=_0x71b300[_0xabcd('0x32')][_0xabcd('0x33')]?_0x71b300['attributes']:_0x71aa64[_0xabcd('0x2c')];if(!_0x3d1cb9['query'][_0xabcd('0x34')](_0xabcd('0x35'))){_0x71b300['limit']=qs[_0xabcd('0x1c')](_0x3d1cb9['query'][_0xabcd('0x1c')]);_0x71b300['offset']=qs[_0xabcd('0x1b')](_0x3d1cb9[_0xabcd('0x2e')][_0xabcd('0x1b')]);}_0x71b300[_0xabcd('0x36')]=qs[_0xabcd('0x37')](_0x3d1cb9[_0xabcd('0x2e')][_0xabcd('0x37')]);_0x71b300[_0xabcd('0x38')]=qs[_0xabcd('0x2f')](_[_0xabcd('0x39')](_0x3d1cb9[_0xabcd('0x2e')],_0x71aa64[_0xabcd('0x2f')]),_0x5649de);if(_0x3d1cb9[_0xabcd('0x2e')][_0xabcd('0x3a')]){_0x71b300['where']=_[_0xabcd('0x3b')](_0x71b300['where'],{'$or':_['map'](_0x5649de,function(_0x35b446){if(_0x35b446[_0xabcd('0x2a')]!==_0xabcd('0x3c')){var _0x5d442b={};_0x5d442b[_0x35b446['name']]={'$like':'%'+_0x3d1cb9[_0xabcd('0x2e')][_0xabcd('0x3a')]+'%'};return _0x5d442b;}})});}_0x71b300=_[_0xabcd('0x3b')]({},_0x71b300,_0x3d1cb9['options']);var _0x3e8918={'where':_0x71b300[_0xabcd('0x38')]};return db[_0xabcd('0x3d')][_0xabcd('0x1a')](_0x3e8918)['then'](function(_0x5118e6){_0x123f6c[_0xabcd('0x1a')]=_0x5118e6;if(_0x3d1cb9[_0xabcd('0x2e')][_0xabcd('0x3e')]){_0x71b300[_0xabcd('0x3f')]=[{'all':!![]}];}return db[_0xabcd('0x3d')][_0xabcd('0x40')](_0x71b300);})[_0xabcd('0x22')](function(_0x49edd1){_0x123f6c[_0xabcd('0x41')]=_0x49edd1;return _0x123f6c;})[_0xabcd('0x22')](respondWithFilteredResult(_0x3abb19,_0x71b300))[_0xabcd('0x42')](handleError(_0x3abb19,null));};exports[_0xabcd('0x43')]=function(_0x38eb93,_0x56b825){var _0x1f943f={'raw':![],'where':{'id':_0x38eb93[_0xabcd('0x44')]['id']}},_0x552dd9={};_0x552dd9[_0xabcd('0x2c')]=_[_0xabcd('0x2d')](db[_0xabcd('0x3d')]['rawAttributes']);_0x552dd9['query']=_['keys'](_0x38eb93[_0xabcd('0x2e')]);_0x552dd9[_0xabcd('0x45')]=_['intersection'](_0x552dd9[_0xabcd('0x2c')],_0x552dd9['query']);_0x1f943f['attributes']=_[_0xabcd('0x30')](_0x552dd9[_0xabcd('0x2c')],qs['fields'](_0x38eb93[_0xabcd('0x2e')]['fields']));_0x1f943f[_0xabcd('0x32')]=_0x1f943f['attributes'][_0xabcd('0x33')]?_0x1f943f[_0xabcd('0x32')]:_0x552dd9[_0xabcd('0x2c')];if(_0x38eb93[_0xabcd('0x2e')][_0xabcd('0x3e')]){_0x1f943f['include']=[{'all':!![]}];}_0x1f943f=_[_0xabcd('0x3b')]({},_0x1f943f,_0x38eb93[_0xabcd('0x46')]);return db['AnalyticFieldReport'][_0xabcd('0x47')](_0x1f943f)[_0xabcd('0x22')](handleEntityNotFound(_0x56b825,null))[_0xabcd('0x22')](respondWithResult(_0x56b825,null))[_0xabcd('0x42')](handleError(_0x56b825,null));};exports[_0xabcd('0x48')]=function(_0x5d703b,_0x21ea3b){return db[_0xabcd('0x3d')][_0xabcd('0x48')](_0x5d703b[_0xabcd('0x49')],{})[_0xabcd('0x22')](respondWithResult(_0x21ea3b,0xc9))[_0xabcd('0x42')](handleError(_0x21ea3b,null));};exports[_0xabcd('0x4a')]=function(_0xd5b6f,_0x4bcb65){return db[_0xabcd('0x3d')][_0xabcd('0x4a')](_0xd5b6f['body'],{'raw':![],'individualHooks':!![]})[_0xabcd('0x22')](respondWithResult(_0x4bcb65,0xc9))[_0xabcd('0x42')](handleError(_0x4bcb65,null));};exports[_0xabcd('0x4b')]=function(_0x41be06,_0x9cc415){if(_0x41be06[_0xabcd('0x49')]['id']){delete _0x41be06[_0xabcd('0x49')]['id'];}return db[_0xabcd('0x3d')]['find']({'where':{'id':_0x41be06['params']['id']}})[_0xabcd('0x22')](handleEntityNotFound(_0x9cc415,null))[_0xabcd('0x22')](saveUpdates(_0x41be06[_0xabcd('0x49')],null))[_0xabcd('0x22')](respondWithResult(_0x9cc415,null))[_0xabcd('0x42')](handleError(_0x9cc415,null));};exports[_0xabcd('0x23')]=function(_0x4b54f3,_0x518273){return db['AnalyticFieldReport'][_0xabcd('0x47')]({'where':{'id':_0x4b54f3['params']['id']}})[_0xabcd('0x22')](handleEntityNotFound(_0x518273,null))[_0xabcd('0x22')](removeEntity(_0x518273,null))['catch'](handleError(_0x518273,null));};exports[_0xabcd('0x4c')]=function(_0x54f046,_0x49fce8){return db['AnalyticFieldReport'][_0xabcd('0x23')]({'where':{'id':_0x54f046[_0xabcd('0x2e')][_0xabcd('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xabcd('0x22')](respondWithResult(_0x49fce8,0xcc))[_0xabcd('0x42')](handleError(_0x49fce8,null));};exports['addFields']=function(_0x307706,_0x206c3d,_0x56efd5){return db[_0xabcd('0x4e')][_0xabcd('0x4f')]({'where':{'id':_0x307706['params']['id']}})['then'](handleEntityNotFound(_0x206c3d,null))[_0xabcd('0x22')](function(_0x4e4b42){if(_0x4e4b42){return db[_0xabcd('0x50')][_0xabcd('0x51')](function(_0x1295b7){return db[_0xabcd('0x3d')]['destroy']({'where':{'CustomReportId':_0x307706[_0xabcd('0x44')]['id']},'transaction':_0x1295b7})[_0xabcd('0x22')](function(_0x5924ed){var _0x287577=_[_0xabcd('0x28')](_0x307706[_0xabcd('0x49')],function(_0x2c5268){delete _0x2c5268['id'];_0x2c5268['CustomReportId']=_0x307706[_0xabcd('0x44')]['id'];return _0x2c5268;});return db[_0xabcd('0x3d')][_0xabcd('0x4a')](_0x287577,{'transaction':_0x1295b7});});})[_0xabcd('0x22')](function(){return db[_0xabcd('0x3d')][_0xabcd('0x40')]({'where':{'CustomReportId':_0x307706[_0xabcd('0x44')]['id']}});});}})[_0xabcd('0x22')](respondWithResult(_0x206c3d,null))[_0xabcd('0x42')](handleError(_0x206c3d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a361906..d21090f 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 _0x370b=['moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x370b,0x14c));var _0xb370=function(_0x97bbfd,_0xd00fda){_0x97bbfd=_0x97bbfd-0x0;var _0x288aaa=_0x370b[_0x97bbfd];return _0x288aaa;};'use strict';var _=require(_0xb370('0x0'));var util=require(_0xb370('0x1'));var logger=require(_0xb370('0x2'))(_0xb370('0x3'));var moment=require(_0xb370('0x4'));var BPromise=require('bluebird');var rp=require(_0xb370('0x5'));var fs=require('fs');var path=require(_0xb370('0x6'));var rimraf=require('rimraf');var config=require(_0xb370('0x7'));var attributes=require(_0xb370('0x8'));module['exports']=function(_0x43e34f,_0x5e218d){return _0x43e34f[_0xb370('0x9')](_0xb370('0xa'),attributes,{'tableName':_0xb370('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d43=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8d43,0x161));var _0x38d4=function(_0x348ebc,_0x5e3091){_0x348ebc=_0x348ebc-0x0;var _0x5f4011=_0x8d43[_0x348ebc];return _0x5f4011;};'use strict';var _=require(_0x38d4('0x0'));var util=require('util');var logger=require(_0x38d4('0x1'))(_0x38d4('0x2'));var moment=require('moment');var BPromise=require(_0x38d4('0x3'));var rp=require(_0x38d4('0x4'));var fs=require('fs');var path=require(_0x38d4('0x5'));var rimraf=require(_0x38d4('0x6'));var config=require(_0x38d4('0x7'));var attributes=require(_0x38d4('0x8'));module[_0x38d4('0x9')]=function(_0x5c2e75,_0x222fed){return _0x5c2e75[_0x38d4('0xa')](_0x38d4('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c364ef5..ddd3a9a 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 _0x7538=['debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x41966d,_0x5c5e69){var _0x48aaec=function(_0x51669e){while(--_0x51669e){_0x41966d['push'](_0x41966d['shift']());}};_0x48aaec(++_0x5c5e69);}(_0x7538,0xa3));var _0x8753=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x7538[_0x1c7137];return _0xeb4432;};'use strict';var _=require('lodash');var util=require(_0x8753('0x0'));var moment=require(_0x8753('0x1'));var BPromise=require('bluebird');var rs=require(_0x8753('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8753('0x3'))['db'];var utils=require(_0x8753('0x4'));var logger=require(_0x8753('0x5'))('rpc');var config=require(_0x8753('0x6'));var jayson=require(_0x8753('0x7'));var client=jayson[_0x8753('0x8')][_0x8753('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24a184,_0x1a9882,_0x58440e){return new BPromise(function(_0x3b5c4a,_0x271227){return client['request'](_0x24a184,_0x58440e)[_0x8753('0xa')](function(_0x4dd00f){logger[_0x8753('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a9882,_0x8753('0xc'));logger[_0x8753('0xd')](_0x8753('0xe'),_0x1a9882,'request\x20sent',JSON[_0x8753('0xf')](_0x4dd00f));if(_0x4dd00f[_0x8753('0x10')]){if(_0x4dd00f[_0x8753('0x10')][_0x8753('0x11')]===0x1f4){logger['error'](_0x8753('0x12'),_0x1a9882,_0x4dd00f[_0x8753('0x10')]['message']);return _0x271227(_0x4dd00f[_0x8753('0x10')][_0x8753('0x13')]);}logger[_0x8753('0x10')](_0x8753('0x12'),_0x1a9882,_0x4dd00f[_0x8753('0x10')][_0x8753('0x13')]);return _0x3b5c4a(_0x4dd00f[_0x8753('0x10')][_0x8753('0x13')]);}else{logger[_0x8753('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1a9882,_0x8753('0xc'));_0x3b5c4a(_0x4dd00f[_0x8753('0x14')][_0x8753('0x13')]);}})[_0x8753('0x15')](function(_0x160d73){logger[_0x8753('0x10')](_0x8753('0x12'),_0x1a9882,_0x160d73);_0x271227(_0x160d73);});});} \ No newline at end of file +var _0x7bf5=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x547ab2,_0xab269f){var _0x4ea807=function(_0xd3a821){while(--_0xd3a821){_0x547ab2['push'](_0x547ab2['shift']());}};_0x4ea807(++_0xab269f);}(_0x7bf5,0x94));var _0x57bf=function(_0x2af009,_0x189708){_0x2af009=_0x2af009-0x0;var _0x46a012=_0x7bf5[_0x2af009];return _0x46a012;};'use strict';var _=require(_0x57bf('0x0'));var util=require(_0x57bf('0x1'));var moment=require(_0x57bf('0x2'));var BPromise=require('bluebird');var rs=require(_0x57bf('0x3'));var fs=require('fs');var Redis=require(_0x57bf('0x4'));var db=require(_0x57bf('0x5'))['db'];var utils=require(_0x57bf('0x6'));var logger=require(_0x57bf('0x7'))('rpc');var config=require(_0x57bf('0x8'));var jayson=require(_0x57bf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x378224,_0x414d31,_0x1139da){return new BPromise(function(_0x33b7f5,_0x2e9c2b){return client[_0x57bf('0xa')](_0x378224,_0x1139da)[_0x57bf('0xb')](function(_0x5533ea){logger[_0x57bf('0xc')](_0x57bf('0xd'),_0x414d31,_0x57bf('0xe'));logger['debug'](_0x57bf('0xf'),_0x414d31,_0x57bf('0xe'),JSON[_0x57bf('0x10')](_0x5533ea));if(_0x5533ea[_0x57bf('0x11')]){if(_0x5533ea[_0x57bf('0x11')][_0x57bf('0x12')]===0x1f4){logger[_0x57bf('0x11')](_0x57bf('0xd'),_0x414d31,_0x5533ea[_0x57bf('0x11')][_0x57bf('0x13')]);return _0x2e9c2b(_0x5533ea[_0x57bf('0x11')][_0x57bf('0x13')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x414d31,_0x5533ea[_0x57bf('0x11')][_0x57bf('0x13')]);return _0x33b7f5(_0x5533ea[_0x57bf('0x11')][_0x57bf('0x13')]);}else{logger[_0x57bf('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x414d31,'request\x20sent');_0x33b7f5(_0x5533ea[_0x57bf('0x14')][_0x57bf('0x13')]);}})['catch'](function(_0x43071e){logger[_0x57bf('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x414d31,_0x43071e);_0x2e9c2b(_0x43071e);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 4fd3d46..aa35ecb 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 _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x47b038,_0x1b0295){var _0xf5a7f1=function(_0x4bdc6b){while(--_0x4bdc6b){_0x47b038['push'](_0x47b038['shift']());}};_0xf5a7f1(++_0x1b0295);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x3e74=['./analyticFieldReport.controller','get','isAuthenticated','index','show','post','create','/create_many','/:id/create_many','addFields','/:id','delete','/destroy_many','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service'];(function(_0x14c821,_0x5e4899){var _0x5ec638=function(_0x2050b5){while(--_0x2050b5){_0x14c821['push'](_0x14c821['shift']());}};_0x5ec638(++_0x5e4899);}(_0x3e74,0x175));var _0x43e7=function(_0x34858c,_0xc591ad){_0x34858c=_0x34858c-0x0;var _0x554345=_0x3e74[_0x34858c];return _0x554345;};'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')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['post'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x43e7('0xa')](_0x43e7('0xd'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router['put'](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0x11'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x12')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x13')]);module[_0x43e7('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index d1a64f8..614afb1 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 _0xa521=['exports','STRING','TEXT','sequelize'];(function(_0x5be3cc,_0x3b5c7d){var _0x1162a2=function(_0x1db04c){while(--_0x1db04c){_0x5be3cc['push'](_0x5be3cc['shift']());}};_0x1162a2(++_0x3b5c7d);}(_0xa521,0xeb));var _0x1a52=function(_0x3cfd24,_0x111cf2){_0x3cfd24=_0x3cfd24-0x0;var _0x4e46d7=_0xa521[_0x3cfd24];return _0x4e46d7;};'use strict';var Sequelize=require(_0x1a52('0x0'));module[_0x1a52('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x1a52('0x2')]},'metric':{'type':Sequelize[_0x1a52('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4227=['STRING','sequelize','name','TEXT'];(function(_0xf65bf8,_0x494a66){var _0x2e4a66=function(_0x50d0de){while(--_0x50d0de){_0xf65bf8['push'](_0xf65bf8['shift']());}};_0x2e4a66(++_0x494a66);}(_0x4227,0x89));var _0x7422=function(_0x3ff8a6,_0x1cf312){_0x3ff8a6=_0x3ff8a6-0x0;var _0x208771=_0x4227[_0x3ff8a6];return _0x208771;};'use strict';var Sequelize=require(_0x7422('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7422('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x7422('0x2')]},'description':{'type':Sequelize[_0x7422('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5657329..af57666 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 _0x7f03=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','reject','update','then','destroy','get','status','error','stack','name','index','AnalyticMetric','fieldName','type','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll'];(function(_0x4c669e,_0x46b79d){var _0x309d53=function(_0x38bd1a){while(--_0x38bd1a){_0x4c669e['push'](_0x4c669e['shift']());}};_0x309d53(++_0x46b79d);}(_0x7f03,0xaf));var _0x37f0=function(_0x4b19d9,_0x1fefdb){_0x4b19d9=_0x4b19d9-0x0;var _0x21c55f=_0x7f03[_0x4b19d9];return _0x21c55f;};'use strict';var pdf=require(_0x37f0('0x0'));var emlformat=require(_0x37f0('0x1'));var rimraf=require(_0x37f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37f0('0x3'));var rp=require(_0x37f0('0x4'));var moment=require(_0x37f0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x37f0('0x6'));var util=require(_0x37f0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x37f0('0x8'));var ejs=require(_0x37f0('0x9'));var fs=require('fs');var _=require(_0x37f0('0xa'));var squel=require(_0x37f0('0xb'));var crypto=require(_0x37f0('0xc'));var jsforce=require(_0x37f0('0xd'));var deskjs=require(_0x37f0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x37f0('0xf'));var Papa=require(_0x37f0('0x10'));var Redis=require(_0x37f0('0x11'));var authService=require(_0x37f0('0x12'));var qs=require(_0x37f0('0x13'));var as=require(_0x37f0('0x14'));var hardwareService=require(_0x37f0('0x15'));var logger=require('../../config/logger')(_0x37f0('0x16'));var utils=require(_0x37f0('0x17'));var config=require(_0x37f0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x37f0('0x19'))['db'];function respondWithStatusCode(_0x5eb49e,_0x565442){_0x565442=_0x565442||0xcc;return function(_0x4999a8){if(_0x4999a8){return _0x5eb49e[_0x37f0('0x1a')](_0x565442);}return _0x5eb49e['status'](_0x565442)[_0x37f0('0x1b')]();};}function respondWithResult(_0x297a46,_0x33420d){_0x33420d=_0x33420d||0xc8;return function(_0x5db03d){if(_0x5db03d){return _0x297a46['status'](_0x33420d)[_0x37f0('0x1c')](_0x5db03d);}};}function respondWithFilteredResult(_0x109138,_0x512353){return function(_0x3f4fc4){if(_0x3f4fc4){var _0x22246b=_0x3f4fc4['count'],_0x3b4abc=_0x512353[_0x37f0('0x1d')],_0x90ae3c=_0x512353[_0x37f0('0x1d')]+_0x512353[_0x37f0('0x1e')],_0x259886;if(_0x90ae3c>=_0x22246b){_0x90ae3c=_0x22246b;_0x259886=0xc8;}else{_0x259886=0xce;}_0x109138['status'](_0x259886);return _0x109138[_0x37f0('0x1f')](_0x37f0('0x20'),_0x3b4abc+'-'+_0x90ae3c+'/'+_0x22246b)[_0x37f0('0x1c')](_0x3f4fc4);}return null;};}function patchUpdates(_0x5a9eb9){return function(_0x4819e1){try{jsonpatch['apply'](_0x4819e1,_0x5a9eb9,!![]);}catch(_0x9875c7){return BPromise[_0x37f0('0x21')](_0x9875c7);}return _0x4819e1['save']();};}function saveUpdates(_0x44a31a,_0x3956e7){return function(_0x59ba39){if(_0x59ba39){return _0x59ba39[_0x37f0('0x22')](_0x44a31a)[_0x37f0('0x23')](function(_0x5ca3d0){return _0x5ca3d0;});}return null;};}function removeEntity(_0x526ce5,_0x494216){return function(_0x7b4052){if(_0x7b4052){return _0x7b4052[_0x37f0('0x24')]()[_0x37f0('0x23')](function(){var _0x2a3843=_0x7b4052[_0x37f0('0x25')]({'plain':!![]});var _0x21e0a2='Metrics';return db['UserProfileResource'][_0x37f0('0x24')]({'where':{'type':_0x21e0a2,'resourceId':_0x2a3843['id']}})[_0x37f0('0x23')](function(){return _0x7b4052;});})['then'](function(){_0x526ce5[_0x37f0('0x26')](0xcc)[_0x37f0('0x1b')]();});}};}function handleEntityNotFound(_0x50ee5d,_0x4cd044){return function(_0xdda11b){if(!_0xdda11b){_0x50ee5d[_0x37f0('0x1a')](0x194);}return _0xdda11b;};}function handleError(_0x52c8f7,_0x574240){_0x574240=_0x574240||0x1f4;return function(_0x3b1665){logger[_0x37f0('0x27')](_0x3b1665[_0x37f0('0x28')]);if(_0x3b1665[_0x37f0('0x29')]){delete _0x3b1665['name'];}_0x52c8f7[_0x37f0('0x26')](_0x574240)['send'](_0x3b1665);};}exports[_0x37f0('0x2a')]=function(_0xae7798,_0x2afaa2){var _0x42e4c1={},_0x3e730d={},_0x455cca={'count':0x0,'rows':[]};var _0x363c79=_['map'](db[_0x37f0('0x2b')]['rawAttributes'],function(_0x54d147){return{'name':_0x54d147[_0x37f0('0x2c')],'type':_0x54d147[_0x37f0('0x2d')]['key']};});_0x3e730d[_0x37f0('0x2e')]=_[_0x37f0('0x2f')](_0x363c79,_0x37f0('0x29'));_0x3e730d['query']=_[_0x37f0('0x30')](_0xae7798['query']);_0x3e730d[_0x37f0('0x31')]=_[_0x37f0('0x32')](_0x3e730d['model'],_0x3e730d[_0x37f0('0x33')]);_0x42e4c1['attributes']=_[_0x37f0('0x32')](_0x3e730d[_0x37f0('0x2e')],qs[_0x37f0('0x34')](_0xae7798['query'][_0x37f0('0x34')]));_0x42e4c1[_0x37f0('0x35')]=_0x42e4c1[_0x37f0('0x35')][_0x37f0('0x36')]?_0x42e4c1['attributes']:_0x3e730d[_0x37f0('0x2e')];if(!_0xae7798[_0x37f0('0x33')][_0x37f0('0x37')]('nolimit')){_0x42e4c1[_0x37f0('0x1e')]=qs[_0x37f0('0x1e')](_0xae7798[_0x37f0('0x33')][_0x37f0('0x1e')]);_0x42e4c1['offset']=qs['offset'](_0xae7798[_0x37f0('0x33')][_0x37f0('0x1d')]);}_0x42e4c1[_0x37f0('0x38')]=qs[_0x37f0('0x39')](_0xae7798[_0x37f0('0x33')][_0x37f0('0x39')]);_0x42e4c1[_0x37f0('0x3a')]=qs['filters'](_[_0x37f0('0x3b')](_0xae7798[_0x37f0('0x33')],_0x3e730d[_0x37f0('0x31')]),_0x363c79);if(_0xae7798[_0x37f0('0x33')][_0x37f0('0x3c')]){_0x42e4c1[_0x37f0('0x3a')]=_[_0x37f0('0x3d')](_0x42e4c1[_0x37f0('0x3a')],{'$or':_['map'](_0x363c79,function(_0x21c7ec){if(_0x21c7ec['type']!==_0x37f0('0x3e')){var _0x138c71={};_0x138c71[_0x21c7ec[_0x37f0('0x29')]]={'$like':'%'+_0xae7798[_0x37f0('0x33')][_0x37f0('0x3c')]+'%'};return _0x138c71;}})});}_0x42e4c1=_[_0x37f0('0x3d')]({},_0x42e4c1,_0xae7798[_0x37f0('0x3f')]);var _0x2f0298={'where':_0x42e4c1[_0x37f0('0x3a')]};return db[_0x37f0('0x2b')]['count'](_0x2f0298)[_0x37f0('0x23')](function(_0x353096){_0x455cca[_0x37f0('0x40')]=_0x353096;if(_0xae7798[_0x37f0('0x33')]['includeAll']){_0x42e4c1[_0x37f0('0x41')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x37f0('0x42')](_0x42e4c1);})['then'](function(_0x27a95d){_0x455cca[_0x37f0('0x43')]=_0x27a95d;return _0x455cca;})[_0x37f0('0x23')](respondWithFilteredResult(_0x2afaa2,_0x42e4c1))[_0x37f0('0x44')](handleError(_0x2afaa2,null));};exports['show']=function(_0x2f47b9,_0x188c28){var _0x109270={'raw':!![],'where':{'id':_0x2f47b9[_0x37f0('0x45')]['id']}},_0x47ca4a={};_0x47ca4a[_0x37f0('0x2e')]=_[_0x37f0('0x30')](db[_0x37f0('0x2b')]['rawAttributes']);_0x47ca4a[_0x37f0('0x33')]=_['keys'](_0x2f47b9[_0x37f0('0x33')]);_0x47ca4a['filtears']=_[_0x37f0('0x32')](_0x47ca4a['model'],_0x47ca4a[_0x37f0('0x33')]);_0x109270[_0x37f0('0x35')]=_[_0x37f0('0x32')](_0x47ca4a[_0x37f0('0x2e')],qs[_0x37f0('0x34')](_0x2f47b9[_0x37f0('0x33')][_0x37f0('0x34')]));_0x109270['attributes']=_0x109270['attributes'][_0x37f0('0x36')]?_0x109270['attributes']:_0x47ca4a[_0x37f0('0x2e')];if(_0x2f47b9[_0x37f0('0x33')][_0x37f0('0x46')]){_0x109270[_0x37f0('0x41')]=[{'all':!![]}];}_0x109270=_['merge']({},_0x109270,_0x2f47b9[_0x37f0('0x3f')]);return db[_0x37f0('0x2b')][_0x37f0('0x47')](_0x109270)[_0x37f0('0x23')](handleEntityNotFound(_0x188c28,null))['then'](respondWithResult(_0x188c28,null))[_0x37f0('0x44')](handleError(_0x188c28,null));};exports[_0x37f0('0x48')]=function(_0x9e7e88,_0x1644b7){return db[_0x37f0('0x2b')][_0x37f0('0x48')](_0x9e7e88[_0x37f0('0x49')],{})[_0x37f0('0x23')](function(_0x12067a){var _0x215856=_0x9e7e88[_0x37f0('0x4a')]['get']({'plain':!![]});if(!_0x215856)throw new Error(_0x37f0('0x4b'));if(_0x215856[_0x37f0('0x4c')]===_0x37f0('0x4a')){var _0x4960ba=_0x12067a['get']({'plain':!![]});var _0x45b1c8=_0x37f0('0x4d');return db[_0x37f0('0x4e')][_0x37f0('0x47')]({'where':{'name':_0x45b1c8,'userProfileId':_0x215856[_0x37f0('0x4f')]},'raw':!![]})[_0x37f0('0x23')](function(_0x224b93){if(_0x224b93&&_0x224b93[_0x37f0('0x50')]===0x0){return db[_0x37f0('0x51')]['create']({'name':_0x4960ba[_0x37f0('0x29')],'resourceId':_0x4960ba['id'],'type':_0x224b93[_0x37f0('0x29')],'sectionId':_0x224b93['id']},{})[_0x37f0('0x23')](function(){return _0x12067a;});}else{return _0x12067a;}})[_0x37f0('0x44')](function(_0x453b9e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x453b9e);throw _0x453b9e;});}return _0x12067a;})[_0x37f0('0x23')](respondWithResult(_0x1644b7,0xc9))[_0x37f0('0x44')](handleError(_0x1644b7,null));};exports[_0x37f0('0x22')]=function(_0x44daaf,_0x2b583c){if(_0x44daaf[_0x37f0('0x49')]['id']){delete _0x44daaf[_0x37f0('0x49')]['id'];}return db['AnalyticMetric'][_0x37f0('0x47')]({'where':{'id':_0x44daaf['params']['id']}})[_0x37f0('0x23')](handleEntityNotFound(_0x2b583c,null))[_0x37f0('0x23')](saveUpdates(_0x44daaf[_0x37f0('0x49')],null))['then'](respondWithResult(_0x2b583c,null))[_0x37f0('0x44')](handleError(_0x2b583c,null));};exports[_0x37f0('0x24')]=function(_0x5df97c,_0x11c0d4){return db['AnalyticMetric'][_0x37f0('0x47')]({'where':{'id':_0x5df97c[_0x37f0('0x45')]['id']}})[_0x37f0('0x23')](handleEntityNotFound(_0x11c0d4,null))[_0x37f0('0x23')](removeEntity(_0x11c0d4,null))[_0x37f0('0x44')](handleError(_0x11c0d4,null));}; \ No newline at end of file +var _0x8d66=['merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','filtears','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','get','Metrics','UserProfileResource','then','error','stack','name','index','map','AnalyticMetric','fieldName','type','key','keys','filters','intersection','model','attributes','fields','query','length','nolimit','order','sort','where','filter'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x8d66,0x69));var _0x68d6=function(_0x3b8ff2,_0x305969){_0x3b8ff2=_0x3b8ff2-0x0;var _0xebdb3=_0x8d66[_0x3b8ff2];return _0xebdb3;};'use strict';var pdf=require(_0x68d6('0x0'));var emlformat=require(_0x68d6('0x1'));var rimraf=require(_0x68d6('0x2'));var zipdir=require(_0x68d6('0x3'));var jsonpatch=require(_0x68d6('0x4'));var rp=require(_0x68d6('0x5'));var moment=require(_0x68d6('0x6'));var BPromise=require(_0x68d6('0x7'));var Mustache=require(_0x68d6('0x8'));var util=require('util');var path=require(_0x68d6('0x9'));var sox=require(_0x68d6('0xa'));var csv=require(_0x68d6('0xb'));var ejs=require(_0x68d6('0xc'));var fs=require('fs');var _=require(_0x68d6('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x68d6('0xe'));var deskjs=require(_0x68d6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x68d6('0x10'));var Papa=require(_0x68d6('0x11'));var Redis=require('ioredis');var authService=require(_0x68d6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x68d6('0x13'));var hardwareService=require(_0x68d6('0x14'));var logger=require(_0x68d6('0x15'))('api');var utils=require(_0x68d6('0x16'));var config=require(_0x68d6('0x17'));var licenseUtil=require(_0x68d6('0x18'));var db=require(_0x68d6('0x19'))['db'];function respondWithStatusCode(_0x3cbc17,_0xa28533){_0xa28533=_0xa28533||0xcc;return function(_0x596920){if(_0x596920){return _0x3cbc17[_0x68d6('0x1a')](_0xa28533);}return _0x3cbc17[_0x68d6('0x1b')](_0xa28533)[_0x68d6('0x1c')]();};}function respondWithResult(_0x30cc37,_0x30ea8d){_0x30ea8d=_0x30ea8d||0xc8;return function(_0x436277){if(_0x436277){return _0x30cc37['status'](_0x30ea8d)[_0x68d6('0x1d')](_0x436277);}};}function respondWithFilteredResult(_0xe75c1,_0x41581b){return function(_0x10c339){if(_0x10c339){var _0x1e5527=_0x10c339['count'],_0x3ead1e=_0x41581b['offset'],_0x386186=_0x41581b[_0x68d6('0x1e')]+_0x41581b[_0x68d6('0x1f')],_0x59044d;if(_0x386186>=_0x1e5527){_0x386186=_0x1e5527;_0x59044d=0xc8;}else{_0x59044d=0xce;}_0xe75c1[_0x68d6('0x1b')](_0x59044d);return _0xe75c1[_0x68d6('0x20')]('Content-Range',_0x3ead1e+'-'+_0x386186+'/'+_0x1e5527)['json'](_0x10c339);}return null;};}function patchUpdates(_0xfeba8a){return function(_0x3e90f0){try{jsonpatch[_0x68d6('0x21')](_0x3e90f0,_0xfeba8a,!![]);}catch(_0x336db2){return BPromise[_0x68d6('0x22')](_0x336db2);}return _0x3e90f0['save']();};}function saveUpdates(_0x5bb2be,_0x5afa21){return function(_0xb1b203){if(_0xb1b203){return _0xb1b203[_0x68d6('0x23')](_0x5bb2be)['then'](function(_0x1fdf36){return _0x1fdf36;});}return null;};}function removeEntity(_0x29f43b,_0x430165){return function(_0x3f205e){if(_0x3f205e){return _0x3f205e[_0x68d6('0x24')]()['then'](function(){var _0x52e3cc=_0x3f205e[_0x68d6('0x25')]({'plain':!![]});var _0x4d6b92=_0x68d6('0x26');return db[_0x68d6('0x27')][_0x68d6('0x24')]({'where':{'type':_0x4d6b92,'resourceId':_0x52e3cc['id']}})[_0x68d6('0x28')](function(){return _0x3f205e;});})[_0x68d6('0x28')](function(){_0x29f43b['status'](0xcc)[_0x68d6('0x1c')]();});}};}function handleEntityNotFound(_0x260a1e,_0x373cd8){return function(_0x9f59d4){if(!_0x9f59d4){_0x260a1e[_0x68d6('0x1a')](0x194);}return _0x9f59d4;};}function handleError(_0x5a34b4,_0x4cf9d6){_0x4cf9d6=_0x4cf9d6||0x1f4;return function(_0x4dc02f){logger[_0x68d6('0x29')](_0x4dc02f[_0x68d6('0x2a')]);if(_0x4dc02f[_0x68d6('0x2b')]){delete _0x4dc02f[_0x68d6('0x2b')];}_0x5a34b4['status'](_0x4cf9d6)['send'](_0x4dc02f);};}exports[_0x68d6('0x2c')]=function(_0x435fc7,_0x5587bf){var _0x3bfa16={},_0x401276={},_0x9f46ff={'count':0x0,'rows':[]};var _0x8bb91f=_[_0x68d6('0x2d')](db[_0x68d6('0x2e')]['rawAttributes'],function(_0x1f8d47){return{'name':_0x1f8d47[_0x68d6('0x2f')],'type':_0x1f8d47[_0x68d6('0x30')][_0x68d6('0x31')]};});_0x401276['model']=_[_0x68d6('0x2d')](_0x8bb91f,'name');_0x401276['query']=_[_0x68d6('0x32')](_0x435fc7['query']);_0x401276[_0x68d6('0x33')]=_[_0x68d6('0x34')](_0x401276[_0x68d6('0x35')],_0x401276['query']);_0x3bfa16[_0x68d6('0x36')]=_[_0x68d6('0x34')](_0x401276['model'],qs[_0x68d6('0x37')](_0x435fc7[_0x68d6('0x38')]['fields']));_0x3bfa16[_0x68d6('0x36')]=_0x3bfa16['attributes'][_0x68d6('0x39')]?_0x3bfa16[_0x68d6('0x36')]:_0x401276[_0x68d6('0x35')];if(!_0x435fc7[_0x68d6('0x38')]['hasOwnProperty'](_0x68d6('0x3a'))){_0x3bfa16[_0x68d6('0x1f')]=qs[_0x68d6('0x1f')](_0x435fc7[_0x68d6('0x38')][_0x68d6('0x1f')]);_0x3bfa16[_0x68d6('0x1e')]=qs[_0x68d6('0x1e')](_0x435fc7[_0x68d6('0x38')][_0x68d6('0x1e')]);}_0x3bfa16[_0x68d6('0x3b')]=qs['sort'](_0x435fc7[_0x68d6('0x38')][_0x68d6('0x3c')]);_0x3bfa16[_0x68d6('0x3d')]=qs['filters'](_['pick'](_0x435fc7['query'],_0x401276[_0x68d6('0x33')]),_0x8bb91f);if(_0x435fc7[_0x68d6('0x38')][_0x68d6('0x3e')]){_0x3bfa16[_0x68d6('0x3d')]=_[_0x68d6('0x3f')](_0x3bfa16['where'],{'$or':_[_0x68d6('0x2d')](_0x8bb91f,function(_0x562c40){if(_0x562c40['type']!==_0x68d6('0x40')){var _0x1f2d01={};_0x1f2d01[_0x562c40[_0x68d6('0x2b')]]={'$like':'%'+_0x435fc7[_0x68d6('0x38')][_0x68d6('0x3e')]+'%'};return _0x1f2d01;}})});}_0x3bfa16=_[_0x68d6('0x3f')]({},_0x3bfa16,_0x435fc7[_0x68d6('0x41')]);var _0x1ab235={'where':_0x3bfa16['where']};return db[_0x68d6('0x2e')][_0x68d6('0x42')](_0x1ab235)[_0x68d6('0x28')](function(_0x4b69f6){_0x9f46ff[_0x68d6('0x42')]=_0x4b69f6;if(_0x435fc7[_0x68d6('0x38')][_0x68d6('0x43')]){_0x3bfa16[_0x68d6('0x44')]=[{'all':!![]}];}return db[_0x68d6('0x2e')][_0x68d6('0x45')](_0x3bfa16);})[_0x68d6('0x28')](function(_0x2aa309){_0x9f46ff[_0x68d6('0x46')]=_0x2aa309;return _0x9f46ff;})[_0x68d6('0x28')](respondWithFilteredResult(_0x5587bf,_0x3bfa16))['catch'](handleError(_0x5587bf,null));};exports[_0x68d6('0x47')]=function(_0x1dd711,_0x13fc78){var _0x2f683a={'raw':!![],'where':{'id':_0x1dd711[_0x68d6('0x48')]['id']}},_0x8d28e={};_0x8d28e[_0x68d6('0x35')]=_['keys'](db[_0x68d6('0x2e')][_0x68d6('0x49')]);_0x8d28e[_0x68d6('0x38')]=_['keys'](_0x1dd711['query']);_0x8d28e[_0x68d6('0x4a')]=_[_0x68d6('0x34')](_0x8d28e['model'],_0x8d28e[_0x68d6('0x38')]);_0x2f683a['attributes']=_[_0x68d6('0x34')](_0x8d28e[_0x68d6('0x35')],qs[_0x68d6('0x37')](_0x1dd711[_0x68d6('0x38')][_0x68d6('0x37')]));_0x2f683a['attributes']=_0x2f683a[_0x68d6('0x36')]['length']?_0x2f683a[_0x68d6('0x36')]:_0x8d28e[_0x68d6('0x35')];if(_0x1dd711[_0x68d6('0x38')][_0x68d6('0x43')]){_0x2f683a[_0x68d6('0x44')]=[{'all':!![]}];}_0x2f683a=_[_0x68d6('0x3f')]({},_0x2f683a,_0x1dd711[_0x68d6('0x41')]);return db[_0x68d6('0x2e')][_0x68d6('0x4b')](_0x2f683a)[_0x68d6('0x28')](handleEntityNotFound(_0x13fc78,null))['then'](respondWithResult(_0x13fc78,null))['catch'](handleError(_0x13fc78,null));};exports[_0x68d6('0x4c')]=function(_0x2b6935,_0xcb0ebe){return db['AnalyticMetric']['create'](_0x2b6935['body'],{})[_0x68d6('0x28')](function(_0x40c771){var _0xab71a4=_0x2b6935[_0x68d6('0x4d')][_0x68d6('0x25')]({'plain':!![]});if(!_0xab71a4)throw new Error(_0x68d6('0x4e'));if(_0xab71a4[_0x68d6('0x4f')]===_0x68d6('0x4d')){var _0x4ac009=_0x40c771[_0x68d6('0x25')]({'plain':!![]});var _0x3df54d=_0x68d6('0x26');return db['UserProfileSection'][_0x68d6('0x4b')]({'where':{'name':_0x3df54d,'userProfileId':_0xab71a4[_0x68d6('0x50')]},'raw':!![]})[_0x68d6('0x28')](function(_0x189bc3){if(_0x189bc3&&_0x189bc3[_0x68d6('0x51')]===0x0){return db[_0x68d6('0x27')][_0x68d6('0x4c')]({'name':_0x4ac009['name'],'resourceId':_0x4ac009['id'],'type':_0x189bc3['name'],'sectionId':_0x189bc3['id']},{})[_0x68d6('0x28')](function(){return _0x40c771;});}else{return _0x40c771;}})[_0x68d6('0x52')](function(_0x7b6841){logger[_0x68d6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7b6841);throw _0x7b6841;});}return _0x40c771;})['then'](respondWithResult(_0xcb0ebe,0xc9))['catch'](handleError(_0xcb0ebe,null));};exports[_0x68d6('0x23')]=function(_0x5760d2,_0x175b2c){if(_0x5760d2['body']['id']){delete _0x5760d2['body']['id'];}return db['AnalyticMetric'][_0x68d6('0x4b')]({'where':{'id':_0x5760d2[_0x68d6('0x48')]['id']}})[_0x68d6('0x28')](handleEntityNotFound(_0x175b2c,null))[_0x68d6('0x28')](saveUpdates(_0x5760d2[_0x68d6('0x53')],null))[_0x68d6('0x28')](respondWithResult(_0x175b2c,null))[_0x68d6('0x52')](handleError(_0x175b2c,null));};exports[_0x68d6('0x24')]=function(_0x22c16a,_0x574f3f){return db[_0x68d6('0x2e')][_0x68d6('0x4b')]({'where':{'id':_0x22c16a[_0x68d6('0x48')]['id']}})[_0x68d6('0x28')](handleEntityNotFound(_0x574f3f,null))[_0x68d6('0x28')](removeEntity(_0x574f3f,null))[_0x68d6('0x52')](handleError(_0x574f3f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0cdd316..10f5275 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 _0x2ec7=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x106d78,_0x416c5b){var _0xd4f110=function(_0x400720){while(--_0x400720){_0x106d78['push'](_0x106d78['shift']());}};_0xd4f110(++_0x416c5b);}(_0x2ec7,0x198));var _0x72ec=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x2ec7[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require(_0x72ec('0x0'));var logger=require(_0x72ec('0x1'))(_0x72ec('0x2'));var moment=require(_0x72ec('0x3'));var BPromise=require(_0x72ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x72ec('0x5'));var config=require(_0x72ec('0x6'));var attributes=require(_0x72ec('0x7'));module[_0x72ec('0x8')]=function(_0x490e68,_0x35dcdd){return _0x490e68[_0x72ec('0x9')](_0x72ec('0xa'),attributes,{'tableName':_0x72ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b63=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x4bbac9,_0x167716){var _0x4e2f74=function(_0xd0a476){while(--_0xd0a476){_0x4bbac9['push'](_0x4bbac9['shift']());}};_0x4e2f74(++_0x167716);}(_0x7b63,0x1a6));var _0x37b6=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x7b63[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0x37b6('0x0'));var util=require(_0x37b6('0x1'));var logger=require(_0x37b6('0x2'))('api');var moment=require(_0x37b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x37b6('0x4'));var fs=require('fs');var path=require(_0x37b6('0x5'));var rimraf=require(_0x37b6('0x6'));var config=require(_0x37b6('0x7'));var attributes=require(_0x37b6('0x8'));module[_0x37b6('0x9')]=function(_0x3b778f,_0x3d1f3a){return _0x3b778f[_0x37b6('0xa')](_0x37b6('0xb'),attributes,{'tableName':_0x37b6('0xc'),'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 c4a691c..3f4d0ba 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 _0x5eda=['message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b6882,_0x48eb69){var _0x30eac9=function(_0x283262){while(--_0x283262){_0x3b6882['push'](_0x3b6882['shift']());}};_0x30eac9(++_0x48eb69);}(_0x5eda,0xf5));var _0xa5ed=function(_0x379128,_0x108df1){_0x379128=_0x379128-0x0;var _0x2cab21=_0x5eda[_0x379128];return _0x2cab21;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa5ed('0x0'));var rs=require(_0xa5ed('0x1'));var fs=require('fs');var Redis=require(_0xa5ed('0x2'));var db=require(_0xa5ed('0x3'))['db'];var utils=require(_0xa5ed('0x4'));var logger=require(_0xa5ed('0x5'))(_0xa5ed('0x6'));var config=require('../../config/environment');var jayson=require(_0xa5ed('0x7'));var client=jayson[_0xa5ed('0x8')][_0xa5ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x521697,_0x314800,_0x5bd7f6){return new BPromise(function(_0x208210,_0x51328e){return client[_0xa5ed('0xa')](_0x521697,_0x5bd7f6)[_0xa5ed('0xb')](function(_0x25ddea){logger[_0xa5ed('0xc')](_0xa5ed('0xd'),_0x314800,_0xa5ed('0xe'));logger[_0xa5ed('0xf')](_0xa5ed('0x10'),_0x314800,_0xa5ed('0xe'),JSON['stringify'](_0x25ddea));if(_0x25ddea[_0xa5ed('0x11')]){if(_0x25ddea[_0xa5ed('0x11')][_0xa5ed('0x12')]===0x1f4){logger[_0xa5ed('0x11')](_0xa5ed('0xd'),_0x314800,_0x25ddea[_0xa5ed('0x11')][_0xa5ed('0x13')]);return _0x51328e(_0x25ddea[_0xa5ed('0x11')][_0xa5ed('0x13')]);}logger[_0xa5ed('0x11')](_0xa5ed('0xd'),_0x314800,_0x25ddea['error'][_0xa5ed('0x13')]);return _0x208210(_0x25ddea['error'][_0xa5ed('0x13')]);}else{logger['info'](_0xa5ed('0xd'),_0x314800,_0xa5ed('0xe'));_0x208210(_0x25ddea[_0xa5ed('0x14')][_0xa5ed('0x13')]);}})[_0xa5ed('0x15')](function(_0x327468){logger['error'](_0xa5ed('0xd'),_0x314800,_0x327468);_0x51328e(_0x327468);});});} \ No newline at end of file +var _0x9f0b=['../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xc971a4,_0x5b381c){var _0x4ebd6b=function(_0x371149){while(--_0x371149){_0xc971a4['push'](_0xc971a4['shift']());}};_0x4ebd6b(++_0x5b381c);}(_0x9f0b,0xe9));var _0xb9f0=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0x9f0b[_0x1e48d3];return _0x2852b1;};'use strict';var _=require(_0xb9f0('0x0'));var util=require(_0xb9f0('0x1'));var moment=require(_0xb9f0('0x2'));var BPromise=require(_0xb9f0('0x3'));var rs=require(_0xb9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9f0('0x5'))['db'];var utils=require(_0xb9f0('0x6'));var logger=require(_0xb9f0('0x7'))('rpc');var config=require(_0xb9f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb9f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcfef,_0x2b4c7c,_0x594acf){return new BPromise(function(_0x13d1cc,_0x30b3f8){return client[_0xb9f0('0xa')](_0x4fcfef,_0x594acf)[_0xb9f0('0xb')](function(_0x223659){logger[_0xb9f0('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x2b4c7c,_0xb9f0('0xd'));logger[_0xb9f0('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2b4c7c,_0xb9f0('0xd'),JSON['stringify'](_0x223659));if(_0x223659[_0xb9f0('0xf')]){if(_0x223659[_0xb9f0('0xf')][_0xb9f0('0x10')]===0x1f4){logger[_0xb9f0('0xf')](_0xb9f0('0x11'),_0x2b4c7c,_0x223659[_0xb9f0('0xf')][_0xb9f0('0x12')]);return _0x30b3f8(_0x223659[_0xb9f0('0xf')][_0xb9f0('0x12')]);}logger[_0xb9f0('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2b4c7c,_0x223659[_0xb9f0('0xf')]['message']);return _0x13d1cc(_0x223659[_0xb9f0('0xf')][_0xb9f0('0x12')]);}else{logger[_0xb9f0('0xc')](_0xb9f0('0x11'),_0x2b4c7c,_0xb9f0('0xd'));_0x13d1cc(_0x223659[_0xb9f0('0x13')][_0xb9f0('0x12')]);}})['catch'](function(_0x3b88df){logger['error'](_0xb9f0('0x11'),_0x2b4c7c,_0x3b88df);_0x30b3f8(_0x3b88df);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index ec9a477..3be5d20 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 _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(_0x277607,_0x345a06){var _0x15fe23=function(_0x336de7){while(--_0x336de7){_0x277607['push'](_0x277607['shift']());}};_0x15fe23(++_0x345a06);}(_0x2542,0x169));var _0x2254=function(_0x929d92,_0x28f4fd){_0x929d92=_0x929d92-0x0;var _0x400f30=_0x2542[_0x929d92];return _0x400f30;};'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 +var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0x1967,0x173));var _0x7196=function(_0x22e552,_0x534b27){_0x22e552=_0x22e552-0x0;var _0x3c2569=_0x1967[_0x22e552];return _0x3c2569;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a1418b1..a179aa8 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 _0x3ac2=['TEXT','sequelize','exports'];(function(_0x4f1939,_0x287328){var _0xaab2cb=function(_0x511376){while(--_0x511376){_0x4f1939['push'](_0x4f1939['shift']());}};_0xaab2cb(++_0x287328);}(_0x3ac2,0x13c));var _0x23ac=function(_0x273cfd,_0xecee8d){_0x273cfd=_0x273cfd-0x0;var _0x464033=_0x3ac2[_0x273cfd];return _0x464033;};'use strict';var Sequelize=require(_0x23ac('0x0'));module[_0x23ac('0x1')]={'tree':{'type':Sequelize[_0x23ac('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x88d5=['sequelize','exports'];(function(_0x697323,_0x4a4821){var _0x1f6b84=function(_0x491cc2){while(--_0x491cc2){_0x697323['push'](_0x697323['shift']());}};_0x1f6b84(++_0x4a4821);}(_0x88d5,0x100));var _0x588d=function(_0x51b80a,_0x355fe3){_0x51b80a=_0x51b80a-0x0;var _0x22fdf0=_0x88d5[_0x51b80a];return _0x22fdf0;};'use strict';var Sequelize=require(_0x588d('0x0'));module[_0x588d('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 4d152cc..a8ff7fc 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 _0x8d62=['AnalyticTreeReport','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','count','catch','show','params','includeAll','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d62,0xf8));var _0x28d6=function(_0x29c2c1,_0x249e09){_0x29c2c1=_0x29c2c1-0x0;var _0x42fe5e=_0x8d62[_0x29c2c1];return _0x42fe5e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28d6('0x0'));var rimraf=require(_0x28d6('0x1'));var zipdir=require(_0x28d6('0x2'));var jsonpatch=require(_0x28d6('0x3'));var rp=require(_0x28d6('0x4'));var moment=require(_0x28d6('0x5'));var BPromise=require(_0x28d6('0x6'));var Mustache=require(_0x28d6('0x7'));var util=require(_0x28d6('0x8'));var path=require(_0x28d6('0x9'));var sox=require(_0x28d6('0xa'));var csv=require(_0x28d6('0xb'));var ejs=require(_0x28d6('0xc'));var fs=require('fs');var _=require(_0x28d6('0xd'));var squel=require('squel');var crypto=require(_0x28d6('0xe'));var jsforce=require(_0x28d6('0xf'));var deskjs=require(_0x28d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x28d6('0x11'));var Papa=require('papaparse');var Redis=require(_0x28d6('0x12'));var authService=require(_0x28d6('0x13'));var qs=require(_0x28d6('0x14'));var as=require(_0x28d6('0x15'));var hardwareService=require(_0x28d6('0x16'));var logger=require('../../config/logger')(_0x28d6('0x17'));var utils=require(_0x28d6('0x18'));var config=require(_0x28d6('0x19'));var licenseUtil=require(_0x28d6('0x1a'));var db=require(_0x28d6('0x1b'))['db'];function respondWithStatusCode(_0x240839,_0x2c29bd){_0x2c29bd=_0x2c29bd||0xcc;return function(_0x43d460){if(_0x43d460){return _0x240839['sendStatus'](_0x2c29bd);}return _0x240839[_0x28d6('0x1c')](_0x2c29bd)[_0x28d6('0x1d')]();};}function respondWithResult(_0x33ba38,_0x549b39){_0x549b39=_0x549b39||0xc8;return function(_0x1621ee){if(_0x1621ee){return _0x33ba38['status'](_0x549b39)[_0x28d6('0x1e')](_0x1621ee);}};}function respondWithFilteredResult(_0x425ffb,_0x4b82e2){return function(_0x1881a8){if(_0x1881a8){var _0x159d2a=_0x1881a8['count'],_0x2d5eee=_0x4b82e2[_0x28d6('0x1f')],_0x17a822=_0x4b82e2['offset']+_0x4b82e2[_0x28d6('0x20')],_0x154c4d;if(_0x17a822>=_0x159d2a){_0x17a822=_0x159d2a;_0x154c4d=0xc8;}else{_0x154c4d=0xce;}_0x425ffb[_0x28d6('0x1c')](_0x154c4d);return _0x425ffb[_0x28d6('0x21')](_0x28d6('0x22'),_0x2d5eee+'-'+_0x17a822+'/'+_0x159d2a)[_0x28d6('0x1e')](_0x1881a8);}return null;};}function patchUpdates(_0x2f1b6b){return function(_0x2d521d){try{jsonpatch['apply'](_0x2d521d,_0x2f1b6b,!![]);}catch(_0x29cfbf){return BPromise[_0x28d6('0x23')](_0x29cfbf);}return _0x2d521d['save']();};}function saveUpdates(_0x26362e,_0x24f764){return function(_0x3770ba){if(_0x3770ba){return _0x3770ba[_0x28d6('0x24')](_0x26362e)[_0x28d6('0x25')](function(_0x3b121a){return _0x3b121a;});}return null;};}function removeEntity(_0x376a64,_0x506be6){return function(_0xcf8fa0){if(_0xcf8fa0){return _0xcf8fa0['destroy']()[_0x28d6('0x25')](function(){_0x376a64[_0x28d6('0x1c')](0xcc)[_0x28d6('0x1d')]();});}};}function handleEntityNotFound(_0x3d128b,_0x26809d){return function(_0x3f7eb9){if(!_0x3f7eb9){_0x3d128b['sendStatus'](0x194);}return _0x3f7eb9;};}function handleError(_0x5c4909,_0xe45d33){_0xe45d33=_0xe45d33||0x1f4;return function(_0x2fb6f7){logger[_0x28d6('0x26')](_0x2fb6f7[_0x28d6('0x27')]);if(_0x2fb6f7['name']){delete _0x2fb6f7[_0x28d6('0x28')];}_0x5c4909[_0x28d6('0x1c')](_0xe45d33)[_0x28d6('0x29')](_0x2fb6f7);};}exports[_0x28d6('0x2a')]=function(_0x4757b1,_0x6a76a){var _0x60ded0={},_0x20b220={},_0x23ef1c={'count':0x0,'rows':[]};var _0x12f77e=_[_0x28d6('0x2b')](db[_0x28d6('0x2c')][_0x28d6('0x2d')],function(_0x3ba89f){return{'name':_0x3ba89f['fieldName'],'type':_0x3ba89f['type'][_0x28d6('0x2e')]};});_0x20b220[_0x28d6('0x2f')]=_[_0x28d6('0x2b')](_0x12f77e,_0x28d6('0x28'));_0x20b220[_0x28d6('0x30')]=_[_0x28d6('0x31')](_0x4757b1['query']);_0x20b220[_0x28d6('0x32')]=_['intersection'](_0x20b220[_0x28d6('0x2f')],_0x20b220['query']);_0x60ded0[_0x28d6('0x33')]=_[_0x28d6('0x34')](_0x20b220[_0x28d6('0x2f')],qs[_0x28d6('0x35')](_0x4757b1[_0x28d6('0x30')]['fields']));_0x60ded0['attributes']=_0x60ded0[_0x28d6('0x33')][_0x28d6('0x36')]?_0x60ded0['attributes']:_0x20b220[_0x28d6('0x2f')];if(!_0x4757b1['query'][_0x28d6('0x37')]('nolimit')){_0x60ded0[_0x28d6('0x20')]=qs['limit'](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x20')]);_0x60ded0[_0x28d6('0x1f')]=qs[_0x28d6('0x1f')](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x1f')]);}_0x60ded0[_0x28d6('0x38')]=qs['sort'](_0x4757b1[_0x28d6('0x30')][_0x28d6('0x39')]);_0x60ded0[_0x28d6('0x3a')]=qs[_0x28d6('0x32')](_['pick'](_0x4757b1[_0x28d6('0x30')],_0x20b220[_0x28d6('0x32')]),_0x12f77e);if(_0x4757b1[_0x28d6('0x30')][_0x28d6('0x3b')]){_0x60ded0['where']=_[_0x28d6('0x3c')](_0x60ded0[_0x28d6('0x3a')],{'$or':_[_0x28d6('0x2b')](_0x12f77e,function(_0x1120c9){if(_0x1120c9[_0x28d6('0x3d')]!==_0x28d6('0x3e')){var _0x1f0fc8={};_0x1f0fc8[_0x1120c9[_0x28d6('0x28')]]={'$like':'%'+_0x4757b1[_0x28d6('0x30')][_0x28d6('0x3b')]+'%'};return _0x1f0fc8;}})});}_0x60ded0=_[_0x28d6('0x3c')]({},_0x60ded0,_0x4757b1[_0x28d6('0x3f')]);var _0x286b3d={'where':_0x60ded0[_0x28d6('0x3a')]};return db[_0x28d6('0x2c')][_0x28d6('0x40')](_0x286b3d)['then'](function(_0x5eff10){_0x23ef1c['count']=_0x5eff10;if(_0x4757b1[_0x28d6('0x30')]['includeAll']){_0x60ded0['include']=[{'all':!![]}];}return db[_0x28d6('0x2c')]['findAll'](_0x60ded0);})[_0x28d6('0x25')](function(_0x3f551a){_0x23ef1c['rows']=_0x3f551a;return _0x23ef1c;})[_0x28d6('0x25')](respondWithFilteredResult(_0x6a76a,_0x60ded0))[_0x28d6('0x41')](handleError(_0x6a76a,null));};exports[_0x28d6('0x42')]=function(_0x131628,_0x3388dc){var _0x334727={'raw':!![],'where':{'id':_0x131628[_0x28d6('0x43')]['id']}},_0x18a0bc={};_0x18a0bc['model']=_[_0x28d6('0x31')](db[_0x28d6('0x2c')]['rawAttributes']);_0x18a0bc[_0x28d6('0x30')]=_[_0x28d6('0x31')](_0x131628[_0x28d6('0x30')]);_0x18a0bc['filtears']=_[_0x28d6('0x34')](_0x18a0bc[_0x28d6('0x2f')],_0x18a0bc[_0x28d6('0x30')]);_0x334727[_0x28d6('0x33')]=_['intersection'](_0x18a0bc[_0x28d6('0x2f')],qs[_0x28d6('0x35')](_0x131628[_0x28d6('0x30')]['fields']));_0x334727[_0x28d6('0x33')]=_0x334727[_0x28d6('0x33')][_0x28d6('0x36')]?_0x334727[_0x28d6('0x33')]:_0x18a0bc['model'];if(_0x131628[_0x28d6('0x30')][_0x28d6('0x44')]){_0x334727[_0x28d6('0x45')]=[{'all':!![]}];}_0x334727=_[_0x28d6('0x3c')]({},_0x334727,_0x131628[_0x28d6('0x3f')]);return db['AnalyticTreeReport'][_0x28d6('0x46')](_0x334727)[_0x28d6('0x25')](handleEntityNotFound(_0x3388dc,null))[_0x28d6('0x25')](respondWithResult(_0x3388dc,null))[_0x28d6('0x41')](handleError(_0x3388dc,null));};exports[_0x28d6('0x47')]=function(_0x182d70,_0x10a52){return db[_0x28d6('0x2c')][_0x28d6('0x47')](_0x182d70[_0x28d6('0x48')],{})['then'](respondWithResult(_0x10a52,0xc9))['catch'](handleError(_0x10a52,null));};exports[_0x28d6('0x24')]=function(_0x5635dc,_0x5ce7c1){if(_0x5635dc['body']['id']){delete _0x5635dc[_0x28d6('0x48')]['id'];}return db['AnalyticTreeReport'][_0x28d6('0x46')]({'where':{'id':_0x5635dc['params']['id']}})[_0x28d6('0x25')](handleEntityNotFound(_0x5ce7c1,null))[_0x28d6('0x25')](saveUpdates(_0x5635dc[_0x28d6('0x48')],null))['then'](respondWithResult(_0x5ce7c1,null))['catch'](handleError(_0x5ce7c1,null));};exports['destroy']=function(_0x2720b1,_0x12e3c0){return db['AnalyticTreeReport'][_0x28d6('0x46')]({'where':{'id':_0x2720b1[_0x28d6('0x43')]['id']}})[_0x28d6('0x25')](handleEntityNotFound(_0x12e3c0,null))[_0x28d6('0x25')](removeEntity(_0x12e3c0,null))[_0x28d6('0x41')](handleError(_0x12e3c0,null));}; \ No newline at end of file +var _0xc373=['type','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filter','merge','name','options','includeAll','include','findAll','rows','catch','params','filtears','find','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','count','offset','set','Content-Range','update','then','error','stack','send','index','map','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x5cfd73,_0x2f8def){var _0x3b4ec3=function(_0x5e7015){while(--_0x5e7015){_0x5cfd73['push'](_0x5cfd73['shift']());}};_0x3b4ec3(++_0x2f8def);}(_0xc373,0x1c7));var _0x3c37=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xc373[_0x16b1a5];return _0x475e25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3c37('0x0'));var rimraf=require(_0x3c37('0x1'));var zipdir=require(_0x3c37('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3c37('0x3'));var BPromise=require(_0x3c37('0x4'));var Mustache=require(_0x3c37('0x5'));var util=require(_0x3c37('0x6'));var path=require(_0x3c37('0x7'));var sox=require(_0x3c37('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c37('0x9'));var squel=require(_0x3c37('0xa'));var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require(_0x3c37('0xd'));var toCsv=require(_0x3c37('0xe'));var querystring=require(_0x3c37('0xf'));var Papa=require(_0x3c37('0x10'));var Redis=require(_0x3c37('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c37('0x12'));var hardwareService=require(_0x3c37('0x13'));var logger=require(_0x3c37('0x14'))(_0x3c37('0x15'));var utils=require(_0x3c37('0x16'));var config=require(_0x3c37('0x17'));var licenseUtil=require(_0x3c37('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc333c2,_0x454f92){_0x454f92=_0x454f92||0xcc;return function(_0x458002){if(_0x458002){return _0xc333c2['sendStatus'](_0x454f92);}return _0xc333c2['status'](_0x454f92)[_0x3c37('0x19')]();};}function respondWithResult(_0x57c33f,_0x52ab1f){_0x52ab1f=_0x52ab1f||0xc8;return function(_0x37904b){if(_0x37904b){return _0x57c33f[_0x3c37('0x1a')](_0x52ab1f)[_0x3c37('0x1b')](_0x37904b);}};}function respondWithFilteredResult(_0x1b70a6,_0x1268b3){return function(_0x22e851){if(_0x22e851){var _0x25d36e=_0x22e851[_0x3c37('0x1c')],_0x40d3ee=_0x1268b3[_0x3c37('0x1d')],_0x294ea3=_0x1268b3['offset']+_0x1268b3['limit'],_0x4e1560;if(_0x294ea3>=_0x25d36e){_0x294ea3=_0x25d36e;_0x4e1560=0xc8;}else{_0x4e1560=0xce;}_0x1b70a6[_0x3c37('0x1a')](_0x4e1560);return _0x1b70a6[_0x3c37('0x1e')](_0x3c37('0x1f'),_0x40d3ee+'-'+_0x294ea3+'/'+_0x25d36e)[_0x3c37('0x1b')](_0x22e851);}return null;};}function patchUpdates(_0x22de19){return function(_0x2b0f25){try{jsonpatch['apply'](_0x2b0f25,_0x22de19,!![]);}catch(_0x97c790){return BPromise['reject'](_0x97c790);}return _0x2b0f25['save']();};}function saveUpdates(_0x3bc0bb,_0x2882ba){return function(_0x46f60e){if(_0x46f60e){return _0x46f60e[_0x3c37('0x20')](_0x3bc0bb)[_0x3c37('0x21')](function(_0x5903ee){return _0x5903ee;});}return null;};}function removeEntity(_0x27f83e,_0x54776f){return function(_0x3399a7){if(_0x3399a7){return _0x3399a7['destroy']()[_0x3c37('0x21')](function(){_0x27f83e[_0x3c37('0x1a')](0xcc)[_0x3c37('0x19')]();});}};}function handleEntityNotFound(_0x574890,_0x51d25d){return function(_0x5e004e){if(!_0x5e004e){_0x574890['sendStatus'](0x194);}return _0x5e004e;};}function handleError(_0x4b8afe,_0x3b2776){_0x3b2776=_0x3b2776||0x1f4;return function(_0xb334d0){logger[_0x3c37('0x22')](_0xb334d0[_0x3c37('0x23')]);if(_0xb334d0['name']){delete _0xb334d0['name'];}_0x4b8afe['status'](_0x3b2776)[_0x3c37('0x24')](_0xb334d0);};}exports[_0x3c37('0x25')]=function(_0x5e1df2,_0x4a9091){var _0x1ba7e0={},_0x9b2495={},_0x118269={'count':0x0,'rows':[]};var _0xf98a18=_[_0x3c37('0x26')](db[_0x3c37('0x27')][_0x3c37('0x28')],function(_0x3abacf){return{'name':_0x3abacf[_0x3c37('0x29')],'type':_0x3abacf[_0x3c37('0x2a')]['key']};});_0x9b2495[_0x3c37('0x2b')]=_[_0x3c37('0x26')](_0xf98a18,'name');_0x9b2495['query']=_[_0x3c37('0x2c')](_0x5e1df2[_0x3c37('0x2d')]);_0x9b2495[_0x3c37('0x2e')]=_['intersection'](_0x9b2495[_0x3c37('0x2b')],_0x9b2495['query']);_0x1ba7e0[_0x3c37('0x2f')]=_[_0x3c37('0x30')](_0x9b2495[_0x3c37('0x2b')],qs[_0x3c37('0x31')](_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x31')]));_0x1ba7e0[_0x3c37('0x2f')]=_0x1ba7e0[_0x3c37('0x2f')][_0x3c37('0x32')]?_0x1ba7e0[_0x3c37('0x2f')]:_0x9b2495['model'];if(!_0x5e1df2['query']['hasOwnProperty'](_0x3c37('0x33'))){_0x1ba7e0[_0x3c37('0x34')]=qs[_0x3c37('0x34')](_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x34')]);_0x1ba7e0[_0x3c37('0x1d')]=qs[_0x3c37('0x1d')](_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x1d')]);}_0x1ba7e0[_0x3c37('0x35')]=qs[_0x3c37('0x36')](_0x5e1df2[_0x3c37('0x2d')]['sort']);_0x1ba7e0[_0x3c37('0x37')]=qs[_0x3c37('0x2e')](_['pick'](_0x5e1df2['query'],_0x9b2495[_0x3c37('0x2e')]),_0xf98a18);if(_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x38')]){_0x1ba7e0[_0x3c37('0x37')]=_[_0x3c37('0x39')](_0x1ba7e0[_0x3c37('0x37')],{'$or':_[_0x3c37('0x26')](_0xf98a18,function(_0x12053a){if(_0x12053a[_0x3c37('0x2a')]!=='VIRTUAL'){var _0x2c8a51={};_0x2c8a51[_0x12053a[_0x3c37('0x3a')]]={'$like':'%'+_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x38')]+'%'};return _0x2c8a51;}})});}_0x1ba7e0=_[_0x3c37('0x39')]({},_0x1ba7e0,_0x5e1df2[_0x3c37('0x3b')]);var _0xf76905={'where':_0x1ba7e0[_0x3c37('0x37')]};return db[_0x3c37('0x27')][_0x3c37('0x1c')](_0xf76905)['then'](function(_0x3b73be){_0x118269[_0x3c37('0x1c')]=_0x3b73be;if(_0x5e1df2[_0x3c37('0x2d')][_0x3c37('0x3c')]){_0x1ba7e0[_0x3c37('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x3c37('0x3e')](_0x1ba7e0);})[_0x3c37('0x21')](function(_0x36e060){_0x118269[_0x3c37('0x3f')]=_0x36e060;return _0x118269;})['then'](respondWithFilteredResult(_0x4a9091,_0x1ba7e0))[_0x3c37('0x40')](handleError(_0x4a9091,null));};exports['show']=function(_0x1fc56e,_0x51687d){var _0x72d2f3={'raw':!![],'where':{'id':_0x1fc56e[_0x3c37('0x41')]['id']}},_0x90e1c5={};_0x90e1c5['model']=_[_0x3c37('0x2c')](db[_0x3c37('0x27')][_0x3c37('0x28')]);_0x90e1c5[_0x3c37('0x2d')]=_[_0x3c37('0x2c')](_0x1fc56e['query']);_0x90e1c5[_0x3c37('0x42')]=_[_0x3c37('0x30')](_0x90e1c5[_0x3c37('0x2b')],_0x90e1c5[_0x3c37('0x2d')]);_0x72d2f3[_0x3c37('0x2f')]=_[_0x3c37('0x30')](_0x90e1c5[_0x3c37('0x2b')],qs['fields'](_0x1fc56e[_0x3c37('0x2d')][_0x3c37('0x31')]));_0x72d2f3[_0x3c37('0x2f')]=_0x72d2f3['attributes'][_0x3c37('0x32')]?_0x72d2f3['attributes']:_0x90e1c5[_0x3c37('0x2b')];if(_0x1fc56e[_0x3c37('0x2d')][_0x3c37('0x3c')]){_0x72d2f3[_0x3c37('0x3d')]=[{'all':!![]}];}_0x72d2f3=_['merge']({},_0x72d2f3,_0x1fc56e['options']);return db['AnalyticTreeReport'][_0x3c37('0x43')](_0x72d2f3)[_0x3c37('0x21')](handleEntityNotFound(_0x51687d,null))['then'](respondWithResult(_0x51687d,null))['catch'](handleError(_0x51687d,null));};exports[_0x3c37('0x44')]=function(_0x518653,_0x834af3){return db[_0x3c37('0x27')][_0x3c37('0x44')](_0x518653[_0x3c37('0x45')],{})[_0x3c37('0x21')](respondWithResult(_0x834af3,0xc9))[_0x3c37('0x40')](handleError(_0x834af3,null));};exports[_0x3c37('0x20')]=function(_0x39457e,_0x26396f){if(_0x39457e[_0x3c37('0x45')]['id']){delete _0x39457e[_0x3c37('0x45')]['id'];}return db['AnalyticTreeReport'][_0x3c37('0x43')]({'where':{'id':_0x39457e[_0x3c37('0x41')]['id']}})['then'](handleEntityNotFound(_0x26396f,null))[_0x3c37('0x21')](saveUpdates(_0x39457e[_0x3c37('0x45')],null))[_0x3c37('0x21')](respondWithResult(_0x26396f,null))['catch'](handleError(_0x26396f,null));};exports[_0x3c37('0x46')]=function(_0x4c7686,_0x32f2f8){return db[_0x3c37('0x27')][_0x3c37('0x43')]({'where':{'id':_0x4c7686['params']['id']}})[_0x3c37('0x21')](handleEntityNotFound(_0x32f2f8,null))[_0x3c37('0x21')](removeEntity(_0x32f2f8,null))[_0x3c37('0x40')](handleError(_0x32f2f8,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9c18778..8ee2d69 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 _0x25e7=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2bff86,_0xa557bd){var _0x140870=function(_0x46879b){while(--_0x46879b){_0x2bff86['push'](_0x2bff86['shift']());}};_0x140870(++_0xa557bd);}(_0x25e7,0x1d6));var _0x725e=function(_0x35c561,_0x1ade37){_0x35c561=_0x35c561-0x0;var _0x3c3f89=_0x25e7[_0x35c561];return _0x3c3f89;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var logger=require(_0x725e('0x2'))(_0x725e('0x3'));var moment=require(_0x725e('0x4'));var BPromise=require(_0x725e('0x5'));var rp=require(_0x725e('0x6'));var fs=require('fs');var path=require(_0x725e('0x7'));var rimraf=require(_0x725e('0x8'));var config=require(_0x725e('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x2497a5,_0x480945){return _0x2497a5['define'](_0x725e('0xa'),attributes,{'tableName':_0x725e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d76=['moment','bluebird','request-promise','path','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api'];(function(_0x48581a,_0x6ccd1f){var _0xb4b76a=function(_0x3bb62c){while(--_0x3bb62c){_0x48581a['push'](_0x48581a['shift']());}};_0xb4b76a(++_0x6ccd1f);}(_0x9d76,0x76));var _0x69d7=function(_0x53941e,_0x22617e){_0x53941e=_0x53941e-0x0;var _0xcc227c=_0x9d76[_0x53941e];return _0xcc227c;};'use strict';var _=require(_0x69d7('0x0'));var util=require('util');var logger=require(_0x69d7('0x1'))(_0x69d7('0x2'));var moment=require(_0x69d7('0x3'));var BPromise=require(_0x69d7('0x4'));var rp=require(_0x69d7('0x5'));var fs=require('fs');var path=require(_0x69d7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x69d7('0x7'));module[_0x69d7('0x8')]=function(_0x9ec22e,_0x237111){return _0x9ec22e['define'](_0x69d7('0x9'),attributes,{'tableName':_0x69d7('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 24ad1b3..c1c75ac 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 _0x7067=['AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x37f07a,_0x4943cc){var _0x2b9a7d=function(_0x1ce851){while(--_0x1ce851){_0x37f07a['push'](_0x37f07a['shift']());}};_0x2b9a7d(++_0x4943cc);}(_0x7067,0xb9));var _0x7706=function(_0xbb31dd,_0x3b7d46){_0xbb31dd=_0xbb31dd-0x0;var _0x81083c=_0x7067[_0xbb31dd];return _0x81083c;};'use strict';var _=require(_0x7706('0x0'));var util=require(_0x7706('0x1'));var moment=require(_0x7706('0x2'));var BPromise=require('bluebird');var rs=require(_0x7706('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7706('0x4'))['db'];var utils=require(_0x7706('0x5'));var logger=require(_0x7706('0x6'))(_0x7706('0x7'));var config=require(_0x7706('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7706('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8be51d,_0xe694a4,_0x454cc7){return new BPromise(function(_0x427db1,_0x1d7c93){return client[_0x7706('0xa')](_0x8be51d,_0x454cc7)[_0x7706('0xb')](function(_0x1b2e68){logger[_0x7706('0xc')](_0x7706('0xd'),_0xe694a4,_0x7706('0xe'));logger['debug'](_0x7706('0xf'),_0xe694a4,_0x7706('0xe'),JSON[_0x7706('0x10')](_0x1b2e68));if(_0x1b2e68[_0x7706('0x11')]){if(_0x1b2e68[_0x7706('0x11')][_0x7706('0x12')]===0x1f4){logger[_0x7706('0x11')](_0x7706('0xd'),_0xe694a4,_0x1b2e68['error']['message']);return _0x1d7c93(_0x1b2e68[_0x7706('0x11')][_0x7706('0x13')]);}logger[_0x7706('0x11')](_0x7706('0xd'),_0xe694a4,_0x1b2e68[_0x7706('0x11')]['message']);return _0x427db1(_0x1b2e68[_0x7706('0x11')][_0x7706('0x13')]);}else{logger[_0x7706('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0xe694a4,_0x7706('0xe'));_0x427db1(_0x1b2e68[_0x7706('0x14')]['message']);}})[_0x7706('0x15')](function(_0xa292ce){logger[_0x7706('0x11')](_0x7706('0xd'),_0xe694a4,_0xa292ce);_0x1d7c93(_0xa292ce);});});} \ No newline at end of file +var _0xa298=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4af351,_0x328587){var _0x238615=function(_0x11800c){while(--_0x11800c){_0x4af351['push'](_0x4af351['shift']());}};_0x238615(++_0x328587);}(_0xa298,0xe4));var _0x8a29=function(_0x5239f6,_0x3bc30a){_0x5239f6=_0x5239f6-0x0;var _0xb66a8b=_0xa298[_0x5239f6];return _0xb66a8b;};'use strict';var _=require(_0x8a29('0x0'));var util=require('util');var moment=require(_0x8a29('0x1'));var BPromise=require(_0x8a29('0x2'));var rs=require(_0x8a29('0x3'));var fs=require('fs');var Redis=require(_0x8a29('0x4'));var db=require(_0x8a29('0x5'))['db'];var utils=require(_0x8a29('0x6'));var logger=require(_0x8a29('0x7'))('rpc');var config=require(_0x8a29('0x8'));var jayson=require(_0x8a29('0x9'));var client=jayson[_0x8a29('0xa')][_0x8a29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fab19,_0x33a841,_0x384e44){return new BPromise(function(_0x4422ab,_0x55da04){return client[_0x8a29('0xc')](_0x2fab19,_0x384e44)[_0x8a29('0xd')](function(_0x2bfc0f){logger[_0x8a29('0xe')](_0x8a29('0xf'),_0x33a841,_0x8a29('0x10'));logger[_0x8a29('0x11')](_0x8a29('0x12'),_0x33a841,'request\x20sent',JSON[_0x8a29('0x13')](_0x2bfc0f));if(_0x2bfc0f[_0x8a29('0x14')]){if(_0x2bfc0f[_0x8a29('0x14')][_0x8a29('0x15')]===0x1f4){logger[_0x8a29('0x14')]('AnalyticTreeReport,\x20%s,\x20%s',_0x33a841,_0x2bfc0f[_0x8a29('0x14')][_0x8a29('0x16')]);return _0x55da04(_0x2bfc0f['error'][_0x8a29('0x16')]);}logger[_0x8a29('0x14')](_0x8a29('0xf'),_0x33a841,_0x2bfc0f[_0x8a29('0x14')][_0x8a29('0x16')]);return _0x4422ab(_0x2bfc0f['error'][_0x8a29('0x16')]);}else{logger[_0x8a29('0xe')](_0x8a29('0xf'),_0x33a841,_0x8a29('0x10'));_0x4422ab(_0x2bfc0f[_0x8a29('0x17')][_0x8a29('0x16')]);}})[_0x8a29('0x18')](function(_0x455c22){logger[_0x8a29('0x14')](_0x8a29('0xf'),_0x33a841,_0x455c22);_0x55da04(_0x455c22);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 3cdf35d..42c2867 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 _0x17b5=['put','delete','/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','post','create'];(function(_0x4dfc90,_0x31f702){var _0x5ef42d=function(_0x487fda){while(--_0x487fda){_0x4dfc90['push'](_0x4dfc90['shift']());}};_0x5ef42d(++_0x31f702);}(_0x17b5,0x1ad));var _0x517b=function(_0x1be03d,_0x46cccf){_0x1be03d=_0x1be03d-0x0;var _0x45aeda=_0x17b5[_0x1be03d];return _0x45aeda;};'use strict';var multer=require(_0x517b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x517b('0x1'));var express=require(_0x517b('0x2'));var router=express[_0x517b('0x3')]();var auth=require(_0x517b('0x4'));var interaction=require(_0x517b('0x5'));var config=require(_0x517b('0x6'));var controller=require(_0x517b('0x7'));router[_0x517b('0x8')]('/',auth[_0x517b('0x9')](),controller['index']);router[_0x517b('0x8')]('/:id',auth[_0x517b('0x9')](),controller[_0x517b('0xa')]);router[_0x517b('0xb')]('/',auth[_0x517b('0x9')](),controller[_0x517b('0xc')]);router[_0x517b('0xd')]('/:id',auth[_0x517b('0x9')](),controller['update']);router[_0x517b('0xe')](_0x517b('0xf'),auth[_0x517b('0x9')](),controller['destroy']);module[_0x517b('0x10')]=router; \ No newline at end of file +var _0x0751=['./analyticTreeReport.controller','get','index','isAuthenticated','show','create','put','/:id','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fbc9a,_0x84dc54){var _0x296e03=function(_0x4604d1){while(--_0x4604d1){_0x4fbc9a['push'](_0x4fbc9a['shift']());}};_0x296e03(++_0x84dc54);}(_0x0751,0x1cd));var _0x1075=function(_0x593a01,_0x25668b){_0x593a01=_0x593a01-0x0;var _0x4b39e1=_0x0751[_0x593a01];return _0x4b39e1;};'use strict';var multer=require('multer');var util=require(_0x1075('0x0'));var path=require('path');var timeout=require(_0x1075('0x1'));var express=require(_0x1075('0x2'));var router=express[_0x1075('0x3')]();var auth=require(_0x1075('0x4'));var interaction=require(_0x1075('0x5'));var config=require(_0x1075('0x6'));var controller=require(_0x1075('0x7'));router[_0x1075('0x8')]('/',auth['isAuthenticated'](),controller[_0x1075('0x9')]);router[_0x1075('0x8')]('/:id',auth[_0x1075('0xa')](),controller[_0x1075('0xb')]);router['post']('/',auth[_0x1075('0xa')](),controller[_0x1075('0xc')]);router[_0x1075('0xd')](_0x1075('0xe'),auth[_0x1075('0xa')](),controller[_0x1075('0xf')]);router[_0x1075('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1075('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1c1fd5f..d037cde 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 _0xa2d2=['sequelize','exports','STRING'];(function(_0x27cbaa,_0x40033e){var _0x3086c5=function(_0x125a92){while(--_0x125a92){_0x27cbaa['push'](_0x27cbaa['shift']());}};_0x3086c5(++_0x40033e);}(_0xa2d2,0x19b));var _0x2a2d=function(_0x221558,_0x58ddb0){_0x221558=_0x221558-0x0;var _0x2f2afd=_0xa2d2[_0x221558];return _0x2f2afd;};'use strict';var Sequelize=require(_0x2a2d('0x0'));module[_0x2a2d('0x1')]={'name':{'type':Sequelize[_0x2a2d('0x2')]},'basename':{'type':Sequelize[_0x2a2d('0x2')]},'type':{'type':Sequelize[_0x2a2d('0x2')]}}; \ No newline at end of file +var _0x57b0=['sequelize','STRING'];(function(_0x262741,_0x52a5c5){var _0x239080=function(_0x1d1daf){while(--_0x1d1daf){_0x262741['push'](_0x262741['shift']());}};_0x239080(++_0x52a5c5);}(_0x57b0,0x7a));var _0x057b=function(_0xd3e233,_0x40feea){_0xd3e233=_0xd3e233-0x0;var _0x5e6344=_0x57b0[_0xd3e233];return _0x5e6344;};'use strict';var Sequelize=require(_0x057b('0x0'));module['exports']={'name':{'type':Sequelize[_0x057b('0x1')]},'basename':{'type':Sequelize[_0x057b('0x1')]},'type':{'type':Sequelize[_0x057b('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b8b2993..93d1f48 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 _0x216a=['includeAll','include','clone','find','get','omit','createdAt','body','updatedAt','create','originalname','basename','file','filename','type','mimetype','download','findOne','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','Attachment','findAll','rows','catch','show','params'];(function(_0x50d564,_0x2bf28b){var _0x39be32=function(_0x98570b){while(--_0x98570b){_0x50d564['push'](_0x50d564['shift']());}};_0x39be32(++_0x2bf28b);}(_0x216a,0x6f));var _0xa216=function(_0x4b0b34,_0x7429a5){_0x4b0b34=_0x4b0b34-0x0;var _0x4eb64a=_0x216a[_0x4b0b34];return _0x4eb64a;};'use strict';var pdf=require(_0xa216('0x0'));var emlformat=require(_0xa216('0x1'));var rimraf=require(_0xa216('0x2'));var zipdir=require(_0xa216('0x3'));var jsonpatch=require(_0xa216('0x4'));var rp=require('request-promise');var moment=require(_0xa216('0x5'));var BPromise=require(_0xa216('0x6'));var Mustache=require(_0xa216('0x7'));var util=require(_0xa216('0x8'));var path=require(_0xa216('0x9'));var sox=require(_0xa216('0xa'));var csv=require(_0xa216('0xb'));var ejs=require(_0xa216('0xc'));var fs=require('fs');var _=require(_0xa216('0xd'));var squel=require('squel');var crypto=require(_0xa216('0xe'));var jsforce=require(_0xa216('0xf'));var deskjs=require(_0xa216('0x10'));var toCsv=require(_0xa216('0xb'));var querystring=require(_0xa216('0x11'));var Papa=require(_0xa216('0x12'));var Redis=require(_0xa216('0x13'));var authService=require(_0xa216('0x14'));var qs=require(_0xa216('0x15'));var as=require(_0xa216('0x16'));var hardwareService=require(_0xa216('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xa216('0x18'));var config=require(_0xa216('0x19'));var licenseUtil=require(_0xa216('0x1a'));var db=require(_0xa216('0x1b'))['db'];function respondWithStatusCode(_0x421a5f,_0x910030){_0x910030=_0x910030||0xcc;return function(_0x15c676){if(_0x15c676){return _0x421a5f[_0xa216('0x1c')](_0x910030);}return _0x421a5f[_0xa216('0x1d')](_0x910030)[_0xa216('0x1e')]();};}function respondWithResult(_0x478a92,_0x5c6585){_0x5c6585=_0x5c6585||0xc8;return function(_0x34c571){if(_0x34c571){return _0x478a92[_0xa216('0x1d')](_0x5c6585)[_0xa216('0x1f')](_0x34c571);}};}function respondWithFilteredResult(_0xaf4020,_0x306f85){return function(_0x26eae7){if(_0x26eae7){var _0x5c2209=_0x26eae7[_0xa216('0x20')],_0x33dffb=_0x306f85[_0xa216('0x21')],_0x56d6cc=_0x306f85[_0xa216('0x21')]+_0x306f85['limit'],_0x3cab6f;if(_0x56d6cc>=_0x5c2209){_0x56d6cc=_0x5c2209;_0x3cab6f=0xc8;}else{_0x3cab6f=0xce;}_0xaf4020[_0xa216('0x1d')](_0x3cab6f);return _0xaf4020['set'](_0xa216('0x22'),_0x33dffb+'-'+_0x56d6cc+'/'+_0x5c2209)[_0xa216('0x1f')](_0x26eae7);}return null;};}function patchUpdates(_0xb66f0d){return function(_0x3a17e4){try{jsonpatch[_0xa216('0x23')](_0x3a17e4,_0xb66f0d,!![]);}catch(_0x551e41){return BPromise[_0xa216('0x24')](_0x551e41);}return _0x3a17e4['save']();};}function saveUpdates(_0xf9fbc,_0x1f1e73){return function(_0x27d808){if(_0x27d808){return _0x27d808[_0xa216('0x25')](_0xf9fbc)[_0xa216('0x26')](function(_0x35c12f){return _0x35c12f;});}return null;};}function removeEntity(_0x22f6a4,_0x5a66c3){return function(_0x1303c5){if(_0x1303c5){return _0x1303c5[_0xa216('0x27')]()[_0xa216('0x26')](function(){_0x22f6a4[_0xa216('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6baf,_0x3882f5){return function(_0x420eed){if(!_0x420eed){_0x5d6baf['sendStatus'](0x194);}return _0x420eed;};}function handleError(_0x1036c0,_0x40086c){_0x40086c=_0x40086c||0x1f4;return function(_0x387ea8){logger['error'](_0x387ea8[_0xa216('0x28')]);if(_0x387ea8[_0xa216('0x29')]){delete _0x387ea8[_0xa216('0x29')];}_0x1036c0[_0xa216('0x1d')](_0x40086c)[_0xa216('0x2a')](_0x387ea8);};}exports[_0xa216('0x2b')]=function(_0x20c9a1,_0x270ff8){var _0x152615={},_0x40d164={},_0x209e3a={'count':0x0,'rows':[]};var _0x317eb0=_[_0xa216('0x2c')](db['Attachment'][_0xa216('0x2d')],function(_0x59498d){return{'name':_0x59498d[_0xa216('0x2e')],'type':_0x59498d['type'][_0xa216('0x2f')]};});_0x40d164[_0xa216('0x30')]=_['map'](_0x317eb0,_0xa216('0x29'));_0x40d164['query']=_[_0xa216('0x31')](_0x20c9a1[_0xa216('0x32')]);_0x40d164[_0xa216('0x33')]=_[_0xa216('0x34')](_0x40d164[_0xa216('0x30')],_0x40d164[_0xa216('0x32')]);_0x152615[_0xa216('0x35')]=_[_0xa216('0x34')](_0x40d164[_0xa216('0x30')],qs[_0xa216('0x36')](_0x20c9a1['query'][_0xa216('0x36')]));_0x152615[_0xa216('0x35')]=_0x152615[_0xa216('0x35')][_0xa216('0x37')]?_0x152615[_0xa216('0x35')]:_0x40d164['model'];if(!_0x20c9a1[_0xa216('0x32')][_0xa216('0x38')](_0xa216('0x39'))){_0x152615['limit']=qs[_0xa216('0x3a')](_0x20c9a1[_0xa216('0x32')]['limit']);_0x152615[_0xa216('0x21')]=qs['offset'](_0x20c9a1['query'][_0xa216('0x21')]);}_0x152615[_0xa216('0x3b')]=qs[_0xa216('0x3c')](_0x20c9a1[_0xa216('0x32')][_0xa216('0x3c')]);_0x152615['where']=qs[_0xa216('0x33')](_[_0xa216('0x3d')](_0x20c9a1[_0xa216('0x32')],_0x40d164[_0xa216('0x33')]),_0x317eb0);if(_0x20c9a1[_0xa216('0x32')][_0xa216('0x3e')]){_0x152615[_0xa216('0x3f')]=_[_0xa216('0x40')](_0x152615[_0xa216('0x3f')],{'$or':_[_0xa216('0x2c')](_0x317eb0,function(_0x33497a){if(_0x33497a['type']!==_0xa216('0x41')){var _0x1da496={};_0x1da496[_0x33497a['name']]={'$like':'%'+_0x20c9a1[_0xa216('0x32')][_0xa216('0x3e')]+'%'};return _0x1da496;}})});}_0x152615=_['merge']({},_0x152615,_0x20c9a1[_0xa216('0x42')]);var _0x5290ad={'where':_0x152615['where']};return db['Attachment'][_0xa216('0x20')](_0x5290ad)[_0xa216('0x26')](function(_0x5a2376){_0x209e3a['count']=_0x5a2376;if(_0x20c9a1[_0xa216('0x32')]['includeAll']){_0x152615['include']=[{'all':!![]}];}return db[_0xa216('0x43')][_0xa216('0x44')](_0x152615);})[_0xa216('0x26')](function(_0x90fc6a){_0x209e3a[_0xa216('0x45')]=_0x90fc6a;return _0x209e3a;})['then'](respondWithFilteredResult(_0x270ff8,_0x152615))[_0xa216('0x46')](handleError(_0x270ff8,null));};exports[_0xa216('0x47')]=function(_0x139f6c,_0x3d9158){var _0x526bd9={'raw':!![],'where':{'id':_0x139f6c[_0xa216('0x48')]['id']}},_0x58632d={};_0x58632d[_0xa216('0x30')]=_[_0xa216('0x31')](db[_0xa216('0x43')]['rawAttributes']);_0x58632d[_0xa216('0x32')]=_[_0xa216('0x31')](_0x139f6c['query']);_0x58632d['filtears']=_[_0xa216('0x34')](_0x58632d['model'],_0x58632d[_0xa216('0x32')]);_0x526bd9[_0xa216('0x35')]=_['intersection'](_0x58632d[_0xa216('0x30')],qs[_0xa216('0x36')](_0x139f6c['query']['fields']));_0x526bd9[_0xa216('0x35')]=_0x526bd9[_0xa216('0x35')][_0xa216('0x37')]?_0x526bd9['attributes']:_0x58632d[_0xa216('0x30')];if(_0x139f6c[_0xa216('0x32')][_0xa216('0x49')]){_0x526bd9[_0xa216('0x4a')]=[{'all':!![]}];}_0x526bd9=_[_0xa216('0x40')]({},_0x526bd9,_0x139f6c[_0xa216('0x42')]);return db[_0xa216('0x43')]['find'](_0x526bd9)['then'](handleEntityNotFound(_0x3d9158,null))[_0xa216('0x26')](respondWithResult(_0x3d9158,null))['catch'](handleError(_0x3d9158,null));};exports[_0xa216('0x4b')]=function(_0x578d1a,_0x523274){var _0x1d6c01={'where':{'id':_0x578d1a[_0xa216('0x48')]['id']}},_0x20ce90={};_0x20ce90['model']=_[_0xa216('0x31')](db[_0xa216('0x43')][_0xa216('0x2d')]);_0x1d6c01[_0xa216('0x35')]=_[_0xa216('0x34')](_0x20ce90['model'],qs[_0xa216('0x36')](_0x578d1a[_0xa216('0x32')][_0xa216('0x36')]));_0x1d6c01[_0xa216('0x35')]=_0x1d6c01['attributes'][_0xa216('0x37')]?_0x1d6c01['attributes']:_0x20ce90[_0xa216('0x30')];if(_0x578d1a[_0xa216('0x32')][_0xa216('0x49')]){_0x1d6c01[_0xa216('0x4a')]=[{'all':!![]}];}_0x1d6c01=_[_0xa216('0x40')]({},_0x1d6c01,_0x578d1a['options']);return db[_0xa216('0x43')][_0xa216('0x4c')](_0x1d6c01)[_0xa216('0x26')](handleEntityNotFound(_0x523274,null))[_0xa216('0x26')](function(_0x182f3a){if(_0x182f3a){var _0x414b7e=_0x182f3a[_0xa216('0x4d')]({'plain':!![]});_0x414b7e=qs[_0xa216('0x4e')](_0x414b7e,['id',_0xa216('0x4f'),'updatedAt']);_0x578d1a['body']=_[_0xa216('0x4e')](_0x578d1a[_0xa216('0x50')],['id','createdAt',_0xa216('0x51')]);return db[_0xa216('0x43')][_0xa216('0x52')](_['merge'](_0x414b7e,_0x578d1a[_0xa216('0x50')]),{'include':_0x578d1a[_0xa216('0x32')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xa216('0x26')](respondWithResult(_0x523274,0xc9))[_0xa216('0x46')](handleError(_0x523274,null));};exports[_0xa216('0x25')]=function(_0xd71485,_0x46c795){if(_0xd71485[_0xa216('0x50')]['id']){delete _0xd71485['body']['id'];}return db[_0xa216('0x43')][_0xa216('0x4c')]({'where':{'id':_0xd71485[_0xa216('0x48')]['id']}})[_0xa216('0x26')](handleEntityNotFound(_0x46c795,null))[_0xa216('0x26')](saveUpdates(_0xd71485['body'],null))[_0xa216('0x26')](respondWithResult(_0x46c795,null))[_0xa216('0x46')](handleError(_0x46c795,null));};exports['destroy']=function(_0x1a4509,_0x53d2cd){return db['Attachment'][_0xa216('0x4c')]({'where':{'id':_0x1a4509[_0xa216('0x48')]['id']}})[_0xa216('0x26')](handleEntityNotFound(_0x53d2cd,null))['then'](removeEntity(_0x53d2cd,null))['catch'](handleError(_0x53d2cd,null));};exports[_0xa216('0x52')]=function(_0x142c69,_0x5271a7,_0x22d02a){_0x142c69[_0xa216('0x50')]['name']=_0x142c69['file'][_0xa216('0x53')];_0x142c69[_0xa216('0x50')][_0xa216('0x54')]=_0x142c69[_0xa216('0x55')][_0xa216('0x56')];_0x142c69[_0xa216('0x50')][_0xa216('0x57')]=_0x142c69[_0xa216('0x55')][_0xa216('0x58')];return db['Attachment'][_0xa216('0x52')](_0x142c69[_0xa216('0x50')])[_0xa216('0x26')](respondWithResult(_0x5271a7,0xc9))[_0xa216('0x46')](handleError(_0x5271a7,null));};exports[_0xa216('0x59')]=function(_0x1cef1a,_0x44b387,_0x28d83f){return db[_0xa216('0x43')][_0xa216('0x5a')]({'where':{'id':_0x1cef1a[_0xa216('0x48')]['id']},'raw':!![]})[_0xa216('0x26')](handleEntityNotFound(_0x44b387,null))[_0xa216('0x26')](function(_0x46666a){if(_0x46666a){return _0x44b387['download'](path['join'](config['root'],_0xa216('0x5b'),_0x46666a[_0xa216('0x54')]));}})[_0xa216('0x46')](handleError(_0x44b387,null));}; \ No newline at end of file +var _0x7048=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','Attachment','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','length','find','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','download','root','server/files/attachments/','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0xb7d470,_0x3c402a){var _0x186fcf=function(_0x5d1ec9){while(--_0x5d1ec9){_0xb7d470['push'](_0xb7d470['shift']());}};_0x186fcf(++_0x3c402a);}(_0x7048,0xf9));var _0x8704=function(_0x1dee3f,_0x3b41d0){_0x1dee3f=_0x1dee3f-0x0;var _0x41a007=_0x7048[_0x1dee3f];return _0x41a007;};'use strict';var pdf=require(_0x8704('0x0'));var emlformat=require(_0x8704('0x1'));var rimraf=require(_0x8704('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8704('0x3'));var rp=require(_0x8704('0x4'));var moment=require(_0x8704('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8704('0x6'));var util=require(_0x8704('0x7'));var path=require(_0x8704('0x8'));var sox=require(_0x8704('0x9'));var csv=require(_0x8704('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8704('0xb'));var squel=require(_0x8704('0xc'));var crypto=require(_0x8704('0xd'));var jsforce=require(_0x8704('0xe'));var deskjs=require(_0x8704('0xf'));var toCsv=require(_0x8704('0xa'));var querystring=require('querystring');var Papa=require(_0x8704('0x10'));var Redis=require(_0x8704('0x11'));var authService=require(_0x8704('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8704('0x13'));var hardwareService=require(_0x8704('0x14'));var logger=require(_0x8704('0x15'))(_0x8704('0x16'));var utils=require(_0x8704('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8704('0x18'))['db'];function respondWithStatusCode(_0x1a82fd,_0x21e024){_0x21e024=_0x21e024||0xcc;return function(_0x49fe2b){if(_0x49fe2b){return _0x1a82fd[_0x8704('0x19')](_0x21e024);}return _0x1a82fd[_0x8704('0x1a')](_0x21e024)[_0x8704('0x1b')]();};}function respondWithResult(_0x131b3f,_0xbb6cb7){_0xbb6cb7=_0xbb6cb7||0xc8;return function(_0x5c7d40){if(_0x5c7d40){return _0x131b3f[_0x8704('0x1a')](_0xbb6cb7)[_0x8704('0x1c')](_0x5c7d40);}};}function respondWithFilteredResult(_0x1a18a5,_0x33ba6a){return function(_0x487682){if(_0x487682){var _0x12c65c=_0x487682[_0x8704('0x1d')],_0x183591=_0x33ba6a[_0x8704('0x1e')],_0x10f98a=_0x33ba6a[_0x8704('0x1e')]+_0x33ba6a[_0x8704('0x1f')],_0x1aea87;if(_0x10f98a>=_0x12c65c){_0x10f98a=_0x12c65c;_0x1aea87=0xc8;}else{_0x1aea87=0xce;}_0x1a18a5[_0x8704('0x1a')](_0x1aea87);return _0x1a18a5['set'](_0x8704('0x20'),_0x183591+'-'+_0x10f98a+'/'+_0x12c65c)[_0x8704('0x1c')](_0x487682);}return null;};}function patchUpdates(_0x3eca3b){return function(_0x57376b){try{jsonpatch[_0x8704('0x21')](_0x57376b,_0x3eca3b,!![]);}catch(_0x12159c){return BPromise['reject'](_0x12159c);}return _0x57376b[_0x8704('0x22')]();};}function saveUpdates(_0x50aa31,_0x240981){return function(_0x41cd1a){if(_0x41cd1a){return _0x41cd1a[_0x8704('0x23')](_0x50aa31)[_0x8704('0x24')](function(_0x2ae1ef){return _0x2ae1ef;});}return null;};}function removeEntity(_0x257192,_0x301a09){return function(_0x2bbda2){if(_0x2bbda2){return _0x2bbda2[_0x8704('0x25')]()['then'](function(){_0x257192['status'](0xcc)[_0x8704('0x1b')]();});}};}function handleEntityNotFound(_0x3362db,_0x1ac063){return function(_0x529f02){if(!_0x529f02){_0x3362db[_0x8704('0x19')](0x194);}return _0x529f02;};}function handleError(_0x53a67e,_0x412f93){_0x412f93=_0x412f93||0x1f4;return function(_0x234bfe){logger[_0x8704('0x26')](_0x234bfe[_0x8704('0x27')]);if(_0x234bfe[_0x8704('0x28')]){delete _0x234bfe[_0x8704('0x28')];}_0x53a67e[_0x8704('0x1a')](_0x412f93)[_0x8704('0x29')](_0x234bfe);};}exports['index']=function(_0x2c5fe5,_0xa131bb){var _0x8c53dc={},_0x3d5acd={},_0x41970d={'count':0x0,'rows':[]};var _0x48d81c=_[_0x8704('0x2a')](db[_0x8704('0x2b')][_0x8704('0x2c')],function(_0x2ca8f0){return{'name':_0x2ca8f0[_0x8704('0x2d')],'type':_0x2ca8f0['type'][_0x8704('0x2e')]};});_0x3d5acd[_0x8704('0x2f')]=_[_0x8704('0x2a')](_0x48d81c,_0x8704('0x28'));_0x3d5acd[_0x8704('0x30')]=_[_0x8704('0x31')](_0x2c5fe5[_0x8704('0x30')]);_0x3d5acd[_0x8704('0x32')]=_[_0x8704('0x33')](_0x3d5acd[_0x8704('0x2f')],_0x3d5acd[_0x8704('0x30')]);_0x8c53dc['attributes']=_['intersection'](_0x3d5acd[_0x8704('0x2f')],qs[_0x8704('0x34')](_0x2c5fe5[_0x8704('0x30')][_0x8704('0x34')]));_0x8c53dc[_0x8704('0x35')]=_0x8c53dc[_0x8704('0x35')]['length']?_0x8c53dc[_0x8704('0x35')]:_0x3d5acd['model'];if(!_0x2c5fe5[_0x8704('0x30')]['hasOwnProperty'](_0x8704('0x36'))){_0x8c53dc[_0x8704('0x1f')]=qs[_0x8704('0x1f')](_0x2c5fe5['query'][_0x8704('0x1f')]);_0x8c53dc[_0x8704('0x1e')]=qs[_0x8704('0x1e')](_0x2c5fe5[_0x8704('0x30')][_0x8704('0x1e')]);}_0x8c53dc[_0x8704('0x37')]=qs[_0x8704('0x38')](_0x2c5fe5[_0x8704('0x30')][_0x8704('0x38')]);_0x8c53dc[_0x8704('0x39')]=qs[_0x8704('0x32')](_[_0x8704('0x3a')](_0x2c5fe5[_0x8704('0x30')],_0x3d5acd[_0x8704('0x32')]),_0x48d81c);if(_0x2c5fe5['query'][_0x8704('0x3b')]){_0x8c53dc[_0x8704('0x39')]=_['merge'](_0x8c53dc['where'],{'$or':_[_0x8704('0x2a')](_0x48d81c,function(_0xf32bd){if(_0xf32bd[_0x8704('0x3c')]!==_0x8704('0x3d')){var _0x4e411f={};_0x4e411f[_0xf32bd[_0x8704('0x28')]]={'$like':'%'+_0x2c5fe5[_0x8704('0x30')][_0x8704('0x3b')]+'%'};return _0x4e411f;}})});}_0x8c53dc=_[_0x8704('0x3e')]({},_0x8c53dc,_0x2c5fe5[_0x8704('0x3f')]);var _0x69fa54={'where':_0x8c53dc[_0x8704('0x39')]};return db[_0x8704('0x2b')][_0x8704('0x1d')](_0x69fa54)[_0x8704('0x24')](function(_0x5c61b8){_0x41970d['count']=_0x5c61b8;if(_0x2c5fe5[_0x8704('0x30')][_0x8704('0x40')]){_0x8c53dc[_0x8704('0x41')]=[{'all':!![]}];}return db[_0x8704('0x2b')][_0x8704('0x42')](_0x8c53dc);})[_0x8704('0x24')](function(_0x3d01b6){_0x41970d[_0x8704('0x43')]=_0x3d01b6;return _0x41970d;})[_0x8704('0x24')](respondWithFilteredResult(_0xa131bb,_0x8c53dc))[_0x8704('0x44')](handleError(_0xa131bb,null));};exports[_0x8704('0x45')]=function(_0x3a3f90,_0x19000c){var _0x21cbe6={'raw':!![],'where':{'id':_0x3a3f90[_0x8704('0x46')]['id']}},_0x13f232={};_0x13f232['model']=_[_0x8704('0x31')](db[_0x8704('0x2b')][_0x8704('0x2c')]);_0x13f232[_0x8704('0x30')]=_[_0x8704('0x31')](_0x3a3f90['query']);_0x13f232[_0x8704('0x47')]=_[_0x8704('0x33')](_0x13f232['model'],_0x13f232[_0x8704('0x30')]);_0x21cbe6[_0x8704('0x35')]=_[_0x8704('0x33')](_0x13f232['model'],qs[_0x8704('0x34')](_0x3a3f90[_0x8704('0x30')][_0x8704('0x34')]));_0x21cbe6['attributes']=_0x21cbe6[_0x8704('0x35')][_0x8704('0x48')]?_0x21cbe6[_0x8704('0x35')]:_0x13f232[_0x8704('0x2f')];if(_0x3a3f90[_0x8704('0x30')][_0x8704('0x40')]){_0x21cbe6[_0x8704('0x41')]=[{'all':!![]}];}_0x21cbe6=_[_0x8704('0x3e')]({},_0x21cbe6,_0x3a3f90[_0x8704('0x3f')]);return db['Attachment'][_0x8704('0x49')](_0x21cbe6)['then'](handleEntityNotFound(_0x19000c,null))[_0x8704('0x24')](respondWithResult(_0x19000c,null))[_0x8704('0x44')](handleError(_0x19000c,null));};exports[_0x8704('0x4a')]=function(_0xbf00da,_0x182044){var _0x4cd15a={'where':{'id':_0xbf00da[_0x8704('0x46')]['id']}},_0x280f15={};_0x280f15['model']=_[_0x8704('0x31')](db['Attachment'][_0x8704('0x2c')]);_0x4cd15a[_0x8704('0x35')]=_['intersection'](_0x280f15[_0x8704('0x2f')],qs[_0x8704('0x34')](_0xbf00da['query'][_0x8704('0x34')]));_0x4cd15a[_0x8704('0x35')]=_0x4cd15a['attributes'][_0x8704('0x48')]?_0x4cd15a['attributes']:_0x280f15['model'];if(_0xbf00da[_0x8704('0x30')][_0x8704('0x40')]){_0x4cd15a[_0x8704('0x41')]=[{'all':!![]}];}_0x4cd15a=_['merge']({},_0x4cd15a,_0xbf00da[_0x8704('0x3f')]);return db[_0x8704('0x2b')]['find'](_0x4cd15a)[_0x8704('0x24')](handleEntityNotFound(_0x182044,null))[_0x8704('0x24')](function(_0x2cd470){if(_0x2cd470){var _0x449f9c=_0x2cd470[_0x8704('0x4b')]({'plain':!![]});_0x449f9c=qs[_0x8704('0x4c')](_0x449f9c,['id',_0x8704('0x4d'),_0x8704('0x4e')]);_0xbf00da['body']=_['omit'](_0xbf00da[_0x8704('0x4f')],['id',_0x8704('0x4d'),_0x8704('0x4e')]);return db['Attachment'][_0x8704('0x50')](_[_0x8704('0x3e')](_0x449f9c,_0xbf00da[_0x8704('0x4f')]),{'include':_0xbf00da[_0x8704('0x30')][_0x8704('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x182044,0xc9))[_0x8704('0x44')](handleError(_0x182044,null));};exports[_0x8704('0x23')]=function(_0x41ce92,_0x52a289){if(_0x41ce92[_0x8704('0x4f')]['id']){delete _0x41ce92[_0x8704('0x4f')]['id'];}return db[_0x8704('0x2b')]['find']({'where':{'id':_0x41ce92['params']['id']}})['then'](handleEntityNotFound(_0x52a289,null))[_0x8704('0x24')](saveUpdates(_0x41ce92[_0x8704('0x4f')],null))[_0x8704('0x24')](respondWithResult(_0x52a289,null))['catch'](handleError(_0x52a289,null));};exports[_0x8704('0x25')]=function(_0x11f2ed,_0x238d4e){return db[_0x8704('0x2b')][_0x8704('0x49')]({'where':{'id':_0x11f2ed['params']['id']}})['then'](handleEntityNotFound(_0x238d4e,null))[_0x8704('0x24')](removeEntity(_0x238d4e,null))['catch'](handleError(_0x238d4e,null));};exports[_0x8704('0x50')]=function(_0x56caa1,_0x689772,_0x189e7e){_0x56caa1[_0x8704('0x4f')][_0x8704('0x28')]=_0x56caa1[_0x8704('0x51')][_0x8704('0x52')];_0x56caa1[_0x8704('0x4f')][_0x8704('0x53')]=_0x56caa1[_0x8704('0x51')]['filename'];_0x56caa1[_0x8704('0x4f')][_0x8704('0x3c')]=_0x56caa1[_0x8704('0x51')][_0x8704('0x54')];return db[_0x8704('0x2b')][_0x8704('0x50')](_0x56caa1[_0x8704('0x4f')])['then'](respondWithResult(_0x689772,0xc9))[_0x8704('0x44')](handleError(_0x689772,null));};exports[_0x8704('0x55')]=function(_0x80ae10,_0x564b08,_0x15025d){return db['Attachment']['findOne']({'where':{'id':_0x80ae10[_0x8704('0x46')]['id']},'raw':!![]})[_0x8704('0x24')](handleEntityNotFound(_0x564b08,null))['then'](function(_0xfaf27f){if(_0xfaf27f){return _0x564b08['download'](path['join'](config[_0x8704('0x56')],_0x8704('0x57'),_0xfaf27f[_0x8704('0x53')]));}})[_0x8704('0x44')](handleError(_0x564b08,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 5442b2b..5130475 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 _0x81cb=['Attachment','attachments','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x81cb,0xaa));var _0xb81c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x81cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb81c('0x0'));var util=require(_0xb81c('0x1'));var logger=require('../../config/logger')(_0xb81c('0x2'));var moment=require(_0xb81c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb81c('0x4'));var fs=require('fs');var path=require(_0xb81c('0x5'));var rimraf=require(_0xb81c('0x6'));var config=require(_0xb81c('0x7'));var attributes=require('./attachment.attributes');module[_0xb81c('0x8')]=function(_0x50d323,_0x4e7d10){return _0x50d323[_0xb81c('0x9')](_0xb81c('0xa'),attributes,{'tableName':_0xb81c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ab9=['request-promise','path','../../config/environment','exports','define','Attachment','lodash','util','../../config/logger','api','moment'];(function(_0x55de68,_0x551917){var _0x3a2bcc=function(_0x1f0c5c){while(--_0x1f0c5c){_0x55de68['push'](_0x55de68['shift']());}};_0x3a2bcc(++_0x551917);}(_0x9ab9,0x19d));var _0x99ab=function(_0x58cbb2,_0x452b13){_0x58cbb2=_0x58cbb2-0x0;var _0x32d9c1=_0x9ab9[_0x58cbb2];return _0x32d9c1;};'use strict';var _=require(_0x99ab('0x0'));var util=require(_0x99ab('0x1'));var logger=require(_0x99ab('0x2'))(_0x99ab('0x3'));var moment=require(_0x99ab('0x4'));var BPromise=require('bluebird');var rp=require(_0x99ab('0x5'));var fs=require('fs');var path=require(_0x99ab('0x6'));var rimraf=require('rimraf');var config=require(_0x99ab('0x7'));var attributes=require('./attachment.attributes');module[_0x99ab('0x8')]=function(_0x1042a3,_0x390d41){return _0x1042a3[_0x99ab('0x9')](_0x99ab('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 32e85af..cc5cf95 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 _0xe55a=['stringify','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','code','error','message','Attachment,\x20%s,\x20%s','catch','CreateAttachment','create','body','options','raw'];(function(_0x37470e,_0x1924dd){var _0x5b9346=function(_0xb0764d){while(--_0xb0764d){_0x37470e['push'](_0x37470e['shift']());}};_0x5b9346(++_0x1924dd);}(_0xe55a,0x1c3));var _0xae55=function(_0x2a0a88,_0x543207){_0x2a0a88=_0x2a0a88-0x0;var _0x3d88dc=_0xe55a[_0x2a0a88];return _0x3d88dc;};'use strict';var _=require('lodash');var util=require(_0xae55('0x0'));var moment=require(_0xae55('0x1'));var BPromise=require(_0xae55('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae55('0x3'))['db'];var utils=require(_0xae55('0x4'));var logger=require('../../config/logger')(_0xae55('0x5'));var config=require(_0xae55('0x6'));var jayson=require(_0xae55('0x7'));var client=jayson['client'][_0xae55('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a543e,_0x1e4abd,_0x30b555){return new BPromise(function(_0x125baf,_0xc2ce35){return client[_0xae55('0x9')](_0x1a543e,_0x30b555)[_0xae55('0xa')](function(_0x2afe6d){logger[_0xae55('0xb')]('Attachment,\x20%s,\x20%s',_0x1e4abd,_0xae55('0xc'));logger[_0xae55('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4abd,'request\x20sent',JSON['stringify'](_0x2afe6d));if(_0x2afe6d['error']){if(_0x2afe6d['error'][_0xae55('0xe')]===0x1f4){logger[_0xae55('0xf')]('Attachment,\x20%s,\x20%s',_0x1e4abd,_0x2afe6d[_0xae55('0xf')][_0xae55('0x10')]);return _0xc2ce35(_0x2afe6d['error'][_0xae55('0x10')]);}logger[_0xae55('0xf')](_0xae55('0x11'),_0x1e4abd,_0x2afe6d[_0xae55('0xf')]['message']);return _0x125baf(_0x2afe6d[_0xae55('0xf')][_0xae55('0x10')]);}else{logger[_0xae55('0xb')](_0xae55('0x11'),_0x1e4abd,'request\x20sent');_0x125baf(_0x2afe6d['result'][_0xae55('0x10')]);}})[_0xae55('0x12')](function(_0x3d33a0){logger[_0xae55('0xf')](_0xae55('0x11'),_0x1e4abd,_0x3d33a0);_0xc2ce35(_0x3d33a0);});});}exports[_0xae55('0x13')]=function(_0x4362c1){var _0x3e4d68=this;return new Promise(function(_0x77f11c,_0x2ea7f3){return db['Attachment'][_0xae55('0x14')](_0x4362c1[_0xae55('0x15')],{'raw':_0x4362c1[_0xae55('0x16')]?_0x4362c1[_0xae55('0x16')][_0xae55('0x17')]===undefined?!![]:![]:!![]})[_0xae55('0xa')](function(_0x276adc){logger[_0xae55('0xb')](_0xae55('0x13'),_0x4362c1);logger[_0xae55('0xd')](_0xae55('0x13'),_0x4362c1,JSON[_0xae55('0x18')](_0x276adc));_0x77f11c(_0x276adc);})['catch'](function(_0xc12c3b){logger['error'](_0xae55('0x13'),_0xc12c3b[_0xae55('0x10')],_0x4362c1);_0x2ea7f3(_0x3e4d68[_0xae55('0xf')](0x1f4,_0xc12c3b['message']));});});}; \ No newline at end of file +var _0xd7df=['Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateAttachment','create','body','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x52caff,_0xd70fdd){var _0x296b3a=function(_0x69913d){while(--_0x69913d){_0x52caff['push'](_0x52caff['shift']());}};_0x296b3a(++_0xd70fdd);}(_0xd7df,0x174));var _0xfd7d=function(_0x2f694c,_0x555b36){_0x2f694c=_0x2f694c-0x0;var _0x5a7442=_0xd7df[_0x2f694c];return _0x5a7442;};'use strict';var _=require(_0xfd7d('0x0'));var util=require(_0xfd7d('0x1'));var moment=require(_0xfd7d('0x2'));var BPromise=require(_0xfd7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd7d('0x5'))(_0xfd7d('0x6'));var config=require(_0xfd7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfd7d('0x8')][_0xfd7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c1917,_0x212baa,_0x416174){return new BPromise(function(_0x2e9c2e,_0x44fdc5){return client['request'](_0x1c1917,_0x416174)[_0xfd7d('0xa')](function(_0x4e6517){logger[_0xfd7d('0xb')](_0xfd7d('0xc'),_0x212baa,_0xfd7d('0xd'));logger[_0xfd7d('0xe')](_0xfd7d('0xf'),_0x212baa,_0xfd7d('0xd'),JSON[_0xfd7d('0x10')](_0x4e6517));if(_0x4e6517[_0xfd7d('0x11')]){if(_0x4e6517[_0xfd7d('0x11')][_0xfd7d('0x12')]===0x1f4){logger[_0xfd7d('0x11')](_0xfd7d('0xc'),_0x212baa,_0x4e6517[_0xfd7d('0x11')]['message']);return _0x44fdc5(_0x4e6517['error'][_0xfd7d('0x13')]);}logger[_0xfd7d('0x11')]('Attachment,\x20%s,\x20%s',_0x212baa,_0x4e6517[_0xfd7d('0x11')][_0xfd7d('0x13')]);return _0x2e9c2e(_0x4e6517['error']['message']);}else{logger[_0xfd7d('0xb')](_0xfd7d('0xc'),_0x212baa,_0xfd7d('0xd'));_0x2e9c2e(_0x4e6517['result'][_0xfd7d('0x13')]);}})['catch'](function(_0x1abbf1){logger[_0xfd7d('0x11')](_0xfd7d('0xc'),_0x212baa,_0x1abbf1);_0x44fdc5(_0x1abbf1);});});}exports[_0xfd7d('0x14')]=function(_0x380de5){var _0x18fcf2=this;return new Promise(function(_0x4fd8eb,_0x20d412){return db['Attachment'][_0xfd7d('0x15')](_0x380de5[_0xfd7d('0x16')],{'raw':_0x380de5['options']?_0x380de5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5c265a){logger['info'](_0xfd7d('0x14'),_0x380de5);logger[_0xfd7d('0xe')]('CreateAttachment',_0x380de5,JSON[_0xfd7d('0x10')](_0x5c265a));_0x4fd8eb(_0x5c265a);})[_0xfd7d('0x17')](function(_0x5df397){logger['error'](_0xfd7d('0x14'),_0x5df397[_0xfd7d('0x13')],_0x380de5);_0x20d412(_0x18fcf2['error'](0x1f4,_0x5df397['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9973485..3a9bfb2 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 _0x4e2e=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','format','now','originalname','replace','post','single'];(function(_0x339daa,_0x553b41){var _0x159339=function(_0x32bdc3){while(--_0x32bdc3){_0x339daa['push'](_0x339daa['shift']());}};_0x159339(++_0x553b41);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x3e6c1d,_0x229af1){_0x3e6c1d=_0x3e6c1d-0x0;var _0x4ac527=_0x4e2e[_0x3e6c1d];return _0x4ac527;};'use strict';var multer=require('multer');var util=require(_0xe4e2('0x0'));var path=require(_0xe4e2('0x1'));var timeout=require(_0xe4e2('0x2'));var express=require(_0xe4e2('0x3'));var router=express[_0xe4e2('0x4')]();var auth=require(_0xe4e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4e2('0x6'));var controller=require(_0xe4e2('0x7'));router[_0xe4e2('0x8')]('/',auth[_0xe4e2('0x9')](),controller['index']);router[_0xe4e2('0x8')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xb')]);router[_0xe4e2('0x8')](_0xe4e2('0xc'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xd')]);router['post'](_0xe4e2('0xe'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1954f8,_0x42a1f0,_0x137047){_0x137047(null,path[_0xe4e2('0x10')](config[_0xe4e2('0x11')],'server/files/attachments/'));},'filename':function(_0x34a818,_0x20d34e,_0x19c6ef){_0x19c6ef(null,util[_0xe4e2('0x12')]('%s-%s',Date[_0xe4e2('0x13')](),_0x20d34e[_0xe4e2('0x14')][_0xe4e2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe4e2('0x16')]('/',upload[_0xe4e2('0x17')]('file'),controller['create']);router[_0xe4e2('0x18')](_0xe4e2('0xa'),auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x19')]);router[_0xe4e2('0x1a')]('/:id',auth[_0xe4e2('0x9')](),controller[_0xe4e2('0x1b')]);module[_0xe4e2('0x1c')]=router; \ No newline at end of file +var _0xd2ed=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','clone','join','root','format','%s-%s','originalname','replace','single','file','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2ed,0x14d));var _0xdd2e=function(_0x115a70,_0x1fa44b){_0x115a70=_0x115a70-0x0;var _0x295e89=_0xd2ed[_0x115a70];return _0x295e89;};'use strict';var multer=require(_0xdd2e('0x0'));var util=require(_0xdd2e('0x1'));var path=require(_0xdd2e('0x2'));var timeout=require(_0xdd2e('0x3'));var express=require(_0xdd2e('0x4'));var router=express[_0xdd2e('0x5')]();var auth=require(_0xdd2e('0x6'));var interaction=require(_0xdd2e('0x7'));var config=require('../../config/environment');var controller=require(_0xdd2e('0x8'));router['get']('/',auth[_0xdd2e('0x9')](),controller[_0xdd2e('0xa')]);router[_0xdd2e('0xb')](_0xdd2e('0xc'),auth['isAuthenticated'](),controller[_0xdd2e('0xd')]);router[_0xdd2e('0xb')](_0xdd2e('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xdd2e('0xf')]('/:id/clone',auth[_0xdd2e('0x9')](),controller[_0xdd2e('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25f0f7,_0x4dd89b,_0x11bff3){_0x11bff3(null,path[_0xdd2e('0x11')](config[_0xdd2e('0x12')],'server/files/attachments/'));},'filename':function(_0x89bf87,_0x45ae8f,_0x391a8d){_0x391a8d(null,util[_0xdd2e('0x13')](_0xdd2e('0x14'),Date['now'](),_0x45ae8f[_0xdd2e('0x15')][_0xdd2e('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdd2e('0xf')]('/',upload[_0xdd2e('0x17')](_0xdd2e('0x18')),controller['create']);router[_0xdd2e('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xdd2e('0x1a')]);router[_0xdd2e('0x1b')]('/:id',auth[_0xdd2e('0x9')](),controller[_0xdd2e('0x1c')]);module[_0xdd2e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3679b01..49e6174 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 _0xd194=['blockDuration','blockedAt','add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','callback','clientID','clientSecret','secret','Setting','then','User','find','map','emails','value','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x50c884,_0x19faa1){var _0x4ed3e4=function(_0x597717){while(--_0x597717){_0x50c884['push'](_0x50c884['shift']());}};_0x4ed3e4(++_0x19faa1);}(_0xd194,0x138));var _0x4d19=function(_0x4c9e02,_0xa13f53){_0x4c9e02=_0x4c9e02-0x0;var _0x3a1626=_0xd194[_0x4c9e02];return _0x3a1626;};'use strict';var _=require(_0x4d19('0x0'));var passport=require(_0x4d19('0x1'));var GoogleStrategy=require(_0x4d19('0x2'))[_0x4d19('0x3')];var moment=require(_0x4d19('0x4'));var db=require(_0x4d19('0x5'))['db'];var config=require(_0x4d19('0x6'));var signToken=require(_0x4d19('0x7'))[_0x4d19('0x8')];var utils=require('../../config/utils');exports[_0x4d19('0x9')]=passport[_0x4d19('0xa')](_0x4d19('0xb'),{'failureRedirect':_0x4d19('0xc'),'scope':[_0x4d19('0xd'),'email'],'session':![]});exports[_0x4d19('0xe')]=passport[_0x4d19('0xa')](_0x4d19('0xb'),{'failureRedirect':_0x4d19('0xc'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x4d19('0xb')]?config[_0x4d19('0xb')][_0x4d19('0xf')]:'id','clientSecret':config[_0x4d19('0xb')]?config[_0x4d19('0xb')][_0x4d19('0x10')]:_0x4d19('0x11'),'callbackURL':config['google']?config[_0x4d19('0xb')]['callbackURL']:''},function(_0x2a6137,_0x1b72b6,_0x159e8e,_0x2b4190){var _0x15eeef,_0x57f236;return db[_0x4d19('0x12')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x4d19('0x13')](function(_0xd1420e){_0x15eeef=_0xd1420e;return db[_0x4d19('0x14')][_0x4d19('0x15')]({'where':{'email':_[_0x4d19('0x16')](_0x159e8e[_0x4d19('0x17')],_0x4d19('0x18')),'role':{'$or':[_0x4d19('0x19'),'user',_0x4d19('0x1a')]}}});})[_0x4d19('0x13')](function(_0x1f8dec){_0x57f236=_0x1f8dec;if(_0x57f236){if(_0x57f236['disabled']){return _0x2b4190(_0x4d19('0x1b'));}else if(_0x15eeef[_0x4d19('0x1c')]>0x0){if(_0x57f236['blocked']){if(moment(_0x57f236[_0x4d19('0x1d')])[_0x4d19('0x1e')](_0x15eeef['blockDuration'],'minutes')>moment()){return _0x2b4190(_0x4d19('0x1b'));}else{return utils[_0x4d19('0x1f')](_0x57f236,0x0,![],null)[_0x4d19('0x13')](function(){return utils[_0x4d19('0x20')](_0x57f236);})[_0x4d19('0x13')](function(){return _0x2b4190(null,_0x57f236);});}}else{return utils[_0x4d19('0x20')](_0x57f236)[_0x4d19('0x13')](function(){return _0x2b4190(null,_0x57f236);});}}else{return utils['getLicense'](_0x57f236)[_0x4d19('0x13')](function(){return _0x2b4190(null,_0x57f236);});}}return _0x2b4190(_0x4d19('0x1b'));})[_0x4d19('0x21')](function(_0x54d633){_0x2b4190(_0x54d633);});})); \ No newline at end of file +var _0x49a2=['signToken','../../config/utils','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','allowedLoginAttempts','blockDuration','then','User','find','emails','value','admin','user','agent','disabled','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','lodash','passport','Strategy','moment','../../mysqldb','../../components/auth/service'];(function(_0x5241b7,_0x5147fb){var _0x56ceb3=function(_0x16828b){while(--_0x16828b){_0x5241b7['push'](_0x5241b7['shift']());}};_0x56ceb3(++_0x5147fb);}(_0x49a2,0x6c));var _0x249a=function(_0x3794a0,_0x1a9cfc){_0x3794a0=_0x3794a0-0x0;var _0x5bdaba=_0x49a2[_0x3794a0];return _0x5bdaba;};'use strict';var _=require(_0x249a('0x0'));var passport=require(_0x249a('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x249a('0x2')];var moment=require(_0x249a('0x3'));var db=require(_0x249a('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0x249a('0x5'))[_0x249a('0x6')];var utils=require(_0x249a('0x7'));exports['login']=passport['authenticate'](_0x249a('0x8'),{'failureRedirect':_0x249a('0x9'),'scope':[_0x249a('0xa'),_0x249a('0xb')],'session':![]});exports[_0x249a('0xc')]=passport[_0x249a('0xd')](_0x249a('0x8'),{'failureRedirect':_0x249a('0x9'),'session':![]});passport[_0x249a('0xe')](new GoogleStrategy({'clientID':config[_0x249a('0x8')]?config[_0x249a('0x8')][_0x249a('0xf')]:'id','clientSecret':config[_0x249a('0x8')]?config[_0x249a('0x8')][_0x249a('0x10')]:_0x249a('0x11'),'callbackURL':config[_0x249a('0x8')]?config[_0x249a('0x8')][_0x249a('0x12')]:''},function(_0x35acb0,_0x279c05,_0x25eaea,_0x22b31e){var _0x41f6ca,_0x119247;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x249a('0x13'),_0x249a('0x14')],'raw':!![]})[_0x249a('0x15')](function(_0x22f916){_0x41f6ca=_0x22f916;return db[_0x249a('0x16')][_0x249a('0x17')]({'where':{'email':_['map'](_0x25eaea[_0x249a('0x18')],_0x249a('0x19')),'role':{'$or':[_0x249a('0x1a'),_0x249a('0x1b'),_0x249a('0x1c')]}}});})[_0x249a('0x15')](function(_0x4146ec){_0x119247=_0x4146ec;if(_0x119247){if(_0x119247[_0x249a('0x1d')]){return _0x22b31e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x41f6ca[_0x249a('0x14')]>0x0){if(_0x119247[_0x249a('0x1e')]){if(moment(_0x119247[_0x249a('0x1f')])[_0x249a('0x20')](_0x41f6ca[_0x249a('0x14')],_0x249a('0x21'))>moment()){return _0x22b31e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x249a('0x22')](_0x119247,0x0,![],null)[_0x249a('0x15')](function(){return utils['getLicense'](_0x119247);})[_0x249a('0x15')](function(){return _0x22b31e(null,_0x119247);});}}else{return utils[_0x249a('0x23')](_0x119247)[_0x249a('0x15')](function(){return _0x22b31e(null,_0x119247);});}}else{return utils[_0x249a('0x23')](_0x119247)['then'](function(){return _0x22b31e(null,_0x119247);});}}return _0x22b31e(_0x249a('0x24'));})[_0x249a('0x25')](function(_0x3cfb09){_0x22b31e(_0x3cfb09);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 08c5f0a..aa6b275 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 _0x7764=['get','login','/callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x3f23f4,_0x1cf30a){var _0x5ea08a=function(_0x36a109){while(--_0x36a109){_0x3f23f4['push'](_0x3f23f4['shift']());}};_0x5ea08a(++_0x1cf30a);}(_0x7764,0xa4));var _0x4776=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x7764[_0x25efdf];return _0x22c495;};'use strict';var express=require(_0x4776('0x0'));var passport=require(_0x4776('0x1'));var router=express[_0x4776('0x2')]();var controller=require(_0x4776('0x3'));var userController=require(_0x4776('0x4'));var authService=require(_0x4776('0x5'));router[_0x4776('0x6')]('/',controller[_0x4776('0x7')]);router[_0x4776('0x6')](_0x4776('0x8'),controller['callback'],authService['isMiddleware'],userController[_0x4776('0x7')],authService[_0x4776('0x9')]);module['exports']=router; \ No newline at end of file +var _0x01fe=['get','login','/callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller'];(function(_0x3702ba,_0x460951){var _0x115695=function(_0x13d972){while(--_0x13d972){_0x3702ba['push'](_0x3702ba['shift']());}};_0x115695(++_0x460951);}(_0x01fe,0x102));var _0xe01f=function(_0x2b1b5f,_0x37c9e7){_0x2b1b5f=_0x2b1b5f-0x0;var _0x2cfd56=_0x01fe[_0x2b1b5f];return _0x2cfd56;};'use strict';var express=require(_0xe01f('0x0'));var passport=require('passport');var router=express[_0xe01f('0x1')]();var controller=require(_0xe01f('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xe01f('0x3')]('/',controller[_0xe01f('0x4')]);router[_0xe01f('0x3')](_0xe01f('0x5'),controller['callback'],authService[_0xe01f('0x6')],userController['login'],authService[_0xe01f('0x7')]);module[_0xe01f('0x8')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index dd48703..6d29e7e 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 _0xa72d=['then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','clearBlockUser','add','minutes','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','stringify','status','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','util','passport','Strategy','lodash','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','role','blocked','blockedAt','loginAttempts','user','agent'];(function(_0x40ce4b,_0x503547){var _0x4e84a0=function(_0x37061a){while(--_0x37061a){_0x40ce4b['push'](_0x40ce4b['shift']());}};_0x4e84a0(++_0x503547);}(_0xa72d,0x134));var _0xda72=function(_0x41ff3b,_0x4e58dc){_0x41ff3b=_0x41ff3b-0x0;var _0x1e4acb=_0xa72d[_0x41ff3b];return _0x1e4acb;};'use strict';var util=require(_0xda72('0x0'));var passport=require(_0xda72('0x1'));var LocalStrategy=require('passport-local')[_0xda72('0x2')];var jayson=require('jayson/promise');var _=require(_0xda72('0x3'));var rs=require('randomstring');var moment=require(_0xda72('0x4'));var db=require(_0xda72('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xda72('0x6'));var client=jayson[_0xda72('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x1729b0,_0x2f2eb7,_0x35077d,_0x1a047d){var _0x3a5ca2,_0x1eeab3;return db[_0xda72('0x8')][_0xda72('0x9')]({'where':{'id':0x1},'attributes':[_0xda72('0xa'),_0xda72('0xb')],'raw':!![]})['then'](function(_0x2fcbcb){_0x3a5ca2=_0x2fcbcb;return _0x1729b0[_0xda72('0x9')]({'attributes':['id',_0xda72('0xc'),_0xda72('0xd'),'salt',_0xda72('0xe'),'disabled',_0xda72('0xf'),_0xda72('0x10'),_0xda72('0x11')],'where':{'name':_0x2f2eb7,'role':{'$or':['admin',_0xda72('0x12'),_0xda72('0x13')]}}});})[_0xda72('0x14')](function(_0x3435a5){if(!_0x3435a5||_0x3435a5&&_0x3435a5['name']!==_0x2f2eb7){throw new Error(_0xda72('0x15'));}else{_0x1eeab3=_0x3435a5;return _0x1eeab3;}})[_0xda72('0x14')](function(){_0x1eeab3['authenticate'](_0x35077d,function(_0x905666,_0x5d7793){var _0x3e741e=_0x1eeab3['loginAttempts']+0x1;if(_0x905666){return _0x1a047d(_0x905666);}else if(!_0x5d7793){if(_0x1eeab3[_0xda72('0x16')]){return _0x1a047d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3a5ca2[_0xda72('0xa')]>0x0){if(_0x1eeab3[_0xda72('0xf')]){if(_0x3a5ca2[_0xda72('0xb')]>0x0){if(moment(_0x1eeab3[_0xda72('0x10')])['add'](_0x3a5ca2['blockDuration'],'minutes')>moment()){return _0x1a047d(null,![],{'message':_0xda72('0x15')});}else{return utils[_0xda72('0x17')](_0x1eeab3,_0x3e741e,![],null)['then'](function(){return _0x1a047d(null,![],{'message':_0xda72('0x15')});});}}else{return _0x1a047d(null,![],{'message':_0xda72('0x15')});}}else{if(_0x3e741e>=_0x3a5ca2['allowedLoginAttempts']){return utils[_0xda72('0x17')](_0x1eeab3,0x0,!![],moment())['then'](function(){return _0x1a047d(null,![],{'message':_0xda72('0x15')});});}else{return utils['clearBlockUser'](_0x1eeab3,_0x3e741e,![],null)[_0xda72('0x14')](function(){return _0x1a047d(null,![],{'message':_0xda72('0x15')});});}}}else{return _0x1a047d(null,![],{'message':_0xda72('0x15')});}}else{if(_0x1eeab3[_0xda72('0x16')]){return _0x1a047d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3a5ca2[_0xda72('0xa')]>0x0){if(_0x1eeab3[_0xda72('0xf')]){if(_0x3a5ca2[_0xda72('0xb')]>0x0){if(moment(_0x1eeab3[_0xda72('0x10')])[_0xda72('0x18')](_0x3a5ca2[_0xda72('0xb')],_0xda72('0x19'))>moment()){return _0x1a047d(null,![],{'message':_0xda72('0x15')});}else{return utils[_0xda72('0x17')](_0x1eeab3,0x0,![],null)[_0xda72('0x14')](function(){return utils[_0xda72('0x1a')](_0x1eeab3);})[_0xda72('0x14')](function(){return _0x1a047d(null,_0x1eeab3);});}}else{return _0x1a047d(null,![],{'message':_0xda72('0x15')});}}else{return utils[_0xda72('0x17')](_0x1eeab3,0x0,![],null)[_0xda72('0x14')](function(){return utils['getLicense'](_0x1eeab3);})[_0xda72('0x14')](function(){return _0x1a047d(null,_0x1eeab3);})[_0xda72('0x1b')](function(_0xb98c4e){return _0x1a047d(null,![],_0xb98c4e);});}}else{if(_0x1eeab3['blocked']){return _0x1a047d(null,![],{'message':_0xda72('0x15')});}else{return utils[_0xda72('0x1a')](_0x1eeab3)['then'](function(){return _0x1a047d(null,_0x1eeab3);});}}}});})[_0xda72('0x1b')](function(_0x3e517e){return _0x1a047d(null,![],_0x3e517e);});}function sendServiceMail(_0x397f81){return db['MailAccount'][_0xda72('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xda72('0xc'),_0xda72('0x1d')],'include':[{'model':db['MailServerOut'],'as':_0xda72('0x1e')}]})[_0xda72('0x14')](function(_0x4470a3){if(!_0x4470a3){throw new Error(_0xda72('0x1f'));}var _0x3d4de3={'tls':{'rejectUnauthorized':![]}};if(_0x4470a3[_0xda72('0x1e')][_0xda72('0x20')]){_0x3d4de3[_0xda72('0x20')]=_0x4470a3[_0xda72('0x1e')][_0xda72('0x20')];}else{_0x3d4de3[_0xda72('0x21')]=_0x4470a3[_0xda72('0x1e')][_0xda72('0x21')];_0x3d4de3[_0xda72('0x22')]=_0x4470a3[_0xda72('0x1e')][_0xda72('0x22')];_0x3d4de3[_0xda72('0x23')]=_0x4470a3[_0xda72('0x1e')][_0xda72('0x23')];}if(_0x4470a3[_0xda72('0x1e')][_0xda72('0x24')]){_0x3d4de3[_0xda72('0x25')]={'user':_0x4470a3['Smtp'][_0xda72('0x12')],'pass':_0x4470a3['Smtp'][_0xda72('0x26')]};}var _0x283e25={'account':_0x3d4de3,'message':_[_0xda72('0x27')]({'from':util[_0xda72('0x28')](_0xda72('0x29'),_0x4470a3[_0xda72('0xc')],_0x4470a3['email']||_0x4470a3['Smtp'][_0xda72('0x12')])},_0x397f81)};return client['request'](_0xda72('0x2a'),_0x283e25);})['then'](function(_0x51e058){if(_0x51e058['error']){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x51e058[_0xda72('0x2b')][_0xda72('0x2c')]||JSON[_0xda72('0x2d')](_0x51e058[_0xda72('0x2b')])));}return!![];});}function handleError(_0x471080,_0x515f6a,_0x3ed23d){return _0x471080[_0xda72('0x2e')](_0x515f6a||0x1f4)[_0xda72('0x2f')]({'message':_0x3ed23d?_0x3ed23d[_0xda72('0x2c')]||_0x3ed23d:''});}exports[_0xda72('0x30')]=function(_0x46fc5d,_0x81504b,_0x5a017c){passport[_0xda72('0x31')](_0xda72('0x32'),function(_0x53b020,_0xd2b2ee,_0x2bf88b){var _0x5e8a8b=_0x53b020||_0x2bf88b;if(_0x5e8a8b){return handleError(_0x81504b,0x191,_0x5e8a8b);}if(!_0xd2b2ee){return handleError(_0x81504b,0x194,{'message':_0xda72('0x33')});}else{var _0x26cce1={'payload':{'id':_0xd2b2ee['id'],'role':_0xd2b2ee[_0xda72('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xda72('0x34')](_0x26cce1)[_0xda72('0x14')](function(_0x43c2d0){_0x81504b[_0xda72('0x35')]({'id':_0xd2b2ee['id'],'token':_0x43c2d0,'statusCall':'','isAlreadyLogged':_0xd2b2ee[_0xda72('0x36')]});});}})(_0x46fc5d,_0x81504b,_0x5a017c);};exports[_0xda72('0x37')]=function(_0x3ef413,_0x895b15,_0x362d50){if(!_0x3ef413['body'][_0xda72('0x1d')]){return handleError(_0x895b15,0x1f4,{'message':_0xda72('0x38')});}var _0x3a1320=rs[_0xda72('0x39')]();_0x3ef413[_0xda72('0x3a')][_0xda72('0x1d')]=_0x3ef413[_0xda72('0x3a')]['email']['trim']()[_0xda72('0x3b')]();var _0x2aec86;return db['Setting'][_0xda72('0x9')]({'where':{'id':0x1},'attributes':[_0xda72('0xa'),_0xda72('0xb')],'raw':!![]})[_0xda72('0x14')](function(_0x16b3fa){_0x2aec86=_0x16b3fa;return db[_0xda72('0x3c')][_0xda72('0x1c')]({'where':{'email':_0x3ef413[_0xda72('0x3a')]['email']}});})[_0xda72('0x14')](function(_0x1fd9ea){if(!_0x1fd9ea){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x1fd9ea[_0xda72('0x16')]){throw new Error(_0xda72('0x3d'));}if(_0x1fd9ea['blocked']){if(moment(_0x1fd9ea[_0xda72('0x10')])[_0xda72('0x18')](_0x2aec86[_0xda72('0xb')],_0xda72('0x19'))>moment()){throw new Error(_0xda72('0x3e'));}else{_0x1fd9ea[_0xda72('0xf')]=![];_0x1fd9ea[_0xda72('0x10')]=null;}}_0x1fd9ea[_0xda72('0x3f')]=_0x3a1320;_0x1fd9ea[_0xda72('0x40')]=Date[_0xda72('0x41')]()+0x36ee80;return _0x1fd9ea[_0xda72('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x3ef413[_0xda72('0x3a')][_0xda72('0x1d')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xda72('0x43')+_0x3ef413[_0xda72('0x44')][_0xda72('0x21')]+_0xda72('0x45')+_0x3a1320+'\x0a\x0a'+_0xda72('0x46')});})[_0xda72('0x14')](function(){_0x895b15[_0xda72('0x2e')](0xc8)[_0xda72('0x2f')]({'message':_0xda72('0x47')});})['catch'](function(_0x77cddb){return handleError(_0x895b15,0x1f4,_0x77cddb);});};exports[_0xda72('0x48')]=function(_0x1b623f,_0x2848eb,_0x2e17cc){return db[_0xda72('0x3c')][_0xda72('0x1c')]({'where':{'resetPasswordToken':_0x1b623f['params'][_0xda72('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xda72('0x14')](function(_0x1ef691){if(!_0x1ef691){throw new Error(_0xda72('0x4a'));}return db[_0xda72('0x8')][_0xda72('0x9')]({'attributes':['id',_0xda72('0x4b'),_0xda72('0x4c'),_0xda72('0x4d')]})[_0xda72('0x14')](function(_0x164bc5){if(_0x164bc5[_0xda72('0x4b')])authService[_0xda72('0x4e')](_0x1b623f['body'][_0xda72('0xd')]);if(!_0x164bc5[_0xda72('0x4c')]||!_0x1ef691[_0xda72('0x4f')])return _0x1ef691;authService[_0xda72('0x50')](_0x1b623f['body'][_0xda72('0xd')],_0x1ef691['previousPasswords'],_0x164bc5[_0xda72('0x4d')]);return _0x1ef691;})[_0xda72('0x14')](function(){_0x1ef691[_0xda72('0xd')]=_0x1b623f[_0xda72('0x3a')][_0xda72('0xd')];_0x1ef691[_0xda72('0x3f')]=null;_0x1ef691[_0xda72('0x40')]=null;return _0x1ef691[_0xda72('0x42')]();});})[_0xda72('0x14')](function(){_0x2848eb[_0xda72('0x2e')](0xc8)[_0xda72('0x2f')]({'message':_0xda72('0x51')});})[_0xda72('0x1b')](function(_0x1bb0e3){return handleError(_0x2848eb,0x1f4,_0x1bb0e3);});};passport['use'](new LocalStrategy({'usernameField':_0xda72('0xc'),'passwordField':_0xda72('0xd')},function(_0x212a2e,_0xf51611,_0x58aaa5){return localAuthenticate(db[_0xda72('0x3c')],_0x212a2e,_0xf51611,_0x58aaa5);})); \ No newline at end of file +var _0x4417=['Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','allowedLoginAttempts','blockDuration','then','findOne','name','salt','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','clearBlockUser','add','minutes','catch','getLicense','MailAccount','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','generate','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','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://','headers','/reset/','Reset\x20Email\x20sent!','reset','find','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','use','passport'];(function(_0x4fb67b,_0x24e17d){var _0x3fbbde=function(_0x321e19){while(--_0x321e19){_0x4fb67b['push'](_0x4fb67b['shift']());}};_0x3fbbde(++_0x24e17d);}(_0x4417,0x1b7));var _0x7441=function(_0x594be6,_0x3e6677){_0x594be6=_0x594be6-0x0;var _0x52e946=_0x4417[_0x594be6];return _0x52e946;};'use strict';var util=require('util');var passport=require(_0x7441('0x0'));var LocalStrategy=require('passport-local')[_0x7441('0x1')];var jayson=require(_0x7441('0x2'));var _=require(_0x7441('0x3'));var rs=require('randomstring');var moment=require(_0x7441('0x4'));var db=require(_0x7441('0x5'))['db'];var authService=require(_0x7441('0x6'));var utils=require('../../config/utils');var client=jayson[_0x7441('0x7')][_0x7441('0x8')]({'port':0x232b});function localAuthenticate(_0x20d819,_0x2eceb0,_0x455e36,_0x3b8b48){var _0xe7e914,_0x17bdaf;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x7441('0x9'),_0x7441('0xa')],'raw':!![]})[_0x7441('0xb')](function(_0x58e69f){_0xe7e914=_0x58e69f;return _0x20d819[_0x7441('0xc')]({'attributes':['id',_0x7441('0xd'),'password',_0x7441('0xe'),'role',_0x7441('0xf'),'blocked',_0x7441('0x10'),_0x7441('0x11')],'where':{'name':_0x2eceb0,'role':{'$or':['admin',_0x7441('0x12'),_0x7441('0x13')]}}});})[_0x7441('0xb')](function(_0x1331cd){if(!_0x1331cd||_0x1331cd&&_0x1331cd[_0x7441('0xd')]!==_0x2eceb0){throw new Error(_0x7441('0x14'));}else{_0x17bdaf=_0x1331cd;return _0x17bdaf;}})[_0x7441('0xb')](function(){_0x17bdaf[_0x7441('0x15')](_0x455e36,function(_0x23119b,_0xe0466c){var _0x3b6acb=_0x17bdaf[_0x7441('0x11')]+0x1;if(_0x23119b){return _0x3b8b48(_0x23119b);}else if(!_0xe0466c){if(_0x17bdaf[_0x7441('0xf')]){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});}else if(_0xe7e914[_0x7441('0x9')]>0x0){if(_0x17bdaf[_0x7441('0x16')]){if(_0xe7e914[_0x7441('0xa')]>0x0){if(moment(_0x17bdaf['blockedAt'])['add'](_0xe7e914['blockDuration'],'minutes')>moment()){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});}else{return utils[_0x7441('0x17')](_0x17bdaf,_0x3b6acb,![],null)[_0x7441('0xb')](function(){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});});}}else{return _0x3b8b48(null,![],{'message':_0x7441('0x14')});}}else{if(_0x3b6acb>=_0xe7e914[_0x7441('0x9')]){return utils['clearBlockUser'](_0x17bdaf,0x0,!![],moment())[_0x7441('0xb')](function(){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});});}else{return utils['clearBlockUser'](_0x17bdaf,_0x3b6acb,![],null)[_0x7441('0xb')](function(){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});});}}}else{return _0x3b8b48(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x17bdaf[_0x7441('0xf')]){return _0x3b8b48(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xe7e914[_0x7441('0x9')]>0x0){if(_0x17bdaf['blocked']){if(_0xe7e914['blockDuration']>0x0){if(moment(_0x17bdaf[_0x7441('0x10')])[_0x7441('0x18')](_0xe7e914[_0x7441('0xa')],_0x7441('0x19'))>moment()){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});}else{return utils[_0x7441('0x17')](_0x17bdaf,0x0,![],null)[_0x7441('0xb')](function(){return utils['getLicense'](_0x17bdaf);})[_0x7441('0xb')](function(){return _0x3b8b48(null,_0x17bdaf);});}}else{return _0x3b8b48(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x7441('0x17')](_0x17bdaf,0x0,![],null)[_0x7441('0xb')](function(){return utils['getLicense'](_0x17bdaf);})[_0x7441('0xb')](function(){return _0x3b8b48(null,_0x17bdaf);})[_0x7441('0x1a')](function(_0x342b65){return _0x3b8b48(null,![],_0x342b65);});}}else{if(_0x17bdaf[_0x7441('0x16')]){return _0x3b8b48(null,![],{'message':_0x7441('0x14')});}else{return utils[_0x7441('0x1b')](_0x17bdaf)[_0x7441('0xb')](function(){return _0x3b8b48(null,_0x17bdaf);});}}}});})['catch'](function(_0x1b400b){return _0x3b8b48(null,![],_0x1b400b);});}function sendServiceMail(_0x3d6596){return db[_0x7441('0x1c')]['find']({'where':{'service':!![]},'attributes':['id',_0x7441('0xd'),_0x7441('0x1d')],'include':[{'model':db[_0x7441('0x1e')],'as':_0x7441('0x1f')}]})[_0x7441('0xb')](function(_0x47027d){if(!_0x47027d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x85fd00={'tls':{'rejectUnauthorized':![]}};if(_0x47027d[_0x7441('0x1f')][_0x7441('0x20')]){_0x85fd00['service']=_0x47027d['Smtp']['service'];}else{_0x85fd00[_0x7441('0x21')]=_0x47027d[_0x7441('0x1f')][_0x7441('0x21')];_0x85fd00['port']=_0x47027d[_0x7441('0x1f')][_0x7441('0x22')];_0x85fd00[_0x7441('0x23')]=_0x47027d['Smtp'][_0x7441('0x23')];}if(_0x47027d[_0x7441('0x1f')][_0x7441('0x24')]){_0x85fd00[_0x7441('0x25')]={'user':_0x47027d[_0x7441('0x1f')][_0x7441('0x12')],'pass':_0x47027d['Smtp'][_0x7441('0x26')]};}var _0x44beb2={'account':_0x85fd00,'message':_[_0x7441('0x27')]({'from':util[_0x7441('0x28')](_0x7441('0x29'),_0x47027d[_0x7441('0xd')],_0x47027d['email']||_0x47027d[_0x7441('0x1f')][_0x7441('0x12')])},_0x3d6596)};return client[_0x7441('0x2a')](_0x7441('0x2b'),_0x44beb2);})[_0x7441('0xb')](function(_0x1fe089){if(_0x1fe089[_0x7441('0x2c')]){throw new Error(util[_0x7441('0x28')](_0x7441('0x2d'),_0x1fe089[_0x7441('0x2c')][_0x7441('0x2e')]||JSON[_0x7441('0x2f')](_0x1fe089[_0x7441('0x2c')])));}return!![];});}function handleError(_0x3afe16,_0x1ca66c,_0x3b2a69){return _0x3afe16[_0x7441('0x30')](_0x1ca66c||0x1f4)[_0x7441('0x31')]({'message':_0x3b2a69?_0x3b2a69[_0x7441('0x2e')]||_0x3b2a69:''});}exports[_0x7441('0x32')]=function(_0x50d40b,_0x5f5798,_0x53bd6e){passport[_0x7441('0x15')](_0x7441('0x33'),function(_0x4129ab,_0x42e1a1,_0x13fc51){var _0x38d40b=_0x4129ab||_0x13fc51;if(_0x38d40b){return handleError(_0x5f5798,0x191,_0x38d40b);}if(!_0x42e1a1){return handleError(_0x5f5798,0x194,{'message':_0x7441('0x34')});}else{var _0x1895f6={'payload':{'id':_0x42e1a1['id'],'role':_0x42e1a1[_0x7441('0x35')]},'options':{'expiresIn':0x15180}};return authService[_0x7441('0x36')](_0x1895f6)[_0x7441('0xb')](function(_0x429e5a){_0x5f5798[_0x7441('0x37')]({'id':_0x42e1a1['id'],'token':_0x429e5a,'statusCall':'','isAlreadyLogged':_0x42e1a1[_0x7441('0x38')]});});}})(_0x50d40b,_0x5f5798,_0x53bd6e);};exports[_0x7441('0x39')]=function(_0x1c7db5,_0x20af2e,_0x4f6a65){if(!_0x1c7db5[_0x7441('0x3a')][_0x7441('0x1d')]){return handleError(_0x20af2e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x98f330=rs[_0x7441('0x3b')]();_0x1c7db5[_0x7441('0x3a')][_0x7441('0x1d')]=_0x1c7db5[_0x7441('0x3a')][_0x7441('0x1d')]['trim']()[_0x7441('0x3c')]();var _0x4b2335;return db[_0x7441('0x3d')]['findOne']({'where':{'id':0x1},'attributes':[_0x7441('0x9'),_0x7441('0xa')],'raw':!![]})[_0x7441('0xb')](function(_0x228a8e){_0x4b2335=_0x228a8e;return db[_0x7441('0x3e')]['find']({'where':{'email':_0x1c7db5[_0x7441('0x3a')][_0x7441('0x1d')]}});})[_0x7441('0xb')](function(_0x95b181){if(!_0x95b181){throw new Error(_0x7441('0x3f'));}if(_0x95b181['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x95b181[_0x7441('0x16')]){if(moment(_0x95b181[_0x7441('0x10')])[_0x7441('0x18')](_0x4b2335[_0x7441('0xa')],_0x7441('0x19'))>moment()){throw new Error(_0x7441('0x40'));}else{_0x95b181[_0x7441('0x16')]=![];_0x95b181[_0x7441('0x10')]=null;}}_0x95b181['resetPasswordToken']=_0x98f330;_0x95b181[_0x7441('0x41')]=Date[_0x7441('0x42')]()+0x36ee80;return _0x95b181[_0x7441('0x43')]();})[_0x7441('0xb')](function(){return sendServiceMail({'to':_0x1c7db5[_0x7441('0x3a')][_0x7441('0x1d')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x7441('0x44')+_0x7441('0x45')+_0x7441('0x46')+_0x1c7db5[_0x7441('0x47')][_0x7441('0x21')]+_0x7441('0x48')+_0x98f330+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x7441('0xb')](function(){_0x20af2e[_0x7441('0x30')](0xc8)[_0x7441('0x31')]({'message':_0x7441('0x49')});})[_0x7441('0x1a')](function(_0x4dc146){return handleError(_0x20af2e,0x1f4,_0x4dc146);});};exports[_0x7441('0x4a')]=function(_0x235a2d,_0x174594,_0x128978){return db['User'][_0x7441('0x4b')]({'where':{'resetPasswordToken':_0x235a2d['params'][_0x7441('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x7441('0x42')]()}}})[_0x7441('0xb')](function(_0x469bdb){if(!_0x469bdb){throw new Error(_0x7441('0x4d'));}return db[_0x7441('0x3d')][_0x7441('0xc')]({'attributes':['id',_0x7441('0x4e'),_0x7441('0x4f'),_0x7441('0x50')]})[_0x7441('0xb')](function(_0x488f1c){if(_0x488f1c[_0x7441('0x4e')])authService[_0x7441('0x51')](_0x235a2d['body'][_0x7441('0x52')]);if(!_0x488f1c[_0x7441('0x4f')]||!_0x469bdb['previousPasswords'])return _0x469bdb;authService[_0x7441('0x53')](_0x235a2d['body'][_0x7441('0x52')],_0x469bdb[_0x7441('0x54')],_0x488f1c[_0x7441('0x50')]);return _0x469bdb;})[_0x7441('0xb')](function(){_0x469bdb[_0x7441('0x52')]=_0x235a2d[_0x7441('0x3a')][_0x7441('0x52')];_0x469bdb[_0x7441('0x55')]=null;_0x469bdb[_0x7441('0x41')]=null;return _0x469bdb[_0x7441('0x43')]();});})[_0x7441('0xb')](function(){_0x174594['status'](0xc8)[_0x7441('0x31')]({'message':_0x7441('0x56')});})['catch'](function(_0x285fcb){return handleError(_0x174594,0x1f4,_0x285fcb);});};passport[_0x7441('0x57')](new LocalStrategy({'usernameField':_0x7441('0xd'),'passwordField':_0x7441('0x52')},function(_0x37fb71,_0x1dc861,_0x535ae){return localAuthenticate(db['User'],_0x37fb71,_0x1dc861,_0x535ae);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f9a57a8..1c5365d 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 _0x9064=['./authLocal.controller','post','/forgot','forgot','/reset/:token','reset','exports','express','Router'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9064,0x1e4));var _0x4906=function(_0x8724f4,_0x32c9cd){_0x8724f4=_0x8724f4-0x0;var _0x1af428=_0x9064[_0x8724f4];return _0x1af428;};'use strict';var express=require(_0x4906('0x0'));var router=express[_0x4906('0x1')]();var controller=require(_0x4906('0x2'));router[_0x4906('0x3')]('/',controller['login']);router[_0x4906('0x3')](_0x4906('0x4'),controller[_0x4906('0x5')]);router[_0x4906('0x3')](_0x4906('0x6'),controller[_0x4906('0x7')]);module[_0x4906('0x8')]=router; \ No newline at end of file +var _0x4310=['/forgot','forgot','/reset/:token','reset','exports','Router','./authLocal.controller','post'];(function(_0x19d3c0,_0x560544){var _0x56e32a=function(_0x423e3e){while(--_0x423e3e){_0x19d3c0['push'](_0x19d3c0['shift']());}};_0x56e32a(++_0x560544);}(_0x4310,0x1ed));var _0x0431=function(_0x5cad70,_0xa8e39){_0x5cad70=_0x5cad70-0x0;var _0x2ebbb3=_0x4310[_0x5cad70];return _0x2ebbb3;};'use strict';var express=require('express');var router=express[_0x0431('0x0')]();var controller=require(_0x0431('0x1'));router[_0x0431('0x2')]('/',controller['login']);router[_0x0431('0x2')](_0x0431('0x3'),controller[_0x0431('0x4')]);router[_0x0431('0x2')](_0x0431('0x5'),controller[_0x0431('0x6')]);module[_0x0431('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index f49003c..d83d012 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 _0xe5bc=['exports','STRING','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe5bc,0x194));var _0xce5b=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0xe5bc[_0x95411e];return _0x2c8718;};'use strict';var Sequelize=require(_0xce5b('0x0'));module[_0xce5b('0x1')]={'name':{'type':Sequelize[_0xce5b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xce5b('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x7867=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x7867,0xb3));var _0x7786=function(_0x4be031,_0x14d9f9){_0x4be031=_0x4be031-0x0;var _0x39cc65=_0x7867[_0x4be031];return _0x39cc65;};'use strict';var Sequelize=require(_0x7786('0x0'));module[_0x7786('0x1')]={'name':{'type':Sequelize[_0x7786('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x7786('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7786('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 26a99df..b292b69 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 _0xd2dd=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','sendStatus','stack','name','map','Automation','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','filtears','fields','include','create','body','find','addConditions','Condition','omit','ids','getConditions','findOne','addActions','Action','getActions','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel'];(function(_0x8fff76,_0x58ee62){var _0x56ac86=function(_0x153607){while(--_0x153607){_0x8fff76['push'](_0x8fff76['shift']());}};_0x56ac86(++_0x58ee62);}(_0xd2dd,0x1e0));var _0xdd2d=function(_0x3298db,_0x2a5470){_0x3298db=_0x3298db-0x0;var _0x27cce6=_0xd2dd[_0x3298db];return _0x27cce6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd2d('0x0'));var rimraf=require(_0xdd2d('0x1'));var zipdir=require(_0xdd2d('0x2'));var jsonpatch=require(_0xdd2d('0x3'));var rp=require(_0xdd2d('0x4'));var moment=require(_0xdd2d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdd2d('0x6'));var sox=require(_0xdd2d('0x7'));var csv=require(_0xdd2d('0x8'));var ejs=require(_0xdd2d('0x9'));var fs=require('fs');var _=require(_0xdd2d('0xa'));var squel=require(_0xdd2d('0xb'));var crypto=require(_0xdd2d('0xc'));var jsforce=require(_0xdd2d('0xd'));var deskjs=require(_0xdd2d('0xe'));var toCsv=require(_0xdd2d('0x8'));var querystring=require(_0xdd2d('0xf'));var Papa=require('papaparse');var Redis=require(_0xdd2d('0x10'));var authService=require(_0xdd2d('0x11'));var qs=require(_0xdd2d('0x12'));var as=require(_0xdd2d('0x13'));var hardwareService=require(_0xdd2d('0x14'));var logger=require('../../config/logger')(_0xdd2d('0x15'));var utils=require('../../config/utils');var config=require(_0xdd2d('0x16'));var licenseUtil=require(_0xdd2d('0x17'));var db=require(_0xdd2d('0x18'))['db'];function respondWithStatusCode(_0x3a7983,_0x5deb17){_0x5deb17=_0x5deb17||0xcc;return function(_0x228b71){if(_0x228b71){return _0x3a7983['sendStatus'](_0x5deb17);}return _0x3a7983[_0xdd2d('0x19')](_0x5deb17)['end']();};}function respondWithResult(_0x3e85af,_0x42929c){_0x42929c=_0x42929c||0xc8;return function(_0x184c8e){if(_0x184c8e){return _0x3e85af['status'](_0x42929c)[_0xdd2d('0x1a')](_0x184c8e);}};}function respondWithFilteredResult(_0x46e6dd,_0x4fb044){return function(_0x2e232a){if(_0x2e232a){var _0x9297aa=_0x2e232a[_0xdd2d('0x1b')],_0x26c01e=_0x4fb044[_0xdd2d('0x1c')],_0x1580c3=_0x4fb044[_0xdd2d('0x1c')]+_0x4fb044[_0xdd2d('0x1d')],_0x3789f6;if(_0x1580c3>=_0x9297aa){_0x1580c3=_0x9297aa;_0x3789f6=0xc8;}else{_0x3789f6=0xce;}_0x46e6dd[_0xdd2d('0x19')](_0x3789f6);return _0x46e6dd[_0xdd2d('0x1e')]('Content-Range',_0x26c01e+'-'+_0x1580c3+'/'+_0x9297aa)[_0xdd2d('0x1a')](_0x2e232a);}return null;};}function patchUpdates(_0x33d539){return function(_0x3fcb11){try{jsonpatch[_0xdd2d('0x1f')](_0x3fcb11,_0x33d539,!![]);}catch(_0x3592bf){return BPromise[_0xdd2d('0x20')](_0x3592bf);}return _0x3fcb11['save']();};}function saveUpdates(_0x32cd31,_0x3b393c){return function(_0x298df0){if(_0x298df0){return _0x298df0[_0xdd2d('0x21')](_0x32cd31)[_0xdd2d('0x22')](function(_0x2d1d7f){return _0x2d1d7f;});}return null;};}function removeEntity(_0x449902,_0xe15f1){return function(_0x2f077c){if(_0x2f077c){return _0x2f077c[_0xdd2d('0x23')]()[_0xdd2d('0x22')](function(){_0x449902[_0xdd2d('0x19')](0xcc)[_0xdd2d('0x24')]();});}};}function handleEntityNotFound(_0x28f7fa,_0x3de562){return function(_0x41632a){if(!_0x41632a){_0x28f7fa[_0xdd2d('0x25')](0x194);}return _0x41632a;};}function handleError(_0x41af19,_0x2f35e5){_0x2f35e5=_0x2f35e5||0x1f4;return function(_0x59a9aa){logger['error'](_0x59a9aa[_0xdd2d('0x26')]);if(_0x59a9aa[_0xdd2d('0x27')]){delete _0x59a9aa[_0xdd2d('0x27')];}_0x41af19[_0xdd2d('0x19')](_0x2f35e5)['send'](_0x59a9aa);};}exports['index']=function(_0x3f5a59,_0x2c59cf){var _0x3e01be={},_0x398218={},_0x400ddc={'count':0x0,'rows':[]};var _0x1c5d4c=_[_0xdd2d('0x28')](db[_0xdd2d('0x29')]['rawAttributes'],function(_0xacd458){return{'name':_0xacd458['fieldName'],'type':_0xacd458['type'][_0xdd2d('0x2a')]};});_0x398218[_0xdd2d('0x2b')]=_[_0xdd2d('0x28')](_0x1c5d4c,_0xdd2d('0x27'));_0x398218[_0xdd2d('0x2c')]=_[_0xdd2d('0x2d')](_0x3f5a59[_0xdd2d('0x2c')]);_0x398218['filters']=_['intersection'](_0x398218[_0xdd2d('0x2b')],_0x398218[_0xdd2d('0x2c')]);_0x3e01be[_0xdd2d('0x2e')]=_[_0xdd2d('0x2f')](_0x398218[_0xdd2d('0x2b')],qs['fields'](_0x3f5a59[_0xdd2d('0x2c')]['fields']));_0x3e01be[_0xdd2d('0x2e')]=_0x3e01be[_0xdd2d('0x2e')][_0xdd2d('0x30')]?_0x3e01be[_0xdd2d('0x2e')]:_0x398218[_0xdd2d('0x2b')];if(!_0x3f5a59[_0xdd2d('0x2c')][_0xdd2d('0x31')](_0xdd2d('0x32'))){_0x3e01be[_0xdd2d('0x1d')]=qs['limit'](_0x3f5a59[_0xdd2d('0x2c')]['limit']);_0x3e01be[_0xdd2d('0x1c')]=qs[_0xdd2d('0x1c')](_0x3f5a59[_0xdd2d('0x2c')]['offset']);}_0x3e01be[_0xdd2d('0x33')]=qs[_0xdd2d('0x34')](_0x3f5a59[_0xdd2d('0x2c')][_0xdd2d('0x34')]);_0x3e01be[_0xdd2d('0x35')]=qs[_0xdd2d('0x36')](_[_0xdd2d('0x37')](_0x3f5a59[_0xdd2d('0x2c')],_0x398218['filters']),_0x1c5d4c);if(_0x3f5a59[_0xdd2d('0x2c')][_0xdd2d('0x38')]){_0x3e01be['where']=_[_0xdd2d('0x39')](_0x3e01be[_0xdd2d('0x35')],{'$or':_[_0xdd2d('0x28')](_0x1c5d4c,function(_0x2e1a66){if(_0x2e1a66[_0xdd2d('0x3a')]!==_0xdd2d('0x3b')){var _0x293baa={};_0x293baa[_0x2e1a66[_0xdd2d('0x27')]]={'$like':'%'+_0x3f5a59[_0xdd2d('0x2c')]['filter']+'%'};return _0x293baa;}})});}_0x3e01be=_[_0xdd2d('0x39')]({},_0x3e01be,_0x3f5a59['options']);var _0x5ec6be={'where':_0x3e01be[_0xdd2d('0x35')]};return db[_0xdd2d('0x29')]['count'](_0x5ec6be)[_0xdd2d('0x22')](function(_0x50a49f){_0x400ddc[_0xdd2d('0x1b')]=_0x50a49f;if(_0x3f5a59[_0xdd2d('0x2c')][_0xdd2d('0x3c')]){_0x3e01be['include']=[{'all':!![]}];}return db[_0xdd2d('0x29')][_0xdd2d('0x3d')](_0x3e01be);})[_0xdd2d('0x22')](function(_0x256e0f){_0x400ddc['rows']=_0x256e0f;return _0x400ddc;})['then'](respondWithFilteredResult(_0x2c59cf,_0x3e01be))[_0xdd2d('0x3e')](handleError(_0x2c59cf,null));};exports[_0xdd2d('0x3f')]=function(_0x53d225,_0x1c65b4){var _0x104a52={'raw':![],'where':{'id':_0x53d225[_0xdd2d('0x40')]['id']}},_0x148846={};_0x148846[_0xdd2d('0x2b')]=_['keys'](db[_0xdd2d('0x29')][_0xdd2d('0x41')]);_0x148846[_0xdd2d('0x2c')]=_[_0xdd2d('0x2d')](_0x53d225[_0xdd2d('0x2c')]);_0x148846[_0xdd2d('0x42')]=_[_0xdd2d('0x2f')](_0x148846[_0xdd2d('0x2b')],_0x148846[_0xdd2d('0x2c')]);_0x104a52[_0xdd2d('0x2e')]=_[_0xdd2d('0x2f')](_0x148846['model'],qs[_0xdd2d('0x43')](_0x53d225['query'][_0xdd2d('0x43')]));_0x104a52[_0xdd2d('0x2e')]=_0x104a52[_0xdd2d('0x2e')][_0xdd2d('0x30')]?_0x104a52[_0xdd2d('0x2e')]:_0x148846[_0xdd2d('0x2b')];if(_0x53d225[_0xdd2d('0x2c')][_0xdd2d('0x3c')]){_0x104a52[_0xdd2d('0x44')]=[{'all':!![]}];}_0x104a52=_[_0xdd2d('0x39')]({},_0x104a52,_0x53d225['options']);return db[_0xdd2d('0x29')]['find'](_0x104a52)[_0xdd2d('0x22')](handleEntityNotFound(_0x1c65b4,null))[_0xdd2d('0x22')](respondWithResult(_0x1c65b4,null))[_0xdd2d('0x3e')](handleError(_0x1c65b4,null));};exports['create']=function(_0x1ad611,_0x5c9719){return db['Automation'][_0xdd2d('0x45')](_0x1ad611[_0xdd2d('0x46')],{})['then'](respondWithResult(_0x5c9719,0xc9))[_0xdd2d('0x3e')](handleError(_0x5c9719,null));};exports['update']=function(_0x9af5f6,_0x4a90b5){if(_0x9af5f6['body']['id']){delete _0x9af5f6[_0xdd2d('0x46')]['id'];}return db[_0xdd2d('0x29')]['find']({'where':{'id':_0x9af5f6['params']['id']}})['then'](handleEntityNotFound(_0x4a90b5,null))['then'](saveUpdates(_0x9af5f6[_0xdd2d('0x46')],null))[_0xdd2d('0x22')](respondWithResult(_0x4a90b5,null))['catch'](handleError(_0x4a90b5,null));};exports[_0xdd2d('0x23')]=function(_0x5086ae,_0x1dbdcf){return db[_0xdd2d('0x29')][_0xdd2d('0x47')]({'where':{'id':_0x5086ae['params']['id']}})['then'](handleEntityNotFound(_0x1dbdcf,null))[_0xdd2d('0x22')](removeEntity(_0x1dbdcf,null))['catch'](handleError(_0x1dbdcf,null));};exports[_0xdd2d('0x48')]=function(_0x5aa09c,_0x325e2d,_0x3f182a){return db[_0xdd2d('0x49')]['find']({'where':{'id':_0x5aa09c[_0xdd2d('0x40')]['id']}})['then'](handleEntityNotFound(_0x325e2d,null))[_0xdd2d('0x22')](function(_0x64fc4){if(_0x64fc4){return _0x64fc4['addConditions'](_0x5aa09c[_0xdd2d('0x46')]['ids'],_[_0xdd2d('0x4a')](_0x5aa09c[_0xdd2d('0x46')],[_0xdd2d('0x4b'),'id'])||{});}})[_0xdd2d('0x22')](respondWithResult(_0x325e2d,null))[_0xdd2d('0x3e')](handleError(_0x325e2d,null));};exports[_0xdd2d('0x4c')]=function(_0x19b2c0,_0x45d2b0,_0x577970){var _0x1ec771={};var _0x145e72={};var _0x7cc79f;var _0x29b8d4;return db[_0xdd2d('0x29')][_0xdd2d('0x4d')]({'where':{'id':_0x19b2c0[_0xdd2d('0x40')]['id']}})[_0xdd2d('0x22')](handleEntityNotFound(_0x45d2b0,null))['then'](function(_0x11eb8e){if(_0x11eb8e){_0x7cc79f=_0x11eb8e;_0x145e72[_0xdd2d('0x2b')]=_[_0xdd2d('0x2d')](db[_0xdd2d('0x49')][_0xdd2d('0x41')]);_0x145e72[_0xdd2d('0x2c')]=_[_0xdd2d('0x2d')](_0x19b2c0['query']);_0x145e72['filters']=_[_0xdd2d('0x2f')](_0x145e72[_0xdd2d('0x2b')],_0x145e72[_0xdd2d('0x2c')]);_0x1ec771[_0xdd2d('0x2e')]=_[_0xdd2d('0x2f')](_0x145e72['model'],qs[_0xdd2d('0x43')](_0x19b2c0[_0xdd2d('0x2c')][_0xdd2d('0x43')]));_0x1ec771['attributes']=_0x1ec771[_0xdd2d('0x2e')][_0xdd2d('0x30')]?_0x1ec771[_0xdd2d('0x2e')]:_0x145e72[_0xdd2d('0x2b')];_0x1ec771[_0xdd2d('0x33')]=qs['sort'](_0x19b2c0['query'][_0xdd2d('0x34')]);_0x1ec771['where']=qs['filters'](_[_0xdd2d('0x37')](_0x19b2c0[_0xdd2d('0x2c')],_0x145e72[_0xdd2d('0x36')]));if(_0x19b2c0[_0xdd2d('0x2c')][_0xdd2d('0x38')]){_0x1ec771[_0xdd2d('0x35')]=_['merge'](_0x1ec771[_0xdd2d('0x35')],{'$or':_['map'](_0x1ec771[_0xdd2d('0x2e')],function(_0xaa71f2){var _0x342cbb={};_0x342cbb[_0xaa71f2]={'$like':'%'+_0x19b2c0[_0xdd2d('0x2c')][_0xdd2d('0x38')]+'%'};return _0x342cbb;})});}_0x1ec771=_[_0xdd2d('0x39')]({},_0x1ec771,_0x19b2c0['options']);return _0x7cc79f[_0xdd2d('0x4c')](_0x1ec771);}})[_0xdd2d('0x22')](function(_0x3f761b){if(_0x3f761b){_0x29b8d4=_0x3f761b[_0xdd2d('0x30')];if(!_0x19b2c0[_0xdd2d('0x2c')][_0xdd2d('0x31')](_0xdd2d('0x32'))){_0x1ec771[_0xdd2d('0x1d')]=qs[_0xdd2d('0x1d')](_0x19b2c0[_0xdd2d('0x2c')][_0xdd2d('0x1d')]);_0x1ec771['offset']=qs['offset'](_0x19b2c0['query'][_0xdd2d('0x1c')]);}return _0x7cc79f['getConditions'](_0x1ec771);}})['then'](function(_0x4f2d83){if(_0x4f2d83){return _0x4f2d83?{'count':_0x29b8d4,'rows':_0x4f2d83}:null;}})['then'](respondWithResult(_0x45d2b0,null))[_0xdd2d('0x3e')](handleError(_0x45d2b0,null));};exports[_0xdd2d('0x4e')]=function(_0x556f85,_0x273e41,_0x411871){return db[_0xdd2d('0x4f')][_0xdd2d('0x47')]({'where':{'id':_0x556f85[_0xdd2d('0x40')]['id']}})[_0xdd2d('0x22')](handleEntityNotFound(_0x273e41,null))['then'](function(_0x5c47fe){if(_0x5c47fe){return _0x5c47fe[_0xdd2d('0x4e')](_0x556f85[_0xdd2d('0x46')]['ids'],_[_0xdd2d('0x4a')](_0x556f85[_0xdd2d('0x46')],['ids','id'])||{});}})['then'](respondWithResult(_0x273e41,null))['catch'](handleError(_0x273e41,null));};exports[_0xdd2d('0x50')]=function(_0x321b41,_0x4f6c91,_0x46a3fc){var _0x382597={};var _0x619c0f={};var _0x25f4dd;var _0x57aa02;return db[_0xdd2d('0x29')][_0xdd2d('0x4d')]({'where':{'id':_0x321b41[_0xdd2d('0x40')]['id']}})[_0xdd2d('0x22')](handleEntityNotFound(_0x4f6c91,null))['then'](function(_0x10420e){if(_0x10420e){_0x25f4dd=_0x10420e;_0x619c0f[_0xdd2d('0x2b')]=_[_0xdd2d('0x2d')](db['Action'][_0xdd2d('0x41')]);_0x619c0f[_0xdd2d('0x2c')]=_['keys'](_0x321b41[_0xdd2d('0x2c')]);_0x619c0f[_0xdd2d('0x36')]=_[_0xdd2d('0x2f')](_0x619c0f[_0xdd2d('0x2b')],_0x619c0f[_0xdd2d('0x2c')]);_0x382597[_0xdd2d('0x2e')]=_[_0xdd2d('0x2f')](_0x619c0f[_0xdd2d('0x2b')],qs[_0xdd2d('0x43')](_0x321b41['query']['fields']));_0x382597['attributes']=_0x382597['attributes'][_0xdd2d('0x30')]?_0x382597[_0xdd2d('0x2e')]:_0x619c0f[_0xdd2d('0x2b')];_0x382597[_0xdd2d('0x33')]=qs[_0xdd2d('0x34')](_0x321b41[_0xdd2d('0x2c')][_0xdd2d('0x34')]);_0x382597[_0xdd2d('0x35')]=qs[_0xdd2d('0x36')](_[_0xdd2d('0x37')](_0x321b41[_0xdd2d('0x2c')],_0x619c0f[_0xdd2d('0x36')]));if(_0x321b41[_0xdd2d('0x2c')][_0xdd2d('0x38')]){_0x382597[_0xdd2d('0x35')]=_[_0xdd2d('0x39')](_0x382597['where'],{'$or':_[_0xdd2d('0x28')](_0x382597[_0xdd2d('0x2e')],function(_0x23b241){var _0x2de42c={};_0x2de42c[_0x23b241]={'$like':'%'+_0x321b41['query'][_0xdd2d('0x38')]+'%'};return _0x2de42c;})});}_0x382597=_[_0xdd2d('0x39')]({},_0x382597,_0x321b41[_0xdd2d('0x51')]);return _0x25f4dd[_0xdd2d('0x50')](_0x382597);}})[_0xdd2d('0x22')](function(_0x51d5b9){if(_0x51d5b9){_0x57aa02=_0x51d5b9[_0xdd2d('0x30')];if(!_0x321b41['query'][_0xdd2d('0x31')](_0xdd2d('0x32'))){_0x382597[_0xdd2d('0x1d')]=qs[_0xdd2d('0x1d')](_0x321b41['query']['limit']);_0x382597[_0xdd2d('0x1c')]=qs[_0xdd2d('0x1c')](_0x321b41[_0xdd2d('0x2c')][_0xdd2d('0x1c')]);}return _0x25f4dd[_0xdd2d('0x50')](_0x382597);}})[_0xdd2d('0x22')](function(_0x34b00b){if(_0x34b00b){return _0x34b00b?{'count':_0x57aa02,'rows':_0x34b00b}:null;}})[_0xdd2d('0x22')](respondWithResult(_0x4f6c91,null))[_0xdd2d('0x3e')](handleError(_0x4f6c91,null));}; \ No newline at end of file +var _0xd338=['end','stack','send','Automation','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','findAll','rows','filtears','catch','create','body','update','params','destroy','addConditions','Condition','find','omit','ids','getConditions','findOne','map','addActions','getActions','Action','nolimit','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','then'];(function(_0x2f2dba,_0x451d2e){var _0x27e85e=function(_0x512386){while(--_0x512386){_0x2f2dba['push'](_0x2f2dba['shift']());}};_0x27e85e(++_0x451d2e);}(_0xd338,0x1b6));var _0x8d33=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xd338[_0xb66df];return _0x42a702;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8d33('0x0'));var rimraf=require(_0x8d33('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d33('0x2'));var rp=require(_0x8d33('0x3'));var moment=require('moment');var BPromise=require(_0x8d33('0x4'));var Mustache=require(_0x8d33('0x5'));var util=require(_0x8d33('0x6'));var path=require(_0x8d33('0x7'));var sox=require(_0x8d33('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8d33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8d33('0xb'));var querystring=require(_0x8d33('0xc'));var Papa=require(_0x8d33('0xd'));var Redis=require(_0x8d33('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8d33('0xf'));var as=require(_0x8d33('0x10'));var hardwareService=require(_0x8d33('0x11'));var logger=require(_0x8d33('0x12'))(_0x8d33('0x13'));var utils=require('../../config/utils');var config=require(_0x8d33('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d33('0x15'))['db'];function respondWithStatusCode(_0x4b8c8c,_0x301a93){_0x301a93=_0x301a93||0xcc;return function(_0x5dade7){if(_0x5dade7){return _0x4b8c8c[_0x8d33('0x16')](_0x301a93);}return _0x4b8c8c['status'](_0x301a93)['end']();};}function respondWithResult(_0x1292a2,_0x54f85b){_0x54f85b=_0x54f85b||0xc8;return function(_0x3df98a){if(_0x3df98a){return _0x1292a2[_0x8d33('0x17')](_0x54f85b)[_0x8d33('0x18')](_0x3df98a);}};}function respondWithFilteredResult(_0x2b6838,_0x1f66ec){return function(_0x4e3dfa){if(_0x4e3dfa){var _0x42485f=_0x4e3dfa[_0x8d33('0x19')],_0xdfef8=_0x1f66ec[_0x8d33('0x1a')],_0x7f7830=_0x1f66ec[_0x8d33('0x1a')]+_0x1f66ec[_0x8d33('0x1b')],_0x13c478;if(_0x7f7830>=_0x42485f){_0x7f7830=_0x42485f;_0x13c478=0xc8;}else{_0x13c478=0xce;}_0x2b6838[_0x8d33('0x17')](_0x13c478);return _0x2b6838['set']('Content-Range',_0xdfef8+'-'+_0x7f7830+'/'+_0x42485f)[_0x8d33('0x18')](_0x4e3dfa);}return null;};}function patchUpdates(_0x16a093){return function(_0xcabe73){try{jsonpatch[_0x8d33('0x1c')](_0xcabe73,_0x16a093,!![]);}catch(_0x2ccbdf){return BPromise['reject'](_0x2ccbdf);}return _0xcabe73['save']();};}function saveUpdates(_0x10871c,_0x2891fc){return function(_0x559c0f){if(_0x559c0f){return _0x559c0f['update'](_0x10871c)[_0x8d33('0x1d')](function(_0x4ec696){return _0x4ec696;});}return null;};}function removeEntity(_0x300308,_0x46224e){return function(_0x2c811c){if(_0x2c811c){return _0x2c811c['destroy']()[_0x8d33('0x1d')](function(){_0x300308[_0x8d33('0x17')](0xcc)[_0x8d33('0x1e')]();});}};}function handleEntityNotFound(_0x42b119,_0x4f8d9b){return function(_0x44d6fd){if(!_0x44d6fd){_0x42b119[_0x8d33('0x16')](0x194);}return _0x44d6fd;};}function handleError(_0x27e769,_0x299a3d){_0x299a3d=_0x299a3d||0x1f4;return function(_0x4bb6bc){logger['error'](_0x4bb6bc[_0x8d33('0x1f')]);if(_0x4bb6bc['name']){delete _0x4bb6bc['name'];}_0x27e769[_0x8d33('0x17')](_0x299a3d)[_0x8d33('0x20')](_0x4bb6bc);};}exports['index']=function(_0x3d2460,_0x165e7f){var _0x510e9e={},_0x12da2f={},_0x517120={'count':0x0,'rows':[]};var _0x53efd7=_['map'](db[_0x8d33('0x21')][_0x8d33('0x22')],function(_0x5b4e19){return{'name':_0x5b4e19[_0x8d33('0x23')],'type':_0x5b4e19['type'][_0x8d33('0x24')]};});_0x12da2f[_0x8d33('0x25')]=_['map'](_0x53efd7,_0x8d33('0x26'));_0x12da2f[_0x8d33('0x27')]=_[_0x8d33('0x28')](_0x3d2460[_0x8d33('0x27')]);_0x12da2f[_0x8d33('0x29')]=_[_0x8d33('0x2a')](_0x12da2f[_0x8d33('0x25')],_0x12da2f[_0x8d33('0x27')]);_0x510e9e[_0x8d33('0x2b')]=_['intersection'](_0x12da2f[_0x8d33('0x25')],qs[_0x8d33('0x2c')](_0x3d2460[_0x8d33('0x27')][_0x8d33('0x2c')]));_0x510e9e[_0x8d33('0x2b')]=_0x510e9e[_0x8d33('0x2b')][_0x8d33('0x2d')]?_0x510e9e[_0x8d33('0x2b')]:_0x12da2f[_0x8d33('0x25')];if(!_0x3d2460['query'][_0x8d33('0x2e')]('nolimit')){_0x510e9e['limit']=qs[_0x8d33('0x1b')](_0x3d2460[_0x8d33('0x27')]['limit']);_0x510e9e[_0x8d33('0x1a')]=qs[_0x8d33('0x1a')](_0x3d2460['query'][_0x8d33('0x1a')]);}_0x510e9e[_0x8d33('0x2f')]=qs[_0x8d33('0x30')](_0x3d2460[_0x8d33('0x27')][_0x8d33('0x30')]);_0x510e9e['where']=qs[_0x8d33('0x29')](_[_0x8d33('0x31')](_0x3d2460[_0x8d33('0x27')],_0x12da2f[_0x8d33('0x29')]),_0x53efd7);if(_0x3d2460[_0x8d33('0x27')][_0x8d33('0x32')]){_0x510e9e['where']=_[_0x8d33('0x33')](_0x510e9e['where'],{'$or':_['map'](_0x53efd7,function(_0xe804b3){if(_0xe804b3[_0x8d33('0x34')]!==_0x8d33('0x35')){var _0x14eabd={};_0x14eabd[_0xe804b3[_0x8d33('0x26')]]={'$like':'%'+_0x3d2460[_0x8d33('0x27')]['filter']+'%'};return _0x14eabd;}})});}_0x510e9e=_[_0x8d33('0x33')]({},_0x510e9e,_0x3d2460[_0x8d33('0x36')]);var _0x5b6c57={'where':_0x510e9e[_0x8d33('0x37')]};return db[_0x8d33('0x21')][_0x8d33('0x19')](_0x5b6c57)[_0x8d33('0x1d')](function(_0x18bb4b){_0x517120[_0x8d33('0x19')]=_0x18bb4b;if(_0x3d2460[_0x8d33('0x27')][_0x8d33('0x38')]){_0x510e9e['include']=[{'all':!![]}];}return db[_0x8d33('0x21')][_0x8d33('0x39')](_0x510e9e);})[_0x8d33('0x1d')](function(_0x1b9c1e){_0x517120[_0x8d33('0x3a')]=_0x1b9c1e;return _0x517120;})[_0x8d33('0x1d')](respondWithFilteredResult(_0x165e7f,_0x510e9e))['catch'](handleError(_0x165e7f,null));};exports['show']=function(_0x57cdb6,_0x1795cc){var _0x72a9a0={'raw':![],'where':{'id':_0x57cdb6['params']['id']}},_0x2a04b7={};_0x2a04b7[_0x8d33('0x25')]=_[_0x8d33('0x28')](db['Automation']['rawAttributes']);_0x2a04b7['query']=_[_0x8d33('0x28')](_0x57cdb6[_0x8d33('0x27')]);_0x2a04b7[_0x8d33('0x3b')]=_['intersection'](_0x2a04b7[_0x8d33('0x25')],_0x2a04b7[_0x8d33('0x27')]);_0x72a9a0[_0x8d33('0x2b')]=_[_0x8d33('0x2a')](_0x2a04b7[_0x8d33('0x25')],qs[_0x8d33('0x2c')](_0x57cdb6[_0x8d33('0x27')][_0x8d33('0x2c')]));_0x72a9a0[_0x8d33('0x2b')]=_0x72a9a0[_0x8d33('0x2b')][_0x8d33('0x2d')]?_0x72a9a0[_0x8d33('0x2b')]:_0x2a04b7[_0x8d33('0x25')];if(_0x57cdb6[_0x8d33('0x27')][_0x8d33('0x38')]){_0x72a9a0['include']=[{'all':!![]}];}_0x72a9a0=_[_0x8d33('0x33')]({},_0x72a9a0,_0x57cdb6['options']);return db['Automation']['find'](_0x72a9a0)[_0x8d33('0x1d')](handleEntityNotFound(_0x1795cc,null))[_0x8d33('0x1d')](respondWithResult(_0x1795cc,null))[_0x8d33('0x3c')](handleError(_0x1795cc,null));};exports[_0x8d33('0x3d')]=function(_0x102206,_0x246a08){return db[_0x8d33('0x21')]['create'](_0x102206[_0x8d33('0x3e')],{})[_0x8d33('0x1d')](respondWithResult(_0x246a08,0xc9))['catch'](handleError(_0x246a08,null));};exports[_0x8d33('0x3f')]=function(_0x1de858,_0x42f140){if(_0x1de858[_0x8d33('0x3e')]['id']){delete _0x1de858[_0x8d33('0x3e')]['id'];}return db[_0x8d33('0x21')]['find']({'where':{'id':_0x1de858[_0x8d33('0x40')]['id']}})['then'](handleEntityNotFound(_0x42f140,null))[_0x8d33('0x1d')](saveUpdates(_0x1de858[_0x8d33('0x3e')],null))['then'](respondWithResult(_0x42f140,null))[_0x8d33('0x3c')](handleError(_0x42f140,null));};exports[_0x8d33('0x41')]=function(_0x54a639,_0x7d3b7f){return db[_0x8d33('0x21')]['find']({'where':{'id':_0x54a639[_0x8d33('0x40')]['id']}})[_0x8d33('0x1d')](handleEntityNotFound(_0x7d3b7f,null))[_0x8d33('0x1d')](removeEntity(_0x7d3b7f,null))[_0x8d33('0x3c')](handleError(_0x7d3b7f,null));};exports[_0x8d33('0x42')]=function(_0x22e8df,_0x4288e3,_0x1a3189){return db[_0x8d33('0x43')][_0x8d33('0x44')]({'where':{'id':_0x22e8df[_0x8d33('0x40')]['id']}})['then'](handleEntityNotFound(_0x4288e3,null))[_0x8d33('0x1d')](function(_0xb61b93){if(_0xb61b93){return _0xb61b93['addConditions'](_0x22e8df[_0x8d33('0x3e')]['ids'],_[_0x8d33('0x45')](_0x22e8df['body'],[_0x8d33('0x46'),'id'])||{});}})[_0x8d33('0x1d')](respondWithResult(_0x4288e3,null))['catch'](handleError(_0x4288e3,null));};exports[_0x8d33('0x47')]=function(_0x22273a,_0x2e50b7,_0x40d8f4){var _0x4c86fb={};var _0x3b75e4={};var _0x442bdf;var _0x2ec1e5;return db[_0x8d33('0x21')][_0x8d33('0x48')]({'where':{'id':_0x22273a[_0x8d33('0x40')]['id']}})[_0x8d33('0x1d')](handleEntityNotFound(_0x2e50b7,null))[_0x8d33('0x1d')](function(_0x9a194e){if(_0x9a194e){_0x442bdf=_0x9a194e;_0x3b75e4[_0x8d33('0x25')]=_[_0x8d33('0x28')](db[_0x8d33('0x43')][_0x8d33('0x22')]);_0x3b75e4[_0x8d33('0x27')]=_[_0x8d33('0x28')](_0x22273a[_0x8d33('0x27')]);_0x3b75e4[_0x8d33('0x29')]=_[_0x8d33('0x2a')](_0x3b75e4[_0x8d33('0x25')],_0x3b75e4[_0x8d33('0x27')]);_0x4c86fb[_0x8d33('0x2b')]=_[_0x8d33('0x2a')](_0x3b75e4[_0x8d33('0x25')],qs[_0x8d33('0x2c')](_0x22273a[_0x8d33('0x27')][_0x8d33('0x2c')]));_0x4c86fb[_0x8d33('0x2b')]=_0x4c86fb[_0x8d33('0x2b')]['length']?_0x4c86fb['attributes']:_0x3b75e4[_0x8d33('0x25')];_0x4c86fb[_0x8d33('0x2f')]=qs[_0x8d33('0x30')](_0x22273a[_0x8d33('0x27')][_0x8d33('0x30')]);_0x4c86fb[_0x8d33('0x37')]=qs[_0x8d33('0x29')](_[_0x8d33('0x31')](_0x22273a[_0x8d33('0x27')],_0x3b75e4['filters']));if(_0x22273a[_0x8d33('0x27')]['filter']){_0x4c86fb[_0x8d33('0x37')]=_['merge'](_0x4c86fb[_0x8d33('0x37')],{'$or':_[_0x8d33('0x49')](_0x4c86fb[_0x8d33('0x2b')],function(_0x795f86){var _0x20b994={};_0x20b994[_0x795f86]={'$like':'%'+_0x22273a[_0x8d33('0x27')][_0x8d33('0x32')]+'%'};return _0x20b994;})});}_0x4c86fb=_[_0x8d33('0x33')]({},_0x4c86fb,_0x22273a[_0x8d33('0x36')]);return _0x442bdf[_0x8d33('0x47')](_0x4c86fb);}})[_0x8d33('0x1d')](function(_0xedc8ff){if(_0xedc8ff){_0x2ec1e5=_0xedc8ff[_0x8d33('0x2d')];if(!_0x22273a[_0x8d33('0x27')][_0x8d33('0x2e')]('nolimit')){_0x4c86fb[_0x8d33('0x1b')]=qs['limit'](_0x22273a[_0x8d33('0x27')][_0x8d33('0x1b')]);_0x4c86fb[_0x8d33('0x1a')]=qs['offset'](_0x22273a[_0x8d33('0x27')][_0x8d33('0x1a')]);}return _0x442bdf[_0x8d33('0x47')](_0x4c86fb);}})[_0x8d33('0x1d')](function(_0x2e8df8){if(_0x2e8df8){return _0x2e8df8?{'count':_0x2ec1e5,'rows':_0x2e8df8}:null;}})[_0x8d33('0x1d')](respondWithResult(_0x2e50b7,null))['catch'](handleError(_0x2e50b7,null));};exports[_0x8d33('0x4a')]=function(_0x3d4c43,_0x5e69c4,_0x1ef679){return db['Action'][_0x8d33('0x44')]({'where':{'id':_0x3d4c43[_0x8d33('0x40')]['id']}})[_0x8d33('0x1d')](handleEntityNotFound(_0x5e69c4,null))['then'](function(_0x3a95c0){if(_0x3a95c0){return _0x3a95c0['addActions'](_0x3d4c43[_0x8d33('0x3e')][_0x8d33('0x46')],_[_0x8d33('0x45')](_0x3d4c43[_0x8d33('0x3e')],['ids','id'])||{});}})[_0x8d33('0x1d')](respondWithResult(_0x5e69c4,null))['catch'](handleError(_0x5e69c4,null));};exports[_0x8d33('0x4b')]=function(_0x2b6a97,_0x519fe9,_0x1f8e7d){var _0x3810ea={};var _0x4cf86b={};var _0x2248ab;var _0x2d5750;return db[_0x8d33('0x21')][_0x8d33('0x48')]({'where':{'id':_0x2b6a97[_0x8d33('0x40')]['id']}})[_0x8d33('0x1d')](handleEntityNotFound(_0x519fe9,null))[_0x8d33('0x1d')](function(_0x57dfae){if(_0x57dfae){_0x2248ab=_0x57dfae;_0x4cf86b[_0x8d33('0x25')]=_[_0x8d33('0x28')](db[_0x8d33('0x4c')]['rawAttributes']);_0x4cf86b['query']=_[_0x8d33('0x28')](_0x2b6a97[_0x8d33('0x27')]);_0x4cf86b[_0x8d33('0x29')]=_[_0x8d33('0x2a')](_0x4cf86b[_0x8d33('0x25')],_0x4cf86b[_0x8d33('0x27')]);_0x3810ea[_0x8d33('0x2b')]=_[_0x8d33('0x2a')](_0x4cf86b['model'],qs[_0x8d33('0x2c')](_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x2c')]));_0x3810ea['attributes']=_0x3810ea[_0x8d33('0x2b')][_0x8d33('0x2d')]?_0x3810ea[_0x8d33('0x2b')]:_0x4cf86b['model'];_0x3810ea['order']=qs[_0x8d33('0x30')](_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x30')]);_0x3810ea[_0x8d33('0x37')]=qs[_0x8d33('0x29')](_['pick'](_0x2b6a97['query'],_0x4cf86b[_0x8d33('0x29')]));if(_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x32')]){_0x3810ea['where']=_[_0x8d33('0x33')](_0x3810ea[_0x8d33('0x37')],{'$or':_['map'](_0x3810ea[_0x8d33('0x2b')],function(_0xe6974){var _0x4ae695={};_0x4ae695[_0xe6974]={'$like':'%'+_0x2b6a97['query'][_0x8d33('0x32')]+'%'};return _0x4ae695;})});}_0x3810ea=_[_0x8d33('0x33')]({},_0x3810ea,_0x2b6a97[_0x8d33('0x36')]);return _0x2248ab[_0x8d33('0x4b')](_0x3810ea);}})[_0x8d33('0x1d')](function(_0x44c89a){if(_0x44c89a){_0x2d5750=_0x44c89a[_0x8d33('0x2d')];if(!_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x2e')](_0x8d33('0x4d'))){_0x3810ea['limit']=qs[_0x8d33('0x1b')](_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x1b')]);_0x3810ea[_0x8d33('0x1a')]=qs[_0x8d33('0x1a')](_0x2b6a97[_0x8d33('0x27')][_0x8d33('0x1a')]);}return _0x2248ab[_0x8d33('0x4b')](_0x3810ea);}})[_0x8d33('0x1d')](function(_0x5b6c2a){if(_0x5b6c2a){return _0x5b6c2a?{'count':_0x2d5750,'rows':_0x5b6c2a}:null;}})[_0x8d33('0x1d')](respondWithResult(_0x519fe9,null))['catch'](handleError(_0x519fe9,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e96b23c..864d94a 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 _0xce61=['exports','define','tools_automations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x48890c,_0x12b87b){var _0x180c95=function(_0x41a437){while(--_0x41a437){_0x48890c['push'](_0x48890c['shift']());}};_0x180c95(++_0x12b87b);}(_0xce61,0x66));var _0x1ce6=function(_0x52ce80,_0x13da5b){_0x52ce80=_0x52ce80-0x0;var _0x182ee6=_0xce61[_0x52ce80];return _0x182ee6;};'use strict';var _=require(_0x1ce6('0x0'));var util=require('util');var logger=require(_0x1ce6('0x1'))(_0x1ce6('0x2'));var moment=require('moment');var BPromise=require(_0x1ce6('0x3'));var rp=require(_0x1ce6('0x4'));var fs=require('fs');var path=require(_0x1ce6('0x5'));var rimraf=require(_0x1ce6('0x6'));var config=require(_0x1ce6('0x7'));var attributes=require('./automation.attributes');module[_0x1ce6('0x8')]=function(_0x4ce6ce,_0x5b1341){return _0x4ce6ce[_0x1ce6('0x9')]('Automation',attributes,{'tableName':_0x1ce6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe075=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','util','../../config/logger'];(function(_0x231e29,_0x2afc1a){var _0x3a3a05=function(_0x2c8e93){while(--_0x2c8e93){_0x231e29['push'](_0x231e29['shift']());}};_0x3a3a05(++_0x2afc1a);}(_0xe075,0x143));var _0x5e07=function(_0x162ae3,_0x3299ed){_0x162ae3=_0x162ae3-0x0;var _0x4fe946=_0xe075[_0x162ae3];return _0x4fe946;};'use strict';var _=require('lodash');var util=require(_0x5e07('0x0'));var logger=require(_0x5e07('0x1'))(_0x5e07('0x2'));var moment=require(_0x5e07('0x3'));var BPromise=require(_0x5e07('0x4'));var rp=require(_0x5e07('0x5'));var fs=require('fs');var path=require(_0x5e07('0x6'));var rimraf=require(_0x5e07('0x7'));var config=require(_0x5e07('0x8'));var attributes=require(_0x5e07('0x9'));module[_0x5e07('0xa')]=function(_0x2a466b,_0x5b9b46){return _0x2a466b[_0x5e07('0xb')](_0x5e07('0xc'),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 cb8c8d6..1853102 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 _0xc2a3=['error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2b4768,_0x16014b){var _0xb95fb2=function(_0x5df094){while(--_0x5df094){_0x2b4768['push'](_0x2b4768['shift']());}};_0xb95fb2(++_0x16014b);}(_0xc2a3,0x131));var _0x3c2a=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0xc2a3[_0x1bd3ab];return _0x37e394;};'use strict';var _=require(_0x3c2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c2a('0x1'));var rs=require(_0x3c2a('0x2'));var fs=require('fs');var Redis=require(_0x3c2a('0x3'));var db=require(_0x3c2a('0x4'))['db'];var utils=require(_0x3c2a('0x5'));var logger=require(_0x3c2a('0x6'))(_0x3c2a('0x7'));var config=require(_0x3c2a('0x8'));var jayson=require(_0x3c2a('0x9'));var client=jayson[_0x3c2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f018,_0x31e9e8,_0x114b13){return new BPromise(function(_0x2e0c2e,_0x9c4233){return client[_0x3c2a('0xb')](_0x34f018,_0x114b13)[_0x3c2a('0xc')](function(_0x5025ac){logger['info'](_0x3c2a('0xd'),_0x31e9e8,_0x3c2a('0xe'));logger['debug'](_0x3c2a('0xf'),_0x31e9e8,_0x3c2a('0xe'),JSON[_0x3c2a('0x10')](_0x5025ac));if(_0x5025ac[_0x3c2a('0x11')]){if(_0x5025ac[_0x3c2a('0x11')][_0x3c2a('0x12')]===0x1f4){logger[_0x3c2a('0x11')]('Automation,\x20%s,\x20%s',_0x31e9e8,_0x5025ac['error'][_0x3c2a('0x13')]);return _0x9c4233(_0x5025ac[_0x3c2a('0x11')][_0x3c2a('0x13')]);}logger[_0x3c2a('0x11')](_0x3c2a('0xd'),_0x31e9e8,_0x5025ac[_0x3c2a('0x11')][_0x3c2a('0x13')]);return _0x2e0c2e(_0x5025ac[_0x3c2a('0x11')]['message']);}else{logger[_0x3c2a('0x14')](_0x3c2a('0xd'),_0x31e9e8,_0x3c2a('0xe'));_0x2e0c2e(_0x5025ac[_0x3c2a('0x15')][_0x3c2a('0x13')]);}})[_0x3c2a('0x16')](function(_0x14400d){logger[_0x3c2a('0x11')]('Automation,\x20%s,\x20%s',_0x31e9e8,_0x14400d);_0x9c4233(_0x14400d);});});} \ No newline at end of file +var _0x177d=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x2b66d7,_0x5cfa98){var _0x4c7512=function(_0x53886b){while(--_0x53886b){_0x2b66d7['push'](_0x2b66d7['shift']());}};_0x4c7512(++_0x5cfa98);}(_0x177d,0xcd));var _0xd177=function(_0x561fa9,_0x4b6ee4){_0x561fa9=_0x561fa9-0x0;var _0x13bf96=_0x177d[_0x561fa9];return _0x13bf96;};'use strict';var _=require(_0xd177('0x0'));var util=require(_0xd177('0x1'));var moment=require('moment');var BPromise=require(_0xd177('0x2'));var rs=require(_0xd177('0x3'));var fs=require('fs');var Redis=require(_0xd177('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd177('0x5'));var logger=require('../../config/logger')(_0xd177('0x6'));var config=require(_0xd177('0x7'));var jayson=require(_0xd177('0x8'));var client=jayson['client'][_0xd177('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4b5d,_0x418a62,_0xc74528){return new BPromise(function(_0x3a2a36,_0x5113ef){return client['request'](_0x4a4b5d,_0xc74528)['then'](function(_0x1c93cb){logger[_0xd177('0xa')](_0xd177('0xb'),_0x418a62,_0xd177('0xc'));logger[_0xd177('0xd')](_0xd177('0xe'),_0x418a62,_0xd177('0xc'),JSON[_0xd177('0xf')](_0x1c93cb));if(_0x1c93cb[_0xd177('0x10')]){if(_0x1c93cb['error'][_0xd177('0x11')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x418a62,_0x1c93cb['error'][_0xd177('0x12')]);return _0x5113ef(_0x1c93cb[_0xd177('0x10')][_0xd177('0x12')]);}logger[_0xd177('0x10')]('Automation,\x20%s,\x20%s',_0x418a62,_0x1c93cb[_0xd177('0x10')][_0xd177('0x12')]);return _0x3a2a36(_0x1c93cb['error'][_0xd177('0x12')]);}else{logger[_0xd177('0xa')](_0xd177('0xb'),_0x418a62,'request\x20sent');_0x3a2a36(_0x1c93cb['result'][_0xd177('0x12')]);}})[_0xd177('0x13')](function(_0x16f473){logger[_0xd177('0x10')](_0xd177('0xb'),_0x418a62,_0x16f473);_0x5113ef(_0x16f473);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 446787f..d541e9e 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 _0xa24a=['/:id/conditions','/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id','get'];(function(_0xf2ad93,_0x30a64d){var _0x5d045d=function(_0x1f2571){while(--_0x1f2571){_0xf2ad93['push'](_0xf2ad93['shift']());}};_0x5d045d(++_0x30a64d);}(_0xa24a,0x1a2));var _0xaa24=function(_0x5e046a,_0x3684fa){_0x5e046a=_0x5e046a-0x0;var _0xc83acb=_0xa24a[_0x5e046a];return _0xc83acb;};'use strict';var multer=require(_0xaa24('0x0'));var util=require(_0xaa24('0x1'));var path=require(_0xaa24('0x2'));var timeout=require(_0xaa24('0x3'));var express=require(_0xaa24('0x4'));var router=express[_0xaa24('0x5')]();var auth=require(_0xaa24('0x6'));var interaction=require(_0xaa24('0x7'));var config=require(_0xaa24('0x8'));var controller=require(_0xaa24('0x9'));router['get']('/',auth[_0xaa24('0xa')](),controller[_0xaa24('0xb')]);router['get'](_0xaa24('0xc'),auth[_0xaa24('0xa')](),controller['show']);router[_0xaa24('0xd')](_0xaa24('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0xaa24('0xd')](_0xaa24('0xf'),auth[_0xaa24('0xa')](),controller[_0xaa24('0x10')]);router[_0xaa24('0x11')]('/',auth[_0xaa24('0xa')](),controller[_0xaa24('0x12')]);router[_0xaa24('0x11')](_0xaa24('0xe'),auth['isAuthenticated'](),controller['addConditions']);router[_0xaa24('0x11')]('/:id/actions',auth[_0xaa24('0xa')](),controller[_0xaa24('0x13')]);router[_0xaa24('0x14')](_0xaa24('0xc'),auth['isAuthenticated'](),controller[_0xaa24('0x15')]);router[_0xaa24('0x16')](_0xaa24('0xc'),auth[_0xaa24('0xa')](),controller[_0xaa24('0x17')]);module['exports']=router; \ No newline at end of file +var _0x33a5=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','create','/:id/conditions','addConditions','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4ce726,_0x1ad9e7){var _0x457da9=function(_0x4a2f7f){while(--_0x4a2f7f){_0x4ce726['push'](_0x4ce726['shift']());}};_0x457da9(++_0x1ad9e7);}(_0x33a5,0x125));var _0x533a=function(_0x5a8cd9,_0x39ae44){_0x5a8cd9=_0x5a8cd9-0x0;var _0x458471=_0x33a5[_0x5a8cd9];return _0x458471;};'use strict';var multer=require(_0x533a('0x0'));var util=require(_0x533a('0x1'));var path=require(_0x533a('0x2'));var timeout=require(_0x533a('0x3'));var express=require(_0x533a('0x4'));var router=express[_0x533a('0x5')]();var auth=require(_0x533a('0x6'));var interaction=require(_0x533a('0x7'));var config=require(_0x533a('0x8'));var controller=require(_0x533a('0x9'));router[_0x533a('0xa')]('/',auth[_0x533a('0xb')](),controller[_0x533a('0xc')]);router['get'](_0x533a('0xd'),auth[_0x533a('0xb')](),controller[_0x533a('0xe')]);router[_0x533a('0xa')]('/:id/conditions',auth[_0x533a('0xb')](),controller[_0x533a('0xf')]);router[_0x533a('0xa')]('/:id/actions',auth[_0x533a('0xb')](),controller[_0x533a('0x10')]);router[_0x533a('0x11')]('/',auth[_0x533a('0xb')](),controller[_0x533a('0x12')]);router[_0x533a('0x11')](_0x533a('0x13'),auth[_0x533a('0xb')](),controller[_0x533a('0x14')]);router[_0x533a('0x11')]('/:id/actions',auth[_0x533a('0xb')](),controller['addActions']);router[_0x533a('0x15')]('/:id',auth[_0x533a('0xb')](),controller[_0x533a('0x16')]);router[_0x533a('0x17')](_0x533a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x533a('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 50bc13d..670d65f 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 _0xe21c=['Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)'];(function(_0x4952d4,_0x102385){var _0x152c2a=function(_0x53722e){while(--_0x53722e){_0x4952d4['push'](_0x4952d4['shift']());}};_0x152c2a(++_0x102385);}(_0xe21c,0x1b9));var _0xce21=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xe21c[_0x290694];return _0x5a0f2e;};'use strict';var Sequelize=require(_0xce21('0x0'));module[_0xce21('0x1')]={'name':{'type':Sequelize[_0xce21('0x2')],'unique':_0xce21('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xce21('0x4')](_0xce21('0x5')),'allowNull':![],'defaultValue':_0xce21('0x5')},'description':{'type':Sequelize[_0xce21('0x2')]},'active':{'type':Sequelize[_0xce21('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xce21('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xce21('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xce21('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xce21('0x7')](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xce21('0x8')],'defaultValue':0x3,'comment':_0xce21('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xce21('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xce21('0x10')},'dialTimezone':{'type':Sequelize[_0xce21('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xce21('0x2')],'defaultValue':_0xce21('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xce21('0x4')](_0xce21('0x12'),_0xce21('0x13'),_0xce21('0x14')),'defaultValue':_0xce21('0x12')},'dialAMDActive':{'type':Sequelize[_0xce21('0x6')],'defaultValue':0x0,'comment':_0xce21('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xce21('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xce21('0x16')},'dialAMDGreeting':{'type':Sequelize[_0xce21('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xce21('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xce21('0x7')](0x9)[_0xce21('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xce21('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xce21('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xce21('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0xce21('0x7')](0x9)[_0xce21('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xce21('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xce21('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xce21('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xce21('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xce21('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xce21('0x7')](0x5)[_0xce21('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xce21('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xce21('0x7')](0x9)[_0xce21('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xce21('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xce21('0x4')](_0xce21('0x1f'),_0xce21('0x20')),'defaultValue':_0xce21('0x1f')},'dialPrefix':{'type':Sequelize[_0xce21('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xce21('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xce21('0x21')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xce21('0x7')](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0x22')},'dialDropMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0x23')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0x25')},'dialMachineMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xce21('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0xce21('0x7')](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xce21('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xce21('0x7')](0x3)[_0xce21('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xce21('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x06e4=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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\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)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x335622,_0x525089){var _0x173e8f=function(_0x38b2a7){while(--_0x38b2a7){_0x335622['push'](_0x335622['shift']());}};_0x173e8f(++_0x525089);}(_0x06e4,0x13a));var _0x406e=function(_0x2c4f3f,_0x266947){_0x2c4f3f=_0x2c4f3f-0x0;var _0x3d0234=_0x06e4[_0x2c4f3f];return _0x3d0234;};'use strict';var Sequelize=require(_0x406e('0x0'));module[_0x406e('0x1')]={'name':{'type':Sequelize[_0x406e('0x2')],'unique':_0x406e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x406e('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x406e('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x406e('0x6')],'defaultValue':0x0,'comment':_0x406e('0x7')},'limitCalls':{'type':Sequelize[_0x406e('0x8')](0x4)[_0x406e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x406e('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x406e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x406e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x406e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x406e('0x8')](0x3)[_0x406e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x406e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x406e('0x8')](0x3)[_0x406e('0x9')],'defaultValue':0x3,'comment':_0x406e('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)[_0x406e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x406e('0x8')](0x3)[_0x406e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x406e('0x10')},'dialTimezone':{'type':Sequelize[_0x406e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x406e('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x406e('0x11'),_0x406e('0x12')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x406e('0x6')],'defaultValue':0x0,'comment':_0x406e('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x406e('0x8')](0x9)[_0x406e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x406e('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x406e('0x8')](0x9)[_0x406e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x406e('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x406e('0x8')](0x9)[_0x406e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x406e('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x406e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x406e('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x406e('0x8')](0x9)[_0x406e('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x406e('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x406e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x406e('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x406e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x406e('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x406e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x406e('0x8')](0x9)[_0x406e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x406e('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x406e('0x4')](_0x406e('0x1c'),_0x406e('0x1d')),'defaultValue':_0x406e('0x1c')},'dialPrefix':{'type':Sequelize[_0x406e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x406e('0x8')](0x3)[_0x406e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x406e('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x406e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x406e('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)[_0x406e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x406e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0x22')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x406e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x406e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0x25')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x406e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x406e('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)[_0x406e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x406e('0x27')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x406e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x406e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0543873..0a36fff 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 _0x14a0=['fromQuery','phone\x20NOT\x20IN\x20(?)','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','Campaign','includeAll','include','rows','catch','show','params','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','createdAt','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CampaignId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','ContactId','ListId','select','field','phone','scheduledAt','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x14a0,0x8e));var _0x014a=function(_0x484a09,_0x31b700){_0x484a09=_0x484a09-0x0;var _0x16ea35=_0x14a0[_0x484a09];return _0x16ea35;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x014a('0x0'));var rimraf=require(_0x014a('0x1'));var zipdir=require(_0x014a('0x2'));var jsonpatch=require(_0x014a('0x3'));var rp=require(_0x014a('0x4'));var moment=require(_0x014a('0x5'));var BPromise=require(_0x014a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x014a('0x7'));var sox=require(_0x014a('0x8'));var csv=require(_0x014a('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=_0x3a836f[_0x014a('0x18')],_0x59a4ea=_0x59f207[_0x014a('0x19')],_0x16e6fc=_0x59f207[_0x014a('0x19')]+_0x59f207[_0x014a('0x1a')],_0x17e4be;if(_0x16e6fc>=_0x128c46){_0x16e6fc=_0x128c46;_0x17e4be=0xc8;}else{_0x17e4be=0xce;}_0x3cf92f[_0x014a('0x15')](_0x17e4be);return _0x3cf92f[_0x014a('0x1b')](_0x014a('0x1c'),_0x59a4ea+'-'+_0x16e6fc+'/'+_0x128c46)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x281224){return function(_0x89e132){try{jsonpatch[_0x014a('0x1d')](_0x89e132,_0x281224,!![]);}catch(_0x34e5c3){return BPromise['reject'](_0x34e5c3);}return _0x89e132[_0x014a('0x1e')]();};}function saveUpdates(_0x109a9c,_0x11065f){return function(_0x1897c7){if(_0x1897c7){return _0x1897c7[_0x014a('0x1f')](_0x109a9c)[_0x014a('0x20')](function(_0x37c3d1){return _0x37c3d1;});}return null;};}function removeEntity(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x21')]()['then'](function(){var _0x1a1318=_0x486e66[_0x014a('0x22')]({'plain':!![]});var _0x44d921=_0x014a('0x23');return db[_0x014a('0x24')][_0x014a('0x21')]({'where':{'type':_0x44d921,'resourceId':_0x1a1318['id']}})[_0x014a('0x20')](function(){return _0x486e66;});})[_0x014a('0x20')](function(){_0x3dd2d0[_0x014a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4b92,_0x5358e9){return function(_0x39a432){if(!_0x39a432){_0x3b4b92[_0x014a('0x14')](0x194);}return _0x39a432;};}function handleError(_0x4f1c44,_0x4ee195){_0x4ee195=_0x4ee195||0x1f4;return function(_0x9a901f){logger[_0x014a('0x25')](_0x9a901f[_0x014a('0x26')]);if(_0x9a901f['name']){delete _0x9a901f[_0x014a('0x27')];}_0x4f1c44[_0x014a('0x15')](_0x4ee195)['send'](_0x9a901f);};}exports[_0x014a('0x28')]=function(_0x2560a6,_0x496040){var _0x4f9c1c={},_0x397850={},_0x3e5a0a={'count':0x0,'rows':[]};var _0xe70dfa=_[_0x014a('0x29')](db['Campaign'][_0x014a('0x2a')],function(_0x147e7e){return{'name':_0x147e7e[_0x014a('0x2b')],'type':_0x147e7e[_0x014a('0x2c')][_0x014a('0x2d')]};});_0x397850[_0x014a('0x2e')]=_[_0x014a('0x29')](_0xe70dfa,_0x014a('0x27'));_0x397850[_0x014a('0x2f')]=_[_0x014a('0x30')](_0x2560a6[_0x014a('0x2f')]);_0x397850['filters']=_[_0x014a('0x31')](_0x397850[_0x014a('0x2e')],_0x397850[_0x014a('0x2f')]);_0x4f9c1c[_0x014a('0x32')]=_[_0x014a('0x31')](_0x397850[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x2560a6['query'][_0x014a('0x33')]));_0x4f9c1c[_0x014a('0x32')]=_0x4f9c1c['attributes'][_0x014a('0x34')]?_0x4f9c1c[_0x014a('0x32')]:_0x397850[_0x014a('0x2e')];if(!_0x2560a6[_0x014a('0x2f')][_0x014a('0x35')](_0x014a('0x36'))){_0x4f9c1c[_0x014a('0x1a')]=qs[_0x014a('0x1a')](_0x2560a6['query'][_0x014a('0x1a')]);_0x4f9c1c[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x2560a6[_0x014a('0x2f')]['offset']);}_0x4f9c1c[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x2560a6[_0x014a('0x2f')][_0x014a('0x38')]);_0x4f9c1c[_0x014a('0x39')]=qs[_0x014a('0x3a')](_[_0x014a('0x3b')](_0x2560a6[_0x014a('0x2f')],_0x397850[_0x014a('0x3a')]),_0xe70dfa);if(_0x2560a6['query'][_0x014a('0x3c')]){_0x4f9c1c['where']=_[_0x014a('0x3d')](_0x4f9c1c[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0xe70dfa,function(_0x1398bb){if(_0x1398bb[_0x014a('0x2c')]!=='VIRTUAL'){var _0x1c6f6f={};_0x1c6f6f[_0x1398bb[_0x014a('0x27')]]={'$like':'%'+_0x2560a6['query'][_0x014a('0x3c')]+'%'};return _0x1c6f6f;}})});}_0x4f9c1c=_[_0x014a('0x3d')]({},_0x4f9c1c,_0x2560a6[_0x014a('0x3e')]);var _0x2e7a14={'where':_0x4f9c1c[_0x014a('0x39')]};return db[_0x014a('0x3f')][_0x014a('0x18')](_0x2e7a14)[_0x014a('0x20')](function(_0x2beddc){_0x3e5a0a['count']=_0x2beddc;if(_0x2560a6[_0x014a('0x2f')][_0x014a('0x40')]){_0x4f9c1c[_0x014a('0x41')]=[{'all':!![]}];}return db[_0x014a('0x3f')]['findAll'](_0x4f9c1c);})[_0x014a('0x20')](function(_0xf402){_0x3e5a0a[_0x014a('0x42')]=_0xf402;return _0x3e5a0a;})[_0x014a('0x20')](respondWithFilteredResult(_0x496040,_0x4f9c1c))[_0x014a('0x43')](handleError(_0x496040,null));};exports[_0x014a('0x44')]=function(_0x5f2969,_0x361866){var _0x2830e1={'raw':![],'where':{'id':_0x5f2969[_0x014a('0x45')]['id']}},_0x5e2f74={};_0x5e2f74[_0x014a('0x2e')]=_[_0x014a('0x30')](db['Campaign'][_0x014a('0x2a')]);_0x5e2f74['query']=_['keys'](_0x5f2969[_0x014a('0x2f')]);_0x5e2f74[_0x014a('0x46')]=_['intersection'](_0x5e2f74[_0x014a('0x2e')],_0x5e2f74[_0x014a('0x2f')]);_0x2830e1[_0x014a('0x32')]=_[_0x014a('0x31')](_0x5e2f74[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x5f2969['query'][_0x014a('0x33')]));_0x2830e1[_0x014a('0x32')]=_0x2830e1[_0x014a('0x32')]['length']?_0x2830e1['attributes']:_0x5e2f74[_0x014a('0x2e')];if(_0x5f2969['query']['includeAll']){_0x2830e1[_0x014a('0x41')]=[{'all':!![]}];}_0x2830e1=_['merge']({},_0x2830e1,_0x5f2969[_0x014a('0x3e')]);return db[_0x014a('0x3f')][_0x014a('0x47')](_0x2830e1)['then'](handleEntityNotFound(_0x361866,null))[_0x014a('0x20')](respondWithResult(_0x361866,null))[_0x014a('0x43')](handleError(_0x361866,null));};exports[_0x014a('0x48')]=function(_0x42d91d,_0x449aea){return db[_0x014a('0x3f')]['create'](_0x42d91d[_0x014a('0x49')],{})[_0x014a('0x20')](function(_0x5a861c){var _0x1a4df9=_0x42d91d[_0x014a('0x4a')][_0x014a('0x22')]({'plain':!![]});if(!_0x1a4df9)throw new Error(_0x014a('0x4b'));if(_0x1a4df9[_0x014a('0x4c')]===_0x014a('0x4a')){var _0x437f23=_0x5a861c[_0x014a('0x22')]({'plain':!![]});var _0x4aa72b=_0x014a('0x23');return db[_0x014a('0x4d')][_0x014a('0x47')]({'where':{'name':_0x4aa72b,'userProfileId':_0x1a4df9[_0x014a('0x4e')]},'raw':!![]})[_0x014a('0x20')](function(_0x4b2fdb){if(_0x4b2fdb&&_0x4b2fdb[_0x014a('0x4f')]===0x0){return db['UserProfileResource'][_0x014a('0x48')]({'name':_0x437f23[_0x014a('0x27')],'resourceId':_0x437f23['id'],'type':_0x4b2fdb[_0x014a('0x27')],'sectionId':_0x4b2fdb['id']},{})[_0x014a('0x20')](function(){return _0x5a861c;});}else{return _0x5a861c;}})[_0x014a('0x43')](function(_0x4f8547){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f8547);throw _0x4f8547;});}return _0x5a861c;})['then'](respondWithResult(_0x449aea,0xc9))[_0x014a('0x43')](handleError(_0x449aea,null));};exports['clone']=function(_0x1fe253,_0x5b5318){var _0x59cfbe={'where':{'id':_0x1fe253['params']['id']}},_0x21ff0c={};_0x21ff0c[_0x014a('0x2e')]=_[_0x014a('0x30')](db[_0x014a('0x3f')][_0x014a('0x2a')]);_0x59cfbe[_0x014a('0x32')]=_[_0x014a('0x31')](_0x21ff0c[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x1fe253[_0x014a('0x2f')][_0x014a('0x33')]));_0x59cfbe['attributes']=_0x59cfbe['attributes'][_0x014a('0x34')]?_0x59cfbe[_0x014a('0x32')]:_0x21ff0c[_0x014a('0x2e')];if(_0x1fe253['query']['includeAll']){_0x59cfbe[_0x014a('0x41')]=[{'all':!![]}];}_0x59cfbe=_['merge']({},_0x59cfbe,_0x1fe253[_0x014a('0x3e')]);return db[_0x014a('0x3f')][_0x014a('0x47')](_0x59cfbe)[_0x014a('0x20')](handleEntityNotFound(_0x5b5318,null))['then'](function(_0x861fb5){if(_0x861fb5){var _0x2ccc2f=_0x861fb5[_0x014a('0x22')]({'plain':!![]});_0x2ccc2f=qs['omit'](_0x2ccc2f,['id',_0x014a('0x50'),'updatedAt']);_0x1fe253[_0x014a('0x49')]=_[_0x014a('0x51')](_0x1fe253[_0x014a('0x49')],['id',_0x014a('0x50'),_0x014a('0x52')]);return db[_0x014a('0x3f')]['create'](_[_0x014a('0x3d')](_0x2ccc2f,_0x1fe253[_0x014a('0x49')]),{'include':_0x1fe253[_0x014a('0x2f')]['includeAll']?[{'all':!![]}]:undefined})[_0x014a('0x20')](function(_0x17f9d7){var _0x2a9137=_0x1fe253[_0x014a('0x4a')][_0x014a('0x22')]({'plain':!![]});if(!_0x2a9137)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a9137[_0x014a('0x4c')]===_0x014a('0x4a')){var _0x63c341=_0x17f9d7[_0x014a('0x22')]({'plain':!![]});var _0x3ca7e6=_0x014a('0x23');return db[_0x014a('0x4d')][_0x014a('0x47')]({'where':{'name':_0x3ca7e6,'userProfileId':_0x2a9137[_0x014a('0x4e')]},'raw':!![]})[_0x014a('0x20')](function(_0x3aa8c4){if(_0x3aa8c4&&_0x3aa8c4[_0x014a('0x4f')]===0x0){return db['UserProfileResource'][_0x014a('0x48')]({'name':_0x63c341['name'],'resourceId':_0x63c341['id'],'type':_0x3aa8c4['name'],'sectionId':_0x3aa8c4['id']},{})['then'](function(){return _0x17f9d7;});}else{return _0x17f9d7;}})['catch'](function(_0x5a38b4){logger[_0x014a('0x25')](_0x014a('0x53'),_0x5a38b4);throw _0x5a38b4;});}return _0x17f9d7;});}})[_0x014a('0x20')](respondWithResult(_0x5b5318,0xc9))['catch'](handleError(_0x5b5318,null));};exports[_0x014a('0x1f')]=function(_0x2a5007,_0x3071c8){if(_0x2a5007[_0x014a('0x49')]['id']){delete _0x2a5007['body']['id'];}return db['Campaign'][_0x014a('0x47')]({'where':{'id':_0x2a5007[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x3071c8,null))[_0x014a('0x20')](saveUpdates(_0x2a5007[_0x014a('0x49')],null))[_0x014a('0x20')](respondWithResult(_0x3071c8,null))[_0x014a('0x43')](handleError(_0x3071c8,null));};exports[_0x014a('0x21')]=function(_0x387d12,_0x2a510c){return db[_0x014a('0x3f')]['find']({'where':{'id':_0x387d12[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x2a510c,null))['then'](removeEntity(_0x2a510c,null))[_0x014a('0x43')](handleError(_0x2a510c,null));};exports[_0x014a('0x54')]=function(_0x56f4b2,_0x14f2e2,_0x51ddea){var _0xc27657={'raw':!![],'where':{}};var _0x2382f3={};var _0xcdcbbb={'count':0x0,'rows':[]};return db[_0x014a('0x3f')][_0x014a('0x55')]({'where':{'id':_0x56f4b2['params']['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x14f2e2,null))[_0x014a('0x20')](function(_0x107e1c){if(_0x107e1c){_0x2382f3[_0x014a('0x2e')]=_[_0x014a('0x30')](db['CmHopper'][_0x014a('0x2a')]);_0x2382f3[_0x014a('0x2f')]=_[_0x014a('0x30')](_0x56f4b2['query']);_0x2382f3[_0x014a('0x3a')]=_['intersection'](_0x2382f3[_0x014a('0x2e')],_0x2382f3[_0x014a('0x2f')]);_0xc27657[_0x014a('0x32')]=_[_0x014a('0x31')](_0x2382f3[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x56f4b2[_0x014a('0x2f')]['fields']));_0xc27657['attributes']=_0xc27657[_0x014a('0x32')]['length']?_0xc27657[_0x014a('0x32')]:_0x2382f3['model'];if(!_0x56f4b2[_0x014a('0x2f')][_0x014a('0x35')]('nolimit')){_0xc27657['limit']=qs[_0x014a('0x1a')](_0x56f4b2[_0x014a('0x2f')]['limit']);_0xc27657[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x56f4b2['query']['offset']);}_0xc27657[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x56f4b2[_0x014a('0x2f')][_0x014a('0x38')]);_0xc27657[_0x014a('0x39')]=qs[_0x014a('0x3a')](_['pick'](_0x56f4b2[_0x014a('0x2f')],_0x2382f3['filters']));_0xc27657['where'][_0x014a('0x56')]=_0x107e1c['id'];if(_0x56f4b2[_0x014a('0x2f')]['filter']){_0xc27657[_0x014a('0x39')]=_[_0x014a('0x3d')](_0xc27657[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0xc27657[_0x014a('0x32')],function(_0x4906dc){var _0x11e6a8={};_0x11e6a8[_0x4906dc]={'$like':'%'+_0x56f4b2[_0x014a('0x2f')][_0x014a('0x3c')]+'%'};return _0x11e6a8;})});}_0xc27657=_[_0x014a('0x3d')]({},_0xc27657,_0x56f4b2['options']);return db[_0x014a('0x57')]['count']({'where':_0xc27657[_0x014a('0x39')]})[_0x014a('0x20')](function(_0xf0e9c7){_0xcdcbbb[_0x014a('0x18')]=_0xf0e9c7;if(_0x56f4b2[_0x014a('0x2f')][_0x014a('0x40')]){_0xc27657['include']=[{'all':!![]}];}return db[_0x014a('0x57')][_0x014a('0x58')](_0xc27657);})[_0x014a('0x20')](function(_0x1a6049){_0xcdcbbb[_0x014a('0x42')]=_0x1a6049;return _0xcdcbbb;});}})[_0x014a('0x20')](respondWithFilteredResult(_0x14f2e2,_0xc27657))[_0x014a('0x43')](handleError(_0x14f2e2,null));};exports[_0x014a('0x59')]=function(_0x55cfe7,_0x143c79,_0x37c69e){var _0x3c2a39={'raw':!![],'where':{}};var _0x5edacf={};var _0x2fbaf3={'count':0x0,'rows':[]};return db[_0x014a('0x3f')][_0x014a('0x55')]({'where':{'id':_0x55cfe7[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x143c79,null))[_0x014a('0x20')](function(_0x29b061){if(_0x29b061){_0x5edacf['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x5edacf[_0x014a('0x2f')]=_[_0x014a('0x30')](_0x55cfe7[_0x014a('0x2f')]);_0x5edacf[_0x014a('0x3a')]=_[_0x014a('0x31')](_0x5edacf[_0x014a('0x2e')],_0x5edacf[_0x014a('0x2f')]);_0x3c2a39['attributes']=_[_0x014a('0x31')](_0x5edacf[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x55cfe7[_0x014a('0x2f')]['fields']));_0x3c2a39['attributes']=_0x3c2a39[_0x014a('0x32')][_0x014a('0x34')]?_0x3c2a39['attributes']:_0x5edacf['model'];if(!_0x55cfe7[_0x014a('0x2f')]['hasOwnProperty']('nolimit')){_0x3c2a39[_0x014a('0x1a')]=qs[_0x014a('0x1a')](_0x55cfe7['query'][_0x014a('0x1a')]);_0x3c2a39[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x55cfe7[_0x014a('0x2f')][_0x014a('0x19')]);}_0x3c2a39[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x55cfe7[_0x014a('0x2f')]['sort']);_0x3c2a39['where']=qs[_0x014a('0x3a')](_['pick'](_0x55cfe7['query'],_0x5edacf['filters']));_0x3c2a39[_0x014a('0x39')][_0x014a('0x56')]=_0x29b061['id'];if(_0x55cfe7[_0x014a('0x2f')]['filter']){_0x3c2a39[_0x014a('0x39')]=_[_0x014a('0x3d')](_0x3c2a39[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0x3c2a39['attributes'],function(_0x3cccd1){var _0x3fa661={};_0x3fa661[_0x3cccd1]={'$like':'%'+_0x55cfe7[_0x014a('0x2f')]['filter']+'%'};return _0x3fa661;})});}_0x3c2a39=_[_0x014a('0x3d')]({},_0x3c2a39,_0x55cfe7[_0x014a('0x3e')]);return db['CmHopperHistory'][_0x014a('0x18')]({'where':_0x3c2a39[_0x014a('0x39')]})[_0x014a('0x20')](function(_0x4b0d03){_0x2fbaf3[_0x014a('0x18')]=_0x4b0d03;if(_0x55cfe7[_0x014a('0x2f')]['includeAll']){_0x3c2a39[_0x014a('0x41')]=[{'all':!![]}];}return db[_0x014a('0x5a')][_0x014a('0x58')](_0x3c2a39);})[_0x014a('0x20')](function(_0x3e6926){_0x2fbaf3[_0x014a('0x42')]=_0x3e6926;return _0x2fbaf3;});}})[_0x014a('0x20')](respondWithFilteredResult(_0x143c79,_0x3c2a39))[_0x014a('0x43')](handleError(_0x143c79,null));};exports['getHopperFinals']=function(_0x38917d,_0x1806d0,_0x50fa83){var _0x53d49d={'raw':!![],'where':{}};var _0x30d141={};var _0x45a093={'count':0x0,'rows':[]};return db['Campaign'][_0x014a('0x55')]({'where':{'id':_0x38917d[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x1806d0,null))['then'](function(_0x3a0012){if(_0x3a0012){_0x30d141[_0x014a('0x2e')]=_['keys'](db['CmHopperFinal'][_0x014a('0x2a')]);_0x30d141['query']=_[_0x014a('0x30')](_0x38917d['query']);_0x30d141[_0x014a('0x3a')]=_[_0x014a('0x31')](_0x30d141[_0x014a('0x2e')],_0x30d141[_0x014a('0x2f')]);_0x53d49d[_0x014a('0x32')]=_['intersection'](_0x30d141[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x38917d[_0x014a('0x2f')][_0x014a('0x33')]));_0x53d49d[_0x014a('0x32')]=_0x53d49d[_0x014a('0x32')][_0x014a('0x34')]?_0x53d49d[_0x014a('0x32')]:_0x30d141['model'];if(!_0x38917d[_0x014a('0x2f')]['hasOwnProperty'](_0x014a('0x36'))){_0x53d49d['limit']=qs['limit'](_0x38917d['query']['limit']);_0x53d49d[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x38917d[_0x014a('0x2f')][_0x014a('0x19')]);}_0x53d49d[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x38917d[_0x014a('0x2f')][_0x014a('0x38')]);_0x53d49d['where']=qs['filters'](_[_0x014a('0x3b')](_0x38917d[_0x014a('0x2f')],_0x30d141[_0x014a('0x3a')]));_0x53d49d[_0x014a('0x39')][_0x014a('0x56')]=_0x3a0012['id'];if(_0x38917d[_0x014a('0x2f')][_0x014a('0x3c')]){_0x53d49d[_0x014a('0x39')]=_['merge'](_0x53d49d[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0x53d49d[_0x014a('0x32')],function(_0x2baee6){var _0x3235b7={};_0x3235b7[_0x2baee6]={'$like':'%'+_0x38917d['query'][_0x014a('0x3c')]+'%'};return _0x3235b7;})});}_0x53d49d=_[_0x014a('0x3d')]({},_0x53d49d,_0x38917d[_0x014a('0x3e')]);return db[_0x014a('0x5b')][_0x014a('0x18')]({'where':_0x53d49d[_0x014a('0x39')]})[_0x014a('0x20')](function(_0x5ad83b){_0x45a093[_0x014a('0x18')]=_0x5ad83b;if(_0x38917d['query']['includeAll']){_0x53d49d[_0x014a('0x41')]=[{'all':!![]}];}return db[_0x014a('0x5b')]['findAll'](_0x53d49d);})[_0x014a('0x20')](function(_0x3199b9){_0x45a093[_0x014a('0x42')]=_0x3199b9;return _0x45a093;});}})['then'](respondWithFilteredResult(_0x1806d0,_0x53d49d))[_0x014a('0x43')](handleError(_0x1806d0,null));};exports[_0x014a('0x5c')]=function(_0x2feb8a,_0x336bcf,_0x2f7969){var _0x263212={'raw':!![],'where':{}};var _0x13c2b2={};var _0x327b07={'count':0x0,'rows':[]};return db[_0x014a('0x3f')]['findOne']({'where':{'id':_0x2feb8a['params']['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x336bcf,null))[_0x014a('0x20')](function(_0x1ae1ca){if(_0x1ae1ca){_0x13c2b2['model']=_[_0x014a('0x30')](db[_0x014a('0x5d')][_0x014a('0x2a')]);_0x13c2b2[_0x014a('0x2f')]=_[_0x014a('0x30')](_0x2feb8a[_0x014a('0x2f')]);_0x13c2b2['filters']=_[_0x014a('0x31')](_0x13c2b2[_0x014a('0x2e')],_0x13c2b2[_0x014a('0x2f')]);_0x263212[_0x014a('0x32')]=_['intersection'](_0x13c2b2[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x2feb8a[_0x014a('0x2f')][_0x014a('0x33')]));_0x263212[_0x014a('0x32')]=_0x263212['attributes'][_0x014a('0x34')]?_0x263212['attributes']:_0x13c2b2['model'];if(!_0x2feb8a[_0x014a('0x2f')][_0x014a('0x35')](_0x014a('0x36'))){_0x263212[_0x014a('0x1a')]=qs[_0x014a('0x1a')](_0x2feb8a[_0x014a('0x2f')][_0x014a('0x1a')]);_0x263212[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x2feb8a[_0x014a('0x2f')][_0x014a('0x19')]);}_0x263212[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x2feb8a[_0x014a('0x2f')][_0x014a('0x38')]);_0x263212[_0x014a('0x39')]=qs['filters'](_[_0x014a('0x3b')](_0x2feb8a[_0x014a('0x2f')],_0x13c2b2[_0x014a('0x3a')]));_0x263212['where'][_0x014a('0x56')]=_0x1ae1ca['id'];if(_0x2feb8a[_0x014a('0x2f')][_0x014a('0x3c')]){_0x263212[_0x014a('0x39')]=_[_0x014a('0x3d')](_0x263212[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0x263212[_0x014a('0x32')],function(_0x10af67){var _0x480639={};_0x480639[_0x10af67]={'$like':'%'+_0x2feb8a[_0x014a('0x2f')][_0x014a('0x3c')]+'%'};return _0x480639;})});}_0x263212=_[_0x014a('0x3d')]({},_0x263212,_0x2feb8a[_0x014a('0x3e')]);return db['CmHopperBlack'][_0x014a('0x18')]({'where':_0x263212['where']})['then'](function(_0x2e478d){_0x327b07['count']=_0x2e478d;if(_0x2feb8a[_0x014a('0x2f')][_0x014a('0x40')]){_0x263212['include']=[{'all':!![]}];}return db[_0x014a('0x5d')]['findAll'](_0x263212);})[_0x014a('0x20')](function(_0x8cc35d){_0x327b07['rows']=_0x8cc35d;return _0x327b07;});}})[_0x014a('0x20')](respondWithFilteredResult(_0x336bcf,_0x263212))[_0x014a('0x43')](handleError(_0x336bcf,null));};exports['getLists']=function(_0x3d764e,_0x3f5c3e,_0xf748a7){var _0x383c07={};var _0xa2d860={};var _0xe57bf1;var _0x78c76b;return db[_0x014a('0x3f')][_0x014a('0x55')]({'where':{'id':_0x3d764e[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x3f5c3e,null))[_0x014a('0x20')](function(_0x4e0c1a){if(_0x4e0c1a){_0xe57bf1=_0x4e0c1a;_0xa2d860[_0x014a('0x2e')]=_[_0x014a('0x30')](db[_0x014a('0x5e')][_0x014a('0x2a')]);_0xa2d860[_0x014a('0x2f')]=_[_0x014a('0x30')](_0x3d764e[_0x014a('0x2f')]);_0xa2d860[_0x014a('0x3a')]=_['intersection'](_0xa2d860[_0x014a('0x2e')],_0xa2d860[_0x014a('0x2f')]);_0x383c07[_0x014a('0x32')]=_[_0x014a('0x31')](_0xa2d860[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x3d764e['query'][_0x014a('0x33')]));_0x383c07[_0x014a('0x32')]=_0x383c07[_0x014a('0x32')]['length']?_0x383c07['attributes']:_0xa2d860[_0x014a('0x2e')];_0x383c07[_0x014a('0x37')]=qs[_0x014a('0x38')](_0x3d764e[_0x014a('0x2f')][_0x014a('0x38')]);_0x383c07['where']=qs[_0x014a('0x3a')](_[_0x014a('0x3b')](_0x3d764e[_0x014a('0x2f')],_0xa2d860[_0x014a('0x3a')]));if(_0x3d764e[_0x014a('0x2f')][_0x014a('0x3c')]){_0x383c07['where']=_[_0x014a('0x3d')](_0x383c07['where'],{'$or':_[_0x014a('0x29')](_0x383c07['attributes'],function(_0x57d852){var _0x581c3a={};_0x581c3a[_0x57d852]={'$like':'%'+_0x3d764e[_0x014a('0x2f')]['filter']+'%'};return _0x581c3a;})});}_0x383c07=_[_0x014a('0x3d')]({},_0x383c07,_0x3d764e['options']);return _0xe57bf1[_0x014a('0x5f')](_0x383c07);}})[_0x014a('0x20')](function(_0x37984f){if(_0x37984f){_0x78c76b=_0x37984f['length'];if(!_0x3d764e[_0x014a('0x2f')]['hasOwnProperty'](_0x014a('0x36'))){_0x383c07[_0x014a('0x1a')]=qs[_0x014a('0x1a')](_0x3d764e['query']['limit']);_0x383c07[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x3d764e[_0x014a('0x2f')][_0x014a('0x19')]);}return _0xe57bf1[_0x014a('0x5f')](_0x383c07);}})[_0x014a('0x20')](function(_0x46f652){if(_0x46f652){return _0x46f652?{'count':_0x78c76b,'rows':_0x46f652}:null;}})[_0x014a('0x20')](respondWithResult(_0x3f5c3e,null))[_0x014a('0x43')](handleError(_0x3f5c3e,null));};exports[_0x014a('0x60')]=function(_0x2a10bb,_0x457385,_0x3c9de9){var _0x4adbd2,_0x55a4bb;return db[_0x014a('0x3f')][_0x014a('0x47')]({'where':{'id':_0x2a10bb['params']['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x457385,null))[_0x014a('0x20')](function(_0x4e50b7){if(_0x4e50b7){_0x55a4bb=_0x4e50b7;return _0x4e50b7['addLists'](_0x2a10bb[_0x014a('0x49')][_0x014a('0x61')],_['omit'](_0x2a10bb[_0x014a('0x49')],['ids','id'])||{});}return null;})[_0x014a('0x62')](function(_0x2aa2c4){var _0x2aec2f;_0x4adbd2=_0x2aa2c4||[];var _0x41bb8f=[];if(_0x2aa2c4){for(var _0x5a3c54=0x0;_0x5a3c54<_0x2aa2c4['length'];_0x5a3c54+=0x1){var _0x5db9d1=_0x2aa2c4[_0x5a3c54]['get']({'plain':!![]});_0x55a4bb[_0x014a('0x63')]=_0x2a10bb[_0x014a('0x49')][_0x014a('0x63')]?_0x2a10bb[_0x014a('0x49')][_0x014a('0x63')]:_0x55a4bb[_0x014a('0x63')];switch(_0x55a4bb[_0x014a('0x63')]){case _0x014a('0x64'):_0x2aec2f=squel[_0x014a('0x65')]()[_0x014a('0x66')](_0x014a('0x67'))['fromQuery'](['phone','scheduledAt',_0x014a('0x68'),_0x014a('0x69'),'CampaignId',_0x014a('0x50'),_0x014a('0x52')],squel[_0x014a('0x6a')]()[_0x014a('0x6b')]('phone',_0x014a('0x6c'))[_0x014a('0x6b')]('NOW()',_0x014a('0x6d'))[_0x014a('0x6b')]('id','ContactId')[_0x014a('0x6b')](_0x5db9d1[_0x014a('0x6e')][_0x014a('0x6f')](),_0x014a('0x69'))[_0x014a('0x6b')](_0x2a10bb[_0x014a('0x45')]['id'][_0x014a('0x6f')](),_0x014a('0x56'))['field'](_0x014a('0x70'),_0x014a('0x50'))[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x52'))[_0x014a('0x71')](_0x014a('0x72'))[_0x014a('0x39')](_0x014a('0x73'))['where'](_0x014a('0x74'),_0x5db9d1['CmListId'][_0x014a('0x6f')]())[_0x014a('0x39')](_0x014a('0x75'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x014a('0x6a')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x014a('0x76'))[_0x014a('0x39')](_0x014a('0x77'),_0x2a10bb['params']['id'][_0x014a('0x6f')]()))[_0x014a('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x014a('0x6a')]()[_0x014a('0x6b')](_0x014a('0x78'))['from']('cm_hopper')[_0x014a('0x39')](_0x014a('0x77'),_0x2a10bb[_0x014a('0x45')]['id'][_0x014a('0x6f')]())))[_0x014a('0x6f')]();break;case _0x014a('0x79'):_0x2aec2f=squel['insert']()['into']('cm_hopper')[_0x014a('0x7a')]([_0x014a('0x6c'),_0x014a('0x6d'),'ContactId',_0x014a('0x69'),_0x014a('0x56'),_0x014a('0x50'),'updatedAt'],squel[_0x014a('0x6a')]()[_0x014a('0x6b')](_0x014a('0x6c'),_0x014a('0x6c'))['field'](_0x014a('0x70'),'scheduledAt')[_0x014a('0x6b')]('id',_0x014a('0x68'))[_0x014a('0x6b')](_0x5db9d1['CmListId'][_0x014a('0x6f')](),_0x014a('0x69'))[_0x014a('0x6b')](_0x2a10bb[_0x014a('0x45')]['id'][_0x014a('0x6f')](),'CampaignId')[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x50'))[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x52'))['from'](_0x014a('0x72'))[_0x014a('0x39')]('deletedAt\x20IS\x20NULL')[_0x014a('0x39')]('ListId\x20=\x20?',_0x5db9d1[_0x014a('0x6e')]['toString']())[_0x014a('0x39')](_0x014a('0x75'))[_0x014a('0x39')](_0x014a('0x7b'),squel[_0x014a('0x6a')]()[_0x014a('0x6b')](_0x014a('0x78'))['from']('cm_hopper')[_0x014a('0x39')](_0x014a('0x77'),_0x2a10bb['params']['id'][_0x014a('0x6f')]())))[_0x014a('0x6f')]();break;default:_0x2aec2f=squel[_0x014a('0x65')]()[_0x014a('0x66')](_0x014a('0x67'))['fromQuery']([_0x014a('0x6c'),_0x014a('0x6d'),_0x014a('0x68'),_0x014a('0x69'),'CampaignId',_0x014a('0x50'),'updatedAt'],squel[_0x014a('0x6a')]()[_0x014a('0x6b')](_0x014a('0x6c'),_0x014a('0x6c'))[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x6d'))['field']('id',_0x014a('0x68'))[_0x014a('0x6b')](_0x5db9d1[_0x014a('0x6e')][_0x014a('0x6f')](),'ListId')['field'](_0x2a10bb[_0x014a('0x45')]['id'][_0x014a('0x6f')](),'CampaignId')[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x50'))[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x52'))[_0x014a('0x71')](_0x014a('0x72'))[_0x014a('0x39')]('deletedAt\x20IS\x20NULL')[_0x014a('0x39')]('ListId\x20=\x20?',_0x5db9d1[_0x014a('0x6e')][_0x014a('0x6f')]())['where'](_0x014a('0x75')))[_0x014a('0x6f')]();}_0x41bb8f[_0x014a('0x7c')](db[_0x014a('0x7d')][_0x014a('0x2f')](_0x2aec2f));}return BPromise['all'](_0x41bb8f);}})[_0x014a('0x20')](function(){return _0x4adbd2;})[_0x014a('0x20')](respondWithResult(_0x457385,null))[_0x014a('0x43')](handleError(_0x457385,null));};exports[_0x014a('0x7e')]=function(_0x3f3c9b,_0x42cf5e,_0x2e1ad7){return db[_0x014a('0x3f')]['find']({'where':{'id':_0x3f3c9b[_0x014a('0x45')]['id']}})['then'](handleEntityNotFound(_0x42cf5e,null))[_0x014a('0x20')](function(_0x3fd77a){if(_0x3fd77a){return _0x3fd77a[_0x014a('0x7e')](_0x3f3c9b[_0x014a('0x2f')][_0x014a('0x61')]);}})[_0x014a('0x20')](function(_0x539403){if(_0x539403){return db[_0x014a('0x57')]['destroy']({'where':{'ListId':_0x3f3c9b[_0x014a('0x2f')][_0x014a('0x61')],'CampaignId':_0x3f3c9b[_0x014a('0x45')]['id']}})[_0x014a('0x20')](function(){return _0x539403;});}})[_0x014a('0x20')](respondWithStatusCode(_0x42cf5e,null))[_0x014a('0x43')](handleError(_0x42cf5e,null));};exports[_0x014a('0x7f')]=function(_0x2f58cb,_0x4e4027,_0x4b90c1){var _0xac886c={'raw':!![],'where':{}};var _0xb7c438={};var _0x41cbaf={'count':0x0,'rows':[]};return db[_0x014a('0x3f')][_0x014a('0x55')]({'where':{'id':_0x2f58cb[_0x014a('0x45')]['id']}})[_0x014a('0x20')](handleEntityNotFound(_0x4e4027,null))[_0x014a('0x20')](function(_0x24eac1){if(_0x24eac1){_0xb7c438[_0x014a('0x2e')]=_[_0x014a('0x30')](db[_0x014a('0x5e')][_0x014a('0x2a')]);_0xb7c438['query']=_[_0x014a('0x30')](_0x2f58cb[_0x014a('0x2f')]);_0xb7c438[_0x014a('0x3a')]=_['intersection'](_0xb7c438[_0x014a('0x2e')],_0xb7c438[_0x014a('0x2f')]);_0xac886c[_0x014a('0x32')]=_[_0x014a('0x31')](_0xb7c438[_0x014a('0x2e')],qs[_0x014a('0x33')](_0x2f58cb[_0x014a('0x2f')][_0x014a('0x33')]));_0xac886c[_0x014a('0x32')]=_0xac886c[_0x014a('0x32')][_0x014a('0x34')]?_0xac886c[_0x014a('0x32')]:_0xb7c438['model'];if(!_0x2f58cb['query'][_0x014a('0x35')](_0x014a('0x36'))){_0xac886c['limit']=qs[_0x014a('0x1a')](_0x2f58cb[_0x014a('0x2f')][_0x014a('0x1a')]);_0xac886c[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x2f58cb[_0x014a('0x2f')][_0x014a('0x19')]);}_0xac886c[_0x014a('0x37')]=qs['sort'](_0x2f58cb[_0x014a('0x2f')][_0x014a('0x38')]);_0xac886c[_0x014a('0x39')]=qs[_0x014a('0x3a')](_['pick'](_0x2f58cb[_0x014a('0x2f')],_0xb7c438[_0x014a('0x3a')]));_0xac886c[_0x014a('0x39')]['CampaignId']=_0x24eac1['id'];if(_0x2f58cb[_0x014a('0x2f')][_0x014a('0x3c')]){_0xac886c['where']=_[_0x014a('0x3d')](_0xac886c[_0x014a('0x39')],{'$or':_[_0x014a('0x29')](_0xac886c['attributes'],function(_0x359dd4){var _0x313316={};_0x313316[_0x359dd4]={'$like':'%'+_0x2f58cb[_0x014a('0x2f')]['filter']+'%'};return _0x313316;})});}_0xac886c=_[_0x014a('0x3d')]({},_0xac886c,_0x2f58cb['options']);return db[_0x014a('0x5e')]['count']({'where':_0xac886c[_0x014a('0x39')]})[_0x014a('0x20')](function(_0x4bc936){_0x41cbaf[_0x014a('0x18')]=_0x4bc936;if(_0x2f58cb['query'][_0x014a('0x40')]){_0xac886c[_0x014a('0x41')]=[{'all':!![]}];}return db[_0x014a('0x5e')][_0x014a('0x58')](_0xac886c);})[_0x014a('0x20')](function(_0x4c6e54){_0x41cbaf[_0x014a('0x42')]=_0x4c6e54;return _0x41cbaf;});}})[_0x014a('0x20')](respondWithFilteredResult(_0x4e4027,_0xac886c))[_0x014a('0x43')](handleError(_0x4e4027,null));};exports['addBlackLists']=function(_0x189322,_0x43858b,_0x50ee6c){var _0x565da5,_0x309858;return db[_0x014a('0x3f')]['find']({'where':{'id':_0x189322[_0x014a('0x45')]['id']}})['then'](handleEntityNotFound(_0x43858b,null))['then'](function(_0x3209c6){if(_0x3209c6){_0x309858=_0x3209c6;return _0x3209c6[_0x014a('0x80')](_0x189322['body']['ids'],_['omit'](_0x189322[_0x014a('0x49')],[_0x014a('0x61'),'id'])||{});}return null;})[_0x014a('0x62')](function(_0x55147d){var _0x4e21e1;_0x565da5=_0x55147d||[];var _0x36b047=[];if(_0x55147d){for(var _0x511ef1=0x0;_0x511ef1<_0x55147d[_0x014a('0x34')];_0x511ef1+=0x1){var _0x26fb1e=_0x55147d[_0x511ef1]['get']({'plain':!![]});_0x4e21e1=squel['insert']()[_0x014a('0x66')](_0x014a('0x81'))['fromQuery']([_0x014a('0x6c'),'ContactId',_0x014a('0x69'),'CampaignId',_0x014a('0x50'),_0x014a('0x52')],squel[_0x014a('0x6a')]()[_0x014a('0x6b')](_0x014a('0x6c'),_0x014a('0x6c'))[_0x014a('0x6b')]('id',_0x014a('0x68'))['field'](_0x26fb1e[_0x014a('0x6e')][_0x014a('0x6f')](),_0x014a('0x69'))[_0x014a('0x6b')](_0x189322[_0x014a('0x45')]['id'][_0x014a('0x6f')](),_0x014a('0x56'))[_0x014a('0x6b')]('NOW()',_0x014a('0x50'))[_0x014a('0x6b')](_0x014a('0x70'),_0x014a('0x52'))[_0x014a('0x71')](_0x014a('0x72'))[_0x014a('0x39')](_0x014a('0x73'))[_0x014a('0x39')](_0x014a('0x74'),_0x26fb1e[_0x014a('0x6e')]['toString']())[_0x014a('0x39')](_0x014a('0x75')))[_0x014a('0x6f')]();_0x36b047[_0x014a('0x7c')](db[_0x014a('0x7d')][_0x014a('0x2f')](_0x4e21e1));}return BPromise[_0x014a('0x82')](_0x36b047);}})['then'](function(){return _0x565da5;})['then'](respondWithResult(_0x43858b,null))[_0x014a('0x43')](handleError(_0x43858b,null));};exports[_0x014a('0x83')]=function(_0x288bb5,_0x23d38e,_0x296366){return db['Campaign'][_0x014a('0x47')]({'where':{'id':_0x288bb5[_0x014a('0x45')]['id']}})['then'](handleEntityNotFound(_0x23d38e,null))[_0x014a('0x20')](function(_0x766c75){if(_0x766c75){return _0x766c75[_0x014a('0x83')](_0x288bb5['query'][_0x014a('0x61')]);}})[_0x014a('0x20')](function(_0x15ed5f){if(_0x15ed5f){return db['CmHopperBlack'][_0x014a('0x21')]({'where':{'ListId':_0x288bb5[_0x014a('0x2f')]['ids'],'CampaignId':_0x288bb5[_0x014a('0x45')]['id']}})[_0x014a('0x20')](function(){return _0x15ed5f;});}})[_0x014a('0x20')](respondWithStatusCode(_0x23d38e,null))['catch'](handleError(_0x23d38e,null));}; \ No newline at end of file +var _0x6343=['rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','rows','params','filtears','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','userProfileId','autoAssociation','error','update','getHoppers','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','order','getLists','CmList','addLists','ids','omit','spread','dialCheckDuplicateType','always','insert','into','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','fromQuery','cm_contacts','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','apply','save','then','destroy','IvrCampaigns','UserProfileResource','name','send','index','map','Campaign'];(function(_0xc40e1c,_0x287bf5){var _0x3e368f=function(_0x5b64d2){while(--_0x5b64d2){_0xc40e1c['push'](_0xc40e1c['shift']());}};_0x3e368f(++_0x287bf5);}(_0x6343,0x168));var _0x3634=function(_0x3d1e1e,_0x1b60ee){_0x3d1e1e=_0x3d1e1e-0x0;var _0xed720e=_0x6343[_0x3d1e1e];return _0xed720e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3634('0x0'));var zipdir=require(_0x3634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3634('0x2'));var util=require(_0x3634('0x3'));var path=require('path');var sox=require(_0x3634('0x4'));var csv=require(_0x3634('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x5'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=_0x69609d['count'],_0x2fc628=_0x48787f[_0x3634('0x16')],_0x78f93f=_0x48787f['offset']+_0x48787f['limit'],_0x91061e;if(_0x78f93f>=_0x18285c){_0x78f93f=_0x18285c;_0x91061e=0xc8;}else{_0x91061e=0xce;}_0x167247[_0x3634('0x14')](_0x91061e);return _0x167247['set'](_0x3634('0x17'),_0x2fc628+'-'+_0x78f93f+'/'+_0x18285c)[_0x3634('0x18')](_0x69609d);}return null;};}function patchUpdates(_0x1e4f1d){return function(_0x5603d2){try{jsonpatch[_0x3634('0x19')](_0x5603d2,_0x1e4f1d,!![]);}catch(_0x4366bc){return BPromise['reject'](_0x4366bc);}return _0x5603d2[_0x3634('0x1a')]();};}function saveUpdates(_0x506281,_0x742e56){return function(_0x2fa200){if(_0x2fa200){return _0x2fa200['update'](_0x506281)[_0x3634('0x1b')](function(_0x3df472){return _0x3df472;});}return null;};}function removeEntity(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1c')]()['then'](function(){var _0x3936ee=_0x22b7ef['get']({'plain':!![]});var _0x5e9188=_0x3634('0x1d');return db[_0x3634('0x1e')]['destroy']({'where':{'type':_0x5e9188,'resourceId':_0x3936ee['id']}})[_0x3634('0x1b')](function(){return _0x22b7ef;});})[_0x3634('0x1b')](function(){_0x206c8e[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x363ca2,_0x12bca9){return function(_0x38e863){if(!_0x38e863){_0x363ca2[_0x3634('0x13')](0x194);}return _0x38e863;};}function handleError(_0x22f1f1,_0x52e9ae){_0x52e9ae=_0x52e9ae||0x1f4;return function(_0x1b0a44){logger['error'](_0x1b0a44['stack']);if(_0x1b0a44['name']){delete _0x1b0a44[_0x3634('0x1f')];}_0x22f1f1['status'](_0x52e9ae)[_0x3634('0x20')](_0x1b0a44);};}exports[_0x3634('0x21')]=function(_0x49804f,_0x55a77f){var _0x282f73={},_0x5bd4e0={},_0x281504={'count':0x0,'rows':[]};var _0x5d273c=_[_0x3634('0x22')](db[_0x3634('0x23')][_0x3634('0x24')],function(_0x17a0fd){return{'name':_0x17a0fd[_0x3634('0x25')],'type':_0x17a0fd[_0x3634('0x26')][_0x3634('0x27')]};});_0x5bd4e0[_0x3634('0x28')]=_['map'](_0x5d273c,'name');_0x5bd4e0['query']=_[_0x3634('0x29')](_0x49804f['query']);_0x5bd4e0[_0x3634('0x2a')]=_[_0x3634('0x2b')](_0x5bd4e0[_0x3634('0x28')],_0x5bd4e0[_0x3634('0x2c')]);_0x282f73[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0x5bd4e0['model'],qs[_0x3634('0x2e')](_0x49804f[_0x3634('0x2c')][_0x3634('0x2e')]));_0x282f73[_0x3634('0x2d')]=_0x282f73[_0x3634('0x2d')][_0x3634('0x2f')]?_0x282f73[_0x3634('0x2d')]:_0x5bd4e0[_0x3634('0x28')];if(!_0x49804f[_0x3634('0x2c')]['hasOwnProperty'](_0x3634('0x30'))){_0x282f73[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x49804f[_0x3634('0x2c')]['limit']);_0x282f73[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x49804f[_0x3634('0x2c')]['offset']);}_0x282f73['order']=qs['sort'](_0x49804f[_0x3634('0x2c')][_0x3634('0x32')]);_0x282f73['where']=qs[_0x3634('0x2a')](_[_0x3634('0x33')](_0x49804f[_0x3634('0x2c')],_0x5bd4e0[_0x3634('0x2a')]),_0x5d273c);if(_0x49804f[_0x3634('0x2c')][_0x3634('0x34')]){_0x282f73[_0x3634('0x35')]=_['merge'](_0x282f73[_0x3634('0x35')],{'$or':_['map'](_0x5d273c,function(_0x35b71e){if(_0x35b71e[_0x3634('0x26')]!==_0x3634('0x36')){var _0x1343f0={};_0x1343f0[_0x35b71e[_0x3634('0x1f')]]={'$like':'%'+_0x49804f['query'][_0x3634('0x34')]+'%'};return _0x1343f0;}})});}_0x282f73=_[_0x3634('0x37')]({},_0x282f73,_0x49804f[_0x3634('0x38')]);var _0x242a6c={'where':_0x282f73[_0x3634('0x35')]};return db[_0x3634('0x23')][_0x3634('0x39')](_0x242a6c)[_0x3634('0x1b')](function(_0x16b43d){_0x281504['count']=_0x16b43d;if(_0x49804f['query'][_0x3634('0x3a')]){_0x282f73['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x282f73);})[_0x3634('0x1b')](function(_0x4d06f9){_0x281504[_0x3634('0x3b')]=_0x4d06f9;return _0x281504;})[_0x3634('0x1b')](respondWithFilteredResult(_0x55a77f,_0x282f73))['catch'](handleError(_0x55a77f,null));};exports['show']=function(_0x4896ab,_0x324970){var _0x334223={'raw':![],'where':{'id':_0x4896ab[_0x3634('0x3c')]['id']}},_0x5b1dad={};_0x5b1dad[_0x3634('0x28')]=_[_0x3634('0x29')](db[_0x3634('0x23')][_0x3634('0x24')]);_0x5b1dad['query']=_['keys'](_0x4896ab[_0x3634('0x2c')]);_0x5b1dad[_0x3634('0x3d')]=_[_0x3634('0x2b')](_0x5b1dad[_0x3634('0x28')],_0x5b1dad[_0x3634('0x2c')]);_0x334223[_0x3634('0x2d')]=_['intersection'](_0x5b1dad[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x4896ab[_0x3634('0x2c')]['fields']));_0x334223['attributes']=_0x334223[_0x3634('0x2d')][_0x3634('0x2f')]?_0x334223[_0x3634('0x2d')]:_0x5b1dad[_0x3634('0x28')];if(_0x4896ab[_0x3634('0x2c')][_0x3634('0x3a')]){_0x334223[_0x3634('0x3e')]=[{'all':!![]}];}_0x334223=_[_0x3634('0x37')]({},_0x334223,_0x4896ab['options']);return db[_0x3634('0x23')][_0x3634('0x3f')](_0x334223)[_0x3634('0x1b')](handleEntityNotFound(_0x324970,null))[_0x3634('0x1b')](respondWithResult(_0x324970,null))[_0x3634('0x40')](handleError(_0x324970,null));};exports[_0x3634('0x41')]=function(_0x10e5e4,_0x326b61){return db[_0x3634('0x23')]['create'](_0x10e5e4[_0x3634('0x42')],{})[_0x3634('0x1b')](function(_0x4a4a94){var _0x3c356b=_0x10e5e4[_0x3634('0x43')][_0x3634('0x44')]({'plain':!![]});if(!_0x3c356b)throw new Error(_0x3634('0x45'));if(_0x3c356b[_0x3634('0x46')]===_0x3634('0x43')){var _0x5cc8d1=_0x4a4a94[_0x3634('0x44')]({'plain':!![]});var _0x2356a9=_0x3634('0x1d');return db[_0x3634('0x47')][_0x3634('0x3f')]({'where':{'name':_0x2356a9,'userProfileId':_0x3c356b['userProfileId']},'raw':!![]})[_0x3634('0x1b')](function(_0x20f9f8){if(_0x20f9f8&&_0x20f9f8['autoAssociation']===0x0){return db['UserProfileResource'][_0x3634('0x41')]({'name':_0x5cc8d1['name'],'resourceId':_0x5cc8d1['id'],'type':_0x20f9f8[_0x3634('0x1f')],'sectionId':_0x20f9f8['id']},{})[_0x3634('0x1b')](function(){return _0x4a4a94;});}else{return _0x4a4a94;}})[_0x3634('0x40')](function(_0x1834a3){logger['error'](_0x3634('0x48'),_0x1834a3);throw _0x1834a3;});}return _0x4a4a94;})[_0x3634('0x1b')](respondWithResult(_0x326b61,0xc9))[_0x3634('0x40')](handleError(_0x326b61,null));};exports[_0x3634('0x49')]=function(_0x1ac9a9,_0x38473b){var _0xe3b65={'where':{'id':_0x1ac9a9[_0x3634('0x3c')]['id']}},_0xc83a28={};_0xc83a28[_0x3634('0x28')]=_[_0x3634('0x29')](db[_0x3634('0x23')]['rawAttributes']);_0xe3b65[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0xc83a28[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x1ac9a9[_0x3634('0x2c')][_0x3634('0x2e')]));_0xe3b65[_0x3634('0x2d')]=_0xe3b65[_0x3634('0x2d')][_0x3634('0x2f')]?_0xe3b65['attributes']:_0xc83a28[_0x3634('0x28')];if(_0x1ac9a9[_0x3634('0x2c')]['includeAll']){_0xe3b65[_0x3634('0x3e')]=[{'all':!![]}];}_0xe3b65=_[_0x3634('0x37')]({},_0xe3b65,_0x1ac9a9['options']);return db[_0x3634('0x23')][_0x3634('0x3f')](_0xe3b65)[_0x3634('0x1b')](handleEntityNotFound(_0x38473b,null))['then'](function(_0x2c16fa){if(_0x2c16fa){var _0x53da29=_0x2c16fa[_0x3634('0x44')]({'plain':!![]});_0x53da29=qs['omit'](_0x53da29,['id',_0x3634('0x4a'),_0x3634('0x4b')]);_0x1ac9a9[_0x3634('0x42')]=_['omit'](_0x1ac9a9[_0x3634('0x42')],['id',_0x3634('0x4a'),'updatedAt']);return db[_0x3634('0x23')][_0x3634('0x41')](_[_0x3634('0x37')](_0x53da29,_0x1ac9a9[_0x3634('0x42')]),{'include':_0x1ac9a9['query'][_0x3634('0x3a')]?[{'all':!![]}]:undefined})[_0x3634('0x1b')](function(_0x55fb3d){var _0x5b8db4=_0x1ac9a9['user'][_0x3634('0x44')]({'plain':!![]});if(!_0x5b8db4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b8db4[_0x3634('0x46')]===_0x3634('0x43')){var _0x185b18=_0x55fb3d['get']({'plain':!![]});var _0x1445a4=_0x3634('0x1d');return db['UserProfileSection'][_0x3634('0x3f')]({'where':{'name':_0x1445a4,'userProfileId':_0x5b8db4[_0x3634('0x4c')]},'raw':!![]})[_0x3634('0x1b')](function(_0x5a9808){if(_0x5a9808&&_0x5a9808[_0x3634('0x4d')]===0x0){return db[_0x3634('0x1e')][_0x3634('0x41')]({'name':_0x185b18[_0x3634('0x1f')],'resourceId':_0x185b18['id'],'type':_0x5a9808[_0x3634('0x1f')],'sectionId':_0x5a9808['id']},{})['then'](function(){return _0x55fb3d;});}else{return _0x55fb3d;}})[_0x3634('0x40')](function(_0x294703){logger[_0x3634('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x294703);throw _0x294703;});}return _0x55fb3d;});}})[_0x3634('0x1b')](respondWithResult(_0x38473b,0xc9))['catch'](handleError(_0x38473b,null));};exports[_0x3634('0x4f')]=function(_0x12ee97,_0x5c590b){if(_0x12ee97[_0x3634('0x42')]['id']){delete _0x12ee97[_0x3634('0x42')]['id'];}return db[_0x3634('0x23')]['find']({'where':{'id':_0x12ee97[_0x3634('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5c590b,null))['then'](saveUpdates(_0x12ee97[_0x3634('0x42')],null))['then'](respondWithResult(_0x5c590b,null))[_0x3634('0x40')](handleError(_0x5c590b,null));};exports[_0x3634('0x1c')]=function(_0x1761d4,_0x88ae3b){return db['Campaign'][_0x3634('0x3f')]({'where':{'id':_0x1761d4[_0x3634('0x3c')]['id']}})['then'](handleEntityNotFound(_0x88ae3b,null))[_0x3634('0x1b')](removeEntity(_0x88ae3b,null))['catch'](handleError(_0x88ae3b,null));};exports[_0x3634('0x50')]=function(_0x4eff8f,_0x48ae86,_0x11c4cc){var _0x9a3947={'raw':!![],'where':{}};var _0x10b783={};var _0x55f9dc={'count':0x0,'rows':[]};return db[_0x3634('0x23')]['findOne']({'where':{'id':_0x4eff8f[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x48ae86,null))[_0x3634('0x1b')](function(_0x10ad0a){if(_0x10ad0a){_0x10b783[_0x3634('0x28')]=_[_0x3634('0x29')](db[_0x3634('0x51')][_0x3634('0x24')]);_0x10b783[_0x3634('0x2c')]=_[_0x3634('0x29')](_0x4eff8f[_0x3634('0x2c')]);_0x10b783['filters']=_['intersection'](_0x10b783[_0x3634('0x28')],_0x10b783['query']);_0x9a3947[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0x10b783[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x4eff8f[_0x3634('0x2c')]['fields']));_0x9a3947[_0x3634('0x2d')]=_0x9a3947[_0x3634('0x2d')][_0x3634('0x2f')]?_0x9a3947[_0x3634('0x2d')]:_0x10b783[_0x3634('0x28')];if(!_0x4eff8f['query'][_0x3634('0x52')](_0x3634('0x30'))){_0x9a3947[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x4eff8f['query']['limit']);_0x9a3947[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x4eff8f[_0x3634('0x2c')][_0x3634('0x16')]);}_0x9a3947['order']=qs[_0x3634('0x32')](_0x4eff8f['query'][_0x3634('0x32')]);_0x9a3947['where']=qs[_0x3634('0x2a')](_[_0x3634('0x33')](_0x4eff8f[_0x3634('0x2c')],_0x10b783[_0x3634('0x2a')]));_0x9a3947[_0x3634('0x35')][_0x3634('0x53')]=_0x10ad0a['id'];if(_0x4eff8f['query'][_0x3634('0x34')]){_0x9a3947['where']=_[_0x3634('0x37')](_0x9a3947[_0x3634('0x35')],{'$or':_[_0x3634('0x22')](_0x9a3947[_0x3634('0x2d')],function(_0x38f3ee){var _0xd522c2={};_0xd522c2[_0x38f3ee]={'$like':'%'+_0x4eff8f[_0x3634('0x2c')][_0x3634('0x34')]+'%'};return _0xd522c2;})});}_0x9a3947=_[_0x3634('0x37')]({},_0x9a3947,_0x4eff8f['options']);return db[_0x3634('0x51')][_0x3634('0x39')]({'where':_0x9a3947[_0x3634('0x35')]})[_0x3634('0x1b')](function(_0x402fb9){_0x55f9dc[_0x3634('0x39')]=_0x402fb9;if(_0x4eff8f[_0x3634('0x2c')][_0x3634('0x3a')]){_0x9a3947[_0x3634('0x3e')]=[{'all':!![]}];}return db[_0x3634('0x51')]['findAll'](_0x9a3947);})[_0x3634('0x1b')](function(_0x3cc256){_0x55f9dc['rows']=_0x3cc256;return _0x55f9dc;});}})['then'](respondWithFilteredResult(_0x48ae86,_0x9a3947))[_0x3634('0x40')](handleError(_0x48ae86,null));};exports[_0x3634('0x54')]=function(_0x32373b,_0x30f7ca,_0x47e9f8){var _0x448db1={'raw':!![],'where':{}};var _0x97c448={};var _0x5bacd9={'count':0x0,'rows':[]};return db[_0x3634('0x23')][_0x3634('0x55')]({'where':{'id':_0x32373b['params']['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x30f7ca,null))[_0x3634('0x1b')](function(_0x4e167a){if(_0x4e167a){_0x97c448[_0x3634('0x28')]=_[_0x3634('0x29')](db['CmHopperHistory'][_0x3634('0x24')]);_0x97c448[_0x3634('0x2c')]=_[_0x3634('0x29')](_0x32373b['query']);_0x97c448['filters']=_['intersection'](_0x97c448[_0x3634('0x28')],_0x97c448[_0x3634('0x2c')]);_0x448db1[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0x97c448['model'],qs['fields'](_0x32373b[_0x3634('0x2c')][_0x3634('0x2e')]));_0x448db1[_0x3634('0x2d')]=_0x448db1[_0x3634('0x2d')][_0x3634('0x2f')]?_0x448db1[_0x3634('0x2d')]:_0x97c448[_0x3634('0x28')];if(!_0x32373b[_0x3634('0x2c')]['hasOwnProperty'](_0x3634('0x30'))){_0x448db1[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x32373b['query'][_0x3634('0x31')]);_0x448db1[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x32373b['query'][_0x3634('0x16')]);}_0x448db1['order']=qs[_0x3634('0x32')](_0x32373b['query'][_0x3634('0x32')]);_0x448db1[_0x3634('0x35')]=qs[_0x3634('0x2a')](_[_0x3634('0x33')](_0x32373b[_0x3634('0x2c')],_0x97c448[_0x3634('0x2a')]));_0x448db1[_0x3634('0x35')][_0x3634('0x53')]=_0x4e167a['id'];if(_0x32373b[_0x3634('0x2c')][_0x3634('0x34')]){_0x448db1['where']=_[_0x3634('0x37')](_0x448db1[_0x3634('0x35')],{'$or':_[_0x3634('0x22')](_0x448db1[_0x3634('0x2d')],function(_0x3c2b97){var _0x25fe79={};_0x25fe79[_0x3c2b97]={'$like':'%'+_0x32373b[_0x3634('0x2c')][_0x3634('0x34')]+'%'};return _0x25fe79;})});}_0x448db1=_[_0x3634('0x37')]({},_0x448db1,_0x32373b[_0x3634('0x38')]);return db[_0x3634('0x56')][_0x3634('0x39')]({'where':_0x448db1[_0x3634('0x35')]})[_0x3634('0x1b')](function(_0xba3b91){_0x5bacd9[_0x3634('0x39')]=_0xba3b91;if(_0x32373b[_0x3634('0x2c')][_0x3634('0x3a')]){_0x448db1[_0x3634('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x448db1);})[_0x3634('0x1b')](function(_0x23704c){_0x5bacd9['rows']=_0x23704c;return _0x5bacd9;});}})[_0x3634('0x1b')](respondWithFilteredResult(_0x30f7ca,_0x448db1))[_0x3634('0x40')](handleError(_0x30f7ca,null));};exports['getHopperFinals']=function(_0x1ee84b,_0x49e8bd,_0x46da44){var _0x19d884={'raw':!![],'where':{}};var _0x20cd2b={};var _0xfc3bd8={'count':0x0,'rows':[]};return db[_0x3634('0x23')][_0x3634('0x55')]({'where':{'id':_0x1ee84b[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x49e8bd,null))[_0x3634('0x1b')](function(_0x3363c1){if(_0x3363c1){_0x20cd2b['model']=_[_0x3634('0x29')](db[_0x3634('0x57')]['rawAttributes']);_0x20cd2b[_0x3634('0x2c')]=_['keys'](_0x1ee84b['query']);_0x20cd2b[_0x3634('0x2a')]=_['intersection'](_0x20cd2b[_0x3634('0x28')],_0x20cd2b[_0x3634('0x2c')]);_0x19d884[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0x20cd2b[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x1ee84b[_0x3634('0x2c')][_0x3634('0x2e')]));_0x19d884['attributes']=_0x19d884[_0x3634('0x2d')][_0x3634('0x2f')]?_0x19d884[_0x3634('0x2d')]:_0x20cd2b[_0x3634('0x28')];if(!_0x1ee84b[_0x3634('0x2c')][_0x3634('0x52')]('nolimit')){_0x19d884[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x1ee84b['query'][_0x3634('0x31')]);_0x19d884[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x1ee84b[_0x3634('0x2c')][_0x3634('0x16')]);}_0x19d884['order']=qs[_0x3634('0x32')](_0x1ee84b[_0x3634('0x2c')][_0x3634('0x32')]);_0x19d884['where']=qs[_0x3634('0x2a')](_[_0x3634('0x33')](_0x1ee84b[_0x3634('0x2c')],_0x20cd2b[_0x3634('0x2a')]));_0x19d884['where']['CampaignId']=_0x3363c1['id'];if(_0x1ee84b[_0x3634('0x2c')][_0x3634('0x34')]){_0x19d884[_0x3634('0x35')]=_[_0x3634('0x37')](_0x19d884['where'],{'$or':_['map'](_0x19d884[_0x3634('0x2d')],function(_0x5d5d40){var _0x423f0c={};_0x423f0c[_0x5d5d40]={'$like':'%'+_0x1ee84b[_0x3634('0x2c')][_0x3634('0x34')]+'%'};return _0x423f0c;})});}_0x19d884=_[_0x3634('0x37')]({},_0x19d884,_0x1ee84b['options']);return db[_0x3634('0x57')]['count']({'where':_0x19d884[_0x3634('0x35')]})[_0x3634('0x1b')](function(_0x461cb5){_0xfc3bd8['count']=_0x461cb5;if(_0x1ee84b[_0x3634('0x2c')]['includeAll']){_0x19d884['include']=[{'all':!![]}];}return db[_0x3634('0x57')][_0x3634('0x58')](_0x19d884);})[_0x3634('0x1b')](function(_0x490e14){_0xfc3bd8['rows']=_0x490e14;return _0xfc3bd8;});}})[_0x3634('0x1b')](respondWithFilteredResult(_0x49e8bd,_0x19d884))[_0x3634('0x40')](handleError(_0x49e8bd,null));};exports[_0x3634('0x59')]=function(_0x391ae5,_0xc9fe1a,_0x381331){var _0xe79299={'raw':!![],'where':{}};var _0x171490={};var _0x2b71d7={'count':0x0,'rows':[]};return db[_0x3634('0x23')][_0x3634('0x55')]({'where':{'id':_0x391ae5[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0xc9fe1a,null))[_0x3634('0x1b')](function(_0x3891de){if(_0x3891de){_0x171490[_0x3634('0x28')]=_[_0x3634('0x29')](db[_0x3634('0x5a')][_0x3634('0x24')]);_0x171490[_0x3634('0x2c')]=_[_0x3634('0x29')](_0x391ae5[_0x3634('0x2c')]);_0x171490[_0x3634('0x2a')]=_['intersection'](_0x171490[_0x3634('0x28')],_0x171490[_0x3634('0x2c')]);_0xe79299['attributes']=_['intersection'](_0x171490['model'],qs[_0x3634('0x2e')](_0x391ae5[_0x3634('0x2c')][_0x3634('0x2e')]));_0xe79299['attributes']=_0xe79299[_0x3634('0x2d')][_0x3634('0x2f')]?_0xe79299['attributes']:_0x171490[_0x3634('0x28')];if(!_0x391ae5['query']['hasOwnProperty'](_0x3634('0x30'))){_0xe79299[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x391ae5[_0x3634('0x2c')]['limit']);_0xe79299[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x391ae5[_0x3634('0x2c')][_0x3634('0x16')]);}_0xe79299[_0x3634('0x5b')]=qs[_0x3634('0x32')](_0x391ae5[_0x3634('0x2c')][_0x3634('0x32')]);_0xe79299[_0x3634('0x35')]=qs[_0x3634('0x2a')](_[_0x3634('0x33')](_0x391ae5['query'],_0x171490[_0x3634('0x2a')]));_0xe79299[_0x3634('0x35')][_0x3634('0x53')]=_0x3891de['id'];if(_0x391ae5['query'][_0x3634('0x34')]){_0xe79299[_0x3634('0x35')]=_[_0x3634('0x37')](_0xe79299[_0x3634('0x35')],{'$or':_[_0x3634('0x22')](_0xe79299[_0x3634('0x2d')],function(_0x4ce4bf){var _0x292441={};_0x292441[_0x4ce4bf]={'$like':'%'+_0x391ae5[_0x3634('0x2c')][_0x3634('0x34')]+'%'};return _0x292441;})});}_0xe79299=_['merge']({},_0xe79299,_0x391ae5[_0x3634('0x38')]);return db[_0x3634('0x5a')]['count']({'where':_0xe79299[_0x3634('0x35')]})[_0x3634('0x1b')](function(_0x27b30d){_0x2b71d7[_0x3634('0x39')]=_0x27b30d;if(_0x391ae5[_0x3634('0x2c')][_0x3634('0x3a')]){_0xe79299[_0x3634('0x3e')]=[{'all':!![]}];}return db[_0x3634('0x5a')][_0x3634('0x58')](_0xe79299);})['then'](function(_0xb5ca9f){_0x2b71d7['rows']=_0xb5ca9f;return _0x2b71d7;});}})[_0x3634('0x1b')](respondWithFilteredResult(_0xc9fe1a,_0xe79299))[_0x3634('0x40')](handleError(_0xc9fe1a,null));};exports[_0x3634('0x5c')]=function(_0x54f984,_0x9a5e22,_0x523840){var _0x2390b9={};var _0x290276={};var _0x26c725;var _0x537825;return db[_0x3634('0x23')][_0x3634('0x55')]({'where':{'id':_0x54f984[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x9a5e22,null))[_0x3634('0x1b')](function(_0x536e9d){if(_0x536e9d){_0x26c725=_0x536e9d;_0x290276['model']=_['keys'](db[_0x3634('0x5d')]['rawAttributes']);_0x290276['query']=_[_0x3634('0x29')](_0x54f984[_0x3634('0x2c')]);_0x290276['filters']=_[_0x3634('0x2b')](_0x290276[_0x3634('0x28')],_0x290276[_0x3634('0x2c')]);_0x2390b9['attributes']=_['intersection'](_0x290276[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x54f984[_0x3634('0x2c')][_0x3634('0x2e')]));_0x2390b9['attributes']=_0x2390b9[_0x3634('0x2d')][_0x3634('0x2f')]?_0x2390b9[_0x3634('0x2d')]:_0x290276['model'];_0x2390b9[_0x3634('0x5b')]=qs[_0x3634('0x32')](_0x54f984[_0x3634('0x2c')]['sort']);_0x2390b9['where']=qs['filters'](_['pick'](_0x54f984[_0x3634('0x2c')],_0x290276[_0x3634('0x2a')]));if(_0x54f984[_0x3634('0x2c')][_0x3634('0x34')]){_0x2390b9[_0x3634('0x35')]=_[_0x3634('0x37')](_0x2390b9[_0x3634('0x35')],{'$or':_[_0x3634('0x22')](_0x2390b9[_0x3634('0x2d')],function(_0x35e0dc){var _0x756842={};_0x756842[_0x35e0dc]={'$like':'%'+_0x54f984[_0x3634('0x2c')][_0x3634('0x34')]+'%'};return _0x756842;})});}_0x2390b9=_[_0x3634('0x37')]({},_0x2390b9,_0x54f984[_0x3634('0x38')]);return _0x26c725[_0x3634('0x5c')](_0x2390b9);}})[_0x3634('0x1b')](function(_0x1f99d0){if(_0x1f99d0){_0x537825=_0x1f99d0['length'];if(!_0x54f984[_0x3634('0x2c')][_0x3634('0x52')](_0x3634('0x30'))){_0x2390b9[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x54f984['query'][_0x3634('0x31')]);_0x2390b9[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x54f984[_0x3634('0x2c')][_0x3634('0x16')]);}return _0x26c725['getLists'](_0x2390b9);}})[_0x3634('0x1b')](function(_0x2cfda9){if(_0x2cfda9){return _0x2cfda9?{'count':_0x537825,'rows':_0x2cfda9}:null;}})[_0x3634('0x1b')](respondWithResult(_0x9a5e22,null))[_0x3634('0x40')](handleError(_0x9a5e22,null));};exports[_0x3634('0x5e')]=function(_0x5ddb76,_0xcdcb4,_0x20f724){var _0x309bbd,_0x182404;return db['Campaign'][_0x3634('0x3f')]({'where':{'id':_0x5ddb76[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0xcdcb4,null))[_0x3634('0x1b')](function(_0x4ca46b){if(_0x4ca46b){_0x182404=_0x4ca46b;return _0x4ca46b[_0x3634('0x5e')](_0x5ddb76[_0x3634('0x42')][_0x3634('0x5f')],_[_0x3634('0x60')](_0x5ddb76['body'],[_0x3634('0x5f'),'id'])||{});}return null;})[_0x3634('0x61')](function(_0x12d753){var _0x3d2055;_0x309bbd=_0x12d753||[];var _0xb14458=[];if(_0x12d753){for(var _0x6d74e0=0x0;_0x6d74e0<_0x12d753[_0x3634('0x2f')];_0x6d74e0+=0x1){var _0x30ddf9=_0x12d753[_0x6d74e0][_0x3634('0x44')]({'plain':!![]});_0x182404[_0x3634('0x62')]=_0x5ddb76[_0x3634('0x42')][_0x3634('0x62')]?_0x5ddb76['body'][_0x3634('0x62')]:_0x182404[_0x3634('0x62')];switch(_0x182404[_0x3634('0x62')]){case _0x3634('0x63'):_0x3d2055=squel[_0x3634('0x64')]()[_0x3634('0x65')]('cm_hopper')['fromQuery']([_0x3634('0x66'),_0x3634('0x67'),'ContactId',_0x3634('0x68'),'CampaignId',_0x3634('0x4a'),_0x3634('0x4b')],squel[_0x3634('0x69')]()[_0x3634('0x6a')](_0x3634('0x66'),_0x3634('0x66'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x67'))['field']('id',_0x3634('0x6c'))[_0x3634('0x6a')](_0x30ddf9[_0x3634('0x6d')][_0x3634('0x6e')](),_0x3634('0x68'))[_0x3634('0x6a')](_0x5ddb76['params']['id']['toString'](),_0x3634('0x53'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x4a'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x4b'))[_0x3634('0x6f')]('cm_contacts')['where'](_0x3634('0x70'))['where'](_0x3634('0x71'),_0x30ddf9[_0x3634('0x6d')][_0x3634('0x6e')]())['where'](_0x3634('0x72'))[_0x3634('0x35')](_0x3634('0x73'),squel[_0x3634('0x69')]()['field'](_0x3634('0x74'))[_0x3634('0x6f')](_0x3634('0x75'))[_0x3634('0x35')](_0x3634('0x76'),_0x5ddb76['params']['id']['toString']()))[_0x3634('0x35')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3634('0x69')]()['field'](_0x3634('0x77'))[_0x3634('0x6f')](_0x3634('0x78'))[_0x3634('0x35')](_0x3634('0x76'),_0x5ddb76[_0x3634('0x3c')]['id']['toString']())))[_0x3634('0x6e')]();break;case _0x3634('0x79'):_0x3d2055=squel[_0x3634('0x64')]()[_0x3634('0x65')]('cm_hopper')[_0x3634('0x7a')]([_0x3634('0x66'),_0x3634('0x67'),'ContactId',_0x3634('0x68'),_0x3634('0x53'),_0x3634('0x4a'),'updatedAt'],squel[_0x3634('0x69')]()[_0x3634('0x6a')](_0x3634('0x66'),_0x3634('0x66'))[_0x3634('0x6a')]('NOW()',_0x3634('0x67'))[_0x3634('0x6a')]('id',_0x3634('0x6c'))[_0x3634('0x6a')](_0x30ddf9['CmListId'][_0x3634('0x6e')](),_0x3634('0x68'))[_0x3634('0x6a')](_0x5ddb76['params']['id'][_0x3634('0x6e')](),'CampaignId')['field'](_0x3634('0x6b'),_0x3634('0x4a'))['field'](_0x3634('0x6b'),_0x3634('0x4b'))[_0x3634('0x6f')](_0x3634('0x7b'))[_0x3634('0x35')](_0x3634('0x70'))[_0x3634('0x35')](_0x3634('0x71'),_0x30ddf9[_0x3634('0x6d')][_0x3634('0x6e')]())[_0x3634('0x35')](_0x3634('0x72'))['where'](_0x3634('0x73'),squel[_0x3634('0x69')]()[_0x3634('0x6a')](_0x3634('0x77'))[_0x3634('0x6f')](_0x3634('0x78'))[_0x3634('0x35')](_0x3634('0x76'),_0x5ddb76[_0x3634('0x3c')]['id'][_0x3634('0x6e')]())))[_0x3634('0x6e')]();break;default:_0x3d2055=squel[_0x3634('0x64')]()['into'](_0x3634('0x78'))[_0x3634('0x7a')]([_0x3634('0x66'),'scheduledAt','ContactId',_0x3634('0x68'),'CampaignId',_0x3634('0x4a'),_0x3634('0x4b')],squel[_0x3634('0x69')]()['field']('phone',_0x3634('0x66'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x67'))[_0x3634('0x6a')]('id',_0x3634('0x6c'))[_0x3634('0x6a')](_0x30ddf9[_0x3634('0x6d')][_0x3634('0x6e')](),_0x3634('0x68'))['field'](_0x5ddb76['params']['id'][_0x3634('0x6e')](),_0x3634('0x53'))['field'](_0x3634('0x6b'),_0x3634('0x4a'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x4b'))[_0x3634('0x6f')](_0x3634('0x7b'))[_0x3634('0x35')](_0x3634('0x70'))[_0x3634('0x35')](_0x3634('0x71'),_0x30ddf9[_0x3634('0x6d')]['toString']())[_0x3634('0x35')](_0x3634('0x72')))[_0x3634('0x6e')]();}_0xb14458[_0x3634('0x7c')](db[_0x3634('0x7d')][_0x3634('0x2c')](_0x3d2055));}return BPromise[_0x3634('0x7e')](_0xb14458);}})[_0x3634('0x1b')](function(){return _0x309bbd;})[_0x3634('0x1b')](respondWithResult(_0xcdcb4,null))['catch'](handleError(_0xcdcb4,null));};exports[_0x3634('0x7f')]=function(_0x5e8d5a,_0x51d9b6,_0x304783){return db[_0x3634('0x23')][_0x3634('0x3f')]({'where':{'id':_0x5e8d5a[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x51d9b6,null))['then'](function(_0x3e2617){if(_0x3e2617){return _0x3e2617[_0x3634('0x7f')](_0x5e8d5a[_0x3634('0x2c')][_0x3634('0x5f')]);}})['then'](function(_0xa4fb83){if(_0xa4fb83){return db[_0x3634('0x51')][_0x3634('0x1c')]({'where':{'ListId':_0x5e8d5a[_0x3634('0x2c')][_0x3634('0x5f')],'CampaignId':_0x5e8d5a[_0x3634('0x3c')]['id']}})['then'](function(){return _0xa4fb83;});}})[_0x3634('0x1b')](respondWithStatusCode(_0x51d9b6,null))['catch'](handleError(_0x51d9b6,null));};exports[_0x3634('0x80')]=function(_0x3d1b02,_0x3c73af,_0x1ff23d){var _0x30b5d3={'raw':!![],'where':{}};var _0x242912={};var _0x5ca8d5={'count':0x0,'rows':[]};return db[_0x3634('0x23')][_0x3634('0x55')]({'where':{'id':_0x3d1b02['params']['id']}})['then'](handleEntityNotFound(_0x3c73af,null))[_0x3634('0x1b')](function(_0x5d00c5){if(_0x5d00c5){_0x242912[_0x3634('0x28')]=_['keys'](db['CmList'][_0x3634('0x24')]);_0x242912['query']=_['keys'](_0x3d1b02[_0x3634('0x2c')]);_0x242912[_0x3634('0x2a')]=_[_0x3634('0x2b')](_0x242912[_0x3634('0x28')],_0x242912['query']);_0x30b5d3[_0x3634('0x2d')]=_[_0x3634('0x2b')](_0x242912['model'],qs[_0x3634('0x2e')](_0x3d1b02[_0x3634('0x2c')][_0x3634('0x2e')]));_0x30b5d3[_0x3634('0x2d')]=_0x30b5d3[_0x3634('0x2d')][_0x3634('0x2f')]?_0x30b5d3[_0x3634('0x2d')]:_0x242912['model'];if(!_0x3d1b02[_0x3634('0x2c')][_0x3634('0x52')](_0x3634('0x30'))){_0x30b5d3[_0x3634('0x31')]=qs[_0x3634('0x31')](_0x3d1b02['query'][_0x3634('0x31')]);_0x30b5d3[_0x3634('0x16')]=qs[_0x3634('0x16')](_0x3d1b02[_0x3634('0x2c')][_0x3634('0x16')]);}_0x30b5d3[_0x3634('0x5b')]=qs[_0x3634('0x32')](_0x3d1b02[_0x3634('0x2c')]['sort']);_0x30b5d3['where']=qs[_0x3634('0x2a')](_['pick'](_0x3d1b02[_0x3634('0x2c')],_0x242912[_0x3634('0x2a')]));_0x30b5d3['where'][_0x3634('0x53')]=_0x5d00c5['id'];if(_0x3d1b02[_0x3634('0x2c')][_0x3634('0x34')]){_0x30b5d3[_0x3634('0x35')]=_['merge'](_0x30b5d3[_0x3634('0x35')],{'$or':_[_0x3634('0x22')](_0x30b5d3[_0x3634('0x2d')],function(_0x5ddffd){var _0x1972e5={};_0x1972e5[_0x5ddffd]={'$like':'%'+_0x3d1b02['query'][_0x3634('0x34')]+'%'};return _0x1972e5;})});}_0x30b5d3=_[_0x3634('0x37')]({},_0x30b5d3,_0x3d1b02[_0x3634('0x38')]);return db[_0x3634('0x5d')][_0x3634('0x39')]({'where':_0x30b5d3[_0x3634('0x35')]})['then'](function(_0xf5e7db){_0x5ca8d5[_0x3634('0x39')]=_0xf5e7db;if(_0x3d1b02['query'][_0x3634('0x3a')]){_0x30b5d3['include']=[{'all':!![]}];}return db[_0x3634('0x5d')]['findAll'](_0x30b5d3);})[_0x3634('0x1b')](function(_0x3a7dd1){_0x5ca8d5['rows']=_0x3a7dd1;return _0x5ca8d5;});}})[_0x3634('0x1b')](respondWithFilteredResult(_0x3c73af,_0x30b5d3))[_0x3634('0x40')](handleError(_0x3c73af,null));};exports[_0x3634('0x81')]=function(_0x1fc174,_0x83722f,_0x265ae3){var _0x4f61d6,_0x3c42c8;return db['Campaign'][_0x3634('0x3f')]({'where':{'id':_0x1fc174[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x83722f,null))[_0x3634('0x1b')](function(_0x5ad78e){if(_0x5ad78e){_0x3c42c8=_0x5ad78e;return _0x5ad78e['addBlackLists'](_0x1fc174[_0x3634('0x42')][_0x3634('0x5f')],_[_0x3634('0x60')](_0x1fc174[_0x3634('0x42')],[_0x3634('0x5f'),'id'])||{});}return null;})[_0x3634('0x61')](function(_0x48618a){var _0x511c6e;_0x4f61d6=_0x48618a||[];var _0x29468d=[];if(_0x48618a){for(var _0x58e418=0x0;_0x58e418<_0x48618a[_0x3634('0x2f')];_0x58e418+=0x1){var _0x613419=_0x48618a[_0x58e418]['get']({'plain':!![]});_0x511c6e=squel[_0x3634('0x64')]()[_0x3634('0x65')](_0x3634('0x82'))['fromQuery']([_0x3634('0x66'),_0x3634('0x6c'),'ListId',_0x3634('0x53'),_0x3634('0x4a'),_0x3634('0x4b')],squel[_0x3634('0x69')]()['field'](_0x3634('0x66'),_0x3634('0x66'))[_0x3634('0x6a')]('id',_0x3634('0x6c'))[_0x3634('0x6a')](_0x613419[_0x3634('0x6d')][_0x3634('0x6e')](),_0x3634('0x68'))[_0x3634('0x6a')](_0x1fc174['params']['id'][_0x3634('0x6e')](),_0x3634('0x53'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x4a'))[_0x3634('0x6a')](_0x3634('0x6b'),_0x3634('0x4b'))['from']('cm_contacts')['where'](_0x3634('0x70'))[_0x3634('0x35')]('ListId\x20=\x20?',_0x613419[_0x3634('0x6d')]['toString']())['where'](_0x3634('0x72')))['toString']();_0x29468d[_0x3634('0x7c')](db[_0x3634('0x7d')][_0x3634('0x2c')](_0x511c6e));}return BPromise[_0x3634('0x7e')](_0x29468d);}})[_0x3634('0x1b')](function(){return _0x4f61d6;})['then'](respondWithResult(_0x83722f,null))[_0x3634('0x40')](handleError(_0x83722f,null));};exports[_0x3634('0x83')]=function(_0x382377,_0x109c4e,_0x3c2576){return db['Campaign'][_0x3634('0x3f')]({'where':{'id':_0x382377[_0x3634('0x3c')]['id']}})[_0x3634('0x1b')](handleEntityNotFound(_0x109c4e,null))['then'](function(_0x5af898){if(_0x5af898){return _0x5af898[_0x3634('0x83')](_0x382377[_0x3634('0x2c')][_0x3634('0x5f')]);}})['then'](function(_0x3ccefd){if(_0x3ccefd){return db['CmHopperBlack'][_0x3634('0x1c')]({'where':{'ListId':_0x382377['query'][_0x3634('0x5f')],'CampaignId':_0x382377['params']['id']}})['then'](function(){return _0x3ccefd;});}})[_0x3634('0x1b')](respondWithStatusCode(_0x109c4e,null))['catch'](handleError(_0x109c4e,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 673905e..2c674dc 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 _0x2870=['moment','bluebird','request-promise','rimraf','campaigns','lodash','../../config/logger','api'];(function(_0x15ef8e,_0x358a55){var _0x2f0737=function(_0x32e6cc){while(--_0x32e6cc){_0x15ef8e['push'](_0x15ef8e['shift']());}};_0x2f0737(++_0x358a55);}(_0x2870,0x1bd));var _0x0287=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x2870[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require(_0x0287('0x0'));var util=require('util');var logger=require(_0x0287('0x1'))(_0x0287('0x2'));var moment=require(_0x0287('0x3'));var BPromise=require(_0x0287('0x4'));var rp=require(_0x0287('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0287('0x6'));var config=require('../../config/environment');var attributes=require('./campaign.attributes');module['exports']=function(_0x369d58,_0x292504){return _0x369d58['define']('Campaign',attributes,{'tableName':_0x0287('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4455=['rimraf','./campaign.attributes','define','Campaign','util','bluebird','request-promise','path'];(function(_0x2922cd,_0x5d645b){var _0x2e8228=function(_0x497e19){while(--_0x497e19){_0x2922cd['push'](_0x2922cd['shift']());}};_0x2e8228(++_0x5d645b);}(_0x4455,0x1b4));var _0x5445=function(_0x7aff13,_0x2521d5){_0x7aff13=_0x7aff13-0x0;var _0x1bea29=_0x4455[_0x7aff13];return _0x1bea29;};'use strict';var _=require('lodash');var util=require(_0x5445('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5445('0x1'));var rp=require(_0x5445('0x2'));var fs=require('fs');var path=require(_0x5445('0x3'));var rimraf=require(_0x5445('0x4'));var config=require('../../config/environment');var attributes=require(_0x5445('0x5'));module['exports']=function(_0x5c5687,_0x2dd099){return _0x5c5687[_0x5445('0x6')](_0x5445('0x7'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 1504e48..0727b96 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(_0x1b587b,_0x4cfd15){var _0x32e1fd=function(_0x4f834b){while(--_0x4f834b){_0x1b587b['push'](_0x1b587b['shift']());}};_0x32e1fd(++_0x4cfd15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 _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(_0x450d7a,_0x160673){var _0x18d8a5=function(_0x46c12){while(--_0x46c12){_0x450d7a['push'](_0x450d7a['shift']());}};_0x18d8a5(++_0x160673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 704e7d8..b39d872 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 _0x6857=['/:id','update','delete','removeLists','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','index','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','create','post','/:id/clone','clone','addLists','/:id/blacklists','put'];(function(_0x5a01f7,_0x5c8505){var _0x1aae21=function(_0x10c827){while(--_0x10c827){_0x5a01f7['push'](_0x5a01f7['shift']());}};_0x1aae21(++_0x5c8505);}(_0x6857,0x198));var _0x7685=function(_0x24a91a,_0x48b586){_0x24a91a=_0x24a91a-0x0;var _0x3ffe67=_0x6857[_0x24a91a];return _0x3ffe67;};'use strict';var multer=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var path=require(_0x7685('0x2'));var timeout=require('connect-timeout');var express=require(_0x7685('0x3'));var router=express[_0x7685('0x4')]();var auth=require(_0x7685('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7685('0x6'));var controller=require(_0x7685('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7685('0x8')]);router[_0x7685('0x9')]('/:id',auth[_0x7685('0xa')](),controller[_0x7685('0xb')]);router[_0x7685('0x9')](_0x7685('0xc'),auth[_0x7685('0xa')](),controller[_0x7685('0xd')]);router[_0x7685('0x9')](_0x7685('0xe'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x7685('0xf'),auth[_0x7685('0xa')](),controller['getHopperFinals']);router[_0x7685('0x9')](_0x7685('0x10'),auth[_0x7685('0xa')](),controller[_0x7685('0x11')]);router[_0x7685('0x9')](_0x7685('0x12'),auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x7685('0xa')](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller[_0x7685('0x13')]);router[_0x7685('0x14')](_0x7685('0x15'),auth[_0x7685('0xa')](),controller[_0x7685('0x16')]);router['post'](_0x7685('0x12'),auth[_0x7685('0xa')](),controller[_0x7685('0x17')]);router[_0x7685('0x14')](_0x7685('0x18'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x7685('0x19')](_0x7685('0x1a'),auth[_0x7685('0xa')](),controller[_0x7685('0x1b')]);router[_0x7685('0x1c')](_0x7685('0x1a'),auth[_0x7685('0xa')](),controller['destroy']);router[_0x7685('0x1c')](_0x7685('0x12'),auth[_0x7685('0xa')](),controller[_0x7685('0x1d')]);router['delete'](_0x7685('0x18'),auth[_0x7685('0xa')](),controller['removeBlackLists']);module[_0x7685('0x1e')]=router; \ No newline at end of file +var _0xbe1c=['Router','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHopperHistories','getHopperFinals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0xb91c9c,_0x18c002){var _0x547bc9=function(_0x10d368){while(--_0x10d368){_0xb91c9c['push'](_0xb91c9c['shift']());}};_0x547bc9(++_0x18c002);}(_0xbe1c,0xc7));var _0xcbe1=function(_0x2a1268,_0x4f93b8){_0x2a1268=_0x2a1268-0x0;var _0x2bf668=_0xbe1c[_0x2a1268];return _0x2bf668;};'use strict';var multer=require(_0xcbe1('0x0'));var util=require(_0xcbe1('0x1'));var path=require(_0xcbe1('0x2'));var timeout=require(_0xcbe1('0x3'));var express=require('express');var router=express[_0xcbe1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcbe1('0x5'));var controller=require(_0xcbe1('0x6'));router[_0xcbe1('0x7')]('/',auth[_0xcbe1('0x8')](),controller['index']);router[_0xcbe1('0x7')](_0xcbe1('0x9'),auth[_0xcbe1('0x8')](),controller[_0xcbe1('0xa')]);router[_0xcbe1('0x7')](_0xcbe1('0xb'),auth[_0xcbe1('0x8')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xcbe1('0xc')]);router['get']('/:id/hopper_finals',auth[_0xcbe1('0x8')](),controller[_0xcbe1('0xd')]);router[_0xcbe1('0x7')]('/:id/hopper_black',auth[_0xcbe1('0x8')](),controller[_0xcbe1('0xe')]);router[_0xcbe1('0x7')](_0xcbe1('0xf'),auth['isAuthenticated'](),controller['getLists']);router[_0xcbe1('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xcbe1('0x10')]);router[_0xcbe1('0x11')]('/',auth['isAuthenticated'](),controller[_0xcbe1('0x12')]);router[_0xcbe1('0x11')](_0xcbe1('0x13'),auth['isAuthenticated'](),controller[_0xcbe1('0x14')]);router[_0xcbe1('0x11')](_0xcbe1('0xf'),auth[_0xcbe1('0x8')](),controller['addLists']);router[_0xcbe1('0x11')](_0xcbe1('0x15'),auth[_0xcbe1('0x8')](),controller[_0xcbe1('0x16')]);router[_0xcbe1('0x17')](_0xcbe1('0x9'),auth[_0xcbe1('0x8')](),controller[_0xcbe1('0x18')]);router['delete'](_0xcbe1('0x9'),auth[_0xcbe1('0x8')](),controller[_0xcbe1('0x19')]);router[_0xcbe1('0x1a')](_0xcbe1('0xf'),auth['isAuthenticated'](),controller['removeLists']);router[_0xcbe1('0x1a')](_0xcbe1('0x15'),auth[_0xcbe1('0x8')](),controller[_0xcbe1('0x1b')]);module[_0xcbe1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index af06096..275d6a5 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 _0xff65=['VIRTUAL','getDataValue','key','exports','STRING','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xff65,0xbd));var _0x5ff6=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xff65[_0x1a72f3];return _0x57ef47;};'use strict';var Sequelize=require('sequelize');module[_0x5ff6('0x0')]={'key':{'type':Sequelize[_0x5ff6('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x5ff6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x5ff6('0x3')],'get':function(){return this[_0x5ff6('0x4')](_0x5ff6('0x5'));}}}; \ No newline at end of file +var _0x7201=['exports','STRING','VIRTUAL','getDataValue','key','sequelize'];(function(_0x314ca7,_0x16b29e){var _0x20e23a=function(_0x35d7cf){while(--_0x35d7cf){_0x314ca7['push'](_0x314ca7['shift']());}};_0x20e23a(++_0x16b29e);}(_0x7201,0x1b5));var _0x1720=function(_0x5f0592,_0x58a382){_0x5f0592=_0x5f0592-0x0;var _0x5712d4=_0x7201[_0x5f0592];return _0x5712d4;};'use strict';var Sequelize=require(_0x1720('0x0'));module[_0x1720('0x1')]={'key':{'type':Sequelize[_0x1720('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x1720('0x2')]},'name':{'type':Sequelize[_0x1720('0x3')],'get':function(){return this[_0x1720('0x4')](_0x1720('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 68f53b5..359ae14 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 _0xed1f=['create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','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/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','body','find'];(function(_0x59ac6e,_0x361ed4){var _0x1c1883=function(_0x35c492){while(--_0x35c492){_0x59ac6e['push'](_0x59ac6e['shift']());}};_0x1c1883(++_0x361ed4);}(_0xed1f,0x6a));var _0xfed1=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xed1f[_0x486f4a];return _0x135d99;};'use strict';var pdf=require(_0xfed1('0x0'));var emlformat=require(_0xfed1('0x1'));var rimraf=require(_0xfed1('0x2'));var zipdir=require(_0xfed1('0x3'));var jsonpatch=require(_0xfed1('0x4'));var rp=require(_0xfed1('0x5'));var moment=require(_0xfed1('0x6'));var BPromise=require(_0xfed1('0x7'));var Mustache=require(_0xfed1('0x8'));var util=require(_0xfed1('0x9'));var path=require(_0xfed1('0xa'));var sox=require(_0xfed1('0xb'));var csv=require(_0xfed1('0xc'));var ejs=require(_0xfed1('0xd'));var fs=require('fs');var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xc'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=_0x123c46[_0xfed1('0x1d')],_0x1a00f6=_0x1fbb7a['offset'],_0x4af928=_0x1fbb7a[_0xfed1('0x1e')]+_0x1fbb7a[_0xfed1('0x1f')],_0x36ff34;if(_0x4af928>=_0x582e67){_0x4af928=_0x582e67;_0x36ff34=0xc8;}else{_0x36ff34=0xce;}_0x39aa0c['status'](_0x36ff34);return _0x39aa0c['set']('Content-Range',_0x1a00f6+'-'+_0x4af928+'/'+_0x582e67)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x51f12a){return function(_0x201f18){try{jsonpatch[_0xfed1('0x20')](_0x201f18,_0x51f12a,!![]);}catch(_0x51a860){return BPromise[_0xfed1('0x21')](_0x51a860);}return _0x201f18[_0xfed1('0x22')]();};}function saveUpdates(_0x59ee9d,_0x3ce944){return function(_0x2ea7a8){if(_0x2ea7a8){return _0x2ea7a8[_0xfed1('0x23')](_0x59ee9d)[_0xfed1('0x24')](function(_0x4bac79){return _0x4bac79;});}return null;};}function removeEntity(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x25')]()[_0xfed1('0x24')](function(){var _0x532ec2=_0x446558[_0xfed1('0x26')]({'plain':!![]});var _0x594917=_0xfed1('0x27');return db[_0xfed1('0x28')][_0xfed1('0x25')]({'where':{'type':_0x594917,'resourceId':_0x532ec2['id']}})[_0xfed1('0x24')](function(){return _0x446558;});})[_0xfed1('0x24')](function(){_0x203cec[_0xfed1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465ce6,_0xcb1cdc){return function(_0x49072b){if(!_0x49072b){_0x465ce6[_0xfed1('0x29')](0x194);}return _0x49072b;};}function handleError(_0x2b9dd2,_0x1b871a){_0x1b871a=_0x1b871a||0x1f4;return function(_0x1d62c5){logger[_0xfed1('0x2a')](_0x1d62c5[_0xfed1('0x2b')]);if(_0x1d62c5['name']){delete _0x1d62c5[_0xfed1('0x2c')];}_0x2b9dd2['status'](_0x1b871a)[_0xfed1('0x2d')](_0x1d62c5);};}exports['index']=function(_0x53b0c9,_0x1cec64){var _0x42c950={},_0x2d334e={},_0x599c23={'count':0x0,'rows':[]};var _0x18e4e7=_[_0xfed1('0x2e')](db[_0xfed1('0x2f')][_0xfed1('0x30')],function(_0x12399f){return{'name':_0x12399f[_0xfed1('0x31')],'type':_0x12399f['type'][_0xfed1('0x32')]};});_0x2d334e[_0xfed1('0x33')]=_['map'](_0x18e4e7,'name');_0x2d334e[_0xfed1('0x34')]=_[_0xfed1('0x35')](_0x53b0c9[_0xfed1('0x34')]);_0x2d334e[_0xfed1('0x36')]=_[_0xfed1('0x37')](_0x2d334e['model'],_0x2d334e[_0xfed1('0x34')]);_0x42c950[_0xfed1('0x38')]=_[_0xfed1('0x37')](_0x2d334e[_0xfed1('0x33')],qs[_0xfed1('0x39')](_0x53b0c9['query'][_0xfed1('0x39')]));_0x42c950['attributes']=_0x42c950[_0xfed1('0x38')][_0xfed1('0x3a')]?_0x42c950[_0xfed1('0x38')]:_0x2d334e[_0xfed1('0x33')];if(!_0x53b0c9[_0xfed1('0x34')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x42c950[_0xfed1('0x1f')]=qs['limit'](_0x53b0c9[_0xfed1('0x34')][_0xfed1('0x1f')]);_0x42c950[_0xfed1('0x1e')]=qs[_0xfed1('0x1e')](_0x53b0c9['query']['offset']);}_0x42c950[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x53b0c9[_0xfed1('0x34')][_0xfed1('0x3e')]);_0x42c950[_0xfed1('0x3f')]=qs[_0xfed1('0x36')](_[_0xfed1('0x40')](_0x53b0c9[_0xfed1('0x34')],_0x2d334e['filters']),_0x18e4e7);if(_0x53b0c9['query'][_0xfed1('0x41')]){_0x42c950[_0xfed1('0x3f')]=_['merge'](_0x42c950[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x2e')](_0x18e4e7,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x42')]!==_0xfed1('0x43')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2c')]]={'$like':'%'+_0x53b0c9[_0xfed1('0x34')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x42c950=_['merge']({},_0x42c950,_0x53b0c9['options']);var _0x5598dc={'where':_0x42c950[_0xfed1('0x3f')]};return db[_0xfed1('0x2f')][_0xfed1('0x1d')](_0x5598dc)['then'](function(_0x3454e6){_0x599c23['count']=_0x3454e6;if(_0x53b0c9[_0xfed1('0x34')][_0xfed1('0x44')]){_0x42c950[_0xfed1('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0xfed1('0x46')](_0x42c950);})[_0xfed1('0x24')](function(_0x422433){_0x599c23['rows']=_0x422433;return _0x599c23;})[_0xfed1('0x24')](respondWithFilteredResult(_0x1cec64,_0x42c950))['catch'](handleError(_0x1cec64,null));};exports[_0xfed1('0x47')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':!![],'where':{'id':_0xf1f739[_0xfed1('0x48')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x35')](db[_0xfed1('0x2f')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x34')]=_[_0xfed1('0x35')](_0xf1f739[_0xfed1('0x34')]);_0x1bfbe8['filtears']=_['intersection'](_0x1bfbe8[_0xfed1('0x33')],_0x1bfbe8[_0xfed1('0x34')]);_0x13c087[_0xfed1('0x38')]=_[_0xfed1('0x37')](_0x1bfbe8[_0xfed1('0x33')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x34')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x38')]=_0x13c087[_0xfed1('0x38')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x38')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x34')][_0xfed1('0x44')]){_0x13c087[_0xfed1('0x45')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x49')]({},_0x13c087,_0xf1f739[_0xfed1('0x4a')]);return db[_0xfed1('0x2f')]['find'](_0x13c087)[_0xfed1('0x24')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x24')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4b')](handleError(_0x229fc7,null));};exports['update']=function(_0x22874a,_0x10f98d){if(_0x22874a[_0xfed1('0x4c')]['id']){delete _0x22874a[_0xfed1('0x4c')]['id'];}return db['CannedAnswer'][_0xfed1('0x4d')]({'where':{'id':_0x22874a[_0xfed1('0x48')]['id']}})[_0xfed1('0x24')](handleEntityNotFound(_0x10f98d,null))[_0xfed1('0x24')](saveUpdates(_0x22874a[_0xfed1('0x4c')],null))[_0xfed1('0x24')](respondWithResult(_0x10f98d,null))[_0xfed1('0x4b')](handleError(_0x10f98d,null));};exports[_0xfed1('0x25')]=function(_0x2365db,_0x326f68){return db[_0xfed1('0x2f')][_0xfed1('0x4d')]({'where':{'id':_0x2365db[_0xfed1('0x48')]['id']}})[_0xfed1('0x24')](handleEntityNotFound(_0x326f68,null))[_0xfed1('0x24')](removeEntity(_0x326f68,null))[_0xfed1('0x4b')](handleError(_0x326f68,null));};exports[_0xfed1('0x4e')]=function(_0x270321,_0x5397c9){var _0x589feb={'key':_0x270321[_0xfed1('0x4c')][_0xfed1('0x32')]};if(_0x270321[_0xfed1('0x4c')][_0xfed1('0x4f')]){_0x589feb['MailAccountId']=_0x270321[_0xfed1('0x4c')][_0xfed1('0x4f')];}else if(_0x270321['body']['SmsAccountId']){_0x589feb['SmsAccountId']=_0x270321[_0xfed1('0x4c')][_0xfed1('0x50')];}else if(_0x270321[_0xfed1('0x4c')][_0xfed1('0x51')]){_0x589feb[_0xfed1('0x51')]=_0x270321[_0xfed1('0x4c')][_0xfed1('0x51')];}else if(_0x270321[_0xfed1('0x4c')][_0xfed1('0x52')]){_0x589feb[_0xfed1('0x52')]=_0x270321['body']['ChatWebsiteId'];}return db[_0xfed1('0x2f')][_0xfed1('0x4d')]({'where':_0x589feb})[_0xfed1('0x24')](function(_0x151938){if(_0x151938){throw new db[(_0xfed1('0x53'))][(_0xfed1('0x54'))](_0xfed1('0x55'));}return db[_0xfed1('0x2f')][_0xfed1('0x4e')](_0x270321[_0xfed1('0x4c')]);})[_0xfed1('0x24')](function(_0x103492){var _0x430d71=_0x270321[_0xfed1('0x56')][_0xfed1('0x26')]({'plain':!![]});if(!_0x430d71)throw new Error(_0xfed1('0x57'));if(_0x430d71[_0xfed1('0x58')]==='user'){var _0x5b167b=_0x103492[_0xfed1('0x26')]({'plain':!![]});return db[_0xfed1('0x59')][_0xfed1('0x4d')]({'where':{'name':_0xfed1('0x27'),'userProfileId':_0x430d71[_0xfed1('0x5a')]},'raw':!![]})[_0xfed1('0x24')](function(_0x2ccdc3){if(_0x2ccdc3&&_0x2ccdc3[_0xfed1('0x5b')]===0x0){return db[_0xfed1('0x28')][_0xfed1('0x4e')]({'name':_0x5b167b[_0xfed1('0x2c')],'resourceId':_0x5b167b['id'],'type':_0x2ccdc3[_0xfed1('0x2c')],'sectionId':_0x2ccdc3['id']},{})[_0xfed1('0x24')](function(){return _0x103492;});}else{return _0x103492;}})[_0xfed1('0x4b')](function(_0x59ecc4){logger[_0xfed1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59ecc4);throw _0x59ecc4;});}return _0x103492;})['then'](respondWithResult(_0x5397c9,0xc9))[_0xfed1('0x4b')](handleError(_0x5397c9,null));}; \ No newline at end of file +var _0x9957=['update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','filtears','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x49')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x4a')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4b')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4c')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4b')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x4a')]({'where':{'id':_0x14b537[_0x7995('0x4c')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4d')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4b')]['MailAccountId']){_0x4ec548[_0x7995('0x4e')]=_0x12d4b8[_0x7995('0x4b')][_0x7995('0x4e')];}else if(_0x12d4b8[_0x7995('0x4b')][_0x7995('0x4f')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4b')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4b')][_0x7995('0x50')]){_0x4ec548[_0x7995('0x50')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x51')]=_0x12d4b8[_0x7995('0x4b')][_0x7995('0x51')];}return db[_0x7995('0x2e')][_0x7995('0x4a')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x52'))][(_0x7995('0x53'))](_0x7995('0x54'));}return db[_0x7995('0x2e')][_0x7995('0x4d')](_0x12d4b8[_0x7995('0x4b')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x55')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x56'));if(_0x416133['role']===_0x7995('0x55')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x57')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x58')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x59')]===0x0){return db['UserProfileResource'][_0x7995('0x4d')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x5a'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 3a68728..d07143c 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 _0x579c=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x19ac7b,_0x562e9f){var _0x2e736c=function(_0x13f8c8){while(--_0x13f8c8){_0x19ac7b['push'](_0x19ac7b['shift']());}};_0x2e736c(++_0x562e9f);}(_0x579c,0xda));var _0xc579=function(_0x2f2367,_0x3a992e){_0x2f2367=_0x2f2367-0x0;var _0x3e7eb8=_0x579c[_0x2f2367];return _0x3e7eb8;};'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')]('CannedAnswer',attributes,{'tableName':_0xc579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc579('0xc'),'collate':_0xc579('0xd')});}; \ No newline at end of file +var _0xd2bb=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util'];(function(_0x57b4cc,_0x2ae50e){var _0x45ba9d=function(_0x4ab1b1){while(--_0x4ab1b1){_0x57b4cc['push'](_0x57b4cc['shift']());}};_0x45ba9d(++_0x2ae50e);}(_0xd2bb,0x1d2));var _0xbd2b=function(_0xe5a583,_0x23232b){_0xe5a583=_0xe5a583-0x0;var _0x4030eb=_0xd2bb[_0xe5a583];return _0x4030eb;};'use strict';var _=require(_0xbd2b('0x0'));var util=require(_0xbd2b('0x1'));var logger=require(_0xbd2b('0x2'))(_0xbd2b('0x3'));var moment=require(_0xbd2b('0x4'));var BPromise=require('bluebird');var rp=require(_0xbd2b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd2b('0x6'));var config=require(_0xbd2b('0x7'));var attributes=require(_0xbd2b('0x8'));module[_0xbd2b('0x9')]=function(_0xb0a744,_0x2b9d5b){return _0xb0a744['define'](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xbd2b('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 78f53f7..3799dc9 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 _0x73f9=['request','info','CannedAnswer,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x73f9,0xc7));var _0x973f=function(_0x5b92c8,_0x7a61d5){_0x5b92c8=_0x5b92c8-0x0;var _0x213bf7=_0x73f9[_0x5b92c8];return _0x213bf7;};'use strict';var _=require(_0x973f('0x0'));var util=require(_0x973f('0x1'));var moment=require(_0x973f('0x2'));var BPromise=require(_0x973f('0x3'));var rs=require(_0x973f('0x4'));var fs=require('fs');var Redis=require(_0x973f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x973f('0x6'));var logger=require(_0x973f('0x7'))(_0x973f('0x8'));var config=require(_0x973f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x973f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ac016,_0x41434b,_0x238b1e){return new BPromise(function(_0x5a9878,_0x28f767){return client[_0x973f('0xb')](_0x5ac016,_0x238b1e)['then'](function(_0x3251b8){logger[_0x973f('0xc')](_0x973f('0xd'),_0x41434b,'request\x20sent');logger[_0x973f('0xe')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x41434b,_0x973f('0xf'),JSON[_0x973f('0x10')](_0x3251b8));if(_0x3251b8[_0x973f('0x11')]){if(_0x3251b8[_0x973f('0x11')][_0x973f('0x12')]===0x1f4){logger[_0x973f('0x11')](_0x973f('0xd'),_0x41434b,_0x3251b8['error'][_0x973f('0x13')]);return _0x28f767(_0x3251b8['error'][_0x973f('0x13')]);}logger[_0x973f('0x11')](_0x973f('0xd'),_0x41434b,_0x3251b8[_0x973f('0x11')][_0x973f('0x13')]);return _0x5a9878(_0x3251b8[_0x973f('0x11')][_0x973f('0x13')]);}else{logger['info'](_0x973f('0xd'),_0x41434b,_0x973f('0xf'));_0x5a9878(_0x3251b8[_0x973f('0x14')][_0x973f('0x13')]);}})['catch'](function(_0x478f61){logger[_0x973f('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x41434b,_0x478f61);_0x28f767(_0x478f61);});});} \ No newline at end of file +var _0xff91=['request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x5aa992,_0x559ebb){var _0x2e2d59=function(_0x1e2e35){while(--_0x1e2e35){_0x5aa992['push'](_0x5aa992['shift']());}};_0x2e2d59(++_0x559ebb);}(_0xff91,0x18f));var _0x1ff9=function(_0x359abc,_0x2ac7b5){_0x359abc=_0x359abc-0x0;var _0x1e1f11=_0xff91[_0x359abc];return _0x1e1f11;};'use strict';var _=require(_0x1ff9('0x0'));var util=require(_0x1ff9('0x1'));var moment=require(_0x1ff9('0x2'));var BPromise=require(_0x1ff9('0x3'));var rs=require(_0x1ff9('0x4'));var fs=require('fs');var Redis=require(_0x1ff9('0x5'));var db=require(_0x1ff9('0x6'))['db'];var utils=require(_0x1ff9('0x7'));var logger=require(_0x1ff9('0x8'))(_0x1ff9('0x9'));var config=require(_0x1ff9('0xa'));var jayson=require(_0x1ff9('0xb'));var client=jayson['client'][_0x1ff9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x537f85,_0x5a1c55,_0x48d7aa){return new BPromise(function(_0x362c5f,_0x4f96b7){return client[_0x1ff9('0xd')](_0x537f85,_0x48d7aa)[_0x1ff9('0xe')](function(_0x3a7a40){logger[_0x1ff9('0xf')](_0x1ff9('0x10'),_0x5a1c55,_0x1ff9('0x11'));logger[_0x1ff9('0x12')](_0x1ff9('0x13'),_0x5a1c55,_0x1ff9('0x11'),JSON[_0x1ff9('0x14')](_0x3a7a40));if(_0x3a7a40['error']){if(_0x3a7a40[_0x1ff9('0x15')][_0x1ff9('0x16')]===0x1f4){logger[_0x1ff9('0x15')](_0x1ff9('0x10'),_0x5a1c55,_0x3a7a40[_0x1ff9('0x15')][_0x1ff9('0x17')]);return _0x4f96b7(_0x3a7a40[_0x1ff9('0x15')][_0x1ff9('0x17')]);}logger[_0x1ff9('0x15')](_0x1ff9('0x10'),_0x5a1c55,_0x3a7a40[_0x1ff9('0x15')][_0x1ff9('0x17')]);return _0x362c5f(_0x3a7a40[_0x1ff9('0x15')]['message']);}else{logger['info'](_0x1ff9('0x10'),_0x5a1c55,'request\x20sent');_0x362c5f(_0x3a7a40[_0x1ff9('0x18')]['message']);}})[_0x1ff9('0x19')](function(_0x672053){logger[_0x1ff9('0x15')](_0x1ff9('0x10'),_0x5a1c55,_0x672053);_0x4f96b7(_0x672053);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index dcc3226..67cd99e 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 _0x824c=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','path'];(function(_0x43abb7,_0x21576e){var _0x57955d=function(_0x5df189){while(--_0x5df189){_0x43abb7['push'](_0x43abb7['shift']());}};_0x57955d(++_0x21576e);}(_0x824c,0x1b7));var _0xc824=function(_0x3df583,_0x14418d){_0x3df583=_0x3df583-0x0;var _0x331c3a=_0x824c[_0x3df583];return _0x331c3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc824('0x0'));var timeout=require(_0xc824('0x1'));var express=require(_0xc824('0x2'));var router=express[_0xc824('0x3')]();var auth=require(_0xc824('0x4'));var interaction=require(_0xc824('0x5'));var config=require(_0xc824('0x6'));var controller=require(_0xc824('0x7'));router['get']('/',auth[_0xc824('0x8')](),controller[_0xc824('0x9')]);router[_0xc824('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc824('0xb')]);router[_0xc824('0xc')]('/',auth[_0xc824('0x8')](),controller[_0xc824('0xd')]);router[_0xc824('0xe')](_0xc824('0xf'),auth[_0xc824('0x8')](),controller[_0xc824('0x10')]);router[_0xc824('0x11')](_0xc824('0xf'),auth[_0xc824('0x8')](),controller[_0xc824('0x12')]);module[_0xc824('0x13')]=router; \ No newline at end of file +var _0xebc8=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','post','create'];(function(_0x291f8b,_0x3b5591){var _0x275171=function(_0xb33d67){while(--_0xb33d67){_0x291f8b['push'](_0x291f8b['shift']());}};_0x275171(++_0x3b5591);}(_0xebc8,0xc4));var _0x8ebc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xebc8[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x8ebc('0x0'));var util=require(_0x8ebc('0x1'));var path=require('path');var timeout=require(_0x8ebc('0x2'));var express=require(_0x8ebc('0x3'));var router=express[_0x8ebc('0x4')]();var auth=require(_0x8ebc('0x5'));var interaction=require(_0x8ebc('0x6'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0x8ebc('0x7')]('/',auth[_0x8ebc('0x8')](),controller[_0x8ebc('0x9')]);router['get']('/:id',auth[_0x8ebc('0x8')](),controller[_0x8ebc('0xa')]);router[_0x8ebc('0xb')]('/',auth[_0x8ebc('0x8')](),controller[_0x8ebc('0xc')]);router[_0x8ebc('0xd')](_0x8ebc('0xe'),auth[_0x8ebc('0x8')](),controller[_0x8ebc('0xf')]);router[_0x8ebc('0x10')](_0x8ebc('0xe'),auth[_0x8ebc('0x8')](),controller[_0x8ebc('0x11')]);module[_0x8ebc('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d63305d..b516786 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 _0xe7b2=['STRING','INTEGER','sequelize','exports','1970-01-01\x2000:00:01'];(function(_0x395a2c,_0x34c3fe){var _0x1ca789=function(_0x15a4a8){while(--_0x15a4a8){_0x395a2c['push'](_0x395a2c['shift']());}};_0x1ca789(++_0x34c3fe);}(_0xe7b2,0x11a));var _0x2e7b=function(_0x1789f1,_0xe35edf){_0x1789f1=_0x1789f1-0x0;var _0x461cb3=_0xe7b2[_0x1789f1];return _0x461cb3;};'use strict';var Sequelize=require(_0x2e7b('0x0'));module[_0x2e7b('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2e7b('0x2')},'clid':{'type':Sequelize[_0x2e7b('0x3')]},'src':{'type':Sequelize[_0x2e7b('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2e7b('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2e7b('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2e7b('0x3')]},'amaflags':{'type':Sequelize[_0x2e7b('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2e7b('0x3')]},'userfield':{'type':Sequelize[_0x2e7b('0x3')]},'uniqueid':{'type':Sequelize[_0x2e7b('0x3')]},'linkedid':{'type':Sequelize[_0x2e7b('0x3')]},'sequence':{'type':Sequelize[_0x2e7b('0x3')]},'peeraccount':{'type':Sequelize[_0x2e7b('0x3')]},'type':{'type':Sequelize[_0x2e7b('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf47=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x5ac111,_0x1e5c8f){var _0x55b670=function(_0x4dfa40){while(--_0x4dfa40){_0x5ac111['push'](_0x5ac111['shift']());}};_0x55b670(++_0x1e5c8f);}(_0xbf47,0x12d));var _0x7bf4=function(_0x39942f,_0x954bd2){_0x39942f=_0x39942f-0x0;var _0x53d109=_0xbf47[_0x39942f];return _0x53d109;};'use strict';var Sequelize=require(_0x7bf4('0x0'));module[_0x7bf4('0x1')]={'calldate':{'type':Sequelize[_0x7bf4('0x2')],'allowNull':![],'defaultValue':_0x7bf4('0x3')},'clid':{'type':Sequelize[_0x7bf4('0x4')]},'src':{'type':Sequelize[_0x7bf4('0x4')]},'dst':{'type':Sequelize[_0x7bf4('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7bf4('0x4')]},'dstchannel':{'type':Sequelize[_0x7bf4('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7bf4('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7bf4('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7bf4('0x4')]},'amaflags':{'type':Sequelize[_0x7bf4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7bf4('0x4')]},'userfield':{'type':Sequelize[_0x7bf4('0x4')]},'uniqueid':{'type':Sequelize[_0x7bf4('0x4')]},'linkedid':{'type':Sequelize[_0x7bf4('0x4')]},'sequence':{'type':Sequelize[_0x7bf4('0x4')]},'peeraccount':{'type':Sequelize[_0x7bf4('0x4')]},'type':{'type':Sequelize[_0x7bf4('0x4')]},'tag':{'type':Sequelize[_0x7bf4('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4e26a33..e541154 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 _0x3b89=['includeAll','include','findAll','rows','catch','show','filtears','find','create','body','update','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x8dcf5d,_0x42898f){var _0x284284=function(_0x18688b){while(--_0x18688b){_0x8dcf5d['push'](_0x8dcf5d['shift']());}};_0x284284(++_0x42898f);}(_0x3b89,0xfa));var _0x93b8=function(_0x121398,_0x3d52d9){_0x121398=_0x121398-0x0;var _0x3eca8b=_0x3b89[_0x121398];return _0x3eca8b;};'use strict';var pdf=require(_0x93b8('0x0'));var emlformat=require(_0x93b8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x93b8('0x2'));var rp=require(_0x93b8('0x3'));var moment=require(_0x93b8('0x4'));var BPromise=require(_0x93b8('0x5'));var Mustache=require(_0x93b8('0x6'));var util=require(_0x93b8('0x7'));var path=require(_0x93b8('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x93b8('0x9'));var squel=require(_0x93b8('0xa'));var crypto=require(_0x93b8('0xb'));var jsforce=require(_0x93b8('0xc'));var deskjs=require(_0x93b8('0xd'));var toCsv=require(_0x93b8('0xe'));var querystring=require(_0x93b8('0xf'));var Papa=require('papaparse');var Redis=require(_0x93b8('0x10'));var authService=require(_0x93b8('0x11'));var qs=require(_0x93b8('0x12'));var as=require(_0x93b8('0x13'));var hardwareService=require(_0x93b8('0x14'));var logger=require(_0x93b8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x93b8('0x16'));var licenseUtil=require(_0x93b8('0x17'));var db=require(_0x93b8('0x18'))['db'];function respondWithStatusCode(_0x4a921e,_0xd063e5){_0xd063e5=_0xd063e5||0xcc;return function(_0x2c5274){if(_0x2c5274){return _0x4a921e[_0x93b8('0x19')](_0xd063e5);}return _0x4a921e[_0x93b8('0x1a')](_0xd063e5)[_0x93b8('0x1b')]();};}function respondWithResult(_0xb81683,_0x477f37){_0x477f37=_0x477f37||0xc8;return function(_0x273738){if(_0x273738){return _0xb81683[_0x93b8('0x1a')](_0x477f37)[_0x93b8('0x1c')](_0x273738);}};}function respondWithFilteredResult(_0x52beb7,_0x5f120f){return function(_0x54bd4a){if(_0x54bd4a){var _0x1240a3=_0x54bd4a[_0x93b8('0x1d')],_0x17f435=_0x5f120f['offset'],_0x115fd5=_0x5f120f[_0x93b8('0x1e')]+_0x5f120f[_0x93b8('0x1f')],_0x4c3887;if(_0x115fd5>=_0x1240a3){_0x115fd5=_0x1240a3;_0x4c3887=0xc8;}else{_0x4c3887=0xce;}_0x52beb7[_0x93b8('0x1a')](_0x4c3887);return _0x52beb7[_0x93b8('0x20')](_0x93b8('0x21'),_0x17f435+'-'+_0x115fd5+'/'+_0x1240a3)[_0x93b8('0x1c')](_0x54bd4a);}return null;};}function patchUpdates(_0x25bf02){return function(_0x5b9558){try{jsonpatch[_0x93b8('0x22')](_0x5b9558,_0x25bf02,!![]);}catch(_0x14fa8f){return BPromise[_0x93b8('0x23')](_0x14fa8f);}return _0x5b9558[_0x93b8('0x24')]();};}function saveUpdates(_0x1bfb36,_0xafff52){return function(_0x47cb1b){if(_0x47cb1b){return _0x47cb1b['update'](_0x1bfb36)[_0x93b8('0x25')](function(_0x5b321a){return _0x5b321a;});}return null;};}function removeEntity(_0x526886,_0x42168e){return function(_0x4419d4){if(_0x4419d4){return _0x4419d4[_0x93b8('0x26')]()['then'](function(){_0x526886[_0x93b8('0x1a')](0xcc)[_0x93b8('0x1b')]();});}};}function handleEntityNotFound(_0x299abb,_0x1f4977){return function(_0x5e349b){if(!_0x5e349b){_0x299abb[_0x93b8('0x19')](0x194);}return _0x5e349b;};}function handleError(_0x536a18,_0xff8e6c){_0xff8e6c=_0xff8e6c||0x1f4;return function(_0x57e95a){logger[_0x93b8('0x27')](_0x57e95a[_0x93b8('0x28')]);if(_0x57e95a[_0x93b8('0x29')]){delete _0x57e95a['name'];}_0x536a18['status'](_0xff8e6c)['send'](_0x57e95a);};}exports[_0x93b8('0x2a')]=function(_0x54f19d,_0x4e437e){var _0xc4be5e={},_0x1acaa9={},_0x498364={'count':0x0,'rows':[]};var _0x2c6fba=_[_0x93b8('0x2b')](db[_0x93b8('0x2c')][_0x93b8('0x2d')],function(_0x25032a){return{'name':_0x25032a[_0x93b8('0x2e')],'type':_0x25032a['type'][_0x93b8('0x2f')]};});_0x1acaa9['model']=_[_0x93b8('0x2b')](_0x2c6fba,_0x93b8('0x29'));_0x1acaa9['query']=_[_0x93b8('0x30')](_0x54f19d[_0x93b8('0x31')]);_0x1acaa9[_0x93b8('0x32')]=_[_0x93b8('0x33')](_0x1acaa9[_0x93b8('0x34')],_0x1acaa9[_0x93b8('0x31')]);_0xc4be5e[_0x93b8('0x35')]=_['intersection'](_0x1acaa9[_0x93b8('0x34')],qs[_0x93b8('0x36')](_0x54f19d[_0x93b8('0x31')][_0x93b8('0x36')]));_0xc4be5e['attributes']=_0xc4be5e['attributes'][_0x93b8('0x37')]?_0xc4be5e[_0x93b8('0x35')]:_0x1acaa9[_0x93b8('0x34')];if(!_0x54f19d[_0x93b8('0x31')][_0x93b8('0x38')]('nolimit')){_0xc4be5e[_0x93b8('0x1f')]=qs[_0x93b8('0x1f')](_0x54f19d[_0x93b8('0x31')][_0x93b8('0x1f')]);_0xc4be5e['offset']=qs[_0x93b8('0x1e')](_0x54f19d[_0x93b8('0x31')][_0x93b8('0x1e')]);}_0xc4be5e[_0x93b8('0x39')]=qs[_0x93b8('0x3a')](_0x54f19d[_0x93b8('0x31')][_0x93b8('0x3a')]);_0xc4be5e[_0x93b8('0x3b')]=qs[_0x93b8('0x32')](_[_0x93b8('0x3c')](_0x54f19d[_0x93b8('0x31')],_0x1acaa9[_0x93b8('0x32')]),_0x2c6fba);if(_0x54f19d[_0x93b8('0x31')][_0x93b8('0x3d')]){_0xc4be5e[_0x93b8('0x3b')]=_[_0x93b8('0x3e')](_0xc4be5e[_0x93b8('0x3b')],{'$or':_[_0x93b8('0x2b')](_0x2c6fba,function(_0x536df8){if(_0x536df8[_0x93b8('0x3f')]!==_0x93b8('0x40')){var _0x11d0cd={};_0x11d0cd[_0x536df8[_0x93b8('0x29')]]={'$like':'%'+_0x54f19d[_0x93b8('0x31')][_0x93b8('0x3d')]+'%'};return _0x11d0cd;}})});}_0xc4be5e=_['merge']({},_0xc4be5e,_0x54f19d[_0x93b8('0x41')]);var _0xa96033={'where':_0xc4be5e['where']};return db[_0x93b8('0x2c')][_0x93b8('0x1d')](_0xa96033)['then'](function(_0x3adfb0){_0x498364[_0x93b8('0x1d')]=_0x3adfb0;if(_0x54f19d[_0x93b8('0x31')][_0x93b8('0x42')]){_0xc4be5e[_0x93b8('0x43')]=[{'all':!![]}];}return db[_0x93b8('0x2c')][_0x93b8('0x44')](_0xc4be5e);})[_0x93b8('0x25')](function(_0x2817d7){_0x498364[_0x93b8('0x45')]=_0x2817d7;return _0x498364;})['then'](respondWithFilteredResult(_0x4e437e,_0xc4be5e))[_0x93b8('0x46')](handleError(_0x4e437e,null));};exports[_0x93b8('0x47')]=function(_0x5dfc2d,_0x2360cd){var _0x42822f={'raw':!![],'where':{'id':_0x5dfc2d['params']['id']}},_0x3a99cd={};_0x3a99cd['model']=_[_0x93b8('0x30')](db[_0x93b8('0x2c')][_0x93b8('0x2d')]);_0x3a99cd[_0x93b8('0x31')]=_['keys'](_0x5dfc2d[_0x93b8('0x31')]);_0x3a99cd[_0x93b8('0x48')]=_[_0x93b8('0x33')](_0x3a99cd['model'],_0x3a99cd[_0x93b8('0x31')]);_0x42822f['attributes']=_[_0x93b8('0x33')](_0x3a99cd[_0x93b8('0x34')],qs[_0x93b8('0x36')](_0x5dfc2d[_0x93b8('0x31')][_0x93b8('0x36')]));_0x42822f[_0x93b8('0x35')]=_0x42822f[_0x93b8('0x35')][_0x93b8('0x37')]?_0x42822f[_0x93b8('0x35')]:_0x3a99cd[_0x93b8('0x34')];if(_0x5dfc2d[_0x93b8('0x31')][_0x93b8('0x42')]){_0x42822f[_0x93b8('0x43')]=[{'all':!![]}];}_0x42822f=_[_0x93b8('0x3e')]({},_0x42822f,_0x5dfc2d[_0x93b8('0x41')]);return db['Cdr'][_0x93b8('0x49')](_0x42822f)[_0x93b8('0x25')](handleEntityNotFound(_0x2360cd,null))[_0x93b8('0x25')](respondWithResult(_0x2360cd,null))[_0x93b8('0x46')](handleError(_0x2360cd,null));};exports[_0x93b8('0x4a')]=function(_0x3c978,_0x422ead){return db[_0x93b8('0x2c')]['create'](_0x3c978[_0x93b8('0x4b')],{})[_0x93b8('0x25')](respondWithResult(_0x422ead,0xc9))[_0x93b8('0x46')](handleError(_0x422ead,null));};exports[_0x93b8('0x4c')]=function(_0x20fe72,_0x4909e2){if(_0x20fe72[_0x93b8('0x4b')]['id']){delete _0x20fe72[_0x93b8('0x4b')]['id'];}return db['Cdr'][_0x93b8('0x49')]({'where':{'id':_0x20fe72[_0x93b8('0x4d')]['id']}})[_0x93b8('0x25')](handleEntityNotFound(_0x4909e2,null))[_0x93b8('0x25')](saveUpdates(_0x20fe72[_0x93b8('0x4b')],null))[_0x93b8('0x25')](respondWithResult(_0x4909e2,null))[_0x93b8('0x46')](handleError(_0x4909e2,null));};exports[_0x93b8('0x26')]=function(_0x195de1,_0x45c322){return db['Cdr'][_0x93b8('0x49')]({'where':{'id':_0x195de1['params']['id']}})[_0x93b8('0x25')](handleEntityNotFound(_0x45c322,null))[_0x93b8('0x25')](removeEntity(_0x45c322,null))[_0x93b8('0x46')](handleError(_0x45c322,null));};exports[_0x93b8('0x4e')]=function(_0x114c00,_0x5681ec){return db[_0x93b8('0x2c')][_0x93b8('0x4e')]()[_0x93b8('0x25')](respondWithResult(_0x5681ec,null))[_0x93b8('0x46')](handleError(_0x5681ec,null));}; \ No newline at end of file +var _0xd357=['limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','Cdr','type','model','query','intersection','attributes','fields','length','nolimit','sort','pick','filters','where','merge','filter','options','includeAll','findAll','show','params','keys','rawAttributes','filtears','include','find','catch','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x5a5675,_0x4b4c8f){var _0x2fb9d6=function(_0x2508bf){while(--_0x2508bf){_0x5a5675['push'](_0x5a5675['shift']());}};_0x2fb9d6(++_0x4b4c8f);}(_0xd357,0x138));var _0x7d35=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd357[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x7d35('0x0'));var emlformat=require(_0x7d35('0x1'));var rimraf=require(_0x7d35('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d35('0x3'));var moment=require(_0x7d35('0x4'));var BPromise=require(_0x7d35('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7d35('0x6'));var csv=require(_0x7d35('0x7'));var ejs=require(_0x7d35('0x8'));var fs=require('fs');var _=require(_0x7d35('0x9'));var squel=require('squel');var crypto=require(_0x7d35('0xa'));var jsforce=require(_0x7d35('0xb'));var deskjs=require(_0x7d35('0xc'));var toCsv=require(_0x7d35('0x7'));var querystring=require('querystring');var Papa=require(_0x7d35('0xd'));var Redis=require('ioredis');var authService=require(_0x7d35('0xe'));var qs=require(_0x7d35('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d35('0x10'));var logger=require(_0x7d35('0x11'))(_0x7d35('0x12'));var utils=require(_0x7d35('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7d35('0x14'));var db=require(_0x7d35('0x15'))['db'];function respondWithStatusCode(_0x33828d,_0x15a558){_0x15a558=_0x15a558||0xcc;return function(_0x35123d){if(_0x35123d){return _0x33828d[_0x7d35('0x16')](_0x15a558);}return _0x33828d[_0x7d35('0x17')](_0x15a558)[_0x7d35('0x18')]();};}function respondWithResult(_0x3b4f78,_0x43fefe){_0x43fefe=_0x43fefe||0xc8;return function(_0x466943){if(_0x466943){return _0x3b4f78[_0x7d35('0x17')](_0x43fefe)[_0x7d35('0x19')](_0x466943);}};}function respondWithFilteredResult(_0x18059d,_0x201d26){return function(_0x3f3b32){if(_0x3f3b32){var _0x3ea5d1=_0x3f3b32[_0x7d35('0x1a')],_0x1abb05=_0x201d26[_0x7d35('0x1b')],_0x3cc102=_0x201d26[_0x7d35('0x1b')]+_0x201d26[_0x7d35('0x1c')],_0x624c0f;if(_0x3cc102>=_0x3ea5d1){_0x3cc102=_0x3ea5d1;_0x624c0f=0xc8;}else{_0x624c0f=0xce;}_0x18059d[_0x7d35('0x17')](_0x624c0f);return _0x18059d[_0x7d35('0x1d')]('Content-Range',_0x1abb05+'-'+_0x3cc102+'/'+_0x3ea5d1)[_0x7d35('0x19')](_0x3f3b32);}return null;};}function patchUpdates(_0x5cc07c){return function(_0x3731a5){try{jsonpatch[_0x7d35('0x1e')](_0x3731a5,_0x5cc07c,!![]);}catch(_0x3c5c88){return BPromise[_0x7d35('0x1f')](_0x3c5c88);}return _0x3731a5[_0x7d35('0x20')]();};}function saveUpdates(_0xf29301,_0x25fe31){return function(_0x4e479c){if(_0x4e479c){return _0x4e479c[_0x7d35('0x21')](_0xf29301)[_0x7d35('0x22')](function(_0x1853cc){return _0x1853cc;});}return null;};}function removeEntity(_0x34b2a6,_0x72003){return function(_0x3dcb43){if(_0x3dcb43){return _0x3dcb43[_0x7d35('0x23')]()[_0x7d35('0x22')](function(){_0x34b2a6['status'](0xcc)[_0x7d35('0x18')]();});}};}function handleEntityNotFound(_0x5edaf8,_0x2e3c10){return function(_0x2badff){if(!_0x2badff){_0x5edaf8[_0x7d35('0x16')](0x194);}return _0x2badff;};}function handleError(_0x43de08,_0x49fd85){_0x49fd85=_0x49fd85||0x1f4;return function(_0x12810b){logger['error'](_0x12810b[_0x7d35('0x24')]);if(_0x12810b[_0x7d35('0x25')]){delete _0x12810b[_0x7d35('0x25')];}_0x43de08[_0x7d35('0x17')](_0x49fd85)[_0x7d35('0x26')](_0x12810b);};}exports['index']=function(_0x4a1e33,_0x436674){var _0x1c8d1c={},_0x5e06d2={},_0xe46f05={'count':0x0,'rows':[]};var _0x390ca3=_[_0x7d35('0x27')](db[_0x7d35('0x28')]['rawAttributes'],function(_0x3f618e){return{'name':_0x3f618e['fieldName'],'type':_0x3f618e[_0x7d35('0x29')]['key']};});_0x5e06d2[_0x7d35('0x2a')]=_[_0x7d35('0x27')](_0x390ca3,'name');_0x5e06d2['query']=_['keys'](_0x4a1e33[_0x7d35('0x2b')]);_0x5e06d2['filters']=_[_0x7d35('0x2c')](_0x5e06d2[_0x7d35('0x2a')],_0x5e06d2['query']);_0x1c8d1c[_0x7d35('0x2d')]=_['intersection'](_0x5e06d2[_0x7d35('0x2a')],qs['fields'](_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x2e')]));_0x1c8d1c[_0x7d35('0x2d')]=_0x1c8d1c['attributes'][_0x7d35('0x2f')]?_0x1c8d1c['attributes']:_0x5e06d2['model'];if(!_0x4a1e33['query']['hasOwnProperty'](_0x7d35('0x30'))){_0x1c8d1c[_0x7d35('0x1c')]=qs[_0x7d35('0x1c')](_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x1c')]);_0x1c8d1c[_0x7d35('0x1b')]=qs[_0x7d35('0x1b')](_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x1b')]);}_0x1c8d1c['order']=qs[_0x7d35('0x31')](_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x31')]);_0x1c8d1c['where']=qs['filters'](_[_0x7d35('0x32')](_0x4a1e33[_0x7d35('0x2b')],_0x5e06d2[_0x7d35('0x33')]),_0x390ca3);if(_0x4a1e33[_0x7d35('0x2b')]['filter']){_0x1c8d1c[_0x7d35('0x34')]=_[_0x7d35('0x35')](_0x1c8d1c[_0x7d35('0x34')],{'$or':_['map'](_0x390ca3,function(_0x193c0b){if(_0x193c0b[_0x7d35('0x29')]!=='VIRTUAL'){var _0x1b8796={};_0x1b8796[_0x193c0b[_0x7d35('0x25')]]={'$like':'%'+_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x36')]+'%'};return _0x1b8796;}})});}_0x1c8d1c=_[_0x7d35('0x35')]({},_0x1c8d1c,_0x4a1e33[_0x7d35('0x37')]);var _0x39f7c5={'where':_0x1c8d1c[_0x7d35('0x34')]};return db[_0x7d35('0x28')][_0x7d35('0x1a')](_0x39f7c5)[_0x7d35('0x22')](function(_0x3d51e8){_0xe46f05['count']=_0x3d51e8;if(_0x4a1e33[_0x7d35('0x2b')][_0x7d35('0x38')]){_0x1c8d1c['include']=[{'all':!![]}];}return db[_0x7d35('0x28')][_0x7d35('0x39')](_0x1c8d1c);})[_0x7d35('0x22')](function(_0x4365b7){_0xe46f05['rows']=_0x4365b7;return _0xe46f05;})[_0x7d35('0x22')](respondWithFilteredResult(_0x436674,_0x1c8d1c))['catch'](handleError(_0x436674,null));};exports[_0x7d35('0x3a')]=function(_0x17ecf9,_0x605448){var _0xdcf075={'raw':!![],'where':{'id':_0x17ecf9[_0x7d35('0x3b')]['id']}},_0x1289e3={};_0x1289e3['model']=_[_0x7d35('0x3c')](db['Cdr'][_0x7d35('0x3d')]);_0x1289e3[_0x7d35('0x2b')]=_[_0x7d35('0x3c')](_0x17ecf9[_0x7d35('0x2b')]);_0x1289e3[_0x7d35('0x3e')]=_['intersection'](_0x1289e3[_0x7d35('0x2a')],_0x1289e3['query']);_0xdcf075['attributes']=_[_0x7d35('0x2c')](_0x1289e3[_0x7d35('0x2a')],qs[_0x7d35('0x2e')](_0x17ecf9[_0x7d35('0x2b')][_0x7d35('0x2e')]));_0xdcf075[_0x7d35('0x2d')]=_0xdcf075[_0x7d35('0x2d')][_0x7d35('0x2f')]?_0xdcf075['attributes']:_0x1289e3[_0x7d35('0x2a')];if(_0x17ecf9[_0x7d35('0x2b')][_0x7d35('0x38')]){_0xdcf075[_0x7d35('0x3f')]=[{'all':!![]}];}_0xdcf075=_[_0x7d35('0x35')]({},_0xdcf075,_0x17ecf9[_0x7d35('0x37')]);return db[_0x7d35('0x28')][_0x7d35('0x40')](_0xdcf075)[_0x7d35('0x22')](handleEntityNotFound(_0x605448,null))['then'](respondWithResult(_0x605448,null))[_0x7d35('0x41')](handleError(_0x605448,null));};exports['create']=function(_0x146feb,_0x5e9fea){return db[_0x7d35('0x28')]['create'](_0x146feb[_0x7d35('0x42')],{})['then'](respondWithResult(_0x5e9fea,0xc9))[_0x7d35('0x41')](handleError(_0x5e9fea,null));};exports['update']=function(_0x44e1ed,_0xa204){if(_0x44e1ed[_0x7d35('0x42')]['id']){delete _0x44e1ed['body']['id'];}return db[_0x7d35('0x28')][_0x7d35('0x40')]({'where':{'id':_0x44e1ed[_0x7d35('0x3b')]['id']}})[_0x7d35('0x22')](handleEntityNotFound(_0xa204,null))[_0x7d35('0x22')](saveUpdates(_0x44e1ed[_0x7d35('0x42')],null))[_0x7d35('0x22')](respondWithResult(_0xa204,null))[_0x7d35('0x41')](handleError(_0xa204,null));};exports[_0x7d35('0x23')]=function(_0x3661f4,_0x2e56f3){return db['Cdr'][_0x7d35('0x40')]({'where':{'id':_0x3661f4[_0x7d35('0x3b')]['id']}})[_0x7d35('0x22')](handleEntityNotFound(_0x2e56f3,null))[_0x7d35('0x22')](removeEntity(_0x2e56f3,null))[_0x7d35('0x41')](handleError(_0x2e56f3,null));};exports[_0x7d35('0x43')]=function(_0x289adc,_0x1b74d7){return db[_0x7d35('0x28')]['describe']()[_0x7d35('0x22')](respondWithResult(_0x1b74d7,null))['catch'](handleError(_0x1b74d7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index fb6ca3c..483090b 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 _0xc1c6=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Cdr'];(function(_0x2f94bf,_0x40def6){var _0x3bbac2=function(_0x30654d){while(--_0x30654d){_0x2f94bf['push'](_0x2f94bf['shift']());}};_0x3bbac2(++_0x40def6);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x11c188,_0x565b71){_0x11c188=_0x11c188-0x0;var _0x3226f5=_0xc1c6[_0x11c188];return _0x3226f5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'calldate','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['disposition']},{'name':_0x6c1c('0xd'),'fields':[_0x6c1c('0xd')]},{'name':_0x6c1c('0xe'),'fields':[_0x6c1c('0xe')]},{'name':'uniqueid','fields':[_0x6c1c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5d17=['calldate','disposition','src','uniqueid','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x5d17,0x114));var _0x75d1=function(_0x2d9f8f,_0x40bc79){_0x2d9f8f=_0x2d9f8f-0x0;var _0x240df4=_0x5d17[_0x2d9f8f];return _0x240df4;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['calldate']},{'name':'disposition','fields':[_0x75d1('0xe')]},{'name':'dst','fields':['dst']},{'name':_0x75d1('0xf'),'fields':[_0x75d1('0xf')]},{'name':'uniqueid','fields':[_0x75d1('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 836e454..2c4e277 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 _0x5656=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5656,0x19e));var _0x6565=function(_0x1c599a,_0x9f1758){_0x1c599a=_0x1c599a-0x0;var _0x163e91=_0x5656[_0x1c599a];return _0x163e91;};'use strict';var _=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var moment=require('moment');var BPromise=require(_0x6565('0x2'));var rs=require(_0x6565('0x3'));var fs=require('fs');var Redis=require(_0x6565('0x4'));var db=require(_0x6565('0x5'))['db'];var utils=require(_0x6565('0x6'));var logger=require('../../config/logger')(_0x6565('0x7'));var config=require(_0x6565('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6565('0x9')][_0x6565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24fee7,_0x2bddc0,_0xda32a7){return new BPromise(function(_0x816043,_0x5300b5){return client[_0x6565('0xb')](_0x24fee7,_0xda32a7)[_0x6565('0xc')](function(_0x26bb82){logger['info'](_0x6565('0xd'),_0x2bddc0,_0x6565('0xe'));logger[_0x6565('0xf')](_0x6565('0x10'),_0x2bddc0,_0x6565('0xe'),JSON[_0x6565('0x11')](_0x26bb82));if(_0x26bb82[_0x6565('0x12')]){if(_0x26bb82['error'][_0x6565('0x13')]===0x1f4){logger['error'](_0x6565('0xd'),_0x2bddc0,_0x26bb82['error']['message']);return _0x5300b5(_0x26bb82[_0x6565('0x12')]['message']);}logger[_0x6565('0x12')](_0x6565('0xd'),_0x2bddc0,_0x26bb82[_0x6565('0x12')][_0x6565('0x14')]);return _0x816043(_0x26bb82['error']['message']);}else{logger['info'](_0x6565('0xd'),_0x2bddc0,_0x6565('0xe'));_0x816043(_0x26bb82[_0x6565('0x15')][_0x6565('0x14')]);}})[_0x6565('0x16')](function(_0x542c8f){logger[_0x6565('0x12')](_0x6565('0xd'),_0x2bddc0,_0x542c8f);_0x5300b5(_0x542c8f);});});} \ No newline at end of file +var _0x5e50=['../../config/utils','rpc','../../config/environment','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x187ee8,_0x38ecef){var _0x4acd8c=function(_0x3a9c4e){while(--_0x3a9c4e){_0x187ee8['push'](_0x187ee8['shift']());}};_0x4acd8c(++_0x38ecef);}(_0x5e50,0x1dd));var _0x05e5=function(_0x557d83,_0x3ce17b){_0x557d83=_0x557d83-0x0;var _0x3ca85c=_0x5e50[_0x557d83];return _0x3ca85c;};'use strict';var _=require('lodash');var util=require(_0x05e5('0x0'));var moment=require(_0x05e5('0x1'));var BPromise=require(_0x05e5('0x2'));var rs=require(_0x05e5('0x3'));var fs=require('fs');var Redis=require(_0x05e5('0x4'));var db=require(_0x05e5('0x5'))['db'];var utils=require(_0x05e5('0x6'));var logger=require('../../config/logger')(_0x05e5('0x7'));var config=require(_0x05e5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa737b2,_0x15ae78,_0x375830){return new BPromise(function(_0x512132,_0x42f73d){return client[_0x05e5('0x9')](_0xa737b2,_0x375830)[_0x05e5('0xa')](function(_0x364e62){logger[_0x05e5('0xb')]('Cdr,\x20%s,\x20%s',_0x15ae78,'request\x20sent');logger[_0x05e5('0xc')](_0x05e5('0xd'),_0x15ae78,'request\x20sent',JSON[_0x05e5('0xe')](_0x364e62));if(_0x364e62['error']){if(_0x364e62[_0x05e5('0xf')][_0x05e5('0x10')]===0x1f4){logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);return _0x42f73d(_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);}logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x364e62[_0x05e5('0xf')][_0x05e5('0x12')]);return _0x512132(_0x364e62['error'][_0x05e5('0x12')]);}else{logger[_0x05e5('0xb')](_0x05e5('0x11'),_0x15ae78,'request\x20sent');_0x512132(_0x364e62[_0x05e5('0x13')][_0x05e5('0x12')]);}})[_0x05e5('0x14')](function(_0x254417){logger[_0x05e5('0xf')](_0x05e5('0x11'),_0x15ae78,_0x254417);_0x42f73d(_0x254417);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4837b04..6f3a252 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 _0xa265=['../../components/auth/service','./cdr.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','exports','connect-timeout'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa265,0xc3));var _0x5a26=function(_0x586825,_0x101b19){_0x586825=_0x586825-0x0;var _0x4d4091=_0xa265[_0x586825];return _0x4d4091;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5a26('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0x5a26('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5a26('0x2'));router[_0x5a26('0x3')]('/',auth[_0x5a26('0x4')](),controller[_0x5a26('0x5')]);router[_0x5a26('0x3')](_0x5a26('0x6'),auth[_0x5a26('0x4')](),controller['describe']);router['get']('/:id',auth[_0x5a26('0x4')](),controller[_0x5a26('0x7')]);router[_0x5a26('0x8')]('/',auth[_0x5a26('0x4')](),controller[_0x5a26('0x9')]);router[_0x5a26('0xa')](_0x5a26('0xb'),auth[_0x5a26('0x4')](),controller[_0x5a26('0xc')]);router['delete']('/:id',auth[_0x5a26('0x4')](),controller['destroy']);module[_0x5a26('0xd')]=router; \ No newline at end of file +var _0x4dbe=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x52a1b2,_0x56d89c){var _0x5cc9aa=function(_0x53b9f2){while(--_0x53b9f2){_0x52a1b2['push'](_0x52a1b2['shift']());}};_0x5cc9aa(++_0x56d89c);}(_0x4dbe,0xbc));var _0xe4db=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4dbe[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xe4db('0x0'));var util=require(_0xe4db('0x1'));var path=require(_0xe4db('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4db('0x3')]();var auth=require(_0xe4db('0x4'));var interaction=require(_0xe4db('0x5'));var config=require(_0xe4db('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0xe4db('0x7')](),controller[_0xe4db('0x8')]);router[_0xe4db('0x9')](_0xe4db('0xa'),auth['isAuthenticated'](),controller[_0xe4db('0xb')]);router[_0xe4db('0x9')](_0xe4db('0xc'),auth[_0xe4db('0x7')](),controller[_0xe4db('0xd')]);router[_0xe4db('0xe')]('/',auth[_0xe4db('0x7')](),controller[_0xe4db('0xf')]);router[_0xe4db('0x10')](_0xe4db('0xc'),auth[_0xe4db('0x7')](),controller[_0xe4db('0x11')]);router['delete']('/:id',auth[_0xe4db('0x7')](),controller[_0xe4db('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index f7da091..3952a4d 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 _0xfe5b=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x9eeaf,_0xceb84f){var _0x5e6b85=function(_0x180825){while(--_0x180825){_0x9eeaf['push'](_0x9eeaf['shift']());}};_0x5e6b85(++_0xceb84f);}(_0xfe5b,0x1b8));var _0xbfe5=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xfe5b[_0x55e08b];return _0xd1a7ff;};'use strict';var Sequelize=require(_0xbfe5('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbfe5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbfe5('0x2')],'allowNull':![],'defaultValue':_0xbfe5('0x3')},'appdata':{'type':Sequelize[_0xbfe5('0x4')]()},'description':{'type':Sequelize[_0xbfe5('0x2')]},'interval':{'type':Sequelize[_0xbfe5('0x2')],'defaultValue':_0xbfe5('0x5')}}; \ No newline at end of file +var _0xc2be=['noop','TEXT','STRING','sequelize'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xc2be,0x11f));var _0xec2b=function(_0x461b52,_0x20b9ed){_0x461b52=_0x461b52-0x0;var _0x2c3811=_0xc2be[_0x461b52];return _0x2c3811;};'use strict';var Sequelize=require(_0xec2b('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xec2b('0x1')},'appdata':{'type':Sequelize[_0xec2b('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xec2b('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a3aa56d..5a93714 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 _0x1ffb=['offset','limit','set','Content-Range','apply','update','destroy','then','name','send','show','params','model','keys','rawAttributes','query','filtears','attributes','intersection','fields','includeAll','include','merge','options','catch','body','ChatApplication','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ffb,0x108));var _0xb1ff=function(_0x5736ee,_0x6f1834){_0x5736ee=_0x5736ee-0x0;var _0x9a075a=_0x1ffb[_0x5736ee];return _0x9a075a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb1ff('0x0'));var zipdir=require(_0xb1ff('0x1'));var jsonpatch=require(_0xb1ff('0x2'));var rp=require(_0xb1ff('0x3'));var moment=require(_0xb1ff('0x4'));var BPromise=require(_0xb1ff('0x5'));var Mustache=require(_0xb1ff('0x6'));var util=require(_0xb1ff('0x7'));var path=require('path');var sox=require(_0xb1ff('0x8'));var csv=require(_0xb1ff('0x9'));var ejs=require(_0xb1ff('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb1ff('0xb'));var crypto=require(_0xb1ff('0xc'));var jsforce=require(_0xb1ff('0xd'));var deskjs=require(_0xb1ff('0xe'));var toCsv=require(_0xb1ff('0x9'));var querystring=require(_0xb1ff('0xf'));var Papa=require(_0xb1ff('0x10'));var Redis=require(_0xb1ff('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb1ff('0x12'));var as=require(_0xb1ff('0x13'));var hardwareService=require(_0xb1ff('0x14'));var logger=require(_0xb1ff('0x15'))(_0xb1ff('0x16'));var utils=require('../../config/utils');var config=require(_0xb1ff('0x17'));var licenseUtil=require(_0xb1ff('0x18'));var db=require(_0xb1ff('0x19'))['db'];function respondWithStatusCode(_0x4e982e,_0x53f4be){_0x53f4be=_0x53f4be||0xcc;return function(_0x485f94){if(_0x485f94){return _0x4e982e[_0xb1ff('0x1a')](_0x53f4be);}return _0x4e982e['status'](_0x53f4be)[_0xb1ff('0x1b')]();};}function respondWithResult(_0x1784c8,_0x2e051e){_0x2e051e=_0x2e051e||0xc8;return function(_0xd86c5d){if(_0xd86c5d){return _0x1784c8[_0xb1ff('0x1c')](_0x2e051e)[_0xb1ff('0x1d')](_0xd86c5d);}};}function respondWithFilteredResult(_0x4df4fd,_0x5a043f){return function(_0x512858){if(_0x512858){var _0xe959ac=_0x512858[_0xb1ff('0x1e')],_0x182adb=_0x5a043f['offset'],_0x27814=_0x5a043f[_0xb1ff('0x1f')]+_0x5a043f[_0xb1ff('0x20')],_0x517172;if(_0x27814>=_0xe959ac){_0x27814=_0xe959ac;_0x517172=0xc8;}else{_0x517172=0xce;}_0x4df4fd[_0xb1ff('0x1c')](_0x517172);return _0x4df4fd[_0xb1ff('0x21')](_0xb1ff('0x22'),_0x182adb+'-'+_0x27814+'/'+_0xe959ac)[_0xb1ff('0x1d')](_0x512858);}return null;};}function patchUpdates(_0x1aa1a8){return function(_0x41b525){try{jsonpatch[_0xb1ff('0x23')](_0x41b525,_0x1aa1a8,!![]);}catch(_0x4038d2){return BPromise['reject'](_0x4038d2);}return _0x41b525['save']();};}function saveUpdates(_0x3e409c,_0x182d1c){return function(_0x1c0d87){if(_0x1c0d87){return _0x1c0d87[_0xb1ff('0x24')](_0x3e409c)['then'](function(_0x4c6744){return _0x4c6744;});}return null;};}function removeEntity(_0x19700a,_0x335252){return function(_0x372eaf){if(_0x372eaf){return _0x372eaf[_0xb1ff('0x25')]()[_0xb1ff('0x26')](function(){_0x19700a[_0xb1ff('0x1c')](0xcc)[_0xb1ff('0x1b')]();});}};}function handleEntityNotFound(_0x3adb8b,_0x2d3576){return function(_0x57f0d9){if(!_0x57f0d9){_0x3adb8b[_0xb1ff('0x1a')](0x194);}return _0x57f0d9;};}function handleError(_0x4c23da,_0x150d2d){_0x150d2d=_0x150d2d||0x1f4;return function(_0x1440ff){logger['error'](_0x1440ff['stack']);if(_0x1440ff['name']){delete _0x1440ff[_0xb1ff('0x27')];}_0x4c23da['status'](_0x150d2d)[_0xb1ff('0x28')](_0x1440ff);};}exports[_0xb1ff('0x29')]=function(_0x218e0a,_0x1e3b76){var _0x37ae1d={'raw':!![],'where':{'id':_0x218e0a[_0xb1ff('0x2a')]['id']}},_0x211727={};_0x211727[_0xb1ff('0x2b')]=_[_0xb1ff('0x2c')](db['ChatApplication'][_0xb1ff('0x2d')]);_0x211727[_0xb1ff('0x2e')]=_[_0xb1ff('0x2c')](_0x218e0a[_0xb1ff('0x2e')]);_0x211727[_0xb1ff('0x2f')]=_['intersection'](_0x211727[_0xb1ff('0x2b')],_0x211727[_0xb1ff('0x2e')]);_0x37ae1d[_0xb1ff('0x30')]=_[_0xb1ff('0x31')](_0x211727[_0xb1ff('0x2b')],qs[_0xb1ff('0x32')](_0x218e0a['query'][_0xb1ff('0x32')]));_0x37ae1d[_0xb1ff('0x30')]=_0x37ae1d[_0xb1ff('0x30')]['length']?_0x37ae1d['attributes']:_0x211727['model'];if(_0x218e0a[_0xb1ff('0x2e')][_0xb1ff('0x33')]){_0x37ae1d[_0xb1ff('0x34')]=[{'all':!![]}];}_0x37ae1d=_[_0xb1ff('0x35')]({},_0x37ae1d,_0x218e0a[_0xb1ff('0x36')]);return db['ChatApplication']['find'](_0x37ae1d)[_0xb1ff('0x26')](handleEntityNotFound(_0x1e3b76,null))['then'](respondWithResult(_0x1e3b76,null))[_0xb1ff('0x37')](handleError(_0x1e3b76,null));};exports[_0xb1ff('0x24')]=function(_0x165c4a,_0x1b9281){if(_0x165c4a[_0xb1ff('0x38')]['id']){delete _0x165c4a[_0xb1ff('0x38')]['id'];}return db[_0xb1ff('0x39')]['find']({'where':{'id':_0x165c4a[_0xb1ff('0x2a')]['id']}})[_0xb1ff('0x26')](handleEntityNotFound(_0x1b9281,null))[_0xb1ff('0x26')](saveUpdates(_0x165c4a[_0xb1ff('0x38')],null))[_0xb1ff('0x26')](respondWithResult(_0x1b9281,null))[_0xb1ff('0x37')](handleError(_0x1b9281,null));};exports[_0xb1ff('0x25')]=function(_0x49d0f8,_0x4eaa92){return db[_0xb1ff('0x39')][_0xb1ff('0x3a')]({'where':{'id':_0x49d0f8[_0xb1ff('0x2a')]['id']}})[_0xb1ff('0x26')](handleEntityNotFound(_0x4eaa92,null))[_0xb1ff('0x26')](removeEntity(_0x4eaa92,null))[_0xb1ff('0x37')](handleError(_0x4eaa92,null));}; \ No newline at end of file +var _0x0802=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','show','params','model','keys','rawAttributes','query','filtears','attributes','fields','includeAll','include','merge','options','ChatApplication','find','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0802,0x16d));var _0x2080=function(_0x3ec5dc,_0x3a48ea){_0x3ec5dc=_0x3ec5dc-0x0;var _0x2767d5=_0x0802[_0x3ec5dc];return _0x2767d5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2080('0x0'));var zipdir=require(_0x2080('0x1'));var jsonpatch=require(_0x2080('0x2'));var rp=require('request-promise');var moment=require(_0x2080('0x3'));var BPromise=require(_0x2080('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2080('0x5'));var csv=require(_0x2080('0x6'));var ejs=require(_0x2080('0x7'));var fs=require('fs');var _=require(_0x2080('0x8'));var squel=require(_0x2080('0x9'));var crypto=require(_0x2080('0xa'));var jsforce=require(_0x2080('0xb'));var deskjs=require(_0x2080('0xc'));var toCsv=require(_0x2080('0x6'));var querystring=require(_0x2080('0xd'));var Papa=require(_0x2080('0xe'));var Redis=require('ioredis');var authService=require(_0x2080('0xf'));var qs=require(_0x2080('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2080('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2080('0x12'));var config=require(_0x2080('0x13'));var licenseUtil=require(_0x2080('0x14'));var db=require(_0x2080('0x15'))['db'];function respondWithStatusCode(_0x1a6b2f,_0x3e44a8){_0x3e44a8=_0x3e44a8||0xcc;return function(_0x1bc132){if(_0x1bc132){return _0x1a6b2f[_0x2080('0x16')](_0x3e44a8);}return _0x1a6b2f[_0x2080('0x17')](_0x3e44a8)[_0x2080('0x18')]();};}function respondWithResult(_0x452c27,_0x2723ab){_0x2723ab=_0x2723ab||0xc8;return function(_0x2761a0){if(_0x2761a0){return _0x452c27[_0x2080('0x17')](_0x2723ab)[_0x2080('0x19')](_0x2761a0);}};}function respondWithFilteredResult(_0x1e2990,_0x4da511){return function(_0x8f729){if(_0x8f729){var _0x2e3be0=_0x8f729[_0x2080('0x1a')],_0x58444a=_0x4da511[_0x2080('0x1b')],_0x3f41d6=_0x4da511[_0x2080('0x1b')]+_0x4da511[_0x2080('0x1c')],_0x32dbea;if(_0x3f41d6>=_0x2e3be0){_0x3f41d6=_0x2e3be0;_0x32dbea=0xc8;}else{_0x32dbea=0xce;}_0x1e2990[_0x2080('0x17')](_0x32dbea);return _0x1e2990[_0x2080('0x1d')](_0x2080('0x1e'),_0x58444a+'-'+_0x3f41d6+'/'+_0x2e3be0)['json'](_0x8f729);}return null;};}function patchUpdates(_0x52002a){return function(_0x286ff2){try{jsonpatch[_0x2080('0x1f')](_0x286ff2,_0x52002a,!![]);}catch(_0x3bedd0){return BPromise[_0x2080('0x20')](_0x3bedd0);}return _0x286ff2[_0x2080('0x21')]();};}function saveUpdates(_0x19f36c,_0x1ec107){return function(_0xb3a6ff){if(_0xb3a6ff){return _0xb3a6ff[_0x2080('0x22')](_0x19f36c)[_0x2080('0x23')](function(_0x5162ce){return _0x5162ce;});}return null;};}function removeEntity(_0x177c72,_0x1ea37e){return function(_0x6f78a9){if(_0x6f78a9){return _0x6f78a9[_0x2080('0x24')]()[_0x2080('0x23')](function(){_0x177c72['status'](0xcc)[_0x2080('0x18')]();});}};}function handleEntityNotFound(_0x2d21a6,_0x3992ad){return function(_0x2376ef){if(!_0x2376ef){_0x2d21a6[_0x2080('0x16')](0x194);}return _0x2376ef;};}function handleError(_0x2fbf14,_0x22c7da){_0x22c7da=_0x22c7da||0x1f4;return function(_0x3bb5bc){logger['error'](_0x3bb5bc[_0x2080('0x25')]);if(_0x3bb5bc[_0x2080('0x26')]){delete _0x3bb5bc[_0x2080('0x26')];}_0x2fbf14[_0x2080('0x17')](_0x22c7da)['send'](_0x3bb5bc);};}exports[_0x2080('0x27')]=function(_0x566309,_0x18c684){var _0x3a45f9={'raw':!![],'where':{'id':_0x566309[_0x2080('0x28')]['id']}},_0x3fb6f8={};_0x3fb6f8[_0x2080('0x29')]=_[_0x2080('0x2a')](db['ChatApplication'][_0x2080('0x2b')]);_0x3fb6f8[_0x2080('0x2c')]=_[_0x2080('0x2a')](_0x566309[_0x2080('0x2c')]);_0x3fb6f8[_0x2080('0x2d')]=_['intersection'](_0x3fb6f8[_0x2080('0x29')],_0x3fb6f8[_0x2080('0x2c')]);_0x3a45f9[_0x2080('0x2e')]=_['intersection'](_0x3fb6f8[_0x2080('0x29')],qs[_0x2080('0x2f')](_0x566309['query'][_0x2080('0x2f')]));_0x3a45f9[_0x2080('0x2e')]=_0x3a45f9[_0x2080('0x2e')]['length']?_0x3a45f9[_0x2080('0x2e')]:_0x3fb6f8['model'];if(_0x566309[_0x2080('0x2c')][_0x2080('0x30')]){_0x3a45f9[_0x2080('0x31')]=[{'all':!![]}];}_0x3a45f9=_[_0x2080('0x32')]({},_0x3a45f9,_0x566309[_0x2080('0x33')]);return db[_0x2080('0x34')][_0x2080('0x35')](_0x3a45f9)[_0x2080('0x23')](handleEntityNotFound(_0x18c684,null))[_0x2080('0x23')](respondWithResult(_0x18c684,null))['catch'](handleError(_0x18c684,null));};exports[_0x2080('0x22')]=function(_0x4cfb72,_0xc2edd){if(_0x4cfb72['body']['id']){delete _0x4cfb72[_0x2080('0x36')]['id'];}return db['ChatApplication'][_0x2080('0x35')]({'where':{'id':_0x4cfb72[_0x2080('0x28')]['id']}})['then'](handleEntityNotFound(_0xc2edd,null))['then'](saveUpdates(_0x4cfb72['body'],null))[_0x2080('0x23')](respondWithResult(_0xc2edd,null))[_0x2080('0x37')](handleError(_0xc2edd,null));};exports[_0x2080('0x24')]=function(_0xcf9102,_0x1f0d34){return db[_0x2080('0x34')][_0x2080('0x35')]({'where':{'id':_0xcf9102[_0x2080('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f0d34,null))[_0x2080('0x23')](removeEntity(_0x1f0d34,null))['catch'](handleError(_0x1f0d34,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 8ddec01..a901823 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1cbf6b2..930a482 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 _0x5f23=['../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatApplication,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x122d2b,_0x70044d){var _0x55ac23=function(_0x1a954b){while(--_0x1a954b){_0x122d2b['push'](_0x122d2b['shift']());}};_0x55ac23(++_0x70044d);}(_0x5f23,0xb7));var _0x35f2=function(_0x418a0e,_0x45a42e){_0x418a0e=_0x418a0e-0x0;var _0x1c76e9=_0x5f23[_0x418a0e];return _0x1c76e9;};'use strict';var _=require('lodash');var util=require(_0x35f2('0x0'));var moment=require(_0x35f2('0x1'));var BPromise=require(_0x35f2('0x2'));var rs=require(_0x35f2('0x3'));var fs=require('fs');var Redis=require(_0x35f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35f2('0x5'));var logger=require(_0x35f2('0x6'))(_0x35f2('0x7'));var config=require(_0x35f2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x35f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1839dc,_0x125995,_0x418063){return new BPromise(function(_0x636fd7,_0x5282ec){return client[_0x35f2('0xa')](_0x1839dc,_0x418063)[_0x35f2('0xb')](function(_0x4e7723){logger['info']('ChatApplication,\x20%s,\x20%s',_0x125995,_0x35f2('0xc'));logger[_0x35f2('0xd')](_0x35f2('0xe'),_0x125995,_0x35f2('0xc'),JSON[_0x35f2('0xf')](_0x4e7723));if(_0x4e7723[_0x35f2('0x10')]){if(_0x4e7723[_0x35f2('0x10')]['code']===0x1f4){logger[_0x35f2('0x10')]('ChatApplication,\x20%s,\x20%s',_0x125995,_0x4e7723[_0x35f2('0x10')][_0x35f2('0x11')]);return _0x5282ec(_0x4e7723['error']['message']);}logger[_0x35f2('0x10')]('ChatApplication,\x20%s,\x20%s',_0x125995,_0x4e7723['error'][_0x35f2('0x11')]);return _0x636fd7(_0x4e7723['error'][_0x35f2('0x11')]);}else{logger['info'](_0x35f2('0x12'),_0x125995,_0x35f2('0xc'));_0x636fd7(_0x4e7723[_0x35f2('0x13')][_0x35f2('0x11')]);}})[_0x35f2('0x14')](function(_0x3bfdd5){logger[_0x35f2('0x10')](_0x35f2('0x12'),_0x125995,_0x3bfdd5);_0x5282ec(_0x3bfdd5);});});} \ No newline at end of file +var _0x0399=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xf0ca90,_0x51f9a8){var _0x397828=function(_0x3010ec){while(--_0x3010ec){_0xf0ca90['push'](_0xf0ca90['shift']());}};_0x397828(++_0x51f9a8);}(_0x0399,0x1a9));var _0x9039=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0399[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x9039('0x0'));var util=require(_0x9039('0x1'));var moment=require(_0x9039('0x2'));var BPromise=require(_0x9039('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9039('0x4'))['db'];var utils=require(_0x9039('0x5'));var logger=require(_0x9039('0x6'))(_0x9039('0x7'));var config=require(_0x9039('0x8'));var jayson=require(_0x9039('0x9'));var client=jayson[_0x9039('0xa')][_0x9039('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b3f10,_0x34dd5d,_0x3d0c6f){return new BPromise(function(_0x591be9,_0x41a17e){return client[_0x9039('0xc')](_0x5b3f10,_0x3d0c6f)[_0x9039('0xd')](function(_0x1ea405){logger[_0x9039('0xe')](_0x9039('0xf'),_0x34dd5d,_0x9039('0x10'));logger[_0x9039('0x11')](_0x9039('0x12'),_0x34dd5d,'request\x20sent',JSON[_0x9039('0x13')](_0x1ea405));if(_0x1ea405[_0x9039('0x14')]){if(_0x1ea405[_0x9039('0x14')]['code']===0x1f4){logger[_0x9039('0x14')](_0x9039('0xf'),_0x34dd5d,_0x1ea405[_0x9039('0x14')][_0x9039('0x15')]);return _0x41a17e(_0x1ea405[_0x9039('0x14')][_0x9039('0x15')]);}logger[_0x9039('0x14')](_0x9039('0xf'),_0x34dd5d,_0x1ea405[_0x9039('0x14')][_0x9039('0x15')]);return _0x591be9(_0x1ea405['error'][_0x9039('0x15')]);}else{logger[_0x9039('0xe')](_0x9039('0xf'),_0x34dd5d,_0x9039('0x10'));_0x591be9(_0x1ea405[_0x9039('0x16')]['message']);}})[_0x9039('0x17')](function(_0x24a611){logger[_0x9039('0x14')](_0x9039('0xf'),_0x34dd5d,_0x24a611);_0x41a17e(_0x24a611);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 2be6d7a..c13546d 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 _0xb4eb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1218f9,_0x10d7c){var _0x9c5283=function(_0x2f0418){while(--_0x2f0418){_0x1218f9['push'](_0x1218f9['shift']());}};_0x9c5283(++_0x10d7c);}(_0xb4eb,0x13c));var _0xbb4e=function(_0x49ce1b,_0xd3e4c0){_0x49ce1b=_0x49ce1b-0x0;var _0x5d49cb=_0xb4eb[_0x49ce1b];return _0x5d49cb;};'use strict';var multer=require(_0xbb4e('0x0'));var util=require(_0xbb4e('0x1'));var path=require(_0xbb4e('0x2'));var timeout=require(_0xbb4e('0x3'));var express=require('express');var router=express[_0xbb4e('0x4')]();var auth=require(_0xbb4e('0x5'));var interaction=require(_0xbb4e('0x6'));var config=require(_0xbb4e('0x7'));var controller=require(_0xbb4e('0x8'));router[_0xbb4e('0x9')](_0xbb4e('0xa'),auth[_0xbb4e('0xb')](),controller[_0xbb4e('0xc')]);router[_0xbb4e('0xd')](_0xbb4e('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbb4e('0xb')](),controller[_0xbb4e('0xe')]);module[_0xbb4e('0xf')]=router; \ No newline at end of file +var _0xa446=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','/:id','update','delete'];(function(_0x57e6c8,_0xfc066e){var _0x592ecf=function(_0x57662f){while(--_0x57662f){_0x57e6c8['push'](_0x57e6c8['shift']());}};_0x592ecf(++_0xfc066e);}(_0xa446,0x16a));var _0x6a44=function(_0x26bde5,_0x2b2c7b){_0x26bde5=_0x26bde5-0x0;var _0x29cb8d=_0xa446[_0x26bde5];return _0x29cb8d;};'use strict';var multer=require(_0x6a44('0x0'));var util=require(_0x6a44('0x1'));var path=require(_0x6a44('0x2'));var timeout=require('connect-timeout');var express=require(_0x6a44('0x3'));var router=express[_0x6a44('0x4')]();var auth=require(_0x6a44('0x5'));var interaction=require(_0x6a44('0x6'));var config=require(_0x6a44('0x7'));var controller=require('./chatApplication.controller');router['get']('/:id',auth[_0x6a44('0x8')](),controller[_0x6a44('0x9')]);router['put'](_0x6a44('0xa'),auth['isAuthenticated'](),controller[_0x6a44('0xb')]);router[_0x6a44('0xc')](_0x6a44('0xa'),auth['isAuthenticated'](),controller[_0x6a44('0xd')]);module[_0x6a44('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 1e7093e..ca2ef5b 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 _0xfc07=['sequelize','exports','STRING'];(function(_0x22c8ae,_0x43eea5){var _0x5ff215=function(_0x504bc6){while(--_0x504bc6){_0x22c8ae['push'](_0x22c8ae['shift']());}};_0x5ff215(++_0x43eea5);}(_0xfc07,0xb4));var _0x7fc0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfc07[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x7fc0('0x0'));module[_0x7fc0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7fc0('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xbf01=['sequelize','exports','STRING'];(function(_0x44da1e,_0x19dd10){var _0x230b02=function(_0x4b449c){while(--_0x4b449c){_0x44da1e['push'](_0x44da1e['shift']());}};_0x230b02(++_0x19dd10);}(_0xbf01,0x19e));var _0x1bf0=function(_0x580971,_0x10984d){_0x580971=_0x580971-0x0;var _0x16d873=_0xbf01[_0x580971];return _0x16d873;};'use strict';var Sequelize=require(_0x1bf0('0x0'));module[_0x1bf0('0x1')]={'name':{'type':Sequelize[_0x1bf0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1bf0('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 d1d1d4d..5d42c95 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 _0xaa6c=['removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User'];(function(_0x4a4051,_0x270271){var _0x81dd5=function(_0x123a14){while(--_0x123a14){_0x4a4051['push'](_0x4a4051['shift']());}};_0x81dd5(++_0x270271);}(_0xaa6c,0x1ab));var _0xcaa6=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xaa6c[_0x5a3cf0];return _0x5a64ee;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcaa6('0x0'));var rp=require(_0xcaa6('0x1'));var moment=require('moment');var BPromise=require(_0xcaa6('0x2'));var Mustache=require(_0xcaa6('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcaa6('0x4'));var csv=require('to-csv');var ejs=require(_0xcaa6('0x5'));var fs=require('fs');var _=require(_0xcaa6('0x6'));var squel=require(_0xcaa6('0x7'));var crypto=require(_0xcaa6('0x8'));var jsforce=require(_0xcaa6('0x9'));var deskjs=require(_0xcaa6('0xa'));var toCsv=require(_0xcaa6('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcaa6('0xc'));var qs=require(_0xcaa6('0xd'));var as=require(_0xcaa6('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaa6('0xf'))(_0xcaa6('0x10'));var utils=require(_0xcaa6('0x11'));var config=require(_0xcaa6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcaa6('0x13')]=_[_0xcaa6('0x14')](config[_0xcaa6('0x13')],{'host':_0xcaa6('0x15'),'port':0x18eb});var socket=require(_0xcaa6('0x16'))(new Redis(config[_0xcaa6('0x13')]));require(_0xcaa6('0x17'))[_0xcaa6('0x18')](socket);var jayson=require(_0xcaa6('0x19'));var client=jayson[_0xcaa6('0x1a')][_0xcaa6('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3f9754,_0xb84c1d,_0x1c0957,_0x47a3af){return new BPromise(function(_0x3c60b1,_0x4e615f){var _0x37f865=_0x47a3af||client;return _0x37f865[_0xcaa6('0x1c')](_0x3f9754,_0x1c0957)[_0xcaa6('0x1d')](function(_0x240875){logger[_0xcaa6('0x1e')](_0xcaa6('0x1f'),_0xb84c1d,'request\x20sent');logger[_0xcaa6('0x20')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0xb84c1d,_0xcaa6('0x21'),JSON[_0xcaa6('0x22')](_0x240875));if(_0x240875['error']){if(_0x240875[_0xcaa6('0x23')]['code']===0x1f4){logger[_0xcaa6('0x23')](_0xcaa6('0x1f'),_0xb84c1d,_0x240875[_0xcaa6('0x23')][_0xcaa6('0x24')]);return _0x4e615f(_0x240875[_0xcaa6('0x23')][_0xcaa6('0x24')]);}logger[_0xcaa6('0x23')](_0xcaa6('0x1f'),_0xb84c1d,_0x240875[_0xcaa6('0x23')][_0xcaa6('0x24')]);return _0x3c60b1(_0x240875[_0xcaa6('0x23')]['message']);}else{logger[_0xcaa6('0x1e')](_0xcaa6('0x1f'),_0xb84c1d,_0xcaa6('0x21'));_0x3c60b1(_0x240875[_0xcaa6('0x25')][_0xcaa6('0x24')]);}})['catch'](function(_0x1de3ba){logger[_0xcaa6('0x23')]('ChatGroup,\x20%s,\x20%s',_0xb84c1d,_0x1de3ba);_0x4e615f(_0x1de3ba);});});}function respondWithStatusCode(_0x42c360,_0x3f2fce){_0x3f2fce=_0x3f2fce||0xcc;return function(_0x26fab7){if(_0x26fab7){return _0x42c360[_0xcaa6('0x26')](_0x3f2fce);}return _0x42c360[_0xcaa6('0x27')](_0x3f2fce)[_0xcaa6('0x28')]();};}function respondWithResult(_0x12ee38,_0x1d771d){_0x1d771d=_0x1d771d||0xc8;return function(_0x1d7205){if(_0x1d7205){return _0x12ee38['status'](_0x1d771d)['json'](_0x1d7205);}};}function respondWithFilteredResult(_0x55b64b,_0x1b9b3a){return function(_0x446e77){if(_0x446e77){var _0x2cbb13=_0x446e77['count'],_0x47240e=_0x1b9b3a[_0xcaa6('0x29')],_0x1dd103=_0x1b9b3a[_0xcaa6('0x29')]+_0x1b9b3a[_0xcaa6('0x2a')],_0x3e6d89;if(_0x1dd103>=_0x2cbb13){_0x1dd103=_0x2cbb13;_0x3e6d89=0xc8;}else{_0x3e6d89=0xce;}_0x55b64b['status'](_0x3e6d89);return _0x55b64b[_0xcaa6('0x2b')](_0xcaa6('0x2c'),_0x47240e+'-'+_0x1dd103+'/'+_0x2cbb13)['json'](_0x446e77);}return null;};}function patchUpdates(_0x303f94){return function(_0x2aced7){try{jsonpatch[_0xcaa6('0x2d')](_0x2aced7,_0x303f94,!![]);}catch(_0x3339db){return BPromise[_0xcaa6('0x2e')](_0x3339db);}return _0x2aced7[_0xcaa6('0x2f')]();};}function saveUpdates(_0x23a501,_0x3d6594){return function(_0x587198){if(_0x587198){return _0x587198[_0xcaa6('0x30')](_0x23a501)[_0xcaa6('0x1d')](function(_0x1756a2){return _0x1756a2;});}return null;};}function removeEntity(_0x2fc594,_0xdca1d7){return function(_0x1be49f){if(_0x1be49f){return _0x1be49f[_0xcaa6('0x31')]()[_0xcaa6('0x1d')](function(){_0x2fc594[_0xcaa6('0x27')](0xcc)[_0xcaa6('0x28')]();});}};}function handleEntityNotFound(_0x4c9f85,_0x599e4b){return function(_0x13ec70){if(!_0x13ec70){_0x4c9f85['sendStatus'](0x194);}return _0x13ec70;};}function handleError(_0x17e888,_0x3fd8bb){_0x3fd8bb=_0x3fd8bb||0x1f4;return function(_0x165611){logger[_0xcaa6('0x23')](_0x165611[_0xcaa6('0x32')]);if(_0x165611[_0xcaa6('0x33')]){delete _0x165611[_0xcaa6('0x33')];}_0x17e888[_0xcaa6('0x27')](_0x3fd8bb)[_0xcaa6('0x34')](_0x165611);};}exports[_0xcaa6('0x35')]=function(_0x1bf3e7,_0x759995){var _0x43ea43={},_0x16632b={},_0x3ba8a3={'count':0x0,'rows':[]};var _0x5f82fa=_['map'](db[_0xcaa6('0x36')][_0xcaa6('0x37')],function(_0x3f8bec){return{'name':_0x3f8bec[_0xcaa6('0x38')],'type':_0x3f8bec[_0xcaa6('0x39')][_0xcaa6('0x3a')]};});_0x16632b[_0xcaa6('0x3b')]=_[_0xcaa6('0x3c')](_0x5f82fa,_0xcaa6('0x33'));_0x16632b[_0xcaa6('0x3d')]=_[_0xcaa6('0x3e')](_0x1bf3e7[_0xcaa6('0x3d')]);_0x16632b[_0xcaa6('0x3f')]=_['intersection'](_0x16632b[_0xcaa6('0x3b')],_0x16632b['query']);_0x43ea43[_0xcaa6('0x40')]=_[_0xcaa6('0x41')](_0x16632b[_0xcaa6('0x3b')],qs[_0xcaa6('0x42')](_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x42')]));_0x43ea43[_0xcaa6('0x40')]=_0x43ea43[_0xcaa6('0x40')][_0xcaa6('0x43')]?_0x43ea43['attributes']:_0x16632b['model'];if(!_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x44')](_0xcaa6('0x45'))){_0x43ea43[_0xcaa6('0x2a')]=qs[_0xcaa6('0x2a')](_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x2a')]);_0x43ea43[_0xcaa6('0x29')]=qs[_0xcaa6('0x29')](_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x29')]);}_0x43ea43[_0xcaa6('0x46')]=qs[_0xcaa6('0x47')](_0x1bf3e7['query'][_0xcaa6('0x47')]);_0x43ea43[_0xcaa6('0x48')]=qs[_0xcaa6('0x3f')](_[_0xcaa6('0x49')](_0x1bf3e7[_0xcaa6('0x3d')],_0x16632b['filters']),_0x5f82fa);if(_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x4a')]){_0x43ea43[_0xcaa6('0x48')]=_[_0xcaa6('0x4b')](_0x43ea43[_0xcaa6('0x48')],{'$or':_[_0xcaa6('0x3c')](_0x5f82fa,function(_0x19a410){if(_0x19a410[_0xcaa6('0x39')]!==_0xcaa6('0x4c')){var _0x4d50a7={};_0x4d50a7[_0x19a410[_0xcaa6('0x33')]]={'$like':'%'+_0x1bf3e7[_0xcaa6('0x3d')][_0xcaa6('0x4a')]+'%'};return _0x4d50a7;}})});}_0x43ea43=_[_0xcaa6('0x4b')]({},_0x43ea43,_0x1bf3e7[_0xcaa6('0x4d')]);var _0x4bce60={'where':_0x43ea43[_0xcaa6('0x48')]};return db[_0xcaa6('0x36')][_0xcaa6('0x4e')](_0x4bce60)[_0xcaa6('0x1d')](function(_0x1b3225){_0x3ba8a3[_0xcaa6('0x4e')]=_0x1b3225;if(_0x1bf3e7[_0xcaa6('0x3d')]['includeAll']){_0x43ea43[_0xcaa6('0x4f')]=[{'all':!![]}];}return db[_0xcaa6('0x36')][_0xcaa6('0x50')](_0x43ea43);})[_0xcaa6('0x1d')](function(_0x4c103c){_0x3ba8a3[_0xcaa6('0x51')]=_0x4c103c;return _0x3ba8a3;})[_0xcaa6('0x1d')](respondWithFilteredResult(_0x759995,_0x43ea43))[_0xcaa6('0x52')](handleError(_0x759995,null));};exports['show']=function(_0x1eb900,_0x35f9fb){var _0x51b31b={'raw':!![],'where':{'id':_0x1eb900[_0xcaa6('0x53')]['id']}},_0xcd6e44={};_0xcd6e44[_0xcaa6('0x3b')]=_[_0xcaa6('0x3e')](db[_0xcaa6('0x36')]['rawAttributes']);_0xcd6e44['query']=_[_0xcaa6('0x3e')](_0x1eb900[_0xcaa6('0x3d')]);_0xcd6e44['filtears']=_[_0xcaa6('0x41')](_0xcd6e44[_0xcaa6('0x3b')],_0xcd6e44['query']);_0x51b31b[_0xcaa6('0x40')]=_[_0xcaa6('0x41')](_0xcd6e44[_0xcaa6('0x3b')],qs[_0xcaa6('0x42')](_0x1eb900[_0xcaa6('0x3d')][_0xcaa6('0x42')]));_0x51b31b[_0xcaa6('0x40')]=_0x51b31b[_0xcaa6('0x40')]['length']?_0x51b31b[_0xcaa6('0x40')]:_0xcd6e44[_0xcaa6('0x3b')];if(_0x1eb900['query'][_0xcaa6('0x54')]){_0x51b31b['include']=[{'all':!![]}];}_0x51b31b=_[_0xcaa6('0x4b')]({},_0x51b31b,_0x1eb900[_0xcaa6('0x4d')]);return db[_0xcaa6('0x36')][_0xcaa6('0x55')](_0x51b31b)['then'](handleEntityNotFound(_0x35f9fb,null))['then'](respondWithResult(_0x35f9fb,null))[_0xcaa6('0x52')](handleError(_0x35f9fb,null));};exports[_0xcaa6('0x56')]=function(_0x42868b,_0x2cb208){return db[_0xcaa6('0x36')][_0xcaa6('0x56')](_0x42868b[_0xcaa6('0x57')],{})[_0xcaa6('0x1d')](respondWithResult(_0x2cb208,0xc9))['catch'](handleError(_0x2cb208,null));};exports[_0xcaa6('0x30')]=function(_0x36712f,_0x5d97a1){if(_0x36712f['body']['id']){delete _0x36712f[_0xcaa6('0x57')]['id'];}return db[_0xcaa6('0x36')][_0xcaa6('0x55')]({'where':{'id':_0x36712f[_0xcaa6('0x53')]['id']}})[_0xcaa6('0x1d')](handleEntityNotFound(_0x5d97a1,null))[_0xcaa6('0x1d')](saveUpdates(_0x36712f[_0xcaa6('0x57')],null))[_0xcaa6('0x1d')](respondWithResult(_0x5d97a1,null))['catch'](handleError(_0x5d97a1,null));};exports[_0xcaa6('0x31')]=function(_0x438eb3,_0x4719b8){return db[_0xcaa6('0x36')][_0xcaa6('0x55')]({'where':{'id':_0x438eb3['params']['id']}})['then'](handleEntityNotFound(_0x4719b8,null))[_0xcaa6('0x1d')](removeEntity(_0x4719b8,null))[_0xcaa6('0x52')](handleError(_0x4719b8,null));};exports['describe']=function(_0x5d0d17,_0x20b3fe){return db[_0xcaa6('0x36')]['describe']()[_0xcaa6('0x1d')](respondWithResult(_0x20b3fe,null))['catch'](handleError(_0x20b3fe,null));};exports[_0xcaa6('0x58')]=function(_0x2d4bc3,_0x5f046d,_0x61b04b){return db[_0xcaa6('0x59')][_0xcaa6('0x4e')]({'where':{'ChatGroupId':_0x2d4bc3[_0xcaa6('0x53')]['id'],'ToId':_0x2d4bc3[_0xcaa6('0x5a')]['id'],'read':![]}})[_0xcaa6('0x1d')](function(_0x26ccaf){return{'id':_[_0xcaa6('0x5b')](_0x2d4bc3[_0xcaa6('0x53')]['id']),'count':_0x26ccaf};})['then'](respondWithResult(_0x5f046d,null))['catch'](handleError(_0x5f046d,null));};exports[_0xcaa6('0x5c')]=function(_0x49e5af,_0x134558,_0x2f43c){return db[_0xcaa6('0x36')][_0xcaa6('0x55')]({'where':{'id':_0x49e5af['params']['id']}})[_0xcaa6('0x1d')](handleEntityNotFound(_0x134558,null))[_0xcaa6('0x1d')](function(_0x2aa7cb){if(_0x2aa7cb){return _0x2aa7cb['addMembers'](_0x49e5af['body'][_0xcaa6('0x5d')],_[_0xcaa6('0x5e')](_0x49e5af[_0xcaa6('0x57')],[_0xcaa6('0x5d'),'id'])||{});}})[_0xcaa6('0x1d')](respondWithResult(_0x134558,null))['catch'](handleError(_0x134558,null));};exports[_0xcaa6('0x5f')]=function(_0x4b751a,_0x457e25,_0x513c35){var _0x217f56={};var _0x1b6c3f={};var _0x198a05;var _0x285c1e;return db[_0xcaa6('0x36')][_0xcaa6('0x60')]({'where':{'id':_0x4b751a[_0xcaa6('0x53')]['id']}})[_0xcaa6('0x1d')](handleEntityNotFound(_0x457e25,null))[_0xcaa6('0x1d')](function(_0x217646){if(_0x217646){_0x198a05=_0x217646;_0x1b6c3f[_0xcaa6('0x3b')]=_[_0xcaa6('0x3e')](db[_0xcaa6('0x61')][_0xcaa6('0x37')]);_0x1b6c3f['query']=_[_0xcaa6('0x3e')](_0x4b751a[_0xcaa6('0x3d')]);_0x1b6c3f[_0xcaa6('0x3f')]=_[_0xcaa6('0x41')](_0x1b6c3f[_0xcaa6('0x3b')],_0x1b6c3f[_0xcaa6('0x3d')]);_0x217f56[_0xcaa6('0x40')]=_[_0xcaa6('0x41')](_0x1b6c3f[_0xcaa6('0x3b')],qs[_0xcaa6('0x42')](_0x4b751a[_0xcaa6('0x3d')]['fields']));_0x217f56[_0xcaa6('0x40')]=_0x217f56[_0xcaa6('0x40')][_0xcaa6('0x43')]?_0x217f56[_0xcaa6('0x40')]:_0x1b6c3f[_0xcaa6('0x3b')];_0x217f56['order']=qs[_0xcaa6('0x47')](_0x4b751a['query'][_0xcaa6('0x47')]);_0x217f56['where']=qs[_0xcaa6('0x3f')](_[_0xcaa6('0x49')](_0x4b751a[_0xcaa6('0x3d')],_0x1b6c3f[_0xcaa6('0x3f')]));if(_0x4b751a[_0xcaa6('0x3d')][_0xcaa6('0x4a')]){_0x217f56[_0xcaa6('0x48')]=_[_0xcaa6('0x4b')](_0x217f56['where'],{'$or':_[_0xcaa6('0x3c')](_0x217f56[_0xcaa6('0x40')],function(_0x46d0c3){var _0x56cb64={};_0x56cb64[_0x46d0c3]={'$like':'%'+_0x4b751a[_0xcaa6('0x3d')]['filter']+'%'};return _0x56cb64;})});}_0x217f56=_['merge']({},_0x217f56,_0x4b751a[_0xcaa6('0x4d')]);return _0x198a05[_0xcaa6('0x5f')](_0x217f56);}})['then'](function(_0x12ee3a){if(_0x12ee3a){_0x285c1e=_0x12ee3a[_0xcaa6('0x43')];if(!_0x4b751a['query'][_0xcaa6('0x44')]('nolimit')){_0x217f56['limit']=qs[_0xcaa6('0x2a')](_0x4b751a['query'][_0xcaa6('0x2a')]);_0x217f56[_0xcaa6('0x29')]=qs[_0xcaa6('0x29')](_0x4b751a[_0xcaa6('0x3d')][_0xcaa6('0x29')]);}return _0x198a05[_0xcaa6('0x5f')](_0x217f56);}})[_0xcaa6('0x1d')](function(_0x1c619f){if(_0x1c619f){return _0x1c619f?{'count':_0x285c1e,'rows':_0x1c619f}:null;}})[_0xcaa6('0x1d')](respondWithResult(_0x457e25,null))[_0xcaa6('0x52')](handleError(_0x457e25,null));};exports[_0xcaa6('0x62')]=function(_0x8e2645,_0x3ef463,_0x4848e8){return db['ChatGroup'][_0xcaa6('0x55')]({'where':{'id':_0x8e2645[_0xcaa6('0x53')]['id']}})['then'](handleEntityNotFound(_0x3ef463,null))[_0xcaa6('0x1d')](function(_0x5e50a6){if(_0x5e50a6){return _0x5e50a6[_0xcaa6('0x62')](_0x8e2645[_0xcaa6('0x3d')][_0xcaa6('0x5d')]);}})['then'](respondWithStatusCode(_0x3ef463,null))[_0xcaa6('0x52')](handleError(_0x3ef463,null));};exports[_0xcaa6('0x63')]=function(_0x1d403b,_0x47ba1b,_0x3746fa){if(_0x1d403b[_0xcaa6('0x57')]['id']){delete _0x1d403b[_0xcaa6('0x57')]['id'];}return db[_0xcaa6('0x36')][_0xcaa6('0x55')]({'where':{'id':_0x1d403b['params']['id']}})[_0xcaa6('0x1d')](handleEntityNotFound(_0x47ba1b,null))[_0xcaa6('0x1d')](function(_0x4ee720){if(_0x4ee720){_0x1d403b[_0xcaa6('0x57')][_0xcaa6('0x64')]=_0x4ee720['id'];return db[_0xcaa6('0x59')][_0xcaa6('0x56')](_0x1d403b['body']);}})['then'](respondWithResult(_0x47ba1b,null))[_0xcaa6('0x52')](handleError(_0x47ba1b,null));};exports[_0xcaa6('0x65')]=function(_0x37cd74,_0x323d88,_0x1e7170){var _0x332a4b={};var _0x5a746c={};var _0x2c804f;var _0x23158b;return db['ChatGroup'][_0xcaa6('0x60')]({'where':{'id':_0x37cd74['params']['id']}})[_0xcaa6('0x1d')](handleEntityNotFound(_0x323d88,null))[_0xcaa6('0x1d')](function(_0x29b87e){if(_0x29b87e){_0x2c804f=_0x29b87e;_0x5a746c[_0xcaa6('0x3b')]=_[_0xcaa6('0x3e')](db['ChatInternalMessage'][_0xcaa6('0x37')]);_0x5a746c[_0xcaa6('0x3d')]=_[_0xcaa6('0x3e')](_0x37cd74[_0xcaa6('0x3d')]);_0x5a746c[_0xcaa6('0x3f')]=_[_0xcaa6('0x41')](_0x5a746c[_0xcaa6('0x3b')],_0x5a746c[_0xcaa6('0x3d')]);_0x332a4b[_0xcaa6('0x40')]=_['intersection'](_0x5a746c[_0xcaa6('0x3b')],qs[_0xcaa6('0x42')](_0x37cd74['query'][_0xcaa6('0x42')]));_0x332a4b[_0xcaa6('0x40')]=_0x332a4b['attributes'][_0xcaa6('0x43')]?_0x332a4b[_0xcaa6('0x40')]:_0x5a746c[_0xcaa6('0x3b')];_0x332a4b['order']=qs[_0xcaa6('0x47')](_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x47')]);_0x332a4b[_0xcaa6('0x48')]=qs[_0xcaa6('0x3f')](_[_0xcaa6('0x49')](_0x37cd74[_0xcaa6('0x3d')],_0x5a746c[_0xcaa6('0x3f')]));if(_0x37cd74[_0xcaa6('0x3d')]['filter']){_0x332a4b[_0xcaa6('0x48')]=_['merge'](_0x332a4b[_0xcaa6('0x48')],{'$or':_[_0xcaa6('0x3c')](_0x332a4b[_0xcaa6('0x40')],function(_0x505179){var _0x9b3571={};_0x9b3571[_0x505179]={'$like':'%'+_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x4a')]+'%'};return _0x9b3571;})});}if(_0x37cd74['query']['$gte']){var _0x31f78a=_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x66')]['split'](',');var _0x91c624={};_0x91c624[_0x31f78a[0x0]]={'$gte':moment(_0x31f78a[0x1])[_0xcaa6('0x67')](_0xcaa6('0x68'))};_0x332a4b[_0xcaa6('0x48')]=_[_0xcaa6('0x4b')](_0x332a4b[_0xcaa6('0x48')],_0x91c624);}_0x332a4b=_[_0xcaa6('0x4b')]({},_0x332a4b,_0x37cd74[_0xcaa6('0x4d')]);return _0x2c804f[_0xcaa6('0x65')](_0x332a4b);}})[_0xcaa6('0x1d')](function(_0x25be9b){if(_0x25be9b){_0x23158b=_0x25be9b[_0xcaa6('0x43')];if(!_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x44')](_0xcaa6('0x45'))){_0x332a4b[_0xcaa6('0x2a')]=qs['limit'](_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x2a')]);_0x332a4b[_0xcaa6('0x29')]=qs['offset'](_0x37cd74[_0xcaa6('0x3d')][_0xcaa6('0x29')]);}return _0x2c804f['getMessages'](_0x332a4b);}})['then'](function(_0x2cca75){if(_0x2cca75){return _0x2cca75?{'count':_0x23158b,'rows':_0x2cca75}:null;}})[_0xcaa6('0x1d')](respondWithResult(_0x323d88,null))[_0xcaa6('0x52')](handleError(_0x323d88,null));}; \ No newline at end of file +var _0x9740=['getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','destroy','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','rawAttributes','order','removeMembers','addMessage'];(function(_0x4626b1,_0x4bb1a5){var _0x40d952=function(_0x57eaf4){while(--_0x57eaf4){_0x4626b1['push'](_0x4626b1['shift']());}};_0x40d952(++_0x4bb1a5);}(_0x9740,0x140));var _0x0974=function(_0x447aa7,_0xbf3a16){_0x447aa7=_0x447aa7-0x0;var _0x5b944c=_0x9740[_0x447aa7];return _0x5b944c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0974('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0974('0x1'));var jsonpatch=require(_0x0974('0x2'));var rp=require(_0x0974('0x3'));var moment=require(_0x0974('0x4'));var BPromise=require(_0x0974('0x5'));var Mustache=require(_0x0974('0x6'));var util=require('util');var path=require(_0x0974('0x7'));var sox=require(_0x0974('0x8'));var csv=require('to-csv');var ejs=require(_0x0974('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0974('0xa'));var crypto=require(_0x0974('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0974('0xc'));var querystring=require(_0x0974('0xd'));var Papa=require(_0x0974('0xe'));var Redis=require(_0x0974('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0974('0x10'));var hardwareService=require(_0x0974('0x11'));var logger=require(_0x0974('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x0974('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0974('0x14'))['db'];config['redis']=_['defaults'](config[_0x0974('0x15')],{'host':_0x0974('0x16'),'port':0x18eb});var socket=require(_0x0974('0x17'))(new Redis(config[_0x0974('0x15')]));require(_0x0974('0x18'))[_0x0974('0x19')](socket);var jayson=require(_0x0974('0x1a'));var client=jayson[_0x0974('0x1b')][_0x0974('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x49333e,_0x5abe33,_0x572105,_0x2d6614){return new BPromise(function(_0x2c76c7,_0x5691b1){var _0x466975=_0x2d6614||client;return _0x466975[_0x0974('0x1d')](_0x49333e,_0x572105)['then'](function(_0x3c3aa6){logger[_0x0974('0x1e')](_0x0974('0x1f'),_0x5abe33,'request\x20sent');logger[_0x0974('0x20')](_0x0974('0x21'),_0x5abe33,_0x0974('0x22'),JSON[_0x0974('0x23')](_0x3c3aa6));if(_0x3c3aa6[_0x0974('0x24')]){if(_0x3c3aa6['error']['code']===0x1f4){logger[_0x0974('0x24')](_0x0974('0x1f'),_0x5abe33,_0x3c3aa6[_0x0974('0x24')][_0x0974('0x25')]);return _0x5691b1(_0x3c3aa6[_0x0974('0x24')][_0x0974('0x25')]);}logger['error'](_0x0974('0x1f'),_0x5abe33,_0x3c3aa6[_0x0974('0x24')][_0x0974('0x25')]);return _0x2c76c7(_0x3c3aa6[_0x0974('0x24')][_0x0974('0x25')]);}else{logger[_0x0974('0x1e')](_0x0974('0x1f'),_0x5abe33,_0x0974('0x22'));_0x2c76c7(_0x3c3aa6[_0x0974('0x26')][_0x0974('0x25')]);}})[_0x0974('0x27')](function(_0x387cb8){logger[_0x0974('0x24')](_0x0974('0x1f'),_0x5abe33,_0x387cb8);_0x5691b1(_0x387cb8);});});}function respondWithStatusCode(_0x5f5005,_0x277e53){_0x277e53=_0x277e53||0xcc;return function(_0x11c0ec){if(_0x11c0ec){return _0x5f5005[_0x0974('0x28')](_0x277e53);}return _0x5f5005[_0x0974('0x29')](_0x277e53)['end']();};}function respondWithResult(_0x4680fe,_0x3736cd){_0x3736cd=_0x3736cd||0xc8;return function(_0x274e21){if(_0x274e21){return _0x4680fe[_0x0974('0x29')](_0x3736cd)['json'](_0x274e21);}};}function respondWithFilteredResult(_0x3b000a,_0x28f813){return function(_0x1d6761){if(_0x1d6761){var _0x26a7a6=_0x1d6761[_0x0974('0x2a')],_0x34d2a7=_0x28f813[_0x0974('0x2b')],_0x3ac645=_0x28f813[_0x0974('0x2b')]+_0x28f813[_0x0974('0x2c')],_0x45775a;if(_0x3ac645>=_0x26a7a6){_0x3ac645=_0x26a7a6;_0x45775a=0xc8;}else{_0x45775a=0xce;}_0x3b000a[_0x0974('0x29')](_0x45775a);return _0x3b000a[_0x0974('0x2d')]('Content-Range',_0x34d2a7+'-'+_0x3ac645+'/'+_0x26a7a6)[_0x0974('0x2e')](_0x1d6761);}return null;};}function patchUpdates(_0x1448bb){return function(_0x4326e9){try{jsonpatch['apply'](_0x4326e9,_0x1448bb,!![]);}catch(_0x3ed500){return BPromise[_0x0974('0x2f')](_0x3ed500);}return _0x4326e9[_0x0974('0x30')]();};}function saveUpdates(_0x302a96,_0x35b8c2){return function(_0x3679b0){if(_0x3679b0){return _0x3679b0[_0x0974('0x31')](_0x302a96)[_0x0974('0x32')](function(_0x502c48){return _0x502c48;});}return null;};}function removeEntity(_0xde15c6,_0x11825d){return function(_0x45f879){if(_0x45f879){return _0x45f879[_0x0974('0x33')]()['then'](function(){_0xde15c6[_0x0974('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5115bd,_0x53a691){return function(_0x286b19){if(!_0x286b19){_0x5115bd[_0x0974('0x28')](0x194);}return _0x286b19;};}function handleError(_0x849655,_0x47b91b){_0x47b91b=_0x47b91b||0x1f4;return function(_0x4fe741){logger[_0x0974('0x24')](_0x4fe741[_0x0974('0x34')]);if(_0x4fe741[_0x0974('0x35')]){delete _0x4fe741['name'];}_0x849655[_0x0974('0x29')](_0x47b91b)[_0x0974('0x36')](_0x4fe741);};}exports[_0x0974('0x37')]=function(_0x4f1ec6,_0x211a58){var _0x41e77e={},_0x5d7e67={},_0x38282c={'count':0x0,'rows':[]};var _0x5af38f=_[_0x0974('0x38')](db[_0x0974('0x39')]['rawAttributes'],function(_0x4dfd42){return{'name':_0x4dfd42[_0x0974('0x3a')],'type':_0x4dfd42[_0x0974('0x3b')][_0x0974('0x3c')]};});_0x5d7e67[_0x0974('0x3d')]=_[_0x0974('0x38')](_0x5af38f,'name');_0x5d7e67[_0x0974('0x3e')]=_[_0x0974('0x3f')](_0x4f1ec6[_0x0974('0x3e')]);_0x5d7e67[_0x0974('0x40')]=_[_0x0974('0x41')](_0x5d7e67[_0x0974('0x3d')],_0x5d7e67['query']);_0x41e77e[_0x0974('0x42')]=_[_0x0974('0x41')](_0x5d7e67['model'],qs[_0x0974('0x43')](_0x4f1ec6['query'][_0x0974('0x43')]));_0x41e77e[_0x0974('0x42')]=_0x41e77e[_0x0974('0x42')][_0x0974('0x44')]?_0x41e77e[_0x0974('0x42')]:_0x5d7e67[_0x0974('0x3d')];if(!_0x4f1ec6[_0x0974('0x3e')][_0x0974('0x45')](_0x0974('0x46'))){_0x41e77e[_0x0974('0x2c')]=qs[_0x0974('0x2c')](_0x4f1ec6[_0x0974('0x3e')]['limit']);_0x41e77e['offset']=qs[_0x0974('0x2b')](_0x4f1ec6[_0x0974('0x3e')][_0x0974('0x2b')]);}_0x41e77e['order']=qs[_0x0974('0x47')](_0x4f1ec6['query'][_0x0974('0x47')]);_0x41e77e['where']=qs[_0x0974('0x40')](_[_0x0974('0x48')](_0x4f1ec6[_0x0974('0x3e')],_0x5d7e67['filters']),_0x5af38f);if(_0x4f1ec6[_0x0974('0x3e')][_0x0974('0x49')]){_0x41e77e[_0x0974('0x4a')]=_[_0x0974('0x4b')](_0x41e77e['where'],{'$or':_[_0x0974('0x38')](_0x5af38f,function(_0x56114b){if(_0x56114b[_0x0974('0x3b')]!==_0x0974('0x4c')){var _0x155bf5={};_0x155bf5[_0x56114b[_0x0974('0x35')]]={'$like':'%'+_0x4f1ec6[_0x0974('0x3e')][_0x0974('0x49')]+'%'};return _0x155bf5;}})});}_0x41e77e=_['merge']({},_0x41e77e,_0x4f1ec6[_0x0974('0x4d')]);var _0x2774c1={'where':_0x41e77e[_0x0974('0x4a')]};return db[_0x0974('0x39')]['count'](_0x2774c1)[_0x0974('0x32')](function(_0x3cd8ee){_0x38282c[_0x0974('0x2a')]=_0x3cd8ee;if(_0x4f1ec6['query']['includeAll']){_0x41e77e['include']=[{'all':!![]}];}return db['ChatGroup'][_0x0974('0x4e')](_0x41e77e);})[_0x0974('0x32')](function(_0x3f79c6){_0x38282c[_0x0974('0x4f')]=_0x3f79c6;return _0x38282c;})[_0x0974('0x32')](respondWithFilteredResult(_0x211a58,_0x41e77e))[_0x0974('0x27')](handleError(_0x211a58,null));};exports[_0x0974('0x50')]=function(_0x659432,_0x4124dc){var _0x5e6c88={'raw':!![],'where':{'id':_0x659432[_0x0974('0x51')]['id']}},_0x62610={};_0x62610['model']=_[_0x0974('0x3f')](db['ChatGroup']['rawAttributes']);_0x62610[_0x0974('0x3e')]=_[_0x0974('0x3f')](_0x659432[_0x0974('0x3e')]);_0x62610['filtears']=_['intersection'](_0x62610[_0x0974('0x3d')],_0x62610[_0x0974('0x3e')]);_0x5e6c88[_0x0974('0x42')]=_[_0x0974('0x41')](_0x62610[_0x0974('0x3d')],qs[_0x0974('0x43')](_0x659432[_0x0974('0x3e')]['fields']));_0x5e6c88[_0x0974('0x42')]=_0x5e6c88[_0x0974('0x42')][_0x0974('0x44')]?_0x5e6c88['attributes']:_0x62610[_0x0974('0x3d')];if(_0x659432['query'][_0x0974('0x52')]){_0x5e6c88[_0x0974('0x53')]=[{'all':!![]}];}_0x5e6c88=_['merge']({},_0x5e6c88,_0x659432['options']);return db[_0x0974('0x39')][_0x0974('0x54')](_0x5e6c88)[_0x0974('0x32')](handleEntityNotFound(_0x4124dc,null))[_0x0974('0x32')](respondWithResult(_0x4124dc,null))[_0x0974('0x27')](handleError(_0x4124dc,null));};exports['create']=function(_0x4ee8e3,_0x3bd963){return db[_0x0974('0x39')][_0x0974('0x55')](_0x4ee8e3[_0x0974('0x56')],{})[_0x0974('0x32')](respondWithResult(_0x3bd963,0xc9))[_0x0974('0x27')](handleError(_0x3bd963,null));};exports['update']=function(_0x2acc95,_0x1496a6){if(_0x2acc95[_0x0974('0x56')]['id']){delete _0x2acc95[_0x0974('0x56')]['id'];}return db[_0x0974('0x39')]['find']({'where':{'id':_0x2acc95['params']['id']}})['then'](handleEntityNotFound(_0x1496a6,null))[_0x0974('0x32')](saveUpdates(_0x2acc95[_0x0974('0x56')],null))['then'](respondWithResult(_0x1496a6,null))[_0x0974('0x27')](handleError(_0x1496a6,null));};exports[_0x0974('0x33')]=function(_0x7076f5,_0x4431ad){return db['ChatGroup'][_0x0974('0x54')]({'where':{'id':_0x7076f5[_0x0974('0x51')]['id']}})['then'](handleEntityNotFound(_0x4431ad,null))[_0x0974('0x32')](removeEntity(_0x4431ad,null))[_0x0974('0x27')](handleError(_0x4431ad,null));};exports['describe']=function(_0x4e685,_0x11430a){return db[_0x0974('0x39')][_0x0974('0x57')]()[_0x0974('0x32')](respondWithResult(_0x11430a,null))['catch'](handleError(_0x11430a,null));};exports[_0x0974('0x58')]=function(_0x28dbf9,_0x12fdb3,_0x13109a){return db[_0x0974('0x59')][_0x0974('0x2a')]({'where':{'ChatGroupId':_0x28dbf9[_0x0974('0x51')]['id'],'ToId':_0x28dbf9[_0x0974('0x5a')]['id'],'read':![]}})[_0x0974('0x32')](function(_0x48dbcb){return{'id':_['toInteger'](_0x28dbf9[_0x0974('0x51')]['id']),'count':_0x48dbcb};})[_0x0974('0x32')](respondWithResult(_0x12fdb3,null))[_0x0974('0x27')](handleError(_0x12fdb3,null));};exports['addMembers']=function(_0x1ec17c,_0xfcb170,_0x35f96c){return db[_0x0974('0x39')][_0x0974('0x54')]({'where':{'id':_0x1ec17c[_0x0974('0x51')]['id']}})[_0x0974('0x32')](handleEntityNotFound(_0xfcb170,null))[_0x0974('0x32')](function(_0x102a0e){if(_0x102a0e){return _0x102a0e[_0x0974('0x5b')](_0x1ec17c[_0x0974('0x56')][_0x0974('0x5c')],_[_0x0974('0x5d')](_0x1ec17c[_0x0974('0x56')],[_0x0974('0x5c'),'id'])||{});}})[_0x0974('0x32')](respondWithResult(_0xfcb170,null))[_0x0974('0x27')](handleError(_0xfcb170,null));};exports[_0x0974('0x5e')]=function(_0xb11c37,_0x3f84f3,_0x19c16a){var _0x40e5fe={};var _0x34482b={};var _0x5fb2b5;var _0x4afc01;return db[_0x0974('0x39')]['findOne']({'where':{'id':_0xb11c37[_0x0974('0x51')]['id']}})[_0x0974('0x32')](handleEntityNotFound(_0x3f84f3,null))['then'](function(_0x57389f){if(_0x57389f){_0x5fb2b5=_0x57389f;_0x34482b[_0x0974('0x3d')]=_[_0x0974('0x3f')](db[_0x0974('0x5f')][_0x0974('0x60')]);_0x34482b[_0x0974('0x3e')]=_[_0x0974('0x3f')](_0xb11c37[_0x0974('0x3e')]);_0x34482b['filters']=_['intersection'](_0x34482b[_0x0974('0x3d')],_0x34482b[_0x0974('0x3e')]);_0x40e5fe[_0x0974('0x42')]=_[_0x0974('0x41')](_0x34482b[_0x0974('0x3d')],qs['fields'](_0xb11c37[_0x0974('0x3e')][_0x0974('0x43')]));_0x40e5fe[_0x0974('0x42')]=_0x40e5fe[_0x0974('0x42')][_0x0974('0x44')]?_0x40e5fe[_0x0974('0x42')]:_0x34482b[_0x0974('0x3d')];_0x40e5fe[_0x0974('0x61')]=qs[_0x0974('0x47')](_0xb11c37[_0x0974('0x3e')][_0x0974('0x47')]);_0x40e5fe[_0x0974('0x4a')]=qs['filters'](_[_0x0974('0x48')](_0xb11c37[_0x0974('0x3e')],_0x34482b[_0x0974('0x40')]));if(_0xb11c37['query'][_0x0974('0x49')]){_0x40e5fe['where']=_[_0x0974('0x4b')](_0x40e5fe[_0x0974('0x4a')],{'$or':_['map'](_0x40e5fe[_0x0974('0x42')],function(_0x16b850){var _0x28a5d4={};_0x28a5d4[_0x16b850]={'$like':'%'+_0xb11c37[_0x0974('0x3e')]['filter']+'%'};return _0x28a5d4;})});}_0x40e5fe=_[_0x0974('0x4b')]({},_0x40e5fe,_0xb11c37['options']);return _0x5fb2b5['getMembers'](_0x40e5fe);}})[_0x0974('0x32')](function(_0x2115f9){if(_0x2115f9){_0x4afc01=_0x2115f9['length'];if(!_0xb11c37['query'][_0x0974('0x45')]('nolimit')){_0x40e5fe[_0x0974('0x2c')]=qs[_0x0974('0x2c')](_0xb11c37[_0x0974('0x3e')][_0x0974('0x2c')]);_0x40e5fe[_0x0974('0x2b')]=qs[_0x0974('0x2b')](_0xb11c37[_0x0974('0x3e')][_0x0974('0x2b')]);}return _0x5fb2b5[_0x0974('0x5e')](_0x40e5fe);}})[_0x0974('0x32')](function(_0x1eadf7){if(_0x1eadf7){return _0x1eadf7?{'count':_0x4afc01,'rows':_0x1eadf7}:null;}})[_0x0974('0x32')](respondWithResult(_0x3f84f3,null))['catch'](handleError(_0x3f84f3,null));};exports[_0x0974('0x62')]=function(_0x43582a,_0x189ced,_0x15e552){return db[_0x0974('0x39')][_0x0974('0x54')]({'where':{'id':_0x43582a[_0x0974('0x51')]['id']}})[_0x0974('0x32')](handleEntityNotFound(_0x189ced,null))[_0x0974('0x32')](function(_0x22bddf){if(_0x22bddf){return _0x22bddf[_0x0974('0x62')](_0x43582a[_0x0974('0x3e')][_0x0974('0x5c')]);}})['then'](respondWithStatusCode(_0x189ced,null))[_0x0974('0x27')](handleError(_0x189ced,null));};exports[_0x0974('0x63')]=function(_0x102244,_0x590467,_0x45d936){if(_0x102244[_0x0974('0x56')]['id']){delete _0x102244['body']['id'];}return db['ChatGroup'][_0x0974('0x54')]({'where':{'id':_0x102244[_0x0974('0x51')]['id']}})[_0x0974('0x32')](handleEntityNotFound(_0x590467,null))[_0x0974('0x32')](function(_0x51bed7){if(_0x51bed7){_0x102244[_0x0974('0x56')]['ChatGroupId']=_0x51bed7['id'];return db[_0x0974('0x59')][_0x0974('0x55')](_0x102244['body']);}})['then'](respondWithResult(_0x590467,null))[_0x0974('0x27')](handleError(_0x590467,null));};exports[_0x0974('0x64')]=function(_0x2754b4,_0x1106d1,_0x109a4f){var _0x1467cd={};var _0x17a525={};var _0x48b868;var _0x33d2f6;return db[_0x0974('0x39')]['findOne']({'where':{'id':_0x2754b4[_0x0974('0x51')]['id']}})['then'](handleEntityNotFound(_0x1106d1,null))[_0x0974('0x32')](function(_0x41bca2){if(_0x41bca2){_0x48b868=_0x41bca2;_0x17a525[_0x0974('0x3d')]=_[_0x0974('0x3f')](db[_0x0974('0x59')][_0x0974('0x60')]);_0x17a525[_0x0974('0x3e')]=_[_0x0974('0x3f')](_0x2754b4['query']);_0x17a525[_0x0974('0x40')]=_[_0x0974('0x41')](_0x17a525['model'],_0x17a525[_0x0974('0x3e')]);_0x1467cd['attributes']=_['intersection'](_0x17a525[_0x0974('0x3d')],qs[_0x0974('0x43')](_0x2754b4[_0x0974('0x3e')][_0x0974('0x43')]));_0x1467cd['attributes']=_0x1467cd[_0x0974('0x42')]['length']?_0x1467cd[_0x0974('0x42')]:_0x17a525[_0x0974('0x3d')];_0x1467cd[_0x0974('0x61')]=qs[_0x0974('0x47')](_0x2754b4[_0x0974('0x3e')]['sort']);_0x1467cd[_0x0974('0x4a')]=qs[_0x0974('0x40')](_[_0x0974('0x48')](_0x2754b4[_0x0974('0x3e')],_0x17a525['filters']));if(_0x2754b4[_0x0974('0x3e')][_0x0974('0x49')]){_0x1467cd[_0x0974('0x4a')]=_[_0x0974('0x4b')](_0x1467cd[_0x0974('0x4a')],{'$or':_[_0x0974('0x38')](_0x1467cd[_0x0974('0x42')],function(_0x4a3b3e){var _0x18ca05={};_0x18ca05[_0x4a3b3e]={'$like':'%'+_0x2754b4[_0x0974('0x3e')][_0x0974('0x49')]+'%'};return _0x18ca05;})});}if(_0x2754b4[_0x0974('0x3e')][_0x0974('0x65')]){var _0x560e38=_0x2754b4[_0x0974('0x3e')][_0x0974('0x65')][_0x0974('0x66')](',');var _0x40fe81={};_0x40fe81[_0x560e38[0x0]]={'$gte':moment(_0x560e38[0x1])[_0x0974('0x67')](_0x0974('0x68'))};_0x1467cd[_0x0974('0x4a')]=_['merge'](_0x1467cd[_0x0974('0x4a')],_0x40fe81);}_0x1467cd=_[_0x0974('0x4b')]({},_0x1467cd,_0x2754b4[_0x0974('0x4d')]);return _0x48b868[_0x0974('0x64')](_0x1467cd);}})['then'](function(_0x467276){if(_0x467276){_0x33d2f6=_0x467276[_0x0974('0x44')];if(!_0x2754b4[_0x0974('0x3e')][_0x0974('0x45')]('nolimit')){_0x1467cd[_0x0974('0x2c')]=qs[_0x0974('0x2c')](_0x2754b4[_0x0974('0x3e')]['limit']);_0x1467cd['offset']=qs[_0x0974('0x2b')](_0x2754b4[_0x0974('0x3e')][_0x0974('0x2b')]);}return _0x48b868[_0x0974('0x64')](_0x1467cd);}})['then'](function(_0x3faac6){if(_0x3faac6){return _0x3faac6?{'count':_0x33d2f6,'rows':_0x3faac6}:null;}})[_0x0974('0x32')](respondWithResult(_0x1106d1,null))[_0x0974('0x27')](handleError(_0x1106d1,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9684436..811901c 100644 --- a/server/api/chatGroup/chatGroup.events.js +++ b/server/api/chatGroup/chatGroup.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x57eb24,_0x11379b){var _0x2d33ac=function(_0x3f2225){while(--_0x3f2225){_0x57eb24['push'](_0x57eb24['shift']());}};_0x2d33ac(++_0x11379b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x7a3247,_0x15cb12){var _0x1bfde5=function(_0x62bbef){while(--_0x62bbef){_0x7a3247['push'](_0x7a3247['shift']());}};_0x1bfde5(++_0x15cb12);}(_0xadb5,0xad));var _0x5adb=function(_0x397fe1,_0x5132db){_0x397fe1=_0x397fe1-0x0;var _0x4b0541=_0xadb5[_0x397fe1];return _0x4b0541;};'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 d815090..d742523 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 _0xd2bb=['moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','api'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xd2bb,0x9a));var _0xbd2b=function(_0xc11792,_0x1fa0f8){_0xc11792=_0xc11792-0x0;var _0x1c705d=_0xd2bb[_0xc11792];return _0x1c705d;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7edb=['define','ChatGroup','chat_groups','util','../../config/logger','api','moment','bluebird','path','./chatGroup.attributes','exports'];(function(_0x4af4e9,_0x83d156){var _0xa96a31=function(_0x4c97b3){while(--_0x4c97b3){_0x4af4e9['push'](_0x4af4e9['shift']());}};_0xa96a31(++_0x83d156);}(_0x7edb,0x158));var _0xb7ed=function(_0x3ae297,_0x3102c8){_0x3ae297=_0x3ae297-0x0;var _0x291ba9=_0x7edb[_0x3ae297];return _0x291ba9;};'use strict';var _=require('lodash');var util=require(_0xb7ed('0x0'));var logger=require(_0xb7ed('0x1'))(_0xb7ed('0x2'));var moment=require(_0xb7ed('0x3'));var BPromise=require(_0xb7ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7ed('0x6'));module[_0xb7ed('0x7')]=function(_0x2aa67d,_0x246cfa){return _0x2aa67d[_0xb7ed('0x8')](_0xb7ed('0x9'),attributes,{'tableName':_0xb7ed('0xa'),'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 31fe037..b658b7b 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 _0x5070=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','ioredis','../../mysqldb'];(function(_0x27e909,_0x36f888){var _0x2cf6f0=function(_0x3c639c){while(--_0x3c639c){_0x27e909['push'](_0x27e909['shift']());}};_0x2cf6f0(++_0x36f888);}(_0x5070,0xec));var _0x0507=function(_0x277e5c,_0x1018f0){_0x277e5c=_0x277e5c-0x0;var _0x1008e9=_0x5070[_0x277e5c];return _0x1008e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0507('0x0'));var BPromise=require(_0x0507('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0507('0x2'));var db=require(_0x0507('0x3'))['db'];var utils=require(_0x0507('0x4'));var logger=require('../../config/logger')(_0x0507('0x5'));var config=require(_0x0507('0x6'));var jayson=require(_0x0507('0x7'));var client=jayson[_0x0507('0x8')][_0x0507('0x9')]({'port':0x232a});config[_0x0507('0xa')]=_[_0x0507('0xb')](config['redis'],{'host':_0x0507('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0507('0xd'))[_0x0507('0xe')](socket);function respondWithRpcPromise(_0x38a383,_0xd1c426,_0x10fd0b){return new BPromise(function(_0x3cf4e1,_0x3dd038){return client[_0x0507('0xf')](_0x38a383,_0x10fd0b)['then'](function(_0x2b8227){logger['info'](_0x0507('0x10'),_0xd1c426,_0x0507('0x11'));logger['debug'](_0x0507('0x12'),_0xd1c426,_0x0507('0x11'),JSON[_0x0507('0x13')](_0x2b8227));if(_0x2b8227[_0x0507('0x14')]){if(_0x2b8227[_0x0507('0x14')][_0x0507('0x15')]===0x1f4){logger[_0x0507('0x14')]('ChatGroup,\x20%s,\x20%s',_0xd1c426,_0x2b8227[_0x0507('0x14')][_0x0507('0x16')]);return _0x3dd038(_0x2b8227[_0x0507('0x14')][_0x0507('0x16')]);}logger[_0x0507('0x14')](_0x0507('0x10'),_0xd1c426,_0x2b8227[_0x0507('0x14')][_0x0507('0x16')]);return _0x3cf4e1(_0x2b8227[_0x0507('0x14')][_0x0507('0x16')]);}else{logger[_0x0507('0x17')]('ChatGroup,\x20%s,\x20%s',_0xd1c426,_0x0507('0x11'));_0x3cf4e1(_0x2b8227['result'][_0x0507('0x16')]);}})['catch'](function(_0x5b8032){logger[_0x0507('0x14')](_0x0507('0x10'),_0xd1c426,_0x5b8032);_0x3dd038(_0x5b8032);});});} \ No newline at end of file +var _0xd701=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then'];(function(_0x25e383,_0x3a709a){var _0x3c043e=function(_0x41f7fe){while(--_0x41f7fe){_0x25e383['push'](_0x25e383['shift']());}};_0x3c043e(++_0x3a709a);}(_0xd701,0x67));var _0x1d70=function(_0x580238,_0x2adec2){_0x580238=_0x580238-0x0;var _0x3d5608=_0xd701[_0x580238];return _0x3d5608;};'use strict';var _=require(_0x1d70('0x0'));var util=require(_0x1d70('0x1'));var moment=require(_0x1d70('0x2'));var BPromise=require(_0x1d70('0x3'));var rs=require(_0x1d70('0x4'));var fs=require('fs');var Redis=require(_0x1d70('0x5'));var db=require(_0x1d70('0x6'))['db'];var utils=require(_0x1d70('0x7'));var logger=require(_0x1d70('0x8'))('rpc');var config=require(_0x1d70('0x9'));var jayson=require(_0x1d70('0xa'));var client=jayson[_0x1d70('0xb')][_0x1d70('0xc')]({'port':0x232a});config[_0x1d70('0xd')]=_[_0x1d70('0xe')](config[_0x1d70('0xd')],{'host':_0x1d70('0xf'),'port':0x18eb});var socket=require(_0x1d70('0x10'))(new Redis(config[_0x1d70('0xd')]));require(_0x1d70('0x11'))[_0x1d70('0x12')](socket);function respondWithRpcPromise(_0x1266d5,_0x13e612,_0x3a3aba){return new BPromise(function(_0x52ee2c,_0x1fd877){return client[_0x1d70('0x13')](_0x1266d5,_0x3a3aba)[_0x1d70('0x14')](function(_0x4c3997){logger[_0x1d70('0x15')](_0x1d70('0x16'),_0x13e612,_0x1d70('0x17'));logger[_0x1d70('0x18')](_0x1d70('0x19'),_0x13e612,_0x1d70('0x17'),JSON[_0x1d70('0x1a')](_0x4c3997));if(_0x4c3997[_0x1d70('0x1b')]){if(_0x4c3997['error']['code']===0x1f4){logger[_0x1d70('0x1b')](_0x1d70('0x16'),_0x13e612,_0x4c3997['error'][_0x1d70('0x1c')]);return _0x1fd877(_0x4c3997['error']['message']);}logger[_0x1d70('0x1b')]('ChatGroup,\x20%s,\x20%s',_0x13e612,_0x4c3997['error'][_0x1d70('0x1c')]);return _0x52ee2c(_0x4c3997[_0x1d70('0x1b')][_0x1d70('0x1c')]);}else{logger[_0x1d70('0x15')](_0x1d70('0x16'),_0x13e612,_0x1d70('0x17'));_0x52ee2c(_0x4c3997[_0x1d70('0x1d')][_0x1d70('0x1c')]);}})[_0x1d70('0x1e')](function(_0x4caefe){logger[_0x1d70('0x1b')]('ChatGroup,\x20%s,\x20%s',_0x13e612,_0x4caefe);_0x1fd877(_0x4caefe);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 650a228..f4d5ef7 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 _0x389f=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x6a2caa,_0x827e3e){var _0x91dfd5=function(_0xe3efa7){while(--_0xe3efa7){_0x6a2caa['push'](_0x6a2caa['shift']());}};_0x91dfd5(++_0x827e3e);}(_0x389f,0x16c));var _0xf389=function(_0x74a91f,_0x400eda){_0x74a91f=_0x74a91f-0x0;var _0x3569c9=_0x389f[_0x74a91f];return _0x3569c9;};'use strict';var ChatGroupEvents=require(_0xf389('0x0'));var events=[_0xf389('0x1'),_0xf389('0x2'),_0xf389('0x3')];function createListener(_0x3bf41f,_0x2e4985){return function(_0x10a00c){_0x2e4985[_0xf389('0x4')](_0x3bf41f,_0x10a00c);};}function removeListener(_0x553b04,_0xd52eb9){return function(){ChatGroupEvents[_0xf389('0x5')](_0x553b04,_0xd52eb9);};}exports[_0xf389('0x6')]=function(_0x31a509){for(var _0x148fa4=0x0,_0x23208b=events[_0xf389('0x7')];_0x148fa4<_0x23208b;_0x148fa4++){var _0x248211=events[_0x148fa4];var _0x2e2bb4=createListener(_0xf389('0x8')+_0x248211,_0x31a509);ChatGroupEvents['on'](_0x248211,_0x2e2bb4);}}; \ No newline at end of file +var _0x7346=['length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x512e9f,_0x3a26f3){var _0x20c93f=function(_0x4c4c07){while(--_0x4c4c07){_0x512e9f['push'](_0x512e9f['shift']());}};_0x20c93f(++_0x3a26f3);}(_0x7346,0x144));var _0x6734=function(_0x169496,_0x49c452){_0x169496=_0x169496-0x0;var _0x244db7=_0x7346[_0x169496];return _0x244db7;};'use strict';var ChatGroupEvents=require(_0x6734('0x0'));var events=[_0x6734('0x1'),_0x6734('0x2'),_0x6734('0x3')];function createListener(_0x5d4069,_0x466bd5){return function(_0x403542){_0x466bd5[_0x6734('0x4')](_0x5d4069,_0x403542);};}function removeListener(_0x37dcc0,_0xba012a){return function(){ChatGroupEvents['removeListener'](_0x37dcc0,_0xba012a);};}exports['register']=function(_0x203104){for(var _0x50d029=0x0,_0x27001e=events[_0x6734('0x5')];_0x50d029<_0x27001e;_0x50d029++){var _0x325baf=events[_0x50d029];var _0x10234d=createListener(_0x6734('0x6')+_0x325baf,_0x203104);ChatGroupEvents['on'](_0x325baf,_0x10234d);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index fe62d0c..663069e 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 _0x9bdc=['/:id','update','destroy','delete','removeMembers','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/unread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage'];(function(_0x3ef6b8,_0x20b169){var _0x29b3ea=function(_0x253346){while(--_0x253346){_0x3ef6b8['push'](_0x3ef6b8['shift']());}};_0x29b3ea(++_0x20b169);}(_0x9bdc,0x69));var _0xc9bd=function(_0x53e09a,_0xe16808){_0x53e09a=_0x53e09a-0x0;var _0x5681d2=_0x9bdc[_0x53e09a];return _0x5681d2;};'use strict';var multer=require(_0xc9bd('0x0'));var util=require('util');var path=require(_0xc9bd('0x1'));var timeout=require(_0xc9bd('0x2'));var express=require(_0xc9bd('0x3'));var router=express['Router']();var auth=require(_0xc9bd('0x4'));var interaction=require(_0xc9bd('0x5'));var config=require(_0xc9bd('0x6'));var controller=require('./chatGroup.controller');router[_0xc9bd('0x7')]('/',auth[_0xc9bd('0x8')](),controller['index']);router[_0xc9bd('0x7')](_0xc9bd('0x9'),auth[_0xc9bd('0x8')](),controller[_0xc9bd('0xa')]);router[_0xc9bd('0x7')]('/:id',auth[_0xc9bd('0x8')](),controller[_0xc9bd('0xb')]);router[_0xc9bd('0x7')](_0xc9bd('0xc'),auth[_0xc9bd('0x8')](),controller['getUnread']);router[_0xc9bd('0x7')](_0xc9bd('0xd'),auth[_0xc9bd('0x8')](),controller['getMembers']);router[_0xc9bd('0x7')](_0xc9bd('0xe'),auth[_0xc9bd('0x8')](),controller[_0xc9bd('0xf')]);router[_0xc9bd('0x10')]('/',auth[_0xc9bd('0x8')](),controller[_0xc9bd('0x11')]);router['post'](_0xc9bd('0xd'),auth['isAuthenticated'](),controller[_0xc9bd('0x12')]);router[_0xc9bd('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc9bd('0x13')]);router['put'](_0xc9bd('0x14'),auth['isAuthenticated'](),controller[_0xc9bd('0x15')]);router['delete']('/:id',auth[_0xc9bd('0x8')](),controller[_0xc9bd('0x16')]);router[_0xc9bd('0x17')](_0xc9bd('0xd'),auth[_0xc9bd('0x8')](),controller[_0xc9bd('0x18')]);module['exports']=router; \ No newline at end of file +var _0x8fc7=['post','addMembers','put','update','delete','destroy','exports','multer','path','express','Router','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages'];(function(_0x472a98,_0x3152bf){var _0xa9234a=function(_0x1cb2fc){while(--_0x1cb2fc){_0x472a98['push'](_0x472a98['shift']());}};_0xa9234a(++_0x3152bf);}(_0x8fc7,0x11b));var _0x78fc=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x8fc7[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x78fc('0x0'));var util=require('util');var path=require(_0x78fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x78fc('0x2'));var router=express[_0x78fc('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x78fc('0x4'));router[_0x78fc('0x5')]('/',auth[_0x78fc('0x6')](),controller[_0x78fc('0x7')]);router[_0x78fc('0x5')](_0x78fc('0x8'),auth[_0x78fc('0x6')](),controller['describe']);router[_0x78fc('0x5')](_0x78fc('0x9'),auth['isAuthenticated'](),controller[_0x78fc('0xa')]);router[_0x78fc('0x5')](_0x78fc('0xb'),auth[_0x78fc('0x6')](),controller[_0x78fc('0xc')]);router['get'](_0x78fc('0xd'),auth[_0x78fc('0x6')](),controller['getMembers']);router['get'](_0x78fc('0xe'),auth[_0x78fc('0x6')](),controller[_0x78fc('0xf')]);router[_0x78fc('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x78fc('0x10')](_0x78fc('0xd'),auth[_0x78fc('0x6')](),controller[_0x78fc('0x11')]);router[_0x78fc('0x10')](_0x78fc('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x78fc('0x12')](_0x78fc('0x9'),auth[_0x78fc('0x6')](),controller[_0x78fc('0x13')]);router[_0x78fc('0x14')]('/:id',auth[_0x78fc('0x6')](),controller[_0x78fc('0x15')]);router['delete'](_0x78fc('0xd'),auth[_0x78fc('0x6')](),controller['removeMembers']);module[_0x78fc('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 29ffe25..4a677f0 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 _0x7197=['out','sequelize','exports','BOOLEAN','ENUM','star','TEXT','STRING','long','DATE'];(function(_0x5850c0,_0x3c2c){var _0x113882=function(_0x1d8200){while(--_0x1d8200){_0x5850c0['push'](_0x5850c0['shift']());}};_0x113882(++_0x3c2c);}(_0x7197,0x105));var _0x7719=function(_0x48cd43,_0x18ea0a){_0x48cd43=_0x48cd43-0x0;var _0x3b7362=_0x7197[_0x48cd43];return _0x3b7362;};'use strict';var Sequelize=require(_0x7719('0x0'));module[_0x7719('0x1')]={'closed':{'type':Sequelize[_0x7719('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x7719('0x3')]('star','thumb'),'defaultValue':_0x7719('0x4')},'ratingMessage':{'type':Sequelize[_0x7719('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x7719('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7719('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7719('0x6')]},'browserName':{'type':Sequelize[_0x7719('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x7719('0x6')]},'deviceModel':{'type':Sequelize[_0x7719('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x7719('0x6')]},'referer':{'type':Sequelize[_0x7719('0x5')]},'customerIp':{'type':Sequelize[_0x7719('0x6')]},'formData':{'type':Sequelize[_0x7719('0x5')](_0x7719('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x7719('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x7719('0x3')]('in',_0x7719('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x7719('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x7719('0x5')]}}; \ No newline at end of file +var _0xdf77=['INTEGER','star','thumb','TEXT','STRING','long','DATE','ENUM','out','exports'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xdf77,0x171));var _0x7df7=function(_0x208270,_0x4d127e){_0x208270=_0x208270-0x0;var _0xb6b976=_0xdf77[_0x208270];return _0xb6b976;};'use strict';var Sequelize=require('sequelize');module[_0x7df7('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7df7('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0x7df7('0x2'),_0x7df7('0x3')),'defaultValue':_0x7df7('0x2')},'ratingMessage':{'type':Sequelize[_0x7df7('0x4')]},'pathTranscript':{'type':Sequelize[_0x7df7('0x4')]},'mailTranscript':{'type':Sequelize[_0x7df7('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7df7('0x5')]},'secondDisposition':{'type':Sequelize[_0x7df7('0x5')]},'thirdDisposition':{'type':Sequelize[_0x7df7('0x5')]},'note':{'type':Sequelize[_0x7df7('0x5')]},'browserName':{'type':Sequelize[_0x7df7('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x7df7('0x5')]},'deviceVendor':{'type':Sequelize[_0x7df7('0x5')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x7df7('0x4')]},'customerIp':{'type':Sequelize[_0x7df7('0x5')]},'formData':{'type':Sequelize[_0x7df7('0x4')](_0x7df7('0x6'))},'read1stAt':{'type':Sequelize[_0x7df7('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7df7('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7df7('0x8')]('in',_0x7df7('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7df7('0x5')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7df7('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 6c0864c..7197588 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 _0x64fc=['text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','body','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','clone','unreadMessages','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','show','params','filtears','include','merge','options','create','update','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','entity\x20not\x20found','UserId','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','download','join','root','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','Messages','ChatWebsite','ChatWebsiteId','CmContact','%s%d','agentAlias','System','Visitor','ContactId','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','ChatInteractionId','filter','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','alias','addTags','setTags','ids','spread','emit','removeTags','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','Owner','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','YYYY-MM-DD','Account','N.A.','disposition','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','direction','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','from','select','u.fullname','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','sqlOperator','conditions','length','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find'];(function(_0x537ad9,_0xe6adab){var _0x46264b=function(_0x2cb634){while(--_0x2cb634){_0x537ad9['push'](_0x537ad9['shift']());}};_0x46264b(++_0xe6adab);}(_0x64fc,0x1f4));var _0xc64f=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x64fc[_0x2f3848];return _0x102668;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc64f('0x0'));var rimraf=require(_0xc64f('0x1'));var zipdir=require(_0xc64f('0x2'));var jsonpatch=require(_0xc64f('0x3'));var rp=require(_0xc64f('0x4'));var moment=require(_0xc64f('0x5'));var BPromise=require(_0xc64f('0x6'));var Mustache=require(_0xc64f('0x7'));var util=require('util');var path=require(_0xc64f('0x8'));var sox=require(_0xc64f('0x9'));var csv=require(_0xc64f('0xa'));var ejs=require(_0xc64f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc64f('0xc'));var jsforce=require(_0xc64f('0xd'));var deskjs=require(_0xc64f('0xe'));var toCsv=require(_0xc64f('0xa'));var querystring=require('querystring');var Papa=require(_0xc64f('0xf'));var Redis=require(_0xc64f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc64f('0x11'));var hardwareService=require(_0xc64f('0x12'));var logger=require(_0xc64f('0x13'))('api');var utils=require(_0xc64f('0x14'));var config=require(_0xc64f('0x15'));var licenseUtil=require(_0xc64f('0x16'));var db=require(_0xc64f('0x17'))['db'];config[_0xc64f('0x18')]=_['defaults'](config[_0xc64f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc64f('0x19'))(new Redis(config['redis']));require(_0xc64f('0x1a'))[_0xc64f('0x1b')](socket);var jayson=require(_0xc64f('0x1c'));var client=jayson[_0xc64f('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0xc64f('0x1d')][_0xc64f('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x1bd03a,_0x27cea5,_0x10dc8a,_0x155a6c){return new BPromise(function(_0x45bc2c,_0x429f3f){var _0x461796=_0x155a6c||client;return _0x461796[_0xc64f('0x1f')](_0x1bd03a,_0x10dc8a)[_0xc64f('0x20')](function(_0x7a43dd){logger[_0xc64f('0x21')](_0xc64f('0x22'),_0x27cea5,_0xc64f('0x23'));logger['debug'](_0xc64f('0x24'),_0x27cea5,_0xc64f('0x23'),JSON[_0xc64f('0x25')](_0x7a43dd));if(_0x7a43dd['error']){if(_0x7a43dd['error']['code']===0x1f4){logger[_0xc64f('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x27cea5,_0x7a43dd[_0xc64f('0x26')][_0xc64f('0x27')]);return _0x429f3f(_0x7a43dd[_0xc64f('0x26')][_0xc64f('0x27')]);}logger[_0xc64f('0x26')](_0xc64f('0x22'),_0x27cea5,_0x7a43dd[_0xc64f('0x26')][_0xc64f('0x27')]);return _0x45bc2c(_0x7a43dd['error']['message']);}else{logger[_0xc64f('0x21')](_0xc64f('0x22'),_0x27cea5,_0xc64f('0x23'));_0x45bc2c(_0x7a43dd[_0xc64f('0x28')][_0xc64f('0x27')]);}})[_0xc64f('0x29')](function(_0x531b69){logger[_0xc64f('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x27cea5,_0x531b69);_0x429f3f(_0x531b69);});});}function respondWithStatusCode(_0x49972a,_0x5adce7){_0x5adce7=_0x5adce7||0xcc;return function(_0x5b2313){if(_0x5b2313){return _0x49972a[_0xc64f('0x2a')](_0x5adce7);}return _0x49972a[_0xc64f('0x2b')](_0x5adce7)[_0xc64f('0x2c')]();};}function respondWithResult(_0x95c722,_0x13dec6){_0x13dec6=_0x13dec6||0xc8;return function(_0x39d297){if(_0x39d297){return _0x95c722[_0xc64f('0x2b')](_0x13dec6)[_0xc64f('0x2d')](_0x39d297);}};}function respondWithFilteredResult(_0x42e801,_0x3a95e2){return function(_0x17e5e3){if(_0x17e5e3){var _0x965ba0=_0x17e5e3[_0xc64f('0x2e')],_0x35942b=_0x3a95e2[_0xc64f('0x2f')],_0x43f232=_0x3a95e2[_0xc64f('0x2f')]+_0x3a95e2[_0xc64f('0x30')],_0x23dbb9;if(_0x43f232>=_0x965ba0){_0x43f232=_0x965ba0;_0x23dbb9=0xc8;}else{_0x23dbb9=0xce;}_0x42e801[_0xc64f('0x2b')](_0x23dbb9);return _0x42e801[_0xc64f('0x31')](_0xc64f('0x32'),_0x35942b+'-'+_0x43f232+'/'+_0x965ba0)['json'](_0x17e5e3);}return null;};}function patchUpdates(_0x4bad15){return function(_0x590e57){try{jsonpatch[_0xc64f('0x33')](_0x590e57,_0x4bad15,!![]);}catch(_0xd5dfc9){return BPromise[_0xc64f('0x34')](_0xd5dfc9);}return _0x590e57['save']();};}function saveUpdates(_0x424021,_0x4ccd52){return function(_0x479449){if(_0x479449){return _0x479449['update'](_0x424021)[_0xc64f('0x20')](function(_0x4ff806){return _0x4ff806;});}return null;};}function removeEntity(_0x15162d,_0x443fb7){return function(_0x4991af){if(_0x4991af){return _0x4991af[_0xc64f('0x35')]()['then'](function(){_0x15162d[_0xc64f('0x2b')](0xcc)[_0xc64f('0x2c')]();});}};}function handleEntityNotFound(_0x480d9a,_0x72f1a4){return function(_0x3c5c43){if(!_0x3c5c43){_0x480d9a[_0xc64f('0x2a')](0x194);}return _0x3c5c43;};}function handleError(_0x4b4665,_0x58d6ad){_0x58d6ad=_0x58d6ad||0x1f4;return function(_0x3bd04d){logger['error'](_0x3bd04d[_0xc64f('0x36')]);if(_0x3bd04d['name']){delete _0x3bd04d[_0xc64f('0x37')];}_0x4b4665[_0xc64f('0x2b')](_0x58d6ad)[_0xc64f('0x38')](_0x3bd04d);};}function getInteractionUsers(_0x657ce0,_0x3d578e){return new BPromise(function(_0xf2f9ab,_0x140d3d){try{if(_0x3d578e[_0x657ce0['id']]){_0x657ce0[_0xc64f('0x39')]=_['map'](_0x3d578e[_0x657ce0['id']],function(_0x318151){return{'id':_0x318151['id'],'fullname':_0x318151[_0xc64f('0x3a')]};});}}catch(_0x3b0441){_0x140d3d(_0x3b0441);}_0xf2f9ab(_0x657ce0);});}function getInteractionTags(_0x4b0bf0,_0x299cf4){return new BPromise(function(_0xb6db2d,_0x5b2304){try{if(_0x4b0bf0['TagIds']){_0x4b0bf0[_0xc64f('0x3b')]=[];_0x4b0bf0[_0xc64f('0x3c')][_0xc64f('0x3d')](',')[_0xc64f('0x3e')](function(_0x2b256a){_0x4b0bf0[_0xc64f('0x3b')][_0xc64f('0x3f')](_0x299cf4[_0x2b256a]);});}delete _0x4b0bf0['TagIds'];}catch(_0x491914){_0x5b2304(_0x491914);}_0xb6db2d(_0x4b0bf0);});}function updateChatInteraction(_0x4365e0,_0x4365c1,_0x1e2038){return new BPromise(function(_0x343421,_0x4e3767){return getInteractionUsers(_0x4365e0,_0x1e2038)['then'](function(_0x35728f){return getInteractionTags(_0x35728f,_0x4365c1);})['then'](function(_0x38d59e){_0x343421(_0x38d59e);})[_0xc64f('0x29')](function(_0xaf5ba8){_0x4e3767(_0xaf5ba8);});});}exports[_0xc64f('0x40')]=function(_0x3c77c9,_0x299e77){var _0x2cfc07={},_0x3a96b8={},_0x41ea23={'count':0x0,'rows':[]};var _0x45e926=_['map'](db[_0xc64f('0x41')][_0xc64f('0x42')],function(_0x4f054b){return{'name':_0x4f054b[_0xc64f('0x43')],'type':_0x4f054b[_0xc64f('0x44')][_0xc64f('0x45')]};});_0x3a96b8[_0xc64f('0x46')]=_[_0xc64f('0x47')](_0x45e926,_0xc64f('0x37'));_0x3a96b8[_0xc64f('0x48')]=_['keys'](_0x3c77c9[_0xc64f('0x48')]);_0x3a96b8[_0xc64f('0x49')]=_[_0xc64f('0x4a')](_0x3a96b8[_0xc64f('0x46')],_0x3a96b8[_0xc64f('0x48')]);_0x2cfc07['attributes']=_[_0xc64f('0x4a')](_0x3a96b8[_0xc64f('0x46')],qs['fields'](_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x4b')]));_0x2cfc07[_0xc64f('0x4c')]=_0x2cfc07[_0xc64f('0x4c')]['length']?_0x2cfc07[_0xc64f('0x4c')]:_0x3a96b8[_0xc64f('0x46')];if(!_0x3c77c9['query'][_0xc64f('0x4d')](_0xc64f('0x4e'))){_0x2cfc07[_0xc64f('0x30')]=qs[_0xc64f('0x30')](_0x3c77c9[_0xc64f('0x48')]['limit']);_0x2cfc07[_0xc64f('0x2f')]=qs['offset'](_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x2f')]);}_0x2cfc07[_0xc64f('0x4f')]=qs['sort'](_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x50')]);_0x2cfc07[_0xc64f('0x51')]=qs['filters'](_[_0xc64f('0x52')](_0x3c77c9[_0xc64f('0x48')],_0x3a96b8[_0xc64f('0x49')]),_0x45e926);var _0x2c2620=[];var _0x203a46=squel['select']()[_0xc64f('0x53')]('id')[_0xc64f('0x53')](_0xc64f('0x37'))[_0xc64f('0x53')]('color')[_0xc64f('0x54')]('tools_tags');var _0x39fecd=squel[_0xc64f('0x55')]()['field']('u.id')[_0xc64f('0x53')](_0xc64f('0x56'))[_0xc64f('0x53')]('ui.ChatInteractionId')['from']('user_has_chat_interactions','ui')[_0xc64f('0x57')](_0xc64f('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x448d46=squel[_0xc64f('0x55')]()['from'](_0xc64f('0x59'),'i')[_0xc64f('0x57')](_0xc64f('0x5a'),'c',_0xc64f('0x5b'))[_0xc64f('0x57')](_0xc64f('0x58'),'o',_0xc64f('0x5c'))[_0xc64f('0x57')](_0xc64f('0x5d'),'a',_0xc64f('0x5e'))['left_join']('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0xc64f('0x57')](_0xc64f('0x5f'),'it',_0xc64f('0x60'))[_0xc64f('0x57')](_0xc64f('0x61'),'t',_0xc64f('0x62'));var _0x382b3a=squel['expr']();var _0x586653=[];var _0x431b54=squel['expr']();var _0x10d26a;if(_0x3c77c9[_0xc64f('0x48')]['search']){_0x10d26a=as[_0xc64f('0x63')](_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x64')]);var _0x59ceca=_0x10d26a[_0xc64f('0x65')];for(var _0x4281a0=0x0;_0x4281a0<_0x10d26a[_0xc64f('0x66')][_0xc64f('0x67')];_0x4281a0++){var _0x270c45=_0x10d26a['conditions'][_0x4281a0];var _0x781674='i';var _0x4776cb=_['find'](_0x45e926,[_0xc64f('0x37'),_0x270c45[_0xc64f('0x53')]]);if(!_0x4776cb){switch(_0x270c45[_0xc64f('0x53')]){case'unreadMessages':if(_0x270c45[_0xc64f('0x68')]==0x1){_0x448d46[_0xc64f('0x69')]('`'+_0x270c45['field']+_0xc64f('0x6a'));}else{_0x448d46['having']('`'+_0x270c45[_0xc64f('0x53')]+'`\x20>\x200');}break;case _0xc64f('0x6b'):if(_0x270c45[_0xc64f('0x6c')]===_0xc64f('0x6d')){if(_0x270c45['value'][_0xc64f('0x3d')]('\x20')[_0xc64f('0x67')]>0x1){_0x382b3a[_0x59ceca](_0xc64f('0x6e'),qs[_0xc64f('0x6f')](_0x270c45[_0xc64f('0x68')]),null);}else{var _0x32c65c='%'+_0x270c45[_0xc64f('0x68')]+'%';_0x382b3a[_0x59ceca](_0xc64f('0x70'),_0x32c65c,_0x32c65c,_0x32c65c);}}else{_0x4776cb=_[_0xc64f('0x71')](_0x45e926,[_0xc64f('0x37'),'ContactId']);_0x270c45['field']='ContactId';_0x2934bf=as['buildExpression'](_0x781674,_0x4776cb[_0xc64f('0x44')],_0x270c45);_0x382b3a[_0x59ceca](_0x2934bf[_0xc64f('0x72')],_0x2934bf[_0xc64f('0x68')]['start'],_0x2934bf[_0xc64f('0x68')]['end']);}break;case _0xc64f('0x73'):var _0x4ba795=_0x270c45['value'][_0xc64f('0x3d')](',')['map'](function(_0x2d5d90){return Number(_0x2d5d90);});_0x4ba795['forEach'](function(_0x1196c4){_0x431b54['or'](_0xc64f('0x74'),'%,'+_0x1196c4+',%');});_0x586653=_[_0xc64f('0x75')](_0x586653,_0x4ba795);break;case _0xc64f('0x76'):if(_0x270c45['operator']==='$substring'){_0x382b3a[_0x59ceca](_0xc64f('0x77'),'%'+_0x270c45['value']+'%',null);}else{_0x4776cb=_[_0xc64f('0x71')](_0x45e926,[_0xc64f('0x37'),'UserId']);_0x270c45[_0xc64f('0x53')]='UserId';_0x2934bf=as[_0xc64f('0x78')](_0x781674,_0x4776cb[_0xc64f('0x44')],_0x270c45);_0x382b3a[_0x59ceca](_0x2934bf[_0xc64f('0x72')],_0x2934bf[_0xc64f('0x68')][_0xc64f('0x79')],_0x2934bf[_0xc64f('0x68')][_0xc64f('0x2c')]);}break;case _0xc64f('0x7a'):_0x2934bf=as['buildExpression']('me',null,_0x270c45);_0x382b3a[_0x59ceca](_0x2934bf[_0xc64f('0x72')],_0x2934bf[_0xc64f('0x68')]['start'],_0x2934bf['value'][_0xc64f('0x2c')]);break;}}else{var _0x2934bf=as[_0xc64f('0x78')](_0x781674,_0x4776cb[_0xc64f('0x44')],_0x270c45);_0x382b3a[_0x59ceca](_0x2934bf[_0xc64f('0x72')],_0x2934bf[_0xc64f('0x68')][_0xc64f('0x79')],_0x2934bf['value'][_0xc64f('0x2c')]);}}}else{var _0x5723bc=_(_0x3c77c9['query'])[_0xc64f('0x7b')]()[_0xc64f('0x47')](function(_0x32dbd5){return _[_0xc64f('0x7c')](_0x45e926,['name',_0x32dbd5])?_0x32dbd5:undefined;})[_0xc64f('0x7d')]()['value']();if(!_[_0xc64f('0x7e')](_0x5723bc)){_0x5723bc['forEach'](function(_0x26df5e){if(_0x26df5e==='ChatWebsiteId'){_0x448d46[_0xc64f('0x51')](_0xc64f('0x7f'),[][_0xc64f('0x80')](_0x3c77c9[_0xc64f('0x48')][_0x26df5e]));}else if(_0x26df5e===_0xc64f('0x81')){var _0x27dc7c=JSON[_0xc64f('0x82')](_0x3c77c9[_0xc64f('0x48')][_0x26df5e])[_0xc64f('0x83')];var _0x533e88=JSON[_0xc64f('0x82')](_0x3c77c9[_0xc64f('0x48')][_0x26df5e])[_0xc64f('0x84')];_0x448d46[_0xc64f('0x51')](_0xc64f('0x85'),_0x27dc7c,_0x533e88);}else{if(_0x3c77c9[_0xc64f('0x48')][_0x26df5e]===_0xc64f('0x86')){_0x448d46[_0xc64f('0x51')]('i.'+_0x26df5e+_0xc64f('0x87'));}else{_0x448d46[_0xc64f('0x51')]('i.'+_0x26df5e+'\x20=\x20?',_0x3c77c9[_0xc64f('0x48')][_0x26df5e]);}}});}if(_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x88')]){if(_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x88')]==0x1){_0x448d46[_0xc64f('0x69')](_0xc64f('0x89'));}else{_0x448d46[_0xc64f('0x69')](_0xc64f('0x8a'));}}if(_0x3c77c9['query'][_0xc64f('0x8b')]){_0x586653=_[_0xc64f('0x8c')](_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x8b')])?_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x8b')]:new Array(_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x8b')]);_0x586653[_0xc64f('0x3e')](function(_0x3de3ee){_0x431b54['or'](_0xc64f('0x74'),'%,'+_0x3de3ee+',%');});}if(_0x3c77c9['query']['filter']){var _0x5ade3a=_0x3c77c9[_0xc64f('0x48')]['filter'][_0xc64f('0x8d')]('\x5c','\x5c\x5c')[_0xc64f('0x8d')]('\x27\x27',_0xc64f('0x8e'));if(qs[_0xc64f('0x8f')](_0x5ade3a)){_0x382b3a['or'](_0xc64f('0x90'),_0x5ade3a+'%');}else{_0x382b3a['or'](_0xc64f('0x91'),qs[_0xc64f('0x6f')](_0x5ade3a))['or'](_0xc64f('0x92'),_0x5ade3a+'%');}}}_0x448d46[_0xc64f('0x51')](_0x382b3a);_0x448d46['group']('i.id');var _0x2d91f3={'type':db['Sequelize'][_0xc64f('0x93')][_0xc64f('0x94')],'raw':!![]};var _0x2c16ee=_0x448d46[_0xc64f('0x95')]();_0x2c16ee[_0xc64f('0x53')]('i.id');_0x2c16ee[_0xc64f('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc64f('0x96'));if(_0x2cfc07[_0xc64f('0x4f')]){_0x2cfc07['order']['forEach'](function(_0x20e87a){_0x448d46['order']('i.'+_0x20e87a[0x0],_0x20e87a[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc64f('0x7e')](_0x586653)){_0x448d46[_0xc64f('0x69')](_0x431b54);_0x2c16ee[_0xc64f('0x51')](_0xc64f('0x97'),_0x586653);}BPromise[_0xc64f('0x98')]()[_0xc64f('0x20')](function(){if(!_0x10d26a){if(_0x3c77c9[_0xc64f('0x48')]['ChatWebsiteId']||_0x3c77c9['query'][_0xc64f('0x99')])return;_0x2c16ee[_0xc64f('0x51')](_0xc64f('0x9a'));_0x448d46['where'](_0xc64f('0x9a'));return;}return _0x3c77c9[_0xc64f('0x9b')][_0xc64f('0x9c')]({'attributes':['id'],'raw':!![]})[_0xc64f('0x20')](function(_0x57002a){if(_[_0xc64f('0x7e')](_0x57002a)){_0x2c16ee[_0xc64f('0x51')]('i.ChatWebsiteId\x20IS\x20NULL');_0x448d46[_0xc64f('0x51')](_0xc64f('0x9d'));}else{_0x2c16ee[_0xc64f('0x51')](_0xc64f('0x7f'),_[_0xc64f('0x47')](_0x57002a,'id'));_0x448d46['where']('i.ChatWebsiteId\x20IN\x20?',_[_0xc64f('0x47')](_0x57002a,'id'));}});})[_0xc64f('0x20')](function(){db[_0xc64f('0x9e')][_0xc64f('0x48')](_0x2c16ee[_0xc64f('0x9f')](),_0x2d91f3)['then'](function(_0x2ce03c){_0x41ea23[_0xc64f('0x2e')]=_0x2ce03c[_0xc64f('0x67')];if(_0x41ea23[_0xc64f('0x2e')]===0x0)return[];return db[_0xc64f('0x9e')][_0xc64f('0x48')](_0x203a46['toString'](),_0x2d91f3)['then'](function(_0x47c337){_0x2c2620=_['keyBy'](_0x47c337,'id');_0x2d91f3=_['merge'](_0x2d91f3,{'model':db[_0xc64f('0x41')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c77c9[_0xc64f('0x48')][_0xc64f('0x4b')]){_0x2cfc07['attributes'][_0xc64f('0x3e')](function(_0x26962a){_0x448d46['field']('i.'+_0x26962a);});}else{_0x448d46[_0xc64f('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc64f('0x96'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xa0'),_0xc64f('0xa1'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xa2'),_0xc64f('0xa3'));_0x448d46[_0xc64f('0x53')]('i.*');_0x448d46[_0xc64f('0x53')]('c.firstName','Contact.firstName');_0x448d46['field'](_0xc64f('0xa4'),_0xc64f('0xa5'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xa6'),_0xc64f('0xa7'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xa8'),_0xc64f('0xa9'));_0x448d46[_0xc64f('0x53')]('c.mobile','Contact.mobile');_0x448d46[_0xc64f('0x53')](_0xc64f('0xaa'),_0xc64f('0xab'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xac'),_0xc64f('0xad'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xae'),_0xc64f('0xaf'));_0x448d46[_0xc64f('0x53')](_0xc64f('0xb0'),_0xc64f('0x3c'));}if(_0x2cfc07[_0xc64f('0x30')])_0x448d46[_0xc64f('0x30')](_0x2cfc07[_0xc64f('0x30')]);if(_0x2cfc07[_0xc64f('0x2f')])_0x448d46[_0xc64f('0x2f')](_0x2cfc07[_0xc64f('0x2f')]);return db[_0xc64f('0x9e')]['query'](_0x448d46[_0xc64f('0x9f')](),_0x2d91f3);})['then'](function(_0x55afec){_0x39fecd[_0xc64f('0x51')](_0xc64f('0xb1'),_[_0xc64f('0x47')](_0x55afec,'id'));return db['sequelize']['query'](_0x39fecd[_0xc64f('0x9f')](),_0x2d91f3)[_0xc64f('0x20')](function(_0x13f290){var _0x9e9aa6=_[_0xc64f('0xb2')](_0x13f290,'ChatInteractionId');var _0x5f0d71=[];_0x55afec[_0xc64f('0x3e')](function(_0x5905b8){_0x5f0d71[_0xc64f('0x3f')](updateChatInteraction(_0x5905b8,_0x2c2620,_0x9e9aa6));});return BPromise[_0xc64f('0xb3')](_0x5f0d71);});});})[_0xc64f('0x20')](function(_0x2dc2fd){_0x41ea23[_0xc64f('0xb4')]=_0x2dc2fd;return _0x41ea23;})[_0xc64f('0x20')](respondWithFilteredResult(_0x299e77,_0x2cfc07));})[_0xc64f('0x29')](handleError(_0x299e77,null));};exports[_0xc64f('0xb5')]=function(_0x520291,_0x496362){var _0xb26afd={'raw':![],'where':{'id':_0x520291[_0xc64f('0xb6')]['id']}},_0xf3b45b={};_0xf3b45b['model']=_[_0xc64f('0x7b')](db[_0xc64f('0x41')][_0xc64f('0x42')]);_0xf3b45b[_0xc64f('0x48')]=_['keys'](_0x520291[_0xc64f('0x48')]);_0xf3b45b[_0xc64f('0xb7')]=_['intersection'](_0xf3b45b[_0xc64f('0x46')],_0xf3b45b[_0xc64f('0x48')]);_0xb26afd[_0xc64f('0x4c')]=_[_0xc64f('0x4a')](_0xf3b45b[_0xc64f('0x46')],qs[_0xc64f('0x4b')](_0x520291['query'][_0xc64f('0x4b')]));_0xb26afd[_0xc64f('0x4c')]=_0xb26afd[_0xc64f('0x4c')][_0xc64f('0x67')]?_0xb26afd[_0xc64f('0x4c')]:_0xf3b45b[_0xc64f('0x46')];if(_0x520291[_0xc64f('0x48')]['includeAll']){_0xb26afd[_0xc64f('0xb8')]=[{'all':!![]}];}_0xb26afd=_[_0xc64f('0xb9')]({},_0xb26afd,_0x520291[_0xc64f('0xba')]);return db[_0xc64f('0x41')][_0xc64f('0x71')](_0xb26afd)[_0xc64f('0x20')](handleEntityNotFound(_0x496362,null))['then'](respondWithResult(_0x496362,null))['catch'](handleError(_0x496362,null));};exports[_0xc64f('0xbb')]=function(_0x551337,_0x3d829b){return db[_0xc64f('0x41')][_0xc64f('0xbb')](_0x551337[_0xc64f('0x7a')],{})[_0xc64f('0x20')](respondWithResult(_0x3d829b,0xc9))[_0xc64f('0x29')](handleError(_0x3d829b,null));};exports[_0xc64f('0xbc')]=function(_0x34eb2a,_0xb24bc3){if(_0x34eb2a[_0xc64f('0x7a')]['id']){delete _0x34eb2a[_0xc64f('0x7a')]['id'];}return db[_0xc64f('0x41')]['find']({'where':{'id':_0x34eb2a[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](handleEntityNotFound(_0xb24bc3,null))[_0xc64f('0x20')](saveUpdates(_0x34eb2a['body'],null))[_0xc64f('0x20')](respondWithResult(_0xb24bc3,null))[_0xc64f('0x29')](handleError(_0xb24bc3,null));};exports[_0xc64f('0x35')]=function(_0x2cf9ac,_0x4c2966){return db[_0xc64f('0x41')][_0xc64f('0x71')]({'where':{'id':_0x2cf9ac[_0xc64f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4c2966,null))['then'](removeEntity(_0x4c2966,null))[_0xc64f('0x29')](handleError(_0x4c2966,null));};exports[_0xc64f('0xbd')]=function(_0x5daccf,_0x54cd55){return db[_0xc64f('0x41')][_0xc64f('0xbd')]()['then'](respondWithResult(_0x54cd55,null))[_0xc64f('0x29')](handleError(_0x54cd55,null));};exports[_0xc64f('0xbe')]=function(_0x3286d8,_0x6dba64){var _0x4bfcd9=_0x3286d8[_0xc64f('0xb6')]['id'];var _0x5ecf30;var _0xfc3f4a;var _0x50c163;return db[_0xc64f('0x41')][_0xc64f('0xbf')]({'where':{'id':_0x4bfcd9}})[_0xc64f('0x20')](function(_0x2315e1){_0x5ecf30=_0x2315e1;return db['ChatWebsite'][_0xc64f('0xbf')]({'where':{'id':_0x2315e1['ChatWebsiteId']},'attributes':['id',_0xc64f('0xc0'),_0xc64f('0xc1')],'raw':!![]});})[_0xc64f('0x20')](function(_0x40de57){if(_0x40de57&&_0x40de57['vidaooApiKey']&&_0x40de57[_0xc64f('0xc1')]){_0xfc3f4a=_0x40de57;var _0x36d16e={'rejectUnauthorized':![],'method':'POST','uri':_0xc64f('0xc2'),'headers':{'X-APIKEY':_0x40de57[_0xc64f('0xc0')]},'body':{'name':_0xc64f('0xc3')+_0x4bfcd9},'redirect':_0xc64f('0xc4'),'json':!![]};return rp(_0x36d16e);}else{throw new db[(_0xc64f('0xc5'))][(_0xc64f('0xc6'))](_0xc64f('0xc7'));}})['then'](function(_0x7990a2){_0x50c163=_0x7990a2;if(_0x50c163['id']){var _0x2d081c={'body':_0x50c163['join_url'],'ChatWebsiteId':_0xfc3f4a['id'],'ChatInteractionId':_0x5ecf30['id'],'direction':_0xc64f('0xc8'),'UserId':_0x3286d8['user']['id']};return db[_0xc64f('0xc9')][_0xc64f('0xbb')](_0x2d081c,{});}else{throw new db[(_0xc64f('0xc5'))]['ValidationError'](_0xc64f('0xca'));}})[_0xc64f('0x20')](function(){return _0x5ecf30[_0xc64f('0xcb')]({'vidaooSessionId':_0x50c163['id']});})[_0xc64f('0x20')](respondWithResult(_0x6dba64,null))[_0xc64f('0x29')](handleError(_0x6dba64,null));};exports[_0xc64f('0xcc')]=function(_0x35375d,_0x5c1616){if(_0x35375d['body']['id']){delete _0x35375d[_0xc64f('0x7a')]['id'];}return db[_0xc64f('0x41')][_0xc64f('0x71')]({'where':{'id':_0x35375d[_0xc64f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5c1616,null))[_0xc64f('0x20')](saveUpdates(_0x35375d[_0xc64f('0x7a')],null))['then'](respondWithResult(_0x5c1616,null))[_0xc64f('0x29')](handleError(_0x5c1616,null));};exports['abandon']=function(_0xc7873a,_0x276ddf,_0x281dba){if(_0xc7873a[_0xc64f('0x7a')]['id']){delete _0xc7873a[_0xc64f('0x7a')]['id'];}return db['ChatInteraction'][_0xc64f('0x71')]({'where':{'id':_0xc7873a[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](function(_0x45f1b0){if(!_0x45f1b0){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xc64f('0xcd'),0x194,_0xc64f('0xce'));_0x276ddf[_0xc64f('0x2a')](0x194);}else{if(_0x45f1b0[_0xc64f('0xcf')]){throw new db[(_0xc64f('0xc5'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x45f1b0;})[_0xc64f('0x20')](function(_0x3c46c1){if(_0x3c46c1){return _0x3c46c1['update']({'closed':_0xc7873a[_0xc64f('0x7a')][_0xc64f('0xd0')],'disposition':_0xc7873a[_0xc64f('0x7a')]['disposition']})[_0xc64f('0x20')](function(_0x2023fb){return _0x2023fb;});}})['then'](function(_0x27a7dd){return respondWithRpcPromise(_0xc64f('0xd1'),_0xc64f('0xcd'),_0xc7873a[_0xc64f('0x7a')],client9004);})[_0xc64f('0x20')](respondWithResult(_0x276ddf,null))['catch'](handleError(_0x276ddf,null));};exports[_0xc64f('0xd2')]=function(_0x3a0e45,_0x51037a,_0x1404ba){_0x3a0e45[_0xc64f('0x7a')][_0xc64f('0x37')]=_0x3a0e45[_0xc64f('0xd3')][_0xc64f('0xd4')];_0x3a0e45[_0xc64f('0x7a')][_0xc64f('0xd5')]=_0x3a0e45[_0xc64f('0xd3')][_0xc64f('0xd6')];_0x3a0e45[_0xc64f('0x7a')][_0xc64f('0x44')]=_0x3a0e45[_0xc64f('0xd3')][_0xc64f('0xd7')];return db[_0xc64f('0xd8')]['create'](_0x3a0e45[_0xc64f('0x7a')])['then'](respondWithResult(_0x51037a,0xc9))[_0xc64f('0x29')](handleError(_0x51037a,null));};exports[_0xc64f('0xd9')]=function(_0x23023e,_0x3fefa4,_0x1cd7f2){return db['ChatInteraction'][_0xc64f('0xbf')]({'where':{'id':_0x23023e[_0xc64f('0xb6')]['id']},'raw':!![]})[_0xc64f('0x20')](handleEntityNotFound(_0x3fefa4,null))['then'](function(_0xd6fb00){if(_0xd6fb00){if(_0xd6fb00[_0xc64f('0xd0')]){return _0x3fefa4[_0xc64f('0x2b')](0x193)[_0xc64f('0x2d')]({'status':0x193,'message':_0xc64f('0xda')});}return db[_0xc64f('0xd8')]['findOne']({'where':{'id':_0x23023e[_0xc64f('0x48')][_0xc64f('0xdb')]},'raw':!![]})[_0xc64f('0x20')](handleEntityNotFound(_0x3fefa4,null));}})[_0xc64f('0x20')](function(_0x2688aa){if(_0x2688aa){return _0x3fefa4[_0xc64f('0xdc')](path[_0xc64f('0xdd')](config[_0xc64f('0xde')],'server/files/attachments/',_0x2688aa[_0xc64f('0xd5')]));}})[_0xc64f('0x29')](handleError(_0x3fefa4,null));};exports['close']=function(_0x188991,_0x2d1a7f){var _0x442d7b=null;var _0xa1dcfc=null;var _0x48551c=null;var _0x3bb2ee=null;if(_0x188991[_0xc64f('0x7a')]['id']){delete _0x188991[_0xc64f('0x7a')]['id'];}if(_0x188991[_0xc64f('0x7a')][_0xc64f('0xdf')]){_0x3bb2ee=path['join'](config[_0xc64f('0xde')],_0xc64f('0xe0'),util[_0xc64f('0xe1')](_0xc64f('0xe2'),Date[_0xc64f('0xe3')]()));_0x188991['body']['pathTranscript']=_0x3bb2ee;}return db[_0xc64f('0x41')][_0xc64f('0x71')]({'where':{'id':_0x188991[_0xc64f('0xb6')]['id']},'include':[{'model':db[_0xc64f('0xc9')],'as':_0xc64f('0xe4'),'include':[{'model':db[_0xc64f('0x76')],'as':_0xc64f('0x76')}]}]})[_0xc64f('0x20')](handleEntityNotFound(_0x2d1a7f,null))[_0xc64f('0x20')](saveUpdates(_0x188991['body'],null))[_0xc64f('0x20')](function(_0x20f4fe){if(_0x20f4fe){_0x442d7b=_0x20f4fe;return db[_0xc64f('0xe5')]['find']({'where':{'id':_0x442d7b[_0xc64f('0xe6')]}});}})[_0xc64f('0x20')](function(_0xd96183){if(_0xd96183){_0x48551c=_0xd96183;return db[_0xc64f('0xe7')][_0xc64f('0x71')]({'where':{'id':_0x442d7b['ContactId']}});}})['then'](function(_0x1f3ab4){if(_0x1f3ab4){_0xa1dcfc=_0x1f3ab4;if(_0x3bb2ee){var _0x31e037=null;for(var _0x189882=0x1;_0x189882<_0x442d7b[_0xc64f('0xe4')]['length'];++_0x189882){_0x31e037=_0x442d7b[_0xc64f('0xe4')][_0x189882];var _0x5d390c=_0x31e037[_0xc64f('0xcf')]?util[_0xc64f('0xe1')](_0xc64f('0xe8'),_0x48551c[_0xc64f('0xe9')],_0x31e037[_0xc64f('0xcf')]):_0xc64f('0xea');var _0x59d7b7=_0x188991['body']['customer']||util[_0xc64f('0xe1')](_0xc64f('0xe8'),_0xc64f('0xeb'),_0x31e037[_0xc64f('0xec')]);switch(_0x48551c['agentIdentifier']){case _0xc64f('0xed'):_0x5d390c=_0x31e037[_0xc64f('0xcf')]?util[_0xc64f('0xe1')](_0xc64f('0xe8'),_0x48551c[_0xc64f('0xe9')],_0x31e037[_0xc64f('0xcf')]):_0xc64f('0xea');break;case _0xc64f('0xee'):_0x5d390c=_0x31e037[_0xc64f('0xcf')]?_0x31e037[_0xc64f('0x76')]['alias']||_0x31e037[_0xc64f('0x76')]['fullname']:_0xc64f('0xea');break;case _0xc64f('0xef'):_0x5d390c=_0x31e037[_0xc64f('0xcf')]?_0x31e037['User'][_0xc64f('0x3a')]:_0xc64f('0xea');break;default:_0x5d390c=_0x31e037[_0xc64f('0xcf')]?util[_0xc64f('0xe1')]('%s%d',_0x48551c[_0xc64f('0xe9')],_0x31e037[_0xc64f('0xcf')]):'System';}var _0x5a7bc6=util['format'](_0xc64f('0xf0'),moment(_0x31e037[_0xc64f('0x81')])['format'](_0xc64f('0xf1')),_0x31e037['direction']==='in'?_0x59d7b7:_0x5d390c,_0x31e037['body']);if(!_0x31e037[_0xc64f('0xf2')]){fs[_0xc64f('0xf3')](_0x3bb2ee,_0x5a7bc6);}}return db[_0xc64f('0xf4')][_0xc64f('0xbf')]({'where':{'service':!![]},'include':[{'model':db[_0xc64f('0xf5')],'as':_0xc64f('0xf6'),'raw':!![]}]});}}})['then'](function(_0x471bfb){if(_0x471bfb&&_0x471bfb[_0xc64f('0xf6')]&&_0x188991['body']){var _0x2ecc58={'tls':{'rejectUnauthorized':![]}};if(_0x471bfb[_0xc64f('0xf6')][_0xc64f('0xf7')]){_0x2ecc58[_0xc64f('0xf7')]=_0x471bfb[_0xc64f('0xf6')][_0xc64f('0xf7')];}else{_0x2ecc58[_0xc64f('0xf8')]=_0x471bfb[_0xc64f('0xf6')]['host'];_0x2ecc58[_0xc64f('0xf9')]=_0x471bfb[_0xc64f('0xf6')][_0xc64f('0xf9')];_0x2ecc58[_0xc64f('0xfa')]=_0x471bfb['Smtp'][_0xc64f('0xfa')];}if(_0x471bfb['Smtp'][_0xc64f('0xfb')]){_0x2ecc58['auth']={'user':_0x471bfb[_0xc64f('0xf6')][_0xc64f('0x9b')],'pass':_0x471bfb[_0xc64f('0xf6')][_0xc64f('0xfc')]};}return respondWithRpcPromise(_0xc64f('0xfd'),_0xc64f('0xfe'),{'account':_0x2ecc58,'message':{'from':util[_0xc64f('0xe1')](_0xc64f('0xff'),_0x471bfb['name'],_0x471bfb['email']||_0x471bfb[_0xc64f('0xf6')][_0xc64f('0x9b')]),'to':_0x188991[_0xc64f('0x7a')][_0xc64f('0xdf')],'subject':_0xc64f('0x100'),'text':util[_0xc64f('0xe1')](_0xc64f('0x101'),_0x188991[_0xc64f('0x7a')]['mailTranscript']),'attachments':[{'path':_0x3bb2ee}]}})[_0xc64f('0x20')](function(){return _0x442d7b;})[_0xc64f('0x29')](function(_0x103570){console[_0xc64f('0x26')](_0x103570);});}else{return _0x442d7b;}})[_0xc64f('0x20')](respondWithStatusCode(_0x2d1a7f,0xc8))[_0xc64f('0x29')](handleError(_0x2d1a7f,null));};exports[_0xc64f('0x102')]=function(_0x1089d2,_0x38385f,_0x584a3c){return db['ChatMessage'][_0xc64f('0x71')]({'where':{'id':_0x1089d2[_0xc64f('0xb6')]['id']}})['then'](handleEntityNotFound(_0x38385f,null))['then'](function(_0x363b33){if(_0x363b33){return _0x363b33[_0xc64f('0x102')](_0x1089d2[_0xc64f('0x7a')]['ids'],_[_0xc64f('0x103')](_0x1089d2[_0xc64f('0x7a')],['ids','id'])||{});}})[_0xc64f('0x20')](respondWithResult(_0x38385f,null))['catch'](handleError(_0x38385f,null));};exports[_0xc64f('0x104')]=function(_0x519f53,_0x41282a,_0x58d1c5){var _0x49ccd6={'raw':![],'where':{}};var _0x279f7a={};var _0x661ab0={'count':0x0,'rows':[]};return db[_0xc64f('0x41')][_0xc64f('0xbf')]({'where':{'id':_0x519f53[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](handleEntityNotFound(_0x41282a,null))[_0xc64f('0x20')](function(_0x1b489e){if(_0x1b489e){_0x279f7a[_0xc64f('0x46')]=_[_0xc64f('0x7b')](db['ChatMessage'][_0xc64f('0x42')]);_0x279f7a[_0xc64f('0x48')]=_[_0xc64f('0x7b')](_0x519f53['query']);_0x279f7a[_0xc64f('0x49')]=_[_0xc64f('0x4a')](_0x279f7a[_0xc64f('0x46')],_0x279f7a[_0xc64f('0x48')]);_0x49ccd6[_0xc64f('0x4c')]=_[_0xc64f('0x4a')](_0x279f7a[_0xc64f('0x46')],qs['fields'](_0x519f53[_0xc64f('0x48')][_0xc64f('0x4b')]));_0x49ccd6[_0xc64f('0x4c')]=_0x49ccd6[_0xc64f('0x4c')][_0xc64f('0x67')]?_0x49ccd6[_0xc64f('0x4c')]:_0x279f7a[_0xc64f('0x46')];if(!_0x519f53['query'][_0xc64f('0x4d')](_0xc64f('0x4e'))){_0x49ccd6['limit']=qs['limit'](_0x519f53[_0xc64f('0x48')][_0xc64f('0x30')]);_0x49ccd6[_0xc64f('0x2f')]=qs['offset'](_0x519f53['query'][_0xc64f('0x2f')]);}_0x49ccd6[_0xc64f('0x4f')]=qs['sort'](_0x519f53[_0xc64f('0x48')][_0xc64f('0x50')]);_0x49ccd6['where']=qs[_0xc64f('0x49')](_[_0xc64f('0x52')](_0x519f53[_0xc64f('0x48')],_0x279f7a['filters']));_0x49ccd6[_0xc64f('0x51')][_0xc64f('0x105')]=_0x1b489e['id'];if(_0x519f53[_0xc64f('0x48')]['filter']){_0x49ccd6[_0xc64f('0x51')]=_[_0xc64f('0xb9')](_0x49ccd6[_0xc64f('0x51')],{'$or':_[_0xc64f('0x47')](_0x49ccd6['attributes'],function(_0x5d8cc2){var _0x210730={};_0x210730[_0x5d8cc2]={'$like':'%'+_0x519f53[_0xc64f('0x48')][_0xc64f('0x106')]+'%'};return _0x210730;})});}if(_0x519f53[_0xc64f('0x48')]['$gte']){var _0x44b797=_0x519f53['query'][_0xc64f('0x83')]['split'](',');var _0x516f29={};_0x516f29[_0x44b797[0x0]]={'$gte':moment(_0x44b797[0x1])[_0xc64f('0xe1')](_0xc64f('0x107'))};_0x49ccd6[_0xc64f('0x51')]=_[_0xc64f('0xb9')](_0x49ccd6[_0xc64f('0x51')],_0x516f29);}_0x49ccd6=_[_0xc64f('0xb9')]({},_0x49ccd6,_0x519f53[_0xc64f('0xba')]);return db[_0xc64f('0xc9')][_0xc64f('0x2e')]({'where':_0x49ccd6[_0xc64f('0x51')]})[_0xc64f('0x20')](function(_0x24046a){_0x661ab0[_0xc64f('0x2e')]=_0x24046a;if(_0x519f53[_0xc64f('0x48')][_0xc64f('0x108')]){_0x49ccd6['include']=[{'all':!![]}];}return db[_0xc64f('0xc9')][_0xc64f('0x109')](_0x49ccd6);})[_0xc64f('0x20')](function(_0x19d8ba){_0x661ab0[_0xc64f('0xb4')]=_0x19d8ba;return _0x661ab0;});}})['then'](respondWithFilteredResult(_0x41282a,_0x49ccd6))[_0xc64f('0x29')](handleError(_0x41282a,null));};exports['getMyMessages']=function(_0x4f834a,_0x23f3a0,_0x2e3ee1){var _0x54d59e={'where':{}},_0x35b562={},_0x220bf7={'count':0x0,'rows':[]};return db[_0xc64f('0x41')][_0xc64f('0xbf')]({'where':{'id':_0x4f834a[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](handleEntityNotFound(_0x23f3a0,null))[_0xc64f('0x20')](function(_0x2cd4bc){if(_0x2cd4bc){_0x35b562['model']=_[_0xc64f('0x7b')](db['ChatMessage'][_0xc64f('0x42')]);_0x35b562['query']=_[_0xc64f('0x7b')](_0x4f834a[_0xc64f('0x48')]);_0x35b562[_0xc64f('0x49')]=_[_0xc64f('0x4a')](_0x35b562[_0xc64f('0x46')],_0x35b562[_0xc64f('0x48')]);_0x54d59e[_0xc64f('0x4c')]=_[_0xc64f('0x4a')](_0x35b562[_0xc64f('0x46')],qs[_0xc64f('0x4b')](_0x4f834a[_0xc64f('0x48')][_0xc64f('0x4b')]));_0x54d59e['attributes']=_0x54d59e[_0xc64f('0x4c')][_0xc64f('0x67')]?_0x54d59e[_0xc64f('0x4c')]:_0x35b562[_0xc64f('0x46')];if(!_0x4f834a[_0xc64f('0x48')][_0xc64f('0x4d')](_0xc64f('0x4e'))){_0x54d59e[_0xc64f('0x30')]=qs['limit'](_0x4f834a[_0xc64f('0x48')]['limit']);_0x54d59e[_0xc64f('0x2f')]=qs[_0xc64f('0x2f')](_0x4f834a['query'][_0xc64f('0x2f')]);}_0x54d59e[_0xc64f('0x4f')]=qs[_0xc64f('0x50')](_0x4f834a[_0xc64f('0x48')][_0xc64f('0x50')]);_0x54d59e[_0xc64f('0x51')]=qs[_0xc64f('0x49')](_['pick'](_0x4f834a[_0xc64f('0x48')],_0x35b562[_0xc64f('0x49')]));_0x54d59e['where'][_0xc64f('0x105')]=_0x2cd4bc['id'];if(_0x4f834a[_0xc64f('0x48')][_0xc64f('0x106')]){_0x54d59e['where']=_[_0xc64f('0xb9')](_0x54d59e[_0xc64f('0x51')],{'$or':_[_0xc64f('0x47')](_0x54d59e[_0xc64f('0x4c')],function(_0x5ef87a){var _0x444fb6={};_0x444fb6[_0x5ef87a]={'$like':'%'+_0x4f834a[_0xc64f('0x48')][_0xc64f('0x106')]+'%'};return _0x444fb6;})});}_0x54d59e[_0xc64f('0x51')][_0xc64f('0xf2')]=![];if(_0x4f834a['query']['id']){_0x54d59e[_0xc64f('0x51')]['id']={'$gt':_0x4f834a[_0xc64f('0x48')]['id']};}_0x54d59e=_[_0xc64f('0xb9')]({},_0x54d59e,_0x4f834a['options']);return db[_0xc64f('0xc9')][_0xc64f('0x2e')]({'where':_0x54d59e[_0xc64f('0x51')]})[_0xc64f('0x20')](function(_0x1538db){_0x220bf7[_0xc64f('0x2e')]=_0x1538db;_0x54d59e[_0xc64f('0xb8')]=[];if(_0x4f834a[_0xc64f('0x48')]['includeAgent']){_0x54d59e[_0xc64f('0xb8')][_0xc64f('0x3f')]({'model':db['User'],'as':_0xc64f('0x76'),'attributes':['id',_0xc64f('0x3a'),_0xc64f('0x10a')]});}if(_0x4f834a[_0xc64f('0x48')][_0xc64f('0x108')]){_0x54d59e[_0xc64f('0xb8')]=[{'all':!![]}];}return db[_0xc64f('0xc9')][_0xc64f('0x109')](_0x54d59e);})[_0xc64f('0x20')](function(_0x19af54){_0x220bf7['rows']=_0x19af54;return _0x220bf7;});}})['then'](respondWithFilteredResult(_0x23f3a0,_0x54d59e))['catch'](handleError(_0x23f3a0,null));};exports[_0xc64f('0x10b')]=function(_0x208bb5,_0xb8ec08,_0xc7f75b){return db['ChatInteraction'][_0xc64f('0x71')]({'where':{'id':_0x208bb5[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](handleEntityNotFound(_0xb8ec08,null))[_0xc64f('0x20')](function(_0x471f57){if(_0x471f57){return _0x471f57[_0xc64f('0x10c')](_0x208bb5[_0xc64f('0x7a')]['ids'],_[_0xc64f('0x103')](_0x208bb5[_0xc64f('0x7a')],[_0xc64f('0x10d'),'id'])||{})[_0xc64f('0x10e')](function(){return db[_0xc64f('0x73')][_0xc64f('0x109')]({'attributes':['id',_0xc64f('0x37'),'color'],'where':{'id':_0x208bb5[_0xc64f('0x7a')]['ids']}});})[_0xc64f('0x20')](function(_0x535ae8){socket[_0xc64f('0x10f')]('chatInteractionTags:save',{'id':Number(_0x208bb5[_0xc64f('0xb6')]['id']),'tags':_0x535ae8||[]});return{'id':Number(_0x208bb5[_0xc64f('0xb6')]['id']),'tags':_0x535ae8||[]};});}})[_0xc64f('0x20')](respondWithResult(_0xb8ec08,null))['catch'](handleError(_0xb8ec08,null));};exports[_0xc64f('0x110')]=function(_0x56579b,_0x380c4e,_0x17cbad){return db[_0xc64f('0x41')][_0xc64f('0x71')]({'where':{'id':_0x56579b[_0xc64f('0xb6')]['id']}})[_0xc64f('0x20')](handleEntityNotFound(_0x380c4e,null))[_0xc64f('0x20')](function(_0x8768f7){if(_0x8768f7){return _0x8768f7['removeTags'](_0x56579b[_0xc64f('0x48')][_0xc64f('0x10d')]);}})[_0xc64f('0x20')](respondWithStatusCode(_0x380c4e,null))[_0xc64f('0x29')](handleError(_0x380c4e,null));};exports[_0xc64f('0xdc')]=function(_0x21b7bc,_0x2c0229){var _0x42e7ed=moment()['unix']()[_0xc64f('0x9f')]();var _0x5dbb53=path[_0xc64f('0xdd')](config['root'],_0xc64f('0x111'),_0xc64f('0x112'),'tmp');var _0x35efb7=path['join'](config['root'],_0xc64f('0x111'),_0xc64f('0x112'),_0xc64f('0x113'));var _0x335aec=path[_0xc64f('0xdd')](_0x5dbb53,_0x42e7ed);var _0x126ffb=util[_0xc64f('0xe1')](_0xc64f('0x114'),_0x21b7bc[_0xc64f('0xb6')]['id'],_0x42e7ed);var _0x2dbb62=path['join'](_0x5dbb53,_0x126ffb);var _0x284dcf=[];_0x284dcf['push']({'model':db[_0xc64f('0x76')],'as':_0xc64f('0x76'),'attributes':['id',_0xc64f('0x3a')],'raw':!![]});_0x284dcf[_0xc64f('0x3f')]({'model':db[_0xc64f('0xe7')],'as':_0xc64f('0x6b'),'attributes':['id',_0xc64f('0x115'),_0xc64f('0x116')],'raw':!![]});if(_0x21b7bc[_0xc64f('0x48')][_0xc64f('0x113')]){_0x284dcf[_0xc64f('0x3f')]({'model':db['Attachment'],'as':_0xc64f('0xd8'),'raw':!![]});}var _0x501b72=[{'model':db[_0xc64f('0xc9')],'as':_0xc64f('0xe4'),'attributes':['id','body',_0xc64f('0x81'),'direction','secret',_0xc64f('0x88')],'include':_0x284dcf}];_0x501b72[_0xc64f('0x3f')]({'model':db[_0xc64f('0xe5')],'as':'Account','attributes':['id',_0xc64f('0x37')]});_0x501b72['push']({'model':db['User'],'as':_0xc64f('0x117'),'attributes':['id','fullname']});return db[_0xc64f('0x41')][_0xc64f('0x71')]({'where':{'id':_0x21b7bc['params']['id']},'include':_0x501b72})[_0xc64f('0x20')](handleEntityNotFound(_0x2c0229,null))[_0xc64f('0x20')](function(_0x403f4f){if(_0x403f4f){var _0x438cb9=_0x403f4f['get']({'plain':!![]});fs[_0xc64f('0x118')](_0x335aec);var _0xc4a630={'format':'A4','border':'10px','header':{'height':_0xc64f('0x119'),'contents':{'first':_0xc64f('0x11a')}},'footer':{'height':_0xc64f('0x11b'),'contents':{'default':util[_0xc64f('0xe1')](_0xc64f('0x11c'),util['format'](_0xc64f('0x11d'),_0xc64f('0x11e'),_0x438cb9['id']),moment()[_0xc64f('0xe1')](_0xc64f('0x11f'))[_0xc64f('0x9f')]())}}};var _0x457aa1={'channel':_0xc64f('0x11e'),'account':_0x438cb9[_0xc64f('0x120')][_0xc64f('0x37')],'agent':_0x438cb9[_0xc64f('0x117')]?_0x438cb9['Owner']['fullname']:_0xc64f('0x121'),'createdAt':moment(_0x438cb9[_0xc64f('0x81')])[_0xc64f('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc64f('0x9f')](),'closedAt':_0x438cb9[_0xc64f('0xd0')]?moment(_0x438cb9['closedAt'])[_0xc64f('0xe1')](_0xc64f('0x107'))['toString']():'','disposition':_0x438cb9[_0xc64f('0x122')],'chatInfo':{'browser':_0x438cb9[_0xc64f('0x123')],'os':_0x438cb9[_0xc64f('0x124')],'referer':_0x438cb9[_0xc64f('0x125')],'customerIp':_0x438cb9[_0xc64f('0x126')],'customerPort':_0x438cb9['customerPort']?_0x438cb9[_0xc64f('0x127')]:_0xc64f('0x121')},'messages':_(_0x438cb9[_0xc64f('0xe4')])['tail']()[_0xc64f('0x106')]({'secret':![]})['map'](function(_0x23144f){if(_0x23144f['Attachment']){var _0x2e1e68=path['join'](_0x35efb7,_0x23144f[_0xc64f('0xd8')][_0xc64f('0xd5')]);if(fs[_0xc64f('0x128')](_0x2e1e68)){fs[_0xc64f('0x129')](_0x2e1e68)[_0xc64f('0x12a')](fs[_0xc64f('0x12b')](path[_0xc64f('0xdd')](_0x335aec,_0x23144f[_0xc64f('0xd8')][_0xc64f('0xd5')])));}}return{'date':moment(_0x23144f[_0xc64f('0x81')])[_0xc64f('0xe1')](_0xc64f('0x107'))['toString'](),'sender':_0x23144f[_0xc64f('0x12c')]===_0xc64f('0xc8')?_0x23144f['User']?_0x23144f[_0xc64f('0x76')][_0xc64f('0x3a')]:_0xc64f('0xea'):_0x23144f[_0xc64f('0x6b')][_0xc64f('0x115')]+(_0x23144f['Contact'][_0xc64f('0x116')]?'\x20'+_0x23144f[_0xc64f('0x6b')][_0xc64f('0x116')]:''),'body':_0x23144f[_0xc64f('0xd8')]?_0x23144f['Attachment'][_0xc64f('0xd5')]:_0x23144f['body'],'direction':_0x23144f[_0xc64f('0x12c')]==='out'?'A':'C','secret':_0x23144f[_0xc64f('0xf2')],'read':_0x23144f[_0xc64f('0x88')],'attachment':_0x23144f[_0xc64f('0xd8')]};})[_0xc64f('0x68')]()};return ejs['renderFile'](path[_0xc64f('0xdd')](config['root'],_0xc64f('0x111'),'views',_0xc64f('0x12d')),{'interaction':_0x457aa1})[_0xc64f('0x20')](function(_0x1812a9){return new BPromise(function(_0xe986c1,_0x3cd7ae){pdf['create'](_0x1812a9,_0xc4a630)[_0xc64f('0x12e')](path['join'](_0x335aec,_0xc64f('0x12f')+_0x438cb9['id']+'-'+_0x42e7ed+'.pdf'),function(_0x1034b6,_0x108db2){if(_0x1034b6)return _0x3cd7ae(_0x1034b6);_0xe986c1(_0x108db2);});});})[_0xc64f('0x20')](function(){return new BPromise(function(_0xe441d7,_0x76b587){zipdir(_0x335aec,{'saveTo':_0x2dbb62},function(_0x20ad74,_0xa3ab80){if(_0x20ad74)return _0x76b587(_0x20ad74);return _0xe441d7(_0xa3ab80);});})[_0xc64f('0x20')](function(){return new BPromise(function(_0x53e0ac,_0xdf61b9){rimraf(_0x335aec,function(_0x1356d1){if(_0x1356d1)_0xdf61b9(_0x1356d1);return _0x53e0ac();});});})[_0xc64f('0x20')](function(){return _0x2c0229['download'](_0x2dbb62,_0x126ffb,function(_0x4e8156){if(_0x4e8156){console[_0xc64f('0x130')](_0xc64f('0x131'),_0x4e8156);}else{fs[_0xc64f('0x132')](_0x2dbb62);}});});});}else{return _0x2c0229['sendStatus'](0xc8);}})[_0xc64f('0x29')](handleError(_0x2c0229,null));}; \ No newline at end of file +var _0x36ab=['count','offset','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','TagIds','Tags','split','index','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','select','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','rows','catch','params','rawAttributes','filtears','includeAll','include','merge','create','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','attachmentUpload','file','originalname','basename','filename','Unauthorized','Attachment','download','join','root','server/files/attachments/','mailTranscript','format','transcript-%s.txt','pathTranscript','CmContact','Messages','customer','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','agent_fullname','fullname','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','findOne','MailServerOut','Smtp','service','host','port','secure','auth','user','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','options','includeAgent','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','files','tmp','server','attachments','firstName','lastName','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','N.A.','closed','closedAt','disposition','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ab,0x107));var _0xb36a=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x36ab[_0x58dc25];return _0x21b0a7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb36a('0x0'));var rimraf=require(_0xb36a('0x1'));var zipdir=require(_0xb36a('0x2'));var jsonpatch=require(_0xb36a('0x3'));var rp=require(_0xb36a('0x4'));var moment=require(_0xb36a('0x5'));var BPromise=require(_0xb36a('0x6'));var Mustache=require('mustache');var util=require(_0xb36a('0x7'));var path=require(_0xb36a('0x8'));var sox=require(_0xb36a('0x9'));var csv=require(_0xb36a('0xa'));var ejs=require(_0xb36a('0xb'));var fs=require('fs');var _=require(_0xb36a('0xc'));var squel=require(_0xb36a('0xd'));var crypto=require(_0xb36a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb36a('0xf'));var toCsv=require(_0xb36a('0xa'));var querystring=require(_0xb36a('0x10'));var Papa=require(_0xb36a('0x11'));var Redis=require(_0xb36a('0x12'));var authService=require(_0xb36a('0x13'));var qs=require(_0xb36a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb36a('0x15'));var logger=require(_0xb36a('0x16'))(_0xb36a('0x17'));var utils=require(_0xb36a('0x18'));var config=require(_0xb36a('0x19'));var licenseUtil=require(_0xb36a('0x1a'));var db=require(_0xb36a('0x1b'))['db'];config[_0xb36a('0x1c')]=_[_0xb36a('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb36a('0x1c')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xb36a('0x1e')][_0xb36a('0x1f')]({'port':0x232b});var client9004=jayson['client'][_0xb36a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x55f525,_0x2641c1,_0x51ddd2,_0x14ae12){return new BPromise(function(_0x1485f5,_0x1a3f8c){var _0x153232=_0x14ae12||client;return _0x153232[_0xb36a('0x20')](_0x55f525,_0x51ddd2)['then'](function(_0x29543e){logger[_0xb36a('0x21')](_0xb36a('0x22'),_0x2641c1,_0xb36a('0x23'));logger[_0xb36a('0x24')](_0xb36a('0x25'),_0x2641c1,_0xb36a('0x23'),JSON[_0xb36a('0x26')](_0x29543e));if(_0x29543e[_0xb36a('0x27')]){if(_0x29543e[_0xb36a('0x27')][_0xb36a('0x28')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2641c1,_0x29543e[_0xb36a('0x27')][_0xb36a('0x29')]);return _0x1a3f8c(_0x29543e[_0xb36a('0x27')][_0xb36a('0x29')]);}logger[_0xb36a('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x2641c1,_0x29543e['error'][_0xb36a('0x29')]);return _0x1485f5(_0x29543e[_0xb36a('0x27')]['message']);}else{logger[_0xb36a('0x21')](_0xb36a('0x22'),_0x2641c1,_0xb36a('0x23'));_0x1485f5(_0x29543e[_0xb36a('0x2a')][_0xb36a('0x29')]);}})['catch'](function(_0x50d2e6){logger[_0xb36a('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x2641c1,_0x50d2e6);_0x1a3f8c(_0x50d2e6);});});}function respondWithStatusCode(_0x611ef5,_0x4adc17){_0x4adc17=_0x4adc17||0xcc;return function(_0x2025bf){if(_0x2025bf){return _0x611ef5[_0xb36a('0x2b')](_0x4adc17);}return _0x611ef5[_0xb36a('0x2c')](_0x4adc17)[_0xb36a('0x2d')]();};}function respondWithResult(_0x4b5411,_0x13e1c0){_0x13e1c0=_0x13e1c0||0xc8;return function(_0x4af46f){if(_0x4af46f){return _0x4b5411[_0xb36a('0x2c')](_0x13e1c0)[_0xb36a('0x2e')](_0x4af46f);}};}function respondWithFilteredResult(_0x4c9d74,_0x307016){return function(_0x26342d){if(_0x26342d){var _0x22f939=_0x26342d[_0xb36a('0x2f')],_0x565765=_0x307016[_0xb36a('0x30')],_0x420ede=_0x307016[_0xb36a('0x30')]+_0x307016['limit'],_0x3d4f30;if(_0x420ede>=_0x22f939){_0x420ede=_0x22f939;_0x3d4f30=0xc8;}else{_0x3d4f30=0xce;}_0x4c9d74[_0xb36a('0x2c')](_0x3d4f30);return _0x4c9d74[_0xb36a('0x31')](_0xb36a('0x32'),_0x565765+'-'+_0x420ede+'/'+_0x22f939)[_0xb36a('0x2e')](_0x26342d);}return null;};}function patchUpdates(_0x34d3cb){return function(_0x16ba41){try{jsonpatch[_0xb36a('0x33')](_0x16ba41,_0x34d3cb,!![]);}catch(_0x49b5df){return BPromise[_0xb36a('0x34')](_0x49b5df);}return _0x16ba41[_0xb36a('0x35')]();};}function saveUpdates(_0x4904a7,_0x40740d){return function(_0x12efaf){if(_0x12efaf){return _0x12efaf[_0xb36a('0x36')](_0x4904a7)['then'](function(_0x63151b){return _0x63151b;});}return null;};}function removeEntity(_0x1053dd,_0x1c58e0){return function(_0xa5bbbc){if(_0xa5bbbc){return _0xa5bbbc[_0xb36a('0x37')]()[_0xb36a('0x38')](function(){_0x1053dd[_0xb36a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e2840,_0x3d497c){return function(_0x1322a0){if(!_0x1322a0){_0x2e2840[_0xb36a('0x2b')](0x194);}return _0x1322a0;};}function handleError(_0x430995,_0x418b77){_0x418b77=_0x418b77||0x1f4;return function(_0x476733){logger[_0xb36a('0x27')](_0x476733[_0xb36a('0x39')]);if(_0x476733[_0xb36a('0x3a')]){delete _0x476733[_0xb36a('0x3a')];}_0x430995[_0xb36a('0x2c')](_0x418b77)[_0xb36a('0x3b')](_0x476733);};}function getInteractionUsers(_0xe53a1e,_0x1ee578){return new BPromise(function(_0x1ab4b7,_0x129014){try{if(_0x1ee578[_0xe53a1e['id']]){_0xe53a1e['Users']=_[_0xb36a('0x3c')](_0x1ee578[_0xe53a1e['id']],function(_0x996c79){return{'id':_0x996c79['id'],'fullname':_0x996c79['fullname']};});}}catch(_0x311e7c){_0x129014(_0x311e7c);}_0x1ab4b7(_0xe53a1e);});}function getInteractionTags(_0x5c3c88,_0x1da4b4){return new BPromise(function(_0x139b78,_0x27ab85){try{if(_0x5c3c88[_0xb36a('0x3d')]){_0x5c3c88[_0xb36a('0x3e')]=[];_0x5c3c88[_0xb36a('0x3d')][_0xb36a('0x3f')](',')['forEach'](function(_0x194b2e){_0x5c3c88[_0xb36a('0x3e')]['push'](_0x1da4b4[_0x194b2e]);});}delete _0x5c3c88[_0xb36a('0x3d')];}catch(_0x271561){_0x27ab85(_0x271561);}_0x139b78(_0x5c3c88);});}function updateChatInteraction(_0x4ad939,_0x20633d,_0x191077){return new BPromise(function(_0x22ac6a,_0x309ddb){return getInteractionUsers(_0x4ad939,_0x191077)['then'](function(_0x1cac36){return getInteractionTags(_0x1cac36,_0x20633d);})['then'](function(_0x221966){_0x22ac6a(_0x221966);})['catch'](function(_0x9ac291){_0x309ddb(_0x9ac291);});});}exports[_0xb36a('0x40')]=function(_0xaa4b47,_0x1c0df1){var _0x66a0a5={},_0x5886b7={},_0x293848={'count':0x0,'rows':[]};var _0x117a29=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x450444){return{'name':_0x450444[_0xb36a('0x41')],'type':_0x450444[_0xb36a('0x42')][_0xb36a('0x43')]};});_0x5886b7[_0xb36a('0x44')]=_[_0xb36a('0x3c')](_0x117a29,_0xb36a('0x3a'));_0x5886b7['query']=_[_0xb36a('0x45')](_0xaa4b47[_0xb36a('0x46')]);_0x5886b7[_0xb36a('0x47')]=_[_0xb36a('0x48')](_0x5886b7['model'],_0x5886b7[_0xb36a('0x46')]);_0x66a0a5[_0xb36a('0x49')]=_[_0xb36a('0x48')](_0x5886b7[_0xb36a('0x44')],qs[_0xb36a('0x4a')](_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x4a')]));_0x66a0a5['attributes']=_0x66a0a5[_0xb36a('0x49')]['length']?_0x66a0a5[_0xb36a('0x49')]:_0x5886b7[_0xb36a('0x44')];if(!_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x4b')](_0xb36a('0x4c'))){_0x66a0a5['limit']=qs['limit'](_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x4d')]);_0x66a0a5[_0xb36a('0x30')]=qs[_0xb36a('0x30')](_0xaa4b47[_0xb36a('0x46')]['offset']);}_0x66a0a5[_0xb36a('0x4e')]=qs[_0xb36a('0x4f')](_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x4f')]);_0x66a0a5[_0xb36a('0x50')]=qs['filters'](_['pick'](_0xaa4b47['query'],_0x5886b7[_0xb36a('0x47')]),_0x117a29);var _0x1823f6=[];var _0x35305e=squel['select']()['field']('id')[_0xb36a('0x51')](_0xb36a('0x3a'))['field']('color')[_0xb36a('0x52')](_0xb36a('0x53'));var _0x18bf49=squel['select']()[_0xb36a('0x51')](_0xb36a('0x54'))['field'](_0xb36a('0x55'))['field'](_0xb36a('0x56'))[_0xb36a('0x52')](_0xb36a('0x57'),'ui')['left_join'](_0xb36a('0x58'),'u',_0xb36a('0x59'));var _0x285a5a=squel[_0xb36a('0x5a')]()['from']('chat_interactions','i')[_0xb36a('0x5b')](_0xb36a('0x5c'),'c',_0xb36a('0x5d'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0xb36a('0x5b')](_0xb36a('0x5e'),'a',_0xb36a('0x5f'))[_0xb36a('0x5b')]('chat_messages','me',_0xb36a('0x60'))[_0xb36a('0x5b')](_0xb36a('0x61'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xb36a('0x5b')](_0xb36a('0x53'),'t','t.id\x20=\x20it.TagId');var _0x4f98f4=squel[_0xb36a('0x62')]();var _0x449ab7=[];var _0x5b4e37=squel[_0xb36a('0x62')]();var _0x1dd3a9;if(_0xaa4b47['query'][_0xb36a('0x63')]){_0x1dd3a9=as[_0xb36a('0x64')](_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x63')]);var _0xfabe03=_0x1dd3a9[_0xb36a('0x65')];for(var _0x5a8476=0x0;_0x5a8476<_0x1dd3a9[_0xb36a('0x66')][_0xb36a('0x67')];_0x5a8476++){var _0x7319f4=_0x1dd3a9[_0xb36a('0x66')][_0x5a8476];var _0x4653a5='i';var _0x297f36=_[_0xb36a('0x68')](_0x117a29,[_0xb36a('0x3a'),_0x7319f4[_0xb36a('0x51')]]);if(!_0x297f36){switch(_0x7319f4[_0xb36a('0x51')]){case _0xb36a('0x69'):if(_0x7319f4[_0xb36a('0x6a')]==0x1){_0x285a5a[_0xb36a('0x6b')]('`'+_0x7319f4[_0xb36a('0x51')]+'`\x20=\x200');}else{_0x285a5a[_0xb36a('0x6b')]('`'+_0x7319f4[_0xb36a('0x51')]+_0xb36a('0x6c'));}break;case _0xb36a('0x6d'):if(_0x7319f4[_0xb36a('0x6e')]===_0xb36a('0x6f')){if(_0x7319f4[_0xb36a('0x6a')][_0xb36a('0x3f')]('\x20')['length']>0x1){_0x4f98f4[_0xfabe03]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb36a('0x70')](_0x7319f4[_0xb36a('0x6a')]),null);}else{var _0x539927='%'+_0x7319f4[_0xb36a('0x6a')]+'%';_0x4f98f4[_0xfabe03](_0xb36a('0x71'),_0x539927,_0x539927,_0x539927);}}else{_0x297f36=_[_0xb36a('0x68')](_0x117a29,['name',_0xb36a('0x72')]);_0x7319f4[_0xb36a('0x51')]=_0xb36a('0x72');_0x4776f8=as['buildExpression'](_0x4653a5,_0x297f36[_0xb36a('0x42')],_0x7319f4);_0x4f98f4[_0xfabe03](_0x4776f8['text'],_0x4776f8[_0xb36a('0x6a')][_0xb36a('0x73')],_0x4776f8['value'][_0xb36a('0x2d')]);}break;case _0xb36a('0x74'):var _0x2d80f6=_0x7319f4['value'][_0xb36a('0x3f')](',')[_0xb36a('0x3c')](function(_0x1a9235){return Number(_0x1a9235);});_0x2d80f6[_0xb36a('0x75')](function(_0x507359){_0x5b4e37['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x507359+',%');});_0x449ab7=_[_0xb36a('0x76')](_0x449ab7,_0x2d80f6);break;case _0xb36a('0x77'):if(_0x7319f4[_0xb36a('0x6e')]===_0xb36a('0x6f')){_0x4f98f4[_0xfabe03](_0xb36a('0x78'),'%'+_0x7319f4[_0xb36a('0x6a')]+'%',null);}else{_0x297f36=_[_0xb36a('0x68')](_0x117a29,[_0xb36a('0x3a'),_0xb36a('0x79')]);_0x7319f4[_0xb36a('0x51')]=_0xb36a('0x79');_0x4776f8=as[_0xb36a('0x7a')](_0x4653a5,_0x297f36[_0xb36a('0x42')],_0x7319f4);_0x4f98f4[_0xfabe03](_0x4776f8[_0xb36a('0x7b')],_0x4776f8['value'][_0xb36a('0x73')],_0x4776f8[_0xb36a('0x6a')][_0xb36a('0x2d')]);}break;case _0xb36a('0x7c'):_0x4776f8=as[_0xb36a('0x7a')]('me',null,_0x7319f4);_0x4f98f4[_0xfabe03](_0x4776f8['text'],_0x4776f8[_0xb36a('0x6a')][_0xb36a('0x73')],_0x4776f8[_0xb36a('0x6a')]['end']);break;}}else{var _0x4776f8=as[_0xb36a('0x7a')](_0x4653a5,_0x297f36[_0xb36a('0x42')],_0x7319f4);_0x4f98f4[_0xfabe03](_0x4776f8['text'],_0x4776f8[_0xb36a('0x6a')][_0xb36a('0x73')],_0x4776f8[_0xb36a('0x6a')][_0xb36a('0x2d')]);}}}else{var _0x2247dd=_(_0xaa4b47[_0xb36a('0x46')])['keys']()[_0xb36a('0x3c')](function(_0x3a8d77){return _[_0xb36a('0x7d')](_0x117a29,[_0xb36a('0x3a'),_0x3a8d77])?_0x3a8d77:undefined;})[_0xb36a('0x7e')]()[_0xb36a('0x6a')]();if(!_['isEmpty'](_0x2247dd)){_0x2247dd[_0xb36a('0x75')](function(_0x3b8d63){if(_0x3b8d63===_0xb36a('0x7f')){_0x285a5a[_0xb36a('0x50')](_0xb36a('0x80'),[][_0xb36a('0x81')](_0xaa4b47[_0xb36a('0x46')][_0x3b8d63]));}else if(_0x3b8d63===_0xb36a('0x82')){var _0x2da80a=JSON[_0xb36a('0x83')](_0xaa4b47[_0xb36a('0x46')][_0x3b8d63])['$gte'];var _0x46b7b2=JSON['parse'](_0xaa4b47['query'][_0x3b8d63])['$lte'];_0x285a5a['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2da80a,_0x46b7b2);}else{if(_0xaa4b47[_0xb36a('0x46')][_0x3b8d63]===_0xb36a('0x84')){_0x285a5a[_0xb36a('0x50')]('i.'+_0x3b8d63+_0xb36a('0x85'));}else{_0x285a5a[_0xb36a('0x50')]('i.'+_0x3b8d63+_0xb36a('0x86'),_0xaa4b47[_0xb36a('0x46')][_0x3b8d63]);}}});}if(_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x87')]){if(_0xaa4b47['query']['read']==0x1){_0x285a5a['having'](_0xb36a('0x88'));}else{_0x285a5a['having'](_0xb36a('0x89'));}}if(_0xaa4b47[_0xb36a('0x46')]['tag']){_0x449ab7=_[_0xb36a('0x8a')](_0xaa4b47[_0xb36a('0x46')]['tag'])?_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x8b')]:new Array(_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x8b')]);_0x449ab7[_0xb36a('0x75')](function(_0x3f4d13){_0x5b4e37['or'](_0xb36a('0x8c'),'%,'+_0x3f4d13+',%');});}if(_0xaa4b47[_0xb36a('0x46')]['filter']){var _0x29bf0b=_0xaa4b47['query'][_0xb36a('0x8d')][_0xb36a('0x8e')]('\x5c','\x5c\x5c')[_0xb36a('0x8e')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xb36a('0x8f')](_0x29bf0b)){_0x4f98f4['or']('i.id\x20LIKE\x20?',_0x29bf0b+'%');}else{_0x4f98f4['or'](_0xb36a('0x90'),qs[_0xb36a('0x70')](_0x29bf0b))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x29bf0b+'%');}}}_0x285a5a[_0xb36a('0x50')](_0x4f98f4);_0x285a5a[_0xb36a('0x91')](_0xb36a('0x92'));var _0x46de0a={'type':db[_0xb36a('0x93')][_0xb36a('0x94')]['SELECT'],'raw':!![]};var _0x13dead=_0x285a5a[_0xb36a('0x95')]();_0x13dead['field']('i.id');_0x13dead['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb36a('0x69'));if(_0x66a0a5[_0xb36a('0x4e')]){_0x66a0a5[_0xb36a('0x4e')][_0xb36a('0x75')](function(_0x2c7957){_0x285a5a[_0xb36a('0x4e')]('i.'+_0x2c7957[0x0],_0x2c7957[0x1]===_0xb36a('0x96')?![]:!![]);});}if(!_[_0xb36a('0x97')](_0x449ab7)){_0x285a5a['having'](_0x5b4e37);_0x13dead[_0xb36a('0x50')](_0xb36a('0x98'),_0x449ab7);}BPromise[_0xb36a('0x99')]()[_0xb36a('0x38')](function(){if(!_0x1dd3a9){if(_0xaa4b47['query']['ChatWebsiteId']||_0xaa4b47[_0xb36a('0x46')]['journey'])return;_0x13dead[_0xb36a('0x50')](_0xb36a('0x9a'));_0x285a5a['where'](_0xb36a('0x9a'));return;}return _0xaa4b47['user'][_0xb36a('0x9b')]({'attributes':['id'],'raw':!![]})[_0xb36a('0x38')](function(_0x5cf69d){if(_[_0xb36a('0x97')](_0x5cf69d)){_0x13dead['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x285a5a[_0xb36a('0x50')](_0xb36a('0x9c'));}else{_0x13dead[_0xb36a('0x50')](_0xb36a('0x80'),_[_0xb36a('0x3c')](_0x5cf69d,'id'));_0x285a5a[_0xb36a('0x50')](_0xb36a('0x80'),_[_0xb36a('0x3c')](_0x5cf69d,'id'));}});})[_0xb36a('0x38')](function(){db[_0xb36a('0x9d')][_0xb36a('0x46')](_0x13dead[_0xb36a('0x9e')](),_0x46de0a)[_0xb36a('0x38')](function(_0x161ef6){_0x293848[_0xb36a('0x2f')]=_0x161ef6['length'];if(_0x293848['count']===0x0)return[];return db[_0xb36a('0x9d')][_0xb36a('0x46')](_0x35305e[_0xb36a('0x9e')](),_0x46de0a)[_0xb36a('0x38')](function(_0x42334e){_0x1823f6=_[_0xb36a('0x9f')](_0x42334e,'id');_0x46de0a=_['merge'](_0x46de0a,{'model':db[_0xb36a('0xa0')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xaa4b47[_0xb36a('0x46')][_0xb36a('0x4a')]){_0x66a0a5[_0xb36a('0x49')][_0xb36a('0x75')](function(_0x1a7e15){_0x285a5a['field']('i.'+_0x1a7e15);});}else{_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa1'),_0xb36a('0x69'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa2'),_0xb36a('0xa3'));_0x285a5a[_0xb36a('0x51')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa4'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa5'),_0xb36a('0xa6'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa7'),'Contact.lastName');_0x285a5a[_0xb36a('0x51')](_0xb36a('0xa8'),_0xb36a('0xa9'));_0x285a5a[_0xb36a('0x51')]('c.phone',_0xb36a('0xaa'));_0x285a5a['field'](_0xb36a('0xab'),_0xb36a('0xac'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xad'),_0xb36a('0xae'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xaf'),_0xb36a('0xb0'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xb1'),_0xb36a('0xb2'));_0x285a5a[_0xb36a('0x51')](_0xb36a('0xb3'),_0xb36a('0x3d'));}if(_0x66a0a5[_0xb36a('0x4d')])_0x285a5a[_0xb36a('0x4d')](_0x66a0a5['limit']);if(_0x66a0a5[_0xb36a('0x30')])_0x285a5a[_0xb36a('0x30')](_0x66a0a5[_0xb36a('0x30')]);return db[_0xb36a('0x9d')][_0xb36a('0x46')](_0x285a5a[_0xb36a('0x9e')](),_0x46de0a);})[_0xb36a('0x38')](function(_0x23228c){_0x18bf49[_0xb36a('0x50')](_0xb36a('0xb4'),_[_0xb36a('0x3c')](_0x23228c,'id'));return db[_0xb36a('0x9d')][_0xb36a('0x46')](_0x18bf49[_0xb36a('0x9e')](),_0x46de0a)[_0xb36a('0x38')](function(_0x1941b7){var _0x4946a8=_['groupBy'](_0x1941b7,_0xb36a('0xb5'));var _0x2cced4=[];_0x23228c[_0xb36a('0x75')](function(_0x304852){_0x2cced4[_0xb36a('0xb6')](updateChatInteraction(_0x304852,_0x1823f6,_0x4946a8));});return BPromise[_0xb36a('0xb7')](_0x2cced4);});});})['then'](function(_0x101f85){_0x293848[_0xb36a('0xb8')]=_0x101f85;return _0x293848;})[_0xb36a('0x38')](respondWithFilteredResult(_0x1c0df1,_0x66a0a5));})[_0xb36a('0xb9')](handleError(_0x1c0df1,null));};exports['show']=function(_0x59f155,_0x590b83){var _0x6c9832={'raw':![],'where':{'id':_0x59f155[_0xb36a('0xba')]['id']}},_0x446841={};_0x446841[_0xb36a('0x44')]=_[_0xb36a('0x45')](db[_0xb36a('0xa0')][_0xb36a('0xbb')]);_0x446841[_0xb36a('0x46')]=_[_0xb36a('0x45')](_0x59f155[_0xb36a('0x46')]);_0x446841[_0xb36a('0xbc')]=_[_0xb36a('0x48')](_0x446841[_0xb36a('0x44')],_0x446841[_0xb36a('0x46')]);_0x6c9832['attributes']=_[_0xb36a('0x48')](_0x446841[_0xb36a('0x44')],qs[_0xb36a('0x4a')](_0x59f155['query'][_0xb36a('0x4a')]));_0x6c9832[_0xb36a('0x49')]=_0x6c9832[_0xb36a('0x49')]['length']?_0x6c9832[_0xb36a('0x49')]:_0x446841[_0xb36a('0x44')];if(_0x59f155[_0xb36a('0x46')][_0xb36a('0xbd')]){_0x6c9832[_0xb36a('0xbe')]=[{'all':!![]}];}_0x6c9832=_[_0xb36a('0xbf')]({},_0x6c9832,_0x59f155['options']);return db[_0xb36a('0xa0')][_0xb36a('0x68')](_0x6c9832)['then'](handleEntityNotFound(_0x590b83,null))[_0xb36a('0x38')](respondWithResult(_0x590b83,null))['catch'](handleError(_0x590b83,null));};exports[_0xb36a('0xc0')]=function(_0x54a9c3,_0x493f1b){return db[_0xb36a('0xa0')][_0xb36a('0xc0')](_0x54a9c3['body'],{})['then'](respondWithResult(_0x493f1b,0xc9))[_0xb36a('0xb9')](handleError(_0x493f1b,null));};exports[_0xb36a('0x36')]=function(_0x20c7a1,_0x1b69f8){if(_0x20c7a1[_0xb36a('0x7c')]['id']){delete _0x20c7a1['body']['id'];}return db[_0xb36a('0xa0')]['find']({'where':{'id':_0x20c7a1[_0xb36a('0xba')]['id']}})['then'](handleEntityNotFound(_0x1b69f8,null))[_0xb36a('0x38')](saveUpdates(_0x20c7a1[_0xb36a('0x7c')],null))['then'](respondWithResult(_0x1b69f8,null))[_0xb36a('0xb9')](handleError(_0x1b69f8,null));};exports[_0xb36a('0x37')]=function(_0x23d35b,_0x31f37c){return db['ChatInteraction']['find']({'where':{'id':_0x23d35b[_0xb36a('0xba')]['id']}})['then'](handleEntityNotFound(_0x31f37c,null))[_0xb36a('0x38')](removeEntity(_0x31f37c,null))[_0xb36a('0xb9')](handleError(_0x31f37c,null));};exports[_0xb36a('0xc1')]=function(_0x295e69,_0x4d4c43){return db['ChatInteraction'][_0xb36a('0xc1')]()[_0xb36a('0x38')](respondWithResult(_0x4d4c43,null))[_0xb36a('0xb9')](handleError(_0x4d4c43,null));};exports[_0xb36a('0xc2')]=function(_0x2d07f4,_0x78e4d4){var _0x103661=_0x2d07f4[_0xb36a('0xba')]['id'];var _0x3ec6df;var _0x28fd3e;var _0x2abf3e;return db[_0xb36a('0xa0')]['findOne']({'where':{'id':_0x103661}})[_0xb36a('0x38')](function(_0x1e65e6){_0x3ec6df=_0x1e65e6;return db[_0xb36a('0xc3')]['findOne']({'where':{'id':_0x1e65e6['ChatWebsiteId']},'attributes':['id',_0xb36a('0xc4'),_0xb36a('0xc5')],'raw':!![]});})['then'](function(_0x1fb879){if(_0x1fb879&&_0x1fb879[_0xb36a('0xc4')]&&_0x1fb879[_0xb36a('0xc5')]){_0x28fd3e=_0x1fb879;var _0x639f66={'rejectUnauthorized':![],'method':_0xb36a('0xc6'),'uri':_0xb36a('0xc7'),'headers':{'X-APIKEY':_0x1fb879['vidaooApiKey']},'body':{'name':_0xb36a('0xc8')+_0x103661},'redirect':'follow','json':!![]};return rp(_0x639f66);}else{throw new db[(_0xb36a('0x93'))]['ValidationError'](_0xb36a('0xc9'));}})['then'](function(_0x23a1dd){_0x2abf3e=_0x23a1dd;if(_0x2abf3e['id']){var _0x387e42={'body':_0x2abf3e[_0xb36a('0xca')],'ChatWebsiteId':_0x28fd3e['id'],'ChatInteractionId':_0x3ec6df['id'],'direction':_0xb36a('0xcb'),'UserId':_0x2d07f4['user']['id']};return db[_0xb36a('0xcc')][_0xb36a('0xc0')](_0x387e42,{});}else{throw new db[(_0xb36a('0x93'))][(_0xb36a('0xcd'))](_0xb36a('0xce'));}})[_0xb36a('0x38')](function(){return _0x3ec6df[_0xb36a('0xcf')]({'vidaooSessionId':_0x2abf3e['id']});})['then'](respondWithResult(_0x78e4d4,null))[_0xb36a('0xb9')](handleError(_0x78e4d4,null));};exports['customUpdate']=function(_0x3ace09,_0x3b8c9e){if(_0x3ace09[_0xb36a('0x7c')]['id']){delete _0x3ace09['body']['id'];}return db[_0xb36a('0xa0')][_0xb36a('0x68')]({'where':{'id':_0x3ace09['params']['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x3b8c9e,null))[_0xb36a('0x38')](saveUpdates(_0x3ace09[_0xb36a('0x7c')],null))[_0xb36a('0x38')](respondWithResult(_0x3b8c9e,null))[_0xb36a('0xb9')](handleError(_0x3b8c9e,null));};exports[_0xb36a('0xd0')]=function(_0x2d40c7,_0x3d6c35,_0x3a976d){if(_0x2d40c7[_0xb36a('0x7c')]['id']){delete _0x2d40c7[_0xb36a('0x7c')]['id'];}return db[_0xb36a('0xa0')]['find']({'where':{'id':_0x2d40c7[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](function(_0x1a02d2){if(!_0x1a02d2){logger[_0xb36a('0x27')](_0xb36a('0xd1'),'abandon',0x194,_0xb36a('0xd2'));_0x3d6c35['sendStatus'](0x194);}else{if(_0x1a02d2[_0xb36a('0x79')]){throw new db[(_0xb36a('0x93'))][(_0xb36a('0xcd'))]('Interaction\x20already\x20assigned');}}return _0x1a02d2;})[_0xb36a('0x38')](function(_0x1ad787){if(_0x1ad787){return _0x1ad787[_0xb36a('0x36')]({'closed':_0x2d40c7[_0xb36a('0x7c')]['closed'],'disposition':_0x2d40c7[_0xb36a('0x7c')]['disposition']})[_0xb36a('0x38')](function(_0x59d704){return _0x59d704;});}})[_0xb36a('0x38')](function(_0x51633b){return respondWithRpcPromise('AbandonInteraction',_0xb36a('0xd0'),_0x2d40c7['body'],client9004);})[_0xb36a('0x38')](respondWithResult(_0x3d6c35,null))[_0xb36a('0xb9')](handleError(_0x3d6c35,null));};exports[_0xb36a('0xd3')]=function(_0x92af25,_0x469906,_0x221140){_0x92af25[_0xb36a('0x7c')][_0xb36a('0x3a')]=_0x92af25[_0xb36a('0xd4')][_0xb36a('0xd5')];_0x92af25[_0xb36a('0x7c')][_0xb36a('0xd6')]=_0x92af25[_0xb36a('0xd4')][_0xb36a('0xd7')];_0x92af25[_0xb36a('0x7c')][_0xb36a('0x42')]=_0x92af25[_0xb36a('0xd4')]['mimetype'];return db['Attachment']['create'](_0x92af25[_0xb36a('0x7c')])[_0xb36a('0x38')](respondWithResult(_0x469906,0xc9))[_0xb36a('0xb9')](handleError(_0x469906,null));};exports['attachmentDownload']=function(_0x52a619,_0x19a31a,_0x40eec8){return db[_0xb36a('0xa0')]['findOne']({'where':{'id':_0x52a619[_0xb36a('0xba')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x19a31a,null))[_0xb36a('0x38')](function(_0x363cfc){if(_0x363cfc){if(_0x363cfc['closed']){return _0x19a31a['status'](0x193)[_0xb36a('0x2e')]({'status':0x193,'message':_0xb36a('0xd8')});}return db[_0xb36a('0xd9')]['findOne']({'where':{'id':_0x52a619[_0xb36a('0x46')]['attachId']},'raw':!![]})[_0xb36a('0x38')](handleEntityNotFound(_0x19a31a,null));}})[_0xb36a('0x38')](function(_0x508690){if(_0x508690){return _0x19a31a[_0xb36a('0xda')](path[_0xb36a('0xdb')](config[_0xb36a('0xdc')],_0xb36a('0xdd'),_0x508690[_0xb36a('0xd6')]));}})['catch'](handleError(_0x19a31a,null));};exports['close']=function(_0x4df9ab,_0x290ec5){var _0x3edd10=null;var _0x10c5a=null;var _0x3e0242=null;var _0x16ddd6=null;if(_0x4df9ab[_0xb36a('0x7c')]['id']){delete _0x4df9ab[_0xb36a('0x7c')]['id'];}if(_0x4df9ab[_0xb36a('0x7c')][_0xb36a('0xde')]){_0x16ddd6=path['join'](config[_0xb36a('0xdc')],'server/files/chat/upload/',util[_0xb36a('0xdf')](_0xb36a('0xe0'),Date['now']()));_0x4df9ab[_0xb36a('0x7c')][_0xb36a('0xe1')]=_0x16ddd6;}return db['ChatInteraction'][_0xb36a('0x68')]({'where':{'id':_0x4df9ab[_0xb36a('0xba')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0xb36a('0x77')}]}]})[_0xb36a('0x38')](handleEntityNotFound(_0x290ec5,null))[_0xb36a('0x38')](saveUpdates(_0x4df9ab[_0xb36a('0x7c')],null))[_0xb36a('0x38')](function(_0x49d5a0){if(_0x49d5a0){_0x3edd10=_0x49d5a0;return db[_0xb36a('0xc3')][_0xb36a('0x68')]({'where':{'id':_0x3edd10[_0xb36a('0x7f')]}});}})[_0xb36a('0x38')](function(_0x1c6e06){if(_0x1c6e06){_0x3e0242=_0x1c6e06;return db[_0xb36a('0xe2')][_0xb36a('0x68')]({'where':{'id':_0x3edd10[_0xb36a('0x72')]}});}})[_0xb36a('0x38')](function(_0x2a28ed){if(_0x2a28ed){_0x10c5a=_0x2a28ed;if(_0x16ddd6){var _0x3e5b26=null;for(var _0x82495d=0x1;_0x82495d<_0x3edd10[_0xb36a('0xe3')]['length'];++_0x82495d){_0x3e5b26=_0x3edd10[_0xb36a('0xe3')][_0x82495d];var _0x28932b=_0x3e5b26[_0xb36a('0x79')]?util[_0xb36a('0xdf')]('%s%d',_0x3e0242['agentAlias'],_0x3e5b26[_0xb36a('0x79')]):'System';var _0x652294=_0x4df9ab['body'][_0xb36a('0xe4')]||util['format'](_0xb36a('0xe5'),_0xb36a('0xe6'),_0x3e5b26[_0xb36a('0x72')]);switch(_0x3e0242[_0xb36a('0xe7')]){case _0xb36a('0xe8'):_0x28932b=_0x3e5b26[_0xb36a('0x79')]?util[_0xb36a('0xdf')](_0xb36a('0xe5'),_0x3e0242[_0xb36a('0xe9')],_0x3e5b26['UserId']):_0xb36a('0xea');break;case _0xb36a('0xeb'):_0x28932b=_0x3e5b26[_0xb36a('0x79')]?_0x3e5b26[_0xb36a('0x77')][_0xb36a('0xec')]||_0x3e5b26[_0xb36a('0x77')]['fullname']:_0xb36a('0xea');break;case _0xb36a('0xed'):_0x28932b=_0x3e5b26[_0xb36a('0x79')]?_0x3e5b26[_0xb36a('0x77')][_0xb36a('0xee')]:_0xb36a('0xea');break;default:_0x28932b=_0x3e5b26['UserId']?util[_0xb36a('0xdf')]('%s%d',_0x3e0242[_0xb36a('0xe9')],_0x3e5b26[_0xb36a('0x79')]):_0xb36a('0xea');}var _0x449d21=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x3e5b26[_0xb36a('0x82')])[_0xb36a('0xdf')](_0xb36a('0xef')),_0x3e5b26[_0xb36a('0xf0')]==='in'?_0x652294:_0x28932b,_0x3e5b26[_0xb36a('0x7c')]);if(!_0x3e5b26[_0xb36a('0xf1')]){fs[_0xb36a('0xf2')](_0x16ddd6,_0x449d21);}}return db[_0xb36a('0xf3')][_0xb36a('0xf4')]({'where':{'service':!![]},'include':[{'model':db[_0xb36a('0xf5')],'as':_0xb36a('0xf6'),'raw':!![]}]});}}})[_0xb36a('0x38')](function(_0x5be870){if(_0x5be870&&_0x5be870[_0xb36a('0xf6')]&&_0x4df9ab[_0xb36a('0x7c')]){var _0x56f61a={'tls':{'rejectUnauthorized':![]}};if(_0x5be870[_0xb36a('0xf6')][_0xb36a('0xf7')]){_0x56f61a[_0xb36a('0xf7')]=_0x5be870[_0xb36a('0xf6')][_0xb36a('0xf7')];}else{_0x56f61a[_0xb36a('0xf8')]=_0x5be870[_0xb36a('0xf6')][_0xb36a('0xf8')];_0x56f61a[_0xb36a('0xf9')]=_0x5be870[_0xb36a('0xf6')][_0xb36a('0xf9')];_0x56f61a[_0xb36a('0xfa')]=_0x5be870[_0xb36a('0xf6')][_0xb36a('0xfa')];}if(_0x5be870[_0xb36a('0xf6')]['authentication']){_0x56f61a[_0xb36a('0xfb')]={'user':_0x5be870[_0xb36a('0xf6')][_0xb36a('0xfc')],'pass':_0x5be870['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xb36a('0xfd'),{'account':_0x56f61a,'message':{'from':util[_0xb36a('0xdf')](_0xb36a('0xfe'),_0x5be870[_0xb36a('0x3a')],_0x5be870[_0xb36a('0xff')]||_0x5be870[_0xb36a('0xf6')][_0xb36a('0xfc')]),'to':_0x4df9ab[_0xb36a('0x7c')][_0xb36a('0xde')],'subject':_0xb36a('0x100'),'text':util[_0xb36a('0xdf')](_0xb36a('0x101'),_0x4df9ab['body'][_0xb36a('0xde')]),'attachments':[{'path':_0x16ddd6}]}})[_0xb36a('0x38')](function(){return _0x3edd10;})[_0xb36a('0xb9')](function(_0x3a1204){console[_0xb36a('0x27')](_0x3a1204);});}else{return _0x3edd10;}})['then'](respondWithStatusCode(_0x290ec5,0xc8))[_0xb36a('0xb9')](handleError(_0x290ec5,null));};exports['addMessage']=function(_0x167875,_0x2e91dd,_0x143e30){return db[_0xb36a('0xcc')][_0xb36a('0x68')]({'where':{'id':_0x167875[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x2e91dd,null))['then'](function(_0x10a183){if(_0x10a183){return _0x10a183[_0xb36a('0x102')](_0x167875[_0xb36a('0x7c')][_0xb36a('0x103')],_[_0xb36a('0x104')](_0x167875[_0xb36a('0x7c')],[_0xb36a('0x103'),'id'])||{});}})[_0xb36a('0x38')](respondWithResult(_0x2e91dd,null))[_0xb36a('0xb9')](handleError(_0x2e91dd,null));};exports['getMessages']=function(_0x4f02b4,_0x4e5889,_0x2b308f){var _0x4ee016={'raw':![],'where':{}};var _0x2a5e25={};var _0x34f2e6={'count':0x0,'rows':[]};return db[_0xb36a('0xa0')][_0xb36a('0xf4')]({'where':{'id':_0x4f02b4[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x4e5889,null))['then'](function(_0x3d8f91){if(_0x3d8f91){_0x2a5e25[_0xb36a('0x44')]=_[_0xb36a('0x45')](db[_0xb36a('0xcc')]['rawAttributes']);_0x2a5e25[_0xb36a('0x46')]=_['keys'](_0x4f02b4[_0xb36a('0x46')]);_0x2a5e25['filters']=_[_0xb36a('0x48')](_0x2a5e25[_0xb36a('0x44')],_0x2a5e25[_0xb36a('0x46')]);_0x4ee016[_0xb36a('0x49')]=_[_0xb36a('0x48')](_0x2a5e25[_0xb36a('0x44')],qs[_0xb36a('0x4a')](_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x4a')]));_0x4ee016[_0xb36a('0x49')]=_0x4ee016[_0xb36a('0x49')][_0xb36a('0x67')]?_0x4ee016[_0xb36a('0x49')]:_0x2a5e25['model'];if(!_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x4b')]('nolimit')){_0x4ee016[_0xb36a('0x4d')]=qs['limit'](_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x4d')]);_0x4ee016['offset']=qs['offset'](_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x30')]);}_0x4ee016[_0xb36a('0x4e')]=qs['sort'](_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x4f')]);_0x4ee016[_0xb36a('0x50')]=qs[_0xb36a('0x47')](_[_0xb36a('0x105')](_0x4f02b4[_0xb36a('0x46')],_0x2a5e25[_0xb36a('0x47')]));_0x4ee016['where']['ChatInteractionId']=_0x3d8f91['id'];if(_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x8d')]){_0x4ee016[_0xb36a('0x50')]=_[_0xb36a('0xbf')](_0x4ee016[_0xb36a('0x50')],{'$or':_[_0xb36a('0x3c')](_0x4ee016[_0xb36a('0x49')],function(_0x327732){var _0x5a7ca2={};_0x5a7ca2[_0x327732]={'$like':'%'+_0x4f02b4[_0xb36a('0x46')][_0xb36a('0x8d')]+'%'};return _0x5a7ca2;})});}if(_0x4f02b4[_0xb36a('0x46')]['$gte']){var _0x2a3f63=_0x4f02b4[_0xb36a('0x46')]['$gte'][_0xb36a('0x3f')](',');var _0x46b643={};_0x46b643[_0x2a3f63[0x0]]={'$gte':moment(_0x2a3f63[0x1])[_0xb36a('0xdf')](_0xb36a('0x106'))};_0x4ee016[_0xb36a('0x50')]=_[_0xb36a('0xbf')](_0x4ee016[_0xb36a('0x50')],_0x46b643);}_0x4ee016=_['merge']({},_0x4ee016,_0x4f02b4['options']);return db['ChatMessage'][_0xb36a('0x2f')]({'where':_0x4ee016['where']})[_0xb36a('0x38')](function(_0x2bdeaf){_0x34f2e6[_0xb36a('0x2f')]=_0x2bdeaf;if(_0x4f02b4[_0xb36a('0x46')][_0xb36a('0xbd')]){_0x4ee016[_0xb36a('0xbe')]=[{'all':!![]}];}return db[_0xb36a('0xcc')][_0xb36a('0x107')](_0x4ee016);})['then'](function(_0x3dcdca){_0x34f2e6['rows']=_0x3dcdca;return _0x34f2e6;});}})['then'](respondWithFilteredResult(_0x4e5889,_0x4ee016))[_0xb36a('0xb9')](handleError(_0x4e5889,null));};exports[_0xb36a('0x108')]=function(_0x35bd10,_0x1aa657,_0x21a5bd){var _0x2433a7={'where':{}},_0x2405e8={},_0x4cc5b3={'count':0x0,'rows':[]};return db[_0xb36a('0xa0')][_0xb36a('0xf4')]({'where':{'id':_0x35bd10[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x1aa657,null))[_0xb36a('0x38')](function(_0x24337c){if(_0x24337c){_0x2405e8[_0xb36a('0x44')]=_[_0xb36a('0x45')](db[_0xb36a('0xcc')][_0xb36a('0xbb')]);_0x2405e8[_0xb36a('0x46')]=_[_0xb36a('0x45')](_0x35bd10[_0xb36a('0x46')]);_0x2405e8[_0xb36a('0x47')]=_[_0xb36a('0x48')](_0x2405e8['model'],_0x2405e8['query']);_0x2433a7[_0xb36a('0x49')]=_[_0xb36a('0x48')](_0x2405e8[_0xb36a('0x44')],qs[_0xb36a('0x4a')](_0x35bd10['query'][_0xb36a('0x4a')]));_0x2433a7['attributes']=_0x2433a7[_0xb36a('0x49')]['length']?_0x2433a7[_0xb36a('0x49')]:_0x2405e8['model'];if(!_0x35bd10['query']['hasOwnProperty'](_0xb36a('0x4c'))){_0x2433a7[_0xb36a('0x4d')]=qs[_0xb36a('0x4d')](_0x35bd10[_0xb36a('0x46')][_0xb36a('0x4d')]);_0x2433a7[_0xb36a('0x30')]=qs[_0xb36a('0x30')](_0x35bd10[_0xb36a('0x46')][_0xb36a('0x30')]);}_0x2433a7[_0xb36a('0x4e')]=qs[_0xb36a('0x4f')](_0x35bd10[_0xb36a('0x46')]['sort']);_0x2433a7[_0xb36a('0x50')]=qs[_0xb36a('0x47')](_[_0xb36a('0x105')](_0x35bd10['query'],_0x2405e8['filters']));_0x2433a7[_0xb36a('0x50')][_0xb36a('0xb5')]=_0x24337c['id'];if(_0x35bd10[_0xb36a('0x46')][_0xb36a('0x8d')]){_0x2433a7['where']=_[_0xb36a('0xbf')](_0x2433a7[_0xb36a('0x50')],{'$or':_[_0xb36a('0x3c')](_0x2433a7[_0xb36a('0x49')],function(_0x25a7ef){var _0x4f7c1f={};_0x4f7c1f[_0x25a7ef]={'$like':'%'+_0x35bd10[_0xb36a('0x46')]['filter']+'%'};return _0x4f7c1f;})});}_0x2433a7[_0xb36a('0x50')][_0xb36a('0xf1')]=![];if(_0x35bd10[_0xb36a('0x46')]['id']){_0x2433a7[_0xb36a('0x50')]['id']={'$gt':_0x35bd10['query']['id']};}_0x2433a7=_[_0xb36a('0xbf')]({},_0x2433a7,_0x35bd10[_0xb36a('0x109')]);return db['ChatMessage'][_0xb36a('0x2f')]({'where':_0x2433a7[_0xb36a('0x50')]})[_0xb36a('0x38')](function(_0x1ff8e1){_0x4cc5b3[_0xb36a('0x2f')]=_0x1ff8e1;_0x2433a7['include']=[];if(_0x35bd10[_0xb36a('0x46')][_0xb36a('0x10a')]){_0x2433a7['include']['push']({'model':db[_0xb36a('0x77')],'as':_0xb36a('0x77'),'attributes':['id',_0xb36a('0xee'),_0xb36a('0xec')]});}if(_0x35bd10['query'][_0xb36a('0xbd')]){_0x2433a7['include']=[{'all':!![]}];}return db[_0xb36a('0xcc')]['findAll'](_0x2433a7);})[_0xb36a('0x38')](function(_0x2d4949){_0x4cc5b3[_0xb36a('0xb8')]=_0x2d4949;return _0x4cc5b3;});}})[_0xb36a('0x38')](respondWithFilteredResult(_0x1aa657,_0x2433a7))[_0xb36a('0xb9')](handleError(_0x1aa657,null));};exports[_0xb36a('0x10b')]=function(_0x3e0098,_0x3a93b3,_0x2c7813){return db[_0xb36a('0xa0')][_0xb36a('0x68')]({'where':{'id':_0x3e0098[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x3a93b3,null))[_0xb36a('0x38')](function(_0x3b09c8){if(_0x3b09c8){return _0x3b09c8[_0xb36a('0x10c')](_0x3e0098[_0xb36a('0x7c')][_0xb36a('0x103')],_[_0xb36a('0x104')](_0x3e0098[_0xb36a('0x7c')],['ids','id'])||{})[_0xb36a('0x10d')](function(){return db[_0xb36a('0x74')][_0xb36a('0x107')]({'attributes':['id',_0xb36a('0x3a'),_0xb36a('0x10e')],'where':{'id':_0x3e0098[_0xb36a('0x7c')][_0xb36a('0x103')]}});})['then'](function(_0x1e4ec7){socket['emit'](_0xb36a('0x10f'),{'id':Number(_0x3e0098['params']['id']),'tags':_0x1e4ec7||[]});return{'id':Number(_0x3e0098[_0xb36a('0xba')]['id']),'tags':_0x1e4ec7||[]};});}})[_0xb36a('0x38')](respondWithResult(_0x3a93b3,null))[_0xb36a('0xb9')](handleError(_0x3a93b3,null));};exports[_0xb36a('0x110')]=function(_0x49e628,_0x41b2a9,_0x905a77){return db[_0xb36a('0xa0')][_0xb36a('0x68')]({'where':{'id':_0x49e628[_0xb36a('0xba')]['id']}})[_0xb36a('0x38')](handleEntityNotFound(_0x41b2a9,null))[_0xb36a('0x38')](function(_0x117991){if(_0x117991){return _0x117991[_0xb36a('0x110')](_0x49e628[_0xb36a('0x46')]['ids']);}})[_0xb36a('0x38')](respondWithStatusCode(_0x41b2a9,null))[_0xb36a('0xb9')](handleError(_0x41b2a9,null));};exports['download']=function(_0x50d67f,_0x330f9c){var _0x3b797d=moment()['unix']()[_0xb36a('0x9e')]();var _0x4cca15=path[_0xb36a('0xdb')](config['root'],'server',_0xb36a('0x111'),_0xb36a('0x112'));var _0x347398=path[_0xb36a('0xdb')](config[_0xb36a('0xdc')],_0xb36a('0x113'),'files',_0xb36a('0x114'));var _0x1598d3=path[_0xb36a('0xdb')](_0x4cca15,_0x3b797d);var _0x88d968=util[_0xb36a('0xdf')]('transcript-%d-%s.zip',_0x50d67f[_0xb36a('0xba')]['id'],_0x3b797d);var _0x316c93=path[_0xb36a('0xdb')](_0x4cca15,_0x88d968);var _0x4c84aa=[];_0x4c84aa[_0xb36a('0xb6')]({'model':db[_0xb36a('0x77')],'as':'User','attributes':['id',_0xb36a('0xee')],'raw':!![]});_0x4c84aa[_0xb36a('0xb6')]({'model':db[_0xb36a('0xe2')],'as':_0xb36a('0x6d'),'attributes':['id',_0xb36a('0x115'),_0xb36a('0x116')],'raw':!![]});if(_0x50d67f[_0xb36a('0x46')][_0xb36a('0x114')]){_0x4c84aa[_0xb36a('0xb6')]({'model':db['Attachment'],'as':_0xb36a('0xd9'),'raw':!![]});}var _0x558db8=[{'model':db['ChatMessage'],'as':_0xb36a('0xe3'),'attributes':['id',_0xb36a('0x7c'),_0xb36a('0x82'),'direction',_0xb36a('0xf1'),_0xb36a('0x87')],'include':_0x4c84aa}];_0x558db8[_0xb36a('0xb6')]({'model':db[_0xb36a('0xc3')],'as':_0xb36a('0x117'),'attributes':['id',_0xb36a('0x3a')]});_0x558db8[_0xb36a('0xb6')]({'model':db['User'],'as':_0xb36a('0x118'),'attributes':['id',_0xb36a('0xee')]});return db['ChatInteraction'][_0xb36a('0x68')]({'where':{'id':_0x50d67f[_0xb36a('0xba')]['id']},'include':_0x558db8})[_0xb36a('0x38')](handleEntityNotFound(_0x330f9c,null))['then'](function(_0x459abd){if(_0x459abd){var _0x5e5b5a=_0x459abd[_0xb36a('0x119')]({'plain':!![]});fs[_0xb36a('0x11a')](_0x1598d3);var _0x2ff48f={'format':'A4','border':_0xb36a('0x11b'),'header':{'height':_0xb36a('0x11c'),'contents':{'first':_0xb36a('0x11d')}},'footer':{'height':'30px','contents':{'default':util['format'](_0xb36a('0x11e'),util[_0xb36a('0xdf')]('%s\x20#%d',_0xb36a('0x11f'),_0x5e5b5a['id']),moment()[_0xb36a('0xdf')](_0xb36a('0x120'))[_0xb36a('0x9e')]())}}};var _0xffe3ff={'channel':_0xb36a('0x11f'),'account':_0x5e5b5a[_0xb36a('0x117')][_0xb36a('0x3a')],'agent':_0x5e5b5a[_0xb36a('0x118')]?_0x5e5b5a[_0xb36a('0x118')][_0xb36a('0xee')]:_0xb36a('0x121'),'createdAt':moment(_0x5e5b5a[_0xb36a('0x82')])[_0xb36a('0xdf')](_0xb36a('0x106'))[_0xb36a('0x9e')](),'closedAt':_0x5e5b5a[_0xb36a('0x122')]?moment(_0x5e5b5a[_0xb36a('0x123')])[_0xb36a('0xdf')](_0xb36a('0x106'))['toString']():'','disposition':_0x5e5b5a[_0xb36a('0x124')],'chatInfo':{'browser':_0x5e5b5a[_0xb36a('0x125')],'os':_0x5e5b5a['osName'],'referer':_0x5e5b5a[_0xb36a('0x126')],'customerIp':_0x5e5b5a[_0xb36a('0x127')],'customerPort':_0x5e5b5a['customerPort']?_0x5e5b5a[_0xb36a('0x128')]:_0xb36a('0x121')},'messages':_(_0x5e5b5a[_0xb36a('0xe3')])[_0xb36a('0x129')]()['filter']({'secret':![]})[_0xb36a('0x3c')](function(_0x4631ec){if(_0x4631ec[_0xb36a('0xd9')]){var _0x4d30fc=path[_0xb36a('0xdb')](_0x347398,_0x4631ec[_0xb36a('0xd9')][_0xb36a('0xd6')]);if(fs[_0xb36a('0x12a')](_0x4d30fc)){fs[_0xb36a('0x12b')](_0x4d30fc)[_0xb36a('0x12c')](fs['createWriteStream'](path[_0xb36a('0xdb')](_0x1598d3,_0x4631ec[_0xb36a('0xd9')][_0xb36a('0xd6')])));}}return{'date':moment(_0x4631ec[_0xb36a('0x82')])[_0xb36a('0xdf')](_0xb36a('0x106'))[_0xb36a('0x9e')](),'sender':_0x4631ec[_0xb36a('0xf0')]===_0xb36a('0xcb')?_0x4631ec[_0xb36a('0x77')]?_0x4631ec[_0xb36a('0x77')][_0xb36a('0xee')]:_0xb36a('0xea'):_0x4631ec[_0xb36a('0x6d')][_0xb36a('0x115')]+(_0x4631ec['Contact'][_0xb36a('0x116')]?'\x20'+_0x4631ec['Contact'][_0xb36a('0x116')]:''),'body':_0x4631ec['Attachment']?_0x4631ec[_0xb36a('0xd9')]['basename']:_0x4631ec['body'],'direction':_0x4631ec[_0xb36a('0xf0')]===_0xb36a('0xcb')?'A':'C','secret':_0x4631ec[_0xb36a('0xf1')],'read':_0x4631ec[_0xb36a('0x87')],'attachment':_0x4631ec[_0xb36a('0xd9')]};})['value']()};return ejs[_0xb36a('0x12d')](path['join'](config[_0xb36a('0xdc')],_0xb36a('0x113'),_0xb36a('0x12e'),_0xb36a('0x12f')),{'interaction':_0xffe3ff})[_0xb36a('0x38')](function(_0x18af0f){return new BPromise(function(_0x251592,_0x51d87a){pdf[_0xb36a('0xc0')](_0x18af0f,_0x2ff48f)[_0xb36a('0x130')](path[_0xb36a('0xdb')](_0x1598d3,_0xb36a('0x131')+_0x5e5b5a['id']+'-'+_0x3b797d+_0xb36a('0x132')),function(_0x203436,_0x34c089){if(_0x203436)return _0x51d87a(_0x203436);_0x251592(_0x34c089);});});})[_0xb36a('0x38')](function(){return new BPromise(function(_0x1ed114,_0x43a972){zipdir(_0x1598d3,{'saveTo':_0x316c93},function(_0x1df8ab,_0x4f6823){if(_0x1df8ab)return _0x43a972(_0x1df8ab);return _0x1ed114(_0x4f6823);});})[_0xb36a('0x38')](function(){return new BPromise(function(_0x4e7368,_0x29a1ef){rimraf(_0x1598d3,function(_0x210e16){if(_0x210e16)_0x29a1ef(_0x210e16);return _0x4e7368();});});})['then'](function(){return _0x330f9c['download'](_0x316c93,_0x88d968,function(_0x247d88){if(_0x247d88){console[_0xb36a('0x133')](_0xb36a('0x134'),_0x247d88);}else{fs[_0xb36a('0x135')](_0x316c93);}});});});}else{return _0x330f9c[_0xb36a('0x2b')](0xc8);}})[_0xb36a('0xb9')](handleError(_0x330f9c,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 02081f5..ca64495 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 _0x9025=['emit','catch','hasOwnProperty','../../mysqldb','ChatMessage','setMaxListeners','update','remove','setDataValue','Users','findAll','then','length'];(function(_0x29d217,_0x4764d7){var _0x404987=function(_0x3e8f5f){while(--_0x3e8f5f){_0x29d217['push'](_0x29d217['shift']());}};_0x404987(++_0x4764d7);}(_0x9025,0x17c));var _0x5902=function(_0x248958,_0x3a5144){_0x248958=_0x248958-0x0;var _0x41b651=_0x9025[_0x248958];return _0x41b651;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x5902('0x0'))['db'][_0x5902('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5902('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5902('0x3'),'afterDestroy':_0x5902('0x4')};function emitEvent(_0x25abe0){return function(_0x2477b5,_0x242b6d,_0x4f157a){_0x2477b5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5ef34d){_0x2477b5[_0x5902('0x5')](_0x5902('0x6'),_0x5ef34d['map'](function(_0x41ab13){return{'id':_0x41ab13['id']};}));return ChatMessage[_0x5902('0x7')]({'where':{'ChatInteractionId':_0x2477b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5902('0x8')](function(_0x17e327){_0x2477b5[_0x5902('0x5')]('unreadMessages',_0x17e327[_0x5902('0x9')]);ChatInteractionEvents[_0x5902('0xa')](_0x25abe0+':'+_0x2477b5['id'],_0x2477b5);ChatInteractionEvents[_0x5902('0xa')](_0x25abe0,_0x2477b5);_0x4f157a(null);})[_0x5902('0xb')](_0x4f157a(null));};}for(var e in events){if(events[_0x5902('0xc')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x0095=['findAll','emit','catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0095,0xaa));var _0x5009=function(_0x56ee93,_0x2450c5){_0x56ee93=_0x56ee93-0x0;var _0x38f3d0=_0x0095[_0x56ee93];return _0x38f3d0;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x5009('0x0'))['db'][_0x5009('0x1')];var ChatMessage=require(_0x5009('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5009('0x2')](0x0);var events={'afterCreate':_0x5009('0x3'),'afterUpdate':'update','afterDestroy':_0x5009('0x4')};function emitEvent(_0x47bd48){return function(_0x227b72,_0x1b71dd,_0x390459){_0x227b72[_0x5009('0x5')]({'attributes':['id'],'raw':!![]})[_0x5009('0x6')](function(_0x2bc1bf){_0x227b72[_0x5009('0x7')](_0x5009('0x8'),_0x2bc1bf[_0x5009('0x9')](function(_0x47c4bb){return{'id':_0x47c4bb['id']};}));return ChatMessage[_0x5009('0xa')]({'where':{'ChatInteractionId':_0x227b72['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5009('0x6')](function(_0x3bc0f4){_0x227b72[_0x5009('0x7')]('unreadMessages',_0x3bc0f4['length']);ChatInteractionEvents[_0x5009('0xb')](_0x47bd48+':'+_0x227b72['id'],_0x227b72);ChatInteractionEvents[_0x5009('0xb')](_0x47bd48,_0x227b72);_0x390459(null);})[_0x5009('0xc')](_0x390459(null));};}for(var e in events){if(events[_0x5009('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x5009('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 6a4568d..a55c0e2 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 _0xbb65=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','closed'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb65,0x1f3));var _0x5bb6=function(_0x5afd93,_0x5b9f43){_0x5afd93=_0x5afd93-0x0;var _0x4048ee=_0xbb65[_0x5afd93];return _0x4048ee;};'use strict';var _=require('lodash');var util=require(_0x5bb6('0x0'));var logger=require(_0x5bb6('0x1'))(_0x5bb6('0x2'));var moment=require('moment');var BPromise=require(_0x5bb6('0x3'));var rp=require(_0x5bb6('0x4'));var fs=require('fs');var path=require(_0x5bb6('0x5'));var rimraf=require('rimraf');var config=require(_0x5bb6('0x6'));var attributes=require(_0x5bb6('0x7'));module[_0x5bb6('0x8')]=function(_0x5ba672,_0x3b5ee0){return _0x5ba672['define']('ChatInteraction',attributes,{'tableName':_0x5bb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x344a40,_0x25ba42,_0x322fa2){if(_0x344a40['changed'](_0x5bb6('0xa'))){_0x344a40[_0x5bb6('0xb')]=moment()[_0x5bb6('0xc')](_0x5bb6('0xd'));}_0x322fa2(null,_0x344a40);}},'charset':_0x5bb6('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd43d=['moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd43d,0x1df));var _0xdd43=function(_0x5eba73,_0x3b0acc){_0x5eba73=_0x5eba73-0x0;var _0x4a3cc4=_0xd43d[_0x5eba73];return _0x4a3cc4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdd43('0x0'))('api');var moment=require(_0xdd43('0x1'));var BPromise=require(_0xdd43('0x2'));var rp=require(_0xdd43('0x3'));var fs=require('fs');var path=require(_0xdd43('0x4'));var rimraf=require('rimraf');var config=require(_0xdd43('0x5'));var attributes=require(_0xdd43('0x6'));module[_0xdd43('0x7')]=function(_0x1a0eb5,_0x2e5029){return _0x1a0eb5[_0xdd43('0x8')](_0xdd43('0x9'),attributes,{'tableName':_0xdd43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d3ed9,_0x5526ef,_0x42fd9f){if(_0x4d3ed9[_0xdd43('0xb')]('closed')){_0x4d3ed9[_0xdd43('0xc')]=moment()[_0xdd43('0xd')](_0xdd43('0xe'));}_0x42fd9f(null,_0x4d3ed9);}},'charset':_0xdd43('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index a978aeb..0004298 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 _0x8cbd=['../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','find','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x346253,_0x3a801d){var _0x50b5aa=function(_0x20213e){while(--_0x20213e){_0x346253['push'](_0x346253['shift']());}};_0x50b5aa(++_0x3a801d);}(_0x8cbd,0x95));var _0xd8cb=function(_0x5bcd23,_0x1242f1){_0x5bcd23=_0x5bcd23-0x0;var _0x17ec3c=_0x8cbd[_0x5bcd23];return _0x17ec3c;};'use strict';var _=require(_0xd8cb('0x0'));var util=require(_0xd8cb('0x1'));var moment=require(_0xd8cb('0x2'));var BPromise=require(_0xd8cb('0x3'));var rs=require(_0xd8cb('0x4'));var fs=require('fs');var Redis=require(_0xd8cb('0x5'));var db=require(_0xd8cb('0x6'))['db'];var utils=require(_0xd8cb('0x7'));var logger=require(_0xd8cb('0x8'))('rpc');var config=require(_0xd8cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd8cb('0xa')][_0xd8cb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd8cb('0xc')],{'host':_0xd8cb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd8cb('0xe'))[_0xd8cb('0xf')](socket);function respondWithRpcPromise(_0x587601,_0xc81bf0,_0x61f770){return new BPromise(function(_0x1b57bb,_0x29cdec){return client[_0xd8cb('0x10')](_0x587601,_0x61f770)[_0xd8cb('0x11')](function(_0x3db4d0){logger[_0xd8cb('0x12')]('ChatInteraction,\x20%s,\x20%s',_0xc81bf0,_0xd8cb('0x13'));logger[_0xd8cb('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xc81bf0,_0xd8cb('0x13'),JSON[_0xd8cb('0x15')](_0x3db4d0));if(_0x3db4d0[_0xd8cb('0x16')]){if(_0x3db4d0[_0xd8cb('0x16')]['code']===0x1f4){logger[_0xd8cb('0x16')](_0xd8cb('0x17'),_0xc81bf0,_0x3db4d0['error'][_0xd8cb('0x18')]);return _0x29cdec(_0x3db4d0['error'][_0xd8cb('0x18')]);}logger['error'](_0xd8cb('0x17'),_0xc81bf0,_0x3db4d0[_0xd8cb('0x16')][_0xd8cb('0x18')]);return _0x1b57bb(_0x3db4d0[_0xd8cb('0x16')][_0xd8cb('0x18')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0xc81bf0,_0xd8cb('0x13'));_0x1b57bb(_0x3db4d0[_0xd8cb('0x19')][_0xd8cb('0x18')]);}})['catch'](function(_0x31474f){logger[_0xd8cb('0x16')](_0xd8cb('0x17'),_0xc81bf0,_0x31474f);_0x29cdec(_0x31474f);});});}exports[_0xd8cb('0x1a')]=function(_0x271d9e){var _0x12c2d3=this;return new Promise(function(_0x3f2288,_0x208612){return db[_0xd8cb('0x1b')][_0xd8cb('0x1c')](_0x271d9e[_0xd8cb('0x1d')],{'raw':_0x271d9e['options']?_0x271d9e[_0xd8cb('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x271d9e['options']?_0x271d9e[_0xd8cb('0x1e')][_0xd8cb('0x1f')]||null:null,'attributes':_0x271d9e[_0xd8cb('0x1e')]?_0x271d9e['options'][_0xd8cb('0x20')]||null:null,'limit':_0x271d9e[_0xd8cb('0x1e')]?_0x271d9e['options'][_0xd8cb('0x21')]||null:null})['then'](function(_0x395f6e){logger[_0xd8cb('0x12')](_0xd8cb('0x1a'),_0x271d9e);logger[_0xd8cb('0x14')](_0xd8cb('0x1a'),_0x271d9e,JSON['stringify'](_0x395f6e));_0x3f2288(_0x395f6e);})['catch'](function(_0x73c9b1){logger['error'](_0xd8cb('0x1a'),_0x73c9b1[_0xd8cb('0x18')],_0x271d9e);_0x208612(_0x12c2d3[_0xd8cb('0x16')](0x1f4,_0x73c9b1[_0xd8cb('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x206ffb){return new Promise(function(_0x41a891,_0x455196){return db['ChatInteraction'][_0xd8cb('0x22')]({'where':_0x206ffb[_0xd8cb('0x1e')]?_0x206ffb['options'][_0xd8cb('0x1f')]||null:null})['then'](function(_0x58de3a){if(_0x58de3a){return _0x58de3a['addTags'](_0x206ffb['body'][_0xd8cb('0x23')],_['omit'](_0x206ffb['body'],['ids','id'])||{});}})[_0xd8cb('0x24')](function(_0x2054e7){logger[_0xd8cb('0x12')](_0xd8cb('0x25'),_0x206ffb);logger[_0xd8cb('0x14')](_0xd8cb('0x25'),_0x206ffb,JSON[_0xd8cb('0x15')](_0x2054e7));_0x41a891(_0x2054e7);})[_0xd8cb('0x26')](function(_0x5d08e0){logger['error'](_0xd8cb('0x25'),_0x5d08e0[_0xd8cb('0x18')],_0x206ffb);_0x455196(_this['error'](0x1f4,_0x5d08e0[_0xd8cb('0x18')]));});});}; \ No newline at end of file +var _0x0bd0=['client','http','redis','defaults','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d1042,_0x26b1e9){var _0x57e251=function(_0x336166){while(--_0x336166){_0x5d1042['push'](_0x5d1042['shift']());}};_0x57e251(++_0x26b1e9);}(_0x0bd0,0x14e));var _0x00bd=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0bd0[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x00bd('0x0'));var util=require('util');var moment=require(_0x00bd('0x1'));var BPromise=require('bluebird');var rs=require(_0x00bd('0x2'));var fs=require('fs');var Redis=require(_0x00bd('0x3'));var db=require(_0x00bd('0x4'))['db'];var utils=require(_0x00bd('0x5'));var logger=require(_0x00bd('0x6'))(_0x00bd('0x7'));var config=require(_0x00bd('0x8'));var jayson=require(_0x00bd('0x9'));var client=jayson[_0x00bd('0xa')][_0x00bd('0xb')]({'port':0x232a});config[_0x00bd('0xc')]=_[_0x00bd('0xd')](config[_0x00bd('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00bd('0xc')]));require(_0x00bd('0xe'))[_0x00bd('0xf')](socket);function respondWithRpcPromise(_0x380ae4,_0x3e861c,_0x1b5a50){return new BPromise(function(_0x56c678,_0x3abbe7){return client[_0x00bd('0x10')](_0x380ae4,_0x1b5a50)[_0x00bd('0x11')](function(_0x11a539){logger['info'](_0x00bd('0x12'),_0x3e861c,'request\x20sent');logger[_0x00bd('0x13')](_0x00bd('0x14'),_0x3e861c,_0x00bd('0x15'),JSON[_0x00bd('0x16')](_0x11a539));if(_0x11a539[_0x00bd('0x17')]){if(_0x11a539[_0x00bd('0x17')][_0x00bd('0x18')]===0x1f4){logger['error'](_0x00bd('0x12'),_0x3e861c,_0x11a539[_0x00bd('0x17')][_0x00bd('0x19')]);return _0x3abbe7(_0x11a539['error'][_0x00bd('0x19')]);}logger[_0x00bd('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x3e861c,_0x11a539[_0x00bd('0x17')][_0x00bd('0x19')]);return _0x56c678(_0x11a539['error'][_0x00bd('0x19')]);}else{logger[_0x00bd('0x1a')](_0x00bd('0x12'),_0x3e861c,'request\x20sent');_0x56c678(_0x11a539[_0x00bd('0x1b')][_0x00bd('0x19')]);}})[_0x00bd('0x1c')](function(_0x3ce7b4){logger['error'](_0x00bd('0x12'),_0x3e861c,_0x3ce7b4);_0x3abbe7(_0x3ce7b4);});});}exports[_0x00bd('0x1d')]=function(_0x5cf3c3){var _0x32fdcc=this;return new Promise(function(_0x2c5515,_0x4a5666){return db[_0x00bd('0x1e')]['update'](_0x5cf3c3['body'],{'raw':_0x5cf3c3[_0x00bd('0x1f')]?_0x5cf3c3[_0x00bd('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cf3c3[_0x00bd('0x1f')]?_0x5cf3c3[_0x00bd('0x1f')][_0x00bd('0x20')]||null:null,'attributes':_0x5cf3c3['options']?_0x5cf3c3[_0x00bd('0x1f')][_0x00bd('0x21')]||null:null,'limit':_0x5cf3c3[_0x00bd('0x1f')]?_0x5cf3c3[_0x00bd('0x1f')][_0x00bd('0x22')]||null:null})[_0x00bd('0x11')](function(_0x1cd189){logger[_0x00bd('0x1a')](_0x00bd('0x1d'),_0x5cf3c3);logger[_0x00bd('0x13')](_0x00bd('0x1d'),_0x5cf3c3,JSON[_0x00bd('0x16')](_0x1cd189));_0x2c5515(_0x1cd189);})[_0x00bd('0x1c')](function(_0x22303a){logger[_0x00bd('0x17')]('UpdateChatInteraction',_0x22303a[_0x00bd('0x19')],_0x5cf3c3);_0x4a5666(_0x32fdcc[_0x00bd('0x17')](0x1f4,_0x22303a[_0x00bd('0x19')]));});});};exports[_0x00bd('0x23')]=function(_0x5d8c27){return new Promise(function(_0x257f51,_0x4e93a3){return db[_0x00bd('0x1e')][_0x00bd('0x24')]({'where':_0x5d8c27[_0x00bd('0x1f')]?_0x5d8c27[_0x00bd('0x1f')][_0x00bd('0x20')]||null:null})[_0x00bd('0x11')](function(_0x57c814){if(_0x57c814){return _0x57c814[_0x00bd('0x25')](_0x5d8c27[_0x00bd('0x26')][_0x00bd('0x27')],_[_0x00bd('0x28')](_0x5d8c27[_0x00bd('0x26')],[_0x00bd('0x27'),'id'])||{});}})[_0x00bd('0x29')](function(_0x36de81){logger['info'](_0x00bd('0x2a'),_0x5d8c27);logger[_0x00bd('0x13')](_0x00bd('0x2a'),_0x5d8c27,JSON['stringify'](_0x36de81));_0x257f51(_0x36de81);})[_0x00bd('0x1c')](function(_0xd3fe05){logger[_0x00bd('0x17')](_0x00bd('0x2a'),_0xd3fe05['message'],_0x5d8c27);_0x4e93a3(_this[_0x00bd('0x17')](0x1f4,_0xd3fe05[_0x00bd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index ad842c1..196815a 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 _0xe11e=['remove','removeListener','register','length','./chatInteraction.events','save'];(function(_0x348a80,_0x325200){var _0x5aa48e=function(_0x36949e){while(--_0x36949e){_0x348a80['push'](_0x348a80['shift']());}};_0x5aa48e(++_0x325200);}(_0xe11e,0xca));var _0xee11=function(_0x2d35b2,_0x4e435f){_0x2d35b2=_0x2d35b2-0x0;var _0x1a1139=_0xe11e[_0x2d35b2];return _0x1a1139;};'use strict';var ChatInteractionEvents=require(_0xee11('0x0'));var events=[_0xee11('0x1'),_0xee11('0x2'),'update'];function createListener(_0x2e8558,_0x1ed90e){return function(_0x282171){_0x1ed90e['emit'](_0x2e8558,_0x282171);};}function removeListener(_0x351bb6,_0x12df1c){return function(){ChatInteractionEvents[_0xee11('0x3')](_0x351bb6,_0x12df1c);};}exports[_0xee11('0x4')]=function(_0xc6a373){for(var _0x471ba8=0x0,_0x190087=events[_0xee11('0x5')];_0x471ba8<_0x190087;_0x471ba8++){var _0x4f2c56=events[_0x471ba8];var _0x33d850=createListener('chatInteraction:'+_0x4f2c56,_0xc6a373);ChatInteractionEvents['on'](_0x4f2c56,_0x33d850);}}; \ No newline at end of file +var _0x4633=['register','./chatInteraction.events','save','update'];(function(_0x13d9c9,_0x2fd434){var _0x1e32b4=function(_0x2f66c0){while(--_0x2f66c0){_0x13d9c9['push'](_0x13d9c9['shift']());}};_0x1e32b4(++_0x2fd434);}(_0x4633,0x169));var _0x3463=function(_0x3e3519,_0x441bb4){_0x3e3519=_0x3e3519-0x0;var _0x25ed5a=_0x4633[_0x3e3519];return _0x25ed5a;};'use strict';var ChatInteractionEvents=require(_0x3463('0x0'));var events=[_0x3463('0x1'),'remove',_0x3463('0x2')];function createListener(_0x12ca1d,_0x54fc35){return function(_0x52970e){_0x54fc35['emit'](_0x12ca1d,_0x52970e);};}function removeListener(_0x5a7250,_0x93dcf9){return function(){ChatInteractionEvents['removeListener'](_0x5a7250,_0x93dcf9);};}exports[_0x3463('0x3')]=function(_0x26de6c){for(var _0x2adc04=0x0,_0x3beede=events['length'];_0x2adc04<_0x3beede;_0x2adc04++){var _0x3a7b7b=events[_0x2adc04];var _0x5e3ef6=createListener('chatInteraction:'+_0x3a7b7b,_0x26de6c);ChatInteractionEvents['on'](_0x3a7b7b,_0x5e3ef6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d340c72..3cfd6f9 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 _0xa41a=['close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','isAuthenticated','/:id/my_messages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','tracked','chat','chatinteraction:addtags','addTags','/:id','chatinteraction:update','update','customUpdate','/:id/close'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xa41a,0x6b));var _0xaa41=function(_0x3d48f2,_0x259123){_0x3d48f2=_0x3d48f2-0x0;var _0x4dfb13=_0xa41a[_0x3d48f2];return _0x4dfb13;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x9')](_0xaa41('0x10'),auth[_0xaa41('0x11')](),controller['getMessages']);router[_0xaa41('0x9')](_0xaa41('0x12'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0xaa41('0x9')]('/:id/download',auth[_0xaa41('0x11')](),controller[_0xaa41('0x13')]);router[_0xaa41('0x14')]('/',auth[_0xaa41('0x11')](),controller[_0xaa41('0x15')]);router['post'](_0xaa41('0x16'),auth[_0xaa41('0x11')](),controller[_0xaa41('0x17')]);var upload=multer({'storage':multer[_0xaa41('0x18')]({'destination':function(_0x2a6988,_0x2005ae,_0x1e1e02){_0x1e1e02(null,path['join'](config[_0xaa41('0x19')],_0xaa41('0x1a')));},'filename':function(_0x4210fa,_0x391b01,_0x230a6a){_0x230a6a(null,util[_0xaa41('0x1b')](_0xaa41('0x1c'),Date[_0xaa41('0x1d')](),_0x391b01[_0xaa41('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xaa41('0x1f'),upload[_0xaa41('0x20')](_0xaa41('0x21')),controller['attachmentUpload']);router[_0xaa41('0x14')](_0xaa41('0x10'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xaa41('0x14')]('/:id/tags',auth[_0xaa41('0x11')](),interaction[_0xaa41('0x22')](_0xaa41('0x23'),_0xaa41('0x24')),controller[_0xaa41('0x25')]);router['put'](_0xaa41('0x26'),auth[_0xaa41('0x11')](),interaction[_0xaa41('0x22')](_0xaa41('0x23'),_0xaa41('0x27')),controller[_0xaa41('0x28')]);router['put']('/:id/custom_update',controller[_0xaa41('0x29')]);router['put']('/:id/abandon',auth[_0xaa41('0xc')](),controller['abandon']);router['put'](_0xaa41('0x2a'),controller[_0xaa41('0x2b')]);router[_0xaa41('0x2c')](_0xaa41('0x26'),auth[_0xaa41('0x11')](),interaction[_0xaa41('0x22')]('chat',_0xaa41('0x2d')),controller[_0xaa41('0x2e')]);router[_0xaa41('0x2c')](_0xaa41('0x2f'),auth[_0xaa41('0x11')](),controller[_0xaa41('0x30')]);module[_0xaa41('0x31')]=router; \ No newline at end of file +var _0x4b84=['/:id/my_messages','getMyMessages','post','createVidaooSession','diskStorage','server/files/attachments/','%s-%s','now','replace','single','file','attachmentUpload','isChatInteractionAuthorized','addMessage','/:id/tags','tracked','chat','addTags','put','/:id','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','chatinteraction:destroy','destroy','removeTags','multer','util','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages'];(function(_0x5d849f,_0x3494ab){var _0x17712a=function(_0x56bb98){while(--_0x56bb98){_0x5d849f['push'](_0x5d849f['shift']());}};_0x17712a(++_0x3494ab);}(_0x4b84,0x1cc));var _0x44b8=function(_0x82140,_0x3a9d87){_0x82140=_0x82140-0x0;var _0x2b15a6=_0x4b84[_0x82140];return _0x2b15a6;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x6')](_0x44b8('0x9'),auth['isChatInteractionAuthorized'](),controller[_0x44b8('0xa')]);router[_0x44b8('0x6')](_0x44b8('0xb'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xc')]);router[_0x44b8('0x6')](_0x44b8('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x44b8('0xe')]);router[_0x44b8('0x6')]('/:id/download',auth[_0x44b8('0x7')](),controller['download']);router[_0x44b8('0xf')]('/',auth[_0x44b8('0x7')](),controller['create']);router[_0x44b8('0xf')]('/:id/vidaoo',auth['isAuthenticated'](),controller[_0x44b8('0x10')]);var upload=multer({'storage':multer[_0x44b8('0x11')]({'destination':function(_0x1722da,_0x41ab46,_0x5e52f2){_0x5e52f2(null,path['join'](config['root'],_0x44b8('0x12')));},'filename':function(_0x5b7803,_0x28ef36,_0x31651b){_0x31651b(null,util['format'](_0x44b8('0x13'),Date[_0x44b8('0x14')](),_0x28ef36['originalname'][_0x44b8('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x44b8('0xf')]('/:id/attachment_upload',upload[_0x44b8('0x16')](_0x44b8('0x17')),controller[_0x44b8('0x18')]);router[_0x44b8('0xf')](_0x44b8('0xb'),auth[_0x44b8('0x19')](),controller[_0x44b8('0x1a')]);router[_0x44b8('0xf')](_0x44b8('0x1b'),auth[_0x44b8('0x7')](),interaction[_0x44b8('0x1c')](_0x44b8('0x1d'),'chatinteraction:addtags'),controller[_0x44b8('0x1e')]);router[_0x44b8('0x1f')](_0x44b8('0x20'),auth[_0x44b8('0x7')](),interaction[_0x44b8('0x1c')]('chat',_0x44b8('0x21')),controller['update']);router[_0x44b8('0x1f')](_0x44b8('0x22'),controller[_0x44b8('0x23')]);router[_0x44b8('0x1f')](_0x44b8('0x24'),auth['isChatInteractionAuthorized'](),controller[_0x44b8('0x25')]);router['put'](_0x44b8('0x26'),controller[_0x44b8('0x27')]);router['delete'](_0x44b8('0x20'),auth[_0x44b8('0x7')](),interaction[_0x44b8('0x1c')]('chat',_0x44b8('0x28')),controller[_0x44b8('0x29')]);router['delete'](_0x44b8('0x1b'),auth['isAuthenticated'](),controller[_0x44b8('0x2a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 945a0ac..c97b117 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 _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x486f6b,_0x7db838){var _0x45c03c=function(_0x2cb178){while(--_0x2cb178){_0x486f6b['push'](_0x486f6b['shift']());}};_0x45c03c(++_0x7db838);}(_0x66fa,0x117));var _0xa66f=function(_0x566571,_0x3718b0){_0x566571=_0x566571-0x0;var _0x557cc7=_0x66fa[_0x566571];return _0x557cc7;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x37e0b0,_0x188338){var _0x41ee38=function(_0x1ce9fa){while(--_0x1ce9fa){_0x37e0b0['push'](_0x37e0b0['shift']());}};_0x41ee38(++_0x188338);}(_0xdb28,0x106));var _0x8db2=function(_0x274132,_0x187e61){_0x274132=_0x274132-0x0;var _0x57723c=_0xdb28[_0x274132];return _0x57723c;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a21cb99..23c9991 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 _0x0bd2=['online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','agent','resourceId','push','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','pick','filter','merge','where','include','ChatInternalMessage','findAll','rows','catch','show','params','filtears','includeAll','options','create','body','find','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','admin','user','fullname','role','userpic','internal'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0bd2,0xf7));var _0x20bd=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x0bd2[_0x3e112d];return _0x531c31;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x20bd('0x0'));var rimraf=require(_0x20bd('0x1'));var zipdir=require(_0x20bd('0x2'));var jsonpatch=require(_0x20bd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x20bd('0x4'));var util=require('util');var path=require(_0x20bd('0x5'));var sox=require(_0x20bd('0x6'));var csv=require(_0x20bd('0x7'));var ejs=require(_0x20bd('0x8'));var fs=require('fs');var _=require(_0x20bd('0x9'));var squel=require(_0x20bd('0xa'));var crypto=require(_0x20bd('0xb'));var jsforce=require(_0x20bd('0xc'));var deskjs=require(_0x20bd('0xd'));var toCsv=require(_0x20bd('0x7'));var querystring=require(_0x20bd('0xe'));var Papa=require('papaparse');var Redis=require(_0x20bd('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x20bd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x20bd('0x11'))(_0x20bd('0x12'));var utils=require(_0x20bd('0x13'));var config=require(_0x20bd('0x14'));var licenseUtil=require(_0x20bd('0x15'));var db=require(_0x20bd('0x16'))['db'];config[_0x20bd('0x17')]=_[_0x20bd('0x18')](config['redis'],{'host':_0x20bd('0x19'),'port':0x18eb});var socket=require(_0x20bd('0x1a'))(new Redis(config[_0x20bd('0x17')]));require(_0x20bd('0x1b'))[_0x20bd('0x1c')](socket);function respondWithStatusCode(_0x3863ab,_0x2de38d){_0x2de38d=_0x2de38d||0xcc;return function(_0x1750f9){if(_0x1750f9){return _0x3863ab[_0x20bd('0x1d')](_0x2de38d);}return _0x3863ab[_0x20bd('0x1e')](_0x2de38d)['end']();};}function respondWithResult(_0x2b5081,_0x58c5b9){_0x58c5b9=_0x58c5b9||0xc8;return function(_0x1647e2){if(_0x1647e2){return _0x2b5081[_0x20bd('0x1e')](_0x58c5b9)[_0x20bd('0x1f')](_0x1647e2);}};}function respondWithFilteredResult(_0x193dc7,_0x5eaa5b){return function(_0x514e6e){if(_0x514e6e){var _0x1d92de=_0x514e6e[_0x20bd('0x20')],_0x30132b=_0x5eaa5b['offset'],_0x19bb9e=_0x5eaa5b[_0x20bd('0x21')]+_0x5eaa5b['limit'],_0x3a5db3;if(_0x19bb9e>=_0x1d92de){_0x19bb9e=_0x1d92de;_0x3a5db3=0xc8;}else{_0x3a5db3=0xce;}_0x193dc7[_0x20bd('0x1e')](_0x3a5db3);return _0x193dc7[_0x20bd('0x22')](_0x20bd('0x23'),_0x30132b+'-'+_0x19bb9e+'/'+_0x1d92de)[_0x20bd('0x1f')](_0x514e6e);}return null;};}function patchUpdates(_0x31b452){return function(_0x55b44f){try{jsonpatch[_0x20bd('0x24')](_0x55b44f,_0x31b452,!![]);}catch(_0x44e84d){return BPromise[_0x20bd('0x25')](_0x44e84d);}return _0x55b44f['save']();};}function saveUpdates(_0xfd05c,_0x55e070){return function(_0x456c96){if(_0x456c96){return _0x456c96[_0x20bd('0x26')](_0xfd05c)[_0x20bd('0x27')](function(_0x328440){return _0x328440;});}return null;};}function removeEntity(_0x15c8a5,_0x10e60d){return function(_0x32599d){if(_0x32599d){return _0x32599d[_0x20bd('0x28')]()['then'](function(){_0x15c8a5[_0x20bd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xac5097,_0x1be6a3){return function(_0x3f5a81){if(!_0x3f5a81){_0xac5097[_0x20bd('0x1d')](0x194);}return _0x3f5a81;};}function handleError(_0x5d0bde,_0x342fc0){_0x342fc0=_0x342fc0||0x1f4;return function(_0x20c883){logger[_0x20bd('0x29')](_0x20c883[_0x20bd('0x2a')]);if(_0x20c883[_0x20bd('0x2b')]){delete _0x20c883['name'];}_0x5d0bde['status'](_0x342fc0)[_0x20bd('0x2c')](_0x20c883);};}exports[_0x20bd('0x2d')]=function(_0x5dbeec,_0x6149ac){var _0x288a9b={},_0x3f826b={},_0x1121dd={'count':0x0,'rows':[]};var _0xba413d=_['map'](db['ChatInternalMessage'][_0x20bd('0x2e')],function(_0x3beb19){return{'name':_0x3beb19[_0x20bd('0x2f')],'type':_0x3beb19[_0x20bd('0x30')][_0x20bd('0x31')]};});_0x3f826b[_0x20bd('0x32')]=_[_0x20bd('0x33')](_0xba413d,_0x20bd('0x2b'));_0x3f826b[_0x20bd('0x34')]=_[_0x20bd('0x35')](_0x5dbeec['query']);_0x3f826b[_0x20bd('0x36')]=_[_0x20bd('0x37')](_0x3f826b[_0x20bd('0x32')],_0x3f826b['query']);_0x288a9b['attributes']=_[_0x20bd('0x37')](_0x3f826b[_0x20bd('0x32')],qs[_0x20bd('0x38')](_0x5dbeec['query'][_0x20bd('0x38')]));_0x288a9b[_0x20bd('0x39')]=_0x288a9b[_0x20bd('0x39')][_0x20bd('0x3a')]?_0x288a9b['attributes']:_0x3f826b[_0x20bd('0x32')];if(!_0x5dbeec[_0x20bd('0x34')]['hasOwnProperty'](_0x20bd('0x3b'))){_0x288a9b[_0x20bd('0x3c')]=qs[_0x20bd('0x3c')](_0x5dbeec['query'][_0x20bd('0x3c')]);_0x288a9b[_0x20bd('0x21')]=qs['offset'](_0x5dbeec['query']['offset']);}_0x288a9b[_0x20bd('0x3d')]=qs[_0x20bd('0x3e')](_0x5dbeec[_0x20bd('0x34')][_0x20bd('0x3e')]);_0x288a9b['where']=qs[_0x20bd('0x36')](_[_0x20bd('0x3f')](_0x5dbeec[_0x20bd('0x34')],_0x3f826b[_0x20bd('0x36')]),_0xba413d);if(_0x5dbeec[_0x20bd('0x34')][_0x20bd('0x40')]){_0x288a9b['where']=_[_0x20bd('0x41')](_0x288a9b['where'],{'$or':_['map'](_0xba413d,function(_0xf85267){if(_0xf85267[_0x20bd('0x30')]!=='VIRTUAL'){var _0x40ea02={};_0x40ea02[_0xf85267[_0x20bd('0x2b')]]={'$like':'%'+_0x5dbeec['query']['filter']+'%'};return _0x40ea02;}})});}_0x288a9b=_[_0x20bd('0x41')]({},_0x288a9b,_0x5dbeec['options']);var _0x180654={'where':_0x288a9b[_0x20bd('0x42')]};return db['ChatInternalMessage']['count'](_0x180654)[_0x20bd('0x27')](function(_0x335622){_0x1121dd['count']=_0x335622;if(_0x5dbeec[_0x20bd('0x34')]['includeAll']){_0x288a9b[_0x20bd('0x43')]=[{'all':!![]}];}return db[_0x20bd('0x44')][_0x20bd('0x45')](_0x288a9b);})[_0x20bd('0x27')](function(_0x811ed0){_0x1121dd[_0x20bd('0x46')]=_0x811ed0;return _0x1121dd;})[_0x20bd('0x27')](respondWithFilteredResult(_0x6149ac,_0x288a9b))[_0x20bd('0x47')](handleError(_0x6149ac,null));};exports[_0x20bd('0x48')]=function(_0x5a5097,_0x19eb0a){var _0x5d9ca7={'raw':!![],'where':{'id':_0x5a5097[_0x20bd('0x49')]['id']}},_0x15deb6={};_0x15deb6[_0x20bd('0x32')]=_[_0x20bd('0x35')](db[_0x20bd('0x44')]['rawAttributes']);_0x15deb6['query']=_[_0x20bd('0x35')](_0x5a5097[_0x20bd('0x34')]);_0x15deb6[_0x20bd('0x4a')]=_[_0x20bd('0x37')](_0x15deb6[_0x20bd('0x32')],_0x15deb6[_0x20bd('0x34')]);_0x5d9ca7[_0x20bd('0x39')]=_[_0x20bd('0x37')](_0x15deb6[_0x20bd('0x32')],qs[_0x20bd('0x38')](_0x5a5097[_0x20bd('0x34')][_0x20bd('0x38')]));_0x5d9ca7[_0x20bd('0x39')]=_0x5d9ca7[_0x20bd('0x39')][_0x20bd('0x3a')]?_0x5d9ca7[_0x20bd('0x39')]:_0x15deb6['model'];if(_0x5a5097[_0x20bd('0x34')][_0x20bd('0x4b')]){_0x5d9ca7[_0x20bd('0x43')]=[{'all':!![]}];}_0x5d9ca7=_[_0x20bd('0x41')]({},_0x5d9ca7,_0x5a5097[_0x20bd('0x4c')]);return db[_0x20bd('0x44')]['find'](_0x5d9ca7)[_0x20bd('0x27')](handleEntityNotFound(_0x19eb0a,null))['then'](respondWithResult(_0x19eb0a,null))[_0x20bd('0x47')](handleError(_0x19eb0a,null));};exports[_0x20bd('0x4d')]=function(_0x11d9ed,_0x9404ee){return db[_0x20bd('0x44')][_0x20bd('0x4d')](_0x11d9ed[_0x20bd('0x4e')],{})['then'](respondWithResult(_0x9404ee,0xc9))['catch'](handleError(_0x9404ee,null));};exports[_0x20bd('0x26')]=function(_0x476e1a,_0x437497){if(_0x476e1a[_0x20bd('0x4e')]['id']){delete _0x476e1a[_0x20bd('0x4e')]['id'];}return db[_0x20bd('0x44')]['find']({'where':{'id':_0x476e1a[_0x20bd('0x49')]['id']}})[_0x20bd('0x27')](handleEntityNotFound(_0x437497,null))['then'](saveUpdates(_0x476e1a['body'],null))[_0x20bd('0x27')](respondWithResult(_0x437497,null))[_0x20bd('0x47')](handleError(_0x437497,null));};exports[_0x20bd('0x28')]=function(_0x27a355,_0x1d8917){return db[_0x20bd('0x44')][_0x20bd('0x4f')]({'where':{'id':_0x27a355[_0x20bd('0x49')]['id']}})[_0x20bd('0x27')](handleEntityNotFound(_0x1d8917,null))[_0x20bd('0x27')](removeEntity(_0x1d8917,null))[_0x20bd('0x47')](handleError(_0x1d8917,null));};exports[_0x20bd('0x50')]=function(_0x515d35,_0x4af79){return db['ChatInternalMessage'][_0x20bd('0x50')]()[_0x20bd('0x27')](respondWithResult(_0x4af79,null))[_0x20bd('0x47')](handleError(_0x4af79,null));};function wrapUser(_0x50b269){return function(_0x57da40){var _0x41d309=_0x50b269[_0x20bd('0x51')]({'plain':!![]});_0x41d309[_0x20bd('0x52')]=[];if(_0x57da40){_0x41d309[_0x20bd('0x53')]=_0x57da40[_0x20bd('0x54')];_0x41d309['lastMessage']=_0x57da40;}else{_0x41d309[_0x20bd('0x53')]=moment(0x0)[_0x20bd('0x55')](_0x20bd('0x56'));_0x41d309[_0x20bd('0x57')]={};}return _0x41d309;};}exports['getUsers']=function(_0x9c2d69,_0x55b23c,_0x326639){var _0x33c7ba=[];return db[_0x20bd('0x58')][_0x20bd('0x45')]({'where':{'role':['agent',_0x20bd('0x59'),_0x20bd('0x5a')]},'attributes':['id',_0x20bd('0x5b'),_0x20bd('0x2b'),_0x20bd('0x5c'),_0x20bd('0x5d'),_0x20bd('0x5e'),_0x20bd('0x5f'),_0x20bd('0x60'),_0x20bd('0x61'),_0x20bd('0x62')],'order':qs[_0x20bd('0x3e')](_0x20bd('0x63')),'include':[{'model':db[_0x20bd('0x64')],'as':_0x20bd('0x65'),'attributes':['id',_0x20bd('0x2b'),_0x20bd('0x30')],'through':{'attributes':[]}}]})['then'](function(_0x1ed813){if(_0x1ed813){var _0x142685=_0x9c2d69[_0x20bd('0x5a')][_0x20bd('0x51')]({'plain':!![]});if(!_0x142685)throw new Error(_0x20bd('0x66'));if(_0x142685[_0x20bd('0x5c')]===_0x20bd('0x5a')){return db[_0x20bd('0x67')][_0x20bd('0x4f')]({'where':{'name':'Agents','userProfileId':_0x142685[_0x20bd('0x68')]},'raw':!![]})['then'](function(_0x5979e4){if(_0x5979e4){if(_0x5979e4[_0x20bd('0x69')]===0x0){return db[_0x20bd('0x6a')][_0x20bd('0x45')]({'where':{'sectionId':_0x5979e4['id']},'raw':!![]})[_0x20bd('0x27')](function(_0x2f4943){var _0xf6a50a=[];if(_['isEmpty'](_0x2f4943)){_0xf6a50a=_['filter'](_0x1ed813,function(_0x545d77){if(_0x545d77[_0x20bd('0x5c')]!==_0x20bd('0x6b')){return _0x545d77;}});return _0xf6a50a;}else{for(var _0x26652d=0x0;_0x26652d<_0x1ed813[_0x20bd('0x3a')];_0x26652d++){var _0x3b1ec3=_0x1ed813[_0x26652d];if(_0x3b1ec3[_0x20bd('0x5c')]===_0x20bd('0x6b')){var _0x45a833=_[_0x20bd('0x4f')](_0x2f4943,function(_0x463dad){return _0x463dad[_0x20bd('0x6c')]===_0x3b1ec3['id'];});if(_0x45a833)_0xf6a50a[_0x20bd('0x6d')](_0x3b1ec3);}else{_0xf6a50a[_0x20bd('0x6d')](_0x3b1ec3);}}return _0xf6a50a;}});}else{return _0x1ed813;}}else{var _0x4b12ba=_[_0x20bd('0x40')](_0x1ed813,function(_0x39df59){if(_0x39df59[_0x20bd('0x5c')]!=='agent'){return _0x39df59;}});return _0x4b12ba;}});}else{return _0x1ed813;}}})['then'](function(_0x2ed7a3){var _0x2839e4=[];if(_0x2ed7a3){_0x33c7ba=_0x2ed7a3;for(var _0x55717f=0x0;_0x55717f<_0x2ed7a3['length'];_0x55717f+=0x1){_0x33c7ba[_0x55717f][_0x20bd('0x52')]=[];_0x2839e4[_0x20bd('0x6d')](db['ChatInternalMessage'][_0x20bd('0x4f')]({'where':{'FromId':[_0x9c2d69[_0x20bd('0x5a')]['id'],_0x2ed7a3[_0x55717f]['id']],'ToId':[_0x9c2d69[_0x20bd('0x5a')]['id'],_0x2ed7a3[_0x55717f]['id']],'ChatGroupId':null},'attributes':['id',_0x20bd('0x54'),_0x20bd('0x6e'),_0x20bd('0x6f'),_0x20bd('0x70'),_0x20bd('0x4e')],'order':qs[_0x20bd('0x3e')](_0x20bd('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2ed7a3[_0x55717f])));}return BPromise['all'](_0x2839e4);}return[];})['then'](function(_0x837f90){return{'rows':_0x837f90,'count':_0x837f90[_0x20bd('0x3a')]};})[_0x20bd('0x27')](respondWithResult(_0x55b23c,null))[_0x20bd('0x47')](handleError(_0x55b23c,null));}; \ No newline at end of file +var _0x5a57=['ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','merge','VIRTUAL','options','where','count','include','findAll','rows','catch','show','filtears','length','create','body','find','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','fullname','role','userpic','internal','lastLoginAt','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','status','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map'];(function(_0x18b087,_0x1aa1a2){var _0x5055e1=function(_0x1f6222){while(--_0x1f6222){_0x18b087['push'](_0x18b087['shift']());}};_0x5055e1(++_0x1aa1a2);}(_0x5a57,0x12b));var _0x75a5=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5a57[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x75a5('0x0'));var emlformat=require(_0x75a5('0x1'));var rimraf=require(_0x75a5('0x2'));var zipdir=require(_0x75a5('0x3'));var jsonpatch=require(_0x75a5('0x4'));var rp=require('request-promise');var moment=require(_0x75a5('0x5'));var BPromise=require(_0x75a5('0x6'));var Mustache=require(_0x75a5('0x7'));var util=require(_0x75a5('0x8'));var path=require(_0x75a5('0x9'));var sox=require('sox');var csv=require(_0x75a5('0xa'));var ejs=require(_0x75a5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x75a5('0xc'));var crypto=require(_0x75a5('0xd'));var jsforce=require(_0x75a5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x75a5('0xa'));var querystring=require(_0x75a5('0xf'));var Papa=require(_0x75a5('0x10'));var Redis=require(_0x75a5('0x11'));var authService=require(_0x75a5('0x12'));var qs=require(_0x75a5('0x13'));var as=require(_0x75a5('0x14'));var hardwareService=require(_0x75a5('0x15'));var logger=require(_0x75a5('0x16'))(_0x75a5('0x17'));var utils=require(_0x75a5('0x18'));var config=require(_0x75a5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x75a5('0x1a'))['db'];config[_0x75a5('0x1b')]=_['defaults'](config['redis'],{'host':_0x75a5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75a5('0x1b')]));require(_0x75a5('0x1d'))[_0x75a5('0x1e')](socket);function respondWithStatusCode(_0x375283,_0x957619){_0x957619=_0x957619||0xcc;return function(_0x2ab919){if(_0x2ab919){return _0x375283['sendStatus'](_0x957619);}return _0x375283[_0x75a5('0x1f')](_0x957619)['end']();};}function respondWithResult(_0xd0f42d,_0x5510e1){_0x5510e1=_0x5510e1||0xc8;return function(_0x2c8422){if(_0x2c8422){return _0xd0f42d[_0x75a5('0x1f')](_0x5510e1)['json'](_0x2c8422);}};}function respondWithFilteredResult(_0x305c82,_0x563deb){return function(_0x57bf69){if(_0x57bf69){var _0x30046b=_0x57bf69['count'],_0x4811e9=_0x563deb[_0x75a5('0x20')],_0x1ae077=_0x563deb[_0x75a5('0x20')]+_0x563deb['limit'],_0x44421a;if(_0x1ae077>=_0x30046b){_0x1ae077=_0x30046b;_0x44421a=0xc8;}else{_0x44421a=0xce;}_0x305c82[_0x75a5('0x1f')](_0x44421a);return _0x305c82[_0x75a5('0x21')](_0x75a5('0x22'),_0x4811e9+'-'+_0x1ae077+'/'+_0x30046b)[_0x75a5('0x23')](_0x57bf69);}return null;};}function patchUpdates(_0x554a24){return function(_0x228c30){try{jsonpatch[_0x75a5('0x24')](_0x228c30,_0x554a24,!![]);}catch(_0xfcc79c){return BPromise[_0x75a5('0x25')](_0xfcc79c);}return _0x228c30[_0x75a5('0x26')]();};}function saveUpdates(_0x14aa91,_0x4bdf8f){return function(_0x3fa657){if(_0x3fa657){return _0x3fa657[_0x75a5('0x27')](_0x14aa91)['then'](function(_0x2b2400){return _0x2b2400;});}return null;};}function removeEntity(_0x260428,_0x364e40){return function(_0x176cf6){if(_0x176cf6){return _0x176cf6[_0x75a5('0x28')]()[_0x75a5('0x29')](function(){_0x260428['status'](0xcc)[_0x75a5('0x2a')]();});}};}function handleEntityNotFound(_0x36bd7e,_0x5cce3a){return function(_0x326a7f){if(!_0x326a7f){_0x36bd7e[_0x75a5('0x2b')](0x194);}return _0x326a7f;};}function handleError(_0x4dc5e1,_0x1a548e){_0x1a548e=_0x1a548e||0x1f4;return function(_0x22fbf4){logger[_0x75a5('0x2c')](_0x22fbf4['stack']);if(_0x22fbf4[_0x75a5('0x2d')]){delete _0x22fbf4['name'];}_0x4dc5e1[_0x75a5('0x1f')](_0x1a548e)[_0x75a5('0x2e')](_0x22fbf4);};}exports[_0x75a5('0x2f')]=function(_0x4818ff,_0x44c35d){var _0x65b51f={},_0x2f9ed2={},_0x351b36={'count':0x0,'rows':[]};var _0x3165d6=_[_0x75a5('0x30')](db[_0x75a5('0x31')][_0x75a5('0x32')],function(_0x28a3e6){return{'name':_0x28a3e6[_0x75a5('0x33')],'type':_0x28a3e6[_0x75a5('0x34')][_0x75a5('0x35')]};});_0x2f9ed2['model']=_[_0x75a5('0x30')](_0x3165d6,'name');_0x2f9ed2[_0x75a5('0x36')]=_[_0x75a5('0x37')](_0x4818ff[_0x75a5('0x36')]);_0x2f9ed2['filters']=_[_0x75a5('0x38')](_0x2f9ed2[_0x75a5('0x39')],_0x2f9ed2[_0x75a5('0x36')]);_0x65b51f[_0x75a5('0x3a')]=_[_0x75a5('0x38')](_0x2f9ed2['model'],qs[_0x75a5('0x3b')](_0x4818ff[_0x75a5('0x36')]['fields']));_0x65b51f[_0x75a5('0x3a')]=_0x65b51f[_0x75a5('0x3a')]['length']?_0x65b51f[_0x75a5('0x3a')]:_0x2f9ed2[_0x75a5('0x39')];if(!_0x4818ff[_0x75a5('0x36')][_0x75a5('0x3c')](_0x75a5('0x3d'))){_0x65b51f[_0x75a5('0x3e')]=qs[_0x75a5('0x3e')](_0x4818ff[_0x75a5('0x36')]['limit']);_0x65b51f[_0x75a5('0x20')]=qs[_0x75a5('0x20')](_0x4818ff['query'][_0x75a5('0x20')]);}_0x65b51f[_0x75a5('0x3f')]=qs['sort'](_0x4818ff['query'][_0x75a5('0x40')]);_0x65b51f['where']=qs['filters'](_[_0x75a5('0x41')](_0x4818ff['query'],_0x2f9ed2[_0x75a5('0x42')]),_0x3165d6);if(_0x4818ff['query'][_0x75a5('0x43')]){_0x65b51f['where']=_[_0x75a5('0x44')](_0x65b51f['where'],{'$or':_[_0x75a5('0x30')](_0x3165d6,function(_0x5fb68a){if(_0x5fb68a[_0x75a5('0x34')]!==_0x75a5('0x45')){var _0x2757cd={};_0x2757cd[_0x5fb68a[_0x75a5('0x2d')]]={'$like':'%'+_0x4818ff['query']['filter']+'%'};return _0x2757cd;}})});}_0x65b51f=_[_0x75a5('0x44')]({},_0x65b51f,_0x4818ff[_0x75a5('0x46')]);var _0x16ab99={'where':_0x65b51f[_0x75a5('0x47')]};return db['ChatInternalMessage'][_0x75a5('0x48')](_0x16ab99)[_0x75a5('0x29')](function(_0x23ce8e){_0x351b36[_0x75a5('0x48')]=_0x23ce8e;if(_0x4818ff[_0x75a5('0x36')]['includeAll']){_0x65b51f[_0x75a5('0x49')]=[{'all':!![]}];}return db[_0x75a5('0x31')][_0x75a5('0x4a')](_0x65b51f);})[_0x75a5('0x29')](function(_0x2b60a8){_0x351b36[_0x75a5('0x4b')]=_0x2b60a8;return _0x351b36;})[_0x75a5('0x29')](respondWithFilteredResult(_0x44c35d,_0x65b51f))[_0x75a5('0x4c')](handleError(_0x44c35d,null));};exports[_0x75a5('0x4d')]=function(_0x1884c9,_0x423296){var _0x46f9ba={'raw':!![],'where':{'id':_0x1884c9['params']['id']}},_0x29b0da={};_0x29b0da[_0x75a5('0x39')]=_[_0x75a5('0x37')](db[_0x75a5('0x31')][_0x75a5('0x32')]);_0x29b0da[_0x75a5('0x36')]=_[_0x75a5('0x37')](_0x1884c9[_0x75a5('0x36')]);_0x29b0da[_0x75a5('0x4e')]=_['intersection'](_0x29b0da['model'],_0x29b0da[_0x75a5('0x36')]);_0x46f9ba[_0x75a5('0x3a')]=_[_0x75a5('0x38')](_0x29b0da[_0x75a5('0x39')],qs[_0x75a5('0x3b')](_0x1884c9['query']['fields']));_0x46f9ba[_0x75a5('0x3a')]=_0x46f9ba[_0x75a5('0x3a')][_0x75a5('0x4f')]?_0x46f9ba[_0x75a5('0x3a')]:_0x29b0da['model'];if(_0x1884c9[_0x75a5('0x36')]['includeAll']){_0x46f9ba[_0x75a5('0x49')]=[{'all':!![]}];}_0x46f9ba=_[_0x75a5('0x44')]({},_0x46f9ba,_0x1884c9[_0x75a5('0x46')]);return db[_0x75a5('0x31')]['find'](_0x46f9ba)[_0x75a5('0x29')](handleEntityNotFound(_0x423296,null))['then'](respondWithResult(_0x423296,null))[_0x75a5('0x4c')](handleError(_0x423296,null));};exports[_0x75a5('0x50')]=function(_0x15e061,_0x19223e){return db[_0x75a5('0x31')][_0x75a5('0x50')](_0x15e061[_0x75a5('0x51')],{})[_0x75a5('0x29')](respondWithResult(_0x19223e,0xc9))[_0x75a5('0x4c')](handleError(_0x19223e,null));};exports['update']=function(_0x2a3874,_0x420310){if(_0x2a3874['body']['id']){delete _0x2a3874[_0x75a5('0x51')]['id'];}return db['ChatInternalMessage'][_0x75a5('0x52')]({'where':{'id':_0x2a3874[_0x75a5('0x53')]['id']}})[_0x75a5('0x29')](handleEntityNotFound(_0x420310,null))['then'](saveUpdates(_0x2a3874[_0x75a5('0x51')],null))[_0x75a5('0x29')](respondWithResult(_0x420310,null))[_0x75a5('0x4c')](handleError(_0x420310,null));};exports[_0x75a5('0x28')]=function(_0x39d7a2,_0x379b95){return db['ChatInternalMessage'][_0x75a5('0x52')]({'where':{'id':_0x39d7a2[_0x75a5('0x53')]['id']}})[_0x75a5('0x29')](handleEntityNotFound(_0x379b95,null))[_0x75a5('0x29')](removeEntity(_0x379b95,null))[_0x75a5('0x4c')](handleError(_0x379b95,null));};exports[_0x75a5('0x54')]=function(_0x162dbd,_0x35b915){return db['ChatInternalMessage'][_0x75a5('0x54')]()['then'](respondWithResult(_0x35b915,null))[_0x75a5('0x4c')](handleError(_0x35b915,null));};function wrapUser(_0x6703f5){return function(_0x392423){var _0x534325=_0x6703f5[_0x75a5('0x55')]({'plain':!![]});_0x534325[_0x75a5('0x56')]=[];if(_0x392423){_0x534325[_0x75a5('0x57')]=_0x392423[_0x75a5('0x58')];_0x534325[_0x75a5('0x59')]=_0x392423;}else{_0x534325[_0x75a5('0x57')]=moment(0x0)[_0x75a5('0x5a')](_0x75a5('0x5b'));_0x534325[_0x75a5('0x59')]={};}return _0x534325;};}exports[_0x75a5('0x5c')]=function(_0x1c4da1,_0x1c090a,_0x1c18dc){var _0x46ddd7=[];return db['User']['findAll']({'where':{'role':[_0x75a5('0x5d'),_0x75a5('0x5e'),'user']},'attributes':['id',_0x75a5('0x5f'),_0x75a5('0x2d'),_0x75a5('0x60'),_0x75a5('0x61'),_0x75a5('0x62'),'online',_0x75a5('0x63'),'allowmessenger','showWebBar'],'order':qs[_0x75a5('0x40')]('-online'),'include':[{'model':db[_0x75a5('0x64')],'as':_0x75a5('0x65'),'attributes':['id','name',_0x75a5('0x34')],'through':{'attributes':[]}}]})[_0x75a5('0x29')](function(_0x4b2933){if(_0x4b2933){var _0x4d6fe6=_0x1c4da1[_0x75a5('0x66')][_0x75a5('0x55')]({'plain':!![]});if(!_0x4d6fe6)throw new Error(_0x75a5('0x67'));if(_0x4d6fe6['role']===_0x75a5('0x66')){return db[_0x75a5('0x68')][_0x75a5('0x52')]({'where':{'name':_0x75a5('0x69'),'userProfileId':_0x4d6fe6[_0x75a5('0x6a')]},'raw':!![]})[_0x75a5('0x29')](function(_0x3cfee2){if(_0x3cfee2){if(_0x3cfee2[_0x75a5('0x6b')]===0x0){return db[_0x75a5('0x6c')][_0x75a5('0x4a')]({'where':{'sectionId':_0x3cfee2['id']},'raw':!![]})[_0x75a5('0x29')](function(_0x40fd2d){var _0x386295=[];if(_[_0x75a5('0x6d')](_0x40fd2d)){_0x386295=_[_0x75a5('0x43')](_0x4b2933,function(_0x3cd70e){if(_0x3cd70e[_0x75a5('0x60')]!=='agent'){return _0x3cd70e;}});return _0x386295;}else{for(var _0x513cb0=0x0;_0x513cb0<_0x4b2933['length'];_0x513cb0++){var _0x3a8c0c=_0x4b2933[_0x513cb0];if(_0x3a8c0c[_0x75a5('0x60')]===_0x75a5('0x5d')){var _0x3dcb20=_[_0x75a5('0x52')](_0x40fd2d,function(_0x19b670){return _0x19b670[_0x75a5('0x6e')]===_0x3a8c0c['id'];});if(_0x3dcb20)_0x386295['push'](_0x3a8c0c);}else{_0x386295[_0x75a5('0x6f')](_0x3a8c0c);}}return _0x386295;}});}else{return _0x4b2933;}}else{var _0x1829b1=_[_0x75a5('0x43')](_0x4b2933,function(_0x21e73b){if(_0x21e73b[_0x75a5('0x60')]!==_0x75a5('0x5d')){return _0x21e73b;}});return _0x1829b1;}});}else{return _0x4b2933;}}})[_0x75a5('0x29')](function(_0x54d977){var _0x11a830=[];if(_0x54d977){_0x46ddd7=_0x54d977;for(var _0x41cad4=0x0;_0x41cad4<_0x54d977[_0x75a5('0x4f')];_0x41cad4+=0x1){_0x46ddd7[_0x41cad4][_0x75a5('0x56')]=[];_0x11a830[_0x75a5('0x6f')](db['ChatInternalMessage'][_0x75a5('0x52')]({'where':{'FromId':[_0x1c4da1['user']['id'],_0x54d977[_0x41cad4]['id']],'ToId':[_0x1c4da1[_0x75a5('0x66')]['id'],_0x54d977[_0x41cad4]['id']],'ChatGroupId':null},'attributes':['id',_0x75a5('0x58'),_0x75a5('0x70'),_0x75a5('0x71'),_0x75a5('0x72'),_0x75a5('0x51')],'order':qs[_0x75a5('0x40')](_0x75a5('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x75a5('0x29')](wrapUser(_0x54d977[_0x41cad4])));}return BPromise['all'](_0x11a830);}return[];})[_0x75a5('0x29')](function(_0x3e4344){return{'rows':_0x3e4344,'count':_0x3e4344[_0x75a5('0x4f')]};})['then'](respondWithResult(_0x1c090a,null))[_0x75a5('0x4c')](handleError(_0x1c090a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3a400ca..4ca4629 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 _0x2fb5=['emit','hook','exports','events','setMaxListeners','save','update'];(function(_0xa03c26,_0x2edd5b){var _0x37f407=function(_0x45dca9){while(--_0x45dca9){_0xa03c26['push'](_0xa03c26['shift']());}};_0x37f407(++_0x2edd5b);}(_0x2fb5,0xff));var _0x52fb=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x2fb5[_0x8c1005];return _0x175354;};'use strict';var EventEmitter=require(_0x52fb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x52fb('0x1')](0x0);var events={'afterCreate':_0x52fb('0x2'),'afterUpdate':_0x52fb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a7b76){return function(_0x23b1dd,_0x2a556a,_0x386e07){ChatInternalMessageEvents['emit'](_0x1a7b76+':'+_0x23b1dd['id'],_0x23b1dd);ChatInternalMessageEvents[_0x52fb('0x4')](_0x1a7b76,_0x23b1dd);_0x386e07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x52fb('0x5')](e,emitEvent(event));}}module[_0x52fb('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xdfcc=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x7b3635,_0x2911be){var _0x11b2e0=function(_0x1deee7){while(--_0x1deee7){_0x7b3635['push'](_0x7b3635['shift']());}};_0x11b2e0(++_0x2911be);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xdfcc[_0x5c9307];return _0x373e29;};'use strict';var EventEmitter=require(_0xcdfc('0x0'));var ChatInternalMessage=require(_0xcdfc('0x1'))['db'][_0xcdfc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcdfc('0x3'),'afterUpdate':_0xcdfc('0x4'),'afterDestroy':_0xcdfc('0x5')};function emitEvent(_0x4aef49){return function(_0x468275,_0x4e9e63,_0x5b1db4){ChatInternalMessageEvents['emit'](_0x4aef49+':'+_0x468275['id'],_0x468275);ChatInternalMessageEvents[_0xcdfc('0x6')](_0x4aef49,_0x468275);_0x5b1db4(null);};}for(var e in events){if(events[_0xcdfc('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcdfc('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b599d01..f12a1ec 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 _0xf4eb=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','bluebird','rimraf','../../config/environment'];(function(_0x46e85e,_0x48ad32){var _0x402ec5=function(_0x169507){while(--_0x169507){_0x46e85e['push'](_0x46e85e['shift']());}};_0x402ec5(++_0x48ad32);}(_0xf4eb,0xec));var _0xbf4e=function(_0x55dea1,_0x4027e6){_0x55dea1=_0x55dea1-0x0;var _0x57eb52=_0xf4eb[_0x55dea1];return _0x57eb52;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf4eb=['./chatInternalMessage.attributes','exports','define','chat_internal_messages','lodash','bluebird','rimraf','../../config/environment'];(function(_0x67f42d,_0x10396b){var _0x542918=function(_0x3e6a70){while(--_0x3e6a70){_0x67f42d['push'](_0x67f42d['shift']());}};_0x542918(++_0x10396b);}(_0xf4eb,0xec));var _0xbf4e=function(_0xefaaf6,_0x30af06){_0xefaaf6=_0xefaaf6-0x0;var _0x3868b1=_0xf4eb[_0xefaaf6];return _0x3868b1;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('ChatInternalMessage',attributes,{'tableName':_0xbf4e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 250586f..42c862e 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 _0x5773=['rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a16a4,_0xf134df){var _0x2e1401=function(_0x8609ba){while(--_0x8609ba){_0x4a16a4['push'](_0x4a16a4['shift']());}};_0x2e1401(++_0xf134df);}(_0x5773,0x161));var _0x3577=function(_0x5a2b1f,_0x3041ac){_0x5a2b1f=_0x5a2b1f-0x0;var _0x4952a1=_0x5773[_0x5a2b1f];return _0x4952a1;};'use strict';var _=require(_0x3577('0x0'));var util=require(_0x3577('0x1'));var moment=require(_0x3577('0x2'));var BPromise=require('bluebird');var rs=require(_0x3577('0x3'));var fs=require('fs');var Redis=require(_0x3577('0x4'));var db=require(_0x3577('0x5'))['db'];var utils=require(_0x3577('0x6'));var logger=require('../../config/logger')(_0x3577('0x7'));var config=require('../../config/environment');var jayson=require(_0x3577('0x8'));var client=jayson['client'][_0x3577('0x9')]({'port':0x232a});config[_0x3577('0xa')]=_[_0x3577('0xb')](config[_0x3577('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3577('0xc'))(new Redis(config[_0x3577('0xa')]));require(_0x3577('0xd'))[_0x3577('0xe')](socket);function respondWithRpcPromise(_0x6977ac,_0x292da0,_0x4869f6){return new BPromise(function(_0x321147,_0x42b0b5){return client[_0x3577('0xf')](_0x6977ac,_0x4869f6)['then'](function(_0x2a902a){logger[_0x3577('0x10')](_0x3577('0x11'),_0x292da0,_0x3577('0x12'));logger[_0x3577('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x292da0,_0x3577('0x12'),JSON[_0x3577('0x14')](_0x2a902a));if(_0x2a902a[_0x3577('0x15')]){if(_0x2a902a[_0x3577('0x15')][_0x3577('0x16')]===0x1f4){logger['error'](_0x3577('0x11'),_0x292da0,_0x2a902a['error']['message']);return _0x42b0b5(_0x2a902a[_0x3577('0x15')]['message']);}logger[_0x3577('0x15')](_0x3577('0x11'),_0x292da0,_0x2a902a['error'][_0x3577('0x17')]);return _0x321147(_0x2a902a[_0x3577('0x15')]['message']);}else{logger[_0x3577('0x10')](_0x3577('0x11'),_0x292da0,_0x3577('0x12'));_0x321147(_0x2a902a['result'][_0x3577('0x17')]);}})['catch'](function(_0x4e948a){logger[_0x3577('0x15')](_0x3577('0x11'),_0x292da0,_0x4e948a);_0x42b0b5(_0x4e948a);});});} \ No newline at end of file +var _0x0c88=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x336e94,_0x101b3f){var _0x321fb7=function(_0x1abcfe){while(--_0x1abcfe){_0x336e94['push'](_0x336e94['shift']());}};_0x321fb7(++_0x101b3f);}(_0x0c88,0x1dd));var _0x80c8=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0c88[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x80c8('0x0'));var util=require(_0x80c8('0x1'));var moment=require('moment');var BPromise=require(_0x80c8('0x2'));var rs=require(_0x80c8('0x3'));var fs=require('fs');var Redis=require(_0x80c8('0x4'));var db=require(_0x80c8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x80c8('0x6'))(_0x80c8('0x7'));var config=require(_0x80c8('0x8'));var jayson=require(_0x80c8('0x9'));var client=jayson[_0x80c8('0xa')][_0x80c8('0xb')]({'port':0x232a});config['redis']=_[_0x80c8('0xc')](config['redis'],{'host':_0x80c8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x80c8('0xe')](socket);function respondWithRpcPromise(_0x490d89,_0x4b2b53,_0x23d836){return new BPromise(function(_0x2b322e,_0x3160ac){return client['request'](_0x490d89,_0x23d836)[_0x80c8('0xf')](function(_0x47e788){logger[_0x80c8('0x10')](_0x80c8('0x11'),_0x4b2b53,_0x80c8('0x12'));logger['debug'](_0x80c8('0x13'),_0x4b2b53,_0x80c8('0x12'),JSON[_0x80c8('0x14')](_0x47e788));if(_0x47e788[_0x80c8('0x15')]){if(_0x47e788['error'][_0x80c8('0x16')]===0x1f4){logger[_0x80c8('0x15')](_0x80c8('0x11'),_0x4b2b53,_0x47e788[_0x80c8('0x15')][_0x80c8('0x17')]);return _0x3160ac(_0x47e788['error']['message']);}logger[_0x80c8('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x4b2b53,_0x47e788[_0x80c8('0x15')][_0x80c8('0x17')]);return _0x2b322e(_0x47e788[_0x80c8('0x15')]['message']);}else{logger[_0x80c8('0x10')](_0x80c8('0x11'),_0x4b2b53,'request\x20sent');_0x2b322e(_0x47e788[_0x80c8('0x18')][_0x80c8('0x17')]);}})['catch'](function(_0x3127c6){logger[_0x80c8('0x15')](_0x80c8('0x11'),_0x4b2b53,_0x3127c6);_0x3160ac(_0x3127c6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4b197cd..efc4f57 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 _0x48ea=['removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','remove','update','emit'];(function(_0x164760,_0x5874b0){var _0x8b91b2=function(_0x40d20a){while(--_0x40d20a){_0x164760['push'](_0x164760['shift']());}};_0x8b91b2(++_0x5874b0);}(_0x48ea,0x9c));var _0xa48e=function(_0x5898b2,_0x232aab){_0x5898b2=_0x5898b2-0x0;var _0x4c5beb=_0x48ea[_0x5898b2];return _0x4c5beb;};'use strict';var ChatInternalMessageEvents=require(_0xa48e('0x0'));var events=['save',_0xa48e('0x1'),_0xa48e('0x2')];function createListener(_0x108dac,_0x492009){return function(_0x480d3c){_0x492009[_0xa48e('0x3')](_0x108dac,_0x480d3c);};}function removeListener(_0x5c7354,_0x1da836){return function(){ChatInternalMessageEvents[_0xa48e('0x4')](_0x5c7354,_0x1da836);};}exports[_0xa48e('0x5')]=function(_0x4387b5){for(var _0x2b058d=0x0,_0x405033=events[_0xa48e('0x6')];_0x2b058d<_0x405033;_0x2b058d++){var _0x143004=events[_0x2b058d];var _0x3bdc25=createListener(_0xa48e('0x7')+_0x143004,_0x4387b5);ChatInternalMessageEvents['on'](_0x143004,_0x3bdc25);}}; \ No newline at end of file +var _0x5620=['remove','update','emit','register','length','./chatInternalMessage.events'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5620,0xbf));var _0x0562=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x5620[_0x219d87];return _0x22823d;};'use strict';var ChatInternalMessageEvents=require(_0x0562('0x0'));var events=['save',_0x0562('0x1'),_0x0562('0x2')];function createListener(_0x517581,_0x57a89e){return function(_0x5d7473){_0x57a89e[_0x0562('0x3')](_0x517581,_0x5d7473);};}function removeListener(_0x4ef07f,_0x18ea87){return function(){ChatInternalMessageEvents['removeListener'](_0x4ef07f,_0x18ea87);};}exports[_0x0562('0x4')]=function(_0x39ab9a){for(var _0x4155b9=0x0,_0x24b8d1=events[_0x0562('0x5')];_0x4155b9<_0x24b8d1;_0x4155b9++){var _0x126c04=events[_0x4155b9];var _0x5f47ba=createListener('chatInternalMessage:'+_0x126c04,_0x39ab9a);ChatInternalMessageEvents['on'](_0x126c04,_0x5f47ba);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 50a4695..a2665a7 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 _0xd8b0=['put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','index','get','/describe','describe','isAuthenticated','getUsers','/:id','show','post'];(function(_0x2cc071,_0x5c3bfb){var _0x2edfce=function(_0xaa0c36){while(--_0xaa0c36){_0x2cc071['push'](_0x2cc071['shift']());}};_0x2edfce(++_0x5c3bfb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/users',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth[_0x0d8b('0xb')](),controller['create']);router[_0x0d8b('0x10')]('/:id',controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);module[_0x0d8b('0x14')]=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0xc3aed2,_0x2a0bef){var _0x1e85eb=function(_0x962b4b){while(--_0x962b4b){_0xc3aed2['push'](_0xc3aed2['shift']());}};_0x1e85eb(++_0x2a0bef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6559306..7a693ac 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 _0x534f=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x186ab2,_0x5a2bdc){var _0x438120=function(_0x40565d){while(--_0x40565d){_0x186ab2['push'](_0x186ab2['shift']());}};_0x438120(++_0x5a2bdc);}(_0x534f,0x1a3));var _0xf534=function(_0x77a27c,_0x477e66){_0x77a27c=_0x77a27c-0x0;var _0x2bc20c=_0x534f[_0x77a27c];return _0x2bc20c;};'use strict';var Sequelize=require(_0xf534('0x0'));module[_0xf534('0x1')]={'body':{'type':Sequelize[_0xf534('0x2')](_0xf534('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf534('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf534('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf534('0x5')]('in',_0xf534('0x6')),'defaultValue':_0xf534('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf534('0x7')]}}; \ No newline at end of file +var _0x0ead=['out','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x0ead,0x10c));var _0xd0ea=function(_0x5c47c2,_0x1f11db){_0x5c47c2=_0x5c47c2-0x0;var _0x30b3ee=_0x0ead[_0x5c47c2];return _0x30b3ee;};'use strict';var Sequelize=require(_0xd0ea('0x0'));module[_0xd0ea('0x1')]={'body':{'type':Sequelize['TEXT'](_0xd0ea('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd0ea('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd0ea('0x4')]('in','out'),'defaultValue':_0xd0ea('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd0ea('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b27d9a6..c4b254f 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 _0xe706=['merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','describe','chat-interactions','accept','chat','read','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','ChatInteraction','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','formData','agent','RejectMessage','rejectMessage','reject','rejectmessage','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','apply','save','update','destroy','then','end','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0xd28ade,_0x8c2b09){var _0x4301cb=function(_0x533c07){while(--_0x533c07){_0xd28ade['push'](_0xd28ade['shift']());}};_0x4301cb(++_0x8c2b09);}(_0xe706,0xa3));var _0x6e70=function(_0x4b64a4,_0x1bdc50){_0x4b64a4=_0x4b64a4-0x0;var _0xd19b0e=_0xe706[_0x4b64a4];return _0xd19b0e;};'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 licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];config[_0x6e70('0x1d')]=_[_0x6e70('0x1e')](config[_0x6e70('0x1d')],{'host':_0x6e70('0x1f'),'port':0x18eb});var socket=require(_0x6e70('0x20'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x6e70('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x6e70('0x22')][_0x6e70('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x5d9263,_0x24f3ac,_0x5c3fe7,_0x2efc0f){return new BPromise(function(_0x161f23,_0x4ca554){var _0x49029f=_0x2efc0f||client;return _0x49029f[_0x6e70('0x24')](_0x5d9263,_0x5c3fe7)['then'](function(_0x28a21f){logger[_0x6e70('0x25')]('ChatMessage,\x20%s,\x20%s',_0x24f3ac,'request\x20sent');logger[_0x6e70('0x26')](_0x6e70('0x27'),_0x24f3ac,_0x6e70('0x28'),JSON[_0x6e70('0x29')](_0x28a21f));if(_0x28a21f[_0x6e70('0x2a')]){if(_0x28a21f[_0x6e70('0x2a')][_0x6e70('0x2b')]===0x1f4){logger[_0x6e70('0x2a')](_0x6e70('0x2c'),_0x24f3ac,_0x28a21f[_0x6e70('0x2a')]['message']);return _0x4ca554(_0x28a21f[_0x6e70('0x2a')][_0x6e70('0x2d')]);}logger[_0x6e70('0x2a')]('ChatMessage,\x20%s,\x20%s',_0x24f3ac,_0x28a21f[_0x6e70('0x2a')][_0x6e70('0x2d')]);return _0x161f23(_0x28a21f[_0x6e70('0x2a')]['message']);}else{logger[_0x6e70('0x25')]('ChatMessage,\x20%s,\x20%s',_0x24f3ac,'request\x20sent');_0x161f23(_0x28a21f['result'][_0x6e70('0x2d')]);}})[_0x6e70('0x2e')](function(_0x51d292){logger[_0x6e70('0x2a')](_0x6e70('0x2c'),_0x24f3ac,_0x51d292);_0x4ca554(_0x51d292);});});}function respondWithStatusCode(_0x5f268f,_0x338ad6){_0x338ad6=_0x338ad6||0xcc;return function(_0x67fb43){if(_0x67fb43){return _0x5f268f[_0x6e70('0x2f')](_0x338ad6);}return _0x5f268f['status'](_0x338ad6)['end']();};}function respondWithResult(_0x2c4d37,_0x3af17f){_0x3af17f=_0x3af17f||0xc8;return function(_0x83c836){if(_0x83c836){return _0x2c4d37[_0x6e70('0x30')](_0x3af17f)[_0x6e70('0x31')](_0x83c836);}};}function respondWithFilteredResult(_0x5d772a,_0x1952ea){return function(_0x406f29){if(_0x406f29){var _0xecf336=_0x406f29[_0x6e70('0x32')],_0x2864a0=_0x1952ea[_0x6e70('0x33')],_0x396a67=_0x1952ea[_0x6e70('0x33')]+_0x1952ea[_0x6e70('0x34')],_0x20a225;if(_0x396a67>=_0xecf336){_0x396a67=_0xecf336;_0x20a225=0xc8;}else{_0x20a225=0xce;}_0x5d772a['status'](_0x20a225);return _0x5d772a[_0x6e70('0x35')]('Content-Range',_0x2864a0+'-'+_0x396a67+'/'+_0xecf336)[_0x6e70('0x31')](_0x406f29);}return null;};}function patchUpdates(_0x5a7a2a){return function(_0xdd7cc1){try{jsonpatch[_0x6e70('0x36')](_0xdd7cc1,_0x5a7a2a,!![]);}catch(_0x30fa0b){return BPromise['reject'](_0x30fa0b);}return _0xdd7cc1[_0x6e70('0x37')]();};}function saveUpdates(_0x42b094,_0x5780a1){return function(_0x13d673){if(_0x13d673){return _0x13d673[_0x6e70('0x38')](_0x42b094)['then'](function(_0x10d8f6){return _0x10d8f6;});}return null;};}function removeEntity(_0x3665a1,_0x2d52bd){return function(_0x2723d7){if(_0x2723d7){return _0x2723d7[_0x6e70('0x39')]()[_0x6e70('0x3a')](function(){_0x3665a1[_0x6e70('0x30')](0xcc)[_0x6e70('0x3b')]();});}};}function handleEntityNotFound(_0xf146fd,_0x419a41){return function(_0x4d32d8){if(!_0x4d32d8){_0xf146fd[_0x6e70('0x2f')](0x194);}return _0x4d32d8;};}function handleError(_0x4795a0,_0x23cd1a){_0x23cd1a=_0x23cd1a||0x1f4;return function(_0x3222a2){logger[_0x6e70('0x2a')](_0x3222a2[_0x6e70('0x3c')]);if(_0x3222a2[_0x6e70('0x3d')]){delete _0x3222a2[_0x6e70('0x3d')];}_0x4795a0[_0x6e70('0x30')](_0x23cd1a)[_0x6e70('0x3e')](_0x3222a2);};}exports[_0x6e70('0x3f')]=function(_0x198dd1,_0x2a5444){var _0x23d5e2={},_0x5594d3={},_0x501b53={'count':0x0,'rows':[]};var _0x5446a2=_['map'](db[_0x6e70('0x40')][_0x6e70('0x41')],function(_0x2cb5b0){return{'name':_0x2cb5b0[_0x6e70('0x42')],'type':_0x2cb5b0[_0x6e70('0x43')][_0x6e70('0x44')]};});_0x5594d3['model']=_[_0x6e70('0x45')](_0x5446a2,_0x6e70('0x3d'));_0x5594d3[_0x6e70('0x46')]=_[_0x6e70('0x47')](_0x198dd1[_0x6e70('0x46')]);_0x5594d3[_0x6e70('0x48')]=_[_0x6e70('0x49')](_0x5594d3[_0x6e70('0x4a')],_0x5594d3['query']);_0x23d5e2[_0x6e70('0x4b')]=_[_0x6e70('0x49')](_0x5594d3[_0x6e70('0x4a')],qs[_0x6e70('0x4c')](_0x198dd1[_0x6e70('0x46')][_0x6e70('0x4c')]));_0x23d5e2[_0x6e70('0x4b')]=_0x23d5e2['attributes']['length']?_0x23d5e2['attributes']:_0x5594d3[_0x6e70('0x4a')];if(!_0x198dd1[_0x6e70('0x46')][_0x6e70('0x4d')](_0x6e70('0x4e'))){_0x23d5e2[_0x6e70('0x34')]=qs['limit'](_0x198dd1[_0x6e70('0x46')][_0x6e70('0x34')]);_0x23d5e2[_0x6e70('0x33')]=qs['offset'](_0x198dd1['query']['offset']);}_0x23d5e2[_0x6e70('0x4f')]=qs['sort'](_0x198dd1[_0x6e70('0x46')][_0x6e70('0x50')]);_0x23d5e2[_0x6e70('0x51')]=qs[_0x6e70('0x48')](_['pick'](_0x198dd1[_0x6e70('0x46')],_0x5594d3['filters']),_0x5446a2);if(_0x198dd1[_0x6e70('0x46')][_0x6e70('0x52')]){_0x23d5e2[_0x6e70('0x51')]=_[_0x6e70('0x53')](_0x23d5e2['where'],{'$or':_[_0x6e70('0x45')](_0x5446a2,function(_0x44b637){if(_0x44b637[_0x6e70('0x43')]!==_0x6e70('0x54')){var _0x8f243d={};_0x8f243d[_0x44b637[_0x6e70('0x3d')]]={'$like':'%'+_0x198dd1[_0x6e70('0x46')]['filter']+'%'};return _0x8f243d;}})});}_0x23d5e2=_[_0x6e70('0x53')]({},_0x23d5e2,_0x198dd1[_0x6e70('0x55')]);var _0x10de2a={'where':_0x23d5e2[_0x6e70('0x51')]};return db[_0x6e70('0x40')][_0x6e70('0x32')](_0x10de2a)[_0x6e70('0x3a')](function(_0x4ab26e){_0x501b53[_0x6e70('0x32')]=_0x4ab26e;if(_0x198dd1['query'][_0x6e70('0x56')]){_0x23d5e2[_0x6e70('0x57')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x23d5e2);})[_0x6e70('0x3a')](function(_0x25a208){_0x501b53[_0x6e70('0x58')]=_0x25a208;return _0x501b53;})['then'](respondWithFilteredResult(_0x2a5444,_0x23d5e2))['catch'](handleError(_0x2a5444,null));};exports[_0x6e70('0x59')]=function(_0x11ac3d,_0x22abc1){var _0x79653={'raw':!![],'where':{'id':_0x11ac3d[_0x6e70('0x5a')]['id']}},_0x2e25d5={};_0x2e25d5['model']=_[_0x6e70('0x47')](db[_0x6e70('0x40')][_0x6e70('0x41')]);_0x2e25d5[_0x6e70('0x46')]=_[_0x6e70('0x47')](_0x11ac3d['query']);_0x2e25d5['filtears']=_[_0x6e70('0x49')](_0x2e25d5[_0x6e70('0x4a')],_0x2e25d5[_0x6e70('0x46')]);_0x79653[_0x6e70('0x4b')]=_[_0x6e70('0x49')](_0x2e25d5['model'],qs[_0x6e70('0x4c')](_0x11ac3d[_0x6e70('0x46')][_0x6e70('0x4c')]));_0x79653[_0x6e70('0x4b')]=_0x79653[_0x6e70('0x4b')]['length']?_0x79653[_0x6e70('0x4b')]:_0x2e25d5[_0x6e70('0x4a')];if(_0x11ac3d[_0x6e70('0x46')][_0x6e70('0x56')]){_0x79653[_0x6e70('0x57')]=[{'all':!![]}];}_0x79653=_[_0x6e70('0x53')]({},_0x79653,_0x11ac3d['options']);return db[_0x6e70('0x40')][_0x6e70('0x5b')](_0x79653)['then'](handleEntityNotFound(_0x22abc1,null))[_0x6e70('0x3a')](respondWithResult(_0x22abc1,null))[_0x6e70('0x2e')](handleError(_0x22abc1,null));};exports['create']=function(_0x3cfaa9,_0xb3f06c){return db[_0x6e70('0x40')][_0x6e70('0x5c')](_0x3cfaa9[_0x6e70('0x5d')],{})['then'](respondWithResult(_0xb3f06c,0xc9))[_0x6e70('0x2e')](handleError(_0xb3f06c,null));};exports[_0x6e70('0x38')]=function(_0x10d655,_0x13be81){if(_0x10d655[_0x6e70('0x5d')]['id']){delete _0x10d655[_0x6e70('0x5d')]['id'];}return db[_0x6e70('0x40')][_0x6e70('0x5b')]({'where':{'id':_0x10d655[_0x6e70('0x5a')]['id']}})[_0x6e70('0x3a')](handleEntityNotFound(_0x13be81,null))[_0x6e70('0x3a')](saveUpdates(_0x10d655[_0x6e70('0x5d')],null))[_0x6e70('0x3a')](respondWithResult(_0x13be81,null))[_0x6e70('0x2e')](handleError(_0x13be81,null));};exports[_0x6e70('0x39')]=function(_0x2240a1,_0x324fa6){return db[_0x6e70('0x40')][_0x6e70('0x5b')]({'where':{'id':_0x2240a1[_0x6e70('0x5a')]['id']}})['then'](handleEntityNotFound(_0x324fa6,null))[_0x6e70('0x3a')](removeEntity(_0x324fa6,null))[_0x6e70('0x2e')](handleError(_0x324fa6,null));};exports[_0x6e70('0x5e')]=function(_0xeeab6e,_0x36757e){return db[_0x6e70('0x40')]['describe']()[_0x6e70('0x3a')](respondWithResult(_0x36757e,null))[_0x6e70('0x2e')](handleError(_0x36757e,null));};var interaction_log=require('../../config/logger')(_0x6e70('0x5f'));exports[_0x6e70('0x60')]=function(_0x459a30,_0x590f7f,_0x51f268){var _0x2f9be4={'channel':_0x6e70('0x61')};if(_0x459a30[_0x6e70('0x5d')]['id']){delete _0x459a30[_0x6e70('0x5d')]['id'];}_0x459a30[_0x6e70('0x5d')][_0x6e70('0x62')]=!![];_0x459a30[_0x6e70('0x5d')]['readAt']=moment()['format'](_0x6e70('0x63'));_0x459a30[_0x6e70('0x5d')][_0x6e70('0x64')]=_0x459a30[_0x6e70('0x5d')]['UserId']||_0x459a30['user']['id'];return db[_0x6e70('0x40')][_0x6e70('0x5b')]({'where':{'id':_0x459a30['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6e70('0x65')}]})['then'](handleEntityNotFound(_0x590f7f,null))[_0x6e70('0x3a')](saveUpdates(_0x459a30[_0x6e70('0x5d')],null))[_0x6e70('0x3a')](function(_0x2f3626){if(_0x2f3626){_0x2f9be4[_0x6e70('0x2d')]=_0x2f3626[_0x6e70('0x66')]({'plain':!![]});return db[_0x6e70('0x67')][_0x6e70('0x5b')]({'where':{'id':_0x2f3626['ChatInteractionId']}});}return null;})[_0x6e70('0x3a')](handleEntityNotFound(_0x590f7f,null))[_0x6e70('0x3a')](function(_0x22c836){if(_0x22c836){return _0x22c836[_0x6e70('0x38')]({'UserId':_0x459a30[_0x6e70('0x5d')]['UserId'],'read1stAt':_['isNil'](_0x22c836['read1stAt'])?moment()[_0x6e70('0x68')](_0x6e70('0x63')):undefined});}return null;})[_0x6e70('0x3a')](function(_0x4ed5ad){if(_0x4ed5ad){_0x2f9be4['interaction']=_0x4ed5ad[_0x6e70('0x66')]({'plain':!![]});interaction_log[_0x6e70('0x25')](_0x6e70('0x69'),_0x459a30[_0x6e70('0x6a')]['id'],_0x459a30[_0x6e70('0x6a')][_0x6e70('0x3d')],_0x459a30['user'][_0x6e70('0x6b')],_0x2f9be4[_0x6e70('0x6c')]['id'],_0x459a30[_0x6e70('0x5d')]?JSON[_0x6e70('0x29')](_0x459a30['body']):_0x6e70('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2f9be4);}return null;})[_0x6e70('0x3a')](function(_0x3249a5){if(_0x3249a5){if(_0x459a30[_0x6e70('0x5d')][_0x6e70('0x6e')]){_0x2f9be4[_0x6e70('0x2d')][_0x6e70('0x6f')]=util['format'](_0x6e70('0x70'),_0x459a30[_0x6e70('0x6a')][_0x6e70('0x3d')]);_0x2f9be4[_0x6e70('0x2d')][_0x6e70('0x71')]=_0x2f9be4[_0x6e70('0x71')];_0x2f9be4[_0x6e70('0x2d')][_0x6e70('0x72')]=_0x6e70('0x60');return respondWithRpcPromise(_0x6e70('0x73'),'EventManager',{'event':_0x6e70('0x74'),'message':_[_0x6e70('0x53')](_0x2f9be4[_0x6e70('0x2d')],JSON['parse'](_0x2f9be4['interaction'][_0x6e70('0x75')]))},client9002)[_0x6e70('0x3a')](function(){return _0x2f9be4;});}return _0x2f9be4;}return null;})[_0x6e70('0x3a')](respondWithResult(_0x590f7f,null))[_0x6e70('0x2e')](handleError(_0x590f7f,null));};var interaction_log=require(_0x6e70('0x19'))('chat-interactions');exports['reject']=function(_0xe0073f,_0x241a21,_0x56d4d9){var _0x58666a={'agent':{},'channel':_0x6e70('0x61')};if(_0xe0073f[_0x6e70('0x5d')]['id']){delete _0xe0073f[_0x6e70('0x5d')]['id'];}_0xe0073f[_0x6e70('0x5d')][_0x6e70('0x64')]=_0xe0073f[_0x6e70('0x5d')][_0x6e70('0x64')]||_0xe0073f[_0x6e70('0x6a')]['id'];_0x58666a[_0x6e70('0x76')]['id']=_0xe0073f[_0x6e70('0x5d')][_0x6e70('0x64')];return db[_0x6e70('0x40')][_0x6e70('0x5b')]({'where':{'id':_0xe0073f['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x241a21,null))[_0x6e70('0x3a')](function(_0x4be7e4){if(_0x4be7e4){_0x58666a[_0x6e70('0x2d')]=_0x4be7e4['get']({'plain':!![]});return db['ChatInteraction'][_0x6e70('0x5b')]({'where':{'id':_0x4be7e4['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x241a21,null))[_0x6e70('0x3a')](function(_0x21e4c2){if(_0x21e4c2){_0x58666a[_0x6e70('0x6c')]=_0x21e4c2['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe0073f[_0x6e70('0x6a')]['id'],_0xe0073f['user'][_0x6e70('0x3d')],_0xe0073f[_0x6e70('0x6a')][_0x6e70('0x6b')],_0x58666a[_0x6e70('0x6c')]['id'],_0xe0073f[_0x6e70('0x5d')]?JSON[_0x6e70('0x29')](_0xe0073f[_0x6e70('0x5d')]):'null');return respondWithRpcPromise(_0x6e70('0x77'),_0x6e70('0x78'),_0x58666a);}return null;})[_0x6e70('0x3a')](function(_0x551904){if(_0x551904){_0x551904[_0x6e70('0x2d')][_0x6e70('0x6f')]=util[_0x6e70('0x68')](_0x6e70('0x70'),_0xe0073f[_0x6e70('0x6a')][_0x6e70('0x3d')]);_0x551904[_0x6e70('0x2d')][_0x6e70('0x71')]=_0x58666a[_0x6e70('0x71')];_0x551904['message'][_0x6e70('0x72')]=_0x6e70('0x79');respondWithRpcPromise('EventManager',_0x6e70('0x73'),{'event':_0x6e70('0x7a'),'message':_0x551904['message']},client9002);return _0x58666a;}return null;})['then'](respondWithResult(_0x241a21,null))[_0x6e70('0x2e')](handleError(_0x241a21,null));}; \ No newline at end of file +var _0xf4eb=['to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','status','count','offset','limit','set','Content-Range','json','apply','save','then','end','stack','index','map','ChatMessage','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','../../config/logger','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','user','role','stringify','AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','parse','formData','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','request-promise','mustache','util','path','sox'];(function(_0x18b10b,_0x58c327){var _0x5f5cd7=function(_0x5eeae9){while(--_0x5eeae9){_0x18b10b['push'](_0x18b10b['shift']());}};_0x5f5cd7(++_0x58c327);}(_0xf4eb,0xec));var _0xbf4e=function(_0x26e921,_0x55a045){_0x26e921=_0x26e921-0x0;var _0x2a5312=_0xf4eb[_0x26e921];return _0x2a5312;};'use strict';var pdf=require(_0xbf4e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf4e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf4e('0x2'));var util=require(_0xbf4e('0x3'));var path=require(_0xbf4e('0x4'));var sox=require(_0xbf4e('0x5'));var csv=require(_0xbf4e('0x6'));var ejs=require(_0xbf4e('0x7'));var fs=require('fs');var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x6'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];config[_0xbf4e('0x13')]=_['defaults'](config['redis'],{'host':_0xbf4e('0x14'),'port':0x18eb});var socket=require(_0xbf4e('0x15'))(new Redis(config[_0xbf4e('0x13')]));require(_0xbf4e('0x16'))[_0xbf4e('0x17')](socket);var jayson=require(_0xbf4e('0x18'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbf4e('0x19')][_0xbf4e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x28fc6b,_0x542909,_0x14110b,_0x2c292c){return new BPromise(function(_0x912fc0,_0x320e7d){var _0x5a631e=_0x2c292c||client;return _0x5a631e[_0xbf4e('0x1b')](_0x28fc6b,_0x14110b)['then'](function(_0x5db03f){logger['info']('ChatMessage,\x20%s,\x20%s',_0x542909,_0xbf4e('0x1c'));logger[_0xbf4e('0x1d')](_0xbf4e('0x1e'),_0x542909,'request\x20sent',JSON['stringify'](_0x5db03f));if(_0x5db03f[_0xbf4e('0x1f')]){if(_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x20')]===0x1f4){logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x22')]);return _0x320e7d(_0x5db03f[_0xbf4e('0x1f')][_0xbf4e('0x22')]);}logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x5db03f['error'][_0xbf4e('0x22')]);return _0x912fc0(_0x5db03f[_0xbf4e('0x1f')]['message']);}else{logger[_0xbf4e('0x23')](_0xbf4e('0x21'),_0x542909,_0xbf4e('0x1c'));_0x912fc0(_0x5db03f[_0xbf4e('0x24')][_0xbf4e('0x22')]);}})['catch'](function(_0x90635e){logger[_0xbf4e('0x1f')](_0xbf4e('0x21'),_0x542909,_0x90635e);_0x320e7d(_0x90635e);});});}function respondWithStatusCode(_0x5766d4,_0x2fb490){_0x2fb490=_0x2fb490||0xcc;return function(_0x5e08b1){if(_0x5e08b1){return _0x5766d4['sendStatus'](_0x2fb490);}return _0x5766d4[_0xbf4e('0x25')](_0x2fb490)['end']();};}function respondWithResult(_0x38c923,_0x315df3){_0x315df3=_0x315df3||0xc8;return function(_0x4021a9){if(_0x4021a9){return _0x38c923[_0xbf4e('0x25')](_0x315df3)['json'](_0x4021a9);}};}function respondWithFilteredResult(_0x2d4686,_0x8e0ab5){return function(_0x43879d){if(_0x43879d){var _0x4cd4a1=_0x43879d[_0xbf4e('0x26')],_0x681c3b=_0x8e0ab5[_0xbf4e('0x27')],_0x590c85=_0x8e0ab5['offset']+_0x8e0ab5[_0xbf4e('0x28')],_0x1dfa81;if(_0x590c85>=_0x4cd4a1){_0x590c85=_0x4cd4a1;_0x1dfa81=0xc8;}else{_0x1dfa81=0xce;}_0x2d4686[_0xbf4e('0x25')](_0x1dfa81);return _0x2d4686[_0xbf4e('0x29')](_0xbf4e('0x2a'),_0x681c3b+'-'+_0x590c85+'/'+_0x4cd4a1)[_0xbf4e('0x2b')](_0x43879d);}return null;};}function patchUpdates(_0x3b5776){return function(_0x5a7c71){try{jsonpatch[_0xbf4e('0x2c')](_0x5a7c71,_0x3b5776,!![]);}catch(_0x154576){return BPromise['reject'](_0x154576);}return _0x5a7c71[_0xbf4e('0x2d')]();};}function saveUpdates(_0x26a375,_0x5473ed){return function(_0x23d769){if(_0x23d769){return _0x23d769['update'](_0x26a375)[_0xbf4e('0x2e')](function(_0x59b161){return _0x59b161;});}return null;};}function removeEntity(_0x2f49d8,_0x2f5a2b){return function(_0x83e0ef){if(_0x83e0ef){return _0x83e0ef['destroy']()[_0xbf4e('0x2e')](function(){_0x2f49d8[_0xbf4e('0x25')](0xcc)[_0xbf4e('0x2f')]();});}};}function handleEntityNotFound(_0x29d6aa,_0xb93672){return function(_0x477873){if(!_0x477873){_0x29d6aa['sendStatus'](0x194);}return _0x477873;};}function handleError(_0x99b320,_0x3dbb2b){_0x3dbb2b=_0x3dbb2b||0x1f4;return function(_0x25b837){logger[_0xbf4e('0x1f')](_0x25b837[_0xbf4e('0x30')]);if(_0x25b837['name']){delete _0x25b837['name'];}_0x99b320['status'](_0x3dbb2b)['send'](_0x25b837);};}exports[_0xbf4e('0x31')]=function(_0x17a1a1,_0x91b52f){var _0x2693ba={},_0x22ddde={},_0x257b74={'count':0x0,'rows':[]};var _0x355b42=_[_0xbf4e('0x32')](db[_0xbf4e('0x33')]['rawAttributes'],function(_0x4f6e93){return{'name':_0x4f6e93[_0xbf4e('0x34')],'type':_0x4f6e93[_0xbf4e('0x35')][_0xbf4e('0x36')]};});_0x22ddde['model']=_[_0xbf4e('0x32')](_0x355b42,'name');_0x22ddde[_0xbf4e('0x37')]=_[_0xbf4e('0x38')](_0x17a1a1[_0xbf4e('0x37')]);_0x22ddde[_0xbf4e('0x39')]=_['intersection'](_0x22ddde[_0xbf4e('0x3a')],_0x22ddde[_0xbf4e('0x37')]);_0x2693ba[_0xbf4e('0x3b')]=_[_0xbf4e('0x3c')](_0x22ddde['model'],qs[_0xbf4e('0x3d')](_0x17a1a1[_0xbf4e('0x37')][_0xbf4e('0x3d')]));_0x2693ba[_0xbf4e('0x3b')]=_0x2693ba[_0xbf4e('0x3b')][_0xbf4e('0x3e')]?_0x2693ba[_0xbf4e('0x3b')]:_0x22ddde['model'];if(!_0x17a1a1[_0xbf4e('0x37')][_0xbf4e('0x3f')]('nolimit')){_0x2693ba['limit']=qs[_0xbf4e('0x28')](_0x17a1a1[_0xbf4e('0x37')]['limit']);_0x2693ba['offset']=qs[_0xbf4e('0x27')](_0x17a1a1[_0xbf4e('0x37')][_0xbf4e('0x27')]);}_0x2693ba[_0xbf4e('0x40')]=qs[_0xbf4e('0x41')](_0x17a1a1[_0xbf4e('0x37')]['sort']);_0x2693ba[_0xbf4e('0x42')]=qs[_0xbf4e('0x39')](_['pick'](_0x17a1a1['query'],_0x22ddde['filters']),_0x355b42);if(_0x17a1a1['query'][_0xbf4e('0x43')]){_0x2693ba['where']=_[_0xbf4e('0x44')](_0x2693ba[_0xbf4e('0x42')],{'$or':_['map'](_0x355b42,function(_0x5cd134){if(_0x5cd134[_0xbf4e('0x35')]!==_0xbf4e('0x45')){var _0x46967c={};_0x46967c[_0x5cd134[_0xbf4e('0x46')]]={'$like':'%'+_0x17a1a1[_0xbf4e('0x37')]['filter']+'%'};return _0x46967c;}})});}_0x2693ba=_[_0xbf4e('0x44')]({},_0x2693ba,_0x17a1a1[_0xbf4e('0x47')]);var _0xd3a88a={'where':_0x2693ba[_0xbf4e('0x42')]};return db[_0xbf4e('0x33')][_0xbf4e('0x26')](_0xd3a88a)[_0xbf4e('0x2e')](function(_0x33f5ea){_0x257b74['count']=_0x33f5ea;if(_0x17a1a1[_0xbf4e('0x37')][_0xbf4e('0x48')]){_0x2693ba[_0xbf4e('0x49')]=[{'all':!![]}];}return db[_0xbf4e('0x33')][_0xbf4e('0x4a')](_0x2693ba);})[_0xbf4e('0x2e')](function(_0x1fce91){_0x257b74[_0xbf4e('0x4b')]=_0x1fce91;return _0x257b74;})[_0xbf4e('0x2e')](respondWithFilteredResult(_0x91b52f,_0x2693ba))[_0xbf4e('0x4c')](handleError(_0x91b52f,null));};exports[_0xbf4e('0x4d')]=function(_0x6fd78d,_0x370d4c){var _0x2ea101={'raw':!![],'where':{'id':_0x6fd78d[_0xbf4e('0x4e')]['id']}},_0x24fb7d={};_0x24fb7d[_0xbf4e('0x3a')]=_['keys'](db[_0xbf4e('0x33')][_0xbf4e('0x4f')]);_0x24fb7d[_0xbf4e('0x37')]=_['keys'](_0x6fd78d[_0xbf4e('0x37')]);_0x24fb7d['filtears']=_['intersection'](_0x24fb7d[_0xbf4e('0x3a')],_0x24fb7d[_0xbf4e('0x37')]);_0x2ea101['attributes']=_[_0xbf4e('0x3c')](_0x24fb7d[_0xbf4e('0x3a')],qs[_0xbf4e('0x3d')](_0x6fd78d[_0xbf4e('0x37')][_0xbf4e('0x3d')]));_0x2ea101[_0xbf4e('0x3b')]=_0x2ea101[_0xbf4e('0x3b')][_0xbf4e('0x3e')]?_0x2ea101[_0xbf4e('0x3b')]:_0x24fb7d[_0xbf4e('0x3a')];if(_0x6fd78d[_0xbf4e('0x37')]['includeAll']){_0x2ea101['include']=[{'all':!![]}];}_0x2ea101=_[_0xbf4e('0x44')]({},_0x2ea101,_0x6fd78d[_0xbf4e('0x47')]);return db[_0xbf4e('0x33')]['find'](_0x2ea101)[_0xbf4e('0x2e')](handleEntityNotFound(_0x370d4c,null))[_0xbf4e('0x2e')](respondWithResult(_0x370d4c,null))['catch'](handleError(_0x370d4c,null));};exports['create']=function(_0x36a87d,_0x51f212){return db['ChatMessage'][_0xbf4e('0x50')](_0x36a87d[_0xbf4e('0x51')],{})[_0xbf4e('0x2e')](respondWithResult(_0x51f212,0xc9))[_0xbf4e('0x4c')](handleError(_0x51f212,null));};exports[_0xbf4e('0x52')]=function(_0x5ec2d9,_0x242a75){if(_0x5ec2d9['body']['id']){delete _0x5ec2d9[_0xbf4e('0x51')]['id'];}return db['ChatMessage'][_0xbf4e('0x53')]({'where':{'id':_0x5ec2d9['params']['id']}})[_0xbf4e('0x2e')](handleEntityNotFound(_0x242a75,null))[_0xbf4e('0x2e')](saveUpdates(_0x5ec2d9[_0xbf4e('0x51')],null))[_0xbf4e('0x2e')](respondWithResult(_0x242a75,null))[_0xbf4e('0x4c')](handleError(_0x242a75,null));};exports['destroy']=function(_0x55a17d,_0x5a0f4a){return db['ChatMessage'][_0xbf4e('0x53')]({'where':{'id':_0x55a17d[_0xbf4e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a0f4a,null))[_0xbf4e('0x2e')](removeEntity(_0x5a0f4a,null))[_0xbf4e('0x4c')](handleError(_0x5a0f4a,null));};exports[_0xbf4e('0x54')]=function(_0x20e913,_0x17c2e1){return db[_0xbf4e('0x33')][_0xbf4e('0x54')]()['then'](respondWithResult(_0x17c2e1,null))[_0xbf4e('0x4c')](handleError(_0x17c2e1,null));};var interaction_log=require(_0xbf4e('0x55'))(_0xbf4e('0x56'));exports['accept']=function(_0x56338e,_0x64d8ea,_0x301d66){var _0x2e8a62={'channel':'chat'};if(_0x56338e[_0xbf4e('0x51')]['id']){delete _0x56338e[_0xbf4e('0x51')]['id'];}_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x57')]=!![];_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x58')]=moment()[_0xbf4e('0x59')](_0xbf4e('0x5a'));_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x5b')]=_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x5b')]||_0x56338e['user']['id'];return db[_0xbf4e('0x33')]['find']({'where':{'id':_0x56338e[_0xbf4e('0x4e')]['id'],'UserId':null},'include':[{'model':db[_0xbf4e('0x5c')],'as':_0xbf4e('0x5d')}]})[_0xbf4e('0x2e')](handleEntityNotFound(_0x64d8ea,null))[_0xbf4e('0x2e')](saveUpdates(_0x56338e[_0xbf4e('0x51')],null))[_0xbf4e('0x2e')](function(_0x1149c2){if(_0x1149c2){_0x2e8a62['message']=_0x1149c2[_0xbf4e('0x5e')]({'plain':!![]});return db[_0xbf4e('0x5f')][_0xbf4e('0x53')]({'where':{'id':_0x1149c2[_0xbf4e('0x60')]}});}return null;})[_0xbf4e('0x2e')](handleEntityNotFound(_0x64d8ea,null))['then'](function(_0x9492a3){if(_0x9492a3){return _0x9492a3[_0xbf4e('0x52')]({'UserId':_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x5b')],'read1stAt':_[_0xbf4e('0x61')](_0x9492a3[_0xbf4e('0x62')])?moment()['format'](_0xbf4e('0x5a')):undefined});}return null;})['then'](function(_0x21d6e3){if(_0x21d6e3){_0x2e8a62[_0xbf4e('0x63')]=_0x21d6e3[_0xbf4e('0x5e')]({'plain':!![]});interaction_log[_0xbf4e('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x56338e[_0xbf4e('0x64')]['id'],_0x56338e['user']['name'],_0x56338e[_0xbf4e('0x64')][_0xbf4e('0x65')],_0x2e8a62[_0xbf4e('0x63')]['id'],_0x56338e['body']?JSON[_0xbf4e('0x66')](_0x56338e[_0xbf4e('0x51')]):'null');return respondWithRpcPromise(_0xbf4e('0x67'),_0xbf4e('0x68'),_0x2e8a62);}return null;})[_0xbf4e('0x2e')](function(_0x137224){if(_0x137224){if(_0x56338e[_0xbf4e('0x51')][_0xbf4e('0x69')]){_0x2e8a62[_0xbf4e('0x22')][_0xbf4e('0x6a')]=util[_0xbf4e('0x59')]('SIP/%s',_0x56338e[_0xbf4e('0x64')][_0xbf4e('0x46')]);_0x2e8a62[_0xbf4e('0x22')][_0xbf4e('0x6b')]=_0x2e8a62['channel'];_0x2e8a62[_0xbf4e('0x22')][_0xbf4e('0x6c')]=_0xbf4e('0x6d');return respondWithRpcPromise(_0xbf4e('0x6e'),_0xbf4e('0x6e'),{'event':_0xbf4e('0x6f'),'message':_[_0xbf4e('0x44')](_0x2e8a62[_0xbf4e('0x22')],JSON[_0xbf4e('0x70')](_0x2e8a62['interaction'][_0xbf4e('0x71')]))},client9002)['then'](function(){return _0x2e8a62;});}return _0x2e8a62;}return null;})[_0xbf4e('0x2e')](respondWithResult(_0x64d8ea,null))[_0xbf4e('0x4c')](handleError(_0x64d8ea,null));};var interaction_log=require(_0xbf4e('0x55'))(_0xbf4e('0x56'));exports[_0xbf4e('0x72')]=function(_0x4db6d7,_0x276dd8,_0x129f43){var _0x16dd5f={'agent':{},'channel':'chat'};if(_0x4db6d7[_0xbf4e('0x51')]['id']){delete _0x4db6d7[_0xbf4e('0x51')]['id'];}_0x4db6d7[_0xbf4e('0x51')]['UserId']=_0x4db6d7[_0xbf4e('0x51')][_0xbf4e('0x5b')]||_0x4db6d7[_0xbf4e('0x64')]['id'];_0x16dd5f[_0xbf4e('0x73')]['id']=_0x4db6d7[_0xbf4e('0x51')]['UserId'];return db[_0xbf4e('0x33')]['find']({'where':{'id':_0x4db6d7[_0xbf4e('0x4e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x276dd8,null))[_0xbf4e('0x2e')](function(_0x5d0856){if(_0x5d0856){_0x16dd5f[_0xbf4e('0x22')]=_0x5d0856['get']({'plain':!![]});return db[_0xbf4e('0x5f')][_0xbf4e('0x53')]({'where':{'id':_0x5d0856[_0xbf4e('0x60')]}});}return null;})[_0xbf4e('0x2e')](handleEntityNotFound(_0x276dd8,null))[_0xbf4e('0x2e')](function(_0xea3331){if(_0xea3331){_0x16dd5f[_0xbf4e('0x63')]=_0xea3331['get']({'plain':!![]});interaction_log[_0xbf4e('0x23')](_0xbf4e('0x74'),_0x4db6d7[_0xbf4e('0x64')]['id'],_0x4db6d7[_0xbf4e('0x64')][_0xbf4e('0x46')],_0x4db6d7[_0xbf4e('0x64')]['role'],_0x16dd5f[_0xbf4e('0x63')]['id'],_0x4db6d7[_0xbf4e('0x51')]?JSON['stringify'](_0x4db6d7[_0xbf4e('0x51')]):_0xbf4e('0x75'));return respondWithRpcPromise(_0xbf4e('0x76'),_0xbf4e('0x77'),_0x16dd5f);}return null;})[_0xbf4e('0x2e')](function(_0x3c5d85){if(_0x3c5d85){_0x3c5d85[_0xbf4e('0x22')][_0xbf4e('0x6a')]=util[_0xbf4e('0x59')]('SIP/%s',_0x4db6d7[_0xbf4e('0x64')][_0xbf4e('0x46')]);_0x3c5d85[_0xbf4e('0x22')]['channel']=_0x16dd5f[_0xbf4e('0x6b')];_0x3c5d85[_0xbf4e('0x22')]['event']=_0xbf4e('0x72');respondWithRpcPromise(_0xbf4e('0x6e'),_0xbf4e('0x6e'),{'event':_0xbf4e('0x78'),'message':_0x3c5d85[_0xbf4e('0x22')]},client9002);return _0x16dd5f;}return null;})[_0xbf4e('0x2e')](respondWithResult(_0x276dd8,null))[_0xbf4e('0x4c')](handleError(_0x276dd8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2c37e9d..de4ca0e 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 _0x0cc9=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x412637,_0x3e4f50){var _0x5aef89=function(_0x4d3f88){while(--_0x4d3f88){_0x412637['push'](_0x412637['shift']());}};_0x5aef89(++_0x3e4f50);}(_0x0cc9,0x1f4));var _0x90cc=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x0cc9[_0x3da832];return _0xe602f2;};'use strict';var EventEmitter=require(_0x90cc('0x0'));var ChatMessage=require(_0x90cc('0x1'))['db'][_0x90cc('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x90cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90cc('0x4'),'afterDestroy':_0x90cc('0x5')};function emitEvent(_0x2db34e){return function(_0x4800e4,_0x4d2277,_0x27dbaa){ChatMessageEvents[_0x90cc('0x6')](_0x2db34e+':'+_0x4800e4['id'],_0x4800e4);ChatMessageEvents[_0x90cc('0x6')](_0x2db34e,_0x4800e4);_0x27dbaa(null);};}for(var e in events){if(events[_0x90cc('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x90cc('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x4e2b=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x462023,_0x19e19e){var _0x597ede=function(_0x402712){while(--_0x402712){_0x462023['push'](_0x462023['shift']());}};_0x597ede(++_0x19e19e);}(_0x4e2b,0x102));var _0xb4e2=function(_0x232d2d,_0x364acc){_0x232d2d=_0x232d2d-0x0;var _0x1f80f5=_0x4e2b[_0x232d2d];return _0x1f80f5;};'use strict';var EventEmitter=require(_0xb4e2('0x0'));var ChatMessage=require(_0xb4e2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb4e2('0x2')](0x0);var events={'afterCreate':_0xb4e2('0x3'),'afterUpdate':_0xb4e2('0x4'),'afterDestroy':_0xb4e2('0x5')};function emitEvent(_0x4ab5a4){return function(_0x47a823,_0x34933f,_0x555951){ChatMessageEvents['emit'](_0x4ab5a4+':'+_0x47a823['id'],_0x47a823);ChatMessageEvents[_0xb4e2('0x6')](_0x4ab5a4,_0x47a823);_0x555951(null);};}for(var e in events){if(events[_0xb4e2('0x7')](e)){var event=events[e];ChatMessage[_0xb4e2('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3669f92..75e7292 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 _0x4d7e=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','chat_messages','fti_chat_messages','body','models','get','direction','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x289241,_0x3550bd){var _0x400dcf=function(_0x3d8b84){while(--_0x3d8b84){_0x289241['push'](_0x289241['shift']());}};_0x400dcf(++_0x3550bd);}(_0x4d7e,0x19d));var _0xe4d7=function(_0x225116,_0x5cafec){_0x225116=_0x225116-0x0;var _0x5c66a5=_0x4d7e[_0x225116];return _0x5c66a5;};'use strict';var _=require(_0xe4d7('0x0'));var util=require(_0xe4d7('0x1'));var logger=require(_0xe4d7('0x2'))(_0xe4d7('0x3'));var moment=require('moment');var BPromise=require(_0xe4d7('0x4'));var rp=require(_0xe4d7('0x5'));var fs=require('fs');var path=require(_0xe4d7('0x6'));var rimraf=require(_0xe4d7('0x7'));var config=require(_0xe4d7('0x8'));var attributes=require(_0xe4d7('0x9'));module['exports']=function(_0x306a1a,_0x502fcc){return _0x306a1a['define']('ChatMessage',attributes,{'tableName':_0xe4d7('0xa'),'paranoid':![],'indexes':[{'name':_0xe4d7('0xb'),'fields':[_0xe4d7('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24e8ff,_0x1c8aa8,_0x53067d){var _0xc6c834=_0x306a1a[_0xe4d7('0xd')];var _0x4842e5=_0x24e8ff[_0xe4d7('0xe')]({'plain':!![]});if(_0x4842e5['direction']['toLowerCase']()==='in'||_0x4842e5[_0xe4d7('0xf')]['toLowerCase']()==='out'&&!_0x4842e5[_0xe4d7('0x10')]&&!_[_0xe4d7('0x11')](_0x4842e5[_0xe4d7('0x12')])){_0xc6c834[_0xe4d7('0x13')]['findOne']({'where':{'id':_0x4842e5[_0xe4d7('0x14')]}})[_0xe4d7('0x15')](function(_0x676316){if(_0x676316){_0x676316['update']({'lastMsgAt':_0x4842e5[_0xe4d7('0x16')],'lastMsgDirection':_0x4842e5[_0xe4d7('0xf')]['toLowerCase']()});}})[_0xe4d7('0x17')](function(_0x261343){console[_0xe4d7('0x18')](_0x261343);});}_0x53067d();}},'charset':'utf8mb4','collate':_0xe4d7('0x19')});}; \ No newline at end of file +var _0xd939=['direction','out','secret','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','path','rimraf','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','FULLTEXT','models','toLowerCase'];(function(_0x2d8276,_0x37456f){var _0x1a6c67=function(_0x200682){while(--_0x200682){_0x2d8276['push'](_0x2d8276['shift']());}};_0x1a6c67(++_0x37456f);}(_0xd939,0x93));var _0x9d93=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0xd939[_0x3c04ef];return _0x6a3a69;};'use strict';var _=require(_0x9d93('0x0'));var util=require(_0x9d93('0x1'));var logger=require(_0x9d93('0x2'))(_0x9d93('0x3'));var moment=require(_0x9d93('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d93('0x5'));var rimraf=require(_0x9d93('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d93('0x7'));module[_0x9d93('0x8')]=function(_0x3b2f01,_0x54b950){return _0x3b2f01['define'](_0x9d93('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9d93('0xa'),'fields':[_0x9d93('0xb')],'type':_0x9d93('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdc2393,_0x185109,_0x333565){var _0x50a8c8=_0x3b2f01[_0x9d93('0xd')];var _0x57f259=_0xdc2393['get']({'plain':!![]});if(_0x57f259['direction'][_0x9d93('0xe')]()==='in'||_0x57f259[_0x9d93('0xf')][_0x9d93('0xe')]()===_0x9d93('0x10')&&!_0x57f259[_0x9d93('0x11')]&&!_['isNil'](_0x57f259['UserId'])){_0x50a8c8[_0x9d93('0x12')][_0x9d93('0x13')]({'where':{'id':_0x57f259[_0x9d93('0x14')]}})[_0x9d93('0x15')](function(_0x46b9d8){if(_0x46b9d8){_0x46b9d8[_0x9d93('0x16')]({'lastMsgAt':_0x57f259[_0x9d93('0x17')],'lastMsgDirection':_0x57f259[_0x9d93('0xf')][_0x9d93('0xe')]()});}})[_0x9d93('0x18')](function(_0x16dfb3){console[_0x9d93('0x19')](_0x16dfb3);});}_0x333565();}},'charset':_0x9d93('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c513b1e..3179afb 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 _0xd4af=['../../config/environment','client','http','redis','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','CreateChatMessage','ChatMessage','create','body','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4af,0x14a));var _0xfd4a=function(_0x1fc38d,_0x1e6483){_0x1fc38d=_0x1fc38d-0x0;var _0x32d386=_0xd4af[_0x1fc38d];return _0x32d386;};'use strict';var _=require('lodash');var util=require(_0xfd4a('0x0'));var moment=require(_0xfd4a('0x1'));var BPromise=require(_0xfd4a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd4a('0x3'));var db=require(_0xfd4a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd4a('0x5'))('rpc');var config=require(_0xfd4a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfd4a('0x7')][_0xfd4a('0x8')]({'port':0x232a});config[_0xfd4a('0x9')]=_['defaults'](config['redis'],{'host':_0xfd4a('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd4a('0x9')]));require(_0xfd4a('0xb'))[_0xfd4a('0xc')](socket);function respondWithRpcPromise(_0x4aa7ed,_0x16b4f0,_0x5a0815){return new BPromise(function(_0x5b60ce,_0x2f2e99){return client[_0xfd4a('0xd')](_0x4aa7ed,_0x5a0815)[_0xfd4a('0xe')](function(_0x4b69c4){logger[_0xfd4a('0xf')](_0xfd4a('0x10'),_0x16b4f0,_0xfd4a('0x11'));logger[_0xfd4a('0x12')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x16b4f0,_0xfd4a('0x11'),JSON[_0xfd4a('0x13')](_0x4b69c4));if(_0x4b69c4[_0xfd4a('0x14')]){if(_0x4b69c4[_0xfd4a('0x14')]['code']===0x1f4){logger[_0xfd4a('0x14')](_0xfd4a('0x10'),_0x16b4f0,_0x4b69c4[_0xfd4a('0x14')][_0xfd4a('0x15')]);return _0x2f2e99(_0x4b69c4[_0xfd4a('0x14')][_0xfd4a('0x15')]);}logger['error'](_0xfd4a('0x10'),_0x16b4f0,_0x4b69c4[_0xfd4a('0x14')][_0xfd4a('0x15')]);return _0x5b60ce(_0x4b69c4[_0xfd4a('0x14')]['message']);}else{logger[_0xfd4a('0xf')]('ChatMessage,\x20%s,\x20%s',_0x16b4f0,_0xfd4a('0x11'));_0x5b60ce(_0x4b69c4[_0xfd4a('0x16')]['message']);}})['catch'](function(_0x4121ea){logger[_0xfd4a('0x14')](_0xfd4a('0x10'),_0x16b4f0,_0x4121ea);_0x2f2e99(_0x4121ea);});});}exports[_0xfd4a('0x17')]=function(_0x9770d2){var _0x1bd6fa=this;return new Promise(function(_0x3702a8,_0x5557fc){return db[_0xfd4a('0x18')][_0xfd4a('0x19')](_0x9770d2[_0xfd4a('0x1a')],{'raw':_0x9770d2[_0xfd4a('0x1b')]?_0x9770d2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5172bc){logger[_0xfd4a('0xf')](_0xfd4a('0x17'),_0x9770d2);logger[_0xfd4a('0x12')](_0xfd4a('0x17'),_0x9770d2,JSON['stringify'](_0x5172bc));_0x3702a8(_0x5172bc);})['catch'](function(_0x1d25f4){logger['error'](_0xfd4a('0x17'),_0x1d25f4['message'],_0x9770d2);_0x5557fc(_0x1bd6fa[_0xfd4a('0x14')](0x1f4,_0x1d25f4[_0xfd4a('0x15')]));});});}; \ No newline at end of file +var _0xf4a2=['./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','catch','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x18f129,_0x4db6b1){var _0x5de23d=function(_0x7f09a8){while(--_0x7f09a8){_0x18f129['push'](_0x18f129['shift']());}};_0x5de23d(++_0x4db6b1);}(_0xf4a2,0x78));var _0x2f4a=function(_0x59e862,_0x477bf2){_0x59e862=_0x59e862-0x0;var _0x1a25ee=_0xf4a2[_0x59e862];return _0x1a25ee;};'use strict';var _=require(_0x2f4a('0x0'));var util=require(_0x2f4a('0x1'));var moment=require(_0x2f4a('0x2'));var BPromise=require(_0x2f4a('0x3'));var rs=require(_0x2f4a('0x4'));var fs=require('fs');var Redis=require(_0x2f4a('0x5'));var db=require(_0x2f4a('0x6'))['db'];var utils=require(_0x2f4a('0x7'));var logger=require(_0x2f4a('0x8'))(_0x2f4a('0x9'));var config=require('../../config/environment');var jayson=require(_0x2f4a('0xa'));var client=jayson['client'][_0x2f4a('0xb')]({'port':0x232a});config[_0x2f4a('0xc')]=_[_0x2f4a('0xd')](config[_0x2f4a('0xc')],{'host':_0x2f4a('0xe'),'port':0x18eb});var socket=require(_0x2f4a('0xf'))(new Redis(config[_0x2f4a('0xc')]));require(_0x2f4a('0x10'))[_0x2f4a('0x11')](socket);function respondWithRpcPromise(_0x4a8813,_0x858831,_0x4918e3){return new BPromise(function(_0x1f1bdb,_0xf2dc09){return client['request'](_0x4a8813,_0x4918e3)[_0x2f4a('0x12')](function(_0x3d086a){logger[_0x2f4a('0x13')](_0x2f4a('0x14'),_0x858831,_0x2f4a('0x15'));logger[_0x2f4a('0x16')](_0x2f4a('0x17'),_0x858831,_0x2f4a('0x15'),JSON['stringify'](_0x3d086a));if(_0x3d086a[_0x2f4a('0x18')]){if(_0x3d086a[_0x2f4a('0x18')]['code']===0x1f4){logger[_0x2f4a('0x18')]('ChatMessage,\x20%s,\x20%s',_0x858831,_0x3d086a['error'][_0x2f4a('0x19')]);return _0xf2dc09(_0x3d086a[_0x2f4a('0x18')]['message']);}logger[_0x2f4a('0x18')](_0x2f4a('0x14'),_0x858831,_0x3d086a['error'][_0x2f4a('0x19')]);return _0x1f1bdb(_0x3d086a[_0x2f4a('0x18')][_0x2f4a('0x19')]);}else{logger[_0x2f4a('0x13')](_0x2f4a('0x14'),_0x858831,_0x2f4a('0x15'));_0x1f1bdb(_0x3d086a['result'][_0x2f4a('0x19')]);}})[_0x2f4a('0x1a')](function(_0x1b47db){logger[_0x2f4a('0x18')](_0x2f4a('0x14'),_0x858831,_0x1b47db);_0xf2dc09(_0x1b47db);});});}exports[_0x2f4a('0x1b')]=function(_0x1616dd){var _0x4f3b3e=this;return new Promise(function(_0x2ca384,_0xd8267c){return db[_0x2f4a('0x1c')][_0x2f4a('0x1d')](_0x1616dd[_0x2f4a('0x1e')],{'raw':_0x1616dd[_0x2f4a('0x1f')]?_0x1616dd[_0x2f4a('0x1f')][_0x2f4a('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x44d901){logger[_0x2f4a('0x13')](_0x2f4a('0x1b'),_0x1616dd);logger[_0x2f4a('0x16')](_0x2f4a('0x1b'),_0x1616dd,JSON[_0x2f4a('0x21')](_0x44d901));_0x2ca384(_0x44d901);})['catch'](function(_0x204ce2){logger['error'](_0x2f4a('0x1b'),_0x204ce2['message'],_0x1616dd);_0xd8267c(_0x4f3b3e[_0x2f4a('0x18')](0x1f4,_0x204ce2[_0x2f4a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4a48e1f..79c369e 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 _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x3a3afe,_0x15da25){var _0x262dab=function(_0x364a7f){while(--_0x364a7f){_0x3a3afe['push'](_0x3a3afe['shift']());}};_0x262dab(++_0x15da25);}(_0xeda8,0x104));var _0x8eda=function(_0x3e8a76,_0x439c8b){_0x3e8a76=_0x3e8a76-0x0;var _0x2247fb=_0xeda8[_0x3e8a76];return _0x2247fb;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file +var _0xe2fe=['update','emit','register','length','./chatMessage.events'];(function(_0x3f051d,_0x1374bd){var _0x5ea733=function(_0x17515d){while(--_0x17515d){_0x3f051d['push'](_0x3f051d['shift']());}};_0x5ea733(++_0x1374bd);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var ChatMessageEvents=require(_0xee2f('0x0'));var events=['save','remove',_0xee2f('0x1')];function createListener(_0x5e18ae,_0x169cf9){return function(_0x1b6f4c){_0x169cf9[_0xee2f('0x2')](_0x5e18ae,_0x1b6f4c);};}function removeListener(_0x2d2b03,_0xcb45e6){return function(){ChatMessageEvents['removeListener'](_0x2d2b03,_0xcb45e6);};}exports[_0xee2f('0x3')]=function(_0x2b7e7c){for(var _0x49926b=0x0,_0x1533a0=events[_0xee2f('0x4')];_0x49926b<_0x1533a0;_0x49926b++){var _0x5a7975=events[_0x49926b];var _0x3c4095=createListener('chatMessage:'+_0x5a7975,_0x2b7e7c);ChatMessageEvents['on'](_0x5a7975,_0x3c4095);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 18ca3ad..7cd987a 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 _0x3858=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','post','tracked','chat','chatmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','path'];(function(_0x55e398,_0x4235c0){var _0x61dd9d=function(_0x58e832){while(--_0x58e832){_0x55e398['push'](_0x55e398['shift']());}};_0x61dd9d(++_0x4235c0);}(_0x3858,0xdf));var _0x8385=function(_0x1e9469,_0x1832db){_0x1e9469=_0x1e9469-0x0;var _0x4bf3bc=_0x3858[_0x1e9469];return _0x4bf3bc;};'use strict';var multer=require(_0x8385('0x0'));var util=require('util');var path=require(_0x8385('0x1'));var timeout=require(_0x8385('0x2'));var express=require(_0x8385('0x3'));var router=express['Router']();var auth=require(_0x8385('0x4'));var interaction=require(_0x8385('0x5'));var config=require(_0x8385('0x6'));var controller=require(_0x8385('0x7'));router[_0x8385('0x8')]('/',auth[_0x8385('0x9')](),controller[_0x8385('0xa')]);router[_0x8385('0x8')]('/describe',auth[_0x8385('0x9')](),controller[_0x8385('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8385('0xc')]('/',auth[_0x8385('0x9')](),interaction[_0x8385('0xd')](_0x8385('0xe'),_0x8385('0xf')),controller[_0x8385('0x10')]);router[_0x8385('0x11')](_0x8385('0x12'),controller[_0x8385('0x13')]);router[_0x8385('0x11')](_0x8385('0x14'),auth[_0x8385('0x9')](),controller[_0x8385('0x15')]);router[_0x8385('0x11')](_0x8385('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x8385('0x17')]('/:id',auth[_0x8385('0x9')](),controller[_0x8385('0x18')]);module['exports']=router; \ No newline at end of file +var _0x93c9=['/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','post','create','put','update','accept'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93c9,0x19d));var _0x993c=function(_0x2b11f2,_0x3ad743){_0x2b11f2=_0x2b11f2-0x0;var _0x1c7bac=_0x93c9[_0x2b11f2];return _0x1c7bac;};'use strict';var multer=require(_0x993c('0x0'));var util=require(_0x993c('0x1'));var path=require(_0x993c('0x2'));var timeout=require('connect-timeout');var express=require(_0x993c('0x3'));var router=express[_0x993c('0x4')]();var auth=require(_0x993c('0x5'));var interaction=require(_0x993c('0x6'));var config=require(_0x993c('0x7'));var controller=require(_0x993c('0x8'));router[_0x993c('0x9')]('/',auth[_0x993c('0xa')](),controller[_0x993c('0xb')]);router['get'](_0x993c('0xc'),auth[_0x993c('0xa')](),controller[_0x993c('0xd')]);router['get']('/:id',auth[_0x993c('0xa')](),controller['show']);router[_0x993c('0xe')]('/',auth[_0x993c('0xa')](),interaction['tracked']('chat','chatmessage:create'),controller[_0x993c('0xf')]);router[_0x993c('0x10')]('/:id',controller[_0x993c('0x11')]);router[_0x993c('0x10')]('/:id/accept',auth[_0x993c('0xa')](),controller[_0x993c('0x12')]);router['put'](_0x993c('0x13'),auth['isAuthenticated'](),controller[_0x993c('0x14')]);router[_0x993c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x993c('0x16')]);module[_0x993c('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 a743fe4..514b626 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 _0x25fa=['TEXT','sequelize'];(function(_0x9de10e,_0x16f3ec){var _0x256e2c=function(_0x2d312d){while(--_0x2d312d){_0x9de10e['push'](_0x9de10e['shift']());}};_0x256e2c(++_0x16f3ec);}(_0x25fa,0x1c1));var _0xa25f=function(_0x1b8b88,_0x124642){_0x1b8b88=_0x1b8b88-0x0;var _0xcf13c6=_0x25fa[_0x1b8b88];return _0xcf13c6;};'use strict';var Sequelize=require(_0xa25f('0x0'));module['exports']={'body':{'type':Sequelize[_0xa25f('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x4c50=['sequelize','TEXT','medium'];(function(_0x11bc87,_0x296cfe){var _0x375ac4=function(_0x1ecf86){while(--_0x1ecf86){_0x11bc87['push'](_0x11bc87['shift']());}};_0x375ac4(++_0x296cfe);}(_0x4c50,0xcf));var _0x04c5=function(_0x42876f,_0x138959){_0x42876f=_0x42876f-0x0;var _0x2f2606=_0x4c50[_0x42876f];return _0x2f2606;};'use strict';var Sequelize=require(_0x04c5('0x0'));module['exports']={'body':{'type':Sequelize[_0x04c5('0x1')](_0x04c5('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index cd6f555..c66e191 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 _0x0142=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','error','stack','name','index','ChatOfflineMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','filtears','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x0142,0x121));var _0x2014=function(_0x1c441b,_0x113389){_0x1c441b=_0x1c441b-0x0;var _0x50b12c=_0x0142[_0x1c441b];return _0x50b12c;};'use strict';var pdf=require(_0x2014('0x0'));var emlformat=require(_0x2014('0x1'));var rimraf=require(_0x2014('0x2'));var zipdir=require(_0x2014('0x3'));var jsonpatch=require(_0x2014('0x4'));var rp=require('request-promise');var moment=require(_0x2014('0x5'));var BPromise=require(_0x2014('0x6'));var Mustache=require(_0x2014('0x7'));var util=require(_0x2014('0x8'));var path=require(_0x2014('0x9'));var sox=require(_0x2014('0xa'));var csv=require(_0x2014('0xb'));var ejs=require(_0x2014('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2014('0xd'));var crypto=require(_0x2014('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2014('0xf'));var toCsv=require(_0x2014('0xb'));var querystring=require(_0x2014('0x10'));var Papa=require(_0x2014('0x11'));var Redis=require('ioredis');var authService=require(_0x2014('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2014('0x13'));var hardwareService=require(_0x2014('0x14'));var logger=require(_0x2014('0x15'))(_0x2014('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2014('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437257,_0x1cf81c){_0x1cf81c=_0x1cf81c||0xcc;return function(_0x18c55e){if(_0x18c55e){return _0x437257[_0x2014('0x18')](_0x1cf81c);}return _0x437257['status'](_0x1cf81c)[_0x2014('0x19')]();};}function respondWithResult(_0x76757a,_0x5f3827){_0x5f3827=_0x5f3827||0xc8;return function(_0x228da3){if(_0x228da3){return _0x76757a['status'](_0x5f3827)[_0x2014('0x1a')](_0x228da3);}};}function respondWithFilteredResult(_0xa98bb7,_0x349916){return function(_0x33fc9c){if(_0x33fc9c){var _0x4356b3=_0x33fc9c[_0x2014('0x1b')],_0x5575d7=_0x349916[_0x2014('0x1c')],_0x20e395=_0x349916['offset']+_0x349916[_0x2014('0x1d')],_0x1d0e9e;if(_0x20e395>=_0x4356b3){_0x20e395=_0x4356b3;_0x1d0e9e=0xc8;}else{_0x1d0e9e=0xce;}_0xa98bb7[_0x2014('0x1e')](_0x1d0e9e);return _0xa98bb7[_0x2014('0x1f')]('Content-Range',_0x5575d7+'-'+_0x20e395+'/'+_0x4356b3)[_0x2014('0x1a')](_0x33fc9c);}return null;};}function patchUpdates(_0x2ccd25){return function(_0x1633f5){try{jsonpatch[_0x2014('0x20')](_0x1633f5,_0x2ccd25,!![]);}catch(_0x176121){return BPromise[_0x2014('0x21')](_0x176121);}return _0x1633f5[_0x2014('0x22')]();};}function saveUpdates(_0x12525e,_0x482729){return function(_0x5b6339){if(_0x5b6339){return _0x5b6339[_0x2014('0x23')](_0x12525e)[_0x2014('0x24')](function(_0x385e45){return _0x385e45;});}return null;};}function removeEntity(_0xa92dba,_0x127990){return function(_0x185031){if(_0x185031){return _0x185031[_0x2014('0x25')]()[_0x2014('0x24')](function(){_0xa92dba[_0x2014('0x1e')](0xcc)[_0x2014('0x19')]();});}};}function handleEntityNotFound(_0x50a5cc,_0x3c4256){return function(_0x4006a9){if(!_0x4006a9){_0x50a5cc[_0x2014('0x18')](0x194);}return _0x4006a9;};}function handleError(_0x14ac80,_0x3de860){_0x3de860=_0x3de860||0x1f4;return function(_0x3c0d7c){logger[_0x2014('0x26')](_0x3c0d7c[_0x2014('0x27')]);if(_0x3c0d7c[_0x2014('0x28')]){delete _0x3c0d7c['name'];}_0x14ac80[_0x2014('0x1e')](_0x3de860)['send'](_0x3c0d7c);};}exports[_0x2014('0x29')]=function(_0x1c2cd4,_0x36fc95){var _0x3ceb9d={},_0x30ad97={},_0x492ea0={'count':0x0,'rows':[]};var _0x5f8db0=_['map'](db[_0x2014('0x2a')][_0x2014('0x2b')],function(_0x475508){return{'name':_0x475508[_0x2014('0x2c')],'type':_0x475508['type'][_0x2014('0x2d')]};});_0x30ad97['model']=_['map'](_0x5f8db0,'name');_0x30ad97[_0x2014('0x2e')]=_[_0x2014('0x2f')](_0x1c2cd4['query']);_0x30ad97[_0x2014('0x30')]=_[_0x2014('0x31')](_0x30ad97[_0x2014('0x32')],_0x30ad97[_0x2014('0x2e')]);_0x3ceb9d[_0x2014('0x33')]=_[_0x2014('0x31')](_0x30ad97[_0x2014('0x32')],qs[_0x2014('0x34')](_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x34')]));_0x3ceb9d[_0x2014('0x33')]=_0x3ceb9d[_0x2014('0x33')]['length']?_0x3ceb9d[_0x2014('0x33')]:_0x30ad97[_0x2014('0x32')];if(!_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x35')](_0x2014('0x36'))){_0x3ceb9d[_0x2014('0x1d')]=qs[_0x2014('0x1d')](_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x1d')]);_0x3ceb9d['offset']=qs[_0x2014('0x1c')](_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x1c')]);}_0x3ceb9d[_0x2014('0x37')]=qs[_0x2014('0x38')](_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x38')]);_0x3ceb9d[_0x2014('0x39')]=qs[_0x2014('0x30')](_[_0x2014('0x3a')](_0x1c2cd4[_0x2014('0x2e')],_0x30ad97[_0x2014('0x30')]),_0x5f8db0);if(_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x3b')]){_0x3ceb9d[_0x2014('0x39')]=_['merge'](_0x3ceb9d['where'],{'$or':_['map'](_0x5f8db0,function(_0x5d93b0){if(_0x5d93b0['type']!=='VIRTUAL'){var _0x43cc7b={};_0x43cc7b[_0x5d93b0[_0x2014('0x28')]]={'$like':'%'+_0x1c2cd4[_0x2014('0x2e')][_0x2014('0x3b')]+'%'};return _0x43cc7b;}})});}_0x3ceb9d=_[_0x2014('0x3c')]({},_0x3ceb9d,_0x1c2cd4[_0x2014('0x3d')]);var _0x2bf235={'where':_0x3ceb9d[_0x2014('0x39')]};return db['ChatOfflineMessage'][_0x2014('0x1b')](_0x2bf235)[_0x2014('0x24')](function(_0x561a1b){_0x492ea0[_0x2014('0x1b')]=_0x561a1b;if(_0x1c2cd4[_0x2014('0x2e')]['includeAll']){_0x3ceb9d['include']=[{'all':!![]}];}return db[_0x2014('0x2a')][_0x2014('0x3e')](_0x3ceb9d);})[_0x2014('0x24')](function(_0x22f567){_0x492ea0[_0x2014('0x3f')]=_0x22f567;return _0x492ea0;})[_0x2014('0x24')](respondWithFilteredResult(_0x36fc95,_0x3ceb9d))[_0x2014('0x40')](handleError(_0x36fc95,null));};exports['show']=function(_0x3d95de,_0xcde123){var _0x511402={'raw':!![],'where':{'id':_0x3d95de['params']['id']}},_0x79fe42={};_0x79fe42[_0x2014('0x32')]=_[_0x2014('0x2f')](db[_0x2014('0x2a')][_0x2014('0x2b')]);_0x79fe42[_0x2014('0x2e')]=_[_0x2014('0x2f')](_0x3d95de['query']);_0x79fe42[_0x2014('0x41')]=_[_0x2014('0x31')](_0x79fe42[_0x2014('0x32')],_0x79fe42['query']);_0x511402[_0x2014('0x33')]=_[_0x2014('0x31')](_0x79fe42[_0x2014('0x32')],qs[_0x2014('0x34')](_0x3d95de[_0x2014('0x2e')][_0x2014('0x34')]));_0x511402[_0x2014('0x33')]=_0x511402[_0x2014('0x33')][_0x2014('0x42')]?_0x511402[_0x2014('0x33')]:_0x79fe42[_0x2014('0x32')];if(_0x3d95de['query']['includeAll']){_0x511402[_0x2014('0x43')]=[{'all':!![]}];}_0x511402=_[_0x2014('0x3c')]({},_0x511402,_0x3d95de['options']);return db[_0x2014('0x2a')][_0x2014('0x44')](_0x511402)['then'](handleEntityNotFound(_0xcde123,null))[_0x2014('0x24')](respondWithResult(_0xcde123,null))['catch'](handleError(_0xcde123,null));};exports[_0x2014('0x45')]=function(_0x38a20f,_0x384be4){return db[_0x2014('0x2a')][_0x2014('0x45')](_0x38a20f[_0x2014('0x46')],{})[_0x2014('0x24')](respondWithResult(_0x384be4,0xc9))[_0x2014('0x40')](handleError(_0x384be4,null));};exports[_0x2014('0x23')]=function(_0x22278a,_0x3ab83f){if(_0x22278a[_0x2014('0x46')]['id']){delete _0x22278a[_0x2014('0x46')]['id'];}return db['ChatOfflineMessage'][_0x2014('0x44')]({'where':{'id':_0x22278a[_0x2014('0x47')]['id']}})[_0x2014('0x24')](handleEntityNotFound(_0x3ab83f,null))[_0x2014('0x24')](saveUpdates(_0x22278a[_0x2014('0x46')],null))[_0x2014('0x24')](respondWithResult(_0x3ab83f,null))[_0x2014('0x40')](handleError(_0x3ab83f,null));};exports[_0x2014('0x25')]=function(_0x25a90c,_0x24220b){return db[_0x2014('0x2a')][_0x2014('0x44')]({'where':{'id':_0x25a90c[_0x2014('0x47')]['id']}})[_0x2014('0x24')](handleEntityNotFound(_0x24220b,null))[_0x2014('0x24')](removeEntity(_0x24220b,null))['catch'](handleError(_0x24220b,null));};exports[_0x2014('0x48')]=function(_0x203c8c,_0x44548d){return db[_0x2014('0x2a')][_0x2014('0x48')]()[_0x2014('0x24')](respondWithResult(_0x44548d,null))[_0x2014('0x40')](handleError(_0x44548d,null));}; \ No newline at end of file +var _0x50c0=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','error','stack','name','send','ChatOfflineMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','filtears','merge','find','create','body','destroy'];(function(_0x40edbb,_0x4b8e85){var _0x1c34e1=function(_0x4cb6dc){while(--_0x4cb6dc){_0x40edbb['push'](_0x40edbb['shift']());}};_0x1c34e1(++_0x4b8e85);}(_0x50c0,0x8e));var _0x050c=function(_0x17791f,_0x1d16d8){_0x17791f=_0x17791f-0x0;var _0x332dc4=_0x50c0[_0x17791f];return _0x332dc4;};'use strict';var pdf=require(_0x050c('0x0'));var emlformat=require(_0x050c('0x1'));var rimraf=require(_0x050c('0x2'));var zipdir=require(_0x050c('0x3'));var jsonpatch=require(_0x050c('0x4'));var rp=require('request-promise');var moment=require(_0x050c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x050c('0x6'));var path=require(_0x050c('0x7'));var sox=require('sox');var csv=require(_0x050c('0x8'));var ejs=require(_0x050c('0x9'));var fs=require('fs');var _=require(_0x050c('0xa'));var squel=require(_0x050c('0xb'));var crypto=require('crypto');var jsforce=require(_0x050c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x050c('0x8'));var querystring=require('querystring');var Papa=require(_0x050c('0xd'));var Redis=require('ioredis');var authService=require(_0x050c('0xe'));var qs=require(_0x050c('0xf'));var as=require(_0x050c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x050c('0x11'))(_0x050c('0x12'));var utils=require('../../config/utils');var config=require(_0x050c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x050c('0x14'))['db'];function respondWithStatusCode(_0x35066d,_0x546e44){_0x546e44=_0x546e44||0xcc;return function(_0x103278){if(_0x103278){return _0x35066d[_0x050c('0x15')](_0x546e44);}return _0x35066d['status'](_0x546e44)[_0x050c('0x16')]();};}function respondWithResult(_0x338a15,_0x175c86){_0x175c86=_0x175c86||0xc8;return function(_0x287ab3){if(_0x287ab3){return _0x338a15[_0x050c('0x17')](_0x175c86)[_0x050c('0x18')](_0x287ab3);}};}function respondWithFilteredResult(_0x1a9f9d,_0x25280c){return function(_0x5d54ad){if(_0x5d54ad){var _0x374480=_0x5d54ad[_0x050c('0x19')],_0x302bd1=_0x25280c[_0x050c('0x1a')],_0x3e87d=_0x25280c[_0x050c('0x1a')]+_0x25280c[_0x050c('0x1b')],_0x4718b5;if(_0x3e87d>=_0x374480){_0x3e87d=_0x374480;_0x4718b5=0xc8;}else{_0x4718b5=0xce;}_0x1a9f9d['status'](_0x4718b5);return _0x1a9f9d[_0x050c('0x1c')](_0x050c('0x1d'),_0x302bd1+'-'+_0x3e87d+'/'+_0x374480)[_0x050c('0x18')](_0x5d54ad);}return null;};}function patchUpdates(_0x5d6b3d){return function(_0x15ebc6){try{jsonpatch[_0x050c('0x1e')](_0x15ebc6,_0x5d6b3d,!![]);}catch(_0x2443e2){return BPromise['reject'](_0x2443e2);}return _0x15ebc6['save']();};}function saveUpdates(_0x3418a2,_0x3231ae){return function(_0x75a490){if(_0x75a490){return _0x75a490[_0x050c('0x1f')](_0x3418a2)['then'](function(_0xad6307){return _0xad6307;});}return null;};}function removeEntity(_0x4d3401,_0x44ac68){return function(_0x48675e){if(_0x48675e){return _0x48675e['destroy']()['then'](function(){_0x4d3401[_0x050c('0x17')](0xcc)[_0x050c('0x16')]();});}};}function handleEntityNotFound(_0xb0825c,_0xb13b01){return function(_0x4a6eb2){if(!_0x4a6eb2){_0xb0825c[_0x050c('0x15')](0x194);}return _0x4a6eb2;};}function handleError(_0x562b29,_0x3e11bf){_0x3e11bf=_0x3e11bf||0x1f4;return function(_0x4d4b5c){logger[_0x050c('0x20')](_0x4d4b5c[_0x050c('0x21')]);if(_0x4d4b5c['name']){delete _0x4d4b5c[_0x050c('0x22')];}_0x562b29['status'](_0x3e11bf)[_0x050c('0x23')](_0x4d4b5c);};}exports['index']=function(_0x149734,_0x1934db){var _0x158fdd={},_0x49bf39={},_0x40c763={'count':0x0,'rows':[]};var _0x1e4cce=_['map'](db[_0x050c('0x24')][_0x050c('0x25')],function(_0x28beff){return{'name':_0x28beff[_0x050c('0x26')],'type':_0x28beff[_0x050c('0x27')][_0x050c('0x28')]};});_0x49bf39[_0x050c('0x29')]=_[_0x050c('0x2a')](_0x1e4cce,_0x050c('0x22'));_0x49bf39['query']=_[_0x050c('0x2b')](_0x149734[_0x050c('0x2c')]);_0x49bf39[_0x050c('0x2d')]=_[_0x050c('0x2e')](_0x49bf39[_0x050c('0x29')],_0x49bf39['query']);_0x158fdd[_0x050c('0x2f')]=_[_0x050c('0x2e')](_0x49bf39['model'],qs[_0x050c('0x30')](_0x149734[_0x050c('0x2c')][_0x050c('0x30')]));_0x158fdd[_0x050c('0x2f')]=_0x158fdd['attributes'][_0x050c('0x31')]?_0x158fdd['attributes']:_0x49bf39[_0x050c('0x29')];if(!_0x149734[_0x050c('0x2c')][_0x050c('0x32')]('nolimit')){_0x158fdd[_0x050c('0x1b')]=qs['limit'](_0x149734[_0x050c('0x2c')][_0x050c('0x1b')]);_0x158fdd[_0x050c('0x1a')]=qs['offset'](_0x149734[_0x050c('0x2c')][_0x050c('0x1a')]);}_0x158fdd[_0x050c('0x33')]=qs[_0x050c('0x34')](_0x149734[_0x050c('0x2c')]['sort']);_0x158fdd[_0x050c('0x35')]=qs['filters'](_['pick'](_0x149734['query'],_0x49bf39[_0x050c('0x2d')]),_0x1e4cce);if(_0x149734[_0x050c('0x2c')][_0x050c('0x36')]){_0x158fdd[_0x050c('0x35')]=_['merge'](_0x158fdd['where'],{'$or':_['map'](_0x1e4cce,function(_0x50a57b){if(_0x50a57b[_0x050c('0x27')]!==_0x050c('0x37')){var _0x139097={};_0x139097[_0x50a57b[_0x050c('0x22')]]={'$like':'%'+_0x149734[_0x050c('0x2c')]['filter']+'%'};return _0x139097;}})});}_0x158fdd=_['merge']({},_0x158fdd,_0x149734[_0x050c('0x38')]);var _0x190c71={'where':_0x158fdd['where']};return db['ChatOfflineMessage'][_0x050c('0x19')](_0x190c71)[_0x050c('0x39')](function(_0x2ab694){_0x40c763[_0x050c('0x19')]=_0x2ab694;if(_0x149734[_0x050c('0x2c')][_0x050c('0x3a')]){_0x158fdd[_0x050c('0x3b')]=[{'all':!![]}];}return db[_0x050c('0x24')][_0x050c('0x3c')](_0x158fdd);})[_0x050c('0x39')](function(_0x248367){_0x40c763[_0x050c('0x3d')]=_0x248367;return _0x40c763;})[_0x050c('0x39')](respondWithFilteredResult(_0x1934db,_0x158fdd))[_0x050c('0x3e')](handleError(_0x1934db,null));};exports[_0x050c('0x3f')]=function(_0x389a62,_0x6c6c85){var _0x46adf8={'raw':!![],'where':{'id':_0x389a62[_0x050c('0x40')]['id']}},_0x4d4937={};_0x4d4937[_0x050c('0x29')]=_[_0x050c('0x2b')](db[_0x050c('0x24')]['rawAttributes']);_0x4d4937[_0x050c('0x2c')]=_[_0x050c('0x2b')](_0x389a62[_0x050c('0x2c')]);_0x4d4937[_0x050c('0x41')]=_[_0x050c('0x2e')](_0x4d4937['model'],_0x4d4937[_0x050c('0x2c')]);_0x46adf8[_0x050c('0x2f')]=_[_0x050c('0x2e')](_0x4d4937[_0x050c('0x29')],qs['fields'](_0x389a62['query'][_0x050c('0x30')]));_0x46adf8[_0x050c('0x2f')]=_0x46adf8[_0x050c('0x2f')][_0x050c('0x31')]?_0x46adf8['attributes']:_0x4d4937[_0x050c('0x29')];if(_0x389a62[_0x050c('0x2c')][_0x050c('0x3a')]){_0x46adf8[_0x050c('0x3b')]=[{'all':!![]}];}_0x46adf8=_[_0x050c('0x42')]({},_0x46adf8,_0x389a62[_0x050c('0x38')]);return db[_0x050c('0x24')][_0x050c('0x43')](_0x46adf8)[_0x050c('0x39')](handleEntityNotFound(_0x6c6c85,null))[_0x050c('0x39')](respondWithResult(_0x6c6c85,null))[_0x050c('0x3e')](handleError(_0x6c6c85,null));};exports['create']=function(_0x3298c5,_0x3f0de9){return db[_0x050c('0x24')][_0x050c('0x44')](_0x3298c5[_0x050c('0x45')],{})[_0x050c('0x39')](respondWithResult(_0x3f0de9,0xc9))[_0x050c('0x3e')](handleError(_0x3f0de9,null));};exports[_0x050c('0x1f')]=function(_0x1c4935,_0x2086be){if(_0x1c4935[_0x050c('0x45')]['id']){delete _0x1c4935[_0x050c('0x45')]['id'];}return db[_0x050c('0x24')][_0x050c('0x43')]({'where':{'id':_0x1c4935[_0x050c('0x40')]['id']}})[_0x050c('0x39')](handleEntityNotFound(_0x2086be,null))[_0x050c('0x39')](saveUpdates(_0x1c4935['body'],null))[_0x050c('0x39')](respondWithResult(_0x2086be,null))[_0x050c('0x3e')](handleError(_0x2086be,null));};exports[_0x050c('0x46')]=function(_0x242ffb,_0x3f8d7c){return db[_0x050c('0x24')][_0x050c('0x43')]({'where':{'id':_0x242ffb['params']['id']}})['then'](handleEntityNotFound(_0x3f8d7c,null))[_0x050c('0x39')](removeEntity(_0x3f8d7c,null))[_0x050c('0x3e')](handleError(_0x3f8d7c,null));};exports['describe']=function(_0x1cf37b,_0x5c167b){return db[_0x050c('0x24')]['describe']()[_0x050c('0x39')](respondWithResult(_0x5c167b,null))['catch'](handleError(_0x5c167b,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 60e0833..1fba103 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 _0xadb8=['path','rimraf','../../config/environment','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xadb8,0x1d0));var _0x8adb=function(_0x4360c4,_0x2f8209){_0x4360c4=_0x4360c4-0x0;var _0x3168c8=_0xadb8[_0x4360c4];return _0x3168c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8adb('0x0'))('api');var moment=require(_0x8adb('0x1'));var BPromise=require(_0x8adb('0x2'));var rp=require(_0x8adb('0x3'));var fs=require('fs');var path=require(_0x8adb('0x4'));var rimraf=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var attributes=require(_0x8adb('0x7'));module['exports']=function(_0x15bc63,_0x1a5f36){return _0x15bc63[_0x8adb('0x8')](_0x8adb('0x9'),attributes,{'tableName':_0x8adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8adb('0xb'),'collate':_0x8adb('0xc')});}; \ No newline at end of file +var _0x9f62=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','util','api','moment','bluebird','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x9f62,0x154));var _0x29f6=function(_0x26ea3a,_0x404d0d){_0x26ea3a=_0x26ea3a-0x0;var _0x545d00=_0x9f62[_0x26ea3a];return _0x545d00;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x29f6('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1bdd8f7..6daf381 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 _0x29d9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x41cbaf,_0x12d9f9){var _0x9f8198=function(_0x486d84){while(--_0x486d84){_0x41cbaf['push'](_0x41cbaf['shift']());}};_0x9f8198(++_0x12d9f9);}(_0x29d9,0xaf));var _0x929d=function(_0xef57,_0x53adab){_0xef57=_0xef57-0x0;var _0xb6bd40=_0x29d9[_0xef57];return _0xb6bd40;};'use strict';var _=require(_0x929d('0x0'));var util=require(_0x929d('0x1'));var moment=require(_0x929d('0x2'));var BPromise=require(_0x929d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x929d('0x4'));var db=require(_0x929d('0x5'))['db'];var utils=require(_0x929d('0x6'));var logger=require(_0x929d('0x7'))(_0x929d('0x8'));var config=require(_0x929d('0x9'));var jayson=require(_0x929d('0xa'));var client=jayson[_0x929d('0xb')][_0x929d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3517c8,_0x5b6382,_0x4fbcc2){return new BPromise(function(_0x407b7a,_0x898d0a){return client['request'](_0x3517c8,_0x4fbcc2)[_0x929d('0xd')](function(_0x112074){logger['info'](_0x929d('0xe'),_0x5b6382,_0x929d('0xf'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5b6382,_0x929d('0xf'),JSON['stringify'](_0x112074));if(_0x112074[_0x929d('0x10')]){if(_0x112074[_0x929d('0x10')]['code']===0x1f4){logger[_0x929d('0x10')](_0x929d('0xe'),_0x5b6382,_0x112074[_0x929d('0x10')][_0x929d('0x11')]);return _0x898d0a(_0x112074[_0x929d('0x10')][_0x929d('0x11')]);}logger[_0x929d('0x10')](_0x929d('0xe'),_0x5b6382,_0x112074['error']['message']);return _0x407b7a(_0x112074['error'][_0x929d('0x11')]);}else{logger['info'](_0x929d('0xe'),_0x5b6382,_0x929d('0xf'));_0x407b7a(_0x112074[_0x929d('0x12')][_0x929d('0x11')]);}})[_0x929d('0x13')](function(_0x469456){logger[_0x929d('0x10')](_0x929d('0xe'),_0x5b6382,_0x469456);_0x898d0a(_0x469456);});});} \ No newline at end of file +var _0x0e04=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird'];(function(_0x382d25,_0x5c1905){var _0x3d0b27=function(_0x2c968a){while(--_0x2c968a){_0x382d25['push'](_0x382d25['shift']());}};_0x3d0b27(++_0x5c1905);}(_0x0e04,0x1eb));var _0x40e0=function(_0x7735be,_0x3c47c1){_0x7735be=_0x7735be-0x0;var _0x5d569c=_0x0e04[_0x7735be];return _0x5d569c;};'use strict';var _=require('lodash');var util=require(_0x40e0('0x0'));var moment=require(_0x40e0('0x1'));var BPromise=require(_0x40e0('0x2'));var rs=require(_0x40e0('0x3'));var fs=require('fs');var Redis=require(_0x40e0('0x4'));var db=require(_0x40e0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x40e0('0x6'))('rpc');var config=require(_0x40e0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x40e0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23b5ef,_0x557df0,_0x237aea){return new BPromise(function(_0x3614e0,_0x20d2f2){return client[_0x40e0('0x9')](_0x23b5ef,_0x237aea)[_0x40e0('0xa')](function(_0x27c679){logger[_0x40e0('0xb')](_0x40e0('0xc'),_0x557df0,_0x40e0('0xd'));logger[_0x40e0('0xe')](_0x40e0('0xf'),_0x557df0,'request\x20sent',JSON['stringify'](_0x27c679));if(_0x27c679[_0x40e0('0x10')]){if(_0x27c679[_0x40e0('0x10')]['code']===0x1f4){logger['error'](_0x40e0('0xc'),_0x557df0,_0x27c679[_0x40e0('0x10')][_0x40e0('0x11')]);return _0x20d2f2(_0x27c679['error'][_0x40e0('0x11')]);}logger[_0x40e0('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x557df0,_0x27c679[_0x40e0('0x10')][_0x40e0('0x11')]);return _0x3614e0(_0x27c679[_0x40e0('0x10')][_0x40e0('0x11')]);}else{logger[_0x40e0('0xb')](_0x40e0('0xc'),_0x557df0,_0x40e0('0xd'));_0x3614e0(_0x27c679['result'][_0x40e0('0x11')]);}})[_0x40e0('0x12')](function(_0x3db1af){logger[_0x40e0('0x10')](_0x40e0('0xc'),_0x557df0,_0x3db1af);_0x20d2f2(_0x3db1af);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4cd47c5..6a7a597 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 _0xf494=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','describe','/:id','show','post','create','update'];(function(_0x417e2c,_0x31e8af){var _0x1c0360=function(_0x2e6d60){while(--_0x2e6d60){_0x417e2c['push'](_0x417e2c['shift']());}};_0x1c0360(++_0x31e8af);}(_0xf494,0x18d));var _0x4f49=function(_0x36fc4c,_0x4f5126){_0x36fc4c=_0x36fc4c-0x0;var _0x266bc6=_0xf494[_0x36fc4c];return _0x266bc6;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require(_0x4f49('0x3'));var express=require(_0x4f49('0x4'));var router=express['Router']();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4f49('0x8')]);router[_0x4f49('0x9')]('/describe',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xe')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xf')]);router['put'](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4f49('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0216=['../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x490975,_0x41f7){var _0x545d84=function(_0x508105){while(--_0x508105){_0x490975['push'](_0x490975['shift']());}};_0x545d84(++_0x41f7);}(_0x0216,0x175));var _0x6021=function(_0x544127,_0x7ad29a){_0x544127=_0x544127-0x0;var _0x3a2cf2=_0x0216[_0x544127];return _0x3a2cf2;};'use strict';var multer=require(_0x6021('0x0'));var util=require(_0x6021('0x1'));var path=require(_0x6021('0x2'));var timeout=require(_0x6021('0x3'));var express=require('express');var router=express[_0x6021('0x4')]();var auth=require(_0x6021('0x5'));var interaction=require(_0x6021('0x6'));var config=require(_0x6021('0x7'));var controller=require(_0x6021('0x8'));router[_0x6021('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6021('0x9')](_0x6021('0xa'),auth[_0x6021('0xb')](),controller[_0x6021('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6021('0xb')](),controller[_0x6021('0xd')]);router[_0x6021('0xe')]('/:id',auth[_0x6021('0xb')](),controller[_0x6021('0xf')]);router[_0x6021('0x10')](_0x6021('0x11'),auth[_0x6021('0xb')](),controller[_0x6021('0x12')]);module[_0x6021('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 da3252e..6db1b28 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 _0x0995=['INTEGER','sequelize','exports','STRING','ENUM','timeout','mouseOver'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0995,0x16d));var _0x5099=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0995[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5099('0x0'));module[_0x5099('0x1')]={'name':{'type':Sequelize[_0x5099('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5099('0x3')]('mouseOver',_0x5099('0x4')),'defaultValue':_0x5099('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5099('0x6')]}}; \ No newline at end of file +var _0xdc3d=['mouseOver','timeout','sequelize','STRING'];(function(_0x32b2a0,_0x84bc2d){var _0x227e5b=function(_0x186404){while(--_0x186404){_0x32b2a0['push'](_0x32b2a0['shift']());}};_0x227e5b(++_0x84bc2d);}(_0xdc3d,0x162));var _0xddc3=function(_0x2d2427,_0x423763){_0x2d2427=_0x2d2427-0x0;var _0x4ea656=_0xdc3d[_0x2d2427];return _0x4ea656;};'use strict';var Sequelize=require(_0xddc3('0x0'));module['exports']={'name':{'type':Sequelize[_0xddc3('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xddc3('0x2'),_0xddc3('0x3')),'defaultValue':_0xddc3('0x2')},'selector':{'type':Sequelize[_0xddc3('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 4597821..90633bd 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 _0xc3df=['../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','show','params','keys','rawAttributes','query','filtears','model','intersection','fields','attributes','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3df,0x1d1));var _0xfc3d=function(_0x8d5f87,_0x4a0d78){_0x8d5f87=_0x8d5f87-0x0;var _0x241ab8=_0xc3df[_0x8d5f87];return _0x241ab8;};'use strict';var pdf=require(_0xfc3d('0x0'));var emlformat=require(_0xfc3d('0x1'));var rimraf=require(_0xfc3d('0x2'));var zipdir=require(_0xfc3d('0x3'));var jsonpatch=require(_0xfc3d('0x4'));var rp=require('request-promise');var moment=require(_0xfc3d('0x5'));var BPromise=require(_0xfc3d('0x6'));var Mustache=require(_0xfc3d('0x7'));var util=require(_0xfc3d('0x8'));var path=require(_0xfc3d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc3d('0xa'));var squel=require('squel');var crypto=require(_0xfc3d('0xb'));var jsforce=require(_0xfc3d('0xc'));var deskjs=require(_0xfc3d('0xd'));var toCsv=require(_0xfc3d('0xe'));var querystring=require('querystring');var Papa=require(_0xfc3d('0xf'));var Redis=require(_0xfc3d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc3d('0x11'));var as=require(_0xfc3d('0x12'));var hardwareService=require(_0xfc3d('0x13'));var logger=require(_0xfc3d('0x14'))(_0xfc3d('0x15'));var utils=require('../../config/utils');var config=require(_0xfc3d('0x16'));var licenseUtil=require(_0xfc3d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x264b1e,_0x10bdfb){_0x10bdfb=_0x10bdfb||0xcc;return function(_0x114bba){if(_0x114bba){return _0x264b1e[_0xfc3d('0x18')](_0x10bdfb);}return _0x264b1e[_0xfc3d('0x19')](_0x10bdfb)['end']();};}function respondWithResult(_0x41df56,_0x5c45ff){_0x5c45ff=_0x5c45ff||0xc8;return function(_0x5c088b){if(_0x5c088b){return _0x41df56[_0xfc3d('0x19')](_0x5c45ff)[_0xfc3d('0x1a')](_0x5c088b);}};}function respondWithFilteredResult(_0xb9b092,_0x57d5eb){return function(_0x216190){if(_0x216190){var _0x58da87=_0x216190[_0xfc3d('0x1b')],_0x4b8c95=_0x57d5eb[_0xfc3d('0x1c')],_0x39994c=_0x57d5eb[_0xfc3d('0x1c')]+_0x57d5eb['limit'],_0x238ba5;if(_0x39994c>=_0x58da87){_0x39994c=_0x58da87;_0x238ba5=0xc8;}else{_0x238ba5=0xce;}_0xb9b092[_0xfc3d('0x19')](_0x238ba5);return _0xb9b092[_0xfc3d('0x1d')](_0xfc3d('0x1e'),_0x4b8c95+'-'+_0x39994c+'/'+_0x58da87)[_0xfc3d('0x1a')](_0x216190);}return null;};}function patchUpdates(_0x3707b7){return function(_0x15f2f8){try{jsonpatch['apply'](_0x15f2f8,_0x3707b7,!![]);}catch(_0x544311){return BPromise[_0xfc3d('0x1f')](_0x544311);}return _0x15f2f8[_0xfc3d('0x20')]();};}function saveUpdates(_0x49e2d2,_0x276666){return function(_0x5f4a79){if(_0x5f4a79){return _0x5f4a79[_0xfc3d('0x21')](_0x49e2d2)[_0xfc3d('0x22')](function(_0x58a1b9){return _0x58a1b9;});}return null;};}function removeEntity(_0x1350fe,_0x4ce6a4){return function(_0x1ab1a3){if(_0x1ab1a3){return _0x1ab1a3[_0xfc3d('0x23')]()[_0xfc3d('0x22')](function(){_0x1350fe['status'](0xcc)[_0xfc3d('0x24')]();});}};}function handleEntityNotFound(_0x564135,_0x218446){return function(_0x423086){if(!_0x423086){_0x564135[_0xfc3d('0x18')](0x194);}return _0x423086;};}function handleError(_0x447401,_0x5ac662){_0x5ac662=_0x5ac662||0x1f4;return function(_0x281165){logger[_0xfc3d('0x25')](_0x281165[_0xfc3d('0x26')]);if(_0x281165[_0xfc3d('0x27')]){delete _0x281165['name'];}_0x447401[_0xfc3d('0x19')](_0x5ac662)[_0xfc3d('0x28')](_0x281165);};}exports[_0xfc3d('0x29')]=function(_0x2722da,_0x38d1c2){var _0x57f012={'raw':!![],'where':{'id':_0x2722da[_0xfc3d('0x2a')]['id']}},_0x28f6e0={};_0x28f6e0['model']=_[_0xfc3d('0x2b')](db['ChatProactiveAction'][_0xfc3d('0x2c')]);_0x28f6e0[_0xfc3d('0x2d')]=_[_0xfc3d('0x2b')](_0x2722da[_0xfc3d('0x2d')]);_0x28f6e0[_0xfc3d('0x2e')]=_['intersection'](_0x28f6e0[_0xfc3d('0x2f')],_0x28f6e0['query']);_0x57f012['attributes']=_[_0xfc3d('0x30')](_0x28f6e0[_0xfc3d('0x2f')],qs['fields'](_0x2722da['query'][_0xfc3d('0x31')]));_0x57f012[_0xfc3d('0x32')]=_0x57f012[_0xfc3d('0x32')][_0xfc3d('0x33')]?_0x57f012['attributes']:_0x28f6e0[_0xfc3d('0x2f')];if(_0x2722da[_0xfc3d('0x2d')][_0xfc3d('0x34')]){_0x57f012[_0xfc3d('0x35')]=[{'all':!![]}];}_0x57f012=_[_0xfc3d('0x36')]({},_0x57f012,_0x2722da[_0xfc3d('0x37')]);return db[_0xfc3d('0x38')][_0xfc3d('0x39')](_0x57f012)[_0xfc3d('0x22')](handleEntityNotFound(_0x38d1c2,null))['then'](respondWithResult(_0x38d1c2,null))[_0xfc3d('0x3a')](handleError(_0x38d1c2,null));};exports[_0xfc3d('0x3b')]=function(_0x5d261f,_0x9dfdd3){return db[_0xfc3d('0x38')][_0xfc3d('0x3b')](_0x5d261f[_0xfc3d('0x3c')],{})[_0xfc3d('0x22')](respondWithResult(_0x9dfdd3,0xc9))[_0xfc3d('0x3a')](handleError(_0x9dfdd3,null));};exports[_0xfc3d('0x21')]=function(_0x26909f,_0x128b1b){if(_0x26909f[_0xfc3d('0x3c')]['id']){delete _0x26909f[_0xfc3d('0x3c')]['id'];}return db[_0xfc3d('0x38')][_0xfc3d('0x39')]({'where':{'id':_0x26909f[_0xfc3d('0x2a')]['id']}})['then'](handleEntityNotFound(_0x128b1b,null))[_0xfc3d('0x22')](saveUpdates(_0x26909f[_0xfc3d('0x3c')],null))[_0xfc3d('0x22')](respondWithResult(_0x128b1b,null))[_0xfc3d('0x3a')](handleError(_0x128b1b,null));};exports[_0xfc3d('0x23')]=function(_0x6dade5,_0x521505){return db[_0xfc3d('0x38')][_0xfc3d('0x39')]({'where':{'id':_0x6dade5[_0xfc3d('0x2a')]['id']}})[_0xfc3d('0x22')](handleEntityNotFound(_0x521505,null))[_0xfc3d('0x22')](removeEntity(_0x521505,null))[_0xfc3d('0x3a')](handleError(_0x521505,null));}; \ No newline at end of file +var _0x19c3=['sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','name','send','show','params','keys','rawAttributes','query','filtears','intersection','model','attributes','fields','length','includeAll','include','merge','options','ChatProactiveAction','catch','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0xcf7d1e,_0x1b00ad){var _0x42b2cb=function(_0x4c5c9b){while(--_0x4c5c9b){_0xcf7d1e['push'](_0xcf7d1e['shift']());}};_0x42b2cb(++_0x1b00ad);}(_0x19c3,0xac));var _0x319c=function(_0x5cbebb,_0x2d67c0){_0x5cbebb=_0x5cbebb-0x0;var _0x121ec9=_0x19c3[_0x5cbebb];return _0x121ec9;};'use strict';var pdf=require(_0x319c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x319c('0x1'));var zipdir=require(_0x319c('0x2'));var jsonpatch=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var moment=require(_0x319c('0x5'));var BPromise=require(_0x319c('0x6'));var Mustache=require('mustache');var util=require(_0x319c('0x7'));var path=require('path');var sox=require(_0x319c('0x8'));var csv=require(_0x319c('0x9'));var ejs=require(_0x319c('0xa'));var fs=require('fs');var _=require(_0x319c('0xb'));var squel=require('squel');var crypto=require(_0x319c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x319c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x319c('0xe'));var Papa=require(_0x319c('0xf'));var Redis=require(_0x319c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x319c('0x11'));var hardwareService=require(_0x319c('0x12'));var logger=require(_0x319c('0x13'))(_0x319c('0x14'));var utils=require(_0x319c('0x15'));var config=require(_0x319c('0x16'));var licenseUtil=require(_0x319c('0x17'));var db=require(_0x319c('0x18'))['db'];function respondWithStatusCode(_0x3b27a3,_0xaf5430){_0xaf5430=_0xaf5430||0xcc;return function(_0x57dca9){if(_0x57dca9){return _0x3b27a3[_0x319c('0x19')](_0xaf5430);}return _0x3b27a3[_0x319c('0x1a')](_0xaf5430)[_0x319c('0x1b')]();};}function respondWithResult(_0xdf1bcf,_0x541a4e){_0x541a4e=_0x541a4e||0xc8;return function(_0x17d40c){if(_0x17d40c){return _0xdf1bcf['status'](_0x541a4e)[_0x319c('0x1c')](_0x17d40c);}};}function respondWithFilteredResult(_0x3402eb,_0xff99c4){return function(_0x599fd2){if(_0x599fd2){var _0x584b21=_0x599fd2[_0x319c('0x1d')],_0x3099aa=_0xff99c4['offset'],_0x2105bf=_0xff99c4['offset']+_0xff99c4[_0x319c('0x1e')],_0xad5d2;if(_0x2105bf>=_0x584b21){_0x2105bf=_0x584b21;_0xad5d2=0xc8;}else{_0xad5d2=0xce;}_0x3402eb[_0x319c('0x1a')](_0xad5d2);return _0x3402eb[_0x319c('0x1f')](_0x319c('0x20'),_0x3099aa+'-'+_0x2105bf+'/'+_0x584b21)[_0x319c('0x1c')](_0x599fd2);}return null;};}function patchUpdates(_0x3aef3f){return function(_0x31a3e5){try{jsonpatch[_0x319c('0x21')](_0x31a3e5,_0x3aef3f,!![]);}catch(_0x510527){return BPromise['reject'](_0x510527);}return _0x31a3e5[_0x319c('0x22')]();};}function saveUpdates(_0x414123,_0x50ea1b){return function(_0x5b2491){if(_0x5b2491){return _0x5b2491[_0x319c('0x23')](_0x414123)[_0x319c('0x24')](function(_0xe4f0e0){return _0xe4f0e0;});}return null;};}function removeEntity(_0x471c7d,_0x2bf581){return function(_0xe0329a){if(_0xe0329a){return _0xe0329a[_0x319c('0x25')]()[_0x319c('0x24')](function(){_0x471c7d[_0x319c('0x1a')](0xcc)[_0x319c('0x1b')]();});}};}function handleEntityNotFound(_0x2977ce,_0x290fef){return function(_0x503f51){if(!_0x503f51){_0x2977ce['sendStatus'](0x194);}return _0x503f51;};}function handleError(_0x2b0f17,_0x45c39c){_0x45c39c=_0x45c39c||0x1f4;return function(_0x7cae19){logger['error'](_0x7cae19['stack']);if(_0x7cae19[_0x319c('0x26')]){delete _0x7cae19[_0x319c('0x26')];}_0x2b0f17[_0x319c('0x1a')](_0x45c39c)[_0x319c('0x27')](_0x7cae19);};}exports[_0x319c('0x28')]=function(_0x4bc96f,_0x125c07){var _0x513e1c={'raw':!![],'where':{'id':_0x4bc96f[_0x319c('0x29')]['id']}},_0x4cf38b={};_0x4cf38b['model']=_[_0x319c('0x2a')](db['ChatProactiveAction'][_0x319c('0x2b')]);_0x4cf38b[_0x319c('0x2c')]=_[_0x319c('0x2a')](_0x4bc96f[_0x319c('0x2c')]);_0x4cf38b[_0x319c('0x2d')]=_[_0x319c('0x2e')](_0x4cf38b[_0x319c('0x2f')],_0x4cf38b['query']);_0x513e1c[_0x319c('0x30')]=_[_0x319c('0x2e')](_0x4cf38b[_0x319c('0x2f')],qs[_0x319c('0x31')](_0x4bc96f[_0x319c('0x2c')][_0x319c('0x31')]));_0x513e1c[_0x319c('0x30')]=_0x513e1c['attributes'][_0x319c('0x32')]?_0x513e1c['attributes']:_0x4cf38b[_0x319c('0x2f')];if(_0x4bc96f[_0x319c('0x2c')][_0x319c('0x33')]){_0x513e1c[_0x319c('0x34')]=[{'all':!![]}];}_0x513e1c=_[_0x319c('0x35')]({},_0x513e1c,_0x4bc96f[_0x319c('0x36')]);return db[_0x319c('0x37')]['find'](_0x513e1c)[_0x319c('0x24')](handleEntityNotFound(_0x125c07,null))[_0x319c('0x24')](respondWithResult(_0x125c07,null))[_0x319c('0x38')](handleError(_0x125c07,null));};exports[_0x319c('0x39')]=function(_0x2bb73f,_0x5cff65){return db['ChatProactiveAction']['create'](_0x2bb73f[_0x319c('0x3a')],{})['then'](respondWithResult(_0x5cff65,0xc9))[_0x319c('0x38')](handleError(_0x5cff65,null));};exports['update']=function(_0x1b1652,_0x2ae4cb){if(_0x1b1652[_0x319c('0x3a')]['id']){delete _0x1b1652[_0x319c('0x3a')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x1b1652['params']['id']}})[_0x319c('0x24')](handleEntityNotFound(_0x2ae4cb,null))[_0x319c('0x24')](saveUpdates(_0x1b1652['body'],null))[_0x319c('0x24')](respondWithResult(_0x2ae4cb,null))[_0x319c('0x38')](handleError(_0x2ae4cb,null));};exports[_0x319c('0x25')]=function(_0x155ab7,_0x3e7a28){return db[_0x319c('0x37')][_0x319c('0x3b')]({'where':{'id':_0x155ab7[_0x319c('0x29')]['id']}})[_0x319c('0x24')](handleEntityNotFound(_0x3e7a28,null))[_0x319c('0x24')](removeEntity(_0x3e7a28,null))[_0x319c('0x38')](handleError(_0x3e7a28,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 4b3d037..b8ddd2f 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 _0x8518=['request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x43f254,_0x3de3e4){var _0x2a7b2c=function(_0x2551a3){while(--_0x2551a3){_0x43f254['push'](_0x43f254['shift']());}};_0x2a7b2c(++_0x3de3e4);}(_0x8518,0x19e));var _0x8851=function(_0x26bafe,_0x13e506){_0x26bafe=_0x26bafe-0x0;var _0x307879=_0x8518[_0x26bafe];return _0x307879;};'use strict';var _=require(_0x8851('0x0'));var util=require(_0x8851('0x1'));var logger=require(_0x8851('0x2'))(_0x8851('0x3'));var moment=require(_0x8851('0x4'));var BPromise=require(_0x8851('0x5'));var rp=require(_0x8851('0x6'));var fs=require('fs');var path=require(_0x8851('0x7'));var rimraf=require('rimraf');var config=require(_0x8851('0x8'));var attributes=require(_0x8851('0x9'));module[_0x8851('0xa')]=function(_0x11e3fa,_0x2e4fa1){return _0x11e3fa[_0x8851('0xb')](_0x8851('0xc'),attributes,{'tableName':_0x8851('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c40=['lodash','util','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0c40,0x1cb));var _0x00c4=function(_0x34d2ad,_0x547dde){_0x34d2ad=_0x34d2ad-0x0;var _0x548a0f=_0x0c40[_0x34d2ad];return _0x548a0f;};'use strict';var _=require(_0x00c4('0x0'));var util=require(_0x00c4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x00c4('0x2'));var rp=require(_0x00c4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00c4('0x4'));var config=require(_0x00c4('0x5'));var attributes=require(_0x00c4('0x6'));module['exports']=function(_0x30c922,_0x30d8ac){return _0x30c922['define'](_0x00c4('0x7'),attributes,{'tableName':_0x00c4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index a109298..e9fad1e 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 _0xe875=['http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3cf85,_0x571868){var _0x2ceecd=function(_0x54755a){while(--_0x54755a){_0x3cf85['push'](_0x3cf85['shift']());}};_0x2ceecd(++_0x571868);}(_0xe875,0x1f1));var _0x5e87=function(_0x16eebe,_0x13b020){_0x16eebe=_0x16eebe-0x0;var _0x226be0=_0xe875[_0x16eebe];return _0x226be0;};'use strict';var _=require('lodash');var util=require(_0x5e87('0x0'));var moment=require(_0x5e87('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e87('0x2'))['db'];var utils=require(_0x5e87('0x3'));var logger=require('../../config/logger')(_0x5e87('0x4'));var config=require(_0x5e87('0x5'));var jayson=require(_0x5e87('0x6'));var client=jayson['client'][_0x5e87('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xcc94eb,_0x34fa7f,_0x40ff27){return new BPromise(function(_0x6e6232,_0x1f28c1){return client[_0x5e87('0x8')](_0xcc94eb,_0x40ff27)[_0x5e87('0x9')](function(_0x4de3d8){logger['info'](_0x5e87('0xa'),_0x34fa7f,_0x5e87('0xb'));logger[_0x5e87('0xc')](_0x5e87('0xd'),_0x34fa7f,_0x5e87('0xb'),JSON[_0x5e87('0xe')](_0x4de3d8));if(_0x4de3d8[_0x5e87('0xf')]){if(_0x4de3d8[_0x5e87('0xf')][_0x5e87('0x10')]===0x1f4){logger[_0x5e87('0xf')](_0x5e87('0xa'),_0x34fa7f,_0x4de3d8[_0x5e87('0xf')][_0x5e87('0x11')]);return _0x1f28c1(_0x4de3d8[_0x5e87('0xf')][_0x5e87('0x11')]);}logger[_0x5e87('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x34fa7f,_0x4de3d8[_0x5e87('0xf')][_0x5e87('0x11')]);return _0x6e6232(_0x4de3d8['error'][_0x5e87('0x11')]);}else{logger[_0x5e87('0x12')](_0x5e87('0xa'),_0x34fa7f,_0x5e87('0xb'));_0x6e6232(_0x4de3d8[_0x5e87('0x13')][_0x5e87('0x11')]);}})[_0x5e87('0x14')](function(_0x3dcc23){logger['error'](_0x5e87('0xa'),_0x34fa7f,_0x3dcc23);_0x1f28c1(_0x3dcc23);});});} \ No newline at end of file +var _0xeed8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeed8,0xe6));var _0x8eed=function(_0x5f0869,_0x2b643c){_0x5f0869=_0x5f0869-0x0;var _0x5c5ef2=_0xeed8[_0x5f0869];return _0x5c5ef2;};'use strict';var _=require(_0x8eed('0x0'));var util=require(_0x8eed('0x1'));var moment=require(_0x8eed('0x2'));var BPromise=require(_0x8eed('0x3'));var rs=require(_0x8eed('0x4'));var fs=require('fs');var Redis=require(_0x8eed('0x5'));var db=require(_0x8eed('0x6'))['db'];var utils=require(_0x8eed('0x7'));var logger=require('../../config/logger')(_0x8eed('0x8'));var config=require(_0x8eed('0x9'));var jayson=require(_0x8eed('0xa'));var client=jayson['client'][_0x8eed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ed30,_0x3792e2,_0x49ed7c){return new BPromise(function(_0x18fb2c,_0x349b70){return client['request'](_0x50ed30,_0x49ed7c)[_0x8eed('0xc')](function(_0x9da47b){logger[_0x8eed('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x3792e2,'request\x20sent');logger[_0x8eed('0xe')](_0x8eed('0xf'),_0x3792e2,_0x8eed('0x10'),JSON[_0x8eed('0x11')](_0x9da47b));if(_0x9da47b[_0x8eed('0x12')]){if(_0x9da47b['error'][_0x8eed('0x13')]===0x1f4){logger[_0x8eed('0x12')](_0x8eed('0x14'),_0x3792e2,_0x9da47b['error'][_0x8eed('0x15')]);return _0x349b70(_0x9da47b['error']['message']);}logger['error'](_0x8eed('0x14'),_0x3792e2,_0x9da47b['error']['message']);return _0x18fb2c(_0x9da47b['error'][_0x8eed('0x15')]);}else{logger[_0x8eed('0xd')](_0x8eed('0x14'),_0x3792e2,_0x8eed('0x10'));_0x18fb2c(_0x9da47b[_0x8eed('0x16')][_0x8eed('0x15')]);}})['catch'](function(_0x29610d){logger[_0x8eed('0x12')](_0x8eed('0x14'),_0x3792e2,_0x29610d);_0x349b70(_0x29610d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 62c5a72..eb289b2 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 _0xe3e4=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe3e4,0xc3));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4e3e('0x0'));var util=require(_0x4e3e('0x1'));var path=require(_0x4e3e('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e3e('0x3'));var router=express[_0x4e3e('0x4')]();var auth=require(_0x4e3e('0x5'));var interaction=require(_0x4e3e('0x6'));var config=require(_0x4e3e('0x7'));var controller=require('./chatProactiveAction.controller');router[_0x4e3e('0x8')]('/:id',auth[_0x4e3e('0x9')](),controller[_0x4e3e('0xa')]);router[_0x4e3e('0xb')]('/',auth[_0x4e3e('0x9')](),controller[_0x4e3e('0xc')]);router[_0x4e3e('0xd')](_0x4e3e('0xe'),auth[_0x4e3e('0x9')](),controller[_0x4e3e('0xf')]);router[_0x4e3e('0x10')](_0x4e3e('0xe'),auth[_0x4e3e('0x9')](),controller[_0x4e3e('0x11')]);module[_0x4e3e('0x12')]=router; \ No newline at end of file +var _0xaf2d=['isAuthenticated','post','create','put','/:id','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get'];(function(_0x415e8c,_0x3b0a8f){var _0x16bb48=function(_0x1ed8e4){while(--_0x1ed8e4){_0x415e8c['push'](_0x415e8c['shift']());}};_0x16bb48(++_0x3b0a8f);}(_0xaf2d,0xbc));var _0xdaf2=function(_0x3c6358,_0x133fbb){_0x3c6358=_0x3c6358-0x0;var _0x15974d=_0xaf2d[_0x3c6358];return _0x15974d;};'use strict';var multer=require('multer');var util=require(_0xdaf2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdaf2('0x1'));var router=express[_0xdaf2('0x2')]();var auth=require(_0xdaf2('0x3'));var interaction=require(_0xdaf2('0x4'));var config=require('../../config/environment');var controller=require(_0xdaf2('0x5'));router[_0xdaf2('0x6')]('/:id',auth[_0xdaf2('0x7')](),controller['show']);router[_0xdaf2('0x8')]('/',auth['isAuthenticated'](),controller[_0xdaf2('0x9')]);router[_0xdaf2('0xa')](_0xdaf2('0xb'),auth[_0xdaf2('0x7')](),controller[_0xdaf2('0xc')]);router[_0xdaf2('0xd')]('/:id',auth[_0xdaf2('0x7')](),controller[_0xdaf2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3446b58..2340e3f 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 _0x1bb4=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x39fa73,_0x2e7026){var _0x52253d=function(_0x3fe183){while(--_0x3fe183){_0x39fa73['push'](_0x39fa73['shift']());}};_0x52253d(++_0x2e7026);}(_0x1bb4,0xa7));var _0x41bb=function(_0x770422,_0x23fe13){_0x770422=_0x770422-0x0;var _0x4623c7=_0x1bb4[_0x770422];return _0x4623c7;};'use strict';var Sequelize=require(_0x41bb('0x0'));module['exports']={'name':{'type':Sequelize[_0x41bb('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x41bb('0x1')]},'timeout':{'type':Sequelize[_0x41bb('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x41bb('0x3')](_0x41bb('0x4'),_0x41bb('0x5'),_0x41bb('0x6'))}}; \ No newline at end of file +var _0xbe74=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x584af0,_0x40696b){var _0x13837e=function(_0xa2cbc1){while(--_0xa2cbc1){_0x584af0['push'](_0x584af0['shift']());}};_0x13837e(++_0x40696b);}(_0xbe74,0x15e));var _0x4be7=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0xbe74[_0x3c4dad];return _0x1a4f49;};'use strict';var Sequelize=require(_0x4be7('0x0'));module[_0x4be7('0x1')]={'name':{'type':Sequelize[_0x4be7('0x2')],'unique':_0x4be7('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4be7('0x2')]},'timeout':{'type':Sequelize[_0x4be7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4be7('0x5')]('rrmemory',_0x4be7('0x6'),_0x4be7('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index b74b4bd..c230379 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 _0xa216=['index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','ChatQueue','includeAll','show','params','filtears','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','order','ChatQueueId','findAll','UserId','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','pick','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','userChatQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','name','send'];(function(_0x147078,_0x4e509c){var _0x2d2f5c=function(_0x231582){while(--_0x231582){_0x147078['push'](_0x147078['shift']());}};_0x2d2f5c(++_0x4e509c);}(_0xa216,0xf4));var _0x6a21=function(_0x11dd13,_0x45d34d){_0x11dd13=_0x11dd13-0x0;var _0x58e5d8=_0xa216[_0x11dd13];return _0x58e5d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a21('0x0'));var rimraf=require(_0x6a21('0x1'));var zipdir=require(_0x6a21('0x2'));var jsonpatch=require(_0x6a21('0x3'));var rp=require(_0x6a21('0x4'));var moment=require(_0x6a21('0x5'));var BPromise=require(_0x6a21('0x6'));var Mustache=require(_0x6a21('0x7'));var util=require(_0x6a21('0x8'));var path=require('path');var sox=require(_0x6a21('0x9'));var csv=require(_0x6a21('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a21('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a21('0xa'));var querystring=require(_0x6a21('0xc'));var Papa=require(_0x6a21('0xd'));var Redis=require(_0x6a21('0xe'));var authService=require(_0x6a21('0xf'));var qs=require(_0x6a21('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a21('0x11'));var logger=require(_0x6a21('0x12'))(_0x6a21('0x13'));var utils=require(_0x6a21('0x14'));var config=require(_0x6a21('0x15'));var licenseUtil=require(_0x6a21('0x16'));var db=require('../../mysqldb')['db'];config[_0x6a21('0x17')]=_[_0x6a21('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6a21('0x19'))(new Redis(config[_0x6a21('0x17')]));require(_0x6a21('0x1a'))[_0x6a21('0x1b')](socket);var jayson=require(_0x6a21('0x1c'));var client=jayson[_0x6a21('0x1d')][_0x6a21('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x360e2e,_0x2448c8,_0xf878f6,_0x3fb700){return new BPromise(function(_0x3cb81a,_0x4525e8){var _0x4e7cf7=_0x3fb700||client;return _0x4e7cf7[_0x6a21('0x1f')](_0x360e2e,_0xf878f6)[_0x6a21('0x20')](function(_0x2b823b){logger[_0x6a21('0x21')](_0x6a21('0x22'),_0x2448c8,_0x6a21('0x23'));logger[_0x6a21('0x24')](_0x6a21('0x25'),_0x2448c8,_0x6a21('0x23'),JSON[_0x6a21('0x26')](_0x2b823b));if(_0x2b823b[_0x6a21('0x27')]){if(_0x2b823b['error'][_0x6a21('0x28')]===0x1f4){logger[_0x6a21('0x27')](_0x6a21('0x22'),_0x2448c8,_0x2b823b[_0x6a21('0x27')][_0x6a21('0x29')]);return _0x4525e8(_0x2b823b[_0x6a21('0x27')][_0x6a21('0x29')]);}logger[_0x6a21('0x27')](_0x6a21('0x22'),_0x2448c8,_0x2b823b[_0x6a21('0x27')]['message']);return _0x3cb81a(_0x2b823b['error'][_0x6a21('0x29')]);}else{logger['info'](_0x6a21('0x22'),_0x2448c8,_0x6a21('0x23'));_0x3cb81a(_0x2b823b[_0x6a21('0x2a')][_0x6a21('0x29')]);}})[_0x6a21('0x2b')](function(_0xe52375){logger[_0x6a21('0x27')](_0x6a21('0x22'),_0x2448c8,_0xe52375);_0x4525e8(_0xe52375);});});}function respondWithStatusCode(_0x3d69f9,_0x3d445e){_0x3d445e=_0x3d445e||0xcc;return function(_0x358fd0){if(_0x358fd0){return _0x3d69f9[_0x6a21('0x2c')](_0x3d445e);}return _0x3d69f9[_0x6a21('0x2d')](_0x3d445e)[_0x6a21('0x2e')]();};}function respondWithResult(_0x14e47a,_0x1e45dc){_0x1e45dc=_0x1e45dc||0xc8;return function(_0x45aa2b){if(_0x45aa2b){return _0x14e47a[_0x6a21('0x2d')](_0x1e45dc)[_0x6a21('0x2f')](_0x45aa2b);}};}function respondWithFilteredResult(_0x1c84c5,_0x10e6a6){return function(_0x2e886e){if(_0x2e886e){var _0x1284cb=_0x2e886e[_0x6a21('0x30')],_0x2f1ac0=_0x10e6a6[_0x6a21('0x31')],_0x8cc2ed=_0x10e6a6[_0x6a21('0x31')]+_0x10e6a6[_0x6a21('0x32')],_0x1014a9;if(_0x8cc2ed>=_0x1284cb){_0x8cc2ed=_0x1284cb;_0x1014a9=0xc8;}else{_0x1014a9=0xce;}_0x1c84c5[_0x6a21('0x2d')](_0x1014a9);return _0x1c84c5[_0x6a21('0x33')](_0x6a21('0x34'),_0x2f1ac0+'-'+_0x8cc2ed+'/'+_0x1284cb)['json'](_0x2e886e);}return null;};}function patchUpdates(_0x28f18f){return function(_0x570920){try{jsonpatch[_0x6a21('0x35')](_0x570920,_0x28f18f,!![]);}catch(_0x511df4){return BPromise[_0x6a21('0x36')](_0x511df4);}return _0x570920[_0x6a21('0x37')]();};}function saveUpdates(_0x5e032e,_0x51a606){return function(_0x23ef89){if(_0x23ef89){return _0x23ef89['update'](_0x5e032e)[_0x6a21('0x20')](function(_0x5afa7d){return _0x5afa7d;});}return null;};}function removeEntity(_0x1b32bb,_0x697257){return function(_0x10533c){if(_0x10533c){return _0x10533c[_0x6a21('0x38')]()['then'](function(){var _0x2604e3=_0x10533c[_0x6a21('0x39')]({'plain':!![]});var _0x8fff3d=_0x6a21('0x3a');return db[_0x6a21('0x3b')][_0x6a21('0x38')]({'where':{'type':_0x8fff3d,'resourceId':_0x2604e3['id']}})[_0x6a21('0x20')](function(){return _0x10533c;});})['then'](function(){_0x1b32bb[_0x6a21('0x2d')](0xcc)[_0x6a21('0x2e')]();});}};}function handleEntityNotFound(_0x3aef8c,_0x22fd81){return function(_0xa1b763){if(!_0xa1b763){_0x3aef8c[_0x6a21('0x2c')](0x194);}return _0xa1b763;};}function handleError(_0x3d5d4e,_0x57c15f){_0x57c15f=_0x57c15f||0x1f4;return function(_0x1397b1){logger[_0x6a21('0x27')](_0x1397b1['stack']);if(_0x1397b1[_0x6a21('0x3c')]){delete _0x1397b1['name'];}_0x3d5d4e[_0x6a21('0x2d')](_0x57c15f)[_0x6a21('0x3d')](_0x1397b1);};}exports[_0x6a21('0x3e')]=function(_0x139eef,_0x338af9){var _0x519d4d={},_0x48f36a={},_0x5392c1={'count':0x0,'rows':[]};var _0x16b301=_[_0x6a21('0x3f')](db['ChatQueue'][_0x6a21('0x40')],function(_0x1c06f6){return{'name':_0x1c06f6[_0x6a21('0x41')],'type':_0x1c06f6['type'][_0x6a21('0x42')]};});_0x48f36a['model']=_[_0x6a21('0x3f')](_0x16b301,_0x6a21('0x3c'));_0x48f36a[_0x6a21('0x43')]=_[_0x6a21('0x44')](_0x139eef[_0x6a21('0x43')]);_0x48f36a[_0x6a21('0x45')]=_[_0x6a21('0x46')](_0x48f36a[_0x6a21('0x47')],_0x48f36a['query']);_0x519d4d[_0x6a21('0x48')]=_['intersection'](_0x48f36a[_0x6a21('0x47')],qs[_0x6a21('0x49')](_0x139eef[_0x6a21('0x43')][_0x6a21('0x49')]));_0x519d4d[_0x6a21('0x48')]=_0x519d4d['attributes'][_0x6a21('0x4a')]?_0x519d4d[_0x6a21('0x48')]:_0x48f36a[_0x6a21('0x47')];if(!_0x139eef[_0x6a21('0x43')][_0x6a21('0x4b')](_0x6a21('0x4c'))){_0x519d4d[_0x6a21('0x32')]=qs[_0x6a21('0x32')](_0x139eef[_0x6a21('0x43')][_0x6a21('0x32')]);_0x519d4d[_0x6a21('0x31')]=qs[_0x6a21('0x31')](_0x139eef['query'][_0x6a21('0x31')]);}_0x519d4d['order']=qs['sort'](_0x139eef['query'][_0x6a21('0x4d')]);_0x519d4d[_0x6a21('0x4e')]=qs[_0x6a21('0x45')](_['pick'](_0x139eef[_0x6a21('0x43')],_0x48f36a[_0x6a21('0x45')]),_0x16b301);if(_0x139eef[_0x6a21('0x43')][_0x6a21('0x4f')]){_0x519d4d[_0x6a21('0x4e')]=_[_0x6a21('0x50')](_0x519d4d[_0x6a21('0x4e')],{'$or':_['map'](_0x16b301,function(_0x59893d){if(_0x59893d[_0x6a21('0x51')]!==_0x6a21('0x52')){var _0x53c1fc={};_0x53c1fc[_0x59893d[_0x6a21('0x3c')]]={'$like':'%'+_0x139eef[_0x6a21('0x43')]['filter']+'%'};return _0x53c1fc;}})});}_0x519d4d=_[_0x6a21('0x50')]({},_0x519d4d,_0x139eef['options']);var _0x2f53e5={'where':_0x519d4d[_0x6a21('0x4e')]};return db[_0x6a21('0x53')]['count'](_0x2f53e5)[_0x6a21('0x20')](function(_0x198d82){_0x5392c1[_0x6a21('0x30')]=_0x198d82;if(_0x139eef[_0x6a21('0x43')][_0x6a21('0x54')]){_0x519d4d['include']=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x519d4d);})[_0x6a21('0x20')](function(_0x1832bf){_0x5392c1['rows']=_0x1832bf;return _0x5392c1;})['then'](respondWithFilteredResult(_0x338af9,_0x519d4d))[_0x6a21('0x2b')](handleError(_0x338af9,null));};exports[_0x6a21('0x55')]=function(_0x4c3aca,_0x5c2496){var _0x292927={'raw':!![],'where':{'id':_0x4c3aca[_0x6a21('0x56')]['id']}},_0x29454b={};_0x29454b[_0x6a21('0x47')]=_[_0x6a21('0x44')](db[_0x6a21('0x53')][_0x6a21('0x40')]);_0x29454b[_0x6a21('0x43')]=_[_0x6a21('0x44')](_0x4c3aca[_0x6a21('0x43')]);_0x29454b[_0x6a21('0x57')]=_[_0x6a21('0x46')](_0x29454b['model'],_0x29454b[_0x6a21('0x43')]);_0x292927[_0x6a21('0x48')]=_[_0x6a21('0x46')](_0x29454b[_0x6a21('0x47')],qs['fields'](_0x4c3aca['query']['fields']));_0x292927['attributes']=_0x292927[_0x6a21('0x48')][_0x6a21('0x4a')]?_0x292927[_0x6a21('0x48')]:_0x29454b[_0x6a21('0x47')];if(_0x4c3aca['query'][_0x6a21('0x54')]){_0x292927[_0x6a21('0x58')]=[{'all':!![]}];}_0x292927=_['merge']({},_0x292927,_0x4c3aca[_0x6a21('0x59')]);return db[_0x6a21('0x53')][_0x6a21('0x5a')](_0x292927)['then'](handleEntityNotFound(_0x5c2496,null))[_0x6a21('0x20')](respondWithResult(_0x5c2496,null))[_0x6a21('0x2b')](handleError(_0x5c2496,null));};exports[_0x6a21('0x5b')]=function(_0x39884e,_0x2ea446){return db[_0x6a21('0x53')]['create'](_0x39884e[_0x6a21('0x5c')],{})[_0x6a21('0x20')](function(_0x277405){var _0x5afaec=_0x39884e[_0x6a21('0x5d')][_0x6a21('0x39')]({'plain':!![]});if(!_0x5afaec)throw new Error(_0x6a21('0x5e'));if(_0x5afaec[_0x6a21('0x5f')]===_0x6a21('0x5d')){var _0x56fdc1=_0x277405[_0x6a21('0x39')]({'plain':!![]});var _0x621d83=_0x6a21('0x3a');return db[_0x6a21('0x60')]['find']({'where':{'name':_0x621d83,'userProfileId':_0x5afaec['userProfileId']},'raw':!![]})['then'](function(_0x57a6a2){if(_0x57a6a2&&_0x57a6a2[_0x6a21('0x61')]===0x0){return db[_0x6a21('0x3b')]['create']({'name':_0x56fdc1['name'],'resourceId':_0x56fdc1['id'],'type':_0x57a6a2[_0x6a21('0x3c')],'sectionId':_0x57a6a2['id']},{})[_0x6a21('0x20')](function(){return _0x277405;});}else{return _0x277405;}})['catch'](function(_0x554ef6){logger['error'](_0x6a21('0x62'),_0x554ef6);throw _0x554ef6;});}return _0x277405;})[_0x6a21('0x20')](respondWithResult(_0x2ea446,0xc9))[_0x6a21('0x2b')](handleError(_0x2ea446,null));};exports[_0x6a21('0x63')]=function(_0x426551,_0x58d375){if(_0x426551['body']['id']){delete _0x426551[_0x6a21('0x5c')]['id'];}return db[_0x6a21('0x53')][_0x6a21('0x5a')]({'where':{'id':_0x426551[_0x6a21('0x56')]['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x58d375,null))['then'](saveUpdates(_0x426551['body'],null))[_0x6a21('0x20')](respondWithResult(_0x58d375,null))[_0x6a21('0x2b')](handleError(_0x58d375,null));};exports[_0x6a21('0x38')]=function(_0x444c03,_0x46107a){return db[_0x6a21('0x53')][_0x6a21('0x5a')]({'where':{'id':_0x444c03[_0x6a21('0x56')]['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x46107a,null))[_0x6a21('0x20')](removeEntity(_0x46107a,null))[_0x6a21('0x2b')](handleError(_0x46107a,null));};exports[_0x6a21('0x64')]=function(_0x245f4e,_0x1a7638){return db[_0x6a21('0x53')][_0x6a21('0x64')]()[_0x6a21('0x20')](respondWithResult(_0x1a7638,null))[_0x6a21('0x2b')](handleError(_0x1a7638,null));};exports[_0x6a21('0x65')]=function(_0x3b3c87,_0x256dff,_0x555584){var _0x4846dd={'raw':!![],'where':{}},_0x15d936={},_0x2e15b8;return db['ChatQueue']['findOne']({'where':{'id':_0x3b3c87[_0x6a21('0x56')]['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x256dff,null))[_0x6a21('0x20')](function(_0x54ea6b){if(_0x54ea6b){_0x2e15b8=_0x54ea6b[_0x6a21('0x39')]({'plain':!![]});_0x15d936[_0x6a21('0x47')]=_[_0x6a21('0x44')](db[_0x6a21('0x66')][_0x6a21('0x40')]);_0x15d936[_0x6a21('0x43')]=_[_0x6a21('0x44')](_0x3b3c87[_0x6a21('0x43')]);_0x15d936[_0x6a21('0x45')]=_[_0x6a21('0x46')](_0x15d936['model'],_0x15d936[_0x6a21('0x43')]);_0x4846dd[_0x6a21('0x48')]=_[_0x6a21('0x46')](_0x15d936[_0x6a21('0x47')],qs[_0x6a21('0x49')](_0x3b3c87[_0x6a21('0x43')]['fields']));_0x4846dd[_0x6a21('0x48')]=_0x4846dd[_0x6a21('0x48')]['length']?_0x4846dd[_0x6a21('0x48')]:_0x15d936[_0x6a21('0x47')];if(!_0x3b3c87[_0x6a21('0x43')][_0x6a21('0x4b')](_0x6a21('0x4c'))){_0x4846dd['limit']=qs[_0x6a21('0x32')](_0x3b3c87[_0x6a21('0x43')]['limit']);_0x4846dd[_0x6a21('0x31')]=qs[_0x6a21('0x31')](_0x3b3c87['query'][_0x6a21('0x31')]);}_0x4846dd[_0x6a21('0x67')]=qs[_0x6a21('0x4d')](_0x3b3c87['query'][_0x6a21('0x4d')]);_0x4846dd[_0x6a21('0x4e')]=qs[_0x6a21('0x45')](_['pick'](_0x3b3c87[_0x6a21('0x43')],_0x15d936[_0x6a21('0x45')]));_0x4846dd[_0x6a21('0x4e')][_0x6a21('0x68')]=_0x54ea6b['id'];if(_0x3b3c87['query']['filter']){_0x4846dd[_0x6a21('0x4e')]=_['merge'](_0x4846dd[_0x6a21('0x4e')],{'$or':_[_0x6a21('0x3f')](_0x4846dd[_0x6a21('0x48')],function(_0x58f4c5){var _0x37948b={};_0x37948b[_0x58f4c5]={'$like':'%'+_0x3b3c87[_0x6a21('0x43')][_0x6a21('0x4f')]+'%'};return _0x37948b;})});}_0x4846dd=_['merge']({},_0x4846dd,_0x3b3c87[_0x6a21('0x59')]);return db[_0x6a21('0x66')][_0x6a21('0x69')](_0x4846dd);}})[_0x6a21('0x20')](function(_0x573acd){if(_0x573acd){return db['User']['findAndCountAll']({'where':{'id':_[_0x6a21('0x3f')](_0x573acd,_0x6a21('0x6a')),'role':'agent'},'attributes':['id',_0x6a21('0x3c'),_0x6a21('0x6b'),_0x6a21('0x6c'),_0x6a21('0x6d')]});}})[_0x6a21('0x20')](function(_0x4fb7a5){if(_0x4fb7a5){return{'count':_0x4fb7a5[_0x6a21('0x30')],'rows':_[_0x6a21('0x3f')](_0x4fb7a5[_0x6a21('0x6e')],function(_0x5bd75b){return{'membername':_0x5bd75b[_0x6a21('0x3c')],'UserId':_0x5bd75b['id'],'queue_name':_0x2e15b8[_0x6a21('0x3c')],'ChatQueueId':_0x2e15b8['id'],'interface':util[_0x6a21('0x6f')](_0x6a21('0x70'),_0x6a21('0x71'),_0x5bd75b[_0x6a21('0x3c')]),'penalty':0x0,'paused':_0x5bd75b[_0x6a21('0x6b')],'createdAt':_0x5bd75b[_0x6a21('0x6d')],'updatedAt':_0x5bd75b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6a21('0x20')](respondWithFilteredResult(_0x256dff,_0x4846dd))[_0x6a21('0x2b')](handleError(_0x256dff,null));};exports[_0x6a21('0x72')]=function(_0x5875fb,_0x4a21cf,_0xc5067a){var _0x550b90={};var _0x3e3a28={};var _0x4a6c8a;var _0xe43681;return db['ChatQueue'][_0x6a21('0x73')]({'where':{'id':_0x5875fb['params']['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x4a21cf,null))[_0x6a21('0x20')](function(_0xa3c1fc){if(_0xa3c1fc){_0x4a6c8a=_0xa3c1fc;_0x3e3a28[_0x6a21('0x47')]=_[_0x6a21('0x44')](db[_0x6a21('0x74')][_0x6a21('0x40')]);_0x3e3a28[_0x6a21('0x43')]=_['keys'](_0x5875fb[_0x6a21('0x43')]);_0x3e3a28[_0x6a21('0x45')]=_[_0x6a21('0x46')](_0x3e3a28['model'],_0x3e3a28['query']);_0x550b90['attributes']=_[_0x6a21('0x46')](_0x3e3a28[_0x6a21('0x47')],qs['fields'](_0x5875fb['query'][_0x6a21('0x49')]));_0x550b90[_0x6a21('0x48')]=_0x550b90[_0x6a21('0x48')]['length']?_0x550b90['attributes']:_0x3e3a28[_0x6a21('0x47')];_0x550b90[_0x6a21('0x67')]=qs[_0x6a21('0x4d')](_0x5875fb['query'][_0x6a21('0x4d')]);_0x550b90[_0x6a21('0x4e')]=qs[_0x6a21('0x45')](_[_0x6a21('0x75')](_0x5875fb[_0x6a21('0x43')],_0x3e3a28['filters']));if(_0x5875fb[_0x6a21('0x43')][_0x6a21('0x4f')]){_0x550b90[_0x6a21('0x4e')]=_[_0x6a21('0x50')](_0x550b90[_0x6a21('0x4e')],{'$or':_[_0x6a21('0x3f')](_0x550b90[_0x6a21('0x48')],function(_0x22541f){var _0x4007a5={};_0x4007a5[_0x22541f]={'$like':'%'+_0x5875fb[_0x6a21('0x43')][_0x6a21('0x4f')]+'%'};return _0x4007a5;})});}_0x550b90=_[_0x6a21('0x50')]({},_0x550b90,_0x5875fb[_0x6a21('0x59')]);return _0x4a6c8a[_0x6a21('0x72')](_0x550b90);}})[_0x6a21('0x20')](function(_0x4de9e4){if(_0x4de9e4){_0xe43681=_0x4de9e4[_0x6a21('0x4a')];if(!_0x5875fb[_0x6a21('0x43')]['hasOwnProperty']('nolimit')){_0x550b90[_0x6a21('0x32')]=qs[_0x6a21('0x32')](_0x5875fb['query'][_0x6a21('0x32')]);_0x550b90['offset']=qs[_0x6a21('0x31')](_0x5875fb[_0x6a21('0x43')][_0x6a21('0x31')]);}return _0x4a6c8a['getTeams'](_0x550b90);}})[_0x6a21('0x20')](function(_0x21bfd3){if(_0x21bfd3){return _0x21bfd3?{'count':_0xe43681,'rows':_0x21bfd3}:null;}})['then'](respondWithResult(_0x4a21cf,null))[_0x6a21('0x2b')](handleError(_0x4a21cf,null));};exports[_0x6a21('0x76')]=function(_0x5b59b7,_0x37d5db,_0x4f27e8){var _0xfc0f9a=_0x5b59b7['body'][_0x6a21('0x77')];return db['Team'][_0x6a21('0x69')]({'where':{'id':_0xfc0f9a},'attributes':['id'],'include':[{'model':db[_0x6a21('0x78')],'as':'Agents','attributes':['id',_0x6a21('0x3c'),_0x6a21('0x79'),_0x6a21('0x7a'),_0x6a21('0x7b')],'raw':!![]}]})['then'](function(_0x3c5bc5){if(_0x3c5bc5){var _0x585876=_[_0x6a21('0x7c')](_0x3c5bc5,function(_0x13b3d4){var _0x54c0a7=_0x13b3d4[_0x6a21('0x39')]({'plain':!![]});return _0x54c0a7[_0x6a21('0x7d')];});return db['ChatQueue'][_0x6a21('0x5a')]({'where':{'id':_0x5b59b7[_0x6a21('0x56')]['id']}})['then'](function(_0x1c996c){return db[_0x6a21('0x7e')][_0x6a21('0x7f')](function(_0x119ce4){return _0x1c996c['addTeams'](_0xfc0f9a,{'transaction':_0x119ce4})[_0x6a21('0x20')](function(){return BPromise[_0x6a21('0x80')](_0x585876,function(_0x127b79){return db[_0x6a21('0x66')]['findOrCreate']({'where':{'UserId':_0x127b79['id'],'ChatQueueId':_0x5b59b7[_0x6a21('0x56')]['id']},'transaction':_0x119ce4});});})['then'](function(){_0x585876[_0x6a21('0x81')](function(_0xdf3852){socket[_0x6a21('0x82')]('userChatQueue:save',{'UserId':_0xdf3852['id'],'ChatQueueId':_0x1c996c['id']});});});});});}})[_0x6a21('0x20')](respondWithStatusCode(_0x37d5db,null))[_0x6a21('0x2b')](handleError(_0x37d5db,null));};exports[_0x6a21('0x83')]=function(_0x269d2b,_0x15eb20,_0x41b67b){return db['Team'][_0x6a21('0x69')]({'where':{'id':_0x269d2b['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6a21('0x78')],'as':_0x6a21('0x7d'),'attributes':['id'],'raw':!![]}]})[_0x6a21('0x20')](handleEntityNotFound(_0x15eb20,null))['then'](function(_0x43c4e2){var _0x1561fe=_[_0x6a21('0x3f')](_0x43c4e2,'id');var _0x2890cf=[];var _0x3f87c7=[];var _0x4b7753=squel['select']();_0x4b7753[_0x6a21('0x84')](_0x6a21('0x85'))[_0x6a21('0x86')](_0x6a21('0x87'),'tq')[_0x6a21('0x88')](_0x6a21('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6a21('0x4e')](_0x6a21('0x8a'),_0x269d2b[_0x6a21('0x56')]['id']);for(var _0x29fe2a=0x0;_0x29fe2a<_0x43c4e2[_0x6a21('0x4a')];_0x29fe2a+=0x1){let _0x4eaeaf=_0x43c4e2[_0x29fe2a];for(var _0x14a454=0x0;_0x14a454<_0x4eaeaf[_0x6a21('0x7d')][_0x6a21('0x4a')];_0x14a454+=0x1){let _0x10bc4f=_0x4eaeaf['Agents'][_0x14a454];var _0x32c87e=_0x4b7753['clone']();_0x32c87e[_0x6a21('0x4e')]('ut.UserId\x20=\x20?',_0x10bc4f['id']);_0x3f87c7[_0x6a21('0x8b')](db[_0x6a21('0x7e')][_0x6a21('0x43')](_0x32c87e[_0x6a21('0x8c')](),{'type':db['sequelize'][_0x6a21('0x8d')]['SELECT']})[_0x6a21('0x20')](function(_0x403926){if(_0x403926[_0x6a21('0x4a')]===0x1){return _0x10bc4f['id'];}else{var _0x2aa798=_[_0x6a21('0x8e')](_['map'](_0x403926,_0x6a21('0x8f')),function(_0x415366){return _[_0x6a21('0x90')](_0x1561fe,_0x415366);});if(_0x2aa798){return _0x10bc4f['id'];}}}));}}return BPromise['all'](_0x3f87c7)[_0x6a21('0x20')](function(_0x491e21){_0x2890cf=_(_0x2890cf)[_0x6a21('0x91')](_0x491e21)['compact']()[_0x6a21('0x92')]();return db['ChatQueue'][_0x6a21('0x5a')]({'where':{'id':_0x269d2b[_0x6a21('0x56')]['id']}})[_0x6a21('0x20')](function(_0x3b19ab){return db[_0x6a21('0x7e')][_0x6a21('0x7f')](function(_0x25be96){return _0x3b19ab[_0x6a21('0x83')](_0x269d2b[_0x6a21('0x43')][_0x6a21('0x77')],{'transaction':_0x25be96})['then'](function(){if(!_[_0x6a21('0x93')](_0x2890cf)){return _0x3b19ab[_0x6a21('0x94')](_0x2890cf,{'transaction':_0x25be96});}})[_0x6a21('0x20')](function(){_0x2890cf[_0x6a21('0x81')](function(_0x335fe2){socket[_0x6a21('0x82')](_0x6a21('0x95'),{'UserId':_0x335fe2,'ChatQueueId':_0x3b19ab['id']});});});});});});})['then'](respondWithStatusCode(_0x15eb20,null))[_0x6a21('0x2b')](handleError(_0x15eb20,null));};exports[_0x6a21('0x96')]=function(_0x5a0941,_0x27303e,_0x1bb305){return db[_0x6a21('0x53')]['find']({'where':{'id':_0x5a0941['params']['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x27303e,null))['then'](function(_0x226a0a){if(_0x226a0a){return _0x226a0a[_0x6a21('0x96')](_0x5a0941['body'][_0x6a21('0x77')],_['omit'](_0x5a0941[_0x6a21('0x5c')],['ids','id'])||{})['spread'](function(_0x5242d0){for(var _0xc5277f=0x0;_0xc5277f<_0x5a0941[_0x6a21('0x5c')][_0x6a21('0x77')][_0x6a21('0x4a')];_0xc5277f+=0x1){socket['emit'](_0x6a21('0x97'),{'UserId':_0x5a0941['body'][_0x6a21('0x77')][_0xc5277f],'ChatQueueId':_0x5a0941['params']['id']});}return _0x5242d0;});}})[_0x6a21('0x20')](respondWithResult(_0x27303e,null))[_0x6a21('0x2b')](handleError(_0x27303e,null));};exports['removeAgents']=function(_0x488985,_0x1b5bb1,_0x56eec6){return db['ChatQueue']['find']({'where':{'id':_0x488985[_0x6a21('0x56')]['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x1b5bb1,null))[_0x6a21('0x20')](function(_0x2342e8){if(_0x2342e8){return _0x2342e8['removeAgents'](_0x488985[_0x6a21('0x43')][_0x6a21('0x77')])[_0x6a21('0x20')](function(){if(_['isArray'](_0x488985[_0x6a21('0x43')]['ids'])){for(var _0x4a9b83=0x0;_0x4a9b83<_0x488985['query']['ids'][_0x6a21('0x4a')];_0x4a9b83+=0x1){socket[_0x6a21('0x82')](_0x6a21('0x95'),{'UserId':Number(_0x488985[_0x6a21('0x43')][_0x6a21('0x77')][_0x4a9b83]),'ChatQueueId':Number(_0x488985[_0x6a21('0x56')]['id'])});}}else{socket['emit'](_0x6a21('0x95'),{'UserId':Number(_0x488985['query']['ids']),'ChatQueueId':Number(_0x488985['params']['id'])});}});}})[_0x6a21('0x20')](respondWithStatusCode(_0x1b5bb1,null))['catch'](handleError(_0x1b5bb1,null));};exports['getAgents']=function(_0x39251a,_0x1db770,_0x3774b5){var _0x4a8e18={};var _0x56e166={};var _0x26a4e9;var _0x2f0aed;return db['ChatQueue'][_0x6a21('0x73')]({'where':{'id':_0x39251a['params']['id']}})[_0x6a21('0x20')](handleEntityNotFound(_0x1db770,null))[_0x6a21('0x20')](function(_0x3ae001){if(_0x3ae001){_0x26a4e9=_0x3ae001;_0x56e166[_0x6a21('0x47')]=_[_0x6a21('0x44')](db[_0x6a21('0x78')][_0x6a21('0x40')]);_0x56e166['query']=_[_0x6a21('0x44')](_0x39251a['query']);_0x56e166[_0x6a21('0x45')]=_[_0x6a21('0x46')](_0x56e166[_0x6a21('0x47')],_0x56e166[_0x6a21('0x43')]);_0x4a8e18[_0x6a21('0x48')]=_[_0x6a21('0x46')](_0x56e166[_0x6a21('0x47')],qs[_0x6a21('0x49')](_0x39251a[_0x6a21('0x43')][_0x6a21('0x49')]));_0x4a8e18[_0x6a21('0x48')]=_0x4a8e18[_0x6a21('0x48')]['length']?_0x4a8e18['attributes']:_0x56e166[_0x6a21('0x47')];_0x4a8e18[_0x6a21('0x67')]=qs[_0x6a21('0x4d')](_0x39251a[_0x6a21('0x43')][_0x6a21('0x4d')]);_0x4a8e18[_0x6a21('0x4e')]=qs[_0x6a21('0x45')](_[_0x6a21('0x75')](_0x39251a[_0x6a21('0x43')],_0x56e166[_0x6a21('0x45')]));if(_0x39251a['query'][_0x6a21('0x4f')]){_0x4a8e18[_0x6a21('0x4e')]=_[_0x6a21('0x50')](_0x4a8e18['where'],{'$or':_[_0x6a21('0x3f')](_0x4a8e18[_0x6a21('0x48')],function(_0x204786){var _0x4bea2b={};_0x4bea2b[_0x204786]={'$like':'%'+_0x39251a['query'][_0x6a21('0x4f')]+'%'};return _0x4bea2b;})});}_0x4a8e18=_['merge']({},_0x4a8e18,_0x39251a[_0x6a21('0x59')]);return _0x26a4e9[_0x6a21('0x98')](_0x4a8e18);}})[_0x6a21('0x20')](function(_0x539e33){if(_0x539e33){_0x2f0aed=_0x539e33[_0x6a21('0x4a')];if(!_0x39251a['query']['hasOwnProperty']('nolimit')){_0x4a8e18[_0x6a21('0x32')]=qs['limit'](_0x39251a[_0x6a21('0x43')][_0x6a21('0x32')]);_0x4a8e18[_0x6a21('0x31')]=qs['offset'](_0x39251a[_0x6a21('0x43')][_0x6a21('0x31')]);}return _0x26a4e9[_0x6a21('0x98')](_0x4a8e18);}})[_0x6a21('0x20')](function(_0x35b189){if(_0x35b189){return _0x35b189?{'count':_0x2f0aed,'rows':_0x35b189}:null;}})[_0x6a21('0x20')](respondWithResult(_0x1db770,null))[_0x6a21('0x2b')](handleError(_0x1db770,null));}; \ No newline at end of file +var _0xcdcc=['rimraf','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','status','end','json','limit','set','apply','reject','save','update','ChatQueues','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','ChatQueue','count','includeAll','include','findAll','rows','show','params','keys','filtears','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','pick','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','user_has_teams','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','value','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format'];(function(_0x462a50,_0x1873f0){var _0x2f3489=function(_0x577409){while(--_0x577409){_0x462a50['push'](_0x462a50['shift']());}};_0x2f3489(++_0x1873f0);}(_0xcdcc,0x1d2));var _0xccdc=function(_0xd05757,_0x3ed66f){_0xd05757=_0xd05757-0x0;var _0x2190de=_0xcdcc[_0xd05757];return _0x2190de;};'use strict';var pdf=require(_0xccdc('0x0'));var emlformat=require(_0xccdc('0x1'));var rimraf=require(_0xccdc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xccdc('0x3'));var rp=require(_0xccdc('0x4'));var moment=require(_0xccdc('0x5'));var BPromise=require(_0xccdc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xccdc('0x7'));var sox=require(_0xccdc('0x8'));var csv=require('to-csv');var ejs=require(_0xccdc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xccdc('0xa'));var crypto=require(_0xccdc('0xb'));var jsforce=require(_0xccdc('0xc'));var deskjs=require(_0xccdc('0xd'));var toCsv=require(_0xccdc('0xe'));var querystring=require('querystring');var Papa=require(_0xccdc('0xf'));var Redis=require(_0xccdc('0x10'));var authService=require(_0xccdc('0x11'));var qs=require(_0xccdc('0x12'));var as=require(_0xccdc('0x13'));var hardwareService=require(_0xccdc('0x14'));var logger=require(_0xccdc('0x15'))('api');var utils=require(_0xccdc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xccdc('0x17'));var db=require('../../mysqldb')['db'];config[_0xccdc('0x18')]=_[_0xccdc('0x19')](config[_0xccdc('0x18')],{'host':_0xccdc('0x1a'),'port':0x18eb});var socket=require(_0xccdc('0x1b'))(new Redis(config[_0xccdc('0x18')]));require(_0xccdc('0x1c'))[_0xccdc('0x1d')](socket);var jayson=require(_0xccdc('0x1e'));var client=jayson[_0xccdc('0x1f')][_0xccdc('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x21fae8,_0x18057e,_0x58ec81,_0x76cee4){return new BPromise(function(_0x57dbe1,_0x375b86){var _0x4b9c8b=_0x76cee4||client;return _0x4b9c8b['request'](_0x21fae8,_0x58ec81)[_0xccdc('0x21')](function(_0x521fa1){logger[_0xccdc('0x22')]('ChatQueue,\x20%s,\x20%s',_0x18057e,'request\x20sent');logger[_0xccdc('0x23')](_0xccdc('0x24'),_0x18057e,'request\x20sent',JSON[_0xccdc('0x25')](_0x521fa1));if(_0x521fa1[_0xccdc('0x26')]){if(_0x521fa1[_0xccdc('0x26')][_0xccdc('0x27')]===0x1f4){logger[_0xccdc('0x26')](_0xccdc('0x28'),_0x18057e,_0x521fa1[_0xccdc('0x26')][_0xccdc('0x29')]);return _0x375b86(_0x521fa1[_0xccdc('0x26')][_0xccdc('0x29')]);}logger[_0xccdc('0x26')](_0xccdc('0x28'),_0x18057e,_0x521fa1[_0xccdc('0x26')][_0xccdc('0x29')]);return _0x57dbe1(_0x521fa1[_0xccdc('0x26')][_0xccdc('0x29')]);}else{logger[_0xccdc('0x22')](_0xccdc('0x28'),_0x18057e,'request\x20sent');_0x57dbe1(_0x521fa1[_0xccdc('0x2a')][_0xccdc('0x29')]);}})[_0xccdc('0x2b')](function(_0x1fe032){logger[_0xccdc('0x26')]('ChatQueue,\x20%s,\x20%s',_0x18057e,_0x1fe032);_0x375b86(_0x1fe032);});});}function respondWithStatusCode(_0x3b624f,_0x40d871){_0x40d871=_0x40d871||0xcc;return function(_0x31d4f0){if(_0x31d4f0){return _0x3b624f['sendStatus'](_0x40d871);}return _0x3b624f[_0xccdc('0x2c')](_0x40d871)[_0xccdc('0x2d')]();};}function respondWithResult(_0x4e5c88,_0x6c7ba4){_0x6c7ba4=_0x6c7ba4||0xc8;return function(_0x1e5e5a){if(_0x1e5e5a){return _0x4e5c88[_0xccdc('0x2c')](_0x6c7ba4)[_0xccdc('0x2e')](_0x1e5e5a);}};}function respondWithFilteredResult(_0x5184b1,_0xb65a50){return function(_0xb9fe59){if(_0xb9fe59){var _0x5d6f47=_0xb9fe59['count'],_0x504844=_0xb65a50['offset'],_0x347d98=_0xb65a50['offset']+_0xb65a50[_0xccdc('0x2f')],_0x4f5288;if(_0x347d98>=_0x5d6f47){_0x347d98=_0x5d6f47;_0x4f5288=0xc8;}else{_0x4f5288=0xce;}_0x5184b1[_0xccdc('0x2c')](_0x4f5288);return _0x5184b1[_0xccdc('0x30')]('Content-Range',_0x504844+'-'+_0x347d98+'/'+_0x5d6f47)[_0xccdc('0x2e')](_0xb9fe59);}return null;};}function patchUpdates(_0x2a8e90){return function(_0xf7731a){try{jsonpatch[_0xccdc('0x31')](_0xf7731a,_0x2a8e90,!![]);}catch(_0x31265d){return BPromise[_0xccdc('0x32')](_0x31265d);}return _0xf7731a[_0xccdc('0x33')]();};}function saveUpdates(_0x5f513b,_0x14028c){return function(_0x59710d){if(_0x59710d){return _0x59710d[_0xccdc('0x34')](_0x5f513b)[_0xccdc('0x21')](function(_0x175578){return _0x175578;});}return null;};}function removeEntity(_0x14f4f0,_0xec6a9c){return function(_0x10010c){if(_0x10010c){return _0x10010c['destroy']()[_0xccdc('0x21')](function(){var _0x53d5d2=_0x10010c['get']({'plain':!![]});var _0x3e523c=_0xccdc('0x35');return db['UserProfileResource'][_0xccdc('0x36')]({'where':{'type':_0x3e523c,'resourceId':_0x53d5d2['id']}})['then'](function(){return _0x10010c;});})[_0xccdc('0x21')](function(){_0x14f4f0[_0xccdc('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a578,_0x3547d3){return function(_0x350534){if(!_0x350534){_0x55a578[_0xccdc('0x37')](0x194);}return _0x350534;};}function handleError(_0x5d9f44,_0x14912d){_0x14912d=_0x14912d||0x1f4;return function(_0x1bffe0){logger[_0xccdc('0x26')](_0x1bffe0[_0xccdc('0x38')]);if(_0x1bffe0['name']){delete _0x1bffe0[_0xccdc('0x39')];}_0x5d9f44[_0xccdc('0x2c')](_0x14912d)[_0xccdc('0x3a')](_0x1bffe0);};}exports[_0xccdc('0x3b')]=function(_0x177e77,_0x29124e){var _0x340c15={},_0x1a14f6={},_0x10b7d8={'count':0x0,'rows':[]};var _0x4577a0=_[_0xccdc('0x3c')](db['ChatQueue'][_0xccdc('0x3d')],function(_0x2bc9ae){return{'name':_0x2bc9ae[_0xccdc('0x3e')],'type':_0x2bc9ae[_0xccdc('0x3f')][_0xccdc('0x40')]};});_0x1a14f6[_0xccdc('0x41')]=_[_0xccdc('0x3c')](_0x4577a0,_0xccdc('0x39'));_0x1a14f6[_0xccdc('0x42')]=_['keys'](_0x177e77['query']);_0x1a14f6[_0xccdc('0x43')]=_['intersection'](_0x1a14f6[_0xccdc('0x41')],_0x1a14f6[_0xccdc('0x42')]);_0x340c15['attributes']=_[_0xccdc('0x44')](_0x1a14f6[_0xccdc('0x41')],qs[_0xccdc('0x45')](_0x177e77[_0xccdc('0x42')][_0xccdc('0x45')]));_0x340c15[_0xccdc('0x46')]=_0x340c15[_0xccdc('0x46')][_0xccdc('0x47')]?_0x340c15['attributes']:_0x1a14f6[_0xccdc('0x41')];if(!_0x177e77['query'][_0xccdc('0x48')](_0xccdc('0x49'))){_0x340c15['limit']=qs[_0xccdc('0x2f')](_0x177e77[_0xccdc('0x42')][_0xccdc('0x2f')]);_0x340c15[_0xccdc('0x4a')]=qs[_0xccdc('0x4a')](_0x177e77[_0xccdc('0x42')]['offset']);}_0x340c15[_0xccdc('0x4b')]=qs[_0xccdc('0x4c')](_0x177e77[_0xccdc('0x42')][_0xccdc('0x4c')]);_0x340c15[_0xccdc('0x4d')]=qs[_0xccdc('0x43')](_['pick'](_0x177e77['query'],_0x1a14f6[_0xccdc('0x43')]),_0x4577a0);if(_0x177e77[_0xccdc('0x42')][_0xccdc('0x4e')]){_0x340c15[_0xccdc('0x4d')]=_[_0xccdc('0x4f')](_0x340c15[_0xccdc('0x4d')],{'$or':_['map'](_0x4577a0,function(_0x4b28e4){if(_0x4b28e4['type']!==_0xccdc('0x50')){var _0x4e8ccf={};_0x4e8ccf[_0x4b28e4[_0xccdc('0x39')]]={'$like':'%'+_0x177e77[_0xccdc('0x42')]['filter']+'%'};return _0x4e8ccf;}})});}_0x340c15=_['merge']({},_0x340c15,_0x177e77['options']);var _0x5791c9={'where':_0x340c15[_0xccdc('0x4d')]};return db[_0xccdc('0x51')][_0xccdc('0x52')](_0x5791c9)[_0xccdc('0x21')](function(_0x17c0cc){_0x10b7d8[_0xccdc('0x52')]=_0x17c0cc;if(_0x177e77['query'][_0xccdc('0x53')]){_0x340c15[_0xccdc('0x54')]=[{'all':!![]}];}return db[_0xccdc('0x51')][_0xccdc('0x55')](_0x340c15);})[_0xccdc('0x21')](function(_0x48954a){_0x10b7d8[_0xccdc('0x56')]=_0x48954a;return _0x10b7d8;})[_0xccdc('0x21')](respondWithFilteredResult(_0x29124e,_0x340c15))[_0xccdc('0x2b')](handleError(_0x29124e,null));};exports[_0xccdc('0x57')]=function(_0x364d58,_0x553cba){var _0x4b35ce={'raw':!![],'where':{'id':_0x364d58[_0xccdc('0x58')]['id']}},_0x25bfbf={};_0x25bfbf['model']=_['keys'](db[_0xccdc('0x51')][_0xccdc('0x3d')]);_0x25bfbf['query']=_[_0xccdc('0x59')](_0x364d58[_0xccdc('0x42')]);_0x25bfbf[_0xccdc('0x5a')]=_['intersection'](_0x25bfbf[_0xccdc('0x41')],_0x25bfbf[_0xccdc('0x42')]);_0x4b35ce[_0xccdc('0x46')]=_[_0xccdc('0x44')](_0x25bfbf['model'],qs[_0xccdc('0x45')](_0x364d58['query'][_0xccdc('0x45')]));_0x4b35ce[_0xccdc('0x46')]=_0x4b35ce[_0xccdc('0x46')][_0xccdc('0x47')]?_0x4b35ce[_0xccdc('0x46')]:_0x25bfbf[_0xccdc('0x41')];if(_0x364d58['query'][_0xccdc('0x53')]){_0x4b35ce['include']=[{'all':!![]}];}_0x4b35ce=_[_0xccdc('0x4f')]({},_0x4b35ce,_0x364d58[_0xccdc('0x5b')]);return db[_0xccdc('0x51')][_0xccdc('0x5c')](_0x4b35ce)[_0xccdc('0x21')](handleEntityNotFound(_0x553cba,null))['then'](respondWithResult(_0x553cba,null))[_0xccdc('0x2b')](handleError(_0x553cba,null));};exports[_0xccdc('0x5d')]=function(_0x93ff88,_0x309806){return db[_0xccdc('0x51')]['create'](_0x93ff88[_0xccdc('0x5e')],{})[_0xccdc('0x21')](function(_0x1597bc){var _0x597ae3=_0x93ff88[_0xccdc('0x5f')][_0xccdc('0x60')]({'plain':!![]});if(!_0x597ae3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x597ae3[_0xccdc('0x61')]===_0xccdc('0x5f')){var _0x186a8a=_0x1597bc['get']({'plain':!![]});var _0x33258e='ChatQueues';return db[_0xccdc('0x62')][_0xccdc('0x5c')]({'where':{'name':_0x33258e,'userProfileId':_0x597ae3[_0xccdc('0x63')]},'raw':!![]})[_0xccdc('0x21')](function(_0x282d39){if(_0x282d39&&_0x282d39[_0xccdc('0x64')]===0x0){return db[_0xccdc('0x65')]['create']({'name':_0x186a8a[_0xccdc('0x39')],'resourceId':_0x186a8a['id'],'type':_0x282d39[_0xccdc('0x39')],'sectionId':_0x282d39['id']},{})[_0xccdc('0x21')](function(){return _0x1597bc;});}else{return _0x1597bc;}})[_0xccdc('0x2b')](function(_0x4c2fed){logger[_0xccdc('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c2fed);throw _0x4c2fed;});}return _0x1597bc;})[_0xccdc('0x21')](respondWithResult(_0x309806,0xc9))['catch'](handleError(_0x309806,null));};exports[_0xccdc('0x34')]=function(_0x4e8a1e,_0x47fd69){if(_0x4e8a1e['body']['id']){delete _0x4e8a1e['body']['id'];}return db[_0xccdc('0x51')][_0xccdc('0x5c')]({'where':{'id':_0x4e8a1e[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](handleEntityNotFound(_0x47fd69,null))['then'](saveUpdates(_0x4e8a1e['body'],null))[_0xccdc('0x21')](respondWithResult(_0x47fd69,null))[_0xccdc('0x2b')](handleError(_0x47fd69,null));};exports[_0xccdc('0x36')]=function(_0x5464be,_0x3a6533){return db['ChatQueue'][_0xccdc('0x5c')]({'where':{'id':_0x5464be[_0xccdc('0x58')]['id']}})['then'](handleEntityNotFound(_0x3a6533,null))['then'](removeEntity(_0x3a6533,null))[_0xccdc('0x2b')](handleError(_0x3a6533,null));};exports[_0xccdc('0x66')]=function(_0x474175,_0x5e580b){return db[_0xccdc('0x51')]['describe']()[_0xccdc('0x21')](respondWithResult(_0x5e580b,null))[_0xccdc('0x2b')](handleError(_0x5e580b,null));};exports[_0xccdc('0x67')]=function(_0x300ca4,_0x21b8d0,_0x12ba68){var _0x1f151d={'raw':!![],'where':{}},_0x353629={},_0x59c379;return db['ChatQueue'][_0xccdc('0x68')]({'where':{'id':_0x300ca4[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](handleEntityNotFound(_0x21b8d0,null))[_0xccdc('0x21')](function(_0x426dab){if(_0x426dab){_0x59c379=_0x426dab[_0xccdc('0x60')]({'plain':!![]});_0x353629[_0xccdc('0x41')]=_[_0xccdc('0x59')](db['UserChatQueue']['rawAttributes']);_0x353629[_0xccdc('0x42')]=_[_0xccdc('0x59')](_0x300ca4['query']);_0x353629[_0xccdc('0x43')]=_['intersection'](_0x353629['model'],_0x353629[_0xccdc('0x42')]);_0x1f151d['attributes']=_['intersection'](_0x353629[_0xccdc('0x41')],qs[_0xccdc('0x45')](_0x300ca4[_0xccdc('0x42')]['fields']));_0x1f151d[_0xccdc('0x46')]=_0x1f151d[_0xccdc('0x46')]['length']?_0x1f151d[_0xccdc('0x46')]:_0x353629[_0xccdc('0x41')];if(!_0x300ca4[_0xccdc('0x42')][_0xccdc('0x48')]('nolimit')){_0x1f151d[_0xccdc('0x2f')]=qs[_0xccdc('0x2f')](_0x300ca4[_0xccdc('0x42')]['limit']);_0x1f151d[_0xccdc('0x4a')]=qs[_0xccdc('0x4a')](_0x300ca4[_0xccdc('0x42')]['offset']);}_0x1f151d[_0xccdc('0x4b')]=qs[_0xccdc('0x4c')](_0x300ca4['query'][_0xccdc('0x4c')]);_0x1f151d[_0xccdc('0x4d')]=qs[_0xccdc('0x43')](_[_0xccdc('0x69')](_0x300ca4[_0xccdc('0x42')],_0x353629[_0xccdc('0x43')]));_0x1f151d[_0xccdc('0x4d')][_0xccdc('0x6a')]=_0x426dab['id'];if(_0x300ca4['query'][_0xccdc('0x4e')]){_0x1f151d[_0xccdc('0x4d')]=_[_0xccdc('0x4f')](_0x1f151d[_0xccdc('0x4d')],{'$or':_[_0xccdc('0x3c')](_0x1f151d[_0xccdc('0x46')],function(_0x2d9946){var _0x19b5f8={};_0x19b5f8[_0x2d9946]={'$like':'%'+_0x300ca4[_0xccdc('0x42')][_0xccdc('0x4e')]+'%'};return _0x19b5f8;})});}_0x1f151d=_[_0xccdc('0x4f')]({},_0x1f151d,_0x300ca4[_0xccdc('0x5b')]);return db[_0xccdc('0x6b')][_0xccdc('0x55')](_0x1f151d);}})[_0xccdc('0x21')](function(_0x3c9b7a){if(_0x3c9b7a){return db[_0xccdc('0x6c')][_0xccdc('0x6d')]({'where':{'id':_[_0xccdc('0x3c')](_0x3c9b7a,_0xccdc('0x6e')),'role':_0xccdc('0x6f')},'attributes':['id',_0xccdc('0x39'),_0xccdc('0x70'),_0xccdc('0x71'),_0xccdc('0x72')]});}})[_0xccdc('0x21')](function(_0x54f895){if(_0x54f895){return{'count':_0x54f895[_0xccdc('0x52')],'rows':_[_0xccdc('0x3c')](_0x54f895[_0xccdc('0x56')],function(_0x254a32){return{'membername':_0x254a32[_0xccdc('0x39')],'UserId':_0x254a32['id'],'queue_name':_0x59c379[_0xccdc('0x39')],'ChatQueueId':_0x59c379['id'],'interface':util['format'](_0xccdc('0x73'),_0xccdc('0x74'),_0x254a32[_0xccdc('0x39')]),'penalty':0x0,'paused':_0x254a32['chatPause'],'createdAt':_0x254a32[_0xccdc('0x72')],'updatedAt':_0x254a32[_0xccdc('0x71')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xccdc('0x21')](respondWithFilteredResult(_0x21b8d0,_0x1f151d))['catch'](handleError(_0x21b8d0,null));};exports[_0xccdc('0x75')]=function(_0x5b38e4,_0x1f542d,_0x57b300){var _0x2db44e={};var _0x28e82c={};var _0xd9a22f;var _0x27a378;return db['ChatQueue'][_0xccdc('0x68')]({'where':{'id':_0x5b38e4[_0xccdc('0x58')]['id']}})['then'](handleEntityNotFound(_0x1f542d,null))[_0xccdc('0x21')](function(_0x165cf1){if(_0x165cf1){_0xd9a22f=_0x165cf1;_0x28e82c[_0xccdc('0x41')]=_['keys'](db[_0xccdc('0x76')][_0xccdc('0x3d')]);_0x28e82c[_0xccdc('0x42')]=_[_0xccdc('0x59')](_0x5b38e4[_0xccdc('0x42')]);_0x28e82c['filters']=_[_0xccdc('0x44')](_0x28e82c[_0xccdc('0x41')],_0x28e82c[_0xccdc('0x42')]);_0x2db44e['attributes']=_['intersection'](_0x28e82c[_0xccdc('0x41')],qs[_0xccdc('0x45')](_0x5b38e4[_0xccdc('0x42')][_0xccdc('0x45')]));_0x2db44e[_0xccdc('0x46')]=_0x2db44e[_0xccdc('0x46')][_0xccdc('0x47')]?_0x2db44e[_0xccdc('0x46')]:_0x28e82c[_0xccdc('0x41')];_0x2db44e[_0xccdc('0x4b')]=qs[_0xccdc('0x4c')](_0x5b38e4['query'][_0xccdc('0x4c')]);_0x2db44e[_0xccdc('0x4d')]=qs[_0xccdc('0x43')](_[_0xccdc('0x69')](_0x5b38e4['query'],_0x28e82c[_0xccdc('0x43')]));if(_0x5b38e4[_0xccdc('0x42')][_0xccdc('0x4e')]){_0x2db44e[_0xccdc('0x4d')]=_[_0xccdc('0x4f')](_0x2db44e[_0xccdc('0x4d')],{'$or':_['map'](_0x2db44e[_0xccdc('0x46')],function(_0x4ddc0f){var _0x4cfd0b={};_0x4cfd0b[_0x4ddc0f]={'$like':'%'+_0x5b38e4['query'][_0xccdc('0x4e')]+'%'};return _0x4cfd0b;})});}_0x2db44e=_[_0xccdc('0x4f')]({},_0x2db44e,_0x5b38e4[_0xccdc('0x5b')]);return _0xd9a22f[_0xccdc('0x75')](_0x2db44e);}})[_0xccdc('0x21')](function(_0x519169){if(_0x519169){_0x27a378=_0x519169['length'];if(!_0x5b38e4['query']['hasOwnProperty'](_0xccdc('0x49'))){_0x2db44e[_0xccdc('0x2f')]=qs[_0xccdc('0x2f')](_0x5b38e4[_0xccdc('0x42')]['limit']);_0x2db44e[_0xccdc('0x4a')]=qs[_0xccdc('0x4a')](_0x5b38e4['query']['offset']);}return _0xd9a22f[_0xccdc('0x75')](_0x2db44e);}})[_0xccdc('0x21')](function(_0x900429){if(_0x900429){return _0x900429?{'count':_0x27a378,'rows':_0x900429}:null;}})['then'](respondWithResult(_0x1f542d,null))[_0xccdc('0x2b')](handleError(_0x1f542d,null));};exports['addTeams']=function(_0x10d782,_0x53d30a,_0x394d72){var _0x262afd=_0x10d782[_0xccdc('0x5e')][_0xccdc('0x77')];return db[_0xccdc('0x76')][_0xccdc('0x55')]({'where':{'id':_0x262afd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xccdc('0x78'),'attributes':['id',_0xccdc('0x39'),_0xccdc('0x79'),_0xccdc('0x7a'),'interface'],'raw':!![]}]})[_0xccdc('0x21')](function(_0x12162e){if(_0x12162e){var _0x9d7d57=_[_0xccdc('0x7b')](_0x12162e,function(_0x50733b){var _0x9ae8cc=_0x50733b[_0xccdc('0x60')]({'plain':!![]});return _0x9ae8cc[_0xccdc('0x78')];});return db[_0xccdc('0x51')][_0xccdc('0x5c')]({'where':{'id':_0x10d782[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](function(_0x13f468){return db[_0xccdc('0x7c')][_0xccdc('0x7d')](function(_0x5013aa){return _0x13f468[_0xccdc('0x7e')](_0x262afd,{'transaction':_0x5013aa})[_0xccdc('0x21')](function(){return BPromise['each'](_0x9d7d57,function(_0x4194b1){return db[_0xccdc('0x6b')][_0xccdc('0x7f')]({'where':{'UserId':_0x4194b1['id'],'ChatQueueId':_0x10d782[_0xccdc('0x58')]['id']},'transaction':_0x5013aa});});})[_0xccdc('0x21')](function(){_0x9d7d57[_0xccdc('0x80')](function(_0x15d8b7){socket[_0xccdc('0x81')](_0xccdc('0x82'),{'UserId':_0x15d8b7['id'],'ChatQueueId':_0x13f468['id']});});});});});}})[_0xccdc('0x21')](respondWithStatusCode(_0x53d30a,null))['catch'](handleError(_0x53d30a,null));};exports[_0xccdc('0x83')]=function(_0x3d76ad,_0x4d8a89,_0x36f38f){return db[_0xccdc('0x76')][_0xccdc('0x55')]({'where':{'id':_0x3d76ad[_0xccdc('0x42')][_0xccdc('0x77')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xccdc('0x21')](handleEntityNotFound(_0x4d8a89,null))[_0xccdc('0x21')](function(_0x36514b){var _0x5c04c7=_[_0xccdc('0x3c')](_0x36514b,'id');var _0x39e339=[];var _0x2ef8dd=[];var _0x5181fe=squel[_0xccdc('0x84')]();_0x5181fe[_0xccdc('0x85')]('tq.TeamId')[_0xccdc('0x86')](_0xccdc('0x87'),'tq')['join'](_0xccdc('0x88'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xccdc('0x4d')](_0xccdc('0x89'),_0x3d76ad[_0xccdc('0x58')]['id']);for(var _0x7f5adc=0x0;_0x7f5adc<_0x36514b[_0xccdc('0x47')];_0x7f5adc+=0x1){let _0x5d1e24=_0x36514b[_0x7f5adc];for(var _0x425019=0x0;_0x425019<_0x5d1e24[_0xccdc('0x78')]['length'];_0x425019+=0x1){let _0x305a35=_0x5d1e24['Agents'][_0x425019];var _0x5b0cf5=_0x5181fe[_0xccdc('0x8a')]();_0x5b0cf5[_0xccdc('0x4d')](_0xccdc('0x8b'),_0x305a35['id']);_0x2ef8dd[_0xccdc('0x8c')](db[_0xccdc('0x7c')]['query'](_0x5b0cf5[_0xccdc('0x8d')](),{'type':db[_0xccdc('0x7c')][_0xccdc('0x8e')]['SELECT']})['then'](function(_0x46d7d7){if(_0x46d7d7['length']===0x1){return _0x305a35['id'];}else{var _0x238bb4=_[_0xccdc('0x8f')](_[_0xccdc('0x3c')](_0x46d7d7,_0xccdc('0x90')),function(_0x1d5f68){return _['includes'](_0x5c04c7,_0x1d5f68);});if(_0x238bb4){return _0x305a35['id'];}}}));}}return BPromise[_0xccdc('0x91')](_0x2ef8dd)[_0xccdc('0x21')](function(_0x5ecfb7){_0x39e339=_(_0x39e339)[_0xccdc('0x92')](_0x5ecfb7)[_0xccdc('0x93')]()[_0xccdc('0x94')]();return db['ChatQueue']['find']({'where':{'id':_0x3d76ad[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](function(_0x325518){return db[_0xccdc('0x7c')]['transaction'](function(_0x55b9ec){return _0x325518[_0xccdc('0x83')](_0x3d76ad['query'][_0xccdc('0x77')],{'transaction':_0x55b9ec})[_0xccdc('0x21')](function(){if(!_['isEmpty'](_0x39e339)){return _0x325518[_0xccdc('0x95')](_0x39e339,{'transaction':_0x55b9ec});}})['then'](function(){_0x39e339[_0xccdc('0x80')](function(_0x2a2e8d){socket[_0xccdc('0x81')](_0xccdc('0x96'),{'UserId':_0x2a2e8d,'ChatQueueId':_0x325518['id']});});});});});});})[_0xccdc('0x21')](respondWithStatusCode(_0x4d8a89,null))['catch'](handleError(_0x4d8a89,null));};exports[_0xccdc('0x97')]=function(_0x136e7c,_0x59057d,_0x488708){return db[_0xccdc('0x51')][_0xccdc('0x5c')]({'where':{'id':_0x136e7c[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](handleEntityNotFound(_0x59057d,null))[_0xccdc('0x21')](function(_0x1a45c1){if(_0x1a45c1){return _0x1a45c1[_0xccdc('0x97')](_0x136e7c[_0xccdc('0x5e')]['ids'],_[_0xccdc('0x98')](_0x136e7c[_0xccdc('0x5e')],[_0xccdc('0x77'),'id'])||{})[_0xccdc('0x99')](function(_0x13ca30){for(var _0x467023=0x0;_0x467023<_0x136e7c[_0xccdc('0x5e')]['ids']['length'];_0x467023+=0x1){socket[_0xccdc('0x81')](_0xccdc('0x82'),{'UserId':_0x136e7c['body'][_0xccdc('0x77')][_0x467023],'ChatQueueId':_0x136e7c[_0xccdc('0x58')]['id']});}return _0x13ca30;});}})['then'](respondWithResult(_0x59057d,null))[_0xccdc('0x2b')](handleError(_0x59057d,null));};exports[_0xccdc('0x95')]=function(_0x6889fb,_0x3f928f,_0x1049f7){return db[_0xccdc('0x51')][_0xccdc('0x5c')]({'where':{'id':_0x6889fb['params']['id']}})[_0xccdc('0x21')](handleEntityNotFound(_0x3f928f,null))[_0xccdc('0x21')](function(_0x4c9940){if(_0x4c9940){return _0x4c9940[_0xccdc('0x95')](_0x6889fb['query'][_0xccdc('0x77')])[_0xccdc('0x21')](function(){if(_[_0xccdc('0x9a')](_0x6889fb[_0xccdc('0x42')][_0xccdc('0x77')])){for(var _0x49f062=0x0;_0x49f062<_0x6889fb[_0xccdc('0x42')][_0xccdc('0x77')]['length'];_0x49f062+=0x1){socket[_0xccdc('0x81')]('userChatQueue:remove',{'UserId':Number(_0x6889fb[_0xccdc('0x42')][_0xccdc('0x77')][_0x49f062]),'ChatQueueId':Number(_0x6889fb[_0xccdc('0x58')]['id'])});}}else{socket[_0xccdc('0x81')](_0xccdc('0x96'),{'UserId':Number(_0x6889fb['query']['ids']),'ChatQueueId':Number(_0x6889fb[_0xccdc('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f928f,null))[_0xccdc('0x2b')](handleError(_0x3f928f,null));};exports[_0xccdc('0x9b')]=function(_0x3dc4c3,_0x12f4c0,_0x34a957){var _0x3fcdce={};var _0x293dce={};var _0x107f09;var _0x2c951e;return db[_0xccdc('0x51')][_0xccdc('0x68')]({'where':{'id':_0x3dc4c3[_0xccdc('0x58')]['id']}})[_0xccdc('0x21')](handleEntityNotFound(_0x12f4c0,null))[_0xccdc('0x21')](function(_0x30ac61){if(_0x30ac61){_0x107f09=_0x30ac61;_0x293dce[_0xccdc('0x41')]=_[_0xccdc('0x59')](db[_0xccdc('0x6c')][_0xccdc('0x3d')]);_0x293dce['query']=_[_0xccdc('0x59')](_0x3dc4c3[_0xccdc('0x42')]);_0x293dce[_0xccdc('0x43')]=_[_0xccdc('0x44')](_0x293dce[_0xccdc('0x41')],_0x293dce[_0xccdc('0x42')]);_0x3fcdce[_0xccdc('0x46')]=_[_0xccdc('0x44')](_0x293dce[_0xccdc('0x41')],qs[_0xccdc('0x45')](_0x3dc4c3[_0xccdc('0x42')][_0xccdc('0x45')]));_0x3fcdce['attributes']=_0x3fcdce['attributes']['length']?_0x3fcdce[_0xccdc('0x46')]:_0x293dce[_0xccdc('0x41')];_0x3fcdce['order']=qs['sort'](_0x3dc4c3[_0xccdc('0x42')][_0xccdc('0x4c')]);_0x3fcdce['where']=qs['filters'](_['pick'](_0x3dc4c3[_0xccdc('0x42')],_0x293dce[_0xccdc('0x43')]));if(_0x3dc4c3[_0xccdc('0x42')]['filter']){_0x3fcdce[_0xccdc('0x4d')]=_[_0xccdc('0x4f')](_0x3fcdce['where'],{'$or':_['map'](_0x3fcdce[_0xccdc('0x46')],function(_0x2dfe90){var _0x492d99={};_0x492d99[_0x2dfe90]={'$like':'%'+_0x3dc4c3[_0xccdc('0x42')][_0xccdc('0x4e')]+'%'};return _0x492d99;})});}_0x3fcdce=_[_0xccdc('0x4f')]({},_0x3fcdce,_0x3dc4c3[_0xccdc('0x5b')]);return _0x107f09['getAgents'](_0x3fcdce);}})[_0xccdc('0x21')](function(_0x456672){if(_0x456672){_0x2c951e=_0x456672['length'];if(!_0x3dc4c3['query'][_0xccdc('0x48')](_0xccdc('0x49'))){_0x3fcdce[_0xccdc('0x2f')]=qs[_0xccdc('0x2f')](_0x3dc4c3[_0xccdc('0x42')][_0xccdc('0x2f')]);_0x3fcdce[_0xccdc('0x4a')]=qs[_0xccdc('0x4a')](_0x3dc4c3[_0xccdc('0x42')][_0xccdc('0x4a')]);}return _0x107f09[_0xccdc('0x9b')](_0x3fcdce);}})[_0xccdc('0x21')](function(_0x23b35e){if(_0x23b35e){return _0x23b35e?{'count':_0x2c951e,'rows':_0x23b35e}:null;}})[_0xccdc('0x21')](respondWithResult(_0x12f4c0,null))[_0xccdc('0x2b')](handleError(_0x12f4c0,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 138745a..97ba95d 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(_0x356b72,_0xbc8696){var _0x510c9b=function(_0x156a59){while(--_0x156a59){_0x356b72['push'](_0x356b72['shift']());}};_0x510c9b(++_0xbc8696);}(_0x5f2f,0x73));var _0xf5f2=function(_0x46dfe4,_0x5a4e9e){_0x46dfe4=_0x46dfe4-0x0;var _0x39c26f=_0x5f2f[_0x46dfe4];return _0x39c26f;};'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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x2cb5e0,_0x8bc756){var _0x49270d=function(_0x44d2c9){while(--_0x44d2c9){_0x2cb5e0['push'](_0x2cb5e0['shift']());}};_0x49270d(++_0x8bc756);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26393f,_0x19f926){_0x26393f=_0x26393f-0x0;var _0x965b07=_0x5f2f[_0x26393f];return _0x965b07;};'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 diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fc52de6..dfa61cb 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 _0x1965=['path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','../../config/logger','moment','request-promise'];(function(_0x53b8e0,_0x55d46e){var _0x10630c=function(_0x3189aa){while(--_0x3189aa){_0x53b8e0['push'](_0x53b8e0['shift']());}};_0x10630c(++_0x55d46e);}(_0x1965,0x1d0));var _0x5196=function(_0x22db94,_0x4c47c0){_0x22db94=_0x22db94-0x0;var _0x3be6ec=_0x1965[_0x22db94];return _0x3be6ec;};'use strict';var _=require(_0x5196('0x0'));var util=require('util');var logger=require(_0x5196('0x1'))('api');var moment=require(_0x5196('0x2'));var BPromise=require('bluebird');var rp=require(_0x5196('0x3'));var fs=require('fs');var path=require(_0x5196('0x4'));var rimraf=require(_0x5196('0x5'));var config=require(_0x5196('0x6'));var attributes=require(_0x5196('0x7'));module[_0x5196('0x8')]=function(_0x17a644,_0x23b460){return _0x17a644[_0x5196('0x9')](_0x5196('0xa'),attributes,{'tableName':_0x5196('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcde=['bluebird','request-promise','path','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xdcde,0xe1));var _0xedcd=function(_0x1e2563,_0x1bba2f){_0x1e2563=_0x1e2563-0x0;var _0x592a74=_0xdcde[_0x1e2563];return _0x592a74;};'use strict';var _=require('lodash');var util=require(_0xedcd('0x0'));var logger=require(_0xedcd('0x1'))(_0xedcd('0x2'));var moment=require('moment');var BPromise=require(_0xedcd('0x3'));var rp=require(_0xedcd('0x4'));var fs=require('fs');var path=require(_0xedcd('0x5'));var rimraf=require(_0xedcd('0x6'));var config=require('../../config/environment');var attributes=require(_0xedcd('0x7'));module[_0xedcd('0x8')]=function(_0x50acca,_0x2b6e7f){return _0x50acca[_0xedcd('0x9')](_0xedcd('0xa'),attributes,{'tableName':_0xedcd('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 f68883c..d2d854c 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 _0xa9d6=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','include','map','model','stringify','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xa9d6,0x1ef));var _0x6a9d=function(_0x42a2e0,_0x4342ab){_0x42a2e0=_0x42a2e0-0x0;var _0x18d9de=_0xa9d6[_0x42a2e0];return _0x18d9de;};'use strict';var _=require(_0x6a9d('0x0'));var util=require(_0x6a9d('0x1'));var moment=require(_0x6a9d('0x2'));var BPromise=require(_0x6a9d('0x3'));var rs=require(_0x6a9d('0x4'));var fs=require('fs');var Redis=require(_0x6a9d('0x5'));var db=require(_0x6a9d('0x6'))['db'];var utils=require(_0x6a9d('0x7'));var logger=require(_0x6a9d('0x8'))(_0x6a9d('0x9'));var config=require(_0x6a9d('0xa'));var jayson=require(_0x6a9d('0xb'));var client=jayson['client'][_0x6a9d('0xc')]({'port':0x232a});config[_0x6a9d('0xd')]=_[_0x6a9d('0xe')](config['redis'],{'host':_0x6a9d('0xf'),'port':0x18eb});var socket=require(_0x6a9d('0x10'))(new Redis(config[_0x6a9d('0xd')]));require('./chatQueue.socket')[_0x6a9d('0x11')](socket);function respondWithRpcPromise(_0x16c896,_0x4c9eb5,_0x4c1e23){return new BPromise(function(_0xfc578a,_0x6b2f87){return client[_0x6a9d('0x12')](_0x16c896,_0x4c1e23)[_0x6a9d('0x13')](function(_0xe5dce6){logger[_0x6a9d('0x14')](_0x6a9d('0x15'),_0x4c9eb5,_0x6a9d('0x16'));logger[_0x6a9d('0x17')](_0x6a9d('0x18'),_0x4c9eb5,_0x6a9d('0x16'),JSON['stringify'](_0xe5dce6));if(_0xe5dce6[_0x6a9d('0x19')]){if(_0xe5dce6['error'][_0x6a9d('0x1a')]===0x1f4){logger[_0x6a9d('0x19')]('ChatQueue,\x20%s,\x20%s',_0x4c9eb5,_0xe5dce6[_0x6a9d('0x19')]['message']);return _0x6b2f87(_0xe5dce6['error'][_0x6a9d('0x1b')]);}logger[_0x6a9d('0x19')]('ChatQueue,\x20%s,\x20%s',_0x4c9eb5,_0xe5dce6[_0x6a9d('0x19')][_0x6a9d('0x1b')]);return _0xfc578a(_0xe5dce6[_0x6a9d('0x19')][_0x6a9d('0x1b')]);}else{logger[_0x6a9d('0x14')](_0x6a9d('0x15'),_0x4c9eb5,_0x6a9d('0x16'));_0xfc578a(_0xe5dce6['result'][_0x6a9d('0x1b')]);}})[_0x6a9d('0x1c')](function(_0x12b2c1){logger[_0x6a9d('0x19')](_0x6a9d('0x15'),_0x4c9eb5,_0x12b2c1);_0x6b2f87(_0x12b2c1);});});}exports[_0x6a9d('0x1d')]=function(_0x29e24c){var _0x4169cf=this;return new Promise(function(_0x1ac88b,_0x50a076){return db[_0x6a9d('0x1e')]['findAll']({'raw':_0x29e24c[_0x6a9d('0x1f')]?_0x29e24c['options'][_0x6a9d('0x20')]===undefined?!![]:![]:!![],'where':_0x29e24c[_0x6a9d('0x1f')]?_0x29e24c[_0x6a9d('0x1f')][_0x6a9d('0x21')]||null:null,'attributes':_0x29e24c[_0x6a9d('0x1f')]?_0x29e24c['options'][_0x6a9d('0x22')]||null:null,'limit':_0x29e24c[_0x6a9d('0x1f')]?_0x29e24c[_0x6a9d('0x1f')][_0x6a9d('0x23')]||null:null,'include':_0x29e24c[_0x6a9d('0x1f')]?_0x29e24c[_0x6a9d('0x1f')][_0x6a9d('0x24')]?_['map'](_0x29e24c[_0x6a9d('0x1f')][_0x6a9d('0x24')],function(_0x5fea63){return{'model':db[_0x5fea63['model']],'as':_0x5fea63['as'],'attributes':_0x5fea63[_0x6a9d('0x22')],'include':_0x5fea63['include']?_[_0x6a9d('0x25')](_0x5fea63[_0x6a9d('0x24')],function(_0x1c2fb2){return{'model':db[_0x1c2fb2[_0x6a9d('0x26')]],'as':_0x1c2fb2['as'],'attributes':_0x1c2fb2[_0x6a9d('0x22')],'include':_0x1c2fb2[_0x6a9d('0x24')]?_['map'](_0x1c2fb2[_0x6a9d('0x24')],function(_0x2c4917){return{'model':db[_0x2c4917[_0x6a9d('0x26')]],'as':_0x2c4917['as'],'attributes':_0x2c4917[_0x6a9d('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35f638){logger[_0x6a9d('0x14')](_0x6a9d('0x1d'),_0x29e24c);logger[_0x6a9d('0x17')](_0x6a9d('0x1d'),_0x29e24c,JSON[_0x6a9d('0x27')](_0x35f638));_0x1ac88b(_0x35f638);})[_0x6a9d('0x1c')](function(_0x341e5f){logger[_0x6a9d('0x19')](_0x6a9d('0x1d'),_0x341e5f['message'],_0x29e24c);_0x50a076(_0x4169cf['error'](0x1f4,_0x341e5f[_0x6a9d('0x1b')]));});});};exports[_0x6a9d('0x28')]=function(_0x13d733){var _0x49b96a=this;return new Promise(function(_0x3d88b6,_0x240140){return db[_0x6a9d('0x1e')][_0x6a9d('0x29')]({'raw':_0x13d733['options']?_0x13d733[_0x6a9d('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x13d733[_0x6a9d('0x1f')]?_0x13d733['options'][_0x6a9d('0x21')]||null:null,'attributes':_0x13d733[_0x6a9d('0x1f')]?_0x13d733['options']['attributes']||null:null,'include':_0x13d733[_0x6a9d('0x1f')]?_0x13d733['options'][_0x6a9d('0x24')]?_['map'](_0x13d733['options'][_0x6a9d('0x24')],function(_0x2b7a63){return{'model':db[_0x2b7a63[_0x6a9d('0x26')]],'as':_0x2b7a63['as'],'attributes':_0x2b7a63['attributes'],'include':_0x2b7a63[_0x6a9d('0x24')]?_['map'](_0x2b7a63[_0x6a9d('0x24')],function(_0x484079){return{'model':db[_0x484079[_0x6a9d('0x26')]],'as':_0x484079['as'],'attributes':_0x484079[_0x6a9d('0x22')],'include':_0x484079[_0x6a9d('0x24')]?_['map'](_0x484079['include'],function(_0x3d5715){return{'model':db[_0x3d5715[_0x6a9d('0x26')]],'as':_0x3d5715['as'],'attributes':_0x3d5715[_0x6a9d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6a9d('0x13')](function(_0x1cab6){logger[_0x6a9d('0x14')](_0x6a9d('0x28'),_0x13d733);logger['debug']('ShowChatQueue',_0x13d733,JSON[_0x6a9d('0x27')](_0x1cab6));_0x3d88b6(_0x1cab6);})[_0x6a9d('0x1c')](function(_0x4e5566){logger[_0x6a9d('0x19')]('ShowChatQueue',_0x4e5566[_0x6a9d('0x1b')],_0x13d733);_0x240140(_0x49b96a[_0x6a9d('0x19')](0x1f4,_0x4e5566[_0x6a9d('0x1b')]));});});}; \ No newline at end of file +var _0x30cb=['client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','map','include','model','ShowChatQueue','find','where','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x30cb,0x1f1));var _0xb30c=function(_0x264b61,_0x4a5017){_0x264b61=_0x264b61-0x0;var _0x8fff4f=_0x30cb[_0x264b61];return _0x8fff4f;};'use strict';var _=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var moment=require(_0xb30c('0x2'));var BPromise=require(_0xb30c('0x3'));var rs=require(_0xb30c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb30c('0x5'))['db'];var utils=require(_0xb30c('0x6'));var logger=require(_0xb30c('0x7'))('rpc');var config=require(_0xb30c('0x8'));var jayson=require(_0xb30c('0x9'));var client=jayson[_0xb30c('0xa')][_0xb30c('0xb')]({'port':0x232a});config[_0xb30c('0xc')]=_[_0xb30c('0xd')](config[_0xb30c('0xc')],{'host':_0xb30c('0xe'),'port':0x18eb});var socket=require(_0xb30c('0xf'))(new Redis(config[_0xb30c('0xc')]));require(_0xb30c('0x10'))['register'](socket);function respondWithRpcPromise(_0x4b62a8,_0x56fd8a,_0x5c07c5){return new BPromise(function(_0x3ad6b6,_0x1a151f){return client[_0xb30c('0x11')](_0x4b62a8,_0x5c07c5)[_0xb30c('0x12')](function(_0x1fe782){logger['info'](_0xb30c('0x13'),_0x56fd8a,_0xb30c('0x14'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x56fd8a,_0xb30c('0x14'),JSON[_0xb30c('0x15')](_0x1fe782));if(_0x1fe782[_0xb30c('0x16')]){if(_0x1fe782[_0xb30c('0x16')][_0xb30c('0x17')]===0x1f4){logger[_0xb30c('0x16')](_0xb30c('0x13'),_0x56fd8a,_0x1fe782[_0xb30c('0x16')][_0xb30c('0x18')]);return _0x1a151f(_0x1fe782['error']['message']);}logger[_0xb30c('0x16')](_0xb30c('0x13'),_0x56fd8a,_0x1fe782[_0xb30c('0x16')]['message']);return _0x3ad6b6(_0x1fe782[_0xb30c('0x16')]['message']);}else{logger['info'](_0xb30c('0x13'),_0x56fd8a,'request\x20sent');_0x3ad6b6(_0x1fe782[_0xb30c('0x19')][_0xb30c('0x18')]);}})['catch'](function(_0x1dcc9a){logger[_0xb30c('0x16')](_0xb30c('0x13'),_0x56fd8a,_0x1dcc9a);_0x1a151f(_0x1dcc9a);});});}exports[_0xb30c('0x1a')]=function(_0x1e1180){var _0x2a5df8=this;return new Promise(function(_0x3df973,_0x502ead){return db[_0xb30c('0x1b')][_0xb30c('0x1c')]({'raw':_0x1e1180[_0xb30c('0x1d')]?_0x1e1180[_0xb30c('0x1d')][_0xb30c('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e1180[_0xb30c('0x1d')]?_0x1e1180[_0xb30c('0x1d')]['where']||null:null,'attributes':_0x1e1180[_0xb30c('0x1d')]?_0x1e1180['options'][_0xb30c('0x1f')]||null:null,'limit':_0x1e1180['options']?_0x1e1180[_0xb30c('0x1d')]['limit']||null:null,'include':_0x1e1180[_0xb30c('0x1d')]?_0x1e1180[_0xb30c('0x1d')]['include']?_[_0xb30c('0x20')](_0x1e1180[_0xb30c('0x1d')][_0xb30c('0x21')],function(_0x4e46bf){return{'model':db[_0x4e46bf[_0xb30c('0x22')]],'as':_0x4e46bf['as'],'attributes':_0x4e46bf[_0xb30c('0x1f')],'include':_0x4e46bf['include']?_[_0xb30c('0x20')](_0x4e46bf['include'],function(_0x93090d){return{'model':db[_0x93090d[_0xb30c('0x22')]],'as':_0x93090d['as'],'attributes':_0x93090d[_0xb30c('0x1f')],'include':_0x93090d[_0xb30c('0x21')]?_['map'](_0x93090d[_0xb30c('0x21')],function(_0x464667){return{'model':db[_0x464667[_0xb30c('0x22')]],'as':_0x464667['as'],'attributes':_0x464667[_0xb30c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb30c('0x12')](function(_0xa9af30){logger['info']('GetChatQueue',_0x1e1180);logger['debug'](_0xb30c('0x1a'),_0x1e1180,JSON['stringify'](_0xa9af30));_0x3df973(_0xa9af30);})['catch'](function(_0x238a55){logger[_0xb30c('0x16')]('GetChatQueue',_0x238a55['message'],_0x1e1180);_0x502ead(_0x2a5df8[_0xb30c('0x16')](0x1f4,_0x238a55[_0xb30c('0x18')]));});});};exports[_0xb30c('0x23')]=function(_0x403faa){var _0x125c4c=this;return new Promise(function(_0x45daf7,_0x3545ff){return db[_0xb30c('0x1b')][_0xb30c('0x24')]({'raw':_0x403faa[_0xb30c('0x1d')]?_0x403faa[_0xb30c('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x403faa[_0xb30c('0x1d')]?_0x403faa[_0xb30c('0x1d')][_0xb30c('0x25')]||null:null,'attributes':_0x403faa['options']?_0x403faa[_0xb30c('0x1d')][_0xb30c('0x1f')]||null:null,'include':_0x403faa[_0xb30c('0x1d')]?_0x403faa['options'][_0xb30c('0x21')]?_['map'](_0x403faa[_0xb30c('0x1d')]['include'],function(_0x2ae0bb){return{'model':db[_0x2ae0bb['model']],'as':_0x2ae0bb['as'],'attributes':_0x2ae0bb[_0xb30c('0x1f')],'include':_0x2ae0bb[_0xb30c('0x21')]?_['map'](_0x2ae0bb[_0xb30c('0x21')],function(_0x1b402d){return{'model':db[_0x1b402d[_0xb30c('0x22')]],'as':_0x1b402d['as'],'attributes':_0x1b402d['attributes'],'include':_0x1b402d[_0xb30c('0x21')]?_[_0xb30c('0x20')](_0x1b402d[_0xb30c('0x21')],function(_0x4e3947){return{'model':db[_0x4e3947['model']],'as':_0x4e3947['as'],'attributes':_0x4e3947[_0xb30c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb30c('0x12')](function(_0x40ebea){logger[_0xb30c('0x26')](_0xb30c('0x23'),_0x403faa);logger['debug'](_0xb30c('0x23'),_0x403faa,JSON[_0xb30c('0x15')](_0x40ebea));_0x45daf7(_0x40ebea);})['catch'](function(_0x41a7c7){logger['error'](_0xb30c('0x23'),_0x41a7c7['message'],_0x403faa);_0x3545ff(_0x125c4c[_0xb30c('0x16')](0x1f4,_0x41a7c7[_0xb30c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 673c34b..6ae329c 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(_0x28a180,_0x5bb5b0){var _0x1161d3=function(_0x2bb4cf){while(--_0x2bb4cf){_0x28a180['push'](_0x28a180['shift']());}};_0x1161d3(++_0x5bb5b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x408f32,_0x258f21){_0x408f32=_0x408f32-0x0;var _0x4cd9cc=_0x5f2f[_0x408f32];return _0x4cd9cc;};'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(_0x852450,_0xd2456e){var _0x329404=function(_0x4d482b){while(--_0x4d482b){_0x852450['push'](_0x852450['shift']());}};_0x329404(++_0xd2456e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57d452,_0x1c7d16){_0x57d452=_0x57d452-0x0;var _0x2e12d2=_0x5f2f[_0x57d452];return _0x2e12d2;};'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 338707d..1ca74b7 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 _0x6435=['addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','/:id/teams','/:id/users','getAgents','post','create'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0x6435,0xbd));var _0x5643=function(_0x1c30c0,_0x1addc5){_0x1c30c0=_0x1c30c0-0x0;var _0x3fd7d8=_0x6435[_0x1c30c0];return _0x3fd7d8;};'use strict';var multer=require(_0x5643('0x0'));var util=require('util');var path=require(_0x5643('0x1'));var timeout=require(_0x5643('0x2'));var express=require(_0x5643('0x3'));var router=express[_0x5643('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5643('0x5'));var config=require(_0x5643('0x6'));var controller=require(_0x5643('0x7'));router[_0x5643('0x8')]('/',auth[_0x5643('0x9')](),controller[_0x5643('0xa')]);router[_0x5643('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5643('0xb')]);router[_0x5643('0x8')](_0x5643('0xc'),auth[_0x5643('0x9')](),controller['show']);router[_0x5643('0x8')](_0x5643('0xd'),auth[_0x5643('0x9')](),controller['getMembers']);router[_0x5643('0x8')](_0x5643('0xe'),auth[_0x5643('0x9')](),controller['getTeams']);router[_0x5643('0x8')](_0x5643('0xf'),auth[_0x5643('0x9')](),controller[_0x5643('0x10')]);router[_0x5643('0x11')]('/',auth[_0x5643('0x9')](),controller[_0x5643('0x12')]);router[_0x5643('0x11')](_0x5643('0xe'),auth[_0x5643('0x9')](),controller['addTeams']);router['post'](_0x5643('0xf'),auth['isAuthenticated'](),controller[_0x5643('0x13')]);router[_0x5643('0x14')]('/:id',auth[_0x5643('0x9')](),controller['update']);router[_0x5643('0x15')](_0x5643('0xc'),auth[_0x5643('0x9')](),controller[_0x5643('0x16')]);router[_0x5643('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5643('0x17')]);router[_0x5643('0x15')](_0x5643('0xf'),auth[_0x5643('0x9')](),controller[_0x5643('0x18')]);module[_0x5643('0x19')]=router; \ No newline at end of file +var _0x45aa=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5955c2,_0x408424){var _0xfd498a=function(_0x28f274){while(--_0x28f274){_0x5955c2['push'](_0x5955c2['shift']());}};_0xfd498a(++_0x408424);}(_0x45aa,0x6e));var _0xa45a=function(_0x87ab62,_0x4821e9){_0x87ab62=_0x87ab62-0x0;var _0x3984bd=_0x45aa[_0x87ab62];return _0x3984bd;};'use strict';var multer=require(_0xa45a('0x0'));var util=require(_0xa45a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa45a('0x2'));var router=express[_0xa45a('0x3')]();var auth=require(_0xa45a('0x4'));var interaction=require(_0xa45a('0x5'));var config=require(_0xa45a('0x6'));var controller=require(_0xa45a('0x7'));router[_0xa45a('0x8')]('/',auth[_0xa45a('0x9')](),controller[_0xa45a('0xa')]);router[_0xa45a('0x8')]('/describe',auth[_0xa45a('0x9')](),controller[_0xa45a('0xb')]);router[_0xa45a('0x8')](_0xa45a('0xc'),auth['isAuthenticated'](),controller[_0xa45a('0xd')]);router['get'](_0xa45a('0xe'),auth['isAuthenticated'](),controller[_0xa45a('0xf')]);router[_0xa45a('0x8')](_0xa45a('0x10'),auth[_0xa45a('0x9')](),controller[_0xa45a('0x11')]);router['get'](_0xa45a('0x12'),auth[_0xa45a('0x9')](),controller[_0xa45a('0x13')]);router[_0xa45a('0x14')]('/',auth[_0xa45a('0x9')](),controller['create']);router[_0xa45a('0x14')](_0xa45a('0x10'),auth['isAuthenticated'](),controller[_0xa45a('0x15')]);router[_0xa45a('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xa45a('0x16')](_0xa45a('0xc'),auth['isAuthenticated'](),controller[_0xa45a('0x17')]);router[_0xa45a('0x18')](_0xa45a('0xc'),auth[_0xa45a('0x9')](),controller[_0xa45a('0x19')]);router[_0xa45a('0x18')](_0xa45a('0x10'),auth[_0xa45a('0x9')](),controller[_0xa45a('0x1a')]);router['delete'](_0xa45a('0x12'),auth[_0xa45a('0x9')](),controller[_0xa45a('0x1b')]);module[_0xa45a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3ab4db9..b85a83c 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 _0x3355=['DATE','STRING','moment','sequelize'];(function(_0x5ae9d0,_0x220869){var _0x48d1f5=function(_0x3f6b3c){while(--_0x3f6b3c){_0x5ae9d0['push'](_0x5ae9d0['shift']());}};_0x48d1f5(++_0x220869);}(_0x3355,0x19a));var _0x5335=function(_0x468b93,_0x456aea){_0x468b93=_0x468b93-0x0;var _0x1ce004=_0x3355[_0x468b93];return _0x1ce004;};'use strict';var moment=require(_0x5335('0x0'));var Sequelize=require(_0x5335('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x5335('0x2')]},'leaveAt':{'type':Sequelize[_0x5335('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5335('0x3')]}}; \ No newline at end of file +var _0x3394=['exports','STRING','DATE','sequelize'];(function(_0x2a44b4,_0x5da8f7){var _0x76f4a3=function(_0x1f3ca5){while(--_0x1f3ca5){_0x2a44b4['push'](_0x2a44b4['shift']());}};_0x76f4a3(++_0x5da8f7);}(_0x3394,0x143));var _0x4339=function(_0xe22dd5,_0x465df6){_0xe22dd5=_0xe22dd5-0x0;var _0x3a6618=_0x3394[_0xe22dd5];return _0x3a6618;};'use strict';var moment=require('moment');var Sequelize=require(_0x4339('0x0'));module[_0x4339('0x1')]={'uniqueid':{'type':Sequelize[_0x4339('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4339('0x2')]},'joinAt':{'type':Sequelize[_0x4339('0x3')]},'leaveAt':{'type':Sequelize[_0x4339('0x3')]},'acceptAt':{'type':Sequelize[_0x4339('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4339('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index cf82faf..bf15653 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 _0xbb97=['end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filters','VIRTUAL','include','ChatQueueReport','findAll','catch','show','params','filtears','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x525d81,_0x24fcb5){var _0x3931d1=function(_0x5e8889){while(--_0x5e8889){_0x525d81['push'](_0x525d81['shift']());}};_0x3931d1(++_0x24fcb5);}(_0xbb97,0xbc));var _0x7bb9=function(_0x4d060c,_0x1989a0){_0x4d060c=_0x4d060c-0x0;var _0x58133a=_0xbb97[_0x4d060c];return _0x58133a;};'use strict';var pdf=require(_0x7bb9('0x0'));var emlformat=require(_0x7bb9('0x1'));var rimraf=require(_0x7bb9('0x2'));var zipdir=require(_0x7bb9('0x3'));var jsonpatch=require(_0x7bb9('0x4'));var rp=require('request-promise');var moment=require(_0x7bb9('0x5'));var BPromise=require(_0x7bb9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7bb9('0x7'));var sox=require(_0x7bb9('0x8'));var csv=require(_0x7bb9('0x9'));var ejs=require(_0x7bb9('0xa'));var fs=require('fs');var _=require(_0x7bb9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bb9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7bb9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7bb9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x7bb9('0xe'));var as=require(_0x7bb9('0xf'));var hardwareService=require(_0x7bb9('0x10'));var logger=require(_0x7bb9('0x11'))(_0x7bb9('0x12'));var utils=require(_0x7bb9('0x13'));var config=require(_0x7bb9('0x14'));var licenseUtil=require(_0x7bb9('0x15'));var db=require(_0x7bb9('0x16'))['db'];function respondWithStatusCode(_0x116260,_0x404b83){_0x404b83=_0x404b83||0xcc;return function(_0x1d3852){if(_0x1d3852){return _0x116260[_0x7bb9('0x17')](_0x404b83);}return _0x116260[_0x7bb9('0x18')](_0x404b83)[_0x7bb9('0x19')]();};}function respondWithResult(_0x503cad,_0x4ff87f){_0x4ff87f=_0x4ff87f||0xc8;return function(_0x3b5ea6){if(_0x3b5ea6){return _0x503cad[_0x7bb9('0x18')](_0x4ff87f)[_0x7bb9('0x1a')](_0x3b5ea6);}};}function respondWithFilteredResult(_0x10970a,_0x2bfdec){return function(_0xda56a7){if(_0xda56a7){var _0x53f716=_0xda56a7[_0x7bb9('0x1b')],_0x21231a=_0x2bfdec['offset'],_0x2bfe30=_0x2bfdec[_0x7bb9('0x1c')]+_0x2bfdec['limit'],_0x427803;if(_0x2bfe30>=_0x53f716){_0x2bfe30=_0x53f716;_0x427803=0xc8;}else{_0x427803=0xce;}_0x10970a[_0x7bb9('0x18')](_0x427803);return _0x10970a[_0x7bb9('0x1d')]('Content-Range',_0x21231a+'-'+_0x2bfe30+'/'+_0x53f716)[_0x7bb9('0x1a')](_0xda56a7);}return null;};}function patchUpdates(_0x24309a){return function(_0x15e88e){try{jsonpatch[_0x7bb9('0x1e')](_0x15e88e,_0x24309a,!![]);}catch(_0xb7a1eb){return BPromise[_0x7bb9('0x1f')](_0xb7a1eb);}return _0x15e88e[_0x7bb9('0x20')]();};}function saveUpdates(_0x2eb907,_0xef59b6){return function(_0x107cca){if(_0x107cca){return _0x107cca[_0x7bb9('0x21')](_0x2eb907)[_0x7bb9('0x22')](function(_0x19b050){return _0x19b050;});}return null;};}function removeEntity(_0x2482e2,_0x2e4ea3){return function(_0x4beca5){if(_0x4beca5){return _0x4beca5[_0x7bb9('0x23')]()['then'](function(){_0x2482e2[_0x7bb9('0x18')](0xcc)[_0x7bb9('0x19')]();});}};}function handleEntityNotFound(_0x1b2a94,_0x2421b6){return function(_0x586d60){if(!_0x586d60){_0x1b2a94[_0x7bb9('0x17')](0x194);}return _0x586d60;};}function handleError(_0x111738,_0x2e8754){_0x2e8754=_0x2e8754||0x1f4;return function(_0x211a75){logger['error'](_0x211a75[_0x7bb9('0x24')]);if(_0x211a75['name']){delete _0x211a75[_0x7bb9('0x25')];}_0x111738['status'](_0x2e8754)[_0x7bb9('0x26')](_0x211a75);};}exports[_0x7bb9('0x27')]=function(_0x41b7fa,_0x5be745){var _0x1be3bf={},_0x1b88bc={},_0x12e5d7={'count':0x0,'rows':[]};var _0x151b8a=_[_0x7bb9('0x28')](db['ChatQueueReport'][_0x7bb9('0x29')],function(_0x5962c3){return{'name':_0x5962c3[_0x7bb9('0x2a')],'type':_0x5962c3[_0x7bb9('0x2b')][_0x7bb9('0x2c')]};});_0x1b88bc[_0x7bb9('0x2d')]=_['map'](_0x151b8a,_0x7bb9('0x25'));_0x1b88bc[_0x7bb9('0x2e')]=_[_0x7bb9('0x2f')](_0x41b7fa[_0x7bb9('0x2e')]);_0x1b88bc['filters']=_[_0x7bb9('0x30')](_0x1b88bc['model'],_0x1b88bc['query']);_0x1be3bf[_0x7bb9('0x31')]=_[_0x7bb9('0x30')](_0x1b88bc[_0x7bb9('0x2d')],qs[_0x7bb9('0x32')](_0x41b7fa[_0x7bb9('0x2e')][_0x7bb9('0x32')]));_0x1be3bf[_0x7bb9('0x31')]=_0x1be3bf[_0x7bb9('0x31')][_0x7bb9('0x33')]?_0x1be3bf['attributes']:_0x1b88bc[_0x7bb9('0x2d')];if(!_0x41b7fa[_0x7bb9('0x2e')]['hasOwnProperty'](_0x7bb9('0x34'))){_0x1be3bf[_0x7bb9('0x35')]=qs['limit'](_0x41b7fa[_0x7bb9('0x2e')][_0x7bb9('0x35')]);_0x1be3bf[_0x7bb9('0x1c')]=qs[_0x7bb9('0x1c')](_0x41b7fa['query'][_0x7bb9('0x1c')]);}_0x1be3bf['order']=qs[_0x7bb9('0x36')](_0x41b7fa['query'][_0x7bb9('0x36')]);_0x1be3bf[_0x7bb9('0x37')]=qs['filters'](_[_0x7bb9('0x38')](_0x41b7fa[_0x7bb9('0x2e')],_0x1b88bc[_0x7bb9('0x39')]),_0x151b8a);if(_0x41b7fa[_0x7bb9('0x2e')]['filter']){_0x1be3bf[_0x7bb9('0x37')]=_['merge'](_0x1be3bf[_0x7bb9('0x37')],{'$or':_['map'](_0x151b8a,function(_0x32c0d4){if(_0x32c0d4['type']!==_0x7bb9('0x3a')){var _0x270c98={};_0x270c98[_0x32c0d4['name']]={'$like':'%'+_0x41b7fa[_0x7bb9('0x2e')]['filter']+'%'};return _0x270c98;}})});}_0x1be3bf=_['merge']({},_0x1be3bf,_0x41b7fa['options']);var _0x415b66={'where':_0x1be3bf[_0x7bb9('0x37')]};return db['ChatQueueReport']['count'](_0x415b66)['then'](function(_0x307ecd){_0x12e5d7[_0x7bb9('0x1b')]=_0x307ecd;if(_0x41b7fa[_0x7bb9('0x2e')]['includeAll']){_0x1be3bf[_0x7bb9('0x3b')]=[{'all':!![]}];}return db[_0x7bb9('0x3c')][_0x7bb9('0x3d')](_0x1be3bf);})[_0x7bb9('0x22')](function(_0x2ff6a5){_0x12e5d7['rows']=_0x2ff6a5;return _0x12e5d7;})[_0x7bb9('0x22')](respondWithFilteredResult(_0x5be745,_0x1be3bf))[_0x7bb9('0x3e')](handleError(_0x5be745,null));};exports[_0x7bb9('0x3f')]=function(_0x1881a4,_0x616b64){var _0x1e673b={'raw':!![],'where':{'id':_0x1881a4[_0x7bb9('0x40')]['id']}},_0x62df60={};_0x62df60[_0x7bb9('0x2d')]=_[_0x7bb9('0x2f')](db[_0x7bb9('0x3c')][_0x7bb9('0x29')]);_0x62df60[_0x7bb9('0x2e')]=_[_0x7bb9('0x2f')](_0x1881a4[_0x7bb9('0x2e')]);_0x62df60[_0x7bb9('0x41')]=_[_0x7bb9('0x30')](_0x62df60[_0x7bb9('0x2d')],_0x62df60[_0x7bb9('0x2e')]);_0x1e673b[_0x7bb9('0x31')]=_[_0x7bb9('0x30')](_0x62df60[_0x7bb9('0x2d')],qs[_0x7bb9('0x32')](_0x1881a4['query'][_0x7bb9('0x32')]));_0x1e673b[_0x7bb9('0x31')]=_0x1e673b[_0x7bb9('0x31')][_0x7bb9('0x33')]?_0x1e673b[_0x7bb9('0x31')]:_0x62df60[_0x7bb9('0x2d')];if(_0x1881a4[_0x7bb9('0x2e')]['includeAll']){_0x1e673b[_0x7bb9('0x3b')]=[{'all':!![]}];}_0x1e673b=_[_0x7bb9('0x42')]({},_0x1e673b,_0x1881a4['options']);return db['ChatQueueReport']['find'](_0x1e673b)[_0x7bb9('0x22')](handleEntityNotFound(_0x616b64,null))[_0x7bb9('0x22')](respondWithResult(_0x616b64,null))['catch'](handleError(_0x616b64,null));};exports[_0x7bb9('0x43')]=function(_0x4b3049,_0x57be2f){return db[_0x7bb9('0x3c')]['create'](_0x4b3049[_0x7bb9('0x44')],{})[_0x7bb9('0x22')](respondWithResult(_0x57be2f,0xc9))[_0x7bb9('0x3e')](handleError(_0x57be2f,null));};exports[_0x7bb9('0x21')]=function(_0x5d0c83,_0x3623f4){if(_0x5d0c83[_0x7bb9('0x44')]['id']){delete _0x5d0c83[_0x7bb9('0x44')]['id'];}return db[_0x7bb9('0x3c')][_0x7bb9('0x45')]({'where':{'id':_0x5d0c83[_0x7bb9('0x40')]['id']}})[_0x7bb9('0x22')](handleEntityNotFound(_0x3623f4,null))[_0x7bb9('0x22')](saveUpdates(_0x5d0c83['body'],null))[_0x7bb9('0x22')](respondWithResult(_0x3623f4,null))[_0x7bb9('0x3e')](handleError(_0x3623f4,null));};exports[_0x7bb9('0x23')]=function(_0x4f71ad,_0x8595b4){return db['ChatQueueReport']['find']({'where':{'id':_0x4f71ad[_0x7bb9('0x40')]['id']}})[_0x7bb9('0x22')](handleEntityNotFound(_0x8595b4,null))[_0x7bb9('0x22')](removeEntity(_0x8595b4,null))[_0x7bb9('0x3e')](handleError(_0x8595b4,null));};exports[_0x7bb9('0x46')]=function(_0x540809,_0x6c6210){return db['ChatQueueReport'][_0x7bb9('0x46')]()['then'](respondWithResult(_0x6c6210,null))[_0x7bb9('0x3e')](handleError(_0x6c6210,null));}; \ No newline at end of file +var _0xe860=['hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ChatQueueReport','includeAll','include','show','params','filtears','find','catch','create','body','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x5206d2,_0x11146c){var _0x298559=function(_0x429687){while(--_0x429687){_0x5206d2['push'](_0x5206d2['shift']());}};_0x298559(++_0x11146c);}(_0xe860,0x153));var _0x0e86=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xe860[_0x2dea24];return _0x309d58;};'use strict';var pdf=require(_0x0e86('0x0'));var emlformat=require(_0x0e86('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e86('0x2'));var rp=require(_0x0e86('0x3'));var moment=require(_0x0e86('0x4'));var BPromise=require(_0x0e86('0x5'));var Mustache=require('mustache');var util=require(_0x0e86('0x6'));var path=require(_0x0e86('0x7'));var sox=require(_0x0e86('0x8'));var csv=require(_0x0e86('0x9'));var ejs=require(_0x0e86('0xa'));var fs=require('fs');var _=require(_0x0e86('0xb'));var squel=require(_0x0e86('0xc'));var crypto=require(_0x0e86('0xd'));var jsforce=require(_0x0e86('0xe'));var deskjs=require(_0x0e86('0xf'));var toCsv=require(_0x0e86('0x9'));var querystring=require('querystring');var Papa=require(_0x0e86('0x10'));var Redis=require(_0x0e86('0x11'));var authService=require(_0x0e86('0x12'));var qs=require(_0x0e86('0x13'));var as=require(_0x0e86('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e86('0x15'))(_0x0e86('0x16'));var utils=require(_0x0e86('0x17'));var config=require(_0x0e86('0x18'));var licenseUtil=require(_0x0e86('0x19'));var db=require(_0x0e86('0x1a'))['db'];function respondWithStatusCode(_0x5d056a,_0x396945){_0x396945=_0x396945||0xcc;return function(_0x5942d1){if(_0x5942d1){return _0x5d056a[_0x0e86('0x1b')](_0x396945);}return _0x5d056a[_0x0e86('0x1c')](_0x396945)['end']();};}function respondWithResult(_0x2222f1,_0x432c44){_0x432c44=_0x432c44||0xc8;return function(_0x9ab989){if(_0x9ab989){return _0x2222f1[_0x0e86('0x1c')](_0x432c44)[_0x0e86('0x1d')](_0x9ab989);}};}function respondWithFilteredResult(_0x4822af,_0x1cac99){return function(_0x25f4ce){if(_0x25f4ce){var _0x215695=_0x25f4ce[_0x0e86('0x1e')],_0x430525=_0x1cac99[_0x0e86('0x1f')],_0x3da606=_0x1cac99['offset']+_0x1cac99['limit'],_0x8eaeb7;if(_0x3da606>=_0x215695){_0x3da606=_0x215695;_0x8eaeb7=0xc8;}else{_0x8eaeb7=0xce;}_0x4822af[_0x0e86('0x1c')](_0x8eaeb7);return _0x4822af[_0x0e86('0x20')](_0x0e86('0x21'),_0x430525+'-'+_0x3da606+'/'+_0x215695)[_0x0e86('0x1d')](_0x25f4ce);}return null;};}function patchUpdates(_0x1a18b4){return function(_0x49e364){try{jsonpatch[_0x0e86('0x22')](_0x49e364,_0x1a18b4,!![]);}catch(_0x19b238){return BPromise[_0x0e86('0x23')](_0x19b238);}return _0x49e364[_0x0e86('0x24')]();};}function saveUpdates(_0x3cbf86,_0x1d9079){return function(_0x1a0a3c){if(_0x1a0a3c){return _0x1a0a3c[_0x0e86('0x25')](_0x3cbf86)[_0x0e86('0x26')](function(_0x220879){return _0x220879;});}return null;};}function removeEntity(_0x5b205e,_0xaf2d7e){return function(_0x42feb5){if(_0x42feb5){return _0x42feb5['destroy']()['then'](function(){_0x5b205e['status'](0xcc)[_0x0e86('0x27')]();});}};}function handleEntityNotFound(_0x4b3e19,_0x6d6ef6){return function(_0xb9cebe){if(!_0xb9cebe){_0x4b3e19[_0x0e86('0x1b')](0x194);}return _0xb9cebe;};}function handleError(_0x260116,_0x229741){_0x229741=_0x229741||0x1f4;return function(_0x1d27a6){logger[_0x0e86('0x28')](_0x1d27a6['stack']);if(_0x1d27a6[_0x0e86('0x29')]){delete _0x1d27a6['name'];}_0x260116['status'](_0x229741)[_0x0e86('0x2a')](_0x1d27a6);};}exports[_0x0e86('0x2b')]=function(_0xc0783,_0x36d624){var _0x48726f={},_0x506372={},_0x4ebf63={'count':0x0,'rows':[]};var _0x478ee1=_[_0x0e86('0x2c')](db['ChatQueueReport'][_0x0e86('0x2d')],function(_0x3a0bf3){return{'name':_0x3a0bf3[_0x0e86('0x2e')],'type':_0x3a0bf3[_0x0e86('0x2f')][_0x0e86('0x30')]};});_0x506372[_0x0e86('0x31')]=_[_0x0e86('0x2c')](_0x478ee1,'name');_0x506372[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0xc0783[_0x0e86('0x32')]);_0x506372['filters']=_[_0x0e86('0x34')](_0x506372[_0x0e86('0x31')],_0x506372[_0x0e86('0x32')]);_0x48726f['attributes']=_[_0x0e86('0x34')](_0x506372['model'],qs[_0x0e86('0x35')](_0xc0783[_0x0e86('0x32')][_0x0e86('0x35')]));_0x48726f['attributes']=_0x48726f[_0x0e86('0x36')][_0x0e86('0x37')]?_0x48726f['attributes']:_0x506372[_0x0e86('0x31')];if(!_0xc0783[_0x0e86('0x32')][_0x0e86('0x38')](_0x0e86('0x39'))){_0x48726f[_0x0e86('0x3a')]=qs[_0x0e86('0x3a')](_0xc0783[_0x0e86('0x32')][_0x0e86('0x3a')]);_0x48726f[_0x0e86('0x1f')]=qs['offset'](_0xc0783[_0x0e86('0x32')]['offset']);}_0x48726f[_0x0e86('0x3b')]=qs[_0x0e86('0x3c')](_0xc0783[_0x0e86('0x32')][_0x0e86('0x3c')]);_0x48726f[_0x0e86('0x3d')]=qs[_0x0e86('0x3e')](_[_0x0e86('0x3f')](_0xc0783[_0x0e86('0x32')],_0x506372[_0x0e86('0x3e')]),_0x478ee1);if(_0xc0783[_0x0e86('0x32')]['filter']){_0x48726f[_0x0e86('0x3d')]=_[_0x0e86('0x40')](_0x48726f[_0x0e86('0x3d')],{'$or':_[_0x0e86('0x2c')](_0x478ee1,function(_0x29fe92){if(_0x29fe92[_0x0e86('0x2f')]!==_0x0e86('0x41')){var _0x1601ea={};_0x1601ea[_0x29fe92[_0x0e86('0x29')]]={'$like':'%'+_0xc0783['query'][_0x0e86('0x42')]+'%'};return _0x1601ea;}})});}_0x48726f=_[_0x0e86('0x40')]({},_0x48726f,_0xc0783[_0x0e86('0x43')]);var _0x7ee8f9={'where':_0x48726f[_0x0e86('0x3d')]};return db[_0x0e86('0x44')][_0x0e86('0x1e')](_0x7ee8f9)['then'](function(_0x49220f){_0x4ebf63['count']=_0x49220f;if(_0xc0783[_0x0e86('0x32')][_0x0e86('0x45')]){_0x48726f[_0x0e86('0x46')]=[{'all':!![]}];}return db[_0x0e86('0x44')]['findAll'](_0x48726f);})[_0x0e86('0x26')](function(_0x270a4a){_0x4ebf63['rows']=_0x270a4a;return _0x4ebf63;})[_0x0e86('0x26')](respondWithFilteredResult(_0x36d624,_0x48726f))['catch'](handleError(_0x36d624,null));};exports[_0x0e86('0x47')]=function(_0x29f55a,_0x24eb51){var _0x20c9d8={'raw':!![],'where':{'id':_0x29f55a[_0x0e86('0x48')]['id']}},_0x13f117={};_0x13f117['model']=_[_0x0e86('0x33')](db[_0x0e86('0x44')]['rawAttributes']);_0x13f117[_0x0e86('0x32')]=_[_0x0e86('0x33')](_0x29f55a[_0x0e86('0x32')]);_0x13f117[_0x0e86('0x49')]=_['intersection'](_0x13f117[_0x0e86('0x31')],_0x13f117[_0x0e86('0x32')]);_0x20c9d8[_0x0e86('0x36')]=_[_0x0e86('0x34')](_0x13f117[_0x0e86('0x31')],qs[_0x0e86('0x35')](_0x29f55a['query']['fields']));_0x20c9d8[_0x0e86('0x36')]=_0x20c9d8['attributes'][_0x0e86('0x37')]?_0x20c9d8[_0x0e86('0x36')]:_0x13f117[_0x0e86('0x31')];if(_0x29f55a[_0x0e86('0x32')]['includeAll']){_0x20c9d8[_0x0e86('0x46')]=[{'all':!![]}];}_0x20c9d8=_['merge']({},_0x20c9d8,_0x29f55a[_0x0e86('0x43')]);return db[_0x0e86('0x44')][_0x0e86('0x4a')](_0x20c9d8)['then'](handleEntityNotFound(_0x24eb51,null))[_0x0e86('0x26')](respondWithResult(_0x24eb51,null))[_0x0e86('0x4b')](handleError(_0x24eb51,null));};exports[_0x0e86('0x4c')]=function(_0x118156,_0x142faf){return db[_0x0e86('0x44')][_0x0e86('0x4c')](_0x118156[_0x0e86('0x4d')],{})['then'](respondWithResult(_0x142faf,0xc9))[_0x0e86('0x4b')](handleError(_0x142faf,null));};exports[_0x0e86('0x25')]=function(_0x30cc58,_0x5bdff8){if(_0x30cc58['body']['id']){delete _0x30cc58[_0x0e86('0x4d')]['id'];}return db[_0x0e86('0x44')][_0x0e86('0x4a')]({'where':{'id':_0x30cc58[_0x0e86('0x48')]['id']}})['then'](handleEntityNotFound(_0x5bdff8,null))[_0x0e86('0x26')](saveUpdates(_0x30cc58[_0x0e86('0x4d')],null))[_0x0e86('0x26')](respondWithResult(_0x5bdff8,null))[_0x0e86('0x4b')](handleError(_0x5bdff8,null));};exports[_0x0e86('0x4e')]=function(_0x4c48ea,_0x2879f2){return db['ChatQueueReport']['find']({'where':{'id':_0x4c48ea['params']['id']}})[_0x0e86('0x26')](handleEntityNotFound(_0x2879f2,null))['then'](removeEntity(_0x2879f2,null))[_0x0e86('0x4b')](handleError(_0x2879f2,null));};exports['describe']=function(_0x1d115c,_0x3d325e){return db['ChatQueueReport']['describe']()[_0x0e86('0x26')](respondWithResult(_0x3d325e,null))['catch'](handleError(_0x3d325e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 91f6702..cb8a585 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 _0x0a5a=['uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue'];(function(_0x1721d4,_0x2d5b1b){var _0x2bdfdb=function(_0x3bb45f){while(--_0x3bb45f){_0x1721d4['push'](_0x1721d4['shift']());}};_0x2bdfdb(++_0x2d5b1b);}(_0x0a5a,0x1d5));var _0xa0a5=function(_0x4295f6,_0x5dd049){_0x4295f6=_0x4295f6-0x0;var _0x2b84c2=_0x0a5a[_0x4295f6];return _0x2b84c2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0a5('0x0'))(_0xa0a5('0x1'));var moment=require(_0xa0a5('0x2'));var BPromise=require(_0xa0a5('0x3'));var rp=require(_0xa0a5('0x4'));var fs=require('fs');var path=require(_0xa0a5('0x5'));var rimraf=require(_0xa0a5('0x6'));var config=require(_0xa0a5('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0xa0a5('0x8')]=function(_0xc36f39,_0x5b0ade){return _0xc36f39[_0xa0a5('0x9')](_0xa0a5('0xa'),attributes,{'tableName':_0xa0a5('0xb'),'paranoid':![],'indexes':[{'name':_0xa0a5('0xc'),'fields':[_0xa0a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0051=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','report_chat_queue','uniqueid','lodash','util','moment'];(function(_0x2326ae,_0x36147c){var _0x3031ed=function(_0x1d39ca){while(--_0x1d39ca){_0x2326ae['push'](_0x2326ae['shift']());}};_0x3031ed(++_0x36147c);}(_0x0051,0x14d));var _0x1005=function(_0x5e6c33,_0x4f157a){_0x5e6c33=_0x5e6c33-0x0;var _0x142bc9=_0x0051[_0x5e6c33];return _0x142bc9;};'use strict';var _=require(_0x1005('0x0'));var util=require(_0x1005('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1005('0x2'));var BPromise=require(_0x1005('0x3'));var rp=require(_0x1005('0x4'));var fs=require('fs');var path=require(_0x1005('0x5'));var rimraf=require(_0x1005('0x6'));var config=require(_0x1005('0x7'));var attributes=require(_0x1005('0x8'));module[_0x1005('0x9')]=function(_0x1d158e,_0x58c5fc){return _0x1d158e['define']('ChatQueueReport',attributes,{'tableName':_0x1005('0xa'),'paranoid':![],'indexes':[{'name':_0x1005('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index f82e51d..d2f3d5a 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 _0x2d90=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateChatQueueReport','create','body','options','raw','UpdateChatQueueReport','ChatQueueReport','update','attributes','limit','lodash','moment','bluebird'];(function(_0x204e15,_0x51c90a){var _0x2089c7=function(_0x702700){while(--_0x702700){_0x204e15['push'](_0x204e15['shift']());}};_0x2089c7(++_0x51c90a);}(_0x2d90,0x129));var _0x02d9=function(_0xeb48b8,_0x48eb90){_0xeb48b8=_0xeb48b8-0x0;var _0x21eb28=_0x2d90[_0xeb48b8];return _0x21eb28;};'use strict';var _=require(_0x02d9('0x0'));var util=require('util');var moment=require(_0x02d9('0x1'));var BPromise=require(_0x02d9('0x2'));var rs=require(_0x02d9('0x3'));var fs=require('fs');var Redis=require(_0x02d9('0x4'));var db=require(_0x02d9('0x5'))['db'];var utils=require(_0x02d9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x02d9('0x7'));var jayson=require(_0x02d9('0x8'));var client=jayson[_0x02d9('0x9')][_0x02d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d82bd,_0x3d23c3,_0x3bc135){return new BPromise(function(_0x179707,_0x30ae5c){return client['request'](_0x3d82bd,_0x3bc135)[_0x02d9('0xb')](function(_0x3fb82f){logger['info'](_0x02d9('0xc'),_0x3d23c3,_0x02d9('0xd'));logger[_0x02d9('0xe')](_0x02d9('0xf'),_0x3d23c3,_0x02d9('0xd'),JSON['stringify'](_0x3fb82f));if(_0x3fb82f[_0x02d9('0x10')]){if(_0x3fb82f[_0x02d9('0x10')]['code']===0x1f4){logger[_0x02d9('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3d23c3,_0x3fb82f['error'][_0x02d9('0x11')]);return _0x30ae5c(_0x3fb82f[_0x02d9('0x10')][_0x02d9('0x11')]);}logger[_0x02d9('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3d23c3,_0x3fb82f[_0x02d9('0x10')][_0x02d9('0x11')]);return _0x179707(_0x3fb82f[_0x02d9('0x10')]['message']);}else{logger[_0x02d9('0x12')](_0x02d9('0xc'),_0x3d23c3,_0x02d9('0xd'));_0x179707(_0x3fb82f['result'][_0x02d9('0x11')]);}})[_0x02d9('0x13')](function(_0x140035){logger['error'](_0x02d9('0xc'),_0x3d23c3,_0x140035);_0x30ae5c(_0x140035);});});}exports[_0x02d9('0x14')]=function(_0x58b6b7){var _0x2d1255=this;return new Promise(function(_0x57e123,_0x43caba){return db['ChatQueueReport'][_0x02d9('0x15')](_0x58b6b7[_0x02d9('0x16')],{'raw':_0x58b6b7[_0x02d9('0x17')]?_0x58b6b7[_0x02d9('0x17')][_0x02d9('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x45c4c6){logger[_0x02d9('0x12')](_0x02d9('0x14'),_0x58b6b7);logger['debug'](_0x02d9('0x14'),_0x58b6b7,JSON['stringify'](_0x45c4c6));_0x57e123(_0x45c4c6);})['catch'](function(_0x127f24){logger[_0x02d9('0x10')](_0x02d9('0x14'),_0x127f24[_0x02d9('0x11')],_0x58b6b7);_0x43caba(_0x2d1255['error'](0x1f4,_0x127f24['message']));});});};exports[_0x02d9('0x19')]=function(_0x5f3443){var _0x1bb6ce=this;return new Promise(function(_0x5cca20,_0x16cf4c){return db[_0x02d9('0x1a')][_0x02d9('0x1b')](_0x5f3443[_0x02d9('0x16')],{'raw':_0x5f3443[_0x02d9('0x17')]?_0x5f3443['options'][_0x02d9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f3443[_0x02d9('0x17')]?_0x5f3443['options']['where']||null:null,'attributes':_0x5f3443['options']?_0x5f3443['options'][_0x02d9('0x1c')]||null:null,'limit':_0x5f3443[_0x02d9('0x17')]?_0x5f3443[_0x02d9('0x17')][_0x02d9('0x1d')]||null:null})[_0x02d9('0xb')](function(_0x38953b){logger['info'](_0x02d9('0x19'),_0x5f3443);logger[_0x02d9('0xe')](_0x02d9('0x19'),_0x5f3443,JSON['stringify'](_0x38953b));_0x5cca20(_0x38953b);})[_0x02d9('0x13')](function(_0x5542df){logger['error'](_0x02d9('0x19'),_0x5542df[_0x02d9('0x11')],_0x5f3443);_0x16cf4c(_0x1bb6ce[_0x02d9('0x10')](0x1f4,_0x5542df[_0x02d9('0x11')]));});});}; \ No newline at end of file +var _0x7805=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','util','bluebird','randomstring'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x7805,0x15d));var _0x5780=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x7805[_0x47e549];return _0x251374;};'use strict';var _=require('lodash');var util=require(_0x5780('0x0'));var moment=require('moment');var BPromise=require(_0x5780('0x1'));var rs=require(_0x5780('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5780('0x3'))['db'];var utils=require(_0x5780('0x4'));var logger=require(_0x5780('0x5'))(_0x5780('0x6'));var config=require(_0x5780('0x7'));var jayson=require(_0x5780('0x8'));var client=jayson[_0x5780('0x9')][_0x5780('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x134822,_0x4a9b78,_0x51fb7a){return new BPromise(function(_0x49dd75,_0x55f4a8){return client['request'](_0x134822,_0x51fb7a)[_0x5780('0xb')](function(_0x4407eb){logger[_0x5780('0xc')](_0x5780('0xd'),_0x4a9b78,'request\x20sent');logger[_0x5780('0xe')](_0x5780('0xf'),_0x4a9b78,_0x5780('0x10'),JSON[_0x5780('0x11')](_0x4407eb));if(_0x4407eb[_0x5780('0x12')]){if(_0x4407eb[_0x5780('0x12')][_0x5780('0x13')]===0x1f4){logger['error'](_0x5780('0xd'),_0x4a9b78,_0x4407eb[_0x5780('0x12')]['message']);return _0x55f4a8(_0x4407eb[_0x5780('0x12')][_0x5780('0x14')]);}logger[_0x5780('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4a9b78,_0x4407eb[_0x5780('0x12')][_0x5780('0x14')]);return _0x49dd75(_0x4407eb[_0x5780('0x12')]['message']);}else{logger[_0x5780('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x4a9b78,_0x5780('0x10'));_0x49dd75(_0x4407eb[_0x5780('0x15')][_0x5780('0x14')]);}})[_0x5780('0x16')](function(_0x176e6e){logger[_0x5780('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x4a9b78,_0x176e6e);_0x55f4a8(_0x176e6e);});});}exports['CreateChatQueueReport']=function(_0x2763c5){var _0x478370=this;return new Promise(function(_0x5e1b5f,_0x6ffe74){return db[_0x5780('0x17')][_0x5780('0x18')](_0x2763c5[_0x5780('0x19')],{'raw':_0x2763c5[_0x5780('0x1a')]?_0x2763c5[_0x5780('0x1a')][_0x5780('0x1b')]===undefined?!![]:![]:!![]})[_0x5780('0xb')](function(_0x3b4e71){logger[_0x5780('0xc')](_0x5780('0x1c'),_0x2763c5);logger[_0x5780('0xe')]('CreateChatQueueReport',_0x2763c5,JSON['stringify'](_0x3b4e71));_0x5e1b5f(_0x3b4e71);})['catch'](function(_0x2b9157){logger[_0x5780('0x12')](_0x5780('0x1c'),_0x2b9157[_0x5780('0x14')],_0x2763c5);_0x6ffe74(_0x478370['error'](0x1f4,_0x2b9157[_0x5780('0x14')]));});});};exports[_0x5780('0x1d')]=function(_0x3867b5){var _0x42a57f=this;return new Promise(function(_0x1f3315,_0xb36c4){return db[_0x5780('0x17')]['update'](_0x3867b5['body'],{'raw':_0x3867b5[_0x5780('0x1a')]?_0x3867b5['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3867b5[_0x5780('0x1a')]?_0x3867b5['options'][_0x5780('0x1e')]||null:null,'attributes':_0x3867b5[_0x5780('0x1a')]?_0x3867b5[_0x5780('0x1a')][_0x5780('0x1f')]||null:null,'limit':_0x3867b5[_0x5780('0x1a')]?_0x3867b5[_0x5780('0x1a')]['limit']||null:null})[_0x5780('0xb')](function(_0x5503b3){logger['info'](_0x5780('0x1d'),_0x3867b5);logger['debug']('UpdateChatQueueReport',_0x3867b5,JSON[_0x5780('0x11')](_0x5503b3));_0x1f3315(_0x5503b3);})[_0x5780('0x16')](function(_0x1dad1b){logger[_0x5780('0x12')]('UpdateChatQueueReport',_0x1dad1b['message'],_0x3867b5);_0xb36c4(_0x42a57f[_0x5780('0x12')](0x1f4,_0x1dad1b[_0x5780('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b6ac52d..1859369 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 _0x2ed8=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x98dd65,_0xeaf2c){var _0x476c95=function(_0x58b4f1){while(--_0x58b4f1){_0x98dd65['push'](_0x98dd65['shift']());}};_0x476c95(++_0xeaf2c);}(_0x2ed8,0x12f));var _0x82ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ed8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x82ed('0x0'));var util=require(_0x82ed('0x1'));var path=require(_0x82ed('0x2'));var timeout=require(_0x82ed('0x3'));var express=require(_0x82ed('0x4'));var router=express['Router']();var auth=require(_0x82ed('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x82ed('0x6'));var controller=require('./chatQueueReport.controller');router[_0x82ed('0x7')]('/',auth['isAuthenticated'](),controller[_0x82ed('0x8')]);router['get'](_0x82ed('0x9'),auth[_0x82ed('0xa')](),controller[_0x82ed('0xb')]);router[_0x82ed('0x7')](_0x82ed('0xc'),auth[_0x82ed('0xa')](),controller[_0x82ed('0xd')]);router[_0x82ed('0xe')]('/',auth[_0x82ed('0xa')](),controller[_0x82ed('0xf')]);router[_0x82ed('0x10')](_0x82ed('0xc'),auth[_0x82ed('0xa')](),controller[_0x82ed('0x11')]);router[_0x82ed('0x12')](_0x82ed('0xc'),auth[_0x82ed('0xa')](),controller[_0x82ed('0x13')]);module[_0x82ed('0x14')]=router; \ No newline at end of file +var _0xdd38=['../../config/environment','get','index','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4f8a15,_0x1359c0){var _0x13bb38=function(_0x5882af){while(--_0x5882af){_0x4f8a15['push'](_0x4f8a15['shift']());}};_0x13bb38(++_0x1359c0);}(_0xdd38,0x8b));var _0x8dd3=function(_0x1879a4,_0x581a4a){_0x1879a4=_0x1879a4-0x0;var _0x38e837=_0xdd38[_0x1879a4];return _0x38e837;};'use strict';var multer=require(_0x8dd3('0x0'));var util=require(_0x8dd3('0x1'));var path=require(_0x8dd3('0x2'));var timeout=require(_0x8dd3('0x3'));var express=require(_0x8dd3('0x4'));var router=express[_0x8dd3('0x5')]();var auth=require(_0x8dd3('0x6'));var interaction=require(_0x8dd3('0x7'));var config=require(_0x8dd3('0x8'));var controller=require('./chatQueueReport.controller');router[_0x8dd3('0x9')]('/',auth['isAuthenticated'](),controller[_0x8dd3('0xa')]);router[_0x8dd3('0x9')](_0x8dd3('0xb'),auth['isAuthenticated'](),controller[_0x8dd3('0xc')]);router[_0x8dd3('0x9')](_0x8dd3('0xd'),auth['isAuthenticated'](),controller[_0x8dd3('0xe')]);router[_0x8dd3('0xf')]('/',auth[_0x8dd3('0x10')](),controller[_0x8dd3('0x11')]);router[_0x8dd3('0x12')]('/:id',auth[_0x8dd3('0x10')](),controller[_0x8dd3('0x13')]);router['delete'](_0x8dd3('0xd'),auth[_0x8dd3('0x10')](),controller[_0x8dd3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 2618d5b..81b0e7b 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 _0xab01=['account','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x121445,_0x168874){var _0x3ac53f=function(_0x5186d9){while(--_0x5186d9){_0x121445['push'](_0x121445['shift']());}};_0x3ac53f(++_0x168874);}(_0xab01,0x1bc));var _0x1ab0=function(_0x2d6d24,_0xaf0aec){_0x2d6d24=_0x2d6d24-0x0;var _0x37607e=_0xab01[_0x2d6d24];return _0x37607e;};'use strict';var moment=require('moment');var Sequelize=require(_0x1ab0('0x0'));module[_0x1ab0('0x1')]={'uniqueid':{'type':Sequelize[_0x1ab0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1ab0('0x3')](_0x1ab0('0x4'),'agent',_0x1ab0('0x5')),'allowNull':![],'defaultValue':_0x1ab0('0x5')},'transferredAt':{'type':Sequelize[_0x1ab0('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3eff=['sequelize','exports','STRING','ENUM','account','agent','queue','DATE','moment'];(function(_0x15af2f,_0x3c0a01){var _0x359239=function(_0x20da30){while(--_0x20da30){_0x15af2f['push'](_0x15af2f['shift']());}};_0x359239(++_0x3c0a01);}(_0x3eff,0x18b));var _0xf3ef=function(_0xc84e3,_0xd631b){_0xc84e3=_0xc84e3-0x0;var _0x437a90=_0x3eff[_0xc84e3];return _0x437a90;};'use strict';var moment=require(_0xf3ef('0x0'));var Sequelize=require(_0xf3ef('0x1'));module[_0xf3ef('0x2')]={'uniqueid':{'type':Sequelize[_0xf3ef('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf3ef('0x4')](_0xf3ef('0x5'),_0xf3ef('0x6'),'queue'),'allowNull':![],'defaultValue':_0xf3ef('0x7')},'transferredAt':{'type':Sequelize[_0xf3ef('0x8')],'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 e60c4f0..ded5ec3 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 _0x039d=['where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','filtears','include','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','end','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x039d,0xf3));var _0xd039=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x039d[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd039('0x0'));var rimraf=require(_0xd039('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd039('0x2'));var rp=require(_0xd039('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd039('0x4'));var util=require(_0xd039('0x5'));var path=require('path');var sox=require(_0xd039('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd039('0x7'));var crypto=require(_0xd039('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xd039('0x9'));var toCsv=require(_0xd039('0xa'));var querystring=require(_0xd039('0xb'));var Papa=require(_0xd039('0xc'));var Redis=require('ioredis');var authService=require(_0xd039('0xd'));var qs=require(_0xd039('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd039('0xf'));var logger=require(_0xd039('0x10'))(_0xd039('0x11'));var utils=require(_0xd039('0x12'));var config=require(_0xd039('0x13'));var licenseUtil=require(_0xd039('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x205989,_0x47bcfa){_0x47bcfa=_0x47bcfa||0xcc;return function(_0x4f873e){if(_0x4f873e){return _0x205989[_0xd039('0x15')](_0x47bcfa);}return _0x205989[_0xd039('0x16')](_0x47bcfa)['end']();};}function respondWithResult(_0x1891f0,_0x4aedc7){_0x4aedc7=_0x4aedc7||0xc8;return function(_0x247c7d){if(_0x247c7d){return _0x1891f0[_0xd039('0x16')](_0x4aedc7)['json'](_0x247c7d);}};}function respondWithFilteredResult(_0x4279c3,_0x4b61d3){return function(_0x293151){if(_0x293151){var _0xa1f1c1=_0x293151[_0xd039('0x17')],_0x4240d8=_0x4b61d3['offset'],_0x3e9a46=_0x4b61d3[_0xd039('0x18')]+_0x4b61d3[_0xd039('0x19')],_0x3db088;if(_0x3e9a46>=_0xa1f1c1){_0x3e9a46=_0xa1f1c1;_0x3db088=0xc8;}else{_0x3db088=0xce;}_0x4279c3[_0xd039('0x16')](_0x3db088);return _0x4279c3[_0xd039('0x1a')](_0xd039('0x1b'),_0x4240d8+'-'+_0x3e9a46+'/'+_0xa1f1c1)[_0xd039('0x1c')](_0x293151);}return null;};}function patchUpdates(_0x5931dd){return function(_0x519add){try{jsonpatch['apply'](_0x519add,_0x5931dd,!![]);}catch(_0x120ed9){return BPromise['reject'](_0x120ed9);}return _0x519add[_0xd039('0x1d')]();};}function saveUpdates(_0x493e0c,_0x316c44){return function(_0x5aa8fb){if(_0x5aa8fb){return _0x5aa8fb[_0xd039('0x1e')](_0x493e0c)[_0xd039('0x1f')](function(_0x2e2c47){return _0x2e2c47;});}return null;};}function removeEntity(_0x463ae5,_0x4a2560){return function(_0xfff432){if(_0xfff432){return _0xfff432[_0xd039('0x20')]()[_0xd039('0x1f')](function(){_0x463ae5[_0xd039('0x16')](0xcc)[_0xd039('0x21')]();});}};}function handleEntityNotFound(_0x9c663,_0x4c215b){return function(_0x51ec0d){if(!_0x51ec0d){_0x9c663[_0xd039('0x15')](0x194);}return _0x51ec0d;};}function handleError(_0x469f13,_0xcf3d81){_0xcf3d81=_0xcf3d81||0x1f4;return function(_0x1e4e6a){logger[_0xd039('0x22')](_0x1e4e6a[_0xd039('0x23')]);if(_0x1e4e6a['name']){delete _0x1e4e6a[_0xd039('0x24')];}_0x469f13['status'](_0xcf3d81)[_0xd039('0x25')](_0x1e4e6a);};}exports[_0xd039('0x26')]=function(_0x1f3642,_0xc13e2){var _0x1e2101={},_0x317e2e={},_0x7691ff={'count':0x0,'rows':[]};var _0x2bc19b=_[_0xd039('0x27')](db[_0xd039('0x28')][_0xd039('0x29')],function(_0x179b06){return{'name':_0x179b06[_0xd039('0x2a')],'type':_0x179b06[_0xd039('0x2b')][_0xd039('0x2c')]};});_0x317e2e[_0xd039('0x2d')]=_[_0xd039('0x27')](_0x2bc19b,_0xd039('0x24'));_0x317e2e[_0xd039('0x2e')]=_[_0xd039('0x2f')](_0x1f3642[_0xd039('0x2e')]);_0x317e2e[_0xd039('0x30')]=_[_0xd039('0x31')](_0x317e2e[_0xd039('0x2d')],_0x317e2e[_0xd039('0x2e')]);_0x1e2101[_0xd039('0x32')]=_[_0xd039('0x31')](_0x317e2e['model'],qs[_0xd039('0x33')](_0x1f3642[_0xd039('0x2e')]['fields']));_0x1e2101['attributes']=_0x1e2101[_0xd039('0x32')][_0xd039('0x34')]?_0x1e2101[_0xd039('0x32')]:_0x317e2e[_0xd039('0x2d')];if(!_0x1f3642[_0xd039('0x2e')][_0xd039('0x35')](_0xd039('0x36'))){_0x1e2101['limit']=qs[_0xd039('0x19')](_0x1f3642[_0xd039('0x2e')][_0xd039('0x19')]);_0x1e2101['offset']=qs['offset'](_0x1f3642['query'][_0xd039('0x18')]);}_0x1e2101[_0xd039('0x37')]=qs[_0xd039('0x38')](_0x1f3642['query'][_0xd039('0x38')]);_0x1e2101[_0xd039('0x39')]=qs[_0xd039('0x30')](_[_0xd039('0x3a')](_0x1f3642[_0xd039('0x2e')],_0x317e2e[_0xd039('0x30')]),_0x2bc19b);if(_0x1f3642[_0xd039('0x2e')][_0xd039('0x3b')]){_0x1e2101['where']=_['merge'](_0x1e2101[_0xd039('0x39')],{'$or':_[_0xd039('0x27')](_0x2bc19b,function(_0x16be93){if(_0x16be93['type']!==_0xd039('0x3c')){var _0x2cd991={};_0x2cd991[_0x16be93[_0xd039('0x24')]]={'$like':'%'+_0x1f3642['query'][_0xd039('0x3b')]+'%'};return _0x2cd991;}})});}_0x1e2101=_[_0xd039('0x3d')]({},_0x1e2101,_0x1f3642['options']);var _0x158df5={'where':_0x1e2101[_0xd039('0x39')]};return db[_0xd039('0x28')][_0xd039('0x17')](_0x158df5)['then'](function(_0x467f86){_0x7691ff[_0xd039('0x17')]=_0x467f86;if(_0x1f3642['query'][_0xd039('0x3e')]){_0x1e2101['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xd039('0x3f')](_0x1e2101);})[_0xd039('0x1f')](function(_0xde8240){_0x7691ff[_0xd039('0x40')]=_0xde8240;return _0x7691ff;})[_0xd039('0x1f')](respondWithFilteredResult(_0xc13e2,_0x1e2101))[_0xd039('0x41')](handleError(_0xc13e2,null));};exports[_0xd039('0x42')]=function(_0x424f68,_0x272448){var _0x3fbde6={'raw':!![],'where':{'id':_0x424f68[_0xd039('0x43')]['id']}},_0x889c4={};_0x889c4[_0xd039('0x2d')]=_[_0xd039('0x2f')](db['ChatTransferReport']['rawAttributes']);_0x889c4['query']=_['keys'](_0x424f68[_0xd039('0x2e')]);_0x889c4[_0xd039('0x44')]=_[_0xd039('0x31')](_0x889c4[_0xd039('0x2d')],_0x889c4[_0xd039('0x2e')]);_0x3fbde6[_0xd039('0x32')]=_[_0xd039('0x31')](_0x889c4[_0xd039('0x2d')],qs['fields'](_0x424f68[_0xd039('0x2e')][_0xd039('0x33')]));_0x3fbde6[_0xd039('0x32')]=_0x3fbde6[_0xd039('0x32')][_0xd039('0x34')]?_0x3fbde6[_0xd039('0x32')]:_0x889c4[_0xd039('0x2d')];if(_0x424f68[_0xd039('0x2e')][_0xd039('0x3e')]){_0x3fbde6[_0xd039('0x45')]=[{'all':!![]}];}_0x3fbde6=_['merge']({},_0x3fbde6,_0x424f68[_0xd039('0x46')]);return db[_0xd039('0x28')][_0xd039('0x47')](_0x3fbde6)[_0xd039('0x1f')](handleEntityNotFound(_0x272448,null))[_0xd039('0x1f')](respondWithResult(_0x272448,null))[_0xd039('0x41')](handleError(_0x272448,null));};exports['create']=function(_0x33dc93,_0xfdd71e){return db[_0xd039('0x28')][_0xd039('0x48')](_0x33dc93['body'],{})['then'](respondWithResult(_0xfdd71e,0xc9))['catch'](handleError(_0xfdd71e,null));};exports['update']=function(_0x56e52d,_0xfa7327){if(_0x56e52d[_0xd039('0x49')]['id']){delete _0x56e52d['body']['id'];}return db[_0xd039('0x28')]['find']({'where':{'id':_0x56e52d[_0xd039('0x43')]['id']}})[_0xd039('0x1f')](handleEntityNotFound(_0xfa7327,null))['then'](saveUpdates(_0x56e52d['body'],null))[_0xd039('0x1f')](respondWithResult(_0xfa7327,null))['catch'](handleError(_0xfa7327,null));};exports[_0xd039('0x20')]=function(_0x3b6c33,_0x4d52b3){return db['ChatTransferReport'][_0xd039('0x47')]({'where':{'id':_0x3b6c33[_0xd039('0x43')]['id']}})[_0xd039('0x1f')](handleEntityNotFound(_0x4d52b3,null))[_0xd039('0x1f')](removeEntity(_0x4d52b3,null))[_0xd039('0x41')](handleError(_0x4d52b3,null));};exports[_0xd039('0x4a')]=function(_0x4a9d28,_0x3ca7bc){return db[_0xd039('0x28')][_0xd039('0x4a')]()['then'](respondWithResult(_0x3ca7bc,null))[_0xd039('0x41')](handleError(_0x3ca7bc,null));}; \ No newline at end of file +var _0x6965=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','set','apply','reject','then','destroy','error','name','send','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','filtears','find','create','update','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x3f56af,_0x2fb687){var _0x21ef73=function(_0x5203e3){while(--_0x5203e3){_0x3f56af['push'](_0x3f56af['shift']());}};_0x21ef73(++_0x2fb687);}(_0x6965,0x14c));var _0x5696=function(_0x58d0de,_0x4141db){_0x58d0de=_0x58d0de-0x0;var _0x418d6c=_0x6965[_0x58d0de];return _0x418d6c;};'use strict';var pdf=require(_0x5696('0x0'));var emlformat=require(_0x5696('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5696('0x2'));var jsonpatch=require(_0x5696('0x3'));var rp=require(_0x5696('0x4'));var moment=require(_0x5696('0x5'));var BPromise=require(_0x5696('0x6'));var Mustache=require('mustache');var util=require(_0x5696('0x7'));var path=require('path');var sox=require(_0x5696('0x8'));var csv=require(_0x5696('0x9'));var ejs=require(_0x5696('0xa'));var fs=require('fs');var _=require(_0x5696('0xb'));var squel=require(_0x5696('0xc'));var crypto=require(_0x5696('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5696('0xe'));var toCsv=require(_0x5696('0x9'));var querystring=require(_0x5696('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5696('0x10'));var qs=require(_0x5696('0x11'));var as=require(_0x5696('0x12'));var hardwareService=require(_0x5696('0x13'));var logger=require(_0x5696('0x14'))('api');var utils=require(_0x5696('0x15'));var config=require(_0x5696('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x441ced,_0x35d137){_0x35d137=_0x35d137||0xcc;return function(_0x8edbdc){if(_0x8edbdc){return _0x441ced[_0x5696('0x17')](_0x35d137);}return _0x441ced[_0x5696('0x18')](_0x35d137)['end']();};}function respondWithResult(_0x58965a,_0x20db6e){_0x20db6e=_0x20db6e||0xc8;return function(_0x50b8e8){if(_0x50b8e8){return _0x58965a[_0x5696('0x18')](_0x20db6e)[_0x5696('0x19')](_0x50b8e8);}};}function respondWithFilteredResult(_0x25c2e0,_0x413143){return function(_0x3282d1){if(_0x3282d1){var _0x551f17=_0x3282d1[_0x5696('0x1a')],_0x4ca8e7=_0x413143['offset'],_0x4badb9=_0x413143[_0x5696('0x1b')]+_0x413143['limit'],_0x1a031d;if(_0x4badb9>=_0x551f17){_0x4badb9=_0x551f17;_0x1a031d=0xc8;}else{_0x1a031d=0xce;}_0x25c2e0[_0x5696('0x18')](_0x1a031d);return _0x25c2e0[_0x5696('0x1c')]('Content-Range',_0x4ca8e7+'-'+_0x4badb9+'/'+_0x551f17)['json'](_0x3282d1);}return null;};}function patchUpdates(_0x100a5e){return function(_0x518d04){try{jsonpatch[_0x5696('0x1d')](_0x518d04,_0x100a5e,!![]);}catch(_0x5e6d69){return BPromise[_0x5696('0x1e')](_0x5e6d69);}return _0x518d04['save']();};}function saveUpdates(_0x447cd4,_0x59ad07){return function(_0x18cfe5){if(_0x18cfe5){return _0x18cfe5['update'](_0x447cd4)[_0x5696('0x1f')](function(_0x39bb26){return _0x39bb26;});}return null;};}function removeEntity(_0x1e37f9,_0x2ec860){return function(_0xf5dc96){if(_0xf5dc96){return _0xf5dc96[_0x5696('0x20')]()[_0x5696('0x1f')](function(){_0x1e37f9[_0x5696('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e1,_0x5e7869){return function(_0x54e3c7){if(!_0x54e3c7){_0x3a02e1[_0x5696('0x17')](0x194);}return _0x54e3c7;};}function handleError(_0xd8a61d,_0x3203d6){_0x3203d6=_0x3203d6||0x1f4;return function(_0x33d95e){logger[_0x5696('0x21')](_0x33d95e['stack']);if(_0x33d95e[_0x5696('0x22')]){delete _0x33d95e['name'];}_0xd8a61d[_0x5696('0x18')](_0x3203d6)[_0x5696('0x23')](_0x33d95e);};}exports['index']=function(_0x1e0ac7,_0x179252){var _0x3efa81={},_0xfd2ce7={},_0x1800c3={'count':0x0,'rows':[]};var _0x538793=_['map'](db[_0x5696('0x24')][_0x5696('0x25')],function(_0x4d7ac6){return{'name':_0x4d7ac6[_0x5696('0x26')],'type':_0x4d7ac6[_0x5696('0x27')]['key']};});_0xfd2ce7[_0x5696('0x28')]=_[_0x5696('0x29')](_0x538793,_0x5696('0x22'));_0xfd2ce7[_0x5696('0x2a')]=_['keys'](_0x1e0ac7['query']);_0xfd2ce7['filters']=_[_0x5696('0x2b')](_0xfd2ce7['model'],_0xfd2ce7[_0x5696('0x2a')]);_0x3efa81[_0x5696('0x2c')]=_['intersection'](_0xfd2ce7[_0x5696('0x28')],qs[_0x5696('0x2d')](_0x1e0ac7[_0x5696('0x2a')]['fields']));_0x3efa81[_0x5696('0x2c')]=_0x3efa81[_0x5696('0x2c')][_0x5696('0x2e')]?_0x3efa81[_0x5696('0x2c')]:_0xfd2ce7['model'];if(!_0x1e0ac7[_0x5696('0x2a')]['hasOwnProperty'](_0x5696('0x2f'))){_0x3efa81[_0x5696('0x30')]=qs['limit'](_0x1e0ac7['query'][_0x5696('0x30')]);_0x3efa81[_0x5696('0x1b')]=qs[_0x5696('0x1b')](_0x1e0ac7['query']['offset']);}_0x3efa81[_0x5696('0x31')]=qs[_0x5696('0x32')](_0x1e0ac7[_0x5696('0x2a')][_0x5696('0x32')]);_0x3efa81[_0x5696('0x33')]=qs['filters'](_['pick'](_0x1e0ac7[_0x5696('0x2a')],_0xfd2ce7[_0x5696('0x34')]),_0x538793);if(_0x1e0ac7[_0x5696('0x2a')]['filter']){_0x3efa81[_0x5696('0x33')]=_[_0x5696('0x35')](_0x3efa81[_0x5696('0x33')],{'$or':_['map'](_0x538793,function(_0x19b986){if(_0x19b986[_0x5696('0x27')]!==_0x5696('0x36')){var _0xb6c6e9={};_0xb6c6e9[_0x19b986[_0x5696('0x22')]]={'$like':'%'+_0x1e0ac7[_0x5696('0x2a')][_0x5696('0x37')]+'%'};return _0xb6c6e9;}})});}_0x3efa81=_[_0x5696('0x35')]({},_0x3efa81,_0x1e0ac7[_0x5696('0x38')]);var _0x2a8bcd={'where':_0x3efa81[_0x5696('0x33')]};return db[_0x5696('0x24')][_0x5696('0x1a')](_0x2a8bcd)[_0x5696('0x1f')](function(_0x4d1080){_0x1800c3[_0x5696('0x1a')]=_0x4d1080;if(_0x1e0ac7[_0x5696('0x2a')][_0x5696('0x39')]){_0x3efa81['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x5696('0x3a')](_0x3efa81);})[_0x5696('0x1f')](function(_0x4050fe){_0x1800c3[_0x5696('0x3b')]=_0x4050fe;return _0x1800c3;})[_0x5696('0x1f')](respondWithFilteredResult(_0x179252,_0x3efa81))[_0x5696('0x3c')](handleError(_0x179252,null));};exports[_0x5696('0x3d')]=function(_0xe44be9,_0x249562){var _0x3f10b1={'raw':!![],'where':{'id':_0xe44be9[_0x5696('0x3e')]['id']}},_0xe78b67={};_0xe78b67[_0x5696('0x28')]=_[_0x5696('0x3f')](db[_0x5696('0x24')]['rawAttributes']);_0xe78b67['query']=_[_0x5696('0x3f')](_0xe44be9[_0x5696('0x2a')]);_0xe78b67[_0x5696('0x40')]=_[_0x5696('0x2b')](_0xe78b67[_0x5696('0x28')],_0xe78b67['query']);_0x3f10b1['attributes']=_[_0x5696('0x2b')](_0xe78b67[_0x5696('0x28')],qs['fields'](_0xe44be9[_0x5696('0x2a')][_0x5696('0x2d')]));_0x3f10b1['attributes']=_0x3f10b1[_0x5696('0x2c')]['length']?_0x3f10b1[_0x5696('0x2c')]:_0xe78b67[_0x5696('0x28')];if(_0xe44be9[_0x5696('0x2a')]['includeAll']){_0x3f10b1['include']=[{'all':!![]}];}_0x3f10b1=_[_0x5696('0x35')]({},_0x3f10b1,_0xe44be9[_0x5696('0x38')]);return db[_0x5696('0x24')][_0x5696('0x41')](_0x3f10b1)[_0x5696('0x1f')](handleEntityNotFound(_0x249562,null))[_0x5696('0x1f')](respondWithResult(_0x249562,null))['catch'](handleError(_0x249562,null));};exports[_0x5696('0x42')]=function(_0x57d6ee,_0x59b5fb){return db[_0x5696('0x24')][_0x5696('0x42')](_0x57d6ee['body'],{})[_0x5696('0x1f')](respondWithResult(_0x59b5fb,0xc9))['catch'](handleError(_0x59b5fb,null));};exports[_0x5696('0x43')]=function(_0x199eef,_0x414613){if(_0x199eef[_0x5696('0x44')]['id']){delete _0x199eef[_0x5696('0x44')]['id'];}return db[_0x5696('0x24')][_0x5696('0x41')]({'where':{'id':_0x199eef[_0x5696('0x3e')]['id']}})[_0x5696('0x1f')](handleEntityNotFound(_0x414613,null))[_0x5696('0x1f')](saveUpdates(_0x199eef[_0x5696('0x44')],null))[_0x5696('0x1f')](respondWithResult(_0x414613,null))[_0x5696('0x3c')](handleError(_0x414613,null));};exports[_0x5696('0x20')]=function(_0x507eea,_0xa72911){return db[_0x5696('0x24')][_0x5696('0x41')]({'where':{'id':_0x507eea['params']['id']}})[_0x5696('0x1f')](handleEntityNotFound(_0xa72911,null))[_0x5696('0x1f')](removeEntity(_0xa72911,null))[_0x5696('0x3c')](handleError(_0xa72911,null));};exports[_0x5696('0x45')]=function(_0x30fa73,_0x1084ce){return db[_0x5696('0x24')][_0x5696('0x45')]()[_0x5696('0x1f')](respondWithResult(_0x1084ce,null))[_0x5696('0x3c')](handleError(_0x1084ce,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 418a1c1..6ebd389 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 _0x2a96=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x2a96,0xdc));var _0x62a9=function(_0x283152,_0x468a35){_0x283152=_0x283152-0x0;var _0x6cb80d=_0x2a96[_0x283152];return _0x6cb80d;};'use strict';var _=require(_0x62a9('0x0'));var util=require(_0x62a9('0x1'));var logger=require(_0x62a9('0x2'))(_0x62a9('0x3'));var moment=require(_0x62a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x62a9('0x5'));var fs=require('fs');var path=require(_0x62a9('0x6'));var rimraf=require('rimraf');var config=require(_0x62a9('0x7'));var attributes=require(_0x62a9('0x8'));module[_0x62a9('0x9')]=function(_0x4cb441,_0x11e94b){return _0x4cb441[_0x62a9('0xa')](_0x62a9('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x62a9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x385a=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','util'];(function(_0x50d651,_0x2fbdcb){var _0xcf558c=function(_0x34f8b6){while(--_0x34f8b6){_0x50d651['push'](_0x50d651['shift']());}};_0xcf558c(++_0x2fbdcb);}(_0x385a,0xa4));var _0xa385=function(_0x572b88,_0x56c561){_0x572b88=_0x572b88-0x0;var _0x39656e=_0x385a[_0x572b88];return _0x39656e;};'use strict';var _=require('lodash');var util=require(_0xa385('0x0'));var logger=require(_0xa385('0x1'))(_0xa385('0x2'));var moment=require(_0xa385('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa385('0x4'));var rimraf=require(_0xa385('0x5'));var config=require(_0xa385('0x6'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x4da2d5,_0x3e4c26){return _0x4da2d5[_0xa385('0x7')](_0xa385('0x8'),attributes,{'tableName':_0xa385('0x9'),'paranoid':![],'indexes':[{'name':_0xa385('0xa'),'fields':[_0xa385('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 b261980..e0f0bf5 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 _0x501b=['then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x45da3d,_0x36f6f2){var _0x322797=function(_0x18bc01){while(--_0x18bc01){_0x45da3d['push'](_0x45da3d['shift']());}};_0x322797(++_0x36f6f2);}(_0x501b,0x13e));var _0xb501=function(_0x49f49a,_0x215ffe){_0x49f49a=_0x49f49a-0x0;var _0x52e525=_0x501b[_0x49f49a];return _0x52e525;};'use strict';var _=require(_0xb501('0x0'));var util=require(_0xb501('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb501('0x2'));var fs=require('fs');var Redis=require(_0xb501('0x3'));var db=require(_0xb501('0x4'))['db'];var utils=require(_0xb501('0x5'));var logger=require(_0xb501('0x6'))(_0xb501('0x7'));var config=require(_0xb501('0x8'));var jayson=require(_0xb501('0x9'));var client=jayson[_0xb501('0xa')][_0xb501('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfee509,_0x2b0d7e,_0x403e27){return new BPromise(function(_0x43032c,_0x46e506){return client['request'](_0xfee509,_0x403e27)[_0xb501('0xc')](function(_0x4242ba){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x2b0d7e,_0xb501('0xd'));logger[_0xb501('0xe')](_0xb501('0xf'),_0x2b0d7e,'request\x20sent',JSON[_0xb501('0x10')](_0x4242ba));if(_0x4242ba[_0xb501('0x11')]){if(_0x4242ba[_0xb501('0x11')][_0xb501('0x12')]===0x1f4){logger[_0xb501('0x11')](_0xb501('0x13'),_0x2b0d7e,_0x4242ba[_0xb501('0x11')][_0xb501('0x14')]);return _0x46e506(_0x4242ba['error'][_0xb501('0x14')]);}logger['error'](_0xb501('0x13'),_0x2b0d7e,_0x4242ba['error']['message']);return _0x43032c(_0x4242ba[_0xb501('0x11')][_0xb501('0x14')]);}else{logger['info'](_0xb501('0x13'),_0x2b0d7e,_0xb501('0xd'));_0x43032c(_0x4242ba['result'][_0xb501('0x14')]);}})[_0xb501('0x15')](function(_0x3e596d){logger[_0xb501('0x11')](_0xb501('0x13'),_0x2b0d7e,_0x3e596d);_0x46e506(_0x3e596d);});});} \ No newline at end of file +var _0x59d6=['ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x53f019,_0x1dbc2e){var _0x42f8f6=function(_0x79dc65){while(--_0x79dc65){_0x53f019['push'](_0x53f019['shift']());}};_0x42f8f6(++_0x1dbc2e);}(_0x59d6,0x7d));var _0x659d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x59d6[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x659d('0x0'));var util=require(_0x659d('0x1'));var moment=require(_0x659d('0x2'));var BPromise=require(_0x659d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x659d('0x4'));var db=require(_0x659d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x659d('0x6'))('rpc');var config=require(_0x659d('0x7'));var jayson=require(_0x659d('0x8'));var client=jayson[_0x659d('0x9')][_0x659d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2778,_0x27febc,_0xe36680){return new BPromise(function(_0x4a6abd,_0x1481c3){return client[_0x659d('0xb')](_0x3a2778,_0xe36680)['then'](function(_0x1a5393){logger[_0x659d('0xc')](_0x659d('0xd'),_0x27febc,'request\x20sent');logger[_0x659d('0xe')](_0x659d('0xf'),_0x27febc,_0x659d('0x10'),JSON[_0x659d('0x11')](_0x1a5393));if(_0x1a5393[_0x659d('0x12')]){if(_0x1a5393['error'][_0x659d('0x13')]===0x1f4){logger['error'](_0x659d('0xd'),_0x27febc,_0x1a5393[_0x659d('0x12')]['message']);return _0x1481c3(_0x1a5393['error'][_0x659d('0x14')]);}logger[_0x659d('0x12')](_0x659d('0xd'),_0x27febc,_0x1a5393[_0x659d('0x12')]['message']);return _0x4a6abd(_0x1a5393[_0x659d('0x12')][_0x659d('0x14')]);}else{logger[_0x659d('0xc')](_0x659d('0xd'),_0x27febc,'request\x20sent');_0x4a6abd(_0x1a5393[_0x659d('0x15')][_0x659d('0x14')]);}})[_0x659d('0x16')](function(_0x1f5273){logger[_0x659d('0x12')](_0x659d('0xd'),_0x27febc,_0x1f5273);_0x1481c3(_0x1f5273);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3c0db5d..d78aba4 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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5095a8,_0x13e61e){var _0x4efa89=function(_0xfaba83){while(--_0xfaba83){_0x5095a8['push'](_0x5095a8['shift']());}};_0x4efa89(++_0x13e61e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x52b591,_0x4a0e5f){_0x52b591=_0x52b591-0x0;var _0x2c9dd7=_0x5f2f[_0x52b591];return _0x2c9dd7;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +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(_0x4bd374,_0x1b9051){var _0x4959a0=function(_0x383afd){while(--_0x383afd){_0x4bd374['push'](_0x4bd374['shift']());}};_0x4959a0(++_0x1b9051);}(_0xb10b,0x12a));var _0xbb10=function(_0x95eba8,_0x128c50){_0x95eba8=_0x95eba8-0x0;var _0x54f606=_0xb10b[_0x95eba8];return _0x54f606;};'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 eeba7b0..e008416 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 _0x4da5=['We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','rounded'];(function(_0x7eb6b4,_0x395b15){var _0x435246=function(_0x5c5f0b){while(--_0x5c5f0b){_0x7eb6b4['push'](_0x7eb6b4['shift']());}};_0x435246(++_0x395b15);}(_0x4da5,0x1b7));var _0x54da=function(_0x4a73fa,_0x42e752){_0x4a73fa=_0x4a73fa-0x0;var _0x5bf14a=_0x4da5[_0x4a73fa];return _0x5bf14a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x54da('0x0'));module[_0x54da('0x1')]={'name':{'type':Sequelize[_0x54da('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54da('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x4')},'mapKeyOffline':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x5')},'customerAlias':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x54da('0x2')],'allowNull':![],'defaultValue':_0x54da('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x54da('0x2')],'allowNull':![],'defaultValue':_0x54da('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x54da('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x54da('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x54da('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x54da('0x9')]('rounded','squared'),'defaultValue':_0x54da('0xa')},'header_online':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0xb')},'start_chat_button':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0xc')},'offline_chat_button':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0xd')},'header_offline':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0xe')},'download_transcript':{'type':Sequelize[_0x54da('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x54da('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x54da('0x11')]},'closingQuestion':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x13')},'noteTitle':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x14')},'placeholderMessage':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x54da('0x16')},'closingMessageButton':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x17')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x18')},'ratingType':{'type':Sequelize['ENUM'](_0x54da('0x19'),_0x54da('0x1a')),'defaultValue':_0x54da('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x54da('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x54da('0x11')],'defaultValue':function(){return JSON[_0x54da('0x1b')]({'items':[{'type':_0x54da('0x1c'),'variable':null,'config':{'placeholder':_0x54da('0x1d'),'type':_0x54da('0x1e'),'required':!![]},'props':{'title':_0x54da('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x54da('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x54da('0x4'),'type':_0x54da('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x54da('0x1f')](_0x54da('0x20'))?JSON[_0x54da('0x21')](this['getDataValue'](_0x54da('0x20'))):{};},'set':function(_0xef179d){return this[_0x54da('0x22')](_0x54da('0x20'),JSON[_0x54da('0x1b')](_0xef179d));}},'offlineForm':{'type':Sequelize[_0x54da('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x54da('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x54da('0x4'),'type':_0x54da('0x4')},'variable':null},{'type':_0x54da('0x23'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x54da('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x54da('0x1f')](_0x54da('0x25'))?JSON['parse'](this[_0x54da('0x1f')](_0x54da('0x25'))):{};},'set':function(_0x56942a){return this[_0x54da('0x22')](_0x54da('0x25'),JSON[_0x54da('0x1b')](_0x56942a));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x54da('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x54da('0x2')]},'forwardOffline':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x54da('0x2')]},'waitingTitle':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x26')},'waitingMessage':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x54da('0x28')},'offlineMessageBody':{'type':Sequelize[_0x54da('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x29')},'skipUnmanaged':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x17')},'sendUnmanaged':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x54da('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x54da('0x2')]},'notificationTemplate':{'type':Sequelize[_0x54da('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x54da('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x54da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x54da('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x54da('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x54da('0x2')],'allowNull':![],'defaultValue':_0x54da('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x54da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x54da('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x54da('0x2')],'defaultValue':_0x54da('0x2e')},'systemAvatar':{'type':Sequelize[_0x54da('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x54da('0x8')],'comment':_0x54da('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![],'comment':_0x54da('0x30'),'set':function(_0xe95a16){if(!_0xe95a16)this[_0x54da('0x22')](_0x54da('0x31'),null);this[_0x54da('0x22')]('mandatoryDisposition',_0xe95a16);}},'vidaooEscalation':{'type':Sequelize[_0x54da('0xf')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0xcb26=['BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Feedback','ENUM','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','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','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','address','STRING','email','#011F6A','#ffffff','INTEGER'];(function(_0x5a8771,_0x6a51a0){var _0x303c8a=function(_0x272cb8){while(--_0x272cb8){_0x5a8771['push'](_0x5a8771['shift']());}};_0x303c8a(++_0x6a51a0);}(_0xcb26,0xf6));var _0x6cb2=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xcb26[_0x5a9c0c];return _0x53c77d;};'use strict';var Sequelize=require(_0x6cb2('0x0'));var rs=require(_0x6cb2('0x1'));module[_0x6cb2('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6cb2('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6cb2('0x5')},'key':{'type':Sequelize[_0x6cb2('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6cb2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6cb2('0x4')],'allowNull':![],'defaultValue':_0x6cb2('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6cb2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6cb2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x6cb2('0xa'),_0x6cb2('0xb')),'defaultValue':_0x6cb2('0xa')},'header_online':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xc')},'start_chat_button':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xd')},'offline_chat_button':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xe')},'header_offline':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xf')},'download_transcript':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6cb2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6cb2('0x13')},'noteTitle':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x14')},'placeholderMessage':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x15')},'closingMessageButton':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xe')},'skipMessageButton':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x16')},'ratingType':{'type':Sequelize[_0x6cb2('0x17')]('star','thumb'),'defaultValue':_0x6cb2('0x18')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6cb2('0x19')],'defaultValue':function(){return JSON[_0x6cb2('0x1a')]({'items':[{'type':_0x6cb2('0x1b'),'variable':null,'config':{'placeholder':_0x6cb2('0x1c'),'type':_0x6cb2('0x1d'),'required':!![]},'props':{'title':_0x6cb2('0x1c'),'helpText':''}},{'type':_0x6cb2('0x1b'),'props':{'title':_0x6cb2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6cb2('0x5'),'type':_0x6cb2('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6cb2('0x1e')](_0x6cb2('0x1f'))?JSON[_0x6cb2('0x20')](this[_0x6cb2('0x1e')](_0x6cb2('0x1f'))):{};},'set':function(_0x41c600){return this[_0x6cb2('0x21')](_0x6cb2('0x1f'),JSON[_0x6cb2('0x1a')](_0x41c600));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x6cb2('0x1a')]({'items':[{'type':_0x6cb2('0x1b'),'props':{'title':_0x6cb2('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6cb2('0x5'),'type':_0x6cb2('0x5')},'variable':null},{'type':_0x6cb2('0x22'),'config':{'placeholder':_0x6cb2('0x23')},'props':{'title':_0x6cb2('0x23'),'helpText':_0x6cb2('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x6cb2('0x1e')](_0x6cb2('0x25'))?JSON['parse'](this[_0x6cb2('0x1e')](_0x6cb2('0x25'))):{};},'set':function(_0x1641f0){return this[_0x6cb2('0x21')](_0x6cb2('0x25'),JSON[_0x6cb2('0x1a')](_0x1641f0));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6cb2('0x26')]();}},'autoclose':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6cb2('0x4')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x27')},'waitingMessage':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x29')},'offlineMessageBody':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6cb2('0x4')]},'notificationTemplate':{'type':Sequelize[_0x6cb2('0x19')],'defaultValue':function(){return _0x6cb2('0x2a');}},'notificationSound':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6cb2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':_0x6cb2('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6cb2('0x19')]},'showCustomerAvatar':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6cb2('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6cb2('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6cb2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6cb2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6cb2('0x2f')},'systemAvatar':{'type':Sequelize[_0x6cb2('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6cb2('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![],'comment':_0x6cb2('0x30'),'set':function(_0x40cb4b){if(!_0x40cb4b)this[_0x6cb2('0x21')](_0x6cb2('0x31'),null);this['setDataValue'](_0x6cb2('0x32'),_0x40cb4b);}},'vidaooEscalation':{'type':Sequelize[_0x6cb2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6cb2('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 487cb73..a5c920f 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 _0x0d8e=['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','externalUrl','ContactId','interaction','contact','firstName','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','describe','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','authentication','auth','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','all','some','server/files/chat/iframe.js','remote','connection','replace','render','alignment','textColor','addApplications','sequelize','bulkCreate','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','html-pdf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','filtears','intersection','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','chat','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','applications','orderBy','priority','account','mapKey','customerIp','cf-connecting-ip'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0x0d8e,0x74));var _0xe0d8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0d8e[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xe0d8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe0d8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe0d8('0x2'));var Mustache=require(_0xe0d8('0x3'));var util=require(_0xe0d8('0x4'));var path=require(_0xe0d8('0x5'));var sox=require(_0xe0d8('0x6'));var csv=require(_0xe0d8('0x7'));var ejs=require(_0xe0d8('0x8'));var fs=require('fs');var _=require(_0xe0d8('0x9'));var squel=require(_0xe0d8('0xa'));var crypto=require(_0xe0d8('0xb'));var jsforce=require(_0xe0d8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe0d8('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0d8('0xd'));var authService=require(_0xe0d8('0xe'));var qs=require(_0xe0d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0d8('0x10'))('api');var utils=require(_0xe0d8('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe0d8('0x12'));var db=require(_0xe0d8('0x13'))['db'];config['redis']=_[_0xe0d8('0x14')](config[_0xe0d8('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xe0d8('0x16'))(new Redis(config[_0xe0d8('0x15')]));require('./chatWebsite.socket')[_0xe0d8('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe0d8('0x18')][_0xe0d8('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xe0d8('0x19')]({'port':0x232a});var client9003=jayson[_0xe0d8('0x18')][_0xe0d8('0x19')]({'port':0x232b});function respondWithRpcPromise(_0x4d3114,_0x1b715e,_0x2506a4,_0xdcddb7){return new BPromise(function(_0x45a78d,_0x47566b){var _0x25986a=_0xdcddb7||client;return _0x25986a[_0xe0d8('0x1a')](_0x4d3114,_0x2506a4)[_0xe0d8('0x1b')](function(_0x5e50f9){logger['info'](_0xe0d8('0x1c'),_0x1b715e,'request\x20sent');logger[_0xe0d8('0x1d')](_0xe0d8('0x1e'),_0x1b715e,_0xe0d8('0x1f'),JSON[_0xe0d8('0x20')](_0x5e50f9));if(_0x5e50f9['error']){if(_0x5e50f9[_0xe0d8('0x21')][_0xe0d8('0x22')]===0x1f4){logger[_0xe0d8('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x1b715e,_0x5e50f9[_0xe0d8('0x21')]['message']);return _0x47566b(_0x5e50f9['error'][_0xe0d8('0x23')]);}logger['error'](_0xe0d8('0x1c'),_0x1b715e,_0x5e50f9[_0xe0d8('0x21')]['message']);return _0x45a78d(_0x5e50f9[_0xe0d8('0x21')][_0xe0d8('0x23')]);}else{logger[_0xe0d8('0x24')](_0xe0d8('0x1c'),_0x1b715e,_0xe0d8('0x1f'));_0x45a78d(_0x5e50f9[_0xe0d8('0x25')][_0xe0d8('0x23')]);}})['catch'](function(_0x27c647){logger[_0xe0d8('0x21')](_0xe0d8('0x1c'),_0x1b715e,_0x27c647);_0x47566b(_0x27c647);});});}function respondWithStatusCode(_0x45ad65,_0x420555){_0x420555=_0x420555||0xcc;return function(_0x1c047e){if(_0x1c047e){return _0x45ad65[_0xe0d8('0x26')](_0x420555);}return _0x45ad65[_0xe0d8('0x27')](_0x420555)[_0xe0d8('0x28')]();};}function respondWithResult(_0x2e9d7,_0x31393b){_0x31393b=_0x31393b||0xc8;return function(_0x499c04){if(_0x499c04){return _0x2e9d7[_0xe0d8('0x27')](_0x31393b)[_0xe0d8('0x29')](_0x499c04);}};}function respondWithFilteredResult(_0x5ccf58,_0x38237a){return function(_0xf032a5){if(_0xf032a5){var _0x2f6dee=_0xf032a5[_0xe0d8('0x2a')],_0x451aaa=_0x38237a['offset'],_0x2aac7b=_0x38237a[_0xe0d8('0x2b')]+_0x38237a['limit'],_0xe8eabc;if(_0x2aac7b>=_0x2f6dee){_0x2aac7b=_0x2f6dee;_0xe8eabc=0xc8;}else{_0xe8eabc=0xce;}_0x5ccf58[_0xe0d8('0x27')](_0xe8eabc);return _0x5ccf58[_0xe0d8('0x2c')](_0xe0d8('0x2d'),_0x451aaa+'-'+_0x2aac7b+'/'+_0x2f6dee)[_0xe0d8('0x29')](_0xf032a5);}return null;};}function patchUpdates(_0x405880){return function(_0x2284cd){try{jsonpatch['apply'](_0x2284cd,_0x405880,!![]);}catch(_0x137255){return BPromise[_0xe0d8('0x2e')](_0x137255);}return _0x2284cd[_0xe0d8('0x2f')]();};}function saveUpdates(_0x4dd8b2,_0x1cc6c9){return function(_0x11baca){if(_0x11baca){return _0x11baca['update'](_0x4dd8b2)[_0xe0d8('0x1b')](function(_0x11365a){return _0x11365a;});}return null;};}function removeEntity(_0x3f9884,_0x1ddbb6){return function(_0x4b0ad6){if(_0x4b0ad6){return _0x4b0ad6[_0xe0d8('0x30')]()['then'](function(){var _0x15f973=_0x4b0ad6[_0xe0d8('0x31')]({'plain':!![]});var _0x42f226=_0xe0d8('0x32');return db[_0xe0d8('0x33')][_0xe0d8('0x30')]({'where':{'type':_0x42f226,'resourceId':_0x15f973['id']}})[_0xe0d8('0x1b')](function(){return _0x4b0ad6;});})[_0xe0d8('0x1b')](function(){_0x3f9884[_0xe0d8('0x27')](0xcc)[_0xe0d8('0x28')]();});}};}function handleEntityNotFound(_0x3d7e62,_0x368413){return function(_0x538547){if(!_0x538547){_0x3d7e62[_0xe0d8('0x26')](0x194);}return _0x538547;};}function handleError(_0x9c17d9,_0x2e8d83){_0x2e8d83=_0x2e8d83||0x1f4;return function(_0x2d0f91){logger[_0xe0d8('0x21')](_0x2d0f91[_0xe0d8('0x34')]);if(_0x2d0f91[_0xe0d8('0x35')]){delete _0x2d0f91[_0xe0d8('0x35')];}_0x9c17d9[_0xe0d8('0x27')](_0x2e8d83)[_0xe0d8('0x36')](_0x2d0f91);};}exports[_0xe0d8('0x37')]=function(_0x32f0c0,_0x4f2350){var _0x348614={'include':[{'model':db[_0xe0d8('0x38')],'as':_0xe0d8('0x39')}]},_0x5859c6={},_0x354b4b={'count':0x0,'rows':[]};var _0x587993=_[_0xe0d8('0x3a')](db[_0xe0d8('0x3b')][_0xe0d8('0x3c')],function(_0x35f85f){return{'name':_0x35f85f['fieldName'],'type':_0x35f85f[_0xe0d8('0x3d')][_0xe0d8('0x3e')]};});_0x5859c6[_0xe0d8('0x3f')]=_[_0xe0d8('0x3a')](_0x587993,'name');_0x5859c6[_0xe0d8('0x40')]=_['keys'](_0x32f0c0[_0xe0d8('0x40')]);_0x5859c6['filters']=_['intersection'](_0x5859c6[_0xe0d8('0x3f')],_0x5859c6['query']);_0x348614['attributes']=_['intersection'](_0x5859c6['model'],qs[_0xe0d8('0x41')](_0x32f0c0['query'][_0xe0d8('0x41')]));_0x348614[_0xe0d8('0x42')]=_0x348614[_0xe0d8('0x42')][_0xe0d8('0x43')]?_0x348614[_0xe0d8('0x42')]:_0x5859c6[_0xe0d8('0x3f')];if(!_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x44')](_0xe0d8('0x45'))){_0x348614['limit']=qs[_0xe0d8('0x46')](_0x32f0c0['query']['limit']);_0x348614['offset']=qs[_0xe0d8('0x2b')](_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x2b')]);}_0x348614[_0xe0d8('0x47')]=qs[_0xe0d8('0x48')](_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x348614[_0xe0d8('0x49')]=qs[_0xe0d8('0x4a')](_[_0xe0d8('0x4b')](_0x32f0c0['query'],_0x5859c6[_0xe0d8('0x4a')]),_0x587993);if(_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0x348614['where']=_[_0xe0d8('0x4d')](_0x348614[_0xe0d8('0x49')],{'$or':_['map'](_0x587993,function(_0x364b04){if(_0x364b04[_0xe0d8('0x3d')]!==_0xe0d8('0x4e')){var _0x84a03f={};_0x84a03f[_0x364b04[_0xe0d8('0x35')]]={'$like':'%'+_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x4c')]+'%'};return _0x84a03f;}})});}_0x348614=_['merge']({},_0x348614,_0x32f0c0[_0xe0d8('0x4f')]);var _0x17e8d6={'where':_0x348614[_0xe0d8('0x49')]};return db[_0xe0d8('0x3b')][_0xe0d8('0x2a')](_0x17e8d6)[_0xe0d8('0x1b')](function(_0x35e7f0){_0x354b4b[_0xe0d8('0x2a')]=_0x35e7f0;if(_0x32f0c0[_0xe0d8('0x40')][_0xe0d8('0x50')]){_0x348614[_0xe0d8('0x51')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x348614);})[_0xe0d8('0x1b')](function(_0x1afe3f){_0x354b4b[_0xe0d8('0x52')]=_0x1afe3f;return _0x354b4b;})[_0xe0d8('0x1b')](respondWithFilteredResult(_0x4f2350,_0x348614))[_0xe0d8('0x53')](handleError(_0x4f2350,null));};exports[_0xe0d8('0x54')]=function(_0x40940b,_0x473574){var _0x319180={'raw':![],'where':{'id':_0x40940b[_0xe0d8('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0xe0d8('0x39')}]},_0x37ce20={};_0x37ce20['model']=_[_0xe0d8('0x56')](db[_0xe0d8('0x3b')]['rawAttributes']);_0x37ce20[_0xe0d8('0x40')]=_['keys'](_0x40940b[_0xe0d8('0x40')]);_0x37ce20[_0xe0d8('0x57')]=_['intersection'](_0x37ce20[_0xe0d8('0x3f')],_0x37ce20[_0xe0d8('0x40')]);_0x319180[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x37ce20['model'],qs['fields'](_0x40940b['query'][_0xe0d8('0x41')]));_0x319180[_0xe0d8('0x42')]=_0x319180[_0xe0d8('0x42')][_0xe0d8('0x43')]?_0x319180[_0xe0d8('0x42')]:_0x37ce20[_0xe0d8('0x3f')];if(_0x40940b[_0xe0d8('0x40')][_0xe0d8('0x50')]){_0x319180['include']=[{'all':!![]}];}_0x319180=_['merge']({},_0x319180,_0x40940b[_0xe0d8('0x4f')]);return db[_0xe0d8('0x3b')][_0xe0d8('0x59')](_0x319180)['then'](handleEntityNotFound(_0x473574,null))['then'](respondWithResult(_0x473574,null))['catch'](handleError(_0x473574,null));};exports[_0xe0d8('0x5a')]=function(_0x3ba6ca,_0x49e02b){return db[_0xe0d8('0x3b')][_0xe0d8('0x5a')](_0x3ba6ca[_0xe0d8('0x5b')],{})[_0xe0d8('0x1b')](function(_0x439896){var _0x6ad114=_0x3ba6ca[_0xe0d8('0x5c')][_0xe0d8('0x31')]({'plain':!![]});if(!_0x6ad114)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6ad114[_0xe0d8('0x5d')]===_0xe0d8('0x5c')){var _0x2e5fa9=_0x439896[_0xe0d8('0x31')]({'plain':!![]});var _0x555140=_0xe0d8('0x32');return db['UserProfileSection']['find']({'where':{'name':_0x555140,'userProfileId':_0x6ad114[_0xe0d8('0x5e')]},'raw':!![]})[_0xe0d8('0x1b')](function(_0x5ce1fd){if(_0x5ce1fd&&_0x5ce1fd[_0xe0d8('0x5f')]===0x0){return db[_0xe0d8('0x33')]['create']({'name':_0x2e5fa9['name'],'resourceId':_0x2e5fa9['id'],'type':_0x5ce1fd[_0xe0d8('0x35')],'sectionId':_0x5ce1fd['id']},{})['then'](function(){return _0x439896;});}else{return _0x439896;}})[_0xe0d8('0x53')](function(_0x55d034){logger['error'](_0xe0d8('0x60'),_0x55d034);throw _0x55d034;});}return _0x439896;})[_0xe0d8('0x1b')](respondWithResult(_0x49e02b,0xc9))[_0xe0d8('0x53')](handleError(_0x49e02b,null));};exports[_0xe0d8('0x61')]=function(_0x2ac4a3,_0x1b7500){if(_0x2ac4a3['body']['id']){delete _0x2ac4a3[_0xe0d8('0x5b')]['id'];}return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x2ac4a3[_0xe0d8('0x55')]['id']},'include':[{'model':db[_0xe0d8('0x38')],'as':_0xe0d8('0x39')}]})['then'](handleEntityNotFound(_0x1b7500,null))[_0xe0d8('0x1b')](saveUpdates(_0x2ac4a3[_0xe0d8('0x5b')],null))[_0xe0d8('0x1b')](respondWithResult(_0x1b7500,null))[_0xe0d8('0x53')](handleError(_0x1b7500,null));};exports[_0xe0d8('0x30')]=function(_0x15d592,_0x39346c){return db[_0xe0d8('0x3b')]['find']({'where':{'id':_0x15d592[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x39346c,null))[_0xe0d8('0x1b')](removeEntity(_0x39346c,null))['catch'](handleError(_0x39346c,null));};exports['describe']=function(_0x1bbac7,_0x33d8ae){return db['ChatWebsite']['describe']()[_0xe0d8('0x1b')](respondWithResult(_0x33d8ae,null))['catch'](handleError(_0x33d8ae,null));};exports[_0xe0d8('0x62')]=function(_0x378f82,_0x45403c,_0x250e66){if(_0x378f82[_0xe0d8('0x5b')]['id']){delete _0x378f82[_0xe0d8('0x5b')]['id'];}return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x378f82[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x45403c,null))[_0xe0d8('0x1b')](function(_0x4657bf){if(_0x4657bf){_0x378f82[_0xe0d8('0x5b')][_0xe0d8('0x63')]=_0x4657bf['id'];return db[_0xe0d8('0x64')]['create'](_0x378f82[_0xe0d8('0x5b')]);}})[_0xe0d8('0x1b')](respondWithResult(_0x45403c,null))[_0xe0d8('0x53')](handleError(_0x45403c,null));};exports[_0xe0d8('0x65')]=function(_0x49ae81,_0x4dd27c,_0x113dad){var _0x29f629={'raw':![],'where':{}};var _0x3c6e88={};var _0x595ba4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe0d8('0x66')]({'where':{'id':_0x49ae81[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x4dd27c,null))[_0xe0d8('0x1b')](function(_0x581da8){if(_0x581da8){_0x3c6e88[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0x64')][_0xe0d8('0x3c')]);_0x3c6e88[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0x49ae81[_0xe0d8('0x40')]);_0x3c6e88[_0xe0d8('0x4a')]=_[_0xe0d8('0x58')](_0x3c6e88[_0xe0d8('0x3f')],_0x3c6e88[_0xe0d8('0x40')]);_0x29f629[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x3c6e88[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x49ae81['query'][_0xe0d8('0x41')]));_0x29f629[_0xe0d8('0x42')]=_0x29f629[_0xe0d8('0x42')]['length']?_0x29f629[_0xe0d8('0x42')]:_0x3c6e88[_0xe0d8('0x3f')];if(!_0x49ae81[_0xe0d8('0x40')]['hasOwnProperty'](_0xe0d8('0x45'))){_0x29f629['limit']=qs[_0xe0d8('0x46')](_0x49ae81[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0x29f629[_0xe0d8('0x2b')]=qs['offset'](_0x49ae81['query'][_0xe0d8('0x2b')]);}_0x29f629['order']=qs[_0xe0d8('0x48')](_0x49ae81[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x29f629[_0xe0d8('0x49')]=qs[_0xe0d8('0x4a')](_[_0xe0d8('0x4b')](_0x49ae81[_0xe0d8('0x40')],_0x3c6e88[_0xe0d8('0x4a')]));_0x29f629['where'][_0xe0d8('0x63')]=_0x581da8['id'];if(_0x49ae81[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0x29f629[_0xe0d8('0x49')]=_[_0xe0d8('0x4d')](_0x29f629['where'],{'$or':_['map'](_0x29f629[_0xe0d8('0x42')],function(_0x289722){var _0x1c96a2={};_0x1c96a2[_0x289722]={'$like':'%'+_0x49ae81[_0xe0d8('0x40')][_0xe0d8('0x4c')]+'%'};return _0x1c96a2;})});}_0x29f629=_[_0xe0d8('0x4d')]({},_0x29f629,_0x49ae81[_0xe0d8('0x4f')]);return db[_0xe0d8('0x64')][_0xe0d8('0x2a')]({'where':_0x29f629[_0xe0d8('0x49')]})['then'](function(_0x90d00f){_0x595ba4[_0xe0d8('0x2a')]=_0x90d00f;if(_0x49ae81[_0xe0d8('0x40')][_0xe0d8('0x50')]){_0x29f629[_0xe0d8('0x51')]=[{'all':!![]}];}return db[_0xe0d8('0x64')][_0xe0d8('0x67')](_0x29f629);})['then'](function(_0x4c9c48){_0x595ba4[_0xe0d8('0x52')]=_0x4c9c48;return _0x595ba4;});}})[_0xe0d8('0x1b')](respondWithFilteredResult(_0x4dd27c,_0x29f629))[_0xe0d8('0x53')](handleError(_0x4dd27c,null));};exports[_0xe0d8('0x68')]=function(_0x13118e,_0x2e3304,_0x55c399){return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x13118e[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x2e3304,null))[_0xe0d8('0x1b')](function(_0x1bc16b){if(_0x1bc16b){return _0x1bc16b[_0xe0d8('0x68')](_0x13118e[_0xe0d8('0x40')][_0xe0d8('0x69')]);}})[_0xe0d8('0x1b')](respondWithStatusCode(_0x2e3304,null))['catch'](handleError(_0x2e3304,null));};exports['addAnswer']=function(_0x1e415b,_0x135466,_0x8c1392){if(_0x1e415b['body']['id']){delete _0x1e415b[_0xe0d8('0x5b')]['id'];}return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x1e415b[_0xe0d8('0x55')]['id']}})['then'](handleEntityNotFound(_0x135466,null))[_0xe0d8('0x1b')](function(_0x19668c){if(_0x19668c){_0x1e415b['body'][_0xe0d8('0x63')]=_0x19668c['id'];return db['CannedAnswer']['create'](_0x1e415b['body']);}})[_0xe0d8('0x1b')](respondWithResult(_0x135466,null))[_0xe0d8('0x53')](handleError(_0x135466,null));};exports['getAnswers']=function(_0x19e589,_0x365d94,_0x2f15a4){var _0xd8a9dd={'raw':![],'where':{}};var _0x750fdc={};var _0x11e4be={'count':0x0,'rows':[]};return db[_0xe0d8('0x3b')][_0xe0d8('0x66')]({'where':{'id':_0x19e589[_0xe0d8('0x55')]['id']}})['then'](handleEntityNotFound(_0x365d94,null))[_0xe0d8('0x1b')](function(_0x5e55cb){if(_0x5e55cb){_0x750fdc[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0x6a')][_0xe0d8('0x3c')]);_0x750fdc[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0x19e589[_0xe0d8('0x40')]);_0x750fdc[_0xe0d8('0x4a')]=_[_0xe0d8('0x58')](_0x750fdc[_0xe0d8('0x3f')],_0x750fdc[_0xe0d8('0x40')]);_0xd8a9dd[_0xe0d8('0x42')]=_['intersection'](_0x750fdc[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x41')]));_0xd8a9dd[_0xe0d8('0x42')]=_0xd8a9dd['attributes']['length']?_0xd8a9dd[_0xe0d8('0x42')]:_0x750fdc[_0xe0d8('0x3f')];if(!_0x19e589['query'][_0xe0d8('0x44')](_0xe0d8('0x45'))){_0xd8a9dd['limit']=qs[_0xe0d8('0x46')](_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0xd8a9dd[_0xe0d8('0x2b')]=qs['offset'](_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x2b')]);}_0xd8a9dd[_0xe0d8('0x47')]=qs[_0xe0d8('0x48')](_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0xd8a9dd[_0xe0d8('0x49')]=qs['filters'](_[_0xe0d8('0x4b')](_0x19e589['query'],_0x750fdc[_0xe0d8('0x4a')]));_0xd8a9dd['where'][_0xe0d8('0x63')]=_0x5e55cb['id'];if(_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0xd8a9dd[_0xe0d8('0x49')]=_[_0xe0d8('0x4d')](_0xd8a9dd[_0xe0d8('0x49')],{'$or':_[_0xe0d8('0x3a')](_0xd8a9dd[_0xe0d8('0x42')],function(_0x227875){var _0x452514={};_0x452514[_0x227875]={'$like':'%'+_0x19e589[_0xe0d8('0x40')][_0xe0d8('0x4c')]+'%'};return _0x452514;})});}_0xd8a9dd=_[_0xe0d8('0x4d')]({},_0xd8a9dd,_0x19e589[_0xe0d8('0x4f')]);return db[_0xe0d8('0x6a')]['count']({'where':_0xd8a9dd[_0xe0d8('0x49')]})[_0xe0d8('0x1b')](function(_0x1ea0eb){_0x11e4be[_0xe0d8('0x2a')]=_0x1ea0eb;if(_0x19e589['query'][_0xe0d8('0x50')]){_0xd8a9dd[_0xe0d8('0x51')]=[{'all':!![]}];}return db[_0xe0d8('0x6a')][_0xe0d8('0x67')](_0xd8a9dd);})[_0xe0d8('0x1b')](function(_0x5c25e6){_0x11e4be['rows']=_0x5c25e6;return _0x11e4be;});}})[_0xe0d8('0x1b')](respondWithFilteredResult(_0x365d94,_0xd8a9dd))[_0xe0d8('0x53')](handleError(_0x365d94,null));};exports[_0xe0d8('0x6b')]=function(_0x22185d,_0x338525,_0x105848){return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x22185d[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x338525,null))[_0xe0d8('0x1b')](function(_0x270179){if(_0x270179){return _0x270179[_0xe0d8('0x6b')](_0x22185d[_0xe0d8('0x40')][_0xe0d8('0x69')]);}})[_0xe0d8('0x1b')](respondWithStatusCode(_0x338525,null))[_0xe0d8('0x53')](handleError(_0x338525,null));};exports[_0xe0d8('0x6c')]=function(_0x14209d,_0x3d040c,_0x34721d){_0x14209d['body'][_0xe0d8('0x6d')]=_0x14209d[_0xe0d8('0x6e')][_0xe0d8('0x6f')];return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x14209d[_0xe0d8('0x55')]['id']}})['then'](handleEntityNotFound(_0x3d040c,null))[_0xe0d8('0x1b')](saveUpdates(_0x14209d[_0xe0d8('0x5b')],null))[_0xe0d8('0x1b')](respondWithResult(_0x3d040c,null))[_0xe0d8('0x53')](handleError(_0x3d040c,null));};exports['addAvatar']=function(_0x4817f5,_0x3b836a,_0x38d999){_0x4817f5[_0xe0d8('0x5b')][_0xe0d8('0x70')]=_0x4817f5[_0xe0d8('0x6e')][_0xe0d8('0x6f')];return db['ChatWebsite']['find']({'where':{'id':_0x4817f5[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x3b836a,null))[_0xe0d8('0x1b')](saveUpdates(_0x4817f5[_0xe0d8('0x5b')],null))[_0xe0d8('0x1b')](respondWithResult(_0x3b836a,null))[_0xe0d8('0x53')](handleError(_0x3b836a,null));};exports[_0xe0d8('0x71')]=function(_0x57402e,_0x215449,_0x279745){_0x57402e[_0xe0d8('0x5b')][_0xe0d8('0x72')]=_0x57402e[_0xe0d8('0x6e')]['filename'];return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x57402e[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x215449,null))[_0xe0d8('0x1b')](saveUpdates(_0x57402e[_0xe0d8('0x5b')],null))[_0xe0d8('0x1b')](respondWithResult(_0x215449,null))[_0xe0d8('0x53')](handleError(_0x215449,null));};exports['addSystemAvatar']=function(_0x40a9f6,_0x718a44,_0x395c30){_0x40a9f6[_0xe0d8('0x5b')][_0xe0d8('0x73')]=_0x40a9f6[_0xe0d8('0x6e')][_0xe0d8('0x6f')];return db[_0xe0d8('0x3b')]['find']({'where':{'id':_0x40a9f6[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x718a44,null))['then'](saveUpdates(_0x40a9f6[_0xe0d8('0x5b')],null))[_0xe0d8('0x1b')](respondWithResult(_0x718a44,null))[_0xe0d8('0x53')](handleError(_0x718a44,null));};exports[_0xe0d8('0x74')]=function(_0x37b64d,_0xd9a8db,_0x2b24ab){var _0x5a40a1=path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0x77'));var _0x3e2fae={'where':{'id':_0x37b64d[_0xe0d8('0x55')]['id']},'attributes':['id',_0xe0d8('0x6d')],'raw':!![]};var _0x590452=![];return require(_0xe0d8('0x12'))[_0xe0d8('0x78')]()[_0xe0d8('0x1b')](function(_0x5609f9){if(_0x5609f9){_0x590452=_0x5609f9[_0xe0d8('0x79')];}})[_0xe0d8('0x1b')](function(){return db[_0xe0d8('0x3b')][_0xe0d8('0x59')](_0x3e2fae);})[_0xe0d8('0x1b')](handleEntityNotFound(_0xd9a8db,null))['then'](function(_0x1d6116){if(_0x1d6116){if(!_[_0xe0d8('0x7a')](_0x1d6116[_0xe0d8('0x6d')])){if(fs[_0xe0d8('0x7b')](path['join'](config[_0xe0d8('0x76')],_0xe0d8('0x7c'),_0x1d6116[_0xe0d8('0x6d')]))&&_0x590452){_0x5a40a1=path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0x7c'),_0x1d6116['sitepic']);}}return _0xd9a8db[_0xe0d8('0x7d')](_0x5a40a1);}})[_0xe0d8('0x53')](handleError(_0xd9a8db,null));};exports[_0xe0d8('0x7e')]=function(_0x1fe789,_0x1e1022,_0xfb58f7){var _0x41b35e=path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0x7f'));var _0x46d492={'where':{'id':_0x1fe789[_0xe0d8('0x55')]['id']},'attributes':['id',_0xe0d8('0x70')],'raw':!![]};return db[_0xe0d8('0x3b')]['find'](_0x46d492)['then'](handleEntityNotFound(_0x1e1022,null))['then'](function(_0xf675f5){if(_0xf675f5){if(!_['isNil'](_0xf675f5['agentAvatar'])){if(fs[_0xe0d8('0x7b')](path[_0xe0d8('0x75')](config['root'],'server/files/images/avatars/',_0xf675f5[_0xe0d8('0x70')]))){_0x41b35e=path['join'](config['root'],'server/files/images/avatars/',_0xf675f5[_0xe0d8('0x70')]);}}return _0x1e1022[_0xe0d8('0x7d')](_0x41b35e);}})['catch'](handleError(_0x1e1022,null));};exports[_0xe0d8('0x80')]=function(_0x596f1d,_0x15c3a8,_0xc19d10){var _0x1abe75=path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0x81'));var _0x17096f={'where':{'id':_0x596f1d[_0xe0d8('0x55')]['id']},'attributes':['id','customerAvatar',_0xe0d8('0x82')],'raw':!![]};return db[_0xe0d8('0x3b')][_0xe0d8('0x59')](_0x17096f)[_0xe0d8('0x1b')](handleEntityNotFound(_0x15c3a8,null))[_0xe0d8('0x1b')](function(_0x124c0){if(_0x124c0){if(!_[_0xe0d8('0x7a')](_0x124c0[_0xe0d8('0x72')])){if(fs['existsSync'](path['join'](config[_0xe0d8('0x76')],_0xe0d8('0x83'),_0x124c0['customerAvatar']))&&_0x124c0[_0xe0d8('0x82')]){_0x1abe75=path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0x83'),_0x124c0[_0xe0d8('0x72')]);}}return _0x15c3a8[_0xe0d8('0x7d')](_0x1abe75);}})[_0xe0d8('0x53')](handleError(_0x15c3a8,null));};exports['getSystemAvatar']=function(_0x4d80eb,_0x361822,_0x5119df){var _0x44946c=path['join'](config[_0xe0d8('0x76')],_0xe0d8('0x84'));var _0x55f2dd={'where':{'id':_0x4d80eb[_0xe0d8('0x55')]['id']},'attributes':['id',_0xe0d8('0x73')],'raw':!![]};return db[_0xe0d8('0x3b')][_0xe0d8('0x59')](_0x55f2dd)[_0xe0d8('0x1b')](handleEntityNotFound(_0x361822,null))[_0xe0d8('0x1b')](function(_0x916b28){if(_0x916b28){if(!_['isNil'](_0x916b28[_0xe0d8('0x73')])){if(fs[_0xe0d8('0x7b')](path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],'server/files/images/avatars/',_0x916b28[_0xe0d8('0x73')]))){_0x44946c=path['join'](config[_0xe0d8('0x76')],'server/files/images/avatars/',_0x916b28[_0xe0d8('0x73')]);}}return _0x361822[_0xe0d8('0x7d')](_0x44946c);}})[_0xe0d8('0x53')](handleError(_0x361822,null));};exports[_0xe0d8('0x85')]=function(_0x339daa,_0x39ffd5,_0x355407){var _0x95bb34=require(_0xe0d8('0x86'));var _0xd88073=new _0x95bb34();var _0x55357d=_0xd88073['setUA'](_0x339daa[_0xe0d8('0x87')]['user-agent'])['getResult']();var _0x56fd98={'body':_0x339daa[_0xe0d8('0x5b')],'channel':_0xe0d8('0x88')};var _0x556147=[];var _0x2fc310=[];var _0x1a3794={};var _0x4efe8b=![];return db['CmContact']['describe']()[_0xe0d8('0x1b')](function(_0x4f7b30){if(!_0x4f7b30){throw new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0x8b'));}_0x556147=_['difference'](_['keys'](_0x4f7b30),[_0xe0d8('0x8c'),_0xe0d8('0x8d')]);_0x2fc310=_[_0xe0d8('0x8e')](_['keys'](_0x4f7b30),[_0xe0d8('0x8c'),_0xe0d8('0x8d'),_0xe0d8('0x8f'),_0xe0d8('0x90')]);if(_0x339daa['body']['id']){delete _0x339daa[_0xe0d8('0x5b')]['id'];}if(_[_0xe0d8('0x7a')](_0x339daa['body'][_0xe0d8('0x91')])){throw new db['Sequelize'][(_0xe0d8('0x8a'))]('from\x20is\x20mandatory');}if(_[_0xe0d8('0x7a')](_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0x5b')])||_0x339daa['body'][_0xe0d8('0x5b')]===''){throw new db['Sequelize'][(_0xe0d8('0x8a'))](_0xe0d8('0x92'));}if(_[_0xe0d8('0x7a')](_0x339daa[_0xe0d8('0x5b')]['mapKey'])){throw new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0x93')+_0x2fc310);}if(!_[_0xe0d8('0x94')](_0x2fc310,_0x339daa[_0xe0d8('0x5b')]['mapKey'])){throw new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0x95')+_0x2fc310);}_0x1a3794[_0x339daa[_0xe0d8('0x5b')]['mapKey']]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0x91')];})[_0xe0d8('0x1b')](function(){return db['ChatWebsite'][_0xe0d8('0x59')]({'where':{'id':_0x339daa[_0xe0d8('0x55')]['id']},'include':[{'model':db[_0xe0d8('0x96')],'as':_0xe0d8('0x97'),'include':[{'model':db[_0xe0d8('0x98')],'as':_0xe0d8('0x99'),'where':_0x1a3794,'limit':0x1,'order':[[_0xe0d8('0x8d'),_0xe0d8('0x9a')]]}]},{'model':db[_0xe0d8('0x9b')],'as':_0xe0d8('0x9c')}]});})['then'](handleEntityNotFound(_0x39ffd5,null))[_0xe0d8('0x1b')](function(_0x564e5d){if(_0x564e5d&&_0x564e5d[_0xe0d8('0x97')]){_0x56fd98['account']=_0x564e5d;_0x56fd98[_0xe0d8('0x9d')]=_0x564e5d[_0xe0d8('0x9c')];_0x56fd98['list']=_0x564e5d['List'];_0x56fd98['applications']=_[_0xe0d8('0x9e')](_0x56fd98[_0xe0d8('0x9d')],[_0xe0d8('0x9f')],['asc']);if(_0x56fd98[_0xe0d8('0xa0')][_0xe0d8('0x9c')]){delete _0x56fd98[_0xe0d8('0xa0')][_0xe0d8('0x9c')];}if(_0x56fd98['account']['List']&&_0x56fd98[_0xe0d8('0xa0')][_0xe0d8('0x97')]['Contacts'][_0xe0d8('0x43')]){return _0x56fd98['account']['List'][_0xe0d8('0x99')][0x0];}var _0x5a9476=_['defaults'](_0x339daa[_0xe0d8('0x5b')],{'firstName':_0x339daa['body'][_0xe0d8('0x91')],'ListId':_0x564e5d['ListId']});_0x5a9476[_0x339daa['body'][_0xe0d8('0xa1')]]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0x91')];return db['CmContact'][_0xe0d8('0x5a')](_0x5a9476,{'fields':_0x556147,'raw':!![]});}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x39ffd5,null))['then'](function(_0x5b4b00){_0x56fd98['contact']=_0x5b4b00;var _0x2fd17e=_0x339daa['body'][_0xe0d8('0xa2')];if(_0x339daa['headers']['cf-connecting-ip']){_0x2fd17e=_0x339daa[_0xe0d8('0x87')][_0xe0d8('0xa3')];}else if(_0x339daa[_0xe0d8('0x87')][_0xe0d8('0xa4')]){_0x2fd17e=_['first'](_0x339daa[_0xe0d8('0x87')][_0xe0d8('0xa4')][_0xe0d8('0xa5')](','));}if(_0x5b4b00){var _0x7f6a6d={'ContactId':_0x5b4b00['id'],'ChatWebsiteId':_0x339daa[_0xe0d8('0x55')]['id'],'from':(_0x5b4b00['firstName']||'')+'\x20'+(_0x5b4b00[_0xe0d8('0xa6')]||''),'customerIp':_0x2fd17e,'customerPort':_0x339daa[_0xe0d8('0x87')]['x-real-port']?_0x339daa[_0xe0d8('0x87')][_0xe0d8('0xa7')]:null,'referer':_0x339daa['body'][_0xe0d8('0xa8')],'browserName':_0x55357d[_0xe0d8('0xa9')][_0xe0d8('0x35')]&&_0x55357d['browser'][_0xe0d8('0xaa')]?util[_0xe0d8('0xab')]('%s\x20%s',_0x55357d['browser']['name'],_0x55357d[_0xe0d8('0xa9')]['version']):'unknown','browserVersion':_0x55357d[_0xe0d8('0xa9')]['version']||_0xe0d8('0xac'),'osName':util[_0xe0d8('0xab')](_0xe0d8('0xad'),_0x55357d['os']['name'],_0x55357d['os'][_0xe0d8('0xaa')]),'osVersion':_0x55357d['os'][_0xe0d8('0xaa')],'deviceModel':_0x55357d[_0xe0d8('0xae')]['model']&&_0x55357d[_0xe0d8('0xae')][_0xe0d8('0xaf')]?util[_0xe0d8('0xab')](_0xe0d8('0xb0'),_0x55357d[_0xe0d8('0xae')][_0xe0d8('0x3f')],_0x55357d[_0xe0d8('0xae')]['vendor'],_0x55357d['device'][_0xe0d8('0x3d')]):null,'deviceVendor':_0x55357d[_0xe0d8('0xae')]['vendor'],'deviceType':_0x55357d[_0xe0d8('0xae')]['type'],'formData':JSON[_0xe0d8('0x20')](_0x339daa[_0xe0d8('0x5b')])};var _0x163a15={'ChatWebsiteId':_0x339daa[_0xe0d8('0x55')]['id'],'closed':![]};if(_0x339daa['body'][_0xe0d8('0xb1')]){_0x163a15[_0xe0d8('0xb1')]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb1')];return db[_0xe0d8('0xb2')]['find']({'where':_0x163a15})[_0xe0d8('0x1b')](function(_0x23108a){if(_0x23108a){return[_0x23108a,![]];}_0x7f6a6d[_0xe0d8('0xb1')]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb1')];_0x7f6a6d[_0xe0d8('0xb3')]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb3')];return db[_0xe0d8('0xb2')][_0xe0d8('0x5a')](_0x7f6a6d)[_0xe0d8('0x1b')](function(_0x17bd2e){return[_0x17bd2e,!![]];});});}_0x163a15[_0xe0d8('0xb4')]=_0x5b4b00['id'];if(_0x339daa['body']['interaction']&&_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb5')]['id']){_0x163a15['id']=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb5')]['id'];return db[_0xe0d8('0xb2')][_0xe0d8('0x59')]({'where':_0x163a15})[_0xe0d8('0x1b')](function(_0x41226d){if(_0x41226d){return[_0x41226d,![]];}return db[_0xe0d8('0xb2')][_0xe0d8('0x5a')](_0x7f6a6d)['then'](function(_0x5f0970){return[_0x5f0970,!![]];});});}return db['ChatInteraction']['create'](_0x7f6a6d)[_0xe0d8('0x1b')](function(_0x62ae07){return[_0x62ae07,!![]];});}})['spread'](function(_0x15795e,_0x38902e){if(_0x15795e){_0x4efe8b=_0x38902e;if(!_0x38902e){var _0x1cb1c4={'from':(_0x56fd98[_0xe0d8('0xb6')][_0xe0d8('0xb7')]||'')+'\x20'+(_0x56fd98[_0xe0d8('0xb6')][_0xe0d8('0xa6')]||'')};if(_0x339daa[_0xe0d8('0x5b')]['threadId']&&_0x339daa['body'][_0xe0d8('0xb8')]&&_0x339daa[_0xe0d8('0x5b')]['threadId']!=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb8')]){_0x1cb1c4[_0xe0d8('0xb1')]=_0x339daa[_0xe0d8('0x5b')][_0xe0d8('0xb8')];}return _0x15795e[_0xe0d8('0x61')](_0x1cb1c4);}else{return _0x15795e;}}})[_0xe0d8('0x1b')](function(_0x56cf7c){_0x56fd98[_0xe0d8('0xb5')]=_0x56cf7c[_0xe0d8('0x31')]({'plain':!![]});_0x56fd98[_0xe0d8('0xb5')][_0xe0d8('0xb9')]=_0x4efe8b;if(_0x56fd98[_0xe0d8('0xb5')][_0xe0d8('0xb9')]){if(_0x56fd98['account']['autoclose']){_0x56fd98['applications'][_0xe0d8('0xba')]({'id':0x0,'priority':_0x56fd98[_0xe0d8('0x9d')][_0xe0d8('0x43')]+0x1,'app':_0xe0d8('0xbb'),'appdata':_0xe0d8('0xbc'),'interval':'*,*,*,*'});}}return db[_0xe0d8('0xbd')][_0xe0d8('0x5a')]({'body':_0x339daa['body'][_0xe0d8('0x5b')],'ChatWebsiteId':_0x339daa[_0xe0d8('0x55')]['id'],'ChatInteractionId':_0x56cf7c['id'],'direction':'in','ContactId':_0x56fd98['contact']['id'],'AttachmentId':_0x339daa['body'][_0xe0d8('0xbe')]});})[_0xe0d8('0x1b')](function(_0x3c54d2){_0x56fd98[_0xe0d8('0x23')]=_0x3c54d2;if(_0x56fd98[_0xe0d8('0xb5')][_0xe0d8('0xbf')]){return db['User'][_0xe0d8('0x59')]({'attributes':['id',_0xe0d8('0x35')],'where':{'id':_0x56fd98[_0xe0d8('0xb5')]['UserId']}})['then'](function(_0x59840f){if(_0x59840f){_0x56fd98['applications'][_0xe0d8('0xc0')]({'id':0x0,'priority':0x0,'app':_0xe0d8('0xc1'),'appdata':_0x59840f[_0xe0d8('0x35')]+','+(_0x56fd98['account'][_0xe0d8('0xc2')]||0xa),'interval':'*,*,*,*'});_0x56fd98[_0xe0d8('0xc3')]=!![];}return respondWithRpcPromise(_0xe0d8('0xc4'),_0xe0d8('0xc5'),_0x56fd98);});}return respondWithRpcPromise(_0xe0d8('0xc4'),_0xe0d8('0xc5'),_0x56fd98);})[_0xe0d8('0x1b')](function(_0x143bdb){respondWithRpcPromise(_0xe0d8('0xc6'),'EventManager',{'event':_0xe0d8('0x85'),'message':_0x143bdb},client9002);return _0x143bdb;})[_0xe0d8('0x1b')](respondWithResult(_0x39ffd5,null))['catch'](handleError(_0x39ffd5,null));};exports[_0xe0d8('0xc7')]=function(_0x4964ab,_0x5abf2d,_0x417c29){var _0x252392,_0x32095c,_0x20185d;var _0x3642da=[];var _0x160ccb=[];var _0x524d3b={};return db[_0xe0d8('0x98')][_0xe0d8('0xc8')]()['then'](function(_0x209710){if(!_0x209710){throw new db['Sequelize'][(_0xe0d8('0x8a'))](_0xe0d8('0x8b'));}_0x160ccb=_[_0xe0d8('0x8e')](_[_0xe0d8('0x56')](_0x209710),['createdAt',_0xe0d8('0x8d')]);_0x3642da=_[_0xe0d8('0x8e')](_[_0xe0d8('0x56')](_0x209710),['createdAt',_0xe0d8('0x8d'),'CompanyId',_0xe0d8('0x90')]);if(_0x4964ab[_0xe0d8('0x5b')]['id']){delete _0x4964ab[_0xe0d8('0x5b')]['id'];}if(_['isNil'](_0x4964ab['body'][_0xe0d8('0x91')])){throw _0x5abf2d[_0xe0d8('0x27')](0x1f4)[_0xe0d8('0x36')](new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0xc9')));}if(_['isNil'](_0x4964ab['body'][_0xe0d8('0x5b')])||_0x4964ab['body']['body']===''){throw _0x5abf2d[_0xe0d8('0x27')](0x1f4)[_0xe0d8('0x36')](new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0x92')));}if(_[_0xe0d8('0x7a')](_0x4964ab[_0xe0d8('0x5b')][_0xe0d8('0xca')])){throw _0x5abf2d[_0xe0d8('0x27')](0x1f4)[_0xe0d8('0x36')](new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3642da));}if(!_[_0xe0d8('0x94')](_0x3642da,_0x4964ab[_0xe0d8('0x5b')][_0xe0d8('0xca')])){throw _0x5abf2d['status'](0x1f4)[_0xe0d8('0x36')](new db[(_0xe0d8('0x89'))][(_0xe0d8('0x8a'))](_0xe0d8('0xcb')+_0x3642da));}_0x524d3b[_0x4964ab['body'][_0xe0d8('0xca')]]=_0x4964ab[_0xe0d8('0x5b')][_0xe0d8('0x91')];})[_0xe0d8('0x1b')](function(){return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x4964ab['params']['id']},'include':[{'model':db['CmList'],'as':_0xe0d8('0x97')}]});})[_0xe0d8('0x1b')](handleEntityNotFound(_0x5abf2d,null))[_0xe0d8('0x1b')](function(_0x47372a){if(_0x47372a&&_0x47372a['List']){_0x32095c=_0x47372a;var _0x39a81d=_[_0xe0d8('0x14')](_0x4964ab[_0xe0d8('0x5b')],{'firstName':_0x4964ab[_0xe0d8('0x5b')]['from'],'phone':_0x4964ab['body'][_0xe0d8('0x91')],'ListId':_0x47372a[_0xe0d8('0x90')]});_0x39a81d[_0x4964ab['body'][_0xe0d8('0xca')]]=_0x4964ab['body'][_0xe0d8('0x91')];return db[_0xe0d8('0x98')][_0xe0d8('0xcc')]({'where':_0x524d3b,'defaults':_0x39a81d});}})[_0xe0d8('0xcd')](function(_0x141715){if(_0x141715){_0x20185d=_0x141715;var _0x47a812=fs[_0xe0d8('0xce')](path[_0xe0d8('0x75')](config[_0xe0d8('0x76')],_0xe0d8('0xcf')),_0xe0d8('0xd0'));var _0x4f13a3=ejs['render'](_0x47a812,{'body':_[_0xe0d8('0xd1')](_0x4964ab['body'][_0xe0d8('0x5b')]),'bodyTitle':_0x32095c[_0xe0d8('0xd2')]});return db[_0xe0d8('0xd3')][_0xe0d8('0x5a')]({'body':_0x4f13a3,'ContactId':_0x141715['id'],'ChatWebsiteId':_0x32095c['id']});}})[_0xe0d8('0x1b')](function(_0x428a6d){if(_0x428a6d){_0x252392=_0x428a6d;return db[_0xe0d8('0xd4')][_0xe0d8('0x66')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}})[_0xe0d8('0x1b')](function(_0x537511){if(_0x537511&&_0x537511[_0xe0d8('0xd5')]&&_0x32095c['forwardOfflineAddress']){var _0x26995a={'tls':{'rejectUnauthorized':![]}};if(_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xd6')]){_0x26995a[_0xe0d8('0xd6')]=_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xd6')];}else{_0x26995a[_0xe0d8('0xd7')]=_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xd7')];_0x26995a[_0xe0d8('0xd8')]=_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xd8')];_0x26995a[_0xe0d8('0xd9')]=_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xd9')];}if(_0x537511[_0xe0d8('0xd5')][_0xe0d8('0xda')]){_0x26995a[_0xe0d8('0xdb')]={'user':_0x537511['Smtp'][_0xe0d8('0x5c')],'pass':_0x537511['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xe0d8('0xdc'),{'account':_0x26995a,'message':{'from':util[_0xe0d8('0xab')](_0xe0d8('0xdd'),_0x537511[_0xe0d8('0x35')],_0x537511[_0xe0d8('0xde')]||_0x537511[_0xe0d8('0xd5')][_0xe0d8('0x5c')]),'to':_0x32095c[_0xe0d8('0xdf')],'subject':_0x32095c[_0xe0d8('0xe0')],'text':_0x252392[_0xe0d8('0x5b')]}},client9003)[_0xe0d8('0x1b')](function(){return _0x252392;})[_0xe0d8('0x53')](function(_0x1c7f4d){console['error'](_0x1c7f4d);});}})[_0xe0d8('0x1b')](function(){if(_0x252392){return _0x252392;}})[_0xe0d8('0x1b')](respondWithResult(_0x5abf2d,null))[_0xe0d8('0x53')](handleError(_0x5abf2d,null));};exports[_0xe0d8('0xe1')]=function(_0x436399,_0xd05f45,_0x325694){return db[_0xe0d8('0xb2')]['find']({'where':{'id':_0x436399[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0xd05f45,null))[_0xe0d8('0x1b')](function(_0x201cbc){if(_0x201cbc){return _0x201cbc['addInteraction'](_0x436399['body']['ids'],_[_0xe0d8('0xe2')](_0x436399[_0xe0d8('0x5b')],[_0xe0d8('0x69'),'id'])||{});}})[_0xe0d8('0x1b')](respondWithResult(_0xd05f45,null))[_0xe0d8('0x53')](handleError(_0xd05f45,null));};exports[_0xe0d8('0xe3')]=function(_0x595724,_0x101a36,_0x5f2263){var _0x5b0bc4={'raw':![],'where':{}};var _0x1bfc95={};var _0x317b50={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe0d8('0x66')]({'where':{'id':_0x595724[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x101a36,null))['then'](function(_0x1c22de){if(_0x1c22de){_0x1bfc95[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0xb2')][_0xe0d8('0x3c')]);_0x1bfc95[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0x595724[_0xe0d8('0x40')]);_0x1bfc95[_0xe0d8('0x4a')]=_[_0xe0d8('0x58')](_0x1bfc95['model'],_0x1bfc95['query']);_0x5b0bc4[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x1bfc95[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x595724[_0xe0d8('0x40')]['fields']));_0x5b0bc4[_0xe0d8('0x42')]=_0x5b0bc4[_0xe0d8('0x42')][_0xe0d8('0x43')]?_0x5b0bc4['attributes']:_0x1bfc95[_0xe0d8('0x3f')];if(!_0x595724[_0xe0d8('0x40')]['hasOwnProperty'](_0xe0d8('0x45'))){_0x5b0bc4[_0xe0d8('0x46')]=qs[_0xe0d8('0x46')](_0x595724[_0xe0d8('0x40')]['limit']);_0x5b0bc4['offset']=qs[_0xe0d8('0x2b')](_0x595724[_0xe0d8('0x40')][_0xe0d8('0x2b')]);}_0x5b0bc4['order']=qs[_0xe0d8('0x48')](_0x595724[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x5b0bc4[_0xe0d8('0x49')]=qs[_0xe0d8('0x4a')](_[_0xe0d8('0x4b')](_0x595724[_0xe0d8('0x40')],_0x1bfc95[_0xe0d8('0x4a')]));_0x5b0bc4[_0xe0d8('0x49')]['ChatWebsiteId']=_0x1c22de['id'];if(_0x595724[_0xe0d8('0x40')]['filter']){_0x5b0bc4[_0xe0d8('0x49')]=_[_0xe0d8('0x4d')](_0x5b0bc4[_0xe0d8('0x49')],{'$or':_[_0xe0d8('0x3a')](_0x5b0bc4[_0xe0d8('0x42')],function(_0xac8cf8){var _0x57ef5a={};_0x57ef5a[_0xac8cf8]={'$like':'%'+_0x595724[_0xe0d8('0x40')][_0xe0d8('0x4c')]+'%'};return _0x57ef5a;})});}_0x5b0bc4=_[_0xe0d8('0x4d')]({},_0x5b0bc4,_0x595724[_0xe0d8('0x4f')]);return db[_0xe0d8('0xb2')][_0xe0d8('0x2a')]({'where':_0x5b0bc4[_0xe0d8('0x49')]})['then'](function(_0xa719d5){_0x317b50[_0xe0d8('0x2a')]=_0xa719d5;if(_0x595724['query']['includeAll']){_0x5b0bc4[_0xe0d8('0x51')]=[{'model':db[_0xe0d8('0x98')],'as':_0xe0d8('0xe4'),'required':![]},{'model':db[_0xe0d8('0xe5')],'as':_0xe0d8('0xe6'),'attributes':[_0xe0d8('0x35'),'fullname',_0xe0d8('0xe7')],'required':![]},{'model':db[_0xe0d8('0xe8')],'as':_0xe0d8('0xe9'),'attributes':['id',_0xe0d8('0x35'),_0xe0d8('0xea')],'where':_0x595724[_0xe0d8('0x40')]['tag']?{'id':_0x595724['query'][_0xe0d8('0xeb')]}:undefined,'required':_0x595724['query'][_0xe0d8('0xeb')]?!![]:![]}];}return db[_0xe0d8('0xb2')][_0xe0d8('0x67')](_0x5b0bc4);})[_0xe0d8('0x1b')](function(_0x37e777){_0x317b50[_0xe0d8('0x52')]=_0x37e777;return _0x317b50;});}})[_0xe0d8('0x1b')](respondWithFilteredResult(_0x101a36,_0x5b0bc4))['catch'](handleError(_0x101a36,null));};function iftimePromise(_0x4b93e1,_0xc2e2bf){return respondWithRpcPromise(_0xe0d8('0xec'),_0xe0d8('0xed'),{'command':_0xc2e2bf[_0xe0d8('0xee')]?util[_0xe0d8('0xab')](_0xe0d8('0xef'),_0x4b93e1[_0xe0d8('0xf0')],_0xc2e2bf[_0xe0d8('0xee')]):util[_0xe0d8('0xab')](_0xe0d8('0xf1'),_0x4b93e1[_0xe0d8('0xf0')])},client9002)[_0xe0d8('0x1b')](function(_0x1b0203){var _0x25ec5e=_0x1b0203&&_0x1b0203[_0xe0d8('0xf2')]('true')>=0x0?!![]:![];logger['info'](_0xe0d8('0xf3'),_0xc2e2bf['id'],_0x4b93e1['id'],_0x4b93e1[_0xe0d8('0xf0')],_0x25ec5e?'ONLINE':'OFFLINE',_0xc2e2bf['timezone']?_0xc2e2bf[_0xe0d8('0xee')]:_0xe0d8('0xf4'));return _0x25ec5e;})['catch'](function(_0x49d52a){logger['error'](_0xe0d8('0xf3'),_0xc2e2bf['id'],_0x4b93e1['id'],_0x4b93e1[_0xe0d8('0xf0')],util[_0xe0d8('0xf5')](_0x49d52a,{'showHidden':![],'depth':null}),_0xc2e2bf[_0xe0d8('0xee')]?_0xc2e2bf['timezone']:_0xe0d8('0xf4'));return![];});}exports[_0xe0d8('0xed')]=function(_0x2fc12d,_0x40538e,_0x13761d){var _0x3937e7=0x0;var _0x4abe11=0x0;var _0x5d3a9a=![];var _0x86696c;var _0x2649b2;return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x2fc12d[_0xe0d8('0x55')]['id']},'include':[{'model':db[_0xe0d8('0xf6')],'as':_0xe0d8('0xf6'),'include':[{'model':db[_0xe0d8('0xf6')],'as':_0xe0d8('0xf7'),'attributes':['id',_0xe0d8('0xf0')],'raw':!![]}]}]})[_0xe0d8('0x1b')](handleEntityNotFound(_0x40538e,null))[_0xe0d8('0x1b')](function(_0x2be331){if(_0x2be331){_0x86696c=_0x2be331;return _0x2be331[_0xe0d8('0xf8')]({'raw':!![]});}})[_0xe0d8('0x1b')](function(_0x1ca8a0){if(_0x86696c){if(_0x1ca8a0){_0x2649b2=_0x1ca8a0;}}return require(_0xe0d8('0x12'))[_0xe0d8('0x78')]();})[_0xe0d8('0x1b')](function(_0x1bf7e7){if(_0x1bf7e7){_0x4abe11=_0x1bf7e7[_0xe0d8('0xf9')];_0x5d3a9a=_0x1bf7e7[_0xe0d8('0x79')];}})[_0xe0d8('0x1b')](function(){return db['ChatInteraction'][_0xe0d8('0x2a')]({'where':{'closed':![]}});})[_0xe0d8('0x1b')](function(_0x41dabb){_0x3937e7=_0x41dabb;if(_0x4abe11&&_0x41dabb>_0x4abe11){return db[_0xe0d8('0xfa')][_0xe0d8('0x66')]({'where':{'id':0x1}})[_0xe0d8('0x1b')](function(_0x104805){if(_0x104805){_0x104805[_0xe0d8('0xfb')]('chatLicenseExceeded');}});}})[_0xe0d8('0x1b')](function(){if(_0x86696c['Interval']&&_0x86696c['Interval'][_0xe0d8('0xf7')]){var _0x4dde97=[];for(var _0x38e8d6=0x0;_0x38e8d6<_0x86696c[_0xe0d8('0xf6')][_0xe0d8('0xf7')][_0xe0d8('0x43')];_0x38e8d6++){var _0x175043=_0x86696c['Interval'][_0xe0d8('0xf7')][_0x38e8d6][_0xe0d8('0x31')]({'plain':!![]});_0x4dde97[_0xe0d8('0xba')](iftimePromise(_0x175043,_0x86696c));}return BPromise[_0xe0d8('0xfc')](_0x4dde97)[_0xe0d8('0x1b')](function(_0x336006){return _[_0xe0d8('0xfd')](_0x336006);});}else{return!![];}})[_0xe0d8('0x1b')](function(_0x51c9cc){var _0x4e97f5=fs[_0xe0d8('0xce')](path['join'](config[_0xe0d8('0x76')],_0xe0d8('0xfe')),_0xe0d8('0xd0'));var _0x4253fd={'remote':_0x86696c[_0xe0d8('0xff')],'query':querystring[_0xe0d8('0x20')](_[_0xe0d8('0x4d')](_0x86696c[_0xe0d8('0x31')]({'plain':!![]}),{'customerIp':_0x2fc12d[_0xe0d8('0x87')][_0xe0d8('0xa4')]||_0x2fc12d[_0xe0d8('0x87')]['x-real-ip']||_0x2fc12d[_0xe0d8('0x100')]['remoteAddress']||_0x2fc12d['ip'],'referer':_0x2fc12d[_0xe0d8('0x87')]['referer'],'openedInteractions':_0x3937e7,'maxInteractions':_0x4abe11,'virtual':_0x5d3a9a['virtual'],'online':_0x51c9cc,'custom':_0x5d3a9a}))[_0xe0d8('0x101')](/'/g,'\x5c\x27')};_0x40538e[_0xe0d8('0x36')](ejs['render'](Mustache[_0xe0d8('0x102')](_0x4e97f5,_0x4253fd),{'proactiveActions':_0x2649b2,'alignment':_0x86696c[_0xe0d8('0x103')],'verticalAlignment':_0x86696c['verticalAlignment'],'div_color':_0x86696c[_0xe0d8('0xea')],'text_color':_0x86696c[_0xe0d8('0x104')]}));})[_0xe0d8('0x53')](handleError(_0x40538e,null));};exports[_0xe0d8('0x105')]=function(_0x294321,_0x36b893,_0x2060e9){return db[_0xe0d8('0x3b')][_0xe0d8('0x66')]({'where':{'id':_0x294321['params']['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x36b893,null))[_0xe0d8('0x1b')](function(_0x16a133){if(_0x16a133){return db[_0xe0d8('0x106')]['transaction'](function(_0x14945d){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x294321['params']['id']},'transaction':_0x14945d})[_0xe0d8('0x1b')](function(_0x50a3c0){var _0xc332ef=_['map'](_0x294321[_0xe0d8('0x5b')],function(_0x1a4d10){_0x1a4d10[_0xe0d8('0x63')]=_0x294321[_0xe0d8('0x55')]['id'];return _0x1a4d10;});return db[_0xe0d8('0x9b')][_0xe0d8('0x107')](_0xc332ef,{'transaction':_0x14945d});});})[_0xe0d8('0x1b')](function(){return db[_0xe0d8('0x9b')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x294321[_0xe0d8('0x55')]['id']},'order':_0xe0d8('0x9f')});});}})['then'](respondWithResult(_0x36b893,null))[_0xe0d8('0x53')](handleError(_0x36b893,null));};exports[_0xe0d8('0x108')]=function(_0x3c708f,_0x21d3ee,_0x5b1df7){var _0x1d5f5e={};var _0x2a546a={};var _0x552ca0;var _0x438aa0;return db['ChatWebsite'][_0xe0d8('0x66')]({'where':{'id':_0x3c708f[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x21d3ee,null))['then'](function(_0x18ad58){if(_0x18ad58){_0x552ca0=_0x18ad58;_0x2a546a[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0x9b')][_0xe0d8('0x3c')]);_0x2a546a[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0x3c708f[_0xe0d8('0x40')]);_0x2a546a[_0xe0d8('0x4a')]=_[_0xe0d8('0x58')](_0x2a546a[_0xe0d8('0x3f')],_0x2a546a[_0xe0d8('0x40')]);_0x1d5f5e[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x2a546a[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x3c708f[_0xe0d8('0x40')][_0xe0d8('0x41')]));_0x1d5f5e[_0xe0d8('0x42')]=_0x1d5f5e[_0xe0d8('0x42')]['length']?_0x1d5f5e['attributes']:_0x2a546a[_0xe0d8('0x3f')];_0x1d5f5e['order']=qs['sort'](_0x3c708f[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x1d5f5e[_0xe0d8('0x49')]=qs[_0xe0d8('0x4a')](_['pick'](_0x3c708f[_0xe0d8('0x40')],_0x2a546a[_0xe0d8('0x4a')]));if(_0x3c708f[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0x1d5f5e[_0xe0d8('0x49')]=_[_0xe0d8('0x4d')](_0x1d5f5e['where'],{'$or':_[_0xe0d8('0x3a')](_0x1d5f5e[_0xe0d8('0x42')],function(_0x7bc5de){var _0x13c23e={};_0x13c23e[_0x7bc5de]={'$like':'%'+_0x3c708f['query'][_0xe0d8('0x4c')]+'%'};return _0x13c23e;})});}_0x1d5f5e=_[_0xe0d8('0x4d')]({},_0x1d5f5e,_0x3c708f['options']);return _0x552ca0[_0xe0d8('0x108')](_0x1d5f5e);}})[_0xe0d8('0x1b')](function(_0x380584){if(_0x380584){_0x438aa0=_0x380584['length'];if(!_0x3c708f[_0xe0d8('0x40')][_0xe0d8('0x44')](_0xe0d8('0x45'))){_0x1d5f5e['limit']=qs['limit'](_0x3c708f[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0x1d5f5e[_0xe0d8('0x2b')]=qs[_0xe0d8('0x2b')](_0x3c708f['query'][_0xe0d8('0x2b')]);}return _0x552ca0[_0xe0d8('0x108')](_0x1d5f5e);}})[_0xe0d8('0x1b')](function(_0xc0d6b2){if(_0xc0d6b2){return _0xc0d6b2?{'count':_0x438aa0,'rows':_0xc0d6b2}:null;}})['then'](respondWithResult(_0x21d3ee,null))[_0xe0d8('0x53')](handleError(_0x21d3ee,null));};exports[_0xe0d8('0x109')]=function(_0x10bd58,_0x16c48d,_0x322ada){return db[_0xe0d8('0x10a')][_0xe0d8('0x59')]({'where':{'id':_0x10bd58['params']['id']}})['then'](handleEntityNotFound(_0x16c48d,null))['then'](function(_0x278be2){if(_0x278be2){return _0x278be2[_0xe0d8('0x109')](_0x10bd58[_0xe0d8('0x5b')][_0xe0d8('0x69')],_[_0xe0d8('0xe2')](_0x10bd58[_0xe0d8('0x5b')],[_0xe0d8('0x69'),'id'])||{});}})['then'](respondWithResult(_0x16c48d,null))[_0xe0d8('0x53')](handleError(_0x16c48d,null));};exports['getProactiveActions']=function(_0xd797a6,_0x3ec821,_0x5097fa){var _0x1b2b87={};var _0x42c88c={};var _0x2cb1b4;var _0x594962;return db[_0xe0d8('0x3b')][_0xe0d8('0x66')]({'where':{'id':_0xd797a6['params']['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x3ec821,null))['then'](function(_0x392d15){if(_0x392d15){_0x2cb1b4=_0x392d15;_0x42c88c[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0x10b')]['rawAttributes']);_0x42c88c[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0xd797a6['query']);_0x42c88c[_0xe0d8('0x4a')]=_['intersection'](_0x42c88c[_0xe0d8('0x3f')],_0x42c88c['query']);_0x1b2b87[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x42c88c[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0xd797a6[_0xe0d8('0x40')][_0xe0d8('0x41')]));_0x1b2b87[_0xe0d8('0x42')]=_0x1b2b87[_0xe0d8('0x42')][_0xe0d8('0x43')]?_0x1b2b87['attributes']:_0x42c88c[_0xe0d8('0x3f')];_0x1b2b87[_0xe0d8('0x47')]=qs[_0xe0d8('0x48')](_0xd797a6[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x1b2b87['where']=qs[_0xe0d8('0x4a')](_[_0xe0d8('0x4b')](_0xd797a6['query'],_0x42c88c[_0xe0d8('0x4a')]));if(_0xd797a6[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0x1b2b87['where']=_[_0xe0d8('0x4d')](_0x1b2b87[_0xe0d8('0x49')],{'$or':_[_0xe0d8('0x3a')](_0x1b2b87[_0xe0d8('0x42')],function(_0x22957e){var _0x14c6a2={};_0x14c6a2[_0x22957e]={'$like':'%'+_0xd797a6['query'][_0xe0d8('0x4c')]+'%'};return _0x14c6a2;})});}_0x1b2b87=_[_0xe0d8('0x4d')]({},_0x1b2b87,_0xd797a6[_0xe0d8('0x4f')]);return _0x2cb1b4[_0xe0d8('0xf8')](_0x1b2b87);}})[_0xe0d8('0x1b')](function(_0x2153ef){if(_0x2153ef){_0x594962=_0x2153ef['length'];if(!_0xd797a6[_0xe0d8('0x40')]['hasOwnProperty'](_0xe0d8('0x45'))){_0x1b2b87[_0xe0d8('0x46')]=qs[_0xe0d8('0x46')](_0xd797a6[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0x1b2b87[_0xe0d8('0x2b')]=qs[_0xe0d8('0x2b')](_0xd797a6[_0xe0d8('0x40')][_0xe0d8('0x2b')]);}return _0x2cb1b4[_0xe0d8('0xf8')](_0x1b2b87);}})[_0xe0d8('0x1b')](function(_0x28dd49){if(_0x28dd49){return _0x28dd49?{'count':_0x594962,'rows':_0x28dd49}:null;}})[_0xe0d8('0x1b')](respondWithResult(_0x3ec821,null))[_0xe0d8('0x53')](handleError(_0x3ec821,null));};exports[_0xe0d8('0x10c')]=function(_0x221bff,_0x153fb7,_0x1f0b1a){var _0x2e8b8c=_0x221bff[_0xe0d8('0x40')]['online']==='false'?_0xe0d8('0x10d'):_0xe0d8('0x10e');return db[_0xe0d8('0x3b')]['find']({'attributes':['id',_0x2e8b8c],'where':{'id':_0x221bff[_0xe0d8('0x55')]['id']}})['then'](handleEntityNotFound(_0x153fb7,null))[_0xe0d8('0x1b')](function(_0x246114){if(_0x246114){var _0x368eb4=_0x246114[_0x2e8b8c];var _0x5b5272=_0x368eb4&&_0x368eb4[_0xe0d8('0x10f')]?_0x368eb4[_0xe0d8('0x10f')]:[];_0x153fb7[_0xe0d8('0x36')]({'fromKey':_['isNil'](_0x368eb4[_0xe0d8('0x110')])?undefined:_0x368eb4[_0xe0d8('0x110')],'count':_0x5b5272[_0xe0d8('0x43')],'rows':_0x5b5272});}})[_0xe0d8('0x53')](handleError(_0x153fb7,null));};exports[_0xe0d8('0x111')]=function(_0x3c4973,_0x28f32b,_0x383a16){var _0x23983a={'raw':![],'where':{}};var _0x3d09da={};var _0x1ee157={'count':0x0,'rows':[]};return db[_0xe0d8('0x3b')]['findOne']({'where':{'id':_0x3c4973[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x28f32b,null))['then'](function(_0x267ef0){if(_0x267ef0){_0x3d09da[_0xe0d8('0x3f')]=_['keys'](db['ChatOfflineMessage'][_0xe0d8('0x3c')]);_0x3d09da[_0xe0d8('0x40')]=_[_0xe0d8('0x56')](_0x3c4973[_0xe0d8('0x40')]);_0x3d09da[_0xe0d8('0x4a')]=_['intersection'](_0x3d09da[_0xe0d8('0x3f')],_0x3d09da[_0xe0d8('0x40')]);_0x23983a[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x3d09da[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x3c4973[_0xe0d8('0x40')]['fields']));_0x23983a[_0xe0d8('0x42')]=_0x23983a[_0xe0d8('0x42')]['length']?_0x23983a[_0xe0d8('0x42')]:_0x3d09da['model'];if(!_0x3c4973[_0xe0d8('0x40')][_0xe0d8('0x44')]('nolimit')){_0x23983a['limit']=qs[_0xe0d8('0x46')](_0x3c4973[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0x23983a[_0xe0d8('0x2b')]=qs['offset'](_0x3c4973['query'][_0xe0d8('0x2b')]);}_0x23983a[_0xe0d8('0x47')]=qs['sort'](_0x3c4973['query']['sort']);_0x23983a['where']=qs[_0xe0d8('0x4a')](_[_0xe0d8('0x4b')](_0x3c4973[_0xe0d8('0x40')],_0x3d09da['filters']));_0x23983a[_0xe0d8('0x49')]['ChatWebsiteId']=_0x267ef0['id'];if(_0x3c4973[_0xe0d8('0x40')][_0xe0d8('0x4c')]){_0x23983a[_0xe0d8('0x49')]=_['merge'](_0x23983a[_0xe0d8('0x49')],{'$or':_['map'](_0x23983a[_0xe0d8('0x42')],function(_0x595d19){var _0x4da18c={};_0x4da18c[_0x595d19]={'$like':'%'+_0x3c4973[_0xe0d8('0x40')][_0xe0d8('0x4c')]+'%'};return _0x4da18c;})});}_0x23983a=_[_0xe0d8('0x4d')]({},_0x23983a,_0x3c4973[_0xe0d8('0x4f')]);return db[_0xe0d8('0xd3')][_0xe0d8('0x2a')]({'where':_0x23983a['where']})['then'](function(_0x134485){_0x1ee157[_0xe0d8('0x2a')]=_0x134485;if(_0x3c4973['query'][_0xe0d8('0x50')]){_0x23983a['include']=[{'all':!![]}];}else{_0x23983a[_0xe0d8('0x51')]=[{'model':db[_0xe0d8('0x98')],'as':'Contact','required':![]}];}return db[_0xe0d8('0xd3')][_0xe0d8('0x67')](_0x23983a);})['then'](function(_0x48a36d){_0x1ee157[_0xe0d8('0x52')]=_0x48a36d;return _0x1ee157;});}})[_0xe0d8('0x1b')](respondWithFilteredResult(_0x28f32b,_0x23983a))[_0xe0d8('0x53')](handleError(_0x28f32b,null));};exports[_0xe0d8('0x112')]=function(_0x55d99d,_0x5cff13,_0xd8b1a8){return db['ChatWebsite']['find']({'where':{'id':_0x55d99d['params']['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x5cff13,null))['then'](function(_0x409439){if(_0x409439){return _0x409439[_0xe0d8('0x112')](_0x55d99d[_0xe0d8('0x5b')][_0xe0d8('0x69')],_[_0xe0d8('0xe2')](_0x55d99d[_0xe0d8('0x5b')],['ids','id'])||{})[_0xe0d8('0xcd')](function(_0x4a035a){for(var _0x4aa3d0=0x0;_0x4aa3d0<_0x55d99d[_0xe0d8('0x5b')][_0xe0d8('0x69')][_0xe0d8('0x43')];_0x4aa3d0+=0x1){socket[_0xe0d8('0x113')](_0xe0d8('0x114'),{'UserId':_0x55d99d['body']['ids'][_0x4aa3d0],'ChatWebsiteId':_0x55d99d[_0xe0d8('0x55')]['id']});}return _0x4a035a;});}})[_0xe0d8('0x1b')](respondWithResult(_0x5cff13,null))[_0xe0d8('0x53')](handleError(_0x5cff13,null));};exports[_0xe0d8('0x115')]=function(_0x4a3632,_0x2e616a,_0x105909){return db[_0xe0d8('0x3b')][_0xe0d8('0x59')]({'where':{'id':_0x4a3632[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x2e616a,null))[_0xe0d8('0x1b')](function(_0x3788d3){if(_0x3788d3){return _0x3788d3['removeAgents'](_0x4a3632[_0xe0d8('0x40')][_0xe0d8('0x69')])[_0xe0d8('0x1b')](function(){if(_[_0xe0d8('0x116')](_0x4a3632['query']['ids'])){for(var _0x5425a9=0x0;_0x5425a9<_0x4a3632[_0xe0d8('0x40')][_0xe0d8('0x69')][_0xe0d8('0x43')];_0x5425a9+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x4a3632[_0xe0d8('0x40')][_0xe0d8('0x69')][_0x5425a9]),'ChatWebsiteId':Number(_0x4a3632[_0xe0d8('0x55')]['id'])});}}else{socket[_0xe0d8('0x113')]('userChatWebsite:remove',{'UserId':Number(_0x4a3632[_0xe0d8('0x40')][_0xe0d8('0x69')]),'ChatWebsiteId':Number(_0x4a3632['params']['id'])});}});}})[_0xe0d8('0x1b')](respondWithStatusCode(_0x2e616a,null))[_0xe0d8('0x53')](handleError(_0x2e616a,null));};exports[_0xe0d8('0x117')]=function(_0x34c4c0,_0x4d65df,_0x393d47){var _0x943a66={};var _0x481ce2={};var _0x4fa2dd;var _0x25b515;return db['ChatWebsite'][_0xe0d8('0x66')]({'where':{'id':_0x34c4c0[_0xe0d8('0x55')]['id']}})[_0xe0d8('0x1b')](handleEntityNotFound(_0x4d65df,null))[_0xe0d8('0x1b')](function(_0x2bd709){if(_0x2bd709){_0x4fa2dd=_0x2bd709;_0x481ce2[_0xe0d8('0x3f')]=_[_0xe0d8('0x56')](db[_0xe0d8('0xe5')][_0xe0d8('0x3c')]);_0x481ce2[_0xe0d8('0x40')]=_['keys'](_0x34c4c0[_0xe0d8('0x40')]);_0x481ce2[_0xe0d8('0x4a')]=_[_0xe0d8('0x58')](_0x481ce2[_0xe0d8('0x3f')],_0x481ce2[_0xe0d8('0x40')]);_0x943a66[_0xe0d8('0x42')]=_[_0xe0d8('0x58')](_0x481ce2[_0xe0d8('0x3f')],qs[_0xe0d8('0x41')](_0x34c4c0['query'][_0xe0d8('0x41')]));_0x943a66['attributes']=_0x943a66[_0xe0d8('0x42')]['length']?_0x943a66['attributes']:_0x481ce2[_0xe0d8('0x3f')];_0x943a66['order']=qs[_0xe0d8('0x48')](_0x34c4c0[_0xe0d8('0x40')][_0xe0d8('0x48')]);_0x943a66[_0xe0d8('0x49')]=qs[_0xe0d8('0x4a')](_['pick'](_0x34c4c0[_0xe0d8('0x40')],_0x481ce2[_0xe0d8('0x4a')]));if(_0x34c4c0[_0xe0d8('0x40')]['filter']){_0x943a66[_0xe0d8('0x49')]=_[_0xe0d8('0x4d')](_0x943a66['where'],{'$or':_['map'](_0x943a66['attributes'],function(_0x1464ee){var _0x4a2383={};_0x4a2383[_0x1464ee]={'$like':'%'+_0x34c4c0[_0xe0d8('0x40')]['filter']+'%'};return _0x4a2383;})});}_0x943a66=_[_0xe0d8('0x4d')]({},_0x943a66,_0x34c4c0[_0xe0d8('0x4f')]);return _0x4fa2dd['getAgents'](_0x943a66);}})[_0xe0d8('0x1b')](function(_0x437c43){if(_0x437c43){_0x25b515=_0x437c43[_0xe0d8('0x43')];if(!_0x34c4c0[_0xe0d8('0x40')][_0xe0d8('0x44')](_0xe0d8('0x45'))){_0x943a66[_0xe0d8('0x46')]=qs[_0xe0d8('0x46')](_0x34c4c0[_0xe0d8('0x40')][_0xe0d8('0x46')]);_0x943a66[_0xe0d8('0x2b')]=qs[_0xe0d8('0x2b')](_0x34c4c0['query'][_0xe0d8('0x2b')]);}return _0x4fa2dd[_0xe0d8('0x117')](_0x943a66);}})[_0xe0d8('0x1b')](function(_0x588e07){if(_0x588e07){return _0x588e07?{'count':_0x25b515,'rows':_0x588e07}:null;}})[_0xe0d8('0x1b')](respondWithResult(_0x4d65df,null))[_0xe0d8('0x53')](handleError(_0x4d65df,null));}; \ No newline at end of file +var _0xbd2f=['findOne','hasOwnProperty','findAll','removeDispositions','ids','CannedAnswer','removeAnswers','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','server/files/images/logos/','getAvatar','isNil','existsSync','server/files/images/avatars/','download','server/files/images/avatars/customer_avatar.png','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','mapKeyOffline','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','indexOf','true','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','x-real-ip','replace','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','rows','keys','filtears','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions'];(function(_0x5bf078,_0x3df717){var _0x2264ba=function(_0x218ce2){while(--_0x218ce2){_0x5bf078['push'](_0x5bf078['shift']());}};_0x2264ba(++_0x3df717);}(_0xbd2f,0x1d2));var _0xfbd2=function(_0x9c52c5,_0xfdcab6){_0x9c52c5=_0x9c52c5-0x0;var _0x1ecb93=_0xbd2f[_0x9c52c5];return _0x1ecb93;};'use strict';var pdf=require(_0xfbd2('0x0'));var emlformat=require(_0xfbd2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfbd2('0x2'));var jsonpatch=require(_0xfbd2('0x3'));var rp=require(_0xfbd2('0x4'));var moment=require('moment');var BPromise=require(_0xfbd2('0x5'));var Mustache=require('mustache');var util=require(_0xfbd2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfbd2('0x7'));var ejs=require(_0xfbd2('0x8'));var fs=require('fs');var _=require(_0xfbd2('0x9'));var squel=require(_0xfbd2('0xa'));var crypto=require(_0xfbd2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfbd2('0xc'));var toCsv=require(_0xfbd2('0x7'));var querystring=require(_0xfbd2('0xd'));var Papa=require(_0xfbd2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfbd2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbd2('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfbd2('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbd2('0x12'))['db'];config[_0xfbd2('0x13')]=_[_0xfbd2('0x14')](config[_0xfbd2('0x13')],{'host':_0xfbd2('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfbd2('0x13')]));require(_0xfbd2('0x16'))['register'](socket);var jayson=require(_0xfbd2('0x17'));var client=jayson[_0xfbd2('0x18')][_0xfbd2('0x19')]({'port':0x232c});var client9002=jayson[_0xfbd2('0x18')][_0xfbd2('0x19')]({'port':0x232a});var client9003=jayson[_0xfbd2('0x18')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5722fe,_0x7ee5eb,_0x99c252,_0x55029c){return new BPromise(function(_0x35d71f,_0x244146){var _0x30dbf4=_0x55029c||client;return _0x30dbf4[_0xfbd2('0x1a')](_0x5722fe,_0x99c252)[_0xfbd2('0x1b')](function(_0x36e307){logger['info'](_0xfbd2('0x1c'),_0x7ee5eb,_0xfbd2('0x1d'));logger[_0xfbd2('0x1e')](_0xfbd2('0x1f'),_0x7ee5eb,_0xfbd2('0x1d'),JSON['stringify'](_0x36e307));if(_0x36e307[_0xfbd2('0x20')]){if(_0x36e307['error'][_0xfbd2('0x21')]===0x1f4){logger[_0xfbd2('0x20')](_0xfbd2('0x1c'),_0x7ee5eb,_0x36e307[_0xfbd2('0x20')][_0xfbd2('0x22')]);return _0x244146(_0x36e307[_0xfbd2('0x20')][_0xfbd2('0x22')]);}logger[_0xfbd2('0x20')](_0xfbd2('0x1c'),_0x7ee5eb,_0x36e307['error'][_0xfbd2('0x22')]);return _0x35d71f(_0x36e307[_0xfbd2('0x20')]['message']);}else{logger['info'](_0xfbd2('0x1c'),_0x7ee5eb,_0xfbd2('0x1d'));_0x35d71f(_0x36e307[_0xfbd2('0x23')]['message']);}})[_0xfbd2('0x24')](function(_0x74ed64){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x7ee5eb,_0x74ed64);_0x244146(_0x74ed64);});});}function respondWithStatusCode(_0x3a75df,_0x5e2784){_0x5e2784=_0x5e2784||0xcc;return function(_0x5aef12){if(_0x5aef12){return _0x3a75df[_0xfbd2('0x25')](_0x5e2784);}return _0x3a75df[_0xfbd2('0x26')](_0x5e2784)['end']();};}function respondWithResult(_0x31fa5e,_0x543b47){_0x543b47=_0x543b47||0xc8;return function(_0x2192cb){if(_0x2192cb){return _0x31fa5e[_0xfbd2('0x26')](_0x543b47)[_0xfbd2('0x27')](_0x2192cb);}};}function respondWithFilteredResult(_0x374643,_0x314d4c){return function(_0x310985){if(_0x310985){var _0x458b63=_0x310985['count'],_0x26e271=_0x314d4c[_0xfbd2('0x28')],_0x289e25=_0x314d4c[_0xfbd2('0x28')]+_0x314d4c[_0xfbd2('0x29')],_0x4df71e;if(_0x289e25>=_0x458b63){_0x289e25=_0x458b63;_0x4df71e=0xc8;}else{_0x4df71e=0xce;}_0x374643[_0xfbd2('0x26')](_0x4df71e);return _0x374643[_0xfbd2('0x2a')](_0xfbd2('0x2b'),_0x26e271+'-'+_0x289e25+'/'+_0x458b63)['json'](_0x310985);}return null;};}function patchUpdates(_0x2e3a1f){return function(_0x19a383){try{jsonpatch['apply'](_0x19a383,_0x2e3a1f,!![]);}catch(_0x3221bc){return BPromise[_0xfbd2('0x2c')](_0x3221bc);}return _0x19a383[_0xfbd2('0x2d')]();};}function saveUpdates(_0x20bd13,_0x394f3f){return function(_0x59987f){if(_0x59987f){return _0x59987f[_0xfbd2('0x2e')](_0x20bd13)[_0xfbd2('0x1b')](function(_0x514731){return _0x514731;});}return null;};}function removeEntity(_0x376e37,_0x50ec7f){return function(_0x5e386d){if(_0x5e386d){return _0x5e386d[_0xfbd2('0x2f')]()[_0xfbd2('0x1b')](function(){var _0x3cb0a5=_0x5e386d[_0xfbd2('0x30')]({'plain':!![]});var _0x3ce4c4=_0xfbd2('0x31');return db[_0xfbd2('0x32')][_0xfbd2('0x2f')]({'where':{'type':_0x3ce4c4,'resourceId':_0x3cb0a5['id']}})[_0xfbd2('0x1b')](function(){return _0x5e386d;});})['then'](function(){_0x376e37['status'](0xcc)[_0xfbd2('0x33')]();});}};}function handleEntityNotFound(_0xe449b5,_0x2594de){return function(_0x442b1e){if(!_0x442b1e){_0xe449b5[_0xfbd2('0x25')](0x194);}return _0x442b1e;};}function handleError(_0x5eb30e,_0x414717){_0x414717=_0x414717||0x1f4;return function(_0x1b9642){logger[_0xfbd2('0x20')](_0x1b9642[_0xfbd2('0x34')]);if(_0x1b9642[_0xfbd2('0x35')]){delete _0x1b9642[_0xfbd2('0x35')];}_0x5eb30e['status'](_0x414717)[_0xfbd2('0x36')](_0x1b9642);};}exports[_0xfbd2('0x37')]=function(_0x18b3ba,_0x2eba77){var _0x543cab={'include':[{'model':db[_0xfbd2('0x38')],'as':_0xfbd2('0x39')}]},_0x411471={},_0x12f1cc={'count':0x0,'rows':[]};var _0x58c70b=_[_0xfbd2('0x3a')](db[_0xfbd2('0x3b')][_0xfbd2('0x3c')],function(_0x3109ce){return{'name':_0x3109ce[_0xfbd2('0x3d')],'type':_0x3109ce[_0xfbd2('0x3e')][_0xfbd2('0x3f')]};});_0x411471['model']=_[_0xfbd2('0x3a')](_0x58c70b,_0xfbd2('0x35'));_0x411471[_0xfbd2('0x40')]=_['keys'](_0x18b3ba[_0xfbd2('0x40')]);_0x411471[_0xfbd2('0x41')]=_[_0xfbd2('0x42')](_0x411471[_0xfbd2('0x43')],_0x411471[_0xfbd2('0x40')]);_0x543cab[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x411471[_0xfbd2('0x43')],qs[_0xfbd2('0x45')](_0x18b3ba[_0xfbd2('0x40')][_0xfbd2('0x45')]));_0x543cab[_0xfbd2('0x44')]=_0x543cab[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x543cab[_0xfbd2('0x44')]:_0x411471[_0xfbd2('0x43')];if(!_0x18b3ba[_0xfbd2('0x40')]['hasOwnProperty'](_0xfbd2('0x47'))){_0x543cab[_0xfbd2('0x29')]=qs['limit'](_0x18b3ba[_0xfbd2('0x40')][_0xfbd2('0x29')]);_0x543cab[_0xfbd2('0x28')]=qs['offset'](_0x18b3ba[_0xfbd2('0x40')]['offset']);}_0x543cab[_0xfbd2('0x48')]=qs[_0xfbd2('0x49')](_0x18b3ba[_0xfbd2('0x40')]['sort']);_0x543cab['where']=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0x18b3ba['query'],_0x411471[_0xfbd2('0x41')]),_0x58c70b);if(_0x18b3ba['query']['filter']){_0x543cab[_0xfbd2('0x4b')]=_['merge'](_0x543cab[_0xfbd2('0x4b')],{'$or':_['map'](_0x58c70b,function(_0x2b6e01){if(_0x2b6e01['type']!==_0xfbd2('0x4c')){var _0x1e7474={};_0x1e7474[_0x2b6e01['name']]={'$like':'%'+_0x18b3ba[_0xfbd2('0x40')][_0xfbd2('0x4d')]+'%'};return _0x1e7474;}})});}_0x543cab=_[_0xfbd2('0x4e')]({},_0x543cab,_0x18b3ba[_0xfbd2('0x4f')]);var _0x1a6bee={'where':_0x543cab[_0xfbd2('0x4b')]};return db[_0xfbd2('0x3b')][_0xfbd2('0x50')](_0x1a6bee)[_0xfbd2('0x1b')](function(_0xe25b93){_0x12f1cc[_0xfbd2('0x50')]=_0xe25b93;if(_0x18b3ba[_0xfbd2('0x40')]['includeAll']){_0x543cab['include']=[{'all':!![]}];}return db[_0xfbd2('0x3b')]['findAll'](_0x543cab);})['then'](function(_0x47421e){_0x12f1cc[_0xfbd2('0x51')]=_0x47421e;return _0x12f1cc;})[_0xfbd2('0x1b')](respondWithFilteredResult(_0x2eba77,_0x543cab))[_0xfbd2('0x24')](handleError(_0x2eba77,null));};exports['show']=function(_0x51ea56,_0x597526){var _0x45a2cb={'raw':![],'where':{'id':_0x51ea56['params']['id']},'include':[{'model':db['Pause'],'as':_0xfbd2('0x39')}]},_0x1fa3d2={};_0x1fa3d2['model']=_[_0xfbd2('0x52')](db['ChatWebsite'][_0xfbd2('0x3c')]);_0x1fa3d2[_0xfbd2('0x40')]=_['keys'](_0x51ea56[_0xfbd2('0x40')]);_0x1fa3d2[_0xfbd2('0x53')]=_['intersection'](_0x1fa3d2[_0xfbd2('0x43')],_0x1fa3d2['query']);_0x45a2cb[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x1fa3d2['model'],qs[_0xfbd2('0x45')](_0x51ea56['query'][_0xfbd2('0x45')]));_0x45a2cb[_0xfbd2('0x44')]=_0x45a2cb[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x45a2cb[_0xfbd2('0x44')]:_0x1fa3d2['model'];if(_0x51ea56[_0xfbd2('0x40')][_0xfbd2('0x54')]){_0x45a2cb[_0xfbd2('0x55')]=[{'all':!![]}];}_0x45a2cb=_[_0xfbd2('0x4e')]({},_0x45a2cb,_0x51ea56[_0xfbd2('0x4f')]);return db[_0xfbd2('0x3b')][_0xfbd2('0x56')](_0x45a2cb)[_0xfbd2('0x1b')](handleEntityNotFound(_0x597526,null))[_0xfbd2('0x1b')](respondWithResult(_0x597526,null))[_0xfbd2('0x24')](handleError(_0x597526,null));};exports[_0xfbd2('0x57')]=function(_0xa8ca02,_0x1e67c0){return db[_0xfbd2('0x3b')][_0xfbd2('0x57')](_0xa8ca02['body'],{})[_0xfbd2('0x1b')](function(_0x2e3c62){var _0x53b4c7=_0xa8ca02[_0xfbd2('0x58')][_0xfbd2('0x30')]({'plain':!![]});if(!_0x53b4c7)throw new Error(_0xfbd2('0x59'));if(_0x53b4c7[_0xfbd2('0x5a')]===_0xfbd2('0x58')){var _0x2e3f55=_0x2e3c62[_0xfbd2('0x30')]({'plain':!![]});var _0xb007b0=_0xfbd2('0x31');return db[_0xfbd2('0x5b')][_0xfbd2('0x56')]({'where':{'name':_0xb007b0,'userProfileId':_0x53b4c7[_0xfbd2('0x5c')]},'raw':!![]})[_0xfbd2('0x1b')](function(_0x2da167){if(_0x2da167&&_0x2da167[_0xfbd2('0x5d')]===0x0){return db[_0xfbd2('0x32')]['create']({'name':_0x2e3f55[_0xfbd2('0x35')],'resourceId':_0x2e3f55['id'],'type':_0x2da167['name'],'sectionId':_0x2da167['id']},{})[_0xfbd2('0x1b')](function(){return _0x2e3c62;});}else{return _0x2e3c62;}})['catch'](function(_0x37f773){logger['error'](_0xfbd2('0x5e'),_0x37f773);throw _0x37f773;});}return _0x2e3c62;})[_0xfbd2('0x1b')](respondWithResult(_0x1e67c0,0xc9))[_0xfbd2('0x24')](handleError(_0x1e67c0,null));};exports['update']=function(_0x27abfd,_0x402466){if(_0x27abfd[_0xfbd2('0x5f')]['id']){delete _0x27abfd[_0xfbd2('0x5f')]['id'];}return db[_0xfbd2('0x3b')]['find']({'where':{'id':_0x27abfd[_0xfbd2('0x60')]['id']},'include':[{'model':db[_0xfbd2('0x38')],'as':_0xfbd2('0x39')}]})[_0xfbd2('0x1b')](handleEntityNotFound(_0x402466,null))[_0xfbd2('0x1b')](saveUpdates(_0x27abfd[_0xfbd2('0x5f')],null))[_0xfbd2('0x1b')](respondWithResult(_0x402466,null))['catch'](handleError(_0x402466,null));};exports[_0xfbd2('0x2f')]=function(_0x4faf79,_0x365696){return db[_0xfbd2('0x3b')]['find']({'where':{'id':_0x4faf79[_0xfbd2('0x60')]['id']}})['then'](handleEntityNotFound(_0x365696,null))[_0xfbd2('0x1b')](removeEntity(_0x365696,null))[_0xfbd2('0x24')](handleError(_0x365696,null));};exports[_0xfbd2('0x61')]=function(_0x35e6e9,_0x3a8588){return db[_0xfbd2('0x3b')][_0xfbd2('0x61')]()['then'](respondWithResult(_0x3a8588,null))['catch'](handleError(_0x3a8588,null));};exports[_0xfbd2('0x62')]=function(_0x18824a,_0x11f40a,_0x452b5e){if(_0x18824a[_0xfbd2('0x5f')]['id']){delete _0x18824a['body']['id'];}return db['ChatWebsite'][_0xfbd2('0x56')]({'where':{'id':_0x18824a[_0xfbd2('0x60')]['id']}})['then'](handleEntityNotFound(_0x11f40a,null))[_0xfbd2('0x1b')](function(_0x14c38b){if(_0x14c38b){_0x18824a[_0xfbd2('0x5f')][_0xfbd2('0x63')]=_0x14c38b['id'];return db[_0xfbd2('0x64')][_0xfbd2('0x57')](_0x18824a[_0xfbd2('0x5f')]);}})[_0xfbd2('0x1b')](respondWithResult(_0x11f40a,null))['catch'](handleError(_0x11f40a,null));};exports[_0xfbd2('0x65')]=function(_0xa3cb56,_0x2dc68c,_0x456cf4){var _0x13acb4={'raw':![],'where':{}};var _0x5392bc={};var _0x19694d={'count':0x0,'rows':[]};return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0xa3cb56[_0xfbd2('0x60')]['id']}})['then'](handleEntityNotFound(_0x2dc68c,null))[_0xfbd2('0x1b')](function(_0x13c9af){if(_0x13c9af){_0x5392bc['model']=_[_0xfbd2('0x52')](db['Disposition'][_0xfbd2('0x3c')]);_0x5392bc[_0xfbd2('0x40')]=_[_0xfbd2('0x52')](_0xa3cb56['query']);_0x5392bc[_0xfbd2('0x41')]=_[_0xfbd2('0x42')](_0x5392bc[_0xfbd2('0x43')],_0x5392bc[_0xfbd2('0x40')]);_0x13acb4[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x5392bc['model'],qs[_0xfbd2('0x45')](_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x45')]));_0x13acb4[_0xfbd2('0x44')]=_0x13acb4[_0xfbd2('0x44')]['length']?_0x13acb4['attributes']:_0x5392bc[_0xfbd2('0x43')];if(!_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x67')](_0xfbd2('0x47'))){_0x13acb4[_0xfbd2('0x29')]=qs['limit'](_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x29')]);_0x13acb4['offset']=qs[_0xfbd2('0x28')](_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x28')]);}_0x13acb4['order']=qs[_0xfbd2('0x49')](_0xa3cb56['query'][_0xfbd2('0x49')]);_0x13acb4[_0xfbd2('0x4b')]=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0xa3cb56[_0xfbd2('0x40')],_0x5392bc[_0xfbd2('0x41')]));_0x13acb4[_0xfbd2('0x4b')][_0xfbd2('0x63')]=_0x13c9af['id'];if(_0xa3cb56['query'][_0xfbd2('0x4d')]){_0x13acb4[_0xfbd2('0x4b')]=_[_0xfbd2('0x4e')](_0x13acb4[_0xfbd2('0x4b')],{'$or':_['map'](_0x13acb4[_0xfbd2('0x44')],function(_0x2c843b){var _0x133fd0={};_0x133fd0[_0x2c843b]={'$like':'%'+_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x4d')]+'%'};return _0x133fd0;})});}_0x13acb4=_['merge']({},_0x13acb4,_0xa3cb56[_0xfbd2('0x4f')]);return db[_0xfbd2('0x64')][_0xfbd2('0x50')]({'where':_0x13acb4[_0xfbd2('0x4b')]})[_0xfbd2('0x1b')](function(_0x93701f){_0x19694d[_0xfbd2('0x50')]=_0x93701f;if(_0xa3cb56[_0xfbd2('0x40')][_0xfbd2('0x54')]){_0x13acb4['include']=[{'all':!![]}];}return db[_0xfbd2('0x64')][_0xfbd2('0x68')](_0x13acb4);})[_0xfbd2('0x1b')](function(_0xf7ee89){_0x19694d[_0xfbd2('0x51')]=_0xf7ee89;return _0x19694d;});}})['then'](respondWithFilteredResult(_0x2dc68c,_0x13acb4))[_0xfbd2('0x24')](handleError(_0x2dc68c,null));};exports[_0xfbd2('0x69')]=function(_0x4047af,_0x2bf898,_0xf06acb){return db[_0xfbd2('0x3b')]['find']({'where':{'id':_0x4047af[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x2bf898,null))[_0xfbd2('0x1b')](function(_0x1c6b2b){if(_0x1c6b2b){return _0x1c6b2b[_0xfbd2('0x69')](_0x4047af[_0xfbd2('0x40')][_0xfbd2('0x6a')]);}})['then'](respondWithStatusCode(_0x2bf898,null))[_0xfbd2('0x24')](handleError(_0x2bf898,null));};exports['addAnswer']=function(_0x3d28bc,_0x4a42bc,_0x47ac53){if(_0x3d28bc[_0xfbd2('0x5f')]['id']){delete _0x3d28bc[_0xfbd2('0x5f')]['id'];}return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x3d28bc[_0xfbd2('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a42bc,null))[_0xfbd2('0x1b')](function(_0x11d924){if(_0x11d924){_0x3d28bc['body'][_0xfbd2('0x63')]=_0x11d924['id'];return db[_0xfbd2('0x6b')]['create'](_0x3d28bc['body']);}})[_0xfbd2('0x1b')](respondWithResult(_0x4a42bc,null))['catch'](handleError(_0x4a42bc,null));};exports['getAnswers']=function(_0xb3f437,_0x583a0e,_0x4767ed){var _0x3723a1={'raw':![],'where':{}};var _0x55068b={};var _0xbafb4b={'count':0x0,'rows':[]};return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0xb3f437[_0xfbd2('0x60')]['id']}})['then'](handleEntityNotFound(_0x583a0e,null))['then'](function(_0x5c54a2){if(_0x5c54a2){_0x55068b['model']=_[_0xfbd2('0x52')](db[_0xfbd2('0x6b')][_0xfbd2('0x3c')]);_0x55068b['query']=_[_0xfbd2('0x52')](_0xb3f437[_0xfbd2('0x40')]);_0x55068b[_0xfbd2('0x41')]=_['intersection'](_0x55068b[_0xfbd2('0x43')],_0x55068b['query']);_0x3723a1[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x55068b[_0xfbd2('0x43')],qs[_0xfbd2('0x45')](_0xb3f437[_0xfbd2('0x40')][_0xfbd2('0x45')]));_0x3723a1['attributes']=_0x3723a1[_0xfbd2('0x44')]['length']?_0x3723a1[_0xfbd2('0x44')]:_0x55068b[_0xfbd2('0x43')];if(!_0xb3f437[_0xfbd2('0x40')][_0xfbd2('0x67')](_0xfbd2('0x47'))){_0x3723a1['limit']=qs[_0xfbd2('0x29')](_0xb3f437[_0xfbd2('0x40')][_0xfbd2('0x29')]);_0x3723a1[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0xb3f437['query']['offset']);}_0x3723a1[_0xfbd2('0x48')]=qs['sort'](_0xb3f437['query'][_0xfbd2('0x49')]);_0x3723a1[_0xfbd2('0x4b')]=qs[_0xfbd2('0x41')](_['pick'](_0xb3f437[_0xfbd2('0x40')],_0x55068b['filters']));_0x3723a1[_0xfbd2('0x4b')][_0xfbd2('0x63')]=_0x5c54a2['id'];if(_0xb3f437[_0xfbd2('0x40')]['filter']){_0x3723a1['where']=_['merge'](_0x3723a1[_0xfbd2('0x4b')],{'$or':_[_0xfbd2('0x3a')](_0x3723a1['attributes'],function(_0x2bbc26){var _0x1bcb7e={};_0x1bcb7e[_0x2bbc26]={'$like':'%'+_0xb3f437[_0xfbd2('0x40')][_0xfbd2('0x4d')]+'%'};return _0x1bcb7e;})});}_0x3723a1=_['merge']({},_0x3723a1,_0xb3f437[_0xfbd2('0x4f')]);return db[_0xfbd2('0x6b')][_0xfbd2('0x50')]({'where':_0x3723a1[_0xfbd2('0x4b')]})[_0xfbd2('0x1b')](function(_0xb8099e){_0xbafb4b['count']=_0xb8099e;if(_0xb3f437[_0xfbd2('0x40')][_0xfbd2('0x54')]){_0x3723a1['include']=[{'all':!![]}];}return db[_0xfbd2('0x6b')][_0xfbd2('0x68')](_0x3723a1);})[_0xfbd2('0x1b')](function(_0x1b8822){_0xbafb4b[_0xfbd2('0x51')]=_0x1b8822;return _0xbafb4b;});}})[_0xfbd2('0x1b')](respondWithFilteredResult(_0x583a0e,_0x3723a1))[_0xfbd2('0x24')](handleError(_0x583a0e,null));};exports[_0xfbd2('0x6c')]=function(_0x4dd599,_0x2317bd,_0x11be17){return db['ChatWebsite']['find']({'where':{'id':_0x4dd599[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x2317bd,null))['then'](function(_0x5d708b){if(_0x5d708b){return _0x5d708b[_0xfbd2('0x6c')](_0x4dd599[_0xfbd2('0x40')][_0xfbd2('0x6a')]);}})['then'](respondWithStatusCode(_0x2317bd,null))[_0xfbd2('0x24')](handleError(_0x2317bd,null));};exports['addLogo']=function(_0x1ee536,_0x328882,_0x1e73b2){_0x1ee536[_0xfbd2('0x5f')][_0xfbd2('0x6d')]=_0x1ee536[_0xfbd2('0x6e')][_0xfbd2('0x6f')];return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x1ee536[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x328882,null))[_0xfbd2('0x1b')](saveUpdates(_0x1ee536[_0xfbd2('0x5f')],null))['then'](respondWithResult(_0x328882,null))[_0xfbd2('0x24')](handleError(_0x328882,null));};exports[_0xfbd2('0x70')]=function(_0x43a6c9,_0x1e3811,_0x2ae2a5){_0x43a6c9[_0xfbd2('0x5f')]['agentAvatar']=_0x43a6c9[_0xfbd2('0x6e')][_0xfbd2('0x6f')];return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x43a6c9[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x1e3811,null))['then'](saveUpdates(_0x43a6c9[_0xfbd2('0x5f')],null))['then'](respondWithResult(_0x1e3811,null))['catch'](handleError(_0x1e3811,null));};exports['addCustomerAvatar']=function(_0x580ab5,_0x3318d3,_0x33d633){_0x580ab5[_0xfbd2('0x5f')][_0xfbd2('0x71')]=_0x580ab5[_0xfbd2('0x6e')][_0xfbd2('0x6f')];return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x580ab5['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x3318d3,null))[_0xfbd2('0x1b')](saveUpdates(_0x580ab5[_0xfbd2('0x5f')],null))[_0xfbd2('0x1b')](respondWithResult(_0x3318d3,null))[_0xfbd2('0x24')](handleError(_0x3318d3,null));};exports[_0xfbd2('0x72')]=function(_0x2bdc7b,_0x31fe19,_0x59ec62){_0x2bdc7b[_0xfbd2('0x5f')][_0xfbd2('0x73')]=_0x2bdc7b[_0xfbd2('0x6e')][_0xfbd2('0x6f')];return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x2bdc7b['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x31fe19,null))[_0xfbd2('0x1b')](saveUpdates(_0x2bdc7b[_0xfbd2('0x5f')],null))['then'](respondWithResult(_0x31fe19,null))[_0xfbd2('0x24')](handleError(_0x31fe19,null));};exports[_0xfbd2('0x74')]=function(_0x184246,_0x59a794,_0x24d548){var _0x24086a=path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],'server/files/images/logos/default_logo.svg');var _0x32db2c={'where':{'id':_0x184246['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x17bd75=![];return require(_0xfbd2('0x77'))[_0xfbd2('0x78')]()[_0xfbd2('0x1b')](function(_0x1ad125){if(_0x1ad125){_0x17bd75=_0x1ad125[_0xfbd2('0x79')];}})['then'](function(){return db['ChatWebsite']['find'](_0x32db2c);})[_0xfbd2('0x1b')](handleEntityNotFound(_0x59a794,null))[_0xfbd2('0x1b')](function(_0x47ffce){if(_0x47ffce){if(!_['isNil'](_0x47ffce[_0xfbd2('0x6d')])){if(fs['existsSync'](path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],_0xfbd2('0x7a'),_0x47ffce[_0xfbd2('0x6d')]))&&_0x17bd75){_0x24086a=path['join'](config['root'],_0xfbd2('0x7a'),_0x47ffce[_0xfbd2('0x6d')]);}}return _0x59a794['download'](_0x24086a);}})[_0xfbd2('0x24')](handleError(_0x59a794,null));};exports[_0xfbd2('0x7b')]=function(_0x5b2bc3,_0x20792b,_0x567274){var _0xe2efe9=path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],'server/files/images/avatars/default_avatar.png');var _0x2a1c07={'where':{'id':_0x5b2bc3[_0xfbd2('0x60')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xfbd2('0x3b')][_0xfbd2('0x56')](_0x2a1c07)[_0xfbd2('0x1b')](handleEntityNotFound(_0x20792b,null))[_0xfbd2('0x1b')](function(_0x251a2a){if(_0x251a2a){if(!_[_0xfbd2('0x7c')](_0x251a2a['agentAvatar'])){if(fs[_0xfbd2('0x7d')](path['join'](config['root'],_0xfbd2('0x7e'),_0x251a2a['agentAvatar']))){_0xe2efe9=path[_0xfbd2('0x75')](config['root'],'server/files/images/avatars/',_0x251a2a['agentAvatar']);}}return _0x20792b[_0xfbd2('0x7f')](_0xe2efe9);}})[_0xfbd2('0x24')](handleError(_0x20792b,null));};exports['getCustomerAvatar']=function(_0x27a141,_0x1ca591,_0x232d9f){var _0x4e3794=path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],_0xfbd2('0x80'));var _0x599a50={'where':{'id':_0x27a141['params']['id']},'attributes':['id',_0xfbd2('0x71'),'showCustomerAvatar'],'raw':!![]};return db[_0xfbd2('0x3b')][_0xfbd2('0x56')](_0x599a50)[_0xfbd2('0x1b')](handleEntityNotFound(_0x1ca591,null))[_0xfbd2('0x1b')](function(_0xca635b){if(_0xca635b){if(!_[_0xfbd2('0x7c')](_0xca635b[_0xfbd2('0x71')])){if(fs[_0xfbd2('0x7d')](path[_0xfbd2('0x75')](config['root'],_0xfbd2('0x7e'),_0xca635b['customerAvatar']))&&_0xca635b['showCustomerAvatar']){_0x4e3794=path[_0xfbd2('0x75')](config['root'],'server/files/images/avatars/',_0xca635b[_0xfbd2('0x71')]);}}return _0x1ca591[_0xfbd2('0x7f')](_0x4e3794);}})[_0xfbd2('0x24')](handleError(_0x1ca591,null));};exports[_0xfbd2('0x81')]=function(_0x23230f,_0x636cd2,_0x3a5d03){var _0x3ef4c1=path[_0xfbd2('0x75')](config['root'],_0xfbd2('0x82'));var _0xcdfd97={'where':{'id':_0x23230f[_0xfbd2('0x60')]['id']},'attributes':['id',_0xfbd2('0x73')],'raw':!![]};return db[_0xfbd2('0x3b')][_0xfbd2('0x56')](_0xcdfd97)[_0xfbd2('0x1b')](handleEntityNotFound(_0x636cd2,null))[_0xfbd2('0x1b')](function(_0x1a707a){if(_0x1a707a){if(!_[_0xfbd2('0x7c')](_0x1a707a['systemAvatar'])){if(fs[_0xfbd2('0x7d')](path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],_0xfbd2('0x7e'),_0x1a707a[_0xfbd2('0x73')]))){_0x3ef4c1=path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],_0xfbd2('0x7e'),_0x1a707a[_0xfbd2('0x73')]);}}return _0x636cd2[_0xfbd2('0x7f')](_0x3ef4c1);}})['catch'](handleError(_0x636cd2,null));};exports['notify']=function(_0x597f23,_0x25fd02,_0x3d2743){var _0x171676=require('user-agent-parser');var _0x3b37f0=new _0x171676();var _0x580127=_0x3b37f0[_0xfbd2('0x83')](_0x597f23[_0xfbd2('0x84')][_0xfbd2('0x85')])[_0xfbd2('0x86')]();var _0x37d857={'body':_0x597f23[_0xfbd2('0x5f')],'channel':_0xfbd2('0x87')};var _0x329a77=[];var _0x36562e=[];var _0x302130={};var _0x48a2ef=![];return db['CmContact'][_0xfbd2('0x61')]()[_0xfbd2('0x1b')](function(_0x75cf4b){if(!_0x75cf4b){throw new db['Sequelize'][(_0xfbd2('0x88'))](_0xfbd2('0x89'));}_0x329a77=_['difference'](_[_0xfbd2('0x52')](_0x75cf4b),[_0xfbd2('0x8a'),'updatedAt']);_0x36562e=_[_0xfbd2('0x8b')](_[_0xfbd2('0x52')](_0x75cf4b),['createdAt',_0xfbd2('0x8c'),_0xfbd2('0x8d'),_0xfbd2('0x8e')]);if(_0x597f23['body']['id']){delete _0x597f23['body']['id'];}if(_[_0xfbd2('0x7c')](_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0x8f')])){throw new db['Sequelize']['ValidationError'](_0xfbd2('0x90'));}if(_['isNil'](_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0x5f')])||_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0x5f')]===''){throw new db[(_0xfbd2('0x91'))]['ValidationError'](_0xfbd2('0x92'));}if(_[_0xfbd2('0x7c')](_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0x93')])){throw new db['Sequelize']['ValidationError'](_0xfbd2('0x94')+_0x36562e);}if(!_[_0xfbd2('0x95')](_0x36562e,_0x597f23[_0xfbd2('0x5f')]['mapKey'])){throw new db['Sequelize'][(_0xfbd2('0x88'))](_0xfbd2('0x96')+_0x36562e);}_0x302130[_0x597f23['body'][_0xfbd2('0x93')]]=_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0x8f')];})[_0xfbd2('0x1b')](function(){return db['ChatWebsite'][_0xfbd2('0x56')]({'where':{'id':_0x597f23[_0xfbd2('0x60')]['id']},'include':[{'model':db[_0xfbd2('0x97')],'as':_0xfbd2('0x98'),'include':[{'model':db[_0xfbd2('0x99')],'as':_0xfbd2('0x9a'),'where':_0x302130,'limit':0x1,'order':[[_0xfbd2('0x8c'),_0xfbd2('0x9b')]]}]},{'model':db[_0xfbd2('0x9c')],'as':_0xfbd2('0x9d')}]});})[_0xfbd2('0x1b')](handleEntityNotFound(_0x25fd02,null))['then'](function(_0x4ea651){if(_0x4ea651&&_0x4ea651[_0xfbd2('0x98')]){_0x37d857[_0xfbd2('0x9e')]=_0x4ea651;_0x37d857[_0xfbd2('0x9f')]=_0x4ea651[_0xfbd2('0x9d')];_0x37d857['list']=_0x4ea651[_0xfbd2('0x98')];_0x37d857[_0xfbd2('0x9f')]=_[_0xfbd2('0xa0')](_0x37d857['applications'],['priority'],[_0xfbd2('0xa1')]);if(_0x37d857[_0xfbd2('0x9e')][_0xfbd2('0x9d')]){delete _0x37d857[_0xfbd2('0x9e')]['Applications'];}if(_0x37d857['account'][_0xfbd2('0x98')]&&_0x37d857[_0xfbd2('0x9e')][_0xfbd2('0x98')][_0xfbd2('0x9a')]['length']){return _0x37d857[_0xfbd2('0x9e')]['List'][_0xfbd2('0x9a')][0x0];}var _0x55a198=_[_0xfbd2('0x14')](_0x597f23['body'],{'firstName':_0x597f23['body'][_0xfbd2('0x8f')],'ListId':_0x4ea651[_0xfbd2('0x8e')]});_0x55a198[_0x597f23[_0xfbd2('0x5f')]['mapKey']]=_0x597f23[_0xfbd2('0x5f')]['from'];return db[_0xfbd2('0x99')]['create'](_0x55a198,{'fields':_0x329a77,'raw':!![]});}})['then'](handleEntityNotFound(_0x25fd02,null))[_0xfbd2('0x1b')](function(_0x445dc1){_0x37d857[_0xfbd2('0xa2')]=_0x445dc1;var _0x294772=_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xa3')];if(_0x597f23[_0xfbd2('0x84')]['cf-connecting-ip']){_0x294772=_0x597f23[_0xfbd2('0x84')][_0xfbd2('0xa4')];}else if(_0x597f23[_0xfbd2('0x84')][_0xfbd2('0xa5')]){_0x294772=_['first'](_0x597f23['headers'][_0xfbd2('0xa5')][_0xfbd2('0xa6')](','));}if(_0x445dc1){var _0x29b800={'ContactId':_0x445dc1['id'],'ChatWebsiteId':_0x597f23['params']['id'],'from':(_0x445dc1[_0xfbd2('0xa7')]||'')+'\x20'+(_0x445dc1[_0xfbd2('0xa8')]||''),'customerIp':_0x294772,'customerPort':_0x597f23[_0xfbd2('0x84')][_0xfbd2('0xa9')]?_0x597f23[_0xfbd2('0x84')]['x-real-port']:null,'referer':_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xaa')],'browserName':_0x580127[_0xfbd2('0xab')][_0xfbd2('0x35')]&&_0x580127[_0xfbd2('0xab')]['version']?util[_0xfbd2('0xac')]('%s\x20%s',_0x580127[_0xfbd2('0xab')][_0xfbd2('0x35')],_0x580127['browser'][_0xfbd2('0xad')]):_0xfbd2('0xae'),'browserVersion':_0x580127[_0xfbd2('0xab')][_0xfbd2('0xad')]||'unknown','osName':util[_0xfbd2('0xac')](_0xfbd2('0xaf'),_0x580127['os'][_0xfbd2('0x35')],_0x580127['os'][_0xfbd2('0xad')]),'osVersion':_0x580127['os'][_0xfbd2('0xad')],'deviceModel':_0x580127[_0xfbd2('0xb0')][_0xfbd2('0x43')]&&_0x580127['device'][_0xfbd2('0xb1')]?util[_0xfbd2('0xac')](_0xfbd2('0xb2'),_0x580127[_0xfbd2('0xb0')][_0xfbd2('0x43')],_0x580127[_0xfbd2('0xb0')]['vendor'],_0x580127[_0xfbd2('0xb0')][_0xfbd2('0x3e')]):null,'deviceVendor':_0x580127['device']['vendor'],'deviceType':_0x580127['device']['type'],'formData':JSON[_0xfbd2('0xb3')](_0x597f23['body'])};var _0x40ccd0={'ChatWebsiteId':_0x597f23[_0xfbd2('0x60')]['id'],'closed':![]};if(_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xb4')]){_0x40ccd0[_0xfbd2('0xb4')]=_0x597f23[_0xfbd2('0x5f')]['threadId'];return db[_0xfbd2('0xb5')][_0xfbd2('0x56')]({'where':_0x40ccd0})[_0xfbd2('0x1b')](function(_0x25ce4a){if(_0x25ce4a){return[_0x25ce4a,![]];}_0x29b800[_0xfbd2('0xb4')]=_0x597f23['body'][_0xfbd2('0xb4')];_0x29b800['externalUrl']=_0x597f23['body'][_0xfbd2('0xb6')];return db[_0xfbd2('0xb5')][_0xfbd2('0x57')](_0x29b800)[_0xfbd2('0x1b')](function(_0x3caf59){return[_0x3caf59,!![]];});});}_0x40ccd0[_0xfbd2('0xb7')]=_0x445dc1['id'];if(_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xb8')]&&_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xb8')]['id']){_0x40ccd0['id']=_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xb8')]['id'];return db['ChatInteraction']['find']({'where':_0x40ccd0})[_0xfbd2('0x1b')](function(_0x3a394d){if(_0x3a394d){return[_0x3a394d,![]];}return db[_0xfbd2('0xb5')]['create'](_0x29b800)[_0xfbd2('0x1b')](function(_0x18cc38){return[_0x18cc38,!![]];});});}return db['ChatInteraction']['create'](_0x29b800)['then'](function(_0x18b407){return[_0x18b407,!![]];});}})['spread'](function(_0x30dcc3,_0x51d5e5){if(_0x30dcc3){_0x48a2ef=_0x51d5e5;if(!_0x51d5e5){var _0x1810f2={'from':(_0x37d857['contact'][_0xfbd2('0xa7')]||'')+'\x20'+(_0x37d857[_0xfbd2('0xa2')][_0xfbd2('0xa8')]||'')};if(_0x597f23[_0xfbd2('0x5f')][_0xfbd2('0xb4')]&&_0x597f23[_0xfbd2('0x5f')]['messageId']&&_0x597f23['body'][_0xfbd2('0xb4')]!=_0x597f23['body']['messageId']){_0x1810f2[_0xfbd2('0xb4')]=_0x597f23[_0xfbd2('0x5f')]['messageId'];}return _0x30dcc3[_0xfbd2('0x2e')](_0x1810f2);}else{return _0x30dcc3;}}})['then'](function(_0x504bff){_0x37d857[_0xfbd2('0xb8')]=_0x504bff[_0xfbd2('0x30')]({'plain':!![]});_0x37d857[_0xfbd2('0xb8')][_0xfbd2('0xb9')]=_0x48a2ef;if(_0x37d857['interaction'][_0xfbd2('0xb9')]){if(_0x37d857['account'][_0xfbd2('0xba')]){_0x37d857[_0xfbd2('0x9f')][_0xfbd2('0xbb')]({'id':0x0,'priority':_0x37d857[_0xfbd2('0x9f')][_0xfbd2('0x46')]+0x1,'app':_0xfbd2('0xbc'),'appdata':_0xfbd2('0xbd'),'interval':_0xfbd2('0xbe')});}}return db[_0xfbd2('0xbf')][_0xfbd2('0x57')]({'body':_0x597f23[_0xfbd2('0x5f')]['body'],'ChatWebsiteId':_0x597f23[_0xfbd2('0x60')]['id'],'ChatInteractionId':_0x504bff['id'],'direction':'in','ContactId':_0x37d857['contact']['id'],'AttachmentId':_0x597f23[_0xfbd2('0x5f')]['AttachmentId']});})[_0xfbd2('0x1b')](function(_0xd25581){_0x37d857['message']=_0xd25581;if(_0x37d857[_0xfbd2('0xb8')]['UserId']){return db[_0xfbd2('0xc0')][_0xfbd2('0x56')]({'attributes':['id',_0xfbd2('0x35')],'where':{'id':_0x37d857[_0xfbd2('0xb8')][_0xfbd2('0xc1')]}})[_0xfbd2('0x1b')](function(_0x454754){if(_0x454754){_0x37d857[_0xfbd2('0x9f')][_0xfbd2('0xc2')]({'id':0x0,'priority':0x0,'app':_0xfbd2('0xc3'),'appdata':_0x454754[_0xfbd2('0x35')]+','+(_0x37d857['account'][_0xfbd2('0xc4')]||0xa),'interval':'*,*,*,*'});_0x37d857[_0xfbd2('0xc5')]=!![];}return respondWithRpcPromise(_0xfbd2('0xc6'),_0xfbd2('0xc7'),_0x37d857);});}return respondWithRpcPromise(_0xfbd2('0xc6'),_0xfbd2('0xc7'),_0x37d857);})[_0xfbd2('0x1b')](function(_0x2fec58){respondWithRpcPromise('EventManager',_0xfbd2('0xc8'),{'event':_0xfbd2('0xc9'),'message':_0x2fec58},client9002);return _0x2fec58;})['then'](respondWithResult(_0x25fd02,null))['catch'](handleError(_0x25fd02,null));};exports[_0xfbd2('0xca')]=function(_0x33e54e,_0xbf9c70,_0x226b9b){var _0x1c600b,_0x200a75,_0x5d1c34;var _0x52526a=[];var _0x45b2e5=[];var _0x4df63f={};return db[_0xfbd2('0x99')][_0xfbd2('0x61')]()[_0xfbd2('0x1b')](function(_0xd2c2a7){if(!_0xd2c2a7){throw new db[(_0xfbd2('0x91'))][(_0xfbd2('0x88'))]('no\x20available\x20attributes');}_0x45b2e5=_[_0xfbd2('0x8b')](_[_0xfbd2('0x52')](_0xd2c2a7),[_0xfbd2('0x8a'),'updatedAt']);_0x52526a=_[_0xfbd2('0x8b')](_[_0xfbd2('0x52')](_0xd2c2a7),[_0xfbd2('0x8a'),_0xfbd2('0x8c'),_0xfbd2('0x8d'),_0xfbd2('0x8e')]);if(_0x33e54e[_0xfbd2('0x5f')]['id']){delete _0x33e54e[_0xfbd2('0x5f')]['id'];}if(_[_0xfbd2('0x7c')](_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x8f')])){throw _0xbf9c70[_0xfbd2('0x26')](0x1f4)[_0xfbd2('0x36')](new db[(_0xfbd2('0x91'))][(_0xfbd2('0x88'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x5f')])||_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x5f')]===''){throw _0xbf9c70['status'](0x1f4)[_0xfbd2('0x36')](new db[(_0xfbd2('0x91'))][(_0xfbd2('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xfbd2('0x7c')](_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0xcb')])){throw _0xbf9c70[_0xfbd2('0x26')](0x1f4)[_0xfbd2('0x36')](new db[(_0xfbd2('0x91'))][(_0xfbd2('0x88'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52526a));}if(!_[_0xfbd2('0x95')](_0x52526a,_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0xcb')])){throw _0xbf9c70[_0xfbd2('0x26')](0x1f4)[_0xfbd2('0x36')](new db[(_0xfbd2('0x91'))][(_0xfbd2('0x88'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x52526a));}_0x4df63f[_0x33e54e[_0xfbd2('0x5f')]['mapKeyOffline']]=_0x33e54e['body'][_0xfbd2('0x8f')];})[_0xfbd2('0x1b')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x33e54e['params']['id']},'include':[{'model':db[_0xfbd2('0x97')],'as':_0xfbd2('0x98')}]});})[_0xfbd2('0x1b')](handleEntityNotFound(_0xbf9c70,null))[_0xfbd2('0x1b')](function(_0x594862){if(_0x594862&&_0x594862[_0xfbd2('0x98')]){_0x200a75=_0x594862;var _0x4f5d6b=_[_0xfbd2('0x14')](_0x33e54e[_0xfbd2('0x5f')],{'firstName':_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x8f')],'phone':_0x33e54e['body']['from'],'ListId':_0x594862[_0xfbd2('0x8e')]});_0x4f5d6b[_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0xcb')]]=_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x8f')];return db['CmContact'][_0xfbd2('0xcc')]({'where':_0x4df63f,'defaults':_0x4f5d6b});}})[_0xfbd2('0xcd')](function(_0x5c2110){if(_0x5c2110){_0x5d1c34=_0x5c2110;var _0xad219=fs[_0xfbd2('0xce')](path[_0xfbd2('0x75')](config[_0xfbd2('0x76')],_0xfbd2('0xcf')),_0xfbd2('0xd0'));var _0x5bc916=ejs[_0xfbd2('0xd1')](_0xad219,{'body':_['toPairs'](_0x33e54e[_0xfbd2('0x5f')][_0xfbd2('0x5f')]),'bodyTitle':_0x200a75[_0xfbd2('0xd2')]});return db[_0xfbd2('0xd3')]['create']({'body':_0x5bc916,'ContactId':_0x5c2110['id'],'ChatWebsiteId':_0x200a75['id']});}})[_0xfbd2('0x1b')](function(_0x27a061){if(_0x27a061){_0x1c600b=_0x27a061;return db[_0xfbd2('0xd4')][_0xfbd2('0x66')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xfbd2('0xd5'),'raw':!![]}]});}})[_0xfbd2('0x1b')](function(_0x80603){if(_0x80603&&_0x80603[_0xfbd2('0xd5')]&&_0x200a75[_0xfbd2('0xd6')]){var _0x54fbfc={'tls':{'rejectUnauthorized':![]}};if(_0x80603['Smtp'][_0xfbd2('0xd7')]){_0x54fbfc[_0xfbd2('0xd7')]=_0x80603[_0xfbd2('0xd5')]['service'];}else{_0x54fbfc[_0xfbd2('0xd8')]=_0x80603[_0xfbd2('0xd5')][_0xfbd2('0xd8')];_0x54fbfc[_0xfbd2('0xd9')]=_0x80603[_0xfbd2('0xd5')][_0xfbd2('0xd9')];_0x54fbfc[_0xfbd2('0xda')]=_0x80603[_0xfbd2('0xd5')][_0xfbd2('0xda')];}if(_0x80603[_0xfbd2('0xd5')]['authentication']){_0x54fbfc[_0xfbd2('0xdb')]={'user':_0x80603[_0xfbd2('0xd5')][_0xfbd2('0x58')],'pass':_0x80603[_0xfbd2('0xd5')][_0xfbd2('0xdc')]};}return respondWithRpcPromise(_0xfbd2('0xdd'),'sendMail',{'account':_0x54fbfc,'message':{'from':util['format'](_0xfbd2('0xde'),_0x80603['name'],_0x80603[_0xfbd2('0xdf')]||_0x80603[_0xfbd2('0xd5')][_0xfbd2('0x58')]),'to':_0x200a75[_0xfbd2('0xd6')],'subject':_0x200a75['offlineMessageSubject'],'text':_0x1c600b['body']}},client9003)[_0xfbd2('0x1b')](function(){return _0x1c600b;})['catch'](function(_0x424543){console[_0xfbd2('0x20')](_0x424543);});}})['then'](function(){if(_0x1c600b){return _0x1c600b;}})[_0xfbd2('0x1b')](respondWithResult(_0xbf9c70,null))[_0xfbd2('0x24')](handleError(_0xbf9c70,null));};exports[_0xfbd2('0xe0')]=function(_0x377b34,_0x1f5cd9,_0x332eda){return db[_0xfbd2('0xb5')]['find']({'where':{'id':_0x377b34[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x1f5cd9,null))[_0xfbd2('0x1b')](function(_0x5c860d){if(_0x5c860d){return _0x5c860d[_0xfbd2('0xe0')](_0x377b34[_0xfbd2('0x5f')][_0xfbd2('0x6a')],_[_0xfbd2('0xe1')](_0x377b34[_0xfbd2('0x5f')],[_0xfbd2('0x6a'),'id'])||{});}})[_0xfbd2('0x1b')](respondWithResult(_0x1f5cd9,null))[_0xfbd2('0x24')](handleError(_0x1f5cd9,null));};exports[_0xfbd2('0xe2')]=function(_0x13de5b,_0x3e2954,_0x45f18e){var _0x93de25={'raw':![],'where':{}};var _0x457c50={};var _0xb28e1e={'count':0x0,'rows':[]};return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0x13de5b[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x3e2954,null))['then'](function(_0x57b458){if(_0x57b458){_0x457c50[_0xfbd2('0x43')]=_[_0xfbd2('0x52')](db[_0xfbd2('0xb5')][_0xfbd2('0x3c')]);_0x457c50[_0xfbd2('0x40')]=_[_0xfbd2('0x52')](_0x13de5b['query']);_0x457c50['filters']=_[_0xfbd2('0x42')](_0x457c50[_0xfbd2('0x43')],_0x457c50[_0xfbd2('0x40')]);_0x93de25[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x457c50[_0xfbd2('0x43')],qs['fields'](_0x13de5b[_0xfbd2('0x40')]['fields']));_0x93de25[_0xfbd2('0x44')]=_0x93de25[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x93de25[_0xfbd2('0x44')]:_0x457c50[_0xfbd2('0x43')];if(!_0x13de5b[_0xfbd2('0x40')]['hasOwnProperty'](_0xfbd2('0x47'))){_0x93de25[_0xfbd2('0x29')]=qs[_0xfbd2('0x29')](_0x13de5b[_0xfbd2('0x40')]['limit']);_0x93de25[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0x13de5b['query'][_0xfbd2('0x28')]);}_0x93de25['order']=qs[_0xfbd2('0x49')](_0x13de5b[_0xfbd2('0x40')][_0xfbd2('0x49')]);_0x93de25[_0xfbd2('0x4b')]=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0x13de5b[_0xfbd2('0x40')],_0x457c50[_0xfbd2('0x41')]));_0x93de25['where'][_0xfbd2('0x63')]=_0x57b458['id'];if(_0x13de5b[_0xfbd2('0x40')][_0xfbd2('0x4d')]){_0x93de25[_0xfbd2('0x4b')]=_[_0xfbd2('0x4e')](_0x93de25['where'],{'$or':_[_0xfbd2('0x3a')](_0x93de25[_0xfbd2('0x44')],function(_0x25cb37){var _0x4f9692={};_0x4f9692[_0x25cb37]={'$like':'%'+_0x13de5b[_0xfbd2('0x40')][_0xfbd2('0x4d')]+'%'};return _0x4f9692;})});}_0x93de25=_[_0xfbd2('0x4e')]({},_0x93de25,_0x13de5b['options']);return db[_0xfbd2('0xb5')][_0xfbd2('0x50')]({'where':_0x93de25['where']})[_0xfbd2('0x1b')](function(_0x13727b){_0xb28e1e['count']=_0x13727b;if(_0x13de5b['query'][_0xfbd2('0x54')]){_0x93de25[_0xfbd2('0x55')]=[{'model':db['CmContact'],'as':_0xfbd2('0xe3'),'required':![]},{'model':db[_0xfbd2('0xc0')],'as':_0xfbd2('0xe4'),'attributes':[_0xfbd2('0x35'),_0xfbd2('0xe5'),_0xfbd2('0xe6')],'required':![]},{'model':db[_0xfbd2('0xe7')],'as':'Tags','attributes':['id',_0xfbd2('0x35'),'color'],'where':_0x13de5b[_0xfbd2('0x40')][_0xfbd2('0xe8')]?{'id':_0x13de5b[_0xfbd2('0x40')]['tag']}:undefined,'required':_0x13de5b[_0xfbd2('0x40')][_0xfbd2('0xe8')]?!![]:![]}];}return db['ChatInteraction'][_0xfbd2('0x68')](_0x93de25);})[_0xfbd2('0x1b')](function(_0x412444){_0xb28e1e[_0xfbd2('0x51')]=_0x412444;return _0xb28e1e;});}})[_0xfbd2('0x1b')](respondWithFilteredResult(_0x3e2954,_0x93de25))[_0xfbd2('0x24')](handleError(_0x3e2954,null));};function iftimePromise(_0x52ac2d,_0x546916){return respondWithRpcPromise(_0xfbd2('0xe9'),_0xfbd2('0xea'),{'command':_0x546916[_0xfbd2('0xeb')]?util[_0xfbd2('0xac')](_0xfbd2('0xec'),_0x52ac2d['interval'],_0x546916[_0xfbd2('0xeb')]):util[_0xfbd2('0xac')](_0xfbd2('0xed'),_0x52ac2d['interval'])},client9002)[_0xfbd2('0x1b')](function(_0x4ae523){var _0x265e8d=_0x4ae523&&_0x4ae523[_0xfbd2('0xee')](_0xfbd2('0xef'))>=0x0?!![]:![];logger[_0xfbd2('0xf0')](_0xfbd2('0xf1'),_0x546916['id'],_0x52ac2d['id'],_0x52ac2d[_0xfbd2('0xf2')],_0x265e8d?_0xfbd2('0xf3'):_0xfbd2('0xf4'),_0x546916['timezone']?_0x546916['timezone']:_0xfbd2('0xf5'));return _0x265e8d;})['catch'](function(_0x46a22d){logger['error'](_0xfbd2('0xf1'),_0x546916['id'],_0x52ac2d['id'],_0x52ac2d[_0xfbd2('0xf2')],util[_0xfbd2('0xf6')](_0x46a22d,{'showHidden':![],'depth':null}),_0x546916['timezone']?_0x546916[_0xfbd2('0xeb')]:_0xfbd2('0xf5'));return![];});}exports[_0xfbd2('0xea')]=function(_0x305fd0,_0x49cd44,_0x3534b1){var _0x2ab7db=0x0;var _0x54ff8f=0x0;var _0x254689=![];var _0x10c7c3;var _0x59c623;return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x305fd0['params']['id']},'include':[{'model':db[_0xfbd2('0xf7')],'as':'Interval','include':[{'model':db[_0xfbd2('0xf7')],'as':'Intervals','attributes':['id',_0xfbd2('0xf2')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x49cd44,null))['then'](function(_0x23c662){if(_0x23c662){_0x10c7c3=_0x23c662;return _0x23c662['getProactiveActions']({'raw':!![]});}})[_0xfbd2('0x1b')](function(_0x4f8848){if(_0x10c7c3){if(_0x4f8848){_0x59c623=_0x4f8848;}}return require(_0xfbd2('0x77'))['getLicense']();})['then'](function(_0x3ebc83){if(_0x3ebc83){_0x54ff8f=_0x3ebc83[_0xfbd2('0xf8')];_0x254689=_0x3ebc83[_0xfbd2('0x79')];}})[_0xfbd2('0x1b')](function(){return db[_0xfbd2('0xb5')]['count']({'where':{'closed':![]}});})[_0xfbd2('0x1b')](function(_0x9f18b0){_0x2ab7db=_0x9f18b0;if(_0x54ff8f&&_0x9f18b0>_0x54ff8f){return db[_0xfbd2('0xf9')]['findOne']({'where':{'id':0x1}})[_0xfbd2('0x1b')](function(_0x5147fb){if(_0x5147fb){_0x5147fb[_0xfbd2('0xfa')](_0xfbd2('0xfb'));}});}})[_0xfbd2('0x1b')](function(){if(_0x10c7c3[_0xfbd2('0xf7')]&&_0x10c7c3['Interval']['Intervals']){var _0x488921=[];for(var _0x2ddac5=0x0;_0x2ddac5<_0x10c7c3[_0xfbd2('0xf7')][_0xfbd2('0xfc')][_0xfbd2('0x46')];_0x2ddac5++){var _0x222c3d=_0x10c7c3['Interval'][_0xfbd2('0xfc')][_0x2ddac5][_0xfbd2('0x30')]({'plain':!![]});_0x488921[_0xfbd2('0xbb')](iftimePromise(_0x222c3d,_0x10c7c3));}return BPromise[_0xfbd2('0xfd')](_0x488921)[_0xfbd2('0x1b')](function(_0x782b29){return _[_0xfbd2('0xfe')](_0x782b29);});}else{return!![];}})[_0xfbd2('0x1b')](function(_0x9d5bd1){var _0x4bbc26=fs[_0xfbd2('0xce')](path[_0xfbd2('0x75')](config['root'],_0xfbd2('0xff')),'utf8');var _0x3dc87c={'remote':_0x10c7c3[_0xfbd2('0x100')],'query':querystring[_0xfbd2('0xb3')](_['merge'](_0x10c7c3[_0xfbd2('0x30')]({'plain':!![]}),{'customerIp':_0x305fd0[_0xfbd2('0x84')][_0xfbd2('0xa5')]||_0x305fd0[_0xfbd2('0x84')][_0xfbd2('0x101')]||_0x305fd0['connection']['remoteAddress']||_0x305fd0['ip'],'referer':_0x305fd0[_0xfbd2('0x84')]['referer'],'openedInteractions':_0x2ab7db,'maxInteractions':_0x54ff8f,'virtual':_0x254689['virtual'],'online':_0x9d5bd1,'custom':_0x254689}))[_0xfbd2('0x102')](/'/g,'\x5c\x27')};_0x49cd44['send'](ejs['render'](Mustache['render'](_0x4bbc26,_0x3dc87c),{'proactiveActions':_0x59c623,'alignment':_0x10c7c3['alignment'],'verticalAlignment':_0x10c7c3['verticalAlignment'],'div_color':_0x10c7c3['color'],'text_color':_0x10c7c3[_0xfbd2('0x103')]}));})[_0xfbd2('0x24')](handleError(_0x49cd44,null));};exports[_0xfbd2('0x104')]=function(_0x191faa,_0x3546a8,_0x14dd15){return db['ChatWebsite'][_0xfbd2('0x66')]({'where':{'id':_0x191faa[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x3546a8,null))['then'](function(_0x580896){if(_0x580896){return db[_0xfbd2('0x105')][_0xfbd2('0x106')](function(_0x402492){return db['ChatApplication'][_0xfbd2('0x2f')]({'where':{'ChatWebsiteId':_0x191faa[_0xfbd2('0x60')]['id']},'transaction':_0x402492})[_0xfbd2('0x1b')](function(_0x3dd8d4){var _0x565f4f=_['map'](_0x191faa['body'],function(_0x456605){_0x456605[_0xfbd2('0x63')]=_0x191faa[_0xfbd2('0x60')]['id'];return _0x456605;});return db['ChatApplication'][_0xfbd2('0x107')](_0x565f4f,{'transaction':_0x402492});});})[_0xfbd2('0x1b')](function(){return db[_0xfbd2('0x9c')][_0xfbd2('0x108')]({'where':{'ChatWebsiteId':_0x191faa[_0xfbd2('0x60')]['id']},'order':_0xfbd2('0x109')});});}})[_0xfbd2('0x1b')](respondWithResult(_0x3546a8,null))[_0xfbd2('0x24')](handleError(_0x3546a8,null));};exports[_0xfbd2('0x10a')]=function(_0x253b6f,_0x4b5481,_0x315462){var _0x37fe09={};var _0x1fb8a9={};var _0xd84d17;var _0xa41a82;return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0x253b6f['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x4b5481,null))[_0xfbd2('0x1b')](function(_0x4a179a){if(_0x4a179a){_0xd84d17=_0x4a179a;_0x1fb8a9[_0xfbd2('0x43')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x1fb8a9[_0xfbd2('0x40')]=_[_0xfbd2('0x52')](_0x253b6f[_0xfbd2('0x40')]);_0x1fb8a9['filters']=_[_0xfbd2('0x42')](_0x1fb8a9['model'],_0x1fb8a9['query']);_0x37fe09[_0xfbd2('0x44')]=_['intersection'](_0x1fb8a9[_0xfbd2('0x43')],qs[_0xfbd2('0x45')](_0x253b6f['query']['fields']));_0x37fe09[_0xfbd2('0x44')]=_0x37fe09[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x37fe09[_0xfbd2('0x44')]:_0x1fb8a9[_0xfbd2('0x43')];_0x37fe09['order']=qs[_0xfbd2('0x49')](_0x253b6f[_0xfbd2('0x40')]['sort']);_0x37fe09[_0xfbd2('0x4b')]=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0x253b6f['query'],_0x1fb8a9['filters']));if(_0x253b6f[_0xfbd2('0x40')]['filter']){_0x37fe09[_0xfbd2('0x4b')]=_[_0xfbd2('0x4e')](_0x37fe09[_0xfbd2('0x4b')],{'$or':_[_0xfbd2('0x3a')](_0x37fe09[_0xfbd2('0x44')],function(_0x1a9fdf){var _0x1043ab={};_0x1043ab[_0x1a9fdf]={'$like':'%'+_0x253b6f['query'][_0xfbd2('0x4d')]+'%'};return _0x1043ab;})});}_0x37fe09=_[_0xfbd2('0x4e')]({},_0x37fe09,_0x253b6f[_0xfbd2('0x4f')]);return _0xd84d17[_0xfbd2('0x10a')](_0x37fe09);}})[_0xfbd2('0x1b')](function(_0xab1368){if(_0xab1368){_0xa41a82=_0xab1368[_0xfbd2('0x46')];if(!_0x253b6f[_0xfbd2('0x40')]['hasOwnProperty'](_0xfbd2('0x47'))){_0x37fe09[_0xfbd2('0x29')]=qs[_0xfbd2('0x29')](_0x253b6f[_0xfbd2('0x40')][_0xfbd2('0x29')]);_0x37fe09[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0x253b6f[_0xfbd2('0x40')][_0xfbd2('0x28')]);}return _0xd84d17[_0xfbd2('0x10a')](_0x37fe09);}})[_0xfbd2('0x1b')](function(_0x1a941b){if(_0x1a941b){return _0x1a941b?{'count':_0xa41a82,'rows':_0x1a941b}:null;}})[_0xfbd2('0x1b')](respondWithResult(_0x4b5481,null))[_0xfbd2('0x24')](handleError(_0x4b5481,null));};exports[_0xfbd2('0x10b')]=function(_0x150213,_0x1f161e,_0x3c35a6){return db[_0xfbd2('0x10c')][_0xfbd2('0x56')]({'where':{'id':_0x150213[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x1f161e,null))[_0xfbd2('0x1b')](function(_0xfcecab){if(_0xfcecab){return _0xfcecab[_0xfbd2('0x10b')](_0x150213[_0xfbd2('0x5f')]['ids'],_[_0xfbd2('0xe1')](_0x150213[_0xfbd2('0x5f')],[_0xfbd2('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x1f161e,null))[_0xfbd2('0x24')](handleError(_0x1f161e,null));};exports['getProactiveActions']=function(_0x3a372e,_0x2facbb,_0x5ece67){var _0x5f2a34={};var _0x57b157={};var _0x3f97f5;var _0x1e9728;return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0x3a372e['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x2facbb,null))[_0xfbd2('0x1b')](function(_0x9d7e9e){if(_0x9d7e9e){_0x3f97f5=_0x9d7e9e;_0x57b157['model']=_[_0xfbd2('0x52')](db[_0xfbd2('0x10d')][_0xfbd2('0x3c')]);_0x57b157[_0xfbd2('0x40')]=_[_0xfbd2('0x52')](_0x3a372e[_0xfbd2('0x40')]);_0x57b157[_0xfbd2('0x41')]=_['intersection'](_0x57b157['model'],_0x57b157[_0xfbd2('0x40')]);_0x5f2a34['attributes']=_['intersection'](_0x57b157[_0xfbd2('0x43')],qs['fields'](_0x3a372e[_0xfbd2('0x40')][_0xfbd2('0x45')]));_0x5f2a34['attributes']=_0x5f2a34[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x5f2a34[_0xfbd2('0x44')]:_0x57b157[_0xfbd2('0x43')];_0x5f2a34['order']=qs[_0xfbd2('0x49')](_0x3a372e[_0xfbd2('0x40')]['sort']);_0x5f2a34[_0xfbd2('0x4b')]=qs['filters'](_[_0xfbd2('0x4a')](_0x3a372e[_0xfbd2('0x40')],_0x57b157[_0xfbd2('0x41')]));if(_0x3a372e[_0xfbd2('0x40')]['filter']){_0x5f2a34[_0xfbd2('0x4b')]=_[_0xfbd2('0x4e')](_0x5f2a34[_0xfbd2('0x4b')],{'$or':_[_0xfbd2('0x3a')](_0x5f2a34[_0xfbd2('0x44')],function(_0x44f76c){var _0x3a5ad8={};_0x3a5ad8[_0x44f76c]={'$like':'%'+_0x3a372e[_0xfbd2('0x40')]['filter']+'%'};return _0x3a5ad8;})});}_0x5f2a34=_[_0xfbd2('0x4e')]({},_0x5f2a34,_0x3a372e[_0xfbd2('0x4f')]);return _0x3f97f5[_0xfbd2('0x10e')](_0x5f2a34);}})[_0xfbd2('0x1b')](function(_0x43f68e){if(_0x43f68e){_0x1e9728=_0x43f68e['length'];if(!_0x3a372e[_0xfbd2('0x40')][_0xfbd2('0x67')](_0xfbd2('0x47'))){_0x5f2a34[_0xfbd2('0x29')]=qs['limit'](_0x3a372e[_0xfbd2('0x40')][_0xfbd2('0x29')]);_0x5f2a34[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0x3a372e[_0xfbd2('0x40')][_0xfbd2('0x28')]);}return _0x3f97f5[_0xfbd2('0x10e')](_0x5f2a34);}})[_0xfbd2('0x1b')](function(_0xdbce2c){if(_0xdbce2c){return _0xdbce2c?{'count':_0x1e9728,'rows':_0xdbce2c}:null;}})['then'](respondWithResult(_0x2facbb,null))[_0xfbd2('0x24')](handleError(_0x2facbb,null));};exports['getFields']=function(_0x4005bf,_0x1e7abf,_0x2a9103){var _0x1cb112=_0x4005bf[_0xfbd2('0x40')][_0xfbd2('0x10f')]===_0xfbd2('0x110')?_0xfbd2('0x111'):_0xfbd2('0x112');return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'attributes':['id',_0x1cb112],'where':{'id':_0x4005bf['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x1e7abf,null))['then'](function(_0x161beb){if(_0x161beb){var _0x4c94d7=_0x161beb[_0x1cb112];var _0x2532a9=_0x4c94d7&&_0x4c94d7['items']?_0x4c94d7[_0xfbd2('0x113')]:[];_0x1e7abf[_0xfbd2('0x36')]({'fromKey':_[_0xfbd2('0x7c')](_0x4c94d7[_0xfbd2('0x114')])?undefined:_0x4c94d7[_0xfbd2('0x114')],'count':_0x2532a9[_0xfbd2('0x46')],'rows':_0x2532a9});}})[_0xfbd2('0x24')](handleError(_0x1e7abf,null));};exports[_0xfbd2('0x115')]=function(_0xdc2f09,_0x35dfc0,_0x5de796){var _0x2a5584={'raw':![],'where':{}};var _0x3d77fc={};var _0x5d56eb={'count':0x0,'rows':[]};return db[_0xfbd2('0x3b')][_0xfbd2('0x66')]({'where':{'id':_0xdc2f09['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x35dfc0,null))[_0xfbd2('0x1b')](function(_0xe01c3){if(_0xe01c3){_0x3d77fc[_0xfbd2('0x43')]=_[_0xfbd2('0x52')](db[_0xfbd2('0xd3')][_0xfbd2('0x3c')]);_0x3d77fc[_0xfbd2('0x40')]=_['keys'](_0xdc2f09['query']);_0x3d77fc['filters']=_['intersection'](_0x3d77fc[_0xfbd2('0x43')],_0x3d77fc['query']);_0x2a5584['attributes']=_[_0xfbd2('0x42')](_0x3d77fc[_0xfbd2('0x43')],qs[_0xfbd2('0x45')](_0xdc2f09[_0xfbd2('0x40')][_0xfbd2('0x45')]));_0x2a5584[_0xfbd2('0x44')]=_0x2a5584[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x2a5584[_0xfbd2('0x44')]:_0x3d77fc[_0xfbd2('0x43')];if(!_0xdc2f09[_0xfbd2('0x40')][_0xfbd2('0x67')](_0xfbd2('0x47'))){_0x2a5584[_0xfbd2('0x29')]=qs['limit'](_0xdc2f09['query'][_0xfbd2('0x29')]);_0x2a5584[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0xdc2f09[_0xfbd2('0x40')][_0xfbd2('0x28')]);}_0x2a5584[_0xfbd2('0x48')]=qs['sort'](_0xdc2f09['query'][_0xfbd2('0x49')]);_0x2a5584[_0xfbd2('0x4b')]=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0xdc2f09['query'],_0x3d77fc[_0xfbd2('0x41')]));_0x2a5584['where'][_0xfbd2('0x63')]=_0xe01c3['id'];if(_0xdc2f09[_0xfbd2('0x40')]['filter']){_0x2a5584[_0xfbd2('0x4b')]=_['merge'](_0x2a5584[_0xfbd2('0x4b')],{'$or':_['map'](_0x2a5584[_0xfbd2('0x44')],function(_0x4e8f2c){var _0x15762a={};_0x15762a[_0x4e8f2c]={'$like':'%'+_0xdc2f09[_0xfbd2('0x40')]['filter']+'%'};return _0x15762a;})});}_0x2a5584=_[_0xfbd2('0x4e')]({},_0x2a5584,_0xdc2f09[_0xfbd2('0x4f')]);return db[_0xfbd2('0xd3')]['count']({'where':_0x2a5584['where']})['then'](function(_0x463892){_0x5d56eb[_0xfbd2('0x50')]=_0x463892;if(_0xdc2f09[_0xfbd2('0x40')]['includeAll']){_0x2a5584[_0xfbd2('0x55')]=[{'all':!![]}];}else{_0x2a5584[_0xfbd2('0x55')]=[{'model':db[_0xfbd2('0x99')],'as':_0xfbd2('0xe3'),'required':![]}];}return db[_0xfbd2('0xd3')][_0xfbd2('0x68')](_0x2a5584);})['then'](function(_0x1ccffa){_0x5d56eb['rows']=_0x1ccffa;return _0x5d56eb;});}})[_0xfbd2('0x1b')](respondWithFilteredResult(_0x35dfc0,_0x2a5584))['catch'](handleError(_0x35dfc0,null));};exports[_0xfbd2('0x116')]=function(_0x1e7129,_0x582433,_0x57e3b1){return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x1e7129[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x582433,null))[_0xfbd2('0x1b')](function(_0x251b78){if(_0x251b78){return _0x251b78[_0xfbd2('0x116')](_0x1e7129[_0xfbd2('0x5f')][_0xfbd2('0x6a')],_[_0xfbd2('0xe1')](_0x1e7129[_0xfbd2('0x5f')],[_0xfbd2('0x6a'),'id'])||{})['spread'](function(_0x27c12c){for(var _0x454c11=0x0;_0x454c11<_0x1e7129[_0xfbd2('0x5f')]['ids']['length'];_0x454c11+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x1e7129['body'][_0xfbd2('0x6a')][_0x454c11],'ChatWebsiteId':_0x1e7129[_0xfbd2('0x60')]['id']});}return _0x27c12c;});}})[_0xfbd2('0x1b')](respondWithResult(_0x582433,null))['catch'](handleError(_0x582433,null));};exports[_0xfbd2('0x117')]=function(_0x23097e,_0x538589,_0xfd7227){return db[_0xfbd2('0x3b')][_0xfbd2('0x56')]({'where':{'id':_0x23097e[_0xfbd2('0x60')]['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x538589,null))[_0xfbd2('0x1b')](function(_0x2b8ccc){if(_0x2b8ccc){return _0x2b8ccc['removeAgents'](_0x23097e[_0xfbd2('0x40')][_0xfbd2('0x6a')])[_0xfbd2('0x1b')](function(){if(_[_0xfbd2('0x118')](_0x23097e[_0xfbd2('0x40')][_0xfbd2('0x6a')])){for(var _0x6fbf0e=0x0;_0x6fbf0e<_0x23097e[_0xfbd2('0x40')]['ids'][_0xfbd2('0x46')];_0x6fbf0e+=0x1){socket[_0xfbd2('0x119')](_0xfbd2('0x11a'),{'UserId':Number(_0x23097e[_0xfbd2('0x40')]['ids'][_0x6fbf0e]),'ChatWebsiteId':Number(_0x23097e[_0xfbd2('0x60')]['id'])});}}else{socket['emit'](_0xfbd2('0x11a'),{'UserId':Number(_0x23097e[_0xfbd2('0x40')][_0xfbd2('0x6a')]),'ChatWebsiteId':Number(_0x23097e['params']['id'])});}});}})[_0xfbd2('0x1b')](respondWithStatusCode(_0x538589,null))[_0xfbd2('0x24')](handleError(_0x538589,null));};exports[_0xfbd2('0x11b')]=function(_0x215230,_0x17f941,_0x4e8d99){var _0x53053f={};var _0x3c3354={};var _0x50a287;var _0x4f48e8;return db[_0xfbd2('0x3b')]['findOne']({'where':{'id':_0x215230['params']['id']}})[_0xfbd2('0x1b')](handleEntityNotFound(_0x17f941,null))['then'](function(_0x27f7e0){if(_0x27f7e0){_0x50a287=_0x27f7e0;_0x3c3354['model']=_['keys'](db['User'][_0xfbd2('0x3c')]);_0x3c3354[_0xfbd2('0x40')]=_[_0xfbd2('0x52')](_0x215230[_0xfbd2('0x40')]);_0x3c3354[_0xfbd2('0x41')]=_[_0xfbd2('0x42')](_0x3c3354['model'],_0x3c3354[_0xfbd2('0x40')]);_0x53053f[_0xfbd2('0x44')]=_[_0xfbd2('0x42')](_0x3c3354['model'],qs[_0xfbd2('0x45')](_0x215230['query'][_0xfbd2('0x45')]));_0x53053f[_0xfbd2('0x44')]=_0x53053f[_0xfbd2('0x44')][_0xfbd2('0x46')]?_0x53053f[_0xfbd2('0x44')]:_0x3c3354['model'];_0x53053f[_0xfbd2('0x48')]=qs[_0xfbd2('0x49')](_0x215230[_0xfbd2('0x40')][_0xfbd2('0x49')]);_0x53053f['where']=qs[_0xfbd2('0x41')](_[_0xfbd2('0x4a')](_0x215230['query'],_0x3c3354[_0xfbd2('0x41')]));if(_0x215230['query']['filter']){_0x53053f[_0xfbd2('0x4b')]=_['merge'](_0x53053f[_0xfbd2('0x4b')],{'$or':_[_0xfbd2('0x3a')](_0x53053f['attributes'],function(_0x19f36b){var _0x3f1a0b={};_0x3f1a0b[_0x19f36b]={'$like':'%'+_0x215230[_0xfbd2('0x40')]['filter']+'%'};return _0x3f1a0b;})});}_0x53053f=_[_0xfbd2('0x4e')]({},_0x53053f,_0x215230['options']);return _0x50a287['getAgents'](_0x53053f);}})['then'](function(_0x42877c){if(_0x42877c){_0x4f48e8=_0x42877c[_0xfbd2('0x46')];if(!_0x215230['query']['hasOwnProperty'](_0xfbd2('0x47'))){_0x53053f[_0xfbd2('0x29')]=qs[_0xfbd2('0x29')](_0x215230[_0xfbd2('0x40')]['limit']);_0x53053f[_0xfbd2('0x28')]=qs[_0xfbd2('0x28')](_0x215230[_0xfbd2('0x40')][_0xfbd2('0x28')]);}return _0x50a287[_0xfbd2('0x11b')](_0x53053f);}})[_0xfbd2('0x1b')](function(_0x172254){if(_0x172254){return _0x172254?{'count':_0x4f48e8,'rows':_0x172254}:null;}})[_0xfbd2('0x1b')](respondWithResult(_0x17f941,null))['catch'](handleError(_0x17f941,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c471d4a..3611bab 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 _0x8ff3=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x56b5d1,_0x59be02){_0x56b5d1=_0x56b5d1-0x0;var _0x5bfe4a=_0x8ff3[_0x56b5d1];return _0x5bfe4a;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x38ff('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x38ff('0x1')](0x0);var events={'afterCreate':_0x38ff('0x2'),'afterUpdate':_0x38ff('0x3'),'afterDestroy':_0x38ff('0x4')};function emitEvent(_0x1ba15b){return function(_0xb50dcf,_0x5443a0,_0x58c06c){ChatWebsiteEvents[_0x38ff('0x5')](_0x1ba15b+':'+_0xb50dcf['id'],_0xb50dcf);ChatWebsiteEvents[_0x38ff('0x5')](_0x1ba15b,_0xb50dcf);_0x58c06c(null);};}for(var e in events){if(events[_0x38ff('0x6')](e)){var event=events[e];ChatWebsite[_0x38ff('0x7')](e,emitEvent(event));}}module[_0x38ff('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5cd7=['ChatWebsite','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x4d3dc0,_0x117b6b){var _0x3e57cb=function(_0x2fa259){while(--_0x2fa259){_0x4d3dc0['push'](_0x4d3dc0['shift']());}};_0x3e57cb(++_0x117b6b);}(_0x5cd7,0x102));var _0x75cd=function(_0x30ba61,_0x48b905){_0x30ba61=_0x30ba61-0x0;var _0x7300ad=_0x5cd7[_0x30ba61];return _0x7300ad;};'use strict';var EventEmitter=require(_0x75cd('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x75cd('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x75cd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x75cd('0x3')};function emitEvent(_0x393073){return function(_0x392b95,_0x20e1dd,_0x397635){ChatWebsiteEvents[_0x75cd('0x4')](_0x393073+':'+_0x392b95['id'],_0x392b95);ChatWebsiteEvents[_0x75cd('0x4')](_0x393073,_0x392b95);_0x397635(null);};}for(var e in events){if(events[_0x75cd('0x5')](e)){var event=events[e];ChatWebsite[_0x75cd('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index daca50f..62f08a3 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 _0x765e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','lodash','util','../../config/logger'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0x765e,0x131));var _0xe765=function(_0x1bb8e2,_0x203a0c){_0x1bb8e2=_0x1bb8e2-0x0;var _0x3eac0d=_0x765e[_0x1bb8e2];return _0x3eac0d;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var logger=require(_0xe765('0x2'))(_0xe765('0x3'));var moment=require(_0xe765('0x4'));var BPromise=require(_0xe765('0x5'));var rp=require(_0xe765('0x6'));var fs=require('fs');var path=require(_0xe765('0x7'));var rimraf=require(_0xe765('0x8'));var config=require(_0xe765('0x9'));var attributes=require(_0xe765('0xa'));module[_0xe765('0xb')]=function(_0x40ac5e,_0xdcac86){return _0x40ac5e[_0xe765('0xc')]('ChatWebsite',attributes,{'tableName':_0xe765('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['ChatWebsite','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x40d6c7,_0x1a15c7){_0x40d6c7=_0x40d6c7-0x0;var _0x5af2e8=_0x6f7a[_0x40d6c7];return _0x5af2e8;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'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 097ff0c..eb97e04 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 _0x0598=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info'];(function(_0x1a2d64,_0x335ef9){var _0x2486a3=function(_0x1d3e64){while(--_0x1d3e64){_0x1a2d64['push'](_0x1a2d64['shift']());}};_0x2486a3(++_0x335ef9);}(_0x0598,0x92));var _0x8059=function(_0x26b97f,_0x5eb504){_0x26b97f=_0x26b97f-0x0;var _0x2b3681=_0x0598[_0x26b97f];return _0x2b3681;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var moment=require('moment');var BPromise=require(_0x8059('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8059('0x3'))['db'];var utils=require(_0x8059('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8059('0x5'));var client=jayson[_0x8059('0x6')]['http']({'port':0x232a});config['redis']=_[_0x8059('0x7')](config[_0x8059('0x8')],{'host':_0x8059('0x9'),'port':0x18eb});var socket=require(_0x8059('0xa'))(new Redis(config['redis']));require('./chatWebsite.socket')[_0x8059('0xb')](socket);function respondWithRpcPromise(_0x1bf5fd,_0x336f85,_0x5097d6){return new BPromise(function(_0x283b63,_0x52a60d){return client['request'](_0x1bf5fd,_0x5097d6)[_0x8059('0xc')](function(_0x4109a9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x336f85,'request\x20sent');logger[_0x8059('0xd')](_0x8059('0xe'),_0x336f85,_0x8059('0xf'),JSON[_0x8059('0x10')](_0x4109a9));if(_0x4109a9[_0x8059('0x11')]){if(_0x4109a9['error'][_0x8059('0x12')]===0x1f4){logger['error'](_0x8059('0x13'),_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x52a60d(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x336f85,_0x4109a9['error'][_0x8059('0x14')]);return _0x283b63(_0x4109a9[_0x8059('0x11')][_0x8059('0x14')]);}else{logger[_0x8059('0x15')](_0x8059('0x13'),_0x336f85,'request\x20sent');_0x283b63(_0x4109a9[_0x8059('0x16')][_0x8059('0x14')]);}})[_0x8059('0x17')](function(_0x1c4566){logger['error'](_0x8059('0x13'),_0x336f85,_0x1c4566);_0x52a60d(_0x1c4566);});});} \ No newline at end of file +var _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x9536,0x179));var _0x6953=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x9536[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});config[_0x6953('0xb')]=_[_0x6953('0xc')](config[_0x6953('0xb')],{'host':_0x6953('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6953('0xb')]));require(_0x6953('0xe'))[_0x6953('0xf')](socket);function respondWithRpcPromise(_0x4b505f,_0x41f41b,_0x465761){return new BPromise(function(_0x300c48,_0xb13f2c){return client[_0x6953('0x10')](_0x4b505f,_0x465761)[_0x6953('0x11')](function(_0x246534){logger[_0x6953('0x12')](_0x6953('0x13'),_0x41f41b,'request\x20sent');logger[_0x6953('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x41f41b,_0x6953('0x15'),JSON[_0x6953('0x16')](_0x246534));if(_0x246534[_0x6953('0x17')]){if(_0x246534[_0x6953('0x17')][_0x6953('0x18')]===0x1f4){logger[_0x6953('0x17')](_0x6953('0x13'),_0x41f41b,_0x246534[_0x6953('0x17')][_0x6953('0x19')]);return _0xb13f2c(_0x246534[_0x6953('0x17')][_0x6953('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x41f41b,_0x246534[_0x6953('0x17')][_0x6953('0x19')]);return _0x300c48(_0x246534[_0x6953('0x17')][_0x6953('0x19')]);}else{logger['info'](_0x6953('0x13'),_0x41f41b,_0x6953('0x15'));_0x300c48(_0x246534['result'][_0x6953('0x19')]);}})[_0x6953('0x1a')](function(_0x283cf4){logger[_0x6953('0x17')](_0x6953('0x13'),_0x41f41b,_0x283cf4);_0xb13f2c(_0x283cf4);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a5dcc28..4e184a9 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3ed736,_0x57fbcd){var _0x452ee3=function(_0x198fec){while(--_0x198fec){_0x3ed736['push'](_0x3ed736['shift']());}};_0x452ee3(++_0x57fbcd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ab181,_0xa66a71){_0x4ab181=_0x4ab181-0x0;var _0x26cc6f=_0x5f2f[_0x4ab181];return _0x26cc6f;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0xc48869,_0x56b37b){var _0x1f5dca=function(_0x508043){while(--_0x508043){_0xc48869['push'](_0xc48869['shift']());}};_0x1f5dca(++_0x56b37b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3cfa3f,_0x2af09a){_0x3cfa3f=_0x3cfa3f-0x0;var _0x288cb9=_0x5f2f[_0x3cfa3f];return _0x288cb9;};'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 040c735..33a0046 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 _0xfb19=['getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','root','server/files/images/logos/','format','%s-%s','now','file','join','originalname','single','addAvatar','server/files/images/avatars/','addCustomerAvatar','diskStorage','addSystemAvatar','/:id/notify','notify','offline','/:id/applications','addProactiveActions','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','Router','../../config/environment','get','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xfb19,0x1a0));var _0x9fb1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfb19[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9fb1('0x0'));var util=require(_0x9fb1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9fb1('0x2'));var router=express[_0x9fb1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9fb1('0x4'));var controller=require('./chatWebsite.controller');router[_0x9fb1('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9fb1('0x5')]('/describe',auth[_0x9fb1('0x6')](),controller['describe']);router[_0x9fb1('0x5')]('/:id',auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x7')]);router['get'](_0x9fb1('0x8'),auth['isAuthenticated'](),controller[_0x9fb1('0x9')]);router[_0x9fb1('0x5')](_0x9fb1('0xa'),auth['isAuthenticated'](),controller[_0x9fb1('0xb')]);router[_0x9fb1('0x5')](_0x9fb1('0xc'),controller['getLogo']);router[_0x9fb1('0x5')](_0x9fb1('0xd'),controller[_0x9fb1('0xe')]);router[_0x9fb1('0x5')](_0x9fb1('0xf'),controller[_0x9fb1('0x10')]);router[_0x9fb1('0x5')](_0x9fb1('0x11'),controller[_0x9fb1('0x12')]);router[_0x9fb1('0x5')](_0x9fb1('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x9fb1('0x5')](_0x9fb1('0x14'),controller[_0x9fb1('0x15')]);router[_0x9fb1('0x5')]('/:id/applications',auth[_0x9fb1('0x6')](),controller['getApplications']);router['get'](_0x9fb1('0x16'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x17')]);router[_0x9fb1('0x5')]('/:id/fields',controller[_0x9fb1('0x18')]);router[_0x9fb1('0x5')](_0x9fb1('0x19'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x1a')]);router[_0x9fb1('0x5')](_0x9fb1('0x1b'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x1c')]);router[_0x9fb1('0x1d')]('/',auth['isAuthenticated'](),controller[_0x9fb1('0x1e')]);router[_0x9fb1('0x1d')](_0x9fb1('0x8'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x1f')]);router['post'](_0x9fb1('0xa'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x17ca11,_0x4d8e66,_0xa9632f){_0xa9632f(null,path['join'](config[_0x9fb1('0x21')],_0x9fb1('0x22')));},'filename':function(_0x3e63d6,_0x10894b,_0x4d6ee5){_0x4d6ee5(null,util[_0x9fb1('0x23')](_0x9fb1('0x24'),Date[_0x9fb1('0x25')](),_0x10894b['originalname']));}})});router[_0x9fb1('0x1d')](_0x9fb1('0xc'),upload['single'](_0x9fb1('0x26')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1522c4,_0x3a15a4,_0x207e36){_0x207e36(null,path[_0x9fb1('0x27')](config[_0x9fb1('0x21')],'server/files/images/avatars/'));},'filename':function(_0x5d81f7,_0x2aaaa7,_0x3c2e7d){_0x3c2e7d(null,util[_0x9fb1('0x23')](_0x9fb1('0x24'),Date['now'](),_0x2aaaa7[_0x9fb1('0x28')]));}})});router[_0x9fb1('0x1d')](_0x9fb1('0xd'),upload[_0x9fb1('0x29')](_0x9fb1('0x26')),controller[_0x9fb1('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x33a8a2,_0x309c0e,_0x5dee48){_0x5dee48(null,path[_0x9fb1('0x27')](config[_0x9fb1('0x21')],_0x9fb1('0x2b')));},'filename':function(_0x22505d,_0x135cbc,_0x1019be){_0x1019be(null,util[_0x9fb1('0x23')](_0x9fb1('0x24'),Date[_0x9fb1('0x25')](),_0x135cbc[_0x9fb1('0x28')]));}})});router[_0x9fb1('0x1d')](_0x9fb1('0xf'),upload[_0x9fb1('0x29')](_0x9fb1('0x26')),controller[_0x9fb1('0x2c')]);var upload=multer({'storage':multer[_0x9fb1('0x2d')]({'destination':function(_0x218611,_0x12d345,_0x1b9037){_0x1b9037(null,path[_0x9fb1('0x27')](config[_0x9fb1('0x21')],_0x9fb1('0x2b')));},'filename':function(_0x2817b8,_0x114661,_0x3476df){_0x3476df(null,util['format']('%s-%s',Date[_0x9fb1('0x25')](),_0x114661[_0x9fb1('0x28')]));}})});router[_0x9fb1('0x1d')](_0x9fb1('0x11'),upload[_0x9fb1('0x29')](_0x9fb1('0x26')),controller[_0x9fb1('0x2e')]);router[_0x9fb1('0x1d')](_0x9fb1('0x2f'),controller[_0x9fb1('0x30')]);router[_0x9fb1('0x1d')]('/:id/offline',controller[_0x9fb1('0x31')]);router[_0x9fb1('0x1d')](_0x9fb1('0x13'),auth[_0x9fb1('0x6')](),controller['addInteraction']);router[_0x9fb1('0x1d')](_0x9fb1('0x32'),auth[_0x9fb1('0x6')](),controller['addApplications']);router[_0x9fb1('0x1d')](_0x9fb1('0x16'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x33')]);router[_0x9fb1('0x1d')]('/:id/users',auth[_0x9fb1('0x6')](),controller['addAgents']);router[_0x9fb1('0x34')](_0x9fb1('0x35'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x36')]);router[_0x9fb1('0x37')](_0x9fb1('0x35'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x38')]);router[_0x9fb1('0x37')](_0x9fb1('0x8'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x39')]);router[_0x9fb1('0x37')](_0x9fb1('0xa'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x3a')]);router[_0x9fb1('0x37')](_0x9fb1('0x1b'),auth[_0x9fb1('0x6')](),controller[_0x9fb1('0x3b')]);module[_0x9fb1('0x3c')]=router; \ No newline at end of file +var _0xa212=['getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','single','file','addLogo','join','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','addProactiveActions','addAgents','put','/:id','update','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','index','describe','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users'];(function(_0xd49e15,_0x5e34ac){var _0x306b6a=function(_0x38ce9c){while(--_0x38ce9c){_0xd49e15['push'](_0xd49e15['shift']());}};_0x306b6a(++_0x5e34ac);}(_0xa212,0xec));var _0x2a21=function(_0x1a9b15,_0x3c0f23){_0x1a9b15=_0x1a9b15-0x0;var _0x4d4f37=_0xa212[_0x1a9b15];return _0x4d4f37;};'use strict';var multer=require(_0x2a21('0x0'));var util=require(_0x2a21('0x1'));var path=require(_0x2a21('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2a21('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2a21('0x4'));router[_0x2a21('0x5')]('/',auth[_0x2a21('0x6')](),controller[_0x2a21('0x7')]);router[_0x2a21('0x5')]('/describe',auth[_0x2a21('0x6')](),controller[_0x2a21('0x8')]);router['get']('/:id',auth[_0x2a21('0x6')](),controller[_0x2a21('0x9')]);router[_0x2a21('0x5')]('/:id/dispositions',auth[_0x2a21('0x6')](),controller[_0x2a21('0xa')]);router[_0x2a21('0x5')](_0x2a21('0xb'),auth[_0x2a21('0x6')](),controller['getAnswers']);router[_0x2a21('0x5')](_0x2a21('0xc'),controller[_0x2a21('0xd')]);router[_0x2a21('0x5')](_0x2a21('0xe'),controller[_0x2a21('0xf')]);router[_0x2a21('0x5')](_0x2a21('0x10'),controller['getCustomerAvatar']);router[_0x2a21('0x5')](_0x2a21('0x11'),controller[_0x2a21('0x12')]);router[_0x2a21('0x5')](_0x2a21('0x13'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x14')]);router[_0x2a21('0x5')](_0x2a21('0x15'),controller[_0x2a21('0x16')]);router[_0x2a21('0x5')](_0x2a21('0x17'),auth['isAuthenticated'](),controller[_0x2a21('0x18')]);router[_0x2a21('0x5')](_0x2a21('0x19'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x1a')]);router[_0x2a21('0x5')](_0x2a21('0x1b'),controller[_0x2a21('0x1c')]);router[_0x2a21('0x5')](_0x2a21('0x1d'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x1e')]);router[_0x2a21('0x5')](_0x2a21('0x1f'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x20')]);router[_0x2a21('0x21')]('/',auth[_0x2a21('0x6')](),controller[_0x2a21('0x22')]);router[_0x2a21('0x21')](_0x2a21('0x23'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x2a21('0xb'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x24')]);var upload=multer({'storage':multer[_0x2a21('0x25')]({'destination':function(_0x9ff85a,_0xc4e9e5,_0x152d2a){_0x152d2a(null,path['join'](config[_0x2a21('0x26')],_0x2a21('0x27')));},'filename':function(_0xbc9a66,_0x336738,_0x4bb237){_0x4bb237(null,util[_0x2a21('0x28')](_0x2a21('0x29'),Date[_0x2a21('0x2a')](),_0x336738['originalname']));}})});router[_0x2a21('0x21')](_0x2a21('0xc'),upload[_0x2a21('0x2b')](_0x2a21('0x2c')),controller[_0x2a21('0x2d')]);var upload=multer({'storage':multer[_0x2a21('0x25')]({'destination':function(_0x570f65,_0xc88d7a,_0x1810c5){_0x1810c5(null,path[_0x2a21('0x2e')](config[_0x2a21('0x26')],_0x2a21('0x2f')));},'filename':function(_0x1906b4,_0xb27dd2,_0x4020d0){_0x4020d0(null,util[_0x2a21('0x28')]('%s-%s',Date['now'](),_0xb27dd2[_0x2a21('0x30')]));}})});router[_0x2a21('0x21')](_0x2a21('0xe'),upload[_0x2a21('0x2b')](_0x2a21('0x2c')),controller[_0x2a21('0x31')]);var upload=multer({'storage':multer[_0x2a21('0x25')]({'destination':function(_0x38be0a,_0x5b72f3,_0x304479){_0x304479(null,path[_0x2a21('0x2e')](config[_0x2a21('0x26')],_0x2a21('0x2f')));},'filename':function(_0xcb2e8e,_0x16200e,_0x4bcf1b){_0x4bcf1b(null,util['format']('%s-%s',Date[_0x2a21('0x2a')](),_0x16200e['originalname']));}})});router[_0x2a21('0x21')](_0x2a21('0x10'),upload['single']('file'),controller[_0x2a21('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ee4cd,_0x2b0e0f,_0x23d542){_0x23d542(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x18dfe9,_0x40455e,_0x1acffe){_0x1acffe(null,util['format'](_0x2a21('0x29'),Date[_0x2a21('0x2a')](),_0x40455e[_0x2a21('0x30')]));}})});router['post'](_0x2a21('0x11'),upload[_0x2a21('0x2b')](_0x2a21('0x2c')),controller['addSystemAvatar']);router[_0x2a21('0x21')](_0x2a21('0x33'),controller[_0x2a21('0x34')]);router[_0x2a21('0x21')](_0x2a21('0x35'),controller[_0x2a21('0x36')]);router['post'](_0x2a21('0x13'),auth[_0x2a21('0x6')](),controller['addInteraction']);router['post'](_0x2a21('0x17'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x37')]);router[_0x2a21('0x21')](_0x2a21('0x19'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x38')]);router[_0x2a21('0x21')]('/:id/users',auth[_0x2a21('0x6')](),controller[_0x2a21('0x39')]);router[_0x2a21('0x3a')](_0x2a21('0x3b'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x3c')]);router['delete'](_0x2a21('0x3b'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x3d')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2a21('0x3e')]);router[_0x2a21('0x3f')](_0x2a21('0xb'),auth[_0x2a21('0x6')](),controller[_0x2a21('0x40')]);router[_0x2a21('0x3f')](_0x2a21('0x1f'),auth['isAuthenticated'](),controller[_0x2a21('0x41')]);module[_0x2a21('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 ab4b844..92a9fb2 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 _0x6dc0=['Google','sequelize','STRING','ENUM','AmazonAWS'];(function(_0x4ed12a,_0x185585){var _0x27a3d0=function(_0x586fbc){while(--_0x586fbc){_0x4ed12a['push'](_0x4ed12a['shift']());}};_0x27a3d0(++_0x185585);}(_0x6dc0,0x18c));var _0x06dc=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0x6dc0[_0x4b0290];return _0x4bd9f4;};'use strict';var Sequelize=require(_0x06dc('0x0'));module['exports']={'name':{'type':Sequelize[_0x06dc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x06dc('0x2')](_0x06dc('0x3'),_0x06dc('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x06dc('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x737d=['exports','STRING','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x737d,0xbc));var _0xd737=function(_0x47dea0,_0x455d8e){_0x47dea0=_0x47dea0-0x0;var _0x3280d6=_0x737d[_0x47dea0];return _0x3280d6;};'use strict';var Sequelize=require(_0xd737('0x0'));module[_0xd737('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS','Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xd737('0x2')]},'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 351392d..18f270d 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 _0x2e31=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','save','update','then','destroy','end','error','name','send','map','CloudProvider','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','findAll','rows','catch','show','params','filtears','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs'];(function(_0x5e0e73,_0x3a682c){var _0x2076c7=function(_0x4e82cf){while(--_0x4e82cf){_0x5e0e73['push'](_0x5e0e73['shift']());}};_0x2076c7(++_0x3a682c);}(_0x2e31,0x145));var _0x12e3=function(_0x40b8e2,_0xb13d69){_0x40b8e2=_0x40b8e2-0x0;var _0x40ee9=_0x2e31[_0x40b8e2];return _0x40ee9;};'use strict';var pdf=require(_0x12e3('0x0'));var emlformat=require(_0x12e3('0x1'));var rimraf=require(_0x12e3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x12e3('0x3'));var rp=require(_0x12e3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x12e3('0x5'));var util=require(_0x12e3('0x6'));var path=require(_0x12e3('0x7'));var sox=require('sox');var csv=require(_0x12e3('0x8'));var ejs=require(_0x12e3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x12e3('0xa'));var jsforce=require(_0x12e3('0xb'));var deskjs=require(_0x12e3('0xc'));var toCsv=require(_0x12e3('0x8'));var querystring=require('querystring');var Papa=require(_0x12e3('0xd'));var Redis=require(_0x12e3('0xe'));var authService=require(_0x12e3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12e3('0x10'));var logger=require(_0x12e3('0x11'))(_0x12e3('0x12'));var utils=require(_0x12e3('0x13'));var config=require(_0x12e3('0x14'));var licenseUtil=require(_0x12e3('0x15'));var db=require(_0x12e3('0x16'))['db'];function respondWithStatusCode(_0xc2c4c8,_0x2b5dc3){_0x2b5dc3=_0x2b5dc3||0xcc;return function(_0x464b63){if(_0x464b63){return _0xc2c4c8[_0x12e3('0x17')](_0x2b5dc3);}return _0xc2c4c8[_0x12e3('0x18')](_0x2b5dc3)['end']();};}function respondWithResult(_0x2b5352,_0x19de67){_0x19de67=_0x19de67||0xc8;return function(_0xd9f80f){if(_0xd9f80f){return _0x2b5352['status'](_0x19de67)[_0x12e3('0x19')](_0xd9f80f);}};}function respondWithFilteredResult(_0x1f7b14,_0x4a29e8){return function(_0x5434fd){if(_0x5434fd){var _0x583ca3=_0x5434fd[_0x12e3('0x1a')],_0x7e6a5c=_0x4a29e8[_0x12e3('0x1b')],_0x5f3e3b=_0x4a29e8[_0x12e3('0x1b')]+_0x4a29e8[_0x12e3('0x1c')],_0x2f26b1;if(_0x5f3e3b>=_0x583ca3){_0x5f3e3b=_0x583ca3;_0x2f26b1=0xc8;}else{_0x2f26b1=0xce;}_0x1f7b14[_0x12e3('0x18')](_0x2f26b1);return _0x1f7b14['set'](_0x12e3('0x1d'),_0x7e6a5c+'-'+_0x5f3e3b+'/'+_0x583ca3)[_0x12e3('0x19')](_0x5434fd);}return null;};}function patchUpdates(_0x5cd991){return function(_0x527dc6){try{jsonpatch['apply'](_0x527dc6,_0x5cd991,!![]);}catch(_0x2e5f1a){return BPromise['reject'](_0x2e5f1a);}return _0x527dc6[_0x12e3('0x1e')]();};}function saveUpdates(_0x2ddfbf,_0x5a1990){return function(_0x48f4b6){if(_0x48f4b6){return _0x48f4b6[_0x12e3('0x1f')](_0x2ddfbf)[_0x12e3('0x20')](function(_0x236731){return _0x236731;});}return null;};}function removeEntity(_0x1f1873,_0x4b8617){return function(_0x55380a){if(_0x55380a){return _0x55380a[_0x12e3('0x21')]()[_0x12e3('0x20')](function(){_0x1f1873[_0x12e3('0x18')](0xcc)[_0x12e3('0x22')]();});}};}function handleEntityNotFound(_0x2cf78a,_0x553982){return function(_0xaaf65f){if(!_0xaaf65f){_0x2cf78a[_0x12e3('0x17')](0x194);}return _0xaaf65f;};}function handleError(_0xd04cbc,_0x2218e7){_0x2218e7=_0x2218e7||0x1f4;return function(_0x43a59f){logger[_0x12e3('0x23')](_0x43a59f['stack']);if(_0x43a59f[_0x12e3('0x24')]){delete _0x43a59f[_0x12e3('0x24')];}_0xd04cbc[_0x12e3('0x18')](_0x2218e7)[_0x12e3('0x25')](_0x43a59f);};}exports['index']=function(_0x1609ea,_0x29880d){var _0x2293ec={},_0x593020={},_0x25f4c7={'count':0x0,'rows':[]};var _0x2f9a7d=_[_0x12e3('0x26')](db[_0x12e3('0x27')]['rawAttributes'],function(_0x342ad2){return{'name':_0x342ad2[_0x12e3('0x28')],'type':_0x342ad2[_0x12e3('0x29')]['key']};});_0x593020[_0x12e3('0x2a')]=_['map'](_0x2f9a7d,_0x12e3('0x24'));_0x593020[_0x12e3('0x2b')]=_[_0x12e3('0x2c')](_0x1609ea[_0x12e3('0x2b')]);_0x593020[_0x12e3('0x2d')]=_[_0x12e3('0x2e')](_0x593020['model'],_0x593020[_0x12e3('0x2b')]);_0x2293ec[_0x12e3('0x2f')]=_['intersection'](_0x593020[_0x12e3('0x2a')],qs[_0x12e3('0x30')](_0x1609ea['query'][_0x12e3('0x30')]));_0x2293ec[_0x12e3('0x2f')]=_0x2293ec['attributes'][_0x12e3('0x31')]?_0x2293ec[_0x12e3('0x2f')]:_0x593020[_0x12e3('0x2a')];if(!_0x1609ea['query'][_0x12e3('0x32')](_0x12e3('0x33'))){_0x2293ec[_0x12e3('0x1c')]=qs[_0x12e3('0x1c')](_0x1609ea[_0x12e3('0x2b')][_0x12e3('0x1c')]);_0x2293ec[_0x12e3('0x1b')]=qs[_0x12e3('0x1b')](_0x1609ea[_0x12e3('0x2b')][_0x12e3('0x1b')]);}_0x2293ec[_0x12e3('0x34')]=qs[_0x12e3('0x35')](_0x1609ea[_0x12e3('0x2b')]['sort']);_0x2293ec[_0x12e3('0x36')]=qs['filters'](_[_0x12e3('0x37')](_0x1609ea['query'],_0x593020[_0x12e3('0x2d')]),_0x2f9a7d);if(_0x1609ea[_0x12e3('0x2b')]['filter']){_0x2293ec[_0x12e3('0x36')]=_[_0x12e3('0x38')](_0x2293ec['where'],{'$or':_[_0x12e3('0x26')](_0x2f9a7d,function(_0x1a8c02){if(_0x1a8c02[_0x12e3('0x29')]!=='VIRTUAL'){var _0x34c0fd={};_0x34c0fd[_0x1a8c02[_0x12e3('0x24')]]={'$like':'%'+_0x1609ea[_0x12e3('0x2b')]['filter']+'%'};return _0x34c0fd;}})});}_0x2293ec=_[_0x12e3('0x38')]({},_0x2293ec,_0x1609ea['options']);var _0x50e1b9={'where':_0x2293ec[_0x12e3('0x36')]};return db[_0x12e3('0x27')][_0x12e3('0x1a')](_0x50e1b9)['then'](function(_0x482285){_0x25f4c7[_0x12e3('0x1a')]=_0x482285;if(_0x1609ea['query'][_0x12e3('0x39')]){_0x2293ec['include']=[{'all':!![]}];}return db[_0x12e3('0x27')][_0x12e3('0x3a')](_0x2293ec);})[_0x12e3('0x20')](function(_0x525dc9){_0x25f4c7[_0x12e3('0x3b')]=_0x525dc9;return _0x25f4c7;})[_0x12e3('0x20')](respondWithFilteredResult(_0x29880d,_0x2293ec))[_0x12e3('0x3c')](handleError(_0x29880d,null));};exports[_0x12e3('0x3d')]=function(_0x27863b,_0xf0dc31){var _0x4d4844={'raw':!![],'where':{'id':_0x27863b[_0x12e3('0x3e')]['id']}},_0x380127={};_0x380127['model']=_[_0x12e3('0x2c')](db[_0x12e3('0x27')]['rawAttributes']);_0x380127[_0x12e3('0x2b')]=_[_0x12e3('0x2c')](_0x27863b[_0x12e3('0x2b')]);_0x380127[_0x12e3('0x3f')]=_[_0x12e3('0x2e')](_0x380127[_0x12e3('0x2a')],_0x380127[_0x12e3('0x2b')]);_0x4d4844['attributes']=_[_0x12e3('0x2e')](_0x380127[_0x12e3('0x2a')],qs[_0x12e3('0x30')](_0x27863b[_0x12e3('0x2b')][_0x12e3('0x30')]));_0x4d4844[_0x12e3('0x2f')]=_0x4d4844[_0x12e3('0x2f')][_0x12e3('0x31')]?_0x4d4844['attributes']:_0x380127['model'];if(_0x27863b[_0x12e3('0x2b')][_0x12e3('0x39')]){_0x4d4844['include']=[{'all':!![]}];}_0x4d4844=_[_0x12e3('0x38')]({},_0x4d4844,_0x27863b['options']);return db[_0x12e3('0x27')][_0x12e3('0x40')](_0x4d4844)[_0x12e3('0x20')](handleEntityNotFound(_0xf0dc31,null))[_0x12e3('0x20')](respondWithResult(_0xf0dc31,null))[_0x12e3('0x3c')](handleError(_0xf0dc31,null));};exports[_0x12e3('0x41')]=function(_0x506ebc,_0x4f9a5e){return db['CloudProvider'][_0x12e3('0x41')](_0x506ebc[_0x12e3('0x42')],{})['then'](respondWithResult(_0x4f9a5e,0xc9))['catch'](handleError(_0x4f9a5e,null));};exports[_0x12e3('0x1f')]=function(_0x5ceb50,_0x117af4){if(_0x5ceb50[_0x12e3('0x42')]['id']){delete _0x5ceb50[_0x12e3('0x42')]['id'];}return db[_0x12e3('0x27')][_0x12e3('0x40')]({'where':{'id':_0x5ceb50[_0x12e3('0x3e')]['id']}})[_0x12e3('0x20')](handleEntityNotFound(_0x117af4,null))['then'](saveUpdates(_0x5ceb50[_0x12e3('0x42')],null))[_0x12e3('0x20')](respondWithResult(_0x117af4,null))['catch'](handleError(_0x117af4,null));};exports['destroy']=function(_0x2a1133,_0x38e39b){return db[_0x12e3('0x27')]['find']({'where':{'id':_0x2a1133[_0x12e3('0x3e')]['id']}})[_0x12e3('0x20')](handleEntityNotFound(_0x38e39b,null))[_0x12e3('0x20')](removeEntity(_0x38e39b,null))['catch'](handleError(_0x38e39b,null));}; \ No newline at end of file +var _0x1ae3=['pick','filter','merge','options','includeAll','include','findAll','catch','params','filtears','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x3f14bb,_0x12998c){var _0x2e174b=function(_0x3281a3){while(--_0x3281a3){_0x3f14bb['push'](_0x3f14bb['shift']());}};_0x2e174b(++_0x12998c);}(_0x1ae3,0x139));var _0x31ae=function(_0x4fba79,_0x1a104e){_0x4fba79=_0x4fba79-0x0;var _0x1dadf4=_0x1ae3[_0x4fba79];return _0x1dadf4;};'use strict';var pdf=require(_0x31ae('0x0'));var emlformat=require(_0x31ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x31ae('0x2'));var jsonpatch=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var moment=require(_0x31ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31ae('0x6'));var util=require(_0x31ae('0x7'));var path=require(_0x31ae('0x8'));var sox=require(_0x31ae('0x9'));var csv=require(_0x31ae('0xa'));var ejs=require(_0x31ae('0xb'));var fs=require('fs');var _=require(_0x31ae('0xc'));var squel=require(_0x31ae('0xd'));var crypto=require(_0x31ae('0xe'));var jsforce=require(_0x31ae('0xf'));var deskjs=require(_0x31ae('0x10'));var toCsv=require(_0x31ae('0xa'));var querystring=require(_0x31ae('0x11'));var Papa=require(_0x31ae('0x12'));var Redis=require(_0x31ae('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x31ae('0x14'));var as=require(_0x31ae('0x15'));var hardwareService=require(_0x31ae('0x16'));var logger=require('../../config/logger')(_0x31ae('0x17'));var utils=require(_0x31ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x31ae('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff0f5,_0x2ea4b0){_0x2ea4b0=_0x2ea4b0||0xcc;return function(_0x2e75ef){if(_0x2e75ef){return _0x3ff0f5['sendStatus'](_0x2ea4b0);}return _0x3ff0f5[_0x31ae('0x1a')](_0x2ea4b0)[_0x31ae('0x1b')]();};}function respondWithResult(_0x201e43,_0x3ba04a){_0x3ba04a=_0x3ba04a||0xc8;return function(_0x2b1fc2){if(_0x2b1fc2){return _0x201e43[_0x31ae('0x1a')](_0x3ba04a)['json'](_0x2b1fc2);}};}function respondWithFilteredResult(_0x331134,_0x11abd4){return function(_0x1ec358){if(_0x1ec358){var _0x314849=_0x1ec358[_0x31ae('0x1c')],_0x1fc2cf=_0x11abd4['offset'],_0x2449ea=_0x11abd4[_0x31ae('0x1d')]+_0x11abd4['limit'],_0x25be89;if(_0x2449ea>=_0x314849){_0x2449ea=_0x314849;_0x25be89=0xc8;}else{_0x25be89=0xce;}_0x331134[_0x31ae('0x1a')](_0x25be89);return _0x331134[_0x31ae('0x1e')](_0x31ae('0x1f'),_0x1fc2cf+'-'+_0x2449ea+'/'+_0x314849)[_0x31ae('0x20')](_0x1ec358);}return null;};}function patchUpdates(_0x3e4d98){return function(_0x26699c){try{jsonpatch[_0x31ae('0x21')](_0x26699c,_0x3e4d98,!![]);}catch(_0x30b3fa){return BPromise[_0x31ae('0x22')](_0x30b3fa);}return _0x26699c[_0x31ae('0x23')]();};}function saveUpdates(_0x3917af,_0x1e4e63){return function(_0x588f72){if(_0x588f72){return _0x588f72[_0x31ae('0x24')](_0x3917af)[_0x31ae('0x25')](function(_0x12d494){return _0x12d494;});}return null;};}function removeEntity(_0x23d875,_0x5c60ef){return function(_0x2729b0){if(_0x2729b0){return _0x2729b0[_0x31ae('0x26')]()['then'](function(){_0x23d875[_0x31ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd24bd5,_0x56f9c4){return function(_0x59827a){if(!_0x59827a){_0xd24bd5[_0x31ae('0x27')](0x194);}return _0x59827a;};}function handleError(_0x24b720,_0x2a9bf6){_0x2a9bf6=_0x2a9bf6||0x1f4;return function(_0x4c86ba){logger['error'](_0x4c86ba['stack']);if(_0x4c86ba[_0x31ae('0x28')]){delete _0x4c86ba['name'];}_0x24b720[_0x31ae('0x1a')](_0x2a9bf6)[_0x31ae('0x29')](_0x4c86ba);};}exports[_0x31ae('0x2a')]=function(_0xb99935,_0x3bb96a){var _0x2e4222={},_0x225172={},_0x16ea63={'count':0x0,'rows':[]};var _0x54676f=_[_0x31ae('0x2b')](db[_0x31ae('0x2c')][_0x31ae('0x2d')],function(_0x2000aa){return{'name':_0x2000aa['fieldName'],'type':_0x2000aa[_0x31ae('0x2e')][_0x31ae('0x2f')]};});_0x225172[_0x31ae('0x30')]=_[_0x31ae('0x2b')](_0x54676f,_0x31ae('0x28'));_0x225172[_0x31ae('0x31')]=_[_0x31ae('0x32')](_0xb99935['query']);_0x225172['filters']=_[_0x31ae('0x33')](_0x225172['model'],_0x225172[_0x31ae('0x31')]);_0x2e4222[_0x31ae('0x34')]=_['intersection'](_0x225172[_0x31ae('0x30')],qs[_0x31ae('0x35')](_0xb99935[_0x31ae('0x31')][_0x31ae('0x35')]));_0x2e4222['attributes']=_0x2e4222[_0x31ae('0x34')][_0x31ae('0x36')]?_0x2e4222['attributes']:_0x225172['model'];if(!_0xb99935['query'][_0x31ae('0x37')](_0x31ae('0x38'))){_0x2e4222[_0x31ae('0x39')]=qs[_0x31ae('0x39')](_0xb99935[_0x31ae('0x31')]['limit']);_0x2e4222[_0x31ae('0x1d')]=qs[_0x31ae('0x1d')](_0xb99935[_0x31ae('0x31')][_0x31ae('0x1d')]);}_0x2e4222[_0x31ae('0x3a')]=qs[_0x31ae('0x3b')](_0xb99935[_0x31ae('0x31')][_0x31ae('0x3b')]);_0x2e4222[_0x31ae('0x3c')]=qs[_0x31ae('0x3d')](_[_0x31ae('0x3e')](_0xb99935[_0x31ae('0x31')],_0x225172['filters']),_0x54676f);if(_0xb99935[_0x31ae('0x31')][_0x31ae('0x3f')]){_0x2e4222['where']=_[_0x31ae('0x40')](_0x2e4222[_0x31ae('0x3c')],{'$or':_[_0x31ae('0x2b')](_0x54676f,function(_0x35cf5e){if(_0x35cf5e[_0x31ae('0x2e')]!=='VIRTUAL'){var _0x43b798={};_0x43b798[_0x35cf5e['name']]={'$like':'%'+_0xb99935['query'][_0x31ae('0x3f')]+'%'};return _0x43b798;}})});}_0x2e4222=_['merge']({},_0x2e4222,_0xb99935[_0x31ae('0x41')]);var _0x585c23={'where':_0x2e4222['where']};return db[_0x31ae('0x2c')][_0x31ae('0x1c')](_0x585c23)[_0x31ae('0x25')](function(_0x133b3c){_0x16ea63['count']=_0x133b3c;if(_0xb99935[_0x31ae('0x31')][_0x31ae('0x42')]){_0x2e4222[_0x31ae('0x43')]=[{'all':!![]}];}return db[_0x31ae('0x2c')][_0x31ae('0x44')](_0x2e4222);})[_0x31ae('0x25')](function(_0x4ddf26){_0x16ea63['rows']=_0x4ddf26;return _0x16ea63;})[_0x31ae('0x25')](respondWithFilteredResult(_0x3bb96a,_0x2e4222))[_0x31ae('0x45')](handleError(_0x3bb96a,null));};exports['show']=function(_0x25729f,_0x35d467){var _0x3f2713={'raw':!![],'where':{'id':_0x25729f[_0x31ae('0x46')]['id']}},_0x6df0f9={};_0x6df0f9[_0x31ae('0x30')]=_['keys'](db[_0x31ae('0x2c')][_0x31ae('0x2d')]);_0x6df0f9[_0x31ae('0x31')]=_['keys'](_0x25729f[_0x31ae('0x31')]);_0x6df0f9[_0x31ae('0x47')]=_['intersection'](_0x6df0f9[_0x31ae('0x30')],_0x6df0f9[_0x31ae('0x31')]);_0x3f2713[_0x31ae('0x34')]=_['intersection'](_0x6df0f9[_0x31ae('0x30')],qs[_0x31ae('0x35')](_0x25729f[_0x31ae('0x31')]['fields']));_0x3f2713[_0x31ae('0x34')]=_0x3f2713[_0x31ae('0x34')][_0x31ae('0x36')]?_0x3f2713['attributes']:_0x6df0f9[_0x31ae('0x30')];if(_0x25729f[_0x31ae('0x31')]['includeAll']){_0x3f2713[_0x31ae('0x43')]=[{'all':!![]}];}_0x3f2713=_[_0x31ae('0x40')]({},_0x3f2713,_0x25729f[_0x31ae('0x41')]);return db[_0x31ae('0x2c')][_0x31ae('0x48')](_0x3f2713)[_0x31ae('0x25')](handleEntityNotFound(_0x35d467,null))[_0x31ae('0x25')](respondWithResult(_0x35d467,null))[_0x31ae('0x45')](handleError(_0x35d467,null));};exports[_0x31ae('0x49')]=function(_0x30f7f6,_0x3eba5d){return db['CloudProvider'][_0x31ae('0x49')](_0x30f7f6['body'],{})[_0x31ae('0x25')](respondWithResult(_0x3eba5d,0xc9))[_0x31ae('0x45')](handleError(_0x3eba5d,null));};exports[_0x31ae('0x24')]=function(_0x23ebcb,_0x381f2a){if(_0x23ebcb[_0x31ae('0x4a')]['id']){delete _0x23ebcb[_0x31ae('0x4a')]['id'];}return db[_0x31ae('0x2c')][_0x31ae('0x48')]({'where':{'id':_0x23ebcb[_0x31ae('0x46')]['id']}})[_0x31ae('0x25')](handleEntityNotFound(_0x381f2a,null))[_0x31ae('0x25')](saveUpdates(_0x23ebcb['body'],null))[_0x31ae('0x25')](respondWithResult(_0x381f2a,null))[_0x31ae('0x45')](handleError(_0x381f2a,null));};exports[_0x31ae('0x26')]=function(_0x755612,_0x41dd33){return db[_0x31ae('0x2c')][_0x31ae('0x48')]({'where':{'id':_0x755612[_0x31ae('0x46')]['id']}})[_0x31ae('0x25')](handleEntityNotFound(_0x41dd33,null))[_0x31ae('0x25')](removeEntity(_0x41dd33,null))['catch'](handleError(_0x41dd33,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 80787cc..7bb5cb1 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 _0x5092=['define','CloudProvider','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x5092,0x1d0));var _0x2509=function(_0x2d449e,_0xa65c73){_0x2d449e=_0x2d449e-0x0;var _0x700dc3=_0x5092[_0x2d449e];return _0x700dc3;};'use strict';var _=require('lodash');var util=require(_0x2509('0x0'));var logger=require(_0x2509('0x1'))(_0x2509('0x2'));var moment=require(_0x2509('0x3'));var BPromise=require('bluebird');var rp=require(_0x2509('0x4'));var fs=require('fs');var path=require(_0x2509('0x5'));var rimraf=require(_0x2509('0x6'));var config=require(_0x2509('0x7'));var attributes=require(_0x2509('0x8'));module['exports']=function(_0x58f782,_0x37ca36){return _0x58f782[_0x2509('0x9')](_0x2509('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dcc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash'];(function(_0x422d6a,_0x20d24f){var _0x3bff4b=function(_0x3789a8){while(--_0x3789a8){_0x422d6a['push'](_0x422d6a['shift']());}};_0x3bff4b(++_0x20d24f);}(_0x7dcc,0xfb));var _0xc7dc=function(_0x1b596f,_0x1d0814){_0x1b596f=_0x1b596f-0x0;var _0x48c840=_0x7dcc[_0x1b596f];return _0x48c840;};'use strict';var _=require(_0xc7dc('0x0'));var util=require(_0xc7dc('0x1'));var logger=require(_0xc7dc('0x2'))(_0xc7dc('0x3'));var moment=require(_0xc7dc('0x4'));var BPromise=require(_0xc7dc('0x5'));var rp=require(_0xc7dc('0x6'));var fs=require('fs');var path=require(_0xc7dc('0x7'));var rimraf=require(_0xc7dc('0x8'));var config=require('../../config/environment');var attributes=require(_0xc7dc('0x9'));module[_0xc7dc('0xa')]=function(_0x581eb2,_0x50c1bd){return _0x581eb2[_0xc7dc('0xb')](_0xc7dc('0xc'),attributes,{'tableName':_0xc7dc('0xd'),'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 9fbf47a..015427d 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 _0x3966=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment'];(function(_0x4317c7,_0x593fab){var _0x44c402=function(_0x82bd19){while(--_0x82bd19){_0x4317c7['push'](_0x4317c7['shift']());}};_0x44c402(++_0x593fab);}(_0x3966,0x157));var _0x6396=function(_0x4188c2,_0x2e7ad7){_0x4188c2=_0x4188c2-0x0;var _0x485d9d=_0x3966[_0x4188c2];return _0x485d9d;};'use strict';var _=require('lodash');var util=require(_0x6396('0x0'));var moment=require(_0x6396('0x1'));var BPromise=require(_0x6396('0x2'));var rs=require(_0x6396('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6396('0x4'))['db'];var utils=require(_0x6396('0x5'));var logger=require(_0x6396('0x6'))('rpc');var config=require(_0x6396('0x7'));var jayson=require(_0x6396('0x8'));var client=jayson[_0x6396('0x9')][_0x6396('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ac8b,_0x4494c5,_0x3d3a8f){return new BPromise(function(_0x96d7ab,_0x18f433){return client[_0x6396('0xb')](_0x28ac8b,_0x3d3a8f)[_0x6396('0xc')](function(_0x20c9c0){logger[_0x6396('0xd')](_0x6396('0xe'),_0x4494c5,_0x6396('0xf'));logger[_0x6396('0x10')](_0x6396('0x11'),_0x4494c5,_0x6396('0xf'),JSON[_0x6396('0x12')](_0x20c9c0));if(_0x20c9c0['error']){if(_0x20c9c0[_0x6396('0x13')][_0x6396('0x14')]===0x1f4){logger[_0x6396('0x13')]('CloudProvider,\x20%s,\x20%s',_0x4494c5,_0x20c9c0[_0x6396('0x13')]['message']);return _0x18f433(_0x20c9c0[_0x6396('0x13')][_0x6396('0x15')]);}logger[_0x6396('0x13')](_0x6396('0xe'),_0x4494c5,_0x20c9c0[_0x6396('0x13')]['message']);return _0x96d7ab(_0x20c9c0[_0x6396('0x13')][_0x6396('0x15')]);}else{logger[_0x6396('0xd')](_0x6396('0xe'),_0x4494c5,_0x6396('0xf'));_0x96d7ab(_0x20c9c0['result'][_0x6396('0x15')]);}})[_0x6396('0x16')](function(_0x4fb827){logger[_0x6396('0x13')](_0x6396('0xe'),_0x4494c5,_0x4fb827);_0x18f433(_0x4fb827);});});} \ No newline at end of file +var _0xfb6a=['../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4be8f2,_0x5c4e32){var _0x2fdd10=function(_0x5e0f4b){while(--_0x5e0f4b){_0x4be8f2['push'](_0x4be8f2['shift']());}};_0x2fdd10(++_0x5c4e32);}(_0xfb6a,0x14a));var _0xafb6=function(_0x4864ea,_0x7764ed){_0x4864ea=_0x4864ea-0x0;var _0x12e74f=_0xfb6a[_0x4864ea];return _0x12e74f;};'use strict';var _=require('lodash');var util=require(_0xafb6('0x0'));var moment=require(_0xafb6('0x1'));var BPromise=require(_0xafb6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafb6('0x3'));var db=require(_0xafb6('0x4'))['db'];var utils=require(_0xafb6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xafb6('0x6'));var jayson=require(_0xafb6('0x7'));var client=jayson[_0xafb6('0x8')][_0xafb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ddf9,_0x336419,_0x2de8a0){return new BPromise(function(_0x59d7b2,_0xdb751e){return client['request'](_0x20ddf9,_0x2de8a0)[_0xafb6('0xa')](function(_0x25c516){logger[_0xafb6('0xb')](_0xafb6('0xc'),_0x336419,_0xafb6('0xd'));logger[_0xafb6('0xe')](_0xafb6('0xf'),_0x336419,'request\x20sent',JSON[_0xafb6('0x10')](_0x25c516));if(_0x25c516['error']){if(_0x25c516[_0xafb6('0x11')][_0xafb6('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x336419,_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);return _0xdb751e(_0x25c516['error'][_0xafb6('0x13')]);}logger[_0xafb6('0x11')](_0xafb6('0xc'),_0x336419,_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);return _0x59d7b2(_0x25c516[_0xafb6('0x11')][_0xafb6('0x13')]);}else{logger[_0xafb6('0xb')](_0xafb6('0xc'),_0x336419,_0xafb6('0xd'));_0x59d7b2(_0x25c516[_0xafb6('0x14')][_0xafb6('0x13')]);}})['catch'](function(_0x43020e){logger[_0xafb6('0x11')](_0xafb6('0xc'),_0x336419,_0x43020e);_0xdb751e(_0x43020e);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 2f745fd..cafe341 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 _0x968c=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x46c5f9,_0x3b7494){var _0x1f490c=function(_0x4997c5){while(--_0x4997c5){_0x46c5f9['push'](_0x46c5f9['shift']());}};_0x1f490c(++_0x3b7494);}(_0x968c,0x1a4));var _0xc968=function(_0x11c6e7,_0x7cc56b){_0x11c6e7=_0x11c6e7-0x0;var _0x2b057b=_0x968c[_0x11c6e7];return _0x2b057b;};'use strict';var multer=require(_0xc968('0x0'));var util=require(_0xc968('0x1'));var path=require(_0xc968('0x2'));var timeout=require('connect-timeout');var express=require(_0xc968('0x3'));var router=express['Router']();var auth=require(_0xc968('0x4'));var interaction=require(_0xc968('0x5'));var config=require(_0xc968('0x6'));var controller=require('./cloudProvider.controller');router[_0xc968('0x7')]('/',auth[_0xc968('0x8')](),controller[_0xc968('0x9')]);router[_0xc968('0x7')](_0xc968('0xa'),auth['isAuthenticated'](),controller[_0xc968('0xb')]);router[_0xc968('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc968('0xa'),auth[_0xc968('0x8')](),controller[_0xc968('0xd')]);router[_0xc968('0xe')](_0xc968('0xa'),auth['isAuthenticated'](),controller[_0xc968('0xf')]);module[_0xc968('0x10')]=router; \ No newline at end of file +var _0xc671=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','index','isAuthenticated','post','create','put','/:id'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0xc671,0x87));var _0x1c67=function(_0x568af7,_0x550ea5){_0x568af7=_0x568af7-0x0;var _0x36af26=_0xc671[_0x568af7];return _0x36af26;};'use strict';var multer=require(_0x1c67('0x0'));var util=require(_0x1c67('0x1'));var path=require(_0x1c67('0x2'));var timeout=require(_0x1c67('0x3'));var express=require(_0x1c67('0x4'));var router=express[_0x1c67('0x5')]();var auth=require(_0x1c67('0x6'));var interaction=require(_0x1c67('0x7'));var config=require(_0x1c67('0x8'));var controller=require(_0x1c67('0x9'));router[_0x1c67('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c67('0xb')]);router[_0x1c67('0xa')]('/:id',auth[_0x1c67('0xc')](),controller['show']);router[_0x1c67('0xd')]('/',auth[_0x1c67('0xc')](),controller[_0x1c67('0xe')]);router[_0x1c67('0xf')](_0x1c67('0x10'),auth[_0x1c67('0xc')](),controller[_0x1c67('0x11')]);router['delete'](_0x1c67('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x1c67('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 5dd5cdc..06af7f2 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 _0xbaef=['STRING','name','sequelize','exports'];(function(_0x3d2555,_0x6e443e){var _0x597430=function(_0x554ed4){while(--_0x554ed4){_0x3d2555['push'](_0x3d2555['shift']());}};_0x597430(++_0x6e443e);}(_0xbaef,0x17e));var _0xfbae=function(_0xfdd6b6,_0x19497a){_0xfdd6b6=_0xfdd6b6-0x0;var _0x464439=_0xbaef[_0xfdd6b6];return _0x464439;};'use strict';var Sequelize=require(_0xfbae('0x0'));module[_0xfbae('0x1')]={'name':{'type':Sequelize[_0xfbae('0x2')],'unique':_0xfbae('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xfbae('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xfbae('0x2')]},'phone':{'type':Sequelize[_0xfbae('0x2')]},'fax':{'type':Sequelize[_0xfbae('0x2')]},'type':{'type':Sequelize[_0xfbae('0x2')]},'street':{'type':Sequelize[_0xfbae('0x2')]},'postalCode':{'type':Sequelize[_0xfbae('0x2')]},'city':{'type':Sequelize[_0xfbae('0x2')]},'country':{'type':Sequelize[_0xfbae('0x2')]},'email':{'type':Sequelize[_0xfbae('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xfbae('0x2')]},'sStreet':{'type':Sequelize[_0xfbae('0x2')]},'sPostalCode':{'type':Sequelize[_0xfbae('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xfbae('0x2')]},'description':{'type':Sequelize[_0xfbae('0x2')]}}; \ No newline at end of file +var _0x2652=['exports','name','STRING'];(function(_0x2834c7,_0xf21164){var _0x5538b1=function(_0x58b277){while(--_0x58b277){_0x2834c7['push'](_0x2834c7['shift']());}};_0x5538b1(++_0xf21164);}(_0x2652,0x87));var _0x2265=function(_0x4b8921,_0x16e1c7){_0x4b8921=_0x4b8921-0x0;var _0x6e01af=_0x2652[_0x4b8921];return _0x6e01af;};'use strict';var Sequelize=require('sequelize');module[_0x2265('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2265('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x2265('0x2')]},'website':{'type':Sequelize[_0x2265('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x2265('0x2')]},'type':{'type':Sequelize[_0x2265('0x2')]},'street':{'type':Sequelize[_0x2265('0x2')]},'postalCode':{'type':Sequelize[_0x2265('0x2')]},'city':{'type':Sequelize[_0x2265('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x2265('0x2')]},'sStreet':{'type':Sequelize[_0x2265('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x2265('0x2')]},'description':{'type':Sequelize[_0x2265('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 641a80a..1467030 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 _0xa9e0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','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','addContacts','CmContact','ids','omit','getContacts','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x22')](function(_0x2ec755){_0x14de77['model']=_[_0x0a9e('0x2b')](_0x2ec755);_0x14de77[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x140511[_0x0a9e('0x2c')]);_0x14de77[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x14de77[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x2c')]);_0x11c3b6[_0x0a9e('0x30')]=_['intersection'](_0x14de77[_0x0a9e('0x2f')],qs['fields'](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x11c3b6[_0x0a9e('0x30')]=_0x11c3b6[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x11c3b6['attributes']:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x11c3b6[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x11c3b6['offset']=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x140511[_0x0a9e('0x2c')]['sort']);_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x2d')](_[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x2c')],_0x14de77['filters']),_0x2ec755);if(_0x140511['query'][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x30')],function(_0x4f41ae){var _0x31916f={};_0x31916f[_0x4f41ae]={'$like':'%'+_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x39')]+'%'};return _0x31916f;})});}_0x11c3b6=_['merge']({},_0x11c3b6,_0x140511[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x11c3b6[_0x0a9e('0x37')]};return db['CmCompany']['count'](_0x1a180b)[_0x0a9e('0x22')](function(_0x40d766){_0x5a101a['count']=_0x40d766;if(_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x11c3b6[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x11c3b6);})['then'](function(_0x15e37d){_0x5a101a[_0x0a9e('0x3f')]=_0x15e37d;return _0x5a101a;})['then'](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));})[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0x5b4f5e,_0x316c8f){var _0x2cfea9={'raw':![],'where':{'id':_0x5b4f5e[_0x0a9e('0x42')]['id']}},_0x274e8e={};_0x274e8e[_0x0a9e('0x2f')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0x29')][_0x0a9e('0x43')]);_0x274e8e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x5b4f5e[_0x0a9e('0x2c')]);_0x274e8e[_0x0a9e('0x44')]=_[_0x0a9e('0x2e')](_0x274e8e[_0x0a9e('0x2f')],_0x274e8e[_0x0a9e('0x2c')]);_0x2cfea9['attributes']=_['intersection'](_0x274e8e[_0x0a9e('0x2f')],qs[_0x0a9e('0x31')](_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x2cfea9[_0x0a9e('0x30')]=_0x2cfea9[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2cfea9[_0x0a9e('0x30')]:_0x274e8e[_0x0a9e('0x2f')];if(_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x2cfea9[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x2cfea9=_['merge']({},_0x2cfea9,_0x5b4f5e[_0x0a9e('0x3c')]);return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x2cfea9)[_0x0a9e('0x22')](handleEntityNotFound(_0x316c8f,null))[_0x0a9e('0x22')](respondWithResult(_0x316c8f,null))[_0x0a9e('0x40')](handleError(_0x316c8f,null));};exports[_0x0a9e('0x46')]=function(_0x44dd99,_0x59afe8){return db[_0x0a9e('0x29')]['create'](_0x44dd99[_0x0a9e('0x47')],{})[_0x0a9e('0x22')](function(_0x8d6dd1){var _0x562fb4=_0x44dd99[_0x0a9e('0x48')][_0x0a9e('0x49')]({'plain':!![]});if(!_0x562fb4)throw new Error(_0x0a9e('0x4a'));if(_0x562fb4[_0x0a9e('0x4b')]===_0x0a9e('0x48')){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]({'plain':!![]});var _0x5bbcde=_0x0a9e('0x23');return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'where':{'name':_0x5bbcde,'userProfileId':_0x562fb4[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x992c77){if(_0x992c77&&_0x992c77[_0x0a9e('0x4e')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x46')]({'name':_0x37be73['name'],'resourceId':_0x37be73['id'],'type':_0x992c77[_0x0a9e('0x26')],'sectionId':_0x992c77['id']},{})[_0x0a9e('0x22')](function(){return _0x8d6dd1;});}else{return _0x8d6dd1;}})['catch'](function(_0x4ae14b){logger['error'](_0x0a9e('0x4f'),_0x4ae14b);throw _0x4ae14b;});}return _0x8d6dd1;})[_0x0a9e('0x22')](respondWithResult(_0x59afe8,0xc9))[_0x0a9e('0x40')](handleError(_0x59afe8,null));};exports[_0x0a9e('0x20')]=function(_0x61bb17,_0x30decb){if(_0x61bb17[_0x0a9e('0x47')]['id']){delete _0x61bb17[_0x0a9e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x61bb17['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))[_0x0a9e('0x22')](saveUpdates(_0x61bb17[_0x0a9e('0x47')],null))['then'](respondWithResult(_0x30decb,null))[_0x0a9e('0x40')](handleError(_0x30decb,null));};exports[_0x0a9e('0x21')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x29')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x22')](removeEntity(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x2a')]=function(_0x53613a,_0x2f82da){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2f82da,null))[_0x0a9e('0x40')](handleError(_0x2f82da,null));};exports[_0x0a9e('0x50')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x51')]['find']({'where':{'id':_0x49c095[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(_0x5df0ad){return _0x5df0ad[_0x0a9e('0x50')](_0x49c095['body'][_0x0a9e('0x52')],_[_0x0a9e('0x53')](_0x49c095[_0x0a9e('0x47')],[_0x0a9e('0x52'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x145931,null))[_0x0a9e('0x40')](handleError(_0x145931,null));};exports[_0x0a9e('0x54')]=function(_0x28d814,_0x4e67ab,_0x1c693e){var _0x121cef={};var _0x2642bb={};var _0x30c491;var _0xb83dfd;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x28d814[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4e67ab,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x30c491=_0x3649cc;_0x2642bb['model']=_[_0x0a9e('0x2b')](db['CmContact']['rawAttributes']);_0x2642bb['query']=_[_0x0a9e('0x2b')](_0x28d814['query']);_0x2642bb[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x2642bb[_0x0a9e('0x2f')],_0x2642bb[_0x0a9e('0x2c')]);_0x121cef[_0x0a9e('0x30')]=_[_0x0a9e('0x2e')](_0x2642bb['model'],qs[_0x0a9e('0x31')](_0x28d814['query'][_0x0a9e('0x31')]));_0x121cef[_0x0a9e('0x30')]=_0x121cef[_0x0a9e('0x30')]['length']?_0x121cef[_0x0a9e('0x30')]:_0x2642bb[_0x0a9e('0x2f')];_0x121cef[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x28d814['query'][_0x0a9e('0x36')]);_0x121cef[_0x0a9e('0x37')]=qs['filters'](_[_0x0a9e('0x38')](_0x28d814[_0x0a9e('0x2c')],_0x2642bb[_0x0a9e('0x2d')]));if(_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x121cef['where']=_[_0x0a9e('0x3a')](_0x121cef[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x121cef['attributes'],function(_0x3528b7){var _0x4f1e60={};_0x4f1e60[_0x3528b7]={'$like':'%'+_0x28d814['query'][_0x0a9e('0x39')]+'%'};return _0x4f1e60;})});}_0x121cef=_[_0x0a9e('0x3a')]({},_0x121cef,_0x28d814[_0x0a9e('0x3c')]);return _0x30c491[_0x0a9e('0x54')](_0x121cef);}})[_0x0a9e('0x22')](function(_0xc8c264){if(_0xc8c264){_0xb83dfd=_0xc8c264[_0x0a9e('0x32')];if(!_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x121cef[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x121cef[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x19')]);}return _0x30c491['getContacts'](_0x121cef);}})[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){return _0x295763?{'count':_0xb83dfd,'rows':_0x295763}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));}; \ No newline at end of file +var _0xa9e0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','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','addContacts','CmContact','ids','omit','getContacts','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','Companies','UserProfileResource','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]()[_0x0a9e('0x22')](function(_0x2ec755){_0x14de77['model']=_[_0x0a9e('0x2b')](_0x2ec755);_0x14de77[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x140511[_0x0a9e('0x2c')]);_0x14de77[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x14de77[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x2c')]);_0x11c3b6[_0x0a9e('0x30')]=_['intersection'](_0x14de77[_0x0a9e('0x2f')],qs['fields'](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x11c3b6[_0x0a9e('0x30')]=_0x11c3b6[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x11c3b6['attributes']:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x11c3b6[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x11c3b6['offset']=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x140511[_0x0a9e('0x2c')]['sort']);_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x2d')](_[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x2c')],_0x14de77['filters']),_0x2ec755);if(_0x140511['query'][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x30')],function(_0x4f41ae){var _0x31916f={};_0x31916f[_0x4f41ae]={'$like':'%'+_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x39')]+'%'};return _0x31916f;})});}_0x11c3b6=_['merge']({},_0x11c3b6,_0x140511[_0x0a9e('0x3c')]);var _0x1a180b={'where':_0x11c3b6[_0x0a9e('0x37')]};return db['CmCompany']['count'](_0x1a180b)[_0x0a9e('0x22')](function(_0x40d766){_0x5a101a['count']=_0x40d766;if(_0x140511[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x11c3b6[_0x0a9e('0x3e')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x11c3b6);})['then'](function(_0x15e37d){_0x5a101a[_0x0a9e('0x3f')]=_0x15e37d;return _0x5a101a;})['then'](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));})[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0x5b4f5e,_0x316c8f){var _0x2cfea9={'raw':![],'where':{'id':_0x5b4f5e[_0x0a9e('0x42')]['id']}},_0x274e8e={};_0x274e8e[_0x0a9e('0x2f')]=_[_0x0a9e('0x2b')](db[_0x0a9e('0x29')][_0x0a9e('0x43')]);_0x274e8e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2b')](_0x5b4f5e[_0x0a9e('0x2c')]);_0x274e8e[_0x0a9e('0x44')]=_[_0x0a9e('0x2e')](_0x274e8e[_0x0a9e('0x2f')],_0x274e8e[_0x0a9e('0x2c')]);_0x2cfea9['attributes']=_['intersection'](_0x274e8e[_0x0a9e('0x2f')],qs[_0x0a9e('0x31')](_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x31')]));_0x2cfea9[_0x0a9e('0x30')]=_0x2cfea9[_0x0a9e('0x30')][_0x0a9e('0x32')]?_0x2cfea9[_0x0a9e('0x30')]:_0x274e8e[_0x0a9e('0x2f')];if(_0x5b4f5e[_0x0a9e('0x2c')][_0x0a9e('0x3d')]){_0x2cfea9[_0x0a9e('0x3e')]=[{'all':!![]}];}_0x2cfea9=_['merge']({},_0x2cfea9,_0x5b4f5e[_0x0a9e('0x3c')]);return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x2cfea9)[_0x0a9e('0x22')](handleEntityNotFound(_0x316c8f,null))[_0x0a9e('0x22')](respondWithResult(_0x316c8f,null))[_0x0a9e('0x40')](handleError(_0x316c8f,null));};exports[_0x0a9e('0x46')]=function(_0x44dd99,_0x59afe8){return db[_0x0a9e('0x29')]['create'](_0x44dd99[_0x0a9e('0x47')],{})[_0x0a9e('0x22')](function(_0x8d6dd1){var _0x562fb4=_0x44dd99[_0x0a9e('0x48')][_0x0a9e('0x49')]({'plain':!![]});if(!_0x562fb4)throw new Error(_0x0a9e('0x4a'));if(_0x562fb4[_0x0a9e('0x4b')]===_0x0a9e('0x48')){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]({'plain':!![]});var _0x5bbcde=_0x0a9e('0x23');return db[_0x0a9e('0x4c')][_0x0a9e('0x45')]({'where':{'name':_0x5bbcde,'userProfileId':_0x562fb4[_0x0a9e('0x4d')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x992c77){if(_0x992c77&&_0x992c77[_0x0a9e('0x4e')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x46')]({'name':_0x37be73['name'],'resourceId':_0x37be73['id'],'type':_0x992c77[_0x0a9e('0x26')],'sectionId':_0x992c77['id']},{})[_0x0a9e('0x22')](function(){return _0x8d6dd1;});}else{return _0x8d6dd1;}})['catch'](function(_0x4ae14b){logger['error'](_0x0a9e('0x4f'),_0x4ae14b);throw _0x4ae14b;});}return _0x8d6dd1;})[_0x0a9e('0x22')](respondWithResult(_0x59afe8,0xc9))[_0x0a9e('0x40')](handleError(_0x59afe8,null));};exports[_0x0a9e('0x20')]=function(_0x61bb17,_0x30decb){if(_0x61bb17[_0x0a9e('0x47')]['id']){delete _0x61bb17[_0x0a9e('0x47')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x61bb17['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))[_0x0a9e('0x22')](saveUpdates(_0x61bb17[_0x0a9e('0x47')],null))['then'](respondWithResult(_0x30decb,null))[_0x0a9e('0x40')](handleError(_0x30decb,null));};exports[_0x0a9e('0x21')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x29')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x22')](removeEntity(_0x5a88da,null))[_0x0a9e('0x40')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x2a')]=function(_0x53613a,_0x2f82da){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2f82da,null))[_0x0a9e('0x40')](handleError(_0x2f82da,null));};exports[_0x0a9e('0x50')]=function(_0x49c095,_0x145931,_0x5ce9ac){return db[_0x0a9e('0x51')]['find']({'where':{'id':_0x49c095[_0x0a9e('0x42')]['id']}})['then'](handleEntityNotFound(_0x145931,null))['then'](function(_0x5df0ad){if(_0x5df0ad){return _0x5df0ad[_0x0a9e('0x50')](_0x49c095['body'][_0x0a9e('0x52')],_[_0x0a9e('0x53')](_0x49c095[_0x0a9e('0x47')],[_0x0a9e('0x52'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x145931,null))[_0x0a9e('0x40')](handleError(_0x145931,null));};exports[_0x0a9e('0x54')]=function(_0x28d814,_0x4e67ab,_0x1c693e){var _0x121cef={};var _0x2642bb={};var _0x30c491;var _0xb83dfd;return db[_0x0a9e('0x29')]['findOne']({'where':{'id':_0x28d814[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4e67ab,null))['then'](function(_0x3649cc){if(_0x3649cc){_0x30c491=_0x3649cc;_0x2642bb['model']=_[_0x0a9e('0x2b')](db['CmContact']['rawAttributes']);_0x2642bb['query']=_[_0x0a9e('0x2b')](_0x28d814['query']);_0x2642bb[_0x0a9e('0x2d')]=_[_0x0a9e('0x2e')](_0x2642bb[_0x0a9e('0x2f')],_0x2642bb[_0x0a9e('0x2c')]);_0x121cef[_0x0a9e('0x30')]=_[_0x0a9e('0x2e')](_0x2642bb['model'],qs[_0x0a9e('0x31')](_0x28d814['query'][_0x0a9e('0x31')]));_0x121cef[_0x0a9e('0x30')]=_0x121cef[_0x0a9e('0x30')]['length']?_0x121cef[_0x0a9e('0x30')]:_0x2642bb[_0x0a9e('0x2f')];_0x121cef[_0x0a9e('0x35')]=qs[_0x0a9e('0x36')](_0x28d814['query'][_0x0a9e('0x36')]);_0x121cef[_0x0a9e('0x37')]=qs['filters'](_[_0x0a9e('0x38')](_0x28d814[_0x0a9e('0x2c')],_0x2642bb[_0x0a9e('0x2d')]));if(_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x121cef['where']=_[_0x0a9e('0x3a')](_0x121cef[_0x0a9e('0x37')],{'$or':_[_0x0a9e('0x3b')](_0x121cef['attributes'],function(_0x3528b7){var _0x4f1e60={};_0x4f1e60[_0x3528b7]={'$like':'%'+_0x28d814['query'][_0x0a9e('0x39')]+'%'};return _0x4f1e60;})});}_0x121cef=_[_0x0a9e('0x3a')]({},_0x121cef,_0x28d814[_0x0a9e('0x3c')]);return _0x30c491[_0x0a9e('0x54')](_0x121cef);}})[_0x0a9e('0x22')](function(_0xc8c264){if(_0xc8c264){_0xb83dfd=_0xc8c264[_0x0a9e('0x32')];if(!_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x33')](_0x0a9e('0x34'))){_0x121cef[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x1a')]);_0x121cef[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x28d814[_0x0a9e('0x2c')][_0x0a9e('0x19')]);}return _0x30c491['getContacts'](_0x121cef);}})[_0x0a9e('0x22')](function(_0x295763){if(_0x295763){return _0x295763?{'count':_0xb83dfd,'rows':_0x295763}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x4e67ab,null))['catch'](handleError(_0x4e67ab,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 73c1077..6fb1703 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 _0x19da=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmCompany','cm_companies','util'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0x19da,0x9f));var _0xa19d=function(_0x354164,_0x4c30de){_0x354164=_0x354164-0x0;var _0x5db9a8=_0x19da[_0x354164];return _0x5db9a8;};'use strict';var _=require('lodash');var util=require(_0xa19d('0x0'));var logger=require('../../config/logger')(_0xa19d('0x1'));var moment=require('moment');var BPromise=require(_0xa19d('0x2'));var rp=require(_0xa19d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa19d('0x4'));var config=require(_0xa19d('0x5'));var attributes=require('./cmCompany.attributes');module[_0xa19d('0x6')]=function(_0x330adb,_0x1f6e10){return _0x330adb[_0xa19d('0x7')](_0xa19d('0x8'),attributes,{'tableName':_0xa19d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbeea=['cm_companies','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany'];(function(_0x237d2a,_0x14cb73){var _0x1bbf7d=function(_0x114ec3){while(--_0x114ec3){_0x237d2a['push'](_0x237d2a['shift']());}};_0x1bbf7d(++_0x14cb73);}(_0xbeea,0xb1));var _0xabee=function(_0x3433c1,_0x5a7870){_0x3433c1=_0x3433c1-0x0;var _0x4448a1=_0xbeea[_0x3433c1];return _0x4448a1;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var logger=require(_0xabee('0x1'))(_0xabee('0x2'));var moment=require(_0xabee('0x3'));var BPromise=require('bluebird');var rp=require(_0xabee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var attributes=require(_0xabee('0x7'));module[_0xabee('0x8')]=function(_0x1ea258,_0x58c9ef){return _0x1ea258['define'](_0xabee('0x9'),attributes,{'tableName':_0xabee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 03e2f14..ebd561c 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 _0xd6d2=['request','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x453bae,_0x35c9c9){var _0x1ceb94=function(_0xa1f5c9){while(--_0xa1f5c9){_0x453bae['push'](_0x453bae['shift']());}};_0x1ceb94(++_0x35c9c9);}(_0xd6d2,0x120));var _0x2d6d=function(_0x162f9e,_0x1548c5){_0x162f9e=_0x162f9e-0x0;var _0x2bb009=_0xd6d2[_0x162f9e];return _0x2bb009;};'use strict';var _=require(_0x2d6d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2d6d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d6d('0x2'));var db=require(_0x2d6d('0x3'))['db'];var utils=require(_0x2d6d('0x4'));var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require(_0x2d6d('0x8'));var client=jayson[_0x2d6d('0x9')][_0x2d6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c4e4a,_0x36add4,_0x5393e8){return new BPromise(function(_0x2a62aa,_0x4ffb25){return client[_0x2d6d('0xb')](_0x2c4e4a,_0x5393e8)['then'](function(_0x13289a){logger[_0x2d6d('0xc')]('CmCompany,\x20%s,\x20%s',_0x36add4,_0x2d6d('0xd'));logger[_0x2d6d('0xe')](_0x2d6d('0xf'),_0x36add4,_0x2d6d('0xd'),JSON[_0x2d6d('0x10')](_0x13289a));if(_0x13289a[_0x2d6d('0x11')]){if(_0x13289a['error'][_0x2d6d('0x12')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x36add4,_0x13289a[_0x2d6d('0x11')][_0x2d6d('0x13')]);return _0x4ffb25(_0x13289a['error'][_0x2d6d('0x13')]);}logger['error'](_0x2d6d('0x14'),_0x36add4,_0x13289a[_0x2d6d('0x11')]['message']);return _0x2a62aa(_0x13289a[_0x2d6d('0x11')][_0x2d6d('0x13')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x36add4,_0x2d6d('0xd'));_0x2a62aa(_0x13289a[_0x2d6d('0x15')]['message']);}})[_0x2d6d('0x16')](function(_0x146e36){logger[_0x2d6d('0x11')](_0x2d6d('0x14'),_0x36add4,_0x146e36);_0x4ffb25(_0x146e36);});});} \ No newline at end of file +var _0x8d67=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x41afb5,_0x20ddb8){var _0x534d40=function(_0x4e4aed){while(--_0x4e4aed){_0x41afb5['push'](_0x41afb5['shift']());}};_0x534d40(++_0x20ddb8);}(_0x8d67,0x7f));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x78d6('0x0'));var util=require(_0x78d6('0x1'));var moment=require(_0x78d6('0x2'));var BPromise=require(_0x78d6('0x3'));var rs=require(_0x78d6('0x4'));var fs=require('fs');var Redis=require(_0x78d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x78d6('0x6'));var logger=require(_0x78d6('0x7'))('rpc');var config=require(_0x78d6('0x8'));var jayson=require(_0x78d6('0x9'));var client=jayson[_0x78d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x530f11,_0x4f5139,_0x12ca7d){return new BPromise(function(_0xdf0166,_0x15994f){return client[_0x78d6('0xb')](_0x530f11,_0x12ca7d)['then'](function(_0xd11c78){logger['info']('CmCompany,\x20%s,\x20%s',_0x4f5139,_0x78d6('0xc'));logger[_0x78d6('0xd')](_0x78d6('0xe'),_0x4f5139,'request\x20sent',JSON[_0x78d6('0xf')](_0xd11c78));if(_0xd11c78[_0x78d6('0x10')]){if(_0xd11c78[_0x78d6('0x10')][_0x78d6('0x11')]===0x1f4){logger['error'](_0x78d6('0x12'),_0x4f5139,_0xd11c78['error']['message']);return _0x15994f(_0xd11c78[_0x78d6('0x10')][_0x78d6('0x13')]);}logger[_0x78d6('0x10')](_0x78d6('0x12'),_0x4f5139,_0xd11c78['error']['message']);return _0xdf0166(_0xd11c78[_0x78d6('0x10')][_0x78d6('0x13')]);}else{logger[_0x78d6('0x14')](_0x78d6('0x12'),_0x4f5139,'request\x20sent');_0xdf0166(_0xd11c78[_0x78d6('0x15')][_0x78d6('0x13')]);}})['catch'](function(_0x2e46bb){logger[_0x78d6('0x10')](_0x78d6('0x12'),_0x4f5139,_0x2e46bb);_0x15994f(_0x2e46bb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 6d145e9..a935f69 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 _0xfb11=['show','/:id/contacts','getContacts','post','addContacts','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./cmCompany.controller','get','index','isAuthenticated','describe','/:id'];(function(_0xd19bf8,_0x5a7648){var _0x24cc50=function(_0x230392){while(--_0x230392){_0xd19bf8['push'](_0xd19bf8['shift']());}};_0x24cc50(++_0x5a7648);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xfb11[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1fb1('0x4'));var config=require('../../config/environment');var controller=require(_0x1fb1('0x5'));router[_0x1fb1('0x6')]('/',auth['isAuthenticated'](),controller[_0x1fb1('0x7')]);router[_0x1fb1('0x6')]('/describe',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x9')]);router[_0x1fb1('0x6')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xb')]);router[_0x1fb1('0x6')](_0x1fb1('0xc'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xd')]);router['post']('/',auth[_0x1fb1('0x8')](),controller['create']);router[_0x1fb1('0xe')]('/:id/contacts',auth[_0x1fb1('0x8')](),controller[_0x1fb1('0xf')]);router[_0x1fb1('0x10')](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x11')]);router['delete'](_0x1fb1('0xa'),auth[_0x1fb1('0x8')](),controller[_0x1fb1('0x12')]);module[_0x1fb1('0x13')]=router; \ No newline at end of file +var _0xa46e=['/:id/contacts','addContacts','put','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./cmCompany.controller','isAuthenticated','get','/describe','describe','/:id','show','getContacts','post','create'];(function(_0x15d965,_0x3469d6){var _0x7243d=function(_0x53e782){while(--_0x53e782){_0x15d965['push'](_0x15d965['shift']());}};_0x7243d(++_0x3469d6);}(_0xa46e,0x8a));var _0xea46=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0xa46e[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xea46('0x5'));var config=require('../../config/environment');var controller=require(_0xea46('0x6'));router['get']('/',auth[_0xea46('0x7')](),controller['index']);router[_0xea46('0x8')](_0xea46('0x9'),auth['isAuthenticated'](),controller[_0xea46('0xa')]);router[_0xea46('0x8')](_0xea46('0xb'),auth[_0xea46('0x7')](),controller[_0xea46('0xc')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xea46('0xd')]);router[_0xea46('0xe')]('/',auth['isAuthenticated'](),controller[_0xea46('0xf')]);router[_0xea46('0xe')](_0xea46('0x10'),auth['isAuthenticated'](),controller[_0xea46('0x11')]);router[_0xea46('0x12')]('/:id',auth[_0xea46('0x7')](),controller[_0xea46('0x13')]);router['delete'](_0xea46('0xb'),auth['isAuthenticated'](),controller[_0xea46('0x14')]);module[_0xea46('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 3439dde..13a7abc 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 _0xa0cf=['TEXT','INTEGER','UNSIGNED','NOW','lodash','sequelize','exports','STRING'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xa0cf,0x164));var _0xfa0c=function(_0xe22ceb,_0x27dc83){_0xe22ceb=_0xe22ceb-0x0;var _0x45bb58=_0xa0cf[_0xe22ceb];return _0x45bb58;};'use strict';var _=require(_0xfa0c('0x0'));var Sequelize=require(_0xfa0c('0x1'));module[_0xfa0c('0x2')]={'firstName':{'type':Sequelize[_0xfa0c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfa0c('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xfa0c('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xfa0c('0x3')]},'description':{'type':Sequelize[_0xfa0c('0x4')]},'phone':{'type':Sequelize[_0xfa0c('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xfa0c('0x3')]},'email':{'type':Sequelize[_0xfa0c('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xfa0c('0x3')]},'fb_data':{'type':Sequelize[_0xfa0c('0x3')]},'twitter':{'type':Sequelize[_0xfa0c('0x3')]},'skype':{'type':Sequelize[_0xfa0c('0x3')]},'teams':{'type':Sequelize[_0xfa0c('0x3')]},'viber':{'type':Sequelize[_0xfa0c('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xfa0c('0x3')]},'telegram':{'type':Sequelize[_0xfa0c('0x3')]},'UserId':{'type':Sequelize[_0xfa0c('0x5')]},'priority':{'type':Sequelize[_0xfa0c('0x5')](0x2)[_0xfa0c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xfa0c('0x7')]}}; \ No newline at end of file +var _0x8a2b=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','sequelize'];(function(_0x5519c4,_0x270f91){var _0x2c1c3=function(_0x28178c){while(--_0x28178c){_0x5519c4['push'](_0x5519c4['shift']());}};_0x2c1c3(++_0x270f91);}(_0x8a2b,0x14f));var _0xb8a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Sequelize=require(_0xb8a2('0x0'));module[_0xb8a2('0x1')]={'firstName':{'type':Sequelize[_0xb8a2('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb8a2('0x2')]},'street':{'type':Sequelize[_0xb8a2('0x2')]},'postalCode':{'type':Sequelize[_0xb8a2('0x2')]},'city':{'type':Sequelize[_0xb8a2('0x2')]},'country':{'type':Sequelize[_0xb8a2('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb8a2('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb8a2('0x2')]},'mobile':{'type':Sequelize[_0xb8a2('0x2')]},'fax':{'type':Sequelize[_0xb8a2('0x2')]},'email':{'type':Sequelize[_0xb8a2('0x2')]},'url':{'type':Sequelize[_0xb8a2('0x2')]},'facebook':{'type':Sequelize[_0xb8a2('0x2')]},'fb_data':{'type':Sequelize[_0xb8a2('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xb8a2('0x2')]},'teams':{'type':Sequelize[_0xb8a2('0x2')]},'viber':{'type':Sequelize[_0xb8a2('0x2')]},'line':{'type':Sequelize[_0xb8a2('0x2')]},'wechat':{'type':Sequelize[_0xb8a2('0x2')]},'telegram':{'type':Sequelize[_0xb8a2('0x2')]},'UserId':{'type':Sequelize[_0xb8a2('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb8a2('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb8a2('0x5')],'defaultValue':Sequelize[_0xb8a2('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7eb48d1..01906e3 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 _0x70e0=['split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','text','filter','Contact','push','isEmpty','where','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','some','User','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','c.firstName','c.mobile','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','params','catch','describe','tags','cf_','columnName','CmCustomField','findAll','displayName','alias','custom','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','bulkCreate','duplicates','ListId','findOrCreate','spread','show','find','format','cf_%d','omit','pickBy','table','cm_contacts','id\x20=\x20?','toParam','values','phone','getTags','rawAttributes','merge','nolimit','findOne','setTags','ids','include','rows','getHopperHistories','ContactId','options','includeAll','getHopperFinals','getJscriptySessions','JscriptySessionReport','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','fork','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','end','count','offset','limit','json','save','update','then','destroy','sendStatus','stack','name','status','send','index','CmContact','length','keys','startsWith','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','select','field','color','tools_tags','from','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator','conditions','Tag','value'];(function(_0x2316c3,_0x103a84){var _0x4dcb15=function(_0x9a4c8f){while(--_0x9a4c8f){_0x2316c3['push'](_0x2316c3['shift']());}};_0x4dcb15(++_0x103a84);}(_0x70e0,0x17b));var _0x070e=function(_0x1e352c,_0x26099d){_0x1e352c=_0x1e352c-0x0;var _0xfe1cf5=_0x70e0[_0x1e352c];return _0xfe1cf5;};'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 licenseUtil=require(_0x070e('0x15'));var db=require(_0x070e('0x16'))['db'];config[_0x070e('0x17')]=_[_0x070e('0x18')](config[_0x070e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x070e('0x17')]));require('./cmContact.socket')['register'](socket);function respondWithStatusCode(_0x5bae0f,_0x11d2ce){_0x11d2ce=_0x11d2ce||0xcc;return function(_0x14c3fd){if(_0x14c3fd){return _0x5bae0f['sendStatus'](_0x11d2ce);}return _0x5bae0f['status'](_0x11d2ce)[_0x070e('0x19')]();};}function respondWithResult(_0xeae1a5,_0x180897){_0x180897=_0x180897||0xc8;return function(_0x19d9da){if(_0x19d9da){return _0xeae1a5['status'](_0x180897)['json'](_0x19d9da);}};}function respondWithFilteredResult(_0x17e2e4,_0x2bd937){return function(_0x38f6e6){if(_0x38f6e6){var _0x2060cc=_0x38f6e6[_0x070e('0x1a')],_0x364b3f=_0x2bd937[_0x070e('0x1b')],_0x5037eb=_0x2bd937[_0x070e('0x1b')]+_0x2bd937[_0x070e('0x1c')],_0x3938b5;if(_0x5037eb>=_0x2060cc){_0x5037eb=_0x2060cc;_0x3938b5=0xc8;}else{_0x3938b5=0xce;}_0x17e2e4['status'](_0x3938b5);return _0x17e2e4['set']('Content-Range',_0x364b3f+'-'+_0x5037eb+'/'+_0x2060cc)[_0x070e('0x1d')](_0x38f6e6);}return null;};}function patchUpdates(_0x3004f0){return function(_0x20dc60){try{jsonpatch['apply'](_0x20dc60,_0x3004f0,!![]);}catch(_0x5b184){return BPromise['reject'](_0x5b184);}return _0x20dc60[_0x070e('0x1e')]();};}function saveUpdates(_0x3f6985,_0x27a01e){return function(_0x33e8c6){if(_0x33e8c6){return _0x33e8c6[_0x070e('0x1f')](_0x3f6985)[_0x070e('0x20')](function(_0xe405e){return _0xe405e;});}return null;};}function removeEntity(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(_0x2f8055){return _0x2f8055[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x164cdf['status'](0xcc)[_0x070e('0x19')]();});}};}function handleEntityNotFound(_0x5f3e9d,_0x4a2dbd){return function(_0x2ccbd7){if(!_0x2ccbd7){_0x5f3e9d[_0x070e('0x22')](0x194);}return _0x2ccbd7;};}function handleError(_0x41deb1,_0x1743cc){_0x1743cc=_0x1743cc||0x1f4;return function(_0x4763c6){logger['error'](_0x4763c6[_0x070e('0x23')]);if(_0x4763c6[_0x070e('0x24')]){delete _0x4763c6[_0x070e('0x24')];}_0x41deb1[_0x070e('0x25')](_0x1743cc)[_0x070e('0x26')](_0x4763c6);};}exports[_0x070e('0x27')]=function(_0x1a1892,_0x26373b){var _0x5e8326={},_0x282344={},_0x351641={'count':0x0,'rows':[]};return db[_0x070e('0x28')]['describe']()['then'](function(_0x13097f){var _0x46065c=[];for(var _0xa6c0ab=0x0;_0xa6c0ab0x1){_0x59037e['or'](_0x070e('0x62'),qs[_0x070e('0x63')](_0x24f303),null);}else{if(qs['isNumeric'](_0x24f303)){_0x59037e['or'](_0x070e('0x64'),_0x24f303+'%');_0x59037e['or']('c.phone\x20LIKE\x20?',_0x24f303+'%');_0x59037e['or'](_0x070e('0x65'),_0x24f303+'%');_0x59037e['or']('c.fax\x20LIKE\x20?',_0x24f303+'%');}else if(qs['isEmail'](_0x24f303)){_0x59037e['or']('c.email\x20LIKE\x20?',_0x24f303+'%');}else{_0x59037e['or'](_0x070e('0x66'),'%'+_0x24f303+'%');_0x59037e['or'](_0x070e('0x67'),'%'+_0x24f303+'%');_0x59037e['or'](_0x070e('0x68'),'%'+_0x24f303+'%');}}}}_0x1223be[_0x070e('0x5c')](_0x59037e);_0x1223be[_0x070e('0x69')](_0x070e('0x6a'));var _0x498bc6={'type':db[_0x070e('0x6b')]['QueryTypes'][_0x070e('0x6c')],'raw':!![]};var _0x52becf=_0x1223be[_0x070e('0x6d')]()[_0x070e('0x3b')]('c.id');if(_0x5e8326[_0x070e('0x37')]){_0x5e8326['order'][_0x070e('0x4d')](function(_0x139630){_0x1223be[_0x070e('0x37')]('c.'+_0x139630[0x0],_0x139630[0x1]===_0x070e('0x6e')?![]:!![]);});}if(!_[_0x070e('0x5b')](_0x42245d)){_0x1223be[_0x070e('0x6f')](_0xff760c);_0x52becf[_0x070e('0x5c')](_0x070e('0x70'),_0x42245d);}BPromise[_0x070e('0x71')]()[_0x070e('0x20')](function(){if(_0x54285a&&!_[_0x070e('0x72')](_0x54285a[_0x070e('0x48')],[_0x070e('0x3b'),_0x070e('0x73')])){return _0x1a1892['user'][_0x070e('0x74')]({'attributes':['id'],'raw':!![]})[_0x070e('0x20')](function(_0x381c83){if(_[_0x070e('0x5b')](_0x381c83)){_0x52becf['where'](_0x070e('0x75'));_0x1223be[_0x070e('0x5c')](_0x070e('0x75'));}else{_0x52becf[_0x070e('0x5c')](_0x070e('0x76'),_[_0x070e('0x4c')](_0x381c83,'id'));_0x1223be['where'](_0x070e('0x76'),_[_0x070e('0x4c')](_0x381c83,'id'));}});}else{return;}})[_0x070e('0x20')](function(){db[_0x070e('0x77')]['query'](_0x52becf[_0x070e('0x78')](),_0x498bc6)['then'](function(_0x10d95d){_0x351641[_0x070e('0x1a')]=_0x10d95d[_0x070e('0x29')];if(_0x351641[_0x070e('0x1a')]===0x0)return[];return db[_0x070e('0x77')]['query'](_0x47b929[_0x070e('0x78')](),_0x498bc6);})[_0x070e('0x20')](function(_0x8cc913){_0xd03404=_[_0x070e('0x79')](_0x8cc913,'id');_0x498bc6=_['merge'](_0x498bc6,{'model':db[_0x070e('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a1892['query'][_0x070e('0x35')]){_0x5e8326[_0x070e('0x34')][_0x070e('0x4d')](function(_0x57585e){_0x1223be[_0x070e('0x3b')]('c.'+_0x57585e);});}else{_0x1223be['field'](_0x070e('0x6a'));_0x1223be['field'](_0x070e('0x7a'));_0x1223be[_0x070e('0x3b')]('c.lastName');_0x1223be[_0x070e('0x3b')]('c.phone');_0x1223be[_0x070e('0x3b')](_0x070e('0x7b'));_0x1223be['field']('c.fax');_0x1223be[_0x070e('0x3b')](_0x070e('0x7c'));_0x1223be[_0x070e('0x3b')](_0x070e('0x7d'));_0x1223be[_0x070e('0x3b')](_0x070e('0x7e'));_0x1223be[_0x070e('0x3b')](_0x070e('0x7f'),_0x070e('0x80'));}if(_0x5e8326[_0x070e('0x1c')])_0x1223be[_0x070e('0x1c')](_0x5e8326[_0x070e('0x1c')]);if(_0x5e8326[_0x070e('0x1b')])_0x1223be['offset'](_0x5e8326[_0x070e('0x1b')]);return db[_0x070e('0x77')]['query'](_0x1223be['toString'](),_0x498bc6);})[_0x070e('0x20')](function(_0x2a4de5){_0x2a4de5[_0x070e('0x4d')](function(_0x24bbc7){if(_0x24bbc7[_0x070e('0x80')]){_0x24bbc7[_0x070e('0x81')]=[];_0x24bbc7[_0x070e('0x80')][_0x070e('0x4b')](',')[_0x070e('0x4d')](function(_0x2c80e3){_0x24bbc7[_0x070e('0x81')][_0x070e('0x5a')](_0xd03404[_0x2c80e3]);});}delete _0x24bbc7[_0x070e('0x80')];});_0x351641['rows']=_0x2a4de5;return _0x351641;})['then'](respondWithFilteredResult(_0x26373b,_0x5e8326));});})['catch'](handleError(_0x26373b,null));};exports[_0x070e('0x21')]=function(_0x2e4b4a,_0x2c4e67){return db[_0x070e('0x28')]['find']({'where':{'id':_0x2e4b4a[_0x070e('0x82')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x2c4e67,null))[_0x070e('0x20')](removeEntity(_0x2c4e67,null))[_0x070e('0x83')](handleError(_0x2c4e67,null));};exports[_0x070e('0x84')]=function(_0x264d6a,_0x4a7129){return db[_0x070e('0x28')]['describe']()[_0x070e('0x20')](function(_0x413df0){delete _0x413df0[_0x070e('0x85')];for(var _0x3aa620=0x0;_0x3aa620=_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);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};return db[_0x0a9e('0x28')][_0x0a9e('0x29')]()[_0x0a9e('0x22')](function(_0x2ec755){var _0x5c877d=[];for(var _0x15b200=0x0;_0x15b2000x1){_0x473fdc['or'](_0x0a9e('0x66'),qs[_0x0a9e('0x67')](_0x232830),null);}else{if(qs[_0x0a9e('0x68')](_0x232830)){_0x473fdc['or']('c.id\x20LIKE\x20?',_0x232830+'%');_0x473fdc['or'](_0x0a9e('0x69'),_0x232830+'%');_0x473fdc['or'](_0x0a9e('0x6a'),_0x232830+'%');_0x473fdc['or']('c.fax\x20LIKE\x20?',_0x232830+'%');}else if(qs[_0x0a9e('0x6b')](_0x232830)){_0x473fdc['or']('c.email\x20LIKE\x20?',_0x232830+'%');}else{_0x473fdc['or'](_0x0a9e('0x6c'),'%'+_0x232830+'%');_0x473fdc['or']('c.lastName\x20LIKE\x20?','%'+_0x232830+'%');_0x473fdc['or']('c.email\x20LIKE\x20?','%'+_0x232830+'%');}}}}_0x274e8e['where'](_0x473fdc);_0x274e8e[_0x0a9e('0x6d')]('c.id');var _0x2244d6={'type':db[_0x0a9e('0x6e')][_0x0a9e('0x6f')][_0x0a9e('0x70')],'raw':!![]};var _0x1cca9f=_0x274e8e[_0x0a9e('0x71')]()['field'](_0x0a9e('0x72'));if(_0x11c3b6['order']){_0x11c3b6[_0x0a9e('0x73')][_0x0a9e('0x51')](function(_0x51aaf7){_0x274e8e['order']('c.'+_0x51aaf7[0x0],_0x51aaf7[0x1]===_0x0a9e('0x74')?![]:!![]);});}if(!_[_0x0a9e('0x75')](_0x405c8f)){_0x274e8e[_0x0a9e('0x76')](_0x315881);_0x1cca9f[_0x0a9e('0x3c')]('t.id\x20IN\x20?',_0x405c8f);}BPromise[_0x0a9e('0x77')]()[_0x0a9e('0x22')](function(){if(_0xc9a702&&!_['some'](_0xc9a702[_0x0a9e('0x4c')],[_0x0a9e('0x3f'),_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x78')][_0x0a9e('0x79')]({'attributes':['id'],'raw':!![]})['then'](function(_0x176840){if(_[_0x0a9e('0x75')](_0x176840)){_0x1cca9f[_0x0a9e('0x3c')]('c.ListId\x20IS\x20NULL');_0x274e8e[_0x0a9e('0x3c')]('c.ListId\x20IS\x20NULL');}else{_0x1cca9f['where'](_0x0a9e('0x5e'),_[_0x0a9e('0x50')](_0x176840,'id'));_0x274e8e[_0x0a9e('0x3c')](_0x0a9e('0x5e'),_[_0x0a9e('0x50')](_0x176840,'id'));}});}else{return;}})[_0x0a9e('0x22')](function(){db[_0x0a9e('0x7a')][_0x0a9e('0x37')](_0x1cca9f[_0x0a9e('0x7b')](),_0x2244d6)[_0x0a9e('0x22')](function(_0x2e89b7){_0x5a101a[_0x0a9e('0x1b')]=_0x2e89b7[_0x0a9e('0x2b')];if(_0x5a101a[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x7a')][_0x0a9e('0x37')](_0x15e37d[_0x0a9e('0x7b')](),_0x2244d6);})[_0x0a9e('0x22')](function(_0x5150a4){_0x5a594b=_[_0x0a9e('0x7c')](_0x5150a4,'id');_0x2244d6=_[_0x0a9e('0x7d')](_0x2244d6,{'model':db[_0x0a9e('0x28')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x140511['query'][_0x0a9e('0x38')]){_0x11c3b6[_0x0a9e('0x39')]['forEach'](function(_0x83f0b2){_0x274e8e[_0x0a9e('0x3f')]('c.'+_0x83f0b2);});}else{_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x72'));_0x274e8e[_0x0a9e('0x3f')]('c.firstName');_0x274e8e['field']('c.lastName');_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x7e'));_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x7f'));_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x80'));_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x81'));_0x274e8e['field'](_0x0a9e('0x82'));_0x274e8e[_0x0a9e('0x3f')](_0x0a9e('0x83'));_0x274e8e['field'](_0x0a9e('0x84'),'TagIds');}if(_0x11c3b6[_0x0a9e('0x1d')])_0x274e8e[_0x0a9e('0x1d')](_0x11c3b6['limit']);if(_0x11c3b6[_0x0a9e('0x1c')])_0x274e8e[_0x0a9e('0x1c')](_0x11c3b6[_0x0a9e('0x1c')]);return db[_0x0a9e('0x7a')]['query'](_0x274e8e[_0x0a9e('0x7b')](),_0x2244d6);})[_0x0a9e('0x22')](function(_0x371533){_0x371533[_0x0a9e('0x51')](function(_0x5b7fc3){if(_0x5b7fc3[_0x0a9e('0x85')]){_0x5b7fc3[_0x0a9e('0x86')]=[];_0x5b7fc3[_0x0a9e('0x85')][_0x0a9e('0x4f')](',')['forEach'](function(_0x290d43){_0x5b7fc3[_0x0a9e('0x86')][_0x0a9e('0x2e')](_0x5a594b[_0x290d43]);});}delete _0x5b7fc3[_0x0a9e('0x85')];});_0x5a101a[_0x0a9e('0x87')]=_0x371533;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6));});})[_0x0a9e('0x88')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x21')]=function(_0x1a7b03,_0x336dc3){return db[_0x0a9e('0x28')][_0x0a9e('0x89')]({'where':{'id':_0x1a7b03[_0x0a9e('0x8a')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x336dc3,null))['then'](removeEntity(_0x336dc3,null))[_0x0a9e('0x88')](handleError(_0x336dc3,null));};exports[_0x0a9e('0x29')]=function(_0xc599b3,_0x563627){return db[_0x0a9e('0x28')][_0x0a9e('0x29')]()[_0x0a9e('0x22')](function(_0x2b9463){delete _0x2b9463['tags'];for(var _0x541e80=0x0;_0x541e80{}\s\\|]/g,'-');_0x48d18a(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path[_0x1ac3('0x25')](_0x5f1918[_0x1ac3('0x21')],path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])),Date['now'](),path[_0x1ac3('0x26')](_0x5f1918[_0x1ac3('0x21')])));}})});router['post'](_0x1ac3('0x27'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x29')]);var upload=multer({'storage':multer[_0x1ac3('0x1d')]({'destination':function(_0x145486,_0x2dfdb7,_0x10db3d){_0x10db3d(null,path['join'](config['root'],'server/files/tmp'));},'filename':function(_0x528807,_0x52a1a5,_0x3ea482){_0x52a1a5['originalname']=_0x52a1a5[_0x1ac3('0x21')][_0x1ac3('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ea482(null,util[_0x1ac3('0x23')](_0x1ac3('0x24'),path['basename'](_0x52a1a5[_0x1ac3('0x21')],path['extname'](_0x52a1a5[_0x1ac3('0x21')])),Date[_0x1ac3('0x2a')](),path[_0x1ac3('0x26')](_0x52a1a5[_0x1ac3('0x21')])));}})});router[_0x1ac3('0x18')](_0x1ac3('0x2b'),upload[_0x1ac3('0x28')]('file'),controller[_0x1ac3('0x2c')]);router[_0x1ac3('0x18')](_0x1ac3('0x2d'),auth[_0x1ac3('0xc')](),controller['import']);router[_0x1ac3('0x2e')](_0x1ac3('0xe'),auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x2f')]);router[_0x1ac3('0x30')]('/:id',auth[_0x1ac3('0xc')](),controller[_0x1ac3('0x31')]);module[_0x1ac3('0x32')]=router; \ No newline at end of file +var _0xb4c7=['diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','/upload','upload','import','put','/:id','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','describe','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/merge','merge','post','create','/create_many','bulkCreate'];(function(_0x1ff1ca,_0x8f9278){var _0x1dbb66=function(_0x45b448){while(--_0x45b448){_0x1ff1ca['push'](_0x1ff1ca['shift']());}};_0x1dbb66(++_0x8f9278);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x47d469,_0x2410bb){_0x47d469=_0x47d469-0x0;var _0x39c2ed=_0xb4c7[_0x47d469];return _0x39c2ed;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var auth=require(_0x7b4c('0x5'));var interaction=require(_0x7b4c('0x6'));var config=require(_0x7b4c('0x7'));var controller=require(_0x7b4c('0x8'));router[_0x7b4c('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b4c('0xa')]);router[_0x7b4c('0x9')](_0x7b4c('0xb'),auth['isAuthenticated'](),controller[_0x7b4c('0xc')]);router[_0x7b4c('0x9')]('/:id',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0x9')](_0x7b4c('0xf'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x10')]);router[_0x7b4c('0x9')](_0x7b4c('0x11'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x12')]);router['get']('/:id/hopper_histories',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x13')]);router[_0x7b4c('0x9')](_0x7b4c('0x14'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x15')]);router[_0x7b4c('0x9')](_0x7b4c('0x16'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x17')]);router['post'](_0x7b4c('0x18'),auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x19')]);router[_0x7b4c('0x1a')]('/',auth[_0x7b4c('0xd')](),controller[_0x7b4c('0x1b')]);router[_0x7b4c('0x1a')](_0x7b4c('0x1c'),auth['isAuthenticated'](),controller[_0x7b4c('0x1d')]);router[_0x7b4c('0x1a')](_0x7b4c('0xf'),auth[_0x7b4c('0xd')](),controller['setTags']);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x3d314d,_0x32110e,_0x380b79){_0x380b79(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x445281,_0x3556d8,_0x55e3df){_0x3556d8[_0x7b4c('0x22')]=_0x3556d8[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x55e3df(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x3556d8[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x3556d8[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path['extname'](_0x3556d8[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x29'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2c')]);var upload=multer({'storage':multer[_0x7b4c('0x1e')]({'destination':function(_0x459eb4,_0x1f311e,_0x1a69db){_0x1a69db(null,path[_0x7b4c('0x1f')](config[_0x7b4c('0x20')],_0x7b4c('0x21')));},'filename':function(_0x501f75,_0x27f361,_0x3ab614){_0x27f361[_0x7b4c('0x22')]=_0x27f361[_0x7b4c('0x22')][_0x7b4c('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3ab614(null,util[_0x7b4c('0x24')](_0x7b4c('0x25'),path[_0x7b4c('0x26')](_0x27f361[_0x7b4c('0x22')],path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])),Date[_0x7b4c('0x28')](),path[_0x7b4c('0x27')](_0x27f361[_0x7b4c('0x22')])));}})});router[_0x7b4c('0x1a')](_0x7b4c('0x2d'),upload[_0x7b4c('0x2a')](_0x7b4c('0x2b')),controller[_0x7b4c('0x2e')]);router['post']('/upload/:id',auth['isAuthenticated'](),controller[_0x7b4c('0x2f')]);router[_0x7b4c('0x30')](_0x7b4c('0x31'),auth[_0x7b4c('0xd')](),controller['update']);router[_0x7b4c('0x32')](_0x7b4c('0x31'),auth['isAuthenticated'](),controller[_0x7b4c('0x33')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 47e58c5..7c2d9d8 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 _0x24ca=['getDataValue','name','TEXT','long','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','alias','STRING','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x24ca[_0x386525];return _0x14d015;};'use strict';var Sequelize=require(_0xa24c('0x0'));var _=require('lodash');module[_0xa24c('0x1')]={'name':{'type':Sequelize[_0xa24c('0x2')],'get':function(_0x4defb1){return this['getDataValue'](_0xa24c('0x3'));}},'alias':{'type':Sequelize[_0xa24c('0x4')],'allowNull':![],'set':function(_0x195e60){this[_0xa24c('0x5')](_0xa24c('0x3'),_0x195e60?_0x195e60:this[_0xa24c('0x6')](_0xa24c('0x7')));}},'type':{'type':Sequelize[_0xa24c('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa24c('0x8')](_0xa24c('0x9')),'get':function(){if(this[_0xa24c('0x6')]('type')===_0xa24c('0xa')){return JSON[_0xa24c('0xb')](this[_0xa24c('0x6')]('values'));}else{return this[_0xa24c('0x6')](_0xa24c('0xc'));}},'set':function(_0x288f76){if(Array[_0xa24c('0xd')](_0x288f76)){this[_0xa24c('0x5')](_0xa24c('0xc'),JSON[_0xa24c('0xe')](_0x288f76));}else{this[_0xa24c('0x5')](_0xa24c('0xc'),_0x288f76);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa24c('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa24c('0x10')](_0xa24c('0x11'))}}; \ No newline at end of file +var _0x29d4=['ENUM','sequelize','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','parse','values','stringify','BOOLEAN'];(function(_0x6c7b6d,_0x452210){var _0x5bebd3=function(_0x12ac66){while(--_0x12ac66){_0x6c7b6d['push'](_0x6c7b6d['shift']());}};_0x5bebd3(++_0x452210);}(_0x29d4,0x1a1));var _0x429d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x29d4[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x429d('0x0'));var _=require('lodash');module[_0x429d('0x1')]={'name':{'type':Sequelize[_0x429d('0x2')],'get':function(_0x16ce75){return this[_0x429d('0x3')](_0x429d('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xc3989d){this[_0x429d('0x5')](_0x429d('0x4'),_0xc3989d?_0xc3989d:this[_0x429d('0x3')](_0x429d('0x6')));}},'type':{'type':Sequelize[_0x429d('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x429d('0x8')](_0x429d('0x9')),'get':function(){if(this['getDataValue'](_0x429d('0xa'))==='select'){return JSON[_0x429d('0xb')](this[_0x429d('0x3')](_0x429d('0xc')));}else{return this['getDataValue'](_0x429d('0xc'));}},'set':function(_0x8c7cb6){if(Array['isArray'](_0x8c7cb6)){this[_0x429d('0x5')](_0x429d('0xc'),JSON[_0x429d('0xd')](_0x8c7cb6));}else{this['setDataValue'](_0x429d('0xc'),_0x8c7cb6);}}},'required':{'type':Sequelize[_0x429d('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x429d('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x429d('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0c8b0fc..f2b2d58 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 _0x43b8=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','status','stack','name','send','index','map','CmCustomField','fieldName','key','model','differenceBy','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','type','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2bc6a6,_0x5d1c51){var _0x47c0c4=function(_0x2afd0f){while(--_0x2afd0f){_0x2bc6a6['push'](_0x2bc6a6['shift']());}};_0x47c0c4(++_0x5d1c51);}(_0x43b8,0x166));var _0x843b=function(_0x133bee,_0x43dca4){_0x133bee=_0x133bee-0x0;var _0x489475=_0x43b8[_0x133bee];return _0x489475;};'use strict';var pdf=require(_0x843b('0x0'));var emlformat=require(_0x843b('0x1'));var rimraf=require(_0x843b('0x2'));var zipdir=require(_0x843b('0x3'));var jsonpatch=require(_0x843b('0x4'));var rp=require(_0x843b('0x5'));var moment=require(_0x843b('0x6'));var BPromise=require(_0x843b('0x7'));var Mustache=require(_0x843b('0x8'));var util=require(_0x843b('0x9'));var path=require(_0x843b('0xa'));var sox=require(_0x843b('0xb'));var csv=require(_0x843b('0xc'));var ejs=require(_0x843b('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x843b('0xe'));var crypto=require(_0x843b('0xf'));var jsforce=require(_0x843b('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x843b('0xc'));var querystring=require('querystring');var Papa=require(_0x843b('0x11'));var Redis=require(_0x843b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x843b('0x13'));var as=require(_0x843b('0x14'));var hardwareService=require(_0x843b('0x15'));var logger=require(_0x843b('0x16'))('api');var utils=require(_0x843b('0x17'));var config=require(_0x843b('0x18'));var licenseUtil=require(_0x843b('0x19'));var db=require(_0x843b('0x1a'))['db'];function respondWithStatusCode(_0x5b7bb5,_0x30a53d){_0x30a53d=_0x30a53d||0xcc;return function(_0x1a64bb){if(_0x1a64bb){return _0x5b7bb5[_0x843b('0x1b')](_0x30a53d);}return _0x5b7bb5['status'](_0x30a53d)[_0x843b('0x1c')]();};}function respondWithResult(_0x27de2a,_0x29a8b3){_0x29a8b3=_0x29a8b3||0xc8;return function(_0x59c487){if(_0x59c487){return _0x27de2a['status'](_0x29a8b3)[_0x843b('0x1d')](_0x59c487);}};}function respondWithFilteredResult(_0x1f4d6d,_0x439f43){return function(_0x21bdc6){if(_0x21bdc6){var _0x1d02ac=_0x21bdc6['count'],_0x49fbfb=_0x439f43[_0x843b('0x1e')],_0x4ec755=_0x439f43[_0x843b('0x1e')]+_0x439f43[_0x843b('0x1f')],_0x1c09c8;if(_0x4ec755>=_0x1d02ac){_0x4ec755=_0x1d02ac;_0x1c09c8=0xc8;}else{_0x1c09c8=0xce;}_0x1f4d6d['status'](_0x1c09c8);return _0x1f4d6d[_0x843b('0x20')](_0x843b('0x21'),_0x49fbfb+'-'+_0x4ec755+'/'+_0x1d02ac)['json'](_0x21bdc6);}return null;};}function patchUpdates(_0x4b79ff){return function(_0x27ccf3){try{jsonpatch['apply'](_0x27ccf3,_0x4b79ff,!![]);}catch(_0x104bf5){return BPromise[_0x843b('0x22')](_0x104bf5);}return _0x27ccf3[_0x843b('0x23')]();};}function saveUpdates(_0x2f3e71,_0x4aebaa){return function(_0x3b6729){if(_0x3b6729){return _0x3b6729[_0x843b('0x24')](_0x2f3e71)['then'](function(_0x32d9fa){return _0x32d9fa;});}return null;};}function removeEntity(_0xcfd182,_0x5be931){return function(_0x4884a6){if(_0x4884a6){return _0x4884a6[_0x843b('0x25')]()[_0x843b('0x26')](function(){_0xcfd182[_0x843b('0x27')](0xcc)[_0x843b('0x1c')]();});}};}function handleEntityNotFound(_0x1e90c2,_0x466caa){return function(_0x7f7fa9){if(!_0x7f7fa9){_0x1e90c2[_0x843b('0x1b')](0x194);}return _0x7f7fa9;};}function handleError(_0x104a5e,_0x395f80){_0x395f80=_0x395f80||0x1f4;return function(_0x1b77cb){logger['error'](_0x1b77cb[_0x843b('0x28')]);if(_0x1b77cb[_0x843b('0x29')]){delete _0x1b77cb[_0x843b('0x29')];}_0x104a5e[_0x843b('0x27')](_0x395f80)[_0x843b('0x2a')](_0x1b77cb);};}exports[_0x843b('0x2b')]=function(_0x51f61f,_0x21359b){var _0x3eaef3={},_0x5487cc={},_0x2424df={'count':0x0,'rows':[]};var _0x938ff1=_[_0x843b('0x2c')](db[_0x843b('0x2d')]['rawAttributes'],function(_0x2fa4a4){return{'name':_0x2fa4a4[_0x843b('0x2e')],'type':_0x2fa4a4['type'][_0x843b('0x2f')]};});_0x5487cc[_0x843b('0x30')]=_[_0x843b('0x31')](_[_0x843b('0x2c')](_0x938ff1,'name'),[_0x843b('0x29')]);_0x5487cc['query']=_['keys'](_0x51f61f[_0x843b('0x32')]);_0x5487cc['filters']=_['intersection'](_0x5487cc[_0x843b('0x30')],_0x5487cc[_0x843b('0x32')]);_0x3eaef3[_0x843b('0x33')]=_[_0x843b('0x34')](_0x5487cc[_0x843b('0x30')],qs[_0x843b('0x35')](_0x51f61f[_0x843b('0x32')][_0x843b('0x35')]));_0x3eaef3['attributes']=_0x3eaef3[_0x843b('0x33')][_0x843b('0x36')]?_0x3eaef3['attributes']:_0x5487cc[_0x843b('0x30')];if(!_0x51f61f[_0x843b('0x32')]['hasOwnProperty'](_0x843b('0x37'))){_0x3eaef3[_0x843b('0x1f')]=qs[_0x843b('0x1f')](_0x51f61f[_0x843b('0x32')][_0x843b('0x1f')]);_0x3eaef3[_0x843b('0x1e')]=qs[_0x843b('0x1e')](_0x51f61f[_0x843b('0x32')]['offset']);}_0x3eaef3[_0x843b('0x38')]=qs[_0x843b('0x39')](_0x51f61f[_0x843b('0x32')]['sort']);_0x3eaef3[_0x843b('0x3a')]=qs[_0x843b('0x3b')](_[_0x843b('0x3c')](_0x51f61f['query'],_0x5487cc[_0x843b('0x3b')]),_0x938ff1);if(_0x51f61f[_0x843b('0x32')]['filter']){_0x3eaef3[_0x843b('0x3a')]=_[_0x843b('0x3d')](_0x3eaef3[_0x843b('0x3a')],{'$or':_[_0x843b('0x2c')](_0x938ff1,function(_0x2fa5ad){if(_0x2fa5ad['type']!==_0x843b('0x3e')){var _0x40661f={};_0x40661f[_0x2fa5ad['name']]={'$like':'%'+_0x51f61f[_0x843b('0x32')][_0x843b('0x3f')]+'%'};return _0x40661f;}})});}_0x3eaef3=_['merge']({},_0x3eaef3,_0x51f61f[_0x843b('0x40')]);var _0xd3e5fb={'where':_0x3eaef3[_0x843b('0x3a')]};return db[_0x843b('0x2d')][_0x843b('0x41')](_0xd3e5fb)['then'](function(_0x37808b){_0x2424df[_0x843b('0x41')]=_0x37808b;if(_0x51f61f['query']['includeAll']){_0x3eaef3[_0x843b('0x42')]=[{'all':!![]}];}return db[_0x843b('0x2d')][_0x843b('0x43')](_0x3eaef3);})['then'](function(_0x2507f2){_0x2424df[_0x843b('0x44')]=_0x2507f2;return _0x2424df;})['then'](respondWithFilteredResult(_0x21359b,_0x3eaef3))['catch'](handleError(_0x21359b,null));};exports[_0x843b('0x45')]=function(_0x819f3b,_0x5a7a2b){var _0xd41c8d={'raw':!![],'where':{'id':_0x819f3b[_0x843b('0x46')]['id']}},_0x11e1b0={};_0x11e1b0['model']=_[_0x843b('0x47')](db[_0x843b('0x2d')][_0x843b('0x48')]);_0x11e1b0[_0x843b('0x32')]=_[_0x843b('0x47')](_0x819f3b[_0x843b('0x32')]);_0x11e1b0['filtears']=_['intersection'](_0x11e1b0[_0x843b('0x30')],_0x11e1b0[_0x843b('0x32')]);_0xd41c8d[_0x843b('0x33')]=_['intersection'](_0x11e1b0[_0x843b('0x30')],qs[_0x843b('0x35')](_0x819f3b[_0x843b('0x32')][_0x843b('0x35')]));_0xd41c8d[_0x843b('0x33')]=_0xd41c8d['attributes'][_0x843b('0x36')]?_0xd41c8d[_0x843b('0x33')]:_0x11e1b0[_0x843b('0x30')];if(_0x819f3b[_0x843b('0x32')][_0x843b('0x49')]){_0xd41c8d[_0x843b('0x42')]=[{'all':!![]}];}_0xd41c8d=_[_0x843b('0x3d')]({},_0xd41c8d,_0x819f3b[_0x843b('0x40')]);return db[_0x843b('0x2d')][_0x843b('0x4a')](_0xd41c8d)[_0x843b('0x26')](handleEntityNotFound(_0x5a7a2b,null))[_0x843b('0x26')](respondWithResult(_0x5a7a2b,null))[_0x843b('0x4b')](handleError(_0x5a7a2b,null));};exports['update']=function(_0x25e0cf,_0x226dc8){if(_0x25e0cf[_0x843b('0x4c')]['id']){delete _0x25e0cf[_0x843b('0x4c')]['id'];}return db[_0x843b('0x2d')][_0x843b('0x4a')]({'where':{'id':_0x25e0cf[_0x843b('0x46')]['id']}})[_0x843b('0x26')](handleEntityNotFound(_0x226dc8,null))[_0x843b('0x26')](saveUpdates(_0x25e0cf[_0x843b('0x4c')],null))[_0x843b('0x26')](respondWithResult(_0x226dc8,null))[_0x843b('0x4b')](handleError(_0x226dc8,null));};exports['destroy']=function(_0x115f97,_0x3324ed){return db[_0x843b('0x2d')][_0x843b('0x4a')]({'where':{'id':_0x115f97[_0x843b('0x46')]['id']}})[_0x843b('0x26')](handleEntityNotFound(_0x3324ed,null))[_0x843b('0x26')](removeEntity(_0x3324ed,null))[_0x843b('0x4b')](handleError(_0x3324ed,null));};exports[_0x843b('0x4d')]=function(_0x2a9b44,_0x121e31){var _0x4b3903;return db[_0x843b('0x4e')][_0x843b('0x4f')](function(_0x112ee4){return db[_0x843b('0x2d')]['create'](_0x2a9b44['body'],{'transaction':_0x112ee4})['then'](function(_0x5cbf8c){_0x4b3903=_0x5cbf8c;var _0x5af950={'type':db[_0x843b('0x50')][_0x843b('0x51')],'transaction':_0x112ee4};switch(_0x2a9b44[_0x843b('0x4c')][_0x843b('0x52')]){case _0x843b('0x53'):_0x5af950[_0x843b('0x52')]=db[_0x843b('0x50')][_0x843b('0x51')];break;case _0x843b('0x54'):_0x5af950[_0x843b('0x52')]=db[_0x843b('0x50')][_0x843b('0x55')];break;case'switch':_0x5af950[_0x843b('0x52')]=db[_0x843b('0x50')][_0x843b('0x56')];_0x5af950[_0x843b('0x57')]=![];break;default:}return db[_0x843b('0x4e')][_0x843b('0x58')]['addColumn'](_0x843b('0x59'),util['format'](_0x843b('0x5a'),_0x4b3903['id']),_0x5af950);})[_0x843b('0x26')](function(){return _0x4b3903;});})[_0x843b('0x26')](respondWithResult(_0x121e31,0xc9))[_0x843b('0x4b')](handleError(_0x121e31,null));}; \ No newline at end of file +var _0xa292=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','status','error','stack','name','index','map','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','CmCustomField','findAll','rows','show','params','filtears','find','update','body','create','sequelize','text','Sequelize','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','catch','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x1b90ae,_0x3f20fd){var _0x5cc15c=function(_0x2a263d){while(--_0x2a263d){_0x1b90ae['push'](_0x1b90ae['shift']());}};_0x5cc15c(++_0x3f20fd);}(_0xa292,0x9e));var _0x2a29=function(_0x3d597a,_0x587ab4){_0x3d597a=_0x3d597a-0x0;var _0x5d2499=_0xa292[_0x3d597a];return _0x5d2499;};'use strict';var pdf=require(_0x2a29('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2a29('0x1'));var zipdir=require(_0x2a29('0x2'));var jsonpatch=require(_0x2a29('0x3'));var rp=require(_0x2a29('0x4'));var moment=require(_0x2a29('0x5'));var BPromise=require(_0x2a29('0x6'));var Mustache=require(_0x2a29('0x7'));var util=require('util');var path=require(_0x2a29('0x8'));var sox=require(_0x2a29('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a29('0xa'));var squel=require(_0x2a29('0xb'));var crypto=require(_0x2a29('0xc'));var jsforce=require(_0x2a29('0xd'));var deskjs=require(_0x2a29('0xe'));var toCsv=require(_0x2a29('0xf'));var querystring=require(_0x2a29('0x10'));var Papa=require(_0x2a29('0x11'));var Redis=require(_0x2a29('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2a29('0x13'));var as=require(_0x2a29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2a29('0x15'));var utils=require(_0x2a29('0x16'));var config=require(_0x2a29('0x17'));var licenseUtil=require(_0x2a29('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x359ab5,_0xd6dad2){_0xd6dad2=_0xd6dad2||0xcc;return function(_0x168041){if(_0x168041){return _0x359ab5[_0x2a29('0x19')](_0xd6dad2);}return _0x359ab5['status'](_0xd6dad2)[_0x2a29('0x1a')]();};}function respondWithResult(_0x55562b,_0xca9563){_0xca9563=_0xca9563||0xc8;return function(_0x5365b9){if(_0x5365b9){return _0x55562b['status'](_0xca9563)[_0x2a29('0x1b')](_0x5365b9);}};}function respondWithFilteredResult(_0x53151d,_0x221505){return function(_0x1c8d0a){if(_0x1c8d0a){var _0x45f42d=_0x1c8d0a[_0x2a29('0x1c')],_0x50c1b7=_0x221505['offset'],_0x5f1fe3=_0x221505[_0x2a29('0x1d')]+_0x221505[_0x2a29('0x1e')],_0x182c09;if(_0x5f1fe3>=_0x45f42d){_0x5f1fe3=_0x45f42d;_0x182c09=0xc8;}else{_0x182c09=0xce;}_0x53151d['status'](_0x182c09);return _0x53151d[_0x2a29('0x1f')](_0x2a29('0x20'),_0x50c1b7+'-'+_0x5f1fe3+'/'+_0x45f42d)['json'](_0x1c8d0a);}return null;};}function patchUpdates(_0x468435){return function(_0x490855){try{jsonpatch[_0x2a29('0x21')](_0x490855,_0x468435,!![]);}catch(_0xa41ce8){return BPromise[_0x2a29('0x22')](_0xa41ce8);}return _0x490855[_0x2a29('0x23')]();};}function saveUpdates(_0x294419,_0x1a7853){return function(_0x27821){if(_0x27821){return _0x27821['update'](_0x294419)[_0x2a29('0x24')](function(_0x1ef12f){return _0x1ef12f;});}return null;};}function removeEntity(_0x3543cf,_0x1e5c62){return function(_0x2919bc){if(_0x2919bc){return _0x2919bc[_0x2a29('0x25')]()[_0x2a29('0x24')](function(){_0x3543cf[_0x2a29('0x26')](0xcc)[_0x2a29('0x1a')]();});}};}function handleEntityNotFound(_0x3c99ba,_0x3cb283){return function(_0x4918b5){if(!_0x4918b5){_0x3c99ba['sendStatus'](0x194);}return _0x4918b5;};}function handleError(_0x596b25,_0x4ea4ef){_0x4ea4ef=_0x4ea4ef||0x1f4;return function(_0x477bcb){logger[_0x2a29('0x27')](_0x477bcb[_0x2a29('0x28')]);if(_0x477bcb['name']){delete _0x477bcb[_0x2a29('0x29')];}_0x596b25['status'](_0x4ea4ef)['send'](_0x477bcb);};}exports[_0x2a29('0x2a')]=function(_0x1e8d19,_0x3f3914){var _0x3cb2a5={},_0x5a2d8d={},_0x128928={'count':0x0,'rows':[]};var _0x29b4c5=_[_0x2a29('0x2b')](db['CmCustomField'][_0x2a29('0x2c')],function(_0x33dfb7){return{'name':_0x33dfb7['fieldName'],'type':_0x33dfb7[_0x2a29('0x2d')]['key']};});_0x5a2d8d[_0x2a29('0x2e')]=_[_0x2a29('0x2f')](_['map'](_0x29b4c5,_0x2a29('0x29')),[_0x2a29('0x29')]);_0x5a2d8d[_0x2a29('0x30')]=_[_0x2a29('0x31')](_0x1e8d19['query']);_0x5a2d8d[_0x2a29('0x32')]=_[_0x2a29('0x33')](_0x5a2d8d[_0x2a29('0x2e')],_0x5a2d8d[_0x2a29('0x30')]);_0x3cb2a5[_0x2a29('0x34')]=_[_0x2a29('0x33')](_0x5a2d8d[_0x2a29('0x2e')],qs['fields'](_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x35')]));_0x3cb2a5[_0x2a29('0x34')]=_0x3cb2a5[_0x2a29('0x34')][_0x2a29('0x36')]?_0x3cb2a5[_0x2a29('0x34')]:_0x5a2d8d['model'];if(!_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x37')]('nolimit')){_0x3cb2a5[_0x2a29('0x1e')]=qs[_0x2a29('0x1e')](_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x1e')]);_0x3cb2a5[_0x2a29('0x1d')]=qs[_0x2a29('0x1d')](_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x1d')]);}_0x3cb2a5[_0x2a29('0x38')]=qs[_0x2a29('0x39')](_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x39')]);_0x3cb2a5[_0x2a29('0x3a')]=qs[_0x2a29('0x32')](_[_0x2a29('0x3b')](_0x1e8d19[_0x2a29('0x30')],_0x5a2d8d[_0x2a29('0x32')]),_0x29b4c5);if(_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x3c')]){_0x3cb2a5[_0x2a29('0x3a')]=_['merge'](_0x3cb2a5[_0x2a29('0x3a')],{'$or':_[_0x2a29('0x2b')](_0x29b4c5,function(_0x469662){if(_0x469662[_0x2a29('0x2d')]!=='VIRTUAL'){var _0x1857fe={};_0x1857fe[_0x469662[_0x2a29('0x29')]]={'$like':'%'+_0x1e8d19[_0x2a29('0x30')][_0x2a29('0x3c')]+'%'};return _0x1857fe;}})});}_0x3cb2a5=_[_0x2a29('0x3d')]({},_0x3cb2a5,_0x1e8d19[_0x2a29('0x3e')]);var _0x42f941={'where':_0x3cb2a5['where']};return db['CmCustomField'][_0x2a29('0x1c')](_0x42f941)[_0x2a29('0x24')](function(_0x195514){_0x128928[_0x2a29('0x1c')]=_0x195514;if(_0x1e8d19['query'][_0x2a29('0x3f')]){_0x3cb2a5[_0x2a29('0x40')]=[{'all':!![]}];}return db[_0x2a29('0x41')][_0x2a29('0x42')](_0x3cb2a5);})[_0x2a29('0x24')](function(_0x9a39e5){_0x128928[_0x2a29('0x43')]=_0x9a39e5;return _0x128928;})[_0x2a29('0x24')](respondWithFilteredResult(_0x3f3914,_0x3cb2a5))['catch'](handleError(_0x3f3914,null));};exports[_0x2a29('0x44')]=function(_0x1a3f7e,_0x18e86e){var _0x3d09f9={'raw':!![],'where':{'id':_0x1a3f7e[_0x2a29('0x45')]['id']}},_0x22fcb4={};_0x22fcb4[_0x2a29('0x2e')]=_[_0x2a29('0x31')](db[_0x2a29('0x41')][_0x2a29('0x2c')]);_0x22fcb4[_0x2a29('0x30')]=_[_0x2a29('0x31')](_0x1a3f7e[_0x2a29('0x30')]);_0x22fcb4[_0x2a29('0x46')]=_[_0x2a29('0x33')](_0x22fcb4[_0x2a29('0x2e')],_0x22fcb4[_0x2a29('0x30')]);_0x3d09f9[_0x2a29('0x34')]=_['intersection'](_0x22fcb4['model'],qs[_0x2a29('0x35')](_0x1a3f7e[_0x2a29('0x30')][_0x2a29('0x35')]));_0x3d09f9[_0x2a29('0x34')]=_0x3d09f9['attributes'][_0x2a29('0x36')]?_0x3d09f9['attributes']:_0x22fcb4[_0x2a29('0x2e')];if(_0x1a3f7e[_0x2a29('0x30')][_0x2a29('0x3f')]){_0x3d09f9['include']=[{'all':!![]}];}_0x3d09f9=_[_0x2a29('0x3d')]({},_0x3d09f9,_0x1a3f7e[_0x2a29('0x3e')]);return db[_0x2a29('0x41')][_0x2a29('0x47')](_0x3d09f9)[_0x2a29('0x24')](handleEntityNotFound(_0x18e86e,null))[_0x2a29('0x24')](respondWithResult(_0x18e86e,null))['catch'](handleError(_0x18e86e,null));};exports[_0x2a29('0x48')]=function(_0x47911d,_0x5aefe5){if(_0x47911d[_0x2a29('0x49')]['id']){delete _0x47911d[_0x2a29('0x49')]['id'];}return db[_0x2a29('0x41')][_0x2a29('0x47')]({'where':{'id':_0x47911d[_0x2a29('0x45')]['id']}})[_0x2a29('0x24')](handleEntityNotFound(_0x5aefe5,null))[_0x2a29('0x24')](saveUpdates(_0x47911d['body'],null))['then'](respondWithResult(_0x5aefe5,null))['catch'](handleError(_0x5aefe5,null));};exports[_0x2a29('0x25')]=function(_0xc453c2,_0x1c2695){return db[_0x2a29('0x41')][_0x2a29('0x47')]({'where':{'id':_0xc453c2['params']['id']}})['then'](handleEntityNotFound(_0x1c2695,null))[_0x2a29('0x24')](removeEntity(_0x1c2695,null))['catch'](handleError(_0x1c2695,null));};exports[_0x2a29('0x4a')]=function(_0x15eca4,_0x387a18){var _0x37e6b4;return db[_0x2a29('0x4b')]['transaction'](function(_0x10f332){return db[_0x2a29('0x41')][_0x2a29('0x4a')](_0x15eca4[_0x2a29('0x49')],{'transaction':_0x10f332})[_0x2a29('0x24')](function(_0x9008c4){_0x37e6b4=_0x9008c4;var _0xb02b95={'type':db['Sequelize']['TEXT'],'transaction':_0x10f332};switch(_0x15eca4[_0x2a29('0x49')]['type']){case _0x2a29('0x4c'):_0xb02b95[_0x2a29('0x2d')]=db[_0x2a29('0x4d')]['TEXT'];break;case _0x2a29('0x4e'):_0xb02b95[_0x2a29('0x2d')]=db['Sequelize']['INTEGER'];break;case _0x2a29('0x4f'):_0xb02b95[_0x2a29('0x2d')]=db['Sequelize'][_0x2a29('0x50')];_0xb02b95[_0x2a29('0x51')]=![];break;default:}return db[_0x2a29('0x4b')][_0x2a29('0x52')][_0x2a29('0x53')](_0x2a29('0x54'),util[_0x2a29('0x55')](_0x2a29('0x56'),_0x37e6b4['id']),_0xb02b95);})[_0x2a29('0x24')](function(){return _0x37e6b4;});})[_0x2a29('0x24')](respondWithResult(_0x387a18,0xc9))[_0x2a29('0x57')](handleError(_0x387a18,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 72fb8be..615b786 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 _0x4df2=['rimraf','../../config/environment','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x923c23,_0x44e057){var _0x1fcba5=function(_0x17729f){while(--_0x17729f){_0x923c23['push'](_0x923c23['shift']());}};_0x1fcba5(++_0x44e057);}(_0x4df2,0xbf));var _0x24df=function(_0x1acdb9,_0x2af077){_0x1acdb9=_0x1acdb9-0x0;var _0x5b5614=_0x4df2[_0x1acdb9];return _0x5b5614;};'use strict';var _=require(_0x24df('0x0'));var util=require(_0x24df('0x1'));var logger=require(_0x24df('0x2'))('api');var moment=require(_0x24df('0x3'));var BPromise=require(_0x24df('0x4'));var rp=require(_0x24df('0x5'));var fs=require('fs');var path=require(_0x24df('0x6'));var rimraf=require(_0x24df('0x7'));var config=require(_0x24df('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x2efb17,_0x200ad7){return _0x2efb17['define'](_0x24df('0x9'),attributes,{'tableName':_0x24df('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed8c=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x2f812d,_0x4032e9){var _0x55d5fe=function(_0x5cac5d){while(--_0x5cac5d){_0x2f812d['push'](_0x2f812d['shift']());}};_0x55d5fe(++_0x4032e9);}(_0xed8c,0x135));var _0xced8=function(_0x150644,_0x134539){_0x150644=_0x150644-0x0;var _0x161b9c=_0xed8c[_0x150644];return _0x161b9c;};'use strict';var _=require(_0xced8('0x0'));var util=require(_0xced8('0x1'));var logger=require(_0xced8('0x2'))(_0xced8('0x3'));var moment=require(_0xced8('0x4'));var BPromise=require(_0xced8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xced8('0x6'));var config=require(_0xced8('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xced8('0x8')]=function(_0x546f16,_0x3e282b){return _0x546f16[_0xced8('0x9')]('CmCustomField',attributes,{'tableName':_0xced8('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index ecda92f..11f9da5 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 _0xa8a8=['stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x21b085,_0x15deff){var _0x2b986e=function(_0x54cca6){while(--_0x54cca6){_0x21b085['push'](_0x21b085['shift']());}};_0x2b986e(++_0x15deff);}(_0xa8a8,0xec));var _0x8a8a=function(_0x22c24d,_0x40253d){_0x22c24d=_0x22c24d-0x0;var _0x5787d5=_0xa8a8[_0x22c24d];return _0x5787d5;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('CmCustomField,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('CmCustomField,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file +var _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x713325,_0x1f7e46){var _0x1cb3d9=function(_0x134954){while(--_0x134954){_0x713325['push'](_0x713325['shift']());}};_0x1cb3d9(++_0x1f7e46);}(_0xd3d1,0x172));var _0x1d3d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd3d1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5aa70b0..2d93409 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 _0x8605=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id'];(function(_0x1b0659,_0x586a89){var _0x1e3bf6=function(_0x4fb9a2){while(--_0x4fb9a2){_0x1b0659['push'](_0x1b0659['shift']());}};_0x1e3bf6(++_0x586a89);}(_0x8605,0x71));var _0x5860=function(_0x58f78f,_0x3ee65d){_0x58f78f=_0x58f78f-0x0;var _0x5b44a9=_0x8605[_0x58f78f];return _0x5b44a9;};'use strict';var multer=require(_0x5860('0x0'));var util=require(_0x5860('0x1'));var path=require(_0x5860('0x2'));var timeout=require(_0x5860('0x3'));var express=require(_0x5860('0x4'));var router=express['Router']();var auth=require(_0x5860('0x5'));var interaction=require(_0x5860('0x6'));var config=require(_0x5860('0x7'));var controller=require(_0x5860('0x8'));router[_0x5860('0x9')]('/',auth[_0x5860('0xa')](),controller[_0x5860('0xb')]);router[_0x5860('0x9')](_0x5860('0xc'),auth[_0x5860('0xa')](),controller[_0x5860('0xd')]);router[_0x5860('0xe')]('/',auth[_0x5860('0xa')](),controller[_0x5860('0xf')]);router[_0x5860('0x10')](_0x5860('0xc'),auth[_0x5860('0xa')](),controller[_0x5860('0x11')]);router[_0x5860('0x12')](_0x5860('0xc'),auth[_0x5860('0xa')](),controller[_0x5860('0x13')]);module[_0x5860('0x14')]=router; \ No newline at end of file +var _0x3e90=['destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','/:id','isAuthenticated','post','create','update','delete'];(function(_0xdbe5be,_0x37ea07){var _0x42ea5a=function(_0x1dce53){while(--_0x1dce53){_0xdbe5be['push'](_0xdbe5be['shift']());}};_0x42ea5a(++_0x37ea07);}(_0x3e90,0xf0));var _0x03e9=function(_0x55b66e,_0x59e081){_0x55b66e=_0x55b66e-0x0;var _0x12b3fd=_0x3e90[_0x55b66e];return _0x12b3fd;};'use strict';var multer=require('multer');var util=require(_0x03e9('0x0'));var path=require('path');var timeout=require(_0x03e9('0x1'));var express=require(_0x03e9('0x2'));var router=express[_0x03e9('0x3')]();var auth=require(_0x03e9('0x4'));var interaction=require(_0x03e9('0x5'));var config=require(_0x03e9('0x6'));var controller=require(_0x03e9('0x7'));router[_0x03e9('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x03e9('0x9'),auth[_0x03e9('0xa')](),controller['show']);router[_0x03e9('0xb')]('/',auth[_0x03e9('0xa')](),controller[_0x03e9('0xc')]);router['put'](_0x03e9('0x9'),auth[_0x03e9('0xa')](),controller[_0x03e9('0xd')]);router[_0x03e9('0xe')](_0x03e9('0x9'),auth[_0x03e9('0xa')](),controller[_0x03e9('0xf')]);module[_0x03e9('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 0cdeb12..519a9be 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 _0x3c6c=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','exports','STRING'];(function(_0xbeb7d7,_0x5962f5){var _0x3549c5=function(_0x27a254){while(--_0x27a254){_0xbeb7d7['push'](_0xbeb7d7['shift']());}};_0x3549c5(++_0x5962f5);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x321fd4,_0x1e3aaa){_0x321fd4=_0x321fd4-0x0;var _0x3a5794=_0x3c6c[_0x321fd4];return _0x3a5794;};'use strict';var moment=require(_0xc3c6('0x0'));var Sequelize=require('sequelize');module[_0xc3c6('0x1')]={'phone':{'type':Sequelize[_0xc3c6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc3c6('0x4')],'defaultValue':moment()[_0xc3c6('0x5')](_0xc3c6('0x6'))},'countbusyretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc3c6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc3c6('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xc3c6('0x7')],'unique':_0xc3c6('0x8')},'CampaignId':{'type':Sequelize[_0xc3c6('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc3c6('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x425d=['moment','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue'];(function(_0x394349,_0x443247){var _0x5eb4b4=function(_0x587618){while(--_0x587618){_0x394349['push'](_0x394349['shift']());}};_0x5eb4b4(++_0x443247);}(_0x425d,0x1e0));var _0xd425=function(_0x1b3251,_0x58f958){_0x1b3251=_0x1b3251-0x0;var _0x370769=_0x425d[_0x1b3251];return _0x370769;};'use strict';var moment=require(_0xd425('0x0'));var Sequelize=require('sequelize');module[_0xd425('0x1')]={'phone':{'type':Sequelize[_0xd425('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xd425('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd425('0x4')],'defaultValue':moment()[_0xd425('0x5')](_0xd425('0x6'))},'countbusyretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd425('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd425('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd425('0x4')]},'priority':{'type':Sequelize[_0xd425('0x7')](0x2)[_0xd425('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd425('0x7')],'unique':_0xd425('0x9')},'ListId':{'type':Sequelize[_0xd425('0x7')],'unique':_0xd425('0x9')},'UserId':{'type':Sequelize[_0xd425('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xd425('0x7')],'unique':_0xd425('0x9')},'CampaignId':{'type':Sequelize[_0xd425('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd425('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index e98506b..2a9cab3 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 _0x8fa4=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','$and','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','CmHopper','count','includeAll','include','catch','show','params','keys','filtears','intersection','options','find','create','body','describe','destroy','VoiceQueueId','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues','preview','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','ASC','DESC','sequelize','literal','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','CmCompany','CmList','VoiceQueue','dialActive','getOpenContacts','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js'];(function(_0x42fd5d,_0x13aa97){var _0x2c3449=function(_0x125065){while(--_0x125065){_0x42fd5d['push'](_0x42fd5d['shift']());}};_0x2c3449(++_0x13aa97);}(_0x8fa4,0x112));var _0x48fa=function(_0x452b5b,_0x50975f){_0x452b5b=_0x452b5b-0x0;var _0x1a9324=_0x8fa4[_0x452b5b];return _0x1a9324;};'use strict';var pdf=require(_0x48fa('0x0'));var emlformat=require(_0x48fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x48fa('0x2'));var jsonpatch=require(_0x48fa('0x3'));var rp=require(_0x48fa('0x4'));var moment=require(_0x48fa('0x5'));var BPromise=require(_0x48fa('0x6'));var Mustache=require(_0x48fa('0x7'));var util=require(_0x48fa('0x8'));var path=require(_0x48fa('0x9'));var sox=require(_0x48fa('0xa'));var csv=require(_0x48fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x48fa('0xc'));var squel=require('squel');var crypto=require(_0x48fa('0xd'));var jsforce=require(_0x48fa('0xe'));var deskjs=require(_0x48fa('0xf'));var toCsv=require(_0x48fa('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48fa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x48fa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x48fa('0x12'));var logger=require(_0x48fa('0x13'))(_0x48fa('0x14'));var utils=require(_0x48fa('0x15'));var config=require(_0x48fa('0x16'));var licenseUtil=require(_0x48fa('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48081f,_0x36fcac){_0x36fcac=_0x36fcac||0xcc;return function(_0x52212d){if(_0x52212d){return _0x48081f[_0x48fa('0x18')](_0x36fcac);}return _0x48081f[_0x48fa('0x19')](_0x36fcac)[_0x48fa('0x1a')]();};}function respondWithResult(_0x2827f2,_0x2cac4d){_0x2cac4d=_0x2cac4d||0xc8;return function(_0x2ca3b7){if(_0x2ca3b7){return _0x2827f2[_0x48fa('0x19')](_0x2cac4d)[_0x48fa('0x1b')](_0x2ca3b7);}};}function respondWithFilteredResult(_0x42199c,_0x256d88){return function(_0x259ce8){if(_0x259ce8){var _0x2706dc=_0x259ce8['count'],_0x2b97b7=_0x256d88['offset'],_0x5a9ee6=_0x256d88[_0x48fa('0x1c')]+_0x256d88[_0x48fa('0x1d')],_0x334c72;if(_0x5a9ee6>=_0x2706dc){_0x5a9ee6=_0x2706dc;_0x334c72=0xc8;}else{_0x334c72=0xce;}_0x42199c[_0x48fa('0x19')](_0x334c72);return _0x42199c[_0x48fa('0x1e')](_0x48fa('0x1f'),_0x2b97b7+'-'+_0x5a9ee6+'/'+_0x2706dc)[_0x48fa('0x1b')](_0x259ce8);}return null;};}function patchUpdates(_0x3b5794){return function(_0x52d766){try{jsonpatch['apply'](_0x52d766,_0x3b5794,!![]);}catch(_0x5b8989){return BPromise[_0x48fa('0x20')](_0x5b8989);}return _0x52d766[_0x48fa('0x21')]();};}function saveUpdates(_0x7342f3,_0x1905d4){return function(_0x488e1f){if(_0x488e1f){return _0x488e1f[_0x48fa('0x22')](_0x7342f3)['then'](function(_0xac5641){return _0xac5641;});}return null;};}function removeEntity(_0x515eb8,_0x32ac6c){return function(_0x56fa9e){if(_0x56fa9e){return _0x56fa9e['destroy']()[_0x48fa('0x23')](function(){_0x515eb8[_0x48fa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548a5d,_0x297bf7){return function(_0x5c7f3a){if(!_0x5c7f3a){_0x548a5d[_0x48fa('0x18')](0x194);}return _0x5c7f3a;};}function handleError(_0x2b0ab8,_0x5f2ac1){_0x5f2ac1=_0x5f2ac1||0x1f4;return function(_0x4d4981){logger['error'](_0x4d4981[_0x48fa('0x24')]);if(_0x4d4981['name']){delete _0x4d4981[_0x48fa('0x25')];}_0x2b0ab8[_0x48fa('0x19')](_0x5f2ac1)[_0x48fa('0x26')](_0x4d4981);};}exports['index']=function(_0x2fa521,_0x17609b){var _0x3ef443={},_0x220899={},_0x57a25f={'count':0x0,'rows':[]};var _0xb346a0=_['map'](db['CmHopper'][_0x48fa('0x27')],function(_0x514731){return{'name':_0x514731[_0x48fa('0x28')],'type':_0x514731['type'][_0x48fa('0x29')]};});_0x220899[_0x48fa('0x2a')]=_[_0x48fa('0x2b')](_0xb346a0,_0x48fa('0x25'));_0x220899[_0x48fa('0x2c')]=_['keys'](_0x2fa521['query']);_0x220899[_0x48fa('0x2d')]=_['intersection'](_0x220899['model'],_0x220899['query']);_0x220899[_0x48fa('0x2d')]=_['concat'](_0x220899[_0x48fa('0x2d')],[_0x48fa('0x2e'),'$or',_0x48fa('0x2f'),_0x48fa('0x30'),'$lt','$lte',_0x48fa('0x31'),_0x48fa('0x32'),_0x48fa('0x33'),_0x48fa('0x34'),_0x48fa('0x35'),_0x48fa('0x36'),_0x48fa('0x37'),_0x48fa('0x38'),'$notLike','$iLike',_0x48fa('0x39'),_0x48fa('0x38'),'$overlap',_0x48fa('0x3a'),'$contained',_0x48fa('0x3b')]);_0x3ef443[_0x48fa('0x3c')]=_['intersection'](_0x220899[_0x48fa('0x2a')],qs[_0x48fa('0x3d')](_0x2fa521['query'][_0x48fa('0x3d')]));_0x3ef443[_0x48fa('0x3c')]=_0x3ef443['attributes'][_0x48fa('0x3e')]?_0x3ef443[_0x48fa('0x3c')]:_0x220899['model'];if(!_0x2fa521['query'][_0x48fa('0x3f')](_0x48fa('0x40'))){_0x3ef443[_0x48fa('0x1d')]=qs[_0x48fa('0x1d')](_0x2fa521[_0x48fa('0x2c')][_0x48fa('0x1d')]);_0x3ef443['offset']=qs[_0x48fa('0x1c')](_0x2fa521[_0x48fa('0x2c')][_0x48fa('0x1c')]);}_0x3ef443[_0x48fa('0x41')]=qs['sort'](_0x2fa521['query'][_0x48fa('0x42')]);_0x3ef443['where']=qs[_0x48fa('0x2d')](_[_0x48fa('0x43')](_0x2fa521[_0x48fa('0x2c')],_0x220899[_0x48fa('0x2d')]),_0xb346a0);if(_0x2fa521[_0x48fa('0x2c')][_0x48fa('0x44')]){_0x3ef443[_0x48fa('0x45')]=_[_0x48fa('0x46')](_0x3ef443['where'],{'$or':_[_0x48fa('0x2b')](_0xb346a0,function(_0x485e79){if(_0x485e79[_0x48fa('0x47')]!==_0x48fa('0x48')){var _0x14e7cc={};_0x14e7cc[_0x485e79['name']]={'$like':'%'+_0x2fa521[_0x48fa('0x2c')][_0x48fa('0x44')]+'%'};return _0x14e7cc;}})});}_0x3ef443=_[_0x48fa('0x46')]({},_0x3ef443,_0x2fa521['options']);var _0x105a26={'where':_0x3ef443[_0x48fa('0x45')]};return db[_0x48fa('0x49')]['count'](_0x105a26)[_0x48fa('0x23')](function(_0x1abd22){_0x57a25f[_0x48fa('0x4a')]=_0x1abd22;if(_0x2fa521[_0x48fa('0x2c')][_0x48fa('0x4b')]){_0x3ef443[_0x48fa('0x4c')]=[{'all':!![]}];}return db[_0x48fa('0x49')]['findAll'](_0x3ef443);})[_0x48fa('0x23')](function(_0x2b9434){_0x57a25f['rows']=_0x2b9434;return _0x57a25f;})[_0x48fa('0x23')](respondWithFilteredResult(_0x17609b,_0x3ef443))[_0x48fa('0x4d')](handleError(_0x17609b,null));};exports[_0x48fa('0x4e')]=function(_0x23ebde,_0x3d3b52){var _0x489640={'raw':!![],'where':{'id':_0x23ebde[_0x48fa('0x4f')]['id']}},_0x139d49={};_0x139d49[_0x48fa('0x2a')]=_[_0x48fa('0x50')](db[_0x48fa('0x49')][_0x48fa('0x27')]);_0x139d49[_0x48fa('0x2c')]=_['keys'](_0x23ebde[_0x48fa('0x2c')]);_0x139d49[_0x48fa('0x51')]=_[_0x48fa('0x52')](_0x139d49['model'],_0x139d49['query']);_0x489640[_0x48fa('0x3c')]=_[_0x48fa('0x52')](_0x139d49[_0x48fa('0x2a')],qs[_0x48fa('0x3d')](_0x23ebde[_0x48fa('0x2c')]['fields']));_0x489640['attributes']=_0x489640[_0x48fa('0x3c')][_0x48fa('0x3e')]?_0x489640[_0x48fa('0x3c')]:_0x139d49[_0x48fa('0x2a')];if(_0x23ebde[_0x48fa('0x2c')]['includeAll']){_0x489640[_0x48fa('0x4c')]=[{'all':!![]}];}_0x489640=_['merge']({},_0x489640,_0x23ebde[_0x48fa('0x53')]);return db['CmHopper'][_0x48fa('0x54')](_0x489640)[_0x48fa('0x23')](handleEntityNotFound(_0x3d3b52,null))[_0x48fa('0x23')](respondWithResult(_0x3d3b52,null))['catch'](handleError(_0x3d3b52,null));};exports[_0x48fa('0x55')]=function(_0x5b2f16,_0x19fc49){return db[_0x48fa('0x49')][_0x48fa('0x55')](_0x5b2f16[_0x48fa('0x56')],{})['then'](respondWithResult(_0x19fc49,0xc9))[_0x48fa('0x4d')](handleError(_0x19fc49,null));};exports['update']=function(_0x5cf98f,_0x28de58){if(_0x5cf98f[_0x48fa('0x56')]['id']){delete _0x5cf98f[_0x48fa('0x56')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x5cf98f[_0x48fa('0x4f')]['id']}})[_0x48fa('0x23')](handleEntityNotFound(_0x28de58,null))[_0x48fa('0x23')](saveUpdates(_0x5cf98f[_0x48fa('0x56')],null))['then'](respondWithResult(_0x28de58,null))['catch'](handleError(_0x28de58,null));};exports[_0x48fa('0x57')]=function(_0x37b15d,_0x981ffe){return db['CmHopper']['describe']()[_0x48fa('0x23')](respondWithResult(_0x981ffe,null))['catch'](handleError(_0x981ffe,null));};exports[_0x48fa('0x58')]=function(_0x4a7d79,_0x24718d){var _0x276039;return db[_0x48fa('0x49')]['find']({'where':{'id':_0x4a7d79[_0x48fa('0x4f')]['id']}})[_0x48fa('0x23')](handleEntityNotFound(_0x24718d,null))[_0x48fa('0x23')](function(_0x465bfe){if(_0x465bfe){return _0x465bfe['destroy']()[_0x48fa('0x23')](function(_0x1423eb){return _0x1423eb;});}})['then'](function(_0x3707b2){_0x276039=_0x3707b2;if(_0x3707b2){if(_0x3707b2[_0x48fa('0x59')]||_0x3707b2[_0x48fa('0x5a')]){return db[_0x3707b2[_0x48fa('0x59')]?'VoiceQueue':'Campaign'][_0x48fa('0x54')]({'where':{'id':_0x3707b2[_0x48fa('0x59')]?_0x3707b2[_0x48fa('0x59')]:_0x3707b2[_0x48fa('0x5a')]},'attributes':['id','name'],'raw':!![]});}}})[_0x48fa('0x23')](function(_0x4f67fa){var _0x473523={};if(_0x4f67fa){_[_0x48fa('0x46')](_0x473523,_[_0x48fa('0x5b')](_0x276039[_0x48fa('0x5c')],[_0x48fa('0x5d'),_0x48fa('0x5e'),'id']));_0x473523[_0x48fa('0x5f')]=0x15;_0x473523[_0x48fa('0x60')]=_0x48fa('0x61');_0x473523[_0x48fa('0x62')]=_0x4f67fa[_0x48fa('0x25')];_0x473523[_0x48fa('0x63')]=_0x4a7d79['user'][_0x48fa('0x25')];_0x473523[_0x48fa('0x64')]=_0x4a7d79[_0x48fa('0x65')]['id'];_0x473523[_0x48fa('0x61')]=!![];_0x473523[_0x48fa('0x66')]=moment()[_0x48fa('0x67')](_0x48fa('0x68'));_0x473523[_0x48fa('0x69')]=_0x276039[_0x48fa('0x6a')];_0x473523[_0x48fa('0x6b')]=_0x276039[_0x48fa('0x59')]?_0x48fa('0x6c'):_0x48fa('0x6d');return db['CmContact'][_0x48fa('0x54')]({'where':{'id':_0x473523[_0x48fa('0x6e')]},'attributes':[_0x48fa('0x6f'),_0x48fa('0x70')]})[_0x48fa('0x23')](function(_0x403e09){if(!_[_0x48fa('0x71')](_0x24718d)&&!_['isNil'](_0x403e09[_0x48fa('0x6f')])){_0x473523[_0x48fa('0x72')]=_0x403e09['firstName'];if(!_[_0x48fa('0x71')](_0x403e09[_0x48fa('0x70')])){_0x473523['calleridname']+='\x20'+_0x403e09['lastName'];}}})[_0x48fa('0x73')](function(){return db[_0x48fa('0x74')]['create'](_0x473523);});}})[_0x48fa('0x23')](function(){return _0x24718d[_0x48fa('0x19')](0xcc)[_0x48fa('0x1a')]();})[_0x48fa('0x4d')](handleError(_0x24718d,null));};exports[_0x48fa('0x75')]=function(_0x107338,_0x38890d,_0x4c824d){var _0x3b9341=[];return db[_0x48fa('0x76')][_0x48fa('0x57')]()[_0x48fa('0x23')](function(_0x46f2e3){_0x3b9341=_[_0x48fa('0x50')](_0x46f2e3);return _0x107338[_0x48fa('0x65')][_0x48fa('0x77')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x48fa('0x78')},'attributes':['id',_0x48fa('0x79')],'raw':!![]});})[_0x48fa('0x23')](function(_0x4c6321){if(_0x4c6321&&_0x4c6321[_0x48fa('0x3e')]){return db['sequelize'][_0x48fa('0x7a')](function(_0x3e4ba4){var _0xb0d87f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x48fa('0x67')](_0x48fa('0x68'))},'VoiceQueueId':{'$in':_[_0x48fa('0x2b')](_0x4c6321,'id')},'$or':[{'UserId':null},{'UserId':_0x107338['user']['id']}]};var _0x4a0715=[];if(_0x107338[_0x48fa('0x56')][_0x48fa('0x7b')]&&_0x107338['body'][_0x48fa('0x7b')]===_0x48fa('0x7c')){if(!_[_0x48fa('0x7d')](_0x107338[_0x48fa('0x56')][_0x48fa('0x7e')])){_0xb0d87f['id']={'$in':_0x107338[_0x48fa('0x56')]['hopperIds']};}_0x4a0715=[['priority',_0x48fa('0x7f')],['scheduledAt',_0x4c6321[0x0][_0x48fa('0x79')]===_0x48fa('0x7f')?_0x48fa('0x80'):_0x48fa('0x7f')],db[_0x48fa('0x81')][_0x48fa('0x82')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x48fa('0x80')]];}else{if(!_[_0x48fa('0x7d')](_0x107338[_0x48fa('0x56')][_0x48fa('0x7e')])){_0xb0d87f['id']={'$notIn':_0x107338[_0x48fa('0x56')][_0x48fa('0x7e')]};}_0x4a0715=[['priority','DESC'],[_0x48fa('0x83'),_0x4c6321[0x0]['dialOrderByScheduledAt']],db[_0x48fa('0x81')][_0x48fa('0x82')](_0x48fa('0x84')),['id','ASC']];}return db[_0x48fa('0x49')]['findOne']({'attributes':['id',_0x48fa('0x85')],'where':_0xb0d87f,'order':_0x4a0715,'transaction':_0x3e4ba4,'lock':_0x3e4ba4[_0x48fa('0x86')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x3b9341,'include':[{'model':db[_0x48fa('0x87')],'as':'Company','attributes':['id',_0x48fa('0x25')]}]},{'model':db[_0x48fa('0x88')],'as':'List','attributes':['id',_0x48fa('0x25')]},{'model':db[_0x48fa('0x89')],'as':'Queue','attributes':['id',_0x48fa('0x25'),_0x48fa('0x8a')]}]})[_0x48fa('0x23')](function(_0x3f5783){if(_0x3f5783){return _0x3f5783[_0x48fa('0x22')]({'UserId':_0x107338[_0x48fa('0x65')]['id']},{'transaction':_0x3e4ba4});}});});}})['then'](handleEntityNotFound(_0x38890d,null))['then'](respondWithResult(_0x38890d,null))[_0x48fa('0x4d')](handleError(_0x38890d,null));};exports[_0x48fa('0x8b')]=function(_0x37ad63,_0x8ba406,_0xa32567){return _0x37ad63[_0x48fa('0x65')][_0x48fa('0x77')]({'where':{'type':_0x48fa('0x8c'),'dialActive':!![],'dialMethod':_0x48fa('0x78')},'attributes':['id'],'raw':!![]})[_0x48fa('0x23')](function(_0xeee268){if(_0xeee268&&_0xeee268['length']){return db[_0x48fa('0x49')][_0x48fa('0x4a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x48fa('0x68'))},'VoiceQueueId':{'$in':_[_0x48fa('0x2b')](_0xeee268,'id')},'$or':[{'UserId':null},{'UserId':_0x37ad63[_0x48fa('0x65')]['id']}]}});}return 0x0;})[_0x48fa('0x23')](function(_0x54049d){if(!_[_0x48fa('0x71')](_0x54049d)&&_[_0x48fa('0x8d')](_0x54049d)){return _0x8ba406[_0x48fa('0x19')](0xc8)['json']({'contacts':_0x54049d});}else{logger[_0x48fa('0x8e')](_0x48fa('0x8f'),_0x48fa('0x8b'),0x194,_0x48fa('0x90'));_0x8ba406[_0x48fa('0x18')](0x194);}})['catch'](handleError(_0x8ba406,null));}; \ No newline at end of file +var _0xff6c=['order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','params','filtears','find','catch','create','body','describe','CampaignId','Campaign','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','UserId','user','deleted','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','dialOrderByScheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','hopperIds','priority','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','CmCompany','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$gte','$lte','$ne','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty'];(function(_0x163ae5,_0x5ca9ec){var _0x3bfa47=function(_0x19c8cd){while(--_0x19c8cd){_0x163ae5['push'](_0x163ae5['shift']());}};_0x3bfa47(++_0x5ca9ec);}(_0xff6c,0x177));var _0xcff6=function(_0x49c07d,_0x55cfc9){_0x49c07d=_0x49c07d-0x0;var _0x5b6e9d=_0xff6c[_0x49c07d];return _0x5b6e9d;};'use strict';var pdf=require(_0xcff6('0x0'));var emlformat=require(_0xcff6('0x1'));var rimraf=require(_0xcff6('0x2'));var zipdir=require(_0xcff6('0x3'));var jsonpatch=require(_0xcff6('0x4'));var rp=require(_0xcff6('0x5'));var moment=require(_0xcff6('0x6'));var BPromise=require(_0xcff6('0x7'));var Mustache=require(_0xcff6('0x8'));var util=require(_0xcff6('0x9'));var path=require(_0xcff6('0xa'));var sox=require(_0xcff6('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcff6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcff6('0xd'));var deskjs=require(_0xcff6('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcff6('0xf'));var Papa=require(_0xcff6('0x10'));var Redis=require(_0xcff6('0x11'));var authService=require(_0xcff6('0x12'));var qs=require(_0xcff6('0x13'));var as=require(_0xcff6('0x14'));var hardwareService=require(_0xcff6('0x15'));var logger=require(_0xcff6('0x16'))(_0xcff6('0x17'));var utils=require('../../config/utils');var config=require(_0xcff6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcff6('0x19'))['db'];function respondWithStatusCode(_0x72cbd4,_0x4cda67){_0x4cda67=_0x4cda67||0xcc;return function(_0x3018cb){if(_0x3018cb){return _0x72cbd4[_0xcff6('0x1a')](_0x4cda67);}return _0x72cbd4['status'](_0x4cda67)[_0xcff6('0x1b')]();};}function respondWithResult(_0x24b25c,_0x2e0d67){_0x2e0d67=_0x2e0d67||0xc8;return function(_0xe22bdb){if(_0xe22bdb){return _0x24b25c[_0xcff6('0x1c')](_0x2e0d67)['json'](_0xe22bdb);}};}function respondWithFilteredResult(_0x19175a,_0xf0d1c0){return function(_0x83fa82){if(_0x83fa82){var _0x50d238=_0x83fa82[_0xcff6('0x1d')],_0x268aa2=_0xf0d1c0['offset'],_0x26cde3=_0xf0d1c0[_0xcff6('0x1e')]+_0xf0d1c0[_0xcff6('0x1f')],_0x5b3c66;if(_0x26cde3>=_0x50d238){_0x26cde3=_0x50d238;_0x5b3c66=0xc8;}else{_0x5b3c66=0xce;}_0x19175a[_0xcff6('0x1c')](_0x5b3c66);return _0x19175a['set'](_0xcff6('0x20'),_0x268aa2+'-'+_0x26cde3+'/'+_0x50d238)[_0xcff6('0x21')](_0x83fa82);}return null;};}function patchUpdates(_0x3952d3){return function(_0x115da0){try{jsonpatch[_0xcff6('0x22')](_0x115da0,_0x3952d3,!![]);}catch(_0x38379f){return BPromise[_0xcff6('0x23')](_0x38379f);}return _0x115da0[_0xcff6('0x24')]();};}function saveUpdates(_0x197579,_0x1760fe){return function(_0x3c4340){if(_0x3c4340){return _0x3c4340[_0xcff6('0x25')](_0x197579)['then'](function(_0x22de1f){return _0x22de1f;});}return null;};}function removeEntity(_0x598c8d,_0x2bddb9){return function(_0x144688){if(_0x144688){return _0x144688[_0xcff6('0x26')]()[_0xcff6('0x27')](function(){_0x598c8d[_0xcff6('0x1c')](0xcc)[_0xcff6('0x1b')]();});}};}function handleEntityNotFound(_0x416853,_0x3ab8b8){return function(_0x4ad90b){if(!_0x4ad90b){_0x416853['sendStatus'](0x194);}return _0x4ad90b;};}function handleError(_0x53bd1c,_0x4c1b1d){_0x4c1b1d=_0x4c1b1d||0x1f4;return function(_0x1d4370){logger[_0xcff6('0x28')](_0x1d4370[_0xcff6('0x29')]);if(_0x1d4370['name']){delete _0x1d4370[_0xcff6('0x2a')];}_0x53bd1c['status'](_0x4c1b1d)[_0xcff6('0x2b')](_0x1d4370);};}exports[_0xcff6('0x2c')]=function(_0x181088,_0x22c98a){var _0x275b0b={},_0x9a6680={},_0x10dd8e={'count':0x0,'rows':[]};var _0x3f63d6=_[_0xcff6('0x2d')](db[_0xcff6('0x2e')]['rawAttributes'],function(_0xcaa9a8){return{'name':_0xcaa9a8[_0xcff6('0x2f')],'type':_0xcaa9a8[_0xcff6('0x30')][_0xcff6('0x31')]};});_0x9a6680[_0xcff6('0x32')]=_[_0xcff6('0x2d')](_0x3f63d6,_0xcff6('0x2a'));_0x9a6680[_0xcff6('0x33')]=_[_0xcff6('0x34')](_0x181088[_0xcff6('0x33')]);_0x9a6680[_0xcff6('0x35')]=_[_0xcff6('0x36')](_0x9a6680[_0xcff6('0x32')],_0x9a6680['query']);_0x9a6680['filters']=_[_0xcff6('0x37')](_0x9a6680[_0xcff6('0x35')],[_0xcff6('0x38'),_0xcff6('0x39'),_0xcff6('0x3a'),_0xcff6('0x3b'),'$lt',_0xcff6('0x3c'),_0xcff6('0x3d'),'$eq',_0xcff6('0x3e'),'$between',_0xcff6('0x3f'),_0xcff6('0x40'),_0xcff6('0x41'),_0xcff6('0x42'),_0xcff6('0x43'),_0xcff6('0x44'),_0xcff6('0x45'),_0xcff6('0x42'),_0xcff6('0x46'),_0xcff6('0x47'),_0xcff6('0x48'),_0xcff6('0x49')]);_0x275b0b[_0xcff6('0x4a')]=_[_0xcff6('0x36')](_0x9a6680[_0xcff6('0x32')],qs['fields'](_0x181088[_0xcff6('0x33')][_0xcff6('0x4b')]));_0x275b0b[_0xcff6('0x4a')]=_0x275b0b['attributes'][_0xcff6('0x4c')]?_0x275b0b['attributes']:_0x9a6680['model'];if(!_0x181088['query'][_0xcff6('0x4d')]('nolimit')){_0x275b0b['limit']=qs[_0xcff6('0x1f')](_0x181088[_0xcff6('0x33')][_0xcff6('0x1f')]);_0x275b0b[_0xcff6('0x1e')]=qs['offset'](_0x181088[_0xcff6('0x33')][_0xcff6('0x1e')]);}_0x275b0b[_0xcff6('0x4e')]=qs[_0xcff6('0x4f')](_0x181088[_0xcff6('0x33')][_0xcff6('0x4f')]);_0x275b0b[_0xcff6('0x50')]=qs[_0xcff6('0x35')](_['pick'](_0x181088[_0xcff6('0x33')],_0x9a6680[_0xcff6('0x35')]),_0x3f63d6);if(_0x181088[_0xcff6('0x33')]['filter']){_0x275b0b[_0xcff6('0x50')]=_[_0xcff6('0x51')](_0x275b0b[_0xcff6('0x50')],{'$or':_['map'](_0x3f63d6,function(_0x19928b){if(_0x19928b[_0xcff6('0x30')]!==_0xcff6('0x52')){var _0x1b5138={};_0x1b5138[_0x19928b['name']]={'$like':'%'+_0x181088[_0xcff6('0x33')]['filter']+'%'};return _0x1b5138;}})});}_0x275b0b=_[_0xcff6('0x51')]({},_0x275b0b,_0x181088[_0xcff6('0x53')]);var _0x30d75a={'where':_0x275b0b[_0xcff6('0x50')]};return db[_0xcff6('0x2e')][_0xcff6('0x1d')](_0x30d75a)[_0xcff6('0x27')](function(_0x361c95){_0x10dd8e[_0xcff6('0x1d')]=_0x361c95;if(_0x181088[_0xcff6('0x33')][_0xcff6('0x54')]){_0x275b0b[_0xcff6('0x55')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x275b0b);})[_0xcff6('0x27')](function(_0x38648a){_0x10dd8e[_0xcff6('0x56')]=_0x38648a;return _0x10dd8e;})['then'](respondWithFilteredResult(_0x22c98a,_0x275b0b))['catch'](handleError(_0x22c98a,null));};exports['show']=function(_0x4f1d93,_0x5885f7){var _0x1b17a4={'raw':!![],'where':{'id':_0x4f1d93[_0xcff6('0x57')]['id']}},_0x591021={};_0x591021[_0xcff6('0x32')]=_[_0xcff6('0x34')](db[_0xcff6('0x2e')]['rawAttributes']);_0x591021[_0xcff6('0x33')]=_['keys'](_0x4f1d93[_0xcff6('0x33')]);_0x591021[_0xcff6('0x58')]=_['intersection'](_0x591021['model'],_0x591021[_0xcff6('0x33')]);_0x1b17a4[_0xcff6('0x4a')]=_[_0xcff6('0x36')](_0x591021[_0xcff6('0x32')],qs[_0xcff6('0x4b')](_0x4f1d93[_0xcff6('0x33')]['fields']));_0x1b17a4['attributes']=_0x1b17a4[_0xcff6('0x4a')][_0xcff6('0x4c')]?_0x1b17a4[_0xcff6('0x4a')]:_0x591021[_0xcff6('0x32')];if(_0x4f1d93['query'][_0xcff6('0x54')]){_0x1b17a4[_0xcff6('0x55')]=[{'all':!![]}];}_0x1b17a4=_[_0xcff6('0x51')]({},_0x1b17a4,_0x4f1d93[_0xcff6('0x53')]);return db[_0xcff6('0x2e')][_0xcff6('0x59')](_0x1b17a4)['then'](handleEntityNotFound(_0x5885f7,null))[_0xcff6('0x27')](respondWithResult(_0x5885f7,null))[_0xcff6('0x5a')](handleError(_0x5885f7,null));};exports['create']=function(_0x2cc0fe,_0xe2a685){return db[_0xcff6('0x2e')][_0xcff6('0x5b')](_0x2cc0fe[_0xcff6('0x5c')],{})[_0xcff6('0x27')](respondWithResult(_0xe2a685,0xc9))['catch'](handleError(_0xe2a685,null));};exports['update']=function(_0x531568,_0xa64a97){if(_0x531568[_0xcff6('0x5c')]['id']){delete _0x531568[_0xcff6('0x5c')]['id'];}return db[_0xcff6('0x2e')][_0xcff6('0x59')]({'where':{'id':_0x531568['params']['id']}})[_0xcff6('0x27')](handleEntityNotFound(_0xa64a97,null))[_0xcff6('0x27')](saveUpdates(_0x531568[_0xcff6('0x5c')],null))[_0xcff6('0x27')](respondWithResult(_0xa64a97,null))['catch'](handleError(_0xa64a97,null));};exports[_0xcff6('0x5d')]=function(_0x2ac863,_0xf145a8){return db[_0xcff6('0x2e')]['describe']()[_0xcff6('0x27')](respondWithResult(_0xf145a8,null))[_0xcff6('0x5a')](handleError(_0xf145a8,null));};exports['destroy']=function(_0x4e634c,_0x2106d9){var _0x21e3a8;return db[_0xcff6('0x2e')][_0xcff6('0x59')]({'where':{'id':_0x4e634c[_0xcff6('0x57')]['id']}})[_0xcff6('0x27')](handleEntityNotFound(_0x2106d9,null))[_0xcff6('0x27')](function(_0x43cb5e){if(_0x43cb5e){return _0x43cb5e['destroy']()[_0xcff6('0x27')](function(_0x3b8f27){return _0x3b8f27;});}})[_0xcff6('0x27')](function(_0xc39a18){_0x21e3a8=_0xc39a18;if(_0xc39a18){if(_0xc39a18['VoiceQueueId']||_0xc39a18[_0xcff6('0x5e')]){return db[_0xc39a18['VoiceQueueId']?'VoiceQueue':_0xcff6('0x5f')][_0xcff6('0x59')]({'where':{'id':_0xc39a18['VoiceQueueId']?_0xc39a18[_0xcff6('0x60')]:_0xc39a18[_0xcff6('0x5e')]},'attributes':['id',_0xcff6('0x2a')],'raw':!![]});}}})[_0xcff6('0x27')](function(_0x2e496f){var _0xcb666={};if(_0x2e496f){_['merge'](_0xcb666,_[_0xcff6('0x61')](_0x21e3a8[_0xcff6('0x62')],[_0xcff6('0x63'),_0xcff6('0x64'),'id']));_0xcb666[_0xcff6('0x65')]=0x15;_0xcb666[_0xcff6('0x66')]='deleted';_0xcb666[_0xcff6('0x67')]=_0x2e496f[_0xcff6('0x2a')];_0xcb666['membername']=_0x4e634c['user'][_0xcff6('0x2a')];_0xcb666[_0xcff6('0x68')]=_0x4e634c[_0xcff6('0x69')]['id'];_0xcb666[_0xcff6('0x6a')]=!![];_0xcb666[_0xcff6('0x6b')]=moment()[_0xcff6('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0xcb666[_0xcff6('0x6d')]=_0x21e3a8[_0xcff6('0x6e')];_0xcb666['campaigntype']=_0x21e3a8[_0xcff6('0x60')]?_0xcff6('0x6f'):_0xcff6('0x70');return db[_0xcff6('0x71')][_0xcff6('0x59')]({'where':{'id':_0xcb666[_0xcff6('0x72')]},'attributes':[_0xcff6('0x73'),_0xcff6('0x74')]})[_0xcff6('0x27')](function(_0x412377){if(!_[_0xcff6('0x75')](_0x2106d9)&&!_[_0xcff6('0x75')](_0x412377[_0xcff6('0x73')])){_0xcb666[_0xcff6('0x76')]=_0x412377[_0xcff6('0x73')];if(!_['isNil'](_0x412377[_0xcff6('0x74')])){_0xcb666[_0xcff6('0x76')]+='\x20'+_0x412377[_0xcff6('0x74')];}}})['finally'](function(){return db[_0xcff6('0x77')][_0xcff6('0x5b')](_0xcb666);});}})['then'](function(){return _0x2106d9['status'](0xcc)[_0xcff6('0x1b')]();})[_0xcff6('0x5a')](handleError(_0x2106d9,null));};exports[_0xcff6('0x78')]=function(_0x5c2786,_0x4f9a3b,_0x50c654){var _0x5e4ea0=[];return db['CmContact']['describe']()['then'](function(_0x390158){_0x5e4ea0=_[_0xcff6('0x34')](_0x390158);return _0x5c2786[_0xcff6('0x69')][_0xcff6('0x79')]({'where':{'type':_0xcff6('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x17b172){if(_0x17b172&&_0x17b172['length']){return db[_0xcff6('0x7b')][_0xcff6('0x7c')](function(_0x1877a9){var _0x5bf817={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcff6('0x6c')](_0xcff6('0x7d'))},'VoiceQueueId':{'$in':_[_0xcff6('0x2d')](_0x17b172,'id')},'$or':[{'UserId':null},{'UserId':_0x5c2786[_0xcff6('0x69')]['id']}]};var _0x2fd737=[];if(_0x5c2786['body'][_0xcff6('0x7e')]&&_0x5c2786[_0xcff6('0x5c')][_0xcff6('0x7e')]===_0xcff6('0x7f')){if(!_[_0xcff6('0x80')](_0x5c2786[_0xcff6('0x5c')]['hopperIds'])){_0x5bf817['id']={'$in':_0x5c2786[_0xcff6('0x5c')]['hopperIds']};}_0x2fd737=[['priority','ASC'],['scheduledAt',_0x17b172[0x0][_0xcff6('0x81')]===_0xcff6('0x82')?_0xcff6('0x83'):_0xcff6('0x82')],db[_0xcff6('0x7b')]['literal'](_0xcff6('0x84')),['id',_0xcff6('0x83')]];}else{if(!_[_0xcff6('0x80')](_0x5c2786[_0xcff6('0x5c')][_0xcff6('0x85')])){_0x5bf817['id']={'$notIn':_0x5c2786['body'][_0xcff6('0x85')]};}_0x2fd737=[[_0xcff6('0x86'),_0xcff6('0x83')],[_0xcff6('0x87'),_0x17b172[0x0][_0xcff6('0x81')]],db[_0xcff6('0x7b')][_0xcff6('0x88')](_0xcff6('0x89')),['id',_0xcff6('0x82')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xcff6('0x8a')],'where':_0x5bf817,'order':_0x2fd737,'transaction':_0x1877a9,'lock':_0x1877a9[_0xcff6('0x8b')]['UPDATE'],'include':[{'model':db[_0xcff6('0x71')],'as':'Contact','attributes':_0x5e4ea0,'include':[{'model':db[_0xcff6('0x8c')],'as':'Company','attributes':['id','name']}]},{'model':db[_0xcff6('0x8d')],'as':_0xcff6('0x8e'),'attributes':['id',_0xcff6('0x2a')]},{'model':db[_0xcff6('0x8f')],'as':_0xcff6('0x90'),'attributes':['id',_0xcff6('0x2a'),_0xcff6('0x91')]}]})[_0xcff6('0x27')](function(_0x3c2903){if(_0x3c2903){return _0x3c2903[_0xcff6('0x25')]({'UserId':_0x5c2786['user']['id']},{'transaction':_0x1877a9});}});});}})['then'](handleEntityNotFound(_0x4f9a3b,null))[_0xcff6('0x27')](respondWithResult(_0x4f9a3b,null))[_0xcff6('0x5a')](handleError(_0x4f9a3b,null));};exports[_0xcff6('0x92')]=function(_0xd73212,_0x501510,_0x322f70){return _0xd73212[_0xcff6('0x69')][_0xcff6('0x79')]({'where':{'type':_0xcff6('0x7a'),'dialActive':!![],'dialMethod':_0xcff6('0x93')},'attributes':['id'],'raw':!![]})[_0xcff6('0x27')](function(_0x58ea9f){if(_0x58ea9f&&_0x58ea9f[_0xcff6('0x4c')]){return db[_0xcff6('0x2e')][_0xcff6('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xcff6('0x6c')](_0xcff6('0x7d'))},'VoiceQueueId':{'$in':_[_0xcff6('0x2d')](_0x58ea9f,'id')},'$or':[{'UserId':null},{'UserId':_0xd73212[_0xcff6('0x69')]['id']}]}});}return 0x0;})[_0xcff6('0x27')](function(_0x371dcb){if(!_[_0xcff6('0x75')](_0x371dcb)&&_[_0xcff6('0x94')](_0x371dcb)){return _0x501510['status'](0xc8)[_0xcff6('0x21')]({'contacts':_0x371dcb});}else{logger['error'](_0xcff6('0x95'),'getOpenContacts',0x194,_0xcff6('0x96'));_0x501510[_0xcff6('0x1a')](0x194);}})['catch'](handleError(_0x501510,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 42164f7..c30957c 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 _0x4430=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','scheduledat','phone','priority'];(function(_0x5e271a,_0x385771){var _0x571e7c=function(_0x3246c6){while(--_0x3246c6){_0x5e271a['push'](_0x5e271a['shift']());}};_0x571e7c(++_0x385771);}(_0x4430,0xb6));var _0x0443=function(_0x5db65f,_0xf89cc8){_0x5db65f=_0x5db65f-0x0;var _0x34fb4b=_0x4430[_0x5db65f];return _0x34fb4b;};'use strict';var _=require('lodash');var util=require(_0x0443('0x0'));var logger=require(_0x0443('0x1'))(_0x0443('0x2'));var moment=require(_0x0443('0x3'));var BPromise=require(_0x0443('0x4'));var rp=require(_0x0443('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0443('0x6'));var config=require(_0x0443('0x7'));var attributes=require(_0x0443('0x8'));module[_0x0443('0x9')]=function(_0x29448b,_0x28a926){return _0x29448b['define'](_0x0443('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x0443('0xb'),'fields':[_0x0443('0xb')]},{'name':'phone','fields':[_0x0443('0xc')]},{'name':_0x0443('0xd'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4296=['./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x49e6ca,_0x3fb558){var _0x362189=function(_0x4e2304){while(--_0x4e2304){_0x49e6ca['push'](_0x49e6ca['shift']());}};_0x362189(++_0x3fb558);}(_0x4296,0xa1));var _0x6429=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x4296[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x6429('0x0'));var util=require(_0x6429('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6429('0x2'));var BPromise=require(_0x6429('0x3'));var rp=require(_0x6429('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6429('0x5'));var config=require(_0x6429('0x6'));var attributes=require(_0x6429('0x7'));module[_0x6429('0x8')]=function(_0x280e61,_0x1cf49c){return _0x280e61[_0x6429('0x9')](_0x6429('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x6429('0xb'),'fields':[_0x6429('0xb')]},{'name':'phone','fields':[_0x6429('0xc')]},{'name':_0x6429('0xd'),'fields':[_0x6429('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 99e5503..4cdf8e3 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 _0x835b=['name','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','GetContactRecallMe','LOCK','keys','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','catch','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','order','UPDATE','CmContact','Contact','User','Agent'];(function(_0x4eb662,_0x540e40){var _0x2d7889=function(_0xbe80a7){while(--_0xbe80a7){_0x4eb662['push'](_0x4eb662['shift']());}};_0x2d7889(++_0x540e40);}(_0x835b,0x123));var _0xb835=function(_0x6d13ac,_0x418c22){_0x6d13ac=_0x6d13ac-0x0;var _0x56c1a0=_0x835b[_0x6d13ac];return _0x56c1a0;};'use strict';var _=require('lodash');var util=require(_0xb835('0x0'));var moment=require(_0xb835('0x1'));var BPromise=require(_0xb835('0x2'));var rs=require(_0xb835('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb835('0x4'));var logger=require(_0xb835('0x5'))(_0xb835('0x6'));var config=require(_0xb835('0x7'));var jayson=require(_0xb835('0x8'));var client=jayson['client'][_0xb835('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26868e,_0x2f815b,_0x3e0d12){return new BPromise(function(_0x44e154,_0x46f764){return client['request'](_0x26868e,_0x3e0d12)['then'](function(_0x3575bc){logger[_0xb835('0xa')](_0xb835('0xb'),_0x2f815b,_0xb835('0xc'));logger[_0xb835('0xd')](_0xb835('0xe'),_0x2f815b,'request\x20sent',JSON[_0xb835('0xf')](_0x3575bc));if(_0x3575bc[_0xb835('0x10')]){if(_0x3575bc['error'][_0xb835('0x11')]===0x1f4){logger[_0xb835('0x10')](_0xb835('0xb'),_0x2f815b,_0x3575bc[_0xb835('0x10')][_0xb835('0x12')]);return _0x46f764(_0x3575bc[_0xb835('0x10')]['message']);}logger[_0xb835('0x10')]('CmHopper,\x20%s,\x20%s',_0x2f815b,_0x3575bc[_0xb835('0x10')]['message']);return _0x44e154(_0x3575bc[_0xb835('0x10')][_0xb835('0x12')]);}else{logger['info'](_0xb835('0xb'),_0x2f815b,_0xb835('0xc'));_0x44e154(_0x3575bc['result']['message']);}})['catch'](function(_0x11aa0d){logger[_0xb835('0x10')](_0xb835('0xb'),_0x2f815b,_0x11aa0d);_0x46f764(_0x11aa0d);});});}exports[_0xb835('0x13')]=function(_0x461172){var _0x57f967=this;return new Promise(function(_0x458f8b,_0x5989e1){return db[_0xb835('0x14')][_0xb835('0x15')]({'raw':_0x461172[_0xb835('0x16')]?_0x461172[_0xb835('0x16')][_0xb835('0x17')]===undefined?!![]:![]:!![],'where':_0x461172[_0xb835('0x16')]?_0x461172[_0xb835('0x16')][_0xb835('0x18')]||null:null,'attributes':_0x461172['options']?_0x461172[_0xb835('0x16')][_0xb835('0x19')]||null:null,'limit':_0x461172['options']?_0x461172[_0xb835('0x16')]['limit']||null:null,'include':_0x461172[_0xb835('0x16')]?_0x461172[_0xb835('0x16')][_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x461172['options']['include'],function(_0xb87f5f){return{'model':db[_0xb87f5f['model']],'as':_0xb87f5f['as'],'attributes':_0xb87f5f[_0xb835('0x19')],'include':_0xb87f5f['include']?_[_0xb835('0x1b')](_0xb87f5f[_0xb835('0x1a')],function(_0x40c2fa){return{'model':db[_0x40c2fa[_0xb835('0x1c')]],'as':_0x40c2fa['as'],'attributes':_0x40c2fa[_0xb835('0x19')],'include':_0x40c2fa[_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x40c2fa[_0xb835('0x1a')],function(_0xa4b8a0){return{'model':db[_0xa4b8a0[_0xb835('0x1c')]],'as':_0xa4b8a0['as'],'attributes':_0xa4b8a0[_0xb835('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb835('0x1d')](function(_0xff7a4d){logger[_0xb835('0xa')](_0xb835('0x13'),_0x461172);logger[_0xb835('0xd')]('GetCmHopper',_0x461172,JSON['stringify'](_0xff7a4d));_0x458f8b(_0xff7a4d);})[_0xb835('0x1e')](function(_0x5f4ed1){logger[_0xb835('0x10')](_0xb835('0x13'),_0x5f4ed1[_0xb835('0x12')],_0x461172);_0x5989e1(_0x57f967[_0xb835('0x10')](0x1f4,_0x5f4ed1['message']));});});};exports['ShowCmHopper']=function(_0x2268dc){var _0x53e5a7=this;return new Promise(function(_0x545033,_0x4849ae){return db['CmHopper'][_0xb835('0x1f')]({'raw':_0x2268dc[_0xb835('0x16')]?_0x2268dc['options'][_0xb835('0x17')]===undefined?!![]:![]:!![],'where':_0x2268dc[_0xb835('0x16')]?_0x2268dc[_0xb835('0x16')]['where']||null:null,'attributes':_0x2268dc['options']?_0x2268dc[_0xb835('0x16')][_0xb835('0x19')]||null:null,'include':_0x2268dc[_0xb835('0x16')]?_0x2268dc[_0xb835('0x16')][_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x2268dc[_0xb835('0x16')][_0xb835('0x1a')],function(_0x15224a){return{'model':db[_0x15224a[_0xb835('0x1c')]],'as':_0x15224a['as'],'attributes':_0x15224a[_0xb835('0x19')],'include':_0x15224a['include']?_[_0xb835('0x1b')](_0x15224a['include'],function(_0x4bb75a){return{'model':db[_0x4bb75a[_0xb835('0x1c')]],'as':_0x4bb75a['as'],'attributes':_0x4bb75a[_0xb835('0x19')],'include':_0x4bb75a[_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x4bb75a[_0xb835('0x1a')],function(_0x37df3e){return{'model':db[_0x37df3e[_0xb835('0x1c')]],'as':_0x37df3e['as'],'attributes':_0x37df3e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb835('0x1d')](function(_0x3e37b9){logger['info'](_0xb835('0x20'),_0x2268dc);logger[_0xb835('0xd')](_0xb835('0x20'),_0x2268dc,JSON['stringify'](_0x3e37b9));_0x545033(_0x3e37b9);})[_0xb835('0x1e')](function(_0x270d44){logger[_0xb835('0x10')](_0xb835('0x20'),_0x270d44[_0xb835('0x12')],_0x2268dc);_0x4849ae(_0x53e5a7[_0xb835('0x10')](0x1f4,_0x270d44[_0xb835('0x12')]));});});};exports[_0xb835('0x21')]=function(_0x3e973b){var _0x2a4e71=this;return new Promise(function(_0x29ea89,_0x115fc8){return db['CmHopper']['create'](_0x3e973b[_0xb835('0x22')],{'raw':_0x3e973b[_0xb835('0x16')]?_0x3e973b[_0xb835('0x16')][_0xb835('0x17')]===undefined?!![]:![]:!![]})[_0xb835('0x1d')](function(_0x2f24b8){logger[_0xb835('0xa')](_0xb835('0x21'),_0x3e973b);logger[_0xb835('0xd')](_0xb835('0x21'),_0x3e973b,JSON[_0xb835('0xf')](_0x2f24b8));_0x29ea89(_0x2f24b8);})['catch'](function(_0x573405){logger[_0xb835('0x10')](_0xb835('0x21'),_0x573405[_0xb835('0x12')],_0x3e973b);_0x115fc8(_0x2a4e71[_0xb835('0x10')](0x1f4,_0x573405[_0xb835('0x12')]));});});};exports[_0xb835('0x23')]=function(_0x70cbc5){var _0x1b2fdd=this;return new Promise(function(_0x103d66,_0x27b8d3){return db[_0xb835('0x14')][_0xb835('0x24')](_0x70cbc5[_0xb835('0x22')],{'raw':_0x70cbc5[_0xb835('0x16')]?_0x70cbc5['options'][_0xb835('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x70cbc5[_0xb835('0x16')]?_0x70cbc5[_0xb835('0x16')][_0xb835('0x18')]||null:null,'attributes':_0x70cbc5['options']?_0x70cbc5[_0xb835('0x16')][_0xb835('0x19')]||null:null,'limit':_0x70cbc5['options']?_0x70cbc5[_0xb835('0x16')][_0xb835('0x25')]||null:null})[_0xb835('0x1d')](function(_0x379b36){logger[_0xb835('0xa')](_0xb835('0x23'),_0x70cbc5);logger[_0xb835('0xd')]('UpdateCmHopper',_0x70cbc5,JSON[_0xb835('0xf')](_0x379b36));_0x103d66(_0x379b36);})[_0xb835('0x1e')](function(_0x2f59e1){logger['error']('UpdateCmHopper',_0x2f59e1[_0xb835('0x12')],_0x70cbc5);_0x27b8d3(_0x1b2fdd['error'](0x1f4,_0x2f59e1['message']));});});};exports[_0xb835('0x26')]=function(_0x4adb9d){var _0x178a64=this;return new Promise(function(_0x193d0b,_0x52410c){return db['CmHopper']['destroy']({'where':_0x4adb9d[_0xb835('0x16')]?_0x4adb9d[_0xb835('0x16')]['where']||null:null})['then'](function(_0x1e58e1){logger[_0xb835('0xa')](_0xb835('0x26'),_0x4adb9d);logger[_0xb835('0xd')](_0xb835('0x26'),_0x4adb9d,JSON[_0xb835('0xf')](_0x1e58e1));_0x193d0b(_0x1e58e1);})[_0xb835('0x1e')](function(_0x1d7ae2){logger['error'](_0xb835('0x26'),_0x1d7ae2[_0xb835('0x12')],_0x4adb9d);_0x52410c(_0x178a64[_0xb835('0x10')](0x1f4,_0x1d7ae2['message']));});});};exports[_0xb835('0x27')]=function(_0x19854b){var _0x5bf117=this;return new Promise(function(_0x1bd112,_0x3758d6){return db['CmContact'][_0xb835('0x28')]()['then'](function(_0x176eef){return db[_0xb835('0x29')][_0xb835('0x2a')](function(_0x56c88e){return db[_0xb835('0x14')][_0xb835('0x15')]({'where':_0x19854b['options']?_0x19854b[_0xb835('0x16')][_0xb835('0x18')]||null:null,'attributes':_0x19854b[_0xb835('0x16')]?_0x19854b['options'][_0xb835('0x19')]||null:null,'limit':_0x19854b[_0xb835('0x16')]?_0x19854b[_0xb835('0x16')][_0xb835('0x25')]||null:null,'order':_0x19854b['options']?_0x19854b['options'][_0xb835('0x2b')]||null:null,'transaction':_0x56c88e,'lock':_0x56c88e['LOCK'][_0xb835('0x2c')],'include':[{'model':db[_0xb835('0x2d')],'as':_0xb835('0x2e'),'attributes':_['keys'](_0x176eef)},{'model':db[_0xb835('0x2f')],'as':_0xb835('0x30'),'attributes':['id',_0xb835('0x31'),_0xb835('0x32')]}]})['then'](function(_0xbed3aa){var _0x5b6dc5=[];var _0x419b5d=[];for(var _0x1d70ac=0x0;_0x1d70ac<_0xbed3aa[_0xb835('0x33')];_0x1d70ac+=0x1){if(!_0x419b5d[_0xb835('0x34')](_0xbed3aa[_0x1d70ac][_0xb835('0x35')])){_0x419b5d[_0xb835('0x36')](_0xbed3aa[_0x1d70ac]['UserId']);_0x5b6dc5[_0xb835('0x36')](_0xbed3aa[_0x1d70ac][_0xb835('0x24')](_0x19854b[_0xb835('0x22')],{'transaction':_0x56c88e}));}}return BPromise[_0xb835('0x37')](_0x5b6dc5);});})[_0xb835('0x1d')](function(_0x32e3d5){logger[_0xb835('0xa')](_0xb835('0x27'),_0x19854b);logger[_0xb835('0xd')]('GetContactDialer',_0x19854b,JSON[_0xb835('0xf')](_0x32e3d5));_0x1bd112(_0x32e3d5);})['catch'](function(_0x3a1b4e){logger[_0xb835('0x10')](_0xb835('0x27'),_0x3a1b4e[_0xb835('0x12')],_0x19854b);_0x3758d6(_0x5bf117['error'](0x1f4,_0x3a1b4e[_0xb835('0x12')]));});});});};exports[_0xb835('0x38')]=function(_0x3a9b82){var _0x120ce3=this;return new Promise(function(_0x1ff40b,_0x1d3209){return db['sequelize'][_0xb835('0x2a')](function(_0x1d4ca9){return db['CmHopperFinal']['create'](_0x3a9b82[_0xb835('0x22')],{'raw':_0x3a9b82[_0xb835('0x16')]?_0x3a9b82[_0xb835('0x16')][_0xb835('0x17')]===undefined?!![]:![]:!![],'transaction':_0x1d4ca9})[_0xb835('0x1d')](function(){return db[_0xb835('0x14')]['destroy']({'where':_0x3a9b82[_0xb835('0x16')]?_0x3a9b82['options'][_0xb835('0x18')]||null:null,'transaction':_0x1d4ca9});});})[_0xb835('0x1d')](function(_0x51bd5f){logger[_0xb835('0xa')]('MoveContactManagedDialer',_0x3a9b82);logger[_0xb835('0xd')](_0xb835('0x38'),_0x3a9b82,JSON['stringify'](_0x51bd5f));_0x1ff40b(_0x51bd5f);})['catch'](function(_0xd11e0a){logger[_0xb835('0x10')](_0xb835('0x38'),_0xd11e0a[_0xb835('0x12')],_0x3a9b82);_0x1d3209(_0x120ce3[_0xb835('0x10')](0x1f4,_0xd11e0a[_0xb835('0x12')]));});});};exports['CountReScheduled']=function(_0x465cdd){var _0x53743b=this;return new Promise(function(_0x38d59d,_0xf4297f){return db[_0xb835('0x14')]['findAll']({'raw':_0x465cdd['options']?_0x465cdd[_0xb835('0x16')][_0xb835('0x17')]===undefined?!![]:![]:!![],'where':_0x465cdd[_0xb835('0x16')]?_0x465cdd[_0xb835('0x16')][_0xb835('0x18')]||null:null,'attributes':[[db[_0xb835('0x29')]['fn'](_0xb835('0x39'),db['sequelize']['fn']('IF',db['sequelize'][_0xb835('0x3a')](_0xb835('0x3b')+util[_0xb835('0x3c')](_0xb835('0x3d'),moment()[_0xb835('0x3c')](_0xb835('0x3e')))+'\x20,\x201,\x20null'))),_0xb835('0x3f')]]})['then'](function(_0x59c9cd){logger[_0xb835('0xa')]('CountReScheduled',_0x465cdd);logger[_0xb835('0xd')](_0xb835('0x40'),_0x465cdd,JSON[_0xb835('0xf')](_0x59c9cd));_0x38d59d(_0x59c9cd);})['catch'](function(_0x5d19ac){logger[_0xb835('0x10')](_0xb835('0x40'),_0x5d19ac[_0xb835('0x12')],_0x465cdd);_0xf4297f(_0x53743b[_0xb835('0x10')](0x1f4,_0x5d19ac[_0xb835('0x12')]));});});};exports[_0xb835('0x41')]=function(_0x3ca745){var _0x387081=this;return new Promise(function(_0x3a1c50,_0x15d11b){return db['CmContact']['describe']()[_0xb835('0x1d')](function(_0x355415){return db[_0xb835('0x29')][_0xb835('0x2a')](function(_0x2669c6){return db[_0xb835('0x14')]['findAll']({'where':_0x3ca745[_0xb835('0x16')]?_0x3ca745[_0xb835('0x16')][_0xb835('0x18')]||null:null,'attributes':_0x3ca745['options']?_0x3ca745[_0xb835('0x16')][_0xb835('0x19')]||null:null,'limit':0x1,'order':_0x3ca745[_0xb835('0x16')]?_0x3ca745['options'][_0xb835('0x2b')]||null:null,'group':db[_0xb835('0x14')][_0xb835('0x35')],'transaction':_0x2669c6,'lock':_0x2669c6[_0xb835('0x42')][_0xb835('0x2c')],'include':_0x3ca745[_0xb835('0x16')]?_0x3ca745[_0xb835('0x16')]['include']?_['map'](_0x3ca745[_0xb835('0x16')][_0xb835('0x1a')],function(_0x319e9e){return{'model':db[_0x319e9e[_0xb835('0x1c')]],'as':_0x319e9e['as'],'attributes':_0x319e9e[_0xb835('0x19')],'include':_0x319e9e[_0xb835('0x1a')]?_['map'](_0x319e9e[_0xb835('0x1a')],function(_0x5c8872){return{'model':db[_0x5c8872['model']],'as':_0x5c8872['as'],'attributes':_0x5c8872[_0xb835('0x19')],'include':_0x5c8872['include']?_['map'](_0x5c8872['include'],function(_0x400bd6){return{'model':db[_0x400bd6[_0xb835('0x1c')]],'as':_0x400bd6['as'],'attributes':_0x400bd6[_0xb835('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xde9957){var _0x2bfffb=[];for(var _0x412233=0x0;_0x412233<_0xde9957[_0xb835('0x33')];_0x412233+=0x1){_0x2bfffb[_0xb835('0x36')](_0xde9957[_0x412233]['update'](_0x3ca745['body'],{'transaction':_0x2669c6}));}return BPromise['all'](_0x2bfffb);});})[_0xb835('0x1d')](function(_0x11810c){logger[_0xb835('0xa')](_0xb835('0x41'),_0x3ca745);logger[_0xb835('0xd')](_0xb835('0x41'),_0x3ca745,JSON[_0xb835('0xf')](_0x11810c));_0x3a1c50(_0x11810c);})[_0xb835('0x1e')](function(_0x3051ef){logger[_0xb835('0x10')](_0xb835('0x41'),_0x3051ef['message'],_0x3ca745);_0x15d11b(_0x387081['error'](0x1f4,_0x3051ef[_0xb835('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x103123){var _0x107904=this;return new Promise(function(_0xd7e84,_0x17b1ca){db[_0xb835('0x2d')]['describe']()[_0xb835('0x1d')](function(_0x4e8731){return db['CmHopper'][_0xb835('0x15')]({'raw':_0x103123[_0xb835('0x16')]?_0x103123[_0xb835('0x16')][_0xb835('0x17')]===undefined?!![]:![]:!![],'where':_0x103123[_0xb835('0x16')]?_0x103123['options'][_0xb835('0x18')]||null:null,'attributes':_0x103123[_0xb835('0x16')]?_0x103123[_0xb835('0x16')][_0xb835('0x19')]||null:null,'limit':_0x103123[_0xb835('0x16')]?_0x103123[_0xb835('0x16')][_0xb835('0x25')]||null:null,'include':_0x103123[_0xb835('0x16')]?_0x103123[_0xb835('0x16')]['include']?_['map'](_0x103123[_0xb835('0x16')][_0xb835('0x1a')],function(_0x4bce07){return{'model':db[_0x4bce07[_0xb835('0x1c')]],'as':_0x4bce07['as'],'attributes':_0x4bce07['as']==='Contact'?_[_0xb835('0x43')](_0x4e8731):_0x4bce07['attributes'],'include':_0x4bce07[_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x4bce07[_0xb835('0x1a')],function(_0x527a15){return{'model':db[_0x527a15[_0xb835('0x1c')]],'as':_0x527a15['as'],'attributes':_0x527a15['attributes'],'include':_0x527a15[_0xb835('0x1a')]?_[_0xb835('0x1b')](_0x527a15[_0xb835('0x1a')],function(_0xd6f069){return{'model':db[_0xd6f069[_0xb835('0x1c')]],'as':_0xd6f069['as'],'attributes':_0xd6f069[_0xb835('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb835('0x1d')](function(_0x2be5e9){logger[_0xb835('0xa')]('GetCmHopper',_0x103123);logger['debug'](_0xb835('0x13'),_0x103123,JSON[_0xb835('0xf')](_0x2be5e9));_0xd7e84(_0x2be5e9);})[_0xb835('0x1e')](function(_0x23e07c){logger[_0xb835('0x10')](_0xb835('0x13'),_0x23e07c[_0xb835('0x12')],_0x103123);_0x17b1ca(_0x107904[_0xb835('0x10')](0x1f4,_0x23e07c['message']));});});});}; \ No newline at end of file +var _0x2102=['CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','name','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','all','GetCmHopperPreview','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','CmHopper','find'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2102,0xf4));var _0x2210=function(_0x29cc05,_0x22c446){_0x29cc05=_0x29cc05-0x0;var _0x3cd089=_0x2102[_0x29cc05];return _0x3cd089;};'use strict';var _=require(_0x2210('0x0'));var util=require(_0x2210('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2210('0x2'));var fs=require('fs');var Redis=require(_0x2210('0x3'));var db=require(_0x2210('0x4'))['db'];var utils=require(_0x2210('0x5'));var logger=require(_0x2210('0x6'))('rpc');var config=require(_0x2210('0x7'));var jayson=require(_0x2210('0x8'));var client=jayson['client'][_0x2210('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x455829,_0x56cd47,_0x4494b4){return new BPromise(function(_0x46f69c,_0x452cfa){return client[_0x2210('0xa')](_0x455829,_0x4494b4)[_0x2210('0xb')](function(_0x16a145){logger[_0x2210('0xc')]('CmHopper,\x20%s,\x20%s',_0x56cd47,_0x2210('0xd'));logger[_0x2210('0xe')](_0x2210('0xf'),_0x56cd47,_0x2210('0xd'),JSON[_0x2210('0x10')](_0x16a145));if(_0x16a145['error']){if(_0x16a145[_0x2210('0x11')][_0x2210('0x12')]===0x1f4){logger['error'](_0x2210('0x13'),_0x56cd47,_0x16a145[_0x2210('0x11')][_0x2210('0x14')]);return _0x452cfa(_0x16a145[_0x2210('0x11')][_0x2210('0x14')]);}logger['error'](_0x2210('0x13'),_0x56cd47,_0x16a145[_0x2210('0x11')][_0x2210('0x14')]);return _0x46f69c(_0x16a145[_0x2210('0x11')][_0x2210('0x14')]);}else{logger[_0x2210('0xc')]('CmHopper,\x20%s,\x20%s',_0x56cd47,_0x2210('0xd'));_0x46f69c(_0x16a145[_0x2210('0x15')][_0x2210('0x14')]);}})[_0x2210('0x16')](function(_0x3627ec){logger[_0x2210('0x11')](_0x2210('0x13'),_0x56cd47,_0x3627ec);_0x452cfa(_0x3627ec);});});}exports[_0x2210('0x17')]=function(_0x4dba42){var _0x3a4e1a=this;return new Promise(function(_0x569633,_0x4c20a2){return db['CmHopper'][_0x2210('0x18')]({'raw':_0x4dba42['options']?_0x4dba42[_0x2210('0x19')][_0x2210('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dba42[_0x2210('0x19')]?_0x4dba42[_0x2210('0x19')][_0x2210('0x1b')]||null:null,'attributes':_0x4dba42[_0x2210('0x19')]?_0x4dba42[_0x2210('0x19')][_0x2210('0x1c')]||null:null,'limit':_0x4dba42[_0x2210('0x19')]?_0x4dba42['options'][_0x2210('0x1d')]||null:null,'include':_0x4dba42['options']?_0x4dba42[_0x2210('0x19')][_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x4dba42[_0x2210('0x19')]['include'],function(_0x3ee2d0){return{'model':db[_0x3ee2d0[_0x2210('0x20')]],'as':_0x3ee2d0['as'],'attributes':_0x3ee2d0['attributes'],'include':_0x3ee2d0['include']?_[_0x2210('0x1f')](_0x3ee2d0[_0x2210('0x1e')],function(_0x246ba7){return{'model':db[_0x246ba7[_0x2210('0x20')]],'as':_0x246ba7['as'],'attributes':_0x246ba7[_0x2210('0x1c')],'include':_0x246ba7['include']?_[_0x2210('0x1f')](_0x246ba7[_0x2210('0x1e')],function(_0x51596d){return{'model':db[_0x51596d[_0x2210('0x20')]],'as':_0x51596d['as'],'attributes':_0x51596d[_0x2210('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c7a46){logger[_0x2210('0xc')](_0x2210('0x17'),_0x4dba42);logger[_0x2210('0xe')](_0x2210('0x17'),_0x4dba42,JSON[_0x2210('0x10')](_0x3c7a46));_0x569633(_0x3c7a46);})[_0x2210('0x16')](function(_0x486af1){logger[_0x2210('0x11')](_0x2210('0x17'),_0x486af1[_0x2210('0x14')],_0x4dba42);_0x4c20a2(_0x3a4e1a[_0x2210('0x11')](0x1f4,_0x486af1[_0x2210('0x14')]));});});};exports[_0x2210('0x21')]=function(_0x30be91){var _0x273d79=this;return new Promise(function(_0x327d55,_0x32c1ea){return db[_0x2210('0x22')][_0x2210('0x23')]({'raw':_0x30be91[_0x2210('0x19')]?_0x30be91['options'][_0x2210('0x1a')]===undefined?!![]:![]:!![],'where':_0x30be91['options']?_0x30be91[_0x2210('0x19')]['where']||null:null,'attributes':_0x30be91[_0x2210('0x19')]?_0x30be91[_0x2210('0x19')][_0x2210('0x1c')]||null:null,'include':_0x30be91[_0x2210('0x19')]?_0x30be91['options'][_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x30be91[_0x2210('0x19')][_0x2210('0x1e')],function(_0x2606b5){return{'model':db[_0x2606b5[_0x2210('0x20')]],'as':_0x2606b5['as'],'attributes':_0x2606b5[_0x2210('0x1c')],'include':_0x2606b5[_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x2606b5[_0x2210('0x1e')],function(_0x190f13){return{'model':db[_0x190f13[_0x2210('0x20')]],'as':_0x190f13['as'],'attributes':_0x190f13[_0x2210('0x1c')],'include':_0x190f13['include']?_['map'](_0x190f13[_0x2210('0x1e')],function(_0x39dbe2){return{'model':db[_0x39dbe2[_0x2210('0x20')]],'as':_0x39dbe2['as'],'attributes':_0x39dbe2[_0x2210('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2210('0xb')](function(_0x4cb4f9){logger['info'](_0x2210('0x21'),_0x30be91);logger[_0x2210('0xe')](_0x2210('0x21'),_0x30be91,JSON[_0x2210('0x10')](_0x4cb4f9));_0x327d55(_0x4cb4f9);})[_0x2210('0x16')](function(_0x4280cb){logger['error'](_0x2210('0x21'),_0x4280cb[_0x2210('0x14')],_0x30be91);_0x32c1ea(_0x273d79[_0x2210('0x11')](0x1f4,_0x4280cb['message']));});});};exports[_0x2210('0x24')]=function(_0x4b8fbe){var _0xf9269e=this;return new Promise(function(_0x5ada69,_0x20a90b){return db['CmHopper'][_0x2210('0x25')](_0x4b8fbe[_0x2210('0x26')],{'raw':_0x4b8fbe['options']?_0x4b8fbe[_0x2210('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2210('0xb')](function(_0x927cac){logger[_0x2210('0xc')]('CreateCmHopper',_0x4b8fbe);logger[_0x2210('0xe')](_0x2210('0x24'),_0x4b8fbe,JSON[_0x2210('0x10')](_0x927cac));_0x5ada69(_0x927cac);})['catch'](function(_0x100f21){logger[_0x2210('0x11')](_0x2210('0x24'),_0x100f21[_0x2210('0x14')],_0x4b8fbe);_0x20a90b(_0xf9269e[_0x2210('0x11')](0x1f4,_0x100f21[_0x2210('0x14')]));});});};exports[_0x2210('0x27')]=function(_0x725d24){var _0x8e5696=this;return new Promise(function(_0x51500b,_0x1b0a35){return db[_0x2210('0x22')][_0x2210('0x28')](_0x725d24['body'],{'raw':_0x725d24[_0x2210('0x19')]?_0x725d24[_0x2210('0x19')][_0x2210('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x725d24['options']?_0x725d24[_0x2210('0x19')][_0x2210('0x1b')]||null:null,'attributes':_0x725d24[_0x2210('0x19')]?_0x725d24['options'][_0x2210('0x1c')]||null:null,'limit':_0x725d24['options']?_0x725d24[_0x2210('0x19')]['limit']||null:null})['then'](function(_0x964ffb){logger[_0x2210('0xc')]('UpdateCmHopper',_0x725d24);logger[_0x2210('0xe')](_0x2210('0x27'),_0x725d24,JSON[_0x2210('0x10')](_0x964ffb));_0x51500b(_0x964ffb);})[_0x2210('0x16')](function(_0x326630){logger[_0x2210('0x11')](_0x2210('0x27'),_0x326630['message'],_0x725d24);_0x1b0a35(_0x8e5696[_0x2210('0x11')](0x1f4,_0x326630['message']));});});};exports[_0x2210('0x29')]=function(_0x4378d2){var _0x467135=this;return new Promise(function(_0x51d378,_0x517db7){return db[_0x2210('0x22')][_0x2210('0x2a')]({'where':_0x4378d2[_0x2210('0x19')]?_0x4378d2['options']['where']||null:null})['then'](function(_0x57a9c4){logger[_0x2210('0xc')](_0x2210('0x29'),_0x4378d2);logger['debug']('DestroyCmHopper',_0x4378d2,JSON[_0x2210('0x10')](_0x57a9c4));_0x51d378(_0x57a9c4);})[_0x2210('0x16')](function(_0x59a47e){logger[_0x2210('0x11')](_0x2210('0x29'),_0x59a47e[_0x2210('0x14')],_0x4378d2);_0x517db7(_0x467135[_0x2210('0x11')](0x1f4,_0x59a47e[_0x2210('0x14')]));});});};exports[_0x2210('0x2b')]=function(_0x2ad4f3){var _0x23fbf2=this;return new Promise(function(_0x5c10b6,_0x154cee){return db[_0x2210('0x2c')][_0x2210('0x2d')]()[_0x2210('0xb')](function(_0x3c2649){return db[_0x2210('0x2e')][_0x2210('0x2f')](function(_0x21d5b4){return db['CmHopper'][_0x2210('0x18')]({'where':_0x2ad4f3[_0x2210('0x19')]?_0x2ad4f3['options'][_0x2210('0x1b')]||null:null,'attributes':_0x2ad4f3[_0x2210('0x19')]?_0x2ad4f3[_0x2210('0x19')][_0x2210('0x1c')]||null:null,'limit':_0x2ad4f3[_0x2210('0x19')]?_0x2ad4f3[_0x2210('0x19')][_0x2210('0x1d')]||null:null,'order':_0x2ad4f3['options']?_0x2ad4f3[_0x2210('0x19')][_0x2210('0x30')]||null:null,'transaction':_0x21d5b4,'lock':_0x21d5b4[_0x2210('0x31')][_0x2210('0x32')],'include':[{'model':db[_0x2210('0x2c')],'as':_0x2210('0x33'),'attributes':_[_0x2210('0x34')](_0x3c2649)},{'model':db[_0x2210('0x35')],'as':'Agent','attributes':['id',_0x2210('0x36'),'voicePause']}]})[_0x2210('0xb')](function(_0x166153){var _0x1850e8=[];var _0x206b46=[];for(var _0x4873d4=0x0;_0x4873d4<_0x166153[_0x2210('0x37')];_0x4873d4+=0x1){if(!_0x206b46[_0x2210('0x38')](_0x166153[_0x4873d4][_0x2210('0x39')])){_0x206b46[_0x2210('0x3a')](_0x166153[_0x4873d4][_0x2210('0x39')]);_0x1850e8[_0x2210('0x3a')](_0x166153[_0x4873d4][_0x2210('0x28')](_0x2ad4f3[_0x2210('0x26')],{'transaction':_0x21d5b4}));}}return BPromise['all'](_0x1850e8);});})[_0x2210('0xb')](function(_0x479faf){logger['info'](_0x2210('0x2b'),_0x2ad4f3);logger[_0x2210('0xe')](_0x2210('0x2b'),_0x2ad4f3,JSON['stringify'](_0x479faf));_0x5c10b6(_0x479faf);})['catch'](function(_0x167d87){logger['error'](_0x2210('0x2b'),_0x167d87['message'],_0x2ad4f3);_0x154cee(_0x23fbf2['error'](0x1f4,_0x167d87[_0x2210('0x14')]));});});});};exports[_0x2210('0x3b')]=function(_0x13e032){var _0x30c176=this;return new Promise(function(_0x58272d,_0x22ee3c){return db['sequelize'][_0x2210('0x2f')](function(_0x32e7f7){return db[_0x2210('0x3c')][_0x2210('0x25')](_0x13e032['body'],{'raw':_0x13e032[_0x2210('0x19')]?_0x13e032['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x32e7f7})[_0x2210('0xb')](function(){return db[_0x2210('0x22')]['destroy']({'where':_0x13e032[_0x2210('0x19')]?_0x13e032[_0x2210('0x19')]['where']||null:null,'transaction':_0x32e7f7});});})[_0x2210('0xb')](function(_0x2cb9fa){logger[_0x2210('0xc')](_0x2210('0x3b'),_0x13e032);logger[_0x2210('0xe')](_0x2210('0x3b'),_0x13e032,JSON[_0x2210('0x10')](_0x2cb9fa));_0x58272d(_0x2cb9fa);})[_0x2210('0x16')](function(_0x27b7a4){logger[_0x2210('0x11')]('MoveContactManagedDialer',_0x27b7a4[_0x2210('0x14')],_0x13e032);_0x22ee3c(_0x30c176[_0x2210('0x11')](0x1f4,_0x27b7a4['message']));});});};exports[_0x2210('0x3d')]=function(_0x55fc68){var _0x1ff5d5=this;return new Promise(function(_0x21c7c7,_0x217c2f){return db[_0x2210('0x22')][_0x2210('0x18')]({'raw':_0x55fc68[_0x2210('0x19')]?_0x55fc68[_0x2210('0x19')][_0x2210('0x1a')]===undefined?!![]:![]:!![],'where':_0x55fc68[_0x2210('0x19')]?_0x55fc68[_0x2210('0x19')]['where']||null:null,'attributes':[[db[_0x2210('0x2e')]['fn'](_0x2210('0x3e'),db[_0x2210('0x2e')]['fn']('IF',db[_0x2210('0x2e')]['literal']('`scheduledat`\x20>=\x20'+util[_0x2210('0x3f')](_0x2210('0x40'),moment()['format'](_0x2210('0x41')))+'\x20,\x201,\x20null'))),_0x2210('0x42')]]})[_0x2210('0xb')](function(_0x378075){logger[_0x2210('0xc')](_0x2210('0x3d'),_0x55fc68);logger[_0x2210('0xe')]('CountReScheduled',_0x55fc68,JSON[_0x2210('0x10')](_0x378075));_0x21c7c7(_0x378075);})[_0x2210('0x16')](function(_0x4485d4){logger[_0x2210('0x11')](_0x2210('0x3d'),_0x4485d4['message'],_0x55fc68);_0x217c2f(_0x1ff5d5['error'](0x1f4,_0x4485d4[_0x2210('0x14')]));});});};exports[_0x2210('0x43')]=function(_0x10f7b9){var _0x432847=this;return new Promise(function(_0x422fed,_0x30d3c4){return db[_0x2210('0x2c')][_0x2210('0x2d')]()[_0x2210('0xb')](function(_0x3bdf78){return db[_0x2210('0x2e')]['transaction'](function(_0x3c0897){return db[_0x2210('0x22')][_0x2210('0x18')]({'where':_0x10f7b9[_0x2210('0x19')]?_0x10f7b9[_0x2210('0x19')][_0x2210('0x1b')]||null:null,'attributes':_0x10f7b9[_0x2210('0x19')]?_0x10f7b9['options']['attributes']||null:null,'limit':0x1,'order':_0x10f7b9[_0x2210('0x19')]?_0x10f7b9['options']['order']||null:null,'group':db[_0x2210('0x22')][_0x2210('0x39')],'transaction':_0x3c0897,'lock':_0x3c0897[_0x2210('0x31')][_0x2210('0x32')],'include':_0x10f7b9['options']?_0x10f7b9[_0x2210('0x19')]['include']?_[_0x2210('0x1f')](_0x10f7b9['options'][_0x2210('0x1e')],function(_0x40c8d5){return{'model':db[_0x40c8d5[_0x2210('0x20')]],'as':_0x40c8d5['as'],'attributes':_0x40c8d5[_0x2210('0x1c')],'include':_0x40c8d5[_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x40c8d5[_0x2210('0x1e')],function(_0xbde031){return{'model':db[_0xbde031[_0x2210('0x20')]],'as':_0xbde031['as'],'attributes':_0xbde031[_0x2210('0x1c')],'include':_0xbde031[_0x2210('0x1e')]?_[_0x2210('0x1f')](_0xbde031[_0x2210('0x1e')],function(_0x19846a){return{'model':db[_0x19846a[_0x2210('0x20')]],'as':_0x19846a['as'],'attributes':_0x19846a[_0x2210('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2210('0xb')](function(_0x56eeea){var _0x4bcea9=[];for(var _0x4fd1d2=0x0;_0x4fd1d2<_0x56eeea[_0x2210('0x37')];_0x4fd1d2+=0x1){_0x4bcea9[_0x2210('0x3a')](_0x56eeea[_0x4fd1d2][_0x2210('0x28')](_0x10f7b9[_0x2210('0x26')],{'transaction':_0x3c0897}));}return BPromise[_0x2210('0x44')](_0x4bcea9);});})[_0x2210('0xb')](function(_0x5871b4){logger[_0x2210('0xc')](_0x2210('0x43'),_0x10f7b9);logger[_0x2210('0xe')](_0x2210('0x43'),_0x10f7b9,JSON[_0x2210('0x10')](_0x5871b4));_0x422fed(_0x5871b4);})[_0x2210('0x16')](function(_0x5997c9){logger[_0x2210('0x11')](_0x2210('0x43'),_0x5997c9['message'],_0x10f7b9);_0x30d3c4(_0x432847['error'](0x1f4,_0x5997c9[_0x2210('0x14')]));});});});};exports[_0x2210('0x45')]=function(_0x5ee2d4){var _0x30e680=this;return new Promise(function(_0x2aeae8,_0x2d1f3f){db[_0x2210('0x2c')]['describe']()[_0x2210('0xb')](function(_0x30b512){return db[_0x2210('0x22')][_0x2210('0x18')]({'raw':_0x5ee2d4[_0x2210('0x19')]?_0x5ee2d4[_0x2210('0x19')][_0x2210('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ee2d4[_0x2210('0x19')]?_0x5ee2d4['options'][_0x2210('0x1b')]||null:null,'attributes':_0x5ee2d4[_0x2210('0x19')]?_0x5ee2d4[_0x2210('0x19')][_0x2210('0x1c')]||null:null,'limit':_0x5ee2d4[_0x2210('0x19')]?_0x5ee2d4['options'][_0x2210('0x1d')]||null:null,'include':_0x5ee2d4[_0x2210('0x19')]?_0x5ee2d4[_0x2210('0x19')]['include']?_[_0x2210('0x1f')](_0x5ee2d4[_0x2210('0x19')][_0x2210('0x1e')],function(_0x5afccc){return{'model':db[_0x5afccc['model']],'as':_0x5afccc['as'],'attributes':_0x5afccc['as']===_0x2210('0x33')?_[_0x2210('0x34')](_0x30b512):_0x5afccc[_0x2210('0x1c')],'include':_0x5afccc[_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x5afccc[_0x2210('0x1e')],function(_0x448018){return{'model':db[_0x448018[_0x2210('0x20')]],'as':_0x448018['as'],'attributes':_0x448018[_0x2210('0x1c')],'include':_0x448018[_0x2210('0x1e')]?_[_0x2210('0x1f')](_0x448018[_0x2210('0x1e')],function(_0x18abc6){return{'model':db[_0x18abc6[_0x2210('0x20')]],'as':_0x18abc6['as'],'attributes':_0x18abc6[_0x2210('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2210('0xb')](function(_0x23aa7c){logger[_0x2210('0xc')](_0x2210('0x17'),_0x5ee2d4);logger['debug'](_0x2210('0x17'),_0x5ee2d4,JSON[_0x2210('0x10')](_0x23aa7c));_0x2aeae8(_0x23aa7c);})['catch'](function(_0x52e198){logger['error'](_0x2210('0x17'),_0x52e198[_0x2210('0x14')],_0x5ee2d4);_0x2d1f3f(_0x30e680[_0x2210('0x11')](0x1f4,_0x52e198[_0x2210('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9a019fb..eec414a 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 _0xd824=['../../config/environment','./cmHopper.controller','index','isAuthenticated','describe','get','/:id','show','post','/preview','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5c609f,_0x1e0183){var _0x3f974d=function(_0x418bd4){while(--_0x418bd4){_0x5c609f['push'](_0x5c609f['shift']());}};_0x3f974d(++_0x1e0183);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4d82('0x2'));var router=express[_0x4d82('0x3')]();var auth=require(_0x4d82('0x4'));var interaction=require(_0x4d82('0x5'));var config=require(_0x4d82('0x6'));var controller=require(_0x4d82('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4d82('0x8')]);router['get']('/describe',auth[_0x4d82('0x9')](),controller[_0x4d82('0xa')]);router[_0x4d82('0xb')]('/opencontacts',auth[_0x4d82('0x9')](),controller['getOpenContacts']);router['get'](_0x4d82('0xc'),auth[_0x4d82('0x9')](),controller[_0x4d82('0xd')]);router['post']('/',auth[_0x4d82('0x9')](),controller['create']);router[_0x4d82('0xe')](_0x4d82('0xf'),auth[_0x4d82('0x9')](),controller['getPreview']);router['put'](_0x4d82('0xc'),auth[_0x4d82('0x9')](),controller[_0x4d82('0x10')]);router[_0x4d82('0x11')]('/:id',auth[_0x4d82('0x9')](),controller[_0x4d82('0x12')]);module[_0x4d82('0x13')]=router; \ No newline at end of file +var _0x6e1c=['./cmHopper.controller','get','isAuthenticated','index','describe','/opencontacts','/:id','create','/preview','getPreview','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f3056,_0xe685f6){var _0x2b8af0=function(_0x3e04c2){while(--_0x3e04c2){_0x4f3056['push'](_0x4f3056['shift']());}};_0x2b8af0(++_0xe685f6);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc6e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6e1('0x1'));var express=require(_0xc6e1('0x2'));var router=express[_0xc6e1('0x3')]();var auth=require(_0xc6e1('0x4'));var interaction=require(_0xc6e1('0x5'));var config=require(_0xc6e1('0x6'));var controller=require(_0xc6e1('0x7'));router[_0xc6e1('0x8')]('/',auth[_0xc6e1('0x9')](),controller[_0xc6e1('0xa')]);router[_0xc6e1('0x8')]('/describe',auth[_0xc6e1('0x9')](),controller[_0xc6e1('0xb')]);router[_0xc6e1('0x8')](_0xc6e1('0xc'),auth[_0xc6e1('0x9')](),controller['getOpenContacts']);router[_0xc6e1('0x8')](_0xc6e1('0xd'),auth[_0xc6e1('0x9')](),controller['show']);router['post']('/',auth[_0xc6e1('0x9')](),controller[_0xc6e1('0xe')]);router['post'](_0xc6e1('0xf'),auth[_0xc6e1('0x9')](),controller[_0xc6e1('0x10')]);router[_0xc6e1('0x11')](_0xc6e1('0xd'),auth[_0xc6e1('0x9')](),controller['update']);router[_0xc6e1('0x12')](_0xc6e1('0xd'),auth[_0xc6e1('0x9')](),controller[_0xc6e1('0x13')]);module[_0xc6e1('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 1262207..7ffbc49 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 _0x96df=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x5ce1c9,_0x3a5c47){var _0x5aec6a=function(_0x2c19d5){while(--_0x2c19d5){_0x5ce1c9['push'](_0x5ce1c9['shift']());}};_0x5aec6a(++_0x3a5c47);}(_0x96df,0xa4));var _0xf96d=function(_0x441fae,_0x3ab2ee){_0x441fae=_0x441fae-0x0;var _0x189025=_0x96df[_0x441fae];return _0x189025;};'use strict';var moment=require(_0xf96d('0x0'));var Sequelize=require(_0xf96d('0x1'));module[_0xf96d('0x2')]={'phone':{'type':Sequelize[_0xf96d('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xf96d('0x4')],'unique':_0xf96d('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf96d('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xfb00=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0xfb00,0xec));var _0x0fb0=function(_0x330172,_0x142bba){_0x330172=_0x330172-0x0;var _0x3bcca0=_0xfb00[_0x330172];return _0x3bcca0;};'use strict';var moment=require(_0x0fb0('0x0'));var Sequelize=require(_0x0fb0('0x1'));module[_0x0fb0('0x2')]={'phone':{'type':Sequelize[_0x0fb0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0fb0('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x0fb0('0x4')],'unique':_0x0fb0('0x5')},'VoiceQueueId':{'type':Sequelize[_0x0fb0('0x4')],'unique':_0x0fb0('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 0e64d7e..8e33229 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 _0x8673=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','set','Content-Range','apply','update','destroy','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','VIRTUAL','merge','then','include','findAll','rows','params','keys','filtears','length','includeAll','find','catch','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x59024b,_0xf2a58e){var _0x3deb90=function(_0x1ca757){while(--_0x1ca757){_0x59024b['push'](_0x59024b['shift']());}};_0x3deb90(++_0xf2a58e);}(_0x8673,0x162));var _0x3867=function(_0x351172,_0x67f424){_0x351172=_0x351172-0x0;var _0x3250cb=_0x8673[_0x351172];return _0x3250cb;};'use strict';var pdf=require(_0x3867('0x0'));var emlformat=require(_0x3867('0x1'));var rimraf=require(_0x3867('0x2'));var zipdir=require(_0x3867('0x3'));var jsonpatch=require(_0x3867('0x4'));var rp=require(_0x3867('0x5'));var moment=require(_0x3867('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3867('0x7'));var sox=require(_0x3867('0x8'));var csv=require(_0x3867('0x9'));var ejs=require(_0x3867('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3867('0xb'));var jsforce=require(_0x3867('0xc'));var deskjs=require(_0x3867('0xd'));var toCsv=require(_0x3867('0x9'));var querystring=require(_0x3867('0xe'));var Papa=require(_0x3867('0xf'));var Redis=require(_0x3867('0x10'));var authService=require(_0x3867('0x11'));var qs=require(_0x3867('0x12'));var as=require(_0x3867('0x13'));var hardwareService=require(_0x3867('0x14'));var logger=require(_0x3867('0x15'))(_0x3867('0x16'));var utils=require('../../config/utils');var config=require(_0x3867('0x17'));var licenseUtil=require(_0x3867('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x74da93,_0x15550c){_0x15550c=_0x15550c||0xcc;return function(_0x828cb8){if(_0x828cb8){return _0x74da93[_0x3867('0x19')](_0x15550c);}return _0x74da93[_0x3867('0x1a')](_0x15550c)[_0x3867('0x1b')]();};}function respondWithResult(_0x616688,_0x11368a){_0x11368a=_0x11368a||0xc8;return function(_0x1471a8){if(_0x1471a8){return _0x616688[_0x3867('0x1a')](_0x11368a)[_0x3867('0x1c')](_0x1471a8);}};}function respondWithFilteredResult(_0x471c76,_0x24f63a){return function(_0x362d8f){if(_0x362d8f){var _0x4c3507=_0x362d8f[_0x3867('0x1d')],_0x420d87=_0x24f63a['offset'],_0x236397=_0x24f63a['offset']+_0x24f63a['limit'],_0x414bef;if(_0x236397>=_0x4c3507){_0x236397=_0x4c3507;_0x414bef=0xc8;}else{_0x414bef=0xce;}_0x471c76['status'](_0x414bef);return _0x471c76[_0x3867('0x1e')](_0x3867('0x1f'),_0x420d87+'-'+_0x236397+'/'+_0x4c3507)[_0x3867('0x1c')](_0x362d8f);}return null;};}function patchUpdates(_0x210088){return function(_0x48c7ad){try{jsonpatch[_0x3867('0x20')](_0x48c7ad,_0x210088,!![]);}catch(_0x5af1cc){return BPromise['reject'](_0x5af1cc);}return _0x48c7ad['save']();};}function saveUpdates(_0x3acf36,_0xf3c895){return function(_0x163ed6){if(_0x163ed6){return _0x163ed6[_0x3867('0x21')](_0x3acf36)['then'](function(_0x3f8057){return _0x3f8057;});}return null;};}function removeEntity(_0x162839,_0x685316){return function(_0x51ac05){if(_0x51ac05){return _0x51ac05[_0x3867('0x22')]()['then'](function(){_0x162839[_0x3867('0x1a')](0xcc)[_0x3867('0x1b')]();});}};}function handleEntityNotFound(_0x939735,_0x5d59ee){return function(_0x439d30){if(!_0x439d30){_0x939735[_0x3867('0x19')](0x194);}return _0x439d30;};}function handleError(_0x1d681a,_0x258e2a){_0x258e2a=_0x258e2a||0x1f4;return function(_0x1f909c){logger['error'](_0x1f909c[_0x3867('0x23')]);if(_0x1f909c[_0x3867('0x24')]){delete _0x1f909c['name'];}_0x1d681a['status'](_0x258e2a)[_0x3867('0x25')](_0x1f909c);};}exports[_0x3867('0x26')]=function(_0x4e8fd4,_0x10657a){var _0x4f2723={},_0x114cb8={},_0x271069={'count':0x0,'rows':[]};var _0x58a992=_[_0x3867('0x27')](db[_0x3867('0x28')][_0x3867('0x29')],function(_0x54b155){return{'name':_0x54b155['fieldName'],'type':_0x54b155[_0x3867('0x2a')][_0x3867('0x2b')]};});_0x114cb8['model']=_[_0x3867('0x27')](_0x58a992,'name');_0x114cb8[_0x3867('0x2c')]=_['keys'](_0x4e8fd4[_0x3867('0x2c')]);_0x114cb8[_0x3867('0x2d')]=_[_0x3867('0x2e')](_0x114cb8[_0x3867('0x2f')],_0x114cb8[_0x3867('0x2c')]);_0x4f2723['attributes']=_[_0x3867('0x2e')](_0x114cb8[_0x3867('0x2f')],qs[_0x3867('0x30')](_0x4e8fd4[_0x3867('0x2c')][_0x3867('0x30')]));_0x4f2723[_0x3867('0x31')]=_0x4f2723[_0x3867('0x31')]['length']?_0x4f2723[_0x3867('0x31')]:_0x114cb8[_0x3867('0x2f')];if(!_0x4e8fd4[_0x3867('0x2c')][_0x3867('0x32')](_0x3867('0x33'))){_0x4f2723[_0x3867('0x34')]=qs[_0x3867('0x34')](_0x4e8fd4[_0x3867('0x2c')]['limit']);_0x4f2723['offset']=qs[_0x3867('0x35')](_0x4e8fd4[_0x3867('0x2c')][_0x3867('0x35')]);}_0x4f2723[_0x3867('0x36')]=qs[_0x3867('0x37')](_0x4e8fd4['query']['sort']);_0x4f2723['where']=qs[_0x3867('0x2d')](_[_0x3867('0x38')](_0x4e8fd4[_0x3867('0x2c')],_0x114cb8['filters']),_0x58a992);if(_0x4e8fd4[_0x3867('0x2c')][_0x3867('0x39')]){_0x4f2723['where']=_['merge'](_0x4f2723[_0x3867('0x3a')],{'$or':_[_0x3867('0x27')](_0x58a992,function(_0x364681){if(_0x364681[_0x3867('0x2a')]!==_0x3867('0x3b')){var _0x245bc1={};_0x245bc1[_0x364681[_0x3867('0x24')]]={'$like':'%'+_0x4e8fd4[_0x3867('0x2c')]['filter']+'%'};return _0x245bc1;}})});}_0x4f2723=_[_0x3867('0x3c')]({},_0x4f2723,_0x4e8fd4['options']);var _0x543f02={'where':_0x4f2723['where']};return db[_0x3867('0x28')][_0x3867('0x1d')](_0x543f02)[_0x3867('0x3d')](function(_0x5ad0c4){_0x271069[_0x3867('0x1d')]=_0x5ad0c4;if(_0x4e8fd4[_0x3867('0x2c')]['includeAll']){_0x4f2723[_0x3867('0x3e')]=[{'all':!![]}];}return db[_0x3867('0x28')][_0x3867('0x3f')](_0x4f2723);})[_0x3867('0x3d')](function(_0x35b154){_0x271069[_0x3867('0x40')]=_0x35b154;return _0x271069;})[_0x3867('0x3d')](respondWithFilteredResult(_0x10657a,_0x4f2723))['catch'](handleError(_0x10657a,null));};exports['show']=function(_0x48e330,_0x64ba3f){var _0x1dded1={'raw':!![],'where':{'id':_0x48e330[_0x3867('0x41')]['id']}},_0x7f45d0={};_0x7f45d0['model']=_[_0x3867('0x42')](db[_0x3867('0x28')][_0x3867('0x29')]);_0x7f45d0[_0x3867('0x2c')]=_[_0x3867('0x42')](_0x48e330[_0x3867('0x2c')]);_0x7f45d0[_0x3867('0x43')]=_[_0x3867('0x2e')](_0x7f45d0['model'],_0x7f45d0[_0x3867('0x2c')]);_0x1dded1[_0x3867('0x31')]=_[_0x3867('0x2e')](_0x7f45d0[_0x3867('0x2f')],qs[_0x3867('0x30')](_0x48e330[_0x3867('0x2c')][_0x3867('0x30')]));_0x1dded1[_0x3867('0x31')]=_0x1dded1[_0x3867('0x31')][_0x3867('0x44')]?_0x1dded1[_0x3867('0x31')]:_0x7f45d0[_0x3867('0x2f')];if(_0x48e330[_0x3867('0x2c')][_0x3867('0x45')]){_0x1dded1[_0x3867('0x3e')]=[{'all':!![]}];}_0x1dded1=_[_0x3867('0x3c')]({},_0x1dded1,_0x48e330['options']);return db[_0x3867('0x28')][_0x3867('0x46')](_0x1dded1)['then'](handleEntityNotFound(_0x64ba3f,null))[_0x3867('0x3d')](respondWithResult(_0x64ba3f,null))[_0x3867('0x47')](handleError(_0x64ba3f,null));};exports[_0x3867('0x21')]=function(_0x3ea418,_0x3d277a){if(_0x3ea418[_0x3867('0x48')]['id']){delete _0x3ea418['body']['id'];}return db[_0x3867('0x28')][_0x3867('0x46')]({'where':{'id':_0x3ea418[_0x3867('0x41')]['id']}})[_0x3867('0x3d')](handleEntityNotFound(_0x3d277a,null))[_0x3867('0x3d')](saveUpdates(_0x3ea418[_0x3867('0x48')],null))[_0x3867('0x3d')](respondWithResult(_0x3d277a,null))[_0x3867('0x47')](handleError(_0x3d277a,null));};exports['destroy']=function(_0x5657da,_0x2659d1){return db[_0x3867('0x28')][_0x3867('0x46')]({'where':{'id':_0x5657da[_0x3867('0x41')]['id']}})[_0x3867('0x3d')](handleEntityNotFound(_0x2659d1,null))[_0x3867('0x3d')](removeEntity(_0x2659d1,null))[_0x3867('0x47')](handleError(_0x2659d1,null));};exports[_0x3867('0x49')]=function(_0x1e881f,_0x4c0c68){return db[_0x3867('0x28')][_0x3867('0x49')]()[_0x3867('0x3d')](respondWithResult(_0x4c0c68,null))[_0x3867('0x47')](handleError(_0x4c0c68,null));}; \ No newline at end of file +var _0x23db=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','stack','name','status','send','index','map','CmHopperBlack','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','rawAttributes','filtears','fields','find','update','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x23db,0x116));var _0xb23d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x23db[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0xb23d('0x0'));var emlformat=require(_0xb23d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb23d('0x2'));var moment=require(_0xb23d('0x3'));var BPromise=require(_0xb23d('0x4'));var Mustache=require(_0xb23d('0x5'));var util=require(_0xb23d('0x6'));var path=require(_0xb23d('0x7'));var sox=require(_0xb23d('0x8'));var csv=require(_0xb23d('0x9'));var ejs=require(_0xb23d('0xa'));var fs=require('fs');var _=require(_0xb23d('0xb'));var squel=require(_0xb23d('0xc'));var crypto=require(_0xb23d('0xd'));var jsforce=require(_0xb23d('0xe'));var deskjs=require(_0xb23d('0xf'));var toCsv=require(_0xb23d('0x9'));var querystring=require('querystring');var Papa=require(_0xb23d('0x10'));var Redis=require('ioredis');var authService=require(_0xb23d('0x11'));var qs=require(_0xb23d('0x12'));var as=require(_0xb23d('0x13'));var hardwareService=require(_0xb23d('0x14'));var logger=require(_0xb23d('0x15'))(_0xb23d('0x16'));var utils=require(_0xb23d('0x17'));var config=require(_0xb23d('0x18'));var licenseUtil=require(_0xb23d('0x19'));var db=require(_0xb23d('0x1a'))['db'];function respondWithStatusCode(_0x4b5f71,_0xa2bd2a){_0xa2bd2a=_0xa2bd2a||0xcc;return function(_0x13672a){if(_0x13672a){return _0x4b5f71[_0xb23d('0x1b')](_0xa2bd2a);}return _0x4b5f71['status'](_0xa2bd2a)[_0xb23d('0x1c')]();};}function respondWithResult(_0x2c3837,_0x2a7f43){_0x2a7f43=_0x2a7f43||0xc8;return function(_0x661e45){if(_0x661e45){return _0x2c3837['status'](_0x2a7f43)[_0xb23d('0x1d')](_0x661e45);}};}function respondWithFilteredResult(_0x2020a1,_0x30579e){return function(_0x278d5d){if(_0x278d5d){var _0x155618=_0x278d5d[_0xb23d('0x1e')],_0x47b991=_0x30579e[_0xb23d('0x1f')],_0x39f310=_0x30579e[_0xb23d('0x1f')]+_0x30579e['limit'],_0x57dd9b;if(_0x39f310>=_0x155618){_0x39f310=_0x155618;_0x57dd9b=0xc8;}else{_0x57dd9b=0xce;}_0x2020a1['status'](_0x57dd9b);return _0x2020a1[_0xb23d('0x20')](_0xb23d('0x21'),_0x47b991+'-'+_0x39f310+'/'+_0x155618)[_0xb23d('0x1d')](_0x278d5d);}return null;};}function patchUpdates(_0x31d671){return function(_0x1fd659){try{jsonpatch[_0xb23d('0x22')](_0x1fd659,_0x31d671,!![]);}catch(_0x4bbf12){return BPromise[_0xb23d('0x23')](_0x4bbf12);}return _0x1fd659[_0xb23d('0x24')]();};}function saveUpdates(_0x245eb6,_0x1ab92c){return function(_0x397e5f){if(_0x397e5f){return _0x397e5f['update'](_0x245eb6)['then'](function(_0x12d669){return _0x12d669;});}return null;};}function removeEntity(_0xdcf5c,_0x2dfd97){return function(_0x212742){if(_0x212742){return _0x212742[_0xb23d('0x25')]()[_0xb23d('0x26')](function(){_0xdcf5c['status'](0xcc)[_0xb23d('0x1c')]();});}};}function handleEntityNotFound(_0x2cf805,_0x1ea48d){return function(_0x3da31b){if(!_0x3da31b){_0x2cf805[_0xb23d('0x1b')](0x194);}return _0x3da31b;};}function handleError(_0xbc9a5e,_0x2d6172){_0x2d6172=_0x2d6172||0x1f4;return function(_0x29b1f9){logger['error'](_0x29b1f9[_0xb23d('0x27')]);if(_0x29b1f9[_0xb23d('0x28')]){delete _0x29b1f9[_0xb23d('0x28')];}_0xbc9a5e[_0xb23d('0x29')](_0x2d6172)[_0xb23d('0x2a')](_0x29b1f9);};}exports[_0xb23d('0x2b')]=function(_0x33e1dc,_0x1c19b5){var _0x5a2a49={},_0x27b9a0={},_0x2c15e9={'count':0x0,'rows':[]};var _0x1340f9=_[_0xb23d('0x2c')](db[_0xb23d('0x2d')]['rawAttributes'],function(_0xe90563){return{'name':_0xe90563['fieldName'],'type':_0xe90563[_0xb23d('0x2e')][_0xb23d('0x2f')]};});_0x27b9a0[_0xb23d('0x30')]=_[_0xb23d('0x2c')](_0x1340f9,_0xb23d('0x28'));_0x27b9a0[_0xb23d('0x31')]=_['keys'](_0x33e1dc[_0xb23d('0x31')]);_0x27b9a0[_0xb23d('0x32')]=_[_0xb23d('0x33')](_0x27b9a0[_0xb23d('0x30')],_0x27b9a0[_0xb23d('0x31')]);_0x5a2a49[_0xb23d('0x34')]=_['intersection'](_0x27b9a0[_0xb23d('0x30')],qs['fields'](_0x33e1dc[_0xb23d('0x31')]['fields']));_0x5a2a49[_0xb23d('0x34')]=_0x5a2a49[_0xb23d('0x34')][_0xb23d('0x35')]?_0x5a2a49[_0xb23d('0x34')]:_0x27b9a0[_0xb23d('0x30')];if(!_0x33e1dc['query'][_0xb23d('0x36')]('nolimit')){_0x5a2a49[_0xb23d('0x37')]=qs['limit'](_0x33e1dc['query']['limit']);_0x5a2a49['offset']=qs['offset'](_0x33e1dc[_0xb23d('0x31')][_0xb23d('0x1f')]);}_0x5a2a49[_0xb23d('0x38')]=qs[_0xb23d('0x39')](_0x33e1dc[_0xb23d('0x31')][_0xb23d('0x39')]);_0x5a2a49[_0xb23d('0x3a')]=qs[_0xb23d('0x32')](_[_0xb23d('0x3b')](_0x33e1dc[_0xb23d('0x31')],_0x27b9a0[_0xb23d('0x32')]),_0x1340f9);if(_0x33e1dc['query'][_0xb23d('0x3c')]){_0x5a2a49['where']=_[_0xb23d('0x3d')](_0x5a2a49['where'],{'$or':_['map'](_0x1340f9,function(_0x34b15e){if(_0x34b15e['type']!==_0xb23d('0x3e')){var _0x17262f={};_0x17262f[_0x34b15e[_0xb23d('0x28')]]={'$like':'%'+_0x33e1dc[_0xb23d('0x31')]['filter']+'%'};return _0x17262f;}})});}_0x5a2a49=_[_0xb23d('0x3d')]({},_0x5a2a49,_0x33e1dc['options']);var _0x33b87b={'where':_0x5a2a49[_0xb23d('0x3a')]};return db[_0xb23d('0x2d')]['count'](_0x33b87b)[_0xb23d('0x26')](function(_0x166c50){_0x2c15e9[_0xb23d('0x1e')]=_0x166c50;if(_0x33e1dc[_0xb23d('0x31')]['includeAll']){_0x5a2a49['include']=[{'all':!![]}];}return db[_0xb23d('0x2d')][_0xb23d('0x3f')](_0x5a2a49);})[_0xb23d('0x26')](function(_0x37d1e9){_0x2c15e9[_0xb23d('0x40')]=_0x37d1e9;return _0x2c15e9;})[_0xb23d('0x26')](respondWithFilteredResult(_0x1c19b5,_0x5a2a49))[_0xb23d('0x41')](handleError(_0x1c19b5,null));};exports[_0xb23d('0x42')]=function(_0x58dec4,_0x34ba0e){var _0x5e4b6c={'raw':!![],'where':{'id':_0x58dec4[_0xb23d('0x43')]['id']}},_0x20065d={};_0x20065d[_0xb23d('0x30')]=_[_0xb23d('0x44')](db[_0xb23d('0x2d')][_0xb23d('0x45')]);_0x20065d[_0xb23d('0x31')]=_['keys'](_0x58dec4['query']);_0x20065d[_0xb23d('0x46')]=_[_0xb23d('0x33')](_0x20065d[_0xb23d('0x30')],_0x20065d[_0xb23d('0x31')]);_0x5e4b6c[_0xb23d('0x34')]=_[_0xb23d('0x33')](_0x20065d[_0xb23d('0x30')],qs['fields'](_0x58dec4[_0xb23d('0x31')][_0xb23d('0x47')]));_0x5e4b6c[_0xb23d('0x34')]=_0x5e4b6c['attributes'][_0xb23d('0x35')]?_0x5e4b6c[_0xb23d('0x34')]:_0x20065d[_0xb23d('0x30')];if(_0x58dec4[_0xb23d('0x31')]['includeAll']){_0x5e4b6c['include']=[{'all':!![]}];}_0x5e4b6c=_[_0xb23d('0x3d')]({},_0x5e4b6c,_0x58dec4['options']);return db['CmHopperBlack'][_0xb23d('0x48')](_0x5e4b6c)[_0xb23d('0x26')](handleEntityNotFound(_0x34ba0e,null))[_0xb23d('0x26')](respondWithResult(_0x34ba0e,null))['catch'](handleError(_0x34ba0e,null));};exports[_0xb23d('0x49')]=function(_0x3fd358,_0x53a856){if(_0x3fd358['body']['id']){delete _0x3fd358[_0xb23d('0x4a')]['id'];}return db['CmHopperBlack'][_0xb23d('0x48')]({'where':{'id':_0x3fd358[_0xb23d('0x43')]['id']}})[_0xb23d('0x26')](handleEntityNotFound(_0x53a856,null))[_0xb23d('0x26')](saveUpdates(_0x3fd358[_0xb23d('0x4a')],null))[_0xb23d('0x26')](respondWithResult(_0x53a856,null))[_0xb23d('0x41')](handleError(_0x53a856,null));};exports[_0xb23d('0x25')]=function(_0x4e5c76,_0x3c796c){return db['CmHopperBlack'][_0xb23d('0x48')]({'where':{'id':_0x4e5c76[_0xb23d('0x43')]['id']}})[_0xb23d('0x26')](handleEntityNotFound(_0x3c796c,null))[_0xb23d('0x26')](removeEntity(_0x3c796c,null))[_0xb23d('0x41')](handleError(_0x3c796c,null));};exports['describe']=function(_0x372943,_0x43a3aa){return db[_0xb23d('0x2d')]['describe']()[_0xb23d('0x26')](respondWithResult(_0x43a3aa,null))[_0xb23d('0x41')](handleError(_0x43a3aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 43461f2..0f84665 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 _0x1eb4=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ba91c,_0x483ee3){var _0x1d4b81=function(_0x2f8dcc){while(--_0x2f8dcc){_0x3ba91c['push'](_0x3ba91c['shift']());}};_0x1d4b81(++_0x483ee3);}(_0x1eb4,0x138));var _0x41eb=function(_0x686fa0,_0xaf185f){_0x686fa0=_0x686fa0-0x0;var _0x41f5ff=_0x1eb4[_0x686fa0];return _0x41f5ff;};'use strict';var _=require(_0x41eb('0x0'));var util=require(_0x41eb('0x1'));var logger=require(_0x41eb('0x2'))(_0x41eb('0x3'));var moment=require(_0x41eb('0x4'));var BPromise=require(_0x41eb('0x5'));var rp=require(_0x41eb('0x6'));var fs=require('fs');var path=require(_0x41eb('0x7'));var rimraf=require(_0x41eb('0x8'));var config=require(_0x41eb('0x9'));var attributes=require(_0x41eb('0xa'));module[_0x41eb('0xb')]=function(_0x3bc144,_0x34ef5f){return _0x3bc144[_0x41eb('0xc')](_0x41eb('0xd'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe88a=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x29f014,_0x508522){var _0x316be5=function(_0x1753a5){while(--_0x1753a5){_0x29f014['push'](_0x29f014['shift']());}};_0x316be5(++_0x508522);}(_0xe88a,0x6c));var _0xae88=function(_0x18f760,_0x4255ee){_0x18f760=_0x18f760-0x0;var _0x636bc9=_0xe88a[_0x18f760];return _0x636bc9;};'use strict';var _=require(_0xae88('0x0'));var util=require(_0xae88('0x1'));var logger=require(_0xae88('0x2'))(_0xae88('0x3'));var moment=require('moment');var BPromise=require(_0xae88('0x4'));var rp=require(_0xae88('0x5'));var fs=require('fs');var path=require(_0xae88('0x6'));var rimraf=require(_0xae88('0x7'));var config=require(_0xae88('0x8'));var attributes=require(_0xae88('0x9'));module[_0xae88('0xa')]=function(_0x51c67e,_0x30aee4){return _0x51c67e[_0xae88('0xb')](_0xae88('0xc'),attributes,{'tableName':_0xae88('0xd'),'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 47f173f..e7ad444 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 _0x521d=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','request\x20sent','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','CmHopperBlack','update','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','ioredis'];(function(_0x44113a,_0x17c405){var _0x526baf=function(_0xf5e3e2){while(--_0xf5e3e2){_0x44113a['push'](_0x44113a['shift']());}};_0x526baf(++_0x17c405);}(_0x521d,0xce));var _0xd521=function(_0x51b187,_0x5b0b62){_0x51b187=_0x51b187-0x0;var _0x6fd4a7=_0x521d[_0x51b187];return _0x6fd4a7;};'use strict';var _=require('lodash');var util=require(_0xd521('0x0'));var moment=require('moment');var BPromise=require(_0xd521('0x1'));var rs=require(_0xd521('0x2'));var fs=require('fs');var Redis=require(_0xd521('0x3'));var db=require(_0xd521('0x4'))['db'];var utils=require(_0xd521('0x5'));var logger=require(_0xd521('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd521('0x7'));var client=jayson['client'][_0xd521('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x367cf0,_0x1f7483,_0x392e74){return new BPromise(function(_0x5653b9,_0xe14f2a){return client['request'](_0x367cf0,_0x392e74)[_0xd521('0x9')](function(_0x2fb5de){logger[_0xd521('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x1f7483,_0xd521('0xb'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1f7483,_0xd521('0xb'),JSON[_0xd521('0xc')](_0x2fb5de));if(_0x2fb5de[_0xd521('0xd')]){if(_0x2fb5de[_0xd521('0xd')][_0xd521('0xe')]===0x1f4){logger[_0xd521('0xd')](_0xd521('0xf'),_0x1f7483,_0x2fb5de[_0xd521('0xd')]['message']);return _0xe14f2a(_0x2fb5de['error']['message']);}logger[_0xd521('0xd')](_0xd521('0xf'),_0x1f7483,_0x2fb5de[_0xd521('0xd')]['message']);return _0x5653b9(_0x2fb5de[_0xd521('0xd')][_0xd521('0x10')]);}else{logger['info'](_0xd521('0xf'),_0x1f7483,_0xd521('0xb'));_0x5653b9(_0x2fb5de[_0xd521('0x11')][_0xd521('0x10')]);}})[_0xd521('0x12')](function(_0x15bc06){logger[_0xd521('0xd')](_0xd521('0xf'),_0x1f7483,_0x15bc06);_0xe14f2a(_0x15bc06);});});}exports[_0xd521('0x13')]=function(_0x2ce45f){var _0x48d6fe=this;return new Promise(function(_0x16ff32,_0x4c45ca){return db['CmHopperBlack'][_0xd521('0x14')]({'raw':_0x2ce45f[_0xd521('0x15')]?_0x2ce45f[_0xd521('0x15')][_0xd521('0x16')]===undefined?!![]:![]:!![],'where':_0x2ce45f[_0xd521('0x15')]?_0x2ce45f[_0xd521('0x15')][_0xd521('0x17')]||null:null,'attributes':_0x2ce45f['options']?_0x2ce45f[_0xd521('0x15')][_0xd521('0x18')]||null:null,'limit':_0x2ce45f[_0xd521('0x15')]?_0x2ce45f[_0xd521('0x15')][_0xd521('0x19')]||null:null,'include':_0x2ce45f[_0xd521('0x15')]?_0x2ce45f[_0xd521('0x15')][_0xd521('0x1a')]?_[_0xd521('0x1b')](_0x2ce45f[_0xd521('0x15')][_0xd521('0x1a')],function(_0x36f2ba){return{'model':db[_0x36f2ba[_0xd521('0x1c')]],'as':_0x36f2ba['as'],'attributes':_0x36f2ba[_0xd521('0x18')],'include':_0x36f2ba[_0xd521('0x1a')]?_[_0xd521('0x1b')](_0x36f2ba[_0xd521('0x1a')],function(_0x41fd41){return{'model':db[_0x41fd41[_0xd521('0x1c')]],'as':_0x41fd41['as'],'attributes':_0x41fd41['attributes'],'include':_0x41fd41['include']?_[_0xd521('0x1b')](_0x41fd41['include'],function(_0x1e208a){return{'model':db[_0x1e208a[_0xd521('0x1c')]],'as':_0x1e208a['as'],'attributes':_0x1e208a[_0xd521('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd521('0x9')](function(_0x7d3a63){logger[_0xd521('0xa')](_0xd521('0x13'),_0x2ce45f);logger[_0xd521('0x1d')](_0xd521('0x13'),_0x2ce45f,JSON[_0xd521('0xc')](_0x7d3a63));_0x16ff32(_0x7d3a63);})[_0xd521('0x12')](function(_0x377a02){logger[_0xd521('0xd')](_0xd521('0x13'),_0x377a02[_0xd521('0x10')],_0x2ce45f);_0x4c45ca(_0x48d6fe[_0xd521('0xd')](0x1f4,_0x377a02[_0xd521('0x10')]));});});};exports[_0xd521('0x1e')]=function(_0x4f45a9){var _0x2363af=this;return new Promise(function(_0x45aa09,_0x2b9028){return db[_0xd521('0x1f')][_0xd521('0x20')](_0x4f45a9['body'],{'raw':_0x4f45a9[_0xd521('0x15')]?_0x4f45a9[_0xd521('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f45a9[_0xd521('0x15')]?_0x4f45a9[_0xd521('0x15')][_0xd521('0x17')]||null:null,'attributes':_0x4f45a9[_0xd521('0x15')]?_0x4f45a9[_0xd521('0x15')][_0xd521('0x18')]||null:null,'limit':_0x4f45a9[_0xd521('0x15')]?_0x4f45a9[_0xd521('0x15')]['limit']||null:null})[_0xd521('0x9')](function(_0x4725e0){logger[_0xd521('0xa')](_0xd521('0x1e'),_0x4f45a9);logger[_0xd521('0x1d')](_0xd521('0x1e'),_0x4f45a9,JSON[_0xd521('0xc')](_0x4725e0));_0x45aa09(_0x4725e0);})[_0xd521('0x12')](function(_0x13a9b8){logger[_0xd521('0xd')](_0xd521('0x1e'),_0x13a9b8[_0xd521('0x10')],_0x4f45a9);_0x2b9028(_0x2363af[_0xd521('0xd')](0x1f4,_0x13a9b8[_0xd521('0x10')]));});});};exports[_0xd521('0x21')]=function(_0x5b4ff2){var _0x1d77b2=this;return new Promise(function(_0xdd57fa,_0x14314a){return db['CmHopperBlack'][_0xd521('0x22')]({'where':_0x5b4ff2[_0xd521('0x15')]?_0x5b4ff2[_0xd521('0x15')][_0xd521('0x17')]||null:null})[_0xd521('0x9')](function(_0xbda987){logger[_0xd521('0xa')](_0xd521('0x21'),_0x5b4ff2);logger['debug'](_0xd521('0x21'),_0x5b4ff2,JSON[_0xd521('0xc')](_0xbda987));_0xdd57fa(_0xbda987);})['catch'](function(_0x4588aa){logger[_0xd521('0xd')](_0xd521('0x21'),_0x4588aa[_0xd521('0x10')],_0x5b4ff2);_0x14314a(_0x1d77b2[_0xd521('0xd')](0x1f4,_0x4588aa['message']));});});}; \ No newline at end of file +var _0x5b6f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCmHopperBlack','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','CmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring'];(function(_0x231a13,_0x2fed13){var _0x58fd7a=function(_0xf52e3f){while(--_0xf52e3f){_0x231a13['push'](_0x231a13['shift']());}};_0x58fd7a(++_0x2fed13);}(_0x5b6f,0x1e9));var _0xf5b6=function(_0x19f92d,_0x55e990){_0x19f92d=_0x19f92d-0x0;var _0x4c7457=_0x5b6f[_0x19f92d];return _0x4c7457;};'use strict';var _=require(_0xf5b6('0x0'));var util=require(_0xf5b6('0x1'));var moment=require(_0xf5b6('0x2'));var BPromise=require(_0xf5b6('0x3'));var rs=require(_0xf5b6('0x4'));var fs=require('fs');var Redis=require(_0xf5b6('0x5'));var db=require(_0xf5b6('0x6'))['db'];var utils=require(_0xf5b6('0x7'));var logger=require(_0xf5b6('0x8'))(_0xf5b6('0x9'));var config=require(_0xf5b6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xf5b6('0xb')][_0xf5b6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19a68c,_0x43593a,_0x51472c){return new BPromise(function(_0x3f635f,_0x2fd968){return client['request'](_0x19a68c,_0x51472c)[_0xf5b6('0xd')](function(_0x5ac91e){logger[_0xf5b6('0xe')](_0xf5b6('0xf'),_0x43593a,_0xf5b6('0x10'));logger[_0xf5b6('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x43593a,_0xf5b6('0x10'),JSON[_0xf5b6('0x12')](_0x5ac91e));if(_0x5ac91e[_0xf5b6('0x13')]){if(_0x5ac91e[_0xf5b6('0x13')][_0xf5b6('0x14')]===0x1f4){logger['error'](_0xf5b6('0xf'),_0x43593a,_0x5ac91e[_0xf5b6('0x13')][_0xf5b6('0x15')]);return _0x2fd968(_0x5ac91e['error'][_0xf5b6('0x15')]);}logger[_0xf5b6('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x43593a,_0x5ac91e[_0xf5b6('0x13')][_0xf5b6('0x15')]);return _0x3f635f(_0x5ac91e[_0xf5b6('0x13')]['message']);}else{logger[_0xf5b6('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x43593a,_0xf5b6('0x10'));_0x3f635f(_0x5ac91e['result'][_0xf5b6('0x15')]);}})[_0xf5b6('0x16')](function(_0x3afa21){logger[_0xf5b6('0x13')](_0xf5b6('0xf'),_0x43593a,_0x3afa21);_0x2fd968(_0x3afa21);});});}exports[_0xf5b6('0x17')]=function(_0x3705d5){var _0x26d4f6=this;return new Promise(function(_0x14d5da,_0x51bf0e){return db['CmHopperBlack']['findAll']({'raw':_0x3705d5[_0xf5b6('0x18')]?_0x3705d5[_0xf5b6('0x18')][_0xf5b6('0x19')]===undefined?!![]:![]:!![],'where':_0x3705d5[_0xf5b6('0x18')]?_0x3705d5[_0xf5b6('0x18')][_0xf5b6('0x1a')]||null:null,'attributes':_0x3705d5[_0xf5b6('0x18')]?_0x3705d5['options'][_0xf5b6('0x1b')]||null:null,'limit':_0x3705d5['options']?_0x3705d5[_0xf5b6('0x18')]['limit']||null:null,'include':_0x3705d5[_0xf5b6('0x18')]?_0x3705d5[_0xf5b6('0x18')][_0xf5b6('0x1c')]?_[_0xf5b6('0x1d')](_0x3705d5[_0xf5b6('0x18')][_0xf5b6('0x1c')],function(_0x4a0109){return{'model':db[_0x4a0109[_0xf5b6('0x1e')]],'as':_0x4a0109['as'],'attributes':_0x4a0109['attributes'],'include':_0x4a0109[_0xf5b6('0x1c')]?_[_0xf5b6('0x1d')](_0x4a0109[_0xf5b6('0x1c')],function(_0x35dc51){return{'model':db[_0x35dc51[_0xf5b6('0x1e')]],'as':_0x35dc51['as'],'attributes':_0x35dc51[_0xf5b6('0x1b')],'include':_0x35dc51[_0xf5b6('0x1c')]?_[_0xf5b6('0x1d')](_0x35dc51[_0xf5b6('0x1c')],function(_0x317dd5){return{'model':db[_0x317dd5['model']],'as':_0x317dd5['as'],'attributes':_0x317dd5['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5b6('0xd')](function(_0x16a9a6){logger[_0xf5b6('0xe')]('GetCmHopperBlack',_0x3705d5);logger[_0xf5b6('0x11')](_0xf5b6('0x17'),_0x3705d5,JSON[_0xf5b6('0x12')](_0x16a9a6));_0x14d5da(_0x16a9a6);})['catch'](function(_0x3209c6){logger['error'](_0xf5b6('0x17'),_0x3209c6[_0xf5b6('0x15')],_0x3705d5);_0x51bf0e(_0x26d4f6[_0xf5b6('0x13')](0x1f4,_0x3209c6[_0xf5b6('0x15')]));});});};exports[_0xf5b6('0x1f')]=function(_0x4836b8){var _0x4f76b4=this;return new Promise(function(_0x515da7,_0x5f34f6){return db[_0xf5b6('0x20')][_0xf5b6('0x21')](_0x4836b8[_0xf5b6('0x22')],{'raw':_0x4836b8[_0xf5b6('0x18')]?_0x4836b8[_0xf5b6('0x18')][_0xf5b6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4836b8[_0xf5b6('0x18')]?_0x4836b8[_0xf5b6('0x18')][_0xf5b6('0x1a')]||null:null,'attributes':_0x4836b8['options']?_0x4836b8[_0xf5b6('0x18')][_0xf5b6('0x1b')]||null:null,'limit':_0x4836b8[_0xf5b6('0x18')]?_0x4836b8[_0xf5b6('0x18')][_0xf5b6('0x23')]||null:null})['then'](function(_0x2fb870){logger[_0xf5b6('0xe')]('UpdateCmHopperBlack',_0x4836b8);logger['debug'](_0xf5b6('0x1f'),_0x4836b8,JSON[_0xf5b6('0x12')](_0x2fb870));_0x515da7(_0x2fb870);})[_0xf5b6('0x16')](function(_0x25d26e){logger[_0xf5b6('0x13')]('UpdateCmHopperBlack',_0x25d26e[_0xf5b6('0x15')],_0x4836b8);_0x5f34f6(_0x4f76b4[_0xf5b6('0x13')](0x1f4,_0x25d26e[_0xf5b6('0x15')]));});});};exports[_0xf5b6('0x24')]=function(_0x31f4e5){var _0x168b34=this;return new Promise(function(_0x2de168,_0x30aa29){return db[_0xf5b6('0x20')][_0xf5b6('0x25')]({'where':_0x31f4e5[_0xf5b6('0x18')]?_0x31f4e5['options'][_0xf5b6('0x1a')]||null:null})['then'](function(_0xc7450c){logger['info']('DestroyCmHopperBlack',_0x31f4e5);logger[_0xf5b6('0x11')](_0xf5b6('0x24'),_0x31f4e5,JSON['stringify'](_0xc7450c));_0x2de168(_0xc7450c);})[_0xf5b6('0x16')](function(_0xb6f712){logger[_0xf5b6('0x13')]('DestroyCmHopperBlack',_0xb6f712[_0xf5b6('0x15')],_0x31f4e5);_0x30aa29(_0x168b34['error'](0x1f4,_0xb6f712['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 9d279c6..2d3bc39 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 _0xfd28=['index','/describe','/:id','put','delete','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4c786a,_0x98b32a){var _0x2dbd7f=function(_0x2cdce3){while(--_0x2cdce3){_0x4c786a['push'](_0x4c786a['shift']());}};_0x2dbd7f(++_0x98b32a);}(_0xfd28,0x148));var _0x8fd2=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xfd28[_0x2338fa];return _0x42df9b;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var auth=require(_0x8fd2('0x3'));var interaction=require(_0x8fd2('0x4'));var config=require(_0x8fd2('0x5'));var controller=require('./cmHopperBlack.controller');router[_0x8fd2('0x6')]('/',auth[_0x8fd2('0x7')](),controller[_0x8fd2('0x8')]);router[_0x8fd2('0x6')](_0x8fd2('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x8fd2('0x6')](_0x8fd2('0xa'),auth[_0x8fd2('0x7')](),controller['show']);router[_0x8fd2('0xb')]('/:id',auth[_0x8fd2('0x7')](),controller['update']);router[_0x8fd2('0xc')]('/:id',auth[_0x8fd2('0x7')](),controller['destroy']);module[_0x8fd2('0xd')]=router; \ No newline at end of file +var _0x4bc3=['get','isAuthenticated','index','/describe','/:id','show','put','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller'];(function(_0x40aa31,_0x175b59){var _0x393c74=function(_0x119817){while(--_0x119817){_0x40aa31['push'](_0x40aa31['shift']());}};_0x393c74(++_0x175b59);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x4bc3[_0x4c440b];return _0x2d48cf;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x34bc('0x8')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x34bc('0xf')](_0x34bc('0xc'),auth[_0x34bc('0x9')](),controller['destroy']);module[_0x34bc('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 72ba3f1..cb5d859 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 _0x2610=['BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','getDataValue','setDataValue','followuptime','diff','seconds','dispositionat'];(function(_0x3f9d4a,_0x27c3ed){var _0x1ba2e9=function(_0x4eccfb){while(--_0x4eccfb){_0x3f9d4a['push'](_0x3f9d4a['shift']());}};_0x1ba2e9(++_0x27c3ed);}(_0x2610,0xc4));var _0x0261=function(_0x37abdc,_0x204c72){_0x37abdc=_0x37abdc-0x0;var _0x135c79=_0x2610[_0x37abdc];return _0x135c79;};'use strict';var Sequelize=require(_0x0261('0x0'));var moment=require(_0x0261('0x1'));module[_0x0261('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0261('0x3')]},'countbusyretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0261('0x5')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0261('0x5')]},'calleridname':{'type':Sequelize[_0x0261('0x5')]},'starttime':{'type':Sequelize[_0x0261('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0261('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0261('0x5')]},'campaign':{'type':Sequelize[_0x0261('0x5')]},'campaigntype':{'type':Sequelize[_0x0261('0x5')]},'membername':{'type':Sequelize[_0x0261('0x5')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0261('0x5')]},'thirdDisposition':{'type':Sequelize[_0x0261('0x5')]},'dispositionat':{'type':Sequelize[_0x0261('0x3')],'set':function(_0x4317c0){var _0x3faa60=this[_0x0261('0x6')]('endtime');if(_0x3faa60&&_0x4317c0){this[_0x0261('0x7')](_0x0261('0x8'),moment(_0x4317c0)[_0x0261('0x9')](moment(_0x3faa60),_0x0261('0xa')));}return this[_0x0261('0x7')](_0x0261('0xb'),_0x4317c0);}},'amd':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0261('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0261('0x3')]},'deleted':{'type':Sequelize[_0x0261('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0261('0x3')]},'recallme':{'type':Sequelize[_0x0261('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0261('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x247c=['dispositionat','BOOLEAN','moment','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','seconds','setDataValue'];(function(_0x50b1f7,_0x471a02){var _0x4119df=function(_0x46606d){while(--_0x46606d){_0x50b1f7['push'](_0x50b1f7['shift']());}};_0x4119df(++_0x471a02);}(_0x247c,0x162));var _0xc247=function(_0x571c00,_0x3ae028){_0x571c00=_0x571c00-0x0;var _0x2887df=_0x247c[_0x571c00];return _0x2887df;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc247('0x0'));module['exports']={'state':{'type':Sequelize[_0xc247('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc247('0x2')]},'scheduledat':{'type':Sequelize[_0xc247('0x3')]},'countbusyretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc247('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xc247('0x2')]},'originatecalleridname':{'type':Sequelize[_0xc247('0x2')]},'calleridnum':{'type':Sequelize[_0xc247('0x2')]},'calleridname':{'type':Sequelize[_0xc247('0x2')]},'starttime':{'type':Sequelize[_0xc247('0x3')]},'responsetime':{'type':Sequelize[_0xc247('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc247('0x3')]},'endtime':{'type':Sequelize[_0xc247('0x3')]},'ringtime':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc247('0x2')]},'campaign':{'type':Sequelize[_0xc247('0x2')]},'campaigntype':{'type':Sequelize[_0xc247('0x2')]},'membername':{'type':Sequelize[_0xc247('0x2')]},'reason':{'type':Sequelize[_0xc247('0x2')]},'disposition':{'type':Sequelize[_0xc247('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc247('0x2')]},'dispositionat':{'type':Sequelize[_0xc247('0x3')],'set':function(_0x3ad2c8){var _0x490f94=this[_0xc247('0x4')](_0xc247('0x5'));if(_0x490f94&&_0x3ad2c8){this['setDataValue'](_0xc247('0x6'),moment(_0x3ad2c8)['diff'](moment(_0x490f94),_0xc247('0x7')));}return this[_0xc247('0x8')](_0xc247('0x9'),_0x3ad2c8);}},'amd':{'type':Sequelize[_0xc247('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc247('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc247('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xc247('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc247('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc247('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc247('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc247('0x3')]},'recallme':{'type':Sequelize[_0xc247('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc247('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc247('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc247('0x1')],'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 8ea0dc6..fba80e7 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 _0x7ba0=['sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','toString','state\x20=\x20?','state','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','cm_hopper','fromQuery','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','../../config/license/util','sendStatus','status','end','json','count','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filters','filter','type','VIRTUAL','merge','includeAll','include','rows','catch','show','params','filtears','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll'];(function(_0x2fc677,_0x17cba8){var _0x78be7=function(_0x59cd8c){while(--_0x59cd8c){_0x2fc677['push'](_0x2fc677['shift']());}};_0x78be7(++_0x17cba8);}(_0x7ba0,0x1bc));var _0x07ba=function(_0x129050,_0x5a847b){_0x129050=_0x129050-0x0;var _0x217aa9=_0x7ba0[_0x129050];return _0x217aa9;};'use strict';var pdf=require(_0x07ba('0x0'));var emlformat=require(_0x07ba('0x1'));var rimraf=require(_0x07ba('0x2'));var zipdir=require(_0x07ba('0x3'));var jsonpatch=require(_0x07ba('0x4'));var rp=require(_0x07ba('0x5'));var moment=require(_0x07ba('0x6'));var BPromise=require(_0x07ba('0x7'));var Mustache=require(_0x07ba('0x8'));var util=require(_0x07ba('0x9'));var path=require(_0x07ba('0xa'));var sox=require('sox');var csv=require(_0x07ba('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x07ba('0xc'));var jsforce=require(_0x07ba('0xd'));var deskjs=require(_0x07ba('0xe'));var toCsv=require(_0x07ba('0xb'));var querystring=require(_0x07ba('0xf'));var Papa=require(_0x07ba('0x10'));var Redis=require(_0x07ba('0x11'));var authService=require(_0x07ba('0x12'));var qs=require(_0x07ba('0x13'));var as=require(_0x07ba('0x14'));var hardwareService=require(_0x07ba('0x15'));var logger=require(_0x07ba('0x16'))('api');var utils=require(_0x07ba('0x17'));var config=require(_0x07ba('0x18'));var licenseUtil=require(_0x07ba('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4434c1,_0x6d7773){_0x6d7773=_0x6d7773||0xcc;return function(_0x59fcbe){if(_0x59fcbe){return _0x4434c1[_0x07ba('0x1a')](_0x6d7773);}return _0x4434c1[_0x07ba('0x1b')](_0x6d7773)[_0x07ba('0x1c')]();};}function respondWithResult(_0x370b33,_0x47303e){_0x47303e=_0x47303e||0xc8;return function(_0xfd4e59){if(_0xfd4e59){return _0x370b33[_0x07ba('0x1b')](_0x47303e)[_0x07ba('0x1d')](_0xfd4e59);}};}function respondWithFilteredResult(_0x551c71,_0x25abba){return function(_0x4c1cb9){if(_0x4c1cb9){var _0x3dc5ad=_0x4c1cb9[_0x07ba('0x1e')],_0x5e1d2b=_0x25abba['offset'],_0x1aa58c=_0x25abba['offset']+_0x25abba[_0x07ba('0x1f')],_0x67f4d0;if(_0x1aa58c>=_0x3dc5ad){_0x1aa58c=_0x3dc5ad;_0x67f4d0=0xc8;}else{_0x67f4d0=0xce;}_0x551c71[_0x07ba('0x1b')](_0x67f4d0);return _0x551c71[_0x07ba('0x20')](_0x07ba('0x21'),_0x5e1d2b+'-'+_0x1aa58c+'/'+_0x3dc5ad)[_0x07ba('0x1d')](_0x4c1cb9);}return null;};}function patchUpdates(_0x5b1d5f){return function(_0x200745){try{jsonpatch[_0x07ba('0x22')](_0x200745,_0x5b1d5f,!![]);}catch(_0x55be54){return BPromise['reject'](_0x55be54);}return _0x200745['save']();};}function saveUpdates(_0x3ccb95,_0x33d0a8){return function(_0x5d1337){if(_0x5d1337){return _0x5d1337['update'](_0x3ccb95)[_0x07ba('0x23')](function(_0xc0c091){return _0xc0c091;});}return null;};}function removeEntity(_0x5cd855,_0x1e29e8){return function(_0x44eff3){if(_0x44eff3){return _0x44eff3[_0x07ba('0x24')]()[_0x07ba('0x23')](function(){_0x5cd855['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x271d31,_0x34d61e){return function(_0x4e5f65){if(!_0x4e5f65){_0x271d31[_0x07ba('0x1a')](0x194);}return _0x4e5f65;};}function handleError(_0xfa2a9a,_0x1387ff){_0x1387ff=_0x1387ff||0x1f4;return function(_0x4dd73c){logger[_0x07ba('0x25')](_0x4dd73c[_0x07ba('0x26')]);if(_0x4dd73c[_0x07ba('0x27')]){delete _0x4dd73c['name'];}_0xfa2a9a[_0x07ba('0x1b')](_0x1387ff)[_0x07ba('0x28')](_0x4dd73c);};}exports[_0x07ba('0x29')]=function(_0x2350c0,_0x1e808d){var _0x35f85a={},_0x3475e0={},_0x4ae10d={'count':0x0,'rows':[]};var _0x50ab16=_[_0x07ba('0x2a')](db[_0x07ba('0x2b')][_0x07ba('0x2c')],function(_0x4db484){return{'name':_0x4db484[_0x07ba('0x2d')],'type':_0x4db484['type'][_0x07ba('0x2e')]};});_0x3475e0['model']=_[_0x07ba('0x2a')](_0x50ab16,_0x07ba('0x27'));_0x3475e0[_0x07ba('0x2f')]=_[_0x07ba('0x30')](_0x2350c0[_0x07ba('0x2f')]);_0x3475e0['filters']=_['intersection'](_0x3475e0['model'],_0x3475e0[_0x07ba('0x2f')]);_0x35f85a[_0x07ba('0x31')]=_[_0x07ba('0x32')](_0x3475e0[_0x07ba('0x33')],qs[_0x07ba('0x34')](_0x2350c0[_0x07ba('0x2f')]['fields']));_0x35f85a[_0x07ba('0x31')]=_0x35f85a[_0x07ba('0x31')][_0x07ba('0x35')]?_0x35f85a['attributes']:_0x3475e0[_0x07ba('0x33')];if(!_0x2350c0[_0x07ba('0x2f')][_0x07ba('0x36')](_0x07ba('0x37'))){_0x35f85a[_0x07ba('0x1f')]=qs[_0x07ba('0x1f')](_0x2350c0['query']['limit']);_0x35f85a[_0x07ba('0x38')]=qs[_0x07ba('0x38')](_0x2350c0[_0x07ba('0x2f')][_0x07ba('0x38')]);}_0x35f85a[_0x07ba('0x39')]=qs['sort'](_0x2350c0['query'][_0x07ba('0x3a')]);_0x35f85a[_0x07ba('0x3b')]=qs['filters'](_[_0x07ba('0x3c')](_0x2350c0[_0x07ba('0x2f')],_0x3475e0[_0x07ba('0x3d')]),_0x50ab16);if(_0x2350c0['query'][_0x07ba('0x3e')]){_0x35f85a['where']=_['merge'](_0x35f85a[_0x07ba('0x3b')],{'$or':_['map'](_0x50ab16,function(_0x270274){if(_0x270274[_0x07ba('0x3f')]!==_0x07ba('0x40')){var _0x509cad={};_0x509cad[_0x270274[_0x07ba('0x27')]]={'$like':'%'+_0x2350c0[_0x07ba('0x2f')][_0x07ba('0x3e')]+'%'};return _0x509cad;}})});}_0x35f85a=_[_0x07ba('0x41')]({},_0x35f85a,_0x2350c0['options']);var _0x37d7d7={'where':_0x35f85a[_0x07ba('0x3b')]};return db[_0x07ba('0x2b')][_0x07ba('0x1e')](_0x37d7d7)[_0x07ba('0x23')](function(_0x158f19){_0x4ae10d[_0x07ba('0x1e')]=_0x158f19;if(_0x2350c0[_0x07ba('0x2f')][_0x07ba('0x42')]){_0x35f85a[_0x07ba('0x43')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x35f85a);})[_0x07ba('0x23')](function(_0x565f8d){_0x4ae10d[_0x07ba('0x44')]=_0x565f8d;return _0x4ae10d;})[_0x07ba('0x23')](respondWithFilteredResult(_0x1e808d,_0x35f85a))[_0x07ba('0x45')](handleError(_0x1e808d,null));};exports[_0x07ba('0x46')]=function(_0x25692a,_0x1dc7d4){var _0xd3e398={'raw':!![],'where':{'id':_0x25692a[_0x07ba('0x47')]['id']}},_0x48d203={};_0x48d203['model']=_['keys'](db[_0x07ba('0x2b')][_0x07ba('0x2c')]);_0x48d203[_0x07ba('0x2f')]=_[_0x07ba('0x30')](_0x25692a[_0x07ba('0x2f')]);_0x48d203[_0x07ba('0x48')]=_[_0x07ba('0x32')](_0x48d203[_0x07ba('0x33')],_0x48d203[_0x07ba('0x2f')]);_0xd3e398[_0x07ba('0x31')]=_[_0x07ba('0x32')](_0x48d203[_0x07ba('0x33')],qs['fields'](_0x25692a[_0x07ba('0x2f')][_0x07ba('0x34')]));_0xd3e398[_0x07ba('0x31')]=_0xd3e398[_0x07ba('0x31')][_0x07ba('0x35')]?_0xd3e398[_0x07ba('0x31')]:_0x48d203[_0x07ba('0x33')];if(_0x25692a[_0x07ba('0x2f')][_0x07ba('0x42')]){_0xd3e398['include']=[{'all':!![]}];}_0xd3e398=_[_0x07ba('0x41')]({},_0xd3e398,_0x25692a[_0x07ba('0x49')]);return db[_0x07ba('0x2b')][_0x07ba('0x4a')](_0xd3e398)[_0x07ba('0x23')](handleEntityNotFound(_0x1dc7d4,null))[_0x07ba('0x23')](respondWithResult(_0x1dc7d4,null))[_0x07ba('0x45')](handleError(_0x1dc7d4,null));};exports[_0x07ba('0x4b')]=function(_0xa7f39a,_0x18b1cd){return db[_0x07ba('0x2b')][_0x07ba('0x4b')]()[_0x07ba('0x23')](respondWithResult(_0x18b1cd,null))[_0x07ba('0x45')](handleError(_0x18b1cd,null));};exports['update']=function(_0x2585b9,_0x440285){if(_0x2585b9[_0x07ba('0x4c')][_0x07ba('0x4d')]){delete _0x2585b9[_0x07ba('0x4c')][_0x07ba('0x4d')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x2585b9['params']['id']}})[_0x07ba('0x23')](handleEntityNotFound(_0x440285,null))[_0x07ba('0x23')](saveUpdates(_0x2585b9[_0x07ba('0x4c')],null))[_0x07ba('0x23')](respondWithResult(_0x440285,null))[_0x07ba('0x45')](handleError(_0x440285,null));};exports[_0x07ba('0x4e')]=function(_0x584bb8,_0x208368,_0x5ca274){return db[_0x07ba('0x2b')][_0x07ba('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x584bb8['params']['id']},'attributes':[[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db['sequelize'][_0x07ba('0x52')](_0x07ba('0x53')))),'noSuchContacts'],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')]['literal'](_0x07ba('0x54')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x55')))),_0x07ba('0x56')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x57')))),_0x07ba('0x58')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db['sequelize'][_0x07ba('0x52')](_0x07ba('0x59')))),'dropContacts'],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x5a')))),_0x07ba('0x5b')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0x07ba('0x5c')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x5d')))),_0x07ba('0x5e')]]})[_0x07ba('0x23')](handleEntityNotFound(_0x208368,null))[_0x07ba('0x23')](respondWithResult(_0x208368,null))[_0x07ba('0x45')](handleError(_0x208368,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x1daf8e,_0x16fef0,_0x3fb4d9){return db[_0x07ba('0x2b')][_0x07ba('0x4f')]({'raw':![],'where':{'CampaignId':_0x1daf8e[_0x07ba('0x47')]['id']},'attributes':[[db[_0x07ba('0x50')]['fn']('COUNT',db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x53')))),'noSuchContacts'],[db['sequelize']['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x54')))),_0x07ba('0x5f')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x55')))),_0x07ba('0x56')],[db[_0x07ba('0x50')]['fn']('COUNT',db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x57')))),_0x07ba('0x58')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db['sequelize']['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db['sequelize']['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x5a')))),_0x07ba('0x5b')],[db[_0x07ba('0x50')]['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x07ba('0x51'),db[_0x07ba('0x50')]['fn']('IF',db[_0x07ba('0x50')][_0x07ba('0x52')](_0x07ba('0x5d')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x16fef0,null))[_0x07ba('0x23')](respondWithResult(_0x16fef0,null))[_0x07ba('0x45')](handleError(_0x16fef0,null));};exports[_0x07ba('0x60')]=function(_0x40d0e7,_0x583e32,_0x5c9ccc){return db[_0x07ba('0x61')]['find']({'where':{'id':_0x40d0e7['params']['id']}})['then'](handleEntityNotFound(_0x583e32,null))[_0x07ba('0x23')](function(_0x5c3736){var _0x5c6bfc;if(_0x5c3736){_0x5c6bfc=squel['insert']()[_0x07ba('0x62')]('cm_hopper')['fromQuery'](['phone',_0x07ba('0x63'),_0x07ba('0x64'),'ListId',_0x07ba('0x65'),_0x07ba('0x66'),_0x07ba('0x67')],squel[_0x07ba('0x68')]()[_0x07ba('0x69')](_0x07ba('0x6a'),_0x07ba('0x6b'))[_0x07ba('0x69')]('NOW()',_0x07ba('0x63'))[_0x07ba('0x69')](_0x07ba('0x6c'),'ContactId')[_0x07ba('0x69')](_0x07ba('0x6d'),_0x07ba('0x6e'))[_0x07ba('0x69')](_0x07ba('0x6f'),_0x07ba('0x65'))[_0x07ba('0x69')](_0x07ba('0x70'),_0x07ba('0x66'))[_0x07ba('0x69')](_0x07ba('0x70'),_0x07ba('0x67'))[_0x07ba('0x71')](_0x07ba('0x72'))[_0x07ba('0x3b')]('VoiceQueueId\x20=\x20?',_0x40d0e7['params']['id'][_0x07ba('0x73')]())[_0x07ba('0x3b')](_0x07ba('0x74'),_0x40d0e7[_0x07ba('0x4c')][_0x07ba('0x75')][_0x07ba('0x73')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x07ba('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x07ba('0x68')]()[_0x07ba('0x69')](_0x07ba('0x6b'))['from']('cm_hopper')[_0x07ba('0x3b')](_0x07ba('0x76'),_0x40d0e7['params']['id'][_0x07ba('0x73')]()))[_0x07ba('0x3b')](_0x07ba('0x77'),squel[_0x07ba('0x68')]()[_0x07ba('0x69')](_0x07ba('0x78'))[_0x07ba('0x71')](_0x07ba('0x72'))[_0x07ba('0x3b')]('VoiceQueueId\x20=\x20?',_0x40d0e7['params']['id'][_0x07ba('0x73')]())[_0x07ba('0x3b')]('state\x20=\x204'))[_0x07ba('0x79')]('ContactId'))['toString']();return db['sequelize']['query'](_0x5c6bfc);}return[];})[_0x07ba('0x23')](respondWithResult(_0x583e32,null))[_0x07ba('0x45')](handleError(_0x583e32,null));};exports[_0x07ba('0x7a')]=function(_0x4e0e31,_0xd8404b,_0x1c48bf){return db['Campaign'][_0x07ba('0x4a')]({'where':{'id':_0x4e0e31[_0x07ba('0x47')]['id']}})['then'](handleEntityNotFound(_0xd8404b,null))['then'](function(_0x5cc228){var _0x3e14f5;if(_0x5cc228){_0x3e14f5=squel['insert']()[_0x07ba('0x62')](_0x07ba('0x7b'))[_0x07ba('0x7c')](['phone','scheduledAt',_0x07ba('0x64'),'ListId',_0x07ba('0x7d'),_0x07ba('0x66'),'updatedAt'],squel[_0x07ba('0x68')]()['field']('ANY_VALUE(calleridnum)',_0x07ba('0x6b'))[_0x07ba('0x69')]('NOW()','scheduledAt')[_0x07ba('0x69')](_0x07ba('0x6c'),_0x07ba('0x64'))[_0x07ba('0x69')](_0x07ba('0x6d'),'ListId')[_0x07ba('0x69')]('ANY_VALUE(CampaignId)','CampaignId')[_0x07ba('0x69')](_0x07ba('0x70'),_0x07ba('0x66'))[_0x07ba('0x69')](_0x07ba('0x70'),_0x07ba('0x67'))[_0x07ba('0x71')](_0x07ba('0x72'))['where'](_0x07ba('0x7e'),_0x4e0e31[_0x07ba('0x47')]['id'][_0x07ba('0x73')]())['where'](_0x07ba('0x74'),_0x4e0e31['body'][_0x07ba('0x75')][_0x07ba('0x73')]())[_0x07ba('0x3b')](_0x07ba('0x7f'))[_0x07ba('0x3b')](_0x07ba('0x77'),squel['select']()[_0x07ba('0x69')]('phone')[_0x07ba('0x71')]('cm_hopper')[_0x07ba('0x3b')](_0x07ba('0x7e'),_0x4e0e31[_0x07ba('0x47')]['id']['toString']()))[_0x07ba('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x07ba('0x68')]()['field'](_0x07ba('0x78'))[_0x07ba('0x71')](_0x07ba('0x72'))[_0x07ba('0x3b')](_0x07ba('0x7e'),_0x4e0e31[_0x07ba('0x47')]['id'][_0x07ba('0x73')]())[_0x07ba('0x3b')](_0x07ba('0x80')))[_0x07ba('0x79')](_0x07ba('0x64')))[_0x07ba('0x73')]();return db[_0x07ba('0x50')][_0x07ba('0x2f')](_0x3e14f5);}return[];})[_0x07ba('0x23')](respondWithResult(_0xd8404b,null))['catch'](handleError(_0xd8404b,null));};exports['checkContactHopper']=function(_0x33870e,_0x2afc51,_0x350f5f){return db[_0x07ba('0x81')][_0x07ba('0x82')]({'where':{'VoiceQueueId':_0x33870e['body'][_0x07ba('0x65')],'CampaignId':_0x33870e['body'][_0x07ba('0x7d')],'ContactId':_0x33870e[_0x07ba('0x4c')]['ContactId']}})[_0x07ba('0x23')](handleEntityNotFound(_0x2afc51,null))['then'](function(_0x32f79c){if(_0x32f79c){return _0x32f79c;}return null;})[_0x07ba('0x23')](respondWithResult(_0x2afc51,null))[_0x07ba('0x45')](handleError(_0x2afc51,null));}; \ No newline at end of file +var _0x970f=['body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','VoiceQueue','find','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','select','calleridnum','group','CampaignId','updatedAt','CampaignId\x20=\x20?','checkContactHopper','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','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/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','CmHopperFinal','findAll','rows','catch','show','params','keys','filtears','includeAll','include','describe'];(function(_0x2804b6,_0x504b86){var _0x431298=function(_0xaa5b61){while(--_0xaa5b61){_0x2804b6['push'](_0x2804b6['shift']());}};_0x431298(++_0x504b86);}(_0x970f,0x1b5));var _0xf970=function(_0x10d98e,_0x266573){_0x10d98e=_0x10d98e-0x0;var _0x2203c5=_0x970f[_0x10d98e];return _0x2203c5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf970('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf970('0x1'));var jsonpatch=require(_0xf970('0x2'));var rp=require(_0xf970('0x3'));var moment=require('moment');var BPromise=require(_0xf970('0x4'));var Mustache=require(_0xf970('0x5'));var util=require(_0xf970('0x6'));var path=require(_0xf970('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf970('0x8'));var fs=require('fs');var _=require(_0xf970('0x9'));var squel=require(_0xf970('0xa'));var crypto=require('crypto');var jsforce=require(_0xf970('0xb'));var deskjs=require(_0xf970('0xc'));var toCsv=require(_0xf970('0xd'));var querystring=require(_0xf970('0xe'));var Papa=require(_0xf970('0xf'));var Redis=require('ioredis');var authService=require(_0xf970('0x10'));var qs=require(_0xf970('0x11'));var as=require(_0xf970('0x12'));var hardwareService=require(_0xf970('0x13'));var logger=require(_0xf970('0x14'))(_0xf970('0x15'));var utils=require(_0xf970('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf970('0x17'));var db=require(_0xf970('0x18'))['db'];function respondWithStatusCode(_0x63db25,_0x551648){_0x551648=_0x551648||0xcc;return function(_0x40dcf5){if(_0x40dcf5){return _0x63db25[_0xf970('0x19')](_0x551648);}return _0x63db25[_0xf970('0x1a')](_0x551648)[_0xf970('0x1b')]();};}function respondWithResult(_0x5de579,_0x73fc8){_0x73fc8=_0x73fc8||0xc8;return function(_0x5ea65b){if(_0x5ea65b){return _0x5de579[_0xf970('0x1a')](_0x73fc8)['json'](_0x5ea65b);}};}function respondWithFilteredResult(_0xdfb856,_0xe8d117){return function(_0x1dce8d){if(_0x1dce8d){var _0x294f90=_0x1dce8d[_0xf970('0x1c')],_0x580cf1=_0xe8d117[_0xf970('0x1d')],_0x1ab64d=_0xe8d117[_0xf970('0x1d')]+_0xe8d117[_0xf970('0x1e')],_0x539174;if(_0x1ab64d>=_0x294f90){_0x1ab64d=_0x294f90;_0x539174=0xc8;}else{_0x539174=0xce;}_0xdfb856[_0xf970('0x1a')](_0x539174);return _0xdfb856[_0xf970('0x1f')](_0xf970('0x20'),_0x580cf1+'-'+_0x1ab64d+'/'+_0x294f90)[_0xf970('0x21')](_0x1dce8d);}return null;};}function patchUpdates(_0x3494af){return function(_0x4fa36f){try{jsonpatch['apply'](_0x4fa36f,_0x3494af,!![]);}catch(_0x1ac6d2){return BPromise[_0xf970('0x22')](_0x1ac6d2);}return _0x4fa36f['save']();};}function saveUpdates(_0x56bfb6,_0x242f8c){return function(_0x4aaaf3){if(_0x4aaaf3){return _0x4aaaf3[_0xf970('0x23')](_0x56bfb6)[_0xf970('0x24')](function(_0x4260a){return _0x4260a;});}return null;};}function removeEntity(_0x551935,_0x4693c5){return function(_0xe8734c){if(_0xe8734c){return _0xe8734c['destroy']()[_0xf970('0x24')](function(){_0x551935['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50468b,_0x2bf520){return function(_0xfbfb5d){if(!_0xfbfb5d){_0x50468b[_0xf970('0x19')](0x194);}return _0xfbfb5d;};}function handleError(_0x381e0f,_0x59e27c){_0x59e27c=_0x59e27c||0x1f4;return function(_0x486ab3){logger['error'](_0x486ab3[_0xf970('0x25')]);if(_0x486ab3[_0xf970('0x26')]){delete _0x486ab3[_0xf970('0x26')];}_0x381e0f[_0xf970('0x1a')](_0x59e27c)[_0xf970('0x27')](_0x486ab3);};}exports[_0xf970('0x28')]=function(_0x14c8fb,_0x536286){var _0x1bffe5={},_0x2dbf66={},_0x5e4aaa={'count':0x0,'rows':[]};var _0x142ca3=_[_0xf970('0x29')](db['CmHopperFinal'][_0xf970('0x2a')],function(_0x356b83){return{'name':_0x356b83[_0xf970('0x2b')],'type':_0x356b83[_0xf970('0x2c')][_0xf970('0x2d')]};});_0x2dbf66[_0xf970('0x2e')]=_['map'](_0x142ca3,_0xf970('0x26'));_0x2dbf66[_0xf970('0x2f')]=_['keys'](_0x14c8fb[_0xf970('0x2f')]);_0x2dbf66[_0xf970('0x30')]=_[_0xf970('0x31')](_0x2dbf66['model'],_0x2dbf66[_0xf970('0x2f')]);_0x1bffe5[_0xf970('0x32')]=_[_0xf970('0x31')](_0x2dbf66[_0xf970('0x2e')],qs[_0xf970('0x33')](_0x14c8fb['query'][_0xf970('0x33')]));_0x1bffe5[_0xf970('0x32')]=_0x1bffe5[_0xf970('0x32')][_0xf970('0x34')]?_0x1bffe5[_0xf970('0x32')]:_0x2dbf66['model'];if(!_0x14c8fb[_0xf970('0x2f')][_0xf970('0x35')](_0xf970('0x36'))){_0x1bffe5[_0xf970('0x1e')]=qs['limit'](_0x14c8fb[_0xf970('0x2f')][_0xf970('0x1e')]);_0x1bffe5[_0xf970('0x1d')]=qs[_0xf970('0x1d')](_0x14c8fb[_0xf970('0x2f')]['offset']);}_0x1bffe5['order']=qs['sort'](_0x14c8fb[_0xf970('0x2f')][_0xf970('0x37')]);_0x1bffe5['where']=qs[_0xf970('0x30')](_['pick'](_0x14c8fb[_0xf970('0x2f')],_0x2dbf66[_0xf970('0x30')]),_0x142ca3);if(_0x14c8fb[_0xf970('0x2f')]['filter']){_0x1bffe5[_0xf970('0x38')]=_[_0xf970('0x39')](_0x1bffe5[_0xf970('0x38')],{'$or':_['map'](_0x142ca3,function(_0x4987c2){if(_0x4987c2[_0xf970('0x2c')]!==_0xf970('0x3a')){var _0x2fe18d={};_0x2fe18d[_0x4987c2[_0xf970('0x26')]]={'$like':'%'+_0x14c8fb[_0xf970('0x2f')][_0xf970('0x3b')]+'%'};return _0x2fe18d;}})});}_0x1bffe5=_[_0xf970('0x39')]({},_0x1bffe5,_0x14c8fb['options']);var _0x1e4243={'where':_0x1bffe5[_0xf970('0x38')]};return db['CmHopperFinal'][_0xf970('0x1c')](_0x1e4243)[_0xf970('0x24')](function(_0x953d6a){_0x5e4aaa['count']=_0x953d6a;if(_0x14c8fb[_0xf970('0x2f')]['includeAll']){_0x1bffe5['include']=[{'all':!![]}];}return db[_0xf970('0x3c')][_0xf970('0x3d')](_0x1bffe5);})[_0xf970('0x24')](function(_0xeed0a9){_0x5e4aaa[_0xf970('0x3e')]=_0xeed0a9;return _0x5e4aaa;})[_0xf970('0x24')](respondWithFilteredResult(_0x536286,_0x1bffe5))[_0xf970('0x3f')](handleError(_0x536286,null));};exports[_0xf970('0x40')]=function(_0x4b9593,_0x1395d1){var _0x514c94={'raw':!![],'where':{'id':_0x4b9593[_0xf970('0x41')]['id']}},_0x1c0cf0={};_0x1c0cf0[_0xf970('0x2e')]=_[_0xf970('0x42')](db[_0xf970('0x3c')][_0xf970('0x2a')]);_0x1c0cf0[_0xf970('0x2f')]=_[_0xf970('0x42')](_0x4b9593['query']);_0x1c0cf0[_0xf970('0x43')]=_[_0xf970('0x31')](_0x1c0cf0[_0xf970('0x2e')],_0x1c0cf0['query']);_0x514c94[_0xf970('0x32')]=_[_0xf970('0x31')](_0x1c0cf0[_0xf970('0x2e')],qs[_0xf970('0x33')](_0x4b9593[_0xf970('0x2f')][_0xf970('0x33')]));_0x514c94[_0xf970('0x32')]=_0x514c94[_0xf970('0x32')][_0xf970('0x34')]?_0x514c94[_0xf970('0x32')]:_0x1c0cf0[_0xf970('0x2e')];if(_0x4b9593['query'][_0xf970('0x44')]){_0x514c94[_0xf970('0x45')]=[{'all':!![]}];}_0x514c94=_[_0xf970('0x39')]({},_0x514c94,_0x4b9593['options']);return db['CmHopperFinal']['find'](_0x514c94)[_0xf970('0x24')](handleEntityNotFound(_0x1395d1,null))['then'](respondWithResult(_0x1395d1,null))[_0xf970('0x3f')](handleError(_0x1395d1,null));};exports[_0xf970('0x46')]=function(_0x1d4a04,_0x2f5d31){return db[_0xf970('0x3c')]['describe']()['then'](respondWithResult(_0x2f5d31,null))['catch'](handleError(_0x2f5d31,null));};exports['update']=function(_0x12e889,_0x560b63){if(_0x12e889[_0xf970('0x47')][_0xf970('0x48')]){delete _0x12e889[_0xf970('0x47')][_0xf970('0x48')];}return db[_0xf970('0x3c')]['find']({'where':{'uniqueid':_0x12e889['params']['id']}})[_0xf970('0x24')](handleEntityNotFound(_0x560b63,null))[_0xf970('0x24')](saveUpdates(_0x12e889[_0xf970('0x47')],null))[_0xf970('0x24')](respondWithResult(_0x560b63,null))[_0xf970('0x3f')](handleError(_0x560b63,null));};exports[_0xf970('0x49')]=function(_0x18e9af,_0x526332,_0x343961){return db[_0xf970('0x3c')][_0xf970('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x18e9af[_0xf970('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x4d')))),'noSuchContacts'],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x4e')))),'noAnswerContacts'],[db[_0xf970('0x4b')]['fn']('COUNT',db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x4f')))),_0xf970('0x50')],[db[_0xf970('0x4b')]['fn']('COUNT',db[_0xf970('0x4b')]['fn']('IF',db['sequelize'][_0xf970('0x4c')](_0xf970('0x51')))),_0xf970('0x52')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x53')))),_0xf970('0x54')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0xf970('0x4c')](_0xf970('0x55')))),_0xf970('0x56')],[db['sequelize']['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xf970('0x57')],[db['sequelize']['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x58')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x526332,null))['then'](respondWithResult(_0x526332,null))['catch'](handleError(_0x526332,null));};exports[_0xf970('0x59')]=function(_0x448d98,_0x171679,_0x1b60ec){return db[_0xf970('0x3c')]['findAll']({'raw':![],'where':{'CampaignId':_0x448d98[_0xf970('0x41')]['id']},'attributes':[[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x4d')))),_0xf970('0x5a')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xf970('0x5b')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x4f')))),_0xf970('0x50')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x51')))),'congestionContacts'],[db[_0xf970('0x4b')]['fn']('COUNT',db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x53')))),_0xf970('0x54')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')]['literal'](_0xf970('0x55')))),_0xf970('0x56')],[db['sequelize']['fn'](_0xf970('0x4a'),db['sequelize']['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x5c')))),_0xf970('0x57')],[db[_0xf970('0x4b')]['fn'](_0xf970('0x4a'),db[_0xf970('0x4b')]['fn']('IF',db[_0xf970('0x4b')][_0xf970('0x4c')](_0xf970('0x58')))),_0xf970('0x5d')]]})[_0xf970('0x24')](handleEntityNotFound(_0x171679,null))['then'](respondWithResult(_0x171679,null))[_0xf970('0x3f')](handleError(_0x171679,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2179d8,_0x22f4a6,_0xbdf5d6){return db[_0xf970('0x5e')][_0xf970('0x5f')]({'where':{'id':_0x2179d8[_0xf970('0x41')]['id']}})[_0xf970('0x24')](handleEntityNotFound(_0x22f4a6,null))[_0xf970('0x24')](function(_0x1ee33b){var _0x51a8d2;if(_0x1ee33b){_0x51a8d2=squel[_0xf970('0x60')]()[_0xf970('0x61')](_0xf970('0x62'))[_0xf970('0x63')]([_0xf970('0x64'),_0xf970('0x65'),'ContactId',_0xf970('0x66'),_0xf970('0x67'),_0xf970('0x68'),'updatedAt'],squel['select']()[_0xf970('0x69')](_0xf970('0x6a'),_0xf970('0x64'))[_0xf970('0x69')](_0xf970('0x6b'),_0xf970('0x65'))['field'](_0xf970('0x6c'),_0xf970('0x6d'))[_0xf970('0x69')](_0xf970('0x6e'),_0xf970('0x66'))[_0xf970('0x69')](_0xf970('0x6f'),_0xf970('0x67'))['field'](_0xf970('0x6b'),'createdAt')[_0xf970('0x69')]('NOW()','updatedAt')['from'](_0xf970('0x70'))[_0xf970('0x38')](_0xf970('0x71'),_0x2179d8['params']['id']['toString']())[_0xf970('0x38')](_0xf970('0x72'),_0x2179d8[_0xf970('0x47')][_0xf970('0x73')][_0xf970('0x74')]())['where'](_0xf970('0x75'))[_0xf970('0x38')](_0xf970('0x76'),squel['select']()['field'](_0xf970('0x64'))[_0xf970('0x77')](_0xf970('0x62'))['where'](_0xf970('0x71'),_0x2179d8[_0xf970('0x41')]['id']['toString']()))[_0xf970('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf970('0x78')]()['field'](_0xf970('0x79'))[_0xf970('0x77')]('cm_hopper_final')[_0xf970('0x38')](_0xf970('0x71'),_0x2179d8[_0xf970('0x41')]['id']['toString']())['where']('state\x20=\x204'))[_0xf970('0x7a')](_0xf970('0x6d')))[_0xf970('0x74')]();return db[_0xf970('0x4b')][_0xf970('0x2f')](_0x51a8d2);}return[];})[_0xf970('0x24')](respondWithResult(_0x22f4a6,null))['catch'](handleError(_0x22f4a6,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5985e8,_0x517b2d,_0x25d7f1){return db['Campaign'][_0xf970('0x5f')]({'where':{'id':_0x5985e8[_0xf970('0x41')]['id']}})[_0xf970('0x24')](handleEntityNotFound(_0x517b2d,null))[_0xf970('0x24')](function(_0x253a2c){var _0x115bbc;if(_0x253a2c){_0x115bbc=squel[_0xf970('0x60')]()['into']('cm_hopper')[_0xf970('0x63')](['phone',_0xf970('0x65'),_0xf970('0x6d'),_0xf970('0x66'),_0xf970('0x7b'),'createdAt',_0xf970('0x7c')],squel[_0xf970('0x78')]()[_0xf970('0x69')](_0xf970('0x6a'),'phone')[_0xf970('0x69')](_0xf970('0x6b'),_0xf970('0x65'))[_0xf970('0x69')](_0xf970('0x6c'),_0xf970('0x6d'))[_0xf970('0x69')](_0xf970('0x6e'),_0xf970('0x66'))['field']('ANY_VALUE(CampaignId)',_0xf970('0x7b'))[_0xf970('0x69')](_0xf970('0x6b'),_0xf970('0x68'))[_0xf970('0x69')]('NOW()',_0xf970('0x7c'))[_0xf970('0x77')](_0xf970('0x70'))[_0xf970('0x38')](_0xf970('0x7d'),_0x5985e8[_0xf970('0x41')]['id']['toString']())['where']('state\x20=\x20?',_0x5985e8[_0xf970('0x47')][_0xf970('0x73')]['toString']())[_0xf970('0x38')](_0xf970('0x75'))[_0xf970('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf970('0x78')]()[_0xf970('0x69')]('phone')[_0xf970('0x77')](_0xf970('0x62'))['where'](_0xf970('0x7d'),_0x5985e8[_0xf970('0x41')]['id']['toString']()))[_0xf970('0x38')](_0xf970('0x76'),squel['select']()[_0xf970('0x69')]('calleridnum')[_0xf970('0x77')](_0xf970('0x70'))[_0xf970('0x38')](_0xf970('0x7d'),_0x5985e8[_0xf970('0x41')]['id']['toString']())[_0xf970('0x38')]('state\x20=\x204'))[_0xf970('0x7a')](_0xf970('0x6d')))[_0xf970('0x74')]();return db['sequelize'][_0xf970('0x2f')](_0x115bbc);}return[];})[_0xf970('0x24')](respondWithResult(_0x517b2d,null))[_0xf970('0x3f')](handleError(_0x517b2d,null));};exports[_0xf970('0x7e')]=function(_0x985e42,_0x138333,_0xa0ea5a){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x985e42[_0xf970('0x47')][_0xf970('0x67')],'CampaignId':_0x985e42[_0xf970('0x47')][_0xf970('0x7b')],'ContactId':_0x985e42['body']['ContactId']}})[_0xf970('0x24')](handleEntityNotFound(_0x138333,null))[_0xf970('0x24')](function(_0x4cfec4){if(_0x4cfec4){return _0x4cfec4;}return null;})['then'](respondWithResult(_0x138333,null))[_0xf970('0x3f')](handleError(_0x138333,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 13da662..1cdc884 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 _0x69f2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x31f9c7,_0x1d5f54){var _0x46c5b3=function(_0x3180e3){while(--_0x3180e3){_0x31f9c7['push'](_0x31f9c7['shift']());}};_0x46c5b3(++_0x1d5f54);}(_0x69f2,0x14d));var _0x269f=function(_0x41d431,_0xdca29f){_0x41d431=_0x41d431-0x0;var _0x5a907c=_0x69f2[_0x41d431];return _0x5a907c;};'use strict';var _=require(_0x269f('0x0'));var util=require(_0x269f('0x1'));var logger=require(_0x269f('0x2'))(_0x269f('0x3'));var moment=require(_0x269f('0x4'));var BPromise=require(_0x269f('0x5'));var rp=require(_0x269f('0x6'));var fs=require('fs');var path=require(_0x269f('0x7'));var rimraf=require(_0x269f('0x8'));var config=require(_0x269f('0x9'));var attributes=require(_0x269f('0xa'));module[_0x269f('0xb')]=function(_0x4e2621,_0x1ac997){return _0x4e2621[_0x269f('0xc')]('CmHopperFinal',attributes,{'tableName':_0x269f('0xd'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x269f('0xe')]},{'name':'uniqueid','fields':[_0x269f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ec9=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./cmHopperFinal.attributes','exports','define','cm_hopper_final'];(function(_0x26d936,_0x338ba9){var _0xf12c96=function(_0x3d0b1d){while(--_0x3d0b1d){_0x26d936['push'](_0x26d936['shift']());}};_0xf12c96(++_0x338ba9);}(_0x1ec9,0x1e3));var _0x91ec=function(_0x62f2dc,_0x5a014c){_0x62f2dc=_0x62f2dc-0x0;var _0x3a205a=_0x1ec9[_0x62f2dc];return _0x3a205a;};'use strict';var _=require(_0x91ec('0x0'));var util=require(_0x91ec('0x1'));var logger=require(_0x91ec('0x2'))(_0x91ec('0x3'));var moment=require(_0x91ec('0x4'));var BPromise=require('bluebird');var rp=require(_0x91ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91ec('0x6'));var config=require('../../config/environment');var attributes=require(_0x91ec('0x7'));module[_0x91ec('0x8')]=function(_0x14eea0,_0x506c61){return _0x14eea0[_0x91ec('0x9')]('CmHopperFinal',attributes,{'tableName':_0x91ec('0xa'),'paranoid':![],'indexes':[{'name':_0x91ec('0xb'),'fields':[_0x91ec('0xb')]},{'name':_0x91ec('0xc'),'fields':[_0x91ec('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e657635..78a3bed 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 _0x122b=['code','message','result','catch','CreateCmHopperFinal','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x49cd09,_0x4e9ca1){var _0x43b5f2=function(_0x15bacf){while(--_0x15bacf){_0x49cd09['push'](_0x49cd09['shift']());}};_0x43b5f2(++_0x4e9ca1);}(_0x122b,0x71));var _0xb122=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x122b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xb122('0x0'));var util=require(_0xb122('0x1'));var moment=require(_0xb122('0x2'));var BPromise=require(_0xb122('0x3'));var rs=require(_0xb122('0x4'));var fs=require('fs');var Redis=require(_0xb122('0x5'));var db=require(_0xb122('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb122('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb122('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb7ae77,_0x788eea,_0x36f5b2){return new BPromise(function(_0x4f0aea,_0x2e9cc5){return client['request'](_0xb7ae77,_0x36f5b2)[_0xb122('0x9')](function(_0x25609a){logger[_0xb122('0xa')](_0xb122('0xb'),_0x788eea,_0xb122('0xc'));logger[_0xb122('0xd')](_0xb122('0xe'),_0x788eea,_0xb122('0xc'),JSON[_0xb122('0xf')](_0x25609a));if(_0x25609a[_0xb122('0x10')]){if(_0x25609a[_0xb122('0x10')][_0xb122('0x11')]===0x1f4){logger['error'](_0xb122('0xb'),_0x788eea,_0x25609a[_0xb122('0x10')]['message']);return _0x2e9cc5(_0x25609a[_0xb122('0x10')][_0xb122('0x12')]);}logger[_0xb122('0x10')](_0xb122('0xb'),_0x788eea,_0x25609a[_0xb122('0x10')][_0xb122('0x12')]);return _0x4f0aea(_0x25609a['error']['message']);}else{logger[_0xb122('0xa')](_0xb122('0xb'),_0x788eea,_0xb122('0xc'));_0x4f0aea(_0x25609a[_0xb122('0x13')][_0xb122('0x12')]);}})[_0xb122('0x14')](function(_0x229cd6){logger[_0xb122('0x10')](_0xb122('0xb'),_0x788eea,_0x229cd6);_0x2e9cc5(_0x229cd6);});});}exports[_0xb122('0x15')]=function(_0x1c92eb){var _0x5c2e5d=this;return new Promise(function(_0x3b61bf,_0x10e703){return db['CmHopperFinal'][_0xb122('0x16')](_0x1c92eb[_0xb122('0x17')],{'raw':_0x1c92eb[_0xb122('0x18')]?_0x1c92eb[_0xb122('0x18')][_0xb122('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3ae1e1){logger[_0xb122('0xa')](_0xb122('0x15'),_0x1c92eb);logger[_0xb122('0xd')]('CreateCmHopperFinal',_0x1c92eb,JSON[_0xb122('0xf')](_0x3ae1e1));_0x3b61bf(_0x3ae1e1);})['catch'](function(_0x11a509){logger[_0xb122('0x10')](_0xb122('0x15'),_0x11a509['message'],_0x1c92eb);_0x10e703(_0x5c2e5d['error'](0x1f4,_0x11a509['message']));});});}; \ No newline at end of file +var _0x5ec4=['body','options','CreateCmHopperFinal','stringify','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','CmHopperFinal,\x20%s,\x20%s','message','info','result','catch','CmHopperFinal','create'];(function(_0x385101,_0x396ad1){var _0x5b836f=function(_0x56def3){while(--_0x56def3){_0x385101['push'](_0x385101['shift']());}};_0x5b836f(++_0x396ad1);}(_0x5ec4,0x156));var _0x45ec=function(_0x10dc83,_0x4e13ba){_0x10dc83=_0x10dc83-0x0;var _0x4f1918=_0x5ec4[_0x10dc83];return _0x4f1918;};'use strict';var _=require('lodash');var util=require(_0x45ec('0x0'));var moment=require(_0x45ec('0x1'));var BPromise=require(_0x45ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ec('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x45ec('0x4'))(_0x45ec('0x5'));var config=require(_0x45ec('0x6'));var jayson=require(_0x45ec('0x7'));var client=jayson[_0x45ec('0x8')][_0x45ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3232b3,_0x41ae93,_0xdca9bb){return new BPromise(function(_0x1b02ab,_0x2bd7a4){return client['request'](_0x3232b3,_0xdca9bb)[_0x45ec('0xa')](function(_0x4d60e9){logger['info']('CmHopperFinal,\x20%s,\x20%s',_0x41ae93,_0x45ec('0xb'));logger[_0x45ec('0xc')](_0x45ec('0xd'),_0x41ae93,_0x45ec('0xb'),JSON['stringify'](_0x4d60e9));if(_0x4d60e9[_0x45ec('0xe')]){if(_0x4d60e9[_0x45ec('0xe')]['code']===0x1f4){logger['error'](_0x45ec('0xf'),_0x41ae93,_0x4d60e9['error'][_0x45ec('0x10')]);return _0x2bd7a4(_0x4d60e9[_0x45ec('0xe')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x41ae93,_0x4d60e9['error']['message']);return _0x1b02ab(_0x4d60e9[_0x45ec('0xe')][_0x45ec('0x10')]);}else{logger[_0x45ec('0x11')](_0x45ec('0xf'),_0x41ae93,_0x45ec('0xb'));_0x1b02ab(_0x4d60e9[_0x45ec('0x12')][_0x45ec('0x10')]);}})[_0x45ec('0x13')](function(_0x45ee0a){logger[_0x45ec('0xe')](_0x45ec('0xf'),_0x41ae93,_0x45ee0a);_0x2bd7a4(_0x45ee0a);});});}exports['CreateCmHopperFinal']=function(_0x3bb03f){var _0x36f267=this;return new Promise(function(_0x4b4563,_0x3781ee){return db[_0x45ec('0x14')][_0x45ec('0x15')](_0x3bb03f[_0x45ec('0x16')],{'raw':_0x3bb03f[_0x45ec('0x17')]?_0x3bb03f['options']['raw']===undefined?!![]:![]:!![]})[_0x45ec('0xa')](function(_0x2b4285){logger[_0x45ec('0x11')](_0x45ec('0x18'),_0x3bb03f);logger[_0x45ec('0xc')](_0x45ec('0x18'),_0x3bb03f,JSON[_0x45ec('0x19')](_0x2b4285));_0x4b4563(_0x2b4285);})[_0x45ec('0x13')](function(_0x4e4500){logger[_0x45ec('0xe')](_0x45ec('0x18'),_0x4e4500[_0x45ec('0x10')],_0x3bb03f);_0x3781ee(_0x36f267[_0x45ec('0xe')](0x1f4,_0x4e4500['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 25a948d..30b4340 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 _0xcf6e=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','update','exports','multer','util'];(function(_0x1b509a,_0x5b8707){var _0x3daa17=function(_0x36275a){while(--_0x36275a){_0x1b509a['push'](_0x1b509a['shift']());}};_0x3daa17(++_0x5b8707);}(_0xcf6e,0x140));var _0xecf6=function(_0x2c2843,_0x9e9a8b){_0x2c2843=_0x2c2843-0x0;var _0x3c16b0=_0xcf6e[_0x2c2843];return _0x3c16b0;};'use strict';var multer=require(_0xecf6('0x0'));var util=require(_0xecf6('0x1'));var path=require(_0xecf6('0x2'));var timeout=require('connect-timeout');var express=require(_0xecf6('0x3'));var router=express[_0xecf6('0x4')]();var auth=require(_0xecf6('0x5'));var interaction=require(_0xecf6('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xecf6('0x7')]('/',auth[_0xecf6('0x8')](),controller['index']);router[_0xecf6('0x7')](_0xecf6('0x9'),auth[_0xecf6('0x8')](),controller[_0xecf6('0xa')]);router['get'](_0xecf6('0xb'),auth[_0xecf6('0x8')](),controller[_0xecf6('0xc')]);router[_0xecf6('0x7')](_0xecf6('0xd'),auth[_0xecf6('0x8')](),controller[_0xecf6('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0xecf6('0x8')](),controller[_0xecf6('0xf')]);router[_0xecf6('0x10')](_0xecf6('0x11'),auth['isAuthenticated'](),controller[_0xecf6('0x12')]);router[_0xecf6('0x10')](_0xecf6('0x13'),auth[_0xecf6('0x8')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xecf6('0x10')](_0xecf6('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0xecf6('0xb'),auth[_0xecf6('0x8')](),controller[_0xecf6('0x15')]);module[_0xecf6('0x16')]=router; \ No newline at end of file +var _0xd76a=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','exports','util','path'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xd76a,0x19e));var _0xad76=function(_0x303b82,_0x4b1958){_0x303b82=_0x303b82-0x0;var _0x110ff0=_0xd76a[_0x303b82];return _0x110ff0;};'use strict';var multer=require('multer');var util=require(_0xad76('0x0'));var path=require(_0xad76('0x1'));var timeout=require(_0xad76('0x2'));var express=require(_0xad76('0x3'));var router=express[_0xad76('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xad76('0x5'));var config=require(_0xad76('0x6'));var controller=require(_0xad76('0x7'));router[_0xad76('0x8')]('/',auth[_0xad76('0x9')](),controller[_0xad76('0xa')]);router[_0xad76('0x8')](_0xad76('0xb'),auth['isAuthenticated'](),controller[_0xad76('0xc')]);router['get'](_0xad76('0xd'),auth[_0xad76('0x9')](),controller[_0xad76('0xe')]);router['get'](_0xad76('0xf'),auth['isAuthenticated'](),controller[_0xad76('0x10')]);router[_0xad76('0x8')](_0xad76('0x11'),auth['isAuthenticated'](),controller[_0xad76('0x12')]);router['post'](_0xad76('0x13'),auth[_0xad76('0x9')](),controller[_0xad76('0x14')]);router[_0xad76('0x15')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xad76('0x15')](_0xad76('0x16'),auth[_0xad76('0x9')](),controller[_0xad76('0x17')]);router[_0xad76('0x18')](_0xad76('0xd'),auth[_0xad76('0x9')](),controller['update']);module[_0xad76('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8b7202c..e6a0c64 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 _0x9460=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0x9460,0xb9));var _0x0946=function(_0x17d308,_0x193e0a){_0x17d308=_0x17d308-0x0;var _0x31d2da=_0x9460[_0x17d308];return _0x31d2da;};'use strict';var Sequelize=require(_0x0946('0x0'));module[_0x0946('0x1')]={'state':{'type':Sequelize[_0x0946('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0946('0x3')]},'scheduledat':{'type':Sequelize[_0x0946('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0946('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0946('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0946('0x3')]},'calleridnum':{'type':Sequelize[_0x0946('0x3')]},'calleridname':{'type':Sequelize[_0x0946('0x3')]},'starttime':{'type':Sequelize[_0x0946('0x4')]},'responsetime':{'type':Sequelize[_0x0946('0x4')]},'answertime':{'type':Sequelize[_0x0946('0x4')]},'droptime':{'type':Sequelize[_0x0946('0x4')]},'endtime':{'type':Sequelize[_0x0946('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0946('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0946('0x3')]},'membername':{'type':Sequelize[_0x0946('0x3')]},'reason':{'type':Sequelize[_0x0946('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0946('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0946('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0946('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0946('0x4')]},'recallme':{'type':Sequelize[_0x0946('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0946('0x4')]},'edited':{'type':Sequelize[_0x0946('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0946('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaf90=['BOOLEAN','INTEGER','STRING','DATE'];(function(_0x4ea52c,_0x3fe304){var _0x52dbe9=function(_0x2ae71e){while(--_0x2ae71e){_0x4ea52c['push'](_0x4ea52c['shift']());}};_0x52dbe9(++_0x3fe304);}(_0xaf90,0x141));var _0x0af9=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xaf90[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x0af9('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x0af9('0x1')]},'scheduledat':{'type':Sequelize[_0x0af9('0x2')]},'countbusyretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0af9('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x0af9('0x1')]},'originatecalleridname':{'type':Sequelize[_0x0af9('0x1')]},'calleridnum':{'type':Sequelize[_0x0af9('0x1')]},'calleridname':{'type':Sequelize[_0x0af9('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0af9('0x2')]},'answertime':{'type':Sequelize[_0x0af9('0x2')]},'droptime':{'type':Sequelize[_0x0af9('0x2')]},'endtime':{'type':Sequelize[_0x0af9('0x2')]},'ringtime':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0af9('0x1')]},'campaign':{'type':Sequelize[_0x0af9('0x1')]},'campaigntype':{'type':Sequelize[_0x0af9('0x1')]},'membername':{'type':Sequelize[_0x0af9('0x1')]},'reason':{'type':Sequelize[_0x0af9('0x1')]},'amd':{'type':Sequelize[_0x0af9('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0af9('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0af9('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0af9('0x2')]},'recallme':{'type':Sequelize[_0x0af9('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0af9('0x2')]},'edited':{'type':Sequelize[_0x0af9('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0af9('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 47d7c88..27db435 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 _0x4077=['pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where'];(function(_0x38b5a4,_0x164c56){var _0x1c8147=function(_0x18b748){while(--_0x18b748){_0x38b5a4['push'](_0x38b5a4['shift']());}};_0x1c8147(++_0x164c56);}(_0x4077,0xea));var _0x7407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4077[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x7407('0x0'));var emlformat=require(_0x7407('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7407('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7407('0x3'));var moment=require('moment');var BPromise=require(_0x7407('0x4'));var Mustache=require(_0x7407('0x5'));var util=require('util');var path=require(_0x7407('0x6'));var sox=require(_0x7407('0x7'));var csv=require(_0x7407('0x8'));var ejs=require(_0x7407('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7407('0xa'));var crypto=require(_0x7407('0xb'));var jsforce=require(_0x7407('0xc'));var deskjs=require(_0x7407('0xd'));var toCsv=require(_0x7407('0x8'));var querystring=require(_0x7407('0xe'));var Papa=require(_0x7407('0xf'));var Redis=require(_0x7407('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7407('0x11'));var as=require(_0x7407('0x12'));var hardwareService=require(_0x7407('0x13'));var logger=require(_0x7407('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7407('0x15'));var licenseUtil=require(_0x7407('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310cbc,_0x14683d){_0x14683d=_0x14683d||0xcc;return function(_0x381128){if(_0x381128){return _0x310cbc[_0x7407('0x17')](_0x14683d);}return _0x310cbc[_0x7407('0x18')](_0x14683d)['end']();};}function respondWithResult(_0x477035,_0x127589){_0x127589=_0x127589||0xc8;return function(_0x4bd49c){if(_0x4bd49c){return _0x477035['status'](_0x127589)[_0x7407('0x19')](_0x4bd49c);}};}function respondWithFilteredResult(_0x6c91bd,_0x193239){return function(_0x27cde6){if(_0x27cde6){var _0x5575e1=_0x27cde6[_0x7407('0x1a')],_0x125225=_0x193239['offset'],_0x53aad6=_0x193239[_0x7407('0x1b')]+_0x193239[_0x7407('0x1c')],_0x440413;if(_0x53aad6>=_0x5575e1){_0x53aad6=_0x5575e1;_0x440413=0xc8;}else{_0x440413=0xce;}_0x6c91bd[_0x7407('0x18')](_0x440413);return _0x6c91bd[_0x7407('0x1d')](_0x7407('0x1e'),_0x125225+'-'+_0x53aad6+'/'+_0x5575e1)[_0x7407('0x19')](_0x27cde6);}return null;};}function patchUpdates(_0x283975){return function(_0x1f71ba){try{jsonpatch[_0x7407('0x1f')](_0x1f71ba,_0x283975,!![]);}catch(_0x440cfc){return BPromise['reject'](_0x440cfc);}return _0x1f71ba['save']();};}function saveUpdates(_0x14e4a4,_0x291ee2){return function(_0x508fa){if(_0x508fa){return _0x508fa[_0x7407('0x20')](_0x14e4a4)[_0x7407('0x21')](function(_0x5ec472){return _0x5ec472;});}return null;};}function removeEntity(_0x454148,_0x498d6a){return function(_0x166f3a){if(_0x166f3a){return _0x166f3a[_0x7407('0x22')]()[_0x7407('0x21')](function(){_0x454148[_0x7407('0x18')](0xcc)[_0x7407('0x23')]();});}};}function handleEntityNotFound(_0x8d847d,_0x2188ba){return function(_0x5f1542){if(!_0x5f1542){_0x8d847d[_0x7407('0x17')](0x194);}return _0x5f1542;};}function handleError(_0x1b3cfe,_0x3b7a36){_0x3b7a36=_0x3b7a36||0x1f4;return function(_0x5594c6){logger[_0x7407('0x24')](_0x5594c6[_0x7407('0x25')]);if(_0x5594c6[_0x7407('0x26')]){delete _0x5594c6['name'];}_0x1b3cfe[_0x7407('0x18')](_0x3b7a36)[_0x7407('0x27')](_0x5594c6);};}exports[_0x7407('0x28')]=function(_0x19f3d4,_0x4a7b54){var _0x5b9690={},_0xea1bb9={},_0x5b19e0={'count':0x0,'rows':[]};var _0xfc921e=_[_0x7407('0x29')](db[_0x7407('0x2a')][_0x7407('0x2b')],function(_0x4da88f){return{'name':_0x4da88f[_0x7407('0x2c')],'type':_0x4da88f[_0x7407('0x2d')][_0x7407('0x2e')]};});_0xea1bb9['model']=_[_0x7407('0x29')](_0xfc921e,_0x7407('0x26'));_0xea1bb9[_0x7407('0x2f')]=_[_0x7407('0x30')](_0x19f3d4['query']);_0xea1bb9[_0x7407('0x31')]=_['intersection'](_0xea1bb9[_0x7407('0x32')],_0xea1bb9[_0x7407('0x2f')]);_0x5b9690[_0x7407('0x33')]=_[_0x7407('0x34')](_0xea1bb9[_0x7407('0x32')],qs[_0x7407('0x35')](_0x19f3d4['query']['fields']));_0x5b9690['attributes']=_0x5b9690[_0x7407('0x33')][_0x7407('0x36')]?_0x5b9690[_0x7407('0x33')]:_0xea1bb9[_0x7407('0x32')];if(!_0x19f3d4['query'][_0x7407('0x37')]('nolimit')){_0x5b9690[_0x7407('0x1c')]=qs[_0x7407('0x1c')](_0x19f3d4[_0x7407('0x2f')][_0x7407('0x1c')]);_0x5b9690[_0x7407('0x1b')]=qs[_0x7407('0x1b')](_0x19f3d4[_0x7407('0x2f')][_0x7407('0x1b')]);}_0x5b9690['order']=qs[_0x7407('0x38')](_0x19f3d4[_0x7407('0x2f')][_0x7407('0x38')]);_0x5b9690[_0x7407('0x39')]=qs[_0x7407('0x31')](_[_0x7407('0x3a')](_0x19f3d4[_0x7407('0x2f')],_0xea1bb9['filters']),_0xfc921e);if(_0x19f3d4[_0x7407('0x2f')]['filter']){_0x5b9690[_0x7407('0x39')]=_[_0x7407('0x3b')](_0x5b9690['where'],{'$or':_[_0x7407('0x29')](_0xfc921e,function(_0x168e4b){if(_0x168e4b[_0x7407('0x2d')]!==_0x7407('0x3c')){var _0x35f51a={};_0x35f51a[_0x168e4b[_0x7407('0x26')]]={'$like':'%'+_0x19f3d4[_0x7407('0x2f')][_0x7407('0x3d')]+'%'};return _0x35f51a;}})});}_0x5b9690=_['merge']({},_0x5b9690,_0x19f3d4[_0x7407('0x3e')]);var _0x4f69e4={'where':_0x5b9690['where']};return db[_0x7407('0x2a')][_0x7407('0x1a')](_0x4f69e4)[_0x7407('0x21')](function(_0x2ffa3f){_0x5b19e0[_0x7407('0x1a')]=_0x2ffa3f;if(_0x19f3d4[_0x7407('0x2f')][_0x7407('0x3f')]){_0x5b9690[_0x7407('0x40')]=[{'all':!![]}];}return db[_0x7407('0x2a')][_0x7407('0x41')](_0x5b9690);})[_0x7407('0x21')](function(_0x1249aa){_0x5b19e0['rows']=_0x1249aa;return _0x5b19e0;})['then'](respondWithFilteredResult(_0x4a7b54,_0x5b9690))[_0x7407('0x42')](handleError(_0x4a7b54,null));};exports[_0x7407('0x43')]=function(_0x3c193a,_0x357c49){var _0x34b66c={'raw':!![],'where':{'id':_0x3c193a['params']['id']}},_0x412576={};_0x412576[_0x7407('0x32')]=_[_0x7407('0x30')](db[_0x7407('0x2a')][_0x7407('0x2b')]);_0x412576[_0x7407('0x2f')]=_[_0x7407('0x30')](_0x3c193a['query']);_0x412576['filtears']=_[_0x7407('0x34')](_0x412576[_0x7407('0x32')],_0x412576[_0x7407('0x2f')]);_0x34b66c['attributes']=_[_0x7407('0x34')](_0x412576[_0x7407('0x32')],qs[_0x7407('0x35')](_0x3c193a['query']['fields']));_0x34b66c[_0x7407('0x33')]=_0x34b66c[_0x7407('0x33')][_0x7407('0x36')]?_0x34b66c['attributes']:_0x412576[_0x7407('0x32')];if(_0x3c193a['query'][_0x7407('0x3f')]){_0x34b66c[_0x7407('0x40')]=[{'all':!![]}];}_0x34b66c=_[_0x7407('0x3b')]({},_0x34b66c,_0x3c193a[_0x7407('0x3e')]);return db[_0x7407('0x2a')][_0x7407('0x44')](_0x34b66c)[_0x7407('0x21')](handleEntityNotFound(_0x357c49,null))[_0x7407('0x21')](respondWithResult(_0x357c49,null))[_0x7407('0x42')](handleError(_0x357c49,null));};exports['create']=function(_0x52cdae,_0x3c592c){return db[_0x7407('0x2a')][_0x7407('0x45')](_0x52cdae[_0x7407('0x46')],{})[_0x7407('0x21')](respondWithResult(_0x3c592c,0xc9))['catch'](handleError(_0x3c592c,null));};exports['describe']=function(_0x59c316,_0x3a07d3){return db['CmHopperHistory'][_0x7407('0x47')]()[_0x7407('0x21')](respondWithResult(_0x3a07d3,null))[_0x7407('0x42')](handleError(_0x3a07d3,null));};exports[_0x7407('0x20')]=function(_0x2691a0,_0xedb1b8){if(_0x2691a0[_0x7407('0x46')]['uniqueid']){delete _0x2691a0['body'][_0x7407('0x48')];}return db[_0x7407('0x2a')][_0x7407('0x44')]({'where':{'uniqueid':_0x2691a0['params']['id']}})[_0x7407('0x21')](handleEntityNotFound(_0xedb1b8,null))[_0x7407('0x21')](saveUpdates(_0x2691a0[_0x7407('0x46')],null))[_0x7407('0x21')](respondWithResult(_0xedb1b8,null))[_0x7407('0x42')](handleError(_0xedb1b8,null));}; \ No newline at end of file +var _0x7c70=['body','update','uniqueid','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','filter','merge','CmHopperHistory','count','includeAll','include','findAll','rows','catch','show','fields','options','find','create'];(function(_0x15e1e3,_0x592b89){var _0x4edd98=function(_0x4ea854){while(--_0x4ea854){_0x15e1e3['push'](_0x15e1e3['shift']());}};_0x4edd98(++_0x592b89);}(_0x7c70,0xe4));var _0x07c7=function(_0x1dc5a7,_0x448a9f){_0x1dc5a7=_0x1dc5a7-0x0;var _0x4b3f3e=_0x7c70[_0x1dc5a7];return _0x4b3f3e;};'use strict';var pdf=require(_0x07c7('0x0'));var emlformat=require(_0x07c7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x07c7('0x2'));var rp=require(_0x07c7('0x3'));var moment=require('moment');var BPromise=require(_0x07c7('0x4'));var Mustache=require(_0x07c7('0x5'));var util=require(_0x07c7('0x6'));var path=require(_0x07c7('0x7'));var sox=require(_0x07c7('0x8'));var csv=require(_0x07c7('0x9'));var ejs=require(_0x07c7('0xa'));var fs=require('fs');var _=require(_0x07c7('0xb'));var squel=require('squel');var crypto=require(_0x07c7('0xc'));var jsforce=require(_0x07c7('0xd'));var deskjs=require(_0x07c7('0xe'));var toCsv=require(_0x07c7('0x9'));var querystring=require(_0x07c7('0xf'));var Papa=require(_0x07c7('0x10'));var Redis=require(_0x07c7('0x11'));var authService=require(_0x07c7('0x12'));var qs=require(_0x07c7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07c7('0x14'));var logger=require(_0x07c7('0x15'))(_0x07c7('0x16'));var utils=require(_0x07c7('0x17'));var config=require(_0x07c7('0x18'));var licenseUtil=require(_0x07c7('0x19'));var db=require(_0x07c7('0x1a'))['db'];function respondWithStatusCode(_0x459ec7,_0x5cdefc){_0x5cdefc=_0x5cdefc||0xcc;return function(_0x3b4d0e){if(_0x3b4d0e){return _0x459ec7[_0x07c7('0x1b')](_0x5cdefc);}return _0x459ec7['status'](_0x5cdefc)[_0x07c7('0x1c')]();};}function respondWithResult(_0x402dc1,_0x52f83a){_0x52f83a=_0x52f83a||0xc8;return function(_0x32e360){if(_0x32e360){return _0x402dc1[_0x07c7('0x1d')](_0x52f83a)[_0x07c7('0x1e')](_0x32e360);}};}function respondWithFilteredResult(_0x2522d3,_0x3510ec){return function(_0x353232){if(_0x353232){var _0x10e799=_0x353232['count'],_0x58acff=_0x3510ec[_0x07c7('0x1f')],_0x97f686=_0x3510ec[_0x07c7('0x1f')]+_0x3510ec[_0x07c7('0x20')],_0x18b596;if(_0x97f686>=_0x10e799){_0x97f686=_0x10e799;_0x18b596=0xc8;}else{_0x18b596=0xce;}_0x2522d3['status'](_0x18b596);return _0x2522d3[_0x07c7('0x21')](_0x07c7('0x22'),_0x58acff+'-'+_0x97f686+'/'+_0x10e799)['json'](_0x353232);}return null;};}function patchUpdates(_0x2ea41a){return function(_0x1e3602){try{jsonpatch[_0x07c7('0x23')](_0x1e3602,_0x2ea41a,!![]);}catch(_0x4bf77b){return BPromise['reject'](_0x4bf77b);}return _0x1e3602[_0x07c7('0x24')]();};}function saveUpdates(_0x462d7a,_0x28d877){return function(_0x57bd07){if(_0x57bd07){return _0x57bd07['update'](_0x462d7a)[_0x07c7('0x25')](function(_0x4f4c61){return _0x4f4c61;});}return null;};}function removeEntity(_0x4719eb,_0x1ba2f0){return function(_0x3a9d14){if(_0x3a9d14){return _0x3a9d14['destroy']()[_0x07c7('0x25')](function(){_0x4719eb[_0x07c7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x539a78,_0xd4e423){return function(_0x42ffe2){if(!_0x42ffe2){_0x539a78[_0x07c7('0x1b')](0x194);}return _0x42ffe2;};}function handleError(_0x3ca76f,_0x1337d4){_0x1337d4=_0x1337d4||0x1f4;return function(_0x483a50){logger[_0x07c7('0x26')](_0x483a50[_0x07c7('0x27')]);if(_0x483a50[_0x07c7('0x28')]){delete _0x483a50[_0x07c7('0x28')];}_0x3ca76f['status'](_0x1337d4)[_0x07c7('0x29')](_0x483a50);};}exports[_0x07c7('0x2a')]=function(_0x316731,_0x2f0a99){var _0x73075d={},_0x5a1c5f={},_0x2b6d14={'count':0x0,'rows':[]};var _0x7b6a4b=_['map'](db['CmHopperHistory'][_0x07c7('0x2b')],function(_0x51ec40){return{'name':_0x51ec40[_0x07c7('0x2c')],'type':_0x51ec40[_0x07c7('0x2d')]['key']};});_0x5a1c5f['model']=_[_0x07c7('0x2e')](_0x7b6a4b,'name');_0x5a1c5f[_0x07c7('0x2f')]=_[_0x07c7('0x30')](_0x316731['query']);_0x5a1c5f[_0x07c7('0x31')]=_[_0x07c7('0x32')](_0x5a1c5f[_0x07c7('0x33')],_0x5a1c5f['query']);_0x73075d[_0x07c7('0x34')]=_[_0x07c7('0x32')](_0x5a1c5f[_0x07c7('0x33')],qs['fields'](_0x316731['query']['fields']));_0x73075d['attributes']=_0x73075d[_0x07c7('0x34')][_0x07c7('0x35')]?_0x73075d[_0x07c7('0x34')]:_0x5a1c5f[_0x07c7('0x33')];if(!_0x316731['query']['hasOwnProperty'](_0x07c7('0x36'))){_0x73075d['limit']=qs[_0x07c7('0x20')](_0x316731[_0x07c7('0x2f')][_0x07c7('0x20')]);_0x73075d[_0x07c7('0x1f')]=qs[_0x07c7('0x1f')](_0x316731[_0x07c7('0x2f')][_0x07c7('0x1f')]);}_0x73075d['order']=qs[_0x07c7('0x37')](_0x316731[_0x07c7('0x2f')][_0x07c7('0x37')]);_0x73075d[_0x07c7('0x38')]=qs[_0x07c7('0x31')](_[_0x07c7('0x39')](_0x316731[_0x07c7('0x2f')],_0x5a1c5f[_0x07c7('0x31')]),_0x7b6a4b);if(_0x316731[_0x07c7('0x2f')][_0x07c7('0x3a')]){_0x73075d[_0x07c7('0x38')]=_[_0x07c7('0x3b')](_0x73075d['where'],{'$or':_[_0x07c7('0x2e')](_0x7b6a4b,function(_0x60cc81){if(_0x60cc81['type']!=='VIRTUAL'){var _0x5ef182={};_0x5ef182[_0x60cc81['name']]={'$like':'%'+_0x316731[_0x07c7('0x2f')][_0x07c7('0x3a')]+'%'};return _0x5ef182;}})});}_0x73075d=_[_0x07c7('0x3b')]({},_0x73075d,_0x316731['options']);var _0x15f2f9={'where':_0x73075d[_0x07c7('0x38')]};return db[_0x07c7('0x3c')]['count'](_0x15f2f9)[_0x07c7('0x25')](function(_0x5ce562){_0x2b6d14[_0x07c7('0x3d')]=_0x5ce562;if(_0x316731[_0x07c7('0x2f')][_0x07c7('0x3e')]){_0x73075d[_0x07c7('0x3f')]=[{'all':!![]}];}return db[_0x07c7('0x3c')][_0x07c7('0x40')](_0x73075d);})[_0x07c7('0x25')](function(_0x1569d4){_0x2b6d14[_0x07c7('0x41')]=_0x1569d4;return _0x2b6d14;})[_0x07c7('0x25')](respondWithFilteredResult(_0x2f0a99,_0x73075d))[_0x07c7('0x42')](handleError(_0x2f0a99,null));};exports[_0x07c7('0x43')]=function(_0x4f7a4b,_0x3e8fc7){var _0x434918={'raw':!![],'where':{'id':_0x4f7a4b['params']['id']}},_0x4ee818={};_0x4ee818[_0x07c7('0x33')]=_[_0x07c7('0x30')](db[_0x07c7('0x3c')][_0x07c7('0x2b')]);_0x4ee818[_0x07c7('0x2f')]=_[_0x07c7('0x30')](_0x4f7a4b[_0x07c7('0x2f')]);_0x4ee818['filtears']=_[_0x07c7('0x32')](_0x4ee818[_0x07c7('0x33')],_0x4ee818[_0x07c7('0x2f')]);_0x434918['attributes']=_[_0x07c7('0x32')](_0x4ee818[_0x07c7('0x33')],qs[_0x07c7('0x44')](_0x4f7a4b[_0x07c7('0x2f')][_0x07c7('0x44')]));_0x434918[_0x07c7('0x34')]=_0x434918[_0x07c7('0x34')][_0x07c7('0x35')]?_0x434918[_0x07c7('0x34')]:_0x4ee818[_0x07c7('0x33')];if(_0x4f7a4b[_0x07c7('0x2f')][_0x07c7('0x3e')]){_0x434918[_0x07c7('0x3f')]=[{'all':!![]}];}_0x434918=_[_0x07c7('0x3b')]({},_0x434918,_0x4f7a4b[_0x07c7('0x45')]);return db[_0x07c7('0x3c')][_0x07c7('0x46')](_0x434918)[_0x07c7('0x25')](handleEntityNotFound(_0x3e8fc7,null))['then'](respondWithResult(_0x3e8fc7,null))[_0x07c7('0x42')](handleError(_0x3e8fc7,null));};exports[_0x07c7('0x47')]=function(_0x41d646,_0x12776f){return db[_0x07c7('0x3c')][_0x07c7('0x47')](_0x41d646[_0x07c7('0x48')],{})[_0x07c7('0x25')](respondWithResult(_0x12776f,0xc9))['catch'](handleError(_0x12776f,null));};exports['describe']=function(_0x1779f0,_0x70cfbc){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x70cfbc,null))['catch'](handleError(_0x70cfbc,null));};exports[_0x07c7('0x49')]=function(_0x1d6989,_0x5cb125){if(_0x1d6989[_0x07c7('0x48')][_0x07c7('0x4a')]){delete _0x1d6989[_0x07c7('0x48')][_0x07c7('0x4a')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x1d6989['params']['id']}})[_0x07c7('0x25')](handleEntityNotFound(_0x5cb125,null))[_0x07c7('0x25')](saveUpdates(_0x1d6989[_0x07c7('0x48')],null))[_0x07c7('0x25')](respondWithResult(_0x5cb125,null))[_0x07c7('0x42')](handleError(_0x5cb125,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 246b558..c5b4421 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 _0x143f=['path','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x143f,0xa2));var _0xf143=function(_0x46ee28,_0x11302d){_0x46ee28=_0x46ee28-0x0;var _0x19880d=_0x143f[_0x46ee28];return _0x19880d;};'use strict';var _=require(_0xf143('0x0'));var util=require(_0xf143('0x1'));var logger=require(_0xf143('0x2'))(_0xf143('0x3'));var moment=require(_0xf143('0x4'));var BPromise=require(_0xf143('0x5'));var rp=require(_0xf143('0x6'));var fs=require('fs');var path=require(_0xf143('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xf143('0x8')]=function(_0x21d3de,_0x45a5c4){return _0x21d3de['define'](_0xf143('0x9'),attributes,{'tableName':_0xf143('0xa'),'paranoid':![],'indexes':[{'name':_0xf143('0xb'),'fields':[_0xf143('0xb')]},{'name':_0xf143('0xc'),'fields':[_0xf143('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1732=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x1732,0x131));var _0x2173=function(_0x53acc9,_0x468a45){_0x53acc9=_0x53acc9-0x0;var _0x10cd02=_0x1732[_0x53acc9];return _0x10cd02;};'use strict';var _=require(_0x2173('0x0'));var util=require(_0x2173('0x1'));var logger=require(_0x2173('0x2'))('api');var moment=require(_0x2173('0x3'));var BPromise=require(_0x2173('0x4'));var rp=require(_0x2173('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2173('0x6'));var config=require(_0x2173('0x7'));var attributes=require(_0x2173('0x8'));module[_0x2173('0x9')]=function(_0xa250cd,_0x394952){return _0xa250cd[_0x2173('0xa')]('CmHopperHistory',attributes,{'tableName':_0x2173('0xb'),'paranoid':![],'indexes':[{'name':_0x2173('0xc'),'fields':[_0x2173('0xc')]},{'name':'uniqueid','fields':[_0x2173('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 42d6d1b..ba389c7 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 _0x672b=['stringify','error','code','message','catch','CreateCmHopperHistory','create','body','options','AvgHandleTime','CmHopperHistory','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','raw','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../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'];(function(_0x41cb4a,_0x47c9bc){var _0x5cceee=function(_0xf36914){while(--_0xf36914){_0x41cb4a['push'](_0x41cb4a['shift']());}};_0x5cceee(++_0x47c9bc);}(_0x672b,0x1d7));var _0xb672=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x672b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb672('0x0'));var util=require(_0xb672('0x1'));var moment=require(_0xb672('0x2'));var BPromise=require(_0xb672('0x3'));var rs=require(_0xb672('0x4'));var fs=require('fs');var Redis=require(_0xb672('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb672('0x6'));var logger=require(_0xb672('0x7'))(_0xb672('0x8'));var config=require(_0xb672('0x9'));var jayson=require(_0xb672('0xa'));var client=jayson['client'][_0xb672('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f2f04,_0x3ed3ed,_0x8377c9){return new BPromise(function(_0x24c21d,_0x978127){return client[_0xb672('0xc')](_0x3f2f04,_0x8377c9)[_0xb672('0xd')](function(_0x67c76e){logger[_0xb672('0xe')](_0xb672('0xf'),_0x3ed3ed,_0xb672('0x10'));logger[_0xb672('0x11')](_0xb672('0x12'),_0x3ed3ed,_0xb672('0x10'),JSON[_0xb672('0x13')](_0x67c76e));if(_0x67c76e[_0xb672('0x14')]){if(_0x67c76e[_0xb672('0x14')][_0xb672('0x15')]===0x1f4){logger[_0xb672('0x14')](_0xb672('0xf'),_0x3ed3ed,_0x67c76e[_0xb672('0x14')][_0xb672('0x16')]);return _0x978127(_0x67c76e['error']['message']);}logger[_0xb672('0x14')](_0xb672('0xf'),_0x3ed3ed,_0x67c76e[_0xb672('0x14')]['message']);return _0x24c21d(_0x67c76e[_0xb672('0x14')][_0xb672('0x16')]);}else{logger[_0xb672('0xe')](_0xb672('0xf'),_0x3ed3ed,_0xb672('0x10'));_0x24c21d(_0x67c76e['result']['message']);}})[_0xb672('0x17')](function(_0x4f74ab){logger[_0xb672('0x14')](_0xb672('0xf'),_0x3ed3ed,_0x4f74ab);_0x978127(_0x4f74ab);});});}exports[_0xb672('0x18')]=function(_0x540f00){var _0x46d0ac=this;return new Promise(function(_0x30b71c,_0x132512){return db['CmHopperHistory'][_0xb672('0x19')](_0x540f00[_0xb672('0x1a')],{'raw':_0x540f00[_0xb672('0x1b')]?_0x540f00['options']['raw']===undefined?!![]:![]:!![]})[_0xb672('0xd')](function(_0x39aa46){logger[_0xb672('0xe')]('CreateCmHopperHistory',_0x540f00);logger['debug'](_0xb672('0x18'),_0x540f00,JSON[_0xb672('0x13')](_0x39aa46));_0x30b71c(_0x39aa46);})['catch'](function(_0x74364e){logger['error'](_0xb672('0x18'),_0x74364e[_0xb672('0x16')],_0x540f00);_0x132512(_0x46d0ac['error'](0x1f4,_0x74364e[_0xb672('0x16')]));});});};exports[_0xb672('0x1c')]=function(_0x2f3792){var _0x2c221c=this;return new Promise(function(_0x464481,_0x27156f){return db[_0xb672('0x1d')]['findAll']({'raw':_0x2f3792[_0xb672('0x1b')]?_0x2f3792['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f3792[_0xb672('0x1b')]?_0x2f3792[_0xb672('0x1b')]['where']||null:null,'attributes':[[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db['sequelize'][_0xb672('0x20')]('id')),_0xb672('0x21')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db['sequelize']['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x23')))),'predictiveIntervalAnsweredCalls'],[db[_0xb672('0x1e')]['fn']('COUNT',db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xb672('0x1e')]['fn'](_0xb672('0x24'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x25')))),_0xb672('0x26')],[db['sequelize']['fn'](_0xb672('0x24'),db[_0xb672('0x1e')]['fn']('IF',db['sequelize'][_0xb672('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xb672('0x27')]]})[_0xb672('0xd')](function(_0x2e7e0a){logger[_0xb672('0xe')]('AvgHandleTime',_0x2f3792);logger[_0xb672('0x11')]('AvgHandleTime',_0x2f3792,JSON[_0xb672('0x13')](_0x2e7e0a));_0x464481(_0x2e7e0a);})[_0xb672('0x17')](function(_0x1c8338){logger['error'](_0xb672('0x1c'),_0x1c8338[_0xb672('0x16')],_0x2f3792);_0x27156f(_0x2c221c[_0xb672('0x14')](0x1f4,_0x1c8338[_0xb672('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x48b39a){var _0x4798d6=this;return new Promise(function(_0x51ed06,_0x4a0a57){return db['CmHopperHistory']['findAll']({'raw':_0x48b39a[_0xb672('0x1b')]?_0x48b39a['options'][_0xb672('0x28')]===undefined?!![]:![]:!![],'where':_0x48b39a[_0xb672('0x1b')]?_0x48b39a[_0xb672('0x1b')][_0xb672('0x29')]||null:null,'attributes':[[_0xb672('0x2a'),'name'],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x2b')))),_0xb672('0x2c')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0xb672('0x2d')],[db[_0xb672('0x1e')]['fn']('COUNT',db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x23')))),_0xb672('0x2e')],[db[_0xb672('0x1e')]['fn']('COUNT',db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x2f')))),_0xb672('0x30')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')]['literal'](_0xb672('0x31')))),_0xb672('0x32')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb672('0x33')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db['sequelize'][_0xb672('0x22')](_0xb672('0x34')))),_0xb672('0x35')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db['sequelize'][_0xb672('0x22')](_0xb672('0x36')))),'outboundUnknownCallsDay'],[db[_0xb672('0x1e')]['fn']('COUNT',db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x37')))),_0xb672('0x38')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x39')))),'outboundOriginateFailureCallsDay'],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')]['literal'](_0xb672('0x3a')))),_0xb672('0x3b')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0xb672('0x3c')],[db['sequelize']['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xb672('0x3d')))),_0xb672('0x3b')],[db['sequelize']['fn'](_0xb672('0x1f'),db['sequelize']['fn']('IF',db[_0xb672('0x1e')][_0xb672('0x22')](_0xb672('0x3e')))),_0xb672('0x3f')]],'group':[_0xb672('0x2a')]})[_0xb672('0xd')](function(_0x3ad11a){logger[_0xb672('0xe')](_0xb672('0x40'),_0x48b39a);logger['debug'](_0xb672('0x40'),_0x48b39a,JSON[_0xb672('0x13')](_0x3ad11a));_0x51ed06(_0x3ad11a);})[_0xb672('0x17')](function(_0x3d1752){logger[_0xb672('0x14')](_0xb672('0x40'),_0x3d1752[_0xb672('0x16')],_0x48b39a);_0x4a0a57(_0x4798d6['error'](0x1f4,_0x3d1752[_0xb672('0x16')]));});});};exports[_0xb672('0x41')]=function(_0x4d1aa7){var _0x3d7cbc=this;return new Promise(function(_0x3a3e4e,_0x1253cf){return db[_0xb672('0x1d')][_0xb672('0x42')]({'raw':_0x4d1aa7[_0xb672('0x1b')]?_0x4d1aa7[_0xb672('0x1b')][_0xb672('0x28')]===undefined?!![]:![]:!![],'where':_0x4d1aa7[_0xb672('0x1b')]?_0x4d1aa7[_0xb672('0x1b')][_0xb672('0x29')]||null:null,'attributes':[['campaign',_0xb672('0x43')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db['sequelize'][_0xb672('0x20')]('id')),_0xb672('0x44')],[db[_0xb672('0x1e')]['fn'](_0xb672('0x1f'),db[_0xb672('0x1e')]['fn']('IF',db[_0xb672('0x1e')]['literal'](_0xb672('0x23')))),_0xb672('0x45')]],'group':[_0xb672('0x2a')]})[_0xb672('0xd')](function(_0x2201bc){logger[_0xb672('0xe')](_0xb672('0x41'),_0x4d1aa7);logger[_0xb672('0x11')]('GetCampaignHopperHistory',_0x4d1aa7,JSON[_0xb672('0x13')](_0x2201bc));_0x3a3e4e(_0x2201bc);})[_0xb672('0x17')](function(_0x12aaa8){logger[_0xb672('0x14')](_0xb672('0x41'),_0x12aaa8['message'],_0x4d1aa7);_0x1253cf(_0x3d7cbc[_0xb672('0x14')](0x1f4,_0x12aaa8[_0xb672('0x16')]));});});}; \ No newline at end of file +var _0x3956=['sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','info','AvgHandleTime','findAll','where'];(function(_0x2b71e0,_0x313267){var _0x36ca99=function(_0x3bf6ee){while(--_0x3bf6ee){_0x2b71e0['push'](_0x2b71e0['shift']());}};_0x36ca99(++_0x313267);}(_0x3956,0x18e));var _0x6395=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3956[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6395('0x0'));var util=require(_0x6395('0x1'));var moment=require(_0x6395('0x2'));var BPromise=require(_0x6395('0x3'));var rs=require(_0x6395('0x4'));var fs=require('fs');var Redis=require(_0x6395('0x5'));var db=require(_0x6395('0x6'))['db'];var utils=require(_0x6395('0x7'));var logger=require(_0x6395('0x8'))(_0x6395('0x9'));var config=require('../../config/environment');var jayson=require(_0x6395('0xa'));var client=jayson[_0x6395('0xb')][_0x6395('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27bb7c,_0x5f32c5,_0x3d5afb){return new BPromise(function(_0x15517a,_0xd5802d){return client[_0x6395('0xd')](_0x27bb7c,_0x3d5afb)[_0x6395('0xe')](function(_0x529183){logger['info'](_0x6395('0xf'),_0x5f32c5,_0x6395('0x10'));logger[_0x6395('0x11')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5f32c5,_0x6395('0x10'),JSON[_0x6395('0x12')](_0x529183));if(_0x529183[_0x6395('0x13')]){if(_0x529183[_0x6395('0x13')][_0x6395('0x14')]===0x1f4){logger['error'](_0x6395('0xf'),_0x5f32c5,_0x529183[_0x6395('0x13')][_0x6395('0x15')]);return _0xd5802d(_0x529183[_0x6395('0x13')]['message']);}logger[_0x6395('0x13')](_0x6395('0xf'),_0x5f32c5,_0x529183[_0x6395('0x13')]['message']);return _0x15517a(_0x529183[_0x6395('0x13')][_0x6395('0x15')]);}else{logger['info'](_0x6395('0xf'),_0x5f32c5,_0x6395('0x10'));_0x15517a(_0x529183[_0x6395('0x16')][_0x6395('0x15')]);}})[_0x6395('0x17')](function(_0x26df3a){logger[_0x6395('0x13')](_0x6395('0xf'),_0x5f32c5,_0x26df3a);_0xd5802d(_0x26df3a);});});}exports[_0x6395('0x18')]=function(_0x17cd5b){var _0x510e38=this;return new Promise(function(_0x58a47c,_0x42599b){return db[_0x6395('0x19')][_0x6395('0x1a')](_0x17cd5b[_0x6395('0x1b')],{'raw':_0x17cd5b['options']?_0x17cd5b[_0x6395('0x1c')][_0x6395('0x1d')]===undefined?!![]:![]:!![]})[_0x6395('0xe')](function(_0x451e18){logger[_0x6395('0x1e')](_0x6395('0x18'),_0x17cd5b);logger[_0x6395('0x11')](_0x6395('0x18'),_0x17cd5b,JSON[_0x6395('0x12')](_0x451e18));_0x58a47c(_0x451e18);})['catch'](function(_0x191954){logger[_0x6395('0x13')]('CreateCmHopperHistory',_0x191954[_0x6395('0x15')],_0x17cd5b);_0x42599b(_0x510e38[_0x6395('0x13')](0x1f4,_0x191954[_0x6395('0x15')]));});});};exports[_0x6395('0x1f')]=function(_0x3fe851){var _0x277172=this;return new Promise(function(_0x18b313,_0x1d97e8){return db['CmHopperHistory'][_0x6395('0x20')]({'raw':_0x3fe851['options']?_0x3fe851[_0x6395('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3fe851['options']?_0x3fe851['options'][_0x6395('0x21')]||null:null,'attributes':[[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')][_0x6395('0x24')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x26')))),_0x6395('0x27')],[db['sequelize']['fn'](_0x6395('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0x6395('0x25')](_0x6395('0x28')))),_0x6395('0x29')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')]['literal'](_0x6395('0x2a')))),_0x6395('0x2b')],[db[_0x6395('0x22')]['fn'](_0x6395('0x2c'),db[_0x6395('0x22')]['fn']('IF',db['sequelize'][_0x6395('0x25')](_0x6395('0x2d')))),'predictiveIntervalAvgHoldtime'],[db[_0x6395('0x22')]['fn'](_0x6395('0x2c'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x2e')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x450002){logger[_0x6395('0x1e')](_0x6395('0x1f'),_0x3fe851);logger[_0x6395('0x11')](_0x6395('0x1f'),_0x3fe851,JSON[_0x6395('0x12')](_0x450002));_0x18b313(_0x450002);})[_0x6395('0x17')](function(_0x1f5872){logger[_0x6395('0x13')](_0x6395('0x1f'),_0x1f5872['message'],_0x3fe851);_0x1d97e8(_0x277172[_0x6395('0x13')](0x1f4,_0x1f5872[_0x6395('0x15')]));});});};exports[_0x6395('0x2f')]=function(_0x3ee874){var _0xb6e54c=this;return new Promise(function(_0x523ace,_0x2a9a6b){return db[_0x6395('0x19')][_0x6395('0x20')]({'raw':_0x3ee874['options']?_0x3ee874['options'][_0x6395('0x1d')]===undefined?!![]:![]:!![],'where':_0x3ee874['options']?_0x3ee874['options'][_0x6395('0x21')]||null:null,'attributes':[[_0x6395('0x30'),_0x6395('0x31')],[db['sequelize']['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x32')))),_0x6395('0x33')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')]['literal'](_0x6395('0x34')))),'outboundNoAnswerCallsDay'],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')]['literal'](_0x6395('0x26')))),'outboundAnswerCallsDay'],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db['sequelize']['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x35')))),_0x6395('0x36')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x37')))),_0x6395('0x38')],[db['sequelize']['fn'](_0x6395('0x23'),db['sequelize']['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x39')))),_0x6395('0x3a')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db['sequelize'][_0x6395('0x25')](_0x6395('0x3b')))),_0x6395('0x3c')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x3d')))),_0x6395('0x3e')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0x6395('0x3f')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db['sequelize'][_0x6395('0x25')](_0x6395('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x41')))),'outboundRejectCallsDay'],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x6395('0x42')],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db['sequelize']['fn']('IF',db[_0x6395('0x22')]['literal'](_0x6395('0x43')))),'outboundRejectCallsDay'],[db[_0x6395('0x22')]['fn'](_0x6395('0x23'),db[_0x6395('0x22')]['fn']('IF',db['sequelize'][_0x6395('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x6395('0x44')]],'group':[_0x6395('0x30')]})[_0x6395('0xe')](function(_0x12872d){logger[_0x6395('0x1e')](_0x6395('0x2f'),_0x3ee874);logger[_0x6395('0x11')](_0x6395('0x2f'),_0x3ee874,JSON[_0x6395('0x12')](_0x12872d));_0x523ace(_0x12872d);})['catch'](function(_0x30093d){logger['error'](_0x6395('0x2f'),_0x30093d[_0x6395('0x15')],_0x3ee874);_0x2a9a6b(_0xb6e54c[_0x6395('0x13')](0x1f4,_0x30093d[_0x6395('0x15')]));});});};exports[_0x6395('0x45')]=function(_0x3f0d9c){var _0x1ef0c5=this;return new Promise(function(_0x1c049a,_0x5a085a){return db['CmHopperHistory'][_0x6395('0x20')]({'raw':_0x3f0d9c[_0x6395('0x1c')]?_0x3f0d9c[_0x6395('0x1c')][_0x6395('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f0d9c['options']?_0x3f0d9c[_0x6395('0x1c')][_0x6395('0x21')]||null:null,'attributes':[[_0x6395('0x30'),_0x6395('0x31')],[db[_0x6395('0x22')]['fn']('COUNT',db[_0x6395('0x22')][_0x6395('0x24')]('id')),_0x6395('0x46')],[db['sequelize']['fn'](_0x6395('0x23'),db['sequelize']['fn']('IF',db[_0x6395('0x22')][_0x6395('0x25')](_0x6395('0x26')))),_0x6395('0x47')]],'group':[_0x6395('0x30')]})['then'](function(_0x480540){logger['info'](_0x6395('0x45'),_0x3f0d9c);logger[_0x6395('0x11')](_0x6395('0x45'),_0x3f0d9c,JSON['stringify'](_0x480540));_0x1c049a(_0x480540);})[_0x6395('0x17')](function(_0x5c7560){logger[_0x6395('0x13')](_0x6395('0x45'),_0x5c7560['message'],_0x3f0d9c);_0x5a085a(_0x1ef0c5[_0x6395('0x13')](0x1f4,_0x5c7560[_0x6395('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9b7fa4c..0deba1f 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 _0xf3d0=['update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x3d4fed,_0xd5e2a8){var _0x236ed2=function(_0x2e6f7d){while(--_0x2e6f7d){_0x3d4fed['push'](_0x3d4fed['shift']());}};_0x236ed2(++_0xd5e2a8);}(_0xf3d0,0x18e));var _0x0f3d=function(_0x463972,_0x2e7115){_0x463972=_0x463972-0x0;var _0x268022=_0xf3d0[_0x463972];return _0x268022;};'use strict';var multer=require(_0x0f3d('0x0'));var util=require(_0x0f3d('0x1'));var path=require('path');var timeout=require(_0x0f3d('0x2'));var express=require(_0x0f3d('0x3'));var router=express[_0x0f3d('0x4')]();var auth=require(_0x0f3d('0x5'));var interaction=require(_0x0f3d('0x6'));var config=require(_0x0f3d('0x7'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x0f3d('0x8')](),controller[_0x0f3d('0x9')]);router[_0x0f3d('0xa')](_0x0f3d('0xb'),auth[_0x0f3d('0x8')](),controller[_0x0f3d('0xc')]);router[_0x0f3d('0xa')](_0x0f3d('0xd'),auth[_0x0f3d('0x8')](),controller[_0x0f3d('0xe')]);router[_0x0f3d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0f3d('0xd'),auth[_0x0f3d('0x8')](),controller[_0x0f3d('0x10')]);module[_0x0f3d('0x11')]=router; \ No newline at end of file +var _0x4e52=['index','describe','/:id','show','post','create','put','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4fae85,_0x370e6a){var _0x121bab=function(_0x3e588a){while(--_0x3e588a){_0x4fae85['push'](_0x4fae85['shift']());}};_0x121bab(++_0x370e6a);}(_0x4e52,0x1b8));var _0x24e5=function(_0x4504db,_0x289298){_0x4504db=_0x4504db-0x0;var _0x10b623=_0x4e52[_0x4504db];return _0x10b623;};'use strict';var multer=require(_0x24e5('0x0'));var util=require(_0x24e5('0x1'));var path=require('path');var timeout=require(_0x24e5('0x2'));var express=require(_0x24e5('0x3'));var router=express[_0x24e5('0x4')]();var auth=require(_0x24e5('0x5'));var interaction=require(_0x24e5('0x6'));var config=require(_0x24e5('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x24e5('0x8')]('/',auth[_0x24e5('0x9')](),controller[_0x24e5('0xa')]);router[_0x24e5('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x24e5('0xb')]);router[_0x24e5('0x8')](_0x24e5('0xc'),auth['isAuthenticated'](),controller[_0x24e5('0xd')]);router[_0x24e5('0xe')]('/',auth[_0x24e5('0x9')](),controller[_0x24e5('0xf')]);router[_0x24e5('0x10')](_0x24e5('0xc'),auth[_0x24e5('0x9')](),controller['update']);module[_0x24e5('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a83591d..d70f9e7 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 _0x44d9=['sequelize','exports','STRING','name'];(function(_0x4c8890,_0x34c779){var _0x2e7ed5=function(_0x6ba2c6){while(--_0x6ba2c6){_0x4c8890['push'](_0x4c8890['shift']());}};_0x2e7ed5(++_0x34c779);}(_0x44d9,0x9c));var _0x944d=function(_0x302817,_0x3325ee){_0x302817=_0x302817-0x0;var _0x2a6a8b=_0x44d9[_0x302817];return _0x2a6a8b;};'use strict';var Sequelize=require(_0x944d('0x0'));module[_0x944d('0x1')]={'name':{'type':Sequelize[_0x944d('0x2')],'unique':_0x944d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x944d('0x2')]},'dialPrefix':{'type':Sequelize[_0x944d('0x2')]}}; \ No newline at end of file +var _0xddb0=['STRING','name','sequelize','exports'];(function(_0x251d43,_0xd5a05a){var _0x3d7759=function(_0x13bd1c){while(--_0x13bd1c){_0x251d43['push'](_0x251d43['shift']());}};_0x3d7759(++_0xd5a05a);}(_0xddb0,0xa6));var _0x0ddb=function(_0x2373be,_0x166927){_0x2373be=_0x2373be-0x0;var _0x42dacb=_0xddb0[_0x2373be];return _0x42dacb;};'use strict';var Sequelize=require(_0x0ddb('0x0'));module[_0x0ddb('0x1')]={'name':{'type':Sequelize[_0x0ddb('0x2')],'unique':_0x0ddb('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0ddb('0x2')]},'dialPrefix':{'type':Sequelize[_0x0ddb('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index bc4a44f..42844af 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 _0x7d26=['ListId','findOne','Disposition','pick','rows','ids','addContacts','CmContact','tags','isArray','join','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','format','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','./cmList.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','filtears','intersection','fields','find','create','body','user','get','role','UserProfileSection','autoAssociation','update','catch','describe','addDisposition'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x7d26,0xcb));var _0x67d2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7d26[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x67d2('0x0'));var emlformat=require(_0x67d2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67d2('0x2'));var moment=require(_0x67d2('0x3'));var BPromise=require(_0x67d2('0x4'));var Mustache=require(_0x67d2('0x5'));var util=require(_0x67d2('0x6'));var path=require(_0x67d2('0x7'));var sox=require(_0x67d2('0x8'));var csv=require(_0x67d2('0x9'));var ejs=require(_0x67d2('0xa'));var fs=require('fs');var _=require(_0x67d2('0xb'));var squel=require(_0x67d2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67d2('0xd'));var toCsv=require(_0x67d2('0x9'));var querystring=require(_0x67d2('0xe'));var Papa=require(_0x67d2('0xf'));var Redis=require(_0x67d2('0x10'));var authService=require(_0x67d2('0x11'));var qs=require(_0x67d2('0x12'));var as=require(_0x67d2('0x13'));var hardwareService=require(_0x67d2('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x67d2('0x15'));var config=require(_0x67d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x67d2('0x17')]=_['defaults'](config[_0x67d2('0x17')],{'host':_0x67d2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x67d2('0x17')]));require(_0x67d2('0x19'))[_0x67d2('0x1a')](socket);function respondWithStatusCode(_0x44c8fd,_0x5044b5){_0x5044b5=_0x5044b5||0xcc;return function(_0x4f7463){if(_0x4f7463){return _0x44c8fd[_0x67d2('0x1b')](_0x5044b5);}return _0x44c8fd[_0x67d2('0x1c')](_0x5044b5)[_0x67d2('0x1d')]();};}function respondWithResult(_0x6052a1,_0x26795c){_0x26795c=_0x26795c||0xc8;return function(_0x501340){if(_0x501340){return _0x6052a1['status'](_0x26795c)['json'](_0x501340);}};}function respondWithFilteredResult(_0x571ab1,_0x12d198){return function(_0x54aee2){if(_0x54aee2){var _0xd05b7e=_0x54aee2[_0x67d2('0x1e')],_0x5d7760=_0x12d198[_0x67d2('0x1f')],_0x338e93=_0x12d198[_0x67d2('0x1f')]+_0x12d198['limit'],_0x11ccd9;if(_0x338e93>=_0xd05b7e){_0x338e93=_0xd05b7e;_0x11ccd9=0xc8;}else{_0x11ccd9=0xce;}_0x571ab1[_0x67d2('0x1c')](_0x11ccd9);return _0x571ab1[_0x67d2('0x20')](_0x67d2('0x21'),_0x5d7760+'-'+_0x338e93+'/'+_0xd05b7e)[_0x67d2('0x22')](_0x54aee2);}return null;};}function patchUpdates(_0x6caeb1){return function(_0x3334b8){try{jsonpatch[_0x67d2('0x23')](_0x3334b8,_0x6caeb1,!![]);}catch(_0x4f374a){return BPromise[_0x67d2('0x24')](_0x4f374a);}return _0x3334b8[_0x67d2('0x25')]();};}function saveUpdates(_0x4d29f2,_0xb65b5c){return function(_0x1675e9){if(_0x1675e9){return _0x1675e9['update'](_0x4d29f2)[_0x67d2('0x26')](function(_0x10dec1){return _0x10dec1;});}return null;};}function removeEntity(_0x70adec,_0x5d7e1b){return function(_0xa1444c){if(_0xa1444c){return _0xa1444c[_0x67d2('0x27')]()['then'](function(){var _0x26b64d=_0xa1444c['get']({'plain':!![]});var _0x1d24a1=_0x67d2('0x28');return db[_0x67d2('0x29')][_0x67d2('0x27')]({'where':{'type':_0x1d24a1,'resourceId':_0x26b64d['id']}})[_0x67d2('0x26')](function(){return _0xa1444c;});})[_0x67d2('0x26')](function(){_0x70adec[_0x67d2('0x1c')](0xcc)[_0x67d2('0x1d')]();});}};}function handleEntityNotFound(_0x25da8a,_0x13547f){return function(_0x4e6484){if(!_0x4e6484){_0x25da8a['sendStatus'](0x194);}return _0x4e6484;};}function handleError(_0x391b18,_0x18d399){_0x18d399=_0x18d399||0x1f4;return function(_0x5731af){logger[_0x67d2('0x2a')](_0x5731af[_0x67d2('0x2b')]);if(_0x5731af['name']){delete _0x5731af[_0x67d2('0x2c')];}_0x391b18[_0x67d2('0x1c')](_0x18d399)[_0x67d2('0x2d')](_0x5731af);};}exports[_0x67d2('0x2e')]=function(_0x492763,_0x3adf24){var _0x6278c1={},_0x18fee9={},_0x44aa50={'count':0x0,'rows':[]};var _0x1b3a6f=_[_0x67d2('0x2f')](db[_0x67d2('0x30')][_0x67d2('0x31')],function(_0x4009f9){return{'name':_0x4009f9[_0x67d2('0x32')],'type':_0x4009f9['type'][_0x67d2('0x33')]};});_0x18fee9['model']=_[_0x67d2('0x2f')](_0x1b3a6f,_0x67d2('0x2c'));_0x18fee9[_0x67d2('0x34')]=_[_0x67d2('0x35')](_0x492763[_0x67d2('0x34')]);_0x18fee9['filters']=_['intersection'](_0x18fee9[_0x67d2('0x36')],_0x18fee9[_0x67d2('0x34')]);_0x6278c1['attributes']=_['intersection'](_0x18fee9['model'],qs['fields'](_0x492763[_0x67d2('0x34')]['fields']));_0x6278c1[_0x67d2('0x37')]=_0x6278c1[_0x67d2('0x37')][_0x67d2('0x38')]?_0x6278c1[_0x67d2('0x37')]:_0x18fee9[_0x67d2('0x36')];if(!_0x492763['query'][_0x67d2('0x39')](_0x67d2('0x3a'))){_0x6278c1[_0x67d2('0x3b')]=qs[_0x67d2('0x3b')](_0x492763[_0x67d2('0x34')][_0x67d2('0x3b')]);_0x6278c1[_0x67d2('0x1f')]=qs[_0x67d2('0x1f')](_0x492763[_0x67d2('0x34')][_0x67d2('0x1f')]);}_0x6278c1[_0x67d2('0x3c')]=qs[_0x67d2('0x3d')](_0x492763[_0x67d2('0x34')][_0x67d2('0x3d')]);_0x6278c1[_0x67d2('0x3e')]=qs[_0x67d2('0x3f')](_['pick'](_0x492763[_0x67d2('0x34')],_0x18fee9['filters']),_0x1b3a6f);if(_0x492763['query'][_0x67d2('0x40')]){_0x6278c1[_0x67d2('0x3e')]=_['merge'](_0x6278c1[_0x67d2('0x3e')],{'$or':_[_0x67d2('0x2f')](_0x1b3a6f,function(_0x526097){if(_0x526097[_0x67d2('0x41')]!==_0x67d2('0x42')){var _0x219987={};_0x219987[_0x526097[_0x67d2('0x2c')]]={'$like':'%'+_0x492763['query'][_0x67d2('0x40')]+'%'};return _0x219987;}})});}_0x6278c1=_[_0x67d2('0x43')]({},_0x6278c1,_0x492763[_0x67d2('0x44')]);var _0x4cbf2b={'where':_0x6278c1[_0x67d2('0x3e')]};return db[_0x67d2('0x30')][_0x67d2('0x1e')](_0x4cbf2b)['then'](function(_0x1762cf){_0x44aa50['count']=_0x1762cf;if(_0x492763['query'][_0x67d2('0x45')]){_0x6278c1[_0x67d2('0x46')]=[{'all':!![]}];}return db[_0x67d2('0x30')][_0x67d2('0x47')](_0x6278c1);})['then'](function(_0x4cf9c3){_0x44aa50['rows']=_0x4cf9c3;return _0x44aa50;})[_0x67d2('0x26')](respondWithFilteredResult(_0x3adf24,_0x6278c1))['catch'](handleError(_0x3adf24,null));};exports[_0x67d2('0x48')]=function(_0x1c958c,_0x3414f3){var _0x4d837f={'raw':![],'where':{'id':_0x1c958c[_0x67d2('0x49')]['id']}},_0xec72da={};_0xec72da[_0x67d2('0x36')]=_['keys'](db[_0x67d2('0x30')][_0x67d2('0x31')]);_0xec72da['query']=_[_0x67d2('0x35')](_0x1c958c[_0x67d2('0x34')]);_0xec72da[_0x67d2('0x4a')]=_[_0x67d2('0x4b')](_0xec72da[_0x67d2('0x36')],_0xec72da[_0x67d2('0x34')]);_0x4d837f[_0x67d2('0x37')]=_[_0x67d2('0x4b')](_0xec72da[_0x67d2('0x36')],qs[_0x67d2('0x4c')](_0x1c958c[_0x67d2('0x34')][_0x67d2('0x4c')]));_0x4d837f[_0x67d2('0x37')]=_0x4d837f[_0x67d2('0x37')]['length']?_0x4d837f[_0x67d2('0x37')]:_0xec72da[_0x67d2('0x36')];if(_0x1c958c[_0x67d2('0x34')][_0x67d2('0x45')]){_0x4d837f[_0x67d2('0x46')]=[{'all':!![]}];}_0x4d837f=_[_0x67d2('0x43')]({},_0x4d837f,_0x1c958c[_0x67d2('0x44')]);return db[_0x67d2('0x30')][_0x67d2('0x4d')](_0x4d837f)[_0x67d2('0x26')](handleEntityNotFound(_0x3414f3,null))['then'](respondWithResult(_0x3414f3,null))['catch'](handleError(_0x3414f3,null));};exports['create']=function(_0x4840f8,_0x29980c){return db['CmList'][_0x67d2('0x4e')](_0x4840f8[_0x67d2('0x4f')],{})[_0x67d2('0x26')](function(_0x157f19){var _0x2e1ca9=_0x4840f8[_0x67d2('0x50')][_0x67d2('0x51')]({'plain':!![]});if(!_0x2e1ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e1ca9[_0x67d2('0x52')]==='user'){var _0x3ebe6c=_0x157f19[_0x67d2('0x51')]({'plain':!![]});var _0x117a08='Lists';return db[_0x67d2('0x53')][_0x67d2('0x4d')]({'where':{'name':_0x117a08,'userProfileId':_0x2e1ca9['userProfileId']},'raw':!![]})[_0x67d2('0x26')](function(_0x5546b1){if(_0x5546b1&&_0x5546b1[_0x67d2('0x54')]===0x0){return db['UserProfileResource'][_0x67d2('0x4e')]({'name':_0x3ebe6c[_0x67d2('0x2c')],'resourceId':_0x3ebe6c['id'],'type':_0x5546b1[_0x67d2('0x2c')],'sectionId':_0x5546b1['id']},{})[_0x67d2('0x26')](function(){return _0x157f19;});}else{return _0x157f19;}})['catch'](function(_0x682f52){logger[_0x67d2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x682f52);throw _0x682f52;});}return _0x157f19;})['then'](respondWithResult(_0x29980c,0xc9))['catch'](handleError(_0x29980c,null));};exports[_0x67d2('0x55')]=function(_0x776609,_0x569427){if(_0x776609['body']['id']){delete _0x776609[_0x67d2('0x4f')]['id'];}return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x776609[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x569427,null))[_0x67d2('0x26')](saveUpdates(_0x776609[_0x67d2('0x4f')],null))[_0x67d2('0x26')](respondWithResult(_0x569427,null))[_0x67d2('0x56')](handleError(_0x569427,null));};exports['destroy']=function(_0x467cb0,_0x433ce1){return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x467cb0[_0x67d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x433ce1,null))[_0x67d2('0x26')](removeEntity(_0x433ce1,null))[_0x67d2('0x56')](handleError(_0x433ce1,null));};exports[_0x67d2('0x57')]=function(_0x41fc60,_0x29bb8a){return db[_0x67d2('0x30')][_0x67d2('0x57')]()['then'](respondWithResult(_0x29bb8a,null))['catch'](handleError(_0x29bb8a,null));};exports[_0x67d2('0x58')]=function(_0x598311,_0x1f51bf,_0x9a9b55){if(_0x598311['body']['id']){delete _0x598311['body']['id'];}return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x598311[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x1f51bf,null))[_0x67d2('0x26')](function(_0x433d02){if(_0x433d02){_0x598311['body'][_0x67d2('0x59')]=_0x433d02['id'];return db['Disposition'][_0x67d2('0x4e')](_0x598311[_0x67d2('0x4f')]);}})[_0x67d2('0x26')](respondWithResult(_0x1f51bf,null))[_0x67d2('0x56')](handleError(_0x1f51bf,null));};exports['getDispositions']=function(_0x2db9cd,_0x219abd,_0x975d5f){var _0x466393={'raw':![],'where':{}};var _0x36d26e={};var _0x1db563={'count':0x0,'rows':[]};return db[_0x67d2('0x30')][_0x67d2('0x5a')]({'where':{'id':_0x2db9cd[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x219abd,null))[_0x67d2('0x26')](function(_0x363c6b){if(_0x363c6b){_0x36d26e['model']=_[_0x67d2('0x35')](db[_0x67d2('0x5b')][_0x67d2('0x31')]);_0x36d26e[_0x67d2('0x34')]=_['keys'](_0x2db9cd['query']);_0x36d26e[_0x67d2('0x3f')]=_[_0x67d2('0x4b')](_0x36d26e[_0x67d2('0x36')],_0x36d26e[_0x67d2('0x34')]);_0x466393[_0x67d2('0x37')]=_[_0x67d2('0x4b')](_0x36d26e[_0x67d2('0x36')],qs[_0x67d2('0x4c')](_0x2db9cd[_0x67d2('0x34')][_0x67d2('0x4c')]));_0x466393['attributes']=_0x466393[_0x67d2('0x37')]['length']?_0x466393[_0x67d2('0x37')]:_0x36d26e['model'];if(!_0x2db9cd[_0x67d2('0x34')][_0x67d2('0x39')](_0x67d2('0x3a'))){_0x466393[_0x67d2('0x3b')]=qs['limit'](_0x2db9cd['query'][_0x67d2('0x3b')]);_0x466393[_0x67d2('0x1f')]=qs['offset'](_0x2db9cd['query']['offset']);}_0x466393[_0x67d2('0x3c')]=qs[_0x67d2('0x3d')](_0x2db9cd[_0x67d2('0x34')]['sort']);_0x466393[_0x67d2('0x3e')]=qs[_0x67d2('0x3f')](_[_0x67d2('0x5c')](_0x2db9cd[_0x67d2('0x34')],_0x36d26e[_0x67d2('0x3f')]));_0x466393[_0x67d2('0x3e')][_0x67d2('0x59')]=_0x363c6b['id'];if(_0x2db9cd[_0x67d2('0x34')][_0x67d2('0x40')]){_0x466393['where']=_['merge'](_0x466393['where'],{'$or':_[_0x67d2('0x2f')](_0x466393[_0x67d2('0x37')],function(_0x3ccdc1){var _0xc4a2fa={};_0xc4a2fa[_0x3ccdc1]={'$like':'%'+_0x2db9cd[_0x67d2('0x34')]['filter']+'%'};return _0xc4a2fa;})});}_0x466393=_[_0x67d2('0x43')]({},_0x466393,_0x2db9cd[_0x67d2('0x44')]);return db[_0x67d2('0x5b')][_0x67d2('0x1e')]({'where':_0x466393[_0x67d2('0x3e')]})['then'](function(_0x486080){_0x1db563['count']=_0x486080;if(_0x2db9cd[_0x67d2('0x34')][_0x67d2('0x45')]){_0x466393['include']=[{'all':!![]}];}return db[_0x67d2('0x5b')][_0x67d2('0x47')](_0x466393);})[_0x67d2('0x26')](function(_0x2a8065){_0x1db563[_0x67d2('0x5d')]=_0x2a8065;return _0x1db563;});}})['then'](respondWithFilteredResult(_0x219abd,_0x466393))[_0x67d2('0x56')](handleError(_0x219abd,null));};exports['removeDispositions']=function(_0x1ae376,_0x332e4e,_0x2115db){return db[_0x67d2('0x30')]['find']({'where':{'id':_0x1ae376[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x332e4e,null))['then'](function(_0x135c61){if(_0x135c61){return _0x135c61['removeDispositions'](_0x1ae376[_0x67d2('0x34')][_0x67d2('0x5e')]);}})[_0x67d2('0x26')](respondWithStatusCode(_0x332e4e,null))[_0x67d2('0x56')](handleError(_0x332e4e,null));};exports[_0x67d2('0x5f')]=function(_0x504951,_0x143aa5,_0x16fa68){return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x504951[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x143aa5,null))[_0x67d2('0x26')](function(_0xbd3c){if(_0xbd3c){var _0x31671d=[];var _0x3523f4={'success':[],'errors':[]};return db[_0x67d2('0x60')]['describe']()[_0x67d2('0x26')](function(_0x5a3f7c){if(_0x504951['body'][_0x67d2('0x61')]&&_[_0x67d2('0x62')](_0x504951[_0x67d2('0x4f')][_0x67d2('0x61')])){if(_0x504951[_0x67d2('0x4f')][_0x67d2('0x61')][_0x67d2('0x38')]){_0x504951[_0x67d2('0x4f')]['tags']=_0x504951[_0x67d2('0x4f')][_0x67d2('0x61')][_0x67d2('0x63')](';')+';';}else{_0x504951[_0x67d2('0x4f')][_0x67d2('0x61')]=null;}}else{_0x504951[_0x67d2('0x4f')][_0x67d2('0x61')]=null;}if(_0x504951[_0x67d2('0x4f')]&&_[_0x67d2('0x62')](_0x504951[_0x67d2('0x4f')])){for(var _0x34fba9=0x0;_0x34fba9<_0x504951[_0x67d2('0x4f')][_0x67d2('0x38')];_0x34fba9+=0x1){_0x504951['body'][_0x34fba9][_0x67d2('0x59')]=_0x504951[_0x67d2('0x49')]['id'];_0x31671d['push'](_0x504951[_0x67d2('0x4f')][_0x34fba9]);}return BPromise['each'](_0x31671d,function(_0x41a3cf){return db[_0x67d2('0x60')][_0x67d2('0x4e')](_[_0x67d2('0x64')](_0x41a3cf,[_0x67d2('0x5e'),'id'])||{},{'fields':_[_0x67d2('0x35')](_0x5a3f7c),'raw':!![]})[_0x67d2('0x26')](function(_0x13eca1){_0x3523f4[_0x67d2('0x65')][_0x67d2('0x66')](_0x13eca1[_0x67d2('0x67')]);})[_0x67d2('0x56')](function(_0x47eaf9){_0x3523f4[_0x67d2('0x68')][_0x67d2('0x66')]({'data':_0x41a3cf,'error':_0x47eaf9[_0x67d2('0x69')]});});})[_0x67d2('0x26')](function(_0x2155a9){return _0x3523f4;})['catch'](function(_0x219867){return _0x219867;});}else{_0x143aa5[_0x67d2('0x1c')](0x190)[_0x67d2('0x22')]({'message':_0x67d2('0x6a')});}});}})[_0x67d2('0x26')](respondWithResult(_0x143aa5,null))[_0x67d2('0x56')](handleError(_0x143aa5,null));};exports[_0x67d2('0x6b')]=function(_0x30544b,_0xe763b9,_0x1fbaa1){var _0x1fec89;return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x30544b[_0x67d2('0x49')]['id']},'include':[{'model':db[_0x67d2('0x6c')],'as':_0x67d2('0x6d')}]})[_0x67d2('0x26')](handleEntityNotFound(_0xe763b9,null))[_0x67d2('0x26')](function(_0x5a26f2){if(_0x5a26f2){_0x1fec89=_0x5a26f2;return db[_0x67d2('0x60')]['rawAttributes'];}})[_0x67d2('0x26')](function(_0x29f1c0){if(_0x29f1c0){var _0x2c7feb={};var _0x568574={};_0x568574[_0x67d2('0x36')]=_[_0x67d2('0x6e')](_[_0x67d2('0x35')](_0x29f1c0),_['map'](_0x1fec89[_0x67d2('0x6d')],function(_0x34adb1){return util['format'](_0x67d2('0x6f'),_0x34adb1['id']);}));_0x568574['query']=_[_0x67d2('0x35')](_0x30544b['query']);_0x568574[_0x67d2('0x3f')]=_['intersection'](_0x568574['model'],_0x568574[_0x67d2('0x34')]);_0x2c7feb[_0x67d2('0x37')]=_[_0x67d2('0x4b')](_0x568574['model'],qs['fields'](_0x30544b[_0x67d2('0x34')][_0x67d2('0x4c')]));_0x2c7feb[_0x67d2('0x37')]=_0x2c7feb['attributes'][_0x67d2('0x38')]?_0x2c7feb[_0x67d2('0x37')]:_0x568574[_0x67d2('0x36')];if(!_0x30544b[_0x67d2('0x34')][_0x67d2('0x39')](_0x67d2('0x3a'))){_0x2c7feb[_0x67d2('0x3b')]=qs[_0x67d2('0x3b')](_0x30544b[_0x67d2('0x34')][_0x67d2('0x3b')]);_0x2c7feb[_0x67d2('0x1f')]=qs[_0x67d2('0x1f')](_0x30544b[_0x67d2('0x34')][_0x67d2('0x1f')]);}_0x2c7feb[_0x67d2('0x3c')]=qs[_0x67d2('0x3d')](_0x30544b[_0x67d2('0x34')][_0x67d2('0x3d')]);_0x2c7feb[_0x67d2('0x3e')]=qs['filters'](_[_0x67d2('0x5c')](_0x30544b[_0x67d2('0x34')],_0x568574[_0x67d2('0x3f')]));_0x2c7feb['raw']=!![];if(_0x30544b[_0x67d2('0x34')][_0x67d2('0x40')]){_0x2c7feb['where']=_['merge'](_0x2c7feb[_0x67d2('0x3e')],{'$or':_[_0x67d2('0x2f')](_0x2c7feb[_0x67d2('0x37')],function(_0x4d90e2){var _0x3ec2b4={};_0x3ec2b4[_0x4d90e2]={'$like':'%'+_0x30544b[_0x67d2('0x34')][_0x67d2('0x40')]+'%'};return _0x3ec2b4;})});}_0x2c7feb=_[_0x67d2('0x43')]({},_0x2c7feb,_0x30544b[_0x67d2('0x44')]);return _0x1fec89[_0x67d2('0x6b')](_0x2c7feb);}})[_0x67d2('0x26')](respondWithResult(_0xe763b9,null))[_0x67d2('0x56')](handleError(_0xe763b9,null));};exports['getContactsCsv']=function(_0x595ee7,_0x4bdc76,_0x10e772){var _0x192c04;return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0x595ee7['params']['id']},'include':[{'model':db[_0x67d2('0x6c')],'as':_0x67d2('0x6d')}]})[_0x67d2('0x26')](handleEntityNotFound(_0x4bdc76,null))[_0x67d2('0x26')](function(_0x111d16){if(_0x111d16){_0x192c04=_0x111d16;return db[_0x67d2('0x60')][_0x67d2('0x31')];}})[_0x67d2('0x26')](function(_0x52f764){if(_0x52f764){var _0x571b5f={};var _0x14316e={};_0x14316e[_0x67d2('0x36')]=_[_0x67d2('0x6e')](_[_0x67d2('0x35')](_0x52f764),_[_0x67d2('0x2f')](_0x192c04[_0x67d2('0x6d')],function(_0x411c83){return util[_0x67d2('0x70')](_0x67d2('0x6f'),_0x411c83['id']);}));_0x14316e[_0x67d2('0x34')]=_[_0x67d2('0x35')](_0x595ee7[_0x67d2('0x34')]);_0x14316e[_0x67d2('0x3f')]=_['intersection'](_0x14316e['model'],_0x14316e[_0x67d2('0x34')]);_0x571b5f['attributes']=_[_0x67d2('0x4b')](_0x14316e[_0x67d2('0x36')],qs[_0x67d2('0x4c')](_0x595ee7['query'][_0x67d2('0x4c')]));_0x571b5f[_0x67d2('0x37')]=_0x571b5f['attributes']['length']?_0x571b5f['attributes']:_0x14316e[_0x67d2('0x36')];if(!_0x595ee7[_0x67d2('0x34')][_0x67d2('0x39')](_0x67d2('0x3a'))){_0x571b5f[_0x67d2('0x3b')]=qs[_0x67d2('0x3b')](_0x595ee7[_0x67d2('0x34')][_0x67d2('0x3b')]);_0x571b5f[_0x67d2('0x1f')]=qs[_0x67d2('0x1f')](_0x595ee7['query'][_0x67d2('0x1f')]);}_0x571b5f['order']=qs[_0x67d2('0x3d')](_0x595ee7['query']['sort']);_0x571b5f[_0x67d2('0x3e')]=qs[_0x67d2('0x3f')](_[_0x67d2('0x5c')](_0x595ee7[_0x67d2('0x34')],_0x14316e[_0x67d2('0x3f')]));_0x571b5f['raw']=!![];if(_0x595ee7[_0x67d2('0x34')][_0x67d2('0x40')]){_0x571b5f[_0x67d2('0x3e')]=_['merge'](_0x571b5f[_0x67d2('0x3e')],{'$or':_['map'](_0x571b5f[_0x67d2('0x37')],function(_0x1f8f90){var _0x387340={};_0x387340[_0x1f8f90]={'$like':'%'+_0x595ee7['query'][_0x67d2('0x40')]+'%'};return _0x387340;})});}_0x571b5f=_['merge']({},_0x571b5f,_0x595ee7[_0x67d2('0x44')]);return _0x192c04[_0x67d2('0x6b')](_0x571b5f);}})['then'](function(_0x52564d){if(!_[_0x67d2('0x71')](_0x52564d)){var _0xc8d4a5=toCsv(_0x52564d);var _0x1041ea=Date[_0x67d2('0x72')]();fs[_0x67d2('0x73')](util[_0x67d2('0x70')](_0x67d2('0x74'),_0x192c04['id'],_0x1041ea),_0xc8d4a5);_0x4bdc76[_0x67d2('0x75')](_0x67d2('0x76'),_0x67d2('0x77')+util[_0x67d2('0x70')](_0x67d2('0x78'),_0x192c04['id'],_0x1041ea));_0x4bdc76[_0x67d2('0x75')](_0x67d2('0x79'),_0x67d2('0x7a'));return _0x4bdc76['download'](util['format'](_0x67d2('0x74'),_0x192c04['id'],_0x1041ea));}else{return _0x4bdc76[_0x67d2('0x1b')](0xcc);}})[_0x67d2('0x56')](handleError(_0x4bdc76,null));};exports['addCustomField']=function(_0x20ed45,_0x377c6a,_0x122d26){var _0x142fbe;delete _0x20ed45[_0x67d2('0x4f')]['id'];return db[_0x67d2('0x30')][_0x67d2('0x5a')]({'where':{'id':_0x20ed45[_0x67d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x377c6a,null))[_0x67d2('0x26')](function(_0x52601b){if(_0x52601b){return db[_0x67d2('0x7b')][_0x67d2('0x7c')](function(_0x3a576e){return db['CmCustomField'][_0x67d2('0x4e')](_0x20ed45[_0x67d2('0x4f')],{'transaction':_0x3a576e})[_0x67d2('0x26')](function(_0x360c2e){_0x142fbe=_0x360c2e;return _0x52601b[_0x67d2('0x7d')](_0x360c2e,{'transaction':_0x3a576e});})[_0x67d2('0x26')](function(){var _0xa95966={'type':db[_0x67d2('0x7e')]['TEXT'],'transaction':_0x3a576e};switch(_0x20ed45[_0x67d2('0x4f')]['type']){case _0x67d2('0x7f'):_0xa95966[_0x67d2('0x41')]=db['Sequelize'][_0x67d2('0x80')];break;case _0x67d2('0x81'):_0xa95966[_0x67d2('0x41')]=db[_0x67d2('0x7e')][_0x67d2('0x82')];break;case _0x67d2('0x83'):_0xa95966[_0x67d2('0x41')]=db[_0x67d2('0x7e')][_0x67d2('0x84')];_0xa95966[_0x67d2('0x85')]=![];break;default:}return db[_0x67d2('0x7b')][_0x67d2('0x86')][_0x67d2('0x87')](_0x67d2('0x88'),util[_0x67d2('0x70')](_0x67d2('0x89'),_0x142fbe['id']),_0xa95966);})['then'](function(){return _0x142fbe;});});}})['then'](respondWithResult(_0x377c6a,null))[_0x67d2('0x56')](handleError(_0x377c6a,null));};exports[_0x67d2('0x8a')]=function(_0x593ba6,_0x41cc72,_0x4c29e0){var _0x451591={};var _0x46472e={};var _0x5b1637;var _0x1d3dae;return db[_0x67d2('0x30')]['findOne']({'where':{'id':_0x593ba6[_0x67d2('0x49')]['id']}})['then'](handleEntityNotFound(_0x41cc72,null))[_0x67d2('0x26')](function(_0x19f2e6){if(_0x19f2e6){_0x5b1637=_0x19f2e6;_0x46472e['model']=_[_0x67d2('0x35')](db[_0x67d2('0x6c')][_0x67d2('0x31')]);_0x46472e[_0x67d2('0x34')]=_[_0x67d2('0x35')](_0x593ba6[_0x67d2('0x34')]);_0x46472e[_0x67d2('0x3f')]=_['intersection'](_0x46472e[_0x67d2('0x36')],_0x46472e[_0x67d2('0x34')]);_0x451591['attributes']=_[_0x67d2('0x4b')](_0x46472e[_0x67d2('0x36')],qs['fields'](_0x593ba6[_0x67d2('0x34')][_0x67d2('0x4c')]));_0x451591[_0x67d2('0x37')]=_0x451591[_0x67d2('0x37')][_0x67d2('0x38')]?_0x451591['attributes']:_0x46472e[_0x67d2('0x36')];_0x451591['order']=qs['sort'](_0x593ba6['query'][_0x67d2('0x3d')]);_0x451591['where']=qs[_0x67d2('0x3f')](_['pick'](_0x593ba6[_0x67d2('0x34')],_0x46472e['filters']));_0x451591[_0x67d2('0x3e')]=_['merge'](_0x451591['where'],{'$or':[{'ListId':_0x19f2e6['id']},{'ListId':null}]});if(_0x593ba6[_0x67d2('0x34')][_0x67d2('0x40')]){_0x451591[_0x67d2('0x3e')]=_[_0x67d2('0x43')](_0x451591[_0x67d2('0x3e')],{'$or':_[_0x67d2('0x2f')](_0x451591[_0x67d2('0x37')],function(_0x2c028f){var _0xc2d250={};_0xc2d250[_0x2c028f]={'$like':'%'+_0x593ba6[_0x67d2('0x34')][_0x67d2('0x40')]+'%'};return _0xc2d250;})});}_0x451591=_[_0x67d2('0x43')]({},_0x451591,_0x593ba6[_0x67d2('0x44')]);return db[_0x67d2('0x6c')]['findAndCountAll'](_0x451591);}})[_0x67d2('0x26')](respondWithResult(_0x41cc72,null))[_0x67d2('0x56')](handleError(_0x41cc72,null));};exports['addAgents']=function(_0xc85bcb,_0x1172c6,_0x5b2b6e){return db[_0x67d2('0x30')][_0x67d2('0x4d')]({'where':{'id':_0xc85bcb['params']['id']}})['then'](handleEntityNotFound(_0x1172c6,null))['then'](function(_0xb4769b){if(_0xb4769b){return _0xb4769b[_0x67d2('0x8b')](_0xc85bcb[_0x67d2('0x4f')][_0x67d2('0x5e')],_[_0x67d2('0x64')](_0xc85bcb[_0x67d2('0x4f')],['ids','id'])||{})['spread'](function(_0x2af9ba){for(var _0x2bc467=0x0;_0x2bc467<_0xc85bcb[_0x67d2('0x4f')][_0x67d2('0x5e')][_0x67d2('0x38')];_0x2bc467+=0x1){socket[_0x67d2('0x8c')](_0x67d2('0x8d'),{'UserId':_0xc85bcb[_0x67d2('0x4f')][_0x67d2('0x5e')][_0x2bc467],'CmListId':_0xc85bcb[_0x67d2('0x49')]['id']});}return _0x2af9ba;});}})[_0x67d2('0x26')](respondWithResult(_0x1172c6,null))[_0x67d2('0x56')](handleError(_0x1172c6,null));};exports['removeAgents']=function(_0x18eeda,_0x41060a,_0x449387){return db['CmList'][_0x67d2('0x4d')]({'where':{'id':_0x18eeda[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0x41060a,null))[_0x67d2('0x26')](function(_0x4465d2){if(_0x4465d2){return _0x4465d2[_0x67d2('0x8e')](_0x18eeda[_0x67d2('0x34')][_0x67d2('0x5e')])[_0x67d2('0x26')](function(){if(_[_0x67d2('0x62')](_0x18eeda['query'][_0x67d2('0x5e')])){for(var _0x44e204=0x0;_0x44e204<_0x18eeda[_0x67d2('0x34')][_0x67d2('0x5e')][_0x67d2('0x38')];_0x44e204+=0x1){socket[_0x67d2('0x8c')]('userCmList:remove',{'UserId':Number(_0x18eeda[_0x67d2('0x34')]['ids'][_0x44e204]),'CmListId':Number(_0x18eeda[_0x67d2('0x49')]['id'])});}}else{socket[_0x67d2('0x8c')](_0x67d2('0x8f'),{'UserId':Number(_0x18eeda[_0x67d2('0x34')][_0x67d2('0x5e')]),'CmListId':Number(_0x18eeda[_0x67d2('0x49')]['id'])});}});}})[_0x67d2('0x26')](respondWithStatusCode(_0x41060a,null))['catch'](handleError(_0x41060a,null));};exports[_0x67d2('0x90')]=function(_0x33f5df,_0xacc286,_0x378f5e){var _0x35cc2a={};var _0x1835dc={};var _0x210d5c;var _0x9f3904;return db[_0x67d2('0x30')]['findOne']({'where':{'id':_0x33f5df[_0x67d2('0x49')]['id']}})[_0x67d2('0x26')](handleEntityNotFound(_0xacc286,null))['then'](function(_0xdfcc91){if(_0xdfcc91){_0x210d5c=_0xdfcc91;_0x1835dc[_0x67d2('0x36')]=_[_0x67d2('0x35')](db[_0x67d2('0x91')][_0x67d2('0x31')]);_0x1835dc[_0x67d2('0x34')]=_[_0x67d2('0x35')](_0x33f5df['query']);_0x1835dc[_0x67d2('0x3f')]=_[_0x67d2('0x4b')](_0x1835dc['model'],_0x1835dc[_0x67d2('0x34')]);_0x35cc2a[_0x67d2('0x37')]=_[_0x67d2('0x4b')](_0x1835dc[_0x67d2('0x36')],qs[_0x67d2('0x4c')](_0x33f5df['query'][_0x67d2('0x4c')]));_0x35cc2a[_0x67d2('0x37')]=_0x35cc2a[_0x67d2('0x37')][_0x67d2('0x38')]?_0x35cc2a[_0x67d2('0x37')]:_0x1835dc[_0x67d2('0x36')];_0x35cc2a['order']=qs['sort'](_0x33f5df[_0x67d2('0x34')][_0x67d2('0x3d')]);_0x35cc2a[_0x67d2('0x3e')]=qs['filters'](_[_0x67d2('0x5c')](_0x33f5df[_0x67d2('0x34')],_0x1835dc[_0x67d2('0x3f')]));if(_0x33f5df[_0x67d2('0x34')][_0x67d2('0x40')]){_0x35cc2a['where']=_[_0x67d2('0x43')](_0x35cc2a[_0x67d2('0x3e')],{'$or':_['map'](_0x35cc2a[_0x67d2('0x37')],function(_0x36eeb7){var _0x615193={};_0x615193[_0x36eeb7]={'$like':'%'+_0x33f5df[_0x67d2('0x34')][_0x67d2('0x40')]+'%'};return _0x615193;})});}_0x35cc2a=_[_0x67d2('0x43')]({},_0x35cc2a,_0x33f5df[_0x67d2('0x44')]);return _0x210d5c[_0x67d2('0x90')](_0x35cc2a);}})[_0x67d2('0x26')](function(_0x1c4ac8){if(_0x1c4ac8){_0x9f3904=_0x1c4ac8[_0x67d2('0x38')];if(!_0x33f5df[_0x67d2('0x34')][_0x67d2('0x39')](_0x67d2('0x3a'))){_0x35cc2a[_0x67d2('0x3b')]=qs[_0x67d2('0x3b')](_0x33f5df[_0x67d2('0x34')][_0x67d2('0x3b')]);_0x35cc2a['offset']=qs[_0x67d2('0x1f')](_0x33f5df['query']['offset']);}return _0x210d5c['getAgents'](_0x35cc2a);}})[_0x67d2('0x26')](function(_0x25c0f3){if(_0x25c0f3){return _0x25c0f3?{'count':_0x9f3904,'rows':_0x25c0f3}:null;}})[_0x67d2('0x26')](respondWithResult(_0xacc286,null))[_0x67d2('0x56')](handleError(_0xacc286,null));}; \ No newline at end of file +var _0x43d0=['squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','filtears','find','catch','create','user','role','UserProfileSection','userProfileId','body','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','filter','options','removeDispositions','ids','addContacts','tags','isArray','join','push','each','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','CmContact','format','isEmpty','now','writeFileSync','setHeader','attachment;\x20filename=','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','userCmList:save','removeAgents','emit','userCmList:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x43d0,0x11e));var _0x043d=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0x43d0[_0x18f152];return _0xa10b34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x043d('0x0'));var rimraf=require(_0x043d('0x1'));var zipdir=require(_0x043d('0x2'));var jsonpatch=require(_0x043d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x043d('0x4'));var Mustache=require(_0x043d('0x5'));var util=require(_0x043d('0x6'));var path=require(_0x043d('0x7'));var sox=require(_0x043d('0x8'));var csv=require(_0x043d('0x9'));var ejs=require(_0x043d('0xa'));var fs=require('fs');var _=require(_0x043d('0xb'));var squel=require(_0x043d('0xc'));var crypto=require(_0x043d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x043d('0xe'));var toCsv=require(_0x043d('0x9'));var querystring=require(_0x043d('0xf'));var Papa=require('papaparse');var Redis=require(_0x043d('0x10'));var authService=require(_0x043d('0x11'));var qs=require(_0x043d('0x12'));var as=require(_0x043d('0x13'));var hardwareService=require(_0x043d('0x14'));var logger=require(_0x043d('0x15'))(_0x043d('0x16'));var utils=require(_0x043d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x043d('0x18'));var db=require(_0x043d('0x19'))['db'];config['redis']=_[_0x043d('0x1a')](config[_0x043d('0x1b')],{'host':_0x043d('0x1c'),'port':0x18eb});var socket=require(_0x043d('0x1d'))(new Redis(config[_0x043d('0x1b')]));require(_0x043d('0x1e'))[_0x043d('0x1f')](socket);function respondWithStatusCode(_0x4b77c7,_0x38c9c8){_0x38c9c8=_0x38c9c8||0xcc;return function(_0x18ada6){if(_0x18ada6){return _0x4b77c7[_0x043d('0x20')](_0x38c9c8);}return _0x4b77c7[_0x043d('0x21')](_0x38c9c8)[_0x043d('0x22')]();};}function respondWithResult(_0x51106d,_0x2aee69){_0x2aee69=_0x2aee69||0xc8;return function(_0xb4f9b6){if(_0xb4f9b6){return _0x51106d['status'](_0x2aee69)[_0x043d('0x23')](_0xb4f9b6);}};}function respondWithFilteredResult(_0x1fad2a,_0x4e255a){return function(_0x2e4e94){if(_0x2e4e94){var _0x4ae537=_0x2e4e94[_0x043d('0x24')],_0x54f6e6=_0x4e255a['offset'],_0x1dbd36=_0x4e255a['offset']+_0x4e255a[_0x043d('0x25')],_0x3e62be;if(_0x1dbd36>=_0x4ae537){_0x1dbd36=_0x4ae537;_0x3e62be=0xc8;}else{_0x3e62be=0xce;}_0x1fad2a['status'](_0x3e62be);return _0x1fad2a['set'](_0x043d('0x26'),_0x54f6e6+'-'+_0x1dbd36+'/'+_0x4ae537)[_0x043d('0x23')](_0x2e4e94);}return null;};}function patchUpdates(_0x5e6bde){return function(_0x4abfec){try{jsonpatch[_0x043d('0x27')](_0x4abfec,_0x5e6bde,!![]);}catch(_0x58bfb7){return BPromise[_0x043d('0x28')](_0x58bfb7);}return _0x4abfec[_0x043d('0x29')]();};}function saveUpdates(_0x4c7bad,_0x1975b2){return function(_0xa9ed17){if(_0xa9ed17){return _0xa9ed17[_0x043d('0x2a')](_0x4c7bad)['then'](function(_0x2abb8e){return _0x2abb8e;});}return null;};}function removeEntity(_0x37566a,_0x30faa2){return function(_0x51b920){if(_0x51b920){return _0x51b920[_0x043d('0x2b')]()[_0x043d('0x2c')](function(){var _0x55776d=_0x51b920[_0x043d('0x2d')]({'plain':!![]});var _0x6c7340=_0x043d('0x2e');return db[_0x043d('0x2f')]['destroy']({'where':{'type':_0x6c7340,'resourceId':_0x55776d['id']}})[_0x043d('0x2c')](function(){return _0x51b920;});})['then'](function(){_0x37566a[_0x043d('0x21')](0xcc)[_0x043d('0x22')]();});}};}function handleEntityNotFound(_0x125e57,_0x1011eb){return function(_0x56a180){if(!_0x56a180){_0x125e57[_0x043d('0x20')](0x194);}return _0x56a180;};}function handleError(_0x15a792,_0x393a36){_0x393a36=_0x393a36||0x1f4;return function(_0x41802e){logger[_0x043d('0x30')](_0x41802e[_0x043d('0x31')]);if(_0x41802e[_0x043d('0x32')]){delete _0x41802e[_0x043d('0x32')];}_0x15a792[_0x043d('0x21')](_0x393a36)[_0x043d('0x33')](_0x41802e);};}exports[_0x043d('0x34')]=function(_0x215177,_0x1dd89f){var _0x2064d5={},_0x37a3b9={},_0x1fefd0={'count':0x0,'rows':[]};var _0x322eb7=_[_0x043d('0x35')](db[_0x043d('0x36')]['rawAttributes'],function(_0x20ce5e){return{'name':_0x20ce5e['fieldName'],'type':_0x20ce5e['type'][_0x043d('0x37')]};});_0x37a3b9[_0x043d('0x38')]=_[_0x043d('0x35')](_0x322eb7,_0x043d('0x32'));_0x37a3b9[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x215177[_0x043d('0x39')]);_0x37a3b9[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x37a3b9[_0x043d('0x38')],_0x37a3b9[_0x043d('0x39')]);_0x2064d5[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x37a3b9[_0x043d('0x38')],qs['fields'](_0x215177['query'][_0x043d('0x3e')]));_0x2064d5[_0x043d('0x3d')]=_0x2064d5['attributes'][_0x043d('0x3f')]?_0x2064d5[_0x043d('0x3d')]:_0x37a3b9[_0x043d('0x38')];if(!_0x215177[_0x043d('0x39')][_0x043d('0x40')](_0x043d('0x41'))){_0x2064d5[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x215177['query'][_0x043d('0x25')]);_0x2064d5[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x215177['query'][_0x043d('0x42')]);}_0x2064d5[_0x043d('0x43')]=qs['sort'](_0x215177[_0x043d('0x39')][_0x043d('0x44')]);_0x2064d5[_0x043d('0x45')]=qs['filters'](_['pick'](_0x215177[_0x043d('0x39')],_0x37a3b9[_0x043d('0x3b')]),_0x322eb7);if(_0x215177[_0x043d('0x39')]['filter']){_0x2064d5['where']=_['merge'](_0x2064d5['where'],{'$or':_['map'](_0x322eb7,function(_0x34b5f0){if(_0x34b5f0[_0x043d('0x46')]!==_0x043d('0x47')){var _0x585df9={};_0x585df9[_0x34b5f0['name']]={'$like':'%'+_0x215177[_0x043d('0x39')]['filter']+'%'};return _0x585df9;}})});}_0x2064d5=_[_0x043d('0x48')]({},_0x2064d5,_0x215177['options']);var _0x582a29={'where':_0x2064d5['where']};return db['CmList'][_0x043d('0x24')](_0x582a29)[_0x043d('0x2c')](function(_0x2003a5){_0x1fefd0[_0x043d('0x24')]=_0x2003a5;if(_0x215177[_0x043d('0x39')][_0x043d('0x49')]){_0x2064d5[_0x043d('0x4a')]=[{'all':!![]}];}return db['CmList'][_0x043d('0x4b')](_0x2064d5);})['then'](function(_0x56fdd9){_0x1fefd0[_0x043d('0x4c')]=_0x56fdd9;return _0x1fefd0;})[_0x043d('0x2c')](respondWithFilteredResult(_0x1dd89f,_0x2064d5))['catch'](handleError(_0x1dd89f,null));};exports[_0x043d('0x4d')]=function(_0xc07b9e,_0x3fece6){var _0x2c8e81={'raw':![],'where':{'id':_0xc07b9e['params']['id']}},_0x4ff84a={};_0x4ff84a['model']=_[_0x043d('0x3a')](db['CmList'][_0x043d('0x4e')]);_0x4ff84a[_0x043d('0x39')]=_[_0x043d('0x3a')](_0xc07b9e[_0x043d('0x39')]);_0x4ff84a[_0x043d('0x4f')]=_[_0x043d('0x3c')](_0x4ff84a[_0x043d('0x38')],_0x4ff84a[_0x043d('0x39')]);_0x2c8e81[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x4ff84a['model'],qs[_0x043d('0x3e')](_0xc07b9e[_0x043d('0x39')]['fields']));_0x2c8e81[_0x043d('0x3d')]=_0x2c8e81[_0x043d('0x3d')][_0x043d('0x3f')]?_0x2c8e81[_0x043d('0x3d')]:_0x4ff84a[_0x043d('0x38')];if(_0xc07b9e['query'][_0x043d('0x49')]){_0x2c8e81[_0x043d('0x4a')]=[{'all':!![]}];}_0x2c8e81=_[_0x043d('0x48')]({},_0x2c8e81,_0xc07b9e['options']);return db[_0x043d('0x36')][_0x043d('0x50')](_0x2c8e81)[_0x043d('0x2c')](handleEntityNotFound(_0x3fece6,null))[_0x043d('0x2c')](respondWithResult(_0x3fece6,null))[_0x043d('0x51')](handleError(_0x3fece6,null));};exports['create']=function(_0x222318,_0x526353){return db[_0x043d('0x36')][_0x043d('0x52')](_0x222318['body'],{})[_0x043d('0x2c')](function(_0x447246){var _0x1940f4=_0x222318[_0x043d('0x53')][_0x043d('0x2d')]({'plain':!![]});if(!_0x1940f4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1940f4[_0x043d('0x54')]===_0x043d('0x53')){var _0xcbd3b=_0x447246[_0x043d('0x2d')]({'plain':!![]});var _0x35a74c=_0x043d('0x2e');return db[_0x043d('0x55')][_0x043d('0x50')]({'where':{'name':_0x35a74c,'userProfileId':_0x1940f4[_0x043d('0x56')]},'raw':!![]})[_0x043d('0x2c')](function(_0x428d33){if(_0x428d33&&_0x428d33['autoAssociation']===0x0){return db['UserProfileResource'][_0x043d('0x52')]({'name':_0xcbd3b['name'],'resourceId':_0xcbd3b['id'],'type':_0x428d33[_0x043d('0x32')],'sectionId':_0x428d33['id']},{})[_0x043d('0x2c')](function(){return _0x447246;});}else{return _0x447246;}})[_0x043d('0x51')](function(_0x79c11f){logger[_0x043d('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x79c11f);throw _0x79c11f;});}return _0x447246;})['then'](respondWithResult(_0x526353,0xc9))[_0x043d('0x51')](handleError(_0x526353,null));};exports['update']=function(_0x3068fe,_0xe724a2){if(_0x3068fe[_0x043d('0x57')]['id']){delete _0x3068fe[_0x043d('0x57')]['id'];}return db[_0x043d('0x36')]['find']({'where':{'id':_0x3068fe[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0xe724a2,null))['then'](saveUpdates(_0x3068fe[_0x043d('0x57')],null))['then'](respondWithResult(_0xe724a2,null))[_0x043d('0x51')](handleError(_0xe724a2,null));};exports[_0x043d('0x2b')]=function(_0x4b6eaf,_0x394c6f){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x4b6eaf[_0x043d('0x58')]['id']}})['then'](handleEntityNotFound(_0x394c6f,null))[_0x043d('0x2c')](removeEntity(_0x394c6f,null))[_0x043d('0x51')](handleError(_0x394c6f,null));};exports[_0x043d('0x59')]=function(_0x2df650,_0x51a7db){return db[_0x043d('0x36')][_0x043d('0x59')]()[_0x043d('0x2c')](respondWithResult(_0x51a7db,null))[_0x043d('0x51')](handleError(_0x51a7db,null));};exports[_0x043d('0x5a')]=function(_0x54b433,_0x2fd9b3,_0x1a2c8b){if(_0x54b433[_0x043d('0x57')]['id']){delete _0x54b433[_0x043d('0x57')]['id'];}return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x54b433['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x2fd9b3,null))[_0x043d('0x2c')](function(_0x17843c){if(_0x17843c){_0x54b433[_0x043d('0x57')]['ListId']=_0x17843c['id'];return db[_0x043d('0x5b')]['create'](_0x54b433['body']);}})[_0x043d('0x2c')](respondWithResult(_0x2fd9b3,null))[_0x043d('0x51')](handleError(_0x2fd9b3,null));};exports[_0x043d('0x5c')]=function(_0xe98138,_0x2cd086,_0x1fd83c){var _0x2d5247={'raw':![],'where':{}};var _0x5cf65e={};var _0xcaab04={'count':0x0,'rows':[]};return db['CmList'][_0x043d('0x5d')]({'where':{'id':_0xe98138[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x2cd086,null))[_0x043d('0x2c')](function(_0x365571){if(_0x365571){_0x5cf65e[_0x043d('0x38')]=_[_0x043d('0x3a')](db[_0x043d('0x5b')][_0x043d('0x4e')]);_0x5cf65e['query']=_['keys'](_0xe98138[_0x043d('0x39')]);_0x5cf65e['filters']=_[_0x043d('0x3c')](_0x5cf65e[_0x043d('0x38')],_0x5cf65e['query']);_0x2d5247[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x5cf65e['model'],qs[_0x043d('0x3e')](_0xe98138['query'][_0x043d('0x3e')]));_0x2d5247[_0x043d('0x3d')]=_0x2d5247[_0x043d('0x3d')][_0x043d('0x3f')]?_0x2d5247['attributes']:_0x5cf65e['model'];if(!_0xe98138[_0x043d('0x39')][_0x043d('0x40')]('nolimit')){_0x2d5247[_0x043d('0x25')]=qs[_0x043d('0x25')](_0xe98138[_0x043d('0x39')][_0x043d('0x25')]);_0x2d5247[_0x043d('0x42')]=qs['offset'](_0xe98138[_0x043d('0x39')][_0x043d('0x42')]);}_0x2d5247['order']=qs[_0x043d('0x44')](_0xe98138[_0x043d('0x39')]['sort']);_0x2d5247[_0x043d('0x45')]=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0xe98138[_0x043d('0x39')],_0x5cf65e[_0x043d('0x3b')]));_0x2d5247[_0x043d('0x45')][_0x043d('0x5f')]=_0x365571['id'];if(_0xe98138[_0x043d('0x39')][_0x043d('0x60')]){_0x2d5247[_0x043d('0x45')]=_[_0x043d('0x48')](_0x2d5247[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x2d5247[_0x043d('0x3d')],function(_0x4c3625){var _0x11e07a={};_0x11e07a[_0x4c3625]={'$like':'%'+_0xe98138[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x11e07a;})});}_0x2d5247=_[_0x043d('0x48')]({},_0x2d5247,_0xe98138[_0x043d('0x61')]);return db[_0x043d('0x5b')]['count']({'where':_0x2d5247['where']})[_0x043d('0x2c')](function(_0x261ae7){_0xcaab04[_0x043d('0x24')]=_0x261ae7;if(_0xe98138[_0x043d('0x39')]['includeAll']){_0x2d5247['include']=[{'all':!![]}];}return db[_0x043d('0x5b')][_0x043d('0x4b')](_0x2d5247);})[_0x043d('0x2c')](function(_0x4f77ce){_0xcaab04[_0x043d('0x4c')]=_0x4f77ce;return _0xcaab04;});}})['then'](respondWithFilteredResult(_0x2cd086,_0x2d5247))[_0x043d('0x51')](handleError(_0x2cd086,null));};exports[_0x043d('0x62')]=function(_0x305a7f,_0x470d88,_0x5c8576){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x305a7f[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x470d88,null))[_0x043d('0x2c')](function(_0x4edf9f){if(_0x4edf9f){return _0x4edf9f[_0x043d('0x62')](_0x305a7f[_0x043d('0x39')][_0x043d('0x63')]);}})[_0x043d('0x2c')](respondWithStatusCode(_0x470d88,null))['catch'](handleError(_0x470d88,null));};exports[_0x043d('0x64')]=function(_0x49e199,_0x66badd,_0x2a77ea){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x49e199['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x66badd,null))[_0x043d('0x2c')](function(_0x137e53){if(_0x137e53){var _0x321627=[];var _0x4e4ef7={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x043d('0x2c')](function(_0x22bc6b){if(_0x49e199[_0x043d('0x57')][_0x043d('0x65')]&&_[_0x043d('0x66')](_0x49e199['body'][_0x043d('0x65')])){if(_0x49e199[_0x043d('0x57')][_0x043d('0x65')][_0x043d('0x3f')]){_0x49e199[_0x043d('0x57')][_0x043d('0x65')]=_0x49e199[_0x043d('0x57')][_0x043d('0x65')][_0x043d('0x67')](';')+';';}else{_0x49e199['body']['tags']=null;}}else{_0x49e199[_0x043d('0x57')][_0x043d('0x65')]=null;}if(_0x49e199[_0x043d('0x57')]&&_[_0x043d('0x66')](_0x49e199[_0x043d('0x57')])){for(var _0xa239c1=0x0;_0xa239c1<_0x49e199[_0x043d('0x57')][_0x043d('0x3f')];_0xa239c1+=0x1){_0x49e199[_0x043d('0x57')][_0xa239c1][_0x043d('0x5f')]=_0x49e199[_0x043d('0x58')]['id'];_0x321627[_0x043d('0x68')](_0x49e199[_0x043d('0x57')][_0xa239c1]);}return BPromise[_0x043d('0x69')](_0x321627,function(_0x257b8e){return db['CmContact']['create'](_[_0x043d('0x6a')](_0x257b8e,[_0x043d('0x63'),'id'])||{},{'fields':_[_0x043d('0x3a')](_0x22bc6b),'raw':!![]})[_0x043d('0x2c')](function(_0x5b9319){_0x4e4ef7[_0x043d('0x6b')]['push'](_0x5b9319[_0x043d('0x6c')]);})[_0x043d('0x51')](function(_0x26baca){_0x4e4ef7['errors']['push']({'data':_0x257b8e,'error':_0x26baca['message']});});})[_0x043d('0x2c')](function(_0x45b0bf){return _0x4e4ef7;})['catch'](function(_0x483785){return _0x483785;});}else{_0x66badd[_0x043d('0x21')](0x190)[_0x043d('0x23')]({'message':_0x043d('0x6d')});}});}})[_0x043d('0x2c')](respondWithResult(_0x66badd,null))['catch'](handleError(_0x66badd,null));};exports[_0x043d('0x6e')]=function(_0x31da79,_0x3e76b3,_0x19ce39){var _0x80def4;return db[_0x043d('0x36')]['find']({'where':{'id':_0x31da79['params']['id']},'include':[{'model':db[_0x043d('0x6f')],'as':_0x043d('0x70')}]})[_0x043d('0x2c')](handleEntityNotFound(_0x3e76b3,null))[_0x043d('0x2c')](function(_0x512453){if(_0x512453){_0x80def4=_0x512453;return db['CmContact'][_0x043d('0x4e')];}})[_0x043d('0x2c')](function(_0x17a9e3){if(_0x17a9e3){var _0x1f7656={};var _0x1a502d={};_0x1a502d['model']=_[_0x043d('0x71')](_[_0x043d('0x3a')](_0x17a9e3),_['map'](_0x80def4[_0x043d('0x70')],function(_0x444b8f){return util['format'](_0x043d('0x72'),_0x444b8f['id']);}));_0x1a502d[_0x043d('0x39')]=_['keys'](_0x31da79['query']);_0x1a502d[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x1a502d[_0x043d('0x38')],_0x1a502d[_0x043d('0x39')]);_0x1f7656[_0x043d('0x3d')]=_['intersection'](_0x1a502d['model'],qs[_0x043d('0x3e')](_0x31da79['query'][_0x043d('0x3e')]));_0x1f7656[_0x043d('0x3d')]=_0x1f7656['attributes']['length']?_0x1f7656[_0x043d('0x3d')]:_0x1a502d['model'];if(!_0x31da79[_0x043d('0x39')][_0x043d('0x40')]('nolimit')){_0x1f7656[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x31da79[_0x043d('0x39')][_0x043d('0x25')]);_0x1f7656[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x31da79[_0x043d('0x39')][_0x043d('0x42')]);}_0x1f7656[_0x043d('0x43')]=qs['sort'](_0x31da79[_0x043d('0x39')][_0x043d('0x44')]);_0x1f7656[_0x043d('0x45')]=qs['filters'](_['pick'](_0x31da79[_0x043d('0x39')],_0x1a502d[_0x043d('0x3b')]));_0x1f7656['raw']=!![];if(_0x31da79['query'][_0x043d('0x60')]){_0x1f7656[_0x043d('0x45')]=_[_0x043d('0x48')](_0x1f7656['where'],{'$or':_[_0x043d('0x35')](_0x1f7656[_0x043d('0x3d')],function(_0x44638b){var _0x533dec={};_0x533dec[_0x44638b]={'$like':'%'+_0x31da79[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x533dec;})});}_0x1f7656=_[_0x043d('0x48')]({},_0x1f7656,_0x31da79['options']);return _0x80def4[_0x043d('0x6e')](_0x1f7656);}})[_0x043d('0x2c')](respondWithResult(_0x3e76b3,null))[_0x043d('0x51')](handleError(_0x3e76b3,null));};exports[_0x043d('0x73')]=function(_0x2a5bd1,_0x3651de,_0x1be9c5){var _0x58f31d;return db[_0x043d('0x36')]['find']({'where':{'id':_0x2a5bd1[_0x043d('0x58')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x043d('0x2c')](handleEntityNotFound(_0x3651de,null))['then'](function(_0x3b1499){if(_0x3b1499){_0x58f31d=_0x3b1499;return db[_0x043d('0x74')][_0x043d('0x4e')];}})[_0x043d('0x2c')](function(_0x3d0eb5){if(_0x3d0eb5){var _0x262b25={};var _0xf0a3d8={};_0xf0a3d8['model']=_[_0x043d('0x71')](_[_0x043d('0x3a')](_0x3d0eb5),_[_0x043d('0x35')](_0x58f31d[_0x043d('0x70')],function(_0x28b1c0){return util[_0x043d('0x75')]('cf_%d',_0x28b1c0['id']);}));_0xf0a3d8[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x2a5bd1[_0x043d('0x39')]);_0xf0a3d8[_0x043d('0x3b')]=_['intersection'](_0xf0a3d8[_0x043d('0x38')],_0xf0a3d8['query']);_0x262b25[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0xf0a3d8[_0x043d('0x38')],qs['fields'](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x3e')]));_0x262b25[_0x043d('0x3d')]=_0x262b25[_0x043d('0x3d')][_0x043d('0x3f')]?_0x262b25[_0x043d('0x3d')]:_0xf0a3d8[_0x043d('0x38')];if(!_0x2a5bd1['query']['hasOwnProperty'](_0x043d('0x41'))){_0x262b25[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x2a5bd1['query']['limit']);_0x262b25['offset']=qs[_0x043d('0x42')](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x42')]);}_0x262b25['order']=qs['sort'](_0x2a5bd1[_0x043d('0x39')][_0x043d('0x44')]);_0x262b25[_0x043d('0x45')]=qs['filters'](_[_0x043d('0x5e')](_0x2a5bd1[_0x043d('0x39')],_0xf0a3d8[_0x043d('0x3b')]));_0x262b25['raw']=!![];if(_0x2a5bd1[_0x043d('0x39')]['filter']){_0x262b25[_0x043d('0x45')]=_[_0x043d('0x48')](_0x262b25[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x262b25[_0x043d('0x3d')],function(_0x1dfe7f){var _0x29d3e7={};_0x29d3e7[_0x1dfe7f]={'$like':'%'+_0x2a5bd1[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x29d3e7;})});}_0x262b25=_['merge']({},_0x262b25,_0x2a5bd1['options']);return _0x58f31d['getContacts'](_0x262b25);}})[_0x043d('0x2c')](function(_0x4da04e){if(!_[_0x043d('0x76')](_0x4da04e)){var _0x1ee404=toCsv(_0x4da04e);var _0x3b1d3f=Date[_0x043d('0x77')]();fs[_0x043d('0x78')](util[_0x043d('0x75')]('/tmp/list_%d_%s.csv',_0x58f31d['id'],_0x3b1d3f),_0x1ee404);_0x3651de[_0x043d('0x79')]('Content-disposition',_0x043d('0x7a')+util[_0x043d('0x75')]('list_%d_%s.csv',_0x58f31d['id'],_0x3b1d3f));_0x3651de[_0x043d('0x79')](_0x043d('0x7b'),_0x043d('0x7c'));return _0x3651de[_0x043d('0x7d')](util[_0x043d('0x75')](_0x043d('0x7e'),_0x58f31d['id'],_0x3b1d3f));}else{return _0x3651de[_0x043d('0x20')](0xcc);}})['catch'](handleError(_0x3651de,null));};exports[_0x043d('0x7f')]=function(_0x3b84e3,_0x2e07e5,_0x42bfdc){var _0xe0dea8;delete _0x3b84e3[_0x043d('0x57')]['id'];return db[_0x043d('0x36')]['findOne']({'where':{'id':_0x3b84e3[_0x043d('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e07e5,null))[_0x043d('0x2c')](function(_0x547e94){if(_0x547e94){return db[_0x043d('0x80')][_0x043d('0x81')](function(_0x3f60e6){return db[_0x043d('0x6f')][_0x043d('0x52')](_0x3b84e3[_0x043d('0x57')],{'transaction':_0x3f60e6})['then'](function(_0x552bfd){_0xe0dea8=_0x552bfd;return _0x547e94['addCustomFields'](_0x552bfd,{'transaction':_0x3f60e6});})['then'](function(){var _0x356b2d={'type':db[_0x043d('0x82')][_0x043d('0x83')],'transaction':_0x3f60e6};switch(_0x3b84e3[_0x043d('0x57')][_0x043d('0x46')]){case _0x043d('0x84'):_0x356b2d[_0x043d('0x46')]=db['Sequelize'][_0x043d('0x83')];break;case'number':_0x356b2d[_0x043d('0x46')]=db[_0x043d('0x82')][_0x043d('0x85')];break;case _0x043d('0x86'):_0x356b2d[_0x043d('0x46')]=db[_0x043d('0x82')][_0x043d('0x87')];_0x356b2d['defaultValue']=![];break;default:}return db[_0x043d('0x80')][_0x043d('0x88')][_0x043d('0x89')](_0x043d('0x8a'),util[_0x043d('0x75')](_0x043d('0x8b'),_0xe0dea8['id']),_0x356b2d);})[_0x043d('0x2c')](function(){return _0xe0dea8;});});}})[_0x043d('0x2c')](respondWithResult(_0x2e07e5,null))['catch'](handleError(_0x2e07e5,null));};exports[_0x043d('0x8c')]=function(_0x3fe7b9,_0x21f13a,_0xd2dd29){var _0x53e87e={};var _0xabc991={};var _0x265a58;var _0x45195a;return db[_0x043d('0x36')][_0x043d('0x5d')]({'where':{'id':_0x3fe7b9['params']['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x21f13a,null))[_0x043d('0x2c')](function(_0xb5498e){if(_0xb5498e){_0x265a58=_0xb5498e;_0xabc991['model']=_['keys'](db[_0x043d('0x6f')]['rawAttributes']);_0xabc991[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x3fe7b9['query']);_0xabc991[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0xabc991[_0x043d('0x38')],_0xabc991[_0x043d('0x39')]);_0x53e87e['attributes']=_[_0x043d('0x3c')](_0xabc991[_0x043d('0x38')],qs[_0x043d('0x3e')](_0x3fe7b9[_0x043d('0x39')][_0x043d('0x3e')]));_0x53e87e[_0x043d('0x3d')]=_0x53e87e[_0x043d('0x3d')]['length']?_0x53e87e['attributes']:_0xabc991[_0x043d('0x38')];_0x53e87e[_0x043d('0x43')]=qs['sort'](_0x3fe7b9[_0x043d('0x39')]['sort']);_0x53e87e[_0x043d('0x45')]=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0x3fe7b9[_0x043d('0x39')],_0xabc991[_0x043d('0x3b')]));_0x53e87e[_0x043d('0x45')]=_[_0x043d('0x48')](_0x53e87e[_0x043d('0x45')],{'$or':[{'ListId':_0xb5498e['id']},{'ListId':null}]});if(_0x3fe7b9[_0x043d('0x39')][_0x043d('0x60')]){_0x53e87e[_0x043d('0x45')]=_[_0x043d('0x48')](_0x53e87e[_0x043d('0x45')],{'$or':_[_0x043d('0x35')](_0x53e87e[_0x043d('0x3d')],function(_0x2e5d6d){var _0x16fe78={};_0x16fe78[_0x2e5d6d]={'$like':'%'+_0x3fe7b9[_0x043d('0x39')][_0x043d('0x60')]+'%'};return _0x16fe78;})});}_0x53e87e=_[_0x043d('0x48')]({},_0x53e87e,_0x3fe7b9[_0x043d('0x61')]);return db['CmCustomField'][_0x043d('0x8d')](_0x53e87e);}})[_0x043d('0x2c')](respondWithResult(_0x21f13a,null))[_0x043d('0x51')](handleError(_0x21f13a,null));};exports[_0x043d('0x8e')]=function(_0x2d653b,_0xa640f,_0x7f3a28){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x2d653b[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0xa640f,null))[_0x043d('0x2c')](function(_0x27cc5b){if(_0x27cc5b){return _0x27cc5b['addAgents'](_0x2d653b['body'][_0x043d('0x63')],_[_0x043d('0x6a')](_0x2d653b[_0x043d('0x57')],[_0x043d('0x63'),'id'])||{})['spread'](function(_0x388e45){for(var _0x342c9d=0x0;_0x342c9d<_0x2d653b[_0x043d('0x57')]['ids'][_0x043d('0x3f')];_0x342c9d+=0x1){socket['emit'](_0x043d('0x8f'),{'UserId':_0x2d653b[_0x043d('0x57')]['ids'][_0x342c9d],'CmListId':_0x2d653b[_0x043d('0x58')]['id']});}return _0x388e45;});}})[_0x043d('0x2c')](respondWithResult(_0xa640f,null))[_0x043d('0x51')](handleError(_0xa640f,null));};exports[_0x043d('0x90')]=function(_0x5cd5e3,_0x1b3ef6,_0x10ca0f){return db[_0x043d('0x36')][_0x043d('0x50')]({'where':{'id':_0x5cd5e3[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x1b3ef6,null))[_0x043d('0x2c')](function(_0x40e30b){if(_0x40e30b){return _0x40e30b[_0x043d('0x90')](_0x5cd5e3[_0x043d('0x39')]['ids'])[_0x043d('0x2c')](function(){if(_[_0x043d('0x66')](_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')])){for(var _0x1714ea=0x0;_0x1714ea<_0x5cd5e3[_0x043d('0x39')]['ids'][_0x043d('0x3f')];_0x1714ea+=0x1){socket[_0x043d('0x91')]('userCmList:remove',{'UserId':Number(_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')][_0x1714ea]),'CmListId':Number(_0x5cd5e3[_0x043d('0x58')]['id'])});}}else{socket[_0x043d('0x91')](_0x043d('0x92'),{'UserId':Number(_0x5cd5e3[_0x043d('0x39')][_0x043d('0x63')]),'CmListId':Number(_0x5cd5e3['params']['id'])});}});}})[_0x043d('0x2c')](respondWithStatusCode(_0x1b3ef6,null))[_0x043d('0x51')](handleError(_0x1b3ef6,null));};exports['getAgents']=function(_0x196c81,_0x4c7dcb,_0x143b34){var _0x30ff31={};var _0x91c303={};var _0x947fcb;var _0x5e1812;return db['CmList'][_0x043d('0x5d')]({'where':{'id':_0x196c81[_0x043d('0x58')]['id']}})[_0x043d('0x2c')](handleEntityNotFound(_0x4c7dcb,null))[_0x043d('0x2c')](function(_0x5637a6){if(_0x5637a6){_0x947fcb=_0x5637a6;_0x91c303[_0x043d('0x38')]=_[_0x043d('0x3a')](db[_0x043d('0x93')][_0x043d('0x4e')]);_0x91c303[_0x043d('0x39')]=_[_0x043d('0x3a')](_0x196c81['query']);_0x91c303[_0x043d('0x3b')]=_[_0x043d('0x3c')](_0x91c303[_0x043d('0x38')],_0x91c303[_0x043d('0x39')]);_0x30ff31[_0x043d('0x3d')]=_[_0x043d('0x3c')](_0x91c303[_0x043d('0x38')],qs['fields'](_0x196c81['query'][_0x043d('0x3e')]));_0x30ff31[_0x043d('0x3d')]=_0x30ff31[_0x043d('0x3d')][_0x043d('0x3f')]?_0x30ff31['attributes']:_0x91c303[_0x043d('0x38')];_0x30ff31['order']=qs[_0x043d('0x44')](_0x196c81[_0x043d('0x39')][_0x043d('0x44')]);_0x30ff31['where']=qs[_0x043d('0x3b')](_[_0x043d('0x5e')](_0x196c81[_0x043d('0x39')],_0x91c303[_0x043d('0x3b')]));if(_0x196c81[_0x043d('0x39')][_0x043d('0x60')]){_0x30ff31['where']=_['merge'](_0x30ff31['where'],{'$or':_[_0x043d('0x35')](_0x30ff31[_0x043d('0x3d')],function(_0x34b00e){var _0x378035={};_0x378035[_0x34b00e]={'$like':'%'+_0x196c81['query'][_0x043d('0x60')]+'%'};return _0x378035;})});}_0x30ff31=_[_0x043d('0x48')]({},_0x30ff31,_0x196c81['options']);return _0x947fcb[_0x043d('0x94')](_0x30ff31);}})[_0x043d('0x2c')](function(_0x3cd418){if(_0x3cd418){_0x5e1812=_0x3cd418['length'];if(!_0x196c81[_0x043d('0x39')][_0x043d('0x40')](_0x043d('0x41'))){_0x30ff31[_0x043d('0x25')]=qs[_0x043d('0x25')](_0x196c81[_0x043d('0x39')]['limit']);_0x30ff31[_0x043d('0x42')]=qs[_0x043d('0x42')](_0x196c81[_0x043d('0x39')]['offset']);}return _0x947fcb[_0x043d('0x94')](_0x30ff31);}})['then'](function(_0x5586ae){if(_0x5586ae){return _0x5586ae?{'count':_0x5e1812,'rows':_0x5586ae}:null;}})[_0x043d('0x2c')](respondWithResult(_0x4c7dcb,null))[_0x043d('0x51')](handleError(_0x4c7dcb,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 00c778e..d17d49a 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 _0x97f1=['update','remove','hasOwnProperty','hook','exports','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97f1,0x17f));var _0x197f=function(_0x1a58da,_0x3f9d70){_0x1a58da=_0x1a58da-0x0;var _0x542425=_0x97f1[_0x1a58da];return _0x542425;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x197f('0x0')](0x0);var events={'afterCreate':_0x197f('0x1'),'afterUpdate':_0x197f('0x2'),'afterDestroy':_0x197f('0x3')};function emitEvent(_0x18d76c){return function(_0x3783b3,_0x4d88fd,_0x53bd79){CmListEvents['emit'](_0x18d76c+':'+_0x3783b3['id'],_0x3783b3);CmListEvents['emit'](_0x18d76c,_0x3783b3);_0x53bd79(null);};}for(var e in events){if(events[_0x197f('0x4')](e)){var event=events[e];CmList[_0x197f('0x5')](e,emitEvent(event));}}module[_0x197f('0x6')]=CmListEvents; \ No newline at end of file +var _0xe491=['events','../../mysqldb','CmList','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xe491,0x75));var _0x1e49=function(_0x32e119,_0x115a82){_0x32e119=_0x32e119-0x0;var _0x428547=_0xe491[_0x32e119];return _0x428547;};'use strict';var EventEmitter=require(_0x1e49('0x0'));var CmList=require(_0x1e49('0x1'))['db'][_0x1e49('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x1e49('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e49('0x4'),'afterDestroy':_0x1e49('0x5')};function emitEvent(_0x2c3d4a){return function(_0x1ad126,_0x41c250,_0x513d25){CmListEvents['emit'](_0x2c3d4a+':'+_0x1ad126['id'],_0x1ad126);CmListEvents[_0x1e49('0x6')](_0x2c3d4a,_0x1ad126);_0x513d25(null);};}for(var e in events){if(events[_0x1e49('0x7')](e)){var event=events[e];CmList[_0x1e49('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index ea05b1a..e3cceb1 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 _0xff0e=['cm_lists','lodash','util','../../config/logger','moment','request-promise','path','./cmList.attributes','define','CmList'];(function(_0x9fd77a,_0x3ea75f){var _0x5dc4a6=function(_0x4aa0d6){while(--_0x4aa0d6){_0x9fd77a['push'](_0x9fd77a['shift']());}};_0x5dc4a6(++_0x3ea75f);}(_0xff0e,0x119));var _0xeff0=function(_0x2e74f8,_0x3ae0d1){_0x2e74f8=_0x2e74f8-0x0;var _0x2f51a1=_0xff0e[_0x2e74f8];return _0x2f51a1;};'use strict';var _=require(_0xeff0('0x0'));var util=require(_0xeff0('0x1'));var logger=require(_0xeff0('0x2'))('api');var moment=require(_0xeff0('0x3'));var BPromise=require('bluebird');var rp=require(_0xeff0('0x4'));var fs=require('fs');var path=require(_0xeff0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xeff0('0x6'));module['exports']=function(_0x361190,_0x17b797){return _0x361190[_0xeff0('0x7')](_0xeff0('0x8'),attributes,{'tableName':_0xeff0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8187=['rimraf','../../config/environment','./cmList.attributes','define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x507652,_0x58dcd8){var _0x1c3ba0=function(_0x101b7c){while(--_0x101b7c){_0x507652['push'](_0x507652['shift']());}};_0x1c3ba0(++_0x58dcd8);}(_0x8187,0x192));var _0x7818=function(_0x4a4a40,_0x422ef6){_0x4a4a40=_0x4a4a40-0x0;var _0x5befa2=_0x8187[_0x4a4a40];return _0x5befa2;};'use strict';var _=require(_0x7818('0x0'));var util=require('util');var logger=require(_0x7818('0x1'))('api');var moment=require(_0x7818('0x2'));var BPromise=require(_0x7818('0x3'));var rp=require(_0x7818('0x4'));var fs=require('fs');var path=require(_0x7818('0x5'));var rimraf=require(_0x7818('0x6'));var config=require(_0x7818('0x7'));var attributes=require(_0x7818('0x8'));module['exports']=function(_0x4b2595,_0x1fc18c){return _0x4b2595[_0x7818('0x9')](_0x7818('0xa'),attributes,{'tableName':_0x7818('0xb'),'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 1afd391..031079d 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 _0x63d9=['localhost','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x316b3e,_0x47b154){var _0x45ba95=function(_0x5e68c4){while(--_0x5e68c4){_0x316b3e['push'](_0x316b3e['shift']());}};_0x45ba95(++_0x47b154);}(_0x63d9,0x1e1));var _0x963d=function(_0x4dcf64,_0x2bc0c2){_0x4dcf64=_0x4dcf64-0x0;var _0x10bb29=_0x63d9[_0x4dcf64];return _0x10bb29;};'use strict';var _=require(_0x963d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x963d('0x1'));var fs=require('fs');var Redis=require(_0x963d('0x2'));var db=require(_0x963d('0x3'))['db'];var utils=require(_0x963d('0x4'));var logger=require(_0x963d('0x5'))(_0x963d('0x6'));var config=require(_0x963d('0x7'));var jayson=require(_0x963d('0x8'));var client=jayson[_0x963d('0x9')][_0x963d('0xa')]({'port':0x232a});config[_0x963d('0xb')]=_[_0x963d('0xc')](config[_0x963d('0xb')],{'host':_0x963d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x963d('0xb')]));require(_0x963d('0xe'))[_0x963d('0xf')](socket);function respondWithRpcPromise(_0x5b85ef,_0x18358b,_0x774200){return new BPromise(function(_0x408483,_0xf57e21){return client['request'](_0x5b85ef,_0x774200)[_0x963d('0x10')](function(_0x29c783){logger[_0x963d('0x11')](_0x963d('0x12'),_0x18358b,_0x963d('0x13'));logger[_0x963d('0x14')](_0x963d('0x15'),_0x18358b,_0x963d('0x13'),JSON['stringify'](_0x29c783));if(_0x29c783['error']){if(_0x29c783[_0x963d('0x16')][_0x963d('0x17')]===0x1f4){logger['error'](_0x963d('0x12'),_0x18358b,_0x29c783[_0x963d('0x16')]['message']);return _0xf57e21(_0x29c783[_0x963d('0x16')][_0x963d('0x18')]);}logger['error'](_0x963d('0x12'),_0x18358b,_0x29c783[_0x963d('0x16')][_0x963d('0x18')]);return _0x408483(_0x29c783[_0x963d('0x16')]['message']);}else{logger[_0x963d('0x11')](_0x963d('0x12'),_0x18358b,_0x963d('0x13'));_0x408483(_0x29c783['result']['message']);}})[_0x963d('0x19')](function(_0x3c707f){logger[_0x963d('0x16')](_0x963d('0x12'),_0x18358b,_0x3c707f);_0xf57e21(_0x3c707f);});});} \ No newline at end of file +var _0x19c2=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x13997e,_0x422dcd){var _0x26a498=function(_0x467cfd){while(--_0x467cfd){_0x13997e['push'](_0x13997e['shift']());}};_0x26a498(++_0x422dcd);}(_0x19c2,0x11e));var _0x219c=function(_0x5da730,_0x27c81c){_0x5da730=_0x5da730-0x0;var _0x459c62=_0x19c2[_0x5da730];return _0x459c62;};'use strict';var _=require(_0x219c('0x0'));var util=require('util');var moment=require(_0x219c('0x1'));var BPromise=require(_0x219c('0x2'));var rs=require(_0x219c('0x3'));var fs=require('fs');var Redis=require(_0x219c('0x4'));var db=require(_0x219c('0x5'))['db'];var utils=require(_0x219c('0x6'));var logger=require('../../config/logger')(_0x219c('0x7'));var config=require(_0x219c('0x8'));var jayson=require(_0x219c('0x9'));var client=jayson['client'][_0x219c('0xa')]({'port':0x232a});config[_0x219c('0xb')]=_[_0x219c('0xc')](config[_0x219c('0xb')],{'host':_0x219c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x219c('0xe'))[_0x219c('0xf')](socket);function respondWithRpcPromise(_0x3c8615,_0x2c803c,_0x706f53){return new BPromise(function(_0x22025c,_0xc23da6){return client[_0x219c('0x10')](_0x3c8615,_0x706f53)[_0x219c('0x11')](function(_0x5743a7){logger[_0x219c('0x12')](_0x219c('0x13'),_0x2c803c,_0x219c('0x14'));logger[_0x219c('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x2c803c,_0x219c('0x14'),JSON[_0x219c('0x16')](_0x5743a7));if(_0x5743a7[_0x219c('0x17')]){if(_0x5743a7[_0x219c('0x17')][_0x219c('0x18')]===0x1f4){logger[_0x219c('0x17')](_0x219c('0x13'),_0x2c803c,_0x5743a7[_0x219c('0x17')][_0x219c('0x19')]);return _0xc23da6(_0x5743a7['error'][_0x219c('0x19')]);}logger['error'](_0x219c('0x13'),_0x2c803c,_0x5743a7[_0x219c('0x17')][_0x219c('0x19')]);return _0x22025c(_0x5743a7[_0x219c('0x17')][_0x219c('0x19')]);}else{logger['info'](_0x219c('0x13'),_0x2c803c,'request\x20sent');_0x22025c(_0x5743a7[_0x219c('0x1a')]['message']);}})[_0x219c('0x1b')](function(_0x3f23a8){logger['error'](_0x219c('0x13'),_0x2c803c,_0x3f23a8);_0xc23da6(_0x3f23a8);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5ba443a..a994456 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 _0x38d3=['save','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x38d3,0x1a7));var _0x338d=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x38d3[_0x75f869];return _0x10af8b;};'use strict';var CmListEvents=require(_0x338d('0x0'));var events=[_0x338d('0x1'),'remove',_0x338d('0x2')];function createListener(_0x338ef5,_0x22c076){return function(_0x43ebf7){_0x22c076[_0x338d('0x3')](_0x338ef5,_0x43ebf7);};}function removeListener(_0x1c47c6,_0x2b867){return function(){CmListEvents[_0x338d('0x4')](_0x1c47c6,_0x2b867);};}exports[_0x338d('0x5')]=function(_0x4e32b4){for(var _0x2a056d=0x0,_0x2012c3=events[_0x338d('0x6')];_0x2a056d<_0x2012c3;_0x2a056d++){var _0x2b7aab=events[_0x2a056d];var _0x60eaa1=createListener(_0x338d('0x7')+_0x2b7aab,_0x4e32b4);CmListEvents['on'](_0x2b7aab,_0x60eaa1);}}; \ No newline at end of file +var _0xdbb1=['cmList:','./cmList.events','emit','removeListener','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdbb1,0x105));var _0x1dbb=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xdbb1[_0x50a0c2];return _0x5ebadd;};'use strict';var CmListEvents=require(_0x1dbb('0x0'));var events=['save','remove','update'];function createListener(_0x26adf7,_0x51e55e){return function(_0x566098){_0x51e55e[_0x1dbb('0x1')](_0x26adf7,_0x566098);};}function removeListener(_0x483e15,_0xa1e321){return function(){CmListEvents[_0x1dbb('0x2')](_0x483e15,_0xa1e321);};}exports['register']=function(_0x55df0f){for(var _0xd43ce8=0x0,_0x38259d=events[_0x1dbb('0x3')];_0xd43ce8<_0x38259d;_0xd43ce8++){var _0x7c2269=events[_0xd43ce8];var _0x5e622c=createListener(_0x1dbb('0x4')+_0x7c2269,_0x55df0f);CmListEvents['on'](_0x7c2269,_0x5e622c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index b2c9f17..cc576b0 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 39fdfa4..87638c3 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(_0x102abd,_0x4df209){var _0x2d57b9=function(_0x20ce8a){while(--_0x20ce8a){_0x102abd['push'](_0x102abd['shift']());}};_0x2d57b9(++_0x4df209);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0xdc0ba1,_0x321338){var _0x99173c=function(_0xf8b1ad){while(--_0xf8b1ad){_0xdc0ba1['push'](_0xdc0ba1['shift']());}};_0x99173c(++_0x321338);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 1960332..94e03ca 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 _0xff8f=['error','name','send','body','Condition','find','params','catch','destroy','html-pdf','eml-format','rimraf','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','status','set','apply','reject','update','then','sendStatus'];(function(_0x5f3702,_0x4e19d){var _0x1474ff=function(_0x37fe4c){while(--_0x37fe4c){_0x5f3702['push'](_0x5f3702['shift']());}};_0x1474ff(++_0x4e19d);}(_0xff8f,0xe0));var _0xfff8=function(_0x50581d,_0x360635){_0x50581d=_0x50581d-0x0;var _0x1ab5b6=_0xff8f[_0x50581d];return _0x1ab5b6;};'use strict';var pdf=require(_0xfff8('0x0'));var emlformat=require(_0xfff8('0x1'));var rimraf=require(_0xfff8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfff8('0x3'));var BPromise=require(_0xfff8('0x4'));var Mustache=require('mustache');var util=require(_0xfff8('0x5'));var path=require(_0xfff8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfff8('0x7'));var fs=require('fs');var _=require(_0xfff8('0x8'));var squel=require(_0xfff8('0x9'));var crypto=require(_0xfff8('0xa'));var jsforce=require(_0xfff8('0xb'));var deskjs=require(_0xfff8('0xc'));var toCsv=require(_0xfff8('0xd'));var querystring=require(_0xfff8('0xe'));var Papa=require(_0xfff8('0xf'));var Redis=require('ioredis');var authService=require(_0xfff8('0x10'));var qs=require(_0xfff8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfff8('0x12'));var logger=require('../../config/logger')(_0xfff8('0x13'));var utils=require('../../config/utils');var config=require(_0xfff8('0x14'));var licenseUtil=require(_0xfff8('0x15'));var db=require(_0xfff8('0x16'))['db'];function respondWithStatusCode(_0x186d23,_0x28689f){_0x28689f=_0x28689f||0xcc;return function(_0x5745b){if(_0x5745b){return _0x186d23['sendStatus'](_0x28689f);}return _0x186d23['status'](_0x28689f)[_0xfff8('0x17')]();};}function respondWithResult(_0x2d61ab,_0x5ac4a0){_0x5ac4a0=_0x5ac4a0||0xc8;return function(_0x834bee){if(_0x834bee){return _0x2d61ab['status'](_0x5ac4a0)[_0xfff8('0x18')](_0x834bee);}};}function respondWithFilteredResult(_0x5c58c4,_0xfbce95){return function(_0x20ea20){if(_0x20ea20){var _0x34a291=_0x20ea20[_0xfff8('0x19')],_0x1c8326=_0xfbce95[_0xfff8('0x1a')],_0x451b8a=_0xfbce95[_0xfff8('0x1a')]+_0xfbce95['limit'],_0x318557;if(_0x451b8a>=_0x34a291){_0x451b8a=_0x34a291;_0x318557=0xc8;}else{_0x318557=0xce;}_0x5c58c4[_0xfff8('0x1b')](_0x318557);return _0x5c58c4[_0xfff8('0x1c')]('Content-Range',_0x1c8326+'-'+_0x451b8a+'/'+_0x34a291)[_0xfff8('0x18')](_0x20ea20);}return null;};}function patchUpdates(_0x521f34){return function(_0x23d08b){try{jsonpatch[_0xfff8('0x1d')](_0x23d08b,_0x521f34,!![]);}catch(_0x49bc41){return BPromise[_0xfff8('0x1e')](_0x49bc41);}return _0x23d08b['save']();};}function saveUpdates(_0x4e49d6,_0x146127){return function(_0xe8c8ec){if(_0xe8c8ec){return _0xe8c8ec[_0xfff8('0x1f')](_0x4e49d6)[_0xfff8('0x20')](function(_0x3d5696){return _0x3d5696;});}return null;};}function removeEntity(_0x509df2,_0x22520a){return function(_0x34ad0e){if(_0x34ad0e){return _0x34ad0e['destroy']()['then'](function(){_0x509df2[_0xfff8('0x1b')](0xcc)[_0xfff8('0x17')]();});}};}function handleEntityNotFound(_0x2364ed,_0x5b11cf){return function(_0x23fdec){if(!_0x23fdec){_0x2364ed[_0xfff8('0x21')](0x194);}return _0x23fdec;};}function handleError(_0x4cf386,_0x504b89){_0x504b89=_0x504b89||0x1f4;return function(_0x1a68ac){logger[_0xfff8('0x22')](_0x1a68ac['stack']);if(_0x1a68ac[_0xfff8('0x23')]){delete _0x1a68ac[_0xfff8('0x23')];}_0x4cf386[_0xfff8('0x1b')](_0x504b89)[_0xfff8('0x24')](_0x1a68ac);};}exports[_0xfff8('0x1f')]=function(_0x243db3,_0x1507c9){if(_0x243db3[_0xfff8('0x25')]['id']){delete _0x243db3[_0xfff8('0x25')]['id'];}return db[_0xfff8('0x26')][_0xfff8('0x27')]({'where':{'id':_0x243db3[_0xfff8('0x28')]['id']}})[_0xfff8('0x20')](handleEntityNotFound(_0x1507c9,null))[_0xfff8('0x20')](saveUpdates(_0x243db3[_0xfff8('0x25')],null))[_0xfff8('0x20')](respondWithResult(_0x1507c9,null))[_0xfff8('0x29')](handleError(_0x1507c9,null));};exports[_0xfff8('0x2a')]=function(_0x17a4f2,_0x35d8b9){return db[_0xfff8('0x26')][_0xfff8('0x27')]({'where':{'id':_0x17a4f2[_0xfff8('0x28')]['id']}})[_0xfff8('0x20')](handleEntityNotFound(_0x35d8b9,null))['then'](removeEntity(_0x35d8b9,null))[_0xfff8('0x29')](handleError(_0x35d8b9,null));}; \ No newline at end of file +var _0xe76c=['save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','limit','set'];(function(_0x2fd557,_0x1acb45){var _0x5064d0=function(_0x4424ed){while(--_0x4424ed){_0x2fd557['push'](_0x2fd557['shift']());}};_0x5064d0(++_0x1acb45);}(_0xe76c,0x1ed));var _0xce76=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0xe76c[_0x1ca9e9];return _0x309f3c;};'use strict';var pdf=require(_0xce76('0x0'));var emlformat=require(_0xce76('0x1'));var rimraf=require(_0xce76('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce76('0x3'));var rp=require('request-promise');var moment=require(_0xce76('0x4'));var BPromise=require(_0xce76('0x5'));var Mustache=require(_0xce76('0x6'));var util=require('util');var path=require('path');var sox=require(_0xce76('0x7'));var csv=require(_0xce76('0x8'));var ejs=require(_0xce76('0x9'));var fs=require('fs');var _=require(_0xce76('0xa'));var squel=require('squel');var crypto=require(_0xce76('0xb'));var jsforce=require(_0xce76('0xc'));var deskjs=require(_0xce76('0xd'));var toCsv=require(_0xce76('0x8'));var querystring=require('querystring');var Papa=require(_0xce76('0xe'));var Redis=require(_0xce76('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xce76('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce76('0x11'));var logger=require(_0xce76('0x12'))(_0xce76('0x13'));var utils=require('../../config/utils');var config=require(_0xce76('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xce76('0x15'))['db'];function respondWithStatusCode(_0x4401d7,_0x23a528){_0x23a528=_0x23a528||0xcc;return function(_0x3cda83){if(_0x3cda83){return _0x4401d7['sendStatus'](_0x23a528);}return _0x4401d7[_0xce76('0x16')](_0x23a528)[_0xce76('0x17')]();};}function respondWithResult(_0x8f8220,_0x319538){_0x319538=_0x319538||0xc8;return function(_0x462675){if(_0x462675){return _0x8f8220[_0xce76('0x16')](_0x319538)[_0xce76('0x18')](_0x462675);}};}function respondWithFilteredResult(_0x3f3f91,_0x3ee1d9){return function(_0xc01ff5){if(_0xc01ff5){var _0x4bcaaa=_0xc01ff5['count'],_0x504a09=_0x3ee1d9['offset'],_0xde4c69=_0x3ee1d9['offset']+_0x3ee1d9[_0xce76('0x19')],_0x227371;if(_0xde4c69>=_0x4bcaaa){_0xde4c69=_0x4bcaaa;_0x227371=0xc8;}else{_0x227371=0xce;}_0x3f3f91[_0xce76('0x16')](_0x227371);return _0x3f3f91[_0xce76('0x1a')]('Content-Range',_0x504a09+'-'+_0xde4c69+'/'+_0x4bcaaa)[_0xce76('0x18')](_0xc01ff5);}return null;};}function patchUpdates(_0x2b8dde){return function(_0x3e837c){try{jsonpatch['apply'](_0x3e837c,_0x2b8dde,!![]);}catch(_0x50221c){return BPromise['reject'](_0x50221c);}return _0x3e837c[_0xce76('0x1b')]();};}function saveUpdates(_0x259b2a,_0x5c81b4){return function(_0x4c3a5e){if(_0x4c3a5e){return _0x4c3a5e[_0xce76('0x1c')](_0x259b2a)[_0xce76('0x1d')](function(_0x1046d4){return _0x1046d4;});}return null;};}function removeEntity(_0x5f511b,_0x3a48ca){return function(_0x2b349a){if(_0x2b349a){return _0x2b349a[_0xce76('0x1e')]()['then'](function(){_0x5f511b[_0xce76('0x16')](0xcc)[_0xce76('0x17')]();});}};}function handleEntityNotFound(_0x343d62,_0x1b5af5){return function(_0x156377){if(!_0x156377){_0x343d62['sendStatus'](0x194);}return _0x156377;};}function handleError(_0x31592e,_0x3c75ed){_0x3c75ed=_0x3c75ed||0x1f4;return function(_0x45170f){logger[_0xce76('0x1f')](_0x45170f[_0xce76('0x20')]);if(_0x45170f[_0xce76('0x21')]){delete _0x45170f[_0xce76('0x21')];}_0x31592e[_0xce76('0x16')](_0x3c75ed)[_0xce76('0x22')](_0x45170f);};}exports[_0xce76('0x1c')]=function(_0x592005,_0x3383e8){if(_0x592005[_0xce76('0x23')]['id']){delete _0x592005[_0xce76('0x23')]['id'];}return db[_0xce76('0x24')][_0xce76('0x25')]({'where':{'id':_0x592005[_0xce76('0x26')]['id']}})['then'](handleEntityNotFound(_0x3383e8,null))[_0xce76('0x1d')](saveUpdates(_0x592005['body'],null))['then'](respondWithResult(_0x3383e8,null))['catch'](handleError(_0x3383e8,null));};exports[_0xce76('0x1e')]=function(_0x516fc1,_0x50a5f3){return db['Condition'][_0xce76('0x25')]({'where':{'id':_0x516fc1['params']['id']}})[_0xce76('0x1d')](handleEntityNotFound(_0x50a5f3,null))[_0xce76('0x1d')](removeEntity(_0x50a5f3,null))[_0xce76('0x27')](handleError(_0x50a5f3,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 3454603..e0bf565 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 _0x68d3=['Condition','tools_conditions','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./condition.attributes','exports','define'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0x68d3,0x199));var _0x368d=function(_0x4f7bdf,_0xb4a8f7){_0x4f7bdf=_0x4f7bdf-0x0;var _0x2e72b2=_0x68d3[_0x4f7bdf];return _0x2e72b2;};'use strict';var _=require('lodash');var util=require(_0x368d('0x0'));var logger=require(_0x368d('0x1'))('api');var moment=require(_0x368d('0x2'));var BPromise=require(_0x368d('0x3'));var rp=require(_0x368d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x368d('0x5'));var attributes=require(_0x368d('0x6'));module[_0x368d('0x7')]=function(_0x39d3d5,_0x5360e1){return _0x39d3d5[_0x368d('0x8')](_0x368d('0x9'),attributes,{'tableName':_0x368d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f7b=['Condition','tools_conditions','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes'];(function(_0x21a59c,_0x4b3378){var _0x32c798=function(_0xabac55){while(--_0xabac55){_0x21a59c['push'](_0x21a59c['shift']());}};_0x32c798(++_0x4b3378);}(_0x2f7b,0x12b));var _0xb2f7=function(_0x41d478,_0x48dfcc){_0x41d478=_0x41d478-0x0;var _0x531c5e=_0x2f7b[_0x41d478];return _0x531c5e;};'use strict';var _=require(_0xb2f7('0x0'));var util=require(_0xb2f7('0x1'));var logger=require('../../config/logger')(_0xb2f7('0x2'));var moment=require(_0xb2f7('0x3'));var BPromise=require(_0xb2f7('0x4'));var rp=require(_0xb2f7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2f7('0x6'));var config=require(_0xb2f7('0x7'));var attributes=require(_0xb2f7('0x8'));module['exports']=function(_0xf733c2,_0x3135ce){return _0xf733c2['define'](_0xb2f7('0x9'),attributes,{'tableName':_0xb2f7('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 4952547..792f3b0 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 _0x73c9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x177f0e,_0x1ee258){var _0xcf2a13=function(_0x4de31d){while(--_0x4de31d){_0x177f0e['push'](_0x177f0e['shift']());}};_0xcf2a13(++_0x1ee258);}(_0x73c9,0x14f));var _0x973c=function(_0x2fce8c,_0x10ea42){_0x2fce8c=_0x2fce8c-0x0;var _0x4fb133=_0x73c9[_0x2fce8c];return _0x4fb133;};'use strict';var _=require(_0x973c('0x0'));var util=require(_0x973c('0x1'));var moment=require(_0x973c('0x2'));var BPromise=require(_0x973c('0x3'));var rs=require(_0x973c('0x4'));var fs=require('fs');var Redis=require(_0x973c('0x5'));var db=require(_0x973c('0x6'))['db'];var utils=require(_0x973c('0x7'));var logger=require('../../config/logger')(_0x973c('0x8'));var config=require(_0x973c('0x9'));var jayson=require(_0x973c('0xa'));var client=jayson[_0x973c('0xb')][_0x973c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7020ac,_0x41f549,_0xdff7){return new BPromise(function(_0x5ab7b6,_0x1be8da){return client['request'](_0x7020ac,_0xdff7)['then'](function(_0x31eb91){logger[_0x973c('0xd')](_0x973c('0xe'),_0x41f549,_0x973c('0xf'));logger['debug'](_0x973c('0x10'),_0x41f549,'request\x20sent',JSON['stringify'](_0x31eb91));if(_0x31eb91[_0x973c('0x11')]){if(_0x31eb91[_0x973c('0x11')][_0x973c('0x12')]===0x1f4){logger[_0x973c('0x11')](_0x973c('0xe'),_0x41f549,_0x31eb91['error'][_0x973c('0x13')]);return _0x1be8da(_0x31eb91[_0x973c('0x11')][_0x973c('0x13')]);}logger[_0x973c('0x11')](_0x973c('0xe'),_0x41f549,_0x31eb91[_0x973c('0x11')][_0x973c('0x13')]);return _0x5ab7b6(_0x31eb91[_0x973c('0x11')]['message']);}else{logger[_0x973c('0xd')](_0x973c('0xe'),_0x41f549,_0x973c('0xf'));_0x5ab7b6(_0x31eb91['result'][_0x973c('0x13')]);}})[_0x973c('0x14')](function(_0x508374){logger['error'](_0x973c('0xe'),_0x41f549,_0x508374);_0x1be8da(_0x508374);});});} \ No newline at end of file +var _0xa1ed=['info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4042a4,_0x10df88){var _0x3adbba=function(_0x41d988){while(--_0x41d988){_0x4042a4['push'](_0x4042a4['shift']());}};_0x3adbba(++_0x10df88);}(_0xa1ed,0x12e));var _0xda1e=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0xa1ed[_0x1597e2];return _0x4c8c0a;};'use strict';var _=require(_0xda1e('0x0'));var util=require('util');var moment=require(_0xda1e('0x1'));var BPromise=require(_0xda1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda1e('0x3'));var db=require(_0xda1e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda1e('0x6'));var client=jayson[_0xda1e('0x7')][_0xda1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48de5c,_0x44b149,_0x196463){return new BPromise(function(_0xf2f430,_0x711d42){return client['request'](_0x48de5c,_0x196463)[_0xda1e('0x9')](function(_0x3556c7){logger['info'](_0xda1e('0xa'),_0x44b149,_0xda1e('0xb'));logger[_0xda1e('0xc')](_0xda1e('0xd'),_0x44b149,_0xda1e('0xb'),JSON[_0xda1e('0xe')](_0x3556c7));if(_0x3556c7[_0xda1e('0xf')]){if(_0x3556c7[_0xda1e('0xf')][_0xda1e('0x10')]===0x1f4){logger[_0xda1e('0xf')](_0xda1e('0xa'),_0x44b149,_0x3556c7[_0xda1e('0xf')][_0xda1e('0x11')]);return _0x711d42(_0x3556c7['error'][_0xda1e('0x11')]);}logger[_0xda1e('0xf')]('Condition,\x20%s,\x20%s',_0x44b149,_0x3556c7[_0xda1e('0xf')]['message']);return _0xf2f430(_0x3556c7['error']['message']);}else{logger[_0xda1e('0x12')](_0xda1e('0xa'),_0x44b149,_0xda1e('0xb'));_0xf2f430(_0x3556c7[_0xda1e('0x13')][_0xda1e('0x11')]);}})['catch'](function(_0x2c8123){logger[_0xda1e('0xf')]('Condition,\x20%s,\x20%s',_0x44b149,_0x2c8123);_0x711d42(_0x2c8123);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 85970a8..65777e7 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 _0x1927=['connect-timeout','Router','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','delete','destroy','exports','multer','path'];(function(_0x552b88,_0x217051){var _0x49d7d4=function(_0x1163fa){while(--_0x1163fa){_0x552b88['push'](_0x552b88['shift']());}};_0x49d7d4(++_0x217051);}(_0x1927,0xe8));var _0x7192=function(_0xd3c1fc,_0x54e814){_0xd3c1fc=_0xd3c1fc-0x0;var _0x2735ed=_0x1927[_0xd3c1fc];return _0x2735ed;};'use strict';var multer=require(_0x7192('0x0'));var util=require('util');var path=require(_0x7192('0x1'));var timeout=require(_0x7192('0x2'));var express=require('express');var router=express[_0x7192('0x3')]();var auth=require(_0x7192('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7192('0x5'));var controller=require(_0x7192('0x6'));router[_0x7192('0x7')](_0x7192('0x8'),auth[_0x7192('0x9')](),controller['update']);router[_0x7192('0xa')]('/:id',auth[_0x7192('0x9')](),controller[_0x7192('0xb')]);module[_0x7192('0xc')]=router; \ No newline at end of file +var _0xe4b1=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0xfc0aab,_0x39ce41){var _0x1c7cd6=function(_0x4087fd){while(--_0x4087fd){_0xfc0aab['push'](_0xfc0aab['shift']());}};_0x1c7cd6(++_0x39ce41);}(_0xe4b1,0x1f0));var _0x1e4b=function(_0x3560de,_0x28b150){_0x3560de=_0x3560de-0x0;var _0x2d31c1=_0xe4b1[_0x3560de];return _0x2d31c1;};'use strict';var multer=require(_0x1e4b('0x0'));var util=require(_0x1e4b('0x1'));var path=require(_0x1e4b('0x2'));var timeout=require(_0x1e4b('0x3'));var express=require(_0x1e4b('0x4'));var router=express[_0x1e4b('0x5')]();var auth=require(_0x1e4b('0x6'));var interaction=require(_0x1e4b('0x7'));var config=require(_0x1e4b('0x8'));var controller=require(_0x1e4b('0x9'));router[_0x1e4b('0xa')](_0x1e4b('0xb'),auth[_0x1e4b('0xc')](),controller[_0x1e4b('0xd')]);router[_0x1e4b('0xe')]('/:id',auth[_0x1e4b('0xc')](),controller[_0x1e4b('0xf')]);module[_0x1e4b('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1e7192a..6cc0a02 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 _0x5735=['name','STRING','sequelize'];(function(_0x57b6f8,_0x195cae){var _0x1dbfbd=function(_0x5e56fa){while(--_0x5e56fa){_0x57b6f8['push'](_0x57b6f8['shift']());}};_0x1dbfbd(++_0x195cae);}(_0x5735,0x16a));var _0x5573=function(_0x459ee0,_0x1e950d){_0x459ee0=_0x459ee0-0x0;var _0x1b87c8=_0x5735[_0x459ee0];return _0x1b87c8;};'use strict';var Sequelize=require(_0x5573('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5573('0x1')},'description':{'type':Sequelize[_0x5573('0x2')]}}; \ No newline at end of file +var _0xbc00=['exports','name','sequelize'];(function(_0x26abc4,_0x52fbef){var _0xbfcce3=function(_0x147441){while(--_0x147441){_0x26abc4['push'](_0x26abc4['shift']());}};_0xbfcce3(++_0x52fbef);}(_0xbc00,0x107));var _0x0bc0=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0xbc00[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require(_0x0bc0('0x0'));module[_0x0bc0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0bc0('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index fe21fb6..5acd3bd 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 _0x0ef2=['model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','Dashboard','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','body','role','update','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','length','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x6465b0,_0x45653a){var _0x4884fe=function(_0x427085){while(--_0x427085){_0x6465b0['push'](_0x6465b0['shift']());}};_0x4884fe(++_0x45653a);}(_0x0ef2,0x139));var _0x20ef=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x0ef2[_0x39772f];return _0xc9edbf;};'use strict';var pdf=require(_0x20ef('0x0'));var emlformat=require(_0x20ef('0x1'));var rimraf=require(_0x20ef('0x2'));var zipdir=require(_0x20ef('0x3'));var jsonpatch=require(_0x20ef('0x4'));var rp=require('request-promise');var moment=require(_0x20ef('0x5'));var BPromise=require(_0x20ef('0x6'));var Mustache=require('mustache');var util=require(_0x20ef('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20ef('0x8'));var fs=require('fs');var _=require(_0x20ef('0x9'));var squel=require(_0x20ef('0xa'));var crypto=require(_0x20ef('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x20ef('0xc'));var Papa=require(_0x20ef('0xd'));var Redis=require(_0x20ef('0xe'));var authService=require(_0x20ef('0xf'));var qs=require(_0x20ef('0x10'));var as=require(_0x20ef('0x11'));var hardwareService=require(_0x20ef('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x20ef('0x13'));var config=require(_0x20ef('0x14'));var licenseUtil=require(_0x20ef('0x15'));var db=require(_0x20ef('0x16'))['db'];config['redis']=_[_0x20ef('0x17')](config[_0x20ef('0x18')],{'host':_0x20ef('0x19'),'port':0x18eb});var socket=require(_0x20ef('0x1a'))(new Redis(config[_0x20ef('0x18')]));require(_0x20ef('0x1b'))[_0x20ef('0x1c')](socket);function respondWithStatusCode(_0x1aa030,_0x4cbc7e){_0x4cbc7e=_0x4cbc7e||0xcc;return function(_0x57931d){if(_0x57931d){return _0x1aa030['sendStatus'](_0x4cbc7e);}return _0x1aa030[_0x20ef('0x1d')](_0x4cbc7e)['end']();};}function respondWithResult(_0x4b0928,_0x2e3a89){_0x2e3a89=_0x2e3a89||0xc8;return function(_0x4c9350){if(_0x4c9350){return _0x4b0928['status'](_0x2e3a89)[_0x20ef('0x1e')](_0x4c9350);}};}function respondWithFilteredResult(_0xa2db23,_0x50683c){return function(_0xc1e0e3){if(_0xc1e0e3){var _0x27ae08=_0xc1e0e3[_0x20ef('0x1f')],_0x35f607=_0x50683c[_0x20ef('0x20')],_0x4ba234=_0x50683c['offset']+_0x50683c[_0x20ef('0x21')],_0x5db7f2;if(_0x4ba234>=_0x27ae08){_0x4ba234=_0x27ae08;_0x5db7f2=0xc8;}else{_0x5db7f2=0xce;}_0xa2db23[_0x20ef('0x1d')](_0x5db7f2);return _0xa2db23[_0x20ef('0x22')](_0x20ef('0x23'),_0x35f607+'-'+_0x4ba234+'/'+_0x27ae08)[_0x20ef('0x1e')](_0xc1e0e3);}return null;};}function patchUpdates(_0x5e65dd){return function(_0xb7753d){try{jsonpatch[_0x20ef('0x24')](_0xb7753d,_0x5e65dd,!![]);}catch(_0x174179){return BPromise[_0x20ef('0x25')](_0x174179);}return _0xb7753d[_0x20ef('0x26')]();};}function saveUpdates(_0x4ae327,_0x20f54b){return function(_0x540d4d){if(_0x540d4d){return _0x540d4d['update'](_0x4ae327)[_0x20ef('0x27')](function(_0x27e238){return _0x27e238;});}return null;};}function removeEntity(_0x41985e,_0x532ffc){return function(_0x36173b){if(_0x36173b){return _0x36173b[_0x20ef('0x28')]()[_0x20ef('0x27')](function(){var _0x5ea921=_0x36173b[_0x20ef('0x29')]({'plain':!![]});var _0x17da2f=_0x20ef('0x2a');return db[_0x20ef('0x2b')][_0x20ef('0x28')]({'where':{'type':_0x17da2f,'resourceId':_0x5ea921['id']}})[_0x20ef('0x27')](function(){return _0x36173b;});})[_0x20ef('0x27')](function(){_0x41985e[_0x20ef('0x1d')](0xcc)[_0x20ef('0x2c')]();});}};}function handleEntityNotFound(_0x5deaa4,_0x26a8f0){return function(_0x3b79e9){if(!_0x3b79e9){_0x5deaa4[_0x20ef('0x2d')](0x194);}return _0x3b79e9;};}function handleError(_0x4a5e4c,_0x190bb6){_0x190bb6=_0x190bb6||0x1f4;return function(_0x45cbfe){logger[_0x20ef('0x2e')](_0x45cbfe[_0x20ef('0x2f')]);if(_0x45cbfe[_0x20ef('0x30')]){delete _0x45cbfe[_0x20ef('0x30')];}_0x4a5e4c['status'](_0x190bb6)['send'](_0x45cbfe);};}exports[_0x20ef('0x31')]=function(_0x35460e,_0x5ea2f8){var _0x1f49f6={},_0x216085={},_0x348a4f={'count':0x0,'rows':[]};var _0x3b70e5=_[_0x20ef('0x32')](db['Dashboard'][_0x20ef('0x33')],function(_0xe58480){return{'name':_0xe58480[_0x20ef('0x34')],'type':_0xe58480[_0x20ef('0x35')][_0x20ef('0x36')]};});_0x216085['model']=_[_0x20ef('0x32')](_0x3b70e5,'name');_0x216085[_0x20ef('0x37')]=_[_0x20ef('0x38')](_0x35460e[_0x20ef('0x37')]);_0x216085[_0x20ef('0x39')]=_[_0x20ef('0x3a')](_0x216085[_0x20ef('0x3b')],_0x216085[_0x20ef('0x37')]);_0x1f49f6[_0x20ef('0x3c')]=_['intersection'](_0x216085['model'],qs['fields'](_0x35460e[_0x20ef('0x37')][_0x20ef('0x3d')]));_0x1f49f6[_0x20ef('0x3c')]=_0x1f49f6[_0x20ef('0x3c')]['length']?_0x1f49f6[_0x20ef('0x3c')]:_0x216085['model'];if(!_0x35460e[_0x20ef('0x37')][_0x20ef('0x3e')]('nolimit')){_0x1f49f6['limit']=qs[_0x20ef('0x21')](_0x35460e['query'][_0x20ef('0x21')]);_0x1f49f6[_0x20ef('0x20')]=qs['offset'](_0x35460e[_0x20ef('0x37')][_0x20ef('0x20')]);}_0x1f49f6[_0x20ef('0x3f')]=qs[_0x20ef('0x40')](_0x35460e['query'][_0x20ef('0x40')]);_0x1f49f6['where']=qs['filters'](_[_0x20ef('0x41')](_0x35460e[_0x20ef('0x37')],_0x216085[_0x20ef('0x39')]),_0x3b70e5);if(_0x35460e[_0x20ef('0x37')][_0x20ef('0x42')]){_0x1f49f6[_0x20ef('0x43')]=_[_0x20ef('0x44')](_0x1f49f6[_0x20ef('0x43')],{'$or':_[_0x20ef('0x32')](_0x3b70e5,function(_0x474335){if(_0x474335[_0x20ef('0x35')]!=='VIRTUAL'){var _0x12fe23={};_0x12fe23[_0x474335[_0x20ef('0x30')]]={'$like':'%'+_0x35460e[_0x20ef('0x37')][_0x20ef('0x42')]+'%'};return _0x12fe23;}})});}_0x1f49f6=_[_0x20ef('0x44')]({},_0x1f49f6,_0x35460e['options']);var _0x30ae84={'where':_0x1f49f6[_0x20ef('0x43')]};return db[_0x20ef('0x45')][_0x20ef('0x1f')](_0x30ae84)[_0x20ef('0x27')](function(_0xc7aaef){_0x348a4f[_0x20ef('0x1f')]=_0xc7aaef;if(_0x35460e[_0x20ef('0x37')][_0x20ef('0x46')]){_0x1f49f6[_0x20ef('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0x20ef('0x48')](_0x1f49f6);})['then'](function(_0x233f04){_0x348a4f[_0x20ef('0x49')]=_0x233f04;return _0x348a4f;})[_0x20ef('0x27')](respondWithFilteredResult(_0x5ea2f8,_0x1f49f6))[_0x20ef('0x4a')](handleError(_0x5ea2f8,null));};exports[_0x20ef('0x4b')]=function(_0x28754b,_0x266123){var _0x155377={'raw':![],'where':{'id':_0x28754b[_0x20ef('0x4c')]['id']}},_0xdc2a04={};_0xdc2a04[_0x20ef('0x3b')]=_[_0x20ef('0x38')](db[_0x20ef('0x45')][_0x20ef('0x33')]);_0xdc2a04[_0x20ef('0x37')]=_[_0x20ef('0x38')](_0x28754b[_0x20ef('0x37')]);_0xdc2a04[_0x20ef('0x4d')]=_['intersection'](_0xdc2a04['model'],_0xdc2a04[_0x20ef('0x37')]);_0x155377['attributes']=_[_0x20ef('0x3a')](_0xdc2a04[_0x20ef('0x3b')],qs[_0x20ef('0x3d')](_0x28754b[_0x20ef('0x37')][_0x20ef('0x3d')]));_0x155377[_0x20ef('0x3c')]=_0x155377[_0x20ef('0x3c')]['length']?_0x155377[_0x20ef('0x3c')]:_0xdc2a04[_0x20ef('0x3b')];if(_0x28754b[_0x20ef('0x37')][_0x20ef('0x46')]){_0x155377['include']=[{'all':!![]}];}_0x155377=_[_0x20ef('0x44')]({},_0x155377,_0x28754b['options']);return db[_0x20ef('0x45')][_0x20ef('0x4e')](_0x155377)[_0x20ef('0x27')](handleEntityNotFound(_0x266123,null))['then'](respondWithResult(_0x266123,null))[_0x20ef('0x4a')](handleError(_0x266123,null));};exports['create']=function(_0x569488,_0xedd597){return db[_0x20ef('0x45')][_0x20ef('0x4f')](_0x569488['body'],{})[_0x20ef('0x27')](function(_0xf55f18){var _0x1ede75=_0x569488[_0x20ef('0x50')][_0x20ef('0x29')]({'plain':!![]});if(!_0x1ede75)throw new Error(_0x20ef('0x51'));if(_0x1ede75['role']===_0x20ef('0x50')){var _0x5edd01=_0xf55f18[_0x20ef('0x29')]({'plain':!![]});var _0xb04fc0='CustomDashboards';return db[_0x20ef('0x52')][_0x20ef('0x4e')]({'where':{'name':_0xb04fc0,'userProfileId':_0x1ede75[_0x20ef('0x53')]},'raw':!![]})[_0x20ef('0x27')](function(_0x43cae2){if(_0x43cae2&&_0x43cae2[_0x20ef('0x54')]===0x0){return db['UserProfileResource'][_0x20ef('0x4f')]({'name':_0x5edd01[_0x20ef('0x30')],'resourceId':_0x5edd01['id'],'type':_0x43cae2[_0x20ef('0x30')],'sectionId':_0x43cae2['id']},{})[_0x20ef('0x27')](function(){return _0xf55f18;});}else{return _0xf55f18;}})[_0x20ef('0x4a')](function(_0x26d239){logger['error'](_0x20ef('0x55'),_0x26d239);throw _0x26d239;});}return _0xf55f18;})[_0x20ef('0x27')](respondWithResult(_0xedd597,0xc9))[_0x20ef('0x4a')](handleError(_0xedd597,null));};exports[_0x20ef('0x56')]=function(_0x26e57d,_0x39d666){var _0x4b7fc9={'where':{'id':_0x26e57d[_0x20ef('0x4c')]['id']}},_0x2ad799={};_0x2ad799['model']=_[_0x20ef('0x38')](db[_0x20ef('0x45')][_0x20ef('0x33')]);_0x4b7fc9[_0x20ef('0x3c')]=_[_0x20ef('0x3a')](_0x2ad799['model'],qs[_0x20ef('0x3d')](_0x26e57d['query']['fields']));_0x4b7fc9['attributes']=_0x4b7fc9[_0x20ef('0x3c')]['length']?_0x4b7fc9[_0x20ef('0x3c')]:_0x2ad799['model'];if(_0x26e57d['query'][_0x20ef('0x46')]){_0x4b7fc9[_0x20ef('0x47')]=[{'all':!![]}];}_0x4b7fc9=_[_0x20ef('0x44')]({},_0x4b7fc9,_0x26e57d[_0x20ef('0x57')]);return db['Dashboard'][_0x20ef('0x4e')](_0x4b7fc9)[_0x20ef('0x27')](handleEntityNotFound(_0x39d666,null))[_0x20ef('0x27')](function(_0x5c54b5){if(_0x5c54b5){var _0x4880e2=_0x5c54b5[_0x20ef('0x29')]({'plain':!![]});_0x4880e2=qs[_0x20ef('0x58')](_0x4880e2,['id',_0x20ef('0x59'),_0x20ef('0x5a')]);_0x26e57d[_0x20ef('0x5b')]=_[_0x20ef('0x58')](_0x26e57d[_0x20ef('0x5b')],['id',_0x20ef('0x59'),_0x20ef('0x5a')]);return db[_0x20ef('0x45')][_0x20ef('0x4f')](_['merge'](_0x4880e2,_0x26e57d[_0x20ef('0x5b')]),{'include':_0x26e57d[_0x20ef('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x20ef('0x27')](function(_0x46a078){var _0x3892d9=_0x26e57d[_0x20ef('0x50')]['get']({'plain':!![]});if(!_0x3892d9)throw new Error(_0x20ef('0x51'));if(_0x3892d9[_0x20ef('0x5c')]===_0x20ef('0x50')){var _0x172a17=_0x46a078[_0x20ef('0x29')]({'plain':!![]});var _0x44eb47=_0x20ef('0x2a');return db[_0x20ef('0x52')][_0x20ef('0x4e')]({'where':{'name':_0x44eb47,'userProfileId':_0x3892d9[_0x20ef('0x53')]},'raw':!![]})[_0x20ef('0x27')](function(_0x18713f){if(_0x18713f&&_0x18713f['autoAssociation']===0x0){return db[_0x20ef('0x2b')]['create']({'name':_0x172a17[_0x20ef('0x30')],'resourceId':_0x172a17['id'],'type':_0x18713f['name'],'sectionId':_0x18713f['id']},{})[_0x20ef('0x27')](function(){return _0x46a078;});}else{return _0x46a078;}})[_0x20ef('0x4a')](function(_0x41e642){logger['error'](_0x20ef('0x55'),_0x41e642);throw _0x41e642;});}return _0x46a078;});}})['then'](respondWithResult(_0x39d666,0xc9))[_0x20ef('0x4a')](handleError(_0x39d666,null));};exports[_0x20ef('0x5d')]=function(_0x542ab0,_0x58e9ef){if(_0x542ab0[_0x20ef('0x5b')]['id']){delete _0x542ab0[_0x20ef('0x5b')]['id'];}return db[_0x20ef('0x45')][_0x20ef('0x4e')]({'where':{'id':_0x542ab0[_0x20ef('0x4c')]['id']}})[_0x20ef('0x27')](handleEntityNotFound(_0x58e9ef,null))[_0x20ef('0x27')](saveUpdates(_0x542ab0['body'],null))[_0x20ef('0x27')](respondWithResult(_0x58e9ef,null))[_0x20ef('0x4a')](handleError(_0x58e9ef,null));};exports[_0x20ef('0x28')]=function(_0x142b00,_0x22bf26){return db[_0x20ef('0x45')][_0x20ef('0x4e')]({'where':{'id':_0x142b00['params']['id']}})[_0x20ef('0x27')](handleEntityNotFound(_0x22bf26,null))[_0x20ef('0x27')](removeEntity(_0x22bf26,null))[_0x20ef('0x4a')](handleError(_0x22bf26,null));};function widgetAttributes(_0x31bcb1){try{switch(_0x31bcb1[_0x20ef('0x35')]){case _0x20ef('0x5e'):return[{'name':_0x20ef('0x5f'),'value':_0x31bcb1[_0x20ef('0x5f')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1['attrs'][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x61')]:undefined)||_0x20ef('0x62')}];case'custom':return[{'name':_0x20ef('0x63'),'value':_0x31bcb1[_0x20ef('0x63')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x61')]:undefined)||''}];case _0x20ef('0x64'):return[{'name':_0x20ef('0x65'),'value':_0x31bcb1['attrHourFormat']||(_0x31bcb1['attrs']&&_0x31bcb1['attrs'][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x61')]:undefined)||_0x20ef('0x66')},{'name':_0x20ef('0x67'),'value':_0x31bcb1[_0x20ef('0x67')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x1]?_0x31bcb1[_0x20ef('0x60')][0x1]['value']:undefined)||_0x20ef('0x68')},{'name':'attrFontSize','value':_0x31bcb1[_0x20ef('0x69')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x2]?_0x31bcb1['attrs'][0x2]['value']:undefined)||0xc}];case _0x20ef('0x6a'):return[{'name':'attrMetric','value':_0x31bcb1['attrMetric']||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x61')]:undefined)||_0x20ef('0x6b')},{'name':_0x20ef('0x6c'),'value':_0x31bcb1['attrVoiceQueues']||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1['attrs'][0x1]?_0x31bcb1[_0x20ef('0x60')][0x1][_0x20ef('0x61')]:undefined)||[]},{'name':_0x20ef('0x69'),'value':_0x31bcb1[_0x20ef('0x69')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x2]?_0x31bcb1['attrs'][0x2][_0x20ef('0x61')]:undefined)||0x14}];case _0x20ef('0x6d'):case'pie-chart':return[{'name':_0x20ef('0x6e'),'value':_0x31bcb1[_0x20ef('0x6e')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1['attrs'][0x0]?_0x31bcb1['attrs'][0x0]['value']:undefined)||_0x20ef('0x6b')},{'name':_0x20ef('0x6f'),'value':_0x31bcb1['attrSerie2']||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x1]?_0x31bcb1[_0x20ef('0x60')][0x1][_0x20ef('0x61')]:undefined)||null},{'name':'attrSerie3','value':_0x31bcb1[_0x20ef('0x70')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x2]?_0x31bcb1['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x31bcb1[_0x20ef('0x6c')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x3]?_0x31bcb1['attrs'][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x20ef('0x71'),'type':_0x31bcb1[_0x20ef('0x72')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x35')]:undefined)||null,'value':_0x31bcb1[_0x20ef('0x71')]||(_0x31bcb1['attrs']&&_0x31bcb1['attrs'][0x0]?_0x31bcb1[_0x20ef('0x60')][0x0][_0x20ef('0x61')]:undefined)||null},{'name':_0x20ef('0x73'),'value':_0x31bcb1[_0x20ef('0x73')]||(_0x31bcb1[_0x20ef('0x60')]&&_0x31bcb1[_0x20ef('0x60')][0x1]?_0x31bcb1['attrs'][0x1][_0x20ef('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xbf388d){logger[_0x20ef('0x2e')](_0x20ef('0x74'),JSON[_0x20ef('0x75')](_0xbf388d));return[];}}exports[_0x20ef('0x76')]=function(_0x1e58f5,_0x575f92,_0x28de71){if(_0x1e58f5['body']['id']){delete _0x1e58f5['body']['id'];}return db[_0x20ef('0x45')]['find']({'where':{'id':_0x1e58f5[_0x20ef('0x4c')]['id']}})[_0x20ef('0x27')](handleEntityNotFound(_0x575f92,null))[_0x20ef('0x27')](function(_0x35558e){if(_0x35558e){_0x1e58f5[_0x20ef('0x5b')][_0x20ef('0x77')]=_0x35558e['id'];_0x1e58f5[_0x20ef('0x5b')]['attrs']=widgetAttributes(_0x1e58f5['body']);return db[_0x20ef('0x78')][_0x20ef('0x4f')](_0x1e58f5[_0x20ef('0x5b')]);}})[_0x20ef('0x27')](respondWithResult(_0x575f92,null))[_0x20ef('0x4a')](handleError(_0x575f92,null));};exports[_0x20ef('0x79')]=function(_0x477910,_0x131287,_0x4c7fdf){var _0x5bc5ff={};var _0x32e81d={};var _0x31acfd;var _0x46ebcb;return db[_0x20ef('0x45')][_0x20ef('0x7a')]({'where':{'id':_0x477910['params']['id']}})[_0x20ef('0x27')](handleEntityNotFound(_0x131287,null))['then'](function(_0x43ff3f){if(_0x43ff3f){_0x31acfd=_0x43ff3f;_0x32e81d['model']=_[_0x20ef('0x38')](db[_0x20ef('0x78')][_0x20ef('0x33')]);_0x32e81d[_0x20ef('0x37')]=_['keys'](_0x477910[_0x20ef('0x37')]);_0x32e81d['filters']=_[_0x20ef('0x3a')](_0x32e81d[_0x20ef('0x3b')],_0x32e81d['query']);_0x5bc5ff[_0x20ef('0x3c')]=_[_0x20ef('0x3a')](_0x32e81d[_0x20ef('0x3b')],qs['fields'](_0x477910[_0x20ef('0x37')][_0x20ef('0x3d')]));_0x5bc5ff[_0x20ef('0x3c')]=_0x5bc5ff[_0x20ef('0x3c')][_0x20ef('0x7b')]?_0x5bc5ff[_0x20ef('0x3c')]:_0x32e81d['model'];_0x5bc5ff['order']=qs[_0x20ef('0x40')](_0x477910[_0x20ef('0x37')][_0x20ef('0x40')]);_0x5bc5ff[_0x20ef('0x43')]=qs[_0x20ef('0x39')](_[_0x20ef('0x41')](_0x477910[_0x20ef('0x37')],_0x32e81d[_0x20ef('0x39')]));if(_0x477910[_0x20ef('0x37')][_0x20ef('0x42')]){_0x5bc5ff[_0x20ef('0x43')]=_[_0x20ef('0x44')](_0x5bc5ff[_0x20ef('0x43')],{'$or':_['map'](_0x5bc5ff[_0x20ef('0x3c')],function(_0x381921){var _0x2cfec3={};_0x2cfec3[_0x381921]={'$like':'%'+_0x477910[_0x20ef('0x37')][_0x20ef('0x42')]+'%'};return _0x2cfec3;})});}_0x5bc5ff=_[_0x20ef('0x44')]({},_0x5bc5ff,_0x477910[_0x20ef('0x57')]);return _0x31acfd[_0x20ef('0x79')](_0x5bc5ff);}})[_0x20ef('0x27')](function(_0x4bbdf9){if(_0x4bbdf9){_0x46ebcb=_0x4bbdf9['length'];if(!_0x477910[_0x20ef('0x37')][_0x20ef('0x3e')]('nolimit')){_0x5bc5ff[_0x20ef('0x21')]=qs[_0x20ef('0x21')](_0x477910['query'][_0x20ef('0x21')]);_0x5bc5ff[_0x20ef('0x20')]=qs[_0x20ef('0x20')](_0x477910[_0x20ef('0x37')][_0x20ef('0x20')]);}return _0x31acfd['getItems'](_0x5bc5ff);}})[_0x20ef('0x27')](function(_0x1a7e6f){if(_0x1a7e6f){return _0x1a7e6f?{'count':_0x46ebcb,'rows':_0x1a7e6f}:null;}})[_0x20ef('0x27')](respondWithResult(_0x131287,null))[_0x20ef('0x4a')](handleError(_0x131287,null));}; \ No newline at end of file +var _0x420d=['count','includeAll','include','findAll','rows','catch','params','keys','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','clone','updatedAt','omit','createdAt','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','pick','getItems','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','then','get','CustomDashboards','UserProfileResource','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x3609b7,_0x532a9f){var _0x379783=function(_0x50823d){while(--_0x50823d){_0x3609b7['push'](_0x3609b7['shift']());}};_0x379783(++_0x532a9f);}(_0x420d,0xae));var _0xd420=function(_0x46801e,_0xd51eb9){_0x46801e=_0x46801e-0x0;var _0x21f830=_0x420d[_0x46801e];return _0x21f830;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd420('0x0'));var zipdir=require(_0xd420('0x1'));var jsonpatch=require(_0xd420('0x2'));var rp=require(_0xd420('0x3'));var moment=require(_0xd420('0x4'));var BPromise=require(_0xd420('0x5'));var Mustache=require(_0xd420('0x6'));var util=require(_0xd420('0x7'));var path=require(_0xd420('0x8'));var sox=require(_0xd420('0x9'));var csv=require(_0xd420('0xa'));var ejs=require(_0xd420('0xb'));var fs=require('fs');var _=require(_0xd420('0xc'));var squel=require('squel');var crypto=require(_0xd420('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd420('0xe'));var toCsv=require(_0xd420('0xa'));var querystring=require(_0xd420('0xf'));var Papa=require(_0xd420('0x10'));var Redis=require(_0xd420('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd420('0x12'));var as=require(_0xd420('0x13'));var hardwareService=require(_0xd420('0x14'));var logger=require('../../config/logger')(_0xd420('0x15'));var utils=require(_0xd420('0x16'));var config=require(_0xd420('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd420('0x18'))['db'];config[_0xd420('0x19')]=_[_0xd420('0x1a')](config[_0xd420('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xd420('0x1b'))(new Redis(config[_0xd420('0x19')]));require(_0xd420('0x1c'))[_0xd420('0x1d')](socket);function respondWithStatusCode(_0x1d672d,_0x2e533b){_0x2e533b=_0x2e533b||0xcc;return function(_0x309247){if(_0x309247){return _0x1d672d[_0xd420('0x1e')](_0x2e533b);}return _0x1d672d['status'](_0x2e533b)[_0xd420('0x1f')]();};}function respondWithResult(_0xcebc7e,_0x507f59){_0x507f59=_0x507f59||0xc8;return function(_0x419236){if(_0x419236){return _0xcebc7e[_0xd420('0x20')](_0x507f59)[_0xd420('0x21')](_0x419236);}};}function respondWithFilteredResult(_0x4b87d7,_0x58c675){return function(_0x4d82de){if(_0x4d82de){var _0x534511=_0x4d82de['count'],_0x35bfce=_0x58c675[_0xd420('0x22')],_0x414a8a=_0x58c675[_0xd420('0x22')]+_0x58c675[_0xd420('0x23')],_0x5280cd;if(_0x414a8a>=_0x534511){_0x414a8a=_0x534511;_0x5280cd=0xc8;}else{_0x5280cd=0xce;}_0x4b87d7[_0xd420('0x20')](_0x5280cd);return _0x4b87d7[_0xd420('0x24')](_0xd420('0x25'),_0x35bfce+'-'+_0x414a8a+'/'+_0x534511)['json'](_0x4d82de);}return null;};}function patchUpdates(_0x358d72){return function(_0x50d61b){try{jsonpatch[_0xd420('0x26')](_0x50d61b,_0x358d72,!![]);}catch(_0x3b6bc0){return BPromise['reject'](_0x3b6bc0);}return _0x50d61b[_0xd420('0x27')]();};}function saveUpdates(_0xb32f67,_0x309c22){return function(_0x30c073){if(_0x30c073){return _0x30c073[_0xd420('0x28')](_0xb32f67)['then'](function(_0x1cd5d1){return _0x1cd5d1;});}return null;};}function removeEntity(_0x475daa,_0x22632b){return function(_0x3ee9a1){if(_0x3ee9a1){return _0x3ee9a1[_0xd420('0x29')]()[_0xd420('0x2a')](function(){var _0x587b9c=_0x3ee9a1[_0xd420('0x2b')]({'plain':!![]});var _0xe1f219=_0xd420('0x2c');return db[_0xd420('0x2d')][_0xd420('0x29')]({'where':{'type':_0xe1f219,'resourceId':_0x587b9c['id']}})[_0xd420('0x2a')](function(){return _0x3ee9a1;});})[_0xd420('0x2a')](function(){_0x475daa[_0xd420('0x20')](0xcc)[_0xd420('0x1f')]();});}};}function handleEntityNotFound(_0x103e50,_0x15f1a4){return function(_0x63bac){if(!_0x63bac){_0x103e50[_0xd420('0x1e')](0x194);}return _0x63bac;};}function handleError(_0x27f538,_0xfb9c71){_0xfb9c71=_0xfb9c71||0x1f4;return function(_0x1c7bfa){logger['error'](_0x1c7bfa['stack']);if(_0x1c7bfa[_0xd420('0x2e')]){delete _0x1c7bfa[_0xd420('0x2e')];}_0x27f538[_0xd420('0x20')](_0xfb9c71)[_0xd420('0x2f')](_0x1c7bfa);};}exports[_0xd420('0x30')]=function(_0x55fb90,_0xdb05c3){var _0x29f193={},_0x10b405={},_0x3a547b={'count':0x0,'rows':[]};var _0x54d1a5=_[_0xd420('0x31')](db[_0xd420('0x32')][_0xd420('0x33')],function(_0x4e98d9){return{'name':_0x4e98d9[_0xd420('0x34')],'type':_0x4e98d9[_0xd420('0x35')]['key']};});_0x10b405[_0xd420('0x36')]=_['map'](_0x54d1a5,'name');_0x10b405[_0xd420('0x37')]=_['keys'](_0x55fb90['query']);_0x10b405[_0xd420('0x38')]=_[_0xd420('0x39')](_0x10b405[_0xd420('0x36')],_0x10b405[_0xd420('0x37')]);_0x29f193[_0xd420('0x3a')]=_['intersection'](_0x10b405['model'],qs[_0xd420('0x3b')](_0x55fb90[_0xd420('0x37')][_0xd420('0x3b')]));_0x29f193[_0xd420('0x3a')]=_0x29f193[_0xd420('0x3a')][_0xd420('0x3c')]?_0x29f193[_0xd420('0x3a')]:_0x10b405['model'];if(!_0x55fb90[_0xd420('0x37')][_0xd420('0x3d')](_0xd420('0x3e'))){_0x29f193[_0xd420('0x23')]=qs['limit'](_0x55fb90[_0xd420('0x37')][_0xd420('0x23')]);_0x29f193[_0xd420('0x22')]=qs[_0xd420('0x22')](_0x55fb90['query']['offset']);}_0x29f193[_0xd420('0x3f')]=qs[_0xd420('0x40')](_0x55fb90['query'][_0xd420('0x40')]);_0x29f193[_0xd420('0x41')]=qs['filters'](_['pick'](_0x55fb90[_0xd420('0x37')],_0x10b405[_0xd420('0x38')]),_0x54d1a5);if(_0x55fb90[_0xd420('0x37')][_0xd420('0x42')]){_0x29f193[_0xd420('0x41')]=_[_0xd420('0x43')](_0x29f193['where'],{'$or':_[_0xd420('0x31')](_0x54d1a5,function(_0x264159){if(_0x264159[_0xd420('0x35')]!==_0xd420('0x44')){var _0x3c6dc6={};_0x3c6dc6[_0x264159[_0xd420('0x2e')]]={'$like':'%'+_0x55fb90[_0xd420('0x37')][_0xd420('0x42')]+'%'};return _0x3c6dc6;}})});}_0x29f193=_[_0xd420('0x43')]({},_0x29f193,_0x55fb90[_0xd420('0x45')]);var _0x57051e={'where':_0x29f193[_0xd420('0x41')]};return db[_0xd420('0x32')][_0xd420('0x46')](_0x57051e)[_0xd420('0x2a')](function(_0x101319){_0x3a547b[_0xd420('0x46')]=_0x101319;if(_0x55fb90[_0xd420('0x37')][_0xd420('0x47')]){_0x29f193[_0xd420('0x48')]=[{'all':!![]}];}return db[_0xd420('0x32')][_0xd420('0x49')](_0x29f193);})[_0xd420('0x2a')](function(_0x40a240){_0x3a547b[_0xd420('0x4a')]=_0x40a240;return _0x3a547b;})[_0xd420('0x2a')](respondWithFilteredResult(_0xdb05c3,_0x29f193))[_0xd420('0x4b')](handleError(_0xdb05c3,null));};exports['show']=function(_0x396032,_0x40fa2e){var _0x2ae45d={'raw':![],'where':{'id':_0x396032[_0xd420('0x4c')]['id']}},_0x29d0ed={};_0x29d0ed[_0xd420('0x36')]=_[_0xd420('0x4d')](db[_0xd420('0x32')][_0xd420('0x33')]);_0x29d0ed[_0xd420('0x37')]=_[_0xd420('0x4d')](_0x396032[_0xd420('0x37')]);_0x29d0ed[_0xd420('0x4e')]=_['intersection'](_0x29d0ed[_0xd420('0x36')],_0x29d0ed[_0xd420('0x37')]);_0x2ae45d[_0xd420('0x3a')]=_[_0xd420('0x39')](_0x29d0ed[_0xd420('0x36')],qs[_0xd420('0x3b')](_0x396032[_0xd420('0x37')][_0xd420('0x3b')]));_0x2ae45d['attributes']=_0x2ae45d[_0xd420('0x3a')][_0xd420('0x3c')]?_0x2ae45d['attributes']:_0x29d0ed[_0xd420('0x36')];if(_0x396032[_0xd420('0x37')][_0xd420('0x47')]){_0x2ae45d[_0xd420('0x48')]=[{'all':!![]}];}_0x2ae45d=_['merge']({},_0x2ae45d,_0x396032['options']);return db[_0xd420('0x32')][_0xd420('0x4f')](_0x2ae45d)['then'](handleEntityNotFound(_0x40fa2e,null))[_0xd420('0x2a')](respondWithResult(_0x40fa2e,null))[_0xd420('0x4b')](handleError(_0x40fa2e,null));};exports[_0xd420('0x50')]=function(_0x5e6f99,_0x5906ed){return db['Dashboard'][_0xd420('0x50')](_0x5e6f99[_0xd420('0x51')],{})[_0xd420('0x2a')](function(_0x475632){var _0x2ed922=_0x5e6f99[_0xd420('0x52')][_0xd420('0x2b')]({'plain':!![]});if(!_0x2ed922)throw new Error(_0xd420('0x53'));if(_0x2ed922[_0xd420('0x54')]===_0xd420('0x52')){var _0x19ec23=_0x475632[_0xd420('0x2b')]({'plain':!![]});var _0x1cb8b4=_0xd420('0x2c');return db[_0xd420('0x55')][_0xd420('0x4f')]({'where':{'name':_0x1cb8b4,'userProfileId':_0x2ed922[_0xd420('0x56')]},'raw':!![]})[_0xd420('0x2a')](function(_0x1911b0){if(_0x1911b0&&_0x1911b0['autoAssociation']===0x0){return db[_0xd420('0x2d')][_0xd420('0x50')]({'name':_0x19ec23['name'],'resourceId':_0x19ec23['id'],'type':_0x1911b0[_0xd420('0x2e')],'sectionId':_0x1911b0['id']},{})[_0xd420('0x2a')](function(){return _0x475632;});}else{return _0x475632;}})['catch'](function(_0x55f729){logger[_0xd420('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55f729);throw _0x55f729;});}return _0x475632;})[_0xd420('0x2a')](respondWithResult(_0x5906ed,0xc9))[_0xd420('0x4b')](handleError(_0x5906ed,null));};exports[_0xd420('0x58')]=function(_0x538be0,_0x1ab66f){var _0x141352={'where':{'id':_0x538be0[_0xd420('0x4c')]['id']}},_0x17ab42={};_0x17ab42[_0xd420('0x36')]=_[_0xd420('0x4d')](db[_0xd420('0x32')][_0xd420('0x33')]);_0x141352[_0xd420('0x3a')]=_['intersection'](_0x17ab42[_0xd420('0x36')],qs['fields'](_0x538be0['query'][_0xd420('0x3b')]));_0x141352[_0xd420('0x3a')]=_0x141352[_0xd420('0x3a')][_0xd420('0x3c')]?_0x141352[_0xd420('0x3a')]:_0x17ab42[_0xd420('0x36')];if(_0x538be0[_0xd420('0x37')][_0xd420('0x47')]){_0x141352[_0xd420('0x48')]=[{'all':!![]}];}_0x141352=_['merge']({},_0x141352,_0x538be0['options']);return db[_0xd420('0x32')][_0xd420('0x4f')](_0x141352)[_0xd420('0x2a')](handleEntityNotFound(_0x1ab66f,null))[_0xd420('0x2a')](function(_0xc1effc){if(_0xc1effc){var _0x203a0d=_0xc1effc[_0xd420('0x2b')]({'plain':!![]});_0x203a0d=qs['omit'](_0x203a0d,['id','createdAt',_0xd420('0x59')]);_0x538be0[_0xd420('0x51')]=_[_0xd420('0x5a')](_0x538be0[_0xd420('0x51')],['id',_0xd420('0x5b'),_0xd420('0x59')]);return db['Dashboard'][_0xd420('0x50')](_['merge'](_0x203a0d,_0x538be0[_0xd420('0x51')]),{'include':_0x538be0['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd420('0x2a')](function(_0x2935a2){var _0x555569=_0x538be0['user']['get']({'plain':!![]});if(!_0x555569)throw new Error(_0xd420('0x53'));if(_0x555569[_0xd420('0x54')]===_0xd420('0x52')){var _0x3ffbf3=_0x2935a2[_0xd420('0x2b')]({'plain':!![]});var _0x1b43fd=_0xd420('0x2c');return db[_0xd420('0x55')][_0xd420('0x4f')]({'where':{'name':_0x1b43fd,'userProfileId':_0x555569[_0xd420('0x56')]},'raw':!![]})[_0xd420('0x2a')](function(_0x53afd1){if(_0x53afd1&&_0x53afd1[_0xd420('0x5c')]===0x0){return db[_0xd420('0x2d')]['create']({'name':_0x3ffbf3[_0xd420('0x2e')],'resourceId':_0x3ffbf3['id'],'type':_0x53afd1['name'],'sectionId':_0x53afd1['id']},{})[_0xd420('0x2a')](function(){return _0x2935a2;});}else{return _0x2935a2;}})[_0xd420('0x4b')](function(_0x3dd6c6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dd6c6);throw _0x3dd6c6;});}return _0x2935a2;});}})[_0xd420('0x2a')](respondWithResult(_0x1ab66f,0xc9))[_0xd420('0x4b')](handleError(_0x1ab66f,null));};exports[_0xd420('0x28')]=function(_0x354f2c,_0x54cc30){if(_0x354f2c[_0xd420('0x51')]['id']){delete _0x354f2c[_0xd420('0x51')]['id'];}return db[_0xd420('0x32')]['find']({'where':{'id':_0x354f2c[_0xd420('0x4c')]['id']}})[_0xd420('0x2a')](handleEntityNotFound(_0x54cc30,null))[_0xd420('0x2a')](saveUpdates(_0x354f2c['body'],null))[_0xd420('0x2a')](respondWithResult(_0x54cc30,null))[_0xd420('0x4b')](handleError(_0x54cc30,null));};exports[_0xd420('0x29')]=function(_0xf36568,_0x4d5c){return db['Dashboard'][_0xd420('0x4f')]({'where':{'id':_0xf36568[_0xd420('0x4c')]['id']}})[_0xd420('0x2a')](handleEntityNotFound(_0x4d5c,null))[_0xd420('0x2a')](removeEntity(_0x4d5c,null))[_0xd420('0x4b')](handleError(_0x4d5c,null));};function widgetAttributes(_0x2b4908){try{switch(_0x2b4908[_0xd420('0x35')]){case _0xd420('0x5d'):return[{'name':_0xd420('0x5e'),'value':_0x2b4908[_0xd420('0x5e')]||(_0x2b4908['attrs']&&_0x2b4908['attrs'][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x60')]:undefined)||_0xd420('0x61')}];case _0xd420('0x62'):return[{'name':_0xd420('0x63'),'value':_0x2b4908[_0xd420('0x63')]||(_0x2b4908['attrs']&&_0x2b4908[_0xd420('0x5f')][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x60')]:undefined)||''}];case _0xd420('0x64'):return[{'name':_0xd420('0x65'),'value':_0x2b4908['attrHourFormat']||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908['attrs'][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x60')]:undefined)||_0xd420('0x66')},{'name':_0xd420('0x67'),'value':_0x2b4908[_0xd420('0x67')]||(_0x2b4908['attrs']&&_0x2b4908[_0xd420('0x5f')][0x1]?_0x2b4908[_0xd420('0x5f')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x2b4908[_0xd420('0x68')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908[_0xd420('0x5f')][0x2]?_0x2b4908[_0xd420('0x5f')][0x2][_0xd420('0x60')]:undefined)||0xc}];case _0xd420('0x69'):return[{'name':_0xd420('0x6a'),'value':_0x2b4908[_0xd420('0x6a')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908[_0xd420('0x5f')][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x60')]:undefined)||_0xd420('0x6b')},{'name':_0xd420('0x6c'),'value':_0x2b4908[_0xd420('0x6c')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908[_0xd420('0x5f')][0x1]?_0x2b4908['attrs'][0x1][_0xd420('0x60')]:undefined)||[]},{'name':'attrFontSize','value':_0x2b4908['attrFontSize']||(_0x2b4908['attrs']&&_0x2b4908[_0xd420('0x5f')][0x2]?_0x2b4908[_0xd420('0x5f')][0x2][_0xd420('0x60')]:undefined)||0x14}];case _0xd420('0x6d'):case'pie-chart':return[{'name':'attrSerie1','value':_0x2b4908['attrSerie1']||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908['attrs'][0x0]?_0x2b4908['attrs'][0x0][_0xd420('0x60')]:undefined)||_0xd420('0x6b')},{'name':_0xd420('0x6e'),'value':_0x2b4908[_0xd420('0x6e')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908['attrs'][0x1]?_0x2b4908[_0xd420('0x5f')][0x1][_0xd420('0x60')]:undefined)||null},{'name':_0xd420('0x6f'),'value':_0x2b4908[_0xd420('0x6f')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908[_0xd420('0x5f')][0x2]?_0x2b4908[_0xd420('0x5f')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x2b4908[_0xd420('0x6c')]||(_0x2b4908['attrs']&&_0x2b4908[_0xd420('0x5f')][0x3]?_0x2b4908['attrs'][0x3][_0xd420('0x60')]:undefined)||[]}];case _0xd420('0x70'):return[{'name':_0xd420('0x71'),'type':_0x2b4908[_0xd420('0x72')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908[_0xd420('0x5f')][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x35')]:undefined)||null,'value':_0x2b4908[_0xd420('0x71')]||(_0x2b4908['attrs']&&_0x2b4908[_0xd420('0x5f')][0x0]?_0x2b4908[_0xd420('0x5f')][0x0][_0xd420('0x60')]:undefined)||null},{'name':_0xd420('0x73'),'value':_0x2b4908[_0xd420('0x73')]||(_0x2b4908[_0xd420('0x5f')]&&_0x2b4908['attrs'][0x1]?_0x2b4908[_0xd420('0x5f')][0x1][_0xd420('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x5e0a45){logger[_0xd420('0x57')](_0xd420('0x74'),JSON['stringify'](_0x5e0a45));return[];}}exports[_0xd420('0x75')]=function(_0x29baad,_0x575ea2,_0x2eaafd){if(_0x29baad['body']['id']){delete _0x29baad[_0xd420('0x51')]['id'];}return db['Dashboard'][_0xd420('0x4f')]({'where':{'id':_0x29baad[_0xd420('0x4c')]['id']}})[_0xd420('0x2a')](handleEntityNotFound(_0x575ea2,null))[_0xd420('0x2a')](function(_0x17fc97){if(_0x17fc97){_0x29baad[_0xd420('0x51')][_0xd420('0x76')]=_0x17fc97['id'];_0x29baad[_0xd420('0x51')][_0xd420('0x5f')]=widgetAttributes(_0x29baad['body']);return db[_0xd420('0x77')][_0xd420('0x50')](_0x29baad[_0xd420('0x51')]);}})[_0xd420('0x2a')](respondWithResult(_0x575ea2,null))[_0xd420('0x4b')](handleError(_0x575ea2,null));};exports['getItems']=function(_0xd28b9c,_0x4ef98a,_0x3c9046){var _0x5ef3f6={};var _0x5822cd={};var _0x2979a9;var _0x2aefe4;return db['Dashboard']['findOne']({'where':{'id':_0xd28b9c[_0xd420('0x4c')]['id']}})[_0xd420('0x2a')](handleEntityNotFound(_0x4ef98a,null))[_0xd420('0x2a')](function(_0x3c363c){if(_0x3c363c){_0x2979a9=_0x3c363c;_0x5822cd[_0xd420('0x36')]=_[_0xd420('0x4d')](db[_0xd420('0x77')][_0xd420('0x33')]);_0x5822cd[_0xd420('0x37')]=_[_0xd420('0x4d')](_0xd28b9c['query']);_0x5822cd[_0xd420('0x38')]=_[_0xd420('0x39')](_0x5822cd['model'],_0x5822cd['query']);_0x5ef3f6[_0xd420('0x3a')]=_[_0xd420('0x39')](_0x5822cd[_0xd420('0x36')],qs[_0xd420('0x3b')](_0xd28b9c[_0xd420('0x37')][_0xd420('0x3b')]));_0x5ef3f6[_0xd420('0x3a')]=_0x5ef3f6[_0xd420('0x3a')][_0xd420('0x3c')]?_0x5ef3f6[_0xd420('0x3a')]:_0x5822cd[_0xd420('0x36')];_0x5ef3f6[_0xd420('0x3f')]=qs['sort'](_0xd28b9c['query'][_0xd420('0x40')]);_0x5ef3f6[_0xd420('0x41')]=qs['filters'](_[_0xd420('0x78')](_0xd28b9c[_0xd420('0x37')],_0x5822cd['filters']));if(_0xd28b9c[_0xd420('0x37')]['filter']){_0x5ef3f6[_0xd420('0x41')]=_[_0xd420('0x43')](_0x5ef3f6[_0xd420('0x41')],{'$or':_[_0xd420('0x31')](_0x5ef3f6[_0xd420('0x3a')],function(_0x22e486){var _0x435ef5={};_0x435ef5[_0x22e486]={'$like':'%'+_0xd28b9c[_0xd420('0x37')][_0xd420('0x42')]+'%'};return _0x435ef5;})});}_0x5ef3f6=_[_0xd420('0x43')]({},_0x5ef3f6,_0xd28b9c[_0xd420('0x45')]);return _0x2979a9[_0xd420('0x79')](_0x5ef3f6);}})[_0xd420('0x2a')](function(_0x182304){if(_0x182304){_0x2aefe4=_0x182304[_0xd420('0x3c')];if(!_0xd28b9c[_0xd420('0x37')]['hasOwnProperty'](_0xd420('0x3e'))){_0x5ef3f6['limit']=qs[_0xd420('0x23')](_0xd28b9c[_0xd420('0x37')][_0xd420('0x23')]);_0x5ef3f6[_0xd420('0x22')]=qs[_0xd420('0x22')](_0xd28b9c['query'][_0xd420('0x22')]);}return _0x2979a9[_0xd420('0x79')](_0x5ef3f6);}})[_0xd420('0x2a')](function(_0x3ca965){if(_0x3ca965){return _0x3ca965?{'count':_0x2aefe4,'rows':_0x3ca965}:null;}})['then'](respondWithResult(_0x4ef98a,null))[_0xd420('0x4b')](handleError(_0x4ef98a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7c8ed8b..4d749c0 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 _0x6f45=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f45,0x1eb));var _0x56f4=function(_0xf123e6,_0x12984e){_0xf123e6=_0xf123e6-0x0;var _0x12dce7=_0x6f45[_0xf123e6];return _0x12dce7;};'use strict';var EventEmitter=require(_0x56f4('0x0'));var Dashboard=require(_0x56f4('0x1'))['db'][_0x56f4('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56f4('0x3'),'afterUpdate':_0x56f4('0x4'),'afterDestroy':_0x56f4('0x5')};function emitEvent(_0x160664){return function(_0x139661,_0x514d0a,_0xe7e219){DashboardEvents[_0x56f4('0x6')](_0x160664+':'+_0x139661['id'],_0x139661);DashboardEvents[_0x56f4('0x6')](_0x160664,_0x139661);_0xe7e219(null);};}for(var e in events){if(events[_0x56f4('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x56f4('0x8')]=DashboardEvents; \ No newline at end of file +var _0x7358=['../../mysqldb','Dashboard','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x32f3d0,_0x18caa6){var _0x3cfb65=function(_0x1b97ba){while(--_0x1b97ba){_0x32f3d0['push'](_0x32f3d0['shift']());}};_0x3cfb65(++_0x18caa6);}(_0x7358,0xfb));var _0x8735=function(_0x3067cc,_0x56c938){_0x3067cc=_0x3067cc-0x0;var _0x1b80c0=_0x7358[_0x3067cc];return _0x1b80c0;};'use strict';var EventEmitter=require(_0x8735('0x0'));var Dashboard=require(_0x8735('0x1'))['db'][_0x8735('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8735('0x3')](0x0);var events={'afterCreate':_0x8735('0x4'),'afterUpdate':_0x8735('0x5'),'afterDestroy':'remove'};function emitEvent(_0x45388e){return function(_0x43bdbb,_0x102c28,_0x54a5e7){DashboardEvents[_0x8735('0x6')](_0x45388e+':'+_0x43bdbb['id'],_0x43bdbb);DashboardEvents[_0x8735('0x6')](_0x45388e,_0x43bdbb);_0x54a5e7(null);};}for(var e in events){if(events[_0x8735('0x7')](e)){var event=events[e];Dashboard[_0x8735('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ca1fdf0..a640021 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 _0xf9dd=['Dashboard','dashboards','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x3ec501,_0x1d035a){var _0x5a3037=function(_0x383d66){while(--_0x383d66){_0x3ec501['push'](_0x3ec501['shift']());}};_0x5a3037(++_0x1d035a);}(_0xf9dd,0xdf));var _0xdf9d=function(_0x44f874,_0x41e5cf){_0x44f874=_0x44f874-0x0;var _0x3fa000=_0xf9dd[_0x44f874];return _0x3fa000;};'use strict';var _=require(_0xdf9d('0x0'));var util=require(_0xdf9d('0x1'));var logger=require('../../config/logger')(_0xdf9d('0x2'));var moment=require(_0xdf9d('0x3'));var BPromise=require(_0xdf9d('0x4'));var rp=require(_0xdf9d('0x5'));var fs=require('fs');var path=require(_0xdf9d('0x6'));var rimraf=require('rimraf');var config=require(_0xdf9d('0x7'));var attributes=require(_0xdf9d('0x8'));module[_0xdf9d('0x9')]=function(_0x16bd4e,_0x99c6d3){return _0x16bd4e[_0xdf9d('0xa')](_0xdf9d('0xb'),attributes,{'tableName':_0xdf9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5a1=['define','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5a1,0x12e));var _0x1e5a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xe5a1[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0x1e5a('0x0'));var logger=require(_0x1e5a('0x1'))(_0x1e5a('0x2'));var moment=require(_0x1e5a('0x3'));var BPromise=require(_0x1e5a('0x4'));var rp=require(_0x1e5a('0x5'));var fs=require('fs');var path=require(_0x1e5a('0x6'));var rimraf=require('rimraf');var config=require(_0x1e5a('0x7'));var attributes=require(_0x1e5a('0x8'));module[_0x1e5a('0x9')]=function(_0x1081b7,_0x59bfe0){return _0x1081b7[_0x1e5a('0xa')]('Dashboard',attributes,{'tableName':_0x1e5a('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 885f36a..44ceb31 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 _0x46c9=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4fd09d,_0x2b1f3f){var _0x239cd4=function(_0x172987){while(--_0x172987){_0x4fd09d['push'](_0x4fd09d['shift']());}};_0x239cd4(++_0x2b1f3f);}(_0x46c9,0x14d));var _0x946c=function(_0x3253f3,_0x1c57d8){_0x3253f3=_0x3253f3-0x0;var _0x598c26=_0x46c9[_0x3253f3];return _0x598c26;};'use strict';var _=require('lodash');var util=require(_0x946c('0x0'));var moment=require(_0x946c('0x1'));var BPromise=require(_0x946c('0x2'));var rs=require(_0x946c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x946c('0x4'))['db'];var utils=require(_0x946c('0x5'));var logger=require(_0x946c('0x6'))(_0x946c('0x7'));var config=require(_0x946c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x946c('0x9')][_0x946c('0xa')]({'port':0x232a});config[_0x946c('0xb')]=_[_0x946c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x946c('0xd'))(new Redis(config['redis']));require(_0x946c('0xe'))[_0x946c('0xf')](socket);function respondWithRpcPromise(_0xd75b9a,_0x273e2e,_0x1ff468){return new BPromise(function(_0x5917d3,_0x3ae33c){return client['request'](_0xd75b9a,_0x1ff468)[_0x946c('0x10')](function(_0x280000){logger[_0x946c('0x11')](_0x946c('0x12'),_0x273e2e,'request\x20sent');logger['debug'](_0x946c('0x13'),_0x273e2e,_0x946c('0x14'),JSON[_0x946c('0x15')](_0x280000));if(_0x280000[_0x946c('0x16')]){if(_0x280000[_0x946c('0x16')][_0x946c('0x17')]===0x1f4){logger['error'](_0x946c('0x12'),_0x273e2e,_0x280000[_0x946c('0x16')]['message']);return _0x3ae33c(_0x280000[_0x946c('0x16')][_0x946c('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x273e2e,_0x280000[_0x946c('0x16')]['message']);return _0x5917d3(_0x280000[_0x946c('0x16')][_0x946c('0x18')]);}else{logger[_0x946c('0x11')]('Dashboard,\x20%s,\x20%s',_0x273e2e,_0x946c('0x14'));_0x5917d3(_0x280000[_0x946c('0x19')]['message']);}})['catch'](function(_0x1fbda1){logger[_0x946c('0x16')]('Dashboard,\x20%s,\x20%s',_0x273e2e,_0x1fbda1);_0x3ae33c(_0x1fbda1);});});} \ No newline at end of file +var _0x884a=['./dashboard.socket','request','info','request\x20sent','debug','stringify','error','code','Dashboard,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x884a,0x1f2));var _0xa884=function(_0x3bbc73,_0xc9c62d){_0x3bbc73=_0x3bbc73-0x0;var _0x545844=_0x884a[_0x3bbc73];return _0x545844;};'use strict';var _=require(_0xa884('0x0'));var util=require(_0xa884('0x1'));var moment=require('moment');var BPromise=require(_0xa884('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa884('0x3'));var db=require(_0xa884('0x4'))['db'];var utils=require(_0xa884('0x5'));var logger=require(_0xa884('0x6'))(_0xa884('0x7'));var config=require(_0xa884('0x8'));var jayson=require(_0xa884('0x9'));var client=jayson[_0xa884('0xa')][_0xa884('0xb')]({'port':0x232a});config[_0xa884('0xc')]=_[_0xa884('0xd')](config[_0xa884('0xc')],{'host':_0xa884('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa884('0xf'))['register'](socket);function respondWithRpcPromise(_0x1849fc,_0x582ad7,_0x23afdc){return new BPromise(function(_0x4b2f3a,_0x1dc5db){return client[_0xa884('0x10')](_0x1849fc,_0x23afdc)['then'](function(_0x2471bd){logger[_0xa884('0x11')]('Dashboard,\x20%s,\x20%s',_0x582ad7,_0xa884('0x12'));logger[_0xa884('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x582ad7,_0xa884('0x12'),JSON[_0xa884('0x14')](_0x2471bd));if(_0x2471bd['error']){if(_0x2471bd[_0xa884('0x15')][_0xa884('0x16')]===0x1f4){logger[_0xa884('0x15')](_0xa884('0x17'),_0x582ad7,_0x2471bd[_0xa884('0x15')]['message']);return _0x1dc5db(_0x2471bd['error'][_0xa884('0x18')]);}logger[_0xa884('0x15')](_0xa884('0x17'),_0x582ad7,_0x2471bd[_0xa884('0x15')][_0xa884('0x18')]);return _0x4b2f3a(_0x2471bd[_0xa884('0x15')][_0xa884('0x18')]);}else{logger['info'](_0xa884('0x17'),_0x582ad7,_0xa884('0x12'));_0x4b2f3a(_0x2471bd[_0xa884('0x19')][_0xa884('0x18')]);}})[_0xa884('0x1a')](function(_0x23600e){logger[_0xa884('0x15')](_0xa884('0x17'),_0x582ad7,_0x23600e);_0x1dc5db(_0x23600e);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index fc4f3dd..0e907a3 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 _0xc0d6=['removeListener','length','dashboard:','remove','emit'];(function(_0x5f0189,_0x25cfef){var _0x4d6237=function(_0x12aeca){while(--_0x12aeca){_0x5f0189['push'](_0x5f0189['shift']());}};_0x4d6237(++_0x25cfef);}(_0xc0d6,0xa8));var _0x6c0d=function(_0x321169,_0x440710){_0x321169=_0x321169-0x0;var _0x2bf905=_0xc0d6[_0x321169];return _0x2bf905;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0x6c0d('0x0'),'update'];function createListener(_0x471824,_0x5f416a){return function(_0x1e63bf){_0x5f416a[_0x6c0d('0x1')](_0x471824,_0x1e63bf);};}function removeListener(_0x4e4868,_0x3ceb0e){return function(){DashboardEvents[_0x6c0d('0x2')](_0x4e4868,_0x3ceb0e);};}exports['register']=function(_0x15db33){for(var _0x31463e=0x0,_0x3c4c0d=events[_0x6c0d('0x3')];_0x31463e<_0x3c4c0d;_0x31463e++){var _0x3c2a6d=events[_0x31463e];var _0x46bc77=createListener(_0x6c0d('0x4')+_0x3c2a6d,_0x15db33);DashboardEvents['on'](_0x3c2a6d,_0x46bc77);}}; \ No newline at end of file +var _0x77ab=['save','remove','removeListener','register','length'];(function(_0x4dbd3f,_0x2b9620){var _0x52a336=function(_0x4c5a79){while(--_0x4c5a79){_0x4dbd3f['push'](_0x4dbd3f['shift']());}};_0x52a336(++_0x2b9620);}(_0x77ab,0x14f));var _0xb77a=function(_0x50db2c,_0x1e01dc){_0x50db2c=_0x50db2c-0x0;var _0x12ac17=_0x77ab[_0x50db2c];return _0x12ac17;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xb77a('0x0'),_0xb77a('0x1'),'update'];function createListener(_0x1423be,_0x1e9120){return function(_0x492974){_0x1e9120['emit'](_0x1423be,_0x492974);};}function removeListener(_0x5a9c8f,_0x40dc73){return function(){DashboardEvents[_0xb77a('0x2')](_0x5a9c8f,_0x40dc73);};}exports[_0xb77a('0x3')]=function(_0x349a2c){for(var _0x1139d1=0x0,_0x5ce3d1=events[_0xb77a('0x4')];_0x1139d1<_0x5ce3d1;_0x1139d1++){var _0x41695d=events[_0x1139d1];var _0x61ddae=createListener('dashboard:'+_0x41695d,_0x349a2c);DashboardEvents['on'](_0x41695d,_0x61ddae);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 9859a62..47306d2 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 _0xb7e7=['addItem','put','update','delete','multer','path','express','../../components/auth/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','/:id/items','getItems','post','create','/:id/clone','clone'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xb7e7[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['post'](_0x7b7e('0xd'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xe')]);router[_0x7b7e('0xb')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0x7'),auth['isAuthenticated'](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/:id',auth[_0x7b7e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f2707a9..ded9df3 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 _0xb923=['#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','stringify','INTEGER'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0xb923,0xc6));var _0x3b92=function(_0x1bf08b,_0x50894c){_0x1bf08b=_0x1bf08b-0x0;var _0x12f78d=_0xb923[_0x1bf08b];return _0x12f78d;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x3b92('0x0'));var _=require(_0x3b92('0x1'));module[_0x3b92('0x2')]={'title':{'type':Sequelize[_0x3b92('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3b92('0x4')](_0x3b92('0x5')),'get':function(){try{return JSON[_0x3b92('0x6')](this[_0x3b92('0x7')]('attrs'));}catch(_0x1a3f64){return[];}},'set':function(_0x50f1fd){try{this[_0x3b92('0x8')](_0x3b92('0x9'),JSON[_0x3b92('0xa')](_0x50f1fd));}catch(_0x115b46){this['setDataValue']('attrs',JSON[_0x3b92('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3b92('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x3b92('0xb')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x3b92('0x3')],'allowNull':![],'defaultValue':_0x3b92('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3b92('0x3')],'allowNull':![],'defaultValue':_0x3b92('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3b92('0x3')]}}; \ No newline at end of file +var _0xa694=['squel','lodash','TEXT','long','getDataValue','setDataValue','attrs','stringify','INTEGER','STRING','#ffffff','#2196f3','sequelize'];(function(_0xaa1975,_0x1c758c){var _0x240b56=function(_0x49344c){while(--_0x49344c){_0xaa1975['push'](_0xaa1975['shift']());}};_0x240b56(++_0x1c758c);}(_0xa694,0x1c6));var _0x4a69=function(_0x199fcc,_0x5b2158){_0x199fcc=_0x199fcc-0x0;var _0x3052a8=_0xa694[_0x199fcc];return _0x3052a8;};'use strict';var Sequelize=require(_0x4a69('0x0'));var squel=require(_0x4a69('0x1'));var _=require(_0x4a69('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4a69('0x3')](_0x4a69('0x4')),'get':function(){try{return JSON['parse'](this[_0x4a69('0x5')]('attrs'));}catch(_0x456622){return[];}},'set':function(_0x42b275){try{this[_0x4a69('0x6')](_0x4a69('0x7'),JSON[_0x4a69('0x8')](_0x42b275));}catch(_0x3a2f0c){this['setDataValue'](_0x4a69('0x7'),JSON[_0x4a69('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x4a69('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4a69('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4a69('0x9')]},'col':{'type':Sequelize[_0x4a69('0x9')]},'background':{'type':Sequelize[_0x4a69('0xa')],'allowNull':![],'defaultValue':_0x4a69('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4a69('0xa')],'allowNull':![],'defaultValue':_0x4a69('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4a69('0xa')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 83f66c2..da77fa4 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 _0x27be=['keys','filtears','intersection','attributes','model','includeAll','include','merge','options','DashboardItem','find','catch','destroy','type','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','error','send','show','params','rawAttributes','query'];(function(_0xe6973c,_0x157cb3){var _0x4c5def=function(_0x55429c){while(--_0x55429c){_0xe6973c['push'](_0xe6973c['shift']());}};_0x4c5def(++_0x157cb3);}(_0x27be,0x185));var _0xe27b=function(_0x20156c,_0x12e1ff){_0x20156c=_0x20156c-0x0;var _0x4cb19a=_0x27be[_0x20156c];return _0x4cb19a;};'use strict';var pdf=require(_0xe27b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe27b('0x1'));var zipdir=require(_0xe27b('0x2'));var jsonpatch=require(_0xe27b('0x3'));var rp=require(_0xe27b('0x4'));var moment=require(_0xe27b('0x5'));var BPromise=require(_0xe27b('0x6'));var Mustache=require('mustache');var util=require(_0xe27b('0x7'));var path=require(_0xe27b('0x8'));var sox=require(_0xe27b('0x9'));var csv=require(_0xe27b('0xa'));var ejs=require(_0xe27b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe27b('0xc'));var crypto=require(_0xe27b('0xd'));var jsforce=require(_0xe27b('0xe'));var deskjs=require(_0xe27b('0xf'));var toCsv=require(_0xe27b('0xa'));var querystring=require('querystring');var Papa=require(_0xe27b('0x10'));var Redis=require(_0xe27b('0x11'));var authService=require(_0xe27b('0x12'));var qs=require(_0xe27b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe27b('0x14'));var logger=require('../../config/logger')(_0xe27b('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe27b('0x16'))['db'];config[_0xe27b('0x17')]=_[_0xe27b('0x18')](config[_0xe27b('0x17')],{'host':_0xe27b('0x19'),'port':0x18eb});var socket=require(_0xe27b('0x1a'))(new Redis(config['redis']));require(_0xe27b('0x1b'))['register'](socket);function respondWithStatusCode(_0x140be7,_0x547870){_0x547870=_0x547870||0xcc;return function(_0x4f50be){if(_0x4f50be){return _0x140be7[_0xe27b('0x1c')](_0x547870);}return _0x140be7[_0xe27b('0x1d')](_0x547870)[_0xe27b('0x1e')]();};}function respondWithResult(_0x2a70e6,_0x412444){_0x412444=_0x412444||0xc8;return function(_0x4a652d){if(_0x4a652d){return _0x2a70e6[_0xe27b('0x1d')](_0x412444)[_0xe27b('0x1f')](_0x4a652d);}};}function respondWithFilteredResult(_0x562969,_0x54909d){return function(_0xe59a0e){if(_0xe59a0e){var _0x4e9126=_0xe59a0e[_0xe27b('0x20')],_0x10fdfd=_0x54909d['offset'],_0x396017=_0x54909d[_0xe27b('0x21')]+_0x54909d['limit'],_0x27d2d4;if(_0x396017>=_0x4e9126){_0x396017=_0x4e9126;_0x27d2d4=0xc8;}else{_0x27d2d4=0xce;}_0x562969['status'](_0x27d2d4);return _0x562969[_0xe27b('0x22')](_0xe27b('0x23'),_0x10fdfd+'-'+_0x396017+'/'+_0x4e9126)[_0xe27b('0x1f')](_0xe59a0e);}return null;};}function patchUpdates(_0x544d02){return function(_0x34c47){try{jsonpatch['apply'](_0x34c47,_0x544d02,!![]);}catch(_0x2486b9){return BPromise[_0xe27b('0x24')](_0x2486b9);}return _0x34c47[_0xe27b('0x25')]();};}function saveUpdates(_0x420837,_0xd96a8f){return function(_0x4afd8f){if(_0x4afd8f){return _0x4afd8f[_0xe27b('0x26')](_0x420837)[_0xe27b('0x27')](function(_0x58bd17){return _0x58bd17;});}return null;};}function removeEntity(_0x475580,_0x1b91c9){return function(_0x42c065){if(_0x42c065){return _0x42c065['destroy']()[_0xe27b('0x27')](function(){_0x475580['status'](0xcc)[_0xe27b('0x1e')]();});}};}function handleEntityNotFound(_0x24290a,_0x41dfc1){return function(_0x2a2156){if(!_0x2a2156){_0x24290a[_0xe27b('0x1c')](0x194);}return _0x2a2156;};}function handleError(_0x5af513,_0x20ce3f){_0x20ce3f=_0x20ce3f||0x1f4;return function(_0x4bf78a){logger[_0xe27b('0x28')](_0x4bf78a['stack']);if(_0x4bf78a['name']){delete _0x4bf78a['name'];}_0x5af513[_0xe27b('0x1d')](_0x20ce3f)[_0xe27b('0x29')](_0x4bf78a);};}exports[_0xe27b('0x2a')]=function(_0x264f1a,_0x4dd73b){var _0x18ef9a={'raw':![],'where':{'id':_0x264f1a[_0xe27b('0x2b')]['id']}},_0x458fa2={};_0x458fa2['model']=_['keys'](db['DashboardItem'][_0xe27b('0x2c')]);_0x458fa2[_0xe27b('0x2d')]=_[_0xe27b('0x2e')](_0x264f1a[_0xe27b('0x2d')]);_0x458fa2[_0xe27b('0x2f')]=_[_0xe27b('0x30')](_0x458fa2['model'],_0x458fa2['query']);_0x18ef9a[_0xe27b('0x31')]=_[_0xe27b('0x30')](_0x458fa2[_0xe27b('0x32')],qs['fields'](_0x264f1a[_0xe27b('0x2d')]['fields']));_0x18ef9a[_0xe27b('0x31')]=_0x18ef9a[_0xe27b('0x31')]['length']?_0x18ef9a[_0xe27b('0x31')]:_0x458fa2[_0xe27b('0x32')];if(_0x264f1a[_0xe27b('0x2d')][_0xe27b('0x33')]){_0x18ef9a[_0xe27b('0x34')]=[{'all':!![]}];}_0x18ef9a=_[_0xe27b('0x35')]({},_0x18ef9a,_0x264f1a[_0xe27b('0x36')]);return db[_0xe27b('0x37')][_0xe27b('0x38')](_0x18ef9a)['then'](handleEntityNotFound(_0x4dd73b,null))[_0xe27b('0x27')](respondWithResult(_0x4dd73b,null))[_0xe27b('0x39')](handleError(_0x4dd73b,null));};exports[_0xe27b('0x3a')]=function(_0x47c0d0,_0x1fe5e0){return db[_0xe27b('0x37')][_0xe27b('0x38')]({'where':{'id':_0x47c0d0[_0xe27b('0x2b')]['id']}})[_0xe27b('0x27')](handleEntityNotFound(_0x1fe5e0,null))[_0xe27b('0x27')](removeEntity(_0x1fe5e0,null))['catch'](handleError(_0x1fe5e0,null));};function widgetAttributes(_0x17594c){try{switch(_0x17594c[_0xe27b('0x3b')]){case'iframe':return[{'name':_0xe27b('0x3c'),'value':_0x17594c[_0xe27b('0x3c')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c['attrs'][0x0][_0xe27b('0x3e')]:undefined)||_0xe27b('0x3f')}];case _0xe27b('0x40'):return[{'name':_0xe27b('0x41'),'value':_0x17594c['attrPath']||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c[_0xe27b('0x3d')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xe27b('0x42'),'value':_0x17594c[_0xe27b('0x42')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c[_0xe27b('0x3d')][0x0][_0xe27b('0x3e')]:undefined)||_0xe27b('0x43')},{'name':_0xe27b('0x44'),'value':_0x17594c[_0xe27b('0x44')]||(_0x17594c['attrs']&&_0x17594c[_0xe27b('0x3d')][0x1]?_0x17594c['attrs'][0x1][_0xe27b('0x3e')]:undefined)||_0xe27b('0x45')},{'name':_0xe27b('0x46'),'value':_0x17594c[_0xe27b('0x46')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x2]?_0x17594c[_0xe27b('0x3d')][0x2][_0xe27b('0x3e')]:undefined)||0xc}];case _0xe27b('0x47'):return[{'name':_0xe27b('0x48'),'value':_0x17594c[_0xe27b('0x48')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c[_0xe27b('0x3d')][0x0][_0xe27b('0x3e')]:undefined)||_0xe27b('0x49')},{'name':_0xe27b('0x4a'),'value':_0x17594c[_0xe27b('0x4a')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c['attrs'][0x1]?_0x17594c['attrs'][0x1][_0xe27b('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x17594c[_0xe27b('0x46')]||(_0x17594c['attrs']&&_0x17594c['attrs'][0x2]?_0x17594c['attrs'][0x2][_0xe27b('0x3e')]:undefined)||0x14}];case _0xe27b('0x4b'):case _0xe27b('0x4c'):return[{'name':_0xe27b('0x4d'),'value':_0x17594c[_0xe27b('0x4d')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c[_0xe27b('0x3d')][0x0]['value']:undefined)||_0xe27b('0x49')},{'name':_0xe27b('0x4e'),'value':_0x17594c[_0xe27b('0x4e')]||(_0x17594c['attrs']&&_0x17594c[_0xe27b('0x3d')][0x1]?_0x17594c[_0xe27b('0x3d')][0x1][_0xe27b('0x3e')]:undefined)||null},{'name':'attrSerie3','value':_0x17594c[_0xe27b('0x4f')]||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x2]?_0x17594c[_0xe27b('0x3d')][0x2][_0xe27b('0x3e')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x17594c[_0xe27b('0x4a')]||(_0x17594c['attrs']&&_0x17594c[_0xe27b('0x3d')][0x3]?_0x17594c['attrs'][0x3][_0xe27b('0x3e')]:undefined)||[]}];case _0xe27b('0x50'):return[{'name':_0xe27b('0x51'),'type':_0x17594c['reportType']||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c[_0xe27b('0x3d')][0x0][_0xe27b('0x3b')]:undefined)||null,'value':_0x17594c[_0xe27b('0x51')]||(_0x17594c['attrs']&&_0x17594c[_0xe27b('0x3d')][0x0]?_0x17594c['attrs'][0x0][_0xe27b('0x3e')]:undefined)||null},{'name':_0xe27b('0x52'),'value':_0x17594c['attrRefresh']||(_0x17594c[_0xe27b('0x3d')]&&_0x17594c[_0xe27b('0x3d')][0x1]?_0x17594c['attrs'][0x1][_0xe27b('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x366ca6){logger[_0xe27b('0x28')](_0xe27b('0x53'),JSON[_0xe27b('0x54')](_0x366ca6));return[];}}exports[_0xe27b('0x55')]=function(_0x56e22f,_0x25fef7){if(_0x56e22f[_0xe27b('0x56')]){_0x56e22f[_0xe27b('0x56')]['attrs']=widgetAttributes(_0x56e22f[_0xe27b('0x56')]);}return db['DashboardItem']['create'](_0x56e22f[_0xe27b('0x56')],{})[_0xe27b('0x27')](respondWithResult(_0x25fef7,0xc9))['catch'](handleError(_0x25fef7,null));};exports[_0xe27b('0x26')]=function(_0x4185c4,_0x1f2389){if(_0x4185c4['body']['id']){delete _0x4185c4['body']['id'];}_0x4185c4[_0xe27b('0x56')][_0xe27b('0x3d')]=widgetAttributes(_0x4185c4['body']);return db[_0xe27b('0x37')][_0xe27b('0x38')]({'where':{'id':_0x4185c4[_0xe27b('0x2b')]['id']}})[_0xe27b('0x27')](handleEntityNotFound(_0x1f2389,null))['then'](saveUpdates(_0x4185c4[_0xe27b('0x56')],null))[_0xe27b('0x27')](respondWithResult(_0x1f2389,null))[_0xe27b('0x39')](handleError(_0x1f2389,null));}; \ No newline at end of file +var _0x460d=['DashboardItem','rawAttributes','query','filtears','intersection','model','fields','attributes','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','offset','set','Content-Range','reject','update','then','destroy','stack','name','show','params','keys'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x460d,0x80));var _0xd460=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0x460d[_0x4cfc1d];return _0x1c01a0;};'use strict';var pdf=require(_0xd460('0x0'));var emlformat=require(_0xd460('0x1'));var rimraf=require(_0xd460('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd460('0x3'));var rp=require(_0xd460('0x4'));var moment=require(_0xd460('0x5'));var BPromise=require(_0xd460('0x6'));var Mustache=require('mustache');var util=require(_0xd460('0x7'));var path=require(_0xd460('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd460('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd460('0xa'));var crypto=require('crypto');var jsforce=require(_0xd460('0xb'));var deskjs=require(_0xd460('0xc'));var toCsv=require(_0xd460('0xd'));var querystring=require('querystring');var Papa=require(_0xd460('0xe'));var Redis=require(_0xd460('0xf'));var authService=require(_0xd460('0x10'));var qs=require(_0xd460('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd460('0x12'));var logger=require('../../config/logger')(_0xd460('0x13'));var utils=require(_0xd460('0x14'));var config=require(_0xd460('0x15'));var licenseUtil=require(_0xd460('0x16'));var db=require('../../mysqldb')['db'];config[_0xd460('0x17')]=_[_0xd460('0x18')](config[_0xd460('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xd460('0x19'))(new Redis(config[_0xd460('0x17')]));require(_0xd460('0x1a'))[_0xd460('0x1b')](socket);function respondWithStatusCode(_0x593aee,_0x5c7c41){_0x5c7c41=_0x5c7c41||0xcc;return function(_0x4db8b3){if(_0x4db8b3){return _0x593aee[_0xd460('0x1c')](_0x5c7c41);}return _0x593aee['status'](_0x5c7c41)[_0xd460('0x1d')]();};}function respondWithResult(_0x2edcf7,_0x11e545){_0x11e545=_0x11e545||0xc8;return function(_0x46692d){if(_0x46692d){return _0x2edcf7[_0xd460('0x1e')](_0x11e545)[_0xd460('0x1f')](_0x46692d);}};}function respondWithFilteredResult(_0x1cb19b,_0x10a649){return function(_0xafc8d4){if(_0xafc8d4){var _0x2ee18e=_0xafc8d4['count'],_0x3c543b=_0x10a649[_0xd460('0x20')],_0x52e627=_0x10a649['offset']+_0x10a649['limit'],_0x135108;if(_0x52e627>=_0x2ee18e){_0x52e627=_0x2ee18e;_0x135108=0xc8;}else{_0x135108=0xce;}_0x1cb19b[_0xd460('0x1e')](_0x135108);return _0x1cb19b[_0xd460('0x21')](_0xd460('0x22'),_0x3c543b+'-'+_0x52e627+'/'+_0x2ee18e)[_0xd460('0x1f')](_0xafc8d4);}return null;};}function patchUpdates(_0x3d23ad){return function(_0x2146d6){try{jsonpatch['apply'](_0x2146d6,_0x3d23ad,!![]);}catch(_0x1b415a){return BPromise[_0xd460('0x23')](_0x1b415a);}return _0x2146d6['save']();};}function saveUpdates(_0x422ccf,_0x335dd6){return function(_0x2c4d9a){if(_0x2c4d9a){return _0x2c4d9a[_0xd460('0x24')](_0x422ccf)[_0xd460('0x25')](function(_0x2a9c5e){return _0x2a9c5e;});}return null;};}function removeEntity(_0x2e655f,_0x464fcd){return function(_0x202959){if(_0x202959){return _0x202959[_0xd460('0x26')]()[_0xd460('0x25')](function(){_0x2e655f[_0xd460('0x1e')](0xcc)[_0xd460('0x1d')]();});}};}function handleEntityNotFound(_0x100235,_0xd1c507){return function(_0xd7130b){if(!_0xd7130b){_0x100235[_0xd460('0x1c')](0x194);}return _0xd7130b;};}function handleError(_0xf77909,_0x3da367){_0x3da367=_0x3da367||0x1f4;return function(_0x165b01){logger['error'](_0x165b01[_0xd460('0x27')]);if(_0x165b01[_0xd460('0x28')]){delete _0x165b01['name'];}_0xf77909['status'](_0x3da367)['send'](_0x165b01);};}exports[_0xd460('0x29')]=function(_0x4c1c22,_0x1ff67c){var _0x19413e={'raw':![],'where':{'id':_0x4c1c22[_0xd460('0x2a')]['id']}},_0x5b6fec={};_0x5b6fec['model']=_[_0xd460('0x2b')](db[_0xd460('0x2c')][_0xd460('0x2d')]);_0x5b6fec[_0xd460('0x2e')]=_[_0xd460('0x2b')](_0x4c1c22[_0xd460('0x2e')]);_0x5b6fec[_0xd460('0x2f')]=_[_0xd460('0x30')](_0x5b6fec[_0xd460('0x31')],_0x5b6fec['query']);_0x19413e['attributes']=_[_0xd460('0x30')](_0x5b6fec[_0xd460('0x31')],qs[_0xd460('0x32')](_0x4c1c22['query']['fields']));_0x19413e['attributes']=_0x19413e[_0xd460('0x33')]['length']?_0x19413e[_0xd460('0x33')]:_0x5b6fec['model'];if(_0x4c1c22['query'][_0xd460('0x34')]){_0x19413e[_0xd460('0x35')]=[{'all':!![]}];}_0x19413e=_[_0xd460('0x36')]({},_0x19413e,_0x4c1c22[_0xd460('0x37')]);return db['DashboardItem'][_0xd460('0x38')](_0x19413e)[_0xd460('0x25')](handleEntityNotFound(_0x1ff67c,null))['then'](respondWithResult(_0x1ff67c,null))['catch'](handleError(_0x1ff67c,null));};exports[_0xd460('0x26')]=function(_0xd2324d,_0x2fe360){return db[_0xd460('0x2c')][_0xd460('0x38')]({'where':{'id':_0xd2324d[_0xd460('0x2a')]['id']}})[_0xd460('0x25')](handleEntityNotFound(_0x2fe360,null))[_0xd460('0x25')](removeEntity(_0x2fe360,null))[_0xd460('0x39')](handleError(_0x2fe360,null));};function widgetAttributes(_0x5a817a){try{switch(_0x5a817a[_0xd460('0x3a')]){case _0xd460('0x3b'):return[{'name':_0xd460('0x3c'),'value':_0x5a817a[_0xd460('0x3c')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x0]?_0x5a817a[_0xd460('0x3d')][0x0]['value']:undefined)||'https://'}];case _0xd460('0x3e'):return[{'name':_0xd460('0x3f'),'value':_0x5a817a[_0xd460('0x3f')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x0]?_0x5a817a[_0xd460('0x3d')][0x0][_0xd460('0x40')]:undefined)||''}];case _0xd460('0x41'):return[{'name':_0xd460('0x42'),'value':_0x5a817a[_0xd460('0x42')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a['attrs'][0x0]?_0x5a817a[_0xd460('0x3d')][0x0][_0xd460('0x40')]:undefined)||_0xd460('0x43')},{'name':'attrTimezone','value':_0x5a817a[_0xd460('0x44')]||(_0x5a817a['attrs']&&_0x5a817a[_0xd460('0x3d')][0x1]?_0x5a817a['attrs'][0x1][_0xd460('0x40')]:undefined)||_0xd460('0x45')},{'name':_0xd460('0x46'),'value':_0x5a817a[_0xd460('0x46')]||(_0x5a817a['attrs']&&_0x5a817a[_0xd460('0x3d')][0x2]?_0x5a817a[_0xd460('0x3d')][0x2][_0xd460('0x40')]:undefined)||0xc}];case _0xd460('0x47'):return[{'name':'attrMetric','value':_0x5a817a['attrMetric']||(_0x5a817a['attrs']&&_0x5a817a['attrs'][0x0]?_0x5a817a[_0xd460('0x3d')][0x0]['value']:undefined)||_0xd460('0x48')},{'name':_0xd460('0x49'),'value':_0x5a817a[_0xd460('0x49')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a['attrs'][0x1]?_0x5a817a[_0xd460('0x3d')][0x1]['value']:undefined)||[]},{'name':_0xd460('0x46'),'value':_0x5a817a['attrFontSize']||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x2]?_0x5a817a['attrs'][0x2][_0xd460('0x40')]:undefined)||0x14}];case _0xd460('0x4a'):case _0xd460('0x4b'):return[{'name':_0xd460('0x4c'),'value':_0x5a817a[_0xd460('0x4c')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x0]?_0x5a817a[_0xd460('0x3d')][0x0][_0xd460('0x40')]:undefined)||_0xd460('0x48')},{'name':_0xd460('0x4d'),'value':_0x5a817a[_0xd460('0x4d')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x1]?_0x5a817a[_0xd460('0x3d')][0x1][_0xd460('0x40')]:undefined)||null},{'name':_0xd460('0x4e'),'value':_0x5a817a[_0xd460('0x4e')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x2]?_0x5a817a[_0xd460('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5a817a[_0xd460('0x49')]||(_0x5a817a['attrs']&&_0x5a817a[_0xd460('0x3d')][0x3]?_0x5a817a[_0xd460('0x3d')][0x3]['value']:undefined)||[]}];case _0xd460('0x4f'):return[{'name':_0xd460('0x50'),'type':_0x5a817a['reportType']||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x0]?_0x5a817a[_0xd460('0x3d')][0x0][_0xd460('0x3a')]:undefined)||null,'value':_0x5a817a[_0xd460('0x50')]||(_0x5a817a['attrs']&&_0x5a817a['attrs'][0x0]?_0x5a817a[_0xd460('0x3d')][0x0][_0xd460('0x40')]:undefined)||null},{'name':'attrRefresh','value':_0x5a817a[_0xd460('0x51')]||(_0x5a817a[_0xd460('0x3d')]&&_0x5a817a[_0xd460('0x3d')][0x1]?_0x5a817a[_0xd460('0x3d')][0x1][_0xd460('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xbf6fce){logger[_0xd460('0x52')](_0xd460('0x53'),JSON['stringify'](_0xbf6fce));return[];}}exports[_0xd460('0x54')]=function(_0x52c602,_0x5364b2){if(_0x52c602['body']){_0x52c602[_0xd460('0x55')]['attrs']=widgetAttributes(_0x52c602['body']);}return db['DashboardItem'][_0xd460('0x54')](_0x52c602['body'],{})[_0xd460('0x25')](respondWithResult(_0x5364b2,0xc9))[_0xd460('0x39')](handleError(_0x5364b2,null));};exports[_0xd460('0x24')]=function(_0x4222e0,_0x29b035){if(_0x4222e0[_0xd460('0x55')]['id']){delete _0x4222e0['body']['id'];}_0x4222e0[_0xd460('0x55')][_0xd460('0x3d')]=widgetAttributes(_0x4222e0[_0xd460('0x55')]);return db[_0xd460('0x2c')][_0xd460('0x38')]({'where':{'id':_0x4222e0[_0xd460('0x2a')]['id']}})['then'](handleEntityNotFound(_0x29b035,null))['then'](saveUpdates(_0x4222e0[_0xd460('0x55')],null))[_0xd460('0x25')](respondWithResult(_0x29b035,null))[_0xd460('0x39')](handleError(_0x29b035,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 6f896d9..061bea3 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 _0xac0a=['update','remove','emit','hasOwnProperty','hook','exports','DashboardItem','setMaxListeners'];(function(_0x5c120a,_0x1a9450){var _0x2ce3e0=function(_0x68e157){while(--_0x68e157){_0x5c120a['push'](_0x5c120a['shift']());}};_0x2ce3e0(++_0x1a9450);}(_0xac0a,0x11e));var _0xaac0=function(_0x11617a,_0x5a694e){_0x11617a=_0x11617a-0x0;var _0x517b28=_0xac0a[_0x11617a];return _0x517b28;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xaac0('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xaac0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaac0('0x2'),'afterDestroy':_0xaac0('0x3')};function emitEvent(_0xb0ecd5){return function(_0x1ca4e1,_0x3ccfd9,_0x295299){DashboardItemEvents[_0xaac0('0x4')](_0xb0ecd5+':'+_0x1ca4e1['id'],_0x1ca4e1);DashboardItemEvents[_0xaac0('0x4')](_0xb0ecd5,_0x1ca4e1);_0x295299(null);};}for(var e in events){if(events[_0xaac0('0x5')](e)){var event=events[e];DashboardItem[_0xaac0('0x6')](e,emitEvent(event));}}module[_0xaac0('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x105d=['hasOwnProperty','hook','DashboardItem','setMaxListeners','save','emit'];(function(_0x5577ec,_0x58dcf5){var _0x47e778=function(_0xbed250){while(--_0xbed250){_0x5577ec['push'](_0x5577ec['shift']());}};_0x47e778(++_0x58dcf5);}(_0x105d,0x158));var _0xd105=function(_0x1c0a50,_0x5330fb){_0x1c0a50=_0x1c0a50-0x0;var _0x39d2b8=_0x105d[_0x1c0a50];return _0x39d2b8;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xd105('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd105('0x1')](0x0);var events={'afterCreate':_0xd105('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x503970){return function(_0x19f521,_0x5b5242,_0x1f7be0){DashboardItemEvents[_0xd105('0x3')](_0x503970+':'+_0x19f521['id'],_0x19f521);DashboardItemEvents['emit'](_0x503970,_0x19f521);_0x1f7be0(null);};}for(var e in events){if(events[_0xd105('0x4')](e)){var event=events[e];DashboardItem[_0xd105('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 3c0eac1..056e4f3 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 _0x2f67=['bluebird','request-promise','path','rimraf','define','DashboardItem','lodash','util','../../config/logger'];(function(_0x39d5a3,_0x2856ef){var _0x178055=function(_0xd7ba3c){while(--_0xd7ba3c){_0x39d5a3['push'](_0x39d5a3['shift']());}};_0x178055(++_0x2856ef);}(_0x2f67,0xe7));var _0x72f6=function(_0x48b841,_0x1c3e0e){_0x48b841=_0x48b841-0x0;var _0x18f64b=_0x2f67[_0x48b841];return _0x18f64b;};'use strict';var _=require(_0x72f6('0x0'));var util=require(_0x72f6('0x1'));var logger=require(_0x72f6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x72f6('0x3'));var rp=require(_0x72f6('0x4'));var fs=require('fs');var path=require(_0x72f6('0x5'));var rimraf=require(_0x72f6('0x6'));var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x2cf975,_0x549301){return _0x2cf975[_0x72f6('0x7')](_0x72f6('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cda=['moment','request-promise','path','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','util','api'];(function(_0x5c8fa5,_0xca3777){var _0x298bc7=function(_0x3144bd){while(--_0x3144bd){_0x5c8fa5['push'](_0x5c8fa5['shift']());}};_0x298bc7(++_0xca3777);}(_0x3cda,0xef));var _0xa3cd=function(_0x44543b,_0x5db79a){_0x44543b=_0x44543b-0x0;var _0x2a893f=_0x3cda[_0x44543b];return _0x2a893f;};'use strict';var _=require(_0xa3cd('0x0'));var util=require(_0xa3cd('0x1'));var logger=require('../../config/logger')(_0xa3cd('0x2'));var moment=require(_0xa3cd('0x3'));var BPromise=require('bluebird');var rp=require(_0xa3cd('0x4'));var fs=require('fs');var path=require(_0xa3cd('0x5'));var rimraf=require('rimraf');var config=require(_0xa3cd('0x6'));var attributes=require(_0xa3cd('0x7'));module['exports']=function(_0x5d803d,_0x36d073){return _0x5d803d[_0xa3cd('0x8')](_0xa3cd('0x9'),attributes,{'tableName':_0xa3cd('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 22f4aaf..7127d44 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 _0x4bd4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4bd4,0x6d));var _0x44bd=function(_0x5d09e2,_0x2a9d05){_0x5d09e2=_0x5d09e2-0x0;var _0x2c5115=_0x4bd4[_0x5d09e2];return _0x2c5115;};'use strict';var _=require(_0x44bd('0x0'));var util=require(_0x44bd('0x1'));var moment=require(_0x44bd('0x2'));var BPromise=require(_0x44bd('0x3'));var rs=require(_0x44bd('0x4'));var fs=require('fs');var Redis=require(_0x44bd('0x5'));var db=require(_0x44bd('0x6'))['db'];var utils=require(_0x44bd('0x7'));var logger=require(_0x44bd('0x8'))(_0x44bd('0x9'));var config=require(_0x44bd('0xa'));var jayson=require(_0x44bd('0xb'));var client=jayson[_0x44bd('0xc')][_0x44bd('0xd')]({'port':0x232a});config[_0x44bd('0xe')]=_[_0x44bd('0xf')](config['redis'],{'host':_0x44bd('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x44bd('0x11')](socket);function respondWithRpcPromise(_0x4a3563,_0x3eab15,_0x51cb31){return new BPromise(function(_0xbfc472,_0x15df25){return client[_0x44bd('0x12')](_0x4a3563,_0x51cb31)['then'](function(_0x142f9e){logger[_0x44bd('0x13')](_0x44bd('0x14'),_0x3eab15,_0x44bd('0x15'));logger['debug'](_0x44bd('0x16'),_0x3eab15,_0x44bd('0x15'),JSON['stringify'](_0x142f9e));if(_0x142f9e['error']){if(_0x142f9e[_0x44bd('0x17')][_0x44bd('0x18')]===0x1f4){logger[_0x44bd('0x17')](_0x44bd('0x14'),_0x3eab15,_0x142f9e['error']['message']);return _0x15df25(_0x142f9e['error'][_0x44bd('0x19')]);}logger[_0x44bd('0x17')](_0x44bd('0x14'),_0x3eab15,_0x142f9e['error'][_0x44bd('0x19')]);return _0xbfc472(_0x142f9e[_0x44bd('0x17')][_0x44bd('0x19')]);}else{logger[_0x44bd('0x13')](_0x44bd('0x14'),_0x3eab15,_0x44bd('0x15'));_0xbfc472(_0x142f9e[_0x44bd('0x1a')][_0x44bd('0x19')]);}})[_0x44bd('0x1b')](function(_0x5beeed){logger['error']('DashboardItem,\x20%s,\x20%s',_0x3eab15,_0x5beeed);_0x15df25(_0x5beeed);});});} \ No newline at end of file +var _0x5b05=['register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x213aaa,_0x52b8d6){var _0x4ac672=function(_0x171829){while(--_0x171829){_0x213aaa['push'](_0x213aaa['shift']());}};_0x4ac672(++_0x52b8d6);}(_0x5b05,0x124));var _0x55b0=function(_0x41e4e7,_0x395bf4){_0x41e4e7=_0x41e4e7-0x0;var _0x3fd5bc=_0x5b05[_0x41e4e7];return _0x3fd5bc;};'use strict';var _=require(_0x55b0('0x0'));var util=require(_0x55b0('0x1'));var moment=require(_0x55b0('0x2'));var BPromise=require(_0x55b0('0x3'));var rs=require(_0x55b0('0x4'));var fs=require('fs');var Redis=require(_0x55b0('0x5'));var db=require(_0x55b0('0x6'))['db'];var utils=require(_0x55b0('0x7'));var logger=require(_0x55b0('0x8'))(_0x55b0('0x9'));var config=require(_0x55b0('0xa'));var jayson=require(_0x55b0('0xb'));var client=jayson[_0x55b0('0xc')][_0x55b0('0xd')]({'port':0x232a});config['redis']=_[_0x55b0('0xe')](config[_0x55b0('0xf')],{'host':_0x55b0('0x10'),'port':0x18eb});var socket=require(_0x55b0('0x11'))(new Redis(config[_0x55b0('0xf')]));require('./dashboardItem.socket')[_0x55b0('0x12')](socket);function respondWithRpcPromise(_0x2e4062,_0x2c30b4,_0x37ccdf){return new BPromise(function(_0x2118f1,_0x4beeb7){return client[_0x55b0('0x13')](_0x2e4062,_0x37ccdf)[_0x55b0('0x14')](function(_0x114c0c){logger[_0x55b0('0x15')]('DashboardItem,\x20%s,\x20%s',_0x2c30b4,_0x55b0('0x16'));logger[_0x55b0('0x17')](_0x55b0('0x18'),_0x2c30b4,_0x55b0('0x16'),JSON[_0x55b0('0x19')](_0x114c0c));if(_0x114c0c[_0x55b0('0x1a')]){if(_0x114c0c['error'][_0x55b0('0x1b')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x2c30b4,_0x114c0c[_0x55b0('0x1a')]['message']);return _0x4beeb7(_0x114c0c[_0x55b0('0x1a')][_0x55b0('0x1c')]);}logger[_0x55b0('0x1a')](_0x55b0('0x1d'),_0x2c30b4,_0x114c0c[_0x55b0('0x1a')]['message']);return _0x2118f1(_0x114c0c[_0x55b0('0x1a')][_0x55b0('0x1c')]);}else{logger[_0x55b0('0x15')](_0x55b0('0x1d'),_0x2c30b4,_0x55b0('0x16'));_0x2118f1(_0x114c0c[_0x55b0('0x1e')][_0x55b0('0x1c')]);}})['catch'](function(_0x337e96){logger[_0x55b0('0x1a')](_0x55b0('0x1d'),_0x2c30b4,_0x337e96);_0x4beeb7(_0x337e96);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6addf21..aec8403 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 _0x90e3=['length','dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x480d07,_0x523781){var _0x8f315=function(_0x3e5555){while(--_0x3e5555){_0x480d07['push'](_0x480d07['shift']());}};_0x8f315(++_0x523781);}(_0x90e3,0x132));var _0x390e=function(_0x28e7e1,_0x45f235){_0x28e7e1=_0x28e7e1-0x0;var _0x1d8a9e=_0x90e3[_0x28e7e1];return _0x1d8a9e;};'use strict';var DashboardItemEvents=require(_0x390e('0x0'));var events=[_0x390e('0x1'),_0x390e('0x2'),'update'];function createListener(_0x6a91e2,_0x307c78){return function(_0x6b245a){_0x307c78[_0x390e('0x3')](_0x6a91e2,_0x6b245a);};}function removeListener(_0x266135,_0x105591){return function(){DashboardItemEvents[_0x390e('0x4')](_0x266135,_0x105591);};}exports[_0x390e('0x5')]=function(_0x1cc228){for(var _0x1c3f2f=0x0,_0x30d5cf=events[_0x390e('0x6')];_0x1c3f2f<_0x30d5cf;_0x1c3f2f++){var _0x37c7e7=events[_0x1c3f2f];var _0x20fadd=createListener(_0x390e('0x7')+_0x37c7e7,_0x1cc228);DashboardItemEvents['on'](_0x37c7e7,_0x20fadd);}}; \ No newline at end of file +var _0x80e2=['dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener','register'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x80e2,0xfd));var _0x280e=function(_0x5d07ff,_0x1f976f){_0x5d07ff=_0x5d07ff-0x0;var _0x5226ad=_0x80e2[_0x5d07ff];return _0x5226ad;};'use strict';var DashboardItemEvents=require(_0x280e('0x0'));var events=[_0x280e('0x1'),_0x280e('0x2'),'update'];function createListener(_0x300c0c,_0xd8c6e1){return function(_0x988380){_0xd8c6e1[_0x280e('0x3')](_0x300c0c,_0x988380);};}function removeListener(_0x3bb383,_0x540638){return function(){DashboardItemEvents[_0x280e('0x4')](_0x3bb383,_0x540638);};}exports[_0x280e('0x5')]=function(_0x38ff84){for(var _0x3b29ea=0x0,_0x5cca86=events['length'];_0x3b29ea<_0x5cca86;_0x3b29ea++){var _0xa6c88=events[_0x3b29ea];var _0xd3dd83=createListener(_0x280e('0x6')+_0xa6c88,_0x38ff84);DashboardItemEvents['on'](_0xa6c88,_0xd3dd83);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a844c7c..a99eef7 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 _0x53ec=['../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2830a4,_0x247028){var _0x4c4c45=function(_0x1c41c3){while(--_0x1c41c3){_0x2830a4['push'](_0x2830a4['shift']());}};_0x4c4c45(++_0x247028);}(_0x53ec,0x192));var _0xc53e=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0x53ec[_0x2c7f80];return _0x11fe38;};'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')]('/:id',auth[_0xc53e('0x9')](),controller['show']);router[_0xc53e('0xa')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0xb')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xc'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xf')]);module[_0xc53e('0x10')]=router; \ No newline at end of file +var _0x814b=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put'];(function(_0x389fb0,_0x336316){var _0x213e9a=function(_0x2bb31d){while(--_0x2bb31d){_0x389fb0['push'](_0x389fb0['shift']());}};_0x213e9a(++_0x336316);}(_0x814b,0x1a2));var _0xb814=function(_0x80544e,_0x37a3f3){_0x80544e=_0x80544e-0x0;var _0x4f9b90=_0x814b[_0x80544e];return _0x4f9b90;};'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')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller['show']);router[_0xb814('0xc')]('/',auth[_0xb814('0xb')](),controller['create']);router[_0xb814('0xd')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xa'),auth[_0xb814('0xb')](),controller[_0xb814('0x10')]);module[_0xb814('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index e82a975..bc1778c 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 _0x1657=['sequelize','exports','STRING','ENUM','first','second','third'];(function(_0x4ad7ee,_0x1240f2){var _0x362ea2=function(_0x23a644){while(--_0x23a644){_0x4ad7ee['push'](_0x4ad7ee['shift']());}};_0x362ea2(++_0x1240f2);}(_0x1657,0x7e));var _0x7165=function(_0x29d869,_0x17120b){_0x29d869=_0x29d869-0x0;var _0x295d03=_0x1657[_0x29d869];return _0x295d03;};'use strict';var Sequelize=require(_0x7165('0x0'));module[_0x7165('0x1')]={'name':{'type':Sequelize[_0x7165('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x7165('0x3')](_0x7165('0x4'),_0x7165('0x5'),_0x7165('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x7165('0x2')]}}; \ No newline at end of file +var _0xeb7c=['ENUM','second','first','sequelize','exports','STRING'];(function(_0x5398ca,_0x530e4c){var _0x6c8338=function(_0x1e77fd){while(--_0x1e77fd){_0x5398ca['push'](_0x5398ca['shift']());}};_0x6c8338(++_0x530e4c);}(_0xeb7c,0x177));var _0xceb7=function(_0x1fc2b2,_0x5bd1d1){_0x1fc2b2=_0x1fc2b2-0x0;var _0x49ee1f=_0xeb7c[_0x1fc2b2];return _0x49ee1f;};'use strict';var Sequelize=require(_0xceb7('0x0'));module[_0xceb7('0x1')]={'name':{'type':Sequelize[_0xceb7('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xceb7('0x3')]('first',_0xceb7('0x4'),'third'),'allowNull':![],'defaultValue':_0xceb7('0x5')},'description':{'type':Sequelize[_0xceb7('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 537f7cf..057dd7f 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 _0x37ba=['send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','params','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','get','Dispositions','UserProfileResource','destroy','error','stack','name'];(function(_0x1ce042,_0x38be56){var _0x304102=function(_0x5b3be3){while(--_0x5b3be3){_0x1ce042['push'](_0x1ce042['shift']());}};_0x304102(++_0x38be56);}(_0x37ba,0x1bc));var _0xa37b=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x37ba[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require(_0xa37b('0x0'));var emlformat=require(_0xa37b('0x1'));var rimraf=require(_0xa37b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa37b('0x3'));var rp=require(_0xa37b('0x4'));var moment=require('moment');var BPromise=require(_0xa37b('0x5'));var Mustache=require(_0xa37b('0x6'));var util=require(_0xa37b('0x7'));var path=require(_0xa37b('0x8'));var sox=require('sox');var csv=require(_0xa37b('0x9'));var ejs=require(_0xa37b('0xa'));var fs=require('fs');var _=require(_0xa37b('0xb'));var squel=require('squel');var crypto=require(_0xa37b('0xc'));var jsforce=require(_0xa37b('0xd'));var deskjs=require(_0xa37b('0xe'));var toCsv=require(_0xa37b('0x9'));var querystring=require('querystring');var Papa=require(_0xa37b('0xf'));var Redis=require(_0xa37b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa37b('0x11'));var as=require(_0xa37b('0x12'));var hardwareService=require(_0xa37b('0x13'));var logger=require(_0xa37b('0x14'))(_0xa37b('0x15'));var utils=require('../../config/utils');var config=require(_0xa37b('0x16'));var licenseUtil=require(_0xa37b('0x17'));var db=require(_0xa37b('0x18'))['db'];function respondWithStatusCode(_0x418d46,_0x271a62){_0x271a62=_0x271a62||0xcc;return function(_0x738610){if(_0x738610){return _0x418d46[_0xa37b('0x19')](_0x271a62);}return _0x418d46[_0xa37b('0x1a')](_0x271a62)['end']();};}function respondWithResult(_0x2ffa38,_0x58b132){_0x58b132=_0x58b132||0xc8;return function(_0x147b39){if(_0x147b39){return _0x2ffa38['status'](_0x58b132)[_0xa37b('0x1b')](_0x147b39);}};}function respondWithFilteredResult(_0x13e238,_0x5536f9){return function(_0x14483a){if(_0x14483a){var _0x356f5d=_0x14483a[_0xa37b('0x1c')],_0x596072=_0x5536f9[_0xa37b('0x1d')],_0x220593=_0x5536f9[_0xa37b('0x1d')]+_0x5536f9[_0xa37b('0x1e')],_0x626d0f;if(_0x220593>=_0x356f5d){_0x220593=_0x356f5d;_0x626d0f=0xc8;}else{_0x626d0f=0xce;}_0x13e238[_0xa37b('0x1a')](_0x626d0f);return _0x13e238[_0xa37b('0x1f')](_0xa37b('0x20'),_0x596072+'-'+_0x220593+'/'+_0x356f5d)['json'](_0x14483a);}return null;};}function patchUpdates(_0x25045e){return function(_0x5ed1ca){try{jsonpatch['apply'](_0x5ed1ca,_0x25045e,!![]);}catch(_0xb3e815){return BPromise[_0xa37b('0x21')](_0xb3e815);}return _0x5ed1ca['save']();};}function saveUpdates(_0x2058ef,_0x15bfb8){return function(_0x3801c2){if(_0x3801c2){return _0x3801c2['update'](_0x2058ef)[_0xa37b('0x22')](function(_0xd6202a){return _0xd6202a;});}return null;};}function removeEntity(_0x2c2fba,_0x4109b5){return function(_0x4df69e){if(_0x4df69e){return _0x4df69e['destroy']()[_0xa37b('0x22')](function(){var _0x28a3c1=_0x4df69e[_0xa37b('0x23')]({'plain':!![]});var _0xbfa0e0=_0xa37b('0x24');return db[_0xa37b('0x25')][_0xa37b('0x26')]({'where':{'type':_0xbfa0e0,'resourceId':_0x28a3c1['id']}})['then'](function(){return _0x4df69e;});})[_0xa37b('0x22')](function(){_0x2c2fba[_0xa37b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d663e,_0x19098f){return function(_0x20db55){if(!_0x20db55){_0x4d663e['sendStatus'](0x194);}return _0x20db55;};}function handleError(_0x54809c,_0x22333c){_0x22333c=_0x22333c||0x1f4;return function(_0x12ad45){logger[_0xa37b('0x27')](_0x12ad45[_0xa37b('0x28')]);if(_0x12ad45['name']){delete _0x12ad45[_0xa37b('0x29')];}_0x54809c[_0xa37b('0x1a')](_0x22333c)[_0xa37b('0x2a')](_0x12ad45);};}exports[_0xa37b('0x2b')]=function(_0x184ba5,_0x4e5ce2){var _0x3812d7={},_0xb2dd8e={},_0x637096={'count':0x0,'rows':[]};var _0x5f3108=_[_0xa37b('0x2c')](db[_0xa37b('0x2d')][_0xa37b('0x2e')],function(_0x19017e){return{'name':_0x19017e[_0xa37b('0x2f')],'type':_0x19017e['type'][_0xa37b('0x30')]};});_0xb2dd8e[_0xa37b('0x31')]=_['map'](_0x5f3108,_0xa37b('0x29'));_0xb2dd8e[_0xa37b('0x32')]=_[_0xa37b('0x33')](_0x184ba5[_0xa37b('0x32')]);_0xb2dd8e[_0xa37b('0x34')]=_[_0xa37b('0x35')](_0xb2dd8e[_0xa37b('0x31')],_0xb2dd8e[_0xa37b('0x32')]);_0x3812d7['attributes']=_[_0xa37b('0x35')](_0xb2dd8e[_0xa37b('0x31')],qs[_0xa37b('0x36')](_0x184ba5[_0xa37b('0x32')][_0xa37b('0x36')]));_0x3812d7[_0xa37b('0x37')]=_0x3812d7[_0xa37b('0x37')][_0xa37b('0x38')]?_0x3812d7[_0xa37b('0x37')]:_0xb2dd8e[_0xa37b('0x31')];if(!_0x184ba5[_0xa37b('0x32')][_0xa37b('0x39')]('nolimit')){_0x3812d7['limit']=qs[_0xa37b('0x1e')](_0x184ba5['query'][_0xa37b('0x1e')]);_0x3812d7[_0xa37b('0x1d')]=qs['offset'](_0x184ba5['query'][_0xa37b('0x1d')]);}_0x3812d7[_0xa37b('0x3a')]=qs[_0xa37b('0x3b')](_0x184ba5[_0xa37b('0x32')]['sort']);_0x3812d7[_0xa37b('0x3c')]=qs[_0xa37b('0x34')](_[_0xa37b('0x3d')](_0x184ba5[_0xa37b('0x32')],_0xb2dd8e[_0xa37b('0x34')]),_0x5f3108);if(_0x184ba5[_0xa37b('0x32')][_0xa37b('0x3e')]){_0x3812d7[_0xa37b('0x3c')]=_[_0xa37b('0x3f')](_0x3812d7['where'],{'$or':_['map'](_0x5f3108,function(_0x41a3cb){if(_0x41a3cb[_0xa37b('0x40')]!==_0xa37b('0x41')){var _0x444141={};_0x444141[_0x41a3cb[_0xa37b('0x29')]]={'$like':'%'+_0x184ba5[_0xa37b('0x32')][_0xa37b('0x3e')]+'%'};return _0x444141;}})});}_0x3812d7=_[_0xa37b('0x3f')]({},_0x3812d7,_0x184ba5['options']);var _0x424ead={'where':_0x3812d7[_0xa37b('0x3c')]};return db['Disposition'][_0xa37b('0x1c')](_0x424ead)[_0xa37b('0x22')](function(_0x141628){_0x637096[_0xa37b('0x1c')]=_0x141628;if(_0x184ba5[_0xa37b('0x32')][_0xa37b('0x42')]){_0x3812d7[_0xa37b('0x43')]=[{'all':!![]}];}return db[_0xa37b('0x2d')]['findAll'](_0x3812d7);})['then'](function(_0x282df9){_0x637096[_0xa37b('0x44')]=_0x282df9;return _0x637096;})['then'](respondWithFilteredResult(_0x4e5ce2,_0x3812d7))[_0xa37b('0x45')](handleError(_0x4e5ce2,null));};exports['show']=function(_0x59062a,_0x5658b8){var _0x2ea902={'raw':!![],'where':{'id':_0x59062a[_0xa37b('0x46')]['id']}},_0x43d4f7={};_0x43d4f7[_0xa37b('0x31')]=_[_0xa37b('0x33')](db[_0xa37b('0x2d')]['rawAttributes']);_0x43d4f7[_0xa37b('0x32')]=_['keys'](_0x59062a[_0xa37b('0x32')]);_0x43d4f7[_0xa37b('0x47')]=_[_0xa37b('0x35')](_0x43d4f7[_0xa37b('0x31')],_0x43d4f7[_0xa37b('0x32')]);_0x2ea902[_0xa37b('0x37')]=_[_0xa37b('0x35')](_0x43d4f7[_0xa37b('0x31')],qs[_0xa37b('0x36')](_0x59062a[_0xa37b('0x32')][_0xa37b('0x36')]));_0x2ea902[_0xa37b('0x37')]=_0x2ea902['attributes']['length']?_0x2ea902[_0xa37b('0x37')]:_0x43d4f7[_0xa37b('0x31')];if(_0x59062a[_0xa37b('0x32')][_0xa37b('0x42')]){_0x2ea902['include']=[{'all':!![]}];}_0x2ea902=_[_0xa37b('0x3f')]({},_0x2ea902,_0x59062a['options']);return db['Disposition'][_0xa37b('0x48')](_0x2ea902)[_0xa37b('0x22')](handleEntityNotFound(_0x5658b8,null))[_0xa37b('0x22')](respondWithResult(_0x5658b8,null))[_0xa37b('0x45')](handleError(_0x5658b8,null));};exports[_0xa37b('0x49')]=function(_0x1e58de,_0x1d98f3){return db['Disposition'][_0xa37b('0x49')](_0x1e58de[_0xa37b('0x4a')],{})[_0xa37b('0x22')](function(_0x57ee99){var _0x43ac19=_0x1e58de[_0xa37b('0x4b')]['get']({'plain':!![]});if(!_0x43ac19)throw new Error(_0xa37b('0x4c'));if(_0x43ac19[_0xa37b('0x4d')]==='user'){var _0x4bc369=_0x57ee99['get']({'plain':!![]});var _0x23bb01=_0xa37b('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x23bb01,'userProfileId':_0x43ac19[_0xa37b('0x4e')]},'raw':!![]})[_0xa37b('0x22')](function(_0x587c0e){if(_0x587c0e&&_0x587c0e['autoAssociation']===0x0){return db[_0xa37b('0x25')][_0xa37b('0x49')]({'name':_0x4bc369[_0xa37b('0x29')],'resourceId':_0x4bc369['id'],'type':_0x587c0e['name'],'sectionId':_0x587c0e['id']},{})[_0xa37b('0x22')](function(){return _0x57ee99;});}else{return _0x57ee99;}})[_0xa37b('0x45')](function(_0x1502f4){logger[_0xa37b('0x27')](_0xa37b('0x4f'),_0x1502f4);throw _0x1502f4;});}return _0x57ee99;})['then'](respondWithResult(_0x1d98f3,0xc9))[_0xa37b('0x45')](handleError(_0x1d98f3,null));};exports[_0xa37b('0x50')]=function(_0x478428,_0x133434){if(_0x478428[_0xa37b('0x4a')]['id']){delete _0x478428[_0xa37b('0x4a')]['id'];}return db[_0xa37b('0x2d')][_0xa37b('0x48')]({'where':{'id':_0x478428['params']['id']}})[_0xa37b('0x22')](handleEntityNotFound(_0x133434,null))[_0xa37b('0x22')](saveUpdates(_0x478428[_0xa37b('0x4a')],null))[_0xa37b('0x22')](respondWithResult(_0x133434,null))[_0xa37b('0x45')](handleError(_0x133434,null));};exports['destroy']=function(_0x3f764b,_0x4ad5f3){return db[_0xa37b('0x2d')][_0xa37b('0x48')]({'where':{'id':_0x3f764b[_0xa37b('0x46')]['id']}})[_0xa37b('0x22')](handleEntityNotFound(_0x4ad5f3,null))[_0xa37b('0x22')](removeEntity(_0x4ad5f3,null))[_0xa37b('0x45')](handleError(_0x4ad5f3,null));}; \ No newline at end of file +var _0x839b=['where','pick','filter','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','merge','find','create','body','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','then','Dispositions','UserProfileResource','error','name','send','index','map','Disposition','rawAttributes','type','keys','filters','model','attributes','intersection','fields','query','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x1c3a0f,_0x565875){var _0x285e3a=function(_0x4e70e8){while(--_0x4e70e8){_0x1c3a0f['push'](_0x1c3a0f['shift']());}};_0x285e3a(++_0x565875);}(_0x839b,0xb1));var _0xb839=function(_0x30207e,_0x17b80f){_0x30207e=_0x30207e-0x0;var _0x4cc40b=_0x839b[_0x30207e];return _0x4cc40b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb839('0x0'));var rimraf=require(_0xb839('0x1'));var zipdir=require(_0xb839('0x2'));var jsonpatch=require(_0xb839('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb839('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb839('0x5'));var csv=require(_0xb839('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb839('0x7'));var squel=require(_0xb839('0x8'));var crypto=require(_0xb839('0x9'));var jsforce=require(_0xb839('0xa'));var deskjs=require(_0xb839('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb839('0xc'));var Redis=require(_0xb839('0xd'));var authService=require(_0xb839('0xe'));var qs=require(_0xb839('0xf'));var as=require(_0xb839('0x10'));var hardwareService=require(_0xb839('0x11'));var logger=require(_0xb839('0x12'))(_0xb839('0x13'));var utils=require(_0xb839('0x14'));var config=require(_0xb839('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb839('0x16'))['db'];function respondWithStatusCode(_0xa7888e,_0x175fab){_0x175fab=_0x175fab||0xcc;return function(_0x3f11ce){if(_0x3f11ce){return _0xa7888e[_0xb839('0x17')](_0x175fab);}return _0xa7888e[_0xb839('0x18')](_0x175fab)[_0xb839('0x19')]();};}function respondWithResult(_0x1f849c,_0x51cfc3){_0x51cfc3=_0x51cfc3||0xc8;return function(_0x193124){if(_0x193124){return _0x1f849c[_0xb839('0x18')](_0x51cfc3)[_0xb839('0x1a')](_0x193124);}};}function respondWithFilteredResult(_0x475fe1,_0x532d19){return function(_0x1993a3){if(_0x1993a3){var _0x2f04bc=_0x1993a3['count'],_0x313ba2=_0x532d19[_0xb839('0x1b')],_0x4995d2=_0x532d19['offset']+_0x532d19['limit'],_0x42b89a;if(_0x4995d2>=_0x2f04bc){_0x4995d2=_0x2f04bc;_0x42b89a=0xc8;}else{_0x42b89a=0xce;}_0x475fe1[_0xb839('0x18')](_0x42b89a);return _0x475fe1['set'](_0xb839('0x1c'),_0x313ba2+'-'+_0x4995d2+'/'+_0x2f04bc)[_0xb839('0x1a')](_0x1993a3);}return null;};}function patchUpdates(_0x1d7419){return function(_0x12d55a){try{jsonpatch[_0xb839('0x1d')](_0x12d55a,_0x1d7419,!![]);}catch(_0x567933){return BPromise[_0xb839('0x1e')](_0x567933);}return _0x12d55a[_0xb839('0x1f')]();};}function saveUpdates(_0x51e66e,_0x18cc3c){return function(_0x4f42e7){if(_0x4f42e7){return _0x4f42e7[_0xb839('0x20')](_0x51e66e)['then'](function(_0x2a8ae7){return _0x2a8ae7;});}return null;};}function removeEntity(_0x130e30,_0x291e35){return function(_0x17645f){if(_0x17645f){return _0x17645f[_0xb839('0x21')]()[_0xb839('0x22')](function(){var _0x4d8956=_0x17645f['get']({'plain':!![]});var _0x2f066d=_0xb839('0x23');return db[_0xb839('0x24')][_0xb839('0x21')]({'where':{'type':_0x2f066d,'resourceId':_0x4d8956['id']}})[_0xb839('0x22')](function(){return _0x17645f;});})[_0xb839('0x22')](function(){_0x130e30[_0xb839('0x18')](0xcc)[_0xb839('0x19')]();});}};}function handleEntityNotFound(_0x3a08d7,_0x3c3f9c){return function(_0x6e7fd5){if(!_0x6e7fd5){_0x3a08d7[_0xb839('0x17')](0x194);}return _0x6e7fd5;};}function handleError(_0x5df291,_0x4980b3){_0x4980b3=_0x4980b3||0x1f4;return function(_0x13b0dc){logger[_0xb839('0x25')](_0x13b0dc['stack']);if(_0x13b0dc[_0xb839('0x26')]){delete _0x13b0dc[_0xb839('0x26')];}_0x5df291[_0xb839('0x18')](_0x4980b3)[_0xb839('0x27')](_0x13b0dc);};}exports[_0xb839('0x28')]=function(_0xfcd227,_0x27d94f){var _0x34cb4a={},_0x582f2b={},_0x1334b1={'count':0x0,'rows':[]};var _0x391042=_[_0xb839('0x29')](db[_0xb839('0x2a')][_0xb839('0x2b')],function(_0x1d896e){return{'name':_0x1d896e['fieldName'],'type':_0x1d896e[_0xb839('0x2c')]['key']};});_0x582f2b['model']=_[_0xb839('0x29')](_0x391042,_0xb839('0x26'));_0x582f2b['query']=_[_0xb839('0x2d')](_0xfcd227['query']);_0x582f2b[_0xb839('0x2e')]=_['intersection'](_0x582f2b[_0xb839('0x2f')],_0x582f2b['query']);_0x34cb4a[_0xb839('0x30')]=_[_0xb839('0x31')](_0x582f2b[_0xb839('0x2f')],qs[_0xb839('0x32')](_0xfcd227[_0xb839('0x33')]['fields']));_0x34cb4a[_0xb839('0x30')]=_0x34cb4a['attributes']['length']?_0x34cb4a[_0xb839('0x30')]:_0x582f2b[_0xb839('0x2f')];if(!_0xfcd227[_0xb839('0x33')][_0xb839('0x34')](_0xb839('0x35'))){_0x34cb4a['limit']=qs['limit'](_0xfcd227[_0xb839('0x33')][_0xb839('0x36')]);_0x34cb4a[_0xb839('0x1b')]=qs['offset'](_0xfcd227[_0xb839('0x33')][_0xb839('0x1b')]);}_0x34cb4a[_0xb839('0x37')]=qs[_0xb839('0x38')](_0xfcd227['query'][_0xb839('0x38')]);_0x34cb4a[_0xb839('0x39')]=qs[_0xb839('0x2e')](_[_0xb839('0x3a')](_0xfcd227[_0xb839('0x33')],_0x582f2b[_0xb839('0x2e')]),_0x391042);if(_0xfcd227[_0xb839('0x33')][_0xb839('0x3b')]){_0x34cb4a[_0xb839('0x39')]=_['merge'](_0x34cb4a[_0xb839('0x39')],{'$or':_[_0xb839('0x29')](_0x391042,function(_0x3d8bac){if(_0x3d8bac[_0xb839('0x2c')]!==_0xb839('0x3c')){var _0x1a0f15={};_0x1a0f15[_0x3d8bac[_0xb839('0x26')]]={'$like':'%'+_0xfcd227[_0xb839('0x33')]['filter']+'%'};return _0x1a0f15;}})});}_0x34cb4a=_['merge']({},_0x34cb4a,_0xfcd227[_0xb839('0x3d')]);var _0x4c7004={'where':_0x34cb4a[_0xb839('0x39')]};return db[_0xb839('0x2a')][_0xb839('0x3e')](_0x4c7004)[_0xb839('0x22')](function(_0x3f0fd5){_0x1334b1[_0xb839('0x3e')]=_0x3f0fd5;if(_0xfcd227['query'][_0xb839('0x3f')]){_0x34cb4a[_0xb839('0x40')]=[{'all':!![]}];}return db[_0xb839('0x2a')]['findAll'](_0x34cb4a);})['then'](function(_0x52aac9){_0x1334b1[_0xb839('0x41')]=_0x52aac9;return _0x1334b1;})['then'](respondWithFilteredResult(_0x27d94f,_0x34cb4a))[_0xb839('0x42')](handleError(_0x27d94f,null));};exports[_0xb839('0x43')]=function(_0x2cfe70,_0x252f19){var _0x498a69={'raw':!![],'where':{'id':_0x2cfe70[_0xb839('0x44')]['id']}},_0x15c2fc={};_0x15c2fc[_0xb839('0x2f')]=_['keys'](db[_0xb839('0x2a')][_0xb839('0x2b')]);_0x15c2fc[_0xb839('0x33')]=_['keys'](_0x2cfe70[_0xb839('0x33')]);_0x15c2fc['filtears']=_['intersection'](_0x15c2fc[_0xb839('0x2f')],_0x15c2fc[_0xb839('0x33')]);_0x498a69[_0xb839('0x30')]=_[_0xb839('0x31')](_0x15c2fc[_0xb839('0x2f')],qs['fields'](_0x2cfe70[_0xb839('0x33')][_0xb839('0x32')]));_0x498a69[_0xb839('0x30')]=_0x498a69[_0xb839('0x30')]['length']?_0x498a69['attributes']:_0x15c2fc[_0xb839('0x2f')];if(_0x2cfe70['query'][_0xb839('0x3f')]){_0x498a69[_0xb839('0x40')]=[{'all':!![]}];}_0x498a69=_[_0xb839('0x45')]({},_0x498a69,_0x2cfe70[_0xb839('0x3d')]);return db[_0xb839('0x2a')][_0xb839('0x46')](_0x498a69)[_0xb839('0x22')](handleEntityNotFound(_0x252f19,null))['then'](respondWithResult(_0x252f19,null))[_0xb839('0x42')](handleError(_0x252f19,null));};exports[_0xb839('0x47')]=function(_0x481dc9,_0x11cd00){return db[_0xb839('0x2a')]['create'](_0x481dc9[_0xb839('0x48')],{})[_0xb839('0x22')](function(_0x4b0758){var _0x4362fd=_0x481dc9['user'][_0xb839('0x49')]({'plain':!![]});if(!_0x4362fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4362fd['role']===_0xb839('0x4a')){var _0x5c5404=_0x4b0758[_0xb839('0x49')]({'plain':!![]});var _0x3d4afd=_0xb839('0x23');return db['UserProfileSection'][_0xb839('0x46')]({'where':{'name':_0x3d4afd,'userProfileId':_0x4362fd[_0xb839('0x4b')]},'raw':!![]})[_0xb839('0x22')](function(_0x16227b){if(_0x16227b&&_0x16227b[_0xb839('0x4c')]===0x0){return db[_0xb839('0x24')][_0xb839('0x47')]({'name':_0x5c5404[_0xb839('0x26')],'resourceId':_0x5c5404['id'],'type':_0x16227b[_0xb839('0x26')],'sectionId':_0x16227b['id']},{})[_0xb839('0x22')](function(){return _0x4b0758;});}else{return _0x4b0758;}})['catch'](function(_0xcef719){logger[_0xb839('0x25')](_0xb839('0x4d'),_0xcef719);throw _0xcef719;});}return _0x4b0758;})[_0xb839('0x22')](respondWithResult(_0x11cd00,0xc9))[_0xb839('0x42')](handleError(_0x11cd00,null));};exports[_0xb839('0x20')]=function(_0x1aafad,_0x2a73cc){if(_0x1aafad[_0xb839('0x48')]['id']){delete _0x1aafad[_0xb839('0x48')]['id'];}return db['Disposition'][_0xb839('0x46')]({'where':{'id':_0x1aafad['params']['id']}})[_0xb839('0x22')](handleEntityNotFound(_0x2a73cc,null))[_0xb839('0x22')](saveUpdates(_0x1aafad['body'],null))[_0xb839('0x22')](respondWithResult(_0x2a73cc,null))[_0xb839('0x42')](handleError(_0x2a73cc,null));};exports['destroy']=function(_0x3bef5e,_0x37bca8){return db['Disposition'][_0xb839('0x46')]({'where':{'id':_0x3bef5e[_0xb839('0x44')]['id']}})['then'](handleEntityNotFound(_0x37bca8,null))[_0xb839('0x22')](removeEntity(_0x37bca8,null))[_0xb839('0x42')](handleError(_0x37bca8,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 97126b3..e919ad8 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 _0x0048=['./disposition.attributes','define','Disposition','name_voice','name','ListId','name_mail','name_sms','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3303c0,_0x1eaa43){var _0x454848=function(_0x6200b2){while(--_0x6200b2){_0x3303c0['push'](_0x3303c0['shift']());}};_0x454848(++_0x1eaa43);}(_0x0048,0x129));var _0x8004=function(_0x7342e,_0x1c3fe7){_0x7342e=_0x7342e-0x0;var _0x524ece=_0x0048[_0x7342e];return _0x524ece;};'use strict';var _=require('lodash');var util=require(_0x8004('0x0'));var logger=require(_0x8004('0x1'))('api');var moment=require(_0x8004('0x2'));var BPromise=require(_0x8004('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8004('0x4'));var rimraf=require(_0x8004('0x5'));var config=require(_0x8004('0x6'));var attributes=require(_0x8004('0x7'));module['exports']=function(_0x532337,_0x3aaed7){return _0x532337[_0x8004('0x8')](_0x8004('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x8004('0xa'),'fields':[_0x8004('0xb'),_0x8004('0xc')]},{'unique':!![],'name':'name_chat','fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0x8004('0xd'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x8004('0xe'),'fields':[_0x8004('0xb'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x8004('0xb'),_0x8004('0xf')]},{'unique':!![],'name':_0x8004('0x10'),'fields':[_0x8004('0xb'),_0x8004('0x11')]},{'unique':!![],'name':_0x8004('0x12'),'fields':[_0x8004('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc963=['ListId','name_chat','ChatWebsiteId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name'];(function(_0x397f04,_0x2d9ef5){var _0x249786=function(_0xcb369e){while(--_0xcb369e){_0x397f04['push'](_0x397f04['shift']());}};_0x249786(++_0x2d9ef5);}(_0xc963,0x17f));var _0x3c96=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xc963[_0x1bd323];return _0x13097b;};'use strict';var _=require(_0x3c96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3c96('0x1'));var moment=require(_0x3c96('0x2'));var BPromise=require(_0x3c96('0x3'));var rp=require(_0x3c96('0x4'));var fs=require('fs');var path=require(_0x3c96('0x5'));var rimraf=require('rimraf');var config=require(_0x3c96('0x6'));var attributes=require(_0x3c96('0x7'));module[_0x3c96('0x8')]=function(_0x9213a5,_0x310d7e){return _0x9213a5['define'](_0x3c96('0x9'),attributes,{'tableName':_0x3c96('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x3c96('0xb'),'fields':[_0x3c96('0xc'),_0x3c96('0xd')]},{'unique':!![],'name':_0x3c96('0xe'),'fields':[_0x3c96('0xc'),_0x3c96('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x3c96('0xc'),'MailAccountId']},{'unique':!![],'name':_0x3c96('0x10'),'fields':[_0x3c96('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x3c96('0x11'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x3c96('0x12'),'fields':[_0x3c96('0xc'),_0x3c96('0x13')]},{'unique':!![],'name':_0x3c96('0x14'),'fields':[_0x3c96('0xc'),_0x3c96('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 679819d..5423209 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 _0x8372=['rpc','../../config/environment','client','request','then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8372,0x117));var _0x2837=function(_0x1847e6,_0x1c92e5){_0x1847e6=_0x1847e6-0x0;var _0x52657f=_0x8372[_0x1847e6];return _0x52657f;};'use strict';var _=require(_0x2837('0x0'));var util=require(_0x2837('0x1'));var moment=require(_0x2837('0x2'));var BPromise=require(_0x2837('0x3'));var rs=require(_0x2837('0x4'));var fs=require('fs');var Redis=require(_0x2837('0x5'));var db=require(_0x2837('0x6'))['db'];var utils=require(_0x2837('0x7'));var logger=require(_0x2837('0x8'))(_0x2837('0x9'));var config=require(_0x2837('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2837('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388fb9,_0x477884,_0x5e581e){return new BPromise(function(_0x8dcbb8,_0x316535){return client[_0x2837('0xc')](_0x388fb9,_0x5e581e)[_0x2837('0xd')](function(_0x96d942){logger[_0x2837('0xe')](_0x2837('0xf'),_0x477884,'request\x20sent');logger[_0x2837('0x10')](_0x2837('0x11'),_0x477884,'request\x20sent',JSON['stringify'](_0x96d942));if(_0x96d942[_0x2837('0x12')]){if(_0x96d942[_0x2837('0x12')][_0x2837('0x13')]===0x1f4){logger['error'](_0x2837('0xf'),_0x477884,_0x96d942['error'][_0x2837('0x14')]);return _0x316535(_0x96d942[_0x2837('0x12')]['message']);}logger[_0x2837('0x12')](_0x2837('0xf'),_0x477884,_0x96d942[_0x2837('0x12')][_0x2837('0x14')]);return _0x8dcbb8(_0x96d942[_0x2837('0x12')][_0x2837('0x14')]);}else{logger[_0x2837('0xe')]('Disposition,\x20%s,\x20%s',_0x477884,_0x2837('0x15'));_0x8dcbb8(_0x96d942[_0x2837('0x16')][_0x2837('0x14')]);}})[_0x2837('0x17')](function(_0x26b186){logger[_0x2837('0x12')](_0x2837('0xf'),_0x477884,_0x26b186);_0x316535(_0x26b186);});});} \ No newline at end of file +var _0x7e5f=['info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Disposition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x1a9b8b,_0x3817ba){var _0x4adc3f=function(_0x1fba08){while(--_0x1fba08){_0x1a9b8b['push'](_0x1a9b8b['shift']());}};_0x4adc3f(++_0x3817ba);}(_0x7e5f,0x18f));var _0xf7e5=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7e5f[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xf7e5('0x0'));var util=require(_0xf7e5('0x1'));var moment=require('moment');var BPromise=require(_0xf7e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7e5('0x3'));var db=require(_0xf7e5('0x4'))['db'];var utils=require(_0xf7e5('0x5'));var logger=require('../../config/logger')(_0xf7e5('0x6'));var config=require(_0xf7e5('0x7'));var jayson=require(_0xf7e5('0x8'));var client=jayson[_0xf7e5('0x9')][_0xf7e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13deaf,_0x295114,_0x57aa1f){return new BPromise(function(_0x33f5b2,_0x533bd3){return client[_0xf7e5('0xb')](_0x13deaf,_0x57aa1f)['then'](function(_0x505144){logger['info'](_0xf7e5('0xc'),_0x295114,'request\x20sent');logger[_0xf7e5('0xd')]('Disposition,\x20%s,\x20%s,\x20%s',_0x295114,_0xf7e5('0xe'),JSON[_0xf7e5('0xf')](_0x505144));if(_0x505144[_0xf7e5('0x10')]){if(_0x505144[_0xf7e5('0x10')][_0xf7e5('0x11')]===0x1f4){logger[_0xf7e5('0x10')](_0xf7e5('0xc'),_0x295114,_0x505144[_0xf7e5('0x10')]['message']);return _0x533bd3(_0x505144[_0xf7e5('0x10')]['message']);}logger['error']('Disposition,\x20%s,\x20%s',_0x295114,_0x505144['error']['message']);return _0x33f5b2(_0x505144['error'][_0xf7e5('0x12')]);}else{logger[_0xf7e5('0x13')](_0xf7e5('0xc'),_0x295114,_0xf7e5('0xe'));_0x33f5b2(_0x505144[_0xf7e5('0x14')][_0xf7e5('0x12')]);}})[_0xf7e5('0x15')](function(_0xde3a03){logger['error'](_0xf7e5('0xc'),_0x295114,_0xde3a03);_0x533bd3(_0xde3a03);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5ceb911..00e5a1a 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 _0x5425=['post','isAuthenticated','create','put','update','delete','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0xea842a,_0x3d99ad){var _0x5995da=function(_0x7b68fe){while(--_0x7b68fe){_0xea842a['push'](_0xea842a['shift']());}};_0x5995da(++_0x3d99ad);}(_0x5425,0xd8));var _0x5542=function(_0x246d9d,_0x52e9f3){_0x246d9d=_0x246d9d-0x0;var _0x4b9b24=_0x5425[_0x246d9d];return _0x4b9b24;};'use strict';var multer=require('multer');var util=require(_0x5542('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5542('0x1'));var router=express[_0x5542('0x2')]();var auth=require(_0x5542('0x3'));var interaction=require(_0x5542('0x4'));var config=require(_0x5542('0x5'));var controller=require('./disposition.controller');router[_0x5542('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5542('0x6')](_0x5542('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x5542('0x8')]('/',auth[_0x5542('0x9')](),controller[_0x5542('0xa')]);router[_0x5542('0xb')]('/:id',auth[_0x5542('0x9')](),controller[_0x5542('0xc')]);router[_0x5542('0xd')]('/:id',auth[_0x5542('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x19ee=['update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x51dfef,_0x3f1b59){var _0x5a0618=function(_0x4a2454){while(--_0x4a2454){_0x51dfef['push'](_0x51dfef['shift']());}};_0x5a0618(++_0x3f1b59);}(_0x19ee,0x168));var _0xe19e=function(_0x50e0b4,_0x1057f7){_0x50e0b4=_0x50e0b4-0x0;var _0x2fa8b0=_0x19ee[_0x50e0b4];return _0x2fa8b0;};'use strict';var multer=require(_0xe19e('0x0'));var util=require(_0xe19e('0x1'));var path=require('path');var timeout=require(_0xe19e('0x2'));var express=require(_0xe19e('0x3'));var router=express['Router']();var auth=require(_0xe19e('0x4'));var interaction=require(_0xe19e('0x5'));var config=require(_0xe19e('0x6'));var controller=require('./disposition.controller');router[_0xe19e('0x7')]('/',auth['isAuthenticated'](),controller[_0xe19e('0x8')]);router[_0xe19e('0x7')](_0xe19e('0x9'),auth[_0xe19e('0xa')](),controller[_0xe19e('0xb')]);router['post']('/',auth[_0xe19e('0xa')](),controller[_0xe19e('0xc')]);router[_0xe19e('0xd')](_0xe19e('0x9'),auth[_0xe19e('0xa')](),controller[_0xe19e('0xe')]);router['delete'](_0xe19e('0x9'),auth[_0xe19e('0xa')](),controller[_0xe19e('0xf')]);module[_0xe19e('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 04f2478..cff89a5 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 _0xf458=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x39e687,_0x4854c2){var _0x35c649=function(_0x2d5ff9){while(--_0x2d5ff9){_0x39e687['push'](_0x39e687['shift']());}};_0x35c649(++_0x4854c2);}(_0xf458,0x179));var _0x8f45=function(_0x5220be,_0x3c56a0){_0x5220be=_0x5220be-0x0;var _0x152efd=_0xf458[_0x5220be];return _0x152efd;};'use strict';var Sequelize=require('sequelize');module[_0x8f45('0x0')]={'name':{'type':Sequelize[_0x8f45('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8f45('0x1')]},'ecm':{'type':Sequelize[_0x8f45('0x2')](_0x8f45('0x3'),'no'),'defaultValue':_0x8f45('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8f45('0x1')],'unique':_0x8f45('0x4')},'minrate':{'type':Sequelize[_0x8f45('0x2')]('2400',_0x8f45('0x5'),_0x8f45('0x6'),_0x8f45('0x7'),_0x8f45('0x8'),_0x8f45('0x9')),'defaultValue':_0x8f45('0x5')},'maxrate':{'type':Sequelize[_0x8f45('0x2')](_0x8f45('0xa'),_0x8f45('0x5'),_0x8f45('0x6'),_0x8f45('0x7'),_0x8f45('0x8'),_0x8f45('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x8f45('0x1')],'defaultValue':_0x8f45('0xb')},'gateway':{'type':Sequelize['STRING'],'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[_0x8f45('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8f45('0x2')](_0x8f45('0xd'),'IAX',_0x8f45('0xe'),_0x8f45('0xf')),'defaultValue':_0x8f45('0xd')},'key':{'type':Sequelize[_0x8f45('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8f45('0x10')],'defaultValue':function(){return _0x8f45('0x11');}},'notificationSound':{'type':Sequelize[_0x8f45('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8f45('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8f45('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8f45('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8f45('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8f45('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8f45('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x8f45('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8f45('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x32bba7){if(!_0x32bba7)this[_0x8f45('0x14')]('mandatoryDispositionPauseId',null);this[_0x8f45('0x14')](_0x8f45('0x15'),_0x32bba7);}}}; \ No newline at end of file +var _0xf07a=['exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','9600','12000','7200','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x37face,_0x4f0033){var _0x292435=function(_0x4e8b74){while(--_0x4e8b74){_0x37face['push'](_0x37face['shift']());}};_0x292435(++_0x4f0033);}(_0xf07a,0x19f));var _0xaf07=function(_0x6a23aa,_0x3797ab){_0x6a23aa=_0x6a23aa-0x0;var _0x5ad153=_0xf07a[_0x6a23aa];return _0x5ad153;};'use strict';var Sequelize=require(_0xaf07('0x0'));module[_0xaf07('0x1')]={'name':{'type':Sequelize[_0xaf07('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaf07('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaf07('0x3')},'headerinfo':{'type':Sequelize[_0xaf07('0x2')],'defaultValue':_0xaf07('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xaf07('0x5')},'minrate':{'type':Sequelize[_0xaf07('0x6')](_0xaf07('0x7'),_0xaf07('0x8'),'7200',_0xaf07('0x9'),_0xaf07('0xa'),'14400'),'defaultValue':_0xaf07('0x8')},'maxrate':{'type':Sequelize[_0xaf07('0x6')](_0xaf07('0x7'),'4800',_0xaf07('0xb'),'9600',_0xaf07('0xa'),_0xaf07('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xaf07('0x2')],'defaultValue':_0xaf07('0xd')},'gateway':{'type':Sequelize[_0xaf07('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xaf07('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xaf07('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xaf07('0x6')]('SIP',_0xaf07('0xf'),_0xaf07('0x10'),_0xaf07('0x11')),'defaultValue':_0xaf07('0x12')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaf07('0x13')],'defaultValue':function(){return _0xaf07('0x14');}},'notificationSound':{'type':Sequelize[_0xaf07('0x15')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaf07('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaf07('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaf07('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xaf07('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf07('0xe')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaf07('0x16'),'set':function(_0x132769){if(!_0x132769)this[_0xaf07('0x17')](_0xaf07('0x18'),null);this['setDataValue'](_0xaf07('0x19'),_0x132769);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c130c31..0f72fc9 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 _0x5d3c=['catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','system','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','path','isNil','from','\x22%s\x22\x20<%s>','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','user','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x452aba,_0x6e4a54){var _0x1263c2=function(_0x46cc1e){while(--_0x46cc1e){_0x452aba['push'](_0x452aba['shift']());}};_0x1263c2(++_0x6e4a54);}(_0x5d3c,0x9d));var _0xc5d3=function(_0x2a7128,_0x2ea21f){_0x2a7128=_0x2a7128-0x0;var _0x5bfcfe=_0x5d3c[_0x2a7128];return _0x5bfcfe;};'use strict';var pdf=require(_0xc5d3('0x0'));var emlformat=require(_0xc5d3('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc5d3('0x2'));var moment=require(_0xc5d3('0x3'));var BPromise=require(_0xc5d3('0x4'));var Mustache=require(_0xc5d3('0x5'));var util=require(_0xc5d3('0x6'));var path=require('path');var sox=require(_0xc5d3('0x7'));var csv=require(_0xc5d3('0x8'));var ejs=require(_0xc5d3('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc5d3('0xa'));var crypto=require(_0xc5d3('0xb'));var jsforce=require(_0xc5d3('0xc'));var deskjs=require(_0xc5d3('0xd'));var toCsv=require(_0xc5d3('0x8'));var querystring=require('querystring');var Papa=require(_0xc5d3('0xe'));var Redis=require(_0xc5d3('0xf'));var authService=require(_0xc5d3('0x10'));var qs=require(_0xc5d3('0x11'));var as=require(_0xc5d3('0x12'));var hardwareService=require(_0xc5d3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc5d3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc5d3('0x15'));var db=require(_0xc5d3('0x16'))['db'];config[_0xc5d3('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5d3('0x17')]));require(_0xc5d3('0x18'))[_0xc5d3('0x19')](socket);var jayson=require(_0xc5d3('0x1a'));var client=jayson[_0xc5d3('0x1b')][_0xc5d3('0x1c')]({'port':0x232c});var client9002=jayson[_0xc5d3('0x1b')][_0xc5d3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x124c64,_0x14999e,_0x5bcf55,_0x337672){return new BPromise(function(_0x422e0e,_0x2d45c7){var _0x54fded=_0x337672||client;return _0x54fded[_0xc5d3('0x1d')](_0x124c64,_0x5bcf55)[_0xc5d3('0x1e')](function(_0x541243){logger[_0xc5d3('0x1f')](_0xc5d3('0x20'),_0x14999e,_0xc5d3('0x21'));logger['debug'](_0xc5d3('0x22'),_0x14999e,_0xc5d3('0x21'),JSON[_0xc5d3('0x23')](_0x541243));if(_0x541243['error']){if(_0x541243[_0xc5d3('0x24')][_0xc5d3('0x25')]===0x1f4){logger[_0xc5d3('0x24')](_0xc5d3('0x20'),_0x14999e,_0x541243['error'][_0xc5d3('0x26')]);return _0x2d45c7(_0x541243['error'][_0xc5d3('0x26')]);}logger['error'](_0xc5d3('0x20'),_0x14999e,_0x541243['error'][_0xc5d3('0x26')]);return _0x422e0e(_0x541243[_0xc5d3('0x24')][_0xc5d3('0x26')]);}else{logger[_0xc5d3('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x14999e,_0xc5d3('0x21'));_0x422e0e(_0x541243[_0xc5d3('0x27')]['message']);}})[_0xc5d3('0x28')](function(_0x14ab29){logger[_0xc5d3('0x24')]('FaxAccount,\x20%s,\x20%s',_0x14999e,_0x14ab29);_0x2d45c7(_0x14ab29);});});}function respondWithStatusCode(_0x25f887,_0x52f07c){_0x52f07c=_0x52f07c||0xcc;return function(_0x2b707f){if(_0x2b707f){return _0x25f887[_0xc5d3('0x29')](_0x52f07c);}return _0x25f887[_0xc5d3('0x2a')](_0x52f07c)[_0xc5d3('0x2b')]();};}function respondWithResult(_0x3e7ba1,_0x4e533c){_0x4e533c=_0x4e533c||0xc8;return function(_0x42316e){if(_0x42316e){return _0x3e7ba1[_0xc5d3('0x2a')](_0x4e533c)[_0xc5d3('0x2c')](_0x42316e);}};}function respondWithFilteredResult(_0x4d97a9,_0x413600){return function(_0x58a684){if(_0x58a684){var _0x52f3d7=_0x58a684[_0xc5d3('0x2d')],_0x52da3d=_0x413600[_0xc5d3('0x2e')],_0x5af8f6=_0x413600[_0xc5d3('0x2e')]+_0x413600[_0xc5d3('0x2f')],_0x31aa57;if(_0x5af8f6>=_0x52f3d7){_0x5af8f6=_0x52f3d7;_0x31aa57=0xc8;}else{_0x31aa57=0xce;}_0x4d97a9['status'](_0x31aa57);return _0x4d97a9['set'](_0xc5d3('0x30'),_0x52da3d+'-'+_0x5af8f6+'/'+_0x52f3d7)[_0xc5d3('0x2c')](_0x58a684);}return null;};}function patchUpdates(_0x4baac9){return function(_0x3eaf9f){try{jsonpatch[_0xc5d3('0x31')](_0x3eaf9f,_0x4baac9,!![]);}catch(_0x45b673){return BPromise[_0xc5d3('0x32')](_0x45b673);}return _0x3eaf9f[_0xc5d3('0x33')]();};}function saveUpdates(_0x1fa9c4,_0x50272f){return function(_0x46617c){if(_0x46617c){return _0x46617c[_0xc5d3('0x34')](_0x1fa9c4)[_0xc5d3('0x1e')](function(_0x5dc574){return _0x5dc574;});}return null;};}function removeEntity(_0x4622f9,_0x2e0e6b){return function(_0x481a2f){if(_0x481a2f){return _0x481a2f[_0xc5d3('0x35')]()['then'](function(){var _0x1d8f66=_0x481a2f[_0xc5d3('0x36')]({'plain':!![]});var _0x549a69=_0xc5d3('0x37');return db[_0xc5d3('0x38')][_0xc5d3('0x35')]({'where':{'type':_0x549a69,'resourceId':_0x1d8f66['id']}})[_0xc5d3('0x1e')](function(){return _0x481a2f;});})[_0xc5d3('0x1e')](function(){_0x4622f9[_0xc5d3('0x2a')](0xcc)[_0xc5d3('0x2b')]();});}};}function handleEntityNotFound(_0x1a35db,_0xec7f1b){return function(_0x333bf0){if(!_0x333bf0){_0x1a35db[_0xc5d3('0x29')](0x194);}return _0x333bf0;};}function handleError(_0x243020,_0x2d68c4){_0x2d68c4=_0x2d68c4||0x1f4;return function(_0x4eb454){logger['error'](_0x4eb454[_0xc5d3('0x39')]);if(_0x4eb454[_0xc5d3('0x3a')]){delete _0x4eb454[_0xc5d3('0x3a')];}_0x243020[_0xc5d3('0x2a')](_0x2d68c4)[_0xc5d3('0x3b')](_0x4eb454);};}exports[_0xc5d3('0x3c')]=function(_0x2551d5,_0x3c73f2){var _0x4dcac9={'include':[{'model':db[_0xc5d3('0x3d')],'as':_0xc5d3('0x3e')}]},_0x434277={},_0x284122={'count':0x0,'rows':[]};var _0x4cc2d7=_[_0xc5d3('0x3f')](db[_0xc5d3('0x40')]['rawAttributes'],function(_0x3312a2){return{'name':_0x3312a2[_0xc5d3('0x41')],'type':_0x3312a2[_0xc5d3('0x42')][_0xc5d3('0x43')]};});_0x434277[_0xc5d3('0x44')]=_['map'](_0x4cc2d7,_0xc5d3('0x3a'));_0x434277[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x2551d5['query']);_0x434277[_0xc5d3('0x47')]=_[_0xc5d3('0x48')](_0x434277[_0xc5d3('0x44')],_0x434277[_0xc5d3('0x45')]);_0x4dcac9[_0xc5d3('0x49')]=_['intersection'](_0x434277[_0xc5d3('0x44')],qs[_0xc5d3('0x4a')](_0x2551d5[_0xc5d3('0x45')][_0xc5d3('0x4a')]));_0x4dcac9[_0xc5d3('0x49')]=_0x4dcac9['attributes'][_0xc5d3('0x4b')]?_0x4dcac9[_0xc5d3('0x49')]:_0x434277['model'];if(!_0x2551d5[_0xc5d3('0x45')][_0xc5d3('0x4c')](_0xc5d3('0x4d'))){_0x4dcac9[_0xc5d3('0x2f')]=qs[_0xc5d3('0x2f')](_0x2551d5[_0xc5d3('0x45')]['limit']);_0x4dcac9[_0xc5d3('0x2e')]=qs[_0xc5d3('0x2e')](_0x2551d5[_0xc5d3('0x45')]['offset']);}_0x4dcac9[_0xc5d3('0x4e')]=qs['sort'](_0x2551d5[_0xc5d3('0x45')][_0xc5d3('0x4f')]);_0x4dcac9[_0xc5d3('0x50')]=qs[_0xc5d3('0x47')](_[_0xc5d3('0x51')](_0x2551d5[_0xc5d3('0x45')],_0x434277['filters']),_0x4cc2d7);if(_0x2551d5[_0xc5d3('0x45')][_0xc5d3('0x52')]){_0x4dcac9['where']=_[_0xc5d3('0x53')](_0x4dcac9[_0xc5d3('0x50')],{'$or':_['map'](_0x4cc2d7,function(_0x469dbf){if(_0x469dbf[_0xc5d3('0x42')]!==_0xc5d3('0x54')){var _0x5f49b9={};_0x5f49b9[_0x469dbf['name']]={'$like':'%'+_0x2551d5[_0xc5d3('0x45')]['filter']+'%'};return _0x5f49b9;}})});}_0x4dcac9=_[_0xc5d3('0x53')]({},_0x4dcac9,_0x2551d5[_0xc5d3('0x55')]);var _0x5d9d19={'where':_0x4dcac9[_0xc5d3('0x50')]};return db[_0xc5d3('0x40')][_0xc5d3('0x2d')](_0x5d9d19)['then'](function(_0x4a3542){_0x284122[_0xc5d3('0x2d')]=_0x4a3542;if(_0x2551d5[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x4dcac9[_0xc5d3('0x57')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x4dcac9);})[_0xc5d3('0x1e')](function(_0x279cf2){_0x284122[_0xc5d3('0x58')]=_0x279cf2;return _0x284122;})['then'](respondWithFilteredResult(_0x3c73f2,_0x4dcac9))[_0xc5d3('0x28')](handleError(_0x3c73f2,null));};exports[_0xc5d3('0x59')]=function(_0x5430e5,_0x4e5965){var _0x1692bb={'raw':![],'where':{'id':_0x5430e5[_0xc5d3('0x5a')]['id']},'include':[{'model':db[_0xc5d3('0x3d')],'as':_0xc5d3('0x3e')}]},_0x5182be={};_0x5182be[_0xc5d3('0x44')]=_['keys'](db['FaxAccount'][_0xc5d3('0x5b')]);_0x5182be[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x5430e5[_0xc5d3('0x45')]);_0x5182be['filtears']=_[_0xc5d3('0x48')](_0x5182be[_0xc5d3('0x44')],_0x5182be['query']);_0x1692bb['attributes']=_['intersection'](_0x5182be[_0xc5d3('0x44')],qs[_0xc5d3('0x4a')](_0x5430e5[_0xc5d3('0x45')]['fields']));_0x1692bb[_0xc5d3('0x49')]=_0x1692bb[_0xc5d3('0x49')][_0xc5d3('0x4b')]?_0x1692bb[_0xc5d3('0x49')]:_0x5182be['model'];if(_0x5430e5[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x1692bb[_0xc5d3('0x57')]=[{'all':!![]}];}_0x1692bb=_[_0xc5d3('0x53')]({},_0x1692bb,_0x5430e5[_0xc5d3('0x55')]);return db[_0xc5d3('0x40')]['find'](_0x1692bb)['then'](handleEntityNotFound(_0x4e5965,null))[_0xc5d3('0x1e')](respondWithResult(_0x4e5965,null))[_0xc5d3('0x28')](handleError(_0x4e5965,null));};exports[_0xc5d3('0x5c')]=function(_0x20c8ee,_0x4cc5e5){return db[_0xc5d3('0x40')]['create'](_0x20c8ee[_0xc5d3('0x5d')],{})[_0xc5d3('0x1e')](function(_0x1fbe0a){var _0x5bee0e=_0x20c8ee['user'][_0xc5d3('0x36')]({'plain':!![]});if(!_0x5bee0e)throw new Error(_0xc5d3('0x5e'));if(_0x5bee0e['role']==='user'){var _0x1fa9bc=_0x1fbe0a[_0xc5d3('0x36')]({'plain':!![]});var _0x494ae2=_0xc5d3('0x37');return db[_0xc5d3('0x5f')][_0xc5d3('0x60')]({'where':{'name':_0x494ae2,'userProfileId':_0x5bee0e[_0xc5d3('0x61')]},'raw':!![]})[_0xc5d3('0x1e')](function(_0x5c0fb4){if(_0x5c0fb4&&_0x5c0fb4[_0xc5d3('0x62')]===0x0){return db[_0xc5d3('0x38')][_0xc5d3('0x5c')]({'name':_0x1fa9bc[_0xc5d3('0x3a')],'resourceId':_0x1fa9bc['id'],'type':_0x5c0fb4[_0xc5d3('0x3a')],'sectionId':_0x5c0fb4['id']},{})[_0xc5d3('0x1e')](function(){return _0x1fbe0a;});}else{return _0x1fbe0a;}})[_0xc5d3('0x28')](function(_0x5c712f){logger[_0xc5d3('0x24')](_0xc5d3('0x63'),_0x5c712f);throw _0x5c712f;});}return _0x1fbe0a;})['then'](respondWithResult(_0x4cc5e5,0xc9))['catch'](handleError(_0x4cc5e5,null));};exports[_0xc5d3('0x34')]=function(_0x3bdf49,_0x3d616b){if(_0x3bdf49[_0xc5d3('0x5d')]['id']){delete _0x3bdf49[_0xc5d3('0x5d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3bdf49[_0xc5d3('0x5a')]['id']},'include':[{'model':db[_0xc5d3('0x3d')],'as':_0xc5d3('0x3e')}]})[_0xc5d3('0x1e')](handleEntityNotFound(_0x3d616b,null))['then'](saveUpdates(_0x3bdf49[_0xc5d3('0x5d')],null))[_0xc5d3('0x1e')](respondWithResult(_0x3d616b,null))[_0xc5d3('0x28')](handleError(_0x3d616b,null));};exports[_0xc5d3('0x35')]=function(_0x38d630,_0x5e1445){return db[_0xc5d3('0x40')][_0xc5d3('0x60')]({'where':{'id':_0x38d630[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x5e1445,null))[_0xc5d3('0x1e')](removeEntity(_0x5e1445,null))['catch'](handleError(_0x5e1445,null));};exports['describe']=function(_0x364817,_0x5d2263){return db[_0xc5d3('0x40')]['describe']()[_0xc5d3('0x1e')](respondWithResult(_0x5d2263,null))[_0xc5d3('0x28')](handleError(_0x5d2263,null));};exports[_0xc5d3('0x64')]=function(_0x2aff17,_0x11a442,_0x360943){if(_0x2aff17[_0xc5d3('0x5d')]['id']){delete _0x2aff17[_0xc5d3('0x5d')]['id'];}return db[_0xc5d3('0x40')][_0xc5d3('0x60')]({'where':{'id':_0x2aff17[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x11a442,null))[_0xc5d3('0x1e')](function(_0x505f03){if(_0x505f03){_0x2aff17[_0xc5d3('0x5d')][_0xc5d3('0x65')]=_0x505f03['id'];return db[_0xc5d3('0x66')]['create'](_0x2aff17[_0xc5d3('0x5d')]);}})[_0xc5d3('0x1e')](respondWithResult(_0x11a442,null))[_0xc5d3('0x28')](handleError(_0x11a442,null));};exports[_0xc5d3('0x67')]=function(_0x93e449,_0x51d275,_0x2fb0d7){var _0x1f6964={'raw':![],'where':{}};var _0x185a27={};var _0x336225={'count':0x0,'rows':[]};return db[_0xc5d3('0x40')][_0xc5d3('0x68')]({'where':{'id':_0x93e449[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x51d275,null))[_0xc5d3('0x1e')](function(_0x32c47d){if(_0x32c47d){_0x185a27[_0xc5d3('0x44')]=_['keys'](db[_0xc5d3('0x66')]['rawAttributes']);_0x185a27[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x93e449[_0xc5d3('0x45')]);_0x185a27[_0xc5d3('0x47')]=_['intersection'](_0x185a27[_0xc5d3('0x44')],_0x185a27['query']);_0x1f6964[_0xc5d3('0x49')]=_[_0xc5d3('0x48')](_0x185a27['model'],qs[_0xc5d3('0x4a')](_0x93e449[_0xc5d3('0x45')][_0xc5d3('0x4a')]));_0x1f6964['attributes']=_0x1f6964[_0xc5d3('0x49')][_0xc5d3('0x4b')]?_0x1f6964[_0xc5d3('0x49')]:_0x185a27['model'];if(!_0x93e449[_0xc5d3('0x45')]['hasOwnProperty']('nolimit')){_0x1f6964[_0xc5d3('0x2f')]=qs[_0xc5d3('0x2f')](_0x93e449['query'][_0xc5d3('0x2f')]);_0x1f6964[_0xc5d3('0x2e')]=qs[_0xc5d3('0x2e')](_0x93e449[_0xc5d3('0x45')][_0xc5d3('0x2e')]);}_0x1f6964['order']=qs[_0xc5d3('0x4f')](_0x93e449['query']['sort']);_0x1f6964[_0xc5d3('0x50')]=qs[_0xc5d3('0x47')](_[_0xc5d3('0x51')](_0x93e449[_0xc5d3('0x45')],_0x185a27[_0xc5d3('0x47')]));_0x1f6964[_0xc5d3('0x50')][_0xc5d3('0x65')]=_0x32c47d['id'];if(_0x93e449[_0xc5d3('0x45')]['filter']){_0x1f6964[_0xc5d3('0x50')]=_['merge'](_0x1f6964[_0xc5d3('0x50')],{'$or':_[_0xc5d3('0x3f')](_0x1f6964['attributes'],function(_0x10645b){var _0x6d6fef={};_0x6d6fef[_0x10645b]={'$like':'%'+_0x93e449[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x6d6fef;})});}_0x1f6964=_[_0xc5d3('0x53')]({},_0x1f6964,_0x93e449['options']);return db[_0xc5d3('0x66')][_0xc5d3('0x2d')]({'where':_0x1f6964[_0xc5d3('0x50')]})[_0xc5d3('0x1e')](function(_0x6a3b14){_0x336225[_0xc5d3('0x2d')]=_0x6a3b14;if(_0x93e449[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x1f6964[_0xc5d3('0x57')]=[{'all':!![]}];}return db[_0xc5d3('0x66')][_0xc5d3('0x69')](_0x1f6964);})[_0xc5d3('0x1e')](function(_0x5c8ea6){_0x336225[_0xc5d3('0x58')]=_0x5c8ea6;return _0x336225;});}})[_0xc5d3('0x1e')](respondWithFilteredResult(_0x51d275,_0x1f6964))[_0xc5d3('0x28')](handleError(_0x51d275,null));};exports[_0xc5d3('0x6a')]=function(_0x5191c9,_0x1d86fc,_0x1c73b0){return db[_0xc5d3('0x40')][_0xc5d3('0x60')]({'where':{'id':_0x5191c9['params']['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x1d86fc,null))[_0xc5d3('0x1e')](function(_0x321bf3){if(_0x321bf3){return _0x321bf3[_0xc5d3('0x6a')](_0x5191c9[_0xc5d3('0x45')]['ids']);}})[_0xc5d3('0x1e')](respondWithStatusCode(_0x1d86fc,null))[_0xc5d3('0x28')](handleError(_0x1d86fc,null));};exports[_0xc5d3('0x6b')]=function(_0x575830,_0x503c86,_0x3c938f){if(_0x575830[_0xc5d3('0x5d')]['id']){delete _0x575830[_0xc5d3('0x5d')]['id'];}return db[_0xc5d3('0x40')][_0xc5d3('0x60')]({'where':{'id':_0x575830['params']['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x503c86,null))[_0xc5d3('0x1e')](function(_0x352701){if(_0x352701){_0x575830[_0xc5d3('0x5d')][_0xc5d3('0x65')]=_0x352701['id'];return db[_0xc5d3('0x6c')][_0xc5d3('0x5c')](_0x575830[_0xc5d3('0x5d')]);}})['then'](respondWithResult(_0x503c86,null))[_0xc5d3('0x28')](handleError(_0x503c86,null));};exports[_0xc5d3('0x6d')]=function(_0x3d87c0,_0x16f331,_0x155921){var _0x4ccb33={'raw':![],'where':{}};var _0x384add={};var _0x5b6ea0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc5d3('0x68')]({'where':{'id':_0x3d87c0[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x16f331,null))['then'](function(_0x25d229){if(_0x25d229){_0x384add[_0xc5d3('0x44')]=_[_0xc5d3('0x46')](db[_0xc5d3('0x6c')][_0xc5d3('0x5b')]);_0x384add[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x3d87c0[_0xc5d3('0x45')]);_0x384add[_0xc5d3('0x47')]=_[_0xc5d3('0x48')](_0x384add[_0xc5d3('0x44')],_0x384add[_0xc5d3('0x45')]);_0x4ccb33[_0xc5d3('0x49')]=_['intersection'](_0x384add['model'],qs[_0xc5d3('0x4a')](_0x3d87c0[_0xc5d3('0x45')]['fields']));_0x4ccb33['attributes']=_0x4ccb33[_0xc5d3('0x49')][_0xc5d3('0x4b')]?_0x4ccb33[_0xc5d3('0x49')]:_0x384add[_0xc5d3('0x44')];if(!_0x3d87c0[_0xc5d3('0x45')]['hasOwnProperty'](_0xc5d3('0x4d'))){_0x4ccb33['limit']=qs['limit'](_0x3d87c0[_0xc5d3('0x45')][_0xc5d3('0x2f')]);_0x4ccb33[_0xc5d3('0x2e')]=qs[_0xc5d3('0x2e')](_0x3d87c0['query'][_0xc5d3('0x2e')]);}_0x4ccb33[_0xc5d3('0x4e')]=qs['sort'](_0x3d87c0[_0xc5d3('0x45')]['sort']);_0x4ccb33['where']=qs['filters'](_[_0xc5d3('0x51')](_0x3d87c0[_0xc5d3('0x45')],_0x384add[_0xc5d3('0x47')]));_0x4ccb33[_0xc5d3('0x50')][_0xc5d3('0x65')]=_0x25d229['id'];if(_0x3d87c0[_0xc5d3('0x45')][_0xc5d3('0x52')]){_0x4ccb33['where']=_[_0xc5d3('0x53')](_0x4ccb33[_0xc5d3('0x50')],{'$or':_[_0xc5d3('0x3f')](_0x4ccb33[_0xc5d3('0x49')],function(_0x564fab){var _0x42a6a9={};_0x42a6a9[_0x564fab]={'$like':'%'+_0x3d87c0[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x42a6a9;})});}_0x4ccb33=_['merge']({},_0x4ccb33,_0x3d87c0[_0xc5d3('0x55')]);return db['CannedAnswer']['count']({'where':_0x4ccb33[_0xc5d3('0x50')]})[_0xc5d3('0x1e')](function(_0x49bcd0){_0x5b6ea0[_0xc5d3('0x2d')]=_0x49bcd0;if(_0x3d87c0[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x4ccb33[_0xc5d3('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc5d3('0x69')](_0x4ccb33);})[_0xc5d3('0x1e')](function(_0x210053){_0x5b6ea0[_0xc5d3('0x58')]=_0x210053;return _0x5b6ea0;});}})[_0xc5d3('0x1e')](respondWithFilteredResult(_0x16f331,_0x4ccb33))[_0xc5d3('0x28')](handleError(_0x16f331,null));};exports[_0xc5d3('0x6e')]=function(_0x2136d4,_0x400951,_0x466a24){return db[_0xc5d3('0x40')]['find']({'where':{'id':_0x2136d4[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x400951,null))[_0xc5d3('0x1e')](function(_0x27890f){if(_0x27890f){return _0x27890f[_0xc5d3('0x6e')](_0x2136d4['query'][_0xc5d3('0x6f')]);}})[_0xc5d3('0x1e')](respondWithStatusCode(_0x400951,null))[_0xc5d3('0x28')](handleError(_0x400951,null));};exports['addInteraction']=function(_0x428fce,_0x2ec87f,_0x5bdaaf){return db[_0xc5d3('0x70')][_0xc5d3('0x60')]({'where':{'id':_0x428fce[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x2ec87f,null))[_0xc5d3('0x1e')](function(_0x9aead6){if(_0x9aead6){return _0x9aead6[_0xc5d3('0x71')](_0x428fce[_0xc5d3('0x5d')][_0xc5d3('0x6f')],_[_0xc5d3('0x72')](_0x428fce['body'],[_0xc5d3('0x6f'),'id'])||{});}})[_0xc5d3('0x1e')](respondWithResult(_0x2ec87f,null))[_0xc5d3('0x28')](handleError(_0x2ec87f,null));};exports[_0xc5d3('0x73')]=function(_0x50fe3c,_0x42d267,_0x51fa1d){var _0x14f60d={'raw':![],'where':{}};var _0x1bf884={};var _0x434e2b={'count':0x0,'rows':[]};return db[_0xc5d3('0x40')]['findOne']({'where':{'id':_0x50fe3c['params']['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x42d267,null))[_0xc5d3('0x1e')](function(_0x2b6119){if(_0x2b6119){_0x1bf884[_0xc5d3('0x44')]=_[_0xc5d3('0x46')](db[_0xc5d3('0x70')][_0xc5d3('0x5b')]);_0x1bf884[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x50fe3c[_0xc5d3('0x45')]);_0x1bf884[_0xc5d3('0x47')]=_[_0xc5d3('0x48')](_0x1bf884[_0xc5d3('0x44')],_0x1bf884[_0xc5d3('0x45')]);_0x14f60d[_0xc5d3('0x49')]=_['intersection'](_0x1bf884['model'],qs[_0xc5d3('0x4a')](_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x4a')]));_0x14f60d[_0xc5d3('0x49')]=_0x14f60d['attributes'][_0xc5d3('0x4b')]?_0x14f60d['attributes']:_0x1bf884[_0xc5d3('0x44')];if(!_0x50fe3c[_0xc5d3('0x45')]['hasOwnProperty'](_0xc5d3('0x4d'))){_0x14f60d[_0xc5d3('0x2f')]=qs[_0xc5d3('0x2f')](_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x2f')]);_0x14f60d[_0xc5d3('0x2e')]=qs[_0xc5d3('0x2e')](_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x2e')]);}_0x14f60d[_0xc5d3('0x4e')]=qs[_0xc5d3('0x4f')](_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x4f')]);_0x14f60d[_0xc5d3('0x50')]=qs['filters'](_[_0xc5d3('0x51')](_0x50fe3c[_0xc5d3('0x45')],_0x1bf884[_0xc5d3('0x47')]));_0x14f60d['where'][_0xc5d3('0x65')]=_0x2b6119['id'];if(_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x52')]){_0x14f60d[_0xc5d3('0x50')]=_[_0xc5d3('0x53')](_0x14f60d['where'],{'$or':_[_0xc5d3('0x3f')](_0x14f60d[_0xc5d3('0x49')],function(_0x5c640f){var _0x29d0fe={};_0x29d0fe[_0x5c640f]={'$like':'%'+_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x29d0fe;})});}_0x14f60d=_['merge']({},_0x14f60d,_0x50fe3c['options']);return db['FaxInteraction']['count']({'where':_0x14f60d[_0xc5d3('0x50')]})[_0xc5d3('0x1e')](function(_0x4a0843){_0x434e2b[_0xc5d3('0x2d')]=_0x4a0843;if(_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x14f60d[_0xc5d3('0x57')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xc5d3('0x74')],'as':_0xc5d3('0x75'),'attributes':[_0xc5d3('0x3a'),_0xc5d3('0x76'),_0xc5d3('0x77')],'required':![]},{'model':db[_0xc5d3('0x78')],'as':_0xc5d3('0x79'),'attributes':['id',_0xc5d3('0x3a'),'color'],'where':_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x7a')]?{'id':_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x7a')]}:undefined,'required':_0x50fe3c[_0xc5d3('0x45')][_0xc5d3('0x7a')]?!![]:![]}];}return db[_0xc5d3('0x70')]['findAll'](_0x14f60d);})[_0xc5d3('0x1e')](function(_0x5f5064){_0x434e2b[_0xc5d3('0x58')]=_0x5f5064;return _0x434e2b;});}})['then'](respondWithFilteredResult(_0x42d267,_0x14f60d))[_0xc5d3('0x28')](handleError(_0x42d267,null));};exports[_0xc5d3('0x7b')]=function(_0x18d0d5,_0x543006,_0x350f7d){return db['FaxAccount'][_0xc5d3('0x68')]({'where':{'id':_0x18d0d5[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x543006,null))[_0xc5d3('0x1e')](function(_0x57adb9){if(_0x57adb9){return db[_0xc5d3('0x7c')][_0xc5d3('0x7d')](function(_0x8c1b9f){return db[_0xc5d3('0x7e')]['destroy']({'where':{'FaxAccountId':_0x18d0d5['params']['id']},'transaction':_0x8c1b9f})['then'](function(_0x5e8bb7){var _0x281cef=_['map'](_0x18d0d5[_0xc5d3('0x5d')],function(_0x46e99e){_0x46e99e[_0xc5d3('0x65')]=_0x18d0d5[_0xc5d3('0x5a')]['id'];return _0x46e99e;});return db[_0xc5d3('0x7e')][_0xc5d3('0x7f')](_0x281cef,{'transaction':_0x8c1b9f});});})[_0xc5d3('0x1e')](function(){return db[_0xc5d3('0x7e')][_0xc5d3('0x80')]({'where':{'FaxAccountId':_0x18d0d5[_0xc5d3('0x5a')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x543006,null))['catch'](handleError(_0x543006,null));};exports[_0xc5d3('0x81')]=function(_0x3c6bbf,_0x4c0bfd,_0x4c72b2){var _0x1b60e2={};var _0x4590b0={};var _0x120964;var _0x4b22dd;return db['FaxAccount'][_0xc5d3('0x68')]({'where':{'id':_0x3c6bbf[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x4c0bfd,null))[_0xc5d3('0x1e')](function(_0x3134a5){if(_0x3134a5){_0x120964=_0x3134a5;_0x4590b0[_0xc5d3('0x44')]=_['keys'](db[_0xc5d3('0x7e')][_0xc5d3('0x5b')]);_0x4590b0[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x3c6bbf[_0xc5d3('0x45')]);_0x4590b0[_0xc5d3('0x47')]=_[_0xc5d3('0x48')](_0x4590b0[_0xc5d3('0x44')],_0x4590b0[_0xc5d3('0x45')]);_0x1b60e2['attributes']=_[_0xc5d3('0x48')](_0x4590b0[_0xc5d3('0x44')],qs['fields'](_0x3c6bbf[_0xc5d3('0x45')][_0xc5d3('0x4a')]));_0x1b60e2['attributes']=_0x1b60e2[_0xc5d3('0x49')][_0xc5d3('0x4b')]?_0x1b60e2[_0xc5d3('0x49')]:_0x4590b0['model'];_0x1b60e2[_0xc5d3('0x4e')]=qs[_0xc5d3('0x4f')](_0x3c6bbf[_0xc5d3('0x45')][_0xc5d3('0x4f')]);_0x1b60e2[_0xc5d3('0x50')]=qs[_0xc5d3('0x47')](_['pick'](_0x3c6bbf[_0xc5d3('0x45')],_0x4590b0['filters']));if(_0x3c6bbf['query'][_0xc5d3('0x52')]){_0x1b60e2['where']=_['merge'](_0x1b60e2[_0xc5d3('0x50')],{'$or':_[_0xc5d3('0x3f')](_0x1b60e2[_0xc5d3('0x49')],function(_0x46b6fd){var _0x3b2d41={};_0x3b2d41[_0x46b6fd]={'$like':'%'+_0x3c6bbf[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x3b2d41;})});}_0x1b60e2=_[_0xc5d3('0x53')]({},_0x1b60e2,_0x3c6bbf['options']);return _0x120964[_0xc5d3('0x81')](_0x1b60e2);}})['then'](function(_0x25ddaf){if(_0x25ddaf){_0x4b22dd=_0x25ddaf['length'];if(!_0x3c6bbf[_0xc5d3('0x45')][_0xc5d3('0x4c')](_0xc5d3('0x4d'))){_0x1b60e2[_0xc5d3('0x2f')]=qs[_0xc5d3('0x2f')](_0x3c6bbf['query'][_0xc5d3('0x2f')]);_0x1b60e2['offset']=qs[_0xc5d3('0x2e')](_0x3c6bbf[_0xc5d3('0x45')][_0xc5d3('0x2e')]);}return _0x120964[_0xc5d3('0x81')](_0x1b60e2);}})['then'](function(_0x1fe2d9){if(_0x1fe2d9){return _0x1fe2d9?{'count':_0x4b22dd,'rows':_0x1fe2d9}:null;}})[_0xc5d3('0x1e')](respondWithResult(_0x4c0bfd,null))['catch'](handleError(_0x4c0bfd,null));};function Extension(_0x5570e9,_0x2e2477,_0x122ae5,_0xca90d1){this[_0xc5d3('0x82')]=_0xc5d3('0x83');this[_0xc5d3('0x84')]=_0x5570e9[_0xc5d3('0x85')];this['app']=_0xca90d1;this[_0xc5d3('0x42')]=_0xc5d3('0x86');this['description']=_0xc5d3('0x87');this['FaxAccountId']=_0x5570e9['id'];this[_0xc5d3('0x88')]=_0x2e2477;this[_0xc5d3('0x89')]=_0x122ae5;}function createExtensionsReciveFax(_0x3c9e0d){var _0x47f079=0x1;var _0x309009=[];_0x309009['push'](new Extension(_0x3c9e0d,_0x47f079,'',_0xc5d3('0x8a')));_0x47f079+=0x1;_0x309009[_0xc5d3('0x8b')](new Extension(_0x3c9e0d,_0x47f079,_0xc5d3('0x8c'),_0xc5d3('0x8d')));_0x47f079+=0x1;for(var _0x872b5b in _0x3c9e0d){if(_0x3c9e0d[_0xc5d3('0x4c')](_0x872b5b)&&(_0x872b5b===_0xc5d3('0x8e')||_0x872b5b===_0xc5d3('0x85')||_0x872b5b===_0xc5d3('0x8f')||_0x872b5b===_0xc5d3('0x90')||_0x872b5b===_0xc5d3('0x91')||_0x872b5b==='maxrate'||_0x872b5b==='minrate'||_0x872b5b===_0xc5d3('0x92')||_0x872b5b==='t38timeout')){_0x309009['push'](new Extension(_0x3c9e0d,_0x47f079,_0xc5d3('0x93')+_0x872b5b+')='+_0x3c9e0d[_0x872b5b],_0xc5d3('0x8d')));_0x47f079+=0x1;}}_0x309009[_0xc5d3('0x8b')](new Extension(_0x3c9e0d,_0x47f079,'6',_0xc5d3('0x94')));_0x47f079+=0x1;_0x309009[_0xc5d3('0x8b')](new Extension(_0x3c9e0d,_0x47f079,_0xc5d3('0x95'),_0xc5d3('0x96')));_0x47f079=0x0;return _0x309009;}exports[_0xc5d3('0x97')]=function(_0x131860,_0x5c2530,_0x217347){var _0x3b78ff;return db[_0xc5d3('0x7c')][_0xc5d3('0x7d')](function(_0x4b64cb){return db[_0xc5d3('0x40')][_0xc5d3('0x5c')](_0x131860[_0xc5d3('0x5d')],{'transaction':_0x4b64cb})[_0xc5d3('0x1e')](function(_0x27af42){_0x3b78ff=_0x27af42[_0xc5d3('0x36')]({'plain':!![]});return db[_0xc5d3('0x98')][_0xc5d3('0x7f')](createExtensionsReciveFax(_0x3b78ff),{'transaction':_0x4b64cb});});})[_0xc5d3('0x1e')](function(){return _0x3b78ff;})[_0xc5d3('0x1e')](respondWithResult(_0x5c2530,null))['catch'](handleError(_0x5c2530,null));};exports[_0xc5d3('0x99')]=function(_0x327daa,_0x1e7a5c,_0x5111b8){var _0x2fc49b;return db[_0xc5d3('0x7c')][_0xc5d3('0x7d')](function(_0x5b1114){return db[_0xc5d3('0x40')][_0xc5d3('0x34')](_0x327daa['body'],{'where':{'id':_0x327daa[_0xc5d3('0x5d')]['id']},'transaction':_0x5b1114})['then'](function(_0x2afba2){return db[_0xc5d3('0x98')][_0xc5d3('0x35')]({'where':{'FaxAccountId':_0x327daa[_0xc5d3('0x5d')]['id']},'transaction':_0x5b1114})[_0xc5d3('0x1e')](function(_0x3559f7){return db[_0xc5d3('0x98')][_0xc5d3('0x7f')](createExtensionsReciveFax(_[_0xc5d3('0x72')](_0x327daa[_0xc5d3('0x5d')],[_0xc5d3('0x9a'),_0xc5d3('0x43'),_0xc5d3('0x9b'),'updatedAt',_0xc5d3('0x9c'),_0xc5d3('0x9d')])),{'transaction':_0x5b1114});});});})[_0xc5d3('0x1e')](function(){return db[_0xc5d3('0x40')][_0xc5d3('0x9e')](_0x327daa[_0xc5d3('0x5d')]['id']);})[_0xc5d3('0x1e')](respondWithResult(_0x1e7a5c,null))[_0xc5d3('0x28')](handleError(_0x1e7a5c,null));};exports['getMessages']=function(_0x721192,_0x314eba,_0x36ee61){var _0x3493ba={'raw':!![],'where':{}};var _0x5bea27={};var _0x2216f6={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc5d3('0x68')]({'where':{'id':_0x721192[_0xc5d3('0x5a')]['id']}})['then'](handleEntityNotFound(_0x314eba,null))['then'](function(_0x46cc09){if(_0x46cc09){_0x5bea27[_0xc5d3('0x44')]=_[_0xc5d3('0x46')](db[_0xc5d3('0x9f')][_0xc5d3('0x5b')]);_0x5bea27[_0xc5d3('0x45')]=_[_0xc5d3('0x46')](_0x721192[_0xc5d3('0x45')]);_0x5bea27[_0xc5d3('0x47')]=_[_0xc5d3('0x48')](_0x5bea27[_0xc5d3('0x44')],_0x5bea27['query']);_0x3493ba['attributes']=_['intersection'](_0x5bea27['model'],qs[_0xc5d3('0x4a')](_0x721192['query'][_0xc5d3('0x4a')]));_0x3493ba['attributes']=_0x3493ba['attributes'][_0xc5d3('0x4b')]?_0x3493ba['attributes']:_0x5bea27['model'];if(!_0x721192[_0xc5d3('0x45')]['hasOwnProperty'](_0xc5d3('0x4d'))){_0x3493ba[_0xc5d3('0x2f')]=qs['limit'](_0x721192[_0xc5d3('0x45')]['limit']);_0x3493ba[_0xc5d3('0x2e')]=qs[_0xc5d3('0x2e')](_0x721192[_0xc5d3('0x45')][_0xc5d3('0x2e')]);}_0x3493ba[_0xc5d3('0x4e')]=qs[_0xc5d3('0x4f')](_0x721192[_0xc5d3('0x45')]['sort']);_0x3493ba[_0xc5d3('0x50')]=qs[_0xc5d3('0x47')](_[_0xc5d3('0x51')](_0x721192['query'],_0x5bea27[_0xc5d3('0x47')]));_0x3493ba['where'][_0xc5d3('0x65')]=_0x46cc09['id'];if(_0x721192[_0xc5d3('0x45')][_0xc5d3('0x52')]){_0x3493ba[_0xc5d3('0x50')]=_[_0xc5d3('0x53')](_0x3493ba[_0xc5d3('0x50')],{'$or':_[_0xc5d3('0x3f')](_0x3493ba[_0xc5d3('0x49')],function(_0x3842ba){var _0x502d83={};_0x502d83[_0x3842ba]={'$like':'%'+_0x721192[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x502d83;})});}if(_0x721192['query'][_0xc5d3('0xa0')]){var _0x1ae397=_0x721192[_0xc5d3('0x45')]['$gte'][_0xc5d3('0xa1')](',');var _0x335471={};_0x335471[_0x1ae397[0x0]]={'$gte':moment(_0x1ae397[0x1])['format'](_0xc5d3('0xa2'))};_0x3493ba[_0xc5d3('0x50')]=_[_0xc5d3('0x53')](_0x3493ba['where'],_0x335471);}_0x3493ba=_[_0xc5d3('0x53')]({},_0x3493ba,_0x721192[_0xc5d3('0x55')]);return db[_0xc5d3('0x9f')][_0xc5d3('0x2d')]({'where':_0x3493ba['where']})[_0xc5d3('0x1e')](function(_0x21efa4){_0x2216f6[_0xc5d3('0x2d')]=_0x21efa4;if(_0x721192[_0xc5d3('0x45')][_0xc5d3('0x56')]){_0x3493ba[_0xc5d3('0x57')]=[{'all':!![]}];}return db[_0xc5d3('0x9f')][_0xc5d3('0x69')](_0x3493ba);})[_0xc5d3('0x1e')](function(_0x363e17){_0x2216f6['rows']=_0x363e17;return _0x2216f6;});}})[_0xc5d3('0x1e')](respondWithFilteredResult(_0x314eba,_0x3493ba))[_0xc5d3('0x28')](handleError(_0x314eba,null));};exports['send']=function(_0x4d9bfc,_0x106810,_0x31ed06){var _0x52a6e0,_0x4bb0da={},_0x23508d;if(_0x4d9bfc[_0xc5d3('0x5d')]['to']){_0x23508d=_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0];}return db['FaxAccount'][_0xc5d3('0x60')]({'where':{'id':_0x4d9bfc[_0xc5d3('0x5a')]['id']},'include':[{'model':db[_0xc5d3('0xa3')],'as':_0xc5d3('0xa4'),'include':[{'model':db[_0xc5d3('0xa5')],'as':_0xc5d3('0xa6'),'where':{'fax':_0x23508d},'limit':0x1,'order':[[_0xc5d3('0xa7'),_0xc5d3('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x106810,null))[_0xc5d3('0x1e')](function(_0x240e26){_0x52a6e0=_0x240e26;if(_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')]&&_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][_0xc5d3('0x4b')]){for(var _0x23da6d=0x0;_0x23da6d<_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')]['length'];_0x23da6d+=0x1){_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][_0x23da6d]={'filename':_0x4d9bfc['body']['attachments'][_0x23da6d]['name'],'id':_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][_0x23da6d]['id'],'path':path[_0xc5d3('0xaa')](config[_0xc5d3('0xab')],_0xc5d3('0xac'),_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][_0x23da6d][_0xc5d3('0xad')])};}}return respondWithRpcPromise(_0xc5d3('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x4d9bfc[_0xc5d3('0x5a')]['id'])?undefined:_0x4d9bfc[_0xc5d3('0x5a')]['id'],'path':_['isNil'](_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][0x0]['path'])?undefined:_0x4d9bfc['body'][_0xc5d3('0xa9')][0x0][_0xc5d3('0xaf')],'fax':_['isNil'](_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0])?undefined:_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0]},client9002);})[_0xc5d3('0x1e')](function(){if(_0x52a6e0){if(_[_0xc5d3('0xb0')](_0x4d9bfc['body']['from'])){_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xb1')]=util['format'](_0xc5d3('0xb2'),_0x52a6e0[_0xc5d3('0x3a')],_0x52a6e0['fax']);}if(_0x52a6e0[_0xc5d3('0xa4')]){if(_0x52a6e0[_0xc5d3('0xa4')][_0xc5d3('0xa6')][_0xc5d3('0x4b')]){return _0x52a6e0['List'][_0xc5d3('0xa6')][0x0];}else{return db[_0xc5d3('0xa5')][_0xc5d3('0x5c')](_[_0xc5d3('0xb3')](_0x4d9bfc[_0xc5d3('0x5d')],{'firstName':_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0],'phone':_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0],'fax':_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0],'ListId':_0x52a6e0['ListId']}));}}else{throw new Error(_0xc5d3('0xb4'));}}else{throw new Error(_0xc5d3('0xb5'));}})['then'](function(_0x43df42){if(_0x43df42){return db['FaxInteraction'][_0xc5d3('0x60')]({'where':{'ContactId':_0x43df42['id'],'closed':![],'FaxAccountId':_0x52a6e0['id']}})[_0xc5d3('0x1e')](function(_0x22ad2d){if(_0x22ad2d){return[_0x22ad2d,![]];}return db[_0xc5d3('0x70')][_0xc5d3('0x5c')]({'UserId':_0x4d9bfc['user']['id'],'ContactId':_0x43df42['id'],'FaxAccountId':_0x52a6e0['id'],'fax':_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0],'firstMsgDirection':_0xc5d3('0xb6'),'Messages':[_['merge'](_0x4d9bfc[_0xc5d3('0x5d')],{'read':![],'body':_0x4d9bfc['body']['attachments'][0x0][_0xc5d3('0xb7')],'FaxAccountId':_0x52a6e0['id'],'UserId':_0x4d9bfc[_0xc5d3('0xb8')]['id'],'ContactId':_0x43df42['id'],'AttachmentId':_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0xc5d3('0x9f')],'as':'Messages'}]})[_0xc5d3('0x1e')](function(_0xbe2411){return[_0xbe2411,!![]];});});}else{throw new Error(_0xc5d3('0xb9'));}})[_0xc5d3('0xba')](function(_0x144b51,_0x4f4f6d){if(_0x4f4f6d){return _0x144b51;}return db[_0xc5d3('0x9f')][_0xc5d3('0x5c')]({'direction':_0xc5d3('0xb6'),'read':![],'body':_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][0x0]['filename'],'FaxAccountId':_0x52a6e0['id'],'FaxInteractionId':_0x144b51['id'],'UserId':_0x4d9bfc[_0xc5d3('0xb8')]['id'],'ContactId':_0x144b51[_0xc5d3('0xbb')],'AttachmentId':_0x4d9bfc[_0xc5d3('0x5d')][_0xc5d3('0xa9')][0x0]['id']})[_0xc5d3('0x1e')](function(_0x4c3791){_0x144b51['dataValues']['Messages']=[];_0x144b51[_0xc5d3('0xbc')][_0xc5d3('0xbd')][_0xc5d3('0x8b')](_0x4c3791[_0xc5d3('0xbc')]);return _0x144b51;});})[_0xc5d3('0x1e')](function(_0x18b7f6){respondWithRpcPromise(_0xc5d3('0xbe'),_0xc5d3('0xbe'),{'FaxAccountId':_['isNil'](_0x4d9bfc[_0xc5d3('0x5a')]['id'])?undefined:_0x4d9bfc[_0xc5d3('0x5a')]['id'],'path':_[_0xc5d3('0xb0')](_0x4d9bfc[_0xc5d3('0x5d')]['attachments'][0x0][_0xc5d3('0xaf')])?undefined:_0x4d9bfc[_0xc5d3('0x5d')]['attachments'][0x0][_0xc5d3('0xaf')],'fax':_[_0xc5d3('0xb0')](_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0])?undefined:_0x4d9bfc[_0xc5d3('0x5d')]['to'][0x0],'AttachmentId':_0x4d9bfc['body'][_0xc5d3('0xa9')][0x0]['id']},client9002)[_0xc5d3('0x1e')](function(_0x2f2959){logger[_0xc5d3('0x1f')]('SendFaxRpc,\x20%s',_0x2f2959);})['catch'](function(_0x54769b){logger[_0xc5d3('0x1f')](_0xc5d3('0xbf'),_0x54769b);});return _0x18b7f6;})[_0xc5d3('0x1e')](respondWithResult(_0x106810,null))['catch'](handleError(_0x106810,null));};exports[_0xc5d3('0xc0')]=function(_0x5ad318,_0xded22,_0x430f7d){return db[_0xc5d3('0x40')][_0xc5d3('0x60')]({'where':{'id':_0x5ad318[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0xded22,null))[_0xc5d3('0x1e')](function(_0x26bc38){if(_0x26bc38){return _0x26bc38[_0xc5d3('0xc0')](_0x5ad318[_0xc5d3('0x5d')][_0xc5d3('0x6f')],_[_0xc5d3('0x72')](_0x5ad318[_0xc5d3('0x5d')],['ids','id'])||{})[_0xc5d3('0xba')](function(_0x305291){for(var _0x58ff80=0x0;_0x58ff80<_0x5ad318[_0xc5d3('0x5d')][_0xc5d3('0x6f')]['length'];_0x58ff80+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x5ad318['body'][_0xc5d3('0x6f')][_0x58ff80],'FaxAccountId':_0x5ad318[_0xc5d3('0x5a')]['id']});}return _0x305291;});}})['then'](respondWithResult(_0xded22,null))['catch'](handleError(_0xded22,null));};exports[_0xc5d3('0xc1')]=function(_0x27224b,_0x22a3a0,_0x207e98){return db['FaxAccount'][_0xc5d3('0x60')]({'where':{'id':_0x27224b[_0xc5d3('0x5a')]['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x22a3a0,null))[_0xc5d3('0x1e')](function(_0x5f242b){if(_0x5f242b){return _0x5f242b[_0xc5d3('0xc1')](_0x27224b['query'][_0xc5d3('0x6f')])['then'](function(){if(_[_0xc5d3('0xc2')](_0x27224b[_0xc5d3('0x45')]['ids'])){for(var _0xb78ad3=0x0;_0xb78ad3<_0x27224b[_0xc5d3('0x45')][_0xc5d3('0x6f')][_0xc5d3('0x4b')];_0xb78ad3+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x27224b[_0xc5d3('0x45')][_0xc5d3('0x6f')][_0xb78ad3]),'FaxAccountId':Number(_0x27224b[_0xc5d3('0x5a')]['id'])});}}else{socket['emit'](_0xc5d3('0xc3'),{'UserId':Number(_0x27224b[_0xc5d3('0x45')][_0xc5d3('0x6f')]),'FaxAccountId':Number(_0x27224b[_0xc5d3('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x22a3a0,null))[_0xc5d3('0x28')](handleError(_0x22a3a0,null));};exports[_0xc5d3('0xc4')]=function(_0x1dcfb3,_0x442125,_0xba3783){var _0x2ca38f={};var _0x44a957={};var _0x34e455;var _0x4367ea;return db['FaxAccount'][_0xc5d3('0x68')]({'where':{'id':_0x1dcfb3['params']['id']}})[_0xc5d3('0x1e')](handleEntityNotFound(_0x442125,null))['then'](function(_0x1f2c6c){if(_0x1f2c6c){_0x34e455=_0x1f2c6c;_0x44a957['model']=_['keys'](db['User'][_0xc5d3('0x5b')]);_0x44a957[_0xc5d3('0x45')]=_['keys'](_0x1dcfb3[_0xc5d3('0x45')]);_0x44a957[_0xc5d3('0x47')]=_['intersection'](_0x44a957[_0xc5d3('0x44')],_0x44a957['query']);_0x2ca38f[_0xc5d3('0x49')]=_['intersection'](_0x44a957['model'],qs[_0xc5d3('0x4a')](_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x4a')]));_0x2ca38f[_0xc5d3('0x49')]=_0x2ca38f[_0xc5d3('0x49')][_0xc5d3('0x4b')]?_0x2ca38f[_0xc5d3('0x49')]:_0x44a957['model'];_0x2ca38f[_0xc5d3('0x4e')]=qs['sort'](_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x4f')]);_0x2ca38f[_0xc5d3('0x50')]=qs[_0xc5d3('0x47')](_['pick'](_0x1dcfb3['query'],_0x44a957[_0xc5d3('0x47')]));if(_0x1dcfb3['query'][_0xc5d3('0x52')]){_0x2ca38f[_0xc5d3('0x50')]=_[_0xc5d3('0x53')](_0x2ca38f['where'],{'$or':_['map'](_0x2ca38f['attributes'],function(_0x331a79){var _0x1f070d={};_0x1f070d[_0x331a79]={'$like':'%'+_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x52')]+'%'};return _0x1f070d;})});}_0x2ca38f=_[_0xc5d3('0x53')]({},_0x2ca38f,_0x1dcfb3[_0xc5d3('0x55')]);return _0x34e455[_0xc5d3('0xc4')](_0x2ca38f);}})[_0xc5d3('0x1e')](function(_0x5d944d){if(_0x5d944d){_0x4367ea=_0x5d944d[_0xc5d3('0x4b')];if(!_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x4c')]('nolimit')){_0x2ca38f[_0xc5d3('0x2f')]=qs['limit'](_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x2f')]);_0x2ca38f['offset']=qs[_0xc5d3('0x2e')](_0x1dcfb3[_0xc5d3('0x45')][_0xc5d3('0x2e')]);}return _0x34e455['getAgents'](_0x2ca38f);}})['then'](function(_0x1c65ac){if(_0x1c65ac){return _0x1c65ac?{'count':_0x4367ea,'rows':_0x1c65ac}:null;}})[_0xc5d3('0x1e')](respondWithResult(_0x442125,null))['catch'](handleError(_0x442125,null));}; \ No newline at end of file +var _0xc97a=['order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','filtears','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','sort','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','pick','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','omit','createdAt','updatedAt','ListId','findById','FaxMessage','$gte','split','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./faxAccount.socket','register','client','http','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','end','json','count','offset','limit','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0xc97a,0x135));var _0xac97=function(_0x29bf16,_0x2a3278){_0x29bf16=_0x29bf16-0x0;var _0x34c701=_0xc97a[_0x29bf16];return _0x34c701;};'use strict';var pdf=require(_0xac97('0x0'));var emlformat=require(_0xac97('0x1'));var rimraf=require(_0xac97('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac97('0x3'));var moment=require(_0xac97('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac97('0x5'));var path=require(_0xac97('0x6'));var sox=require(_0xac97('0x7'));var csv=require('to-csv');var ejs=require(_0xac97('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac97('0x9'));var crypto=require(_0xac97('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac97('0xb'));var querystring=require(_0xac97('0xc'));var Papa=require(_0xac97('0xd'));var Redis=require('ioredis');var authService=require(_0xac97('0xe'));var qs=require(_0xac97('0xf'));var as=require(_0xac97('0x10'));var hardwareService=require(_0xac97('0x11'));var logger=require(_0xac97('0x12'))(_0xac97('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xac97('0x14'));var db=require(_0xac97('0x15'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xac97('0x16'))(new Redis(config[_0xac97('0x17')]));require(_0xac97('0x18'))[_0xac97('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac97('0x1a')][_0xac97('0x1b')]({'port':0x232c});var client9002=jayson[_0xac97('0x1a')][_0xac97('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x13c292,_0x2fcb85,_0x5d66d3,_0xf02402){return new BPromise(function(_0x47e6f3,_0x3c1c1f){var _0x280109=_0xf02402||client;return _0x280109[_0xac97('0x1c')](_0x13c292,_0x5d66d3)[_0xac97('0x1d')](function(_0x5701cf){logger[_0xac97('0x1e')](_0xac97('0x1f'),_0x2fcb85,_0xac97('0x20'));logger[_0xac97('0x21')](_0xac97('0x22'),_0x2fcb85,_0xac97('0x20'),JSON[_0xac97('0x23')](_0x5701cf));if(_0x5701cf[_0xac97('0x24')]){if(_0x5701cf[_0xac97('0x24')][_0xac97('0x25')]===0x1f4){logger['error'](_0xac97('0x1f'),_0x2fcb85,_0x5701cf['error'][_0xac97('0x26')]);return _0x3c1c1f(_0x5701cf[_0xac97('0x24')][_0xac97('0x26')]);}logger[_0xac97('0x24')](_0xac97('0x1f'),_0x2fcb85,_0x5701cf[_0xac97('0x24')][_0xac97('0x26')]);return _0x47e6f3(_0x5701cf['error'][_0xac97('0x26')]);}else{logger[_0xac97('0x1e')](_0xac97('0x1f'),_0x2fcb85,'request\x20sent');_0x47e6f3(_0x5701cf[_0xac97('0x27')][_0xac97('0x26')]);}})[_0xac97('0x28')](function(_0x35115d){logger[_0xac97('0x24')](_0xac97('0x1f'),_0x2fcb85,_0x35115d);_0x3c1c1f(_0x35115d);});});}function respondWithStatusCode(_0x1aa5d7,_0x571bcf){_0x571bcf=_0x571bcf||0xcc;return function(_0x2fe020){if(_0x2fe020){return _0x1aa5d7[_0xac97('0x29')](_0x571bcf);}return _0x1aa5d7[_0xac97('0x2a')](_0x571bcf)[_0xac97('0x2b')]();};}function respondWithResult(_0x5c8987,_0x4c2eca){_0x4c2eca=_0x4c2eca||0xc8;return function(_0x4ed735){if(_0x4ed735){return _0x5c8987[_0xac97('0x2a')](_0x4c2eca)[_0xac97('0x2c')](_0x4ed735);}};}function respondWithFilteredResult(_0x2dfd00,_0x1a20e9){return function(_0x2ae0da){if(_0x2ae0da){var _0x53ce69=_0x2ae0da[_0xac97('0x2d')],_0x4e1456=_0x1a20e9[_0xac97('0x2e')],_0x4471c6=_0x1a20e9[_0xac97('0x2e')]+_0x1a20e9[_0xac97('0x2f')],_0x5f034f;if(_0x4471c6>=_0x53ce69){_0x4471c6=_0x53ce69;_0x5f034f=0xc8;}else{_0x5f034f=0xce;}_0x2dfd00[_0xac97('0x2a')](_0x5f034f);return _0x2dfd00['set']('Content-Range',_0x4e1456+'-'+_0x4471c6+'/'+_0x53ce69)[_0xac97('0x2c')](_0x2ae0da);}return null;};}function patchUpdates(_0x3f51c2){return function(_0xd60d74){try{jsonpatch[_0xac97('0x30')](_0xd60d74,_0x3f51c2,!![]);}catch(_0x1b74cb){return BPromise['reject'](_0x1b74cb);}return _0xd60d74[_0xac97('0x31')]();};}function saveUpdates(_0x4a4ced,_0x44d497){return function(_0x32196f){if(_0x32196f){return _0x32196f[_0xac97('0x32')](_0x4a4ced)[_0xac97('0x1d')](function(_0x22d4ba){return _0x22d4ba;});}return null;};}function removeEntity(_0x8fce9a,_0x112e22){return function(_0x2db14e){if(_0x2db14e){return _0x2db14e[_0xac97('0x33')]()[_0xac97('0x1d')](function(){var _0x294bcc=_0x2db14e[_0xac97('0x34')]({'plain':!![]});var _0x382276=_0xac97('0x35');return db[_0xac97('0x36')][_0xac97('0x33')]({'where':{'type':_0x382276,'resourceId':_0x294bcc['id']}})[_0xac97('0x1d')](function(){return _0x2db14e;});})[_0xac97('0x1d')](function(){_0x8fce9a[_0xac97('0x2a')](0xcc)[_0xac97('0x2b')]();});}};}function handleEntityNotFound(_0x552cd3,_0x536671){return function(_0x46dc85){if(!_0x46dc85){_0x552cd3[_0xac97('0x29')](0x194);}return _0x46dc85;};}function handleError(_0x578dc2,_0x4428f1){_0x4428f1=_0x4428f1||0x1f4;return function(_0x3013c2){logger['error'](_0x3013c2[_0xac97('0x37')]);if(_0x3013c2[_0xac97('0x38')]){delete _0x3013c2[_0xac97('0x38')];}_0x578dc2[_0xac97('0x2a')](_0x4428f1)[_0xac97('0x39')](_0x3013c2);};}exports[_0xac97('0x3a')]=function(_0x3dfb24,_0x4bb915){var _0xdb9c22={'include':[{'model':db['Pause'],'as':_0xac97('0x3b')}]},_0x107737={},_0x1c3115={'count':0x0,'rows':[]};var _0x15d8b4=_[_0xac97('0x3c')](db[_0xac97('0x3d')][_0xac97('0x3e')],function(_0x1ae48a){return{'name':_0x1ae48a[_0xac97('0x3f')],'type':_0x1ae48a[_0xac97('0x40')][_0xac97('0x41')]};});_0x107737['model']=_['map'](_0x15d8b4,'name');_0x107737[_0xac97('0x42')]=_['keys'](_0x3dfb24[_0xac97('0x42')]);_0x107737[_0xac97('0x43')]=_[_0xac97('0x44')](_0x107737['model'],_0x107737[_0xac97('0x42')]);_0xdb9c22['attributes']=_[_0xac97('0x44')](_0x107737[_0xac97('0x45')],qs[_0xac97('0x46')](_0x3dfb24[_0xac97('0x42')][_0xac97('0x46')]));_0xdb9c22[_0xac97('0x47')]=_0xdb9c22[_0xac97('0x47')][_0xac97('0x48')]?_0xdb9c22[_0xac97('0x47')]:_0x107737[_0xac97('0x45')];if(!_0x3dfb24[_0xac97('0x42')][_0xac97('0x49')](_0xac97('0x4a'))){_0xdb9c22[_0xac97('0x2f')]=qs['limit'](_0x3dfb24[_0xac97('0x42')][_0xac97('0x2f')]);_0xdb9c22['offset']=qs[_0xac97('0x2e')](_0x3dfb24['query'][_0xac97('0x2e')]);}_0xdb9c22[_0xac97('0x4b')]=qs['sort'](_0x3dfb24[_0xac97('0x42')]['sort']);_0xdb9c22[_0xac97('0x4c')]=qs[_0xac97('0x43')](_['pick'](_0x3dfb24[_0xac97('0x42')],_0x107737[_0xac97('0x43')]),_0x15d8b4);if(_0x3dfb24['query'][_0xac97('0x4d')]){_0xdb9c22[_0xac97('0x4c')]=_[_0xac97('0x4e')](_0xdb9c22[_0xac97('0x4c')],{'$or':_[_0xac97('0x3c')](_0x15d8b4,function(_0x27dbbe){if(_0x27dbbe[_0xac97('0x40')]!==_0xac97('0x4f')){var _0x2d7e1b={};_0x2d7e1b[_0x27dbbe[_0xac97('0x38')]]={'$like':'%'+_0x3dfb24[_0xac97('0x42')][_0xac97('0x4d')]+'%'};return _0x2d7e1b;}})});}_0xdb9c22=_['merge']({},_0xdb9c22,_0x3dfb24[_0xac97('0x50')]);var _0x2c0103={'where':_0xdb9c22[_0xac97('0x4c')]};return db['FaxAccount'][_0xac97('0x2d')](_0x2c0103)[_0xac97('0x1d')](function(_0x46fc0f){_0x1c3115[_0xac97('0x2d')]=_0x46fc0f;if(_0x3dfb24[_0xac97('0x42')][_0xac97('0x51')]){_0xdb9c22[_0xac97('0x52')]=[{'all':!![]}];}return db[_0xac97('0x3d')][_0xac97('0x53')](_0xdb9c22);})[_0xac97('0x1d')](function(_0x493731){_0x1c3115[_0xac97('0x54')]=_0x493731;return _0x1c3115;})['then'](respondWithFilteredResult(_0x4bb915,_0xdb9c22))[_0xac97('0x28')](handleError(_0x4bb915,null));};exports[_0xac97('0x55')]=function(_0x4802b3,_0x3832a0){var _0x1bcf80={'raw':![],'where':{'id':_0x4802b3[_0xac97('0x56')]['id']},'include':[{'model':db[_0xac97('0x57')],'as':_0xac97('0x3b')}]},_0x556f4f={};_0x556f4f[_0xac97('0x45')]=_[_0xac97('0x58')](db[_0xac97('0x3d')][_0xac97('0x3e')]);_0x556f4f[_0xac97('0x42')]=_[_0xac97('0x58')](_0x4802b3[_0xac97('0x42')]);_0x556f4f[_0xac97('0x59')]=_['intersection'](_0x556f4f['model'],_0x556f4f['query']);_0x1bcf80['attributes']=_[_0xac97('0x44')](_0x556f4f[_0xac97('0x45')],qs[_0xac97('0x46')](_0x4802b3[_0xac97('0x42')][_0xac97('0x46')]));_0x1bcf80[_0xac97('0x47')]=_0x1bcf80[_0xac97('0x47')][_0xac97('0x48')]?_0x1bcf80[_0xac97('0x47')]:_0x556f4f[_0xac97('0x45')];if(_0x4802b3[_0xac97('0x42')][_0xac97('0x51')]){_0x1bcf80['include']=[{'all':!![]}];}_0x1bcf80=_[_0xac97('0x4e')]({},_0x1bcf80,_0x4802b3[_0xac97('0x50')]);return db[_0xac97('0x3d')]['find'](_0x1bcf80)[_0xac97('0x1d')](handleEntityNotFound(_0x3832a0,null))[_0xac97('0x1d')](respondWithResult(_0x3832a0,null))['catch'](handleError(_0x3832a0,null));};exports[_0xac97('0x5a')]=function(_0x10f564,_0xe32c15){return db['FaxAccount']['create'](_0x10f564[_0xac97('0x5b')],{})[_0xac97('0x1d')](function(_0x1eb52f){var _0x545282=_0x10f564[_0xac97('0x5c')][_0xac97('0x34')]({'plain':!![]});if(!_0x545282)throw new Error(_0xac97('0x5d'));if(_0x545282[_0xac97('0x5e')]===_0xac97('0x5c')){var _0x1a0011=_0x1eb52f['get']({'plain':!![]});var _0x2c4a59=_0xac97('0x35');return db['UserProfileSection'][_0xac97('0x5f')]({'where':{'name':_0x2c4a59,'userProfileId':_0x545282[_0xac97('0x60')]},'raw':!![]})[_0xac97('0x1d')](function(_0x14da56){if(_0x14da56&&_0x14da56[_0xac97('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a0011[_0xac97('0x38')],'resourceId':_0x1a0011['id'],'type':_0x14da56[_0xac97('0x38')],'sectionId':_0x14da56['id']},{})[_0xac97('0x1d')](function(){return _0x1eb52f;});}else{return _0x1eb52f;}})[_0xac97('0x28')](function(_0x539cf8){logger['error'](_0xac97('0x62'),_0x539cf8);throw _0x539cf8;});}return _0x1eb52f;})[_0xac97('0x1d')](respondWithResult(_0xe32c15,0xc9))[_0xac97('0x28')](handleError(_0xe32c15,null));};exports[_0xac97('0x32')]=function(_0x145bbf,_0x5c2ad6){if(_0x145bbf[_0xac97('0x5b')]['id']){delete _0x145bbf[_0xac97('0x5b')]['id'];}return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x145bbf[_0xac97('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xac97('0x3b')}]})['then'](handleEntityNotFound(_0x5c2ad6,null))[_0xac97('0x1d')](saveUpdates(_0x145bbf[_0xac97('0x5b')],null))[_0xac97('0x1d')](respondWithResult(_0x5c2ad6,null))[_0xac97('0x28')](handleError(_0x5c2ad6,null));};exports['destroy']=function(_0x4a268c,_0x43540f){return db['FaxAccount'][_0xac97('0x5f')]({'where':{'id':_0x4a268c[_0xac97('0x56')]['id']}})['then'](handleEntityNotFound(_0x43540f,null))['then'](removeEntity(_0x43540f,null))[_0xac97('0x28')](handleError(_0x43540f,null));};exports['describe']=function(_0x5a4b5b,_0x4c91b9){return db[_0xac97('0x3d')][_0xac97('0x63')]()[_0xac97('0x1d')](respondWithResult(_0x4c91b9,null))[_0xac97('0x28')](handleError(_0x4c91b9,null));};exports[_0xac97('0x64')]=function(_0x36c4ec,_0x31a5e6,_0x1741a6){if(_0x36c4ec[_0xac97('0x5b')]['id']){delete _0x36c4ec[_0xac97('0x5b')]['id'];}return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x36c4ec[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x31a5e6,null))['then'](function(_0x392d98){if(_0x392d98){_0x36c4ec['body'][_0xac97('0x65')]=_0x392d98['id'];return db[_0xac97('0x66')][_0xac97('0x5a')](_0x36c4ec[_0xac97('0x5b')]);}})['then'](respondWithResult(_0x31a5e6,null))['catch'](handleError(_0x31a5e6,null));};exports[_0xac97('0x67')]=function(_0x3080b4,_0x36ed94,_0x29fc2b){var _0x54e234={'raw':![],'where':{}};var _0x2d10bb={};var _0x5a5447={'count':0x0,'rows':[]};return db['FaxAccount'][_0xac97('0x68')]({'where':{'id':_0x3080b4[_0xac97('0x56')]['id']}})['then'](handleEntityNotFound(_0x36ed94,null))[_0xac97('0x1d')](function(_0x3e2ff5){if(_0x3e2ff5){_0x2d10bb[_0xac97('0x45')]=_[_0xac97('0x58')](db[_0xac97('0x66')]['rawAttributes']);_0x2d10bb['query']=_['keys'](_0x3080b4[_0xac97('0x42')]);_0x2d10bb['filters']=_[_0xac97('0x44')](_0x2d10bb[_0xac97('0x45')],_0x2d10bb['query']);_0x54e234[_0xac97('0x47')]=_[_0xac97('0x44')](_0x2d10bb[_0xac97('0x45')],qs[_0xac97('0x46')](_0x3080b4[_0xac97('0x42')][_0xac97('0x46')]));_0x54e234[_0xac97('0x47')]=_0x54e234[_0xac97('0x47')][_0xac97('0x48')]?_0x54e234[_0xac97('0x47')]:_0x2d10bb[_0xac97('0x45')];if(!_0x3080b4['query']['hasOwnProperty'](_0xac97('0x4a'))){_0x54e234['limit']=qs[_0xac97('0x2f')](_0x3080b4['query']['limit']);_0x54e234['offset']=qs[_0xac97('0x2e')](_0x3080b4[_0xac97('0x42')][_0xac97('0x2e')]);}_0x54e234[_0xac97('0x4b')]=qs[_0xac97('0x69')](_0x3080b4[_0xac97('0x42')][_0xac97('0x69')]);_0x54e234['where']=qs[_0xac97('0x43')](_['pick'](_0x3080b4[_0xac97('0x42')],_0x2d10bb[_0xac97('0x43')]));_0x54e234['where'][_0xac97('0x65')]=_0x3e2ff5['id'];if(_0x3080b4[_0xac97('0x42')][_0xac97('0x4d')]){_0x54e234[_0xac97('0x4c')]=_[_0xac97('0x4e')](_0x54e234[_0xac97('0x4c')],{'$or':_[_0xac97('0x3c')](_0x54e234[_0xac97('0x47')],function(_0x5ed5a3){var _0x228f07={};_0x228f07[_0x5ed5a3]={'$like':'%'+_0x3080b4['query'][_0xac97('0x4d')]+'%'};return _0x228f07;})});}_0x54e234=_[_0xac97('0x4e')]({},_0x54e234,_0x3080b4[_0xac97('0x50')]);return db[_0xac97('0x66')]['count']({'where':_0x54e234[_0xac97('0x4c')]})['then'](function(_0xf339dd){_0x5a5447['count']=_0xf339dd;if(_0x3080b4[_0xac97('0x42')][_0xac97('0x51')]){_0x54e234[_0xac97('0x52')]=[{'all':!![]}];}return db[_0xac97('0x66')][_0xac97('0x53')](_0x54e234);})[_0xac97('0x1d')](function(_0x4c3405){_0x5a5447['rows']=_0x4c3405;return _0x5a5447;});}})[_0xac97('0x1d')](respondWithFilteredResult(_0x36ed94,_0x54e234))[_0xac97('0x28')](handleError(_0x36ed94,null));};exports[_0xac97('0x6a')]=function(_0x2a030c,_0x50ecc1,_0x25c0d6){return db['FaxAccount'][_0xac97('0x5f')]({'where':{'id':_0x2a030c['params']['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x50ecc1,null))['then'](function(_0x3b5984){if(_0x3b5984){return _0x3b5984[_0xac97('0x6a')](_0x2a030c[_0xac97('0x42')][_0xac97('0x6b')]);}})[_0xac97('0x1d')](respondWithStatusCode(_0x50ecc1,null))[_0xac97('0x28')](handleError(_0x50ecc1,null));};exports[_0xac97('0x6c')]=function(_0x53fc70,_0x2387b4,_0x1fdbed){if(_0x53fc70[_0xac97('0x5b')]['id']){delete _0x53fc70['body']['id'];}return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x53fc70[_0xac97('0x56')]['id']}})['then'](handleEntityNotFound(_0x2387b4,null))[_0xac97('0x1d')](function(_0x4528b2){if(_0x4528b2){_0x53fc70[_0xac97('0x5b')]['FaxAccountId']=_0x4528b2['id'];return db['CannedAnswer'][_0xac97('0x5a')](_0x53fc70[_0xac97('0x5b')]);}})[_0xac97('0x1d')](respondWithResult(_0x2387b4,null))[_0xac97('0x28')](handleError(_0x2387b4,null));};exports['getAnswers']=function(_0x2ab934,_0x2718cf,_0x59013a){var _0x17918c={'raw':![],'where':{}};var _0x4b5152={};var _0x49c6ea={'count':0x0,'rows':[]};return db[_0xac97('0x3d')][_0xac97('0x68')]({'where':{'id':_0x2ab934[_0xac97('0x56')]['id']}})['then'](handleEntityNotFound(_0x2718cf,null))[_0xac97('0x1d')](function(_0x5971e9){if(_0x5971e9){_0x4b5152[_0xac97('0x45')]=_[_0xac97('0x58')](db[_0xac97('0x6d')][_0xac97('0x3e')]);_0x4b5152['query']=_[_0xac97('0x58')](_0x2ab934['query']);_0x4b5152[_0xac97('0x43')]=_[_0xac97('0x44')](_0x4b5152['model'],_0x4b5152[_0xac97('0x42')]);_0x17918c[_0xac97('0x47')]=_[_0xac97('0x44')](_0x4b5152[_0xac97('0x45')],qs[_0xac97('0x46')](_0x2ab934[_0xac97('0x42')][_0xac97('0x46')]));_0x17918c[_0xac97('0x47')]=_0x17918c[_0xac97('0x47')]['length']?_0x17918c[_0xac97('0x47')]:_0x4b5152[_0xac97('0x45')];if(!_0x2ab934[_0xac97('0x42')][_0xac97('0x49')]('nolimit')){_0x17918c[_0xac97('0x2f')]=qs['limit'](_0x2ab934[_0xac97('0x42')][_0xac97('0x2f')]);_0x17918c['offset']=qs[_0xac97('0x2e')](_0x2ab934['query'][_0xac97('0x2e')]);}_0x17918c[_0xac97('0x4b')]=qs[_0xac97('0x69')](_0x2ab934[_0xac97('0x42')][_0xac97('0x69')]);_0x17918c[_0xac97('0x4c')]=qs[_0xac97('0x43')](_['pick'](_0x2ab934[_0xac97('0x42')],_0x4b5152[_0xac97('0x43')]));_0x17918c[_0xac97('0x4c')]['FaxAccountId']=_0x5971e9['id'];if(_0x2ab934[_0xac97('0x42')][_0xac97('0x4d')]){_0x17918c[_0xac97('0x4c')]=_[_0xac97('0x4e')](_0x17918c['where'],{'$or':_[_0xac97('0x3c')](_0x17918c[_0xac97('0x47')],function(_0x26ba08){var _0xe8d2a0={};_0xe8d2a0[_0x26ba08]={'$like':'%'+_0x2ab934[_0xac97('0x42')][_0xac97('0x4d')]+'%'};return _0xe8d2a0;})});}_0x17918c=_[_0xac97('0x4e')]({},_0x17918c,_0x2ab934[_0xac97('0x50')]);return db[_0xac97('0x6d')][_0xac97('0x2d')]({'where':_0x17918c['where']})[_0xac97('0x1d')](function(_0x90ce5a){_0x49c6ea['count']=_0x90ce5a;if(_0x2ab934['query'][_0xac97('0x51')]){_0x17918c[_0xac97('0x52')]=[{'all':!![]}];}return db[_0xac97('0x6d')]['findAll'](_0x17918c);})[_0xac97('0x1d')](function(_0x32da72){_0x49c6ea['rows']=_0x32da72;return _0x49c6ea;});}})[_0xac97('0x1d')](respondWithFilteredResult(_0x2718cf,_0x17918c))['catch'](handleError(_0x2718cf,null));};exports[_0xac97('0x6e')]=function(_0x4e7dd2,_0x33b39c,_0x123466){return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x4e7dd2['params']['id']}})['then'](handleEntityNotFound(_0x33b39c,null))['then'](function(_0x450869){if(_0x450869){return _0x450869[_0xac97('0x6e')](_0x4e7dd2[_0xac97('0x42')][_0xac97('0x6b')]);}})[_0xac97('0x1d')](respondWithStatusCode(_0x33b39c,null))[_0xac97('0x28')](handleError(_0x33b39c,null));};exports[_0xac97('0x6f')]=function(_0x566432,_0x1ece31,_0x2ff0b1){return db[_0xac97('0x70')]['find']({'where':{'id':_0x566432['params']['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x1ece31,null))[_0xac97('0x1d')](function(_0x162569){if(_0x162569){return _0x162569[_0xac97('0x6f')](_0x566432[_0xac97('0x5b')][_0xac97('0x6b')],_['omit'](_0x566432[_0xac97('0x5b')],[_0xac97('0x6b'),'id'])||{});}})[_0xac97('0x1d')](respondWithResult(_0x1ece31,null))[_0xac97('0x28')](handleError(_0x1ece31,null));};exports[_0xac97('0x71')]=function(_0x351f40,_0x162623,_0x439193){var _0x1dd169={'raw':![],'where':{}};var _0x245491={};var _0x3def51={'count':0x0,'rows':[]};return db[_0xac97('0x3d')][_0xac97('0x68')]({'where':{'id':_0x351f40[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x162623,null))[_0xac97('0x1d')](function(_0x20ad94){if(_0x20ad94){_0x245491[_0xac97('0x45')]=_['keys'](db[_0xac97('0x70')][_0xac97('0x3e')]);_0x245491[_0xac97('0x42')]=_['keys'](_0x351f40[_0xac97('0x42')]);_0x245491['filters']=_[_0xac97('0x44')](_0x245491[_0xac97('0x45')],_0x245491['query']);_0x1dd169[_0xac97('0x47')]=_[_0xac97('0x44')](_0x245491[_0xac97('0x45')],qs[_0xac97('0x46')](_0x351f40[_0xac97('0x42')][_0xac97('0x46')]));_0x1dd169['attributes']=_0x1dd169['attributes'][_0xac97('0x48')]?_0x1dd169[_0xac97('0x47')]:_0x245491['model'];if(!_0x351f40[_0xac97('0x42')]['hasOwnProperty'](_0xac97('0x4a'))){_0x1dd169['limit']=qs[_0xac97('0x2f')](_0x351f40[_0xac97('0x42')][_0xac97('0x2f')]);_0x1dd169[_0xac97('0x2e')]=qs[_0xac97('0x2e')](_0x351f40[_0xac97('0x42')]['offset']);}_0x1dd169['order']=qs[_0xac97('0x69')](_0x351f40[_0xac97('0x42')][_0xac97('0x69')]);_0x1dd169[_0xac97('0x4c')]=qs[_0xac97('0x43')](_['pick'](_0x351f40['query'],_0x245491[_0xac97('0x43')]));_0x1dd169[_0xac97('0x4c')]['FaxAccountId']=_0x20ad94['id'];if(_0x351f40[_0xac97('0x42')][_0xac97('0x4d')]){_0x1dd169[_0xac97('0x4c')]=_[_0xac97('0x4e')](_0x1dd169[_0xac97('0x4c')],{'$or':_[_0xac97('0x3c')](_0x1dd169['attributes'],function(_0x4c3a40){var _0x2d8fdd={};_0x2d8fdd[_0x4c3a40]={'$like':'%'+_0x351f40['query'][_0xac97('0x4d')]+'%'};return _0x2d8fdd;})});}_0x1dd169=_['merge']({},_0x1dd169,_0x351f40['options']);return db[_0xac97('0x70')][_0xac97('0x2d')]({'where':_0x1dd169[_0xac97('0x4c')]})[_0xac97('0x1d')](function(_0x1868ea){_0x3def51[_0xac97('0x2d')]=_0x1868ea;if(_0x351f40[_0xac97('0x42')][_0xac97('0x51')]){_0x1dd169['include']=[{'model':db[_0xac97('0x72')],'as':_0xac97('0x73'),'required':![]},{'model':db[_0xac97('0x74')],'as':_0xac97('0x75'),'attributes':[_0xac97('0x38'),_0xac97('0x76'),_0xac97('0x77')],'required':![]},{'model':db[_0xac97('0x78')],'as':_0xac97('0x79'),'attributes':['id',_0xac97('0x38'),_0xac97('0x7a')],'where':_0x351f40[_0xac97('0x42')][_0xac97('0x7b')]?{'id':_0x351f40[_0xac97('0x42')][_0xac97('0x7b')]}:undefined,'required':_0x351f40[_0xac97('0x42')][_0xac97('0x7b')]?!![]:![]}];}return db[_0xac97('0x70')][_0xac97('0x53')](_0x1dd169);})[_0xac97('0x1d')](function(_0x3bc4f0){_0x3def51[_0xac97('0x54')]=_0x3bc4f0;return _0x3def51;});}})[_0xac97('0x1d')](respondWithFilteredResult(_0x162623,_0x1dd169))[_0xac97('0x28')](handleError(_0x162623,null));};exports[_0xac97('0x7c')]=function(_0x16980a,_0x5790dc,_0x31fc5a){return db[_0xac97('0x3d')][_0xac97('0x68')]({'where':{'id':_0x16980a['params']['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x5790dc,null))['then'](function(_0x3c1010){if(_0x3c1010){return db[_0xac97('0x7d')][_0xac97('0x7e')](function(_0x270257){return db[_0xac97('0x7f')][_0xac97('0x33')]({'where':{'FaxAccountId':_0x16980a[_0xac97('0x56')]['id']},'transaction':_0x270257})['then'](function(_0x55bcc1){var _0x25d04f=_[_0xac97('0x3c')](_0x16980a[_0xac97('0x5b')],function(_0x2e63fc){_0x2e63fc[_0xac97('0x65')]=_0x16980a[_0xac97('0x56')]['id'];return _0x2e63fc;});return db[_0xac97('0x7f')]['bulkCreate'](_0x25d04f,{'transaction':_0x270257});});})[_0xac97('0x1d')](function(){return db[_0xac97('0x7f')][_0xac97('0x80')]({'where':{'FaxAccountId':_0x16980a['params']['id']},'order':_0xac97('0x81')});});}})['then'](respondWithResult(_0x5790dc,null))['catch'](handleError(_0x5790dc,null));};exports[_0xac97('0x82')]=function(_0x21d537,_0x4ef9bc,_0x20808b){var _0x273943={};var _0x264184={};var _0x5a493a;var _0x5b8e3b;return db[_0xac97('0x3d')][_0xac97('0x68')]({'where':{'id':_0x21d537[_0xac97('0x56')]['id']}})['then'](handleEntityNotFound(_0x4ef9bc,null))[_0xac97('0x1d')](function(_0x2b4689){if(_0x2b4689){_0x5a493a=_0x2b4689;_0x264184[_0xac97('0x45')]=_['keys'](db[_0xac97('0x7f')][_0xac97('0x3e')]);_0x264184[_0xac97('0x42')]=_[_0xac97('0x58')](_0x21d537[_0xac97('0x42')]);_0x264184[_0xac97('0x43')]=_[_0xac97('0x44')](_0x264184[_0xac97('0x45')],_0x264184[_0xac97('0x42')]);_0x273943[_0xac97('0x47')]=_['intersection'](_0x264184[_0xac97('0x45')],qs[_0xac97('0x46')](_0x21d537[_0xac97('0x42')][_0xac97('0x46')]));_0x273943[_0xac97('0x47')]=_0x273943[_0xac97('0x47')]['length']?_0x273943[_0xac97('0x47')]:_0x264184[_0xac97('0x45')];_0x273943[_0xac97('0x4b')]=qs[_0xac97('0x69')](_0x21d537[_0xac97('0x42')][_0xac97('0x69')]);_0x273943[_0xac97('0x4c')]=qs[_0xac97('0x43')](_[_0xac97('0x83')](_0x21d537['query'],_0x264184[_0xac97('0x43')]));if(_0x21d537['query'][_0xac97('0x4d')]){_0x273943['where']=_[_0xac97('0x4e')](_0x273943[_0xac97('0x4c')],{'$or':_['map'](_0x273943[_0xac97('0x47')],function(_0x87fc9c){var _0x13a9a1={};_0x13a9a1[_0x87fc9c]={'$like':'%'+_0x21d537[_0xac97('0x42')][_0xac97('0x4d')]+'%'};return _0x13a9a1;})});}_0x273943=_['merge']({},_0x273943,_0x21d537[_0xac97('0x50')]);return _0x5a493a[_0xac97('0x82')](_0x273943);}})[_0xac97('0x1d')](function(_0x5940bd){if(_0x5940bd){_0x5b8e3b=_0x5940bd[_0xac97('0x48')];if(!_0x21d537[_0xac97('0x42')]['hasOwnProperty'](_0xac97('0x4a'))){_0x273943[_0xac97('0x2f')]=qs[_0xac97('0x2f')](_0x21d537[_0xac97('0x42')][_0xac97('0x2f')]);_0x273943[_0xac97('0x2e')]=qs[_0xac97('0x2e')](_0x21d537[_0xac97('0x42')][_0xac97('0x2e')]);}return _0x5a493a[_0xac97('0x82')](_0x273943);}})['then'](function(_0x244642){if(_0x244642){return _0x244642?{'count':_0x5b8e3b,'rows':_0x244642}:null;}})[_0xac97('0x1d')](respondWithResult(_0x4ef9bc,null))['catch'](handleError(_0x4ef9bc,null));};function Extension(_0x1c62fc,_0x57af69,_0x1cfb6e,_0x16c7b1){this[_0xac97('0x84')]=_0xac97('0x85');this[_0xac97('0x86')]=_0x1c62fc[_0xac97('0x87')];this[_0xac97('0x88')]=_0x16c7b1;this['type']=_0xac97('0x89');this[_0xac97('0x8a')]=_0xac97('0x8b');this[_0xac97('0x65')]=_0x1c62fc['id'];this['priority']=_0x57af69;this['appdata']=_0x1cfb6e;}function createExtensionsReciveFax(_0x19152c){var _0x495eda=0x1;var _0x4ffbf7=[];_0x4ffbf7[_0xac97('0x8c')](new Extension(_0x19152c,_0x495eda,'',_0xac97('0x8d')));_0x495eda+=0x1;_0x4ffbf7['push'](new Extension(_0x19152c,_0x495eda,_0xac97('0x8e'),_0xac97('0x8f')));_0x495eda+=0x1;for(var _0x661f60 in _0x19152c){if(_0x19152c[_0xac97('0x49')](_0x661f60)&&(_0x661f60==='ecm'||_0x661f60===_0xac97('0x87')||_0x661f60==='gateway'||_0x661f60===_0xac97('0x90')||_0x661f60===_0xac97('0x91')||_0x661f60===_0xac97('0x92')||_0x661f60===_0xac97('0x93')||_0x661f60===_0xac97('0x94')||_0x661f60===_0xac97('0x95'))){_0x4ffbf7[_0xac97('0x8c')](new Extension(_0x19152c,_0x495eda,_0xac97('0x96')+_0x661f60+')='+_0x19152c[_0x661f60],_0xac97('0x8f')));_0x495eda+=0x1;}}_0x4ffbf7[_0xac97('0x8c')](new Extension(_0x19152c,_0x495eda,'6','Wait'));_0x495eda+=0x1;_0x4ffbf7[_0xac97('0x8c')](new Extension(_0x19152c,_0x495eda,_0xac97('0x97'),_0xac97('0x98')));_0x495eda=0x0;return _0x4ffbf7;}exports[_0xac97('0x99')]=function(_0x2ece0d,_0x5683bf,_0x2dc6e1){var _0x292eb7;return db[_0xac97('0x7d')]['transaction'](function(_0xa107ce){return db[_0xac97('0x3d')][_0xac97('0x5a')](_0x2ece0d[_0xac97('0x5b')],{'transaction':_0xa107ce})[_0xac97('0x1d')](function(_0x5f4414){_0x292eb7=_0x5f4414[_0xac97('0x34')]({'plain':!![]});return db[_0xac97('0x9a')][_0xac97('0x9b')](createExtensionsReciveFax(_0x292eb7),{'transaction':_0xa107ce});});})['then'](function(){return _0x292eb7;})[_0xac97('0x1d')](respondWithResult(_0x5683bf,null))[_0xac97('0x28')](handleError(_0x5683bf,null));};exports[_0xac97('0x9c')]=function(_0x2d6881,_0x5e2771,_0x349338){var _0x4d234a;return db['sequelize'][_0xac97('0x7e')](function(_0x4fcab2){return db[_0xac97('0x3d')][_0xac97('0x32')](_0x2d6881['body'],{'where':{'id':_0x2d6881[_0xac97('0x5b')]['id']},'transaction':_0x4fcab2})[_0xac97('0x1d')](function(_0x575b1d){return db[_0xac97('0x9a')]['destroy']({'where':{'FaxAccountId':_0x2d6881[_0xac97('0x5b')]['id']},'transaction':_0x4fcab2})[_0xac97('0x1d')](function(_0x378a5d){return db[_0xac97('0x9a')][_0xac97('0x9b')](createExtensionsReciveFax(_[_0xac97('0x9d')](_0x2d6881[_0xac97('0x5b')],['tech',_0xac97('0x41'),_0xac97('0x9e'),_0xac97('0x9f'),'TrunkId',_0xac97('0xa0')])),{'transaction':_0x4fcab2});});});})[_0xac97('0x1d')](function(){return db[_0xac97('0x3d')][_0xac97('0xa1')](_0x2d6881[_0xac97('0x5b')]['id']);})[_0xac97('0x1d')](respondWithResult(_0x5e2771,null))['catch'](handleError(_0x5e2771,null));};exports['getMessages']=function(_0x1a5eca,_0x2c3076,_0x14ed1b){var _0x319c27={'raw':!![],'where':{}};var _0x56743a={};var _0x2c7de9={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1a5eca[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x2c3076,null))['then'](function(_0x390eb5){if(_0x390eb5){_0x56743a[_0xac97('0x45')]=_[_0xac97('0x58')](db[_0xac97('0xa2')][_0xac97('0x3e')]);_0x56743a[_0xac97('0x42')]=_['keys'](_0x1a5eca[_0xac97('0x42')]);_0x56743a[_0xac97('0x43')]=_[_0xac97('0x44')](_0x56743a[_0xac97('0x45')],_0x56743a[_0xac97('0x42')]);_0x319c27['attributes']=_[_0xac97('0x44')](_0x56743a[_0xac97('0x45')],qs[_0xac97('0x46')](_0x1a5eca[_0xac97('0x42')]['fields']));_0x319c27[_0xac97('0x47')]=_0x319c27[_0xac97('0x47')]['length']?_0x319c27[_0xac97('0x47')]:_0x56743a[_0xac97('0x45')];if(!_0x1a5eca[_0xac97('0x42')][_0xac97('0x49')](_0xac97('0x4a'))){_0x319c27[_0xac97('0x2f')]=qs[_0xac97('0x2f')](_0x1a5eca[_0xac97('0x42')]['limit']);_0x319c27[_0xac97('0x2e')]=qs[_0xac97('0x2e')](_0x1a5eca[_0xac97('0x42')]['offset']);}_0x319c27['order']=qs[_0xac97('0x69')](_0x1a5eca[_0xac97('0x42')]['sort']);_0x319c27['where']=qs[_0xac97('0x43')](_[_0xac97('0x83')](_0x1a5eca['query'],_0x56743a[_0xac97('0x43')]));_0x319c27[_0xac97('0x4c')][_0xac97('0x65')]=_0x390eb5['id'];if(_0x1a5eca[_0xac97('0x42')][_0xac97('0x4d')]){_0x319c27[_0xac97('0x4c')]=_['merge'](_0x319c27[_0xac97('0x4c')],{'$or':_[_0xac97('0x3c')](_0x319c27['attributes'],function(_0x2ad92d){var _0x485836={};_0x485836[_0x2ad92d]={'$like':'%'+_0x1a5eca[_0xac97('0x42')]['filter']+'%'};return _0x485836;})});}if(_0x1a5eca[_0xac97('0x42')][_0xac97('0xa3')]){var _0x5b3105=_0x1a5eca[_0xac97('0x42')]['$gte'][_0xac97('0xa4')](',');var _0x3a6dda={};_0x3a6dda[_0x5b3105[0x0]]={'$gte':moment(_0x5b3105[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x319c27['where']=_[_0xac97('0x4e')](_0x319c27['where'],_0x3a6dda);}_0x319c27=_['merge']({},_0x319c27,_0x1a5eca['options']);return db[_0xac97('0xa2')][_0xac97('0x2d')]({'where':_0x319c27[_0xac97('0x4c')]})[_0xac97('0x1d')](function(_0x503363){_0x2c7de9[_0xac97('0x2d')]=_0x503363;if(_0x1a5eca[_0xac97('0x42')]['includeAll']){_0x319c27['include']=[{'all':!![]}];}return db[_0xac97('0xa2')][_0xac97('0x53')](_0x319c27);})[_0xac97('0x1d')](function(_0x3bc557){_0x2c7de9[_0xac97('0x54')]=_0x3bc557;return _0x2c7de9;});}})[_0xac97('0x1d')](respondWithFilteredResult(_0x2c3076,_0x319c27))[_0xac97('0x28')](handleError(_0x2c3076,null));};exports[_0xac97('0x39')]=function(_0x3d0b03,_0x22708e,_0x137454){var _0x5d3ece,_0x23684a={},_0x4ab1c4;if(_0x3d0b03['body']['to']){_0x4ab1c4=_0x3d0b03[_0xac97('0x5b')]['to'][0x0];}return db['FaxAccount'][_0xac97('0x5f')]({'where':{'id':_0x3d0b03[_0xac97('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xac97('0xa5'),'include':[{'model':db[_0xac97('0x72')],'as':_0xac97('0xa6'),'where':{'fax':_0x4ab1c4},'limit':0x1,'order':[[_0xac97('0x9f'),_0xac97('0xa7')]]}]}]})[_0xac97('0x1d')](handleEntityNotFound(_0x22708e,null))[_0xac97('0x1d')](function(_0x584deb){_0x5d3ece=_0x584deb;if(_0x3d0b03['body']['attachments']&&_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][_0xac97('0x48')]){for(var _0x3fb1d7=0x0;_0x3fb1d7<_0x3d0b03[_0xac97('0x5b')]['attachments'][_0xac97('0x48')];_0x3fb1d7+=0x1){_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][_0x3fb1d7]={'filename':_0x3d0b03['body'][_0xac97('0xa8')][_0x3fb1d7][_0xac97('0x38')],'id':_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][_0x3fb1d7]['id'],'path':path[_0xac97('0xa9')](config[_0xac97('0xaa')],_0xac97('0xab'),_0x3d0b03['body']['attachments'][_0x3fb1d7][_0xac97('0xac')])};}}return respondWithRpcPromise(_0xac97('0xad'),_0xac97('0xad'),{'FaxAccountId':_[_0xac97('0xae')](_0x3d0b03[_0xac97('0x56')]['id'])?undefined:_0x3d0b03[_0xac97('0x56')]['id'],'path':_[_0xac97('0xae')](_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0][_0xac97('0x6')])?undefined:_0x3d0b03['body'][_0xac97('0xa8')][0x0][_0xac97('0x6')],'fax':_['isNil'](_0x3d0b03[_0xac97('0x5b')]['to'][0x0])?undefined:_0x3d0b03[_0xac97('0x5b')]['to'][0x0]},client9002);})[_0xac97('0x1d')](function(){if(_0x5d3ece){if(_['isNil'](_0x3d0b03[_0xac97('0x5b')][_0xac97('0xaf')])){_0x3d0b03['body'][_0xac97('0xaf')]=util[_0xac97('0xb0')]('\x22%s\x22\x20<%s>',_0x5d3ece[_0xac97('0x38')],_0x5d3ece['fax']);}if(_0x5d3ece[_0xac97('0xa5')]){if(_0x5d3ece[_0xac97('0xa5')][_0xac97('0xa6')][_0xac97('0x48')]){return _0x5d3ece[_0xac97('0xa5')][_0xac97('0xa6')][0x0];}else{return db['CmContact'][_0xac97('0x5a')](_['defaults'](_0x3d0b03[_0xac97('0x5b')],{'firstName':_0x3d0b03[_0xac97('0x5b')]['to'][0x0],'phone':_0x3d0b03['body']['to'][0x0],'fax':_0x3d0b03[_0xac97('0x5b')]['to'][0x0],'ListId':_0x5d3ece[_0xac97('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xac97('0xb1'));}})[_0xac97('0x1d')](function(_0x49e411){if(_0x49e411){return db[_0xac97('0x70')][_0xac97('0x5f')]({'where':{'ContactId':_0x49e411['id'],'closed':![],'FaxAccountId':_0x5d3ece['id']}})['then'](function(_0x357fa4){if(_0x357fa4){return[_0x357fa4,![]];}return db[_0xac97('0x70')][_0xac97('0x5a')]({'UserId':_0x3d0b03[_0xac97('0x5c')]['id'],'ContactId':_0x49e411['id'],'FaxAccountId':_0x5d3ece['id'],'fax':_0x3d0b03[_0xac97('0x5b')]['to'][0x0],'firstMsgDirection':_0xac97('0xb2'),'Messages':[_['merge'](_0x3d0b03[_0xac97('0x5b')],{'read':![],'body':_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0]['filename'],'FaxAccountId':_0x5d3ece['id'],'UserId':_0x3d0b03[_0xac97('0x5c')]['id'],'ContactId':_0x49e411['id'],'AttachmentId':_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xac97('0xb3')}]})[_0xac97('0x1d')](function(_0x1d33d2){return[_0x1d33d2,!![]];});});}else{throw new Error(_0xac97('0xb4'));}})[_0xac97('0xb5')](function(_0x52abe2,_0x4f637c){if(_0x4f637c){return _0x52abe2;}return db['FaxMessage'][_0xac97('0x5a')]({'direction':_0xac97('0xb2'),'read':![],'body':_0x3d0b03['body'][_0xac97('0xa8')][0x0][_0xac97('0xb6')],'FaxAccountId':_0x5d3ece['id'],'FaxInteractionId':_0x52abe2['id'],'UserId':_0x3d0b03[_0xac97('0x5c')]['id'],'ContactId':_0x52abe2[_0xac97('0xb7')],'AttachmentId':_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0]['id']})['then'](function(_0x21de9c){_0x52abe2[_0xac97('0xb8')][_0xac97('0xb3')]=[];_0x52abe2[_0xac97('0xb8')][_0xac97('0xb3')][_0xac97('0x8c')](_0x21de9c[_0xac97('0xb8')]);return _0x52abe2;});})[_0xac97('0x1d')](function(_0x128bf3){respondWithRpcPromise(_0xac97('0xb9'),_0xac97('0xb9'),{'FaxAccountId':_[_0xac97('0xae')](_0x3d0b03[_0xac97('0x56')]['id'])?undefined:_0x3d0b03['params']['id'],'path':_[_0xac97('0xae')](_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0][_0xac97('0x6')])?undefined:_0x3d0b03[_0xac97('0x5b')][_0xac97('0xa8')][0x0][_0xac97('0x6')],'fax':_[_0xac97('0xae')](_0x3d0b03['body']['to'][0x0])?undefined:_0x3d0b03['body']['to'][0x0],'AttachmentId':_0x3d0b03[_0xac97('0x5b')]['attachments'][0x0]['id']},client9002)[_0xac97('0x1d')](function(_0x4d2729){logger[_0xac97('0x1e')]('SendFaxRpc,\x20%s',_0x4d2729);})[_0xac97('0x28')](function(_0x2ce40c){logger[_0xac97('0x1e')](_0xac97('0xba'),_0x2ce40c);});return _0x128bf3;})['then'](respondWithResult(_0x22708e,null))[_0xac97('0x28')](handleError(_0x22708e,null));};exports[_0xac97('0xbb')]=function(_0x69df4b,_0x3d2c71,_0x1545e6){return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x69df4b[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x3d2c71,null))['then'](function(_0x882169){if(_0x882169){return _0x882169[_0xac97('0xbb')](_0x69df4b[_0xac97('0x5b')][_0xac97('0x6b')],_[_0xac97('0x9d')](_0x69df4b[_0xac97('0x5b')],[_0xac97('0x6b'),'id'])||{})[_0xac97('0xb5')](function(_0x1794ab){for(var _0x1e3379=0x0;_0x1e3379<_0x69df4b[_0xac97('0x5b')][_0xac97('0x6b')][_0xac97('0x48')];_0x1e3379+=0x1){socket[_0xac97('0xbc')]('userFaxAccount:save',{'UserId':_0x69df4b[_0xac97('0x5b')][_0xac97('0x6b')][_0x1e3379],'FaxAccountId':_0x69df4b['params']['id']});}return _0x1794ab;});}})['then'](respondWithResult(_0x3d2c71,null))[_0xac97('0x28')](handleError(_0x3d2c71,null));};exports[_0xac97('0xbd')]=function(_0x535734,_0x2f01b3,_0x105fb5){return db[_0xac97('0x3d')][_0xac97('0x5f')]({'where':{'id':_0x535734[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x2f01b3,null))[_0xac97('0x1d')](function(_0x42998d){if(_0x42998d){return _0x42998d['removeAgents'](_0x535734[_0xac97('0x42')][_0xac97('0x6b')])[_0xac97('0x1d')](function(){if(_['isArray'](_0x535734['query'][_0xac97('0x6b')])){for(var _0x292031=0x0;_0x292031<_0x535734[_0xac97('0x42')][_0xac97('0x6b')]['length'];_0x292031+=0x1){socket[_0xac97('0xbc')](_0xac97('0xbe'),{'UserId':Number(_0x535734['query']['ids'][_0x292031]),'FaxAccountId':Number(_0x535734['params']['id'])});}}else{socket[_0xac97('0xbc')](_0xac97('0xbe'),{'UserId':Number(_0x535734[_0xac97('0x42')][_0xac97('0x6b')]),'FaxAccountId':Number(_0x535734[_0xac97('0x56')]['id'])});}});}})[_0xac97('0x1d')](respondWithStatusCode(_0x2f01b3,null))[_0xac97('0x28')](handleError(_0x2f01b3,null));};exports[_0xac97('0xbf')]=function(_0xd1340e,_0x5d0141,_0x429f70){var _0x5e4f07={};var _0x9bcee4={};var _0x33cc96;var _0x5607bd;return db[_0xac97('0x3d')][_0xac97('0x68')]({'where':{'id':_0xd1340e[_0xac97('0x56')]['id']}})[_0xac97('0x1d')](handleEntityNotFound(_0x5d0141,null))[_0xac97('0x1d')](function(_0x5541e5){if(_0x5541e5){_0x33cc96=_0x5541e5;_0x9bcee4[_0xac97('0x45')]=_[_0xac97('0x58')](db['User'][_0xac97('0x3e')]);_0x9bcee4[_0xac97('0x42')]=_[_0xac97('0x58')](_0xd1340e[_0xac97('0x42')]);_0x9bcee4[_0xac97('0x43')]=_[_0xac97('0x44')](_0x9bcee4[_0xac97('0x45')],_0x9bcee4[_0xac97('0x42')]);_0x5e4f07[_0xac97('0x47')]=_[_0xac97('0x44')](_0x9bcee4[_0xac97('0x45')],qs[_0xac97('0x46')](_0xd1340e[_0xac97('0x42')][_0xac97('0x46')]));_0x5e4f07[_0xac97('0x47')]=_0x5e4f07['attributes'][_0xac97('0x48')]?_0x5e4f07[_0xac97('0x47')]:_0x9bcee4[_0xac97('0x45')];_0x5e4f07[_0xac97('0x4b')]=qs['sort'](_0xd1340e['query']['sort']);_0x5e4f07['where']=qs[_0xac97('0x43')](_[_0xac97('0x83')](_0xd1340e[_0xac97('0x42')],_0x9bcee4[_0xac97('0x43')]));if(_0xd1340e['query'][_0xac97('0x4d')]){_0x5e4f07['where']=_[_0xac97('0x4e')](_0x5e4f07[_0xac97('0x4c')],{'$or':_[_0xac97('0x3c')](_0x5e4f07[_0xac97('0x47')],function(_0x2d5255){var _0x220c42={};_0x220c42[_0x2d5255]={'$like':'%'+_0xd1340e[_0xac97('0x42')][_0xac97('0x4d')]+'%'};return _0x220c42;})});}_0x5e4f07=_[_0xac97('0x4e')]({},_0x5e4f07,_0xd1340e[_0xac97('0x50')]);return _0x33cc96[_0xac97('0xbf')](_0x5e4f07);}})[_0xac97('0x1d')](function(_0x2106ca){if(_0x2106ca){_0x5607bd=_0x2106ca[_0xac97('0x48')];if(!_0xd1340e[_0xac97('0x42')][_0xac97('0x49')](_0xac97('0x4a'))){_0x5e4f07[_0xac97('0x2f')]=qs[_0xac97('0x2f')](_0xd1340e['query'][_0xac97('0x2f')]);_0x5e4f07[_0xac97('0x2e')]=qs['offset'](_0xd1340e[_0xac97('0x42')]['offset']);}return _0x33cc96[_0xac97('0xbf')](_0x5e4f07);}})[_0xac97('0x1d')](function(_0x4307e1){if(_0x4307e1){return _0x4307e1?{'count':_0x5607bd,'rows':_0x4307e1}:null;}})[_0xac97('0x1d')](respondWithResult(_0x5d0141,null))[_0xac97('0x28')](handleError(_0x5d0141,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c19d987..ff0d3d2 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 _0x3be3=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3be3,0x1d7));var _0x33be=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x3be3[_0xcf4569];return _0x7fef;};'use strict';var EventEmitter=require(_0x33be('0x0'));var FaxAccount=require(_0x33be('0x1'))['db'][_0x33be('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x33be('0x3')](0x0);var events={'afterCreate':_0x33be('0x4'),'afterUpdate':'update','afterDestroy':_0x33be('0x5')};function emitEvent(_0x28134b){return function(_0x5b2964,_0x73e440,_0x388228){FaxAccountEvents['emit'](_0x28134b+':'+_0x5b2964['id'],_0x5b2964);FaxAccountEvents['emit'](_0x28134b,_0x5b2964);_0x388228(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x33be('0x6')](e,emitEvent(event));}}module[_0x33be('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xf73f=['hasOwnProperty','hook','FaxAccount','save','update','remove','emit'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xf73f,0x87));var _0xff73=function(_0x47eb49,_0xfbc1dd){_0x47eb49=_0x47eb49-0x0;var _0x4738c2=_0xf73f[_0x47eb49];return _0x4738c2;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xff73('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xff73('0x1'),'afterUpdate':_0xff73('0x2'),'afterDestroy':_0xff73('0x3')};function emitEvent(_0x376816){return function(_0x3b8d72,_0x2b11e9,_0x28f81c){FaxAccountEvents[_0xff73('0x4')](_0x376816+':'+_0x3b8d72['id'],_0x3b8d72);FaxAccountEvents[_0xff73('0x4')](_0x376816,_0x3b8d72);_0x28f81c(null);};}for(var e in events){if(events[_0xff73('0x5')](e)){var event=events[e];FaxAccount[_0xff73('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bcd96be..67b671f 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 _0xdbd7=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','api'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0xdbd7,0x133));var _0x7dbd=function(_0xd34c38,_0x455c59){_0xd34c38=_0xd34c38-0x0;var _0xd180d6=_0xdbd7[_0xd34c38];return _0xd180d6;};'use strict';var _=require(_0x7dbd('0x0'));var util=require(_0x7dbd('0x1'));var logger=require('../../config/logger')(_0x7dbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7dbd('0x3'));var config=require(_0x7dbd('0x4'));var attributes=require(_0x7dbd('0x5'));module[_0x7dbd('0x6')]=function(_0x156cb7,_0x438dbf){return _0x156cb7[_0x7dbd('0x7')](_0x7dbd('0x8'),attributes,{'tableName':_0x7dbd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0aed=['./faxAccount.attributes','exports','FaxAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x0aed,0x175));var _0xd0ae=function(_0xb8d37c,_0x10a6a4){_0xb8d37c=_0xb8d37c-0x0;var _0x400f4b=_0x0aed[_0xb8d37c];return _0x400f4b;};'use strict';var _=require('lodash');var util=require(_0xd0ae('0x0'));var logger=require(_0xd0ae('0x1'))(_0xd0ae('0x2'));var moment=require(_0xd0ae('0x3'));var BPromise=require(_0xd0ae('0x4'));var rp=require(_0xd0ae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0ae('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0ae('0x7'));module[_0xd0ae('0x8')]=function(_0x59daac,_0x25d900){return _0x59daac['define'](_0xd0ae('0x9'),attributes,{'tableName':'fax_accounts','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 2f4e37f..c1b9cc7 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 _0xa406=['localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','include','model','attributes','map','then','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','keys','createdAt','updatedAt','difference','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','account','applications','orderBy','priority','asc','length','create','contact','fax','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','randomstring','../../mysqldb','jayson/promise','client','http','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa406,0xa2));var _0x6a40=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa406[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x6a40('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a40('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a40('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a40('0x3'));var client=jayson[_0x6a40('0x4')][_0x6a40('0x5')]({'port':0x232c});config[_0x6a40('0x6')]=_[_0x6a40('0x7')](config[_0x6a40('0x6')],{'host':_0x6a40('0x8'),'port':0x18eb});var socket=require(_0x6a40('0x9'))(new Redis(config[_0x6a40('0x6')]));require(_0x6a40('0xa'))[_0x6a40('0xb')](socket);function respondWithRpcPromise(_0x1c87c2,_0x430764,_0xafa45e){return new BPromise(function(_0x1569f5,_0x2e7e5b){return client[_0x6a40('0xc')](_0x1c87c2,_0xafa45e)['then'](function(_0x203c39){logger[_0x6a40('0xd')](_0x6a40('0xe'),_0x430764,_0x6a40('0xf'));logger[_0x6a40('0x10')](_0x6a40('0x11'),_0x430764,_0x6a40('0xf'),JSON[_0x6a40('0x12')](_0x203c39));if(_0x203c39[_0x6a40('0x13')]){if(_0x203c39[_0x6a40('0x13')]['code']===0x1f4){logger[_0x6a40('0x13')](_0x6a40('0xe'),_0x430764,_0x203c39[_0x6a40('0x13')][_0x6a40('0x14')]);return _0x2e7e5b(_0x203c39[_0x6a40('0x13')]['message']);}logger[_0x6a40('0x13')]('FaxAccount,\x20%s,\x20%s',_0x430764,_0x203c39[_0x6a40('0x13')]['message']);return _0x1569f5(_0x203c39[_0x6a40('0x13')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x430764,_0x6a40('0xf'));_0x1569f5(_0x203c39[_0x6a40('0x15')]['message']);}})[_0x6a40('0x16')](function(_0xb21672){logger['error']('FaxAccount,\x20%s,\x20%s',_0x430764,_0xb21672);_0x2e7e5b(_0xb21672);});});}exports[_0x6a40('0x17')]=function(_0x1acaed){var _0x4a61b9=this;return new Promise(function(_0xb751f2,_0x4f7438){return db[_0x6a40('0x18')]['findAll']({'raw':_0x1acaed[_0x6a40('0x19')]?_0x1acaed[_0x6a40('0x19')][_0x6a40('0x1a')]===undefined?!![]:![]:!![],'where':_0x1acaed[_0x6a40('0x19')]?_0x1acaed['options'][_0x6a40('0x1b')]||null:null,'attributes':_0x1acaed[_0x6a40('0x19')]?_0x1acaed[_0x6a40('0x19')]['attributes']||null:null,'limit':_0x1acaed['options']?_0x1acaed[_0x6a40('0x19')]['limit']||null:null,'include':_0x1acaed[_0x6a40('0x19')]?_0x1acaed[_0x6a40('0x19')][_0x6a40('0x1c')]?_['map'](_0x1acaed[_0x6a40('0x19')][_0x6a40('0x1c')],function(_0x3a9817){return{'model':db[_0x3a9817[_0x6a40('0x1d')]],'as':_0x3a9817['as'],'attributes':_0x3a9817[_0x6a40('0x1e')],'include':_0x3a9817[_0x6a40('0x1c')]?_[_0x6a40('0x1f')](_0x3a9817['include'],function(_0x3b1cff){return{'model':db[_0x3b1cff[_0x6a40('0x1d')]],'as':_0x3b1cff['as'],'attributes':_0x3b1cff[_0x6a40('0x1e')],'include':_0x3b1cff[_0x6a40('0x1c')]?_[_0x6a40('0x1f')](_0x3b1cff[_0x6a40('0x1c')],function(_0x42c3f9){return{'model':db[_0x42c3f9[_0x6a40('0x1d')]],'as':_0x42c3f9['as'],'attributes':_0x42c3f9[_0x6a40('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6a40('0x20')](function(_0x34b104){logger['info'](_0x6a40('0x17'),_0x1acaed);logger[_0x6a40('0x10')](_0x6a40('0x17'),_0x1acaed,JSON['stringify'](_0x34b104));_0xb751f2(_0x34b104);})[_0x6a40('0x16')](function(_0x9ff9d3){logger['error'](_0x6a40('0x17'),_0x9ff9d3['message'],_0x1acaed);_0x4f7438(_0x4a61b9['error'](0x1f4,_0x9ff9d3[_0x6a40('0x14')]));});});};exports[_0x6a40('0x21')]=function(_0x132a86,_0x1ee0b7,_0x390012){var _0x3f6f84=this;return new Promise(function(_0x23aec6,_0x4a14ed){var _0x32117c={'body':_0x132a86['body'],'channel':'fax'};var _0x5474db=[];var _0x16e8c4=[];var _0x3abf10={};return db[_0x6a40('0x22')][_0x6a40('0x23')]()[_0x6a40('0x20')](function(_0x5b0f61){if(!_0x5b0f61){throw new db[(_0x6a40('0x24'))][(_0x6a40('0x25'))]('no\x20available\x20attributes');}_0x5474db=_['difference'](_[_0x6a40('0x26')](_0x5b0f61),[_0x6a40('0x27'),_0x6a40('0x28')]);_0x16e8c4=_[_0x6a40('0x29')](_['keys'](_0x5b0f61),[_0x6a40('0x27'),'updatedAt',_0x6a40('0x2a'),_0x6a40('0x2b')]);if(_0x132a86[_0x6a40('0x2c')]['id']){delete _0x132a86[_0x6a40('0x2c')]['id'];}if(_[_0x6a40('0x2d')](_0x132a86[_0x6a40('0x2c')][_0x6a40('0x2e')])){throw new db['Sequelize'][(_0x6a40('0x25'))](_0x6a40('0x2f'));}if(_[_0x6a40('0x2d')](_0x132a86[_0x6a40('0x2c')]['body'])||_0x132a86[_0x6a40('0x2c')]['body']===''){throw new db[(_0x6a40('0x24'))][(_0x6a40('0x25'))](_0x6a40('0x30'));}if(_[_0x6a40('0x2d')](_0x132a86[_0x6a40('0x2c')][_0x6a40('0x31')])){throw new db[(_0x6a40('0x24'))][(_0x6a40('0x25'))](_0x6a40('0x32')+_0x16e8c4);}if(!_[_0x6a40('0x33')](_0x16e8c4,_0x132a86[_0x6a40('0x2c')][_0x6a40('0x31')])){throw new db['Sequelize'][(_0x6a40('0x25'))](_0x6a40('0x34')+_0x16e8c4);}_0x3abf10[_0x132a86[_0x6a40('0x2c')]['mapKey']]=_0x132a86['body'][_0x6a40('0x2e')];})[_0x6a40('0x20')](function(){return db[_0x6a40('0x18')][_0x6a40('0x35')]({'where':{'id':_0x132a86['account']['id']},'include':[{'model':db[_0x6a40('0x36')],'as':_0x6a40('0x37'),'include':[{'model':db['CmContact'],'as':_0x6a40('0x38'),'where':_0x3abf10,'limit':0x1,'order':[[_0x6a40('0x28'),_0x6a40('0x39')]]}]},{'model':db[_0x6a40('0x3a')],'as':_0x6a40('0x3b')}]});})[_0x6a40('0x20')](function(_0x39c634){if(_0x39c634&&_0x39c634[_0x6a40('0x37')]){var _0x5b4883=_0x39c634['get']({'plain':!![]});_0x32117c[_0x6a40('0x3c')]=_0x5b4883;_0x32117c['applications']=_0x5b4883[_0x6a40('0x3b')];_0x32117c['list']=_0x5b4883[_0x6a40('0x37')];_0x32117c[_0x6a40('0x3d')]=_[_0x6a40('0x3e')](_0x32117c['applications'],[_0x6a40('0x3f')],[_0x6a40('0x40')]);if(_0x32117c[_0x6a40('0x3c')][_0x6a40('0x3b')]){delete _0x32117c[_0x6a40('0x3c')][_0x6a40('0x3b')];}if(_0x32117c[_0x6a40('0x3c')][_0x6a40('0x37')]&&_0x32117c[_0x6a40('0x3c')]['List'][_0x6a40('0x38')][_0x6a40('0x41')]){return _0x32117c[_0x6a40('0x3c')]['List'][_0x6a40('0x38')][0x0];}var _0x502a64=_[_0x6a40('0x7')](_0x132a86[_0x6a40('0x2c')],{'firstName':_0x132a86[_0x6a40('0x2c')]['from'],'ListId':_0x5b4883[_0x6a40('0x2b')]});_0x502a64[_0x132a86[_0x6a40('0x2c')][_0x6a40('0x31')]]=_0x132a86[_0x6a40('0x2c')][_0x6a40('0x2e')];return db[_0x6a40('0x22')][_0x6a40('0x42')](_0x502a64,{'fields':_0x5474db,'raw':!![]});}})[_0x6a40('0x20')](function(_0x58c53a){_0x32117c[_0x6a40('0x43')]=_0x58c53a;if(_0x58c53a){var _0x3f0abc={'ContactId':_0x58c53a['id'],'FaxAccountId':_0x132a86[_0x6a40('0x3c')]['id'],'fax':_0x58c53a[_0x6a40('0x44')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x58c53a['id'],'closed':![],'FaxAccountId':_0x132a86[_0x6a40('0x3c')]['id']}})[_0x6a40('0x20')](function(_0x4f3289){if(_0x4f3289){return[_0x4f3289,![]];}return db['FaxInteraction'][_0x6a40('0x42')](_0x3f0abc)['then'](function(_0x2e889e){return[_0x2e889e,!![]];});});}else{throw new Error(_0x6a40('0x45'));}})[_0x6a40('0x46')](function(_0x3c919b,_0x3cadc0){var _0x44030e=_0x3c919b['get']({'plain':!![]});if(_0x3cadc0){if(_0x32117c[_0x6a40('0x3c')][_0x6a40('0x47')]){_0x32117c['applications'][_0x6a40('0x48')]({'id':0x0,'priority':_0x32117c['applications'][_0x6a40('0x41')]+0x1,'app':_0x6a40('0x49'),'appdata':'unmanaged','interval':_0x6a40('0x4a')});}_0x44030e['created']=!![];}else{_0x44030e['created']=![];}_0x32117c[_0x6a40('0x4b')]=_0x44030e;return db[_0x6a40('0x4c')][_0x6a40('0x42')]({'body':_0x132a86[_0x6a40('0x2c')][_0x6a40('0x2c')],'FaxAccountId':_0x132a86[_0x6a40('0x3c')]['id'],'FaxInteractionId':_0x3c919b['id'],'direction':'in','ContactId':_0x3c919b[_0x6a40('0x4d')],'AttachmentId':_0x132a86[_0x6a40('0x2c')][_0x6a40('0x4e')]});})[_0x6a40('0x20')](function(_0x2ab304){_0x32117c[_0x6a40('0x14')]=_0x2ab304;if(_0x32117c[_0x6a40('0x4b')][_0x6a40('0x4f')]){return db['User'][_0x6a40('0x35')]({'attributes':['id',_0x6a40('0x50')],'where':{'id':_0x32117c[_0x6a40('0x4b')][_0x6a40('0x4f')]}})[_0x6a40('0x20')](function(_0x14b7f7){if(_0x14b7f7){_0x32117c[_0x6a40('0x3d')][_0x6a40('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x14b7f7[_0x6a40('0x50')]+','+(_0x32117c['account'][_0x6a40('0x52')]||0xa),'interval':_0x6a40('0x4a')});}return respondWithRpcPromise(_0x6a40('0x53'),_0x6a40('0x54'),_0x32117c);});}return respondWithRpcPromise(_0x6a40('0x53'),_0x6a40('0x54'),_0x32117c);})['then'](function(_0x57f7f4){_0x23aec6(_0x57f7f4);})['catch'](function(_0x93da5c){_0x4a14ed(_0x3f6f84['error'](0x1f4,_0x93da5c[_0x6a40('0x14')]));});});}; \ No newline at end of file +var _0xd913=['include','model','debug','stringify','NotifyFaxAccount','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Sequelize','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','get','applications','list','priority','List','create','contact','FaxInteraction','spread','autoclose','push','length','*,*,*,*','created','interaction','FaxMessage','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','attributes','limit','map'];(function(_0x1d04c2,_0x1acc43){var _0xb51980=function(_0x2c08eb){while(--_0x2c08eb){_0x1d04c2['push'](_0x1d04c2['shift']());}};_0xb51980(++_0x1acc43);}(_0xd913,0xee));var _0x3d91=function(_0x3de977,_0x444397){_0x3de977=_0x3de977-0x0;var _0x3a5984=_0xd913[_0x3de977];return _0x3a5984;};'use strict';var _=require(_0x3d91('0x0'));var util=require(_0x3d91('0x1'));var moment=require(_0x3d91('0x2'));var BPromise=require(_0x3d91('0x3'));var rs=require(_0x3d91('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d91('0x5'));var logger=require(_0x3d91('0x6'))(_0x3d91('0x7'));var config=require(_0x3d91('0x8'));var jayson=require(_0x3d91('0x9'));var client=jayson[_0x3d91('0xa')][_0x3d91('0xb')]({'port':0x232c});config['redis']=_['defaults'](config[_0x3d91('0xc')],{'host':_0x3d91('0xd'),'port':0x18eb});var socket=require(_0x3d91('0xe'))(new Redis(config[_0x3d91('0xc')]));require(_0x3d91('0xf'))[_0x3d91('0x10')](socket);function respondWithRpcPromise(_0x2a4048,_0x4bd9a5,_0x1ee0c2){return new BPromise(function(_0x11e705,_0x57f44d){return client[_0x3d91('0x11')](_0x2a4048,_0x1ee0c2)[_0x3d91('0x12')](function(_0x1a5f60){logger[_0x3d91('0x13')](_0x3d91('0x14'),_0x4bd9a5,_0x3d91('0x15'));logger['debug'](_0x3d91('0x16'),_0x4bd9a5,'request\x20sent',JSON['stringify'](_0x1a5f60));if(_0x1a5f60[_0x3d91('0x17')]){if(_0x1a5f60[_0x3d91('0x17')][_0x3d91('0x18')]===0x1f4){logger[_0x3d91('0x17')](_0x3d91('0x14'),_0x4bd9a5,_0x1a5f60['error'][_0x3d91('0x19')]);return _0x57f44d(_0x1a5f60[_0x3d91('0x17')][_0x3d91('0x19')]);}logger['error'](_0x3d91('0x14'),_0x4bd9a5,_0x1a5f60['error'][_0x3d91('0x19')]);return _0x11e705(_0x1a5f60['error']['message']);}else{logger[_0x3d91('0x13')](_0x3d91('0x14'),_0x4bd9a5,_0x3d91('0x15'));_0x11e705(_0x1a5f60[_0x3d91('0x1a')][_0x3d91('0x19')]);}})[_0x3d91('0x1b')](function(_0x331707){logger[_0x3d91('0x17')](_0x3d91('0x14'),_0x4bd9a5,_0x331707);_0x57f44d(_0x331707);});});}exports[_0x3d91('0x1c')]=function(_0x212a1f){var _0x5e8203=this;return new Promise(function(_0x1cd3fe,_0x342758){return db['FaxAccount'][_0x3d91('0x1d')]({'raw':_0x212a1f[_0x3d91('0x1e')]?_0x212a1f['options'][_0x3d91('0x1f')]===undefined?!![]:![]:!![],'where':_0x212a1f['options']?_0x212a1f[_0x3d91('0x1e')]['where']||null:null,'attributes':_0x212a1f[_0x3d91('0x1e')]?_0x212a1f[_0x3d91('0x1e')][_0x3d91('0x20')]||null:null,'limit':_0x212a1f[_0x3d91('0x1e')]?_0x212a1f['options'][_0x3d91('0x21')]||null:null,'include':_0x212a1f['options']?_0x212a1f[_0x3d91('0x1e')]['include']?_[_0x3d91('0x22')](_0x212a1f['options'][_0x3d91('0x23')],function(_0x55afeb){return{'model':db[_0x55afeb['model']],'as':_0x55afeb['as'],'attributes':_0x55afeb[_0x3d91('0x20')],'include':_0x55afeb[_0x3d91('0x23')]?_[_0x3d91('0x22')](_0x55afeb[_0x3d91('0x23')],function(_0x5e3741){return{'model':db[_0x5e3741[_0x3d91('0x24')]],'as':_0x5e3741['as'],'attributes':_0x5e3741[_0x3d91('0x20')],'include':_0x5e3741[_0x3d91('0x23')]?_[_0x3d91('0x22')](_0x5e3741[_0x3d91('0x23')],function(_0x4c9dc2){return{'model':db[_0x4c9dc2[_0x3d91('0x24')]],'as':_0x4c9dc2['as'],'attributes':_0x4c9dc2[_0x3d91('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3d91('0x12')](function(_0x5b7778){logger[_0x3d91('0x13')]('GetFaxAccount',_0x212a1f);logger[_0x3d91('0x25')](_0x3d91('0x1c'),_0x212a1f,JSON[_0x3d91('0x26')](_0x5b7778));_0x1cd3fe(_0x5b7778);})[_0x3d91('0x1b')](function(_0x248e40){logger[_0x3d91('0x17')](_0x3d91('0x1c'),_0x248e40[_0x3d91('0x19')],_0x212a1f);_0x342758(_0x5e8203[_0x3d91('0x17')](0x1f4,_0x248e40[_0x3d91('0x19')]));});});};exports[_0x3d91('0x27')]=function(_0x3641e2,_0x2e02b0,_0x10ccec){var _0x479f58=this;return new Promise(function(_0x449f40,_0x3c866e){var _0x276ddf={'body':_0x3641e2['body'],'channel':_0x3d91('0x28')};var _0x3303e6=[];var _0x13e346=[];var _0x144837={};return db[_0x3d91('0x29')][_0x3d91('0x2a')]()[_0x3d91('0x12')](function(_0x1bb8e8){if(!_0x1bb8e8){throw new db['Sequelize'][(_0x3d91('0x2b'))](_0x3d91('0x2c'));}_0x3303e6=_[_0x3d91('0x2d')](_['keys'](_0x1bb8e8),[_0x3d91('0x2e'),_0x3d91('0x2f')]);_0x13e346=_[_0x3d91('0x2d')](_[_0x3d91('0x30')](_0x1bb8e8),[_0x3d91('0x2e'),_0x3d91('0x2f'),_0x3d91('0x31'),_0x3d91('0x32')]);if(_0x3641e2[_0x3d91('0x33')]['id']){delete _0x3641e2['body']['id'];}if(_[_0x3d91('0x34')](_0x3641e2[_0x3d91('0x33')][_0x3d91('0x35')])){throw new db['Sequelize'][(_0x3d91('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x3d91('0x34')](_0x3641e2['body'][_0x3d91('0x33')])||_0x3641e2[_0x3d91('0x33')]['body']===''){throw new db['Sequelize'][(_0x3d91('0x2b'))](_0x3d91('0x36'));}if(_['isNil'](_0x3641e2[_0x3d91('0x33')][_0x3d91('0x37')])){throw new db['Sequelize']['ValidationError'](_0x3d91('0x38')+_0x13e346);}if(!_[_0x3d91('0x39')](_0x13e346,_0x3641e2[_0x3d91('0x33')][_0x3d91('0x37')])){throw new db[(_0x3d91('0x3a'))][(_0x3d91('0x2b'))](_0x3d91('0x3b')+_0x13e346);}_0x144837[_0x3641e2['body'][_0x3d91('0x37')]]=_0x3641e2[_0x3d91('0x33')][_0x3d91('0x35')];})[_0x3d91('0x12')](function(){return db['FaxAccount'][_0x3d91('0x3c')]({'where':{'id':_0x3641e2[_0x3d91('0x3d')]['id']},'include':[{'model':db[_0x3d91('0x3e')],'as':'List','include':[{'model':db[_0x3d91('0x29')],'as':_0x3d91('0x3f'),'where':_0x144837,'limit':0x1,'order':[[_0x3d91('0x2f'),_0x3d91('0x40')]]}]},{'model':db[_0x3d91('0x41')],'as':_0x3d91('0x42')}]});})[_0x3d91('0x12')](function(_0x4442d9){if(_0x4442d9&&_0x4442d9['List']){var _0x424bd4=_0x4442d9[_0x3d91('0x43')]({'plain':!![]});_0x276ddf['account']=_0x424bd4;_0x276ddf[_0x3d91('0x44')]=_0x424bd4[_0x3d91('0x42')];_0x276ddf[_0x3d91('0x45')]=_0x424bd4['List'];_0x276ddf[_0x3d91('0x44')]=_['orderBy'](_0x276ddf[_0x3d91('0x44')],[_0x3d91('0x46')],['asc']);if(_0x276ddf[_0x3d91('0x3d')]['Applications']){delete _0x276ddf[_0x3d91('0x3d')][_0x3d91('0x42')];}if(_0x276ddf[_0x3d91('0x3d')]['List']&&_0x276ddf[_0x3d91('0x3d')][_0x3d91('0x47')][_0x3d91('0x3f')]['length']){return _0x276ddf[_0x3d91('0x3d')][_0x3d91('0x47')][_0x3d91('0x3f')][0x0];}var _0x45c776=_['defaults'](_0x3641e2[_0x3d91('0x33')],{'firstName':_0x3641e2['body']['from'],'ListId':_0x424bd4['ListId']});_0x45c776[_0x3641e2[_0x3d91('0x33')][_0x3d91('0x37')]]=_0x3641e2[_0x3d91('0x33')][_0x3d91('0x35')];return db[_0x3d91('0x29')][_0x3d91('0x48')](_0x45c776,{'fields':_0x3303e6,'raw':!![]});}})['then'](function(_0x16949c){_0x276ddf[_0x3d91('0x49')]=_0x16949c;if(_0x16949c){var _0x4f0fd2={'ContactId':_0x16949c['id'],'FaxAccountId':_0x3641e2[_0x3d91('0x3d')]['id'],'fax':_0x16949c['fax']};return db['FaxInteraction'][_0x3d91('0x3c')]({'where':{'ContactId':_0x16949c['id'],'closed':![],'FaxAccountId':_0x3641e2[_0x3d91('0x3d')]['id']}})[_0x3d91('0x12')](function(_0x2465c3){if(_0x2465c3){return[_0x2465c3,![]];}return db[_0x3d91('0x4a')][_0x3d91('0x48')](_0x4f0fd2)[_0x3d91('0x12')](function(_0x9b116){return[_0x9b116,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d91('0x4b')](function(_0x364f4b,_0x1c47ea){var _0x28477d=_0x364f4b[_0x3d91('0x43')]({'plain':!![]});if(_0x1c47ea){if(_0x276ddf[_0x3d91('0x3d')][_0x3d91('0x4c')]){_0x276ddf[_0x3d91('0x44')][_0x3d91('0x4d')]({'id':0x0,'priority':_0x276ddf['applications'][_0x3d91('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3d91('0x4f')});}_0x28477d[_0x3d91('0x50')]=!![];}else{_0x28477d['created']=![];}_0x276ddf[_0x3d91('0x51')]=_0x28477d;return db[_0x3d91('0x52')][_0x3d91('0x48')]({'body':_0x3641e2[_0x3d91('0x33')][_0x3d91('0x33')],'FaxAccountId':_0x3641e2['account']['id'],'FaxInteractionId':_0x364f4b['id'],'direction':'in','ContactId':_0x364f4b['ContactId'],'AttachmentId':_0x3641e2[_0x3d91('0x33')]['AttachmentId']});})[_0x3d91('0x12')](function(_0xfbf8c5){_0x276ddf[_0x3d91('0x19')]=_0xfbf8c5;if(_0x276ddf[_0x3d91('0x51')][_0x3d91('0x53')]){return db[_0x3d91('0x54')][_0x3d91('0x3c')]({'attributes':['id',_0x3d91('0x55')],'where':{'id':_0x276ddf[_0x3d91('0x51')][_0x3d91('0x53')]}})[_0x3d91('0x12')](function(_0x3b3c70){if(_0x3b3c70){_0x276ddf[_0x3d91('0x44')][_0x3d91('0x56')]({'id':0x0,'priority':0x0,'app':_0x3d91('0x57'),'appdata':_0x3b3c70[_0x3d91('0x55')]+','+(_0x276ddf[_0x3d91('0x3d')][_0x3d91('0x58')]||0xa),'interval':_0x3d91('0x4f')});}return respondWithRpcPromise(_0x3d91('0x59'),'startRouting',_0x276ddf);});}return respondWithRpcPromise('Start',_0x3d91('0x5a'),_0x276ddf);})['then'](function(_0x271748){_0x449f40(_0x271748);})[_0x3d91('0x1b')](function(_0x2c13fe){_0x3c866e(_0x479f58[_0x3d91('0x17')](0x1f4,_0x2c13fe[_0x3d91('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0ac74d7..e8c4477 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 _0x4325=['./faxAccount.events','save','update','removeListener','length','faxAccount:'];(function(_0x4a7c3b,_0x3931eb){var _0x416505=function(_0xd8889){while(--_0xd8889){_0x4a7c3b['push'](_0x4a7c3b['shift']());}};_0x416505(++_0x3931eb);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var FaxAccountEvents=require(_0x5432('0x0'));var events=[_0x5432('0x1'),'remove',_0x5432('0x2')];function createListener(_0x533c92,_0x12c8d8){return function(_0x480fb7){_0x12c8d8['emit'](_0x533c92,_0x480fb7);};}function removeListener(_0x20f704,_0x36ce53){return function(){FaxAccountEvents[_0x5432('0x3')](_0x20f704,_0x36ce53);};}exports['register']=function(_0x209e2e){for(var _0xbb0075=0x0,_0x4a6e76=events[_0x5432('0x4')];_0xbb0075<_0x4a6e76;_0xbb0075++){var _0x50394d=events[_0xbb0075];var _0xc8252e=createListener(_0x5432('0x5')+_0x50394d,_0x209e2e);FaxAccountEvents['on'](_0x50394d,_0xc8252e);}}; \ No newline at end of file +var _0xf2e3=['faxAccount:','./faxAccount.events','remove','update','emit','removeListener','length'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xf2e3[_0x243b59];return _0x3e1676;};'use strict';var FaxAccountEvents=require(_0x3f2e('0x0'));var events=['save',_0x3f2e('0x1'),_0x3f2e('0x2')];function createListener(_0x3fba4b,_0x30f1bb){return function(_0x27d28c){_0x30f1bb[_0x3f2e('0x3')](_0x3fba4b,_0x27d28c);};}function removeListener(_0x3938e2,_0xabcf5c){return function(){FaxAccountEvents[_0x3f2e('0x4')](_0x3938e2,_0xabcf5c);};}exports['register']=function(_0x33a3b7){for(var _0xdd6b3e=0x0,_0x3c0864=events[_0x3f2e('0x5')];_0xdd6b3e<_0x3c0864;_0xdd6b3e++){var _0x12c6e7=events[_0xdd6b3e];var _0x11067d=createListener(_0x3f2e('0x6')+_0x12c6e7,_0x33a3b7);FaxAccountEvents['on'](_0x12c6e7,_0x11067d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index aa7b547..f2c8109 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 _0x4e2f=['put','update','removeDispositions','removeAnswers','delete','removeAgents','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','create','post','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send'];(function(_0x215916,_0x1a8422){var _0x3ccdf4=function(_0x1b8822){while(--_0x1b8822){_0x215916['push'](_0x215916['shift']());}};_0x3ccdf4(++_0x1a8422);}(_0x4e2f,0x15c));var _0xf4e2=function(_0x1242aa,_0x4d821c){_0x1242aa=_0x1242aa-0x0;var _0x3fd80a=_0x4e2f[_0x1242aa];return _0x3fd80a;};'use strict';var multer=require(_0xf4e2('0x0'));var util=require('util');var path=require(_0xf4e2('0x1'));var timeout=require(_0xf4e2('0x2'));var express=require('express');var router=express[_0xf4e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf4e2('0x4'));var config=require(_0xf4e2('0x5'));var controller=require(_0xf4e2('0x6'));router[_0xf4e2('0x7')]('/',auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x9')]);router[_0xf4e2('0x7')](_0xf4e2('0xa'),auth[_0xf4e2('0x8')](),controller['describe']);router[_0xf4e2('0x7')](_0xf4e2('0xb'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0xc')]);router[_0xf4e2('0x7')](_0xf4e2('0xd'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0xe')]);router[_0xf4e2('0x7')](_0xf4e2('0xf'),auth['isAuthenticated'](),controller[_0xf4e2('0x10')]);router[_0xf4e2('0x7')](_0xf4e2('0x11'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x12')]);router[_0xf4e2('0x7')](_0xf4e2('0x13'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x14')]);router[_0xf4e2('0x7')](_0xf4e2('0x15'),auth[_0xf4e2('0x8')](),controller['getMessages']);router['get'](_0xf4e2('0x16'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xf4e2('0x17')]);router[_0xf4e2('0x18')](_0xf4e2('0xd'),auth[_0xf4e2('0x8')](),controller['addDisposition']);router[_0xf4e2('0x18')](_0xf4e2('0xf'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xf4e2('0x18')](_0xf4e2('0x11'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x19')]);router[_0xf4e2('0x18')]('/:id/applications',auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x1a')]);router[_0xf4e2('0x18')](_0xf4e2('0x1b'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x1c')]);router[_0xf4e2('0x18')]('/updateaccountapplications',auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x1d')]);router[_0xf4e2('0x18')](_0xf4e2('0x1e'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x1f')]);router[_0xf4e2('0x18')](_0xf4e2('0x16'),auth[_0xf4e2('0x8')](),controller['addAgents']);router[_0xf4e2('0x20')](_0xf4e2('0xb'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x21')]);router['delete'](_0xf4e2('0xb'),auth[_0xf4e2('0x8')](),controller['destroy']);router['delete'](_0xf4e2('0xd'),auth['isAuthenticated'](),controller[_0xf4e2('0x22')]);router['delete']('/:id/canned_answers',auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x23')]);router[_0xf4e2('0x24')](_0xf4e2('0x16'),auth[_0xf4e2('0x8')](),controller[_0xf4e2('0x25')]);module['exports']=router; \ No newline at end of file +var _0x9f08=['/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x1f1fa6,_0x2864d4){var _0xe38738=function(_0x245df6){while(--_0x245df6){_0x1f1fa6['push'](_0x1f1fa6['shift']());}};_0xe38738(++_0x2864d4);}(_0x9f08,0x114));var _0x89f0=function(_0x2e3d77,_0x46e1a2){_0x2e3d77=_0x2e3d77-0x0;var _0x1d0cd4=_0x9f08[_0x2e3d77];return _0x1d0cd4;};'use strict';var multer=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var path=require(_0x89f0('0x2'));var timeout=require(_0x89f0('0x3'));var express=require(_0x89f0('0x4'));var router=express[_0x89f0('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89f0('0x6'));var controller=require('./faxAccount.controller');router[_0x89f0('0x7')]('/',auth[_0x89f0('0x8')](),controller['index']);router['get'](_0x89f0('0x9'),auth[_0x89f0('0x8')](),controller[_0x89f0('0xa')]);router[_0x89f0('0x7')](_0x89f0('0xb'),auth[_0x89f0('0x8')](),controller[_0x89f0('0xc')]);router[_0x89f0('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x89f0('0xd')]);router[_0x89f0('0x7')](_0x89f0('0xe'),auth[_0x89f0('0x8')](),controller[_0x89f0('0xf')]);router['get'](_0x89f0('0x10'),auth['isAuthenticated'](),controller[_0x89f0('0x11')]);router[_0x89f0('0x7')](_0x89f0('0x12'),auth['isAuthenticated'](),controller[_0x89f0('0x13')]);router[_0x89f0('0x7')](_0x89f0('0x14'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x15')]);router[_0x89f0('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x89f0('0x16')]);router[_0x89f0('0x17')]('/',auth[_0x89f0('0x8')](),controller[_0x89f0('0x18')]);router[_0x89f0('0x17')](_0x89f0('0x19'),auth['isAuthenticated'](),controller[_0x89f0('0x1a')]);router[_0x89f0('0x17')](_0x89f0('0xe'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x1b')]);router['post'](_0x89f0('0x10'),auth[_0x89f0('0x8')](),controller['addInteraction']);router['post'](_0x89f0('0x12'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x1c')]);router[_0x89f0('0x17')]('/addaccountapplications',auth[_0x89f0('0x8')](),controller[_0x89f0('0x1d')]);router[_0x89f0('0x17')](_0x89f0('0x1e'),auth['isAuthenticated'](),controller[_0x89f0('0x1f')]);router[_0x89f0('0x17')](_0x89f0('0x20'),auth['isAuthenticated'](),controller['send']);router['post'](_0x89f0('0x21'),auth[_0x89f0('0x8')](),controller['addAgents']);router[_0x89f0('0x22')]('/:id',auth[_0x89f0('0x8')](),controller[_0x89f0('0x23')]);router[_0x89f0('0x24')](_0x89f0('0xb'),auth['isAuthenticated'](),controller[_0x89f0('0x25')]);router[_0x89f0('0x24')](_0x89f0('0x19'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x26')]);router[_0x89f0('0x24')](_0x89f0('0xe'),auth['isAuthenticated'](),controller[_0x89f0('0x27')]);router[_0x89f0('0x24')](_0x89f0('0x21'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index cbf42f3..cc0b0dc 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 _0x9bb3=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1d4f91,_0x171a05){var _0x46b711=function(_0x39f1a7){while(--_0x39f1a7){_0x1d4f91['push'](_0x1d4f91['shift']());}};_0x46b711(++_0x171a05);}(_0x9bb3,0x134));var _0x39bb=function(_0x5284e1,_0x3f55e3){_0x5284e1=_0x5284e1-0x0;var _0x5ce603=_0x9bb3[_0x5284e1];return _0x5ce603;};'use strict';var Sequelize=require(_0x39bb('0x0'));module[_0x39bb('0x1')]={'priority':{'type':Sequelize[_0x39bb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x39bb('0x3')],'allowNull':![],'defaultValue':_0x39bb('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x39bb('0x3')],'defaultValue':_0x39bb('0x5')}}; \ No newline at end of file +var _0x8ed7=['INTEGER','STRING','*,*,*,*','exports'];(function(_0x18f0bd,_0x2675c3){var _0x314678=function(_0x558bff){while(--_0x558bff){_0x18f0bd['push'](_0x18f0bd['shift']());}};_0x314678(++_0x2675c3);}(_0x8ed7,0x8b));var _0x78ed=function(_0x447bd8,_0x28ec15){_0x447bd8=_0x447bd8-0x0;var _0x113018=_0x8ed7[_0x447bd8];return _0x113018;};'use strict';var Sequelize=require('sequelize');module[_0x78ed('0x0')]={'priority':{'type':Sequelize[_0x78ed('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x78ed('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x78ed('0x2')]},'interval':{'type':Sequelize[_0x78ed('0x2')],'defaultValue':_0x78ed('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 71ce9c9..84c0d3a 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 _0x0a09=['apply','reject','save','update','then','end','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','filtears','create','body','find','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json'];(function(_0xea54a8,_0x17384d){var _0x3f7c8d=function(_0x22d015){while(--_0x22d015){_0xea54a8['push'](_0xea54a8['shift']());}};_0x3f7c8d(++_0x17384d);}(_0x0a09,0x1ed));var _0x90a0=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x0a09[_0x3a9661];return _0x5bb119;};'use strict';var pdf=require(_0x90a0('0x0'));var emlformat=require(_0x90a0('0x1'));var rimraf=require(_0x90a0('0x2'));var zipdir=require(_0x90a0('0x3'));var jsonpatch=require(_0x90a0('0x4'));var rp=require(_0x90a0('0x5'));var moment=require('moment');var BPromise=require(_0x90a0('0x6'));var Mustache=require('mustache');var util=require(_0x90a0('0x7'));var path=require(_0x90a0('0x8'));var sox=require('sox');var csv=require(_0x90a0('0x9'));var ejs=require(_0x90a0('0xa'));var fs=require('fs');var _=require(_0x90a0('0xb'));var squel=require(_0x90a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90a0('0xd'));var toCsv=require(_0x90a0('0x9'));var querystring=require(_0x90a0('0xe'));var Papa=require(_0x90a0('0xf'));var Redis=require(_0x90a0('0x10'));var authService=require(_0x90a0('0x11'));var qs=require(_0x90a0('0x12'));var as=require(_0x90a0('0x13'));var hardwareService=require(_0x90a0('0x14'));var logger=require('../../config/logger')(_0x90a0('0x15'));var utils=require(_0x90a0('0x16'));var config=require(_0x90a0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x90a0('0x18'))['db'];function respondWithStatusCode(_0x455c38,_0x25475c){_0x25475c=_0x25475c||0xcc;return function(_0x2b16a0){if(_0x2b16a0){return _0x455c38[_0x90a0('0x19')](_0x25475c);}return _0x455c38[_0x90a0('0x1a')](_0x25475c)['end']();};}function respondWithResult(_0xe05726,_0x26313a){_0x26313a=_0x26313a||0xc8;return function(_0x4d5a08){if(_0x4d5a08){return _0xe05726[_0x90a0('0x1a')](_0x26313a)['json'](_0x4d5a08);}};}function respondWithFilteredResult(_0x5db5dd,_0x2406f4){return function(_0x235d19){if(_0x235d19){var _0x347666=_0x235d19[_0x90a0('0x1b')],_0xbfff86=_0x2406f4[_0x90a0('0x1c')],_0x4ce4db=_0x2406f4['offset']+_0x2406f4[_0x90a0('0x1d')],_0x3d66b3;if(_0x4ce4db>=_0x347666){_0x4ce4db=_0x347666;_0x3d66b3=0xc8;}else{_0x3d66b3=0xce;}_0x5db5dd[_0x90a0('0x1a')](_0x3d66b3);return _0x5db5dd['set'](_0x90a0('0x1e'),_0xbfff86+'-'+_0x4ce4db+'/'+_0x347666)[_0x90a0('0x1f')](_0x235d19);}return null;};}function patchUpdates(_0x3ad430){return function(_0x18125a){try{jsonpatch[_0x90a0('0x20')](_0x18125a,_0x3ad430,!![]);}catch(_0x55838a){return BPromise[_0x90a0('0x21')](_0x55838a);}return _0x18125a[_0x90a0('0x22')]();};}function saveUpdates(_0x444581,_0x4ed43f){return function(_0x1cb517){if(_0x1cb517){return _0x1cb517[_0x90a0('0x23')](_0x444581)[_0x90a0('0x24')](function(_0xc664e1){return _0xc664e1;});}return null;};}function removeEntity(_0x16d0bc,_0x42acf2){return function(_0x26d66b){if(_0x26d66b){return _0x26d66b['destroy']()[_0x90a0('0x24')](function(){_0x16d0bc[_0x90a0('0x1a')](0xcc)[_0x90a0('0x25')]();});}};}function handleEntityNotFound(_0x3106eb,_0x470c2e){return function(_0x1ca192){if(!_0x1ca192){_0x3106eb[_0x90a0('0x19')](0x194);}return _0x1ca192;};}function handleError(_0x4e10c5,_0x44fe1c){_0x44fe1c=_0x44fe1c||0x1f4;return function(_0x179f6a){logger[_0x90a0('0x26')](_0x179f6a[_0x90a0('0x27')]);if(_0x179f6a[_0x90a0('0x28')]){delete _0x179f6a['name'];}_0x4e10c5[_0x90a0('0x1a')](_0x44fe1c)[_0x90a0('0x29')](_0x179f6a);};}exports['index']=function(_0x6d57b8,_0x208763){var _0x1256fb={},_0x49938a={},_0x31d132={'count':0x0,'rows':[]};var _0x5a588e=_[_0x90a0('0x2a')](db[_0x90a0('0x2b')][_0x90a0('0x2c')],function(_0x486b7e){return{'name':_0x486b7e[_0x90a0('0x2d')],'type':_0x486b7e['type']['key']};});_0x49938a[_0x90a0('0x2e')]=_[_0x90a0('0x2a')](_0x5a588e,_0x90a0('0x28'));_0x49938a[_0x90a0('0x2f')]=_[_0x90a0('0x30')](_0x6d57b8[_0x90a0('0x2f')]);_0x49938a[_0x90a0('0x31')]=_[_0x90a0('0x32')](_0x49938a['model'],_0x49938a[_0x90a0('0x2f')]);_0x1256fb[_0x90a0('0x33')]=_[_0x90a0('0x32')](_0x49938a['model'],qs[_0x90a0('0x34')](_0x6d57b8[_0x90a0('0x2f')][_0x90a0('0x34')]));_0x1256fb[_0x90a0('0x33')]=_0x1256fb[_0x90a0('0x33')][_0x90a0('0x35')]?_0x1256fb[_0x90a0('0x33')]:_0x49938a[_0x90a0('0x2e')];if(!_0x6d57b8[_0x90a0('0x2f')]['hasOwnProperty'](_0x90a0('0x36'))){_0x1256fb[_0x90a0('0x1d')]=qs[_0x90a0('0x1d')](_0x6d57b8['query']['limit']);_0x1256fb[_0x90a0('0x1c')]=qs[_0x90a0('0x1c')](_0x6d57b8[_0x90a0('0x2f')][_0x90a0('0x1c')]);}_0x1256fb[_0x90a0('0x37')]=qs[_0x90a0('0x38')](_0x6d57b8[_0x90a0('0x2f')]['sort']);_0x1256fb[_0x90a0('0x39')]=qs[_0x90a0('0x31')](_[_0x90a0('0x3a')](_0x6d57b8[_0x90a0('0x2f')],_0x49938a['filters']),_0x5a588e);if(_0x6d57b8[_0x90a0('0x2f')]['filter']){_0x1256fb['where']=_[_0x90a0('0x3b')](_0x1256fb[_0x90a0('0x39')],{'$or':_[_0x90a0('0x2a')](_0x5a588e,function(_0x4bd328){if(_0x4bd328[_0x90a0('0x3c')]!=='VIRTUAL'){var _0x16ba65={};_0x16ba65[_0x4bd328[_0x90a0('0x28')]]={'$like':'%'+_0x6d57b8['query'][_0x90a0('0x3d')]+'%'};return _0x16ba65;}})});}_0x1256fb=_['merge']({},_0x1256fb,_0x6d57b8[_0x90a0('0x3e')]);var _0x357ca2={'where':_0x1256fb[_0x90a0('0x39')]};return db['FaxApplication']['count'](_0x357ca2)[_0x90a0('0x24')](function(_0x226f22){_0x31d132['count']=_0x226f22;if(_0x6d57b8[_0x90a0('0x2f')][_0x90a0('0x3f')]){_0x1256fb[_0x90a0('0x40')]=[{'all':!![]}];}return db[_0x90a0('0x2b')][_0x90a0('0x41')](_0x1256fb);})[_0x90a0('0x24')](function(_0x3807d6){_0x31d132[_0x90a0('0x42')]=_0x3807d6;return _0x31d132;})[_0x90a0('0x24')](respondWithFilteredResult(_0x208763,_0x1256fb))[_0x90a0('0x43')](handleError(_0x208763,null));};exports[_0x90a0('0x44')]=function(_0x93c595,_0xf48b9f){var _0x5ec788={'raw':!![],'where':{'id':_0x93c595[_0x90a0('0x45')]['id']}},_0x5e7ac2={};_0x5e7ac2[_0x90a0('0x2e')]=_['keys'](db['FaxApplication'][_0x90a0('0x2c')]);_0x5e7ac2['query']=_[_0x90a0('0x30')](_0x93c595['query']);_0x5e7ac2[_0x90a0('0x46')]=_[_0x90a0('0x32')](_0x5e7ac2[_0x90a0('0x2e')],_0x5e7ac2[_0x90a0('0x2f')]);_0x5ec788[_0x90a0('0x33')]=_[_0x90a0('0x32')](_0x5e7ac2['model'],qs[_0x90a0('0x34')](_0x93c595[_0x90a0('0x2f')]['fields']));_0x5ec788[_0x90a0('0x33')]=_0x5ec788[_0x90a0('0x33')][_0x90a0('0x35')]?_0x5ec788[_0x90a0('0x33')]:_0x5e7ac2['model'];if(_0x93c595[_0x90a0('0x2f')][_0x90a0('0x3f')]){_0x5ec788[_0x90a0('0x40')]=[{'all':!![]}];}_0x5ec788=_[_0x90a0('0x3b')]({},_0x5ec788,_0x93c595['options']);return db[_0x90a0('0x2b')]['find'](_0x5ec788)[_0x90a0('0x24')](handleEntityNotFound(_0xf48b9f,null))['then'](respondWithResult(_0xf48b9f,null))[_0x90a0('0x43')](handleError(_0xf48b9f,null));};exports[_0x90a0('0x47')]=function(_0x500d9b,_0x10af49){return db['FaxApplication'][_0x90a0('0x47')](_0x500d9b[_0x90a0('0x48')],{})[_0x90a0('0x24')](respondWithResult(_0x10af49,0xc9))[_0x90a0('0x43')](handleError(_0x10af49,null));};exports[_0x90a0('0x23')]=function(_0x40d8ba,_0x5d2411){if(_0x40d8ba[_0x90a0('0x48')]['id']){delete _0x40d8ba[_0x90a0('0x48')]['id'];}return db['FaxApplication'][_0x90a0('0x49')]({'where':{'id':_0x40d8ba['params']['id']}})[_0x90a0('0x24')](handleEntityNotFound(_0x5d2411,null))[_0x90a0('0x24')](saveUpdates(_0x40d8ba[_0x90a0('0x48')],null))[_0x90a0('0x24')](respondWithResult(_0x5d2411,null))[_0x90a0('0x43')](handleError(_0x5d2411,null));};exports[_0x90a0('0x4a')]=function(_0x19dc2b,_0xf0ad0b){return db[_0x90a0('0x2b')][_0x90a0('0x49')]({'where':{'id':_0x19dc2b[_0x90a0('0x45')]['id']}})[_0x90a0('0x24')](handleEntityNotFound(_0xf0ad0b,null))[_0x90a0('0x24')](removeEntity(_0xf0ad0b,null))[_0x90a0('0x43')](handleError(_0xf0ad0b,null));}; \ No newline at end of file +var _0x25ea=['stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','count','include','findAll','rows','params','filtears','length','includeAll','find','catch','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','then','sendStatus'];(function(_0xe8738a,_0x520618){var _0x2f9831=function(_0x348e47){while(--_0x348e47){_0xe8738a['push'](_0xe8738a['shift']());}};_0x2f9831(++_0x520618);}(_0x25ea,0xc4));var _0xa25e=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x25ea[_0x57474e];return _0xfaae8c;};'use strict';var pdf=require(_0xa25e('0x0'));var emlformat=require(_0xa25e('0x1'));var rimraf=require(_0xa25e('0x2'));var zipdir=require(_0xa25e('0x3'));var jsonpatch=require(_0xa25e('0x4'));var rp=require('request-promise');var moment=require(_0xa25e('0x5'));var BPromise=require(_0xa25e('0x6'));var Mustache=require(_0xa25e('0x7'));var util=require(_0xa25e('0x8'));var path=require(_0xa25e('0x9'));var sox=require(_0xa25e('0xa'));var csv=require(_0xa25e('0xb'));var ejs=require(_0xa25e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa25e('0xd'));var crypto=require(_0xa25e('0xe'));var jsforce=require(_0xa25e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa25e('0xb'));var querystring=require(_0xa25e('0x10'));var Papa=require(_0xa25e('0x11'));var Redis=require(_0xa25e('0x12'));var authService=require(_0xa25e('0x13'));var qs=require(_0xa25e('0x14'));var as=require(_0xa25e('0x15'));var hardwareService=require(_0xa25e('0x16'));var logger=require(_0xa25e('0x17'))(_0xa25e('0x18'));var utils=require(_0xa25e('0x19'));var config=require(_0xa25e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22fc66,_0xd2f0d9){_0xd2f0d9=_0xd2f0d9||0xcc;return function(_0xad746){if(_0xad746){return _0x22fc66['sendStatus'](_0xd2f0d9);}return _0x22fc66[_0xa25e('0x1b')](_0xd2f0d9)[_0xa25e('0x1c')]();};}function respondWithResult(_0xc30429,_0x180bb3){_0x180bb3=_0x180bb3||0xc8;return function(_0x44cfd3){if(_0x44cfd3){return _0xc30429['status'](_0x180bb3)[_0xa25e('0x1d')](_0x44cfd3);}};}function respondWithFilteredResult(_0x2e2de5,_0x4d1588){return function(_0x36ecb0){if(_0x36ecb0){var _0xec93e6=_0x36ecb0['count'],_0x375113=_0x4d1588[_0xa25e('0x1e')],_0x75ad83=_0x4d1588[_0xa25e('0x1e')]+_0x4d1588[_0xa25e('0x1f')],_0x27f83f;if(_0x75ad83>=_0xec93e6){_0x75ad83=_0xec93e6;_0x27f83f=0xc8;}else{_0x27f83f=0xce;}_0x2e2de5[_0xa25e('0x1b')](_0x27f83f);return _0x2e2de5[_0xa25e('0x20')](_0xa25e('0x21'),_0x375113+'-'+_0x75ad83+'/'+_0xec93e6)[_0xa25e('0x1d')](_0x36ecb0);}return null;};}function patchUpdates(_0x5ab144){return function(_0x28c3de){try{jsonpatch[_0xa25e('0x22')](_0x28c3de,_0x5ab144,!![]);}catch(_0x1e9dd1){return BPromise[_0xa25e('0x23')](_0x1e9dd1);}return _0x28c3de['save']();};}function saveUpdates(_0x496e81,_0x2e8d18){return function(_0x5c330f){if(_0x5c330f){return _0x5c330f['update'](_0x496e81)[_0xa25e('0x24')](function(_0x482a80){return _0x482a80;});}return null;};}function removeEntity(_0x535d37,_0xe5f4b3){return function(_0x468ebe){if(_0x468ebe){return _0x468ebe['destroy']()[_0xa25e('0x24')](function(){_0x535d37[_0xa25e('0x1b')](0xcc)[_0xa25e('0x1c')]();});}};}function handleEntityNotFound(_0x2f6aec,_0x5f286b){return function(_0x32d72d){if(!_0x32d72d){_0x2f6aec[_0xa25e('0x25')](0x194);}return _0x32d72d;};}function handleError(_0x134daf,_0x11cbcf){_0x11cbcf=_0x11cbcf||0x1f4;return function(_0x34166a){logger['error'](_0x34166a[_0xa25e('0x26')]);if(_0x34166a[_0xa25e('0x27')]){delete _0x34166a[_0xa25e('0x27')];}_0x134daf[_0xa25e('0x1b')](_0x11cbcf)[_0xa25e('0x28')](_0x34166a);};}exports[_0xa25e('0x29')]=function(_0x599edc,_0x491370){var _0x1b560a={},_0x2a148d={},_0x7e486d={'count':0x0,'rows':[]};var _0x177b39=_[_0xa25e('0x2a')](db['FaxApplication'][_0xa25e('0x2b')],function(_0x4a19c2){return{'name':_0x4a19c2[_0xa25e('0x2c')],'type':_0x4a19c2[_0xa25e('0x2d')][_0xa25e('0x2e')]};});_0x2a148d[_0xa25e('0x2f')]=_[_0xa25e('0x2a')](_0x177b39,'name');_0x2a148d['query']=_[_0xa25e('0x30')](_0x599edc['query']);_0x2a148d['filters']=_['intersection'](_0x2a148d[_0xa25e('0x2f')],_0x2a148d[_0xa25e('0x31')]);_0x1b560a[_0xa25e('0x32')]=_[_0xa25e('0x33')](_0x2a148d[_0xa25e('0x2f')],qs['fields'](_0x599edc[_0xa25e('0x31')][_0xa25e('0x34')]));_0x1b560a[_0xa25e('0x32')]=_0x1b560a[_0xa25e('0x32')]['length']?_0x1b560a[_0xa25e('0x32')]:_0x2a148d[_0xa25e('0x2f')];if(!_0x599edc[_0xa25e('0x31')][_0xa25e('0x35')]('nolimit')){_0x1b560a[_0xa25e('0x1f')]=qs[_0xa25e('0x1f')](_0x599edc[_0xa25e('0x31')][_0xa25e('0x1f')]);_0x1b560a[_0xa25e('0x1e')]=qs[_0xa25e('0x1e')](_0x599edc[_0xa25e('0x31')][_0xa25e('0x1e')]);}_0x1b560a[_0xa25e('0x36')]=qs[_0xa25e('0x37')](_0x599edc[_0xa25e('0x31')][_0xa25e('0x37')]);_0x1b560a[_0xa25e('0x38')]=qs[_0xa25e('0x39')](_[_0xa25e('0x3a')](_0x599edc[_0xa25e('0x31')],_0x2a148d[_0xa25e('0x39')]),_0x177b39);if(_0x599edc[_0xa25e('0x31')][_0xa25e('0x3b')]){_0x1b560a['where']=_[_0xa25e('0x3c')](_0x1b560a['where'],{'$or':_[_0xa25e('0x2a')](_0x177b39,function(_0x48daa7){if(_0x48daa7['type']!==_0xa25e('0x3d')){var _0x323427={};_0x323427[_0x48daa7[_0xa25e('0x27')]]={'$like':'%'+_0x599edc[_0xa25e('0x31')][_0xa25e('0x3b')]+'%'};return _0x323427;}})});}_0x1b560a=_[_0xa25e('0x3c')]({},_0x1b560a,_0x599edc[_0xa25e('0x3e')]);var _0xbc306b={'where':_0x1b560a[_0xa25e('0x38')]};return db[_0xa25e('0x3f')][_0xa25e('0x40')](_0xbc306b)['then'](function(_0xf4e91d){_0x7e486d[_0xa25e('0x40')]=_0xf4e91d;if(_0x599edc[_0xa25e('0x31')]['includeAll']){_0x1b560a[_0xa25e('0x41')]=[{'all':!![]}];}return db[_0xa25e('0x3f')][_0xa25e('0x42')](_0x1b560a);})['then'](function(_0x4d3144){_0x7e486d[_0xa25e('0x43')]=_0x4d3144;return _0x7e486d;})[_0xa25e('0x24')](respondWithFilteredResult(_0x491370,_0x1b560a))['catch'](handleError(_0x491370,null));};exports['show']=function(_0x5b25e3,_0x5cad36){var _0x2eeb0b={'raw':!![],'where':{'id':_0x5b25e3[_0xa25e('0x44')]['id']}},_0x593660={};_0x593660[_0xa25e('0x2f')]=_[_0xa25e('0x30')](db['FaxApplication'][_0xa25e('0x2b')]);_0x593660[_0xa25e('0x31')]=_[_0xa25e('0x30')](_0x5b25e3[_0xa25e('0x31')]);_0x593660[_0xa25e('0x45')]=_[_0xa25e('0x33')](_0x593660['model'],_0x593660[_0xa25e('0x31')]);_0x2eeb0b['attributes']=_[_0xa25e('0x33')](_0x593660[_0xa25e('0x2f')],qs[_0xa25e('0x34')](_0x5b25e3[_0xa25e('0x31')]['fields']));_0x2eeb0b[_0xa25e('0x32')]=_0x2eeb0b[_0xa25e('0x32')][_0xa25e('0x46')]?_0x2eeb0b[_0xa25e('0x32')]:_0x593660['model'];if(_0x5b25e3[_0xa25e('0x31')][_0xa25e('0x47')]){_0x2eeb0b['include']=[{'all':!![]}];}_0x2eeb0b=_[_0xa25e('0x3c')]({},_0x2eeb0b,_0x5b25e3['options']);return db['FaxApplication'][_0xa25e('0x48')](_0x2eeb0b)[_0xa25e('0x24')](handleEntityNotFound(_0x5cad36,null))[_0xa25e('0x24')](respondWithResult(_0x5cad36,null))[_0xa25e('0x49')](handleError(_0x5cad36,null));};exports[_0xa25e('0x4a')]=function(_0x12a200,_0x5834f1){return db['FaxApplication'][_0xa25e('0x4a')](_0x12a200[_0xa25e('0x4b')],{})[_0xa25e('0x24')](respondWithResult(_0x5834f1,0xc9))['catch'](handleError(_0x5834f1,null));};exports[_0xa25e('0x4c')]=function(_0x34d440,_0x474480){if(_0x34d440[_0xa25e('0x4b')]['id']){delete _0x34d440[_0xa25e('0x4b')]['id'];}return db[_0xa25e('0x3f')][_0xa25e('0x48')]({'where':{'id':_0x34d440[_0xa25e('0x44')]['id']}})[_0xa25e('0x24')](handleEntityNotFound(_0x474480,null))['then'](saveUpdates(_0x34d440[_0xa25e('0x4b')],null))[_0xa25e('0x24')](respondWithResult(_0x474480,null))[_0xa25e('0x49')](handleError(_0x474480,null));};exports[_0xa25e('0x4d')]=function(_0x1f95d1,_0x3542c7){return db[_0xa25e('0x3f')][_0xa25e('0x48')]({'where':{'id':_0x1f95d1[_0xa25e('0x44')]['id']}})[_0xa25e('0x24')](handleEntityNotFound(_0x3542c7,null))[_0xa25e('0x24')](removeEntity(_0x3542c7,null))['catch'](handleError(_0x3542c7,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d8188fe..7b6b686 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 _0xf74c=['utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','fax_applications','utf8mb4'];(function(_0x206663,_0x16f9fc){var _0x392f40=function(_0xe91aa9){while(--_0xe91aa9){_0x206663['push'](_0x206663['shift']());}};_0x392f40(++_0x16f9fc);}(_0xf74c,0x1a3));var _0xcf74=function(_0x4efa30,_0x1c20d5){_0x4efa30=_0x4efa30-0x0;var _0x2f74c1=_0xf74c[_0x4efa30];return _0x2f74c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf74('0x0'))('api');var moment=require(_0xcf74('0x1'));var BPromise=require(_0xcf74('0x2'));var rp=require(_0xcf74('0x3'));var fs=require('fs');var path=require(_0xcf74('0x4'));var rimraf=require(_0xcf74('0x5'));var config=require(_0xcf74('0x6'));var attributes=require(_0xcf74('0x7'));module['exports']=function(_0x637b2a,_0x42d52e){return _0x637b2a['define']('FaxApplication',attributes,{'tableName':_0xcf74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf74('0x9'),'collate':_0xcf74('0xa')});}; \ No newline at end of file +var _0x3d9d=['fax_applications','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','FaxApplication'];(function(_0x599e0a,_0x3162d9){var _0x3ac3e0=function(_0x4aad77){while(--_0x4aad77){_0x599e0a['push'](_0x599e0a['shift']());}};_0x3ac3e0(++_0x3162d9);}(_0x3d9d,0x14c));var _0xd3d9=function(_0x492d4e,_0xf5412a){_0x492d4e=_0x492d4e-0x0;var _0x583678=_0x3d9d[_0x492d4e];return _0x583678;};'use strict';var _=require('lodash');var util=require(_0xd3d9('0x0'));var logger=require('../../config/logger')(_0xd3d9('0x1'));var moment=require(_0xd3d9('0x2'));var BPromise=require(_0xd3d9('0x3'));var rp=require(_0xd3d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d9('0x5'));var config=require(_0xd3d9('0x6'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x4555fe,_0x368a74){return _0x4555fe[_0xd3d9('0x7')](_0xd3d9('0x8'),attributes,{'tableName':_0xd3d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd3d9('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 01fac69..abd2c3d 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 _0x09e9=['where','attributes','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','catch','UpdateFaxApplication','body','options','raw'];(function(_0x301c44,_0x433abe){var _0x160034=function(_0x514b07){while(--_0x514b07){_0x301c44['push'](_0x301c44['shift']());}};_0x160034(++_0x433abe);}(_0x09e9,0xe2));var _0x909e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x09e9[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x909e('0x0'));var util=require('util');var moment=require(_0x909e('0x1'));var BPromise=require(_0x909e('0x2'));var rs=require(_0x909e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x909e('0x4'));var logger=require('../../config/logger')(_0x909e('0x5'));var config=require(_0x909e('0x6'));var jayson=require(_0x909e('0x7'));var client=jayson[_0x909e('0x8')][_0x909e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee6f0,_0x481536,_0x2dd5b8){return new BPromise(function(_0x137a3c,_0x2e5d6e){return client[_0x909e('0xa')](_0x1ee6f0,_0x2dd5b8)[_0x909e('0xb')](function(_0x46a8f2){logger[_0x909e('0xc')]('FaxApplication,\x20%s,\x20%s',_0x481536,'request\x20sent');logger[_0x909e('0xd')](_0x909e('0xe'),_0x481536,_0x909e('0xf'),JSON[_0x909e('0x10')](_0x46a8f2));if(_0x46a8f2[_0x909e('0x11')]){if(_0x46a8f2[_0x909e('0x11')][_0x909e('0x12')]===0x1f4){logger['error'](_0x909e('0x13'),_0x481536,_0x46a8f2[_0x909e('0x11')][_0x909e('0x14')]);return _0x2e5d6e(_0x46a8f2[_0x909e('0x11')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x481536,_0x46a8f2[_0x909e('0x11')]['message']);return _0x137a3c(_0x46a8f2[_0x909e('0x11')][_0x909e('0x14')]);}else{logger['info'](_0x909e('0x13'),_0x481536,_0x909e('0xf'));_0x137a3c(_0x46a8f2['result'][_0x909e('0x14')]);}})[_0x909e('0x15')](function(_0x46af92){logger[_0x909e('0x11')](_0x909e('0x13'),_0x481536,_0x46af92);_0x2e5d6e(_0x46af92);});});}exports[_0x909e('0x16')]=function(_0x3ea99a){var _0x41f5db=this;return new Promise(function(_0x249b05,_0x23930a){return db['FaxApplication']['update'](_0x3ea99a[_0x909e('0x17')],{'raw':_0x3ea99a[_0x909e('0x18')]?_0x3ea99a[_0x909e('0x18')][_0x909e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ea99a[_0x909e('0x18')]?_0x3ea99a['options'][_0x909e('0x1a')]||null:null,'attributes':_0x3ea99a[_0x909e('0x18')]?_0x3ea99a[_0x909e('0x18')][_0x909e('0x1b')]||null:null,'limit':_0x3ea99a[_0x909e('0x18')]?_0x3ea99a['options']['limit']||null:null})[_0x909e('0xb')](function(_0x282932){logger[_0x909e('0xc')](_0x909e('0x16'),_0x3ea99a);logger['debug'](_0x909e('0x16'),_0x3ea99a,JSON[_0x909e('0x10')](_0x282932));_0x249b05(_0x282932);})[_0x909e('0x15')](function(_0x38dec3){logger['error'](_0x909e('0x16'),_0x38dec3[_0x909e('0x14')],_0x3ea99a);_0x23930a(_0x41f5db[_0x909e('0x11')](0x1f4,_0x38dec3[_0x909e('0x14')]));});});}; \ No newline at end of file +var _0xe85d=['rpc','jayson/promise','http','request','then','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','UpdateFaxApplication','FaxApplication','options','raw','where','attributes','limit','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9dce,_0x18d27d){var _0x3ea0=function(_0x22e5e2){while(--_0x22e5e2){_0x5a9dce['push'](_0x5a9dce['shift']());}};_0x3ea0(++_0x18d27d);}(_0xe85d,0x172));var _0xde85=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0xe85d[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require('lodash');var util=require(_0xde85('0x0'));var moment=require('moment');var BPromise=require(_0xde85('0x1'));var rs=require(_0xde85('0x2'));var fs=require('fs');var Redis=require(_0xde85('0x3'));var db=require(_0xde85('0x4'))['db'];var utils=require(_0xde85('0x5'));var logger=require(_0xde85('0x6'))(_0xde85('0x7'));var config=require('../../config/environment');var jayson=require(_0xde85('0x8'));var client=jayson['client'][_0xde85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c1115,_0x4cc3ca,_0x3896e5){return new BPromise(function(_0x1dc7e4,_0x4551f2){return client[_0xde85('0xa')](_0x3c1115,_0x3896e5)[_0xde85('0xb')](function(_0x37577c){logger['info'](_0xde85('0xc'),_0x4cc3ca,'request\x20sent');logger[_0xde85('0xd')](_0xde85('0xe'),_0x4cc3ca,_0xde85('0xf'),JSON[_0xde85('0x10')](_0x37577c));if(_0x37577c['error']){if(_0x37577c[_0xde85('0x11')][_0xde85('0x12')]===0x1f4){logger[_0xde85('0x11')](_0xde85('0xc'),_0x4cc3ca,_0x37577c[_0xde85('0x11')]['message']);return _0x4551f2(_0x37577c[_0xde85('0x11')]['message']);}logger[_0xde85('0x11')]('FaxApplication,\x20%s,\x20%s',_0x4cc3ca,_0x37577c[_0xde85('0x11')][_0xde85('0x13')]);return _0x1dc7e4(_0x37577c[_0xde85('0x11')][_0xde85('0x13')]);}else{logger[_0xde85('0x14')]('FaxApplication,\x20%s,\x20%s',_0x4cc3ca,_0xde85('0xf'));_0x1dc7e4(_0x37577c['result'][_0xde85('0x13')]);}})['catch'](function(_0x2a6c85){logger[_0xde85('0x11')]('FaxApplication,\x20%s,\x20%s',_0x4cc3ca,_0x2a6c85);_0x4551f2(_0x2a6c85);});});}exports[_0xde85('0x15')]=function(_0x304a6a){var _0x48d7ad=this;return new Promise(function(_0x26f2e3,_0x46a470){return db[_0xde85('0x16')]['update'](_0x304a6a['body'],{'raw':_0x304a6a['options']?_0x304a6a[_0xde85('0x17')][_0xde85('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304a6a[_0xde85('0x17')]?_0x304a6a['options'][_0xde85('0x19')]||null:null,'attributes':_0x304a6a[_0xde85('0x17')]?_0x304a6a['options'][_0xde85('0x1a')]||null:null,'limit':_0x304a6a[_0xde85('0x17')]?_0x304a6a['options'][_0xde85('0x1b')]||null:null})[_0xde85('0xb')](function(_0x3054c1){logger[_0xde85('0x14')]('UpdateFaxApplication',_0x304a6a);logger[_0xde85('0xd')](_0xde85('0x15'),_0x304a6a,JSON[_0xde85('0x10')](_0x3054c1));_0x26f2e3(_0x3054c1);})[_0xde85('0x1c')](function(_0x14af55){logger[_0xde85('0x11')]('UpdateFaxApplication',_0x14af55[_0xde85('0x13')],_0x304a6a);_0x46a470(_0x48d7ad[_0xde85('0x11')](0x1f4,_0x14af55['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 79cfbc2..008026c 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 _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(_0x4849e4,_0x20a625){var _0x13b029=function(_0x25a011){while(--_0x25a011){_0x4849e4['push'](_0x4849e4['shift']());}};_0x13b029(++_0x20a625);}(_0xeda8,0x104));var _0x8eda=function(_0x28de79,_0x41e69b){_0x28de79=_0x28de79-0x0;var _0x5d9fe9=_0xeda8[_0x28de79];return _0x5d9fe9;};'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 +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x2e6dee,_0x1a61b0){var _0x47706=function(_0x365546){while(--_0x365546){_0x2e6dee['push'](_0x2e6dee['shift']());}};_0x47706(++_0x1a61b0);}(_0x687b,0x14a));var _0xb687=function(_0x9f6f64,_0x4cd6df){_0x9f6f64=_0x9f6f64-0x0;var _0x3b9f5c=_0x687b[_0x9f6f64];return _0x3b9f5c;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('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 9e344dd..bdfe3a2 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 _0x9a19=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x3a7017,_0x19d2db){var _0x17473c=function(_0x5d6021){while(--_0x5d6021){_0x3a7017['push'](_0x3a7017['shift']());}};_0x17473c(++_0x19d2db);}(_0x9a19,0x114));var _0x99a1=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x9a19[_0x504df1];return _0x1063b5;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'closed':{'type':Sequelize[_0x99a1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x99a1('0x3')]},'secondDisposition':{'type':Sequelize[_0x99a1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x99a1('0x3')]},'note':{'type':Sequelize[_0x99a1('0x3')]},'read1stAt':{'type':Sequelize[_0x99a1('0x4')]},'fax':{'type':Sequelize[_0x99a1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x99a1('0x5')]('in',_0x99a1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x99a1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x99a1('0x5')]('in',_0x99a1('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xff3c=['exports','DATE','STRING','ENUM','out','sequelize'];(function(_0xf304fc,_0x445451){var _0x785f50=function(_0x4c4408){while(--_0x4c4408){_0xf304fc['push'](_0xf304fc['shift']());}};_0x785f50(++_0x445451);}(_0xff3c,0x179));var _0xcff3=function(_0x24f67a,_0x52e463){_0x24f67a=_0x24f67a-0x0;var _0x4252d4=_0xff3c[_0x24f67a];return _0x4252d4;};'use strict';var Sequelize=require(_0xcff3('0x0'));module[_0xcff3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcff3('0x2')]},'disposition':{'type':Sequelize[_0xcff3('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcff3('0x3')]},'read1stAt':{'type':Sequelize[_0xcff3('0x2')]},'fax':{'type':Sequelize[_0xcff3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcff3('0x4')]('in',_0xcff3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcff3('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fa1efd9..a820e51 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 _0x9dbf=['send','map','TagIds','Tags','forEach','push','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','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','unreadMessages','`\x20=\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.mandatoryDisposition','i.*','Contact.firstName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.internal','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','params','includeAll','options','catch','create','describe','FaxMessage','addMessage','ids','getMessages','findOne','sort','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','spread','emit','removeTags','unix','root','server','files','join','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','createReadStream','pipe','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','sendStatus','status','end','json','count','offset','reject','update','then','destroy','error','name'];(function(_0x32ccba,_0x105c95){var _0x3f0a58=function(_0x151ab7){while(--_0x151ab7){_0x32ccba['push'](_0x32ccba['shift']());}};_0x3f0a58(++_0x105c95);}(_0x9dbf,0x99));var _0xf9db=function(_0x18fa97,_0x3419ae){_0x18fa97=_0x18fa97-0x0;var _0x95ac1e=_0x9dbf[_0x18fa97];return _0x95ac1e;};'use strict';var pdf=require(_0xf9db('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf9db('0x1'));var jsonpatch=require(_0xf9db('0x2'));var rp=require(_0xf9db('0x3'));var moment=require(_0xf9db('0x4'));var BPromise=require(_0xf9db('0x5'));var Mustache=require(_0xf9db('0x6'));var util=require(_0xf9db('0x7'));var path=require(_0xf9db('0x8'));var sox=require('sox');var csv=require(_0xf9db('0x9'));var ejs=require(_0xf9db('0xa'));var fs=require('fs');var _=require(_0xf9db('0xb'));var squel=require(_0xf9db('0xc'));var crypto=require('crypto');var jsforce=require(_0xf9db('0xd'));var deskjs=require(_0xf9db('0xe'));var toCsv=require(_0xf9db('0x9'));var querystring=require(_0xf9db('0xf'));var Papa=require(_0xf9db('0x10'));var Redis=require(_0xf9db('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9db('0x12'));var hardwareService=require(_0xf9db('0x13'));var logger=require('../../config/logger')(_0xf9db('0x14'));var utils=require('../../config/utils');var config=require(_0xf9db('0x15'));var licenseUtil=require(_0xf9db('0x16'));var db=require('../../mysqldb')['db'];config[_0xf9db('0x17')]=_[_0xf9db('0x18')](config['redis'],{'host':_0xf9db('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9db('0x17')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x520684,_0x28b51f){_0x28b51f=_0x28b51f||0xcc;return function(_0x5e0a57){if(_0x5e0a57){return _0x520684[_0xf9db('0x1a')](_0x28b51f);}return _0x520684[_0xf9db('0x1b')](_0x28b51f)[_0xf9db('0x1c')]();};}function respondWithResult(_0x5c6a0a,_0x535d34){_0x535d34=_0x535d34||0xc8;return function(_0x26b672){if(_0x26b672){return _0x5c6a0a['status'](_0x535d34)[_0xf9db('0x1d')](_0x26b672);}};}function respondWithFilteredResult(_0x4b172d,_0x51d69b){return function(_0x384ce0){if(_0x384ce0){var _0x4c7d29=_0x384ce0[_0xf9db('0x1e')],_0x4cebcd=_0x51d69b[_0xf9db('0x1f')],_0x2effec=_0x51d69b[_0xf9db('0x1f')]+_0x51d69b['limit'],_0x32d1c8;if(_0x2effec>=_0x4c7d29){_0x2effec=_0x4c7d29;_0x32d1c8=0xc8;}else{_0x32d1c8=0xce;}_0x4b172d[_0xf9db('0x1b')](_0x32d1c8);return _0x4b172d['set']('Content-Range',_0x4cebcd+'-'+_0x2effec+'/'+_0x4c7d29)[_0xf9db('0x1d')](_0x384ce0);}return null;};}function patchUpdates(_0x4c9f18){return function(_0x4d0281){try{jsonpatch['apply'](_0x4d0281,_0x4c9f18,!![]);}catch(_0x353b0c){return BPromise[_0xf9db('0x20')](_0x353b0c);}return _0x4d0281['save']();};}function saveUpdates(_0x2139de,_0x18c6f2){return function(_0x4e6de1){if(_0x4e6de1){return _0x4e6de1[_0xf9db('0x21')](_0x2139de)[_0xf9db('0x22')](function(_0x3ac78f){return _0x3ac78f;});}return null;};}function removeEntity(_0x1cdf20,_0x1bcd12){return function(_0x1b4b56){if(_0x1b4b56){return _0x1b4b56[_0xf9db('0x23')]()[_0xf9db('0x22')](function(){_0x1cdf20[_0xf9db('0x1b')](0xcc)[_0xf9db('0x1c')]();});}};}function handleEntityNotFound(_0x346f2b,_0x863a40){return function(_0x2ef0b1){if(!_0x2ef0b1){_0x346f2b['sendStatus'](0x194);}return _0x2ef0b1;};}function handleError(_0x48046a,_0x3ccd71){_0x3ccd71=_0x3ccd71||0x1f4;return function(_0x1e7e89){logger[_0xf9db('0x24')](_0x1e7e89['stack']);if(_0x1e7e89[_0xf9db('0x25')]){delete _0x1e7e89[_0xf9db('0x25')];}_0x48046a[_0xf9db('0x1b')](_0x3ccd71)[_0xf9db('0x26')](_0x1e7e89);};}function getInteractionUsers(_0x474479,_0x4e3634){return new BPromise(function(_0x4ea5d9,_0x2a901d){try{if(_0x4e3634[_0x474479['id']]){_0x474479['Users']=_[_0xf9db('0x27')](_0x4e3634[_0x474479['id']],function(_0x424d6f){return{'id':_0x424d6f['id'],'fullname':_0x424d6f['fullname']};});}}catch(_0x34920c){_0x2a901d(_0x34920c);}_0x4ea5d9(_0x474479);});}function getInteractionTags(_0x53125c,_0x5098e8){return new BPromise(function(_0x182160,_0x1e5715){try{if(_0x53125c[_0xf9db('0x28')]){_0x53125c[_0xf9db('0x29')]=[];_0x53125c[_0xf9db('0x28')]['split'](',')[_0xf9db('0x2a')](function(_0x49ce30){_0x53125c['Tags'][_0xf9db('0x2b')](_0x5098e8[_0x49ce30]);});}delete _0x53125c[_0xf9db('0x28')];}catch(_0x47ddcb){_0x1e5715(_0x47ddcb);}_0x182160(_0x53125c);});}function updateFaxInteraction(_0x4b422d,_0x3e5b23,_0x381a2a){return new BPromise(function(_0x509408,_0xe26395){return getInteractionUsers(_0x4b422d,_0x381a2a)[_0xf9db('0x22')](function(_0xc89cd3){return getInteractionTags(_0xc89cd3,_0x3e5b23);})[_0xf9db('0x22')](function(_0x248149){_0x509408(_0x248149);})['catch'](function(_0x4d134f){_0xe26395(_0x4d134f);});});}exports['index']=function(_0x1dc6ef,_0x3f5907){var _0x3b2c66={},_0x54eac5={},_0x2ed8fe={'count':0x0,'rows':[]};var _0x3ccc92=_['map'](db[_0xf9db('0x2c')][_0xf9db('0x2d')],function(_0xb59508){return{'name':_0xb59508['fieldName'],'type':_0xb59508[_0xf9db('0x2e')][_0xf9db('0x2f')]};});_0x54eac5[_0xf9db('0x30')]=_[_0xf9db('0x27')](_0x3ccc92,_0xf9db('0x25'));_0x54eac5[_0xf9db('0x31')]=_[_0xf9db('0x32')](_0x1dc6ef[_0xf9db('0x31')]);_0x54eac5[_0xf9db('0x33')]=_[_0xf9db('0x34')](_0x54eac5['model'],_0x54eac5[_0xf9db('0x31')]);_0x3b2c66[_0xf9db('0x35')]=_[_0xf9db('0x34')](_0x54eac5[_0xf9db('0x30')],qs['fields'](_0x1dc6ef['query']['fields']));_0x3b2c66[_0xf9db('0x35')]=_0x3b2c66[_0xf9db('0x35')][_0xf9db('0x36')]?_0x3b2c66[_0xf9db('0x35')]:_0x54eac5[_0xf9db('0x30')];if(!_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x37')](_0xf9db('0x38'))){_0x3b2c66[_0xf9db('0x39')]=qs[_0xf9db('0x39')](_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x39')]);_0x3b2c66[_0xf9db('0x1f')]=qs[_0xf9db('0x1f')](_0x1dc6ef['query'][_0xf9db('0x1f')]);}_0x3b2c66['order']=qs['sort'](_0x1dc6ef[_0xf9db('0x31')]['sort']);_0x3b2c66[_0xf9db('0x3a')]=qs[_0xf9db('0x33')](_[_0xf9db('0x3b')](_0x1dc6ef[_0xf9db('0x31')],_0x54eac5['filters']),_0x3ccc92);var _0x292e47=[];var _0x2ad29a=squel[_0xf9db('0x3c')]()['field']('id')[_0xf9db('0x3d')](_0xf9db('0x25'))[_0xf9db('0x3d')](_0xf9db('0x3e'))[_0xf9db('0x3f')]('tools_tags');var _0x3607a0=squel['select']()[_0xf9db('0x3d')](_0xf9db('0x40'))[_0xf9db('0x3d')](_0xf9db('0x41'))['field'](_0xf9db('0x42'))[_0xf9db('0x3f')](_0xf9db('0x43'),'ui')[_0xf9db('0x44')](_0xf9db('0x45'),'u','u.id\x20=\x20ui.UserId');var _0x455a97=squel[_0xf9db('0x3c')]()[_0xf9db('0x3f')](_0xf9db('0x46'),'i')['left_join']('cm_contacts','c',_0xf9db('0x47'))[_0xf9db('0x44')](_0xf9db('0x45'),'o',_0xf9db('0x48'))[_0xf9db('0x44')](_0xf9db('0x49'),'a',_0xf9db('0x4a'))[_0xf9db('0x44')](_0xf9db('0x4b'),'me',_0xf9db('0x4c'))['left_join'](_0xf9db('0x4d'),'it',_0xf9db('0x4e'))[_0xf9db('0x44')]('tools_tags','t',_0xf9db('0x4f'));var _0x2251df=squel[_0xf9db('0x50')]();var _0xd6ba7f=[];var _0x401216=squel['expr']();var _0x3a577f;if(_0x1dc6ef['query'][_0xf9db('0x51')]){_0x3a577f=as[_0xf9db('0x52')](_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x51')]);var _0xf1a120=_0x3a577f[_0xf9db('0x53')];for(var _0x27582a=0x0;_0x27582a<_0x3a577f[_0xf9db('0x54')][_0xf9db('0x36')];_0x27582a++){var _0x253898=_0x3a577f[_0xf9db('0x54')][_0x27582a];var _0x177c1b='i';var _0xe260b2=_['find'](_0x3ccc92,['name',_0x253898[_0xf9db('0x3d')]]);if(!_0xe260b2){switch(_0x253898['field']){case _0xf9db('0x55'):if(_0x253898['value']==0x1){_0x455a97['having']('`'+_0x253898[_0xf9db('0x3d')]+_0xf9db('0x56'));}else{_0x455a97['having']('`'+_0x253898[_0xf9db('0x3d')]+'`\x20>\x200');}break;case _0xf9db('0x57'):if(_0x253898[_0xf9db('0x58')]==='$substring'){if(_0x253898['value'][_0xf9db('0x59')]('\x20')[_0xf9db('0x36')]>0x1){_0x2251df[_0xf1a120](_0xf9db('0x5a'),qs['getFullTextValue'](_0x253898['value']),null);}else{var _0x1f8d64='%'+_0x253898[_0xf9db('0x5b')]+'%';_0x2251df[_0xf1a120]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1f8d64,_0x1f8d64,_0x1f8d64);}}else{_0xe260b2=_[_0xf9db('0x5c')](_0x3ccc92,['name',_0xf9db('0x5d')]);_0x253898[_0xf9db('0x3d')]=_0xf9db('0x5d');_0x4ee004=as[_0xf9db('0x5e')](_0x177c1b,_0xe260b2[_0xf9db('0x2e')],_0x253898);_0x2251df[_0xf1a120](_0x4ee004['text'],_0x4ee004[_0xf9db('0x5b')][_0xf9db('0x5f')],_0x4ee004[_0xf9db('0x5b')][_0xf9db('0x1c')]);}break;case _0xf9db('0x60'):var _0x5cd419=_0x253898['value']['split'](',')[_0xf9db('0x27')](function(_0x8dfc79){return Number(_0x8dfc79);});_0x5cd419[_0xf9db('0x2a')](function(_0x28a8d5){_0x401216['or'](_0xf9db('0x61'),'%,'+_0x28a8d5+',%');});_0xd6ba7f=_['union'](_0xd6ba7f,_0x5cd419);break;case _0xf9db('0x62'):if(_0x253898[_0xf9db('0x58')]===_0xf9db('0x63')){_0x2251df[_0xf1a120](_0xf9db('0x64'),'%'+_0x253898[_0xf9db('0x5b')]+'%',null);}else{_0xe260b2=_[_0xf9db('0x5c')](_0x3ccc92,['name',_0xf9db('0x65')]);_0x253898['field']=_0xf9db('0x65');_0x4ee004=as[_0xf9db('0x5e')](_0x177c1b,_0xe260b2[_0xf9db('0x2e')],_0x253898);_0x2251df[_0xf1a120](_0x4ee004['text'],_0x4ee004[_0xf9db('0x5b')][_0xf9db('0x5f')],_0x4ee004['value'][_0xf9db('0x1c')]);}break;case _0xf9db('0x66'):_0x4ee004=as[_0xf9db('0x5e')]('me',null,_0x253898);_0x2251df[_0xf1a120](_0x4ee004[_0xf9db('0x67')],_0x4ee004['value'][_0xf9db('0x5f')],_0x4ee004[_0xf9db('0x5b')][_0xf9db('0x1c')]);break;}}else{var _0x4ee004=as[_0xf9db('0x5e')](_0x177c1b,_0xe260b2['type'],_0x253898);_0x2251df[_0xf1a120](_0x4ee004[_0xf9db('0x67')],_0x4ee004[_0xf9db('0x5b')][_0xf9db('0x5f')],_0x4ee004['value']['end']);}}}else{var _0x2e5701=_(_0x1dc6ef[_0xf9db('0x31')])['keys']()['map'](function(_0xf1ae){return _[_0xf9db('0x68')](_0x3ccc92,[_0xf9db('0x25'),_0xf1ae])?_0xf1ae:undefined;})[_0xf9db('0x69')]()[_0xf9db('0x5b')]();if(!_['isEmpty'](_0x2e5701)){_0x2e5701[_0xf9db('0x2a')](function(_0x416022){if(_0x416022==='FaxAccountId'){_0x455a97[_0xf9db('0x3a')](_0xf9db('0x6a'),[][_0xf9db('0x6b')](_0x1dc6ef[_0xf9db('0x31')][_0x416022]));}else if(_0x416022===_0xf9db('0x6c')){var _0x2ba9d1=JSON['parse'](_0x1dc6ef[_0xf9db('0x31')][_0x416022])['$gte'];var _0x5ca37d=JSON[_0xf9db('0x6d')](_0x1dc6ef[_0xf9db('0x31')][_0x416022])[_0xf9db('0x6e')];_0x455a97[_0xf9db('0x3a')](_0xf9db('0x6f'),_0x2ba9d1,_0x5ca37d);}else{if(_0x1dc6ef[_0xf9db('0x31')][_0x416022]==='null'){_0x455a97['where']('i.'+_0x416022+_0xf9db('0x70'));}else{_0x455a97['where']('i.'+_0x416022+'\x20=\x20?',_0x1dc6ef[_0xf9db('0x31')][_0x416022]);}}});}if(_0x1dc6ef[_0xf9db('0x31')]['read']){if(_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x71')]==0x1){_0x455a97[_0xf9db('0x72')](_0xf9db('0x73'));}else{_0x455a97[_0xf9db('0x72')](_0xf9db('0x74'));}}if(_0x1dc6ef['query']['tag']){_0xd6ba7f=_['isArray'](_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x75')])?_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x75')]:new Array(_0x1dc6ef[_0xf9db('0x31')]['tag']);_0xd6ba7f[_0xf9db('0x2a')](function(_0x144e92){_0x401216['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x144e92+',%');});}if(_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x76')]){var _0x1b12ac=_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x76')]['replace']('\x5c','\x5c\x5c')[_0xf9db('0x77')]('\x27\x27',_0xf9db('0x78'));if(qs[_0xf9db('0x79')](_0x1b12ac)){_0x2251df['or']('i.id\x20LIKE\x20?',_0x1b12ac+'%')['or'](_0xf9db('0x7a'),_0x1b12ac+'%');}_0x2251df['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1b12ac+'%');}}_0x455a97[_0xf9db('0x3a')](_0x2251df);_0x455a97['group']('i.id');var _0x3d38c9={'type':db[_0xf9db('0x7b')][_0xf9db('0x7c')][_0xf9db('0x7d')],'raw':!![]};var _0x48a998=_0x455a97[_0xf9db('0x7e')]();_0x48a998[_0xf9db('0x3d')](_0xf9db('0x7f'));_0x48a998[_0xf9db('0x3d')](_0xf9db('0x80'),'unreadMessages');if(_0x3b2c66[_0xf9db('0x81')]){_0x3b2c66[_0xf9db('0x81')][_0xf9db('0x2a')](function(_0xed5aa0){_0x455a97[_0xf9db('0x81')]('i.'+_0xed5aa0[0x0],_0xed5aa0[0x1]==='DESC'?![]:!![]);});}if(!_[_0xf9db('0x82')](_0xd6ba7f)){_0x455a97[_0xf9db('0x72')](_0x401216);_0x48a998[_0xf9db('0x3a')](_0xf9db('0x83'),_0xd6ba7f);}BPromise[_0xf9db('0x84')]()['then'](function(){if(!_0x3a577f){if(_0x1dc6ef[_0xf9db('0x31')]['FaxAccountId']||_0x1dc6ef[_0xf9db('0x31')][_0xf9db('0x85')])return;_0x48a998[_0xf9db('0x3a')](_0xf9db('0x86'));_0x455a97[_0xf9db('0x3a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x1dc6ef[_0xf9db('0x87')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xf9db('0x22')](function(_0x39e51f){if(_[_0xf9db('0x82')](_0x39e51f)){_0x48a998['where']('i.FaxAccountId\x20IS\x20NULL');_0x455a97[_0xf9db('0x3a')](_0xf9db('0x88'));}else{_0x48a998[_0xf9db('0x3a')](_0xf9db('0x6a'),_['map'](_0x39e51f,'id'));_0x455a97['where'](_0xf9db('0x6a'),_[_0xf9db('0x27')](_0x39e51f,'id'));}});})['then'](function(){db[_0xf9db('0x89')]['query'](_0x48a998[_0xf9db('0x8a')](),_0x3d38c9)[_0xf9db('0x22')](function(_0x96a702){_0x2ed8fe[_0xf9db('0x1e')]=_0x96a702['length'];if(_0x2ed8fe[_0xf9db('0x1e')]===0x0)return[];return db[_0xf9db('0x89')][_0xf9db('0x31')](_0x2ad29a[_0xf9db('0x8a')](),_0x3d38c9)['then'](function(_0x37b71d){_0x292e47=_[_0xf9db('0x8b')](_0x37b71d,'id');_0x3d38c9=_[_0xf9db('0x8c')](_0x3d38c9,{'model':db[_0xf9db('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1dc6ef['query'][_0xf9db('0x8d')]){_0x3b2c66['attributes']['forEach'](function(_0x46235a){_0x455a97[_0xf9db('0x3d')]('i.'+_0x46235a);});}else{_0x455a97[_0xf9db('0x3d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x455a97['field']('a.key','Account.key');_0x455a97[_0xf9db('0x3d')](_0xf9db('0x8e'),'Account.mandatoryDisposition');_0x455a97[_0xf9db('0x3d')](_0xf9db('0x8f'));_0x455a97['field']('c.firstName',_0xf9db('0x90'));_0x455a97[_0xf9db('0x3d')]('c.lastName','Contact.lastName');_0x455a97[_0xf9db('0x3d')]('c.email',_0xf9db('0x91'));_0x455a97['field'](_0xf9db('0x92'),_0xf9db('0x93'));_0x455a97[_0xf9db('0x3d')]('c.mobile',_0xf9db('0x94'));_0x455a97[_0xf9db('0x3d')](_0xf9db('0x95'),'Contact.fax');_0x455a97[_0xf9db('0x3d')](_0xf9db('0x96'),'Owner.fullname');_0x455a97[_0xf9db('0x3d')]('o.internal',_0xf9db('0x97'));_0x455a97['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3b2c66[_0xf9db('0x39')])_0x455a97[_0xf9db('0x39')](_0x3b2c66[_0xf9db('0x39')]);if(_0x3b2c66[_0xf9db('0x1f')])_0x455a97['offset'](_0x3b2c66[_0xf9db('0x1f')]);return db['sequelize'][_0xf9db('0x31')](_0x455a97['toString'](),_0x3d38c9);})['then'](function(_0x10caff){_0x3607a0[_0xf9db('0x3a')](_0xf9db('0x98'),_[_0xf9db('0x27')](_0x10caff,'id'));return db[_0xf9db('0x89')][_0xf9db('0x31')](_0x3607a0[_0xf9db('0x8a')](),_0x3d38c9)[_0xf9db('0x22')](function(_0x407602){var _0x481c7e=_['groupBy'](_0x407602,_0xf9db('0x99'));var _0x374e06=[];_0x10caff['forEach'](function(_0x2bd8d2){_0x374e06[_0xf9db('0x2b')](updateFaxInteraction(_0x2bd8d2,_0x292e47,_0x481c7e));});return BPromise[_0xf9db('0x9a')](_0x374e06);});});})[_0xf9db('0x22')](function(_0x810146){_0x2ed8fe['rows']=_0x810146;return _0x2ed8fe;})[_0xf9db('0x22')](respondWithFilteredResult(_0x3f5907,_0x3b2c66));})['catch'](handleError(_0x3f5907,null));};exports['show']=function(_0x226522,_0x581a1b){var _0x4bcb48={'raw':![],'where':{'id':_0x226522[_0xf9db('0x9b')]['id']}},_0x1eeca7={};_0x1eeca7['model']=_['keys'](db['FaxInteraction'][_0xf9db('0x2d')]);_0x1eeca7[_0xf9db('0x31')]=_[_0xf9db('0x32')](_0x226522[_0xf9db('0x31')]);_0x1eeca7['filtears']=_[_0xf9db('0x34')](_0x1eeca7['model'],_0x1eeca7[_0xf9db('0x31')]);_0x4bcb48[_0xf9db('0x35')]=_[_0xf9db('0x34')](_0x1eeca7[_0xf9db('0x30')],qs['fields'](_0x226522['query'][_0xf9db('0x8d')]));_0x4bcb48[_0xf9db('0x35')]=_0x4bcb48[_0xf9db('0x35')][_0xf9db('0x36')]?_0x4bcb48['attributes']:_0x1eeca7[_0xf9db('0x30')];if(_0x226522['query'][_0xf9db('0x9c')]){_0x4bcb48['include']=[{'all':!![]}];}_0x4bcb48=_[_0xf9db('0x8c')]({},_0x4bcb48,_0x226522[_0xf9db('0x9d')]);return db[_0xf9db('0x2c')][_0xf9db('0x5c')](_0x4bcb48)[_0xf9db('0x22')](handleEntityNotFound(_0x581a1b,null))[_0xf9db('0x22')](respondWithResult(_0x581a1b,null))[_0xf9db('0x9e')](handleError(_0x581a1b,null));};exports['create']=function(_0x1ceab0,_0x2b2773){return db[_0xf9db('0x2c')][_0xf9db('0x9f')](_0x1ceab0['body'],{})[_0xf9db('0x22')](respondWithResult(_0x2b2773,0xc9))[_0xf9db('0x9e')](handleError(_0x2b2773,null));};exports['update']=function(_0x406d8b,_0x9b356e){if(_0x406d8b[_0xf9db('0x66')]['id']){delete _0x406d8b['body']['id'];}return db[_0xf9db('0x2c')][_0xf9db('0x5c')]({'where':{'id':_0x406d8b[_0xf9db('0x9b')]['id']}})[_0xf9db('0x22')](handleEntityNotFound(_0x9b356e,null))[_0xf9db('0x22')](saveUpdates(_0x406d8b['body'],null))[_0xf9db('0x22')](respondWithResult(_0x9b356e,null))[_0xf9db('0x9e')](handleError(_0x9b356e,null));};exports[_0xf9db('0x23')]=function(_0xb20271,_0x2f2697){return db[_0xf9db('0x2c')][_0xf9db('0x5c')]({'where':{'id':_0xb20271['params']['id']}})['then'](handleEntityNotFound(_0x2f2697,null))[_0xf9db('0x22')](removeEntity(_0x2f2697,null))[_0xf9db('0x9e')](handleError(_0x2f2697,null));};exports[_0xf9db('0xa0')]=function(_0x1025c7,_0x29cd08){return db[_0xf9db('0x2c')][_0xf9db('0xa0')]()[_0xf9db('0x22')](respondWithResult(_0x29cd08,null))['catch'](handleError(_0x29cd08,null));};exports['addMessage']=function(_0x4201f6,_0x215472,_0x235bf6){return db[_0xf9db('0xa1')]['find']({'where':{'id':_0x4201f6['params']['id']}})[_0xf9db('0x22')](handleEntityNotFound(_0x215472,null))[_0xf9db('0x22')](function(_0x42ea9f){if(_0x42ea9f){return _0x42ea9f[_0xf9db('0xa2')](_0x4201f6[_0xf9db('0x66')][_0xf9db('0xa3')],_['omit'](_0x4201f6['body'],['ids','id'])||{});}})[_0xf9db('0x22')](respondWithResult(_0x215472,null))[_0xf9db('0x9e')](handleError(_0x215472,null));};exports[_0xf9db('0xa4')]=function(_0x43c07f,_0xcab871,_0x4a5c3f){var _0x5f3af1={'raw':![],'where':{}};var _0x499fbc={};var _0x570696={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xf9db('0xa5')]({'where':{'id':_0x43c07f[_0xf9db('0x9b')]['id']}})[_0xf9db('0x22')](handleEntityNotFound(_0xcab871,null))[_0xf9db('0x22')](function(_0x336dde){if(_0x336dde){_0x499fbc[_0xf9db('0x30')]=_[_0xf9db('0x32')](db[_0xf9db('0xa1')]['rawAttributes']);_0x499fbc[_0xf9db('0x31')]=_[_0xf9db('0x32')](_0x43c07f[_0xf9db('0x31')]);_0x499fbc[_0xf9db('0x33')]=_['intersection'](_0x499fbc[_0xf9db('0x30')],_0x499fbc[_0xf9db('0x31')]);_0x5f3af1[_0xf9db('0x35')]=_[_0xf9db('0x34')](_0x499fbc['model'],qs[_0xf9db('0x8d')](_0x43c07f['query'][_0xf9db('0x8d')]));_0x5f3af1[_0xf9db('0x35')]=_0x5f3af1[_0xf9db('0x35')][_0xf9db('0x36')]?_0x5f3af1[_0xf9db('0x35')]:_0x499fbc[_0xf9db('0x30')];if(!_0x43c07f[_0xf9db('0x31')][_0xf9db('0x37')]('nolimit')){_0x5f3af1['limit']=qs[_0xf9db('0x39')](_0x43c07f[_0xf9db('0x31')][_0xf9db('0x39')]);_0x5f3af1[_0xf9db('0x1f')]=qs['offset'](_0x43c07f['query'][_0xf9db('0x1f')]);}_0x5f3af1[_0xf9db('0x81')]=qs['sort'](_0x43c07f[_0xf9db('0x31')][_0xf9db('0xa6')]);_0x5f3af1[_0xf9db('0x3a')]=qs[_0xf9db('0x33')](_[_0xf9db('0x3b')](_0x43c07f[_0xf9db('0x31')],_0x499fbc[_0xf9db('0x33')]));_0x5f3af1[_0xf9db('0x3a')][_0xf9db('0x99')]=_0x336dde['id'];if(_0x43c07f[_0xf9db('0x31')]['filter']){_0x5f3af1['where']=_[_0xf9db('0x8c')](_0x5f3af1['where'],{'$or':_['map'](_0x5f3af1['attributes'],function(_0x26edee){var _0x428e48={};_0x428e48[_0x26edee]={'$like':'%'+_0x43c07f['query']['filter']+'%'};return _0x428e48;})});}if(_0x43c07f[_0xf9db('0x31')][_0xf9db('0xa7')]){var _0x383e6b=_0x43c07f[_0xf9db('0x31')]['$gte']['split'](',');var _0x1dfb09={};_0x1dfb09[_0x383e6b[0x0]]={'$gte':moment(_0x383e6b[0x1])['format'](_0xf9db('0xa8'))};_0x5f3af1['where']=_[_0xf9db('0x8c')](_0x5f3af1[_0xf9db('0x3a')],_0x1dfb09);}_0x5f3af1=_[_0xf9db('0x8c')]({},_0x5f3af1,_0x43c07f[_0xf9db('0x9d')]);return db[_0xf9db('0xa1')][_0xf9db('0x1e')]({'where':_0x5f3af1['where']})[_0xf9db('0x22')](function(_0x441ba4){_0x570696['count']=_0x441ba4;if(_0x43c07f['query'][_0xf9db('0x9c')]){_0x5f3af1[_0xf9db('0xa9')]=[{'all':!![]}];}return db[_0xf9db('0xa1')][_0xf9db('0xaa')](_0x5f3af1);})['then'](function(_0x20a541){_0x570696['rows']=_0x20a541;return _0x570696;});}})[_0xf9db('0x22')](respondWithFilteredResult(_0xcab871,_0x5f3af1))[_0xf9db('0x9e')](handleError(_0xcab871,null));};exports[_0xf9db('0xab')]=function(_0x266482,_0x24ef48,_0x216840){return db[_0xf9db('0x2c')][_0xf9db('0x5c')]({'where':{'id':_0x266482['params']['id']}})[_0xf9db('0x22')](handleEntityNotFound(_0x24ef48,null))[_0xf9db('0x22')](function(_0x3adb3e){if(_0x3adb3e){return _0x3adb3e['setTags'](_0x266482[_0xf9db('0x66')][_0xf9db('0xa3')],_['omit'](_0x266482['body'],['ids','id'])||{})[_0xf9db('0xac')](function(){return db[_0xf9db('0x60')][_0xf9db('0xaa')]({'attributes':['id','name',_0xf9db('0x3e')],'where':{'id':_0x266482['body'][_0xf9db('0xa3')]}});})['then'](function(_0x4de9b7){socket[_0xf9db('0xad')]('faxInteractionTags:save',{'id':Number(_0x266482[_0xf9db('0x9b')]['id']),'tags':_0x4de9b7||[]});return{'id':Number(_0x266482[_0xf9db('0x9b')]['id']),'tags':_0x4de9b7||[]};});}})['then'](respondWithResult(_0x24ef48,null))[_0xf9db('0x9e')](handleError(_0x24ef48,null));};exports[_0xf9db('0xae')]=function(_0x332505,_0x35de9a,_0x2a53cc){return db[_0xf9db('0x2c')][_0xf9db('0x5c')]({'where':{'id':_0x332505[_0xf9db('0x9b')]['id']}})[_0xf9db('0x22')](handleEntityNotFound(_0x35de9a,null))['then'](function(_0x1eb98d){if(_0x1eb98d){return _0x1eb98d[_0xf9db('0xae')](_0x332505['query'][_0xf9db('0xa3')]);}})[_0xf9db('0x22')](respondWithStatusCode(_0x35de9a,null))[_0xf9db('0x9e')](handleError(_0x35de9a,null));};exports['download']=function(_0x3e9847,_0x35f711){var _0x1d191c=moment()[_0xf9db('0xaf')]()['toString']();var _0x4d9e96=path['join'](config[_0xf9db('0xb0')],_0xf9db('0xb1'),_0xf9db('0xb2'),'tmp');var _0x2dcb07=path[_0xf9db('0xb3')](config['root'],'server','files',_0xf9db('0xb4'));var _0x1f58ce=path[_0xf9db('0xb3')](_0x4d9e96,_0x1d191c);var _0x24edca=util['format'](_0xf9db('0xb5'),_0x3e9847[_0xf9db('0x9b')]['id'],_0x1d191c);var _0x52104f=path[_0xf9db('0xb3')](_0x4d9e96,_0x24edca);var _0x227528=[];_0x227528[_0xf9db('0x2b')]({'model':db['Attachment'],'as':_0xf9db('0xb6'),'raw':!![]});var _0x3e882b=[{'model':db[_0xf9db('0xa1')],'as':_0xf9db('0xb7'),'attributes':['id',_0xf9db('0x66'),_0xf9db('0x6c')],'include':_0x227528}];return db['FaxInteraction'][_0xf9db('0x5c')]({'where':{'id':_0x3e9847['params']['id']},'include':_0x3e882b})[_0xf9db('0x22')](handleEntityNotFound(_0x35f711,null))[_0xf9db('0x22')](function(_0x5442df){if(_0x5442df&&_0x5442df[_0xf9db('0xb7')]){var _0x26839c=_0x5442df[_0xf9db('0xb8')]({'plain':!![]});fs[_0xf9db('0xb9')](_0x1f58ce);for(var _0x187285=0x0;_0x187285<_0x26839c['Messages']['length'];_0x187285++){var _0xab2dbe=_0x26839c[_0xf9db('0xb7')][_0x187285][_0xf9db('0xb6')];if(_0xab2dbe){var _0x397b7f=path['join'](_0x2dcb07,_0xab2dbe['basename']);if(fs['existsSync'](_0x397b7f)){fs[_0xf9db('0xba')](_0x397b7f)[_0xf9db('0xbb')](fs['createWriteStream'](path[_0xf9db('0xb3')](_0x1f58ce,_0xab2dbe['basename'])));}}}return BPromise['resolve']()[_0xf9db('0x22')](function(){return new BPromise(function(_0x112361,_0x6bc7d9){zipdir(_0x1f58ce,{'saveTo':_0x52104f},function(_0x1821ce,_0x159306){if(_0x1821ce)return _0x6bc7d9(_0x1821ce);return _0x112361(_0x159306);});})[_0xf9db('0x22')](function(){return new BPromise(function(_0x52ee8d,_0x5b5699){rimraf(_0x1f58ce,function(_0x22c86a){if(_0x22c86a)_0x5b5699(_0x22c86a);return _0x52ee8d();});});})[_0xf9db('0x22')](function(){return _0x35f711['download'](_0x52104f,_0x24edca,function(_0x255b04){if(_0x255b04){console[_0xf9db('0xbc')](_0xf9db('0xbd'),_0x255b04);}else{fs[_0xf9db('0xbe')](_0x52104f);}});});});}else{return _0x35f711[_0xf9db('0x1a')](0xc8);}})[_0xf9db('0x9e')](handleError(_0x35f711,null));}; \ No newline at end of file +var _0x180e=['text','start','split','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','\x20IS\x20NULL','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','params','filtears','includeAll','include','create','describe','FaxMessage','addMessage','ids','getMessages','findOne','rawAttributes','$gte','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','omit','spread','findAll','emit','faxInteractionTags:save','removeTags','unix','join','root','files','server','format','transcript-%d-%s.zip','Attachment','Messages','get','createReadStream','pipe','basename','resolve','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','fullname','TagIds','Tags','forEach','push','catch','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type'];(function(_0x381372,_0xf0a5a){var _0x4e959a=function(_0x25a897){while(--_0x25a897){_0x381372['push'](_0x381372['shift']());}};_0x4e959a(++_0xf0a5a);}(_0x180e,0x65));var _0xe180=function(_0x20099a,_0x2bf584){_0x20099a=_0x20099a-0x0;var _0x2c3649=_0x180e[_0x20099a];return _0x2c3649;};'use strict';var pdf=require(_0xe180('0x0'));var emlformat=require(_0xe180('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe180('0x2'));var jsonpatch=require(_0xe180('0x3'));var rp=require('request-promise');var moment=require(_0xe180('0x4'));var BPromise=require(_0xe180('0x5'));var Mustache=require(_0xe180('0x6'));var util=require(_0xe180('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe180('0x8'));var ejs=require(_0xe180('0x9'));var fs=require('fs');var _=require(_0xe180('0xa'));var squel=require(_0xe180('0xb'));var crypto=require(_0xe180('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe180('0xd'));var Papa=require(_0xe180('0xe'));var Redis=require('ioredis');var authService=require(_0xe180('0xf'));var qs=require(_0xe180('0x10'));var as=require(_0xe180('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe180('0x12'))('api');var utils=require(_0xe180('0x13'));var config=require(_0xe180('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe180('0x15'))['db'];config['redis']=_['defaults'](config[_0xe180('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe180('0x17'))(new Redis(config[_0xe180('0x16')]));require('./faxInteraction.socket')[_0xe180('0x18')](socket);function respondWithStatusCode(_0x292067,_0x2325ae){_0x2325ae=_0x2325ae||0xcc;return function(_0xcb154e){if(_0xcb154e){return _0x292067['sendStatus'](_0x2325ae);}return _0x292067[_0xe180('0x19')](_0x2325ae)[_0xe180('0x1a')]();};}function respondWithResult(_0x355a22,_0x4659f7){_0x4659f7=_0x4659f7||0xc8;return function(_0x5287dd){if(_0x5287dd){return _0x355a22['status'](_0x4659f7)[_0xe180('0x1b')](_0x5287dd);}};}function respondWithFilteredResult(_0x1d7f84,_0x411d7b){return function(_0x2f1103){if(_0x2f1103){var _0x20d2f2=_0x2f1103[_0xe180('0x1c')],_0xc66315=_0x411d7b[_0xe180('0x1d')],_0x455e92=_0x411d7b[_0xe180('0x1d')]+_0x411d7b[_0xe180('0x1e')],_0x511532;if(_0x455e92>=_0x20d2f2){_0x455e92=_0x20d2f2;_0x511532=0xc8;}else{_0x511532=0xce;}_0x1d7f84[_0xe180('0x19')](_0x511532);return _0x1d7f84[_0xe180('0x1f')](_0xe180('0x20'),_0xc66315+'-'+_0x455e92+'/'+_0x20d2f2)['json'](_0x2f1103);}return null;};}function patchUpdates(_0x163740){return function(_0x4aa384){try{jsonpatch['apply'](_0x4aa384,_0x163740,!![]);}catch(_0x58c629){return BPromise['reject'](_0x58c629);}return _0x4aa384[_0xe180('0x21')]();};}function saveUpdates(_0x35ffaf,_0x2c4dcc){return function(_0x371a52){if(_0x371a52){return _0x371a52[_0xe180('0x22')](_0x35ffaf)[_0xe180('0x23')](function(_0x48887d){return _0x48887d;});}return null;};}function removeEntity(_0x1f67e2,_0x22a30d){return function(_0x1b5b19){if(_0x1b5b19){return _0x1b5b19[_0xe180('0x24')]()['then'](function(){_0x1f67e2[_0xe180('0x19')](0xcc)[_0xe180('0x1a')]();});}};}function handleEntityNotFound(_0x327a21,_0xae3053){return function(_0x28ec16){if(!_0x28ec16){_0x327a21[_0xe180('0x25')](0x194);}return _0x28ec16;};}function handleError(_0x47b441,_0x3123b5){_0x3123b5=_0x3123b5||0x1f4;return function(_0x3b2b36){logger[_0xe180('0x26')](_0x3b2b36[_0xe180('0x27')]);if(_0x3b2b36[_0xe180('0x28')]){delete _0x3b2b36[_0xe180('0x28')];}_0x47b441[_0xe180('0x19')](_0x3123b5)['send'](_0x3b2b36);};}function getInteractionUsers(_0x4a7ce6,_0x387a2b){return new BPromise(function(_0x5daa97,_0x4889ca){try{if(_0x387a2b[_0x4a7ce6['id']]){_0x4a7ce6['Users']=_['map'](_0x387a2b[_0x4a7ce6['id']],function(_0x4e847c){return{'id':_0x4e847c['id'],'fullname':_0x4e847c[_0xe180('0x29')]};});}}catch(_0x1bf393){_0x4889ca(_0x1bf393);}_0x5daa97(_0x4a7ce6);});}function getInteractionTags(_0x2bc09d,_0x4fd27b){return new BPromise(function(_0xec77f3,_0x34a6ae){try{if(_0x2bc09d[_0xe180('0x2a')]){_0x2bc09d[_0xe180('0x2b')]=[];_0x2bc09d[_0xe180('0x2a')]['split'](',')[_0xe180('0x2c')](function(_0x1959a9){_0x2bc09d[_0xe180('0x2b')][_0xe180('0x2d')](_0x4fd27b[_0x1959a9]);});}delete _0x2bc09d[_0xe180('0x2a')];}catch(_0x3400b8){_0x34a6ae(_0x3400b8);}_0xec77f3(_0x2bc09d);});}function updateFaxInteraction(_0x1f815c,_0x4def0f,_0x37c872){return new BPromise(function(_0x3bfc86,_0x485519){return getInteractionUsers(_0x1f815c,_0x37c872)['then'](function(_0x28a03c){return getInteractionTags(_0x28a03c,_0x4def0f);})[_0xe180('0x23')](function(_0xb396cc){_0x3bfc86(_0xb396cc);})[_0xe180('0x2e')](function(_0x52cc4c){_0x485519(_0x52cc4c);});});}exports[_0xe180('0x2f')]=function(_0x4d8e2c,_0x48c83e){var _0x565bb6={},_0x2fad04={},_0x50b0f9={'count':0x0,'rows':[]};var _0x361bdf=_[_0xe180('0x30')](db['FaxInteraction']['rawAttributes'],function(_0x3cb8b6){return{'name':_0x3cb8b6[_0xe180('0x31')],'type':_0x3cb8b6['type'][_0xe180('0x32')]};});_0x2fad04[_0xe180('0x33')]=_[_0xe180('0x30')](_0x361bdf,_0xe180('0x28'));_0x2fad04['query']=_[_0xe180('0x34')](_0x4d8e2c[_0xe180('0x35')]);_0x2fad04[_0xe180('0x36')]=_[_0xe180('0x37')](_0x2fad04[_0xe180('0x33')],_0x2fad04[_0xe180('0x35')]);_0x565bb6[_0xe180('0x38')]=_[_0xe180('0x37')](_0x2fad04[_0xe180('0x33')],qs[_0xe180('0x39')](_0x4d8e2c[_0xe180('0x35')][_0xe180('0x39')]));_0x565bb6[_0xe180('0x38')]=_0x565bb6[_0xe180('0x38')]['length']?_0x565bb6[_0xe180('0x38')]:_0x2fad04['model'];if(!_0x4d8e2c[_0xe180('0x35')][_0xe180('0x3a')](_0xe180('0x3b'))){_0x565bb6[_0xe180('0x1e')]=qs[_0xe180('0x1e')](_0x4d8e2c[_0xe180('0x35')]['limit']);_0x565bb6[_0xe180('0x1d')]=qs[_0xe180('0x1d')](_0x4d8e2c[_0xe180('0x35')][_0xe180('0x1d')]);}_0x565bb6[_0xe180('0x3c')]=qs[_0xe180('0x3d')](_0x4d8e2c[_0xe180('0x35')][_0xe180('0x3d')]);_0x565bb6['where']=qs[_0xe180('0x36')](_[_0xe180('0x3e')](_0x4d8e2c[_0xe180('0x35')],_0x2fad04[_0xe180('0x36')]),_0x361bdf);var _0x310540=[];var _0x6e3492=squel[_0xe180('0x3f')]()[_0xe180('0x40')]('id')['field'](_0xe180('0x28'))['field'](_0xe180('0x41'))[_0xe180('0x42')](_0xe180('0x43'));var _0x25466f=squel[_0xe180('0x3f')]()[_0xe180('0x40')](_0xe180('0x44'))[_0xe180('0x40')]('u.fullname')[_0xe180('0x40')]('ui.FaxInteractionId')['from'](_0xe180('0x45'),'ui')[_0xe180('0x46')]('users','u',_0xe180('0x47'));var _0x481146=squel[_0xe180('0x3f')]()[_0xe180('0x42')](_0xe180('0x48'),'i')['left_join']('cm_contacts','c',_0xe180('0x49'))[_0xe180('0x46')]('users','o',_0xe180('0x4a'))['left_join'](_0xe180('0x4b'),'a','a.id\x20=\x20i.FaxAccountId')[_0xe180('0x46')]('fax_messages','me',_0xe180('0x4c'))[_0xe180('0x46')]('fax_interaction_has_tags','it',_0xe180('0x4d'))['left_join'](_0xe180('0x43'),'t',_0xe180('0x4e'));var _0x1b8b55=squel[_0xe180('0x4f')]();var _0x16045c=[];var _0x9a6113=squel[_0xe180('0x4f')]();var _0x47d841;if(_0x4d8e2c[_0xe180('0x35')][_0xe180('0x50')]){_0x47d841=as['parseSearch'](_0x4d8e2c[_0xe180('0x35')][_0xe180('0x50')]);var _0x402652=_0x47d841[_0xe180('0x51')];for(var _0x11741e=0x0;_0x11741e<_0x47d841[_0xe180('0x52')][_0xe180('0x53')];_0x11741e++){var _0x130bf8=_0x47d841[_0xe180('0x52')][_0x11741e];var _0xda56c4='i';var _0x4cbfc3=_['find'](_0x361bdf,[_0xe180('0x28'),_0x130bf8[_0xe180('0x40')]]);if(!_0x4cbfc3){switch(_0x130bf8[_0xe180('0x40')]){case _0xe180('0x54'):if(_0x130bf8[_0xe180('0x55')]==0x1){_0x481146[_0xe180('0x56')]('`'+_0x130bf8[_0xe180('0x40')]+_0xe180('0x57'));}else{_0x481146[_0xe180('0x56')]('`'+_0x130bf8[_0xe180('0x40')]+'`\x20>\x200');}break;case _0xe180('0x58'):if(_0x130bf8[_0xe180('0x59')]===_0xe180('0x5a')){if(_0x130bf8[_0xe180('0x55')]['split']('\x20')[_0xe180('0x53')]>0x1){_0x1b8b55[_0x402652]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x130bf8[_0xe180('0x55')]),null);}else{var _0x57bbb9='%'+_0x130bf8[_0xe180('0x55')]+'%';_0x1b8b55[_0x402652](_0xe180('0x5b'),_0x57bbb9,_0x57bbb9,_0x57bbb9);}}else{_0x4cbfc3=_[_0xe180('0x5c')](_0x361bdf,[_0xe180('0x28'),_0xe180('0x5d')]);_0x130bf8['field']='ContactId';_0x4f60fd=as[_0xe180('0x5e')](_0xda56c4,_0x4cbfc3[_0xe180('0x5f')],_0x130bf8);_0x1b8b55[_0x402652](_0x4f60fd[_0xe180('0x60')],_0x4f60fd[_0xe180('0x55')][_0xe180('0x61')],_0x4f60fd[_0xe180('0x55')][_0xe180('0x1a')]);}break;case'Tag':var _0x435c23=_0x130bf8['value'][_0xe180('0x62')](',')['map'](function(_0x1e76c4){return Number(_0x1e76c4);});_0x435c23[_0xe180('0x2c')](function(_0x10a8d0){_0x9a6113['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x10a8d0+',%');});_0x16045c=_[_0xe180('0x63')](_0x16045c,_0x435c23);break;case'User':if(_0x130bf8['operator']===_0xe180('0x5a')){_0x1b8b55[_0x402652](_0xe180('0x64'),'%'+_0x130bf8[_0xe180('0x55')]+'%',null);}else{_0x4cbfc3=_['find'](_0x361bdf,[_0xe180('0x28'),_0xe180('0x65')]);_0x130bf8[_0xe180('0x40')]=_0xe180('0x65');_0x4f60fd=as[_0xe180('0x5e')](_0xda56c4,_0x4cbfc3['type'],_0x130bf8);_0x1b8b55[_0x402652](_0x4f60fd[_0xe180('0x60')],_0x4f60fd[_0xe180('0x55')][_0xe180('0x61')],_0x4f60fd[_0xe180('0x55')]['end']);}break;case _0xe180('0x66'):_0x4f60fd=as['buildExpression']('me',null,_0x130bf8);_0x1b8b55[_0x402652](_0x4f60fd[_0xe180('0x60')],_0x4f60fd['value'][_0xe180('0x61')],_0x4f60fd[_0xe180('0x55')][_0xe180('0x1a')]);break;}}else{var _0x4f60fd=as[_0xe180('0x5e')](_0xda56c4,_0x4cbfc3[_0xe180('0x5f')],_0x130bf8);_0x1b8b55[_0x402652](_0x4f60fd['text'],_0x4f60fd['value'][_0xe180('0x61')],_0x4f60fd[_0xe180('0x55')][_0xe180('0x1a')]);}}}else{var _0x5bf229=_(_0x4d8e2c[_0xe180('0x35')])[_0xe180('0x34')]()[_0xe180('0x30')](function(_0x16eb62){return _[_0xe180('0x67')](_0x361bdf,[_0xe180('0x28'),_0x16eb62])?_0x16eb62:undefined;})[_0xe180('0x68')]()[_0xe180('0x55')]();if(!_[_0xe180('0x69')](_0x5bf229)){_0x5bf229['forEach'](function(_0x4787bd){if(_0x4787bd==='FaxAccountId'){_0x481146[_0xe180('0x6a')](_0xe180('0x6b'),[][_0xe180('0x6c')](_0x4d8e2c['query'][_0x4787bd]));}else if(_0x4787bd===_0xe180('0x6d')){var _0x5c0ff3=JSON[_0xe180('0x6e')](_0x4d8e2c['query'][_0x4787bd])['$gte'];var _0x120737=JSON[_0xe180('0x6e')](_0x4d8e2c['query'][_0x4787bd])['$lte'];_0x481146[_0xe180('0x6a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5c0ff3,_0x120737);}else{if(_0x4d8e2c[_0xe180('0x35')][_0x4787bd]==='null'){_0x481146[_0xe180('0x6a')]('i.'+_0x4787bd+_0xe180('0x6f'));}else{_0x481146[_0xe180('0x6a')]('i.'+_0x4787bd+'\x20=\x20?',_0x4d8e2c[_0xe180('0x35')][_0x4787bd]);}}});}if(_0x4d8e2c['query'][_0xe180('0x70')]){if(_0x4d8e2c[_0xe180('0x35')]['read']==0x1){_0x481146[_0xe180('0x56')]('`unreadMessages`\x20=\x200');}else{_0x481146[_0xe180('0x56')]('`unreadMessages`\x20>\x200');}}if(_0x4d8e2c['query'][_0xe180('0x71')]){_0x16045c=_[_0xe180('0x72')](_0x4d8e2c['query'][_0xe180('0x71')])?_0x4d8e2c[_0xe180('0x35')]['tag']:new Array(_0x4d8e2c['query'][_0xe180('0x71')]);_0x16045c[_0xe180('0x2c')](function(_0x3c2b13){_0x9a6113['or'](_0xe180('0x73'),'%,'+_0x3c2b13+',%');});}if(_0x4d8e2c[_0xe180('0x35')][_0xe180('0x74')]){var _0x28dd88=_0x4d8e2c['query'][_0xe180('0x74')][_0xe180('0x75')]('\x5c','\x5c\x5c')[_0xe180('0x75')]('\x27\x27',_0xe180('0x76'));if(qs['isNumeric'](_0x28dd88)){_0x1b8b55['or'](_0xe180('0x77'),_0x28dd88+'%')['or']('i.fax\x20LIKE\x20?',_0x28dd88+'%');}_0x1b8b55['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x28dd88+'%');}}_0x481146['where'](_0x1b8b55);_0x481146[_0xe180('0x78')]('i.id');var _0x309f29={'type':db[_0xe180('0x79')][_0xe180('0x7a')][_0xe180('0x7b')],'raw':!![]};var _0x49323b=_0x481146['clone']();_0x49323b['field'](_0xe180('0x7c'));_0x49323b['field'](_0xe180('0x7d'),_0xe180('0x54'));if(_0x565bb6[_0xe180('0x3c')]){_0x565bb6[_0xe180('0x3c')]['forEach'](function(_0x468fa2){_0x481146['order']('i.'+_0x468fa2[0x0],_0x468fa2[0x1]===_0xe180('0x7e')?![]:!![]);});}if(!_[_0xe180('0x69')](_0x16045c)){_0x481146['having'](_0x9a6113);_0x49323b[_0xe180('0x6a')](_0xe180('0x7f'),_0x16045c);}BPromise['resolve']()[_0xe180('0x23')](function(){if(!_0x47d841){if(_0x4d8e2c['query'][_0xe180('0x80')]||_0x4d8e2c[_0xe180('0x35')]['journey'])return;_0x49323b[_0xe180('0x6a')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x481146[_0xe180('0x6a')](_0xe180('0x81'));return;}return _0x4d8e2c['user']['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xe180('0x23')](function(_0x10129e){if(_[_0xe180('0x69')](_0x10129e)){_0x49323b[_0xe180('0x6a')]('i.FaxAccountId\x20IS\x20NULL');_0x481146[_0xe180('0x6a')](_0xe180('0x82'));}else{_0x49323b[_0xe180('0x6a')]('i.FaxAccountId\x20IN\x20?',_[_0xe180('0x30')](_0x10129e,'id'));_0x481146['where'](_0xe180('0x6b'),_[_0xe180('0x30')](_0x10129e,'id'));}});})[_0xe180('0x23')](function(){db[_0xe180('0x83')][_0xe180('0x35')](_0x49323b[_0xe180('0x84')](),_0x309f29)[_0xe180('0x23')](function(_0x36a1d9){_0x50b0f9[_0xe180('0x1c')]=_0x36a1d9[_0xe180('0x53')];if(_0x50b0f9[_0xe180('0x1c')]===0x0)return[];return db[_0xe180('0x83')][_0xe180('0x35')](_0x6e3492[_0xe180('0x84')](),_0x309f29)[_0xe180('0x23')](function(_0x42ffd1){_0x310540=_[_0xe180('0x85')](_0x42ffd1,'id');_0x309f29=_[_0xe180('0x86')](_0x309f29,{'model':db[_0xe180('0x87')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4d8e2c[_0xe180('0x35')][_0xe180('0x39')]){_0x565bb6[_0xe180('0x38')][_0xe180('0x2c')](function(_0x2e8141){_0x481146[_0xe180('0x40')]('i.'+_0x2e8141);});}else{_0x481146[_0xe180('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x481146[_0xe180('0x40')](_0xe180('0x88'),_0xe180('0x89'));_0x481146['field'](_0xe180('0x8a'),_0xe180('0x8b'));_0x481146[_0xe180('0x40')](_0xe180('0x8c'));_0x481146[_0xe180('0x40')](_0xe180('0x8d'),_0xe180('0x8e'));_0x481146[_0xe180('0x40')](_0xe180('0x8f'),_0xe180('0x90'));_0x481146[_0xe180('0x40')](_0xe180('0x91'),_0xe180('0x92'));_0x481146[_0xe180('0x40')](_0xe180('0x93'),'Contact.phone');_0x481146[_0xe180('0x40')](_0xe180('0x94'),'Contact.mobile');_0x481146[_0xe180('0x40')](_0xe180('0x95'),_0xe180('0x96'));_0x481146[_0xe180('0x40')](_0xe180('0x97'),_0xe180('0x98'));_0x481146[_0xe180('0x40')](_0xe180('0x99'),'Owner.internal');_0x481146[_0xe180('0x40')](_0xe180('0x9a'),_0xe180('0x2a'));}if(_0x565bb6['limit'])_0x481146[_0xe180('0x1e')](_0x565bb6[_0xe180('0x1e')]);if(_0x565bb6[_0xe180('0x1d')])_0x481146[_0xe180('0x1d')](_0x565bb6[_0xe180('0x1d')]);return db[_0xe180('0x83')][_0xe180('0x35')](_0x481146[_0xe180('0x84')](),_0x309f29);})[_0xe180('0x23')](function(_0x1434c5){_0x25466f[_0xe180('0x6a')](_0xe180('0x9b'),_['map'](_0x1434c5,'id'));return db[_0xe180('0x83')][_0xe180('0x35')](_0x25466f['toString'](),_0x309f29)[_0xe180('0x23')](function(_0x3fdea0){var _0x2c9259=_[_0xe180('0x9c')](_0x3fdea0,_0xe180('0x9d'));var _0x3d36c4=[];_0x1434c5[_0xe180('0x2c')](function(_0x323dab){_0x3d36c4[_0xe180('0x2d')](updateFaxInteraction(_0x323dab,_0x310540,_0x2c9259));});return BPromise['all'](_0x3d36c4);});});})[_0xe180('0x23')](function(_0x58a1ee){_0x50b0f9[_0xe180('0x9e')]=_0x58a1ee;return _0x50b0f9;})[_0xe180('0x23')](respondWithFilteredResult(_0x48c83e,_0x565bb6));})[_0xe180('0x2e')](handleError(_0x48c83e,null));};exports['show']=function(_0x314e18,_0x335295){var _0x59af99={'raw':![],'where':{'id':_0x314e18[_0xe180('0x9f')]['id']}},_0x28d3cf={};_0x28d3cf[_0xe180('0x33')]=_['keys'](db[_0xe180('0x87')]['rawAttributes']);_0x28d3cf[_0xe180('0x35')]=_[_0xe180('0x34')](_0x314e18[_0xe180('0x35')]);_0x28d3cf[_0xe180('0xa0')]=_[_0xe180('0x37')](_0x28d3cf[_0xe180('0x33')],_0x28d3cf['query']);_0x59af99['attributes']=_[_0xe180('0x37')](_0x28d3cf['model'],qs[_0xe180('0x39')](_0x314e18[_0xe180('0x35')][_0xe180('0x39')]));_0x59af99[_0xe180('0x38')]=_0x59af99[_0xe180('0x38')][_0xe180('0x53')]?_0x59af99['attributes']:_0x28d3cf[_0xe180('0x33')];if(_0x314e18[_0xe180('0x35')][_0xe180('0xa1')]){_0x59af99[_0xe180('0xa2')]=[{'all':!![]}];}_0x59af99=_['merge']({},_0x59af99,_0x314e18['options']);return db[_0xe180('0x87')][_0xe180('0x5c')](_0x59af99)[_0xe180('0x23')](handleEntityNotFound(_0x335295,null))['then'](respondWithResult(_0x335295,null))[_0xe180('0x2e')](handleError(_0x335295,null));};exports[_0xe180('0xa3')]=function(_0x4f3a06,_0x25da9e){return db[_0xe180('0x87')][_0xe180('0xa3')](_0x4f3a06[_0xe180('0x66')],{})[_0xe180('0x23')](respondWithResult(_0x25da9e,0xc9))[_0xe180('0x2e')](handleError(_0x25da9e,null));};exports[_0xe180('0x22')]=function(_0x1fc68c,_0x153969){if(_0x1fc68c['body']['id']){delete _0x1fc68c[_0xe180('0x66')]['id'];}return db[_0xe180('0x87')]['find']({'where':{'id':_0x1fc68c[_0xe180('0x9f')]['id']}})[_0xe180('0x23')](handleEntityNotFound(_0x153969,null))['then'](saveUpdates(_0x1fc68c[_0xe180('0x66')],null))[_0xe180('0x23')](respondWithResult(_0x153969,null))[_0xe180('0x2e')](handleError(_0x153969,null));};exports[_0xe180('0x24')]=function(_0x207f45,_0xa3dbba){return db[_0xe180('0x87')][_0xe180('0x5c')]({'where':{'id':_0x207f45[_0xe180('0x9f')]['id']}})[_0xe180('0x23')](handleEntityNotFound(_0xa3dbba,null))[_0xe180('0x23')](removeEntity(_0xa3dbba,null))[_0xe180('0x2e')](handleError(_0xa3dbba,null));};exports[_0xe180('0xa4')]=function(_0x20a50a,_0x1ddfd4){return db['FaxInteraction'][_0xe180('0xa4')]()['then'](respondWithResult(_0x1ddfd4,null))[_0xe180('0x2e')](handleError(_0x1ddfd4,null));};exports['addMessage']=function(_0x500473,_0x248e7d,_0xcedb29){return db[_0xe180('0xa5')][_0xe180('0x5c')]({'where':{'id':_0x500473['params']['id']}})['then'](handleEntityNotFound(_0x248e7d,null))[_0xe180('0x23')](function(_0x2f7658){if(_0x2f7658){return _0x2f7658[_0xe180('0xa6')](_0x500473[_0xe180('0x66')]['ids'],_['omit'](_0x500473[_0xe180('0x66')],[_0xe180('0xa7'),'id'])||{});}})[_0xe180('0x23')](respondWithResult(_0x248e7d,null))[_0xe180('0x2e')](handleError(_0x248e7d,null));};exports[_0xe180('0xa8')]=function(_0x13eec4,_0x379bcb,_0x19ee98){var _0xe344f6={'raw':![],'where':{}};var _0x416064={};var _0xf5152b={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xe180('0xa9')]({'where':{'id':_0x13eec4[_0xe180('0x9f')]['id']}})[_0xe180('0x23')](handleEntityNotFound(_0x379bcb,null))[_0xe180('0x23')](function(_0x45343d){if(_0x45343d){_0x416064[_0xe180('0x33')]=_['keys'](db[_0xe180('0xa5')][_0xe180('0xaa')]);_0x416064[_0xe180('0x35')]=_[_0xe180('0x34')](_0x13eec4[_0xe180('0x35')]);_0x416064[_0xe180('0x36')]=_[_0xe180('0x37')](_0x416064['model'],_0x416064['query']);_0xe344f6[_0xe180('0x38')]=_[_0xe180('0x37')](_0x416064[_0xe180('0x33')],qs[_0xe180('0x39')](_0x13eec4[_0xe180('0x35')][_0xe180('0x39')]));_0xe344f6['attributes']=_0xe344f6[_0xe180('0x38')][_0xe180('0x53')]?_0xe344f6[_0xe180('0x38')]:_0x416064['model'];if(!_0x13eec4['query']['hasOwnProperty']('nolimit')){_0xe344f6[_0xe180('0x1e')]=qs[_0xe180('0x1e')](_0x13eec4['query'][_0xe180('0x1e')]);_0xe344f6[_0xe180('0x1d')]=qs[_0xe180('0x1d')](_0x13eec4[_0xe180('0x35')][_0xe180('0x1d')]);}_0xe344f6[_0xe180('0x3c')]=qs[_0xe180('0x3d')](_0x13eec4['query'][_0xe180('0x3d')]);_0xe344f6['where']=qs[_0xe180('0x36')](_[_0xe180('0x3e')](_0x13eec4[_0xe180('0x35')],_0x416064[_0xe180('0x36')]));_0xe344f6['where'][_0xe180('0x9d')]=_0x45343d['id'];if(_0x13eec4[_0xe180('0x35')]['filter']){_0xe344f6['where']=_[_0xe180('0x86')](_0xe344f6[_0xe180('0x6a')],{'$or':_[_0xe180('0x30')](_0xe344f6[_0xe180('0x38')],function(_0x2ec332){var _0x369d68={};_0x369d68[_0x2ec332]={'$like':'%'+_0x13eec4[_0xe180('0x35')][_0xe180('0x74')]+'%'};return _0x369d68;})});}if(_0x13eec4['query']['$gte']){var _0x51611f=_0x13eec4[_0xe180('0x35')][_0xe180('0xab')][_0xe180('0x62')](',');var _0x231f61={};_0x231f61[_0x51611f[0x0]]={'$gte':moment(_0x51611f[0x1])['format'](_0xe180('0xac'))};_0xe344f6['where']=_[_0xe180('0x86')](_0xe344f6[_0xe180('0x6a')],_0x231f61);}_0xe344f6=_[_0xe180('0x86')]({},_0xe344f6,_0x13eec4[_0xe180('0xad')]);return db[_0xe180('0xa5')][_0xe180('0x1c')]({'where':_0xe344f6['where']})[_0xe180('0x23')](function(_0x3eaea1){_0xf5152b[_0xe180('0x1c')]=_0x3eaea1;if(_0x13eec4['query'][_0xe180('0xa1')]){_0xe344f6[_0xe180('0xa2')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0xe344f6);})['then'](function(_0x100a4b){_0xf5152b['rows']=_0x100a4b;return _0xf5152b;});}})[_0xe180('0x23')](respondWithFilteredResult(_0x379bcb,_0xe344f6))[_0xe180('0x2e')](handleError(_0x379bcb,null));};exports[_0xe180('0xae')]=function(_0xc4e151,_0x27c7d0,_0x23adc4){return db[_0xe180('0x87')][_0xe180('0x5c')]({'where':{'id':_0xc4e151[_0xe180('0x9f')]['id']}})[_0xe180('0x23')](handleEntityNotFound(_0x27c7d0,null))['then'](function(_0x510d4b){if(_0x510d4b){return _0x510d4b[_0xe180('0xaf')](_0xc4e151[_0xe180('0x66')][_0xe180('0xa7')],_[_0xe180('0xb0')](_0xc4e151[_0xe180('0x66')],[_0xe180('0xa7'),'id'])||{})[_0xe180('0xb1')](function(){return db['Tag'][_0xe180('0xb2')]({'attributes':['id',_0xe180('0x28'),_0xe180('0x41')],'where':{'id':_0xc4e151[_0xe180('0x66')][_0xe180('0xa7')]}});})[_0xe180('0x23')](function(_0x3ef042){socket[_0xe180('0xb3')](_0xe180('0xb4'),{'id':Number(_0xc4e151[_0xe180('0x9f')]['id']),'tags':_0x3ef042||[]});return{'id':Number(_0xc4e151[_0xe180('0x9f')]['id']),'tags':_0x3ef042||[]};});}})[_0xe180('0x23')](respondWithResult(_0x27c7d0,null))['catch'](handleError(_0x27c7d0,null));};exports[_0xe180('0xb5')]=function(_0x4d2bc5,_0x32c535,_0x2a6ffb){return db['FaxInteraction'][_0xe180('0x5c')]({'where':{'id':_0x4d2bc5[_0xe180('0x9f')]['id']}})[_0xe180('0x23')](handleEntityNotFound(_0x32c535,null))[_0xe180('0x23')](function(_0x48c3b3){if(_0x48c3b3){return _0x48c3b3[_0xe180('0xb5')](_0x4d2bc5[_0xe180('0x35')][_0xe180('0xa7')]);}})['then'](respondWithStatusCode(_0x32c535,null))[_0xe180('0x2e')](handleError(_0x32c535,null));};exports['download']=function(_0x287717,_0x2f0049){var _0x347803=moment()[_0xe180('0xb6')]()[_0xe180('0x84')]();var _0xf8c8b8=path[_0xe180('0xb7')](config[_0xe180('0xb8')],'server',_0xe180('0xb9'),'tmp');var _0x5562a3=path['join'](config[_0xe180('0xb8')],_0xe180('0xba'),_0xe180('0xb9'),'attachments');var _0x469e55=path[_0xe180('0xb7')](_0xf8c8b8,_0x347803);var _0x157386=util[_0xe180('0xbb')](_0xe180('0xbc'),_0x287717[_0xe180('0x9f')]['id'],_0x347803);var _0x3974f5=path['join'](_0xf8c8b8,_0x157386);var _0x431b07=[];_0x431b07[_0xe180('0x2d')]({'model':db[_0xe180('0xbd')],'as':_0xe180('0xbd'),'raw':!![]});var _0x29b0f6=[{'model':db[_0xe180('0xa5')],'as':'Messages','attributes':['id',_0xe180('0x66'),_0xe180('0x6d')],'include':_0x431b07}];return db[_0xe180('0x87')][_0xe180('0x5c')]({'where':{'id':_0x287717[_0xe180('0x9f')]['id']},'include':_0x29b0f6})[_0xe180('0x23')](handleEntityNotFound(_0x2f0049,null))[_0xe180('0x23')](function(_0x4afcb9){if(_0x4afcb9&&_0x4afcb9[_0xe180('0xbe')]){var _0x34a919=_0x4afcb9[_0xe180('0xbf')]({'plain':!![]});fs['mkdirSync'](_0x469e55);for(var _0x134cc9=0x0;_0x134cc9<_0x34a919[_0xe180('0xbe')][_0xe180('0x53')];_0x134cc9++){var _0x5b9540=_0x34a919[_0xe180('0xbe')][_0x134cc9][_0xe180('0xbd')];if(_0x5b9540){var _0x35d396=path[_0xe180('0xb7')](_0x5562a3,_0x5b9540['basename']);if(fs['existsSync'](_0x35d396)){fs[_0xe180('0xc0')](_0x35d396)[_0xe180('0xc1')](fs['createWriteStream'](path[_0xe180('0xb7')](_0x469e55,_0x5b9540[_0xe180('0xc2')])));}}}return BPromise[_0xe180('0xc3')]()[_0xe180('0x23')](function(){return new BPromise(function(_0x3030b7,_0x27360d){zipdir(_0x469e55,{'saveTo':_0x3974f5},function(_0x24bfa4,_0x3fba70){if(_0x24bfa4)return _0x27360d(_0x24bfa4);return _0x3030b7(_0x3fba70);});})[_0xe180('0x23')](function(){return new BPromise(function(_0x598ef2,_0x32153c){rimraf(_0x469e55,function(_0x533a08){if(_0x533a08)_0x32153c(_0x533a08);return _0x598ef2();});});})[_0xe180('0x23')](function(){return _0x2f0049['download'](_0x3974f5,_0x157386,function(_0x1ec630){if(_0x1ec630){console['log']('err',_0x1ec630);}else{fs[_0xe180('0xc4')](_0x3974f5);}});});});}else{return _0x2f0049[_0xe180('0x25')](0xc8);}})['catch'](handleError(_0x2f0049,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 6bd939c..9cba9c6 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 _0x814b=['then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x420782,_0x216ccf){var _0x5c3bb3=function(_0x460760){while(--_0x460760){_0x420782['push'](_0x420782['shift']());}};_0x5c3bb3(++_0x216ccf);}(_0x814b,0x1a2));var _0xb814=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x814b[_0x36eaaa];return _0x461349;};'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 +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x4de376,_0x1c5d06){var _0x4d0489=function(_0x492249){while(--_0x492249){_0x4de376['push'](_0x4de376['shift']());}};_0x4d0489(++_0x1c5d06);}(_0xadb5,0xad));var _0x5adb=function(_0x58c07c,_0x5bf763){_0x58c07c=_0x58c07c-0x0;var _0x57ecfc=_0xadb5[_0x58c07c];return _0x57ecfc;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8553fd0..bf50c4e 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 _0x2022=['util','../../config/logger','moment','bluebird','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash'];(function(_0x303642,_0x23121b){var _0x19107c=function(_0x54bf85){while(--_0x54bf85){_0x303642['push'](_0x303642['shift']());}};_0x19107c(++_0x23121b);}(_0x2022,0xbf));var _0x2202=function(_0x4aa44f,_0x4384c1){_0x4aa44f=_0x4aa44f-0x0;var _0x193854=_0x2022[_0x4aa44f];return _0x193854;};'use strict';var _=require(_0x2202('0x0'));var util=require(_0x2202('0x1'));var logger=require(_0x2202('0x2'))('api');var moment=require(_0x2202('0x3'));var BPromise=require(_0x2202('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2202('0x5'));var rimraf=require(_0x2202('0x6'));var config=require('../../config/environment');var attributes=require(_0x2202('0x7'));module[_0x2202('0x8')]=function(_0x5a3697,_0x285c3e){return _0x5a3697[_0x2202('0x9')](_0x2202('0xa'),attributes,{'tableName':_0x2202('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e551a,_0x698ceb,_0x278d20){if(_0x5e551a[_0x2202('0xc')](_0x2202('0xd'))){_0x5e551a[_0x2202('0xe')]=moment()[_0x2202('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x278d20(null,_0x5e551a);}}});}; \ No newline at end of file +var _0x898b=['moment','bluebird','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x898b,0x1a2));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb898('0x0'));var logger=require('../../config/logger')(_0xb898('0x1'));var moment=require(_0xb898('0x2'));var BPromise=require(_0xb898('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb898('0x4'));var rimraf=require('rimraf');var config=require(_0xb898('0x5'));var attributes=require(_0xb898('0x6'));module[_0xb898('0x7')]=function(_0x5f3544,_0x92743e){return _0x5f3544[_0xb898('0x8')](_0xb898('0x9'),attributes,{'tableName':_0xb898('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26b566,_0x497dd5,_0x2d3585){if(_0x26b566[_0xb898('0xb')]('closed')){_0x26b566[_0xb898('0xc')]=moment()['format'](_0xb898('0xd'));}_0x2d3585(null,_0x26b566);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e7ae08b..c77191e 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 _0x0195=['redis','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','stringify','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x54783e,_0xe85a52){var _0x4b03f4=function(_0x4095ba){while(--_0x4095ba){_0x54783e['push'](_0x54783e['shift']());}};_0x4b03f4(++_0xe85a52);}(_0x0195,0x155));var _0x5019=function(_0x401a94,_0x160d10){_0x401a94=_0x401a94-0x0;var _0x5ede9e=_0x0195[_0x401a94];return _0x5ede9e;};'use strict';var _=require(_0x5019('0x0'));var util=require('util');var moment=require(_0x5019('0x1'));var BPromise=require(_0x5019('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5019('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5019('0x4'));var logger=require(_0x5019('0x5'))(_0x5019('0x6'));var config=require(_0x5019('0x7'));var jayson=require(_0x5019('0x8'));var client=jayson['client'][_0x5019('0x9')]({'port':0x232a});config[_0x5019('0xa')]=_['defaults'](config[_0x5019('0xa')],{'host':_0x5019('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5019('0xa')]));require('./faxInteraction.socket')[_0x5019('0xc')](socket);function respondWithRpcPromise(_0x1758a8,_0x1c8476,_0x1e5489){return new BPromise(function(_0x543744,_0x22f057){return client[_0x5019('0xd')](_0x1758a8,_0x1e5489)[_0x5019('0xe')](function(_0x5ea66f){logger[_0x5019('0xf')](_0x5019('0x10'),_0x1c8476,_0x5019('0x11'));logger[_0x5019('0x12')](_0x5019('0x13'),_0x1c8476,'request\x20sent',JSON['stringify'](_0x5ea66f));if(_0x5ea66f[_0x5019('0x14')]){if(_0x5ea66f['error'][_0x5019('0x15')]===0x1f4){logger[_0x5019('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1c8476,_0x5ea66f['error'][_0x5019('0x16')]);return _0x22f057(_0x5ea66f[_0x5019('0x14')]['message']);}logger['error'](_0x5019('0x10'),_0x1c8476,_0x5ea66f[_0x5019('0x14')][_0x5019('0x16')]);return _0x543744(_0x5ea66f['error'][_0x5019('0x16')]);}else{logger[_0x5019('0xf')](_0x5019('0x10'),_0x1c8476,_0x5019('0x11'));_0x543744(_0x5ea66f['result'][_0x5019('0x16')]);}})[_0x5019('0x17')](function(_0x4663b8){logger['error'](_0x5019('0x10'),_0x1c8476,_0x4663b8);_0x22f057(_0x4663b8);});});}exports[_0x5019('0x18')]=function(_0xbae872){var _0x18fd90=this;return new Promise(function(_0x158431,_0x3a7421){return db[_0x5019('0x19')][_0x5019('0x1a')](_0xbae872[_0x5019('0x1b')],{'raw':_0xbae872[_0x5019('0x1c')]?_0xbae872[_0x5019('0x1c')][_0x5019('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbae872['options']?_0xbae872[_0x5019('0x1c')][_0x5019('0x1e')]||null:null,'attributes':_0xbae872[_0x5019('0x1c')]?_0xbae872[_0x5019('0x1c')][_0x5019('0x1f')]||null:null,'limit':_0xbae872[_0x5019('0x1c')]?_0xbae872[_0x5019('0x1c')][_0x5019('0x20')]||null:null})[_0x5019('0xe')](function(_0xf01da1){logger[_0x5019('0xf')](_0x5019('0x18'),_0xbae872);logger['debug']('UpdateFaxInteraction',_0xbae872,JSON[_0x5019('0x21')](_0xf01da1));_0x158431(_0xf01da1);})[_0x5019('0x17')](function(_0x473ef4){logger[_0x5019('0x14')](_0x5019('0x18'),_0x473ef4[_0x5019('0x16')],_0xbae872);_0x3a7421(_0x18fd90[_0x5019('0x14')](0x1f4,_0x473ef4['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x46eeea){return new Promise(function(_0x168723,_0x12b30a){return db[_0x5019('0x19')]['find']({'where':_0x46eeea[_0x5019('0x1c')]?_0x46eeea[_0x5019('0x1c')][_0x5019('0x1e')]||null:null})['then'](function(_0x3fd245){if(_0x3fd245){return _0x3fd245[_0x5019('0x22')](_0x46eeea[_0x5019('0x1b')][_0x5019('0x23')],_[_0x5019('0x24')](_0x46eeea['body'],[_0x5019('0x23'),'id'])||{});}})[_0x5019('0x25')](function(_0x142556){logger['info'](_0x5019('0x26'),_0x46eeea);logger[_0x5019('0x12')](_0x5019('0x26'),_0x46eeea,JSON[_0x5019('0x21')](_0x142556));_0x168723(_0x142556);})['catch'](function(_0x4e0938){logger[_0x5019('0x14')](_0x5019('0x26'),_0x4e0938[_0x5019('0x16')],_0x46eeea);_0x12b30a(_this['error'](0x1f4,_0x4e0938['message']));});});}; \ No newline at end of file +var _0xf95d=['request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','message','error','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','debug','stringify','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register'];(function(_0x40b595,_0x5b9b1){var _0x43e3cf=function(_0x210ab7){while(--_0x210ab7){_0x40b595['push'](_0x40b595['shift']());}};_0x43e3cf(++_0x5b9b1);}(_0xf95d,0x6f));var _0xdf95=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xf95d[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xdf95('0x0'));var util=require(_0xdf95('0x1'));var moment=require(_0xdf95('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf95('0x3'));var fs=require('fs');var Redis=require(_0xdf95('0x4'));var db=require(_0xdf95('0x5'))['db'];var utils=require(_0xdf95('0x6'));var logger=require(_0xdf95('0x7'))(_0xdf95('0x8'));var config=require(_0xdf95('0x9'));var jayson=require(_0xdf95('0xa'));var client=jayson['client'][_0xdf95('0xb')]({'port':0x232a});config[_0xdf95('0xc')]=_[_0xdf95('0xd')](config[_0xdf95('0xc')],{'host':_0xdf95('0xe'),'port':0x18eb});var socket=require(_0xdf95('0xf'))(new Redis(config[_0xdf95('0xc')]));require(_0xdf95('0x10'))[_0xdf95('0x11')](socket);function respondWithRpcPromise(_0x4d31c0,_0x3c8e95,_0x53185f){return new BPromise(function(_0xc5cc67,_0x12918a){return client[_0xdf95('0x12')](_0x4d31c0,_0x53185f)[_0xdf95('0x13')](function(_0x1b0b2e){logger[_0xdf95('0x14')](_0xdf95('0x15'),_0x3c8e95,'request\x20sent');logger['debug'](_0xdf95('0x16'),_0x3c8e95,_0xdf95('0x17'),JSON['stringify'](_0x1b0b2e));if(_0x1b0b2e['error']){if(_0x1b0b2e['error']['code']===0x1f4){logger['error'](_0xdf95('0x15'),_0x3c8e95,_0x1b0b2e['error'][_0xdf95('0x18')]);return _0x12918a(_0x1b0b2e[_0xdf95('0x19')][_0xdf95('0x18')]);}logger['error'](_0xdf95('0x15'),_0x3c8e95,_0x1b0b2e['error'][_0xdf95('0x18')]);return _0xc5cc67(_0x1b0b2e['error']['message']);}else{logger[_0xdf95('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x3c8e95,'request\x20sent');_0xc5cc67(_0x1b0b2e[_0xdf95('0x1a')][_0xdf95('0x18')]);}})[_0xdf95('0x1b')](function(_0x4abfa8){logger[_0xdf95('0x19')](_0xdf95('0x15'),_0x3c8e95,_0x4abfa8);_0x12918a(_0x4abfa8);});});}exports[_0xdf95('0x1c')]=function(_0x185f64){var _0x5d1866=this;return new Promise(function(_0x5073c6,_0x31867a){return db[_0xdf95('0x1d')]['update'](_0x185f64[_0xdf95('0x1e')],{'raw':_0x185f64[_0xdf95('0x1f')]?_0x185f64['options'][_0xdf95('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185f64[_0xdf95('0x1f')]?_0x185f64[_0xdf95('0x1f')][_0xdf95('0x21')]||null:null,'attributes':_0x185f64[_0xdf95('0x1f')]?_0x185f64['options'][_0xdf95('0x22')]||null:null,'limit':_0x185f64['options']?_0x185f64[_0xdf95('0x1f')]['limit']||null:null})[_0xdf95('0x13')](function(_0x8d08f8){logger[_0xdf95('0x14')](_0xdf95('0x1c'),_0x185f64);logger[_0xdf95('0x23')](_0xdf95('0x1c'),_0x185f64,JSON[_0xdf95('0x24')](_0x8d08f8));_0x5073c6(_0x8d08f8);})[_0xdf95('0x1b')](function(_0x32020d){logger[_0xdf95('0x19')](_0xdf95('0x1c'),_0x32020d[_0xdf95('0x18')],_0x185f64);_0x31867a(_0x5d1866[_0xdf95('0x19')](0x1f4,_0x32020d['message']));});});};exports[_0xdf95('0x25')]=function(_0x366975){return new Promise(function(_0x135c54,_0x3b7bec){return db['FaxInteraction'][_0xdf95('0x26')]({'where':_0x366975['options']?_0x366975[_0xdf95('0x1f')][_0xdf95('0x21')]||null:null})['then'](function(_0x5b60a9){if(_0x5b60a9){return _0x5b60a9['addTags'](_0x366975[_0xdf95('0x1e')][_0xdf95('0x27')],_[_0xdf95('0x28')](_0x366975['body'],['ids','id'])||{});}})[_0xdf95('0x29')](function(_0x57b1b0){logger[_0xdf95('0x14')]('AddTags',_0x366975);logger[_0xdf95('0x23')](_0xdf95('0x2a'),_0x366975,JSON['stringify'](_0x57b1b0));_0x135c54(_0x57b1b0);})[_0xdf95('0x1b')](function(_0x48b922){logger['error'](_0xdf95('0x2a'),_0x48b922['message'],_0x366975);_0x3b7bec(_this[_0xdf95('0x19')](0x1f4,_0x48b922['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3dfe51c..e0c22f9 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 _0x7b75=['removeListener','register','remove'];(function(_0xdacad2,_0x130437){var _0x43ba8e=function(_0x15ad6f){while(--_0x15ad6f){_0xdacad2['push'](_0xdacad2['shift']());}};_0x43ba8e(++_0x130437);}(_0x7b75,0x110));var _0x57b7=function(_0x44d8e8,_0x182607){_0x44d8e8=_0x44d8e8-0x0;var _0x36a19c=_0x7b75[_0x44d8e8];return _0x36a19c;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x57b7('0x0'),'update'];function createListener(_0x1b648f,_0x1321a9){return function(_0x37cb5a){_0x1321a9['emit'](_0x1b648f,_0x37cb5a);};}function removeListener(_0x5e151e,_0x262db4){return function(){FaxInteractionEvents[_0x57b7('0x1')](_0x5e151e,_0x262db4);};}exports[_0x57b7('0x2')]=function(_0x2d616f){for(var _0x40cb92=0x0,_0x8d4506=events['length'];_0x40cb92<_0x8d4506;_0x40cb92++){var _0x2df235=events[_0x40cb92];var _0x3f6ee7=createListener('faxInteraction:'+_0x2df235,_0x2d616f);FaxInteractionEvents['on'](_0x2df235,_0x3f6ee7);}}; \ No newline at end of file +var _0x9792=['register','./faxInteraction.events','save','remove','update','emit','removeListener'];(function(_0x163582,_0x1935a7){var _0x3677cf=function(_0x34f190){while(--_0x34f190){_0x163582['push'](_0x163582['shift']());}};_0x3677cf(++_0x1935a7);}(_0x9792,0xda));var _0x2979=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9792[_0x4b369d];return _0x571a98;};'use strict';var FaxInteractionEvents=require(_0x2979('0x0'));var events=[_0x2979('0x1'),_0x2979('0x2'),_0x2979('0x3')];function createListener(_0x5265e7,_0x399645){return function(_0x31814d){_0x399645[_0x2979('0x4')](_0x5265e7,_0x31814d);};}function removeListener(_0x3125ab,_0x5d9d6c){return function(){FaxInteractionEvents[_0x2979('0x5')](_0x3125ab,_0x5d9d6c);};}exports[_0x2979('0x6')]=function(_0xe03f2b){for(var _0x53b382=0x0,_0x1f4f69=events['length'];_0x53b382<_0x1f4f69;_0x53b382++){var _0x862079=events[_0x53b382];var _0x1ccb96=createListener('faxInteraction:'+_0x862079,_0xe03f2b);FaxInteractionEvents['on'](_0x862079,_0x1ccb96);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index cedaa0c..19fde65 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 _0xa571=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','faxinteraction:addtags','addTags','put','update','delete','fax','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./faxInteraction.controller'];(function(_0x4d3825,_0x7514ba){var _0x1c135e=function(_0x5ad604){while(--_0x5ad604){_0x4d3825['push'](_0x4d3825['shift']());}};_0x1c135e(++_0x7514ba);}(_0xa571,0x107));var _0x1a57=function(_0x4e8957,_0x5f0149){_0x4e8957=_0x4e8957-0x0;var _0x1e3d91=_0xa571[_0x4e8957];return _0x1e3d91;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get']('/',auth[_0x1a57('0x7')](),controller[_0x1a57('0x8')]);router[_0x1a57('0x9')](_0x1a57('0xa'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xb')]);router['get'](_0x1a57('0xc'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xd')]);router['get'](_0x1a57('0xe'),auth[_0x1a57('0x7')](),controller[_0x1a57('0xf')]);router[_0x1a57('0x9')](_0x1a57('0x10'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x11')]);router[_0x1a57('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a57('0x12')](_0x1a57('0xe'),auth[_0x1a57('0x7')](),controller['addMessage']);router[_0x1a57('0x12')](_0x1a57('0x13'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')]('fax',_0x1a57('0x15')),controller[_0x1a57('0x16')]);router[_0x1a57('0x17')](_0x1a57('0xc'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')]('fax','faxinteraction:update'),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')](_0x1a57('0xc'),auth['isAuthenticated'](),interaction[_0x1a57('0x14')](_0x1a57('0x1a'),_0x1a57('0x1b')),controller['destroy']);router[_0x1a57('0x19')](_0x1a57('0x13'),auth[_0x1a57('0x7')](),controller[_0x1a57('0x1c')]);module[_0x1a57('0x1d')]=router; \ No newline at end of file +var _0xaa88=['show','/:id/messages','getMessages','/:id/download','post','/:id/tags','fax','put','tracked','faxinteraction:update','update','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id'];(function(_0x36d780,_0x493be1){var _0x491eda=function(_0x5c741e){while(--_0x5c741e){_0x36d780['push'](_0x36d780['shift']());}};_0x491eda(++_0x493be1);}(_0xaa88,0x137));var _0x8aa8=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xaa88[_0x4392af];return _0x9fa8eb;};'use strict';var multer=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var timeout=require(_0x8aa8('0x3'));var express=require('express');var router=express[_0x8aa8('0x4')]();var auth=require(_0x8aa8('0x5'));var interaction=require(_0x8aa8('0x6'));var config=require(_0x8aa8('0x7'));var controller=require(_0x8aa8('0x8'));router[_0x8aa8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8aa8('0x9')]('/describe',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0xb')]);router[_0x8aa8('0x9')](_0x8aa8('0xc'),auth['isAuthenticated'](),controller[_0x8aa8('0xd')]);router[_0x8aa8('0x9')](_0x8aa8('0xe'),auth['isAuthenticated'](),controller[_0x8aa8('0xf')]);router[_0x8aa8('0x9')](_0x8aa8('0x10'),auth[_0x8aa8('0xa')](),controller['download']);router[_0x8aa8('0x11')]('/',auth[_0x8aa8('0xa')](),controller['create']);router[_0x8aa8('0x11')](_0x8aa8('0xe'),auth[_0x8aa8('0xa')](),controller['addMessage']);router[_0x8aa8('0x11')](_0x8aa8('0x12'),auth[_0x8aa8('0xa')](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:addtags'),controller['addTags']);router[_0x8aa8('0x14')](_0x8aa8('0xc'),auth[_0x8aa8('0xa')](),interaction[_0x8aa8('0x15')](_0x8aa8('0x13'),_0x8aa8('0x16')),controller[_0x8aa8('0x17')]);router[_0x8aa8('0x18')](_0x8aa8('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x8aa8('0x13'),'faxinteraction:destroy'),controller['destroy']);router[_0x8aa8('0x18')]('/:id/tags',auth[_0x8aa8('0xa')](),controller[_0x8aa8('0x19')]);module[_0x8aa8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a47b1c7..e097f7f 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 _0x4bc7=['ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x63e03d,_0x13749e){var _0x39af9b=function(_0x84ec9e){while(--_0x84ec9e){_0x63e03d['push'](_0x63e03d['shift']());}};_0x39af9b(++_0x13749e);}(_0x4bc7,0x10b));var _0x74bc=function(_0x19fb2b,_0x212bd8){_0x19fb2b=_0x19fb2b-0x0;var _0x3be612=_0x4bc7[_0x19fb2b];return _0x3be612;};'use strict';var Sequelize=require(_0x74bc('0x0'));module['exports']={'body':{'type':Sequelize[_0x74bc('0x1')](_0x74bc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x74bc('0x3')]('in',_0x74bc('0x4')),'defaultValue':_0x74bc('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x74bc('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x74bc('0x5')]}}; \ No newline at end of file +var _0x7471=['exports','BOOLEAN','ENUM','out','TEXT','DATE','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7471,0xb5));var _0x1747=function(_0x5f293d,_0x1fb643){_0x5f293d=_0x5f293d-0x0;var _0x38a1aa=_0x7471[_0x5f293d];return _0x38a1aa;};'use strict';var Sequelize=require(_0x1747('0x0'));module[_0x1747('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1747('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1747('0x3')]('in',_0x1747('0x4')),'defaultValue':_0x1747('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1747('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1747('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index baaf8c9..43c8738 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 _0x5223=['read','format','CmContact','Contact','get','UserId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','user','role','stringify','null','AcceptMessage','interface','SIP/%s','event','EventManager','fax-interactions','agent','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','create','findOne','ContactId','fax','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','download','join','files','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','where','merge','options','FaxMessage','findAll','rows','show','params','includeAll','include','find','body','describe','accept'];(function(_0x349ecf,_0x4e0644){var _0x60d8e0=function(_0x3ab6ba){while(--_0x3ab6ba){_0x349ecf['push'](_0x349ecf['shift']());}};_0x60d8e0(++_0x4e0644);}(_0x5223,0x11f));var _0x3522=function(_0x9aad30,_0x4aec1b){_0x9aad30=_0x9aad30-0x0;var _0x1609bb=_0x5223[_0x9aad30];return _0x1609bb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3522('0x0'));var rimraf=require(_0x3522('0x1'));var zipdir=require(_0x3522('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3522('0x3'));var moment=require(_0x3522('0x4'));var BPromise=require(_0x3522('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3522('0x6'));var sox=require(_0x3522('0x7'));var csv=require(_0x3522('0x8'));var ejs=require(_0x3522('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3522('0xa'));var jsforce=require(_0x3522('0xb'));var deskjs=require(_0x3522('0xc'));var toCsv=require(_0x3522('0x8'));var querystring=require('querystring');var Papa=require(_0x3522('0xd'));var Redis=require(_0x3522('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3522('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3522('0x10'));var logger=require(_0x3522('0x11'))(_0x3522('0x12'));var utils=require(_0x3522('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3522('0x14'));var db=require(_0x3522('0x15'))['db'];config[_0x3522('0x16')]=_[_0x3522('0x17')](config[_0x3522('0x16')],{'host':_0x3522('0x18'),'port':0x18eb});var socket=require(_0x3522('0x19'))(new Redis(config[_0x3522('0x16')]));require(_0x3522('0x1a'))[_0x3522('0x1b')](socket);var jayson=require(_0x3522('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3522('0x1d')][_0x3522('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4365f5,_0x5cf5d7,_0x2d3219,_0x48397f){return new BPromise(function(_0x1d2bf1,_0x1e5bb3){var _0x117ffb=_0x48397f||client;return _0x117ffb[_0x3522('0x1f')](_0x4365f5,_0x2d3219)[_0x3522('0x20')](function(_0xd58c57){logger[_0x3522('0x21')](_0x3522('0x22'),_0x5cf5d7,'request\x20sent');logger[_0x3522('0x23')](_0x3522('0x24'),_0x5cf5d7,_0x3522('0x25'),JSON['stringify'](_0xd58c57));if(_0xd58c57[_0x3522('0x26')]){if(_0xd58c57[_0x3522('0x26')][_0x3522('0x27')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5cf5d7,_0xd58c57[_0x3522('0x26')][_0x3522('0x28')]);return _0x1e5bb3(_0xd58c57[_0x3522('0x26')]['message']);}logger[_0x3522('0x26')](_0x3522('0x22'),_0x5cf5d7,_0xd58c57[_0x3522('0x26')][_0x3522('0x28')]);return _0x1d2bf1(_0xd58c57[_0x3522('0x26')][_0x3522('0x28')]);}else{logger[_0x3522('0x21')](_0x3522('0x22'),_0x5cf5d7,'request\x20sent');_0x1d2bf1(_0xd58c57[_0x3522('0x29')][_0x3522('0x28')]);}})[_0x3522('0x2a')](function(_0x54d477){logger[_0x3522('0x26')](_0x3522('0x22'),_0x5cf5d7,_0x54d477);_0x1e5bb3(_0x54d477);});});}function respondWithStatusCode(_0x39dece,_0x562231){_0x562231=_0x562231||0xcc;return function(_0x176d10){if(_0x176d10){return _0x39dece['sendStatus'](_0x562231);}return _0x39dece[_0x3522('0x2b')](_0x562231)[_0x3522('0x2c')]();};}function respondWithResult(_0x2cf81c,_0xeeeb45){_0xeeeb45=_0xeeeb45||0xc8;return function(_0x262445){if(_0x262445){return _0x2cf81c[_0x3522('0x2b')](_0xeeeb45)[_0x3522('0x2d')](_0x262445);}};}function respondWithFilteredResult(_0x3ef62e,_0x44e16d){return function(_0x5715ab){if(_0x5715ab){var _0xbee8d9=_0x5715ab[_0x3522('0x2e')],_0x1aea8f=_0x44e16d[_0x3522('0x2f')],_0x491b65=_0x44e16d['offset']+_0x44e16d['limit'],_0x3187ab;if(_0x491b65>=_0xbee8d9){_0x491b65=_0xbee8d9;_0x3187ab=0xc8;}else{_0x3187ab=0xce;}_0x3ef62e[_0x3522('0x2b')](_0x3187ab);return _0x3ef62e['set'](_0x3522('0x30'),_0x1aea8f+'-'+_0x491b65+'/'+_0xbee8d9)[_0x3522('0x2d')](_0x5715ab);}return null;};}function patchUpdates(_0x9e61bf){return function(_0x286ab5){try{jsonpatch[_0x3522('0x31')](_0x286ab5,_0x9e61bf,!![]);}catch(_0x409e38){return BPromise[_0x3522('0x32')](_0x409e38);}return _0x286ab5[_0x3522('0x33')]();};}function saveUpdates(_0x5f4b0b,_0x299cc3){return function(_0x51c97e){if(_0x51c97e){return _0x51c97e[_0x3522('0x34')](_0x5f4b0b)[_0x3522('0x20')](function(_0x2d927f){return _0x2d927f;});}return null;};}function removeEntity(_0x770ec3,_0x22568f){return function(_0x493065){if(_0x493065){return _0x493065[_0x3522('0x35')]()[_0x3522('0x20')](function(){_0x770ec3['status'](0xcc)[_0x3522('0x2c')]();});}};}function handleEntityNotFound(_0x59cc2e,_0x370c5a){return function(_0x34228f){if(!_0x34228f){_0x59cc2e[_0x3522('0x36')](0x194);}return _0x34228f;};}function handleError(_0x498e54,_0x2bd7dd){_0x2bd7dd=_0x2bd7dd||0x1f4;return function(_0x2f568d){logger[_0x3522('0x26')](_0x2f568d[_0x3522('0x37')]);if(_0x2f568d[_0x3522('0x38')]){delete _0x2f568d['name'];}_0x498e54[_0x3522('0x2b')](_0x2bd7dd)[_0x3522('0x39')](_0x2f568d);};}exports[_0x3522('0x3a')]=function(_0x359221,_0x2be4ac){var _0x1a6ce4={},_0x262e0d={},_0x50f8b4={'count':0x0,'rows':[]};var _0x59ccda=_[_0x3522('0x3b')](db['FaxMessage'][_0x3522('0x3c')],function(_0x4a4064){return{'name':_0x4a4064[_0x3522('0x3d')],'type':_0x4a4064[_0x3522('0x3e')][_0x3522('0x3f')]};});_0x262e0d[_0x3522('0x40')]=_[_0x3522('0x3b')](_0x59ccda,'name');_0x262e0d[_0x3522('0x41')]=_[_0x3522('0x42')](_0x359221['query']);_0x262e0d[_0x3522('0x43')]=_[_0x3522('0x44')](_0x262e0d[_0x3522('0x40')],_0x262e0d[_0x3522('0x41')]);_0x1a6ce4[_0x3522('0x45')]=_[_0x3522('0x44')](_0x262e0d[_0x3522('0x40')],qs[_0x3522('0x46')](_0x359221['query'][_0x3522('0x46')]));_0x1a6ce4['attributes']=_0x1a6ce4[_0x3522('0x45')][_0x3522('0x47')]?_0x1a6ce4[_0x3522('0x45')]:_0x262e0d[_0x3522('0x40')];if(!_0x359221[_0x3522('0x41')][_0x3522('0x48')]('nolimit')){_0x1a6ce4[_0x3522('0x49')]=qs[_0x3522('0x49')](_0x359221[_0x3522('0x41')][_0x3522('0x49')]);_0x1a6ce4[_0x3522('0x2f')]=qs[_0x3522('0x2f')](_0x359221[_0x3522('0x41')][_0x3522('0x2f')]);}_0x1a6ce4[_0x3522('0x4a')]=qs[_0x3522('0x4b')](_0x359221['query']['sort']);_0x1a6ce4['where']=qs[_0x3522('0x43')](_[_0x3522('0x4c')](_0x359221['query'],_0x262e0d[_0x3522('0x43')]),_0x59ccda);if(_0x359221['query']['filter']){_0x1a6ce4[_0x3522('0x4d')]=_[_0x3522('0x4e')](_0x1a6ce4[_0x3522('0x4d')],{'$or':_['map'](_0x59ccda,function(_0x5dd2b5){if(_0x5dd2b5[_0x3522('0x3e')]!=='VIRTUAL'){var _0x12fa07={};_0x12fa07[_0x5dd2b5[_0x3522('0x38')]]={'$like':'%'+_0x359221['query']['filter']+'%'};return _0x12fa07;}})});}_0x1a6ce4=_[_0x3522('0x4e')]({},_0x1a6ce4,_0x359221[_0x3522('0x4f')]);var _0x1fef74={'where':_0x1a6ce4['where']};return db[_0x3522('0x50')]['count'](_0x1fef74)[_0x3522('0x20')](function(_0x260f23){_0x50f8b4[_0x3522('0x2e')]=_0x260f23;if(_0x359221[_0x3522('0x41')]['includeAll']){_0x1a6ce4['include']=[{'all':!![]}];}return db[_0x3522('0x50')][_0x3522('0x51')](_0x1a6ce4);})['then'](function(_0x4ca584){_0x50f8b4[_0x3522('0x52')]=_0x4ca584;return _0x50f8b4;})[_0x3522('0x20')](respondWithFilteredResult(_0x2be4ac,_0x1a6ce4))[_0x3522('0x2a')](handleError(_0x2be4ac,null));};exports[_0x3522('0x53')]=function(_0x37bceb,_0x324a22){var _0x3d07ea={'raw':!![],'where':{'id':_0x37bceb[_0x3522('0x54')]['id']}},_0x33047e={};_0x33047e[_0x3522('0x40')]=_['keys'](db['FaxMessage'][_0x3522('0x3c')]);_0x33047e[_0x3522('0x41')]=_[_0x3522('0x42')](_0x37bceb[_0x3522('0x41')]);_0x33047e['filtears']=_['intersection'](_0x33047e[_0x3522('0x40')],_0x33047e['query']);_0x3d07ea[_0x3522('0x45')]=_[_0x3522('0x44')](_0x33047e['model'],qs[_0x3522('0x46')](_0x37bceb[_0x3522('0x41')][_0x3522('0x46')]));_0x3d07ea['attributes']=_0x3d07ea[_0x3522('0x45')][_0x3522('0x47')]?_0x3d07ea[_0x3522('0x45')]:_0x33047e[_0x3522('0x40')];if(_0x37bceb['query'][_0x3522('0x55')]){_0x3d07ea[_0x3522('0x56')]=[{'all':!![]}];}_0x3d07ea=_[_0x3522('0x4e')]({},_0x3d07ea,_0x37bceb['options']);return db[_0x3522('0x50')][_0x3522('0x57')](_0x3d07ea)[_0x3522('0x20')](handleEntityNotFound(_0x324a22,null))[_0x3522('0x20')](respondWithResult(_0x324a22,null))[_0x3522('0x2a')](handleError(_0x324a22,null));};exports[_0x3522('0x34')]=function(_0x11a805,_0x330dea){if(_0x11a805['body']['id']){delete _0x11a805[_0x3522('0x58')]['id'];}return db[_0x3522('0x50')][_0x3522('0x57')]({'where':{'id':_0x11a805[_0x3522('0x54')]['id']}})[_0x3522('0x20')](handleEntityNotFound(_0x330dea,null))[_0x3522('0x20')](saveUpdates(_0x11a805[_0x3522('0x58')],null))[_0x3522('0x20')](respondWithResult(_0x330dea,null))[_0x3522('0x2a')](handleError(_0x330dea,null));};exports[_0x3522('0x35')]=function(_0x2920b4,_0x4df3be){return db[_0x3522('0x50')][_0x3522('0x57')]({'where':{'id':_0x2920b4[_0x3522('0x54')]['id']}})[_0x3522('0x20')](handleEntityNotFound(_0x4df3be,null))[_0x3522('0x20')](removeEntity(_0x4df3be,null))[_0x3522('0x2a')](handleError(_0x4df3be,null));};exports[_0x3522('0x59')]=function(_0x3aee65,_0x52f267){return db[_0x3522('0x50')][_0x3522('0x59')]()['then'](respondWithResult(_0x52f267,null))[_0x3522('0x2a')](handleError(_0x52f267,null));};var interaction_log=require(_0x3522('0x11'))('fax-interactions');exports[_0x3522('0x5a')]=function(_0x261dcd,_0x51d205,_0x3a9ee2){var _0x53f5e6={'channel':'fax'};if(_0x261dcd[_0x3522('0x58')]['id']){delete _0x261dcd['body']['id'];}_0x261dcd[_0x3522('0x58')][_0x3522('0x5b')]=!![];_0x261dcd[_0x3522('0x58')]['readAt']=moment()[_0x3522('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x261dcd['body']['UserId']=_0x261dcd['body']['UserId']||_0x261dcd['user']['id'];return db[_0x3522('0x50')][_0x3522('0x57')]({'where':{'id':_0x261dcd['params']['id'],'UserId':null},'include':[{'model':db[_0x3522('0x5d')],'as':_0x3522('0x5e')}]})[_0x3522('0x20')](handleEntityNotFound(_0x51d205,null))[_0x3522('0x20')](saveUpdates(_0x261dcd['body'],null))['then'](function(_0x43c5ad){if(_0x43c5ad){_0x53f5e6[_0x3522('0x28')]=_0x43c5ad[_0x3522('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x43c5ad['FaxInteractionId']}});}return null;})[_0x3522('0x20')](handleEntityNotFound(_0x51d205,null))[_0x3522('0x20')](function(_0xeda154){if(_0xeda154){return _0xeda154['update']({'UserId':_0x261dcd[_0x3522('0x58')][_0x3522('0x60')],'read1stAt':_['isNil'](_0xeda154[_0x3522('0x61')])?moment()[_0x3522('0x5c')](_0x3522('0x62')):undefined});}return null;})[_0x3522('0x20')](function(_0x9e78b6){if(_0x9e78b6){_0x53f5e6['interaction']=_0x9e78b6[_0x3522('0x5f')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x261dcd[_0x3522('0x63')]['id'],_0x261dcd[_0x3522('0x63')][_0x3522('0x38')],_0x261dcd[_0x3522('0x63')][_0x3522('0x64')],_0x53f5e6['interaction']['id'],_0x261dcd[_0x3522('0x58')]?JSON[_0x3522('0x65')](_0x261dcd[_0x3522('0x58')]):_0x3522('0x66'));return respondWithRpcPromise(_0x3522('0x67'),'acceptMessage',_0x53f5e6);}return null;})[_0x3522('0x20')](function(_0x25196a){if(_0x25196a){if(_0x261dcd[_0x3522('0x58')]['manual']){_0x53f5e6[_0x3522('0x28')][_0x3522('0x68')]=util['format'](_0x3522('0x69'),_0x261dcd[_0x3522('0x63')][_0x3522('0x38')]);_0x53f5e6[_0x3522('0x28')]['channel']=_0x53f5e6['channel'];_0x53f5e6[_0x3522('0x28')][_0x3522('0x6a')]=_0x3522('0x5a');return respondWithRpcPromise(_0x3522('0x6b'),_0x3522('0x6b'),{'event':'acceptmessage','message':_0x53f5e6[_0x3522('0x28')]},client9002)[_0x3522('0x20')](function(){return _0x53f5e6;});}return _0x53f5e6;}return null;})[_0x3522('0x20')](respondWithResult(_0x51d205,null))[_0x3522('0x2a')](handleError(_0x51d205,null));};var interaction_log=require(_0x3522('0x11'))(_0x3522('0x6c'));exports[_0x3522('0x32')]=function(_0x30d09a,_0x3f41fb,_0xb5740b){var _0x357a5c={'agent':{},'channel':'fax'};if(_0x30d09a[_0x3522('0x58')]['id']){delete _0x30d09a[_0x3522('0x58')]['id'];}_0x30d09a[_0x3522('0x58')][_0x3522('0x60')]=_0x30d09a[_0x3522('0x58')]['UserId']||_0x30d09a[_0x3522('0x63')]['id'];_0x357a5c[_0x3522('0x6d')]['id']=_0x30d09a[_0x3522('0x58')][_0x3522('0x60')];return db[_0x3522('0x50')]['find']({'where':{'id':_0x30d09a[_0x3522('0x54')]['id'],'UserId':null}})[_0x3522('0x20')](handleEntityNotFound(_0x3f41fb,null))[_0x3522('0x20')](function(_0x459b2d){if(_0x459b2d){_0x357a5c[_0x3522('0x28')]=_0x459b2d['get']({'plain':!![]});return db[_0x3522('0x6e')][_0x3522('0x57')]({'where':{'id':_0x459b2d[_0x3522('0x6f')]}});}return null;})[_0x3522('0x20')](handleEntityNotFound(_0x3f41fb,null))['then'](function(_0x5acbbb){if(_0x5acbbb){_0x357a5c[_0x3522('0x70')]=_0x5acbbb[_0x3522('0x5f')]({'plain':!![]});interaction_log[_0x3522('0x21')](_0x3522('0x71'),_0x30d09a['user']['id'],_0x30d09a['user'][_0x3522('0x38')],_0x30d09a[_0x3522('0x63')][_0x3522('0x64')],_0x357a5c['interaction']['id'],_0x30d09a[_0x3522('0x58')]?JSON[_0x3522('0x65')](_0x30d09a[_0x3522('0x58')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x357a5c);}return null;})[_0x3522('0x20')](function(_0x3db36a){if(_0x3db36a){_0x3db36a[_0x3522('0x28')]['interface']=util['format'](_0x3522('0x69'),_0x30d09a[_0x3522('0x63')][_0x3522('0x38')]);_0x3db36a['message']['channel']=_0x357a5c['channel'];_0x3db36a[_0x3522('0x28')][_0x3522('0x6a')]=_0x3522('0x32');respondWithRpcPromise(_0x3522('0x6b'),_0x3522('0x6b'),{'event':'rejectmessage','message':_0x3db36a[_0x3522('0x28')]},client9002);return _0x357a5c;}return null;})['then'](respondWithResult(_0x3f41fb,null))[_0x3522('0x2a')](handleError(_0x3f41fb,null));};exports[_0x3522('0x72')]=function(_0x4f87dd,_0x3d8b8f){var _0x4856b4;return db[_0x3522('0x50')][_0x3522('0x72')](_0x4f87dd[_0x3522('0x58')],{})[_0x3522('0x20')](function(_0x271c47){_0x4856b4=_0x271c47;return db[_0x3522('0x5d')][_0x3522('0x73')]({'where':{'id':_0x4856b4[_0x3522('0x74')]}});})[_0x3522('0x20')](function(_0x531df1){if(_['isNil'](_0x531df1)){return;}else{_0x4856b4[_0x3522('0x75')]=_0x531df1['fax'];return db[_0x3522('0x76')]['findOne']({'where':{'id':_0x4856b4[_0x3522('0x77')]}});}})[_0x3522('0x20')](function(_0x17e19b){return respondWithRpcPromise(_0x3522('0x78'),_0x3522('0x78'),{'FaxAccountId':_[_0x3522('0x79')](_0x4f87dd[_0x3522('0x58')])?undefined:_0x4f87dd[_0x3522('0x58')]['FaxAccountId'],'path':_[_0x3522('0x79')](_0x17e19b)?undefined:util[_0x3522('0x5c')](_0x3522('0x7a'),_0x17e19b['basename']),'fax':_['isNil'](_0x4856b4['fax'])?undefined:_0x4856b4['fax'],'AttachmentId':_0x4856b4[_0x3522('0x77')]},client9002);})[_0x3522('0x20')](respondWithResult(_0x3d8b8f,0xc9))[_0x3522('0x2a')](handleError(_0x3d8b8f,null));};exports[_0x3522('0x7b')]=function(_0x5c4b03,_0x3c16ba){var _0x2d43eb=path[_0x3522('0x7c')](config['root'],'server',_0x3522('0x7d'),'attachments');return db[_0x3522('0x50')][_0x3522('0x57')]({'where':{'id':_0x5c4b03[_0x3522('0x54')]['id']},'include':[{'model':db[_0x3522('0x76')],'as':_0x3522('0x76')}]})[_0x3522('0x20')](handleEntityNotFound(_0x3c16ba,null))['then'](function(_0x28b401){if(_0x28b401){return _0x3c16ba['download'](path['join'](_0x2d43eb,_0x28b401[_0x3522('0x76')]['basename']));}})['catch'](handleError(_0x3c16ba,null));}; \ No newline at end of file +var _0x82aa=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','keys','filtears','include','body','find','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','event','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','server','attachments','join','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x82aa,0xff));var _0xa82a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x82aa[_0x59ee6f];return _0x4c0979;};'use strict';var pdf=require(_0xa82a('0x0'));var emlformat=require(_0xa82a('0x1'));var rimraf=require(_0xa82a('0x2'));var zipdir=require(_0xa82a('0x3'));var jsonpatch=require(_0xa82a('0x4'));var rp=require(_0xa82a('0x5'));var moment=require(_0xa82a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa82a('0x7'));var util=require(_0xa82a('0x8'));var path=require(_0xa82a('0x9'));var sox=require(_0xa82a('0xa'));var csv=require('to-csv');var ejs=require(_0xa82a('0xb'));var fs=require('fs');var _=require(_0xa82a('0xc'));var squel=require(_0xa82a('0xd'));var crypto=require(_0xa82a('0xe'));var jsforce=require(_0xa82a('0xf'));var deskjs=require(_0xa82a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa82a('0x11'));var Redis=require(_0xa82a('0x12'));var authService=require(_0xa82a('0x13'));var qs=require(_0xa82a('0x14'));var as=require(_0xa82a('0x15'));var hardwareService=require(_0xa82a('0x16'));var logger=require(_0xa82a('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa82a('0x18'));var db=require(_0xa82a('0x19'))['db'];config[_0xa82a('0x1a')]=_[_0xa82a('0x1b')](config[_0xa82a('0x1a')],{'host':_0xa82a('0x1c'),'port':0x18eb});var socket=require(_0xa82a('0x1d'))(new Redis(config[_0xa82a('0x1a')]));require(_0xa82a('0x1e'))[_0xa82a('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa82a('0x20')][_0xa82a('0x21')]({'port':0x232c});var client9002=jayson[_0xa82a('0x20')][_0xa82a('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x33297b,_0x3a4980,_0x14b6ce,_0x261c24){return new BPromise(function(_0x142a92,_0x3708aa){var _0x4cb856=_0x261c24||client;return _0x4cb856[_0xa82a('0x22')](_0x33297b,_0x14b6ce)[_0xa82a('0x23')](function(_0x506806){logger[_0xa82a('0x24')](_0xa82a('0x25'),_0x3a4980,_0xa82a('0x26'));logger[_0xa82a('0x27')](_0xa82a('0x28'),_0x3a4980,_0xa82a('0x26'),JSON[_0xa82a('0x29')](_0x506806));if(_0x506806[_0xa82a('0x2a')]){if(_0x506806['error']['code']===0x1f4){logger[_0xa82a('0x2a')](_0xa82a('0x25'),_0x3a4980,_0x506806[_0xa82a('0x2a')]['message']);return _0x3708aa(_0x506806['error'][_0xa82a('0x2b')]);}logger[_0xa82a('0x2a')](_0xa82a('0x25'),_0x3a4980,_0x506806['error']['message']);return _0x142a92(_0x506806[_0xa82a('0x2a')][_0xa82a('0x2b')]);}else{logger[_0xa82a('0x24')]('FaxMessage,\x20%s,\x20%s',_0x3a4980,_0xa82a('0x26'));_0x142a92(_0x506806['result'][_0xa82a('0x2b')]);}})[_0xa82a('0x2c')](function(_0x5b39c4){logger[_0xa82a('0x2a')](_0xa82a('0x25'),_0x3a4980,_0x5b39c4);_0x3708aa(_0x5b39c4);});});}function respondWithStatusCode(_0x131f7b,_0x348d19){_0x348d19=_0x348d19||0xcc;return function(_0x5743e4){if(_0x5743e4){return _0x131f7b[_0xa82a('0x2d')](_0x348d19);}return _0x131f7b['status'](_0x348d19)[_0xa82a('0x2e')]();};}function respondWithResult(_0x118983,_0x1d6934){_0x1d6934=_0x1d6934||0xc8;return function(_0x511237){if(_0x511237){return _0x118983['status'](_0x1d6934)[_0xa82a('0x2f')](_0x511237);}};}function respondWithFilteredResult(_0x687a40,_0x56013d){return function(_0x18d518){if(_0x18d518){var _0x1f1ecf=_0x18d518[_0xa82a('0x30')],_0x5a656f=_0x56013d['offset'],_0x499a56=_0x56013d[_0xa82a('0x31')]+_0x56013d['limit'],_0xbb5dc0;if(_0x499a56>=_0x1f1ecf){_0x499a56=_0x1f1ecf;_0xbb5dc0=0xc8;}else{_0xbb5dc0=0xce;}_0x687a40[_0xa82a('0x32')](_0xbb5dc0);return _0x687a40[_0xa82a('0x33')](_0xa82a('0x34'),_0x5a656f+'-'+_0x499a56+'/'+_0x1f1ecf)[_0xa82a('0x2f')](_0x18d518);}return null;};}function patchUpdates(_0x1478c3){return function(_0x5a1c7e){try{jsonpatch[_0xa82a('0x35')](_0x5a1c7e,_0x1478c3,!![]);}catch(_0x50e4be){return BPromise[_0xa82a('0x36')](_0x50e4be);}return _0x5a1c7e[_0xa82a('0x37')]();};}function saveUpdates(_0x2c7e61,_0x2dfcfd){return function(_0x470382){if(_0x470382){return _0x470382[_0xa82a('0x38')](_0x2c7e61)['then'](function(_0x9776f2){return _0x9776f2;});}return null;};}function removeEntity(_0x12a0fd,_0x1bdc45){return function(_0x5239b1){if(_0x5239b1){return _0x5239b1[_0xa82a('0x39')]()[_0xa82a('0x23')](function(){_0x12a0fd[_0xa82a('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e473,_0x470b3f){return function(_0x38bbd7){if(!_0x38bbd7){_0x56e473[_0xa82a('0x2d')](0x194);}return _0x38bbd7;};}function handleError(_0x4781cc,_0x1ba1a9){_0x1ba1a9=_0x1ba1a9||0x1f4;return function(_0x35985e){logger[_0xa82a('0x2a')](_0x35985e[_0xa82a('0x3a')]);if(_0x35985e[_0xa82a('0x3b')]){delete _0x35985e[_0xa82a('0x3b')];}_0x4781cc[_0xa82a('0x32')](_0x1ba1a9)[_0xa82a('0x3c')](_0x35985e);};}exports[_0xa82a('0x3d')]=function(_0x23ff32,_0x5f19a5){var _0x2b56e8={},_0x52e16d={},_0x2abceb={'count':0x0,'rows':[]};var _0x3e8509=_[_0xa82a('0x3e')](db[_0xa82a('0x3f')][_0xa82a('0x40')],function(_0x199728){return{'name':_0x199728[_0xa82a('0x41')],'type':_0x199728[_0xa82a('0x42')][_0xa82a('0x43')]};});_0x52e16d[_0xa82a('0x44')]=_[_0xa82a('0x3e')](_0x3e8509,_0xa82a('0x3b'));_0x52e16d[_0xa82a('0x45')]=_['keys'](_0x23ff32[_0xa82a('0x45')]);_0x52e16d['filters']=_[_0xa82a('0x46')](_0x52e16d[_0xa82a('0x44')],_0x52e16d[_0xa82a('0x45')]);_0x2b56e8['attributes']=_['intersection'](_0x52e16d['model'],qs[_0xa82a('0x47')](_0x23ff32['query']['fields']));_0x2b56e8[_0xa82a('0x48')]=_0x2b56e8['attributes'][_0xa82a('0x49')]?_0x2b56e8[_0xa82a('0x48')]:_0x52e16d[_0xa82a('0x44')];if(!_0x23ff32['query']['hasOwnProperty'](_0xa82a('0x4a'))){_0x2b56e8['limit']=qs['limit'](_0x23ff32[_0xa82a('0x45')][_0xa82a('0x4b')]);_0x2b56e8[_0xa82a('0x31')]=qs[_0xa82a('0x31')](_0x23ff32['query'][_0xa82a('0x31')]);}_0x2b56e8[_0xa82a('0x4c')]=qs[_0xa82a('0x4d')](_0x23ff32['query'][_0xa82a('0x4d')]);_0x2b56e8[_0xa82a('0x4e')]=qs[_0xa82a('0x4f')](_['pick'](_0x23ff32[_0xa82a('0x45')],_0x52e16d[_0xa82a('0x4f')]),_0x3e8509);if(_0x23ff32[_0xa82a('0x45')][_0xa82a('0x50')]){_0x2b56e8[_0xa82a('0x4e')]=_[_0xa82a('0x51')](_0x2b56e8['where'],{'$or':_[_0xa82a('0x3e')](_0x3e8509,function(_0x257cb3){if(_0x257cb3[_0xa82a('0x42')]!==_0xa82a('0x52')){var _0x502df3={};_0x502df3[_0x257cb3[_0xa82a('0x3b')]]={'$like':'%'+_0x23ff32[_0xa82a('0x45')]['filter']+'%'};return _0x502df3;}})});}_0x2b56e8=_[_0xa82a('0x51')]({},_0x2b56e8,_0x23ff32[_0xa82a('0x53')]);var _0x2378fb={'where':_0x2b56e8[_0xa82a('0x4e')]};return db[_0xa82a('0x3f')]['count'](_0x2378fb)[_0xa82a('0x23')](function(_0x477a21){_0x2abceb[_0xa82a('0x30')]=_0x477a21;if(_0x23ff32[_0xa82a('0x45')][_0xa82a('0x54')]){_0x2b56e8['include']=[{'all':!![]}];}return db[_0xa82a('0x3f')][_0xa82a('0x55')](_0x2b56e8);})['then'](function(_0xd42082){_0x2abceb[_0xa82a('0x56')]=_0xd42082;return _0x2abceb;})['then'](respondWithFilteredResult(_0x5f19a5,_0x2b56e8))['catch'](handleError(_0x5f19a5,null));};exports[_0xa82a('0x57')]=function(_0x4f7027,_0x15b548){var _0x2b0be3={'raw':!![],'where':{'id':_0x4f7027['params']['id']}},_0x2eba52={};_0x2eba52[_0xa82a('0x44')]=_[_0xa82a('0x58')](db['FaxMessage']['rawAttributes']);_0x2eba52[_0xa82a('0x45')]=_['keys'](_0x4f7027['query']);_0x2eba52[_0xa82a('0x59')]=_[_0xa82a('0x46')](_0x2eba52['model'],_0x2eba52[_0xa82a('0x45')]);_0x2b0be3['attributes']=_[_0xa82a('0x46')](_0x2eba52['model'],qs[_0xa82a('0x47')](_0x4f7027[_0xa82a('0x45')][_0xa82a('0x47')]));_0x2b0be3[_0xa82a('0x48')]=_0x2b0be3[_0xa82a('0x48')][_0xa82a('0x49')]?_0x2b0be3[_0xa82a('0x48')]:_0x2eba52[_0xa82a('0x44')];if(_0x4f7027['query']['includeAll']){_0x2b0be3[_0xa82a('0x5a')]=[{'all':!![]}];}_0x2b0be3=_[_0xa82a('0x51')]({},_0x2b0be3,_0x4f7027['options']);return db[_0xa82a('0x3f')]['find'](_0x2b0be3)['then'](handleEntityNotFound(_0x15b548,null))[_0xa82a('0x23')](respondWithResult(_0x15b548,null))[_0xa82a('0x2c')](handleError(_0x15b548,null));};exports[_0xa82a('0x38')]=function(_0x174125,_0x5f545e){if(_0x174125[_0xa82a('0x5b')]['id']){delete _0x174125['body']['id'];}return db[_0xa82a('0x3f')][_0xa82a('0x5c')]({'where':{'id':_0x174125[_0xa82a('0x5d')]['id']}})[_0xa82a('0x23')](handleEntityNotFound(_0x5f545e,null))[_0xa82a('0x23')](saveUpdates(_0x174125[_0xa82a('0x5b')],null))[_0xa82a('0x23')](respondWithResult(_0x5f545e,null))[_0xa82a('0x2c')](handleError(_0x5f545e,null));};exports['destroy']=function(_0xd4a59e,_0x593a45){return db[_0xa82a('0x3f')][_0xa82a('0x5c')]({'where':{'id':_0xd4a59e[_0xa82a('0x5d')]['id']}})[_0xa82a('0x23')](handleEntityNotFound(_0x593a45,null))[_0xa82a('0x23')](removeEntity(_0x593a45,null))[_0xa82a('0x2c')](handleError(_0x593a45,null));};exports[_0xa82a('0x5e')]=function(_0x4c390e,_0x371f96){return db[_0xa82a('0x3f')][_0xa82a('0x5e')]()['then'](respondWithResult(_0x371f96,null))[_0xa82a('0x2c')](handleError(_0x371f96,null));};var interaction_log=require(_0xa82a('0x17'))(_0xa82a('0x5f'));exports[_0xa82a('0x60')]=function(_0x2da37c,_0x65a72e,_0x1cc2b4){var _0x2472d2={'channel':_0xa82a('0x61')};if(_0x2da37c[_0xa82a('0x5b')]['id']){delete _0x2da37c[_0xa82a('0x5b')]['id'];}_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x62')]=!![];_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x63')]=moment()['format'](_0xa82a('0x64'));_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x65')]=_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x65')]||_0x2da37c[_0xa82a('0x66')]['id'];return db['FaxMessage'][_0xa82a('0x5c')]({'where':{'id':_0x2da37c[_0xa82a('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0xa82a('0x67')],'as':_0xa82a('0x68')}]})[_0xa82a('0x23')](handleEntityNotFound(_0x65a72e,null))[_0xa82a('0x23')](saveUpdates(_0x2da37c[_0xa82a('0x5b')],null))['then'](function(_0x5a4e61){if(_0x5a4e61){_0x2472d2[_0xa82a('0x2b')]=_0x5a4e61[_0xa82a('0x69')]({'plain':!![]});return db[_0xa82a('0x6a')]['find']({'where':{'id':_0x5a4e61[_0xa82a('0x6b')]}});}return null;})[_0xa82a('0x23')](handleEntityNotFound(_0x65a72e,null))['then'](function(_0x2ad86e){if(_0x2ad86e){return _0x2ad86e[_0xa82a('0x38')]({'UserId':_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x65')],'read1stAt':_[_0xa82a('0x6c')](_0x2ad86e[_0xa82a('0x6d')])?moment()[_0xa82a('0x6e')](_0xa82a('0x64')):undefined});}return null;})['then'](function(_0x4e4a09){if(_0x4e4a09){_0x2472d2['interaction']=_0x4e4a09[_0xa82a('0x69')]({'plain':!![]});interaction_log[_0xa82a('0x24')](_0xa82a('0x6f'),_0x2da37c[_0xa82a('0x66')]['id'],_0x2da37c[_0xa82a('0x66')]['name'],_0x2da37c[_0xa82a('0x66')][_0xa82a('0x70')],_0x2472d2[_0xa82a('0x71')]['id'],_0x2da37c[_0xa82a('0x5b')]?JSON[_0xa82a('0x29')](_0x2da37c['body']):_0xa82a('0x72'));return respondWithRpcPromise(_0xa82a('0x73'),_0xa82a('0x74'),_0x2472d2);}return null;})[_0xa82a('0x23')](function(_0x4d87a9){if(_0x4d87a9){if(_0x2da37c[_0xa82a('0x5b')][_0xa82a('0x75')]){_0x2472d2[_0xa82a('0x2b')]['interface']=util[_0xa82a('0x6e')](_0xa82a('0x76'),_0x2da37c[_0xa82a('0x66')][_0xa82a('0x3b')]);_0x2472d2[_0xa82a('0x2b')][_0xa82a('0x77')]=_0x2472d2[_0xa82a('0x77')];_0x2472d2[_0xa82a('0x2b')]['event']=_0xa82a('0x60');return respondWithRpcPromise(_0xa82a('0x78'),'EventManager',{'event':'acceptmessage','message':_0x2472d2[_0xa82a('0x2b')]},client9002)[_0xa82a('0x23')](function(){return _0x2472d2;});}return _0x2472d2;}return null;})[_0xa82a('0x23')](respondWithResult(_0x65a72e,null))['catch'](handleError(_0x65a72e,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0xa82a('0x36')]=function(_0x25309f,_0x581367,_0xebc602){var _0x1f3041={'agent':{},'channel':'fax'};if(_0x25309f[_0xa82a('0x5b')]['id']){delete _0x25309f['body']['id'];}_0x25309f[_0xa82a('0x5b')]['UserId']=_0x25309f[_0xa82a('0x5b')][_0xa82a('0x65')]||_0x25309f['user']['id'];_0x1f3041[_0xa82a('0x79')]['id']=_0x25309f[_0xa82a('0x5b')]['UserId'];return db['FaxMessage'][_0xa82a('0x5c')]({'where':{'id':_0x25309f[_0xa82a('0x5d')]['id'],'UserId':null}})[_0xa82a('0x23')](handleEntityNotFound(_0x581367,null))[_0xa82a('0x23')](function(_0x2a6233){if(_0x2a6233){_0x1f3041[_0xa82a('0x2b')]=_0x2a6233[_0xa82a('0x69')]({'plain':!![]});return db[_0xa82a('0x6a')][_0xa82a('0x5c')]({'where':{'id':_0x2a6233['FaxInteractionId']}});}return null;})[_0xa82a('0x23')](handleEntityNotFound(_0x581367,null))[_0xa82a('0x23')](function(_0x2c9b06){if(_0x2c9b06){_0x1f3041[_0xa82a('0x71')]=_0x2c9b06['get']({'plain':!![]});interaction_log['info'](_0xa82a('0x7a'),_0x25309f['user']['id'],_0x25309f['user'][_0xa82a('0x3b')],_0x25309f[_0xa82a('0x66')]['role'],_0x1f3041[_0xa82a('0x71')]['id'],_0x25309f[_0xa82a('0x5b')]?JSON[_0xa82a('0x29')](_0x25309f[_0xa82a('0x5b')]):_0xa82a('0x72'));return respondWithRpcPromise(_0xa82a('0x7b'),'rejectMessage',_0x1f3041);}return null;})[_0xa82a('0x23')](function(_0x5d3c2a){if(_0x5d3c2a){_0x5d3c2a[_0xa82a('0x2b')][_0xa82a('0x7c')]=util[_0xa82a('0x6e')](_0xa82a('0x76'),_0x25309f['user'][_0xa82a('0x3b')]);_0x5d3c2a[_0xa82a('0x2b')][_0xa82a('0x77')]=_0x1f3041['channel'];_0x5d3c2a[_0xa82a('0x2b')][_0xa82a('0x7d')]=_0xa82a('0x36');respondWithRpcPromise(_0xa82a('0x78'),_0xa82a('0x78'),{'event':'rejectmessage','message':_0x5d3c2a['message']},client9002);return _0x1f3041;}return null;})[_0xa82a('0x23')](respondWithResult(_0x581367,null))['catch'](handleError(_0x581367,null));};exports[_0xa82a('0x7e')]=function(_0x38d0c0,_0x3d5c4a){var _0x5cb1c0;return db[_0xa82a('0x3f')]['create'](_0x38d0c0[_0xa82a('0x5b')],{})[_0xa82a('0x23')](function(_0x484e26){_0x5cb1c0=_0x484e26;return db[_0xa82a('0x67')][_0xa82a('0x7f')]({'where':{'id':_0x5cb1c0['ContactId']}});})[_0xa82a('0x23')](function(_0x18657b){if(_[_0xa82a('0x6c')](_0x18657b)){return;}else{_0x5cb1c0[_0xa82a('0x61')]=_0x18657b[_0xa82a('0x61')];return db[_0xa82a('0x80')]['findOne']({'where':{'id':_0x5cb1c0[_0xa82a('0x81')]}});}})[_0xa82a('0x23')](function(_0x3b013d){return respondWithRpcPromise('SendFax',_0xa82a('0x82'),{'FaxAccountId':_[_0xa82a('0x6c')](_0x38d0c0[_0xa82a('0x5b')])?undefined:_0x38d0c0[_0xa82a('0x5b')]['FaxAccountId'],'path':_[_0xa82a('0x6c')](_0x3b013d)?undefined:util['format'](_0xa82a('0x83'),_0x3b013d[_0xa82a('0x84')]),'fax':_[_0xa82a('0x6c')](_0x5cb1c0['fax'])?undefined:_0x5cb1c0[_0xa82a('0x61')],'AttachmentId':_0x5cb1c0[_0xa82a('0x81')]},client9002);})['then'](respondWithResult(_0x3d5c4a,0xc9))[_0xa82a('0x2c')](handleError(_0x3d5c4a,null));};exports[_0xa82a('0x85')]=function(_0x408f63,_0x26bbc9){var _0x279784=path['join'](config['root'],_0xa82a('0x86'),'files',_0xa82a('0x87'));return db['FaxMessage'][_0xa82a('0x5c')]({'where':{'id':_0x408f63[_0xa82a('0x5d')]['id']},'include':[{'model':db[_0xa82a('0x80')],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x26bbc9,null))[_0xa82a('0x23')](function(_0x2f024b){if(_0x2f024b){return _0x26bbc9['download'](path[_0xa82a('0x88')](_0x279784,_0x2f024b[_0xa82a('0x80')][_0xa82a('0x84')]));}})[_0xa82a('0x2c')](handleError(_0x26bbc9,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 44d9178..6e42bea 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x27d71a,_0x336f09){var _0x9c245c=function(_0x593585){while(--_0x593585){_0x27d71a['push'](_0x27d71a['shift']());}};_0x9c245c(++_0x336f09);}(_0x008c,0x188));var _0xc008=function(_0x5ad820,_0x955136){_0x5ad820=_0x5ad820-0x0;var _0x1969d3=_0x008c[_0x5ad820];return _0x1969d3;};'use strict';var EventEmitter=require(_0xc008('0x0'));var FaxMessage=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){FaxMessageEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);FaxMessageEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];FaxMessage[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +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(_0x49d80e,_0x5d4ae7){_0x49d80e=_0x49d80e-0x0;var _0x183a11=_0x3e74[_0x49d80e];return _0x183a11;};'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 diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index a47e51d..faaf15b 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 _0x3cde=['findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','FaxInteraction'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x3cde,0xf9));var _0xe3cd=function(_0x2b5730,_0x2b0e3d){_0x2b5730=_0x2b5730-0x0;var _0x216232=_0x3cde[_0x2b5730];return _0x216232;};'use strict';var _=require(_0xe3cd('0x0'));var util=require(_0xe3cd('0x1'));var logger=require(_0xe3cd('0x2'))(_0xe3cd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe3cd('0x4'));var fs=require('fs');var path=require(_0xe3cd('0x5'));var rimraf=require('rimraf');var config=require(_0xe3cd('0x6'));var attributes=require('./faxMessage.attributes');module[_0xe3cd('0x7')]=function(_0x88b933,_0x324c4f){return _0x88b933[_0xe3cd('0x8')](_0xe3cd('0x9'),attributes,{'tableName':_0xe3cd('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xe3cd('0xb')],'type':_0xe3cd('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x49f427,_0x4b8811,_0x51e437){var _0x4e96fc=_0x88b933[_0xe3cd('0xd')];var _0x323b17=_0x49f427[_0xe3cd('0xe')]({'plain':!![]});if(_0x323b17[_0xe3cd('0xf')][_0xe3cd('0x10')]()==='in'||_0x323b17[_0xe3cd('0xf')][_0xe3cd('0x10')]()===_0xe3cd('0x11')&&!_0x323b17[_0xe3cd('0x12')]&&!_[_0xe3cd('0x13')](_0x323b17['UserId'])){_0x4e96fc[_0xe3cd('0x14')][_0xe3cd('0x15')]({'where':{'id':_0x323b17[_0xe3cd('0x16')]}})[_0xe3cd('0x17')](function(_0x291d4b){if(_0x291d4b){_0x291d4b[_0xe3cd('0x18')]({'lastMsgAt':_0x323b17[_0xe3cd('0x19')],'lastMsgDirection':_0x323b17[_0xe3cd('0xf')][_0xe3cd('0x10')]()});}})[_0xe3cd('0x1a')](function(_0x49a7a2){console[_0xe3cd('0x1b')](_0x49a7a2);});}_0x51e437();}},'charset':_0xe3cd('0x1c'),'collate':_0xe3cd('0x1d')});}; \ No newline at end of file +var _0x0a9a=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4'];(function(_0x47041d,_0x42153f){var _0x5022bd=function(_0x1dbb9a){while(--_0x1dbb9a){_0x47041d['push'](_0x47041d['shift']());}};_0x5022bd(++_0x42153f);}(_0x0a9a,0x16c));var _0xa0a9=function(_0x2bc925,_0x1f4cb1){_0x2bc925=_0x2bc925-0x0;var _0x41be72=_0x0a9a[_0x2bc925];return _0x41be72;};'use strict';var _=require(_0xa0a9('0x0'));var util=require('util');var logger=require(_0xa0a9('0x1'))(_0xa0a9('0x2'));var moment=require('moment');var BPromise=require(_0xa0a9('0x3'));var rp=require(_0xa0a9('0x4'));var fs=require('fs');var path=require(_0xa0a9('0x5'));var rimraf=require(_0xa0a9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa0a9('0x7'));module[_0xa0a9('0x8')]=function(_0x572040,_0x4c4c5e){return _0x572040[_0xa0a9('0x9')](_0xa0a9('0xa'),attributes,{'tableName':_0xa0a9('0xb'),'paranoid':![],'indexes':[{'name':_0xa0a9('0xc'),'fields':[_0xa0a9('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e2535,_0x34cd0a,_0x118f68){var _0x2b7e31=_0x572040['models'];var _0x1a2e21=_0x7e2535[_0xa0a9('0xe')]({'plain':!![]});if(_0x1a2e21[_0xa0a9('0xf')][_0xa0a9('0x10')]()==='in'||_0x1a2e21[_0xa0a9('0xf')]['toLowerCase']()===_0xa0a9('0x11')&&!_0x1a2e21[_0xa0a9('0x12')]&&!_[_0xa0a9('0x13')](_0x1a2e21[_0xa0a9('0x14')])){_0x2b7e31['FaxInteraction'][_0xa0a9('0x15')]({'where':{'id':_0x1a2e21[_0xa0a9('0x16')]}})[_0xa0a9('0x17')](function(_0x5416cf){if(_0x5416cf){_0x5416cf[_0xa0a9('0x18')]({'lastMsgAt':_0x1a2e21[_0xa0a9('0x19')],'lastMsgDirection':_0x1a2e21[_0xa0a9('0xf')]['toLowerCase']()});}})['catch'](function(_0x51b698){console[_0xa0a9('0x1a')](_0x51b698);});}_0x118f68();}},'charset':_0xa0a9('0x1b'),'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 20d06ee..ff670ba 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 _0x40a5=['redis','defaults','socket.io-emitter','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x13dd37,_0x1a62d7){var _0x4018ef=function(_0x24f017){while(--_0x24f017){_0x13dd37['push'](_0x13dd37['shift']());}};_0x4018ef(++_0x1a62d7);}(_0x40a5,0x1ab));var _0x540a=function(_0x5c2e65,_0x20e630){_0x5c2e65=_0x5c2e65-0x0;var _0x445359=_0x40a5[_0x5c2e65];return _0x445359;};'use strict';var _=require('lodash');var util=require(_0x540a('0x0'));var moment=require(_0x540a('0x1'));var BPromise=require(_0x540a('0x2'));var rs=require(_0x540a('0x3'));var fs=require('fs');var Redis=require(_0x540a('0x4'));var db=require(_0x540a('0x5'))['db'];var utils=require(_0x540a('0x6'));var logger=require(_0x540a('0x7'))(_0x540a('0x8'));var config=require(_0x540a('0x9'));var jayson=require(_0x540a('0xa'));var client=jayson[_0x540a('0xb')][_0x540a('0xc')]({'port':0x232a});config[_0x540a('0xd')]=_[_0x540a('0xe')](config[_0x540a('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x540a('0xf'))(new Redis(config['redis']));require(_0x540a('0x10'))[_0x540a('0x11')](socket);function respondWithRpcPromise(_0x415e65,_0x106d35,_0x33f020){return new BPromise(function(_0x10b6a5,_0x509be7){return client['request'](_0x415e65,_0x33f020)[_0x540a('0x12')](function(_0x13a385){logger['info'](_0x540a('0x13'),_0x106d35,_0x540a('0x14'));logger[_0x540a('0x15')](_0x540a('0x16'),_0x106d35,_0x540a('0x14'),JSON[_0x540a('0x17')](_0x13a385));if(_0x13a385['error']){if(_0x13a385[_0x540a('0x18')][_0x540a('0x19')]===0x1f4){logger[_0x540a('0x18')](_0x540a('0x13'),_0x106d35,_0x13a385[_0x540a('0x18')][_0x540a('0x1a')]);return _0x509be7(_0x13a385[_0x540a('0x18')]['message']);}logger[_0x540a('0x18')](_0x540a('0x13'),_0x106d35,_0x13a385[_0x540a('0x18')][_0x540a('0x1a')]);return _0x10b6a5(_0x13a385[_0x540a('0x18')]['message']);}else{logger[_0x540a('0x1b')](_0x540a('0x13'),_0x106d35,_0x540a('0x14'));_0x10b6a5(_0x13a385[_0x540a('0x1c')][_0x540a('0x1a')]);}})[_0x540a('0x1d')](function(_0x3b0b86){logger['error'](_0x540a('0x13'),_0x106d35,_0x3b0b86);_0x509be7(_0x3b0b86);});});}exports[_0x540a('0x1e')]=function(_0x5ba473){var _0x52dd77=this;return new Promise(function(_0x206009,_0x252748){return db[_0x540a('0x1f')][_0x540a('0x20')](_0x5ba473[_0x540a('0x21')],{'raw':_0x5ba473[_0x540a('0x22')]?_0x5ba473[_0x540a('0x22')]['raw']===undefined?!![]:![]:!![]})[_0x540a('0x12')](function(_0x1dffcf){logger[_0x540a('0x1b')](_0x540a('0x1e'),_0x5ba473);logger[_0x540a('0x15')](_0x540a('0x1e'),_0x5ba473,JSON['stringify'](_0x1dffcf));_0x206009(_0x1dffcf);})['catch'](function(_0x454290){logger[_0x540a('0x18')](_0x540a('0x1e'),_0x454290[_0x540a('0x1a')],_0x5ba473);_0x252748(_0x52dd77[_0x540a('0x18')](0x1f4,_0x454290[_0x540a('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x4439cc){var _0x5deaf4=this;return new Promise(function(_0x45dcaf,_0x19ac81){return db[_0x540a('0x1f')]['update'](_0x4439cc[_0x540a('0x21')],{'raw':_0x4439cc['options']?_0x4439cc[_0x540a('0x22')][_0x540a('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4439cc[_0x540a('0x22')]?_0x4439cc[_0x540a('0x22')][_0x540a('0x24')]||null:null,'attributes':_0x4439cc[_0x540a('0x22')]?_0x4439cc[_0x540a('0x22')][_0x540a('0x25')]||null:null,'limit':_0x4439cc[_0x540a('0x22')]?_0x4439cc[_0x540a('0x22')][_0x540a('0x26')]||null:null})[_0x540a('0x12')](function(_0x4b7646){logger[_0x540a('0x1b')]('UpdateFaxMessage',_0x4439cc);logger[_0x540a('0x15')]('UpdateFaxMessage',_0x4439cc,JSON[_0x540a('0x17')](_0x4b7646));_0x45dcaf(_0x4b7646);})['catch'](function(_0x3235ab){logger[_0x540a('0x18')](_0x540a('0x27'),_0x3235ab[_0x540a('0x1a')],_0x4439cc);_0x19ac81(_0x5deaf4[_0x540a('0x18')](0x1f4,_0x3235ab[_0x540a('0x1a')]));});});}; \ No newline at end of file +var _0xfcba=['raw','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','request','then','request\x20sent','debug','error','FaxMessage,\x20%s,\x20%s','message','info','result','catch','FaxMessage','create','body','options'];(function(_0x7d9bdc,_0xa84069){var _0x54860f=function(_0x2afb93){while(--_0x2afb93){_0x7d9bdc['push'](_0x7d9bdc['shift']());}};_0x54860f(++_0xa84069);}(_0xfcba,0x116));var _0xafcb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfcba[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xafcb('0x0'));var util=require(_0xafcb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafcb('0x2'));var db=require(_0xafcb('0x3'))['db'];var utils=require(_0xafcb('0x4'));var logger=require(_0xafcb('0x5'))(_0xafcb('0x6'));var config=require(_0xafcb('0x7'));var jayson=require(_0xafcb('0x8'));var client=jayson[_0xafcb('0x9')]['http']({'port':0x232a});config[_0xafcb('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xafcb('0xb'))(new Redis(config[_0xafcb('0xa')]));require(_0xafcb('0xc'))[_0xafcb('0xd')](socket);function respondWithRpcPromise(_0x2f7902,_0xbde155,_0x21a770){return new BPromise(function(_0x4d1064,_0x36173a){return client[_0xafcb('0xe')](_0x2f7902,_0x21a770)[_0xafcb('0xf')](function(_0x25dbbd){logger['info']('FaxMessage,\x20%s,\x20%s',_0xbde155,_0xafcb('0x10'));logger[_0xafcb('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0xbde155,_0xafcb('0x10'),JSON['stringify'](_0x25dbbd));if(_0x25dbbd[_0xafcb('0x12')]){if(_0x25dbbd['error']['code']===0x1f4){logger[_0xafcb('0x12')](_0xafcb('0x13'),_0xbde155,_0x25dbbd[_0xafcb('0x12')][_0xafcb('0x14')]);return _0x36173a(_0x25dbbd[_0xafcb('0x12')]['message']);}logger['error'](_0xafcb('0x13'),_0xbde155,_0x25dbbd[_0xafcb('0x12')][_0xafcb('0x14')]);return _0x4d1064(_0x25dbbd[_0xafcb('0x12')][_0xafcb('0x14')]);}else{logger[_0xafcb('0x15')](_0xafcb('0x13'),_0xbde155,_0xafcb('0x10'));_0x4d1064(_0x25dbbd[_0xafcb('0x16')][_0xafcb('0x14')]);}})[_0xafcb('0x17')](function(_0x40f819){logger[_0xafcb('0x12')]('FaxMessage,\x20%s,\x20%s',_0xbde155,_0x40f819);_0x36173a(_0x40f819);});});}exports['CreateFaxMessage']=function(_0xb05887){var _0x3ba233=this;return new Promise(function(_0x4acf4e,_0x539306){return db[_0xafcb('0x18')][_0xafcb('0x19')](_0xb05887[_0xafcb('0x1a')],{'raw':_0xb05887[_0xafcb('0x1b')]?_0xb05887[_0xafcb('0x1b')][_0xafcb('0x1c')]===undefined?!![]:![]:!![]})[_0xafcb('0xf')](function(_0x3e48ea){logger[_0xafcb('0x15')](_0xafcb('0x1d'),_0xb05887);logger['debug'](_0xafcb('0x1d'),_0xb05887,JSON['stringify'](_0x3e48ea));_0x4acf4e(_0x3e48ea);})['catch'](function(_0x470dd5){logger[_0xafcb('0x12')](_0xafcb('0x1d'),_0x470dd5[_0xafcb('0x14')],_0xb05887);_0x539306(_0x3ba233[_0xafcb('0x12')](0x1f4,_0x470dd5[_0xafcb('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x471782){var _0xd6e4d9=this;return new Promise(function(_0x3a2c6b,_0x46c963){return db[_0xafcb('0x18')]['update'](_0x471782['body'],{'raw':_0x471782[_0xafcb('0x1b')]?_0x471782[_0xafcb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x471782['options']?_0x471782[_0xafcb('0x1b')]['where']||null:null,'attributes':_0x471782[_0xafcb('0x1b')]?_0x471782['options'][_0xafcb('0x1e')]||null:null,'limit':_0x471782[_0xafcb('0x1b')]?_0x471782[_0xafcb('0x1b')][_0xafcb('0x1f')]||null:null})['then'](function(_0x515776){logger['info'](_0xafcb('0x20'),_0x471782);logger['debug'](_0xafcb('0x20'),_0x471782,JSON[_0xafcb('0x21')](_0x515776));_0x3a2c6b(_0x515776);})[_0xafcb('0x17')](function(_0x485c1d){logger['error'](_0xafcb('0x20'),_0x485c1d['message'],_0x471782);_0x46c963(_0xd6e4d9[_0xafcb('0x12')](0x1f4,_0x485c1d[_0xafcb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 1c5ae45..67ed7f3 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(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index e44a876..974f22e 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 _0x7044=['reject','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','index','describe','get','/:id','/:id/download','download','post','tracked','fax','create','put','update','accept','/:id/reject'];(function(_0x50abc4,_0x558d64){var _0x5a745d=function(_0x4e835b){while(--_0x4e835b){_0x50abc4['push'](_0x50abc4['shift']());}};_0x5a745d(++_0x558d64);}(_0x7044,0x147));var _0x4704=function(_0x4ee66a,_0x14b107){_0x4ee66a=_0x4ee66a-0x0;var _0x1babb5=_0x7044[_0x4ee66a];return _0x1babb5;};'use strict';var multer=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var path=require(_0x4704('0x2'));var timeout=require('connect-timeout');var express=require(_0x4704('0x3'));var router=express[_0x4704('0x4')]();var auth=require(_0x4704('0x5'));var interaction=require(_0x4704('0x6'));var config=require('../../config/environment');var controller=require(_0x4704('0x7'));router['get']('/',auth[_0x4704('0x8')](),controller[_0x4704('0x9')]);router['get']('/describe',auth[_0x4704('0x8')](),controller[_0x4704('0xa')]);router[_0x4704('0xb')](_0x4704('0xc'),auth[_0x4704('0x8')](),controller['show']);router['get'](_0x4704('0xd'),auth['isAuthenticated'](),controller[_0x4704('0xe')]);router[_0x4704('0xf')]('/',auth[_0x4704('0x8')](),interaction[_0x4704('0x10')](_0x4704('0x11'),'faxmessage:create'),controller[_0x4704('0x12')]);router[_0x4704('0x13')](_0x4704('0xc'),auth[_0x4704('0x8')](),controller[_0x4704('0x14')]);router[_0x4704('0x13')]('/:id/accept',auth[_0x4704('0x8')](),controller[_0x4704('0x15')]);router[_0x4704('0x13')](_0x4704('0x16'),auth[_0x4704('0x8')](),controller[_0x4704('0x17')]);router[_0x4704('0x18')](_0x4704('0xc'),auth[_0x4704('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4941=['accept','reject','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','put','/:id/accept'];(function(_0x27087a,_0x1dc580){var _0x45b4e8=function(_0x22a655){while(--_0x22a655){_0x27087a['push'](_0x27087a['shift']());}};_0x45b4e8(++_0x1dc580);}(_0x4941,0x9a));var _0x1494=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x4941[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0x1494('0x0'));var util=require(_0x1494('0x1'));var path=require(_0x1494('0x2'));var timeout=require(_0x1494('0x3'));var express=require(_0x1494('0x4'));var router=express['Router']();var auth=require(_0x1494('0x5'));var interaction=require(_0x1494('0x6'));var config=require(_0x1494('0x7'));var controller=require('./faxMessage.controller');router[_0x1494('0x8')]('/',auth[_0x1494('0x9')](),controller[_0x1494('0xa')]);router[_0x1494('0x8')](_0x1494('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x1494('0x8')](_0x1494('0xc'),auth['isAuthenticated'](),controller[_0x1494('0xd')]);router['get'](_0x1494('0xe'),auth[_0x1494('0x9')](),controller[_0x1494('0xf')]);router[_0x1494('0x10')]('/',auth[_0x1494('0x9')](),interaction[_0x1494('0x11')]('fax',_0x1494('0x12')),controller['create']);router[_0x1494('0x13')](_0x1494('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x1494('0x13')](_0x1494('0x14'),auth[_0x1494('0x9')](),controller[_0x1494('0x15')]);router[_0x1494('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x1494('0x16')]);router['delete']('/:id',auth[_0x1494('0x9')](),controller[_0x1494('0x17')]);module[_0x1494('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 a3bb32a..d5d5318 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 _0xbb1e=['exports','STRING','name','ENUM','roundrobin','INTEGER'];(function(_0x5f16d4,_0x58eb6e){var _0x341952=function(_0x1bf70e){while(--_0x1bf70e){_0x5f16d4['push'](_0x5f16d4['shift']());}};_0x341952(++_0x58eb6e);}(_0xbb1e,0x90));var _0xebb1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbb1e[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0xebb1('0x0')]={'name':{'type':Sequelize[_0xebb1('0x1')],'unique':_0xebb1('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xebb1('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xebb1('0x3')]('rrmemory','beepall',_0xebb1('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xebb1('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x13ad=['rrmemory','roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13ad,0x142));var _0xd13a=function(_0x4ebb60,_0x28d3bf){_0x4ebb60=_0x4ebb60-0x0;var _0x482d90=_0x13ad[_0x4ebb60];return _0x482d90;};'use strict';var Sequelize=require(_0xd13a('0x0'));module[_0xd13a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd13a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd13a('0x3')]},'timeout':{'type':Sequelize[_0xd13a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd13a('0x5')](_0xd13a('0x6'),'beepall',_0xd13a('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd13a('0x4')],'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 bfd6a04..1d68165 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 _0x7d15=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','filtears','length','catch','create','user','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','agent','updatedAt','format','SIP','getTeams','addTeams','ids','Team','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','every','TeamId','all','union','value','removeAgents','addAgents','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','count','offset','set','apply','save','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d15,0x1d1));var _0x57d1=function(_0x4eb4af,_0x4c81eb){_0x4eb4af=_0x4eb4af-0x0;var _0x3558f4=_0x7d15[_0x4eb4af];return _0x3558f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x57d1('0x0'));var rimraf=require(_0x57d1('0x1'));var zipdir=require(_0x57d1('0x2'));var jsonpatch=require(_0x57d1('0x3'));var rp=require('request-promise');var moment=require(_0x57d1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57d1('0x5'));var util=require(_0x57d1('0x6'));var path=require(_0x57d1('0x7'));var sox=require(_0x57d1('0x8'));var csv=require(_0x57d1('0x9'));var ejs=require(_0x57d1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x57d1('0xb'));var crypto=require(_0x57d1('0xc'));var jsforce=require(_0x57d1('0xd'));var deskjs=require(_0x57d1('0xe'));var toCsv=require(_0x57d1('0x9'));var querystring=require(_0x57d1('0xf'));var Papa=require(_0x57d1('0x10'));var Redis=require(_0x57d1('0x11'));var authService=require(_0x57d1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57d1('0x13'));var logger=require(_0x57d1('0x14'))('api');var utils=require(_0x57d1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x57d1('0x16'));var db=require(_0x57d1('0x17'))['db'];config[_0x57d1('0x18')]=_[_0x57d1('0x19')](config[_0x57d1('0x18')],{'host':_0x57d1('0x1a'),'port':0x18eb});var socket=require(_0x57d1('0x1b'))(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithStatusCode(_0x50f55f,_0x5c1b26){_0x5c1b26=_0x5c1b26||0xcc;return function(_0x2a2d72){if(_0x2a2d72){return _0x50f55f['sendStatus'](_0x5c1b26);}return _0x50f55f[_0x57d1('0x1c')](_0x5c1b26)[_0x57d1('0x1d')]();};}function respondWithResult(_0x561383,_0x3da1aa){_0x3da1aa=_0x3da1aa||0xc8;return function(_0x3f7d09){if(_0x3f7d09){return _0x561383['status'](_0x3da1aa)[_0x57d1('0x1e')](_0x3f7d09);}};}function respondWithFilteredResult(_0x402ccb,_0x303f7b){return function(_0x4b9a23){if(_0x4b9a23){var _0x411395=_0x4b9a23[_0x57d1('0x1f')],_0x39e18b=_0x303f7b[_0x57d1('0x20')],_0x22d85b=_0x303f7b[_0x57d1('0x20')]+_0x303f7b['limit'],_0x3ae890;if(_0x22d85b>=_0x411395){_0x22d85b=_0x411395;_0x3ae890=0xc8;}else{_0x3ae890=0xce;}_0x402ccb['status'](_0x3ae890);return _0x402ccb[_0x57d1('0x21')]('Content-Range',_0x39e18b+'-'+_0x22d85b+'/'+_0x411395)[_0x57d1('0x1e')](_0x4b9a23);}return null;};}function patchUpdates(_0x4a5377){return function(_0x433171){try{jsonpatch[_0x57d1('0x22')](_0x433171,_0x4a5377,!![]);}catch(_0xeb48ca){return BPromise['reject'](_0xeb48ca);}return _0x433171[_0x57d1('0x23')]();};}function saveUpdates(_0x34775b,_0x47db68){return function(_0x4d3002){if(_0x4d3002){return _0x4d3002['update'](_0x34775b)[_0x57d1('0x24')](function(_0x55c388){return _0x55c388;});}return null;};}function removeEntity(_0x5ccdeb,_0x498dfe){return function(_0x471f5b){if(_0x471f5b){return _0x471f5b[_0x57d1('0x25')]()['then'](function(){var _0x8f452a=_0x471f5b[_0x57d1('0x26')]({'plain':!![]});var _0x2d7a1c=_0x57d1('0x27');return db[_0x57d1('0x28')][_0x57d1('0x25')]({'where':{'type':_0x2d7a1c,'resourceId':_0x8f452a['id']}})[_0x57d1('0x24')](function(){return _0x471f5b;});})[_0x57d1('0x24')](function(){_0x5ccdeb['status'](0xcc)[_0x57d1('0x1d')]();});}};}function handleEntityNotFound(_0x4c000d,_0x2cfa7f){return function(_0x24ffc1){if(!_0x24ffc1){_0x4c000d[_0x57d1('0x29')](0x194);}return _0x24ffc1;};}function handleError(_0x3ba0fe,_0x39db43){_0x39db43=_0x39db43||0x1f4;return function(_0x5d4907){logger['error'](_0x5d4907['stack']);if(_0x5d4907['name']){delete _0x5d4907[_0x57d1('0x2a')];}_0x3ba0fe['status'](_0x39db43)[_0x57d1('0x2b')](_0x5d4907);};}exports[_0x57d1('0x2c')]=function(_0x2db993,_0x284d32){var _0x37292b={},_0x57f67e={},_0x29ad4d={'count':0x0,'rows':[]};var _0x4e92e6=_[_0x57d1('0x2d')](db[_0x57d1('0x2e')][_0x57d1('0x2f')],function(_0x3ce8e0){return{'name':_0x3ce8e0[_0x57d1('0x30')],'type':_0x3ce8e0[_0x57d1('0x31')]['key']};});_0x57f67e[_0x57d1('0x32')]=_[_0x57d1('0x2d')](_0x4e92e6,_0x57d1('0x2a'));_0x57f67e[_0x57d1('0x33')]=_[_0x57d1('0x34')](_0x2db993['query']);_0x57f67e['filters']=_[_0x57d1('0x35')](_0x57f67e[_0x57d1('0x32')],_0x57f67e[_0x57d1('0x33')]);_0x37292b['attributes']=_[_0x57d1('0x35')](_0x57f67e[_0x57d1('0x32')],qs['fields'](_0x2db993[_0x57d1('0x33')][_0x57d1('0x36')]));_0x37292b['attributes']=_0x37292b[_0x57d1('0x37')]['length']?_0x37292b[_0x57d1('0x37')]:_0x57f67e[_0x57d1('0x32')];if(!_0x2db993['query'][_0x57d1('0x38')](_0x57d1('0x39'))){_0x37292b[_0x57d1('0x3a')]=qs[_0x57d1('0x3a')](_0x2db993[_0x57d1('0x33')][_0x57d1('0x3a')]);_0x37292b[_0x57d1('0x20')]=qs[_0x57d1('0x20')](_0x2db993[_0x57d1('0x33')]['offset']);}_0x37292b[_0x57d1('0x3b')]=qs['sort'](_0x2db993[_0x57d1('0x33')][_0x57d1('0x3c')]);_0x37292b[_0x57d1('0x3d')]=qs[_0x57d1('0x3e')](_[_0x57d1('0x3f')](_0x2db993['query'],_0x57f67e[_0x57d1('0x3e')]),_0x4e92e6);if(_0x2db993[_0x57d1('0x33')][_0x57d1('0x40')]){_0x37292b[_0x57d1('0x3d')]=_[_0x57d1('0x41')](_0x37292b['where'],{'$or':_['map'](_0x4e92e6,function(_0xbb0f24){if(_0xbb0f24[_0x57d1('0x31')]!==_0x57d1('0x42')){var _0x3d3524={};_0x3d3524[_0xbb0f24['name']]={'$like':'%'+_0x2db993[_0x57d1('0x33')][_0x57d1('0x40')]+'%'};return _0x3d3524;}})});}_0x37292b=_['merge']({},_0x37292b,_0x2db993[_0x57d1('0x43')]);var _0x5f08e9={'where':_0x37292b['where']};return db[_0x57d1('0x2e')]['count'](_0x5f08e9)['then'](function(_0x119beb){_0x29ad4d['count']=_0x119beb;if(_0x2db993[_0x57d1('0x33')][_0x57d1('0x44')]){_0x37292b[_0x57d1('0x45')]=[{'all':!![]}];}return db[_0x57d1('0x2e')][_0x57d1('0x46')](_0x37292b);})[_0x57d1('0x24')](function(_0x14d999){_0x29ad4d[_0x57d1('0x47')]=_0x14d999;return _0x29ad4d;})['then'](respondWithFilteredResult(_0x284d32,_0x37292b))['catch'](handleError(_0x284d32,null));};exports[_0x57d1('0x48')]=function(_0x20fd14,_0x5e41ed){var _0x598357={'raw':!![],'where':{'id':_0x20fd14[_0x57d1('0x49')]['id']}},_0x59ee31={};_0x59ee31[_0x57d1('0x32')]=_[_0x57d1('0x34')](db[_0x57d1('0x2e')][_0x57d1('0x2f')]);_0x59ee31[_0x57d1('0x33')]=_['keys'](_0x20fd14[_0x57d1('0x33')]);_0x59ee31[_0x57d1('0x4a')]=_[_0x57d1('0x35')](_0x59ee31['model'],_0x59ee31['query']);_0x598357[_0x57d1('0x37')]=_[_0x57d1('0x35')](_0x59ee31['model'],qs['fields'](_0x20fd14[_0x57d1('0x33')][_0x57d1('0x36')]));_0x598357['attributes']=_0x598357[_0x57d1('0x37')][_0x57d1('0x4b')]?_0x598357['attributes']:_0x59ee31[_0x57d1('0x32')];if(_0x20fd14[_0x57d1('0x33')][_0x57d1('0x44')]){_0x598357[_0x57d1('0x45')]=[{'all':!![]}];}_0x598357=_[_0x57d1('0x41')]({},_0x598357,_0x20fd14[_0x57d1('0x43')]);return db[_0x57d1('0x2e')]['find'](_0x598357)['then'](handleEntityNotFound(_0x5e41ed,null))['then'](respondWithResult(_0x5e41ed,null))[_0x57d1('0x4c')](handleError(_0x5e41ed,null));};exports[_0x57d1('0x4d')]=function(_0x19b202,_0x15b50d){return db['FaxQueue'][_0x57d1('0x4d')](_0x19b202['body'],{})[_0x57d1('0x24')](function(_0x4e4c25){var _0x217dcd=_0x19b202[_0x57d1('0x4e')][_0x57d1('0x26')]({'plain':!![]});if(!_0x217dcd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x217dcd['role']===_0x57d1('0x4e')){var _0x438caf=_0x4e4c25[_0x57d1('0x26')]({'plain':!![]});var _0x2c5d45=_0x57d1('0x27');return db[_0x57d1('0x4f')][_0x57d1('0x50')]({'where':{'name':_0x2c5d45,'userProfileId':_0x217dcd[_0x57d1('0x51')]},'raw':!![]})[_0x57d1('0x24')](function(_0x2d54bf){if(_0x2d54bf&&_0x2d54bf['autoAssociation']===0x0){return db[_0x57d1('0x28')][_0x57d1('0x4d')]({'name':_0x438caf[_0x57d1('0x2a')],'resourceId':_0x438caf['id'],'type':_0x2d54bf['name'],'sectionId':_0x2d54bf['id']},{})['then'](function(){return _0x4e4c25;});}else{return _0x4e4c25;}})[_0x57d1('0x4c')](function(_0x5a4c27){logger[_0x57d1('0x52')](_0x57d1('0x53'),_0x5a4c27);throw _0x5a4c27;});}return _0x4e4c25;})['then'](respondWithResult(_0x15b50d,0xc9))['catch'](handleError(_0x15b50d,null));};exports[_0x57d1('0x54')]=function(_0x35c666,_0x2639f3){if(_0x35c666[_0x57d1('0x55')]['id']){delete _0x35c666[_0x57d1('0x55')]['id'];}return db['FaxQueue'][_0x57d1('0x50')]({'where':{'id':_0x35c666[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x2639f3,null))['then'](saveUpdates(_0x35c666['body'],null))[_0x57d1('0x24')](respondWithResult(_0x2639f3,null))[_0x57d1('0x4c')](handleError(_0x2639f3,null));};exports[_0x57d1('0x25')]=function(_0x23e463,_0x24c6a6){return db[_0x57d1('0x2e')][_0x57d1('0x50')]({'where':{'id':_0x23e463['params']['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x24c6a6,null))[_0x57d1('0x24')](removeEntity(_0x24c6a6,null))[_0x57d1('0x4c')](handleError(_0x24c6a6,null));};exports['describe']=function(_0x194fff,_0x280317){return db[_0x57d1('0x2e')][_0x57d1('0x56')]()['then'](respondWithResult(_0x280317,null))[_0x57d1('0x4c')](handleError(_0x280317,null));};exports[_0x57d1('0x57')]=function(_0x158580,_0x156e96,_0x225913){var _0x384491={'raw':!![],'where':{}},_0x3af22c={},_0x53e09d;return db['FaxQueue'][_0x57d1('0x58')]({'where':{'id':_0x158580[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x156e96,null))[_0x57d1('0x24')](function(_0x279cbb){if(_0x279cbb){_0x53e09d=_0x279cbb['get']({'plain':!![]});_0x3af22c[_0x57d1('0x32')]=_[_0x57d1('0x34')](db[_0x57d1('0x59')][_0x57d1('0x2f')]);_0x3af22c[_0x57d1('0x33')]=_[_0x57d1('0x34')](_0x158580['query']);_0x3af22c['filters']=_[_0x57d1('0x35')](_0x3af22c['model'],_0x3af22c[_0x57d1('0x33')]);_0x384491[_0x57d1('0x37')]=_[_0x57d1('0x35')](_0x3af22c[_0x57d1('0x32')],qs[_0x57d1('0x36')](_0x158580[_0x57d1('0x33')][_0x57d1('0x36')]));_0x384491[_0x57d1('0x37')]=_0x384491[_0x57d1('0x37')][_0x57d1('0x4b')]?_0x384491['attributes']:_0x3af22c['model'];if(!_0x158580[_0x57d1('0x33')][_0x57d1('0x38')]('nolimit')){_0x384491[_0x57d1('0x3a')]=qs[_0x57d1('0x3a')](_0x158580[_0x57d1('0x33')][_0x57d1('0x3a')]);_0x384491[_0x57d1('0x20')]=qs[_0x57d1('0x20')](_0x158580[_0x57d1('0x33')]['offset']);}_0x384491[_0x57d1('0x3b')]=qs[_0x57d1('0x3c')](_0x158580[_0x57d1('0x33')]['sort']);_0x384491[_0x57d1('0x3d')]=qs[_0x57d1('0x3e')](_[_0x57d1('0x3f')](_0x158580[_0x57d1('0x33')],_0x3af22c['filters']));_0x384491[_0x57d1('0x3d')][_0x57d1('0x5a')]=_0x279cbb['id'];if(_0x158580['query'][_0x57d1('0x40')]){_0x384491[_0x57d1('0x3d')]=_[_0x57d1('0x41')](_0x384491['where'],{'$or':_['map'](_0x384491[_0x57d1('0x37')],function(_0x2e0c4f){var _0x57417f={};_0x57417f[_0x2e0c4f]={'$like':'%'+_0x158580['query']['filter']+'%'};return _0x57417f;})});}_0x384491=_[_0x57d1('0x41')]({},_0x384491,_0x158580[_0x57d1('0x43')]);return db['UserFaxQueue'][_0x57d1('0x46')](_0x384491);}})[_0x57d1('0x24')](function(_0x5d7d84){if(_0x5d7d84){return db['User']['findAndCountAll']({'where':{'id':_[_0x57d1('0x2d')](_0x5d7d84,'UserId'),'role':_0x57d1('0x5b')},'attributes':['id',_0x57d1('0x2a'),'faxPause',_0x57d1('0x5c'),'createdAt']});}})['then'](function(_0x2d32d3){if(_0x2d32d3){return{'count':_0x2d32d3['count'],'rows':_[_0x57d1('0x2d')](_0x2d32d3[_0x57d1('0x47')],function(_0x333861){return{'membername':_0x333861[_0x57d1('0x2a')],'UserId':_0x333861['id'],'queue_name':_0x53e09d[_0x57d1('0x2a')],'FaxQueueId':_0x53e09d['id'],'interface':util[_0x57d1('0x5d')]('%s/%s',_0x57d1('0x5e'),_0x333861['name']),'penalty':0x0,'paused':_0x333861['faxPause'],'createdAt':_0x333861['createdAt'],'updatedAt':_0x333861[_0x57d1('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x57d1('0x24')](respondWithFilteredResult(_0x156e96,_0x384491))[_0x57d1('0x4c')](handleError(_0x156e96,null));};exports[_0x57d1('0x5f')]=function(_0xa588e1,_0xb765b9,_0x2cbaae){var _0x355fcc={};var _0x4c5d9b={};var _0x482086;var _0x485ef0;return db[_0x57d1('0x2e')][_0x57d1('0x58')]({'where':{'id':_0xa588e1[_0x57d1('0x49')]['id']}})['then'](handleEntityNotFound(_0xb765b9,null))[_0x57d1('0x24')](function(_0x56e52a){if(_0x56e52a){_0x482086=_0x56e52a;_0x4c5d9b[_0x57d1('0x32')]=_[_0x57d1('0x34')](db['Team']['rawAttributes']);_0x4c5d9b[_0x57d1('0x33')]=_[_0x57d1('0x34')](_0xa588e1[_0x57d1('0x33')]);_0x4c5d9b[_0x57d1('0x3e')]=_[_0x57d1('0x35')](_0x4c5d9b[_0x57d1('0x32')],_0x4c5d9b['query']);_0x355fcc['attributes']=_[_0x57d1('0x35')](_0x4c5d9b[_0x57d1('0x32')],qs['fields'](_0xa588e1[_0x57d1('0x33')][_0x57d1('0x36')]));_0x355fcc[_0x57d1('0x37')]=_0x355fcc[_0x57d1('0x37')][_0x57d1('0x4b')]?_0x355fcc['attributes']:_0x4c5d9b[_0x57d1('0x32')];_0x355fcc[_0x57d1('0x3b')]=qs[_0x57d1('0x3c')](_0xa588e1[_0x57d1('0x33')][_0x57d1('0x3c')]);_0x355fcc[_0x57d1('0x3d')]=qs['filters'](_['pick'](_0xa588e1[_0x57d1('0x33')],_0x4c5d9b[_0x57d1('0x3e')]));if(_0xa588e1[_0x57d1('0x33')][_0x57d1('0x40')]){_0x355fcc[_0x57d1('0x3d')]=_[_0x57d1('0x41')](_0x355fcc[_0x57d1('0x3d')],{'$or':_['map'](_0x355fcc[_0x57d1('0x37')],function(_0x19d074){var _0x5e03e2={};_0x5e03e2[_0x19d074]={'$like':'%'+_0xa588e1['query'][_0x57d1('0x40')]+'%'};return _0x5e03e2;})});}_0x355fcc=_[_0x57d1('0x41')]({},_0x355fcc,_0xa588e1[_0x57d1('0x43')]);return _0x482086[_0x57d1('0x5f')](_0x355fcc);}})['then'](function(_0x32e440){if(_0x32e440){_0x485ef0=_0x32e440[_0x57d1('0x4b')];if(!_0xa588e1[_0x57d1('0x33')][_0x57d1('0x38')](_0x57d1('0x39'))){_0x355fcc[_0x57d1('0x3a')]=qs['limit'](_0xa588e1['query']['limit']);_0x355fcc['offset']=qs[_0x57d1('0x20')](_0xa588e1[_0x57d1('0x33')][_0x57d1('0x20')]);}return _0x482086['getTeams'](_0x355fcc);}})[_0x57d1('0x24')](function(_0x38ac66){if(_0x38ac66){return _0x38ac66?{'count':_0x485ef0,'rows':_0x38ac66}:null;}})['then'](respondWithResult(_0xb765b9,null))[_0x57d1('0x4c')](handleError(_0xb765b9,null));};exports[_0x57d1('0x60')]=function(_0x281322,_0x53c354,_0x349423){var _0x3f40a3=_0x281322[_0x57d1('0x55')][_0x57d1('0x61')];return db[_0x57d1('0x62')]['findAll']({'where':{'id':_0x3f40a3},'attributes':['id'],'include':[{'model':db[_0x57d1('0x63')],'as':_0x57d1('0x64'),'attributes':['id',_0x57d1('0x2a'),'online',_0x57d1('0x65'),_0x57d1('0x66')],'raw':!![]}]})[_0x57d1('0x24')](function(_0x2a88af){if(_0x2a88af){var _0x515dd3=_[_0x57d1('0x67')](_0x2a88af,function(_0x11db0e){var _0x5023db=_0x11db0e[_0x57d1('0x26')]({'plain':!![]});return _0x5023db[_0x57d1('0x64')];});return db[_0x57d1('0x2e')][_0x57d1('0x50')]({'where':{'id':_0x281322[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](function(_0x56b4f5){return db[_0x57d1('0x68')][_0x57d1('0x69')](function(_0x5e1feb){return _0x56b4f5[_0x57d1('0x60')](_0x3f40a3,{'transaction':_0x5e1feb})[_0x57d1('0x24')](function(){return BPromise[_0x57d1('0x6a')](_0x515dd3,function(_0x4cc9a5){return db[_0x57d1('0x59')][_0x57d1('0x6b')]({'where':{'UserId':_0x4cc9a5['id'],'FaxQueueId':_0x281322[_0x57d1('0x49')]['id']},'transaction':_0x5e1feb});});})[_0x57d1('0x24')](function(){_0x515dd3[_0x57d1('0x6c')](function(_0x2667f9){socket[_0x57d1('0x6d')](_0x57d1('0x6e'),{'UserId':_0x2667f9['id'],'FaxQueueId':_0x56b4f5['id']});});});});});}})[_0x57d1('0x24')](respondWithStatusCode(_0x53c354,null))['catch'](handleError(_0x53c354,null));};exports['removeTeams']=function(_0x50d71c,_0x1dde15,_0x433237){return db[_0x57d1('0x62')]['findAll']({'where':{'id':_0x50d71c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x57d1('0x64'),'attributes':['id'],'raw':!![]}]})[_0x57d1('0x24')](handleEntityNotFound(_0x1dde15,null))['then'](function(_0x5c2f8b){var _0x2ca8e4=_[_0x57d1('0x2d')](_0x5c2f8b,'id');var _0x436b4a=[];var _0xa4f49b=[];var _0x19d224=squel[_0x57d1('0x6f')]();_0x19d224[_0x57d1('0x70')](_0x57d1('0x71'))['from'](_0x57d1('0x72'),'tq')[_0x57d1('0x73')](_0x57d1('0x74'),'ut',_0x57d1('0x75'))[_0x57d1('0x3d')]('FaxQueueId\x20=\x20?',_0x50d71c[_0x57d1('0x49')]['id']);for(var _0x140108=0x0;_0x140108<_0x5c2f8b[_0x57d1('0x4b')];_0x140108+=0x1){let _0x1655c9=_0x5c2f8b[_0x140108];for(var _0x1dd0ba=0x0;_0x1dd0ba<_0x1655c9['Agents'][_0x57d1('0x4b')];_0x1dd0ba+=0x1){let _0x19af1e=_0x1655c9[_0x57d1('0x64')][_0x1dd0ba];var _0x2e34da=_0x19d224[_0x57d1('0x76')]();_0x2e34da[_0x57d1('0x3d')]('ut.UserId\x20=\x20?',_0x19af1e['id']);_0xa4f49b[_0x57d1('0x77')](db[_0x57d1('0x68')][_0x57d1('0x33')](_0x2e34da['toString'](),{'type':db[_0x57d1('0x68')][_0x57d1('0x78')][_0x57d1('0x79')]})[_0x57d1('0x24')](function(_0xe35666){if(_0xe35666['length']===0x1){return _0x19af1e['id'];}else{var _0xf1e3c9=_[_0x57d1('0x7a')](_[_0x57d1('0x2d')](_0xe35666,_0x57d1('0x7b')),function(_0x5be74f){return _['includes'](_0x2ca8e4,_0x5be74f);});if(_0xf1e3c9){return _0x19af1e['id'];}}}));}}return BPromise[_0x57d1('0x7c')](_0xa4f49b)['then'](function(_0x24af0c){_0x436b4a=_(_0x436b4a)[_0x57d1('0x7d')](_0x24af0c)['compact']()[_0x57d1('0x7e')]();return db[_0x57d1('0x2e')]['find']({'where':{'id':_0x50d71c[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](function(_0x198ad9){return db[_0x57d1('0x68')][_0x57d1('0x69')](function(_0x2d167f){return _0x198ad9['removeTeams'](_0x50d71c[_0x57d1('0x33')]['ids'],{'transaction':_0x2d167f})[_0x57d1('0x24')](function(){if(!_['isEmpty'](_0x436b4a)){return _0x198ad9[_0x57d1('0x7f')](_0x436b4a,{'transaction':_0x2d167f});}})['then'](function(){_0x436b4a['forEach'](function(_0x454c46){socket['emit']('userFaxQueue:remove',{'UserId':_0x454c46,'FaxQueueId':_0x198ad9['id']});});});});});});})['then'](respondWithStatusCode(_0x1dde15,null))[_0x57d1('0x4c')](handleError(_0x1dde15,null));};exports['addAgents']=function(_0x56a8e9,_0x249184,_0x5126fa){return db[_0x57d1('0x2e')]['find']({'where':{'id':_0x56a8e9[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x249184,null))[_0x57d1('0x24')](function(_0x1e0682){if(_0x1e0682){return _0x1e0682[_0x57d1('0x80')](_0x56a8e9[_0x57d1('0x55')][_0x57d1('0x61')],_['omit'](_0x56a8e9[_0x57d1('0x55')],[_0x57d1('0x61'),'id'])||{})['spread'](function(_0x417973){for(var _0x5195a3=0x0;_0x5195a3<_0x56a8e9[_0x57d1('0x55')][_0x57d1('0x61')]['length'];_0x5195a3+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x56a8e9[_0x57d1('0x55')]['ids'][_0x5195a3],'FaxQueueId':_0x56a8e9[_0x57d1('0x49')]['id']});}return _0x417973;});}})['then'](respondWithResult(_0x249184,null))[_0x57d1('0x4c')](handleError(_0x249184,null));};exports[_0x57d1('0x7f')]=function(_0x57cef2,_0x26ea08,_0x12c14a){return db[_0x57d1('0x2e')][_0x57d1('0x50')]({'where':{'id':_0x57cef2[_0x57d1('0x49')]['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x26ea08,null))['then'](function(_0x2a9a39){if(_0x2a9a39){return _0x2a9a39[_0x57d1('0x7f')](_0x57cef2['query'][_0x57d1('0x61')])[_0x57d1('0x24')](function(){if(_[_0x57d1('0x81')](_0x57cef2[_0x57d1('0x33')][_0x57d1('0x61')])){for(var _0x5e6ad8=0x0;_0x5e6ad8<_0x57cef2[_0x57d1('0x33')][_0x57d1('0x61')]['length'];_0x5e6ad8+=0x1){socket['emit'](_0x57d1('0x82'),{'UserId':Number(_0x57cef2['query'][_0x57d1('0x61')][_0x5e6ad8]),'FaxQueueId':Number(_0x57cef2[_0x57d1('0x49')]['id'])});}}else{socket[_0x57d1('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x57cef2['query'][_0x57d1('0x61')]),'FaxQueueId':Number(_0x57cef2[_0x57d1('0x49')]['id'])});}});}})[_0x57d1('0x24')](respondWithStatusCode(_0x26ea08,null))[_0x57d1('0x4c')](handleError(_0x26ea08,null));};exports[_0x57d1('0x83')]=function(_0x4242aa,_0x55436a,_0x422c70){var _0x10a7f6={};var _0x3aa49d={};var _0x9aced8;var _0x3ff027;return db[_0x57d1('0x2e')][_0x57d1('0x58')]({'where':{'id':_0x4242aa['params']['id']}})[_0x57d1('0x24')](handleEntityNotFound(_0x55436a,null))[_0x57d1('0x24')](function(_0x41ab2f){if(_0x41ab2f){_0x9aced8=_0x41ab2f;_0x3aa49d[_0x57d1('0x32')]=_['keys'](db[_0x57d1('0x63')]['rawAttributes']);_0x3aa49d['query']=_[_0x57d1('0x34')](_0x4242aa['query']);_0x3aa49d['filters']=_['intersection'](_0x3aa49d[_0x57d1('0x32')],_0x3aa49d['query']);_0x10a7f6[_0x57d1('0x37')]=_[_0x57d1('0x35')](_0x3aa49d['model'],qs['fields'](_0x4242aa['query'][_0x57d1('0x36')]));_0x10a7f6[_0x57d1('0x37')]=_0x10a7f6[_0x57d1('0x37')][_0x57d1('0x4b')]?_0x10a7f6[_0x57d1('0x37')]:_0x3aa49d['model'];_0x10a7f6[_0x57d1('0x3b')]=qs['sort'](_0x4242aa[_0x57d1('0x33')]['sort']);_0x10a7f6['where']=qs[_0x57d1('0x3e')](_[_0x57d1('0x3f')](_0x4242aa[_0x57d1('0x33')],_0x3aa49d[_0x57d1('0x3e')]));if(_0x4242aa[_0x57d1('0x33')]['filter']){_0x10a7f6['where']=_[_0x57d1('0x41')](_0x10a7f6[_0x57d1('0x3d')],{'$or':_[_0x57d1('0x2d')](_0x10a7f6[_0x57d1('0x37')],function(_0x378fb2){var _0x46affa={};_0x46affa[_0x378fb2]={'$like':'%'+_0x4242aa['query'][_0x57d1('0x40')]+'%'};return _0x46affa;})});}_0x10a7f6=_[_0x57d1('0x41')]({},_0x10a7f6,_0x4242aa[_0x57d1('0x43')]);return _0x9aced8[_0x57d1('0x83')](_0x10a7f6);}})[_0x57d1('0x24')](function(_0x312056){if(_0x312056){_0x3ff027=_0x312056['length'];if(!_0x4242aa[_0x57d1('0x33')][_0x57d1('0x38')]('nolimit')){_0x10a7f6[_0x57d1('0x3a')]=qs[_0x57d1('0x3a')](_0x4242aa[_0x57d1('0x33')]['limit']);_0x10a7f6[_0x57d1('0x20')]=qs['offset'](_0x4242aa[_0x57d1('0x33')][_0x57d1('0x20')]);}return _0x9aced8[_0x57d1('0x83')](_0x10a7f6);}})['then'](function(_0x28a0ce){if(_0x28a0ce){return _0x28a0ce?{'count':_0x3ff027,'rows':_0x28a0ce}:null;}})['then'](respondWithResult(_0x55436a,null))[_0x57d1('0x4c')](handleError(_0x55436a,null));}; \ No newline at end of file +var _0x27bf=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','rawAttributes','filtears','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','order','findAll','User','findAndCountAll','agent','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:remove','getAgents','eml-format','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x27bf,0x8f));var _0xf27b=function(_0x26f0b8,_0x3ee5f8){_0x26f0b8=_0x26f0b8-0x0;var _0x2b6765=_0x27bf[_0x26f0b8];return _0x2b6765;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf27b('0x0'));var rimraf=require(_0xf27b('0x1'));var zipdir=require(_0xf27b('0x2'));var jsonpatch=require(_0xf27b('0x3'));var rp=require('request-promise');var moment=require(_0xf27b('0x4'));var BPromise=require(_0xf27b('0x5'));var Mustache=require(_0xf27b('0x6'));var util=require(_0xf27b('0x7'));var path=require('path');var sox=require(_0xf27b('0x8'));var csv=require('to-csv');var ejs=require(_0xf27b('0x9'));var fs=require('fs');var _=require(_0xf27b('0xa'));var squel=require(_0xf27b('0xb'));var crypto=require(_0xf27b('0xc'));var jsforce=require(_0xf27b('0xd'));var deskjs=require(_0xf27b('0xe'));var toCsv=require(_0xf27b('0xf'));var querystring=require(_0xf27b('0x10'));var Papa=require(_0xf27b('0x11'));var Redis=require(_0xf27b('0x12'));var authService=require(_0xf27b('0x13'));var qs=require(_0xf27b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf27b('0x15'))(_0xf27b('0x16'));var utils=require(_0xf27b('0x17'));var config=require(_0xf27b('0x18'));var licenseUtil=require(_0xf27b('0x19'));var db=require(_0xf27b('0x1a'))['db'];config[_0xf27b('0x1b')]=_['defaults'](config['redis'],{'host':_0xf27b('0x1c'),'port':0x18eb});var socket=require(_0xf27b('0x1d'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xf27b('0x1e')](socket);function respondWithStatusCode(_0x3d0eae,_0x508c84){_0x508c84=_0x508c84||0xcc;return function(_0x27fc83){if(_0x27fc83){return _0x3d0eae[_0xf27b('0x1f')](_0x508c84);}return _0x3d0eae[_0xf27b('0x20')](_0x508c84)[_0xf27b('0x21')]();};}function respondWithResult(_0x351fab,_0x17e3e0){_0x17e3e0=_0x17e3e0||0xc8;return function(_0x52f3ef){if(_0x52f3ef){return _0x351fab[_0xf27b('0x20')](_0x17e3e0)['json'](_0x52f3ef);}};}function respondWithFilteredResult(_0x11a253,_0x4836ff){return function(_0x30b818){if(_0x30b818){var _0x418c76=_0x30b818[_0xf27b('0x22')],_0x3afab0=_0x4836ff['offset'],_0x41b891=_0x4836ff[_0xf27b('0x23')]+_0x4836ff[_0xf27b('0x24')],_0x431f27;if(_0x41b891>=_0x418c76){_0x41b891=_0x418c76;_0x431f27=0xc8;}else{_0x431f27=0xce;}_0x11a253[_0xf27b('0x20')](_0x431f27);return _0x11a253[_0xf27b('0x25')]('Content-Range',_0x3afab0+'-'+_0x41b891+'/'+_0x418c76)[_0xf27b('0x26')](_0x30b818);}return null;};}function patchUpdates(_0x345f8a){return function(_0x25741d){try{jsonpatch['apply'](_0x25741d,_0x345f8a,!![]);}catch(_0x25aacf){return BPromise[_0xf27b('0x27')](_0x25aacf);}return _0x25741d[_0xf27b('0x28')]();};}function saveUpdates(_0xabe22e,_0x3cdd75){return function(_0x3fdb60){if(_0x3fdb60){return _0x3fdb60[_0xf27b('0x29')](_0xabe22e)[_0xf27b('0x2a')](function(_0x58b36c){return _0x58b36c;});}return null;};}function removeEntity(_0x5015b5,_0x318d54){return function(_0x44630b){if(_0x44630b){return _0x44630b[_0xf27b('0x2b')]()[_0xf27b('0x2a')](function(){var _0x256fdd=_0x44630b[_0xf27b('0x2c')]({'plain':!![]});var _0x1b3d8c=_0xf27b('0x2d');return db[_0xf27b('0x2e')]['destroy']({'where':{'type':_0x1b3d8c,'resourceId':_0x256fdd['id']}})[_0xf27b('0x2a')](function(){return _0x44630b;});})[_0xf27b('0x2a')](function(){_0x5015b5[_0xf27b('0x20')](0xcc)[_0xf27b('0x21')]();});}};}function handleEntityNotFound(_0x2f64cc,_0x4b5eda){return function(_0x49bef2){if(!_0x49bef2){_0x2f64cc[_0xf27b('0x1f')](0x194);}return _0x49bef2;};}function handleError(_0x4a5d51,_0x57cd57){_0x57cd57=_0x57cd57||0x1f4;return function(_0x2c7187){logger[_0xf27b('0x2f')](_0x2c7187[_0xf27b('0x30')]);if(_0x2c7187[_0xf27b('0x31')]){delete _0x2c7187[_0xf27b('0x31')];}_0x4a5d51[_0xf27b('0x20')](_0x57cd57)[_0xf27b('0x32')](_0x2c7187);};}exports[_0xf27b('0x33')]=function(_0x45254c,_0x41c5c2){var _0x212e23={},_0x4b4ab9={},_0xf2c32={'count':0x0,'rows':[]};var _0x9b13f0=_[_0xf27b('0x34')](db[_0xf27b('0x35')]['rawAttributes'],function(_0x2a4ef1){return{'name':_0x2a4ef1['fieldName'],'type':_0x2a4ef1[_0xf27b('0x36')][_0xf27b('0x37')]};});_0x4b4ab9['model']=_['map'](_0x9b13f0,_0xf27b('0x31'));_0x4b4ab9[_0xf27b('0x38')]=_[_0xf27b('0x39')](_0x45254c[_0xf27b('0x38')]);_0x4b4ab9[_0xf27b('0x3a')]=_['intersection'](_0x4b4ab9[_0xf27b('0x3b')],_0x4b4ab9[_0xf27b('0x38')]);_0x212e23[_0xf27b('0x3c')]=_['intersection'](_0x4b4ab9['model'],qs[_0xf27b('0x3d')](_0x45254c[_0xf27b('0x38')][_0xf27b('0x3d')]));_0x212e23[_0xf27b('0x3c')]=_0x212e23[_0xf27b('0x3c')][_0xf27b('0x3e')]?_0x212e23['attributes']:_0x4b4ab9[_0xf27b('0x3b')];if(!_0x45254c[_0xf27b('0x38')][_0xf27b('0x3f')](_0xf27b('0x40'))){_0x212e23['limit']=qs['limit'](_0x45254c[_0xf27b('0x38')]['limit']);_0x212e23[_0xf27b('0x23')]=qs[_0xf27b('0x23')](_0x45254c[_0xf27b('0x38')][_0xf27b('0x23')]);}_0x212e23['order']=qs[_0xf27b('0x41')](_0x45254c[_0xf27b('0x38')][_0xf27b('0x41')]);_0x212e23[_0xf27b('0x42')]=qs[_0xf27b('0x3a')](_[_0xf27b('0x43')](_0x45254c[_0xf27b('0x38')],_0x4b4ab9[_0xf27b('0x3a')]),_0x9b13f0);if(_0x45254c[_0xf27b('0x38')][_0xf27b('0x44')]){_0x212e23[_0xf27b('0x42')]=_[_0xf27b('0x45')](_0x212e23['where'],{'$or':_[_0xf27b('0x34')](_0x9b13f0,function(_0x41ce33){if(_0x41ce33['type']!==_0xf27b('0x46')){var _0x9f18b1={};_0x9f18b1[_0x41ce33['name']]={'$like':'%'+_0x45254c[_0xf27b('0x38')]['filter']+'%'};return _0x9f18b1;}})});}_0x212e23=_[_0xf27b('0x45')]({},_0x212e23,_0x45254c[_0xf27b('0x47')]);var _0x5b99ef={'where':_0x212e23[_0xf27b('0x42')]};return db[_0xf27b('0x35')]['count'](_0x5b99ef)[_0xf27b('0x2a')](function(_0x5b9033){_0xf2c32['count']=_0x5b9033;if(_0x45254c[_0xf27b('0x38')]['includeAll']){_0x212e23[_0xf27b('0x48')]=[{'all':!![]}];}return db[_0xf27b('0x35')]['findAll'](_0x212e23);})[_0xf27b('0x2a')](function(_0x341b07){_0xf2c32['rows']=_0x341b07;return _0xf2c32;})[_0xf27b('0x2a')](respondWithFilteredResult(_0x41c5c2,_0x212e23))[_0xf27b('0x49')](handleError(_0x41c5c2,null));};exports[_0xf27b('0x4a')]=function(_0x415b19,_0x3ceb39){var _0x44a00b={'raw':!![],'where':{'id':_0x415b19[_0xf27b('0x4b')]['id']}},_0x5bd666={};_0x5bd666[_0xf27b('0x3b')]=_[_0xf27b('0x39')](db[_0xf27b('0x35')][_0xf27b('0x4c')]);_0x5bd666['query']=_[_0xf27b('0x39')](_0x415b19[_0xf27b('0x38')]);_0x5bd666[_0xf27b('0x4d')]=_[_0xf27b('0x4e')](_0x5bd666[_0xf27b('0x3b')],_0x5bd666[_0xf27b('0x38')]);_0x44a00b[_0xf27b('0x3c')]=_['intersection'](_0x5bd666['model'],qs[_0xf27b('0x3d')](_0x415b19[_0xf27b('0x38')][_0xf27b('0x3d')]));_0x44a00b[_0xf27b('0x3c')]=_0x44a00b[_0xf27b('0x3c')][_0xf27b('0x3e')]?_0x44a00b[_0xf27b('0x3c')]:_0x5bd666['model'];if(_0x415b19[_0xf27b('0x38')][_0xf27b('0x4f')]){_0x44a00b[_0xf27b('0x48')]=[{'all':!![]}];}_0x44a00b=_[_0xf27b('0x45')]({},_0x44a00b,_0x415b19['options']);return db['FaxQueue'][_0xf27b('0x50')](_0x44a00b)[_0xf27b('0x2a')](handleEntityNotFound(_0x3ceb39,null))[_0xf27b('0x2a')](respondWithResult(_0x3ceb39,null))[_0xf27b('0x49')](handleError(_0x3ceb39,null));};exports[_0xf27b('0x51')]=function(_0x1276db,_0xf8932c){return db[_0xf27b('0x35')]['create'](_0x1276db['body'],{})[_0xf27b('0x2a')](function(_0x97452d){var _0x1830e9=_0x1276db['user'][_0xf27b('0x2c')]({'plain':!![]});if(!_0x1830e9)throw new Error(_0xf27b('0x52'));if(_0x1830e9[_0xf27b('0x53')]===_0xf27b('0x54')){var _0xddddf8=_0x97452d[_0xf27b('0x2c')]({'plain':!![]});var _0x53b68b=_0xf27b('0x2d');return db[_0xf27b('0x55')]['find']({'where':{'name':_0x53b68b,'userProfileId':_0x1830e9[_0xf27b('0x56')]},'raw':!![]})['then'](function(_0x2ca20b){if(_0x2ca20b&&_0x2ca20b[_0xf27b('0x57')]===0x0){return db[_0xf27b('0x2e')][_0xf27b('0x51')]({'name':_0xddddf8[_0xf27b('0x31')],'resourceId':_0xddddf8['id'],'type':_0x2ca20b['name'],'sectionId':_0x2ca20b['id']},{})['then'](function(){return _0x97452d;});}else{return _0x97452d;}})['catch'](function(_0x40b9b2){logger[_0xf27b('0x2f')](_0xf27b('0x58'),_0x40b9b2);throw _0x40b9b2;});}return _0x97452d;})[_0xf27b('0x2a')](respondWithResult(_0xf8932c,0xc9))[_0xf27b('0x49')](handleError(_0xf8932c,null));};exports[_0xf27b('0x29')]=function(_0x10d75c,_0x221b36){if(_0x10d75c[_0xf27b('0x59')]['id']){delete _0x10d75c[_0xf27b('0x59')]['id'];}return db[_0xf27b('0x35')][_0xf27b('0x50')]({'where':{'id':_0x10d75c[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](handleEntityNotFound(_0x221b36,null))[_0xf27b('0x2a')](saveUpdates(_0x10d75c[_0xf27b('0x59')],null))[_0xf27b('0x2a')](respondWithResult(_0x221b36,null))[_0xf27b('0x49')](handleError(_0x221b36,null));};exports['destroy']=function(_0x4b9a01,_0x229ddb){return db[_0xf27b('0x35')][_0xf27b('0x50')]({'where':{'id':_0x4b9a01[_0xf27b('0x4b')]['id']}})['then'](handleEntityNotFound(_0x229ddb,null))['then'](removeEntity(_0x229ddb,null))[_0xf27b('0x49')](handleError(_0x229ddb,null));};exports[_0xf27b('0x5a')]=function(_0x5d7364,_0x59e6ae){return db[_0xf27b('0x35')]['describe']()[_0xf27b('0x2a')](respondWithResult(_0x59e6ae,null))[_0xf27b('0x49')](handleError(_0x59e6ae,null));};exports[_0xf27b('0x5b')]=function(_0x2c4f6b,_0x22dbeb,_0x47e012){var _0x32961b={'raw':!![],'where':{}},_0x59cb0a={},_0x54aabf;return db[_0xf27b('0x35')][_0xf27b('0x5c')]({'where':{'id':_0x2c4f6b[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](handleEntityNotFound(_0x22dbeb,null))[_0xf27b('0x2a')](function(_0x5811b2){if(_0x5811b2){_0x54aabf=_0x5811b2['get']({'plain':!![]});_0x59cb0a[_0xf27b('0x3b')]=_[_0xf27b('0x39')](db[_0xf27b('0x5d')][_0xf27b('0x4c')]);_0x59cb0a['query']=_[_0xf27b('0x39')](_0x2c4f6b[_0xf27b('0x38')]);_0x59cb0a[_0xf27b('0x3a')]=_[_0xf27b('0x4e')](_0x59cb0a[_0xf27b('0x3b')],_0x59cb0a[_0xf27b('0x38')]);_0x32961b[_0xf27b('0x3c')]=_[_0xf27b('0x4e')](_0x59cb0a['model'],qs[_0xf27b('0x3d')](_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x3d')]));_0x32961b[_0xf27b('0x3c')]=_0x32961b[_0xf27b('0x3c')][_0xf27b('0x3e')]?_0x32961b[_0xf27b('0x3c')]:_0x59cb0a['model'];if(!_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x3f')](_0xf27b('0x40'))){_0x32961b[_0xf27b('0x24')]=qs[_0xf27b('0x24')](_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x24')]);_0x32961b['offset']=qs['offset'](_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x23')]);}_0x32961b[_0xf27b('0x5e')]=qs[_0xf27b('0x41')](_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x41')]);_0x32961b[_0xf27b('0x42')]=qs['filters'](_[_0xf27b('0x43')](_0x2c4f6b[_0xf27b('0x38')],_0x59cb0a[_0xf27b('0x3a')]));_0x32961b[_0xf27b('0x42')]['FaxQueueId']=_0x5811b2['id'];if(_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x44')]){_0x32961b[_0xf27b('0x42')]=_['merge'](_0x32961b[_0xf27b('0x42')],{'$or':_[_0xf27b('0x34')](_0x32961b[_0xf27b('0x3c')],function(_0x1b2262){var _0x9cf1bf={};_0x9cf1bf[_0x1b2262]={'$like':'%'+_0x2c4f6b[_0xf27b('0x38')][_0xf27b('0x44')]+'%'};return _0x9cf1bf;})});}_0x32961b=_[_0xf27b('0x45')]({},_0x32961b,_0x2c4f6b[_0xf27b('0x47')]);return db[_0xf27b('0x5d')][_0xf27b('0x5f')](_0x32961b);}})['then'](function(_0x205dd3){if(_0x205dd3){return db[_0xf27b('0x60')][_0xf27b('0x61')]({'where':{'id':_[_0xf27b('0x34')](_0x205dd3,'UserId'),'role':_0xf27b('0x62')},'attributes':['id',_0xf27b('0x31'),_0xf27b('0x63'),_0xf27b('0x64'),_0xf27b('0x65')]});}})[_0xf27b('0x2a')](function(_0x27694e){if(_0x27694e){return{'count':_0x27694e['count'],'rows':_[_0xf27b('0x34')](_0x27694e['rows'],function(_0x12ad35){return{'membername':_0x12ad35[_0xf27b('0x31')],'UserId':_0x12ad35['id'],'queue_name':_0x54aabf['name'],'FaxQueueId':_0x54aabf['id'],'interface':util[_0xf27b('0x66')](_0xf27b('0x67'),'SIP',_0x12ad35[_0xf27b('0x31')]),'penalty':0x0,'paused':_0x12ad35['faxPause'],'createdAt':_0x12ad35['createdAt'],'updatedAt':_0x12ad35[_0xf27b('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf27b('0x2a')](respondWithFilteredResult(_0x22dbeb,_0x32961b))[_0xf27b('0x49')](handleError(_0x22dbeb,null));};exports['getTeams']=function(_0x1d6c16,_0x24a75c,_0x1bf001){var _0x338610={};var _0xd5b92b={};var _0x2ad538;var _0x49d31f;return db['FaxQueue'][_0xf27b('0x5c')]({'where':{'id':_0x1d6c16[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](handleEntityNotFound(_0x24a75c,null))[_0xf27b('0x2a')](function(_0x26e256){if(_0x26e256){_0x2ad538=_0x26e256;_0xd5b92b[_0xf27b('0x3b')]=_[_0xf27b('0x39')](db['Team'][_0xf27b('0x4c')]);_0xd5b92b['query']=_[_0xf27b('0x39')](_0x1d6c16[_0xf27b('0x38')]);_0xd5b92b[_0xf27b('0x3a')]=_[_0xf27b('0x4e')](_0xd5b92b[_0xf27b('0x3b')],_0xd5b92b[_0xf27b('0x38')]);_0x338610[_0xf27b('0x3c')]=_[_0xf27b('0x4e')](_0xd5b92b[_0xf27b('0x3b')],qs[_0xf27b('0x3d')](_0x1d6c16[_0xf27b('0x38')][_0xf27b('0x3d')]));_0x338610['attributes']=_0x338610[_0xf27b('0x3c')][_0xf27b('0x3e')]?_0x338610[_0xf27b('0x3c')]:_0xd5b92b[_0xf27b('0x3b')];_0x338610[_0xf27b('0x5e')]=qs[_0xf27b('0x41')](_0x1d6c16[_0xf27b('0x38')][_0xf27b('0x41')]);_0x338610[_0xf27b('0x42')]=qs['filters'](_['pick'](_0x1d6c16[_0xf27b('0x38')],_0xd5b92b[_0xf27b('0x3a')]));if(_0x1d6c16['query'][_0xf27b('0x44')]){_0x338610[_0xf27b('0x42')]=_[_0xf27b('0x45')](_0x338610[_0xf27b('0x42')],{'$or':_[_0xf27b('0x34')](_0x338610['attributes'],function(_0x5385c9){var _0x33fedf={};_0x33fedf[_0x5385c9]={'$like':'%'+_0x1d6c16[_0xf27b('0x38')]['filter']+'%'};return _0x33fedf;})});}_0x338610=_[_0xf27b('0x45')]({},_0x338610,_0x1d6c16[_0xf27b('0x47')]);return _0x2ad538[_0xf27b('0x68')](_0x338610);}})[_0xf27b('0x2a')](function(_0x507c9b){if(_0x507c9b){_0x49d31f=_0x507c9b['length'];if(!_0x1d6c16['query'][_0xf27b('0x3f')]('nolimit')){_0x338610[_0xf27b('0x24')]=qs[_0xf27b('0x24')](_0x1d6c16[_0xf27b('0x38')][_0xf27b('0x24')]);_0x338610[_0xf27b('0x23')]=qs[_0xf27b('0x23')](_0x1d6c16[_0xf27b('0x38')][_0xf27b('0x23')]);}return _0x2ad538[_0xf27b('0x68')](_0x338610);}})[_0xf27b('0x2a')](function(_0x3ef619){if(_0x3ef619){return _0x3ef619?{'count':_0x49d31f,'rows':_0x3ef619}:null;}})['then'](respondWithResult(_0x24a75c,null))[_0xf27b('0x49')](handleError(_0x24a75c,null));};exports[_0xf27b('0x69')]=function(_0x2939b7,_0x37f1ad,_0x2386ce){var _0x1f9b64=_0x2939b7[_0xf27b('0x59')][_0xf27b('0x6a')];return db[_0xf27b('0x6b')][_0xf27b('0x5f')]({'where':{'id':_0x1f9b64},'attributes':['id'],'include':[{'model':db[_0xf27b('0x60')],'as':_0xf27b('0x6c'),'attributes':['id','name',_0xf27b('0x6d'),'voicePause','interface'],'raw':!![]}]})[_0xf27b('0x2a')](function(_0x3a4f11){if(_0x3a4f11){var _0x417c29=_[_0xf27b('0x6e')](_0x3a4f11,function(_0x38e33a){var _0x40cfb1=_0x38e33a[_0xf27b('0x2c')]({'plain':!![]});return _0x40cfb1[_0xf27b('0x6c')];});return db[_0xf27b('0x35')]['find']({'where':{'id':_0x2939b7[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](function(_0xe4b8e3){return db[_0xf27b('0x6f')][_0xf27b('0x70')](function(_0x39fb9b){return _0xe4b8e3[_0xf27b('0x69')](_0x1f9b64,{'transaction':_0x39fb9b})[_0xf27b('0x2a')](function(){return BPromise[_0xf27b('0x71')](_0x417c29,function(_0x340c6a){return db[_0xf27b('0x5d')][_0xf27b('0x72')]({'where':{'UserId':_0x340c6a['id'],'FaxQueueId':_0x2939b7[_0xf27b('0x4b')]['id']},'transaction':_0x39fb9b});});})['then'](function(){_0x417c29[_0xf27b('0x73')](function(_0x167289){socket[_0xf27b('0x74')](_0xf27b('0x75'),{'UserId':_0x167289['id'],'FaxQueueId':_0xe4b8e3['id']});});});});});}})[_0xf27b('0x2a')](respondWithStatusCode(_0x37f1ad,null))[_0xf27b('0x49')](handleError(_0x37f1ad,null));};exports[_0xf27b('0x76')]=function(_0x24b3df,_0x12e222,_0xa9ed3f){return db[_0xf27b('0x6b')]['findAll']({'where':{'id':_0x24b3df['query'][_0xf27b('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xf27b('0x60')],'as':_0xf27b('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf27b('0x2a')](handleEntityNotFound(_0x12e222,null))[_0xf27b('0x2a')](function(_0x273fab){var _0x395c0e=_[_0xf27b('0x34')](_0x273fab,'id');var _0x4ad3ff=[];var _0x142acf=[];var _0x127d6a=squel['select']();_0x127d6a[_0xf27b('0x77')](_0xf27b('0x78'))[_0xf27b('0x79')](_0xf27b('0x7a'),'tq')[_0xf27b('0x7b')](_0xf27b('0x7c'),'ut',_0xf27b('0x7d'))[_0xf27b('0x42')](_0xf27b('0x7e'),_0x24b3df[_0xf27b('0x4b')]['id']);for(var _0x4efff0=0x0;_0x4efff0<_0x273fab['length'];_0x4efff0+=0x1){let _0x540295=_0x273fab[_0x4efff0];for(var _0x4800d5=0x0;_0x4800d5<_0x540295[_0xf27b('0x6c')][_0xf27b('0x3e')];_0x4800d5+=0x1){let _0x25cfe4=_0x540295[_0xf27b('0x6c')][_0x4800d5];var _0x2b4589=_0x127d6a[_0xf27b('0x7f')]();_0x2b4589[_0xf27b('0x42')](_0xf27b('0x80'),_0x25cfe4['id']);_0x142acf[_0xf27b('0x81')](db[_0xf27b('0x6f')][_0xf27b('0x38')](_0x2b4589[_0xf27b('0x82')](),{'type':db[_0xf27b('0x6f')][_0xf27b('0x83')][_0xf27b('0x84')]})[_0xf27b('0x2a')](function(_0x4bba9d){if(_0x4bba9d[_0xf27b('0x3e')]===0x1){return _0x25cfe4['id'];}else{var _0x22b4e7=_[_0xf27b('0x85')](_[_0xf27b('0x34')](_0x4bba9d,_0xf27b('0x86')),function(_0x3f0966){return _[_0xf27b('0x87')](_0x395c0e,_0x3f0966);});if(_0x22b4e7){return _0x25cfe4['id'];}}}));}}return BPromise[_0xf27b('0x88')](_0x142acf)[_0xf27b('0x2a')](function(_0x5d4378){_0x4ad3ff=_(_0x4ad3ff)['union'](_0x5d4378)[_0xf27b('0x89')]()[_0xf27b('0x8a')]();return db[_0xf27b('0x35')][_0xf27b('0x50')]({'where':{'id':_0x24b3df['params']['id']}})[_0xf27b('0x2a')](function(_0x30ad5d){return db[_0xf27b('0x6f')]['transaction'](function(_0x23831c){return _0x30ad5d[_0xf27b('0x76')](_0x24b3df[_0xf27b('0x38')][_0xf27b('0x6a')],{'transaction':_0x23831c})[_0xf27b('0x2a')](function(){if(!_[_0xf27b('0x8b')](_0x4ad3ff)){return _0x30ad5d[_0xf27b('0x8c')](_0x4ad3ff,{'transaction':_0x23831c});}})[_0xf27b('0x2a')](function(){_0x4ad3ff[_0xf27b('0x73')](function(_0xc307df){socket[_0xf27b('0x74')]('userFaxQueue:remove',{'UserId':_0xc307df,'FaxQueueId':_0x30ad5d['id']});});});});});});})[_0xf27b('0x2a')](respondWithStatusCode(_0x12e222,null))[_0xf27b('0x49')](handleError(_0x12e222,null));};exports[_0xf27b('0x8d')]=function(_0x2a412e,_0x55789c,_0x532b47){return db[_0xf27b('0x35')][_0xf27b('0x50')]({'where':{'id':_0x2a412e[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](handleEntityNotFound(_0x55789c,null))['then'](function(_0x38d295){if(_0x38d295){return _0x38d295[_0xf27b('0x8d')](_0x2a412e[_0xf27b('0x59')][_0xf27b('0x6a')],_['omit'](_0x2a412e[_0xf27b('0x59')],[_0xf27b('0x6a'),'id'])||{})[_0xf27b('0x8e')](function(_0x4ceb85){for(var _0x292029=0x0;_0x292029<_0x2a412e[_0xf27b('0x59')][_0xf27b('0x6a')][_0xf27b('0x3e')];_0x292029+=0x1){socket[_0xf27b('0x74')](_0xf27b('0x75'),{'UserId':_0x2a412e['body'][_0xf27b('0x6a')][_0x292029],'FaxQueueId':_0x2a412e[_0xf27b('0x4b')]['id']});}return _0x4ceb85;});}})[_0xf27b('0x2a')](respondWithResult(_0x55789c,null))[_0xf27b('0x49')](handleError(_0x55789c,null));};exports[_0xf27b('0x8c')]=function(_0x199c60,_0x46d70c,_0x556b05){return db[_0xf27b('0x35')][_0xf27b('0x50')]({'where':{'id':_0x199c60['params']['id']}})['then'](handleEntityNotFound(_0x46d70c,null))[_0xf27b('0x2a')](function(_0x7af490){if(_0x7af490){return _0x7af490[_0xf27b('0x8c')](_0x199c60[_0xf27b('0x38')][_0xf27b('0x6a')])[_0xf27b('0x2a')](function(){if(_['isArray'](_0x199c60[_0xf27b('0x38')][_0xf27b('0x6a')])){for(var _0x2766db=0x0;_0x2766db<_0x199c60[_0xf27b('0x38')][_0xf27b('0x6a')][_0xf27b('0x3e')];_0x2766db+=0x1){socket[_0xf27b('0x74')](_0xf27b('0x8f'),{'UserId':Number(_0x199c60[_0xf27b('0x38')]['ids'][_0x2766db]),'FaxQueueId':Number(_0x199c60['params']['id'])});}}else{socket[_0xf27b('0x74')](_0xf27b('0x8f'),{'UserId':Number(_0x199c60['query']['ids']),'FaxQueueId':Number(_0x199c60[_0xf27b('0x4b')]['id'])});}});}})[_0xf27b('0x2a')](respondWithStatusCode(_0x46d70c,null))['catch'](handleError(_0x46d70c,null));};exports[_0xf27b('0x90')]=function(_0x202d0f,_0x3aa108,_0x51147e){var _0x46b874={};var _0x3a6ff5={};var _0x193d56;var _0x1d3125;return db[_0xf27b('0x35')][_0xf27b('0x5c')]({'where':{'id':_0x202d0f[_0xf27b('0x4b')]['id']}})[_0xf27b('0x2a')](handleEntityNotFound(_0x3aa108,null))[_0xf27b('0x2a')](function(_0x1c2b52){if(_0x1c2b52){_0x193d56=_0x1c2b52;_0x3a6ff5[_0xf27b('0x3b')]=_[_0xf27b('0x39')](db[_0xf27b('0x60')][_0xf27b('0x4c')]);_0x3a6ff5[_0xf27b('0x38')]=_[_0xf27b('0x39')](_0x202d0f[_0xf27b('0x38')]);_0x3a6ff5[_0xf27b('0x3a')]=_[_0xf27b('0x4e')](_0x3a6ff5['model'],_0x3a6ff5[_0xf27b('0x38')]);_0x46b874[_0xf27b('0x3c')]=_[_0xf27b('0x4e')](_0x3a6ff5['model'],qs['fields'](_0x202d0f[_0xf27b('0x38')][_0xf27b('0x3d')]));_0x46b874[_0xf27b('0x3c')]=_0x46b874[_0xf27b('0x3c')][_0xf27b('0x3e')]?_0x46b874[_0xf27b('0x3c')]:_0x3a6ff5['model'];_0x46b874[_0xf27b('0x5e')]=qs[_0xf27b('0x41')](_0x202d0f['query'][_0xf27b('0x41')]);_0x46b874[_0xf27b('0x42')]=qs[_0xf27b('0x3a')](_[_0xf27b('0x43')](_0x202d0f[_0xf27b('0x38')],_0x3a6ff5['filters']));if(_0x202d0f['query'][_0xf27b('0x44')]){_0x46b874['where']=_['merge'](_0x46b874[_0xf27b('0x42')],{'$or':_[_0xf27b('0x34')](_0x46b874[_0xf27b('0x3c')],function(_0x55cf17){var _0x2fc095={};_0x2fc095[_0x55cf17]={'$like':'%'+_0x202d0f[_0xf27b('0x38')][_0xf27b('0x44')]+'%'};return _0x2fc095;})});}_0x46b874=_[_0xf27b('0x45')]({},_0x46b874,_0x202d0f['options']);return _0x193d56[_0xf27b('0x90')](_0x46b874);}})[_0xf27b('0x2a')](function(_0x598ed3){if(_0x598ed3){_0x1d3125=_0x598ed3[_0xf27b('0x3e')];if(!_0x202d0f[_0xf27b('0x38')][_0xf27b('0x3f')](_0xf27b('0x40'))){_0x46b874[_0xf27b('0x24')]=qs[_0xf27b('0x24')](_0x202d0f['query'][_0xf27b('0x24')]);_0x46b874[_0xf27b('0x23')]=qs[_0xf27b('0x23')](_0x202d0f['query']['offset']);}return _0x193d56['getAgents'](_0x46b874);}})['then'](function(_0x9742dd){if(_0x9742dd){return _0x9742dd?{'count':_0x1d3125,'rows':_0x9742dd}:null;}})[_0xf27b('0x2a')](respondWithResult(_0x3aa108,null))[_0xf27b('0x49')](handleError(_0x3aa108,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index c992104..4e72db8 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 _0xb374=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xc3891c,_0x4ef80e){var _0x1d0aa8=function(_0x228f87){while(--_0x228f87){_0xc3891c['push'](_0xc3891c['shift']());}};_0x1d0aa8(++_0x4ef80e);}(_0xb374,0x106));var _0x4b37=function(_0xf5d006,_0x116f85){_0xf5d006=_0xf5d006-0x0;var _0x2b5d83=_0xb374[_0xf5d006];return _0x2b5d83;};'use strict';var EventEmitter=require(_0x4b37('0x0'));var FaxQueue=require(_0x4b37('0x1'))['db'][_0x4b37('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4b37('0x3')](0x0);var events={'afterCreate':_0x4b37('0x4'),'afterUpdate':_0x4b37('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1d9ed7){return function(_0x3b2129,_0x59d200,_0x3defc1){FaxQueueEvents[_0x4b37('0x6')](_0x1d9ed7+':'+_0x3b2129['id'],_0x3b2129);FaxQueueEvents[_0x4b37('0x6')](_0x1d9ed7,_0x3b2129);_0x3defc1(null);};}for(var e in events){if(events[_0x4b37('0x7')](e)){var event=events[e];FaxQueue[_0x4b37('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x8f2b=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x387aba,_0x1bb9be){var _0x4d9309=function(_0x58a6a8){while(--_0x58a6a8){_0x387aba['push'](_0x387aba['shift']());}};_0x4d9309(++_0x1bb9be);}(_0x8f2b,0x122));var _0xb8f2=function(_0x223199,_0x521861){_0x223199=_0x223199-0x0;var _0x4e4ff4=_0x8f2b[_0x223199];return _0x4e4ff4;};'use strict';var EventEmitter=require(_0xb8f2('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb8f2('0x1')](0x0);var events={'afterCreate':_0xb8f2('0x2'),'afterUpdate':_0xb8f2('0x3'),'afterDestroy':_0xb8f2('0x4')};function emitEvent(_0x7ec02d){return function(_0x34067e,_0x2e6e85,_0x50b18d){FaxQueueEvents[_0xb8f2('0x5')](_0x7ec02d+':'+_0x34067e['id'],_0x34067e);FaxQueueEvents[_0xb8f2('0x5')](_0x7ec02d,_0x34067e);_0x50b18d(null);};}for(var e in events){if(events[_0xb8f2('0x6')](e)){var event=events[e];FaxQueue[_0xb8f2('0x7')](e,emitEvent(event));}}module[_0xb8f2('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 dd29607..a87fd2b 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 _0xd163=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','api','request-promise'];(function(_0x5b1dbf,_0x433570){var _0x16ec62=function(_0x3d097d){while(--_0x3d097d){_0x5b1dbf['push'](_0x5b1dbf['shift']());}};_0x16ec62(++_0x433570);}(_0xd163,0x98));var _0x3d16=function(_0xa28b1a,_0x384f4b){_0xa28b1a=_0xa28b1a-0x0;var _0x4c9b78=_0xd163[_0xa28b1a];return _0x4c9b78;};'use strict';var _=require(_0x3d16('0x0'));var util=require(_0x3d16('0x1'));var logger=require('../../config/logger')(_0x3d16('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d16('0x3'));var fs=require('fs');var path=require(_0x3d16('0x4'));var rimraf=require(_0x3d16('0x5'));var config=require(_0x3d16('0x6'));var attributes=require(_0x3d16('0x7'));module[_0x3d16('0x8')]=function(_0x4e15e3,_0xb4803f){return _0x4e15e3[_0x3d16('0x9')](_0x3d16('0xa'),attributes,{'tableName':_0x3d16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3ef=['fax_queues','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','FaxQueue'];(function(_0x4873b3,_0x414957){var _0x720fa7=function(_0x3b8855){while(--_0x3b8855){_0x4873b3['push'](_0x4873b3['shift']());}};_0x720fa7(++_0x414957);}(_0xb3ef,0xb9));var _0xfb3e=function(_0xb0742d,_0x5cb3d9){_0xb0742d=_0xb0742d-0x0;var _0x329935=_0xb3ef[_0xb0742d];return _0x329935;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb3e('0x0'))(_0xfb3e('0x1'));var moment=require(_0xfb3e('0x2'));var BPromise=require('bluebird');var rp=require(_0xfb3e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb3e('0x4'));var config=require(_0xfb3e('0x5'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0x3bc448,_0x45ead8){return _0x3bc448['define'](_0xfb3e('0x6'),attributes,{'tableName':_0xfb3e('0x7'),'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 82f1a2f..7328971 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 _0x6568=['../../config/logger','rpc','http','redis','defaults','localhost','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','ShowFaxQueue','find','moment','randomstring','ioredis','../../config/utils'];(function(_0x393fbc,_0x18d8ec){var _0x3ec28a=function(_0x4a1574){while(--_0x4a1574){_0x393fbc['push'](_0x393fbc['shift']());}};_0x3ec28a(++_0x18d8ec);}(_0x6568,0x12e));var _0x8656=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6568[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8656('0x0'));var BPromise=require('bluebird');var rs=require(_0x8656('0x1'));var fs=require('fs');var Redis=require(_0x8656('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8656('0x3'));var logger=require(_0x8656('0x4'))(_0x8656('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8656('0x6')]({'port':0x232a});config[_0x8656('0x7')]=_[_0x8656('0x8')](config['redis'],{'host':_0x8656('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8656('0x7')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4622b6,_0x90cb21,_0x1ee26f){return new BPromise(function(_0x197816,_0x290ac7){return client['request'](_0x4622b6,_0x1ee26f)[_0x8656('0xa')](function(_0x5072e0){logger[_0x8656('0xb')](_0x8656('0xc'),_0x90cb21,'request\x20sent');logger[_0x8656('0xd')](_0x8656('0xe'),_0x90cb21,_0x8656('0xf'),JSON[_0x8656('0x10')](_0x5072e0));if(_0x5072e0[_0x8656('0x11')]){if(_0x5072e0[_0x8656('0x11')][_0x8656('0x12')]===0x1f4){logger['error'](_0x8656('0xc'),_0x90cb21,_0x5072e0[_0x8656('0x11')][_0x8656('0x13')]);return _0x290ac7(_0x5072e0[_0x8656('0x11')][_0x8656('0x13')]);}logger[_0x8656('0x11')](_0x8656('0xc'),_0x90cb21,_0x5072e0[_0x8656('0x11')][_0x8656('0x13')]);return _0x197816(_0x5072e0[_0x8656('0x11')]['message']);}else{logger[_0x8656('0xb')]('FaxQueue,\x20%s,\x20%s',_0x90cb21,_0x8656('0xf'));_0x197816(_0x5072e0[_0x8656('0x14')]['message']);}})[_0x8656('0x15')](function(_0x2bd0aa){logger[_0x8656('0x11')](_0x8656('0xc'),_0x90cb21,_0x2bd0aa);_0x290ac7(_0x2bd0aa);});});}exports[_0x8656('0x16')]=function(_0x13e4ab){var _0x107331=this;return new Promise(function(_0x4d1256,_0x3fcc4d){return db[_0x8656('0x17')][_0x8656('0x18')]({'raw':_0x13e4ab[_0x8656('0x19')]?_0x13e4ab[_0x8656('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x13e4ab[_0x8656('0x19')]?_0x13e4ab[_0x8656('0x19')][_0x8656('0x1a')]||null:null,'attributes':_0x13e4ab[_0x8656('0x19')]?_0x13e4ab['options'][_0x8656('0x1b')]||null:null,'limit':_0x13e4ab[_0x8656('0x19')]?_0x13e4ab[_0x8656('0x19')][_0x8656('0x1c')]||null:null,'include':_0x13e4ab['options']?_0x13e4ab['options'][_0x8656('0x1d')]?_[_0x8656('0x1e')](_0x13e4ab[_0x8656('0x19')][_0x8656('0x1d')],function(_0x28e0a9){return{'model':db[_0x28e0a9[_0x8656('0x1f')]],'as':_0x28e0a9['as'],'attributes':_0x28e0a9[_0x8656('0x1b')],'include':_0x28e0a9[_0x8656('0x1d')]?_[_0x8656('0x1e')](_0x28e0a9[_0x8656('0x1d')],function(_0x3540be){return{'model':db[_0x3540be['model']],'as':_0x3540be['as'],'attributes':_0x3540be[_0x8656('0x1b')],'include':_0x3540be['include']?_[_0x8656('0x1e')](_0x3540be[_0x8656('0x1d')],function(_0x3cfb3d){return{'model':db[_0x3cfb3d[_0x8656('0x1f')]],'as':_0x3cfb3d['as'],'attributes':_0x3cfb3d[_0x8656('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8656('0xa')](function(_0x59a2d4){logger[_0x8656('0xb')](_0x8656('0x16'),_0x13e4ab);logger['debug'](_0x8656('0x16'),_0x13e4ab,JSON[_0x8656('0x10')](_0x59a2d4));_0x4d1256(_0x59a2d4);})[_0x8656('0x15')](function(_0x11f8cd){logger['error'](_0x8656('0x16'),_0x11f8cd[_0x8656('0x13')],_0x13e4ab);_0x3fcc4d(_0x107331[_0x8656('0x11')](0x1f4,_0x11f8cd[_0x8656('0x13')]));});});};exports[_0x8656('0x20')]=function(_0x2c2624){var _0x50edae=this;return new Promise(function(_0x1e82fc,_0x25a62a){return db[_0x8656('0x17')][_0x8656('0x21')]({'raw':_0x2c2624[_0x8656('0x19')]?_0x2c2624['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c2624[_0x8656('0x19')]?_0x2c2624[_0x8656('0x19')][_0x8656('0x1a')]||null:null,'attributes':_0x2c2624[_0x8656('0x19')]?_0x2c2624[_0x8656('0x19')][_0x8656('0x1b')]||null:null,'include':_0x2c2624[_0x8656('0x19')]?_0x2c2624[_0x8656('0x19')][_0x8656('0x1d')]?_[_0x8656('0x1e')](_0x2c2624['options']['include'],function(_0x3dca9b){return{'model':db[_0x3dca9b[_0x8656('0x1f')]],'as':_0x3dca9b['as'],'attributes':_0x3dca9b['attributes'],'include':_0x3dca9b[_0x8656('0x1d')]?_[_0x8656('0x1e')](_0x3dca9b['include'],function(_0x15cb2c){return{'model':db[_0x15cb2c[_0x8656('0x1f')]],'as':_0x15cb2c['as'],'attributes':_0x15cb2c[_0x8656('0x1b')],'include':_0x15cb2c['include']?_['map'](_0x15cb2c[_0x8656('0x1d')],function(_0x36d972){return{'model':db[_0x36d972[_0x8656('0x1f')]],'as':_0x36d972['as'],'attributes':_0x36d972[_0x8656('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8656('0xa')](function(_0x3c5f94){logger['info'](_0x8656('0x20'),_0x2c2624);logger[_0x8656('0xd')](_0x8656('0x20'),_0x2c2624,JSON['stringify'](_0x3c5f94));_0x1e82fc(_0x3c5f94);})[_0x8656('0x15')](function(_0x3c9bde){logger[_0x8656('0x11')]('ShowFaxQueue',_0x3c9bde[_0x8656('0x13')],_0x2c2624);_0x25a62a(_0x50edae['error'](0x1f4,_0x3c9bde['message']));});});}; \ No newline at end of file +var _0xdbec=['include','model','attributes','map','then','GetFaxQueue','ShowFaxQueue','find','raw','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','FaxQueue','findAll','options','where'];(function(_0x460705,_0x4da10b){var _0x202f89=function(_0x43e9bd){while(--_0x43e9bd){_0x460705['push'](_0x460705['shift']());}};_0x202f89(++_0x4da10b);}(_0xdbec,0xa9));var _0xcdbe=function(_0x5309c7,_0x1204a8){_0x5309c7=_0x5309c7-0x0;var _0x5ddc32=_0xdbec[_0x5309c7];return _0x5ddc32;};'use strict';var _=require(_0xcdbe('0x0'));var util=require(_0xcdbe('0x1'));var moment=require(_0xcdbe('0x2'));var BPromise=require(_0xcdbe('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcdbe('0x4'))['db'];var utils=require(_0xcdbe('0x5'));var logger=require(_0xcdbe('0x6'))(_0xcdbe('0x7'));var config=require(_0xcdbe('0x8'));var jayson=require(_0xcdbe('0x9'));var client=jayson[_0xcdbe('0xa')][_0xcdbe('0xb')]({'port':0x232a});config['redis']=_[_0xcdbe('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcdbe('0xd'))(new Redis(config[_0xcdbe('0xe')]));require(_0xcdbe('0xf'))['register'](socket);function respondWithRpcPromise(_0x2fd996,_0x354fd2,_0x1a3892){return new BPromise(function(_0x2e3ad0,_0x238fbb){return client[_0xcdbe('0x10')](_0x2fd996,_0x1a3892)['then'](function(_0x2280f8){logger['info'](_0xcdbe('0x11'),_0x354fd2,_0xcdbe('0x12'));logger[_0xcdbe('0x13')](_0xcdbe('0x14'),_0x354fd2,_0xcdbe('0x12'),JSON[_0xcdbe('0x15')](_0x2280f8));if(_0x2280f8[_0xcdbe('0x16')]){if(_0x2280f8[_0xcdbe('0x16')][_0xcdbe('0x17')]===0x1f4){logger['error'](_0xcdbe('0x11'),_0x354fd2,_0x2280f8[_0xcdbe('0x16')][_0xcdbe('0x18')]);return _0x238fbb(_0x2280f8[_0xcdbe('0x16')]['message']);}logger[_0xcdbe('0x16')](_0xcdbe('0x11'),_0x354fd2,_0x2280f8[_0xcdbe('0x16')][_0xcdbe('0x18')]);return _0x2e3ad0(_0x2280f8['error'][_0xcdbe('0x18')]);}else{logger[_0xcdbe('0x19')](_0xcdbe('0x11'),_0x354fd2,'request\x20sent');_0x2e3ad0(_0x2280f8['result'][_0xcdbe('0x18')]);}})[_0xcdbe('0x1a')](function(_0x2b1408){logger['error'](_0xcdbe('0x11'),_0x354fd2,_0x2b1408);_0x238fbb(_0x2b1408);});});}exports['GetFaxQueue']=function(_0x58c1f2){var _0x10e332=this;return new Promise(function(_0x4007f9,_0x267e08){return db[_0xcdbe('0x1b')][_0xcdbe('0x1c')]({'raw':_0x58c1f2['options']?_0x58c1f2[_0xcdbe('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x58c1f2['options']?_0x58c1f2[_0xcdbe('0x1d')][_0xcdbe('0x1e')]||null:null,'attributes':_0x58c1f2[_0xcdbe('0x1d')]?_0x58c1f2['options']['attributes']||null:null,'limit':_0x58c1f2[_0xcdbe('0x1d')]?_0x58c1f2[_0xcdbe('0x1d')]['limit']||null:null,'include':_0x58c1f2[_0xcdbe('0x1d')]?_0x58c1f2[_0xcdbe('0x1d')][_0xcdbe('0x1f')]?_['map'](_0x58c1f2[_0xcdbe('0x1d')][_0xcdbe('0x1f')],function(_0x27e9cf){return{'model':db[_0x27e9cf[_0xcdbe('0x20')]],'as':_0x27e9cf['as'],'attributes':_0x27e9cf[_0xcdbe('0x21')],'include':_0x27e9cf[_0xcdbe('0x1f')]?_[_0xcdbe('0x22')](_0x27e9cf[_0xcdbe('0x1f')],function(_0x156f5a){return{'model':db[_0x156f5a[_0xcdbe('0x20')]],'as':_0x156f5a['as'],'attributes':_0x156f5a[_0xcdbe('0x21')],'include':_0x156f5a[_0xcdbe('0x1f')]?_[_0xcdbe('0x22')](_0x156f5a['include'],function(_0x18806a){return{'model':db[_0x18806a[_0xcdbe('0x20')]],'as':_0x18806a['as'],'attributes':_0x18806a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdbe('0x23')](function(_0x5edeea){logger[_0xcdbe('0x19')](_0xcdbe('0x24'),_0x58c1f2);logger[_0xcdbe('0x13')](_0xcdbe('0x24'),_0x58c1f2,JSON[_0xcdbe('0x15')](_0x5edeea));_0x4007f9(_0x5edeea);})[_0xcdbe('0x1a')](function(_0x45c2bc){logger['error']('GetFaxQueue',_0x45c2bc[_0xcdbe('0x18')],_0x58c1f2);_0x267e08(_0x10e332['error'](0x1f4,_0x45c2bc[_0xcdbe('0x18')]));});});};exports[_0xcdbe('0x25')]=function(_0x2ba508){var _0x4138c9=this;return new Promise(function(_0x5d76dd,_0x365674){return db[_0xcdbe('0x1b')][_0xcdbe('0x26')]({'raw':_0x2ba508['options']?_0x2ba508[_0xcdbe('0x1d')][_0xcdbe('0x27')]===undefined?!![]:![]:!![],'where':_0x2ba508[_0xcdbe('0x1d')]?_0x2ba508[_0xcdbe('0x1d')][_0xcdbe('0x1e')]||null:null,'attributes':_0x2ba508[_0xcdbe('0x1d')]?_0x2ba508[_0xcdbe('0x1d')][_0xcdbe('0x21')]||null:null,'include':_0x2ba508['options']?_0x2ba508[_0xcdbe('0x1d')][_0xcdbe('0x1f')]?_['map'](_0x2ba508[_0xcdbe('0x1d')]['include'],function(_0x136b8e){return{'model':db[_0x136b8e[_0xcdbe('0x20')]],'as':_0x136b8e['as'],'attributes':_0x136b8e['attributes'],'include':_0x136b8e[_0xcdbe('0x1f')]?_[_0xcdbe('0x22')](_0x136b8e[_0xcdbe('0x1f')],function(_0x16a24e){return{'model':db[_0x16a24e[_0xcdbe('0x20')]],'as':_0x16a24e['as'],'attributes':_0x16a24e[_0xcdbe('0x21')],'include':_0x16a24e[_0xcdbe('0x1f')]?_[_0xcdbe('0x22')](_0x16a24e[_0xcdbe('0x1f')],function(_0x21f94c){return{'model':db[_0x21f94c[_0xcdbe('0x20')]],'as':_0x21f94c['as'],'attributes':_0x21f94c[_0xcdbe('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcdbe('0x23')](function(_0x2a0476){logger[_0xcdbe('0x19')](_0xcdbe('0x25'),_0x2ba508);logger[_0xcdbe('0x13')]('ShowFaxQueue',_0x2ba508,JSON[_0xcdbe('0x15')](_0x2a0476));_0x5d76dd(_0x2a0476);})[_0xcdbe('0x1a')](function(_0x29ba7f){logger[_0xcdbe('0x16')]('ShowFaxQueue',_0x29ba7f[_0xcdbe('0x18')],_0x2ba508);_0x365674(_0x4138c9[_0xcdbe('0x16')](0x1f4,_0x29ba7f[_0xcdbe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e9711c4..4d766f1 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 _0x6622=['register','length','faxQueue:','./faxQueue.events','save','remove','emit','removeListener'];(function(_0x57d712,_0x29b0e1){var _0x253ceb=function(_0x4044dd){while(--_0x4044dd){_0x57d712['push'](_0x57d712['shift']());}};_0x253ceb(++_0x29b0e1);}(_0x6622,0x1a3));var _0x2662=function(_0x4e0026,_0x2b52b6){_0x4e0026=_0x4e0026-0x0;var _0x3f8ee7=_0x6622[_0x4e0026];return _0x3f8ee7;};'use strict';var FaxQueueEvents=require(_0x2662('0x0'));var events=[_0x2662('0x1'),_0x2662('0x2'),'update'];function createListener(_0x1ff8b0,_0x355a15){return function(_0x3f6942){_0x355a15[_0x2662('0x3')](_0x1ff8b0,_0x3f6942);};}function removeListener(_0x242b48,_0x529b58){return function(){FaxQueueEvents[_0x2662('0x4')](_0x242b48,_0x529b58);};}exports[_0x2662('0x5')]=function(_0x3d0652){for(var _0x522a0f=0x0,_0x39a207=events[_0x2662('0x6')];_0x522a0f<_0x39a207;_0x522a0f++){var _0x53ddcc=events[_0x522a0f];var _0x2c9481=createListener(_0x2662('0x7')+_0x53ddcc,_0x3d0652);FaxQueueEvents['on'](_0x53ddcc,_0x2c9481);}}; \ No newline at end of file +var _0x8169=['remove','update','removeListener','register','./faxQueue.events','save'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8169,0x112));var _0x9816=function(_0x45a240,_0x2846bf){_0x45a240=_0x45a240-0x0;var _0x3e10e1=_0x8169[_0x45a240];return _0x3e10e1;};'use strict';var FaxQueueEvents=require(_0x9816('0x0'));var events=[_0x9816('0x1'),_0x9816('0x2'),_0x9816('0x3')];function createListener(_0x20b882,_0x30c068){return function(_0x46a677){_0x30c068['emit'](_0x20b882,_0x46a677);};}function removeListener(_0x4fa24b,_0x2da916){return function(){FaxQueueEvents[_0x9816('0x4')](_0x4fa24b,_0x2da916);};}exports[_0x9816('0x5')]=function(_0x95b962){for(var _0x540d5f=0x0,_0x345ff4=events['length'];_0x540d5f<_0x345ff4;_0x540d5f++){var _0x4f7750=events[_0x540d5f];var _0x2035b1=createListener('faxQueue:'+_0x4f7750,_0x95b962);FaxQueueEvents['on'](_0x4f7750,_0x2035b1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 86e2fae..6db7e90 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xb10b[_0x213518];return _0x1baf75;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x128904,_0x3867e1){var _0x25c2d5=function(_0x5438f0){while(--_0x5438f0){_0x128904['push'](_0x128904['shift']());}};_0x25c2d5(++_0x3867e1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7441b39..324cbce 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 _0xd67f=['DATE','moment','sequelize','exports','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd67f,0x137));var _0xfd67=function(_0x1d2db0,_0x137b35){_0x1d2db0=_0x1d2db0-0x0;var _0x4548a9=_0xd67f[_0x1d2db0];return _0x4548a9;};'use strict';var moment=require(_0xfd67('0x0'));var Sequelize=require(_0xfd67('0x1'));module[_0xfd67('0x2')]={'uniqueid':{'type':Sequelize[_0xfd67('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xfd67('0x3')]},'joinAt':{'type':Sequelize[_0xfd67('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfd67('0x4')]},'reason':{'type':Sequelize[_0xfd67('0x3')]}}; \ No newline at end of file +var _0x1d8f=['exports','STRING','DATE','sequelize'];(function(_0x2fb9a5,_0x13e734){var _0x73c22b=function(_0x2b4ce3){while(--_0x2b4ce3){_0x2fb9a5['push'](_0x2fb9a5['shift']());}};_0x73c22b(++_0x13e734);}(_0x1d8f,0x1df));var _0xf1d8=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x1d8f[_0x47b58b];return _0x46bebe;};'use strict';var moment=require('moment');var Sequelize=require(_0xf1d8('0x0'));module[_0xf1d8('0x1')]={'uniqueid':{'type':Sequelize[_0xf1d8('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf1d8('0x2')]},'joinAt':{'type':Sequelize[_0xf1d8('0x3')]},'leaveAt':{'type':Sequelize[_0xf1d8('0x3')]},'acceptAt':{'type':Sequelize[_0xf1d8('0x3')]},'exitAt':{'type':Sequelize[_0xf1d8('0x3')]},'reason':{'type':Sequelize[_0xf1d8('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 1a1e926..0aba37c 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 _0x51fd=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','params','filtears','include','find','catch','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','lodash','squel','crypto','desk.js'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x51fd,0x17a));var _0xd51f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x51fd[_0x32f7d7];return _0x133d09;};'use strict';var pdf=require(_0xd51f('0x0'));var emlformat=require(_0xd51f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd51f('0x2'));var jsonpatch=require(_0xd51f('0x3'));var rp=require(_0xd51f('0x4'));var moment=require(_0xd51f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd51f('0x6'));var util=require('util');var path=require(_0xd51f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd51f('0x8'));var squel=require(_0xd51f('0x9'));var crypto=require(_0xd51f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd51f('0xb'));var toCsv=require(_0xd51f('0xc'));var querystring=require(_0xd51f('0xd'));var Papa=require(_0xd51f('0xe'));var Redis=require('ioredis');var authService=require(_0xd51f('0xf'));var qs=require(_0xd51f('0x10'));var as=require(_0xd51f('0x11'));var hardwareService=require(_0xd51f('0x12'));var logger=require(_0xd51f('0x13'))(_0xd51f('0x14'));var utils=require(_0xd51f('0x15'));var config=require(_0xd51f('0x16'));var licenseUtil=require(_0xd51f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x146582,_0x5c108a){_0x5c108a=_0x5c108a||0xcc;return function(_0xe9827d){if(_0xe9827d){return _0x146582[_0xd51f('0x18')](_0x5c108a);}return _0x146582[_0xd51f('0x19')](_0x5c108a)[_0xd51f('0x1a')]();};}function respondWithResult(_0x254550,_0x598362){_0x598362=_0x598362||0xc8;return function(_0x168a29){if(_0x168a29){return _0x254550['status'](_0x598362)[_0xd51f('0x1b')](_0x168a29);}};}function respondWithFilteredResult(_0x4e095b,_0x467b1b){return function(_0x49259a){if(_0x49259a){var _0x32ec72=_0x49259a[_0xd51f('0x1c')],_0x2f3a0c=_0x467b1b['offset'],_0x5b4ad2=_0x467b1b[_0xd51f('0x1d')]+_0x467b1b['limit'],_0x3c802a;if(_0x5b4ad2>=_0x32ec72){_0x5b4ad2=_0x32ec72;_0x3c802a=0xc8;}else{_0x3c802a=0xce;}_0x4e095b[_0xd51f('0x19')](_0x3c802a);return _0x4e095b[_0xd51f('0x1e')](_0xd51f('0x1f'),_0x2f3a0c+'-'+_0x5b4ad2+'/'+_0x32ec72)[_0xd51f('0x1b')](_0x49259a);}return null;};}function patchUpdates(_0x4363cd){return function(_0x3fbb4a){try{jsonpatch[_0xd51f('0x20')](_0x3fbb4a,_0x4363cd,!![]);}catch(_0x379e4d){return BPromise[_0xd51f('0x21')](_0x379e4d);}return _0x3fbb4a[_0xd51f('0x22')]();};}function saveUpdates(_0x2e324b,_0xff25c6){return function(_0x1ada84){if(_0x1ada84){return _0x1ada84[_0xd51f('0x23')](_0x2e324b)[_0xd51f('0x24')](function(_0x6be1a4){return _0x6be1a4;});}return null;};}function removeEntity(_0x40dd3c,_0x107d62){return function(_0x10a5d1){if(_0x10a5d1){return _0x10a5d1['destroy']()[_0xd51f('0x24')](function(){_0x40dd3c['status'](0xcc)[_0xd51f('0x1a')]();});}};}function handleEntityNotFound(_0x922d2d,_0x1a6bf6){return function(_0x1f2ff9){if(!_0x1f2ff9){_0x922d2d['sendStatus'](0x194);}return _0x1f2ff9;};}function handleError(_0x1adfce,_0x53b163){_0x53b163=_0x53b163||0x1f4;return function(_0x1a019f){logger[_0xd51f('0x25')](_0x1a019f[_0xd51f('0x26')]);if(_0x1a019f[_0xd51f('0x27')]){delete _0x1a019f['name'];}_0x1adfce[_0xd51f('0x19')](_0x53b163)[_0xd51f('0x28')](_0x1a019f);};}exports['index']=function(_0x1b4d6a,_0x333ce1){var _0x452c21={},_0x5217db={},_0x2ba83f={'count':0x0,'rows':[]};var _0x5c12ec=_[_0xd51f('0x29')](db[_0xd51f('0x2a')][_0xd51f('0x2b')],function(_0x211cb4){return{'name':_0x211cb4[_0xd51f('0x2c')],'type':_0x211cb4[_0xd51f('0x2d')]['key']};});_0x5217db[_0xd51f('0x2e')]=_[_0xd51f('0x29')](_0x5c12ec,_0xd51f('0x27'));_0x5217db[_0xd51f('0x2f')]=_[_0xd51f('0x30')](_0x1b4d6a[_0xd51f('0x2f')]);_0x5217db[_0xd51f('0x31')]=_[_0xd51f('0x32')](_0x5217db[_0xd51f('0x2e')],_0x5217db[_0xd51f('0x2f')]);_0x452c21[_0xd51f('0x33')]=_[_0xd51f('0x32')](_0x5217db[_0xd51f('0x2e')],qs[_0xd51f('0x34')](_0x1b4d6a[_0xd51f('0x2f')]['fields']));_0x452c21[_0xd51f('0x33')]=_0x452c21[_0xd51f('0x33')][_0xd51f('0x35')]?_0x452c21['attributes']:_0x5217db['model'];if(!_0x1b4d6a['query'][_0xd51f('0x36')](_0xd51f('0x37'))){_0x452c21[_0xd51f('0x38')]=qs[_0xd51f('0x38')](_0x1b4d6a[_0xd51f('0x2f')][_0xd51f('0x38')]);_0x452c21['offset']=qs[_0xd51f('0x1d')](_0x1b4d6a[_0xd51f('0x2f')][_0xd51f('0x1d')]);}_0x452c21[_0xd51f('0x39')]=qs['sort'](_0x1b4d6a[_0xd51f('0x2f')][_0xd51f('0x3a')]);_0x452c21['where']=qs['filters'](_[_0xd51f('0x3b')](_0x1b4d6a[_0xd51f('0x2f')],_0x5217db[_0xd51f('0x31')]),_0x5c12ec);if(_0x1b4d6a[_0xd51f('0x2f')][_0xd51f('0x3c')]){_0x452c21['where']=_[_0xd51f('0x3d')](_0x452c21[_0xd51f('0x3e')],{'$or':_['map'](_0x5c12ec,function(_0x33d55f){if(_0x33d55f[_0xd51f('0x2d')]!==_0xd51f('0x3f')){var _0x58eecc={};_0x58eecc[_0x33d55f['name']]={'$like':'%'+_0x1b4d6a[_0xd51f('0x2f')]['filter']+'%'};return _0x58eecc;}})});}_0x452c21=_[_0xd51f('0x3d')]({},_0x452c21,_0x1b4d6a[_0xd51f('0x40')]);var _0x3c64d4={'where':_0x452c21[_0xd51f('0x3e')]};return db[_0xd51f('0x2a')][_0xd51f('0x1c')](_0x3c64d4)[_0xd51f('0x24')](function(_0x417d98){_0x2ba83f[_0xd51f('0x1c')]=_0x417d98;if(_0x1b4d6a[_0xd51f('0x2f')][_0xd51f('0x41')]){_0x452c21['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xd51f('0x42')](_0x452c21);})[_0xd51f('0x24')](function(_0x3580ae){_0x2ba83f[_0xd51f('0x43')]=_0x3580ae;return _0x2ba83f;})[_0xd51f('0x24')](respondWithFilteredResult(_0x333ce1,_0x452c21))['catch'](handleError(_0x333ce1,null));};exports[_0xd51f('0x44')]=function(_0xf4392d,_0x3dcdf8){var _0x14eb7b={'raw':!![],'where':{'id':_0xf4392d[_0xd51f('0x45')]['id']}},_0x27fcc8={};_0x27fcc8['model']=_['keys'](db[_0xd51f('0x2a')][_0xd51f('0x2b')]);_0x27fcc8[_0xd51f('0x2f')]=_[_0xd51f('0x30')](_0xf4392d[_0xd51f('0x2f')]);_0x27fcc8[_0xd51f('0x46')]=_['intersection'](_0x27fcc8[_0xd51f('0x2e')],_0x27fcc8[_0xd51f('0x2f')]);_0x14eb7b['attributes']=_[_0xd51f('0x32')](_0x27fcc8['model'],qs[_0xd51f('0x34')](_0xf4392d[_0xd51f('0x2f')][_0xd51f('0x34')]));_0x14eb7b[_0xd51f('0x33')]=_0x14eb7b[_0xd51f('0x33')]['length']?_0x14eb7b[_0xd51f('0x33')]:_0x27fcc8[_0xd51f('0x2e')];if(_0xf4392d[_0xd51f('0x2f')][_0xd51f('0x41')]){_0x14eb7b[_0xd51f('0x47')]=[{'all':!![]}];}_0x14eb7b=_[_0xd51f('0x3d')]({},_0x14eb7b,_0xf4392d[_0xd51f('0x40')]);return db['FaxQueueReport'][_0xd51f('0x48')](_0x14eb7b)[_0xd51f('0x24')](handleEntityNotFound(_0x3dcdf8,null))[_0xd51f('0x24')](respondWithResult(_0x3dcdf8,null))[_0xd51f('0x49')](handleError(_0x3dcdf8,null));};exports[_0xd51f('0x4a')]=function(_0x5789ec,_0x49f4b3){return db['FaxQueueReport'][_0xd51f('0x4a')](_0x5789ec[_0xd51f('0x4b')],{})[_0xd51f('0x24')](respondWithResult(_0x49f4b3,0xc9))[_0xd51f('0x49')](handleError(_0x49f4b3,null));};exports[_0xd51f('0x23')]=function(_0x50bde2,_0x4554da){if(_0x50bde2[_0xd51f('0x4b')]['id']){delete _0x50bde2[_0xd51f('0x4b')]['id'];}return db['FaxQueueReport'][_0xd51f('0x48')]({'where':{'id':_0x50bde2[_0xd51f('0x45')]['id']}})['then'](handleEntityNotFound(_0x4554da,null))['then'](saveUpdates(_0x50bde2[_0xd51f('0x4b')],null))[_0xd51f('0x24')](respondWithResult(_0x4554da,null))['catch'](handleError(_0x4554da,null));};exports[_0xd51f('0x4c')]=function(_0x4602e6,_0x3a1e95){return db[_0xd51f('0x2a')][_0xd51f('0x48')]({'where':{'id':_0x4602e6[_0xd51f('0x45')]['id']}})[_0xd51f('0x24')](handleEntityNotFound(_0x3a1e95,null))[_0xd51f('0x24')](removeEntity(_0x3a1e95,null))[_0xd51f('0x49')](handleError(_0x3a1e95,null));};exports['describe']=function(_0x4b642f,_0x49c501){return db[_0xd51f('0x2a')][_0xd51f('0x4d')]()[_0xd51f('0x24')](respondWithResult(_0x49c501,null))[_0xd51f('0x49')](handleError(_0x49c501,null));}; \ No newline at end of file +var _0x7ed7=['map','FaxQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','filtears','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','index'];(function(_0x5f4eda,_0x192efe){var _0x38654d=function(_0x26ba72){while(--_0x26ba72){_0x5f4eda['push'](_0x5f4eda['shift']());}};_0x38654d(++_0x192efe);}(_0x7ed7,0x1ef));var _0x77ed=function(_0x144c33,_0x4f7860){_0x144c33=_0x144c33-0x0;var _0x5e6f01=_0x7ed7[_0x144c33];return _0x5e6f01;};'use strict';var pdf=require(_0x77ed('0x0'));var emlformat=require(_0x77ed('0x1'));var rimraf=require(_0x77ed('0x2'));var zipdir=require(_0x77ed('0x3'));var jsonpatch=require(_0x77ed('0x4'));var rp=require(_0x77ed('0x5'));var moment=require(_0x77ed('0x6'));var BPromise=require(_0x77ed('0x7'));var Mustache=require(_0x77ed('0x8'));var util=require(_0x77ed('0x9'));var path=require(_0x77ed('0xa'));var sox=require(_0x77ed('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x77ed('0xc'));var crypto=require(_0x77ed('0xd'));var jsforce=require(_0x77ed('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x77ed('0xf'));var querystring=require(_0x77ed('0x10'));var Papa=require(_0x77ed('0x11'));var Redis=require(_0x77ed('0x12'));var authService=require(_0x77ed('0x13'));var qs=require(_0x77ed('0x14'));var as=require(_0x77ed('0x15'));var hardwareService=require(_0x77ed('0x16'));var logger=require('../../config/logger')(_0x77ed('0x17'));var utils=require(_0x77ed('0x18'));var config=require(_0x77ed('0x19'));var licenseUtil=require(_0x77ed('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51eb6c,_0x2d4b1d){_0x2d4b1d=_0x2d4b1d||0xcc;return function(_0x233db7){if(_0x233db7){return _0x51eb6c[_0x77ed('0x1b')](_0x2d4b1d);}return _0x51eb6c[_0x77ed('0x1c')](_0x2d4b1d)[_0x77ed('0x1d')]();};}function respondWithResult(_0x4a087a,_0x3e2f6e){_0x3e2f6e=_0x3e2f6e||0xc8;return function(_0x3369c7){if(_0x3369c7){return _0x4a087a[_0x77ed('0x1c')](_0x3e2f6e)[_0x77ed('0x1e')](_0x3369c7);}};}function respondWithFilteredResult(_0x144f9b,_0x472938){return function(_0x37e022){if(_0x37e022){var _0x2ac8c0=_0x37e022[_0x77ed('0x1f')],_0x589514=_0x472938[_0x77ed('0x20')],_0x4d0b3a=_0x472938['offset']+_0x472938[_0x77ed('0x21')],_0x29d9a2;if(_0x4d0b3a>=_0x2ac8c0){_0x4d0b3a=_0x2ac8c0;_0x29d9a2=0xc8;}else{_0x29d9a2=0xce;}_0x144f9b['status'](_0x29d9a2);return _0x144f9b[_0x77ed('0x22')](_0x77ed('0x23'),_0x589514+'-'+_0x4d0b3a+'/'+_0x2ac8c0)[_0x77ed('0x1e')](_0x37e022);}return null;};}function patchUpdates(_0x44a720){return function(_0x7de1fd){try{jsonpatch[_0x77ed('0x24')](_0x7de1fd,_0x44a720,!![]);}catch(_0x3c7477){return BPromise[_0x77ed('0x25')](_0x3c7477);}return _0x7de1fd[_0x77ed('0x26')]();};}function saveUpdates(_0x20023d,_0x22caf9){return function(_0x17cce4){if(_0x17cce4){return _0x17cce4[_0x77ed('0x27')](_0x20023d)[_0x77ed('0x28')](function(_0x1012a2){return _0x1012a2;});}return null;};}function removeEntity(_0x249efe,_0xdf6873){return function(_0x1e7d4f){if(_0x1e7d4f){return _0x1e7d4f[_0x77ed('0x29')]()[_0x77ed('0x28')](function(){_0x249efe[_0x77ed('0x1c')](0xcc)[_0x77ed('0x1d')]();});}};}function handleEntityNotFound(_0x2fb646,_0x30a238){return function(_0x204d42){if(!_0x204d42){_0x2fb646[_0x77ed('0x1b')](0x194);}return _0x204d42;};}function handleError(_0x3417c2,_0x2740a1){_0x2740a1=_0x2740a1||0x1f4;return function(_0x58ef40){logger['error'](_0x58ef40['stack']);if(_0x58ef40[_0x77ed('0x2a')]){delete _0x58ef40[_0x77ed('0x2a')];}_0x3417c2[_0x77ed('0x1c')](_0x2740a1)['send'](_0x58ef40);};}exports[_0x77ed('0x2b')]=function(_0x48aff8,_0x416416){var _0x4a72ed={},_0x169757={},_0x59f14f={'count':0x0,'rows':[]};var _0x188932=_[_0x77ed('0x2c')](db[_0x77ed('0x2d')][_0x77ed('0x2e')],function(_0x105371){return{'name':_0x105371[_0x77ed('0x2f')],'type':_0x105371[_0x77ed('0x30')][_0x77ed('0x31')]};});_0x169757[_0x77ed('0x32')]=_['map'](_0x188932,_0x77ed('0x2a'));_0x169757['query']=_[_0x77ed('0x33')](_0x48aff8[_0x77ed('0x34')]);_0x169757[_0x77ed('0x35')]=_[_0x77ed('0x36')](_0x169757[_0x77ed('0x32')],_0x169757[_0x77ed('0x34')]);_0x4a72ed[_0x77ed('0x37')]=_[_0x77ed('0x36')](_0x169757[_0x77ed('0x32')],qs[_0x77ed('0x38')](_0x48aff8[_0x77ed('0x34')]['fields']));_0x4a72ed[_0x77ed('0x37')]=_0x4a72ed[_0x77ed('0x37')][_0x77ed('0x39')]?_0x4a72ed[_0x77ed('0x37')]:_0x169757[_0x77ed('0x32')];if(!_0x48aff8[_0x77ed('0x34')][_0x77ed('0x3a')](_0x77ed('0x3b'))){_0x4a72ed['limit']=qs[_0x77ed('0x21')](_0x48aff8['query'][_0x77ed('0x21')]);_0x4a72ed[_0x77ed('0x20')]=qs[_0x77ed('0x20')](_0x48aff8[_0x77ed('0x34')][_0x77ed('0x20')]);}_0x4a72ed[_0x77ed('0x3c')]=qs[_0x77ed('0x3d')](_0x48aff8[_0x77ed('0x34')][_0x77ed('0x3d')]);_0x4a72ed['where']=qs['filters'](_['pick'](_0x48aff8[_0x77ed('0x34')],_0x169757[_0x77ed('0x35')]),_0x188932);if(_0x48aff8['query'][_0x77ed('0x3e')]){_0x4a72ed['where']=_[_0x77ed('0x3f')](_0x4a72ed[_0x77ed('0x40')],{'$or':_[_0x77ed('0x2c')](_0x188932,function(_0x509917){if(_0x509917['type']!==_0x77ed('0x41')){var _0x45e6e2={};_0x45e6e2[_0x509917[_0x77ed('0x2a')]]={'$like':'%'+_0x48aff8[_0x77ed('0x34')][_0x77ed('0x3e')]+'%'};return _0x45e6e2;}})});}_0x4a72ed=_['merge']({},_0x4a72ed,_0x48aff8[_0x77ed('0x42')]);var _0x2793af={'where':_0x4a72ed[_0x77ed('0x40')]};return db[_0x77ed('0x2d')][_0x77ed('0x1f')](_0x2793af)[_0x77ed('0x28')](function(_0x1142b9){_0x59f14f['count']=_0x1142b9;if(_0x48aff8[_0x77ed('0x34')][_0x77ed('0x43')]){_0x4a72ed[_0x77ed('0x44')]=[{'all':!![]}];}return db[_0x77ed('0x2d')]['findAll'](_0x4a72ed);})[_0x77ed('0x28')](function(_0x44be4c){_0x59f14f[_0x77ed('0x45')]=_0x44be4c;return _0x59f14f;})[_0x77ed('0x28')](respondWithFilteredResult(_0x416416,_0x4a72ed))[_0x77ed('0x46')](handleError(_0x416416,null));};exports['show']=function(_0x16fa78,_0x4c5071){var _0x3a6ef0={'raw':!![],'where':{'id':_0x16fa78['params']['id']}},_0x35c8ae={};_0x35c8ae[_0x77ed('0x32')]=_[_0x77ed('0x33')](db['FaxQueueReport'][_0x77ed('0x2e')]);_0x35c8ae[_0x77ed('0x34')]=_[_0x77ed('0x33')](_0x16fa78[_0x77ed('0x34')]);_0x35c8ae[_0x77ed('0x47')]=_[_0x77ed('0x36')](_0x35c8ae['model'],_0x35c8ae['query']);_0x3a6ef0[_0x77ed('0x37')]=_[_0x77ed('0x36')](_0x35c8ae[_0x77ed('0x32')],qs[_0x77ed('0x38')](_0x16fa78[_0x77ed('0x34')][_0x77ed('0x38')]));_0x3a6ef0[_0x77ed('0x37')]=_0x3a6ef0[_0x77ed('0x37')]['length']?_0x3a6ef0[_0x77ed('0x37')]:_0x35c8ae['model'];if(_0x16fa78[_0x77ed('0x34')][_0x77ed('0x43')]){_0x3a6ef0[_0x77ed('0x44')]=[{'all':!![]}];}_0x3a6ef0=_[_0x77ed('0x3f')]({},_0x3a6ef0,_0x16fa78[_0x77ed('0x42')]);return db[_0x77ed('0x2d')]['find'](_0x3a6ef0)[_0x77ed('0x28')](handleEntityNotFound(_0x4c5071,null))[_0x77ed('0x28')](respondWithResult(_0x4c5071,null))[_0x77ed('0x46')](handleError(_0x4c5071,null));};exports[_0x77ed('0x48')]=function(_0x341e83,_0x5c4b54){return db[_0x77ed('0x2d')][_0x77ed('0x48')](_0x341e83['body'],{})[_0x77ed('0x28')](respondWithResult(_0x5c4b54,0xc9))[_0x77ed('0x46')](handleError(_0x5c4b54,null));};exports[_0x77ed('0x27')]=function(_0x1cae47,_0x380db0){if(_0x1cae47['body']['id']){delete _0x1cae47[_0x77ed('0x49')]['id'];}return db[_0x77ed('0x2d')][_0x77ed('0x4a')]({'where':{'id':_0x1cae47[_0x77ed('0x4b')]['id']}})[_0x77ed('0x28')](handleEntityNotFound(_0x380db0,null))[_0x77ed('0x28')](saveUpdates(_0x1cae47[_0x77ed('0x49')],null))[_0x77ed('0x28')](respondWithResult(_0x380db0,null))[_0x77ed('0x46')](handleError(_0x380db0,null));};exports[_0x77ed('0x29')]=function(_0x3dcf01,_0x4c6b05){return db[_0x77ed('0x2d')][_0x77ed('0x4a')]({'where':{'id':_0x3dcf01[_0x77ed('0x4b')]['id']}})[_0x77ed('0x28')](handleEntityNotFound(_0x4c6b05,null))['then'](removeEntity(_0x4c6b05,null))[_0x77ed('0x46')](handleError(_0x4c6b05,null));};exports['describe']=function(_0x3f7933,_0x53562a){return db[_0x77ed('0x2d')][_0x77ed('0x4c')]()[_0x77ed('0x28')](respondWithResult(_0x53562a,null))[_0x77ed('0x46')](handleError(_0x53562a,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d1372eb..29eb5c7 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 _0xcf58=['exports','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./faxQueueReport.attributes'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xcf58,0x16c));var _0x8cf5=function(_0x77b0f,_0x1c0c8d){_0x77b0f=_0x77b0f-0x0;var _0x357ea4=_0xcf58[_0x77b0f];return _0x357ea4;};'use strict';var _=require(_0x8cf5('0x0'));var util=require(_0x8cf5('0x1'));var logger=require(_0x8cf5('0x2'))(_0x8cf5('0x3'));var moment=require(_0x8cf5('0x4'));var BPromise=require(_0x8cf5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8cf5('0x6'));var attributes=require(_0x8cf5('0x7'));module[_0x8cf5('0x8')]=function(_0x448cae,_0x532767){return _0x448cae[_0x8cf5('0x9')]('FaxQueueReport',attributes,{'tableName':_0x8cf5('0xa'),'paranoid':![],'indexes':[{'name':_0x8cf5('0xb'),'fields':[_0x8cf5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8214=['uniqueid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./faxQueueReport.attributes','FaxQueueReport','report_fax_queue'];(function(_0x3b15a5,_0x5cd1c5){var _0x2b221d=function(_0x195d86){while(--_0x195d86){_0x3b15a5['push'](_0x3b15a5['shift']());}};_0x2b221d(++_0x5cd1c5);}(_0x8214,0x155));var _0x4821=function(_0x4ffe55,_0xc0009f){_0x4ffe55=_0x4ffe55-0x0;var _0x3d7f69=_0x8214[_0x4ffe55];return _0x3d7f69;};'use strict';var _=require(_0x4821('0x0'));var util=require('util');var logger=require(_0x4821('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4821('0x2'));var rp=require(_0x4821('0x3'));var fs=require('fs');var path=require(_0x4821('0x4'));var rimraf=require(_0x4821('0x5'));var config=require('../../config/environment');var attributes=require(_0x4821('0x6'));module['exports']=function(_0x3b9bc2,_0x39f7ca){return _0x3b9bc2['define'](_0x4821('0x7'),attributes,{'tableName':_0x4821('0x8'),'paranoid':![],'indexes':[{'name':_0x4821('0x9'),'fields':[_0x4821('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 8cf49b5..ec103fa 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 _0xbeaa=['../../config/environment','jayson/promise','client','request','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','create','options','raw','info','UpdateFaxQueueReport','FaxQueueReport','body','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xbeaa,0x100));var _0xabea=function(_0x485ee8,_0x2acea5){_0x485ee8=_0x485ee8-0x0;var _0x45143d=_0xbeaa[_0x485ee8];return _0x45143d;};'use strict';var _=require(_0xabea('0x0'));var util=require(_0xabea('0x1'));var moment=require(_0xabea('0x2'));var BPromise=require(_0xabea('0x3'));var rs=require(_0xabea('0x4'));var fs=require('fs');var Redis=require(_0xabea('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabea('0x6'));var logger=require('../../config/logger')(_0xabea('0x7'));var config=require(_0xabea('0x8'));var jayson=require(_0xabea('0x9'));var client=jayson[_0xabea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bdc19,_0x423c6b,_0x1c450f){return new BPromise(function(_0xf77d5b,_0x3bab13){return client[_0xabea('0xb')](_0x5bdc19,_0x1c450f)['then'](function(_0x171801){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x423c6b,_0xabea('0xc'));logger[_0xabea('0xd')](_0xabea('0xe'),_0x423c6b,'request\x20sent',JSON[_0xabea('0xf')](_0x171801));if(_0x171801[_0xabea('0x10')]){if(_0x171801[_0xabea('0x10')][_0xabea('0x11')]===0x1f4){logger['error'](_0xabea('0x12'),_0x423c6b,_0x171801[_0xabea('0x10')][_0xabea('0x13')]);return _0x3bab13(_0x171801[_0xabea('0x10')][_0xabea('0x13')]);}logger[_0xabea('0x10')](_0xabea('0x12'),_0x423c6b,_0x171801[_0xabea('0x10')][_0xabea('0x13')]);return _0xf77d5b(_0x171801[_0xabea('0x10')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x423c6b,'request\x20sent');_0xf77d5b(_0x171801[_0xabea('0x14')]['message']);}})[_0xabea('0x15')](function(_0x101104){logger[_0xabea('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x423c6b,_0x101104);_0x3bab13(_0x101104);});});}exports['CreateFaxQueueReport']=function(_0x468a81){var _0x2e4080=this;return new Promise(function(_0x16cf2b,_0x14c910){return db['FaxQueueReport'][_0xabea('0x16')](_0x468a81['body'],{'raw':_0x468a81[_0xabea('0x17')]?_0x468a81['options'][_0xabea('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xb5f8a7){logger[_0xabea('0x19')]('CreateFaxQueueReport',_0x468a81);logger['debug']('CreateFaxQueueReport',_0x468a81,JSON[_0xabea('0xf')](_0xb5f8a7));_0x16cf2b(_0xb5f8a7);})['catch'](function(_0x35a53b){logger[_0xabea('0x10')]('CreateFaxQueueReport',_0x35a53b[_0xabea('0x13')],_0x468a81);_0x14c910(_0x2e4080['error'](0x1f4,_0x35a53b['message']));});});};exports[_0xabea('0x1a')]=function(_0xee9387){var _0x1b00f7=this;return new Promise(function(_0x115691,_0x63ac09){return db[_0xabea('0x1b')]['update'](_0xee9387[_0xabea('0x1c')],{'raw':_0xee9387[_0xabea('0x17')]?_0xee9387[_0xabea('0x17')][_0xabea('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xee9387[_0xabea('0x17')]?_0xee9387[_0xabea('0x17')][_0xabea('0x1d')]||null:null,'attributes':_0xee9387[_0xabea('0x17')]?_0xee9387[_0xabea('0x17')][_0xabea('0x1e')]||null:null,'limit':_0xee9387[_0xabea('0x17')]?_0xee9387[_0xabea('0x17')][_0xabea('0x1f')]||null:null})[_0xabea('0x20')](function(_0x44f9f8){logger['info']('UpdateFaxQueueReport',_0xee9387);logger[_0xabea('0xd')](_0xabea('0x1a'),_0xee9387,JSON[_0xabea('0xf')](_0x44f9f8));_0x115691(_0x44f9f8);})[_0xabea('0x15')](function(_0x63ce53){logger[_0xabea('0x10')](_0xabea('0x1a'),_0x63ce53[_0xabea('0x13')],_0xee9387);_0x63ac09(_0x1b00f7['error'](0x1f4,_0x63ce53['message']));});});}; \ No newline at end of file +var _0xf2f7=['request\x20sent','stringify','error','code','message','info','result','catch','FaxQueueReport','create','options','raw','CreateFaxQueueReport','UpdateFaxQueueReport','update','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xf2f7,0x7a));var _0x7f2f=function(_0x297239,_0x371385){_0x297239=_0x297239-0x0;var _0xfa8f30=_0xf2f7[_0x297239];return _0xfa8f30;};'use strict';var _=require('lodash');var util=require(_0x7f2f('0x0'));var moment=require(_0x7f2f('0x1'));var BPromise=require(_0x7f2f('0x2'));var rs=require(_0x7f2f('0x3'));var fs=require('fs');var Redis=require(_0x7f2f('0x4'));var db=require(_0x7f2f('0x5'))['db'];var utils=require(_0x7f2f('0x6'));var logger=require(_0x7f2f('0x7'))(_0x7f2f('0x8'));var config=require(_0x7f2f('0x9'));var jayson=require(_0x7f2f('0xa'));var client=jayson[_0x7f2f('0xb')][_0x7f2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3276fb,_0x427042,_0x2918e6){return new BPromise(function(_0x477f09,_0x2f1e4f){return client[_0x7f2f('0xd')](_0x3276fb,_0x2918e6)[_0x7f2f('0xe')](function(_0x4c1283){logger['info'](_0x7f2f('0xf'),_0x427042,'request\x20sent');logger[_0x7f2f('0x10')](_0x7f2f('0x11'),_0x427042,_0x7f2f('0x12'),JSON[_0x7f2f('0x13')](_0x4c1283));if(_0x4c1283[_0x7f2f('0x14')]){if(_0x4c1283[_0x7f2f('0x14')][_0x7f2f('0x15')]===0x1f4){logger[_0x7f2f('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x427042,_0x4c1283[_0x7f2f('0x14')][_0x7f2f('0x16')]);return _0x2f1e4f(_0x4c1283[_0x7f2f('0x14')]['message']);}logger[_0x7f2f('0x14')]('FaxQueueReport,\x20%s,\x20%s',_0x427042,_0x4c1283['error'][_0x7f2f('0x16')]);return _0x477f09(_0x4c1283[_0x7f2f('0x14')][_0x7f2f('0x16')]);}else{logger[_0x7f2f('0x17')](_0x7f2f('0xf'),_0x427042,_0x7f2f('0x12'));_0x477f09(_0x4c1283[_0x7f2f('0x18')]['message']);}})[_0x7f2f('0x19')](function(_0x2045ad){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x427042,_0x2045ad);_0x2f1e4f(_0x2045ad);});});}exports['CreateFaxQueueReport']=function(_0x3ee8f0){var _0x310089=this;return new Promise(function(_0x2a81f9,_0x348589){return db[_0x7f2f('0x1a')][_0x7f2f('0x1b')](_0x3ee8f0['body'],{'raw':_0x3ee8f0['options']?_0x3ee8f0[_0x7f2f('0x1c')][_0x7f2f('0x1d')]===undefined?!![]:![]:!![]})[_0x7f2f('0xe')](function(_0xb1bd99){logger[_0x7f2f('0x17')](_0x7f2f('0x1e'),_0x3ee8f0);logger['debug'](_0x7f2f('0x1e'),_0x3ee8f0,JSON[_0x7f2f('0x13')](_0xb1bd99));_0x2a81f9(_0xb1bd99);})[_0x7f2f('0x19')](function(_0x1802e9){logger[_0x7f2f('0x14')](_0x7f2f('0x1e'),_0x1802e9[_0x7f2f('0x16')],_0x3ee8f0);_0x348589(_0x310089[_0x7f2f('0x14')](0x1f4,_0x1802e9[_0x7f2f('0x16')]));});});};exports[_0x7f2f('0x1f')]=function(_0x1385d3){var _0x171770=this;return new Promise(function(_0x398c85,_0x2984e8){return db['FaxQueueReport'][_0x7f2f('0x20')](_0x1385d3['body'],{'raw':_0x1385d3[_0x7f2f('0x1c')]?_0x1385d3[_0x7f2f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1385d3[_0x7f2f('0x1c')]?_0x1385d3[_0x7f2f('0x1c')][_0x7f2f('0x21')]||null:null,'attributes':_0x1385d3[_0x7f2f('0x1c')]?_0x1385d3[_0x7f2f('0x1c')][_0x7f2f('0x22')]||null:null,'limit':_0x1385d3[_0x7f2f('0x1c')]?_0x1385d3['options']['limit']||null:null})['then'](function(_0xa52149){logger[_0x7f2f('0x17')](_0x7f2f('0x1f'),_0x1385d3);logger[_0x7f2f('0x10')](_0x7f2f('0x1f'),_0x1385d3,JSON['stringify'](_0xa52149));_0x398c85(_0xa52149);})[_0x7f2f('0x19')](function(_0x40c512){logger['error'](_0x7f2f('0x1f'),_0x40c512[_0x7f2f('0x16')],_0x1385d3);_0x2984e8(_0x171770['error'](0x1f4,_0x40c512[_0x7f2f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5c47bef..070c4a7 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 _0x48c9=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x48c9,0xd8));var _0x948c=function(_0x627b1b,_0x462114){_0x627b1b=_0x627b1b-0x0;var _0x2fd022=_0x48c9[_0x627b1b];return _0x2fd022;};'use strict';var multer=require('multer');var util=require(_0x948c('0x0'));var path=require('path');var timeout=require(_0x948c('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x948c('0x2'));var interaction=require(_0x948c('0x3'));var config=require('../../config/environment');var controller=require(_0x948c('0x4'));router['get']('/',auth[_0x948c('0x5')](),controller[_0x948c('0x6')]);router[_0x948c('0x7')](_0x948c('0x8'),auth[_0x948c('0x5')](),controller[_0x948c('0x9')]);router['get'](_0x948c('0xa'),auth[_0x948c('0x5')](),controller[_0x948c('0xb')]);router[_0x948c('0xc')]('/',auth[_0x948c('0x5')](),controller['create']);router[_0x948c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x948c('0xe')]);router[_0x948c('0xf')](_0x948c('0xa'),auth[_0x948c('0x5')](),controller[_0x948c('0x10')]);module[_0x948c('0x11')]=router; \ No newline at end of file +var _0x9e17=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x9e17,0x1f0));var _0x79e1=function(_0x2b6c01,_0x4a1d39){_0x2b6c01=_0x2b6c01-0x0;var _0x4c051e=_0x9e17[_0x2b6c01];return _0x4c051e;};'use strict';var multer=require(_0x79e1('0x0'));var util=require(_0x79e1('0x1'));var path=require(_0x79e1('0x2'));var timeout=require(_0x79e1('0x3'));var express=require(_0x79e1('0x4'));var router=express[_0x79e1('0x5')]();var auth=require(_0x79e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x79e1('0x7'));var controller=require('./faxQueueReport.controller');router[_0x79e1('0x8')]('/',auth[_0x79e1('0x9')](),controller[_0x79e1('0xa')]);router['get']('/describe',auth[_0x79e1('0x9')](),controller[_0x79e1('0xb')]);router[_0x79e1('0x8')](_0x79e1('0xc'),auth[_0x79e1('0x9')](),controller[_0x79e1('0xd')]);router[_0x79e1('0xe')]('/',auth[_0x79e1('0x9')](),controller[_0x79e1('0xf')]);router[_0x79e1('0x10')](_0x79e1('0xc'),auth['isAuthenticated'](),controller[_0x79e1('0x11')]);router[_0x79e1('0x12')](_0x79e1('0xc'),auth[_0x79e1('0x9')](),controller['destroy']);module[_0x79e1('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index eadfd82..ae5eae4 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 _0xea7f=['account','agent','queue','DATE','NOW','STRING','ENUM'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xea7f,0x171));var _0xfea7=function(_0x2599a8,_0x20d758){_0x2599a8=_0x2599a8-0x0;var _0x56b6ad=_0xea7f[_0x2599a8];return _0x56b6ad;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfea7('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfea7('0x1')](_0xfea7('0x2'),_0xfea7('0x3'),'queue'),'allowNull':![],'defaultValue':_0xfea7('0x4')},'transferredAt':{'type':Sequelize[_0xfea7('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xfea7('0x6')]}}; \ No newline at end of file +var _0x85da=['NOW','moment','STRING','ENUM','account','agent','queue','DATE'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x85da,0x121));var _0xa85d=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x85da[_0xaa1b3e];return _0x454d7d;};'use strict';var moment=require(_0xa85d('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xa85d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa85d('0x2')](_0xa85d('0x3'),_0xa85d('0x4'),_0xa85d('0x5')),'allowNull':![],'defaultValue':_0xa85d('0x5')},'transferredAt':{'type':Sequelize[_0xa85d('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xa85d('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e31cdf2..de05a0d 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 _0x31fe=['stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','FaxTransferReport','includeAll','findAll','catch','show','filtears','include','options','find','create','body','update','params','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error'];(function(_0x3ae8f4,_0x2920f4){var _0x367312=function(_0x4dffbf){while(--_0x4dffbf){_0x3ae8f4['push'](_0x3ae8f4['shift']());}};_0x367312(++_0x2920f4);}(_0x31fe,0x198));var _0xe31f=function(_0x15bba7,_0x5c9d96){_0x15bba7=_0x15bba7-0x0;var _0x310dbd=_0x31fe[_0x15bba7];return _0x310dbd;};'use strict';var pdf=require(_0xe31f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe31f('0x1'));var zipdir=require(_0xe31f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe31f('0x3'));var moment=require('moment');var BPromise=require(_0xe31f('0x4'));var Mustache=require('mustache');var util=require(_0xe31f('0x5'));var path=require(_0xe31f('0x6'));var sox=require(_0xe31f('0x7'));var csv=require(_0xe31f('0x8'));var ejs=require(_0xe31f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe31f('0xa'));var jsforce=require(_0xe31f('0xb'));var deskjs=require(_0xe31f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe31f('0xd'));var Papa=require(_0xe31f('0xe'));var Redis=require(_0xe31f('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe31f('0x10'));var hardwareService=require(_0xe31f('0x11'));var logger=require(_0xe31f('0x12'))(_0xe31f('0x13'));var utils=require(_0xe31f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe31f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34f7df,_0xe62a4f){_0xe62a4f=_0xe62a4f||0xcc;return function(_0x75741a){if(_0x75741a){return _0x34f7df[_0xe31f('0x16')](_0xe62a4f);}return _0x34f7df[_0xe31f('0x17')](_0xe62a4f)[_0xe31f('0x18')]();};}function respondWithResult(_0x40cf99,_0x3b78cb){_0x3b78cb=_0x3b78cb||0xc8;return function(_0x48a6bd){if(_0x48a6bd){return _0x40cf99[_0xe31f('0x17')](_0x3b78cb)['json'](_0x48a6bd);}};}function respondWithFilteredResult(_0x22d5ac,_0x230502){return function(_0x358497){if(_0x358497){var _0x3fa736=_0x358497[_0xe31f('0x19')],_0x2f6eca=_0x230502[_0xe31f('0x1a')],_0x5d3aa2=_0x230502[_0xe31f('0x1a')]+_0x230502[_0xe31f('0x1b')],_0x2d7a9a;if(_0x5d3aa2>=_0x3fa736){_0x5d3aa2=_0x3fa736;_0x2d7a9a=0xc8;}else{_0x2d7a9a=0xce;}_0x22d5ac[_0xe31f('0x17')](_0x2d7a9a);return _0x22d5ac[_0xe31f('0x1c')](_0xe31f('0x1d'),_0x2f6eca+'-'+_0x5d3aa2+'/'+_0x3fa736)[_0xe31f('0x1e')](_0x358497);}return null;};}function patchUpdates(_0x54b43e){return function(_0x45f370){try{jsonpatch[_0xe31f('0x1f')](_0x45f370,_0x54b43e,!![]);}catch(_0x3b0984){return BPromise['reject'](_0x3b0984);}return _0x45f370[_0xe31f('0x20')]();};}function saveUpdates(_0x295e7f,_0x449b99){return function(_0x17e349){if(_0x17e349){return _0x17e349['update'](_0x295e7f)[_0xe31f('0x21')](function(_0x38f92c){return _0x38f92c;});}return null;};}function removeEntity(_0x50c73e,_0x270236){return function(_0x14a100){if(_0x14a100){return _0x14a100[_0xe31f('0x22')]()[_0xe31f('0x21')](function(){_0x50c73e[_0xe31f('0x17')](0xcc)[_0xe31f('0x18')]();});}};}function handleEntityNotFound(_0x4c3843,_0x150162){return function(_0x2f7fcb){if(!_0x2f7fcb){_0x4c3843[_0xe31f('0x16')](0x194);}return _0x2f7fcb;};}function handleError(_0x367809,_0x15f342){_0x15f342=_0x15f342||0x1f4;return function(_0x3d106a){logger[_0xe31f('0x23')](_0x3d106a[_0xe31f('0x24')]);if(_0x3d106a['name']){delete _0x3d106a['name'];}_0x367809[_0xe31f('0x17')](_0x15f342)['send'](_0x3d106a);};}exports[_0xe31f('0x25')]=function(_0x20b220,_0x2942f6){var _0xd917b={},_0x44c10b={},_0x7e7eb={'count':0x0,'rows':[]};var _0x46f9e3=_[_0xe31f('0x26')](db['FaxTransferReport'][_0xe31f('0x27')],function(_0x161033){return{'name':_0x161033[_0xe31f('0x28')],'type':_0x161033[_0xe31f('0x29')][_0xe31f('0x2a')]};});_0x44c10b[_0xe31f('0x2b')]=_[_0xe31f('0x26')](_0x46f9e3,_0xe31f('0x2c'));_0x44c10b[_0xe31f('0x2d')]=_[_0xe31f('0x2e')](_0x20b220[_0xe31f('0x2d')]);_0x44c10b[_0xe31f('0x2f')]=_[_0xe31f('0x30')](_0x44c10b['model'],_0x44c10b['query']);_0xd917b['attributes']=_['intersection'](_0x44c10b[_0xe31f('0x2b')],qs[_0xe31f('0x31')](_0x20b220[_0xe31f('0x2d')][_0xe31f('0x31')]));_0xd917b[_0xe31f('0x32')]=_0xd917b['attributes'][_0xe31f('0x33')]?_0xd917b['attributes']:_0x44c10b[_0xe31f('0x2b')];if(!_0x20b220['query'][_0xe31f('0x34')]('nolimit')){_0xd917b[_0xe31f('0x1b')]=qs[_0xe31f('0x1b')](_0x20b220[_0xe31f('0x2d')][_0xe31f('0x1b')]);_0xd917b[_0xe31f('0x1a')]=qs[_0xe31f('0x1a')](_0x20b220[_0xe31f('0x2d')][_0xe31f('0x1a')]);}_0xd917b[_0xe31f('0x35')]=qs[_0xe31f('0x36')](_0x20b220[_0xe31f('0x2d')][_0xe31f('0x36')]);_0xd917b[_0xe31f('0x37')]=qs[_0xe31f('0x2f')](_[_0xe31f('0x38')](_0x20b220[_0xe31f('0x2d')],_0x44c10b[_0xe31f('0x2f')]),_0x46f9e3);if(_0x20b220[_0xe31f('0x2d')][_0xe31f('0x39')]){_0xd917b[_0xe31f('0x37')]=_['merge'](_0xd917b[_0xe31f('0x37')],{'$or':_[_0xe31f('0x26')](_0x46f9e3,function(_0x3bf6bf){if(_0x3bf6bf[_0xe31f('0x29')]!==_0xe31f('0x3a')){var _0x3ce190={};_0x3ce190[_0x3bf6bf[_0xe31f('0x2c')]]={'$like':'%'+_0x20b220[_0xe31f('0x2d')][_0xe31f('0x39')]+'%'};return _0x3ce190;}})});}_0xd917b=_[_0xe31f('0x3b')]({},_0xd917b,_0x20b220['options']);var _0x3b1f45={'where':_0xd917b[_0xe31f('0x37')]};return db[_0xe31f('0x3c')][_0xe31f('0x19')](_0x3b1f45)['then'](function(_0x34f288){_0x7e7eb[_0xe31f('0x19')]=_0x34f288;if(_0x20b220['query'][_0xe31f('0x3d')]){_0xd917b['include']=[{'all':!![]}];}return db[_0xe31f('0x3c')][_0xe31f('0x3e')](_0xd917b);})[_0xe31f('0x21')](function(_0x1fa5c9){_0x7e7eb['rows']=_0x1fa5c9;return _0x7e7eb;})[_0xe31f('0x21')](respondWithFilteredResult(_0x2942f6,_0xd917b))[_0xe31f('0x3f')](handleError(_0x2942f6,null));};exports[_0xe31f('0x40')]=function(_0x4d78a1,_0x5ae50b){var _0x1e042c={'raw':!![],'where':{'id':_0x4d78a1['params']['id']}},_0x15cd4a={};_0x15cd4a[_0xe31f('0x2b')]=_['keys'](db[_0xe31f('0x3c')][_0xe31f('0x27')]);_0x15cd4a['query']=_[_0xe31f('0x2e')](_0x4d78a1['query']);_0x15cd4a[_0xe31f('0x41')]=_['intersection'](_0x15cd4a[_0xe31f('0x2b')],_0x15cd4a[_0xe31f('0x2d')]);_0x1e042c[_0xe31f('0x32')]=_[_0xe31f('0x30')](_0x15cd4a[_0xe31f('0x2b')],qs[_0xe31f('0x31')](_0x4d78a1['query'][_0xe31f('0x31')]));_0x1e042c[_0xe31f('0x32')]=_0x1e042c['attributes'][_0xe31f('0x33')]?_0x1e042c['attributes']:_0x15cd4a['model'];if(_0x4d78a1[_0xe31f('0x2d')]['includeAll']){_0x1e042c[_0xe31f('0x42')]=[{'all':!![]}];}_0x1e042c=_['merge']({},_0x1e042c,_0x4d78a1[_0xe31f('0x43')]);return db[_0xe31f('0x3c')][_0xe31f('0x44')](_0x1e042c)[_0xe31f('0x21')](handleEntityNotFound(_0x5ae50b,null))[_0xe31f('0x21')](respondWithResult(_0x5ae50b,null))[_0xe31f('0x3f')](handleError(_0x5ae50b,null));};exports[_0xe31f('0x45')]=function(_0x4acd61,_0x47472b){return db[_0xe31f('0x3c')][_0xe31f('0x45')](_0x4acd61[_0xe31f('0x46')],{})['then'](respondWithResult(_0x47472b,0xc9))[_0xe31f('0x3f')](handleError(_0x47472b,null));};exports[_0xe31f('0x47')]=function(_0x23b7a1,_0x254125){if(_0x23b7a1[_0xe31f('0x46')]['id']){delete _0x23b7a1[_0xe31f('0x46')]['id'];}return db['FaxTransferReport'][_0xe31f('0x44')]({'where':{'id':_0x23b7a1['params']['id']}})['then'](handleEntityNotFound(_0x254125,null))[_0xe31f('0x21')](saveUpdates(_0x23b7a1[_0xe31f('0x46')],null))[_0xe31f('0x21')](respondWithResult(_0x254125,null))[_0xe31f('0x3f')](handleError(_0x254125,null));};exports[_0xe31f('0x22')]=function(_0x47c52b,_0x3ca34e){return db[_0xe31f('0x3c')][_0xe31f('0x44')]({'where':{'id':_0x47c52b[_0xe31f('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ca34e,null))[_0xe31f('0x21')](removeEntity(_0x3ca34e,null))['catch'](handleError(_0x3ca34e,null));};exports[_0xe31f('0x49')]=function(_0x252f6c,_0x2aea3f){return db['FaxTransferReport']['describe']()[_0xe31f('0x21')](respondWithResult(_0x2aea3f,null))[_0xe31f('0x3f')](handleError(_0x2aea3f,null));}; \ No newline at end of file +var _0x24ea=['lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','FaxTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','catch','show','params','includeAll','include','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x24ea,0x1ee));var _0xa24e=function(_0x5ce089,_0x49fdd3){_0x5ce089=_0x5ce089-0x0;var _0x20c63b=_0x24ea[_0x5ce089];return _0x20c63b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa24e('0x0'));var rimraf=require(_0xa24e('0x1'));var zipdir=require(_0xa24e('0x2'));var jsonpatch=require(_0xa24e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa24e('0x4'));var Mustache=require(_0xa24e('0x5'));var util=require(_0xa24e('0x6'));var path=require('path');var sox=require(_0xa24e('0x7'));var csv=require(_0xa24e('0x8'));var ejs=require(_0xa24e('0x9'));var fs=require('fs');var _=require(_0xa24e('0xa'));var squel=require(_0xa24e('0xb'));var crypto=require(_0xa24e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa24e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa24e('0xe'));var Redis=require('ioredis');var authService=require(_0xa24e('0xf'));var qs=require(_0xa24e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa24e('0x11'));var logger=require('../../config/logger')(_0xa24e('0x12'));var utils=require('../../config/utils');var config=require(_0xa24e('0x13'));var licenseUtil=require(_0xa24e('0x14'));var db=require(_0xa24e('0x15'))['db'];function respondWithStatusCode(_0x21f459,_0x236d43){_0x236d43=_0x236d43||0xcc;return function(_0x34b4e8){if(_0x34b4e8){return _0x21f459[_0xa24e('0x16')](_0x236d43);}return _0x21f459[_0xa24e('0x17')](_0x236d43)[_0xa24e('0x18')]();};}function respondWithResult(_0x2d215b,_0x35ebc9){_0x35ebc9=_0x35ebc9||0xc8;return function(_0x1097cb){if(_0x1097cb){return _0x2d215b[_0xa24e('0x17')](_0x35ebc9)[_0xa24e('0x19')](_0x1097cb);}};}function respondWithFilteredResult(_0x1ba4dd,_0x5d319d){return function(_0x2f74d6){if(_0x2f74d6){var _0x56a004=_0x2f74d6['count'],_0x3b19eb=_0x5d319d[_0xa24e('0x1a')],_0x3aeabc=_0x5d319d[_0xa24e('0x1a')]+_0x5d319d[_0xa24e('0x1b')],_0x351f1d;if(_0x3aeabc>=_0x56a004){_0x3aeabc=_0x56a004;_0x351f1d=0xc8;}else{_0x351f1d=0xce;}_0x1ba4dd[_0xa24e('0x17')](_0x351f1d);return _0x1ba4dd[_0xa24e('0x1c')]('Content-Range',_0x3b19eb+'-'+_0x3aeabc+'/'+_0x56a004)[_0xa24e('0x19')](_0x2f74d6);}return null;};}function patchUpdates(_0x5154ff){return function(_0x6f968f){try{jsonpatch[_0xa24e('0x1d')](_0x6f968f,_0x5154ff,!![]);}catch(_0xe8bfc3){return BPromise[_0xa24e('0x1e')](_0xe8bfc3);}return _0x6f968f['save']();};}function saveUpdates(_0x2cf900,_0x3f7026){return function(_0x2c3fd4){if(_0x2c3fd4){return _0x2c3fd4['update'](_0x2cf900)[_0xa24e('0x1f')](function(_0x144e61){return _0x144e61;});}return null;};}function removeEntity(_0x2bd4cc,_0x14ba2a){return function(_0x52acd4){if(_0x52acd4){return _0x52acd4[_0xa24e('0x20')]()[_0xa24e('0x1f')](function(){_0x2bd4cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36abe7,_0x4556ea){return function(_0xce6f26){if(!_0xce6f26){_0x36abe7['sendStatus'](0x194);}return _0xce6f26;};}function handleError(_0x1f55a3,_0x432ece){_0x432ece=_0x432ece||0x1f4;return function(_0x2f574b){logger[_0xa24e('0x21')](_0x2f574b[_0xa24e('0x22')]);if(_0x2f574b[_0xa24e('0x23')]){delete _0x2f574b['name'];}_0x1f55a3[_0xa24e('0x17')](_0x432ece)[_0xa24e('0x24')](_0x2f574b);};}exports['index']=function(_0x1e2f98,_0x133666){var _0x244c2c={},_0x188d68={},_0x11fb23={'count':0x0,'rows':[]};var _0x2d10ff=_['map'](db[_0xa24e('0x25')][_0xa24e('0x26')],function(_0x173197){return{'name':_0x173197[_0xa24e('0x27')],'type':_0x173197[_0xa24e('0x28')]['key']};});_0x188d68[_0xa24e('0x29')]=_[_0xa24e('0x2a')](_0x2d10ff,_0xa24e('0x23'));_0x188d68[_0xa24e('0x2b')]=_[_0xa24e('0x2c')](_0x1e2f98[_0xa24e('0x2b')]);_0x188d68[_0xa24e('0x2d')]=_['intersection'](_0x188d68['model'],_0x188d68[_0xa24e('0x2b')]);_0x244c2c[_0xa24e('0x2e')]=_[_0xa24e('0x2f')](_0x188d68['model'],qs[_0xa24e('0x30')](_0x1e2f98[_0xa24e('0x2b')][_0xa24e('0x30')]));_0x244c2c['attributes']=_0x244c2c[_0xa24e('0x2e')][_0xa24e('0x31')]?_0x244c2c[_0xa24e('0x2e')]:_0x188d68[_0xa24e('0x29')];if(!_0x1e2f98[_0xa24e('0x2b')][_0xa24e('0x32')](_0xa24e('0x33'))){_0x244c2c[_0xa24e('0x1b')]=qs['limit'](_0x1e2f98[_0xa24e('0x2b')][_0xa24e('0x1b')]);_0x244c2c[_0xa24e('0x1a')]=qs['offset'](_0x1e2f98[_0xa24e('0x2b')][_0xa24e('0x1a')]);}_0x244c2c[_0xa24e('0x34')]=qs[_0xa24e('0x35')](_0x1e2f98[_0xa24e('0x2b')][_0xa24e('0x35')]);_0x244c2c[_0xa24e('0x36')]=qs[_0xa24e('0x2d')](_[_0xa24e('0x37')](_0x1e2f98['query'],_0x188d68['filters']),_0x2d10ff);if(_0x1e2f98['query'][_0xa24e('0x38')]){_0x244c2c['where']=_[_0xa24e('0x39')](_0x244c2c['where'],{'$or':_[_0xa24e('0x2a')](_0x2d10ff,function(_0x5b4b40){if(_0x5b4b40[_0xa24e('0x28')]!==_0xa24e('0x3a')){var _0x36c24c={};_0x36c24c[_0x5b4b40['name']]={'$like':'%'+_0x1e2f98['query']['filter']+'%'};return _0x36c24c;}})});}_0x244c2c=_[_0xa24e('0x39')]({},_0x244c2c,_0x1e2f98['options']);var _0x73efb={'where':_0x244c2c[_0xa24e('0x36')]};return db[_0xa24e('0x25')][_0xa24e('0x3b')](_0x73efb)[_0xa24e('0x1f')](function(_0x4f36c9){_0x11fb23[_0xa24e('0x3b')]=_0x4f36c9;if(_0x1e2f98['query']['includeAll']){_0x244c2c['include']=[{'all':!![]}];}return db[_0xa24e('0x25')][_0xa24e('0x3c')](_0x244c2c);})[_0xa24e('0x1f')](function(_0x34892d){_0x11fb23['rows']=_0x34892d;return _0x11fb23;})['then'](respondWithFilteredResult(_0x133666,_0x244c2c))[_0xa24e('0x3d')](handleError(_0x133666,null));};exports[_0xa24e('0x3e')]=function(_0x13ebff,_0x3ce595){var _0x4e4041={'raw':!![],'where':{'id':_0x13ebff[_0xa24e('0x3f')]['id']}},_0x92c5fa={};_0x92c5fa[_0xa24e('0x29')]=_[_0xa24e('0x2c')](db[_0xa24e('0x25')][_0xa24e('0x26')]);_0x92c5fa[_0xa24e('0x2b')]=_[_0xa24e('0x2c')](_0x13ebff[_0xa24e('0x2b')]);_0x92c5fa['filtears']=_[_0xa24e('0x2f')](_0x92c5fa[_0xa24e('0x29')],_0x92c5fa[_0xa24e('0x2b')]);_0x4e4041[_0xa24e('0x2e')]=_['intersection'](_0x92c5fa[_0xa24e('0x29')],qs[_0xa24e('0x30')](_0x13ebff['query'][_0xa24e('0x30')]));_0x4e4041[_0xa24e('0x2e')]=_0x4e4041['attributes'][_0xa24e('0x31')]?_0x4e4041[_0xa24e('0x2e')]:_0x92c5fa[_0xa24e('0x29')];if(_0x13ebff[_0xa24e('0x2b')][_0xa24e('0x40')]){_0x4e4041[_0xa24e('0x41')]=[{'all':!![]}];}_0x4e4041=_['merge']({},_0x4e4041,_0x13ebff[_0xa24e('0x42')]);return db['FaxTransferReport'][_0xa24e('0x43')](_0x4e4041)[_0xa24e('0x1f')](handleEntityNotFound(_0x3ce595,null))[_0xa24e('0x1f')](respondWithResult(_0x3ce595,null))[_0xa24e('0x3d')](handleError(_0x3ce595,null));};exports['create']=function(_0x4b8a07,_0x36cc52){return db['FaxTransferReport'][_0xa24e('0x44')](_0x4b8a07[_0xa24e('0x45')],{})[_0xa24e('0x1f')](respondWithResult(_0x36cc52,0xc9))['catch'](handleError(_0x36cc52,null));};exports[_0xa24e('0x46')]=function(_0x41b4ec,_0x12fb13){if(_0x41b4ec[_0xa24e('0x45')]['id']){delete _0x41b4ec[_0xa24e('0x45')]['id'];}return db[_0xa24e('0x25')][_0xa24e('0x43')]({'where':{'id':_0x41b4ec[_0xa24e('0x3f')]['id']}})[_0xa24e('0x1f')](handleEntityNotFound(_0x12fb13,null))[_0xa24e('0x1f')](saveUpdates(_0x41b4ec[_0xa24e('0x45')],null))[_0xa24e('0x1f')](respondWithResult(_0x12fb13,null))[_0xa24e('0x3d')](handleError(_0x12fb13,null));};exports[_0xa24e('0x20')]=function(_0x377273,_0x31907b){return db[_0xa24e('0x25')][_0xa24e('0x43')]({'where':{'id':_0x377273['params']['id']}})[_0xa24e('0x1f')](handleEntityNotFound(_0x31907b,null))['then'](removeEntity(_0x31907b,null))[_0xa24e('0x3d')](handleError(_0x31907b,null));};exports[_0xa24e('0x47')]=function(_0x31a783,_0x39c3b8){return db[_0xa24e('0x25')][_0xa24e('0x47')]()['then'](respondWithResult(_0x39c3b8,null))['catch'](handleError(_0x39c3b8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a558ea3..342f637 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 _0xed22=['bluebird','request-promise','path','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x4b19e3,_0x2b63c3){var _0x2ce22a=function(_0x5c1fac){while(--_0x5c1fac){_0x4b19e3['push'](_0x4b19e3['shift']());}};_0x2ce22a(++_0x2b63c3);}(_0xed22,0x1e5));var _0x2ed2=function(_0xbdbb75,_0x487f6b){_0xbdbb75=_0xbdbb75-0x0;var _0x51cb40=_0xed22[_0xbdbb75];return _0x51cb40;};'use strict';var _=require(_0x2ed2('0x0'));var util=require(_0x2ed2('0x1'));var logger=require(_0x2ed2('0x2'))(_0x2ed2('0x3'));var moment=require(_0x2ed2('0x4'));var BPromise=require(_0x2ed2('0x5'));var rp=require(_0x2ed2('0x6'));var fs=require('fs');var path=require(_0x2ed2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2ed2('0x8'));module[_0x2ed2('0x9')]=function(_0x3b0103,_0x21cf4b){return _0x3b0103[_0x2ed2('0xa')](_0x2ed2('0xb'),attributes,{'tableName':_0x2ed2('0xc'),'paranoid':![],'indexes':[{'name':_0x2ed2('0xd'),'fields':[_0x2ed2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11d1=['./faxTransferReport.attributes','define','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x42b7ed,_0x2fb2a6){var _0x4222aa=function(_0x2395a5){while(--_0x2395a5){_0x42b7ed['push'](_0x42b7ed['shift']());}};_0x4222aa(++_0x2fb2a6);}(_0x11d1,0x7d));var _0x111d=function(_0x58b0ed,_0x37170c){_0x58b0ed=_0x58b0ed-0x0;var _0x18d150=_0x11d1[_0x58b0ed];return _0x18d150;};'use strict';var _=require(_0x111d('0x0'));var util=require('util');var logger=require(_0x111d('0x1'))(_0x111d('0x2'));var moment=require(_0x111d('0x3'));var BPromise=require('bluebird');var rp=require(_0x111d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x111d('0x5'));var config=require(_0x111d('0x6'));var attributes=require(_0x111d('0x7'));module['exports']=function(_0x3801dc,_0x463ef6){return _0x3801dc[_0x111d('0x8')]('FaxTransferReport',attributes,{'tableName':_0x111d('0x9'),'paranoid':![],'indexes':[{'name':_0x111d('0xa'),'fields':[_0x111d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f288593..8b6e63b 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 _0xb436=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis'];(function(_0x503d40,_0x33643f){var _0x271598=function(_0x3de9f2){while(--_0x3de9f2){_0x503d40['push'](_0x503d40['shift']());}};_0x271598(++_0x33643f);}(_0xb436,0x1b2));var _0x6b43=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0xb436[_0x30c2ae];return _0x1ee1cc;};'use strict';var _=require(_0x6b43('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b43('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b43('0x2'));var db=require(_0x6b43('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b43('0x4'))(_0x6b43('0x5'));var config=require(_0x6b43('0x6'));var jayson=require(_0x6b43('0x7'));var client=jayson[_0x6b43('0x8')][_0x6b43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1003e2,_0x1e9739,_0x216192){return new BPromise(function(_0x1df685,_0x1e2f3e){return client[_0x6b43('0xa')](_0x1003e2,_0x216192)[_0x6b43('0xb')](function(_0x2cce2e){logger['info'](_0x6b43('0xc'),_0x1e9739,_0x6b43('0xd'));logger[_0x6b43('0xe')](_0x6b43('0xf'),_0x1e9739,_0x6b43('0xd'),JSON[_0x6b43('0x10')](_0x2cce2e));if(_0x2cce2e[_0x6b43('0x11')]){if(_0x2cce2e['error'][_0x6b43('0x12')]===0x1f4){logger[_0x6b43('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1e9739,_0x2cce2e[_0x6b43('0x11')]['message']);return _0x1e2f3e(_0x2cce2e['error']['message']);}logger['error'](_0x6b43('0xc'),_0x1e9739,_0x2cce2e[_0x6b43('0x11')][_0x6b43('0x13')]);return _0x1df685(_0x2cce2e['error'][_0x6b43('0x13')]);}else{logger[_0x6b43('0x14')](_0x6b43('0xc'),_0x1e9739,_0x6b43('0xd'));_0x1df685(_0x2cce2e[_0x6b43('0x15')][_0x6b43('0x13')]);}})[_0x6b43('0x16')](function(_0x5dfb28){logger[_0x6b43('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1e9739,_0x5dfb28);_0x1e2f3e(_0x5dfb28);});});} \ No newline at end of file +var _0x2f3f=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x345705,_0x2829c1){var _0x22c250=function(_0x4ae124){while(--_0x4ae124){_0x345705['push'](_0x345705['shift']());}};_0x22c250(++_0x2829c1);}(_0x2f3f,0x12b));var _0xf2f3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2f3f[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf2f3('0x0'));var util=require(_0xf2f3('0x1'));var moment=require('moment');var BPromise=require(_0xf2f3('0x2'));var rs=require(_0xf2f3('0x3'));var fs=require('fs');var Redis=require(_0xf2f3('0x4'));var db=require(_0xf2f3('0x5'))['db'];var utils=require(_0xf2f3('0x6'));var logger=require(_0xf2f3('0x7'))('rpc');var config=require(_0xf2f3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf2f3('0x9')][_0xf2f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19fdce,_0x511ca0,_0x36afb5){return new BPromise(function(_0x5d3b45,_0x157fdb){return client[_0xf2f3('0xb')](_0x19fdce,_0x36afb5)[_0xf2f3('0xc')](function(_0x445280){logger[_0xf2f3('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x511ca0,_0xf2f3('0xe'));logger[_0xf2f3('0xf')](_0xf2f3('0x10'),_0x511ca0,'request\x20sent',JSON['stringify'](_0x445280));if(_0x445280[_0xf2f3('0x11')]){if(_0x445280[_0xf2f3('0x11')][_0xf2f3('0x12')]===0x1f4){logger[_0xf2f3('0x11')](_0xf2f3('0x13'),_0x511ca0,_0x445280[_0xf2f3('0x11')][_0xf2f3('0x14')]);return _0x157fdb(_0x445280[_0xf2f3('0x11')]['message']);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x511ca0,_0x445280[_0xf2f3('0x11')][_0xf2f3('0x14')]);return _0x5d3b45(_0x445280[_0xf2f3('0x11')][_0xf2f3('0x14')]);}else{logger[_0xf2f3('0xd')](_0xf2f3('0x13'),_0x511ca0,_0xf2f3('0xe'));_0x5d3b45(_0x445280[_0xf2f3('0x15')][_0xf2f3('0x14')]);}})[_0xf2f3('0x16')](function(_0x3f64a8){logger[_0xf2f3('0x11')](_0xf2f3('0x13'),_0x511ca0,_0x3f64a8);_0x157fdb(_0x3f64a8);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0032191..66e828f 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 _0x35f9=['express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe','get','show','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout'];(function(_0x143475,_0x458e84){var _0x491066=function(_0x509171){while(--_0x509171){_0x143475['push'](_0x143475['shift']());}};_0x491066(++_0x458e84);}(_0x35f9,0x75));var _0x935f=function(_0x34e4c9,_0xf904f0){_0x34e4c9=_0x34e4c9-0x0;var _0x5e855d=_0x35f9[_0x34e4c9];return _0x5e855d;};'use strict';var multer=require('multer');var util=require(_0x935f('0x0'));var path=require(_0x935f('0x1'));var timeout=require(_0x935f('0x2'));var express=require(_0x935f('0x3'));var router=express[_0x935f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x935f('0x5'));var config=require(_0x935f('0x6'));var controller=require(_0x935f('0x7'));router['get']('/',auth[_0x935f('0x8')](),controller[_0x935f('0x9')]);router['get'](_0x935f('0xa'),auth[_0x935f('0x8')](),controller['describe']);router[_0x935f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x935f('0xc')]);router[_0x935f('0xd')]('/',auth['isAuthenticated'](),controller[_0x935f('0xe')]);router[_0x935f('0xf')](_0x935f('0x10'),auth['isAuthenticated'](),controller[_0x935f('0x11')]);router['delete'](_0x935f('0x10'),auth['isAuthenticated'](),controller[_0x935f('0x12')]);module[_0x935f('0x13')]=router; \ No newline at end of file +var _0x45e4=['path','connect-timeout','express','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','exports','multer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x45e4,0xcb));var _0x445e=function(_0x1942b1,_0x3861ad){_0x1942b1=_0x1942b1-0x0;var _0x3421b5=_0x45e4[_0x1942b1];return _0x3421b5;};'use strict';var multer=require(_0x445e('0x0'));var util=require('util');var path=require(_0x445e('0x1'));var timeout=require(_0x445e('0x2'));var express=require(_0x445e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x445e('0x4'));var controller=require(_0x445e('0x5'));router['get']('/',auth[_0x445e('0x6')](),controller[_0x445e('0x7')]);router[_0x445e('0x8')]('/describe',auth[_0x445e('0x6')](),controller[_0x445e('0x9')]);router[_0x445e('0x8')]('/:id',auth[_0x445e('0x6')](),controller[_0x445e('0xa')]);router[_0x445e('0xb')]('/',auth['isAuthenticated'](),controller[_0x445e('0xc')]);router[_0x445e('0xd')](_0x445e('0xe'),auth[_0x445e('0x6')](),controller['update']);router['delete'](_0x445e('0xe'),auth[_0x445e('0x6')](),controller[_0x445e('0xf')]);module[_0x445e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0c4bd90..0351216 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 _0x7f42=['Router','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f42,0x1dd));var _0x27f4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x7f42[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x27f4('0x0'));var util=require('util');var path=require(_0x27f4('0x1'));var timeout=require(_0x27f4('0x2'));var express=require('express');var router=express[_0x27f4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x27f4('0x4'));var config=require('../../config/environment');var controller=require(_0x27f4('0x5'));router['get']('/',auth[_0x27f4('0x6')](),controller['index']);router[_0x27f4('0x7')](_0x27f4('0x8'),auth[_0x27f4('0x6')](),controller[_0x27f4('0x9')]);router[_0x27f4('0x7')](_0x27f4('0xa'),auth[_0x27f4('0x6')](),controller[_0x27f4('0xb')]);router[_0x27f4('0x7')](_0x27f4('0xc'),auth[_0x27f4('0x6')](),controller[_0x27f4('0xd')]);router[_0x27f4('0xe')]('/',auth[_0x27f4('0x6')](),controller[_0x27f4('0xf')]);router[_0x27f4('0xe')](_0x27f4('0xa'),auth[_0x27f4('0x6')](),controller['addConfiguration']);router['put'](_0x27f4('0x8'),auth[_0x27f4('0x6')](),controller[_0x27f4('0x10')]);router[_0x27f4('0x11')](_0x27f4('0x8'),auth[_0x27f4('0x6')](),controller[_0x27f4('0x12')]);module[_0x27f4('0x13')]=router; \ No newline at end of file +var _0x98a8=['./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x98a8,0x12c));var _0x898a=function(_0x1dff28,_0x523a18){_0x1dff28=_0x1dff28-0x0;var _0x5edcbf=_0x98a8[_0x1dff28];return _0x5edcbf;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['get'](_0x898a('0xe'),auth[_0x898a('0xa')](),controller[_0x898a('0xf')]);router[_0x898a('0x9')](_0x898a('0x10'),auth[_0x898a('0xa')](),controller[_0x898a('0x11')]);router[_0x898a('0x12')]('/',auth[_0x898a('0xa')](),controller['create']);router[_0x898a('0x12')]('/:id/configurations',auth[_0x898a('0xa')](),controller['addConfiguration']);router[_0x898a('0x13')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x898a('0xa')](),controller[_0x898a('0x14')]);module[_0x898a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 2c63fa5..206e352 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 _0x75d5=['sequelize','exports','STRING','ENUM','integrationTab','newTab'];(function(_0x5c6210,_0x1310b7){var _0xe4c7a1=function(_0x1fa4c9){while(--_0x1fa4c9){_0x5c6210['push'](_0x5c6210['shift']());}};_0xe4c7a1(++_0x1310b7);}(_0x75d5,0x17a));var _0x575d=function(_0xd8e80e,_0x434b6f){_0xd8e80e=_0xd8e80e-0x0;var _0x634e2f=_0x75d5[_0xd8e80e];return _0x634e2f;};'use strict';var Sequelize=require(_0x575d('0x0'));module[_0x575d('0x1')]={'name':{'type':Sequelize[_0x575d('0x2')]},'description':{'type':Sequelize[_0x575d('0x2')]},'username':{'type':Sequelize[_0x575d('0x2')]},'remoteUri':{'type':Sequelize[_0x575d('0x2')]},'authType':{'type':Sequelize[_0x575d('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x575d('0x2')]},'consumerSecret':{'type':Sequelize[_0x575d('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x575d('0x2')]},'serverUrl':{'type':Sequelize[_0x575d('0x2')]},'type':{'type':Sequelize[_0x575d('0x3')](_0x575d('0x4'),_0x575d('0x5')),'defaultValue':_0x575d('0x4')}}; \ No newline at end of file +var _0x7e18=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x7e18,0x133));var _0x87e1=function(_0x19ba0a,_0x2c1db8){_0x19ba0a=_0x19ba0a-0x0;var _0x13a8b7=_0x7e18[_0x19ba0a];return _0x13a8b7;};'use strict';var Sequelize=require(_0x87e1('0x0'));module[_0x87e1('0x1')]={'name':{'type':Sequelize[_0x87e1('0x2')]},'description':{'type':Sequelize[_0x87e1('0x2')]},'username':{'type':Sequelize[_0x87e1('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x87e1('0x3')](_0x87e1('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x87e1('0x2')]},'consumerKey':{'type':Sequelize[_0x87e1('0x2')]},'consumerSecret':{'type':Sequelize[_0x87e1('0x2')]},'token':{'type':Sequelize[_0x87e1('0x2')]},'tokenSecret':{'type':Sequelize[_0x87e1('0x2')]},'serverUrl':{'type':Sequelize[_0x87e1('0x2')]},'type':{'type':Sequelize[_0x87e1('0x3')](_0x87e1('0x5'),_0x87e1('0x6')),'defaultValue':_0x87e1('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 407030c..543e678 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 _0xf7be=['create','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','%s:%s','toString','base64','concat','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','then','end','stack','send','map','DeskAccount','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','type','VIRTUAL','filter','include','rows','show','filtears','includeAll','find','body','update','params','destroy','getConfigurations','findOne','pick','options','addConfiguration','AccountId','Subjects','channel','getDescriptions'];(function(_0x436f03,_0x4c574f){var _0x1678e2=function(_0x13741c){while(--_0x13741c){_0x436f03['push'](_0x436f03['shift']());}};_0x1678e2(++_0x4c574f);}(_0xf7be,0x9e));var _0xef7b=function(_0x35af36,_0x5126f1){_0x35af36=_0x35af36-0x0;var _0x1ed151=_0xf7be[_0x35af36];return _0x1ed151;};'use strict';var pdf=require(_0xef7b('0x0'));var emlformat=require(_0xef7b('0x1'));var rimraf=require(_0xef7b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef7b('0x3'));var moment=require('moment');var BPromise=require(_0xef7b('0x4'));var Mustache=require(_0xef7b('0x5'));var util=require(_0xef7b('0x6'));var path=require(_0xef7b('0x7'));var sox=require(_0xef7b('0x8'));var csv=require(_0xef7b('0x9'));var ejs=require(_0xef7b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xef7b('0xb'));var crypto=require(_0xef7b('0xc'));var jsforce=require(_0xef7b('0xd'));var deskjs=require(_0xef7b('0xe'));var toCsv=require(_0xef7b('0x9'));var querystring=require(_0xef7b('0xf'));var Papa=require(_0xef7b('0x10'));var Redis=require(_0xef7b('0x11'));var authService=require(_0xef7b('0x12'));var qs=require(_0xef7b('0x13'));var as=require(_0xef7b('0x14'));var hardwareService=require(_0xef7b('0x15'));var logger=require(_0xef7b('0x16'))(_0xef7b('0x17'));var utils=require(_0xef7b('0x18'));var config=require(_0xef7b('0x19'));var licenseUtil=require(_0xef7b('0x1a'));var db=require(_0xef7b('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xef7b('0x1c'));var client=jayson[_0xef7b('0x1d')][_0xef7b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5cb1f8,_0x5540b1,_0x96e077,_0x4f4003){return new BPromise(function(_0x1697eb,_0x447953){var _0x257286=_0x4f4003||client;return _0x257286[_0xef7b('0x1f')](_0x5cb1f8,_0x96e077)['then'](function(_0x55d8f4){logger[_0xef7b('0x20')](_0xef7b('0x21'),_0x5540b1,_0xef7b('0x22'));logger[_0xef7b('0x23')](_0xef7b('0x24'),_0x5540b1,_0xef7b('0x22'),JSON[_0xef7b('0x25')](_0x55d8f4));if(_0x55d8f4[_0xef7b('0x26')]){if(_0x55d8f4['error']['code']===0x1f4){logger[_0xef7b('0x26')](_0xef7b('0x21'),_0x5540b1,_0x55d8f4['error'][_0xef7b('0x27')]);return _0x447953(_0x55d8f4[_0xef7b('0x26')][_0xef7b('0x27')]);}logger['error'](_0xef7b('0x21'),_0x5540b1,_0x55d8f4[_0xef7b('0x26')][_0xef7b('0x27')]);return _0x1697eb(_0x55d8f4[_0xef7b('0x26')][_0xef7b('0x27')]);}else{logger[_0xef7b('0x20')](_0xef7b('0x21'),_0x5540b1,_0xef7b('0x22'));_0x1697eb(_0x55d8f4[_0xef7b('0x28')][_0xef7b('0x27')]);}})[_0xef7b('0x29')](function(_0x127bbb){logger[_0xef7b('0x26')](_0xef7b('0x21'),_0x5540b1,_0x127bbb);_0x447953(_0x127bbb);});});}function respondWithStatusCode(_0x40a4ce,_0x1ec805){_0x1ec805=_0x1ec805||0xcc;return function(_0x582e87){if(_0x582e87){return _0x40a4ce[_0xef7b('0x2a')](_0x1ec805);}return _0x40a4ce['status'](_0x1ec805)['end']();};}function respondWithResult(_0x27f1e9,_0x375e7b){_0x375e7b=_0x375e7b||0xc8;return function(_0x3d07a5){if(_0x3d07a5){return _0x27f1e9[_0xef7b('0x2b')](_0x375e7b)[_0xef7b('0x2c')](_0x3d07a5);}};}function respondWithFilteredResult(_0x2a3e63,_0x1f0531){return function(_0x31351e){if(_0x31351e){var _0x5d0d27=_0x31351e[_0xef7b('0x2d')],_0x153297=_0x1f0531[_0xef7b('0x2e')],_0x1a165e=_0x1f0531['offset']+_0x1f0531['limit'],_0x3666ac;if(_0x1a165e>=_0x5d0d27){_0x1a165e=_0x5d0d27;_0x3666ac=0xc8;}else{_0x3666ac=0xce;}_0x2a3e63[_0xef7b('0x2b')](_0x3666ac);return _0x2a3e63['set'](_0xef7b('0x2f'),_0x153297+'-'+_0x1a165e+'/'+_0x5d0d27)['json'](_0x31351e);}return null;};}function patchUpdates(_0x27bacc){return function(_0x2c0888){try{jsonpatch[_0xef7b('0x30')](_0x2c0888,_0x27bacc,!![]);}catch(_0x1d2295){return BPromise[_0xef7b('0x31')](_0x1d2295);}return _0x2c0888[_0xef7b('0x32')]();};}function saveUpdates(_0x3b55b2,_0x2b1f7a){return function(_0x49c11f){if(_0x49c11f){return _0x49c11f['update'](_0x3b55b2)[_0xef7b('0x33')](function(_0x3dc599){return _0x3dc599;});}return null;};}function removeEntity(_0x1e755d,_0x3fcccf){return function(_0x405c9f){if(_0x405c9f){return _0x405c9f['destroy']()[_0xef7b('0x33')](function(){_0x1e755d[_0xef7b('0x2b')](0xcc)[_0xef7b('0x34')]();});}};}function handleEntityNotFound(_0x52951c,_0x5d50b1){return function(_0x3ce25e){if(!_0x3ce25e){_0x52951c[_0xef7b('0x2a')](0x194);}return _0x3ce25e;};}function handleError(_0x248017,_0x1f0fc5){_0x1f0fc5=_0x1f0fc5||0x1f4;return function(_0x56852c){logger[_0xef7b('0x26')](_0x56852c[_0xef7b('0x35')]);if(_0x56852c['name']){delete _0x56852c['name'];}_0x248017[_0xef7b('0x2b')](_0x1f0fc5)[_0xef7b('0x36')](_0x56852c);};}exports['index']=function(_0x2b4d7c,_0x3dd578){var _0x1ebe40={},_0x2cf112={},_0x3fe7aa={'count':0x0,'rows':[]};var _0x4a68ab=_[_0xef7b('0x37')](db[_0xef7b('0x38')][_0xef7b('0x39')],function(_0x4156f9){return{'name':_0x4156f9[_0xef7b('0x3a')],'type':_0x4156f9['type'][_0xef7b('0x3b')]};});_0x2cf112[_0xef7b('0x3c')]=_[_0xef7b('0x37')](_0x4a68ab,_0xef7b('0x3d'));_0x2cf112[_0xef7b('0x3e')]=_[_0xef7b('0x3f')](_0x2b4d7c[_0xef7b('0x3e')]);_0x2cf112[_0xef7b('0x40')]=_['intersection'](_0x2cf112[_0xef7b('0x3c')],_0x2cf112[_0xef7b('0x3e')]);_0x1ebe40[_0xef7b('0x41')]=_[_0xef7b('0x42')](_0x2cf112[_0xef7b('0x3c')],qs[_0xef7b('0x43')](_0x2b4d7c[_0xef7b('0x3e')][_0xef7b('0x43')]));_0x1ebe40['attributes']=_0x1ebe40[_0xef7b('0x41')][_0xef7b('0x44')]?_0x1ebe40['attributes']:_0x2cf112[_0xef7b('0x3c')];if(!_0x2b4d7c[_0xef7b('0x3e')][_0xef7b('0x45')](_0xef7b('0x46'))){_0x1ebe40['limit']=qs[_0xef7b('0x47')](_0x2b4d7c['query']['limit']);_0x1ebe40[_0xef7b('0x2e')]=qs[_0xef7b('0x2e')](_0x2b4d7c[_0xef7b('0x3e')][_0xef7b('0x2e')]);}_0x1ebe40[_0xef7b('0x48')]=qs[_0xef7b('0x49')](_0x2b4d7c[_0xef7b('0x3e')][_0xef7b('0x49')]);_0x1ebe40[_0xef7b('0x4a')]=qs[_0xef7b('0x40')](_['pick'](_0x2b4d7c[_0xef7b('0x3e')],_0x2cf112[_0xef7b('0x40')]),_0x4a68ab);if(_0x2b4d7c[_0xef7b('0x3e')]['filter']){_0x1ebe40[_0xef7b('0x4a')]=_[_0xef7b('0x4b')](_0x1ebe40[_0xef7b('0x4a')],{'$or':_['map'](_0x4a68ab,function(_0x3ac9b7){if(_0x3ac9b7[_0xef7b('0x4c')]!==_0xef7b('0x4d')){var _0x21cf1e={};_0x21cf1e[_0x3ac9b7[_0xef7b('0x3d')]]={'$like':'%'+_0x2b4d7c[_0xef7b('0x3e')][_0xef7b('0x4e')]+'%'};return _0x21cf1e;}})});}_0x1ebe40=_['merge']({},_0x1ebe40,_0x2b4d7c['options']);var _0x48a534={'where':_0x1ebe40['where']};return db[_0xef7b('0x38')]['count'](_0x48a534)[_0xef7b('0x33')](function(_0x2fd484){_0x3fe7aa['count']=_0x2fd484;if(_0x2b4d7c[_0xef7b('0x3e')]['includeAll']){_0x1ebe40[_0xef7b('0x4f')]=[{'all':!![]}];}return db[_0xef7b('0x38')]['findAll'](_0x1ebe40);})[_0xef7b('0x33')](function(_0x3b3d8d){_0x3fe7aa[_0xef7b('0x50')]=_0x3b3d8d;return _0x3fe7aa;})['then'](respondWithFilteredResult(_0x3dd578,_0x1ebe40))[_0xef7b('0x29')](handleError(_0x3dd578,null));};exports[_0xef7b('0x51')]=function(_0x1c7802,_0x568dcb){var _0x20288c={'raw':![],'where':{'id':_0x1c7802['params']['id']}},_0x5dc359={};_0x5dc359[_0xef7b('0x3c')]=_[_0xef7b('0x3f')](db[_0xef7b('0x38')][_0xef7b('0x39')]);_0x5dc359[_0xef7b('0x3e')]=_[_0xef7b('0x3f')](_0x1c7802[_0xef7b('0x3e')]);_0x5dc359[_0xef7b('0x52')]=_['intersection'](_0x5dc359[_0xef7b('0x3c')],_0x5dc359[_0xef7b('0x3e')]);_0x20288c[_0xef7b('0x41')]=_[_0xef7b('0x42')](_0x5dc359['model'],qs[_0xef7b('0x43')](_0x1c7802['query'][_0xef7b('0x43')]));_0x20288c['attributes']=_0x20288c[_0xef7b('0x41')]['length']?_0x20288c[_0xef7b('0x41')]:_0x5dc359[_0xef7b('0x3c')];if(_0x1c7802[_0xef7b('0x3e')][_0xef7b('0x53')]){_0x20288c[_0xef7b('0x4f')]=[{'all':!![]}];}_0x20288c=_[_0xef7b('0x4b')]({},_0x20288c,_0x1c7802['options']);return db['DeskAccount'][_0xef7b('0x54')](_0x20288c)['then'](handleEntityNotFound(_0x568dcb,null))[_0xef7b('0x33')](respondWithResult(_0x568dcb,null))[_0xef7b('0x29')](handleError(_0x568dcb,null));};exports['create']=function(_0xe8bad4,_0x3364eb){return db[_0xef7b('0x38')]['create'](_0xe8bad4[_0xef7b('0x55')],{})[_0xef7b('0x33')](respondWithResult(_0x3364eb,0xc9))[_0xef7b('0x29')](handleError(_0x3364eb,null));};exports[_0xef7b('0x56')]=function(_0x365185,_0x23e534){if(_0x365185[_0xef7b('0x55')]['id']){delete _0x365185[_0xef7b('0x55')]['id'];}return db[_0xef7b('0x38')][_0xef7b('0x54')]({'where':{'id':_0x365185[_0xef7b('0x57')]['id']}})[_0xef7b('0x33')](handleEntityNotFound(_0x23e534,null))['then'](saveUpdates(_0x365185[_0xef7b('0x55')],null))[_0xef7b('0x33')](respondWithResult(_0x23e534,null))[_0xef7b('0x29')](handleError(_0x23e534,null));};exports[_0xef7b('0x58')]=function(_0x537f0d,_0x31578e){return db[_0xef7b('0x38')][_0xef7b('0x54')]({'where':{'id':_0x537f0d[_0xef7b('0x57')]['id']}})[_0xef7b('0x33')](handleEntityNotFound(_0x31578e,null))[_0xef7b('0x33')](removeEntity(_0x31578e,null))[_0xef7b('0x29')](handleError(_0x31578e,null));};exports[_0xef7b('0x59')]=function(_0x51878f,_0x3e8612,_0x47b99d){var _0x29f65a={};var _0x5f1044={};var _0xeb5f3d;var _0x3d2c69;return db[_0xef7b('0x38')][_0xef7b('0x5a')]({'where':{'id':_0x51878f['params']['id']}})[_0xef7b('0x33')](handleEntityNotFound(_0x3e8612,null))['then'](function(_0x4c7670){if(_0x4c7670){_0xeb5f3d=_0x4c7670;_0x5f1044[_0xef7b('0x3c')]=_[_0xef7b('0x3f')](db['DeskConfiguration'][_0xef7b('0x39')]);_0x5f1044[_0xef7b('0x3e')]=_[_0xef7b('0x3f')](_0x51878f[_0xef7b('0x3e')]);_0x5f1044['filters']=_[_0xef7b('0x42')](_0x5f1044[_0xef7b('0x3c')],_0x5f1044[_0xef7b('0x3e')]);_0x29f65a['attributes']=_[_0xef7b('0x42')](_0x5f1044[_0xef7b('0x3c')],qs['fields'](_0x51878f[_0xef7b('0x3e')][_0xef7b('0x43')]));_0x29f65a[_0xef7b('0x41')]=_0x29f65a[_0xef7b('0x41')][_0xef7b('0x44')]?_0x29f65a[_0xef7b('0x41')]:_0x5f1044[_0xef7b('0x3c')];_0x29f65a[_0xef7b('0x48')]=qs[_0xef7b('0x49')](_0x51878f[_0xef7b('0x3e')][_0xef7b('0x49')]);_0x29f65a[_0xef7b('0x4a')]=qs['filters'](_[_0xef7b('0x5b')](_0x51878f[_0xef7b('0x3e')],_0x5f1044[_0xef7b('0x40')]));if(_0x51878f[_0xef7b('0x3e')][_0xef7b('0x4e')]){_0x29f65a[_0xef7b('0x4a')]=_[_0xef7b('0x4b')](_0x29f65a[_0xef7b('0x4a')],{'$or':_[_0xef7b('0x37')](_0x29f65a['attributes'],function(_0x4e3ab5){var _0x36858f={};_0x36858f[_0x4e3ab5]={'$like':'%'+_0x51878f[_0xef7b('0x3e')][_0xef7b('0x4e')]+'%'};return _0x36858f;})});}_0x29f65a=_[_0xef7b('0x4b')]({},_0x29f65a,_0x51878f[_0xef7b('0x5c')]);return _0xeb5f3d[_0xef7b('0x59')](_0x29f65a);}})['then'](function(_0x5a5fa2){if(_0x5a5fa2){_0x3d2c69=_0x5a5fa2['length'];if(!_0x51878f[_0xef7b('0x3e')][_0xef7b('0x45')](_0xef7b('0x46'))){_0x29f65a[_0xef7b('0x47')]=qs[_0xef7b('0x47')](_0x51878f[_0xef7b('0x3e')][_0xef7b('0x47')]);_0x29f65a[_0xef7b('0x2e')]=qs[_0xef7b('0x2e')](_0x51878f[_0xef7b('0x3e')][_0xef7b('0x2e')]);}return _0xeb5f3d['getConfigurations'](_0x29f65a);}})[_0xef7b('0x33')](function(_0x114a7d){if(_0x114a7d){return _0x114a7d?{'count':_0x3d2c69,'rows':_0x114a7d}:null;}})[_0xef7b('0x33')](respondWithResult(_0x3e8612,null))[_0xef7b('0x29')](handleError(_0x3e8612,null));};exports[_0xef7b('0x5d')]=function(_0x108495,_0x52af4c,_0x31fc27){if(_0x108495[_0xef7b('0x55')]['id']){delete _0x108495[_0xef7b('0x55')]['id'];}return db[_0xef7b('0x38')]['findOne']({'where':{'id':_0x108495[_0xef7b('0x57')]['id']}})[_0xef7b('0x33')](handleEntityNotFound(_0x52af4c,null))['then'](function(_0x4af89b){if(_0x4af89b){_0x108495[_0xef7b('0x55')][_0xef7b('0x5e')]=_0x4af89b['id'];_0x108495[_0xef7b('0x55')][_0xef7b('0x5f')]=integrations['getSubjects'](_0x108495[_0xef7b('0x55')][_0xef7b('0x60')],_0x108495[_0xef7b('0x55')][_0xef7b('0x4c')]);_0x108495[_0xef7b('0x55')]['Descriptions']=integrations[_0xef7b('0x61')](_0x108495[_0xef7b('0x55')][_0xef7b('0x60')],_0x108495[_0xef7b('0x55')]['type']);return db['DeskConfiguration'][_0xef7b('0x62')](_0x108495[_0xef7b('0x55')],{'include':[{'model':db['DeskField'],'as':_0xef7b('0x5f')},{'model':db[_0xef7b('0x63')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x52af4c,null))[_0xef7b('0x29')](handleError(_0x52af4c,null));};exports[_0xef7b('0x64')]=function(_0x448d7c,_0x26237b,_0x4f0e9a){var _0x18277e=[{'name':_0xef7b('0x65'),'label':_0xef7b('0x65'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x19ef9c='';return db[_0xef7b('0x38')][_0xef7b('0x5a')]({'where':{'id':_0x448d7c[_0xef7b('0x57')]['id']},'attributes':['id',_0xef7b('0x66'),_0xef7b('0x67'),_0xef7b('0x68'),_0xef7b('0x69'),_0xef7b('0x6a'),_0xef7b('0x6b'),_0xef7b('0x6c'),'tokenSecret']})[_0xef7b('0x33')](handleEntityNotFound(_0x26237b,null))[_0xef7b('0x33')](function(_0x5dd639){if(_0x5dd639){_0x19ef9c=_0x5dd639[_0xef7b('0x66')];var _0x2590b4=_0x19ef9c[_0xef7b('0x6d')](-0x1);if(_0x2590b4==='/'){_0x19ef9c=_0x19ef9c[_0xef7b('0x6e')](0x0,_0x19ef9c[_0xef7b('0x6f')](_0x2590b4));}var _0x488dbe={'method':_0xef7b('0x70'),'uri':util[_0xef7b('0x71')](_0xef7b('0x72'),_0x19ef9c),'headers':{'Content-Type':'application/json','Accept':_0xef7b('0x73')},'json':!![]};if(_0x5dd639[_0xef7b('0x67')]===_0xef7b('0x74')){_0x488dbe[_0xef7b('0x75')]['Authorization']=util['format']('Basic\x20%s',new Buffer(util['format'](_0xef7b('0x76'),_0x5dd639['username'],_0x5dd639[_0xef7b('0x69')]))[_0xef7b('0x77')](_0xef7b('0x78')));}return rp(_0x488dbe)[_0xef7b('0x33')](function(_0x235db6){return _0x18277e[_0xef7b('0x79')](_[_0xef7b('0x37')](_0x235db6['_embedded'][_0xef7b('0x7a')],function(_0x1840e2){return{'id':_0x1840e2[_0xef7b('0x3d')],'name':_0x1840e2['name'],'type':_0x1840e2[_0xef7b('0x4c')],'active':_0x1840e2[_0xef7b('0x7b')],'label':_0x1840e2['label'],'custom':!![]};}));});}})[_0xef7b('0x33')](function(_0xfd7c87){return{'count':_0xfd7c87[_0xef7b('0x44')],'rows':_0xfd7c87};})[_0xef7b('0x33')](respondWithResult(_0x26237b,null))[_0xef7b('0x29')](function(_0x1320f9){var _0x3c3d34=_0x448d7c['query'][_0xef7b('0x7c')]?0x1f4:_0x1320f9[_0xef7b('0x7d')]||0x1f4;logger[_0xef7b('0x26')](_0xef7b('0x7e'),'getFields',_0x3c3d34,JSON[_0xef7b('0x25')](_0x1320f9));delete _0x1320f9[_0xef7b('0x3d')];if(_0x3c3d34===0x191){_0x3c3d34=0x190;}_0x26237b['status'](_0x3c3d34)[_0xef7b('0x36')](_0x448d7c['query']['test']?{'message':_0xef7b('0x7f'),'statusCode':_0x1320f9['statusCode']}:_0x1320f9);});}; \ No newline at end of file +var _0x58e0=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','filtears','find','body','params','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','getDescriptions','create','DeskField','Descriptions','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','concat','_embedded','active','label','test','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','map','DeskAccount','rawAttributes','fieldName'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x58e0,0x19c));var _0x058e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x58e0[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x058e('0x0'));var emlformat=require(_0x058e('0x1'));var rimraf=require(_0x058e('0x2'));var zipdir=require(_0x058e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x058e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x058e('0x5'));var util=require(_0x058e('0x6'));var path=require(_0x058e('0x7'));var sox=require(_0x058e('0x8'));var csv=require('to-csv');var ejs=require(_0x058e('0x9'));var fs=require('fs');var _=require(_0x058e('0xa'));var squel=require('squel');var crypto=require(_0x058e('0xb'));var jsforce=require(_0x058e('0xc'));var deskjs=require(_0x058e('0xd'));var toCsv=require(_0x058e('0xe'));var querystring=require(_0x058e('0xf'));var Papa=require(_0x058e('0x10'));var Redis=require(_0x058e('0x11'));var authService=require(_0x058e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x058e('0x13'));var hardwareService=require(_0x058e('0x14'));var logger=require('../../config/logger')(_0x058e('0x15'));var utils=require(_0x058e('0x16'));var config=require(_0x058e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x058e('0x18'));var client=jayson[_0x058e('0x19')][_0x058e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2353ff,_0x3c7b93,_0x5d7759,_0x131f72){return new BPromise(function(_0x7affaa,_0x5a2590){var _0x43a1c7=_0x131f72||client;return _0x43a1c7[_0x058e('0x1b')](_0x2353ff,_0x5d7759)[_0x058e('0x1c')](function(_0x5dca4f){logger[_0x058e('0x1d')](_0x058e('0x1e'),_0x3c7b93,_0x058e('0x1f'));logger['debug'](_0x058e('0x20'),_0x3c7b93,_0x058e('0x1f'),JSON[_0x058e('0x21')](_0x5dca4f));if(_0x5dca4f['error']){if(_0x5dca4f['error']['code']===0x1f4){logger[_0x058e('0x22')]('DeskAccount,\x20%s,\x20%s',_0x3c7b93,_0x5dca4f['error'][_0x058e('0x23')]);return _0x5a2590(_0x5dca4f[_0x058e('0x22')]['message']);}logger[_0x058e('0x22')]('DeskAccount,\x20%s,\x20%s',_0x3c7b93,_0x5dca4f[_0x058e('0x22')][_0x058e('0x23')]);return _0x7affaa(_0x5dca4f['error']['message']);}else{logger[_0x058e('0x1d')](_0x058e('0x1e'),_0x3c7b93,'request\x20sent');_0x7affaa(_0x5dca4f[_0x058e('0x24')][_0x058e('0x23')]);}})[_0x058e('0x25')](function(_0x138bd6){logger[_0x058e('0x22')](_0x058e('0x1e'),_0x3c7b93,_0x138bd6);_0x5a2590(_0x138bd6);});});}function respondWithStatusCode(_0x37c3c1,_0x82e3e6){_0x82e3e6=_0x82e3e6||0xcc;return function(_0x116dbb){if(_0x116dbb){return _0x37c3c1[_0x058e('0x26')](_0x82e3e6);}return _0x37c3c1[_0x058e('0x27')](_0x82e3e6)['end']();};}function respondWithResult(_0x480c57,_0x4400f6){_0x4400f6=_0x4400f6||0xc8;return function(_0x190ec7){if(_0x190ec7){return _0x480c57[_0x058e('0x27')](_0x4400f6)[_0x058e('0x28')](_0x190ec7);}};}function respondWithFilteredResult(_0x2cacb9,_0x459abf){return function(_0x266008){if(_0x266008){var _0x10889d=_0x266008[_0x058e('0x29')],_0x481c20=_0x459abf[_0x058e('0x2a')],_0x4a30ed=_0x459abf[_0x058e('0x2a')]+_0x459abf[_0x058e('0x2b')],_0x2834d0;if(_0x4a30ed>=_0x10889d){_0x4a30ed=_0x10889d;_0x2834d0=0xc8;}else{_0x2834d0=0xce;}_0x2cacb9[_0x058e('0x27')](_0x2834d0);return _0x2cacb9[_0x058e('0x2c')](_0x058e('0x2d'),_0x481c20+'-'+_0x4a30ed+'/'+_0x10889d)[_0x058e('0x28')](_0x266008);}return null;};}function patchUpdates(_0xd87a14){return function(_0x2bd9d8){try{jsonpatch[_0x058e('0x2e')](_0x2bd9d8,_0xd87a14,!![]);}catch(_0x49411a){return BPromise['reject'](_0x49411a);}return _0x2bd9d8['save']();};}function saveUpdates(_0x1f752b,_0x195572){return function(_0x125ae7){if(_0x125ae7){return _0x125ae7[_0x058e('0x2f')](_0x1f752b)['then'](function(_0x570b46){return _0x570b46;});}return null;};}function removeEntity(_0x119ea9,_0x212fe6){return function(_0x42b05b){if(_0x42b05b){return _0x42b05b[_0x058e('0x30')]()[_0x058e('0x1c')](function(){_0x119ea9[_0x058e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a995e,_0xdd6c78){return function(_0x1580a0){if(!_0x1580a0){_0x1a995e['sendStatus'](0x194);}return _0x1580a0;};}function handleError(_0x3e7911,_0x27b31c){_0x27b31c=_0x27b31c||0x1f4;return function(_0x3fce7d){logger['error'](_0x3fce7d[_0x058e('0x31')]);if(_0x3fce7d[_0x058e('0x32')]){delete _0x3fce7d[_0x058e('0x32')];}_0x3e7911['status'](_0x27b31c)[_0x058e('0x33')](_0x3fce7d);};}exports['index']=function(_0x5acd8b,_0x687c02){var _0x50e734={},_0x3418e4={},_0x16471e={'count':0x0,'rows':[]};var _0x56fdb6=_[_0x058e('0x34')](db[_0x058e('0x35')][_0x058e('0x36')],function(_0x46882a){return{'name':_0x46882a[_0x058e('0x37')],'type':_0x46882a[_0x058e('0x38')]['key']};});_0x3418e4[_0x058e('0x39')]=_[_0x058e('0x34')](_0x56fdb6,'name');_0x3418e4[_0x058e('0x3a')]=_[_0x058e('0x3b')](_0x5acd8b[_0x058e('0x3a')]);_0x3418e4[_0x058e('0x3c')]=_[_0x058e('0x3d')](_0x3418e4[_0x058e('0x39')],_0x3418e4['query']);_0x50e734[_0x058e('0x3e')]=_[_0x058e('0x3d')](_0x3418e4[_0x058e('0x39')],qs[_0x058e('0x3f')](_0x5acd8b['query'][_0x058e('0x3f')]));_0x50e734['attributes']=_0x50e734['attributes'][_0x058e('0x40')]?_0x50e734[_0x058e('0x3e')]:_0x3418e4[_0x058e('0x39')];if(!_0x5acd8b['query'][_0x058e('0x41')](_0x058e('0x42'))){_0x50e734[_0x058e('0x2b')]=qs['limit'](_0x5acd8b[_0x058e('0x3a')][_0x058e('0x2b')]);_0x50e734[_0x058e('0x2a')]=qs['offset'](_0x5acd8b[_0x058e('0x3a')][_0x058e('0x2a')]);}_0x50e734[_0x058e('0x43')]=qs['sort'](_0x5acd8b['query'][_0x058e('0x44')]);_0x50e734['where']=qs[_0x058e('0x3c')](_[_0x058e('0x45')](_0x5acd8b['query'],_0x3418e4['filters']),_0x56fdb6);if(_0x5acd8b[_0x058e('0x3a')][_0x058e('0x46')]){_0x50e734[_0x058e('0x47')]=_[_0x058e('0x48')](_0x50e734[_0x058e('0x47')],{'$or':_[_0x058e('0x34')](_0x56fdb6,function(_0x18786f){if(_0x18786f['type']!==_0x058e('0x49')){var _0x2fb21e={};_0x2fb21e[_0x18786f[_0x058e('0x32')]]={'$like':'%'+_0x5acd8b['query'][_0x058e('0x46')]+'%'};return _0x2fb21e;}})});}_0x50e734=_[_0x058e('0x48')]({},_0x50e734,_0x5acd8b[_0x058e('0x4a')]);var _0x5ea3ce={'where':_0x50e734['where']};return db[_0x058e('0x35')][_0x058e('0x29')](_0x5ea3ce)[_0x058e('0x1c')](function(_0x31f161){_0x16471e[_0x058e('0x29')]=_0x31f161;if(_0x5acd8b[_0x058e('0x3a')][_0x058e('0x4b')]){_0x50e734[_0x058e('0x4c')]=[{'all':!![]}];}return db[_0x058e('0x35')][_0x058e('0x4d')](_0x50e734);})[_0x058e('0x1c')](function(_0x2663d3){_0x16471e[_0x058e('0x4e')]=_0x2663d3;return _0x16471e;})['then'](respondWithFilteredResult(_0x687c02,_0x50e734))[_0x058e('0x25')](handleError(_0x687c02,null));};exports[_0x058e('0x4f')]=function(_0x45d8c8,_0x19bd62){var _0x1df8c5={'raw':![],'where':{'id':_0x45d8c8['params']['id']}},_0x16b0a0={};_0x16b0a0[_0x058e('0x39')]=_[_0x058e('0x3b')](db[_0x058e('0x35')][_0x058e('0x36')]);_0x16b0a0[_0x058e('0x3a')]=_[_0x058e('0x3b')](_0x45d8c8[_0x058e('0x3a')]);_0x16b0a0[_0x058e('0x50')]=_[_0x058e('0x3d')](_0x16b0a0[_0x058e('0x39')],_0x16b0a0[_0x058e('0x3a')]);_0x1df8c5[_0x058e('0x3e')]=_['intersection'](_0x16b0a0[_0x058e('0x39')],qs[_0x058e('0x3f')](_0x45d8c8['query'][_0x058e('0x3f')]));_0x1df8c5[_0x058e('0x3e')]=_0x1df8c5[_0x058e('0x3e')][_0x058e('0x40')]?_0x1df8c5['attributes']:_0x16b0a0['model'];if(_0x45d8c8[_0x058e('0x3a')][_0x058e('0x4b')]){_0x1df8c5[_0x058e('0x4c')]=[{'all':!![]}];}_0x1df8c5=_[_0x058e('0x48')]({},_0x1df8c5,_0x45d8c8[_0x058e('0x4a')]);return db['DeskAccount'][_0x058e('0x51')](_0x1df8c5)[_0x058e('0x1c')](handleEntityNotFound(_0x19bd62,null))[_0x058e('0x1c')](respondWithResult(_0x19bd62,null))['catch'](handleError(_0x19bd62,null));};exports['create']=function(_0x414138,_0x277528){return db[_0x058e('0x35')]['create'](_0x414138[_0x058e('0x52')],{})[_0x058e('0x1c')](respondWithResult(_0x277528,0xc9))[_0x058e('0x25')](handleError(_0x277528,null));};exports[_0x058e('0x2f')]=function(_0x5371e6,_0x491583){if(_0x5371e6['body']['id']){delete _0x5371e6['body']['id'];}return db[_0x058e('0x35')]['find']({'where':{'id':_0x5371e6['params']['id']}})['then'](handleEntityNotFound(_0x491583,null))[_0x058e('0x1c')](saveUpdates(_0x5371e6[_0x058e('0x52')],null))[_0x058e('0x1c')](respondWithResult(_0x491583,null))[_0x058e('0x25')](handleError(_0x491583,null));};exports[_0x058e('0x30')]=function(_0x574a75,_0x5c4811){return db['DeskAccount'][_0x058e('0x51')]({'where':{'id':_0x574a75[_0x058e('0x53')]['id']}})[_0x058e('0x1c')](handleEntityNotFound(_0x5c4811,null))[_0x058e('0x1c')](removeEntity(_0x5c4811,null))[_0x058e('0x25')](handleError(_0x5c4811,null));};exports[_0x058e('0x54')]=function(_0x150d81,_0x3baeff,_0x274914){var _0x21e253={};var _0x24cc70={};var _0x279047;var _0x3bab4f;return db[_0x058e('0x35')][_0x058e('0x55')]({'where':{'id':_0x150d81[_0x058e('0x53')]['id']}})[_0x058e('0x1c')](handleEntityNotFound(_0x3baeff,null))[_0x058e('0x1c')](function(_0x10e9d5){if(_0x10e9d5){_0x279047=_0x10e9d5;_0x24cc70[_0x058e('0x39')]=_[_0x058e('0x3b')](db[_0x058e('0x56')][_0x058e('0x36')]);_0x24cc70['query']=_['keys'](_0x150d81[_0x058e('0x3a')]);_0x24cc70[_0x058e('0x3c')]=_[_0x058e('0x3d')](_0x24cc70[_0x058e('0x39')],_0x24cc70[_0x058e('0x3a')]);_0x21e253['attributes']=_[_0x058e('0x3d')](_0x24cc70[_0x058e('0x39')],qs[_0x058e('0x3f')](_0x150d81[_0x058e('0x3a')][_0x058e('0x3f')]));_0x21e253['attributes']=_0x21e253[_0x058e('0x3e')][_0x058e('0x40')]?_0x21e253[_0x058e('0x3e')]:_0x24cc70[_0x058e('0x39')];_0x21e253['order']=qs[_0x058e('0x44')](_0x150d81['query']['sort']);_0x21e253[_0x058e('0x47')]=qs[_0x058e('0x3c')](_[_0x058e('0x45')](_0x150d81[_0x058e('0x3a')],_0x24cc70[_0x058e('0x3c')]));if(_0x150d81[_0x058e('0x3a')][_0x058e('0x46')]){_0x21e253[_0x058e('0x47')]=_[_0x058e('0x48')](_0x21e253[_0x058e('0x47')],{'$or':_[_0x058e('0x34')](_0x21e253[_0x058e('0x3e')],function(_0x4ef05a){var _0x590c42={};_0x590c42[_0x4ef05a]={'$like':'%'+_0x150d81[_0x058e('0x3a')][_0x058e('0x46')]+'%'};return _0x590c42;})});}_0x21e253=_['merge']({},_0x21e253,_0x150d81[_0x058e('0x4a')]);return _0x279047[_0x058e('0x54')](_0x21e253);}})[_0x058e('0x1c')](function(_0x4dd494){if(_0x4dd494){_0x3bab4f=_0x4dd494[_0x058e('0x40')];if(!_0x150d81[_0x058e('0x3a')]['hasOwnProperty'](_0x058e('0x42'))){_0x21e253[_0x058e('0x2b')]=qs['limit'](_0x150d81[_0x058e('0x3a')][_0x058e('0x2b')]);_0x21e253[_0x058e('0x2a')]=qs[_0x058e('0x2a')](_0x150d81[_0x058e('0x3a')][_0x058e('0x2a')]);}return _0x279047[_0x058e('0x54')](_0x21e253);}})[_0x058e('0x1c')](function(_0x22ba32){if(_0x22ba32){return _0x22ba32?{'count':_0x3bab4f,'rows':_0x22ba32}:null;}})['then'](respondWithResult(_0x3baeff,null))[_0x058e('0x25')](handleError(_0x3baeff,null));};exports[_0x058e('0x57')]=function(_0x4b8e9e,_0x7186fd,_0x3203e1){if(_0x4b8e9e[_0x058e('0x52')]['id']){delete _0x4b8e9e['body']['id'];}return db[_0x058e('0x35')]['findOne']({'where':{'id':_0x4b8e9e[_0x058e('0x53')]['id']}})[_0x058e('0x1c')](handleEntityNotFound(_0x7186fd,null))[_0x058e('0x1c')](function(_0x2d0894){if(_0x2d0894){_0x4b8e9e[_0x058e('0x52')]['AccountId']=_0x2d0894['id'];_0x4b8e9e['body'][_0x058e('0x58')]=integrations[_0x058e('0x59')](_0x4b8e9e[_0x058e('0x52')][_0x058e('0x5a')],_0x4b8e9e[_0x058e('0x52')][_0x058e('0x38')]);_0x4b8e9e[_0x058e('0x52')]['Descriptions']=integrations[_0x058e('0x5b')](_0x4b8e9e['body']['channel'],_0x4b8e9e[_0x058e('0x52')][_0x058e('0x38')]);return db[_0x058e('0x56')][_0x058e('0x5c')](_0x4b8e9e[_0x058e('0x52')],{'include':[{'model':db[_0x058e('0x5d')],'as':_0x058e('0x58')},{'model':db[_0x058e('0x5d')],'as':_0x058e('0x5e')}]});}return null;})[_0x058e('0x1c')](respondWithResult(_0x7186fd,null))[_0x058e('0x25')](handleError(_0x7186fd,null));};exports['getFields']=function(_0x220db0,_0x6808b6,_0x3f5be0){var _0x381394=[{'name':'priority','label':_0x058e('0x5f'),'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 _0x12b14f='';return db[_0x058e('0x35')][_0x058e('0x55')]({'where':{'id':_0x220db0[_0x058e('0x53')]['id']},'attributes':['id',_0x058e('0x60'),_0x058e('0x61'),'username',_0x058e('0x62'),_0x058e('0x63'),_0x058e('0x64'),_0x058e('0x65'),'tokenSecret']})['then'](handleEntityNotFound(_0x6808b6,null))[_0x058e('0x1c')](function(_0x189062){if(_0x189062){_0x12b14f=_0x189062[_0x058e('0x60')];var _0x1251c5=_0x12b14f['slice'](-0x1);if(_0x1251c5==='/'){_0x12b14f=_0x12b14f[_0x058e('0x66')](0x0,_0x12b14f['lastIndexOf'](_0x1251c5));}var _0x2895ac={'method':_0x058e('0x67'),'uri':util[_0x058e('0x68')](_0x058e('0x69'),_0x12b14f),'headers':{'Content-Type':_0x058e('0x6a'),'Accept':_0x058e('0x6a')},'json':!![]};if(_0x189062[_0x058e('0x61')]===_0x058e('0x6b')){_0x2895ac[_0x058e('0x6c')][_0x058e('0x6d')]=util[_0x058e('0x68')]('Basic\x20%s',new Buffer(util[_0x058e('0x68')](_0x058e('0x6e'),_0x189062['username'],_0x189062[_0x058e('0x62')]))['toString']('base64'));}return rp(_0x2895ac)['then'](function(_0x42f490){return _0x381394[_0x058e('0x6f')](_['map'](_0x42f490[_0x058e('0x70')]['entries'],function(_0x24f6fe){return{'id':_0x24f6fe[_0x058e('0x32')],'name':_0x24f6fe['name'],'type':_0x24f6fe[_0x058e('0x38')],'active':_0x24f6fe[_0x058e('0x71')],'label':_0x24f6fe[_0x058e('0x72')],'custom':!![]};}));});}})['then'](function(_0x478d5d){return{'count':_0x478d5d['length'],'rows':_0x478d5d};})[_0x058e('0x1c')](respondWithResult(_0x6808b6,null))[_0x058e('0x25')](function(_0x5f2abe){var _0x9efc31=_0x220db0[_0x058e('0x3a')][_0x058e('0x73')]?0x1f4:_0x5f2abe['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x058e('0x74'),_0x9efc31,JSON['stringify'](_0x5f2abe));delete _0x5f2abe[_0x058e('0x32')];if(_0x9efc31===0x191){_0x9efc31=0x190;}_0x6808b6[_0x058e('0x27')](_0x9efc31)['send'](_0x220db0[_0x058e('0x3a')][_0x058e('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x5f2abe['statusCode']}:_0x5f2abe);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 4e7c4d3..3f931fb 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 _0xe324=['bluebird','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','api','moment'];(function(_0x3e48df,_0x3182ce){var _0x4a64db=function(_0x2915fb){while(--_0x2915fb){_0x3e48df['push'](_0x3e48df['shift']());}};_0x4a64db(++_0x3182ce);}(_0xe324,0x98));var _0x4e32=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xe324[_0x175e89];return _0x2ed996;};'use strict';var _=require(_0x4e32('0x0'));var util=require(_0x4e32('0x1'));var logger=require('../../config/logger')(_0x4e32('0x2'));var moment=require(_0x4e32('0x3'));var BPromise=require(_0x4e32('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e32('0x5'));var rimraf=require(_0x4e32('0x6'));var config=require('../../config/environment');var attributes=require(_0x4e32('0x7'));var integrations=require(_0x4e32('0x8'));module[_0x4e32('0x9')]=function(_0x2b844c,_0x2d350b){return _0x2b844c[_0x4e32('0xa')]('DeskAccount',attributes,{'tableName':_0x4e32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x247b=['bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','api'];(function(_0x194691,_0xeb6c2c){var _0x53ecfe=function(_0x5dfdd8){while(--_0x5dfdd8){_0x194691['push'](_0x194691['shift']());}};_0x53ecfe(++_0xeb6c2c);}(_0x247b,0x182));var _0xb247=function(_0x16502f,_0xb4c01){_0x16502f=_0x16502f-0x0;var _0x5986bf=_0x247b[_0x16502f];return _0x5986bf;};'use strict';var _=require(_0xb247('0x0'));var util=require(_0xb247('0x1'));var logger=require(_0xb247('0x2'))(_0xb247('0x3'));var moment=require('moment');var BPromise=require(_0xb247('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb247('0x5'));var rimraf=require(_0xb247('0x6'));var config=require(_0xb247('0x7'));var attributes=require(_0xb247('0x8'));var integrations=require(_0xb247('0x9'));module[_0xb247('0xa')]=function(_0x43c2ff,_0x362ac1){return _0x43c2ff[_0xb247('0xb')](_0xb247('0xc'),attributes,{'tableName':'int_desk_accounts','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 5b7131a..b4b95f8 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 _0x0e48=['attributes','include','map','model','stringify','ShowDeskAccount','find','debug','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0x0e48,0x194));var _0x80e4=function(_0xa3d6a,_0x50408e){_0xa3d6a=_0xa3d6a-0x0;var _0x14f584=_0x0e48[_0xa3d6a];return _0x14f584;};'use strict';var _=require(_0x80e4('0x0'));var util=require('util');var moment=require(_0x80e4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80e4('0x2'))['db'];var utils=require(_0x80e4('0x3'));var logger=require('../../config/logger')(_0x80e4('0x4'));var config=require(_0x80e4('0x5'));var jayson=require(_0x80e4('0x6'));var client=jayson[_0x80e4('0x7')][_0x80e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f463b,_0x394fbd,_0x26e7bc){return new BPromise(function(_0x509caa,_0x200e4a){return client['request'](_0x5f463b,_0x26e7bc)[_0x80e4('0x9')](function(_0x41f074){logger[_0x80e4('0xa')](_0x80e4('0xb'),_0x394fbd,_0x80e4('0xc'));logger['debug'](_0x80e4('0xd'),_0x394fbd,'request\x20sent',JSON['stringify'](_0x41f074));if(_0x41f074[_0x80e4('0xe')]){if(_0x41f074[_0x80e4('0xe')][_0x80e4('0xf')]===0x1f4){logger[_0x80e4('0xe')](_0x80e4('0xb'),_0x394fbd,_0x41f074['error'][_0x80e4('0x10')]);return _0x200e4a(_0x41f074[_0x80e4('0xe')][_0x80e4('0x10')]);}logger[_0x80e4('0xe')](_0x80e4('0xb'),_0x394fbd,_0x41f074[_0x80e4('0xe')][_0x80e4('0x10')]);return _0x509caa(_0x41f074['error'][_0x80e4('0x10')]);}else{logger['info'](_0x80e4('0xb'),_0x394fbd,_0x80e4('0xc'));_0x509caa(_0x41f074[_0x80e4('0x11')][_0x80e4('0x10')]);}})[_0x80e4('0x12')](function(_0xd7ce38){logger['error']('DeskAccount,\x20%s,\x20%s',_0x394fbd,_0xd7ce38);_0x200e4a(_0xd7ce38);});});}exports[_0x80e4('0x13')]=function(_0x325380){var _0x781fc1=this;return new Promise(function(_0x1cd65a,_0x50c475){return db[_0x80e4('0x14')][_0x80e4('0x15')]({'raw':_0x325380['options']?_0x325380[_0x80e4('0x16')][_0x80e4('0x17')]===undefined?!![]:![]:!![],'where':_0x325380[_0x80e4('0x16')]?_0x325380['options'][_0x80e4('0x18')]||null:null,'attributes':_0x325380[_0x80e4('0x16')]?_0x325380[_0x80e4('0x16')][_0x80e4('0x19')]||null:null,'limit':_0x325380[_0x80e4('0x16')]?_0x325380[_0x80e4('0x16')]['limit']||null:null,'include':_0x325380['options']?_0x325380[_0x80e4('0x16')][_0x80e4('0x1a')]?_[_0x80e4('0x1b')](_0x325380[_0x80e4('0x16')][_0x80e4('0x1a')],function(_0x5bd75b){return{'model':db[_0x5bd75b[_0x80e4('0x1c')]],'as':_0x5bd75b['as'],'attributes':_0x5bd75b['attributes'],'include':_0x5bd75b[_0x80e4('0x1a')]?_[_0x80e4('0x1b')](_0x5bd75b[_0x80e4('0x1a')],function(_0x4331b4){return{'model':db[_0x4331b4[_0x80e4('0x1c')]],'as':_0x4331b4['as'],'attributes':_0x4331b4[_0x80e4('0x19')],'include':_0x4331b4['include']?_[_0x80e4('0x1b')](_0x4331b4[_0x80e4('0x1a')],function(_0x459dcf){return{'model':db[_0x459dcf[_0x80e4('0x1c')]],'as':_0x459dcf['as'],'attributes':_0x459dcf[_0x80e4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x80e4('0x9')](function(_0x34dac0){logger[_0x80e4('0xa')]('GetDeskAccount',_0x325380);logger['debug'](_0x80e4('0x13'),_0x325380,JSON[_0x80e4('0x1d')](_0x34dac0));_0x1cd65a(_0x34dac0);})['catch'](function(_0xe05966){logger[_0x80e4('0xe')](_0x80e4('0x13'),_0xe05966[_0x80e4('0x10')],_0x325380);_0x50c475(_0x781fc1[_0x80e4('0xe')](0x1f4,_0xe05966[_0x80e4('0x10')]));});});};exports[_0x80e4('0x1e')]=function(_0x599612){var _0x37968b=this;return new Promise(function(_0x11c26f,_0x2dc3b4){return db['DeskAccount'][_0x80e4('0x1f')]({'raw':_0x599612[_0x80e4('0x16')]?_0x599612[_0x80e4('0x16')][_0x80e4('0x17')]===undefined?!![]:![]:!![],'where':_0x599612[_0x80e4('0x16')]?_0x599612[_0x80e4('0x16')]['where']||null:null,'attributes':_0x599612[_0x80e4('0x16')]?_0x599612[_0x80e4('0x16')][_0x80e4('0x19')]||null:null,'include':_0x599612[_0x80e4('0x16')]?_0x599612[_0x80e4('0x16')][_0x80e4('0x1a')]?_['map'](_0x599612[_0x80e4('0x16')][_0x80e4('0x1a')],function(_0x451b35){return{'model':db[_0x451b35[_0x80e4('0x1c')]],'as':_0x451b35['as'],'attributes':_0x451b35['attributes'],'include':_0x451b35[_0x80e4('0x1a')]?_[_0x80e4('0x1b')](_0x451b35[_0x80e4('0x1a')],function(_0x1944db){return{'model':db[_0x1944db[_0x80e4('0x1c')]],'as':_0x1944db['as'],'attributes':_0x1944db[_0x80e4('0x19')],'include':_0x1944db[_0x80e4('0x1a')]?_[_0x80e4('0x1b')](_0x1944db['include'],function(_0x15c5cd){return{'model':db[_0x15c5cd[_0x80e4('0x1c')]],'as':_0x15c5cd['as'],'attributes':_0x15c5cd[_0x80e4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35aa85){logger[_0x80e4('0xa')](_0x80e4('0x1e'),_0x599612);logger[_0x80e4('0x20')]('ShowDeskAccount',_0x599612,JSON[_0x80e4('0x1d')](_0x35aa85));_0x11c26f(_0x35aa85);})['catch'](function(_0x2bb6a2){logger[_0x80e4('0xe')](_0x80e4('0x1e'),_0x2bb6a2['message'],_0x599612);_0x2dc3b4(_0x37968b[_0x80e4('0xe')](0x1f4,_0x2bb6a2[_0x80e4('0x10')]));});});}; \ No newline at end of file +var _0x1119=['model','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','include','map'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x1119,0xad));var _0x9111=function(_0x2aa3ed,_0x21bb61){_0x2aa3ed=_0x2aa3ed-0x0;var _0x4e0881=_0x1119[_0x2aa3ed];return _0x4e0881;};'use strict';var _=require(_0x9111('0x0'));var util=require(_0x9111('0x1'));var moment=require(_0x9111('0x2'));var BPromise=require(_0x9111('0x3'));var rs=require(_0x9111('0x4'));var fs=require('fs');var Redis=require(_0x9111('0x5'));var db=require(_0x9111('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9111('0x7'));var config=require(_0x9111('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9111('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f0eca,_0x4fc675,_0x291de3){return new BPromise(function(_0x4d10f8,_0x533633){return client[_0x9111('0xa')](_0x1f0eca,_0x291de3)[_0x9111('0xb')](function(_0xbbe8ae){logger[_0x9111('0xc')](_0x9111('0xd'),_0x4fc675,_0x9111('0xe'));logger[_0x9111('0xf')](_0x9111('0x10'),_0x4fc675,'request\x20sent',JSON[_0x9111('0x11')](_0xbbe8ae));if(_0xbbe8ae[_0x9111('0x12')]){if(_0xbbe8ae['error'][_0x9111('0x13')]===0x1f4){logger[_0x9111('0x12')](_0x9111('0xd'),_0x4fc675,_0xbbe8ae[_0x9111('0x12')]['message']);return _0x533633(_0xbbe8ae['error']['message']);}logger[_0x9111('0x12')](_0x9111('0xd'),_0x4fc675,_0xbbe8ae['error'][_0x9111('0x14')]);return _0x4d10f8(_0xbbe8ae[_0x9111('0x12')][_0x9111('0x14')]);}else{logger['info'](_0x9111('0xd'),_0x4fc675,_0x9111('0xe'));_0x4d10f8(_0xbbe8ae[_0x9111('0x15')][_0x9111('0x14')]);}})[_0x9111('0x16')](function(_0x2e3557){logger[_0x9111('0x12')]('DeskAccount,\x20%s,\x20%s',_0x4fc675,_0x2e3557);_0x533633(_0x2e3557);});});}exports[_0x9111('0x17')]=function(_0x4a4e89){var _0x9e7afb=this;return new Promise(function(_0x2f52e2,_0x1413d5){return db[_0x9111('0x18')]['findAll']({'raw':_0x4a4e89[_0x9111('0x19')]?_0x4a4e89[_0x9111('0x19')][_0x9111('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a4e89['options']?_0x4a4e89[_0x9111('0x19')][_0x9111('0x1b')]||null:null,'attributes':_0x4a4e89[_0x9111('0x19')]?_0x4a4e89[_0x9111('0x19')][_0x9111('0x1c')]||null:null,'limit':_0x4a4e89[_0x9111('0x19')]?_0x4a4e89[_0x9111('0x19')]['limit']||null:null,'include':_0x4a4e89[_0x9111('0x19')]?_0x4a4e89[_0x9111('0x19')][_0x9111('0x1d')]?_[_0x9111('0x1e')](_0x4a4e89['options']['include'],function(_0x30314c){return{'model':db[_0x30314c[_0x9111('0x1f')]],'as':_0x30314c['as'],'attributes':_0x30314c[_0x9111('0x1c')],'include':_0x30314c[_0x9111('0x1d')]?_[_0x9111('0x1e')](_0x30314c[_0x9111('0x1d')],function(_0x3a774d){return{'model':db[_0x3a774d[_0x9111('0x1f')]],'as':_0x3a774d['as'],'attributes':_0x3a774d['attributes'],'include':_0x3a774d[_0x9111('0x1d')]?_[_0x9111('0x1e')](_0x3a774d[_0x9111('0x1d')],function(_0x1d51f9){return{'model':db[_0x1d51f9['model']],'as':_0x1d51f9['as'],'attributes':_0x1d51f9[_0x9111('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9111('0xb')](function(_0x1d51f2){logger['info'](_0x9111('0x17'),_0x4a4e89);logger['debug'](_0x9111('0x17'),_0x4a4e89,JSON[_0x9111('0x11')](_0x1d51f2));_0x2f52e2(_0x1d51f2);})[_0x9111('0x16')](function(_0x12dc5b){logger[_0x9111('0x12')](_0x9111('0x17'),_0x12dc5b[_0x9111('0x14')],_0x4a4e89);_0x1413d5(_0x9e7afb['error'](0x1f4,_0x12dc5b[_0x9111('0x14')]));});});};exports[_0x9111('0x20')]=function(_0x11d53f){var _0x22ccfd=this;return new Promise(function(_0x55b518,_0x49a813){return db[_0x9111('0x18')][_0x9111('0x21')]({'raw':_0x11d53f[_0x9111('0x19')]?_0x11d53f[_0x9111('0x19')][_0x9111('0x1a')]===undefined?!![]:![]:!![],'where':_0x11d53f['options']?_0x11d53f[_0x9111('0x19')]['where']||null:null,'attributes':_0x11d53f[_0x9111('0x19')]?_0x11d53f[_0x9111('0x19')][_0x9111('0x1c')]||null:null,'include':_0x11d53f[_0x9111('0x19')]?_0x11d53f[_0x9111('0x19')][_0x9111('0x1d')]?_[_0x9111('0x1e')](_0x11d53f[_0x9111('0x19')][_0x9111('0x1d')],function(_0x455ffe){return{'model':db[_0x455ffe[_0x9111('0x1f')]],'as':_0x455ffe['as'],'attributes':_0x455ffe[_0x9111('0x1c')],'include':_0x455ffe['include']?_[_0x9111('0x1e')](_0x455ffe['include'],function(_0x4c6b14){return{'model':db[_0x4c6b14[_0x9111('0x1f')]],'as':_0x4c6b14['as'],'attributes':_0x4c6b14['attributes'],'include':_0x4c6b14[_0x9111('0x1d')]?_['map'](_0x4c6b14[_0x9111('0x1d')],function(_0x5db88d){return{'model':db[_0x5db88d[_0x9111('0x1f')]],'as':_0x5db88d['as'],'attributes':_0x5db88d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9111('0xb')](function(_0xd79ce3){logger['info'](_0x9111('0x20'),_0x11d53f);logger[_0x9111('0xf')]('ShowDeskAccount',_0x11d53f,JSON[_0x9111('0x11')](_0xd79ce3));_0x55b518(_0xd79ce3);})[_0x9111('0x16')](function(_0x23e218){logger[_0x9111('0x12')](_0x9111('0x20'),_0x23e218[_0x9111('0x14')],_0x11d53f);_0x49a813(_0x22ccfd[_0x9111('0x12')](0x1f4,_0x23e218[_0x9111('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e47cd67..2d03413 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 _0xda81=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update'];(function(_0x53a2e,_0x555029){var _0xa73ac3=function(_0x319d93){while(--_0x319d93){_0x53a2e['push'](_0x53a2e['shift']());}};_0xa73ac3(++_0x555029);}(_0xda81,0x1c3));var _0x1da8=function(_0x4fd705,_0x2a0722){_0x4fd705=_0x4fd705-0x0;var _0x425d70=_0xda81[_0x4fd705];return _0x425d70;};'use strict';var multer=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var path=require(_0x1da8('0x2'));var timeout=require('connect-timeout');var express=require(_0x1da8('0x3'));var router=express[_0x1da8('0x4')]();var auth=require(_0x1da8('0x5'));var interaction=require(_0x1da8('0x6'));var config=require('../../config/environment');var controller=require(_0x1da8('0x7'));router[_0x1da8('0x8')]('/',auth['isAuthenticated'](),controller[_0x1da8('0x9')]);router['get'](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xc')]);router[_0x1da8('0x8')](_0x1da8('0xd'),auth[_0x1da8('0xb')](),controller[_0x1da8('0xe')]);router[_0x1da8('0x8')](_0x1da8('0xf'),auth['isAuthenticated'](),controller[_0x1da8('0x10')]);router[_0x1da8('0x8')](_0x1da8('0x11'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x12')]);router['get'](_0x1da8('0x13'),auth['isAuthenticated'](),controller[_0x1da8('0x14')]);router[_0x1da8('0x15')]('/',auth[_0x1da8('0xb')](),controller[_0x1da8('0x16')]);router[_0x1da8('0x15')]('/:id/tags',auth[_0x1da8('0xb')](),controller['setTags']);router[_0x1da8('0x17')](_0x1da8('0xa'),auth[_0x1da8('0xb')](),controller[_0x1da8('0x18')]);router[_0x1da8('0x19')](_0x1da8('0xa'),auth['isAuthenticated'](),controller[_0x1da8('0x1a')]);module[_0x1da8('0x1b')]=router; \ No newline at end of file +var _0x0650=['post','put','update','/:id','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags'];(function(_0x4a4f63,_0x604d23){var _0x5882eb=function(_0x4ba8bc){while(--_0x4ba8bc){_0x4a4f63['push'](_0x4a4f63['shift']());}};_0x5882eb(++_0x604d23);}(_0x0650,0xed));var _0x0065=function(_0x450de1,_0x5b94bb){_0x450de1=_0x450de1-0x0;var _0x53849e=_0x0650[_0x450de1];return _0x53849e;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x4'));var config=require(_0x0065('0x5'));var controller=require(_0x0065('0x6'));router['get']('/',auth[_0x0065('0x7')](),controller['index']);router['get']('/:id',auth[_0x0065('0x7')](),controller[_0x0065('0x8')]);router[_0x0065('0x9')](_0x0065('0xa'),auth[_0x0065('0x7')](),controller[_0x0065('0xb')]);router[_0x0065('0x9')](_0x0065('0xc'),auth[_0x0065('0x7')](),controller['getSubjects']);router[_0x0065('0x9')](_0x0065('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x0065('0xe'),auth[_0x0065('0x7')](),controller['getTags']);router[_0x0065('0xf')]('/',auth[_0x0065('0x7')](),controller['create']);router[_0x0065('0xf')](_0x0065('0xe'),auth['isAuthenticated'](),controller['setTags']);router[_0x0065('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0065('0x11')]);router['delete'](_0x0065('0x12'),auth['isAuthenticated'](),controller[_0x0065('0x13')]);module[_0x0065('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f53755b..1f0b447 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 _0xe961=['STRING','sequelize'];(function(_0x36e041,_0x72b33a){var _0x1255e4=function(_0x2e86c6){while(--_0x2e86c6){_0x36e041['push'](_0x36e041['shift']());}};_0x1255e4(++_0x72b33a);}(_0xe961,0x15f));var _0x1e96=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xe961[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x1e96('0x0'));module['exports']={'name':{'type':Sequelize[_0x1e96('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa951=['exports','STRING','sequelize'];(function(_0x4bc831,_0x437503){var _0x1499b4=function(_0x29f876){while(--_0x29f876){_0x4bc831['push'](_0x4bc831['shift']());}};_0x1499b4(++_0x437503);}(_0xa951,0x9b));var _0x1a95=function(_0x10ef69,_0x5cb182){_0x10ef69=_0x10ef69-0x0;var _0x19e5a6=_0xa951[_0x10ef69];return _0x19e5a6;};'use strict';var Sequelize=require(_0x1a95('0x0'));module[_0x1a95('0x1')]={'name':{'type':Sequelize[_0x1a95('0x2')]},'description':{'type':Sequelize[_0x1a95('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index e705d20..3cfce5b 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 _0xafe7=['DeskField','pick','map','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','html-pdf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','end','stack','send','DeskConfiguration','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','rows','catch','show','filtears','includeAll','find','create','body','params','getFields'];(function(_0x223c43,_0x5224c1){var _0x2aa0cb=function(_0x2d6e7c){while(--_0x2d6e7c){_0x223c43['push'](_0x223c43['shift']());}};_0x2aa0cb(++_0x5224c1);}(_0xafe7,0x187));var _0x7afe=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xafe7[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x7afe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7afe('0x1'));var rp=require(_0x7afe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7afe('0x3'));var util=require('util');var path=require(_0x7afe('0x4'));var sox=require(_0x7afe('0x5'));var csv=require(_0x7afe('0x6'));var ejs=require(_0x7afe('0x7'));var fs=require('fs');var _=require(_0x7afe('0x8'));var squel=require('squel');var crypto=require(_0x7afe('0x9'));var jsforce=require(_0x7afe('0xa'));var deskjs=require(_0x7afe('0xb'));var toCsv=require(_0x7afe('0x6'));var querystring=require(_0x7afe('0xc'));var Papa=require(_0x7afe('0xd'));var Redis=require(_0x7afe('0xe'));var authService=require(_0x7afe('0xf'));var qs=require(_0x7afe('0x10'));var as=require(_0x7afe('0x11'));var hardwareService=require(_0x7afe('0x12'));var logger=require(_0x7afe('0x13'))(_0x7afe('0x14'));var utils=require(_0x7afe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7afe('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7afe('0x17'));var client=jayson[_0x7afe('0x18')][_0x7afe('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x495e45,_0xa6694c,_0xf33064,_0x27aa3b){return new BPromise(function(_0x2bcdde,_0x253443){var _0x246cb5=_0x27aa3b||client;return _0x246cb5[_0x7afe('0x1a')](_0x495e45,_0xf33064)[_0x7afe('0x1b')](function(_0x5475aa){logger[_0x7afe('0x1c')]('DeskConfiguration,\x20%s,\x20%s',_0xa6694c,_0x7afe('0x1d'));logger[_0x7afe('0x1e')](_0x7afe('0x1f'),_0xa6694c,_0x7afe('0x1d'),JSON[_0x7afe('0x20')](_0x5475aa));if(_0x5475aa[_0x7afe('0x21')]){if(_0x5475aa['error'][_0x7afe('0x22')]===0x1f4){logger['error'](_0x7afe('0x23'),_0xa6694c,_0x5475aa[_0x7afe('0x21')]['message']);return _0x253443(_0x5475aa[_0x7afe('0x21')][_0x7afe('0x24')]);}logger[_0x7afe('0x21')](_0x7afe('0x23'),_0xa6694c,_0x5475aa['error']['message']);return _0x2bcdde(_0x5475aa['error'][_0x7afe('0x24')]);}else{logger[_0x7afe('0x1c')](_0x7afe('0x23'),_0xa6694c,_0x7afe('0x1d'));_0x2bcdde(_0x5475aa['result'][_0x7afe('0x24')]);}})['catch'](function(_0x52bcf8){logger[_0x7afe('0x21')]('DeskConfiguration,\x20%s,\x20%s',_0xa6694c,_0x52bcf8);_0x253443(_0x52bcf8);});});}function respondWithStatusCode(_0x570442,_0x451000){_0x451000=_0x451000||0xcc;return function(_0x149123){if(_0x149123){return _0x570442[_0x7afe('0x25')](_0x451000);}return _0x570442[_0x7afe('0x26')](_0x451000)['end']();};}function respondWithResult(_0x21d0ef,_0x35b632){_0x35b632=_0x35b632||0xc8;return function(_0x399ffd){if(_0x399ffd){return _0x21d0ef[_0x7afe('0x26')](_0x35b632)[_0x7afe('0x27')](_0x399ffd);}};}function respondWithFilteredResult(_0x4f4f83,_0x2bf233){return function(_0xf89492){if(_0xf89492){var _0x579b73=_0xf89492['count'],_0x349898=_0x2bf233['offset'],_0x3332a1=_0x2bf233[_0x7afe('0x28')]+_0x2bf233[_0x7afe('0x29')],_0xe21df;if(_0x3332a1>=_0x579b73){_0x3332a1=_0x579b73;_0xe21df=0xc8;}else{_0xe21df=0xce;}_0x4f4f83[_0x7afe('0x26')](_0xe21df);return _0x4f4f83[_0x7afe('0x2a')](_0x7afe('0x2b'),_0x349898+'-'+_0x3332a1+'/'+_0x579b73)[_0x7afe('0x27')](_0xf89492);}return null;};}function patchUpdates(_0x456015){return function(_0x505c35){try{jsonpatch[_0x7afe('0x2c')](_0x505c35,_0x456015,!![]);}catch(_0x5d68ea){return BPromise[_0x7afe('0x2d')](_0x5d68ea);}return _0x505c35['save']();};}function saveUpdates(_0x5d7286,_0x56692b){return function(_0x991de8){if(_0x991de8){return _0x991de8[_0x7afe('0x2e')](_0x5d7286)[_0x7afe('0x1b')](function(_0x4abb15){return _0x4abb15;});}return null;};}function removeEntity(_0x298d49,_0x37fd02){return function(_0x3472df){if(_0x3472df){return _0x3472df[_0x7afe('0x2f')]()['then'](function(){_0x298d49[_0x7afe('0x26')](0xcc)[_0x7afe('0x30')]();});}};}function handleEntityNotFound(_0x92e887,_0x382d67){return function(_0x3775c5){if(!_0x3775c5){_0x92e887[_0x7afe('0x25')](0x194);}return _0x3775c5;};}function handleError(_0x2c6e38,_0x395919){_0x395919=_0x395919||0x1f4;return function(_0x497745){logger[_0x7afe('0x21')](_0x497745[_0x7afe('0x31')]);if(_0x497745['name']){delete _0x497745['name'];}_0x2c6e38[_0x7afe('0x26')](_0x395919)[_0x7afe('0x32')](_0x497745);};}exports['index']=function(_0x52e002,_0x42e705){var _0x41756b={},_0x2b4dfe={},_0x1f3f77={'count':0x0,'rows':[]};var _0x467dda=_['map'](db[_0x7afe('0x33')][_0x7afe('0x34')],function(_0x4a1e8a){return{'name':_0x4a1e8a['fieldName'],'type':_0x4a1e8a[_0x7afe('0x35')][_0x7afe('0x36')]};});_0x2b4dfe[_0x7afe('0x37')]=_['map'](_0x467dda,_0x7afe('0x38'));_0x2b4dfe[_0x7afe('0x39')]=_[_0x7afe('0x3a')](_0x52e002['query']);_0x2b4dfe[_0x7afe('0x3b')]=_[_0x7afe('0x3c')](_0x2b4dfe[_0x7afe('0x37')],_0x2b4dfe[_0x7afe('0x39')]);_0x41756b['attributes']=_[_0x7afe('0x3c')](_0x2b4dfe[_0x7afe('0x37')],qs[_0x7afe('0x3d')](_0x52e002[_0x7afe('0x39')][_0x7afe('0x3d')]));_0x41756b['attributes']=_0x41756b[_0x7afe('0x3e')][_0x7afe('0x3f')]?_0x41756b['attributes']:_0x2b4dfe['model'];if(!_0x52e002[_0x7afe('0x39')]['hasOwnProperty'](_0x7afe('0x40'))){_0x41756b[_0x7afe('0x29')]=qs[_0x7afe('0x29')](_0x52e002[_0x7afe('0x39')]['limit']);_0x41756b['offset']=qs['offset'](_0x52e002[_0x7afe('0x39')][_0x7afe('0x28')]);}_0x41756b[_0x7afe('0x41')]=qs[_0x7afe('0x42')](_0x52e002[_0x7afe('0x39')][_0x7afe('0x42')]);_0x41756b[_0x7afe('0x43')]=qs[_0x7afe('0x3b')](_['pick'](_0x52e002[_0x7afe('0x39')],_0x2b4dfe['filters']),_0x467dda);if(_0x52e002[_0x7afe('0x39')][_0x7afe('0x44')]){_0x41756b[_0x7afe('0x43')]=_[_0x7afe('0x45')](_0x41756b[_0x7afe('0x43')],{'$or':_['map'](_0x467dda,function(_0x580c26){if(_0x580c26[_0x7afe('0x35')]!==_0x7afe('0x46')){var _0x12dc2b={};_0x12dc2b[_0x580c26[_0x7afe('0x38')]]={'$like':'%'+_0x52e002[_0x7afe('0x39')][_0x7afe('0x44')]+'%'};return _0x12dc2b;}})});}_0x41756b=_[_0x7afe('0x45')]({},_0x41756b,_0x52e002[_0x7afe('0x47')]);var _0xb5020e={'where':_0x41756b[_0x7afe('0x43')]};return db[_0x7afe('0x33')][_0x7afe('0x48')](_0xb5020e)[_0x7afe('0x1b')](function(_0x49ebdd){_0x1f3f77[_0x7afe('0x48')]=_0x49ebdd;if(_0x52e002[_0x7afe('0x39')]['includeAll']){_0x41756b[_0x7afe('0x49')]=[{'all':!![]}];}return db[_0x7afe('0x33')]['findAll'](_0x41756b);})[_0x7afe('0x1b')](function(_0x3a61f6){_0x1f3f77[_0x7afe('0x4a')]=_0x3a61f6;return _0x1f3f77;})[_0x7afe('0x1b')](respondWithFilteredResult(_0x42e705,_0x41756b))[_0x7afe('0x4b')](handleError(_0x42e705,null));};exports[_0x7afe('0x4c')]=function(_0x19bece,_0x592818){var _0x3e0009={'raw':![],'where':{'id':_0x19bece['params']['id']}},_0x5a8027={};_0x5a8027[_0x7afe('0x37')]=_['keys'](db['DeskConfiguration'][_0x7afe('0x34')]);_0x5a8027['query']=_[_0x7afe('0x3a')](_0x19bece[_0x7afe('0x39')]);_0x5a8027[_0x7afe('0x4d')]=_[_0x7afe('0x3c')](_0x5a8027[_0x7afe('0x37')],_0x5a8027[_0x7afe('0x39')]);_0x3e0009[_0x7afe('0x3e')]=_['intersection'](_0x5a8027[_0x7afe('0x37')],qs[_0x7afe('0x3d')](_0x19bece[_0x7afe('0x39')][_0x7afe('0x3d')]));_0x3e0009[_0x7afe('0x3e')]=_0x3e0009[_0x7afe('0x3e')]['length']?_0x3e0009['attributes']:_0x5a8027[_0x7afe('0x37')];if(_0x19bece[_0x7afe('0x39')][_0x7afe('0x4e')]){_0x3e0009[_0x7afe('0x49')]=[{'all':!![]}];}_0x3e0009=_[_0x7afe('0x45')]({},_0x3e0009,_0x19bece[_0x7afe('0x47')]);return db[_0x7afe('0x33')][_0x7afe('0x4f')](_0x3e0009)[_0x7afe('0x1b')](handleEntityNotFound(_0x592818,null))[_0x7afe('0x1b')](respondWithResult(_0x592818,null))[_0x7afe('0x4b')](handleError(_0x592818,null));};exports['create']=function(_0x726757,_0x5b1acc){return db[_0x7afe('0x33')][_0x7afe('0x50')](_0x726757[_0x7afe('0x51')],{})[_0x7afe('0x1b')](respondWithResult(_0x5b1acc,0xc9))[_0x7afe('0x4b')](handleError(_0x5b1acc,null));};exports[_0x7afe('0x2e')]=function(_0x25caab,_0xdb9daa){if(_0x25caab[_0x7afe('0x51')]['id']){delete _0x25caab[_0x7afe('0x51')]['id'];}return db[_0x7afe('0x33')][_0x7afe('0x4f')]({'where':{'id':_0x25caab[_0x7afe('0x52')]['id']}})[_0x7afe('0x1b')](handleEntityNotFound(_0xdb9daa,null))[_0x7afe('0x1b')](saveUpdates(_0x25caab[_0x7afe('0x51')],null))[_0x7afe('0x1b')](respondWithResult(_0xdb9daa,null))[_0x7afe('0x4b')](handleError(_0xdb9daa,null));};exports[_0x7afe('0x2f')]=function(_0x296ea3,_0x4a7f87){return db[_0x7afe('0x33')][_0x7afe('0x4f')]({'where':{'id':_0x296ea3[_0x7afe('0x52')]['id']}})[_0x7afe('0x1b')](handleEntityNotFound(_0x4a7f87,null))[_0x7afe('0x1b')](removeEntity(_0x4a7f87,null))[_0x7afe('0x4b')](handleError(_0x4a7f87,null));};exports[_0x7afe('0x53')]=function(_0x1774e7,_0x45834c,_0x6cf85c){var _0x8e6128={};var _0x3a46af={};var _0x17157e;var _0x4fe7b4;return db[_0x7afe('0x33')]['findOne']({'where':{'id':_0x1774e7[_0x7afe('0x52')]['id']}})[_0x7afe('0x1b')](handleEntityNotFound(_0x45834c,null))[_0x7afe('0x1b')](function(_0x47103c){if(_0x47103c){_0x17157e=_0x47103c;_0x3a46af[_0x7afe('0x37')]=_['keys'](db[_0x7afe('0x54')][_0x7afe('0x34')]);_0x3a46af[_0x7afe('0x39')]=_[_0x7afe('0x3a')](_0x1774e7['query']);_0x3a46af[_0x7afe('0x3b')]=_[_0x7afe('0x3c')](_0x3a46af['model'],_0x3a46af[_0x7afe('0x39')]);_0x8e6128[_0x7afe('0x3e')]=_[_0x7afe('0x3c')](_0x3a46af[_0x7afe('0x37')],qs['fields'](_0x1774e7[_0x7afe('0x39')][_0x7afe('0x3d')]));_0x8e6128[_0x7afe('0x3e')]=_0x8e6128[_0x7afe('0x3e')][_0x7afe('0x3f')]?_0x8e6128[_0x7afe('0x3e')]:_0x3a46af[_0x7afe('0x37')];_0x8e6128[_0x7afe('0x41')]=qs['sort'](_0x1774e7[_0x7afe('0x39')][_0x7afe('0x42')]);_0x8e6128[_0x7afe('0x43')]=qs[_0x7afe('0x3b')](_[_0x7afe('0x55')](_0x1774e7[_0x7afe('0x39')],_0x3a46af[_0x7afe('0x3b')]));if(_0x1774e7['query']['filter']){_0x8e6128[_0x7afe('0x43')]=_['merge'](_0x8e6128[_0x7afe('0x43')],{'$or':_[_0x7afe('0x56')](_0x8e6128[_0x7afe('0x3e')],function(_0x189a6a){var _0x349536={};_0x349536[_0x189a6a]={'$like':'%'+_0x1774e7['query'][_0x7afe('0x44')]+'%'};return _0x349536;})});}_0x8e6128=_[_0x7afe('0x45')]({},_0x8e6128,_0x1774e7[_0x7afe('0x47')]);return _0x17157e[_0x7afe('0x53')](_0x8e6128);}})[_0x7afe('0x1b')](function(_0x239088){if(_0x239088){_0x4fe7b4=_0x239088[_0x7afe('0x3f')];if(!_0x1774e7[_0x7afe('0x39')][_0x7afe('0x57')]('nolimit')){_0x8e6128[_0x7afe('0x29')]=qs[_0x7afe('0x29')](_0x1774e7[_0x7afe('0x39')][_0x7afe('0x29')]);_0x8e6128[_0x7afe('0x28')]=qs[_0x7afe('0x28')](_0x1774e7[_0x7afe('0x39')]['offset']);}return _0x17157e[_0x7afe('0x53')](_0x8e6128);}})[_0x7afe('0x1b')](function(_0x26654e){if(_0x26654e){return _0x26654e?{'count':_0x4fe7b4,'rows':_0x26654e}:null;}})[_0x7afe('0x1b')](respondWithResult(_0x45834c,null))['catch'](handleError(_0x45834c,null));};exports['getSubjects']=function(_0x576eb2,_0x5a80ed,_0x415372){var _0x562f65={};var _0x3144d0={};var _0x1c7886;var _0xa9404a;return db[_0x7afe('0x33')]['findOne']({'where':{'id':_0x576eb2[_0x7afe('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a80ed,null))[_0x7afe('0x1b')](function(_0x2d4bf3){if(_0x2d4bf3){_0x1c7886=_0x2d4bf3;_0x3144d0[_0x7afe('0x37')]=_[_0x7afe('0x3a')](db['DeskField'][_0x7afe('0x34')]);_0x3144d0['query']=_[_0x7afe('0x3a')](_0x576eb2[_0x7afe('0x39')]);_0x3144d0['filters']=_[_0x7afe('0x3c')](_0x3144d0[_0x7afe('0x37')],_0x3144d0[_0x7afe('0x39')]);_0x562f65[_0x7afe('0x3e')]=_[_0x7afe('0x3c')](_0x3144d0['model'],qs[_0x7afe('0x3d')](_0x576eb2[_0x7afe('0x39')][_0x7afe('0x3d')]));_0x562f65[_0x7afe('0x3e')]=_0x562f65[_0x7afe('0x3e')][_0x7afe('0x3f')]?_0x562f65['attributes']:_0x3144d0[_0x7afe('0x37')];_0x562f65[_0x7afe('0x41')]=qs['sort'](_0x576eb2[_0x7afe('0x39')][_0x7afe('0x42')]);_0x562f65[_0x7afe('0x43')]=qs['filters'](_[_0x7afe('0x55')](_0x576eb2[_0x7afe('0x39')],_0x3144d0['filters']));if(_0x576eb2[_0x7afe('0x39')][_0x7afe('0x44')]){_0x562f65[_0x7afe('0x43')]=_[_0x7afe('0x45')](_0x562f65[_0x7afe('0x43')],{'$or':_[_0x7afe('0x56')](_0x562f65[_0x7afe('0x3e')],function(_0xfdb68d){var _0x1669ca={};_0x1669ca[_0xfdb68d]={'$like':'%'+_0x576eb2['query'][_0x7afe('0x44')]+'%'};return _0x1669ca;})});}_0x562f65=_[_0x7afe('0x45')]({},_0x562f65,_0x576eb2['options']);return _0x1c7886[_0x7afe('0x58')](_0x562f65);}})[_0x7afe('0x1b')](function(_0x3cad34){if(_0x3cad34){_0xa9404a=_0x3cad34[_0x7afe('0x3f')];if(!_0x576eb2[_0x7afe('0x39')][_0x7afe('0x57')](_0x7afe('0x40'))){_0x562f65[_0x7afe('0x29')]=qs[_0x7afe('0x29')](_0x576eb2[_0x7afe('0x39')][_0x7afe('0x29')]);_0x562f65[_0x7afe('0x28')]=qs[_0x7afe('0x28')](_0x576eb2[_0x7afe('0x39')][_0x7afe('0x28')]);}return _0x1c7886['getSubjects'](_0x562f65);}})[_0x7afe('0x1b')](function(_0x484524){if(_0x484524){return _0x484524?{'count':_0xa9404a,'rows':_0x484524}:null;}})[_0x7afe('0x1b')](respondWithResult(_0x5a80ed,null))[_0x7afe('0x4b')](handleError(_0x5a80ed,null));};exports[_0x7afe('0x59')]=function(_0x4f97f7,_0x19f746,_0x483b17){var _0x197f96={};var _0x5101a0={};var _0x1f6378;var _0x1a8253;return db[_0x7afe('0x33')][_0x7afe('0x5a')]({'where':{'id':_0x4f97f7[_0x7afe('0x52')]['id']}})[_0x7afe('0x1b')](handleEntityNotFound(_0x19f746,null))[_0x7afe('0x1b')](function(_0x43c0e6){if(_0x43c0e6){_0x1f6378=_0x43c0e6;_0x5101a0[_0x7afe('0x37')]=_[_0x7afe('0x3a')](db[_0x7afe('0x54')][_0x7afe('0x34')]);_0x5101a0[_0x7afe('0x39')]=_[_0x7afe('0x3a')](_0x4f97f7[_0x7afe('0x39')]);_0x5101a0['filters']=_['intersection'](_0x5101a0['model'],_0x5101a0[_0x7afe('0x39')]);_0x197f96[_0x7afe('0x3e')]=_[_0x7afe('0x3c')](_0x5101a0[_0x7afe('0x37')],qs[_0x7afe('0x3d')](_0x4f97f7[_0x7afe('0x39')]['fields']));_0x197f96['attributes']=_0x197f96['attributes'][_0x7afe('0x3f')]?_0x197f96[_0x7afe('0x3e')]:_0x5101a0[_0x7afe('0x37')];_0x197f96[_0x7afe('0x41')]=qs['sort'](_0x4f97f7['query'][_0x7afe('0x42')]);_0x197f96['where']=qs[_0x7afe('0x3b')](_[_0x7afe('0x55')](_0x4f97f7[_0x7afe('0x39')],_0x5101a0[_0x7afe('0x3b')]));if(_0x4f97f7[_0x7afe('0x39')][_0x7afe('0x44')]){_0x197f96[_0x7afe('0x43')]=_[_0x7afe('0x45')](_0x197f96[_0x7afe('0x43')],{'$or':_[_0x7afe('0x56')](_0x197f96[_0x7afe('0x3e')],function(_0x156e44){var _0x1b947b={};_0x1b947b[_0x156e44]={'$like':'%'+_0x4f97f7[_0x7afe('0x39')][_0x7afe('0x44')]+'%'};return _0x1b947b;})});}_0x197f96=_[_0x7afe('0x45')]({},_0x197f96,_0x4f97f7[_0x7afe('0x47')]);return _0x1f6378[_0x7afe('0x59')](_0x197f96);}})[_0x7afe('0x1b')](function(_0x1f3e93){if(_0x1f3e93){_0x1a8253=_0x1f3e93[_0x7afe('0x3f')];if(!_0x4f97f7[_0x7afe('0x39')][_0x7afe('0x57')](_0x7afe('0x40'))){_0x197f96[_0x7afe('0x29')]=qs[_0x7afe('0x29')](_0x4f97f7['query'][_0x7afe('0x29')]);_0x197f96[_0x7afe('0x28')]=qs['offset'](_0x4f97f7[_0x7afe('0x39')][_0x7afe('0x28')]);}return _0x1f6378[_0x7afe('0x59')](_0x197f96);}})[_0x7afe('0x1b')](function(_0x5f0b54){if(_0x5f0b54){return _0x5f0b54?{'count':_0x1a8253,'rows':_0x5f0b54}:null;}})[_0x7afe('0x1b')](respondWithResult(_0x19f746,null))['catch'](handleError(_0x19f746,null));};exports[_0x7afe('0x5b')]=function(_0x39803d,_0xefd75d,_0x2f6233){var _0x3e69e3={};var _0x4d4d66={};var _0x25332b;var _0x241458;return db['DeskConfiguration'][_0x7afe('0x5a')]({'where':{'id':_0x39803d['params']['id']}})['then'](handleEntityNotFound(_0xefd75d,null))[_0x7afe('0x1b')](function(_0x5aed85){if(_0x5aed85){_0x25332b=_0x5aed85;_0x4d4d66[_0x7afe('0x37')]=_[_0x7afe('0x3a')](db[_0x7afe('0x5c')]['rawAttributes']);_0x4d4d66[_0x7afe('0x39')]=_[_0x7afe('0x3a')](_0x39803d[_0x7afe('0x39')]);_0x4d4d66[_0x7afe('0x3b')]=_['intersection'](_0x4d4d66[_0x7afe('0x37')],_0x4d4d66['query']);_0x3e69e3[_0x7afe('0x3e')]=_[_0x7afe('0x3c')](_0x4d4d66['model'],qs[_0x7afe('0x3d')](_0x39803d[_0x7afe('0x39')][_0x7afe('0x3d')]));_0x3e69e3[_0x7afe('0x3e')]=_0x3e69e3[_0x7afe('0x3e')]['length']?_0x3e69e3[_0x7afe('0x3e')]:_0x4d4d66[_0x7afe('0x37')];_0x3e69e3[_0x7afe('0x41')]=qs['sort'](_0x39803d['query'][_0x7afe('0x42')]);_0x3e69e3['where']=qs[_0x7afe('0x3b')](_['pick'](_0x39803d[_0x7afe('0x39')],_0x4d4d66[_0x7afe('0x3b')]));if(_0x39803d[_0x7afe('0x39')]['filter']){_0x3e69e3[_0x7afe('0x43')]=_['merge'](_0x3e69e3[_0x7afe('0x43')],{'$or':_[_0x7afe('0x56')](_0x3e69e3[_0x7afe('0x3e')],function(_0x342678){var _0x449690={};_0x449690[_0x342678]={'$like':'%'+_0x39803d['query'][_0x7afe('0x44')]+'%'};return _0x449690;})});}_0x3e69e3=_[_0x7afe('0x45')]({},_0x3e69e3,_0x39803d['options']);return _0x25332b[_0x7afe('0x5b')](_0x3e69e3);}})[_0x7afe('0x1b')](function(_0x597759){if(_0x597759){_0x241458=_0x597759['length'];if(!_0x39803d[_0x7afe('0x39')][_0x7afe('0x57')](_0x7afe('0x40'))){_0x3e69e3[_0x7afe('0x29')]=qs[_0x7afe('0x29')](_0x39803d[_0x7afe('0x39')]['limit']);_0x3e69e3['offset']=qs['offset'](_0x39803d[_0x7afe('0x39')]['offset']);}return _0x25332b[_0x7afe('0x5b')](_0x3e69e3);}})[_0x7afe('0x1b')](function(_0x250943){if(_0x250943){return _0x250943?{'count':_0x241458,'rows':_0x250943}:null;}})[_0x7afe('0x1b')](respondWithResult(_0xefd75d,null))[_0x7afe('0x4b')](handleError(_0xefd75d,null));};exports[_0x7afe('0x5d')]=function(_0x1689dd,_0x349899,_0x3faa35){if(_0x1689dd[_0x7afe('0x51')]['id']){delete _0x1689dd['body']['id'];}return db[_0x7afe('0x33')][_0x7afe('0x5a')]({'where':{'id':_0x1689dd[_0x7afe('0x52')]['id']}})[_0x7afe('0x1b')](handleEntityNotFound(_0x349899,null))[_0x7afe('0x1b')](function(_0x4bcc87){if(_0x4bcc87){return _0x4bcc87[_0x7afe('0x5d')](_0x1689dd[_0x7afe('0x51')][_0x7afe('0x5e')]||[]);}return null;})[_0x7afe('0x1b')](respondWithResult(_0x349899,null))[_0x7afe('0x4b')](handleError(_0x349899,null));}; \ No newline at end of file +var _0x9e6b=['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','../../config/license/util','../../mysqldb','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','name','map','DeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','show','params','filtears','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','order','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','bluebird','mustache'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x9e6b,0x1ad));var _0xb9e6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x9e6b[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9e6('0x0'));var rimraf=require(_0xb9e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9e6('0x2'));var moment=require(_0xb9e6('0x3'));var BPromise=require(_0xb9e6('0x4'));var Mustache=require(_0xb9e6('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb9e6('0x6'));var ejs=require(_0xb9e6('0x7'));var fs=require('fs');var _=require(_0xb9e6('0x8'));var squel=require(_0xb9e6('0x9'));var crypto=require(_0xb9e6('0xa'));var jsforce=require(_0xb9e6('0xb'));var deskjs=require(_0xb9e6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb9e6('0xd'));var Papa=require(_0xb9e6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9e6('0xf'));var as=require(_0xb9e6('0x10'));var hardwareService=require(_0xb9e6('0x11'));var logger=require(_0xb9e6('0x12'))(_0xb9e6('0x13'));var utils=require(_0xb9e6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb9e6('0x15'));var db=require(_0xb9e6('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb9e6('0x17')][_0xb9e6('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x42b08d,_0x2c20a5,_0x4b18b3,_0x26c4d6){return new BPromise(function(_0x572e95,_0x5ce8e1){var _0x481cce=_0x26c4d6||client;return _0x481cce['request'](_0x42b08d,_0x4b18b3)[_0xb9e6('0x19')](function(_0x13b083){logger['info'](_0xb9e6('0x1a'),_0x2c20a5,_0xb9e6('0x1b'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2c20a5,_0xb9e6('0x1b'),JSON[_0xb9e6('0x1c')](_0x13b083));if(_0x13b083['error']){if(_0x13b083[_0xb9e6('0x1d')][_0xb9e6('0x1e')]===0x1f4){logger[_0xb9e6('0x1d')](_0xb9e6('0x1a'),_0x2c20a5,_0x13b083[_0xb9e6('0x1d')][_0xb9e6('0x1f')]);return _0x5ce8e1(_0x13b083[_0xb9e6('0x1d')]['message']);}logger[_0xb9e6('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x2c20a5,_0x13b083['error'][_0xb9e6('0x1f')]);return _0x572e95(_0x13b083[_0xb9e6('0x1d')][_0xb9e6('0x1f')]);}else{logger[_0xb9e6('0x20')](_0xb9e6('0x1a'),_0x2c20a5,'request\x20sent');_0x572e95(_0x13b083['result'][_0xb9e6('0x1f')]);}})[_0xb9e6('0x21')](function(_0x42614c){logger[_0xb9e6('0x1d')](_0xb9e6('0x1a'),_0x2c20a5,_0x42614c);_0x5ce8e1(_0x42614c);});});}function respondWithStatusCode(_0x3a2415,_0x122292){_0x122292=_0x122292||0xcc;return function(_0xf71443){if(_0xf71443){return _0x3a2415['sendStatus'](_0x122292);}return _0x3a2415[_0xb9e6('0x22')](_0x122292)['end']();};}function respondWithResult(_0x32b9f0,_0x3ecda0){_0x3ecda0=_0x3ecda0||0xc8;return function(_0x59c086){if(_0x59c086){return _0x32b9f0[_0xb9e6('0x22')](_0x3ecda0)[_0xb9e6('0x23')](_0x59c086);}};}function respondWithFilteredResult(_0x343686,_0x374b21){return function(_0x4b9c3c){if(_0x4b9c3c){var _0x725abb=_0x4b9c3c[_0xb9e6('0x24')],_0x2255a3=_0x374b21['offset'],_0x5b89af=_0x374b21[_0xb9e6('0x25')]+_0x374b21[_0xb9e6('0x26')],_0x2b9c61;if(_0x5b89af>=_0x725abb){_0x5b89af=_0x725abb;_0x2b9c61=0xc8;}else{_0x2b9c61=0xce;}_0x343686['status'](_0x2b9c61);return _0x343686[_0xb9e6('0x27')]('Content-Range',_0x2255a3+'-'+_0x5b89af+'/'+_0x725abb)[_0xb9e6('0x23')](_0x4b9c3c);}return null;};}function patchUpdates(_0x5366c0){return function(_0x400adf){try{jsonpatch[_0xb9e6('0x28')](_0x400adf,_0x5366c0,!![]);}catch(_0x506e9e){return BPromise[_0xb9e6('0x29')](_0x506e9e);}return _0x400adf[_0xb9e6('0x2a')]();};}function saveUpdates(_0x10d3ad,_0x1e7f20){return function(_0x306106){if(_0x306106){return _0x306106[_0xb9e6('0x2b')](_0x10d3ad)[_0xb9e6('0x19')](function(_0x59704d){return _0x59704d;});}return null;};}function removeEntity(_0x3b5bca,_0x458f79){return function(_0x353ca9){if(_0x353ca9){return _0x353ca9[_0xb9e6('0x2c')]()[_0xb9e6('0x19')](function(){_0x3b5bca[_0xb9e6('0x22')](0xcc)[_0xb9e6('0x2d')]();});}};}function handleEntityNotFound(_0x3dd6ff,_0x3aa148){return function(_0xc7849d){if(!_0xc7849d){_0x3dd6ff[_0xb9e6('0x2e')](0x194);}return _0xc7849d;};}function handleError(_0x4256a0,_0x43bbec){_0x43bbec=_0x43bbec||0x1f4;return function(_0x383cc3){logger[_0xb9e6('0x1d')](_0x383cc3['stack']);if(_0x383cc3[_0xb9e6('0x2f')]){delete _0x383cc3[_0xb9e6('0x2f')];}_0x4256a0['status'](_0x43bbec)['send'](_0x383cc3);};}exports['index']=function(_0x58024b,_0x1b873c){var _0x5da842={},_0x4a6ed6={},_0x1a57c8={'count':0x0,'rows':[]};var _0x29c36c=_[_0xb9e6('0x30')](db[_0xb9e6('0x31')][_0xb9e6('0x32')],function(_0x4adaae){return{'name':_0x4adaae['fieldName'],'type':_0x4adaae['type'][_0xb9e6('0x33')]};});_0x4a6ed6[_0xb9e6('0x34')]=_['map'](_0x29c36c,_0xb9e6('0x2f'));_0x4a6ed6[_0xb9e6('0x35')]=_[_0xb9e6('0x36')](_0x58024b['query']);_0x4a6ed6[_0xb9e6('0x37')]=_[_0xb9e6('0x38')](_0x4a6ed6['model'],_0x4a6ed6[_0xb9e6('0x35')]);_0x5da842[_0xb9e6('0x39')]=_[_0xb9e6('0x38')](_0x4a6ed6[_0xb9e6('0x34')],qs[_0xb9e6('0x3a')](_0x58024b[_0xb9e6('0x35')][_0xb9e6('0x3a')]));_0x5da842[_0xb9e6('0x39')]=_0x5da842[_0xb9e6('0x39')][_0xb9e6('0x3b')]?_0x5da842[_0xb9e6('0x39')]:_0x4a6ed6[_0xb9e6('0x34')];if(!_0x58024b['query']['hasOwnProperty']('nolimit')){_0x5da842[_0xb9e6('0x26')]=qs[_0xb9e6('0x26')](_0x58024b[_0xb9e6('0x35')][_0xb9e6('0x26')]);_0x5da842[_0xb9e6('0x25')]=qs['offset'](_0x58024b[_0xb9e6('0x35')][_0xb9e6('0x25')]);}_0x5da842['order']=qs[_0xb9e6('0x3c')](_0x58024b['query']['sort']);_0x5da842['where']=qs[_0xb9e6('0x37')](_[_0xb9e6('0x3d')](_0x58024b[_0xb9e6('0x35')],_0x4a6ed6[_0xb9e6('0x37')]),_0x29c36c);if(_0x58024b['query'][_0xb9e6('0x3e')]){_0x5da842[_0xb9e6('0x3f')]=_['merge'](_0x5da842[_0xb9e6('0x3f')],{'$or':_[_0xb9e6('0x30')](_0x29c36c,function(_0x570d41){if(_0x570d41['type']!==_0xb9e6('0x40')){var _0x173d33={};_0x173d33[_0x570d41[_0xb9e6('0x2f')]]={'$like':'%'+_0x58024b['query'][_0xb9e6('0x3e')]+'%'};return _0x173d33;}})});}_0x5da842=_[_0xb9e6('0x41')]({},_0x5da842,_0x58024b[_0xb9e6('0x42')]);var _0x419315={'where':_0x5da842[_0xb9e6('0x3f')]};return db['DeskConfiguration'][_0xb9e6('0x24')](_0x419315)['then'](function(_0x599831){_0x1a57c8['count']=_0x599831;if(_0x58024b[_0xb9e6('0x35')][_0xb9e6('0x43')]){_0x5da842[_0xb9e6('0x44')]=[{'all':!![]}];}return db[_0xb9e6('0x31')]['findAll'](_0x5da842);})[_0xb9e6('0x19')](function(_0x252fa8){_0x1a57c8['rows']=_0x252fa8;return _0x1a57c8;})['then'](respondWithFilteredResult(_0x1b873c,_0x5da842))[_0xb9e6('0x21')](handleError(_0x1b873c,null));};exports[_0xb9e6('0x45')]=function(_0xc2b28f,_0x26a47e){var _0x1e2de1={'raw':![],'where':{'id':_0xc2b28f[_0xb9e6('0x46')]['id']}},_0x268357={};_0x268357[_0xb9e6('0x34')]=_['keys'](db[_0xb9e6('0x31')][_0xb9e6('0x32')]);_0x268357[_0xb9e6('0x35')]=_[_0xb9e6('0x36')](_0xc2b28f[_0xb9e6('0x35')]);_0x268357[_0xb9e6('0x47')]=_['intersection'](_0x268357[_0xb9e6('0x34')],_0x268357[_0xb9e6('0x35')]);_0x1e2de1[_0xb9e6('0x39')]=_[_0xb9e6('0x38')](_0x268357['model'],qs[_0xb9e6('0x3a')](_0xc2b28f['query'][_0xb9e6('0x3a')]));_0x1e2de1['attributes']=_0x1e2de1[_0xb9e6('0x39')][_0xb9e6('0x3b')]?_0x1e2de1[_0xb9e6('0x39')]:_0x268357[_0xb9e6('0x34')];if(_0xc2b28f['query'][_0xb9e6('0x43')]){_0x1e2de1['include']=[{'all':!![]}];}_0x1e2de1=_[_0xb9e6('0x41')]({},_0x1e2de1,_0xc2b28f[_0xb9e6('0x42')]);return db[_0xb9e6('0x31')][_0xb9e6('0x48')](_0x1e2de1)[_0xb9e6('0x19')](handleEntityNotFound(_0x26a47e,null))[_0xb9e6('0x19')](respondWithResult(_0x26a47e,null))['catch'](handleError(_0x26a47e,null));};exports[_0xb9e6('0x49')]=function(_0x15da89,_0x399fa2){return db[_0xb9e6('0x31')][_0xb9e6('0x49')](_0x15da89[_0xb9e6('0x4a')],{})[_0xb9e6('0x19')](respondWithResult(_0x399fa2,0xc9))[_0xb9e6('0x21')](handleError(_0x399fa2,null));};exports[_0xb9e6('0x2b')]=function(_0xf43b6,_0x5c6a72){if(_0xf43b6[_0xb9e6('0x4a')]['id']){delete _0xf43b6[_0xb9e6('0x4a')]['id'];}return db[_0xb9e6('0x31')][_0xb9e6('0x48')]({'where':{'id':_0xf43b6[_0xb9e6('0x46')]['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x5c6a72,null))['then'](saveUpdates(_0xf43b6[_0xb9e6('0x4a')],null))[_0xb9e6('0x19')](respondWithResult(_0x5c6a72,null))['catch'](handleError(_0x5c6a72,null));};exports[_0xb9e6('0x2c')]=function(_0x1a5ca7,_0x26378c){return db['DeskConfiguration']['find']({'where':{'id':_0x1a5ca7[_0xb9e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x26378c,null))[_0xb9e6('0x19')](removeEntity(_0x26378c,null))[_0xb9e6('0x21')](handleError(_0x26378c,null));};exports[_0xb9e6('0x4b')]=function(_0x1a9201,_0x3331d3,_0x1c6f91){var _0x47c30c={};var _0x4589c0={};var _0x3abf19;var _0x35f8ba;return db[_0xb9e6('0x31')][_0xb9e6('0x4c')]({'where':{'id':_0x1a9201[_0xb9e6('0x46')]['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x3331d3,null))['then'](function(_0xc6b6ad){if(_0xc6b6ad){_0x3abf19=_0xc6b6ad;_0x4589c0[_0xb9e6('0x34')]=_[_0xb9e6('0x36')](db[_0xb9e6('0x4d')]['rawAttributes']);_0x4589c0['query']=_['keys'](_0x1a9201[_0xb9e6('0x35')]);_0x4589c0[_0xb9e6('0x37')]=_[_0xb9e6('0x38')](_0x4589c0[_0xb9e6('0x34')],_0x4589c0[_0xb9e6('0x35')]);_0x47c30c['attributes']=_['intersection'](_0x4589c0[_0xb9e6('0x34')],qs['fields'](_0x1a9201[_0xb9e6('0x35')][_0xb9e6('0x3a')]));_0x47c30c[_0xb9e6('0x39')]=_0x47c30c['attributes'][_0xb9e6('0x3b')]?_0x47c30c[_0xb9e6('0x39')]:_0x4589c0[_0xb9e6('0x34')];_0x47c30c['order']=qs[_0xb9e6('0x3c')](_0x1a9201[_0xb9e6('0x35')][_0xb9e6('0x3c')]);_0x47c30c[_0xb9e6('0x3f')]=qs[_0xb9e6('0x37')](_['pick'](_0x1a9201[_0xb9e6('0x35')],_0x4589c0['filters']));if(_0x1a9201['query'][_0xb9e6('0x3e')]){_0x47c30c[_0xb9e6('0x3f')]=_['merge'](_0x47c30c[_0xb9e6('0x3f')],{'$or':_[_0xb9e6('0x30')](_0x47c30c[_0xb9e6('0x39')],function(_0x218b48){var _0xa451={};_0xa451[_0x218b48]={'$like':'%'+_0x1a9201[_0xb9e6('0x35')]['filter']+'%'};return _0xa451;})});}_0x47c30c=_[_0xb9e6('0x41')]({},_0x47c30c,_0x1a9201[_0xb9e6('0x42')]);return _0x3abf19[_0xb9e6('0x4b')](_0x47c30c);}})[_0xb9e6('0x19')](function(_0x19d2eb){if(_0x19d2eb){_0x35f8ba=_0x19d2eb['length'];if(!_0x1a9201[_0xb9e6('0x35')]['hasOwnProperty'](_0xb9e6('0x4e'))){_0x47c30c['limit']=qs[_0xb9e6('0x26')](_0x1a9201[_0xb9e6('0x35')][_0xb9e6('0x26')]);_0x47c30c[_0xb9e6('0x25')]=qs[_0xb9e6('0x25')](_0x1a9201[_0xb9e6('0x35')][_0xb9e6('0x25')]);}return _0x3abf19['getFields'](_0x47c30c);}})[_0xb9e6('0x19')](function(_0x132a72){if(_0x132a72){return _0x132a72?{'count':_0x35f8ba,'rows':_0x132a72}:null;}})['then'](respondWithResult(_0x3331d3,null))[_0xb9e6('0x21')](handleError(_0x3331d3,null));};exports[_0xb9e6('0x4f')]=function(_0x4f1cc5,_0x19a13a,_0x148b3b){var _0xaa5b3a={};var _0x5a591e={};var _0x52c9c2;var _0x2f4cc8;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4f1cc5[_0xb9e6('0x46')]['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x19a13a,null))[_0xb9e6('0x19')](function(_0x3049c0){if(_0x3049c0){_0x52c9c2=_0x3049c0;_0x5a591e[_0xb9e6('0x34')]=_['keys'](db[_0xb9e6('0x4d')][_0xb9e6('0x32')]);_0x5a591e[_0xb9e6('0x35')]=_[_0xb9e6('0x36')](_0x4f1cc5[_0xb9e6('0x35')]);_0x5a591e[_0xb9e6('0x37')]=_['intersection'](_0x5a591e[_0xb9e6('0x34')],_0x5a591e[_0xb9e6('0x35')]);_0xaa5b3a['attributes']=_[_0xb9e6('0x38')](_0x5a591e['model'],qs[_0xb9e6('0x3a')](_0x4f1cc5[_0xb9e6('0x35')][_0xb9e6('0x3a')]));_0xaa5b3a[_0xb9e6('0x39')]=_0xaa5b3a[_0xb9e6('0x39')]['length']?_0xaa5b3a[_0xb9e6('0x39')]:_0x5a591e[_0xb9e6('0x34')];_0xaa5b3a[_0xb9e6('0x50')]=qs[_0xb9e6('0x3c')](_0x4f1cc5[_0xb9e6('0x35')][_0xb9e6('0x3c')]);_0xaa5b3a[_0xb9e6('0x3f')]=qs['filters'](_[_0xb9e6('0x3d')](_0x4f1cc5['query'],_0x5a591e['filters']));if(_0x4f1cc5[_0xb9e6('0x35')][_0xb9e6('0x3e')]){_0xaa5b3a[_0xb9e6('0x3f')]=_[_0xb9e6('0x41')](_0xaa5b3a['where'],{'$or':_[_0xb9e6('0x30')](_0xaa5b3a[_0xb9e6('0x39')],function(_0x4f22fc){var _0x4ccb48={};_0x4ccb48[_0x4f22fc]={'$like':'%'+_0x4f1cc5[_0xb9e6('0x35')]['filter']+'%'};return _0x4ccb48;})});}_0xaa5b3a=_[_0xb9e6('0x41')]({},_0xaa5b3a,_0x4f1cc5[_0xb9e6('0x42')]);return _0x52c9c2[_0xb9e6('0x4f')](_0xaa5b3a);}})[_0xb9e6('0x19')](function(_0x36cef3){if(_0x36cef3){_0x2f4cc8=_0x36cef3['length'];if(!_0x4f1cc5[_0xb9e6('0x35')][_0xb9e6('0x51')]('nolimit')){_0xaa5b3a[_0xb9e6('0x26')]=qs[_0xb9e6('0x26')](_0x4f1cc5['query'][_0xb9e6('0x26')]);_0xaa5b3a[_0xb9e6('0x25')]=qs[_0xb9e6('0x25')](_0x4f1cc5[_0xb9e6('0x35')][_0xb9e6('0x25')]);}return _0x52c9c2[_0xb9e6('0x4f')](_0xaa5b3a);}})['then'](function(_0x7c6138){if(_0x7c6138){return _0x7c6138?{'count':_0x2f4cc8,'rows':_0x7c6138}:null;}})[_0xb9e6('0x19')](respondWithResult(_0x19a13a,null))[_0xb9e6('0x21')](handleError(_0x19a13a,null));};exports['getDescriptions']=function(_0x8f109d,_0x4785e7,_0x422963){var _0x2fea25={};var _0x4f490a={};var _0x1fe34b;var _0x280a22;return db[_0xb9e6('0x31')][_0xb9e6('0x4c')]({'where':{'id':_0x8f109d['params']['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x4785e7,null))[_0xb9e6('0x19')](function(_0x1ccfac){if(_0x1ccfac){_0x1fe34b=_0x1ccfac;_0x4f490a[_0xb9e6('0x34')]=_[_0xb9e6('0x36')](db[_0xb9e6('0x4d')][_0xb9e6('0x32')]);_0x4f490a[_0xb9e6('0x35')]=_[_0xb9e6('0x36')](_0x8f109d[_0xb9e6('0x35')]);_0x4f490a[_0xb9e6('0x37')]=_[_0xb9e6('0x38')](_0x4f490a['model'],_0x4f490a[_0xb9e6('0x35')]);_0x2fea25[_0xb9e6('0x39')]=_[_0xb9e6('0x38')](_0x4f490a[_0xb9e6('0x34')],qs[_0xb9e6('0x3a')](_0x8f109d['query'][_0xb9e6('0x3a')]));_0x2fea25[_0xb9e6('0x39')]=_0x2fea25[_0xb9e6('0x39')][_0xb9e6('0x3b')]?_0x2fea25[_0xb9e6('0x39')]:_0x4f490a[_0xb9e6('0x34')];_0x2fea25[_0xb9e6('0x50')]=qs['sort'](_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x3c')]);_0x2fea25[_0xb9e6('0x3f')]=qs[_0xb9e6('0x37')](_['pick'](_0x8f109d['query'],_0x4f490a[_0xb9e6('0x37')]));if(_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x3e')]){_0x2fea25[_0xb9e6('0x3f')]=_['merge'](_0x2fea25['where'],{'$or':_[_0xb9e6('0x30')](_0x2fea25[_0xb9e6('0x39')],function(_0x26a9de){var _0x139e18={};_0x139e18[_0x26a9de]={'$like':'%'+_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x3e')]+'%'};return _0x139e18;})});}_0x2fea25=_['merge']({},_0x2fea25,_0x8f109d[_0xb9e6('0x42')]);return _0x1fe34b[_0xb9e6('0x52')](_0x2fea25);}})[_0xb9e6('0x19')](function(_0x21c289){if(_0x21c289){_0x280a22=_0x21c289[_0xb9e6('0x3b')];if(!_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x51')]('nolimit')){_0x2fea25[_0xb9e6('0x26')]=qs[_0xb9e6('0x26')](_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x26')]);_0x2fea25['offset']=qs[_0xb9e6('0x25')](_0x8f109d[_0xb9e6('0x35')][_0xb9e6('0x25')]);}return _0x1fe34b[_0xb9e6('0x52')](_0x2fea25);}})[_0xb9e6('0x19')](function(_0x110b8d){if(_0x110b8d){return _0x110b8d?{'count':_0x280a22,'rows':_0x110b8d}:null;}})[_0xb9e6('0x19')](respondWithResult(_0x4785e7,null))['catch'](handleError(_0x4785e7,null));};exports[_0xb9e6('0x53')]=function(_0x753ba,_0x279156,_0x3ffcbd){var _0xd09d3a={};var _0x5b8db8={};var _0x5adf13;var _0x556066;return db[_0xb9e6('0x31')][_0xb9e6('0x4c')]({'where':{'id':_0x753ba[_0xb9e6('0x46')]['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x279156,null))[_0xb9e6('0x19')](function(_0x33352d){if(_0x33352d){_0x5adf13=_0x33352d;_0x5b8db8[_0xb9e6('0x34')]=_['keys'](db[_0xb9e6('0x54')][_0xb9e6('0x32')]);_0x5b8db8['query']=_[_0xb9e6('0x36')](_0x753ba[_0xb9e6('0x35')]);_0x5b8db8[_0xb9e6('0x37')]=_[_0xb9e6('0x38')](_0x5b8db8[_0xb9e6('0x34')],_0x5b8db8[_0xb9e6('0x35')]);_0xd09d3a[_0xb9e6('0x39')]=_[_0xb9e6('0x38')](_0x5b8db8[_0xb9e6('0x34')],qs['fields'](_0x753ba[_0xb9e6('0x35')][_0xb9e6('0x3a')]));_0xd09d3a[_0xb9e6('0x39')]=_0xd09d3a[_0xb9e6('0x39')][_0xb9e6('0x3b')]?_0xd09d3a[_0xb9e6('0x39')]:_0x5b8db8['model'];_0xd09d3a[_0xb9e6('0x50')]=qs['sort'](_0x753ba[_0xb9e6('0x35')][_0xb9e6('0x3c')]);_0xd09d3a['where']=qs[_0xb9e6('0x37')](_['pick'](_0x753ba[_0xb9e6('0x35')],_0x5b8db8['filters']));if(_0x753ba[_0xb9e6('0x35')][_0xb9e6('0x3e')]){_0xd09d3a[_0xb9e6('0x3f')]=_[_0xb9e6('0x41')](_0xd09d3a[_0xb9e6('0x3f')],{'$or':_[_0xb9e6('0x30')](_0xd09d3a[_0xb9e6('0x39')],function(_0x22f9dc){var _0x1bf4ef={};_0x1bf4ef[_0x22f9dc]={'$like':'%'+_0x753ba[_0xb9e6('0x35')][_0xb9e6('0x3e')]+'%'};return _0x1bf4ef;})});}_0xd09d3a=_[_0xb9e6('0x41')]({},_0xd09d3a,_0x753ba['options']);return _0x5adf13[_0xb9e6('0x53')](_0xd09d3a);}})[_0xb9e6('0x19')](function(_0x1818d7){if(_0x1818d7){_0x556066=_0x1818d7[_0xb9e6('0x3b')];if(!_0x753ba[_0xb9e6('0x35')]['hasOwnProperty'](_0xb9e6('0x4e'))){_0xd09d3a[_0xb9e6('0x26')]=qs['limit'](_0x753ba[_0xb9e6('0x35')]['limit']);_0xd09d3a[_0xb9e6('0x25')]=qs[_0xb9e6('0x25')](_0x753ba['query']['offset']);}return _0x5adf13['getTags'](_0xd09d3a);}})[_0xb9e6('0x19')](function(_0x91b74c){if(_0x91b74c){return _0x91b74c?{'count':_0x556066,'rows':_0x91b74c}:null;}})[_0xb9e6('0x19')](respondWithResult(_0x279156,null))[_0xb9e6('0x21')](handleError(_0x279156,null));};exports['setTags']=function(_0x38031d,_0x532c6d,_0x5c7822){if(_0x38031d[_0xb9e6('0x4a')]['id']){delete _0x38031d['body']['id'];}return db[_0xb9e6('0x31')][_0xb9e6('0x4c')]({'where':{'id':_0x38031d[_0xb9e6('0x46')]['id']}})[_0xb9e6('0x19')](handleEntityNotFound(_0x532c6d,null))[_0xb9e6('0x19')](function(_0x2e59a9){if(_0x2e59a9){return _0x2e59a9[_0xb9e6('0x55')](_0x38031d['body'][_0xb9e6('0x56')]||[]);}return null;})[_0xb9e6('0x19')](respondWithResult(_0x532c6d,null))['catch'](handleError(_0x532c6d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 99a80f8..8bd81fa 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 _0xaa7a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x32b3c2,_0xe56fd){var _0x40a313=function(_0x51ba92){while(--_0x51ba92){_0x32b3c2['push'](_0x32b3c2['shift']());}};_0x40a313(++_0xe56fd);}(_0xaa7a,0x195));var _0xaaa7=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xaa7a[_0x3ec1da];return _0x472358;};'use strict';var _=require(_0xaaa7('0x0'));var util=require(_0xaaa7('0x1'));var logger=require(_0xaaa7('0x2'))('api');var moment=require(_0xaaa7('0x3'));var BPromise=require(_0xaaa7('0x4'));var rp=require(_0xaaa7('0x5'));var fs=require('fs');var path=require(_0xaaa7('0x6'));var rimraf=require(_0xaaa7('0x7'));var config=require(_0xaaa7('0x8'));var attributes=require(_0xaaa7('0x9'));module['exports']=function(_0x4e542f,_0x2c1c5f){return _0x4e542f[_0xaaa7('0xa')]('DeskConfiguration',attributes,{'tableName':_0xaaa7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1034=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1034,0x181));var _0x4103=function(_0x48e246,_0xcaf928){_0x48e246=_0x48e246-0x0;var _0x4492e7=_0x1034[_0x48e246];return _0x4492e7;};'use strict';var _=require(_0x4103('0x0'));var util=require(_0x4103('0x1'));var logger=require(_0x4103('0x2'))(_0x4103('0x3'));var moment=require(_0x4103('0x4'));var BPromise=require(_0x4103('0x5'));var rp=require(_0x4103('0x6'));var fs=require('fs');var path=require(_0x4103('0x7'));var rimraf=require(_0x4103('0x8'));var config=require(_0x4103('0x9'));var attributes=require(_0x4103('0xa'));module[_0x4103('0xb')]=function(_0x30f2d1,_0x2a4e8a){return _0x30f2d1[_0x4103('0xc')]('DeskConfiguration',attributes,{'tableName':_0x4103('0xd'),'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 bde9954..6ee2593 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 _0x63bb=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x200db2,_0x593ff9){var _0x565b52=function(_0x42034b){while(--_0x42034b){_0x200db2['push'](_0x200db2['shift']());}};_0x565b52(++_0x593ff9);}(_0x63bb,0xf8));var _0xb63b=function(_0xf43cb,_0x465374){_0xf43cb=_0xf43cb-0x0;var _0x14e869=_0x63bb[_0xf43cb];return _0x14e869;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var moment=require(_0xb63b('0x2'));var BPromise=require(_0xb63b('0x3'));var rs=require(_0xb63b('0x4'));var fs=require('fs');var Redis=require(_0xb63b('0x5'));var db=require(_0xb63b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb63b('0x7'));var config=require(_0xb63b('0x8'));var jayson=require(_0xb63b('0x9'));var client=jayson[_0xb63b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3eb1be,_0x2a27f9,_0x2aa873){return new BPromise(function(_0x544988,_0x366bda){return client[_0xb63b('0xb')](_0x3eb1be,_0x2aa873)['then'](function(_0x2d5002){logger[_0xb63b('0xc')](_0xb63b('0xd'),_0x2a27f9,_0xb63b('0xe'));logger[_0xb63b('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a27f9,_0xb63b('0xe'),JSON[_0xb63b('0x10')](_0x2d5002));if(_0x2d5002[_0xb63b('0x11')]){if(_0x2d5002['error']['code']===0x1f4){logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x366bda(_0x2d5002['error'][_0xb63b('0x12')]);}logger[_0xb63b('0x11')](_0xb63b('0xd'),_0x2a27f9,_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);return _0x544988(_0x2d5002[_0xb63b('0x11')][_0xb63b('0x12')]);}else{logger['info'](_0xb63b('0xd'),_0x2a27f9,'request\x20sent');_0x544988(_0x2d5002[_0xb63b('0x13')][_0xb63b('0x12')]);}})[_0xb63b('0x14')](function(_0x41bfc4){logger[_0xb63b('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2a27f9,_0x41bfc4);_0x366bda(_0x41bfc4);});});} \ No newline at end of file +var _0x1da1=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x43c5f1,_0x24aded){var _0x3662ff=function(_0x11638d){while(--_0x11638d){_0x43c5f1['push'](_0x43c5f1['shift']());}};_0x3662ff(++_0x24aded);}(_0x1da1,0x1a4));var _0x11da=function(_0x66d684,_0x5b1612){_0x66d684=_0x66d684-0x0;var _0x53d49e=_0x1da1[_0x66d684];return _0x53d49e;};'use strict';var _=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var moment=require(_0x11da('0x2'));var BPromise=require(_0x11da('0x3'));var rs=require(_0x11da('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11da('0x5'));var logger=require(_0x11da('0x6'))(_0x11da('0x7'));var config=require('../../config/environment');var jayson=require(_0x11da('0x8'));var client=jayson[_0x11da('0x9')][_0x11da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecc27,_0x5e7d63,_0x287653){return new BPromise(function(_0x109f4b,_0x4c7757){return client[_0x11da('0xb')](_0x5ecc27,_0x287653)[_0x11da('0xc')](function(_0x5c03d7){logger[_0x11da('0xd')](_0x11da('0xe'),_0x5e7d63,_0x11da('0xf'));logger[_0x11da('0x10')](_0x11da('0x11'),_0x5e7d63,_0x11da('0xf'),JSON[_0x11da('0x12')](_0x5c03d7));if(_0x5c03d7[_0x11da('0x13')]){if(_0x5c03d7[_0x11da('0x13')]['code']===0x1f4){logger[_0x11da('0x13')](_0x11da('0xe'),_0x5e7d63,_0x5c03d7[_0x11da('0x13')][_0x11da('0x14')]);return _0x4c7757(_0x5c03d7[_0x11da('0x13')]['message']);}logger[_0x11da('0x13')](_0x11da('0xe'),_0x5e7d63,_0x5c03d7[_0x11da('0x13')][_0x11da('0x14')]);return _0x109f4b(_0x5c03d7[_0x11da('0x13')]['message']);}else{logger[_0x11da('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x5e7d63,_0x11da('0xf'));_0x109f4b(_0x5c03d7[_0x11da('0x15')][_0x11da('0x14')]);}})[_0x11da('0x16')](function(_0x9ec352){logger[_0x11da('0x13')](_0x11da('0xe'),_0x5e7d63,_0x9ec352);_0x4c7757(_0x9ec352);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9cc91f8..8b757f0 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 _0xc6cd=['../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','util','path','express','../../components/auth/service'];(function(_0x14f452,_0x4ad6aa){var _0x432ffa=function(_0x36c388){while(--_0x36c388){_0x14f452['push'](_0x14f452['shift']());}};_0x432ffa(++_0x4ad6aa);}(_0xc6cd,0xa6));var _0xdc6c=function(_0x2898b1,_0x1787e8){_0x2898b1=_0x2898b1-0x0;var _0x107cf5=_0xc6cd[_0x2898b1];return _0x107cf5;};'use strict';var multer=require('multer');var util=require(_0xdc6c('0x0'));var path=require(_0xdc6c('0x1'));var timeout=require('connect-timeout');var express=require(_0xdc6c('0x2'));var router=express['Router']();var auth=require(_0xdc6c('0x3'));var interaction=require(_0xdc6c('0x4'));var config=require(_0xdc6c('0x5'));var controller=require(_0xdc6c('0x6'));router[_0xdc6c('0x7')]('/',auth[_0xdc6c('0x8')](),controller[_0xdc6c('0x9')]);router[_0xdc6c('0x7')](_0xdc6c('0xa'),auth[_0xdc6c('0x8')](),controller['show']);router[_0xdc6c('0xb')]('/',auth[_0xdc6c('0x8')](),controller[_0xdc6c('0xc')]);router[_0xdc6c('0xd')](_0xdc6c('0xa'),auth[_0xdc6c('0x8')](),controller['update']);router[_0xdc6c('0xe')](_0xdc6c('0xa'),auth[_0xdc6c('0x8')](),controller[_0xdc6c('0xf')]);module[_0xdc6c('0x10')]=router; \ No newline at end of file +var _0xaffc=['isAuthenticated','show','post','create','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','get','/:id'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xaffc,0xf5));var _0xcaff=function(_0x54d5b2,_0x961f4f){_0x54d5b2=_0x54d5b2-0x0;var _0x42983c=_0xaffc[_0x54d5b2];return _0x42983c;};'use strict';var multer=require(_0xcaff('0x0'));var util=require(_0xcaff('0x1'));var path=require(_0xcaff('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcaff('0x3')]();var auth=require(_0xcaff('0x4'));var interaction=require(_0xcaff('0x5'));var config=require(_0xcaff('0x6'));var controller=require(_0xcaff('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcaff('0x8')]);router[_0xcaff('0x9')](_0xcaff('0xa'),auth[_0xcaff('0xb')](),controller[_0xcaff('0xc')]);router[_0xcaff('0xd')]('/',auth[_0xcaff('0xb')](),controller[_0xcaff('0xe')]);router['put'](_0xcaff('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xcaff('0xf')]('/:id',auth[_0xcaff('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 9a56006..4c9f9a7 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 _0x004a=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x43d246,_0x324b83){var _0x22a0c6=function(_0x1b0814){while(--_0x1b0814){_0x43d246['push'](_0x43d246['shift']());}};_0x22a0c6(++_0x324b83);}(_0x004a,0x1ab));var _0xa004=function(_0x409106,_0x22e9a0){_0x409106=_0x409106-0x0;var _0x62019b=_0x004a[_0x409106];return _0x62019b;};'use strict';var Sequelize=require(_0xa004('0x0'));module['exports']={'type':{'type':Sequelize[_0xa004('0x1')](_0xa004('0x2'),_0xa004('0x3'),_0xa004('0x4'),_0xa004('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa004('0x6')]},'key':{'type':Sequelize[_0xa004('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xa004('0x2'),'variable',_0xa004('0x4'))},'keyContent':{'type':Sequelize[_0xa004('0x6')]},'idField':{'type':Sequelize[_0xa004('0x6')]},'nameField':{'type':Sequelize[_0xa004('0x6')]},'customField':{'type':Sequelize[_0xa004('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa004('0x6')]}}; \ No newline at end of file +var _0xab03=['ENUM','string','variable','customVariable','STRING','BOOLEAN','exports'];(function(_0x4e1a6e,_0x36cd1f){var _0x27bc7b=function(_0x6e909c){while(--_0x6e909c){_0x4e1a6e['push'](_0x4e1a6e['shift']());}};_0x27bc7b(++_0x36cd1f);}(_0xab03,0x11e));var _0x3ab0=function(_0x2488d4,_0x59a9e6){_0x2488d4=_0x2488d4-0x0;var _0x526569=_0xab03[_0x2488d4];return _0x526569;};'use strict';var Sequelize=require('sequelize');module[_0x3ab0('0x0')]={'type':{'type':Sequelize[_0x3ab0('0x1')](_0x3ab0('0x2'),_0x3ab0('0x3'),_0x3ab0('0x4'),'keyValue'),'defaultValue':_0x3ab0('0x2')},'content':{'type':Sequelize[_0x3ab0('0x5')]},'key':{'type':Sequelize[_0x3ab0('0x5')]},'keyType':{'type':Sequelize[_0x3ab0('0x1')]('string',_0x3ab0('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3ab0('0x5')]},'idField':{'type':Sequelize[_0x3ab0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3ab0('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ab0('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index a6c063a..237db7d 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 _0x6947=['Content-Range','apply','reject','save','then','error','stack','name','send','index','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','map','merge','options','includeAll','include','findAll','rows','show','params','filtears','find','create','catch','update','body','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','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x23444a,_0x14be65){var _0x557f7d=function(_0x7b4146){while(--_0x7b4146){_0x23444a['push'](_0x23444a['shift']());}};_0x557f7d(++_0x14be65);}(_0x6947,0x72));var _0x7694=function(_0x1b4943,_0x12e4bb){_0x1b4943=_0x1b4943-0x0;var _0x39dad5=_0x6947[_0x1b4943];return _0x39dad5;};'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 licenseUtil=require('../../config/license/util');var db=require(_0x7694('0x16'))['db'];function respondWithStatusCode(_0x40abbe,_0xac1a22){_0xac1a22=_0xac1a22||0xcc;return function(_0x4c3341){if(_0x4c3341){return _0x40abbe['sendStatus'](_0xac1a22);}return _0x40abbe[_0x7694('0x17')](_0xac1a22)[_0x7694('0x18')]();};}function respondWithResult(_0x436b87,_0x574f29){_0x574f29=_0x574f29||0xc8;return function(_0x143c48){if(_0x143c48){return _0x436b87['status'](_0x574f29)[_0x7694('0x19')](_0x143c48);}};}function respondWithFilteredResult(_0x1e7706,_0x1bec84){return function(_0x306c31){if(_0x306c31){var _0x4298a2=_0x306c31[_0x7694('0x1a')],_0x550c85=_0x1bec84[_0x7694('0x1b')],_0x23432d=_0x1bec84['offset']+_0x1bec84[_0x7694('0x1c')],_0xb1edf0;if(_0x23432d>=_0x4298a2){_0x23432d=_0x4298a2;_0xb1edf0=0xc8;}else{_0xb1edf0=0xce;}_0x1e7706[_0x7694('0x17')](_0xb1edf0);return _0x1e7706[_0x7694('0x1d')](_0x7694('0x1e'),_0x550c85+'-'+_0x23432d+'/'+_0x4298a2)[_0x7694('0x19')](_0x306c31);}return null;};}function patchUpdates(_0x142ce4){return function(_0x4c3067){try{jsonpatch[_0x7694('0x1f')](_0x4c3067,_0x142ce4,!![]);}catch(_0x506613){return BPromise[_0x7694('0x20')](_0x506613);}return _0x4c3067[_0x7694('0x21')]();};}function saveUpdates(_0x271a36,_0x394e31){return function(_0x177f4b){if(_0x177f4b){return _0x177f4b['update'](_0x271a36)[_0x7694('0x22')](function(_0x105709){return _0x105709;});}return null;};}function removeEntity(_0x2d569a,_0x1654d2){return function(_0x267968){if(_0x267968){return _0x267968['destroy']()[_0x7694('0x22')](function(){_0x2d569a[_0x7694('0x17')](0xcc)[_0x7694('0x18')]();});}};}function handleEntityNotFound(_0x23a4f3,_0x4b36d9){return function(_0x21383e){if(!_0x21383e){_0x23a4f3['sendStatus'](0x194);}return _0x21383e;};}function handleError(_0x31a334,_0x50d262){_0x50d262=_0x50d262||0x1f4;return function(_0x2d77b7){logger[_0x7694('0x23')](_0x2d77b7[_0x7694('0x24')]);if(_0x2d77b7[_0x7694('0x25')]){delete _0x2d77b7[_0x7694('0x25')];}_0x31a334[_0x7694('0x17')](_0x50d262)[_0x7694('0x26')](_0x2d77b7);};}exports[_0x7694('0x27')]=function(_0x285114,_0x54cd58){var _0x3a56f1={},_0x3c09fa={},_0x2d4a79={'count':0x0,'rows':[]};var _0x3522ce=_['map'](db[_0x7694('0x28')][_0x7694('0x29')],function(_0x2facc7){return{'name':_0x2facc7['fieldName'],'type':_0x2facc7[_0x7694('0x2a')][_0x7694('0x2b')]};});_0x3c09fa[_0x7694('0x2c')]=_['map'](_0x3522ce,_0x7694('0x25'));_0x3c09fa[_0x7694('0x2d')]=_[_0x7694('0x2e')](_0x285114[_0x7694('0x2d')]);_0x3c09fa[_0x7694('0x2f')]=_[_0x7694('0x30')](_0x3c09fa[_0x7694('0x2c')],_0x3c09fa[_0x7694('0x2d')]);_0x3a56f1[_0x7694('0x31')]=_['intersection'](_0x3c09fa[_0x7694('0x2c')],qs[_0x7694('0x32')](_0x285114[_0x7694('0x2d')][_0x7694('0x32')]));_0x3a56f1['attributes']=_0x3a56f1[_0x7694('0x31')][_0x7694('0x33')]?_0x3a56f1[_0x7694('0x31')]:_0x3c09fa[_0x7694('0x2c')];if(!_0x285114[_0x7694('0x2d')][_0x7694('0x34')]('nolimit')){_0x3a56f1[_0x7694('0x1c')]=qs[_0x7694('0x1c')](_0x285114[_0x7694('0x2d')][_0x7694('0x1c')]);_0x3a56f1[_0x7694('0x1b')]=qs[_0x7694('0x1b')](_0x285114[_0x7694('0x2d')][_0x7694('0x1b')]);}_0x3a56f1[_0x7694('0x35')]=qs['sort'](_0x285114[_0x7694('0x2d')]['sort']);_0x3a56f1[_0x7694('0x36')]=qs[_0x7694('0x2f')](_[_0x7694('0x37')](_0x285114[_0x7694('0x2d')],_0x3c09fa[_0x7694('0x2f')]),_0x3522ce);if(_0x285114[_0x7694('0x2d')][_0x7694('0x38')]){_0x3a56f1[_0x7694('0x36')]=_['merge'](_0x3a56f1['where'],{'$or':_[_0x7694('0x39')](_0x3522ce,function(_0x8192ac){if(_0x8192ac[_0x7694('0x2a')]!=='VIRTUAL'){var _0x13794b={};_0x13794b[_0x8192ac[_0x7694('0x25')]]={'$like':'%'+_0x285114[_0x7694('0x2d')][_0x7694('0x38')]+'%'};return _0x13794b;}})});}_0x3a56f1=_[_0x7694('0x3a')]({},_0x3a56f1,_0x285114[_0x7694('0x3b')]);var _0x470b2b={'where':_0x3a56f1[_0x7694('0x36')]};return db[_0x7694('0x28')][_0x7694('0x1a')](_0x470b2b)[_0x7694('0x22')](function(_0x384d1b){_0x2d4a79[_0x7694('0x1a')]=_0x384d1b;if(_0x285114[_0x7694('0x2d')][_0x7694('0x3c')]){_0x3a56f1[_0x7694('0x3d')]=[{'all':!![]}];}return db[_0x7694('0x28')][_0x7694('0x3e')](_0x3a56f1);})[_0x7694('0x22')](function(_0x3a23f2){_0x2d4a79[_0x7694('0x3f')]=_0x3a23f2;return _0x2d4a79;})['then'](respondWithFilteredResult(_0x54cd58,_0x3a56f1))['catch'](handleError(_0x54cd58,null));};exports[_0x7694('0x40')]=function(_0x233395,_0x19ff01){var _0x53b655={'raw':!![],'where':{'id':_0x233395[_0x7694('0x41')]['id']}},_0x3caea7={};_0x3caea7[_0x7694('0x2c')]=_['keys'](db['DeskField'][_0x7694('0x29')]);_0x3caea7[_0x7694('0x2d')]=_[_0x7694('0x2e')](_0x233395['query']);_0x3caea7[_0x7694('0x42')]=_['intersection'](_0x3caea7[_0x7694('0x2c')],_0x3caea7[_0x7694('0x2d')]);_0x53b655[_0x7694('0x31')]=_[_0x7694('0x30')](_0x3caea7[_0x7694('0x2c')],qs[_0x7694('0x32')](_0x233395[_0x7694('0x2d')]['fields']));_0x53b655[_0x7694('0x31')]=_0x53b655[_0x7694('0x31')][_0x7694('0x33')]?_0x53b655[_0x7694('0x31')]:_0x3caea7[_0x7694('0x2c')];if(_0x233395['query'][_0x7694('0x3c')]){_0x53b655[_0x7694('0x3d')]=[{'all':!![]}];}_0x53b655=_[_0x7694('0x3a')]({},_0x53b655,_0x233395[_0x7694('0x3b')]);return db[_0x7694('0x28')][_0x7694('0x43')](_0x53b655)[_0x7694('0x22')](handleEntityNotFound(_0x19ff01,null))[_0x7694('0x22')](respondWithResult(_0x19ff01,null))['catch'](handleError(_0x19ff01,null));};exports[_0x7694('0x44')]=function(_0x288df2,_0x4b3404){return db['DeskField'][_0x7694('0x44')](_0x288df2['body'],{})[_0x7694('0x22')](respondWithResult(_0x4b3404,0xc9))[_0x7694('0x45')](handleError(_0x4b3404,null));};exports[_0x7694('0x46')]=function(_0x15c4dd,_0x1f9775){if(_0x15c4dd[_0x7694('0x47')]['id']){delete _0x15c4dd[_0x7694('0x47')]['id'];}return db[_0x7694('0x28')][_0x7694('0x43')]({'where':{'id':_0x15c4dd['params']['id']}})[_0x7694('0x22')](handleEntityNotFound(_0x1f9775,null))[_0x7694('0x22')](saveUpdates(_0x15c4dd[_0x7694('0x47')],null))['then'](respondWithResult(_0x1f9775,null))[_0x7694('0x45')](handleError(_0x1f9775,null));};exports['destroy']=function(_0x3a776b,_0x51757a){return db['DeskField'][_0x7694('0x43')]({'where':{'id':_0x3a776b[_0x7694('0x41')]['id']}})[_0x7694('0x22')](handleEntityNotFound(_0x51757a,null))[_0x7694('0x22')](removeEntity(_0x51757a,null))[_0x7694('0x45')](handleError(_0x51757a,null));}; \ No newline at end of file +var _0x1b59=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','rows','catch','show','params','filtears','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','stack','name','send','map','DeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields'];(function(_0xe85766,_0x52be8f){var _0x4756f5=function(_0x117bf4){while(--_0x117bf4){_0xe85766['push'](_0xe85766['shift']());}};_0x4756f5(++_0x52be8f);}(_0x1b59,0x1c5));var _0x91b5=function(_0x2b11c0,_0x4c1e72){_0x2b11c0=_0x2b11c0-0x0;var _0x73ae6e=_0x1b59[_0x2b11c0];return _0x73ae6e;};'use strict';var pdf=require(_0x91b5('0x0'));var emlformat=require(_0x91b5('0x1'));var rimraf=require(_0x91b5('0x2'));var zipdir=require(_0x91b5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x91b5('0x4'));var moment=require('moment');var BPromise=require(_0x91b5('0x5'));var Mustache=require('mustache');var util=require(_0x91b5('0x6'));var path=require(_0x91b5('0x7'));var sox=require(_0x91b5('0x8'));var csv=require(_0x91b5('0x9'));var ejs=require(_0x91b5('0xa'));var fs=require('fs');var _=require(_0x91b5('0xb'));var squel=require(_0x91b5('0xc'));var crypto=require(_0x91b5('0xd'));var jsforce=require(_0x91b5('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x91b5('0xf'));var Papa=require(_0x91b5('0x10'));var Redis=require(_0x91b5('0x11'));var authService=require(_0x91b5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91b5('0x13'));var logger=require(_0x91b5('0x14'))('api');var utils=require(_0x91b5('0x15'));var config=require(_0x91b5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x91b5('0x17'))['db'];function respondWithStatusCode(_0x2f09f5,_0x3e67ee){_0x3e67ee=_0x3e67ee||0xcc;return function(_0x4a0d22){if(_0x4a0d22){return _0x2f09f5[_0x91b5('0x18')](_0x3e67ee);}return _0x2f09f5[_0x91b5('0x19')](_0x3e67ee)['end']();};}function respondWithResult(_0x513fb4,_0xf7091a){_0xf7091a=_0xf7091a||0xc8;return function(_0x4a4331){if(_0x4a4331){return _0x513fb4[_0x91b5('0x19')](_0xf7091a)[_0x91b5('0x1a')](_0x4a4331);}};}function respondWithFilteredResult(_0x93810e,_0x56228c){return function(_0x203b0c){if(_0x203b0c){var _0x4e1220=_0x203b0c[_0x91b5('0x1b')],_0x1fd015=_0x56228c['offset'],_0xd0a2ca=_0x56228c[_0x91b5('0x1c')]+_0x56228c[_0x91b5('0x1d')],_0xa90954;if(_0xd0a2ca>=_0x4e1220){_0xd0a2ca=_0x4e1220;_0xa90954=0xc8;}else{_0xa90954=0xce;}_0x93810e[_0x91b5('0x19')](_0xa90954);return _0x93810e['set'](_0x91b5('0x1e'),_0x1fd015+'-'+_0xd0a2ca+'/'+_0x4e1220)[_0x91b5('0x1a')](_0x203b0c);}return null;};}function patchUpdates(_0x299e59){return function(_0x7b0245){try{jsonpatch['apply'](_0x7b0245,_0x299e59,!![]);}catch(_0x4078f7){return BPromise[_0x91b5('0x1f')](_0x4078f7);}return _0x7b0245[_0x91b5('0x20')]();};}function saveUpdates(_0x2d3536,_0x41dfdd){return function(_0x12f074){if(_0x12f074){return _0x12f074[_0x91b5('0x21')](_0x2d3536)[_0x91b5('0x22')](function(_0x18ed71){return _0x18ed71;});}return null;};}function removeEntity(_0x21db9e,_0x421d57){return function(_0x4f13b4){if(_0x4f13b4){return _0x4f13b4[_0x91b5('0x23')]()[_0x91b5('0x22')](function(){_0x21db9e[_0x91b5('0x19')](0xcc)[_0x91b5('0x24')]();});}};}function handleEntityNotFound(_0x534264,_0x195e6d){return function(_0x539200){if(!_0x539200){_0x534264[_0x91b5('0x18')](0x194);}return _0x539200;};}function handleError(_0xab6612,_0x34fa8e){_0x34fa8e=_0x34fa8e||0x1f4;return function(_0x3a34a2){logger['error'](_0x3a34a2[_0x91b5('0x25')]);if(_0x3a34a2[_0x91b5('0x26')]){delete _0x3a34a2[_0x91b5('0x26')];}_0xab6612['status'](_0x34fa8e)[_0x91b5('0x27')](_0x3a34a2);};}exports['index']=function(_0x2f805b,_0x5dff84){var _0x260432={},_0x340f57={},_0x1faef6={'count':0x0,'rows':[]};var _0x53f0f6=_[_0x91b5('0x28')](db[_0x91b5('0x29')][_0x91b5('0x2a')],function(_0x271d21){return{'name':_0x271d21[_0x91b5('0x2b')],'type':_0x271d21['type']['key']};});_0x340f57[_0x91b5('0x2c')]=_['map'](_0x53f0f6,'name');_0x340f57[_0x91b5('0x2d')]=_[_0x91b5('0x2e')](_0x2f805b['query']);_0x340f57[_0x91b5('0x2f')]=_[_0x91b5('0x30')](_0x340f57[_0x91b5('0x2c')],_0x340f57[_0x91b5('0x2d')]);_0x260432[_0x91b5('0x31')]=_[_0x91b5('0x30')](_0x340f57['model'],qs[_0x91b5('0x32')](_0x2f805b['query']['fields']));_0x260432[_0x91b5('0x31')]=_0x260432[_0x91b5('0x31')][_0x91b5('0x33')]?_0x260432[_0x91b5('0x31')]:_0x340f57['model'];if(!_0x2f805b[_0x91b5('0x2d')][_0x91b5('0x34')](_0x91b5('0x35'))){_0x260432[_0x91b5('0x1d')]=qs[_0x91b5('0x1d')](_0x2f805b[_0x91b5('0x2d')][_0x91b5('0x1d')]);_0x260432[_0x91b5('0x1c')]=qs[_0x91b5('0x1c')](_0x2f805b['query'][_0x91b5('0x1c')]);}_0x260432[_0x91b5('0x36')]=qs[_0x91b5('0x37')](_0x2f805b['query']['sort']);_0x260432[_0x91b5('0x38')]=qs[_0x91b5('0x2f')](_[_0x91b5('0x39')](_0x2f805b[_0x91b5('0x2d')],_0x340f57['filters']),_0x53f0f6);if(_0x2f805b['query'][_0x91b5('0x3a')]){_0x260432[_0x91b5('0x38')]=_['merge'](_0x260432['where'],{'$or':_[_0x91b5('0x28')](_0x53f0f6,function(_0x523220){if(_0x523220[_0x91b5('0x3b')]!==_0x91b5('0x3c')){var _0x1c523b={};_0x1c523b[_0x523220[_0x91b5('0x26')]]={'$like':'%'+_0x2f805b['query'][_0x91b5('0x3a')]+'%'};return _0x1c523b;}})});}_0x260432=_[_0x91b5('0x3d')]({},_0x260432,_0x2f805b[_0x91b5('0x3e')]);var _0x47cb20={'where':_0x260432['where']};return db['DeskField'][_0x91b5('0x1b')](_0x47cb20)['then'](function(_0x558f45){_0x1faef6[_0x91b5('0x1b')]=_0x558f45;if(_0x2f805b[_0x91b5('0x2d')]['includeAll']){_0x260432[_0x91b5('0x3f')]=[{'all':!![]}];}return db[_0x91b5('0x29')]['findAll'](_0x260432);})[_0x91b5('0x22')](function(_0x3f2581){_0x1faef6[_0x91b5('0x40')]=_0x3f2581;return _0x1faef6;})['then'](respondWithFilteredResult(_0x5dff84,_0x260432))[_0x91b5('0x41')](handleError(_0x5dff84,null));};exports[_0x91b5('0x42')]=function(_0x31e746,_0x43d6f7){var _0x4b9331={'raw':!![],'where':{'id':_0x31e746[_0x91b5('0x43')]['id']}},_0x54ea79={};_0x54ea79[_0x91b5('0x2c')]=_[_0x91b5('0x2e')](db[_0x91b5('0x29')][_0x91b5('0x2a')]);_0x54ea79[_0x91b5('0x2d')]=_['keys'](_0x31e746[_0x91b5('0x2d')]);_0x54ea79[_0x91b5('0x44')]=_[_0x91b5('0x30')](_0x54ea79[_0x91b5('0x2c')],_0x54ea79[_0x91b5('0x2d')]);_0x4b9331[_0x91b5('0x31')]=_[_0x91b5('0x30')](_0x54ea79['model'],qs['fields'](_0x31e746[_0x91b5('0x2d')][_0x91b5('0x32')]));_0x4b9331[_0x91b5('0x31')]=_0x4b9331[_0x91b5('0x31')]['length']?_0x4b9331[_0x91b5('0x31')]:_0x54ea79[_0x91b5('0x2c')];if(_0x31e746[_0x91b5('0x2d')]['includeAll']){_0x4b9331[_0x91b5('0x3f')]=[{'all':!![]}];}_0x4b9331=_[_0x91b5('0x3d')]({},_0x4b9331,_0x31e746['options']);return db[_0x91b5('0x29')]['find'](_0x4b9331)[_0x91b5('0x22')](handleEntityNotFound(_0x43d6f7,null))[_0x91b5('0x22')](respondWithResult(_0x43d6f7,null))[_0x91b5('0x41')](handleError(_0x43d6f7,null));};exports[_0x91b5('0x45')]=function(_0x402bbe,_0x39fe88){return db['DeskField'][_0x91b5('0x45')](_0x402bbe[_0x91b5('0x46')],{})['then'](respondWithResult(_0x39fe88,0xc9))[_0x91b5('0x41')](handleError(_0x39fe88,null));};exports['update']=function(_0x32ffdf,_0x54b9cc){if(_0x32ffdf['body']['id']){delete _0x32ffdf[_0x91b5('0x46')]['id'];}return db['DeskField'][_0x91b5('0x47')]({'where':{'id':_0x32ffdf['params']['id']}})['then'](handleEntityNotFound(_0x54b9cc,null))['then'](saveUpdates(_0x32ffdf['body'],null))['then'](respondWithResult(_0x54b9cc,null))['catch'](handleError(_0x54b9cc,null));};exports[_0x91b5('0x23')]=function(_0x30c8cd,_0xccd4d5){return db['DeskField']['find']({'where':{'id':_0x30c8cd[_0x91b5('0x43')]['id']}})[_0x91b5('0x22')](handleEntityNotFound(_0xccd4d5,null))[_0x91b5('0x22')](removeEntity(_0xccd4d5,null))['catch'](handleError(_0xccd4d5,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 10d58e0..ef9c4ca 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 _0x122a=['api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x222ecc,_0x16652b){var _0x2810e4=function(_0x2a35d1){while(--_0x2a35d1){_0x222ecc['push'](_0x222ecc['shift']());}};_0x2810e4(++_0x16652b);}(_0x122a,0x67));var _0xa122=function(_0x38016f,_0x276699){_0x38016f=_0x38016f-0x0;var _0x5bd2c7=_0x122a[_0x38016f];return _0x5bd2c7;};'use strict';var _=require(_0xa122('0x0'));var util=require('util');var logger=require(_0xa122('0x1'))(_0xa122('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa122('0x3'));var fs=require('fs');var path=require(_0xa122('0x4'));var rimraf=require(_0xa122('0x5'));var config=require(_0xa122('0x6'));var attributes=require(_0xa122('0x7'));module[_0xa122('0x8')]=function(_0x3a4df6,_0x13fd88){return _0x3a4df6[_0xa122('0x9')](_0xa122('0xa'),attributes,{'tableName':_0xa122('0xb'),'paranoid':![],'indexes':[{'name':_0xa122('0xc'),'fields':[_0xa122('0xd'),_0xa122('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb462=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x21e325,_0x2cfaab){var _0x19dee3=function(_0x261558){while(--_0x261558){_0x21e325['push'](_0x21e325['shift']());}};_0x19dee3(++_0x2cfaab);}(_0xb462,0x19d));var _0x2b46=function(_0x3b50d1,_0x4b7fe2){_0x3b50d1=_0x3b50d1-0x0;var _0x362499=_0xb462[_0x3b50d1];return _0x362499;};'use strict';var _=require(_0x2b46('0x0'));var util=require(_0x2b46('0x1'));var logger=require(_0x2b46('0x2'))(_0x2b46('0x3'));var moment=require(_0x2b46('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b46('0x5'));var fs=require('fs');var path=require(_0x2b46('0x6'));var rimraf=require(_0x2b46('0x7'));var config=require(_0x2b46('0x8'));var attributes=require(_0x2b46('0x9'));module[_0x2b46('0xa')]=function(_0x509479,_0x9f4bef){return _0x509479[_0x2b46('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x2b46('0xc'),'fields':[_0x2b46('0xd'),'FieldId'],'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 13ebe76..836f295 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 _0x33e4=['jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x149d0c,_0x1f544f){var _0x7b9e11=function(_0x525f5f){while(--_0x525f5f){_0x149d0c['push'](_0x149d0c['shift']());}};_0x7b9e11(++_0x1f544f);}(_0x33e4,0xc9));var _0x433e=function(_0x4d1ce7,_0x5292d2){_0x4d1ce7=_0x4d1ce7-0x0;var _0x3d76cb=_0x33e4[_0x4d1ce7];return _0x3d76cb;};'use strict';var _=require(_0x433e('0x0'));var util=require(_0x433e('0x1'));var moment=require(_0x433e('0x2'));var BPromise=require(_0x433e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x433e('0x4'));var db=require(_0x433e('0x5'))['db'];var utils=require(_0x433e('0x6'));var logger=require(_0x433e('0x7'))('rpc');var config=require(_0x433e('0x8'));var jayson=require(_0x433e('0x9'));var client=jayson['client'][_0x433e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28723e,_0x114a40,_0x526591){return new BPromise(function(_0x59ed32,_0x4acf00){return client[_0x433e('0xb')](_0x28723e,_0x526591)[_0x433e('0xc')](function(_0x8c8f21){logger[_0x433e('0xd')](_0x433e('0xe'),_0x114a40,_0x433e('0xf'));logger['debug'](_0x433e('0x10'),_0x114a40,_0x433e('0xf'),JSON['stringify'](_0x8c8f21));if(_0x8c8f21[_0x433e('0x11')]){if(_0x8c8f21[_0x433e('0x11')][_0x433e('0x12')]===0x1f4){logger[_0x433e('0x11')](_0x433e('0xe'),_0x114a40,_0x8c8f21['error']['message']);return _0x4acf00(_0x8c8f21['error'][_0x433e('0x13')]);}logger[_0x433e('0x11')](_0x433e('0xe'),_0x114a40,_0x8c8f21[_0x433e('0x11')]['message']);return _0x59ed32(_0x8c8f21[_0x433e('0x11')][_0x433e('0x13')]);}else{logger[_0x433e('0xd')](_0x433e('0xe'),_0x114a40,_0x433e('0xf'));_0x59ed32(_0x8c8f21['result'][_0x433e('0x13')]);}})[_0x433e('0x14')](function(_0xddf752){logger[_0x433e('0x11')](_0x433e('0xe'),_0x114a40,_0xddf752);_0x4acf00(_0xddf752);});});} \ No newline at end of file +var _0x77bf=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x77bf,0x193));var _0xf77b=function(_0x5f370a,_0x530e2f){_0x5f370a=_0x5f370a-0x0;var _0x285e5c=_0x77bf[_0x5f370a];return _0x285e5c;};'use strict';var _=require('lodash');var util=require(_0xf77b('0x0'));var moment=require('moment');var BPromise=require(_0xf77b('0x1'));var rs=require(_0xf77b('0x2'));var fs=require('fs');var Redis=require(_0xf77b('0x3'));var db=require(_0xf77b('0x4'))['db'];var utils=require(_0xf77b('0x5'));var logger=require(_0xf77b('0x6'))(_0xf77b('0x7'));var config=require(_0xf77b('0x8'));var jayson=require(_0xf77b('0x9'));var client=jayson[_0xf77b('0xa')][_0xf77b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e676c,_0xbee6c0,_0x4341e1){return new BPromise(function(_0x6321a8,_0x49e4f7){return client[_0xf77b('0xc')](_0x5e676c,_0x4341e1)['then'](function(_0x12e7b1){logger[_0xf77b('0xd')](_0xf77b('0xe'),_0xbee6c0,_0xf77b('0xf'));logger[_0xf77b('0x10')](_0xf77b('0x11'),_0xbee6c0,_0xf77b('0xf'),JSON[_0xf77b('0x12')](_0x12e7b1));if(_0x12e7b1[_0xf77b('0x13')]){if(_0x12e7b1[_0xf77b('0x13')][_0xf77b('0x14')]===0x1f4){logger[_0xf77b('0x13')](_0xf77b('0xe'),_0xbee6c0,_0x12e7b1[_0xf77b('0x13')][_0xf77b('0x15')]);return _0x49e4f7(_0x12e7b1[_0xf77b('0x13')][_0xf77b('0x15')]);}logger[_0xf77b('0x13')](_0xf77b('0xe'),_0xbee6c0,_0x12e7b1[_0xf77b('0x13')][_0xf77b('0x15')]);return _0x6321a8(_0x12e7b1['error']['message']);}else{logger[_0xf77b('0xd')]('DeskField,\x20%s,\x20%s',_0xbee6c0,'request\x20sent');_0x6321a8(_0x12e7b1[_0xf77b('0x16')][_0xf77b('0x15')]);}})[_0xf77b('0x17')](function(_0x530b3a){logger[_0xf77b('0x13')](_0xf77b('0xe'),_0xbee6c0,_0x530b3a);_0x49e4f7(_0x530b3a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index cb8754e..ea8ff80 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 _0xe866=['addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe866,0x1bd));var _0x6e86=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe866[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6e86('0x0'));var util=require(_0x6e86('0x1'));var path=require(_0x6e86('0x2'));var timeout=require(_0x6e86('0x3'));var express=require(_0x6e86('0x4'));var router=express[_0x6e86('0x5')]();var auth=require(_0x6e86('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6e86('0x7'));router[_0x6e86('0x8')]('/',auth[_0x6e86('0x9')](),controller['index']);router[_0x6e86('0x8')](_0x6e86('0xa'),auth[_0x6e86('0x9')](),controller[_0x6e86('0xb')]);router['get'](_0x6e86('0xc'),auth[_0x6e86('0x9')](),controller[_0x6e86('0xd')]);router[_0x6e86('0x8')](_0x6e86('0xe'),auth[_0x6e86('0x9')](),controller['getFields']);router[_0x6e86('0xf')]('/',auth['isAuthenticated'](),controller[_0x6e86('0x10')]);router['post']('/:id/configurations',auth[_0x6e86('0x9')](),controller[_0x6e86('0x11')]);router[_0x6e86('0x12')](_0x6e86('0xa'),auth[_0x6e86('0x9')](),controller[_0x6e86('0x13')]);router[_0x6e86('0x14')]('/:id',auth[_0x6e86('0x9')](),controller[_0x6e86('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9602=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index'];(function(_0xbebf50,_0x44ec09){var _0xce1496=function(_0x1bf94d){while(--_0x1bf94d){_0xbebf50['push'](_0xbebf50['shift']());}};_0xce1496(++_0x44ec09);}(_0x9602,0x113));var _0x2960=function(_0x59a6ad,_0x13cdee){_0x59a6ad=_0x59a6ad-0x0;var _0x5d3368=_0x9602[_0x59a6ad];return _0x5d3368;};'use strict';var multer=require(_0x2960('0x0'));var util=require(_0x2960('0x1'));var path=require('path');var timeout=require(_0x2960('0x2'));var express=require('express');var router=express[_0x2960('0x3')]();var auth=require(_0x2960('0x4'));var interaction=require(_0x2960('0x5'));var config=require(_0x2960('0x6'));var controller=require(_0x2960('0x7'));router[_0x2960('0x8')]('/',auth[_0x2960('0x9')](),controller[_0x2960('0xa')]);router[_0x2960('0x8')](_0x2960('0xb'),auth[_0x2960('0x9')](),controller[_0x2960('0xc')]);router['get'](_0x2960('0xd'),auth[_0x2960('0x9')](),controller[_0x2960('0xe')]);router[_0x2960('0x8')](_0x2960('0xf'),auth[_0x2960('0x9')](),controller[_0x2960('0x10')]);router[_0x2960('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2960('0xd'),auth['isAuthenticated'](),controller[_0x2960('0x12')]);router['put']('/:id',auth[_0x2960('0x9')](),controller['update']);router[_0x2960('0x13')]('/:id',auth[_0x2960('0x9')](),controller[_0x2960('0x14')]);module[_0x2960('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index dd20a59..9696fb5 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 _0x8402=['exports','STRING','sequelize'];(function(_0x26bb1a,_0x5da6ca){var _0x15bc57=function(_0x29e4e7){while(--_0x29e4e7){_0x26bb1a['push'](_0x26bb1a['shift']());}};_0x15bc57(++_0x5da6ca);}(_0x8402,0xb9));var _0x2840=function(_0x12eb25,_0x354b2a){_0x12eb25=_0x12eb25-0x0;var _0x21c6d3=_0x8402[_0x12eb25];return _0x21c6d3;};'use strict';var Sequelize=require(_0x2840('0x0'));module[_0x2840('0x1')]={'name':{'type':Sequelize[_0x2840('0x2')]},'username':{'type':Sequelize[_0x2840('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2840('0x2')]},'tenantId':{'type':Sequelize[_0x2840('0x2')]},'clientId':{'type':Sequelize[_0x2840('0x2')]},'clientSecret':{'type':Sequelize[_0x2840('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2840('0x2')]}}; \ No newline at end of file +var _0x63e1=['STRING','exports'];(function(_0x594867,_0x2ee5d3){var _0x9ac5b1=function(_0x4609ec){while(--_0x4609ec){_0x594867['push'](_0x594867['shift']());}};_0x9ac5b1(++_0x2ee5d3);}(_0x63e1,0x137));var _0x163e=function(_0x2482e8,_0x35b774){_0x2482e8=_0x2482e8-0x0;var _0x267449=_0x63e1[_0x2482e8];return _0x267449;};'use strict';var Sequelize=require('sequelize');module[_0x163e('0x0')]={'name':{'type':Sequelize[_0x163e('0x1')]},'username':{'type':Sequelize[_0x163e('0x1')]},'password':{'type':Sequelize[_0x163e('0x1')]},'remoteUri':{'type':Sequelize[_0x163e('0x1')]},'tenantId':{'type':Sequelize[_0x163e('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x163e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index bf68ead..56e91dc 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 _0x812a=['description','customerid','ownerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','password','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','username','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','send','test','Wrong\x20credentials','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','DisplayName','UserLocalizedLabel','GET',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','end','status','json','count','offset','set','apply','reject','save','update','then','sendStatus','stack','name','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','rows','show','params','filtears','include','Dynamics365Account','find','create','body','destroy','findOne','Dynamics365Configuration','getConfigurations','AccountId','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Field','Subjects','ticketType','incident','Incident','PhoneCall','title'];(function(_0x47c1f4,_0x4847a5){var _0x3e17b3=function(_0x437145){while(--_0x437145){_0x47c1f4['push'](_0x47c1f4['shift']());}};_0x3e17b3(++_0x4847a5);}(_0x812a,0x75));var _0xa812=function(_0x1e4b62,_0x459617){_0x1e4b62=_0x1e4b62-0x0;var _0x166554=_0x812a[_0x1e4b62];return _0x166554;};'use strict';var pdf=require(_0xa812('0x0'));var emlformat=require(_0xa812('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa812('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa812('0x3'));var BPromise=require(_0xa812('0x4'));var Mustache=require(_0xa812('0x5'));var util=require(_0xa812('0x6'));var path=require(_0xa812('0x7'));var sox=require(_0xa812('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa812('0x9'));var squel=require(_0xa812('0xa'));var crypto=require(_0xa812('0xb'));var jsforce=require(_0xa812('0xc'));var deskjs=require(_0xa812('0xd'));var toCsv=require(_0xa812('0xe'));var querystring=require(_0xa812('0xf'));var Papa=require(_0xa812('0x10'));var Redis=require(_0xa812('0x11'));var authService=require(_0xa812('0x12'));var qs=require(_0xa812('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa812('0x14'))('api');var utils=require(_0xa812('0x15'));var config=require(_0xa812('0x16'));var licenseUtil=require(_0xa812('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa812('0x18'));var client=jayson[_0xa812('0x19')][_0xa812('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x424282,_0x1e366e,_0xd2ce39,_0x42a41a){return new BPromise(function(_0x191707,_0x32f8db){var _0x14f45d=_0x42a41a||client;return _0x14f45d[_0xa812('0x1b')](_0x424282,_0xd2ce39)['then'](function(_0xac090b){logger[_0xa812('0x1c')](_0xa812('0x1d'),_0x1e366e,_0xa812('0x1e'));logger[_0xa812('0x1f')](_0xa812('0x20'),_0x1e366e,_0xa812('0x1e'),JSON[_0xa812('0x21')](_0xac090b));if(_0xac090b[_0xa812('0x22')]){if(_0xac090b[_0xa812('0x22')]['code']===0x1f4){logger[_0xa812('0x22')](_0xa812('0x1d'),_0x1e366e,_0xac090b[_0xa812('0x22')][_0xa812('0x23')]);return _0x32f8db(_0xac090b[_0xa812('0x22')]['message']);}logger[_0xa812('0x22')](_0xa812('0x1d'),_0x1e366e,_0xac090b[_0xa812('0x22')]['message']);return _0x191707(_0xac090b['error'][_0xa812('0x23')]);}else{logger[_0xa812('0x1c')](_0xa812('0x1d'),_0x1e366e,_0xa812('0x1e'));_0x191707(_0xac090b['result']['message']);}})[_0xa812('0x24')](function(_0x1dc901){logger[_0xa812('0x22')](_0xa812('0x1d'),_0x1e366e,_0x1dc901);_0x32f8db(_0x1dc901);});});}function respondWithStatusCode(_0x5c43fc,_0x4a2adb){_0x4a2adb=_0x4a2adb||0xcc;return function(_0x3d4790){if(_0x3d4790){return _0x5c43fc['sendStatus'](_0x4a2adb);}return _0x5c43fc['status'](_0x4a2adb)[_0xa812('0x25')]();};}function respondWithResult(_0x3b9b6c,_0x4314c2){_0x4314c2=_0x4314c2||0xc8;return function(_0xcd341d){if(_0xcd341d){return _0x3b9b6c[_0xa812('0x26')](_0x4314c2)[_0xa812('0x27')](_0xcd341d);}};}function respondWithFilteredResult(_0x44d8d9,_0x2d537b){return function(_0x50555f){if(_0x50555f){var _0x202abc=_0x50555f[_0xa812('0x28')],_0x2f9a9d=_0x2d537b[_0xa812('0x29')],_0x5e12d1=_0x2d537b[_0xa812('0x29')]+_0x2d537b['limit'],_0x2facb1;if(_0x5e12d1>=_0x202abc){_0x5e12d1=_0x202abc;_0x2facb1=0xc8;}else{_0x2facb1=0xce;}_0x44d8d9[_0xa812('0x26')](_0x2facb1);return _0x44d8d9[_0xa812('0x2a')]('Content-Range',_0x2f9a9d+'-'+_0x5e12d1+'/'+_0x202abc)[_0xa812('0x27')](_0x50555f);}return null;};}function patchUpdates(_0x400307){return function(_0x1b9e68){try{jsonpatch[_0xa812('0x2b')](_0x1b9e68,_0x400307,!![]);}catch(_0x507de9){return BPromise[_0xa812('0x2c')](_0x507de9);}return _0x1b9e68[_0xa812('0x2d')]();};}function saveUpdates(_0x37486a,_0x1429bc){return function(_0x3eb8b2){if(_0x3eb8b2){return _0x3eb8b2[_0xa812('0x2e')](_0x37486a)['then'](function(_0x41b040){return _0x41b040;});}return null;};}function removeEntity(_0x2c6cf9,_0x1ca0ed){return function(_0x3ae7fa){if(_0x3ae7fa){return _0x3ae7fa['destroy']()[_0xa812('0x2f')](function(){_0x2c6cf9['status'](0xcc)[_0xa812('0x25')]();});}};}function handleEntityNotFound(_0x345bc0,_0x5c74ee){return function(_0x54dcf5){if(!_0x54dcf5){_0x345bc0[_0xa812('0x30')](0x194);}return _0x54dcf5;};}function handleError(_0x12ef56,_0x5c47e5){_0x5c47e5=_0x5c47e5||0x1f4;return function(_0x465f5b){logger[_0xa812('0x22')](_0x465f5b[_0xa812('0x31')]);if(_0x465f5b[_0xa812('0x32')]){delete _0x465f5b['name'];}_0x12ef56[_0xa812('0x26')](_0x5c47e5)['send'](_0x465f5b);};}exports['index']=function(_0x503ce6,_0x3ab684){var _0x119b1c={},_0x5b6a92={},_0x2ca8df={'count':0x0,'rows':[]};var _0x342b16=_[_0xa812('0x33')](db['Dynamics365Account'][_0xa812('0x34')],function(_0x4810c2){return{'name':_0x4810c2[_0xa812('0x35')],'type':_0x4810c2['type']['key']};});_0x5b6a92['model']=_[_0xa812('0x33')](_0x342b16,_0xa812('0x32'));_0x5b6a92[_0xa812('0x36')]=_[_0xa812('0x37')](_0x503ce6[_0xa812('0x36')]);_0x5b6a92[_0xa812('0x38')]=_[_0xa812('0x39')](_0x5b6a92[_0xa812('0x3a')],_0x5b6a92['query']);_0x119b1c[_0xa812('0x3b')]=_['intersection'](_0x5b6a92[_0xa812('0x3a')],qs[_0xa812('0x3c')](_0x503ce6[_0xa812('0x36')][_0xa812('0x3c')]));_0x119b1c[_0xa812('0x3b')]=_0x119b1c[_0xa812('0x3b')][_0xa812('0x3d')]?_0x119b1c[_0xa812('0x3b')]:_0x5b6a92['model'];if(!_0x503ce6[_0xa812('0x36')][_0xa812('0x3e')](_0xa812('0x3f'))){_0x119b1c['limit']=qs[_0xa812('0x40')](_0x503ce6['query'][_0xa812('0x40')]);_0x119b1c['offset']=qs['offset'](_0x503ce6[_0xa812('0x36')][_0xa812('0x29')]);}_0x119b1c[_0xa812('0x41')]=qs[_0xa812('0x42')](_0x503ce6[_0xa812('0x36')][_0xa812('0x42')]);_0x119b1c['where']=qs[_0xa812('0x38')](_[_0xa812('0x43')](_0x503ce6[_0xa812('0x36')],_0x5b6a92[_0xa812('0x38')]),_0x342b16);if(_0x503ce6[_0xa812('0x36')][_0xa812('0x44')]){_0x119b1c['where']=_[_0xa812('0x45')](_0x119b1c[_0xa812('0x46')],{'$or':_[_0xa812('0x33')](_0x342b16,function(_0x1786f2){if(_0x1786f2[_0xa812('0x47')]!==_0xa812('0x48')){var _0x5e940e={};_0x5e940e[_0x1786f2[_0xa812('0x32')]]={'$like':'%'+_0x503ce6[_0xa812('0x36')][_0xa812('0x44')]+'%'};return _0x5e940e;}})});}_0x119b1c=_[_0xa812('0x45')]({},_0x119b1c,_0x503ce6[_0xa812('0x49')]);var _0x228dcf={'where':_0x119b1c[_0xa812('0x46')]};return db['Dynamics365Account'][_0xa812('0x28')](_0x228dcf)[_0xa812('0x2f')](function(_0x4dbf04){_0x2ca8df[_0xa812('0x28')]=_0x4dbf04;if(_0x503ce6['query'][_0xa812('0x4a')]){_0x119b1c['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x119b1c);})['then'](function(_0x3c0656){_0x2ca8df[_0xa812('0x4b')]=_0x3c0656;return _0x2ca8df;})['then'](respondWithFilteredResult(_0x3ab684,_0x119b1c))[_0xa812('0x24')](handleError(_0x3ab684,null));};exports[_0xa812('0x4c')]=function(_0x22c396,_0x925ddd){var _0x5f1202={'raw':![],'where':{'id':_0x22c396[_0xa812('0x4d')]['id']}},_0x9d2c4f={};_0x9d2c4f[_0xa812('0x3a')]=_[_0xa812('0x37')](db['Dynamics365Account'][_0xa812('0x34')]);_0x9d2c4f[_0xa812('0x36')]=_[_0xa812('0x37')](_0x22c396[_0xa812('0x36')]);_0x9d2c4f[_0xa812('0x4e')]=_[_0xa812('0x39')](_0x9d2c4f[_0xa812('0x3a')],_0x9d2c4f[_0xa812('0x36')]);_0x5f1202[_0xa812('0x3b')]=_[_0xa812('0x39')](_0x9d2c4f[_0xa812('0x3a')],qs[_0xa812('0x3c')](_0x22c396[_0xa812('0x36')][_0xa812('0x3c')]));_0x5f1202[_0xa812('0x3b')]=_0x5f1202[_0xa812('0x3b')]['length']?_0x5f1202[_0xa812('0x3b')]:_0x9d2c4f[_0xa812('0x3a')];if(_0x22c396[_0xa812('0x36')][_0xa812('0x4a')]){_0x5f1202[_0xa812('0x4f')]=[{'all':!![]}];}_0x5f1202=_[_0xa812('0x45')]({},_0x5f1202,_0x22c396[_0xa812('0x49')]);return db[_0xa812('0x50')][_0xa812('0x51')](_0x5f1202)[_0xa812('0x2f')](handleEntityNotFound(_0x925ddd,null))['then'](respondWithResult(_0x925ddd,null))['catch'](handleError(_0x925ddd,null));};exports['create']=function(_0xf187a5,_0x4310ad){return db['Dynamics365Account'][_0xa812('0x52')](_0xf187a5[_0xa812('0x53')],{})['then'](respondWithResult(_0x4310ad,0xc9))['catch'](handleError(_0x4310ad,null));};exports[_0xa812('0x2e')]=function(_0x7b2b43,_0x4c3887){if(_0x7b2b43[_0xa812('0x53')]['id']){delete _0x7b2b43[_0xa812('0x53')]['id'];}return db[_0xa812('0x50')][_0xa812('0x51')]({'where':{'id':_0x7b2b43['params']['id']}})[_0xa812('0x2f')](handleEntityNotFound(_0x4c3887,null))[_0xa812('0x2f')](saveUpdates(_0x7b2b43[_0xa812('0x53')],null))['then'](respondWithResult(_0x4c3887,null))[_0xa812('0x24')](handleError(_0x4c3887,null));};exports[_0xa812('0x54')]=function(_0xf33581,_0x3757ae){return db[_0xa812('0x50')][_0xa812('0x51')]({'where':{'id':_0xf33581[_0xa812('0x4d')]['id']}})[_0xa812('0x2f')](handleEntityNotFound(_0x3757ae,null))['then'](removeEntity(_0x3757ae,null))['catch'](handleError(_0x3757ae,null));};exports['getConfigurations']=function(_0x3ec8bb,_0x372133,_0x4efb4a){var _0x351442={};var _0x275448={};var _0x199108;var _0x1cfb9e;return db[_0xa812('0x50')][_0xa812('0x55')]({'where':{'id':_0x3ec8bb['params']['id']}})[_0xa812('0x2f')](handleEntityNotFound(_0x372133,null))[_0xa812('0x2f')](function(_0x34229a){if(_0x34229a){_0x199108=_0x34229a;_0x275448[_0xa812('0x3a')]=_['keys'](db[_0xa812('0x56')]['rawAttributes']);_0x275448[_0xa812('0x36')]=_[_0xa812('0x37')](_0x3ec8bb['query']);_0x275448[_0xa812('0x38')]=_['intersection'](_0x275448[_0xa812('0x3a')],_0x275448[_0xa812('0x36')]);_0x351442[_0xa812('0x3b')]=_[_0xa812('0x39')](_0x275448[_0xa812('0x3a')],qs[_0xa812('0x3c')](_0x3ec8bb[_0xa812('0x36')][_0xa812('0x3c')]));_0x351442[_0xa812('0x3b')]=_0x351442[_0xa812('0x3b')][_0xa812('0x3d')]?_0x351442[_0xa812('0x3b')]:_0x275448[_0xa812('0x3a')];_0x351442[_0xa812('0x41')]=qs[_0xa812('0x42')](_0x3ec8bb[_0xa812('0x36')][_0xa812('0x42')]);_0x351442['where']=qs['filters'](_['pick'](_0x3ec8bb[_0xa812('0x36')],_0x275448[_0xa812('0x38')]));if(_0x3ec8bb['query'][_0xa812('0x44')]){_0x351442[_0xa812('0x46')]=_[_0xa812('0x45')](_0x351442[_0xa812('0x46')],{'$or':_['map'](_0x351442[_0xa812('0x3b')],function(_0x5c66d9){var _0x107754={};_0x107754[_0x5c66d9]={'$like':'%'+_0x3ec8bb['query'][_0xa812('0x44')]+'%'};return _0x107754;})});}_0x351442=_[_0xa812('0x45')]({},_0x351442,_0x3ec8bb[_0xa812('0x49')]);return _0x199108[_0xa812('0x57')](_0x351442);}})['then'](function(_0x11d4f5){if(_0x11d4f5){_0x1cfb9e=_0x11d4f5[_0xa812('0x3d')];if(!_0x3ec8bb['query']['hasOwnProperty'](_0xa812('0x3f'))){_0x351442['limit']=qs[_0xa812('0x40')](_0x3ec8bb[_0xa812('0x36')]['limit']);_0x351442[_0xa812('0x29')]=qs[_0xa812('0x29')](_0x3ec8bb[_0xa812('0x36')]['offset']);}return _0x199108[_0xa812('0x57')](_0x351442);}})[_0xa812('0x2f')](function(_0x1b6383){if(_0x1b6383){return _0x1b6383?{'count':_0x1cfb9e,'rows':_0x1b6383}:null;}})['then'](respondWithResult(_0x372133,null))[_0xa812('0x24')](handleError(_0x372133,null));};exports['addConfiguration']=function(_0x3aeb5a,_0x36bd2a,_0x454609){if(_0x3aeb5a[_0xa812('0x53')]['id']){delete _0x3aeb5a['body']['id'];}return db[_0xa812('0x50')][_0xa812('0x55')]({'where':{'id':_0x3aeb5a['params']['id']}})['then'](handleEntityNotFound(_0x36bd2a,null))[_0xa812('0x2f')](function(_0x36f6a7){if(_0x36f6a7){_0x3aeb5a[_0xa812('0x53')][_0xa812('0x58')]=_0x36f6a7['id'];_0x3aeb5a[_0xa812('0x53')]['Subjects']=integrations[_0xa812('0x59')](_0x3aeb5a['body']['channel'],_0x3aeb5a['body'][_0xa812('0x47')]);_0x3aeb5a[_0xa812('0x53')][_0xa812('0x5a')]=integrations[_0xa812('0x5b')](_0x3aeb5a[_0xa812('0x53')][_0xa812('0x5c')],_0x3aeb5a['body'][_0xa812('0x47')]);return db[_0xa812('0x56')][_0xa812('0x52')](_0x3aeb5a[_0xa812('0x53')],{'include':[{'model':db[_0xa812('0x5d')],'as':_0xa812('0x5e')},{'model':db[_0xa812('0x5d')],'as':_0xa812('0x5a')}]});}return null;})[_0xa812('0x2f')](respondWithResult(_0x36bd2a,null))[_0xa812('0x24')](handleError(_0x36bd2a,null));};exports['getFields']=function(_0x17639c,_0x4568c0,_0x6f7f64){var _0x521f30=_0x17639c[_0xa812('0x36')][_0xa812('0x5f')];var _0x20b8c3=_0x521f30===_0xa812('0x60')?_0xa812('0x61'):_0xa812('0x62');var _0x16a2a3='';var _0x4d33bd='';var _0x2dabee='';var _0x340177='';var _0x3d1b4e='';var _0x27a556='';var _0x333e84='';var _0x40d0c3='';var _0x2dcf53=[_0xa812('0x63'),_0xa812('0x64'),_0xa812('0x65'),_0xa812('0x66'),'caseorigincode','subject',_0xa812('0x67'),_0xa812('0x68'),_0xa812('0x69'),_0xa812('0x6a')];var _0x2fbee6=['accountidname',_0xa812('0x6b'),'actualserviceunits','billedserviceunits',_0xa812('0x6c'),_0xa812('0x6d'),_0xa812('0x6e'),_0xa812('0x6f'),_0xa812('0x70'),_0xa812('0x71'),_0xa812('0x72'),_0xa812('0x73'),'createdon',_0xa812('0x74'),_0xa812('0x75'),_0xa812('0x76'),_0xa812('0x77'),_0xa812('0x78'),_0xa812('0x79'),_0xa812('0x7a'),'entityimage_timestamp',_0xa812('0x7b'),_0xa812('0x7c'),_0xa812('0x7d'),_0xa812('0x7e'),_0xa812('0x7f'),'importsequencenumber',_0xa812('0x80'),_0xa812('0x81'),_0xa812('0x82'),_0xa812('0x83'),_0xa812('0x84'),_0xa812('0x85'),_0xa812('0x86'),'modifiedbyyominame',_0xa812('0x87'),'modifiedonbehalfbyname',_0xa812('0x88'),_0xa812('0x89'),'msdyn_iotalertname','numberofchildincidents',_0xa812('0x8a'),'overriddencreatedon',_0xa812('0x8b'),_0xa812('0x8c'),'owneridyominame',_0xa812('0x8d'),'primarycontactidname',_0xa812('0x8e'),_0xa812('0x8f'),_0xa812('0x90'),_0xa812('0x91'),_0xa812('0x92'),'resolvebykpiidname','responseby',_0xa812('0x93'),_0xa812('0x94'),_0xa812('0x95'),_0xa812('0x96'),_0xa812('0x97'),_0xa812('0x98'),_0xa812('0x99'),_0xa812('0x9a'),_0xa812('0x9b'),_0xa812('0x9c'),_0xa812('0x9d'),'transactioncurrencyidname',_0xa812('0x9e'),_0xa812('0x9f'),'versionnumber'];var _0x288737=_0x2dcf53['concat'](_0x2fbee6);return db[_0xa812('0x50')]['findOne']({'where':{'id':_0x17639c[_0xa812('0x4d')]['id']},'attributes':['id','username',_0xa812('0xa0'),'remoteUri',_0xa812('0xa1'),_0xa812('0xa2'),_0xa812('0xa3')]})[_0xa812('0x2f')](handleEntityNotFound(_0x4568c0,null))['then'](function(_0x2955b4){if(_0x2955b4){_0x40d0c3=_0x2955b4['remoteUri'];var _0x22e663=_0x40d0c3[_0xa812('0xa4')](-0x1);if(_0x22e663==='/'){_0x40d0c3=_0x40d0c3[_0xa812('0xa5')](0x0,_0x40d0c3[_0xa812('0xa6')](_0x22e663));}_0x333e84=util[_0xa812('0xa7')](_0xa812('0xa8'),_0x40d0c3);var _0x1ef71e={'method':'POST','uri':_0xa812('0xa9')+_0x2955b4[_0xa812('0xa1')]+_0xa812('0xaa'),'form':{'client_id':_0x2955b4[_0xa812('0xa2')],'resource':_0x40d0c3,'username':_0x2955b4[_0xa812('0xab')],'password':_0x2955b4['password'],'grant_type':_0xa812('0xa0'),'client_secret':_0x2955b4[_0xa812('0xa3')]},'json':!![]};return rp(_0x1ef71e);}})[_0xa812('0x2f')](function(_0xf11491){_0x27a556=_0xf11491[_0xa812('0xac')];var _0x228814={'method':'GET','uri':encodeURI(_0x333e84+_0xa812('0xad')+_0x20b8c3+'\x27'),'headers':{'Authorization':_0xa812('0xae')+_0x27a556,'If-None-Match':null,'OData-Version':_0xa812('0xaf')},'json':!![]};return rp(_0x228814);})[_0xa812('0x2f')](function(_0x562299){var _0x31b1f5=_0x562299['value'][0x0];var _0xce6420=_0x31b1f5[_0xa812('0xb0')];var _0x5035cd={'method':'GET','uri':_0x333e84+'EntityDefinitions('+_0xce6420+_0xa812('0xb1'),'headers':{'Authorization':_0xa812('0xae')+_0x27a556,'If-None-Match':null,'OData-Version':_0xa812('0xaf')},'json':!![]};return rp(_0x5035cd);})[_0xa812('0x2f')](function(_0xc31776){_0x16a2a3=_0xc31776;_0x4d33bd=_0x16a2a3[_0xa812('0xb2')];_0x4d33bd=_[_0xa812('0xb3')](_0x4d33bd,function(_0x578418){return!_0x288737[_0xa812('0xb4')](_0x578418[_0xa812('0xb5')]);});var _0x506aed=[];var _0x2ac047=[];_0x4d33bd[_0xa812('0xb6')](function(_0x338e3e){if(_0x338e3e[_0xa812('0xb7')]){var _0x188dc1=_0x338e3e[_0xa812('0xb7')][_0xa812('0xa5')](_0x338e3e[_0xa812('0xb7')][_0xa812('0xa6')]('.')+0x1);if(_0x188dc1===_0xa812('0xb8')){_0x506aed[_0xa812('0xb9')](getSelectList(_0x333e84,_0x521f30,_0x2ac047,_0x16a2a3[_0xa812('0xb0')],_0x338e3e[_0xa812('0xb0')],_0x27a556));}}});return Promise[_0xa812('0xba')](_0x506aed);})[_0xa812('0x2f')](function(_0x30ac49){_0x2dabee=_0x30ac49[0x0];var _0x503a67=[];var _0x329673=[];_0x4d33bd[_0xa812('0xb6')](function(_0x13656c){if(!_[_0xa812('0xbb')](_0x13656c[_0xa812('0xb7')])){var _0x5b7401=_0x13656c[_0xa812('0xb7')][_0xa812('0xa5')](_0x13656c['@odata.type'][_0xa812('0xa6')]('.')+0x1);if(_0x5b7401===_0xa812('0xbc')){_0x503a67[_0xa812('0xb9')](getBooleanList(_0x333e84,_0x521f30,_0x329673,_0x16a2a3[_0xa812('0xb0')],_0x13656c[_0xa812('0xb0')],_0x27a556));}}});return Promise['all'](_0x503a67);})[_0xa812('0x2f')](function(_0x2ef432){_0x340177=_0x2ef432[0x0];var _0x4f4784=[];var _0x573967=[];_0x4d33bd[_0xa812('0xb6')](function(_0x5d62d4){if(_0x5d62d4['@odata.type']){var _0x1f8a6c=_0x5d62d4[_0xa812('0xb7')][_0xa812('0xa5')](_0x5d62d4[_0xa812('0xb7')][_0xa812('0xa6')]('.')+0x1);if(_0x1f8a6c===_0xa812('0xbd')||_0x1f8a6c===_0xa812('0xbe')||_0x1f8a6c===_0xa812('0xbf')||_0x1f8a6c==='IntegerAttributeMetadata'||_0x1f8a6c==='MemoAttributeMetadata'||_0x1f8a6c===_0xa812('0xc0')||_0x1f8a6c===_0xa812('0xc1')||_0x1f8a6c==='EntityNameAttributeMetadata'||_0x1f8a6c===_0xa812('0xc2')||_0x1f8a6c===_0xa812('0xc3')){_0x4f4784[_0xa812('0xb9')](getInputList(_0x333e84,_0x521f30,_0x1f8a6c,_0x573967,_0x16a2a3[_0xa812('0xb0')],_0x5d62d4['MetadataId'],_0x27a556));}}});return Promise[_0xa812('0xba')](_0x4f4784);})[_0xa812('0x2f')](function(_0xb83829){_0x3d1b4e=_0xb83829[0x0];var _0x2cb6f2=_0x2dabee[_0xa812('0xc4')](_0x340177)['concat'](_0x3d1b4e);var _0xed79da={'count':_0x2cb6f2[_0xa812('0x3d')],'rows':_0x2cb6f2};return _0xed79da;})[_0xa812('0x2f')](respondWithResult(_0x4568c0,null))[_0xa812('0x24')](function(_0xa93ef6){var _0x32d2b1=_0x17639c[_0xa812('0x36')]['test']?0x1f4:_0xa93ef6[_0xa812('0xc5')]||0x1f4;logger[_0xa812('0x22')](_0xa93ef6[_0xa812('0x31')]);delete _0xa93ef6[_0xa812('0x32')];if(_0x32d2b1===0x191){_0x32d2b1=0x190;}_0x4568c0['status'](_0x32d2b1)[_0xa812('0xc6')](_0x17639c[_0xa812('0x36')][_0xa812('0xc7')]?{'message':_0xa812('0xc8'),'statusCode':_0xa93ef6[_0xa812('0xc5')]}:_0xa93ef6);});};function getSelectList(_0x4b3a82,_0x3f4cd6,_0x183a48,_0x4a1ee6,_0x4aafa8,_0x5ac556){var _0x4188f5={'method':'GET','uri':_0x4b3a82+_0xa812('0xc9')+_0x4a1ee6+')/Attributes('+_0x4aafa8+_0xa812('0xca')+_0xa812('0xcb'),'headers':{'Authorization':'Bearer\x20'+_0x5ac556,'If-None-Match':null,'OData-Version':_0xa812('0xaf')},'json':!![]};return rp(_0x4188f5)['then'](function(_0xea8003){var _0x3cde28=[];var _0xbd16b7=_0xea8003['OptionSet'][_0xa812('0xcc')];_0xbd16b7['forEach'](function(_0x3f8589){_0x3cde28['push']({'name':_0x3f8589[_0xa812('0xcd')]['UserLocalizedLabel'][_0xa812('0xcd')],'value':String(_0x3f8589[_0xa812('0xce')])});});var _0xc3ec2e={'id':_0x3f4cd6+'_'+_0xea8003[_0xa812('0xb5')],'name':_0xea8003[_0xa812('0xcf')][_0xa812('0xd0')][_0xa812('0xcd')],'custom':![],'options':_0x3cde28};_0x183a48[_0xa812('0xb9')](_0xc3ec2e);return _0x183a48;});}function getBooleanList(_0x4b6ae3,_0x4d4b2e,_0x15cb30,_0x4d3ccb,_0x407e32,_0x45f713){var _0xb88da8={'method':_0xa812('0xd1'),'uri':_0x4b6ae3+'EntityDefinitions('+_0x4d3ccb+_0xa812('0xd2')+_0x407e32+_0xa812('0xd3'),'headers':{'Authorization':_0xa812('0xae')+_0x45f713,'If-None-Match':null,'OData-Version':_0xa812('0xaf')},'json':!![]};return rp(_0xb88da8)['then'](function(_0x28af2a){var _0x139e9d=[];_0x139e9d['push']({'name':_0x28af2a[_0xa812('0xd4')][_0xa812('0xd5')]['Label'][_0xa812('0xd0')][_0xa812('0xcd')],'value':'true'},{'name':_0x28af2a[_0xa812('0xd4')][_0xa812('0xd6')][_0xa812('0xcd')][_0xa812('0xd0')]['Label'],'value':'false'});var _0x249134={'id':_0x4d4b2e+'_'+_0x28af2a[_0xa812('0xb5')],'name':_0x28af2a[_0xa812('0xcf')][_0xa812('0xd0')][_0xa812('0xcd')],'custom':![],'options':_0x139e9d};_0x15cb30[_0xa812('0xb9')](_0x249134);return _0x15cb30;});}function getInputList(_0x745cde,_0x10a731,_0x49f5fe,_0xc0ad90,_0x4b1786,_0x24f2b5,_0x3e8231){var _0x319e91={'method':_0xa812('0xd1'),'uri':_0x745cde+_0xa812('0xc9')+_0x4b1786+_0xa812('0xd2')+_0x24f2b5+_0xa812('0xd7')+_0x49f5fe+_0xa812('0xd8'),'headers':{'Authorization':_0xa812('0xae')+_0x3e8231,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x319e91)[_0xa812('0x2f')](function(_0x359903){var _0x5c8f6f={'id':_0x10a731+'_'+_0x359903[_0xa812('0xb5')],'name':_0x359903[_0xa812('0xcf')][_0xa812('0xd0')]?_0x359903[_0xa812('0xcf')][_0xa812('0xd0')][_0xa812('0xcd')]:_0x359903[_0xa812('0xb5')],'custom':![],'options':[]};_0xc0ad90[_0xa812('0xb9')](_0x5c8f6f);return _0xc0ad90;});} \ No newline at end of file +var _0x35c4=['end','stack','name','send','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','type','merge','options','Dynamics365Account','includeAll','include','rows','show','filtears','length','find','create','body','params','destroy','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','PhoneCall','title','description','customerid','ownerid','subject','regardingobjectid','directioncode','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','/oauth2/token','password','GET','Bearer\x20','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','DisplayName','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','count','offset','set','json','apply','reject','save','update','then'];(function(_0x37434a,_0x5afbfb){var _0x14308f=function(_0xfb522a){while(--_0xfb522a){_0x37434a['push'](_0x37434a['shift']());}};_0x14308f(++_0x5afbfb);}(_0x35c4,0xa6));var _0x435c=function(_0x97e4e,_0x3182fe){_0x97e4e=_0x97e4e-0x0;var _0x3161c0=_0x35c4[_0x97e4e];return _0x3161c0;};'use strict';var pdf=require(_0x435c('0x0'));var emlformat=require(_0x435c('0x1'));var rimraf=require(_0x435c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x435c('0x3'));var rp=require(_0x435c('0x4'));var moment=require(_0x435c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x435c('0x6'));var util=require(_0x435c('0x7'));var path=require(_0x435c('0x8'));var sox=require(_0x435c('0x9'));var csv=require(_0x435c('0xa'));var ejs=require(_0x435c('0xb'));var fs=require('fs');var _=require(_0x435c('0xc'));var squel=require(_0x435c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x435c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x435c('0xf'));var Papa=require('papaparse');var Redis=require(_0x435c('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(_0x435c('0x11'))(_0x435c('0x12'));var utils=require(_0x435c('0x13'));var config=require(_0x435c('0x14'));var licenseUtil=require(_0x435c('0x15'));var db=require(_0x435c('0x16'))['db'];var integrations=require(_0x435c('0x17'));var jayson=require(_0x435c('0x18'));var client=jayson['client'][_0x435c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x173140,_0x2fc892,_0x413e51,_0x3759f6){return new BPromise(function(_0xdd6606,_0x5bed73){var _0xd158d5=_0x3759f6||client;return _0xd158d5['request'](_0x173140,_0x413e51)['then'](function(_0x3da2d3){logger[_0x435c('0x1a')]('Dynamics365Account,\x20%s,\x20%s',_0x2fc892,_0x435c('0x1b'));logger[_0x435c('0x1c')](_0x435c('0x1d'),_0x2fc892,_0x435c('0x1b'),JSON['stringify'](_0x3da2d3));if(_0x3da2d3[_0x435c('0x1e')]){if(_0x3da2d3[_0x435c('0x1e')][_0x435c('0x1f')]===0x1f4){logger[_0x435c('0x1e')](_0x435c('0x20'),_0x2fc892,_0x3da2d3[_0x435c('0x1e')][_0x435c('0x21')]);return _0x5bed73(_0x3da2d3[_0x435c('0x1e')][_0x435c('0x21')]);}logger[_0x435c('0x1e')](_0x435c('0x20'),_0x2fc892,_0x3da2d3[_0x435c('0x1e')][_0x435c('0x21')]);return _0xdd6606(_0x3da2d3['error'][_0x435c('0x21')]);}else{logger[_0x435c('0x1a')](_0x435c('0x20'),_0x2fc892,_0x435c('0x1b'));_0xdd6606(_0x3da2d3[_0x435c('0x22')][_0x435c('0x21')]);}})[_0x435c('0x23')](function(_0x85161a){logger[_0x435c('0x1e')](_0x435c('0x20'),_0x2fc892,_0x85161a);_0x5bed73(_0x85161a);});});}function respondWithStatusCode(_0x1df2c0,_0x336625){_0x336625=_0x336625||0xcc;return function(_0x1b8c27){if(_0x1b8c27){return _0x1df2c0[_0x435c('0x24')](_0x336625);}return _0x1df2c0[_0x435c('0x25')](_0x336625)['end']();};}function respondWithResult(_0x300be8,_0x23d3c0){_0x23d3c0=_0x23d3c0||0xc8;return function(_0x462ef5){if(_0x462ef5){return _0x300be8[_0x435c('0x25')](_0x23d3c0)['json'](_0x462ef5);}};}function respondWithFilteredResult(_0x175b4a,_0x2d6dd5){return function(_0x1f994a){if(_0x1f994a){var _0x24dc73=_0x1f994a[_0x435c('0x26')],_0xdcecdf=_0x2d6dd5[_0x435c('0x27')],_0x3581e8=_0x2d6dd5['offset']+_0x2d6dd5['limit'],_0x7526dc;if(_0x3581e8>=_0x24dc73){_0x3581e8=_0x24dc73;_0x7526dc=0xc8;}else{_0x7526dc=0xce;}_0x175b4a[_0x435c('0x25')](_0x7526dc);return _0x175b4a[_0x435c('0x28')]('Content-Range',_0xdcecdf+'-'+_0x3581e8+'/'+_0x24dc73)[_0x435c('0x29')](_0x1f994a);}return null;};}function patchUpdates(_0x30b81e){return function(_0x14757a){try{jsonpatch[_0x435c('0x2a')](_0x14757a,_0x30b81e,!![]);}catch(_0x29a971){return BPromise[_0x435c('0x2b')](_0x29a971);}return _0x14757a[_0x435c('0x2c')]();};}function saveUpdates(_0x3ea579,_0x4f7919){return function(_0x3ebd50){if(_0x3ebd50){return _0x3ebd50[_0x435c('0x2d')](_0x3ea579)[_0x435c('0x2e')](function(_0x3abff2){return _0x3abff2;});}return null;};}function removeEntity(_0x53a0db,_0x17937d){return function(_0x4501f2){if(_0x4501f2){return _0x4501f2['destroy']()[_0x435c('0x2e')](function(){_0x53a0db[_0x435c('0x25')](0xcc)[_0x435c('0x2f')]();});}};}function handleEntityNotFound(_0x2fd4f9,_0x108d79){return function(_0x186a7e){if(!_0x186a7e){_0x2fd4f9[_0x435c('0x24')](0x194);}return _0x186a7e;};}function handleError(_0x3beb11,_0x1690b0){_0x1690b0=_0x1690b0||0x1f4;return function(_0x3fad96){logger['error'](_0x3fad96[_0x435c('0x30')]);if(_0x3fad96[_0x435c('0x31')]){delete _0x3fad96[_0x435c('0x31')];}_0x3beb11['status'](_0x1690b0)[_0x435c('0x32')](_0x3fad96);};}exports['index']=function(_0xa8f8d8,_0x15f94d){var _0x130800={},_0x228ad4={},_0x38017d={'count':0x0,'rows':[]};var _0x656bb8=_['map'](db['Dynamics365Account'][_0x435c('0x33')],function(_0x5b0d2b){return{'name':_0x5b0d2b[_0x435c('0x34')],'type':_0x5b0d2b['type'][_0x435c('0x35')]};});_0x228ad4['model']=_[_0x435c('0x36')](_0x656bb8,_0x435c('0x31'));_0x228ad4[_0x435c('0x37')]=_[_0x435c('0x38')](_0xa8f8d8[_0x435c('0x37')]);_0x228ad4['filters']=_[_0x435c('0x39')](_0x228ad4[_0x435c('0x3a')],_0x228ad4[_0x435c('0x37')]);_0x130800[_0x435c('0x3b')]=_[_0x435c('0x39')](_0x228ad4['model'],qs['fields'](_0xa8f8d8['query'][_0x435c('0x3c')]));_0x130800['attributes']=_0x130800[_0x435c('0x3b')]['length']?_0x130800[_0x435c('0x3b')]:_0x228ad4[_0x435c('0x3a')];if(!_0xa8f8d8[_0x435c('0x37')][_0x435c('0x3d')](_0x435c('0x3e'))){_0x130800[_0x435c('0x3f')]=qs[_0x435c('0x3f')](_0xa8f8d8[_0x435c('0x37')][_0x435c('0x3f')]);_0x130800[_0x435c('0x27')]=qs[_0x435c('0x27')](_0xa8f8d8[_0x435c('0x37')][_0x435c('0x27')]);}_0x130800[_0x435c('0x40')]=qs[_0x435c('0x41')](_0xa8f8d8[_0x435c('0x37')][_0x435c('0x41')]);_0x130800['where']=qs[_0x435c('0x42')](_[_0x435c('0x43')](_0xa8f8d8[_0x435c('0x37')],_0x228ad4['filters']),_0x656bb8);if(_0xa8f8d8['query'][_0x435c('0x44')]){_0x130800['where']=_['merge'](_0x130800[_0x435c('0x45')],{'$or':_['map'](_0x656bb8,function(_0x5dd559){if(_0x5dd559[_0x435c('0x46')]!=='VIRTUAL'){var _0x19f329={};_0x19f329[_0x5dd559[_0x435c('0x31')]]={'$like':'%'+_0xa8f8d8[_0x435c('0x37')][_0x435c('0x44')]+'%'};return _0x19f329;}})});}_0x130800=_[_0x435c('0x47')]({},_0x130800,_0xa8f8d8[_0x435c('0x48')]);var _0x3449c9={'where':_0x130800[_0x435c('0x45')]};return db[_0x435c('0x49')][_0x435c('0x26')](_0x3449c9)[_0x435c('0x2e')](function(_0x37736a){_0x38017d[_0x435c('0x26')]=_0x37736a;if(_0xa8f8d8['query'][_0x435c('0x4a')]){_0x130800[_0x435c('0x4b')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x130800);})[_0x435c('0x2e')](function(_0x36062d){_0x38017d[_0x435c('0x4c')]=_0x36062d;return _0x38017d;})[_0x435c('0x2e')](respondWithFilteredResult(_0x15f94d,_0x130800))[_0x435c('0x23')](handleError(_0x15f94d,null));};exports[_0x435c('0x4d')]=function(_0x523c4c,_0x1f8e41){var _0x4df354={'raw':![],'where':{'id':_0x523c4c['params']['id']}},_0x1c56f5={};_0x1c56f5[_0x435c('0x3a')]=_['keys'](db['Dynamics365Account']['rawAttributes']);_0x1c56f5[_0x435c('0x37')]=_[_0x435c('0x38')](_0x523c4c[_0x435c('0x37')]);_0x1c56f5[_0x435c('0x4e')]=_['intersection'](_0x1c56f5[_0x435c('0x3a')],_0x1c56f5[_0x435c('0x37')]);_0x4df354['attributes']=_[_0x435c('0x39')](_0x1c56f5[_0x435c('0x3a')],qs[_0x435c('0x3c')](_0x523c4c[_0x435c('0x37')][_0x435c('0x3c')]));_0x4df354[_0x435c('0x3b')]=_0x4df354['attributes'][_0x435c('0x4f')]?_0x4df354[_0x435c('0x3b')]:_0x1c56f5[_0x435c('0x3a')];if(_0x523c4c[_0x435c('0x37')][_0x435c('0x4a')]){_0x4df354[_0x435c('0x4b')]=[{'all':!![]}];}_0x4df354=_[_0x435c('0x47')]({},_0x4df354,_0x523c4c[_0x435c('0x48')]);return db[_0x435c('0x49')][_0x435c('0x50')](_0x4df354)[_0x435c('0x2e')](handleEntityNotFound(_0x1f8e41,null))[_0x435c('0x2e')](respondWithResult(_0x1f8e41,null))['catch'](handleError(_0x1f8e41,null));};exports[_0x435c('0x51')]=function(_0x1bab40,_0x11c172){return db['Dynamics365Account'][_0x435c('0x51')](_0x1bab40['body'],{})[_0x435c('0x2e')](respondWithResult(_0x11c172,0xc9))[_0x435c('0x23')](handleError(_0x11c172,null));};exports['update']=function(_0x1bf0d0,_0x29d24a){if(_0x1bf0d0[_0x435c('0x52')]['id']){delete _0x1bf0d0['body']['id'];}return db[_0x435c('0x49')][_0x435c('0x50')]({'where':{'id':_0x1bf0d0[_0x435c('0x53')]['id']}})[_0x435c('0x2e')](handleEntityNotFound(_0x29d24a,null))[_0x435c('0x2e')](saveUpdates(_0x1bf0d0['body'],null))[_0x435c('0x2e')](respondWithResult(_0x29d24a,null))[_0x435c('0x23')](handleError(_0x29d24a,null));};exports[_0x435c('0x54')]=function(_0x55376d,_0x5a8674){return db[_0x435c('0x49')][_0x435c('0x50')]({'where':{'id':_0x55376d['params']['id']}})[_0x435c('0x2e')](handleEntityNotFound(_0x5a8674,null))['then'](removeEntity(_0x5a8674,null))['catch'](handleError(_0x5a8674,null));};exports[_0x435c('0x55')]=function(_0x50af2d,_0x3daab4,_0x4938ab){var _0x17a477={};var _0x4fd373={};var _0x3b3c13;var _0x30ff3b;return db[_0x435c('0x49')][_0x435c('0x56')]({'where':{'id':_0x50af2d[_0x435c('0x53')]['id']}})[_0x435c('0x2e')](handleEntityNotFound(_0x3daab4,null))[_0x435c('0x2e')](function(_0x59ec45){if(_0x59ec45){_0x3b3c13=_0x59ec45;_0x4fd373[_0x435c('0x3a')]=_['keys'](db[_0x435c('0x57')]['rawAttributes']);_0x4fd373[_0x435c('0x37')]=_[_0x435c('0x38')](_0x50af2d[_0x435c('0x37')]);_0x4fd373[_0x435c('0x42')]=_[_0x435c('0x39')](_0x4fd373[_0x435c('0x3a')],_0x4fd373[_0x435c('0x37')]);_0x17a477[_0x435c('0x3b')]=_[_0x435c('0x39')](_0x4fd373[_0x435c('0x3a')],qs[_0x435c('0x3c')](_0x50af2d[_0x435c('0x37')]['fields']));_0x17a477[_0x435c('0x3b')]=_0x17a477[_0x435c('0x3b')][_0x435c('0x4f')]?_0x17a477[_0x435c('0x3b')]:_0x4fd373[_0x435c('0x3a')];_0x17a477[_0x435c('0x40')]=qs['sort'](_0x50af2d[_0x435c('0x37')][_0x435c('0x41')]);_0x17a477[_0x435c('0x45')]=qs['filters'](_['pick'](_0x50af2d['query'],_0x4fd373[_0x435c('0x42')]));if(_0x50af2d['query'][_0x435c('0x44')]){_0x17a477[_0x435c('0x45')]=_[_0x435c('0x47')](_0x17a477[_0x435c('0x45')],{'$or':_[_0x435c('0x36')](_0x17a477[_0x435c('0x3b')],function(_0x46e4d1){var _0x19b2ab={};_0x19b2ab[_0x46e4d1]={'$like':'%'+_0x50af2d[_0x435c('0x37')][_0x435c('0x44')]+'%'};return _0x19b2ab;})});}_0x17a477=_[_0x435c('0x47')]({},_0x17a477,_0x50af2d['options']);return _0x3b3c13[_0x435c('0x55')](_0x17a477);}})['then'](function(_0x339269){if(_0x339269){_0x30ff3b=_0x339269[_0x435c('0x4f')];if(!_0x50af2d[_0x435c('0x37')][_0x435c('0x3d')](_0x435c('0x3e'))){_0x17a477[_0x435c('0x3f')]=qs['limit'](_0x50af2d[_0x435c('0x37')][_0x435c('0x3f')]);_0x17a477['offset']=qs['offset'](_0x50af2d['query']['offset']);}return _0x3b3c13['getConfigurations'](_0x17a477);}})[_0x435c('0x2e')](function(_0x326904){if(_0x326904){return _0x326904?{'count':_0x30ff3b,'rows':_0x326904}:null;}})[_0x435c('0x2e')](respondWithResult(_0x3daab4,null))[_0x435c('0x23')](handleError(_0x3daab4,null));};exports[_0x435c('0x58')]=function(_0xe49cc0,_0x341826,_0x47cb2d){if(_0xe49cc0['body']['id']){delete _0xe49cc0[_0x435c('0x52')]['id'];}return db[_0x435c('0x49')][_0x435c('0x56')]({'where':{'id':_0xe49cc0['params']['id']}})[_0x435c('0x2e')](handleEntityNotFound(_0x341826,null))['then'](function(_0x52e7f7){if(_0x52e7f7){_0xe49cc0['body']['AccountId']=_0x52e7f7['id'];_0xe49cc0[_0x435c('0x52')][_0x435c('0x59')]=integrations[_0x435c('0x5a')](_0xe49cc0[_0x435c('0x52')][_0x435c('0x5b')],_0xe49cc0[_0x435c('0x52')]['type']);_0xe49cc0[_0x435c('0x52')][_0x435c('0x5c')]=integrations[_0x435c('0x5d')](_0xe49cc0['body']['channel'],_0xe49cc0[_0x435c('0x52')]['type']);return db['Dynamics365Configuration'][_0x435c('0x51')](_0xe49cc0[_0x435c('0x52')],{'include':[{'model':db[_0x435c('0x5e')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x435c('0x5c')}]});}return null;})['then'](respondWithResult(_0x341826,null))[_0x435c('0x23')](handleError(_0x341826,null));};exports[_0x435c('0x5f')]=function(_0x4e6917,_0x4152d5,_0xe3797b){var _0x31331b=_0x4e6917[_0x435c('0x37')]['ticketType'];var _0x1998b6=_0x31331b===_0x435c('0x60')?'Incident':_0x435c('0x61');var _0x480dbe='';var _0x14fa15='';var _0x1a22e4='';var _0x1917b5='';var _0x146268='';var _0xe41e3f='';var _0x18bf71='';var _0x3457bd='';var _0x9e3c17=[_0x435c('0x62'),_0x435c('0x63'),_0x435c('0x64'),_0x435c('0x65'),'caseorigincode',_0x435c('0x66'),'phonenumber',_0x435c('0x67'),_0x435c('0x68'),'phonecall_activity_parties'];var _0x34f995=['accountidname',_0x435c('0x69'),_0x435c('0x6a'),_0x435c('0x6b'),'contactidname',_0x435c('0x6c'),_0x435c('0x6d'),_0x435c('0x6e'),_0x435c('0x6f'),_0x435c('0x70'),_0x435c('0x71'),_0x435c('0x72'),_0x435c('0x73'),_0x435c('0x74'),'createdonbehalfbyyominame',_0x435c('0x75'),_0x435c('0x76'),_0x435c('0x77'),'emailaddress',_0x435c('0x78'),'entityimage_timestamp','entityimage_url','escalatedon',_0x435c('0x79'),_0x435c('0x7a'),'followupby',_0x435c('0x7b'),_0x435c('0x7c'),_0x435c('0x7d'),_0x435c('0x7e'),_0x435c('0x7f'),_0x435c('0x80'),_0x435c('0x81'),_0x435c('0x82'),_0x435c('0x83'),_0x435c('0x84'),_0x435c('0x85'),_0x435c('0x86'),_0x435c('0x87'),_0x435c('0x88'),_0x435c('0x89'),_0x435c('0x8a'),_0x435c('0x8b'),'owneridname',_0x435c('0x8c'),_0x435c('0x8d'),_0x435c('0x8e'),_0x435c('0x8f'),_0x435c('0x90'),'prioritycodename','productidname',_0x435c('0x91'),_0x435c('0x92'),'resolvebykpiidname',_0x435c('0x93'),_0x435c('0x94'),_0x435c('0x95'),_0x435c('0x96'),_0x435c('0x97'),_0x435c('0x98'),_0x435c('0x99'),_0x435c('0x9a'),_0x435c('0x9b'),_0x435c('0x9c'),_0x435c('0x9d'),_0x435c('0x9e'),'transactioncurrencyidname',_0x435c('0x9f'),_0x435c('0xa0'),'versionnumber'];var _0x532604=_0x9e3c17[_0x435c('0xa1')](_0x34f995);return db[_0x435c('0x49')][_0x435c('0x56')]({'where':{'id':_0x4e6917[_0x435c('0x53')]['id']},'attributes':['id',_0x435c('0xa2'),'password','remoteUri',_0x435c('0xa3'),_0x435c('0xa4'),_0x435c('0xa5')]})[_0x435c('0x2e')](handleEntityNotFound(_0x4152d5,null))['then'](function(_0x17e89f){if(_0x17e89f){_0x3457bd=_0x17e89f[_0x435c('0xa6')];var _0x4894f9=_0x3457bd[_0x435c('0xa7')](-0x1);if(_0x4894f9==='/'){_0x3457bd=_0x3457bd[_0x435c('0xa8')](0x0,_0x3457bd[_0x435c('0xa9')](_0x4894f9));}_0x18bf71=util[_0x435c('0xaa')](_0x435c('0xab'),_0x3457bd);var _0x459680={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x17e89f[_0x435c('0xa3')]+_0x435c('0xac'),'form':{'client_id':_0x17e89f[_0x435c('0xa4')],'resource':_0x3457bd,'username':_0x17e89f[_0x435c('0xa2')],'password':_0x17e89f['password'],'grant_type':_0x435c('0xad'),'client_secret':_0x17e89f[_0x435c('0xa5')]},'json':!![]};return rp(_0x459680);}})[_0x435c('0x2e')](function(_0x3274f3){_0xe41e3f=_0x3274f3['access_token'];var _0x247ca5={'method':_0x435c('0xae'),'uri':encodeURI(_0x18bf71+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1998b6+'\x27'),'headers':{'Authorization':_0x435c('0xaf')+_0xe41e3f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x247ca5);})[_0x435c('0x2e')](function(_0x262d44){var _0x5432e7=_0x262d44['value'][0x0];var _0x17490f=_0x5432e7['MetadataId'];var _0x20926a={'method':_0x435c('0xae'),'uri':_0x18bf71+_0x435c('0xb0')+_0x17490f+_0x435c('0xb1'),'headers':{'Authorization':_0x435c('0xaf')+_0xe41e3f,'If-None-Match':null,'OData-Version':_0x435c('0xb2')},'json':!![]};return rp(_0x20926a);})[_0x435c('0x2e')](function(_0x49fbb9){_0x480dbe=_0x49fbb9;_0x14fa15=_0x480dbe[_0x435c('0xb3')];_0x14fa15=_[_0x435c('0xb4')](_0x14fa15,function(_0x1e7809){return!_0x532604[_0x435c('0xb5')](_0x1e7809[_0x435c('0xb6')]);});var _0x413f2b=[];var _0x18b2d2=[];_0x14fa15[_0x435c('0xb7')](function(_0x1538be){if(_0x1538be['@odata.type']){var _0x45c6f0=_0x1538be[_0x435c('0xb8')]['substring'](_0x1538be[_0x435c('0xb8')][_0x435c('0xa9')]('.')+0x1);if(_0x45c6f0===_0x435c('0xb9')){_0x413f2b[_0x435c('0xba')](getSelectList(_0x18bf71,_0x31331b,_0x18b2d2,_0x480dbe[_0x435c('0xbb')],_0x1538be[_0x435c('0xbb')],_0xe41e3f));}}});return Promise[_0x435c('0xbc')](_0x413f2b);})[_0x435c('0x2e')](function(_0x22b776){_0x1a22e4=_0x22b776[0x0];var _0x18a6c3=[];var _0x1dd10c=[];_0x14fa15[_0x435c('0xb7')](function(_0x21c9ed){if(!_[_0x435c('0xbd')](_0x21c9ed[_0x435c('0xb8')])){var _0x3033b9=_0x21c9ed[_0x435c('0xb8')][_0x435c('0xa8')](_0x21c9ed[_0x435c('0xb8')]['lastIndexOf']('.')+0x1);if(_0x3033b9===_0x435c('0xbe')){_0x18a6c3['push'](getBooleanList(_0x18bf71,_0x31331b,_0x1dd10c,_0x480dbe[_0x435c('0xbb')],_0x21c9ed[_0x435c('0xbb')],_0xe41e3f));}}});return Promise['all'](_0x18a6c3);})[_0x435c('0x2e')](function(_0x21aa64){_0x1917b5=_0x21aa64[0x0];var _0x5a55f9=[];var _0x211fba=[];_0x14fa15[_0x435c('0xb7')](function(_0x28f972){if(_0x28f972['@odata.type']){var _0x149248=_0x28f972['@odata.type'][_0x435c('0xa8')](_0x28f972['@odata.type'][_0x435c('0xa9')]('.')+0x1);if(_0x149248===_0x435c('0xbf')||_0x149248==='DoubleAttributeMetadata'||_0x149248==='BigIntAttributeMetadata'||_0x149248===_0x435c('0xc0')||_0x149248===_0x435c('0xc1')||_0x149248===_0x435c('0xc2')||_0x149248===_0x435c('0xc3')||_0x149248===_0x435c('0xc4')||_0x149248===_0x435c('0xc5')||_0x149248===_0x435c('0xc6')){_0x5a55f9[_0x435c('0xba')](getInputList(_0x18bf71,_0x31331b,_0x149248,_0x211fba,_0x480dbe['MetadataId'],_0x28f972[_0x435c('0xbb')],_0xe41e3f));}}});return Promise['all'](_0x5a55f9);})['then'](function(_0x98ce2c){_0x146268=_0x98ce2c[0x0];var _0x3b4fb3=_0x1a22e4[_0x435c('0xa1')](_0x1917b5)[_0x435c('0xa1')](_0x146268);var _0x4db6cd={'count':_0x3b4fb3['length'],'rows':_0x3b4fb3};return _0x4db6cd;})[_0x435c('0x2e')](respondWithResult(_0x4152d5,null))[_0x435c('0x23')](function(_0x54021f){var _0xa6a95d=_0x4e6917[_0x435c('0x37')][_0x435c('0xc7')]?0x1f4:_0x54021f[_0x435c('0xc8')]||0x1f4;logger[_0x435c('0x1e')](_0x54021f[_0x435c('0x30')]);delete _0x54021f['name'];if(_0xa6a95d===0x191){_0xa6a95d=0x190;}_0x4152d5[_0x435c('0x25')](_0xa6a95d)[_0x435c('0x32')](_0x4e6917['query'][_0x435c('0xc7')]?{'message':_0x435c('0xc9'),'statusCode':_0x54021f['statusCode']}:_0x54021f);});};function getSelectList(_0x141bf9,_0x49b465,_0x15e80a,_0x3f85de,_0x26176a,_0xc1d939){var _0x4877d7={'method':'GET','uri':_0x141bf9+'EntityDefinitions('+_0x3f85de+')/Attributes('+_0x26176a+_0x435c('0xca')+_0x435c('0xcb'),'headers':{'Authorization':_0x435c('0xaf')+_0xc1d939,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4877d7)[_0x435c('0x2e')](function(_0x20228f){var _0x567f52=[];var _0x3c7f19=_0x20228f[_0x435c('0xcc')][_0x435c('0xcd')];_0x3c7f19[_0x435c('0xb7')](function(_0x41245e){_0x567f52[_0x435c('0xba')]({'name':_0x41245e[_0x435c('0xce')][_0x435c('0xcf')]['Label'],'value':String(_0x41245e[_0x435c('0xd0')])});});var _0x1803e6={'id':_0x49b465+'_'+_0x20228f[_0x435c('0xb6')],'name':_0x20228f['DisplayName'][_0x435c('0xcf')][_0x435c('0xce')],'custom':![],'options':_0x567f52};_0x15e80a[_0x435c('0xba')](_0x1803e6);return _0x15e80a;});}function getBooleanList(_0x4a04cd,_0x357082,_0x29d8b7,_0x4df3a4,_0x4dd211,_0x518608){var _0xe8fda0={'method':_0x435c('0xae'),'uri':_0x4a04cd+_0x435c('0xb0')+_0x4df3a4+_0x435c('0xd1')+_0x4dd211+_0x435c('0xd2'),'headers':{'Authorization':_0x435c('0xaf')+_0x518608,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xe8fda0)['then'](function(_0x34ecc6){var _0x284efa=[];_0x284efa['push']({'name':_0x34ecc6['OptionSet']['TrueOption']['Label'][_0x435c('0xcf')][_0x435c('0xce')],'value':'true'},{'name':_0x34ecc6[_0x435c('0xcc')][_0x435c('0xd3')][_0x435c('0xce')][_0x435c('0xcf')][_0x435c('0xce')],'value':'false'});var _0x1b8cd6={'id':_0x357082+'_'+_0x34ecc6[_0x435c('0xb6')],'name':_0x34ecc6[_0x435c('0xd4')]['UserLocalizedLabel'][_0x435c('0xce')],'custom':![],'options':_0x284efa};_0x29d8b7[_0x435c('0xba')](_0x1b8cd6);return _0x29d8b7;});}function getInputList(_0x139b99,_0x4ce575,_0xac54ca,_0x1ab59,_0x8b9b8a,_0xb945d3,_0xa7da5e){var _0x39b8c4={'method':_0x435c('0xae'),'uri':_0x139b99+_0x435c('0xb0')+_0x8b9b8a+_0x435c('0xd1')+_0xb945d3+')/Microsoft.Dynamics.CRM.'+_0xac54ca+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x435c('0xaf')+_0xa7da5e,'If-None-Match':null,'OData-Version':_0x435c('0xb2')},'json':!![]};return rp(_0x39b8c4)[_0x435c('0x2e')](function(_0x407b5f){var _0xaf4f22={'id':_0x4ce575+'_'+_0x407b5f['LogicalName'],'name':_0x407b5f[_0x435c('0xd4')]['UserLocalizedLabel']?_0x407b5f[_0x435c('0xd4')][_0x435c('0xcf')]['Label']:_0x407b5f['LogicalName'],'custom':![],'options':[]};_0x1ab59[_0x435c('0xba')](_0xaf4f22);return _0x1ab59;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a1115e1..8749f00 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 _0xd149=['rimraf','../../config/environment','exports','define','Dynamics365Account','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x11a305,_0x33e848){var _0x1f8da2=function(_0x550cfc){while(--_0x550cfc){_0x11a305['push'](_0x11a305['shift']());}};_0x1f8da2(++_0x33e848);}(_0xd149,0xc5));var _0x9d14=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xd149[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x9d14('0x0'));var util=require(_0x9d14('0x1'));var logger=require(_0x9d14('0x2'))(_0x9d14('0x3'));var moment=require(_0x9d14('0x4'));var BPromise=require(_0x9d14('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d14('0x6'));var rimraf=require(_0x9d14('0x7'));var config=require(_0x9d14('0x8'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x9d14('0x9')]=function(_0x23ca32,_0x2812db){return _0x23ca32[_0x9d14('0xa')](_0x9d14('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2445=['./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','int_dynamics365_accounts','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x1c2ae4,_0x2d440b){var _0x2cb6cd=function(_0x3bb616){while(--_0x3bb616){_0x1c2ae4['push'](_0x1c2ae4['shift']());}};_0x2cb6cd(++_0x2d440b);}(_0x2445,0x1c1));var _0x5244=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x2445[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x5244('0x0'));var util=require(_0x5244('0x1'));var logger=require('../../config/logger')(_0x5244('0x2'));var moment=require(_0x5244('0x3'));var BPromise=require('bluebird');var rp=require(_0x5244('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5244('0x5'));var config=require(_0x5244('0x6'));var attributes=require(_0x5244('0x7'));var integrations=require(_0x5244('0x8'));module[_0x5244('0x9')]=function(_0x18bf2f,_0x1c59f8){return _0x18bf2f[_0x5244('0xa')]('Dynamics365Account',attributes,{'tableName':_0x5244('0xb'),'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 af12eb7..e82b0c8 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 _0x77f7=['attributes','model','find','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x77f7,0xbd));var _0x777f=function(_0x3c0003,_0x36c34a){_0x3c0003=_0x3c0003-0x0;var _0x420cf3=_0x77f7[_0x3c0003];return _0x420cf3;};'use strict';var _=require(_0x777f('0x0'));var util=require(_0x777f('0x1'));var moment=require(_0x777f('0x2'));var BPromise=require(_0x777f('0x3'));var rs=require(_0x777f('0x4'));var fs=require('fs');var Redis=require(_0x777f('0x5'));var db=require(_0x777f('0x6'))['db'];var utils=require(_0x777f('0x7'));var logger=require(_0x777f('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x777f('0x9'));var client=jayson[_0x777f('0xa')][_0x777f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16642d,_0xda8cb2,_0x5bf11d){return new BPromise(function(_0x12bff6,_0x27e9ee){return client[_0x777f('0xc')](_0x16642d,_0x5bf11d)[_0x777f('0xd')](function(_0x4edde5){logger[_0x777f('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xda8cb2,_0x777f('0xf'));logger[_0x777f('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0xda8cb2,_0x777f('0xf'),JSON[_0x777f('0x11')](_0x4edde5));if(_0x4edde5[_0x777f('0x12')]){if(_0x4edde5['error'][_0x777f('0x13')]===0x1f4){logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x4edde5[_0x777f('0x12')][_0x777f('0x15')]);return _0x27e9ee(_0x4edde5[_0x777f('0x12')]['message']);}logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x4edde5['error'][_0x777f('0x15')]);return _0x12bff6(_0x4edde5[_0x777f('0x12')][_0x777f('0x15')]);}else{logger[_0x777f('0xe')](_0x777f('0x14'),_0xda8cb2,_0x777f('0xf'));_0x12bff6(_0x4edde5[_0x777f('0x16')]['message']);}})[_0x777f('0x17')](function(_0x3f6143){logger[_0x777f('0x12')](_0x777f('0x14'),_0xda8cb2,_0x3f6143);_0x27e9ee(_0x3f6143);});});}exports[_0x777f('0x18')]=function(_0x3aeb58){var _0x4038e2=this;return new Promise(function(_0x4e1153,_0x481c4c){return db[_0x777f('0x19')][_0x777f('0x1a')]({'raw':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1c')]===undefined?!![]:![]:!![],'where':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1d')]||null:null,'attributes':_0x3aeb58['options']?_0x3aeb58[_0x777f('0x1b')]['attributes']||null:null,'limit':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1e')]||null:null,'include':_0x3aeb58[_0x777f('0x1b')]?_0x3aeb58[_0x777f('0x1b')][_0x777f('0x1f')]?_[_0x777f('0x20')](_0x3aeb58['options'][_0x777f('0x1f')],function(_0x17f1ed){return{'model':db[_0x17f1ed['model']],'as':_0x17f1ed['as'],'attributes':_0x17f1ed[_0x777f('0x21')],'include':_0x17f1ed['include']?_[_0x777f('0x20')](_0x17f1ed[_0x777f('0x1f')],function(_0x109a8e){return{'model':db[_0x109a8e[_0x777f('0x22')]],'as':_0x109a8e['as'],'attributes':_0x109a8e[_0x777f('0x21')],'include':_0x109a8e[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x109a8e[_0x777f('0x1f')],function(_0x104b86){return{'model':db[_0x104b86['model']],'as':_0x104b86['as'],'attributes':_0x104b86['attributes']};}):[]};}):[]};}):[]:[]})[_0x777f('0xd')](function(_0x37655d){logger[_0x777f('0xe')](_0x777f('0x18'),_0x3aeb58);logger[_0x777f('0x10')](_0x777f('0x18'),_0x3aeb58,JSON[_0x777f('0x11')](_0x37655d));_0x4e1153(_0x37655d);})['catch'](function(_0x2ebed8){logger[_0x777f('0x12')]('GetDynamics365Account',_0x2ebed8[_0x777f('0x15')],_0x3aeb58);_0x481c4c(_0x4038e2[_0x777f('0x12')](0x1f4,_0x2ebed8['message']));});});};exports['ShowDynamics365Account']=function(_0x263fa2){var _0x10e02e=this;return new Promise(function(_0x164792,_0x4365c0){return db[_0x777f('0x19')][_0x777f('0x23')]({'raw':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')][_0x777f('0x1c')]===undefined?!![]:![]:!![],'where':_0x263fa2[_0x777f('0x1b')]?_0x263fa2['options'][_0x777f('0x1d')]||null:null,'attributes':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')][_0x777f('0x21')]||null:null,'include':_0x263fa2[_0x777f('0x1b')]?_0x263fa2[_0x777f('0x1b')]['include']?_[_0x777f('0x20')](_0x263fa2[_0x777f('0x1b')]['include'],function(_0x259983){return{'model':db[_0x259983['model']],'as':_0x259983['as'],'attributes':_0x259983['attributes'],'include':_0x259983[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x259983[_0x777f('0x1f')],function(_0x41252b){return{'model':db[_0x41252b[_0x777f('0x22')]],'as':_0x41252b['as'],'attributes':_0x41252b[_0x777f('0x21')],'include':_0x41252b[_0x777f('0x1f')]?_[_0x777f('0x20')](_0x41252b['include'],function(_0x50f4c4){return{'model':db[_0x50f4c4[_0x777f('0x22')]],'as':_0x50f4c4['as'],'attributes':_0x50f4c4[_0x777f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x777f('0xd')](function(_0x23d1e5){logger[_0x777f('0xe')](_0x777f('0x24'),_0x263fa2);logger[_0x777f('0x10')](_0x777f('0x24'),_0x263fa2,JSON['stringify'](_0x23d1e5));_0x164792(_0x23d1e5);})[_0x777f('0x17')](function(_0x2f7007){logger[_0x777f('0x12')](_0x777f('0x24'),_0x2f7007[_0x777f('0x15')],_0x263fa2);_0x4365c0(_0x10e02e[_0x777f('0x12')](0x1f4,_0x2f7007[_0x777f('0x15')]));});});}; \ No newline at end of file +var _0x2e65=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','findAll','options','raw','where','attributes','limit','model','include','map','debug','GetDynamics365Account','ShowDynamics365Account','find','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e65,0x193));var _0x52e6=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x2e65[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});}exports['GetDynamics365Account']=function(_0x5363d9){var _0x3a3a47=this;return new Promise(function(_0x3997ed,_0x3631e6){return db['Dynamics365Account'][_0x52e6('0x18')]({'raw':_0x5363d9['options']?_0x5363d9[_0x52e6('0x19')][_0x52e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x5363d9[_0x52e6('0x19')]?_0x5363d9['options'][_0x52e6('0x1b')]||null:null,'attributes':_0x5363d9['options']?_0x5363d9[_0x52e6('0x19')][_0x52e6('0x1c')]||null:null,'limit':_0x5363d9[_0x52e6('0x19')]?_0x5363d9['options'][_0x52e6('0x1d')]||null:null,'include':_0x5363d9[_0x52e6('0x19')]?_0x5363d9['options']['include']?_['map'](_0x5363d9[_0x52e6('0x19')]['include'],function(_0x37a59c){return{'model':db[_0x37a59c[_0x52e6('0x1e')]],'as':_0x37a59c['as'],'attributes':_0x37a59c[_0x52e6('0x1c')],'include':_0x37a59c[_0x52e6('0x1f')]?_[_0x52e6('0x20')](_0x37a59c['include'],function(_0x2d5087){return{'model':db[_0x2d5087['model']],'as':_0x2d5087['as'],'attributes':_0x2d5087[_0x52e6('0x1c')],'include':_0x2d5087[_0x52e6('0x1f')]?_[_0x52e6('0x20')](_0x2d5087[_0x52e6('0x1f')],function(_0x1edc6c){return{'model':db[_0x1edc6c[_0x52e6('0x1e')]],'as':_0x1edc6c['as'],'attributes':_0x1edc6c[_0x52e6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x52e6('0xd')](function(_0x160de2){logger[_0x52e6('0x15')]('GetDynamics365Account',_0x5363d9);logger[_0x52e6('0x21')](_0x52e6('0x22'),_0x5363d9,JSON[_0x52e6('0x11')](_0x160de2));_0x3997ed(_0x160de2);})[_0x52e6('0x17')](function(_0x40821c){logger[_0x52e6('0x12')](_0x52e6('0x22'),_0x40821c['message'],_0x5363d9);_0x3631e6(_0x3a3a47['error'](0x1f4,_0x40821c[_0x52e6('0x14')]));});});};exports[_0x52e6('0x23')]=function(_0x116743){var _0x1e2299=this;return new Promise(function(_0x3554fe,_0x5b0446){return db['Dynamics365Account'][_0x52e6('0x24')]({'raw':_0x116743[_0x52e6('0x19')]?_0x116743[_0x52e6('0x19')][_0x52e6('0x1a')]===undefined?!![]:![]:!![],'where':_0x116743[_0x52e6('0x19')]?_0x116743['options'][_0x52e6('0x1b')]||null:null,'attributes':_0x116743[_0x52e6('0x19')]?_0x116743['options'][_0x52e6('0x1c')]||null:null,'include':_0x116743[_0x52e6('0x19')]?_0x116743[_0x52e6('0x19')][_0x52e6('0x1f')]?_['map'](_0x116743[_0x52e6('0x19')][_0x52e6('0x1f')],function(_0x56994f){return{'model':db[_0x56994f[_0x52e6('0x1e')]],'as':_0x56994f['as'],'attributes':_0x56994f[_0x52e6('0x1c')],'include':_0x56994f['include']?_['map'](_0x56994f[_0x52e6('0x1f')],function(_0x18b561){return{'model':db[_0x18b561[_0x52e6('0x1e')]],'as':_0x18b561['as'],'attributes':_0x18b561['attributes'],'include':_0x18b561[_0x52e6('0x1f')]?_[_0x52e6('0x20')](_0x18b561[_0x52e6('0x1f')],function(_0x167c85){return{'model':db[_0x167c85[_0x52e6('0x1e')]],'as':_0x167c85['as'],'attributes':_0x167c85[_0x52e6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b25b0){logger[_0x52e6('0x15')]('ShowDynamics365Account',_0x116743);logger[_0x52e6('0x21')](_0x52e6('0x23'),_0x116743,JSON[_0x52e6('0x11')](_0x4b25b0));_0x3554fe(_0x4b25b0);})['catch'](function(_0x303524){logger[_0x52e6('0x12')]('ShowDynamics365Account',_0x303524[_0x52e6('0x14')],_0x116743);_0x5b0446(_0x1e2299[_0x52e6('0x12')](0x1f4,_0x303524[_0x52e6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 9b63b92..8ca315b 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 _0xe925=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','update','destroy','exports','path'];(function(_0x390dcb,_0x4e5082){var _0x25801b=function(_0x483393){while(--_0x483393){_0x390dcb['push'](_0x390dcb['shift']());}};_0x25801b(++_0x4e5082);}(_0xe925,0x1b4));var _0x5e92=function(_0x47b346,_0x4529fe){_0x47b346=_0x47b346-0x0;var _0x216509=_0xe925[_0x47b346];return _0x216509;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e92('0x0'));var timeout=require(_0x5e92('0x1'));var express=require(_0x5e92('0x2'));var router=express[_0x5e92('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e92('0x4'));var config=require(_0x5e92('0x5'));var controller=require(_0x5e92('0x6'));router[_0x5e92('0x7')]('/',auth['isAuthenticated'](),controller[_0x5e92('0x8')]);router[_0x5e92('0x7')](_0x5e92('0x9'),auth[_0x5e92('0xa')](),controller[_0x5e92('0xb')]);router[_0x5e92('0x7')]('/:id/fields',auth[_0x5e92('0xa')](),controller[_0x5e92('0xc')]);router[_0x5e92('0x7')](_0x5e92('0xd'),auth[_0x5e92('0xa')](),controller[_0x5e92('0xe')]);router[_0x5e92('0x7')](_0x5e92('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x5e92('0xa')](),controller['create']);router['put'](_0x5e92('0x9'),auth['isAuthenticated'](),controller[_0x5e92('0x10')]);router['delete'](_0x5e92('0x9'),auth[_0x5e92('0xa')](),controller[_0x5e92('0x11')]);module[_0x5e92('0x12')]=router; \ No newline at end of file +var _0x903c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x903c,0x1d8));var _0xc903=function(_0x29140d,_0x598dfd){_0x29140d=_0x29140d-0x0;var _0x10451e=_0x903c[_0x29140d];return _0x10451e;};'use strict';var multer=require(_0xc903('0x0'));var util=require(_0xc903('0x1'));var path=require(_0xc903('0x2'));var timeout=require(_0xc903('0x3'));var express=require('express');var router=express[_0xc903('0x4')]();var auth=require(_0xc903('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc903('0x6'));var controller=require(_0xc903('0x7'));router[_0xc903('0x8')]('/',auth['isAuthenticated'](),controller[_0xc903('0x9')]);router[_0xc903('0x8')]('/:id',auth[_0xc903('0xa')](),controller[_0xc903('0xb')]);router[_0xc903('0x8')](_0xc903('0xc'),auth[_0xc903('0xa')](),controller[_0xc903('0xd')]);router[_0xc903('0x8')](_0xc903('0xe'),auth[_0xc903('0xa')](),controller[_0xc903('0xf')]);router[_0xc903('0x8')](_0xc903('0x10'),auth['isAuthenticated'](),controller[_0xc903('0x11')]);router[_0xc903('0x12')]('/',auth[_0xc903('0xa')](),controller[_0xc903('0x13')]);router[_0xc903('0x14')](_0xc903('0x15'),auth['isAuthenticated'](),controller[_0xc903('0x16')]);router[_0xc903('0x17')](_0xc903('0x15'),auth[_0xc903('0xa')](),controller[_0xc903('0x18')]);module[_0xc903('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index fd69b42..8745d0c 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 _0x6e08=['incident','phonecall','sequelize','exports','STRING','ENUM'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x6e08,0x98));var _0x86e0=function(_0x30a19c,_0x379a40){_0x30a19c=_0x30a19c-0x0;var _0x4f3f36=_0x6e08[_0x30a19c];return _0x4f3f36;};'use strict';var Sequelize=require(_0x86e0('0x0'));module[_0x86e0('0x1')]={'name':{'type':Sequelize[_0x86e0('0x2')]},'description':{'type':Sequelize[_0x86e0('0x2')]},'ticketType':{'type':Sequelize[_0x86e0('0x3')](_0x86e0('0x4'),_0x86e0('0x5')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xa2a6=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0x3b0745,_0x2876df){var _0x5e803a=function(_0x49f03e){while(--_0x49f03e){_0x3b0745['push'](_0x3b0745['shift']());}};_0x5e803a(++_0x2876df);}(_0xa2a6,0x1a3));var _0x6a2a=function(_0x3d7d94,_0x1e4085){_0x3d7d94=_0x3d7d94-0x0;var _0x2be24f=_0xa2a6[_0x3d7d94];return _0x2be24f;};'use strict';var Sequelize=require(_0x6a2a('0x0'));module[_0x6a2a('0x1')]={'name':{'type':Sequelize[_0x6a2a('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x6a2a('0x3')]('incident',_0x6a2a('0x4')),'defaultValue':_0x6a2a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 708e707..4136c90 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 _0x9c06=['fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','includeAll','find','create','body','params','getFields','findOne','getSubjects','getDescriptions','Dynamics365Field','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','Dynamics365Configuration','rawAttributes'];(function(_0x32bfc3,_0x1c7983){var _0xba5dd=function(_0x448c92){while(--_0x448c92){_0x32bfc3['push'](_0x32bfc3['shift']());}};_0xba5dd(++_0x1c7983);}(_0x9c06,0x7f));var _0x69c0=function(_0x4e0287,_0x3ef010){_0x4e0287=_0x4e0287-0x0;var _0x4caf29=_0x9c06[_0x4e0287];return _0x4caf29;};'use strict';var pdf=require(_0x69c0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x69c0('0x1'));var zipdir=require(_0x69c0('0x2'));var jsonpatch=require(_0x69c0('0x3'));var rp=require(_0x69c0('0x4'));var moment=require(_0x69c0('0x5'));var BPromise=require(_0x69c0('0x6'));var Mustache=require(_0x69c0('0x7'));var util=require('util');var path=require(_0x69c0('0x8'));var sox=require(_0x69c0('0x9'));var csv=require(_0x69c0('0xa'));var ejs=require(_0x69c0('0xb'));var fs=require('fs');var _=require(_0x69c0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x69c0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x69c0('0xa'));var querystring=require(_0x69c0('0xe'));var Papa=require(_0x69c0('0xf'));var Redis=require('ioredis');var authService=require(_0x69c0('0x10'));var qs=require(_0x69c0('0x11'));var as=require(_0x69c0('0x12'));var hardwareService=require(_0x69c0('0x13'));var logger=require(_0x69c0('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x69c0('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x69c0('0x16'));var client=jayson[_0x69c0('0x17')][_0x69c0('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3a45af,_0x55ca27,_0x11c65e,_0x1995b9){return new BPromise(function(_0xfab1d8,_0x362290){var _0x14b2fa=_0x1995b9||client;return _0x14b2fa[_0x69c0('0x19')](_0x3a45af,_0x11c65e)[_0x69c0('0x1a')](function(_0x3d4357){logger[_0x69c0('0x1b')](_0x69c0('0x1c'),_0x55ca27,'request\x20sent');logger[_0x69c0('0x1d')](_0x69c0('0x1e'),_0x55ca27,'request\x20sent',JSON[_0x69c0('0x1f')](_0x3d4357));if(_0x3d4357[_0x69c0('0x20')]){if(_0x3d4357['error'][_0x69c0('0x21')]===0x1f4){logger[_0x69c0('0x20')](_0x69c0('0x1c'),_0x55ca27,_0x3d4357[_0x69c0('0x20')][_0x69c0('0x22')]);return _0x362290(_0x3d4357[_0x69c0('0x20')][_0x69c0('0x22')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x55ca27,_0x3d4357[_0x69c0('0x20')]['message']);return _0xfab1d8(_0x3d4357['error']['message']);}else{logger[_0x69c0('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x55ca27,_0x69c0('0x23'));_0xfab1d8(_0x3d4357[_0x69c0('0x24')]['message']);}})[_0x69c0('0x25')](function(_0x1c02cc){logger[_0x69c0('0x20')](_0x69c0('0x1c'),_0x55ca27,_0x1c02cc);_0x362290(_0x1c02cc);});});}function respondWithStatusCode(_0x1788bc,_0x1b2158){_0x1b2158=_0x1b2158||0xcc;return function(_0x4bfb0c){if(_0x4bfb0c){return _0x1788bc['sendStatus'](_0x1b2158);}return _0x1788bc[_0x69c0('0x26')](_0x1b2158)['end']();};}function respondWithResult(_0x4200d2,_0xac093){_0xac093=_0xac093||0xc8;return function(_0x419f05){if(_0x419f05){return _0x4200d2[_0x69c0('0x26')](_0xac093)[_0x69c0('0x27')](_0x419f05);}};}function respondWithFilteredResult(_0x586732,_0x4adcf6){return function(_0x2bb20e){if(_0x2bb20e){var _0x30ebf8=_0x2bb20e[_0x69c0('0x28')],_0x42fe58=_0x4adcf6['offset'],_0x2dc697=_0x4adcf6[_0x69c0('0x29')]+_0x4adcf6[_0x69c0('0x2a')],_0x1fef99;if(_0x2dc697>=_0x30ebf8){_0x2dc697=_0x30ebf8;_0x1fef99=0xc8;}else{_0x1fef99=0xce;}_0x586732[_0x69c0('0x26')](_0x1fef99);return _0x586732[_0x69c0('0x2b')](_0x69c0('0x2c'),_0x42fe58+'-'+_0x2dc697+'/'+_0x30ebf8)['json'](_0x2bb20e);}return null;};}function patchUpdates(_0x4e7473){return function(_0x33e86e){try{jsonpatch[_0x69c0('0x2d')](_0x33e86e,_0x4e7473,!![]);}catch(_0x90a869){return BPromise[_0x69c0('0x2e')](_0x90a869);}return _0x33e86e[_0x69c0('0x2f')]();};}function saveUpdates(_0x10ddbb,_0x355258){return function(_0xcb9f2b){if(_0xcb9f2b){return _0xcb9f2b[_0x69c0('0x30')](_0x10ddbb)['then'](function(_0x18e2cc){return _0x18e2cc;});}return null;};}function removeEntity(_0x26b714,_0x338c32){return function(_0x17d816){if(_0x17d816){return _0x17d816[_0x69c0('0x31')]()['then'](function(){_0x26b714[_0x69c0('0x26')](0xcc)[_0x69c0('0x32')]();});}};}function handleEntityNotFound(_0x101a19,_0xffa4e6){return function(_0xf1a226){if(!_0xf1a226){_0x101a19[_0x69c0('0x33')](0x194);}return _0xf1a226;};}function handleError(_0x2016b0,_0x302625){_0x302625=_0x302625||0x1f4;return function(_0xb63836){logger[_0x69c0('0x20')](_0xb63836[_0x69c0('0x34')]);if(_0xb63836['name']){delete _0xb63836[_0x69c0('0x35')];}_0x2016b0[_0x69c0('0x26')](_0x302625)[_0x69c0('0x36')](_0xb63836);};}exports[_0x69c0('0x37')]=function(_0x33b3e0,_0x227ee){var _0x550ba0={},_0x5df66b={},_0x575da0={'count':0x0,'rows':[]};var _0xd20355=_[_0x69c0('0x38')](db[_0x69c0('0x39')][_0x69c0('0x3a')],function(_0x2cb6ae){return{'name':_0x2cb6ae[_0x69c0('0x3b')],'type':_0x2cb6ae['type'][_0x69c0('0x3c')]};});_0x5df66b['model']=_[_0x69c0('0x38')](_0xd20355,_0x69c0('0x35'));_0x5df66b[_0x69c0('0x3d')]=_[_0x69c0('0x3e')](_0x33b3e0['query']);_0x5df66b['filters']=_[_0x69c0('0x3f')](_0x5df66b[_0x69c0('0x40')],_0x5df66b[_0x69c0('0x3d')]);_0x550ba0[_0x69c0('0x41')]=_[_0x69c0('0x3f')](_0x5df66b['model'],qs[_0x69c0('0x42')](_0x33b3e0[_0x69c0('0x3d')][_0x69c0('0x42')]));_0x550ba0['attributes']=_0x550ba0['attributes'][_0x69c0('0x43')]?_0x550ba0['attributes']:_0x5df66b[_0x69c0('0x40')];if(!_0x33b3e0[_0x69c0('0x3d')][_0x69c0('0x44')](_0x69c0('0x45'))){_0x550ba0[_0x69c0('0x2a')]=qs[_0x69c0('0x2a')](_0x33b3e0[_0x69c0('0x3d')][_0x69c0('0x2a')]);_0x550ba0[_0x69c0('0x29')]=qs[_0x69c0('0x29')](_0x33b3e0['query']['offset']);}_0x550ba0[_0x69c0('0x46')]=qs[_0x69c0('0x47')](_0x33b3e0['query'][_0x69c0('0x47')]);_0x550ba0[_0x69c0('0x48')]=qs[_0x69c0('0x49')](_[_0x69c0('0x4a')](_0x33b3e0['query'],_0x5df66b[_0x69c0('0x49')]),_0xd20355);if(_0x33b3e0[_0x69c0('0x3d')][_0x69c0('0x4b')]){_0x550ba0['where']=_[_0x69c0('0x4c')](_0x550ba0[_0x69c0('0x48')],{'$or':_[_0x69c0('0x38')](_0xd20355,function(_0xe8c06e){if(_0xe8c06e[_0x69c0('0x4d')]!==_0x69c0('0x4e')){var _0x44cd1f={};_0x44cd1f[_0xe8c06e['name']]={'$like':'%'+_0x33b3e0[_0x69c0('0x3d')][_0x69c0('0x4b')]+'%'};return _0x44cd1f;}})});}_0x550ba0=_[_0x69c0('0x4c')]({},_0x550ba0,_0x33b3e0[_0x69c0('0x4f')]);var _0x388dec={'where':_0x550ba0[_0x69c0('0x48')]};return db[_0x69c0('0x39')][_0x69c0('0x28')](_0x388dec)['then'](function(_0x2c1b18){_0x575da0[_0x69c0('0x28')]=_0x2c1b18;if(_0x33b3e0[_0x69c0('0x3d')]['includeAll']){_0x550ba0[_0x69c0('0x50')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x69c0('0x51')](_0x550ba0);})['then'](function(_0x13a6ee){_0x575da0['rows']=_0x13a6ee;return _0x575da0;})[_0x69c0('0x1a')](respondWithFilteredResult(_0x227ee,_0x550ba0))[_0x69c0('0x25')](handleError(_0x227ee,null));};exports[_0x69c0('0x52')]=function(_0x17a024,_0x4d217d){var _0x2cc4ed={'raw':![],'where':{'id':_0x17a024['params']['id']}},_0x3503e3={};_0x3503e3[_0x69c0('0x40')]=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x3503e3[_0x69c0('0x3d')]=_['keys'](_0x17a024[_0x69c0('0x3d')]);_0x3503e3['filtears']=_[_0x69c0('0x3f')](_0x3503e3[_0x69c0('0x40')],_0x3503e3[_0x69c0('0x3d')]);_0x2cc4ed[_0x69c0('0x41')]=_['intersection'](_0x3503e3[_0x69c0('0x40')],qs[_0x69c0('0x42')](_0x17a024[_0x69c0('0x3d')][_0x69c0('0x42')]));_0x2cc4ed[_0x69c0('0x41')]=_0x2cc4ed[_0x69c0('0x41')][_0x69c0('0x43')]?_0x2cc4ed[_0x69c0('0x41')]:_0x3503e3[_0x69c0('0x40')];if(_0x17a024[_0x69c0('0x3d')][_0x69c0('0x53')]){_0x2cc4ed[_0x69c0('0x50')]=[{'all':!![]}];}_0x2cc4ed=_[_0x69c0('0x4c')]({},_0x2cc4ed,_0x17a024[_0x69c0('0x4f')]);return db[_0x69c0('0x39')][_0x69c0('0x54')](_0x2cc4ed)[_0x69c0('0x1a')](handleEntityNotFound(_0x4d217d,null))['then'](respondWithResult(_0x4d217d,null))['catch'](handleError(_0x4d217d,null));};exports['create']=function(_0x5e557c,_0x11e8f7){return db['Dynamics365Configuration'][_0x69c0('0x55')](_0x5e557c['body'],{})['then'](respondWithResult(_0x11e8f7,0xc9))[_0x69c0('0x25')](handleError(_0x11e8f7,null));};exports[_0x69c0('0x30')]=function(_0x4ab720,_0x4e848f){if(_0x4ab720[_0x69c0('0x56')]['id']){delete _0x4ab720[_0x69c0('0x56')]['id'];}return db[_0x69c0('0x39')][_0x69c0('0x54')]({'where':{'id':_0x4ab720[_0x69c0('0x57')]['id']}})[_0x69c0('0x1a')](handleEntityNotFound(_0x4e848f,null))['then'](saveUpdates(_0x4ab720[_0x69c0('0x56')],null))[_0x69c0('0x1a')](respondWithResult(_0x4e848f,null))[_0x69c0('0x25')](handleError(_0x4e848f,null));};exports[_0x69c0('0x31')]=function(_0x1f0183,_0x153f4e){return db['Dynamics365Configuration'][_0x69c0('0x54')]({'where':{'id':_0x1f0183[_0x69c0('0x57')]['id']}})['then'](handleEntityNotFound(_0x153f4e,null))[_0x69c0('0x1a')](removeEntity(_0x153f4e,null))[_0x69c0('0x25')](handleError(_0x153f4e,null));};exports[_0x69c0('0x58')]=function(_0x6b4d4f,_0x269c26,_0x3274dd){var _0x3eb888={};var _0x1c48c4={};var _0x404d13;var _0x286b98;return db[_0x69c0('0x39')]['findOne']({'where':{'id':_0x6b4d4f[_0x69c0('0x57')]['id']}})[_0x69c0('0x1a')](handleEntityNotFound(_0x269c26,null))[_0x69c0('0x1a')](function(_0x54f5fa){if(_0x54f5fa){_0x404d13=_0x54f5fa;_0x1c48c4[_0x69c0('0x40')]=_[_0x69c0('0x3e')](db['Dynamics365Field'][_0x69c0('0x3a')]);_0x1c48c4[_0x69c0('0x3d')]=_['keys'](_0x6b4d4f[_0x69c0('0x3d')]);_0x1c48c4[_0x69c0('0x49')]=_[_0x69c0('0x3f')](_0x1c48c4[_0x69c0('0x40')],_0x1c48c4[_0x69c0('0x3d')]);_0x3eb888[_0x69c0('0x41')]=_[_0x69c0('0x3f')](_0x1c48c4[_0x69c0('0x40')],qs['fields'](_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x42')]));_0x3eb888[_0x69c0('0x41')]=_0x3eb888[_0x69c0('0x41')][_0x69c0('0x43')]?_0x3eb888[_0x69c0('0x41')]:_0x1c48c4[_0x69c0('0x40')];_0x3eb888[_0x69c0('0x46')]=qs[_0x69c0('0x47')](_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x47')]);_0x3eb888['where']=qs[_0x69c0('0x49')](_[_0x69c0('0x4a')](_0x6b4d4f[_0x69c0('0x3d')],_0x1c48c4[_0x69c0('0x49')]));if(_0x6b4d4f['query'][_0x69c0('0x4b')]){_0x3eb888[_0x69c0('0x48')]=_[_0x69c0('0x4c')](_0x3eb888['where'],{'$or':_[_0x69c0('0x38')](_0x3eb888['attributes'],function(_0x5cccbb){var _0x3f6025={};_0x3f6025[_0x5cccbb]={'$like':'%'+_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x4b')]+'%'};return _0x3f6025;})});}_0x3eb888=_[_0x69c0('0x4c')]({},_0x3eb888,_0x6b4d4f[_0x69c0('0x4f')]);return _0x404d13['getFields'](_0x3eb888);}})[_0x69c0('0x1a')](function(_0x3e5c82){if(_0x3e5c82){_0x286b98=_0x3e5c82[_0x69c0('0x43')];if(!_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x44')](_0x69c0('0x45'))){_0x3eb888['limit']=qs[_0x69c0('0x2a')](_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x2a')]);_0x3eb888[_0x69c0('0x29')]=qs['offset'](_0x6b4d4f[_0x69c0('0x3d')][_0x69c0('0x29')]);}return _0x404d13['getFields'](_0x3eb888);}})[_0x69c0('0x1a')](function(_0x2855cc){if(_0x2855cc){return _0x2855cc?{'count':_0x286b98,'rows':_0x2855cc}:null;}})[_0x69c0('0x1a')](respondWithResult(_0x269c26,null))[_0x69c0('0x25')](handleError(_0x269c26,null));};exports['getSubjects']=function(_0xb28bbf,_0x27742d,_0xeaa799){var _0x57025d={};var _0x30bc07={};var _0xfeb583;var _0x4ad717;return db[_0x69c0('0x39')][_0x69c0('0x59')]({'where':{'id':_0xb28bbf[_0x69c0('0x57')]['id']}})[_0x69c0('0x1a')](handleEntityNotFound(_0x27742d,null))[_0x69c0('0x1a')](function(_0xe550e0){if(_0xe550e0){_0xfeb583=_0xe550e0;_0x30bc07['model']=_[_0x69c0('0x3e')](db['Dynamics365Field'][_0x69c0('0x3a')]);_0x30bc07[_0x69c0('0x3d')]=_[_0x69c0('0x3e')](_0xb28bbf[_0x69c0('0x3d')]);_0x30bc07['filters']=_[_0x69c0('0x3f')](_0x30bc07[_0x69c0('0x40')],_0x30bc07[_0x69c0('0x3d')]);_0x57025d[_0x69c0('0x41')]=_[_0x69c0('0x3f')](_0x30bc07[_0x69c0('0x40')],qs['fields'](_0xb28bbf['query'][_0x69c0('0x42')]));_0x57025d[_0x69c0('0x41')]=_0x57025d[_0x69c0('0x41')][_0x69c0('0x43')]?_0x57025d['attributes']:_0x30bc07[_0x69c0('0x40')];_0x57025d['order']=qs[_0x69c0('0x47')](_0xb28bbf[_0x69c0('0x3d')][_0x69c0('0x47')]);_0x57025d[_0x69c0('0x48')]=qs['filters'](_['pick'](_0xb28bbf[_0x69c0('0x3d')],_0x30bc07[_0x69c0('0x49')]));if(_0xb28bbf[_0x69c0('0x3d')]['filter']){_0x57025d[_0x69c0('0x48')]=_[_0x69c0('0x4c')](_0x57025d[_0x69c0('0x48')],{'$or':_[_0x69c0('0x38')](_0x57025d[_0x69c0('0x41')],function(_0x399c63){var _0x5a93b4={};_0x5a93b4[_0x399c63]={'$like':'%'+_0xb28bbf[_0x69c0('0x3d')]['filter']+'%'};return _0x5a93b4;})});}_0x57025d=_['merge']({},_0x57025d,_0xb28bbf[_0x69c0('0x4f')]);return _0xfeb583[_0x69c0('0x5a')](_0x57025d);}})[_0x69c0('0x1a')](function(_0x595b3a){if(_0x595b3a){_0x4ad717=_0x595b3a[_0x69c0('0x43')];if(!_0xb28bbf[_0x69c0('0x3d')][_0x69c0('0x44')](_0x69c0('0x45'))){_0x57025d[_0x69c0('0x2a')]=qs[_0x69c0('0x2a')](_0xb28bbf['query']['limit']);_0x57025d[_0x69c0('0x29')]=qs[_0x69c0('0x29')](_0xb28bbf['query']['offset']);}return _0xfeb583['getSubjects'](_0x57025d);}})[_0x69c0('0x1a')](function(_0x45f1f0){if(_0x45f1f0){return _0x45f1f0?{'count':_0x4ad717,'rows':_0x45f1f0}:null;}})['then'](respondWithResult(_0x27742d,null))['catch'](handleError(_0x27742d,null));};exports[_0x69c0('0x5b')]=function(_0x1c56a8,_0x55fdef,_0x3218a7){var _0x2d7ae0={};var _0x22ed09={};var _0x433dca;var _0x911d3c;return db[_0x69c0('0x39')]['findOne']({'where':{'id':_0x1c56a8[_0x69c0('0x57')]['id']}})['then'](handleEntityNotFound(_0x55fdef,null))[_0x69c0('0x1a')](function(_0x1a2340){if(_0x1a2340){_0x433dca=_0x1a2340;_0x22ed09[_0x69c0('0x40')]=_['keys'](db[_0x69c0('0x5c')][_0x69c0('0x3a')]);_0x22ed09['query']=_[_0x69c0('0x3e')](_0x1c56a8['query']);_0x22ed09[_0x69c0('0x49')]=_[_0x69c0('0x3f')](_0x22ed09['model'],_0x22ed09['query']);_0x2d7ae0['attributes']=_[_0x69c0('0x3f')](_0x22ed09[_0x69c0('0x40')],qs[_0x69c0('0x42')](_0x1c56a8['query'][_0x69c0('0x42')]));_0x2d7ae0['attributes']=_0x2d7ae0[_0x69c0('0x41')]['length']?_0x2d7ae0[_0x69c0('0x41')]:_0x22ed09[_0x69c0('0x40')];_0x2d7ae0[_0x69c0('0x46')]=qs['sort'](_0x1c56a8['query'][_0x69c0('0x47')]);_0x2d7ae0[_0x69c0('0x48')]=qs[_0x69c0('0x49')](_[_0x69c0('0x4a')](_0x1c56a8[_0x69c0('0x3d')],_0x22ed09[_0x69c0('0x49')]));if(_0x1c56a8['query'][_0x69c0('0x4b')]){_0x2d7ae0[_0x69c0('0x48')]=_[_0x69c0('0x4c')](_0x2d7ae0['where'],{'$or':_[_0x69c0('0x38')](_0x2d7ae0[_0x69c0('0x41')],function(_0xd86a39){var _0x5023d6={};_0x5023d6[_0xd86a39]={'$like':'%'+_0x1c56a8[_0x69c0('0x3d')][_0x69c0('0x4b')]+'%'};return _0x5023d6;})});}_0x2d7ae0=_[_0x69c0('0x4c')]({},_0x2d7ae0,_0x1c56a8[_0x69c0('0x4f')]);return _0x433dca[_0x69c0('0x5b')](_0x2d7ae0);}})['then'](function(_0xc27dd9){if(_0xc27dd9){_0x911d3c=_0xc27dd9[_0x69c0('0x43')];if(!_0x1c56a8[_0x69c0('0x3d')][_0x69c0('0x44')](_0x69c0('0x45'))){_0x2d7ae0[_0x69c0('0x2a')]=qs[_0x69c0('0x2a')](_0x1c56a8[_0x69c0('0x3d')][_0x69c0('0x2a')]);_0x2d7ae0[_0x69c0('0x29')]=qs[_0x69c0('0x29')](_0x1c56a8[_0x69c0('0x3d')][_0x69c0('0x29')]);}return _0x433dca[_0x69c0('0x5b')](_0x2d7ae0);}})['then'](function(_0x267c93){if(_0x267c93){return _0x267c93?{'count':_0x911d3c,'rows':_0x267c93}:null;}})['then'](respondWithResult(_0x55fdef,null))[_0x69c0('0x25')](handleError(_0x55fdef,null));}; \ No newline at end of file +var _0x968f=['filter','type','VIRTUAL','merge','options','includeAll','findAll','show','params','filtears','include','find','create','body','findOne','length','getFields','order','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','send','index','map','Dynamics365Configuration','rawAttributes','key','model','name','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','pick'];(function(_0x1f0855,_0x23899d){var _0x49b507=function(_0x4a3521){while(--_0x4a3521){_0x1f0855['push'](_0x1f0855['shift']());}};_0x49b507(++_0x23899d);}(_0x968f,0x1eb));var _0xf968=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x968f[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf968('0x0'));var rimraf=require(_0xf968('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf968('0x2'));var rp=require(_0xf968('0x3'));var moment=require(_0xf968('0x4'));var BPromise=require(_0xf968('0x5'));var Mustache=require('mustache');var util=require(_0xf968('0x6'));var path=require(_0xf968('0x7'));var sox=require(_0xf968('0x8'));var csv=require(_0xf968('0x9'));var ejs=require(_0xf968('0xa'));var fs=require('fs');var _=require(_0xf968('0xb'));var squel=require('squel');var crypto=require(_0xf968('0xc'));var jsforce=require(_0xf968('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf968('0x9'));var querystring=require(_0xf968('0xe'));var Papa=require(_0xf968('0xf'));var Redis=require(_0xf968('0x10'));var authService=require(_0xf968('0x11'));var qs=require(_0xf968('0x12'));var as=require(_0xf968('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf968('0x14'))(_0xf968('0x15'));var utils=require(_0xf968('0x16'));var config=require(_0xf968('0x17'));var licenseUtil=require(_0xf968('0x18'));var db=require(_0xf968('0x19'))['db'];var jayson=require(_0xf968('0x1a'));var client=jayson[_0xf968('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9b37,_0x4a1661,_0x4b7be6,_0x2213ae){return new BPromise(function(_0x56750f,_0x1edf73){var _0x620445=_0x2213ae||client;return _0x620445[_0xf968('0x1c')](_0x2c9b37,_0x4b7be6)['then'](function(_0x2ece2b){logger[_0xf968('0x1d')](_0xf968('0x1e'),_0x4a1661,_0xf968('0x1f'));logger[_0xf968('0x20')](_0xf968('0x21'),_0x4a1661,_0xf968('0x1f'),JSON[_0xf968('0x22')](_0x2ece2b));if(_0x2ece2b[_0xf968('0x23')]){if(_0x2ece2b[_0xf968('0x23')][_0xf968('0x24')]===0x1f4){logger[_0xf968('0x23')](_0xf968('0x1e'),_0x4a1661,_0x2ece2b['error'][_0xf968('0x25')]);return _0x1edf73(_0x2ece2b[_0xf968('0x23')][_0xf968('0x25')]);}logger[_0xf968('0x23')](_0xf968('0x1e'),_0x4a1661,_0x2ece2b[_0xf968('0x23')][_0xf968('0x25')]);return _0x56750f(_0x2ece2b['error'][_0xf968('0x25')]);}else{logger[_0xf968('0x1d')](_0xf968('0x1e'),_0x4a1661,_0xf968('0x1f'));_0x56750f(_0x2ece2b[_0xf968('0x26')][_0xf968('0x25')]);}})[_0xf968('0x27')](function(_0x1d312b){logger['error'](_0xf968('0x1e'),_0x4a1661,_0x1d312b);_0x1edf73(_0x1d312b);});});}function respondWithStatusCode(_0x10eff6,_0x54cc9d){_0x54cc9d=_0x54cc9d||0xcc;return function(_0x447a15){if(_0x447a15){return _0x10eff6[_0xf968('0x28')](_0x54cc9d);}return _0x10eff6[_0xf968('0x29')](_0x54cc9d)['end']();};}function respondWithResult(_0x3ccc2c,_0x21e760){_0x21e760=_0x21e760||0xc8;return function(_0x41a6c6){if(_0x41a6c6){return _0x3ccc2c['status'](_0x21e760)[_0xf968('0x2a')](_0x41a6c6);}};}function respondWithFilteredResult(_0x184a41,_0x7814fb){return function(_0x2c5ab4){if(_0x2c5ab4){var _0x2012a9=_0x2c5ab4[_0xf968('0x2b')],_0x2d9305=_0x7814fb['offset'],_0x283903=_0x7814fb[_0xf968('0x2c')]+_0x7814fb['limit'],_0xc4455a;if(_0x283903>=_0x2012a9){_0x283903=_0x2012a9;_0xc4455a=0xc8;}else{_0xc4455a=0xce;}_0x184a41[_0xf968('0x29')](_0xc4455a);return _0x184a41[_0xf968('0x2d')](_0xf968('0x2e'),_0x2d9305+'-'+_0x283903+'/'+_0x2012a9)[_0xf968('0x2a')](_0x2c5ab4);}return null;};}function patchUpdates(_0x2d5c86){return function(_0x253a08){try{jsonpatch[_0xf968('0x2f')](_0x253a08,_0x2d5c86,!![]);}catch(_0x5e7689){return BPromise[_0xf968('0x30')](_0x5e7689);}return _0x253a08[_0xf968('0x31')]();};}function saveUpdates(_0x14f615,_0x43b72e){return function(_0x48acc3){if(_0x48acc3){return _0x48acc3[_0xf968('0x32')](_0x14f615)['then'](function(_0x34bdba){return _0x34bdba;});}return null;};}function removeEntity(_0x52068e,_0x53eeb6){return function(_0x44a10b){if(_0x44a10b){return _0x44a10b[_0xf968('0x33')]()[_0xf968('0x34')](function(){_0x52068e[_0xf968('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11992e,_0x4391cd){return function(_0x3479e0){if(!_0x3479e0){_0x11992e[_0xf968('0x28')](0x194);}return _0x3479e0;};}function handleError(_0x291ca2,_0x2568bb){_0x2568bb=_0x2568bb||0x1f4;return function(_0x224751){logger[_0xf968('0x23')](_0x224751['stack']);if(_0x224751['name']){delete _0x224751['name'];}_0x291ca2['status'](_0x2568bb)[_0xf968('0x35')](_0x224751);};}exports[_0xf968('0x36')]=function(_0x1f250f,_0x4dbaa3){var _0x24a53d={},_0x26f5bc={},_0x18c909={'count':0x0,'rows':[]};var _0x48a401=_[_0xf968('0x37')](db[_0xf968('0x38')][_0xf968('0x39')],function(_0x46a820){return{'name':_0x46a820['fieldName'],'type':_0x46a820['type'][_0xf968('0x3a')]};});_0x26f5bc[_0xf968('0x3b')]=_[_0xf968('0x37')](_0x48a401,_0xf968('0x3c'));_0x26f5bc['query']=_[_0xf968('0x3d')](_0x1f250f[_0xf968('0x3e')]);_0x26f5bc['filters']=_['intersection'](_0x26f5bc[_0xf968('0x3b')],_0x26f5bc[_0xf968('0x3e')]);_0x24a53d['attributes']=_[_0xf968('0x3f')](_0x26f5bc[_0xf968('0x3b')],qs['fields'](_0x1f250f[_0xf968('0x3e')][_0xf968('0x40')]));_0x24a53d[_0xf968('0x41')]=_0x24a53d[_0xf968('0x41')]['length']?_0x24a53d[_0xf968('0x41')]:_0x26f5bc[_0xf968('0x3b')];if(!_0x1f250f[_0xf968('0x3e')][_0xf968('0x42')](_0xf968('0x43'))){_0x24a53d[_0xf968('0x44')]=qs[_0xf968('0x44')](_0x1f250f[_0xf968('0x3e')]['limit']);_0x24a53d[_0xf968('0x2c')]=qs[_0xf968('0x2c')](_0x1f250f[_0xf968('0x3e')][_0xf968('0x2c')]);}_0x24a53d['order']=qs[_0xf968('0x45')](_0x1f250f[_0xf968('0x3e')][_0xf968('0x45')]);_0x24a53d[_0xf968('0x46')]=qs[_0xf968('0x47')](_[_0xf968('0x48')](_0x1f250f['query'],_0x26f5bc[_0xf968('0x47')]),_0x48a401);if(_0x1f250f[_0xf968('0x3e')][_0xf968('0x49')]){_0x24a53d[_0xf968('0x46')]=_['merge'](_0x24a53d[_0xf968('0x46')],{'$or':_[_0xf968('0x37')](_0x48a401,function(_0x500eec){if(_0x500eec[_0xf968('0x4a')]!==_0xf968('0x4b')){var _0x3b850d={};_0x3b850d[_0x500eec[_0xf968('0x3c')]]={'$like':'%'+_0x1f250f['query'][_0xf968('0x49')]+'%'};return _0x3b850d;}})});}_0x24a53d=_[_0xf968('0x4c')]({},_0x24a53d,_0x1f250f[_0xf968('0x4d')]);var _0x450924={'where':_0x24a53d[_0xf968('0x46')]};return db['Dynamics365Configuration'][_0xf968('0x2b')](_0x450924)[_0xf968('0x34')](function(_0x2fdc8b){_0x18c909[_0xf968('0x2b')]=_0x2fdc8b;if(_0x1f250f[_0xf968('0x3e')][_0xf968('0x4e')]){_0x24a53d['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf968('0x4f')](_0x24a53d);})[_0xf968('0x34')](function(_0x133e68){_0x18c909['rows']=_0x133e68;return _0x18c909;})[_0xf968('0x34')](respondWithFilteredResult(_0x4dbaa3,_0x24a53d))[_0xf968('0x27')](handleError(_0x4dbaa3,null));};exports[_0xf968('0x50')]=function(_0x46665a,_0x2c5d6b){var _0x54667f={'raw':![],'where':{'id':_0x46665a[_0xf968('0x51')]['id']}},_0x476d04={};_0x476d04[_0xf968('0x3b')]=_['keys'](db[_0xf968('0x38')][_0xf968('0x39')]);_0x476d04[_0xf968('0x3e')]=_[_0xf968('0x3d')](_0x46665a[_0xf968('0x3e')]);_0x476d04[_0xf968('0x52')]=_[_0xf968('0x3f')](_0x476d04[_0xf968('0x3b')],_0x476d04[_0xf968('0x3e')]);_0x54667f[_0xf968('0x41')]=_[_0xf968('0x3f')](_0x476d04[_0xf968('0x3b')],qs['fields'](_0x46665a[_0xf968('0x3e')][_0xf968('0x40')]));_0x54667f[_0xf968('0x41')]=_0x54667f[_0xf968('0x41')]['length']?_0x54667f[_0xf968('0x41')]:_0x476d04['model'];if(_0x46665a[_0xf968('0x3e')][_0xf968('0x4e')]){_0x54667f[_0xf968('0x53')]=[{'all':!![]}];}_0x54667f=_[_0xf968('0x4c')]({},_0x54667f,_0x46665a['options']);return db[_0xf968('0x38')][_0xf968('0x54')](_0x54667f)[_0xf968('0x34')](handleEntityNotFound(_0x2c5d6b,null))[_0xf968('0x34')](respondWithResult(_0x2c5d6b,null))[_0xf968('0x27')](handleError(_0x2c5d6b,null));};exports[_0xf968('0x55')]=function(_0x1975f4,_0x49d3f0){return db['Dynamics365Configuration'][_0xf968('0x55')](_0x1975f4[_0xf968('0x56')],{})[_0xf968('0x34')](respondWithResult(_0x49d3f0,0xc9))[_0xf968('0x27')](handleError(_0x49d3f0,null));};exports[_0xf968('0x32')]=function(_0x52d386,_0x3dcebf){if(_0x52d386['body']['id']){delete _0x52d386[_0xf968('0x56')]['id'];}return db['Dynamics365Configuration'][_0xf968('0x54')]({'where':{'id':_0x52d386[_0xf968('0x51')]['id']}})['then'](handleEntityNotFound(_0x3dcebf,null))['then'](saveUpdates(_0x52d386[_0xf968('0x56')],null))[_0xf968('0x34')](respondWithResult(_0x3dcebf,null))['catch'](handleError(_0x3dcebf,null));};exports[_0xf968('0x33')]=function(_0x1c6fe9,_0x54bb0e){return db[_0xf968('0x38')][_0xf968('0x54')]({'where':{'id':_0x1c6fe9[_0xf968('0x51')]['id']}})[_0xf968('0x34')](handleEntityNotFound(_0x54bb0e,null))[_0xf968('0x34')](removeEntity(_0x54bb0e,null))[_0xf968('0x27')](handleError(_0x54bb0e,null));};exports['getFields']=function(_0x1a5656,_0x5d2121,_0x593dbb){var _0x5e6787={};var _0x48bbea={};var _0x78e92;var _0x20e251;return db[_0xf968('0x38')][_0xf968('0x57')]({'where':{'id':_0x1a5656[_0xf968('0x51')]['id']}})[_0xf968('0x34')](handleEntityNotFound(_0x5d2121,null))[_0xf968('0x34')](function(_0x2f1b10){if(_0x2f1b10){_0x78e92=_0x2f1b10;_0x48bbea[_0xf968('0x3b')]=_[_0xf968('0x3d')](db['Dynamics365Field'][_0xf968('0x39')]);_0x48bbea[_0xf968('0x3e')]=_[_0xf968('0x3d')](_0x1a5656[_0xf968('0x3e')]);_0x48bbea[_0xf968('0x47')]=_['intersection'](_0x48bbea['model'],_0x48bbea['query']);_0x5e6787[_0xf968('0x41')]=_[_0xf968('0x3f')](_0x48bbea['model'],qs[_0xf968('0x40')](_0x1a5656[_0xf968('0x3e')]['fields']));_0x5e6787[_0xf968('0x41')]=_0x5e6787[_0xf968('0x41')][_0xf968('0x58')]?_0x5e6787[_0xf968('0x41')]:_0x48bbea[_0xf968('0x3b')];_0x5e6787['order']=qs['sort'](_0x1a5656['query'][_0xf968('0x45')]);_0x5e6787[_0xf968('0x46')]=qs[_0xf968('0x47')](_[_0xf968('0x48')](_0x1a5656[_0xf968('0x3e')],_0x48bbea[_0xf968('0x47')]));if(_0x1a5656['query'][_0xf968('0x49')]){_0x5e6787[_0xf968('0x46')]=_[_0xf968('0x4c')](_0x5e6787[_0xf968('0x46')],{'$or':_[_0xf968('0x37')](_0x5e6787[_0xf968('0x41')],function(_0x53afe3){var _0x2a5737={};_0x2a5737[_0x53afe3]={'$like':'%'+_0x1a5656['query'][_0xf968('0x49')]+'%'};return _0x2a5737;})});}_0x5e6787=_[_0xf968('0x4c')]({},_0x5e6787,_0x1a5656[_0xf968('0x4d')]);return _0x78e92[_0xf968('0x59')](_0x5e6787);}})['then'](function(_0x357d5f){if(_0x357d5f){_0x20e251=_0x357d5f[_0xf968('0x58')];if(!_0x1a5656['query'][_0xf968('0x42')]('nolimit')){_0x5e6787[_0xf968('0x44')]=qs[_0xf968('0x44')](_0x1a5656[_0xf968('0x3e')]['limit']);_0x5e6787[_0xf968('0x2c')]=qs['offset'](_0x1a5656[_0xf968('0x3e')][_0xf968('0x2c')]);}return _0x78e92[_0xf968('0x59')](_0x5e6787);}})[_0xf968('0x34')](function(_0x2f39f8){if(_0x2f39f8){return _0x2f39f8?{'count':_0x20e251,'rows':_0x2f39f8}:null;}})[_0xf968('0x34')](respondWithResult(_0x5d2121,null))[_0xf968('0x27')](handleError(_0x5d2121,null));};exports['getSubjects']=function(_0x251fb8,_0x52967f,_0x11ec4c){var _0x184f4c={};var _0x26bba3={};var _0x7ac666;var _0x372d58;return db['Dynamics365Configuration'][_0xf968('0x57')]({'where':{'id':_0x251fb8[_0xf968('0x51')]['id']}})[_0xf968('0x34')](handleEntityNotFound(_0x52967f,null))['then'](function(_0xec23cb){if(_0xec23cb){_0x7ac666=_0xec23cb;_0x26bba3[_0xf968('0x3b')]=_[_0xf968('0x3d')](db['Dynamics365Field']['rawAttributes']);_0x26bba3['query']=_[_0xf968('0x3d')](_0x251fb8[_0xf968('0x3e')]);_0x26bba3[_0xf968('0x47')]=_[_0xf968('0x3f')](_0x26bba3['model'],_0x26bba3[_0xf968('0x3e')]);_0x184f4c[_0xf968('0x41')]=_[_0xf968('0x3f')](_0x26bba3[_0xf968('0x3b')],qs[_0xf968('0x40')](_0x251fb8[_0xf968('0x3e')][_0xf968('0x40')]));_0x184f4c[_0xf968('0x41')]=_0x184f4c[_0xf968('0x41')][_0xf968('0x58')]?_0x184f4c[_0xf968('0x41')]:_0x26bba3['model'];_0x184f4c[_0xf968('0x5a')]=qs[_0xf968('0x45')](_0x251fb8[_0xf968('0x3e')][_0xf968('0x45')]);_0x184f4c['where']=qs[_0xf968('0x47')](_[_0xf968('0x48')](_0x251fb8[_0xf968('0x3e')],_0x26bba3[_0xf968('0x47')]));if(_0x251fb8['query'][_0xf968('0x49')]){_0x184f4c[_0xf968('0x46')]=_[_0xf968('0x4c')](_0x184f4c[_0xf968('0x46')],{'$or':_[_0xf968('0x37')](_0x184f4c['attributes'],function(_0x53ec0c){var _0x27e7eb={};_0x27e7eb[_0x53ec0c]={'$like':'%'+_0x251fb8[_0xf968('0x3e')][_0xf968('0x49')]+'%'};return _0x27e7eb;})});}_0x184f4c=_[_0xf968('0x4c')]({},_0x184f4c,_0x251fb8[_0xf968('0x4d')]);return _0x7ac666[_0xf968('0x5b')](_0x184f4c);}})[_0xf968('0x34')](function(_0x37f649){if(_0x37f649){_0x372d58=_0x37f649[_0xf968('0x58')];if(!_0x251fb8[_0xf968('0x3e')][_0xf968('0x42')](_0xf968('0x43'))){_0x184f4c[_0xf968('0x44')]=qs[_0xf968('0x44')](_0x251fb8[_0xf968('0x3e')][_0xf968('0x44')]);_0x184f4c['offset']=qs[_0xf968('0x2c')](_0x251fb8[_0xf968('0x3e')][_0xf968('0x2c')]);}return _0x7ac666[_0xf968('0x5b')](_0x184f4c);}})[_0xf968('0x34')](function(_0x57c434){if(_0x57c434){return _0x57c434?{'count':_0x372d58,'rows':_0x57c434}:null;}})['then'](respondWithResult(_0x52967f,null))[_0xf968('0x27')](handleError(_0x52967f,null));};exports[_0xf968('0x5c')]=function(_0x197052,_0x5d771d,_0x35a8aa){var _0x18f876={};var _0x56105b={};var _0x202083;var _0x38eb6e;return db[_0xf968('0x38')][_0xf968('0x57')]({'where':{'id':_0x197052['params']['id']}})['then'](handleEntityNotFound(_0x5d771d,null))['then'](function(_0x29e1d5){if(_0x29e1d5){_0x202083=_0x29e1d5;_0x56105b[_0xf968('0x3b')]=_['keys'](db[_0xf968('0x5d')][_0xf968('0x39')]);_0x56105b[_0xf968('0x3e')]=_[_0xf968('0x3d')](_0x197052['query']);_0x56105b['filters']=_[_0xf968('0x3f')](_0x56105b[_0xf968('0x3b')],_0x56105b[_0xf968('0x3e')]);_0x18f876['attributes']=_[_0xf968('0x3f')](_0x56105b[_0xf968('0x3b')],qs[_0xf968('0x40')](_0x197052[_0xf968('0x3e')][_0xf968('0x40')]));_0x18f876['attributes']=_0x18f876[_0xf968('0x41')][_0xf968('0x58')]?_0x18f876[_0xf968('0x41')]:_0x56105b[_0xf968('0x3b')];_0x18f876[_0xf968('0x5a')]=qs[_0xf968('0x45')](_0x197052['query'][_0xf968('0x45')]);_0x18f876['where']=qs[_0xf968('0x47')](_[_0xf968('0x48')](_0x197052[_0xf968('0x3e')],_0x56105b[_0xf968('0x47')]));if(_0x197052[_0xf968('0x3e')][_0xf968('0x49')]){_0x18f876['where']=_['merge'](_0x18f876[_0xf968('0x46')],{'$or':_[_0xf968('0x37')](_0x18f876['attributes'],function(_0x223d82){var _0x321621={};_0x321621[_0x223d82]={'$like':'%'+_0x197052[_0xf968('0x3e')][_0xf968('0x49')]+'%'};return _0x321621;})});}_0x18f876=_[_0xf968('0x4c')]({},_0x18f876,_0x197052[_0xf968('0x4d')]);return _0x202083['getDescriptions'](_0x18f876);}})[_0xf968('0x34')](function(_0x3d5e58){if(_0x3d5e58){_0x38eb6e=_0x3d5e58[_0xf968('0x58')];if(!_0x197052['query'][_0xf968('0x42')]('nolimit')){_0x18f876[_0xf968('0x44')]=qs[_0xf968('0x44')](_0x197052[_0xf968('0x3e')][_0xf968('0x44')]);_0x18f876[_0xf968('0x2c')]=qs[_0xf968('0x2c')](_0x197052[_0xf968('0x3e')]['offset']);}return _0x202083[_0xf968('0x5c')](_0x18f876);}})['then'](function(_0x4b7b52){if(_0x4b7b52){return _0x4b7b52?{'count':_0x38eb6e,'rows':_0x4b7b52}:null;}})[_0xf968('0x34')](respondWithResult(_0x5d771d,null))[_0xf968('0x27')](handleError(_0x5d771d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 1ef2caf..73b98d6 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 _0x5e8a=['rimraf','exports','define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x5e8a,0x1c7));var _0xa5e8=function(_0x20d41d,_0x3b8076){_0x20d41d=_0x20d41d-0x0;var _0x3d8518=_0x5e8a[_0x20d41d];return _0x3d8518;};'use strict';var _=require(_0xa5e8('0x0'));var util=require(_0xa5e8('0x1'));var logger=require(_0xa5e8('0x2'))(_0xa5e8('0x3'));var moment=require(_0xa5e8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5e8('0x5'));var fs=require('fs');var path=require(_0xa5e8('0x6'));var rimraf=require(_0xa5e8('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0xa5e8('0x8')]=function(_0x61f6e,_0x175b47){return _0x61f6e[_0xa5e8('0x9')]('Dynamics365Configuration',attributes,{'tableName':_0xa5e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f75=['path','rimraf','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6f75,0x1b2));var _0x56f7=function(_0x16ead3,_0x3c4810){_0x16ead3=_0x16ead3-0x0;var _0x4a82df=_0x6f75[_0x16ead3];return _0x4a82df;};'use strict';var _=require(_0x56f7('0x0'));var util=require('util');var logger=require(_0x56f7('0x1'))(_0x56f7('0x2'));var moment=require(_0x56f7('0x3'));var BPromise=require(_0x56f7('0x4'));var rp=require(_0x56f7('0x5'));var fs=require('fs');var path=require(_0x56f7('0x6'));var rimraf=require(_0x56f7('0x7'));var config=require('../../config/environment');var attributes=require(_0x56f7('0x8'));module['exports']=function(_0x4a43d4,_0x2ba4cf){return _0x4a43d4['define']('Dynamics365Configuration',attributes,{'tableName':_0x56f7('0x9'),'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 9823016..3399ddc 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 _0x3d8c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xd10919,_0x2d66ab){var _0x3e88f4=function(_0x32dbae){while(--_0x32dbae){_0xd10919['push'](_0xd10919['shift']());}};_0x3e88f4(++_0x2d66ab);}(_0x3d8c,0x110));var _0xc3d8=function(_0x580cf8,_0x26751e){_0x580cf8=_0x580cf8-0x0;var _0xcc9a9e=_0x3d8c[_0x580cf8];return _0xcc9a9e;};'use strict';var _=require(_0xc3d8('0x0'));var util=require(_0xc3d8('0x1'));var moment=require(_0xc3d8('0x2'));var BPromise=require(_0xc3d8('0x3'));var rs=require(_0xc3d8('0x4'));var fs=require('fs');var Redis=require(_0xc3d8('0x5'));var db=require(_0xc3d8('0x6'))['db'];var utils=require(_0xc3d8('0x7'));var logger=require('../../config/logger')(_0xc3d8('0x8'));var config=require(_0xc3d8('0x9'));var jayson=require(_0xc3d8('0xa'));var client=jayson['client'][_0xc3d8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b9e4a,_0x40d50e,_0x2a1a4b){return new BPromise(function(_0x22dee5,_0x2cf223){return client[_0xc3d8('0xc')](_0x4b9e4a,_0x2a1a4b)[_0xc3d8('0xd')](function(_0x39c739){logger[_0xc3d8('0xe')](_0xc3d8('0xf'),_0x40d50e,_0xc3d8('0x10'));logger[_0xc3d8('0x11')](_0xc3d8('0x12'),_0x40d50e,_0xc3d8('0x10'),JSON[_0xc3d8('0x13')](_0x39c739));if(_0x39c739[_0xc3d8('0x14')]){if(_0x39c739[_0xc3d8('0x14')][_0xc3d8('0x15')]===0x1f4){logger[_0xc3d8('0x14')](_0xc3d8('0xf'),_0x40d50e,_0x39c739['error'][_0xc3d8('0x16')]);return _0x2cf223(_0x39c739[_0xc3d8('0x14')][_0xc3d8('0x16')]);}logger[_0xc3d8('0x14')](_0xc3d8('0xf'),_0x40d50e,_0x39c739[_0xc3d8('0x14')]['message']);return _0x22dee5(_0x39c739['error'][_0xc3d8('0x16')]);}else{logger[_0xc3d8('0xe')](_0xc3d8('0xf'),_0x40d50e,_0xc3d8('0x10'));_0x22dee5(_0x39c739[_0xc3d8('0x17')][_0xc3d8('0x16')]);}})[_0xc3d8('0x18')](function(_0x1ddeb2){logger[_0xc3d8('0x14')](_0xc3d8('0xf'),_0x40d50e,_0x1ddeb2);_0x2cf223(_0x1ddeb2);});});} \ No newline at end of file +var _0x1591=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x40966,_0xa0f9a2){var _0x109c68=function(_0x56445a){while(--_0x56445a){_0x40966['push'](_0x40966['shift']());}};_0x109c68(++_0xa0f9a2);}(_0x1591,0x9f));var _0x1159=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x1591[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x1159('0x0'));var util=require(_0x1159('0x1'));var moment=require(_0x1159('0x2'));var BPromise=require(_0x1159('0x3'));var rs=require(_0x1159('0x4'));var fs=require('fs');var Redis=require(_0x1159('0x5'));var db=require(_0x1159('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1159('0x7'));var jayson=require(_0x1159('0x8'));var client=jayson[_0x1159('0x9')][_0x1159('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bd0ba,_0x5b1664,_0x29bb96){return new BPromise(function(_0x1a0390,_0x187065){return client[_0x1159('0xb')](_0x1bd0ba,_0x29bb96)[_0x1159('0xc')](function(_0x466e82){logger['info'](_0x1159('0xd'),_0x5b1664,_0x1159('0xe'));logger[_0x1159('0xf')](_0x1159('0x10'),_0x5b1664,_0x1159('0xe'),JSON[_0x1159('0x11')](_0x466e82));if(_0x466e82['error']){if(_0x466e82[_0x1159('0x12')][_0x1159('0x13')]===0x1f4){logger[_0x1159('0x12')](_0x1159('0xd'),_0x5b1664,_0x466e82[_0x1159('0x12')][_0x1159('0x14')]);return _0x187065(_0x466e82[_0x1159('0x12')][_0x1159('0x14')]);}logger[_0x1159('0x12')](_0x1159('0xd'),_0x5b1664,_0x466e82[_0x1159('0x12')]['message']);return _0x1a0390(_0x466e82[_0x1159('0x12')]['message']);}else{logger['info'](_0x1159('0xd'),_0x5b1664,_0x1159('0xe'));_0x1a0390(_0x466e82[_0x1159('0x15')][_0x1159('0x14')]);}})['catch'](function(_0x265ff3){logger[_0x1159('0x12')](_0x1159('0xd'),_0x5b1664,_0x265ff3);_0x187065(_0x265ff3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 06f0d77..0adbb1f 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x582b0f,_0x35a9de){var _0x4658f0=function(_0x106924){while(--_0x106924){_0x582b0f['push'](_0x582b0f['shift']());}};_0x4658f0(++_0x35a9de);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'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('./intDynamics365Field.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 +var _0x16d2=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x32664d,_0x340941){var _0x2564d8=function(_0x295f9f){while(--_0x295f9f){_0x32664d['push'](_0x32664d['shift']());}};_0x2564d8(++_0x340941);}(_0x16d2,0x123));var _0x216d=function(_0x203b5c,_0x2384f1){_0x203b5c=_0x203b5c-0x0;var _0x20a057=_0x16d2[_0x203b5c];return _0x20a057;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var auth=require(_0x216d('0x6'));var interaction=require(_0x216d('0x7'));var config=require(_0x216d('0x8'));var controller=require('./intDynamics365Field.controller');router[_0x216d('0x9')]('/',auth[_0x216d('0xa')](),controller[_0x216d('0xb')]);router[_0x216d('0x9')](_0x216d('0xc'),auth[_0x216d('0xa')](),controller[_0x216d('0xd')]);router[_0x216d('0xe')]('/',auth['isAuthenticated'](),controller[_0x216d('0xf')]);router[_0x216d('0x10')](_0x216d('0xc'),auth[_0x216d('0xa')](),controller[_0x216d('0x11')]);router[_0x216d('0x12')]('/:id',auth[_0x216d('0xa')](),controller['destroy']);module[_0x216d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2c4333e..54fe722 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 _0x3069=['customVariable','keyValue','STRING','ENUM','variable','BOOLEAN','sequelize','string'];(function(_0x21a5f6,_0x1f28aa){var _0x1b0466=function(_0x321fc2){while(--_0x321fc2){_0x21a5f6['push'](_0x21a5f6['shift']());}};_0x1b0466(++_0x1f28aa);}(_0x3069,0x1e6));var _0x9306=function(_0x4c60e0,_0x2e9376){_0x4c60e0=_0x4c60e0-0x0;var _0x5295e3=_0x3069[_0x4c60e0];return _0x5295e3;};'use strict';var Sequelize=require(_0x9306('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9306('0x1'),'variable',_0x9306('0x2'),_0x9306('0x3')),'defaultValue':_0x9306('0x1')},'content':{'type':Sequelize[_0x9306('0x4')]},'key':{'type':Sequelize[_0x9306('0x4')]},'keyType':{'type':Sequelize[_0x9306('0x5')](_0x9306('0x1'),_0x9306('0x6'),_0x9306('0x2'))},'keyContent':{'type':Sequelize[_0x9306('0x4')]},'idField':{'type':Sequelize[_0x9306('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9306('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9306('0x4')]}}; \ No newline at end of file +var _0x1ff9=['keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x100d41,_0x35ae6d){var _0x459274=function(_0x23b66c){while(--_0x23b66c){_0x100d41['push'](_0x100d41['shift']());}};_0x459274(++_0x35ae6d);}(_0x1ff9,0x15c));var _0x91ff=function(_0x40cff7,_0x5c3eb5){_0x40cff7=_0x40cff7-0x0;var _0x38006f=_0x1ff9[_0x40cff7];return _0x38006f;};'use strict';var Sequelize=require(_0x91ff('0x0'));module[_0x91ff('0x1')]={'type':{'type':Sequelize[_0x91ff('0x2')]('string',_0x91ff('0x3'),'customVariable',_0x91ff('0x4')),'defaultValue':_0x91ff('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x91ff('0x2')](_0x91ff('0x5'),_0x91ff('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x91ff('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x91ff('0x6')]},'customField':{'type':Sequelize[_0x91ff('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x91ff('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 71615c7..0b57dfd 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 _0x5f2f=['limit','set','Content-Range','json','reject','then','error','stack','name','send','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','type','filter','Dynamics365Field','includeAll','include','findAll','rows','catch','show','params','filtears','merge','options','find','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset'];(function(_0x53af0d,_0x527e82){var _0x5e5bb9=function(_0x490466){while(--_0x490466){_0x53af0d['push'](_0x53af0d['shift']());}};_0x5e5bb9(++_0x527e82);}(_0x5f2f,0x73));var _0xf5f2=function(_0x300e96,_0x329b01){_0x300e96=_0x300e96-0x0;var _0x3a4fe6=_0x5f2f[_0x300e96];return _0x3a4fe6;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=_0x17d656[_0xf5f2('0x1b')],_0x23e23a=_0x286197[_0xf5f2('0x1c')],_0x3a9dbb=_0x286197[_0xf5f2('0x1c')]+_0x286197[_0xf5f2('0x1d')],_0xdb61b3;if(_0x3a9dbb>=_0x1b6dd2){_0x3a9dbb=_0x1b6dd2;_0xdb61b3=0xc8;}else{_0xdb61b3=0xce;}_0xafe430[_0xf5f2('0x1a')](_0xdb61b3);return _0xafe430[_0xf5f2('0x1e')](_0xf5f2('0x1f'),_0x23e23a+'-'+_0x3a9dbb+'/'+_0x1b6dd2)[_0xf5f2('0x20')](_0x17d656);}return null;};}function patchUpdates(_0x626999){return function(_0x1bf655){try{jsonpatch['apply'](_0x1bf655,_0x626999,!![]);}catch(_0x34706d){return BPromise[_0xf5f2('0x21')](_0x34706d);}return _0x1bf655['save']();};}function saveUpdates(_0x47acfc,_0x2d2805){return function(_0x388e6c){if(_0x388e6c){return _0x388e6c['update'](_0x47acfc)[_0xf5f2('0x22')](function(_0x170042){return _0x170042;});}return null;};}function removeEntity(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['destroy']()[_0xf5f2('0x22')](function(){_0x39e44a[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x2833fe,_0x287ad5){return function(_0x5bdf4a){if(!_0x5bdf4a){_0x2833fe['sendStatus'](0x194);}return _0x5bdf4a;};}function handleError(_0x5f1124,_0x3f79d5){_0x3f79d5=_0x3f79d5||0x1f4;return function(_0x13da6f){logger[_0xf5f2('0x23')](_0x13da6f[_0xf5f2('0x24')]);if(_0x13da6f[_0xf5f2('0x25')]){delete _0x13da6f[_0xf5f2('0x25')];}_0x5f1124[_0xf5f2('0x1a')](_0x3f79d5)[_0xf5f2('0x26')](_0x13da6f);};}exports['index']=function(_0xaa2602,_0x102449){var _0x375ca8={},_0x31bfcb={},_0x198c73={'count':0x0,'rows':[]};var _0x477604=_['map'](db['Dynamics365Field'][_0xf5f2('0x27')],function(_0x14c829){return{'name':_0x14c829[_0xf5f2('0x28')],'type':_0x14c829['type']['key']};});_0x31bfcb[_0xf5f2('0x29')]=_[_0xf5f2('0x2a')](_0x477604,_0xf5f2('0x25'));_0x31bfcb[_0xf5f2('0x2b')]=_[_0xf5f2('0x2c')](_0xaa2602['query']);_0x31bfcb['filters']=_[_0xf5f2('0x2d')](_0x31bfcb['model'],_0x31bfcb[_0xf5f2('0x2b')]);_0x375ca8['attributes']=_[_0xf5f2('0x2d')](_0x31bfcb[_0xf5f2('0x29')],qs[_0xf5f2('0x2e')](_0xaa2602[_0xf5f2('0x2b')][_0xf5f2('0x2e')]));_0x375ca8[_0xf5f2('0x2f')]=_0x375ca8[_0xf5f2('0x2f')][_0xf5f2('0x30')]?_0x375ca8['attributes']:_0x31bfcb[_0xf5f2('0x29')];if(!_0xaa2602[_0xf5f2('0x2b')][_0xf5f2('0x31')](_0xf5f2('0x32'))){_0x375ca8[_0xf5f2('0x1d')]=qs[_0xf5f2('0x1d')](_0xaa2602[_0xf5f2('0x2b')]['limit']);_0x375ca8[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0xaa2602['query'][_0xf5f2('0x1c')]);}_0x375ca8['order']=qs[_0xf5f2('0x33')](_0xaa2602[_0xf5f2('0x2b')][_0xf5f2('0x33')]);_0x375ca8[_0xf5f2('0x34')]=qs['filters'](_['pick'](_0xaa2602[_0xf5f2('0x2b')],_0x31bfcb[_0xf5f2('0x35')]),_0x477604);if(_0xaa2602[_0xf5f2('0x2b')]['filter']){_0x375ca8[_0xf5f2('0x34')]=_['merge'](_0x375ca8[_0xf5f2('0x34')],{'$or':_['map'](_0x477604,function(_0x46f464){if(_0x46f464[_0xf5f2('0x36')]!=='VIRTUAL'){var _0x29694f={};_0x29694f[_0x46f464[_0xf5f2('0x25')]]={'$like':'%'+_0xaa2602[_0xf5f2('0x2b')][_0xf5f2('0x37')]+'%'};return _0x29694f;}})});}_0x375ca8=_['merge']({},_0x375ca8,_0xaa2602['options']);var _0x3d328f={'where':_0x375ca8[_0xf5f2('0x34')]};return db[_0xf5f2('0x38')][_0xf5f2('0x1b')](_0x3d328f)[_0xf5f2('0x22')](function(_0xe62b57){_0x198c73[_0xf5f2('0x1b')]=_0xe62b57;if(_0xaa2602['query'][_0xf5f2('0x39')]){_0x375ca8[_0xf5f2('0x3a')]=[{'all':!![]}];}return db['Dynamics365Field'][_0xf5f2('0x3b')](_0x375ca8);})[_0xf5f2('0x22')](function(_0x71b0e7){_0x198c73[_0xf5f2('0x3c')]=_0x71b0e7;return _0x198c73;})[_0xf5f2('0x22')](respondWithFilteredResult(_0x102449,_0x375ca8))[_0xf5f2('0x3d')](handleError(_0x102449,null));};exports[_0xf5f2('0x3e')]=function(_0x2083b3,_0x574f24){var _0x31c3c={'raw':!![],'where':{'id':_0x2083b3[_0xf5f2('0x3f')]['id']}},_0x34792f={};_0x34792f['model']=_['keys'](db['Dynamics365Field'][_0xf5f2('0x27')]);_0x34792f[_0xf5f2('0x2b')]=_['keys'](_0x2083b3[_0xf5f2('0x2b')]);_0x34792f[_0xf5f2('0x40')]=_[_0xf5f2('0x2d')](_0x34792f[_0xf5f2('0x29')],_0x34792f[_0xf5f2('0x2b')]);_0x31c3c[_0xf5f2('0x2f')]=_[_0xf5f2('0x2d')](_0x34792f[_0xf5f2('0x29')],qs[_0xf5f2('0x2e')](_0x2083b3[_0xf5f2('0x2b')][_0xf5f2('0x2e')]));_0x31c3c[_0xf5f2('0x2f')]=_0x31c3c[_0xf5f2('0x2f')][_0xf5f2('0x30')]?_0x31c3c['attributes']:_0x34792f[_0xf5f2('0x29')];if(_0x2083b3['query'][_0xf5f2('0x39')]){_0x31c3c[_0xf5f2('0x3a')]=[{'all':!![]}];}_0x31c3c=_[_0xf5f2('0x41')]({},_0x31c3c,_0x2083b3[_0xf5f2('0x42')]);return db[_0xf5f2('0x38')][_0xf5f2('0x43')](_0x31c3c)['then'](handleEntityNotFound(_0x574f24,null))[_0xf5f2('0x22')](respondWithResult(_0x574f24,null))[_0xf5f2('0x3d')](handleError(_0x574f24,null));};exports[_0xf5f2('0x44')]=function(_0x29b108,_0x12124d){return db[_0xf5f2('0x38')][_0xf5f2('0x44')](_0x29b108[_0xf5f2('0x45')],{})['then'](respondWithResult(_0x12124d,0xc9))[_0xf5f2('0x3d')](handleError(_0x12124d,null));};exports[_0xf5f2('0x46')]=function(_0x45db9a,_0x492eea){if(_0x45db9a[_0xf5f2('0x45')]['id']){delete _0x45db9a[_0xf5f2('0x45')]['id'];}return db[_0xf5f2('0x38')]['find']({'where':{'id':_0x45db9a['params']['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x492eea,null))[_0xf5f2('0x22')](saveUpdates(_0x45db9a['body'],null))[_0xf5f2('0x22')](respondWithResult(_0x492eea,null))['catch'](handleError(_0x492eea,null));};exports[_0xf5f2('0x47')]=function(_0x497eb8,_0x2cbd9d){return db['Dynamics365Field'][_0xf5f2('0x43')]({'where':{'id':_0x497eb8[_0xf5f2('0x3f')]['id']}})[_0xf5f2('0x22')](handleEntityNotFound(_0x2cbd9d,null))[_0xf5f2('0x22')](removeEntity(_0x2cbd9d,null))['catch'](handleError(_0x2cbd9d,null));}; \ No newline at end of file +var _0xdb28=['update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','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','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','save'];(function(_0x5925cc,_0x1efa73){var _0x177e46=function(_0x3bfa89){while(--_0x3bfa89){_0x5925cc['push'](_0x5925cc['shift']());}};_0x177e46(++_0x1efa73);}(_0xdb28,0x106));var _0x8db2=function(_0xf544c5,_0xdfd76e){_0xf544c5=_0xf544c5-0x0;var _0x353d5f=_0xdb28[_0xf544c5];return _0x353d5f;};'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 licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=_0x16c8c2[_0x8db2('0x1c')],_0x13b0f5=_0x131252[_0x8db2('0x1d')],_0x24da1b=_0x131252[_0x8db2('0x1d')]+_0x131252[_0x8db2('0x1e')],_0x48101e;if(_0x24da1b>=_0x5489a9){_0x24da1b=_0x5489a9;_0x48101e=0xc8;}else{_0x48101e=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x48101e);return _0x3c96a7[_0x8db2('0x1f')]('Content-Range',_0x13b0f5+'-'+_0x24da1b+'/'+_0x5489a9)['json'](_0x16c8c2);}return null;};}function patchUpdates(_0x77789){return function(_0x104e33){try{jsonpatch[_0x8db2('0x20')](_0x104e33,_0x77789,!![]);}catch(_0x1b64e4){return BPromise['reject'](_0x1b64e4);}return _0x104e33[_0x8db2('0x21')]();};}function saveUpdates(_0x36a9ff,_0x260940){return function(_0x297ba3){if(_0x297ba3){return _0x297ba3[_0x8db2('0x22')](_0x36a9ff)['then'](function(_0x124467){return _0x124467;});}return null;};}function removeEntity(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')]()[_0x8db2('0x24')](function(){_0x3e30e6[_0x8db2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x256202,_0x4f6516){return function(_0x5725f0){if(!_0x5725f0){_0x256202['sendStatus'](0x194);}return _0x5725f0;};}function handleError(_0x4d923c,_0xec8cd2){_0xec8cd2=_0xec8cd2||0x1f4;return function(_0x29b5cd){logger[_0x8db2('0x25')](_0x29b5cd[_0x8db2('0x26')]);if(_0x29b5cd[_0x8db2('0x27')]){delete _0x29b5cd[_0x8db2('0x27')];}_0x4d923c['status'](_0xec8cd2)[_0x8db2('0x28')](_0x29b5cd);};}exports[_0x8db2('0x29')]=function(_0x430dd5,_0x8b7cec){var _0x483aee={},_0x2e0691={},_0x11f398={'count':0x0,'rows':[]};var _0x241baf=_[_0x8db2('0x2a')](db[_0x8db2('0x2b')][_0x8db2('0x2c')],function(_0xa54ea3){return{'name':_0xa54ea3[_0x8db2('0x2d')],'type':_0xa54ea3[_0x8db2('0x2e')]['key']};});_0x2e0691[_0x8db2('0x2f')]=_['map'](_0x241baf,'name');_0x2e0691[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x430dd5[_0x8db2('0x30')]);_0x2e0691['filters']=_[_0x8db2('0x32')](_0x2e0691['model'],_0x2e0691[_0x8db2('0x30')]);_0x483aee[_0x8db2('0x33')]=_[_0x8db2('0x32')](_0x2e0691['model'],qs['fields'](_0x430dd5[_0x8db2('0x30')][_0x8db2('0x34')]));_0x483aee['attributes']=_0x483aee['attributes'][_0x8db2('0x35')]?_0x483aee[_0x8db2('0x33')]:_0x2e0691[_0x8db2('0x2f')];if(!_0x430dd5[_0x8db2('0x30')][_0x8db2('0x36')](_0x8db2('0x37'))){_0x483aee[_0x8db2('0x1e')]=qs[_0x8db2('0x1e')](_0x430dd5[_0x8db2('0x30')][_0x8db2('0x1e')]);_0x483aee['offset']=qs[_0x8db2('0x1d')](_0x430dd5[_0x8db2('0x30')]['offset']);}_0x483aee[_0x8db2('0x38')]=qs[_0x8db2('0x39')](_0x430dd5['query']['sort']);_0x483aee[_0x8db2('0x3a')]=qs['filters'](_[_0x8db2('0x3b')](_0x430dd5[_0x8db2('0x30')],_0x2e0691[_0x8db2('0x3c')]),_0x241baf);if(_0x430dd5[_0x8db2('0x30')]['filter']){_0x483aee[_0x8db2('0x3a')]=_['merge'](_0x483aee[_0x8db2('0x3a')],{'$or':_[_0x8db2('0x2a')](_0x241baf,function(_0x2c8bc9){if(_0x2c8bc9[_0x8db2('0x2e')]!=='VIRTUAL'){var _0x50ee17={};_0x50ee17[_0x2c8bc9[_0x8db2('0x27')]]={'$like':'%'+_0x430dd5[_0x8db2('0x30')]['filter']+'%'};return _0x50ee17;}})});}_0x483aee=_[_0x8db2('0x3d')]({},_0x483aee,_0x430dd5[_0x8db2('0x3e')]);var _0x656dd2={'where':_0x483aee['where']};return db[_0x8db2('0x2b')][_0x8db2('0x1c')](_0x656dd2)[_0x8db2('0x24')](function(_0x279e74){_0x11f398[_0x8db2('0x1c')]=_0x279e74;if(_0x430dd5[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x483aee[_0x8db2('0x40')]=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x41')](_0x483aee);})[_0x8db2('0x24')](function(_0x20bf0b){_0x11f398[_0x8db2('0x42')]=_0x20bf0b;return _0x11f398;})['then'](respondWithFilteredResult(_0x8b7cec,_0x483aee))[_0x8db2('0x43')](handleError(_0x8b7cec,null));};exports[_0x8db2('0x44')]=function(_0x5e0382,_0x49a7ae){var _0x249c73={'raw':!![],'where':{'id':_0x5e0382[_0x8db2('0x45')]['id']}},_0x4f1a49={};_0x4f1a49[_0x8db2('0x2f')]=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x2c')]);_0x4f1a49[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x5e0382['query']);_0x4f1a49[_0x8db2('0x46')]=_[_0x8db2('0x32')](_0x4f1a49[_0x8db2('0x2f')],_0x4f1a49[_0x8db2('0x30')]);_0x249c73['attributes']=_[_0x8db2('0x32')](_0x4f1a49[_0x8db2('0x2f')],qs[_0x8db2('0x34')](_0x5e0382[_0x8db2('0x30')]['fields']));_0x249c73[_0x8db2('0x33')]=_0x249c73['attributes'][_0x8db2('0x35')]?_0x249c73[_0x8db2('0x33')]:_0x4f1a49[_0x8db2('0x2f')];if(_0x5e0382['query']['includeAll']){_0x249c73[_0x8db2('0x40')]=[{'all':!![]}];}_0x249c73=_['merge']({},_0x249c73,_0x5e0382[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x47')](_0x249c73)[_0x8db2('0x24')](handleEntityNotFound(_0x49a7ae,null))[_0x8db2('0x24')](respondWithResult(_0x49a7ae,null))[_0x8db2('0x43')](handleError(_0x49a7ae,null));};exports[_0x8db2('0x48')]=function(_0xab6bdd,_0x4291e3){return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xab6bdd[_0x8db2('0x49')],{})['then'](respondWithResult(_0x4291e3,0xc9))[_0x8db2('0x43')](handleError(_0x4291e3,null));};exports[_0x8db2('0x22')]=function(_0xdbba64,_0x3244db){if(_0xdbba64['body']['id']){delete _0xdbba64['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x47')]({'where':{'id':_0xdbba64[_0x8db2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3244db,null))['then'](saveUpdates(_0xdbba64['body'],null))[_0x8db2('0x24')](respondWithResult(_0x3244db,null))[_0x8db2('0x43')](handleError(_0x3244db,null));};exports[_0x8db2('0x23')]=function(_0x383fa1,_0xaab731){return db[_0x8db2('0x2b')][_0x8db2('0x47')]({'where':{'id':_0x383fa1['params']['id']}})['then'](handleEntityNotFound(_0xaab731,null))[_0x8db2('0x24')](removeEntity(_0xaab731,null))[_0x8db2('0x43')](handleError(_0xaab731,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6d1d416..643b281 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 _0xddf6=['FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','idField'];(function(_0x529e07,_0x529b42){var _0x4bb595=function(_0x971e6){while(--_0x971e6){_0x529e07['push'](_0x529e07['shift']());}};_0x4bb595(++_0x529b42);}(_0xddf6,0x79));var _0x6ddf=function(_0x45270d,_0x34ae6e){_0x45270d=_0x45270d-0x0;var _0x3c4a9d=_0xddf6[_0x45270d];return _0x3c4a9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6ddf('0x0'))(_0x6ddf('0x1'));var moment=require(_0x6ddf('0x2'));var BPromise=require(_0x6ddf('0x3'));var rp=require(_0x6ddf('0x4'));var fs=require('fs');var path=require(_0x6ddf('0x5'));var rimraf=require(_0x6ddf('0x6'));var config=require(_0x6ddf('0x7'));var attributes=require(_0x6ddf('0x8'));module[_0x6ddf('0x9')]=function(_0x5ad13b,_0x45103e){return _0x5ad13b[_0x6ddf('0xa')](_0x6ddf('0xb'),attributes,{'tableName':_0x6ddf('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x6ddf('0xd'),_0x6ddf('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdbb5=['define','Dynamics365Field','idField','FieldId','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xdbb5,0x108));var _0x5dbb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdbb5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5dbb('0x0'));var logger=require(_0x5dbb('0x1'))('api');var moment=require(_0x5dbb('0x2'));var BPromise=require(_0x5dbb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dbb('0x4'));var rimraf=require(_0x5dbb('0x5'));var config=require(_0x5dbb('0x6'));var attributes=require(_0x5dbb('0x7'));module[_0x5dbb('0x8')]=function(_0x1a74a8,_0xa1535a){return _0x1a74a8[_0x5dbb('0x9')](_0x5dbb('0xa'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x5dbb('0xb'),_0x5dbb('0xc')],'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 79b8fa4..065c44c 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 _0xfb11=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x29c934,_0x3c30e2){var _0x4302de=function(_0x179a5a){while(--_0x179a5a){_0x29c934['push'](_0x29c934['shift']());}};_0x4302de(++_0x3c30e2);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xfb11[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file +var _0xb242=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5b0af0,_0x4e4950){var _0x237f31=function(_0x3df5bc){while(--_0x3df5bc){_0x5b0af0['push'](_0x5b0af0['shift']());}};_0x237f31(++_0x4e4950);}(_0xb242,0x1f3));var _0x2b24=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0xb242[_0x5c6299];return _0x23b564;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var moment=require(_0x2b24('0x1'));var BPromise=require(_0x2b24('0x2'));var rs=require(_0x2b24('0x3'));var fs=require('fs');var Redis=require(_0x2b24('0x4'));var db=require(_0x2b24('0x5'))['db'];var utils=require(_0x2b24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b24('0x7'));var jayson=require(_0x2b24('0x8'));var client=jayson['client'][_0x2b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477e45,_0x179d9a,_0x53345b){return new BPromise(function(_0x475271,_0x56c14a){return client[_0x2b24('0xa')](_0x477e45,_0x53345b)[_0x2b24('0xb')](function(_0x529939){logger[_0x2b24('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x179d9a,_0x2b24('0xd'));logger[_0x2b24('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x179d9a,'request\x20sent',JSON[_0x2b24('0xf')](_0x529939));if(_0x529939['error']){if(_0x529939[_0x2b24('0x10')][_0x2b24('0x11')]===0x1f4){logger[_0x2b24('0x10')](_0x2b24('0x12'),_0x179d9a,_0x529939['error']['message']);return _0x56c14a(_0x529939[_0x2b24('0x10')][_0x2b24('0x13')]);}logger[_0x2b24('0x10')](_0x2b24('0x12'),_0x179d9a,_0x529939[_0x2b24('0x10')]['message']);return _0x475271(_0x529939[_0x2b24('0x10')][_0x2b24('0x13')]);}else{logger['info'](_0x2b24('0x12'),_0x179d9a,_0x2b24('0xd'));_0x475271(_0x529939['result'][_0x2b24('0x13')]);}})[_0x2b24('0x14')](function(_0x2fdc73){logger[_0x2b24('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x179d9a,_0x2fdc73);_0x56c14a(_0x2fdc73);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6c8ff77..9157ede 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 _0x2f82=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','update','delete'];(function(_0x5954d2,_0x15db93){var _0x316928=function(_0x278bd3){while(--_0x278bd3){_0x5954d2['push'](_0x5954d2['shift']());}};_0x316928(++_0x15db93);}(_0x2f82,0xf4));var _0x22f8=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x2f82[_0x2d4661];return _0x42ed1e;};'use strict';var multer=require(_0x22f8('0x0'));var util=require(_0x22f8('0x1'));var path=require(_0x22f8('0x2'));var timeout=require(_0x22f8('0x3'));var express=require(_0x22f8('0x4'));var router=express['Router']();var auth=require(_0x22f8('0x5'));var interaction=require(_0x22f8('0x6'));var config=require(_0x22f8('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x22f8('0x8')]('/',auth[_0x22f8('0x9')](),controller[_0x22f8('0xa')]);router[_0x22f8('0x8')](_0x22f8('0xb'),auth[_0x22f8('0x9')](),controller[_0x22f8('0xc')]);router[_0x22f8('0x8')](_0x22f8('0xd'),auth[_0x22f8('0x9')](),controller[_0x22f8('0xe')]);router[_0x22f8('0x8')](_0x22f8('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x22f8('0x10')]('/',auth[_0x22f8('0x9')](),controller[_0x22f8('0x11')]);router[_0x22f8('0x10')](_0x22f8('0xd'),auth[_0x22f8('0x9')](),controller['addConfiguration']);router['put'](_0x22f8('0xb'),auth[_0x22f8('0x9')](),controller[_0x22f8('0x12')]);router[_0x22f8('0x13')](_0x22f8('0xb'),auth[_0x22f8('0x9')](),controller[_0x22f8('0x14')]);module[_0x22f8('0x15')]=router; \ No newline at end of file +var _0xf920=['index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated'];(function(_0x1a0840,_0x3d0419){var _0x295712=function(_0x28c002){while(--_0x28c002){_0x1a0840['push'](_0x1a0840['shift']());}};_0x295712(++_0x3d0419);}(_0xf920,0x1d5));var _0x0f92=function(_0x3e8d78,_0xef4524){_0x3e8d78=_0x3e8d78-0x0;var _0x50532d=_0xf920[_0x3e8d78];return _0x50532d;};'use strict';var multer=require(_0x0f92('0x0'));var util=require(_0x0f92('0x1'));var path=require(_0x0f92('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f92('0x3'));var router=express[_0x0f92('0x4')]();var auth=require(_0x0f92('0x5'));var interaction=require(_0x0f92('0x6'));var config=require(_0x0f92('0x7'));var controller=require(_0x0f92('0x8'));router[_0x0f92('0x9')]('/',auth[_0x0f92('0xa')](),controller[_0x0f92('0xb')]);router[_0x0f92('0x9')]('/:id',auth[_0x0f92('0xa')](),controller['show']);router[_0x0f92('0x9')](_0x0f92('0xc'),auth['isAuthenticated'](),controller[_0x0f92('0xd')]);router[_0x0f92('0x9')](_0x0f92('0xe'),auth['isAuthenticated'](),controller[_0x0f92('0xf')]);router[_0x0f92('0x10')]('/',auth[_0x0f92('0xa')](),controller['create']);router[_0x0f92('0x10')](_0x0f92('0xc'),auth[_0x0f92('0xa')](),controller[_0x0f92('0x11')]);router[_0x0f92('0x12')](_0x0f92('0x13'),auth[_0x0f92('0xa')](),controller[_0x0f92('0x14')]);router[_0x0f92('0x15')](_0x0f92('0x13'),auth[_0x0f92('0xa')](),controller[_0x0f92('0x16')]);module[_0x0f92('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f1b18de..81590f4 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 _0x457b=['STRING','username','sequelize','exports'];(function(_0x171fa7,_0x587eca){var _0xc894e1=function(_0x43d7c7){while(--_0x43d7c7){_0x171fa7['push'](_0x171fa7['shift']());}};_0xc894e1(++_0x587eca);}(_0x457b,0xca));var _0xb457=function(_0xf0ab7c,_0x23bbc2){_0xf0ab7c=_0xf0ab7c-0x0;var _0x198144=_0x457b[_0xf0ab7c];return _0x198144;};'use strict';var Sequelize=require(_0xb457('0x0'));module[_0xb457('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb457('0x2')]},'username':{'type':Sequelize[_0xb457('0x2')],'unique':_0xb457('0x3')},'apiKey':{'type':Sequelize[_0xb457('0x2')]},'remoteUri':{'type':Sequelize[_0xb457('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xb457('0x2')]}}; \ No newline at end of file +var _0x5532=['STRING','remoteUri','sequelize','exports'];(function(_0x3be65b,_0x151792){var _0x111f1a=function(_0x185665){while(--_0x185665){_0x3be65b['push'](_0x3be65b['shift']());}};_0x111f1a(++_0x151792);}(_0x5532,0x19a));var _0x2553=function(_0x327fc9,_0x3926e2){_0x327fc9=_0x327fc9-0x0;var _0x42bd41=_0x5532[_0x327fc9];return _0x42bd41;};'use strict';var Sequelize=require(_0x2553('0x0'));module[_0x2553('0x1')]={'name':{'type':Sequelize[_0x2553('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2553('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2553('0x2')]},'remoteUri':{'type':Sequelize[_0x2553('0x2')],'unique':_0x2553('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6ce334f..e45815e 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 _0x9957=['requester','subject','priority','group','source','ticket_type','remove','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','filtears','options','find','update','body','getConfigurations','findOne','FreshdeskConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64'];(function(_0x51a03c,_0x1be9f2){var _0x445fbe=function(_0x5a17a1){while(--_0x5a17a1){_0x51a03c['push'](_0x51a03c['shift']());}};_0x445fbe(++_0x1be9f2);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x2d')],_0x229742=_0x56691a[_0x7995('0x2e')],_0x49bc7e=_0x56691a['offset']+_0x56691a[_0x7995('0x2f')],_0xf16cc2;if(_0x49bc7e>=_0x5911c3){_0x49bc7e=_0x5911c3;_0xf16cc2=0xc8;}else{_0xf16cc2=0xce;}_0x2a307e['status'](_0xf16cc2);return _0x2a307e[_0x7995('0x30')](_0x7995('0x31'),_0x229742+'-'+_0x49bc7e+'/'+_0x5911c3)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x574574){return function(_0x530611){try{jsonpatch['apply'](_0x530611,_0x574574,!![]);}catch(_0x3573be){return BPromise[_0x7995('0x32')](_0x3573be);}return _0x530611[_0x7995('0x33')]();};}function saveUpdates(_0x2b874d,_0x2e3493){return function(_0x1ca460){if(_0x1ca460){return _0x1ca460['update'](_0x2b874d)['then'](function(_0xfa8f15){return _0xfa8f15;});}return null;};}function removeEntity(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x34')]()[_0x7995('0x20')](function(){_0x5524af[_0x7995('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44309d,_0x33e24e){return function(_0x5dd802){if(!_0x5dd802){_0x44309d['sendStatus'](0x194);}return _0x5dd802;};}function handleError(_0x577412,_0x45bc5e){_0x45bc5e=_0x45bc5e||0x1f4;return function(_0x3acfc3){logger['error'](_0x3acfc3[_0x7995('0x35')]);if(_0x3acfc3['name']){delete _0x3acfc3[_0x7995('0x36')];}_0x577412[_0x7995('0x2b')](_0x45bc5e)[_0x7995('0x37')](_0x3acfc3);};}exports['index']=function(_0x52d76d,_0x36d057){var _0x5e67fe={},_0x5d2428={},_0x3e99cd={'count':0x0,'rows':[]};var _0xe328b1=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x2b772f){return{'name':_0x2b772f[_0x7995('0x3a')],'type':_0x2b772f[_0x7995('0x3b')]['key']};});_0x5d2428[_0x7995('0x3c')]=_[_0x7995('0x3d')](_0xe328b1,_0x7995('0x36'));_0x5d2428[_0x7995('0x3e')]=_['keys'](_0x52d76d[_0x7995('0x3e')]);_0x5d2428[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5d2428[_0x7995('0x3c')],_0x5d2428[_0x7995('0x3e')]);_0x5e67fe[_0x7995('0x41')]=_['intersection'](_0x5d2428[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x52d76d[_0x7995('0x3e')][_0x7995('0x42')]));_0x5e67fe[_0x7995('0x41')]=_0x5e67fe[_0x7995('0x41')][_0x7995('0x43')]?_0x5e67fe[_0x7995('0x41')]:_0x5d2428[_0x7995('0x3c')];if(!_0x52d76d[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x5e67fe[_0x7995('0x2f')]=qs['limit'](_0x52d76d['query'][_0x7995('0x2f')]);_0x5e67fe[_0x7995('0x2e')]=qs['offset'](_0x52d76d['query'][_0x7995('0x2e')]);}_0x5e67fe['order']=qs['sort'](_0x52d76d[_0x7995('0x3e')][_0x7995('0x46')]);_0x5e67fe[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x52d76d['query'],_0x5d2428[_0x7995('0x3f')]),_0xe328b1);if(_0x52d76d['query']['filter']){_0x5e67fe[_0x7995('0x47')]=_[_0x7995('0x49')](_0x5e67fe[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0xe328b1,function(_0x599ecb){if(_0x599ecb[_0x7995('0x3b')]!==_0x7995('0x4a')){var _0x31b347={};_0x31b347[_0x599ecb[_0x7995('0x36')]]={'$like':'%'+_0x52d76d['query']['filter']+'%'};return _0x31b347;}})});}_0x5e67fe=_[_0x7995('0x49')]({},_0x5e67fe,_0x52d76d['options']);var _0x23c41d={'where':_0x5e67fe['where']};return db[_0x7995('0x38')]['count'](_0x23c41d)[_0x7995('0x20')](function(_0x1b0373){_0x3e99cd['count']=_0x1b0373;if(_0x52d76d[_0x7995('0x3e')][_0x7995('0x4b')]){_0x5e67fe[_0x7995('0x4c')]=[{'all':!![]}];}return db[_0x7995('0x38')]['findAll'](_0x5e67fe);})[_0x7995('0x20')](function(_0x3e787d){_0x3e99cd[_0x7995('0x4d')]=_0x3e787d;return _0x3e99cd;})['then'](respondWithFilteredResult(_0x36d057,_0x5e67fe))[_0x7995('0x4e')](handleError(_0x36d057,null));};exports[_0x7995('0x4f')]=function(_0x511567,_0x3d8ae3){var _0x255313={'raw':![],'where':{'id':_0x511567[_0x7995('0x50')]['id']}},_0x51934b={};_0x51934b[_0x7995('0x3c')]=_['keys'](db[_0x7995('0x38')]['rawAttributes']);_0x51934b[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x511567[_0x7995('0x3e')]);_0x51934b[_0x7995('0x52')]=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],_0x51934b[_0x7995('0x3e')]);_0x255313['attributes']=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x511567['query'][_0x7995('0x42')]));_0x255313[_0x7995('0x41')]=_0x255313[_0x7995('0x41')]['length']?_0x255313['attributes']:_0x51934b['model'];if(_0x511567[_0x7995('0x3e')][_0x7995('0x4b')]){_0x255313['include']=[{'all':!![]}];}_0x255313=_[_0x7995('0x49')]({},_0x255313,_0x511567[_0x7995('0x53')]);return db[_0x7995('0x38')][_0x7995('0x54')](_0x255313)[_0x7995('0x20')](handleEntityNotFound(_0x3d8ae3,null))['then'](respondWithResult(_0x3d8ae3,null))[_0x7995('0x4e')](handleError(_0x3d8ae3,null));};exports['create']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['create'](_0x14fe7f['body'],{})['then'](respondWithResult(_0x33c801,0xc9))['catch'](handleError(_0x33c801,null));};exports[_0x7995('0x55')]=function(_0x3709de,_0x1a861c){if(_0x3709de[_0x7995('0x56')]['id']){delete _0x3709de[_0x7995('0x56')]['id'];}return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x3709de[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1a861c,null))[_0x7995('0x20')](saveUpdates(_0x3709de[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x1a861c,null))[_0x7995('0x4e')](handleError(_0x1a861c,null));};exports[_0x7995('0x34')]=function(_0x1ea1dc,_0x416133){return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x1ea1dc[_0x7995('0x50')]['id']}})['then'](handleEntityNotFound(_0x416133,null))[_0x7995('0x20')](removeEntity(_0x416133,null))[_0x7995('0x4e')](handleError(_0x416133,null));};exports[_0x7995('0x57')]=function(_0x32c0d3,_0x5d160d,_0x53125a){var _0x402fa0={};var _0x197b52={};var _0x5b9467;var _0x332a85;return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x32c0d3[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x5d160d,null))[_0x7995('0x20')](function(_0x502d43){if(_0x502d43){_0x5b9467=_0x502d43;_0x197b52['model']=_[_0x7995('0x51')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x197b52[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x32c0d3[_0x7995('0x3e')]);_0x197b52[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],_0x197b52['query']);_0x402fa0[_0x7995('0x41')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x32c0d3['query']['fields']));_0x402fa0[_0x7995('0x41')]=_0x402fa0[_0x7995('0x41')]['length']?_0x402fa0[_0x7995('0x41')]:_0x197b52[_0x7995('0x3c')];_0x402fa0[_0x7995('0x5a')]=qs[_0x7995('0x46')](_0x32c0d3[_0x7995('0x3e')]['sort']);_0x402fa0[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x32c0d3[_0x7995('0x3e')],_0x197b52[_0x7995('0x3f')]));if(_0x32c0d3[_0x7995('0x3e')][_0x7995('0x5b')]){_0x402fa0[_0x7995('0x47')]=_[_0x7995('0x49')](_0x402fa0[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0x402fa0[_0x7995('0x41')],function(_0x2618c4){var _0x234d8d={};_0x234d8d[_0x2618c4]={'$like':'%'+_0x32c0d3['query'][_0x7995('0x5b')]+'%'};return _0x234d8d;})});}_0x402fa0=_[_0x7995('0x49')]({},_0x402fa0,_0x32c0d3[_0x7995('0x53')]);return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x54a2e0){if(_0x54a2e0){_0x332a85=_0x54a2e0['length'];if(!_0x32c0d3[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x402fa0[_0x7995('0x2f')]=qs['limit'](_0x32c0d3[_0x7995('0x3e')]['limit']);_0x402fa0['offset']=qs[_0x7995('0x2e')](_0x32c0d3[_0x7995('0x3e')][_0x7995('0x2e')]);}return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x25d9a4){if(_0x25d9a4){return _0x25d9a4?{'count':_0x332a85,'rows':_0x25d9a4}:null;}})[_0x7995('0x20')](respondWithResult(_0x5d160d,null))[_0x7995('0x4e')](handleError(_0x5d160d,null));};exports[_0x7995('0x5c')]=function(_0x2466df,_0x560b0a,_0x2dc1f7){if(_0x2466df[_0x7995('0x56')]['id']){delete _0x2466df[_0x7995('0x56')]['id'];}return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x2466df[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x560b0a,null))[_0x7995('0x20')](function(_0x3b0d30){if(_0x3b0d30){_0x2466df[_0x7995('0x56')][_0x7995('0x5d')]=_0x3b0d30['id'];_0x2466df[_0x7995('0x56')][_0x7995('0x5e')]=integrations[_0x7995('0x5f')](_0x2466df[_0x7995('0x56')]['channel'],_0x2466df['body'][_0x7995('0x3b')]);_0x2466df[_0x7995('0x56')][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x2466df['body'][_0x7995('0x62')],_0x2466df[_0x7995('0x56')]['type']);return db['FreshdeskConfiguration'][_0x7995('0x63')](_0x2466df[_0x7995('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0x7995('0x5e')},{'model':db['FreshdeskField'],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x560b0a,null))['catch'](handleError(_0x560b0a,null));};exports['getFields']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff='';return db[_0x7995('0x38')][_0x7995('0x58')]({'where':{'id':_0x1f01c0[_0x7995('0x50')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x20')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0x20')](function(_0x117317){if(_0x117317){_0xa41fff=_0x117317[_0x7995('0x64')];var _0x16108c=_0xa41fff[_0x7995('0x66')](-0x1);if(_0x16108c==='/'){_0xa41fff=_0xa41fff[_0x7995('0x67')](0x0,_0xa41fff[_0x7995('0x68')](_0x16108c));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0xa41fff,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util[_0x7995('0x6a')](_0x7995('0x6e'),_0x117317[_0x7995('0x65')]))[_0x7995('0x6f')](_0x7995('0x70')))},'json':!![]});}})[_0x7995('0x20')](function(_0x34724d){if(_0x34724d){var _0x59efff=[_0x7995('0x71'),_0x7995('0x72'),'agent','description',_0x7995('0x2b'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x76'),_0x7995('0x74'),'company'];_[_0x7995('0x77')](_0x34724d,function(_0xb68962){return _0x59efff[_0x7995('0x78')](_0xb68962[_0x7995('0x36')])||!_0xb68962[_0x7995('0x79')]&&_0xb68962[_0x7995('0x3b')]!==_0x7995('0x7a')&&_0xb68962[_0x7995('0x3b')]!=='custom_dropdown';});return{'count':_0x34724d[_0x7995('0x43')],'rows':_[_0x7995('0x3d')](_0x34724d,function(_0x5c04c9){return{'id':_0x5c04c9['name'],'name':_0x5c04c9[_0x7995('0x7b')],'custom':!_0x5c04c9[_0x7995('0x79')],'options':_0x5c04c9[_0x7995('0x7c')]?_[_0x7995('0x3d')](_0x5c04c9[_0x7995('0x7c')],function(_0x4a02ea){return{'name':_[_0x7995('0x7d')](_0x4a02ea),'value':_0x4a02ea};}):[]};})};}})[_0x7995('0x20')](respondWithResult(_0x50c1a4,null))['catch'](function(_0x209977){var _0x30b41f=_0x1f01c0['query'][_0x7995('0x7e')]?0x1f4:_0x209977['statusCode']||0x1f4;logger[_0x7995('0x25')](_0x7995('0x7f'),_0x7995('0x80'),_0x30b41f,JSON[_0x7995('0x24')](_0x209977));delete _0x209977[_0x7995('0x36')];if(_0x30b41f===0x191){_0x30b41f=0x190;}_0x50c1a4['status'](_0x30b41f)[_0x7995('0x37')](_0x1f01c0[_0x7995('0x3e')][_0x7995('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x209977[_0x7995('0x81')]}:_0x209977);});}; \ No newline at end of file +var _0x9957=['requester','subject','priority','group','source','ticket_type','remove','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','show','params','keys','filtears','options','find','update','body','getConfigurations','findOne','FreshdeskConfiguration','order','filter','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64'];(function(_0x2afb55,_0x4ec468){var _0x18ca73=function(_0x3cdd6e){while(--_0x3cdd6e){_0x2afb55['push'](_0x2afb55['shift']());}};_0x18ca73(++_0x4ec468);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var integrations=require(_0x7995('0x1b'));var jayson=require(_0x7995('0x1c'));var client=jayson[_0x7995('0x1d')][_0x7995('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2bbe7a,_0x4cc004,_0x58f5ad,_0x2b4e94){return new BPromise(function(_0x2233dd,_0x24b5bb){var _0x321ae8=_0x2b4e94||client;return _0x321ae8[_0x7995('0x1f')](_0x2bbe7a,_0x58f5ad)[_0x7995('0x20')](function(_0x2202ce){logger[_0x7995('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x7995('0x22'));logger['debug'](_0x7995('0x23'),_0x4cc004,_0x7995('0x22'),JSON[_0x7995('0x24')](_0x2202ce));if(_0x2202ce[_0x7995('0x25')]){if(_0x2202ce[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x24b5bb(_0x2202ce['error'][_0x7995('0x27')]);}logger[_0x7995('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x4cc004,_0x2202ce[_0x7995('0x25')]['message']);return _0x2233dd(_0x2202ce['error'][_0x7995('0x27')]);}else{logger[_0x7995('0x21')](_0x7995('0x28'),_0x4cc004,_0x7995('0x22'));_0x2233dd(_0x2202ce[_0x7995('0x29')][_0x7995('0x27')]);}})['catch'](function(_0x32a09a){logger[_0x7995('0x25')](_0x7995('0x28'),_0x4cc004,_0x32a09a);_0x24b5bb(_0x32a09a);});});}function respondWithStatusCode(_0x285437,_0x563799){_0x563799=_0x563799||0xcc;return function(_0x13bc35){if(_0x13bc35){return _0x285437[_0x7995('0x2a')](_0x563799);}return _0x285437[_0x7995('0x2b')](_0x563799)['end']();};}function respondWithResult(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xc8;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c)[_0x7995('0x2c')](_0x401dc3);}};}function respondWithFilteredResult(_0x2a307e,_0x56691a){return function(_0x47625f){if(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x2d')],_0x229742=_0x56691a[_0x7995('0x2e')],_0x49bc7e=_0x56691a['offset']+_0x56691a[_0x7995('0x2f')],_0xf16cc2;if(_0x49bc7e>=_0x5911c3){_0x49bc7e=_0x5911c3;_0xf16cc2=0xc8;}else{_0xf16cc2=0xce;}_0x2a307e['status'](_0xf16cc2);return _0x2a307e[_0x7995('0x30')](_0x7995('0x31'),_0x229742+'-'+_0x49bc7e+'/'+_0x5911c3)[_0x7995('0x2c')](_0x47625f);}return null;};}function patchUpdates(_0x574574){return function(_0x530611){try{jsonpatch['apply'](_0x530611,_0x574574,!![]);}catch(_0x3573be){return BPromise[_0x7995('0x32')](_0x3573be);}return _0x530611[_0x7995('0x33')]();};}function saveUpdates(_0x2b874d,_0x2e3493){return function(_0x1ca460){if(_0x1ca460){return _0x1ca460['update'](_0x2b874d)['then'](function(_0xfa8f15){return _0xfa8f15;});}return null;};}function removeEntity(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x34')]()[_0x7995('0x20')](function(){_0x5524af[_0x7995('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44309d,_0x33e24e){return function(_0x5dd802){if(!_0x5dd802){_0x44309d['sendStatus'](0x194);}return _0x5dd802;};}function handleError(_0x577412,_0x45bc5e){_0x45bc5e=_0x45bc5e||0x1f4;return function(_0x3acfc3){logger['error'](_0x3acfc3[_0x7995('0x35')]);if(_0x3acfc3['name']){delete _0x3acfc3[_0x7995('0x36')];}_0x577412[_0x7995('0x2b')](_0x45bc5e)[_0x7995('0x37')](_0x3acfc3);};}exports['index']=function(_0x52d76d,_0x36d057){var _0x5e67fe={},_0x5d2428={},_0x3e99cd={'count':0x0,'rows':[]};var _0xe328b1=_['map'](db[_0x7995('0x38')][_0x7995('0x39')],function(_0x2b772f){return{'name':_0x2b772f[_0x7995('0x3a')],'type':_0x2b772f[_0x7995('0x3b')]['key']};});_0x5d2428[_0x7995('0x3c')]=_[_0x7995('0x3d')](_0xe328b1,_0x7995('0x36'));_0x5d2428[_0x7995('0x3e')]=_['keys'](_0x52d76d[_0x7995('0x3e')]);_0x5d2428[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5d2428[_0x7995('0x3c')],_0x5d2428[_0x7995('0x3e')]);_0x5e67fe[_0x7995('0x41')]=_['intersection'](_0x5d2428[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x52d76d[_0x7995('0x3e')][_0x7995('0x42')]));_0x5e67fe[_0x7995('0x41')]=_0x5e67fe[_0x7995('0x41')][_0x7995('0x43')]?_0x5e67fe[_0x7995('0x41')]:_0x5d2428[_0x7995('0x3c')];if(!_0x52d76d[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x5e67fe[_0x7995('0x2f')]=qs['limit'](_0x52d76d['query'][_0x7995('0x2f')]);_0x5e67fe[_0x7995('0x2e')]=qs['offset'](_0x52d76d['query'][_0x7995('0x2e')]);}_0x5e67fe['order']=qs['sort'](_0x52d76d[_0x7995('0x3e')][_0x7995('0x46')]);_0x5e67fe[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x52d76d['query'],_0x5d2428[_0x7995('0x3f')]),_0xe328b1);if(_0x52d76d['query']['filter']){_0x5e67fe[_0x7995('0x47')]=_[_0x7995('0x49')](_0x5e67fe[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0xe328b1,function(_0x599ecb){if(_0x599ecb[_0x7995('0x3b')]!==_0x7995('0x4a')){var _0x31b347={};_0x31b347[_0x599ecb[_0x7995('0x36')]]={'$like':'%'+_0x52d76d['query']['filter']+'%'};return _0x31b347;}})});}_0x5e67fe=_[_0x7995('0x49')]({},_0x5e67fe,_0x52d76d['options']);var _0x23c41d={'where':_0x5e67fe['where']};return db[_0x7995('0x38')]['count'](_0x23c41d)[_0x7995('0x20')](function(_0x1b0373){_0x3e99cd['count']=_0x1b0373;if(_0x52d76d[_0x7995('0x3e')][_0x7995('0x4b')]){_0x5e67fe[_0x7995('0x4c')]=[{'all':!![]}];}return db[_0x7995('0x38')]['findAll'](_0x5e67fe);})[_0x7995('0x20')](function(_0x3e787d){_0x3e99cd[_0x7995('0x4d')]=_0x3e787d;return _0x3e99cd;})['then'](respondWithFilteredResult(_0x36d057,_0x5e67fe))[_0x7995('0x4e')](handleError(_0x36d057,null));};exports[_0x7995('0x4f')]=function(_0x511567,_0x3d8ae3){var _0x255313={'raw':![],'where':{'id':_0x511567[_0x7995('0x50')]['id']}},_0x51934b={};_0x51934b[_0x7995('0x3c')]=_['keys'](db[_0x7995('0x38')]['rawAttributes']);_0x51934b[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x511567[_0x7995('0x3e')]);_0x51934b[_0x7995('0x52')]=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],_0x51934b[_0x7995('0x3e')]);_0x255313['attributes']=_[_0x7995('0x40')](_0x51934b[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x511567['query'][_0x7995('0x42')]));_0x255313[_0x7995('0x41')]=_0x255313[_0x7995('0x41')]['length']?_0x255313['attributes']:_0x51934b['model'];if(_0x511567[_0x7995('0x3e')][_0x7995('0x4b')]){_0x255313['include']=[{'all':!![]}];}_0x255313=_[_0x7995('0x49')]({},_0x255313,_0x511567[_0x7995('0x53')]);return db[_0x7995('0x38')][_0x7995('0x54')](_0x255313)[_0x7995('0x20')](handleEntityNotFound(_0x3d8ae3,null))['then'](respondWithResult(_0x3d8ae3,null))[_0x7995('0x4e')](handleError(_0x3d8ae3,null));};exports['create']=function(_0x14fe7f,_0x33c801){return db[_0x7995('0x38')]['create'](_0x14fe7f['body'],{})['then'](respondWithResult(_0x33c801,0xc9))['catch'](handleError(_0x33c801,null));};exports[_0x7995('0x55')]=function(_0x3709de,_0x1a861c){if(_0x3709de[_0x7995('0x56')]['id']){delete _0x3709de[_0x7995('0x56')]['id'];}return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x3709de[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1a861c,null))[_0x7995('0x20')](saveUpdates(_0x3709de[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x1a861c,null))[_0x7995('0x4e')](handleError(_0x1a861c,null));};exports[_0x7995('0x34')]=function(_0x1ea1dc,_0x416133){return db[_0x7995('0x38')][_0x7995('0x54')]({'where':{'id':_0x1ea1dc[_0x7995('0x50')]['id']}})['then'](handleEntityNotFound(_0x416133,null))[_0x7995('0x20')](removeEntity(_0x416133,null))[_0x7995('0x4e')](handleError(_0x416133,null));};exports[_0x7995('0x57')]=function(_0x32c0d3,_0x5d160d,_0x53125a){var _0x402fa0={};var _0x197b52={};var _0x5b9467;var _0x332a85;return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x32c0d3[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x5d160d,null))[_0x7995('0x20')](function(_0x502d43){if(_0x502d43){_0x5b9467=_0x502d43;_0x197b52['model']=_[_0x7995('0x51')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x197b52[_0x7995('0x3e')]=_[_0x7995('0x51')](_0x32c0d3[_0x7995('0x3e')]);_0x197b52[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],_0x197b52['query']);_0x402fa0[_0x7995('0x41')]=_[_0x7995('0x40')](_0x197b52[_0x7995('0x3c')],qs[_0x7995('0x42')](_0x32c0d3['query']['fields']));_0x402fa0[_0x7995('0x41')]=_0x402fa0[_0x7995('0x41')]['length']?_0x402fa0[_0x7995('0x41')]:_0x197b52[_0x7995('0x3c')];_0x402fa0[_0x7995('0x5a')]=qs[_0x7995('0x46')](_0x32c0d3[_0x7995('0x3e')]['sort']);_0x402fa0[_0x7995('0x47')]=qs['filters'](_[_0x7995('0x48')](_0x32c0d3[_0x7995('0x3e')],_0x197b52[_0x7995('0x3f')]));if(_0x32c0d3[_0x7995('0x3e')][_0x7995('0x5b')]){_0x402fa0[_0x7995('0x47')]=_[_0x7995('0x49')](_0x402fa0[_0x7995('0x47')],{'$or':_[_0x7995('0x3d')](_0x402fa0[_0x7995('0x41')],function(_0x2618c4){var _0x234d8d={};_0x234d8d[_0x2618c4]={'$like':'%'+_0x32c0d3['query'][_0x7995('0x5b')]+'%'};return _0x234d8d;})});}_0x402fa0=_[_0x7995('0x49')]({},_0x402fa0,_0x32c0d3[_0x7995('0x53')]);return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x54a2e0){if(_0x54a2e0){_0x332a85=_0x54a2e0['length'];if(!_0x32c0d3[_0x7995('0x3e')][_0x7995('0x44')](_0x7995('0x45'))){_0x402fa0[_0x7995('0x2f')]=qs['limit'](_0x32c0d3[_0x7995('0x3e')]['limit']);_0x402fa0['offset']=qs[_0x7995('0x2e')](_0x32c0d3[_0x7995('0x3e')][_0x7995('0x2e')]);}return _0x5b9467[_0x7995('0x57')](_0x402fa0);}})[_0x7995('0x20')](function(_0x25d9a4){if(_0x25d9a4){return _0x25d9a4?{'count':_0x332a85,'rows':_0x25d9a4}:null;}})[_0x7995('0x20')](respondWithResult(_0x5d160d,null))[_0x7995('0x4e')](handleError(_0x5d160d,null));};exports[_0x7995('0x5c')]=function(_0x2466df,_0x560b0a,_0x2dc1f7){if(_0x2466df[_0x7995('0x56')]['id']){delete _0x2466df[_0x7995('0x56')]['id'];}return db['FreshdeskAccount'][_0x7995('0x58')]({'where':{'id':_0x2466df[_0x7995('0x50')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x560b0a,null))[_0x7995('0x20')](function(_0x3b0d30){if(_0x3b0d30){_0x2466df[_0x7995('0x56')][_0x7995('0x5d')]=_0x3b0d30['id'];_0x2466df[_0x7995('0x56')][_0x7995('0x5e')]=integrations[_0x7995('0x5f')](_0x2466df[_0x7995('0x56')]['channel'],_0x2466df['body'][_0x7995('0x3b')]);_0x2466df[_0x7995('0x56')][_0x7995('0x60')]=integrations[_0x7995('0x61')](_0x2466df['body'][_0x7995('0x62')],_0x2466df[_0x7995('0x56')]['type']);return db['FreshdeskConfiguration'][_0x7995('0x63')](_0x2466df[_0x7995('0x56')],{'include':[{'model':db['FreshdeskField'],'as':_0x7995('0x5e')},{'model':db['FreshdeskField'],'as':_0x7995('0x60')}]});}return null;})[_0x7995('0x20')](respondWithResult(_0x560b0a,null))['catch'](handleError(_0x560b0a,null));};exports['getFields']=function(_0x1f01c0,_0x50c1a4,_0x31b9e6){var _0xa41fff='';return db[_0x7995('0x38')][_0x7995('0x58')]({'where':{'id':_0x1f01c0[_0x7995('0x50')]['id']},'attributes':['id',_0x7995('0x64'),_0x7995('0x65')]})[_0x7995('0x20')](handleEntityNotFound(_0x50c1a4,null))[_0x7995('0x20')](function(_0x117317){if(_0x117317){_0xa41fff=_0x117317[_0x7995('0x64')];var _0x16108c=_0xa41fff[_0x7995('0x66')](-0x1);if(_0x16108c==='/'){_0xa41fff=_0xa41fff[_0x7995('0x67')](0x0,_0xa41fff[_0x7995('0x68')](_0x16108c));}return rp({'method':_0x7995('0x69'),'uri':util[_0x7995('0x6a')](_0x7995('0x6b'),_0xa41fff,_0x7995('0x6c')),'headers':{'Authorization':util[_0x7995('0x6a')](_0x7995('0x6d'),new Buffer(util[_0x7995('0x6a')](_0x7995('0x6e'),_0x117317[_0x7995('0x65')]))[_0x7995('0x6f')](_0x7995('0x70')))},'json':!![]});}})[_0x7995('0x20')](function(_0x34724d){if(_0x34724d){var _0x59efff=[_0x7995('0x71'),_0x7995('0x72'),'agent','description',_0x7995('0x2b'),_0x7995('0x73'),_0x7995('0x74'),_0x7995('0x75'),_0x7995('0x76'),_0x7995('0x74'),'company'];_[_0x7995('0x77')](_0x34724d,function(_0xb68962){return _0x59efff[_0x7995('0x78')](_0xb68962[_0x7995('0x36')])||!_0xb68962[_0x7995('0x79')]&&_0xb68962[_0x7995('0x3b')]!==_0x7995('0x7a')&&_0xb68962[_0x7995('0x3b')]!=='custom_dropdown';});return{'count':_0x34724d[_0x7995('0x43')],'rows':_[_0x7995('0x3d')](_0x34724d,function(_0x5c04c9){return{'id':_0x5c04c9['name'],'name':_0x5c04c9[_0x7995('0x7b')],'custom':!_0x5c04c9[_0x7995('0x79')],'options':_0x5c04c9[_0x7995('0x7c')]?_[_0x7995('0x3d')](_0x5c04c9[_0x7995('0x7c')],function(_0x4a02ea){return{'name':_[_0x7995('0x7d')](_0x4a02ea),'value':_0x4a02ea};}):[]};})};}})[_0x7995('0x20')](respondWithResult(_0x50c1a4,null))['catch'](function(_0x209977){var _0x30b41f=_0x1f01c0['query'][_0x7995('0x7e')]?0x1f4:_0x209977['statusCode']||0x1f4;logger[_0x7995('0x25')](_0x7995('0x7f'),_0x7995('0x80'),_0x30b41f,JSON[_0x7995('0x24')](_0x209977));delete _0x209977[_0x7995('0x36')];if(_0x30b41f===0x191){_0x30b41f=0x190;}_0x50c1a4['status'](_0x30b41f)[_0x7995('0x37')](_0x1f01c0[_0x7995('0x3e')][_0x7995('0x7e')]?{'message':'Wrong\x20credentials','statusCode':_0x209977[_0x7995('0x81')]}:_0x209977);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b40bacc..b5a8038 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 _0xed21=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','int_freshdesk_accounts'];(function(_0xf6b799,_0x1e3997){var _0x4869db=function(_0x477e5e){while(--_0x477e5e){_0xf6b799['push'](_0xf6b799['shift']());}};_0x4869db(++_0x1e3997);}(_0xed21,0xdc));var _0x1ed2=function(_0x71a6e0,_0x19ff83){_0x71a6e0=_0x71a6e0-0x0;var _0x264938=_0xed21[_0x71a6e0];return _0x264938;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1ed2('0x0'))('api');var moment=require(_0x1ed2('0x1'));var BPromise=require('bluebird');var rp=require(_0x1ed2('0x2'));var fs=require('fs');var path=require(_0x1ed2('0x3'));var rimraf=require(_0x1ed2('0x4'));var config=require(_0x1ed2('0x5'));var attributes=require(_0x1ed2('0x6'));var integrations=require(_0x1ed2('0x7'));module[_0x1ed2('0x8')]=function(_0x5914d3,_0x19717e){return _0x5914d3['define']('FreshdeskAccount',attributes,{'tableName':_0x1ed2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5ab=['path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2d0c1d,_0x4f160b){var _0x4ff26d=function(_0xbebd35){while(--_0xbebd35){_0x2d0c1d['push'](_0x2d0c1d['shift']());}};_0x4ff26d(++_0x4f160b);}(_0xd5ab,0xa3));var _0xbd5a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd5ab[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var logger=require(_0xbd5a('0x2'))(_0xbd5a('0x3'));var moment=require('moment');var BPromise=require(_0xbd5a('0x4'));var rp=require(_0xbd5a('0x5'));var fs=require('fs');var path=require(_0xbd5a('0x6'));var rimraf=require('rimraf');var config=require(_0xbd5a('0x7'));var attributes=require(_0xbd5a('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xbd5a('0x9')]=function(_0x2f76e3,_0x1802ae){return _0x2f76e3[_0xbd5a('0xa')](_0xbd5a('0xb'),attributes,{'tableName':_0xbd5a('0xc'),'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 02d8b16..9d2986e 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 _0xe613=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','raw','lodash','bluebird'];(function(_0x14b5a5,_0x231b3a){var _0x2a7706=function(_0x2d451d){while(--_0x2d451d){_0x14b5a5['push'](_0x14b5a5['shift']());}};_0x2a7706(++_0x231b3a);}(_0xe613,0x18a));var _0x3e61=function(_0x3cca6a,_0x70a648){_0x3cca6a=_0x3cca6a-0x0;var _0x545eac=_0xe613[_0x3cca6a];return _0x545eac;};'use strict';var _=require(_0x3e61('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e61('0x1'));var rs=require(_0x3e61('0x2'));var fs=require('fs');var Redis=require(_0x3e61('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e61('0x4'));var logger=require('../../config/logger')(_0x3e61('0x5'));var config=require(_0x3e61('0x6'));var jayson=require(_0x3e61('0x7'));var client=jayson['client'][_0x3e61('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x440fff,_0x54367e,_0x2a5cf7){return new BPromise(function(_0x13eab9,_0x28790c){return client['request'](_0x440fff,_0x2a5cf7)[_0x3e61('0x9')](function(_0x24db15){logger[_0x3e61('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x54367e,_0x3e61('0xb'));logger[_0x3e61('0xc')](_0x3e61('0xd'),_0x54367e,_0x3e61('0xb'),JSON[_0x3e61('0xe')](_0x24db15));if(_0x24db15[_0x3e61('0xf')]){if(_0x24db15[_0x3e61('0xf')]['code']===0x1f4){logger['error'](_0x3e61('0x10'),_0x54367e,_0x24db15['error']['message']);return _0x28790c(_0x24db15['error'][_0x3e61('0x11')]);}logger[_0x3e61('0xf')](_0x3e61('0x10'),_0x54367e,_0x24db15[_0x3e61('0xf')][_0x3e61('0x11')]);return _0x13eab9(_0x24db15['error'][_0x3e61('0x11')]);}else{logger[_0x3e61('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x54367e,_0x3e61('0xb'));_0x13eab9(_0x24db15[_0x3e61('0x12')][_0x3e61('0x11')]);}})[_0x3e61('0x13')](function(_0x21200c){logger[_0x3e61('0xf')](_0x3e61('0x10'),_0x54367e,_0x21200c);_0x28790c(_0x21200c);});});}exports[_0x3e61('0x14')]=function(_0x2803ca){var _0x5460d4=this;return new Promise(function(_0x1aea27,_0x4968ab){return db[_0x3e61('0x15')][_0x3e61('0x16')]({'raw':_0x2803ca['options']?_0x2803ca[_0x3e61('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2803ca[_0x3e61('0x17')]?_0x2803ca['options'][_0x3e61('0x18')]||null:null,'attributes':_0x2803ca['options']?_0x2803ca[_0x3e61('0x17')][_0x3e61('0x19')]||null:null,'limit':_0x2803ca[_0x3e61('0x17')]?_0x2803ca[_0x3e61('0x17')][_0x3e61('0x1a')]||null:null,'include':_0x2803ca[_0x3e61('0x17')]?_0x2803ca['options'][_0x3e61('0x1b')]?_[_0x3e61('0x1c')](_0x2803ca['options'][_0x3e61('0x1b')],function(_0x3c9485){return{'model':db[_0x3c9485[_0x3e61('0x1d')]],'as':_0x3c9485['as'],'attributes':_0x3c9485[_0x3e61('0x19')],'include':_0x3c9485[_0x3e61('0x1b')]?_[_0x3e61('0x1c')](_0x3c9485[_0x3e61('0x1b')],function(_0x5ecb9b){return{'model':db[_0x5ecb9b['model']],'as':_0x5ecb9b['as'],'attributes':_0x5ecb9b[_0x3e61('0x19')],'include':_0x5ecb9b[_0x3e61('0x1b')]?_[_0x3e61('0x1c')](_0x5ecb9b[_0x3e61('0x1b')],function(_0x1277ad){return{'model':db[_0x1277ad[_0x3e61('0x1d')]],'as':_0x1277ad['as'],'attributes':_0x1277ad[_0x3e61('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3e61('0x9')](function(_0x1f8b58){logger[_0x3e61('0xa')](_0x3e61('0x14'),_0x2803ca);logger[_0x3e61('0xc')](_0x3e61('0x14'),_0x2803ca,JSON[_0x3e61('0xe')](_0x1f8b58));_0x1aea27(_0x1f8b58);})[_0x3e61('0x13')](function(_0x57cd29){logger[_0x3e61('0xf')](_0x3e61('0x14'),_0x57cd29[_0x3e61('0x11')],_0x2803ca);_0x4968ab(_0x5460d4['error'](0x1f4,_0x57cd29[_0x3e61('0x11')]));});});};exports[_0x3e61('0x1e')]=function(_0x32bc8c){var _0x33a0dd=this;return new Promise(function(_0x5bcce6,_0xe15de2){return db[_0x3e61('0x15')][_0x3e61('0x1f')]({'raw':_0x32bc8c[_0x3e61('0x17')]?_0x32bc8c[_0x3e61('0x17')][_0x3e61('0x20')]===undefined?!![]:![]:!![],'where':_0x32bc8c['options']?_0x32bc8c[_0x3e61('0x17')][_0x3e61('0x18')]||null:null,'attributes':_0x32bc8c['options']?_0x32bc8c[_0x3e61('0x17')][_0x3e61('0x19')]||null:null,'include':_0x32bc8c[_0x3e61('0x17')]?_0x32bc8c[_0x3e61('0x17')][_0x3e61('0x1b')]?_[_0x3e61('0x1c')](_0x32bc8c[_0x3e61('0x17')]['include'],function(_0x4dd1d6){return{'model':db[_0x4dd1d6['model']],'as':_0x4dd1d6['as'],'attributes':_0x4dd1d6[_0x3e61('0x19')],'include':_0x4dd1d6['include']?_[_0x3e61('0x1c')](_0x4dd1d6[_0x3e61('0x1b')],function(_0x3a815a){return{'model':db[_0x3a815a['model']],'as':_0x3a815a['as'],'attributes':_0x3a815a[_0x3e61('0x19')],'include':_0x3a815a[_0x3e61('0x1b')]?_[_0x3e61('0x1c')](_0x3a815a[_0x3e61('0x1b')],function(_0x5c3b74){return{'model':db[_0x5c3b74[_0x3e61('0x1d')]],'as':_0x5c3b74['as'],'attributes':_0x5c3b74[_0x3e61('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3e61('0x9')](function(_0x3f132a){logger['info']('ShowFreshdeskAccount',_0x32bc8c);logger[_0x3e61('0xc')](_0x3e61('0x1e'),_0x32bc8c,JSON[_0x3e61('0xe')](_0x3f132a));_0x5bcce6(_0x3f132a);})[_0x3e61('0x13')](function(_0x51594c){logger[_0x3e61('0xf')](_0x3e61('0x1e'),_0x51594c['message'],_0x32bc8c);_0xe15de2(_0x33a0dd[_0x3e61('0xf')](0x1f4,_0x51594c[_0x3e61('0x11')]));});});}; \ No newline at end of file +var _0x4f21=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','ioredis'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x4f21,0x12d));var _0x14f2=function(_0x31a655,_0x581842){_0x31a655=_0x31a655-0x0;var _0x361094=_0x4f21[_0x31a655];return _0x361094;};'use strict';var _=require(_0x14f2('0x0'));var util=require(_0x14f2('0x1'));var moment=require(_0x14f2('0x2'));var BPromise=require(_0x14f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14f2('0x4'));var db=require(_0x14f2('0x5'))['db'];var utils=require(_0x14f2('0x6'));var logger=require(_0x14f2('0x7'))(_0x14f2('0x8'));var config=require('../../config/environment');var jayson=require(_0x14f2('0x9'));var client=jayson[_0x14f2('0xa')][_0x14f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x325984,_0x260607,_0x3f0e19){return new BPromise(function(_0x4b164f,_0x4a083e){return client['request'](_0x325984,_0x3f0e19)[_0x14f2('0xc')](function(_0x2577d5){logger[_0x14f2('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x260607,_0x14f2('0xe'));logger[_0x14f2('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x260607,'request\x20sent',JSON[_0x14f2('0x10')](_0x2577d5));if(_0x2577d5[_0x14f2('0x11')]){if(_0x2577d5['error'][_0x14f2('0x12')]===0x1f4){logger[_0x14f2('0x11')](_0x14f2('0x13'),_0x260607,_0x2577d5[_0x14f2('0x11')][_0x14f2('0x14')]);return _0x4a083e(_0x2577d5[_0x14f2('0x11')]['message']);}logger['error'](_0x14f2('0x13'),_0x260607,_0x2577d5[_0x14f2('0x11')]['message']);return _0x4b164f(_0x2577d5[_0x14f2('0x11')][_0x14f2('0x14')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x260607,_0x14f2('0xe'));_0x4b164f(_0x2577d5['result'][_0x14f2('0x14')]);}})[_0x14f2('0x15')](function(_0x3837e9){logger[_0x14f2('0x11')](_0x14f2('0x13'),_0x260607,_0x3837e9);_0x4a083e(_0x3837e9);});});}exports[_0x14f2('0x16')]=function(_0x586ca2){var _0x572ffb=this;return new Promise(function(_0x3239c0,_0x38d4a4){return db[_0x14f2('0x17')]['findAll']({'raw':_0x586ca2[_0x14f2('0x18')]?_0x586ca2[_0x14f2('0x18')][_0x14f2('0x19')]===undefined?!![]:![]:!![],'where':_0x586ca2['options']?_0x586ca2[_0x14f2('0x18')][_0x14f2('0x1a')]||null:null,'attributes':_0x586ca2['options']?_0x586ca2[_0x14f2('0x18')][_0x14f2('0x1b')]||null:null,'limit':_0x586ca2['options']?_0x586ca2[_0x14f2('0x18')][_0x14f2('0x1c')]||null:null,'include':_0x586ca2[_0x14f2('0x18')]?_0x586ca2[_0x14f2('0x18')][_0x14f2('0x1d')]?_[_0x14f2('0x1e')](_0x586ca2[_0x14f2('0x18')][_0x14f2('0x1d')],function(_0x18e193){return{'model':db[_0x18e193[_0x14f2('0x1f')]],'as':_0x18e193['as'],'attributes':_0x18e193[_0x14f2('0x1b')],'include':_0x18e193[_0x14f2('0x1d')]?_['map'](_0x18e193[_0x14f2('0x1d')],function(_0x2ed185){return{'model':db[_0x2ed185[_0x14f2('0x1f')]],'as':_0x2ed185['as'],'attributes':_0x2ed185['attributes'],'include':_0x2ed185[_0x14f2('0x1d')]?_['map'](_0x2ed185[_0x14f2('0x1d')],function(_0x5c3157){return{'model':db[_0x5c3157['model']],'as':_0x5c3157['as'],'attributes':_0x5c3157[_0x14f2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36fbe0){logger[_0x14f2('0xd')](_0x14f2('0x16'),_0x586ca2);logger[_0x14f2('0xf')](_0x14f2('0x16'),_0x586ca2,JSON[_0x14f2('0x10')](_0x36fbe0));_0x3239c0(_0x36fbe0);})['catch'](function(_0x254fa5){logger[_0x14f2('0x11')](_0x14f2('0x16'),_0x254fa5[_0x14f2('0x14')],_0x586ca2);_0x38d4a4(_0x572ffb[_0x14f2('0x11')](0x1f4,_0x254fa5[_0x14f2('0x14')]));});});};exports[_0x14f2('0x20')]=function(_0x59c874){var _0x325d6a=this;return new Promise(function(_0x1fc6ba,_0x5245cc){return db[_0x14f2('0x17')][_0x14f2('0x21')]({'raw':_0x59c874[_0x14f2('0x18')]?_0x59c874[_0x14f2('0x18')][_0x14f2('0x19')]===undefined?!![]:![]:!![],'where':_0x59c874[_0x14f2('0x18')]?_0x59c874[_0x14f2('0x18')]['where']||null:null,'attributes':_0x59c874[_0x14f2('0x18')]?_0x59c874[_0x14f2('0x18')]['attributes']||null:null,'include':_0x59c874[_0x14f2('0x18')]?_0x59c874[_0x14f2('0x18')][_0x14f2('0x1d')]?_['map'](_0x59c874[_0x14f2('0x18')][_0x14f2('0x1d')],function(_0x1a6178){return{'model':db[_0x1a6178['model']],'as':_0x1a6178['as'],'attributes':_0x1a6178['attributes'],'include':_0x1a6178[_0x14f2('0x1d')]?_['map'](_0x1a6178[_0x14f2('0x1d')],function(_0x252c49){return{'model':db[_0x252c49[_0x14f2('0x1f')]],'as':_0x252c49['as'],'attributes':_0x252c49[_0x14f2('0x1b')],'include':_0x252c49[_0x14f2('0x1d')]?_[_0x14f2('0x1e')](_0x252c49[_0x14f2('0x1d')],function(_0x377539){return{'model':db[_0x377539[_0x14f2('0x1f')]],'as':_0x377539['as'],'attributes':_0x377539[_0x14f2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bd728){logger['info']('ShowFreshdeskAccount',_0x59c874);logger[_0x14f2('0xf')](_0x14f2('0x20'),_0x59c874,JSON['stringify'](_0x1bd728));_0x1fc6ba(_0x1bd728);})[_0x14f2('0x15')](function(_0x2d6195){logger[_0x14f2('0x11')]('ShowFreshdeskAccount',_0x2d6195[_0x14f2('0x14')],_0x59c874);_0x5245cc(_0x325d6a[_0x14f2('0x11')](0x1f4,_0x2d6195[_0x14f2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index eb2dfc9..290b63c 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 _0xd04d=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','post','create','put','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd04d,0x9d));var _0xdd04=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd04d[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xdd04('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdd04('0x1'));var router=express[_0xdd04('0x2')]();var auth=require(_0xdd04('0x3'));var interaction=require(_0xdd04('0x4'));var config=require(_0xdd04('0x5'));var controller=require(_0xdd04('0x6'));router[_0xdd04('0x7')]('/',auth[_0xdd04('0x8')](),controller[_0xdd04('0x9')]);router[_0xdd04('0x7')](_0xdd04('0xa'),auth['isAuthenticated'](),controller[_0xdd04('0xb')]);router['get'](_0xdd04('0xc'),auth[_0xdd04('0x8')](),controller[_0xdd04('0xd')]);router[_0xdd04('0x7')](_0xdd04('0xe'),auth[_0xdd04('0x8')](),controller[_0xdd04('0xf')]);router[_0xdd04('0x7')](_0xdd04('0x10'),auth[_0xdd04('0x8')](),controller['getDescriptions']);router[_0xdd04('0x7')](_0xdd04('0x11'),auth[_0xdd04('0x8')](),controller['getTags']);router[_0xdd04('0x12')]('/',auth[_0xdd04('0x8')](),controller[_0xdd04('0x13')]);router[_0xdd04('0x12')](_0xdd04('0x11'),auth[_0xdd04('0x8')](),controller['setTags']);router[_0xdd04('0x14')](_0xdd04('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdd04('0x15')](_0xdd04('0xa'),auth[_0xdd04('0x8')](),controller[_0xdd04('0x16')]);module[_0xdd04('0x17')]=router; \ No newline at end of file +var _0x72e2=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','/:id'];(function(_0x1ce7cf,_0x3b2308){var _0x1fcdc3=function(_0x1667cd){while(--_0x1667cd){_0x1ce7cf['push'](_0x1ce7cf['shift']());}};_0x1fcdc3(++_0x3b2308);}(_0x72e2,0x13b));var _0x272e=function(_0x405f36,_0x360931){_0x405f36=_0x405f36-0x0;var _0x522905=_0x72e2[_0x405f36];return _0x522905;};'use strict';var multer=require(_0x272e('0x0'));var util=require(_0x272e('0x1'));var path=require(_0x272e('0x2'));var timeout=require(_0x272e('0x3'));var express=require('express');var router=express[_0x272e('0x4')]();var auth=require(_0x272e('0x5'));var interaction=require(_0x272e('0x6'));var config=require('../../config/environment');var controller=require(_0x272e('0x7'));router[_0x272e('0x8')]('/',auth[_0x272e('0x9')](),controller[_0x272e('0xa')]);router['get']('/:id',auth[_0x272e('0x9')](),controller[_0x272e('0xb')]);router['get'](_0x272e('0xc'),auth['isAuthenticated'](),controller[_0x272e('0xd')]);router[_0x272e('0x8')](_0x272e('0xe'),auth[_0x272e('0x9')](),controller['getSubjects']);router[_0x272e('0x8')](_0x272e('0xf'),auth[_0x272e('0x9')](),controller['getDescriptions']);router[_0x272e('0x8')](_0x272e('0x10'),auth[_0x272e('0x9')](),controller[_0x272e('0x11')]);router[_0x272e('0x12')]('/',auth[_0x272e('0x9')](),controller[_0x272e('0x13')]);router[_0x272e('0x12')](_0x272e('0x10'),auth[_0x272e('0x9')](),controller[_0x272e('0x14')]);router[_0x272e('0x15')](_0x272e('0x16'),auth[_0x272e('0x9')](),controller[_0x272e('0x17')]);router['delete'](_0x272e('0x16'),auth[_0x272e('0x9')](),controller[_0x272e('0x18')]);module[_0x272e('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2efa5e4..8b2c0f3 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 _0x738f=['STRING','sequelize','exports'];(function(_0x5b5b6c,_0x53606d){var _0x473c9e=function(_0x56f079){while(--_0x56f079){_0x5b5b6c['push'](_0x5b5b6c['shift']());}};_0x473c9e(++_0x53606d);}(_0x738f,0x79));var _0xf738=function(_0x466d24,_0x3a3d6c){_0x466d24=_0x466d24-0x0;var _0x535da6=_0x738f[_0x466d24];return _0x535da6;};'use strict';var Sequelize=require(_0xf738('0x0'));module[_0xf738('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf738('0x2')]}}; \ No newline at end of file +var _0x29f0=['sequelize','exports','STRING'];(function(_0x554af6,_0x217896){var _0x643d6=function(_0x39ce57){while(--_0x39ce57){_0x554af6['push'](_0x554af6['shift']());}};_0x643d6(++_0x217896);}(_0x29f0,0x9f));var _0x029f=function(_0x332e1b,_0x5ccedb){_0x332e1b=_0x332e1b-0x0;var _0x4f0afd=_0x29f0[_0x332e1b];return _0x4f0afd;};'use strict';var Sequelize=require(_0x029f('0x0'));module[_0x029f('0x1')]={'name':{'type':Sequelize[_0x029f('0x2')]},'description':{'type':Sequelize[_0x029f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index cd16fef..8eb0158 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 _0x0758=['catch','status','end','json','count','offset','set','Content-Range','apply','reject','update','sendStatus','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','FreshdeskConfiguration','includeAll','include','findAll','rows','show','params','options','find','create','body','destroy','findOne','FreshdeskField','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3ddb52,_0x7790cf){var _0x378940=function(_0x49dbbb){while(--_0x49dbbb){_0x3ddb52['push'](_0x3ddb52['shift']());}};_0x378940(++_0x7790cf);}(_0x0758,0x152));var _0x8075=function(_0x30ed80,_0x196b87){_0x30ed80=_0x30ed80-0x0;var _0x324bab=_0x0758[_0x30ed80];return _0x324bab;};'use strict';var pdf=require(_0x8075('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8075('0x1'));var zipdir=require(_0x8075('0x2'));var jsonpatch=require(_0x8075('0x3'));var rp=require(_0x8075('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8075('0x5'));var util=require(_0x8075('0x6'));var path=require(_0x8075('0x7'));var sox=require(_0x8075('0x8'));var csv=require('to-csv');var ejs=require(_0x8075('0x9'));var fs=require('fs');var _=require(_0x8075('0xa'));var squel=require('squel');var crypto=require(_0x8075('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8075('0xc'));var Papa=require(_0x8075('0xd'));var Redis=require(_0x8075('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8075('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8075('0x10'));var utils=require(_0x8075('0x11'));var config=require(_0x8075('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x8075('0x13'))['db'];var jayson=require(_0x8075('0x14'));var client=jayson[_0x8075('0x15')][_0x8075('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3ca456,_0x338b7a,_0x3168f8,_0x1ffd92){return new BPromise(function(_0x42e10f,_0x4f3656){var _0x46d499=_0x1ffd92||client;return _0x46d499[_0x8075('0x17')](_0x3ca456,_0x3168f8)[_0x8075('0x18')](function(_0x15cf27){logger[_0x8075('0x19')](_0x8075('0x1a'),_0x338b7a,_0x8075('0x1b'));logger[_0x8075('0x1c')](_0x8075('0x1d'),_0x338b7a,_0x8075('0x1b'),JSON[_0x8075('0x1e')](_0x15cf27));if(_0x15cf27[_0x8075('0x1f')]){if(_0x15cf27[_0x8075('0x1f')][_0x8075('0x20')]===0x1f4){logger[_0x8075('0x1f')](_0x8075('0x1a'),_0x338b7a,_0x15cf27['error'][_0x8075('0x21')]);return _0x4f3656(_0x15cf27[_0x8075('0x1f')][_0x8075('0x21')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x338b7a,_0x15cf27[_0x8075('0x1f')][_0x8075('0x21')]);return _0x42e10f(_0x15cf27['error'][_0x8075('0x21')]);}else{logger['info'](_0x8075('0x1a'),_0x338b7a,_0x8075('0x1b'));_0x42e10f(_0x15cf27['result'][_0x8075('0x21')]);}})[_0x8075('0x22')](function(_0x50848f){logger[_0x8075('0x1f')](_0x8075('0x1a'),_0x338b7a,_0x50848f);_0x4f3656(_0x50848f);});});}function respondWithStatusCode(_0x47d316,_0x8ec063){_0x8ec063=_0x8ec063||0xcc;return function(_0x4acbcd){if(_0x4acbcd){return _0x47d316['sendStatus'](_0x8ec063);}return _0x47d316[_0x8075('0x23')](_0x8ec063)[_0x8075('0x24')]();};}function respondWithResult(_0x16cbd5,_0x505d7c){_0x505d7c=_0x505d7c||0xc8;return function(_0x80ec7e){if(_0x80ec7e){return _0x16cbd5[_0x8075('0x23')](_0x505d7c)[_0x8075('0x25')](_0x80ec7e);}};}function respondWithFilteredResult(_0x2a125a,_0x322e45){return function(_0x45fa3f){if(_0x45fa3f){var _0x5e3763=_0x45fa3f[_0x8075('0x26')],_0x115d97=_0x322e45[_0x8075('0x27')],_0x55a29e=_0x322e45[_0x8075('0x27')]+_0x322e45['limit'],_0x235b3b;if(_0x55a29e>=_0x5e3763){_0x55a29e=_0x5e3763;_0x235b3b=0xc8;}else{_0x235b3b=0xce;}_0x2a125a[_0x8075('0x23')](_0x235b3b);return _0x2a125a[_0x8075('0x28')](_0x8075('0x29'),_0x115d97+'-'+_0x55a29e+'/'+_0x5e3763)[_0x8075('0x25')](_0x45fa3f);}return null;};}function patchUpdates(_0x44139c){return function(_0x5ec4ff){try{jsonpatch[_0x8075('0x2a')](_0x5ec4ff,_0x44139c,!![]);}catch(_0x3f0f2c){return BPromise[_0x8075('0x2b')](_0x3f0f2c);}return _0x5ec4ff['save']();};}function saveUpdates(_0x4d6a3c,_0x8d5547){return function(_0x35cd6e){if(_0x35cd6e){return _0x35cd6e[_0x8075('0x2c')](_0x4d6a3c)[_0x8075('0x18')](function(_0x23fbff){return _0x23fbff;});}return null;};}function removeEntity(_0x525d3a,_0x219c0a){return function(_0x5bc0a5){if(_0x5bc0a5){return _0x5bc0a5['destroy']()[_0x8075('0x18')](function(){_0x525d3a['status'](0xcc)[_0x8075('0x24')]();});}};}function handleEntityNotFound(_0x5d9bb6,_0x21696a){return function(_0x14fccc){if(!_0x14fccc){_0x5d9bb6[_0x8075('0x2d')](0x194);}return _0x14fccc;};}function handleError(_0x1d5394,_0x341f23){_0x341f23=_0x341f23||0x1f4;return function(_0x3dcd7a){logger[_0x8075('0x1f')](_0x3dcd7a[_0x8075('0x2e')]);if(_0x3dcd7a[_0x8075('0x2f')]){delete _0x3dcd7a['name'];}_0x1d5394[_0x8075('0x23')](_0x341f23)['send'](_0x3dcd7a);};}exports[_0x8075('0x30')]=function(_0x4171a8,_0x5bd23c){var _0xe97045={},_0x16a477={},_0x165c82={'count':0x0,'rows':[]};var _0x4b4dde=_['map'](db['FreshdeskConfiguration'][_0x8075('0x31')],function(_0x41e921){return{'name':_0x41e921[_0x8075('0x32')],'type':_0x41e921['type'][_0x8075('0x33')]};});_0x16a477[_0x8075('0x34')]=_[_0x8075('0x35')](_0x4b4dde,_0x8075('0x2f'));_0x16a477[_0x8075('0x36')]=_[_0x8075('0x37')](_0x4171a8['query']);_0x16a477[_0x8075('0x38')]=_['intersection'](_0x16a477[_0x8075('0x34')],_0x16a477[_0x8075('0x36')]);_0xe97045[_0x8075('0x39')]=_[_0x8075('0x3a')](_0x16a477[_0x8075('0x34')],qs[_0x8075('0x3b')](_0x4171a8[_0x8075('0x36')][_0x8075('0x3b')]));_0xe97045[_0x8075('0x39')]=_0xe97045[_0x8075('0x39')][_0x8075('0x3c')]?_0xe97045[_0x8075('0x39')]:_0x16a477['model'];if(!_0x4171a8[_0x8075('0x36')][_0x8075('0x3d')]('nolimit')){_0xe97045[_0x8075('0x3e')]=qs[_0x8075('0x3e')](_0x4171a8[_0x8075('0x36')][_0x8075('0x3e')]);_0xe97045[_0x8075('0x27')]=qs[_0x8075('0x27')](_0x4171a8[_0x8075('0x36')][_0x8075('0x27')]);}_0xe97045[_0x8075('0x3f')]=qs['sort'](_0x4171a8[_0x8075('0x36')][_0x8075('0x40')]);_0xe97045['where']=qs['filters'](_[_0x8075('0x41')](_0x4171a8[_0x8075('0x36')],_0x16a477[_0x8075('0x38')]),_0x4b4dde);if(_0x4171a8[_0x8075('0x36')][_0x8075('0x42')]){_0xe97045[_0x8075('0x43')]=_[_0x8075('0x44')](_0xe97045[_0x8075('0x43')],{'$or':_['map'](_0x4b4dde,function(_0x908afd){if(_0x908afd[_0x8075('0x45')]!==_0x8075('0x46')){var _0x15c77f={};_0x15c77f[_0x908afd[_0x8075('0x2f')]]={'$like':'%'+_0x4171a8[_0x8075('0x36')][_0x8075('0x42')]+'%'};return _0x15c77f;}})});}_0xe97045=_[_0x8075('0x44')]({},_0xe97045,_0x4171a8['options']);var _0x3cdebe={'where':_0xe97045[_0x8075('0x43')]};return db[_0x8075('0x47')][_0x8075('0x26')](_0x3cdebe)[_0x8075('0x18')](function(_0x22d0f6){_0x165c82[_0x8075('0x26')]=_0x22d0f6;if(_0x4171a8[_0x8075('0x36')][_0x8075('0x48')]){_0xe97045[_0x8075('0x49')]=[{'all':!![]}];}return db[_0x8075('0x47')][_0x8075('0x4a')](_0xe97045);})[_0x8075('0x18')](function(_0xb3be68){_0x165c82[_0x8075('0x4b')]=_0xb3be68;return _0x165c82;})[_0x8075('0x18')](respondWithFilteredResult(_0x5bd23c,_0xe97045))['catch'](handleError(_0x5bd23c,null));};exports[_0x8075('0x4c')]=function(_0x4c13b4,_0x5f372c){var _0x55b44b={'raw':![],'where':{'id':_0x4c13b4[_0x8075('0x4d')]['id']}},_0x429256={};_0x429256[_0x8075('0x34')]=_[_0x8075('0x37')](db[_0x8075('0x47')][_0x8075('0x31')]);_0x429256[_0x8075('0x36')]=_[_0x8075('0x37')](_0x4c13b4['query']);_0x429256['filtears']=_[_0x8075('0x3a')](_0x429256['model'],_0x429256[_0x8075('0x36')]);_0x55b44b[_0x8075('0x39')]=_[_0x8075('0x3a')](_0x429256['model'],qs[_0x8075('0x3b')](_0x4c13b4['query'][_0x8075('0x3b')]));_0x55b44b['attributes']=_0x55b44b[_0x8075('0x39')][_0x8075('0x3c')]?_0x55b44b['attributes']:_0x429256[_0x8075('0x34')];if(_0x4c13b4['query'][_0x8075('0x48')]){_0x55b44b[_0x8075('0x49')]=[{'all':!![]}];}_0x55b44b=_[_0x8075('0x44')]({},_0x55b44b,_0x4c13b4[_0x8075('0x4e')]);return db['FreshdeskConfiguration'][_0x8075('0x4f')](_0x55b44b)[_0x8075('0x18')](handleEntityNotFound(_0x5f372c,null))[_0x8075('0x18')](respondWithResult(_0x5f372c,null))[_0x8075('0x22')](handleError(_0x5f372c,null));};exports[_0x8075('0x50')]=function(_0x372496,_0x1648c0){return db[_0x8075('0x47')][_0x8075('0x50')](_0x372496[_0x8075('0x51')],{})[_0x8075('0x18')](respondWithResult(_0x1648c0,0xc9))[_0x8075('0x22')](handleError(_0x1648c0,null));};exports['update']=function(_0x54477d,_0x4a2cd1){if(_0x54477d[_0x8075('0x51')]['id']){delete _0x54477d[_0x8075('0x51')]['id'];}return db[_0x8075('0x47')][_0x8075('0x4f')]({'where':{'id':_0x54477d[_0x8075('0x4d')]['id']}})[_0x8075('0x18')](handleEntityNotFound(_0x4a2cd1,null))[_0x8075('0x18')](saveUpdates(_0x54477d['body'],null))[_0x8075('0x18')](respondWithResult(_0x4a2cd1,null))[_0x8075('0x22')](handleError(_0x4a2cd1,null));};exports[_0x8075('0x52')]=function(_0x59bd6a,_0x55e1fa){return db[_0x8075('0x47')]['find']({'where':{'id':_0x59bd6a[_0x8075('0x4d')]['id']}})[_0x8075('0x18')](handleEntityNotFound(_0x55e1fa,null))[_0x8075('0x18')](removeEntity(_0x55e1fa,null))[_0x8075('0x22')](handleError(_0x55e1fa,null));};exports['getFields']=function(_0x127141,_0x4f6c4c,_0x239e58){var _0x28c48f={};var _0x2af966={};var _0x5748f5;var _0x3d8f07;return db['FreshdeskConfiguration'][_0x8075('0x53')]({'where':{'id':_0x127141[_0x8075('0x4d')]['id']}})[_0x8075('0x18')](handleEntityNotFound(_0x4f6c4c,null))[_0x8075('0x18')](function(_0x2372b5){if(_0x2372b5){_0x5748f5=_0x2372b5;_0x2af966[_0x8075('0x34')]=_['keys'](db[_0x8075('0x54')][_0x8075('0x31')]);_0x2af966[_0x8075('0x36')]=_[_0x8075('0x37')](_0x127141[_0x8075('0x36')]);_0x2af966[_0x8075('0x38')]=_['intersection'](_0x2af966['model'],_0x2af966[_0x8075('0x36')]);_0x28c48f[_0x8075('0x39')]=_[_0x8075('0x3a')](_0x2af966[_0x8075('0x34')],qs[_0x8075('0x3b')](_0x127141['query']['fields']));_0x28c48f['attributes']=_0x28c48f['attributes']['length']?_0x28c48f[_0x8075('0x39')]:_0x2af966[_0x8075('0x34')];_0x28c48f[_0x8075('0x3f')]=qs['sort'](_0x127141['query']['sort']);_0x28c48f['where']=qs[_0x8075('0x38')](_[_0x8075('0x41')](_0x127141[_0x8075('0x36')],_0x2af966[_0x8075('0x38')]));if(_0x127141[_0x8075('0x36')][_0x8075('0x42')]){_0x28c48f[_0x8075('0x43')]=_[_0x8075('0x44')](_0x28c48f['where'],{'$or':_[_0x8075('0x35')](_0x28c48f[_0x8075('0x39')],function(_0x3b2d36){var _0x47c1c0={};_0x47c1c0[_0x3b2d36]={'$like':'%'+_0x127141[_0x8075('0x36')][_0x8075('0x42')]+'%'};return _0x47c1c0;})});}_0x28c48f=_['merge']({},_0x28c48f,_0x127141[_0x8075('0x4e')]);return _0x5748f5[_0x8075('0x55')](_0x28c48f);}})[_0x8075('0x18')](function(_0x84f52c){if(_0x84f52c){_0x3d8f07=_0x84f52c[_0x8075('0x3c')];if(!_0x127141[_0x8075('0x36')][_0x8075('0x3d')](_0x8075('0x56'))){_0x28c48f[_0x8075('0x3e')]=qs[_0x8075('0x3e')](_0x127141[_0x8075('0x36')]['limit']);_0x28c48f[_0x8075('0x27')]=qs[_0x8075('0x27')](_0x127141[_0x8075('0x36')]['offset']);}return _0x5748f5[_0x8075('0x55')](_0x28c48f);}})[_0x8075('0x18')](function(_0x16334d){if(_0x16334d){return _0x16334d?{'count':_0x3d8f07,'rows':_0x16334d}:null;}})[_0x8075('0x18')](respondWithResult(_0x4f6c4c,null))[_0x8075('0x22')](handleError(_0x4f6c4c,null));};exports[_0x8075('0x57')]=function(_0x412740,_0x24646b,_0x5060e6){var _0x4f229b={};var _0x182ea5={};var _0x3f681f;var _0x129449;return db['FreshdeskConfiguration'][_0x8075('0x53')]({'where':{'id':_0x412740[_0x8075('0x4d')]['id']}})[_0x8075('0x18')](handleEntityNotFound(_0x24646b,null))[_0x8075('0x18')](function(_0x3702da){if(_0x3702da){_0x3f681f=_0x3702da;_0x182ea5[_0x8075('0x34')]=_[_0x8075('0x37')](db['FreshdeskField']['rawAttributes']);_0x182ea5['query']=_[_0x8075('0x37')](_0x412740[_0x8075('0x36')]);_0x182ea5['filters']=_[_0x8075('0x3a')](_0x182ea5['model'],_0x182ea5[_0x8075('0x36')]);_0x4f229b[_0x8075('0x39')]=_[_0x8075('0x3a')](_0x182ea5[_0x8075('0x34')],qs[_0x8075('0x3b')](_0x412740[_0x8075('0x36')]['fields']));_0x4f229b[_0x8075('0x39')]=_0x4f229b['attributes'][_0x8075('0x3c')]?_0x4f229b[_0x8075('0x39')]:_0x182ea5[_0x8075('0x34')];_0x4f229b['order']=qs[_0x8075('0x40')](_0x412740[_0x8075('0x36')][_0x8075('0x40')]);_0x4f229b['where']=qs['filters'](_[_0x8075('0x41')](_0x412740[_0x8075('0x36')],_0x182ea5[_0x8075('0x38')]));if(_0x412740[_0x8075('0x36')]['filter']){_0x4f229b[_0x8075('0x43')]=_['merge'](_0x4f229b[_0x8075('0x43')],{'$or':_[_0x8075('0x35')](_0x4f229b[_0x8075('0x39')],function(_0xa22a76){var _0xbc0445={};_0xbc0445[_0xa22a76]={'$like':'%'+_0x412740[_0x8075('0x36')][_0x8075('0x42')]+'%'};return _0xbc0445;})});}_0x4f229b=_['merge']({},_0x4f229b,_0x412740[_0x8075('0x4e')]);return _0x3f681f[_0x8075('0x57')](_0x4f229b);}})['then'](function(_0x414887){if(_0x414887){_0x129449=_0x414887['length'];if(!_0x412740[_0x8075('0x36')]['hasOwnProperty']('nolimit')){_0x4f229b['limit']=qs[_0x8075('0x3e')](_0x412740[_0x8075('0x36')][_0x8075('0x3e')]);_0x4f229b[_0x8075('0x27')]=qs[_0x8075('0x27')](_0x412740[_0x8075('0x36')]['offset']);}return _0x3f681f[_0x8075('0x57')](_0x4f229b);}})[_0x8075('0x18')](function(_0xb382d0){if(_0xb382d0){return _0xb382d0?{'count':_0x129449,'rows':_0xb382d0}:null;}})['then'](respondWithResult(_0x24646b,null))[_0x8075('0x22')](handleError(_0x24646b,null));};exports[_0x8075('0x58')]=function(_0x4136c6,_0x152416,_0x3206c5){var _0x4cbefc={};var _0x38cb1d={};var _0x4e82e9;var _0x298eee;return db[_0x8075('0x47')][_0x8075('0x53')]({'where':{'id':_0x4136c6[_0x8075('0x4d')]['id']}})['then'](handleEntityNotFound(_0x152416,null))['then'](function(_0x4bb0f8){if(_0x4bb0f8){_0x4e82e9=_0x4bb0f8;_0x38cb1d[_0x8075('0x34')]=_[_0x8075('0x37')](db[_0x8075('0x54')][_0x8075('0x31')]);_0x38cb1d['query']=_[_0x8075('0x37')](_0x4136c6[_0x8075('0x36')]);_0x38cb1d[_0x8075('0x38')]=_[_0x8075('0x3a')](_0x38cb1d[_0x8075('0x34')],_0x38cb1d['query']);_0x4cbefc['attributes']=_[_0x8075('0x3a')](_0x38cb1d[_0x8075('0x34')],qs[_0x8075('0x3b')](_0x4136c6[_0x8075('0x36')][_0x8075('0x3b')]));_0x4cbefc[_0x8075('0x39')]=_0x4cbefc[_0x8075('0x39')]['length']?_0x4cbefc[_0x8075('0x39')]:_0x38cb1d[_0x8075('0x34')];_0x4cbefc[_0x8075('0x3f')]=qs['sort'](_0x4136c6[_0x8075('0x36')][_0x8075('0x40')]);_0x4cbefc[_0x8075('0x43')]=qs['filters'](_['pick'](_0x4136c6[_0x8075('0x36')],_0x38cb1d['filters']));if(_0x4136c6[_0x8075('0x36')][_0x8075('0x42')]){_0x4cbefc[_0x8075('0x43')]=_[_0x8075('0x44')](_0x4cbefc[_0x8075('0x43')],{'$or':_[_0x8075('0x35')](_0x4cbefc[_0x8075('0x39')],function(_0x3b9ce5){var _0x3d3c15={};_0x3d3c15[_0x3b9ce5]={'$like':'%'+_0x4136c6[_0x8075('0x36')]['filter']+'%'};return _0x3d3c15;})});}_0x4cbefc=_['merge']({},_0x4cbefc,_0x4136c6['options']);return _0x4e82e9[_0x8075('0x58')](_0x4cbefc);}})[_0x8075('0x18')](function(_0x1a8ecc){if(_0x1a8ecc){_0x298eee=_0x1a8ecc[_0x8075('0x3c')];if(!_0x4136c6[_0x8075('0x36')]['hasOwnProperty'](_0x8075('0x56'))){_0x4cbefc['limit']=qs[_0x8075('0x3e')](_0x4136c6[_0x8075('0x36')]['limit']);_0x4cbefc[_0x8075('0x27')]=qs[_0x8075('0x27')](_0x4136c6[_0x8075('0x36')][_0x8075('0x27')]);}return _0x4e82e9[_0x8075('0x58')](_0x4cbefc);}})[_0x8075('0x18')](function(_0x205b0){if(_0x205b0){return _0x205b0?{'count':_0x298eee,'rows':_0x205b0}:null;}})['then'](respondWithResult(_0x152416,null))[_0x8075('0x22')](handleError(_0x152416,null));};exports[_0x8075('0x59')]=function(_0x4c0c42,_0x243501,_0x31d22a){var _0x3faa07={};var _0x52e44c={};var _0x4acf81;var _0x1d47dd;return db[_0x8075('0x47')]['findOne']({'where':{'id':_0x4c0c42[_0x8075('0x4d')]['id']}})[_0x8075('0x18')](handleEntityNotFound(_0x243501,null))[_0x8075('0x18')](function(_0x164677){if(_0x164677){_0x4acf81=_0x164677;_0x52e44c[_0x8075('0x34')]=_[_0x8075('0x37')](db[_0x8075('0x5a')][_0x8075('0x31')]);_0x52e44c[_0x8075('0x36')]=_[_0x8075('0x37')](_0x4c0c42[_0x8075('0x36')]);_0x52e44c[_0x8075('0x38')]=_[_0x8075('0x3a')](_0x52e44c[_0x8075('0x34')],_0x52e44c[_0x8075('0x36')]);_0x3faa07[_0x8075('0x39')]=_['intersection'](_0x52e44c[_0x8075('0x34')],qs['fields'](_0x4c0c42[_0x8075('0x36')]['fields']));_0x3faa07[_0x8075('0x39')]=_0x3faa07['attributes'][_0x8075('0x3c')]?_0x3faa07[_0x8075('0x39')]:_0x52e44c[_0x8075('0x34')];_0x3faa07[_0x8075('0x3f')]=qs[_0x8075('0x40')](_0x4c0c42[_0x8075('0x36')][_0x8075('0x40')]);_0x3faa07[_0x8075('0x43')]=qs['filters'](_[_0x8075('0x41')](_0x4c0c42[_0x8075('0x36')],_0x52e44c['filters']));if(_0x4c0c42['query']['filter']){_0x3faa07[_0x8075('0x43')]=_[_0x8075('0x44')](_0x3faa07['where'],{'$or':_['map'](_0x3faa07[_0x8075('0x39')],function(_0x7d0d89){var _0x2eff9b={};_0x2eff9b[_0x7d0d89]={'$like':'%'+_0x4c0c42['query'][_0x8075('0x42')]+'%'};return _0x2eff9b;})});}_0x3faa07=_[_0x8075('0x44')]({},_0x3faa07,_0x4c0c42['options']);return _0x4acf81[_0x8075('0x59')](_0x3faa07);}})['then'](function(_0x51b657){if(_0x51b657){_0x1d47dd=_0x51b657['length'];if(!_0x4c0c42['query'][_0x8075('0x3d')](_0x8075('0x56'))){_0x3faa07['limit']=qs[_0x8075('0x3e')](_0x4c0c42[_0x8075('0x36')][_0x8075('0x3e')]);_0x3faa07[_0x8075('0x27')]=qs[_0x8075('0x27')](_0x4c0c42[_0x8075('0x36')][_0x8075('0x27')]);}return _0x4acf81[_0x8075('0x59')](_0x3faa07);}})[_0x8075('0x18')](function(_0x46e664){if(_0x46e664){return _0x46e664?{'count':_0x1d47dd,'rows':_0x46e664}:null;}})[_0x8075('0x18')](respondWithResult(_0x243501,null))['catch'](handleError(_0x243501,null));};exports['setTags']=function(_0x217c67,_0x364ec2,_0x27c9a8){if(_0x217c67[_0x8075('0x51')]['id']){delete _0x217c67['body']['id'];}return db[_0x8075('0x47')][_0x8075('0x53')]({'where':{'id':_0x217c67[_0x8075('0x4d')]['id']}})['then'](handleEntityNotFound(_0x364ec2,null))[_0x8075('0x18')](function(_0x5b5d75){if(_0x5b5d75){return _0x5b5d75[_0x8075('0x5b')](_0x217c67[_0x8075('0x51')][_0x8075('0x5c')]||[]);}return null;})[_0x8075('0x18')](respondWithResult(_0x364ec2,null))[_0x8075('0x22')](handleError(_0x364ec2,null));}; \ No newline at end of file +var _0xe4bb=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','FreshdeskConfiguration','show','params','filtears','length','includeAll','include','find','create','body','getFields','findOne','keys','getSubjects','FreshdeskField','getDescriptions','pick','Tag','getTags','setTags','ids','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info'];(function(_0x31f280,_0x1dbe08){var _0x353349=function(_0x91fd96){while(--_0x91fd96){_0x31f280['push'](_0x31f280['shift']());}};_0x353349(++_0x1dbe08);}(_0xe4bb,0x9d));var _0xbe4b=function(_0x16714e,_0x31cff8){_0x16714e=_0x16714e-0x0;var _0x289063=_0xe4bb[_0x16714e];return _0x289063;};'use strict';var pdf=require(_0xbe4b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe4b('0x2'));var rp=require(_0xbe4b('0x3'));var moment=require(_0xbe4b('0x4'));var BPromise=require(_0xbe4b('0x5'));var Mustache=require(_0xbe4b('0x6'));var util=require(_0xbe4b('0x7'));var path=require('path');var sox=require(_0xbe4b('0x8'));var csv=require(_0xbe4b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbe4b('0xa'));var squel=require(_0xbe4b('0xb'));var crypto=require(_0xbe4b('0xc'));var jsforce=require(_0xbe4b('0xd'));var deskjs=require(_0xbe4b('0xe'));var toCsv=require(_0xbe4b('0x9'));var querystring=require(_0xbe4b('0xf'));var Papa=require(_0xbe4b('0x10'));var Redis=require(_0xbe4b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbe4b('0x12'));var as=require(_0xbe4b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe4b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbe4b('0x15'));var licenseUtil=require(_0xbe4b('0x16'));var db=require(_0xbe4b('0x17'))['db'];var jayson=require(_0xbe4b('0x18'));var client=jayson[_0xbe4b('0x19')][_0xbe4b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3b1e90,_0x56a788,_0x2491d4,_0x5408bf){return new BPromise(function(_0xbd8660,_0x43eb93){var _0x143b84=_0x5408bf||client;return _0x143b84['request'](_0x3b1e90,_0x2491d4)[_0xbe4b('0x1b')](function(_0x3ebc9f){logger[_0xbe4b('0x1c')](_0xbe4b('0x1d'),_0x56a788,_0xbe4b('0x1e'));logger[_0xbe4b('0x1f')](_0xbe4b('0x20'),_0x56a788,_0xbe4b('0x1e'),JSON[_0xbe4b('0x21')](_0x3ebc9f));if(_0x3ebc9f[_0xbe4b('0x22')]){if(_0x3ebc9f[_0xbe4b('0x22')][_0xbe4b('0x23')]===0x1f4){logger['error'](_0xbe4b('0x1d'),_0x56a788,_0x3ebc9f[_0xbe4b('0x22')][_0xbe4b('0x24')]);return _0x43eb93(_0x3ebc9f[_0xbe4b('0x22')][_0xbe4b('0x24')]);}logger['error'](_0xbe4b('0x1d'),_0x56a788,_0x3ebc9f['error'][_0xbe4b('0x24')]);return _0xbd8660(_0x3ebc9f[_0xbe4b('0x22')][_0xbe4b('0x24')]);}else{logger[_0xbe4b('0x1c')](_0xbe4b('0x1d'),_0x56a788,_0xbe4b('0x1e'));_0xbd8660(_0x3ebc9f['result'][_0xbe4b('0x24')]);}})[_0xbe4b('0x25')](function(_0x322f9a){logger[_0xbe4b('0x22')](_0xbe4b('0x1d'),_0x56a788,_0x322f9a);_0x43eb93(_0x322f9a);});});}function respondWithStatusCode(_0x485473,_0x49f63e){_0x49f63e=_0x49f63e||0xcc;return function(_0x59d535){if(_0x59d535){return _0x485473[_0xbe4b('0x26')](_0x49f63e);}return _0x485473[_0xbe4b('0x27')](_0x49f63e)[_0xbe4b('0x28')]();};}function respondWithResult(_0xac3bdc,_0x7e229){_0x7e229=_0x7e229||0xc8;return function(_0x19c91e){if(_0x19c91e){return _0xac3bdc[_0xbe4b('0x27')](_0x7e229)[_0xbe4b('0x29')](_0x19c91e);}};}function respondWithFilteredResult(_0x2acc01,_0x104c0e){return function(_0xf0da9f){if(_0xf0da9f){var _0x38264b=_0xf0da9f[_0xbe4b('0x2a')],_0xe8e3ed=_0x104c0e[_0xbe4b('0x2b')],_0x2fb9f0=_0x104c0e['offset']+_0x104c0e[_0xbe4b('0x2c')],_0x3c4504;if(_0x2fb9f0>=_0x38264b){_0x2fb9f0=_0x38264b;_0x3c4504=0xc8;}else{_0x3c4504=0xce;}_0x2acc01[_0xbe4b('0x27')](_0x3c4504);return _0x2acc01[_0xbe4b('0x2d')]('Content-Range',_0xe8e3ed+'-'+_0x2fb9f0+'/'+_0x38264b)[_0xbe4b('0x29')](_0xf0da9f);}return null;};}function patchUpdates(_0x46f888){return function(_0x4ef658){try{jsonpatch['apply'](_0x4ef658,_0x46f888,!![]);}catch(_0x23b5c2){return BPromise[_0xbe4b('0x2e')](_0x23b5c2);}return _0x4ef658['save']();};}function saveUpdates(_0xbaa938,_0x5d8e37){return function(_0x3380ee){if(_0x3380ee){return _0x3380ee[_0xbe4b('0x2f')](_0xbaa938)[_0xbe4b('0x1b')](function(_0x1c11cc){return _0x1c11cc;});}return null;};}function removeEntity(_0x1bafdc,_0xe22b34){return function(_0x3d2d6f){if(_0x3d2d6f){return _0x3d2d6f[_0xbe4b('0x30')]()[_0xbe4b('0x1b')](function(){_0x1bafdc[_0xbe4b('0x27')](0xcc)[_0xbe4b('0x28')]();});}};}function handleEntityNotFound(_0x4dda3c,_0x446855){return function(_0xb88ebe){if(!_0xb88ebe){_0x4dda3c[_0xbe4b('0x26')](0x194);}return _0xb88ebe;};}function handleError(_0x15955d,_0x284242){_0x284242=_0x284242||0x1f4;return function(_0x4db4e7){logger[_0xbe4b('0x22')](_0x4db4e7[_0xbe4b('0x31')]);if(_0x4db4e7['name']){delete _0x4db4e7[_0xbe4b('0x32')];}_0x15955d[_0xbe4b('0x27')](_0x284242)[_0xbe4b('0x33')](_0x4db4e7);};}exports['index']=function(_0x4baa95,_0x1419aa){var _0x15a486={},_0x576f97={},_0x33f1a4={'count':0x0,'rows':[]};var _0x553d6d=_[_0xbe4b('0x34')](db['FreshdeskConfiguration'][_0xbe4b('0x35')],function(_0x43a18b){return{'name':_0x43a18b[_0xbe4b('0x36')],'type':_0x43a18b[_0xbe4b('0x37')][_0xbe4b('0x38')]};});_0x576f97[_0xbe4b('0x39')]=_[_0xbe4b('0x34')](_0x553d6d,'name');_0x576f97['query']=_['keys'](_0x4baa95[_0xbe4b('0x3a')]);_0x576f97['filters']=_[_0xbe4b('0x3b')](_0x576f97[_0xbe4b('0x39')],_0x576f97[_0xbe4b('0x3a')]);_0x15a486[_0xbe4b('0x3c')]=_[_0xbe4b('0x3b')](_0x576f97[_0xbe4b('0x39')],qs['fields'](_0x4baa95[_0xbe4b('0x3a')][_0xbe4b('0x3d')]));_0x15a486[_0xbe4b('0x3c')]=_0x15a486[_0xbe4b('0x3c')]['length']?_0x15a486[_0xbe4b('0x3c')]:_0x576f97[_0xbe4b('0x39')];if(!_0x4baa95[_0xbe4b('0x3a')][_0xbe4b('0x3e')](_0xbe4b('0x3f'))){_0x15a486['limit']=qs[_0xbe4b('0x2c')](_0x4baa95['query']['limit']);_0x15a486[_0xbe4b('0x2b')]=qs[_0xbe4b('0x2b')](_0x4baa95[_0xbe4b('0x3a')][_0xbe4b('0x2b')]);}_0x15a486[_0xbe4b('0x40')]=qs[_0xbe4b('0x41')](_0x4baa95['query'][_0xbe4b('0x41')]);_0x15a486['where']=qs[_0xbe4b('0x42')](_['pick'](_0x4baa95[_0xbe4b('0x3a')],_0x576f97[_0xbe4b('0x42')]),_0x553d6d);if(_0x4baa95['query'][_0xbe4b('0x43')]){_0x15a486[_0xbe4b('0x44')]=_[_0xbe4b('0x45')](_0x15a486[_0xbe4b('0x44')],{'$or':_[_0xbe4b('0x34')](_0x553d6d,function(_0x1a7926){if(_0x1a7926[_0xbe4b('0x37')]!==_0xbe4b('0x46')){var _0x3fdf79={};_0x3fdf79[_0x1a7926['name']]={'$like':'%'+_0x4baa95['query'][_0xbe4b('0x43')]+'%'};return _0x3fdf79;}})});}_0x15a486=_[_0xbe4b('0x45')]({},_0x15a486,_0x4baa95[_0xbe4b('0x47')]);var _0xccc671={'where':_0x15a486[_0xbe4b('0x44')]};return db[_0xbe4b('0x48')][_0xbe4b('0x2a')](_0xccc671)['then'](function(_0x237b11){_0x33f1a4[_0xbe4b('0x2a')]=_0x237b11;if(_0x4baa95[_0xbe4b('0x3a')]['includeAll']){_0x15a486['include']=[{'all':!![]}];}return db[_0xbe4b('0x48')]['findAll'](_0x15a486);})[_0xbe4b('0x1b')](function(_0x3f8f6b){_0x33f1a4['rows']=_0x3f8f6b;return _0x33f1a4;})[_0xbe4b('0x1b')](respondWithFilteredResult(_0x1419aa,_0x15a486))[_0xbe4b('0x25')](handleError(_0x1419aa,null));};exports[_0xbe4b('0x49')]=function(_0x5d08fc,_0x5b8dcd){var _0x5c3f21={'raw':![],'where':{'id':_0x5d08fc[_0xbe4b('0x4a')]['id']}},_0x141e82={};_0x141e82['model']=_['keys'](db[_0xbe4b('0x48')][_0xbe4b('0x35')]);_0x141e82[_0xbe4b('0x3a')]=_['keys'](_0x5d08fc[_0xbe4b('0x3a')]);_0x141e82[_0xbe4b('0x4b')]=_[_0xbe4b('0x3b')](_0x141e82[_0xbe4b('0x39')],_0x141e82[_0xbe4b('0x3a')]);_0x5c3f21[_0xbe4b('0x3c')]=_[_0xbe4b('0x3b')](_0x141e82[_0xbe4b('0x39')],qs[_0xbe4b('0x3d')](_0x5d08fc[_0xbe4b('0x3a')][_0xbe4b('0x3d')]));_0x5c3f21[_0xbe4b('0x3c')]=_0x5c3f21[_0xbe4b('0x3c')][_0xbe4b('0x4c')]?_0x5c3f21['attributes']:_0x141e82['model'];if(_0x5d08fc['query'][_0xbe4b('0x4d')]){_0x5c3f21[_0xbe4b('0x4e')]=[{'all':!![]}];}_0x5c3f21=_[_0xbe4b('0x45')]({},_0x5c3f21,_0x5d08fc['options']);return db[_0xbe4b('0x48')][_0xbe4b('0x4f')](_0x5c3f21)[_0xbe4b('0x1b')](handleEntityNotFound(_0x5b8dcd,null))[_0xbe4b('0x1b')](respondWithResult(_0x5b8dcd,null))[_0xbe4b('0x25')](handleError(_0x5b8dcd,null));};exports['create']=function(_0x287b27,_0x14e620){return db[_0xbe4b('0x48')][_0xbe4b('0x50')](_0x287b27['body'],{})['then'](respondWithResult(_0x14e620,0xc9))[_0xbe4b('0x25')](handleError(_0x14e620,null));};exports['update']=function(_0x29055d,_0x3fe173){if(_0x29055d[_0xbe4b('0x51')]['id']){delete _0x29055d[_0xbe4b('0x51')]['id'];}return db[_0xbe4b('0x48')][_0xbe4b('0x4f')]({'where':{'id':_0x29055d[_0xbe4b('0x4a')]['id']}})[_0xbe4b('0x1b')](handleEntityNotFound(_0x3fe173,null))[_0xbe4b('0x1b')](saveUpdates(_0x29055d['body'],null))['then'](respondWithResult(_0x3fe173,null))[_0xbe4b('0x25')](handleError(_0x3fe173,null));};exports[_0xbe4b('0x30')]=function(_0x5cb595,_0x4d1d42){return db[_0xbe4b('0x48')][_0xbe4b('0x4f')]({'where':{'id':_0x5cb595[_0xbe4b('0x4a')]['id']}})[_0xbe4b('0x1b')](handleEntityNotFound(_0x4d1d42,null))['then'](removeEntity(_0x4d1d42,null))[_0xbe4b('0x25')](handleError(_0x4d1d42,null));};exports[_0xbe4b('0x52')]=function(_0x164e99,_0x1ee260,_0x192ede){var _0x752276={};var _0xfe63f2={};var _0x45c6b6;var _0x202d51;return db[_0xbe4b('0x48')][_0xbe4b('0x53')]({'where':{'id':_0x164e99['params']['id']}})[_0xbe4b('0x1b')](handleEntityNotFound(_0x1ee260,null))[_0xbe4b('0x1b')](function(_0x5b7330){if(_0x5b7330){_0x45c6b6=_0x5b7330;_0xfe63f2[_0xbe4b('0x39')]=_[_0xbe4b('0x54')](db['FreshdeskField'][_0xbe4b('0x35')]);_0xfe63f2[_0xbe4b('0x3a')]=_[_0xbe4b('0x54')](_0x164e99[_0xbe4b('0x3a')]);_0xfe63f2[_0xbe4b('0x42')]=_[_0xbe4b('0x3b')](_0xfe63f2[_0xbe4b('0x39')],_0xfe63f2[_0xbe4b('0x3a')]);_0x752276[_0xbe4b('0x3c')]=_[_0xbe4b('0x3b')](_0xfe63f2['model'],qs['fields'](_0x164e99[_0xbe4b('0x3a')][_0xbe4b('0x3d')]));_0x752276[_0xbe4b('0x3c')]=_0x752276[_0xbe4b('0x3c')][_0xbe4b('0x4c')]?_0x752276[_0xbe4b('0x3c')]:_0xfe63f2[_0xbe4b('0x39')];_0x752276[_0xbe4b('0x40')]=qs['sort'](_0x164e99['query'][_0xbe4b('0x41')]);_0x752276['where']=qs['filters'](_['pick'](_0x164e99[_0xbe4b('0x3a')],_0xfe63f2[_0xbe4b('0x42')]));if(_0x164e99[_0xbe4b('0x3a')][_0xbe4b('0x43')]){_0x752276[_0xbe4b('0x44')]=_['merge'](_0x752276[_0xbe4b('0x44')],{'$or':_[_0xbe4b('0x34')](_0x752276[_0xbe4b('0x3c')],function(_0x1ed399){var _0x49ccd7={};_0x49ccd7[_0x1ed399]={'$like':'%'+_0x164e99[_0xbe4b('0x3a')][_0xbe4b('0x43')]+'%'};return _0x49ccd7;})});}_0x752276=_[_0xbe4b('0x45')]({},_0x752276,_0x164e99[_0xbe4b('0x47')]);return _0x45c6b6[_0xbe4b('0x52')](_0x752276);}})[_0xbe4b('0x1b')](function(_0x301845){if(_0x301845){_0x202d51=_0x301845[_0xbe4b('0x4c')];if(!_0x164e99['query'][_0xbe4b('0x3e')]('nolimit')){_0x752276['limit']=qs['limit'](_0x164e99[_0xbe4b('0x3a')]['limit']);_0x752276[_0xbe4b('0x2b')]=qs[_0xbe4b('0x2b')](_0x164e99[_0xbe4b('0x3a')]['offset']);}return _0x45c6b6[_0xbe4b('0x52')](_0x752276);}})[_0xbe4b('0x1b')](function(_0x593f1d){if(_0x593f1d){return _0x593f1d?{'count':_0x202d51,'rows':_0x593f1d}:null;}})['then'](respondWithResult(_0x1ee260,null))['catch'](handleError(_0x1ee260,null));};exports[_0xbe4b('0x55')]=function(_0x39044c,_0xe948a8,_0x52ce19){var _0xe0634c={};var _0x127d8a={};var _0x25111a;var _0x494eb2;return db[_0xbe4b('0x48')][_0xbe4b('0x53')]({'where':{'id':_0x39044c[_0xbe4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe948a8,null))['then'](function(_0x5c58a){if(_0x5c58a){_0x25111a=_0x5c58a;_0x127d8a[_0xbe4b('0x39')]=_[_0xbe4b('0x54')](db[_0xbe4b('0x56')][_0xbe4b('0x35')]);_0x127d8a[_0xbe4b('0x3a')]=_[_0xbe4b('0x54')](_0x39044c[_0xbe4b('0x3a')]);_0x127d8a[_0xbe4b('0x42')]=_[_0xbe4b('0x3b')](_0x127d8a[_0xbe4b('0x39')],_0x127d8a[_0xbe4b('0x3a')]);_0xe0634c['attributes']=_[_0xbe4b('0x3b')](_0x127d8a['model'],qs[_0xbe4b('0x3d')](_0x39044c[_0xbe4b('0x3a')]['fields']));_0xe0634c['attributes']=_0xe0634c[_0xbe4b('0x3c')]['length']?_0xe0634c['attributes']:_0x127d8a[_0xbe4b('0x39')];_0xe0634c[_0xbe4b('0x40')]=qs['sort'](_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x41')]);_0xe0634c[_0xbe4b('0x44')]=qs['filters'](_['pick'](_0x39044c['query'],_0x127d8a[_0xbe4b('0x42')]));if(_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x43')]){_0xe0634c[_0xbe4b('0x44')]=_[_0xbe4b('0x45')](_0xe0634c[_0xbe4b('0x44')],{'$or':_[_0xbe4b('0x34')](_0xe0634c[_0xbe4b('0x3c')],function(_0x3629d6){var _0x566dcc={};_0x566dcc[_0x3629d6]={'$like':'%'+_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x43')]+'%'};return _0x566dcc;})});}_0xe0634c=_[_0xbe4b('0x45')]({},_0xe0634c,_0x39044c[_0xbe4b('0x47')]);return _0x25111a[_0xbe4b('0x55')](_0xe0634c);}})[_0xbe4b('0x1b')](function(_0x40577a){if(_0x40577a){_0x494eb2=_0x40577a[_0xbe4b('0x4c')];if(!_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x3e')](_0xbe4b('0x3f'))){_0xe0634c['limit']=qs[_0xbe4b('0x2c')](_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x2c')]);_0xe0634c[_0xbe4b('0x2b')]=qs[_0xbe4b('0x2b')](_0x39044c[_0xbe4b('0x3a')][_0xbe4b('0x2b')]);}return _0x25111a[_0xbe4b('0x55')](_0xe0634c);}})[_0xbe4b('0x1b')](function(_0x3c9a95){if(_0x3c9a95){return _0x3c9a95?{'count':_0x494eb2,'rows':_0x3c9a95}:null;}})[_0xbe4b('0x1b')](respondWithResult(_0xe948a8,null))[_0xbe4b('0x25')](handleError(_0xe948a8,null));};exports[_0xbe4b('0x57')]=function(_0xfd5fbe,_0x24fe08,_0x5344b9){var _0x44b5e2={};var _0x4c3338={};var _0x1a4f85;var _0x1d4f4e;return db[_0xbe4b('0x48')][_0xbe4b('0x53')]({'where':{'id':_0xfd5fbe['params']['id']}})[_0xbe4b('0x1b')](handleEntityNotFound(_0x24fe08,null))[_0xbe4b('0x1b')](function(_0x32d7f2){if(_0x32d7f2){_0x1a4f85=_0x32d7f2;_0x4c3338['model']=_[_0xbe4b('0x54')](db[_0xbe4b('0x56')][_0xbe4b('0x35')]);_0x4c3338[_0xbe4b('0x3a')]=_[_0xbe4b('0x54')](_0xfd5fbe[_0xbe4b('0x3a')]);_0x4c3338[_0xbe4b('0x42')]=_[_0xbe4b('0x3b')](_0x4c3338[_0xbe4b('0x39')],_0x4c3338[_0xbe4b('0x3a')]);_0x44b5e2[_0xbe4b('0x3c')]=_[_0xbe4b('0x3b')](_0x4c3338['model'],qs[_0xbe4b('0x3d')](_0xfd5fbe[_0xbe4b('0x3a')][_0xbe4b('0x3d')]));_0x44b5e2[_0xbe4b('0x3c')]=_0x44b5e2[_0xbe4b('0x3c')][_0xbe4b('0x4c')]?_0x44b5e2['attributes']:_0x4c3338[_0xbe4b('0x39')];_0x44b5e2[_0xbe4b('0x40')]=qs[_0xbe4b('0x41')](_0xfd5fbe[_0xbe4b('0x3a')][_0xbe4b('0x41')]);_0x44b5e2[_0xbe4b('0x44')]=qs['filters'](_[_0xbe4b('0x58')](_0xfd5fbe['query'],_0x4c3338[_0xbe4b('0x42')]));if(_0xfd5fbe[_0xbe4b('0x3a')][_0xbe4b('0x43')]){_0x44b5e2[_0xbe4b('0x44')]=_['merge'](_0x44b5e2[_0xbe4b('0x44')],{'$or':_[_0xbe4b('0x34')](_0x44b5e2['attributes'],function(_0x5a8c05){var _0x1a9dc3={};_0x1a9dc3[_0x5a8c05]={'$like':'%'+_0xfd5fbe[_0xbe4b('0x3a')][_0xbe4b('0x43')]+'%'};return _0x1a9dc3;})});}_0x44b5e2=_[_0xbe4b('0x45')]({},_0x44b5e2,_0xfd5fbe[_0xbe4b('0x47')]);return _0x1a4f85[_0xbe4b('0x57')](_0x44b5e2);}})[_0xbe4b('0x1b')](function(_0x10912a){if(_0x10912a){_0x1d4f4e=_0x10912a[_0xbe4b('0x4c')];if(!_0xfd5fbe['query']['hasOwnProperty'](_0xbe4b('0x3f'))){_0x44b5e2[_0xbe4b('0x2c')]=qs[_0xbe4b('0x2c')](_0xfd5fbe['query']['limit']);_0x44b5e2[_0xbe4b('0x2b')]=qs[_0xbe4b('0x2b')](_0xfd5fbe[_0xbe4b('0x3a')][_0xbe4b('0x2b')]);}return _0x1a4f85[_0xbe4b('0x57')](_0x44b5e2);}})[_0xbe4b('0x1b')](function(_0x741408){if(_0x741408){return _0x741408?{'count':_0x1d4f4e,'rows':_0x741408}:null;}})[_0xbe4b('0x1b')](respondWithResult(_0x24fe08,null))['catch'](handleError(_0x24fe08,null));};exports['getTags']=function(_0x1446a0,_0x19ff92,_0x2fe771){var _0x3dc5df={};var _0x39d60e={};var _0x2a5a4b;var _0x25eeca;return db[_0xbe4b('0x48')]['findOne']({'where':{'id':_0x1446a0[_0xbe4b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x19ff92,null))[_0xbe4b('0x1b')](function(_0x1933d2){if(_0x1933d2){_0x2a5a4b=_0x1933d2;_0x39d60e['model']=_[_0xbe4b('0x54')](db[_0xbe4b('0x59')]['rawAttributes']);_0x39d60e[_0xbe4b('0x3a')]=_[_0xbe4b('0x54')](_0x1446a0['query']);_0x39d60e['filters']=_[_0xbe4b('0x3b')](_0x39d60e[_0xbe4b('0x39')],_0x39d60e[_0xbe4b('0x3a')]);_0x3dc5df['attributes']=_[_0xbe4b('0x3b')](_0x39d60e['model'],qs[_0xbe4b('0x3d')](_0x1446a0[_0xbe4b('0x3a')][_0xbe4b('0x3d')]));_0x3dc5df[_0xbe4b('0x3c')]=_0x3dc5df[_0xbe4b('0x3c')][_0xbe4b('0x4c')]?_0x3dc5df['attributes']:_0x39d60e[_0xbe4b('0x39')];_0x3dc5df['order']=qs[_0xbe4b('0x41')](_0x1446a0[_0xbe4b('0x3a')][_0xbe4b('0x41')]);_0x3dc5df[_0xbe4b('0x44')]=qs['filters'](_[_0xbe4b('0x58')](_0x1446a0[_0xbe4b('0x3a')],_0x39d60e[_0xbe4b('0x42')]));if(_0x1446a0[_0xbe4b('0x3a')][_0xbe4b('0x43')]){_0x3dc5df['where']=_[_0xbe4b('0x45')](_0x3dc5df[_0xbe4b('0x44')],{'$or':_[_0xbe4b('0x34')](_0x3dc5df[_0xbe4b('0x3c')],function(_0x4f17e7){var _0x836135={};_0x836135[_0x4f17e7]={'$like':'%'+_0x1446a0['query']['filter']+'%'};return _0x836135;})});}_0x3dc5df=_[_0xbe4b('0x45')]({},_0x3dc5df,_0x1446a0['options']);return _0x2a5a4b[_0xbe4b('0x5a')](_0x3dc5df);}})[_0xbe4b('0x1b')](function(_0x58a3da){if(_0x58a3da){_0x25eeca=_0x58a3da[_0xbe4b('0x4c')];if(!_0x1446a0['query'][_0xbe4b('0x3e')]('nolimit')){_0x3dc5df[_0xbe4b('0x2c')]=qs[_0xbe4b('0x2c')](_0x1446a0[_0xbe4b('0x3a')][_0xbe4b('0x2c')]);_0x3dc5df['offset']=qs[_0xbe4b('0x2b')](_0x1446a0['query'][_0xbe4b('0x2b')]);}return _0x2a5a4b[_0xbe4b('0x5a')](_0x3dc5df);}})['then'](function(_0x28a7b5){if(_0x28a7b5){return _0x28a7b5?{'count':_0x25eeca,'rows':_0x28a7b5}:null;}})[_0xbe4b('0x1b')](respondWithResult(_0x19ff92,null))['catch'](handleError(_0x19ff92,null));};exports[_0xbe4b('0x5b')]=function(_0x113c75,_0x3a8832,_0x25708c){if(_0x113c75['body']['id']){delete _0x113c75['body']['id'];}return db[_0xbe4b('0x48')][_0xbe4b('0x53')]({'where':{'id':_0x113c75[_0xbe4b('0x4a')]['id']}})[_0xbe4b('0x1b')](handleEntityNotFound(_0x3a8832,null))[_0xbe4b('0x1b')](function(_0x4594c6){if(_0x4594c6){return _0x4594c6[_0xbe4b('0x5b')](_0x113c75[_0xbe4b('0x51')][_0xbe4b('0x5c')]||[]);}return null;})[_0xbe4b('0x1b')](respondWithResult(_0x3a8832,null))[_0xbe4b('0x25')](handleError(_0x3a8832,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 4e92b24..b804a9b 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 _0x2e7a=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x54e091,_0x36ddd6){var _0x47b87f=function(_0x43c19d){while(--_0x43c19d){_0x54e091['push'](_0x54e091['shift']());}};_0x47b87f(++_0x36ddd6);}(_0x2e7a,0x140));var _0xa2e7=function(_0x289179,_0x1b1da2){_0x289179=_0x289179-0x0;var _0x702f84=_0x2e7a[_0x289179];return _0x702f84;};'use strict';var _=require(_0xa2e7('0x0'));var util=require(_0xa2e7('0x1'));var logger=require(_0xa2e7('0x2'))(_0xa2e7('0x3'));var moment=require(_0xa2e7('0x4'));var BPromise=require(_0xa2e7('0x5'));var rp=require(_0xa2e7('0x6'));var fs=require('fs');var path=require(_0xa2e7('0x7'));var rimraf=require(_0xa2e7('0x8'));var config=require('../../config/environment');var attributes=require(_0xa2e7('0x9'));module[_0xa2e7('0xa')]=function(_0xff4120,_0x4d9f92){return _0xff4120[_0xa2e7('0xb')](_0xa2e7('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53d7=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','bluebird','path','../../config/environment'];(function(_0x4a340d,_0x467625){var _0x59116d=function(_0x181ddd){while(--_0x181ddd){_0x4a340d['push'](_0x4a340d['shift']());}};_0x59116d(++_0x467625);}(_0x53d7,0x1c8));var _0x753d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x753d('0x0'));var util=require(_0x753d('0x1'));var logger=require(_0x753d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x753d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x753d('0x4'));var rimraf=require('rimraf');var config=require(_0x753d('0x5'));var attributes=require(_0x753d('0x6'));module[_0x753d('0x7')]=function(_0x3e23cc,_0x541afa){return _0x3e23cc[_0x753d('0x8')](_0x753d('0x9'),attributes,{'tableName':_0x753d('0xa'),'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 ce1dc40..6e33be5 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 _0xf0c1=['../../config/logger','../../config/environment','jayson/promise','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1807f6,_0x363edf){var _0x3f6d41=function(_0x5d8ec7){while(--_0x5d8ec7){_0x1807f6['push'](_0x1807f6['shift']());}};_0x3f6d41(++_0x363edf);}(_0xf0c1,0x12c));var _0x1f0c=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xf0c1[_0x2db667];return _0x83ff9;};'use strict';var _=require('lodash');var util=require(_0x1f0c('0x0'));var moment=require('moment');var BPromise=require(_0x1f0c('0x1'));var rs=require(_0x1f0c('0x2'));var fs=require('fs');var Redis=require(_0x1f0c('0x3'));var db=require(_0x1f0c('0x4'))['db'];var utils=require(_0x1f0c('0x5'));var logger=require(_0x1f0c('0x6'))('rpc');var config=require(_0x1f0c('0x7'));var jayson=require(_0x1f0c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2628,_0x6f4c6d,_0x122c0f){return new BPromise(function(_0x2122b0,_0xa83522){return client['request'](_0x3c2628,_0x122c0f)['then'](function(_0x3efe72){logger[_0x1f0c('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6f4c6d,_0x1f0c('0xa'));logger['debug'](_0x1f0c('0xb'),_0x6f4c6d,_0x1f0c('0xa'),JSON['stringify'](_0x3efe72));if(_0x3efe72[_0x1f0c('0xc')]){if(_0x3efe72[_0x1f0c('0xc')][_0x1f0c('0xd')]===0x1f4){logger[_0x1f0c('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x6f4c6d,_0x3efe72[_0x1f0c('0xc')][_0x1f0c('0xe')]);return _0xa83522(_0x3efe72[_0x1f0c('0xc')][_0x1f0c('0xe')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x6f4c6d,_0x3efe72[_0x1f0c('0xc')][_0x1f0c('0xe')]);return _0x2122b0(_0x3efe72[_0x1f0c('0xc')][_0x1f0c('0xe')]);}else{logger['info'](_0x1f0c('0xf'),_0x6f4c6d,_0x1f0c('0xa'));_0x2122b0(_0x3efe72[_0x1f0c('0x10')][_0x1f0c('0xe')]);}})[_0x1f0c('0x11')](function(_0x669599){logger['error'](_0x1f0c('0xf'),_0x6f4c6d,_0x669599);_0xa83522(_0x669599);});});} \ No newline at end of file +var _0x2a1a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x75a647,_0x1b51d5){var _0x535c9c=function(_0x13c6b5){while(--_0x13c6b5){_0x75a647['push'](_0x75a647['shift']());}};_0x535c9c(++_0x1b51d5);}(_0x2a1a,0xde));var _0xa2a1=function(_0x44ca83,_0x4e527c){_0x44ca83=_0x44ca83-0x0;var _0x1d47b4=_0x2a1a[_0x44ca83];return _0x1d47b4;};'use strict';var _=require('lodash');var util=require(_0xa2a1('0x0'));var moment=require(_0xa2a1('0x1'));var BPromise=require(_0xa2a1('0x2'));var rs=require(_0xa2a1('0x3'));var fs=require('fs');var Redis=require(_0xa2a1('0x4'));var db=require(_0xa2a1('0x5'))['db'];var utils=require(_0xa2a1('0x6'));var logger=require(_0xa2a1('0x7'))(_0xa2a1('0x8'));var config=require(_0xa2a1('0x9'));var jayson=require(_0xa2a1('0xa'));var client=jayson[_0xa2a1('0xb')][_0xa2a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c64ab,_0x288f05,_0x582fb5){return new BPromise(function(_0x71951b,_0x2de538){return client[_0xa2a1('0xd')](_0x3c64ab,_0x582fb5)[_0xa2a1('0xe')](function(_0x39444a){logger['info'](_0xa2a1('0xf'),_0x288f05,_0xa2a1('0x10'));logger[_0xa2a1('0x11')](_0xa2a1('0x12'),_0x288f05,'request\x20sent',JSON[_0xa2a1('0x13')](_0x39444a));if(_0x39444a[_0xa2a1('0x14')]){if(_0x39444a[_0xa2a1('0x14')][_0xa2a1('0x15')]===0x1f4){logger[_0xa2a1('0x14')](_0xa2a1('0xf'),_0x288f05,_0x39444a[_0xa2a1('0x14')]['message']);return _0x2de538(_0x39444a[_0xa2a1('0x14')]['message']);}logger['error'](_0xa2a1('0xf'),_0x288f05,_0x39444a[_0xa2a1('0x14')][_0xa2a1('0x16')]);return _0x71951b(_0x39444a[_0xa2a1('0x14')]['message']);}else{logger['info'](_0xa2a1('0xf'),_0x288f05,_0xa2a1('0x10'));_0x71951b(_0x39444a[_0xa2a1('0x17')]['message']);}})[_0xa2a1('0x18')](function(_0x4453a3){logger[_0xa2a1('0x14')](_0xa2a1('0xf'),_0x288f05,_0x4453a3);_0x2de538(_0x4453a3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index a360e9b..cecffac 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x1dcc28,_0x26d40f){var _0x1ffb2d=function(_0x59e9e0){while(--_0x59e9e0){_0x1dcc28['push'](_0x1dcc28['shift']());}};_0x1ffb2d(++_0x26d40f);}(_0x3e74,0x175));var _0x43e7=function(_0x22a186,_0x19879a){_0x22a186=_0x22a186-0x0;var _0x2f8acf=_0x3e74[_0x22a186];return _0x2f8acf;};'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')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x13606d,_0x30f265){var _0x1b85b0=function(_0x285c1b){while(--_0x285c1b){_0x13606d['push'](_0x13606d['shift']());}};_0x1b85b0(++_0x30f265);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xcb91[_0x273c39];return _0x46d6b5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 798bdcb..61744cd 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 _0x397c=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0x4bf9fe,_0x20796e){var _0x8e09cb=function(_0x1661a8){while(--_0x1661a8){_0x4bf9fe['push'](_0x4bf9fe['shift']());}};_0x8e09cb(++_0x20796e);}(_0x397c,0xc1));var _0xc397=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x397c[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0xc397('0x0'));module[_0xc397('0x1')]={'type':{'type':Sequelize[_0xc397('0x2')]('string',_0xc397('0x3'),'customVariable',_0xc397('0x4')),'defaultValue':_0xc397('0x5')},'content':{'type':Sequelize[_0xc397('0x6')]},'key':{'type':Sequelize[_0xc397('0x6')]},'keyType':{'type':Sequelize[_0xc397('0x2')]('string',_0xc397('0x3'),_0xc397('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc397('0x6')]},'nameField':{'type':Sequelize[_0xc397('0x6')]},'customField':{'type':Sequelize[_0xc397('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc397('0x6')]}}; \ No newline at end of file +var _0x26ed=['sequelize','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0xd58928,_0x34d753){var _0xb2e1c1=function(_0x55dc3f){while(--_0x55dc3f){_0xd58928['push'](_0xd58928['shift']());}};_0xb2e1c1(++_0x34d753);}(_0x26ed,0x1f0));var _0xd26e=function(_0x1f7201,_0x141b79){_0x1f7201=_0x1f7201-0x0;var _0x289fd2=_0x26ed[_0x1f7201];return _0x289fd2;};'use strict';var Sequelize=require(_0xd26e('0x0'));module['exports']={'type':{'type':Sequelize[_0xd26e('0x1')](_0xd26e('0x2'),'variable',_0xd26e('0x3'),_0xd26e('0x4')),'defaultValue':_0xd26e('0x2')},'content':{'type':Sequelize[_0xd26e('0x5')]},'key':{'type':Sequelize[_0xd26e('0x5')]},'keyType':{'type':Sequelize[_0xd26e('0x1')](_0xd26e('0x2'),_0xd26e('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xd26e('0x5')]},'idField':{'type':Sequelize[_0xd26e('0x5')]},'nameField':{'type':Sequelize[_0xd26e('0x5')]},'customField':{'type':Sequelize[_0xd26e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd26e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2235779..03add00 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 _0x464b=['../../config/utils','../../config/license/util','end','status','json','limit','set','reject','save','update','then','sendStatus','stack','name','send','index','map','FreshdeskField','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0xbb5262,_0x2a7c99){var _0xa52301=function(_0x3d8065){while(--_0x3d8065){_0xbb5262['push'](_0xbb5262['shift']());}};_0xa52301(++_0x2a7c99);}(_0x464b,0x161));var _0xb464=function(_0x5b8f29,_0x5c62aa){_0x5b8f29=_0x5b8f29-0x0;var _0x3f64e8=_0x464b[_0x5b8f29];return _0x3f64e8;};'use strict';var pdf=require(_0xb464('0x0'));var emlformat=require(_0xb464('0x1'));var rimraf=require(_0xb464('0x2'));var zipdir=require(_0xb464('0x3'));var jsonpatch=require(_0xb464('0x4'));var rp=require(_0xb464('0x5'));var moment=require(_0xb464('0x6'));var BPromise=require(_0xb464('0x7'));var Mustache=require(_0xb464('0x8'));var util=require(_0xb464('0x9'));var path=require(_0xb464('0xa'));var sox=require(_0xb464('0xb'));var csv=require(_0xb464('0xc'));var ejs=require(_0xb464('0xd'));var fs=require('fs');var _=require(_0xb464('0xe'));var squel=require('squel');var crypto=require(_0xb464('0xf'));var jsforce=require(_0xb464('0x10'));var deskjs=require(_0xb464('0x11'));var toCsv=require(_0xb464('0xc'));var querystring=require(_0xb464('0x12'));var Papa=require(_0xb464('0x13'));var Redis=require(_0xb464('0x14'));var authService=require(_0xb464('0x15'));var qs=require(_0xb464('0x16'));var as=require(_0xb464('0x17'));var hardwareService=require(_0xb464('0x18'));var logger=require(_0xb464('0x19'))(_0xb464('0x1a'));var utils=require(_0xb464('0x1b'));var config=require('../../config/environment');var licenseUtil=require(_0xb464('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bf2ca,_0x3576d9){_0x3576d9=_0x3576d9||0xcc;return function(_0x3af139){if(_0x3af139){return _0x4bf2ca['sendStatus'](_0x3576d9);}return _0x4bf2ca['status'](_0x3576d9)[_0xb464('0x1d')]();};}function respondWithResult(_0x24ab1f,_0x29e98e){_0x29e98e=_0x29e98e||0xc8;return function(_0x495302){if(_0x495302){return _0x24ab1f[_0xb464('0x1e')](_0x29e98e)[_0xb464('0x1f')](_0x495302);}};}function respondWithFilteredResult(_0x10fea9,_0x2a30f6){return function(_0x364326){if(_0x364326){var _0x314ed9=_0x364326['count'],_0x1279e1=_0x2a30f6['offset'],_0x3071ee=_0x2a30f6['offset']+_0x2a30f6[_0xb464('0x20')],_0x593b0c;if(_0x3071ee>=_0x314ed9){_0x3071ee=_0x314ed9;_0x593b0c=0xc8;}else{_0x593b0c=0xce;}_0x10fea9[_0xb464('0x1e')](_0x593b0c);return _0x10fea9[_0xb464('0x21')]('Content-Range',_0x1279e1+'-'+_0x3071ee+'/'+_0x314ed9)[_0xb464('0x1f')](_0x364326);}return null;};}function patchUpdates(_0x2db6cc){return function(_0x3e9485){try{jsonpatch['apply'](_0x3e9485,_0x2db6cc,!![]);}catch(_0x4bcd09){return BPromise[_0xb464('0x22')](_0x4bcd09);}return _0x3e9485[_0xb464('0x23')]();};}function saveUpdates(_0xc0ec2,_0x32f278){return function(_0x1ad61e){if(_0x1ad61e){return _0x1ad61e[_0xb464('0x24')](_0xc0ec2)[_0xb464('0x25')](function(_0x5dc9a6){return _0x5dc9a6;});}return null;};}function removeEntity(_0x3ae75b,_0x2641dc){return function(_0x11c61e){if(_0x11c61e){return _0x11c61e['destroy']()['then'](function(){_0x3ae75b[_0xb464('0x1e')](0xcc)[_0xb464('0x1d')]();});}};}function handleEntityNotFound(_0x573fb8,_0x70fbfc){return function(_0x507b47){if(!_0x507b47){_0x573fb8[_0xb464('0x26')](0x194);}return _0x507b47;};}function handleError(_0x15ece6,_0x2b5dc1){_0x2b5dc1=_0x2b5dc1||0x1f4;return function(_0xf29cef){logger['error'](_0xf29cef[_0xb464('0x27')]);if(_0xf29cef[_0xb464('0x28')]){delete _0xf29cef[_0xb464('0x28')];}_0x15ece6['status'](_0x2b5dc1)[_0xb464('0x29')](_0xf29cef);};}exports[_0xb464('0x2a')]=function(_0x5e782f,_0x43c46e){var _0x4b3d97={},_0x3b88b5={},_0x1d9216={'count':0x0,'rows':[]};var _0x9c1ca7=_[_0xb464('0x2b')](db[_0xb464('0x2c')]['rawAttributes'],function(_0x5d4dce){return{'name':_0x5d4dce['fieldName'],'type':_0x5d4dce['type'][_0xb464('0x2d')]};});_0x3b88b5[_0xb464('0x2e')]=_[_0xb464('0x2b')](_0x9c1ca7,_0xb464('0x28'));_0x3b88b5[_0xb464('0x2f')]=_[_0xb464('0x30')](_0x5e782f['query']);_0x3b88b5[_0xb464('0x31')]=_[_0xb464('0x32')](_0x3b88b5[_0xb464('0x2e')],_0x3b88b5['query']);_0x4b3d97[_0xb464('0x33')]=_[_0xb464('0x32')](_0x3b88b5['model'],qs[_0xb464('0x34')](_0x5e782f[_0xb464('0x2f')]['fields']));_0x4b3d97[_0xb464('0x33')]=_0x4b3d97[_0xb464('0x33')][_0xb464('0x35')]?_0x4b3d97[_0xb464('0x33')]:_0x3b88b5[_0xb464('0x2e')];if(!_0x5e782f[_0xb464('0x2f')]['hasOwnProperty'](_0xb464('0x36'))){_0x4b3d97[_0xb464('0x20')]=qs[_0xb464('0x20')](_0x5e782f[_0xb464('0x2f')]['limit']);_0x4b3d97[_0xb464('0x37')]=qs[_0xb464('0x37')](_0x5e782f['query'][_0xb464('0x37')]);}_0x4b3d97[_0xb464('0x38')]=qs[_0xb464('0x39')](_0x5e782f[_0xb464('0x2f')]['sort']);_0x4b3d97[_0xb464('0x3a')]=qs[_0xb464('0x31')](_[_0xb464('0x3b')](_0x5e782f[_0xb464('0x2f')],_0x3b88b5[_0xb464('0x31')]),_0x9c1ca7);if(_0x5e782f[_0xb464('0x2f')][_0xb464('0x3c')]){_0x4b3d97[_0xb464('0x3a')]=_[_0xb464('0x3d')](_0x4b3d97[_0xb464('0x3a')],{'$or':_['map'](_0x9c1ca7,function(_0x27f561){if(_0x27f561['type']!==_0xb464('0x3e')){var _0x32ea57={};_0x32ea57[_0x27f561['name']]={'$like':'%'+_0x5e782f['query'][_0xb464('0x3c')]+'%'};return _0x32ea57;}})});}_0x4b3d97=_[_0xb464('0x3d')]({},_0x4b3d97,_0x5e782f[_0xb464('0x3f')]);var _0x53944e={'where':_0x4b3d97['where']};return db['FreshdeskField']['count'](_0x53944e)[_0xb464('0x25')](function(_0xf43b88){_0x1d9216[_0xb464('0x40')]=_0xf43b88;if(_0x5e782f['query'][_0xb464('0x41')]){_0x4b3d97[_0xb464('0x42')]=[{'all':!![]}];}return db[_0xb464('0x2c')][_0xb464('0x43')](_0x4b3d97);})['then'](function(_0x38c613){_0x1d9216[_0xb464('0x44')]=_0x38c613;return _0x1d9216;})[_0xb464('0x25')](respondWithFilteredResult(_0x43c46e,_0x4b3d97))[_0xb464('0x45')](handleError(_0x43c46e,null));};exports[_0xb464('0x46')]=function(_0x1d6476,_0x4bb696){var _0x1cfece={'raw':!![],'where':{'id':_0x1d6476[_0xb464('0x47')]['id']}},_0xa64ee6={};_0xa64ee6[_0xb464('0x2e')]=_[_0xb464('0x30')](db['FreshdeskField'][_0xb464('0x48')]);_0xa64ee6['query']=_[_0xb464('0x30')](_0x1d6476[_0xb464('0x2f')]);_0xa64ee6['filtears']=_[_0xb464('0x32')](_0xa64ee6[_0xb464('0x2e')],_0xa64ee6[_0xb464('0x2f')]);_0x1cfece[_0xb464('0x33')]=_[_0xb464('0x32')](_0xa64ee6[_0xb464('0x2e')],qs['fields'](_0x1d6476['query'][_0xb464('0x34')]));_0x1cfece[_0xb464('0x33')]=_0x1cfece[_0xb464('0x33')][_0xb464('0x35')]?_0x1cfece[_0xb464('0x33')]:_0xa64ee6[_0xb464('0x2e')];if(_0x1d6476[_0xb464('0x2f')]['includeAll']){_0x1cfece[_0xb464('0x42')]=[{'all':!![]}];}_0x1cfece=_[_0xb464('0x3d')]({},_0x1cfece,_0x1d6476['options']);return db[_0xb464('0x2c')]['find'](_0x1cfece)[_0xb464('0x25')](handleEntityNotFound(_0x4bb696,null))[_0xb464('0x25')](respondWithResult(_0x4bb696,null))[_0xb464('0x45')](handleError(_0x4bb696,null));};exports[_0xb464('0x49')]=function(_0x23c750,_0x18443e){return db['FreshdeskField'][_0xb464('0x49')](_0x23c750[_0xb464('0x4a')],{})[_0xb464('0x25')](respondWithResult(_0x18443e,0xc9))[_0xb464('0x45')](handleError(_0x18443e,null));};exports[_0xb464('0x24')]=function(_0x3b3e14,_0x27d767){if(_0x3b3e14['body']['id']){delete _0x3b3e14[_0xb464('0x4a')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x3b3e14[_0xb464('0x47')]['id']}})[_0xb464('0x25')](handleEntityNotFound(_0x27d767,null))[_0xb464('0x25')](saveUpdates(_0x3b3e14[_0xb464('0x4a')],null))[_0xb464('0x25')](respondWithResult(_0x27d767,null))[_0xb464('0x45')](handleError(_0x27d767,null));};exports[_0xb464('0x4b')]=function(_0x8c3a8c,_0x53fbbc){return db[_0xb464('0x2c')]['find']({'where':{'id':_0x8c3a8c[_0xb464('0x47')]['id']}})[_0xb464('0x25')](handleEntityNotFound(_0x53fbbc,null))[_0xb464('0x25')](removeEntity(_0x53fbbc,null))[_0xb464('0x45')](handleError(_0x53fbbc,null));}; \ No newline at end of file +var _0x1f59=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','map','FreshdeskField','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','catch','show','params','length','include','create','body','find','eml-format','fast-json-patch','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f59,0xef));var _0x91f5=function(_0x16bddf,_0x3ac6f6){_0x16bddf=_0x16bddf-0x0;var _0x531f2c=_0x1f59[_0x16bddf];return _0x531f2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91f5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91f5('0x1'));var rp=require('request-promise');var moment=require(_0x91f5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x91f5('0x3'));var util=require(_0x91f5('0x4'));var path=require(_0x91f5('0x5'));var sox=require('sox');var csv=require(_0x91f5('0x6'));var ejs=require(_0x91f5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x91f5('0x8'));var crypto=require(_0x91f5('0x9'));var jsforce=require(_0x91f5('0xa'));var deskjs=require(_0x91f5('0xb'));var toCsv=require(_0x91f5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x91f5('0xc'));var qs=require(_0x91f5('0xd'));var as=require(_0x91f5('0xe'));var hardwareService=require(_0x91f5('0xf'));var logger=require(_0x91f5('0x10'))(_0x91f5('0x11'));var utils=require(_0x91f5('0x12'));var config=require(_0x91f5('0x13'));var licenseUtil=require(_0x91f5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29bcb6,_0x1a7d14){_0x1a7d14=_0x1a7d14||0xcc;return function(_0x5a32d6){if(_0x5a32d6){return _0x29bcb6[_0x91f5('0x15')](_0x1a7d14);}return _0x29bcb6[_0x91f5('0x16')](_0x1a7d14)[_0x91f5('0x17')]();};}function respondWithResult(_0x543810,_0x163905){_0x163905=_0x163905||0xc8;return function(_0x31e3bd){if(_0x31e3bd){return _0x543810[_0x91f5('0x16')](_0x163905)[_0x91f5('0x18')](_0x31e3bd);}};}function respondWithFilteredResult(_0x2fd9ac,_0xcef2ac){return function(_0x4bda9f){if(_0x4bda9f){var _0x2be265=_0x4bda9f[_0x91f5('0x19')],_0x149cbb=_0xcef2ac[_0x91f5('0x1a')],_0x4792f5=_0xcef2ac[_0x91f5('0x1a')]+_0xcef2ac[_0x91f5('0x1b')],_0x2b33ce;if(_0x4792f5>=_0x2be265){_0x4792f5=_0x2be265;_0x2b33ce=0xc8;}else{_0x2b33ce=0xce;}_0x2fd9ac[_0x91f5('0x16')](_0x2b33ce);return _0x2fd9ac[_0x91f5('0x1c')](_0x91f5('0x1d'),_0x149cbb+'-'+_0x4792f5+'/'+_0x2be265)[_0x91f5('0x18')](_0x4bda9f);}return null;};}function patchUpdates(_0x14a85c){return function(_0x3cfa4b){try{jsonpatch[_0x91f5('0x1e')](_0x3cfa4b,_0x14a85c,!![]);}catch(_0x266e1c){return BPromise['reject'](_0x266e1c);}return _0x3cfa4b[_0x91f5('0x1f')]();};}function saveUpdates(_0x1221a6,_0x463898){return function(_0x49e0c8){if(_0x49e0c8){return _0x49e0c8[_0x91f5('0x20')](_0x1221a6)[_0x91f5('0x21')](function(_0x8bec64){return _0x8bec64;});}return null;};}function removeEntity(_0x362714,_0x3bc893){return function(_0x26f85f){if(_0x26f85f){return _0x26f85f[_0x91f5('0x22')]()[_0x91f5('0x21')](function(){_0x362714[_0x91f5('0x16')](0xcc)[_0x91f5('0x17')]();});}};}function handleEntityNotFound(_0x5579af,_0x39a75b){return function(_0x18d9d3){if(!_0x18d9d3){_0x5579af[_0x91f5('0x15')](0x194);}return _0x18d9d3;};}function handleError(_0x232b9a,_0x3d366b){_0x3d366b=_0x3d366b||0x1f4;return function(_0x5a8612){logger['error'](_0x5a8612[_0x91f5('0x23')]);if(_0x5a8612[_0x91f5('0x24')]){delete _0x5a8612['name'];}_0x232b9a[_0x91f5('0x16')](_0x3d366b)['send'](_0x5a8612);};}exports['index']=function(_0x9c0c4e,_0x18a0ed){var _0xaa3061={},_0xe29aec={},_0x5743fa={'count':0x0,'rows':[]};var _0x5f459e=_[_0x91f5('0x25')](db[_0x91f5('0x26')][_0x91f5('0x27')],function(_0x14c904){return{'name':_0x14c904['fieldName'],'type':_0x14c904[_0x91f5('0x28')][_0x91f5('0x29')]};});_0xe29aec[_0x91f5('0x2a')]=_[_0x91f5('0x25')](_0x5f459e,'name');_0xe29aec['query']=_[_0x91f5('0x2b')](_0x9c0c4e[_0x91f5('0x2c')]);_0xe29aec[_0x91f5('0x2d')]=_[_0x91f5('0x2e')](_0xe29aec[_0x91f5('0x2a')],_0xe29aec[_0x91f5('0x2c')]);_0xaa3061[_0x91f5('0x2f')]=_['intersection'](_0xe29aec[_0x91f5('0x2a')],qs[_0x91f5('0x30')](_0x9c0c4e['query']['fields']));_0xaa3061[_0x91f5('0x2f')]=_0xaa3061['attributes']['length']?_0xaa3061[_0x91f5('0x2f')]:_0xe29aec[_0x91f5('0x2a')];if(!_0x9c0c4e[_0x91f5('0x2c')][_0x91f5('0x31')](_0x91f5('0x32'))){_0xaa3061['limit']=qs[_0x91f5('0x1b')](_0x9c0c4e['query'][_0x91f5('0x1b')]);_0xaa3061[_0x91f5('0x1a')]=qs['offset'](_0x9c0c4e[_0x91f5('0x2c')]['offset']);}_0xaa3061['order']=qs[_0x91f5('0x33')](_0x9c0c4e[_0x91f5('0x2c')][_0x91f5('0x33')]);_0xaa3061[_0x91f5('0x34')]=qs[_0x91f5('0x2d')](_[_0x91f5('0x35')](_0x9c0c4e[_0x91f5('0x2c')],_0xe29aec[_0x91f5('0x2d')]),_0x5f459e);if(_0x9c0c4e['query'][_0x91f5('0x36')]){_0xaa3061[_0x91f5('0x34')]=_[_0x91f5('0x37')](_0xaa3061[_0x91f5('0x34')],{'$or':_['map'](_0x5f459e,function(_0x3bdb95){if(_0x3bdb95[_0x91f5('0x28')]!=='VIRTUAL'){var _0x3b8d37={};_0x3b8d37[_0x3bdb95['name']]={'$like':'%'+_0x9c0c4e['query'][_0x91f5('0x36')]+'%'};return _0x3b8d37;}})});}_0xaa3061=_[_0x91f5('0x37')]({},_0xaa3061,_0x9c0c4e[_0x91f5('0x38')]);var _0x32cdb1={'where':_0xaa3061[_0x91f5('0x34')]};return db[_0x91f5('0x26')][_0x91f5('0x19')](_0x32cdb1)[_0x91f5('0x21')](function(_0x34377d){_0x5743fa[_0x91f5('0x19')]=_0x34377d;if(_0x9c0c4e[_0x91f5('0x2c')][_0x91f5('0x39')]){_0xaa3061['include']=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0xaa3061);})[_0x91f5('0x21')](function(_0x4e4865){_0x5743fa['rows']=_0x4e4865;return _0x5743fa;})[_0x91f5('0x21')](respondWithFilteredResult(_0x18a0ed,_0xaa3061))[_0x91f5('0x3a')](handleError(_0x18a0ed,null));};exports[_0x91f5('0x3b')]=function(_0x3f3dad,_0x1a673c){var _0x393d3f={'raw':!![],'where':{'id':_0x3f3dad[_0x91f5('0x3c')]['id']}},_0x25e17a={};_0x25e17a[_0x91f5('0x2a')]=_['keys'](db[_0x91f5('0x26')][_0x91f5('0x27')]);_0x25e17a[_0x91f5('0x2c')]=_['keys'](_0x3f3dad[_0x91f5('0x2c')]);_0x25e17a['filtears']=_[_0x91f5('0x2e')](_0x25e17a[_0x91f5('0x2a')],_0x25e17a[_0x91f5('0x2c')]);_0x393d3f[_0x91f5('0x2f')]=_[_0x91f5('0x2e')](_0x25e17a[_0x91f5('0x2a')],qs[_0x91f5('0x30')](_0x3f3dad[_0x91f5('0x2c')][_0x91f5('0x30')]));_0x393d3f[_0x91f5('0x2f')]=_0x393d3f[_0x91f5('0x2f')][_0x91f5('0x3d')]?_0x393d3f['attributes']:_0x25e17a[_0x91f5('0x2a')];if(_0x3f3dad[_0x91f5('0x2c')][_0x91f5('0x39')]){_0x393d3f[_0x91f5('0x3e')]=[{'all':!![]}];}_0x393d3f=_[_0x91f5('0x37')]({},_0x393d3f,_0x3f3dad[_0x91f5('0x38')]);return db[_0x91f5('0x26')]['find'](_0x393d3f)[_0x91f5('0x21')](handleEntityNotFound(_0x1a673c,null))[_0x91f5('0x21')](respondWithResult(_0x1a673c,null))[_0x91f5('0x3a')](handleError(_0x1a673c,null));};exports[_0x91f5('0x3f')]=function(_0x349c9e,_0x42add6){return db[_0x91f5('0x26')][_0x91f5('0x3f')](_0x349c9e[_0x91f5('0x40')],{})[_0x91f5('0x21')](respondWithResult(_0x42add6,0xc9))['catch'](handleError(_0x42add6,null));};exports[_0x91f5('0x20')]=function(_0x591142,_0x1cc52f){if(_0x591142[_0x91f5('0x40')]['id']){delete _0x591142['body']['id'];}return db['FreshdeskField'][_0x91f5('0x41')]({'where':{'id':_0x591142[_0x91f5('0x3c')]['id']}})[_0x91f5('0x21')](handleEntityNotFound(_0x1cc52f,null))[_0x91f5('0x21')](saveUpdates(_0x591142[_0x91f5('0x40')],null))['then'](respondWithResult(_0x1cc52f,null))[_0x91f5('0x3a')](handleError(_0x1cc52f,null));};exports[_0x91f5('0x22')]=function(_0x5e3630,_0x6f0619){return db[_0x91f5('0x26')][_0x91f5('0x41')]({'where':{'id':_0x5e3630[_0x91f5('0x3c')]['id']}})[_0x91f5('0x21')](handleEntityNotFound(_0x6f0619,null))[_0x91f5('0x21')](removeEntity(_0x6f0619,null))[_0x91f5('0x3a')](handleError(_0x6f0619,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index da77351..96e7122 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 _0x0b27=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x316852,_0xc901f0){var _0x5a9eae=function(_0x449bc2){while(--_0x449bc2){_0x316852['push'](_0x316852['shift']());}};_0x5a9eae(++_0xc901f0);}(_0x0b27,0x133));var _0x70b2=function(_0x42452b,_0x4a4c99){_0x42452b=_0x42452b-0x0;var _0x2a18a4=_0x0b27[_0x42452b];return _0x2a18a4;};'use strict';var _=require(_0x70b2('0x0'));var util=require(_0x70b2('0x1'));var logger=require(_0x70b2('0x2'))(_0x70b2('0x3'));var moment=require('moment');var BPromise=require(_0x70b2('0x4'));var rp=require(_0x70b2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70b2('0x6'));var attributes=require(_0x70b2('0x7'));module[_0x70b2('0x8')]=function(_0x3b5df9,_0x3db5dc){return _0x3b5df9[_0x70b2('0x9')](_0x70b2('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x70b2('0xb'),'fields':[_0x70b2('0xc'),_0x70b2('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa673=['freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0xa673,0xf3));var _0x3a67=function(_0x507cd3,_0x2dc4da){_0x507cd3=_0x507cd3-0x0;var _0x431279=_0xa673[_0x507cd3];return _0x431279;};'use strict';var _=require(_0x3a67('0x0'));var util=require(_0x3a67('0x1'));var logger=require(_0x3a67('0x2'))(_0x3a67('0x3'));var moment=require(_0x3a67('0x4'));var BPromise=require(_0x3a67('0x5'));var rp=require(_0x3a67('0x6'));var fs=require('fs');var path=require(_0x3a67('0x7'));var rimraf=require('rimraf');var config=require(_0x3a67('0x8'));var attributes=require(_0x3a67('0x9'));module[_0x3a67('0xa')]=function(_0x3bd472,_0x22b22e){return _0x3bd472['define'](_0x3a67('0xb'),attributes,{'tableName':_0x3a67('0xc'),'paranoid':![],'indexes':[{'name':_0x3a67('0xd'),'fields':[_0x3a67('0xe'),_0x3a67('0xf')],'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 d65dd52..6ff553f 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(_0x199bf3,_0x4c2ea2){var _0x4ef0f0=function(_0x182403){while(--_0x182403){_0x199bf3['push'](_0x199bf3['shift']());}};_0x4ef0f0(++_0x4c2ea2);}(_0xb10b,0x12a));var _0xbb10=function(_0x45b625,_0x165113){_0x45b625=_0x45b625-0x0;var _0x2a1e5c=_0xb10b[_0x45b625];return _0x2a1e5c;};'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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x4ac512,_0x36e867){_0x4ac512=_0x4ac512-0x0;var _0x844693=_0x7a54[_0x4ac512];return _0x844693;};'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 ed0cdf8..7de1955 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 _0x8bad=['show','/:id/configurations','getConfigurations','getFields','post','create','put','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4de044,_0xbc9b4f){var _0x447981=function(_0x89cbd9){while(--_0x89cbd9){_0x4de044['push'](_0x4de044['shift']());}};_0x447981(++_0xbc9b4f);}(_0x8bad,0x1e8));var _0xd8ba=function(_0xed4701,_0x45a176){_0xed4701=_0xed4701-0x0;var _0x32f39d=_0x8bad[_0xed4701];return _0x32f39d;};'use strict';var multer=require('multer');var util=require(_0xd8ba('0x0'));var path=require(_0xd8ba('0x1'));var timeout=require(_0xd8ba('0x2'));var express=require(_0xd8ba('0x3'));var router=express[_0xd8ba('0x4')]();var auth=require(_0xd8ba('0x5'));var interaction=require(_0xd8ba('0x6'));var config=require(_0xd8ba('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xd8ba('0x8')]('/',auth[_0xd8ba('0x9')](),controller[_0xd8ba('0xa')]);router['get'](_0xd8ba('0xb'),auth[_0xd8ba('0x9')](),controller[_0xd8ba('0xc')]);router[_0xd8ba('0x8')](_0xd8ba('0xd'),auth[_0xd8ba('0x9')](),controller[_0xd8ba('0xe')]);router[_0xd8ba('0x8')]('/:id/fields',auth[_0xd8ba('0x9')](),controller[_0xd8ba('0xf')]);router[_0xd8ba('0x10')]('/',auth[_0xd8ba('0x9')](),controller[_0xd8ba('0x11')]);router[_0xd8ba('0x10')](_0xd8ba('0xd'),auth[_0xd8ba('0x9')](),controller['addConfiguration']);router[_0xd8ba('0x12')](_0xd8ba('0xb'),auth[_0xd8ba('0x9')](),controller['update']);router['delete'](_0xd8ba('0xb'),auth[_0xd8ba('0x9')](),controller[_0xd8ba('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1b26=['getFields','post','create','addConfiguration','put','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x1b26,0xd7));var _0x61b2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b26[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x61b2('0x0'));var timeout=require(_0x61b2('0x1'));var express=require(_0x61b2('0x2'));var router=express[_0x61b2('0x3')]();var auth=require(_0x61b2('0x4'));var interaction=require(_0x61b2('0x5'));var config=require(_0x61b2('0x6'));var controller=require(_0x61b2('0x7'));router[_0x61b2('0x8')]('/',auth[_0x61b2('0x9')](),controller[_0x61b2('0xa')]);router[_0x61b2('0x8')](_0x61b2('0xb'),auth[_0x61b2('0x9')](),controller[_0x61b2('0xc')]);router[_0x61b2('0x8')](_0x61b2('0xd'),auth[_0x61b2('0x9')](),controller[_0x61b2('0xe')]);router[_0x61b2('0x8')]('/:id/fields',auth[_0x61b2('0x9')](),controller[_0x61b2('0xf')]);router[_0x61b2('0x10')]('/',auth[_0x61b2('0x9')](),controller[_0x61b2('0x11')]);router[_0x61b2('0x10')](_0x61b2('0xd'),auth[_0x61b2('0x9')](),controller[_0x61b2('0x12')]);router[_0x61b2('0x13')]('/:id',auth[_0x61b2('0x9')](),controller[_0x61b2('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x61b2('0x15')]);module[_0x61b2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index dd5027e..40b4222 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 _0x25e7=['sequelize','exports','STRING','username','remoteUri'];(function(_0x592eeb,_0x10ef82){var _0x3ea777=function(_0x4ca4f7){while(--_0x4ca4f7){_0x592eeb['push'](_0x592eeb['shift']());}};_0x3ea777(++_0x10ef82);}(_0x25e7,0x1d6));var _0x725e=function(_0x3592ab,_0x4f669a){_0x3592ab=_0x3592ab-0x0;var _0x13298a=_0x25e7[_0x3592ab];return _0x13298a;};'use strict';var Sequelize=require(_0x725e('0x0'));module[_0x725e('0x1')]={'name':{'type':Sequelize[_0x725e('0x2')]},'description':{'type':Sequelize[_0x725e('0x2')]},'username':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x3')},'apiKey':{'type':Sequelize[_0x725e('0x2')]},'remoteUri':{'type':Sequelize[_0x725e('0x2')],'unique':_0x725e('0x4')},'serverUrl':{'type':Sequelize[_0x725e('0x2')]}}; \ No newline at end of file +var _0xc35f=['STRING','username','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xc35f,0x1ca));var _0xfc35=function(_0x2a4291,_0x53bdd8){_0x2a4291=_0x2a4291-0x0;var _0xf91cbe=_0xc35f[_0x2a4291];return _0xf91cbe;};'use strict';var Sequelize=require(_0xfc35('0x0'));module[_0xfc35('0x1')]={'name':{'type':Sequelize[_0xfc35('0x2')]},'description':{'type':Sequelize[_0xfc35('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xfc35('0x3')},'apiKey':{'type':Sequelize[_0xfc35('0x2')]},'remoteUri':{'type':Sequelize[_0xfc35('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xfc35('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index f13c55c..633a2b6 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 _0xf337=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','params','includeAll','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','FreshsalesAccount','rawAttributes'];(function(_0x4959bb,_0xc0df8e){var _0x137f1f=function(_0x41a5c3){while(--_0x41a5c3){_0x4959bb['push'](_0x4959bb['shift']());}};_0x137f1f(++_0xc0df8e);}(_0xf337,0x174));var _0x7f33=function(_0x3344d9,_0x3bb535){_0x3344d9=_0x3344d9-0x0;var _0x4319f8=_0xf337[_0x3344d9];return _0x4319f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7f33('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7f33('0x1'));var rp=require(_0x7f33('0x2'));var moment=require('moment');var BPromise=require(_0x7f33('0x3'));var Mustache=require(_0x7f33('0x4'));var util=require(_0x7f33('0x5'));var path=require(_0x7f33('0x6'));var sox=require(_0x7f33('0x7'));var csv=require(_0x7f33('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7f33('0x9'));var squel=require(_0x7f33('0xa'));var crypto=require(_0x7f33('0xb'));var jsforce=require(_0x7f33('0xc'));var deskjs=require(_0x7f33('0xd'));var toCsv=require(_0x7f33('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f33('0xe'));var authService=require(_0x7f33('0xf'));var qs=require(_0x7f33('0x10'));var as=require(_0x7f33('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f33('0x12'))('api');var utils=require(_0x7f33('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7f33('0x14'));var db=require(_0x7f33('0x15'))['db'];var integrations=require(_0x7f33('0x16'));var jayson=require(_0x7f33('0x17'));var client=jayson[_0x7f33('0x18')][_0x7f33('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x53b778,_0x20adbf,_0x22f4d6,_0x17f699){return new BPromise(function(_0x5c23e2,_0x59d09e){var _0x5a72b3=_0x17f699||client;return _0x5a72b3['request'](_0x53b778,_0x22f4d6)['then'](function(_0x1f0ec8){logger['info'](_0x7f33('0x1a'),_0x20adbf,_0x7f33('0x1b'));logger[_0x7f33('0x1c')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x20adbf,_0x7f33('0x1b'),JSON['stringify'](_0x1f0ec8));if(_0x1f0ec8[_0x7f33('0x1d')]){if(_0x1f0ec8[_0x7f33('0x1d')]['code']===0x1f4){logger['error'](_0x7f33('0x1a'),_0x20adbf,_0x1f0ec8[_0x7f33('0x1d')][_0x7f33('0x1e')]);return _0x59d09e(_0x1f0ec8[_0x7f33('0x1d')][_0x7f33('0x1e')]);}logger[_0x7f33('0x1d')](_0x7f33('0x1a'),_0x20adbf,_0x1f0ec8[_0x7f33('0x1d')][_0x7f33('0x1e')]);return _0x5c23e2(_0x1f0ec8[_0x7f33('0x1d')][_0x7f33('0x1e')]);}else{logger['info'](_0x7f33('0x1a'),_0x20adbf,_0x7f33('0x1b'));_0x5c23e2(_0x1f0ec8['result'][_0x7f33('0x1e')]);}})[_0x7f33('0x1f')](function(_0x465665){logger[_0x7f33('0x1d')](_0x7f33('0x1a'),_0x20adbf,_0x465665);_0x59d09e(_0x465665);});});}function respondWithStatusCode(_0x137cb0,_0x1961a3){_0x1961a3=_0x1961a3||0xcc;return function(_0x5f4ad4){if(_0x5f4ad4){return _0x137cb0[_0x7f33('0x20')](_0x1961a3);}return _0x137cb0[_0x7f33('0x21')](_0x1961a3)[_0x7f33('0x22')]();};}function respondWithResult(_0x154966,_0x1f80ad){_0x1f80ad=_0x1f80ad||0xc8;return function(_0x17a00f){if(_0x17a00f){return _0x154966[_0x7f33('0x21')](_0x1f80ad)[_0x7f33('0x23')](_0x17a00f);}};}function respondWithFilteredResult(_0x576f50,_0x4f1498){return function(_0x34a249){if(_0x34a249){var _0x3be048=_0x34a249[_0x7f33('0x24')],_0x1dd9c9=_0x4f1498['offset'],_0x27f715=_0x4f1498[_0x7f33('0x25')]+_0x4f1498['limit'],_0x24b8d4;if(_0x27f715>=_0x3be048){_0x27f715=_0x3be048;_0x24b8d4=0xc8;}else{_0x24b8d4=0xce;}_0x576f50[_0x7f33('0x21')](_0x24b8d4);return _0x576f50[_0x7f33('0x26')](_0x7f33('0x27'),_0x1dd9c9+'-'+_0x27f715+'/'+_0x3be048)['json'](_0x34a249);}return null;};}function patchUpdates(_0x519ac8){return function(_0x53acdc){try{jsonpatch[_0x7f33('0x28')](_0x53acdc,_0x519ac8,!![]);}catch(_0x32b0ab){return BPromise[_0x7f33('0x29')](_0x32b0ab);}return _0x53acdc[_0x7f33('0x2a')]();};}function saveUpdates(_0x1d0987,_0x2715bd){return function(_0x457ffb){if(_0x457ffb){return _0x457ffb[_0x7f33('0x2b')](_0x1d0987)[_0x7f33('0x2c')](function(_0x35df32){return _0x35df32;});}return null;};}function removeEntity(_0x3df556,_0xb2d4ec){return function(_0x2b1f30){if(_0x2b1f30){return _0x2b1f30[_0x7f33('0x2d')]()[_0x7f33('0x2c')](function(){_0x3df556['status'](0xcc)[_0x7f33('0x22')]();});}};}function handleEntityNotFound(_0x137186,_0x201ae9){return function(_0x13653d){if(!_0x13653d){_0x137186[_0x7f33('0x20')](0x194);}return _0x13653d;};}function handleError(_0x4cc5ea,_0x1ef055){_0x1ef055=_0x1ef055||0x1f4;return function(_0x3d2b84){logger['error'](_0x3d2b84[_0x7f33('0x2e')]);if(_0x3d2b84[_0x7f33('0x2f')]){delete _0x3d2b84[_0x7f33('0x2f')];}_0x4cc5ea[_0x7f33('0x21')](_0x1ef055)['send'](_0x3d2b84);};}exports[_0x7f33('0x30')]=function(_0x128e51,_0x1e4cac){var _0x36c1a0={},_0x5c3918={},_0x5bfae9={'count':0x0,'rows':[]};var _0x16b018=_[_0x7f33('0x31')](db[_0x7f33('0x32')][_0x7f33('0x33')],function(_0x399618){return{'name':_0x399618['fieldName'],'type':_0x399618['type'][_0x7f33('0x34')]};});_0x5c3918[_0x7f33('0x35')]=_['map'](_0x16b018,'name');_0x5c3918[_0x7f33('0x36')]=_[_0x7f33('0x37')](_0x128e51[_0x7f33('0x36')]);_0x5c3918[_0x7f33('0x38')]=_[_0x7f33('0x39')](_0x5c3918['model'],_0x5c3918[_0x7f33('0x36')]);_0x36c1a0[_0x7f33('0x3a')]=_[_0x7f33('0x39')](_0x5c3918[_0x7f33('0x35')],qs[_0x7f33('0x3b')](_0x128e51[_0x7f33('0x36')][_0x7f33('0x3b')]));_0x36c1a0[_0x7f33('0x3a')]=_0x36c1a0[_0x7f33('0x3a')][_0x7f33('0x3c')]?_0x36c1a0[_0x7f33('0x3a')]:_0x5c3918['model'];if(!_0x128e51[_0x7f33('0x36')]['hasOwnProperty'](_0x7f33('0x3d'))){_0x36c1a0[_0x7f33('0x3e')]=qs[_0x7f33('0x3e')](_0x128e51[_0x7f33('0x36')][_0x7f33('0x3e')]);_0x36c1a0['offset']=qs[_0x7f33('0x25')](_0x128e51[_0x7f33('0x36')]['offset']);}_0x36c1a0['order']=qs[_0x7f33('0x3f')](_0x128e51[_0x7f33('0x36')][_0x7f33('0x3f')]);_0x36c1a0[_0x7f33('0x40')]=qs[_0x7f33('0x38')](_['pick'](_0x128e51[_0x7f33('0x36')],_0x5c3918[_0x7f33('0x38')]),_0x16b018);if(_0x128e51['query'][_0x7f33('0x41')]){_0x36c1a0[_0x7f33('0x40')]=_[_0x7f33('0x42')](_0x36c1a0[_0x7f33('0x40')],{'$or':_[_0x7f33('0x31')](_0x16b018,function(_0x4095af){if(_0x4095af[_0x7f33('0x43')]!==_0x7f33('0x44')){var _0x23a445={};_0x23a445[_0x4095af[_0x7f33('0x2f')]]={'$like':'%'+_0x128e51[_0x7f33('0x36')][_0x7f33('0x41')]+'%'};return _0x23a445;}})});}_0x36c1a0=_['merge']({},_0x36c1a0,_0x128e51[_0x7f33('0x45')]);var _0x5bf38d={'where':_0x36c1a0[_0x7f33('0x40')]};return db[_0x7f33('0x32')][_0x7f33('0x24')](_0x5bf38d)[_0x7f33('0x2c')](function(_0x55478b){_0x5bfae9[_0x7f33('0x24')]=_0x55478b;if(_0x128e51['query']['includeAll']){_0x36c1a0['include']=[{'all':!![]}];}return db[_0x7f33('0x32')][_0x7f33('0x46')](_0x36c1a0);})[_0x7f33('0x2c')](function(_0x50bf97){_0x5bfae9[_0x7f33('0x47')]=_0x50bf97;return _0x5bfae9;})['then'](respondWithFilteredResult(_0x1e4cac,_0x36c1a0))[_0x7f33('0x1f')](handleError(_0x1e4cac,null));};exports['show']=function(_0x4d42cb,_0x21cded){var _0x40d0a2={'raw':![],'where':{'id':_0x4d42cb[_0x7f33('0x48')]['id']}},_0x4901dd={};_0x4901dd[_0x7f33('0x35')]=_['keys'](db['FreshsalesAccount'][_0x7f33('0x33')]);_0x4901dd[_0x7f33('0x36')]=_['keys'](_0x4d42cb[_0x7f33('0x36')]);_0x4901dd['filtears']=_[_0x7f33('0x39')](_0x4901dd[_0x7f33('0x35')],_0x4901dd[_0x7f33('0x36')]);_0x40d0a2[_0x7f33('0x3a')]=_[_0x7f33('0x39')](_0x4901dd[_0x7f33('0x35')],qs['fields'](_0x4d42cb[_0x7f33('0x36')]['fields']));_0x40d0a2[_0x7f33('0x3a')]=_0x40d0a2[_0x7f33('0x3a')]['length']?_0x40d0a2[_0x7f33('0x3a')]:_0x4901dd[_0x7f33('0x35')];if(_0x4d42cb['query'][_0x7f33('0x49')]){_0x40d0a2['include']=[{'all':!![]}];}_0x40d0a2=_['merge']({},_0x40d0a2,_0x4d42cb[_0x7f33('0x45')]);return db[_0x7f33('0x32')][_0x7f33('0x4a')](_0x40d0a2)[_0x7f33('0x2c')](handleEntityNotFound(_0x21cded,null))[_0x7f33('0x2c')](respondWithResult(_0x21cded,null))[_0x7f33('0x1f')](handleError(_0x21cded,null));};exports[_0x7f33('0x4b')]=function(_0x3686fc,_0x45afe4){return db[_0x7f33('0x32')][_0x7f33('0x4b')](_0x3686fc[_0x7f33('0x4c')],{})['then'](respondWithResult(_0x45afe4,0xc9))[_0x7f33('0x1f')](handleError(_0x45afe4,null));};exports[_0x7f33('0x2b')]=function(_0x1e875e,_0x427df2){if(_0x1e875e[_0x7f33('0x4c')]['id']){delete _0x1e875e[_0x7f33('0x4c')]['id'];}return db[_0x7f33('0x32')][_0x7f33('0x4a')]({'where':{'id':_0x1e875e[_0x7f33('0x48')]['id']}})[_0x7f33('0x2c')](handleEntityNotFound(_0x427df2,null))['then'](saveUpdates(_0x1e875e[_0x7f33('0x4c')],null))[_0x7f33('0x2c')](respondWithResult(_0x427df2,null))[_0x7f33('0x1f')](handleError(_0x427df2,null));};exports[_0x7f33('0x2d')]=function(_0x5085a0,_0xccde6a){return db[_0x7f33('0x32')][_0x7f33('0x4a')]({'where':{'id':_0x5085a0[_0x7f33('0x48')]['id']}})[_0x7f33('0x2c')](handleEntityNotFound(_0xccde6a,null))['then'](removeEntity(_0xccde6a,null))[_0x7f33('0x1f')](handleError(_0xccde6a,null));};exports[_0x7f33('0x4d')]=function(_0x45fef3,_0xcfba59,_0xd9dbde){var _0x27724a={};var _0x592ddf={};var _0x5f5c5c;var _0x14690a;return db[_0x7f33('0x32')][_0x7f33('0x4e')]({'where':{'id':_0x45fef3[_0x7f33('0x48')]['id']}})[_0x7f33('0x2c')](handleEntityNotFound(_0xcfba59,null))[_0x7f33('0x2c')](function(_0x2fdb0c){if(_0x2fdb0c){_0x5f5c5c=_0x2fdb0c;_0x592ddf[_0x7f33('0x35')]=_[_0x7f33('0x37')](db[_0x7f33('0x4f')][_0x7f33('0x33')]);_0x592ddf[_0x7f33('0x36')]=_[_0x7f33('0x37')](_0x45fef3[_0x7f33('0x36')]);_0x592ddf['filters']=_['intersection'](_0x592ddf[_0x7f33('0x35')],_0x592ddf[_0x7f33('0x36')]);_0x27724a[_0x7f33('0x3a')]=_['intersection'](_0x592ddf['model'],qs[_0x7f33('0x3b')](_0x45fef3[_0x7f33('0x36')][_0x7f33('0x3b')]));_0x27724a['attributes']=_0x27724a[_0x7f33('0x3a')][_0x7f33('0x3c')]?_0x27724a[_0x7f33('0x3a')]:_0x592ddf[_0x7f33('0x35')];_0x27724a[_0x7f33('0x50')]=qs[_0x7f33('0x3f')](_0x45fef3[_0x7f33('0x36')][_0x7f33('0x3f')]);_0x27724a['where']=qs[_0x7f33('0x38')](_[_0x7f33('0x51')](_0x45fef3['query'],_0x592ddf['filters']));if(_0x45fef3[_0x7f33('0x36')][_0x7f33('0x41')]){_0x27724a['where']=_['merge'](_0x27724a[_0x7f33('0x40')],{'$or':_[_0x7f33('0x31')](_0x27724a[_0x7f33('0x3a')],function(_0x869d58){var _0x4c0b89={};_0x4c0b89[_0x869d58]={'$like':'%'+_0x45fef3[_0x7f33('0x36')][_0x7f33('0x41')]+'%'};return _0x4c0b89;})});}_0x27724a=_[_0x7f33('0x42')]({},_0x27724a,_0x45fef3[_0x7f33('0x45')]);return _0x5f5c5c['getConfigurations'](_0x27724a);}})['then'](function(_0x170268){if(_0x170268){_0x14690a=_0x170268['length'];if(!_0x45fef3[_0x7f33('0x36')]['hasOwnProperty']('nolimit')){_0x27724a[_0x7f33('0x3e')]=qs['limit'](_0x45fef3[_0x7f33('0x36')][_0x7f33('0x3e')]);_0x27724a[_0x7f33('0x25')]=qs[_0x7f33('0x25')](_0x45fef3[_0x7f33('0x36')][_0x7f33('0x25')]);}return _0x5f5c5c[_0x7f33('0x4d')](_0x27724a);}})[_0x7f33('0x2c')](function(_0x278512){if(_0x278512){return _0x278512?{'count':_0x14690a,'rows':_0x278512}:null;}})['then'](respondWithResult(_0xcfba59,null))['catch'](handleError(_0xcfba59,null));};exports['addConfiguration']=function(_0x11363e,_0x35a19e,_0x1fa0a7){if(_0x11363e[_0x7f33('0x4c')]['id']){delete _0x11363e['body']['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x11363e[_0x7f33('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a19e,null))[_0x7f33('0x2c')](function(_0x447410){if(_0x447410){_0x11363e[_0x7f33('0x4c')][_0x7f33('0x52')]=_0x447410['id'];_0x11363e[_0x7f33('0x4c')][_0x7f33('0x53')]=integrations[_0x7f33('0x54')](_0x11363e[_0x7f33('0x4c')][_0x7f33('0x55')],_0x11363e[_0x7f33('0x4c')][_0x7f33('0x43')]);_0x11363e[_0x7f33('0x4c')][_0x7f33('0x56')]=integrations[_0x7f33('0x57')](_0x11363e[_0x7f33('0x4c')][_0x7f33('0x55')],_0x11363e[_0x7f33('0x4c')]['type']);return db['FreshsalesConfiguration'][_0x7f33('0x4b')](_0x11363e[_0x7f33('0x4c')],{'include':[{'model':db[_0x7f33('0x58')],'as':_0x7f33('0x53')},{'model':db[_0x7f33('0x58')],'as':_0x7f33('0x56')}]});}return null;})[_0x7f33('0x2c')](respondWithResult(_0x35a19e,null))[_0x7f33('0x1f')](handleError(_0x35a19e,null));};exports[_0x7f33('0x59')]=function(_0x45d06e,_0x30dda4,_0x594f91){var _0x22466e='';var _0x1cc46f='';return db[_0x7f33('0x32')][_0x7f33('0x4e')]({'where':{'id':_0x45d06e[_0x7f33('0x48')]['id']},'attributes':['id',_0x7f33('0x5a'),_0x7f33('0x5b'),_0x7f33('0x5c')]})['then'](handleEntityNotFound(_0x30dda4,null))['then'](function(_0x290ba0){if(_0x290ba0){_0x1cc46f=_0x290ba0[_0x7f33('0x5a')];_0x22466e=_0x290ba0[_0x7f33('0x5b')];var _0x388e9b=_0x290ba0[_0x7f33('0x5b')][_0x7f33('0x5d')](-0x1);if(_0x388e9b==='/'){_0x22466e=_0x22466e['substring'](0x0,_0x22466e[_0x7f33('0x5e')](_0x388e9b));}return rp({'method':'GET','uri':util[_0x7f33('0x5f')](_0x7f33('0x60'),_0x22466e,_0x7f33('0x61')),'headers':{'Authorization':_0x7f33('0x62')+_0x290ba0[_0x7f33('0x5c')]},'json':!![]});}})[_0x7f33('0x2c')](function(_0x21f6c9){if(_0x21f6c9){var _0x6be040=_0x21f6c9[_0x7f33('0x63')];var _0x2ddd29=![];var _0x1c554e=null;for(_0x1c554e=0x0;_0x1c554e<_0x6be040[_0x7f33('0x3c')];_0x1c554e++){if(_0x6be040[_0x1c554e]['email']===_0x1cc46f){_0x2ddd29=!![];}}if(_0x2ddd29){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7f33('0x64')});}}})['then'](respondWithResult(_0x30dda4,null))[_0x7f33('0x1f')](function(_0x9b2a3){var _0x3f7cfe=_0x45d06e[_0x7f33('0x36')][_0x7f33('0x65')]?0x1f4:_0x9b2a3['statusCode']||0x1f4;logger['error'](_0x7f33('0x66'),'getFields',_0x3f7cfe,JSON[_0x7f33('0x67')](_0x9b2a3));delete _0x9b2a3[_0x7f33('0x2f')];if(_0x3f7cfe===0x191){_0x3f7cfe=0x190;}_0x30dda4['status'](_0x3f7cfe)[_0x7f33('0x68')](_0x45d06e['query'][_0x7f33('0x65')]?{'message':_0x7f33('0x69'),'statusCode':_0x9b2a3['statusCode']}:_0x9b2a3);});}; \ No newline at end of file +var _0x05bf=['GET','format','/api/selector/owners','users','Requested\x20Resource\x20not\x20Found','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','apply','reject','destroy','end','name','send','index','FreshsalesAccount','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','filtears','find','catch','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x05bf,0x77));var _0xf05b=function(_0x39e822,_0x4030cd){_0x39e822=_0x39e822-0x0;var _0x1ef84d=_0x05bf[_0x39e822];return _0x1ef84d;};'use strict';var pdf=require(_0xf05b('0x0'));var emlformat=require(_0xf05b('0x1'));var rimraf=require(_0xf05b('0x2'));var zipdir=require(_0xf05b('0x3'));var jsonpatch=require(_0xf05b('0x4'));var rp=require(_0xf05b('0x5'));var moment=require('moment');var BPromise=require(_0xf05b('0x6'));var Mustache=require(_0xf05b('0x7'));var util=require(_0xf05b('0x8'));var path=require(_0xf05b('0x9'));var sox=require(_0xf05b('0xa'));var csv=require(_0xf05b('0xb'));var ejs=require(_0xf05b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf05b('0xd'));var crypto=require('crypto');var jsforce=require(_0xf05b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf05b('0xb'));var querystring=require(_0xf05b('0xf'));var Papa=require(_0xf05b('0x10'));var Redis=require(_0xf05b('0x11'));var authService=require(_0xf05b('0x12'));var qs=require(_0xf05b('0x13'));var as=require(_0xf05b('0x14'));var hardwareService=require(_0xf05b('0x15'));var logger=require(_0xf05b('0x16'))(_0xf05b('0x17'));var utils=require(_0xf05b('0x18'));var config=require(_0xf05b('0x19'));var licenseUtil=require(_0xf05b('0x1a'));var db=require(_0xf05b('0x1b'))['db'];var integrations=require(_0xf05b('0x1c'));var jayson=require(_0xf05b('0x1d'));var client=jayson[_0xf05b('0x1e')][_0xf05b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x27705f,_0xdc65c2,_0x98400f,_0x4ac3a3){return new BPromise(function(_0x118db4,_0x36af2b){var _0x91435f=_0x4ac3a3||client;return _0x91435f[_0xf05b('0x20')](_0x27705f,_0x98400f)[_0xf05b('0x21')](function(_0x13cfc8){logger[_0xf05b('0x22')](_0xf05b('0x23'),_0xdc65c2,_0xf05b('0x24'));logger[_0xf05b('0x25')](_0xf05b('0x26'),_0xdc65c2,'request\x20sent',JSON[_0xf05b('0x27')](_0x13cfc8));if(_0x13cfc8[_0xf05b('0x28')]){if(_0x13cfc8[_0xf05b('0x28')][_0xf05b('0x29')]===0x1f4){logger[_0xf05b('0x28')](_0xf05b('0x23'),_0xdc65c2,_0x13cfc8['error']['message']);return _0x36af2b(_0x13cfc8[_0xf05b('0x28')][_0xf05b('0x2a')]);}logger[_0xf05b('0x28')](_0xf05b('0x23'),_0xdc65c2,_0x13cfc8[_0xf05b('0x28')][_0xf05b('0x2a')]);return _0x118db4(_0x13cfc8['error']['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0xdc65c2,'request\x20sent');_0x118db4(_0x13cfc8[_0xf05b('0x2b')][_0xf05b('0x2a')]);}})['catch'](function(_0x19bdcc){logger[_0xf05b('0x28')](_0xf05b('0x23'),_0xdc65c2,_0x19bdcc);_0x36af2b(_0x19bdcc);});});}function respondWithStatusCode(_0x40e6ac,_0x500c9a){_0x500c9a=_0x500c9a||0xcc;return function(_0x391c53){if(_0x391c53){return _0x40e6ac[_0xf05b('0x2c')](_0x500c9a);}return _0x40e6ac[_0xf05b('0x2d')](_0x500c9a)['end']();};}function respondWithResult(_0x4c3d6f,_0x84e86a){_0x84e86a=_0x84e86a||0xc8;return function(_0x1a2e0a){if(_0x1a2e0a){return _0x4c3d6f[_0xf05b('0x2d')](_0x84e86a)[_0xf05b('0x2e')](_0x1a2e0a);}};}function respondWithFilteredResult(_0x10a353,_0x3ab687){return function(_0x2a5bf4){if(_0x2a5bf4){var _0xa1a7f3=_0x2a5bf4[_0xf05b('0x2f')],_0x5789df=_0x3ab687[_0xf05b('0x30')],_0xdf29a6=_0x3ab687['offset']+_0x3ab687[_0xf05b('0x31')],_0x3f69ec;if(_0xdf29a6>=_0xa1a7f3){_0xdf29a6=_0xa1a7f3;_0x3f69ec=0xc8;}else{_0x3f69ec=0xce;}_0x10a353[_0xf05b('0x2d')](_0x3f69ec);return _0x10a353['set']('Content-Range',_0x5789df+'-'+_0xdf29a6+'/'+_0xa1a7f3)['json'](_0x2a5bf4);}return null;};}function patchUpdates(_0x48c7d3){return function(_0x1561e6){try{jsonpatch[_0xf05b('0x32')](_0x1561e6,_0x48c7d3,!![]);}catch(_0x20aad4){return BPromise[_0xf05b('0x33')](_0x20aad4);}return _0x1561e6['save']();};}function saveUpdates(_0x17b236,_0x5010bd){return function(_0x3c5c14){if(_0x3c5c14){return _0x3c5c14['update'](_0x17b236)[_0xf05b('0x21')](function(_0x1eacf3){return _0x1eacf3;});}return null;};}function removeEntity(_0x7a329f,_0x2cbfe4){return function(_0x585e17){if(_0x585e17){return _0x585e17[_0xf05b('0x34')]()[_0xf05b('0x21')](function(){_0x7a329f[_0xf05b('0x2d')](0xcc)[_0xf05b('0x35')]();});}};}function handleEntityNotFound(_0x4baf01,_0x170e2d){return function(_0x2d5b32){if(!_0x2d5b32){_0x4baf01[_0xf05b('0x2c')](0x194);}return _0x2d5b32;};}function handleError(_0x31b5bf,_0x49b590){_0x49b590=_0x49b590||0x1f4;return function(_0x105831){logger[_0xf05b('0x28')](_0x105831['stack']);if(_0x105831[_0xf05b('0x36')]){delete _0x105831[_0xf05b('0x36')];}_0x31b5bf[_0xf05b('0x2d')](_0x49b590)[_0xf05b('0x37')](_0x105831);};}exports[_0xf05b('0x38')]=function(_0x1dcab6,_0xc2a51c){var _0x3014d2={},_0x4906cb={},_0x57146f={'count':0x0,'rows':[]};var _0x121a00=_['map'](db[_0xf05b('0x39')][_0xf05b('0x3a')],function(_0x5a66fc){return{'name':_0x5a66fc['fieldName'],'type':_0x5a66fc[_0xf05b('0x3b')]['key']};});_0x4906cb[_0xf05b('0x3c')]=_[_0xf05b('0x3d')](_0x121a00,_0xf05b('0x36'));_0x4906cb['query']=_[_0xf05b('0x3e')](_0x1dcab6[_0xf05b('0x3f')]);_0x4906cb[_0xf05b('0x40')]=_[_0xf05b('0x41')](_0x4906cb[_0xf05b('0x3c')],_0x4906cb[_0xf05b('0x3f')]);_0x3014d2['attributes']=_[_0xf05b('0x41')](_0x4906cb[_0xf05b('0x3c')],qs[_0xf05b('0x42')](_0x1dcab6[_0xf05b('0x3f')][_0xf05b('0x42')]));_0x3014d2[_0xf05b('0x43')]=_0x3014d2[_0xf05b('0x43')][_0xf05b('0x44')]?_0x3014d2['attributes']:_0x4906cb[_0xf05b('0x3c')];if(!_0x1dcab6[_0xf05b('0x3f')]['hasOwnProperty']('nolimit')){_0x3014d2['limit']=qs['limit'](_0x1dcab6['query']['limit']);_0x3014d2[_0xf05b('0x30')]=qs[_0xf05b('0x30')](_0x1dcab6['query']['offset']);}_0x3014d2[_0xf05b('0x45')]=qs['sort'](_0x1dcab6['query'][_0xf05b('0x46')]);_0x3014d2[_0xf05b('0x47')]=qs[_0xf05b('0x40')](_[_0xf05b('0x48')](_0x1dcab6[_0xf05b('0x3f')],_0x4906cb[_0xf05b('0x40')]),_0x121a00);if(_0x1dcab6[_0xf05b('0x3f')][_0xf05b('0x49')]){_0x3014d2['where']=_[_0xf05b('0x4a')](_0x3014d2['where'],{'$or':_['map'](_0x121a00,function(_0x26aca6){if(_0x26aca6[_0xf05b('0x3b')]!==_0xf05b('0x4b')){var _0x4664fe={};_0x4664fe[_0x26aca6['name']]={'$like':'%'+_0x1dcab6['query'][_0xf05b('0x49')]+'%'};return _0x4664fe;}})});}_0x3014d2=_[_0xf05b('0x4a')]({},_0x3014d2,_0x1dcab6['options']);var _0xf5ff40={'where':_0x3014d2['where']};return db[_0xf05b('0x39')][_0xf05b('0x2f')](_0xf5ff40)[_0xf05b('0x21')](function(_0x24c4b7){_0x57146f[_0xf05b('0x2f')]=_0x24c4b7;if(_0x1dcab6[_0xf05b('0x3f')][_0xf05b('0x4c')]){_0x3014d2[_0xf05b('0x4d')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xf05b('0x4e')](_0x3014d2);})[_0xf05b('0x21')](function(_0x438ddf){_0x57146f[_0xf05b('0x4f')]=_0x438ddf;return _0x57146f;})[_0xf05b('0x21')](respondWithFilteredResult(_0xc2a51c,_0x3014d2))['catch'](handleError(_0xc2a51c,null));};exports[_0xf05b('0x50')]=function(_0x1b617e,_0xde4a33){var _0x1d09f5={'raw':![],'where':{'id':_0x1b617e['params']['id']}},_0x71f9f7={};_0x71f9f7[_0xf05b('0x3c')]=_[_0xf05b('0x3e')](db[_0xf05b('0x39')][_0xf05b('0x3a')]);_0x71f9f7[_0xf05b('0x3f')]=_[_0xf05b('0x3e')](_0x1b617e[_0xf05b('0x3f')]);_0x71f9f7[_0xf05b('0x51')]=_[_0xf05b('0x41')](_0x71f9f7[_0xf05b('0x3c')],_0x71f9f7[_0xf05b('0x3f')]);_0x1d09f5['attributes']=_[_0xf05b('0x41')](_0x71f9f7[_0xf05b('0x3c')],qs[_0xf05b('0x42')](_0x1b617e['query']['fields']));_0x1d09f5[_0xf05b('0x43')]=_0x1d09f5[_0xf05b('0x43')][_0xf05b('0x44')]?_0x1d09f5['attributes']:_0x71f9f7[_0xf05b('0x3c')];if(_0x1b617e[_0xf05b('0x3f')][_0xf05b('0x4c')]){_0x1d09f5[_0xf05b('0x4d')]=[{'all':!![]}];}_0x1d09f5=_['merge']({},_0x1d09f5,_0x1b617e['options']);return db['FreshsalesAccount'][_0xf05b('0x52')](_0x1d09f5)[_0xf05b('0x21')](handleEntityNotFound(_0xde4a33,null))['then'](respondWithResult(_0xde4a33,null))[_0xf05b('0x53')](handleError(_0xde4a33,null));};exports[_0xf05b('0x54')]=function(_0x222bf7,_0x51d171){return db[_0xf05b('0x39')]['create'](_0x222bf7[_0xf05b('0x55')],{})[_0xf05b('0x21')](respondWithResult(_0x51d171,0xc9))['catch'](handleError(_0x51d171,null));};exports[_0xf05b('0x56')]=function(_0x114431,_0xfb7998){if(_0x114431[_0xf05b('0x55')]['id']){delete _0x114431[_0xf05b('0x55')]['id'];}return db['FreshsalesAccount'][_0xf05b('0x52')]({'where':{'id':_0x114431['params']['id']}})[_0xf05b('0x21')](handleEntityNotFound(_0xfb7998,null))[_0xf05b('0x21')](saveUpdates(_0x114431['body'],null))[_0xf05b('0x21')](respondWithResult(_0xfb7998,null))['catch'](handleError(_0xfb7998,null));};exports[_0xf05b('0x34')]=function(_0x3ad2b4,_0x3233d4){return db[_0xf05b('0x39')][_0xf05b('0x52')]({'where':{'id':_0x3ad2b4[_0xf05b('0x57')]['id']}})[_0xf05b('0x21')](handleEntityNotFound(_0x3233d4,null))[_0xf05b('0x21')](removeEntity(_0x3233d4,null))['catch'](handleError(_0x3233d4,null));};exports[_0xf05b('0x58')]=function(_0x27f09b,_0x493c8e,_0x58f114){var _0x11b2e3={};var _0x117ac6={};var _0x4f9513;var _0x1e9524;return db[_0xf05b('0x39')][_0xf05b('0x59')]({'where':{'id':_0x27f09b[_0xf05b('0x57')]['id']}})[_0xf05b('0x21')](handleEntityNotFound(_0x493c8e,null))[_0xf05b('0x21')](function(_0x8e4297){if(_0x8e4297){_0x4f9513=_0x8e4297;_0x117ac6[_0xf05b('0x3c')]=_['keys'](db[_0xf05b('0x5a')]['rawAttributes']);_0x117ac6[_0xf05b('0x3f')]=_[_0xf05b('0x3e')](_0x27f09b[_0xf05b('0x3f')]);_0x117ac6[_0xf05b('0x40')]=_[_0xf05b('0x41')](_0x117ac6['model'],_0x117ac6[_0xf05b('0x3f')]);_0x11b2e3[_0xf05b('0x43')]=_[_0xf05b('0x41')](_0x117ac6[_0xf05b('0x3c')],qs['fields'](_0x27f09b[_0xf05b('0x3f')][_0xf05b('0x42')]));_0x11b2e3[_0xf05b('0x43')]=_0x11b2e3['attributes'][_0xf05b('0x44')]?_0x11b2e3['attributes']:_0x117ac6[_0xf05b('0x3c')];_0x11b2e3[_0xf05b('0x45')]=qs[_0xf05b('0x46')](_0x27f09b['query'][_0xf05b('0x46')]);_0x11b2e3[_0xf05b('0x47')]=qs[_0xf05b('0x40')](_[_0xf05b('0x48')](_0x27f09b['query'],_0x117ac6['filters']));if(_0x27f09b[_0xf05b('0x3f')]['filter']){_0x11b2e3[_0xf05b('0x47')]=_['merge'](_0x11b2e3[_0xf05b('0x47')],{'$or':_[_0xf05b('0x3d')](_0x11b2e3[_0xf05b('0x43')],function(_0xa365d8){var _0x38afb6={};_0x38afb6[_0xa365d8]={'$like':'%'+_0x27f09b[_0xf05b('0x3f')][_0xf05b('0x49')]+'%'};return _0x38afb6;})});}_0x11b2e3=_[_0xf05b('0x4a')]({},_0x11b2e3,_0x27f09b['options']);return _0x4f9513[_0xf05b('0x58')](_0x11b2e3);}})[_0xf05b('0x21')](function(_0x2d9b3a){if(_0x2d9b3a){_0x1e9524=_0x2d9b3a[_0xf05b('0x44')];if(!_0x27f09b[_0xf05b('0x3f')]['hasOwnProperty'](_0xf05b('0x5b'))){_0x11b2e3[_0xf05b('0x31')]=qs['limit'](_0x27f09b['query'][_0xf05b('0x31')]);_0x11b2e3[_0xf05b('0x30')]=qs[_0xf05b('0x30')](_0x27f09b[_0xf05b('0x3f')]['offset']);}return _0x4f9513['getConfigurations'](_0x11b2e3);}})[_0xf05b('0x21')](function(_0x19239c){if(_0x19239c){return _0x19239c?{'count':_0x1e9524,'rows':_0x19239c}:null;}})[_0xf05b('0x21')](respondWithResult(_0x493c8e,null))['catch'](handleError(_0x493c8e,null));};exports[_0xf05b('0x5c')]=function(_0x34e6ae,_0x2385fb,_0x11ad2d){if(_0x34e6ae[_0xf05b('0x55')]['id']){delete _0x34e6ae[_0xf05b('0x55')]['id'];}return db[_0xf05b('0x39')][_0xf05b('0x59')]({'where':{'id':_0x34e6ae[_0xf05b('0x57')]['id']}})[_0xf05b('0x21')](handleEntityNotFound(_0x2385fb,null))[_0xf05b('0x21')](function(_0x4e289b){if(_0x4e289b){_0x34e6ae[_0xf05b('0x55')]['AccountId']=_0x4e289b['id'];_0x34e6ae[_0xf05b('0x55')][_0xf05b('0x5d')]=integrations[_0xf05b('0x5e')](_0x34e6ae[_0xf05b('0x55')][_0xf05b('0x5f')],_0x34e6ae['body'][_0xf05b('0x3b')]);_0x34e6ae['body'][_0xf05b('0x60')]=integrations[_0xf05b('0x61')](_0x34e6ae[_0xf05b('0x55')][_0xf05b('0x5f')],_0x34e6ae[_0xf05b('0x55')][_0xf05b('0x3b')]);return db[_0xf05b('0x5a')][_0xf05b('0x54')](_0x34e6ae['body'],{'include':[{'model':db[_0xf05b('0x62')],'as':_0xf05b('0x5d')},{'model':db[_0xf05b('0x62')],'as':_0xf05b('0x60')}]});}return null;})[_0xf05b('0x21')](respondWithResult(_0x2385fb,null))[_0xf05b('0x53')](handleError(_0x2385fb,null));};exports[_0xf05b('0x63')]=function(_0x553b42,_0x29274c,_0x1be5c){var _0x126d45='';var _0x48bda5='';return db[_0xf05b('0x39')][_0xf05b('0x59')]({'where':{'id':_0x553b42['params']['id']},'attributes':['id',_0xf05b('0x64'),_0xf05b('0x65'),_0xf05b('0x66')]})[_0xf05b('0x21')](handleEntityNotFound(_0x29274c,null))[_0xf05b('0x21')](function(_0xade9d8){if(_0xade9d8){_0x48bda5=_0xade9d8[_0xf05b('0x64')];_0x126d45=_0xade9d8[_0xf05b('0x65')];var _0x36889e=_0xade9d8['remoteUri'][_0xf05b('0x67')](-0x1);if(_0x36889e==='/'){_0x126d45=_0x126d45[_0xf05b('0x68')](0x0,_0x126d45['lastIndexOf'](_0x36889e));}return rp({'method':_0xf05b('0x69'),'uri':util[_0xf05b('0x6a')]('%s%s',_0x126d45,_0xf05b('0x6b')),'headers':{'Authorization':'Token\x20token='+_0xade9d8[_0xf05b('0x66')]},'json':!![]});}})[_0xf05b('0x21')](function(_0x16068d){if(_0x16068d){var _0x445f26=_0x16068d[_0xf05b('0x6c')];var _0x2f6bbd=![];var _0x383165=null;for(_0x383165=0x0;_0x383165<_0x445f26[_0xf05b('0x44')];_0x383165++){if(_0x445f26[_0x383165]['email']===_0x48bda5){_0x2f6bbd=!![];}}if(_0x2f6bbd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf05b('0x6d')});}}})['then'](respondWithResult(_0x29274c,null))[_0xf05b('0x53')](function(_0x4132ba){var _0x14e9de=_0x553b42[_0xf05b('0x3f')]['test']?0x1f4:_0x4132ba[_0xf05b('0x6e')]||0x1f4;logger[_0xf05b('0x28')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x14e9de,JSON[_0xf05b('0x27')](_0x4132ba));delete _0x4132ba[_0xf05b('0x36')];if(_0x14e9de===0x191){_0x14e9de=0x190;}_0x29274c[_0xf05b('0x2d')](_0x14e9de)[_0xf05b('0x37')](_0x553b42[_0xf05b('0x3f')]['test']?{'message':_0xf05b('0x6f'),'statusCode':_0x4132ba[_0xf05b('0x6e')]}:_0x4132ba);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8df36e8..612558f 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 _0xe0bf=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2bfa79,_0x4b5d1e){var _0x4d2365=function(_0x55396d){while(--_0x55396d){_0x2bfa79['push'](_0x2bfa79['shift']());}};_0x4d2365(++_0x4b5d1e);}(_0xe0bf,0x123));var _0xfe0b=function(_0x335f02,_0x3507bf){_0x335f02=_0x335f02-0x0;var _0x32a6f1=_0xe0bf[_0x335f02];return _0x32a6f1;};'use strict';var _=require(_0xfe0b('0x0'));var util=require('util');var logger=require(_0xfe0b('0x1'))(_0xfe0b('0x2'));var moment=require(_0xfe0b('0x3'));var BPromise=require(_0xfe0b('0x4'));var rp=require(_0xfe0b('0x5'));var fs=require('fs');var path=require(_0xfe0b('0x6'));var rimraf=require(_0xfe0b('0x7'));var config=require(_0xfe0b('0x8'));var attributes=require(_0xfe0b('0x9'));var integrations=require(_0xfe0b('0xa'));module[_0xfe0b('0xb')]=function(_0x19a3eb,_0xf715e9){return _0x19a3eb[_0xfe0b('0xc')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27de=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5d2bd6,_0x377005){var _0x796b32=function(_0x40014c){while(--_0x40014c){_0x5d2bd6['push'](_0x5d2bd6['shift']());}};_0x796b32(++_0x377005);}(_0x27de,0x111));var _0xe27d=function(_0x5a7792,_0x4cd27e){_0x5a7792=_0x5a7792-0x0;var _0x1b6bc7=_0x27de[_0x5a7792];return _0x1b6bc7;};'use strict';var _=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var logger=require(_0xe27d('0x2'))(_0xe27d('0x3'));var moment=require(_0xe27d('0x4'));var BPromise=require(_0xe27d('0x5'));var rp=require(_0xe27d('0x6'));var fs=require('fs');var path=require(_0xe27d('0x7'));var rimraf=require(_0xe27d('0x8'));var config=require('../../config/environment');var attributes=require(_0xe27d('0x9'));var integrations=require(_0xe27d('0xa'));module[_0xe27d('0xb')]=function(_0x41ae0f,_0x3cf482){return _0x41ae0f[_0xe27d('0xc')](_0xe27d('0xd'),attributes,{'tableName':_0xe27d('0xe'),'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 5dbe838..ea67463 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 _0x9851=['message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b7c03,_0x166134){var _0x2bc83f=function(_0x408580){while(--_0x408580){_0x2b7c03['push'](_0x2b7c03['shift']());}};_0x2bc83f(++_0x166134);}(_0x9851,0x1f1));var _0x1985=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9851[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x1985('0x0'));var util=require('util');var moment=require(_0x1985('0x1'));var BPromise=require(_0x1985('0x2'));var rs=require(_0x1985('0x3'));var fs=require('fs');var Redis=require(_0x1985('0x4'));var db=require(_0x1985('0x5'))['db'];var utils=require(_0x1985('0x6'));var logger=require(_0x1985('0x7'))(_0x1985('0x8'));var config=require(_0x1985('0x9'));var jayson=require(_0x1985('0xa'));var client=jayson['client'][_0x1985('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a5919,_0x310f2e,_0x50eea1){return new BPromise(function(_0x316889,_0x2f7760){return client['request'](_0x8a5919,_0x50eea1)[_0x1985('0xc')](function(_0x4cf7a7){logger[_0x1985('0xd')](_0x1985('0xe'),_0x310f2e,_0x1985('0xf'));logger[_0x1985('0x10')](_0x1985('0x11'),_0x310f2e,_0x1985('0xf'),JSON[_0x1985('0x12')](_0x4cf7a7));if(_0x4cf7a7[_0x1985('0x13')]){if(_0x4cf7a7[_0x1985('0x13')][_0x1985('0x14')]===0x1f4){logger[_0x1985('0x13')](_0x1985('0xe'),_0x310f2e,_0x4cf7a7['error'][_0x1985('0x15')]);return _0x2f7760(_0x4cf7a7[_0x1985('0x13')]['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x310f2e,_0x4cf7a7[_0x1985('0x13')][_0x1985('0x15')]);return _0x316889(_0x4cf7a7['error'][_0x1985('0x15')]);}else{logger[_0x1985('0xd')](_0x1985('0xe'),_0x310f2e,'request\x20sent');_0x316889(_0x4cf7a7[_0x1985('0x16')]['message']);}})[_0x1985('0x17')](function(_0x5a8aa0){logger[_0x1985('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x310f2e,_0x5a8aa0);_0x2f7760(_0x5a8aa0);});});}exports[_0x1985('0x18')]=function(_0x2c7279){var _0x3e91cc=this;return new Promise(function(_0x433a33,_0xd31a71){return db[_0x1985('0x19')][_0x1985('0x1a')]({'raw':_0x2c7279[_0x1985('0x1b')]?_0x2c7279['options'][_0x1985('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c7279[_0x1985('0x1b')]?_0x2c7279['options'][_0x1985('0x1d')]||null:null,'attributes':_0x2c7279[_0x1985('0x1b')]?_0x2c7279[_0x1985('0x1b')][_0x1985('0x1e')]||null:null,'limit':_0x2c7279[_0x1985('0x1b')]?_0x2c7279[_0x1985('0x1b')][_0x1985('0x1f')]||null:null,'include':_0x2c7279[_0x1985('0x1b')]?_0x2c7279[_0x1985('0x1b')][_0x1985('0x20')]?_[_0x1985('0x21')](_0x2c7279['options'][_0x1985('0x20')],function(_0x6d7358){return{'model':db[_0x6d7358[_0x1985('0x22')]],'as':_0x6d7358['as'],'attributes':_0x6d7358[_0x1985('0x1e')],'include':_0x6d7358[_0x1985('0x20')]?_['map'](_0x6d7358[_0x1985('0x20')],function(_0x17ffe2){return{'model':db[_0x17ffe2[_0x1985('0x22')]],'as':_0x17ffe2['as'],'attributes':_0x17ffe2[_0x1985('0x1e')],'include':_0x17ffe2['include']?_[_0x1985('0x21')](_0x17ffe2[_0x1985('0x20')],function(_0x3ea584){return{'model':db[_0x3ea584[_0x1985('0x22')]],'as':_0x3ea584['as'],'attributes':_0x3ea584['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf4300d){logger[_0x1985('0xd')](_0x1985('0x18'),_0x2c7279);logger[_0x1985('0x10')]('GetFreshsalesAccount',_0x2c7279,JSON[_0x1985('0x12')](_0xf4300d));_0x433a33(_0xf4300d);})['catch'](function(_0x5ed429){logger[_0x1985('0x13')]('GetFreshsalesAccount',_0x5ed429['message'],_0x2c7279);_0xd31a71(_0x3e91cc[_0x1985('0x13')](0x1f4,_0x5ed429[_0x1985('0x15')]));});});};exports[_0x1985('0x23')]=function(_0xb718c0){var _0x5962d8=this;return new Promise(function(_0x18510f,_0x18634e){return db[_0x1985('0x19')][_0x1985('0x24')]({'raw':_0xb718c0[_0x1985('0x1b')]?_0xb718c0['options'][_0x1985('0x1c')]===undefined?!![]:![]:!![],'where':_0xb718c0[_0x1985('0x1b')]?_0xb718c0[_0x1985('0x1b')][_0x1985('0x1d')]||null:null,'attributes':_0xb718c0[_0x1985('0x1b')]?_0xb718c0[_0x1985('0x1b')]['attributes']||null:null,'include':_0xb718c0[_0x1985('0x1b')]?_0xb718c0[_0x1985('0x1b')][_0x1985('0x20')]?_[_0x1985('0x21')](_0xb718c0['options'][_0x1985('0x20')],function(_0x4d7172){return{'model':db[_0x4d7172['model']],'as':_0x4d7172['as'],'attributes':_0x4d7172[_0x1985('0x1e')],'include':_0x4d7172[_0x1985('0x20')]?_['map'](_0x4d7172['include'],function(_0xf904d1){return{'model':db[_0xf904d1[_0x1985('0x22')]],'as':_0xf904d1['as'],'attributes':_0xf904d1[_0x1985('0x1e')],'include':_0xf904d1[_0x1985('0x20')]?_[_0x1985('0x21')](_0xf904d1[_0x1985('0x20')],function(_0x323188){return{'model':db[_0x323188[_0x1985('0x22')]],'as':_0x323188['as'],'attributes':_0x323188[_0x1985('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1985('0xc')](function(_0x40d8b2){logger['info'](_0x1985('0x23'),_0xb718c0);logger['debug']('ShowFreshsalesAccount',_0xb718c0,JSON['stringify'](_0x40d8b2));_0x18510f(_0x40d8b2);})[_0x1985('0x17')](function(_0x42f0f2){logger['error'](_0x1985('0x23'),_0x42f0f2['message'],_0xb718c0);_0x18634e(_0x5962d8[_0x1985('0x13')](0x1f4,_0x42f0f2[_0x1985('0x15')]));});});}; \ No newline at end of file +var _0x10ad=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4346ae,_0x367236){var _0x4955b0=function(_0x97f394){while(--_0x97f394){_0x4346ae['push'](_0x4346ae['shift']());}};_0x4955b0(++_0x367236);}(_0x10ad,0xf4));var _0xd10a=function(_0x40a839,_0x364ea8){_0x40a839=_0x40a839-0x0;var _0x586dec=_0x10ad[_0x40a839];return _0x586dec;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd10a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd10a('0x1'));var db=require(_0xd10a('0x2'))['db'];var utils=require(_0xd10a('0x3'));var logger=require(_0xd10a('0x4'))('rpc');var config=require(_0xd10a('0x5'));var jayson=require(_0xd10a('0x6'));var client=jayson[_0xd10a('0x7')][_0xd10a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x429316,_0xdae354,_0x217329){return new BPromise(function(_0x194a4a,_0x5be3da){return client['request'](_0x429316,_0x217329)[_0xd10a('0x9')](function(_0x4d8613){logger[_0xd10a('0xa')](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));logger[_0xd10a('0xd')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0xdae354,_0xd10a('0xc'),JSON[_0xd10a('0xe')](_0x4d8613));if(_0x4d8613[_0xd10a('0xf')]){if(_0x4d8613['error'][_0xd10a('0x10')]===0x1f4){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x5be3da(_0x4d8613[_0xd10a('0xf')]['message']);}logger['error'](_0xd10a('0xb'),_0xdae354,_0x4d8613[_0xd10a('0xf')][_0xd10a('0x11')]);return _0x194a4a(_0x4d8613[_0xd10a('0xf')]['message']);}else{logger['info'](_0xd10a('0xb'),_0xdae354,_0xd10a('0xc'));_0x194a4a(_0x4d8613[_0xd10a('0x12')][_0xd10a('0x11')]);}})[_0xd10a('0x13')](function(_0x33bb89){logger[_0xd10a('0xf')](_0xd10a('0xb'),_0xdae354,_0x33bb89);_0x5be3da(_0x33bb89);});});}exports[_0xd10a('0x14')]=function(_0x48a07b){var _0x589fb3=this;return new Promise(function(_0x40dd9f,_0x27d1a7){return db['FreshsalesAccount']['findAll']({'raw':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x17')]||null:null,'attributes':_0x48a07b['options']?_0x48a07b['options'][_0xd10a('0x18')]||null:null,'limit':_0x48a07b['options']?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x19')]||null:null,'include':_0x48a07b[_0xd10a('0x15')]?_0x48a07b[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x48a07b['options'][_0xd10a('0x1a')],function(_0x13eefe){return{'model':db[_0x13eefe[_0xd10a('0x1c')]],'as':_0x13eefe['as'],'attributes':_0x13eefe[_0xd10a('0x18')],'include':_0x13eefe[_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x13eefe[_0xd10a('0x1a')],function(_0x3715fe){return{'model':db[_0x3715fe['model']],'as':_0x3715fe['as'],'attributes':_0x3715fe['attributes'],'include':_0x3715fe['include']?_[_0xd10a('0x1b')](_0x3715fe[_0xd10a('0x1a')],function(_0x58f500){return{'model':db[_0x58f500[_0xd10a('0x1c')]],'as':_0x58f500['as'],'attributes':_0x58f500[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x152bd5){logger[_0xd10a('0xa')]('GetFreshsalesAccount',_0x48a07b);logger[_0xd10a('0xd')](_0xd10a('0x14'),_0x48a07b,JSON[_0xd10a('0xe')](_0x152bd5));_0x40dd9f(_0x152bd5);})[_0xd10a('0x13')](function(_0x41e582){logger[_0xd10a('0xf')](_0xd10a('0x14'),_0x41e582[_0xd10a('0x11')],_0x48a07b);_0x27d1a7(_0x589fb3[_0xd10a('0xf')](0x1f4,_0x41e582[_0xd10a('0x11')]));});});};exports[_0xd10a('0x1d')]=function(_0x45e9fd){var _0x12ab07=this;return new Promise(function(_0xd7741,_0x4ad3d4){return db['FreshsalesAccount'][_0xd10a('0x1e')]({'raw':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x16')]===undefined?!![]:![]:!![],'where':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['where']||null:null,'attributes':_0x45e9fd[_0xd10a('0x15')]?_0x45e9fd[_0xd10a('0x15')]['attributes']||null:null,'include':_0x45e9fd['options']?_0x45e9fd[_0xd10a('0x15')][_0xd10a('0x1a')]?_[_0xd10a('0x1b')](_0x45e9fd[_0xd10a('0x15')]['include'],function(_0xa6aeeb){return{'model':db[_0xa6aeeb['model']],'as':_0xa6aeeb['as'],'attributes':_0xa6aeeb[_0xd10a('0x18')],'include':_0xa6aeeb['include']?_['map'](_0xa6aeeb[_0xd10a('0x1a')],function(_0x1bce2b){return{'model':db[_0x1bce2b[_0xd10a('0x1c')]],'as':_0x1bce2b['as'],'attributes':_0x1bce2b['attributes'],'include':_0x1bce2b[_0xd10a('0x1a')]?_['map'](_0x1bce2b[_0xd10a('0x1a')],function(_0x1ab0a2){return{'model':db[_0x1ab0a2[_0xd10a('0x1c')]],'as':_0x1ab0a2['as'],'attributes':_0x1ab0a2[_0xd10a('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd10a('0x9')](function(_0x22ee6e){logger[_0xd10a('0xa')]('ShowFreshsalesAccount',_0x45e9fd);logger[_0xd10a('0xd')](_0xd10a('0x1d'),_0x45e9fd,JSON[_0xd10a('0xe')](_0x22ee6e));_0xd7741(_0x22ee6e);})[_0xd10a('0x13')](function(_0x4997b0){logger[_0xd10a('0xf')](_0xd10a('0x1d'),_0x4997b0[_0xd10a('0x11')],_0x45e9fd);_0x4ad3d4(_0x12ab07['error'](0x1f4,_0x4997b0['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index ab79e57..257755d 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 _0x25f3=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects'];(function(_0x577ba0,_0x1d188e){var _0x212b52=function(_0x282f9a){while(--_0x282f9a){_0x577ba0['push'](_0x577ba0['shift']());}};_0x212b52(++_0x1d188e);}(_0x25f3,0xe3));var _0x325f=function(_0x578358,_0x4ae0d6){_0x578358=_0x578358-0x0;var _0x13b873=_0x25f3[_0x578358];return _0x13b873;};'use strict';var multer=require(_0x325f('0x0'));var util=require(_0x325f('0x1'));var path=require(_0x325f('0x2'));var timeout=require(_0x325f('0x3'));var express=require(_0x325f('0x4'));var router=express[_0x325f('0x5')]();var auth=require(_0x325f('0x6'));var interaction=require(_0x325f('0x7'));var config=require(_0x325f('0x8'));var controller=require(_0x325f('0x9'));router[_0x325f('0xa')]('/',auth[_0x325f('0xb')](),controller[_0x325f('0xc')]);router[_0x325f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x325f('0xd')]);router[_0x325f('0xa')](_0x325f('0xe'),auth[_0x325f('0xb')](),controller[_0x325f('0xf')]);router['get'](_0x325f('0x10'),auth[_0x325f('0xb')](),controller[_0x325f('0x11')]);router[_0x325f('0xa')](_0x325f('0x12'),auth[_0x325f('0xb')](),controller[_0x325f('0x13')]);router[_0x325f('0x14')]('/',auth[_0x325f('0xb')](),controller[_0x325f('0x15')]);router[_0x325f('0x16')](_0x325f('0x17'),auth[_0x325f('0xb')](),controller['update']);router[_0x325f('0x18')](_0x325f('0x17'),auth[_0x325f('0xb')](),controller[_0x325f('0x19')]);module[_0x325f('0x1a')]=router; \ No newline at end of file +var _0x7acf=['getFields','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7acf,0xb7));var _0xf7ac=function(_0x36148e,_0x36ce23){_0x36148e=_0x36148e-0x0;var _0x1b40c1=_0x7acf[_0x36148e];return _0x1b40c1;};'use strict';var multer=require(_0xf7ac('0x0'));var util=require('util');var path=require(_0xf7ac('0x1'));var timeout=require(_0xf7ac('0x2'));var express=require(_0xf7ac('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf7ac('0x4'));var controller=require(_0xf7ac('0x5'));router[_0xf7ac('0x6')]('/',auth[_0xf7ac('0x7')](),controller[_0xf7ac('0x8')]);router['get'](_0xf7ac('0x9'),auth[_0xf7ac('0x7')](),controller[_0xf7ac('0xa')]);router['get'](_0xf7ac('0xb'),auth[_0xf7ac('0x7')](),controller[_0xf7ac('0xc')]);router[_0xf7ac('0x6')](_0xf7ac('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf7ac('0x6')](_0xf7ac('0xe'),auth[_0xf7ac('0x7')](),controller[_0xf7ac('0xf')]);router[_0xf7ac('0x10')]('/',auth[_0xf7ac('0x7')](),controller[_0xf7ac('0x11')]);router['put']('/:id',auth[_0xf7ac('0x7')](),controller[_0xf7ac('0x12')]);router[_0xf7ac('0x13')](_0xf7ac('0x9'),auth['isAuthenticated'](),controller[_0xf7ac('0x14')]);module[_0xf7ac('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 d5e8ff3..6874190 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 _0x911f=['sequelize','exports','STRING'];(function(_0x556689,_0x1a5faf){var _0xbafd01=function(_0xb955a){while(--_0xb955a){_0x556689['push'](_0x556689['shift']());}};_0xbafd01(++_0x1a5faf);}(_0x911f,0xa8));var _0xf911=function(_0x1e033f,_0x32bd94){_0x1e033f=_0x1e033f-0x0;var _0x53ee38=_0x911f[_0x1e033f];return _0x53ee38;};'use strict';var Sequelize=require(_0xf911('0x0'));module[_0xf911('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf911('0x2')]}}; \ No newline at end of file +var _0x18ef=['STRING','sequelize','exports'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x18ef,0x118));var _0xf18e=function(_0x10c803,_0x2bd2c1){_0x10c803=_0x10c803-0x0;var _0x1e8b8e=_0x18ef[_0x10c803];return _0x1e8b8e;};'use strict';var Sequelize=require(_0xf18e('0x0'));module[_0xf18e('0x1')]={'name':{'type':Sequelize[_0xf18e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b7324e4..00501a0 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 _0x5c92=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','findAll','params','find','create','body','getSubjects','findOne','keys','FreshsalesField','getDescriptions','getFields','html-pdf','eml-format','rimraf','moment','mustache','util','to-csv','ejs','lodash','squel'];(function(_0x52263c,_0x4577e6){var _0x1594e4=function(_0x5d8765){while(--_0x5d8765){_0x52263c['push'](_0x52263c['shift']());}};_0x1594e4(++_0x4577e6);}(_0x5c92,0x1e2));var _0x25c9=function(_0x53d24a,_0x2dba06){_0x53d24a=_0x53d24a-0x0;var _0x2b9195=_0x5c92[_0x53d24a];return _0x2b9195;};'use strict';var pdf=require(_0x25c9('0x0'));var emlformat=require(_0x25c9('0x1'));var rimraf=require(_0x25c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25c9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x25c9('0x4'));var util=require(_0x25c9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x25c9('0x6'));var ejs=require(_0x25c9('0x7'));var fs=require('fs');var _=require(_0x25c9('0x8'));var squel=require(_0x25c9('0x9'));var crypto=require(_0x25c9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x25c9('0xb'));var toCsv=require('to-csv');var querystring=require(_0x25c9('0xc'));var Papa=require(_0x25c9('0xd'));var Redis=require('ioredis');var authService=require(_0x25c9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x25c9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x25c9('0x10'));var utils=require(_0x25c9('0x11'));var config=require(_0x25c9('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x25c9('0x13'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26e2a4,_0x321d5b,_0x3402c0,_0x4e0ae9){return new BPromise(function(_0x4150b2,_0x2b5d22){var _0x427fdf=_0x4e0ae9||client;return _0x427fdf['request'](_0x26e2a4,_0x3402c0)[_0x25c9('0x14')](function(_0x2cff08){logger[_0x25c9('0x15')](_0x25c9('0x16'),_0x321d5b,_0x25c9('0x17'));logger[_0x25c9('0x18')](_0x25c9('0x19'),_0x321d5b,_0x25c9('0x17'),JSON[_0x25c9('0x1a')](_0x2cff08));if(_0x2cff08[_0x25c9('0x1b')]){if(_0x2cff08['error'][_0x25c9('0x1c')]===0x1f4){logger[_0x25c9('0x1b')](_0x25c9('0x16'),_0x321d5b,_0x2cff08[_0x25c9('0x1b')][_0x25c9('0x1d')]);return _0x2b5d22(_0x2cff08['error'][_0x25c9('0x1d')]);}logger[_0x25c9('0x1b')](_0x25c9('0x16'),_0x321d5b,_0x2cff08[_0x25c9('0x1b')][_0x25c9('0x1d')]);return _0x4150b2(_0x2cff08[_0x25c9('0x1b')][_0x25c9('0x1d')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x321d5b,_0x25c9('0x17'));_0x4150b2(_0x2cff08[_0x25c9('0x1e')][_0x25c9('0x1d')]);}})[_0x25c9('0x1f')](function(_0x43dcdd){logger[_0x25c9('0x1b')](_0x25c9('0x16'),_0x321d5b,_0x43dcdd);_0x2b5d22(_0x43dcdd);});});}function respondWithStatusCode(_0xc0c641,_0x29924d){_0x29924d=_0x29924d||0xcc;return function(_0x38e1c0){if(_0x38e1c0){return _0xc0c641['sendStatus'](_0x29924d);}return _0xc0c641[_0x25c9('0x20')](_0x29924d)[_0x25c9('0x21')]();};}function respondWithResult(_0x4075f3,_0xabb5db){_0xabb5db=_0xabb5db||0xc8;return function(_0x3ba7b7){if(_0x3ba7b7){return _0x4075f3[_0x25c9('0x20')](_0xabb5db)[_0x25c9('0x22')](_0x3ba7b7);}};}function respondWithFilteredResult(_0xcb95a0,_0x57b446){return function(_0x1ee98a){if(_0x1ee98a){var _0x4a4c7b=_0x1ee98a[_0x25c9('0x23')],_0x17e0f4=_0x57b446[_0x25c9('0x24')],_0x3718ee=_0x57b446[_0x25c9('0x24')]+_0x57b446[_0x25c9('0x25')],_0x53ebd3;if(_0x3718ee>=_0x4a4c7b){_0x3718ee=_0x4a4c7b;_0x53ebd3=0xc8;}else{_0x53ebd3=0xce;}_0xcb95a0['status'](_0x53ebd3);return _0xcb95a0[_0x25c9('0x26')](_0x25c9('0x27'),_0x17e0f4+'-'+_0x3718ee+'/'+_0x4a4c7b)[_0x25c9('0x22')](_0x1ee98a);}return null;};}function patchUpdates(_0xa8ed55){return function(_0x5e025c){try{jsonpatch[_0x25c9('0x28')](_0x5e025c,_0xa8ed55,!![]);}catch(_0x404de1){return BPromise[_0x25c9('0x29')](_0x404de1);}return _0x5e025c[_0x25c9('0x2a')]();};}function saveUpdates(_0x2004de,_0x22d18a){return function(_0x377697){if(_0x377697){return _0x377697[_0x25c9('0x2b')](_0x2004de)[_0x25c9('0x14')](function(_0x4cf936){return _0x4cf936;});}return null;};}function removeEntity(_0x4d7f6b,_0x3d9ace){return function(_0x4ddd24){if(_0x4ddd24){return _0x4ddd24[_0x25c9('0x2c')]()[_0x25c9('0x14')](function(){_0x4d7f6b[_0x25c9('0x20')](0xcc)[_0x25c9('0x21')]();});}};}function handleEntityNotFound(_0x188bbc,_0x31f83){return function(_0x1726a2){if(!_0x1726a2){_0x188bbc[_0x25c9('0x2d')](0x194);}return _0x1726a2;};}function handleError(_0x1304de,_0x279895){_0x279895=_0x279895||0x1f4;return function(_0x2f4c58){logger[_0x25c9('0x1b')](_0x2f4c58['stack']);if(_0x2f4c58[_0x25c9('0x2e')]){delete _0x2f4c58[_0x25c9('0x2e')];}_0x1304de[_0x25c9('0x20')](_0x279895)['send'](_0x2f4c58);};}exports[_0x25c9('0x2f')]=function(_0x424a03,_0x249ff6){var _0x39d68a={},_0x3008a7={},_0xf38a71={'count':0x0,'rows':[]};var _0x5c34b8=_[_0x25c9('0x30')](db['FreshsalesConfiguration'][_0x25c9('0x31')],function(_0x515115){return{'name':_0x515115[_0x25c9('0x32')],'type':_0x515115[_0x25c9('0x33')]['key']};});_0x3008a7[_0x25c9('0x34')]=_[_0x25c9('0x30')](_0x5c34b8,'name');_0x3008a7[_0x25c9('0x35')]=_['keys'](_0x424a03['query']);_0x3008a7[_0x25c9('0x36')]=_[_0x25c9('0x37')](_0x3008a7['model'],_0x3008a7[_0x25c9('0x35')]);_0x39d68a['attributes']=_[_0x25c9('0x37')](_0x3008a7[_0x25c9('0x34')],qs[_0x25c9('0x38')](_0x424a03[_0x25c9('0x35')]['fields']));_0x39d68a['attributes']=_0x39d68a[_0x25c9('0x39')][_0x25c9('0x3a')]?_0x39d68a[_0x25c9('0x39')]:_0x3008a7[_0x25c9('0x34')];if(!_0x424a03[_0x25c9('0x35')][_0x25c9('0x3b')](_0x25c9('0x3c'))){_0x39d68a[_0x25c9('0x25')]=qs[_0x25c9('0x25')](_0x424a03[_0x25c9('0x35')][_0x25c9('0x25')]);_0x39d68a[_0x25c9('0x24')]=qs[_0x25c9('0x24')](_0x424a03[_0x25c9('0x35')][_0x25c9('0x24')]);}_0x39d68a[_0x25c9('0x3d')]=qs['sort'](_0x424a03[_0x25c9('0x35')][_0x25c9('0x3e')]);_0x39d68a[_0x25c9('0x3f')]=qs['filters'](_[_0x25c9('0x40')](_0x424a03[_0x25c9('0x35')],_0x3008a7[_0x25c9('0x36')]),_0x5c34b8);if(_0x424a03['query'][_0x25c9('0x41')]){_0x39d68a[_0x25c9('0x3f')]=_['merge'](_0x39d68a[_0x25c9('0x3f')],{'$or':_[_0x25c9('0x30')](_0x5c34b8,function(_0x589cb0){if(_0x589cb0[_0x25c9('0x33')]!=='VIRTUAL'){var _0x2bb0cd={};_0x2bb0cd[_0x589cb0[_0x25c9('0x2e')]]={'$like':'%'+_0x424a03[_0x25c9('0x35')][_0x25c9('0x41')]+'%'};return _0x2bb0cd;}})});}_0x39d68a=_[_0x25c9('0x42')]({},_0x39d68a,_0x424a03[_0x25c9('0x43')]);var _0x1c42fd={'where':_0x39d68a[_0x25c9('0x3f')]};return db[_0x25c9('0x44')][_0x25c9('0x23')](_0x1c42fd)[_0x25c9('0x14')](function(_0x46b045){_0xf38a71[_0x25c9('0x23')]=_0x46b045;if(_0x424a03['query'][_0x25c9('0x45')]){_0x39d68a[_0x25c9('0x46')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x25c9('0x47')](_0x39d68a);})[_0x25c9('0x14')](function(_0x56d655){_0xf38a71['rows']=_0x56d655;return _0xf38a71;})['then'](respondWithFilteredResult(_0x249ff6,_0x39d68a))[_0x25c9('0x1f')](handleError(_0x249ff6,null));};exports['show']=function(_0x56c220,_0x162df0){var _0x281ed3={'raw':![],'where':{'id':_0x56c220[_0x25c9('0x48')]['id']}},_0x5dc825={};_0x5dc825[_0x25c9('0x34')]=_['keys'](db['FreshsalesConfiguration'][_0x25c9('0x31')]);_0x5dc825[_0x25c9('0x35')]=_['keys'](_0x56c220[_0x25c9('0x35')]);_0x5dc825['filtears']=_[_0x25c9('0x37')](_0x5dc825['model'],_0x5dc825[_0x25c9('0x35')]);_0x281ed3[_0x25c9('0x39')]=_[_0x25c9('0x37')](_0x5dc825['model'],qs[_0x25c9('0x38')](_0x56c220[_0x25c9('0x35')]['fields']));_0x281ed3[_0x25c9('0x39')]=_0x281ed3[_0x25c9('0x39')][_0x25c9('0x3a')]?_0x281ed3[_0x25c9('0x39')]:_0x5dc825[_0x25c9('0x34')];if(_0x56c220[_0x25c9('0x35')][_0x25c9('0x45')]){_0x281ed3[_0x25c9('0x46')]=[{'all':!![]}];}_0x281ed3=_[_0x25c9('0x42')]({},_0x281ed3,_0x56c220['options']);return db['FreshsalesConfiguration'][_0x25c9('0x49')](_0x281ed3)[_0x25c9('0x14')](handleEntityNotFound(_0x162df0,null))[_0x25c9('0x14')](respondWithResult(_0x162df0,null))[_0x25c9('0x1f')](handleError(_0x162df0,null));};exports[_0x25c9('0x4a')]=function(_0x5c6ebb,_0xd5a94e){return db[_0x25c9('0x44')][_0x25c9('0x4a')](_0x5c6ebb[_0x25c9('0x4b')],{})[_0x25c9('0x14')](respondWithResult(_0xd5a94e,0xc9))['catch'](handleError(_0xd5a94e,null));};exports[_0x25c9('0x2b')]=function(_0x320d13,_0x1fa535){if(_0x320d13[_0x25c9('0x4b')]['id']){delete _0x320d13[_0x25c9('0x4b')]['id'];}return db[_0x25c9('0x44')][_0x25c9('0x49')]({'where':{'id':_0x320d13['params']['id']}})[_0x25c9('0x14')](handleEntityNotFound(_0x1fa535,null))[_0x25c9('0x14')](saveUpdates(_0x320d13[_0x25c9('0x4b')],null))[_0x25c9('0x14')](respondWithResult(_0x1fa535,null))[_0x25c9('0x1f')](handleError(_0x1fa535,null));};exports[_0x25c9('0x2c')]=function(_0x5915c1,_0x2d9e44){return db['FreshsalesConfiguration'][_0x25c9('0x49')]({'where':{'id':_0x5915c1[_0x25c9('0x48')]['id']}})[_0x25c9('0x14')](handleEntityNotFound(_0x2d9e44,null))[_0x25c9('0x14')](removeEntity(_0x2d9e44,null))[_0x25c9('0x1f')](handleError(_0x2d9e44,null));};exports[_0x25c9('0x4c')]=function(_0x322cdf,_0x51ac88,_0x2d9729){var _0x291146={};var _0x3d9938={};var _0x2856dc;var _0x41ae03;return db[_0x25c9('0x44')][_0x25c9('0x4d')]({'where':{'id':_0x322cdf[_0x25c9('0x48')]['id']}})[_0x25c9('0x14')](handleEntityNotFound(_0x51ac88,null))[_0x25c9('0x14')](function(_0x15dd43){if(_0x15dd43){_0x2856dc=_0x15dd43;_0x3d9938[_0x25c9('0x34')]=_[_0x25c9('0x4e')](db[_0x25c9('0x4f')]['rawAttributes']);_0x3d9938[_0x25c9('0x35')]=_[_0x25c9('0x4e')](_0x322cdf[_0x25c9('0x35')]);_0x3d9938[_0x25c9('0x36')]=_[_0x25c9('0x37')](_0x3d9938[_0x25c9('0x34')],_0x3d9938['query']);_0x291146[_0x25c9('0x39')]=_[_0x25c9('0x37')](_0x3d9938[_0x25c9('0x34')],qs['fields'](_0x322cdf[_0x25c9('0x35')][_0x25c9('0x38')]));_0x291146[_0x25c9('0x39')]=_0x291146['attributes'][_0x25c9('0x3a')]?_0x291146[_0x25c9('0x39')]:_0x3d9938['model'];_0x291146[_0x25c9('0x3d')]=qs[_0x25c9('0x3e')](_0x322cdf[_0x25c9('0x35')][_0x25c9('0x3e')]);_0x291146[_0x25c9('0x3f')]=qs[_0x25c9('0x36')](_['pick'](_0x322cdf[_0x25c9('0x35')],_0x3d9938[_0x25c9('0x36')]));if(_0x322cdf[_0x25c9('0x35')][_0x25c9('0x41')]){_0x291146[_0x25c9('0x3f')]=_[_0x25c9('0x42')](_0x291146['where'],{'$or':_[_0x25c9('0x30')](_0x291146['attributes'],function(_0x536a1f){var _0x11d2e1={};_0x11d2e1[_0x536a1f]={'$like':'%'+_0x322cdf[_0x25c9('0x35')][_0x25c9('0x41')]+'%'};return _0x11d2e1;})});}_0x291146=_[_0x25c9('0x42')]({},_0x291146,_0x322cdf[_0x25c9('0x43')]);return _0x2856dc[_0x25c9('0x4c')](_0x291146);}})[_0x25c9('0x14')](function(_0x3482e3){if(_0x3482e3){_0x41ae03=_0x3482e3[_0x25c9('0x3a')];if(!_0x322cdf[_0x25c9('0x35')][_0x25c9('0x3b')](_0x25c9('0x3c'))){_0x291146[_0x25c9('0x25')]=qs[_0x25c9('0x25')](_0x322cdf[_0x25c9('0x35')][_0x25c9('0x25')]);_0x291146[_0x25c9('0x24')]=qs[_0x25c9('0x24')](_0x322cdf['query']['offset']);}return _0x2856dc[_0x25c9('0x4c')](_0x291146);}})['then'](function(_0x173f28){if(_0x173f28){return _0x173f28?{'count':_0x41ae03,'rows':_0x173f28}:null;}})['then'](respondWithResult(_0x51ac88,null))[_0x25c9('0x1f')](handleError(_0x51ac88,null));};exports[_0x25c9('0x50')]=function(_0xf6cd2a,_0x4e258c,_0x3ae4a7){var _0x55d3f9={};var _0x364c5b={};var _0x147bb1;var _0x34e91e;return db['FreshsalesConfiguration'][_0x25c9('0x4d')]({'where':{'id':_0xf6cd2a[_0x25c9('0x48')]['id']}})[_0x25c9('0x14')](handleEntityNotFound(_0x4e258c,null))[_0x25c9('0x14')](function(_0x432d0e){if(_0x432d0e){_0x147bb1=_0x432d0e;_0x364c5b[_0x25c9('0x34')]=_[_0x25c9('0x4e')](db[_0x25c9('0x4f')]['rawAttributes']);_0x364c5b[_0x25c9('0x35')]=_[_0x25c9('0x4e')](_0xf6cd2a[_0x25c9('0x35')]);_0x364c5b[_0x25c9('0x36')]=_['intersection'](_0x364c5b[_0x25c9('0x34')],_0x364c5b['query']);_0x55d3f9[_0x25c9('0x39')]=_[_0x25c9('0x37')](_0x364c5b[_0x25c9('0x34')],qs[_0x25c9('0x38')](_0xf6cd2a[_0x25c9('0x35')][_0x25c9('0x38')]));_0x55d3f9[_0x25c9('0x39')]=_0x55d3f9[_0x25c9('0x39')][_0x25c9('0x3a')]?_0x55d3f9[_0x25c9('0x39')]:_0x364c5b['model'];_0x55d3f9[_0x25c9('0x3d')]=qs[_0x25c9('0x3e')](_0xf6cd2a['query'][_0x25c9('0x3e')]);_0x55d3f9[_0x25c9('0x3f')]=qs[_0x25c9('0x36')](_[_0x25c9('0x40')](_0xf6cd2a[_0x25c9('0x35')],_0x364c5b[_0x25c9('0x36')]));if(_0xf6cd2a['query'][_0x25c9('0x41')]){_0x55d3f9[_0x25c9('0x3f')]=_['merge'](_0x55d3f9['where'],{'$or':_['map'](_0x55d3f9['attributes'],function(_0x1aba6e){var _0x446f3f={};_0x446f3f[_0x1aba6e]={'$like':'%'+_0xf6cd2a[_0x25c9('0x35')][_0x25c9('0x41')]+'%'};return _0x446f3f;})});}_0x55d3f9=_['merge']({},_0x55d3f9,_0xf6cd2a[_0x25c9('0x43')]);return _0x147bb1[_0x25c9('0x50')](_0x55d3f9);}})[_0x25c9('0x14')](function(_0x1d5c67){if(_0x1d5c67){_0x34e91e=_0x1d5c67['length'];if(!_0xf6cd2a[_0x25c9('0x35')][_0x25c9('0x3b')](_0x25c9('0x3c'))){_0x55d3f9['limit']=qs[_0x25c9('0x25')](_0xf6cd2a[_0x25c9('0x35')][_0x25c9('0x25')]);_0x55d3f9[_0x25c9('0x24')]=qs['offset'](_0xf6cd2a[_0x25c9('0x35')][_0x25c9('0x24')]);}return _0x147bb1[_0x25c9('0x50')](_0x55d3f9);}})['then'](function(_0x18ae0e){if(_0x18ae0e){return _0x18ae0e?{'count':_0x34e91e,'rows':_0x18ae0e}:null;}})[_0x25c9('0x14')](respondWithResult(_0x4e258c,null))[_0x25c9('0x1f')](handleError(_0x4e258c,null));};exports[_0x25c9('0x51')]=function(_0x1c6b33,_0x5d3c5d,_0x34441b){var _0xccc8e9={};var _0xbd442b={};var _0x281eb7;var _0x27e6b8;return db['FreshsalesConfiguration'][_0x25c9('0x4d')]({'where':{'id':_0x1c6b33[_0x25c9('0x48')]['id']}})[_0x25c9('0x14')](handleEntityNotFound(_0x5d3c5d,null))['then'](function(_0x56b9ac){if(_0x56b9ac){_0x281eb7=_0x56b9ac;_0xbd442b[_0x25c9('0x34')]=_[_0x25c9('0x4e')](db[_0x25c9('0x4f')]['rawAttributes']);_0xbd442b[_0x25c9('0x35')]=_[_0x25c9('0x4e')](_0x1c6b33['query']);_0xbd442b[_0x25c9('0x36')]=_[_0x25c9('0x37')](_0xbd442b[_0x25c9('0x34')],_0xbd442b[_0x25c9('0x35')]);_0xccc8e9[_0x25c9('0x39')]=_[_0x25c9('0x37')](_0xbd442b[_0x25c9('0x34')],qs[_0x25c9('0x38')](_0x1c6b33['query'][_0x25c9('0x38')]));_0xccc8e9['attributes']=_0xccc8e9[_0x25c9('0x39')][_0x25c9('0x3a')]?_0xccc8e9['attributes']:_0xbd442b['model'];_0xccc8e9[_0x25c9('0x3d')]=qs[_0x25c9('0x3e')](_0x1c6b33['query'][_0x25c9('0x3e')]);_0xccc8e9['where']=qs[_0x25c9('0x36')](_[_0x25c9('0x40')](_0x1c6b33[_0x25c9('0x35')],_0xbd442b[_0x25c9('0x36')]));if(_0x1c6b33['query'][_0x25c9('0x41')]){_0xccc8e9['where']=_['merge'](_0xccc8e9[_0x25c9('0x3f')],{'$or':_[_0x25c9('0x30')](_0xccc8e9['attributes'],function(_0x1e79da){var _0x3affc3={};_0x3affc3[_0x1e79da]={'$like':'%'+_0x1c6b33[_0x25c9('0x35')]['filter']+'%'};return _0x3affc3;})});}_0xccc8e9=_[_0x25c9('0x42')]({},_0xccc8e9,_0x1c6b33['options']);return _0x281eb7[_0x25c9('0x51')](_0xccc8e9);}})['then'](function(_0x2c902d){if(_0x2c902d){_0x27e6b8=_0x2c902d[_0x25c9('0x3a')];if(!_0x1c6b33['query'][_0x25c9('0x3b')](_0x25c9('0x3c'))){_0xccc8e9['limit']=qs[_0x25c9('0x25')](_0x1c6b33['query'][_0x25c9('0x25')]);_0xccc8e9['offset']=qs['offset'](_0x1c6b33[_0x25c9('0x35')][_0x25c9('0x24')]);}return _0x281eb7[_0x25c9('0x51')](_0xccc8e9);}})[_0x25c9('0x14')](function(_0x4cfde4){if(_0x4cfde4){return _0x4cfde4?{'count':_0x27e6b8,'rows':_0x4cfde4}:null;}})['then'](respondWithResult(_0x5d3c5d,null))[_0x25c9('0x1f')](handleError(_0x5d3c5d,null));}; \ No newline at end of file +var _0x1ebb=['stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','save','update','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','hasOwnProperty','limit','order','sort','pick','where','VIRTUAL','filter','options','FreshsalesConfiguration','count','include','findAll','show','params','keys','attributes','length','includeAll','merge','body','find','getSubjects','FreshsalesField','nolimit','getDescriptions','getFields','findOne','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x1ebb,0xee));var _0xb1eb=function(_0x362838,_0x3b9512){_0x362838=_0x362838-0x0;var _0x3018f5=_0x1ebb[_0x362838];return _0x3018f5;};'use strict';var pdf=require(_0xb1eb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb1eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1eb('0x2'));var rp=require(_0xb1eb('0x3'));var moment=require(_0xb1eb('0x4'));var BPromise=require(_0xb1eb('0x5'));var Mustache=require(_0xb1eb('0x6'));var util=require(_0xb1eb('0x7'));var path=require(_0xb1eb('0x8'));var sox=require(_0xb1eb('0x9'));var csv=require(_0xb1eb('0xa'));var ejs=require(_0xb1eb('0xb'));var fs=require('fs');var _=require(_0xb1eb('0xc'));var squel=require(_0xb1eb('0xd'));var crypto=require(_0xb1eb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb1eb('0xf'));var toCsv=require(_0xb1eb('0xa'));var querystring=require(_0xb1eb('0x10'));var Papa=require(_0xb1eb('0x11'));var Redis=require(_0xb1eb('0x12'));var authService=require(_0xb1eb('0x13'));var qs=require(_0xb1eb('0x14'));var as=require(_0xb1eb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb1eb('0x16'));var utils=require(_0xb1eb('0x17'));var config=require(_0xb1eb('0x18'));var licenseUtil=require(_0xb1eb('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb1eb('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x239111,_0x370563,_0x3445a0,_0x50d5ec){return new BPromise(function(_0x59df56,_0x270f84){var _0x296752=_0x50d5ec||client;return _0x296752[_0xb1eb('0x1b')](_0x239111,_0x3445a0)[_0xb1eb('0x1c')](function(_0x1391eb){logger['info'](_0xb1eb('0x1d'),_0x370563,_0xb1eb('0x1e'));logger[_0xb1eb('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x370563,_0xb1eb('0x1e'),JSON[_0xb1eb('0x20')](_0x1391eb));if(_0x1391eb[_0xb1eb('0x21')]){if(_0x1391eb[_0xb1eb('0x21')][_0xb1eb('0x22')]===0x1f4){logger['error'](_0xb1eb('0x1d'),_0x370563,_0x1391eb[_0xb1eb('0x21')][_0xb1eb('0x23')]);return _0x270f84(_0x1391eb[_0xb1eb('0x21')][_0xb1eb('0x23')]);}logger[_0xb1eb('0x21')](_0xb1eb('0x1d'),_0x370563,_0x1391eb['error'][_0xb1eb('0x23')]);return _0x59df56(_0x1391eb['error'][_0xb1eb('0x23')]);}else{logger[_0xb1eb('0x24')](_0xb1eb('0x1d'),_0x370563,'request\x20sent');_0x59df56(_0x1391eb[_0xb1eb('0x25')]['message']);}})[_0xb1eb('0x26')](function(_0x32ba78){logger[_0xb1eb('0x21')](_0xb1eb('0x1d'),_0x370563,_0x32ba78);_0x270f84(_0x32ba78);});});}function respondWithStatusCode(_0x3cb093,_0x302f34){_0x302f34=_0x302f34||0xcc;return function(_0x2f9402){if(_0x2f9402){return _0x3cb093[_0xb1eb('0x27')](_0x302f34);}return _0x3cb093[_0xb1eb('0x28')](_0x302f34)[_0xb1eb('0x29')]();};}function respondWithResult(_0x2d717f,_0x398f03){_0x398f03=_0x398f03||0xc8;return function(_0x45653d){if(_0x45653d){return _0x2d717f['status'](_0x398f03)['json'](_0x45653d);}};}function respondWithFilteredResult(_0x17a51a,_0x42290a){return function(_0x326be4){if(_0x326be4){var _0x754100=_0x326be4['count'],_0x4fd8a9=_0x42290a[_0xb1eb('0x2a')],_0x3c39b0=_0x42290a[_0xb1eb('0x2a')]+_0x42290a['limit'],_0x13cea1;if(_0x3c39b0>=_0x754100){_0x3c39b0=_0x754100;_0x13cea1=0xc8;}else{_0x13cea1=0xce;}_0x17a51a[_0xb1eb('0x28')](_0x13cea1);return _0x17a51a[_0xb1eb('0x2b')](_0xb1eb('0x2c'),_0x4fd8a9+'-'+_0x3c39b0+'/'+_0x754100)[_0xb1eb('0x2d')](_0x326be4);}return null;};}function patchUpdates(_0x2f5aff){return function(_0x2dd8ee){try{jsonpatch[_0xb1eb('0x2e')](_0x2dd8ee,_0x2f5aff,!![]);}catch(_0x462bde){return BPromise['reject'](_0x462bde);}return _0x2dd8ee[_0xb1eb('0x2f')]();};}function saveUpdates(_0x56b2f,_0x7c9314){return function(_0x557f9d){if(_0x557f9d){return _0x557f9d[_0xb1eb('0x30')](_0x56b2f)['then'](function(_0x465168){return _0x465168;});}return null;};}function removeEntity(_0x1cf503,_0x10a425){return function(_0x5e9d3a){if(_0x5e9d3a){return _0x5e9d3a[_0xb1eb('0x31')]()[_0xb1eb('0x1c')](function(){_0x1cf503['status'](0xcc)[_0xb1eb('0x29')]();});}};}function handleEntityNotFound(_0x281ac0,_0x384c9c){return function(_0x3510d4){if(!_0x3510d4){_0x281ac0[_0xb1eb('0x27')](0x194);}return _0x3510d4;};}function handleError(_0xab38b7,_0x7d782c){_0x7d782c=_0x7d782c||0x1f4;return function(_0x5ac8d9){logger[_0xb1eb('0x21')](_0x5ac8d9['stack']);if(_0x5ac8d9[_0xb1eb('0x32')]){delete _0x5ac8d9[_0xb1eb('0x32')];}_0xab38b7['status'](_0x7d782c)['send'](_0x5ac8d9);};}exports[_0xb1eb('0x33')]=function(_0x11e4c4,_0x44f0bc){var _0x14c06f={},_0x405fc6={},_0x2f9af6={'count':0x0,'rows':[]};var _0x1b3664=_[_0xb1eb('0x34')](db['FreshsalesConfiguration'][_0xb1eb('0x35')],function(_0x176112){return{'name':_0x176112[_0xb1eb('0x36')],'type':_0x176112[_0xb1eb('0x37')][_0xb1eb('0x38')]};});_0x405fc6[_0xb1eb('0x39')]=_[_0xb1eb('0x34')](_0x1b3664,_0xb1eb('0x32'));_0x405fc6['query']=_['keys'](_0x11e4c4[_0xb1eb('0x3a')]);_0x405fc6[_0xb1eb('0x3b')]=_[_0xb1eb('0x3c')](_0x405fc6[_0xb1eb('0x39')],_0x405fc6[_0xb1eb('0x3a')]);_0x14c06f['attributes']=_[_0xb1eb('0x3c')](_0x405fc6[_0xb1eb('0x39')],qs['fields'](_0x11e4c4[_0xb1eb('0x3a')][_0xb1eb('0x3d')]));_0x14c06f['attributes']=_0x14c06f['attributes']['length']?_0x14c06f['attributes']:_0x405fc6[_0xb1eb('0x39')];if(!_0x11e4c4[_0xb1eb('0x3a')][_0xb1eb('0x3e')]('nolimit')){_0x14c06f[_0xb1eb('0x3f')]=qs['limit'](_0x11e4c4['query'][_0xb1eb('0x3f')]);_0x14c06f['offset']=qs[_0xb1eb('0x2a')](_0x11e4c4[_0xb1eb('0x3a')][_0xb1eb('0x2a')]);}_0x14c06f[_0xb1eb('0x40')]=qs[_0xb1eb('0x41')](_0x11e4c4[_0xb1eb('0x3a')][_0xb1eb('0x41')]);_0x14c06f['where']=qs[_0xb1eb('0x3b')](_[_0xb1eb('0x42')](_0x11e4c4[_0xb1eb('0x3a')],_0x405fc6[_0xb1eb('0x3b')]),_0x1b3664);if(_0x11e4c4[_0xb1eb('0x3a')]['filter']){_0x14c06f['where']=_['merge'](_0x14c06f[_0xb1eb('0x43')],{'$or':_[_0xb1eb('0x34')](_0x1b3664,function(_0x1f7843){if(_0x1f7843[_0xb1eb('0x37')]!==_0xb1eb('0x44')){var _0x27836c={};_0x27836c[_0x1f7843[_0xb1eb('0x32')]]={'$like':'%'+_0x11e4c4[_0xb1eb('0x3a')][_0xb1eb('0x45')]+'%'};return _0x27836c;}})});}_0x14c06f=_['merge']({},_0x14c06f,_0x11e4c4[_0xb1eb('0x46')]);var _0x30dc7c={'where':_0x14c06f[_0xb1eb('0x43')]};return db[_0xb1eb('0x47')][_0xb1eb('0x48')](_0x30dc7c)[_0xb1eb('0x1c')](function(_0xec0ab5){_0x2f9af6[_0xb1eb('0x48')]=_0xec0ab5;if(_0x11e4c4[_0xb1eb('0x3a')]['includeAll']){_0x14c06f[_0xb1eb('0x49')]=[{'all':!![]}];}return db[_0xb1eb('0x47')][_0xb1eb('0x4a')](_0x14c06f);})['then'](function(_0x1f97e2){_0x2f9af6['rows']=_0x1f97e2;return _0x2f9af6;})[_0xb1eb('0x1c')](respondWithFilteredResult(_0x44f0bc,_0x14c06f))['catch'](handleError(_0x44f0bc,null));};exports[_0xb1eb('0x4b')]=function(_0x3026f5,_0x520305){var _0x98fbaa={'raw':![],'where':{'id':_0x3026f5[_0xb1eb('0x4c')]['id']}},_0x3c017a={};_0x3c017a[_0xb1eb('0x39')]=_[_0xb1eb('0x4d')](db[_0xb1eb('0x47')][_0xb1eb('0x35')]);_0x3c017a[_0xb1eb('0x3a')]=_[_0xb1eb('0x4d')](_0x3026f5['query']);_0x3c017a['filtears']=_[_0xb1eb('0x3c')](_0x3c017a[_0xb1eb('0x39')],_0x3c017a[_0xb1eb('0x3a')]);_0x98fbaa['attributes']=_['intersection'](_0x3c017a[_0xb1eb('0x39')],qs['fields'](_0x3026f5['query'][_0xb1eb('0x3d')]));_0x98fbaa[_0xb1eb('0x4e')]=_0x98fbaa[_0xb1eb('0x4e')][_0xb1eb('0x4f')]?_0x98fbaa['attributes']:_0x3c017a[_0xb1eb('0x39')];if(_0x3026f5['query'][_0xb1eb('0x50')]){_0x98fbaa[_0xb1eb('0x49')]=[{'all':!![]}];}_0x98fbaa=_[_0xb1eb('0x51')]({},_0x98fbaa,_0x3026f5[_0xb1eb('0x46')]);return db[_0xb1eb('0x47')]['find'](_0x98fbaa)['then'](handleEntityNotFound(_0x520305,null))[_0xb1eb('0x1c')](respondWithResult(_0x520305,null))[_0xb1eb('0x26')](handleError(_0x520305,null));};exports['create']=function(_0x2c00bd,_0x4eb0ba){return db['FreshsalesConfiguration']['create'](_0x2c00bd['body'],{})['then'](respondWithResult(_0x4eb0ba,0xc9))[_0xb1eb('0x26')](handleError(_0x4eb0ba,null));};exports[_0xb1eb('0x30')]=function(_0x2a1e74,_0x2e99d0){if(_0x2a1e74[_0xb1eb('0x52')]['id']){delete _0x2a1e74[_0xb1eb('0x52')]['id'];}return db[_0xb1eb('0x47')][_0xb1eb('0x53')]({'where':{'id':_0x2a1e74[_0xb1eb('0x4c')]['id']}})[_0xb1eb('0x1c')](handleEntityNotFound(_0x2e99d0,null))[_0xb1eb('0x1c')](saveUpdates(_0x2a1e74['body'],null))['then'](respondWithResult(_0x2e99d0,null))['catch'](handleError(_0x2e99d0,null));};exports[_0xb1eb('0x31')]=function(_0x3350c5,_0x561bcb){return db[_0xb1eb('0x47')][_0xb1eb('0x53')]({'where':{'id':_0x3350c5['params']['id']}})[_0xb1eb('0x1c')](handleEntityNotFound(_0x561bcb,null))[_0xb1eb('0x1c')](removeEntity(_0x561bcb,null))[_0xb1eb('0x26')](handleError(_0x561bcb,null));};exports[_0xb1eb('0x54')]=function(_0x3e37f4,_0x214d98,_0x11dd73){var _0x68e056={};var _0x5a08da={};var _0x59ae73;var _0x244467;return db[_0xb1eb('0x47')]['findOne']({'where':{'id':_0x3e37f4['params']['id']}})[_0xb1eb('0x1c')](handleEntityNotFound(_0x214d98,null))[_0xb1eb('0x1c')](function(_0x213187){if(_0x213187){_0x59ae73=_0x213187;_0x5a08da[_0xb1eb('0x39')]=_[_0xb1eb('0x4d')](db[_0xb1eb('0x55')][_0xb1eb('0x35')]);_0x5a08da[_0xb1eb('0x3a')]=_['keys'](_0x3e37f4[_0xb1eb('0x3a')]);_0x5a08da['filters']=_[_0xb1eb('0x3c')](_0x5a08da['model'],_0x5a08da[_0xb1eb('0x3a')]);_0x68e056[_0xb1eb('0x4e')]=_[_0xb1eb('0x3c')](_0x5a08da[_0xb1eb('0x39')],qs['fields'](_0x3e37f4[_0xb1eb('0x3a')][_0xb1eb('0x3d')]));_0x68e056[_0xb1eb('0x4e')]=_0x68e056['attributes'][_0xb1eb('0x4f')]?_0x68e056['attributes']:_0x5a08da[_0xb1eb('0x39')];_0x68e056[_0xb1eb('0x40')]=qs[_0xb1eb('0x41')](_0x3e37f4['query'][_0xb1eb('0x41')]);_0x68e056[_0xb1eb('0x43')]=qs['filters'](_['pick'](_0x3e37f4['query'],_0x5a08da[_0xb1eb('0x3b')]));if(_0x3e37f4[_0xb1eb('0x3a')][_0xb1eb('0x45')]){_0x68e056[_0xb1eb('0x43')]=_[_0xb1eb('0x51')](_0x68e056[_0xb1eb('0x43')],{'$or':_['map'](_0x68e056['attributes'],function(_0x2125da){var _0x464362={};_0x464362[_0x2125da]={'$like':'%'+_0x3e37f4[_0xb1eb('0x3a')]['filter']+'%'};return _0x464362;})});}_0x68e056=_[_0xb1eb('0x51')]({},_0x68e056,_0x3e37f4[_0xb1eb('0x46')]);return _0x59ae73[_0xb1eb('0x54')](_0x68e056);}})['then'](function(_0x3c8375){if(_0x3c8375){_0x244467=_0x3c8375[_0xb1eb('0x4f')];if(!_0x3e37f4[_0xb1eb('0x3a')]['hasOwnProperty'](_0xb1eb('0x56'))){_0x68e056['limit']=qs['limit'](_0x3e37f4[_0xb1eb('0x3a')][_0xb1eb('0x3f')]);_0x68e056['offset']=qs[_0xb1eb('0x2a')](_0x3e37f4['query']['offset']);}return _0x59ae73['getSubjects'](_0x68e056);}})[_0xb1eb('0x1c')](function(_0x28abe4){if(_0x28abe4){return _0x28abe4?{'count':_0x244467,'rows':_0x28abe4}:null;}})[_0xb1eb('0x1c')](respondWithResult(_0x214d98,null))['catch'](handleError(_0x214d98,null));};exports['getDescriptions']=function(_0x981bd6,_0x993212,_0x1ae73e){var _0x1ccb92={};var _0x569528={};var _0x1ae303;var _0x4b8ac3;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x981bd6[_0xb1eb('0x4c')]['id']}})[_0xb1eb('0x1c')](handleEntityNotFound(_0x993212,null))[_0xb1eb('0x1c')](function(_0x1dce33){if(_0x1dce33){_0x1ae303=_0x1dce33;_0x569528[_0xb1eb('0x39')]=_['keys'](db[_0xb1eb('0x55')][_0xb1eb('0x35')]);_0x569528[_0xb1eb('0x3a')]=_[_0xb1eb('0x4d')](_0x981bd6[_0xb1eb('0x3a')]);_0x569528[_0xb1eb('0x3b')]=_[_0xb1eb('0x3c')](_0x569528[_0xb1eb('0x39')],_0x569528[_0xb1eb('0x3a')]);_0x1ccb92[_0xb1eb('0x4e')]=_[_0xb1eb('0x3c')](_0x569528[_0xb1eb('0x39')],qs[_0xb1eb('0x3d')](_0x981bd6['query']['fields']));_0x1ccb92[_0xb1eb('0x4e')]=_0x1ccb92['attributes'][_0xb1eb('0x4f')]?_0x1ccb92[_0xb1eb('0x4e')]:_0x569528[_0xb1eb('0x39')];_0x1ccb92[_0xb1eb('0x40')]=qs[_0xb1eb('0x41')](_0x981bd6['query']['sort']);_0x1ccb92[_0xb1eb('0x43')]=qs['filters'](_[_0xb1eb('0x42')](_0x981bd6[_0xb1eb('0x3a')],_0x569528[_0xb1eb('0x3b')]));if(_0x981bd6['query'][_0xb1eb('0x45')]){_0x1ccb92[_0xb1eb('0x43')]=_[_0xb1eb('0x51')](_0x1ccb92[_0xb1eb('0x43')],{'$or':_[_0xb1eb('0x34')](_0x1ccb92['attributes'],function(_0x8333d3){var _0x5ad536={};_0x5ad536[_0x8333d3]={'$like':'%'+_0x981bd6['query']['filter']+'%'};return _0x5ad536;})});}_0x1ccb92=_[_0xb1eb('0x51')]({},_0x1ccb92,_0x981bd6[_0xb1eb('0x46')]);return _0x1ae303[_0xb1eb('0x57')](_0x1ccb92);}})['then'](function(_0x1d60b8){if(_0x1d60b8){_0x4b8ac3=_0x1d60b8['length'];if(!_0x981bd6[_0xb1eb('0x3a')][_0xb1eb('0x3e')]('nolimit')){_0x1ccb92[_0xb1eb('0x3f')]=qs[_0xb1eb('0x3f')](_0x981bd6['query'][_0xb1eb('0x3f')]);_0x1ccb92['offset']=qs[_0xb1eb('0x2a')](_0x981bd6[_0xb1eb('0x3a')]['offset']);}return _0x1ae303[_0xb1eb('0x57')](_0x1ccb92);}})[_0xb1eb('0x1c')](function(_0x6746c){if(_0x6746c){return _0x6746c?{'count':_0x4b8ac3,'rows':_0x6746c}:null;}})[_0xb1eb('0x1c')](respondWithResult(_0x993212,null))['catch'](handleError(_0x993212,null));};exports[_0xb1eb('0x58')]=function(_0x68f9c8,_0x3a76e0,_0x4dd1a4){var _0x44686a={};var _0x490541={};var _0x555436;var _0x4ff4f6;return db['FreshsalesConfiguration'][_0xb1eb('0x59')]({'where':{'id':_0x68f9c8[_0xb1eb('0x4c')]['id']}})[_0xb1eb('0x1c')](handleEntityNotFound(_0x3a76e0,null))[_0xb1eb('0x1c')](function(_0x9fd85c){if(_0x9fd85c){_0x555436=_0x9fd85c;_0x490541['model']=_['keys'](db['FreshsalesField']['rawAttributes']);_0x490541['query']=_[_0xb1eb('0x4d')](_0x68f9c8['query']);_0x490541[_0xb1eb('0x3b')]=_['intersection'](_0x490541[_0xb1eb('0x39')],_0x490541[_0xb1eb('0x3a')]);_0x44686a['attributes']=_[_0xb1eb('0x3c')](_0x490541[_0xb1eb('0x39')],qs['fields'](_0x68f9c8[_0xb1eb('0x3a')]['fields']));_0x44686a[_0xb1eb('0x4e')]=_0x44686a[_0xb1eb('0x4e')][_0xb1eb('0x4f')]?_0x44686a[_0xb1eb('0x4e')]:_0x490541[_0xb1eb('0x39')];_0x44686a['order']=qs[_0xb1eb('0x41')](_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x41')]);_0x44686a['where']=qs[_0xb1eb('0x3b')](_[_0xb1eb('0x42')](_0x68f9c8[_0xb1eb('0x3a')],_0x490541[_0xb1eb('0x3b')]));if(_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x45')]){_0x44686a[_0xb1eb('0x43')]=_['merge'](_0x44686a[_0xb1eb('0x43')],{'$or':_[_0xb1eb('0x34')](_0x44686a[_0xb1eb('0x4e')],function(_0x40b5a1){var _0x222fcf={};_0x222fcf[_0x40b5a1]={'$like':'%'+_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x45')]+'%'};return _0x222fcf;})});}_0x44686a=_[_0xb1eb('0x51')]({},_0x44686a,_0x68f9c8[_0xb1eb('0x46')]);return _0x555436[_0xb1eb('0x58')](_0x44686a);}})[_0xb1eb('0x1c')](function(_0x2c175e){if(_0x2c175e){_0x4ff4f6=_0x2c175e[_0xb1eb('0x4f')];if(!_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x3e')](_0xb1eb('0x56'))){_0x44686a[_0xb1eb('0x3f')]=qs['limit'](_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x3f')]);_0x44686a['offset']=qs[_0xb1eb('0x2a')](_0x68f9c8[_0xb1eb('0x3a')][_0xb1eb('0x2a')]);}return _0x555436[_0xb1eb('0x58')](_0x44686a);}})['then'](function(_0x514081){if(_0x514081){return _0x514081?{'count':_0x4ff4f6,'rows':_0x514081}:null;}})['then'](respondWithResult(_0x3a76e0,null))[_0xb1eb('0x26')](handleError(_0x3a76e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c9df811..6cabf2d 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 _0x222f=['define','int_freshsales_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1774a6,_0x749a97){var _0x52a1e3=function(_0x4df5b1){while(--_0x4df5b1){_0x1774a6['push'](_0x1774a6['shift']());}};_0x52a1e3(++_0x749a97);}(_0x222f,0x1a4));var _0xf222=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0x222f[_0x4f192e];return _0x49294d;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xf222('0x8')]=function(_0x54a758,_0x112e6d){return _0x54a758[_0xf222('0x9')]('FreshsalesConfiguration',attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd398=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd398,0x1dd));var _0x8d39=function(_0x396143,_0x2402a8){_0x396143=_0x396143-0x0;var _0x153e20=_0xd398[_0x396143];return _0x153e20;};'use strict';var _=require(_0x8d39('0x0'));var util=require(_0x8d39('0x1'));var logger=require(_0x8d39('0x2'))(_0x8d39('0x3'));var moment=require(_0x8d39('0x4'));var BPromise=require('bluebird');var rp=require(_0x8d39('0x5'));var fs=require('fs');var path=require(_0x8d39('0x6'));var rimraf=require(_0x8d39('0x7'));var config=require(_0x8d39('0x8'));var attributes=require(_0x8d39('0x9'));module[_0x8d39('0xa')]=function(_0x329d29,_0xfdbeb3){return _0x329d29[_0x8d39('0xb')](_0x8d39('0xc'),attributes,{'tableName':_0x8d39('0xd'),'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 e21860b..62841f0 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 _0xf4eb=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xd2548e,_0x556106){var _0x1258d3=function(_0x4d4b7f){while(--_0x4d4b7f){_0xd2548e['push'](_0xd2548e['shift']());}};_0x1258d3(++_0x556106);}(_0xf4eb,0xec));var _0xbf4e=function(_0xd802ba,_0x2e78f9){_0xd802ba=_0xd802ba-0x0;var _0x32e64a=_0xf4eb[_0xd802ba];return _0x32e64a;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0x0f73=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x1a9b0e,_0x44f9b3){var _0xf6006b=function(_0x1b3ffb){while(--_0x1b3ffb){_0x1a9b0e['push'](_0x1a9b0e['shift']());}};_0xf6006b(++_0x44f9b3);}(_0x0f73,0x146));var _0x30f7=function(_0x3533a5,_0x1ffb6e){_0x3533a5=_0x3533a5-0x0;var _0x11bf65=_0x0f73[_0x3533a5];return _0x11bf65;};'use strict';var _=require(_0x30f7('0x0'));var util=require(_0x30f7('0x1'));var moment=require(_0x30f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30f7('0x3'));var db=require(_0x30f7('0x4'))['db'];var utils=require(_0x30f7('0x5'));var logger=require(_0x30f7('0x6'))(_0x30f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x30f7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38ad1d,_0x1c90cb,_0x2de5e7){return new BPromise(function(_0x7e377e,_0x5c5cf3){return client[_0x30f7('0x9')](_0x38ad1d,_0x2de5e7)[_0x30f7('0xa')](function(_0x5eedb2){logger[_0x30f7('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c90cb,'request\x20sent');logger[_0x30f7('0xc')](_0x30f7('0xd'),_0x1c90cb,_0x30f7('0xe'),JSON[_0x30f7('0xf')](_0x5eedb2));if(_0x5eedb2['error']){if(_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x11')]===0x1f4){logger['error'](_0x30f7('0x12'),_0x1c90cb,_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);return _0x5c5cf3(_0x5eedb2['error'][_0x30f7('0x13')]);}logger[_0x30f7('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c90cb,_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);return _0x7e377e(_0x5eedb2[_0x30f7('0x10')][_0x30f7('0x13')]);}else{logger[_0x30f7('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c90cb,'request\x20sent');_0x7e377e(_0x5eedb2[_0x30f7('0x14')][_0x30f7('0x13')]);}})[_0x30f7('0x15')](function(_0x1a5565){logger['error'](_0x30f7('0x12'),_0x1c90cb,_0x1a5565);_0x5c5cf3(_0x1a5565);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6257ae1..9374d61 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 _0xc651=['index','get','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc651,0x185));var _0x1c65=function(_0x155830,_0x343f5e){_0x155830=_0x155830-0x0;var _0x5c33d3=_0xc651[_0x155830];return _0x5c33d3;};'use strict';var multer=require(_0x1c65('0x0'));var util=require(_0x1c65('0x1'));var path=require(_0x1c65('0x2'));var timeout=require(_0x1c65('0x3'));var express=require(_0x1c65('0x4'));var router=express[_0x1c65('0x5')]();var auth=require(_0x1c65('0x6'));var interaction=require(_0x1c65('0x7'));var config=require(_0x1c65('0x8'));var controller=require(_0x1c65('0x9'));router['get']('/',auth[_0x1c65('0xa')](),controller[_0x1c65('0xb')]);router[_0x1c65('0xc')](_0x1c65('0xd'),auth[_0x1c65('0xa')](),controller['show']);router[_0x1c65('0xe')]('/',auth['isAuthenticated'](),controller[_0x1c65('0xf')]);router[_0x1c65('0x10')](_0x1c65('0xd'),auth['isAuthenticated'](),controller[_0x1c65('0x11')]);router['delete']('/:id',auth[_0x1c65('0xa')](),controller[_0x1c65('0x12')]);module[_0x1c65('0x13')]=router; \ No newline at end of file +var _0x777c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xb0ae0d,_0x3e2d01){var _0x394c25=function(_0x44891e){while(--_0x44891e){_0xb0ae0d['push'](_0xb0ae0d['shift']());}};_0x394c25(++_0x3e2d01);}(_0x777c,0x1b5));var _0xc777=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x777c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xc777('0x0'));var path=require(_0xc777('0x1'));var timeout=require(_0xc777('0x2'));var express=require(_0xc777('0x3'));var router=express[_0xc777('0x4')]();var auth=require(_0xc777('0x5'));var interaction=require(_0xc777('0x6'));var config=require(_0xc777('0x7'));var controller=require(_0xc777('0x8'));router['get']('/',auth[_0xc777('0x9')](),controller[_0xc777('0xa')]);router['get']('/:id',auth[_0xc777('0x9')](),controller[_0xc777('0xb')]);router[_0xc777('0xc')]('/',auth[_0xc777('0x9')](),controller[_0xc777('0xd')]);router[_0xc777('0xe')](_0xc777('0xf'),auth['isAuthenticated'](),controller[_0xc777('0x10')]);router[_0xc777('0x11')]('/:id',auth[_0xc777('0x9')](),controller[_0xc777('0x12')]);module[_0xc777('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 6e65f00..0b12149 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 _0x2ec0=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x32e3ee,_0x1dd91a){var _0x82a4fa=function(_0x543b90){while(--_0x543b90){_0x32e3ee['push'](_0x32e3ee['shift']());}};_0x82a4fa(++_0x1dd91a);}(_0x2ec0,0x69));var _0x02ec=function(_0x218994,_0x2cf487){_0x218994=_0x218994-0x0;var _0x3f350b=_0x2ec0[_0x218994];return _0x3f350b;};'use strict';var Sequelize=require(_0x02ec('0x0'));module[_0x02ec('0x1')]={'type':{'type':Sequelize[_0x02ec('0x2')](_0x02ec('0x3'),'variable',_0x02ec('0x4'),_0x02ec('0x5')),'defaultValue':_0x02ec('0x3')},'content':{'type':Sequelize[_0x02ec('0x6')]},'key':{'type':Sequelize[_0x02ec('0x6')]},'keyType':{'type':Sequelize[_0x02ec('0x2')](_0x02ec('0x3'),_0x02ec('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x02ec('0x6')]},'idField':{'type':Sequelize[_0x02ec('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x02ec('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02ec('0x6')]}}; \ No newline at end of file +var _0x201d=['sequelize','ENUM','string','STRING','variable'];(function(_0x6c698f,_0x246c65){var _0x50bcc6=function(_0x662b56){while(--_0x662b56){_0x6c698f['push'](_0x6c698f['shift']());}};_0x50bcc6(++_0x246c65);}(_0x201d,0xd2));var _0xd201=function(_0x56ca1f,_0x508cf6){_0x56ca1f=_0x56ca1f-0x0;var _0x2c5eb5=_0x201d[_0x56ca1f];return _0x2c5eb5;};'use strict';var Sequelize=require(_0xd201('0x0'));module['exports']={'type':{'type':Sequelize[_0xd201('0x1')](_0xd201('0x2'),'variable','customVariable','keyValue'),'defaultValue':_0xd201('0x2')},'content':{'type':Sequelize[_0xd201('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd201('0x1')]('string',_0xd201('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xd201('0x3')]},'idField':{'type':Sequelize[_0xd201('0x3')]},'nameField':{'type':Sequelize[_0xd201('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d9e36f7..3b5bc37 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 _0x6494=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','update','then','destroy','stack','name','send','index','map','FreshsalesField','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','filtears','find','create','body','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x2207a0,_0xa4fea6){var _0x2d002b=function(_0x413d46){while(--_0x413d46){_0x2207a0['push'](_0x2207a0['shift']());}};_0x2d002b(++_0xa4fea6);}(_0x6494,0x11c));var _0x4649=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6494[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x4649('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4649('0x1'));var jsonpatch=require(_0x4649('0x2'));var rp=require(_0x4649('0x3'));var moment=require(_0x4649('0x4'));var BPromise=require(_0x4649('0x5'));var Mustache=require(_0x4649('0x6'));var util=require('util');var path=require(_0x4649('0x7'));var sox=require(_0x4649('0x8'));var csv=require(_0x4649('0x9'));var ejs=require(_0x4649('0xa'));var fs=require('fs');var _=require(_0x4649('0xb'));var squel=require(_0x4649('0xc'));var crypto=require(_0x4649('0xd'));var jsforce=require(_0x4649('0xe'));var deskjs=require(_0x4649('0xf'));var toCsv=require(_0x4649('0x9'));var querystring=require(_0x4649('0x10'));var Papa=require(_0x4649('0x11'));var Redis=require(_0x4649('0x12'));var authService=require(_0x4649('0x13'));var qs=require(_0x4649('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4649('0x15'))(_0x4649('0x16'));var utils=require(_0x4649('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4649('0x18'));var db=require(_0x4649('0x19'))['db'];function respondWithStatusCode(_0x57e6ff,_0x476f5c){_0x476f5c=_0x476f5c||0xcc;return function(_0x1b1dbd){if(_0x1b1dbd){return _0x57e6ff[_0x4649('0x1a')](_0x476f5c);}return _0x57e6ff['status'](_0x476f5c)['end']();};}function respondWithResult(_0x3572f1,_0x101906){_0x101906=_0x101906||0xc8;return function(_0x345b12){if(_0x345b12){return _0x3572f1[_0x4649('0x1b')](_0x101906)['json'](_0x345b12);}};}function respondWithFilteredResult(_0x243e75,_0x1c84de){return function(_0x39feb9){if(_0x39feb9){var _0x54e26c=_0x39feb9['count'],_0x42b5c8=_0x1c84de[_0x4649('0x1c')],_0x4d723a=_0x1c84de[_0x4649('0x1c')]+_0x1c84de[_0x4649('0x1d')],_0x34b428;if(_0x4d723a>=_0x54e26c){_0x4d723a=_0x54e26c;_0x34b428=0xc8;}else{_0x34b428=0xce;}_0x243e75[_0x4649('0x1b')](_0x34b428);return _0x243e75[_0x4649('0x1e')]('Content-Range',_0x42b5c8+'-'+_0x4d723a+'/'+_0x54e26c)[_0x4649('0x1f')](_0x39feb9);}return null;};}function patchUpdates(_0x26da33){return function(_0x572e7f){try{jsonpatch[_0x4649('0x20')](_0x572e7f,_0x26da33,!![]);}catch(_0x3e9038){return BPromise[_0x4649('0x21')](_0x3e9038);}return _0x572e7f['save']();};}function saveUpdates(_0x31a282,_0xaed2f9){return function(_0x2c7bf4){if(_0x2c7bf4){return _0x2c7bf4[_0x4649('0x22')](_0x31a282)[_0x4649('0x23')](function(_0x4cda85){return _0x4cda85;});}return null;};}function removeEntity(_0xc3bb60,_0x248b2b){return function(_0x58038a){if(_0x58038a){return _0x58038a[_0x4649('0x24')]()[_0x4649('0x23')](function(){_0xc3bb60[_0x4649('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8e94,_0x1c810c){return function(_0x325f20){if(!_0x325f20){_0x1f8e94['sendStatus'](0x194);}return _0x325f20;};}function handleError(_0x2568bc,_0x1d9e31){_0x1d9e31=_0x1d9e31||0x1f4;return function(_0x58ae7a){logger['error'](_0x58ae7a[_0x4649('0x25')]);if(_0x58ae7a['name']){delete _0x58ae7a[_0x4649('0x26')];}_0x2568bc[_0x4649('0x1b')](_0x1d9e31)[_0x4649('0x27')](_0x58ae7a);};}exports[_0x4649('0x28')]=function(_0x359c6e,_0x777e8d){var _0x1400f4={},_0x59e721={},_0x438466={'count':0x0,'rows':[]};var _0x3f5b73=_[_0x4649('0x29')](db[_0x4649('0x2a')]['rawAttributes'],function(_0xb1e6c2){return{'name':_0xb1e6c2['fieldName'],'type':_0xb1e6c2['type'][_0x4649('0x2b')]};});_0x59e721[_0x4649('0x2c')]=_[_0x4649('0x29')](_0x3f5b73,_0x4649('0x26'));_0x59e721[_0x4649('0x2d')]=_[_0x4649('0x2e')](_0x359c6e[_0x4649('0x2d')]);_0x59e721[_0x4649('0x2f')]=_[_0x4649('0x30')](_0x59e721['model'],_0x59e721[_0x4649('0x2d')]);_0x1400f4[_0x4649('0x31')]=_[_0x4649('0x30')](_0x59e721[_0x4649('0x2c')],qs[_0x4649('0x32')](_0x359c6e[_0x4649('0x2d')][_0x4649('0x32')]));_0x1400f4[_0x4649('0x31')]=_0x1400f4[_0x4649('0x31')][_0x4649('0x33')]?_0x1400f4[_0x4649('0x31')]:_0x59e721[_0x4649('0x2c')];if(!_0x359c6e[_0x4649('0x2d')]['hasOwnProperty']('nolimit')){_0x1400f4[_0x4649('0x1d')]=qs['limit'](_0x359c6e[_0x4649('0x2d')][_0x4649('0x1d')]);_0x1400f4[_0x4649('0x1c')]=qs['offset'](_0x359c6e[_0x4649('0x2d')][_0x4649('0x1c')]);}_0x1400f4[_0x4649('0x34')]=qs[_0x4649('0x35')](_0x359c6e[_0x4649('0x2d')][_0x4649('0x35')]);_0x1400f4[_0x4649('0x36')]=qs['filters'](_[_0x4649('0x37')](_0x359c6e[_0x4649('0x2d')],_0x59e721['filters']),_0x3f5b73);if(_0x359c6e[_0x4649('0x2d')]['filter']){_0x1400f4['where']=_[_0x4649('0x38')](_0x1400f4[_0x4649('0x36')],{'$or':_[_0x4649('0x29')](_0x3f5b73,function(_0x16751c){if(_0x16751c[_0x4649('0x39')]!=='VIRTUAL'){var _0x21e8f1={};_0x21e8f1[_0x16751c['name']]={'$like':'%'+_0x359c6e['query'][_0x4649('0x3a')]+'%'};return _0x21e8f1;}})});}_0x1400f4=_[_0x4649('0x38')]({},_0x1400f4,_0x359c6e[_0x4649('0x3b')]);var _0x56e5de={'where':_0x1400f4[_0x4649('0x36')]};return db[_0x4649('0x2a')]['count'](_0x56e5de)[_0x4649('0x23')](function(_0x5d6b01){_0x438466[_0x4649('0x3c')]=_0x5d6b01;if(_0x359c6e[_0x4649('0x2d')][_0x4649('0x3d')]){_0x1400f4[_0x4649('0x3e')]=[{'all':!![]}];}return db[_0x4649('0x2a')][_0x4649('0x3f')](_0x1400f4);})['then'](function(_0x2aa81a){_0x438466[_0x4649('0x40')]=_0x2aa81a;return _0x438466;})[_0x4649('0x23')](respondWithFilteredResult(_0x777e8d,_0x1400f4))[_0x4649('0x41')](handleError(_0x777e8d,null));};exports['show']=function(_0x41131e,_0x59e514){var _0x57dfbb={'raw':!![],'where':{'id':_0x41131e[_0x4649('0x42')]['id']}},_0x43c96c={};_0x43c96c[_0x4649('0x2c')]=_['keys'](db[_0x4649('0x2a')][_0x4649('0x43')]);_0x43c96c[_0x4649('0x2d')]=_[_0x4649('0x2e')](_0x41131e[_0x4649('0x2d')]);_0x43c96c[_0x4649('0x44')]=_[_0x4649('0x30')](_0x43c96c[_0x4649('0x2c')],_0x43c96c['query']);_0x57dfbb[_0x4649('0x31')]=_[_0x4649('0x30')](_0x43c96c[_0x4649('0x2c')],qs[_0x4649('0x32')](_0x41131e['query'][_0x4649('0x32')]));_0x57dfbb['attributes']=_0x57dfbb[_0x4649('0x31')]['length']?_0x57dfbb[_0x4649('0x31')]:_0x43c96c[_0x4649('0x2c')];if(_0x41131e[_0x4649('0x2d')][_0x4649('0x3d')]){_0x57dfbb[_0x4649('0x3e')]=[{'all':!![]}];}_0x57dfbb=_[_0x4649('0x38')]({},_0x57dfbb,_0x41131e['options']);return db[_0x4649('0x2a')][_0x4649('0x45')](_0x57dfbb)[_0x4649('0x23')](handleEntityNotFound(_0x59e514,null))[_0x4649('0x23')](respondWithResult(_0x59e514,null))['catch'](handleError(_0x59e514,null));};exports[_0x4649('0x46')]=function(_0x2fc79e,_0x1a2ec1){return db['FreshsalesField'][_0x4649('0x46')](_0x2fc79e['body'],{})[_0x4649('0x23')](respondWithResult(_0x1a2ec1,0xc9))['catch'](handleError(_0x1a2ec1,null));};exports['update']=function(_0x2c0f52,_0xf6480f){if(_0x2c0f52[_0x4649('0x47')]['id']){delete _0x2c0f52[_0x4649('0x47')]['id'];}return db[_0x4649('0x2a')][_0x4649('0x45')]({'where':{'id':_0x2c0f52[_0x4649('0x42')]['id']}})['then'](handleEntityNotFound(_0xf6480f,null))[_0x4649('0x23')](saveUpdates(_0x2c0f52[_0x4649('0x47')],null))['then'](respondWithResult(_0xf6480f,null))['catch'](handleError(_0xf6480f,null));};exports[_0x4649('0x24')]=function(_0x4f1507,_0x3153f8){return db[_0x4649('0x2a')][_0x4649('0x45')]({'where':{'id':_0x4f1507[_0x4649('0x42')]['id']}})[_0x4649('0x23')](handleEntityNotFound(_0x3153f8,null))[_0x4649('0x23')](removeEntity(_0x3153f8,null))[_0x4649('0x41')](handleError(_0x3153f8,null));}; \ No newline at end of file +var _0x41cd=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','set','save','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','FreshsalesField','rows','catch','params','filtears','length','find','create','body','update','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x27b316,_0x1bcdf0){var _0x303a5b=function(_0xb33fb1){while(--_0xb33fb1){_0x27b316['push'](_0x27b316['shift']());}};_0x303a5b(++_0x1bcdf0);}(_0x41cd,0x100));var _0xd41c=function(_0x47b5e0,_0x273723){_0x47b5e0=_0x47b5e0-0x0;var _0x128d60=_0x41cd[_0x47b5e0];return _0x128d60;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd41c('0x0'));var rimraf=require(_0xd41c('0x1'));var zipdir=require(_0xd41c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd41c('0x3'));var Mustache=require(_0xd41c('0x4'));var util=require(_0xd41c('0x5'));var path=require('path');var sox=require(_0xd41c('0x6'));var csv=require(_0xd41c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd41c('0x8'));var squel=require('squel');var crypto=require(_0xd41c('0x9'));var jsforce=require(_0xd41c('0xa'));var deskjs=require(_0xd41c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd41c('0xc'));var Papa=require(_0xd41c('0xd'));var Redis=require('ioredis');var authService=require(_0xd41c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd41c('0xf'));var hardwareService=require(_0xd41c('0x10'));var logger=require('../../config/logger')(_0xd41c('0x11'));var utils=require(_0xd41c('0x12'));var config=require(_0xd41c('0x13'));var licenseUtil=require(_0xd41c('0x14'));var db=require(_0xd41c('0x15'))['db'];function respondWithStatusCode(_0x47a18a,_0x3c71bc){_0x3c71bc=_0x3c71bc||0xcc;return function(_0x2668c5){if(_0x2668c5){return _0x47a18a[_0xd41c('0x16')](_0x3c71bc);}return _0x47a18a[_0xd41c('0x17')](_0x3c71bc)[_0xd41c('0x18')]();};}function respondWithResult(_0x537449,_0xc5e96e){_0xc5e96e=_0xc5e96e||0xc8;return function(_0x43fb61){if(_0x43fb61){return _0x537449[_0xd41c('0x17')](_0xc5e96e)[_0xd41c('0x19')](_0x43fb61);}};}function respondWithFilteredResult(_0x5ccf79,_0x573355){return function(_0x2f8e44){if(_0x2f8e44){var _0xc21c63=_0x2f8e44[_0xd41c('0x1a')],_0x512248=_0x573355['offset'],_0x2c1e21=_0x573355['offset']+_0x573355['limit'],_0x41815a;if(_0x2c1e21>=_0xc21c63){_0x2c1e21=_0xc21c63;_0x41815a=0xc8;}else{_0x41815a=0xce;}_0x5ccf79[_0xd41c('0x17')](_0x41815a);return _0x5ccf79[_0xd41c('0x1b')]('Content-Range',_0x512248+'-'+_0x2c1e21+'/'+_0xc21c63)['json'](_0x2f8e44);}return null;};}function patchUpdates(_0x91ecb2){return function(_0x16d2a4){try{jsonpatch['apply'](_0x16d2a4,_0x91ecb2,!![]);}catch(_0x1764bb){return BPromise['reject'](_0x1764bb);}return _0x16d2a4[_0xd41c('0x1c')]();};}function saveUpdates(_0x3b821c,_0x2315d9){return function(_0x5a7411){if(_0x5a7411){return _0x5a7411['update'](_0x3b821c)[_0xd41c('0x1d')](function(_0x375052){return _0x375052;});}return null;};}function removeEntity(_0x46bb83,_0x28b532){return function(_0x443e2e){if(_0x443e2e){return _0x443e2e[_0xd41c('0x1e')]()[_0xd41c('0x1d')](function(){_0x46bb83['status'](0xcc)[_0xd41c('0x18')]();});}};}function handleEntityNotFound(_0x2261cf,_0x2c3010){return function(_0x536fbf){if(!_0x536fbf){_0x2261cf[_0xd41c('0x16')](0x194);}return _0x536fbf;};}function handleError(_0x1e3f71,_0xb2a728){_0xb2a728=_0xb2a728||0x1f4;return function(_0x402ded){logger[_0xd41c('0x1f')](_0x402ded[_0xd41c('0x20')]);if(_0x402ded['name']){delete _0x402ded[_0xd41c('0x21')];}_0x1e3f71[_0xd41c('0x17')](_0xb2a728)[_0xd41c('0x22')](_0x402ded);};}exports['index']=function(_0x105642,_0x27f079){var _0x2054d8={},_0x1075e7={},_0x538b87={'count':0x0,'rows':[]};var _0x1c4585=_[_0xd41c('0x23')](db['FreshsalesField']['rawAttributes'],function(_0x15734d){return{'name':_0x15734d[_0xd41c('0x24')],'type':_0x15734d[_0xd41c('0x25')][_0xd41c('0x26')]};});_0x1075e7[_0xd41c('0x27')]=_[_0xd41c('0x23')](_0x1c4585,_0xd41c('0x21'));_0x1075e7[_0xd41c('0x28')]=_[_0xd41c('0x29')](_0x105642[_0xd41c('0x28')]);_0x1075e7['filters']=_[_0xd41c('0x2a')](_0x1075e7[_0xd41c('0x27')],_0x1075e7['query']);_0x2054d8['attributes']=_[_0xd41c('0x2a')](_0x1075e7['model'],qs[_0xd41c('0x2b')](_0x105642['query'][_0xd41c('0x2b')]));_0x2054d8[_0xd41c('0x2c')]=_0x2054d8[_0xd41c('0x2c')]['length']?_0x2054d8[_0xd41c('0x2c')]:_0x1075e7['model'];if(!_0x105642[_0xd41c('0x28')][_0xd41c('0x2d')](_0xd41c('0x2e'))){_0x2054d8[_0xd41c('0x2f')]=qs[_0xd41c('0x2f')](_0x105642[_0xd41c('0x28')][_0xd41c('0x2f')]);_0x2054d8[_0xd41c('0x30')]=qs[_0xd41c('0x30')](_0x105642['query'][_0xd41c('0x30')]);}_0x2054d8[_0xd41c('0x31')]=qs[_0xd41c('0x32')](_0x105642[_0xd41c('0x28')][_0xd41c('0x32')]);_0x2054d8[_0xd41c('0x33')]=qs[_0xd41c('0x34')](_['pick'](_0x105642[_0xd41c('0x28')],_0x1075e7['filters']),_0x1c4585);if(_0x105642[_0xd41c('0x28')][_0xd41c('0x35')]){_0x2054d8['where']=_[_0xd41c('0x36')](_0x2054d8[_0xd41c('0x33')],{'$or':_[_0xd41c('0x23')](_0x1c4585,function(_0x5ae7b1){if(_0x5ae7b1[_0xd41c('0x25')]!==_0xd41c('0x37')){var _0x81ae18={};_0x81ae18[_0x5ae7b1['name']]={'$like':'%'+_0x105642[_0xd41c('0x28')]['filter']+'%'};return _0x81ae18;}})});}_0x2054d8=_['merge']({},_0x2054d8,_0x105642[_0xd41c('0x38')]);var _0x4d1e8d={'where':_0x2054d8[_0xd41c('0x33')]};return db['FreshsalesField'][_0xd41c('0x1a')](_0x4d1e8d)['then'](function(_0x1c2ed7){_0x538b87['count']=_0x1c2ed7;if(_0x105642[_0xd41c('0x28')][_0xd41c('0x39')]){_0x2054d8[_0xd41c('0x3a')]=[{'all':!![]}];}return db[_0xd41c('0x3b')]['findAll'](_0x2054d8);})[_0xd41c('0x1d')](function(_0x5e85cb){_0x538b87[_0xd41c('0x3c')]=_0x5e85cb;return _0x538b87;})[_0xd41c('0x1d')](respondWithFilteredResult(_0x27f079,_0x2054d8))[_0xd41c('0x3d')](handleError(_0x27f079,null));};exports['show']=function(_0xfd19a1,_0x611096){var _0x83a6c3={'raw':!![],'where':{'id':_0xfd19a1[_0xd41c('0x3e')]['id']}},_0x5a0465={};_0x5a0465[_0xd41c('0x27')]=_['keys'](db[_0xd41c('0x3b')]['rawAttributes']);_0x5a0465[_0xd41c('0x28')]=_[_0xd41c('0x29')](_0xfd19a1['query']);_0x5a0465[_0xd41c('0x3f')]=_[_0xd41c('0x2a')](_0x5a0465[_0xd41c('0x27')],_0x5a0465[_0xd41c('0x28')]);_0x83a6c3[_0xd41c('0x2c')]=_[_0xd41c('0x2a')](_0x5a0465['model'],qs[_0xd41c('0x2b')](_0xfd19a1[_0xd41c('0x28')][_0xd41c('0x2b')]));_0x83a6c3[_0xd41c('0x2c')]=_0x83a6c3[_0xd41c('0x2c')][_0xd41c('0x40')]?_0x83a6c3[_0xd41c('0x2c')]:_0x5a0465['model'];if(_0xfd19a1[_0xd41c('0x28')][_0xd41c('0x39')]){_0x83a6c3[_0xd41c('0x3a')]=[{'all':!![]}];}_0x83a6c3=_[_0xd41c('0x36')]({},_0x83a6c3,_0xfd19a1['options']);return db[_0xd41c('0x3b')][_0xd41c('0x41')](_0x83a6c3)[_0xd41c('0x1d')](handleEntityNotFound(_0x611096,null))['then'](respondWithResult(_0x611096,null))[_0xd41c('0x3d')](handleError(_0x611096,null));};exports[_0xd41c('0x42')]=function(_0x53bb95,_0x40b8ba){return db[_0xd41c('0x3b')][_0xd41c('0x42')](_0x53bb95[_0xd41c('0x43')],{})[_0xd41c('0x1d')](respondWithResult(_0x40b8ba,0xc9))[_0xd41c('0x3d')](handleError(_0x40b8ba,null));};exports[_0xd41c('0x44')]=function(_0x365350,_0x249caf){if(_0x365350[_0xd41c('0x43')]['id']){delete _0x365350['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x365350[_0xd41c('0x3e')]['id']}})[_0xd41c('0x1d')](handleEntityNotFound(_0x249caf,null))[_0xd41c('0x1d')](saveUpdates(_0x365350[_0xd41c('0x43')],null))['then'](respondWithResult(_0x249caf,null))['catch'](handleError(_0x249caf,null));};exports['destroy']=function(_0x5719a0,_0x59d72c){return db[_0xd41c('0x3b')][_0xd41c('0x41')]({'where':{'id':_0x5719a0[_0xd41c('0x3e')]['id']}})[_0xd41c('0x1d')](handleEntityNotFound(_0x59d72c,null))[_0xd41c('0x1d')](removeEntity(_0x59d72c,null))[_0xd41c('0x3d')](handleError(_0x59d72c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2519d99..3ee24b1 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 _0x8978=['request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','../../config/logger','moment'];(function(_0x560232,_0x3d3008){var _0x478ab6=function(_0x20e131){while(--_0x20e131){_0x560232['push'](_0x560232['shift']());}};_0x478ab6(++_0x3d3008);}(_0x8978,0x1cc));var _0x8897=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8978[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8897('0x0'))('api');var moment=require(_0x8897('0x1'));var BPromise=require('bluebird');var rp=require(_0x8897('0x2'));var fs=require('fs');var path=require(_0x8897('0x3'));var rimraf=require(_0x8897('0x4'));var config=require(_0x8897('0x5'));var attributes=require(_0x8897('0x6'));module['exports']=function(_0x11355e,_0x1191eb){return _0x11355e['define'](_0x8897('0x7'),attributes,{'tableName':_0x8897('0x8'),'paranoid':![],'indexes':[{'name':_0x8897('0x9'),'fields':['idField',_0x8897('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x007a=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x007a,0x145));var _0xa007=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0x007a[_0x4a73dd];return _0x279e6b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa007('0x0'))(_0xa007('0x1'));var moment=require('moment');var BPromise=require(_0xa007('0x2'));var rp=require(_0xa007('0x3'));var fs=require('fs');var path=require(_0xa007('0x4'));var rimraf=require(_0xa007('0x5'));var config=require(_0xa007('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xa007('0x7')]=function(_0x58e1b8,_0x2ef3e2){return _0x58e1b8[_0xa007('0x8')](_0xa007('0x9'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xa007('0xa'),'fields':[_0xa007('0xb'),_0xa007('0xc')],'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 e49ccde..56730f5 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 _0x0d7a=['FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x364062,_0x29f4f6){var _0x5930e7=function(_0x297ead){while(--_0x297ead){_0x364062['push'](_0x364062['shift']());}};_0x5930e7(++_0x29f4f6);}(_0x0d7a,0x1e4));var _0xa0d7=function(_0x348a12,_0x497903){_0x348a12=_0x348a12-0x0;var _0x57dab5=_0x0d7a[_0x348a12];return _0x57dab5;};'use strict';var _=require(_0xa0d7('0x0'));var util=require(_0xa0d7('0x1'));var moment=require(_0xa0d7('0x2'));var BPromise=require(_0xa0d7('0x3'));var rs=require(_0xa0d7('0x4'));var fs=require('fs');var Redis=require(_0xa0d7('0x5'));var db=require(_0xa0d7('0x6'))['db'];var utils=require(_0xa0d7('0x7'));var logger=require(_0xa0d7('0x8'))('rpc');var config=require(_0xa0d7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa0d7('0xa')][_0xa0d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52ed2d,_0x43f184,_0x502126){return new BPromise(function(_0x1112ce,_0x5384b2){return client['request'](_0x52ed2d,_0x502126)[_0xa0d7('0xc')](function(_0x4599d4){logger[_0xa0d7('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x43f184,'request\x20sent');logger[_0xa0d7('0xe')](_0xa0d7('0xf'),_0x43f184,_0xa0d7('0x10'),JSON[_0xa0d7('0x11')](_0x4599d4));if(_0x4599d4['error']){if(_0x4599d4[_0xa0d7('0x12')][_0xa0d7('0x13')]===0x1f4){logger[_0xa0d7('0x12')](_0xa0d7('0x14'),_0x43f184,_0x4599d4[_0xa0d7('0x12')]['message']);return _0x5384b2(_0x4599d4[_0xa0d7('0x12')][_0xa0d7('0x15')]);}logger[_0xa0d7('0x12')](_0xa0d7('0x14'),_0x43f184,_0x4599d4['error']['message']);return _0x1112ce(_0x4599d4[_0xa0d7('0x12')][_0xa0d7('0x15')]);}else{logger[_0xa0d7('0xd')](_0xa0d7('0x14'),_0x43f184,_0xa0d7('0x10'));_0x1112ce(_0x4599d4[_0xa0d7('0x16')]['message']);}})[_0xa0d7('0x17')](function(_0x2c55e3){logger[_0xa0d7('0x12')](_0xa0d7('0x14'),_0x43f184,_0x2c55e3);_0x5384b2(_0x2c55e3);});});} \ No newline at end of file +var _0x3124=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','randomstring','ioredis'];(function(_0x583155,_0x558b2c){var _0x128eb7=function(_0x12dbc9){while(--_0x12dbc9){_0x583155['push'](_0x583155['shift']());}};_0x128eb7(++_0x558b2c);}(_0x3124,0x6e));var _0x4312=function(_0x45c22b,_0x354341){_0x45c22b=_0x45c22b-0x0;var _0x3c5e3e=_0x3124[_0x45c22b];return _0x3c5e3e;};'use strict';var _=require(_0x4312('0x0'));var util=require(_0x4312('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4312('0x2'));var fs=require('fs');var Redis=require(_0x4312('0x3'));var db=require(_0x4312('0x4'))['db'];var utils=require(_0x4312('0x5'));var logger=require(_0x4312('0x6'))(_0x4312('0x7'));var config=require(_0x4312('0x8'));var jayson=require(_0x4312('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfc4d7e,_0x46bd5b,_0x80ebc3){return new BPromise(function(_0x18f128,_0x27ac1a){return client[_0x4312('0xa')](_0xfc4d7e,_0x80ebc3)['then'](function(_0x21b056){logger['info'](_0x4312('0xb'),_0x46bd5b,_0x4312('0xc'));logger['debug'](_0x4312('0xd'),_0x46bd5b,'request\x20sent',JSON['stringify'](_0x21b056));if(_0x21b056[_0x4312('0xe')]){if(_0x21b056[_0x4312('0xe')]['code']===0x1f4){logger[_0x4312('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x46bd5b,_0x21b056[_0x4312('0xe')][_0x4312('0xf')]);return _0x27ac1a(_0x21b056[_0x4312('0xe')][_0x4312('0xf')]);}logger[_0x4312('0xe')](_0x4312('0xb'),_0x46bd5b,_0x21b056[_0x4312('0xe')][_0x4312('0xf')]);return _0x18f128(_0x21b056[_0x4312('0xe')][_0x4312('0xf')]);}else{logger[_0x4312('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x46bd5b,_0x4312('0xc'));_0x18f128(_0x21b056[_0x4312('0x11')][_0x4312('0xf')]);}})[_0x4312('0x12')](function(_0xad9ff3){logger['error'](_0x4312('0xb'),_0x46bd5b,_0xad9ff3);_0x27ac1a(_0xad9ff3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a6a8493..987d8f6 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 _0x5251=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy'];(function(_0x37301e,_0x302ffa){var _0x4941a7=function(_0x1055e1){while(--_0x1055e1){_0x37301e['push'](_0x37301e['shift']());}};_0x4941a7(++_0x302ffa);}(_0x5251,0x1c9));var _0x1525=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5251[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1525('0x0'));var util=require(_0x1525('0x1'));var path=require(_0x1525('0x2'));var timeout=require(_0x1525('0x3'));var express=require(_0x1525('0x4'));var router=express[_0x1525('0x5')]();var auth=require(_0x1525('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1525('0x7'));var controller=require(_0x1525('0x8'));router[_0x1525('0x9')]('/',auth['isAuthenticated'](),controller[_0x1525('0xa')]);router[_0x1525('0x9')]('/:id',auth[_0x1525('0xb')](),controller[_0x1525('0xc')]);router['get'](_0x1525('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1525('0x9')](_0x1525('0xe'),auth['isAuthenticated'](),controller[_0x1525('0xf')]);router[_0x1525('0x10')]('/',auth['isAuthenticated'](),controller[_0x1525('0x11')]);router[_0x1525('0x10')](_0x1525('0xd'),auth[_0x1525('0xb')](),controller['addConfiguration']);router[_0x1525('0x12')]('/:id',auth[_0x1525('0xb')](),controller[_0x1525('0x13')]);router[_0x1525('0x14')](_0x1525('0x15'),auth[_0x1525('0xb')](),controller[_0x1525('0x16')]);module[_0x1525('0x17')]=router; \ No newline at end of file +var _0x5057=['express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','/:id/fields','create','post','/:id/configurations','put','update','destroy','multer','util','path'];(function(_0x12c0fe,_0x2af9c8){var _0x4ac0b7=function(_0x1840fa){while(--_0x1840fa){_0x12c0fe['push'](_0x12c0fe['shift']());}};_0x4ac0b7(++_0x2af9c8);}(_0x5057,0x151));var _0x7505=function(_0x5581b0,_0x45b0a0){_0x5581b0=_0x5581b0-0x0;var _0x3fb8b6=_0x5057[_0x5581b0];return _0x3fb8b6;};'use strict';var multer=require(_0x7505('0x0'));var util=require(_0x7505('0x1'));var path=require(_0x7505('0x2'));var timeout=require('connect-timeout');var express=require(_0x7505('0x3'));var router=express[_0x7505('0x4')]();var auth=require(_0x7505('0x5'));var interaction=require(_0x7505('0x6'));var config=require('../../config/environment');var controller=require(_0x7505('0x7'));router[_0x7505('0x8')]('/',auth['isAuthenticated'](),controller[_0x7505('0x9')]);router[_0x7505('0x8')](_0x7505('0xa'),auth[_0x7505('0xb')](),controller[_0x7505('0xc')]);router[_0x7505('0x8')]('/:id/configurations',auth[_0x7505('0xb')](),controller['getConfigurations']);router[_0x7505('0x8')](_0x7505('0xd'),auth[_0x7505('0xb')](),controller['getFields']);router['post']('/',auth[_0x7505('0xb')](),controller[_0x7505('0xe')]);router[_0x7505('0xf')](_0x7505('0x10'),auth[_0x7505('0xb')](),controller['addConfiguration']);router[_0x7505('0x11')](_0x7505('0xa'),auth['isAuthenticated'](),controller[_0x7505('0x12')]);router['delete'](_0x7505('0xa'),auth[_0x7505('0xb')](),controller[_0x7505('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e653c7c..634685d 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 _0xabce=['exports','STRING','ENUM','newTab','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xabce,0x103));var _0xeabc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xabce[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')]},'description':{'type':Sequelize[_0xeabc('0x2')]},'username':{'type':Sequelize[_0xeabc('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xeabc('0x2')]},'clientId':{'type':Sequelize[_0xeabc('0x2')]},'clientSecret':{'type':Sequelize[_0xeabc('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xeabc('0x3')]('integrationTab',_0xeabc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1b1a3b,_0x52a88a){_0x1b1a3b=_0x1b1a3b-0x0;var _0x385347=_0x5fc3[_0x1b1a3b];return _0x385347;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35fc('0x2')]},'username':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x3')},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x35fc('0x2')]},'securityToken':{'type':Sequelize[_0x35fc('0x2')]},'serverUrl':{'type':Sequelize[_0x35fc('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x35fc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c2324ac..2efe8c6 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 _0x79bf=['send','index','map','rawAttributes','fieldName','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','type','VIRTUAL','filter','options','SalesforceAccount','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','remoteUri','clientId','clientSecret','username','password','slice','Connection','login','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','Priority','Status','Type','Case','Origin','SuppliedName','remove','includes','picklistValues','label','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','save','update','destroy','name'];(function(_0x1642b2,_0x1e3775){var _0x486fda=function(_0x358f9e){while(--_0x358f9e){_0x1642b2['push'](_0x1642b2['shift']());}};_0x486fda(++_0x1e3775);}(_0x79bf,0x1df));var _0xf79b=function(_0x2d08d2,_0x22d0c1){_0x2d08d2=_0x2d08d2-0x0;var _0x5b91e9=_0x79bf[_0x2d08d2];return _0x5b91e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf79b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf79b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf79b('0x2'));var moment=require(_0xf79b('0x3'));var BPromise=require(_0xf79b('0x4'));var Mustache=require(_0xf79b('0x5'));var util=require(_0xf79b('0x6'));var path=require(_0xf79b('0x7'));var sox=require(_0xf79b('0x8'));var csv=require('to-csv');var ejs=require(_0xf79b('0x9'));var fs=require('fs');var _=require(_0xf79b('0xa'));var squel=require(_0xf79b('0xb'));var crypto=require('crypto');var jsforce=require(_0xf79b('0xc'));var deskjs=require(_0xf79b('0xd'));var toCsv=require(_0xf79b('0xe'));var querystring=require(_0xf79b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf79b('0x10'));var qs=require(_0xf79b('0x11'));var as=require(_0xf79b('0x12'));var hardwareService=require(_0xf79b('0x13'));var logger=require(_0xf79b('0x14'))(_0xf79b('0x15'));var utils=require(_0xf79b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf79b('0x17'));var db=require(_0xf79b('0x18'))['db'];var integrations=require(_0xf79b('0x19'));var jayson=require(_0xf79b('0x1a'));var client=jayson[_0xf79b('0x1b')][_0xf79b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xef61f7,_0x108b60,_0x1ac99c,_0xe046eb){return new BPromise(function(_0x1bd011,_0x2d1361){var _0x5ac739=_0xe046eb||client;return _0x5ac739['request'](_0xef61f7,_0x1ac99c)[_0xf79b('0x1d')](function(_0x595790){logger[_0xf79b('0x1e')]('SalesforceAccount,\x20%s,\x20%s',_0x108b60,_0xf79b('0x1f'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x108b60,_0xf79b('0x1f'),JSON['stringify'](_0x595790));if(_0x595790[_0xf79b('0x20')]){if(_0x595790[_0xf79b('0x20')][_0xf79b('0x21')]===0x1f4){logger['error'](_0xf79b('0x22'),_0x108b60,_0x595790['error'][_0xf79b('0x23')]);return _0x2d1361(_0x595790[_0xf79b('0x20')][_0xf79b('0x23')]);}logger[_0xf79b('0x20')](_0xf79b('0x22'),_0x108b60,_0x595790['error'][_0xf79b('0x23')]);return _0x1bd011(_0x595790['error']['message']);}else{logger[_0xf79b('0x1e')](_0xf79b('0x22'),_0x108b60,_0xf79b('0x1f'));_0x1bd011(_0x595790[_0xf79b('0x24')][_0xf79b('0x23')]);}})[_0xf79b('0x25')](function(_0x5dd34d){logger[_0xf79b('0x20')](_0xf79b('0x22'),_0x108b60,_0x5dd34d);_0x2d1361(_0x5dd34d);});});}function respondWithStatusCode(_0x378db3,_0x13a339){_0x13a339=_0x13a339||0xcc;return function(_0x2de335){if(_0x2de335){return _0x378db3[_0xf79b('0x26')](_0x13a339);}return _0x378db3[_0xf79b('0x27')](_0x13a339)[_0xf79b('0x28')]();};}function respondWithResult(_0xf1480e,_0x31bd2a){_0x31bd2a=_0x31bd2a||0xc8;return function(_0x5c9dfb){if(_0x5c9dfb){return _0xf1480e[_0xf79b('0x27')](_0x31bd2a)['json'](_0x5c9dfb);}};}function respondWithFilteredResult(_0x55740a,_0x1a99e3){return function(_0x4cb150){if(_0x4cb150){var _0xb4e37=_0x4cb150[_0xf79b('0x29')],_0x112019=_0x1a99e3[_0xf79b('0x2a')],_0x291c8a=_0x1a99e3[_0xf79b('0x2a')]+_0x1a99e3['limit'],_0x17a310;if(_0x291c8a>=_0xb4e37){_0x291c8a=_0xb4e37;_0x17a310=0xc8;}else{_0x17a310=0xce;}_0x55740a[_0xf79b('0x27')](_0x17a310);return _0x55740a[_0xf79b('0x2b')](_0xf79b('0x2c'),_0x112019+'-'+_0x291c8a+'/'+_0xb4e37)['json'](_0x4cb150);}return null;};}function patchUpdates(_0x26217e){return function(_0x3b7c5d){try{jsonpatch['apply'](_0x3b7c5d,_0x26217e,!![]);}catch(_0x152b06){return BPromise['reject'](_0x152b06);}return _0x3b7c5d[_0xf79b('0x2d')]();};}function saveUpdates(_0x45be6,_0x1cb0c3){return function(_0x3e4627){if(_0x3e4627){return _0x3e4627[_0xf79b('0x2e')](_0x45be6)[_0xf79b('0x1d')](function(_0x91a89b){return _0x91a89b;});}return null;};}function removeEntity(_0x682ebf,_0x4a4d75){return function(_0x38901f){if(_0x38901f){return _0x38901f[_0xf79b('0x2f')]()[_0xf79b('0x1d')](function(){_0x682ebf[_0xf79b('0x27')](0xcc)[_0xf79b('0x28')]();});}};}function handleEntityNotFound(_0x55c5a3,_0x4c14f0){return function(_0x3e6829){if(!_0x3e6829){_0x55c5a3[_0xf79b('0x26')](0x194);}return _0x3e6829;};}function handleError(_0x69f2a6,_0x31acaa){_0x31acaa=_0x31acaa||0x1f4;return function(_0x994e7){logger['error'](_0x994e7['stack']);if(_0x994e7[_0xf79b('0x30')]){delete _0x994e7[_0xf79b('0x30')];}_0x69f2a6[_0xf79b('0x27')](_0x31acaa)[_0xf79b('0x31')](_0x994e7);};}exports[_0xf79b('0x32')]=function(_0x458eaf,_0x59f576){var _0x2feedf={},_0x2b3faf={},_0x691b7a={'count':0x0,'rows':[]};var _0x1d0b28=_[_0xf79b('0x33')](db['SalesforceAccount'][_0xf79b('0x34')],function(_0x4831d3){return{'name':_0x4831d3[_0xf79b('0x35')],'type':_0x4831d3['type'][_0xf79b('0x36')]};});_0x2b3faf[_0xf79b('0x37')]=_[_0xf79b('0x33')](_0x1d0b28,_0xf79b('0x30'));_0x2b3faf['query']=_['keys'](_0x458eaf['query']);_0x2b3faf[_0xf79b('0x38')]=_[_0xf79b('0x39')](_0x2b3faf['model'],_0x2b3faf[_0xf79b('0x3a')]);_0x2feedf['attributes']=_[_0xf79b('0x39')](_0x2b3faf[_0xf79b('0x37')],qs[_0xf79b('0x3b')](_0x458eaf['query'][_0xf79b('0x3b')]));_0x2feedf[_0xf79b('0x3c')]=_0x2feedf['attributes'][_0xf79b('0x3d')]?_0x2feedf['attributes']:_0x2b3faf[_0xf79b('0x37')];if(!_0x458eaf[_0xf79b('0x3a')][_0xf79b('0x3e')](_0xf79b('0x3f'))){_0x2feedf[_0xf79b('0x40')]=qs[_0xf79b('0x40')](_0x458eaf[_0xf79b('0x3a')][_0xf79b('0x40')]);_0x2feedf[_0xf79b('0x2a')]=qs[_0xf79b('0x2a')](_0x458eaf[_0xf79b('0x3a')][_0xf79b('0x2a')]);}_0x2feedf['order']=qs[_0xf79b('0x41')](_0x458eaf[_0xf79b('0x3a')]['sort']);_0x2feedf['where']=qs[_0xf79b('0x38')](_[_0xf79b('0x42')](_0x458eaf[_0xf79b('0x3a')],_0x2b3faf[_0xf79b('0x38')]),_0x1d0b28);if(_0x458eaf[_0xf79b('0x3a')]['filter']){_0x2feedf[_0xf79b('0x43')]=_[_0xf79b('0x44')](_0x2feedf[_0xf79b('0x43')],{'$or':_[_0xf79b('0x33')](_0x1d0b28,function(_0x36504a){if(_0x36504a[_0xf79b('0x45')]!==_0xf79b('0x46')){var _0x214413={};_0x214413[_0x36504a[_0xf79b('0x30')]]={'$like':'%'+_0x458eaf[_0xf79b('0x3a')][_0xf79b('0x47')]+'%'};return _0x214413;}})});}_0x2feedf=_[_0xf79b('0x44')]({},_0x2feedf,_0x458eaf[_0xf79b('0x48')]);var _0x3ef7aa={'where':_0x2feedf[_0xf79b('0x43')]};return db[_0xf79b('0x49')]['count'](_0x3ef7aa)[_0xf79b('0x1d')](function(_0x56f606){_0x691b7a[_0xf79b('0x29')]=_0x56f606;if(_0x458eaf[_0xf79b('0x3a')][_0xf79b('0x4a')]){_0x2feedf[_0xf79b('0x4b')]=[{'all':!![]}];}return db[_0xf79b('0x49')][_0xf79b('0x4c')](_0x2feedf);})[_0xf79b('0x1d')](function(_0x429164){_0x691b7a[_0xf79b('0x4d')]=_0x429164;return _0x691b7a;})['then'](respondWithFilteredResult(_0x59f576,_0x2feedf))['catch'](handleError(_0x59f576,null));};exports[_0xf79b('0x4e')]=function(_0x58fade,_0x4d7bdd){var _0x5b107d={'raw':![],'where':{'id':_0x58fade[_0xf79b('0x4f')]['id']}},_0x33341d={};_0x33341d[_0xf79b('0x37')]=_['keys'](db[_0xf79b('0x49')][_0xf79b('0x34')]);_0x33341d['query']=_[_0xf79b('0x50')](_0x58fade[_0xf79b('0x3a')]);_0x33341d['filtears']=_[_0xf79b('0x39')](_0x33341d[_0xf79b('0x37')],_0x33341d[_0xf79b('0x3a')]);_0x5b107d[_0xf79b('0x3c')]=_[_0xf79b('0x39')](_0x33341d[_0xf79b('0x37')],qs[_0xf79b('0x3b')](_0x58fade[_0xf79b('0x3a')]['fields']));_0x5b107d[_0xf79b('0x3c')]=_0x5b107d[_0xf79b('0x3c')][_0xf79b('0x3d')]?_0x5b107d[_0xf79b('0x3c')]:_0x33341d[_0xf79b('0x37')];if(_0x58fade[_0xf79b('0x3a')]['includeAll']){_0x5b107d[_0xf79b('0x4b')]=[{'all':!![]}];}_0x5b107d=_['merge']({},_0x5b107d,_0x58fade[_0xf79b('0x48')]);return db[_0xf79b('0x49')][_0xf79b('0x51')](_0x5b107d)['then'](handleEntityNotFound(_0x4d7bdd,null))[_0xf79b('0x1d')](respondWithResult(_0x4d7bdd,null))['catch'](handleError(_0x4d7bdd,null));};exports[_0xf79b('0x52')]=function(_0x214ef2,_0x515915){return db[_0xf79b('0x49')]['create'](_0x214ef2[_0xf79b('0x53')],{})['then'](respondWithResult(_0x515915,0xc9))['catch'](handleError(_0x515915,null));};exports[_0xf79b('0x2e')]=function(_0x280774,_0x3344bd){if(_0x280774[_0xf79b('0x53')]['id']){delete _0x280774[_0xf79b('0x53')]['id'];}return db['SalesforceAccount'][_0xf79b('0x51')]({'where':{'id':_0x280774[_0xf79b('0x4f')]['id']}})[_0xf79b('0x1d')](handleEntityNotFound(_0x3344bd,null))[_0xf79b('0x1d')](saveUpdates(_0x280774['body'],null))[_0xf79b('0x1d')](respondWithResult(_0x3344bd,null))[_0xf79b('0x25')](handleError(_0x3344bd,null));};exports[_0xf79b('0x2f')]=function(_0x5c716c,_0x3bc052){return db[_0xf79b('0x49')]['find']({'where':{'id':_0x5c716c[_0xf79b('0x4f')]['id']}})[_0xf79b('0x1d')](handleEntityNotFound(_0x3bc052,null))[_0xf79b('0x1d')](removeEntity(_0x3bc052,null))['catch'](handleError(_0x3bc052,null));};exports[_0xf79b('0x54')]=function(_0x152c18,_0x5d4966,_0x4d43b9){var _0x128f0f={};var _0x5bad4f={};var _0x53e45c;var _0x53f426;return db[_0xf79b('0x49')][_0xf79b('0x55')]({'where':{'id':_0x152c18[_0xf79b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d4966,null))[_0xf79b('0x1d')](function(_0x5e1f53){if(_0x5e1f53){_0x53e45c=_0x5e1f53;_0x5bad4f[_0xf79b('0x37')]=_[_0xf79b('0x50')](db[_0xf79b('0x56')][_0xf79b('0x34')]);_0x5bad4f[_0xf79b('0x3a')]=_[_0xf79b('0x50')](_0x152c18['query']);_0x5bad4f[_0xf79b('0x38')]=_[_0xf79b('0x39')](_0x5bad4f[_0xf79b('0x37')],_0x5bad4f['query']);_0x128f0f[_0xf79b('0x3c')]=_['intersection'](_0x5bad4f['model'],qs[_0xf79b('0x3b')](_0x152c18[_0xf79b('0x3a')][_0xf79b('0x3b')]));_0x128f0f[_0xf79b('0x3c')]=_0x128f0f['attributes']['length']?_0x128f0f[_0xf79b('0x3c')]:_0x5bad4f[_0xf79b('0x37')];_0x128f0f['order']=qs[_0xf79b('0x41')](_0x152c18[_0xf79b('0x3a')][_0xf79b('0x41')]);_0x128f0f[_0xf79b('0x43')]=qs[_0xf79b('0x38')](_[_0xf79b('0x42')](_0x152c18['query'],_0x5bad4f[_0xf79b('0x38')]));if(_0x152c18[_0xf79b('0x3a')][_0xf79b('0x47')]){_0x128f0f['where']=_[_0xf79b('0x44')](_0x128f0f[_0xf79b('0x43')],{'$or':_[_0xf79b('0x33')](_0x128f0f[_0xf79b('0x3c')],function(_0x67a1b4){var _0x222299={};_0x222299[_0x67a1b4]={'$like':'%'+_0x152c18['query']['filter']+'%'};return _0x222299;})});}_0x128f0f=_[_0xf79b('0x44')]({},_0x128f0f,_0x152c18[_0xf79b('0x48')]);return _0x53e45c[_0xf79b('0x54')](_0x128f0f);}})[_0xf79b('0x1d')](function(_0x57f3e6){if(_0x57f3e6){_0x53f426=_0x57f3e6[_0xf79b('0x3d')];if(!_0x152c18[_0xf79b('0x3a')][_0xf79b('0x3e')](_0xf79b('0x3f'))){_0x128f0f[_0xf79b('0x40')]=qs[_0xf79b('0x40')](_0x152c18[_0xf79b('0x3a')]['limit']);_0x128f0f[_0xf79b('0x2a')]=qs[_0xf79b('0x2a')](_0x152c18[_0xf79b('0x3a')][_0xf79b('0x2a')]);}return _0x53e45c[_0xf79b('0x54')](_0x128f0f);}})[_0xf79b('0x1d')](function(_0x4bce51){if(_0x4bce51){return _0x4bce51?{'count':_0x53f426,'rows':_0x4bce51}:null;}})[_0xf79b('0x1d')](respondWithResult(_0x5d4966,null))[_0xf79b('0x25')](handleError(_0x5d4966,null));};exports[_0xf79b('0x57')]=function(_0x743c64,_0x1d2e7a,_0x124e8d){if(_0x743c64[_0xf79b('0x53')]['id']){delete _0x743c64['body']['id'];}return db[_0xf79b('0x49')]['findOne']({'where':{'id':_0x743c64[_0xf79b('0x4f')]['id']}})[_0xf79b('0x1d')](handleEntityNotFound(_0x1d2e7a,null))[_0xf79b('0x1d')](function(_0x37fd1){if(_0x37fd1){_0x743c64['body'][_0xf79b('0x58')]=_0x37fd1['id'];_0x743c64[_0xf79b('0x53')][_0xf79b('0x59')]=integrations[_0xf79b('0x5a')](_0x743c64[_0xf79b('0x53')][_0xf79b('0x5b')],_0x743c64[_0xf79b('0x53')][_0xf79b('0x45')]);_0x743c64[_0xf79b('0x53')]['Descriptions']=integrations[_0xf79b('0x5c')](_0x743c64[_0xf79b('0x53')][_0xf79b('0x5b')],_0x743c64[_0xf79b('0x53')]['type']);return db['SalesforceConfiguration'][_0xf79b('0x52')](_0x743c64[_0xf79b('0x53')],{'include':[{'model':db[_0xf79b('0x5d')],'as':_0xf79b('0x59')},{'model':db[_0xf79b('0x5d')],'as':_0xf79b('0x5e')}]});}return null;})[_0xf79b('0x1d')](respondWithResult(_0x1d2e7a,null))[_0xf79b('0x25')](handleError(_0x1d2e7a,null));};exports[_0xf79b('0x5f')]=function(_0x168d8c,_0x5133ba,_0x4b871c){var _0x27fa66;var _0x401a9e='';var _0x224e21='Task';return db[_0xf79b('0x49')][_0xf79b('0x55')]({'where':{'id':_0x168d8c[_0xf79b('0x4f')]['id']},'attributes':['id',_0xf79b('0x60'),_0xf79b('0x61'),_0xf79b('0x62'),_0xf79b('0x63'),_0xf79b('0x64'),'securityToken']})[_0xf79b('0x1d')](handleEntityNotFound(_0x5133ba,null))[_0xf79b('0x1d')](function(_0x48eb58){if(_0x48eb58){_0x401a9e=_0x48eb58[_0xf79b('0x60')];var _0x56f8c4=_0x401a9e[_0xf79b('0x65')](-0x1);if(_0x56f8c4==='/'){_0x401a9e=_0x401a9e['substring'](0x0,_0x401a9e['lastIndexOf'](_0x56f8c4));}_0x27fa66=new jsforce[(_0xf79b('0x66'))]({'oauth2':{'loginUrl':_0x401a9e,'clientId':_0x48eb58[_0xf79b('0x61')],'clientSecret':_0x48eb58[_0xf79b('0x62')]}});return _0x27fa66[_0xf79b('0x67')](_0x48eb58[_0xf79b('0x63')],_0x48eb58[_0xf79b('0x64')]['concat'](_0x48eb58['securityToken']));}})[_0xf79b('0x1d')](function(_0x55681f){if(_0x55681f){if(!_[_0xf79b('0x68')](_0x168d8c[_0xf79b('0x3a')][_0xf79b('0x69')])){_0x224e21=_0x168d8c[_0xf79b('0x3a')][_0xf79b('0x69')];}return _0x27fa66[_0xf79b('0x6a')](_0x224e21)['describe']();}})[_0xf79b('0x1d')](function(_0x408773){var _0xde10c0=[_0xf79b('0x6b'),_0xf79b('0x6c'),_0xf79b('0x6d'),_0xf79b('0x6e'),'IsArchived',_0xf79b('0x6f'),_0xf79b('0x70'),_0xf79b('0x71')];if(!_['isNil'](_0x168d8c['query']['ticketType'])&&_0x168d8c['query']['ticketType']===_0xf79b('0x72')){_0xde10c0=['Type',_0xf79b('0x73'),'Reason',_0xf79b('0x70'),_0xf79b('0x6f'),'IsEscalated',_0xf79b('0x74'),'SuppliedCompany'];}if(_0x408773){_[_0xf79b('0x75')](_0x408773[_0xf79b('0x3b')],function(_0x4c619b){return _0x4c619b['custom']===![]&&!_0xde10c0[_0xf79b('0x76')](_0x4c619b[_0xf79b('0x30')]);});return{'count':_0x408773[_0xf79b('0x3b')][_0xf79b('0x3d')],'rows':_[_0xf79b('0x33')](_0x408773[_0xf79b('0x3b')],function(_0xc44936){return{'id':_0xc44936[_0xf79b('0x30')],'name':_0xc44936['label'],'custom':_0xc44936['custom'],'options':_0xc44936[_0xf79b('0x77')][_0xf79b('0x3d')]>0x0?_[_0xf79b('0x33')](_0xc44936['picklistValues'],function(_0xaad7b2){return{'name':_0xaad7b2[_0xf79b('0x78')],'value':_0xaad7b2[_0xf79b('0x79')]};}):_0xc44936[_0xf79b('0x45')]==_0xf79b('0x7a')?[{'name':_0xf79b('0x7b'),'value':_0xf79b('0x7c')},{'name':_0xf79b('0x7d'),'value':_0xf79b('0x7e')}]:[]};})};}})[_0xf79b('0x1d')](respondWithResult(_0x5133ba,null))[_0xf79b('0x25')](function(_0x205368){var _0x41e862=_0x168d8c['query']['test']?0x1f4:_0x205368[_0xf79b('0x7f')]||0x1f4;logger[_0xf79b('0x20')](_0xf79b('0x80'),_0xf79b('0x5f'),_0x41e862,JSON[_0xf79b('0x81')](_0x205368));delete _0x205368[_0xf79b('0x30')];if(_0x41e862===0x191){_0x41e862=0x190;}_0x5133ba[_0xf79b('0x27')](_0x41e862)[_0xf79b('0x31')](_0x168d8c['query'][_0xf79b('0x82')]?{'message':_0xf79b('0x83'),'statusCode':_0x205368['statusCode']}:_0x205368);});}; \ No newline at end of file +var _0x7d5d=['stack','name','index','map','rawAttributes','type','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','includeAll','SalesforceAccount','findAll','rows','catch','show','params','filtears','intersection','include','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','options','addConfiguration','Subjects','getDescriptions','channel','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','username','password','slice','substring','Connection','login','concat','securityToken','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','IsArchived','Priority','Status','Type','Case','Origin','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x7d5d,0x1dd));var _0xd7d5=function(_0x30d32b,_0x17357a){_0x30d32b=_0x30d32b-0x0;var _0x1e09c3=_0x7d5d[_0x30d32b];return _0x1e09c3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7d5('0x0'));var rimraf=require(_0xd7d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd7d5('0x2'));var moment=require(_0xd7d5('0x3'));var BPromise=require(_0xd7d5('0x4'));var Mustache=require('mustache');var util=require(_0xd7d5('0x5'));var path=require(_0xd7d5('0x6'));var sox=require(_0xd7d5('0x7'));var csv=require(_0xd7d5('0x8'));var ejs=require(_0xd7d5('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd7d5('0xa'));var crypto=require(_0xd7d5('0xb'));var jsforce=require(_0xd7d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd7d5('0x8'));var querystring=require(_0xd7d5('0xd'));var Papa=require('papaparse');var Redis=require(_0xd7d5('0xe'));var authService=require(_0xd7d5('0xf'));var qs=require(_0xd7d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7d5('0x11'));var logger=require(_0xd7d5('0x12'))(_0xd7d5('0x13'));var utils=require(_0xd7d5('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd7d5('0x15'))['db'];var integrations=require(_0xd7d5('0x16'));var jayson=require(_0xd7d5('0x17'));var client=jayson[_0xd7d5('0x18')][_0xd7d5('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x612f8c,_0x54e2f1,_0x12327e,_0x32753d){return new BPromise(function(_0x2c38f1,_0x3a01d9){var _0x237c1f=_0x32753d||client;return _0x237c1f['request'](_0x612f8c,_0x12327e)[_0xd7d5('0x1a')](function(_0x125302){logger[_0xd7d5('0x1b')](_0xd7d5('0x1c'),_0x54e2f1,_0xd7d5('0x1d'));logger[_0xd7d5('0x1e')](_0xd7d5('0x1f'),_0x54e2f1,_0xd7d5('0x1d'),JSON['stringify'](_0x125302));if(_0x125302['error']){if(_0x125302[_0xd7d5('0x20')]['code']===0x1f4){logger['error'](_0xd7d5('0x1c'),_0x54e2f1,_0x125302['error'][_0xd7d5('0x21')]);return _0x3a01d9(_0x125302['error'][_0xd7d5('0x21')]);}logger[_0xd7d5('0x20')](_0xd7d5('0x1c'),_0x54e2f1,_0x125302[_0xd7d5('0x20')][_0xd7d5('0x21')]);return _0x2c38f1(_0x125302['error'][_0xd7d5('0x21')]);}else{logger[_0xd7d5('0x1b')](_0xd7d5('0x1c'),_0x54e2f1,'request\x20sent');_0x2c38f1(_0x125302['result'][_0xd7d5('0x21')]);}})['catch'](function(_0x153cb8){logger[_0xd7d5('0x20')](_0xd7d5('0x1c'),_0x54e2f1,_0x153cb8);_0x3a01d9(_0x153cb8);});});}function respondWithStatusCode(_0x813333,_0x232978){_0x232978=_0x232978||0xcc;return function(_0x378501){if(_0x378501){return _0x813333[_0xd7d5('0x22')](_0x232978);}return _0x813333['status'](_0x232978)[_0xd7d5('0x23')]();};}function respondWithResult(_0x2f05f8,_0x5713ff){_0x5713ff=_0x5713ff||0xc8;return function(_0x3eb1eb){if(_0x3eb1eb){return _0x2f05f8[_0xd7d5('0x24')](_0x5713ff)[_0xd7d5('0x25')](_0x3eb1eb);}};}function respondWithFilteredResult(_0xd3e212,_0x445a8e){return function(_0x18a660){if(_0x18a660){var _0x106d88=_0x18a660[_0xd7d5('0x26')],_0xf47f2d=_0x445a8e[_0xd7d5('0x27')],_0x3bd423=_0x445a8e[_0xd7d5('0x27')]+_0x445a8e[_0xd7d5('0x28')],_0x1acef9;if(_0x3bd423>=_0x106d88){_0x3bd423=_0x106d88;_0x1acef9=0xc8;}else{_0x1acef9=0xce;}_0xd3e212[_0xd7d5('0x24')](_0x1acef9);return _0xd3e212['set'](_0xd7d5('0x29'),_0xf47f2d+'-'+_0x3bd423+'/'+_0x106d88)[_0xd7d5('0x25')](_0x18a660);}return null;};}function patchUpdates(_0x5bed84){return function(_0x30b929){try{jsonpatch[_0xd7d5('0x2a')](_0x30b929,_0x5bed84,!![]);}catch(_0x3091cc){return BPromise[_0xd7d5('0x2b')](_0x3091cc);}return _0x30b929[_0xd7d5('0x2c')]();};}function saveUpdates(_0x135f83,_0x513b81){return function(_0x3c3627){if(_0x3c3627){return _0x3c3627[_0xd7d5('0x2d')](_0x135f83)['then'](function(_0x49b41e){return _0x49b41e;});}return null;};}function removeEntity(_0x50ab34,_0x59ebb2){return function(_0x2371e0){if(_0x2371e0){return _0x2371e0[_0xd7d5('0x2e')]()[_0xd7d5('0x1a')](function(){_0x50ab34[_0xd7d5('0x24')](0xcc)[_0xd7d5('0x23')]();});}};}function handleEntityNotFound(_0xb3386b,_0x169296){return function(_0x2225a0){if(!_0x2225a0){_0xb3386b[_0xd7d5('0x22')](0x194);}return _0x2225a0;};}function handleError(_0x48b761,_0x2a54dd){_0x2a54dd=_0x2a54dd||0x1f4;return function(_0x31a9a9){logger[_0xd7d5('0x20')](_0x31a9a9[_0xd7d5('0x2f')]);if(_0x31a9a9[_0xd7d5('0x30')]){delete _0x31a9a9[_0xd7d5('0x30')];}_0x48b761['status'](_0x2a54dd)['send'](_0x31a9a9);};}exports[_0xd7d5('0x31')]=function(_0xdb5cc4,_0x170930){var _0x364d64={},_0x3e380b={},_0x2ffb60={'count':0x0,'rows':[]};var _0x2d8a9f=_[_0xd7d5('0x32')](db['SalesforceAccount'][_0xd7d5('0x33')],function(_0x37648b){return{'name':_0x37648b['fieldName'],'type':_0x37648b[_0xd7d5('0x34')]['key']};});_0x3e380b['model']=_[_0xd7d5('0x32')](_0x2d8a9f,_0xd7d5('0x30'));_0x3e380b[_0xd7d5('0x35')]=_[_0xd7d5('0x36')](_0xdb5cc4['query']);_0x3e380b[_0xd7d5('0x37')]=_['intersection'](_0x3e380b[_0xd7d5('0x38')],_0x3e380b['query']);_0x364d64['attributes']=_['intersection'](_0x3e380b['model'],qs[_0xd7d5('0x39')](_0xdb5cc4['query']['fields']));_0x364d64[_0xd7d5('0x3a')]=_0x364d64[_0xd7d5('0x3a')][_0xd7d5('0x3b')]?_0x364d64['attributes']:_0x3e380b[_0xd7d5('0x38')];if(!_0xdb5cc4['query'][_0xd7d5('0x3c')](_0xd7d5('0x3d'))){_0x364d64[_0xd7d5('0x28')]=qs[_0xd7d5('0x28')](_0xdb5cc4['query']['limit']);_0x364d64['offset']=qs[_0xd7d5('0x27')](_0xdb5cc4[_0xd7d5('0x35')]['offset']);}_0x364d64[_0xd7d5('0x3e')]=qs[_0xd7d5('0x3f')](_0xdb5cc4[_0xd7d5('0x35')][_0xd7d5('0x3f')]);_0x364d64[_0xd7d5('0x40')]=qs['filters'](_['pick'](_0xdb5cc4[_0xd7d5('0x35')],_0x3e380b[_0xd7d5('0x37')]),_0x2d8a9f);if(_0xdb5cc4['query']['filter']){_0x364d64['where']=_[_0xd7d5('0x41')](_0x364d64[_0xd7d5('0x40')],{'$or':_['map'](_0x2d8a9f,function(_0x5cb5ce){if(_0x5cb5ce[_0xd7d5('0x34')]!=='VIRTUAL'){var _0x329e29={};_0x329e29[_0x5cb5ce['name']]={'$like':'%'+_0xdb5cc4[_0xd7d5('0x35')][_0xd7d5('0x42')]+'%'};return _0x329e29;}})});}_0x364d64=_[_0xd7d5('0x41')]({},_0x364d64,_0xdb5cc4['options']);var _0x2115e8={'where':_0x364d64[_0xd7d5('0x40')]};return db['SalesforceAccount'][_0xd7d5('0x26')](_0x2115e8)[_0xd7d5('0x1a')](function(_0xce6a0c){_0x2ffb60['count']=_0xce6a0c;if(_0xdb5cc4[_0xd7d5('0x35')][_0xd7d5('0x43')]){_0x364d64['include']=[{'all':!![]}];}return db[_0xd7d5('0x44')][_0xd7d5('0x45')](_0x364d64);})[_0xd7d5('0x1a')](function(_0x3019ef){_0x2ffb60[_0xd7d5('0x46')]=_0x3019ef;return _0x2ffb60;})[_0xd7d5('0x1a')](respondWithFilteredResult(_0x170930,_0x364d64))[_0xd7d5('0x47')](handleError(_0x170930,null));};exports[_0xd7d5('0x48')]=function(_0xa77bba,_0x56259f){var _0x3d06e0={'raw':![],'where':{'id':_0xa77bba[_0xd7d5('0x49')]['id']}},_0x1b4f54={};_0x1b4f54[_0xd7d5('0x38')]=_[_0xd7d5('0x36')](db[_0xd7d5('0x44')][_0xd7d5('0x33')]);_0x1b4f54['query']=_['keys'](_0xa77bba['query']);_0x1b4f54[_0xd7d5('0x4a')]=_[_0xd7d5('0x4b')](_0x1b4f54[_0xd7d5('0x38')],_0x1b4f54['query']);_0x3d06e0[_0xd7d5('0x3a')]=_[_0xd7d5('0x4b')](_0x1b4f54['model'],qs[_0xd7d5('0x39')](_0xa77bba[_0xd7d5('0x35')][_0xd7d5('0x39')]));_0x3d06e0[_0xd7d5('0x3a')]=_0x3d06e0[_0xd7d5('0x3a')][_0xd7d5('0x3b')]?_0x3d06e0[_0xd7d5('0x3a')]:_0x1b4f54[_0xd7d5('0x38')];if(_0xa77bba['query'][_0xd7d5('0x43')]){_0x3d06e0[_0xd7d5('0x4c')]=[{'all':!![]}];}_0x3d06e0=_[_0xd7d5('0x41')]({},_0x3d06e0,_0xa77bba['options']);return db['SalesforceAccount'][_0xd7d5('0x4d')](_0x3d06e0)[_0xd7d5('0x1a')](handleEntityNotFound(_0x56259f,null))[_0xd7d5('0x1a')](respondWithResult(_0x56259f,null))['catch'](handleError(_0x56259f,null));};exports[_0xd7d5('0x4e')]=function(_0x4aaa1d,_0x4c07ed){return db[_0xd7d5('0x44')]['create'](_0x4aaa1d['body'],{})[_0xd7d5('0x1a')](respondWithResult(_0x4c07ed,0xc9))[_0xd7d5('0x47')](handleError(_0x4c07ed,null));};exports[_0xd7d5('0x2d')]=function(_0x3b18cd,_0x8a27c0){if(_0x3b18cd[_0xd7d5('0x4f')]['id']){delete _0x3b18cd[_0xd7d5('0x4f')]['id'];}return db[_0xd7d5('0x44')]['find']({'where':{'id':_0x3b18cd[_0xd7d5('0x49')]['id']}})['then'](handleEntityNotFound(_0x8a27c0,null))[_0xd7d5('0x1a')](saveUpdates(_0x3b18cd[_0xd7d5('0x4f')],null))['then'](respondWithResult(_0x8a27c0,null))[_0xd7d5('0x47')](handleError(_0x8a27c0,null));};exports[_0xd7d5('0x2e')]=function(_0x5041d3,_0x3b57bf){return db[_0xd7d5('0x44')][_0xd7d5('0x4d')]({'where':{'id':_0x5041d3[_0xd7d5('0x49')]['id']}})[_0xd7d5('0x1a')](handleEntityNotFound(_0x3b57bf,null))[_0xd7d5('0x1a')](removeEntity(_0x3b57bf,null))['catch'](handleError(_0x3b57bf,null));};exports[_0xd7d5('0x50')]=function(_0xc3c768,_0x177ad3,_0x21a194){var _0x1aa807={};var _0x574033={};var _0x5ae5aa;var _0x5d52b4;return db[_0xd7d5('0x44')][_0xd7d5('0x51')]({'where':{'id':_0xc3c768[_0xd7d5('0x49')]['id']}})[_0xd7d5('0x1a')](handleEntityNotFound(_0x177ad3,null))[_0xd7d5('0x1a')](function(_0x2d44be){if(_0x2d44be){_0x5ae5aa=_0x2d44be;_0x574033[_0xd7d5('0x38')]=_[_0xd7d5('0x36')](db[_0xd7d5('0x52')][_0xd7d5('0x33')]);_0x574033[_0xd7d5('0x35')]=_[_0xd7d5('0x36')](_0xc3c768[_0xd7d5('0x35')]);_0x574033['filters']=_['intersection'](_0x574033[_0xd7d5('0x38')],_0x574033[_0xd7d5('0x35')]);_0x1aa807[_0xd7d5('0x3a')]=_[_0xd7d5('0x4b')](_0x574033['model'],qs[_0xd7d5('0x39')](_0xc3c768['query'][_0xd7d5('0x39')]));_0x1aa807[_0xd7d5('0x3a')]=_0x1aa807[_0xd7d5('0x3a')][_0xd7d5('0x3b')]?_0x1aa807[_0xd7d5('0x3a')]:_0x574033['model'];_0x1aa807[_0xd7d5('0x3e')]=qs[_0xd7d5('0x3f')](_0xc3c768[_0xd7d5('0x35')][_0xd7d5('0x3f')]);_0x1aa807[_0xd7d5('0x40')]=qs[_0xd7d5('0x37')](_[_0xd7d5('0x53')](_0xc3c768[_0xd7d5('0x35')],_0x574033[_0xd7d5('0x37')]));if(_0xc3c768[_0xd7d5('0x35')][_0xd7d5('0x42')]){_0x1aa807[_0xd7d5('0x40')]=_[_0xd7d5('0x41')](_0x1aa807[_0xd7d5('0x40')],{'$or':_['map'](_0x1aa807[_0xd7d5('0x3a')],function(_0xc1dec6){var _0x46ec99={};_0x46ec99[_0xc1dec6]={'$like':'%'+_0xc3c768[_0xd7d5('0x35')][_0xd7d5('0x42')]+'%'};return _0x46ec99;})});}_0x1aa807=_[_0xd7d5('0x41')]({},_0x1aa807,_0xc3c768[_0xd7d5('0x54')]);return _0x5ae5aa['getConfigurations'](_0x1aa807);}})[_0xd7d5('0x1a')](function(_0x3ae51f){if(_0x3ae51f){_0x5d52b4=_0x3ae51f[_0xd7d5('0x3b')];if(!_0xc3c768[_0xd7d5('0x35')][_0xd7d5('0x3c')](_0xd7d5('0x3d'))){_0x1aa807[_0xd7d5('0x28')]=qs[_0xd7d5('0x28')](_0xc3c768[_0xd7d5('0x35')][_0xd7d5('0x28')]);_0x1aa807[_0xd7d5('0x27')]=qs[_0xd7d5('0x27')](_0xc3c768['query'][_0xd7d5('0x27')]);}return _0x5ae5aa[_0xd7d5('0x50')](_0x1aa807);}})[_0xd7d5('0x1a')](function(_0x595500){if(_0x595500){return _0x595500?{'count':_0x5d52b4,'rows':_0x595500}:null;}})['then'](respondWithResult(_0x177ad3,null))[_0xd7d5('0x47')](handleError(_0x177ad3,null));};exports[_0xd7d5('0x55')]=function(_0x2284e3,_0x1e328f,_0x49fecd){if(_0x2284e3['body']['id']){delete _0x2284e3[_0xd7d5('0x4f')]['id'];}return db[_0xd7d5('0x44')][_0xd7d5('0x51')]({'where':{'id':_0x2284e3[_0xd7d5('0x49')]['id']}})[_0xd7d5('0x1a')](handleEntityNotFound(_0x1e328f,null))[_0xd7d5('0x1a')](function(_0x22e1ec){if(_0x22e1ec){_0x2284e3[_0xd7d5('0x4f')]['AccountId']=_0x22e1ec['id'];_0x2284e3[_0xd7d5('0x4f')][_0xd7d5('0x56')]=integrations['getSubjects'](_0x2284e3['body']['channel'],_0x2284e3[_0xd7d5('0x4f')][_0xd7d5('0x34')]);_0x2284e3[_0xd7d5('0x4f')]['Descriptions']=integrations[_0xd7d5('0x57')](_0x2284e3[_0xd7d5('0x4f')][_0xd7d5('0x58')],_0x2284e3[_0xd7d5('0x4f')]['type']);return db[_0xd7d5('0x52')][_0xd7d5('0x4e')](_0x2284e3['body'],{'include':[{'model':db[_0xd7d5('0x59')],'as':_0xd7d5('0x56')},{'model':db[_0xd7d5('0x59')],'as':_0xd7d5('0x5a')}]});}return null;})[_0xd7d5('0x1a')](respondWithResult(_0x1e328f,null))['catch'](handleError(_0x1e328f,null));};exports[_0xd7d5('0x5b')]=function(_0x534cba,_0x1d4d2c,_0x3e68b5){var _0x107818;var _0x135936='';var _0x1345f4=_0xd7d5('0x5c');return db['SalesforceAccount']['findOne']({'where':{'id':_0x534cba[_0xd7d5('0x49')]['id']},'attributes':['id',_0xd7d5('0x5d'),_0xd7d5('0x5e'),'clientSecret',_0xd7d5('0x5f'),_0xd7d5('0x60'),'securityToken']})[_0xd7d5('0x1a')](handleEntityNotFound(_0x1d4d2c,null))[_0xd7d5('0x1a')](function(_0x14bf51){if(_0x14bf51){_0x135936=_0x14bf51[_0xd7d5('0x5d')];var _0x5774df=_0x135936[_0xd7d5('0x61')](-0x1);if(_0x5774df==='/'){_0x135936=_0x135936[_0xd7d5('0x62')](0x0,_0x135936['lastIndexOf'](_0x5774df));}_0x107818=new jsforce[(_0xd7d5('0x63'))]({'oauth2':{'loginUrl':_0x135936,'clientId':_0x14bf51[_0xd7d5('0x5e')],'clientSecret':_0x14bf51['clientSecret']}});return _0x107818[_0xd7d5('0x64')](_0x14bf51[_0xd7d5('0x5f')],_0x14bf51[_0xd7d5('0x60')][_0xd7d5('0x65')](_0x14bf51[_0xd7d5('0x66')]));}})[_0xd7d5('0x1a')](function(_0x577882){if(_0x577882){if(!_[_0xd7d5('0x67')](_0x534cba[_0xd7d5('0x35')][_0xd7d5('0x68')])){_0x1345f4=_0x534cba['query'][_0xd7d5('0x68')];}return _0x107818[_0xd7d5('0x69')](_0x1345f4)['describe']();}})[_0xd7d5('0x1a')](function(_0x5f4690){var _0xbd1d39=[_0xd7d5('0x6a'),_0xd7d5('0x6b'),'CallObject','CallType',_0xd7d5('0x6c'),_0xd7d5('0x6d'),_0xd7d5('0x6e'),_0xd7d5('0x6f')];if(!_[_0xd7d5('0x67')](_0x534cba['query'][_0xd7d5('0x68')])&&_0x534cba[_0xd7d5('0x35')][_0xd7d5('0x68')]===_0xd7d5('0x70')){_0xbd1d39=['Type',_0xd7d5('0x71'),'Reason',_0xd7d5('0x6e'),_0xd7d5('0x6d'),_0xd7d5('0x72'),_0xd7d5('0x73'),_0xd7d5('0x74')];}if(_0x5f4690){_[_0xd7d5('0x75')](_0x5f4690['fields'],function(_0x752e19){return _0x752e19[_0xd7d5('0x76')]===![]&&!_0xbd1d39[_0xd7d5('0x77')](_0x752e19['name']);});return{'count':_0x5f4690[_0xd7d5('0x39')][_0xd7d5('0x3b')],'rows':_['map'](_0x5f4690['fields'],function(_0x1c89e2){return{'id':_0x1c89e2[_0xd7d5('0x30')],'name':_0x1c89e2[_0xd7d5('0x78')],'custom':_0x1c89e2[_0xd7d5('0x76')],'options':_0x1c89e2[_0xd7d5('0x79')][_0xd7d5('0x3b')]>0x0?_[_0xd7d5('0x32')](_0x1c89e2[_0xd7d5('0x79')],function(_0x286311){return{'name':_0x286311['label'],'value':_0x286311[_0xd7d5('0x7a')]};}):_0x1c89e2[_0xd7d5('0x34')]=='boolean'?[{'name':'True','value':_0xd7d5('0x7b')},{'name':'False','value':_0xd7d5('0x7c')}]:[]};})};}})[_0xd7d5('0x1a')](respondWithResult(_0x1d4d2c,null))['catch'](function(_0x5d9b1f){var _0x352509=_0x534cba['query']['test']?0x1f4:_0x5d9b1f[_0xd7d5('0x7d')]||0x1f4;logger[_0xd7d5('0x20')](_0xd7d5('0x7e'),'getFields',_0x352509,JSON[_0xd7d5('0x7f')](_0x5d9b1f));delete _0x5d9b1f[_0xd7d5('0x30')];if(_0x352509===0x191){_0x352509=0x190;}_0x1d4d2c[_0xd7d5('0x24')](_0x352509)[_0xd7d5('0x80')](_0x534cba[_0xd7d5('0x35')][_0xd7d5('0x81')]?{'message':_0xd7d5('0x82'),'statusCode':_0x5d9b1f[_0xd7d5('0x7d')]}:_0x5d9b1f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 7a19fe3..ffac62e 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 _0x324b=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fa4dc,_0x5dcf6d){var _0x4e9a31=function(_0x39173d){while(--_0x39173d){_0x4fa4dc['push'](_0x4fa4dc['shift']());}};_0x4e9a31(++_0x5dcf6d);}(_0x324b,0x1a5));var _0xb324=function(_0x21708f,_0x4cd43e){_0x21708f=_0x21708f-0x0;var _0x4a2667=_0x324b[_0x21708f];return _0x4a2667;};'use strict';var _=require('lodash');var util=require(_0xb324('0x0'));var logger=require(_0xb324('0x1'))(_0xb324('0x2'));var moment=require(_0xb324('0x3'));var BPromise=require(_0xb324('0x4'));var rp=require(_0xb324('0x5'));var fs=require('fs');var path=require(_0xb324('0x6'));var rimraf=require(_0xb324('0x7'));var config=require('../../config/environment');var attributes=require(_0xb324('0x8'));var integrations=require(_0xb324('0x9'));module['exports']=function(_0x33421f,_0x5599fa){return _0x33421f[_0xb324('0xa')](_0xb324('0xb'),attributes,{'tableName':_0xb324('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1775=['request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c491a,_0x2f7b2f){var _0x404b9d=function(_0x579e45){while(--_0x579e45){_0x4c491a['push'](_0x4c491a['shift']());}};_0x404b9d(++_0x2f7b2f);}(_0x1775,0xb0));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5177('0x0'));var util=require(_0x5177('0x1'));var logger=require(_0x5177('0x2'))(_0x5177('0x3'));var moment=require(_0x5177('0x4'));var BPromise=require(_0x5177('0x5'));var rp=require(_0x5177('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x56856d,_0x1ee500){return _0x56856d['define'](_0x5177('0xb'),attributes,{'tableName':_0x5177('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 a138ec9..ce2d2c8 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 _0xb903=['info','result','findAll','options','raw','where','attributes','limit','map','include','model','then','GetSalesforceAccount','debug','stringify','ShowSalesforceAccount','SalesforceAccount','find','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SalesforceAccount,\x20%s,\x20%s','message'];(function(_0x25e214,_0x42a13e){var _0x48ca06=function(_0x34c6ca){while(--_0x34c6ca){_0x25e214['push'](_0x25e214['shift']());}};_0x48ca06(++_0x42a13e);}(_0xb903,0x185));var _0x3b90=function(_0x3f71f4,_0x2b0fd6){_0x3f71f4=_0x3f71f4-0x0;var _0x3af6df=_0xb903[_0x3f71f4];return _0x3af6df;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});}exports['GetSalesforceAccount']=function(_0x269488){var _0x3cf281=this;return new Promise(function(_0x11ad7d,_0x131f3f){return db['SalesforceAccount'][_0x3b90('0x14')]({'raw':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x16')]===undefined?!![]:![]:!![],'where':_0x269488['options']?_0x269488[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x18')]||null:null,'limit':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')][_0x3b90('0x19')]||null:null,'include':_0x269488[_0x3b90('0x15')]?_0x269488[_0x3b90('0x15')]['include']?_[_0x3b90('0x1a')](_0x269488[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x7faee){return{'model':db[_0x7faee[_0x3b90('0x1c')]],'as':_0x7faee['as'],'attributes':_0x7faee[_0x3b90('0x18')],'include':_0x7faee['include']?_['map'](_0x7faee[_0x3b90('0x1b')],function(_0x29d472){return{'model':db[_0x29d472[_0x3b90('0x1c')]],'as':_0x29d472['as'],'attributes':_0x29d472[_0x3b90('0x18')],'include':_0x29d472['include']?_[_0x3b90('0x1a')](_0x29d472[_0x3b90('0x1b')],function(_0x1787d1){return{'model':db[_0x1787d1['model']],'as':_0x1787d1['as'],'attributes':_0x1787d1[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x17ec7f){logger[_0x3b90('0x12')](_0x3b90('0x1e'),_0x269488);logger[_0x3b90('0x1f')]('GetSalesforceAccount',_0x269488,JSON[_0x3b90('0x20')](_0x17ec7f));_0x11ad7d(_0x17ec7f);})['catch'](function(_0xaf453c){logger[_0x3b90('0xf')](_0x3b90('0x1e'),_0xaf453c[_0x3b90('0x11')],_0x269488);_0x131f3f(_0x3cf281[_0x3b90('0xf')](0x1f4,_0xaf453c[_0x3b90('0x11')]));});});};exports[_0x3b90('0x21')]=function(_0x2430ec){var _0x500ceb=this;return new Promise(function(_0x4d1f31,_0x43bd4f){return db[_0x3b90('0x22')][_0x3b90('0x23')]({'raw':_0x2430ec[_0x3b90('0x15')]?_0x2430ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x2430ec[_0x3b90('0x15')]?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x17')]||null:null,'attributes':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')]['attributes']||null:null,'include':_0x2430ec['options']?_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')]?_['map'](_0x2430ec[_0x3b90('0x15')][_0x3b90('0x1b')],function(_0x3e30b8){return{'model':db[_0x3e30b8['model']],'as':_0x3e30b8['as'],'attributes':_0x3e30b8['attributes'],'include':_0x3e30b8[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x3e30b8[_0x3b90('0x1b')],function(_0x401dc5){return{'model':db[_0x401dc5['model']],'as':_0x401dc5['as'],'attributes':_0x401dc5['attributes'],'include':_0x401dc5[_0x3b90('0x1b')]?_[_0x3b90('0x1a')](_0x401dc5['include'],function(_0x57946d){return{'model':db[_0x57946d[_0x3b90('0x1c')]],'as':_0x57946d['as'],'attributes':_0x57946d[_0x3b90('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b90('0x1d')](function(_0x298df6){logger['info'](_0x3b90('0x21'),_0x2430ec);logger['debug'](_0x3b90('0x21'),_0x2430ec,JSON[_0x3b90('0x20')](_0x298df6));_0x4d1f31(_0x298df6);})[_0x3b90('0x24')](function(_0x20abf8){logger[_0x3b90('0xf')](_0x3b90('0x21'),_0x20abf8[_0x3b90('0x11')],_0x2430ec);_0x43bd4f(_0x500ceb['error'](0x1f4,_0x20abf8[_0x3b90('0x11')]));});});}; \ No newline at end of file +var _0xd2ea=['attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where'];(function(_0x32a246,_0x46445b){var _0x30164f=function(_0x3d9d41){while(--_0x3d9d41){_0x32a246['push'](_0x32a246['shift']());}};_0x30164f(++_0x46445b);}(_0xd2ea,0x15f));var _0xad2e=function(_0x432723,_0x31e971){_0x432723=_0x432723-0x0;var _0x4f4991=_0xd2ea[_0x432723];return _0x4f4991;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});}exports[_0xad2e('0x18')]=function(_0x34f946){var _0x1b4889=this;return new Promise(function(_0x163e83,_0x4ef16f){return db[_0xad2e('0x19')][_0xad2e('0x1a')]({'raw':_0x34f946['options']?_0x34f946['options']['raw']===undefined?!![]:![]:!![],'where':_0x34f946['options']?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'limit':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1e')]||null:null,'include':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x207517){return{'model':db[_0x207517[_0xad2e('0x21')]],'as':_0x207517['as'],'attributes':_0x207517['attributes'],'include':_0x207517[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x207517[_0xad2e('0x1f')],function(_0x350c66){return{'model':db[_0x350c66[_0xad2e('0x21')]],'as':_0x350c66['as'],'attributes':_0x350c66[_0xad2e('0x1d')],'include':_0x350c66[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x350c66[_0xad2e('0x1f')],function(_0x50d446){return{'model':db[_0x50d446[_0xad2e('0x21')]],'as':_0x50d446['as'],'attributes':_0x50d446['attributes']};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x28ef72){logger[_0xad2e('0x15')](_0xad2e('0x18'),_0x34f946);logger[_0xad2e('0xf')](_0xad2e('0x18'),_0x34f946,JSON[_0xad2e('0x11')](_0x28ef72));_0x163e83(_0x28ef72);})[_0xad2e('0x17')](function(_0x52fdda){logger[_0xad2e('0x12')]('GetSalesforceAccount',_0x52fdda[_0xad2e('0x14')],_0x34f946);_0x4ef16f(_0x1b4889[_0xad2e('0x12')](0x1f4,_0x52fdda[_0xad2e('0x14')]));});});};exports[_0xad2e('0x23')]=function(_0x42fe6c){var _0x9b4a23=this;return new Promise(function(_0x409f58,_0x3e3d86){return db[_0xad2e('0x19')][_0xad2e('0x24')]({'raw':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c['options'][_0xad2e('0x25')]===undefined?!![]:![]:!![],'where':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'include':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')]?_['map'](_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x569b9c){return{'model':db[_0x569b9c[_0xad2e('0x21')]],'as':_0x569b9c['as'],'attributes':_0x569b9c[_0xad2e('0x1d')],'include':_0x569b9c[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x569b9c[_0xad2e('0x1f')],function(_0x2fa320){return{'model':db[_0x2fa320[_0xad2e('0x21')]],'as':_0x2fa320['as'],'attributes':_0x2fa320['attributes'],'include':_0x2fa320[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x2fa320['include'],function(_0x161402){return{'model':db[_0x161402[_0xad2e('0x21')]],'as':_0x161402['as'],'attributes':_0x161402[_0xad2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x48c77b){logger[_0xad2e('0x15')]('ShowSalesforceAccount',_0x42fe6c);logger['debug'](_0xad2e('0x23'),_0x42fe6c,JSON['stringify'](_0x48c77b));_0x409f58(_0x48c77b);})[_0xad2e('0x17')](function(_0x33c2a8){logger[_0xad2e('0x12')](_0xad2e('0x23'),_0x33c2a8[_0xad2e('0x14')],_0x42fe6c);_0x3e3d86(_0x9b4a23['error'](0x1f4,_0x33c2a8[_0xad2e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index c663743..ffd0012 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 _0x3055=['get','isAuthenticated','/:id','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','delete','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x3055,0xa3));var _0x5305=function(_0x346645,_0x3e9d9c){_0x346645=_0x346645-0x0;var _0x32f590=_0x3055[_0x346645];return _0x32f590;};'use strict';var multer=require(_0x5305('0x0'));var util=require(_0x5305('0x1'));var path=require('path');var timeout=require(_0x5305('0x2'));var express=require('express');var router=express[_0x5305('0x3')]();var auth=require(_0x5305('0x4'));var interaction=require(_0x5305('0x5'));var config=require(_0x5305('0x6'));var controller=require(_0x5305('0x7'));router[_0x5305('0x8')]('/',auth[_0x5305('0x9')](),controller['index']);router[_0x5305('0x8')](_0x5305('0xa'),auth[_0x5305('0x9')](),controller[_0x5305('0xb')]);router[_0x5305('0x8')](_0x5305('0xc'),auth[_0x5305('0x9')](),controller['getFields']);router[_0x5305('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x5305('0x8')](_0x5305('0xd'),auth['isAuthenticated'](),controller[_0x5305('0xe')]);router[_0x5305('0xf')]('/',auth['isAuthenticated'](),controller[_0x5305('0x10')]);router[_0x5305('0x11')]('/:id',auth[_0x5305('0x9')](),controller['update']);router[_0x5305('0x12')](_0x5305('0xa'),auth[_0x5305('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb700=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','path'];(function(_0x31205d,_0x6d427){var _0x47ff96=function(_0x2b3424){while(--_0x2b3424){_0x31205d['push'](_0x31205d['shift']());}};_0x47ff96(++_0x6d427);}(_0xb700,0xfc));var _0x0b70=function(_0x2dc7c9,_0x3a15f8){_0x2dc7c9=_0x2dc7c9-0x0;var _0x3e6536=_0xb700[_0x2dc7c9];return _0x3e6536;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b70('0x0'));var timeout=require(_0x0b70('0x1'));var express=require(_0x0b70('0x2'));var router=express[_0x0b70('0x3')]();var auth=require(_0x0b70('0x4'));var interaction=require(_0x0b70('0x5'));var config=require(_0x0b70('0x6'));var controller=require(_0x0b70('0x7'));router[_0x0b70('0x8')]('/',auth[_0x0b70('0x9')](),controller[_0x0b70('0xa')]);router['get'](_0x0b70('0xb'),auth[_0x0b70('0x9')](),controller[_0x0b70('0xc')]);router[_0x0b70('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0b70('0xd')]);router[_0x0b70('0x8')](_0x0b70('0xe'),auth[_0x0b70('0x9')](),controller[_0x0b70('0xf')]);router['get']('/:id/descriptions',auth[_0x0b70('0x9')](),controller[_0x0b70('0x10')]);router[_0x0b70('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0b70('0x12')](_0x0b70('0xb'),auth[_0x0b70('0x9')](),controller[_0x0b70('0x13')]);router[_0x0b70('0x14')](_0x0b70('0xb'),auth[_0x0b70('0x9')](),controller[_0x0b70('0x15')]);module[_0x0b70('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9944f9e..6ecfb02 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 _0x7c85=['STRING','Task','Case','ENUM','contact_lead','contact','lead','exports'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x7c85,0x12f));var _0x57c8=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x7c85[_0x3060e3];return _0x497d2c;};'use strict';var Sequelize=require('sequelize');module[_0x57c8('0x0')]={'name':{'type':Sequelize[_0x57c8('0x1')]},'description':{'type':Sequelize[_0x57c8('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x57c8('0x2'),_0x57c8('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x57c8('0x4')](_0x57c8('0x5'),_0x57c8('0x6'),_0x57c8('0x7')),'defaultValue':_0x57c8('0x5')},'moduleCreate':{'type':Sequelize[_0x57c8('0x4')]('nothing',_0x57c8('0x6'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file +var _0xb892=['ENUM','contact','nothing','lead','exports','STRING','Task'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xb892,0x1bd));var _0x2b89=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb892[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0x2b89('0x0')]={'name':{'type':Sequelize[_0x2b89('0x1')]},'description':{'type':Sequelize[_0x2b89('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x2b89('0x2'),'Case'),'defaultValue':_0x2b89('0x2')},'moduleSearch':{'type':Sequelize[_0x2b89('0x3')]('contact_lead',_0x2b89('0x4'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x2b89('0x3')](_0x2b89('0x5'),_0x2b89('0x4'),_0x2b89('0x6')),'defaultValue':_0x2b89('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ae28480..23bee3d 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 _0x3b1c=['params','filtears','fields','find','create','body','update','destroy','getFields','findOne','SalesforceField','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','reject','save','then','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show'];(function(_0x2b5da9,_0x5a655c){var _0x5453b4=function(_0x5a326a){while(--_0x5a326a){_0x2b5da9['push'](_0x2b5da9['shift']());}};_0x5453b4(++_0x5a655c);}(_0x3b1c,0x17e));var _0xc3b1=function(_0x226db6,_0x10d21f){_0x226db6=_0x226db6-0x0;var _0x3231a4=_0x3b1c[_0x226db6];return _0x3231a4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc3b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3b1('0x1'));var jsonpatch=require(_0xc3b1('0x2'));var rp=require(_0xc3b1('0x3'));var moment=require(_0xc3b1('0x4'));var BPromise=require(_0xc3b1('0x5'));var Mustache=require(_0xc3b1('0x6'));var util=require(_0xc3b1('0x7'));var path=require('path');var sox=require(_0xc3b1('0x8'));var csv=require(_0xc3b1('0x9'));var ejs=require(_0xc3b1('0xa'));var fs=require('fs');var _=require(_0xc3b1('0xb'));var squel=require(_0xc3b1('0xc'));var crypto=require(_0xc3b1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3b1('0x9'));var querystring=require(_0xc3b1('0xe'));var Papa=require(_0xc3b1('0xf'));var Redis=require(_0xc3b1('0x10'));var authService=require(_0xc3b1('0x11'));var qs=require(_0xc3b1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3b1('0x13'));var utils=require('../../config/utils');var config=require(_0xc3b1('0x14'));var licenseUtil=require(_0xc3b1('0x15'));var db=require(_0xc3b1('0x16'))['db'];var jayson=require(_0xc3b1('0x17'));var client=jayson[_0xc3b1('0x18')][_0xc3b1('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xc2a445,_0x192b31,_0x4260e8,_0x4ab778){return new BPromise(function(_0x1fcc53,_0x24932e){var _0x32d04c=_0x4ab778||client;return _0x32d04c[_0xc3b1('0x1a')](_0xc2a445,_0x4260e8)['then'](function(_0x3f8e85){logger[_0xc3b1('0x1b')](_0xc3b1('0x1c'),_0x192b31,_0xc3b1('0x1d'));logger[_0xc3b1('0x1e')](_0xc3b1('0x1f'),_0x192b31,_0xc3b1('0x1d'),JSON[_0xc3b1('0x20')](_0x3f8e85));if(_0x3f8e85['error']){if(_0x3f8e85['error'][_0xc3b1('0x21')]===0x1f4){logger['error'](_0xc3b1('0x1c'),_0x192b31,_0x3f8e85[_0xc3b1('0x22')]['message']);return _0x24932e(_0x3f8e85[_0xc3b1('0x22')][_0xc3b1('0x23')]);}logger[_0xc3b1('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x192b31,_0x3f8e85[_0xc3b1('0x22')][_0xc3b1('0x23')]);return _0x1fcc53(_0x3f8e85[_0xc3b1('0x22')][_0xc3b1('0x23')]);}else{logger['info'](_0xc3b1('0x1c'),_0x192b31,'request\x20sent');_0x1fcc53(_0x3f8e85[_0xc3b1('0x24')][_0xc3b1('0x23')]);}})[_0xc3b1('0x25')](function(_0x3bfe38){logger[_0xc3b1('0x22')](_0xc3b1('0x1c'),_0x192b31,_0x3bfe38);_0x24932e(_0x3bfe38);});});}function respondWithStatusCode(_0x2511be,_0x1c346d){_0x1c346d=_0x1c346d||0xcc;return function(_0x514fcc){if(_0x514fcc){return _0x2511be[_0xc3b1('0x26')](_0x1c346d);}return _0x2511be[_0xc3b1('0x27')](_0x1c346d)[_0xc3b1('0x28')]();};}function respondWithResult(_0x4f87b1,_0x13fe67){_0x13fe67=_0x13fe67||0xc8;return function(_0x3e6595){if(_0x3e6595){return _0x4f87b1[_0xc3b1('0x27')](_0x13fe67)[_0xc3b1('0x29')](_0x3e6595);}};}function respondWithFilteredResult(_0x32c8ba,_0x22eb07){return function(_0x28aada){if(_0x28aada){var _0x46e01a=_0x28aada['count'],_0x38bd98=_0x22eb07[_0xc3b1('0x2a')],_0x2ac67a=_0x22eb07['offset']+_0x22eb07['limit'],_0x5c0975;if(_0x2ac67a>=_0x46e01a){_0x2ac67a=_0x46e01a;_0x5c0975=0xc8;}else{_0x5c0975=0xce;}_0x32c8ba[_0xc3b1('0x27')](_0x5c0975);return _0x32c8ba['set']('Content-Range',_0x38bd98+'-'+_0x2ac67a+'/'+_0x46e01a)['json'](_0x28aada);}return null;};}function patchUpdates(_0x4b9b67){return function(_0x2e53ff){try{jsonpatch['apply'](_0x2e53ff,_0x4b9b67,!![]);}catch(_0x493a2c){return BPromise[_0xc3b1('0x2b')](_0x493a2c);}return _0x2e53ff[_0xc3b1('0x2c')]();};}function saveUpdates(_0x3425c6,_0x42cfb2){return function(_0x8d4b9){if(_0x8d4b9){return _0x8d4b9['update'](_0x3425c6)['then'](function(_0x3644d7){return _0x3644d7;});}return null;};}function removeEntity(_0x5db35f,_0xa4a811){return function(_0x3d479a){if(_0x3d479a){return _0x3d479a['destroy']()[_0xc3b1('0x2d')](function(){_0x5db35f[_0xc3b1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43eccc,_0x424616){return function(_0x55ded0){if(!_0x55ded0){_0x43eccc['sendStatus'](0x194);}return _0x55ded0;};}function handleError(_0x3c8349,_0x57bbb1){_0x57bbb1=_0x57bbb1||0x1f4;return function(_0x1643f1){logger[_0xc3b1('0x22')](_0x1643f1[_0xc3b1('0x2e')]);if(_0x1643f1[_0xc3b1('0x2f')]){delete _0x1643f1[_0xc3b1('0x2f')];}_0x3c8349[_0xc3b1('0x27')](_0x57bbb1)[_0xc3b1('0x30')](_0x1643f1);};}exports[_0xc3b1('0x31')]=function(_0xbd71bf,_0x4e6f15){var _0x22b7e1={},_0x4f5b99={},_0x342f76={'count':0x0,'rows':[]};var _0x1a62fd=_[_0xc3b1('0x32')](db[_0xc3b1('0x33')][_0xc3b1('0x34')],function(_0x2dee8b){return{'name':_0x2dee8b['fieldName'],'type':_0x2dee8b[_0xc3b1('0x35')][_0xc3b1('0x36')]};});_0x4f5b99[_0xc3b1('0x37')]=_[_0xc3b1('0x32')](_0x1a62fd,_0xc3b1('0x2f'));_0x4f5b99['query']=_[_0xc3b1('0x38')](_0xbd71bf[_0xc3b1('0x39')]);_0x4f5b99[_0xc3b1('0x3a')]=_[_0xc3b1('0x3b')](_0x4f5b99[_0xc3b1('0x37')],_0x4f5b99[_0xc3b1('0x39')]);_0x22b7e1[_0xc3b1('0x3c')]=_[_0xc3b1('0x3b')](_0x4f5b99[_0xc3b1('0x37')],qs['fields'](_0xbd71bf[_0xc3b1('0x39')]['fields']));_0x22b7e1[_0xc3b1('0x3c')]=_0x22b7e1['attributes'][_0xc3b1('0x3d')]?_0x22b7e1[_0xc3b1('0x3c')]:_0x4f5b99[_0xc3b1('0x37')];if(!_0xbd71bf[_0xc3b1('0x39')][_0xc3b1('0x3e')](_0xc3b1('0x3f'))){_0x22b7e1[_0xc3b1('0x40')]=qs[_0xc3b1('0x40')](_0xbd71bf[_0xc3b1('0x39')]['limit']);_0x22b7e1['offset']=qs['offset'](_0xbd71bf[_0xc3b1('0x39')][_0xc3b1('0x2a')]);}_0x22b7e1['order']=qs['sort'](_0xbd71bf[_0xc3b1('0x39')][_0xc3b1('0x41')]);_0x22b7e1['where']=qs[_0xc3b1('0x3a')](_[_0xc3b1('0x42')](_0xbd71bf[_0xc3b1('0x39')],_0x4f5b99[_0xc3b1('0x3a')]),_0x1a62fd);if(_0xbd71bf[_0xc3b1('0x39')][_0xc3b1('0x43')]){_0x22b7e1[_0xc3b1('0x44')]=_[_0xc3b1('0x45')](_0x22b7e1['where'],{'$or':_[_0xc3b1('0x32')](_0x1a62fd,function(_0x43fb79){if(_0x43fb79['type']!==_0xc3b1('0x46')){var _0x2208af={};_0x2208af[_0x43fb79[_0xc3b1('0x2f')]]={'$like':'%'+_0xbd71bf['query'][_0xc3b1('0x43')]+'%'};return _0x2208af;}})});}_0x22b7e1=_[_0xc3b1('0x45')]({},_0x22b7e1,_0xbd71bf[_0xc3b1('0x47')]);var _0x501559={'where':_0x22b7e1[_0xc3b1('0x44')]};return db[_0xc3b1('0x33')][_0xc3b1('0x48')](_0x501559)[_0xc3b1('0x2d')](function(_0x14214a){_0x342f76[_0xc3b1('0x48')]=_0x14214a;if(_0xbd71bf[_0xc3b1('0x39')][_0xc3b1('0x49')]){_0x22b7e1[_0xc3b1('0x4a')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xc3b1('0x4b')](_0x22b7e1);})[_0xc3b1('0x2d')](function(_0x23830f){_0x342f76[_0xc3b1('0x4c')]=_0x23830f;return _0x342f76;})[_0xc3b1('0x2d')](respondWithFilteredResult(_0x4e6f15,_0x22b7e1))['catch'](handleError(_0x4e6f15,null));};exports[_0xc3b1('0x4d')]=function(_0x36e986,_0x75e2b0){var _0x3e9048={'raw':![],'where':{'id':_0x36e986[_0xc3b1('0x4e')]['id']}},_0x293fe0={};_0x293fe0[_0xc3b1('0x37')]=_['keys'](db[_0xc3b1('0x33')][_0xc3b1('0x34')]);_0x293fe0[_0xc3b1('0x39')]=_[_0xc3b1('0x38')](_0x36e986[_0xc3b1('0x39')]);_0x293fe0[_0xc3b1('0x4f')]=_[_0xc3b1('0x3b')](_0x293fe0[_0xc3b1('0x37')],_0x293fe0[_0xc3b1('0x39')]);_0x3e9048['attributes']=_[_0xc3b1('0x3b')](_0x293fe0['model'],qs[_0xc3b1('0x50')](_0x36e986['query'][_0xc3b1('0x50')]));_0x3e9048['attributes']=_0x3e9048[_0xc3b1('0x3c')]['length']?_0x3e9048[_0xc3b1('0x3c')]:_0x293fe0['model'];if(_0x36e986['query'][_0xc3b1('0x49')]){_0x3e9048[_0xc3b1('0x4a')]=[{'all':!![]}];}_0x3e9048=_[_0xc3b1('0x45')]({},_0x3e9048,_0x36e986[_0xc3b1('0x47')]);return db[_0xc3b1('0x33')][_0xc3b1('0x51')](_0x3e9048)[_0xc3b1('0x2d')](handleEntityNotFound(_0x75e2b0,null))['then'](respondWithResult(_0x75e2b0,null))[_0xc3b1('0x25')](handleError(_0x75e2b0,null));};exports['create']=function(_0x20048e,_0x520082){return db[_0xc3b1('0x33')][_0xc3b1('0x52')](_0x20048e[_0xc3b1('0x53')],{})['then'](respondWithResult(_0x520082,0xc9))[_0xc3b1('0x25')](handleError(_0x520082,null));};exports[_0xc3b1('0x54')]=function(_0x98be52,_0x39b4b5){if(_0x98be52['body']['id']){delete _0x98be52[_0xc3b1('0x53')]['id'];}return db[_0xc3b1('0x33')][_0xc3b1('0x51')]({'where':{'id':_0x98be52[_0xc3b1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39b4b5,null))[_0xc3b1('0x2d')](saveUpdates(_0x98be52[_0xc3b1('0x53')],null))[_0xc3b1('0x2d')](respondWithResult(_0x39b4b5,null))[_0xc3b1('0x25')](handleError(_0x39b4b5,null));};exports[_0xc3b1('0x55')]=function(_0x4158a0,_0x4e35bf){return db[_0xc3b1('0x33')]['find']({'where':{'id':_0x4158a0[_0xc3b1('0x4e')]['id']}})[_0xc3b1('0x2d')](handleEntityNotFound(_0x4e35bf,null))[_0xc3b1('0x2d')](removeEntity(_0x4e35bf,null))[_0xc3b1('0x25')](handleError(_0x4e35bf,null));};exports[_0xc3b1('0x56')]=function(_0x4bff13,_0x3ccb99,_0xb48174){var _0x278914={};var _0x5aaa92={};var _0x3f276;var _0x2bb082;return db[_0xc3b1('0x33')][_0xc3b1('0x57')]({'where':{'id':_0x4bff13[_0xc3b1('0x4e')]['id']}})[_0xc3b1('0x2d')](handleEntityNotFound(_0x3ccb99,null))['then'](function(_0x30185a){if(_0x30185a){_0x3f276=_0x30185a;_0x5aaa92[_0xc3b1('0x37')]=_[_0xc3b1('0x38')](db[_0xc3b1('0x58')][_0xc3b1('0x34')]);_0x5aaa92[_0xc3b1('0x39')]=_[_0xc3b1('0x38')](_0x4bff13[_0xc3b1('0x39')]);_0x5aaa92[_0xc3b1('0x3a')]=_['intersection'](_0x5aaa92[_0xc3b1('0x37')],_0x5aaa92['query']);_0x278914[_0xc3b1('0x3c')]=_['intersection'](_0x5aaa92[_0xc3b1('0x37')],qs[_0xc3b1('0x50')](_0x4bff13['query']['fields']));_0x278914['attributes']=_0x278914[_0xc3b1('0x3c')][_0xc3b1('0x3d')]?_0x278914[_0xc3b1('0x3c')]:_0x5aaa92[_0xc3b1('0x37')];_0x278914[_0xc3b1('0x59')]=qs[_0xc3b1('0x41')](_0x4bff13['query']['sort']);_0x278914['where']=qs[_0xc3b1('0x3a')](_['pick'](_0x4bff13[_0xc3b1('0x39')],_0x5aaa92['filters']));if(_0x4bff13['query']['filter']){_0x278914[_0xc3b1('0x44')]=_['merge'](_0x278914[_0xc3b1('0x44')],{'$or':_['map'](_0x278914[_0xc3b1('0x3c')],function(_0x5dd3f5){var _0x1e8091={};_0x1e8091[_0x5dd3f5]={'$like':'%'+_0x4bff13['query'][_0xc3b1('0x43')]+'%'};return _0x1e8091;})});}_0x278914=_['merge']({},_0x278914,_0x4bff13[_0xc3b1('0x47')]);return _0x3f276[_0xc3b1('0x56')](_0x278914);}})[_0xc3b1('0x2d')](function(_0x13a12d){if(_0x13a12d){_0x2bb082=_0x13a12d[_0xc3b1('0x3d')];if(!_0x4bff13['query'][_0xc3b1('0x3e')](_0xc3b1('0x3f'))){_0x278914['limit']=qs[_0xc3b1('0x40')](_0x4bff13[_0xc3b1('0x39')][_0xc3b1('0x40')]);_0x278914['offset']=qs['offset'](_0x4bff13[_0xc3b1('0x39')][_0xc3b1('0x2a')]);}return _0x3f276[_0xc3b1('0x56')](_0x278914);}})[_0xc3b1('0x2d')](function(_0x4757d8){if(_0x4757d8){return _0x4757d8?{'count':_0x2bb082,'rows':_0x4757d8}:null;}})[_0xc3b1('0x2d')](respondWithResult(_0x3ccb99,null))['catch'](handleError(_0x3ccb99,null));};exports['getSubjects']=function(_0x36f3c4,_0x49369d,_0x409f85){var _0x1e03b2={};var _0x3838ff={};var _0x105612;var _0x437663;return db[_0xc3b1('0x33')][_0xc3b1('0x57')]({'where':{'id':_0x36f3c4['params']['id']}})[_0xc3b1('0x2d')](handleEntityNotFound(_0x49369d,null))[_0xc3b1('0x2d')](function(_0x164f08){if(_0x164f08){_0x105612=_0x164f08;_0x3838ff[_0xc3b1('0x37')]=_[_0xc3b1('0x38')](db['SalesforceField']['rawAttributes']);_0x3838ff['query']=_['keys'](_0x36f3c4[_0xc3b1('0x39')]);_0x3838ff[_0xc3b1('0x3a')]=_[_0xc3b1('0x3b')](_0x3838ff['model'],_0x3838ff[_0xc3b1('0x39')]);_0x1e03b2['attributes']=_[_0xc3b1('0x3b')](_0x3838ff[_0xc3b1('0x37')],qs[_0xc3b1('0x50')](_0x36f3c4['query']['fields']));_0x1e03b2['attributes']=_0x1e03b2['attributes'][_0xc3b1('0x3d')]?_0x1e03b2[_0xc3b1('0x3c')]:_0x3838ff[_0xc3b1('0x37')];_0x1e03b2[_0xc3b1('0x59')]=qs['sort'](_0x36f3c4['query']['sort']);_0x1e03b2[_0xc3b1('0x44')]=qs[_0xc3b1('0x3a')](_[_0xc3b1('0x42')](_0x36f3c4[_0xc3b1('0x39')],_0x3838ff['filters']));if(_0x36f3c4[_0xc3b1('0x39')]['filter']){_0x1e03b2[_0xc3b1('0x44')]=_[_0xc3b1('0x45')](_0x1e03b2['where'],{'$or':_[_0xc3b1('0x32')](_0x1e03b2[_0xc3b1('0x3c')],function(_0x1e187a){var _0x333bdc={};_0x333bdc[_0x1e187a]={'$like':'%'+_0x36f3c4[_0xc3b1('0x39')][_0xc3b1('0x43')]+'%'};return _0x333bdc;})});}_0x1e03b2=_[_0xc3b1('0x45')]({},_0x1e03b2,_0x36f3c4[_0xc3b1('0x47')]);return _0x105612[_0xc3b1('0x5a')](_0x1e03b2);}})[_0xc3b1('0x2d')](function(_0x1bf3f0){if(_0x1bf3f0){_0x437663=_0x1bf3f0[_0xc3b1('0x3d')];if(!_0x36f3c4[_0xc3b1('0x39')][_0xc3b1('0x3e')](_0xc3b1('0x3f'))){_0x1e03b2['limit']=qs[_0xc3b1('0x40')](_0x36f3c4['query'][_0xc3b1('0x40')]);_0x1e03b2['offset']=qs[_0xc3b1('0x2a')](_0x36f3c4[_0xc3b1('0x39')][_0xc3b1('0x2a')]);}return _0x105612[_0xc3b1('0x5a')](_0x1e03b2);}})['then'](function(_0x2a15cc){if(_0x2a15cc){return _0x2a15cc?{'count':_0x437663,'rows':_0x2a15cc}:null;}})[_0xc3b1('0x2d')](respondWithResult(_0x49369d,null))[_0xc3b1('0x25')](handleError(_0x49369d,null));};exports['getDescriptions']=function(_0x279377,_0x1dc6ea,_0x375468){var _0xf35fc8={};var _0x5118ad={};var _0x2b192c;var _0x4e7afb;return db['SalesforceConfiguration'][_0xc3b1('0x57')]({'where':{'id':_0x279377['params']['id']}})[_0xc3b1('0x2d')](handleEntityNotFound(_0x1dc6ea,null))[_0xc3b1('0x2d')](function(_0x3a7b40){if(_0x3a7b40){_0x2b192c=_0x3a7b40;_0x5118ad[_0xc3b1('0x37')]=_['keys'](db[_0xc3b1('0x58')]['rawAttributes']);_0x5118ad[_0xc3b1('0x39')]=_[_0xc3b1('0x38')](_0x279377[_0xc3b1('0x39')]);_0x5118ad[_0xc3b1('0x3a')]=_[_0xc3b1('0x3b')](_0x5118ad[_0xc3b1('0x37')],_0x5118ad[_0xc3b1('0x39')]);_0xf35fc8[_0xc3b1('0x3c')]=_[_0xc3b1('0x3b')](_0x5118ad[_0xc3b1('0x37')],qs[_0xc3b1('0x50')](_0x279377[_0xc3b1('0x39')]['fields']));_0xf35fc8[_0xc3b1('0x3c')]=_0xf35fc8[_0xc3b1('0x3c')][_0xc3b1('0x3d')]?_0xf35fc8[_0xc3b1('0x3c')]:_0x5118ad[_0xc3b1('0x37')];_0xf35fc8[_0xc3b1('0x59')]=qs[_0xc3b1('0x41')](_0x279377[_0xc3b1('0x39')][_0xc3b1('0x41')]);_0xf35fc8[_0xc3b1('0x44')]=qs[_0xc3b1('0x3a')](_['pick'](_0x279377[_0xc3b1('0x39')],_0x5118ad[_0xc3b1('0x3a')]));if(_0x279377['query'][_0xc3b1('0x43')]){_0xf35fc8['where']=_[_0xc3b1('0x45')](_0xf35fc8[_0xc3b1('0x44')],{'$or':_[_0xc3b1('0x32')](_0xf35fc8['attributes'],function(_0x2c6832){var _0x1609c4={};_0x1609c4[_0x2c6832]={'$like':'%'+_0x279377[_0xc3b1('0x39')]['filter']+'%'};return _0x1609c4;})});}_0xf35fc8=_['merge']({},_0xf35fc8,_0x279377[_0xc3b1('0x47')]);return _0x2b192c['getDescriptions'](_0xf35fc8);}})[_0xc3b1('0x2d')](function(_0xab237f){if(_0xab237f){_0x4e7afb=_0xab237f[_0xc3b1('0x3d')];if(!_0x279377['query'][_0xc3b1('0x3e')](_0xc3b1('0x3f'))){_0xf35fc8[_0xc3b1('0x40')]=qs[_0xc3b1('0x40')](_0x279377['query'][_0xc3b1('0x40')]);_0xf35fc8[_0xc3b1('0x2a')]=qs[_0xc3b1('0x2a')](_0x279377[_0xc3b1('0x39')][_0xc3b1('0x2a')]);}return _0x2b192c[_0xc3b1('0x5b')](_0xf35fc8);}})[_0xc3b1('0x2d')](function(_0x3a28d4){if(_0x3a28d4){return _0x3a28d4?{'count':_0x4e7afb,'rows':_0x3a28d4}:null;}})[_0xc3b1('0x2d')](respondWithResult(_0x1dc6ea,null))[_0xc3b1('0x25')](handleError(_0x1dc6ea,null));}; \ No newline at end of file +var _0x2e12=['catch','create','body','findOne','SalesforceField','getFields','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','filtears','length','includeAll','find'];(function(_0x2d126e,_0x1e8257){var _0xcb04d3=function(_0x19a2d9){while(--_0x19a2d9){_0x2d126e['push'](_0x2d126e['shift']());}};_0xcb04d3(++_0x1e8257);}(_0x2e12,0x179));var _0x22e1=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x2e12[_0x494d1f];return _0x457b6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x22e1('0x0'));var rimraf=require(_0x22e1('0x1'));var zipdir=require(_0x22e1('0x2'));var jsonpatch=require(_0x22e1('0x3'));var rp=require(_0x22e1('0x4'));var moment=require('moment');var BPromise=require(_0x22e1('0x5'));var Mustache=require(_0x22e1('0x6'));var util=require(_0x22e1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x22e1('0x8'));var ejs=require(_0x22e1('0x9'));var fs=require('fs');var _=require(_0x22e1('0xa'));var squel=require(_0x22e1('0xb'));var crypto=require(_0x22e1('0xc'));var jsforce=require(_0x22e1('0xd'));var deskjs=require(_0x22e1('0xe'));var toCsv=require(_0x22e1('0x8'));var querystring=require(_0x22e1('0xf'));var Papa=require(_0x22e1('0x10'));var Redis=require(_0x22e1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22e1('0x12'));var as=require(_0x22e1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x22e1('0x14'))(_0x22e1('0x15'));var utils=require(_0x22e1('0x16'));var config=require(_0x22e1('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x22e1('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5db316,_0x53c45d,_0x247046,_0x4c44fa){return new BPromise(function(_0x3b7082,_0x32f76a){var _0x14a20f=_0x4c44fa||client;return _0x14a20f[_0x22e1('0x19')](_0x5db316,_0x247046)[_0x22e1('0x1a')](function(_0x267e6e){logger[_0x22e1('0x1b')](_0x22e1('0x1c'),_0x53c45d,'request\x20sent');logger[_0x22e1('0x1d')](_0x22e1('0x1e'),_0x53c45d,'request\x20sent',JSON[_0x22e1('0x1f')](_0x267e6e));if(_0x267e6e[_0x22e1('0x20')]){if(_0x267e6e[_0x22e1('0x20')]['code']===0x1f4){logger[_0x22e1('0x20')](_0x22e1('0x1c'),_0x53c45d,_0x267e6e['error'][_0x22e1('0x21')]);return _0x32f76a(_0x267e6e[_0x22e1('0x20')][_0x22e1('0x21')]);}logger['error'](_0x22e1('0x1c'),_0x53c45d,_0x267e6e[_0x22e1('0x20')][_0x22e1('0x21')]);return _0x3b7082(_0x267e6e[_0x22e1('0x20')]['message']);}else{logger[_0x22e1('0x1b')](_0x22e1('0x1c'),_0x53c45d,'request\x20sent');_0x3b7082(_0x267e6e[_0x22e1('0x22')][_0x22e1('0x21')]);}})['catch'](function(_0x41ab9d){logger[_0x22e1('0x20')](_0x22e1('0x1c'),_0x53c45d,_0x41ab9d);_0x32f76a(_0x41ab9d);});});}function respondWithStatusCode(_0x38d0e9,_0x1cec3c){_0x1cec3c=_0x1cec3c||0xcc;return function(_0x2946e6){if(_0x2946e6){return _0x38d0e9['sendStatus'](_0x1cec3c);}return _0x38d0e9[_0x22e1('0x23')](_0x1cec3c)[_0x22e1('0x24')]();};}function respondWithResult(_0x3e2dc0,_0x569a32){_0x569a32=_0x569a32||0xc8;return function(_0x2ab047){if(_0x2ab047){return _0x3e2dc0['status'](_0x569a32)['json'](_0x2ab047);}};}function respondWithFilteredResult(_0x1be318,_0x384b8d){return function(_0x518aa5){if(_0x518aa5){var _0x3f9b76=_0x518aa5['count'],_0x258e0d=_0x384b8d['offset'],_0x39f53c=_0x384b8d[_0x22e1('0x25')]+_0x384b8d[_0x22e1('0x26')],_0x52829b;if(_0x39f53c>=_0x3f9b76){_0x39f53c=_0x3f9b76;_0x52829b=0xc8;}else{_0x52829b=0xce;}_0x1be318[_0x22e1('0x23')](_0x52829b);return _0x1be318[_0x22e1('0x27')](_0x22e1('0x28'),_0x258e0d+'-'+_0x39f53c+'/'+_0x3f9b76)[_0x22e1('0x29')](_0x518aa5);}return null;};}function patchUpdates(_0x20f3a4){return function(_0x15b751){try{jsonpatch[_0x22e1('0x2a')](_0x15b751,_0x20f3a4,!![]);}catch(_0x5db2e7){return BPromise[_0x22e1('0x2b')](_0x5db2e7);}return _0x15b751['save']();};}function saveUpdates(_0x51179c,_0x1b27ff){return function(_0x2865ac){if(_0x2865ac){return _0x2865ac[_0x22e1('0x2c')](_0x51179c)['then'](function(_0x30bf89){return _0x30bf89;});}return null;};}function removeEntity(_0x50a393,_0x592fbe){return function(_0x416987){if(_0x416987){return _0x416987[_0x22e1('0x2d')]()[_0x22e1('0x1a')](function(){_0x50a393['status'](0xcc)[_0x22e1('0x24')]();});}};}function handleEntityNotFound(_0x450429,_0x399336){return function(_0x431741){if(!_0x431741){_0x450429[_0x22e1('0x2e')](0x194);}return _0x431741;};}function handleError(_0x3fe16d,_0xb9c3a7){_0xb9c3a7=_0xb9c3a7||0x1f4;return function(_0x19dbee){logger[_0x22e1('0x20')](_0x19dbee[_0x22e1('0x2f')]);if(_0x19dbee[_0x22e1('0x30')]){delete _0x19dbee[_0x22e1('0x30')];}_0x3fe16d['status'](_0xb9c3a7)[_0x22e1('0x31')](_0x19dbee);};}exports[_0x22e1('0x32')]=function(_0x1f110a,_0x5be42f){var _0x1e0c36={},_0x5baf63={},_0x4cb97e={'count':0x0,'rows':[]};var _0x5055d8=_[_0x22e1('0x33')](db[_0x22e1('0x34')][_0x22e1('0x35')],function(_0x32d516){return{'name':_0x32d516[_0x22e1('0x36')],'type':_0x32d516[_0x22e1('0x37')][_0x22e1('0x38')]};});_0x5baf63['model']=_['map'](_0x5055d8,_0x22e1('0x30'));_0x5baf63[_0x22e1('0x39')]=_['keys'](_0x1f110a[_0x22e1('0x39')]);_0x5baf63[_0x22e1('0x3a')]=_['intersection'](_0x5baf63['model'],_0x5baf63[_0x22e1('0x39')]);_0x1e0c36['attributes']=_[_0x22e1('0x3b')](_0x5baf63[_0x22e1('0x3c')],qs[_0x22e1('0x3d')](_0x1f110a[_0x22e1('0x39')][_0x22e1('0x3d')]));_0x1e0c36[_0x22e1('0x3e')]=_0x1e0c36[_0x22e1('0x3e')]['length']?_0x1e0c36[_0x22e1('0x3e')]:_0x5baf63['model'];if(!_0x1f110a[_0x22e1('0x39')][_0x22e1('0x3f')]('nolimit')){_0x1e0c36[_0x22e1('0x26')]=qs['limit'](_0x1f110a[_0x22e1('0x39')]['limit']);_0x1e0c36['offset']=qs[_0x22e1('0x25')](_0x1f110a['query'][_0x22e1('0x25')]);}_0x1e0c36[_0x22e1('0x40')]=qs[_0x22e1('0x41')](_0x1f110a[_0x22e1('0x39')][_0x22e1('0x41')]);_0x1e0c36[_0x22e1('0x42')]=qs[_0x22e1('0x3a')](_[_0x22e1('0x43')](_0x1f110a[_0x22e1('0x39')],_0x5baf63[_0x22e1('0x3a')]),_0x5055d8);if(_0x1f110a[_0x22e1('0x39')][_0x22e1('0x44')]){_0x1e0c36[_0x22e1('0x42')]=_[_0x22e1('0x45')](_0x1e0c36[_0x22e1('0x42')],{'$or':_['map'](_0x5055d8,function(_0x4143da){if(_0x4143da[_0x22e1('0x37')]!==_0x22e1('0x46')){var _0x1fb9e2={};_0x1fb9e2[_0x4143da['name']]={'$like':'%'+_0x1f110a[_0x22e1('0x39')]['filter']+'%'};return _0x1fb9e2;}})});}_0x1e0c36=_[_0x22e1('0x45')]({},_0x1e0c36,_0x1f110a[_0x22e1('0x47')]);var _0x18dbac={'where':_0x1e0c36['where']};return db[_0x22e1('0x34')][_0x22e1('0x48')](_0x18dbac)[_0x22e1('0x1a')](function(_0x5c6738){_0x4cb97e[_0x22e1('0x48')]=_0x5c6738;if(_0x1f110a['query']['includeAll']){_0x1e0c36[_0x22e1('0x49')]=[{'all':!![]}];}return db[_0x22e1('0x34')][_0x22e1('0x4a')](_0x1e0c36);})[_0x22e1('0x1a')](function(_0x351bfb){_0x4cb97e[_0x22e1('0x4b')]=_0x351bfb;return _0x4cb97e;})[_0x22e1('0x1a')](respondWithFilteredResult(_0x5be42f,_0x1e0c36))['catch'](handleError(_0x5be42f,null));};exports[_0x22e1('0x4c')]=function(_0x226ac6,_0x37132e){var _0x524aa3={'raw':![],'where':{'id':_0x226ac6[_0x22e1('0x4d')]['id']}},_0x26b52a={};_0x26b52a[_0x22e1('0x3c')]=_[_0x22e1('0x4e')](db[_0x22e1('0x34')][_0x22e1('0x35')]);_0x26b52a[_0x22e1('0x39')]=_[_0x22e1('0x4e')](_0x226ac6['query']);_0x26b52a[_0x22e1('0x4f')]=_['intersection'](_0x26b52a[_0x22e1('0x3c')],_0x26b52a['query']);_0x524aa3[_0x22e1('0x3e')]=_[_0x22e1('0x3b')](_0x26b52a['model'],qs[_0x22e1('0x3d')](_0x226ac6[_0x22e1('0x39')][_0x22e1('0x3d')]));_0x524aa3[_0x22e1('0x3e')]=_0x524aa3[_0x22e1('0x3e')][_0x22e1('0x50')]?_0x524aa3[_0x22e1('0x3e')]:_0x26b52a[_0x22e1('0x3c')];if(_0x226ac6['query'][_0x22e1('0x51')]){_0x524aa3[_0x22e1('0x49')]=[{'all':!![]}];}_0x524aa3=_['merge']({},_0x524aa3,_0x226ac6[_0x22e1('0x47')]);return db[_0x22e1('0x34')][_0x22e1('0x52')](_0x524aa3)['then'](handleEntityNotFound(_0x37132e,null))[_0x22e1('0x1a')](respondWithResult(_0x37132e,null))[_0x22e1('0x53')](handleError(_0x37132e,null));};exports['create']=function(_0x12f7c0,_0xe6f748){return db['SalesforceConfiguration'][_0x22e1('0x54')](_0x12f7c0[_0x22e1('0x55')],{})['then'](respondWithResult(_0xe6f748,0xc9))[_0x22e1('0x53')](handleError(_0xe6f748,null));};exports[_0x22e1('0x2c')]=function(_0x130f27,_0x592444){if(_0x130f27[_0x22e1('0x55')]['id']){delete _0x130f27[_0x22e1('0x55')]['id'];}return db['SalesforceConfiguration'][_0x22e1('0x52')]({'where':{'id':_0x130f27[_0x22e1('0x4d')]['id']}})[_0x22e1('0x1a')](handleEntityNotFound(_0x592444,null))[_0x22e1('0x1a')](saveUpdates(_0x130f27['body'],null))['then'](respondWithResult(_0x592444,null))[_0x22e1('0x53')](handleError(_0x592444,null));};exports[_0x22e1('0x2d')]=function(_0x9a7c75,_0x1010ef){return db['SalesforceConfiguration'][_0x22e1('0x52')]({'where':{'id':_0x9a7c75[_0x22e1('0x4d')]['id']}})[_0x22e1('0x1a')](handleEntityNotFound(_0x1010ef,null))[_0x22e1('0x1a')](removeEntity(_0x1010ef,null))[_0x22e1('0x53')](handleError(_0x1010ef,null));};exports['getFields']=function(_0x472654,_0x31eb68,_0x496b21){var _0x23f4f3={};var _0x518cfa={};var _0x4b6ae4;var _0x376ac0;return db[_0x22e1('0x34')][_0x22e1('0x56')]({'where':{'id':_0x472654[_0x22e1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x31eb68,null))[_0x22e1('0x1a')](function(_0x5d65f2){if(_0x5d65f2){_0x4b6ae4=_0x5d65f2;_0x518cfa[_0x22e1('0x3c')]=_['keys'](db[_0x22e1('0x57')]['rawAttributes']);_0x518cfa[_0x22e1('0x39')]=_['keys'](_0x472654[_0x22e1('0x39')]);_0x518cfa[_0x22e1('0x3a')]=_[_0x22e1('0x3b')](_0x518cfa[_0x22e1('0x3c')],_0x518cfa['query']);_0x23f4f3[_0x22e1('0x3e')]=_[_0x22e1('0x3b')](_0x518cfa[_0x22e1('0x3c')],qs[_0x22e1('0x3d')](_0x472654['query'][_0x22e1('0x3d')]));_0x23f4f3[_0x22e1('0x3e')]=_0x23f4f3['attributes'][_0x22e1('0x50')]?_0x23f4f3[_0x22e1('0x3e')]:_0x518cfa[_0x22e1('0x3c')];_0x23f4f3[_0x22e1('0x40')]=qs[_0x22e1('0x41')](_0x472654[_0x22e1('0x39')][_0x22e1('0x41')]);_0x23f4f3[_0x22e1('0x42')]=qs[_0x22e1('0x3a')](_['pick'](_0x472654[_0x22e1('0x39')],_0x518cfa[_0x22e1('0x3a')]));if(_0x472654[_0x22e1('0x39')]['filter']){_0x23f4f3[_0x22e1('0x42')]=_['merge'](_0x23f4f3[_0x22e1('0x42')],{'$or':_[_0x22e1('0x33')](_0x23f4f3[_0x22e1('0x3e')],function(_0x29d6bc){var _0x22e4e2={};_0x22e4e2[_0x29d6bc]={'$like':'%'+_0x472654[_0x22e1('0x39')][_0x22e1('0x44')]+'%'};return _0x22e4e2;})});}_0x23f4f3=_[_0x22e1('0x45')]({},_0x23f4f3,_0x472654[_0x22e1('0x47')]);return _0x4b6ae4[_0x22e1('0x58')](_0x23f4f3);}})['then'](function(_0x2ae7a4){if(_0x2ae7a4){_0x376ac0=_0x2ae7a4['length'];if(!_0x472654[_0x22e1('0x39')]['hasOwnProperty'](_0x22e1('0x59'))){_0x23f4f3[_0x22e1('0x26')]=qs[_0x22e1('0x26')](_0x472654[_0x22e1('0x39')][_0x22e1('0x26')]);_0x23f4f3['offset']=qs[_0x22e1('0x25')](_0x472654[_0x22e1('0x39')][_0x22e1('0x25')]);}return _0x4b6ae4['getFields'](_0x23f4f3);}})[_0x22e1('0x1a')](function(_0x3c48d2){if(_0x3c48d2){return _0x3c48d2?{'count':_0x376ac0,'rows':_0x3c48d2}:null;}})[_0x22e1('0x1a')](respondWithResult(_0x31eb68,null))[_0x22e1('0x53')](handleError(_0x31eb68,null));};exports[_0x22e1('0x5a')]=function(_0xde9f55,_0x1602a4,_0x322ebe){var _0x3f2f4b={};var _0x145ea8={};var _0x4969ff;var _0x1b0c30;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0xde9f55[_0x22e1('0x4d')]['id']}})[_0x22e1('0x1a')](handleEntityNotFound(_0x1602a4,null))[_0x22e1('0x1a')](function(_0x531dcb){if(_0x531dcb){_0x4969ff=_0x531dcb;_0x145ea8[_0x22e1('0x3c')]=_['keys'](db[_0x22e1('0x57')]['rawAttributes']);_0x145ea8[_0x22e1('0x39')]=_[_0x22e1('0x4e')](_0xde9f55[_0x22e1('0x39')]);_0x145ea8[_0x22e1('0x3a')]=_[_0x22e1('0x3b')](_0x145ea8['model'],_0x145ea8[_0x22e1('0x39')]);_0x3f2f4b[_0x22e1('0x3e')]=_[_0x22e1('0x3b')](_0x145ea8[_0x22e1('0x3c')],qs[_0x22e1('0x3d')](_0xde9f55[_0x22e1('0x39')][_0x22e1('0x3d')]));_0x3f2f4b[_0x22e1('0x3e')]=_0x3f2f4b[_0x22e1('0x3e')]['length']?_0x3f2f4b[_0x22e1('0x3e')]:_0x145ea8[_0x22e1('0x3c')];_0x3f2f4b[_0x22e1('0x40')]=qs['sort'](_0xde9f55[_0x22e1('0x39')][_0x22e1('0x41')]);_0x3f2f4b[_0x22e1('0x42')]=qs[_0x22e1('0x3a')](_[_0x22e1('0x43')](_0xde9f55[_0x22e1('0x39')],_0x145ea8[_0x22e1('0x3a')]));if(_0xde9f55[_0x22e1('0x39')][_0x22e1('0x44')]){_0x3f2f4b['where']=_['merge'](_0x3f2f4b[_0x22e1('0x42')],{'$or':_[_0x22e1('0x33')](_0x3f2f4b[_0x22e1('0x3e')],function(_0x2b50cc){var _0x2ef81d={};_0x2ef81d[_0x2b50cc]={'$like':'%'+_0xde9f55['query'][_0x22e1('0x44')]+'%'};return _0x2ef81d;})});}_0x3f2f4b=_[_0x22e1('0x45')]({},_0x3f2f4b,_0xde9f55['options']);return _0x4969ff['getSubjects'](_0x3f2f4b);}})['then'](function(_0x511a8b){if(_0x511a8b){_0x1b0c30=_0x511a8b[_0x22e1('0x50')];if(!_0xde9f55[_0x22e1('0x39')][_0x22e1('0x3f')]('nolimit')){_0x3f2f4b[_0x22e1('0x26')]=qs['limit'](_0xde9f55[_0x22e1('0x39')][_0x22e1('0x26')]);_0x3f2f4b[_0x22e1('0x25')]=qs[_0x22e1('0x25')](_0xde9f55[_0x22e1('0x39')]['offset']);}return _0x4969ff[_0x22e1('0x5a')](_0x3f2f4b);}})[_0x22e1('0x1a')](function(_0xf4ef73){if(_0xf4ef73){return _0xf4ef73?{'count':_0x1b0c30,'rows':_0xf4ef73}:null;}})[_0x22e1('0x1a')](respondWithResult(_0x1602a4,null))[_0x22e1('0x53')](handleError(_0x1602a4,null));};exports[_0x22e1('0x5b')]=function(_0x22af64,_0xadf631,_0x548744){var _0x333b3d={};var _0x4a2cec={};var _0x536ffc;var _0x151f24;return db[_0x22e1('0x34')][_0x22e1('0x56')]({'where':{'id':_0x22af64[_0x22e1('0x4d')]['id']}})[_0x22e1('0x1a')](handleEntityNotFound(_0xadf631,null))['then'](function(_0x35d74d){if(_0x35d74d){_0x536ffc=_0x35d74d;_0x4a2cec['model']=_[_0x22e1('0x4e')](db[_0x22e1('0x57')][_0x22e1('0x35')]);_0x4a2cec[_0x22e1('0x39')]=_['keys'](_0x22af64[_0x22e1('0x39')]);_0x4a2cec[_0x22e1('0x3a')]=_[_0x22e1('0x3b')](_0x4a2cec['model'],_0x4a2cec[_0x22e1('0x39')]);_0x333b3d[_0x22e1('0x3e')]=_[_0x22e1('0x3b')](_0x4a2cec[_0x22e1('0x3c')],qs[_0x22e1('0x3d')](_0x22af64[_0x22e1('0x39')][_0x22e1('0x3d')]));_0x333b3d[_0x22e1('0x3e')]=_0x333b3d['attributes'][_0x22e1('0x50')]?_0x333b3d[_0x22e1('0x3e')]:_0x4a2cec[_0x22e1('0x3c')];_0x333b3d[_0x22e1('0x40')]=qs['sort'](_0x22af64[_0x22e1('0x39')][_0x22e1('0x41')]);_0x333b3d['where']=qs[_0x22e1('0x3a')](_[_0x22e1('0x43')](_0x22af64[_0x22e1('0x39')],_0x4a2cec[_0x22e1('0x3a')]));if(_0x22af64[_0x22e1('0x39')][_0x22e1('0x44')]){_0x333b3d[_0x22e1('0x42')]=_['merge'](_0x333b3d['where'],{'$or':_[_0x22e1('0x33')](_0x333b3d[_0x22e1('0x3e')],function(_0x2f7726){var _0x11690e={};_0x11690e[_0x2f7726]={'$like':'%'+_0x22af64['query'][_0x22e1('0x44')]+'%'};return _0x11690e;})});}_0x333b3d=_['merge']({},_0x333b3d,_0x22af64[_0x22e1('0x47')]);return _0x536ffc[_0x22e1('0x5b')](_0x333b3d);}})['then'](function(_0x113bec){if(_0x113bec){_0x151f24=_0x113bec[_0x22e1('0x50')];if(!_0x22af64[_0x22e1('0x39')][_0x22e1('0x3f')](_0x22e1('0x59'))){_0x333b3d[_0x22e1('0x26')]=qs['limit'](_0x22af64[_0x22e1('0x39')][_0x22e1('0x26')]);_0x333b3d[_0x22e1('0x25')]=qs[_0x22e1('0x25')](_0x22af64[_0x22e1('0x39')][_0x22e1('0x25')]);}return _0x536ffc[_0x22e1('0x5b')](_0x333b3d);}})['then'](function(_0xfd2f58){if(_0xfd2f58){return _0xfd2f58?{'count':_0x151f24,'rows':_0xfd2f58}:null;}})[_0x22e1('0x1a')](respondWithResult(_0xadf631,null))[_0x22e1('0x53')](handleError(_0xadf631,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 6963f8b..0baa2fc 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 _0x1027=['./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2200f8,_0x539ad8){var _0x55be58=function(_0x99c4f1){while(--_0x99c4f1){_0x2200f8['push'](_0x2200f8['shift']());}};_0x55be58(++_0x539ad8);}(_0x1027,0x116));var _0x7102=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x1027[_0x29df9a];return _0x3a8e96;};'use strict';var _=require('lodash');var util=require(_0x7102('0x0'));var logger=require(_0x7102('0x1'))(_0x7102('0x2'));var moment=require(_0x7102('0x3'));var BPromise=require(_0x7102('0x4'));var rp=require(_0x7102('0x5'));var fs=require('fs');var path=require(_0x7102('0x6'));var rimraf=require('rimraf');var config=require(_0x7102('0x7'));var attributes=require(_0x7102('0x8'));module[_0x7102('0x9')]=function(_0x3eacfe,_0x45465e){return _0x3eacfe[_0x7102('0xa')](_0x7102('0xb'),attributes,{'tableName':_0x7102('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff82=['SalesforceConfiguration','int_salesforce_configurations','lodash','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x4c9492,_0x413911){var _0x4dc573=function(_0xc70cb5){while(--_0xc70cb5){_0x4c9492['push'](_0x4c9492['shift']());}};_0x4dc573(++_0x413911);}(_0xff82,0x1c4));var _0x2ff8=function(_0x30e2a9,_0x17dc87){_0x30e2a9=_0x30e2a9-0x0;var _0x4c9781=_0xff82[_0x30e2a9];return _0x4c9781;};'use strict';var _=require(_0x2ff8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2ff8('0x1'));var fs=require('fs');var path=require(_0x2ff8('0x2'));var rimraf=require('rimraf');var config=require(_0x2ff8('0x3'));var attributes=require(_0x2ff8('0x4'));module[_0x2ff8('0x5')]=function(_0x5acc2a,_0x1317f5){return _0x5acc2a[_0x2ff8('0x6')](_0x2ff8('0x7'),attributes,{'tableName':_0x2ff8('0x8'),'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 728cf38..dd1d4f4 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 _0x7f48=['then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x46a727,_0x2f3ad2){var _0x2f774f=function(_0x174bfe){while(--_0x174bfe){_0x46a727['push'](_0x46a727['shift']());}};_0x2f774f(++_0x2f3ad2);}(_0x7f48,0xb1));var _0x87f4=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x7f48[_0x934425];return _0x31d596;};'use strict';var _=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var moment=require(_0x87f4('0x2'));var BPromise=require(_0x87f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87f4('0x4'));var db=require(_0x87f4('0x5'))['db'];var utils=require(_0x87f4('0x6'));var logger=require(_0x87f4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x87f4('0x8'));var client=jayson[_0x87f4('0x9')][_0x87f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a7f6a,_0x3a76a9,_0x433338){return new BPromise(function(_0x27ef38,_0x4ebd66){return client[_0x87f4('0xb')](_0x3a7f6a,_0x433338)[_0x87f4('0xc')](function(_0x9645e4){logger[_0x87f4('0xd')](_0x87f4('0xe'),_0x3a76a9,_0x87f4('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3a76a9,_0x87f4('0xf'),JSON['stringify'](_0x9645e4));if(_0x9645e4[_0x87f4('0x10')]){if(_0x9645e4[_0x87f4('0x10')][_0x87f4('0x11')]===0x1f4){logger[_0x87f4('0x10')](_0x87f4('0xe'),_0x3a76a9,_0x9645e4[_0x87f4('0x10')][_0x87f4('0x12')]);return _0x4ebd66(_0x9645e4[_0x87f4('0x10')][_0x87f4('0x12')]);}logger[_0x87f4('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3a76a9,_0x9645e4[_0x87f4('0x10')][_0x87f4('0x12')]);return _0x27ef38(_0x9645e4[_0x87f4('0x10')]['message']);}else{logger[_0x87f4('0xd')](_0x87f4('0xe'),_0x3a76a9,_0x87f4('0xf'));_0x27ef38(_0x9645e4[_0x87f4('0x13')][_0x87f4('0x12')]);}})[_0x87f4('0x14')](function(_0x20bbe4){logger[_0x87f4('0x10')](_0x87f4('0xe'),_0x3a76a9,_0x20bbe4);_0x4ebd66(_0x20bbe4);});});} \ No newline at end of file +var _0x3cc6=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5645ad,_0x580ea3){var _0x17d292=function(_0xe66902){while(--_0xe66902){_0x5645ad['push'](_0x5645ad['shift']());}};_0x17d292(++_0x580ea3);}(_0x3cc6,0x158));var _0x63cc=function(_0x1d72a9,_0x353b61){_0x1d72a9=_0x1d72a9-0x0;var _0x3e1bfc=_0x3cc6[_0x1d72a9];return _0x3e1bfc;};'use strict';var _=require('lodash');var util=require(_0x63cc('0x0'));var moment=require(_0x63cc('0x1'));var BPromise=require(_0x63cc('0x2'));var rs=require(_0x63cc('0x3'));var fs=require('fs');var Redis=require(_0x63cc('0x4'));var db=require(_0x63cc('0x5'))['db'];var utils=require(_0x63cc('0x6'));var logger=require(_0x63cc('0x7'))(_0x63cc('0x8'));var config=require('../../config/environment');var jayson=require(_0x63cc('0x9'));var client=jayson[_0x63cc('0xa')][_0x63cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x547957,_0x5883a5,_0x46ca0f){return new BPromise(function(_0x965aeb,_0x4f1bdc){return client['request'](_0x547957,_0x46ca0f)['then'](function(_0x47a071){logger[_0x63cc('0xc')](_0x63cc('0xd'),_0x5883a5,_0x63cc('0xe'));logger[_0x63cc('0xf')](_0x63cc('0x10'),_0x5883a5,_0x63cc('0xe'),JSON[_0x63cc('0x11')](_0x47a071));if(_0x47a071[_0x63cc('0x12')]){if(_0x47a071[_0x63cc('0x12')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5883a5,_0x47a071[_0x63cc('0x12')][_0x63cc('0x13')]);return _0x4f1bdc(_0x47a071[_0x63cc('0x12')]['message']);}logger[_0x63cc('0x12')](_0x63cc('0xd'),_0x5883a5,_0x47a071[_0x63cc('0x12')]['message']);return _0x965aeb(_0x47a071[_0x63cc('0x12')][_0x63cc('0x13')]);}else{logger[_0x63cc('0xc')](_0x63cc('0xd'),_0x5883a5,_0x63cc('0xe'));_0x965aeb(_0x47a071['result']['message']);}})['catch'](function(_0x45e8a2){logger[_0x63cc('0x12')](_0x63cc('0xd'),_0x5883a5,_0x45e8a2);_0x4f1bdc(_0x45e8a2);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ac4b2f8..84f3fbf 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 _0xafb9=['get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x14b52f,_0x581404){var _0x4c74e2=function(_0x4540c9){while(--_0x4540c9){_0x14b52f['push'](_0x14b52f['shift']());}};_0x4c74e2(++_0x581404);}(_0xafb9,0x68));var _0x9afb=function(_0x112226,_0x235c2a){_0x112226=_0x112226-0x0;var _0x4b7fdb=_0xafb9[_0x112226];return _0x4b7fdb;};'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'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x9afb('0x9')](),controller['index']);router[_0x9afb('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9afb('0xb')]);router[_0x9afb('0xc')]('/',auth[_0x9afb('0x9')](),controller['create']);router[_0x9afb('0xd')](_0x9afb('0xe'),auth[_0x9afb('0x9')](),controller[_0x9afb('0xf')]);router[_0x9afb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9afb('0x11')]);module[_0x9afb('0x12')]=router; \ No newline at end of file +var _0xe0ae=['../../config/environment','get','/:id','isAuthenticated','show','update','exports','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x1007db,_0x1b8ddc){var _0x37af45=function(_0x338149){while(--_0x338149){_0x1007db['push'](_0x1007db['shift']());}};_0x37af45(++_0x1b8ddc);}(_0xe0ae,0xa1));var _0xee0a=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xe0ae[_0x1b25c1];return _0x1e4447;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xee0a('0x3'));var config=require(_0xee0a('0x4'));var controller=require('./intSalesforceField.controller');router[_0xee0a('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xee0a('0x5')](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller[_0xee0a('0x8')]);router['post']('/',auth[_0xee0a('0x7')](),controller['create']);router['put'](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller[_0xee0a('0x9')]);router['delete'](_0xee0a('0x6'),auth[_0xee0a('0x7')](),controller['destroy']);module[_0xee0a('0xa')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 9e88a4c..8ef3247 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 _0x7c3d=['sequelize','ENUM','string','variable','customVariable','STRING'];(function(_0x4921a9,_0x3167f0){var _0x9c11e4=function(_0x2cce88){while(--_0x2cce88){_0x4921a9['push'](_0x4921a9['shift']());}};_0x9c11e4(++_0x3167f0);}(_0x7c3d,0x8a));var _0xd7c3=function(_0x15a9cb,_0x2c5d45){_0x15a9cb=_0x15a9cb-0x0;var _0x4036e4=_0x7c3d[_0x15a9cb];return _0x4036e4;};'use strict';var Sequelize=require(_0xd7c3('0x0'));module['exports']={'type':{'type':Sequelize[_0xd7c3('0x1')](_0xd7c3('0x2'),_0xd7c3('0x3'),_0xd7c3('0x4'),'keyValue'),'defaultValue':_0xd7c3('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xd7c3('0x2'),_0xd7c3('0x3'),_0xd7c3('0x4'))},'keyContent':{'type':Sequelize[_0xd7c3('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xd7c3('0x5')]}}; \ No newline at end of file +var _0xb4f2=['string','variable','keyValue','STRING','sequelize','exports','ENUM'];(function(_0x3251a5,_0x120d58){var _0x2034fc=function(_0x312684){while(--_0x312684){_0x3251a5['push'](_0x3251a5['shift']());}};_0x2034fc(++_0x120d58);}(_0xb4f2,0x14d));var _0x2b4f=function(_0x4cd260,_0x392e3b){_0x4cd260=_0x4cd260-0x0;var _0x5b00c7=_0xb4f2[_0x4cd260];return _0x5b00c7;};'use strict';var Sequelize=require(_0x2b4f('0x0'));module[_0x2b4f('0x1')]={'type':{'type':Sequelize[_0x2b4f('0x2')](_0x2b4f('0x3'),_0x2b4f('0x4'),'customVariable',_0x2b4f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2b4f('0x6')]},'key':{'type':Sequelize[_0x2b4f('0x6')]},'keyType':{'type':Sequelize[_0x2b4f('0x2')]('string',_0x2b4f('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2b4f('0x6')]},'variableName':{'type':Sequelize[_0x2b4f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6fe6092..a8a0aa7 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 _0xbee3=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','then','destroy','end','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','filtears','find','body','update','eml-format','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x91aa89,_0x54961f){var _0x3592f4=function(_0x1d1412){while(--_0x1d1412){_0x91aa89['push'](_0x91aa89['shift']());}};_0x3592f4(++_0x54961f);}(_0xbee3,0xd5));var _0x3bee=function(_0xf87e58,_0x1b5fd4){_0xf87e58=_0xf87e58-0x0;var _0x38212d=_0xbee3[_0xf87e58];return _0x38212d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3bee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3bee('0x1'));var rp=require(_0x3bee('0x2'));var moment=require('moment');var BPromise=require(_0x3bee('0x3'));var Mustache=require(_0x3bee('0x4'));var util=require(_0x3bee('0x5'));var path=require('path');var sox=require(_0x3bee('0x6'));var csv=require(_0x3bee('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x7'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=_0x346767['count'],_0x2cfba7=_0x558436[_0x3bee('0x1a')],_0x7e763c=_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1b')],_0x57d42c;if(_0x7e763c>=_0x515397){_0x7e763c=_0x515397;_0x57d42c=0xc8;}else{_0x57d42c=0xce;}_0x5b9473[_0x3bee('0x18')](_0x57d42c);return _0x5b9473['set'](_0x3bee('0x1c'),_0x2cfba7+'-'+_0x7e763c+'/'+_0x515397)[_0x3bee('0x19')](_0x346767);}return null;};}function patchUpdates(_0x440644){return function(_0x49b32d){try{jsonpatch[_0x3bee('0x1d')](_0x49b32d,_0x440644,!![]);}catch(_0xa1a004){return BPromise[_0x3bee('0x1e')](_0xa1a004);}return _0x49b32d['save']();};}function saveUpdates(_0x4f36af,_0x1afd0f){return function(_0x30bba2){if(_0x30bba2){return _0x30bba2['update'](_0x4f36af)[_0x3bee('0x1f')](function(_0x44d68e){return _0x44d68e;});}return null;};}function removeEntity(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x20')]()[_0x3bee('0x1f')](function(){_0x2eea75['status'](0xcc)[_0x3bee('0x21')]();});}};}function handleEntityNotFound(_0x1ed0c1,_0x1fed5a){return function(_0x3bb884){if(!_0x3bb884){_0x1ed0c1['sendStatus'](0x194);}return _0x3bb884;};}function handleError(_0x45249c,_0xdcc781){_0xdcc781=_0xdcc781||0x1f4;return function(_0x1e0111){logger['error'](_0x1e0111['stack']);if(_0x1e0111[_0x3bee('0x22')]){delete _0x1e0111[_0x3bee('0x22')];}_0x45249c['status'](_0xdcc781)[_0x3bee('0x23')](_0x1e0111);};}exports[_0x3bee('0x24')]=function(_0x2e666a,_0x5b1eec){var _0x1984c4={},_0x355b64={},_0x150766={'count':0x0,'rows':[]};var _0x4f2066=_[_0x3bee('0x25')](db[_0x3bee('0x26')][_0x3bee('0x27')],function(_0x496abd){return{'name':_0x496abd[_0x3bee('0x28')],'type':_0x496abd[_0x3bee('0x29')][_0x3bee('0x2a')]};});_0x355b64[_0x3bee('0x2b')]=_[_0x3bee('0x25')](_0x4f2066,'name');_0x355b64['query']=_[_0x3bee('0x2c')](_0x2e666a[_0x3bee('0x2d')]);_0x355b64[_0x3bee('0x2e')]=_[_0x3bee('0x2f')](_0x355b64['model'],_0x355b64['query']);_0x1984c4[_0x3bee('0x30')]=_[_0x3bee('0x2f')](_0x355b64['model'],qs['fields'](_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x31')]));_0x1984c4[_0x3bee('0x30')]=_0x1984c4[_0x3bee('0x30')][_0x3bee('0x32')]?_0x1984c4[_0x3bee('0x30')]:_0x355b64[_0x3bee('0x2b')];if(!_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x33')](_0x3bee('0x34'))){_0x1984c4['limit']=qs['limit'](_0x2e666a[_0x3bee('0x2d')]['limit']);_0x1984c4['offset']=qs[_0x3bee('0x1a')](_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x1a')]);}_0x1984c4[_0x3bee('0x35')]=qs[_0x3bee('0x36')](_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x36')]);_0x1984c4[_0x3bee('0x37')]=qs['filters'](_[_0x3bee('0x38')](_0x2e666a[_0x3bee('0x2d')],_0x355b64['filters']),_0x4f2066);if(_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x39')]){_0x1984c4[_0x3bee('0x37')]=_[_0x3bee('0x3a')](_0x1984c4[_0x3bee('0x37')],{'$or':_['map'](_0x4f2066,function(_0x57a895){if(_0x57a895[_0x3bee('0x29')]!==_0x3bee('0x3b')){var _0x59ca12={};_0x59ca12[_0x57a895[_0x3bee('0x22')]]={'$like':'%'+_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x39')]+'%'};return _0x59ca12;}})});}_0x1984c4=_[_0x3bee('0x3a')]({},_0x1984c4,_0x2e666a[_0x3bee('0x3c')]);var _0x2fb349={'where':_0x1984c4[_0x3bee('0x37')]};return db[_0x3bee('0x26')][_0x3bee('0x3d')](_0x2fb349)['then'](function(_0xaceed4){_0x150766[_0x3bee('0x3d')]=_0xaceed4;if(_0x2e666a[_0x3bee('0x2d')][_0x3bee('0x3e')]){_0x1984c4[_0x3bee('0x3f')]=[{'all':!![]}];}return db[_0x3bee('0x26')][_0x3bee('0x40')](_0x1984c4);})[_0x3bee('0x1f')](function(_0x1ed537){_0x150766[_0x3bee('0x41')]=_0x1ed537;return _0x150766;})[_0x3bee('0x1f')](respondWithFilteredResult(_0x5b1eec,_0x1984c4))[_0x3bee('0x42')](handleError(_0x5b1eec,null));};exports[_0x3bee('0x43')]=function(_0x4d16ea,_0x2b773d){var _0x2f30d7={'raw':!![],'where':{'id':_0x4d16ea[_0x3bee('0x44')]['id']}},_0x3f7f88={};_0x3f7f88[_0x3bee('0x2b')]=_[_0x3bee('0x2c')](db[_0x3bee('0x26')][_0x3bee('0x27')]);_0x3f7f88['query']=_[_0x3bee('0x2c')](_0x4d16ea[_0x3bee('0x2d')]);_0x3f7f88[_0x3bee('0x45')]=_['intersection'](_0x3f7f88[_0x3bee('0x2b')],_0x3f7f88['query']);_0x2f30d7[_0x3bee('0x30')]=_['intersection'](_0x3f7f88['model'],qs[_0x3bee('0x31')](_0x4d16ea[_0x3bee('0x2d')][_0x3bee('0x31')]));_0x2f30d7[_0x3bee('0x30')]=_0x2f30d7[_0x3bee('0x30')]['length']?_0x2f30d7['attributes']:_0x3f7f88[_0x3bee('0x2b')];if(_0x4d16ea['query'][_0x3bee('0x3e')]){_0x2f30d7['include']=[{'all':!![]}];}_0x2f30d7=_[_0x3bee('0x3a')]({},_0x2f30d7,_0x4d16ea['options']);return db[_0x3bee('0x26')][_0x3bee('0x46')](_0x2f30d7)[_0x3bee('0x1f')](handleEntityNotFound(_0x2b773d,null))[_0x3bee('0x1f')](respondWithResult(_0x2b773d,null))['catch'](handleError(_0x2b773d,null));};exports['create']=function(_0x44bcfb,_0x541777){return db['SalesforceField']['create'](_0x44bcfb[_0x3bee('0x47')],{})['then'](respondWithResult(_0x541777,0xc9))[_0x3bee('0x42')](handleError(_0x541777,null));};exports[_0x3bee('0x48')]=function(_0xd87fd2,_0x593427){if(_0xd87fd2[_0x3bee('0x47')]['id']){delete _0xd87fd2['body']['id'];}return db[_0x3bee('0x26')]['find']({'where':{'id':_0xd87fd2[_0x3bee('0x44')]['id']}})[_0x3bee('0x1f')](handleEntityNotFound(_0x593427,null))[_0x3bee('0x1f')](saveUpdates(_0xd87fd2['body'],null))[_0x3bee('0x1f')](respondWithResult(_0x593427,null))[_0x3bee('0x42')](handleError(_0x593427,null));};exports[_0x3bee('0x20')]=function(_0x504382,_0x479d7f){return db[_0x3bee('0x26')][_0x3bee('0x46')]({'where':{'id':_0x504382[_0x3bee('0x44')]['id']}})[_0x3bee('0x1f')](handleEntityNotFound(_0x479d7f,null))[_0x3bee('0x1f')](removeEntity(_0x479d7f,null))[_0x3bee('0x42')](handleError(_0x479d7f,null));}; \ No newline at end of file +var _0xbdb7=['VIRTUAL','then','includeAll','include','findAll','catch','show','params','filtears','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','limit','status','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge'];(function(_0x222522,_0x531e5a){var _0x464a6a=function(_0x354ef1){while(--_0x354ef1){_0x222522['push'](_0x222522['shift']());}};_0x464a6a(++_0x531e5a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3f9024,_0x48d0e5){_0x3f9024=_0x3f9024-0x0;var _0x3c931c=_0xbdb7[_0x3f9024];return _0x3c931c;};'use strict';var pdf=require(_0x7bdb('0x0'));var emlformat=require(_0x7bdb('0x1'));var rimraf=require(_0x7bdb('0x2'));var zipdir=require(_0x7bdb('0x3'));var jsonpatch=require(_0x7bdb('0x4'));var rp=require(_0x7bdb('0x5'));var moment=require(_0x7bdb('0x6'));var BPromise=require(_0x7bdb('0x7'));var Mustache=require(_0x7bdb('0x8'));var util=require('util');var path=require(_0x7bdb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7bdb('0xa'));var fs=require('fs');var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=_0x25d417['count'],_0xbde12a=_0xe9919f[_0x7bdb('0x19')],_0x3e96ac=_0xe9919f[_0x7bdb('0x19')]+_0xe9919f[_0x7bdb('0x1a')],_0x1b2d9b;if(_0x3e96ac>=_0x31c909){_0x3e96ac=_0x31c909;_0x1b2d9b=0xc8;}else{_0x1b2d9b=0xce;}_0x195b2e[_0x7bdb('0x1b')](_0x1b2d9b);return _0x195b2e['set'](_0x7bdb('0x1c'),_0xbde12a+'-'+_0x3e96ac+'/'+_0x31c909)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5b8481){return function(_0x3e5f8e){try{jsonpatch[_0x7bdb('0x1d')](_0x3e5f8e,_0x5b8481,!![]);}catch(_0x9143e8){return BPromise[_0x7bdb('0x1e')](_0x9143e8);}return _0x3e5f8e[_0x7bdb('0x1f')]();};}function saveUpdates(_0x5bfc35,_0x49f353){return function(_0x677825){if(_0x677825){return _0x677825[_0x7bdb('0x20')](_0x5bfc35)['then'](function(_0x341fe4){return _0x341fe4;});}return null;};}function removeEntity(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x21')]()['then'](function(){_0x118ea1[_0x7bdb('0x1b')](0xcc)[_0x7bdb('0x17')]();});}};}function handleEntityNotFound(_0x40c447,_0x3a456f){return function(_0x481f4b){if(!_0x481f4b){_0x40c447['sendStatus'](0x194);}return _0x481f4b;};}function handleError(_0x3c423f,_0x5eface){_0x5eface=_0x5eface||0x1f4;return function(_0x47abaf){logger['error'](_0x47abaf[_0x7bdb('0x22')]);if(_0x47abaf['name']){delete _0x47abaf[_0x7bdb('0x23')];}_0x3c423f[_0x7bdb('0x1b')](_0x5eface)[_0x7bdb('0x24')](_0x47abaf);};}exports[_0x7bdb('0x25')]=function(_0x2a494e,_0x523869){var _0x10e818={},_0x32242d={},_0x399b62={'count':0x0,'rows':[]};var _0xe1141d=_[_0x7bdb('0x26')](db[_0x7bdb('0x27')][_0x7bdb('0x28')],function(_0xd2d7be){return{'name':_0xd2d7be[_0x7bdb('0x29')],'type':_0xd2d7be[_0x7bdb('0x2a')][_0x7bdb('0x2b')]};});_0x32242d[_0x7bdb('0x2c')]=_['map'](_0xe1141d,_0x7bdb('0x23'));_0x32242d[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0x2a494e[_0x7bdb('0x2d')]);_0x32242d[_0x7bdb('0x2f')]=_['intersection'](_0x32242d[_0x7bdb('0x2c')],_0x32242d[_0x7bdb('0x2d')]);_0x10e818[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x32242d['model'],qs['fields'](_0x2a494e['query'][_0x7bdb('0x32')]));_0x10e818['attributes']=_0x10e818[_0x7bdb('0x30')]['length']?_0x10e818[_0x7bdb('0x30')]:_0x32242d[_0x7bdb('0x2c')];if(!_0x2a494e[_0x7bdb('0x2d')]['hasOwnProperty'](_0x7bdb('0x33'))){_0x10e818['limit']=qs['limit'](_0x2a494e[_0x7bdb('0x2d')]['limit']);_0x10e818[_0x7bdb('0x19')]=qs['offset'](_0x2a494e['query'][_0x7bdb('0x19')]);}_0x10e818[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x2a494e[_0x7bdb('0x2d')][_0x7bdb('0x35')]);_0x10e818[_0x7bdb('0x36')]=qs['filters'](_[_0x7bdb('0x37')](_0x2a494e[_0x7bdb('0x2d')],_0x32242d[_0x7bdb('0x2f')]),_0xe1141d);if(_0x2a494e[_0x7bdb('0x2d')][_0x7bdb('0x38')]){_0x10e818[_0x7bdb('0x36')]=_[_0x7bdb('0x39')](_0x10e818[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x26')](_0xe1141d,function(_0x4e1c97){if(_0x4e1c97['type']!==_0x7bdb('0x3a')){var _0x31af6f={};_0x31af6f[_0x4e1c97[_0x7bdb('0x23')]]={'$like':'%'+_0x2a494e[_0x7bdb('0x2d')][_0x7bdb('0x38')]+'%'};return _0x31af6f;}})});}_0x10e818=_['merge']({},_0x10e818,_0x2a494e['options']);var _0x27164f={'where':_0x10e818['where']};return db[_0x7bdb('0x27')]['count'](_0x27164f)[_0x7bdb('0x3b')](function(_0x5d1826){_0x399b62['count']=_0x5d1826;if(_0x2a494e[_0x7bdb('0x2d')][_0x7bdb('0x3c')]){_0x10e818[_0x7bdb('0x3d')]=[{'all':!![]}];}return db[_0x7bdb('0x27')][_0x7bdb('0x3e')](_0x10e818);})[_0x7bdb('0x3b')](function(_0x2e10f3){_0x399b62['rows']=_0x2e10f3;return _0x399b62;})['then'](respondWithFilteredResult(_0x523869,_0x10e818))[_0x7bdb('0x3f')](handleError(_0x523869,null));};exports[_0x7bdb('0x40')]=function(_0x2dbb43,_0x3509e4){var _0x39fbca={'raw':!![],'where':{'id':_0x2dbb43[_0x7bdb('0x41')]['id']}},_0x1824c6={};_0x1824c6['model']=_['keys'](db[_0x7bdb('0x27')][_0x7bdb('0x28')]);_0x1824c6[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0x2dbb43['query']);_0x1824c6[_0x7bdb('0x42')]=_['intersection'](_0x1824c6[_0x7bdb('0x2c')],_0x1824c6[_0x7bdb('0x2d')]);_0x39fbca[_0x7bdb('0x30')]=_[_0x7bdb('0x31')](_0x1824c6[_0x7bdb('0x2c')],qs[_0x7bdb('0x32')](_0x2dbb43[_0x7bdb('0x2d')][_0x7bdb('0x32')]));_0x39fbca[_0x7bdb('0x30')]=_0x39fbca['attributes'][_0x7bdb('0x43')]?_0x39fbca[_0x7bdb('0x30')]:_0x1824c6['model'];if(_0x2dbb43[_0x7bdb('0x2d')]['includeAll']){_0x39fbca[_0x7bdb('0x3d')]=[{'all':!![]}];}_0x39fbca=_[_0x7bdb('0x39')]({},_0x39fbca,_0x2dbb43[_0x7bdb('0x44')]);return db[_0x7bdb('0x27')][_0x7bdb('0x45')](_0x39fbca)['then'](handleEntityNotFound(_0x3509e4,null))[_0x7bdb('0x3b')](respondWithResult(_0x3509e4,null))[_0x7bdb('0x3f')](handleError(_0x3509e4,null));};exports[_0x7bdb('0x46')]=function(_0x3eda2e,_0x31244f){return db['SalesforceField'][_0x7bdb('0x46')](_0x3eda2e[_0x7bdb('0x47')],{})[_0x7bdb('0x3b')](respondWithResult(_0x31244f,0xc9))[_0x7bdb('0x3f')](handleError(_0x31244f,null));};exports[_0x7bdb('0x20')]=function(_0x25c534,_0x1895b6){if(_0x25c534[_0x7bdb('0x47')]['id']){delete _0x25c534[_0x7bdb('0x47')]['id'];}return db[_0x7bdb('0x27')]['find']({'where':{'id':_0x25c534[_0x7bdb('0x41')]['id']}})['then'](handleEntityNotFound(_0x1895b6,null))['then'](saveUpdates(_0x25c534[_0x7bdb('0x47')],null))[_0x7bdb('0x3b')](respondWithResult(_0x1895b6,null))['catch'](handleError(_0x1895b6,null));};exports[_0x7bdb('0x21')]=function(_0x186809,_0x5ea9ef){return db['SalesforceField']['find']({'where':{'id':_0x186809[_0x7bdb('0x41')]['id']}})[_0x7bdb('0x3b')](handleEntityNotFound(_0x5ea9ef,null))[_0x7bdb('0x3b')](removeEntity(_0x5ea9ef,null))[_0x7bdb('0x3f')](handleError(_0x5ea9ef,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d2b3611..a288f16 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 _0x6e34=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4c5a87,_0x40cef1){var _0x587305=function(_0x128cd6){while(--_0x128cd6){_0x4c5a87['push'](_0x4c5a87['shift']());}};_0x587305(++_0x40cef1);}(_0x6e34,0x159));var _0x46e3=function(_0x57212f,_0xac4715){_0x57212f=_0x57212f-0x0;var _0xd46bdf=_0x6e34[_0x57212f];return _0xd46bdf;};'use strict';var _=require(_0x46e3('0x0'));var util=require(_0x46e3('0x1'));var logger=require(_0x46e3('0x2'))(_0x46e3('0x3'));var moment=require('moment');var BPromise=require(_0x46e3('0x4'));var rp=require(_0x46e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x46e3('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x46e3('0x7')]=function(_0x1e16a7,_0x505fc9){return _0x1e16a7[_0x46e3('0x8')](_0x46e3('0x9'),attributes,{'tableName':_0x46e3('0xa'),'paranoid':![],'indexes':[{'name':_0x46e3('0xb'),'fields':['idField',_0x46e3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3e44=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField'];(function(_0x460850,_0x49e5d4){var _0x165a6f=function(_0x1a5c6b){while(--_0x1a5c6b){_0x460850['push'](_0x460850['shift']());}};_0x165a6f(++_0x49e5d4);}(_0x3e44,0xd8));var _0x43e4=function(_0x142e7b,_0x4cc20c){_0x142e7b=_0x142e7b-0x0;var _0x5c823e=_0x3e44[_0x142e7b];return _0x5c823e;};'use strict';var _=require(_0x43e4('0x0'));var util=require('util');var logger=require(_0x43e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x43e4('0x2'));var rp=require(_0x43e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43e4('0x4'));var config=require(_0x43e4('0x5'));var attributes=require('./intSalesforceField.attributes');module[_0x43e4('0x6')]=function(_0x19cbb8,_0x190d4c){return _0x19cbb8[_0x43e4('0x7')](_0x43e4('0x8'),attributes,{'tableName':_0x43e4('0x9'),'paranoid':![],'indexes':[{'name':_0x43e4('0xa'),'fields':[_0x43e4('0xb'),'FieldId'],'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 007d1cd..b0316b9 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 _0xb688=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x370a84,_0xfc61f0){var _0x39d0fa=function(_0x5a99b8){while(--_0x5a99b8){_0x370a84['push'](_0x370a84['shift']());}};_0x39d0fa(++_0xfc61f0);}(_0xb688,0xcf));var _0x8b68=function(_0x58191e,_0x7f264c){_0x58191e=_0x58191e-0x0;var _0x1e56de=_0xb688[_0x58191e];return _0x1e56de;};'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')]('SalesforceField,\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);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x99778e,_0x2e288b){var _0x3a4033=function(_0x5524dc){while(--_0x5524dc){_0x99778e['push'](_0x99778e['shift']());}};_0x3a4033(++_0x2e288b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x27e1ff,_0x3a997c){_0x27e1ff=_0x27e1ff-0x0;var _0x44df8a=_0xb43b[_0x27e1ff];return _0x44df8a;};'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')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceField,\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 diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9e2f02d..f1cb486 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 _0x6b1d=['./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1c0a33,_0x33d6bb){var _0x3b00a5=function(_0x5bf211){while(--_0x5bf211){_0x1c0a33['push'](_0x1c0a33['shift']());}};_0x3b00a5(++_0x33d6bb);}(_0x6b1d,0xc9));var _0xd6b1=function(_0xaeff8a,_0x506724){_0xaeff8a=_0xaeff8a-0x0;var _0x8a6ce3=_0x6b1d[_0xaeff8a];return _0x8a6ce3;};'use strict';var multer=require('multer');var util=require(_0xd6b1('0x0'));var path=require('path');var timeout=require(_0xd6b1('0x1'));var express=require(_0xd6b1('0x2'));var router=express[_0xd6b1('0x3')]();var auth=require(_0xd6b1('0x4'));var interaction=require(_0xd6b1('0x5'));var config=require('../../config/environment');var controller=require(_0xd6b1('0x6'));router['get']('/',auth[_0xd6b1('0x7')](),controller[_0xd6b1('0x8')]);router[_0xd6b1('0x9')](_0xd6b1('0xa'),auth[_0xd6b1('0x7')](),controller[_0xd6b1('0xb')]);router[_0xd6b1('0x9')]('/:id/configurations',auth[_0xd6b1('0x7')](),controller[_0xd6b1('0xc')]);router['get']('/:id/fields',auth[_0xd6b1('0x7')](),controller[_0xd6b1('0xd')]);router['post']('/',auth[_0xd6b1('0x7')](),controller[_0xd6b1('0xe')]);router[_0xd6b1('0xf')](_0xd6b1('0x10'),auth[_0xd6b1('0x7')](),controller[_0xd6b1('0x11')]);router[_0xd6b1('0x12')](_0xd6b1('0xa'),auth[_0xd6b1('0x7')](),controller[_0xd6b1('0x13')]);router[_0xd6b1('0x14')]('/:id',auth[_0xd6b1('0x7')](),controller[_0xd6b1('0x15')]);module[_0xd6b1('0x16')]=router; \ No newline at end of file +var _0xb734=['express','Router','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x4b1e31,_0x4f0e49){var _0x36b221=function(_0x5eb155){while(--_0x5eb155){_0x4b1e31['push'](_0x4b1e31['shift']());}};_0x36b221(++_0x4f0e49);}(_0xb734,0xe3));var _0x4b73=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xb734[_0x35c5a8];return _0x34782c;};'use strict';var multer=require(_0x4b73('0x0'));var util=require(_0x4b73('0x1'));var path=require(_0x4b73('0x2'));var timeout=require(_0x4b73('0x3'));var express=require(_0x4b73('0x4'));var router=express[_0x4b73('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b73('0x6'));router[_0x4b73('0x7')]('/',auth[_0x4b73('0x8')](),controller[_0x4b73('0x9')]);router[_0x4b73('0x7')](_0x4b73('0xa'),auth[_0x4b73('0x8')](),controller['show']);router[_0x4b73('0x7')](_0x4b73('0xb'),auth['isAuthenticated'](),controller[_0x4b73('0xc')]);router['get'](_0x4b73('0xd'),auth[_0x4b73('0x8')](),controller['getFields']);router[_0x4b73('0xe')]('/',auth[_0x4b73('0x8')](),controller[_0x4b73('0xf')]);router[_0x4b73('0xe')](_0x4b73('0xb'),auth[_0x4b73('0x8')](),controller[_0x4b73('0x10')]);router[_0x4b73('0x11')](_0x4b73('0xa'),auth[_0x4b73('0x8')](),controller[_0x4b73('0x12')]);router[_0x4b73('0x13')]('/:id',auth[_0x4b73('0x8')](),controller[_0x4b73('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d96e5d0..40d45a9 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 _0xe7eb=['remoteUri','sequelize','STRING'];(function(_0x1163c3,_0x3aedc6){var _0x7a7cb5=function(_0x2e4054){while(--_0x2e4054){_0x1163c3['push'](_0x1163c3['shift']());}};_0x7a7cb5(++_0x3aedc6);}(_0xe7eb,0x151));var _0xbe7e=function(_0x4b85aa,_0x533add){_0x4b85aa=_0x4b85aa-0x0;var _0x577408=_0xe7eb[_0x4b85aa];return _0x577408;};'use strict';var Sequelize=require(_0xbe7e('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe7e('0x1')]},'description':{'type':Sequelize[_0xbe7e('0x1')]},'username':{'type':Sequelize[_0xbe7e('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xbe7e('0x1')]},'email':{'type':Sequelize[_0xbe7e('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xbe7e('0x2')},'serverUrl':{'type':Sequelize[_0xbe7e('0x1')]}}; \ No newline at end of file +var _0x2ffb=['sequelize','exports','STRING','remoteUri'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ffb,0x148));var _0xb2ff=function(_0x44a3e1,_0x4084b4){_0x44a3e1=_0x44a3e1-0x0;var _0x493faa=_0x2ffb[_0x44a3e1];return _0x493faa;};'use strict';var Sequelize=require(_0xb2ff('0x0'));module[_0xb2ff('0x1')]={'name':{'type':Sequelize[_0xb2ff('0x2')]},'description':{'type':Sequelize[_0xb2ff('0x2')]},'username':{'type':Sequelize[_0xb2ff('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xb2ff('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb2ff('0x2')],'unique':_0xb2ff('0x3')},'serverUrl':{'type':Sequelize[_0xb2ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 388476a..a6a2545 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 _0xa45b=['serverUrl','slice','substring','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','forEach','all','TCL:\x20_object','log','internalType','push','concat','test','Wrong\x20credentials','statusCode','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','label','value','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','name','send','ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','filtears','include','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','length','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','made_sla','hold_reason','subcategory','close_code','incident_state','severity','category','parent','watch_list','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','state','sys_created_by','knowledge','calendar_stc','closed_at','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','problem_id','company','reassignment_count','assigned_to','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri'];(function(_0x43128b,_0x3565ab){var _0x44b6be=function(_0x3fc8ba){while(--_0x3fc8ba){_0x43128b['push'](_0x43128b['shift']());}};_0x44b6be(++_0x3565ab);}(_0xa45b,0x199));var _0xba45=function(_0x4790a3,_0x1dc623){_0x4790a3=_0x4790a3-0x0;var _0x4eccbd=_0xa45b[_0x4790a3];return _0x4eccbd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba45('0x0'));var rimraf=require(_0xba45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba45('0x2'));var BPromise=require(_0xba45('0x3'));var Mustache=require(_0xba45('0x4'));var util=require(_0xba45('0x5'));var path=require('path');var sox=require(_0xba45('0x6'));var csv=require(_0xba45('0x7'));var ejs=require(_0xba45('0x8'));var fs=require('fs');var _=require(_0xba45('0x9'));var squel=require(_0xba45('0xa'));var crypto=require(_0xba45('0xb'));var jsforce=require(_0xba45('0xc'));var deskjs=require(_0xba45('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba45('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xba45('0xf'));var hardwareService=require(_0xba45('0x10'));var logger=require('../../config/logger')(_0xba45('0x11'));var utils=require(_0xba45('0x12'));var config=require(_0xba45('0x13'));var licenseUtil=require(_0xba45('0x14'));var db=require(_0xba45('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xba45('0x16'));var client=jayson[_0xba45('0x17')][_0xba45('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x10426d,_0x55c102,_0x4d78c8,_0x4d2ec5){return new BPromise(function(_0x1972d7,_0x13a8fb){var _0x303214=_0x4d2ec5||client;return _0x303214[_0xba45('0x19')](_0x10426d,_0x4d78c8)[_0xba45('0x1a')](function(_0x13f291){logger[_0xba45('0x1b')](_0xba45('0x1c'),_0x55c102,_0xba45('0x1d'));logger[_0xba45('0x1e')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x55c102,_0xba45('0x1d'),JSON[_0xba45('0x1f')](_0x13f291));if(_0x13f291[_0xba45('0x20')]){if(_0x13f291[_0xba45('0x20')]['code']===0x1f4){logger[_0xba45('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x55c102,_0x13f291[_0xba45('0x20')][_0xba45('0x21')]);return _0x13a8fb(_0x13f291[_0xba45('0x20')][_0xba45('0x21')]);}logger[_0xba45('0x20')](_0xba45('0x1c'),_0x55c102,_0x13f291['error'][_0xba45('0x21')]);return _0x1972d7(_0x13f291[_0xba45('0x20')]['message']);}else{logger[_0xba45('0x1b')](_0xba45('0x1c'),_0x55c102,_0xba45('0x1d'));_0x1972d7(_0x13f291[_0xba45('0x22')][_0xba45('0x21')]);}})[_0xba45('0x23')](function(_0x116934){logger[_0xba45('0x20')](_0xba45('0x1c'),_0x55c102,_0x116934);_0x13a8fb(_0x116934);});});}function respondWithStatusCode(_0x274f1b,_0x5e840e){_0x5e840e=_0x5e840e||0xcc;return function(_0x4dca68){if(_0x4dca68){return _0x274f1b['sendStatus'](_0x5e840e);}return _0x274f1b[_0xba45('0x24')](_0x5e840e)[_0xba45('0x25')]();};}function respondWithResult(_0x346ef0,_0x2efbe4){_0x2efbe4=_0x2efbe4||0xc8;return function(_0x2c17df){if(_0x2c17df){return _0x346ef0[_0xba45('0x24')](_0x2efbe4)['json'](_0x2c17df);}};}function respondWithFilteredResult(_0xe0f621,_0x373390){return function(_0x3f90ea){if(_0x3f90ea){var _0x508fcd=_0x3f90ea[_0xba45('0x26')],_0x52e9e7=_0x373390[_0xba45('0x27')],_0x541db4=_0x373390[_0xba45('0x27')]+_0x373390[_0xba45('0x28')],_0x494cef;if(_0x541db4>=_0x508fcd){_0x541db4=_0x508fcd;_0x494cef=0xc8;}else{_0x494cef=0xce;}_0xe0f621['status'](_0x494cef);return _0xe0f621[_0xba45('0x29')](_0xba45('0x2a'),_0x52e9e7+'-'+_0x541db4+'/'+_0x508fcd)['json'](_0x3f90ea);}return null;};}function patchUpdates(_0x560adf){return function(_0x2546ef){try{jsonpatch[_0xba45('0x2b')](_0x2546ef,_0x560adf,!![]);}catch(_0x9d7bd3){return BPromise[_0xba45('0x2c')](_0x9d7bd3);}return _0x2546ef[_0xba45('0x2d')]();};}function saveUpdates(_0x4a5a19,_0x7e284a){return function(_0x2e7af1){if(_0x2e7af1){return _0x2e7af1[_0xba45('0x2e')](_0x4a5a19)[_0xba45('0x1a')](function(_0x145236){return _0x145236;});}return null;};}function removeEntity(_0x35f2f4,_0x273a3d){return function(_0x24cb6f){if(_0x24cb6f){return _0x24cb6f['destroy']()[_0xba45('0x1a')](function(){_0x35f2f4[_0xba45('0x24')](0xcc)[_0xba45('0x25')]();});}};}function handleEntityNotFound(_0x2c62c3,_0x4ed61a){return function(_0x30d1f2){if(!_0x30d1f2){_0x2c62c3['sendStatus'](0x194);}return _0x30d1f2;};}function handleError(_0x1ac2f0,_0x1079a8){_0x1079a8=_0x1079a8||0x1f4;return function(_0x280bf8){logger[_0xba45('0x20')](_0x280bf8['stack']);if(_0x280bf8[_0xba45('0x2f')]){delete _0x280bf8[_0xba45('0x2f')];}_0x1ac2f0['status'](_0x1079a8)[_0xba45('0x30')](_0x280bf8);};}exports['index']=function(_0x960529,_0x6b540){var _0x4b8010={},_0x24b5df={},_0x1b5e26={'count':0x0,'rows':[]};var _0x27992d=_['map'](db[_0xba45('0x31')][_0xba45('0x32')],function(_0x56ff17){return{'name':_0x56ff17[_0xba45('0x33')],'type':_0x56ff17[_0xba45('0x34')][_0xba45('0x35')]};});_0x24b5df[_0xba45('0x36')]=_[_0xba45('0x37')](_0x27992d,_0xba45('0x2f'));_0x24b5df[_0xba45('0x38')]=_[_0xba45('0x39')](_0x960529[_0xba45('0x38')]);_0x24b5df[_0xba45('0x3a')]=_['intersection'](_0x24b5df[_0xba45('0x36')],_0x24b5df['query']);_0x4b8010[_0xba45('0x3b')]=_[_0xba45('0x3c')](_0x24b5df[_0xba45('0x36')],qs[_0xba45('0x3d')](_0x960529[_0xba45('0x38')][_0xba45('0x3d')]));_0x4b8010['attributes']=_0x4b8010[_0xba45('0x3b')]['length']?_0x4b8010[_0xba45('0x3b')]:_0x24b5df[_0xba45('0x36')];if(!_0x960529[_0xba45('0x38')][_0xba45('0x3e')](_0xba45('0x3f'))){_0x4b8010[_0xba45('0x28')]=qs[_0xba45('0x28')](_0x960529['query'][_0xba45('0x28')]);_0x4b8010[_0xba45('0x27')]=qs[_0xba45('0x27')](_0x960529['query'][_0xba45('0x27')]);}_0x4b8010[_0xba45('0x40')]=qs[_0xba45('0x41')](_0x960529[_0xba45('0x38')]['sort']);_0x4b8010[_0xba45('0x42')]=qs[_0xba45('0x3a')](_[_0xba45('0x43')](_0x960529[_0xba45('0x38')],_0x24b5df[_0xba45('0x3a')]),_0x27992d);if(_0x960529[_0xba45('0x38')][_0xba45('0x44')]){_0x4b8010[_0xba45('0x42')]=_[_0xba45('0x45')](_0x4b8010['where'],{'$or':_[_0xba45('0x37')](_0x27992d,function(_0x3fea97){if(_0x3fea97[_0xba45('0x34')]!==_0xba45('0x46')){var _0x1f00c6={};_0x1f00c6[_0x3fea97[_0xba45('0x2f')]]={'$like':'%'+_0x960529[_0xba45('0x38')][_0xba45('0x44')]+'%'};return _0x1f00c6;}})});}_0x4b8010=_[_0xba45('0x45')]({},_0x4b8010,_0x960529[_0xba45('0x47')]);var _0x593d5f={'where':_0x4b8010['where']};return db[_0xba45('0x31')][_0xba45('0x26')](_0x593d5f)[_0xba45('0x1a')](function(_0x3559c4){_0x1b5e26[_0xba45('0x26')]=_0x3559c4;if(_0x960529['query'][_0xba45('0x48')]){_0x4b8010['include']=[{'all':!![]}];}return db[_0xba45('0x31')][_0xba45('0x49')](_0x4b8010);})[_0xba45('0x1a')](function(_0x24746c){_0x1b5e26[_0xba45('0x4a')]=_0x24746c;return _0x1b5e26;})[_0xba45('0x1a')](respondWithFilteredResult(_0x6b540,_0x4b8010))['catch'](handleError(_0x6b540,null));};exports[_0xba45('0x4b')]=function(_0x43b081,_0x43d785){var _0x3fcd32={'raw':![],'where':{'id':_0x43b081[_0xba45('0x4c')]['id']}},_0x1f3b10={};_0x1f3b10[_0xba45('0x36')]=_['keys'](db[_0xba45('0x31')][_0xba45('0x32')]);_0x1f3b10['query']=_[_0xba45('0x39')](_0x43b081[_0xba45('0x38')]);_0x1f3b10[_0xba45('0x4d')]=_['intersection'](_0x1f3b10[_0xba45('0x36')],_0x1f3b10['query']);_0x3fcd32[_0xba45('0x3b')]=_['intersection'](_0x1f3b10[_0xba45('0x36')],qs[_0xba45('0x3d')](_0x43b081['query']['fields']));_0x3fcd32[_0xba45('0x3b')]=_0x3fcd32[_0xba45('0x3b')]['length']?_0x3fcd32['attributes']:_0x1f3b10[_0xba45('0x36')];if(_0x43b081[_0xba45('0x38')][_0xba45('0x48')]){_0x3fcd32[_0xba45('0x4e')]=[{'all':!![]}];}_0x3fcd32=_[_0xba45('0x45')]({},_0x3fcd32,_0x43b081[_0xba45('0x47')]);return db[_0xba45('0x31')][_0xba45('0x4f')](_0x3fcd32)[_0xba45('0x1a')](handleEntityNotFound(_0x43d785,null))[_0xba45('0x1a')](respondWithResult(_0x43d785,null))[_0xba45('0x23')](handleError(_0x43d785,null));};exports[_0xba45('0x50')]=function(_0x1692ad,_0x1df22a){return db[_0xba45('0x31')][_0xba45('0x50')](_0x1692ad[_0xba45('0x51')],{})['then'](respondWithResult(_0x1df22a,0xc9))[_0xba45('0x23')](handleError(_0x1df22a,null));};exports[_0xba45('0x2e')]=function(_0x3b2e1b,_0x35f9fa){if(_0x3b2e1b['body']['id']){delete _0x3b2e1b[_0xba45('0x51')]['id'];}return db[_0xba45('0x31')][_0xba45('0x4f')]({'where':{'id':_0x3b2e1b[_0xba45('0x4c')]['id']}})[_0xba45('0x1a')](handleEntityNotFound(_0x35f9fa,null))[_0xba45('0x1a')](saveUpdates(_0x3b2e1b[_0xba45('0x51')],null))[_0xba45('0x1a')](respondWithResult(_0x35f9fa,null))[_0xba45('0x23')](handleError(_0x35f9fa,null));};exports[_0xba45('0x52')]=function(_0x4a1cb1,_0x364b5a){return db[_0xba45('0x31')]['find']({'where':{'id':_0x4a1cb1['params']['id']}})[_0xba45('0x1a')](handleEntityNotFound(_0x364b5a,null))[_0xba45('0x1a')](removeEntity(_0x364b5a,null))[_0xba45('0x23')](handleError(_0x364b5a,null));};exports[_0xba45('0x53')]=function(_0x15ed9d,_0x3c78fa,_0x3a879d){var _0x4475b9={};var _0x5e8c37={};var _0xdc3e5c;var _0x2a1ffe;return db[_0xba45('0x31')][_0xba45('0x54')]({'where':{'id':_0x15ed9d[_0xba45('0x4c')]['id']}})[_0xba45('0x1a')](handleEntityNotFound(_0x3c78fa,null))['then'](function(_0x35c5ba){if(_0x35c5ba){_0xdc3e5c=_0x35c5ba;_0x5e8c37[_0xba45('0x36')]=_[_0xba45('0x39')](db[_0xba45('0x55')][_0xba45('0x32')]);_0x5e8c37[_0xba45('0x38')]=_[_0xba45('0x39')](_0x15ed9d[_0xba45('0x38')]);_0x5e8c37['filters']=_['intersection'](_0x5e8c37[_0xba45('0x36')],_0x5e8c37[_0xba45('0x38')]);_0x4475b9[_0xba45('0x3b')]=_[_0xba45('0x3c')](_0x5e8c37[_0xba45('0x36')],qs[_0xba45('0x3d')](_0x15ed9d['query'][_0xba45('0x3d')]));_0x4475b9[_0xba45('0x3b')]=_0x4475b9[_0xba45('0x3b')]['length']?_0x4475b9[_0xba45('0x3b')]:_0x5e8c37['model'];_0x4475b9[_0xba45('0x40')]=qs[_0xba45('0x41')](_0x15ed9d[_0xba45('0x38')]['sort']);_0x4475b9[_0xba45('0x42')]=qs['filters'](_[_0xba45('0x43')](_0x15ed9d['query'],_0x5e8c37[_0xba45('0x3a')]));if(_0x15ed9d[_0xba45('0x38')][_0xba45('0x44')]){_0x4475b9[_0xba45('0x42')]=_[_0xba45('0x45')](_0x4475b9[_0xba45('0x42')],{'$or':_[_0xba45('0x37')](_0x4475b9[_0xba45('0x3b')],function(_0x48a516){var _0x187480={};_0x187480[_0x48a516]={'$like':'%'+_0x15ed9d[_0xba45('0x38')][_0xba45('0x44')]+'%'};return _0x187480;})});}_0x4475b9=_[_0xba45('0x45')]({},_0x4475b9,_0x15ed9d[_0xba45('0x47')]);return _0xdc3e5c[_0xba45('0x53')](_0x4475b9);}})[_0xba45('0x1a')](function(_0x4a1dbb){if(_0x4a1dbb){_0x2a1ffe=_0x4a1dbb[_0xba45('0x56')];if(!_0x15ed9d[_0xba45('0x38')][_0xba45('0x3e')](_0xba45('0x3f'))){_0x4475b9['limit']=qs[_0xba45('0x28')](_0x15ed9d['query']['limit']);_0x4475b9[_0xba45('0x27')]=qs[_0xba45('0x27')](_0x15ed9d[_0xba45('0x38')][_0xba45('0x27')]);}return _0xdc3e5c[_0xba45('0x53')](_0x4475b9);}})[_0xba45('0x1a')](function(_0x986d50){if(_0x986d50){return _0x986d50?{'count':_0x2a1ffe,'rows':_0x986d50}:null;}})['then'](respondWithResult(_0x3c78fa,null))[_0xba45('0x23')](handleError(_0x3c78fa,null));};exports[_0xba45('0x57')]=function(_0x4b4e35,_0x3aac8d,_0x20a431){if(_0x4b4e35['body']['id']){delete _0x4b4e35[_0xba45('0x51')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x4b4e35['params']['id']}})[_0xba45('0x1a')](handleEntityNotFound(_0x3aac8d,null))[_0xba45('0x1a')](function(_0x50d8a3){if(_0x50d8a3){_0x4b4e35[_0xba45('0x51')][_0xba45('0x58')]=_0x50d8a3['id'];_0x4b4e35[_0xba45('0x51')][_0xba45('0x59')]=integrations['getSubjects'](_0x4b4e35['body'][_0xba45('0x5a')],_0x4b4e35['body'][_0xba45('0x34')]);_0x4b4e35[_0xba45('0x51')]['Descriptions']=integrations[_0xba45('0x5b')](_0x4b4e35[_0xba45('0x51')]['channel'],_0x4b4e35[_0xba45('0x51')][_0xba45('0x34')]);return db[_0xba45('0x55')][_0xba45('0x50')](_0x4b4e35['body'],{'include':[{'model':db['ServicenowField'],'as':_0xba45('0x59')},{'model':db[_0xba45('0x5c')],'as':_0xba45('0x5d')}]});}return null;})[_0xba45('0x1a')](respondWithResult(_0x3aac8d,null))['catch'](handleError(_0x3aac8d,null));};exports['getFields']=function(_0x1d1846,_0x59cd46,_0x2b7cde){var _0xd59376=[_0xba45('0x5e'),_0xba45('0x5f'),'knowledge',_0xba45('0x60'),_0xba45('0x61'),'notify',_0xba45('0x62'),_0xba45('0x63'),_0xba45('0x64')];var _0x1fcd1f=[_0xba45('0x65'),_0xba45('0x5e'),'caused_by',_0xba45('0x66'),'upon_reject','sys_updated_on','child_incidents',_0xba45('0x5f'),_0xba45('0x67'),_0xba45('0x68'),_0xba45('0x69'),_0xba45('0x6a'),_0xba45('0x6b'),_0xba45('0x6c'),'sys_created_on','sys_domain',_0xba45('0x6d'),_0xba45('0x6e'),_0xba45('0x6f'),_0xba45('0x40'),_0xba45('0x70'),_0xba45('0x71'),'cmdb_ci',_0xba45('0x72'),_0xba45('0x73'),_0xba45('0x74'),'work_notes_list',_0xba45('0x75'),_0xba45('0x76'),_0xba45('0x77'),_0xba45('0x78'),_0xba45('0x79'),_0xba45('0x7a'),_0xba45('0x7b'),_0xba45('0x7c'),'group_list',_0xba45('0x7d'),_0xba45('0x7e'),_0xba45('0x7f'),_0xba45('0x80'),_0xba45('0x81'),_0xba45('0x60'),_0xba45('0x82'),_0xba45('0x83'),_0xba45('0x61'),_0xba45('0x84'),_0xba45('0x85'),_0xba45('0x86'),_0xba45('0x87'),_0xba45('0x88'),_0xba45('0x89'),'description',_0xba45('0x8a'),_0xba45('0x8b'),_0xba45('0x8c'),_0xba45('0x8d'),_0xba45('0x8e'),_0xba45('0x8f'),'parent_incident',_0xba45('0x90'),_0xba45('0x91'),'reopened_by',_0xba45('0x62'),'urgency',_0xba45('0x92'),_0xba45('0x93'),_0xba45('0x94'),'activity_due',_0xba45('0x95'),'severity','comments','sla_due','approval','comments_and_work_notes',_0xba45('0x96'),_0xba45('0x97'),_0xba45('0x98'),_0xba45('0x99'),_0xba45('0x9a'),'upon_approval',_0xba45('0x9b'),_0xba45('0x9c'),_0xba45('0x64')];var _0x3a5f75='';var _0x5515be='';var _0x46067e=[];var _0x5e0043='';var _0x5dcdb='';var _0xf92a96=[];var _0x21f96d='';var _0x567bfc='';var _0x540673={};var _0x21b3f8='';return db[_0xba45('0x31')]['findOne']({'where':{'id':_0x1d1846[_0xba45('0x4c')]['id']},'attributes':['id',_0xba45('0x9d'),_0xba45('0x9e'),_0xba45('0x9f'),_0xba45('0xa0'),_0xba45('0xa1')]})[_0xba45('0x1a')](handleEntityNotFound(_0x59cd46,null))[_0xba45('0x1a')](function(_0x1c5eea){if(_0x1c5eea){_0x21b3f8=_0x1c5eea[_0xba45('0xa0')];var _0x4ba437=_0x21b3f8[_0xba45('0xa2')](-0x1);if(_0x4ba437==='/'){_0x21b3f8=_0x21b3f8[_0xba45('0xa3')](0x0,_0x21b3f8['lastIndexOf'](_0x4ba437));}_0x567bfc=util['format'](_0xba45('0xa4'),_0x21b3f8);_0x21f96d=util['format'](_0xba45('0xa5'),_0x21b3f8);_0x540673={'user':_0x1c5eea[_0xba45('0x9d')],'pass':_0x1c5eea['password']};var _0x587df5={'method':'GET','uri':_0x567bfc+_0xba45('0xa6'),'auth':_0x540673,'json':!![]};return rp(_0x587df5);}})[_0xba45('0x1a')](function(_0x27c8b6){if(_0x27c8b6['result'][_0xba45('0x56')]>0x0){_0x3a5f75=_0x27c8b6['result'];}console['log'](_0xba45('0xa7'),_0x3a5f75);_0xf92a96=[];_0x5515be=Object[_0xba45('0xa8')]([],_0x3a5f75);_[_0xba45('0xa9')](_0x5515be,function(_0x230c19){return!_0xd59376[_0xba45('0xaa')](_0x230c19[_0xba45('0x2f')]);});_0x5515be[_0xba45('0xab')](function(_0x12fb5d){var _0x293f12=createFieldObject(_0x21f96d,_0x540673,_0x12fb5d['internalType'],_0x12fb5d[_0xba45('0x2f')],_0x12fb5d['label'],![]);_0xf92a96['push'](_0x293f12);});return Promise[_0xba45('0xac')](_0xf92a96);})[_0xba45('0x1a')](function(_0xa57d57){_0x46067e=_0xa57d57;_0x5e0043=Object[_0xba45('0xa8')]([],_0x3a5f75);console['log'](_0xba45('0xad'),_0x3a5f75);_['remove'](_0x5e0043,function(_0x1f8d75){return _0x1fcd1f['includes'](_0x1f8d75[_0xba45('0x2f')]);});console[_0xba45('0xae')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x5e0043);_0xf92a96=[];_0x5e0043[_0xba45('0xab')](function(_0x288320){var _0x392d2d=createFieldObject(_0x21f96d,_0x540673,_0x288320[_0xba45('0xaf')],_0x288320['name'],_0x288320['label'],!![]);_0xf92a96[_0xba45('0xb0')](_0x392d2d);});return Promise[_0xba45('0xac')](_0xf92a96);})[_0xba45('0x1a')](function(_0x3ce048){_0x5dcdb=_0x3ce048;var _0x41b889=_0x46067e[_0xba45('0xb1')](_0x5dcdb);return{'count':_0x41b889['length'],'rows':_0x41b889};})['then'](respondWithResult(_0x59cd46,null))[_0xba45('0x23')](function(_0x5edcc5){console[_0xba45('0xae')]('ServiceNow\x20error:\x20'+_0x5edcc5);var _0x50581d=_0x1d1846['query']['test']?0x1f4:_0x5edcc5['statusCode']||0x1f4;logger['error'](_0x5edcc5['stack']);delete _0x5edcc5[_0xba45('0x2f')];if(_0x50581d===0x191){_0x50581d=0x190;}_0x59cd46[_0xba45('0x24')](_0x50581d)[_0xba45('0x30')](_0x1d1846['query'][_0xba45('0xb2')]?{'message':_0xba45('0xb3'),'statusCode':_0x5edcc5[_0xba45('0xb4')]}:_0x5edcc5);});};function createFieldObject(_0x4689b3,_0x453a45,_0x46d1ae,_0x1231bc,_0x51a8fe,_0x218910){return new Promise(function(_0x29d68a,_0x54c03b){var _0xe0576={'id':_0x1231bc,'name':_0x51a8fe,'custom':_0x218910};if(_0x46d1ae===_0xba45('0xb5')){_0xe0576['options']=[{'name':'True','value':_0xba45('0xb6')},{'name':_0xba45('0xb7'),'value':_0xba45('0xb8')}];_0x29d68a(_0xe0576);}else{var _0x20180c={'method':_0xba45('0xb9'),'uri':_0x4689b3+_0xba45('0xba')+_0x1231bc,'auth':_0x453a45,'json':!![]};return rp(_0x20180c)[_0xba45('0x1a')](function(_0x20c5f4){var _0x39ea0c=[];if(_0x20c5f4[_0xba45('0x22')][_0xba45('0x56')]>0x0){_0x20c5f4[_0xba45('0x22')][_0xba45('0xab')](function(_0x3fe3bf){if(_0x3fe3bf[_0xba45('0xbb')]===_0xba45('0xb8')){var _0x4bdd25={'name':_0x3fe3bf[_0xba45('0xbc')],'value':_0x3fe3bf[_0xba45('0xbd')]};_0x39ea0c[_0xba45('0xb0')](_0x4bdd25);}});}_0xe0576['options']=_0x39ea0c;if(_0xe0576['options'][_0xba45('0x56')]>0x0){_0x29d68a(_0xe0576);}else{if(_0x218910==![]){_0x29d68a();}else{_0x29d68a(_0xe0576);}}});}});} \ No newline at end of file +var _0xb74d=['http','request','then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','reopened_time','resolved_at','approval_set','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','sys_id','contact_type','reopened_by','urgency','problem_id','company','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','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/doc/table/schema/','GET','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x5e6578,_0x15c25a){var _0x32a32e=function(_0x1b15dd){while(--_0x1b15dd){_0x5e6578['push'](_0x5e6578['shift']());}};_0x32a32e(++_0x15c25a);}(_0xb74d,0x16e));var _0xdb74=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xb74d[_0x1d70db];return _0x3060c6;};'use strict';var pdf=require(_0xdb74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdb74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb74('0x2'));var rp=require('request-promise');var moment=require(_0xdb74('0x3'));var BPromise=require(_0xdb74('0x4'));var Mustache=require(_0xdb74('0x5'));var util=require('util');var path=require(_0xdb74('0x6'));var sox=require(_0xdb74('0x7'));var csv=require(_0xdb74('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdb74('0x9'));var crypto=require('crypto');var jsforce=require(_0xdb74('0xa'));var deskjs=require(_0xdb74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xdb74('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb74('0xd'));var authService=require(_0xdb74('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdb74('0xf'));var hardwareService=require(_0xdb74('0x10'));var logger=require(_0xdb74('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xdb74('0x12'));var licenseUtil=require(_0xdb74('0x13'));var db=require(_0xdb74('0x14'))['db'];var integrations=require(_0xdb74('0x15'));var jayson=require(_0xdb74('0x16'));var client=jayson[_0xdb74('0x17')][_0xdb74('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x101d22,_0x26ec1a,_0xad1802,_0x3cc3ba){return new BPromise(function(_0x3cbbc5,_0x1df848){var _0x49ffcc=_0x3cc3ba||client;return _0x49ffcc[_0xdb74('0x19')](_0x101d22,_0xad1802)[_0xdb74('0x1a')](function(_0x23f848){logger[_0xdb74('0x1b')]('ServicenowAccount,\x20%s,\x20%s',_0x26ec1a,'request\x20sent');logger[_0xdb74('0x1c')](_0xdb74('0x1d'),_0x26ec1a,'request\x20sent',JSON[_0xdb74('0x1e')](_0x23f848));if(_0x23f848[_0xdb74('0x1f')]){if(_0x23f848[_0xdb74('0x1f')][_0xdb74('0x20')]===0x1f4){logger['error'](_0xdb74('0x21'),_0x26ec1a,_0x23f848[_0xdb74('0x1f')][_0xdb74('0x22')]);return _0x1df848(_0x23f848['error']['message']);}logger[_0xdb74('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x26ec1a,_0x23f848[_0xdb74('0x1f')][_0xdb74('0x22')]);return _0x3cbbc5(_0x23f848[_0xdb74('0x1f')][_0xdb74('0x22')]);}else{logger['info'](_0xdb74('0x21'),_0x26ec1a,_0xdb74('0x23'));_0x3cbbc5(_0x23f848[_0xdb74('0x24')][_0xdb74('0x22')]);}})[_0xdb74('0x25')](function(_0x48abb4){logger[_0xdb74('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x26ec1a,_0x48abb4);_0x1df848(_0x48abb4);});});}function respondWithStatusCode(_0x3d9d1d,_0x3fef84){_0x3fef84=_0x3fef84||0xcc;return function(_0xb44edc){if(_0xb44edc){return _0x3d9d1d['sendStatus'](_0x3fef84);}return _0x3d9d1d[_0xdb74('0x26')](_0x3fef84)[_0xdb74('0x27')]();};}function respondWithResult(_0x429cee,_0x7fffbf){_0x7fffbf=_0x7fffbf||0xc8;return function(_0x2d0049){if(_0x2d0049){return _0x429cee[_0xdb74('0x26')](_0x7fffbf)[_0xdb74('0x28')](_0x2d0049);}};}function respondWithFilteredResult(_0x40bcb2,_0x9d8021){return function(_0x334242){if(_0x334242){var _0x602930=_0x334242[_0xdb74('0x29')],_0x5ec6df=_0x9d8021[_0xdb74('0x2a')],_0x2890a2=_0x9d8021[_0xdb74('0x2a')]+_0x9d8021[_0xdb74('0x2b')],_0x367573;if(_0x2890a2>=_0x602930){_0x2890a2=_0x602930;_0x367573=0xc8;}else{_0x367573=0xce;}_0x40bcb2[_0xdb74('0x26')](_0x367573);return _0x40bcb2[_0xdb74('0x2c')](_0xdb74('0x2d'),_0x5ec6df+'-'+_0x2890a2+'/'+_0x602930)[_0xdb74('0x28')](_0x334242);}return null;};}function patchUpdates(_0x59044c){return function(_0x33fd67){try{jsonpatch[_0xdb74('0x2e')](_0x33fd67,_0x59044c,!![]);}catch(_0xd0412){return BPromise[_0xdb74('0x2f')](_0xd0412);}return _0x33fd67[_0xdb74('0x30')]();};}function saveUpdates(_0x583422,_0x228b91){return function(_0x25a298){if(_0x25a298){return _0x25a298[_0xdb74('0x31')](_0x583422)[_0xdb74('0x1a')](function(_0x5041cb){return _0x5041cb;});}return null;};}function removeEntity(_0x338bdd,_0x5c2fca){return function(_0x4e9a26){if(_0x4e9a26){return _0x4e9a26[_0xdb74('0x32')]()[_0xdb74('0x1a')](function(){_0x338bdd[_0xdb74('0x26')](0xcc)[_0xdb74('0x27')]();});}};}function handleEntityNotFound(_0x51e0d5,_0x26cc61){return function(_0xcf6a0){if(!_0xcf6a0){_0x51e0d5['sendStatus'](0x194);}return _0xcf6a0;};}function handleError(_0x3f1d1d,_0x43dfc0){_0x43dfc0=_0x43dfc0||0x1f4;return function(_0x14bb4e){logger[_0xdb74('0x1f')](_0x14bb4e[_0xdb74('0x33')]);if(_0x14bb4e[_0xdb74('0x34')]){delete _0x14bb4e[_0xdb74('0x34')];}_0x3f1d1d[_0xdb74('0x26')](_0x43dfc0)[_0xdb74('0x35')](_0x14bb4e);};}exports[_0xdb74('0x36')]=function(_0x360939,_0x3045a3){var _0x122ee8={},_0x47d187={},_0x3b82e1={'count':0x0,'rows':[]};var _0x32efc6=_[_0xdb74('0x37')](db[_0xdb74('0x38')][_0xdb74('0x39')],function(_0x1677c1){return{'name':_0x1677c1[_0xdb74('0x3a')],'type':_0x1677c1[_0xdb74('0x3b')][_0xdb74('0x3c')]};});_0x47d187['model']=_[_0xdb74('0x37')](_0x32efc6,'name');_0x47d187[_0xdb74('0x3d')]=_['keys'](_0x360939[_0xdb74('0x3d')]);_0x47d187[_0xdb74('0x3e')]=_[_0xdb74('0x3f')](_0x47d187[_0xdb74('0x40')],_0x47d187['query']);_0x122ee8[_0xdb74('0x41')]=_[_0xdb74('0x3f')](_0x47d187['model'],qs['fields'](_0x360939['query'][_0xdb74('0x42')]));_0x122ee8['attributes']=_0x122ee8['attributes'][_0xdb74('0x43')]?_0x122ee8[_0xdb74('0x41')]:_0x47d187[_0xdb74('0x40')];if(!_0x360939[_0xdb74('0x3d')]['hasOwnProperty'](_0xdb74('0x44'))){_0x122ee8['limit']=qs[_0xdb74('0x2b')](_0x360939[_0xdb74('0x3d')][_0xdb74('0x2b')]);_0x122ee8[_0xdb74('0x2a')]=qs[_0xdb74('0x2a')](_0x360939[_0xdb74('0x3d')][_0xdb74('0x2a')]);}_0x122ee8[_0xdb74('0x45')]=qs[_0xdb74('0x46')](_0x360939['query']['sort']);_0x122ee8['where']=qs[_0xdb74('0x3e')](_[_0xdb74('0x47')](_0x360939[_0xdb74('0x3d')],_0x47d187[_0xdb74('0x3e')]),_0x32efc6);if(_0x360939['query'][_0xdb74('0x48')]){_0x122ee8[_0xdb74('0x49')]=_[_0xdb74('0x4a')](_0x122ee8[_0xdb74('0x49')],{'$or':_[_0xdb74('0x37')](_0x32efc6,function(_0x3660d9){if(_0x3660d9[_0xdb74('0x3b')]!=='VIRTUAL'){var _0x171264={};_0x171264[_0x3660d9[_0xdb74('0x34')]]={'$like':'%'+_0x360939[_0xdb74('0x3d')][_0xdb74('0x48')]+'%'};return _0x171264;}})});}_0x122ee8=_[_0xdb74('0x4a')]({},_0x122ee8,_0x360939[_0xdb74('0x4b')]);var _0x49fbab={'where':_0x122ee8[_0xdb74('0x49')]};return db[_0xdb74('0x38')][_0xdb74('0x29')](_0x49fbab)[_0xdb74('0x1a')](function(_0x507364){_0x3b82e1[_0xdb74('0x29')]=_0x507364;if(_0x360939[_0xdb74('0x3d')][_0xdb74('0x4c')]){_0x122ee8['include']=[{'all':!![]}];}return db[_0xdb74('0x38')][_0xdb74('0x4d')](_0x122ee8);})[_0xdb74('0x1a')](function(_0x54e63f){_0x3b82e1[_0xdb74('0x4e')]=_0x54e63f;return _0x3b82e1;})[_0xdb74('0x1a')](respondWithFilteredResult(_0x3045a3,_0x122ee8))[_0xdb74('0x25')](handleError(_0x3045a3,null));};exports[_0xdb74('0x4f')]=function(_0x19b4a0,_0x2527ac){var _0x511261={'raw':![],'where':{'id':_0x19b4a0[_0xdb74('0x50')]['id']}},_0x1fb7a2={};_0x1fb7a2['model']=_[_0xdb74('0x51')](db['ServicenowAccount'][_0xdb74('0x39')]);_0x1fb7a2[_0xdb74('0x3d')]=_[_0xdb74('0x51')](_0x19b4a0[_0xdb74('0x3d')]);_0x1fb7a2['filtears']=_['intersection'](_0x1fb7a2[_0xdb74('0x40')],_0x1fb7a2['query']);_0x511261['attributes']=_[_0xdb74('0x3f')](_0x1fb7a2[_0xdb74('0x40')],qs[_0xdb74('0x42')](_0x19b4a0[_0xdb74('0x3d')][_0xdb74('0x42')]));_0x511261[_0xdb74('0x41')]=_0x511261[_0xdb74('0x41')][_0xdb74('0x43')]?_0x511261[_0xdb74('0x41')]:_0x1fb7a2[_0xdb74('0x40')];if(_0x19b4a0['query'][_0xdb74('0x4c')]){_0x511261[_0xdb74('0x52')]=[{'all':!![]}];}_0x511261=_[_0xdb74('0x4a')]({},_0x511261,_0x19b4a0[_0xdb74('0x4b')]);return db['ServicenowAccount'][_0xdb74('0x53')](_0x511261)['then'](handleEntityNotFound(_0x2527ac,null))[_0xdb74('0x1a')](respondWithResult(_0x2527ac,null))[_0xdb74('0x25')](handleError(_0x2527ac,null));};exports[_0xdb74('0x54')]=function(_0x269e17,_0x42b82e){return db[_0xdb74('0x38')][_0xdb74('0x54')](_0x269e17[_0xdb74('0x55')],{})['then'](respondWithResult(_0x42b82e,0xc9))[_0xdb74('0x25')](handleError(_0x42b82e,null));};exports['update']=function(_0x3c8d5,_0x195df7){if(_0x3c8d5['body']['id']){delete _0x3c8d5[_0xdb74('0x55')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x3c8d5['params']['id']}})['then'](handleEntityNotFound(_0x195df7,null))[_0xdb74('0x1a')](saveUpdates(_0x3c8d5[_0xdb74('0x55')],null))[_0xdb74('0x1a')](respondWithResult(_0x195df7,null))[_0xdb74('0x25')](handleError(_0x195df7,null));};exports[_0xdb74('0x32')]=function(_0x4b44c8,_0x397305){return db['ServicenowAccount'][_0xdb74('0x53')]({'where':{'id':_0x4b44c8['params']['id']}})[_0xdb74('0x1a')](handleEntityNotFound(_0x397305,null))[_0xdb74('0x1a')](removeEntity(_0x397305,null))[_0xdb74('0x25')](handleError(_0x397305,null));};exports[_0xdb74('0x56')]=function(_0x300a16,_0x2abad4,_0x2e5bb4){var _0x524390={};var _0xa9f72e={};var _0x160f8b;var _0x304f73;return db[_0xdb74('0x38')][_0xdb74('0x57')]({'where':{'id':_0x300a16[_0xdb74('0x50')]['id']}})['then'](handleEntityNotFound(_0x2abad4,null))['then'](function(_0x2e3b22){if(_0x2e3b22){_0x160f8b=_0x2e3b22;_0xa9f72e['model']=_['keys'](db['ServicenowConfiguration']['rawAttributes']);_0xa9f72e[_0xdb74('0x3d')]=_[_0xdb74('0x51')](_0x300a16[_0xdb74('0x3d')]);_0xa9f72e['filters']=_[_0xdb74('0x3f')](_0xa9f72e['model'],_0xa9f72e[_0xdb74('0x3d')]);_0x524390[_0xdb74('0x41')]=_['intersection'](_0xa9f72e[_0xdb74('0x40')],qs['fields'](_0x300a16['query'][_0xdb74('0x42')]));_0x524390['attributes']=_0x524390[_0xdb74('0x41')][_0xdb74('0x43')]?_0x524390[_0xdb74('0x41')]:_0xa9f72e[_0xdb74('0x40')];_0x524390[_0xdb74('0x45')]=qs[_0xdb74('0x46')](_0x300a16[_0xdb74('0x3d')][_0xdb74('0x46')]);_0x524390[_0xdb74('0x49')]=qs['filters'](_[_0xdb74('0x47')](_0x300a16[_0xdb74('0x3d')],_0xa9f72e['filters']));if(_0x300a16['query']['filter']){_0x524390[_0xdb74('0x49')]=_['merge'](_0x524390['where'],{'$or':_['map'](_0x524390[_0xdb74('0x41')],function(_0x298f44){var _0x4f8f94={};_0x4f8f94[_0x298f44]={'$like':'%'+_0x300a16[_0xdb74('0x3d')][_0xdb74('0x48')]+'%'};return _0x4f8f94;})});}_0x524390=_[_0xdb74('0x4a')]({},_0x524390,_0x300a16[_0xdb74('0x4b')]);return _0x160f8b[_0xdb74('0x56')](_0x524390);}})['then'](function(_0x2798a4){if(_0x2798a4){_0x304f73=_0x2798a4[_0xdb74('0x43')];if(!_0x300a16[_0xdb74('0x3d')][_0xdb74('0x58')](_0xdb74('0x44'))){_0x524390[_0xdb74('0x2b')]=qs[_0xdb74('0x2b')](_0x300a16['query'][_0xdb74('0x2b')]);_0x524390[_0xdb74('0x2a')]=qs['offset'](_0x300a16[_0xdb74('0x3d')][_0xdb74('0x2a')]);}return _0x160f8b['getConfigurations'](_0x524390);}})[_0xdb74('0x1a')](function(_0x3aaf85){if(_0x3aaf85){return _0x3aaf85?{'count':_0x304f73,'rows':_0x3aaf85}:null;}})['then'](respondWithResult(_0x2abad4,null))[_0xdb74('0x25')](handleError(_0x2abad4,null));};exports[_0xdb74('0x59')]=function(_0x2f3885,_0x3ecca6,_0xce00ad){if(_0x2f3885[_0xdb74('0x55')]['id']){delete _0x2f3885[_0xdb74('0x55')]['id'];}return db['ServicenowAccount'][_0xdb74('0x57')]({'where':{'id':_0x2f3885[_0xdb74('0x50')]['id']}})[_0xdb74('0x1a')](handleEntityNotFound(_0x3ecca6,null))[_0xdb74('0x1a')](function(_0x1fe15){if(_0x1fe15){_0x2f3885[_0xdb74('0x55')][_0xdb74('0x5a')]=_0x1fe15['id'];_0x2f3885[_0xdb74('0x55')][_0xdb74('0x5b')]=integrations[_0xdb74('0x5c')](_0x2f3885[_0xdb74('0x55')][_0xdb74('0x5d')],_0x2f3885[_0xdb74('0x55')][_0xdb74('0x3b')]);_0x2f3885[_0xdb74('0x55')][_0xdb74('0x5e')]=integrations[_0xdb74('0x5f')](_0x2f3885[_0xdb74('0x55')][_0xdb74('0x5d')],_0x2f3885[_0xdb74('0x55')][_0xdb74('0x3b')]);return db[_0xdb74('0x60')][_0xdb74('0x54')](_0x2f3885[_0xdb74('0x55')],{'include':[{'model':db[_0xdb74('0x61')],'as':_0xdb74('0x5b')},{'model':db[_0xdb74('0x61')],'as':'Descriptions'}]});}return null;})[_0xdb74('0x1a')](respondWithResult(_0x3ecca6,null))[_0xdb74('0x25')](handleError(_0x3ecca6,null));};exports['getFields']=function(_0x44d73f,_0x591be2,_0xfba0f0){var _0x561878=[_0xdb74('0x62'),_0xdb74('0x63'),_0xdb74('0x64'),_0xdb74('0x65'),_0xdb74('0x66'),'notify',_0xdb74('0x67'),_0xdb74('0x68'),_0xdb74('0x69')];var _0x1d0cf3=[_0xdb74('0x6a'),'made_sla',_0xdb74('0x6b'),'watch_list','upon_reject','sys_updated_on',_0xdb74('0x6c'),'hold_reason',_0xdb74('0x6d'),_0xdb74('0x6e'),_0xdb74('0x6f'),'sys_updated_by',_0xdb74('0x70'),_0xdb74('0x71'),_0xdb74('0x72'),_0xdb74('0x73'),_0xdb74('0x74'),_0xdb74('0x75'),_0xdb74('0x64'),'order','calendar_stc',_0xdb74('0x76'),'cmdb_ci',_0xdb74('0x77'),_0xdb74('0x78'),_0xdb74('0x79'),'work_notes_list','business_service',_0xdb74('0x7a'),_0xdb74('0x7b'),_0xdb74('0x7c'),_0xdb74('0x7d'),_0xdb74('0x7e'),_0xdb74('0x7f'),'business_duration','group_list',_0xdb74('0x80'),_0xdb74('0x81'),_0xdb74('0x82'),'caller_id',_0xdb74('0x83'),_0xdb74('0x65'),'work_notes',_0xdb74('0x84'),_0xdb74('0x66'),_0xdb74('0x85'),_0xdb74('0x86'),_0xdb74('0x87'),'assignment_group',_0xdb74('0x88'),_0xdb74('0x89'),_0xdb74('0x8a'),_0xdb74('0x8b'),'notify',_0xdb74('0x8c'),_0xdb74('0x8d'),'closed_by','follow_up','parent_incident',_0xdb74('0x8e'),_0xdb74('0x8f'),_0xdb74('0x90'),_0xdb74('0x67'),_0xdb74('0x91'),_0xdb74('0x92'),_0xdb74('0x93'),'reassignment_count',_0xdb74('0x94'),_0xdb74('0x95'),_0xdb74('0x68'),_0xdb74('0x96'),_0xdb74('0x97'),_0xdb74('0x98'),_0xdb74('0x99'),_0xdb74('0x9a'),_0xdb74('0x9b'),_0xdb74('0x9c'),_0xdb74('0x9d'),_0xdb74('0x9e'),_0xdb74('0x9f'),_0xdb74('0xa0'),_0xdb74('0xa1'),'category'];var _0x5d3f56='';var _0x5d1d6d='';var _0x3da140=[];var _0x5055c4='';var _0x3994f0='';var _0x5f295b=[];var _0x50708b='';var _0xff1ec7='';var _0x9494f0={};var _0x50d07e='';return db['ServicenowAccount'][_0xdb74('0x57')]({'where':{'id':_0x44d73f['params']['id']},'attributes':['id',_0xdb74('0xa2'),_0xdb74('0xa3'),_0xdb74('0xa4'),_0xdb74('0xa5'),_0xdb74('0xa6')]})['then'](handleEntityNotFound(_0x591be2,null))[_0xdb74('0x1a')](function(_0x4ecb6e){if(_0x4ecb6e){_0x50d07e=_0x4ecb6e[_0xdb74('0xa5')];var _0x22a2e8=_0x50d07e[_0xdb74('0xa7')](-0x1);if(_0x22a2e8==='/'){_0x50d07e=_0x50d07e[_0xdb74('0xa8')](0x0,_0x50d07e[_0xdb74('0xa9')](_0x22a2e8));}_0xff1ec7=util[_0xdb74('0xaa')](_0xdb74('0xab'),_0x50d07e);_0x50708b=util[_0xdb74('0xaa')]('%s/api/now/table/',_0x50d07e);_0x9494f0={'user':_0x4ecb6e[_0xdb74('0xa2')],'pass':_0x4ecb6e[_0xdb74('0xa3')]};var _0x2d3caa={'method':_0xdb74('0xac'),'uri':_0xff1ec7+_0xdb74('0xad'),'auth':_0x9494f0,'json':!![]};return rp(_0x2d3caa);}})['then'](function(_0xe07147){if(_0xe07147[_0xdb74('0x24')][_0xdb74('0x43')]>0x0){_0x5d3f56=_0xe07147['result'];}console['log'](_0xdb74('0xae'),_0x5d3f56);_0x5f295b=[];_0x5d1d6d=Object[_0xdb74('0xaf')]([],_0x5d3f56);_[_0xdb74('0xb0')](_0x5d1d6d,function(_0x4b704a){return!_0x561878[_0xdb74('0xb1')](_0x4b704a['name']);});_0x5d1d6d[_0xdb74('0xb2')](function(_0x78c82c){var _0x5cd94d=createFieldObject(_0x50708b,_0x9494f0,_0x78c82c['internalType'],_0x78c82c['name'],_0x78c82c[_0xdb74('0xb3')],![]);_0x5f295b[_0xdb74('0xb4')](_0x5cd94d);});return Promise[_0xdb74('0xb5')](_0x5f295b);})['then'](function(_0x31fb25){_0x3da140=_0x31fb25;_0x5055c4=Object[_0xdb74('0xaf')]([],_0x5d3f56);console[_0xdb74('0xb6')]('TCL:\x20_object',_0x5d3f56);_[_0xdb74('0xb0')](_0x5055c4,function(_0x18e03b){return _0x1d0cf3['includes'](_0x18e03b['name']);});console[_0xdb74('0xb6')](_0xdb74('0xb7'),_0x5055c4);_0x5f295b=[];_0x5055c4[_0xdb74('0xb2')](function(_0x1f2767){var _0x1f48a4=createFieldObject(_0x50708b,_0x9494f0,_0x1f2767[_0xdb74('0xb8')],_0x1f2767[_0xdb74('0x34')],_0x1f2767[_0xdb74('0xb3')],!![]);_0x5f295b[_0xdb74('0xb4')](_0x1f48a4);});return Promise[_0xdb74('0xb5')](_0x5f295b);})[_0xdb74('0x1a')](function(_0x57d786){_0x3994f0=_0x57d786;var _0x333330=_0x3da140[_0xdb74('0xb9')](_0x3994f0);return{'count':_0x333330[_0xdb74('0x43')],'rows':_0x333330};})[_0xdb74('0x1a')](respondWithResult(_0x591be2,null))[_0xdb74('0x25')](function(_0x589ac2){console[_0xdb74('0xb6')]('ServiceNow\x20error:\x20'+_0x589ac2);var _0x4c71d4=_0x44d73f[_0xdb74('0x3d')][_0xdb74('0xba')]?0x1f4:_0x589ac2[_0xdb74('0xbb')]||0x1f4;logger[_0xdb74('0x1f')](_0x589ac2[_0xdb74('0x33')]);delete _0x589ac2['name'];if(_0x4c71d4===0x191){_0x4c71d4=0x190;}_0x591be2['status'](_0x4c71d4)[_0xdb74('0x35')](_0x44d73f[_0xdb74('0x3d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x589ac2[_0xdb74('0xbb')]}:_0x589ac2);});};function createFieldObject(_0x41265c,_0x530979,_0x689327,_0x4e8358,_0x2695b3,_0x1d4fbb){return new Promise(function(_0x320263,_0x5cc7a4){var _0x404344={'id':_0x4e8358,'name':_0x2695b3,'custom':_0x1d4fbb};if(_0x689327===_0xdb74('0xbc')){_0x404344[_0xdb74('0x4b')]=[{'name':_0xdb74('0xbd'),'value':_0xdb74('0xbe')},{'name':_0xdb74('0xbf'),'value':_0xdb74('0xc0')}];_0x320263(_0x404344);}else{var _0x3bbebb={'method':_0xdb74('0xac'),'uri':_0x41265c+_0xdb74('0xc1')+_0x4e8358,'auth':_0x530979,'json':!![]};return rp(_0x3bbebb)[_0xdb74('0x1a')](function(_0x1d38b7){var _0x8f2d69=[];if(_0x1d38b7['result'][_0xdb74('0x43')]>0x0){_0x1d38b7[_0xdb74('0x24')][_0xdb74('0xb2')](function(_0x39783){if(_0x39783['inactive']==='false'){var _0x3e6a0f={'name':_0x39783[_0xdb74('0xb3')],'value':_0x39783[_0xdb74('0xc2')]};_0x8f2d69[_0xdb74('0xb4')](_0x3e6a0f);}});}_0x404344[_0xdb74('0x4b')]=_0x8f2d69;if(_0x404344[_0xdb74('0x4b')][_0xdb74('0x43')]>0x0){_0x320263(_0x404344);}else{if(_0x1d4fbb==![]){_0x320263();}else{_0x320263(_0x404344);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 155447b..48be683 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 _0x8ef6=['bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0x5c2188,_0x26c03f){var _0x224fa7=function(_0x1f5e1b){while(--_0x1f5e1b){_0x5c2188['push'](_0x5c2188['shift']());}};_0x224fa7(++_0x26c03f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ccf01,_0x43f128){_0x2ccf01=_0x2ccf01-0x0;var _0x381dee=_0x8ef6[_0x2ccf01];return _0x381dee;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));var integrations=require(_0x68ef('0xa'));module['exports']=function(_0x4f77f3,_0x3c2ff3){return _0x4f77f3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc978=['bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x1637dc,_0x51c2b6){var _0x4bc46c=function(_0x2faa4b){while(--_0x2faa4b){_0x1637dc['push'](_0x1637dc['shift']());}};_0x4bc46c(++_0x51c2b6);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));var integrations=require(_0x8c97('0xa'));module[_0x8c97('0xb')]=function(_0xabd146,_0x524196){return _0xabd146[_0x8c97('0xc')](_0x8c97('0xd'),attributes,{'tableName':_0x8c97('0xe'),'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 04d8e3f..9f33fab 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 _0x67e3=['raw','where','limit','map','include','attributes','model','then','catch','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetServicenowAccount','options'];(function(_0x29d2d2,_0x3344){var _0x3f6476=function(_0x29c2a2){while(--_0x29c2a2){_0x29d2d2['push'](_0x29d2d2['shift']());}};_0x3f6476(++_0x3344);}(_0x67e3,0x1d3));var _0x367e=function(_0x1b9716,_0x3aba61){_0x1b9716=_0x1b9716-0x0;var _0x186137=_0x67e3[_0x1b9716];return _0x186137;};'use strict';var _=require(_0x367e('0x0'));var util=require(_0x367e('0x1'));var moment=require(_0x367e('0x2'));var BPromise=require(_0x367e('0x3'));var rs=require(_0x367e('0x4'));var fs=require('fs');var Redis=require(_0x367e('0x5'));var db=require(_0x367e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x367e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x367e('0x8'));var client=jayson[_0x367e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4bd8,_0x3e0378,_0x2d80cd){return new BPromise(function(_0x2d5ca3,_0x58ca9b){return client[_0x367e('0xa')](_0x1d4bd8,_0x2d80cd)['then'](function(_0x3d427c){logger['info'](_0x367e('0xb'),_0x3e0378,_0x367e('0xc'));logger[_0x367e('0xd')](_0x367e('0xe'),_0x3e0378,_0x367e('0xc'),JSON[_0x367e('0xf')](_0x3d427c));if(_0x3d427c[_0x367e('0x10')]){if(_0x3d427c[_0x367e('0x10')][_0x367e('0x11')]===0x1f4){logger[_0x367e('0x10')](_0x367e('0xb'),_0x3e0378,_0x3d427c[_0x367e('0x10')][_0x367e('0x12')]);return _0x58ca9b(_0x3d427c['error'][_0x367e('0x12')]);}logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3e0378,_0x3d427c['error'][_0x367e('0x12')]);return _0x2d5ca3(_0x3d427c[_0x367e('0x10')][_0x367e('0x12')]);}else{logger[_0x367e('0x13')](_0x367e('0xb'),_0x3e0378,_0x367e('0xc'));_0x2d5ca3(_0x3d427c[_0x367e('0x14')][_0x367e('0x12')]);}})['catch'](function(_0x17732a){logger[_0x367e('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x3e0378,_0x17732a);_0x58ca9b(_0x17732a);});});}exports[_0x367e('0x15')]=function(_0x4bba0){var _0x24e63d=this;return new Promise(function(_0x2778d2,_0x41c9cb){return db['ServicenowAccount']['findAll']({'raw':_0x4bba0['options']?_0x4bba0[_0x367e('0x16')][_0x367e('0x17')]===undefined?!![]:![]:!![],'where':_0x4bba0[_0x367e('0x16')]?_0x4bba0[_0x367e('0x16')][_0x367e('0x18')]||null:null,'attributes':_0x4bba0['options']?_0x4bba0[_0x367e('0x16')]['attributes']||null:null,'limit':_0x4bba0[_0x367e('0x16')]?_0x4bba0[_0x367e('0x16')][_0x367e('0x19')]||null:null,'include':_0x4bba0[_0x367e('0x16')]?_0x4bba0[_0x367e('0x16')]['include']?_[_0x367e('0x1a')](_0x4bba0[_0x367e('0x16')][_0x367e('0x1b')],function(_0x2954ee){return{'model':db[_0x2954ee['model']],'as':_0x2954ee['as'],'attributes':_0x2954ee[_0x367e('0x1c')],'include':_0x2954ee['include']?_[_0x367e('0x1a')](_0x2954ee[_0x367e('0x1b')],function(_0x4ec36e){return{'model':db[_0x4ec36e[_0x367e('0x1d')]],'as':_0x4ec36e['as'],'attributes':_0x4ec36e[_0x367e('0x1c')],'include':_0x4ec36e['include']?_[_0x367e('0x1a')](_0x4ec36e[_0x367e('0x1b')],function(_0x62966e){return{'model':db[_0x62966e[_0x367e('0x1d')]],'as':_0x62966e['as'],'attributes':_0x62966e['attributes']};}):[]};}):[]};}):[]:[]})[_0x367e('0x1e')](function(_0x4d20ac){logger['info'](_0x367e('0x15'),_0x4bba0);logger[_0x367e('0xd')](_0x367e('0x15'),_0x4bba0,JSON[_0x367e('0xf')](_0x4d20ac));_0x2778d2(_0x4d20ac);})[_0x367e('0x1f')](function(_0x348094){logger[_0x367e('0x10')]('GetServicenowAccount',_0x348094['message'],_0x4bba0);_0x41c9cb(_0x24e63d[_0x367e('0x10')](0x1f4,_0x348094[_0x367e('0x12')]));});});};exports[_0x367e('0x20')]=function(_0x582eb6){var _0x33067b=this;return new Promise(function(_0x82c23e,_0x30829d){return db[_0x367e('0x21')][_0x367e('0x22')]({'raw':_0x582eb6[_0x367e('0x16')]?_0x582eb6['options'][_0x367e('0x17')]===undefined?!![]:![]:!![],'where':_0x582eb6[_0x367e('0x16')]?_0x582eb6[_0x367e('0x16')][_0x367e('0x18')]||null:null,'attributes':_0x582eb6['options']?_0x582eb6[_0x367e('0x16')][_0x367e('0x1c')]||null:null,'include':_0x582eb6[_0x367e('0x16')]?_0x582eb6['options'][_0x367e('0x1b')]?_[_0x367e('0x1a')](_0x582eb6['options'][_0x367e('0x1b')],function(_0x481697){return{'model':db[_0x481697['model']],'as':_0x481697['as'],'attributes':_0x481697[_0x367e('0x1c')],'include':_0x481697['include']?_[_0x367e('0x1a')](_0x481697['include'],function(_0x38ff5d){return{'model':db[_0x38ff5d['model']],'as':_0x38ff5d['as'],'attributes':_0x38ff5d[_0x367e('0x1c')],'include':_0x38ff5d[_0x367e('0x1b')]?_[_0x367e('0x1a')](_0x38ff5d['include'],function(_0x22c378){return{'model':db[_0x22c378[_0x367e('0x1d')]],'as':_0x22c378['as'],'attributes':_0x22c378[_0x367e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x367e('0x1e')](function(_0x3fc57b){logger[_0x367e('0x13')](_0x367e('0x20'),_0x582eb6);logger[_0x367e('0xd')](_0x367e('0x20'),_0x582eb6,JSON['stringify'](_0x3fc57b));_0x82c23e(_0x3fc57b);})[_0x367e('0x1f')](function(_0x3f6b07){logger[_0x367e('0x10')](_0x367e('0x20'),_0x3f6b07[_0x367e('0x12')],_0x582eb6);_0x30829d(_0x33067b['error'](0x1f4,_0x3f6b07['message']));});});}; \ No newline at end of file +var _0x426c=['request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetServicenowAccount','findAll','options','where','attributes','limit','include','model','map','catch','ServicenowAccount','find','raw','ShowServicenowAccount','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x426c,0x179));var _0xc426=function(_0x44dc4c,_0x357e6a){_0x44dc4c=_0x44dc4c-0x0;var _0x4e644e=_0x426c[_0x44dc4c];return _0x4e644e;};'use strict';var _=require(_0xc426('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc426('0x1'));var rs=require(_0xc426('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc426('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc426('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc426('0x5'));var client=jayson[_0xc426('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48eb8b,_0x598923,_0x21b7fe){return new BPromise(function(_0x26373a,_0x55fd66){return client[_0xc426('0x7')](_0x48eb8b,_0x21b7fe)[_0xc426('0x8')](function(_0x29dd0f){logger[_0xc426('0x9')](_0xc426('0xa'),_0x598923,_0xc426('0xb'));logger[_0xc426('0xc')](_0xc426('0xd'),_0x598923,'request\x20sent',JSON[_0xc426('0xe')](_0x29dd0f));if(_0x29dd0f[_0xc426('0xf')]){if(_0x29dd0f[_0xc426('0xf')][_0xc426('0x10')]===0x1f4){logger['error'](_0xc426('0xa'),_0x598923,_0x29dd0f['error']['message']);return _0x55fd66(_0x29dd0f['error']['message']);}logger[_0xc426('0xf')](_0xc426('0xa'),_0x598923,_0x29dd0f['error']['message']);return _0x26373a(_0x29dd0f[_0xc426('0xf')][_0xc426('0x11')]);}else{logger[_0xc426('0x9')](_0xc426('0xa'),_0x598923,_0xc426('0xb'));_0x26373a(_0x29dd0f['result'][_0xc426('0x11')]);}})['catch'](function(_0x2e83c6){logger[_0xc426('0xf')](_0xc426('0xa'),_0x598923,_0x2e83c6);_0x55fd66(_0x2e83c6);});});}exports[_0xc426('0x12')]=function(_0x3e3ad4){var _0x5c00b7=this;return new Promise(function(_0x49cc88,_0x514dde){return db['ServicenowAccount'][_0xc426('0x13')]({'raw':_0x3e3ad4[_0xc426('0x14')]?_0x3e3ad4[_0xc426('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3e3ad4[_0xc426('0x14')]?_0x3e3ad4[_0xc426('0x14')][_0xc426('0x15')]||null:null,'attributes':_0x3e3ad4['options']?_0x3e3ad4[_0xc426('0x14')][_0xc426('0x16')]||null:null,'limit':_0x3e3ad4[_0xc426('0x14')]?_0x3e3ad4[_0xc426('0x14')][_0xc426('0x17')]||null:null,'include':_0x3e3ad4[_0xc426('0x14')]?_0x3e3ad4[_0xc426('0x14')][_0xc426('0x18')]?_['map'](_0x3e3ad4[_0xc426('0x14')][_0xc426('0x18')],function(_0x2c9aa0){return{'model':db[_0x2c9aa0[_0xc426('0x19')]],'as':_0x2c9aa0['as'],'attributes':_0x2c9aa0[_0xc426('0x16')],'include':_0x2c9aa0[_0xc426('0x18')]?_[_0xc426('0x1a')](_0x2c9aa0[_0xc426('0x18')],function(_0x102ecf){return{'model':db[_0x102ecf[_0xc426('0x19')]],'as':_0x102ecf['as'],'attributes':_0x102ecf[_0xc426('0x16')],'include':_0x102ecf[_0xc426('0x18')]?_[_0xc426('0x1a')](_0x102ecf[_0xc426('0x18')],function(_0x503802){return{'model':db[_0x503802['model']],'as':_0x503802['as'],'attributes':_0x503802[_0xc426('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc426('0x8')](function(_0x3f767b){logger[_0xc426('0x9')]('GetServicenowAccount',_0x3e3ad4);logger[_0xc426('0xc')](_0xc426('0x12'),_0x3e3ad4,JSON[_0xc426('0xe')](_0x3f767b));_0x49cc88(_0x3f767b);})[_0xc426('0x1b')](function(_0x51da8c){logger[_0xc426('0xf')]('GetServicenowAccount',_0x51da8c[_0xc426('0x11')],_0x3e3ad4);_0x514dde(_0x5c00b7[_0xc426('0xf')](0x1f4,_0x51da8c[_0xc426('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x3f7594){var _0x5b4ba4=this;return new Promise(function(_0x583077,_0x439678){return db[_0xc426('0x1c')][_0xc426('0x1d')]({'raw':_0x3f7594[_0xc426('0x14')]?_0x3f7594['options'][_0xc426('0x1e')]===undefined?!![]:![]:!![],'where':_0x3f7594[_0xc426('0x14')]?_0x3f7594[_0xc426('0x14')][_0xc426('0x15')]||null:null,'attributes':_0x3f7594[_0xc426('0x14')]?_0x3f7594[_0xc426('0x14')][_0xc426('0x16')]||null:null,'include':_0x3f7594[_0xc426('0x14')]?_0x3f7594['options']['include']?_[_0xc426('0x1a')](_0x3f7594['options'][_0xc426('0x18')],function(_0x22b4ff){return{'model':db[_0x22b4ff[_0xc426('0x19')]],'as':_0x22b4ff['as'],'attributes':_0x22b4ff[_0xc426('0x16')],'include':_0x22b4ff[_0xc426('0x18')]?_[_0xc426('0x1a')](_0x22b4ff[_0xc426('0x18')],function(_0x5c1289){return{'model':db[_0x5c1289[_0xc426('0x19')]],'as':_0x5c1289['as'],'attributes':_0x5c1289[_0xc426('0x16')],'include':_0x5c1289[_0xc426('0x18')]?_[_0xc426('0x1a')](_0x5c1289[_0xc426('0x18')],function(_0x527435){return{'model':db[_0x527435[_0xc426('0x19')]],'as':_0x527435['as'],'attributes':_0x527435[_0xc426('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc426('0x8')](function(_0x2fbd2e){logger[_0xc426('0x9')](_0xc426('0x1f'),_0x3f7594);logger[_0xc426('0xc')](_0xc426('0x1f'),_0x3f7594,JSON[_0xc426('0xe')](_0x2fbd2e));_0x583077(_0x2fbd2e);})[_0xc426('0x1b')](function(_0x595764){logger[_0xc426('0xf')](_0xc426('0x1f'),_0x595764[_0xc426('0x11')],_0x3f7594);_0x439678(_0x5b4ba4[_0xc426('0xf')](0x1f4,_0x595764[_0xc426('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 3369052..a99fb1c 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 _0x221b=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x221b,0x11a));var _0xb221=function(_0x1e859d,_0x48e5c2){_0x1e859d=_0x1e859d-0x0;var _0x285fce=_0x221b[_0x1e859d];return _0x285fce;};'use strict';var multer=require('multer');var util=require(_0xb221('0x0'));var path=require('path');var timeout=require(_0xb221('0x1'));var express=require('express');var router=express[_0xb221('0x2')]();var auth=require(_0xb221('0x3'));var interaction=require(_0xb221('0x4'));var config=require(_0xb221('0x5'));var controller=require(_0xb221('0x6'));router[_0xb221('0x7')]('/',auth[_0xb221('0x8')](),controller[_0xb221('0x9')]);router[_0xb221('0x7')](_0xb221('0xa'),auth['isAuthenticated'](),controller[_0xb221('0xb')]);router[_0xb221('0x7')](_0xb221('0xc'),auth['isAuthenticated'](),controller[_0xb221('0xd')]);router[_0xb221('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb221('0xe')]);router[_0xb221('0x7')](_0xb221('0xf'),auth[_0xb221('0x8')](),controller[_0xb221('0x10')]);router['post']('/',auth[_0xb221('0x8')](),controller['create']);router[_0xb221('0x11')](_0xb221('0xa'),auth[_0xb221('0x8')](),controller[_0xb221('0x12')]);router[_0xb221('0x13')](_0xb221('0xa'),auth[_0xb221('0x8')](),controller[_0xb221('0x14')]);module[_0xb221('0x15')]=router; \ No newline at end of file +var _0xd7df=['getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0xd7df,0x19e));var _0xfd7d=function(_0xa9f2ba,_0x4b3982){_0xa9f2ba=_0xa9f2ba-0x0;var _0x5735fe=_0xd7df[_0xa9f2ba];return _0x5735fe;};'use strict';var multer=require(_0xfd7d('0x0'));var util=require(_0xfd7d('0x1'));var path=require(_0xfd7d('0x2'));var timeout=require(_0xfd7d('0x3'));var express=require(_0xfd7d('0x4'));var router=express[_0xfd7d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd7d('0x6'));var config=require(_0xfd7d('0x7'));var controller=require(_0xfd7d('0x8'));router[_0xfd7d('0x9')]('/',auth[_0xfd7d('0xa')](),controller[_0xfd7d('0xb')]);router[_0xfd7d('0x9')](_0xfd7d('0xc'),auth[_0xfd7d('0xa')](),controller[_0xfd7d('0xd')]);router['get'](_0xfd7d('0xe'),auth[_0xfd7d('0xa')](),controller[_0xfd7d('0xf')]);router[_0xfd7d('0x9')]('/:id/subjects',auth[_0xfd7d('0xa')](),controller[_0xfd7d('0x10')]);router[_0xfd7d('0x9')](_0xfd7d('0x11'),auth[_0xfd7d('0xa')](),controller[_0xfd7d('0x12')]);router[_0xfd7d('0x13')]('/',auth[_0xfd7d('0xa')](),controller['create']);router['put'](_0xfd7d('0xc'),auth['isAuthenticated'](),controller[_0xfd7d('0x14')]);router[_0xfd7d('0x15')](_0xfd7d('0xc'),auth[_0xfd7d('0xa')](),controller[_0xfd7d('0x16')]);module[_0xfd7d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 53ad55e..d92a1d3 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 _0x8214=['exports','STRING'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x8214,0x122));var _0x4821=function(_0x4deff1,_0x26fd63){_0x4deff1=_0x4deff1-0x0;var _0x60a4e1=_0x8214[_0x4deff1];return _0x60a4e1;};'use strict';var Sequelize=require('sequelize');module[_0x4821('0x0')]={'name':{'type':Sequelize[_0x4821('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0dc8=['exports','sequelize'];(function(_0x674b9a,_0x51e11a){var _0xff9d1d=function(_0x4c9ee7){while(--_0x4c9ee7){_0x674b9a['push'](_0x674b9a['shift']());}};_0xff9d1d(++_0x51e11a);}(_0x0dc8,0x1a9));var _0x80dc=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x0dc8[_0x18b344];return _0x5ef6bb;};'use strict';var Sequelize=require(_0x80dc('0x0'));module[_0x80dc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index e0b844d..e264a0e 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 _0xa017=['ServicenowConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','filtears','find','create','body','getFields','ServicenowField','getSubjects','getDescriptions','findOne','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x38182b,_0x5dbf8b){var _0x3d6a8c=function(_0x5ee16f){while(--_0x5ee16f){_0x38182b['push'](_0x38182b['shift']());}};_0x3d6a8c(++_0x5dbf8b);}(_0xa017,0x1f1));var _0x7a01=function(_0x1785bf,_0x485813){_0x1785bf=_0x1785bf-0x0;var _0xda5f95=_0xa017[_0x1785bf];return _0xda5f95;};'use strict';var pdf=require(_0x7a01('0x0'));var emlformat=require(_0x7a01('0x1'));var rimraf=require(_0x7a01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a01('0x3'));var moment=require(_0x7a01('0x4'));var BPromise=require(_0x7a01('0x5'));var Mustache=require(_0x7a01('0x6'));var util=require(_0x7a01('0x7'));var path=require(_0x7a01('0x8'));var sox=require(_0x7a01('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7a01('0xa'));var squel=require(_0x7a01('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a01('0xc'));var querystring=require('querystring');var Papa=require(_0x7a01('0xd'));var Redis=require(_0x7a01('0xe'));var authService=require(_0x7a01('0xf'));var qs=require(_0x7a01('0x10'));var as=require(_0x7a01('0x11'));var hardwareService=require(_0x7a01('0x12'));var logger=require(_0x7a01('0x13'))('api');var utils=require(_0x7a01('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7a01('0x15'));var db=require(_0x7a01('0x16'))['db'];var jayson=require(_0x7a01('0x17'));var client=jayson['client'][_0x7a01('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x43025c,_0x17e245,_0x505d46,_0x2781d6){return new BPromise(function(_0xb68cd6,_0x170642){var _0x41274c=_0x2781d6||client;return _0x41274c[_0x7a01('0x19')](_0x43025c,_0x505d46)[_0x7a01('0x1a')](function(_0x4416ab){logger[_0x7a01('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17e245,'request\x20sent');logger['debug'](_0x7a01('0x1c'),_0x17e245,'request\x20sent',JSON[_0x7a01('0x1d')](_0x4416ab));if(_0x4416ab[_0x7a01('0x1e')]){if(_0x4416ab[_0x7a01('0x1e')]['code']===0x1f4){logger[_0x7a01('0x1e')](_0x7a01('0x1f'),_0x17e245,_0x4416ab[_0x7a01('0x1e')]['message']);return _0x170642(_0x4416ab[_0x7a01('0x1e')][_0x7a01('0x20')]);}logger[_0x7a01('0x1e')](_0x7a01('0x1f'),_0x17e245,_0x4416ab[_0x7a01('0x1e')][_0x7a01('0x20')]);return _0xb68cd6(_0x4416ab[_0x7a01('0x1e')][_0x7a01('0x20')]);}else{logger[_0x7a01('0x1b')](_0x7a01('0x1f'),_0x17e245,_0x7a01('0x21'));_0xb68cd6(_0x4416ab[_0x7a01('0x22')][_0x7a01('0x20')]);}})[_0x7a01('0x23')](function(_0x471573){logger[_0x7a01('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x17e245,_0x471573);_0x170642(_0x471573);});});}function respondWithStatusCode(_0x2005bf,_0x5f04bd){_0x5f04bd=_0x5f04bd||0xcc;return function(_0xb60cb2){if(_0xb60cb2){return _0x2005bf[_0x7a01('0x24')](_0x5f04bd);}return _0x2005bf[_0x7a01('0x25')](_0x5f04bd)[_0x7a01('0x26')]();};}function respondWithResult(_0x5732f8,_0x2b647a){_0x2b647a=_0x2b647a||0xc8;return function(_0x6516c4){if(_0x6516c4){return _0x5732f8[_0x7a01('0x25')](_0x2b647a)[_0x7a01('0x27')](_0x6516c4);}};}function respondWithFilteredResult(_0x317fd1,_0xaef2d2){return function(_0x43a77f){if(_0x43a77f){var _0x10d857=_0x43a77f[_0x7a01('0x28')],_0x2f519f=_0xaef2d2[_0x7a01('0x29')],_0x5cfb78=_0xaef2d2[_0x7a01('0x29')]+_0xaef2d2[_0x7a01('0x2a')],_0x4d5374;if(_0x5cfb78>=_0x10d857){_0x5cfb78=_0x10d857;_0x4d5374=0xc8;}else{_0x4d5374=0xce;}_0x317fd1['status'](_0x4d5374);return _0x317fd1[_0x7a01('0x2b')](_0x7a01('0x2c'),_0x2f519f+'-'+_0x5cfb78+'/'+_0x10d857)[_0x7a01('0x27')](_0x43a77f);}return null;};}function patchUpdates(_0x3aa999){return function(_0x1c9c53){try{jsonpatch[_0x7a01('0x2d')](_0x1c9c53,_0x3aa999,!![]);}catch(_0x55b7dc){return BPromise[_0x7a01('0x2e')](_0x55b7dc);}return _0x1c9c53['save']();};}function saveUpdates(_0xca0c9a,_0x4d01be){return function(_0x2bbc28){if(_0x2bbc28){return _0x2bbc28['update'](_0xca0c9a)[_0x7a01('0x1a')](function(_0x54115e){return _0x54115e;});}return null;};}function removeEntity(_0x43ff91,_0x546657){return function(_0x5004b9){if(_0x5004b9){return _0x5004b9[_0x7a01('0x2f')]()[_0x7a01('0x1a')](function(){_0x43ff91[_0x7a01('0x25')](0xcc)[_0x7a01('0x26')]();});}};}function handleEntityNotFound(_0x4f4ae2,_0x561211){return function(_0x2e6f9e){if(!_0x2e6f9e){_0x4f4ae2[_0x7a01('0x24')](0x194);}return _0x2e6f9e;};}function handleError(_0x419213,_0x23281c){_0x23281c=_0x23281c||0x1f4;return function(_0x25ebeb){logger[_0x7a01('0x1e')](_0x25ebeb[_0x7a01('0x30')]);if(_0x25ebeb[_0x7a01('0x31')]){delete _0x25ebeb[_0x7a01('0x31')];}_0x419213[_0x7a01('0x25')](_0x23281c)[_0x7a01('0x32')](_0x25ebeb);};}exports['index']=function(_0xf6b288,_0x259fb6){var _0x3d17c8={},_0x394511={},_0x1b902f={'count':0x0,'rows':[]};var _0x5c8846=_[_0x7a01('0x33')](db[_0x7a01('0x34')][_0x7a01('0x35')],function(_0x87c2da){return{'name':_0x87c2da[_0x7a01('0x36')],'type':_0x87c2da[_0x7a01('0x37')][_0x7a01('0x38')]};});_0x394511[_0x7a01('0x39')]=_['map'](_0x5c8846,_0x7a01('0x31'));_0x394511['query']=_[_0x7a01('0x3a')](_0xf6b288[_0x7a01('0x3b')]);_0x394511['filters']=_[_0x7a01('0x3c')](_0x394511[_0x7a01('0x39')],_0x394511['query']);_0x3d17c8[_0x7a01('0x3d')]=_[_0x7a01('0x3c')](_0x394511[_0x7a01('0x39')],qs[_0x7a01('0x3e')](_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x3e')]));_0x3d17c8[_0x7a01('0x3d')]=_0x3d17c8['attributes'][_0x7a01('0x3f')]?_0x3d17c8[_0x7a01('0x3d')]:_0x394511[_0x7a01('0x39')];if(!_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x40')](_0x7a01('0x41'))){_0x3d17c8['limit']=qs[_0x7a01('0x2a')](_0xf6b288[_0x7a01('0x3b')]['limit']);_0x3d17c8['offset']=qs['offset'](_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x29')]);}_0x3d17c8[_0x7a01('0x42')]=qs['sort'](_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x43')]);_0x3d17c8['where']=qs[_0x7a01('0x44')](_[_0x7a01('0x45')](_0xf6b288[_0x7a01('0x3b')],_0x394511[_0x7a01('0x44')]),_0x5c8846);if(_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x46')]){_0x3d17c8[_0x7a01('0x47')]=_[_0x7a01('0x48')](_0x3d17c8[_0x7a01('0x47')],{'$or':_[_0x7a01('0x33')](_0x5c8846,function(_0xd47ce5){if(_0xd47ce5[_0x7a01('0x37')]!==_0x7a01('0x49')){var _0x11f7e5={};_0x11f7e5[_0xd47ce5[_0x7a01('0x31')]]={'$like':'%'+_0xf6b288['query'][_0x7a01('0x46')]+'%'};return _0x11f7e5;}})});}_0x3d17c8=_['merge']({},_0x3d17c8,_0xf6b288[_0x7a01('0x4a')]);var _0x2ff2be={'where':_0x3d17c8[_0x7a01('0x47')]};return db[_0x7a01('0x34')][_0x7a01('0x28')](_0x2ff2be)[_0x7a01('0x1a')](function(_0x4be5c7){_0x1b902f['count']=_0x4be5c7;if(_0xf6b288[_0x7a01('0x3b')][_0x7a01('0x4b')]){_0x3d17c8[_0x7a01('0x4c')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x3d17c8);})[_0x7a01('0x1a')](function(_0x3931c6){_0x1b902f[_0x7a01('0x4d')]=_0x3931c6;return _0x1b902f;})[_0x7a01('0x1a')](respondWithFilteredResult(_0x259fb6,_0x3d17c8))[_0x7a01('0x23')](handleError(_0x259fb6,null));};exports['show']=function(_0x3e4dcb,_0x537baa){var _0x454abf={'raw':![],'where':{'id':_0x3e4dcb[_0x7a01('0x4e')]['id']}},_0x139da0={};_0x139da0[_0x7a01('0x39')]=_['keys'](db[_0x7a01('0x34')][_0x7a01('0x35')]);_0x139da0[_0x7a01('0x3b')]=_[_0x7a01('0x3a')](_0x3e4dcb[_0x7a01('0x3b')]);_0x139da0[_0x7a01('0x4f')]=_['intersection'](_0x139da0['model'],_0x139da0['query']);_0x454abf[_0x7a01('0x3d')]=_['intersection'](_0x139da0[_0x7a01('0x39')],qs[_0x7a01('0x3e')](_0x3e4dcb[_0x7a01('0x3b')][_0x7a01('0x3e')]));_0x454abf[_0x7a01('0x3d')]=_0x454abf['attributes'][_0x7a01('0x3f')]?_0x454abf[_0x7a01('0x3d')]:_0x139da0[_0x7a01('0x39')];if(_0x3e4dcb['query'][_0x7a01('0x4b')]){_0x454abf[_0x7a01('0x4c')]=[{'all':!![]}];}_0x454abf=_['merge']({},_0x454abf,_0x3e4dcb[_0x7a01('0x4a')]);return db[_0x7a01('0x34')][_0x7a01('0x50')](_0x454abf)[_0x7a01('0x1a')](handleEntityNotFound(_0x537baa,null))[_0x7a01('0x1a')](respondWithResult(_0x537baa,null))[_0x7a01('0x23')](handleError(_0x537baa,null));};exports[_0x7a01('0x51')]=function(_0x170cae,_0x26f9dc){return db[_0x7a01('0x34')]['create'](_0x170cae[_0x7a01('0x52')],{})[_0x7a01('0x1a')](respondWithResult(_0x26f9dc,0xc9))['catch'](handleError(_0x26f9dc,null));};exports['update']=function(_0x1ebfe4,_0x569d69){if(_0x1ebfe4[_0x7a01('0x52')]['id']){delete _0x1ebfe4[_0x7a01('0x52')]['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x1ebfe4[_0x7a01('0x4e')]['id']}})[_0x7a01('0x1a')](handleEntityNotFound(_0x569d69,null))[_0x7a01('0x1a')](saveUpdates(_0x1ebfe4[_0x7a01('0x52')],null))[_0x7a01('0x1a')](respondWithResult(_0x569d69,null))[_0x7a01('0x23')](handleError(_0x569d69,null));};exports[_0x7a01('0x2f')]=function(_0x568233,_0x2cad3f){return db[_0x7a01('0x34')]['find']({'where':{'id':_0x568233['params']['id']}})[_0x7a01('0x1a')](handleEntityNotFound(_0x2cad3f,null))[_0x7a01('0x1a')](removeEntity(_0x2cad3f,null))[_0x7a01('0x23')](handleError(_0x2cad3f,null));};exports[_0x7a01('0x53')]=function(_0x384893,_0x51844d,_0x52bb78){var _0x4264d2={};var _0x97f94c={};var _0x4615a5;var _0x42f2fa;return db[_0x7a01('0x34')]['findOne']({'where':{'id':_0x384893[_0x7a01('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51844d,null))['then'](function(_0x56fbcc){if(_0x56fbcc){_0x4615a5=_0x56fbcc;_0x97f94c[_0x7a01('0x39')]=_['keys'](db[_0x7a01('0x54')][_0x7a01('0x35')]);_0x97f94c[_0x7a01('0x3b')]=_['keys'](_0x384893[_0x7a01('0x3b')]);_0x97f94c[_0x7a01('0x44')]=_[_0x7a01('0x3c')](_0x97f94c[_0x7a01('0x39')],_0x97f94c[_0x7a01('0x3b')]);_0x4264d2['attributes']=_['intersection'](_0x97f94c[_0x7a01('0x39')],qs[_0x7a01('0x3e')](_0x384893[_0x7a01('0x3b')][_0x7a01('0x3e')]));_0x4264d2[_0x7a01('0x3d')]=_0x4264d2[_0x7a01('0x3d')][_0x7a01('0x3f')]?_0x4264d2[_0x7a01('0x3d')]:_0x97f94c[_0x7a01('0x39')];_0x4264d2[_0x7a01('0x42')]=qs[_0x7a01('0x43')](_0x384893['query'][_0x7a01('0x43')]);_0x4264d2[_0x7a01('0x47')]=qs[_0x7a01('0x44')](_[_0x7a01('0x45')](_0x384893[_0x7a01('0x3b')],_0x97f94c['filters']));if(_0x384893['query'][_0x7a01('0x46')]){_0x4264d2[_0x7a01('0x47')]=_['merge'](_0x4264d2[_0x7a01('0x47')],{'$or':_[_0x7a01('0x33')](_0x4264d2[_0x7a01('0x3d')],function(_0xa9d8fd){var _0x2ea68e={};_0x2ea68e[_0xa9d8fd]={'$like':'%'+_0x384893[_0x7a01('0x3b')][_0x7a01('0x46')]+'%'};return _0x2ea68e;})});}_0x4264d2=_[_0x7a01('0x48')]({},_0x4264d2,_0x384893[_0x7a01('0x4a')]);return _0x4615a5[_0x7a01('0x53')](_0x4264d2);}})[_0x7a01('0x1a')](function(_0x139fe1){if(_0x139fe1){_0x42f2fa=_0x139fe1[_0x7a01('0x3f')];if(!_0x384893[_0x7a01('0x3b')][_0x7a01('0x40')](_0x7a01('0x41'))){_0x4264d2[_0x7a01('0x2a')]=qs['limit'](_0x384893['query'][_0x7a01('0x2a')]);_0x4264d2[_0x7a01('0x29')]=qs[_0x7a01('0x29')](_0x384893[_0x7a01('0x3b')]['offset']);}return _0x4615a5[_0x7a01('0x53')](_0x4264d2);}})[_0x7a01('0x1a')](function(_0x2702f6){if(_0x2702f6){return _0x2702f6?{'count':_0x42f2fa,'rows':_0x2702f6}:null;}})[_0x7a01('0x1a')](respondWithResult(_0x51844d,null))['catch'](handleError(_0x51844d,null));};exports[_0x7a01('0x55')]=function(_0x1333d7,_0x320d1e,_0x4bd25d){var _0x3289bd={};var _0x4eb1c5={};var _0x134049;var _0x54da49;return db[_0x7a01('0x34')]['findOne']({'where':{'id':_0x1333d7[_0x7a01('0x4e')]['id']}})[_0x7a01('0x1a')](handleEntityNotFound(_0x320d1e,null))['then'](function(_0x4ba28c){if(_0x4ba28c){_0x134049=_0x4ba28c;_0x4eb1c5[_0x7a01('0x39')]=_[_0x7a01('0x3a')](db[_0x7a01('0x54')]['rawAttributes']);_0x4eb1c5['query']=_[_0x7a01('0x3a')](_0x1333d7[_0x7a01('0x3b')]);_0x4eb1c5[_0x7a01('0x44')]=_['intersection'](_0x4eb1c5['model'],_0x4eb1c5['query']);_0x3289bd[_0x7a01('0x3d')]=_['intersection'](_0x4eb1c5[_0x7a01('0x39')],qs[_0x7a01('0x3e')](_0x1333d7[_0x7a01('0x3b')][_0x7a01('0x3e')]));_0x3289bd[_0x7a01('0x3d')]=_0x3289bd[_0x7a01('0x3d')][_0x7a01('0x3f')]?_0x3289bd[_0x7a01('0x3d')]:_0x4eb1c5['model'];_0x3289bd['order']=qs['sort'](_0x1333d7['query']['sort']);_0x3289bd['where']=qs[_0x7a01('0x44')](_[_0x7a01('0x45')](_0x1333d7[_0x7a01('0x3b')],_0x4eb1c5[_0x7a01('0x44')]));if(_0x1333d7[_0x7a01('0x3b')][_0x7a01('0x46')]){_0x3289bd[_0x7a01('0x47')]=_['merge'](_0x3289bd[_0x7a01('0x47')],{'$or':_[_0x7a01('0x33')](_0x3289bd[_0x7a01('0x3d')],function(_0x155871){var _0xafa10d={};_0xafa10d[_0x155871]={'$like':'%'+_0x1333d7['query'][_0x7a01('0x46')]+'%'};return _0xafa10d;})});}_0x3289bd=_[_0x7a01('0x48')]({},_0x3289bd,_0x1333d7[_0x7a01('0x4a')]);return _0x134049[_0x7a01('0x55')](_0x3289bd);}})[_0x7a01('0x1a')](function(_0x5b345a){if(_0x5b345a){_0x54da49=_0x5b345a['length'];if(!_0x1333d7[_0x7a01('0x3b')]['hasOwnProperty']('nolimit')){_0x3289bd[_0x7a01('0x2a')]=qs[_0x7a01('0x2a')](_0x1333d7[_0x7a01('0x3b')][_0x7a01('0x2a')]);_0x3289bd[_0x7a01('0x29')]=qs[_0x7a01('0x29')](_0x1333d7[_0x7a01('0x3b')][_0x7a01('0x29')]);}return _0x134049[_0x7a01('0x55')](_0x3289bd);}})[_0x7a01('0x1a')](function(_0xaa40c5){if(_0xaa40c5){return _0xaa40c5?{'count':_0x54da49,'rows':_0xaa40c5}:null;}})['then'](respondWithResult(_0x320d1e,null))[_0x7a01('0x23')](handleError(_0x320d1e,null));};exports[_0x7a01('0x56')]=function(_0x5a7a0c,_0x17b91b,_0x53bb05){var _0xb606c2={};var _0xbe615a={};var _0x3409eb;var _0x109dbb;return db[_0x7a01('0x34')][_0x7a01('0x57')]({'where':{'id':_0x5a7a0c[_0x7a01('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17b91b,null))[_0x7a01('0x1a')](function(_0x3c2ee5){if(_0x3c2ee5){_0x3409eb=_0x3c2ee5;_0xbe615a[_0x7a01('0x39')]=_['keys'](db[_0x7a01('0x54')][_0x7a01('0x35')]);_0xbe615a[_0x7a01('0x3b')]=_[_0x7a01('0x3a')](_0x5a7a0c[_0x7a01('0x3b')]);_0xbe615a[_0x7a01('0x44')]=_['intersection'](_0xbe615a[_0x7a01('0x39')],_0xbe615a[_0x7a01('0x3b')]);_0xb606c2[_0x7a01('0x3d')]=_[_0x7a01('0x3c')](_0xbe615a[_0x7a01('0x39')],qs[_0x7a01('0x3e')](_0x5a7a0c['query'][_0x7a01('0x3e')]));_0xb606c2['attributes']=_0xb606c2[_0x7a01('0x3d')][_0x7a01('0x3f')]?_0xb606c2[_0x7a01('0x3d')]:_0xbe615a['model'];_0xb606c2['order']=qs['sort'](_0x5a7a0c[_0x7a01('0x3b')][_0x7a01('0x43')]);_0xb606c2[_0x7a01('0x47')]=qs[_0x7a01('0x44')](_['pick'](_0x5a7a0c[_0x7a01('0x3b')],_0xbe615a[_0x7a01('0x44')]));if(_0x5a7a0c[_0x7a01('0x3b')][_0x7a01('0x46')]){_0xb606c2[_0x7a01('0x47')]=_['merge'](_0xb606c2['where'],{'$or':_[_0x7a01('0x33')](_0xb606c2['attributes'],function(_0x50cbd2){var _0x255fce={};_0x255fce[_0x50cbd2]={'$like':'%'+_0x5a7a0c['query']['filter']+'%'};return _0x255fce;})});}_0xb606c2=_[_0x7a01('0x48')]({},_0xb606c2,_0x5a7a0c[_0x7a01('0x4a')]);return _0x3409eb[_0x7a01('0x56')](_0xb606c2);}})['then'](function(_0xc4220a){if(_0xc4220a){_0x109dbb=_0xc4220a[_0x7a01('0x3f')];if(!_0x5a7a0c[_0x7a01('0x3b')]['hasOwnProperty'](_0x7a01('0x41'))){_0xb606c2['limit']=qs[_0x7a01('0x2a')](_0x5a7a0c[_0x7a01('0x3b')][_0x7a01('0x2a')]);_0xb606c2[_0x7a01('0x29')]=qs['offset'](_0x5a7a0c['query'][_0x7a01('0x29')]);}return _0x3409eb[_0x7a01('0x56')](_0xb606c2);}})[_0x7a01('0x1a')](function(_0x5bfd23){if(_0x5bfd23){return _0x5bfd23?{'count':_0x109dbb,'rows':_0x5bfd23}:null;}})[_0x7a01('0x1a')](respondWithResult(_0x17b91b,null))[_0x7a01('0x23')](handleError(_0x17b91b,null));}; \ No newline at end of file +var _0x110e=['hasOwnProperty','nolimit','limit','sort','where','merge','filter','include','findAll','params','includeAll','find','create','body','destroy','findOne','ServicenowField','order','pick','options','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','apply','reject','update','then','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length'];(function(_0x4c090d,_0x221466){var _0x5c7601=function(_0x370270){while(--_0x370270){_0x4c090d['push'](_0x4c090d['shift']());}};_0x5c7601(++_0x221466);}(_0x110e,0x68));var _0xe110=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x110e[_0x2e4e19];return _0x9ba20b;};'use strict';var pdf=require(_0xe110('0x0'));var emlformat=require(_0xe110('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe110('0x2'));var jsonpatch=require(_0xe110('0x3'));var rp=require(_0xe110('0x4'));var moment=require(_0xe110('0x5'));var BPromise=require(_0xe110('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe110('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe110('0x8'));var squel=require(_0xe110('0x9'));var crypto=require(_0xe110('0xa'));var jsforce=require(_0xe110('0xb'));var deskjs=require(_0xe110('0xc'));var toCsv=require(_0xe110('0x7'));var querystring=require(_0xe110('0xd'));var Papa=require(_0xe110('0xe'));var Redis=require(_0xe110('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe110('0x10'));var as=require(_0xe110('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe110('0x12'))(_0xe110('0x13'));var utils=require(_0xe110('0x14'));var config=require(_0xe110('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xe110('0x16')][_0xe110('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x52ea99,_0x4aef00,_0x482022,_0x3acdbb){return new BPromise(function(_0x2719c0,_0x4ffdfe){var _0x596dcf=_0x3acdbb||client;return _0x596dcf[_0xe110('0x18')](_0x52ea99,_0x482022)['then'](function(_0x4653bb){logger[_0xe110('0x19')](_0xe110('0x1a'),_0x4aef00,_0xe110('0x1b'));logger['debug'](_0xe110('0x1c'),_0x4aef00,_0xe110('0x1b'),JSON['stringify'](_0x4653bb));if(_0x4653bb['error']){if(_0x4653bb[_0xe110('0x1d')]['code']===0x1f4){logger[_0xe110('0x1d')](_0xe110('0x1a'),_0x4aef00,_0x4653bb['error'][_0xe110('0x1e')]);return _0x4ffdfe(_0x4653bb[_0xe110('0x1d')][_0xe110('0x1e')]);}logger[_0xe110('0x1d')](_0xe110('0x1a'),_0x4aef00,_0x4653bb['error'][_0xe110('0x1e')]);return _0x2719c0(_0x4653bb[_0xe110('0x1d')]['message']);}else{logger[_0xe110('0x19')](_0xe110('0x1a'),_0x4aef00,_0xe110('0x1b'));_0x2719c0(_0x4653bb[_0xe110('0x1f')][_0xe110('0x1e')]);}})[_0xe110('0x20')](function(_0xba7b71){logger[_0xe110('0x1d')](_0xe110('0x1a'),_0x4aef00,_0xba7b71);_0x4ffdfe(_0xba7b71);});});}function respondWithStatusCode(_0x100697,_0x2cef74){_0x2cef74=_0x2cef74||0xcc;return function(_0x4b08ff){if(_0x4b08ff){return _0x100697[_0xe110('0x21')](_0x2cef74);}return _0x100697[_0xe110('0x22')](_0x2cef74)[_0xe110('0x23')]();};}function respondWithResult(_0x43f14d,_0x374ccf){_0x374ccf=_0x374ccf||0xc8;return function(_0x4dc77b){if(_0x4dc77b){return _0x43f14d['status'](_0x374ccf)[_0xe110('0x24')](_0x4dc77b);}};}function respondWithFilteredResult(_0x5be7a7,_0x3a5362){return function(_0x578464){if(_0x578464){var _0x51a530=_0x578464['count'],_0x5a67cd=_0x3a5362[_0xe110('0x25')],_0x55f8ae=_0x3a5362[_0xe110('0x25')]+_0x3a5362['limit'],_0x3ec248;if(_0x55f8ae>=_0x51a530){_0x55f8ae=_0x51a530;_0x3ec248=0xc8;}else{_0x3ec248=0xce;}_0x5be7a7['status'](_0x3ec248);return _0x5be7a7['set']('Content-Range',_0x5a67cd+'-'+_0x55f8ae+'/'+_0x51a530)['json'](_0x578464);}return null;};}function patchUpdates(_0x3e5603){return function(_0x2de4cd){try{jsonpatch[_0xe110('0x26')](_0x2de4cd,_0x3e5603,!![]);}catch(_0xe086f6){return BPromise[_0xe110('0x27')](_0xe086f6);}return _0x2de4cd['save']();};}function saveUpdates(_0x45a3f9,_0x53e1d3){return function(_0x1da4b4){if(_0x1da4b4){return _0x1da4b4[_0xe110('0x28')](_0x45a3f9)[_0xe110('0x29')](function(_0x4cd799){return _0x4cd799;});}return null;};}function removeEntity(_0x2e5af1,_0x20803b){return function(_0x2e0ca0){if(_0x2e0ca0){return _0x2e0ca0['destroy']()['then'](function(){_0x2e5af1['status'](0xcc)[_0xe110('0x23')]();});}};}function handleEntityNotFound(_0x3ec2f4,_0x34eedf){return function(_0xe7207a){if(!_0xe7207a){_0x3ec2f4[_0xe110('0x21')](0x194);}return _0xe7207a;};}function handleError(_0x36c426,_0x27554a){_0x27554a=_0x27554a||0x1f4;return function(_0x563a08){logger[_0xe110('0x1d')](_0x563a08['stack']);if(_0x563a08[_0xe110('0x2a')]){delete _0x563a08['name'];}_0x36c426[_0xe110('0x22')](_0x27554a)['send'](_0x563a08);};}exports[_0xe110('0x2b')]=function(_0x5031c6,_0x577aae){var _0x370c38={},_0xc45e0d={},_0x1786a2={'count':0x0,'rows':[]};var _0x57c8b3=_['map'](db[_0xe110('0x2c')][_0xe110('0x2d')],function(_0x50a07b){return{'name':_0x50a07b[_0xe110('0x2e')],'type':_0x50a07b[_0xe110('0x2f')][_0xe110('0x30')]};});_0xc45e0d[_0xe110('0x31')]=_[_0xe110('0x32')](_0x57c8b3,_0xe110('0x2a'));_0xc45e0d[_0xe110('0x33')]=_[_0xe110('0x34')](_0x5031c6[_0xe110('0x33')]);_0xc45e0d[_0xe110('0x35')]=_['intersection'](_0xc45e0d[_0xe110('0x31')],_0xc45e0d[_0xe110('0x33')]);_0x370c38[_0xe110('0x36')]=_[_0xe110('0x37')](_0xc45e0d[_0xe110('0x31')],qs[_0xe110('0x38')](_0x5031c6[_0xe110('0x33')][_0xe110('0x38')]));_0x370c38[_0xe110('0x36')]=_0x370c38[_0xe110('0x36')][_0xe110('0x39')]?_0x370c38[_0xe110('0x36')]:_0xc45e0d[_0xe110('0x31')];if(!_0x5031c6['query'][_0xe110('0x3a')](_0xe110('0x3b'))){_0x370c38[_0xe110('0x3c')]=qs[_0xe110('0x3c')](_0x5031c6['query'][_0xe110('0x3c')]);_0x370c38[_0xe110('0x25')]=qs['offset'](_0x5031c6['query'][_0xe110('0x25')]);}_0x370c38['order']=qs[_0xe110('0x3d')](_0x5031c6[_0xe110('0x33')][_0xe110('0x3d')]);_0x370c38[_0xe110('0x3e')]=qs[_0xe110('0x35')](_['pick'](_0x5031c6[_0xe110('0x33')],_0xc45e0d[_0xe110('0x35')]),_0x57c8b3);if(_0x5031c6[_0xe110('0x33')]['filter']){_0x370c38[_0xe110('0x3e')]=_[_0xe110('0x3f')](_0x370c38['where'],{'$or':_[_0xe110('0x32')](_0x57c8b3,function(_0x449b36){if(_0x449b36[_0xe110('0x2f')]!=='VIRTUAL'){var _0x3e5f8f={};_0x3e5f8f[_0x449b36[_0xe110('0x2a')]]={'$like':'%'+_0x5031c6['query'][_0xe110('0x40')]+'%'};return _0x3e5f8f;}})});}_0x370c38=_['merge']({},_0x370c38,_0x5031c6['options']);var _0x2115c0={'where':_0x370c38['where']};return db[_0xe110('0x2c')]['count'](_0x2115c0)['then'](function(_0x10768e){_0x1786a2['count']=_0x10768e;if(_0x5031c6['query']['includeAll']){_0x370c38[_0xe110('0x41')]=[{'all':!![]}];}return db[_0xe110('0x2c')][_0xe110('0x42')](_0x370c38);})[_0xe110('0x29')](function(_0x1be128){_0x1786a2['rows']=_0x1be128;return _0x1786a2;})[_0xe110('0x29')](respondWithFilteredResult(_0x577aae,_0x370c38))[_0xe110('0x20')](handleError(_0x577aae,null));};exports['show']=function(_0xd9f3f7,_0x4e67fc){var _0x2de907={'raw':![],'where':{'id':_0xd9f3f7[_0xe110('0x43')]['id']}},_0x237cd8={};_0x237cd8[_0xe110('0x31')]=_[_0xe110('0x34')](db[_0xe110('0x2c')][_0xe110('0x2d')]);_0x237cd8[_0xe110('0x33')]=_[_0xe110('0x34')](_0xd9f3f7[_0xe110('0x33')]);_0x237cd8['filtears']=_['intersection'](_0x237cd8['model'],_0x237cd8[_0xe110('0x33')]);_0x2de907[_0xe110('0x36')]=_['intersection'](_0x237cd8['model'],qs[_0xe110('0x38')](_0xd9f3f7['query'][_0xe110('0x38')]));_0x2de907[_0xe110('0x36')]=_0x2de907[_0xe110('0x36')]['length']?_0x2de907[_0xe110('0x36')]:_0x237cd8['model'];if(_0xd9f3f7['query'][_0xe110('0x44')]){_0x2de907[_0xe110('0x41')]=[{'all':!![]}];}_0x2de907=_[_0xe110('0x3f')]({},_0x2de907,_0xd9f3f7['options']);return db[_0xe110('0x2c')][_0xe110('0x45')](_0x2de907)[_0xe110('0x29')](handleEntityNotFound(_0x4e67fc,null))[_0xe110('0x29')](respondWithResult(_0x4e67fc,null))['catch'](handleError(_0x4e67fc,null));};exports[_0xe110('0x46')]=function(_0x4ad6a9,_0x3a5ca3){return db[_0xe110('0x2c')][_0xe110('0x46')](_0x4ad6a9[_0xe110('0x47')],{})[_0xe110('0x29')](respondWithResult(_0x3a5ca3,0xc9))[_0xe110('0x20')](handleError(_0x3a5ca3,null));};exports[_0xe110('0x28')]=function(_0x51feb4,_0x5288ce){if(_0x51feb4[_0xe110('0x47')]['id']){delete _0x51feb4['body']['id'];}return db[_0xe110('0x2c')][_0xe110('0x45')]({'where':{'id':_0x51feb4['params']['id']}})['then'](handleEntityNotFound(_0x5288ce,null))[_0xe110('0x29')](saveUpdates(_0x51feb4[_0xe110('0x47')],null))[_0xe110('0x29')](respondWithResult(_0x5288ce,null))[_0xe110('0x20')](handleError(_0x5288ce,null));};exports[_0xe110('0x48')]=function(_0x4670b1,_0x2cd0db){return db[_0xe110('0x2c')][_0xe110('0x45')]({'where':{'id':_0x4670b1[_0xe110('0x43')]['id']}})[_0xe110('0x29')](handleEntityNotFound(_0x2cd0db,null))[_0xe110('0x29')](removeEntity(_0x2cd0db,null))[_0xe110('0x20')](handleError(_0x2cd0db,null));};exports['getFields']=function(_0x29837c,_0x566fa8,_0x22f874){var _0x301678={};var _0x594772={};var _0x4a270e;var _0x1e03ca;return db['ServicenowConfiguration'][_0xe110('0x49')]({'where':{'id':_0x29837c[_0xe110('0x43')]['id']}})['then'](handleEntityNotFound(_0x566fa8,null))['then'](function(_0x47147a){if(_0x47147a){_0x4a270e=_0x47147a;_0x594772['model']=_[_0xe110('0x34')](db[_0xe110('0x4a')][_0xe110('0x2d')]);_0x594772[_0xe110('0x33')]=_[_0xe110('0x34')](_0x29837c[_0xe110('0x33')]);_0x594772[_0xe110('0x35')]=_[_0xe110('0x37')](_0x594772[_0xe110('0x31')],_0x594772['query']);_0x301678[_0xe110('0x36')]=_[_0xe110('0x37')](_0x594772[_0xe110('0x31')],qs[_0xe110('0x38')](_0x29837c['query']['fields']));_0x301678[_0xe110('0x36')]=_0x301678[_0xe110('0x36')][_0xe110('0x39')]?_0x301678['attributes']:_0x594772[_0xe110('0x31')];_0x301678[_0xe110('0x4b')]=qs['sort'](_0x29837c[_0xe110('0x33')][_0xe110('0x3d')]);_0x301678['where']=qs['filters'](_[_0xe110('0x4c')](_0x29837c['query'],_0x594772[_0xe110('0x35')]));if(_0x29837c[_0xe110('0x33')][_0xe110('0x40')]){_0x301678[_0xe110('0x3e')]=_[_0xe110('0x3f')](_0x301678[_0xe110('0x3e')],{'$or':_[_0xe110('0x32')](_0x301678[_0xe110('0x36')],function(_0x591561){var _0x3ded64={};_0x3ded64[_0x591561]={'$like':'%'+_0x29837c['query'][_0xe110('0x40')]+'%'};return _0x3ded64;})});}_0x301678=_['merge']({},_0x301678,_0x29837c[_0xe110('0x4d')]);return _0x4a270e['getFields'](_0x301678);}})['then'](function(_0x3c7bac){if(_0x3c7bac){_0x1e03ca=_0x3c7bac[_0xe110('0x39')];if(!_0x29837c[_0xe110('0x33')][_0xe110('0x3a')](_0xe110('0x3b'))){_0x301678['limit']=qs[_0xe110('0x3c')](_0x29837c[_0xe110('0x33')][_0xe110('0x3c')]);_0x301678['offset']=qs[_0xe110('0x25')](_0x29837c[_0xe110('0x33')][_0xe110('0x25')]);}return _0x4a270e[_0xe110('0x4e')](_0x301678);}})[_0xe110('0x29')](function(_0x494f84){if(_0x494f84){return _0x494f84?{'count':_0x1e03ca,'rows':_0x494f84}:null;}})[_0xe110('0x29')](respondWithResult(_0x566fa8,null))[_0xe110('0x20')](handleError(_0x566fa8,null));};exports[_0xe110('0x4f')]=function(_0xf6b55d,_0x2962eb,_0x5aa70d){var _0x53d5e3={};var _0x166074={};var _0x4234d9;var _0x540c22;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xf6b55d[_0xe110('0x43')]['id']}})[_0xe110('0x29')](handleEntityNotFound(_0x2962eb,null))[_0xe110('0x29')](function(_0x249ca9){if(_0x249ca9){_0x4234d9=_0x249ca9;_0x166074[_0xe110('0x31')]=_[_0xe110('0x34')](db['ServicenowField']['rawAttributes']);_0x166074[_0xe110('0x33')]=_[_0xe110('0x34')](_0xf6b55d[_0xe110('0x33')]);_0x166074[_0xe110('0x35')]=_[_0xe110('0x37')](_0x166074[_0xe110('0x31')],_0x166074['query']);_0x53d5e3[_0xe110('0x36')]=_[_0xe110('0x37')](_0x166074['model'],qs[_0xe110('0x38')](_0xf6b55d['query'][_0xe110('0x38')]));_0x53d5e3[_0xe110('0x36')]=_0x53d5e3['attributes'][_0xe110('0x39')]?_0x53d5e3['attributes']:_0x166074[_0xe110('0x31')];_0x53d5e3[_0xe110('0x4b')]=qs[_0xe110('0x3d')](_0xf6b55d[_0xe110('0x33')][_0xe110('0x3d')]);_0x53d5e3[_0xe110('0x3e')]=qs['filters'](_[_0xe110('0x4c')](_0xf6b55d[_0xe110('0x33')],_0x166074['filters']));if(_0xf6b55d[_0xe110('0x33')][_0xe110('0x40')]){_0x53d5e3[_0xe110('0x3e')]=_['merge'](_0x53d5e3[_0xe110('0x3e')],{'$or':_['map'](_0x53d5e3[_0xe110('0x36')],function(_0x2fe0ff){var _0x37616d={};_0x37616d[_0x2fe0ff]={'$like':'%'+_0xf6b55d[_0xe110('0x33')][_0xe110('0x40')]+'%'};return _0x37616d;})});}_0x53d5e3=_['merge']({},_0x53d5e3,_0xf6b55d['options']);return _0x4234d9[_0xe110('0x4f')](_0x53d5e3);}})[_0xe110('0x29')](function(_0x1152ef){if(_0x1152ef){_0x540c22=_0x1152ef[_0xe110('0x39')];if(!_0xf6b55d[_0xe110('0x33')]['hasOwnProperty'](_0xe110('0x3b'))){_0x53d5e3['limit']=qs[_0xe110('0x3c')](_0xf6b55d[_0xe110('0x33')][_0xe110('0x3c')]);_0x53d5e3[_0xe110('0x25')]=qs[_0xe110('0x25')](_0xf6b55d[_0xe110('0x33')][_0xe110('0x25')]);}return _0x4234d9['getSubjects'](_0x53d5e3);}})[_0xe110('0x29')](function(_0x12cac2){if(_0x12cac2){return _0x12cac2?{'count':_0x540c22,'rows':_0x12cac2}:null;}})[_0xe110('0x29')](respondWithResult(_0x2962eb,null))['catch'](handleError(_0x2962eb,null));};exports[_0xe110('0x50')]=function(_0x134179,_0x440dfe,_0xbcae98){var _0x3704ff={};var _0x93ec12={};var _0x27d577;var _0x2837a7;return db[_0xe110('0x2c')]['findOne']({'where':{'id':_0x134179[_0xe110('0x43')]['id']}})[_0xe110('0x29')](handleEntityNotFound(_0x440dfe,null))[_0xe110('0x29')](function(_0x190a3a){if(_0x190a3a){_0x27d577=_0x190a3a;_0x93ec12[_0xe110('0x31')]=_[_0xe110('0x34')](db[_0xe110('0x4a')][_0xe110('0x2d')]);_0x93ec12['query']=_['keys'](_0x134179[_0xe110('0x33')]);_0x93ec12['filters']=_[_0xe110('0x37')](_0x93ec12[_0xe110('0x31')],_0x93ec12['query']);_0x3704ff[_0xe110('0x36')]=_[_0xe110('0x37')](_0x93ec12['model'],qs[_0xe110('0x38')](_0x134179[_0xe110('0x33')][_0xe110('0x38')]));_0x3704ff['attributes']=_0x3704ff[_0xe110('0x36')][_0xe110('0x39')]?_0x3704ff[_0xe110('0x36')]:_0x93ec12['model'];_0x3704ff[_0xe110('0x4b')]=qs[_0xe110('0x3d')](_0x134179['query'][_0xe110('0x3d')]);_0x3704ff[_0xe110('0x3e')]=qs[_0xe110('0x35')](_[_0xe110('0x4c')](_0x134179['query'],_0x93ec12[_0xe110('0x35')]));if(_0x134179['query']['filter']){_0x3704ff['where']=_[_0xe110('0x3f')](_0x3704ff[_0xe110('0x3e')],{'$or':_[_0xe110('0x32')](_0x3704ff['attributes'],function(_0x49a429){var _0x662023={};_0x662023[_0x49a429]={'$like':'%'+_0x134179[_0xe110('0x33')][_0xe110('0x40')]+'%'};return _0x662023;})});}_0x3704ff=_['merge']({},_0x3704ff,_0x134179[_0xe110('0x4d')]);return _0x27d577[_0xe110('0x50')](_0x3704ff);}})[_0xe110('0x29')](function(_0x15e97f){if(_0x15e97f){_0x2837a7=_0x15e97f['length'];if(!_0x134179[_0xe110('0x33')]['hasOwnProperty']('nolimit')){_0x3704ff[_0xe110('0x3c')]=qs[_0xe110('0x3c')](_0x134179[_0xe110('0x33')][_0xe110('0x3c')]);_0x3704ff[_0xe110('0x25')]=qs[_0xe110('0x25')](_0x134179[_0xe110('0x33')][_0xe110('0x25')]);}return _0x27d577[_0xe110('0x50')](_0x3704ff);}})[_0xe110('0x29')](function(_0x2386d6){if(_0x2386d6){return _0x2386d6?{'count':_0x2837a7,'rows':_0x2386d6}:null;}})[_0xe110('0x29')](respondWithResult(_0x440dfe,null))[_0xe110('0x20')](handleError(_0x440dfe,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 7f9b55d..5c1fd6d 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 _0x38b4=['define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x4a48e5,_0x7f651b){var _0x208c7d=function(_0x24f2e3){while(--_0x24f2e3){_0x4a48e5['push'](_0x4a48e5['shift']());}};_0x208c7d(++_0x7f651b);}(_0x38b4,0xae));var _0x438b=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x38b4[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x438b('0x0'));var logger=require(_0x438b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x438b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x438b('0x3'));var config=require(_0x438b('0x4'));var attributes=require(_0x438b('0x5'));module['exports']=function(_0x3882f9,_0x3da54a){return _0x3882f9[_0x438b('0x6')](_0x438b('0x7'),attributes,{'tableName':_0x438b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff7e=['ServicenowConfiguration','int_servicenow_configurations','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x2f3159,_0x53f06d){var _0xf184cd=function(_0xe413a3){while(--_0xe413a3){_0x2f3159['push'](_0x2f3159['shift']());}};_0xf184cd(++_0x53f06d);}(_0xff7e,0x10a));var _0xeff7=function(_0x43697d,_0x2a565b){_0x43697d=_0x43697d-0x0;var _0x372340=_0xff7e[_0x43697d];return _0x372340;};'use strict';var _=require(_0xeff7('0x0'));var util=require(_0xeff7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeff7('0x2'));var BPromise=require('bluebird');var rp=require(_0xeff7('0x3'));var fs=require('fs');var path=require(_0xeff7('0x4'));var rimraf=require(_0xeff7('0x5'));var config=require(_0xeff7('0x6'));var attributes=require(_0xeff7('0x7'));module[_0xeff7('0x8')]=function(_0x20d7f2,_0x20066b){return _0x20d7f2['define'](_0xeff7('0x9'),attributes,{'tableName':_0xeff7('0xa'),'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 8deae12..a654950 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 _0x79d7=['http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x100ad6,_0x4b71a3){var _0x647eb9=function(_0x257e39){while(--_0x257e39){_0x100ad6['push'](_0x100ad6['shift']());}};_0x647eb9(++_0x4b71a3);}(_0x79d7,0x90));var _0x779d=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x79d7[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x779d('0x0'));var util=require(_0x779d('0x1'));var moment=require(_0x779d('0x2'));var BPromise=require(_0x779d('0x3'));var rs=require(_0x779d('0x4'));var fs=require('fs');var Redis=require(_0x779d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x779d('0x6'));var logger=require('../../config/logger')(_0x779d('0x7'));var config=require(_0x779d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x779d('0x9')][_0x779d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc81cf,_0xfe5bbf,_0x1074eb){return new BPromise(function(_0x508d17,_0x593a21){return client[_0x779d('0xb')](_0xc81cf,_0x1074eb)[_0x779d('0xc')](function(_0x35c1bd){logger['info'](_0x779d('0xd'),_0xfe5bbf,_0x779d('0xe'));logger[_0x779d('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xfe5bbf,_0x779d('0xe'),JSON[_0x779d('0x10')](_0x35c1bd));if(_0x35c1bd[_0x779d('0x11')]){if(_0x35c1bd['error']['code']===0x1f4){logger['error'](_0x779d('0xd'),_0xfe5bbf,_0x35c1bd['error'][_0x779d('0x12')]);return _0x593a21(_0x35c1bd[_0x779d('0x11')][_0x779d('0x12')]);}logger[_0x779d('0x11')](_0x779d('0xd'),_0xfe5bbf,_0x35c1bd[_0x779d('0x11')]['message']);return _0x508d17(_0x35c1bd[_0x779d('0x11')][_0x779d('0x12')]);}else{logger[_0x779d('0x13')](_0x779d('0xd'),_0xfe5bbf,_0x779d('0xe'));_0x508d17(_0x35c1bd[_0x779d('0x14')]['message']);}})[_0x779d('0x15')](function(_0x490a9b){logger[_0x779d('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0xfe5bbf,_0x490a9b);_0x593a21(_0x490a9b);});});} \ No newline at end of file +var _0x1f53=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x1f53,0x14e));var _0x31f5=function(_0xb37d4e,_0x3ccc6c){_0xb37d4e=_0xb37d4e-0x0;var _0x41830e=_0x1f53[_0xb37d4e];return _0x41830e;};'use strict';var _=require(_0x31f5('0x0'));var util=require(_0x31f5('0x1'));var moment=require(_0x31f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x31f5('0x3'));var fs=require('fs');var Redis=require(_0x31f5('0x4'));var db=require(_0x31f5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x31f5('0x6'))(_0x31f5('0x7'));var config=require(_0x31f5('0x8'));var jayson=require(_0x31f5('0x9'));var client=jayson[_0x31f5('0xa')][_0x31f5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4731f2,_0x840d55,_0xdce9c3){return new BPromise(function(_0x4adfee,_0x36c790){return client['request'](_0x4731f2,_0xdce9c3)['then'](function(_0xf83a0e){logger[_0x31f5('0xc')](_0x31f5('0xd'),_0x840d55,'request\x20sent');logger[_0x31f5('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x840d55,'request\x20sent',JSON[_0x31f5('0xf')](_0xf83a0e));if(_0xf83a0e['error']){if(_0xf83a0e[_0x31f5('0x10')]['code']===0x1f4){logger[_0x31f5('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x840d55,_0xf83a0e['error'][_0x31f5('0x11')]);return _0x36c790(_0xf83a0e['error'][_0x31f5('0x11')]);}logger[_0x31f5('0x10')](_0x31f5('0xd'),_0x840d55,_0xf83a0e[_0x31f5('0x10')]['message']);return _0x4adfee(_0xf83a0e[_0x31f5('0x10')][_0x31f5('0x11')]);}else{logger[_0x31f5('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x840d55,_0x31f5('0x12'));_0x4adfee(_0xf83a0e['result'][_0x31f5('0x11')]);}})[_0x31f5('0x13')](function(_0x2bb53a){logger[_0x31f5('0x10')](_0x31f5('0xd'),_0x840d55,_0x2bb53a);_0x36c790(_0x2bb53a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e16a073..a53e102 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 _0xe2fe=['/:id','show','post','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x423eba,_0xb6826c){var _0x138f29=function(_0x22e9e3){while(--_0x22e9e3){_0x423eba['push'](_0x423eba['shift']());}};_0x138f29(++_0xb6826c);}(_0xe2fe,0x1c7));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require(_0xee2f('0x1'));var path=require(_0xee2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xee2f('0x3'));var router=express[_0xee2f('0x4')]();var auth=require(_0xee2f('0x5'));var interaction=require(_0xee2f('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xa')]);router[_0xee2f('0xb')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put'](_0xee2f('0x9'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xc')]);router[_0xee2f('0xd')](_0xee2f('0x9'),auth[_0xee2f('0x8')](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file +var _0xa32a=['update','delete','destroy','exports','util','connect-timeout','express','Router','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa32a,0x194));var _0xaa32=function(_0x4f8b2b,_0x1dc8dd){_0x4f8b2b=_0x4f8b2b-0x0;var _0x2f230a=_0xa32a[_0x4f8b2b];return _0x2f230a;};'use strict';var multer=require('multer');var util=require(_0xaa32('0x0'));var path=require('path');var timeout=require(_0xaa32('0x1'));var express=require(_0xaa32('0x2'));var router=express[_0xaa32('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaa32('0x4'));router[_0xaa32('0x5')]('/',auth[_0xaa32('0x6')](),controller[_0xaa32('0x7')]);router[_0xaa32('0x5')](_0xaa32('0x8'),auth[_0xaa32('0x6')](),controller[_0xaa32('0x9')]);router['post']('/',auth[_0xaa32('0x6')](),controller[_0xaa32('0xa')]);router[_0xaa32('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xaa32('0xc')]);router[_0xaa32('0xd')](_0xaa32('0x8'),auth['isAuthenticated'](),controller[_0xaa32('0xe')]);module[_0xaa32('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 0395324..1d1b343 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 _0x65d9=['variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x65d9,0x1bf));var _0x965d=function(_0x5ce456,_0x82501b){_0x5ce456=_0x5ce456-0x0;var _0x5b6856=_0x65d9[_0x5ce456];return _0x5b6856;};'use strict';var Sequelize=require(_0x965d('0x0'));module[_0x965d('0x1')]={'type':{'type':Sequelize[_0x965d('0x2')]('string',_0x965d('0x3'),_0x965d('0x4'),_0x965d('0x5')),'defaultValue':_0x965d('0x6')},'content':{'type':Sequelize[_0x965d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x965d('0x2')]('string',_0x965d('0x3'),_0x965d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x965d('0x7')]},'customField':{'type':Sequelize[_0x965d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x965d('0x7')]}}; \ No newline at end of file +var _0x3105=['sequelize','exports','ENUM','string','keyValue','STRING','BOOLEAN'];(function(_0x48f5ca,_0x5e4750){var _0x50b00e=function(_0x5be181){while(--_0x5be181){_0x48f5ca['push'](_0x48f5ca['shift']());}};_0x50b00e(++_0x5e4750);}(_0x3105,0x7e));var _0x5310=function(_0x122f18,_0x5090c3){_0x122f18=_0x122f18-0x0;var _0x53f89e=_0x3105[_0x122f18];return _0x53f89e;};'use strict';var Sequelize=require(_0x5310('0x0'));module[_0x5310('0x1')]={'type':{'type':Sequelize[_0x5310('0x2')](_0x5310('0x3'),'variable','customVariable',_0x5310('0x4')),'defaultValue':_0x5310('0x3')},'content':{'type':Sequelize[_0x5310('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5310('0x2')](_0x5310('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x5310('0x5')]},'idField':{'type':Sequelize[_0x5310('0x5')]},'nameField':{'type':Sequelize[_0x5310('0x5')]},'customField':{'type':Sequelize[_0x5310('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 3fd1208..8998266 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 _0x9b08=['../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','error','stack','name','index','map','ServicenowField','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','filtears','length','find','create','body','params','eml-format','zip-dir','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x50d84b,_0x1d7ea7){var _0x6d4270=function(_0x883f21){while(--_0x883f21){_0x50d84b['push'](_0x50d84b['shift']());}};_0x6d4270(++_0x1d7ea7);}(_0x9b08,0x159));var _0x89b0=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0x9b08[_0x285824];return _0x311d7e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x89b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89b0('0x2'));var moment=require('moment');var BPromise=require(_0x89b0('0x3'));var Mustache=require('mustache');var util=require(_0x89b0('0x4'));var path=require(_0x89b0('0x5'));var sox=require(_0x89b0('0x6'));var csv=require('to-csv');var ejs=require(_0x89b0('0x7'));var fs=require('fs');var _=require(_0x89b0('0x8'));var squel=require(_0x89b0('0x9'));var crypto=require(_0x89b0('0xa'));var jsforce=require(_0x89b0('0xb'));var deskjs=require(_0x89b0('0xc'));var toCsv=require(_0x89b0('0xd'));var querystring=require('querystring');var Papa=require(_0x89b0('0xe'));var Redis=require(_0x89b0('0xf'));var authService=require(_0x89b0('0x10'));var qs=require(_0x89b0('0x11'));var as=require(_0x89b0('0x12'));var hardwareService=require(_0x89b0('0x13'));var logger=require(_0x89b0('0x14'))(_0x89b0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x89b0('0x16'))['db'];function respondWithStatusCode(_0x4d7550,_0x1ec768){_0x1ec768=_0x1ec768||0xcc;return function(_0xada936){if(_0xada936){return _0x4d7550[_0x89b0('0x17')](_0x1ec768);}return _0x4d7550[_0x89b0('0x18')](_0x1ec768)[_0x89b0('0x19')]();};}function respondWithResult(_0x111dba,_0x4c88fd){_0x4c88fd=_0x4c88fd||0xc8;return function(_0x366f47){if(_0x366f47){return _0x111dba[_0x89b0('0x18')](_0x4c88fd)['json'](_0x366f47);}};}function respondWithFilteredResult(_0x4bbc82,_0x27408c){return function(_0x5494f3){if(_0x5494f3){var _0x1fac84=_0x5494f3[_0x89b0('0x1a')],_0x3fe353=_0x27408c[_0x89b0('0x1b')],_0x518a5a=_0x27408c[_0x89b0('0x1b')]+_0x27408c[_0x89b0('0x1c')],_0x1804ee;if(_0x518a5a>=_0x1fac84){_0x518a5a=_0x1fac84;_0x1804ee=0xc8;}else{_0x1804ee=0xce;}_0x4bbc82[_0x89b0('0x18')](_0x1804ee);return _0x4bbc82[_0x89b0('0x1d')](_0x89b0('0x1e'),_0x3fe353+'-'+_0x518a5a+'/'+_0x1fac84)[_0x89b0('0x1f')](_0x5494f3);}return null;};}function patchUpdates(_0x48ba4f){return function(_0x1c8a06){try{jsonpatch['apply'](_0x1c8a06,_0x48ba4f,!![]);}catch(_0x1fa075){return BPromise[_0x89b0('0x20')](_0x1fa075);}return _0x1c8a06[_0x89b0('0x21')]();};}function saveUpdates(_0x2910e7,_0x3c6ebe){return function(_0x4796ab){if(_0x4796ab){return _0x4796ab[_0x89b0('0x22')](_0x2910e7)['then'](function(_0x190b99){return _0x190b99;});}return null;};}function removeEntity(_0x168faa,_0x4bec84){return function(_0x419f5b){if(_0x419f5b){return _0x419f5b['destroy']()['then'](function(){_0x168faa[_0x89b0('0x18')](0xcc)[_0x89b0('0x19')]();});}};}function handleEntityNotFound(_0x35f440,_0x308209){return function(_0x559634){if(!_0x559634){_0x35f440[_0x89b0('0x17')](0x194);}return _0x559634;};}function handleError(_0x2109e6,_0x22b948){_0x22b948=_0x22b948||0x1f4;return function(_0x5e8fc8){logger[_0x89b0('0x23')](_0x5e8fc8[_0x89b0('0x24')]);if(_0x5e8fc8[_0x89b0('0x25')]){delete _0x5e8fc8[_0x89b0('0x25')];}_0x2109e6[_0x89b0('0x18')](_0x22b948)['send'](_0x5e8fc8);};}exports[_0x89b0('0x26')]=function(_0x3904c4,_0x3db9a8){var _0x225000={},_0x29cb42={},_0x27605a={'count':0x0,'rows':[]};var _0x849c74=_[_0x89b0('0x27')](db[_0x89b0('0x28')]['rawAttributes'],function(_0x2e18b5){return{'name':_0x2e18b5['fieldName'],'type':_0x2e18b5[_0x89b0('0x29')][_0x89b0('0x2a')]};});_0x29cb42[_0x89b0('0x2b')]=_[_0x89b0('0x27')](_0x849c74,_0x89b0('0x25'));_0x29cb42['query']=_['keys'](_0x3904c4[_0x89b0('0x2c')]);_0x29cb42['filters']=_[_0x89b0('0x2d')](_0x29cb42[_0x89b0('0x2b')],_0x29cb42['query']);_0x225000[_0x89b0('0x2e')]=_[_0x89b0('0x2d')](_0x29cb42[_0x89b0('0x2b')],qs[_0x89b0('0x2f')](_0x3904c4['query'][_0x89b0('0x2f')]));_0x225000[_0x89b0('0x2e')]=_0x225000[_0x89b0('0x2e')]['length']?_0x225000['attributes']:_0x29cb42[_0x89b0('0x2b')];if(!_0x3904c4['query']['hasOwnProperty'](_0x89b0('0x30'))){_0x225000[_0x89b0('0x1c')]=qs[_0x89b0('0x1c')](_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x1c')]);_0x225000['offset']=qs[_0x89b0('0x1b')](_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x1b')]);}_0x225000[_0x89b0('0x31')]=qs[_0x89b0('0x32')](_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x32')]);_0x225000[_0x89b0('0x33')]=qs[_0x89b0('0x34')](_[_0x89b0('0x35')](_0x3904c4[_0x89b0('0x2c')],_0x29cb42[_0x89b0('0x34')]),_0x849c74);if(_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x36')]){_0x225000[_0x89b0('0x33')]=_[_0x89b0('0x37')](_0x225000[_0x89b0('0x33')],{'$or':_['map'](_0x849c74,function(_0x12ed00){if(_0x12ed00[_0x89b0('0x29')]!==_0x89b0('0x38')){var _0x230961={};_0x230961[_0x12ed00[_0x89b0('0x25')]]={'$like':'%'+_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x36')]+'%'};return _0x230961;}})});}_0x225000=_[_0x89b0('0x37')]({},_0x225000,_0x3904c4[_0x89b0('0x39')]);var _0x37072d={'where':_0x225000[_0x89b0('0x33')]};return db[_0x89b0('0x28')][_0x89b0('0x1a')](_0x37072d)[_0x89b0('0x3a')](function(_0x2ff203){_0x27605a[_0x89b0('0x1a')]=_0x2ff203;if(_0x3904c4[_0x89b0('0x2c')][_0x89b0('0x3b')]){_0x225000[_0x89b0('0x3c')]=[{'all':!![]}];}return db[_0x89b0('0x28')][_0x89b0('0x3d')](_0x225000);})[_0x89b0('0x3a')](function(_0x1092ca){_0x27605a[_0x89b0('0x3e')]=_0x1092ca;return _0x27605a;})[_0x89b0('0x3a')](respondWithFilteredResult(_0x3db9a8,_0x225000))[_0x89b0('0x3f')](handleError(_0x3db9a8,null));};exports[_0x89b0('0x40')]=function(_0x311a4b,_0x8ded09){var _0x3c2bdf={'raw':!![],'where':{'id':_0x311a4b['params']['id']}},_0xd4fe70={};_0xd4fe70[_0x89b0('0x2b')]=_['keys'](db[_0x89b0('0x28')][_0x89b0('0x41')]);_0xd4fe70[_0x89b0('0x2c')]=_[_0x89b0('0x42')](_0x311a4b[_0x89b0('0x2c')]);_0xd4fe70[_0x89b0('0x43')]=_[_0x89b0('0x2d')](_0xd4fe70[_0x89b0('0x2b')],_0xd4fe70[_0x89b0('0x2c')]);_0x3c2bdf['attributes']=_[_0x89b0('0x2d')](_0xd4fe70[_0x89b0('0x2b')],qs[_0x89b0('0x2f')](_0x311a4b['query'][_0x89b0('0x2f')]));_0x3c2bdf[_0x89b0('0x2e')]=_0x3c2bdf[_0x89b0('0x2e')][_0x89b0('0x44')]?_0x3c2bdf['attributes']:_0xd4fe70[_0x89b0('0x2b')];if(_0x311a4b[_0x89b0('0x2c')][_0x89b0('0x3b')]){_0x3c2bdf[_0x89b0('0x3c')]=[{'all':!![]}];}_0x3c2bdf=_[_0x89b0('0x37')]({},_0x3c2bdf,_0x311a4b[_0x89b0('0x39')]);return db[_0x89b0('0x28')][_0x89b0('0x45')](_0x3c2bdf)[_0x89b0('0x3a')](handleEntityNotFound(_0x8ded09,null))['then'](respondWithResult(_0x8ded09,null))[_0x89b0('0x3f')](handleError(_0x8ded09,null));};exports[_0x89b0('0x46')]=function(_0x3bbfa5,_0x34f3a4){return db[_0x89b0('0x28')][_0x89b0('0x46')](_0x3bbfa5[_0x89b0('0x47')],{})['then'](respondWithResult(_0x34f3a4,0xc9))[_0x89b0('0x3f')](handleError(_0x34f3a4,null));};exports[_0x89b0('0x22')]=function(_0x530aca,_0x457152){if(_0x530aca[_0x89b0('0x47')]['id']){delete _0x530aca[_0x89b0('0x47')]['id'];}return db[_0x89b0('0x28')][_0x89b0('0x45')]({'where':{'id':_0x530aca[_0x89b0('0x48')]['id']}})['then'](handleEntityNotFound(_0x457152,null))[_0x89b0('0x3a')](saveUpdates(_0x530aca['body'],null))['then'](respondWithResult(_0x457152,null))[_0x89b0('0x3f')](handleError(_0x457152,null));};exports['destroy']=function(_0x12c5bb,_0x1306b5){return db[_0x89b0('0x28')][_0x89b0('0x45')]({'where':{'id':_0x12c5bb['params']['id']}})[_0x89b0('0x3a')](handleEntityNotFound(_0x1306b5,null))[_0x89b0('0x3a')](removeEntity(_0x1306b5,null))['catch'](handleError(_0x1306b5,null));}; \ No newline at end of file +var _0xbb74=['json','offset','limit','apply','reject','save','update','destroy','then','end','error','stack','name','index','map','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','ServicenowField','includeAll','include','findAll','catch','params','keys','rawAttributes','filtears','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x495d7e,_0x15536e){var _0x2ecdfa=function(_0x52dab8){while(--_0x52dab8){_0x495d7e['push'](_0x495d7e['shift']());}};_0x2ecdfa(++_0x15536e);}(_0xbb74,0x1e4));var _0x4bb7=function(_0xf1fafa,_0x302279){_0xf1fafa=_0xf1fafa-0x0;var _0x1102a3=_0xbb74[_0xf1fafa];return _0x1102a3;};'use strict';var pdf=require(_0x4bb7('0x0'));var emlformat=require(_0x4bb7('0x1'));var rimraf=require(_0x4bb7('0x2'));var zipdir=require(_0x4bb7('0x3'));var jsonpatch=require(_0x4bb7('0x4'));var rp=require('request-promise');var moment=require(_0x4bb7('0x5'));var BPromise=require(_0x4bb7('0x6'));var Mustache=require(_0x4bb7('0x7'));var util=require('util');var path=require(_0x4bb7('0x8'));var sox=require(_0x4bb7('0x9'));var csv=require(_0x4bb7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4bb7('0xb'));var squel=require(_0x4bb7('0xc'));var crypto=require(_0x4bb7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4bb7('0xa'));var querystring=require(_0x4bb7('0xe'));var Papa=require(_0x4bb7('0xf'));var Redis=require(_0x4bb7('0x10'));var authService=require(_0x4bb7('0x11'));var qs=require(_0x4bb7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bb7('0x13'));var logger=require(_0x4bb7('0x14'))('api');var utils=require(_0x4bb7('0x15'));var config=require(_0x4bb7('0x16'));var licenseUtil=require(_0x4bb7('0x17'));var db=require(_0x4bb7('0x18'))['db'];function respondWithStatusCode(_0x5e30ec,_0x1abaa5){_0x1abaa5=_0x1abaa5||0xcc;return function(_0x56ed5a){if(_0x56ed5a){return _0x5e30ec[_0x4bb7('0x19')](_0x1abaa5);}return _0x5e30ec[_0x4bb7('0x1a')](_0x1abaa5)['end']();};}function respondWithResult(_0x39fe72,_0x13cd19){_0x13cd19=_0x13cd19||0xc8;return function(_0x33db4f){if(_0x33db4f){return _0x39fe72[_0x4bb7('0x1a')](_0x13cd19)[_0x4bb7('0x1b')](_0x33db4f);}};}function respondWithFilteredResult(_0x1f51ec,_0x4ea11e){return function(_0x4eb275){if(_0x4eb275){var _0x491a5b=_0x4eb275['count'],_0x376e4a=_0x4ea11e['offset'],_0x296b2b=_0x4ea11e[_0x4bb7('0x1c')]+_0x4ea11e[_0x4bb7('0x1d')],_0x36671a;if(_0x296b2b>=_0x491a5b){_0x296b2b=_0x491a5b;_0x36671a=0xc8;}else{_0x36671a=0xce;}_0x1f51ec['status'](_0x36671a);return _0x1f51ec['set']('Content-Range',_0x376e4a+'-'+_0x296b2b+'/'+_0x491a5b)[_0x4bb7('0x1b')](_0x4eb275);}return null;};}function patchUpdates(_0x339ebb){return function(_0x494303){try{jsonpatch[_0x4bb7('0x1e')](_0x494303,_0x339ebb,!![]);}catch(_0x84c86b){return BPromise[_0x4bb7('0x1f')](_0x84c86b);}return _0x494303[_0x4bb7('0x20')]();};}function saveUpdates(_0x2a94c1,_0xee396){return function(_0x3c8c55){if(_0x3c8c55){return _0x3c8c55[_0x4bb7('0x21')](_0x2a94c1)['then'](function(_0x2aee85){return _0x2aee85;});}return null;};}function removeEntity(_0x1b7a09,_0x33da6a){return function(_0x295ce1){if(_0x295ce1){return _0x295ce1[_0x4bb7('0x22')]()[_0x4bb7('0x23')](function(){_0x1b7a09['status'](0xcc)[_0x4bb7('0x24')]();});}};}function handleEntityNotFound(_0x575ced,_0x4a93be){return function(_0xdb3bb4){if(!_0xdb3bb4){_0x575ced[_0x4bb7('0x19')](0x194);}return _0xdb3bb4;};}function handleError(_0x43a1f5,_0xf601b2){_0xf601b2=_0xf601b2||0x1f4;return function(_0x3eb4a3){logger[_0x4bb7('0x25')](_0x3eb4a3[_0x4bb7('0x26')]);if(_0x3eb4a3['name']){delete _0x3eb4a3[_0x4bb7('0x27')];}_0x43a1f5[_0x4bb7('0x1a')](_0xf601b2)['send'](_0x3eb4a3);};}exports[_0x4bb7('0x28')]=function(_0x1698a4,_0x547156){var _0x58aed9={},_0x4633cd={},_0x118de8={'count':0x0,'rows':[]};var _0x3e5e33=_[_0x4bb7('0x29')](db['ServicenowField']['rawAttributes'],function(_0x482a6e){return{'name':_0x482a6e[_0x4bb7('0x2a')],'type':_0x482a6e['type'][_0x4bb7('0x2b')]};});_0x4633cd[_0x4bb7('0x2c')]=_[_0x4bb7('0x29')](_0x3e5e33,'name');_0x4633cd[_0x4bb7('0x2d')]=_['keys'](_0x1698a4['query']);_0x4633cd['filters']=_[_0x4bb7('0x2e')](_0x4633cd['model'],_0x4633cd['query']);_0x58aed9[_0x4bb7('0x2f')]=_['intersection'](_0x4633cd[_0x4bb7('0x2c')],qs[_0x4bb7('0x30')](_0x1698a4[_0x4bb7('0x2d')]['fields']));_0x58aed9[_0x4bb7('0x2f')]=_0x58aed9[_0x4bb7('0x2f')][_0x4bb7('0x31')]?_0x58aed9[_0x4bb7('0x2f')]:_0x4633cd[_0x4bb7('0x2c')];if(!_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x32')](_0x4bb7('0x33'))){_0x58aed9['limit']=qs[_0x4bb7('0x1d')](_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x1d')]);_0x58aed9[_0x4bb7('0x1c')]=qs[_0x4bb7('0x1c')](_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x1c')]);}_0x58aed9[_0x4bb7('0x34')]=qs[_0x4bb7('0x35')](_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x35')]);_0x58aed9[_0x4bb7('0x36')]=qs[_0x4bb7('0x37')](_['pick'](_0x1698a4[_0x4bb7('0x2d')],_0x4633cd['filters']),_0x3e5e33);if(_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x38')]){_0x58aed9[_0x4bb7('0x36')]=_[_0x4bb7('0x39')](_0x58aed9[_0x4bb7('0x36')],{'$or':_[_0x4bb7('0x29')](_0x3e5e33,function(_0x144b1f){if(_0x144b1f[_0x4bb7('0x3a')]!==_0x4bb7('0x3b')){var _0x9e60c={};_0x9e60c[_0x144b1f[_0x4bb7('0x27')]]={'$like':'%'+_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x38')]+'%'};return _0x9e60c;}})});}_0x58aed9=_[_0x4bb7('0x39')]({},_0x58aed9,_0x1698a4[_0x4bb7('0x3c')]);var _0x2fc857={'where':_0x58aed9['where']};return db[_0x4bb7('0x3d')]['count'](_0x2fc857)[_0x4bb7('0x23')](function(_0x263923){_0x118de8['count']=_0x263923;if(_0x1698a4[_0x4bb7('0x2d')][_0x4bb7('0x3e')]){_0x58aed9[_0x4bb7('0x3f')]=[{'all':!![]}];}return db[_0x4bb7('0x3d')][_0x4bb7('0x40')](_0x58aed9);})[_0x4bb7('0x23')](function(_0x4e4435){_0x118de8['rows']=_0x4e4435;return _0x118de8;})[_0x4bb7('0x23')](respondWithFilteredResult(_0x547156,_0x58aed9))[_0x4bb7('0x41')](handleError(_0x547156,null));};exports['show']=function(_0xe7a2f5,_0x1887f1){var _0x250090={'raw':!![],'where':{'id':_0xe7a2f5[_0x4bb7('0x42')]['id']}},_0x50f642={};_0x50f642['model']=_[_0x4bb7('0x43')](db['ServicenowField'][_0x4bb7('0x44')]);_0x50f642[_0x4bb7('0x2d')]=_[_0x4bb7('0x43')](_0xe7a2f5[_0x4bb7('0x2d')]);_0x50f642[_0x4bb7('0x45')]=_['intersection'](_0x50f642[_0x4bb7('0x2c')],_0x50f642['query']);_0x250090[_0x4bb7('0x2f')]=_['intersection'](_0x50f642['model'],qs[_0x4bb7('0x30')](_0xe7a2f5[_0x4bb7('0x2d')][_0x4bb7('0x30')]));_0x250090[_0x4bb7('0x2f')]=_0x250090[_0x4bb7('0x2f')][_0x4bb7('0x31')]?_0x250090[_0x4bb7('0x2f')]:_0x50f642['model'];if(_0xe7a2f5['query']['includeAll']){_0x250090[_0x4bb7('0x3f')]=[{'all':!![]}];}_0x250090=_['merge']({},_0x250090,_0xe7a2f5[_0x4bb7('0x3c')]);return db[_0x4bb7('0x3d')][_0x4bb7('0x46')](_0x250090)[_0x4bb7('0x23')](handleEntityNotFound(_0x1887f1,null))[_0x4bb7('0x23')](respondWithResult(_0x1887f1,null))['catch'](handleError(_0x1887f1,null));};exports[_0x4bb7('0x47')]=function(_0x3023e4,_0x3bf696){return db['ServicenowField']['create'](_0x3023e4[_0x4bb7('0x48')],{})[_0x4bb7('0x23')](respondWithResult(_0x3bf696,0xc9))[_0x4bb7('0x41')](handleError(_0x3bf696,null));};exports[_0x4bb7('0x21')]=function(_0x2fb3d5,_0xc8e6d0){if(_0x2fb3d5[_0x4bb7('0x48')]['id']){delete _0x2fb3d5[_0x4bb7('0x48')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x2fb3d5[_0x4bb7('0x42')]['id']}})[_0x4bb7('0x23')](handleEntityNotFound(_0xc8e6d0,null))[_0x4bb7('0x23')](saveUpdates(_0x2fb3d5[_0x4bb7('0x48')],null))['then'](respondWithResult(_0xc8e6d0,null))[_0x4bb7('0x41')](handleError(_0xc8e6d0,null));};exports[_0x4bb7('0x22')]=function(_0x4a0c7a,_0x540d74){return db['ServicenowField']['find']({'where':{'id':_0x4a0c7a[_0x4bb7('0x42')]['id']}})[_0x4bb7('0x23')](handleEntityNotFound(_0x540d74,null))[_0x4bb7('0x23')](removeEntity(_0x540d74,null))[_0x4bb7('0x41')](handleError(_0x540d74,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 42cc465..38713bd 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 _0x5296=['./intServicenowField.attributes','exports','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x570c5d,_0xae190a){var _0x267397=function(_0x1191d6){while(--_0x1191d6){_0x570c5d['push'](_0x570c5d['shift']());}};_0x267397(++_0xae190a);}(_0x5296,0x17d));var _0x6529=function(_0x1c5545,_0x309206){_0x1c5545=_0x1c5545-0x0;var _0x272a9d=_0x5296[_0x1c5545];return _0x272a9d;};'use strict';var _=require(_0x6529('0x0'));var util=require(_0x6529('0x1'));var logger=require(_0x6529('0x2'))(_0x6529('0x3'));var moment=require(_0x6529('0x4'));var BPromise=require('bluebird');var rp=require(_0x6529('0x5'));var fs=require('fs');var path=require(_0x6529('0x6'));var rimraf=require(_0x6529('0x7'));var config=require(_0x6529('0x8'));var attributes=require(_0x6529('0x9'));module[_0x6529('0xa')]=function(_0x46c7b0,_0x449565){return _0x46c7b0['define']('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x6529('0xb'),'fields':['idField',_0x6529('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x083c=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId'];(function(_0x3a213f,_0x42b5c6){var _0x5f50b2=function(_0x232f0f){while(--_0x232f0f){_0x3a213f['push'](_0x3a213f['shift']());}};_0x5f50b2(++_0x42b5c6);}(_0x083c,0xee));var _0xc083=function(_0x9f05d9,_0x2ff1ca){_0x9f05d9=_0x9f05d9-0x0;var _0x5028a1=_0x083c[_0x9f05d9];return _0x5028a1;};'use strict';var _=require(_0xc083('0x0'));var util=require(_0xc083('0x1'));var logger=require('../../config/logger')(_0xc083('0x2'));var moment=require(_0xc083('0x3'));var BPromise=require('bluebird');var rp=require(_0xc083('0x4'));var fs=require('fs');var path=require(_0xc083('0x5'));var rimraf=require(_0xc083('0x6'));var config=require(_0xc083('0x7'));var attributes=require(_0xc083('0x8'));module['exports']=function(_0xa637b0,_0x5f4aec){return _0xa637b0['define'](_0xc083('0x9'),attributes,{'tableName':_0xc083('0xa'),'paranoid':![],'indexes':[{'name':_0xc083('0xb'),'fields':[_0xc083('0xc'),_0xc083('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ada982e..653ed82 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 _0xd8a2=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2669e6,_0xaabd00){var _0x586ce5=function(_0x9a8e9b){while(--_0x9a8e9b){_0x2669e6['push'](_0x2669e6['shift']());}};_0x586ce5(++_0xaabd00);}(_0xd8a2,0x1ae));var _0x2d8a=function(_0x3b4bb8,_0x25dd4c){_0x3b4bb8=_0x3b4bb8-0x0;var _0x18a21d=_0xd8a2[_0x3b4bb8];return _0x18a21d;};'use strict';var _=require(_0x2d8a('0x0'));var util=require(_0x2d8a('0x1'));var moment=require(_0x2d8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d8a('0x3'));var fs=require('fs');var Redis=require(_0x2d8a('0x4'));var db=require(_0x2d8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d8a('0x6'))(_0x2d8a('0x7'));var config=require(_0x2d8a('0x8'));var jayson=require(_0x2d8a('0x9'));var client=jayson[_0x2d8a('0xa')][_0x2d8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2daab5,_0x4a86a7,_0x3ce958){return new BPromise(function(_0x1be238,_0x2f2379){return client[_0x2d8a('0xc')](_0x2daab5,_0x3ce958)[_0x2d8a('0xd')](function(_0x8ddc73){logger[_0x2d8a('0xe')](_0x2d8a('0xf'),_0x4a86a7,_0x2d8a('0x10'));logger[_0x2d8a('0x11')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x4a86a7,_0x2d8a('0x10'),JSON[_0x2d8a('0x12')](_0x8ddc73));if(_0x8ddc73[_0x2d8a('0x13')]){if(_0x8ddc73['error']['code']===0x1f4){logger[_0x2d8a('0x13')](_0x2d8a('0xf'),_0x4a86a7,_0x8ddc73[_0x2d8a('0x13')]['message']);return _0x2f2379(_0x8ddc73[_0x2d8a('0x13')]['message']);}logger[_0x2d8a('0x13')]('ServicenowField,\x20%s,\x20%s',_0x4a86a7,_0x8ddc73[_0x2d8a('0x13')]['message']);return _0x1be238(_0x8ddc73[_0x2d8a('0x13')]['message']);}else{logger[_0x2d8a('0xe')](_0x2d8a('0xf'),_0x4a86a7,'request\x20sent');_0x1be238(_0x8ddc73['result']['message']);}})[_0x2d8a('0x14')](function(_0x5eb70e){logger['error'](_0x2d8a('0xf'),_0x4a86a7,_0x5eb70e);_0x2f2379(_0x5eb70e);});});} \ No newline at end of file +var _0x6a26=['http','then','request\x20sent','debug','error','ServicenowField,\x20%s,\x20%s','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6a26,0x117));var _0x66a2=function(_0x5e55cb,_0x1d2764){_0x5e55cb=_0x5e55cb-0x0;var _0x3c28e4=_0x6a26[_0x5e55cb];return _0x3c28e4;};'use strict';var _=require(_0x66a2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x66a2('0x1'));var rs=require(_0x66a2('0x2'));var fs=require('fs');var Redis=require(_0x66a2('0x3'));var db=require(_0x66a2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66a2('0x5'));var config=require(_0x66a2('0x6'));var jayson=require(_0x66a2('0x7'));var client=jayson[_0x66a2('0x8')][_0x66a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b037e,_0x65653a,_0x4344c0){return new BPromise(function(_0x470f69,_0x3e519b){return client['request'](_0x3b037e,_0x4344c0)[_0x66a2('0xa')](function(_0x200816){logger['info']('ServicenowField,\x20%s,\x20%s',_0x65653a,_0x66a2('0xb'));logger[_0x66a2('0xc')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x65653a,_0x66a2('0xb'),JSON['stringify'](_0x200816));if(_0x200816[_0x66a2('0xd')]){if(_0x200816[_0x66a2('0xd')]['code']===0x1f4){logger[_0x66a2('0xd')](_0x66a2('0xe'),_0x65653a,_0x200816[_0x66a2('0xd')][_0x66a2('0xf')]);return _0x3e519b(_0x200816[_0x66a2('0xd')][_0x66a2('0xf')]);}logger['error'](_0x66a2('0xe'),_0x65653a,_0x200816[_0x66a2('0xd')]['message']);return _0x470f69(_0x200816[_0x66a2('0xd')]['message']);}else{logger[_0x66a2('0x10')]('ServicenowField,\x20%s,\x20%s',_0x65653a,_0x66a2('0xb'));_0x470f69(_0x200816[_0x66a2('0x11')]['message']);}})['catch'](function(_0x3833e9){logger[_0x66a2('0xd')](_0x66a2('0xe'),_0x65653a,_0x3833e9);_0x3e519b(_0x3833e9);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 6fbab31..339b58c 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 _0x42d4=['path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','util'];(function(_0x3c0e23,_0x137648){var _0x59850f=function(_0x217d15){while(--_0x217d15){_0x3c0e23['push'](_0x3c0e23['shift']());}};_0x59850f(++_0x137648);}(_0x42d4,0x88));var _0x442d=function(_0x53ef37,_0x4c118b){_0x53ef37=_0x53ef37-0x0;var _0xdf43de=_0x42d4[_0x53ef37];return _0xdf43de;};'use strict';var multer=require(_0x442d('0x0'));var util=require(_0x442d('0x1'));var path=require(_0x442d('0x2'));var timeout=require('connect-timeout');var express=require(_0x442d('0x3'));var router=express[_0x442d('0x4')]();var auth=require(_0x442d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x442d('0x6'));var controller=require('./intSugarcrmAccount.controller');router[_0x442d('0x7')]('/',auth[_0x442d('0x8')](),controller[_0x442d('0x9')]);router[_0x442d('0x7')](_0x442d('0xa'),auth[_0x442d('0x8')](),controller['show']);router['get'](_0x442d('0xb'),auth[_0x442d('0x8')](),controller[_0x442d('0xc')]);router[_0x442d('0x7')](_0x442d('0xd'),auth[_0x442d('0x8')](),controller[_0x442d('0xe')]);router['post']('/',auth[_0x442d('0x8')](),controller[_0x442d('0xf')]);router[_0x442d('0x10')](_0x442d('0xb'),auth[_0x442d('0x8')](),controller[_0x442d('0x11')]);router[_0x442d('0x12')](_0x442d('0xa'),auth[_0x442d('0x8')](),controller[_0x442d('0x13')]);router[_0x442d('0x14')](_0x442d('0xa'),auth[_0x442d('0x8')](),controller[_0x442d('0x15')]);module[_0x442d('0x16')]=router; \ No newline at end of file +var _0x7be8=['create','addConfiguration','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id/configurations','post'];(function(_0x59364a,_0x966197){var _0x53fb7e=function(_0x1205d8){while(--_0x1205d8){_0x59364a['push'](_0x59364a['shift']());}};_0x53fb7e(++_0x966197);}(_0x7be8,0x79));var _0x87be=function(_0x4d88cc,_0x36a786){_0x4d88cc=_0x4d88cc-0x0;var _0x4beb23=_0x7be8[_0x4d88cc];return _0x4beb23;};'use strict';var multer=require(_0x87be('0x0'));var util=require('util');var path=require(_0x87be('0x1'));var timeout=require(_0x87be('0x2'));var express=require(_0x87be('0x3'));var router=express['Router']();var auth=require(_0x87be('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87be('0x5'));var controller=require(_0x87be('0x6'));router[_0x87be('0x7')]('/',auth[_0x87be('0x8')](),controller[_0x87be('0x9')]);router[_0x87be('0x7')]('/:id',auth[_0x87be('0x8')](),controller['show']);router[_0x87be('0x7')](_0x87be('0xa'),auth[_0x87be('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x87be('0x8')](),controller['getFields']);router[_0x87be('0xb')]('/',auth[_0x87be('0x8')](),controller[_0x87be('0xc')]);router[_0x87be('0xb')](_0x87be('0xa'),auth[_0x87be('0x8')](),controller[_0x87be('0xd')]);router[_0x87be('0xe')]('/:id',auth[_0x87be('0x8')](),controller[_0x87be('0xf')]);router['delete'](_0x87be('0x10'),auth[_0x87be('0x8')](),controller[_0x87be('0x11')]);module[_0x87be('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index e6a33a7..a1dde10 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 _0x9fc3=['STRING','username','sequelize','exports'];(function(_0x213d52,_0x45cc2a){var _0x202a81=function(_0x201d6e){while(--_0x201d6e){_0x213d52['push'](_0x213d52['shift']());}};_0x202a81(++_0x45cc2a);}(_0x9fc3,0x166));var _0x39fc=function(_0x194bef,_0x36a036){_0x194bef=_0x194bef-0x0;var _0x47fe1e=_0x9fc3[_0x194bef];return _0x47fe1e;};'use strict';var Sequelize=require(_0x39fc('0x0'));module[_0x39fc('0x1')]={'name':{'type':Sequelize[_0x39fc('0x2')]},'description':{'type':Sequelize[_0x39fc('0x2')]},'username':{'type':Sequelize[_0x39fc('0x2')],'unique':_0x39fc('0x3')},'password':{'type':Sequelize[_0x39fc('0x2')]},'remoteUri':{'type':Sequelize[_0x39fc('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1522=['exports','STRING','username','remoteUri','sequelize'];(function(_0x25748e,_0x5982d7){var _0x214445=function(_0x423c51){while(--_0x423c51){_0x25748e['push'](_0x25748e['shift']());}};_0x214445(++_0x5982d7);}(_0x1522,0x95));var _0x2152=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1522[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2152('0x0'));module[_0x2152('0x1')]={'name':{'type':Sequelize[_0x2152('0x2')]},'description':{'type':Sequelize[_0x2152('0x2')]},'username':{'type':Sequelize[_0x2152('0x2')],'unique':_0x2152('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2152('0x2')],'unique':_0x2152('0x4')},'serverUrl':{'type':Sequelize[_0x2152('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 9c4945b..cb3ec0e 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 _0xa87e=['xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','remove','includes','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','reject','save','destroy','stack','name','send','map','SugarcrmAccount','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','filtears','length','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify'];(function(_0x11d85e,_0x4e4032){var _0x2455e2=function(_0x21a280){while(--_0x21a280){_0x11d85e['push'](_0x11d85e['shift']());}};_0x2455e2(++_0x4e4032);}(_0xa87e,0x113));var _0xea87=function(_0x5c398f,_0x19adbe){_0x5c398f=_0x5c398f-0x0;var _0x524acd=_0xa87e[_0x5c398f];return _0x524acd;};'use strict';var pdf=require(_0xea87('0x0'));var emlformat=require(_0xea87('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xea87('0x2'));var rp=require('request-promise');var moment=require(_0xea87('0x3'));var BPromise=require(_0xea87('0x4'));var Mustache=require('mustache');var util=require(_0xea87('0x5'));var path=require('path');var sox=require(_0xea87('0x6'));var csv=require(_0xea87('0x7'));var ejs=require(_0xea87('0x8'));var fs=require('fs');var _=require(_0xea87('0x9'));var squel=require(_0xea87('0xa'));var crypto=require(_0xea87('0xb'));var jsforce=require(_0xea87('0xc'));var deskjs=require(_0xea87('0xd'));var toCsv=require(_0xea87('0x7'));var querystring=require('querystring');var Papa=require(_0xea87('0xe'));var Redis=require(_0xea87('0xf'));var authService=require(_0xea87('0x10'));var qs=require(_0xea87('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xea87('0x12'))(_0xea87('0x13'));var utils=require(_0xea87('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xea87('0x15'));var jayson=require(_0xea87('0x16'));var client=jayson[_0xea87('0x17')][_0xea87('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x197e35,_0x223372,_0x4bc349,_0x28803f){return new BPromise(function(_0x235b80,_0x62e7b1){var _0xf5edfa=_0x28803f||client;return _0xf5edfa[_0xea87('0x19')](_0x197e35,_0x4bc349)[_0xea87('0x1a')](function(_0x282990){logger[_0xea87('0x1b')](_0xea87('0x1c'),_0x223372,_0xea87('0x1d'));logger['debug'](_0xea87('0x1e'),_0x223372,'request\x20sent',JSON['stringify'](_0x282990));if(_0x282990['error']){if(_0x282990[_0xea87('0x1f')][_0xea87('0x20')]===0x1f4){logger['error'](_0xea87('0x1c'),_0x223372,_0x282990['error'][_0xea87('0x21')]);return _0x62e7b1(_0x282990['error'][_0xea87('0x21')]);}logger[_0xea87('0x1f')](_0xea87('0x1c'),_0x223372,_0x282990[_0xea87('0x1f')][_0xea87('0x21')]);return _0x235b80(_0x282990[_0xea87('0x1f')][_0xea87('0x21')]);}else{logger[_0xea87('0x1b')](_0xea87('0x1c'),_0x223372,_0xea87('0x1d'));_0x235b80(_0x282990[_0xea87('0x22')][_0xea87('0x21')]);}})[_0xea87('0x23')](function(_0x1fedf6){logger[_0xea87('0x1f')](_0xea87('0x1c'),_0x223372,_0x1fedf6);_0x62e7b1(_0x1fedf6);});});}function respondWithStatusCode(_0x5c8936,_0x1c065b){_0x1c065b=_0x1c065b||0xcc;return function(_0x58b091){if(_0x58b091){return _0x5c8936[_0xea87('0x24')](_0x1c065b);}return _0x5c8936['status'](_0x1c065b)['end']();};}function respondWithResult(_0x424c8b,_0x242245){_0x242245=_0x242245||0xc8;return function(_0x14d5bd){if(_0x14d5bd){return _0x424c8b[_0xea87('0x25')](_0x242245)[_0xea87('0x26')](_0x14d5bd);}};}function respondWithFilteredResult(_0x45a386,_0x6a0389){return function(_0x3d26df){if(_0x3d26df){var _0x74365d=_0x3d26df[_0xea87('0x27')],_0x131ea6=_0x6a0389[_0xea87('0x28')],_0x230e22=_0x6a0389[_0xea87('0x28')]+_0x6a0389['limit'],_0x4bc639;if(_0x230e22>=_0x74365d){_0x230e22=_0x74365d;_0x4bc639=0xc8;}else{_0x4bc639=0xce;}_0x45a386[_0xea87('0x25')](_0x4bc639);return _0x45a386[_0xea87('0x29')](_0xea87('0x2a'),_0x131ea6+'-'+_0x230e22+'/'+_0x74365d)['json'](_0x3d26df);}return null;};}function patchUpdates(_0x373dcb){return function(_0x122a80){try{jsonpatch['apply'](_0x122a80,_0x373dcb,!![]);}catch(_0x4f9ee9){return BPromise[_0xea87('0x2b')](_0x4f9ee9);}return _0x122a80[_0xea87('0x2c')]();};}function saveUpdates(_0x536c50,_0x482b5f){return function(_0x4df4b8){if(_0x4df4b8){return _0x4df4b8['update'](_0x536c50)['then'](function(_0x18a194){return _0x18a194;});}return null;};}function removeEntity(_0x5622fb,_0x2666af){return function(_0x5e37ab){if(_0x5e37ab){return _0x5e37ab[_0xea87('0x2d')]()['then'](function(){_0x5622fb[_0xea87('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25653c,_0x14b193){return function(_0xd7cccf){if(!_0xd7cccf){_0x25653c[_0xea87('0x24')](0x194);}return _0xd7cccf;};}function handleError(_0x2e5568,_0x3dcef5){_0x3dcef5=_0x3dcef5||0x1f4;return function(_0x184b39){logger[_0xea87('0x1f')](_0x184b39[_0xea87('0x2e')]);if(_0x184b39[_0xea87('0x2f')]){delete _0x184b39[_0xea87('0x2f')];}_0x2e5568[_0xea87('0x25')](_0x3dcef5)[_0xea87('0x30')](_0x184b39);};}exports['index']=function(_0x3170c5,_0x5c8371){var _0x5e8ec0={},_0x240d57={},_0x2eb0e3={'count':0x0,'rows':[]};var _0x2f5ec8=_[_0xea87('0x31')](db[_0xea87('0x32')]['rawAttributes'],function(_0x195b0b){return{'name':_0x195b0b['fieldName'],'type':_0x195b0b[_0xea87('0x33')][_0xea87('0x34')]};});_0x240d57['model']=_[_0xea87('0x31')](_0x2f5ec8,_0xea87('0x2f'));_0x240d57['query']=_[_0xea87('0x35')](_0x3170c5[_0xea87('0x36')]);_0x240d57[_0xea87('0x37')]=_['intersection'](_0x240d57['model'],_0x240d57[_0xea87('0x36')]);_0x5e8ec0[_0xea87('0x38')]=_[_0xea87('0x39')](_0x240d57[_0xea87('0x3a')],qs[_0xea87('0x3b')](_0x3170c5[_0xea87('0x36')][_0xea87('0x3b')]));_0x5e8ec0[_0xea87('0x38')]=_0x5e8ec0[_0xea87('0x38')]['length']?_0x5e8ec0['attributes']:_0x240d57[_0xea87('0x3a')];if(!_0x3170c5[_0xea87('0x36')][_0xea87('0x3c')]('nolimit')){_0x5e8ec0[_0xea87('0x3d')]=qs[_0xea87('0x3d')](_0x3170c5['query'][_0xea87('0x3d')]);_0x5e8ec0[_0xea87('0x28')]=qs['offset'](_0x3170c5[_0xea87('0x36')]['offset']);}_0x5e8ec0[_0xea87('0x3e')]=qs[_0xea87('0x3f')](_0x3170c5[_0xea87('0x36')][_0xea87('0x3f')]);_0x5e8ec0[_0xea87('0x40')]=qs[_0xea87('0x37')](_[_0xea87('0x41')](_0x3170c5[_0xea87('0x36')],_0x240d57[_0xea87('0x37')]),_0x2f5ec8);if(_0x3170c5[_0xea87('0x36')]['filter']){_0x5e8ec0['where']=_[_0xea87('0x42')](_0x5e8ec0[_0xea87('0x40')],{'$or':_[_0xea87('0x31')](_0x2f5ec8,function(_0x16d33d){if(_0x16d33d[_0xea87('0x33')]!==_0xea87('0x43')){var _0x15a6eb={};_0x15a6eb[_0x16d33d['name']]={'$like':'%'+_0x3170c5[_0xea87('0x36')][_0xea87('0x44')]+'%'};return _0x15a6eb;}})});}_0x5e8ec0=_['merge']({},_0x5e8ec0,_0x3170c5[_0xea87('0x45')]);var _0x1ef208={'where':_0x5e8ec0[_0xea87('0x40')]};return db[_0xea87('0x32')][_0xea87('0x27')](_0x1ef208)[_0xea87('0x1a')](function(_0x46b036){_0x2eb0e3[_0xea87('0x27')]=_0x46b036;if(_0x3170c5[_0xea87('0x36')][_0xea87('0x46')]){_0x5e8ec0[_0xea87('0x47')]=[{'all':!![]}];}return db[_0xea87('0x32')][_0xea87('0x48')](_0x5e8ec0);})[_0xea87('0x1a')](function(_0x1f59b0){_0x2eb0e3[_0xea87('0x49')]=_0x1f59b0;return _0x2eb0e3;})[_0xea87('0x1a')](respondWithFilteredResult(_0x5c8371,_0x5e8ec0))['catch'](handleError(_0x5c8371,null));};exports[_0xea87('0x4a')]=function(_0x4f4608,_0xde252c){var _0x54b2ae={'raw':![],'where':{'id':_0x4f4608[_0xea87('0x4b')]['id']}},_0x443593={};_0x443593[_0xea87('0x3a')]=_['keys'](db[_0xea87('0x32')][_0xea87('0x4c')]);_0x443593[_0xea87('0x36')]=_[_0xea87('0x35')](_0x4f4608[_0xea87('0x36')]);_0x443593[_0xea87('0x4d')]=_[_0xea87('0x39')](_0x443593['model'],_0x443593[_0xea87('0x36')]);_0x54b2ae[_0xea87('0x38')]=_['intersection'](_0x443593[_0xea87('0x3a')],qs[_0xea87('0x3b')](_0x4f4608['query'][_0xea87('0x3b')]));_0x54b2ae['attributes']=_0x54b2ae[_0xea87('0x38')][_0xea87('0x4e')]?_0x54b2ae[_0xea87('0x38')]:_0x443593[_0xea87('0x3a')];if(_0x4f4608[_0xea87('0x36')][_0xea87('0x46')]){_0x54b2ae[_0xea87('0x47')]=[{'all':!![]}];}_0x54b2ae=_[_0xea87('0x42')]({},_0x54b2ae,_0x4f4608[_0xea87('0x45')]);return db[_0xea87('0x32')][_0xea87('0x4f')](_0x54b2ae)['then'](handleEntityNotFound(_0xde252c,null))['then'](respondWithResult(_0xde252c,null))['catch'](handleError(_0xde252c,null));};exports[_0xea87('0x50')]=function(_0x288202,_0x550c92){return db[_0xea87('0x32')]['create'](_0x288202[_0xea87('0x51')],{})[_0xea87('0x1a')](respondWithResult(_0x550c92,0xc9))['catch'](handleError(_0x550c92,null));};exports[_0xea87('0x52')]=function(_0x434251,_0x274bde){if(_0x434251[_0xea87('0x51')]['id']){delete _0x434251[_0xea87('0x51')]['id'];}return db[_0xea87('0x32')]['find']({'where':{'id':_0x434251[_0xea87('0x4b')]['id']}})[_0xea87('0x1a')](handleEntityNotFound(_0x274bde,null))[_0xea87('0x1a')](saveUpdates(_0x434251[_0xea87('0x51')],null))['then'](respondWithResult(_0x274bde,null))['catch'](handleError(_0x274bde,null));};exports['destroy']=function(_0x4cc7e1,_0x569a1f){return db[_0xea87('0x32')][_0xea87('0x4f')]({'where':{'id':_0x4cc7e1['params']['id']}})[_0xea87('0x1a')](handleEntityNotFound(_0x569a1f,null))[_0xea87('0x1a')](removeEntity(_0x569a1f,null))[_0xea87('0x23')](handleError(_0x569a1f,null));};exports[_0xea87('0x53')]=function(_0x55ad4d,_0x14ed90,_0x5205d0){var _0x1ce61c={};var _0x11e2b0={};var _0x529485;var _0x1a56d2;return db[_0xea87('0x32')][_0xea87('0x54')]({'where':{'id':_0x55ad4d[_0xea87('0x4b')]['id']}})[_0xea87('0x1a')](handleEntityNotFound(_0x14ed90,null))[_0xea87('0x1a')](function(_0x22c6da){if(_0x22c6da){_0x529485=_0x22c6da;_0x11e2b0[_0xea87('0x3a')]=_[_0xea87('0x35')](db[_0xea87('0x55')][_0xea87('0x4c')]);_0x11e2b0[_0xea87('0x36')]=_[_0xea87('0x35')](_0x55ad4d[_0xea87('0x36')]);_0x11e2b0[_0xea87('0x37')]=_['intersection'](_0x11e2b0[_0xea87('0x3a')],_0x11e2b0[_0xea87('0x36')]);_0x1ce61c['attributes']=_[_0xea87('0x39')](_0x11e2b0[_0xea87('0x3a')],qs['fields'](_0x55ad4d['query'][_0xea87('0x3b')]));_0x1ce61c['attributes']=_0x1ce61c['attributes'][_0xea87('0x4e')]?_0x1ce61c[_0xea87('0x38')]:_0x11e2b0[_0xea87('0x3a')];_0x1ce61c[_0xea87('0x3e')]=qs[_0xea87('0x3f')](_0x55ad4d['query']['sort']);_0x1ce61c[_0xea87('0x40')]=qs['filters'](_['pick'](_0x55ad4d[_0xea87('0x36')],_0x11e2b0['filters']));if(_0x55ad4d['query']['filter']){_0x1ce61c[_0xea87('0x40')]=_['merge'](_0x1ce61c[_0xea87('0x40')],{'$or':_[_0xea87('0x31')](_0x1ce61c[_0xea87('0x38')],function(_0x53d038){var _0x1de433={};_0x1de433[_0x53d038]={'$like':'%'+_0x55ad4d[_0xea87('0x36')][_0xea87('0x44')]+'%'};return _0x1de433;})});}_0x1ce61c=_[_0xea87('0x42')]({},_0x1ce61c,_0x55ad4d[_0xea87('0x45')]);return _0x529485[_0xea87('0x53')](_0x1ce61c);}})[_0xea87('0x1a')](function(_0x3c14fb){if(_0x3c14fb){_0x1a56d2=_0x3c14fb[_0xea87('0x4e')];if(!_0x55ad4d['query'][_0xea87('0x3c')](_0xea87('0x56'))){_0x1ce61c[_0xea87('0x3d')]=qs[_0xea87('0x3d')](_0x55ad4d[_0xea87('0x36')][_0xea87('0x3d')]);_0x1ce61c[_0xea87('0x28')]=qs['offset'](_0x55ad4d[_0xea87('0x36')][_0xea87('0x28')]);}return _0x529485[_0xea87('0x53')](_0x1ce61c);}})[_0xea87('0x1a')](function(_0x57eb29){if(_0x57eb29){return _0x57eb29?{'count':_0x1a56d2,'rows':_0x57eb29}:null;}})[_0xea87('0x1a')](respondWithResult(_0x14ed90,null))['catch'](handleError(_0x14ed90,null));};exports[_0xea87('0x57')]=function(_0x2ad4df,_0x498961,_0x56d4dd){if(_0x2ad4df[_0xea87('0x51')]['id']){delete _0x2ad4df[_0xea87('0x51')]['id'];}return db[_0xea87('0x32')][_0xea87('0x54')]({'where':{'id':_0x2ad4df[_0xea87('0x4b')]['id']}})['then'](handleEntityNotFound(_0x498961,null))['then'](function(_0x563ca1){if(_0x563ca1){_0x2ad4df[_0xea87('0x51')][_0xea87('0x58')]=_0x563ca1['id'];_0x2ad4df[_0xea87('0x51')]['Subjects']=integrations[_0xea87('0x59')](_0x2ad4df[_0xea87('0x51')]['channel'],_0x2ad4df[_0xea87('0x51')]['type']);_0x2ad4df['body'][_0xea87('0x5a')]=integrations[_0xea87('0x5b')](_0x2ad4df['body'][_0xea87('0x5c')],_0x2ad4df[_0xea87('0x51')][_0xea87('0x33')]);return db[_0xea87('0x55')][_0xea87('0x50')](_0x2ad4df[_0xea87('0x51')],{'include':[{'model':db[_0xea87('0x5d')],'as':_0xea87('0x5e')},{'model':db['SugarcrmField'],'as':_0xea87('0x5a')}]});}return null;})[_0xea87('0x1a')](respondWithResult(_0x498961,null))[_0xea87('0x23')](handleError(_0x498961,null));};exports[_0xea87('0x5f')]=function(_0x498999,_0x175fea,_0x3559fa){var _0x40d397='';var _0x27e8c6=['id',_0xea87('0x2f'),_0xea87('0x60'),_0xea87('0x61'),_0xea87('0x62'),'date_start',_0xea87('0x63'),_0xea87('0x64'),'parent_id',_0xea87('0x65'),_0xea87('0x66'),_0xea87('0x67')];return db[_0xea87('0x32')][_0xea87('0x54')]({'where':{'id':_0x498999[_0xea87('0x4b')]['id']},'attributes':['id',_0xea87('0x68'),_0xea87('0x69'),'remoteUri']})[_0xea87('0x1a')](handleEntityNotFound(_0x175fea,null))[_0xea87('0x1a')](function(_0x4cdc16){if(_0x4cdc16){_0x40d397=_0x4cdc16[_0xea87('0x6a')];var _0x3cbec8=_0x40d397[_0xea87('0x6b')](-0x1);if(_0x3cbec8==='/'){_0x40d397=_0x40d397['substring'](0x0,_0x40d397[_0xea87('0x6c')](_0x3cbec8));}return rp({'method':_0xea87('0x6d'),'uri':util['format'](_0xea87('0x6e'),_0x40d397,_0xea87('0x6f')),'json':!![],'form':{'method':_0xea87('0x70'),'input_type':_0xea87('0x71'),'response_type':_0xea87('0x71'),'rest_data':JSON[_0xea87('0x72')]({'user_auth':{'user_name':_0x4cdc16['username'],'password':_0x4cdc16[_0xea87('0x69')],'encryption':'PLAIN'},'application':_0xea87('0x73')})}});}})[_0xea87('0x1a')](function(_0x3a9d9a){if(_0x3a9d9a&&_0x3a9d9a[_0xea87('0x2f')]!==_0xea87('0x74')&&_0x3a9d9a[_0xea87('0x2f')]!==_0xea87('0x75')){return rp({'method':_0xea87('0x6d'),'uri':util[_0xea87('0x76')](_0xea87('0x6e'),_0x40d397,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xea87('0x77'),'input_type':_0xea87('0x71'),'response_type':'JSON','rest_data':JSON[_0xea87('0x72')]({'session':_0x3a9d9a['id'],'module_name':_0xea87('0x78')})}})['then'](function(_0x4877ca){if(_0x4877ca){var _0x561ae2=_['values'](_0x4877ca['module_fields']);_[_0xea87('0x79')](_0x561ae2,function(_0x2b2388){return _0x27e8c6[_0xea87('0x7a')](_0x2b2388[_0xea87('0x2f')]);});return{'count':_0x561ae2[_0xea87('0x4e')],'rows':_[_0xea87('0x31')](_0x561ae2,function(_0x2cbec2){return{'id':_0x2cbec2[_0xea87('0x2f')],'name':_0x2cbec2['label'],'custom':_[_0xea87('0x7b')](_0x2cbec2['name'],'_c')?!![]:![],'options':_0x2cbec2[_0xea87('0x45')]?_['map'](_[_0xea87('0x7c')](_0x2cbec2[_0xea87('0x45')]),function(_0x5b9381){return{'name':_0x5b9381[_0xea87('0x7d')],'value':_0x5b9381[_0xea87('0x2f')]};}):[]};})};}})[_0xea87('0x1a')](respondWithResult(_0x175fea,null))[_0xea87('0x23')](function(_0xd1563b){var _0x3a04d7=_0x498999['query'][_0xea87('0x7e')]?0x1f4:_0xd1563b[_0xea87('0x7f')]||0x1f4;logger[_0xea87('0x1f')](_0xea87('0x80'),_0xea87('0x5f'),_0x3a04d7,JSON[_0xea87('0x72')](_0xd1563b));delete _0xd1563b[_0xea87('0x2f')];if(_0x3a04d7===0x191){_0x3a04d7=0x190;}_0x175fea[_0xea87('0x25')](_0x3a04d7)['send'](_0x498999[_0xea87('0x36')][_0xea87('0x7e')]?{'message':_0xea87('0x81'),'statusCode':_0xd1563b[_0xea87('0x7f')]}:_0xd1563b);});}else{var _0x599a57=0x1f4;_0x175fea[_0xea87('0x25')](_0x599a57)[_0xea87('0x30')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x1139=['findAll','rows','show','params','keys','rawAttributes','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','get_module_fields','Calls','values','module_fields','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SugarcrmAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','name','send','map','SugarcrmAccount','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1139,0x13a));var _0x9113=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1139[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0x9113('0x0'));var emlformat=require(_0x9113('0x1'));var rimraf=require(_0x9113('0x2'));var zipdir=require(_0x9113('0x3'));var jsonpatch=require(_0x9113('0x4'));var rp=require('request-promise');var moment=require(_0x9113('0x5'));var BPromise=require(_0x9113('0x6'));var Mustache=require(_0x9113('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9113('0x8'));var csv=require(_0x9113('0x9'));var ejs=require(_0x9113('0xa'));var fs=require('fs');var _=require(_0x9113('0xb'));var squel=require(_0x9113('0xc'));var crypto=require('crypto');var jsforce=require(_0x9113('0xd'));var deskjs=require(_0x9113('0xe'));var toCsv=require(_0x9113('0x9'));var querystring=require(_0x9113('0xf'));var Papa=require('papaparse');var Redis=require(_0x9113('0x10'));var authService=require(_0x9113('0x11'));var qs=require(_0x9113('0x12'));var as=require(_0x9113('0x13'));var hardwareService=require(_0x9113('0x14'));var logger=require('../../config/logger')(_0x9113('0x15'));var utils=require('../../config/utils');var config=require(_0x9113('0x16'));var licenseUtil=require(_0x9113('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9113('0x18'));var jayson=require(_0x9113('0x19'));var client=jayson[_0x9113('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eda30,_0x561f86,_0x39fe5b,_0x29b4bb){return new BPromise(function(_0x50eaa8,_0x445d6a){var _0x5e3ad1=_0x29b4bb||client;return _0x5e3ad1[_0x9113('0x1b')](_0x5eda30,_0x39fe5b)[_0x9113('0x1c')](function(_0x2ec18b){logger[_0x9113('0x1d')]('SugarcrmAccount,\x20%s,\x20%s',_0x561f86,_0x9113('0x1e'));logger[_0x9113('0x1f')](_0x9113('0x20'),_0x561f86,_0x9113('0x1e'),JSON[_0x9113('0x21')](_0x2ec18b));if(_0x2ec18b['error']){if(_0x2ec18b['error'][_0x9113('0x22')]===0x1f4){logger[_0x9113('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x561f86,_0x2ec18b[_0x9113('0x23')][_0x9113('0x24')]);return _0x445d6a(_0x2ec18b[_0x9113('0x23')][_0x9113('0x24')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x561f86,_0x2ec18b[_0x9113('0x23')][_0x9113('0x24')]);return _0x50eaa8(_0x2ec18b[_0x9113('0x23')]['message']);}else{logger[_0x9113('0x1d')](_0x9113('0x25'),_0x561f86,'request\x20sent');_0x50eaa8(_0x2ec18b['result'][_0x9113('0x24')]);}})[_0x9113('0x26')](function(_0x307b61){logger[_0x9113('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x561f86,_0x307b61);_0x445d6a(_0x307b61);});});}function respondWithStatusCode(_0x310e32,_0x1fd779){_0x1fd779=_0x1fd779||0xcc;return function(_0x15a2e8){if(_0x15a2e8){return _0x310e32[_0x9113('0x27')](_0x1fd779);}return _0x310e32[_0x9113('0x28')](_0x1fd779)[_0x9113('0x29')]();};}function respondWithResult(_0x824b5b,_0x3a58ac){_0x3a58ac=_0x3a58ac||0xc8;return function(_0x2e3f4b){if(_0x2e3f4b){return _0x824b5b[_0x9113('0x28')](_0x3a58ac)[_0x9113('0x2a')](_0x2e3f4b);}};}function respondWithFilteredResult(_0x35b79d,_0x363775){return function(_0x4cda19){if(_0x4cda19){var _0x16d647=_0x4cda19[_0x9113('0x2b')],_0x119db2=_0x363775['offset'],_0x286fee=_0x363775[_0x9113('0x2c')]+_0x363775[_0x9113('0x2d')],_0x155b25;if(_0x286fee>=_0x16d647){_0x286fee=_0x16d647;_0x155b25=0xc8;}else{_0x155b25=0xce;}_0x35b79d[_0x9113('0x28')](_0x155b25);return _0x35b79d[_0x9113('0x2e')]('Content-Range',_0x119db2+'-'+_0x286fee+'/'+_0x16d647)[_0x9113('0x2a')](_0x4cda19);}return null;};}function patchUpdates(_0x49be59){return function(_0x3e6dcb){try{jsonpatch[_0x9113('0x2f')](_0x3e6dcb,_0x49be59,!![]);}catch(_0x5241b8){return BPromise[_0x9113('0x30')](_0x5241b8);}return _0x3e6dcb[_0x9113('0x31')]();};}function saveUpdates(_0xe60fa0,_0x286dd3){return function(_0xa0dbad){if(_0xa0dbad){return _0xa0dbad[_0x9113('0x32')](_0xe60fa0)[_0x9113('0x1c')](function(_0x6d0b11){return _0x6d0b11;});}return null;};}function removeEntity(_0x565b2a,_0x1c3e5c){return function(_0x422ac1){if(_0x422ac1){return _0x422ac1[_0x9113('0x33')]()[_0x9113('0x1c')](function(){_0x565b2a[_0x9113('0x28')](0xcc)[_0x9113('0x29')]();});}};}function handleEntityNotFound(_0xd4b7ee,_0x48fb2e){return function(_0x33a2be){if(!_0x33a2be){_0xd4b7ee[_0x9113('0x27')](0x194);}return _0x33a2be;};}function handleError(_0x2dd2be,_0x301e4c){_0x301e4c=_0x301e4c||0x1f4;return function(_0x780db2){logger[_0x9113('0x23')](_0x780db2['stack']);if(_0x780db2[_0x9113('0x34')]){delete _0x780db2[_0x9113('0x34')];}_0x2dd2be[_0x9113('0x28')](_0x301e4c)[_0x9113('0x35')](_0x780db2);};}exports['index']=function(_0x29bf53,_0x300ea0){var _0x2d4828={},_0x16cd75={},_0x3ddf4f={'count':0x0,'rows':[]};var _0x2875d9=_[_0x9113('0x36')](db[_0x9113('0x37')]['rawAttributes'],function(_0x4587a2){return{'name':_0x4587a2[_0x9113('0x38')],'type':_0x4587a2[_0x9113('0x39')][_0x9113('0x3a')]};});_0x16cd75[_0x9113('0x3b')]=_['map'](_0x2875d9,_0x9113('0x34'));_0x16cd75['query']=_['keys'](_0x29bf53[_0x9113('0x3c')]);_0x16cd75['filters']=_[_0x9113('0x3d')](_0x16cd75[_0x9113('0x3b')],_0x16cd75[_0x9113('0x3c')]);_0x2d4828[_0x9113('0x3e')]=_[_0x9113('0x3d')](_0x16cd75[_0x9113('0x3b')],qs[_0x9113('0x3f')](_0x29bf53[_0x9113('0x3c')][_0x9113('0x3f')]));_0x2d4828[_0x9113('0x3e')]=_0x2d4828['attributes']['length']?_0x2d4828[_0x9113('0x3e')]:_0x16cd75[_0x9113('0x3b')];if(!_0x29bf53['query'][_0x9113('0x40')](_0x9113('0x41'))){_0x2d4828['limit']=qs[_0x9113('0x2d')](_0x29bf53[_0x9113('0x3c')]['limit']);_0x2d4828[_0x9113('0x2c')]=qs[_0x9113('0x2c')](_0x29bf53[_0x9113('0x3c')][_0x9113('0x2c')]);}_0x2d4828[_0x9113('0x42')]=qs[_0x9113('0x43')](_0x29bf53[_0x9113('0x3c')][_0x9113('0x43')]);_0x2d4828[_0x9113('0x44')]=qs[_0x9113('0x45')](_['pick'](_0x29bf53[_0x9113('0x3c')],_0x16cd75['filters']),_0x2875d9);if(_0x29bf53[_0x9113('0x3c')][_0x9113('0x46')]){_0x2d4828[_0x9113('0x44')]=_[_0x9113('0x47')](_0x2d4828[_0x9113('0x44')],{'$or':_[_0x9113('0x36')](_0x2875d9,function(_0x153557){if(_0x153557[_0x9113('0x39')]!==_0x9113('0x48')){var _0x4fa6f8={};_0x4fa6f8[_0x153557['name']]={'$like':'%'+_0x29bf53[_0x9113('0x3c')][_0x9113('0x46')]+'%'};return _0x4fa6f8;}})});}_0x2d4828=_['merge']({},_0x2d4828,_0x29bf53[_0x9113('0x49')]);var _0x22d83e={'where':_0x2d4828['where']};return db[_0x9113('0x37')][_0x9113('0x2b')](_0x22d83e)[_0x9113('0x1c')](function(_0xd85da7){_0x3ddf4f[_0x9113('0x2b')]=_0xd85da7;if(_0x29bf53[_0x9113('0x3c')][_0x9113('0x4a')]){_0x2d4828[_0x9113('0x4b')]=[{'all':!![]}];}return db[_0x9113('0x37')][_0x9113('0x4c')](_0x2d4828);})[_0x9113('0x1c')](function(_0x4b4add){_0x3ddf4f[_0x9113('0x4d')]=_0x4b4add;return _0x3ddf4f;})['then'](respondWithFilteredResult(_0x300ea0,_0x2d4828))[_0x9113('0x26')](handleError(_0x300ea0,null));};exports[_0x9113('0x4e')]=function(_0x5f5a52,_0x269c0d){var _0x3b7cc1={'raw':![],'where':{'id':_0x5f5a52[_0x9113('0x4f')]['id']}},_0x1f93a3={};_0x1f93a3[_0x9113('0x3b')]=_[_0x9113('0x50')](db['SugarcrmAccount'][_0x9113('0x51')]);_0x1f93a3[_0x9113('0x3c')]=_[_0x9113('0x50')](_0x5f5a52[_0x9113('0x3c')]);_0x1f93a3['filtears']=_[_0x9113('0x3d')](_0x1f93a3[_0x9113('0x3b')],_0x1f93a3[_0x9113('0x3c')]);_0x3b7cc1[_0x9113('0x3e')]=_['intersection'](_0x1f93a3['model'],qs[_0x9113('0x3f')](_0x5f5a52['query'][_0x9113('0x3f')]));_0x3b7cc1[_0x9113('0x3e')]=_0x3b7cc1[_0x9113('0x3e')][_0x9113('0x52')]?_0x3b7cc1[_0x9113('0x3e')]:_0x1f93a3['model'];if(_0x5f5a52['query'][_0x9113('0x4a')]){_0x3b7cc1[_0x9113('0x4b')]=[{'all':!![]}];}_0x3b7cc1=_[_0x9113('0x47')]({},_0x3b7cc1,_0x5f5a52['options']);return db[_0x9113('0x37')][_0x9113('0x53')](_0x3b7cc1)[_0x9113('0x1c')](handleEntityNotFound(_0x269c0d,null))[_0x9113('0x1c')](respondWithResult(_0x269c0d,null))[_0x9113('0x26')](handleError(_0x269c0d,null));};exports[_0x9113('0x54')]=function(_0x59e839,_0x2d9b7b){return db[_0x9113('0x37')]['create'](_0x59e839[_0x9113('0x55')],{})[_0x9113('0x1c')](respondWithResult(_0x2d9b7b,0xc9))['catch'](handleError(_0x2d9b7b,null));};exports[_0x9113('0x32')]=function(_0xd6d8a1,_0x18a8be){if(_0xd6d8a1[_0x9113('0x55')]['id']){delete _0xd6d8a1['body']['id'];}return db[_0x9113('0x37')]['find']({'where':{'id':_0xd6d8a1['params']['id']}})[_0x9113('0x1c')](handleEntityNotFound(_0x18a8be,null))[_0x9113('0x1c')](saveUpdates(_0xd6d8a1[_0x9113('0x55')],null))[_0x9113('0x1c')](respondWithResult(_0x18a8be,null))[_0x9113('0x26')](handleError(_0x18a8be,null));};exports['destroy']=function(_0x27848e,_0x435451){return db['SugarcrmAccount'][_0x9113('0x53')]({'where':{'id':_0x27848e[_0x9113('0x4f')]['id']}})[_0x9113('0x1c')](handleEntityNotFound(_0x435451,null))[_0x9113('0x1c')](removeEntity(_0x435451,null))['catch'](handleError(_0x435451,null));};exports[_0x9113('0x56')]=function(_0x3c7f53,_0x1d800b,_0x54a6cf){var _0x3c84bb={};var _0xbcb511={};var _0x59d5aa;var _0x11c22d;return db[_0x9113('0x37')][_0x9113('0x57')]({'where':{'id':_0x3c7f53[_0x9113('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1d800b,null))[_0x9113('0x1c')](function(_0x1594b6){if(_0x1594b6){_0x59d5aa=_0x1594b6;_0xbcb511[_0x9113('0x3b')]=_[_0x9113('0x50')](db[_0x9113('0x58')][_0x9113('0x51')]);_0xbcb511['query']=_['keys'](_0x3c7f53['query']);_0xbcb511[_0x9113('0x45')]=_['intersection'](_0xbcb511[_0x9113('0x3b')],_0xbcb511[_0x9113('0x3c')]);_0x3c84bb['attributes']=_['intersection'](_0xbcb511[_0x9113('0x3b')],qs['fields'](_0x3c7f53['query'][_0x9113('0x3f')]));_0x3c84bb[_0x9113('0x3e')]=_0x3c84bb[_0x9113('0x3e')][_0x9113('0x52')]?_0x3c84bb[_0x9113('0x3e')]:_0xbcb511[_0x9113('0x3b')];_0x3c84bb[_0x9113('0x42')]=qs[_0x9113('0x43')](_0x3c7f53[_0x9113('0x3c')]['sort']);_0x3c84bb[_0x9113('0x44')]=qs[_0x9113('0x45')](_['pick'](_0x3c7f53[_0x9113('0x3c')],_0xbcb511['filters']));if(_0x3c7f53[_0x9113('0x3c')][_0x9113('0x46')]){_0x3c84bb[_0x9113('0x44')]=_[_0x9113('0x47')](_0x3c84bb[_0x9113('0x44')],{'$or':_[_0x9113('0x36')](_0x3c84bb['attributes'],function(_0x4872f2){var _0x15b06f={};_0x15b06f[_0x4872f2]={'$like':'%'+_0x3c7f53[_0x9113('0x3c')]['filter']+'%'};return _0x15b06f;})});}_0x3c84bb=_[_0x9113('0x47')]({},_0x3c84bb,_0x3c7f53[_0x9113('0x49')]);return _0x59d5aa[_0x9113('0x56')](_0x3c84bb);}})[_0x9113('0x1c')](function(_0x366cc2){if(_0x366cc2){_0x11c22d=_0x366cc2[_0x9113('0x52')];if(!_0x3c7f53['query']['hasOwnProperty'](_0x9113('0x41'))){_0x3c84bb[_0x9113('0x2d')]=qs[_0x9113('0x2d')](_0x3c7f53[_0x9113('0x3c')][_0x9113('0x2d')]);_0x3c84bb[_0x9113('0x2c')]=qs[_0x9113('0x2c')](_0x3c7f53[_0x9113('0x3c')][_0x9113('0x2c')]);}return _0x59d5aa[_0x9113('0x56')](_0x3c84bb);}})[_0x9113('0x1c')](function(_0xc84bf9){if(_0xc84bf9){return _0xc84bf9?{'count':_0x11c22d,'rows':_0xc84bf9}:null;}})[_0x9113('0x1c')](respondWithResult(_0x1d800b,null))['catch'](handleError(_0x1d800b,null));};exports[_0x9113('0x59')]=function(_0x424474,_0x4acd60,_0x1c0bb3){if(_0x424474['body']['id']){delete _0x424474[_0x9113('0x55')]['id'];}return db[_0x9113('0x37')][_0x9113('0x57')]({'where':{'id':_0x424474[_0x9113('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4acd60,null))[_0x9113('0x1c')](function(_0x2eb16f){if(_0x2eb16f){_0x424474[_0x9113('0x55')][_0x9113('0x5a')]=_0x2eb16f['id'];_0x424474[_0x9113('0x55')][_0x9113('0x5b')]=integrations['getSubjects'](_0x424474[_0x9113('0x55')][_0x9113('0x5c')],_0x424474['body'][_0x9113('0x39')]);_0x424474[_0x9113('0x55')][_0x9113('0x5d')]=integrations[_0x9113('0x5e')](_0x424474[_0x9113('0x55')][_0x9113('0x5c')],_0x424474['body'][_0x9113('0x39')]);return db[_0x9113('0x58')][_0x9113('0x54')](_0x424474[_0x9113('0x55')],{'include':[{'model':db[_0x9113('0x5f')],'as':'Subjects'},{'model':db[_0x9113('0x5f')],'as':'Descriptions'}]});}return null;})[_0x9113('0x1c')](respondWithResult(_0x4acd60,null))[_0x9113('0x26')](handleError(_0x4acd60,null));};exports[_0x9113('0x60')]=function(_0x79a8cd,_0x5d5c21,_0x24b26f){var _0x74999e='';var _0xfda0b3=['id','name',_0x9113('0x61'),_0x9113('0x62'),'description',_0x9113('0x63'),'duration_hours',_0x9113('0x64'),_0x9113('0x65'),_0x9113('0x66'),'parent_name',_0x9113('0x67')];return db['SugarcrmAccount'][_0x9113('0x57')]({'where':{'id':_0x79a8cd[_0x9113('0x4f')]['id']},'attributes':['id',_0x9113('0x68'),_0x9113('0x69'),_0x9113('0x6a')]})[_0x9113('0x1c')](handleEntityNotFound(_0x5d5c21,null))[_0x9113('0x1c')](function(_0x57301f){if(_0x57301f){_0x74999e=_0x57301f[_0x9113('0x6a')];var _0x16d964=_0x74999e[_0x9113('0x6b')](-0x1);if(_0x16d964==='/'){_0x74999e=_0x74999e[_0x9113('0x6c')](0x0,_0x74999e[_0x9113('0x6d')](_0x16d964));}return rp({'method':'POST','uri':util['format'](_0x9113('0x6e'),_0x74999e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x9113('0x6f'),'input_type':_0x9113('0x70'),'response_type':_0x9113('0x70'),'rest_data':JSON[_0x9113('0x21')]({'user_auth':{'user_name':_0x57301f[_0x9113('0x68')],'password':_0x57301f[_0x9113('0x69')],'encryption':_0x9113('0x71')},'application':_0x9113('0x72')})}});}})['then'](function(_0x190fd3){if(_0x190fd3&&_0x190fd3['name']!==_0x9113('0x73')&&_0x190fd3[_0x9113('0x34')]!==_0x9113('0x74')){return rp({'method':_0x9113('0x75'),'uri':util[_0x9113('0x76')](_0x9113('0x6e'),_0x74999e,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x9113('0x77'),'input_type':_0x9113('0x70'),'response_type':_0x9113('0x70'),'rest_data':JSON[_0x9113('0x21')]({'session':_0x190fd3['id'],'module_name':_0x9113('0x78')})}})[_0x9113('0x1c')](function(_0x54b499){if(_0x54b499){var _0x267782=_[_0x9113('0x79')](_0x54b499[_0x9113('0x7a')]);_['remove'](_0x267782,function(_0x42113c){return _0xfda0b3[_0x9113('0x7b')](_0x42113c[_0x9113('0x34')]);});return{'count':_0x267782[_0x9113('0x52')],'rows':_['map'](_0x267782,function(_0x27db4a){return{'id':_0x27db4a['name'],'name':_0x27db4a['label'],'custom':_[_0x9113('0x7c')](_0x27db4a[_0x9113('0x34')],'_c')?!![]:![],'options':_0x27db4a[_0x9113('0x49')]?_[_0x9113('0x36')](_[_0x9113('0x79')](_0x27db4a[_0x9113('0x49')]),function(_0x2904d3){return{'name':_0x2904d3[_0x9113('0x7d')],'value':_0x2904d3['name']};}):[]};})};}})[_0x9113('0x1c')](respondWithResult(_0x5d5c21,null))['catch'](function(_0x349ea7){var _0x18cb4d=_0x79a8cd[_0x9113('0x3c')][_0x9113('0x7e')]?0x1f4:_0x349ea7[_0x9113('0x7f')]||0x1f4;logger[_0x9113('0x23')](_0x9113('0x80'),'getFields',_0x18cb4d,JSON['stringify'](_0x349ea7));delete _0x349ea7[_0x9113('0x34')];if(_0x18cb4d===0x191){_0x18cb4d=0x190;}_0x5d5c21[_0x9113('0x28')](_0x18cb4d)['send'](_0x79a8cd[_0x9113('0x3c')][_0x9113('0x7e')]?{'message':_0x9113('0x81'),'statusCode':_0x349ea7['statusCode']}:_0x349ea7);});}else{var _0x4a591a=0x1f4;_0x5d5c21[_0x9113('0x28')](_0x4a591a)[_0x9113('0x35')]({'message':_0x9113('0x81'),'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 c2a0f6f..bd5fb48 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 _0xab62=['path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ba76a,_0x175509){var _0x174c99=function(_0x44944a){while(--_0x44944a){_0x1ba76a['push'](_0x1ba76a['shift']());}};_0x174c99(++_0x175509);}(_0xab62,0x96));var _0x2ab6=function(_0x3a6382,_0x4470d8){_0x3a6382=_0x3a6382-0x0;var _0x3d4fff=_0xab62[_0x3a6382];return _0x3d4fff;};'use strict';var _=require(_0x2ab6('0x0'));var util=require(_0x2ab6('0x1'));var logger=require('../../config/logger')(_0x2ab6('0x2'));var moment=require(_0x2ab6('0x3'));var BPromise=require(_0x2ab6('0x4'));var rp=require(_0x2ab6('0x5'));var fs=require('fs');var path=require(_0x2ab6('0x6'));var rimraf=require(_0x2ab6('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ab6('0x8'));var integrations=require(_0x2ab6('0x9'));module[_0x2ab6('0xa')]=function(_0x5dea1a,_0x1e2e3c){return _0x5dea1a['define'](_0x2ab6('0xb'),attributes,{'tableName':_0x2ab6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa076=['rimraf','../../config/environment','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','moment','bluebird','request-promise','path'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0xa076,0xb5));var _0x6a07=function(_0x3c33a7,_0x19eac6){_0x3c33a7=_0x3c33a7-0x0;var _0x1d4d1d=_0xa076[_0x3c33a7];return _0x1d4d1d;};'use strict';var _=require(_0x6a07('0x0'));var util=require(_0x6a07('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6a07('0x2'));var BPromise=require(_0x6a07('0x3'));var rp=require(_0x6a07('0x4'));var fs=require('fs');var path=require(_0x6a07('0x5'));var rimraf=require(_0x6a07('0x6'));var config=require(_0x6a07('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x6a07('0x8'));module['exports']=function(_0x4f539e,_0x27250c){return _0x4f539e['define'](_0x6a07('0x9'),attributes,{'tableName':_0x6a07('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 ca4aa17..ef1eba0 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 _0xa3a1=['result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','then','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SugarcrmAccount,\x20%s,\x20%s','message','info'];(function(_0x527a3e,_0x12f3c4){var _0x13a5be=function(_0x8ada08){while(--_0x8ada08){_0x527a3e['push'](_0x527a3e['shift']());}};_0x13a5be(++_0x12f3c4);}(_0xa3a1,0xe1));var _0x1a3a=function(_0x2112c0,_0x48d9f0){_0x2112c0=_0x2112c0-0x0;var _0x2b835d=_0xa3a1[_0x2112c0];return _0x2b835d;};'use strict';var _=require(_0x1a3a('0x0'));var util=require(_0x1a3a('0x1'));var moment=require(_0x1a3a('0x2'));var BPromise=require(_0x1a3a('0x3'));var rs=require(_0x1a3a('0x4'));var fs=require('fs');var Redis=require(_0x1a3a('0x5'));var db=require(_0x1a3a('0x6'))['db'];var utils=require(_0x1a3a('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a3a('0x8'));var jayson=require(_0x1a3a('0x9'));var client=jayson['client'][_0x1a3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa387f7,_0x48026a,_0x597e17){return new BPromise(function(_0x238b8f,_0x2e52f3){return client['request'](_0xa387f7,_0x597e17)['then'](function(_0x24dfe6){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x48026a,_0x1a3a('0xb'));logger[_0x1a3a('0xc')](_0x1a3a('0xd'),_0x48026a,_0x1a3a('0xb'),JSON[_0x1a3a('0xe')](_0x24dfe6));if(_0x24dfe6['error']){if(_0x24dfe6['error'][_0x1a3a('0xf')]===0x1f4){logger[_0x1a3a('0x10')](_0x1a3a('0x11'),_0x48026a,_0x24dfe6[_0x1a3a('0x10')][_0x1a3a('0x12')]);return _0x2e52f3(_0x24dfe6[_0x1a3a('0x10')][_0x1a3a('0x12')]);}logger[_0x1a3a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x48026a,_0x24dfe6[_0x1a3a('0x10')]['message']);return _0x238b8f(_0x24dfe6[_0x1a3a('0x10')][_0x1a3a('0x12')]);}else{logger[_0x1a3a('0x13')](_0x1a3a('0x11'),_0x48026a,_0x1a3a('0xb'));_0x238b8f(_0x24dfe6[_0x1a3a('0x14')]['message']);}})[_0x1a3a('0x15')](function(_0x48458f){logger[_0x1a3a('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x48026a,_0x48458f);_0x2e52f3(_0x48458f);});});}exports[_0x1a3a('0x16')]=function(_0x4274d5){var _0x45e830=this;return new Promise(function(_0xfbe202,_0x1d7491){return db[_0x1a3a('0x17')]['findAll']({'raw':_0x4274d5[_0x1a3a('0x18')]?_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x19')]===undefined?!![]:![]:!![],'where':_0x4274d5[_0x1a3a('0x18')]?_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x1a')]||null:null,'attributes':_0x4274d5['options']?_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x1b')]||null:null,'limit':_0x4274d5[_0x1a3a('0x18')]?_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x1c')]||null:null,'include':_0x4274d5[_0x1a3a('0x18')]?_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x1d')]?_[_0x1a3a('0x1e')](_0x4274d5[_0x1a3a('0x18')][_0x1a3a('0x1d')],function(_0x363a6e){return{'model':db[_0x363a6e['model']],'as':_0x363a6e['as'],'attributes':_0x363a6e['attributes'],'include':_0x363a6e[_0x1a3a('0x1d')]?_[_0x1a3a('0x1e')](_0x363a6e['include'],function(_0x33a8c9){return{'model':db[_0x33a8c9[_0x1a3a('0x1f')]],'as':_0x33a8c9['as'],'attributes':_0x33a8c9[_0x1a3a('0x1b')],'include':_0x33a8c9[_0x1a3a('0x1d')]?_[_0x1a3a('0x1e')](_0x33a8c9[_0x1a3a('0x1d')],function(_0xdc7f7a){return{'model':db[_0xdc7f7a[_0x1a3a('0x1f')]],'as':_0xdc7f7a['as'],'attributes':_0xdc7f7a[_0x1a3a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1a3a('0x20')](function(_0x3cc860){logger[_0x1a3a('0x13')](_0x1a3a('0x16'),_0x4274d5);logger[_0x1a3a('0xc')](_0x1a3a('0x16'),_0x4274d5,JSON['stringify'](_0x3cc860));_0xfbe202(_0x3cc860);})['catch'](function(_0x340499){logger[_0x1a3a('0x10')]('GetSugarcrmAccount',_0x340499[_0x1a3a('0x12')],_0x4274d5);_0x1d7491(_0x45e830['error'](0x1f4,_0x340499[_0x1a3a('0x12')]));});});};exports[_0x1a3a('0x21')]=function(_0x3f4a9b){var _0x2996fd=this;return new Promise(function(_0x4a0ea2,_0x5c8a5e){return db[_0x1a3a('0x17')][_0x1a3a('0x22')]({'raw':_0x3f4a9b[_0x1a3a('0x18')]?_0x3f4a9b[_0x1a3a('0x18')][_0x1a3a('0x19')]===undefined?!![]:![]:!![],'where':_0x3f4a9b['options']?_0x3f4a9b[_0x1a3a('0x18')]['where']||null:null,'attributes':_0x3f4a9b[_0x1a3a('0x18')]?_0x3f4a9b[_0x1a3a('0x18')]['attributes']||null:null,'include':_0x3f4a9b[_0x1a3a('0x18')]?_0x3f4a9b[_0x1a3a('0x18')][_0x1a3a('0x1d')]?_[_0x1a3a('0x1e')](_0x3f4a9b[_0x1a3a('0x18')][_0x1a3a('0x1d')],function(_0x5ab238){return{'model':db[_0x5ab238['model']],'as':_0x5ab238['as'],'attributes':_0x5ab238['attributes'],'include':_0x5ab238[_0x1a3a('0x1d')]?_[_0x1a3a('0x1e')](_0x5ab238[_0x1a3a('0x1d')],function(_0x4cd8df){return{'model':db[_0x4cd8df[_0x1a3a('0x1f')]],'as':_0x4cd8df['as'],'attributes':_0x4cd8df[_0x1a3a('0x1b')],'include':_0x4cd8df['include']?_['map'](_0x4cd8df['include'],function(_0x3c3044){return{'model':db[_0x3c3044[_0x1a3a('0x1f')]],'as':_0x3c3044['as'],'attributes':_0x3c3044[_0x1a3a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d302d){logger[_0x1a3a('0x13')]('ShowSugarcrmAccount',_0x3f4a9b);logger[_0x1a3a('0xc')](_0x1a3a('0x21'),_0x3f4a9b,JSON[_0x1a3a('0xe')](_0x4d302d));_0x4a0ea2(_0x4d302d);})[_0x1a3a('0x15')](function(_0x1ec54b){logger[_0x1a3a('0x10')](_0x1a3a('0x21'),_0x1ec54b[_0x1a3a('0x12')],_0x3f4a9b);_0x5c8a5e(_0x2996fd[_0x1a3a('0x10')](0x1f4,_0x1ec54b[_0x1a3a('0x12')]));});});}; \ No newline at end of file +var _0x7e46=['findAll','options','raw','where','limit','include','map','attributes','model','GetSugarcrmAccount','stringify','find','ShowSugarcrmAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','SugarcrmAccount'];(function(_0x56e996,_0x311dd2){var _0x41e4d4=function(_0x450c3a){while(--_0x450c3a){_0x56e996['push'](_0x56e996['shift']());}};_0x41e4d4(++_0x311dd2);}(_0x7e46,0x7c));var _0x67e4=function(_0x1f80b1,_0x3bfb21){_0x1f80b1=_0x1f80b1-0x0;var _0x4335cd=_0x7e46[_0x1f80b1];return _0x4335cd;};'use strict';var _=require(_0x67e4('0x0'));var util=require(_0x67e4('0x1'));var moment=require('moment');var BPromise=require(_0x67e4('0x2'));var rs=require(_0x67e4('0x3'));var fs=require('fs');var Redis=require(_0x67e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x67e4('0x5'));var logger=require(_0x67e4('0x6'))(_0x67e4('0x7'));var config=require(_0x67e4('0x8'));var jayson=require(_0x67e4('0x9'));var client=jayson[_0x67e4('0xa')][_0x67e4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39e1e4,_0x2cc8db,_0x225343){return new BPromise(function(_0x2f0c0f,_0x624de5){return client[_0x67e4('0xc')](_0x39e1e4,_0x225343)[_0x67e4('0xd')](function(_0xcb4d0d){logger[_0x67e4('0xe')](_0x67e4('0xf'),_0x2cc8db,_0x67e4('0x10'));logger[_0x67e4('0x11')](_0x67e4('0x12'),_0x2cc8db,_0x67e4('0x10'),JSON['stringify'](_0xcb4d0d));if(_0xcb4d0d['error']){if(_0xcb4d0d[_0x67e4('0x13')]['code']===0x1f4){logger[_0x67e4('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cc8db,_0xcb4d0d[_0x67e4('0x13')][_0x67e4('0x14')]);return _0x624de5(_0xcb4d0d[_0x67e4('0x13')][_0x67e4('0x14')]);}logger[_0x67e4('0x13')](_0x67e4('0xf'),_0x2cc8db,_0xcb4d0d['error'][_0x67e4('0x14')]);return _0x2f0c0f(_0xcb4d0d[_0x67e4('0x13')][_0x67e4('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x2cc8db,'request\x20sent');_0x2f0c0f(_0xcb4d0d[_0x67e4('0x15')][_0x67e4('0x14')]);}})[_0x67e4('0x16')](function(_0x14afec){logger[_0x67e4('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2cc8db,_0x14afec);_0x624de5(_0x14afec);});});}exports['GetSugarcrmAccount']=function(_0x3fee80){var _0x111856=this;return new Promise(function(_0x3a1e9e,_0x4a3ddc){return db[_0x67e4('0x17')][_0x67e4('0x18')]({'raw':_0x3fee80['options']?_0x3fee80[_0x67e4('0x19')][_0x67e4('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fee80[_0x67e4('0x19')]?_0x3fee80[_0x67e4('0x19')][_0x67e4('0x1b')]||null:null,'attributes':_0x3fee80[_0x67e4('0x19')]?_0x3fee80['options']['attributes']||null:null,'limit':_0x3fee80[_0x67e4('0x19')]?_0x3fee80['options'][_0x67e4('0x1c')]||null:null,'include':_0x3fee80[_0x67e4('0x19')]?_0x3fee80[_0x67e4('0x19')][_0x67e4('0x1d')]?_[_0x67e4('0x1e')](_0x3fee80['options']['include'],function(_0xb8a6e4){return{'model':db[_0xb8a6e4['model']],'as':_0xb8a6e4['as'],'attributes':_0xb8a6e4[_0x67e4('0x1f')],'include':_0xb8a6e4[_0x67e4('0x1d')]?_['map'](_0xb8a6e4[_0x67e4('0x1d')],function(_0x39c9c1){return{'model':db[_0x39c9c1[_0x67e4('0x20')]],'as':_0x39c9c1['as'],'attributes':_0x39c9c1[_0x67e4('0x1f')],'include':_0x39c9c1[_0x67e4('0x1d')]?_['map'](_0x39c9c1['include'],function(_0x4d6934){return{'model':db[_0x4d6934[_0x67e4('0x20')]],'as':_0x4d6934['as'],'attributes':_0x4d6934[_0x67e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d1d3e){logger[_0x67e4('0xe')](_0x67e4('0x21'),_0x3fee80);logger[_0x67e4('0x11')](_0x67e4('0x21'),_0x3fee80,JSON[_0x67e4('0x22')](_0x3d1d3e));_0x3a1e9e(_0x3d1d3e);})['catch'](function(_0x5af006){logger[_0x67e4('0x13')](_0x67e4('0x21'),_0x5af006[_0x67e4('0x14')],_0x3fee80);_0x4a3ddc(_0x111856[_0x67e4('0x13')](0x1f4,_0x5af006[_0x67e4('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x735eaf){var _0x42d647=this;return new Promise(function(_0x4c916e,_0x2d6b1f){return db['SugarcrmAccount'][_0x67e4('0x23')]({'raw':_0x735eaf[_0x67e4('0x19')]?_0x735eaf['options'][_0x67e4('0x1a')]===undefined?!![]:![]:!![],'where':_0x735eaf[_0x67e4('0x19')]?_0x735eaf[_0x67e4('0x19')][_0x67e4('0x1b')]||null:null,'attributes':_0x735eaf[_0x67e4('0x19')]?_0x735eaf[_0x67e4('0x19')][_0x67e4('0x1f')]||null:null,'include':_0x735eaf[_0x67e4('0x19')]?_0x735eaf[_0x67e4('0x19')][_0x67e4('0x1d')]?_[_0x67e4('0x1e')](_0x735eaf[_0x67e4('0x19')]['include'],function(_0x132857){return{'model':db[_0x132857[_0x67e4('0x20')]],'as':_0x132857['as'],'attributes':_0x132857[_0x67e4('0x1f')],'include':_0x132857['include']?_[_0x67e4('0x1e')](_0x132857[_0x67e4('0x1d')],function(_0x45b67b){return{'model':db[_0x45b67b[_0x67e4('0x20')]],'as':_0x45b67b['as'],'attributes':_0x45b67b[_0x67e4('0x1f')],'include':_0x45b67b[_0x67e4('0x1d')]?_[_0x67e4('0x1e')](_0x45b67b[_0x67e4('0x1d')],function(_0xe6c5b9){return{'model':db[_0xe6c5b9['model']],'as':_0xe6c5b9['as'],'attributes':_0xe6c5b9[_0x67e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44fdb8){logger[_0x67e4('0xe')]('ShowSugarcrmAccount',_0x735eaf);logger[_0x67e4('0x11')](_0x67e4('0x24'),_0x735eaf,JSON[_0x67e4('0x22')](_0x44fdb8));_0x4c916e(_0x44fdb8);})[_0x67e4('0x16')](function(_0x3ad7ab){logger[_0x67e4('0x13')]('ShowSugarcrmAccount',_0x3ad7ab[_0x67e4('0x14')],_0x735eaf);_0x2d6b1f(_0x42d647[_0x67e4('0x13')](0x1f4,_0x3ad7ab[_0x67e4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 17e70dc..58efa6e 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 _0x59f2=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields'];(function(_0xb6573e,_0x156da9){var _0x251daa=function(_0x598c0f){while(--_0x598c0f){_0xb6573e['push'](_0xb6573e['shift']());}};_0x251daa(++_0x156da9);}(_0x59f2,0x10b));var _0x259f=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x59f2[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require(_0x259f('0x0'));var path=require(_0x259f('0x1'));var timeout=require(_0x259f('0x2'));var express=require(_0x259f('0x3'));var router=express[_0x259f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x259f('0x5'));var config=require('../../config/environment');var controller=require(_0x259f('0x6'));router['get']('/',auth[_0x259f('0x7')](),controller[_0x259f('0x8')]);router['get'](_0x259f('0x9'),auth[_0x259f('0x7')](),controller[_0x259f('0xa')]);router[_0x259f('0xb')](_0x259f('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x259f('0xb')](_0x259f('0xd'),auth[_0x259f('0x7')](),controller[_0x259f('0xe')]);router[_0x259f('0xb')](_0x259f('0xf'),auth[_0x259f('0x7')](),controller[_0x259f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x259f('0x11')]);router['put']('/:id',auth[_0x259f('0x7')](),controller['update']);router['delete'](_0x259f('0x9'),auth['isAuthenticated'](),controller[_0x259f('0x12')]);module[_0x259f('0x13')]=router; \ No newline at end of file +var _0xbf51=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ed7c1,_0x38bad0){var _0x24eb1d=function(_0x359198){while(--_0x359198){_0x3ed7c1['push'](_0x3ed7c1['shift']());}};_0x24eb1d(++_0x38bad0);}(_0xbf51,0x102));var _0x1bf5=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xbf51[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x1bf5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1bf5('0x1'));var router=express[_0x1bf5('0x2')]();var auth=require(_0x1bf5('0x3'));var interaction=require(_0x1bf5('0x4'));var config=require(_0x1bf5('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x1bf5('0x6')]('/',auth[_0x1bf5('0x7')](),controller[_0x1bf5('0x8')]);router[_0x1bf5('0x6')](_0x1bf5('0x9'),auth[_0x1bf5('0x7')](),controller[_0x1bf5('0xa')]);router[_0x1bf5('0x6')](_0x1bf5('0xb'),auth[_0x1bf5('0x7')](),controller[_0x1bf5('0xc')]);router['get'](_0x1bf5('0xd'),auth[_0x1bf5('0x7')](),controller[_0x1bf5('0xe')]);router[_0x1bf5('0x6')]('/:id/descriptions',auth[_0x1bf5('0x7')](),controller[_0x1bf5('0xf')]);router[_0x1bf5('0x10')]('/',auth[_0x1bf5('0x7')](),controller[_0x1bf5('0x11')]);router[_0x1bf5('0x12')]('/:id',auth[_0x1bf5('0x7')](),controller[_0x1bf5('0x13')]);router[_0x1bf5('0x14')](_0x1bf5('0x9'),auth[_0x1bf5('0x7')](),controller['destroy']);module[_0x1bf5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 031f33a..54e30e3 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 _0x8e14=['exports','STRING','sequelize'];(function(_0x43efdc,_0x5936f7){var _0x124ede=function(_0x53e426){while(--_0x53e426){_0x43efdc['push'](_0x43efdc['shift']());}};_0x124ede(++_0x5936f7);}(_0x8e14,0x65));var _0x48e1=function(_0x58050f,_0x668624){_0x58050f=_0x58050f-0x0;var _0x4683ca=_0x8e14[_0x58050f];return _0x4683ca;};'use strict';var Sequelize=require(_0x48e1('0x0'));module[_0x48e1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x48e1('0x2')]}}; \ No newline at end of file +var _0x770b=['sequelize','exports','STRING'];(function(_0x2db48f,_0x3a671f){var _0x1c9f28=function(_0x88badd){while(--_0x88badd){_0x2db48f['push'](_0x2db48f['shift']());}};_0x1c9f28(++_0x3a671f);}(_0x770b,0x141));var _0xb770=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0x770b[_0x5ec9db];return _0xfc7061;};'use strict';var Sequelize=require(_0xb770('0x0'));module[_0xb770('0x1')]={'name':{'type':Sequelize[_0xb770('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 33f903e..c286999 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 _0x70c3=['set','Content-Range','reject','save','update','destroy','sendStatus','name','index','map','SugarcrmConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','rawAttributes','filtears','create','body','find','params','findOne','SugarcrmField','getFields','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','limit'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x70c3,0x1a3));var _0x370c=function(_0x4ad356,_0x5e81df){_0x4ad356=_0x4ad356-0x0;var _0x2d8eb3=_0x70c3[_0x4ad356];return _0x2d8eb3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x370c('0x0'));var rimraf=require(_0x370c('0x1'));var zipdir=require(_0x370c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x370c('0x3'));var moment=require(_0x370c('0x4'));var BPromise=require(_0x370c('0x5'));var Mustache=require(_0x370c('0x6'));var util=require(_0x370c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x370c('0x8'));var ejs=require(_0x370c('0x9'));var fs=require('fs');var _=require(_0x370c('0xa'));var squel=require(_0x370c('0xb'));var crypto=require(_0x370c('0xc'));var jsforce=require(_0x370c('0xd'));var deskjs=require(_0x370c('0xe'));var toCsv=require(_0x370c('0x8'));var querystring=require(_0x370c('0xf'));var Papa=require('papaparse');var Redis=require(_0x370c('0x10'));var authService=require(_0x370c('0x11'));var qs=require(_0x370c('0x12'));var as=require(_0x370c('0x13'));var hardwareService=require(_0x370c('0x14'));var logger=require('../../config/logger')(_0x370c('0x15'));var utils=require(_0x370c('0x16'));var config=require(_0x370c('0x17'));var licenseUtil=require(_0x370c('0x18'));var db=require(_0x370c('0x19'))['db'];var jayson=require(_0x370c('0x1a'));var client=jayson['client'][_0x370c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5aeaec,_0x2d259f,_0x15c3d7,_0x225caa){return new BPromise(function(_0x2ba2f8,_0x227978){var _0x464e03=_0x225caa||client;return _0x464e03[_0x370c('0x1c')](_0x5aeaec,_0x15c3d7)[_0x370c('0x1d')](function(_0x25f7d1){logger[_0x370c('0x1e')](_0x370c('0x1f'),_0x2d259f,'request\x20sent');logger[_0x370c('0x20')](_0x370c('0x21'),_0x2d259f,_0x370c('0x22'),JSON[_0x370c('0x23')](_0x25f7d1));if(_0x25f7d1[_0x370c('0x24')]){if(_0x25f7d1[_0x370c('0x24')][_0x370c('0x25')]===0x1f4){logger[_0x370c('0x24')](_0x370c('0x1f'),_0x2d259f,_0x25f7d1[_0x370c('0x24')][_0x370c('0x26')]);return _0x227978(_0x25f7d1['error'][_0x370c('0x26')]);}logger[_0x370c('0x24')](_0x370c('0x1f'),_0x2d259f,_0x25f7d1['error'][_0x370c('0x26')]);return _0x2ba2f8(_0x25f7d1[_0x370c('0x24')]['message']);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d259f,_0x370c('0x22'));_0x2ba2f8(_0x25f7d1[_0x370c('0x27')]['message']);}})[_0x370c('0x28')](function(_0x13e4ff){logger[_0x370c('0x24')](_0x370c('0x1f'),_0x2d259f,_0x13e4ff);_0x227978(_0x13e4ff);});});}function respondWithStatusCode(_0x28b603,_0x23d8eb){_0x23d8eb=_0x23d8eb||0xcc;return function(_0x48d356){if(_0x48d356){return _0x28b603['sendStatus'](_0x23d8eb);}return _0x28b603[_0x370c('0x29')](_0x23d8eb)[_0x370c('0x2a')]();};}function respondWithResult(_0x22fb7e,_0x4abb40){_0x4abb40=_0x4abb40||0xc8;return function(_0x30ec44){if(_0x30ec44){return _0x22fb7e['status'](_0x4abb40)[_0x370c('0x2b')](_0x30ec44);}};}function respondWithFilteredResult(_0x54e781,_0x280f33){return function(_0x2e36eb){if(_0x2e36eb){var _0x1cf9d1=_0x2e36eb['count'],_0x2949cc=_0x280f33[_0x370c('0x2c')],_0x5c8370=_0x280f33[_0x370c('0x2c')]+_0x280f33[_0x370c('0x2d')],_0x54aa9d;if(_0x5c8370>=_0x1cf9d1){_0x5c8370=_0x1cf9d1;_0x54aa9d=0xc8;}else{_0x54aa9d=0xce;}_0x54e781[_0x370c('0x29')](_0x54aa9d);return _0x54e781[_0x370c('0x2e')](_0x370c('0x2f'),_0x2949cc+'-'+_0x5c8370+'/'+_0x1cf9d1)[_0x370c('0x2b')](_0x2e36eb);}return null;};}function patchUpdates(_0x5bb754){return function(_0x17fe16){try{jsonpatch['apply'](_0x17fe16,_0x5bb754,!![]);}catch(_0x23417f){return BPromise[_0x370c('0x30')](_0x23417f);}return _0x17fe16[_0x370c('0x31')]();};}function saveUpdates(_0x548440,_0x53c0de){return function(_0x10de43){if(_0x10de43){return _0x10de43[_0x370c('0x32')](_0x548440)[_0x370c('0x1d')](function(_0x22ad48){return _0x22ad48;});}return null;};}function removeEntity(_0x1bd304,_0x4551e2){return function(_0x2c40e6){if(_0x2c40e6){return _0x2c40e6[_0x370c('0x33')]()[_0x370c('0x1d')](function(){_0x1bd304[_0x370c('0x29')](0xcc)[_0x370c('0x2a')]();});}};}function handleEntityNotFound(_0x239768,_0x11a550){return function(_0x197957){if(!_0x197957){_0x239768[_0x370c('0x34')](0x194);}return _0x197957;};}function handleError(_0x5bc529,_0x2b43ee){_0x2b43ee=_0x2b43ee||0x1f4;return function(_0x35cada){logger['error'](_0x35cada['stack']);if(_0x35cada[_0x370c('0x35')]){delete _0x35cada[_0x370c('0x35')];}_0x5bc529[_0x370c('0x29')](_0x2b43ee)['send'](_0x35cada);};}exports[_0x370c('0x36')]=function(_0x225d90,_0x3311bc){var _0x5ce3d9={},_0x551018={},_0x3526e9={'count':0x0,'rows':[]};var _0x37bb3d=_[_0x370c('0x37')](db[_0x370c('0x38')]['rawAttributes'],function(_0xf98156){return{'name':_0xf98156[_0x370c('0x39')],'type':_0xf98156[_0x370c('0x3a')]['key']};});_0x551018[_0x370c('0x3b')]=_[_0x370c('0x37')](_0x37bb3d,_0x370c('0x35'));_0x551018[_0x370c('0x3c')]=_[_0x370c('0x3d')](_0x225d90['query']);_0x551018[_0x370c('0x3e')]=_[_0x370c('0x3f')](_0x551018[_0x370c('0x3b')],_0x551018[_0x370c('0x3c')]);_0x5ce3d9[_0x370c('0x40')]=_[_0x370c('0x3f')](_0x551018['model'],qs[_0x370c('0x41')](_0x225d90['query'][_0x370c('0x41')]));_0x5ce3d9[_0x370c('0x40')]=_0x5ce3d9[_0x370c('0x40')][_0x370c('0x42')]?_0x5ce3d9[_0x370c('0x40')]:_0x551018[_0x370c('0x3b')];if(!_0x225d90[_0x370c('0x3c')][_0x370c('0x43')](_0x370c('0x44'))){_0x5ce3d9[_0x370c('0x2d')]=qs[_0x370c('0x2d')](_0x225d90[_0x370c('0x3c')][_0x370c('0x2d')]);_0x5ce3d9[_0x370c('0x2c')]=qs[_0x370c('0x2c')](_0x225d90[_0x370c('0x3c')][_0x370c('0x2c')]);}_0x5ce3d9['order']=qs['sort'](_0x225d90[_0x370c('0x3c')][_0x370c('0x45')]);_0x5ce3d9['where']=qs[_0x370c('0x3e')](_[_0x370c('0x46')](_0x225d90[_0x370c('0x3c')],_0x551018[_0x370c('0x3e')]),_0x37bb3d);if(_0x225d90[_0x370c('0x3c')][_0x370c('0x47')]){_0x5ce3d9[_0x370c('0x48')]=_[_0x370c('0x49')](_0x5ce3d9[_0x370c('0x48')],{'$or':_[_0x370c('0x37')](_0x37bb3d,function(_0x33a042){if(_0x33a042[_0x370c('0x3a')]!==_0x370c('0x4a')){var _0xea4a6d={};_0xea4a6d[_0x33a042[_0x370c('0x35')]]={'$like':'%'+_0x225d90[_0x370c('0x3c')]['filter']+'%'};return _0xea4a6d;}})});}_0x5ce3d9=_[_0x370c('0x49')]({},_0x5ce3d9,_0x225d90[_0x370c('0x4b')]);var _0x21b18a={'where':_0x5ce3d9[_0x370c('0x48')]};return db[_0x370c('0x38')][_0x370c('0x4c')](_0x21b18a)[_0x370c('0x1d')](function(_0x59cd0c){_0x3526e9['count']=_0x59cd0c;if(_0x225d90[_0x370c('0x3c')][_0x370c('0x4d')]){_0x5ce3d9[_0x370c('0x4e')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x370c('0x4f')](_0x5ce3d9);})[_0x370c('0x1d')](function(_0x49bf45){_0x3526e9[_0x370c('0x50')]=_0x49bf45;return _0x3526e9;})['then'](respondWithFilteredResult(_0x3311bc,_0x5ce3d9))[_0x370c('0x28')](handleError(_0x3311bc,null));};exports['show']=function(_0x29745f,_0x513916){var _0x17fc7c={'raw':![],'where':{'id':_0x29745f['params']['id']}},_0xe7ac48={};_0xe7ac48['model']=_['keys'](db[_0x370c('0x38')][_0x370c('0x51')]);_0xe7ac48['query']=_[_0x370c('0x3d')](_0x29745f[_0x370c('0x3c')]);_0xe7ac48[_0x370c('0x52')]=_['intersection'](_0xe7ac48[_0x370c('0x3b')],_0xe7ac48[_0x370c('0x3c')]);_0x17fc7c[_0x370c('0x40')]=_[_0x370c('0x3f')](_0xe7ac48['model'],qs[_0x370c('0x41')](_0x29745f[_0x370c('0x3c')][_0x370c('0x41')]));_0x17fc7c[_0x370c('0x40')]=_0x17fc7c[_0x370c('0x40')][_0x370c('0x42')]?_0x17fc7c[_0x370c('0x40')]:_0xe7ac48[_0x370c('0x3b')];if(_0x29745f[_0x370c('0x3c')][_0x370c('0x4d')]){_0x17fc7c[_0x370c('0x4e')]=[{'all':!![]}];}_0x17fc7c=_['merge']({},_0x17fc7c,_0x29745f[_0x370c('0x4b')]);return db[_0x370c('0x38')]['find'](_0x17fc7c)['then'](handleEntityNotFound(_0x513916,null))[_0x370c('0x1d')](respondWithResult(_0x513916,null))[_0x370c('0x28')](handleError(_0x513916,null));};exports[_0x370c('0x53')]=function(_0x3561e5,_0x3c9c76){return db[_0x370c('0x38')][_0x370c('0x53')](_0x3561e5[_0x370c('0x54')],{})['then'](respondWithResult(_0x3c9c76,0xc9))[_0x370c('0x28')](handleError(_0x3c9c76,null));};exports[_0x370c('0x32')]=function(_0x26beaa,_0x47490a){if(_0x26beaa[_0x370c('0x54')]['id']){delete _0x26beaa[_0x370c('0x54')]['id'];}return db[_0x370c('0x38')][_0x370c('0x55')]({'where':{'id':_0x26beaa[_0x370c('0x56')]['id']}})[_0x370c('0x1d')](handleEntityNotFound(_0x47490a,null))['then'](saveUpdates(_0x26beaa[_0x370c('0x54')],null))[_0x370c('0x1d')](respondWithResult(_0x47490a,null))['catch'](handleError(_0x47490a,null));};exports[_0x370c('0x33')]=function(_0x1d106b,_0x1bd210){return db[_0x370c('0x38')][_0x370c('0x55')]({'where':{'id':_0x1d106b[_0x370c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bd210,null))[_0x370c('0x1d')](removeEntity(_0x1bd210,null))[_0x370c('0x28')](handleError(_0x1bd210,null));};exports['getFields']=function(_0x32ea41,_0x3c4b13,_0x47f526){var _0x37db2c={};var _0x532842={};var _0x4d60cb;var _0x28b752;return db[_0x370c('0x38')][_0x370c('0x57')]({'where':{'id':_0x32ea41[_0x370c('0x56')]['id']}})[_0x370c('0x1d')](handleEntityNotFound(_0x3c4b13,null))[_0x370c('0x1d')](function(_0x5b4307){if(_0x5b4307){_0x4d60cb=_0x5b4307;_0x532842[_0x370c('0x3b')]=_[_0x370c('0x3d')](db[_0x370c('0x58')][_0x370c('0x51')]);_0x532842['query']=_[_0x370c('0x3d')](_0x32ea41[_0x370c('0x3c')]);_0x532842[_0x370c('0x3e')]=_[_0x370c('0x3f')](_0x532842[_0x370c('0x3b')],_0x532842[_0x370c('0x3c')]);_0x37db2c[_0x370c('0x40')]=_[_0x370c('0x3f')](_0x532842[_0x370c('0x3b')],qs['fields'](_0x32ea41['query'][_0x370c('0x41')]));_0x37db2c[_0x370c('0x40')]=_0x37db2c['attributes']['length']?_0x37db2c[_0x370c('0x40')]:_0x532842[_0x370c('0x3b')];_0x37db2c['order']=qs[_0x370c('0x45')](_0x32ea41[_0x370c('0x3c')][_0x370c('0x45')]);_0x37db2c[_0x370c('0x48')]=qs['filters'](_[_0x370c('0x46')](_0x32ea41[_0x370c('0x3c')],_0x532842[_0x370c('0x3e')]));if(_0x32ea41[_0x370c('0x3c')][_0x370c('0x47')]){_0x37db2c['where']=_[_0x370c('0x49')](_0x37db2c[_0x370c('0x48')],{'$or':_['map'](_0x37db2c['attributes'],function(_0x4a4325){var _0x206e73={};_0x206e73[_0x4a4325]={'$like':'%'+_0x32ea41[_0x370c('0x3c')][_0x370c('0x47')]+'%'};return _0x206e73;})});}_0x37db2c=_[_0x370c('0x49')]({},_0x37db2c,_0x32ea41[_0x370c('0x4b')]);return _0x4d60cb[_0x370c('0x59')](_0x37db2c);}})[_0x370c('0x1d')](function(_0x5b445f){if(_0x5b445f){_0x28b752=_0x5b445f[_0x370c('0x42')];if(!_0x32ea41[_0x370c('0x3c')][_0x370c('0x43')](_0x370c('0x44'))){_0x37db2c[_0x370c('0x2d')]=qs[_0x370c('0x2d')](_0x32ea41[_0x370c('0x3c')][_0x370c('0x2d')]);_0x37db2c[_0x370c('0x2c')]=qs[_0x370c('0x2c')](_0x32ea41['query'][_0x370c('0x2c')]);}return _0x4d60cb[_0x370c('0x59')](_0x37db2c);}})[_0x370c('0x1d')](function(_0x137bb8){if(_0x137bb8){return _0x137bb8?{'count':_0x28b752,'rows':_0x137bb8}:null;}})[_0x370c('0x1d')](respondWithResult(_0x3c4b13,null))[_0x370c('0x28')](handleError(_0x3c4b13,null));};exports[_0x370c('0x5a')]=function(_0x527af8,_0x5baec9,_0x5c871e){var _0x1f9347={};var _0x7cd78={};var _0x2b3e5d;var _0x3782fd;return db[_0x370c('0x38')][_0x370c('0x57')]({'where':{'id':_0x527af8[_0x370c('0x56')]['id']}})[_0x370c('0x1d')](handleEntityNotFound(_0x5baec9,null))['then'](function(_0x38ac99){if(_0x38ac99){_0x2b3e5d=_0x38ac99;_0x7cd78[_0x370c('0x3b')]=_[_0x370c('0x3d')](db[_0x370c('0x58')][_0x370c('0x51')]);_0x7cd78[_0x370c('0x3c')]=_[_0x370c('0x3d')](_0x527af8[_0x370c('0x3c')]);_0x7cd78['filters']=_[_0x370c('0x3f')](_0x7cd78[_0x370c('0x3b')],_0x7cd78[_0x370c('0x3c')]);_0x1f9347[_0x370c('0x40')]=_['intersection'](_0x7cd78[_0x370c('0x3b')],qs['fields'](_0x527af8[_0x370c('0x3c')][_0x370c('0x41')]));_0x1f9347['attributes']=_0x1f9347[_0x370c('0x40')][_0x370c('0x42')]?_0x1f9347[_0x370c('0x40')]:_0x7cd78['model'];_0x1f9347['order']=qs[_0x370c('0x45')](_0x527af8['query']['sort']);_0x1f9347[_0x370c('0x48')]=qs[_0x370c('0x3e')](_[_0x370c('0x46')](_0x527af8[_0x370c('0x3c')],_0x7cd78[_0x370c('0x3e')]));if(_0x527af8['query'][_0x370c('0x47')]){_0x1f9347['where']=_['merge'](_0x1f9347['where'],{'$or':_[_0x370c('0x37')](_0x1f9347[_0x370c('0x40')],function(_0x194322){var _0x2b7605={};_0x2b7605[_0x194322]={'$like':'%'+_0x527af8['query'][_0x370c('0x47')]+'%'};return _0x2b7605;})});}_0x1f9347=_[_0x370c('0x49')]({},_0x1f9347,_0x527af8[_0x370c('0x4b')]);return _0x2b3e5d[_0x370c('0x5a')](_0x1f9347);}})[_0x370c('0x1d')](function(_0x135f36){if(_0x135f36){_0x3782fd=_0x135f36['length'];if(!_0x527af8[_0x370c('0x3c')][_0x370c('0x43')](_0x370c('0x44'))){_0x1f9347['limit']=qs['limit'](_0x527af8[_0x370c('0x3c')]['limit']);_0x1f9347[_0x370c('0x2c')]=qs[_0x370c('0x2c')](_0x527af8[_0x370c('0x3c')][_0x370c('0x2c')]);}return _0x2b3e5d[_0x370c('0x5a')](_0x1f9347);}})[_0x370c('0x1d')](function(_0x2481d8){if(_0x2481d8){return _0x2481d8?{'count':_0x3782fd,'rows':_0x2481d8}:null;}})[_0x370c('0x1d')](respondWithResult(_0x5baec9,null))[_0x370c('0x28')](handleError(_0x5baec9,null));};exports['getDescriptions']=function(_0x40ce6e,_0x36847d,_0x2bb838){var _0xdce1ae={};var _0x489d92={};var _0x53eb63;var _0x1b6499;return db['SugarcrmConfiguration'][_0x370c('0x57')]({'where':{'id':_0x40ce6e[_0x370c('0x56')]['id']}})[_0x370c('0x1d')](handleEntityNotFound(_0x36847d,null))['then'](function(_0x2fcbd6){if(_0x2fcbd6){_0x53eb63=_0x2fcbd6;_0x489d92['model']=_[_0x370c('0x3d')](db[_0x370c('0x58')][_0x370c('0x51')]);_0x489d92['query']=_[_0x370c('0x3d')](_0x40ce6e[_0x370c('0x3c')]);_0x489d92[_0x370c('0x3e')]=_[_0x370c('0x3f')](_0x489d92[_0x370c('0x3b')],_0x489d92['query']);_0xdce1ae[_0x370c('0x40')]=_[_0x370c('0x3f')](_0x489d92[_0x370c('0x3b')],qs[_0x370c('0x41')](_0x40ce6e[_0x370c('0x3c')]['fields']));_0xdce1ae[_0x370c('0x40')]=_0xdce1ae[_0x370c('0x40')][_0x370c('0x42')]?_0xdce1ae[_0x370c('0x40')]:_0x489d92[_0x370c('0x3b')];_0xdce1ae[_0x370c('0x5b')]=qs[_0x370c('0x45')](_0x40ce6e['query'][_0x370c('0x45')]);_0xdce1ae[_0x370c('0x48')]=qs[_0x370c('0x3e')](_[_0x370c('0x46')](_0x40ce6e[_0x370c('0x3c')],_0x489d92['filters']));if(_0x40ce6e[_0x370c('0x3c')][_0x370c('0x47')]){_0xdce1ae[_0x370c('0x48')]=_['merge'](_0xdce1ae[_0x370c('0x48')],{'$or':_['map'](_0xdce1ae[_0x370c('0x40')],function(_0x2eb612){var _0xe55d74={};_0xe55d74[_0x2eb612]={'$like':'%'+_0x40ce6e[_0x370c('0x3c')][_0x370c('0x47')]+'%'};return _0xe55d74;})});}_0xdce1ae=_[_0x370c('0x49')]({},_0xdce1ae,_0x40ce6e[_0x370c('0x4b')]);return _0x53eb63[_0x370c('0x5c')](_0xdce1ae);}})[_0x370c('0x1d')](function(_0x220f77){if(_0x220f77){_0x1b6499=_0x220f77['length'];if(!_0x40ce6e['query'][_0x370c('0x43')](_0x370c('0x44'))){_0xdce1ae[_0x370c('0x2d')]=qs['limit'](_0x40ce6e['query'][_0x370c('0x2d')]);_0xdce1ae[_0x370c('0x2c')]=qs[_0x370c('0x2c')](_0x40ce6e[_0x370c('0x3c')]['offset']);}return _0x53eb63['getDescriptions'](_0xdce1ae);}})['then'](function(_0x60cdc7){if(_0x60cdc7){return _0x60cdc7?{'count':_0x1b6499,'rows':_0x60cdc7}:null;}})[_0x370c('0x1d')](respondWithResult(_0x36847d,null))[_0x370c('0x28')](handleError(_0x36847d,null));}; \ No newline at end of file +var _0x3bef=['reject','update','destroy','sendStatus','stack','name','SugarcrmConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','options','rows','show','params','include','merge','find','create','body','getFields','findOne','SugarcrmField','sort','map','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','json','count','offset','set','Content-Range','apply'];(function(_0x3c2e1c,_0x6f1fe3){var _0x4c56e8=function(_0x1233ca){while(--_0x1233ca){_0x3c2e1c['push'](_0x3c2e1c['shift']());}};_0x4c56e8(++_0x6f1fe3);}(_0x3bef,0xd7));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf3be('0x0'));var rimraf=require(_0xf3be('0x1'));var zipdir=require(_0xf3be('0x2'));var jsonpatch=require(_0xf3be('0x3'));var rp=require(_0xf3be('0x4'));var moment=require('moment');var BPromise=require(_0xf3be('0x5'));var Mustache=require(_0xf3be('0x6'));var util=require(_0xf3be('0x7'));var path=require(_0xf3be('0x8'));var sox=require(_0xf3be('0x9'));var csv=require(_0xf3be('0xa'));var ejs=require(_0xf3be('0xb'));var fs=require('fs');var _=require(_0xf3be('0xc'));var squel=require(_0xf3be('0xd'));var crypto=require(_0xf3be('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf3be('0xf'));var toCsv=require(_0xf3be('0xa'));var querystring=require(_0xf3be('0x10'));var Papa=require(_0xf3be('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf3be('0x12'));var as=require(_0xf3be('0x13'));var hardwareService=require(_0xf3be('0x14'));var logger=require(_0xf3be('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf3be('0x16'));var licenseUtil=require(_0xf3be('0x17'));var db=require(_0xf3be('0x18'))['db'];var jayson=require(_0xf3be('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e710c,_0x4ef716,_0x4323a7,_0x46e106){return new BPromise(function(_0x16e747,_0x267a40){var _0x53a8fe=_0x46e106||client;return _0x53a8fe[_0xf3be('0x1a')](_0x2e710c,_0x4323a7)[_0xf3be('0x1b')](function(_0x42ee1d){logger[_0xf3be('0x1c')](_0xf3be('0x1d'),_0x4ef716,_0xf3be('0x1e'));logger[_0xf3be('0x1f')](_0xf3be('0x20'),_0x4ef716,_0xf3be('0x1e'),JSON['stringify'](_0x42ee1d));if(_0x42ee1d[_0xf3be('0x21')]){if(_0x42ee1d[_0xf3be('0x21')][_0xf3be('0x22')]===0x1f4){logger[_0xf3be('0x21')](_0xf3be('0x1d'),_0x4ef716,_0x42ee1d[_0xf3be('0x21')][_0xf3be('0x23')]);return _0x267a40(_0x42ee1d[_0xf3be('0x21')][_0xf3be('0x23')]);}logger[_0xf3be('0x21')](_0xf3be('0x1d'),_0x4ef716,_0x42ee1d['error'][_0xf3be('0x23')]);return _0x16e747(_0x42ee1d['error'][_0xf3be('0x23')]);}else{logger[_0xf3be('0x1c')](_0xf3be('0x1d'),_0x4ef716,_0xf3be('0x1e'));_0x16e747(_0x42ee1d[_0xf3be('0x24')][_0xf3be('0x23')]);}})[_0xf3be('0x25')](function(_0x371864){logger[_0xf3be('0x21')](_0xf3be('0x1d'),_0x4ef716,_0x371864);_0x267a40(_0x371864);});});}function respondWithStatusCode(_0x309259,_0x26014c){_0x26014c=_0x26014c||0xcc;return function(_0x29cdc9){if(_0x29cdc9){return _0x309259['sendStatus'](_0x26014c);}return _0x309259[_0xf3be('0x26')](_0x26014c)[_0xf3be('0x27')]();};}function respondWithResult(_0x74db89,_0x1a38bf){_0x1a38bf=_0x1a38bf||0xc8;return function(_0x25c83b){if(_0x25c83b){return _0x74db89[_0xf3be('0x26')](_0x1a38bf)[_0xf3be('0x28')](_0x25c83b);}};}function respondWithFilteredResult(_0x2c0f75,_0x5e8f26){return function(_0x3fd439){if(_0x3fd439){var _0x3c85a8=_0x3fd439[_0xf3be('0x29')],_0x557e6f=_0x5e8f26[_0xf3be('0x2a')],_0x3529c=_0x5e8f26[_0xf3be('0x2a')]+_0x5e8f26['limit'],_0x3f640a;if(_0x3529c>=_0x3c85a8){_0x3529c=_0x3c85a8;_0x3f640a=0xc8;}else{_0x3f640a=0xce;}_0x2c0f75[_0xf3be('0x26')](_0x3f640a);return _0x2c0f75[_0xf3be('0x2b')](_0xf3be('0x2c'),_0x557e6f+'-'+_0x3529c+'/'+_0x3c85a8)['json'](_0x3fd439);}return null;};}function patchUpdates(_0x15e3e1){return function(_0x3c15ff){try{jsonpatch[_0xf3be('0x2d')](_0x3c15ff,_0x15e3e1,!![]);}catch(_0x22df3e){return BPromise[_0xf3be('0x2e')](_0x22df3e);}return _0x3c15ff['save']();};}function saveUpdates(_0x507cad,_0x8914ca){return function(_0x46dc97){if(_0x46dc97){return _0x46dc97[_0xf3be('0x2f')](_0x507cad)[_0xf3be('0x1b')](function(_0x1a58af){return _0x1a58af;});}return null;};}function removeEntity(_0x3c5059,_0x37f62a){return function(_0x3fd95f){if(_0x3fd95f){return _0x3fd95f[_0xf3be('0x30')]()[_0xf3be('0x1b')](function(){_0x3c5059[_0xf3be('0x26')](0xcc)[_0xf3be('0x27')]();});}};}function handleEntityNotFound(_0x1d9fa7,_0x21a43a){return function(_0x294f20){if(!_0x294f20){_0x1d9fa7[_0xf3be('0x31')](0x194);}return _0x294f20;};}function handleError(_0x1dfdab,_0x590dcb){_0x590dcb=_0x590dcb||0x1f4;return function(_0x57324d){logger[_0xf3be('0x21')](_0x57324d[_0xf3be('0x32')]);if(_0x57324d[_0xf3be('0x33')]){delete _0x57324d['name'];}_0x1dfdab[_0xf3be('0x26')](_0x590dcb)['send'](_0x57324d);};}exports['index']=function(_0x4f8556,_0x80b822){var _0x30c343={},_0x50a6b3={},_0x9f0651={'count':0x0,'rows':[]};var _0x3a3139=_['map'](db[_0xf3be('0x34')][_0xf3be('0x35')],function(_0x2914a7){return{'name':_0x2914a7['fieldName'],'type':_0x2914a7[_0xf3be('0x36')][_0xf3be('0x37')]};});_0x50a6b3[_0xf3be('0x38')]=_['map'](_0x3a3139,_0xf3be('0x33'));_0x50a6b3['query']=_[_0xf3be('0x39')](_0x4f8556[_0xf3be('0x3a')]);_0x50a6b3[_0xf3be('0x3b')]=_[_0xf3be('0x3c')](_0x50a6b3[_0xf3be('0x38')],_0x50a6b3[_0xf3be('0x3a')]);_0x30c343[_0xf3be('0x3d')]=_[_0xf3be('0x3c')](_0x50a6b3[_0xf3be('0x38')],qs[_0xf3be('0x3e')](_0x4f8556['query']['fields']));_0x30c343[_0xf3be('0x3d')]=_0x30c343[_0xf3be('0x3d')][_0xf3be('0x3f')]?_0x30c343[_0xf3be('0x3d')]:_0x50a6b3['model'];if(!_0x4f8556[_0xf3be('0x3a')][_0xf3be('0x40')](_0xf3be('0x41'))){_0x30c343[_0xf3be('0x42')]=qs['limit'](_0x4f8556[_0xf3be('0x3a')][_0xf3be('0x42')]);_0x30c343[_0xf3be('0x2a')]=qs[_0xf3be('0x2a')](_0x4f8556[_0xf3be('0x3a')][_0xf3be('0x2a')]);}_0x30c343[_0xf3be('0x43')]=qs['sort'](_0x4f8556['query']['sort']);_0x30c343[_0xf3be('0x44')]=qs[_0xf3be('0x3b')](_[_0xf3be('0x45')](_0x4f8556[_0xf3be('0x3a')],_0x50a6b3[_0xf3be('0x3b')]),_0x3a3139);if(_0x4f8556['query']['filter']){_0x30c343[_0xf3be('0x44')]=_['merge'](_0x30c343['where'],{'$or':_['map'](_0x3a3139,function(_0x26b1ba){if(_0x26b1ba[_0xf3be('0x36')]!=='VIRTUAL'){var _0x484c85={};_0x484c85[_0x26b1ba[_0xf3be('0x33')]]={'$like':'%'+_0x4f8556['query'][_0xf3be('0x46')]+'%'};return _0x484c85;}})});}_0x30c343=_['merge']({},_0x30c343,_0x4f8556[_0xf3be('0x47')]);var _0x3e579e={'where':_0x30c343['where']};return db['SugarcrmConfiguration'][_0xf3be('0x29')](_0x3e579e)[_0xf3be('0x1b')](function(_0xc1c245){_0x9f0651['count']=_0xc1c245;if(_0x4f8556[_0xf3be('0x3a')]['includeAll']){_0x30c343['include']=[{'all':!![]}];}return db[_0xf3be('0x34')]['findAll'](_0x30c343);})[_0xf3be('0x1b')](function(_0x3907e2){_0x9f0651[_0xf3be('0x48')]=_0x3907e2;return _0x9f0651;})[_0xf3be('0x1b')](respondWithFilteredResult(_0x80b822,_0x30c343))['catch'](handleError(_0x80b822,null));};exports[_0xf3be('0x49')]=function(_0x48f916,_0x4e8486){var _0x5f57ef={'raw':![],'where':{'id':_0x48f916[_0xf3be('0x4a')]['id']}},_0xd32448={};_0xd32448[_0xf3be('0x38')]=_[_0xf3be('0x39')](db[_0xf3be('0x34')][_0xf3be('0x35')]);_0xd32448['query']=_['keys'](_0x48f916[_0xf3be('0x3a')]);_0xd32448['filtears']=_[_0xf3be('0x3c')](_0xd32448['model'],_0xd32448[_0xf3be('0x3a')]);_0x5f57ef[_0xf3be('0x3d')]=_['intersection'](_0xd32448['model'],qs[_0xf3be('0x3e')](_0x48f916[_0xf3be('0x3a')][_0xf3be('0x3e')]));_0x5f57ef[_0xf3be('0x3d')]=_0x5f57ef[_0xf3be('0x3d')]['length']?_0x5f57ef[_0xf3be('0x3d')]:_0xd32448[_0xf3be('0x38')];if(_0x48f916[_0xf3be('0x3a')]['includeAll']){_0x5f57ef[_0xf3be('0x4b')]=[{'all':!![]}];}_0x5f57ef=_[_0xf3be('0x4c')]({},_0x5f57ef,_0x48f916[_0xf3be('0x47')]);return db[_0xf3be('0x34')][_0xf3be('0x4d')](_0x5f57ef)[_0xf3be('0x1b')](handleEntityNotFound(_0x4e8486,null))[_0xf3be('0x1b')](respondWithResult(_0x4e8486,null))[_0xf3be('0x25')](handleError(_0x4e8486,null));};exports[_0xf3be('0x4e')]=function(_0x3c124d,_0x268a7c){return db[_0xf3be('0x34')][_0xf3be('0x4e')](_0x3c124d[_0xf3be('0x4f')],{})[_0xf3be('0x1b')](respondWithResult(_0x268a7c,0xc9))['catch'](handleError(_0x268a7c,null));};exports[_0xf3be('0x2f')]=function(_0x1b4d91,_0x1883c6){if(_0x1b4d91[_0xf3be('0x4f')]['id']){delete _0x1b4d91[_0xf3be('0x4f')]['id'];}return db[_0xf3be('0x34')][_0xf3be('0x4d')]({'where':{'id':_0x1b4d91['params']['id']}})[_0xf3be('0x1b')](handleEntityNotFound(_0x1883c6,null))['then'](saveUpdates(_0x1b4d91['body'],null))['then'](respondWithResult(_0x1883c6,null))['catch'](handleError(_0x1883c6,null));};exports[_0xf3be('0x30')]=function(_0x185854,_0x4516ce){return db[_0xf3be('0x34')]['find']({'where':{'id':_0x185854[_0xf3be('0x4a')]['id']}})[_0xf3be('0x1b')](handleEntityNotFound(_0x4516ce,null))[_0xf3be('0x1b')](removeEntity(_0x4516ce,null))[_0xf3be('0x25')](handleError(_0x4516ce,null));};exports[_0xf3be('0x50')]=function(_0x19a0a1,_0x388c8e,_0x12217f){var _0xf33207={};var _0x3987c0={};var _0x106d49;var _0x967394;return db['SugarcrmConfiguration'][_0xf3be('0x51')]({'where':{'id':_0x19a0a1['params']['id']}})[_0xf3be('0x1b')](handleEntityNotFound(_0x388c8e,null))['then'](function(_0x2a9f8a){if(_0x2a9f8a){_0x106d49=_0x2a9f8a;_0x3987c0[_0xf3be('0x38')]=_['keys'](db[_0xf3be('0x52')]['rawAttributes']);_0x3987c0[_0xf3be('0x3a')]=_['keys'](_0x19a0a1[_0xf3be('0x3a')]);_0x3987c0['filters']=_[_0xf3be('0x3c')](_0x3987c0['model'],_0x3987c0[_0xf3be('0x3a')]);_0xf33207[_0xf3be('0x3d')]=_['intersection'](_0x3987c0[_0xf3be('0x38')],qs[_0xf3be('0x3e')](_0x19a0a1[_0xf3be('0x3a')][_0xf3be('0x3e')]));_0xf33207[_0xf3be('0x3d')]=_0xf33207[_0xf3be('0x3d')][_0xf3be('0x3f')]?_0xf33207[_0xf3be('0x3d')]:_0x3987c0[_0xf3be('0x38')];_0xf33207['order']=qs[_0xf3be('0x53')](_0x19a0a1[_0xf3be('0x3a')]['sort']);_0xf33207['where']=qs['filters'](_['pick'](_0x19a0a1['query'],_0x3987c0[_0xf3be('0x3b')]));if(_0x19a0a1['query'][_0xf3be('0x46')]){_0xf33207['where']=_[_0xf3be('0x4c')](_0xf33207[_0xf3be('0x44')],{'$or':_[_0xf3be('0x54')](_0xf33207[_0xf3be('0x3d')],function(_0x1dcfc5){var _0x558ea7={};_0x558ea7[_0x1dcfc5]={'$like':'%'+_0x19a0a1[_0xf3be('0x3a')][_0xf3be('0x46')]+'%'};return _0x558ea7;})});}_0xf33207=_[_0xf3be('0x4c')]({},_0xf33207,_0x19a0a1[_0xf3be('0x47')]);return _0x106d49['getFields'](_0xf33207);}})[_0xf3be('0x1b')](function(_0x3ba45f){if(_0x3ba45f){_0x967394=_0x3ba45f[_0xf3be('0x3f')];if(!_0x19a0a1[_0xf3be('0x3a')]['hasOwnProperty'](_0xf3be('0x41'))){_0xf33207[_0xf3be('0x42')]=qs[_0xf3be('0x42')](_0x19a0a1[_0xf3be('0x3a')][_0xf3be('0x42')]);_0xf33207[_0xf3be('0x2a')]=qs[_0xf3be('0x2a')](_0x19a0a1[_0xf3be('0x3a')]['offset']);}return _0x106d49[_0xf3be('0x50')](_0xf33207);}})[_0xf3be('0x1b')](function(_0x54388c){if(_0x54388c){return _0x54388c?{'count':_0x967394,'rows':_0x54388c}:null;}})[_0xf3be('0x1b')](respondWithResult(_0x388c8e,null))[_0xf3be('0x25')](handleError(_0x388c8e,null));};exports[_0xf3be('0x55')]=function(_0x1f52f6,_0x19ff51,_0x310b4d){var _0x1a0956={};var _0x19aecc={};var _0x429777;var _0x59bd4b;return db[_0xf3be('0x34')][_0xf3be('0x51')]({'where':{'id':_0x1f52f6[_0xf3be('0x4a')]['id']}})[_0xf3be('0x1b')](handleEntityNotFound(_0x19ff51,null))[_0xf3be('0x1b')](function(_0x321d98){if(_0x321d98){_0x429777=_0x321d98;_0x19aecc[_0xf3be('0x38')]=_[_0xf3be('0x39')](db[_0xf3be('0x52')][_0xf3be('0x35')]);_0x19aecc[_0xf3be('0x3a')]=_[_0xf3be('0x39')](_0x1f52f6[_0xf3be('0x3a')]);_0x19aecc[_0xf3be('0x3b')]=_['intersection'](_0x19aecc[_0xf3be('0x38')],_0x19aecc['query']);_0x1a0956[_0xf3be('0x3d')]=_[_0xf3be('0x3c')](_0x19aecc[_0xf3be('0x38')],qs[_0xf3be('0x3e')](_0x1f52f6[_0xf3be('0x3a')][_0xf3be('0x3e')]));_0x1a0956[_0xf3be('0x3d')]=_0x1a0956[_0xf3be('0x3d')][_0xf3be('0x3f')]?_0x1a0956['attributes']:_0x19aecc['model'];_0x1a0956['order']=qs[_0xf3be('0x53')](_0x1f52f6[_0xf3be('0x3a')][_0xf3be('0x53')]);_0x1a0956[_0xf3be('0x44')]=qs['filters'](_['pick'](_0x1f52f6['query'],_0x19aecc['filters']));if(_0x1f52f6['query'][_0xf3be('0x46')]){_0x1a0956[_0xf3be('0x44')]=_[_0xf3be('0x4c')](_0x1a0956[_0xf3be('0x44')],{'$or':_[_0xf3be('0x54')](_0x1a0956[_0xf3be('0x3d')],function(_0x38d63f){var _0xa14675={};_0xa14675[_0x38d63f]={'$like':'%'+_0x1f52f6[_0xf3be('0x3a')][_0xf3be('0x46')]+'%'};return _0xa14675;})});}_0x1a0956=_[_0xf3be('0x4c')]({},_0x1a0956,_0x1f52f6['options']);return _0x429777[_0xf3be('0x55')](_0x1a0956);}})[_0xf3be('0x1b')](function(_0x121db1){if(_0x121db1){_0x59bd4b=_0x121db1[_0xf3be('0x3f')];if(!_0x1f52f6[_0xf3be('0x3a')][_0xf3be('0x40')]('nolimit')){_0x1a0956[_0xf3be('0x42')]=qs['limit'](_0x1f52f6[_0xf3be('0x3a')][_0xf3be('0x42')]);_0x1a0956[_0xf3be('0x2a')]=qs['offset'](_0x1f52f6['query'][_0xf3be('0x2a')]);}return _0x429777[_0xf3be('0x55')](_0x1a0956);}})[_0xf3be('0x1b')](function(_0x4ea619){if(_0x4ea619){return _0x4ea619?{'count':_0x59bd4b,'rows':_0x4ea619}:null;}})[_0xf3be('0x1b')](respondWithResult(_0x19ff51,null))['catch'](handleError(_0x19ff51,null));};exports['getDescriptions']=function(_0x5e8aa2,_0x29854e,_0x12915e){var _0x5af5e3={};var _0x272750={};var _0xb47a98;var _0x552cb7;return db['SugarcrmConfiguration'][_0xf3be('0x51')]({'where':{'id':_0x5e8aa2[_0xf3be('0x4a')]['id']}})[_0xf3be('0x1b')](handleEntityNotFound(_0x29854e,null))[_0xf3be('0x1b')](function(_0x25d4fb){if(_0x25d4fb){_0xb47a98=_0x25d4fb;_0x272750[_0xf3be('0x38')]=_[_0xf3be('0x39')](db[_0xf3be('0x52')][_0xf3be('0x35')]);_0x272750[_0xf3be('0x3a')]=_['keys'](_0x5e8aa2['query']);_0x272750[_0xf3be('0x3b')]=_['intersection'](_0x272750[_0xf3be('0x38')],_0x272750[_0xf3be('0x3a')]);_0x5af5e3['attributes']=_['intersection'](_0x272750['model'],qs['fields'](_0x5e8aa2['query'][_0xf3be('0x3e')]));_0x5af5e3[_0xf3be('0x3d')]=_0x5af5e3[_0xf3be('0x3d')][_0xf3be('0x3f')]?_0x5af5e3[_0xf3be('0x3d')]:_0x272750[_0xf3be('0x38')];_0x5af5e3['order']=qs[_0xf3be('0x53')](_0x5e8aa2[_0xf3be('0x3a')][_0xf3be('0x53')]);_0x5af5e3['where']=qs['filters'](_[_0xf3be('0x45')](_0x5e8aa2[_0xf3be('0x3a')],_0x272750[_0xf3be('0x3b')]));if(_0x5e8aa2[_0xf3be('0x3a')][_0xf3be('0x46')]){_0x5af5e3[_0xf3be('0x44')]=_['merge'](_0x5af5e3[_0xf3be('0x44')],{'$or':_[_0xf3be('0x54')](_0x5af5e3[_0xf3be('0x3d')],function(_0x287940){var _0x513587={};_0x513587[_0x287940]={'$like':'%'+_0x5e8aa2[_0xf3be('0x3a')]['filter']+'%'};return _0x513587;})});}_0x5af5e3=_[_0xf3be('0x4c')]({},_0x5af5e3,_0x5e8aa2[_0xf3be('0x47')]);return _0xb47a98[_0xf3be('0x56')](_0x5af5e3);}})['then'](function(_0x231a14){if(_0x231a14){_0x552cb7=_0x231a14[_0xf3be('0x3f')];if(!_0x5e8aa2[_0xf3be('0x3a')][_0xf3be('0x40')]('nolimit')){_0x5af5e3[_0xf3be('0x42')]=qs[_0xf3be('0x42')](_0x5e8aa2[_0xf3be('0x3a')][_0xf3be('0x42')]);_0x5af5e3['offset']=qs[_0xf3be('0x2a')](_0x5e8aa2[_0xf3be('0x3a')]['offset']);}return _0xb47a98['getDescriptions'](_0x5af5e3);}})[_0xf3be('0x1b')](function(_0xbbf6ff){if(_0xbbf6ff){return _0xbbf6ff?{'count':_0x552cb7,'rows':_0xbbf6ff}:null;}})[_0xf3be('0x1b')](respondWithResult(_0x29854e,null))[_0xf3be('0x25')](handleError(_0x29854e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index bc4eb26..95cae6c 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 _0xaab0=['exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes'];(function(_0x3490e6,_0x250b3e){var _0x2c0226=function(_0x1bc004){while(--_0x1bc004){_0x3490e6['push'](_0x3490e6['shift']());}};_0x2c0226(++_0x250b3e);}(_0xaab0,0x122));var _0x0aab=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xaab0[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x0aab('0x0'));var util=require(_0x0aab('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0aab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aab('0x3'));var rimraf=require(_0x0aab('0x4'));var config=require(_0x0aab('0x5'));var attributes=require(_0x0aab('0x6'));module[_0x0aab('0x7')]=function(_0x28d0ec,_0x564c4f){return _0x28d0ec[_0x0aab('0x8')](_0x0aab('0x9'),attributes,{'tableName':_0x0aab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd83=['path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1c5f70,_0x55a294){var _0x5addf6=function(_0x3270fb){while(--_0x3270fb){_0x1c5f70['push'](_0x1c5f70['shift']());}};_0x5addf6(++_0x55a294);}(_0xfd83,0x1e7));var _0x3fd8=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0xfd83[_0x58ac34];return _0x3921ab;};'use strict';var _=require(_0x3fd8('0x0'));var util=require(_0x3fd8('0x1'));var logger=require(_0x3fd8('0x2'))(_0x3fd8('0x3'));var moment=require(_0x3fd8('0x4'));var BPromise=require(_0x3fd8('0x5'));var rp=require(_0x3fd8('0x6'));var fs=require('fs');var path=require(_0x3fd8('0x7'));var rimraf=require(_0x3fd8('0x8'));var config=require('../../config/environment');var attributes=require(_0x3fd8('0x9'));module[_0x3fd8('0xa')]=function(_0x4c8f91,_0x50ab13){return _0x4c8f91['define'](_0x3fd8('0xb'),attributes,{'tableName':_0x3fd8('0xc'),'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 bff48ff..d342515 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 _0x1879=['SugarcrmConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x24b409,_0x571e97){var _0x14f371=function(_0x4a1551){while(--_0x4a1551){_0x24b409['push'](_0x24b409['shift']());}};_0x14f371(++_0x571e97);}(_0x1879,0xf5));var _0x9187=function(_0x5f25b3,_0x35481a){_0x5f25b3=_0x5f25b3-0x0;var _0x4ab9bf=_0x1879[_0x5f25b3];return _0x4ab9bf;};'use strict';var _=require(_0x9187('0x0'));var util=require(_0x9187('0x1'));var moment=require(_0x9187('0x2'));var BPromise=require(_0x9187('0x3'));var rs=require(_0x9187('0x4'));var fs=require('fs');var Redis=require(_0x9187('0x5'));var db=require(_0x9187('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9187('0x7'));var config=require(_0x9187('0x8'));var jayson=require(_0x9187('0x9'));var client=jayson[_0x9187('0xa')][_0x9187('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d2f1f,_0x5a74f8,_0x548dac){return new BPromise(function(_0x4659e2,_0x2fc249){return client[_0x9187('0xc')](_0x5d2f1f,_0x548dac)[_0x9187('0xd')](function(_0x1fcc31){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a74f8,_0x9187('0xe'));logger[_0x9187('0xf')](_0x9187('0x10'),_0x5a74f8,_0x9187('0xe'),JSON['stringify'](_0x1fcc31));if(_0x1fcc31['error']){if(_0x1fcc31[_0x9187('0x11')][_0x9187('0x12')]===0x1f4){logger[_0x9187('0x11')](_0x9187('0x13'),_0x5a74f8,_0x1fcc31[_0x9187('0x11')]['message']);return _0x2fc249(_0x1fcc31[_0x9187('0x11')][_0x9187('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a74f8,_0x1fcc31[_0x9187('0x11')][_0x9187('0x14')]);return _0x4659e2(_0x1fcc31['error'][_0x9187('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a74f8,_0x9187('0xe'));_0x4659e2(_0x1fcc31['result'][_0x9187('0x14')]);}})[_0x9187('0x15')](function(_0x16d907){logger['error'](_0x9187('0x13'),_0x5a74f8,_0x16d907);_0x2fc249(_0x16d907);});});} \ No newline at end of file +var _0x0d1e=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bbf9b,_0x1b9961){var _0x7c66e=function(_0x18e6c2){while(--_0x18e6c2){_0x3bbf9b['push'](_0x3bbf9b['shift']());}};_0x7c66e(++_0x1b9961);}(_0x0d1e,0x1de));var _0xe0d1=function(_0x3a0661,_0x429adc){_0x3a0661=_0x3a0661-0x0;var _0x1ea7e4=_0x0d1e[_0x3a0661];return _0x1ea7e4;};'use strict';var _=require('lodash');var util=require(_0xe0d1('0x0'));var moment=require(_0xe0d1('0x1'));var BPromise=require(_0xe0d1('0x2'));var rs=require(_0xe0d1('0x3'));var fs=require('fs');var Redis=require(_0xe0d1('0x4'));var db=require(_0xe0d1('0x5'))['db'];var utils=require(_0xe0d1('0x6'));var logger=require(_0xe0d1('0x7'))(_0xe0d1('0x8'));var config=require(_0xe0d1('0x9'));var jayson=require(_0xe0d1('0xa'));var client=jayson[_0xe0d1('0xb')][_0xe0d1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40b559,_0x5f473e,_0x2ed4e7){return new BPromise(function(_0x446584,_0x35ee23){return client[_0xe0d1('0xd')](_0x40b559,_0x2ed4e7)[_0xe0d1('0xe')](function(_0x14f1a9){logger[_0xe0d1('0xf')](_0xe0d1('0x10'),_0x5f473e,_0xe0d1('0x11'));logger[_0xe0d1('0x12')](_0xe0d1('0x13'),_0x5f473e,_0xe0d1('0x11'),JSON[_0xe0d1('0x14')](_0x14f1a9));if(_0x14f1a9['error']){if(_0x14f1a9[_0xe0d1('0x15')][_0xe0d1('0x16')]===0x1f4){logger[_0xe0d1('0x15')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5f473e,_0x14f1a9[_0xe0d1('0x15')][_0xe0d1('0x17')]);return _0x35ee23(_0x14f1a9[_0xe0d1('0x15')][_0xe0d1('0x17')]);}logger[_0xe0d1('0x15')](_0xe0d1('0x10'),_0x5f473e,_0x14f1a9['error'][_0xe0d1('0x17')]);return _0x446584(_0x14f1a9[_0xe0d1('0x15')][_0xe0d1('0x17')]);}else{logger['info'](_0xe0d1('0x10'),_0x5f473e,'request\x20sent');_0x446584(_0x14f1a9[_0xe0d1('0x18')][_0xe0d1('0x17')]);}})['catch'](function(_0x210d84){logger[_0xe0d1('0x15')](_0xe0d1('0x10'),_0x5f473e,_0x210d84);_0x35ee23(_0x210d84);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3c8edb6..217d894 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 _0x32af=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer'];(function(_0x297e92,_0x45d01d){var _0xbe3a5e=function(_0x320fad){while(--_0x320fad){_0x297e92['push'](_0x297e92['shift']());}};_0xbe3a5e(++_0x45d01d);}(_0x32af,0x1f3));var _0xf32a=function(_0x265576,_0x2c2242){_0x265576=_0x265576-0x0;var _0x3b2e45=_0x32af[_0x265576];return _0x3b2e45;};'use strict';var multer=require(_0xf32a('0x0'));var util=require(_0xf32a('0x1'));var path=require(_0xf32a('0x2'));var timeout=require(_0xf32a('0x3'));var express=require(_0xf32a('0x4'));var router=express[_0xf32a('0x5')]();var auth=require(_0xf32a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf32a('0x7'));var controller=require(_0xf32a('0x8'));router['get']('/',auth[_0xf32a('0x9')](),controller[_0xf32a('0xa')]);router[_0xf32a('0xb')](_0xf32a('0xc'),auth[_0xf32a('0x9')](),controller[_0xf32a('0xd')]);router[_0xf32a('0xe')]('/',auth[_0xf32a('0x9')](),controller[_0xf32a('0xf')]);router[_0xf32a('0x10')](_0xf32a('0xc'),auth[_0xf32a('0x9')](),controller[_0xf32a('0x11')]);router['delete'](_0xf32a('0xc'),auth[_0xf32a('0x9')](),controller[_0xf32a('0x12')]);module[_0xf32a('0x13')]=router; \ No newline at end of file +var _0xd9aa=['create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','post'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd9aa,0x93));var _0xad9a=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xd9aa[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xad9a('0x0'));var util=require(_0xad9a('0x1'));var path=require(_0xad9a('0x2'));var timeout=require(_0xad9a('0x3'));var express=require(_0xad9a('0x4'));var router=express[_0xad9a('0x5')]();var auth=require(_0xad9a('0x6'));var interaction=require(_0xad9a('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xad9a('0x8')]('/',auth['isAuthenticated'](),controller[_0xad9a('0x9')]);router[_0xad9a('0x8')](_0xad9a('0xa'),auth['isAuthenticated'](),controller[_0xad9a('0xb')]);router[_0xad9a('0xc')]('/',auth['isAuthenticated'](),controller[_0xad9a('0xd')]);router[_0xad9a('0xe')](_0xad9a('0xa'),auth[_0xad9a('0xf')](),controller[_0xad9a('0x10')]);router[_0xad9a('0x11')](_0xad9a('0xa'),auth[_0xad9a('0xf')](),controller[_0xad9a('0x12')]);module[_0xad9a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 2c09713..b0375fb 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 _0x6dfa=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6dfa,0x7b));var _0xa6df=function(_0x2083c4,_0x379560){_0x2083c4=_0x2083c4-0x0;var _0x49c74d=_0x6dfa[_0x2083c4];return _0x49c74d;};'use strict';var Sequelize=require(_0xa6df('0x0'));module[_0xa6df('0x1')]={'type':{'type':Sequelize[_0xa6df('0x2')](_0xa6df('0x3'),_0xa6df('0x4'),'customVariable',_0xa6df('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa6df('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa6df('0x3'),_0xa6df('0x4'),_0xa6df('0x7'))},'keyContent':{'type':Sequelize[_0xa6df('0x6')]},'idField':{'type':Sequelize[_0xa6df('0x6')]},'nameField':{'type':Sequelize[_0xa6df('0x6')]},'customField':{'type':Sequelize[_0xa6df('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa6df('0x6')]}}; \ No newline at end of file +var _0x6a93=['string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING'];(function(_0x298357,_0x249f81){var _0x5008b8=function(_0x3acc22){while(--_0x3acc22){_0x298357['push'](_0x298357['shift']());}};_0x5008b8(++_0x249f81);}(_0x6a93,0x1d7));var _0x36a9=function(_0x50cea3,_0x1ca014){_0x50cea3=_0x50cea3-0x0;var _0x59fd9f=_0x6a93[_0x50cea3];return _0x59fd9f;};'use strict';var Sequelize=require(_0x36a9('0x0'));module[_0x36a9('0x1')]={'type':{'type':Sequelize[_0x36a9('0x2')]('string','variable',_0x36a9('0x3'),_0x36a9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x36a9('0x5')]},'key':{'type':Sequelize[_0x36a9('0x5')]},'keyType':{'type':Sequelize[_0x36a9('0x2')](_0x36a9('0x6'),_0x36a9('0x7'),_0x36a9('0x3'))},'keyContent':{'type':Sequelize[_0x36a9('0x5')]},'idField':{'type':Sequelize[_0x36a9('0x5')]},'nameField':{'type':Sequelize[_0x36a9('0x5')]},'customField':{'type':Sequelize[_0x36a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36a9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 1e7b757..6b98222 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 _0x5513=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmField','count','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index'];(function(_0x2edf3d,_0x1070f9){var _0x5a27bc=function(_0x30fdac){while(--_0x30fdac){_0x2edf3d['push'](_0x2edf3d['shift']());}};_0x5a27bc(++_0x1070f9);}(_0x5513,0x101));var _0x3551=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x5513[_0x1cd674];return _0x27928f;};'use strict';var pdf=require(_0x3551('0x0'));var emlformat=require(_0x3551('0x1'));var rimraf=require(_0x3551('0x2'));var zipdir=require(_0x3551('0x3'));var jsonpatch=require(_0x3551('0x4'));var rp=require('request-promise');var moment=require(_0x3551('0x5'));var BPromise=require(_0x3551('0x6'));var Mustache=require(_0x3551('0x7'));var util=require(_0x3551('0x8'));var path=require(_0x3551('0x9'));var sox=require(_0x3551('0xa'));var csv=require('to-csv');var ejs=require(_0x3551('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3551('0xc'));var crypto=require(_0x3551('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3551('0xe'));var toCsv=require(_0x3551('0xf'));var querystring=require('querystring');var Papa=require(_0x3551('0x10'));var Redis=require('ioredis');var authService=require(_0x3551('0x11'));var qs=require(_0x3551('0x12'));var as=require(_0x3551('0x13'));var hardwareService=require(_0x3551('0x14'));var logger=require('../../config/logger')(_0x3551('0x15'));var utils=require(_0x3551('0x16'));var config=require(_0x3551('0x17'));var licenseUtil=require(_0x3551('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x196dde,_0x4a29d6){_0x4a29d6=_0x4a29d6||0xcc;return function(_0x3d57fb){if(_0x3d57fb){return _0x196dde[_0x3551('0x19')](_0x4a29d6);}return _0x196dde[_0x3551('0x1a')](_0x4a29d6)['end']();};}function respondWithResult(_0x35a213,_0x5048f2){_0x5048f2=_0x5048f2||0xc8;return function(_0x24bbb2){if(_0x24bbb2){return _0x35a213[_0x3551('0x1a')](_0x5048f2)[_0x3551('0x1b')](_0x24bbb2);}};}function respondWithFilteredResult(_0x57dcda,_0x59ec0c){return function(_0x1b38dc){if(_0x1b38dc){var _0x5ddf7b=_0x1b38dc['count'],_0x164135=_0x59ec0c['offset'],_0x41e5a5=_0x59ec0c[_0x3551('0x1c')]+_0x59ec0c[_0x3551('0x1d')],_0x229a0b;if(_0x41e5a5>=_0x5ddf7b){_0x41e5a5=_0x5ddf7b;_0x229a0b=0xc8;}else{_0x229a0b=0xce;}_0x57dcda[_0x3551('0x1a')](_0x229a0b);return _0x57dcda[_0x3551('0x1e')](_0x3551('0x1f'),_0x164135+'-'+_0x41e5a5+'/'+_0x5ddf7b)['json'](_0x1b38dc);}return null;};}function patchUpdates(_0xc43aa1){return function(_0x593926){try{jsonpatch[_0x3551('0x20')](_0x593926,_0xc43aa1,!![]);}catch(_0x3d19f9){return BPromise['reject'](_0x3d19f9);}return _0x593926[_0x3551('0x21')]();};}function saveUpdates(_0x575ba4,_0x5db615){return function(_0x15e452){if(_0x15e452){return _0x15e452[_0x3551('0x22')](_0x575ba4)[_0x3551('0x23')](function(_0x59a02e){return _0x59a02e;});}return null;};}function removeEntity(_0x256722,_0x5d3668){return function(_0x3baf6e){if(_0x3baf6e){return _0x3baf6e[_0x3551('0x24')]()['then'](function(){_0x256722[_0x3551('0x1a')](0xcc)[_0x3551('0x25')]();});}};}function handleEntityNotFound(_0x103467,_0xf5f5fd){return function(_0x61faf0){if(!_0x61faf0){_0x103467[_0x3551('0x19')](0x194);}return _0x61faf0;};}function handleError(_0x1118de,_0x5e1eee){_0x5e1eee=_0x5e1eee||0x1f4;return function(_0x268f0a){logger[_0x3551('0x26')](_0x268f0a[_0x3551('0x27')]);if(_0x268f0a['name']){delete _0x268f0a[_0x3551('0x28')];}_0x1118de[_0x3551('0x1a')](_0x5e1eee)[_0x3551('0x29')](_0x268f0a);};}exports[_0x3551('0x2a')]=function(_0x28e754,_0x95f403){var _0x35a21d={},_0x1bbea5={},_0x41b38b={'count':0x0,'rows':[]};var _0x5a1e79=_['map'](db['SugarcrmField'][_0x3551('0x2b')],function(_0x56453b){return{'name':_0x56453b[_0x3551('0x2c')],'type':_0x56453b[_0x3551('0x2d')][_0x3551('0x2e')]};});_0x1bbea5[_0x3551('0x2f')]=_[_0x3551('0x30')](_0x5a1e79,_0x3551('0x28'));_0x1bbea5['query']=_[_0x3551('0x31')](_0x28e754[_0x3551('0x32')]);_0x1bbea5[_0x3551('0x33')]=_['intersection'](_0x1bbea5[_0x3551('0x2f')],_0x1bbea5[_0x3551('0x32')]);_0x35a21d['attributes']=_[_0x3551('0x34')](_0x1bbea5['model'],qs[_0x3551('0x35')](_0x28e754[_0x3551('0x32')][_0x3551('0x35')]));_0x35a21d['attributes']=_0x35a21d[_0x3551('0x36')][_0x3551('0x37')]?_0x35a21d[_0x3551('0x36')]:_0x1bbea5[_0x3551('0x2f')];if(!_0x28e754[_0x3551('0x32')]['hasOwnProperty'](_0x3551('0x38'))){_0x35a21d[_0x3551('0x1d')]=qs[_0x3551('0x1d')](_0x28e754[_0x3551('0x32')][_0x3551('0x1d')]);_0x35a21d[_0x3551('0x1c')]=qs[_0x3551('0x1c')](_0x28e754['query'][_0x3551('0x1c')]);}_0x35a21d[_0x3551('0x39')]=qs[_0x3551('0x3a')](_0x28e754[_0x3551('0x32')]['sort']);_0x35a21d[_0x3551('0x3b')]=qs['filters'](_[_0x3551('0x3c')](_0x28e754['query'],_0x1bbea5[_0x3551('0x33')]),_0x5a1e79);if(_0x28e754[_0x3551('0x32')][_0x3551('0x3d')]){_0x35a21d['where']=_[_0x3551('0x3e')](_0x35a21d['where'],{'$or':_[_0x3551('0x30')](_0x5a1e79,function(_0x3b57e2){if(_0x3b57e2[_0x3551('0x2d')]!==_0x3551('0x3f')){var _0x49f1d9={};_0x49f1d9[_0x3b57e2['name']]={'$like':'%'+_0x28e754[_0x3551('0x32')][_0x3551('0x3d')]+'%'};return _0x49f1d9;}})});}_0x35a21d=_['merge']({},_0x35a21d,_0x28e754['options']);var _0x6cddf2={'where':_0x35a21d[_0x3551('0x3b')]};return db[_0x3551('0x40')][_0x3551('0x41')](_0x6cddf2)[_0x3551('0x23')](function(_0xab0108){_0x41b38b[_0x3551('0x41')]=_0xab0108;if(_0x28e754[_0x3551('0x32')][_0x3551('0x42')]){_0x35a21d[_0x3551('0x43')]=[{'all':!![]}];}return db['SugarcrmField'][_0x3551('0x44')](_0x35a21d);})[_0x3551('0x23')](function(_0x23749c){_0x41b38b['rows']=_0x23749c;return _0x41b38b;})[_0x3551('0x23')](respondWithFilteredResult(_0x95f403,_0x35a21d))[_0x3551('0x45')](handleError(_0x95f403,null));};exports[_0x3551('0x46')]=function(_0x243ea5,_0x4331ab){var _0x1adfe0={'raw':!![],'where':{'id':_0x243ea5[_0x3551('0x47')]['id']}},_0x9aaed5={};_0x9aaed5[_0x3551('0x2f')]=_['keys'](db['SugarcrmField'][_0x3551('0x2b')]);_0x9aaed5[_0x3551('0x32')]=_['keys'](_0x243ea5['query']);_0x9aaed5['filtears']=_[_0x3551('0x34')](_0x9aaed5['model'],_0x9aaed5[_0x3551('0x32')]);_0x1adfe0[_0x3551('0x36')]=_[_0x3551('0x34')](_0x9aaed5[_0x3551('0x2f')],qs['fields'](_0x243ea5[_0x3551('0x32')]['fields']));_0x1adfe0[_0x3551('0x36')]=_0x1adfe0[_0x3551('0x36')][_0x3551('0x37')]?_0x1adfe0[_0x3551('0x36')]:_0x9aaed5[_0x3551('0x2f')];if(_0x243ea5[_0x3551('0x32')][_0x3551('0x42')]){_0x1adfe0[_0x3551('0x43')]=[{'all':!![]}];}_0x1adfe0=_[_0x3551('0x3e')]({},_0x1adfe0,_0x243ea5['options']);return db[_0x3551('0x40')][_0x3551('0x48')](_0x1adfe0)[_0x3551('0x23')](handleEntityNotFound(_0x4331ab,null))[_0x3551('0x23')](respondWithResult(_0x4331ab,null))[_0x3551('0x45')](handleError(_0x4331ab,null));};exports[_0x3551('0x49')]=function(_0x511c1d,_0x4dbae4){return db['SugarcrmField'][_0x3551('0x49')](_0x511c1d['body'],{})['then'](respondWithResult(_0x4dbae4,0xc9))[_0x3551('0x45')](handleError(_0x4dbae4,null));};exports[_0x3551('0x22')]=function(_0x19f6a3,_0xedfd0d){if(_0x19f6a3[_0x3551('0x4a')]['id']){delete _0x19f6a3[_0x3551('0x4a')]['id'];}return db['SugarcrmField'][_0x3551('0x48')]({'where':{'id':_0x19f6a3['params']['id']}})['then'](handleEntityNotFound(_0xedfd0d,null))[_0x3551('0x23')](saveUpdates(_0x19f6a3[_0x3551('0x4a')],null))[_0x3551('0x23')](respondWithResult(_0xedfd0d,null))['catch'](handleError(_0xedfd0d,null));};exports[_0x3551('0x24')]=function(_0x5abf5a,_0x318b9e){return db[_0x3551('0x40')][_0x3551('0x48')]({'where':{'id':_0x5abf5a[_0x3551('0x47')]['id']}})[_0x3551('0x23')](handleEntityNotFound(_0x318b9e,null))[_0x3551('0x23')](removeEntity(_0x318b9e,null))[_0x3551('0x45')](handleError(_0x318b9e,null));}; \ No newline at end of file +var _0x4295=['fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','keys','SugarcrmField','length','options','find','create','body','catch','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','map','rawAttributes'];(function(_0x2d07d8,_0x432e26){var _0x3397aa=function(_0x25bd9e){while(--_0x25bd9e){_0x2d07d8['push'](_0x2d07d8['shift']());}};_0x3397aa(++_0x432e26);}(_0x4295,0x147));var _0x5429=function(_0x131a70,_0x5f53b2){_0x131a70=_0x131a70-0x0;var _0x212967=_0x4295[_0x131a70];return _0x212967;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5429('0x0'));var rimraf=require(_0x5429('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5429('0x2'));var rp=require(_0x5429('0x3'));var moment=require(_0x5429('0x4'));var BPromise=require(_0x5429('0x5'));var Mustache=require(_0x5429('0x6'));var util=require('util');var path=require(_0x5429('0x7'));var sox=require(_0x5429('0x8'));var csv=require(_0x5429('0x9'));var ejs=require(_0x5429('0xa'));var fs=require('fs');var _=require(_0x5429('0xb'));var squel=require(_0x5429('0xc'));var crypto=require(_0x5429('0xd'));var jsforce=require(_0x5429('0xe'));var deskjs=require(_0x5429('0xf'));var toCsv=require(_0x5429('0x9'));var querystring=require('querystring');var Papa=require(_0x5429('0x10'));var Redis=require(_0x5429('0x11'));var authService=require(_0x5429('0x12'));var qs=require(_0x5429('0x13'));var as=require(_0x5429('0x14'));var hardwareService=require(_0x5429('0x15'));var logger=require('../../config/logger')(_0x5429('0x16'));var utils=require(_0x5429('0x17'));var config=require(_0x5429('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5429('0x19'))['db'];function respondWithStatusCode(_0x12f851,_0xe511f6){_0xe511f6=_0xe511f6||0xcc;return function(_0x555e50){if(_0x555e50){return _0x12f851[_0x5429('0x1a')](_0xe511f6);}return _0x12f851['status'](_0xe511f6)[_0x5429('0x1b')]();};}function respondWithResult(_0x2843be,_0x86c33a){_0x86c33a=_0x86c33a||0xc8;return function(_0x2f621c){if(_0x2f621c){return _0x2843be[_0x5429('0x1c')](_0x86c33a)[_0x5429('0x1d')](_0x2f621c);}};}function respondWithFilteredResult(_0x22c94f,_0x332f88){return function(_0x18a1da){if(_0x18a1da){var _0x28ccf5=_0x18a1da[_0x5429('0x1e')],_0x240f6d=_0x332f88['offset'],_0x23eb53=_0x332f88['offset']+_0x332f88[_0x5429('0x1f')],_0x20fa36;if(_0x23eb53>=_0x28ccf5){_0x23eb53=_0x28ccf5;_0x20fa36=0xc8;}else{_0x20fa36=0xce;}_0x22c94f[_0x5429('0x1c')](_0x20fa36);return _0x22c94f[_0x5429('0x20')](_0x5429('0x21'),_0x240f6d+'-'+_0x23eb53+'/'+_0x28ccf5)[_0x5429('0x1d')](_0x18a1da);}return null;};}function patchUpdates(_0x4b62ce){return function(_0x6d9750){try{jsonpatch['apply'](_0x6d9750,_0x4b62ce,!![]);}catch(_0x4c1733){return BPromise[_0x5429('0x22')](_0x4c1733);}return _0x6d9750['save']();};}function saveUpdates(_0x4fd2ce,_0x33db8a){return function(_0x2c48d4){if(_0x2c48d4){return _0x2c48d4[_0x5429('0x23')](_0x4fd2ce)['then'](function(_0x26c499){return _0x26c499;});}return null;};}function removeEntity(_0x52a8e3,_0x28be6e){return function(_0x31c8dc){if(_0x31c8dc){return _0x31c8dc[_0x5429('0x24')]()[_0x5429('0x25')](function(){_0x52a8e3[_0x5429('0x1c')](0xcc)[_0x5429('0x1b')]();});}};}function handleEntityNotFound(_0x182280,_0x3e656c){return function(_0x4e9d51){if(!_0x4e9d51){_0x182280['sendStatus'](0x194);}return _0x4e9d51;};}function handleError(_0x502283,_0x4bc808){_0x4bc808=_0x4bc808||0x1f4;return function(_0x4ce40d){logger[_0x5429('0x26')](_0x4ce40d[_0x5429('0x27')]);if(_0x4ce40d[_0x5429('0x28')]){delete _0x4ce40d['name'];}_0x502283['status'](_0x4bc808)['send'](_0x4ce40d);};}exports['index']=function(_0x2282d4,_0x205fa9){var _0x380b97={},_0x31ff4b={},_0x3e3e61={'count':0x0,'rows':[]};var _0x1dcb65=_[_0x5429('0x29')](db['SugarcrmField'][_0x5429('0x2a')],function(_0x5ee24b){return{'name':_0x5ee24b[_0x5429('0x2b')],'type':_0x5ee24b[_0x5429('0x2c')][_0x5429('0x2d')]};});_0x31ff4b[_0x5429('0x2e')]=_[_0x5429('0x29')](_0x1dcb65,_0x5429('0x28'));_0x31ff4b['query']=_['keys'](_0x2282d4[_0x5429('0x2f')]);_0x31ff4b[_0x5429('0x30')]=_[_0x5429('0x31')](_0x31ff4b['model'],_0x31ff4b[_0x5429('0x2f')]);_0x380b97[_0x5429('0x32')]=_['intersection'](_0x31ff4b['model'],qs[_0x5429('0x33')](_0x2282d4[_0x5429('0x2f')]['fields']));_0x380b97['attributes']=_0x380b97[_0x5429('0x32')]['length']?_0x380b97[_0x5429('0x32')]:_0x31ff4b['model'];if(!_0x2282d4[_0x5429('0x2f')][_0x5429('0x34')](_0x5429('0x35'))){_0x380b97[_0x5429('0x1f')]=qs['limit'](_0x2282d4[_0x5429('0x2f')][_0x5429('0x1f')]);_0x380b97[_0x5429('0x36')]=qs['offset'](_0x2282d4[_0x5429('0x2f')][_0x5429('0x36')]);}_0x380b97['order']=qs['sort'](_0x2282d4[_0x5429('0x2f')][_0x5429('0x37')]);_0x380b97[_0x5429('0x38')]=qs[_0x5429('0x30')](_[_0x5429('0x39')](_0x2282d4[_0x5429('0x2f')],_0x31ff4b[_0x5429('0x30')]),_0x1dcb65);if(_0x2282d4[_0x5429('0x2f')]['filter']){_0x380b97[_0x5429('0x38')]=_[_0x5429('0x3a')](_0x380b97[_0x5429('0x38')],{'$or':_[_0x5429('0x29')](_0x1dcb65,function(_0x18538d){if(_0x18538d['type']!==_0x5429('0x3b')){var _0x4fa727={};_0x4fa727[_0x18538d[_0x5429('0x28')]]={'$like':'%'+_0x2282d4[_0x5429('0x2f')]['filter']+'%'};return _0x4fa727;}})});}_0x380b97=_[_0x5429('0x3a')]({},_0x380b97,_0x2282d4['options']);var _0x25c03d={'where':_0x380b97[_0x5429('0x38')]};return db['SugarcrmField']['count'](_0x25c03d)[_0x5429('0x25')](function(_0x4dd757){_0x3e3e61[_0x5429('0x1e')]=_0x4dd757;if(_0x2282d4[_0x5429('0x2f')][_0x5429('0x3c')]){_0x380b97[_0x5429('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x5429('0x3e')](_0x380b97);})[_0x5429('0x25')](function(_0x5c2f4d){_0x3e3e61[_0x5429('0x3f')]=_0x5c2f4d;return _0x3e3e61;})[_0x5429('0x25')](respondWithFilteredResult(_0x205fa9,_0x380b97))['catch'](handleError(_0x205fa9,null));};exports[_0x5429('0x40')]=function(_0x32de81,_0x256467){var _0x38e0bd={'raw':!![],'where':{'id':_0x32de81['params']['id']}},_0xc2c1d1={};_0xc2c1d1[_0x5429('0x2e')]=_[_0x5429('0x41')](db[_0x5429('0x42')][_0x5429('0x2a')]);_0xc2c1d1['query']=_['keys'](_0x32de81[_0x5429('0x2f')]);_0xc2c1d1['filtears']=_[_0x5429('0x31')](_0xc2c1d1['model'],_0xc2c1d1[_0x5429('0x2f')]);_0x38e0bd[_0x5429('0x32')]=_[_0x5429('0x31')](_0xc2c1d1['model'],qs[_0x5429('0x33')](_0x32de81[_0x5429('0x2f')][_0x5429('0x33')]));_0x38e0bd['attributes']=_0x38e0bd[_0x5429('0x32')][_0x5429('0x43')]?_0x38e0bd[_0x5429('0x32')]:_0xc2c1d1[_0x5429('0x2e')];if(_0x32de81[_0x5429('0x2f')][_0x5429('0x3c')]){_0x38e0bd[_0x5429('0x3d')]=[{'all':!![]}];}_0x38e0bd=_[_0x5429('0x3a')]({},_0x38e0bd,_0x32de81[_0x5429('0x44')]);return db[_0x5429('0x42')][_0x5429('0x45')](_0x38e0bd)[_0x5429('0x25')](handleEntityNotFound(_0x256467,null))[_0x5429('0x25')](respondWithResult(_0x256467,null))['catch'](handleError(_0x256467,null));};exports['create']=function(_0x491b14,_0x2d8865){return db[_0x5429('0x42')][_0x5429('0x46')](_0x491b14[_0x5429('0x47')],{})[_0x5429('0x25')](respondWithResult(_0x2d8865,0xc9))[_0x5429('0x48')](handleError(_0x2d8865,null));};exports[_0x5429('0x23')]=function(_0x415770,_0x2826f1){if(_0x415770[_0x5429('0x47')]['id']){delete _0x415770['body']['id'];}return db['SugarcrmField'][_0x5429('0x45')]({'where':{'id':_0x415770[_0x5429('0x49')]['id']}})[_0x5429('0x25')](handleEntityNotFound(_0x2826f1,null))[_0x5429('0x25')](saveUpdates(_0x415770[_0x5429('0x47')],null))[_0x5429('0x25')](respondWithResult(_0x2826f1,null))[_0x5429('0x48')](handleError(_0x2826f1,null));};exports[_0x5429('0x24')]=function(_0x5802ca,_0x4eead3){return db[_0x5429('0x42')][_0x5429('0x45')]({'where':{'id':_0x5802ca[_0x5429('0x49')]['id']}})[_0x5429('0x25')](handleEntityNotFound(_0x4eead3,null))[_0x5429('0x25')](removeEntity(_0x4eead3,null))[_0x5429('0x48')](handleError(_0x4eead3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9abb419..2cd714c 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 _0x6ed0=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','lodash','api'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6ed0,0x1b8));var _0x06ed=function(_0x3c40fa,_0x474dd4){_0x3c40fa=_0x3c40fa-0x0;var _0x341b92=_0x6ed0[_0x3c40fa];return _0x341b92;};'use strict';var _=require(_0x06ed('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x06ed('0x1'));var moment=require(_0x06ed('0x2'));var BPromise=require(_0x06ed('0x3'));var rp=require(_0x06ed('0x4'));var fs=require('fs');var path=require(_0x06ed('0x5'));var rimraf=require(_0x06ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x06ed('0x7'));module[_0x06ed('0x8')]=function(_0x26acfa,_0x398b61){return _0x26acfa[_0x06ed('0x9')](_0x06ed('0xa'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x06ed('0xb'),'fields':[_0x06ed('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb0ff=['idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x549a81,_0x28f9c7){var _0x514df1=function(_0x1ed41c){while(--_0x1ed41c){_0x549a81['push'](_0x549a81['shift']());}};_0x514df1(++_0x28f9c7);}(_0xb0ff,0x6b));var _0xfb0f=function(_0x2476af,_0x2ec7a7){_0x2476af=_0x2476af-0x0;var _0x24b113=_0xb0ff[_0x2476af];return _0x24b113;};'use strict';var _=require(_0xfb0f('0x0'));var util=require(_0xfb0f('0x1'));var logger=require(_0xfb0f('0x2'))(_0xfb0f('0x3'));var moment=require('moment');var BPromise=require(_0xfb0f('0x4'));var rp=require(_0xfb0f('0x5'));var fs=require('fs');var path=require(_0xfb0f('0x6'));var rimraf=require(_0xfb0f('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb0f('0x8'));module['exports']=function(_0x5ab35b,_0x27d26f){return _0x5ab35b[_0xfb0f('0x9')](_0xfb0f('0xa'),attributes,{'tableName':_0xfb0f('0xb'),'paranoid':![],'indexes':[{'name':_0xfb0f('0xc'),'fields':[_0xfb0f('0xd'),_0xfb0f('0xe')],'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 8605f25..ff1a0ec 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 _0x4fc2=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x4fc2,0x111));var _0x24fc=function(_0x5ac94d,_0x5d3a8c){_0x5ac94d=_0x5ac94d-0x0;var _0x563863=_0x4fc2[_0x5ac94d];return _0x563863;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x4c1863,_0x3b8da0){var _0xa250dc=function(_0x5c66e0){while(--_0x5c66e0){_0x4c1863['push'](_0x4c1863['shift']());}};_0xa250dc(++_0x3b8da0);}(_0xdb28,0x106));var _0x8db2=function(_0x185d06,_0x38721b){_0x185d06=_0x185d06-0x0;var _0x342296=_0xdb28[_0x185d06];return _0x342296;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 1d4e9b6..ca47fa0 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 _0xd245=['post','addConfiguration','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x283304,_0x29a1b7){var _0x1ab99a=function(_0x54e35d){while(--_0x54e35d){_0x283304['push'](_0x283304['shift']());}};_0x1ab99a(++_0x29a1b7);}(_0xd245,0x6d));var _0x5d24=function(_0x547e20,_0x284545){_0x547e20=_0x547e20-0x0;var _0x359171=_0xd245[_0x547e20];return _0x359171;};'use strict';var multer=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var path=require('path');var timeout=require(_0x5d24('0x2'));var express=require(_0x5d24('0x3'));var router=express[_0x5d24('0x4')]();var auth=require(_0x5d24('0x5'));var interaction=require(_0x5d24('0x6'));var config=require('../../config/environment');var controller=require(_0x5d24('0x7'));router['get']('/',auth[_0x5d24('0x8')](),controller[_0x5d24('0x9')]);router[_0x5d24('0xa')](_0x5d24('0xb'),auth['isAuthenticated'](),controller[_0x5d24('0xc')]);router[_0x5d24('0xa')](_0x5d24('0xd'),auth[_0x5d24('0x8')](),controller[_0x5d24('0xe')]);router['get'](_0x5d24('0xf'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x10')]);router['post']('/',auth[_0x5d24('0x8')](),controller['create']);router[_0x5d24('0x11')](_0x5d24('0xd'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x12')]);router['put'](_0x5d24('0xb'),auth[_0x5d24('0x8')](),controller[_0x5d24('0x13')]);router['delete'](_0x5d24('0xb'),auth[_0x5d24('0x8')](),controller['destroy']);module[_0x5d24('0x14')]=router; \ No newline at end of file +var _0xa86b=['./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x30d445,_0x1935d5){var _0x4cbf39=function(_0x367c5b){while(--_0x367c5b){_0x30d445['push'](_0x30d445['shift']());}};_0x4cbf39(++_0x1935d5);}(_0xa86b,0x1f2));var _0xba86=function(_0x1c0942,_0x2e642a){_0x1c0942=_0x1c0942-0x0;var _0x407d6b=_0xa86b[_0x1c0942];return _0x407d6b;};'use strict';var multer=require(_0xba86('0x0'));var util=require(_0xba86('0x1'));var path=require('path');var timeout=require(_0xba86('0x2'));var express=require(_0xba86('0x3'));var router=express[_0xba86('0x4')]();var auth=require(_0xba86('0x5'));var interaction=require(_0xba86('0x6'));var config=require(_0xba86('0x7'));var controller=require(_0xba86('0x8'));router[_0xba86('0x9')]('/',auth[_0xba86('0xa')](),controller[_0xba86('0xb')]);router['get']('/:id',auth[_0xba86('0xa')](),controller[_0xba86('0xc')]);router[_0xba86('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba86('0xd')]);router[_0xba86('0x9')](_0xba86('0xe'),auth[_0xba86('0xa')](),controller['getFields']);router[_0xba86('0xf')]('/',auth[_0xba86('0xa')](),controller[_0xba86('0x10')]);router[_0xba86('0xf')](_0xba86('0x11'),auth[_0xba86('0xa')](),controller['addConfiguration']);router['put'](_0xba86('0x12'),auth[_0xba86('0xa')](),controller[_0xba86('0x13')]);router[_0xba86('0x14')](_0xba86('0x12'),auth[_0xba86('0xa')](),controller[_0xba86('0x15')]);module[_0xba86('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c75d394..8356315 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 _0xb1cc=['STRING','sequelize','exports'];(function(_0xbeb808,_0x881ddf){var _0x5d6909=function(_0x37d652){while(--_0x37d652){_0xbeb808['push'](_0xbeb808['shift']());}};_0x5d6909(++_0x881ddf);}(_0xb1cc,0xfa));var _0xcb1c=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb1cc[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0xcb1c('0x0'));module[_0xcb1c('0x1')]={'name':{'type':Sequelize[_0xcb1c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xcb1c('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xcb1c('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xcb1c('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xcb1c('0x2')]},'accessKey':{'type':Sequelize[_0xcb1c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe13d=['STRING','HelpDesk','sequelize'];(function(_0xef08c,_0x5d7dfc){var _0x247f3a=function(_0x4bac01){while(--_0x4bac01){_0xef08c['push'](_0xef08c['shift']());}};_0x247f3a(++_0x5d7dfc);}(_0xe13d,0x11c));var _0xde13=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe13d[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xde13('0x0'));module['exports']={'name':{'type':Sequelize[_0xde13('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xde13('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xde13('0x1')],'allowNull':![],'defaultValue':_0xde13('0x2')},'remoteUri':{'type':Sequelize[_0xde13('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xde13('0x1')]},'accessKey':{'type':Sequelize[_0xde13('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e68d4d9..afab1d7 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 _0x9ce6=['set','json','save','update','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','length','find','create','body','getConfigurations','VtigerConfiguration','sort','addConfiguration','findOne','getSubjects','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','username','remoteUri','serverUrl','accessKey','moduleName','substring','lastIndexOf','getchallenge','POST','login','token','success','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','jayson/promise','client','http','then','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','limit'];(function(_0x3ec86c,_0x317951){var _0x4ad96b=function(_0x1369bf){while(--_0x1369bf){_0x3ec86c['push'](_0x3ec86c['shift']());}};_0x4ad96b(++_0x317951);}(_0x9ce6,0x13b));var _0x69ce=function(_0x341cad,_0x4fcca4){_0x341cad=_0x341cad-0x0;var _0x401840=_0x9ce6[_0x341cad];return _0x401840;};'use strict';var pdf=require(_0x69ce('0x0'));var emlformat=require(_0x69ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x69ce('0x2'));var jsonpatch=require(_0x69ce('0x3'));var rp=require(_0x69ce('0x4'));var moment=require(_0x69ce('0x5'));var BPromise=require(_0x69ce('0x6'));var Mustache=require(_0x69ce('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x69ce('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x69ce('0x9'));var squel=require('squel');var crypto=require(_0x69ce('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x69ce('0xb'));var toCsv=require(_0x69ce('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x69ce('0xc'));var authService=require(_0x69ce('0xd'));var qs=require(_0x69ce('0xe'));var as=require(_0x69ce('0xf'));var hardwareService=require(_0x69ce('0x10'));var logger=require('../../config/logger')(_0x69ce('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x69ce('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x69ce('0x13'));var client=jayson[_0x69ce('0x14')][_0x69ce('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1eb6f0,_0x35c122,_0xc2cab8,_0x3a1dd6){return new BPromise(function(_0x572ad0,_0x22759b){var _0x40fd6b=_0x3a1dd6||client;return _0x40fd6b['request'](_0x1eb6f0,_0xc2cab8)[_0x69ce('0x16')](function(_0x17c6dc){logger['info']('VtigerAccount,\x20%s,\x20%s',_0x35c122,_0x69ce('0x17'));logger[_0x69ce('0x18')](_0x69ce('0x19'),_0x35c122,_0x69ce('0x17'),JSON[_0x69ce('0x1a')](_0x17c6dc));if(_0x17c6dc['error']){if(_0x17c6dc['error'][_0x69ce('0x1b')]===0x1f4){logger[_0x69ce('0x1c')](_0x69ce('0x1d'),_0x35c122,_0x17c6dc[_0x69ce('0x1c')][_0x69ce('0x1e')]);return _0x22759b(_0x17c6dc['error']['message']);}logger[_0x69ce('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x35c122,_0x17c6dc[_0x69ce('0x1c')]['message']);return _0x572ad0(_0x17c6dc[_0x69ce('0x1c')]['message']);}else{logger[_0x69ce('0x1f')](_0x69ce('0x1d'),_0x35c122,_0x69ce('0x17'));_0x572ad0(_0x17c6dc[_0x69ce('0x20')][_0x69ce('0x1e')]);}})[_0x69ce('0x21')](function(_0x4b6b4c){logger[_0x69ce('0x1c')](_0x69ce('0x1d'),_0x35c122,_0x4b6b4c);_0x22759b(_0x4b6b4c);});});}function respondWithStatusCode(_0x1eae2a,_0x16751a){_0x16751a=_0x16751a||0xcc;return function(_0x4aba16){if(_0x4aba16){return _0x1eae2a[_0x69ce('0x22')](_0x16751a);}return _0x1eae2a[_0x69ce('0x23')](_0x16751a)['end']();};}function respondWithResult(_0x1cc754,_0x53d284){_0x53d284=_0x53d284||0xc8;return function(_0x60b8ba){if(_0x60b8ba){return _0x1cc754[_0x69ce('0x23')](_0x53d284)['json'](_0x60b8ba);}};}function respondWithFilteredResult(_0x5c8e65,_0x22bb6d){return function(_0xb06075){if(_0xb06075){var _0x47b4d6=_0xb06075[_0x69ce('0x24')],_0x826ef9=_0x22bb6d[_0x69ce('0x25')],_0x18f705=_0x22bb6d[_0x69ce('0x25')]+_0x22bb6d[_0x69ce('0x26')],_0x3b1a20;if(_0x18f705>=_0x47b4d6){_0x18f705=_0x47b4d6;_0x3b1a20=0xc8;}else{_0x3b1a20=0xce;}_0x5c8e65['status'](_0x3b1a20);return _0x5c8e65[_0x69ce('0x27')]('Content-Range',_0x826ef9+'-'+_0x18f705+'/'+_0x47b4d6)[_0x69ce('0x28')](_0xb06075);}return null;};}function patchUpdates(_0x5ed0a7){return function(_0x275eaa){try{jsonpatch['apply'](_0x275eaa,_0x5ed0a7,!![]);}catch(_0x397c74){return BPromise['reject'](_0x397c74);}return _0x275eaa[_0x69ce('0x29')]();};}function saveUpdates(_0x4aaa3a,_0x46d944){return function(_0x41292b){if(_0x41292b){return _0x41292b[_0x69ce('0x2a')](_0x4aaa3a)['then'](function(_0x725b3){return _0x725b3;});}return null;};}function removeEntity(_0x48c25a,_0x2b2e0a){return function(_0x20bc54){if(_0x20bc54){return _0x20bc54[_0x69ce('0x2b')]()[_0x69ce('0x16')](function(){_0x48c25a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x265323,_0x44d6d1){return function(_0x5e7ace){if(!_0x5e7ace){_0x265323[_0x69ce('0x22')](0x194);}return _0x5e7ace;};}function handleError(_0x474160,_0x4cebb1){_0x4cebb1=_0x4cebb1||0x1f4;return function(_0x83756a){logger[_0x69ce('0x1c')](_0x83756a[_0x69ce('0x2c')]);if(_0x83756a[_0x69ce('0x2d')]){delete _0x83756a[_0x69ce('0x2d')];}_0x474160['status'](_0x4cebb1)[_0x69ce('0x2e')](_0x83756a);};}exports[_0x69ce('0x2f')]=function(_0x554b13,_0x3bcf18){var _0x4e91b4={},_0xb5f2ce={},_0x132d6a={'count':0x0,'rows':[]};var _0x155f7b=_[_0x69ce('0x30')](db[_0x69ce('0x31')][_0x69ce('0x32')],function(_0x48e520){return{'name':_0x48e520['fieldName'],'type':_0x48e520[_0x69ce('0x33')]['key']};});_0xb5f2ce[_0x69ce('0x34')]=_[_0x69ce('0x30')](_0x155f7b,_0x69ce('0x2d'));_0xb5f2ce[_0x69ce('0x35')]=_['keys'](_0x554b13['query']);_0xb5f2ce[_0x69ce('0x36')]=_[_0x69ce('0x37')](_0xb5f2ce['model'],_0xb5f2ce[_0x69ce('0x35')]);_0x4e91b4['attributes']=_[_0x69ce('0x37')](_0xb5f2ce[_0x69ce('0x34')],qs[_0x69ce('0x38')](_0x554b13[_0x69ce('0x35')][_0x69ce('0x38')]));_0x4e91b4[_0x69ce('0x39')]=_0x4e91b4['attributes']['length']?_0x4e91b4[_0x69ce('0x39')]:_0xb5f2ce[_0x69ce('0x34')];if(!_0x554b13['query'][_0x69ce('0x3a')](_0x69ce('0x3b'))){_0x4e91b4[_0x69ce('0x26')]=qs[_0x69ce('0x26')](_0x554b13[_0x69ce('0x35')][_0x69ce('0x26')]);_0x4e91b4[_0x69ce('0x25')]=qs[_0x69ce('0x25')](_0x554b13[_0x69ce('0x35')][_0x69ce('0x25')]);}_0x4e91b4[_0x69ce('0x3c')]=qs['sort'](_0x554b13['query']['sort']);_0x4e91b4[_0x69ce('0x3d')]=qs[_0x69ce('0x36')](_[_0x69ce('0x3e')](_0x554b13[_0x69ce('0x35')],_0xb5f2ce[_0x69ce('0x36')]),_0x155f7b);if(_0x554b13['query'][_0x69ce('0x3f')]){_0x4e91b4[_0x69ce('0x3d')]=_['merge'](_0x4e91b4[_0x69ce('0x3d')],{'$or':_[_0x69ce('0x30')](_0x155f7b,function(_0x292f91){if(_0x292f91['type']!=='VIRTUAL'){var _0x47aa21={};_0x47aa21[_0x292f91['name']]={'$like':'%'+_0x554b13[_0x69ce('0x35')][_0x69ce('0x3f')]+'%'};return _0x47aa21;}})});}_0x4e91b4=_[_0x69ce('0x40')]({},_0x4e91b4,_0x554b13[_0x69ce('0x41')]);var _0x2e50fc={'where':_0x4e91b4['where']};return db[_0x69ce('0x31')][_0x69ce('0x24')](_0x2e50fc)[_0x69ce('0x16')](function(_0x33d991){_0x132d6a[_0x69ce('0x24')]=_0x33d991;if(_0x554b13[_0x69ce('0x35')][_0x69ce('0x42')]){_0x4e91b4[_0x69ce('0x43')]=[{'all':!![]}];}return db[_0x69ce('0x31')][_0x69ce('0x44')](_0x4e91b4);})[_0x69ce('0x16')](function(_0x6e797){_0x132d6a[_0x69ce('0x45')]=_0x6e797;return _0x132d6a;})[_0x69ce('0x16')](respondWithFilteredResult(_0x3bcf18,_0x4e91b4))[_0x69ce('0x21')](handleError(_0x3bcf18,null));};exports['show']=function(_0x4c49f2,_0x31aef7){var _0x4bb5e2={'raw':![],'where':{'id':_0x4c49f2[_0x69ce('0x46')]['id']}},_0xce7467={};_0xce7467[_0x69ce('0x34')]=_[_0x69ce('0x47')](db[_0x69ce('0x31')][_0x69ce('0x32')]);_0xce7467[_0x69ce('0x35')]=_['keys'](_0x4c49f2['query']);_0xce7467['filtears']=_[_0x69ce('0x37')](_0xce7467[_0x69ce('0x34')],_0xce7467['query']);_0x4bb5e2[_0x69ce('0x39')]=_[_0x69ce('0x37')](_0xce7467[_0x69ce('0x34')],qs[_0x69ce('0x38')](_0x4c49f2[_0x69ce('0x35')][_0x69ce('0x38')]));_0x4bb5e2[_0x69ce('0x39')]=_0x4bb5e2['attributes'][_0x69ce('0x48')]?_0x4bb5e2[_0x69ce('0x39')]:_0xce7467[_0x69ce('0x34')];if(_0x4c49f2['query'][_0x69ce('0x42')]){_0x4bb5e2[_0x69ce('0x43')]=[{'all':!![]}];}_0x4bb5e2=_[_0x69ce('0x40')]({},_0x4bb5e2,_0x4c49f2[_0x69ce('0x41')]);return db[_0x69ce('0x31')][_0x69ce('0x49')](_0x4bb5e2)[_0x69ce('0x16')](handleEntityNotFound(_0x31aef7,null))[_0x69ce('0x16')](respondWithResult(_0x31aef7,null))[_0x69ce('0x21')](handleError(_0x31aef7,null));};exports['create']=function(_0x13d1ad,_0x55337c){return db['VtigerAccount'][_0x69ce('0x4a')](_0x13d1ad[_0x69ce('0x4b')],{})[_0x69ce('0x16')](respondWithResult(_0x55337c,0xc9))[_0x69ce('0x21')](handleError(_0x55337c,null));};exports['update']=function(_0x407ad2,_0x1cfc07){if(_0x407ad2['body']['id']){delete _0x407ad2['body']['id'];}return db[_0x69ce('0x31')][_0x69ce('0x49')]({'where':{'id':_0x407ad2[_0x69ce('0x46')]['id']}})[_0x69ce('0x16')](handleEntityNotFound(_0x1cfc07,null))[_0x69ce('0x16')](saveUpdates(_0x407ad2[_0x69ce('0x4b')],null))['then'](respondWithResult(_0x1cfc07,null))[_0x69ce('0x21')](handleError(_0x1cfc07,null));};exports[_0x69ce('0x2b')]=function(_0x517802,_0xbacd0){return db[_0x69ce('0x31')][_0x69ce('0x49')]({'where':{'id':_0x517802[_0x69ce('0x46')]['id']}})[_0x69ce('0x16')](handleEntityNotFound(_0xbacd0,null))[_0x69ce('0x16')](removeEntity(_0xbacd0,null))[_0x69ce('0x21')](handleError(_0xbacd0,null));};exports[_0x69ce('0x4c')]=function(_0x19d0b4,_0x28e5db,_0x44a7d8){var _0x5d3963={};var _0x1de719={};var _0x2f249a;var _0x3df99f;return db[_0x69ce('0x31')]['findOne']({'where':{'id':_0x19d0b4[_0x69ce('0x46')]['id']}})[_0x69ce('0x16')](handleEntityNotFound(_0x28e5db,null))['then'](function(_0x288971){if(_0x288971){_0x2f249a=_0x288971;_0x1de719[_0x69ce('0x34')]=_[_0x69ce('0x47')](db[_0x69ce('0x4d')][_0x69ce('0x32')]);_0x1de719[_0x69ce('0x35')]=_[_0x69ce('0x47')](_0x19d0b4['query']);_0x1de719['filters']=_[_0x69ce('0x37')](_0x1de719[_0x69ce('0x34')],_0x1de719['query']);_0x5d3963[_0x69ce('0x39')]=_['intersection'](_0x1de719[_0x69ce('0x34')],qs['fields'](_0x19d0b4[_0x69ce('0x35')][_0x69ce('0x38')]));_0x5d3963[_0x69ce('0x39')]=_0x5d3963[_0x69ce('0x39')]['length']?_0x5d3963[_0x69ce('0x39')]:_0x1de719[_0x69ce('0x34')];_0x5d3963[_0x69ce('0x3c')]=qs['sort'](_0x19d0b4[_0x69ce('0x35')][_0x69ce('0x4e')]);_0x5d3963['where']=qs[_0x69ce('0x36')](_[_0x69ce('0x3e')](_0x19d0b4[_0x69ce('0x35')],_0x1de719[_0x69ce('0x36')]));if(_0x19d0b4[_0x69ce('0x35')][_0x69ce('0x3f')]){_0x5d3963[_0x69ce('0x3d')]=_['merge'](_0x5d3963['where'],{'$or':_[_0x69ce('0x30')](_0x5d3963[_0x69ce('0x39')],function(_0x1fd554){var _0x4eb496={};_0x4eb496[_0x1fd554]={'$like':'%'+_0x19d0b4[_0x69ce('0x35')]['filter']+'%'};return _0x4eb496;})});}_0x5d3963=_[_0x69ce('0x40')]({},_0x5d3963,_0x19d0b4[_0x69ce('0x41')]);return _0x2f249a[_0x69ce('0x4c')](_0x5d3963);}})[_0x69ce('0x16')](function(_0x4cd925){if(_0x4cd925){_0x3df99f=_0x4cd925[_0x69ce('0x48')];if(!_0x19d0b4['query'][_0x69ce('0x3a')]('nolimit')){_0x5d3963['limit']=qs['limit'](_0x19d0b4[_0x69ce('0x35')]['limit']);_0x5d3963[_0x69ce('0x25')]=qs[_0x69ce('0x25')](_0x19d0b4[_0x69ce('0x35')][_0x69ce('0x25')]);}return _0x2f249a['getConfigurations'](_0x5d3963);}})['then'](function(_0x2a492f){if(_0x2a492f){return _0x2a492f?{'count':_0x3df99f,'rows':_0x2a492f}:null;}})[_0x69ce('0x16')](respondWithResult(_0x28e5db,null))[_0x69ce('0x21')](handleError(_0x28e5db,null));};exports[_0x69ce('0x4f')]=function(_0x230eb3,_0x14577b,_0x215929){if(_0x230eb3[_0x69ce('0x4b')]['id']){delete _0x230eb3[_0x69ce('0x4b')]['id'];}return db['VtigerAccount'][_0x69ce('0x50')]({'where':{'id':_0x230eb3['params']['id']}})['then'](handleEntityNotFound(_0x14577b,null))[_0x69ce('0x16')](function(_0x1d3b76){if(_0x1d3b76){_0x230eb3[_0x69ce('0x4b')]['AccountId']=_0x1d3b76['id'];_0x230eb3['body']['Subjects']=integrations[_0x69ce('0x51')](_0x230eb3[_0x69ce('0x4b')][_0x69ce('0x52')],_0x230eb3['body'][_0x69ce('0x33')]);_0x230eb3[_0x69ce('0x4b')][_0x69ce('0x53')]=integrations[_0x69ce('0x54')](_0x230eb3[_0x69ce('0x4b')][_0x69ce('0x52')],_0x230eb3['body'][_0x69ce('0x33')]);return db[_0x69ce('0x4d')][_0x69ce('0x4a')](_0x230eb3[_0x69ce('0x4b')],{'include':[{'model':db[_0x69ce('0x55')],'as':_0x69ce('0x56')},{'model':db[_0x69ce('0x55')],'as':_0x69ce('0x53')}]});}return null;})[_0x69ce('0x16')](respondWithResult(_0x14577b,null))['catch'](handleError(_0x14577b,null));};var md5=require(_0x69ce('0x57'));exports[_0x69ce('0x58')]=function(_0x1c28d5,_0x519f8a,_0x500f0a){var _0xf2e2ab=null;var _0x403882=null;var _0x3b035b=null;var _0x5ab9ab=null;var _0x5222bf='';return db[_0x69ce('0x31')][_0x69ce('0x50')]({'where':{'id':_0x1c28d5[_0x69ce('0x46')]['id']},'attributes':['id',_0x69ce('0x2d'),_0x69ce('0x59'),'description','moduleName',_0x69ce('0x5a'),_0x69ce('0x5b'),_0x69ce('0x5c')]})['then'](handleEntityNotFound(_0x519f8a,null))['then'](function(_0x45e0aa){if(_0x45e0aa){_0xf2e2ab=_0x45e0aa[_0x69ce('0x59')];_0x403882=_0x45e0aa[_0x69ce('0x5c')];_0x3b035b=_0x45e0aa[_0x69ce('0x5d')];_0x5222bf=_0x45e0aa['remoteUri'];var _0x42686a=_0x5222bf['slice'](-0x1);if(_0x42686a==='/'){_0x5222bf=_0x5222bf[_0x69ce('0x5e')](0x0,_0x5222bf[_0x69ce('0x5f')](_0x42686a));}_0x5ab9ab=util['format']('%s/webservice.php',_0x5222bf);var _0x304351={'method':'GET','uri':_0x5ab9ab,'qs':{'operation':_0x69ce('0x60'),'username':_0x45e0aa[_0x69ce('0x59')]},'json':!![]};return rp(_0x304351);}})[_0x69ce('0x16')](function(_0x47b174){if(_0x47b174['success']){var _0x107542={'method':_0x69ce('0x61'),'uri':_0x5ab9ab,'form':{'operation':_0x69ce('0x62'),'username':_0xf2e2ab,'accessKey':md5(_0x47b174['result'][_0x69ce('0x63')]+_0x403882)},'json':!![]};return rp(_0x107542);}})[_0x69ce('0x16')](function(_0x25088d){if(_0x25088d[_0x69ce('0x64')]){var _0x5893e3={'method':'GET','uri':_0x5ab9ab,'qs':{'operation':'describe','username':_0xf2e2ab,'sessionName':_0x25088d['result'][_0x69ce('0x65')],'elementType':_0x3b035b},'json':!![]};return rp(_0x5893e3);}})[_0x69ce('0x16')](function(_0x31b818){if(_0x31b818[_0x69ce('0x64')]){var _0x26493b=[_0x69ce('0x66'),_0x69ce('0x67'),_0x69ce('0x68')];_[_0x69ce('0x69')](_0x31b818['result'][_0x69ce('0x38')],function(_0x2d090f){return _0x26493b[_0x69ce('0x6a')](_0x2d090f[_0x69ce('0x33')][_0x69ce('0x2d')]);});_[_0x69ce('0x69')](_0x31b818[_0x69ce('0x20')]['fields'],function(_0x2f3cf1){return _0x2f3cf1[_0x69ce('0x6b')]===_0x69ce('0x6c');});return{'count':_0x31b818['result'][_0x69ce('0x38')]['length'],'rows':_['map'](_0x31b818[_0x69ce('0x20')][_0x69ce('0x38')],function(_0x122bec){return{'id':_0x122bec[_0x69ce('0x2d')],'name':_0x122bec[_0x69ce('0x6d')],'custom':_['startsWith'](_0x122bec['name'],'cf_')?!![]:![],'options':_0x122bec[_0x69ce('0x33')][_0x69ce('0x2d')]===_0x69ce('0x6e')&&_0x122bec['type']['picklistValues'][_0x69ce('0x48')]>0x0?_[_0x69ce('0x30')](_0x122bec['type'][_0x69ce('0x6f')],function(_0x4cbf35){return{'name':_0x4cbf35[_0x69ce('0x6d')],'value':_0x4cbf35[_0x69ce('0x70')]};}):[]};})};}})[_0x69ce('0x16')](respondWithResult(_0x519f8a,null))[_0x69ce('0x21')](function(_0x9b2315){console[_0x69ce('0x71')](_0x69ce('0x72')+_0x9b2315);var _0x339454=_0x1c28d5[_0x69ce('0x35')][_0x69ce('0x73')]?0x1f4:_0x9b2315[_0x69ce('0x74')]||0x1f4;logger[_0x69ce('0x1c')](_0x69ce('0x75'),_0x69ce('0x58'),_0x339454,JSON[_0x69ce('0x1a')](_0x9b2315));delete _0x9b2315[_0x69ce('0x2d')];if(_0x339454===0x191){_0x339454=0x190;}_0x519f8a[_0x69ce('0x23')](_0x339454)['send'](_0x1c28d5[_0x69ce('0x35')][_0x69ce('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x9b2315[_0x69ce('0x74')]}:_0x9b2315);});}; \ No newline at end of file +var _0x14bb=['Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','serverUrl','substring','format','%s/webservice.php','GET','getchallenge','success','POST','login','describe','sessionName','autogenerated','reference','owner','includes','editable','false','startsWith','cf_','picklist','label','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','show','filtears','length','include','find','create','body','params','getConfigurations','pick','nolimit','findOne','AccountId'];(function(_0x2a6fd5,_0x3d6deb){var _0x43c6a4=function(_0x3aecb3){while(--_0x3aecb3){_0x2a6fd5['push'](_0x2a6fd5['shift']());}};_0x43c6a4(++_0x3d6deb);}(_0x14bb,0xab));var _0xb14b=function(_0x306ccc,_0x377ae5){_0x306ccc=_0x306ccc-0x0;var _0x3c9fc8=_0x14bb[_0x306ccc];return _0x3c9fc8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb14b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb14b('0x1'));var rp=require(_0xb14b('0x2'));var moment=require(_0xb14b('0x3'));var BPromise=require(_0xb14b('0x4'));var Mustache=require(_0xb14b('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb14b('0x6'));var csv=require(_0xb14b('0x7'));var ejs=require(_0xb14b('0x8'));var fs=require('fs');var _=require(_0xb14b('0x9'));var squel=require(_0xb14b('0xa'));var crypto=require(_0xb14b('0xb'));var jsforce=require(_0xb14b('0xc'));var deskjs=require(_0xb14b('0xd'));var toCsv=require(_0xb14b('0x7'));var querystring=require(_0xb14b('0xe'));var Papa=require(_0xb14b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb14b('0x10'));var as=require(_0xb14b('0x11'));var hardwareService=require(_0xb14b('0x12'));var logger=require('../../config/logger')(_0xb14b('0x13'));var utils=require(_0xb14b('0x14'));var config=require(_0xb14b('0x15'));var licenseUtil=require(_0xb14b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb14b('0x17'));var jayson=require(_0xb14b('0x18'));var client=jayson[_0xb14b('0x19')][_0xb14b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3ad439,_0x588b43,_0x501063,_0x3d7ce9){return new BPromise(function(_0x534322,_0x118f98){var _0x2c5302=_0x3d7ce9||client;return _0x2c5302[_0xb14b('0x1b')](_0x3ad439,_0x501063)[_0xb14b('0x1c')](function(_0x551fa9){logger[_0xb14b('0x1d')]('VtigerAccount,\x20%s,\x20%s',_0x588b43,_0xb14b('0x1e'));logger[_0xb14b('0x1f')](_0xb14b('0x20'),_0x588b43,_0xb14b('0x1e'),JSON[_0xb14b('0x21')](_0x551fa9));if(_0x551fa9[_0xb14b('0x22')]){if(_0x551fa9[_0xb14b('0x22')][_0xb14b('0x23')]===0x1f4){logger[_0xb14b('0x22')](_0xb14b('0x24'),_0x588b43,_0x551fa9[_0xb14b('0x22')][_0xb14b('0x25')]);return _0x118f98(_0x551fa9[_0xb14b('0x22')][_0xb14b('0x25')]);}logger[_0xb14b('0x22')](_0xb14b('0x24'),_0x588b43,_0x551fa9[_0xb14b('0x22')][_0xb14b('0x25')]);return _0x534322(_0x551fa9[_0xb14b('0x22')]['message']);}else{logger['info'](_0xb14b('0x24'),_0x588b43,_0xb14b('0x1e'));_0x534322(_0x551fa9[_0xb14b('0x26')][_0xb14b('0x25')]);}})[_0xb14b('0x27')](function(_0x2bdc8b){logger[_0xb14b('0x22')](_0xb14b('0x24'),_0x588b43,_0x2bdc8b);_0x118f98(_0x2bdc8b);});});}function respondWithStatusCode(_0x2e34fc,_0x45668b){_0x45668b=_0x45668b||0xcc;return function(_0xa163f5){if(_0xa163f5){return _0x2e34fc['sendStatus'](_0x45668b);}return _0x2e34fc[_0xb14b('0x28')](_0x45668b)['end']();};}function respondWithResult(_0x354d0c,_0x2b6bb3){_0x2b6bb3=_0x2b6bb3||0xc8;return function(_0x11d1de){if(_0x11d1de){return _0x354d0c[_0xb14b('0x28')](_0x2b6bb3)[_0xb14b('0x29')](_0x11d1de);}};}function respondWithFilteredResult(_0x4da90a,_0x445ca9){return function(_0x256e45){if(_0x256e45){var _0x340e3=_0x256e45['count'],_0x3f1d03=_0x445ca9[_0xb14b('0x2a')],_0x31c299=_0x445ca9['offset']+_0x445ca9[_0xb14b('0x2b')],_0x220418;if(_0x31c299>=_0x340e3){_0x31c299=_0x340e3;_0x220418=0xc8;}else{_0x220418=0xce;}_0x4da90a[_0xb14b('0x28')](_0x220418);return _0x4da90a['set'](_0xb14b('0x2c'),_0x3f1d03+'-'+_0x31c299+'/'+_0x340e3)[_0xb14b('0x29')](_0x256e45);}return null;};}function patchUpdates(_0x4f5dd9){return function(_0x346df6){try{jsonpatch[_0xb14b('0x2d')](_0x346df6,_0x4f5dd9,!![]);}catch(_0x169441){return BPromise[_0xb14b('0x2e')](_0x169441);}return _0x346df6[_0xb14b('0x2f')]();};}function saveUpdates(_0x16b9c9,_0x4ac985){return function(_0x2326c0){if(_0x2326c0){return _0x2326c0[_0xb14b('0x30')](_0x16b9c9)['then'](function(_0x1e3544){return _0x1e3544;});}return null;};}function removeEntity(_0x50a075,_0x2f7edf){return function(_0xf28bd6){if(_0xf28bd6){return _0xf28bd6[_0xb14b('0x31')]()[_0xb14b('0x1c')](function(){_0x50a075['status'](0xcc)[_0xb14b('0x32')]();});}};}function handleEntityNotFound(_0x23b7fd,_0x1f91e5){return function(_0x5b7e91){if(!_0x5b7e91){_0x23b7fd['sendStatus'](0x194);}return _0x5b7e91;};}function handleError(_0x115b88,_0xa1351c){_0xa1351c=_0xa1351c||0x1f4;return function(_0x2fe750){logger[_0xb14b('0x22')](_0x2fe750[_0xb14b('0x33')]);if(_0x2fe750[_0xb14b('0x34')]){delete _0x2fe750[_0xb14b('0x34')];}_0x115b88[_0xb14b('0x28')](_0xa1351c)[_0xb14b('0x35')](_0x2fe750);};}exports[_0xb14b('0x36')]=function(_0x246149,_0xabff49){var _0x41aa4a={},_0x3575ae={},_0x2a5c4b={'count':0x0,'rows':[]};var _0x4a9ee6=_['map'](db[_0xb14b('0x37')][_0xb14b('0x38')],function(_0x5aad22){return{'name':_0x5aad22[_0xb14b('0x39')],'type':_0x5aad22[_0xb14b('0x3a')][_0xb14b('0x3b')]};});_0x3575ae[_0xb14b('0x3c')]=_['map'](_0x4a9ee6,_0xb14b('0x34'));_0x3575ae[_0xb14b('0x3d')]=_[_0xb14b('0x3e')](_0x246149['query']);_0x3575ae[_0xb14b('0x3f')]=_[_0xb14b('0x40')](_0x3575ae['model'],_0x3575ae[_0xb14b('0x3d')]);_0x41aa4a[_0xb14b('0x41')]=_[_0xb14b('0x40')](_0x3575ae[_0xb14b('0x3c')],qs[_0xb14b('0x42')](_0x246149['query'][_0xb14b('0x42')]));_0x41aa4a[_0xb14b('0x41')]=_0x41aa4a[_0xb14b('0x41')]['length']?_0x41aa4a[_0xb14b('0x41')]:_0x3575ae[_0xb14b('0x3c')];if(!_0x246149['query'][_0xb14b('0x43')]('nolimit')){_0x41aa4a['limit']=qs[_0xb14b('0x2b')](_0x246149[_0xb14b('0x3d')]['limit']);_0x41aa4a[_0xb14b('0x2a')]=qs[_0xb14b('0x2a')](_0x246149[_0xb14b('0x3d')][_0xb14b('0x2a')]);}_0x41aa4a[_0xb14b('0x44')]=qs[_0xb14b('0x45')](_0x246149[_0xb14b('0x3d')][_0xb14b('0x45')]);_0x41aa4a[_0xb14b('0x46')]=qs[_0xb14b('0x3f')](_['pick'](_0x246149['query'],_0x3575ae[_0xb14b('0x3f')]),_0x4a9ee6);if(_0x246149[_0xb14b('0x3d')][_0xb14b('0x47')]){_0x41aa4a[_0xb14b('0x46')]=_[_0xb14b('0x48')](_0x41aa4a[_0xb14b('0x46')],{'$or':_[_0xb14b('0x49')](_0x4a9ee6,function(_0x3786b8){if(_0x3786b8[_0xb14b('0x3a')]!==_0xb14b('0x4a')){var _0x3737e4={};_0x3737e4[_0x3786b8[_0xb14b('0x34')]]={'$like':'%'+_0x246149[_0xb14b('0x3d')][_0xb14b('0x47')]+'%'};return _0x3737e4;}})});}_0x41aa4a=_['merge']({},_0x41aa4a,_0x246149[_0xb14b('0x4b')]);var _0x4ae2c8={'where':_0x41aa4a[_0xb14b('0x46')]};return db[_0xb14b('0x37')][_0xb14b('0x4c')](_0x4ae2c8)[_0xb14b('0x1c')](function(_0x414f65){_0x2a5c4b['count']=_0x414f65;if(_0x246149[_0xb14b('0x3d')][_0xb14b('0x4d')]){_0x41aa4a['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xb14b('0x4e')](_0x41aa4a);})[_0xb14b('0x1c')](function(_0x33137f){_0x2a5c4b[_0xb14b('0x4f')]=_0x33137f;return _0x2a5c4b;})['then'](respondWithFilteredResult(_0xabff49,_0x41aa4a))[_0xb14b('0x27')](handleError(_0xabff49,null));};exports[_0xb14b('0x50')]=function(_0xd21383,_0x26d080){var _0x297f36={'raw':![],'where':{'id':_0xd21383['params']['id']}},_0x59e545={};_0x59e545['model']=_[_0xb14b('0x3e')](db[_0xb14b('0x37')][_0xb14b('0x38')]);_0x59e545[_0xb14b('0x3d')]=_[_0xb14b('0x3e')](_0xd21383['query']);_0x59e545[_0xb14b('0x51')]=_[_0xb14b('0x40')](_0x59e545[_0xb14b('0x3c')],_0x59e545[_0xb14b('0x3d')]);_0x297f36['attributes']=_[_0xb14b('0x40')](_0x59e545[_0xb14b('0x3c')],qs['fields'](_0xd21383[_0xb14b('0x3d')]['fields']));_0x297f36['attributes']=_0x297f36[_0xb14b('0x41')][_0xb14b('0x52')]?_0x297f36[_0xb14b('0x41')]:_0x59e545[_0xb14b('0x3c')];if(_0xd21383[_0xb14b('0x3d')][_0xb14b('0x4d')]){_0x297f36[_0xb14b('0x53')]=[{'all':!![]}];}_0x297f36=_[_0xb14b('0x48')]({},_0x297f36,_0xd21383[_0xb14b('0x4b')]);return db[_0xb14b('0x37')][_0xb14b('0x54')](_0x297f36)[_0xb14b('0x1c')](handleEntityNotFound(_0x26d080,null))['then'](respondWithResult(_0x26d080,null))['catch'](handleError(_0x26d080,null));};exports[_0xb14b('0x55')]=function(_0x22f817,_0x363662){return db['VtigerAccount'][_0xb14b('0x55')](_0x22f817[_0xb14b('0x56')],{})[_0xb14b('0x1c')](respondWithResult(_0x363662,0xc9))[_0xb14b('0x27')](handleError(_0x363662,null));};exports['update']=function(_0x17fc22,_0x1dc291){if(_0x17fc22['body']['id']){delete _0x17fc22[_0xb14b('0x56')]['id'];}return db[_0xb14b('0x37')][_0xb14b('0x54')]({'where':{'id':_0x17fc22[_0xb14b('0x57')]['id']}})[_0xb14b('0x1c')](handleEntityNotFound(_0x1dc291,null))['then'](saveUpdates(_0x17fc22[_0xb14b('0x56')],null))[_0xb14b('0x1c')](respondWithResult(_0x1dc291,null))[_0xb14b('0x27')](handleError(_0x1dc291,null));};exports[_0xb14b('0x31')]=function(_0xa2d074,_0xb48d3a){return db[_0xb14b('0x37')][_0xb14b('0x54')]({'where':{'id':_0xa2d074[_0xb14b('0x57')]['id']}})[_0xb14b('0x1c')](handleEntityNotFound(_0xb48d3a,null))[_0xb14b('0x1c')](removeEntity(_0xb48d3a,null))[_0xb14b('0x27')](handleError(_0xb48d3a,null));};exports[_0xb14b('0x58')]=function(_0x504da1,_0xf8d3fc,_0x20d118){var _0x4376b6={};var _0x5de9b4={};var _0x29bea3;var _0x291953;return db['VtigerAccount']['findOne']({'where':{'id':_0x504da1[_0xb14b('0x57')]['id']}})['then'](handleEntityNotFound(_0xf8d3fc,null))[_0xb14b('0x1c')](function(_0x41723a){if(_0x41723a){_0x29bea3=_0x41723a;_0x5de9b4[_0xb14b('0x3c')]=_[_0xb14b('0x3e')](db['VtigerConfiguration'][_0xb14b('0x38')]);_0x5de9b4[_0xb14b('0x3d')]=_[_0xb14b('0x3e')](_0x504da1[_0xb14b('0x3d')]);_0x5de9b4[_0xb14b('0x3f')]=_[_0xb14b('0x40')](_0x5de9b4['model'],_0x5de9b4[_0xb14b('0x3d')]);_0x4376b6[_0xb14b('0x41')]=_[_0xb14b('0x40')](_0x5de9b4[_0xb14b('0x3c')],qs[_0xb14b('0x42')](_0x504da1[_0xb14b('0x3d')][_0xb14b('0x42')]));_0x4376b6[_0xb14b('0x41')]=_0x4376b6[_0xb14b('0x41')]['length']?_0x4376b6[_0xb14b('0x41')]:_0x5de9b4[_0xb14b('0x3c')];_0x4376b6['order']=qs[_0xb14b('0x45')](_0x504da1[_0xb14b('0x3d')][_0xb14b('0x45')]);_0x4376b6[_0xb14b('0x46')]=qs[_0xb14b('0x3f')](_[_0xb14b('0x59')](_0x504da1['query'],_0x5de9b4[_0xb14b('0x3f')]));if(_0x504da1[_0xb14b('0x3d')][_0xb14b('0x47')]){_0x4376b6['where']=_[_0xb14b('0x48')](_0x4376b6[_0xb14b('0x46')],{'$or':_['map'](_0x4376b6[_0xb14b('0x41')],function(_0x4b751b){var _0x501d9c={};_0x501d9c[_0x4b751b]={'$like':'%'+_0x504da1[_0xb14b('0x3d')][_0xb14b('0x47')]+'%'};return _0x501d9c;})});}_0x4376b6=_[_0xb14b('0x48')]({},_0x4376b6,_0x504da1[_0xb14b('0x4b')]);return _0x29bea3[_0xb14b('0x58')](_0x4376b6);}})['then'](function(_0x458c12){if(_0x458c12){_0x291953=_0x458c12[_0xb14b('0x52')];if(!_0x504da1[_0xb14b('0x3d')]['hasOwnProperty'](_0xb14b('0x5a'))){_0x4376b6['limit']=qs[_0xb14b('0x2b')](_0x504da1[_0xb14b('0x3d')][_0xb14b('0x2b')]);_0x4376b6[_0xb14b('0x2a')]=qs[_0xb14b('0x2a')](_0x504da1[_0xb14b('0x3d')][_0xb14b('0x2a')]);}return _0x29bea3[_0xb14b('0x58')](_0x4376b6);}})[_0xb14b('0x1c')](function(_0x260957){if(_0x260957){return _0x260957?{'count':_0x291953,'rows':_0x260957}:null;}})[_0xb14b('0x1c')](respondWithResult(_0xf8d3fc,null))[_0xb14b('0x27')](handleError(_0xf8d3fc,null));};exports['addConfiguration']=function(_0x57df0f,_0x2fb629,_0x24fe53){if(_0x57df0f[_0xb14b('0x56')]['id']){delete _0x57df0f[_0xb14b('0x56')]['id'];}return db[_0xb14b('0x37')][_0xb14b('0x5b')]({'where':{'id':_0x57df0f[_0xb14b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fb629,null))['then'](function(_0x38fe24){if(_0x38fe24){_0x57df0f[_0xb14b('0x56')][_0xb14b('0x5c')]=_0x38fe24['id'];_0x57df0f['body'][_0xb14b('0x5d')]=integrations[_0xb14b('0x5e')](_0x57df0f[_0xb14b('0x56')][_0xb14b('0x5f')],_0x57df0f['body'][_0xb14b('0x3a')]);_0x57df0f[_0xb14b('0x56')][_0xb14b('0x60')]=integrations[_0xb14b('0x61')](_0x57df0f['body'][_0xb14b('0x5f')],_0x57df0f[_0xb14b('0x56')][_0xb14b('0x3a')]);return db[_0xb14b('0x62')][_0xb14b('0x55')](_0x57df0f['body'],{'include':[{'model':db[_0xb14b('0x63')],'as':_0xb14b('0x5d')},{'model':db[_0xb14b('0x63')],'as':_0xb14b('0x60')}]});}return null;})[_0xb14b('0x1c')](respondWithResult(_0x2fb629,null))[_0xb14b('0x27')](handleError(_0x2fb629,null));};var md5=require(_0xb14b('0x64'));exports[_0xb14b('0x65')]=function(_0x1f0a57,_0x18c162,_0x27c8c4){var _0x37a1de=null;var _0x28eda2=null;var _0x141376=null;var _0x3a14c1=null;var _0x2c4455='';return db[_0xb14b('0x37')][_0xb14b('0x5b')]({'where':{'id':_0x1f0a57[_0xb14b('0x57')]['id']},'attributes':['id',_0xb14b('0x34'),_0xb14b('0x66'),_0xb14b('0x67'),_0xb14b('0x68'),'remoteUri',_0xb14b('0x69'),'accessKey']})[_0xb14b('0x1c')](handleEntityNotFound(_0x18c162,null))[_0xb14b('0x1c')](function(_0x571afe){if(_0x571afe){_0x37a1de=_0x571afe['username'];_0x28eda2=_0x571afe['accessKey'];_0x141376=_0x571afe[_0xb14b('0x68')];_0x2c4455=_0x571afe['remoteUri'];var _0x100d78=_0x2c4455['slice'](-0x1);if(_0x100d78==='/'){_0x2c4455=_0x2c4455[_0xb14b('0x6a')](0x0,_0x2c4455['lastIndexOf'](_0x100d78));}_0x3a14c1=util[_0xb14b('0x6b')](_0xb14b('0x6c'),_0x2c4455);var _0x4caf86={'method':_0xb14b('0x6d'),'uri':_0x3a14c1,'qs':{'operation':_0xb14b('0x6e'),'username':_0x571afe[_0xb14b('0x66')]},'json':!![]};return rp(_0x4caf86);}})[_0xb14b('0x1c')](function(_0x4b00f2){if(_0x4b00f2[_0xb14b('0x6f')]){var _0x2ae5fa={'method':_0xb14b('0x70'),'uri':_0x3a14c1,'form':{'operation':_0xb14b('0x71'),'username':_0x37a1de,'accessKey':md5(_0x4b00f2['result']['token']+_0x28eda2)},'json':!![]};return rp(_0x2ae5fa);}})[_0xb14b('0x1c')](function(_0x594ee9){if(_0x594ee9[_0xb14b('0x6f')]){var _0x60e5f1={'method':'GET','uri':_0x3a14c1,'qs':{'operation':_0xb14b('0x72'),'username':_0x37a1de,'sessionName':_0x594ee9['result'][_0xb14b('0x73')],'elementType':_0x141376},'json':!![]};return rp(_0x60e5f1);}})[_0xb14b('0x1c')](function(_0x3a9eef){if(_0x3a9eef[_0xb14b('0x6f')]){var _0x16dc55=[_0xb14b('0x74'),_0xb14b('0x75'),_0xb14b('0x76')];_['remove'](_0x3a9eef[_0xb14b('0x26')][_0xb14b('0x42')],function(_0x230f2c){return _0x16dc55[_0xb14b('0x77')](_0x230f2c[_0xb14b('0x3a')]['name']);});_['remove'](_0x3a9eef[_0xb14b('0x26')]['fields'],function(_0x4a50bb){return _0x4a50bb[_0xb14b('0x78')]===_0xb14b('0x79');});return{'count':_0x3a9eef[_0xb14b('0x26')][_0xb14b('0x42')][_0xb14b('0x52')],'rows':_[_0xb14b('0x49')](_0x3a9eef[_0xb14b('0x26')][_0xb14b('0x42')],function(_0x2156ae){return{'id':_0x2156ae['name'],'name':_0x2156ae['label'],'custom':_[_0xb14b('0x7a')](_0x2156ae[_0xb14b('0x34')],_0xb14b('0x7b'))?!![]:![],'options':_0x2156ae[_0xb14b('0x3a')][_0xb14b('0x34')]===_0xb14b('0x7c')&&_0x2156ae[_0xb14b('0x3a')]['picklistValues']['length']>0x0?_['map'](_0x2156ae[_0xb14b('0x3a')]['picklistValues'],function(_0x3d38ce){return{'name':_0x3d38ce[_0xb14b('0x7d')],'value':_0x3d38ce[_0xb14b('0x7e')]};}):[]};})};}})[_0xb14b('0x1c')](respondWithResult(_0x18c162,null))[_0xb14b('0x27')](function(_0x222b88){console[_0xb14b('0x7f')]('vTiger\x20error:\x20'+_0x222b88);var _0x57da61=_0x1f0a57[_0xb14b('0x3d')][_0xb14b('0x80')]?0x1f4:_0x222b88['statusCode']||0x1f4;logger['error'](_0xb14b('0x81'),_0xb14b('0x65'),_0x57da61,JSON[_0xb14b('0x21')](_0x222b88));delete _0x222b88[_0xb14b('0x34')];if(_0x57da61===0x191){_0x57da61=0x190;}_0x18c162[_0xb14b('0x28')](_0x57da61)[_0xb14b('0x35')](_0x1f0a57[_0xb14b('0x3d')][_0xb14b('0x80')]?{'message':_0xb14b('0x82'),'statusCode':_0x222b88[_0xb14b('0x83')]}:_0x222b88);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2d605d4..fede0ca 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 _0x6807=['define','../../config/logger','moment','bluebird','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6807,0x76));var _0x7680=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x6807[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7680('0x0'))('api');var moment=require(_0x7680('0x1'));var BPromise=require(_0x7680('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7680('0x3'));var rimraf=require('rimraf');var config=require(_0x7680('0x4'));var attributes=require(_0x7680('0x5'));var integrations=require(_0x7680('0x6'));module[_0x7680('0x7')]=function(_0x306301,_0x558010){return _0x306301[_0x7680('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52af=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x4ee7f9,_0x52d617){var _0x52daf3=function(_0xe9696b){while(--_0xe9696b){_0x4ee7f9['push'](_0x4ee7f9['shift']());}};_0x52daf3(++_0x52d617);}(_0x52af,0x66));var _0xf52a=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x52af[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xf52a('0x0'));var util=require(_0xf52a('0x1'));var logger=require(_0xf52a('0x2'))(_0xf52a('0x3'));var moment=require(_0xf52a('0x4'));var BPromise=require(_0xf52a('0x5'));var rp=require(_0xf52a('0x6'));var fs=require('fs');var path=require(_0xf52a('0x7'));var rimraf=require(_0xf52a('0x8'));var config=require(_0xf52a('0x9'));var attributes=require(_0xf52a('0xa'));var integrations=require(_0xf52a('0xb'));module[_0xf52a('0xc')]=function(_0x2a9d58,_0x2117bd){return _0x2a9d58[_0xf52a('0xd')]('VtigerAccount',attributes,{'tableName':_0xf52a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 293f0d7..9f35ecf 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 _0x487c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','util','moment'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x487c,0x7e));var _0xc487=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x487c[_0x38a7ac];return _0x53061a;};'use strict';var _=require('lodash');var util=require(_0xc487('0x0'));var moment=require(_0xc487('0x1'));var BPromise=require('bluebird');var rs=require(_0xc487('0x2'));var fs=require('fs');var Redis=require(_0xc487('0x3'));var db=require(_0xc487('0x4'))['db'];var utils=require(_0xc487('0x5'));var logger=require(_0xc487('0x6'))('rpc');var config=require(_0xc487('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a16cc,_0x13299e,_0x2b7b8e){return new BPromise(function(_0xe04d33,_0x1c7a88){return client[_0xc487('0x8')](_0x1a16cc,_0x2b7b8e)[_0xc487('0x9')](function(_0x3dccd0){logger[_0xc487('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x13299e,_0xc487('0xb'));logger[_0xc487('0xc')](_0xc487('0xd'),_0x13299e,_0xc487('0xb'),JSON[_0xc487('0xe')](_0x3dccd0));if(_0x3dccd0['error']){if(_0x3dccd0[_0xc487('0xf')][_0xc487('0x10')]===0x1f4){logger[_0xc487('0xf')](_0xc487('0x11'),_0x13299e,_0x3dccd0[_0xc487('0xf')]['message']);return _0x1c7a88(_0x3dccd0['error'][_0xc487('0x12')]);}logger[_0xc487('0xf')](_0xc487('0x11'),_0x13299e,_0x3dccd0['error'][_0xc487('0x12')]);return _0xe04d33(_0x3dccd0['error'][_0xc487('0x12')]);}else{logger['info'](_0xc487('0x11'),_0x13299e,_0xc487('0xb'));_0xe04d33(_0x3dccd0['result']['message']);}})[_0xc487('0x13')](function(_0x1fb99e){logger['error'](_0xc487('0x11'),_0x13299e,_0x1fb99e);_0x1c7a88(_0x1fb99e);});});}exports[_0xc487('0x14')]=function(_0x4d4e1c){var _0x3928c6=this;return new Promise(function(_0x5e3968,_0xd97030){return db[_0xc487('0x15')][_0xc487('0x16')]({'raw':_0x4d4e1c[_0xc487('0x17')]?_0x4d4e1c[_0xc487('0x17')][_0xc487('0x18')]===undefined?!![]:![]:!![],'where':_0x4d4e1c[_0xc487('0x17')]?_0x4d4e1c[_0xc487('0x17')][_0xc487('0x19')]||null:null,'attributes':_0x4d4e1c[_0xc487('0x17')]?_0x4d4e1c[_0xc487('0x17')][_0xc487('0x1a')]||null:null,'limit':_0x4d4e1c['options']?_0x4d4e1c[_0xc487('0x17')][_0xc487('0x1b')]||null:null,'include':_0x4d4e1c[_0xc487('0x17')]?_0x4d4e1c[_0xc487('0x17')][_0xc487('0x1c')]?_[_0xc487('0x1d')](_0x4d4e1c[_0xc487('0x17')][_0xc487('0x1c')],function(_0xc699c5){return{'model':db[_0xc699c5[_0xc487('0x1e')]],'as':_0xc699c5['as'],'attributes':_0xc699c5[_0xc487('0x1a')],'include':_0xc699c5[_0xc487('0x1c')]?_[_0xc487('0x1d')](_0xc699c5[_0xc487('0x1c')],function(_0x10e3f6){return{'model':db[_0x10e3f6[_0xc487('0x1e')]],'as':_0x10e3f6['as'],'attributes':_0x10e3f6[_0xc487('0x1a')],'include':_0x10e3f6['include']?_['map'](_0x10e3f6[_0xc487('0x1c')],function(_0x40bc93){return{'model':db[_0x40bc93['model']],'as':_0x40bc93['as'],'attributes':_0x40bc93[_0xc487('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc487('0x9')](function(_0x134ad3){logger[_0xc487('0xa')]('GetVtigerAccount',_0x4d4e1c);logger[_0xc487('0xc')](_0xc487('0x14'),_0x4d4e1c,JSON['stringify'](_0x134ad3));_0x5e3968(_0x134ad3);})[_0xc487('0x13')](function(_0x4a27da){logger[_0xc487('0xf')](_0xc487('0x14'),_0x4a27da[_0xc487('0x12')],_0x4d4e1c);_0xd97030(_0x3928c6[_0xc487('0xf')](0x1f4,_0x4a27da[_0xc487('0x12')]));});});};exports[_0xc487('0x1f')]=function(_0x2b5203){var _0x32a914=this;return new Promise(function(_0x68a7a7,_0x1d4f4d){return db['VtigerAccount']['find']({'raw':_0x2b5203[_0xc487('0x17')]?_0x2b5203['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b5203['options']?_0x2b5203[_0xc487('0x17')][_0xc487('0x19')]||null:null,'attributes':_0x2b5203[_0xc487('0x17')]?_0x2b5203[_0xc487('0x17')][_0xc487('0x1a')]||null:null,'include':_0x2b5203[_0xc487('0x17')]?_0x2b5203['options']['include']?_['map'](_0x2b5203[_0xc487('0x17')]['include'],function(_0x49adc9){return{'model':db[_0x49adc9[_0xc487('0x1e')]],'as':_0x49adc9['as'],'attributes':_0x49adc9['attributes'],'include':_0x49adc9[_0xc487('0x1c')]?_[_0xc487('0x1d')](_0x49adc9['include'],function(_0x505f77){return{'model':db[_0x505f77[_0xc487('0x1e')]],'as':_0x505f77['as'],'attributes':_0x505f77['attributes'],'include':_0x505f77[_0xc487('0x1c')]?_['map'](_0x505f77[_0xc487('0x1c')],function(_0x5e21b5){return{'model':db[_0x5e21b5[_0xc487('0x1e')]],'as':_0x5e21b5['as'],'attributes':_0x5e21b5[_0xc487('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc487('0x9')](function(_0x2e8935){logger[_0xc487('0xa')]('ShowVtigerAccount',_0x2b5203);logger[_0xc487('0xc')](_0xc487('0x1f'),_0x2b5203,JSON[_0xc487('0xe')](_0x2e8935));_0x68a7a7(_0x2e8935);})[_0xc487('0x13')](function(_0x2152ee){logger[_0xc487('0xf')](_0xc487('0x1f'),_0x2152ee[_0xc487('0x12')],_0x2b5203);_0x1d4f4d(_0x32a914[_0xc487('0xf')](0x1f4,_0x2152ee[_0xc487('0x12')]));});});}; \ No newline at end of file +var _0x8587=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','limit','map','include','model','attributes','raw','ShowVtigerAccount','lodash','util'];(function(_0x38f7fd,_0x34a05c){var _0x3c463b=function(_0x39aaf9){while(--_0x39aaf9){_0x38f7fd['push'](_0x38f7fd['shift']());}};_0x3c463b(++_0x34a05c);}(_0x8587,0x1e8));var _0x7858=function(_0x80b870,_0x22a8bd){_0x80b870=_0x80b870-0x0;var _0x2dbba5=_0x8587[_0x80b870];return _0x2dbba5;};'use strict';var _=require(_0x7858('0x0'));var util=require(_0x7858('0x1'));var moment=require(_0x7858('0x2'));var BPromise=require(_0x7858('0x3'));var rs=require(_0x7858('0x4'));var fs=require('fs');var Redis=require(_0x7858('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7858('0x6'));var logger=require(_0x7858('0x7'))(_0x7858('0x8'));var config=require(_0x7858('0x9'));var jayson=require(_0x7858('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1734e6,_0x3fe7f0,_0x5c4061){return new BPromise(function(_0x5663c7,_0x1f51b9){return client[_0x7858('0xb')](_0x1734e6,_0x5c4061)[_0x7858('0xc')](function(_0x4fa2a5){logger[_0x7858('0xd')](_0x7858('0xe'),_0x3fe7f0,_0x7858('0xf'));logger[_0x7858('0x10')](_0x7858('0x11'),_0x3fe7f0,'request\x20sent',JSON[_0x7858('0x12')](_0x4fa2a5));if(_0x4fa2a5[_0x7858('0x13')]){if(_0x4fa2a5[_0x7858('0x13')]['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x3fe7f0,_0x4fa2a5[_0x7858('0x13')][_0x7858('0x14')]);return _0x1f51b9(_0x4fa2a5[_0x7858('0x13')][_0x7858('0x14')]);}logger[_0x7858('0x13')](_0x7858('0xe'),_0x3fe7f0,_0x4fa2a5[_0x7858('0x13')][_0x7858('0x14')]);return _0x5663c7(_0x4fa2a5[_0x7858('0x13')][_0x7858('0x14')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x3fe7f0,_0x7858('0xf'));_0x5663c7(_0x4fa2a5[_0x7858('0x15')]['message']);}})[_0x7858('0x16')](function(_0x368cf1){logger[_0x7858('0x13')](_0x7858('0xe'),_0x3fe7f0,_0x368cf1);_0x1f51b9(_0x368cf1);});});}exports[_0x7858('0x17')]=function(_0x332e31){var _0x136a8f=this;return new Promise(function(_0x159189,_0x215cd9){return db[_0x7858('0x18')][_0x7858('0x19')]({'raw':_0x332e31['options']?_0x332e31[_0x7858('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x332e31[_0x7858('0x1a')]?_0x332e31[_0x7858('0x1a')][_0x7858('0x1b')]||null:null,'attributes':_0x332e31[_0x7858('0x1a')]?_0x332e31[_0x7858('0x1a')]['attributes']||null:null,'limit':_0x332e31['options']?_0x332e31[_0x7858('0x1a')][_0x7858('0x1c')]||null:null,'include':_0x332e31[_0x7858('0x1a')]?_0x332e31[_0x7858('0x1a')]['include']?_[_0x7858('0x1d')](_0x332e31[_0x7858('0x1a')][_0x7858('0x1e')],function(_0x234576){return{'model':db[_0x234576[_0x7858('0x1f')]],'as':_0x234576['as'],'attributes':_0x234576['attributes'],'include':_0x234576[_0x7858('0x1e')]?_[_0x7858('0x1d')](_0x234576[_0x7858('0x1e')],function(_0x28653b){return{'model':db[_0x28653b['model']],'as':_0x28653b['as'],'attributes':_0x28653b[_0x7858('0x20')],'include':_0x28653b[_0x7858('0x1e')]?_[_0x7858('0x1d')](_0x28653b[_0x7858('0x1e')],function(_0x539956){return{'model':db[_0x539956[_0x7858('0x1f')]],'as':_0x539956['as'],'attributes':_0x539956[_0x7858('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47ddaf){logger[_0x7858('0xd')]('GetVtigerAccount',_0x332e31);logger[_0x7858('0x10')](_0x7858('0x17'),_0x332e31,JSON[_0x7858('0x12')](_0x47ddaf));_0x159189(_0x47ddaf);})['catch'](function(_0x56f2ad){logger[_0x7858('0x13')](_0x7858('0x17'),_0x56f2ad['message'],_0x332e31);_0x215cd9(_0x136a8f[_0x7858('0x13')](0x1f4,_0x56f2ad[_0x7858('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x42d4e2){var _0x27536d=this;return new Promise(function(_0x2b8b1d,_0x569ff0){return db[_0x7858('0x18')]['find']({'raw':_0x42d4e2[_0x7858('0x1a')]?_0x42d4e2[_0x7858('0x1a')][_0x7858('0x21')]===undefined?!![]:![]:!![],'where':_0x42d4e2[_0x7858('0x1a')]?_0x42d4e2[_0x7858('0x1a')][_0x7858('0x1b')]||null:null,'attributes':_0x42d4e2[_0x7858('0x1a')]?_0x42d4e2['options'][_0x7858('0x20')]||null:null,'include':_0x42d4e2[_0x7858('0x1a')]?_0x42d4e2[_0x7858('0x1a')][_0x7858('0x1e')]?_['map'](_0x42d4e2['options'][_0x7858('0x1e')],function(_0x1f06e1){return{'model':db[_0x1f06e1['model']],'as':_0x1f06e1['as'],'attributes':_0x1f06e1[_0x7858('0x20')],'include':_0x1f06e1[_0x7858('0x1e')]?_[_0x7858('0x1d')](_0x1f06e1[_0x7858('0x1e')],function(_0x2b7227){return{'model':db[_0x2b7227[_0x7858('0x1f')]],'as':_0x2b7227['as'],'attributes':_0x2b7227[_0x7858('0x20')],'include':_0x2b7227[_0x7858('0x1e')]?_[_0x7858('0x1d')](_0x2b7227[_0x7858('0x1e')],function(_0x2d0778){return{'model':db[_0x2d0778[_0x7858('0x1f')]],'as':_0x2d0778['as'],'attributes':_0x2d0778['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5823bd){logger['info'](_0x7858('0x22'),_0x42d4e2);logger[_0x7858('0x10')]('ShowVtigerAccount',_0x42d4e2,JSON[_0x7858('0x12')](_0x5823bd));_0x2b8b1d(_0x5823bd);})['catch'](function(_0x91053d){logger[_0x7858('0x13')](_0x7858('0x22'),_0x91053d[_0x7858('0x14')],_0x42d4e2);_0x569ff0(_0x27536d[_0x7858('0x13')](0x1f4,_0x91053d[_0x7858('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 5714662..9cc1a90 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(_0x282bc3,_0x544bbe){var _0x54aee4=function(_0x217466){while(--_0x217466){_0x282bc3['push'](_0x282bc3['shift']());}};_0x54aee4(++_0x544bbe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x53915d,_0x1daa70){_0x53915d=_0x53915d-0x0;var _0x11e040=_0x5f2f[_0x53915d];return _0x11e040;};'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(_0x23c6c6,_0x2de1e){var _0x483b11=function(_0x2e83b3){while(--_0x2e83b3){_0x23c6c6['push'](_0x23c6c6['shift']());}};_0x483b11(++_0x2de1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a5e11,_0x346470){_0x3a5e11=_0x3a5e11-0x0;var _0x2ca2ba=_0xb10b[_0x3a5e11];return _0x2ca2ba;};'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 d89cd46..2379528 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 _0xd7e6=['STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd7e6,0x1bd));var _0x6d7e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd7e6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6d7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d7e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3fd4=['sequelize','exports','STRING'];(function(_0xd5255f,_0x225f0e){var _0x32123f=function(_0x26ea3b){while(--_0x26ea3b){_0xd5255f['push'](_0xd5255f['shift']());}};_0x32123f(++_0x225f0e);}(_0x3fd4,0xb4));var _0x43fd=function(_0x426939,_0x3e29ed){_0x426939=_0x426939-0x0;var _0x5e2d74=_0x3fd4[_0x426939];return _0x5e2d74;};'use strict';var Sequelize=require(_0x43fd('0x0'));module[_0x43fd('0x1')]={'name':{'type':Sequelize[_0x43fd('0x2')]},'description':{'type':Sequelize[_0x43fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index ecc5111..7a75d75 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 _0xae36=['create','body','getFields','findOne','VtigerField','length','sort','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','VtigerConfiguration','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','filtears','find'];(function(_0x385b70,_0x52974f){var _0x33e2ef=function(_0x273ee9){while(--_0x273ee9){_0x385b70['push'](_0x385b70['shift']());}};_0x33e2ef(++_0x52974f);}(_0xae36,0x1c2));var _0x6ae3=function(_0x525158,_0x125f09){_0x525158=_0x525158-0x0;var _0x1825d3=_0xae36[_0x525158];return _0x1825d3;};'use strict';var pdf=require(_0x6ae3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ae3('0x1'));var zipdir=require(_0x6ae3('0x2'));var jsonpatch=require(_0x6ae3('0x3'));var rp=require(_0x6ae3('0x4'));var moment=require(_0x6ae3('0x5'));var BPromise=require(_0x6ae3('0x6'));var Mustache=require(_0x6ae3('0x7'));var util=require(_0x6ae3('0x8'));var path=require(_0x6ae3('0x9'));var sox=require(_0x6ae3('0xa'));var csv=require('to-csv');var ejs=require(_0x6ae3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ae3('0xc'));var crypto=require('crypto');var jsforce=require(_0x6ae3('0xd'));var deskjs=require(_0x6ae3('0xe'));var toCsv=require(_0x6ae3('0xf'));var querystring=require(_0x6ae3('0x10'));var Papa=require('papaparse');var Redis=require(_0x6ae3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6ae3('0x12'));var hardwareService=require(_0x6ae3('0x13'));var logger=require('../../config/logger')(_0x6ae3('0x14'));var utils=require('../../config/utils');var config=require(_0x6ae3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6ae3('0x16')][_0x6ae3('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x357ab1,_0x9d7ecb,_0x1d546d,_0x46a67b){return new BPromise(function(_0x4fd5cb,_0x47bb5c){var _0x509303=_0x46a67b||client;return _0x509303['request'](_0x357ab1,_0x1d546d)['then'](function(_0x464704){logger[_0x6ae3('0x18')](_0x6ae3('0x19'),_0x9d7ecb,_0x6ae3('0x1a'));logger[_0x6ae3('0x1b')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x9d7ecb,'request\x20sent',JSON[_0x6ae3('0x1c')](_0x464704));if(_0x464704[_0x6ae3('0x1d')]){if(_0x464704[_0x6ae3('0x1d')][_0x6ae3('0x1e')]===0x1f4){logger[_0x6ae3('0x1d')](_0x6ae3('0x19'),_0x9d7ecb,_0x464704[_0x6ae3('0x1d')][_0x6ae3('0x1f')]);return _0x47bb5c(_0x464704[_0x6ae3('0x1d')][_0x6ae3('0x1f')]);}logger[_0x6ae3('0x1d')](_0x6ae3('0x19'),_0x9d7ecb,_0x464704['error'][_0x6ae3('0x1f')]);return _0x4fd5cb(_0x464704[_0x6ae3('0x1d')][_0x6ae3('0x1f')]);}else{logger[_0x6ae3('0x18')](_0x6ae3('0x19'),_0x9d7ecb,_0x6ae3('0x1a'));_0x4fd5cb(_0x464704['result'][_0x6ae3('0x1f')]);}})[_0x6ae3('0x20')](function(_0x4c04c2){logger[_0x6ae3('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x9d7ecb,_0x4c04c2);_0x47bb5c(_0x4c04c2);});});}function respondWithStatusCode(_0x57c029,_0x1aa820){_0x1aa820=_0x1aa820||0xcc;return function(_0xcd7226){if(_0xcd7226){return _0x57c029[_0x6ae3('0x21')](_0x1aa820);}return _0x57c029['status'](_0x1aa820)[_0x6ae3('0x22')]();};}function respondWithResult(_0x5a6c26,_0x5cc1f2){_0x5cc1f2=_0x5cc1f2||0xc8;return function(_0xe7e56d){if(_0xe7e56d){return _0x5a6c26[_0x6ae3('0x23')](_0x5cc1f2)[_0x6ae3('0x24')](_0xe7e56d);}};}function respondWithFilteredResult(_0x428c3a,_0x1d86a7){return function(_0x173f5d){if(_0x173f5d){var _0x3ae570=_0x173f5d[_0x6ae3('0x25')],_0xd9a4d6=_0x1d86a7[_0x6ae3('0x26')],_0x4420c3=_0x1d86a7[_0x6ae3('0x26')]+_0x1d86a7[_0x6ae3('0x27')],_0x5e639f;if(_0x4420c3>=_0x3ae570){_0x4420c3=_0x3ae570;_0x5e639f=0xc8;}else{_0x5e639f=0xce;}_0x428c3a['status'](_0x5e639f);return _0x428c3a[_0x6ae3('0x28')](_0x6ae3('0x29'),_0xd9a4d6+'-'+_0x4420c3+'/'+_0x3ae570)[_0x6ae3('0x24')](_0x173f5d);}return null;};}function patchUpdates(_0x87487e){return function(_0x5efc18){try{jsonpatch[_0x6ae3('0x2a')](_0x5efc18,_0x87487e,!![]);}catch(_0x352934){return BPromise[_0x6ae3('0x2b')](_0x352934);}return _0x5efc18[_0x6ae3('0x2c')]();};}function saveUpdates(_0x461c58,_0x375046){return function(_0x2d0daf){if(_0x2d0daf){return _0x2d0daf[_0x6ae3('0x2d')](_0x461c58)[_0x6ae3('0x2e')](function(_0x3bca86){return _0x3bca86;});}return null;};}function removeEntity(_0x3814e2,_0x19d7a6){return function(_0x3d3bfb){if(_0x3d3bfb){return _0x3d3bfb[_0x6ae3('0x2f')]()[_0x6ae3('0x2e')](function(){_0x3814e2[_0x6ae3('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb203,_0x52a371){return function(_0x2caacd){if(!_0x2caacd){_0x1fb203['sendStatus'](0x194);}return _0x2caacd;};}function handleError(_0x31a20b,_0x2322db){_0x2322db=_0x2322db||0x1f4;return function(_0x31db6c){logger[_0x6ae3('0x1d')](_0x31db6c['stack']);if(_0x31db6c[_0x6ae3('0x30')]){delete _0x31db6c[_0x6ae3('0x30')];}_0x31a20b[_0x6ae3('0x23')](_0x2322db)[_0x6ae3('0x31')](_0x31db6c);};}exports[_0x6ae3('0x32')]=function(_0x590b99,_0x4e99fc){var _0x114e73={},_0x284a4c={},_0x39b5f3={'count':0x0,'rows':[]};var _0x34e120=_['map'](db[_0x6ae3('0x33')][_0x6ae3('0x34')],function(_0x447f29){return{'name':_0x447f29['fieldName'],'type':_0x447f29[_0x6ae3('0x35')][_0x6ae3('0x36')]};});_0x284a4c[_0x6ae3('0x37')]=_[_0x6ae3('0x38')](_0x34e120,'name');_0x284a4c[_0x6ae3('0x39')]=_[_0x6ae3('0x3a')](_0x590b99[_0x6ae3('0x39')]);_0x284a4c['filters']=_[_0x6ae3('0x3b')](_0x284a4c[_0x6ae3('0x37')],_0x284a4c[_0x6ae3('0x39')]);_0x114e73[_0x6ae3('0x3c')]=_[_0x6ae3('0x3b')](_0x284a4c[_0x6ae3('0x37')],qs[_0x6ae3('0x3d')](_0x590b99[_0x6ae3('0x39')][_0x6ae3('0x3d')]));_0x114e73[_0x6ae3('0x3c')]=_0x114e73['attributes']['length']?_0x114e73['attributes']:_0x284a4c[_0x6ae3('0x37')];if(!_0x590b99[_0x6ae3('0x39')][_0x6ae3('0x3e')](_0x6ae3('0x3f'))){_0x114e73['limit']=qs[_0x6ae3('0x27')](_0x590b99[_0x6ae3('0x39')]['limit']);_0x114e73['offset']=qs[_0x6ae3('0x26')](_0x590b99[_0x6ae3('0x39')][_0x6ae3('0x26')]);}_0x114e73[_0x6ae3('0x40')]=qs['sort'](_0x590b99[_0x6ae3('0x39')]['sort']);_0x114e73[_0x6ae3('0x41')]=qs[_0x6ae3('0x42')](_['pick'](_0x590b99[_0x6ae3('0x39')],_0x284a4c[_0x6ae3('0x42')]),_0x34e120);if(_0x590b99[_0x6ae3('0x39')][_0x6ae3('0x43')]){_0x114e73[_0x6ae3('0x41')]=_[_0x6ae3('0x44')](_0x114e73['where'],{'$or':_[_0x6ae3('0x38')](_0x34e120,function(_0x26e4ff){if(_0x26e4ff[_0x6ae3('0x35')]!==_0x6ae3('0x45')){var _0x4b5667={};_0x4b5667[_0x26e4ff[_0x6ae3('0x30')]]={'$like':'%'+_0x590b99[_0x6ae3('0x39')]['filter']+'%'};return _0x4b5667;}})});}_0x114e73=_[_0x6ae3('0x44')]({},_0x114e73,_0x590b99[_0x6ae3('0x46')]);var _0x4e844f={'where':_0x114e73['where']};return db[_0x6ae3('0x33')][_0x6ae3('0x25')](_0x4e844f)[_0x6ae3('0x2e')](function(_0x2f7614){_0x39b5f3[_0x6ae3('0x25')]=_0x2f7614;if(_0x590b99[_0x6ae3('0x39')][_0x6ae3('0x47')]){_0x114e73[_0x6ae3('0x48')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x6ae3('0x49')](_0x114e73);})[_0x6ae3('0x2e')](function(_0x3c6b49){_0x39b5f3[_0x6ae3('0x4a')]=_0x3c6b49;return _0x39b5f3;})['then'](respondWithFilteredResult(_0x4e99fc,_0x114e73))[_0x6ae3('0x20')](handleError(_0x4e99fc,null));};exports['show']=function(_0x2dad39,_0x355219){var _0x43ffd7={'raw':![],'where':{'id':_0x2dad39[_0x6ae3('0x4b')]['id']}},_0x194689={};_0x194689[_0x6ae3('0x37')]=_[_0x6ae3('0x3a')](db['VtigerConfiguration'][_0x6ae3('0x34')]);_0x194689[_0x6ae3('0x39')]=_['keys'](_0x2dad39[_0x6ae3('0x39')]);_0x194689[_0x6ae3('0x4c')]=_[_0x6ae3('0x3b')](_0x194689[_0x6ae3('0x37')],_0x194689[_0x6ae3('0x39')]);_0x43ffd7[_0x6ae3('0x3c')]=_[_0x6ae3('0x3b')](_0x194689[_0x6ae3('0x37')],qs[_0x6ae3('0x3d')](_0x2dad39['query'][_0x6ae3('0x3d')]));_0x43ffd7[_0x6ae3('0x3c')]=_0x43ffd7['attributes']['length']?_0x43ffd7[_0x6ae3('0x3c')]:_0x194689['model'];if(_0x2dad39['query']['includeAll']){_0x43ffd7[_0x6ae3('0x48')]=[{'all':!![]}];}_0x43ffd7=_[_0x6ae3('0x44')]({},_0x43ffd7,_0x2dad39[_0x6ae3('0x46')]);return db[_0x6ae3('0x33')][_0x6ae3('0x4d')](_0x43ffd7)[_0x6ae3('0x2e')](handleEntityNotFound(_0x355219,null))[_0x6ae3('0x2e')](respondWithResult(_0x355219,null))[_0x6ae3('0x20')](handleError(_0x355219,null));};exports[_0x6ae3('0x4e')]=function(_0x282fdd,_0x5911b7){return db[_0x6ae3('0x33')][_0x6ae3('0x4e')](_0x282fdd['body'],{})[_0x6ae3('0x2e')](respondWithResult(_0x5911b7,0xc9))['catch'](handleError(_0x5911b7,null));};exports[_0x6ae3('0x2d')]=function(_0x573921,_0x30be89){if(_0x573921[_0x6ae3('0x4f')]['id']){delete _0x573921[_0x6ae3('0x4f')]['id'];}return db[_0x6ae3('0x33')][_0x6ae3('0x4d')]({'where':{'id':_0x573921[_0x6ae3('0x4b')]['id']}})[_0x6ae3('0x2e')](handleEntityNotFound(_0x30be89,null))[_0x6ae3('0x2e')](saveUpdates(_0x573921[_0x6ae3('0x4f')],null))[_0x6ae3('0x2e')](respondWithResult(_0x30be89,null))[_0x6ae3('0x20')](handleError(_0x30be89,null));};exports[_0x6ae3('0x2f')]=function(_0x43be38,_0x2f4a63){return db['VtigerConfiguration'][_0x6ae3('0x4d')]({'where':{'id':_0x43be38['params']['id']}})['then'](handleEntityNotFound(_0x2f4a63,null))[_0x6ae3('0x2e')](removeEntity(_0x2f4a63,null))['catch'](handleError(_0x2f4a63,null));};exports[_0x6ae3('0x50')]=function(_0x2d1f0d,_0x37207a,_0x471f3b){var _0x1af077={};var _0xeb2773={};var _0x1d43db;var _0x2e9c80;return db[_0x6ae3('0x33')][_0x6ae3('0x51')]({'where':{'id':_0x2d1f0d[_0x6ae3('0x4b')]['id']}})[_0x6ae3('0x2e')](handleEntityNotFound(_0x37207a,null))[_0x6ae3('0x2e')](function(_0x7fabd6){if(_0x7fabd6){_0x1d43db=_0x7fabd6;_0xeb2773['model']=_[_0x6ae3('0x3a')](db[_0x6ae3('0x52')]['rawAttributes']);_0xeb2773[_0x6ae3('0x39')]=_[_0x6ae3('0x3a')](_0x2d1f0d[_0x6ae3('0x39')]);_0xeb2773[_0x6ae3('0x42')]=_['intersection'](_0xeb2773[_0x6ae3('0x37')],_0xeb2773[_0x6ae3('0x39')]);_0x1af077[_0x6ae3('0x3c')]=_[_0x6ae3('0x3b')](_0xeb2773[_0x6ae3('0x37')],qs[_0x6ae3('0x3d')](_0x2d1f0d['query']['fields']));_0x1af077[_0x6ae3('0x3c')]=_0x1af077[_0x6ae3('0x3c')][_0x6ae3('0x53')]?_0x1af077[_0x6ae3('0x3c')]:_0xeb2773[_0x6ae3('0x37')];_0x1af077['order']=qs[_0x6ae3('0x54')](_0x2d1f0d[_0x6ae3('0x39')][_0x6ae3('0x54')]);_0x1af077[_0x6ae3('0x41')]=qs[_0x6ae3('0x42')](_[_0x6ae3('0x55')](_0x2d1f0d[_0x6ae3('0x39')],_0xeb2773[_0x6ae3('0x42')]));if(_0x2d1f0d[_0x6ae3('0x39')][_0x6ae3('0x43')]){_0x1af077[_0x6ae3('0x41')]=_[_0x6ae3('0x44')](_0x1af077['where'],{'$or':_[_0x6ae3('0x38')](_0x1af077['attributes'],function(_0x4a8113){var _0x27d650={};_0x27d650[_0x4a8113]={'$like':'%'+_0x2d1f0d['query'][_0x6ae3('0x43')]+'%'};return _0x27d650;})});}_0x1af077=_[_0x6ae3('0x44')]({},_0x1af077,_0x2d1f0d[_0x6ae3('0x46')]);return _0x1d43db[_0x6ae3('0x50')](_0x1af077);}})[_0x6ae3('0x2e')](function(_0x157534){if(_0x157534){_0x2e9c80=_0x157534[_0x6ae3('0x53')];if(!_0x2d1f0d[_0x6ae3('0x39')][_0x6ae3('0x3e')]('nolimit')){_0x1af077[_0x6ae3('0x27')]=qs['limit'](_0x2d1f0d[_0x6ae3('0x39')][_0x6ae3('0x27')]);_0x1af077[_0x6ae3('0x26')]=qs['offset'](_0x2d1f0d['query']['offset']);}return _0x1d43db[_0x6ae3('0x50')](_0x1af077);}})['then'](function(_0x38a652){if(_0x38a652){return _0x38a652?{'count':_0x2e9c80,'rows':_0x38a652}:null;}})[_0x6ae3('0x2e')](respondWithResult(_0x37207a,null))[_0x6ae3('0x20')](handleError(_0x37207a,null));};exports['getSubjects']=function(_0x442b45,_0x1a69ad,_0x1f6f33){var _0x587f80={};var _0x243453={};var _0x1fed68;var _0x207392;return db[_0x6ae3('0x33')]['findOne']({'where':{'id':_0x442b45[_0x6ae3('0x4b')]['id']}})[_0x6ae3('0x2e')](handleEntityNotFound(_0x1a69ad,null))[_0x6ae3('0x2e')](function(_0x53d541){if(_0x53d541){_0x1fed68=_0x53d541;_0x243453['model']=_[_0x6ae3('0x3a')](db[_0x6ae3('0x52')][_0x6ae3('0x34')]);_0x243453[_0x6ae3('0x39')]=_[_0x6ae3('0x3a')](_0x442b45[_0x6ae3('0x39')]);_0x243453['filters']=_[_0x6ae3('0x3b')](_0x243453[_0x6ae3('0x37')],_0x243453[_0x6ae3('0x39')]);_0x587f80[_0x6ae3('0x3c')]=_['intersection'](_0x243453[_0x6ae3('0x37')],qs[_0x6ae3('0x3d')](_0x442b45[_0x6ae3('0x39')][_0x6ae3('0x3d')]));_0x587f80[_0x6ae3('0x3c')]=_0x587f80[_0x6ae3('0x3c')]['length']?_0x587f80[_0x6ae3('0x3c')]:_0x243453[_0x6ae3('0x37')];_0x587f80[_0x6ae3('0x40')]=qs[_0x6ae3('0x54')](_0x442b45[_0x6ae3('0x39')]['sort']);_0x587f80[_0x6ae3('0x41')]=qs[_0x6ae3('0x42')](_[_0x6ae3('0x55')](_0x442b45[_0x6ae3('0x39')],_0x243453['filters']));if(_0x442b45[_0x6ae3('0x39')]['filter']){_0x587f80[_0x6ae3('0x41')]=_[_0x6ae3('0x44')](_0x587f80[_0x6ae3('0x41')],{'$or':_[_0x6ae3('0x38')](_0x587f80[_0x6ae3('0x3c')],function(_0x38e2f9){var _0x52f880={};_0x52f880[_0x38e2f9]={'$like':'%'+_0x442b45[_0x6ae3('0x39')][_0x6ae3('0x43')]+'%'};return _0x52f880;})});}_0x587f80=_[_0x6ae3('0x44')]({},_0x587f80,_0x442b45[_0x6ae3('0x46')]);return _0x1fed68[_0x6ae3('0x56')](_0x587f80);}})[_0x6ae3('0x2e')](function(_0x549714){if(_0x549714){_0x207392=_0x549714[_0x6ae3('0x53')];if(!_0x442b45[_0x6ae3('0x39')][_0x6ae3('0x3e')](_0x6ae3('0x3f'))){_0x587f80[_0x6ae3('0x27')]=qs['limit'](_0x442b45[_0x6ae3('0x39')][_0x6ae3('0x27')]);_0x587f80[_0x6ae3('0x26')]=qs[_0x6ae3('0x26')](_0x442b45[_0x6ae3('0x39')][_0x6ae3('0x26')]);}return _0x1fed68[_0x6ae3('0x56')](_0x587f80);}})[_0x6ae3('0x2e')](function(_0x24ff8){if(_0x24ff8){return _0x24ff8?{'count':_0x207392,'rows':_0x24ff8}:null;}})['then'](respondWithResult(_0x1a69ad,null))[_0x6ae3('0x20')](handleError(_0x1a69ad,null));};exports['getDescriptions']=function(_0x1accef,_0x1c376d,_0x48923f){var _0x237a7e={};var _0x39ce8a={};var _0x301e60;var _0x234a69;return db[_0x6ae3('0x33')]['findOne']({'where':{'id':_0x1accef['params']['id']}})[_0x6ae3('0x2e')](handleEntityNotFound(_0x1c376d,null))[_0x6ae3('0x2e')](function(_0x242cae){if(_0x242cae){_0x301e60=_0x242cae;_0x39ce8a[_0x6ae3('0x37')]=_['keys'](db['VtigerField'][_0x6ae3('0x34')]);_0x39ce8a[_0x6ae3('0x39')]=_[_0x6ae3('0x3a')](_0x1accef[_0x6ae3('0x39')]);_0x39ce8a[_0x6ae3('0x42')]=_[_0x6ae3('0x3b')](_0x39ce8a['model'],_0x39ce8a[_0x6ae3('0x39')]);_0x237a7e[_0x6ae3('0x3c')]=_[_0x6ae3('0x3b')](_0x39ce8a['model'],qs['fields'](_0x1accef[_0x6ae3('0x39')][_0x6ae3('0x3d')]));_0x237a7e[_0x6ae3('0x3c')]=_0x237a7e[_0x6ae3('0x3c')]['length']?_0x237a7e['attributes']:_0x39ce8a[_0x6ae3('0x37')];_0x237a7e[_0x6ae3('0x40')]=qs[_0x6ae3('0x54')](_0x1accef['query'][_0x6ae3('0x54')]);_0x237a7e[_0x6ae3('0x41')]=qs[_0x6ae3('0x42')](_['pick'](_0x1accef[_0x6ae3('0x39')],_0x39ce8a[_0x6ae3('0x42')]));if(_0x1accef[_0x6ae3('0x39')]['filter']){_0x237a7e[_0x6ae3('0x41')]=_[_0x6ae3('0x44')](_0x237a7e[_0x6ae3('0x41')],{'$or':_[_0x6ae3('0x38')](_0x237a7e[_0x6ae3('0x3c')],function(_0x433725){var _0x13e229={};_0x13e229[_0x433725]={'$like':'%'+_0x1accef['query'][_0x6ae3('0x43')]+'%'};return _0x13e229;})});}_0x237a7e=_['merge']({},_0x237a7e,_0x1accef[_0x6ae3('0x46')]);return _0x301e60[_0x6ae3('0x57')](_0x237a7e);}})[_0x6ae3('0x2e')](function(_0x341905){if(_0x341905){_0x234a69=_0x341905['length'];if(!_0x1accef[_0x6ae3('0x39')][_0x6ae3('0x3e')]('nolimit')){_0x237a7e[_0x6ae3('0x27')]=qs[_0x6ae3('0x27')](_0x1accef[_0x6ae3('0x39')][_0x6ae3('0x27')]);_0x237a7e[_0x6ae3('0x26')]=qs[_0x6ae3('0x26')](_0x1accef[_0x6ae3('0x39')][_0x6ae3('0x26')]);}return _0x301e60['getDescriptions'](_0x237a7e);}})[_0x6ae3('0x2e')](function(_0x41a80e){if(_0x41a80e){return _0x41a80e?{'count':_0x234a69,'rows':_0x41a80e}:null;}})[_0x6ae3('0x2e')](respondWithResult(_0x1c376d,null))['catch'](handleError(_0x1c376d,null));}; \ No newline at end of file +var _0x6b31=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','options','includeAll','findAll','rows','show','params','filtears','merge','find','create','body','getFields','findOne','filter','getSubjects','getDescriptions','VtigerField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','end','name','index','map','VtigerConfiguration','rawAttributes','type'];(function(_0x47e7dd,_0x51b041){var _0x38501f=function(_0x5ba66d){while(--_0x5ba66d){_0x47e7dd['push'](_0x47e7dd['shift']());}};_0x38501f(++_0x51b041);}(_0x6b31,0x17d));var _0x16b3=function(_0x18db7d,_0x196356){_0x18db7d=_0x18db7d-0x0;var _0x2c8ec5=_0x6b31[_0x18db7d];return _0x2c8ec5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16b3('0x0'));var rimraf=require(_0x16b3('0x1'));var zipdir=require(_0x16b3('0x2'));var jsonpatch=require(_0x16b3('0x3'));var rp=require(_0x16b3('0x4'));var moment=require(_0x16b3('0x5'));var BPromise=require(_0x16b3('0x6'));var Mustache=require(_0x16b3('0x7'));var util=require(_0x16b3('0x8'));var path=require(_0x16b3('0x9'));var sox=require(_0x16b3('0xa'));var csv=require('to-csv');var ejs=require(_0x16b3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16b3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x16b3('0xd'));var toCsv=require(_0x16b3('0xe'));var querystring=require('querystring');var Papa=require(_0x16b3('0xf'));var Redis=require(_0x16b3('0x10'));var authService=require(_0x16b3('0x11'));var qs=require(_0x16b3('0x12'));var as=require(_0x16b3('0x13'));var hardwareService=require(_0x16b3('0x14'));var logger=require('../../config/logger')(_0x16b3('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x16b3('0x16'));var db=require(_0x16b3('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x16b3('0x18')][_0x16b3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x15589b,_0x27077b,_0x1881d7,_0x140d5a){return new BPromise(function(_0x3f0f55,_0xee05aa){var _0x5970c7=_0x140d5a||client;return _0x5970c7['request'](_0x15589b,_0x1881d7)[_0x16b3('0x1a')](function(_0x1132af){logger[_0x16b3('0x1b')](_0x16b3('0x1c'),_0x27077b,_0x16b3('0x1d'));logger[_0x16b3('0x1e')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x27077b,_0x16b3('0x1d'),JSON['stringify'](_0x1132af));if(_0x1132af[_0x16b3('0x1f')]){if(_0x1132af['error'][_0x16b3('0x20')]===0x1f4){logger[_0x16b3('0x1f')](_0x16b3('0x1c'),_0x27077b,_0x1132af[_0x16b3('0x1f')]['message']);return _0xee05aa(_0x1132af[_0x16b3('0x1f')]['message']);}logger[_0x16b3('0x1f')](_0x16b3('0x1c'),_0x27077b,_0x1132af['error']['message']);return _0x3f0f55(_0x1132af[_0x16b3('0x1f')][_0x16b3('0x21')]);}else{logger[_0x16b3('0x1b')]('VtigerConfiguration,\x20%s,\x20%s',_0x27077b,_0x16b3('0x1d'));_0x3f0f55(_0x1132af['result'][_0x16b3('0x21')]);}})[_0x16b3('0x22')](function(_0xa57f5){logger['error'](_0x16b3('0x1c'),_0x27077b,_0xa57f5);_0xee05aa(_0xa57f5);});});}function respondWithStatusCode(_0x12f0a4,_0x227e04){_0x227e04=_0x227e04||0xcc;return function(_0x11e26c){if(_0x11e26c){return _0x12f0a4[_0x16b3('0x23')](_0x227e04);}return _0x12f0a4[_0x16b3('0x24')](_0x227e04)['end']();};}function respondWithResult(_0x4386e1,_0x3a405b){_0x3a405b=_0x3a405b||0xc8;return function(_0x1d81fd){if(_0x1d81fd){return _0x4386e1[_0x16b3('0x24')](_0x3a405b)['json'](_0x1d81fd);}};}function respondWithFilteredResult(_0x33b5c8,_0x2cb0d1){return function(_0x4c13b4){if(_0x4c13b4){var _0x2ed89f=_0x4c13b4[_0x16b3('0x25')],_0x3f00c0=_0x2cb0d1['offset'],_0x4f9915=_0x2cb0d1[_0x16b3('0x26')]+_0x2cb0d1[_0x16b3('0x27')],_0x21d738;if(_0x4f9915>=_0x2ed89f){_0x4f9915=_0x2ed89f;_0x21d738=0xc8;}else{_0x21d738=0xce;}_0x33b5c8[_0x16b3('0x24')](_0x21d738);return _0x33b5c8[_0x16b3('0x28')](_0x16b3('0x29'),_0x3f00c0+'-'+_0x4f9915+'/'+_0x2ed89f)[_0x16b3('0x2a')](_0x4c13b4);}return null;};}function patchUpdates(_0x32da49){return function(_0x49f3c5){try{jsonpatch[_0x16b3('0x2b')](_0x49f3c5,_0x32da49,!![]);}catch(_0x5e54c9){return BPromise[_0x16b3('0x2c')](_0x5e54c9);}return _0x49f3c5[_0x16b3('0x2d')]();};}function saveUpdates(_0x1295e3,_0x30a831){return function(_0x4354a9){if(_0x4354a9){return _0x4354a9['update'](_0x1295e3)['then'](function(_0x5c34db){return _0x5c34db;});}return null;};}function removeEntity(_0x47ac39,_0x1a07b6){return function(_0x413892){if(_0x413892){return _0x413892[_0x16b3('0x2e')]()[_0x16b3('0x1a')](function(){_0x47ac39['status'](0xcc)[_0x16b3('0x2f')]();});}};}function handleEntityNotFound(_0x57d936,_0x28e1d1){return function(_0x4a6335){if(!_0x4a6335){_0x57d936['sendStatus'](0x194);}return _0x4a6335;};}function handleError(_0xca043f,_0x163258){_0x163258=_0x163258||0x1f4;return function(_0x1f32a3){logger[_0x16b3('0x1f')](_0x1f32a3['stack']);if(_0x1f32a3[_0x16b3('0x30')]){delete _0x1f32a3[_0x16b3('0x30')];}_0xca043f['status'](_0x163258)['send'](_0x1f32a3);};}exports[_0x16b3('0x31')]=function(_0x2dbc7c,_0x42526d){var _0x3785d7={},_0x260106={},_0x43c6d8={'count':0x0,'rows':[]};var _0x5f4825=_[_0x16b3('0x32')](db[_0x16b3('0x33')][_0x16b3('0x34')],function(_0x45ca6c){return{'name':_0x45ca6c['fieldName'],'type':_0x45ca6c[_0x16b3('0x35')][_0x16b3('0x36')]};});_0x260106['model']=_[_0x16b3('0x32')](_0x5f4825,_0x16b3('0x30'));_0x260106[_0x16b3('0x37')]=_[_0x16b3('0x38')](_0x2dbc7c[_0x16b3('0x37')]);_0x260106[_0x16b3('0x39')]=_[_0x16b3('0x3a')](_0x260106[_0x16b3('0x3b')],_0x260106[_0x16b3('0x37')]);_0x3785d7[_0x16b3('0x3c')]=_['intersection'](_0x260106[_0x16b3('0x3b')],qs[_0x16b3('0x3d')](_0x2dbc7c['query'][_0x16b3('0x3d')]));_0x3785d7[_0x16b3('0x3c')]=_0x3785d7['attributes'][_0x16b3('0x3e')]?_0x3785d7[_0x16b3('0x3c')]:_0x260106['model'];if(!_0x2dbc7c[_0x16b3('0x37')][_0x16b3('0x3f')](_0x16b3('0x40'))){_0x3785d7[_0x16b3('0x27')]=qs[_0x16b3('0x27')](_0x2dbc7c[_0x16b3('0x37')][_0x16b3('0x27')]);_0x3785d7[_0x16b3('0x26')]=qs[_0x16b3('0x26')](_0x2dbc7c[_0x16b3('0x37')][_0x16b3('0x26')]);}_0x3785d7[_0x16b3('0x41')]=qs['sort'](_0x2dbc7c[_0x16b3('0x37')][_0x16b3('0x42')]);_0x3785d7['where']=qs[_0x16b3('0x39')](_[_0x16b3('0x43')](_0x2dbc7c[_0x16b3('0x37')],_0x260106[_0x16b3('0x39')]),_0x5f4825);if(_0x2dbc7c[_0x16b3('0x37')]['filter']){_0x3785d7[_0x16b3('0x44')]=_['merge'](_0x3785d7[_0x16b3('0x44')],{'$or':_[_0x16b3('0x32')](_0x5f4825,function(_0x125978){if(_0x125978['type']!==_0x16b3('0x45')){var _0x3ed7e7={};_0x3ed7e7[_0x125978[_0x16b3('0x30')]]={'$like':'%'+_0x2dbc7c[_0x16b3('0x37')]['filter']+'%'};return _0x3ed7e7;}})});}_0x3785d7=_['merge']({},_0x3785d7,_0x2dbc7c[_0x16b3('0x46')]);var _0x4466a2={'where':_0x3785d7[_0x16b3('0x44')]};return db['VtigerConfiguration'][_0x16b3('0x25')](_0x4466a2)[_0x16b3('0x1a')](function(_0x32a4a8){_0x43c6d8[_0x16b3('0x25')]=_0x32a4a8;if(_0x2dbc7c[_0x16b3('0x37')][_0x16b3('0x47')]){_0x3785d7['include']=[{'all':!![]}];}return db[_0x16b3('0x33')][_0x16b3('0x48')](_0x3785d7);})[_0x16b3('0x1a')](function(_0x151c41){_0x43c6d8[_0x16b3('0x49')]=_0x151c41;return _0x43c6d8;})[_0x16b3('0x1a')](respondWithFilteredResult(_0x42526d,_0x3785d7))[_0x16b3('0x22')](handleError(_0x42526d,null));};exports[_0x16b3('0x4a')]=function(_0x3e102d,_0x1be675){var _0x375fc0={'raw':![],'where':{'id':_0x3e102d[_0x16b3('0x4b')]['id']}},_0x4515ff={};_0x4515ff[_0x16b3('0x3b')]=_['keys'](db['VtigerConfiguration']['rawAttributes']);_0x4515ff[_0x16b3('0x37')]=_[_0x16b3('0x38')](_0x3e102d[_0x16b3('0x37')]);_0x4515ff[_0x16b3('0x4c')]=_[_0x16b3('0x3a')](_0x4515ff[_0x16b3('0x3b')],_0x4515ff[_0x16b3('0x37')]);_0x375fc0[_0x16b3('0x3c')]=_[_0x16b3('0x3a')](_0x4515ff[_0x16b3('0x3b')],qs[_0x16b3('0x3d')](_0x3e102d[_0x16b3('0x37')][_0x16b3('0x3d')]));_0x375fc0[_0x16b3('0x3c')]=_0x375fc0[_0x16b3('0x3c')]['length']?_0x375fc0[_0x16b3('0x3c')]:_0x4515ff[_0x16b3('0x3b')];if(_0x3e102d[_0x16b3('0x37')]['includeAll']){_0x375fc0['include']=[{'all':!![]}];}_0x375fc0=_[_0x16b3('0x4d')]({},_0x375fc0,_0x3e102d['options']);return db['VtigerConfiguration'][_0x16b3('0x4e')](_0x375fc0)['then'](handleEntityNotFound(_0x1be675,null))['then'](respondWithResult(_0x1be675,null))[_0x16b3('0x22')](handleError(_0x1be675,null));};exports[_0x16b3('0x4f')]=function(_0x511000,_0x32425d){return db[_0x16b3('0x33')][_0x16b3('0x4f')](_0x511000[_0x16b3('0x50')],{})[_0x16b3('0x1a')](respondWithResult(_0x32425d,0xc9))[_0x16b3('0x22')](handleError(_0x32425d,null));};exports['update']=function(_0x3f7cee,_0xb50de9){if(_0x3f7cee[_0x16b3('0x50')]['id']){delete _0x3f7cee[_0x16b3('0x50')]['id'];}return db['VtigerConfiguration'][_0x16b3('0x4e')]({'where':{'id':_0x3f7cee[_0x16b3('0x4b')]['id']}})[_0x16b3('0x1a')](handleEntityNotFound(_0xb50de9,null))[_0x16b3('0x1a')](saveUpdates(_0x3f7cee[_0x16b3('0x50')],null))['then'](respondWithResult(_0xb50de9,null))[_0x16b3('0x22')](handleError(_0xb50de9,null));};exports[_0x16b3('0x2e')]=function(_0x145a4e,_0x15bcc0){return db[_0x16b3('0x33')][_0x16b3('0x4e')]({'where':{'id':_0x145a4e[_0x16b3('0x4b')]['id']}})[_0x16b3('0x1a')](handleEntityNotFound(_0x15bcc0,null))[_0x16b3('0x1a')](removeEntity(_0x15bcc0,null))[_0x16b3('0x22')](handleError(_0x15bcc0,null));};exports[_0x16b3('0x51')]=function(_0xa44014,_0x57ec73,_0x5237ee){var _0x202028={};var _0x379f02={};var _0x57b76d;var _0x18ff6f;return db[_0x16b3('0x33')][_0x16b3('0x52')]({'where':{'id':_0xa44014[_0x16b3('0x4b')]['id']}})[_0x16b3('0x1a')](handleEntityNotFound(_0x57ec73,null))[_0x16b3('0x1a')](function(_0x371797){if(_0x371797){_0x57b76d=_0x371797;_0x379f02[_0x16b3('0x3b')]=_[_0x16b3('0x38')](db['VtigerField'][_0x16b3('0x34')]);_0x379f02[_0x16b3('0x37')]=_['keys'](_0xa44014['query']);_0x379f02[_0x16b3('0x39')]=_[_0x16b3('0x3a')](_0x379f02[_0x16b3('0x3b')],_0x379f02[_0x16b3('0x37')]);_0x202028['attributes']=_['intersection'](_0x379f02[_0x16b3('0x3b')],qs['fields'](_0xa44014[_0x16b3('0x37')]['fields']));_0x202028['attributes']=_0x202028[_0x16b3('0x3c')][_0x16b3('0x3e')]?_0x202028['attributes']:_0x379f02['model'];_0x202028[_0x16b3('0x41')]=qs[_0x16b3('0x42')](_0xa44014['query'][_0x16b3('0x42')]);_0x202028[_0x16b3('0x44')]=qs['filters'](_[_0x16b3('0x43')](_0xa44014['query'],_0x379f02['filters']));if(_0xa44014[_0x16b3('0x37')][_0x16b3('0x53')]){_0x202028[_0x16b3('0x44')]=_['merge'](_0x202028[_0x16b3('0x44')],{'$or':_[_0x16b3('0x32')](_0x202028[_0x16b3('0x3c')],function(_0x26c132){var _0xccbddc={};_0xccbddc[_0x26c132]={'$like':'%'+_0xa44014[_0x16b3('0x37')][_0x16b3('0x53')]+'%'};return _0xccbddc;})});}_0x202028=_[_0x16b3('0x4d')]({},_0x202028,_0xa44014['options']);return _0x57b76d[_0x16b3('0x51')](_0x202028);}})['then'](function(_0x4ad089){if(_0x4ad089){_0x18ff6f=_0x4ad089[_0x16b3('0x3e')];if(!_0xa44014[_0x16b3('0x37')]['hasOwnProperty'](_0x16b3('0x40'))){_0x202028[_0x16b3('0x27')]=qs['limit'](_0xa44014[_0x16b3('0x37')]['limit']);_0x202028['offset']=qs[_0x16b3('0x26')](_0xa44014[_0x16b3('0x37')][_0x16b3('0x26')]);}return _0x57b76d[_0x16b3('0x51')](_0x202028);}})['then'](function(_0x25c4dd){if(_0x25c4dd){return _0x25c4dd?{'count':_0x18ff6f,'rows':_0x25c4dd}:null;}})[_0x16b3('0x1a')](respondWithResult(_0x57ec73,null))['catch'](handleError(_0x57ec73,null));};exports[_0x16b3('0x54')]=function(_0x560c44,_0x3b6e22,_0x5a7bfe){var _0x2eba88={};var _0x1b9cb8={};var _0x2897eb;var _0x59b62d;return db[_0x16b3('0x33')][_0x16b3('0x52')]({'where':{'id':_0x560c44[_0x16b3('0x4b')]['id']}})[_0x16b3('0x1a')](handleEntityNotFound(_0x3b6e22,null))[_0x16b3('0x1a')](function(_0x16d2a9){if(_0x16d2a9){_0x2897eb=_0x16d2a9;_0x1b9cb8['model']=_['keys'](db['VtigerField'][_0x16b3('0x34')]);_0x1b9cb8['query']=_[_0x16b3('0x38')](_0x560c44[_0x16b3('0x37')]);_0x1b9cb8[_0x16b3('0x39')]=_['intersection'](_0x1b9cb8[_0x16b3('0x3b')],_0x1b9cb8[_0x16b3('0x37')]);_0x2eba88[_0x16b3('0x3c')]=_[_0x16b3('0x3a')](_0x1b9cb8[_0x16b3('0x3b')],qs['fields'](_0x560c44['query'][_0x16b3('0x3d')]));_0x2eba88[_0x16b3('0x3c')]=_0x2eba88['attributes'][_0x16b3('0x3e')]?_0x2eba88[_0x16b3('0x3c')]:_0x1b9cb8[_0x16b3('0x3b')];_0x2eba88[_0x16b3('0x41')]=qs[_0x16b3('0x42')](_0x560c44[_0x16b3('0x37')][_0x16b3('0x42')]);_0x2eba88[_0x16b3('0x44')]=qs[_0x16b3('0x39')](_[_0x16b3('0x43')](_0x560c44[_0x16b3('0x37')],_0x1b9cb8['filters']));if(_0x560c44[_0x16b3('0x37')]['filter']){_0x2eba88['where']=_[_0x16b3('0x4d')](_0x2eba88[_0x16b3('0x44')],{'$or':_['map'](_0x2eba88[_0x16b3('0x3c')],function(_0x2e487e){var _0x2f0f86={};_0x2f0f86[_0x2e487e]={'$like':'%'+_0x560c44[_0x16b3('0x37')][_0x16b3('0x53')]+'%'};return _0x2f0f86;})});}_0x2eba88=_['merge']({},_0x2eba88,_0x560c44[_0x16b3('0x46')]);return _0x2897eb[_0x16b3('0x54')](_0x2eba88);}})['then'](function(_0x224244){if(_0x224244){_0x59b62d=_0x224244['length'];if(!_0x560c44[_0x16b3('0x37')]['hasOwnProperty'](_0x16b3('0x40'))){_0x2eba88[_0x16b3('0x27')]=qs['limit'](_0x560c44['query'][_0x16b3('0x27')]);_0x2eba88['offset']=qs[_0x16b3('0x26')](_0x560c44[_0x16b3('0x37')][_0x16b3('0x26')]);}return _0x2897eb['getSubjects'](_0x2eba88);}})['then'](function(_0x41470a){if(_0x41470a){return _0x41470a?{'count':_0x59b62d,'rows':_0x41470a}:null;}})[_0x16b3('0x1a')](respondWithResult(_0x3b6e22,null))['catch'](handleError(_0x3b6e22,null));};exports[_0x16b3('0x55')]=function(_0x2c7e3c,_0x152efb,_0x380883){var _0x23f64e={};var _0x3db793={};var _0x57c8bd;var _0xf18281;return db[_0x16b3('0x33')][_0x16b3('0x52')]({'where':{'id':_0x2c7e3c[_0x16b3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x152efb,null))[_0x16b3('0x1a')](function(_0x1001f9){if(_0x1001f9){_0x57c8bd=_0x1001f9;_0x3db793[_0x16b3('0x3b')]=_[_0x16b3('0x38')](db[_0x16b3('0x56')][_0x16b3('0x34')]);_0x3db793[_0x16b3('0x37')]=_[_0x16b3('0x38')](_0x2c7e3c[_0x16b3('0x37')]);_0x3db793[_0x16b3('0x39')]=_['intersection'](_0x3db793[_0x16b3('0x3b')],_0x3db793['query']);_0x23f64e[_0x16b3('0x3c')]=_['intersection'](_0x3db793[_0x16b3('0x3b')],qs[_0x16b3('0x3d')](_0x2c7e3c[_0x16b3('0x37')][_0x16b3('0x3d')]));_0x23f64e[_0x16b3('0x3c')]=_0x23f64e[_0x16b3('0x3c')][_0x16b3('0x3e')]?_0x23f64e['attributes']:_0x3db793[_0x16b3('0x3b')];_0x23f64e[_0x16b3('0x41')]=qs['sort'](_0x2c7e3c[_0x16b3('0x37')][_0x16b3('0x42')]);_0x23f64e[_0x16b3('0x44')]=qs[_0x16b3('0x39')](_['pick'](_0x2c7e3c[_0x16b3('0x37')],_0x3db793['filters']));if(_0x2c7e3c[_0x16b3('0x37')][_0x16b3('0x53')]){_0x23f64e[_0x16b3('0x44')]=_[_0x16b3('0x4d')](_0x23f64e[_0x16b3('0x44')],{'$or':_[_0x16b3('0x32')](_0x23f64e['attributes'],function(_0x3f68ea){var _0x3d00a3={};_0x3d00a3[_0x3f68ea]={'$like':'%'+_0x2c7e3c[_0x16b3('0x37')]['filter']+'%'};return _0x3d00a3;})});}_0x23f64e=_[_0x16b3('0x4d')]({},_0x23f64e,_0x2c7e3c[_0x16b3('0x46')]);return _0x57c8bd[_0x16b3('0x55')](_0x23f64e);}})[_0x16b3('0x1a')](function(_0x1d9210){if(_0x1d9210){_0xf18281=_0x1d9210[_0x16b3('0x3e')];if(!_0x2c7e3c['query']['hasOwnProperty'](_0x16b3('0x40'))){_0x23f64e[_0x16b3('0x27')]=qs[_0x16b3('0x27')](_0x2c7e3c['query'][_0x16b3('0x27')]);_0x23f64e['offset']=qs[_0x16b3('0x26')](_0x2c7e3c[_0x16b3('0x37')]['offset']);}return _0x57c8bd[_0x16b3('0x55')](_0x23f64e);}})[_0x16b3('0x1a')](function(_0x25b0a2){if(_0x25b0a2){return _0x25b0a2?{'count':_0xf18281,'rows':_0x25b0a2}:null;}})[_0x16b3('0x1a')](respondWithResult(_0x152efb,null))['catch'](handleError(_0x152efb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dd38442..47fb8a9 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 _0xb05e=['api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x3a8e51,_0x21a1ac){var _0x3394b1=function(_0x5aa648){while(--_0x5aa648){_0x3a8e51['push'](_0x3a8e51['shift']());}};_0x3394b1(++_0x21a1ac);}(_0xb05e,0xd6));var _0xeb05=function(_0x17c63f,_0x92e1b9){_0x17c63f=_0x17c63f-0x0;var _0x2667d2=_0xb05e[_0x17c63f];return _0x2667d2;};'use strict';var _=require(_0xeb05('0x0'));var util=require(_0xeb05('0x1'));var logger=require('../../config/logger')(_0xeb05('0x2'));var moment=require(_0xeb05('0x3'));var BPromise=require('bluebird');var rp=require(_0xeb05('0x4'));var fs=require('fs');var path=require(_0xeb05('0x5'));var rimraf=require(_0xeb05('0x6'));var config=require(_0xeb05('0x7'));var attributes=require(_0xeb05('0x8'));module['exports']=function(_0x23e63d,_0xeac238){return _0x23e63d[_0xeb05('0x9')](_0xeb05('0xa'),attributes,{'tableName':_0xeb05('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfce=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0x3d8a03,_0x2f9cab){var _0x142a54=function(_0xb24158){while(--_0xb24158){_0x3d8a03['push'](_0x3d8a03['shift']());}};_0x142a54(++_0x2f9cab);}(_0xbfce,0x197));var _0xebfc=function(_0x4c667c,_0x26e15d){_0x4c667c=_0x4c667c-0x0;var _0x19a2df=_0xbfce[_0x4c667c];return _0x19a2df;};'use strict';var _=require(_0xebfc('0x0'));var util=require(_0xebfc('0x1'));var logger=require(_0xebfc('0x2'))(_0xebfc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xebfc('0x4'));var rimraf=require(_0xebfc('0x5'));var config=require(_0xebfc('0x6'));var attributes=require(_0xebfc('0x7'));module[_0xebfc('0x8')]=function(_0x1a2edb,_0x4734cc){return _0x1a2edb[_0xebfc('0x9')](_0xebfc('0xa'),attributes,{'tableName':'int_vtiger_configurations','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 a93a9b1..33c7d95 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 _0xee45=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','VtigerConfiguration,\x20%s,\x20%s','message','result'];(function(_0x5146e9,_0x539fea){var _0x36be24=function(_0x4dc2d8){while(--_0x4dc2d8){_0x5146e9['push'](_0x5146e9['shift']());}};_0x36be24(++_0x539fea);}(_0xee45,0x1c9));var _0x5ee4=function(_0x507625,_0x8299a6){_0x507625=_0x507625-0x0;var _0x19b244=_0xee45[_0x507625];return _0x19b244;};'use strict';var _=require(_0x5ee4('0x0'));var util=require(_0x5ee4('0x1'));var moment=require('moment');var BPromise=require(_0x5ee4('0x2'));var rs=require(_0x5ee4('0x3'));var fs=require('fs');var Redis=require(_0x5ee4('0x4'));var db=require(_0x5ee4('0x5'))['db'];var utils=require(_0x5ee4('0x6'));var logger=require(_0x5ee4('0x7'))(_0x5ee4('0x8'));var config=require(_0x5ee4('0x9'));var jayson=require(_0x5ee4('0xa'));var client=jayson[_0x5ee4('0xb')][_0x5ee4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x216bd6,_0x31947b,_0x5614e1){return new BPromise(function(_0x475ade,_0x1ed486){return client[_0x5ee4('0xd')](_0x216bd6,_0x5614e1)[_0x5ee4('0xe')](function(_0x25c3ce){logger[_0x5ee4('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x31947b,_0x5ee4('0x10'));logger[_0x5ee4('0x11')](_0x5ee4('0x12'),_0x31947b,'request\x20sent',JSON['stringify'](_0x25c3ce));if(_0x25c3ce['error']){if(_0x25c3ce[_0x5ee4('0x13')]['code']===0x1f4){logger[_0x5ee4('0x13')](_0x5ee4('0x14'),_0x31947b,_0x25c3ce[_0x5ee4('0x13')][_0x5ee4('0x15')]);return _0x1ed486(_0x25c3ce[_0x5ee4('0x13')][_0x5ee4('0x15')]);}logger[_0x5ee4('0x13')](_0x5ee4('0x14'),_0x31947b,_0x25c3ce['error'][_0x5ee4('0x15')]);return _0x475ade(_0x25c3ce['error'][_0x5ee4('0x15')]);}else{logger[_0x5ee4('0xf')](_0x5ee4('0x14'),_0x31947b,'request\x20sent');_0x475ade(_0x25c3ce[_0x5ee4('0x16')][_0x5ee4('0x15')]);}})[_0x5ee4('0x17')](function(_0x37fa33){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x31947b,_0x37fa33);_0x1ed486(_0x37fa33);});});} \ No newline at end of file +var _0x69bd=['request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x5673c4,_0x5b672d){var _0x32b859=function(_0x4aa620){while(--_0x4aa620){_0x5673c4['push'](_0x5673c4['shift']());}};_0x32b859(++_0x5b672d);}(_0x69bd,0xa5));var _0xd69b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x69bd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd69b('0x0'));var util=require('util');var moment=require(_0xd69b('0x1'));var BPromise=require(_0xd69b('0x2'));var rs=require(_0xd69b('0x3'));var fs=require('fs');var Redis=require(_0xd69b('0x4'));var db=require(_0xd69b('0x5'))['db'];var utils=require(_0xd69b('0x6'));var logger=require(_0xd69b('0x7'))('rpc');var config=require(_0xd69b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd69b('0x9')][_0xd69b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7ec90,_0x54f410,_0x23cf96){return new BPromise(function(_0x190e7e,_0x5c1f26){return client[_0xd69b('0xb')](_0xb7ec90,_0x23cf96)['then'](function(_0x173240){logger['info'](_0xd69b('0xc'),_0x54f410,_0xd69b('0xd'));logger[_0xd69b('0xe')](_0xd69b('0xf'),_0x54f410,'request\x20sent',JSON[_0xd69b('0x10')](_0x173240));if(_0x173240[_0xd69b('0x11')]){if(_0x173240['error']['code']===0x1f4){logger[_0xd69b('0x11')](_0xd69b('0xc'),_0x54f410,_0x173240[_0xd69b('0x11')][_0xd69b('0x12')]);return _0x5c1f26(_0x173240[_0xd69b('0x11')]['message']);}logger['error'](_0xd69b('0xc'),_0x54f410,_0x173240[_0xd69b('0x11')][_0xd69b('0x12')]);return _0x190e7e(_0x173240[_0xd69b('0x11')][_0xd69b('0x12')]);}else{logger[_0xd69b('0x13')](_0xd69b('0xc'),_0x54f410,_0xd69b('0xd'));_0x190e7e(_0x173240[_0xd69b('0x14')][_0xd69b('0x12')]);}})[_0xd69b('0x15')](function(_0xdfce4a){logger['error'](_0xd69b('0xc'),_0x54f410,_0xdfce4a);_0x5c1f26(_0xdfce4a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index abd5630..d7e5f92 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 _0xc323=['../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x47f816,_0x137ac5){var _0x593738=function(_0x142143){while(--_0x142143){_0x47f816['push'](_0x47f816['shift']());}};_0x593738(++_0x137ac5);}(_0xc323,0xb6));var _0x3c32=function(_0x420083,_0x4ffb2f){_0x420083=_0x420083-0x0;var _0x1efd41=_0xc323[_0x420083];return _0x1efd41;};'use strict';var multer=require(_0x3c32('0x0'));var util=require(_0x3c32('0x1'));var path=require(_0x3c32('0x2'));var timeout=require(_0x3c32('0x3'));var express=require(_0x3c32('0x4'));var router=express[_0x3c32('0x5')]();var auth=require(_0x3c32('0x6'));var interaction=require(_0x3c32('0x7'));var config=require(_0x3c32('0x8'));var controller=require(_0x3c32('0x9'));router[_0x3c32('0xa')]('/',auth['isAuthenticated'](),controller[_0x3c32('0xb')]);router['get'](_0x3c32('0xc'),auth[_0x3c32('0xd')](),controller[_0x3c32('0xe')]);router['post']('/',auth[_0x3c32('0xd')](),controller[_0x3c32('0xf')]);router['put'](_0x3c32('0xc'),auth[_0x3c32('0xd')](),controller['update']);router[_0x3c32('0x10')](_0x3c32('0xc'),auth['isAuthenticated'](),controller[_0x3c32('0x11')]);module[_0x3c32('0x12')]=router; \ No newline at end of file +var _0xaada=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','post','create','/:id'];(function(_0x13b1bc,_0x2707d7){var _0x2b42ec=function(_0x17b4b7){while(--_0x17b4b7){_0x13b1bc['push'](_0x13b1bc['shift']());}};_0x2b42ec(++_0x2707d7);}(_0xaada,0x1ce));var _0xaaad=function(_0x38b98e,_0x3844f6){_0x38b98e=_0x38b98e-0x0;var _0x51d476=_0xaada[_0x38b98e];return _0x51d476;};'use strict';var multer=require(_0xaaad('0x0'));var util=require(_0xaaad('0x1'));var path=require(_0xaaad('0x2'));var timeout=require(_0xaaad('0x3'));var express=require(_0xaaad('0x4'));var router=express[_0xaaad('0x5')]();var auth=require(_0xaaad('0x6'));var interaction=require(_0xaaad('0x7'));var config=require('../../config/environment');var controller=require(_0xaaad('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaaad('0x9')]('/:id',auth[_0xaaad('0xa')](),controller['show']);router[_0xaaad('0xb')]('/',auth[_0xaaad('0xa')](),controller[_0xaaad('0xc')]);router['put'](_0xaaad('0xd'),auth[_0xaaad('0xa')](),controller['update']);router[_0xaaad('0xe')](_0xaaad('0xd'),auth[_0xaaad('0xa')](),controller[_0xaaad('0xf')]);module[_0xaaad('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6d80c38..27a74dd 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 _0x5640=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x5640,0x111));var _0x0564=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5640[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x0564('0x0'));module['exports']={'type':{'type':Sequelize[_0x0564('0x1')](_0x0564('0x2'),_0x0564('0x3'),_0x0564('0x4'),_0x0564('0x5')),'defaultValue':_0x0564('0x2')},'content':{'type':Sequelize[_0x0564('0x6')]},'key':{'type':Sequelize[_0x0564('0x6')]},'keyType':{'type':Sequelize[_0x0564('0x1')](_0x0564('0x2'),_0x0564('0x3'),_0x0564('0x4'))},'keyContent':{'type':Sequelize[_0x0564('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0564('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0564('0x6')]}}; \ No newline at end of file +var _0x9009=['ENUM','string','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0xa8369a,_0x3d2319){var _0x4b74b7=function(_0x11d138){while(--_0x11d138){_0xa8369a['push'](_0xa8369a['shift']());}};_0x4b74b7(++_0x3d2319);}(_0x9009,0x1d4));var _0x9900=function(_0x24745b,_0x344d4d){_0x24745b=_0x24745b-0x0;var _0x1f1cf1=_0x9009[_0x24745b];return _0x1f1cf1;};'use strict';var Sequelize=require(_0x9900('0x0'));module['exports']={'type':{'type':Sequelize[_0x9900('0x1')](_0x9900('0x2'),'variable',_0x9900('0x3'),_0x9900('0x4')),'defaultValue':_0x9900('0x2')},'content':{'type':Sequelize[_0x9900('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9900('0x1')](_0x9900('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x9900('0x5')]},'idField':{'type':Sequelize[_0x9900('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9900('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9900('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index bb690f2..99238a9 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 _0xda19=['eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','json','apply','reject','save','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VtigerField','rows','catch','show','params','find','create','body'];(function(_0x5941b7,_0x17b181){var _0x27f0ca=function(_0x151595){while(--_0x151595){_0x5941b7['push'](_0x5941b7['shift']());}};_0x27f0ca(++_0x17b181);}(_0xda19,0xd5));var _0x9da1=function(_0x41155f,_0xc18a03){_0x41155f=_0x41155f-0x0;var _0x54d908=_0xda19[_0x41155f];return _0x54d908;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9da1('0x0'));var rimraf=require(_0x9da1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9da1('0x2'));var rp=require('request-promise');var moment=require(_0x9da1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9da1('0x4'));var util=require(_0x9da1('0x5'));var path=require(_0x9da1('0x6'));var sox=require(_0x9da1('0x7'));var csv=require(_0x9da1('0x8'));var ejs=require(_0x9da1('0x9'));var fs=require('fs');var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];function respondWithStatusCode(_0x596b6b,_0x4735c7){_0x4735c7=_0x4735c7||0xcc;return function(_0x1d93f8){if(_0x1d93f8){return _0x596b6b[_0x9da1('0x17')](_0x4735c7);}return _0x596b6b[_0x9da1('0x18')](_0x4735c7)['end']();};}function respondWithResult(_0x2837e3,_0x535a13){_0x535a13=_0x535a13||0xc8;return function(_0x4d17e1){if(_0x4d17e1){return _0x2837e3[_0x9da1('0x18')](_0x535a13)['json'](_0x4d17e1);}};}function respondWithFilteredResult(_0x433ff4,_0x43c093){return function(_0x37653d){if(_0x37653d){var _0x1a1a6b=_0x37653d[_0x9da1('0x19')],_0x7f1a64=_0x43c093[_0x9da1('0x1a')],_0x514d8e=_0x43c093[_0x9da1('0x1a')]+_0x43c093[_0x9da1('0x1b')],_0x16f75a;if(_0x514d8e>=_0x1a1a6b){_0x514d8e=_0x1a1a6b;_0x16f75a=0xc8;}else{_0x16f75a=0xce;}_0x433ff4[_0x9da1('0x18')](_0x16f75a);return _0x433ff4['set']('Content-Range',_0x7f1a64+'-'+_0x514d8e+'/'+_0x1a1a6b)[_0x9da1('0x1c')](_0x37653d);}return null;};}function patchUpdates(_0x8da712){return function(_0x1b0e7f){try{jsonpatch[_0x9da1('0x1d')](_0x1b0e7f,_0x8da712,!![]);}catch(_0x40a967){return BPromise[_0x9da1('0x1e')](_0x40a967);}return _0x1b0e7f[_0x9da1('0x1f')]();};}function saveUpdates(_0x47e5cf,_0x1a459c){return function(_0x554845){if(_0x554845){return _0x554845[_0x9da1('0x20')](_0x47e5cf)[_0x9da1('0x21')](function(_0x1fc065){return _0x1fc065;});}return null;};}function removeEntity(_0x4e9d7d,_0x5454d3){return function(_0x14793b){if(_0x14793b){return _0x14793b[_0x9da1('0x22')]()[_0x9da1('0x21')](function(){_0x4e9d7d[_0x9da1('0x18')](0xcc)[_0x9da1('0x23')]();});}};}function handleEntityNotFound(_0x165b73,_0x4c60aa){return function(_0x2413fe){if(!_0x2413fe){_0x165b73[_0x9da1('0x17')](0x194);}return _0x2413fe;};}function handleError(_0x4fd25a,_0x45fcce){_0x45fcce=_0x45fcce||0x1f4;return function(_0x3f5680){logger['error'](_0x3f5680[_0x9da1('0x24')]);if(_0x3f5680[_0x9da1('0x25')]){delete _0x3f5680['name'];}_0x4fd25a[_0x9da1('0x18')](_0x45fcce)[_0x9da1('0x26')](_0x3f5680);};}exports['index']=function(_0x5c09ed,_0x67dbc8){var _0x47055e={},_0x5eca5b={},_0x27c6e2={'count':0x0,'rows':[]};var _0x5db5c2=_['map'](db['VtigerField'][_0x9da1('0x27')],function(_0x404b86){return{'name':_0x404b86[_0x9da1('0x28')],'type':_0x404b86[_0x9da1('0x29')][_0x9da1('0x2a')]};});_0x5eca5b['model']=_[_0x9da1('0x2b')](_0x5db5c2,'name');_0x5eca5b[_0x9da1('0x2c')]=_[_0x9da1('0x2d')](_0x5c09ed['query']);_0x5eca5b[_0x9da1('0x2e')]=_[_0x9da1('0x2f')](_0x5eca5b['model'],_0x5eca5b[_0x9da1('0x2c')]);_0x47055e[_0x9da1('0x30')]=_[_0x9da1('0x2f')](_0x5eca5b[_0x9da1('0x31')],qs['fields'](_0x5c09ed['query'][_0x9da1('0x32')]));_0x47055e[_0x9da1('0x30')]=_0x47055e[_0x9da1('0x30')][_0x9da1('0x33')]?_0x47055e[_0x9da1('0x30')]:_0x5eca5b['model'];if(!_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x47055e[_0x9da1('0x1b')]=qs[_0x9da1('0x1b')](_0x5c09ed[_0x9da1('0x2c')]['limit']);_0x47055e[_0x9da1('0x1a')]=qs['offset'](_0x5c09ed['query'][_0x9da1('0x1a')]);}_0x47055e['order']=qs[_0x9da1('0x36')](_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x36')]);_0x47055e[_0x9da1('0x37')]=qs[_0x9da1('0x2e')](_[_0x9da1('0x38')](_0x5c09ed[_0x9da1('0x2c')],_0x5eca5b[_0x9da1('0x2e')]),_0x5db5c2);if(_0x5c09ed['query'][_0x9da1('0x39')]){_0x47055e['where']=_[_0x9da1('0x3a')](_0x47055e['where'],{'$or':_['map'](_0x5db5c2,function(_0x1ce0f8){if(_0x1ce0f8['type']!==_0x9da1('0x3b')){var _0x227a1c={};_0x227a1c[_0x1ce0f8['name']]={'$like':'%'+_0x5c09ed[_0x9da1('0x2c')][_0x9da1('0x39')]+'%'};return _0x227a1c;}})});}_0x47055e=_[_0x9da1('0x3a')]({},_0x47055e,_0x5c09ed[_0x9da1('0x3c')]);var _0x56bd49={'where':_0x47055e[_0x9da1('0x37')]};return db['VtigerField'][_0x9da1('0x19')](_0x56bd49)['then'](function(_0x26e8d3){_0x27c6e2[_0x9da1('0x19')]=_0x26e8d3;if(_0x5c09ed['query'][_0x9da1('0x3d')]){_0x47055e[_0x9da1('0x3e')]=[{'all':!![]}];}return db[_0x9da1('0x3f')]['findAll'](_0x47055e);})['then'](function(_0x53fc15){_0x27c6e2[_0x9da1('0x40')]=_0x53fc15;return _0x27c6e2;})['then'](respondWithFilteredResult(_0x67dbc8,_0x47055e))[_0x9da1('0x41')](handleError(_0x67dbc8,null));};exports[_0x9da1('0x42')]=function(_0x118be7,_0x43c064){var _0x54f188={'raw':!![],'where':{'id':_0x118be7[_0x9da1('0x43')]['id']}},_0x42dbd8={};_0x42dbd8[_0x9da1('0x31')]=_[_0x9da1('0x2d')](db[_0x9da1('0x3f')][_0x9da1('0x27')]);_0x42dbd8[_0x9da1('0x2c')]=_['keys'](_0x118be7[_0x9da1('0x2c')]);_0x42dbd8['filtears']=_[_0x9da1('0x2f')](_0x42dbd8['model'],_0x42dbd8[_0x9da1('0x2c')]);_0x54f188[_0x9da1('0x30')]=_['intersection'](_0x42dbd8[_0x9da1('0x31')],qs[_0x9da1('0x32')](_0x118be7['query'][_0x9da1('0x32')]));_0x54f188['attributes']=_0x54f188[_0x9da1('0x30')][_0x9da1('0x33')]?_0x54f188['attributes']:_0x42dbd8['model'];if(_0x118be7[_0x9da1('0x2c')][_0x9da1('0x3d')]){_0x54f188[_0x9da1('0x3e')]=[{'all':!![]}];}_0x54f188=_[_0x9da1('0x3a')]({},_0x54f188,_0x118be7[_0x9da1('0x3c')]);return db[_0x9da1('0x3f')][_0x9da1('0x44')](_0x54f188)[_0x9da1('0x21')](handleEntityNotFound(_0x43c064,null))['then'](respondWithResult(_0x43c064,null))[_0x9da1('0x41')](handleError(_0x43c064,null));};exports[_0x9da1('0x45')]=function(_0x1eebc5,_0x5cf7ef){return db[_0x9da1('0x3f')][_0x9da1('0x45')](_0x1eebc5[_0x9da1('0x46')],{})['then'](respondWithResult(_0x5cf7ef,0xc9))[_0x9da1('0x41')](handleError(_0x5cf7ef,null));};exports[_0x9da1('0x20')]=function(_0x28b1b0,_0x516bdd){if(_0x28b1b0[_0x9da1('0x46')]['id']){delete _0x28b1b0['body']['id'];}return db['VtigerField'][_0x9da1('0x44')]({'where':{'id':_0x28b1b0[_0x9da1('0x43')]['id']}})['then'](handleEntityNotFound(_0x516bdd,null))[_0x9da1('0x21')](saveUpdates(_0x28b1b0[_0x9da1('0x46')],null))['then'](respondWithResult(_0x516bdd,null))[_0x9da1('0x41')](handleError(_0x516bdd,null));};exports[_0x9da1('0x22')]=function(_0x1984f7,_0x3a529d){return db[_0x9da1('0x3f')][_0x9da1('0x44')]({'where':{'id':_0x1984f7[_0x9da1('0x43')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x3a529d,null))[_0x9da1('0x21')](removeEntity(_0x3a529d,null))['catch'](handleError(_0x3a529d,null));}; \ No newline at end of file +var _0x8958=['filtears','intersection','find','catch','create','body','params','eml-format','moment','mustache','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','where','pick','merge','map','VIRTUAL','options','VtigerField','includeAll','include','rows','show'];(function(_0x223f5a,_0x218454){var _0x41ad07=function(_0xf244d1){while(--_0xf244d1){_0x223f5a['push'](_0x223f5a['shift']());}};_0x41ad07(++_0x218454);}(_0x8958,0x93));var _0x8895=function(_0x5d4786,_0x583840){_0x5d4786=_0x5d4786-0x0;var _0x9de313=_0x8958[_0x5d4786];return _0x9de313;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var licenseUtil=require(_0x8895('0x15'));var db=require(_0x8895('0x16'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x17')](_0xaf93bc);}return _0x446e1a[_0x8895('0x18')](_0xaf93bc)[_0x8895('0x19')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1a')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=_0x3d7b59[_0x8895('0x1b')],_0x5b4c2e=_0x195789[_0x8895('0x1c')],_0x4128e2=_0x195789[_0x8895('0x1c')]+_0x195789[_0x8895('0x1d')],_0x100fc8;if(_0x4128e2>=_0x2c9d40){_0x4128e2=_0x2c9d40;_0x100fc8=0xc8;}else{_0x100fc8=0xce;}_0x337101[_0x8895('0x18')](_0x100fc8);return _0x337101[_0x8895('0x1e')](_0x8895('0x1f'),_0x5b4c2e+'-'+_0x4128e2+'/'+_0x2c9d40)[_0x8895('0x1a')](_0x3d7b59);}return null;};}function patchUpdates(_0x24fef0){return function(_0x6b8a16){try{jsonpatch[_0x8895('0x20')](_0x6b8a16,_0x24fef0,!![]);}catch(_0x54e6d4){return BPromise['reject'](_0x54e6d4);}return _0x6b8a16['save']();};}function saveUpdates(_0x3daf43,_0x456282){return function(_0x2d189c){if(_0x2d189c){return _0x2d189c[_0x8895('0x21')](_0x3daf43)[_0x8895('0x22')](function(_0x35bda5){return _0x35bda5;});}return null;};}function removeEntity(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')]()[_0x8895('0x22')](function(){_0x461346[_0x8895('0x18')](0xcc)[_0x8895('0x19')]();});}};}function handleEntityNotFound(_0x29223d,_0x4d092d){return function(_0x5d354a){if(!_0x5d354a){_0x29223d[_0x8895('0x17')](0x194);}return _0x5d354a;};}function handleError(_0x398382,_0x38f7ad){_0x38f7ad=_0x38f7ad||0x1f4;return function(_0x24a376){logger['error'](_0x24a376[_0x8895('0x24')]);if(_0x24a376[_0x8895('0x25')]){delete _0x24a376[_0x8895('0x25')];}_0x398382['status'](_0x38f7ad)['send'](_0x24a376);};}exports[_0x8895('0x26')]=function(_0x555e60,_0x3d51b0){var _0x3e3b48={},_0x10b48f={},_0xf5fb66={'count':0x0,'rows':[]};var _0x153220=_['map'](db['VtigerField'][_0x8895('0x27')],function(_0x37ac3a){return{'name':_0x37ac3a[_0x8895('0x28')],'type':_0x37ac3a[_0x8895('0x29')][_0x8895('0x2a')]};});_0x10b48f['model']=_['map'](_0x153220,_0x8895('0x25'));_0x10b48f[_0x8895('0x2b')]=_[_0x8895('0x2c')](_0x555e60[_0x8895('0x2b')]);_0x10b48f[_0x8895('0x2d')]=_['intersection'](_0x10b48f[_0x8895('0x2e')],_0x10b48f['query']);_0x3e3b48[_0x8895('0x2f')]=_['intersection'](_0x10b48f[_0x8895('0x2e')],qs[_0x8895('0x30')](_0x555e60[_0x8895('0x2b')][_0x8895('0x30')]));_0x3e3b48[_0x8895('0x2f')]=_0x3e3b48['attributes'][_0x8895('0x31')]?_0x3e3b48[_0x8895('0x2f')]:_0x10b48f[_0x8895('0x2e')];if(!_0x555e60[_0x8895('0x2b')][_0x8895('0x32')]('nolimit')){_0x3e3b48[_0x8895('0x1d')]=qs['limit'](_0x555e60[_0x8895('0x2b')]['limit']);_0x3e3b48[_0x8895('0x1c')]=qs[_0x8895('0x1c')](_0x555e60[_0x8895('0x2b')][_0x8895('0x1c')]);}_0x3e3b48[_0x8895('0x33')]=qs['sort'](_0x555e60[_0x8895('0x2b')]['sort']);_0x3e3b48[_0x8895('0x34')]=qs[_0x8895('0x2d')](_[_0x8895('0x35')](_0x555e60[_0x8895('0x2b')],_0x10b48f[_0x8895('0x2d')]),_0x153220);if(_0x555e60[_0x8895('0x2b')]['filter']){_0x3e3b48[_0x8895('0x34')]=_[_0x8895('0x36')](_0x3e3b48['where'],{'$or':_[_0x8895('0x37')](_0x153220,function(_0x54ca09){if(_0x54ca09[_0x8895('0x29')]!==_0x8895('0x38')){var _0x482c9f={};_0x482c9f[_0x54ca09[_0x8895('0x25')]]={'$like':'%'+_0x555e60[_0x8895('0x2b')]['filter']+'%'};return _0x482c9f;}})});}_0x3e3b48=_['merge']({},_0x3e3b48,_0x555e60[_0x8895('0x39')]);var _0xf0b378={'where':_0x3e3b48[_0x8895('0x34')]};return db[_0x8895('0x3a')][_0x8895('0x1b')](_0xf0b378)['then'](function(_0x42ed1f){_0xf5fb66[_0x8895('0x1b')]=_0x42ed1f;if(_0x555e60[_0x8895('0x2b')][_0x8895('0x3b')]){_0x3e3b48[_0x8895('0x3c')]=[{'all':!![]}];}return db[_0x8895('0x3a')]['findAll'](_0x3e3b48);})[_0x8895('0x22')](function(_0x5ebfc4){_0xf5fb66[_0x8895('0x3d')]=_0x5ebfc4;return _0xf5fb66;})[_0x8895('0x22')](respondWithFilteredResult(_0x3d51b0,_0x3e3b48))['catch'](handleError(_0x3d51b0,null));};exports[_0x8895('0x3e')]=function(_0x4e8fbc,_0x1e6395){var _0x5e6413={'raw':!![],'where':{'id':_0x4e8fbc['params']['id']}},_0x4af3b1={};_0x4af3b1['model']=_['keys'](db['VtigerField'][_0x8895('0x27')]);_0x4af3b1[_0x8895('0x2b')]=_['keys'](_0x4e8fbc['query']);_0x4af3b1[_0x8895('0x3f')]=_[_0x8895('0x40')](_0x4af3b1['model'],_0x4af3b1[_0x8895('0x2b')]);_0x5e6413[_0x8895('0x2f')]=_[_0x8895('0x40')](_0x4af3b1[_0x8895('0x2e')],qs[_0x8895('0x30')](_0x4e8fbc['query']['fields']));_0x5e6413['attributes']=_0x5e6413[_0x8895('0x2f')]['length']?_0x5e6413[_0x8895('0x2f')]:_0x4af3b1[_0x8895('0x2e')];if(_0x4e8fbc[_0x8895('0x2b')][_0x8895('0x3b')]){_0x5e6413['include']=[{'all':!![]}];}_0x5e6413=_[_0x8895('0x36')]({},_0x5e6413,_0x4e8fbc[_0x8895('0x39')]);return db[_0x8895('0x3a')][_0x8895('0x41')](_0x5e6413)[_0x8895('0x22')](handleEntityNotFound(_0x1e6395,null))[_0x8895('0x22')](respondWithResult(_0x1e6395,null))[_0x8895('0x42')](handleError(_0x1e6395,null));};exports[_0x8895('0x43')]=function(_0x55fb78,_0x4740df){return db[_0x8895('0x3a')]['create'](_0x55fb78[_0x8895('0x44')],{})['then'](respondWithResult(_0x4740df,0xc9))['catch'](handleError(_0x4740df,null));};exports[_0x8895('0x21')]=function(_0x337a9f,_0x130018){if(_0x337a9f['body']['id']){delete _0x337a9f[_0x8895('0x44')]['id'];}return db['VtigerField'][_0x8895('0x41')]({'where':{'id':_0x337a9f[_0x8895('0x45')]['id']}})[_0x8895('0x22')](handleEntityNotFound(_0x130018,null))[_0x8895('0x22')](saveUpdates(_0x337a9f[_0x8895('0x44')],null))[_0x8895('0x22')](respondWithResult(_0x130018,null))[_0x8895('0x42')](handleError(_0x130018,null));};exports['destroy']=function(_0x47c4b9,_0x2a933c){return db[_0x8895('0x3a')]['find']({'where':{'id':_0x47c4b9[_0x8895('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a933c,null))['then'](removeEntity(_0x2a933c,null))[_0x8895('0x42')](handleError(_0x2a933c,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 07d9c3a..fcc5041 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0xcaba3b,_0x3bf822){var _0x2d3856=function(_0x1bd7d6){while(--_0x1bd7d6){_0xcaba3b['push'](_0xcaba3b['shift']());}};_0x2d3856(++_0x3bf822);}(_0x7a54,0x106));var _0x47a5=function(_0x14d54b,_0x5c87c3){_0x14d54b=_0x14d54b-0x0;var _0x215494=_0x7a54[_0x14d54b];return _0x215494;};'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':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x15ee90,_0x102c9c){var _0x3f82cf=function(_0x39971f){while(--_0x39971f){_0x15ee90['push'](_0x15ee90['shift']());}};_0x3f82cf(++_0x102c9c);}(_0x7a54,0x106));var _0x47a5=function(_0x54bd40,_0x5761a3){_0x54bd40=_0x54bd40-0x0;var _0x4466ed=_0x7a54[_0x54bd40];return _0x4466ed;};'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':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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 9d8106f..19ba561 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 _0x1219=['http','then','info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x38fb9b,_0x5eafda){var _0xae1fa2=function(_0x2e4d50){while(--_0x2e4d50){_0x38fb9b['push'](_0x38fb9b['shift']());}};_0xae1fa2(++_0x5eafda);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var moment=require(_0x9121('0x2'));var BPromise=require(_0x9121('0x3'));var rs=require(_0x9121('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9121('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9121('0x6'))(_0x9121('0x7'));var config=require(_0x9121('0x8'));var jayson=require(_0x9121('0x9'));var client=jayson[_0x9121('0xa')][_0x9121('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437bac,_0x1387b7,_0x262520){return new BPromise(function(_0x409a74,_0x2c55eb){return client['request'](_0x437bac,_0x262520)[_0x9121('0xc')](function(_0x2bf1d6){logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,'request\x20sent');logger[_0x9121('0xf')](_0x9121('0x10'),_0x1387b7,_0x9121('0x11'),JSON[_0x9121('0x12')](_0x2bf1d6));if(_0x2bf1d6[_0x9121('0x13')]){if(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x14')]===0x1f4){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);return _0x2c55eb(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x2bf1d6['error'][_0x9121('0x15')]);return _0x409a74(_0x2bf1d6[_0x9121('0x13')][_0x9121('0x15')]);}else{logger[_0x9121('0xd')](_0x9121('0xe'),_0x1387b7,_0x9121('0x11'));_0x409a74(_0x2bf1d6['result']['message']);}})[_0x9121('0x16')](function(_0x200a28){logger[_0x9121('0x13')](_0x9121('0xe'),_0x1387b7,_0x200a28);_0x2c55eb(_0x200a28);});});} \ No newline at end of file +var _0xa596=['VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent','debug'];(function(_0x1a975d,_0x48700e){var _0x5ad4ea=function(_0x1ff72c){while(--_0x1ff72c){_0x1a975d['push'](_0x1a975d['shift']());}};_0x5ad4ea(++_0x48700e);}(_0xa596,0x7b));var _0x6a59=function(_0x35fcf5,_0x2bd71f){_0x35fcf5=_0x35fcf5-0x0;var _0x1e35d9=_0xa596[_0x35fcf5];return _0x1e35d9;};'use strict';var _=require(_0x6a59('0x0'));var util=require(_0x6a59('0x1'));var moment=require('moment');var BPromise=require(_0x6a59('0x2'));var rs=require(_0x6a59('0x3'));var fs=require('fs');var Redis=require(_0x6a59('0x4'));var db=require(_0x6a59('0x5'))['db'];var utils=require(_0x6a59('0x6'));var logger=require(_0x6a59('0x7'))(_0x6a59('0x8'));var config=require(_0x6a59('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a59('0xa')][_0x6a59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e97f,_0x375a77,_0xb50532){return new BPromise(function(_0x3c392f,_0x5aa5fe){return client[_0x6a59('0xc')](_0x21e97f,_0xb50532)['then'](function(_0x21008c){logger['info']('VtigerField,\x20%s,\x20%s',_0x375a77,_0x6a59('0xd'));logger[_0x6a59('0xe')](_0x6a59('0xf'),_0x375a77,'request\x20sent',JSON[_0x6a59('0x10')](_0x21008c));if(_0x21008c[_0x6a59('0x11')]){if(_0x21008c['error'][_0x6a59('0x12')]===0x1f4){logger['error'](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x5aa5fe(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}logger[_0x6a59('0x11')](_0x6a59('0x13'),_0x375a77,_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);return _0x3c392f(_0x21008c[_0x6a59('0x11')][_0x6a59('0x14')]);}else{logger['info'](_0x6a59('0x13'),_0x375a77,_0x6a59('0xd'));_0x3c392f(_0x21008c[_0x6a59('0x15')][_0x6a59('0x14')]);}})[_0x6a59('0x16')](function(_0x39ad1e){logger['error'](_0x6a59('0x13'),_0x375a77,_0x39ad1e);_0x5aa5fe(_0x39ad1e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4ff18f6..58ca0b6 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 _0xafe5=['getFields','post','create','addConfiguration','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x41c19d,_0x4b0d99){var _0x4da0b5=function(_0x3af2c8){while(--_0x3af2c8){_0x41c19d['push'](_0x41c19d['shift']());}};_0x4da0b5(++_0x4b0d99);}(_0xafe5,0x124));var _0x5afe=function(_0x557605,_0x4d1457){_0x557605=_0x557605-0x0;var _0x49e350=_0xafe5[_0x557605];return _0x49e350;};'use strict';var multer=require('multer');var util=require(_0x5afe('0x0'));var path=require(_0x5afe('0x1'));var timeout=require(_0x5afe('0x2'));var express=require(_0x5afe('0x3'));var router=express[_0x5afe('0x4')]();var auth=require(_0x5afe('0x5'));var interaction=require(_0x5afe('0x6'));var config=require('../../config/environment');var controller=require(_0x5afe('0x7'));router[_0x5afe('0x8')]('/',auth[_0x5afe('0x9')](),controller[_0x5afe('0xa')]);router[_0x5afe('0x8')](_0x5afe('0xb'),auth[_0x5afe('0x9')](),controller[_0x5afe('0xc')]);router[_0x5afe('0x8')](_0x5afe('0xd'),auth[_0x5afe('0x9')](),controller[_0x5afe('0xe')]);router[_0x5afe('0x8')](_0x5afe('0xf'),auth[_0x5afe('0x9')](),controller[_0x5afe('0x10')]);router[_0x5afe('0x11')]('/',auth[_0x5afe('0x9')](),controller[_0x5afe('0x12')]);router[_0x5afe('0x11')](_0x5afe('0xd'),auth['isAuthenticated'](),controller[_0x5afe('0x13')]);router['put'](_0x5afe('0xb'),auth[_0x5afe('0x9')](),controller[_0x5afe('0x14')]);router['delete'](_0x5afe('0xb'),auth[_0x5afe('0x9')](),controller[_0x5afe('0x15')]);module['exports']=router; \ No newline at end of file +var _0x813b=['getFields','post','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1118eb,_0x476f0a){var _0x2dbcd0=function(_0x37c71e){while(--_0x37c71e){_0x1118eb['push'](_0x1118eb['shift']());}};_0x2dbcd0(++_0x476f0a);}(_0x813b,0x16f));var _0xb813=function(_0x30c2d0,_0x442780){_0x30c2d0=_0x30c2d0-0x0;var _0x5a3191=_0x813b[_0x30c2d0];return _0x5a3191;};'use strict';var multer=require(_0xb813('0x0'));var util=require(_0xb813('0x1'));var path=require(_0xb813('0x2'));var timeout=require(_0xb813('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb813('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb813('0x5'));var controller=require('./intZendeskAccount.controller');router[_0xb813('0x6')]('/',auth[_0xb813('0x7')](),controller['index']);router[_0xb813('0x6')](_0xb813('0x8'),auth[_0xb813('0x7')](),controller[_0xb813('0x9')]);router[_0xb813('0x6')](_0xb813('0xa'),auth[_0xb813('0x7')](),controller[_0xb813('0xb')]);router[_0xb813('0x6')](_0xb813('0xc'),auth[_0xb813('0x7')](),controller[_0xb813('0xd')]);router[_0xb813('0xe')]('/',auth[_0xb813('0x7')](),controller[_0xb813('0xf')]);router['post']('/:id/configurations',auth[_0xb813('0x7')](),controller['addConfiguration']);router[_0xb813('0x10')](_0xb813('0x8'),auth['isAuthenticated'](),controller[_0xb813('0x11')]);router[_0xb813('0x12')]('/:id',auth[_0xb813('0x7')](),controller['destroy']);module[_0xb813('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 33cbce3..0945181 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 _0x8040=['integrationTab','newTab','exports','STRING','username','ENUM','token'];(function(_0x3b50c0,_0x418f4a){var _0x57e46e=function(_0x1af4c9){while(--_0x1af4c9){_0x3b50c0['push'](_0x3b50c0['shift']());}};_0x57e46e(++_0x418f4a);}(_0x8040,0x160));var _0x0804=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x8040[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require('sequelize');module[_0x0804('0x0')]={'name':{'type':Sequelize[_0x0804('0x1')]},'description':{'type':Sequelize[_0x0804('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0804('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0804('0x1')]},'remoteUri':{'type':Sequelize[_0x0804('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x0804('0x3')]('password',_0x0804('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x0804('0x1')]},'type':{'type':Sequelize[_0x0804('0x3')](_0x0804('0x5'),_0x0804('0x6')),'defaultValue':_0x0804('0x5')}}; \ No newline at end of file +var _0x138a=['integrationTab','newTab','sequelize','STRING','ENUM','password','token'];(function(_0xec4da0,_0x34250f){var _0x1f72c7=function(_0x46fc1f){while(--_0x46fc1f){_0xec4da0['push'](_0xec4da0['shift']());}};_0x1f72c7(++_0x34250f);}(_0x138a,0xb8));var _0xa138=function(_0x56e3ed,_0x41ac98){_0x56e3ed=_0x56e3ed-0x0;var _0x534acb=_0x138a[_0x56e3ed];return _0x534acb;};'use strict';var Sequelize=require(_0xa138('0x0'));module['exports']={'name':{'type':Sequelize[_0xa138('0x1')]},'description':{'type':Sequelize[_0xa138('0x1')]},'username':{'type':Sequelize[_0xa138('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xa138('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa138('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xa138('0x2')](_0xa138('0x3'),_0xa138('0x4')),'defaultValue':_0xa138('0x3')},'serverUrl':{'type':Sequelize[_0xa138('0x1')]},'type':{'type':Sequelize[_0xa138('0x2')](_0xa138('0x5'),_0xa138('0x6')),'defaultValue':_0xa138('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 389afa8..970ede1 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 _0xfcb0=['sendStatus','status','end','json','offset','limit','apply','reject','destroy','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','params','options','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','order','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','username','password','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0xfcb0,0xce));var _0x0fcb=function(_0x1d9aff,_0x1e9f79){_0x1d9aff=_0x1d9aff-0x0;var _0x4418e9=_0xfcb0[_0x1d9aff];return _0x4418e9;};'use strict';var pdf=require(_0x0fcb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0fcb('0x1'));var zipdir=require(_0x0fcb('0x2'));var jsonpatch=require(_0x0fcb('0x3'));var rp=require('request-promise');var moment=require(_0x0fcb('0x4'));var BPromise=require(_0x0fcb('0x5'));var Mustache=require(_0x0fcb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0fcb('0x7'));var csv=require(_0x0fcb('0x8'));var ejs=require(_0x0fcb('0x9'));var fs=require('fs');var _=require(_0x0fcb('0xa'));var squel=require('squel');var crypto=require(_0x0fcb('0xb'));var jsforce=require(_0x0fcb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0fcb('0xd'));var Papa=require(_0x0fcb('0xe'));var Redis=require(_0x0fcb('0xf'));var authService=require(_0x0fcb('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fcb('0x11'));var logger=require(_0x0fcb('0x12'))(_0x0fcb('0x13'));var utils=require(_0x0fcb('0x14'));var config=require(_0x0fcb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fcb('0x16'))['db'];var integrations=require(_0x0fcb('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x0fcb('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554fee,_0x3cfbcf,_0x5e3437,_0x5680c6){return new BPromise(function(_0x433870,_0x4ba04e){var _0x39c48f=_0x5680c6||client;return _0x39c48f[_0x0fcb('0x19')](_0x554fee,_0x5e3437)[_0x0fcb('0x1a')](function(_0x4be144){logger['info'](_0x0fcb('0x1b'),_0x3cfbcf,_0x0fcb('0x1c'));logger[_0x0fcb('0x1d')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x3cfbcf,'request\x20sent',JSON[_0x0fcb('0x1e')](_0x4be144));if(_0x4be144[_0x0fcb('0x1f')]){if(_0x4be144[_0x0fcb('0x1f')][_0x0fcb('0x20')]===0x1f4){logger[_0x0fcb('0x1f')](_0x0fcb('0x1b'),_0x3cfbcf,_0x4be144['error']['message']);return _0x4ba04e(_0x4be144[_0x0fcb('0x1f')][_0x0fcb('0x21')]);}logger[_0x0fcb('0x1f')](_0x0fcb('0x1b'),_0x3cfbcf,_0x4be144[_0x0fcb('0x1f')]['message']);return _0x433870(_0x4be144['error']['message']);}else{logger[_0x0fcb('0x22')]('ZendeskAccount,\x20%s,\x20%s',_0x3cfbcf,_0x0fcb('0x1c'));_0x433870(_0x4be144[_0x0fcb('0x23')][_0x0fcb('0x21')]);}})['catch'](function(_0x4962d4){logger[_0x0fcb('0x1f')](_0x0fcb('0x1b'),_0x3cfbcf,_0x4962d4);_0x4ba04e(_0x4962d4);});});}function respondWithStatusCode(_0x1cd529,_0x1ad67d){_0x1ad67d=_0x1ad67d||0xcc;return function(_0xd2c692){if(_0xd2c692){return _0x1cd529[_0x0fcb('0x24')](_0x1ad67d);}return _0x1cd529[_0x0fcb('0x25')](_0x1ad67d)[_0x0fcb('0x26')]();};}function respondWithResult(_0x410e20,_0x5888a2){_0x5888a2=_0x5888a2||0xc8;return function(_0x3a408d){if(_0x3a408d){return _0x410e20[_0x0fcb('0x25')](_0x5888a2)[_0x0fcb('0x27')](_0x3a408d);}};}function respondWithFilteredResult(_0x31db40,_0x16d013){return function(_0x5633ef){if(_0x5633ef){var _0x1b3f04=_0x5633ef['count'],_0x4fd82c=_0x16d013[_0x0fcb('0x28')],_0x987b55=_0x16d013[_0x0fcb('0x28')]+_0x16d013[_0x0fcb('0x29')],_0x2c5e53;if(_0x987b55>=_0x1b3f04){_0x987b55=_0x1b3f04;_0x2c5e53=0xc8;}else{_0x2c5e53=0xce;}_0x31db40[_0x0fcb('0x25')](_0x2c5e53);return _0x31db40['set']('Content-Range',_0x4fd82c+'-'+_0x987b55+'/'+_0x1b3f04)[_0x0fcb('0x27')](_0x5633ef);}return null;};}function patchUpdates(_0x11a4c7){return function(_0x24c0aa){try{jsonpatch[_0x0fcb('0x2a')](_0x24c0aa,_0x11a4c7,!![]);}catch(_0x109c92){return BPromise[_0x0fcb('0x2b')](_0x109c92);}return _0x24c0aa['save']();};}function saveUpdates(_0x44562f,_0x1c578c){return function(_0x4eae24){if(_0x4eae24){return _0x4eae24['update'](_0x44562f)[_0x0fcb('0x1a')](function(_0x441507){return _0x441507;});}return null;};}function removeEntity(_0x5848ab,_0x43d9d2){return function(_0x40e24f){if(_0x40e24f){return _0x40e24f[_0x0fcb('0x2c')]()[_0x0fcb('0x1a')](function(){_0x5848ab['status'](0xcc)[_0x0fcb('0x26')]();});}};}function handleEntityNotFound(_0x3bd7d8,_0xffa1cf){return function(_0x40c523){if(!_0x40c523){_0x3bd7d8[_0x0fcb('0x24')](0x194);}return _0x40c523;};}function handleError(_0x5e7bd9,_0x5e8506){_0x5e8506=_0x5e8506||0x1f4;return function(_0x3b5fba){logger[_0x0fcb('0x1f')](_0x3b5fba['stack']);if(_0x3b5fba['name']){delete _0x3b5fba[_0x0fcb('0x2d')];}_0x5e7bd9[_0x0fcb('0x25')](_0x5e8506)[_0x0fcb('0x2e')](_0x3b5fba);};}exports[_0x0fcb('0x2f')]=function(_0xa388fd,_0x2444d3){var _0x590116={},_0x6eefa={},_0x588b79={'count':0x0,'rows':[]};var _0x3e05a4=_[_0x0fcb('0x30')](db[_0x0fcb('0x31')][_0x0fcb('0x32')],function(_0x42a0ff){return{'name':_0x42a0ff[_0x0fcb('0x33')],'type':_0x42a0ff[_0x0fcb('0x34')][_0x0fcb('0x35')]};});_0x6eefa['model']=_[_0x0fcb('0x30')](_0x3e05a4,_0x0fcb('0x2d'));_0x6eefa[_0x0fcb('0x36')]=_[_0x0fcb('0x37')](_0xa388fd[_0x0fcb('0x36')]);_0x6eefa[_0x0fcb('0x38')]=_[_0x0fcb('0x39')](_0x6eefa[_0x0fcb('0x3a')],_0x6eefa[_0x0fcb('0x36')]);_0x590116['attributes']=_[_0x0fcb('0x39')](_0x6eefa[_0x0fcb('0x3a')],qs[_0x0fcb('0x3b')](_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x3b')]));_0x590116[_0x0fcb('0x3c')]=_0x590116[_0x0fcb('0x3c')][_0x0fcb('0x3d')]?_0x590116['attributes']:_0x6eefa['model'];if(!_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x3e')](_0x0fcb('0x3f'))){_0x590116[_0x0fcb('0x29')]=qs[_0x0fcb('0x29')](_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x29')]);_0x590116['offset']=qs[_0x0fcb('0x28')](_0xa388fd['query'][_0x0fcb('0x28')]);}_0x590116['order']=qs[_0x0fcb('0x40')](_0xa388fd[_0x0fcb('0x36')]['sort']);_0x590116['where']=qs[_0x0fcb('0x38')](_[_0x0fcb('0x41')](_0xa388fd[_0x0fcb('0x36')],_0x6eefa['filters']),_0x3e05a4);if(_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x42')]){_0x590116[_0x0fcb('0x43')]=_[_0x0fcb('0x44')](_0x590116['where'],{'$or':_['map'](_0x3e05a4,function(_0x45033b){if(_0x45033b['type']!==_0x0fcb('0x45')){var _0xcdc95b={};_0xcdc95b[_0x45033b[_0x0fcb('0x2d')]]={'$like':'%'+_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x42')]+'%'};return _0xcdc95b;}})});}_0x590116=_[_0x0fcb('0x44')]({},_0x590116,_0xa388fd['options']);var _0x596070={'where':_0x590116[_0x0fcb('0x43')]};return db[_0x0fcb('0x31')][_0x0fcb('0x46')](_0x596070)[_0x0fcb('0x1a')](function(_0x43ac64){_0x588b79[_0x0fcb('0x46')]=_0x43ac64;if(_0xa388fd[_0x0fcb('0x36')][_0x0fcb('0x47')]){_0x590116[_0x0fcb('0x48')]=[{'all':!![]}];}return db[_0x0fcb('0x31')][_0x0fcb('0x49')](_0x590116);})[_0x0fcb('0x1a')](function(_0x15d0cd){_0x588b79['rows']=_0x15d0cd;return _0x588b79;})[_0x0fcb('0x1a')](respondWithFilteredResult(_0x2444d3,_0x590116))[_0x0fcb('0x4a')](handleError(_0x2444d3,null));};exports['show']=function(_0x1ce7e2,_0x323c4e){var _0x42e7e1={'raw':![],'where':{'id':_0x1ce7e2[_0x0fcb('0x4b')]['id']}},_0x2232a4={};_0x2232a4[_0x0fcb('0x3a')]=_[_0x0fcb('0x37')](db[_0x0fcb('0x31')][_0x0fcb('0x32')]);_0x2232a4[_0x0fcb('0x36')]=_[_0x0fcb('0x37')](_0x1ce7e2[_0x0fcb('0x36')]);_0x2232a4['filtears']=_[_0x0fcb('0x39')](_0x2232a4[_0x0fcb('0x3a')],_0x2232a4[_0x0fcb('0x36')]);_0x42e7e1[_0x0fcb('0x3c')]=_['intersection'](_0x2232a4[_0x0fcb('0x3a')],qs[_0x0fcb('0x3b')](_0x1ce7e2[_0x0fcb('0x36')][_0x0fcb('0x3b')]));_0x42e7e1['attributes']=_0x42e7e1[_0x0fcb('0x3c')][_0x0fcb('0x3d')]?_0x42e7e1[_0x0fcb('0x3c')]:_0x2232a4[_0x0fcb('0x3a')];if(_0x1ce7e2[_0x0fcb('0x36')][_0x0fcb('0x47')]){_0x42e7e1[_0x0fcb('0x48')]=[{'all':!![]}];}_0x42e7e1=_[_0x0fcb('0x44')]({},_0x42e7e1,_0x1ce7e2[_0x0fcb('0x4c')]);return db[_0x0fcb('0x31')][_0x0fcb('0x4d')](_0x42e7e1)[_0x0fcb('0x1a')](handleEntityNotFound(_0x323c4e,null))[_0x0fcb('0x1a')](respondWithResult(_0x323c4e,null))['catch'](handleError(_0x323c4e,null));};exports[_0x0fcb('0x4e')]=function(_0x56b71a,_0x371896){return db['ZendeskAccount'][_0x0fcb('0x4e')](_0x56b71a[_0x0fcb('0x4f')],{})['then'](respondWithResult(_0x371896,0xc9))['catch'](handleError(_0x371896,null));};exports[_0x0fcb('0x50')]=function(_0x3df864,_0x3ca7ba){if(_0x3df864[_0x0fcb('0x4f')]['id']){delete _0x3df864[_0x0fcb('0x4f')]['id'];}return db[_0x0fcb('0x31')][_0x0fcb('0x4d')]({'where':{'id':_0x3df864[_0x0fcb('0x4b')]['id']}})[_0x0fcb('0x1a')](handleEntityNotFound(_0x3ca7ba,null))[_0x0fcb('0x1a')](saveUpdates(_0x3df864[_0x0fcb('0x4f')],null))[_0x0fcb('0x1a')](respondWithResult(_0x3ca7ba,null))['catch'](handleError(_0x3ca7ba,null));};exports[_0x0fcb('0x2c')]=function(_0x3dc612,_0x3abf6b){return db['ZendeskAccount'][_0x0fcb('0x4d')]({'where':{'id':_0x3dc612[_0x0fcb('0x4b')]['id']}})[_0x0fcb('0x1a')](handleEntityNotFound(_0x3abf6b,null))[_0x0fcb('0x1a')](removeEntity(_0x3abf6b,null))['catch'](handleError(_0x3abf6b,null));};exports[_0x0fcb('0x51')]=function(_0x598fad,_0xe34f2c,_0x527e12){var _0xc2af49={};var _0xedfd7b={};var _0x5d0f4f;var _0x14a5ce;return db['ZendeskAccount'][_0x0fcb('0x52')]({'where':{'id':_0x598fad['params']['id']}})[_0x0fcb('0x1a')](handleEntityNotFound(_0xe34f2c,null))[_0x0fcb('0x1a')](function(_0x531ada){if(_0x531ada){_0x5d0f4f=_0x531ada;_0xedfd7b[_0x0fcb('0x3a')]=_['keys'](db[_0x0fcb('0x53')][_0x0fcb('0x32')]);_0xedfd7b[_0x0fcb('0x36')]=_[_0x0fcb('0x37')](_0x598fad[_0x0fcb('0x36')]);_0xedfd7b['filters']=_[_0x0fcb('0x39')](_0xedfd7b['model'],_0xedfd7b['query']);_0xc2af49['attributes']=_[_0x0fcb('0x39')](_0xedfd7b[_0x0fcb('0x3a')],qs['fields'](_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x3b')]));_0xc2af49[_0x0fcb('0x3c')]=_0xc2af49[_0x0fcb('0x3c')][_0x0fcb('0x3d')]?_0xc2af49[_0x0fcb('0x3c')]:_0xedfd7b[_0x0fcb('0x3a')];_0xc2af49[_0x0fcb('0x54')]=qs[_0x0fcb('0x40')](_0x598fad[_0x0fcb('0x36')]['sort']);_0xc2af49['where']=qs[_0x0fcb('0x38')](_[_0x0fcb('0x41')](_0x598fad['query'],_0xedfd7b[_0x0fcb('0x38')]));if(_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x42')]){_0xc2af49[_0x0fcb('0x43')]=_['merge'](_0xc2af49[_0x0fcb('0x43')],{'$or':_[_0x0fcb('0x30')](_0xc2af49['attributes'],function(_0x23a8d5){var _0x3d2429={};_0x3d2429[_0x23a8d5]={'$like':'%'+_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x42')]+'%'};return _0x3d2429;})});}_0xc2af49=_[_0x0fcb('0x44')]({},_0xc2af49,_0x598fad[_0x0fcb('0x4c')]);return _0x5d0f4f[_0x0fcb('0x51')](_0xc2af49);}})[_0x0fcb('0x1a')](function(_0x406ef9){if(_0x406ef9){_0x14a5ce=_0x406ef9[_0x0fcb('0x3d')];if(!_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x3e')](_0x0fcb('0x3f'))){_0xc2af49[_0x0fcb('0x29')]=qs[_0x0fcb('0x29')](_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x29')]);_0xc2af49['offset']=qs[_0x0fcb('0x28')](_0x598fad[_0x0fcb('0x36')][_0x0fcb('0x28')]);}return _0x5d0f4f[_0x0fcb('0x51')](_0xc2af49);}})[_0x0fcb('0x1a')](function(_0x520fe1){if(_0x520fe1){return _0x520fe1?{'count':_0x14a5ce,'rows':_0x520fe1}:null;}})[_0x0fcb('0x1a')](respondWithResult(_0xe34f2c,null))[_0x0fcb('0x4a')](handleError(_0xe34f2c,null));};exports['addConfiguration']=function(_0x4feaf1,_0x559447,_0x1062b0){if(_0x4feaf1[_0x0fcb('0x4f')]['id']){delete _0x4feaf1[_0x0fcb('0x4f')]['id'];}return db['ZendeskAccount'][_0x0fcb('0x52')]({'where':{'id':_0x4feaf1[_0x0fcb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x559447,null))[_0x0fcb('0x1a')](function(_0x210383){if(_0x210383){_0x4feaf1[_0x0fcb('0x4f')][_0x0fcb('0x55')]=_0x210383['id'];_0x4feaf1['body'][_0x0fcb('0x56')]=integrations[_0x0fcb('0x57')](_0x4feaf1[_0x0fcb('0x4f')][_0x0fcb('0x58')],_0x4feaf1[_0x0fcb('0x4f')][_0x0fcb('0x34')]);_0x4feaf1[_0x0fcb('0x4f')][_0x0fcb('0x59')]=integrations['getDescriptions'](_0x4feaf1[_0x0fcb('0x4f')][_0x0fcb('0x58')],_0x4feaf1[_0x0fcb('0x4f')]['type']);return db[_0x0fcb('0x53')][_0x0fcb('0x4e')](_0x4feaf1['body'],{'include':[{'model':db[_0x0fcb('0x5a')],'as':_0x0fcb('0x56')},{'model':db[_0x0fcb('0x5a')],'as':_0x0fcb('0x59')}]});}return null;})[_0x0fcb('0x1a')](respondWithResult(_0x559447,null))['catch'](handleError(_0x559447,null));};exports[_0x0fcb('0x5b')]=function(_0x4039a9,_0x3368d7,_0x3d3d93){var _0xb6de9b='';return db[_0x0fcb('0x31')]['findOne']({'where':{'id':_0x4039a9[_0x0fcb('0x4b')]['id']},'attributes':['id',_0x0fcb('0x5c'),_0x0fcb('0x5d'),'token','authType',_0x0fcb('0x5e')]})[_0x0fcb('0x1a')](handleEntityNotFound(_0x3368d7,null))[_0x0fcb('0x1a')](function(_0x5974e6){if(_0x5974e6){_0xb6de9b=_0x5974e6['remoteUri'];var _0x4a7937=_0xb6de9b['slice'](-0x1);if(_0x4a7937==='/'){_0xb6de9b=_0xb6de9b[_0x0fcb('0x5f')](0x0,_0xb6de9b[_0x0fcb('0x60')](_0x4a7937));}var _0x4f844a={'method':'GET','uri':util[_0x0fcb('0x61')](_0x0fcb('0x62'),_0xb6de9b,_0x0fcb('0x63')),'json':!![]};switch(_0x5974e6[_0x0fcb('0x64')]){case'password':_0x4f844a[_0x0fcb('0x65')]={'Authorization':util[_0x0fcb('0x61')](_0x0fcb('0x66'),new Buffer(util[_0x0fcb('0x61')](_0x0fcb('0x67'),_0x5974e6[_0x0fcb('0x5c')],_0x5974e6[_0x0fcb('0x5d')]))[_0x0fcb('0x68')](_0x0fcb('0x69')))};break;case _0x0fcb('0x6a'):_0x4f844a['headers']={'Authorization':util[_0x0fcb('0x61')](_0x0fcb('0x66'),new Buffer(util[_0x0fcb('0x61')](_0x0fcb('0x6b'),_0x5974e6[_0x0fcb('0x5c')],_0x5974e6[_0x0fcb('0x6a')]))[_0x0fcb('0x68')]('base64'))};break;default:throw new db[(_0x0fcb('0x6c'))]['ValidationError'](_0x0fcb('0x6d'));}return rp(_0x4f844a);}})[_0x0fcb('0x1a')](function(_0x9d65d3){if(_0x9d65d3){var _0x33f954=['subject',_0x0fcb('0x6e'),_0x0fcb('0x6f'),'assignee'];_[_0x0fcb('0x70')](_0x9d65d3['ticket_fields'],function(_0x340ccc){return _0x33f954['includes'](_0x340ccc['type']);});return{'count':_0x9d65d3[_0x0fcb('0x63')]['length'],'rows':_[_0x0fcb('0x30')](_0x9d65d3['ticket_fields'],function(_0x464f13){return{'id':_0x464f13['id'],'name':_0x464f13[_0x0fcb('0x71')]>0x7?_0x464f13[_0x0fcb('0x72')]:_0x464f13[_0x0fcb('0x34')],'custom':_0x464f13[_0x0fcb('0x71')]>0x7?!![]:![],'options':_0x464f13[_0x0fcb('0x73')]?_0x464f13[_0x0fcb('0x73')]:_0x464f13[_0x0fcb('0x74')]?_0x464f13[_0x0fcb('0x74')]:[]};})};}})[_0x0fcb('0x1a')](respondWithResult(_0x3368d7,null))[_0x0fcb('0x4a')](function(_0x20700d){var _0x444321=_0x4039a9['query']['test']?0x1f4:_0x20700d[_0x0fcb('0x75')]||0x1f4;logger['error'](_0x0fcb('0x76'),_0x0fcb('0x5b'),_0x444321,JSON[_0x0fcb('0x1e')](_0x20700d));delete _0x20700d[_0x0fcb('0x2d')];if(_0x444321===0x191){_0x444321=0x190;}_0x3368d7[_0x0fcb('0x25')](_0x444321)[_0x0fcb('0x2e')](_0x4039a9[_0x0fcb('0x36')][_0x0fcb('0x77')]?{'message':_0x0fcb('0x78'),'statusCode':_0x20700d[_0x0fcb('0x75')]}:_0x20700d);});}; \ No newline at end of file +var _0x57ca=['rows','show','params','rawAttributes','filtears','includeAll','find','catch','create','body','update','getConfigurations','findOne','ZendeskConfiguration','length','order','pick','addConfiguration','Subjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','GET','format','%s/%s','ticket_fields','Basic\x20%s','toString','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','destroy','stack','name','send','index','map','type','key','keys','intersection','model','fields','query','attributes','hasOwnProperty','nolimit','sort','filters','filter','merge','where','VIRTUAL','options','include','ZendeskAccount'];(function(_0x30bf81,_0x4c00c5){var _0x148a30=function(_0x320430){while(--_0x320430){_0x30bf81['push'](_0x30bf81['shift']());}};_0x148a30(++_0x4c00c5);}(_0x57ca,0x12b));var _0xa57c=function(_0x521fb2,_0x38bedf){_0x521fb2=_0x521fb2-0x0;var _0x9f162c=_0x57ca[_0x521fb2];return _0x9f162c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require(_0xa57c('0x7'));var path=require('path');var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa57c('0xb'));var crypto=require('crypto');var jsforce=require(_0xa57c('0xc'));var deskjs=require(_0xa57c('0xd'));var toCsv=require(_0xa57c('0x9'));var querystring=require(_0xa57c('0xe'));var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require(_0xa57c('0x11'));var qs=require(_0xa57c('0x12'));var as=require(_0xa57c('0x13'));var hardwareService=require(_0xa57c('0x14'));var logger=require(_0xa57c('0x15'))(_0xa57c('0x16'));var utils=require(_0xa57c('0x17'));var config=require(_0xa57c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa57c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa57c('0x1a'));var client=jayson[_0xa57c('0x1b')][_0xa57c('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x498f47,_0x5da3c7,_0x556155,_0x2d1bde){return new BPromise(function(_0x2e04e7,_0x3e069e){var _0x43c723=_0x2d1bde||client;return _0x43c723['request'](_0x498f47,_0x556155)[_0xa57c('0x1d')](function(_0x162ca1){logger['info'](_0xa57c('0x1e'),_0x5da3c7,_0xa57c('0x1f'));logger[_0xa57c('0x20')](_0xa57c('0x21'),_0x5da3c7,_0xa57c('0x1f'),JSON[_0xa57c('0x22')](_0x162ca1));if(_0x162ca1[_0xa57c('0x23')]){if(_0x162ca1[_0xa57c('0x23')][_0xa57c('0x24')]===0x1f4){logger[_0xa57c('0x23')](_0xa57c('0x1e'),_0x5da3c7,_0x162ca1[_0xa57c('0x23')][_0xa57c('0x25')]);return _0x3e069e(_0x162ca1[_0xa57c('0x23')][_0xa57c('0x25')]);}logger[_0xa57c('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x5da3c7,_0x162ca1[_0xa57c('0x23')][_0xa57c('0x25')]);return _0x2e04e7(_0x162ca1[_0xa57c('0x23')][_0xa57c('0x25')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x5da3c7,'request\x20sent');_0x2e04e7(_0x162ca1['result'][_0xa57c('0x25')]);}})['catch'](function(_0x54c9bf){logger[_0xa57c('0x23')](_0xa57c('0x1e'),_0x5da3c7,_0x54c9bf);_0x3e069e(_0x54c9bf);});});}function respondWithStatusCode(_0x3e217b,_0x3f0259){_0x3f0259=_0x3f0259||0xcc;return function(_0x30bdeb){if(_0x30bdeb){return _0x3e217b[_0xa57c('0x26')](_0x3f0259);}return _0x3e217b['status'](_0x3f0259)[_0xa57c('0x27')]();};}function respondWithResult(_0x55d7df,_0xe893f5){_0xe893f5=_0xe893f5||0xc8;return function(_0x243759){if(_0x243759){return _0x55d7df[_0xa57c('0x28')](_0xe893f5)[_0xa57c('0x29')](_0x243759);}};}function respondWithFilteredResult(_0x33c2d3,_0x456322){return function(_0x51ce8c){if(_0x51ce8c){var _0xc47e6e=_0x51ce8c[_0xa57c('0x2a')],_0x2aad18=_0x456322['offset'],_0x3bb271=_0x456322[_0xa57c('0x2b')]+_0x456322[_0xa57c('0x2c')],_0x22281f;if(_0x3bb271>=_0xc47e6e){_0x3bb271=_0xc47e6e;_0x22281f=0xc8;}else{_0x22281f=0xce;}_0x33c2d3['status'](_0x22281f);return _0x33c2d3[_0xa57c('0x2d')](_0xa57c('0x2e'),_0x2aad18+'-'+_0x3bb271+'/'+_0xc47e6e)[_0xa57c('0x29')](_0x51ce8c);}return null;};}function patchUpdates(_0x481c4b){return function(_0x19953d){try{jsonpatch['apply'](_0x19953d,_0x481c4b,!![]);}catch(_0x2e8eff){return BPromise[_0xa57c('0x2f')](_0x2e8eff);}return _0x19953d['save']();};}function saveUpdates(_0x3b7ebf,_0x679f16){return function(_0x32c67f){if(_0x32c67f){return _0x32c67f['update'](_0x3b7ebf)['then'](function(_0x30d8f8){return _0x30d8f8;});}return null;};}function removeEntity(_0x1191bd,_0x355e28){return function(_0x286ac6){if(_0x286ac6){return _0x286ac6[_0xa57c('0x30')]()[_0xa57c('0x1d')](function(){_0x1191bd['status'](0xcc)[_0xa57c('0x27')]();});}};}function handleEntityNotFound(_0x5289bb,_0x2379b6){return function(_0x5a30e5){if(!_0x5a30e5){_0x5289bb[_0xa57c('0x26')](0x194);}return _0x5a30e5;};}function handleError(_0x83636b,_0x104e0c){_0x104e0c=_0x104e0c||0x1f4;return function(_0x15f260){logger['error'](_0x15f260[_0xa57c('0x31')]);if(_0x15f260[_0xa57c('0x32')]){delete _0x15f260[_0xa57c('0x32')];}_0x83636b[_0xa57c('0x28')](_0x104e0c)[_0xa57c('0x33')](_0x15f260);};}exports[_0xa57c('0x34')]=function(_0x2c76b2,_0x1eda03){var _0x44c652={},_0x483730={},_0x2f6d4c={'count':0x0,'rows':[]};var _0x31b6fe=_[_0xa57c('0x35')](db['ZendeskAccount']['rawAttributes'],function(_0x306abb){return{'name':_0x306abb['fieldName'],'type':_0x306abb[_0xa57c('0x36')][_0xa57c('0x37')]};});_0x483730['model']=_['map'](_0x31b6fe,_0xa57c('0x32'));_0x483730['query']=_[_0xa57c('0x38')](_0x2c76b2['query']);_0x483730['filters']=_[_0xa57c('0x39')](_0x483730[_0xa57c('0x3a')],_0x483730['query']);_0x44c652['attributes']=_[_0xa57c('0x39')](_0x483730[_0xa57c('0x3a')],qs[_0xa57c('0x3b')](_0x2c76b2[_0xa57c('0x3c')][_0xa57c('0x3b')]));_0x44c652[_0xa57c('0x3d')]=_0x44c652['attributes']['length']?_0x44c652[_0xa57c('0x3d')]:_0x483730[_0xa57c('0x3a')];if(!_0x2c76b2[_0xa57c('0x3c')][_0xa57c('0x3e')](_0xa57c('0x3f'))){_0x44c652[_0xa57c('0x2c')]=qs['limit'](_0x2c76b2[_0xa57c('0x3c')]['limit']);_0x44c652[_0xa57c('0x2b')]=qs['offset'](_0x2c76b2['query'][_0xa57c('0x2b')]);}_0x44c652['order']=qs[_0xa57c('0x40')](_0x2c76b2[_0xa57c('0x3c')][_0xa57c('0x40')]);_0x44c652['where']=qs[_0xa57c('0x41')](_['pick'](_0x2c76b2[_0xa57c('0x3c')],_0x483730[_0xa57c('0x41')]),_0x31b6fe);if(_0x2c76b2[_0xa57c('0x3c')][_0xa57c('0x42')]){_0x44c652['where']=_[_0xa57c('0x43')](_0x44c652[_0xa57c('0x44')],{'$or':_['map'](_0x31b6fe,function(_0x4bb77b){if(_0x4bb77b[_0xa57c('0x36')]!==_0xa57c('0x45')){var _0x19b95a={};_0x19b95a[_0x4bb77b[_0xa57c('0x32')]]={'$like':'%'+_0x2c76b2['query'][_0xa57c('0x42')]+'%'};return _0x19b95a;}})});}_0x44c652=_[_0xa57c('0x43')]({},_0x44c652,_0x2c76b2[_0xa57c('0x46')]);var _0x22899b={'where':_0x44c652['where']};return db['ZendeskAccount']['count'](_0x22899b)[_0xa57c('0x1d')](function(_0x3de9d5){_0x2f6d4c['count']=_0x3de9d5;if(_0x2c76b2[_0xa57c('0x3c')]['includeAll']){_0x44c652[_0xa57c('0x47')]=[{'all':!![]}];}return db[_0xa57c('0x48')]['findAll'](_0x44c652);})[_0xa57c('0x1d')](function(_0x22eb8a){_0x2f6d4c[_0xa57c('0x49')]=_0x22eb8a;return _0x2f6d4c;})['then'](respondWithFilteredResult(_0x1eda03,_0x44c652))['catch'](handleError(_0x1eda03,null));};exports[_0xa57c('0x4a')]=function(_0x57a903,_0x5a1f37){var _0x36601d={'raw':![],'where':{'id':_0x57a903[_0xa57c('0x4b')]['id']}},_0x43e5af={};_0x43e5af[_0xa57c('0x3a')]=_[_0xa57c('0x38')](db[_0xa57c('0x48')][_0xa57c('0x4c')]);_0x43e5af[_0xa57c('0x3c')]=_[_0xa57c('0x38')](_0x57a903[_0xa57c('0x3c')]);_0x43e5af[_0xa57c('0x4d')]=_[_0xa57c('0x39')](_0x43e5af[_0xa57c('0x3a')],_0x43e5af['query']);_0x36601d['attributes']=_[_0xa57c('0x39')](_0x43e5af[_0xa57c('0x3a')],qs[_0xa57c('0x3b')](_0x57a903[_0xa57c('0x3c')]['fields']));_0x36601d[_0xa57c('0x3d')]=_0x36601d[_0xa57c('0x3d')]['length']?_0x36601d[_0xa57c('0x3d')]:_0x43e5af[_0xa57c('0x3a')];if(_0x57a903[_0xa57c('0x3c')][_0xa57c('0x4e')]){_0x36601d[_0xa57c('0x47')]=[{'all':!![]}];}_0x36601d=_[_0xa57c('0x43')]({},_0x36601d,_0x57a903[_0xa57c('0x46')]);return db[_0xa57c('0x48')][_0xa57c('0x4f')](_0x36601d)['then'](handleEntityNotFound(_0x5a1f37,null))[_0xa57c('0x1d')](respondWithResult(_0x5a1f37,null))[_0xa57c('0x50')](handleError(_0x5a1f37,null));};exports[_0xa57c('0x51')]=function(_0x12fa83,_0x192175){return db[_0xa57c('0x48')]['create'](_0x12fa83[_0xa57c('0x52')],{})[_0xa57c('0x1d')](respondWithResult(_0x192175,0xc9))[_0xa57c('0x50')](handleError(_0x192175,null));};exports[_0xa57c('0x53')]=function(_0x50999a,_0x17012c){if(_0x50999a[_0xa57c('0x52')]['id']){delete _0x50999a[_0xa57c('0x52')]['id'];}return db[_0xa57c('0x48')]['find']({'where':{'id':_0x50999a[_0xa57c('0x4b')]['id']}})[_0xa57c('0x1d')](handleEntityNotFound(_0x17012c,null))[_0xa57c('0x1d')](saveUpdates(_0x50999a[_0xa57c('0x52')],null))[_0xa57c('0x1d')](respondWithResult(_0x17012c,null))[_0xa57c('0x50')](handleError(_0x17012c,null));};exports[_0xa57c('0x30')]=function(_0x3d635f,_0x349812){return db[_0xa57c('0x48')][_0xa57c('0x4f')]({'where':{'id':_0x3d635f[_0xa57c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x349812,null))[_0xa57c('0x1d')](removeEntity(_0x349812,null))['catch'](handleError(_0x349812,null));};exports[_0xa57c('0x54')]=function(_0x182467,_0x4bad9d,_0x31f140){var _0x1131cc={};var _0x37800a={};var _0x5280dc;var _0x385b8c;return db[_0xa57c('0x48')][_0xa57c('0x55')]({'where':{'id':_0x182467[_0xa57c('0x4b')]['id']}})[_0xa57c('0x1d')](handleEntityNotFound(_0x4bad9d,null))[_0xa57c('0x1d')](function(_0x44960f){if(_0x44960f){_0x5280dc=_0x44960f;_0x37800a[_0xa57c('0x3a')]=_['keys'](db[_0xa57c('0x56')][_0xa57c('0x4c')]);_0x37800a[_0xa57c('0x3c')]=_[_0xa57c('0x38')](_0x182467[_0xa57c('0x3c')]);_0x37800a[_0xa57c('0x41')]=_[_0xa57c('0x39')](_0x37800a[_0xa57c('0x3a')],_0x37800a[_0xa57c('0x3c')]);_0x1131cc[_0xa57c('0x3d')]=_[_0xa57c('0x39')](_0x37800a[_0xa57c('0x3a')],qs[_0xa57c('0x3b')](_0x182467['query']['fields']));_0x1131cc[_0xa57c('0x3d')]=_0x1131cc[_0xa57c('0x3d')][_0xa57c('0x57')]?_0x1131cc[_0xa57c('0x3d')]:_0x37800a['model'];_0x1131cc[_0xa57c('0x58')]=qs[_0xa57c('0x40')](_0x182467[_0xa57c('0x3c')][_0xa57c('0x40')]);_0x1131cc[_0xa57c('0x44')]=qs['filters'](_[_0xa57c('0x59')](_0x182467[_0xa57c('0x3c')],_0x37800a[_0xa57c('0x41')]));if(_0x182467['query'][_0xa57c('0x42')]){_0x1131cc[_0xa57c('0x44')]=_[_0xa57c('0x43')](_0x1131cc['where'],{'$or':_['map'](_0x1131cc[_0xa57c('0x3d')],function(_0x4227ab){var _0x43b2f6={};_0x43b2f6[_0x4227ab]={'$like':'%'+_0x182467[_0xa57c('0x3c')]['filter']+'%'};return _0x43b2f6;})});}_0x1131cc=_[_0xa57c('0x43')]({},_0x1131cc,_0x182467[_0xa57c('0x46')]);return _0x5280dc['getConfigurations'](_0x1131cc);}})[_0xa57c('0x1d')](function(_0x54c864){if(_0x54c864){_0x385b8c=_0x54c864[_0xa57c('0x57')];if(!_0x182467[_0xa57c('0x3c')]['hasOwnProperty'](_0xa57c('0x3f'))){_0x1131cc[_0xa57c('0x2c')]=qs[_0xa57c('0x2c')](_0x182467['query']['limit']);_0x1131cc[_0xa57c('0x2b')]=qs[_0xa57c('0x2b')](_0x182467[_0xa57c('0x3c')][_0xa57c('0x2b')]);}return _0x5280dc[_0xa57c('0x54')](_0x1131cc);}})[_0xa57c('0x1d')](function(_0x471c8f){if(_0x471c8f){return _0x471c8f?{'count':_0x385b8c,'rows':_0x471c8f}:null;}})['then'](respondWithResult(_0x4bad9d,null))[_0xa57c('0x50')](handleError(_0x4bad9d,null));};exports[_0xa57c('0x5a')]=function(_0x355879,_0x5a8206,_0x525133){if(_0x355879[_0xa57c('0x52')]['id']){delete _0x355879['body']['id'];}return db[_0xa57c('0x48')][_0xa57c('0x55')]({'where':{'id':_0x355879[_0xa57c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a8206,null))[_0xa57c('0x1d')](function(_0x26914b){if(_0x26914b){_0x355879[_0xa57c('0x52')]['AccountId']=_0x26914b['id'];_0x355879['body'][_0xa57c('0x5b')]=integrations['getSubjects'](_0x355879[_0xa57c('0x52')]['channel'],_0x355879[_0xa57c('0x52')][_0xa57c('0x36')]);_0x355879[_0xa57c('0x52')][_0xa57c('0x5c')]=integrations['getDescriptions'](_0x355879['body'][_0xa57c('0x5d')],_0x355879['body'][_0xa57c('0x36')]);return db[_0xa57c('0x56')][_0xa57c('0x51')](_0x355879[_0xa57c('0x52')],{'include':[{'model':db[_0xa57c('0x5e')],'as':_0xa57c('0x5b')},{'model':db[_0xa57c('0x5e')],'as':_0xa57c('0x5c')}]});}return null;})[_0xa57c('0x1d')](respondWithResult(_0x5a8206,null))[_0xa57c('0x50')](handleError(_0x5a8206,null));};exports[_0xa57c('0x5f')]=function(_0x57360f,_0x38994c,_0x1a3c59){var _0x124026='';return db['ZendeskAccount'][_0xa57c('0x55')]({'where':{'id':_0x57360f[_0xa57c('0x4b')]['id']},'attributes':['id',_0xa57c('0x60'),_0xa57c('0x61'),_0xa57c('0x62'),_0xa57c('0x63'),_0xa57c('0x64')]})[_0xa57c('0x1d')](handleEntityNotFound(_0x38994c,null))['then'](function(_0x5827c1){if(_0x5827c1){_0x124026=_0x5827c1[_0xa57c('0x64')];var _0x5435d7=_0x124026[_0xa57c('0x65')](-0x1);if(_0x5435d7==='/'){_0x124026=_0x124026['substring'](0x0,_0x124026['lastIndexOf'](_0x5435d7));}var _0x272c81={'method':_0xa57c('0x66'),'uri':util[_0xa57c('0x67')](_0xa57c('0x68'),_0x124026,_0xa57c('0x69')),'json':!![]};switch(_0x5827c1[_0xa57c('0x63')]){case _0xa57c('0x61'):_0x272c81['headers']={'Authorization':util['format'](_0xa57c('0x6a'),new Buffer(util['format']('%s:%s',_0x5827c1['username'],_0x5827c1[_0xa57c('0x61')]))[_0xa57c('0x6b')](_0xa57c('0x6c')))};break;case _0xa57c('0x62'):_0x272c81[_0xa57c('0x6d')]={'Authorization':util[_0xa57c('0x67')](_0xa57c('0x6a'),new Buffer(util[_0xa57c('0x67')](_0xa57c('0x6e'),_0x5827c1['username'],_0x5827c1[_0xa57c('0x62')]))[_0xa57c('0x6b')]('base64'))};break;default:throw new db['Sequelize'][(_0xa57c('0x6f'))](_0xa57c('0x70'));}return rp(_0x272c81);}})[_0xa57c('0x1d')](function(_0x29a5b3){if(_0x29a5b3){var _0x1b9eb9=['subject',_0xa57c('0x71'),'group',_0xa57c('0x72')];_[_0xa57c('0x73')](_0x29a5b3[_0xa57c('0x69')],function(_0x1db911){return _0x1b9eb9[_0xa57c('0x74')](_0x1db911[_0xa57c('0x36')]);});return{'count':_0x29a5b3[_0xa57c('0x69')][_0xa57c('0x57')],'rows':_[_0xa57c('0x35')](_0x29a5b3['ticket_fields'],function(_0x46b01d){return{'id':_0x46b01d['id'],'name':_0x46b01d[_0xa57c('0x75')]>0x7?_0x46b01d[_0xa57c('0x76')]:_0x46b01d[_0xa57c('0x36')],'custom':_0x46b01d['position']>0x7?!![]:![],'options':_0x46b01d[_0xa57c('0x77')]?_0x46b01d[_0xa57c('0x77')]:_0x46b01d[_0xa57c('0x78')]?_0x46b01d[_0xa57c('0x78')]:[]};})};}})['then'](respondWithResult(_0x38994c,null))[_0xa57c('0x50')](function(_0x189909){var _0x219088=_0x57360f[_0xa57c('0x3c')][_0xa57c('0x79')]?0x1f4:_0x189909[_0xa57c('0x7a')]||0x1f4;logger[_0xa57c('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xa57c('0x5f'),_0x219088,JSON[_0xa57c('0x22')](_0x189909));delete _0x189909[_0xa57c('0x32')];if(_0x219088===0x191){_0x219088=0x190;}_0x38994c[_0xa57c('0x28')](_0x219088)[_0xa57c('0x33')](_0x57360f[_0xa57c('0x3c')][_0xa57c('0x79')]?{'message':_0xa57c('0x7b'),'statusCode':_0x189909['statusCode']}:_0x189909);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 635d1c1..66f99b1 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 _0x2d36=['request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','api','moment','bluebird'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x2d36,0x1c4));var _0x62d3=function(_0x5a759a,_0x313921){_0x5a759a=_0x5a759a-0x0;var _0xdb13a8=_0x2d36[_0x5a759a];return _0xdb13a8;};'use strict';var _=require('lodash');var util=require(_0x62d3('0x0'));var logger=require('../../config/logger')(_0x62d3('0x1'));var moment=require(_0x62d3('0x2'));var BPromise=require(_0x62d3('0x3'));var rp=require(_0x62d3('0x4'));var fs=require('fs');var path=require(_0x62d3('0x5'));var rimraf=require(_0x62d3('0x6'));var config=require('../../config/environment');var attributes=require(_0x62d3('0x7'));var integrations=require(_0x62d3('0x8'));module[_0x62d3('0x9')]=function(_0x3d747e,_0x5a09ac){return _0x3d747e['define'](_0x62d3('0xa'),attributes,{'tableName':_0x62d3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf4e=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define'];(function(_0x1b2763,_0x49e0b5){var _0x5a02a5=function(_0x4d13a9){while(--_0x4d13a9){_0x1b2763['push'](_0x1b2763['shift']());}};_0x5a02a5(++_0x49e0b5);}(_0xaf4e,0xbb));var _0xeaf4=function(_0x121800,_0x4e6fab){_0x121800=_0x121800-0x0;var _0x112699=_0xaf4e[_0x121800];return _0x112699;};'use strict';var _=require(_0xeaf4('0x0'));var util=require('util');var logger=require(_0xeaf4('0x1'))(_0xeaf4('0x2'));var moment=require(_0xeaf4('0x3'));var BPromise=require(_0xeaf4('0x4'));var rp=require(_0xeaf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeaf4('0x6'));var config=require(_0xeaf4('0x7'));var attributes=require(_0xeaf4('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xeaf4('0x9')]=function(_0x157033,_0x4d08f8){return _0x157033[_0xeaf4('0xa')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c891008..0c011cb 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 _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(_0x5d6270,_0x83b57a){var _0x168f26=function(_0x258a27){while(--_0x258a27){_0x5d6270['push'](_0x5d6270['shift']());}};_0x168f26(++_0x83b57a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 +var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x336b1f,_0xc557f1){var _0x237afe=function(_0x4888c8){while(--_0x4888c8){_0x336b1f['push'](_0x336b1f['shift']());}};_0x237afe(++_0xc557f1);}(_0x757a,0xde));var _0xa757=function(_0x3e27b1,_0x54a45){_0x3e27b1=_0x3e27b1-0x0;var _0x3bc374=_0x757a[_0x3e27b1];return _0x3bc374;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9d49cb9..e097967 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 _0xeda1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xeda1,0x11c));var _0x1eda=function(_0x571dbc,_0x400df9){_0x571dbc=_0x571dbc-0x0;var _0x55043c=_0xeda1[_0x571dbc];return _0x55043c;};'use strict';var multer=require(_0x1eda('0x0'));var util=require('util');var path=require(_0x1eda('0x1'));var timeout=require(_0x1eda('0x2'));var express=require(_0x1eda('0x3'));var router=express['Router']();var auth=require(_0x1eda('0x4'));var interaction=require(_0x1eda('0x5'));var config=require(_0x1eda('0x6'));var controller=require(_0x1eda('0x7'));router[_0x1eda('0x8')]('/',auth[_0x1eda('0x9')](),controller['index']);router[_0x1eda('0x8')](_0x1eda('0xa'),auth[_0x1eda('0x9')](),controller['show']);router['get'](_0x1eda('0xb'),auth[_0x1eda('0x9')](),controller[_0x1eda('0xc')]);router[_0x1eda('0x8')](_0x1eda('0xd'),auth[_0x1eda('0x9')](),controller[_0x1eda('0xe')]);router[_0x1eda('0x8')](_0x1eda('0xf'),auth[_0x1eda('0x9')](),controller[_0x1eda('0x10')]);router[_0x1eda('0x8')](_0x1eda('0x11'),auth[_0x1eda('0x9')](),controller['getTags']);router[_0x1eda('0x12')]('/',auth[_0x1eda('0x9')](),controller[_0x1eda('0x13')]);router['post'](_0x1eda('0x11'),auth[_0x1eda('0x9')](),controller[_0x1eda('0x14')]);router['put'](_0x1eda('0xa'),auth[_0x1eda('0x9')](),controller['update']);router[_0x1eda('0x15')](_0x1eda('0xa'),auth['isAuthenticated'](),controller[_0x1eda('0x16')]);module[_0x1eda('0x17')]=router; \ No newline at end of file +var _0x8a94=['path','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','put','destroy','multer'];(function(_0x126c7a,_0x16a7e6){var _0x5b9916=function(_0x38be1f){while(--_0x38be1f){_0x126c7a['push'](_0x126c7a['shift']());}};_0x5b9916(++_0x16a7e6);}(_0x8a94,0x131));var _0x48a9=function(_0x4f33cb,_0x46c73d){_0x4f33cb=_0x4f33cb-0x0;var _0x2b2dbd=_0x8a94[_0x4f33cb];return _0x2b2dbd;};'use strict';var multer=require(_0x48a9('0x0'));var util=require('util');var path=require(_0x48a9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x48a9('0x2'));var controller=require(_0x48a9('0x3'));router[_0x48a9('0x4')]('/',auth['isAuthenticated'](),controller[_0x48a9('0x5')]);router[_0x48a9('0x4')](_0x48a9('0x6'),auth[_0x48a9('0x7')](),controller[_0x48a9('0x8')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x48a9('0x4')](_0x48a9('0x9'),auth[_0x48a9('0x7')](),controller[_0x48a9('0xa')]);router['get'](_0x48a9('0xb'),auth[_0x48a9('0x7')](),controller[_0x48a9('0xc')]);router[_0x48a9('0x4')](_0x48a9('0xd'),auth[_0x48a9('0x7')](),controller[_0x48a9('0xe')]);router[_0x48a9('0xf')]('/',auth[_0x48a9('0x7')](),controller['create']);router[_0x48a9('0xf')]('/:id/tags',auth[_0x48a9('0x7')](),controller['setTags']);router[_0x48a9('0x10')](_0x48a9('0x6'),auth[_0x48a9('0x7')](),controller['update']);router['delete'](_0x48a9('0x6'),auth[_0x48a9('0x7')](),controller[_0x48a9('0x11')]);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 261d060..ce33116 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 _0x72b5=['exports','STRING','sequelize'];(function(_0x2d5844,_0x22e723){var _0x11327c=function(_0x2f6c6d){while(--_0x2f6c6d){_0x2d5844['push'](_0x2d5844['shift']());}};_0x11327c(++_0x22e723);}(_0x72b5,0x71));var _0x572b=function(_0x391d9a,_0x15d0f7){_0x391d9a=_0x391d9a-0x0;var _0x2064c3=_0x72b5[_0x391d9a];return _0x2064c3;};'use strict';var Sequelize=require(_0x572b('0x0'));module[_0x572b('0x1')]={'name':{'type':Sequelize[_0x572b('0x2')]},'description':{'type':Sequelize[_0x572b('0x2')]}}; \ No newline at end of file +var _0x9330=['exports','STRING','sequelize'];(function(_0x35468d,_0x2a7240){var _0x30da52=function(_0xd9d2f){while(--_0xd9d2f){_0x35468d['push'](_0x35468d['shift']());}};_0x30da52(++_0x2a7240);}(_0x9330,0x110));var _0x0933=function(_0x78db92,_0x35961e){_0x78db92=_0x78db92-0x0;var _0x59aa36=_0x9330[_0x78db92];return _0x59aa36;};'use strict';var Sequelize=require(_0x0933('0x0'));module[_0x0933('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0933('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4e345ed..cf69670 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 _0x8af6=['VIRTUAL','options','includeAll','include','show','params','filtears','merge','find','create','body','getFields','findOne','ZendeskField','order','hasOwnProperty','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter'];(function(_0x1023c3,_0x482ae1){var _0x24a208=function(_0x5182f9){while(--_0x5182f9){_0x1023c3['push'](_0x1023c3['shift']());}};_0x24a208(++_0x482ae1);}(_0x8af6,0x76));var _0x68af=function(_0x168cab,_0x5d8933){_0x168cab=_0x168cab-0x0;var _0x908b98=_0x8af6[_0x168cab];return _0x908b98;};'use strict';var pdf=require(_0x68af('0x0'));var emlformat=require(_0x68af('0x1'));var rimraf=require(_0x68af('0x2'));var zipdir=require(_0x68af('0x3'));var jsonpatch=require(_0x68af('0x4'));var rp=require(_0x68af('0x5'));var moment=require(_0x68af('0x6'));var BPromise=require(_0x68af('0x7'));var Mustache=require(_0x68af('0x8'));var util=require(_0x68af('0x9'));var path=require('path');var sox=require(_0x68af('0xa'));var csv=require('to-csv');var ejs=require(_0x68af('0xb'));var fs=require('fs');var _=require(_0x68af('0xc'));var squel=require(_0x68af('0xd'));var crypto=require(_0x68af('0xe'));var jsforce=require(_0x68af('0xf'));var deskjs=require(_0x68af('0x10'));var toCsv=require(_0x68af('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68af('0x12'));var authService=require(_0x68af('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x68af('0x14'));var hardwareService=require(_0x68af('0x15'));var logger=require(_0x68af('0x16'))(_0x68af('0x17'));var utils=require(_0x68af('0x18'));var config=require(_0x68af('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x68af('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x368fa5,_0x7e53d7,_0xdba0d,_0x5d8a97){return new BPromise(function(_0x1ab12a,_0x50f1ea){var _0x3a6d18=_0x5d8a97||client;return _0x3a6d18[_0x68af('0x1b')](_0x368fa5,_0xdba0d)[_0x68af('0x1c')](function(_0x2e7e1e){logger[_0x68af('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7e53d7,_0x68af('0x1e'));logger[_0x68af('0x1f')](_0x68af('0x20'),_0x7e53d7,_0x68af('0x1e'),JSON['stringify'](_0x2e7e1e));if(_0x2e7e1e['error']){if(_0x2e7e1e[_0x68af('0x21')][_0x68af('0x22')]===0x1f4){logger['error'](_0x68af('0x23'),_0x7e53d7,_0x2e7e1e[_0x68af('0x21')][_0x68af('0x24')]);return _0x50f1ea(_0x2e7e1e[_0x68af('0x21')]['message']);}logger[_0x68af('0x21')](_0x68af('0x23'),_0x7e53d7,_0x2e7e1e['error']['message']);return _0x1ab12a(_0x2e7e1e[_0x68af('0x21')][_0x68af('0x24')]);}else{logger[_0x68af('0x1d')](_0x68af('0x23'),_0x7e53d7,_0x68af('0x1e'));_0x1ab12a(_0x2e7e1e[_0x68af('0x25')]['message']);}})[_0x68af('0x26')](function(_0x3c71ef){logger['error'](_0x68af('0x23'),_0x7e53d7,_0x3c71ef);_0x50f1ea(_0x3c71ef);});});}function respondWithStatusCode(_0x539bc0,_0x13af7b){_0x13af7b=_0x13af7b||0xcc;return function(_0x1f0d0e){if(_0x1f0d0e){return _0x539bc0[_0x68af('0x27')](_0x13af7b);}return _0x539bc0[_0x68af('0x28')](_0x13af7b)[_0x68af('0x29')]();};}function respondWithResult(_0x218811,_0x5851b9){_0x5851b9=_0x5851b9||0xc8;return function(_0x514ebc){if(_0x514ebc){return _0x218811[_0x68af('0x28')](_0x5851b9)[_0x68af('0x2a')](_0x514ebc);}};}function respondWithFilteredResult(_0x351909,_0x1651de){return function(_0x375d38){if(_0x375d38){var _0x3e1447=_0x375d38[_0x68af('0x2b')],_0x1839f9=_0x1651de[_0x68af('0x2c')],_0x2729fd=_0x1651de[_0x68af('0x2c')]+_0x1651de[_0x68af('0x2d')],_0x5417e9;if(_0x2729fd>=_0x3e1447){_0x2729fd=_0x3e1447;_0x5417e9=0xc8;}else{_0x5417e9=0xce;}_0x351909['status'](_0x5417e9);return _0x351909['set'](_0x68af('0x2e'),_0x1839f9+'-'+_0x2729fd+'/'+_0x3e1447)[_0x68af('0x2a')](_0x375d38);}return null;};}function patchUpdates(_0x1cb7c5){return function(_0x5dd38c){try{jsonpatch['apply'](_0x5dd38c,_0x1cb7c5,!![]);}catch(_0x3c3268){return BPromise[_0x68af('0x2f')](_0x3c3268);}return _0x5dd38c['save']();};}function saveUpdates(_0x718b39,_0x2d5aac){return function(_0x21b677){if(_0x21b677){return _0x21b677[_0x68af('0x30')](_0x718b39)[_0x68af('0x1c')](function(_0x38de14){return _0x38de14;});}return null;};}function removeEntity(_0x18120e,_0x482f85){return function(_0xb27414){if(_0xb27414){return _0xb27414[_0x68af('0x31')]()[_0x68af('0x1c')](function(){_0x18120e['status'](0xcc)[_0x68af('0x29')]();});}};}function handleEntityNotFound(_0x306d0f,_0x5d49fe){return function(_0x6e74b9){if(!_0x6e74b9){_0x306d0f[_0x68af('0x27')](0x194);}return _0x6e74b9;};}function handleError(_0x5ecb38,_0x206a6c){_0x206a6c=_0x206a6c||0x1f4;return function(_0x4bff3d){logger['error'](_0x4bff3d[_0x68af('0x32')]);if(_0x4bff3d[_0x68af('0x33')]){delete _0x4bff3d[_0x68af('0x33')];}_0x5ecb38[_0x68af('0x28')](_0x206a6c)[_0x68af('0x34')](_0x4bff3d);};}exports[_0x68af('0x35')]=function(_0x4d9f28,_0x565a9e){var _0x49a4dd={},_0x294ead={},_0x27679f={'count':0x0,'rows':[]};var _0x47c527=_[_0x68af('0x36')](db[_0x68af('0x37')][_0x68af('0x38')],function(_0x486242){return{'name':_0x486242[_0x68af('0x39')],'type':_0x486242[_0x68af('0x3a')][_0x68af('0x3b')]};});_0x294ead[_0x68af('0x3c')]=_[_0x68af('0x36')](_0x47c527,'name');_0x294ead[_0x68af('0x3d')]=_[_0x68af('0x3e')](_0x4d9f28[_0x68af('0x3d')]);_0x294ead[_0x68af('0x3f')]=_[_0x68af('0x40')](_0x294ead[_0x68af('0x3c')],_0x294ead[_0x68af('0x3d')]);_0x49a4dd[_0x68af('0x41')]=_[_0x68af('0x40')](_0x294ead[_0x68af('0x3c')],qs['fields'](_0x4d9f28[_0x68af('0x3d')][_0x68af('0x42')]));_0x49a4dd['attributes']=_0x49a4dd[_0x68af('0x41')][_0x68af('0x43')]?_0x49a4dd[_0x68af('0x41')]:_0x294ead[_0x68af('0x3c')];if(!_0x4d9f28[_0x68af('0x3d')]['hasOwnProperty']('nolimit')){_0x49a4dd['limit']=qs[_0x68af('0x2d')](_0x4d9f28[_0x68af('0x3d')]['limit']);_0x49a4dd[_0x68af('0x2c')]=qs[_0x68af('0x2c')](_0x4d9f28[_0x68af('0x3d')][_0x68af('0x2c')]);}_0x49a4dd['order']=qs[_0x68af('0x44')](_0x4d9f28[_0x68af('0x3d')][_0x68af('0x44')]);_0x49a4dd[_0x68af('0x45')]=qs[_0x68af('0x3f')](_[_0x68af('0x46')](_0x4d9f28[_0x68af('0x3d')],_0x294ead[_0x68af('0x3f')]),_0x47c527);if(_0x4d9f28[_0x68af('0x3d')][_0x68af('0x47')]){_0x49a4dd['where']=_['merge'](_0x49a4dd[_0x68af('0x45')],{'$or':_[_0x68af('0x36')](_0x47c527,function(_0x1a0b10){if(_0x1a0b10[_0x68af('0x3a')]!==_0x68af('0x48')){var _0x517de3={};_0x517de3[_0x1a0b10[_0x68af('0x33')]]={'$like':'%'+_0x4d9f28[_0x68af('0x3d')][_0x68af('0x47')]+'%'};return _0x517de3;}})});}_0x49a4dd=_['merge']({},_0x49a4dd,_0x4d9f28[_0x68af('0x49')]);var _0x1cff14={'where':_0x49a4dd[_0x68af('0x45')]};return db[_0x68af('0x37')][_0x68af('0x2b')](_0x1cff14)[_0x68af('0x1c')](function(_0x3c4e20){_0x27679f['count']=_0x3c4e20;if(_0x4d9f28[_0x68af('0x3d')][_0x68af('0x4a')]){_0x49a4dd[_0x68af('0x4b')]=[{'all':!![]}];}return db[_0x68af('0x37')]['findAll'](_0x49a4dd);})[_0x68af('0x1c')](function(_0x1603af){_0x27679f['rows']=_0x1603af;return _0x27679f;})[_0x68af('0x1c')](respondWithFilteredResult(_0x565a9e,_0x49a4dd))['catch'](handleError(_0x565a9e,null));};exports[_0x68af('0x4c')]=function(_0x5bab92,_0xbec158){var _0x205aad={'raw':![],'where':{'id':_0x5bab92[_0x68af('0x4d')]['id']}},_0x38dc92={};_0x38dc92[_0x68af('0x3c')]=_[_0x68af('0x3e')](db[_0x68af('0x37')][_0x68af('0x38')]);_0x38dc92[_0x68af('0x3d')]=_[_0x68af('0x3e')](_0x5bab92[_0x68af('0x3d')]);_0x38dc92[_0x68af('0x4e')]=_['intersection'](_0x38dc92[_0x68af('0x3c')],_0x38dc92[_0x68af('0x3d')]);_0x205aad['attributes']=_[_0x68af('0x40')](_0x38dc92[_0x68af('0x3c')],qs[_0x68af('0x42')](_0x5bab92['query'][_0x68af('0x42')]));_0x205aad[_0x68af('0x41')]=_0x205aad[_0x68af('0x41')][_0x68af('0x43')]?_0x205aad[_0x68af('0x41')]:_0x38dc92['model'];if(_0x5bab92[_0x68af('0x3d')][_0x68af('0x4a')]){_0x205aad[_0x68af('0x4b')]=[{'all':!![]}];}_0x205aad=_[_0x68af('0x4f')]({},_0x205aad,_0x5bab92[_0x68af('0x49')]);return db[_0x68af('0x37')][_0x68af('0x50')](_0x205aad)[_0x68af('0x1c')](handleEntityNotFound(_0xbec158,null))[_0x68af('0x1c')](respondWithResult(_0xbec158,null))[_0x68af('0x26')](handleError(_0xbec158,null));};exports['create']=function(_0x3a44af,_0x14f942){return db[_0x68af('0x37')][_0x68af('0x51')](_0x3a44af[_0x68af('0x52')],{})[_0x68af('0x1c')](respondWithResult(_0x14f942,0xc9))['catch'](handleError(_0x14f942,null));};exports['update']=function(_0x433d50,_0x5550cd){if(_0x433d50['body']['id']){delete _0x433d50[_0x68af('0x52')]['id'];}return db[_0x68af('0x37')][_0x68af('0x50')]({'where':{'id':_0x433d50[_0x68af('0x4d')]['id']}})[_0x68af('0x1c')](handleEntityNotFound(_0x5550cd,null))[_0x68af('0x1c')](saveUpdates(_0x433d50[_0x68af('0x52')],null))['then'](respondWithResult(_0x5550cd,null))[_0x68af('0x26')](handleError(_0x5550cd,null));};exports[_0x68af('0x31')]=function(_0x255e1c,_0x1ffdbb){return db[_0x68af('0x37')][_0x68af('0x50')]({'where':{'id':_0x255e1c[_0x68af('0x4d')]['id']}})[_0x68af('0x1c')](handleEntityNotFound(_0x1ffdbb,null))[_0x68af('0x1c')](removeEntity(_0x1ffdbb,null))['catch'](handleError(_0x1ffdbb,null));};exports[_0x68af('0x53')]=function(_0x2706a4,_0x2f3319,_0x2536dd){var _0x23986b={};var _0x2b4d6f={};var _0x582e82;var _0x1f2ba6;return db['ZendeskConfiguration'][_0x68af('0x54')]({'where':{'id':_0x2706a4['params']['id']}})['then'](handleEntityNotFound(_0x2f3319,null))['then'](function(_0x348818){if(_0x348818){_0x582e82=_0x348818;_0x2b4d6f['model']=_[_0x68af('0x3e')](db[_0x68af('0x55')][_0x68af('0x38')]);_0x2b4d6f[_0x68af('0x3d')]=_[_0x68af('0x3e')](_0x2706a4[_0x68af('0x3d')]);_0x2b4d6f[_0x68af('0x3f')]=_['intersection'](_0x2b4d6f[_0x68af('0x3c')],_0x2b4d6f['query']);_0x23986b[_0x68af('0x41')]=_[_0x68af('0x40')](_0x2b4d6f[_0x68af('0x3c')],qs['fields'](_0x2706a4[_0x68af('0x3d')][_0x68af('0x42')]));_0x23986b[_0x68af('0x41')]=_0x23986b[_0x68af('0x41')]['length']?_0x23986b[_0x68af('0x41')]:_0x2b4d6f['model'];_0x23986b[_0x68af('0x56')]=qs['sort'](_0x2706a4[_0x68af('0x3d')][_0x68af('0x44')]);_0x23986b[_0x68af('0x45')]=qs['filters'](_[_0x68af('0x46')](_0x2706a4[_0x68af('0x3d')],_0x2b4d6f[_0x68af('0x3f')]));if(_0x2706a4[_0x68af('0x3d')]['filter']){_0x23986b[_0x68af('0x45')]=_['merge'](_0x23986b[_0x68af('0x45')],{'$or':_['map'](_0x23986b['attributes'],function(_0x29d53f){var _0x4fd891={};_0x4fd891[_0x29d53f]={'$like':'%'+_0x2706a4[_0x68af('0x3d')]['filter']+'%'};return _0x4fd891;})});}_0x23986b=_[_0x68af('0x4f')]({},_0x23986b,_0x2706a4[_0x68af('0x49')]);return _0x582e82['getFields'](_0x23986b);}})[_0x68af('0x1c')](function(_0x2e26fd){if(_0x2e26fd){_0x1f2ba6=_0x2e26fd['length'];if(!_0x2706a4[_0x68af('0x3d')][_0x68af('0x57')](_0x68af('0x58'))){_0x23986b[_0x68af('0x2d')]=qs[_0x68af('0x2d')](_0x2706a4['query'][_0x68af('0x2d')]);_0x23986b[_0x68af('0x2c')]=qs[_0x68af('0x2c')](_0x2706a4[_0x68af('0x3d')][_0x68af('0x2c')]);}return _0x582e82[_0x68af('0x53')](_0x23986b);}})[_0x68af('0x1c')](function(_0x183349){if(_0x183349){return _0x183349?{'count':_0x1f2ba6,'rows':_0x183349}:null;}})[_0x68af('0x1c')](respondWithResult(_0x2f3319,null))['catch'](handleError(_0x2f3319,null));};exports[_0x68af('0x59')]=function(_0x4fd281,_0x1605d9,_0x19e873){var _0x59580e={};var _0x4b23e6={};var _0x3a5058;var _0x487d52;return db['ZendeskConfiguration'][_0x68af('0x54')]({'where':{'id':_0x4fd281[_0x68af('0x4d')]['id']}})[_0x68af('0x1c')](handleEntityNotFound(_0x1605d9,null))[_0x68af('0x1c')](function(_0x5dbf33){if(_0x5dbf33){_0x3a5058=_0x5dbf33;_0x4b23e6[_0x68af('0x3c')]=_[_0x68af('0x3e')](db[_0x68af('0x55')][_0x68af('0x38')]);_0x4b23e6['query']=_['keys'](_0x4fd281[_0x68af('0x3d')]);_0x4b23e6[_0x68af('0x3f')]=_['intersection'](_0x4b23e6[_0x68af('0x3c')],_0x4b23e6[_0x68af('0x3d')]);_0x59580e[_0x68af('0x41')]=_[_0x68af('0x40')](_0x4b23e6[_0x68af('0x3c')],qs['fields'](_0x4fd281[_0x68af('0x3d')][_0x68af('0x42')]));_0x59580e[_0x68af('0x41')]=_0x59580e['attributes'][_0x68af('0x43')]?_0x59580e[_0x68af('0x41')]:_0x4b23e6['model'];_0x59580e['order']=qs[_0x68af('0x44')](_0x4fd281[_0x68af('0x3d')][_0x68af('0x44')]);_0x59580e[_0x68af('0x45')]=qs['filters'](_[_0x68af('0x46')](_0x4fd281['query'],_0x4b23e6['filters']));if(_0x4fd281['query'][_0x68af('0x47')]){_0x59580e['where']=_['merge'](_0x59580e[_0x68af('0x45')],{'$or':_[_0x68af('0x36')](_0x59580e[_0x68af('0x41')],function(_0xc034c5){var _0x242675={};_0x242675[_0xc034c5]={'$like':'%'+_0x4fd281[_0x68af('0x3d')][_0x68af('0x47')]+'%'};return _0x242675;})});}_0x59580e=_['merge']({},_0x59580e,_0x4fd281[_0x68af('0x49')]);return _0x3a5058[_0x68af('0x59')](_0x59580e);}})[_0x68af('0x1c')](function(_0x4cd9b3){if(_0x4cd9b3){_0x487d52=_0x4cd9b3[_0x68af('0x43')];if(!_0x4fd281['query'][_0x68af('0x57')](_0x68af('0x58'))){_0x59580e[_0x68af('0x2d')]=qs[_0x68af('0x2d')](_0x4fd281[_0x68af('0x3d')][_0x68af('0x2d')]);_0x59580e[_0x68af('0x2c')]=qs[_0x68af('0x2c')](_0x4fd281[_0x68af('0x3d')][_0x68af('0x2c')]);}return _0x3a5058[_0x68af('0x59')](_0x59580e);}})[_0x68af('0x1c')](function(_0x412f40){if(_0x412f40){return _0x412f40?{'count':_0x487d52,'rows':_0x412f40}:null;}})['then'](respondWithResult(_0x1605d9,null))[_0x68af('0x26')](handleError(_0x1605d9,null));};exports[_0x68af('0x5a')]=function(_0x489d46,_0x2b814a,_0x20b73b){var _0x3cf23a={};var _0x469711={};var _0x3c9ed4;var _0x2f7b7d;return db['ZendeskConfiguration'][_0x68af('0x54')]({'where':{'id':_0x489d46[_0x68af('0x4d')]['id']}})[_0x68af('0x1c')](handleEntityNotFound(_0x2b814a,null))['then'](function(_0x5eae11){if(_0x5eae11){_0x3c9ed4=_0x5eae11;_0x469711[_0x68af('0x3c')]=_[_0x68af('0x3e')](db[_0x68af('0x55')]['rawAttributes']);_0x469711[_0x68af('0x3d')]=_[_0x68af('0x3e')](_0x489d46[_0x68af('0x3d')]);_0x469711[_0x68af('0x3f')]=_['intersection'](_0x469711[_0x68af('0x3c')],_0x469711[_0x68af('0x3d')]);_0x3cf23a[_0x68af('0x41')]=_[_0x68af('0x40')](_0x469711[_0x68af('0x3c')],qs['fields'](_0x489d46[_0x68af('0x3d')][_0x68af('0x42')]));_0x3cf23a[_0x68af('0x41')]=_0x3cf23a['attributes'][_0x68af('0x43')]?_0x3cf23a[_0x68af('0x41')]:_0x469711[_0x68af('0x3c')];_0x3cf23a[_0x68af('0x56')]=qs[_0x68af('0x44')](_0x489d46[_0x68af('0x3d')]['sort']);_0x3cf23a[_0x68af('0x45')]=qs[_0x68af('0x3f')](_[_0x68af('0x46')](_0x489d46['query'],_0x469711['filters']));if(_0x489d46[_0x68af('0x3d')][_0x68af('0x47')]){_0x3cf23a[_0x68af('0x45')]=_[_0x68af('0x4f')](_0x3cf23a['where'],{'$or':_[_0x68af('0x36')](_0x3cf23a[_0x68af('0x41')],function(_0x4a2797){var _0x584796={};_0x584796[_0x4a2797]={'$like':'%'+_0x489d46[_0x68af('0x3d')][_0x68af('0x47')]+'%'};return _0x584796;})});}_0x3cf23a=_['merge']({},_0x3cf23a,_0x489d46[_0x68af('0x49')]);return _0x3c9ed4[_0x68af('0x5a')](_0x3cf23a);}})[_0x68af('0x1c')](function(_0x47640b){if(_0x47640b){_0x2f7b7d=_0x47640b['length'];if(!_0x489d46[_0x68af('0x3d')][_0x68af('0x57')]('nolimit')){_0x3cf23a['limit']=qs[_0x68af('0x2d')](_0x489d46[_0x68af('0x3d')]['limit']);_0x3cf23a[_0x68af('0x2c')]=qs['offset'](_0x489d46[_0x68af('0x3d')]['offset']);}return _0x3c9ed4['getDescriptions'](_0x3cf23a);}})['then'](function(_0x8c5d55){if(_0x8c5d55){return _0x8c5d55?{'count':_0x2f7b7d,'rows':_0x8c5d55}:null;}})[_0x68af('0x1c')](respondWithResult(_0x2b814a,null))[_0x68af('0x26')](handleError(_0x2b814a,null));};exports[_0x68af('0x5b')]=function(_0x165c3b,_0x59f150,_0x1cd95f){var _0x308be2={};var _0x47948b={};var _0x32da38;var _0x160a65;return db['ZendeskConfiguration'][_0x68af('0x54')]({'where':{'id':_0x165c3b[_0x68af('0x4d')]['id']}})[_0x68af('0x1c')](handleEntityNotFound(_0x59f150,null))[_0x68af('0x1c')](function(_0x48b175){if(_0x48b175){_0x32da38=_0x48b175;_0x47948b[_0x68af('0x3c')]=_[_0x68af('0x3e')](db[_0x68af('0x5c')]['rawAttributes']);_0x47948b[_0x68af('0x3d')]=_[_0x68af('0x3e')](_0x165c3b[_0x68af('0x3d')]);_0x47948b[_0x68af('0x3f')]=_[_0x68af('0x40')](_0x47948b[_0x68af('0x3c')],_0x47948b[_0x68af('0x3d')]);_0x308be2['attributes']=_[_0x68af('0x40')](_0x47948b['model'],qs[_0x68af('0x42')](_0x165c3b['query'][_0x68af('0x42')]));_0x308be2[_0x68af('0x41')]=_0x308be2[_0x68af('0x41')][_0x68af('0x43')]?_0x308be2[_0x68af('0x41')]:_0x47948b[_0x68af('0x3c')];_0x308be2[_0x68af('0x56')]=qs[_0x68af('0x44')](_0x165c3b[_0x68af('0x3d')][_0x68af('0x44')]);_0x308be2['where']=qs[_0x68af('0x3f')](_['pick'](_0x165c3b[_0x68af('0x3d')],_0x47948b[_0x68af('0x3f')]));if(_0x165c3b[_0x68af('0x3d')]['filter']){_0x308be2[_0x68af('0x45')]=_['merge'](_0x308be2['where'],{'$or':_[_0x68af('0x36')](_0x308be2[_0x68af('0x41')],function(_0x1e7a6a){var _0x510dcb={};_0x510dcb[_0x1e7a6a]={'$like':'%'+_0x165c3b[_0x68af('0x3d')]['filter']+'%'};return _0x510dcb;})});}_0x308be2=_[_0x68af('0x4f')]({},_0x308be2,_0x165c3b[_0x68af('0x49')]);return _0x32da38[_0x68af('0x5b')](_0x308be2);}})[_0x68af('0x1c')](function(_0x35959c){if(_0x35959c){_0x160a65=_0x35959c[_0x68af('0x43')];if(!_0x165c3b['query']['hasOwnProperty'](_0x68af('0x58'))){_0x308be2[_0x68af('0x2d')]=qs[_0x68af('0x2d')](_0x165c3b[_0x68af('0x3d')][_0x68af('0x2d')]);_0x308be2[_0x68af('0x2c')]=qs['offset'](_0x165c3b['query'][_0x68af('0x2c')]);}return _0x32da38[_0x68af('0x5b')](_0x308be2);}})[_0x68af('0x1c')](function(_0x4086a4){if(_0x4086a4){return _0x4086a4?{'count':_0x160a65,'rows':_0x4086a4}:null;}})['then'](respondWithResult(_0x59f150,null))['catch'](handleError(_0x59f150,null));};exports[_0x68af('0x5d')]=function(_0xe7205d,_0x1af580,_0x144146){if(_0xe7205d[_0x68af('0x52')]['id']){delete _0xe7205d['body']['id'];}return db[_0x68af('0x37')][_0x68af('0x54')]({'where':{'id':_0xe7205d[_0x68af('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1af580,null))[_0x68af('0x1c')](function(_0x553284){if(_0x553284){return _0x553284[_0x68af('0x5d')](_0xe7205d[_0x68af('0x52')][_0x68af('0x5e')]||[]);}return null;})[_0x68af('0x1c')](respondWithResult(_0x1af580,null))['catch'](handleError(_0x1af580,null));}; \ No newline at end of file +var _0x2d06=['status','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZendeskConfiguration','count','includeAll','include','findAll','rows','show','params','keys','filtears','length','find','create','body','getFields','findOne','ZendeskField','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2d06,0x157));var _0x62d0=function(_0x296aeb,_0x550891){_0x296aeb=_0x296aeb-0x0;var _0x48f94f=_0x2d06[_0x296aeb];return _0x48f94f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x62d0('0x0'));var rimraf=require(_0x62d0('0x1'));var zipdir=require(_0x62d0('0x2'));var jsonpatch=require(_0x62d0('0x3'));var rp=require('request-promise');var moment=require(_0x62d0('0x4'));var BPromise=require(_0x62d0('0x5'));var Mustache=require(_0x62d0('0x6'));var util=require(_0x62d0('0x7'));var path=require('path');var sox=require(_0x62d0('0x8'));var csv=require(_0x62d0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62d0('0xa'));var squel=require(_0x62d0('0xb'));var crypto=require('crypto');var jsforce=require(_0x62d0('0xc'));var deskjs=require(_0x62d0('0xd'));var toCsv=require(_0x62d0('0x9'));var querystring=require(_0x62d0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x62d0('0xf'));var qs=require(_0x62d0('0x10'));var as=require(_0x62d0('0x11'));var hardwareService=require(_0x62d0('0x12'));var logger=require(_0x62d0('0x13'))(_0x62d0('0x14'));var utils=require(_0x62d0('0x15'));var config=require(_0x62d0('0x16'));var licenseUtil=require(_0x62d0('0x17'));var db=require(_0x62d0('0x18'))['db'];var jayson=require(_0x62d0('0x19'));var client=jayson[_0x62d0('0x1a')][_0x62d0('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2da9cd,_0x50c533,_0x38afb7,_0x23376e){return new BPromise(function(_0x603b69,_0x59d179){var _0x2b7616=_0x23376e||client;return _0x2b7616[_0x62d0('0x1c')](_0x2da9cd,_0x38afb7)['then'](function(_0x1a6e41){logger[_0x62d0('0x1d')](_0x62d0('0x1e'),_0x50c533,_0x62d0('0x1f'));logger['debug'](_0x62d0('0x20'),_0x50c533,_0x62d0('0x1f'),JSON['stringify'](_0x1a6e41));if(_0x1a6e41[_0x62d0('0x21')]){if(_0x1a6e41[_0x62d0('0x21')]['code']===0x1f4){logger[_0x62d0('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50c533,_0x1a6e41[_0x62d0('0x21')][_0x62d0('0x22')]);return _0x59d179(_0x1a6e41[_0x62d0('0x21')]['message']);}logger[_0x62d0('0x21')](_0x62d0('0x1e'),_0x50c533,_0x1a6e41[_0x62d0('0x21')]['message']);return _0x603b69(_0x1a6e41[_0x62d0('0x21')]['message']);}else{logger[_0x62d0('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50c533,_0x62d0('0x1f'));_0x603b69(_0x1a6e41['result'][_0x62d0('0x22')]);}})[_0x62d0('0x23')](function(_0x51f1ea){logger[_0x62d0('0x21')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50c533,_0x51f1ea);_0x59d179(_0x51f1ea);});});}function respondWithStatusCode(_0xb1ceae,_0x495aba){_0x495aba=_0x495aba||0xcc;return function(_0x3253be){if(_0x3253be){return _0xb1ceae[_0x62d0('0x24')](_0x495aba);}return _0xb1ceae[_0x62d0('0x25')](_0x495aba)['end']();};}function respondWithResult(_0xe451b8,_0x130bc6){_0x130bc6=_0x130bc6||0xc8;return function(_0x4979f6){if(_0x4979f6){return _0xe451b8['status'](_0x130bc6)['json'](_0x4979f6);}};}function respondWithFilteredResult(_0x48bc12,_0x6846b4){return function(_0x15de54){if(_0x15de54){var _0x84324a=_0x15de54['count'],_0x2d5279=_0x6846b4[_0x62d0('0x26')],_0x37e2aa=_0x6846b4[_0x62d0('0x26')]+_0x6846b4[_0x62d0('0x27')],_0x52cec8;if(_0x37e2aa>=_0x84324a){_0x37e2aa=_0x84324a;_0x52cec8=0xc8;}else{_0x52cec8=0xce;}_0x48bc12[_0x62d0('0x25')](_0x52cec8);return _0x48bc12['set'](_0x62d0('0x28'),_0x2d5279+'-'+_0x37e2aa+'/'+_0x84324a)['json'](_0x15de54);}return null;};}function patchUpdates(_0xb9f97c){return function(_0x32abcb){try{jsonpatch[_0x62d0('0x29')](_0x32abcb,_0xb9f97c,!![]);}catch(_0xfa13b9){return BPromise[_0x62d0('0x2a')](_0xfa13b9);}return _0x32abcb[_0x62d0('0x2b')]();};}function saveUpdates(_0x84dbb2,_0x382aa6){return function(_0x36a5ec){if(_0x36a5ec){return _0x36a5ec[_0x62d0('0x2c')](_0x84dbb2)[_0x62d0('0x2d')](function(_0x1ce2a6){return _0x1ce2a6;});}return null;};}function removeEntity(_0x5763ec,_0x5a8052){return function(_0x528117){if(_0x528117){return _0x528117[_0x62d0('0x2e')]()[_0x62d0('0x2d')](function(){_0x5763ec['status'](0xcc)[_0x62d0('0x2f')]();});}};}function handleEntityNotFound(_0x327c8c,_0x579fad){return function(_0x38e835){if(!_0x38e835){_0x327c8c[_0x62d0('0x24')](0x194);}return _0x38e835;};}function handleError(_0xc6f046,_0x577f7c){_0x577f7c=_0x577f7c||0x1f4;return function(_0x3f4fde){logger['error'](_0x3f4fde['stack']);if(_0x3f4fde[_0x62d0('0x30')]){delete _0x3f4fde[_0x62d0('0x30')];}_0xc6f046['status'](_0x577f7c)[_0x62d0('0x31')](_0x3f4fde);};}exports[_0x62d0('0x32')]=function(_0x360b69,_0x52f3d8){var _0xfec0ed={},_0x261baa={},_0x331363={'count':0x0,'rows':[]};var _0x135bec=_['map'](db['ZendeskConfiguration'][_0x62d0('0x33')],function(_0x1f0bff){return{'name':_0x1f0bff[_0x62d0('0x34')],'type':_0x1f0bff[_0x62d0('0x35')][_0x62d0('0x36')]};});_0x261baa[_0x62d0('0x37')]=_[_0x62d0('0x38')](_0x135bec,'name');_0x261baa[_0x62d0('0x39')]=_['keys'](_0x360b69['query']);_0x261baa[_0x62d0('0x3a')]=_[_0x62d0('0x3b')](_0x261baa[_0x62d0('0x37')],_0x261baa[_0x62d0('0x39')]);_0xfec0ed[_0x62d0('0x3c')]=_[_0x62d0('0x3b')](_0x261baa[_0x62d0('0x37')],qs['fields'](_0x360b69['query'][_0x62d0('0x3d')]));_0xfec0ed[_0x62d0('0x3c')]=_0xfec0ed[_0x62d0('0x3c')]['length']?_0xfec0ed[_0x62d0('0x3c')]:_0x261baa[_0x62d0('0x37')];if(!_0x360b69['query']['hasOwnProperty'](_0x62d0('0x3e'))){_0xfec0ed['limit']=qs[_0x62d0('0x27')](_0x360b69[_0x62d0('0x39')]['limit']);_0xfec0ed[_0x62d0('0x26')]=qs[_0x62d0('0x26')](_0x360b69[_0x62d0('0x39')][_0x62d0('0x26')]);}_0xfec0ed[_0x62d0('0x3f')]=qs[_0x62d0('0x40')](_0x360b69[_0x62d0('0x39')][_0x62d0('0x40')]);_0xfec0ed[_0x62d0('0x41')]=qs[_0x62d0('0x3a')](_['pick'](_0x360b69[_0x62d0('0x39')],_0x261baa[_0x62d0('0x3a')]),_0x135bec);if(_0x360b69['query'][_0x62d0('0x42')]){_0xfec0ed[_0x62d0('0x41')]=_[_0x62d0('0x43')](_0xfec0ed[_0x62d0('0x41')],{'$or':_[_0x62d0('0x38')](_0x135bec,function(_0x1d8a28){if(_0x1d8a28[_0x62d0('0x35')]!==_0x62d0('0x44')){var _0x59136f={};_0x59136f[_0x1d8a28[_0x62d0('0x30')]]={'$like':'%'+_0x360b69[_0x62d0('0x39')][_0x62d0('0x42')]+'%'};return _0x59136f;}})});}_0xfec0ed=_[_0x62d0('0x43')]({},_0xfec0ed,_0x360b69[_0x62d0('0x45')]);var _0x159e54={'where':_0xfec0ed['where']};return db[_0x62d0('0x46')][_0x62d0('0x47')](_0x159e54)[_0x62d0('0x2d')](function(_0x538d06){_0x331363[_0x62d0('0x47')]=_0x538d06;if(_0x360b69[_0x62d0('0x39')][_0x62d0('0x48')]){_0xfec0ed[_0x62d0('0x49')]=[{'all':!![]}];}return db[_0x62d0('0x46')][_0x62d0('0x4a')](_0xfec0ed);})[_0x62d0('0x2d')](function(_0x162370){_0x331363[_0x62d0('0x4b')]=_0x162370;return _0x331363;})[_0x62d0('0x2d')](respondWithFilteredResult(_0x52f3d8,_0xfec0ed))['catch'](handleError(_0x52f3d8,null));};exports[_0x62d0('0x4c')]=function(_0x11cb13,_0x5219dd){var _0x5d333b={'raw':![],'where':{'id':_0x11cb13[_0x62d0('0x4d')]['id']}},_0x15e2b8={};_0x15e2b8['model']=_[_0x62d0('0x4e')](db['ZendeskConfiguration']['rawAttributes']);_0x15e2b8[_0x62d0('0x39')]=_[_0x62d0('0x4e')](_0x11cb13[_0x62d0('0x39')]);_0x15e2b8[_0x62d0('0x4f')]=_['intersection'](_0x15e2b8[_0x62d0('0x37')],_0x15e2b8[_0x62d0('0x39')]);_0x5d333b['attributes']=_[_0x62d0('0x3b')](_0x15e2b8[_0x62d0('0x37')],qs[_0x62d0('0x3d')](_0x11cb13[_0x62d0('0x39')][_0x62d0('0x3d')]));_0x5d333b[_0x62d0('0x3c')]=_0x5d333b[_0x62d0('0x3c')][_0x62d0('0x50')]?_0x5d333b[_0x62d0('0x3c')]:_0x15e2b8[_0x62d0('0x37')];if(_0x11cb13[_0x62d0('0x39')][_0x62d0('0x48')]){_0x5d333b[_0x62d0('0x49')]=[{'all':!![]}];}_0x5d333b=_['merge']({},_0x5d333b,_0x11cb13[_0x62d0('0x45')]);return db['ZendeskConfiguration'][_0x62d0('0x51')](_0x5d333b)[_0x62d0('0x2d')](handleEntityNotFound(_0x5219dd,null))['then'](respondWithResult(_0x5219dd,null))[_0x62d0('0x23')](handleError(_0x5219dd,null));};exports[_0x62d0('0x52')]=function(_0x5c231d,_0x5ac366){return db[_0x62d0('0x46')][_0x62d0('0x52')](_0x5c231d[_0x62d0('0x53')],{})[_0x62d0('0x2d')](respondWithResult(_0x5ac366,0xc9))[_0x62d0('0x23')](handleError(_0x5ac366,null));};exports[_0x62d0('0x2c')]=function(_0x3fe71a,_0x3e448a){if(_0x3fe71a[_0x62d0('0x53')]['id']){delete _0x3fe71a['body']['id'];}return db[_0x62d0('0x46')][_0x62d0('0x51')]({'where':{'id':_0x3fe71a['params']['id']}})[_0x62d0('0x2d')](handleEntityNotFound(_0x3e448a,null))[_0x62d0('0x2d')](saveUpdates(_0x3fe71a[_0x62d0('0x53')],null))[_0x62d0('0x2d')](respondWithResult(_0x3e448a,null))[_0x62d0('0x23')](handleError(_0x3e448a,null));};exports[_0x62d0('0x2e')]=function(_0x4de6ff,_0x27ec50){return db[_0x62d0('0x46')][_0x62d0('0x51')]({'where':{'id':_0x4de6ff['params']['id']}})['then'](handleEntityNotFound(_0x27ec50,null))[_0x62d0('0x2d')](removeEntity(_0x27ec50,null))[_0x62d0('0x23')](handleError(_0x27ec50,null));};exports[_0x62d0('0x54')]=function(_0x56c2a4,_0xeb37b9,_0x458cad){var _0x155dc2={};var _0x1dc7f5={};var _0x4a9e58;var _0x16a814;return db[_0x62d0('0x46')][_0x62d0('0x55')]({'where':{'id':_0x56c2a4[_0x62d0('0x4d')]['id']}})['then'](handleEntityNotFound(_0xeb37b9,null))[_0x62d0('0x2d')](function(_0x15dfae){if(_0x15dfae){_0x4a9e58=_0x15dfae;_0x1dc7f5[_0x62d0('0x37')]=_['keys'](db[_0x62d0('0x56')][_0x62d0('0x33')]);_0x1dc7f5[_0x62d0('0x39')]=_[_0x62d0('0x4e')](_0x56c2a4[_0x62d0('0x39')]);_0x1dc7f5[_0x62d0('0x3a')]=_['intersection'](_0x1dc7f5['model'],_0x1dc7f5[_0x62d0('0x39')]);_0x155dc2['attributes']=_[_0x62d0('0x3b')](_0x1dc7f5['model'],qs['fields'](_0x56c2a4[_0x62d0('0x39')][_0x62d0('0x3d')]));_0x155dc2[_0x62d0('0x3c')]=_0x155dc2['attributes']['length']?_0x155dc2[_0x62d0('0x3c')]:_0x1dc7f5[_0x62d0('0x37')];_0x155dc2[_0x62d0('0x3f')]=qs['sort'](_0x56c2a4['query'][_0x62d0('0x40')]);_0x155dc2[_0x62d0('0x41')]=qs['filters'](_[_0x62d0('0x57')](_0x56c2a4[_0x62d0('0x39')],_0x1dc7f5[_0x62d0('0x3a')]));if(_0x56c2a4[_0x62d0('0x39')][_0x62d0('0x42')]){_0x155dc2[_0x62d0('0x41')]=_[_0x62d0('0x43')](_0x155dc2['where'],{'$or':_['map'](_0x155dc2[_0x62d0('0x3c')],function(_0x1005e9){var _0x5c0298={};_0x5c0298[_0x1005e9]={'$like':'%'+_0x56c2a4[_0x62d0('0x39')][_0x62d0('0x42')]+'%'};return _0x5c0298;})});}_0x155dc2=_['merge']({},_0x155dc2,_0x56c2a4[_0x62d0('0x45')]);return _0x4a9e58[_0x62d0('0x54')](_0x155dc2);}})['then'](function(_0x56b994){if(_0x56b994){_0x16a814=_0x56b994[_0x62d0('0x50')];if(!_0x56c2a4[_0x62d0('0x39')][_0x62d0('0x58')](_0x62d0('0x3e'))){_0x155dc2['limit']=qs['limit'](_0x56c2a4[_0x62d0('0x39')][_0x62d0('0x27')]);_0x155dc2[_0x62d0('0x26')]=qs[_0x62d0('0x26')](_0x56c2a4[_0x62d0('0x39')]['offset']);}return _0x4a9e58['getFields'](_0x155dc2);}})[_0x62d0('0x2d')](function(_0x3584cb){if(_0x3584cb){return _0x3584cb?{'count':_0x16a814,'rows':_0x3584cb}:null;}})[_0x62d0('0x2d')](respondWithResult(_0xeb37b9,null))[_0x62d0('0x23')](handleError(_0xeb37b9,null));};exports['getSubjects']=function(_0x3ba66e,_0x51189a,_0x1c9573){var _0x2ef883={};var _0x172b37={};var _0x523779;var _0x3b6def;return db[_0x62d0('0x46')]['findOne']({'where':{'id':_0x3ba66e[_0x62d0('0x4d')]['id']}})[_0x62d0('0x2d')](handleEntityNotFound(_0x51189a,null))[_0x62d0('0x2d')](function(_0x1594d7){if(_0x1594d7){_0x523779=_0x1594d7;_0x172b37[_0x62d0('0x37')]=_['keys'](db[_0x62d0('0x56')][_0x62d0('0x33')]);_0x172b37[_0x62d0('0x39')]=_[_0x62d0('0x4e')](_0x3ba66e[_0x62d0('0x39')]);_0x172b37[_0x62d0('0x3a')]=_[_0x62d0('0x3b')](_0x172b37[_0x62d0('0x37')],_0x172b37[_0x62d0('0x39')]);_0x2ef883['attributes']=_[_0x62d0('0x3b')](_0x172b37[_0x62d0('0x37')],qs['fields'](_0x3ba66e[_0x62d0('0x39')]['fields']));_0x2ef883[_0x62d0('0x3c')]=_0x2ef883[_0x62d0('0x3c')][_0x62d0('0x50')]?_0x2ef883[_0x62d0('0x3c')]:_0x172b37[_0x62d0('0x37')];_0x2ef883['order']=qs[_0x62d0('0x40')](_0x3ba66e[_0x62d0('0x39')][_0x62d0('0x40')]);_0x2ef883[_0x62d0('0x41')]=qs['filters'](_[_0x62d0('0x57')](_0x3ba66e['query'],_0x172b37[_0x62d0('0x3a')]));if(_0x3ba66e['query']['filter']){_0x2ef883[_0x62d0('0x41')]=_[_0x62d0('0x43')](_0x2ef883[_0x62d0('0x41')],{'$or':_[_0x62d0('0x38')](_0x2ef883['attributes'],function(_0x4a5146){var _0x31626d={};_0x31626d[_0x4a5146]={'$like':'%'+_0x3ba66e['query'][_0x62d0('0x42')]+'%'};return _0x31626d;})});}_0x2ef883=_[_0x62d0('0x43')]({},_0x2ef883,_0x3ba66e[_0x62d0('0x45')]);return _0x523779[_0x62d0('0x59')](_0x2ef883);}})[_0x62d0('0x2d')](function(_0x1d5061){if(_0x1d5061){_0x3b6def=_0x1d5061[_0x62d0('0x50')];if(!_0x3ba66e['query'][_0x62d0('0x58')](_0x62d0('0x3e'))){_0x2ef883[_0x62d0('0x27')]=qs[_0x62d0('0x27')](_0x3ba66e['query'][_0x62d0('0x27')]);_0x2ef883[_0x62d0('0x26')]=qs[_0x62d0('0x26')](_0x3ba66e[_0x62d0('0x39')][_0x62d0('0x26')]);}return _0x523779['getSubjects'](_0x2ef883);}})[_0x62d0('0x2d')](function(_0x1d3fc2){if(_0x1d3fc2){return _0x1d3fc2?{'count':_0x3b6def,'rows':_0x1d3fc2}:null;}})[_0x62d0('0x2d')](respondWithResult(_0x51189a,null))[_0x62d0('0x23')](handleError(_0x51189a,null));};exports[_0x62d0('0x5a')]=function(_0x3a7616,_0x2e0252,_0x51160f){var _0x2d173e={};var _0x4d8e2d={};var _0x1ddf03;var _0x14a424;return db['ZendeskConfiguration'][_0x62d0('0x55')]({'where':{'id':_0x3a7616['params']['id']}})['then'](handleEntityNotFound(_0x2e0252,null))[_0x62d0('0x2d')](function(_0x364fa6){if(_0x364fa6){_0x1ddf03=_0x364fa6;_0x4d8e2d[_0x62d0('0x37')]=_[_0x62d0('0x4e')](db[_0x62d0('0x56')][_0x62d0('0x33')]);_0x4d8e2d[_0x62d0('0x39')]=_[_0x62d0('0x4e')](_0x3a7616[_0x62d0('0x39')]);_0x4d8e2d[_0x62d0('0x3a')]=_[_0x62d0('0x3b')](_0x4d8e2d[_0x62d0('0x37')],_0x4d8e2d[_0x62d0('0x39')]);_0x2d173e[_0x62d0('0x3c')]=_[_0x62d0('0x3b')](_0x4d8e2d[_0x62d0('0x37')],qs[_0x62d0('0x3d')](_0x3a7616[_0x62d0('0x39')][_0x62d0('0x3d')]));_0x2d173e[_0x62d0('0x3c')]=_0x2d173e[_0x62d0('0x3c')]['length']?_0x2d173e[_0x62d0('0x3c')]:_0x4d8e2d[_0x62d0('0x37')];_0x2d173e[_0x62d0('0x3f')]=qs[_0x62d0('0x40')](_0x3a7616[_0x62d0('0x39')][_0x62d0('0x40')]);_0x2d173e[_0x62d0('0x41')]=qs['filters'](_[_0x62d0('0x57')](_0x3a7616['query'],_0x4d8e2d[_0x62d0('0x3a')]));if(_0x3a7616['query'][_0x62d0('0x42')]){_0x2d173e[_0x62d0('0x41')]=_[_0x62d0('0x43')](_0x2d173e[_0x62d0('0x41')],{'$or':_[_0x62d0('0x38')](_0x2d173e[_0x62d0('0x3c')],function(_0x5d9458){var _0x438318={};_0x438318[_0x5d9458]={'$like':'%'+_0x3a7616['query'][_0x62d0('0x42')]+'%'};return _0x438318;})});}_0x2d173e=_[_0x62d0('0x43')]({},_0x2d173e,_0x3a7616['options']);return _0x1ddf03[_0x62d0('0x5a')](_0x2d173e);}})[_0x62d0('0x2d')](function(_0x47561a){if(_0x47561a){_0x14a424=_0x47561a[_0x62d0('0x50')];if(!_0x3a7616[_0x62d0('0x39')][_0x62d0('0x58')](_0x62d0('0x3e'))){_0x2d173e[_0x62d0('0x27')]=qs[_0x62d0('0x27')](_0x3a7616[_0x62d0('0x39')][_0x62d0('0x27')]);_0x2d173e['offset']=qs['offset'](_0x3a7616[_0x62d0('0x39')]['offset']);}return _0x1ddf03[_0x62d0('0x5a')](_0x2d173e);}})[_0x62d0('0x2d')](function(_0x285936){if(_0x285936){return _0x285936?{'count':_0x14a424,'rows':_0x285936}:null;}})['then'](respondWithResult(_0x2e0252,null))['catch'](handleError(_0x2e0252,null));};exports[_0x62d0('0x5b')]=function(_0x3d156e,_0x4e7761,_0x20ea0c){var _0x948142={};var _0x3d57af={};var _0x175a82;var _0x4f3ce7;return db[_0x62d0('0x46')][_0x62d0('0x55')]({'where':{'id':_0x3d156e[_0x62d0('0x4d')]['id']}})[_0x62d0('0x2d')](handleEntityNotFound(_0x4e7761,null))['then'](function(_0x3b265b){if(_0x3b265b){_0x175a82=_0x3b265b;_0x3d57af[_0x62d0('0x37')]=_[_0x62d0('0x4e')](db[_0x62d0('0x5c')][_0x62d0('0x33')]);_0x3d57af[_0x62d0('0x39')]=_['keys'](_0x3d156e[_0x62d0('0x39')]);_0x3d57af[_0x62d0('0x3a')]=_[_0x62d0('0x3b')](_0x3d57af[_0x62d0('0x37')],_0x3d57af[_0x62d0('0x39')]);_0x948142[_0x62d0('0x3c')]=_[_0x62d0('0x3b')](_0x3d57af[_0x62d0('0x37')],qs[_0x62d0('0x3d')](_0x3d156e[_0x62d0('0x39')][_0x62d0('0x3d')]));_0x948142[_0x62d0('0x3c')]=_0x948142[_0x62d0('0x3c')][_0x62d0('0x50')]?_0x948142[_0x62d0('0x3c')]:_0x3d57af[_0x62d0('0x37')];_0x948142[_0x62d0('0x3f')]=qs['sort'](_0x3d156e[_0x62d0('0x39')][_0x62d0('0x40')]);_0x948142[_0x62d0('0x41')]=qs[_0x62d0('0x3a')](_[_0x62d0('0x57')](_0x3d156e[_0x62d0('0x39')],_0x3d57af[_0x62d0('0x3a')]));if(_0x3d156e[_0x62d0('0x39')]['filter']){_0x948142[_0x62d0('0x41')]=_[_0x62d0('0x43')](_0x948142[_0x62d0('0x41')],{'$or':_[_0x62d0('0x38')](_0x948142['attributes'],function(_0x59f55a){var _0x555a70={};_0x555a70[_0x59f55a]={'$like':'%'+_0x3d156e['query']['filter']+'%'};return _0x555a70;})});}_0x948142=_[_0x62d0('0x43')]({},_0x948142,_0x3d156e['options']);return _0x175a82[_0x62d0('0x5b')](_0x948142);}})[_0x62d0('0x2d')](function(_0x1dc1ab){if(_0x1dc1ab){_0x4f3ce7=_0x1dc1ab[_0x62d0('0x50')];if(!_0x3d156e[_0x62d0('0x39')][_0x62d0('0x58')](_0x62d0('0x3e'))){_0x948142[_0x62d0('0x27')]=qs[_0x62d0('0x27')](_0x3d156e[_0x62d0('0x39')][_0x62d0('0x27')]);_0x948142[_0x62d0('0x26')]=qs[_0x62d0('0x26')](_0x3d156e[_0x62d0('0x39')][_0x62d0('0x26')]);}return _0x175a82[_0x62d0('0x5b')](_0x948142);}})['then'](function(_0x4c2271){if(_0x4c2271){return _0x4c2271?{'count':_0x4f3ce7,'rows':_0x4c2271}:null;}})[_0x62d0('0x2d')](respondWithResult(_0x4e7761,null))[_0x62d0('0x23')](handleError(_0x4e7761,null));};exports[_0x62d0('0x5d')]=function(_0x3c235d,_0x5dcfa3,_0x477e35){if(_0x3c235d[_0x62d0('0x53')]['id']){delete _0x3c235d[_0x62d0('0x53')]['id'];}return db[_0x62d0('0x46')][_0x62d0('0x55')]({'where':{'id':_0x3c235d['params']['id']}})['then'](handleEntityNotFound(_0x5dcfa3,null))['then'](function(_0x108ea3){if(_0x108ea3){return _0x108ea3[_0x62d0('0x5d')](_0x3c235d[_0x62d0('0x53')][_0x62d0('0x5e')]||[]);}return null;})[_0x62d0('0x2d')](respondWithResult(_0x5dcfa3,null))[_0x62d0('0x23')](handleError(_0x5dcfa3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 6931bc4..7b25d1b 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 _0x969c=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x29cf4c,_0x2c533a){var _0x98a394=function(_0x4082af){while(--_0x4082af){_0x29cf4c['push'](_0x29cf4c['shift']());}};_0x98a394(++_0x2c533a);}(_0x969c,0x67));var _0xc969=function(_0x38fda0,_0x531571){_0x38fda0=_0x38fda0-0x0;var _0x16dc82=_0x969c[_0x38fda0];return _0x16dc82;};'use strict';var _=require('lodash');var util=require(_0xc969('0x0'));var logger=require(_0xc969('0x1'))(_0xc969('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc969('0x3'));var fs=require('fs');var path=require(_0xc969('0x4'));var rimraf=require(_0xc969('0x5'));var config=require(_0xc969('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc969('0x7')]=function(_0x174f8b,_0x394bcb){return _0x174f8b[_0xc969('0x8')](_0xc969('0x9'),attributes,{'tableName':_0xc969('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5df=['../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x27b88,_0x2d0024){var _0x14b146=function(_0x17608f){while(--_0x17608f){_0x27b88['push'](_0x27b88['shift']());}};_0x14b146(++_0x2d0024);}(_0xd5df,0xa9));var _0xfd5d=function(_0x237ef6,_0x198caf){_0x237ef6=_0x237ef6-0x0;var _0x311ddd=_0xd5df[_0x237ef6];return _0x311ddd;};'use strict';var _=require(_0xfd5d('0x0'));var util=require(_0xfd5d('0x1'));var logger=require(_0xfd5d('0x2'))(_0xfd5d('0x3'));var moment=require('moment');var BPromise=require(_0xfd5d('0x4'));var rp=require(_0xfd5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd5d('0x6'));var config=require(_0xfd5d('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x4bb8c3,_0x56597b){return _0x4bb8c3[_0xfd5d('0x8')](_0xfd5d('0x9'),attributes,{'tableName':_0xfd5d('0xa'),'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 48fea50..d2158da 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 _0x2229=['debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0xa04ace,_0x5e317d){var _0x58758a=function(_0x31a877){while(--_0x31a877){_0xa04ace['push'](_0xa04ace['shift']());}};_0x58758a(++_0x5e317d);}(_0x2229,0x198));var _0x9222=function(_0x488e3d,_0x4f7e2a){_0x488e3d=_0x488e3d-0x0;var _0x3ee2b2=_0x2229[_0x488e3d];return _0x3ee2b2;};'use strict';var _=require(_0x9222('0x0'));var util=require(_0x9222('0x1'));var moment=require(_0x9222('0x2'));var BPromise=require('bluebird');var rs=require(_0x9222('0x3'));var fs=require('fs');var Redis=require(_0x9222('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9222('0x5'));var config=require(_0x9222('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9222('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27897d,_0x2b3129,_0x15722a){return new BPromise(function(_0x3cd514,_0x1d730b){return client[_0x9222('0x8')](_0x27897d,_0x15722a)[_0x9222('0x9')](function(_0x379f72){logger[_0x9222('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2b3129,_0x9222('0xb'));logger[_0x9222('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2b3129,_0x9222('0xb'),JSON[_0x9222('0xd')](_0x379f72));if(_0x379f72['error']){if(_0x379f72[_0x9222('0xe')][_0x9222('0xf')]===0x1f4){logger[_0x9222('0xe')](_0x9222('0x10'),_0x2b3129,_0x379f72[_0x9222('0xe')][_0x9222('0x11')]);return _0x1d730b(_0x379f72[_0x9222('0xe')][_0x9222('0x11')]);}logger[_0x9222('0xe')](_0x9222('0x10'),_0x2b3129,_0x379f72[_0x9222('0xe')][_0x9222('0x11')]);return _0x3cd514(_0x379f72[_0x9222('0xe')][_0x9222('0x11')]);}else{logger[_0x9222('0xa')](_0x9222('0x10'),_0x2b3129,_0x9222('0xb'));_0x3cd514(_0x379f72[_0x9222('0x12')]['message']);}})[_0x9222('0x13')](function(_0x5cf0a9){logger[_0x9222('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2b3129,_0x5cf0a9);_0x1d730b(_0x5cf0a9);});});} \ No newline at end of file +var _0x9aeb=['http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x9aeb,0xff));var _0xb9ae=function(_0x325419,_0x320864){_0x325419=_0x325419-0x0;var _0x480831=_0x9aeb[_0x325419];return _0x480831;};'use strict';var _=require(_0xb9ae('0x0'));var util=require(_0xb9ae('0x1'));var moment=require(_0xb9ae('0x2'));var BPromise=require(_0xb9ae('0x3'));var rs=require(_0xb9ae('0x4'));var fs=require('fs');var Redis=require(_0xb9ae('0x5'));var db=require(_0xb9ae('0x6'))['db'];var utils=require(_0xb9ae('0x7'));var logger=require(_0xb9ae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb9ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a6910,_0x49b9b3,_0x3be002){return new BPromise(function(_0x147728,_0x2ecd52){return client[_0xb9ae('0xa')](_0x5a6910,_0x3be002)[_0xb9ae('0xb')](function(_0x1d5c6b){logger['info'](_0xb9ae('0xc'),_0x49b9b3,_0xb9ae('0xd'));logger[_0xb9ae('0xe')](_0xb9ae('0xf'),_0x49b9b3,'request\x20sent',JSON['stringify'](_0x1d5c6b));if(_0x1d5c6b[_0xb9ae('0x10')]){if(_0x1d5c6b[_0xb9ae('0x10')][_0xb9ae('0x11')]===0x1f4){logger['error'](_0xb9ae('0xc'),_0x49b9b3,_0x1d5c6b[_0xb9ae('0x10')][_0xb9ae('0x12')]);return _0x2ecd52(_0x1d5c6b[_0xb9ae('0x10')][_0xb9ae('0x12')]);}logger[_0xb9ae('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x49b9b3,_0x1d5c6b[_0xb9ae('0x10')][_0xb9ae('0x12')]);return _0x147728(_0x1d5c6b['error']['message']);}else{logger[_0xb9ae('0x13')](_0xb9ae('0xc'),_0x49b9b3,_0xb9ae('0xd'));_0x147728(_0x1d5c6b[_0xb9ae('0x14')][_0xb9ae('0x12')]);}})[_0xb9ae('0x15')](function(_0x12efb2){logger[_0xb9ae('0x10')](_0xb9ae('0xc'),_0x49b9b3,_0x12efb2);_0x2ecd52(_0x12efb2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f0330af..a6fd0f7 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 _0x867f=['util','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','show','post','/:id','update','destroy','exports','multer'];(function(_0x400087,_0x56ecdd){var _0x2eff26=function(_0x28c08c){while(--_0x28c08c){_0x400087['push'](_0x400087['shift']());}};_0x2eff26(++_0x56ecdd);}(_0x867f,0x7f));var _0xf867=function(_0x50b651,_0x2ce0c5){_0x50b651=_0x50b651-0x0;var _0x1ec2b0=_0x867f[_0x50b651];return _0x1ec2b0;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var auth=require(_0xf867('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xf867('0x7')]('/',auth[_0xf867('0x8')](),controller[_0xf867('0x9')]);router[_0xf867('0x7')]('/:id',auth[_0xf867('0x8')](),controller[_0xf867('0xa')]);router[_0xf867('0xb')]('/',auth[_0xf867('0x8')](),controller['create']);router['put'](_0xf867('0xc'),auth[_0xf867('0x8')](),controller[_0xf867('0xd')]);router['delete'](_0xf867('0xc'),auth['isAuthenticated'](),controller[_0xf867('0xe')]);module[_0xf867('0xf')]=router; \ No newline at end of file +var _0xae64=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x176e74,_0x49256d){var _0xfe19e5=function(_0x65b0f3){while(--_0x65b0f3){_0x176e74['push'](_0x176e74['shift']());}};_0xfe19e5(++_0x49256d);}(_0xae64,0x1ef));var _0x4ae6=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0xae64[_0x18a772];return _0xbaac04;};'use strict';var multer=require(_0x4ae6('0x0'));var util=require(_0x4ae6('0x1'));var path=require('path');var timeout=require(_0x4ae6('0x2'));var express=require(_0x4ae6('0x3'));var router=express[_0x4ae6('0x4')]();var auth=require(_0x4ae6('0x5'));var interaction=require(_0x4ae6('0x6'));var config=require(_0x4ae6('0x7'));var controller=require(_0x4ae6('0x8'));router[_0x4ae6('0x9')]('/',auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xb')]);router[_0x4ae6('0x9')](_0x4ae6('0xc'),auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xd')]);router[_0x4ae6('0xe')]('/',auth[_0x4ae6('0xa')](),controller[_0x4ae6('0xf')]);router[_0x4ae6('0x10')]('/:id',auth[_0x4ae6('0xa')](),controller['update']);router[_0x4ae6('0x11')](_0x4ae6('0xc'),auth[_0x4ae6('0xa')](),controller['destroy']);module[_0x4ae6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index fbfdb44..80d5854 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 _0xe5b3=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x1b5e54,_0x65594a){var _0xd2fc55=function(_0x28312d){while(--_0x28312d){_0x1b5e54['push'](_0x1b5e54['shift']());}};_0xd2fc55(++_0x65594a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5e1313,_0x2dbfa6){_0x5e1313=_0x5e1313-0x0;var _0x2b4bc8=_0xe5b3[_0x5e1313];return _0x2b4bc8;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'type':{'type':Sequelize[_0x3e5b('0x1')](_0x3e5b('0x2'),_0x3e5b('0x3'),_0x3e5b('0x4'),_0x3e5b('0x5')),'defaultValue':_0x3e5b('0x2')},'content':{'type':Sequelize[_0x3e5b('0x6')]},'key':{'type':Sequelize[_0x3e5b('0x6')]},'keyType':{'type':Sequelize[_0x3e5b('0x1')](_0x3e5b('0x2'),'variable',_0x3e5b('0x4'))},'keyContent':{'type':Sequelize[_0x3e5b('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3e5b('0x6')]},'customField':{'type':Sequelize[_0x3e5b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3e5b('0x6')]}}; \ No newline at end of file +var _0xcabc=['customVariable','STRING','exports','ENUM','string','variable'];(function(_0x41f5a6,_0xb35c51){var _0x241efd=function(_0x2cfaa5){while(--_0x2cfaa5){_0x41f5a6['push'](_0x41f5a6['shift']());}};_0x241efd(++_0xb35c51);}(_0xcabc,0x16a));var _0xccab=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcabc[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0xccab('0x0')]={'type':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),_0xccab('0x4'),'keyValue'),'defaultValue':_0xccab('0x2')},'content':{'type':Sequelize[_0xccab('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xccab('0x1')](_0xccab('0x2'),_0xccab('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xccab('0x5')]},'idField':{'type':Sequelize[_0xccab('0x5')]},'nameField':{'type':Sequelize[_0xccab('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xccab('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d4a6f17..fe44e01 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 _0x2993=['path','sox','to-csv','ejs','lodash','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','ZendeskField','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x23345f,_0xc1cd34){var _0x1865e0=function(_0x4c76e3){while(--_0x4c76e3){_0x23345f['push'](_0x23345f['shift']());}};_0x1865e0(++_0xc1cd34);}(_0x2993,0x1e7));var _0x3299=function(_0x5730bd,_0x4d00e2){_0x5730bd=_0x5730bd-0x0;var _0x20f45b=_0x2993[_0x5730bd];return _0x20f45b;};'use strict';var pdf=require(_0x3299('0x0'));var emlformat=require(_0x3299('0x1'));var rimraf=require(_0x3299('0x2'));var zipdir=require(_0x3299('0x3'));var jsonpatch=require(_0x3299('0x4'));var rp=require(_0x3299('0x5'));var moment=require(_0x3299('0x6'));var BPromise=require(_0x3299('0x7'));var Mustache=require(_0x3299('0x8'));var util=require(_0x3299('0x9'));var path=require(_0x3299('0xa'));var sox=require(_0x3299('0xb'));var csv=require(_0x3299('0xc'));var ejs=require(_0x3299('0xd'));var fs=require('fs');var _=require(_0x3299('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3299('0xf'));var toCsv=require(_0x3299('0xc'));var querystring=require(_0x3299('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3299('0x11'));var as=require(_0x3299('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3299('0x13'));var utils=require(_0x3299('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bac6e,_0x351737){_0x351737=_0x351737||0xcc;return function(_0x45c950){if(_0x45c950){return _0x4bac6e[_0x3299('0x15')](_0x351737);}return _0x4bac6e[_0x3299('0x16')](_0x351737)[_0x3299('0x17')]();};}function respondWithResult(_0x5d2c8b,_0x55ddec){_0x55ddec=_0x55ddec||0xc8;return function(_0x8ff56){if(_0x8ff56){return _0x5d2c8b[_0x3299('0x16')](_0x55ddec)[_0x3299('0x18')](_0x8ff56);}};}function respondWithFilteredResult(_0xa55ee6,_0xb85460){return function(_0x5304b1){if(_0x5304b1){var _0x2259d5=_0x5304b1[_0x3299('0x19')],_0x5e7cfa=_0xb85460[_0x3299('0x1a')],_0x437cbb=_0xb85460['offset']+_0xb85460[_0x3299('0x1b')],_0x31c01b;if(_0x437cbb>=_0x2259d5){_0x437cbb=_0x2259d5;_0x31c01b=0xc8;}else{_0x31c01b=0xce;}_0xa55ee6['status'](_0x31c01b);return _0xa55ee6[_0x3299('0x1c')](_0x3299('0x1d'),_0x5e7cfa+'-'+_0x437cbb+'/'+_0x2259d5)[_0x3299('0x18')](_0x5304b1);}return null;};}function patchUpdates(_0x15723a){return function(_0x275300){try{jsonpatch[_0x3299('0x1e')](_0x275300,_0x15723a,!![]);}catch(_0x342d0f){return BPromise['reject'](_0x342d0f);}return _0x275300[_0x3299('0x1f')]();};}function saveUpdates(_0x2a2b1c,_0x3feeca){return function(_0x20f923){if(_0x20f923){return _0x20f923[_0x3299('0x20')](_0x2a2b1c)[_0x3299('0x21')](function(_0x48be44){return _0x48be44;});}return null;};}function removeEntity(_0x318e61,_0x26d0f2){return function(_0x4901eb){if(_0x4901eb){return _0x4901eb[_0x3299('0x22')]()[_0x3299('0x21')](function(){_0x318e61[_0x3299('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58ea39,_0x457a7e){return function(_0x2a6ea9){if(!_0x2a6ea9){_0x58ea39[_0x3299('0x15')](0x194);}return _0x2a6ea9;};}function handleError(_0x5950c0,_0x268e77){_0x268e77=_0x268e77||0x1f4;return function(_0x14d374){logger[_0x3299('0x23')](_0x14d374['stack']);if(_0x14d374[_0x3299('0x24')]){delete _0x14d374['name'];}_0x5950c0[_0x3299('0x16')](_0x268e77)[_0x3299('0x25')](_0x14d374);};}exports[_0x3299('0x26')]=function(_0x2a9d6b,_0x470632){var _0x5d3db3={},_0xfa0082={},_0x5bf1e6={'count':0x0,'rows':[]};var _0x55ccd2=_['map'](db[_0x3299('0x27')][_0x3299('0x28')],function(_0x1d63e4){return{'name':_0x1d63e4[_0x3299('0x29')],'type':_0x1d63e4[_0x3299('0x2a')]['key']};});_0xfa0082[_0x3299('0x2b')]=_[_0x3299('0x2c')](_0x55ccd2,_0x3299('0x24'));_0xfa0082['query']=_[_0x3299('0x2d')](_0x2a9d6b[_0x3299('0x2e')]);_0xfa0082[_0x3299('0x2f')]=_[_0x3299('0x30')](_0xfa0082[_0x3299('0x2b')],_0xfa0082['query']);_0x5d3db3[_0x3299('0x31')]=_[_0x3299('0x30')](_0xfa0082['model'],qs[_0x3299('0x32')](_0x2a9d6b[_0x3299('0x2e')]['fields']));_0x5d3db3[_0x3299('0x31')]=_0x5d3db3[_0x3299('0x31')][_0x3299('0x33')]?_0x5d3db3['attributes']:_0xfa0082[_0x3299('0x2b')];if(!_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x34')](_0x3299('0x35'))){_0x5d3db3[_0x3299('0x1b')]=qs[_0x3299('0x1b')](_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x1b')]);_0x5d3db3[_0x3299('0x1a')]=qs['offset'](_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x1a')]);}_0x5d3db3[_0x3299('0x36')]=qs[_0x3299('0x37')](_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x37')]);_0x5d3db3[_0x3299('0x38')]=qs[_0x3299('0x2f')](_[_0x3299('0x39')](_0x2a9d6b[_0x3299('0x2e')],_0xfa0082[_0x3299('0x2f')]),_0x55ccd2);if(_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x3a')]){_0x5d3db3['where']=_['merge'](_0x5d3db3['where'],{'$or':_['map'](_0x55ccd2,function(_0x13fe93){if(_0x13fe93[_0x3299('0x2a')]!==_0x3299('0x3b')){var _0x2e97b1={};_0x2e97b1[_0x13fe93[_0x3299('0x24')]]={'$like':'%'+_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x3a')]+'%'};return _0x2e97b1;}})});}_0x5d3db3=_[_0x3299('0x3c')]({},_0x5d3db3,_0x2a9d6b[_0x3299('0x3d')]);var _0x5b5704={'where':_0x5d3db3[_0x3299('0x38')]};return db[_0x3299('0x27')][_0x3299('0x19')](_0x5b5704)[_0x3299('0x21')](function(_0x3cbb33){_0x5bf1e6[_0x3299('0x19')]=_0x3cbb33;if(_0x2a9d6b[_0x3299('0x2e')][_0x3299('0x3e')]){_0x5d3db3[_0x3299('0x3f')]=[{'all':!![]}];}return db[_0x3299('0x27')][_0x3299('0x40')](_0x5d3db3);})[_0x3299('0x21')](function(_0x2ce539){_0x5bf1e6[_0x3299('0x41')]=_0x2ce539;return _0x5bf1e6;})[_0x3299('0x21')](respondWithFilteredResult(_0x470632,_0x5d3db3))[_0x3299('0x42')](handleError(_0x470632,null));};exports['show']=function(_0x11a244,_0x333349){var _0xf5e2b4={'raw':!![],'where':{'id':_0x11a244[_0x3299('0x43')]['id']}},_0xe46d47={};_0xe46d47[_0x3299('0x2b')]=_[_0x3299('0x2d')](db['ZendeskField']['rawAttributes']);_0xe46d47[_0x3299('0x2e')]=_[_0x3299('0x2d')](_0x11a244[_0x3299('0x2e')]);_0xe46d47['filtears']=_['intersection'](_0xe46d47['model'],_0xe46d47[_0x3299('0x2e')]);_0xf5e2b4['attributes']=_[_0x3299('0x30')](_0xe46d47[_0x3299('0x2b')],qs['fields'](_0x11a244['query'][_0x3299('0x32')]));_0xf5e2b4['attributes']=_0xf5e2b4[_0x3299('0x31')]['length']?_0xf5e2b4[_0x3299('0x31')]:_0xe46d47[_0x3299('0x2b')];if(_0x11a244['query'][_0x3299('0x3e')]){_0xf5e2b4[_0x3299('0x3f')]=[{'all':!![]}];}_0xf5e2b4=_[_0x3299('0x3c')]({},_0xf5e2b4,_0x11a244[_0x3299('0x3d')]);return db[_0x3299('0x27')][_0x3299('0x44')](_0xf5e2b4)[_0x3299('0x21')](handleEntityNotFound(_0x333349,null))['then'](respondWithResult(_0x333349,null))[_0x3299('0x42')](handleError(_0x333349,null));};exports[_0x3299('0x45')]=function(_0x3aa2bb,_0x5661ac){return db[_0x3299('0x27')][_0x3299('0x45')](_0x3aa2bb[_0x3299('0x46')],{})['then'](respondWithResult(_0x5661ac,0xc9))[_0x3299('0x42')](handleError(_0x5661ac,null));};exports['update']=function(_0x1d6498,_0x558ecf){if(_0x1d6498[_0x3299('0x46')]['id']){delete _0x1d6498['body']['id'];}return db[_0x3299('0x27')][_0x3299('0x44')]({'where':{'id':_0x1d6498[_0x3299('0x43')]['id']}})[_0x3299('0x21')](handleEntityNotFound(_0x558ecf,null))[_0x3299('0x21')](saveUpdates(_0x1d6498[_0x3299('0x46')],null))['then'](respondWithResult(_0x558ecf,null))['catch'](handleError(_0x558ecf,null));};exports['destroy']=function(_0x237a1b,_0x11b54e){return db[_0x3299('0x27')][_0x3299('0x44')]({'where':{'id':_0x237a1b[_0x3299('0x43')]['id']}})[_0x3299('0x21')](handleEntityNotFound(_0x11b54e,null))[_0x3299('0x21')](removeEntity(_0x11b54e,null))[_0x3299('0x42')](handleError(_0x11b54e,null));}; \ No newline at end of file +var _0xdd0e=['where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','destroy','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ZendeskField','fieldName','type','model','keys','query','intersection','attributes','fields','length','limit','order','sort'];(function(_0x3cb6fa,_0x516f15){var _0x4d786e=function(_0x481c65){while(--_0x481c65){_0x3cb6fa['push'](_0x3cb6fa['shift']());}};_0x4d786e(++_0x516f15);}(_0xdd0e,0x1bc));var _0xedd0=function(_0x25e49e,_0x564de6){_0x25e49e=_0x25e49e-0x0;var _0x425d30=_0xdd0e[_0x25e49e];return _0x425d30;};'use strict';var pdf=require(_0xedd0('0x0'));var emlformat=require(_0xedd0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xedd0('0x2'));var rp=require(_0xedd0('0x3'));var moment=require(_0xedd0('0x4'));var BPromise=require(_0xedd0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xedd0('0x6'));var ejs=require(_0xedd0('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xedd0('0x8'));var jsforce=require(_0xedd0('0x9'));var deskjs=require(_0xedd0('0xa'));var toCsv=require(_0xedd0('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xedd0('0xb'));var authService=require(_0xedd0('0xc'));var qs=require(_0xedd0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedd0('0xe'));var logger=require(_0xedd0('0xf'))(_0xedd0('0x10'));var utils=require(_0xedd0('0x11'));var config=require(_0xedd0('0x12'));var licenseUtil=require(_0xedd0('0x13'));var db=require(_0xedd0('0x14'))['db'];function respondWithStatusCode(_0x8892ff,_0x208da9){_0x208da9=_0x208da9||0xcc;return function(_0x4a69de){if(_0x4a69de){return _0x8892ff[_0xedd0('0x15')](_0x208da9);}return _0x8892ff['status'](_0x208da9)[_0xedd0('0x16')]();};}function respondWithResult(_0x5ba324,_0x312c8b){_0x312c8b=_0x312c8b||0xc8;return function(_0x2f0e3e){if(_0x2f0e3e){return _0x5ba324['status'](_0x312c8b)[_0xedd0('0x17')](_0x2f0e3e);}};}function respondWithFilteredResult(_0x1e2b5e,_0x34de56){return function(_0x39a84b){if(_0x39a84b){var _0x4a5594=_0x39a84b[_0xedd0('0x18')],_0xd3cbd3=_0x34de56[_0xedd0('0x19')],_0x10c8bb=_0x34de56[_0xedd0('0x19')]+_0x34de56['limit'],_0x37cd84;if(_0x10c8bb>=_0x4a5594){_0x10c8bb=_0x4a5594;_0x37cd84=0xc8;}else{_0x37cd84=0xce;}_0x1e2b5e[_0xedd0('0x1a')](_0x37cd84);return _0x1e2b5e[_0xedd0('0x1b')](_0xedd0('0x1c'),_0xd3cbd3+'-'+_0x10c8bb+'/'+_0x4a5594)[_0xedd0('0x17')](_0x39a84b);}return null;};}function patchUpdates(_0x3fa3bf){return function(_0x5c1991){try{jsonpatch[_0xedd0('0x1d')](_0x5c1991,_0x3fa3bf,!![]);}catch(_0x25dcaf){return BPromise[_0xedd0('0x1e')](_0x25dcaf);}return _0x5c1991[_0xedd0('0x1f')]();};}function saveUpdates(_0x42b21d,_0x431c95){return function(_0x542006){if(_0x542006){return _0x542006[_0xedd0('0x20')](_0x42b21d)[_0xedd0('0x21')](function(_0x480540){return _0x480540;});}return null;};}function removeEntity(_0x57b8c0,_0x301ffe){return function(_0x1034d8){if(_0x1034d8){return _0x1034d8['destroy']()[_0xedd0('0x21')](function(){_0x57b8c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fddc,_0x43dcfa){return function(_0xc4a321){if(!_0xc4a321){_0x50fddc[_0xedd0('0x15')](0x194);}return _0xc4a321;};}function handleError(_0x4e7364,_0x113dc4){_0x113dc4=_0x113dc4||0x1f4;return function(_0x4f17c0){logger[_0xedd0('0x22')](_0x4f17c0[_0xedd0('0x23')]);if(_0x4f17c0['name']){delete _0x4f17c0[_0xedd0('0x24')];}_0x4e7364[_0xedd0('0x1a')](_0x113dc4)[_0xedd0('0x25')](_0x4f17c0);};}exports[_0xedd0('0x26')]=function(_0x39943d,_0x191786){var _0x142f76={},_0x2d7972={},_0x4aecb6={'count':0x0,'rows':[]};var _0x102e07=_[_0xedd0('0x27')](db[_0xedd0('0x28')]['rawAttributes'],function(_0x21687f){return{'name':_0x21687f[_0xedd0('0x29')],'type':_0x21687f[_0xedd0('0x2a')]['key']};});_0x2d7972[_0xedd0('0x2b')]=_['map'](_0x102e07,'name');_0x2d7972['query']=_[_0xedd0('0x2c')](_0x39943d[_0xedd0('0x2d')]);_0x2d7972['filters']=_[_0xedd0('0x2e')](_0x2d7972[_0xedd0('0x2b')],_0x2d7972['query']);_0x142f76[_0xedd0('0x2f')]=_[_0xedd0('0x2e')](_0x2d7972[_0xedd0('0x2b')],qs[_0xedd0('0x30')](_0x39943d['query'][_0xedd0('0x30')]));_0x142f76[_0xedd0('0x2f')]=_0x142f76['attributes'][_0xedd0('0x31')]?_0x142f76[_0xedd0('0x2f')]:_0x2d7972[_0xedd0('0x2b')];if(!_0x39943d[_0xedd0('0x2d')]['hasOwnProperty']('nolimit')){_0x142f76[_0xedd0('0x32')]=qs[_0xedd0('0x32')](_0x39943d[_0xedd0('0x2d')][_0xedd0('0x32')]);_0x142f76['offset']=qs[_0xedd0('0x19')](_0x39943d[_0xedd0('0x2d')][_0xedd0('0x19')]);}_0x142f76[_0xedd0('0x33')]=qs[_0xedd0('0x34')](_0x39943d[_0xedd0('0x2d')]['sort']);_0x142f76[_0xedd0('0x35')]=qs[_0xedd0('0x36')](_['pick'](_0x39943d['query'],_0x2d7972['filters']),_0x102e07);if(_0x39943d[_0xedd0('0x2d')][_0xedd0('0x37')]){_0x142f76['where']=_['merge'](_0x142f76[_0xedd0('0x35')],{'$or':_[_0xedd0('0x27')](_0x102e07,function(_0x311fcb){if(_0x311fcb[_0xedd0('0x2a')]!==_0xedd0('0x38')){var _0x38ab5f={};_0x38ab5f[_0x311fcb[_0xedd0('0x24')]]={'$like':'%'+_0x39943d[_0xedd0('0x2d')][_0xedd0('0x37')]+'%'};return _0x38ab5f;}})});}_0x142f76=_[_0xedd0('0x39')]({},_0x142f76,_0x39943d[_0xedd0('0x3a')]);var _0x2ab503={'where':_0x142f76['where']};return db[_0xedd0('0x28')][_0xedd0('0x18')](_0x2ab503)[_0xedd0('0x21')](function(_0x892a3a){_0x4aecb6['count']=_0x892a3a;if(_0x39943d[_0xedd0('0x2d')][_0xedd0('0x3b')]){_0x142f76[_0xedd0('0x3c')]=[{'all':!![]}];}return db[_0xedd0('0x28')][_0xedd0('0x3d')](_0x142f76);})[_0xedd0('0x21')](function(_0x55d7b2){_0x4aecb6[_0xedd0('0x3e')]=_0x55d7b2;return _0x4aecb6;})[_0xedd0('0x21')](respondWithFilteredResult(_0x191786,_0x142f76))[_0xedd0('0x3f')](handleError(_0x191786,null));};exports[_0xedd0('0x40')]=function(_0x1458c8,_0x29c44d){var _0x510a10={'raw':!![],'where':{'id':_0x1458c8[_0xedd0('0x41')]['id']}},_0x37dd42={};_0x37dd42[_0xedd0('0x2b')]=_['keys'](db[_0xedd0('0x28')]['rawAttributes']);_0x37dd42[_0xedd0('0x2d')]=_[_0xedd0('0x2c')](_0x1458c8[_0xedd0('0x2d')]);_0x37dd42[_0xedd0('0x42')]=_['intersection'](_0x37dd42[_0xedd0('0x2b')],_0x37dd42['query']);_0x510a10[_0xedd0('0x2f')]=_[_0xedd0('0x2e')](_0x37dd42['model'],qs['fields'](_0x1458c8[_0xedd0('0x2d')][_0xedd0('0x30')]));_0x510a10[_0xedd0('0x2f')]=_0x510a10[_0xedd0('0x2f')][_0xedd0('0x31')]?_0x510a10['attributes']:_0x37dd42[_0xedd0('0x2b')];if(_0x1458c8[_0xedd0('0x2d')][_0xedd0('0x3b')]){_0x510a10[_0xedd0('0x3c')]=[{'all':!![]}];}_0x510a10=_[_0xedd0('0x39')]({},_0x510a10,_0x1458c8['options']);return db[_0xedd0('0x28')][_0xedd0('0x43')](_0x510a10)['then'](handleEntityNotFound(_0x29c44d,null))[_0xedd0('0x21')](respondWithResult(_0x29c44d,null))['catch'](handleError(_0x29c44d,null));};exports[_0xedd0('0x44')]=function(_0x1e0ab8,_0xc6fa2){return db[_0xedd0('0x28')][_0xedd0('0x44')](_0x1e0ab8[_0xedd0('0x45')],{})[_0xedd0('0x21')](respondWithResult(_0xc6fa2,0xc9))['catch'](handleError(_0xc6fa2,null));};exports[_0xedd0('0x20')]=function(_0x3fc6e0,_0x398cf9){if(_0x3fc6e0[_0xedd0('0x45')]['id']){delete _0x3fc6e0[_0xedd0('0x45')]['id'];}return db[_0xedd0('0x28')][_0xedd0('0x43')]({'where':{'id':_0x3fc6e0[_0xedd0('0x41')]['id']}})['then'](handleEntityNotFound(_0x398cf9,null))[_0xedd0('0x21')](saveUpdates(_0x3fc6e0[_0xedd0('0x45')],null))['then'](respondWithResult(_0x398cf9,null))[_0xedd0('0x3f')](handleError(_0x398cf9,null));};exports[_0xedd0('0x46')]=function(_0x36cd36,_0x12f7ab){return db['ZendeskField'][_0xedd0('0x43')]({'where':{'id':_0x36cd36[_0xedd0('0x41')]['id']}})['then'](handleEntityNotFound(_0x12f7ab,null))[_0xedd0('0x21')](removeEntity(_0x12f7ab,null))[_0xedd0('0x3f')](handleError(_0x12f7ab,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 837c4fa..96d7ce5 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 _0x0f69=['moment','bluebird','path','rimraf','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','../../config/logger'];(function(_0x3668c7,_0x3dc9f1){var _0x257ad5=function(_0x35a208){while(--_0x35a208){_0x3668c7['push'](_0x3668c7['shift']());}};_0x257ad5(++_0x3dc9f1);}(_0x0f69,0x173));var _0x90f6=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x0f69[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90f6('0x0'))('api');var moment=require(_0x90f6('0x1'));var BPromise=require(_0x90f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90f6('0x3'));var rimraf=require(_0x90f6('0x4'));var config=require('../../config/environment');var attributes=require(_0x90f6('0x5'));module['exports']=function(_0x1840a5,_0x3dfd95){return _0x1840a5[_0x90f6('0x6')](_0x90f6('0x7'),attributes,{'tableName':_0x90f6('0x8'),'paranoid':![],'indexes':[{'name':_0x90f6('0x9'),'fields':[_0x90f6('0xa'),_0x90f6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6953=['FieldId','lodash','util','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x6953,0x91));var _0x3695=function(_0x51f2f9,_0x276888){_0x51f2f9=_0x51f2f9-0x0;var _0x5e114e=_0x6953[_0x51f2f9];return _0x5e114e;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[{'name':_0x3695('0xa'),'fields':['idField',_0x3695('0xb')],'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 60f255a..7bc2987 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 _0xefa7=['code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x54c7d8,_0x44e1e7){var _0x491c9c=function(_0x567142){while(--_0x567142){_0x54c7d8['push'](_0x54c7d8['shift']());}};_0x491c9c(++_0x44e1e7);}(_0xefa7,0x180));var _0x7efa=function(_0x2a1b18,_0x43beb2){_0x2a1b18=_0x2a1b18-0x0;var _0x8d5273=_0xefa7[_0x2a1b18];return _0x8d5273;};'use strict';var _=require(_0x7efa('0x0'));var util=require(_0x7efa('0x1'));var moment=require(_0x7efa('0x2'));var BPromise=require(_0x7efa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7efa('0x4'))['db'];var utils=require(_0x7efa('0x5'));var logger=require(_0x7efa('0x6'))(_0x7efa('0x7'));var config=require(_0x7efa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7efa('0x9')][_0x7efa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ae993,_0x34d3b3,_0x343719){return new BPromise(function(_0xf4f3f0,_0x370f36){return client['request'](_0x4ae993,_0x343719)[_0x7efa('0xb')](function(_0x369fd7){logger['info'](_0x7efa('0xc'),_0x34d3b3,'request\x20sent');logger[_0x7efa('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x34d3b3,_0x7efa('0xe'),JSON['stringify'](_0x369fd7));if(_0x369fd7[_0x7efa('0xf')]){if(_0x369fd7[_0x7efa('0xf')][_0x7efa('0x10')]===0x1f4){logger[_0x7efa('0xf')](_0x7efa('0xc'),_0x34d3b3,_0x369fd7['error'][_0x7efa('0x11')]);return _0x370f36(_0x369fd7[_0x7efa('0xf')][_0x7efa('0x11')]);}logger[_0x7efa('0xf')](_0x7efa('0xc'),_0x34d3b3,_0x369fd7[_0x7efa('0xf')][_0x7efa('0x11')]);return _0xf4f3f0(_0x369fd7[_0x7efa('0xf')][_0x7efa('0x11')]);}else{logger[_0x7efa('0x12')](_0x7efa('0xc'),_0x34d3b3,_0x7efa('0xe'));_0xf4f3f0(_0x369fd7[_0x7efa('0x13')][_0x7efa('0x11')]);}})['catch'](function(_0x43695c){logger[_0x7efa('0xf')]('ZendeskField,\x20%s,\x20%s',_0x34d3b3,_0x43695c);_0x370f36(_0x43695c);});});} \ No newline at end of file +var _0xc238=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x300301,_0x55e16c){var _0x29c295=function(_0x109d3f){while(--_0x109d3f){_0x300301['push'](_0x300301['shift']());}};_0x29c295(++_0x55e16c);}(_0xc238,0x144));var _0x8c23=function(_0x5e81d4,_0x46c688){_0x5e81d4=_0x5e81d4-0x0;var _0x1e5267=_0xc238[_0x5e81d4];return _0x1e5267;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c23('0x0'));var BPromise=require(_0x8c23('0x1'));var rs=require(_0x8c23('0x2'));var fs=require('fs');var Redis=require(_0x8c23('0x3'));var db=require(_0x8c23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c23('0x5'))(_0x8c23('0x6'));var config=require(_0x8c23('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a6ea2,_0x3d8d77,_0x1f8186){return new BPromise(function(_0x32e0b0,_0x2bc3a6){return client[_0x8c23('0x8')](_0x2a6ea2,_0x1f8186)[_0x8c23('0x9')](function(_0x225f9a){logger[_0x8c23('0xa')](_0x8c23('0xb'),_0x3d8d77,_0x8c23('0xc'));logger[_0x8c23('0xd')](_0x8c23('0xe'),_0x3d8d77,_0x8c23('0xc'),JSON[_0x8c23('0xf')](_0x225f9a));if(_0x225f9a[_0x8c23('0x10')]){if(_0x225f9a[_0x8c23('0x10')][_0x8c23('0x11')]===0x1f4){logger[_0x8c23('0x10')](_0x8c23('0xb'),_0x3d8d77,_0x225f9a[_0x8c23('0x10')][_0x8c23('0x12')]);return _0x2bc3a6(_0x225f9a['error'][_0x8c23('0x12')]);}logger[_0x8c23('0x10')](_0x8c23('0xb'),_0x3d8d77,_0x225f9a[_0x8c23('0x10')][_0x8c23('0x12')]);return _0x32e0b0(_0x225f9a[_0x8c23('0x10')][_0x8c23('0x12')]);}else{logger[_0x8c23('0xa')](_0x8c23('0xb'),_0x3d8d77,'request\x20sent');_0x32e0b0(_0x225f9a[_0x8c23('0x13')][_0x8c23('0x12')]);}})[_0x8c23('0x14')](function(_0x42284e){logger[_0x8c23('0x10')](_0x8c23('0xb'),_0x3d8d77,_0x42284e);_0x2bc3a6(_0x42284e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2506775..e7f09a4 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 _0x4c41=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x4c41,0xcc));var _0x14c4=function(_0x3f9cb8,_0x143b4b){_0x3f9cb8=_0x3f9cb8-0x0;var _0x3773b9=_0x4c41[_0x3f9cb8];return _0x3773b9;};'use strict';var multer=require(_0x14c4('0x0'));var util=require(_0x14c4('0x1'));var path=require(_0x14c4('0x2'));var timeout=require(_0x14c4('0x3'));var express=require('express');var router=express[_0x14c4('0x4')]();var auth=require(_0x14c4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x14c4('0x6'));var controller=require(_0x14c4('0x7'));router[_0x14c4('0x8')]('/',auth[_0x14c4('0x9')](),controller[_0x14c4('0xa')]);router[_0x14c4('0x8')](_0x14c4('0xb'),auth[_0x14c4('0x9')](),controller[_0x14c4('0xc')]);router[_0x14c4('0x8')]('/:id/configurations',auth[_0x14c4('0x9')](),controller[_0x14c4('0xd')]);router[_0x14c4('0x8')](_0x14c4('0xe'),auth[_0x14c4('0x9')](),controller[_0x14c4('0xf')]);router[_0x14c4('0x10')]('/',auth[_0x14c4('0x9')](),controller[_0x14c4('0x11')]);router[_0x14c4('0x10')]('/:id/configurations',auth[_0x14c4('0x9')](),controller['addConfiguration']);router[_0x14c4('0x12')](_0x14c4('0xb'),auth['isAuthenticated'](),controller[_0x14c4('0x13')]);router[_0x14c4('0x14')](_0x14c4('0xb'),auth[_0x14c4('0x9')](),controller['destroy']);module[_0x14c4('0x15')]=router; \ No newline at end of file +var _0xc2b2=['./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','/:id','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0xada712,_0x514cb6){var _0x20e928=function(_0x39480e){while(--_0x39480e){_0xada712['push'](_0xada712['shift']());}};_0x20e928(++_0x514cb6);}(_0xc2b2,0x1b3));var _0x2c2b=function(_0x4aa390,_0x93e971){_0x4aa390=_0x4aa390-0x0;var _0x18d39c=_0xc2b2[_0x4aa390];return _0x18d39c;};'use strict';var multer=require(_0x2c2b('0x0'));var util=require(_0x2c2b('0x1'));var path=require('path');var timeout=require(_0x2c2b('0x2'));var express=require(_0x2c2b('0x3'));var router=express[_0x2c2b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c2b('0x5'));var config=require('../../config/environment');var controller=require(_0x2c2b('0x6'));router[_0x2c2b('0x7')]('/',auth[_0x2c2b('0x8')](),controller[_0x2c2b('0x9')]);router[_0x2c2b('0x7')]('/:id',auth[_0x2c2b('0x8')](),controller[_0x2c2b('0xa')]);router[_0x2c2b('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2c2b('0xb')]);router[_0x2c2b('0x7')](_0x2c2b('0xc'),auth[_0x2c2b('0x8')](),controller[_0x2c2b('0xd')]);router[_0x2c2b('0xe')]('/',auth[_0x2c2b('0x8')](),controller[_0x2c2b('0xf')]);router[_0x2c2b('0xe')](_0x2c2b('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x2c2b('0x11')]('/:id',auth[_0x2c2b('0x8')](),controller[_0x2c2b('0x12')]);router['delete'](_0x2c2b('0x13'),auth[_0x2c2b('0x8')](),controller['destroy']);module[_0x2c2b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 60d8499..d379363 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 _0x7105=['sequelize','STRING'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x7105,0xd8));var _0x5710=function(_0x1fe312,_0x5c0f7e){_0x1fe312=_0x1fe312-0x0;var _0x2e8f46=_0x7105[_0x1fe312];return _0x2e8f46;};'use strict';var Sequelize=require(_0x5710('0x0'));module['exports']={'name':{'type':Sequelize[_0x5710('0x1')]},'description':{'type':Sequelize[_0x5710('0x1')]},'host':{'type':Sequelize[_0x5710('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x5710('0x1')]},'clientSecret':{'type':Sequelize[_0x5710('0x1')]},'serverUrl':{'type':Sequelize[_0x5710('0x1')]},'code':{'type':Sequelize[_0x5710('0x1')]},'refreshToken':{'type':Sequelize[_0x5710('0x1')]}}; \ No newline at end of file +var _0x7a76=['sequelize','exports','STRING'];(function(_0x52e341,_0x26abb9){var _0x1dc553=function(_0x771782){while(--_0x771782){_0x52e341['push'](_0x52e341['shift']());}};_0x1dc553(++_0x26abb9);}(_0x7a76,0x1f2));var _0x67a7=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7a76[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x67a7('0x0'));module[_0x67a7('0x1')]={'name':{'type':Sequelize[_0x67a7('0x2')]},'description':{'type':Sequelize[_0x67a7('0x2')]},'host':{'type':Sequelize[_0x67a7('0x2')]},'zone':{'type':Sequelize[_0x67a7('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x67a7('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x67a7('0x2')]},'refreshToken':{'type':Sequelize[_0x67a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 002b7a6..a343845 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 _0x53d1=['stringify','error','code','message','info','catch','sendStatus','status','offset','set','Content-Range','json','reject','save','update','destroy','end','name','send','fieldName','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','merge','type','filter','options','ZohoAccount','count','findAll','rows','show','params','rawAttributes','includeAll','include','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xa0eff6,_0x163e0f){var _0x1f7029=function(_0x26a26e){while(--_0x26a26e){_0xa0eff6['push'](_0xa0eff6['shift']());}};_0x1f7029(++_0x163e0f);}(_0x53d1,0x174));var _0x153d=function(_0x52c967,_0x24861e){_0x52c967=_0x52c967-0x0;var _0x417600=_0x53d1[_0x52c967];return _0x417600;};'use strict';var pdf=require(_0x153d('0x0'));var emlformat=require(_0x153d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x153d('0x2'));var jsonpatch=require(_0x153d('0x3'));var rp=require(_0x153d('0x4'));var moment=require(_0x153d('0x5'));var BPromise=require(_0x153d('0x6'));var Mustache=require('mustache');var util=require(_0x153d('0x7'));var path=require(_0x153d('0x8'));var sox=require(_0x153d('0x9'));var csv=require('to-csv');var ejs=require(_0x153d('0xa'));var fs=require('fs');var _=require(_0x153d('0xb'));var squel=require(_0x153d('0xc'));var crypto=require('crypto');var jsforce=require(_0x153d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x153d('0xe'));var querystring=require(_0x153d('0xf'));var Papa=require('papaparse');var Redis=require(_0x153d('0x10'));var authService=require(_0x153d('0x11'));var qs=require(_0x153d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x153d('0x13'));var logger=require(_0x153d('0x14'))(_0x153d('0x15'));var utils=require(_0x153d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x153d('0x17'));var jayson=require(_0x153d('0x18'));var client=jayson[_0x153d('0x19')][_0x153d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xd5cdb1,_0x265581,_0x532cc2,_0x4f4e1c){return new BPromise(function(_0x14c7d7,_0x24a069){var _0x231c50=_0x4f4e1c||client;return _0x231c50[_0x153d('0x1b')](_0xd5cdb1,_0x532cc2)[_0x153d('0x1c')](function(_0x34f0c5){logger['info'](_0x153d('0x1d'),_0x265581,'request\x20sent');logger[_0x153d('0x1e')](_0x153d('0x1f'),_0x265581,_0x153d('0x20'),JSON[_0x153d('0x21')](_0x34f0c5));if(_0x34f0c5[_0x153d('0x22')]){if(_0x34f0c5['error'][_0x153d('0x23')]===0x1f4){logger[_0x153d('0x22')](_0x153d('0x1d'),_0x265581,_0x34f0c5[_0x153d('0x22')][_0x153d('0x24')]);return _0x24a069(_0x34f0c5[_0x153d('0x22')][_0x153d('0x24')]);}logger[_0x153d('0x22')](_0x153d('0x1d'),_0x265581,_0x34f0c5[_0x153d('0x22')][_0x153d('0x24')]);return _0x14c7d7(_0x34f0c5[_0x153d('0x22')][_0x153d('0x24')]);}else{logger[_0x153d('0x25')](_0x153d('0x1d'),_0x265581,_0x153d('0x20'));_0x14c7d7(_0x34f0c5['result'][_0x153d('0x24')]);}})[_0x153d('0x26')](function(_0x860e6b){logger[_0x153d('0x22')](_0x153d('0x1d'),_0x265581,_0x860e6b);_0x24a069(_0x860e6b);});});}function respondWithStatusCode(_0x433427,_0x178b95){_0x178b95=_0x178b95||0xcc;return function(_0x3e150a){if(_0x3e150a){return _0x433427[_0x153d('0x27')](_0x178b95);}return _0x433427[_0x153d('0x28')](_0x178b95)['end']();};}function respondWithResult(_0x439a91,_0x1edd67){_0x1edd67=_0x1edd67||0xc8;return function(_0x42bedd){if(_0x42bedd){return _0x439a91[_0x153d('0x28')](_0x1edd67)['json'](_0x42bedd);}};}function respondWithFilteredResult(_0x433671,_0x4151ca){return function(_0x197973){if(_0x197973){var _0x1098cd=_0x197973['count'],_0x22e37e=_0x4151ca[_0x153d('0x29')],_0x408da7=_0x4151ca[_0x153d('0x29')]+_0x4151ca['limit'],_0x575a8c;if(_0x408da7>=_0x1098cd){_0x408da7=_0x1098cd;_0x575a8c=0xc8;}else{_0x575a8c=0xce;}_0x433671[_0x153d('0x28')](_0x575a8c);return _0x433671[_0x153d('0x2a')](_0x153d('0x2b'),_0x22e37e+'-'+_0x408da7+'/'+_0x1098cd)[_0x153d('0x2c')](_0x197973);}return null;};}function patchUpdates(_0x11919f){return function(_0x2a23e2){try{jsonpatch['apply'](_0x2a23e2,_0x11919f,!![]);}catch(_0x38e3d5){return BPromise[_0x153d('0x2d')](_0x38e3d5);}return _0x2a23e2[_0x153d('0x2e')]();};}function saveUpdates(_0x22b365,_0x27f2c9){return function(_0x28463f){if(_0x28463f){return _0x28463f[_0x153d('0x2f')](_0x22b365)['then'](function(_0x2b3af8){return _0x2b3af8;});}return null;};}function removeEntity(_0x59062f,_0x238417){return function(_0x4dba63){if(_0x4dba63){return _0x4dba63[_0x153d('0x30')]()[_0x153d('0x1c')](function(){_0x59062f[_0x153d('0x28')](0xcc)[_0x153d('0x31')]();});}};}function handleEntityNotFound(_0x52beb6,_0x44966e){return function(_0x51603a){if(!_0x51603a){_0x52beb6[_0x153d('0x27')](0x194);}return _0x51603a;};}function handleError(_0x3d9364,_0x14bfc6){_0x14bfc6=_0x14bfc6||0x1f4;return function(_0xfcf0c5){logger[_0x153d('0x22')](_0xfcf0c5['stack']);if(_0xfcf0c5[_0x153d('0x32')]){delete _0xfcf0c5[_0x153d('0x32')];}_0x3d9364[_0x153d('0x28')](_0x14bfc6)[_0x153d('0x33')](_0xfcf0c5);};}exports['index']=function(_0x56a285,_0x3ce820){var _0x2d1da1={},_0x37fde5={},_0x3d701c={'count':0x0,'rows':[]};var _0x246e68=_['map'](db['ZohoAccount']['rawAttributes'],function(_0x423850){return{'name':_0x423850[_0x153d('0x34')],'type':_0x423850['type']['key']};});_0x37fde5[_0x153d('0x35')]=_[_0x153d('0x36')](_0x246e68,_0x153d('0x32'));_0x37fde5[_0x153d('0x37')]=_[_0x153d('0x38')](_0x56a285['query']);_0x37fde5['filters']=_[_0x153d('0x39')](_0x37fde5['model'],_0x37fde5['query']);_0x2d1da1[_0x153d('0x3a')]=_[_0x153d('0x39')](_0x37fde5[_0x153d('0x35')],qs[_0x153d('0x3b')](_0x56a285[_0x153d('0x37')]['fields']));_0x2d1da1[_0x153d('0x3a')]=_0x2d1da1['attributes'][_0x153d('0x3c')]?_0x2d1da1['attributes']:_0x37fde5[_0x153d('0x35')];if(!_0x56a285[_0x153d('0x37')]['hasOwnProperty'](_0x153d('0x3d'))){_0x2d1da1[_0x153d('0x3e')]=qs[_0x153d('0x3e')](_0x56a285[_0x153d('0x37')][_0x153d('0x3e')]);_0x2d1da1[_0x153d('0x29')]=qs['offset'](_0x56a285[_0x153d('0x37')][_0x153d('0x29')]);}_0x2d1da1[_0x153d('0x3f')]=qs[_0x153d('0x40')](_0x56a285[_0x153d('0x37')][_0x153d('0x40')]);_0x2d1da1[_0x153d('0x41')]=qs[_0x153d('0x42')](_['pick'](_0x56a285[_0x153d('0x37')],_0x37fde5[_0x153d('0x42')]),_0x246e68);if(_0x56a285[_0x153d('0x37')]['filter']){_0x2d1da1[_0x153d('0x41')]=_[_0x153d('0x43')](_0x2d1da1[_0x153d('0x41')],{'$or':_['map'](_0x246e68,function(_0x11e4f5){if(_0x11e4f5[_0x153d('0x44')]!=='VIRTUAL'){var _0x24ce59={};_0x24ce59[_0x11e4f5['name']]={'$like':'%'+_0x56a285['query'][_0x153d('0x45')]+'%'};return _0x24ce59;}})});}_0x2d1da1=_['merge']({},_0x2d1da1,_0x56a285[_0x153d('0x46')]);var _0x27dccf={'where':_0x2d1da1[_0x153d('0x41')]};return db[_0x153d('0x47')]['count'](_0x27dccf)['then'](function(_0x3cf631){_0x3d701c[_0x153d('0x48')]=_0x3cf631;if(_0x56a285['query']['includeAll']){_0x2d1da1['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x153d('0x49')](_0x2d1da1);})[_0x153d('0x1c')](function(_0x1a418a){_0x3d701c[_0x153d('0x4a')]=_0x1a418a;return _0x3d701c;})[_0x153d('0x1c')](respondWithFilteredResult(_0x3ce820,_0x2d1da1))[_0x153d('0x26')](handleError(_0x3ce820,null));};exports[_0x153d('0x4b')]=function(_0x14d163,_0x2a14d8){var _0x183801={'raw':![],'where':{'id':_0x14d163[_0x153d('0x4c')]['id']}},_0x3b01cf={};_0x3b01cf['model']=_[_0x153d('0x38')](db[_0x153d('0x47')][_0x153d('0x4d')]);_0x3b01cf[_0x153d('0x37')]=_[_0x153d('0x38')](_0x14d163[_0x153d('0x37')]);_0x3b01cf['filtears']=_[_0x153d('0x39')](_0x3b01cf[_0x153d('0x35')],_0x3b01cf[_0x153d('0x37')]);_0x183801['attributes']=_['intersection'](_0x3b01cf['model'],qs[_0x153d('0x3b')](_0x14d163[_0x153d('0x37')][_0x153d('0x3b')]));_0x183801['attributes']=_0x183801['attributes'][_0x153d('0x3c')]?_0x183801['attributes']:_0x3b01cf['model'];if(_0x14d163[_0x153d('0x37')][_0x153d('0x4e')]){_0x183801[_0x153d('0x4f')]=[{'all':!![]}];}_0x183801=_[_0x153d('0x43')]({},_0x183801,_0x14d163[_0x153d('0x46')]);return db[_0x153d('0x47')]['find'](_0x183801)[_0x153d('0x1c')](handleEntityNotFound(_0x2a14d8,null))[_0x153d('0x1c')](respondWithResult(_0x2a14d8,null))[_0x153d('0x26')](handleError(_0x2a14d8,null));};exports[_0x153d('0x50')]=function(_0x375fd8,_0x2893c9){return db[_0x153d('0x47')][_0x153d('0x50')](_0x375fd8[_0x153d('0x51')],{})[_0x153d('0x1c')](respondWithResult(_0x2893c9,0xc9))[_0x153d('0x26')](handleError(_0x2893c9,null));};exports['update']=function(_0x184f75,_0x227a0f){if(_0x184f75['body']['id']){delete _0x184f75[_0x153d('0x51')]['id'];}return db[_0x153d('0x47')][_0x153d('0x52')]({'where':{'id':_0x184f75[_0x153d('0x4c')]['id']}})[_0x153d('0x1c')](handleEntityNotFound(_0x227a0f,null))[_0x153d('0x1c')](saveUpdates(_0x184f75[_0x153d('0x51')],null))[_0x153d('0x1c')](respondWithResult(_0x227a0f,null))[_0x153d('0x26')](handleError(_0x227a0f,null));};exports[_0x153d('0x30')]=function(_0x558a7e,_0x916b53){return db[_0x153d('0x47')][_0x153d('0x52')]({'where':{'id':_0x558a7e[_0x153d('0x4c')]['id']}})[_0x153d('0x1c')](handleEntityNotFound(_0x916b53,null))[_0x153d('0x1c')](removeEntity(_0x916b53,null))[_0x153d('0x26')](handleError(_0x916b53,null));};exports['getConfigurations']=function(_0x57cc62,_0x5d1f34,_0x1d3971){var _0x18985d={};var _0x1a8f9c={};var _0x3faf15;var _0x5e3f44;return db[_0x153d('0x47')]['findOne']({'where':{'id':_0x57cc62['params']['id']}})[_0x153d('0x1c')](handleEntityNotFound(_0x5d1f34,null))[_0x153d('0x1c')](function(_0x33d62e){if(_0x33d62e){_0x3faf15=_0x33d62e;_0x1a8f9c[_0x153d('0x35')]=_[_0x153d('0x38')](db['ZohoConfiguration'][_0x153d('0x4d')]);_0x1a8f9c[_0x153d('0x37')]=_[_0x153d('0x38')](_0x57cc62[_0x153d('0x37')]);_0x1a8f9c[_0x153d('0x42')]=_['intersection'](_0x1a8f9c[_0x153d('0x35')],_0x1a8f9c[_0x153d('0x37')]);_0x18985d[_0x153d('0x3a')]=_['intersection'](_0x1a8f9c['model'],qs['fields'](_0x57cc62[_0x153d('0x37')][_0x153d('0x3b')]));_0x18985d[_0x153d('0x3a')]=_0x18985d[_0x153d('0x3a')][_0x153d('0x3c')]?_0x18985d['attributes']:_0x1a8f9c['model'];_0x18985d['order']=qs[_0x153d('0x40')](_0x57cc62[_0x153d('0x37')][_0x153d('0x40')]);_0x18985d[_0x153d('0x41')]=qs['filters'](_['pick'](_0x57cc62[_0x153d('0x37')],_0x1a8f9c[_0x153d('0x42')]));if(_0x57cc62[_0x153d('0x37')][_0x153d('0x45')]){_0x18985d[_0x153d('0x41')]=_[_0x153d('0x43')](_0x18985d[_0x153d('0x41')],{'$or':_['map'](_0x18985d[_0x153d('0x3a')],function(_0x21c876){var _0x4aa308={};_0x4aa308[_0x21c876]={'$like':'%'+_0x57cc62[_0x153d('0x37')][_0x153d('0x45')]+'%'};return _0x4aa308;})});}_0x18985d=_[_0x153d('0x43')]({},_0x18985d,_0x57cc62[_0x153d('0x46')]);return _0x3faf15[_0x153d('0x53')](_0x18985d);}})['then'](function(_0x5294d4){if(_0x5294d4){_0x5e3f44=_0x5294d4[_0x153d('0x3c')];if(!_0x57cc62['query'][_0x153d('0x54')](_0x153d('0x3d'))){_0x18985d['limit']=qs[_0x153d('0x3e')](_0x57cc62[_0x153d('0x37')][_0x153d('0x3e')]);_0x18985d[_0x153d('0x29')]=qs[_0x153d('0x29')](_0x57cc62[_0x153d('0x37')]['offset']);}return _0x3faf15[_0x153d('0x53')](_0x18985d);}})[_0x153d('0x1c')](function(_0x55e48d){if(_0x55e48d){return _0x55e48d?{'count':_0x5e3f44,'rows':_0x55e48d}:null;}})[_0x153d('0x1c')](respondWithResult(_0x5d1f34,null))[_0x153d('0x26')](handleError(_0x5d1f34,null));};exports[_0x153d('0x55')]=function(_0xa608d8,_0x421c87,_0x448a0d){if(_0xa608d8[_0x153d('0x51')]['id']){delete _0xa608d8[_0x153d('0x51')]['id'];}return db['ZohoAccount'][_0x153d('0x56')]({'where':{'id':_0xa608d8[_0x153d('0x4c')]['id']}})[_0x153d('0x1c')](handleEntityNotFound(_0x421c87,null))[_0x153d('0x1c')](function(_0x2dbaa3){if(_0x2dbaa3){_0xa608d8[_0x153d('0x51')]['AccountId']=_0x2dbaa3['id'];_0xa608d8[_0x153d('0x51')][_0x153d('0x57')]=integrations[_0x153d('0x58')](_0xa608d8[_0x153d('0x51')][_0x153d('0x59')],_0xa608d8[_0x153d('0x51')]['type']);_0xa608d8[_0x153d('0x51')][_0x153d('0x5a')]=integrations['getDescriptions'](_0xa608d8[_0x153d('0x51')][_0x153d('0x59')],_0xa608d8[_0x153d('0x51')][_0x153d('0x44')]);return db[_0x153d('0x5b')][_0x153d('0x50')](_0xa608d8[_0x153d('0x51')],{'include':[{'model':db[_0x153d('0x5c')],'as':_0x153d('0x57')},{'model':db[_0x153d('0x5c')],'as':_0x153d('0x5a')}]});}return null;})['then'](respondWithResult(_0x421c87,null))[_0x153d('0x26')](handleError(_0x421c87,null));};function getAccessToken(_0x521fe8){return new Promise(function(_0x313d06,_0x2800c8){var _0x55ab93;switch(_0x521fe8[_0x153d('0x5d')]){case'US':_0x55ab93=_0x153d('0x5e');break;case'AU':_0x55ab93=_0x153d('0x5f');break;case'EU':_0x55ab93=_0x153d('0x60');break;case'IN':_0x55ab93=_0x153d('0x61');break;case'CN':_0x55ab93=_0x153d('0x62');break;default:_0x55ab93=_0x153d('0x60');break;}var _0x97d874={'method':_0x153d('0x63'),'uri':_0x55ab93+_0x153d('0x64'),'qs':{'refresh_token':_0x521fe8[_0x153d('0x65')],'client_id':_0x521fe8[_0x153d('0x66')],'client_secret':_0x521fe8[_0x153d('0x67')],'grant_type':_0x153d('0x68')},'json':!![]};return rp(_0x97d874)[_0x153d('0x1c')](function(_0x178113){if(_0x178113[_0x153d('0x69')]){_0x313d06(_0x178113[_0x153d('0x69')]);}else{_0x2800c8(_0x153d('0x6a'));}})[_0x153d('0x26')](function(_0x2bd3ed){_0x2800c8(_0x2bd3ed);});});}exports[_0x153d('0x6b')]=function(_0x35af35,_0x4a12f5,_0x5bae16){var _0x1cb890,_0x53f288,_0x3ef60c,_0x19c9b9,_0x3d9751;return db[_0x153d('0x47')][_0x153d('0x56')]({'where':{'id':_0x35af35['params']['id']},'attributes':['id',_0x153d('0x6c'),_0x153d('0x5d'),_0x153d('0x66'),_0x153d('0x67'),_0x153d('0x6d'),_0x153d('0x23'),_0x153d('0x65')]})['then'](handleEntityNotFound(_0x4a12f5,null))[_0x153d('0x1c')](function(_0x498216){_0x3d9751=_0x498216;_0x1cb890=_0x3d9751[_0x153d('0x6c')];_0x53f288=_0x1cb890==='zoho.eu'?'eu':_0x153d('0x6e');_0x3ef60c=_0x3d9751[_0x153d('0x6d')];var _0x1a86cd=_0x3ef60c['slice'](-0x1);if(_0x1a86cd==='/'||_0x1a86cd==='\x5c'||_0x1a86cd===':'){_0x3ef60c=_0x3ef60c[_0x153d('0x6f')](0x0,_0x3ef60c[_0x153d('0x70')](_0x1a86cd));}if(!_0x3d9751[_0x153d('0x65')]){throw new Error(_0x153d('0x71'));}return getAccessToken(_0x3d9751);})[_0x153d('0x1c')](function(_0xd06f5){if(_0xd06f5){return rp({'method':_0x153d('0x72'),'uri':util[_0x153d('0x73')](_0x153d('0x74'),_0x53f288),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd06f5},'json':!![]});}})[_0x153d('0x1c')](function(_0x4e6d47){if(_0x4e6d47){if(_0x4e6d47[_0x153d('0x75')]&&_0x4e6d47[_0x153d('0x75')][_0x153d('0x22')]){throw new Error(_0x4e6d47['response']['error'][_0x153d('0x24')]);}var _0x520b61=[];var _0x567bcd=[];var _0x4ba408=[_0x153d('0x76'),'Subject',_0x153d('0x77'),_0x153d('0x78'),_0x153d('0x79'),_0x153d('0x7a'),_0x153d('0x7b'),_0x153d('0x7c')];_0x567bcd=_[_0x153d('0x7d')](_0x4e6d47[_0x153d('0x3b')],function(_0x1677a1){return _0x4ba408['includes'](_0x1677a1[_0x153d('0x7e')]);});for(var _0x518f39=0x0;_0x518f39<_0x567bcd[_0x153d('0x3c')];_0x518f39++){if(_0x567bcd[_0x518f39]['system_mandatory']===![]){_0x520b61[_0x153d('0x7f')]({'id':_0x567bcd[_0x518f39]['id'],'name':_0x567bcd[_0x518f39]['display_label'],'custom':_0x567bcd[_0x518f39][_0x153d('0x80')],'options':_0x567bcd[_0x518f39]['data_type']===_0x153d('0x81')&&_0x567bcd[_0x518f39]['pick_list_values']['length']>-0x1?_['map'](_0x567bcd[_0x518f39][_0x153d('0x82')],function(_0x34b25b){return{'name':_0x34b25b,'value':_0x34b25b};}):[]});}}return{'count':_0x520b61[_0x153d('0x3c')],'rows':_0x520b61};}else{return{'count':0x0,'rows':[]};}})[_0x153d('0x1c')](respondWithResult(_0x4a12f5,null))[_0x153d('0x26')](function(_0x18f19f){var _0x3c032e=_0x35af35[_0x153d('0x37')][_0x153d('0x83')]?0x1f4:_0x18f19f['statusCode']||0x1f4;logger[_0x153d('0x22')](_0x153d('0x84'),_0x153d('0x6b'),_0x3c032e,JSON[_0x153d('0x21')](_0x18f19f));delete _0x18f19f[_0x153d('0x32')];if(_0x3c032e===0x191){_0x3c032e=0x190;}_0x4a12f5[_0x153d('0x28')](_0x3c032e)[_0x153d('0x33')](_0x35af35['query'][_0x153d('0x83')]?{'message':_0x153d('0x85'),'statusCode':_0x18f19f[_0x153d('0x86')]}:_0x18f19f);});}; \ No newline at end of file +var _0xc314=['Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','display_label','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','limit','set','json','apply','save','update','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','show','params','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','zoho.eu','com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject'];(function(_0x37b43b,_0x108251){var _0x2cce3a=function(_0x44065b){while(--_0x44065b){_0x37b43b['push'](_0x37b43b['shift']());}};_0x2cce3a(++_0x108251);}(_0xc314,0x1b2));var _0x4c31=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc314[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x4c31('0x0'));var emlformat=require(_0x4c31('0x1'));var rimraf=require(_0x4c31('0x2'));var zipdir=require(_0x4c31('0x3'));var jsonpatch=require(_0x4c31('0x4'));var rp=require(_0x4c31('0x5'));var moment=require(_0x4c31('0x6'));var BPromise=require(_0x4c31('0x7'));var Mustache=require(_0x4c31('0x8'));var util=require(_0x4c31('0x9'));var path=require(_0x4c31('0xa'));var sox=require(_0x4c31('0xb'));var csv=require(_0x4c31('0xc'));var ejs=require(_0x4c31('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4c31('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c31('0xf'));var toCsv=require(_0x4c31('0xc'));var querystring=require(_0x4c31('0x10'));var Papa=require('papaparse');var Redis=require(_0x4c31('0x11'));var authService=require(_0x4c31('0x12'));var qs=require(_0x4c31('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c31('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4c31('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4c31('0x16'));var jayson=require(_0x4c31('0x17'));var client=jayson['client'][_0x4c31('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5a6876,_0x5d6cf5,_0x1d4e46,_0x1e7832){return new BPromise(function(_0x3841fb,_0x1f480d){var _0x3d485d=_0x1e7832||client;return _0x3d485d[_0x4c31('0x19')](_0x5a6876,_0x1d4e46)[_0x4c31('0x1a')](function(_0x8df2e6){logger[_0x4c31('0x1b')](_0x4c31('0x1c'),_0x5d6cf5,_0x4c31('0x1d'));logger[_0x4c31('0x1e')](_0x4c31('0x1f'),_0x5d6cf5,_0x4c31('0x1d'),JSON[_0x4c31('0x20')](_0x8df2e6));if(_0x8df2e6[_0x4c31('0x21')]){if(_0x8df2e6[_0x4c31('0x21')][_0x4c31('0x22')]===0x1f4){logger[_0x4c31('0x21')](_0x4c31('0x1c'),_0x5d6cf5,_0x8df2e6['error'][_0x4c31('0x23')]);return _0x1f480d(_0x8df2e6['error'][_0x4c31('0x23')]);}logger[_0x4c31('0x21')](_0x4c31('0x1c'),_0x5d6cf5,_0x8df2e6[_0x4c31('0x21')]['message']);return _0x3841fb(_0x8df2e6[_0x4c31('0x21')]['message']);}else{logger[_0x4c31('0x1b')](_0x4c31('0x1c'),_0x5d6cf5,_0x4c31('0x1d'));_0x3841fb(_0x8df2e6[_0x4c31('0x24')][_0x4c31('0x23')]);}})[_0x4c31('0x25')](function(_0x358aad){logger[_0x4c31('0x21')]('ZohoAccount,\x20%s,\x20%s',_0x5d6cf5,_0x358aad);_0x1f480d(_0x358aad);});});}function respondWithStatusCode(_0x30d6ac,_0x1904aa){_0x1904aa=_0x1904aa||0xcc;return function(_0x449248){if(_0x449248){return _0x30d6ac[_0x4c31('0x26')](_0x1904aa);}return _0x30d6ac[_0x4c31('0x27')](_0x1904aa)[_0x4c31('0x28')]();};}function respondWithResult(_0x366525,_0x71137d){_0x71137d=_0x71137d||0xc8;return function(_0x1ffbd2){if(_0x1ffbd2){return _0x366525[_0x4c31('0x27')](_0x71137d)['json'](_0x1ffbd2);}};}function respondWithFilteredResult(_0x27f4e9,_0x4ef9c5){return function(_0x50e78d){if(_0x50e78d){var _0x79e674=_0x50e78d[_0x4c31('0x29')],_0x201531=_0x4ef9c5['offset'],_0x334f60=_0x4ef9c5['offset']+_0x4ef9c5[_0x4c31('0x2a')],_0x52014e;if(_0x334f60>=_0x79e674){_0x334f60=_0x79e674;_0x52014e=0xc8;}else{_0x52014e=0xce;}_0x27f4e9[_0x4c31('0x27')](_0x52014e);return _0x27f4e9[_0x4c31('0x2b')]('Content-Range',_0x201531+'-'+_0x334f60+'/'+_0x79e674)[_0x4c31('0x2c')](_0x50e78d);}return null;};}function patchUpdates(_0x24850f){return function(_0x22a38e){try{jsonpatch[_0x4c31('0x2d')](_0x22a38e,_0x24850f,!![]);}catch(_0x40b5e2){return BPromise['reject'](_0x40b5e2);}return _0x22a38e[_0x4c31('0x2e')]();};}function saveUpdates(_0x57052a,_0x1f2f74){return function(_0x3fa0b0){if(_0x3fa0b0){return _0x3fa0b0[_0x4c31('0x2f')](_0x57052a)[_0x4c31('0x1a')](function(_0x3e4b31){return _0x3e4b31;});}return null;};}function removeEntity(_0x26f831,_0x1ebe69){return function(_0x405297){if(_0x405297){return _0x405297[_0x4c31('0x30')]()[_0x4c31('0x1a')](function(){_0x26f831[_0x4c31('0x27')](0xcc)[_0x4c31('0x28')]();});}};}function handleEntityNotFound(_0x394ec6,_0x19410e){return function(_0x36d55a){if(!_0x36d55a){_0x394ec6[_0x4c31('0x26')](0x194);}return _0x36d55a;};}function handleError(_0x19427f,_0x30c307){_0x30c307=_0x30c307||0x1f4;return function(_0x1bf34d){logger[_0x4c31('0x21')](_0x1bf34d[_0x4c31('0x31')]);if(_0x1bf34d[_0x4c31('0x32')]){delete _0x1bf34d[_0x4c31('0x32')];}_0x19427f[_0x4c31('0x27')](_0x30c307)[_0x4c31('0x33')](_0x1bf34d);};}exports['index']=function(_0x3bc862,_0x4c6467){var _0x29c0bf={},_0x5d2ac2={},_0x1dc8cd={'count':0x0,'rows':[]};var _0xa6e44f=_[_0x4c31('0x34')](db[_0x4c31('0x35')][_0x4c31('0x36')],function(_0x7d238a){return{'name':_0x7d238a[_0x4c31('0x37')],'type':_0x7d238a['type']['key']};});_0x5d2ac2[_0x4c31('0x38')]=_['map'](_0xa6e44f,_0x4c31('0x32'));_0x5d2ac2['query']=_[_0x4c31('0x39')](_0x3bc862[_0x4c31('0x3a')]);_0x5d2ac2[_0x4c31('0x3b')]=_[_0x4c31('0x3c')](_0x5d2ac2[_0x4c31('0x38')],_0x5d2ac2[_0x4c31('0x3a')]);_0x29c0bf[_0x4c31('0x3d')]=_[_0x4c31('0x3c')](_0x5d2ac2[_0x4c31('0x38')],qs[_0x4c31('0x3e')](_0x3bc862[_0x4c31('0x3a')][_0x4c31('0x3e')]));_0x29c0bf[_0x4c31('0x3d')]=_0x29c0bf[_0x4c31('0x3d')][_0x4c31('0x3f')]?_0x29c0bf[_0x4c31('0x3d')]:_0x5d2ac2['model'];if(!_0x3bc862[_0x4c31('0x3a')][_0x4c31('0x40')](_0x4c31('0x41'))){_0x29c0bf[_0x4c31('0x2a')]=qs[_0x4c31('0x2a')](_0x3bc862['query'][_0x4c31('0x2a')]);_0x29c0bf[_0x4c31('0x42')]=qs['offset'](_0x3bc862[_0x4c31('0x3a')][_0x4c31('0x42')]);}_0x29c0bf[_0x4c31('0x43')]=qs[_0x4c31('0x44')](_0x3bc862[_0x4c31('0x3a')]['sort']);_0x29c0bf['where']=qs['filters'](_[_0x4c31('0x45')](_0x3bc862[_0x4c31('0x3a')],_0x5d2ac2[_0x4c31('0x3b')]),_0xa6e44f);if(_0x3bc862['query'][_0x4c31('0x46')]){_0x29c0bf['where']=_[_0x4c31('0x47')](_0x29c0bf[_0x4c31('0x48')],{'$or':_[_0x4c31('0x34')](_0xa6e44f,function(_0x1d6480){if(_0x1d6480[_0x4c31('0x49')]!==_0x4c31('0x4a')){var _0x4613db={};_0x4613db[_0x1d6480[_0x4c31('0x32')]]={'$like':'%'+_0x3bc862[_0x4c31('0x3a')]['filter']+'%'};return _0x4613db;}})});}_0x29c0bf=_['merge']({},_0x29c0bf,_0x3bc862[_0x4c31('0x4b')]);var _0x25f9b6={'where':_0x29c0bf[_0x4c31('0x48')]};return db[_0x4c31('0x35')][_0x4c31('0x29')](_0x25f9b6)[_0x4c31('0x1a')](function(_0x4f7e61){_0x1dc8cd[_0x4c31('0x29')]=_0x4f7e61;if(_0x3bc862[_0x4c31('0x3a')][_0x4c31('0x4c')]){_0x29c0bf[_0x4c31('0x4d')]=[{'all':!![]}];}return db[_0x4c31('0x35')]['findAll'](_0x29c0bf);})[_0x4c31('0x1a')](function(_0x7182b3){_0x1dc8cd['rows']=_0x7182b3;return _0x1dc8cd;})[_0x4c31('0x1a')](respondWithFilteredResult(_0x4c6467,_0x29c0bf))[_0x4c31('0x25')](handleError(_0x4c6467,null));};exports[_0x4c31('0x4e')]=function(_0x39322c,_0x212158){var _0x5b40fa={'raw':![],'where':{'id':_0x39322c[_0x4c31('0x4f')]['id']}},_0x402e68={};_0x402e68[_0x4c31('0x38')]=_[_0x4c31('0x39')](db['ZohoAccount'][_0x4c31('0x36')]);_0x402e68['query']=_[_0x4c31('0x39')](_0x39322c[_0x4c31('0x3a')]);_0x402e68['filtears']=_[_0x4c31('0x3c')](_0x402e68[_0x4c31('0x38')],_0x402e68[_0x4c31('0x3a')]);_0x5b40fa[_0x4c31('0x3d')]=_[_0x4c31('0x3c')](_0x402e68['model'],qs[_0x4c31('0x3e')](_0x39322c[_0x4c31('0x3a')][_0x4c31('0x3e')]));_0x5b40fa['attributes']=_0x5b40fa[_0x4c31('0x3d')][_0x4c31('0x3f')]?_0x5b40fa[_0x4c31('0x3d')]:_0x402e68[_0x4c31('0x38')];if(_0x39322c['query'][_0x4c31('0x4c')]){_0x5b40fa['include']=[{'all':!![]}];}_0x5b40fa=_['merge']({},_0x5b40fa,_0x39322c[_0x4c31('0x4b')]);return db[_0x4c31('0x35')][_0x4c31('0x50')](_0x5b40fa)[_0x4c31('0x1a')](handleEntityNotFound(_0x212158,null))[_0x4c31('0x1a')](respondWithResult(_0x212158,null))[_0x4c31('0x25')](handleError(_0x212158,null));};exports[_0x4c31('0x51')]=function(_0x115a28,_0x466480){return db[_0x4c31('0x35')][_0x4c31('0x51')](_0x115a28[_0x4c31('0x52')],{})[_0x4c31('0x1a')](respondWithResult(_0x466480,0xc9))[_0x4c31('0x25')](handleError(_0x466480,null));};exports[_0x4c31('0x2f')]=function(_0x52958f,_0x4a58c3){if(_0x52958f[_0x4c31('0x52')]['id']){delete _0x52958f['body']['id'];}return db['ZohoAccount'][_0x4c31('0x50')]({'where':{'id':_0x52958f[_0x4c31('0x4f')]['id']}})[_0x4c31('0x1a')](handleEntityNotFound(_0x4a58c3,null))['then'](saveUpdates(_0x52958f[_0x4c31('0x52')],null))[_0x4c31('0x1a')](respondWithResult(_0x4a58c3,null))['catch'](handleError(_0x4a58c3,null));};exports[_0x4c31('0x30')]=function(_0x2a367c,_0x3d1ea9){return db['ZohoAccount'][_0x4c31('0x50')]({'where':{'id':_0x2a367c[_0x4c31('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3d1ea9,null))[_0x4c31('0x1a')](removeEntity(_0x3d1ea9,null))[_0x4c31('0x25')](handleError(_0x3d1ea9,null));};exports[_0x4c31('0x53')]=function(_0x573d45,_0x389555,_0x33b3d9){var _0x3ba329={};var _0xab3c8f={};var _0xeeb776;var _0xff5da;return db[_0x4c31('0x35')]['findOne']({'where':{'id':_0x573d45[_0x4c31('0x4f')]['id']}})['then'](handleEntityNotFound(_0x389555,null))[_0x4c31('0x1a')](function(_0x2141d7){if(_0x2141d7){_0xeeb776=_0x2141d7;_0xab3c8f['model']=_[_0x4c31('0x39')](db['ZohoConfiguration']['rawAttributes']);_0xab3c8f[_0x4c31('0x3a')]=_['keys'](_0x573d45['query']);_0xab3c8f[_0x4c31('0x3b')]=_[_0x4c31('0x3c')](_0xab3c8f[_0x4c31('0x38')],_0xab3c8f[_0x4c31('0x3a')]);_0x3ba329[_0x4c31('0x3d')]=_[_0x4c31('0x3c')](_0xab3c8f[_0x4c31('0x38')],qs['fields'](_0x573d45['query'][_0x4c31('0x3e')]));_0x3ba329[_0x4c31('0x3d')]=_0x3ba329[_0x4c31('0x3d')][_0x4c31('0x3f')]?_0x3ba329[_0x4c31('0x3d')]:_0xab3c8f[_0x4c31('0x38')];_0x3ba329[_0x4c31('0x43')]=qs[_0x4c31('0x44')](_0x573d45[_0x4c31('0x3a')][_0x4c31('0x44')]);_0x3ba329[_0x4c31('0x48')]=qs['filters'](_[_0x4c31('0x45')](_0x573d45[_0x4c31('0x3a')],_0xab3c8f[_0x4c31('0x3b')]));if(_0x573d45[_0x4c31('0x3a')][_0x4c31('0x46')]){_0x3ba329[_0x4c31('0x48')]=_[_0x4c31('0x47')](_0x3ba329[_0x4c31('0x48')],{'$or':_[_0x4c31('0x34')](_0x3ba329['attributes'],function(_0xe8a530){var _0x3719dd={};_0x3719dd[_0xe8a530]={'$like':'%'+_0x573d45[_0x4c31('0x3a')][_0x4c31('0x46')]+'%'};return _0x3719dd;})});}_0x3ba329=_['merge']({},_0x3ba329,_0x573d45['options']);return _0xeeb776['getConfigurations'](_0x3ba329);}})[_0x4c31('0x1a')](function(_0x3863cc){if(_0x3863cc){_0xff5da=_0x3863cc[_0x4c31('0x3f')];if(!_0x573d45[_0x4c31('0x3a')][_0x4c31('0x40')](_0x4c31('0x41'))){_0x3ba329['limit']=qs['limit'](_0x573d45['query'][_0x4c31('0x2a')]);_0x3ba329[_0x4c31('0x42')]=qs[_0x4c31('0x42')](_0x573d45[_0x4c31('0x3a')]['offset']);}return _0xeeb776[_0x4c31('0x53')](_0x3ba329);}})[_0x4c31('0x1a')](function(_0x34fcb7){if(_0x34fcb7){return _0x34fcb7?{'count':_0xff5da,'rows':_0x34fcb7}:null;}})['then'](respondWithResult(_0x389555,null))[_0x4c31('0x25')](handleError(_0x389555,null));};exports[_0x4c31('0x54')]=function(_0x1fc056,_0x3d1d25,_0x32b958){if(_0x1fc056[_0x4c31('0x52')]['id']){delete _0x1fc056[_0x4c31('0x52')]['id'];}return db[_0x4c31('0x35')][_0x4c31('0x55')]({'where':{'id':_0x1fc056['params']['id']}})[_0x4c31('0x1a')](handleEntityNotFound(_0x3d1d25,null))[_0x4c31('0x1a')](function(_0x43d7ba){if(_0x43d7ba){_0x1fc056[_0x4c31('0x52')][_0x4c31('0x56')]=_0x43d7ba['id'];_0x1fc056[_0x4c31('0x52')][_0x4c31('0x57')]=integrations[_0x4c31('0x58')](_0x1fc056[_0x4c31('0x52')]['channel'],_0x1fc056['body'][_0x4c31('0x49')]);_0x1fc056['body'][_0x4c31('0x59')]=integrations[_0x4c31('0x5a')](_0x1fc056[_0x4c31('0x52')][_0x4c31('0x5b')],_0x1fc056[_0x4c31('0x52')]['type']);return db[_0x4c31('0x5c')]['create'](_0x1fc056[_0x4c31('0x52')],{'include':[{'model':db[_0x4c31('0x5d')],'as':_0x4c31('0x57')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x4c31('0x1a')](respondWithResult(_0x3d1d25,null))[_0x4c31('0x25')](handleError(_0x3d1d25,null));};function getAccessToken(_0x55b9c4){return new Promise(function(_0x130e01,_0x5ce318){var _0x4d10f6;switch(_0x55b9c4[_0x4c31('0x5e')]){case'US':_0x4d10f6=_0x4c31('0x5f');break;case'AU':_0x4d10f6=_0x4c31('0x60');break;case'EU':_0x4d10f6=_0x4c31('0x61');break;case'IN':_0x4d10f6=_0x4c31('0x62');break;case'CN':_0x4d10f6=_0x4c31('0x63');break;default:_0x4d10f6=_0x4c31('0x61');break;}var _0xe8617b={'method':_0x4c31('0x64'),'uri':_0x4d10f6+_0x4c31('0x65'),'qs':{'refresh_token':_0x55b9c4[_0x4c31('0x66')],'client_id':_0x55b9c4[_0x4c31('0x67')],'client_secret':_0x55b9c4[_0x4c31('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xe8617b)[_0x4c31('0x1a')](function(_0x4e3254){if(_0x4e3254[_0x4c31('0x69')]){_0x130e01(_0x4e3254['access_token']);}else{_0x5ce318(_0x4c31('0x6a'));}})['catch'](function(_0x5a3fa4){_0x5ce318(_0x5a3fa4);});});}exports[_0x4c31('0x6b')]=function(_0x34c026,_0xbd8718,_0x4f11b2){var _0x328187,_0x12e393,_0x2be0c5,_0x5f5bc7,_0x574563;return db['ZohoAccount'][_0x4c31('0x55')]({'where':{'id':_0x34c026[_0x4c31('0x4f')]['id']},'attributes':['id',_0x4c31('0x6c'),_0x4c31('0x5e'),_0x4c31('0x67'),_0x4c31('0x68'),_0x4c31('0x6d'),_0x4c31('0x22'),_0x4c31('0x66')]})[_0x4c31('0x1a')](handleEntityNotFound(_0xbd8718,null))[_0x4c31('0x1a')](function(_0x2f6dfd){_0x574563=_0x2f6dfd;_0x328187=_0x574563[_0x4c31('0x6c')];_0x12e393=_0x328187===_0x4c31('0x6e')?'eu':_0x4c31('0x6f');_0x2be0c5=_0x574563[_0x4c31('0x6d')];var _0x3c5b18=_0x2be0c5['slice'](-0x1);if(_0x3c5b18==='/'||_0x3c5b18==='\x5c'||_0x3c5b18===':'){_0x2be0c5=_0x2be0c5[_0x4c31('0x70')](0x0,_0x2be0c5[_0x4c31('0x71')](_0x3c5b18));}if(!_0x574563[_0x4c31('0x66')]){throw new Error(_0x4c31('0x72'));}return getAccessToken(_0x574563);})['then'](function(_0xa2d27f){if(_0xa2d27f){return rp({'method':_0x4c31('0x73'),'uri':util[_0x4c31('0x74')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x12e393),'qs':{'module':_0x4c31('0x75')},'headers':{'Authorization':_0x4c31('0x76')+_0xa2d27f},'json':!![]});}})[_0x4c31('0x1a')](function(_0x1be0fd){if(_0x1be0fd){if(_0x1be0fd[_0x4c31('0x77')]&&_0x1be0fd[_0x4c31('0x77')][_0x4c31('0x21')]){throw new Error(_0x1be0fd[_0x4c31('0x77')][_0x4c31('0x21')]['message']);}var _0x4337b1=[];var _0x235345=[];var _0x3de76c=[_0x4c31('0x78'),_0x4c31('0x79'),_0x4c31('0x7a'),_0x4c31('0x7b'),_0x4c31('0x7c'),_0x4c31('0x7d'),_0x4c31('0x7e'),'Call_Type'];_0x235345=_[_0x4c31('0x7f')](_0x1be0fd[_0x4c31('0x3e')],function(_0x42d656){return _0x3de76c[_0x4c31('0x80')](_0x42d656[_0x4c31('0x81')]);});for(var _0x43c12b=0x0;_0x43c12b<_0x235345[_0x4c31('0x3f')];_0x43c12b++){if(_0x235345[_0x43c12b][_0x4c31('0x82')]===![]){_0x4337b1['push']({'id':_0x235345[_0x43c12b]['id'],'name':_0x235345[_0x43c12b][_0x4c31('0x83')],'custom':_0x235345[_0x43c12b]['custom_field'],'options':_0x235345[_0x43c12b][_0x4c31('0x84')]===_0x4c31('0x85')&&_0x235345[_0x43c12b]['pick_list_values'][_0x4c31('0x3f')]>-0x1?_[_0x4c31('0x34')](_0x235345[_0x43c12b][_0x4c31('0x86')],function(_0x5d2cf1){return{'name':_0x5d2cf1,'value':_0x5d2cf1};}):[]});}}return{'count':_0x4337b1[_0x4c31('0x3f')],'rows':_0x4337b1};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0xbd8718,null))[_0x4c31('0x25')](function(_0x21b594){var _0x29b80=_0x34c026['query']['test']?0x1f4:_0x21b594[_0x4c31('0x87')]||0x1f4;logger[_0x4c31('0x21')](_0x4c31('0x88'),'getFields',_0x29b80,JSON[_0x4c31('0x20')](_0x21b594));delete _0x21b594[_0x4c31('0x32')];if(_0x29b80===0x191){_0x29b80=0x190;}_0xbd8718[_0x4c31('0x27')](_0x29b80)[_0x4c31('0x33')](_0x34c026[_0x4c31('0x3a')][_0x4c31('0x89')]?{'message':_0x4c31('0x8a'),'statusCode':_0x21b594[_0x4c31('0x87')]}:_0x21b594);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3b3d687..d6956e2 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 _0x1a49=['api','moment','request-promise','rimraf','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','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','catch','authorization_code','application/x-www-form-urlencoded','inspect','lodash','util','../../config/logger'];(function(_0x1f0e10,_0x1986f9){var _0x3583aa=function(_0x56e8a3){while(--_0x56e8a3){_0x1f0e10['push'](_0x1f0e10['shift']());}};_0x3583aa(++_0x1986f9);}(_0x1a49,0xe7));var _0x91a4=function(_0x507517,_0x58fe80){_0x507517=_0x507517-0x0;var _0x177c0c=_0x1a49[_0x507517];return _0x177c0c;};'use strict';var _=require(_0x91a4('0x0'));var util=require(_0x91a4('0x1'));var logger=require(_0x91a4('0x2'))(_0x91a4('0x3'));var moment=require(_0x91a4('0x4'));var BPromise=require('bluebird');var rp=require(_0x91a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91a4('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x38cde7,_0xb81567){return _0x38cde7[_0x91a4('0x7')](_0x91a4('0x8'),attributes,{'tableName':_0x91a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x22c728,_0x46bbf5,_0xb3ae17){if(_0x22c728[_0x91a4('0xa')]('zone')||_0x22c728['changed'](_0x91a4('0xb'))||_0x22c728[_0x91a4('0xa')](_0x91a4('0xc'))||_0x22c728['changed'](_0x91a4('0xd'))||_0x22c728[_0x91a4('0xa')](_0x91a4('0xe'))||_0x22c728[_0x91a4('0xa')](_0x91a4('0xf'))){var _0x28f628,_0x3d4f07;_0x28f628=_0x22c728['serverUrl'];var _0x4a8c0b=_0x28f628[_0x91a4('0x10')](-0x1);if(_0x4a8c0b==='/'||_0x4a8c0b==='\x5c'||_0x4a8c0b===':'){_0x28f628=_0x28f628[_0x91a4('0x11')](0x0,_0x28f628[_0x91a4('0x12')](_0x4a8c0b));}switch(_0x22c728[_0x91a4('0x13')]){case'US':_0x3d4f07=_0x91a4('0x14');break;case'AU':_0x3d4f07=_0x91a4('0x15');break;case'IN':_0x3d4f07=_0x91a4('0x16');break;case'CN':_0x3d4f07=_0x91a4('0x17');break;default:_0x3d4f07='https://accounts.zoho.eu';break;}var _0x514e3a={'method':_0x91a4('0x18'),'uri':_0x3d4f07+_0x91a4('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x22c728[_0x91a4('0xc')],'client_secret':_0x22c728[_0x91a4('0xd')],'redirect_uri':_0x22c728['serverUrl'],'code':_0x22c728[_0x91a4('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x514e3a)['then'](function(_0x32683c){var _0x5e8847=JSON[_0x91a4('0x1a')](_0x32683c);if(_0x5e8847[_0x91a4('0x1b')]){_0x22c728[_0x91a4('0x1c')]=_0x5e8847['refresh_token'];logger[_0x91a4('0x1d')](util[_0x91a4('0x1e')](_0x91a4('0x1f'),_0x22c728[_0x91a4('0x20')],_0x22c728['id']));}else{logger[_0x91a4('0x21')](util['format'](_0x91a4('0x22'),_0x22c728[_0x91a4('0x20')],_0x22c728['id']),util['inspect'](_0x5e8847,{'showHidden':![],'depth':null}));}return _0xb3ae17(null,_0x46bbf5);})[_0x91a4('0x23')](function(_0x2e4467){logger[_0x91a4('0x21')](util['format'](_0x91a4('0x22'),_0x22c728[_0x91a4('0x20')],_0x22c728['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xb3ae17(_0x2e4467);});}else{return _0xb3ae17(null,_0x46bbf5);}},'beforeUpdate':function(_0x3e7b82,_0x41f230,_0x40ebc0){if(_0x3e7b82[_0x91a4('0xa')](_0x91a4('0x13'))||_0x3e7b82[_0x91a4('0xa')](_0x91a4('0xb'))||_0x3e7b82[_0x91a4('0xa')](_0x91a4('0xc'))||_0x3e7b82['changed'](_0x91a4('0xd'))||_0x3e7b82[_0x91a4('0xa')](_0x91a4('0xe'))||_0x3e7b82[_0x91a4('0xa')](_0x91a4('0xf'))){var _0x5e2c54,_0x1de89e;_0x5e2c54=_0x3e7b82[_0x91a4('0xb')];var _0x206d75=_0x5e2c54[_0x91a4('0x10')](-0x1);if(_0x206d75==='/'||_0x206d75==='\x5c'||_0x206d75===':'){_0x5e2c54=_0x5e2c54[_0x91a4('0x11')](0x0,_0x5e2c54['lastIndexOf'](_0x206d75));}switch(_0x3e7b82['zone']){case'US':_0x1de89e=_0x91a4('0x14');break;case'AU':_0x1de89e='https://accounts.zoho.com.au';break;case'IN':_0x1de89e=_0x91a4('0x16');break;case'CN':_0x1de89e=_0x91a4('0x17');break;default:_0x1de89e='https://accounts.zoho.eu';break;}var _0x589ebb={'method':_0x91a4('0x18'),'uri':_0x1de89e+_0x91a4('0x19'),'form':{'grant_type':_0x91a4('0x24'),'client_id':_0x3e7b82[_0x91a4('0xc')],'client_secret':_0x3e7b82[_0x91a4('0xd')],'redirect_uri':_0x3e7b82['serverUrl'],'code':_0x3e7b82[_0x91a4('0xe')]},'headers':{'Content-Type':_0x91a4('0x25')}};return rp(_0x589ebb)['then'](function(_0xe33a00){var _0x11b622=JSON[_0x91a4('0x1a')](_0xe33a00);if(_0x11b622[_0x91a4('0x1b')]){_0x3e7b82[_0x91a4('0x1c')]=_0x11b622['refresh_token'];logger[_0x91a4('0x1d')](util[_0x91a4('0x1e')](_0x91a4('0x1f'),_0x3e7b82['name'],_0x3e7b82['id']));}else{logger['error'](util[_0x91a4('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3e7b82[_0x91a4('0x20')],_0x3e7b82['id']),util[_0x91a4('0x26')](_0x11b622,{'showHidden':![],'depth':null}));}return _0x40ebc0(null,_0x41f230);})[_0x91a4('0x23')](function(_0x48a61c){logger['error'](util['format'](_0x91a4('0x22'),_0x3e7b82['name'],_0x3e7b82['id']),util[_0x91a4('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x40ebc0(_0x48a61c);});}else{return _0x40ebc0(null,_0x41f230);}}}});}; \ No newline at end of file +var _0x63f8=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientSecret','host','serverUrl','slice','substring','zone','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','name','inspect','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x511b97,_0x4366cb){var _0x13ada3=function(_0x50ee6c){while(--_0x50ee6c){_0x511b97['push'](_0x511b97['shift']());}};_0x13ada3(++_0x4366cb);}(_0x63f8,0x1c2));var _0x863f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x63f8[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x863f('0x0'));var util=require(_0x863f('0x1'));var logger=require(_0x863f('0x2'))(_0x863f('0x3'));var moment=require(_0x863f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x863f('0x5'));var rimraf=require(_0x863f('0x6'));var config=require(_0x863f('0x7'));var attributes=require(_0x863f('0x8'));var integrations=require(_0x863f('0x9'));module[_0x863f('0xa')]=function(_0x407432,_0x14ba44){return _0x407432[_0x863f('0xb')](_0x863f('0xc'),attributes,{'tableName':_0x863f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f991c,_0x28e6f7,_0x45b413){if(_0x4f991c[_0x863f('0xe')]('zone')||_0x4f991c[_0x863f('0xe')]('serverUrl')||_0x4f991c[_0x863f('0xe')]('clientId')||_0x4f991c[_0x863f('0xe')](_0x863f('0xf'))||_0x4f991c[_0x863f('0xe')]('code')||_0x4f991c['changed'](_0x863f('0x10'))){var _0x5c9211,_0x22243b;_0x5c9211=_0x4f991c[_0x863f('0x11')];var _0x2826c6=_0x5c9211[_0x863f('0x12')](-0x1);if(_0x2826c6==='/'||_0x2826c6==='\x5c'||_0x2826c6===':'){_0x5c9211=_0x5c9211[_0x863f('0x13')](0x0,_0x5c9211['lastIndexOf'](_0x2826c6));}switch(_0x4f991c[_0x863f('0x14')]){case'US':_0x22243b='https://accounts.zoho.com';break;case'AU':_0x22243b='https://accounts.zoho.com.au';break;case'IN':_0x22243b=_0x863f('0x15');break;case'CN':_0x22243b=_0x863f('0x16');break;default:_0x22243b=_0x863f('0x17');break;}var _0x453f9a={'method':_0x863f('0x18'),'uri':_0x22243b+_0x863f('0x19'),'form':{'grant_type':_0x863f('0x1a'),'client_id':_0x4f991c[_0x863f('0x1b')],'client_secret':_0x4f991c[_0x863f('0xf')],'redirect_uri':_0x4f991c[_0x863f('0x11')],'code':_0x4f991c[_0x863f('0x1c')]},'headers':{'Content-Type':_0x863f('0x1d')}};return rp(_0x453f9a)[_0x863f('0x1e')](function(_0x143943){var _0x2f3678=JSON[_0x863f('0x1f')](_0x143943);if(_0x2f3678['refresh_token']){_0x4f991c[_0x863f('0x20')]=_0x2f3678[_0x863f('0x21')];logger[_0x863f('0x22')](util['format'](_0x863f('0x23'),_0x4f991c['name'],_0x4f991c['id']));}else{logger[_0x863f('0x24')](util[_0x863f('0x25')](_0x863f('0x26'),_0x4f991c['name'],_0x4f991c['id']),util['inspect'](_0x2f3678,{'showHidden':![],'depth':null}));}return _0x45b413(null,_0x28e6f7);})[_0x863f('0x27')](function(_0x2fb22a){logger[_0x863f('0x24')](util[_0x863f('0x25')](_0x863f('0x26'),_0x4f991c[_0x863f('0x28')],_0x4f991c['id']),util[_0x863f('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x45b413(_0x2fb22a);});}else{return _0x45b413(null,_0x28e6f7);}},'beforeUpdate':function(_0x3de65f,_0x3f36fc,_0x48d436){if(_0x3de65f[_0x863f('0xe')]('zone')||_0x3de65f[_0x863f('0xe')](_0x863f('0x11'))||_0x3de65f['changed']('clientId')||_0x3de65f[_0x863f('0xe')]('clientSecret')||_0x3de65f[_0x863f('0xe')]('code')||_0x3de65f[_0x863f('0xe')]('host')){var _0x37cdee,_0x1f7e6b;_0x37cdee=_0x3de65f[_0x863f('0x11')];var _0x102bb6=_0x37cdee['slice'](-0x1);if(_0x102bb6==='/'||_0x102bb6==='\x5c'||_0x102bb6===':'){_0x37cdee=_0x37cdee['substring'](0x0,_0x37cdee[_0x863f('0x2a')](_0x102bb6));}switch(_0x3de65f[_0x863f('0x14')]){case'US':_0x1f7e6b=_0x863f('0x2b');break;case'AU':_0x1f7e6b=_0x863f('0x2c');break;case'IN':_0x1f7e6b=_0x863f('0x15');break;case'CN':_0x1f7e6b='https://accounts.zoho.com.cn';break;default:_0x1f7e6b='https://accounts.zoho.eu';break;}var _0x1637d6={'method':'POST','uri':_0x1f7e6b+_0x863f('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x3de65f[_0x863f('0x1b')],'client_secret':_0x3de65f[_0x863f('0xf')],'redirect_uri':_0x3de65f[_0x863f('0x11')],'code':_0x3de65f[_0x863f('0x1c')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x1637d6)[_0x863f('0x1e')](function(_0xf1f3b5){var _0x9d1042=JSON['parse'](_0xf1f3b5);if(_0x9d1042['refresh_token']){_0x3de65f[_0x863f('0x20')]=_0x9d1042[_0x863f('0x21')];logger[_0x863f('0x22')](util[_0x863f('0x25')](_0x863f('0x23'),_0x3de65f[_0x863f('0x28')],_0x3de65f['id']));}else{logger[_0x863f('0x24')](util['format'](_0x863f('0x26'),_0x3de65f['name'],_0x3de65f['id']),util[_0x863f('0x29')](_0x9d1042,{'showHidden':![],'depth':null}));}return _0x48d436(null,_0x3f36fc);})[_0x863f('0x27')](function(_0x370b0c){logger[_0x863f('0x24')](util[_0x863f('0x25')](_0x863f('0x26'),_0x3de65f[_0x863f('0x28')],_0x3de65f['id']),util[_0x863f('0x29')](parsedResult,{'showHidden':![],'depth':null}));return _0x48d436(_0x370b0c);});}else{return _0x48d436(null,_0x3f36fc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c808441..c91ea0d 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 _0xcdda=['request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','GetZohoAccount','ShowZohoAccount','find','debug','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x153515,_0x4b0bec){var _0x260bc2=function(_0x40f802){while(--_0x40f802){_0x153515['push'](_0x153515['shift']());}};_0x260bc2(++_0x4b0bec);}(_0xcdda,0xa3));var _0xacdd=function(_0xd84c36,_0x5e14be){_0xd84c36=_0xd84c36-0x0;var _0x32c2bf=_0xcdda[_0xd84c36];return _0x32c2bf;};'use strict';var _=require(_0xacdd('0x0'));var util=require('util');var moment=require(_0xacdd('0x1'));var BPromise=require('bluebird');var rs=require(_0xacdd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xacdd('0x3'));var logger=require(_0xacdd('0x4'))(_0xacdd('0x5'));var config=require(_0xacdd('0x6'));var jayson=require(_0xacdd('0x7'));var client=jayson[_0xacdd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x206dae,_0x8cf4e7,_0x1b201a){return new BPromise(function(_0x40d99b,_0x1b8c35){return client[_0xacdd('0x9')](_0x206dae,_0x1b201a)[_0xacdd('0xa')](function(_0x32b139){logger[_0xacdd('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x8cf4e7,_0xacdd('0xc'));logger['debug'](_0xacdd('0xd'),_0x8cf4e7,_0xacdd('0xc'),JSON[_0xacdd('0xe')](_0x32b139));if(_0x32b139[_0xacdd('0xf')]){if(_0x32b139[_0xacdd('0xf')][_0xacdd('0x10')]===0x1f4){logger[_0xacdd('0xf')](_0xacdd('0x11'),_0x8cf4e7,_0x32b139['error'][_0xacdd('0x12')]);return _0x1b8c35(_0x32b139[_0xacdd('0xf')][_0xacdd('0x12')]);}logger['error'](_0xacdd('0x11'),_0x8cf4e7,_0x32b139[_0xacdd('0xf')]['message']);return _0x40d99b(_0x32b139[_0xacdd('0xf')][_0xacdd('0x12')]);}else{logger[_0xacdd('0xb')](_0xacdd('0x11'),_0x8cf4e7,'request\x20sent');_0x40d99b(_0x32b139[_0xacdd('0x13')][_0xacdd('0x12')]);}})['catch'](function(_0x1c5dc4){logger[_0xacdd('0xf')](_0xacdd('0x11'),_0x8cf4e7,_0x1c5dc4);_0x1b8c35(_0x1c5dc4);});});}exports['GetZohoAccount']=function(_0x48357e){var _0x42dbc1=this;return new Promise(function(_0x456be9,_0x16012e){return db[_0xacdd('0x14')][_0xacdd('0x15')]({'raw':_0x48357e[_0xacdd('0x16')]?_0x48357e[_0xacdd('0x16')][_0xacdd('0x17')]===undefined?!![]:![]:!![],'where':_0x48357e[_0xacdd('0x16')]?_0x48357e['options'][_0xacdd('0x18')]||null:null,'attributes':_0x48357e[_0xacdd('0x16')]?_0x48357e[_0xacdd('0x16')][_0xacdd('0x19')]||null:null,'limit':_0x48357e[_0xacdd('0x16')]?_0x48357e[_0xacdd('0x16')][_0xacdd('0x1a')]||null:null,'include':_0x48357e['options']?_0x48357e[_0xacdd('0x16')][_0xacdd('0x1b')]?_[_0xacdd('0x1c')](_0x48357e[_0xacdd('0x16')][_0xacdd('0x1b')],function(_0x44007b){return{'model':db[_0x44007b[_0xacdd('0x1d')]],'as':_0x44007b['as'],'attributes':_0x44007b['attributes'],'include':_0x44007b[_0xacdd('0x1b')]?_[_0xacdd('0x1c')](_0x44007b[_0xacdd('0x1b')],function(_0x2112e8){return{'model':db[_0x2112e8[_0xacdd('0x1d')]],'as':_0x2112e8['as'],'attributes':_0x2112e8['attributes'],'include':_0x2112e8['include']?_['map'](_0x2112e8[_0xacdd('0x1b')],function(_0x33d101){return{'model':db[_0x33d101['model']],'as':_0x33d101['as'],'attributes':_0x33d101[_0xacdd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xacdd('0xa')](function(_0x1cac27){logger[_0xacdd('0xb')]('GetZohoAccount',_0x48357e);logger['debug']('GetZohoAccount',_0x48357e,JSON['stringify'](_0x1cac27));_0x456be9(_0x1cac27);})[_0xacdd('0x1e')](function(_0x370493){logger[_0xacdd('0xf')](_0xacdd('0x1f'),_0x370493[_0xacdd('0x12')],_0x48357e);_0x16012e(_0x42dbc1[_0xacdd('0xf')](0x1f4,_0x370493[_0xacdd('0x12')]));});});};exports[_0xacdd('0x20')]=function(_0x2061e3){var _0x352d9f=this;return new Promise(function(_0x404e52,_0xab76b9){return db[_0xacdd('0x14')][_0xacdd('0x21')]({'raw':_0x2061e3[_0xacdd('0x16')]?_0x2061e3[_0xacdd('0x16')][_0xacdd('0x17')]===undefined?!![]:![]:!![],'where':_0x2061e3[_0xacdd('0x16')]?_0x2061e3['options']['where']||null:null,'attributes':_0x2061e3[_0xacdd('0x16')]?_0x2061e3[_0xacdd('0x16')][_0xacdd('0x19')]||null:null,'include':_0x2061e3[_0xacdd('0x16')]?_0x2061e3[_0xacdd('0x16')][_0xacdd('0x1b')]?_[_0xacdd('0x1c')](_0x2061e3[_0xacdd('0x16')][_0xacdd('0x1b')],function(_0x2bf5a7){return{'model':db[_0x2bf5a7[_0xacdd('0x1d')]],'as':_0x2bf5a7['as'],'attributes':_0x2bf5a7[_0xacdd('0x19')],'include':_0x2bf5a7[_0xacdd('0x1b')]?_[_0xacdd('0x1c')](_0x2bf5a7[_0xacdd('0x1b')],function(_0x50abe6){return{'model':db[_0x50abe6[_0xacdd('0x1d')]],'as':_0x50abe6['as'],'attributes':_0x50abe6[_0xacdd('0x19')],'include':_0x50abe6[_0xacdd('0x1b')]?_[_0xacdd('0x1c')](_0x50abe6[_0xacdd('0x1b')],function(_0xc538da){return{'model':db[_0xc538da['model']],'as':_0xc538da['as'],'attributes':_0xc538da[_0xacdd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xacdd('0xa')](function(_0x982f01){logger[_0xacdd('0xb')](_0xacdd('0x20'),_0x2061e3);logger[_0xacdd('0x22')](_0xacdd('0x20'),_0x2061e3,JSON['stringify'](_0x982f01));_0x404e52(_0x982f01);})[_0xacdd('0x1e')](function(_0x46257b){logger[_0xacdd('0xf')](_0xacdd('0x20'),_0x46257b['message'],_0x2061e3);_0xab76b9(_0x352d9f[_0xacdd('0xf')](0x1f4,_0x46257b[_0xacdd('0x12')]));});});}; \ No newline at end of file +var _0x5fd9=['attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','where','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','request','then','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','ZohoAccount','options','raw'];(function(_0x5db5f5,_0x195ef9){var _0x51d907=function(_0x203a3f){while(--_0x203a3f){_0x5db5f5['push'](_0x5db5f5['shift']());}};_0x51d907(++_0x195ef9);}(_0x5fd9,0x1d9));var _0x95fd=function(_0x120bc0,_0x40e780){_0x120bc0=_0x120bc0-0x0;var _0x49d52a=_0x5fd9[_0x120bc0];return _0x49d52a;};'use strict';var _=require('lodash');var util=require(_0x95fd('0x0'));var moment=require(_0x95fd('0x1'));var BPromise=require(_0x95fd('0x2'));var rs=require(_0x95fd('0x3'));var fs=require('fs');var Redis=require(_0x95fd('0x4'));var db=require(_0x95fd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95fd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x95fd('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xebaf10,_0x46799e,_0x54e5e7){return new BPromise(function(_0x31e2d8,_0x5bcafb){return client[_0x95fd('0x8')](_0xebaf10,_0x54e5e7)[_0x95fd('0x9')](function(_0x4521cd){logger['info'](_0x95fd('0xa'),_0x46799e,'request\x20sent');logger['debug'](_0x95fd('0xb'),_0x46799e,_0x95fd('0xc'),JSON[_0x95fd('0xd')](_0x4521cd));if(_0x4521cd[_0x95fd('0xe')]){if(_0x4521cd[_0x95fd('0xe')][_0x95fd('0xf')]===0x1f4){logger[_0x95fd('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x46799e,_0x4521cd[_0x95fd('0xe')][_0x95fd('0x10')]);return _0x5bcafb(_0x4521cd[_0x95fd('0xe')]['message']);}logger[_0x95fd('0xe')](_0x95fd('0xa'),_0x46799e,_0x4521cd[_0x95fd('0xe')][_0x95fd('0x10')]);return _0x31e2d8(_0x4521cd[_0x95fd('0xe')][_0x95fd('0x10')]);}else{logger[_0x95fd('0x11')](_0x95fd('0xa'),_0x46799e,_0x95fd('0xc'));_0x31e2d8(_0x4521cd[_0x95fd('0x12')][_0x95fd('0x10')]);}})['catch'](function(_0x4e7410){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x46799e,_0x4e7410);_0x5bcafb(_0x4e7410);});});}exports['GetZohoAccount']=function(_0x16f167){var _0x175d87=this;return new Promise(function(_0xcdb98c,_0x19e3a9){return db[_0x95fd('0x13')]['findAll']({'raw':_0x16f167['options']?_0x16f167[_0x95fd('0x14')][_0x95fd('0x15')]===undefined?!![]:![]:!![],'where':_0x16f167[_0x95fd('0x14')]?_0x16f167['options']['where']||null:null,'attributes':_0x16f167['options']?_0x16f167[_0x95fd('0x14')][_0x95fd('0x16')]||null:null,'limit':_0x16f167['options']?_0x16f167[_0x95fd('0x14')][_0x95fd('0x17')]||null:null,'include':_0x16f167['options']?_0x16f167[_0x95fd('0x14')]['include']?_['map'](_0x16f167[_0x95fd('0x14')][_0x95fd('0x18')],function(_0x1822c8){return{'model':db[_0x1822c8[_0x95fd('0x19')]],'as':_0x1822c8['as'],'attributes':_0x1822c8[_0x95fd('0x16')],'include':_0x1822c8[_0x95fd('0x18')]?_[_0x95fd('0x1a')](_0x1822c8[_0x95fd('0x18')],function(_0x2b597a){return{'model':db[_0x2b597a[_0x95fd('0x19')]],'as':_0x2b597a['as'],'attributes':_0x2b597a[_0x95fd('0x16')],'include':_0x2b597a['include']?_['map'](_0x2b597a[_0x95fd('0x18')],function(_0x2a7285){return{'model':db[_0x2a7285['model']],'as':_0x2a7285['as'],'attributes':_0x2a7285[_0x95fd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x95fd('0x9')](function(_0xc4bbbd){logger[_0x95fd('0x11')](_0x95fd('0x1b'),_0x16f167);logger['debug'](_0x95fd('0x1b'),_0x16f167,JSON[_0x95fd('0xd')](_0xc4bbbd));_0xcdb98c(_0xc4bbbd);})['catch'](function(_0x418ff1){logger[_0x95fd('0xe')]('GetZohoAccount',_0x418ff1[_0x95fd('0x10')],_0x16f167);_0x19e3a9(_0x175d87[_0x95fd('0xe')](0x1f4,_0x418ff1[_0x95fd('0x10')]));});});};exports[_0x95fd('0x1c')]=function(_0x279637){var _0x236695=this;return new Promise(function(_0x1ac0ab,_0x379ce5){return db[_0x95fd('0x13')][_0x95fd('0x1d')]({'raw':_0x279637[_0x95fd('0x14')]?_0x279637[_0x95fd('0x14')][_0x95fd('0x15')]===undefined?!![]:![]:!![],'where':_0x279637[_0x95fd('0x14')]?_0x279637['options'][_0x95fd('0x1e')]||null:null,'attributes':_0x279637[_0x95fd('0x14')]?_0x279637[_0x95fd('0x14')][_0x95fd('0x16')]||null:null,'include':_0x279637[_0x95fd('0x14')]?_0x279637[_0x95fd('0x14')][_0x95fd('0x18')]?_[_0x95fd('0x1a')](_0x279637[_0x95fd('0x14')]['include'],function(_0x16539){return{'model':db[_0x16539[_0x95fd('0x19')]],'as':_0x16539['as'],'attributes':_0x16539[_0x95fd('0x16')],'include':_0x16539[_0x95fd('0x18')]?_[_0x95fd('0x1a')](_0x16539[_0x95fd('0x18')],function(_0x3a0e70){return{'model':db[_0x3a0e70['model']],'as':_0x3a0e70['as'],'attributes':_0x3a0e70[_0x95fd('0x16')],'include':_0x3a0e70[_0x95fd('0x18')]?_[_0x95fd('0x1a')](_0x3a0e70['include'],function(_0x411291){return{'model':db[_0x411291[_0x95fd('0x19')]],'as':_0x411291['as'],'attributes':_0x411291[_0x95fd('0x16')]};}):[]};}):[]};}):[]:[]})[_0x95fd('0x9')](function(_0x5f1ee8){logger[_0x95fd('0x11')](_0x95fd('0x1c'),_0x279637);logger[_0x95fd('0x1f')](_0x95fd('0x1c'),_0x279637,JSON[_0x95fd('0xd')](_0x5f1ee8));_0x1ac0ab(_0x5f1ee8);})[_0x95fd('0x20')](function(_0x118833){logger[_0x95fd('0xe')](_0x95fd('0x1c'),_0x118833['message'],_0x279637);_0x379ce5(_0x236695['error'](0x1f4,_0x118833['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 6f5ee71..340ce44 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 _0x112a=['getDescriptions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x3eb0b3,_0x41ecad){var _0x9271c7=function(_0x3db3c6){while(--_0x3db3c6){_0x3eb0b3['push'](_0x3eb0b3['shift']());}};_0x9271c7(++_0x41ecad);}(_0x112a,0x115));var _0xa112=function(_0x24c189,_0x14fd1d){_0x24c189=_0x24c189-0x0;var _0x492fa5=_0x112a[_0x24c189];return _0x492fa5;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var auth=require(_0xa112('0x6'));var interaction=require(_0xa112('0x7'));var config=require(_0xa112('0x8'));var controller=require(_0xa112('0x9'));router[_0xa112('0xa')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0xc')]);router[_0xa112('0xa')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0xe')]);router[_0xa112('0xa')](_0xa112('0xf'),auth[_0xa112('0xb')](),controller[_0xa112('0x10')]);router[_0xa112('0xa')](_0xa112('0x11'),auth['isAuthenticated'](),controller[_0xa112('0x12')]);router['get'](_0xa112('0x13'),auth[_0xa112('0xb')](),controller[_0xa112('0x14')]);router[_0xa112('0x15')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0x16')]);router[_0xa112('0x17')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x18')]);router[_0xa112('0x19')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x00b3=['connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','destroy','util','path'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x00b3,0x17a));var _0x300b=function(_0x161a77,_0x27aa6f){_0x161a77=_0x161a77-0x0;var _0xf4eedd=_0x00b3[_0x161a77];return _0xf4eedd;};'use strict';var multer=require('multer');var util=require(_0x300b('0x0'));var path=require(_0x300b('0x1'));var timeout=require(_0x300b('0x2'));var express=require(_0x300b('0x3'));var router=express['Router']();var auth=require(_0x300b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x300b('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x300b('0x6')]('/',auth[_0x300b('0x7')](),controller[_0x300b('0x8')]);router[_0x300b('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x300b('0x9')]);router['get']('/:id/fields',auth[_0x300b('0x7')](),controller[_0x300b('0xa')]);router[_0x300b('0x6')]('/:id/subjects',auth[_0x300b('0x7')](),controller[_0x300b('0xb')]);router[_0x300b('0x6')](_0x300b('0xc'),auth['isAuthenticated'](),controller[_0x300b('0xd')]);router[_0x300b('0xe')]('/',auth[_0x300b('0x7')](),controller['create']);router[_0x300b('0xf')](_0x300b('0x10'),auth[_0x300b('0x7')](),controller[_0x300b('0x11')]);router[_0x300b('0x12')](_0x300b('0x10'),auth[_0x300b('0x7')](),controller[_0x300b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 7002c62..920d813 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 _0x10bb=['contact_lead','sequelize','STRING','ENUM','lead','contact','nothing'];(function(_0x41b91d,_0x5dd040){var _0xb0ab4d=function(_0x51d2a9){while(--_0x51d2a9){_0x41b91d['push'](_0x41b91d['shift']());}};_0xb0ab4d(++_0x5dd040);}(_0x10bb,0x71));var _0xb10b=function(_0x12b720,_0x42ae38){_0x12b720=_0x12b720-0x0;var _0x151801=_0x10bb[_0x12b720];return _0x151801;};'use strict';var Sequelize=require(_0xb10b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb10b('0x1')]},'moduleCreate':{'type':Sequelize[_0xb10b('0x2')](_0xb10b('0x3'),_0xb10b('0x4'),_0xb10b('0x5')),'defaultValue':_0xb10b('0x3')},'moduleSearch':{'type':Sequelize[_0xb10b('0x2')](_0xb10b('0x6'),_0xb10b('0x4'),_0xb10b('0x3')),'defaultValue':_0xb10b('0x6')},'description':{'type':Sequelize[_0xb10b('0x1')]}}; \ No newline at end of file +var _0x0add=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x5e642f,_0x474454){var _0x222b5f=function(_0x6d092d){while(--_0x6d092d){_0x5e642f['push'](_0x5e642f['shift']());}};_0x222b5f(++_0x474454);}(_0x0add,0xf2));var _0xd0ad=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x0add[_0x3a7a9c];return _0x59156e;};'use strict';var Sequelize=require(_0xd0ad('0x0'));module[_0xd0ad('0x1')]={'name':{'type':Sequelize[_0xd0ad('0x2')]},'moduleCreate':{'type':Sequelize[_0xd0ad('0x3')](_0xd0ad('0x4'),_0xd0ad('0x5'),_0xd0ad('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xd0ad('0x3')]('contact_lead',_0xd0ad('0x5'),_0xd0ad('0x4')),'defaultValue':_0xd0ad('0x7')},'description':{'type':Sequelize[_0xd0ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0f7460f..61222bc 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 _0x814b=['error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','save','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','attributes','hasOwnProperty','nolimit','limit','where','pick','merge','filter','options','count','includeAll','include','ZohoConfiguration','findAll','params','intersection','length','find','create','body','update','findOne','ZohoField','order','getFields','sort','getDescriptions','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x11cbb5,_0x390441){var _0x54b8d3=function(_0x162ca2){while(--_0x162ca2){_0x11cbb5['push'](_0x11cbb5['shift']());}};_0x54b8d3(++_0x390441);}(_0x814b,0x1a2));var _0xb814=function(_0xca1091,_0x539dbf){_0xca1091=_0xca1091-0x0;var _0xd3019c=_0x814b[_0xca1091];return _0xd3019c;};'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 licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var jayson=require(_0xb814('0x1b'));var client=jayson[_0xb814('0x1c')][_0xb814('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3bde14,_0x1438e7,_0x41ed7b,_0xa0a2e5){return new BPromise(function(_0x2ab627,_0x3f4881){var _0x44fb96=_0xa0a2e5||client;return _0x44fb96[_0xb814('0x1e')](_0x3bde14,_0x41ed7b)[_0xb814('0x1f')](function(_0x303aca){logger[_0xb814('0x20')](_0xb814('0x21'),_0x1438e7,_0xb814('0x22'));logger[_0xb814('0x23')](_0xb814('0x24'),_0x1438e7,_0xb814('0x22'),JSON['stringify'](_0x303aca));if(_0x303aca[_0xb814('0x25')]){if(_0x303aca['error'][_0xb814('0x26')]===0x1f4){logger[_0xb814('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x1438e7,_0x303aca['error']['message']);return _0x3f4881(_0x303aca[_0xb814('0x25')]['message']);}logger['error'](_0xb814('0x21'),_0x1438e7,_0x303aca[_0xb814('0x25')][_0xb814('0x27')]);return _0x2ab627(_0x303aca['error'][_0xb814('0x27')]);}else{logger['info'](_0xb814('0x21'),_0x1438e7,_0xb814('0x22'));_0x2ab627(_0x303aca[_0xb814('0x28')][_0xb814('0x27')]);}})[_0xb814('0x29')](function(_0x2bd039){logger[_0xb814('0x25')]('ZohoConfiguration,\x20%s,\x20%s',_0x1438e7,_0x2bd039);_0x3f4881(_0x2bd039);});});}function respondWithStatusCode(_0x2ead86,_0x52b7a3){_0x52b7a3=_0x52b7a3||0xcc;return function(_0x3f81d0){if(_0x3f81d0){return _0x2ead86[_0xb814('0x2a')](_0x52b7a3);}return _0x2ead86[_0xb814('0x2b')](_0x52b7a3)[_0xb814('0x2c')]();};}function respondWithResult(_0x1c8a2e,_0xb9e57d){_0xb9e57d=_0xb9e57d||0xc8;return function(_0x3d836c){if(_0x3d836c){return _0x1c8a2e['status'](_0xb9e57d)[_0xb814('0x2d')](_0x3d836c);}};}function respondWithFilteredResult(_0xc0ef66,_0x1c2625){return function(_0x349394){if(_0x349394){var _0x32ed56=_0x349394['count'],_0x1d5965=_0x1c2625[_0xb814('0x2e')],_0x3f0150=_0x1c2625[_0xb814('0x2e')]+_0x1c2625['limit'],_0x1e4e89;if(_0x3f0150>=_0x32ed56){_0x3f0150=_0x32ed56;_0x1e4e89=0xc8;}else{_0x1e4e89=0xce;}_0xc0ef66[_0xb814('0x2b')](_0x1e4e89);return _0xc0ef66[_0xb814('0x2f')](_0xb814('0x30'),_0x1d5965+'-'+_0x3f0150+'/'+_0x32ed56)['json'](_0x349394);}return null;};}function patchUpdates(_0x20577b){return function(_0x2051d0){try{jsonpatch['apply'](_0x2051d0,_0x20577b,!![]);}catch(_0x338a28){return BPromise['reject'](_0x338a28);}return _0x2051d0[_0xb814('0x31')]();};}function saveUpdates(_0x5f3e9b,_0x4cfc58){return function(_0x419cd9){if(_0x419cd9){return _0x419cd9['update'](_0x5f3e9b)[_0xb814('0x1f')](function(_0x19469b){return _0x19469b;});}return null;};}function removeEntity(_0x2b91bd,_0x599f9f){return function(_0x51d5ae){if(_0x51d5ae){return _0x51d5ae[_0xb814('0x32')]()[_0xb814('0x1f')](function(){_0x2b91bd['status'](0xcc)[_0xb814('0x2c')]();});}};}function handleEntityNotFound(_0xe558d5,_0x692c72){return function(_0x217b7e){if(!_0x217b7e){_0xe558d5[_0xb814('0x2a')](0x194);}return _0x217b7e;};}function handleError(_0x60024d,_0x3672f3){_0x3672f3=_0x3672f3||0x1f4;return function(_0x4df4e6){logger[_0xb814('0x25')](_0x4df4e6[_0xb814('0x33')]);if(_0x4df4e6[_0xb814('0x34')]){delete _0x4df4e6[_0xb814('0x34')];}_0x60024d[_0xb814('0x2b')](_0x3672f3)['send'](_0x4df4e6);};}exports[_0xb814('0x35')]=function(_0x57e6e6,_0x43db67){var _0x16e21c={},_0xe0f509={},_0x492d5e={'count':0x0,'rows':[]};var _0x40b885=_[_0xb814('0x36')](db['ZohoConfiguration'][_0xb814('0x37')],function(_0x2d0e27){return{'name':_0x2d0e27[_0xb814('0x38')],'type':_0x2d0e27[_0xb814('0x39')][_0xb814('0x3a')]};});_0xe0f509[_0xb814('0x3b')]=_['map'](_0x40b885,_0xb814('0x34'));_0xe0f509['query']=_[_0xb814('0x3c')](_0x57e6e6['query']);_0xe0f509[_0xb814('0x3d')]=_['intersection'](_0xe0f509[_0xb814('0x3b')],_0xe0f509[_0xb814('0x3e')]);_0x16e21c['attributes']=_['intersection'](_0xe0f509['model'],qs['fields'](_0x57e6e6[_0xb814('0x3e')][_0xb814('0x3f')]));_0x16e21c[_0xb814('0x40')]=_0x16e21c[_0xb814('0x40')]['length']?_0x16e21c['attributes']:_0xe0f509[_0xb814('0x3b')];if(!_0x57e6e6['query'][_0xb814('0x41')](_0xb814('0x42'))){_0x16e21c[_0xb814('0x43')]=qs[_0xb814('0x43')](_0x57e6e6[_0xb814('0x3e')][_0xb814('0x43')]);_0x16e21c[_0xb814('0x2e')]=qs[_0xb814('0x2e')](_0x57e6e6[_0xb814('0x3e')]['offset']);}_0x16e21c['order']=qs['sort'](_0x57e6e6[_0xb814('0x3e')]['sort']);_0x16e21c[_0xb814('0x44')]=qs['filters'](_[_0xb814('0x45')](_0x57e6e6[_0xb814('0x3e')],_0xe0f509[_0xb814('0x3d')]),_0x40b885);if(_0x57e6e6[_0xb814('0x3e')]['filter']){_0x16e21c[_0xb814('0x44')]=_[_0xb814('0x46')](_0x16e21c[_0xb814('0x44')],{'$or':_[_0xb814('0x36')](_0x40b885,function(_0x7d92aa){if(_0x7d92aa[_0xb814('0x39')]!=='VIRTUAL'){var _0x69f060={};_0x69f060[_0x7d92aa[_0xb814('0x34')]]={'$like':'%'+_0x57e6e6[_0xb814('0x3e')][_0xb814('0x47')]+'%'};return _0x69f060;}})});}_0x16e21c=_[_0xb814('0x46')]({},_0x16e21c,_0x57e6e6[_0xb814('0x48')]);var _0x263152={'where':_0x16e21c['where']};return db['ZohoConfiguration'][_0xb814('0x49')](_0x263152)[_0xb814('0x1f')](function(_0x4c08d6){_0x492d5e[_0xb814('0x49')]=_0x4c08d6;if(_0x57e6e6[_0xb814('0x3e')][_0xb814('0x4a')]){_0x16e21c[_0xb814('0x4b')]=[{'all':!![]}];}return db[_0xb814('0x4c')][_0xb814('0x4d')](_0x16e21c);})[_0xb814('0x1f')](function(_0xe73300){_0x492d5e['rows']=_0xe73300;return _0x492d5e;})[_0xb814('0x1f')](respondWithFilteredResult(_0x43db67,_0x16e21c))[_0xb814('0x29')](handleError(_0x43db67,null));};exports['show']=function(_0x338e80,_0x55234d){var _0x2fb0f7={'raw':![],'where':{'id':_0x338e80[_0xb814('0x4e')]['id']}},_0x37866f={};_0x37866f[_0xb814('0x3b')]=_[_0xb814('0x3c')](db[_0xb814('0x4c')][_0xb814('0x37')]);_0x37866f[_0xb814('0x3e')]=_[_0xb814('0x3c')](_0x338e80[_0xb814('0x3e')]);_0x37866f['filtears']=_['intersection'](_0x37866f[_0xb814('0x3b')],_0x37866f[_0xb814('0x3e')]);_0x2fb0f7[_0xb814('0x40')]=_[_0xb814('0x4f')](_0x37866f[_0xb814('0x3b')],qs[_0xb814('0x3f')](_0x338e80[_0xb814('0x3e')]['fields']));_0x2fb0f7[_0xb814('0x40')]=_0x2fb0f7[_0xb814('0x40')][_0xb814('0x50')]?_0x2fb0f7['attributes']:_0x37866f[_0xb814('0x3b')];if(_0x338e80['query'][_0xb814('0x4a')]){_0x2fb0f7['include']=[{'all':!![]}];}_0x2fb0f7=_[_0xb814('0x46')]({},_0x2fb0f7,_0x338e80[_0xb814('0x48')]);return db['ZohoConfiguration'][_0xb814('0x51')](_0x2fb0f7)[_0xb814('0x1f')](handleEntityNotFound(_0x55234d,null))[_0xb814('0x1f')](respondWithResult(_0x55234d,null))['catch'](handleError(_0x55234d,null));};exports[_0xb814('0x52')]=function(_0x5f0e58,_0x13bdcf){return db[_0xb814('0x4c')]['create'](_0x5f0e58[_0xb814('0x53')],{})['then'](respondWithResult(_0x13bdcf,0xc9))['catch'](handleError(_0x13bdcf,null));};exports[_0xb814('0x54')]=function(_0x35f59a,_0x34935b){if(_0x35f59a['body']['id']){delete _0x35f59a[_0xb814('0x53')]['id'];}return db['ZohoConfiguration'][_0xb814('0x51')]({'where':{'id':_0x35f59a[_0xb814('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34935b,null))[_0xb814('0x1f')](saveUpdates(_0x35f59a['body'],null))[_0xb814('0x1f')](respondWithResult(_0x34935b,null))[_0xb814('0x29')](handleError(_0x34935b,null));};exports[_0xb814('0x32')]=function(_0x113fe5,_0x251d44){return db[_0xb814('0x4c')][_0xb814('0x51')]({'where':{'id':_0x113fe5[_0xb814('0x4e')]['id']}})['then'](handleEntityNotFound(_0x251d44,null))[_0xb814('0x1f')](removeEntity(_0x251d44,null))[_0xb814('0x29')](handleError(_0x251d44,null));};exports['getFields']=function(_0x29a127,_0xe14249,_0x4d13db){var _0x371000={};var _0x58b9a6={};var _0x48362c;var _0x2114ca;return db['ZohoConfiguration'][_0xb814('0x55')]({'where':{'id':_0x29a127[_0xb814('0x4e')]['id']}})[_0xb814('0x1f')](handleEntityNotFound(_0xe14249,null))['then'](function(_0x1a0ef4){if(_0x1a0ef4){_0x48362c=_0x1a0ef4;_0x58b9a6['model']=_[_0xb814('0x3c')](db[_0xb814('0x56')][_0xb814('0x37')]);_0x58b9a6[_0xb814('0x3e')]=_[_0xb814('0x3c')](_0x29a127[_0xb814('0x3e')]);_0x58b9a6[_0xb814('0x3d')]=_[_0xb814('0x4f')](_0x58b9a6[_0xb814('0x3b')],_0x58b9a6['query']);_0x371000[_0xb814('0x40')]=_[_0xb814('0x4f')](_0x58b9a6[_0xb814('0x3b')],qs[_0xb814('0x3f')](_0x29a127[_0xb814('0x3e')][_0xb814('0x3f')]));_0x371000['attributes']=_0x371000[_0xb814('0x40')]['length']?_0x371000[_0xb814('0x40')]:_0x58b9a6[_0xb814('0x3b')];_0x371000[_0xb814('0x57')]=qs['sort'](_0x29a127[_0xb814('0x3e')]['sort']);_0x371000[_0xb814('0x44')]=qs['filters'](_[_0xb814('0x45')](_0x29a127[_0xb814('0x3e')],_0x58b9a6[_0xb814('0x3d')]));if(_0x29a127[_0xb814('0x3e')][_0xb814('0x47')]){_0x371000[_0xb814('0x44')]=_[_0xb814('0x46')](_0x371000['where'],{'$or':_[_0xb814('0x36')](_0x371000['attributes'],function(_0x255047){var _0x22c73f={};_0x22c73f[_0x255047]={'$like':'%'+_0x29a127[_0xb814('0x3e')][_0xb814('0x47')]+'%'};return _0x22c73f;})});}_0x371000=_[_0xb814('0x46')]({},_0x371000,_0x29a127[_0xb814('0x48')]);return _0x48362c['getFields'](_0x371000);}})[_0xb814('0x1f')](function(_0x1a2603){if(_0x1a2603){_0x2114ca=_0x1a2603['length'];if(!_0x29a127[_0xb814('0x3e')][_0xb814('0x41')](_0xb814('0x42'))){_0x371000[_0xb814('0x43')]=qs[_0xb814('0x43')](_0x29a127['query'][_0xb814('0x43')]);_0x371000['offset']=qs[_0xb814('0x2e')](_0x29a127[_0xb814('0x3e')][_0xb814('0x2e')]);}return _0x48362c[_0xb814('0x58')](_0x371000);}})[_0xb814('0x1f')](function(_0x41bcaf){if(_0x41bcaf){return _0x41bcaf?{'count':_0x2114ca,'rows':_0x41bcaf}:null;}})['then'](respondWithResult(_0xe14249,null))['catch'](handleError(_0xe14249,null));};exports['getSubjects']=function(_0x25c776,_0x490e5c,_0x45a8b9){var _0x1d3954={};var _0x25db89={};var _0x5e966c;var _0x1b76fa;return db[_0xb814('0x4c')][_0xb814('0x55')]({'where':{'id':_0x25c776['params']['id']}})[_0xb814('0x1f')](handleEntityNotFound(_0x490e5c,null))[_0xb814('0x1f')](function(_0x1f39c0){if(_0x1f39c0){_0x5e966c=_0x1f39c0;_0x25db89[_0xb814('0x3b')]=_['keys'](db['ZohoField'][_0xb814('0x37')]);_0x25db89[_0xb814('0x3e')]=_[_0xb814('0x3c')](_0x25c776[_0xb814('0x3e')]);_0x25db89[_0xb814('0x3d')]=_[_0xb814('0x4f')](_0x25db89[_0xb814('0x3b')],_0x25db89[_0xb814('0x3e')]);_0x1d3954[_0xb814('0x40')]=_[_0xb814('0x4f')](_0x25db89[_0xb814('0x3b')],qs[_0xb814('0x3f')](_0x25c776[_0xb814('0x3e')][_0xb814('0x3f')]));_0x1d3954[_0xb814('0x40')]=_0x1d3954['attributes'][_0xb814('0x50')]?_0x1d3954[_0xb814('0x40')]:_0x25db89[_0xb814('0x3b')];_0x1d3954[_0xb814('0x57')]=qs[_0xb814('0x59')](_0x25c776[_0xb814('0x3e')]['sort']);_0x1d3954[_0xb814('0x44')]=qs['filters'](_[_0xb814('0x45')](_0x25c776[_0xb814('0x3e')],_0x25db89[_0xb814('0x3d')]));if(_0x25c776[_0xb814('0x3e')][_0xb814('0x47')]){_0x1d3954['where']=_['merge'](_0x1d3954[_0xb814('0x44')],{'$or':_[_0xb814('0x36')](_0x1d3954[_0xb814('0x40')],function(_0x1cbf0c){var _0x488ef2={};_0x488ef2[_0x1cbf0c]={'$like':'%'+_0x25c776[_0xb814('0x3e')]['filter']+'%'};return _0x488ef2;})});}_0x1d3954=_[_0xb814('0x46')]({},_0x1d3954,_0x25c776[_0xb814('0x48')]);return _0x5e966c['getSubjects'](_0x1d3954);}})['then'](function(_0x2fa6b7){if(_0x2fa6b7){_0x1b76fa=_0x2fa6b7['length'];if(!_0x25c776[_0xb814('0x3e')][_0xb814('0x41')](_0xb814('0x42'))){_0x1d3954[_0xb814('0x43')]=qs[_0xb814('0x43')](_0x25c776[_0xb814('0x3e')][_0xb814('0x43')]);_0x1d3954['offset']=qs[_0xb814('0x2e')](_0x25c776['query'][_0xb814('0x2e')]);}return _0x5e966c['getSubjects'](_0x1d3954);}})[_0xb814('0x1f')](function(_0x43ee60){if(_0x43ee60){return _0x43ee60?{'count':_0x1b76fa,'rows':_0x43ee60}:null;}})['then'](respondWithResult(_0x490e5c,null))[_0xb814('0x29')](handleError(_0x490e5c,null));};exports['getDescriptions']=function(_0x37adec,_0x356875,_0x4e15c2){var _0x5a0c4a={};var _0x9e2e16={};var _0x25d976;var _0x3309c5;return db[_0xb814('0x4c')][_0xb814('0x55')]({'where':{'id':_0x37adec[_0xb814('0x4e')]['id']}})[_0xb814('0x1f')](handleEntityNotFound(_0x356875,null))[_0xb814('0x1f')](function(_0x8cb107){if(_0x8cb107){_0x25d976=_0x8cb107;_0x9e2e16[_0xb814('0x3b')]=_['keys'](db['ZohoField']['rawAttributes']);_0x9e2e16['query']=_['keys'](_0x37adec[_0xb814('0x3e')]);_0x9e2e16[_0xb814('0x3d')]=_[_0xb814('0x4f')](_0x9e2e16['model'],_0x9e2e16[_0xb814('0x3e')]);_0x5a0c4a[_0xb814('0x40')]=_[_0xb814('0x4f')](_0x9e2e16[_0xb814('0x3b')],qs[_0xb814('0x3f')](_0x37adec[_0xb814('0x3e')][_0xb814('0x3f')]));_0x5a0c4a[_0xb814('0x40')]=_0x5a0c4a['attributes'][_0xb814('0x50')]?_0x5a0c4a[_0xb814('0x40')]:_0x9e2e16[_0xb814('0x3b')];_0x5a0c4a[_0xb814('0x57')]=qs['sort'](_0x37adec[_0xb814('0x3e')][_0xb814('0x59')]);_0x5a0c4a[_0xb814('0x44')]=qs[_0xb814('0x3d')](_[_0xb814('0x45')](_0x37adec['query'],_0x9e2e16['filters']));if(_0x37adec[_0xb814('0x3e')]['filter']){_0x5a0c4a[_0xb814('0x44')]=_[_0xb814('0x46')](_0x5a0c4a['where'],{'$or':_[_0xb814('0x36')](_0x5a0c4a['attributes'],function(_0xe17e86){var _0x520d0f={};_0x520d0f[_0xe17e86]={'$like':'%'+_0x37adec[_0xb814('0x3e')][_0xb814('0x47')]+'%'};return _0x520d0f;})});}_0x5a0c4a=_[_0xb814('0x46')]({},_0x5a0c4a,_0x37adec[_0xb814('0x48')]);return _0x25d976[_0xb814('0x5a')](_0x5a0c4a);}})[_0xb814('0x1f')](function(_0x455b22){if(_0x455b22){_0x3309c5=_0x455b22['length'];if(!_0x37adec['query'][_0xb814('0x41')]('nolimit')){_0x5a0c4a['limit']=qs[_0xb814('0x43')](_0x37adec[_0xb814('0x3e')][_0xb814('0x43')]);_0x5a0c4a['offset']=qs[_0xb814('0x2e')](_0x37adec['query'][_0xb814('0x2e')]);}return _0x25d976[_0xb814('0x5a')](_0x5a0c4a);}})[_0xb814('0x1f')](function(_0x2d2b6c){if(_0x2d2b6c){return _0x2d2b6c?{'count':_0x3309c5,'rows':_0x2d2b6c}:null;}})['then'](respondWithResult(_0x356875,null))[_0xb814('0x29')](handleError(_0x356875,null));}; \ No newline at end of file +var _0x7fbe=['attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','params','filtears','includeAll','find','catch','update','body','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x11c4b6,_0x572fdb){var _0x2cb405=function(_0xf12cc4){while(--_0xf12cc4){_0x11c4b6['push'](_0x11c4b6['shift']());}};_0x2cb405(++_0x572fdb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x51b1a5,_0x285a4f){_0x51b1a5=_0x51b1a5-0x0;var _0x15c738=_0x7fbe[_0x51b1a5];return _0x15c738;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe7fb('0x0'));var zipdir=require(_0xe7fb('0x1'));var jsonpatch=require(_0xe7fb('0x2'));var rp=require(_0xe7fb('0x3'));var moment=require(_0xe7fb('0x4'));var BPromise=require(_0xe7fb('0x5'));var Mustache=require(_0xe7fb('0x6'));var util=require(_0xe7fb('0x7'));var path=require(_0xe7fb('0x8'));var sox=require(_0xe7fb('0x9'));var csv=require(_0xe7fb('0xa'));var ejs=require(_0xe7fb('0xb'));var fs=require('fs');var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0xa'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];var jayson=require(_0xe7fb('0x1b'));var client=jayson[_0xe7fb('0x1c')][_0xe7fb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x45fe75,_0x7fe4d3,_0x598729,_0x278b75){return new BPromise(function(_0x2225e5,_0x5573ab){var _0x30015a=_0x278b75||client;return _0x30015a[_0xe7fb('0x1e')](_0x45fe75,_0x598729)['then'](function(_0xa76acf){logger['info'](_0xe7fb('0x1f'),_0x7fe4d3,_0xe7fb('0x20'));logger[_0xe7fb('0x21')](_0xe7fb('0x22'),_0x7fe4d3,'request\x20sent',JSON[_0xe7fb('0x23')](_0xa76acf));if(_0xa76acf['error']){if(_0xa76acf[_0xe7fb('0x24')]['code']===0x1f4){logger[_0xe7fb('0x24')](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf[_0xe7fb('0x24')][_0xe7fb('0x25')]);return _0x5573ab(_0xa76acf['error'][_0xe7fb('0x25')]);}logger['error'](_0xe7fb('0x1f'),_0x7fe4d3,_0xa76acf['error'][_0xe7fb('0x25')]);return _0x2225e5(_0xa76acf['error'][_0xe7fb('0x25')]);}else{logger[_0xe7fb('0x26')]('ZohoConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0xe7fb('0x20'));_0x2225e5(_0xa76acf[_0xe7fb('0x27')][_0xe7fb('0x25')]);}})['catch'](function(_0x469d50){logger[_0xe7fb('0x24')]('ZohoConfiguration,\x20%s,\x20%s',_0x7fe4d3,_0x469d50);_0x5573ab(_0x469d50);});});}function respondWithStatusCode(_0x5bea27,_0x52f08b){_0x52f08b=_0x52f08b||0xcc;return function(_0x35e4db){if(_0x35e4db){return _0x5bea27['sendStatus'](_0x52f08b);}return _0x5bea27['status'](_0x52f08b)[_0xe7fb('0x28')]();};}function respondWithResult(_0x32e8b2,_0x2996ae){_0x2996ae=_0x2996ae||0xc8;return function(_0x4f6c73){if(_0x4f6c73){return _0x32e8b2[_0xe7fb('0x29')](_0x2996ae)[_0xe7fb('0x2a')](_0x4f6c73);}};}function respondWithFilteredResult(_0x390f32,_0x1ceed8){return function(_0x392d75){if(_0x392d75){var _0x16237a=_0x392d75[_0xe7fb('0x2b')],_0x380130=_0x1ceed8[_0xe7fb('0x2c')],_0x59e015=_0x1ceed8[_0xe7fb('0x2c')]+_0x1ceed8['limit'],_0x5df9f2;if(_0x59e015>=_0x16237a){_0x59e015=_0x16237a;_0x5df9f2=0xc8;}else{_0x5df9f2=0xce;}_0x390f32[_0xe7fb('0x29')](_0x5df9f2);return _0x390f32[_0xe7fb('0x2d')](_0xe7fb('0x2e'),_0x380130+'-'+_0x59e015+'/'+_0x16237a)[_0xe7fb('0x2a')](_0x392d75);}return null;};}function patchUpdates(_0x219554){return function(_0x1256d4){try{jsonpatch[_0xe7fb('0x2f')](_0x1256d4,_0x219554,!![]);}catch(_0x3dd0be){return BPromise['reject'](_0x3dd0be);}return _0x1256d4[_0xe7fb('0x30')]();};}function saveUpdates(_0x1742f3,_0x29d1ca){return function(_0x547a04){if(_0x547a04){return _0x547a04['update'](_0x1742f3)[_0xe7fb('0x31')](function(_0x4a9fea){return _0x4a9fea;});}return null;};}function removeEntity(_0xac56b4,_0x2f8774){return function(_0xe49053){if(_0xe49053){return _0xe49053[_0xe7fb('0x32')]()['then'](function(){_0xac56b4[_0xe7fb('0x29')](0xcc)[_0xe7fb('0x28')]();});}};}function handleEntityNotFound(_0x18ed83,_0x2f8818){return function(_0x2d650d){if(!_0x2d650d){_0x18ed83['sendStatus'](0x194);}return _0x2d650d;};}function handleError(_0x256694,_0x121d19){_0x121d19=_0x121d19||0x1f4;return function(_0x209eaa){logger[_0xe7fb('0x24')](_0x209eaa[_0xe7fb('0x33')]);if(_0x209eaa[_0xe7fb('0x34')]){delete _0x209eaa[_0xe7fb('0x34')];}_0x256694[_0xe7fb('0x29')](_0x121d19)[_0xe7fb('0x35')](_0x209eaa);};}exports['index']=function(_0x44d8cf,_0x29ef52){var _0x2593e3={},_0x56e17b={},_0x1de75a={'count':0x0,'rows':[]};var _0x3502dc=_[_0xe7fb('0x36')](db[_0xe7fb('0x37')][_0xe7fb('0x38')],function(_0x35b828){return{'name':_0x35b828[_0xe7fb('0x39')],'type':_0x35b828[_0xe7fb('0x3a')][_0xe7fb('0x3b')]};});_0x56e17b[_0xe7fb('0x3c')]=_[_0xe7fb('0x36')](_0x3502dc,_0xe7fb('0x34'));_0x56e17b[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x44d8cf[_0xe7fb('0x3d')]);_0x56e17b[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],_0x56e17b[_0xe7fb('0x3d')]);_0x2593e3['attributes']=_[_0xe7fb('0x40')](_0x56e17b[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x44d8cf[_0xe7fb('0x3d')]['fields']));_0x2593e3[_0xe7fb('0x42')]=_0x2593e3[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2593e3[_0xe7fb('0x42')]:_0x56e17b['model'];if(!_0x44d8cf[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2593e3[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x44d8cf[_0xe7fb('0x3d')]['limit']);_0x2593e3[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x44d8cf[_0xe7fb('0x3d')]['offset']);}_0x2593e3[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x44d8cf['query']['sort']);_0x2593e3['where']=qs['filters'](_['pick'](_0x44d8cf[_0xe7fb('0x3d')],_0x56e17b[_0xe7fb('0x3f')]),_0x3502dc);if(_0x44d8cf[_0xe7fb('0x3d')]['filter']){_0x2593e3[_0xe7fb('0x49')]=_['merge'](_0x2593e3[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x3502dc,function(_0x4d29d3){if(_0x4d29d3[_0xe7fb('0x3a')]!==_0xe7fb('0x4a')){var _0x240efa={};_0x240efa[_0x4d29d3[_0xe7fb('0x34')]]={'$like':'%'+_0x44d8cf['query'][_0xe7fb('0x4b')]+'%'};return _0x240efa;}})});}_0x2593e3=_[_0xe7fb('0x4c')]({},_0x2593e3,_0x44d8cf[_0xe7fb('0x4d')]);var _0x56a84f={'where':_0x2593e3[_0xe7fb('0x49')]};return db[_0xe7fb('0x37')][_0xe7fb('0x2b')](_0x56a84f)[_0xe7fb('0x31')](function(_0xc07c40){_0x1de75a['count']=_0xc07c40;if(_0x44d8cf[_0xe7fb('0x3d')]['includeAll']){_0x2593e3[_0xe7fb('0x4e')]=[{'all':!![]}];}return db[_0xe7fb('0x37')][_0xe7fb('0x4f')](_0x2593e3);})[_0xe7fb('0x31')](function(_0x15cec3){_0x1de75a['rows']=_0x15cec3;return _0x1de75a;})[_0xe7fb('0x31')](respondWithFilteredResult(_0x29ef52,_0x2593e3))['catch'](handleError(_0x29ef52,null));};exports['show']=function(_0x12c828,_0x3d740f){var _0x16327f={'raw':![],'where':{'id':_0x12c828[_0xe7fb('0x50')]['id']}},_0x589555={};_0x589555[_0xe7fb('0x3c')]=_['keys'](db['ZohoConfiguration'][_0xe7fb('0x38')]);_0x589555[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x12c828[_0xe7fb('0x3d')]);_0x589555[_0xe7fb('0x51')]=_[_0xe7fb('0x40')](_0x589555[_0xe7fb('0x3c')],_0x589555[_0xe7fb('0x3d')]);_0x16327f['attributes']=_[_0xe7fb('0x40')](_0x589555['model'],qs[_0xe7fb('0x41')](_0x12c828[_0xe7fb('0x3d')]['fields']));_0x16327f[_0xe7fb('0x42')]=_0x16327f['attributes'][_0xe7fb('0x43')]?_0x16327f['attributes']:_0x589555[_0xe7fb('0x3c')];if(_0x12c828['query'][_0xe7fb('0x52')]){_0x16327f['include']=[{'all':!![]}];}_0x16327f=_[_0xe7fb('0x4c')]({},_0x16327f,_0x12c828[_0xe7fb('0x4d')]);return db[_0xe7fb('0x37')][_0xe7fb('0x53')](_0x16327f)[_0xe7fb('0x31')](handleEntityNotFound(_0x3d740f,null))[_0xe7fb('0x31')](respondWithResult(_0x3d740f,null))[_0xe7fb('0x54')](handleError(_0x3d740f,null));};exports['create']=function(_0x5d20dc,_0x20aa55){return db['ZohoConfiguration']['create'](_0x5d20dc['body'],{})['then'](respondWithResult(_0x20aa55,0xc9))['catch'](handleError(_0x20aa55,null));};exports[_0xe7fb('0x55')]=function(_0x34dd69,_0xd2fd76){if(_0x34dd69[_0xe7fb('0x56')]['id']){delete _0x34dd69['body']['id'];}return db[_0xe7fb('0x37')][_0xe7fb('0x53')]({'where':{'id':_0x34dd69[_0xe7fb('0x50')]['id']}})['then'](handleEntityNotFound(_0xd2fd76,null))['then'](saveUpdates(_0x34dd69[_0xe7fb('0x56')],null))[_0xe7fb('0x31')](respondWithResult(_0xd2fd76,null))[_0xe7fb('0x54')](handleError(_0xd2fd76,null));};exports['destroy']=function(_0x27f860,_0x3d946b){return db[_0xe7fb('0x37')][_0xe7fb('0x53')]({'where':{'id':_0x27f860['params']['id']}})['then'](handleEntityNotFound(_0x3d946b,null))[_0xe7fb('0x31')](removeEntity(_0x3d946b,null))[_0xe7fb('0x54')](handleError(_0x3d946b,null));};exports[_0xe7fb('0x57')]=function(_0x2f61b1,_0x3b0147,_0x5dd7c8){var _0x9c45a={};var _0x349a2a={};var _0x23755b;var _0x590d7a;return db['ZohoConfiguration'][_0xe7fb('0x58')]({'where':{'id':_0x2f61b1[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x3b0147,null))[_0xe7fb('0x31')](function(_0x40f546){if(_0x40f546){_0x23755b=_0x40f546;_0x349a2a[_0xe7fb('0x3c')]=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x38')]);_0x349a2a[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x2f61b1[_0xe7fb('0x3d')]);_0x349a2a[_0xe7fb('0x3f')]=_['intersection'](_0x349a2a[_0xe7fb('0x3c')],_0x349a2a['query']);_0x9c45a[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x349a2a[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2f61b1['query']['fields']));_0x9c45a[_0xe7fb('0x42')]=_0x9c45a[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x9c45a[_0xe7fb('0x42')]:_0x349a2a[_0xe7fb('0x3c')];_0x9c45a['order']=qs[_0xe7fb('0x48')](_0x2f61b1['query'][_0xe7fb('0x48')]);_0x9c45a['where']=qs['filters'](_[_0xe7fb('0x5a')](_0x2f61b1[_0xe7fb('0x3d')],_0x349a2a[_0xe7fb('0x3f')]));if(_0x2f61b1['query'][_0xe7fb('0x4b')]){_0x9c45a[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x9c45a[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x9c45a['attributes'],function(_0x404498){var _0x3c153a={};_0x3c153a[_0x404498]={'$like':'%'+_0x2f61b1['query'][_0xe7fb('0x4b')]+'%'};return _0x3c153a;})});}_0x9c45a=_[_0xe7fb('0x4c')]({},_0x9c45a,_0x2f61b1['options']);return _0x23755b[_0xe7fb('0x57')](_0x9c45a);}})['then'](function(_0x2705ef){if(_0x2705ef){_0x590d7a=_0x2705ef[_0xe7fb('0x43')];if(!_0x2f61b1[_0xe7fb('0x3d')]['hasOwnProperty'](_0xe7fb('0x45'))){_0x9c45a[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2f61b1[_0xe7fb('0x3d')][_0xe7fb('0x46')]);_0x9c45a[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x2f61b1[_0xe7fb('0x3d')]['offset']);}return _0x23755b['getFields'](_0x9c45a);}})[_0xe7fb('0x31')](function(_0x3a674e){if(_0x3a674e){return _0x3a674e?{'count':_0x590d7a,'rows':_0x3a674e}:null;}})[_0xe7fb('0x31')](respondWithResult(_0x3b0147,null))['catch'](handleError(_0x3b0147,null));};exports['getSubjects']=function(_0x1ac1fd,_0x2b071c,_0xad7c53){var _0x1df857={};var _0x2d558c={};var _0x336fd3;var _0x188e57;return db[_0xe7fb('0x37')][_0xe7fb('0x58')]({'where':{'id':_0x1ac1fd[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x2b071c,null))[_0xe7fb('0x31')](function(_0x12b91f){if(_0x12b91f){_0x336fd3=_0x12b91f;_0x2d558c['model']=_['keys'](db[_0xe7fb('0x59')][_0xe7fb('0x38')]);_0x2d558c[_0xe7fb('0x3d')]=_[_0xe7fb('0x3e')](_0x1ac1fd[_0xe7fb('0x3d')]);_0x2d558c['filters']=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],_0x2d558c[_0xe7fb('0x3d')]);_0x1df857[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x2d558c[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x1df857['attributes']=_0x1df857[_0xe7fb('0x42')]['length']?_0x1df857[_0xe7fb('0x42')]:_0x2d558c[_0xe7fb('0x3c')];_0x1df857[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x1ac1fd[_0xe7fb('0x3d')]['sort']);_0x1df857[_0xe7fb('0x49')]=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x5a')](_0x1ac1fd[_0xe7fb('0x3d')],_0x2d558c[_0xe7fb('0x3f')]));if(_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x1df857[_0xe7fb('0x49')]=_[_0xe7fb('0x4c')](_0x1df857[_0xe7fb('0x49')],{'$or':_[_0xe7fb('0x36')](_0x1df857[_0xe7fb('0x42')],function(_0x3a68c0){var _0x300a7c={};_0x300a7c[_0x3a68c0]={'$like':'%'+_0x1ac1fd['query']['filter']+'%'};return _0x300a7c;})});}_0x1df857=_['merge']({},_0x1df857,_0x1ac1fd[_0xe7fb('0x4d')]);return _0x336fd3[_0xe7fb('0x5b')](_0x1df857);}})[_0xe7fb('0x31')](function(_0x2789f0){if(_0x2789f0){_0x188e57=_0x2789f0['length'];if(!_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x1df857[_0xe7fb('0x46')]=qs['limit'](_0x1ac1fd[_0xe7fb('0x3d')]['limit']);_0x1df857[_0xe7fb('0x2c')]=qs[_0xe7fb('0x2c')](_0x1ac1fd[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0x336fd3[_0xe7fb('0x5b')](_0x1df857);}})['then'](function(_0x3ffd6c){if(_0x3ffd6c){return _0x3ffd6c?{'count':_0x188e57,'rows':_0x3ffd6c}:null;}})['then'](respondWithResult(_0x2b071c,null))[_0xe7fb('0x54')](handleError(_0x2b071c,null));};exports['getDescriptions']=function(_0x2aeeed,_0x38f52c,_0x4c37cd){var _0x2b6d69={};var _0x31642f={};var _0xb19e94;var _0x4181fd;return db['ZohoConfiguration'][_0xe7fb('0x58')]({'where':{'id':_0x2aeeed[_0xe7fb('0x50')]['id']}})[_0xe7fb('0x31')](handleEntityNotFound(_0x38f52c,null))['then'](function(_0x11d5b6){if(_0x11d5b6){_0xb19e94=_0x11d5b6;_0x31642f['model']=_['keys'](db['ZohoField'][_0xe7fb('0x38')]);_0x31642f[_0xe7fb('0x3d')]=_['keys'](_0x2aeeed[_0xe7fb('0x3d')]);_0x31642f[_0xe7fb('0x3f')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],_0x31642f[_0xe7fb('0x3d')]);_0x2b6d69[_0xe7fb('0x42')]=_[_0xe7fb('0x40')](_0x31642f[_0xe7fb('0x3c')],qs[_0xe7fb('0x41')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x41')]));_0x2b6d69[_0xe7fb('0x42')]=_0x2b6d69[_0xe7fb('0x42')][_0xe7fb('0x43')]?_0x2b6d69[_0xe7fb('0x42')]:_0x31642f[_0xe7fb('0x3c')];_0x2b6d69[_0xe7fb('0x47')]=qs[_0xe7fb('0x48')](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x48')]);_0x2b6d69['where']=qs[_0xe7fb('0x3f')](_[_0xe7fb('0x5a')](_0x2aeeed[_0xe7fb('0x3d')],_0x31642f[_0xe7fb('0x3f')]));if(_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x4b')]){_0x2b6d69[_0xe7fb('0x49')]=_['merge'](_0x2b6d69['where'],{'$or':_[_0xe7fb('0x36')](_0x2b6d69['attributes'],function(_0x2f486){var _0x496205={};_0x496205[_0x2f486]={'$like':'%'+_0x2aeeed['query'][_0xe7fb('0x4b')]+'%'};return _0x496205;})});}_0x2b6d69=_[_0xe7fb('0x4c')]({},_0x2b6d69,_0x2aeeed[_0xe7fb('0x4d')]);return _0xb19e94[_0xe7fb('0x5c')](_0x2b6d69);}})[_0xe7fb('0x31')](function(_0x38cc9e){if(_0x38cc9e){_0x4181fd=_0x38cc9e['length'];if(!_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x44')](_0xe7fb('0x45'))){_0x2b6d69[_0xe7fb('0x46')]=qs[_0xe7fb('0x46')](_0x2aeeed[_0xe7fb('0x3d')]['limit']);_0x2b6d69['offset']=qs['offset'](_0x2aeeed[_0xe7fb('0x3d')][_0xe7fb('0x2c')]);}return _0xb19e94[_0xe7fb('0x5c')](_0x2b6d69);}})['then'](function(_0xfa895b){if(_0xfa895b){return _0xfa895b?{'count':_0x4181fd,'rows':_0xfa895b}:null;}})['then'](respondWithResult(_0x38f52c,null))[_0xe7fb('0x54')](handleError(_0x38f52c,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 78242e2..8f0188e 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 _0x7774=['ZohoConfiguration','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x7774,0x182));var _0x4777=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x7774[_0x2b5b44];return _0x32cb66;};'use strict';var _=require('lodash');var util=require(_0x4777('0x0'));var logger=require(_0x4777('0x1'))('api');var moment=require(_0x4777('0x2'));var BPromise=require(_0x4777('0x3'));var rp=require(_0x4777('0x4'));var fs=require('fs');var path=require(_0x4777('0x5'));var rimraf=require('rimraf');var config=require(_0x4777('0x6'));var attributes=require(_0x4777('0x7'));module[_0x4777('0x8')]=function(_0x20bbb7,_0x2c0191){return _0x20bbb7[_0x4777('0x9')](_0x4777('0xa'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x246e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x246e,0x6b));var _0xe246=function(_0x453fec,_0x477691){_0x453fec=_0x453fec-0x0;var _0x33392f=_0x246e[_0x453fec];return _0x33392f;};'use strict';var _=require(_0xe246('0x0'));var util=require(_0xe246('0x1'));var logger=require(_0xe246('0x2'))('api');var moment=require(_0xe246('0x3'));var BPromise=require(_0xe246('0x4'));var rp=require(_0xe246('0x5'));var fs=require('fs');var path=require(_0xe246('0x6'));var rimraf=require(_0xe246('0x7'));var config=require(_0xe246('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x1fecfa,_0x1c967f){return _0x1fecfa[_0xe246('0x9')]('ZohoConfiguration',attributes,{'tableName':_0xe246('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 69d8f0a..2c1aaba 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 _0x32f2=['client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x32f2,0x116));var _0x232f=function(_0x429b6e,_0x1b4636){_0x429b6e=_0x429b6e-0x0;var _0x4dfb1a=_0x32f2[_0x429b6e];return _0x4dfb1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x232f('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x232f('0x1'));var db=require(_0x232f('0x2'))['db'];var utils=require(_0x232f('0x3'));var logger=require('../../config/logger')(_0x232f('0x4'));var config=require(_0x232f('0x5'));var jayson=require(_0x232f('0x6'));var client=jayson[_0x232f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x522c5a,_0x27517e,_0x4849d5){return new BPromise(function(_0xd6b3b,_0x42993c){return client[_0x232f('0x8')](_0x522c5a,_0x4849d5)[_0x232f('0x9')](function(_0x3c8b58){logger['info'](_0x232f('0xa'),_0x27517e,_0x232f('0xb'));logger['debug'](_0x232f('0xc'),_0x27517e,_0x232f('0xb'),JSON['stringify'](_0x3c8b58));if(_0x3c8b58[_0x232f('0xd')]){if(_0x3c8b58[_0x232f('0xd')][_0x232f('0xe')]===0x1f4){logger['error'](_0x232f('0xa'),_0x27517e,_0x3c8b58[_0x232f('0xd')][_0x232f('0xf')]);return _0x42993c(_0x3c8b58[_0x232f('0xd')][_0x232f('0xf')]);}logger[_0x232f('0xd')](_0x232f('0xa'),_0x27517e,_0x3c8b58[_0x232f('0xd')][_0x232f('0xf')]);return _0xd6b3b(_0x3c8b58['error'][_0x232f('0xf')]);}else{logger[_0x232f('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x27517e,_0x232f('0xb'));_0xd6b3b(_0x3c8b58[_0x232f('0x11')]['message']);}})[_0x232f('0x12')](function(_0x35bc8e){logger[_0x232f('0xd')](_0x232f('0xa'),_0x27517e,_0x35bc8e);_0x42993c(_0x35bc8e);});});} \ No newline at end of file +var _0x3277=['then','info','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x44b292,_0x541753){var _0x3bc3ff=function(_0x369ec5){while(--_0x369ec5){_0x44b292['push'](_0x44b292['shift']());}};_0x3bc3ff(++_0x541753);}(_0x3277,0xc7));var _0x7327=function(_0x11bb23,_0x250188){_0x11bb23=_0x11bb23-0x0;var _0x683a2=_0x3277[_0x11bb23];return _0x683a2;};'use strict';var _=require(_0x7327('0x0'));var util=require(_0x7327('0x1'));var moment=require(_0x7327('0x2'));var BPromise=require(_0x7327('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7327('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7327('0x5'))('rpc');var config=require(_0x7327('0x6'));var jayson=require(_0x7327('0x7'));var client=jayson[_0x7327('0x8')][_0x7327('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39bcd5,_0x58f430,_0x1435eb){return new BPromise(function(_0x34ff6e,_0x39b4db){return client[_0x7327('0xa')](_0x39bcd5,_0x1435eb)[_0x7327('0xb')](function(_0x39d1a1){logger[_0x7327('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x58f430,_0x7327('0xd'));logger['debug'](_0x7327('0xe'),_0x58f430,_0x7327('0xd'),JSON['stringify'](_0x39d1a1));if(_0x39d1a1['error']){if(_0x39d1a1[_0x7327('0xf')][_0x7327('0x10')]===0x1f4){logger[_0x7327('0xf')](_0x7327('0x11'),_0x58f430,_0x39d1a1[_0x7327('0xf')]['message']);return _0x39b4db(_0x39d1a1['error'][_0x7327('0x12')]);}logger[_0x7327('0xf')](_0x7327('0x11'),_0x58f430,_0x39d1a1[_0x7327('0xf')][_0x7327('0x12')]);return _0x34ff6e(_0x39d1a1[_0x7327('0xf')][_0x7327('0x12')]);}else{logger[_0x7327('0xc')](_0x7327('0x11'),_0x58f430,_0x7327('0xd'));_0x34ff6e(_0x39d1a1[_0x7327('0x13')]['message']);}})[_0x7327('0x14')](function(_0x5b7911){logger[_0x7327('0xf')](_0x7327('0x11'),_0x58f430,_0x5b7911);_0x39b4db(_0x5b7911);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index fd1ad5d..985a827 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 _0x25e7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','index','isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express'];(function(_0x39f2ba,_0x25ab37){var _0x24813b=function(_0xb5cd3f){while(--_0xb5cd3f){_0x39f2ba['push'](_0x39f2ba['shift']());}};_0x24813b(++_0x25ab37);}(_0x25e7,0x1d6));var _0x725e=function(_0x205c48,_0x4d0c4a){_0x205c48=_0x205c48-0x0;var _0x4d8d79=_0x25e7[_0x205c48];return _0x4d8d79;};'use strict';var multer=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var path=require(_0x725e('0x2'));var timeout=require(_0x725e('0x3'));var express=require(_0x725e('0x4'));var router=express[_0x725e('0x5')]();var auth=require(_0x725e('0x6'));var interaction=require(_0x725e('0x7'));var config=require(_0x725e('0x8'));var controller=require(_0x725e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x725e('0xa')]);router['get']('/:id',auth[_0x725e('0xb')](),controller[_0x725e('0xc')]);router[_0x725e('0xd')]('/',auth[_0x725e('0xb')](),controller[_0x725e('0xe')]);router[_0x725e('0xf')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller[_0x725e('0x11')]);router[_0x725e('0x12')](_0x725e('0x10'),auth[_0x725e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8ace=['index','show','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x3077f4,_0x917671){var _0x10a3bf=function(_0x41172f){while(--_0x41172f){_0x3077f4['push'](_0x3077f4['shift']());}};_0x10a3bf(++_0x917671);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x5a84d1,_0x4a330f){_0x5a84d1=_0x5a84d1-0x0;var _0x4b656c=_0x8ace[_0x5a84d1];return _0x4b656c;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/:id',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe8ac('0xe')]);router['put'](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xb')](),controller['destroy']);module[_0xe8ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c9bed77..640561c 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 _0x639d=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x53468a,_0x286986){var _0x205efd=function(_0x5eb1e9){while(--_0x5eb1e9){_0x53468a['push'](_0x53468a['shift']());}};_0x205efd(++_0x286986);}(_0x639d,0xbb));var _0xd639=function(_0x16a123,_0x3e984d){_0x16a123=_0x16a123-0x0;var _0x5821bd=_0x639d[_0x16a123];return _0x5821bd;};'use strict';var Sequelize=require(_0xd639('0x0'));module[_0xd639('0x1')]={'type':{'type':Sequelize[_0xd639('0x2')]('string',_0xd639('0x3'),_0xd639('0x4'),'keyValue'),'defaultValue':_0xd639('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd639('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xd639('0x3'),_0xd639('0x4'))},'keyContent':{'type':Sequelize[_0xd639('0x6')]},'idField':{'type':Sequelize[_0xd639('0x6')]},'nameField':{'type':Sequelize[_0xd639('0x6')]},'customField':{'type':Sequelize[_0xd639('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd639('0x6')]}}; \ No newline at end of file +var _0xd5bf=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x50c7d6,_0x43aaed){var _0x4e1b11=function(_0x247a15){while(--_0x247a15){_0x50c7d6['push'](_0x50c7d6['shift']());}};_0x4e1b11(++_0x43aaed);}(_0xd5bf,0x66));var _0xfd5b=function(_0x1f4082,_0x5d16de){_0x1f4082=_0x1f4082-0x0;var _0x198946=_0xd5bf[_0x1f4082];return _0x198946;};'use strict';var Sequelize=require(_0xfd5b('0x0'));module[_0xfd5b('0x1')]={'type':{'type':Sequelize[_0xfd5b('0x2')](_0xfd5b('0x3'),_0xfd5b('0x4'),_0xfd5b('0x5'),_0xfd5b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfd5b('0x7')]},'keyType':{'type':Sequelize[_0xfd5b('0x2')](_0xfd5b('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfd5b('0x7')]},'idField':{'type':Sequelize[_0xfd5b('0x7')]},'nameField':{'type':Sequelize[_0xfd5b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfd5b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index b8aaada..e0835f8 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 _0xb7ce=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','error','stack','name','send','index','ZohoField','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','count','includeAll','include','findAll','then','rows','catch','params','filtears','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7ce,0x1a3));var _0xeb7c=function(_0x4fcd23,_0x399d59){_0x4fcd23=_0x4fcd23-0x0;var _0x521bb2=_0xb7ce[_0x4fcd23];return _0x521bb2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeb7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb7c('0x1'));var jsonpatch=require(_0xeb7c('0x2'));var rp=require(_0xeb7c('0x3'));var moment=require(_0xeb7c('0x4'));var BPromise=require(_0xeb7c('0x5'));var Mustache=require('mustache');var util=require(_0xeb7c('0x6'));var path=require(_0xeb7c('0x7'));var sox=require(_0xeb7c('0x8'));var csv=require(_0xeb7c('0x9'));var ejs=require(_0xeb7c('0xa'));var fs=require('fs');var _=require(_0xeb7c('0xb'));var squel=require(_0xeb7c('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb7c('0xd'));var deskjs=require(_0xeb7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb7c('0xf'));var Papa=require(_0xeb7c('0x10'));var Redis=require(_0xeb7c('0x11'));var authService=require(_0xeb7c('0x12'));var qs=require(_0xeb7c('0x13'));var as=require(_0xeb7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb7c('0x15'));var utils=require('../../config/utils');var config=require(_0xeb7c('0x16'));var licenseUtil=require(_0xeb7c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2daecc,_0xb26420){_0xb26420=_0xb26420||0xcc;return function(_0x280e13){if(_0x280e13){return _0x2daecc[_0xeb7c('0x18')](_0xb26420);}return _0x2daecc[_0xeb7c('0x19')](_0xb26420)[_0xeb7c('0x1a')]();};}function respondWithResult(_0x1c727b,_0x374317){_0x374317=_0x374317||0xc8;return function(_0x63c3d3){if(_0x63c3d3){return _0x1c727b[_0xeb7c('0x19')](_0x374317)[_0xeb7c('0x1b')](_0x63c3d3);}};}function respondWithFilteredResult(_0x3aafa4,_0x4cddce){return function(_0x289d39){if(_0x289d39){var _0x58b598=_0x289d39['count'],_0x44e1c9=_0x4cddce[_0xeb7c('0x1c')],_0x3fdd00=_0x4cddce[_0xeb7c('0x1c')]+_0x4cddce[_0xeb7c('0x1d')],_0x2d61b3;if(_0x3fdd00>=_0x58b598){_0x3fdd00=_0x58b598;_0x2d61b3=0xc8;}else{_0x2d61b3=0xce;}_0x3aafa4[_0xeb7c('0x19')](_0x2d61b3);return _0x3aafa4[_0xeb7c('0x1e')](_0xeb7c('0x1f'),_0x44e1c9+'-'+_0x3fdd00+'/'+_0x58b598)['json'](_0x289d39);}return null;};}function patchUpdates(_0x2c6b86){return function(_0x47d461){try{jsonpatch[_0xeb7c('0x20')](_0x47d461,_0x2c6b86,!![]);}catch(_0x334fa4){return BPromise[_0xeb7c('0x21')](_0x334fa4);}return _0x47d461['save']();};}function saveUpdates(_0x4009ad,_0x451f12){return function(_0x380ead){if(_0x380ead){return _0x380ead[_0xeb7c('0x22')](_0x4009ad)['then'](function(_0x224747){return _0x224747;});}return null;};}function removeEntity(_0x2e9b7f,_0xfcc8f0){return function(_0x983d57){if(_0x983d57){return _0x983d57['destroy']()['then'](function(){_0x2e9b7f[_0xeb7c('0x19')](0xcc)[_0xeb7c('0x1a')]();});}};}function handleEntityNotFound(_0x52102,_0x245fac){return function(_0x1a8946){if(!_0x1a8946){_0x52102[_0xeb7c('0x18')](0x194);}return _0x1a8946;};}function handleError(_0x3ceec6,_0x1513c8){_0x1513c8=_0x1513c8||0x1f4;return function(_0x2900e3){logger[_0xeb7c('0x23')](_0x2900e3[_0xeb7c('0x24')]);if(_0x2900e3[_0xeb7c('0x25')]){delete _0x2900e3[_0xeb7c('0x25')];}_0x3ceec6[_0xeb7c('0x19')](_0x1513c8)[_0xeb7c('0x26')](_0x2900e3);};}exports[_0xeb7c('0x27')]=function(_0x24d254,_0x79e769){var _0x39b8bb={},_0x1e02cc={},_0x3280df={'count':0x0,'rows':[]};var _0x2c2e00=_['map'](db[_0xeb7c('0x28')][_0xeb7c('0x29')],function(_0x197c38){return{'name':_0x197c38[_0xeb7c('0x2a')],'type':_0x197c38['type'][_0xeb7c('0x2b')]};});_0x1e02cc['model']=_[_0xeb7c('0x2c')](_0x2c2e00,_0xeb7c('0x25'));_0x1e02cc[_0xeb7c('0x2d')]=_[_0xeb7c('0x2e')](_0x24d254[_0xeb7c('0x2d')]);_0x1e02cc[_0xeb7c('0x2f')]=_['intersection'](_0x1e02cc[_0xeb7c('0x30')],_0x1e02cc['query']);_0x39b8bb[_0xeb7c('0x31')]=_[_0xeb7c('0x32')](_0x1e02cc['model'],qs[_0xeb7c('0x33')](_0x24d254[_0xeb7c('0x2d')][_0xeb7c('0x33')]));_0x39b8bb[_0xeb7c('0x31')]=_0x39b8bb['attributes'][_0xeb7c('0x34')]?_0x39b8bb['attributes']:_0x1e02cc[_0xeb7c('0x30')];if(!_0x24d254[_0xeb7c('0x2d')][_0xeb7c('0x35')](_0xeb7c('0x36'))){_0x39b8bb[_0xeb7c('0x1d')]=qs[_0xeb7c('0x1d')](_0x24d254[_0xeb7c('0x2d')][_0xeb7c('0x1d')]);_0x39b8bb['offset']=qs['offset'](_0x24d254['query'][_0xeb7c('0x1c')]);}_0x39b8bb['order']=qs[_0xeb7c('0x37')](_0x24d254['query'][_0xeb7c('0x37')]);_0x39b8bb[_0xeb7c('0x38')]=qs[_0xeb7c('0x2f')](_[_0xeb7c('0x39')](_0x24d254['query'],_0x1e02cc[_0xeb7c('0x2f')]),_0x2c2e00);if(_0x24d254['query'][_0xeb7c('0x3a')]){_0x39b8bb[_0xeb7c('0x38')]=_[_0xeb7c('0x3b')](_0x39b8bb[_0xeb7c('0x38')],{'$or':_['map'](_0x2c2e00,function(_0x3a9b15){if(_0x3a9b15['type']!=='VIRTUAL'){var _0xf1be6b={};_0xf1be6b[_0x3a9b15['name']]={'$like':'%'+_0x24d254[_0xeb7c('0x2d')][_0xeb7c('0x3a')]+'%'};return _0xf1be6b;}})});}_0x39b8bb=_[_0xeb7c('0x3b')]({},_0x39b8bb,_0x24d254['options']);var _0x40034c={'where':_0x39b8bb[_0xeb7c('0x38')]};return db[_0xeb7c('0x28')][_0xeb7c('0x3c')](_0x40034c)['then'](function(_0x3d7a12){_0x3280df['count']=_0x3d7a12;if(_0x24d254['query'][_0xeb7c('0x3d')]){_0x39b8bb[_0xeb7c('0x3e')]=[{'all':!![]}];}return db[_0xeb7c('0x28')][_0xeb7c('0x3f')](_0x39b8bb);})[_0xeb7c('0x40')](function(_0x34eefd){_0x3280df[_0xeb7c('0x41')]=_0x34eefd;return _0x3280df;})['then'](respondWithFilteredResult(_0x79e769,_0x39b8bb))[_0xeb7c('0x42')](handleError(_0x79e769,null));};exports['show']=function(_0x3aa0a0,_0x597e10){var _0x274562={'raw':!![],'where':{'id':_0x3aa0a0[_0xeb7c('0x43')]['id']}},_0x5a7651={};_0x5a7651[_0xeb7c('0x30')]=_['keys'](db[_0xeb7c('0x28')][_0xeb7c('0x29')]);_0x5a7651[_0xeb7c('0x2d')]=_[_0xeb7c('0x2e')](_0x3aa0a0[_0xeb7c('0x2d')]);_0x5a7651[_0xeb7c('0x44')]=_[_0xeb7c('0x32')](_0x5a7651['model'],_0x5a7651[_0xeb7c('0x2d')]);_0x274562[_0xeb7c('0x31')]=_['intersection'](_0x5a7651[_0xeb7c('0x30')],qs[_0xeb7c('0x33')](_0x3aa0a0[_0xeb7c('0x2d')]['fields']));_0x274562[_0xeb7c('0x31')]=_0x274562[_0xeb7c('0x31')][_0xeb7c('0x34')]?_0x274562[_0xeb7c('0x31')]:_0x5a7651[_0xeb7c('0x30')];if(_0x3aa0a0[_0xeb7c('0x2d')][_0xeb7c('0x3d')]){_0x274562[_0xeb7c('0x3e')]=[{'all':!![]}];}_0x274562=_[_0xeb7c('0x3b')]({},_0x274562,_0x3aa0a0['options']);return db[_0xeb7c('0x28')]['find'](_0x274562)[_0xeb7c('0x40')](handleEntityNotFound(_0x597e10,null))[_0xeb7c('0x40')](respondWithResult(_0x597e10,null))[_0xeb7c('0x42')](handleError(_0x597e10,null));};exports[_0xeb7c('0x45')]=function(_0x56f860,_0x3794c1){return db[_0xeb7c('0x28')][_0xeb7c('0x45')](_0x56f860[_0xeb7c('0x46')],{})[_0xeb7c('0x40')](respondWithResult(_0x3794c1,0xc9))[_0xeb7c('0x42')](handleError(_0x3794c1,null));};exports[_0xeb7c('0x22')]=function(_0x2a71d7,_0x28cc91){if(_0x2a71d7['body']['id']){delete _0x2a71d7[_0xeb7c('0x46')]['id'];}return db[_0xeb7c('0x28')]['find']({'where':{'id':_0x2a71d7[_0xeb7c('0x43')]['id']}})['then'](handleEntityNotFound(_0x28cc91,null))[_0xeb7c('0x40')](saveUpdates(_0x2a71d7['body'],null))['then'](respondWithResult(_0x28cc91,null))[_0xeb7c('0x42')](handleError(_0x28cc91,null));};exports['destroy']=function(_0x39c6f8,_0x5ec1d4){return db[_0xeb7c('0x28')][_0xeb7c('0x47')]({'where':{'id':_0x39c6f8['params']['id']}})[_0xeb7c('0x40')](handleEntityNotFound(_0x5ec1d4,null))[_0xeb7c('0x40')](removeEntity(_0x5ec1d4,null))[_0xeb7c('0x42')](handleError(_0x5ec1d4,null));}; \ No newline at end of file +var _0xcc5d=['count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ZohoField','includeAll','include','findAll','filtears','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xcc5d,0x111));var _0xdcc5=function(_0x58c7dc,_0x4a9dd8){_0x58c7dc=_0x58c7dc-0x0;var _0x315d22=_0xcc5d[_0x58c7dc];return _0x315d22;};'use strict';var pdf=require(_0xdcc5('0x0'));var emlformat=require(_0xdcc5('0x1'));var rimraf=require(_0xdcc5('0x2'));var zipdir=require(_0xdcc5('0x3'));var jsonpatch=require(_0xdcc5('0x4'));var rp=require(_0xdcc5('0x5'));var moment=require(_0xdcc5('0x6'));var BPromise=require(_0xdcc5('0x7'));var Mustache=require(_0xdcc5('0x8'));var util=require('util');var path=require('path');var sox=require(_0xdcc5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdcc5('0xa'));var squel=require('squel');var crypto=require(_0xdcc5('0xb'));var jsforce=require(_0xdcc5('0xc'));var deskjs=require(_0xdcc5('0xd'));var toCsv=require(_0xdcc5('0xe'));var querystring=require(_0xdcc5('0xf'));var Papa=require(_0xdcc5('0x10'));var Redis=require(_0xdcc5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdcc5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcc5('0x13'));var logger=require(_0xdcc5('0x14'))(_0xdcc5('0x15'));var utils=require('../../config/utils');var config=require(_0xdcc5('0x16'));var licenseUtil=require(_0xdcc5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ed9b0,_0x4f7909){_0x4f7909=_0x4f7909||0xcc;return function(_0x451a54){if(_0x451a54){return _0x4ed9b0['sendStatus'](_0x4f7909);}return _0x4ed9b0[_0xdcc5('0x18')](_0x4f7909)[_0xdcc5('0x19')]();};}function respondWithResult(_0x48dcc0,_0x3f47f7){_0x3f47f7=_0x3f47f7||0xc8;return function(_0x7999d4){if(_0x7999d4){return _0x48dcc0['status'](_0x3f47f7)[_0xdcc5('0x1a')](_0x7999d4);}};}function respondWithFilteredResult(_0x32fd4f,_0x3cedc8){return function(_0x4bd32b){if(_0x4bd32b){var _0x26e4ed=_0x4bd32b[_0xdcc5('0x1b')],_0x176634=_0x3cedc8[_0xdcc5('0x1c')],_0x420b43=_0x3cedc8[_0xdcc5('0x1c')]+_0x3cedc8[_0xdcc5('0x1d')],_0x2c2936;if(_0x420b43>=_0x26e4ed){_0x420b43=_0x26e4ed;_0x2c2936=0xc8;}else{_0x2c2936=0xce;}_0x32fd4f[_0xdcc5('0x18')](_0x2c2936);return _0x32fd4f[_0xdcc5('0x1e')](_0xdcc5('0x1f'),_0x176634+'-'+_0x420b43+'/'+_0x26e4ed)['json'](_0x4bd32b);}return null;};}function patchUpdates(_0xb807cf){return function(_0xe3cd8f){try{jsonpatch[_0xdcc5('0x20')](_0xe3cd8f,_0xb807cf,!![]);}catch(_0x525113){return BPromise[_0xdcc5('0x21')](_0x525113);}return _0xe3cd8f[_0xdcc5('0x22')]();};}function saveUpdates(_0x4e410e,_0x3fb79a){return function(_0x214853){if(_0x214853){return _0x214853[_0xdcc5('0x23')](_0x4e410e)['then'](function(_0x12d6fd){return _0x12d6fd;});}return null;};}function removeEntity(_0x51139e,_0x436d67){return function(_0x28e3c7){if(_0x28e3c7){return _0x28e3c7[_0xdcc5('0x24')]()[_0xdcc5('0x25')](function(){_0x51139e[_0xdcc5('0x18')](0xcc)[_0xdcc5('0x19')]();});}};}function handleEntityNotFound(_0x307602,_0x1a2af6){return function(_0x384fb3){if(!_0x384fb3){_0x307602[_0xdcc5('0x26')](0x194);}return _0x384fb3;};}function handleError(_0x39a383,_0xe8e06c){_0xe8e06c=_0xe8e06c||0x1f4;return function(_0x3d49b5){logger[_0xdcc5('0x27')](_0x3d49b5[_0xdcc5('0x28')]);if(_0x3d49b5[_0xdcc5('0x29')]){delete _0x3d49b5[_0xdcc5('0x29')];}_0x39a383[_0xdcc5('0x18')](_0xe8e06c)[_0xdcc5('0x2a')](_0x3d49b5);};}exports['index']=function(_0x57eff7,_0x4e0a97){var _0x3ff5ea={},_0x234fe5={},_0x24afae={'count':0x0,'rows':[]};var _0x46eac7=_['map'](db['ZohoField'][_0xdcc5('0x2b')],function(_0x3e95b1){return{'name':_0x3e95b1[_0xdcc5('0x2c')],'type':_0x3e95b1['type'][_0xdcc5('0x2d')]};});_0x234fe5[_0xdcc5('0x2e')]=_[_0xdcc5('0x2f')](_0x46eac7,_0xdcc5('0x29'));_0x234fe5['query']=_[_0xdcc5('0x30')](_0x57eff7[_0xdcc5('0x31')]);_0x234fe5[_0xdcc5('0x32')]=_[_0xdcc5('0x33')](_0x234fe5['model'],_0x234fe5['query']);_0x3ff5ea[_0xdcc5('0x34')]=_[_0xdcc5('0x33')](_0x234fe5[_0xdcc5('0x2e')],qs[_0xdcc5('0x35')](_0x57eff7['query']['fields']));_0x3ff5ea[_0xdcc5('0x34')]=_0x3ff5ea[_0xdcc5('0x34')][_0xdcc5('0x36')]?_0x3ff5ea[_0xdcc5('0x34')]:_0x234fe5[_0xdcc5('0x2e')];if(!_0x57eff7[_0xdcc5('0x31')][_0xdcc5('0x37')](_0xdcc5('0x38'))){_0x3ff5ea['limit']=qs[_0xdcc5('0x1d')](_0x57eff7['query']['limit']);_0x3ff5ea[_0xdcc5('0x1c')]=qs[_0xdcc5('0x1c')](_0x57eff7[_0xdcc5('0x31')][_0xdcc5('0x1c')]);}_0x3ff5ea[_0xdcc5('0x39')]=qs['sort'](_0x57eff7['query'][_0xdcc5('0x3a')]);_0x3ff5ea[_0xdcc5('0x3b')]=qs[_0xdcc5('0x32')](_[_0xdcc5('0x3c')](_0x57eff7[_0xdcc5('0x31')],_0x234fe5[_0xdcc5('0x32')]),_0x46eac7);if(_0x57eff7[_0xdcc5('0x31')][_0xdcc5('0x3d')]){_0x3ff5ea['where']=_[_0xdcc5('0x3e')](_0x3ff5ea[_0xdcc5('0x3b')],{'$or':_[_0xdcc5('0x2f')](_0x46eac7,function(_0x1c8336){if(_0x1c8336['type']!==_0xdcc5('0x3f')){var _0x79f77b={};_0x79f77b[_0x1c8336['name']]={'$like':'%'+_0x57eff7[_0xdcc5('0x31')][_0xdcc5('0x3d')]+'%'};return _0x79f77b;}})});}_0x3ff5ea=_[_0xdcc5('0x3e')]({},_0x3ff5ea,_0x57eff7['options']);var _0x18efe6={'where':_0x3ff5ea[_0xdcc5('0x3b')]};return db[_0xdcc5('0x40')][_0xdcc5('0x1b')](_0x18efe6)[_0xdcc5('0x25')](function(_0x44e162){_0x24afae['count']=_0x44e162;if(_0x57eff7[_0xdcc5('0x31')][_0xdcc5('0x41')]){_0x3ff5ea[_0xdcc5('0x42')]=[{'all':!![]}];}return db[_0xdcc5('0x40')][_0xdcc5('0x43')](_0x3ff5ea);})[_0xdcc5('0x25')](function(_0x4ea224){_0x24afae['rows']=_0x4ea224;return _0x24afae;})['then'](respondWithFilteredResult(_0x4e0a97,_0x3ff5ea))['catch'](handleError(_0x4e0a97,null));};exports['show']=function(_0x113f34,_0x4512b4){var _0x5d887f={'raw':!![],'where':{'id':_0x113f34['params']['id']}},_0x426625={};_0x426625[_0xdcc5('0x2e')]=_[_0xdcc5('0x30')](db[_0xdcc5('0x40')][_0xdcc5('0x2b')]);_0x426625[_0xdcc5('0x31')]=_[_0xdcc5('0x30')](_0x113f34[_0xdcc5('0x31')]);_0x426625[_0xdcc5('0x44')]=_[_0xdcc5('0x33')](_0x426625[_0xdcc5('0x2e')],_0x426625[_0xdcc5('0x31')]);_0x5d887f[_0xdcc5('0x34')]=_[_0xdcc5('0x33')](_0x426625['model'],qs[_0xdcc5('0x35')](_0x113f34[_0xdcc5('0x31')][_0xdcc5('0x35')]));_0x5d887f['attributes']=_0x5d887f[_0xdcc5('0x34')]['length']?_0x5d887f[_0xdcc5('0x34')]:_0x426625['model'];if(_0x113f34[_0xdcc5('0x31')][_0xdcc5('0x41')]){_0x5d887f[_0xdcc5('0x42')]=[{'all':!![]}];}_0x5d887f=_[_0xdcc5('0x3e')]({},_0x5d887f,_0x113f34[_0xdcc5('0x45')]);return db[_0xdcc5('0x40')][_0xdcc5('0x46')](_0x5d887f)[_0xdcc5('0x25')](handleEntityNotFound(_0x4512b4,null))['then'](respondWithResult(_0x4512b4,null))['catch'](handleError(_0x4512b4,null));};exports['create']=function(_0xf1d212,_0x4a4dd2){return db[_0xdcc5('0x40')][_0xdcc5('0x47')](_0xf1d212[_0xdcc5('0x48')],{})[_0xdcc5('0x25')](respondWithResult(_0x4a4dd2,0xc9))[_0xdcc5('0x49')](handleError(_0x4a4dd2,null));};exports[_0xdcc5('0x23')]=function(_0xb91e86,_0x3a3a64){if(_0xb91e86[_0xdcc5('0x48')]['id']){delete _0xb91e86['body']['id'];}return db[_0xdcc5('0x40')][_0xdcc5('0x46')]({'where':{'id':_0xb91e86[_0xdcc5('0x4a')]['id']}})[_0xdcc5('0x25')](handleEntityNotFound(_0x3a3a64,null))[_0xdcc5('0x25')](saveUpdates(_0xb91e86[_0xdcc5('0x48')],null))[_0xdcc5('0x25')](respondWithResult(_0x3a3a64,null))[_0xdcc5('0x49')](handleError(_0x3a3a64,null));};exports[_0xdcc5('0x24')]=function(_0x382fc6,_0x59d8bd){return db['ZohoField'][_0xdcc5('0x46')]({'where':{'id':_0x382fc6[_0xdcc5('0x4a')]['id']}})[_0xdcc5('0x25')](handleEntityNotFound(_0x59d8bd,null))['then'](removeEntity(_0x59d8bd,null))['catch'](handleError(_0x59d8bd,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 23eca48..3c748df 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 _0xe952=['int_zoho_fields','idField','FieldId','util','../../config/logger','api','moment','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x566816,_0x73fea5){var _0x36719c=function(_0x4cb076){while(--_0x4cb076){_0x566816['push'](_0x566816['shift']());}};_0x36719c(++_0x73fea5);}(_0xe952,0x85));var _0x2e95=function(_0x23e9b3,_0x53367f){_0x23e9b3=_0x23e9b3-0x0;var _0x3d3d82=_0xe952[_0x23e9b3];return _0x3d3d82;};'use strict';var _=require('lodash');var util=require(_0x2e95('0x0'));var logger=require(_0x2e95('0x1'))(_0x2e95('0x2'));var moment=require(_0x2e95('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e95('0x4'));var rimraf=require('rimraf');var config=require(_0x2e95('0x5'));var attributes=require(_0x2e95('0x6'));module[_0x2e95('0x7')]=function(_0x31b0c6,_0x3c7ecd){return _0x31b0c6[_0x2e95('0x8')](_0x2e95('0x9'),attributes,{'tableName':_0x2e95('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x2e95('0xb'),_0x2e95('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3894=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3894,0x80));var _0x4389=function(_0x41cc3f,_0x2678a2){_0x41cc3f=_0x41cc3f-0x0;var _0x47ff58=_0x3894[_0x41cc3f];return _0x47ff58;};'use strict';var _=require(_0x4389('0x0'));var util=require('util');var logger=require(_0x4389('0x1'))(_0x4389('0x2'));var moment=require(_0x4389('0x3'));var BPromise=require(_0x4389('0x4'));var rp=require(_0x4389('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4389('0x6'));var config=require(_0x4389('0x7'));var attributes=require(_0x4389('0x8'));module[_0x4389('0x9')]=function(_0x1eab69,_0x11aac1){return _0x1eab69[_0x4389('0xa')](_0x4389('0xb'),attributes,{'tableName':_0x4389('0xc'),'paranoid':![],'indexes':[{'name':_0x4389('0xd'),'fields':[_0x4389('0xe'),_0x4389('0xf')],'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 d05a599..8f2ecb6 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 _0x0a9a=['ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x0a9a,0x183));var _0xa0a9=function(_0x568808,_0x419f81){_0x568808=_0x568808-0x0;var _0x32aa35=_0x0a9a[_0x568808];return _0x32aa35;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var moment=require('moment');var BPromise=require(_0xa0a9('0x1'));var rs=require(_0xa0a9('0x2'));var fs=require('fs');var Redis=require(_0xa0a9('0x3'));var db=require(_0xa0a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa0a9('0x5'))(_0xa0a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xa0a9('0x7'));var client=jayson[_0xa0a9('0x8')][_0xa0a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31d689,_0x499a29,_0x2b2eb4){return new BPromise(function(_0x520f42,_0x10aa8a){return client[_0xa0a9('0xa')](_0x31d689,_0x2b2eb4)[_0xa0a9('0xb')](function(_0x2d6ac0){logger['info'](_0xa0a9('0xc'),_0x499a29,_0xa0a9('0xd'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x499a29,_0xa0a9('0xd'),JSON[_0xa0a9('0xe')](_0x2d6ac0));if(_0x2d6ac0['error']){if(_0x2d6ac0[_0xa0a9('0xf')]['code']===0x1f4){logger[_0xa0a9('0xf')]('ZohoField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x10aa8a(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}logger[_0xa0a9('0xf')]('ZohoField,\x20%s,\x20%s',_0x499a29,_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);return _0x520f42(_0x2d6ac0[_0xa0a9('0xf')][_0xa0a9('0x10')]);}else{logger[_0xa0a9('0x11')](_0xa0a9('0xc'),_0x499a29,'request\x20sent');_0x520f42(_0x2d6ac0[_0xa0a9('0x12')]['message']);}})['catch'](function(_0x347092){logger[_0xa0a9('0xf')](_0xa0a9('0xc'),_0x499a29,_0x347092);_0x10aa8a(_0x347092);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x27ce0b,_0x44aeb9){var _0x11e23c=function(_0x43432c){while(--_0x43432c){_0x27ce0b['push'](_0x27ce0b['shift']());}};_0x11e23c(++_0x44aeb9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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']('ZohoField,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index e8d65d4..f5eb83d 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 _0x30a7=['../../config/environment','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2bec06,_0x2673b6){var _0x19e09b=function(_0x1432c8){while(--_0x1432c8){_0x2bec06['push'](_0x2bec06['shift']());}};_0x19e09b(++_0x2673b6);}(_0x30a7,0xf1));var _0x730a=function(_0x3df748,_0x363fdd){_0x3df748=_0x3df748-0x0;var _0x268636=_0x30a7[_0x3df748];return _0x268636;};'use strict';var multer=require('multer');var util=require(_0x730a('0x0'));var path=require(_0x730a('0x1'));var timeout=require(_0x730a('0x2'));var express=require(_0x730a('0x3'));var router=express['Router']();var auth=require(_0x730a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x730a('0x5'));module['exports']=router; \ No newline at end of file +var _0xd159=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x39c7a9,_0x386d03){var _0xb4ed65=function(_0x315fb6){while(--_0x315fb6){_0x39c7a9['push'](_0x39c7a9['shift']());}};_0xb4ed65(++_0x386d03);}(_0xd159,0x169));var _0x9d15=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd159[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x9d15('0x0'));var util=require(_0x9d15('0x1'));var path=require(_0x9d15('0x2'));var timeout=require(_0x9d15('0x3'));var express=require(_0x9d15('0x4'));var router=express[_0x9d15('0x5')]();var auth=require(_0x9d15('0x6'));var interaction=require(_0x9d15('0x7'));var config=require(_0x9d15('0x8'));module[_0x9d15('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 ad7210c..c3ec69d 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 _0x43f5=['BOOLEAN','state','STRING','unique_name_and_version','INTEGER'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x43f5,0x1bf));var _0x543f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x43f5[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x543f('0x0')],'allowNull':![],'unique':_0x543f('0x1')},'version':{'type':Sequelize[_0x543f('0x0')],'allowNull':![],'unique':_0x543f('0x1')},'main':{'type':Sequelize[_0x543f('0x0')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x543f('0x0')]},'path':{'type':Sequelize[_0x543f('0x0')]},'type':{'type':Sequelize[_0x543f('0x0')]},'size':{'type':Sequelize[_0x543f('0x2')]},'active':{'type':Sequelize[_0x543f('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x543f('0x0')]},'logo':{'type':Sequelize[_0x543f('0x0')]},'state':{'type':Sequelize[_0x543f('0x0')],'unique':_0x543f('0x4')},'description':{'type':Sequelize[_0x543f('0x0')]},'title':{'type':Sequelize[_0x543f('0x0')]},'remoteUri':{'type':Sequelize[_0x543f('0x0')]},'link':{'type':Sequelize[_0x543f('0x0')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa887=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x4c28d2,_0x2b8273){var _0x1299b8=function(_0x15c356){while(--_0x15c356){_0x4c28d2['push'](_0x4c28d2['shift']());}};_0x1299b8(++_0x2b8273);}(_0xa887,0xfd));var _0x7a88=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa887[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7a88('0x0'));module[_0x7a88('0x1')]={'name':{'type':Sequelize[_0x7a88('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x7a88('0x2')],'allowNull':![],'unique':_0x7a88('0x3')},'main':{'type':Sequelize[_0x7a88('0x2')],'defaultValue':_0x7a88('0x4')},'filename':{'type':Sequelize[_0x7a88('0x2')]},'path':{'type':Sequelize[_0x7a88('0x2')]},'type':{'type':Sequelize[_0x7a88('0x2')]},'size':{'type':Sequelize[_0x7a88('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x7a88('0x2')]},'logo':{'type':Sequelize[_0x7a88('0x2')]},'state':{'type':Sequelize[_0x7a88('0x2')],'unique':_0x7a88('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x7a88('0x2')]},'remoteUri':{'type':Sequelize[_0x7a88('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c84df87..570cd99 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 _0xd3c2=['fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','Integration','findAll','rows','catch','show','filtears','create','update','body','find','params','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','then','destroy','stack','name','send','index','map','rawAttributes'];(function(_0x11aa8e,_0x1e2829){var _0x4f940f=function(_0x9f2ffa){while(--_0x9f2ffa){_0x11aa8e['push'](_0x11aa8e['shift']());}};_0x4f940f(++_0x1e2829);}(_0xd3c2,0x1e4));var _0x2d3c=function(_0x1a9b21,_0x2a568e){_0x1a9b21=_0x1a9b21-0x0;var _0x35d5f0=_0xd3c2[_0x1a9b21];return _0x35d5f0;};'use strict';var pdf=require(_0x2d3c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d3c('0x1'));var jsonpatch=require(_0x2d3c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2d3c('0x3'));var Mustache=require(_0x2d3c('0x4'));var util=require('util');var path=require(_0x2d3c('0x5'));var sox=require('sox');var csv=require(_0x2d3c('0x6'));var ejs=require(_0x2d3c('0x7'));var fs=require('fs');var _=require(_0x2d3c('0x8'));var squel=require(_0x2d3c('0x9'));var crypto=require(_0x2d3c('0xa'));var jsforce=require(_0x2d3c('0xb'));var deskjs=require(_0x2d3c('0xc'));var toCsv=require(_0x2d3c('0x6'));var querystring=require(_0x2d3c('0xd'));var Papa=require('papaparse');var Redis=require(_0x2d3c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2d3c('0xf'));var as=require(_0x2d3c('0x10'));var hardwareService=require(_0x2d3c('0x11'));var logger=require('../../config/logger')(_0x2d3c('0x12'));var utils=require(_0x2d3c('0x13'));var config=require(_0x2d3c('0x14'));var licenseUtil=require(_0x2d3c('0x15'));var db=require(_0x2d3c('0x16'))['db'];function respondWithStatusCode(_0x115fb9,_0x3597dd){_0x3597dd=_0x3597dd||0xcc;return function(_0x402672){if(_0x402672){return _0x115fb9[_0x2d3c('0x17')](_0x3597dd);}return _0x115fb9[_0x2d3c('0x18')](_0x3597dd)[_0x2d3c('0x19')]();};}function respondWithResult(_0x373701,_0x487bbe){_0x487bbe=_0x487bbe||0xc8;return function(_0x45761b){if(_0x45761b){return _0x373701['status'](_0x487bbe)[_0x2d3c('0x1a')](_0x45761b);}};}function respondWithFilteredResult(_0x34a37f,_0x11840b){return function(_0x2250f8){if(_0x2250f8){var _0xcdcfc3=_0x2250f8[_0x2d3c('0x1b')],_0x33c255=_0x11840b[_0x2d3c('0x1c')],_0x1c03f9=_0x11840b[_0x2d3c('0x1c')]+_0x11840b[_0x2d3c('0x1d')],_0x546c64;if(_0x1c03f9>=_0xcdcfc3){_0x1c03f9=_0xcdcfc3;_0x546c64=0xc8;}else{_0x546c64=0xce;}_0x34a37f[_0x2d3c('0x18')](_0x546c64);return _0x34a37f[_0x2d3c('0x1e')]('Content-Range',_0x33c255+'-'+_0x1c03f9+'/'+_0xcdcfc3)[_0x2d3c('0x1a')](_0x2250f8);}return null;};}function patchUpdates(_0x479ca9){return function(_0x12e862){try{jsonpatch[_0x2d3c('0x1f')](_0x12e862,_0x479ca9,!![]);}catch(_0x57230a){return BPromise['reject'](_0x57230a);}return _0x12e862[_0x2d3c('0x20')]();};}function saveUpdates(_0x48a55e,_0x5707f6){return function(_0x545d16){if(_0x545d16){return _0x545d16['update'](_0x48a55e)[_0x2d3c('0x21')](function(_0x3db6b6){return _0x3db6b6;});}return null;};}function removeEntity(_0x56a12f,_0x402c3e){return function(_0x4d5a20){if(_0x4d5a20){return _0x4d5a20[_0x2d3c('0x22')]()['then'](function(){_0x56a12f[_0x2d3c('0x18')](0xcc)[_0x2d3c('0x19')]();});}};}function handleEntityNotFound(_0x4845de,_0x281c1e){return function(_0x235e8f){if(!_0x235e8f){_0x4845de[_0x2d3c('0x17')](0x194);}return _0x235e8f;};}function handleError(_0x171213,_0x42296f){_0x42296f=_0x42296f||0x1f4;return function(_0xf77060){logger['error'](_0xf77060[_0x2d3c('0x23')]);if(_0xf77060[_0x2d3c('0x24')]){delete _0xf77060[_0x2d3c('0x24')];}_0x171213[_0x2d3c('0x18')](_0x42296f)[_0x2d3c('0x25')](_0xf77060);};}exports[_0x2d3c('0x26')]=function(_0x52e980,_0x4dbc17){var _0x1568c0={},_0x1eab99={},_0x2b8656={'count':0x0,'rows':[]};var _0x53a752=_[_0x2d3c('0x27')](db['Integration'][_0x2d3c('0x28')],function(_0x5bcf85){return{'name':_0x5bcf85[_0x2d3c('0x29')],'type':_0x5bcf85[_0x2d3c('0x2a')][_0x2d3c('0x2b')]};});_0x1eab99['model']=_[_0x2d3c('0x27')](_0x53a752,_0x2d3c('0x24'));_0x1eab99[_0x2d3c('0x2c')]=_[_0x2d3c('0x2d')](_0x52e980[_0x2d3c('0x2c')]);_0x1eab99[_0x2d3c('0x2e')]=_[_0x2d3c('0x2f')](_0x1eab99['model'],_0x1eab99[_0x2d3c('0x2c')]);_0x1568c0[_0x2d3c('0x30')]=_[_0x2d3c('0x2f')](_0x1eab99[_0x2d3c('0x31')],qs['fields'](_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x32')]));_0x1568c0[_0x2d3c('0x30')]=_0x1568c0['attributes'][_0x2d3c('0x33')]?_0x1568c0[_0x2d3c('0x30')]:_0x1eab99[_0x2d3c('0x31')];if(!_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x34')](_0x2d3c('0x35'))){_0x1568c0['limit']=qs[_0x2d3c('0x1d')](_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x1d')]);_0x1568c0['offset']=qs[_0x2d3c('0x1c')](_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x1c')]);}_0x1568c0[_0x2d3c('0x36')]=qs[_0x2d3c('0x37')](_0x52e980['query'][_0x2d3c('0x37')]);_0x1568c0[_0x2d3c('0x38')]=qs[_0x2d3c('0x2e')](_[_0x2d3c('0x39')](_0x52e980['query'],_0x1eab99[_0x2d3c('0x2e')]),_0x53a752);if(_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x3a')]){_0x1568c0[_0x2d3c('0x38')]=_['merge'](_0x1568c0[_0x2d3c('0x38')],{'$or':_[_0x2d3c('0x27')](_0x53a752,function(_0xb027b6){if(_0xb027b6[_0x2d3c('0x2a')]!==_0x2d3c('0x3b')){var _0x4c0673={};_0x4c0673[_0xb027b6['name']]={'$like':'%'+_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x3a')]+'%'};return _0x4c0673;}})});}_0x1568c0=_[_0x2d3c('0x3c')]({},_0x1568c0,_0x52e980[_0x2d3c('0x3d')]);var _0x2b250d={'where':_0x1568c0['where']};return db['Integration'][_0x2d3c('0x1b')](_0x2b250d)['then'](function(_0x20b345){_0x2b8656[_0x2d3c('0x1b')]=_0x20b345;if(_0x52e980[_0x2d3c('0x2c')][_0x2d3c('0x3e')]){_0x1568c0[_0x2d3c('0x3f')]=[{'all':!![]}];}return db[_0x2d3c('0x40')][_0x2d3c('0x41')](_0x1568c0);})[_0x2d3c('0x21')](function(_0x7c6c0){_0x2b8656[_0x2d3c('0x42')]=_0x7c6c0;return _0x2b8656;})[_0x2d3c('0x21')](respondWithFilteredResult(_0x4dbc17,_0x1568c0))[_0x2d3c('0x43')](handleError(_0x4dbc17,null));};exports[_0x2d3c('0x44')]=function(_0x185385,_0x2a90e2){var _0x513fe3={'raw':![],'where':{'id':_0x185385['params']['id']}},_0x3f8480={};_0x3f8480[_0x2d3c('0x31')]=_[_0x2d3c('0x2d')](db['Integration'][_0x2d3c('0x28')]);_0x3f8480[_0x2d3c('0x2c')]=_[_0x2d3c('0x2d')](_0x185385[_0x2d3c('0x2c')]);_0x3f8480[_0x2d3c('0x45')]=_[_0x2d3c('0x2f')](_0x3f8480[_0x2d3c('0x31')],_0x3f8480[_0x2d3c('0x2c')]);_0x513fe3[_0x2d3c('0x30')]=_[_0x2d3c('0x2f')](_0x3f8480['model'],qs[_0x2d3c('0x32')](_0x185385[_0x2d3c('0x2c')][_0x2d3c('0x32')]));_0x513fe3['attributes']=_0x513fe3[_0x2d3c('0x30')][_0x2d3c('0x33')]?_0x513fe3[_0x2d3c('0x30')]:_0x3f8480[_0x2d3c('0x31')];if(_0x185385[_0x2d3c('0x2c')]['includeAll']){_0x513fe3[_0x2d3c('0x3f')]=[{'all':!![]}];}_0x513fe3=_[_0x2d3c('0x3c')]({},_0x513fe3,_0x185385[_0x2d3c('0x3d')]);return db['Integration']['find'](_0x513fe3)[_0x2d3c('0x21')](handleEntityNotFound(_0x2a90e2,null))['then'](respondWithResult(_0x2a90e2,null))[_0x2d3c('0x43')](handleError(_0x2a90e2,null));};exports[_0x2d3c('0x46')]=function(_0x4e1342,_0x58947f){return db['Integration'][_0x2d3c('0x46')](_0x4e1342['body'],{})[_0x2d3c('0x21')](respondWithResult(_0x58947f,0xc9))[_0x2d3c('0x43')](handleError(_0x58947f,null));};exports[_0x2d3c('0x47')]=function(_0x5cc7ae,_0x78bfc8){if(_0x5cc7ae[_0x2d3c('0x48')]['id']){delete _0x5cc7ae[_0x2d3c('0x48')]['id'];}return db[_0x2d3c('0x40')][_0x2d3c('0x49')]({'where':{'id':_0x5cc7ae[_0x2d3c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x78bfc8,null))['then'](saveUpdates(_0x5cc7ae[_0x2d3c('0x48')],null))[_0x2d3c('0x21')](respondWithResult(_0x78bfc8,null))[_0x2d3c('0x43')](handleError(_0x78bfc8,null));};exports[_0x2d3c('0x22')]=function(_0x28e4e3,_0x58ac7f){return db['Integration'][_0x2d3c('0x49')]({'where':{'id':_0x28e4e3['params']['id']}})['then'](handleEntityNotFound(_0x58ac7f,null))[_0x2d3c('0x21')](removeEntity(_0x58ac7f,null))[_0x2d3c('0x43')](handleError(_0x58ac7f,null));}; \ No newline at end of file +var _0x1210=['body','find','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','index','map','Integration','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','rawAttributes','filtears','includeAll','create'];(function(_0x2234cc,_0x45708a){var _0x2b1187=function(_0x48d038){while(--_0x48d038){_0x2234cc['push'](_0x2234cc['shift']());}};_0x2b1187(++_0x45708a);}(_0x1210,0x188));var _0x0121=function(_0x127783,_0x258715){_0x127783=_0x127783-0x0;var _0x14f298=_0x1210[_0x127783];return _0x14f298;};'use strict';var pdf=require(_0x0121('0x0'));var emlformat=require(_0x0121('0x1'));var rimraf=require(_0x0121('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0121('0x3'));var rp=require(_0x0121('0x4'));var moment=require(_0x0121('0x5'));var BPromise=require(_0x0121('0x6'));var Mustache=require(_0x0121('0x7'));var util=require(_0x0121('0x8'));var path=require(_0x0121('0x9'));var sox=require(_0x0121('0xa'));var csv=require(_0x0121('0xb'));var ejs=require(_0x0121('0xc'));var fs=require('fs');var _=require(_0x0121('0xd'));var squel=require(_0x0121('0xe'));var crypto=require(_0x0121('0xf'));var jsforce=require(_0x0121('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0121('0x11'));var Papa=require(_0x0121('0x12'));var Redis=require('ioredis');var authService=require(_0x0121('0x13'));var qs=require(_0x0121('0x14'));var as=require(_0x0121('0x15'));var hardwareService=require(_0x0121('0x16'));var logger=require('../../config/logger')(_0x0121('0x17'));var utils=require(_0x0121('0x18'));var config=require(_0x0121('0x19'));var licenseUtil=require(_0x0121('0x1a'));var db=require(_0x0121('0x1b'))['db'];function respondWithStatusCode(_0x25c7b1,_0x5b41d7){_0x5b41d7=_0x5b41d7||0xcc;return function(_0x46caa7){if(_0x46caa7){return _0x25c7b1[_0x0121('0x1c')](_0x5b41d7);}return _0x25c7b1[_0x0121('0x1d')](_0x5b41d7)['end']();};}function respondWithResult(_0x4e7c9d,_0x1e8f9e){_0x1e8f9e=_0x1e8f9e||0xc8;return function(_0x3a2539){if(_0x3a2539){return _0x4e7c9d[_0x0121('0x1d')](_0x1e8f9e)['json'](_0x3a2539);}};}function respondWithFilteredResult(_0x102989,_0x28c6ea){return function(_0x511f01){if(_0x511f01){var _0x38404c=_0x511f01[_0x0121('0x1e')],_0x2f32f4=_0x28c6ea[_0x0121('0x1f')],_0x1c556f=_0x28c6ea[_0x0121('0x1f')]+_0x28c6ea['limit'],_0x2ffd17;if(_0x1c556f>=_0x38404c){_0x1c556f=_0x38404c;_0x2ffd17=0xc8;}else{_0x2ffd17=0xce;}_0x102989['status'](_0x2ffd17);return _0x102989[_0x0121('0x20')](_0x0121('0x21'),_0x2f32f4+'-'+_0x1c556f+'/'+_0x38404c)[_0x0121('0x22')](_0x511f01);}return null;};}function patchUpdates(_0x479f85){return function(_0x461374){try{jsonpatch[_0x0121('0x23')](_0x461374,_0x479f85,!![]);}catch(_0x2f10a7){return BPromise['reject'](_0x2f10a7);}return _0x461374[_0x0121('0x24')]();};}function saveUpdates(_0x17aefa,_0x4dbeea){return function(_0x302067){if(_0x302067){return _0x302067[_0x0121('0x25')](_0x17aefa)[_0x0121('0x26')](function(_0x25f152){return _0x25f152;});}return null;};}function removeEntity(_0x688472,_0x384a60){return function(_0x492aa0){if(_0x492aa0){return _0x492aa0[_0x0121('0x27')]()[_0x0121('0x26')](function(){_0x688472[_0x0121('0x1d')](0xcc)[_0x0121('0x28')]();});}};}function handleEntityNotFound(_0x4d1cf3,_0x47c9d2){return function(_0x38d901){if(!_0x38d901){_0x4d1cf3[_0x0121('0x1c')](0x194);}return _0x38d901;};}function handleError(_0x58304d,_0x29ce84){_0x29ce84=_0x29ce84||0x1f4;return function(_0x1f2cbe){logger[_0x0121('0x29')](_0x1f2cbe[_0x0121('0x2a')]);if(_0x1f2cbe[_0x0121('0x2b')]){delete _0x1f2cbe[_0x0121('0x2b')];}_0x58304d['status'](_0x29ce84)['send'](_0x1f2cbe);};}exports[_0x0121('0x2c')]=function(_0x59e6db,_0x2778bd){var _0x4cba17={},_0x286aaa={},_0x33115f={'count':0x0,'rows':[]};var _0xb7486c=_[_0x0121('0x2d')](db[_0x0121('0x2e')]['rawAttributes'],function(_0x3385cc){return{'name':_0x3385cc[_0x0121('0x2f')],'type':_0x3385cc[_0x0121('0x30')][_0x0121('0x31')]};});_0x286aaa[_0x0121('0x32')]=_['map'](_0xb7486c,_0x0121('0x2b'));_0x286aaa['query']=_[_0x0121('0x33')](_0x59e6db['query']);_0x286aaa[_0x0121('0x34')]=_[_0x0121('0x35')](_0x286aaa[_0x0121('0x32')],_0x286aaa[_0x0121('0x36')]);_0x4cba17[_0x0121('0x37')]=_['intersection'](_0x286aaa['model'],qs[_0x0121('0x38')](_0x59e6db['query'][_0x0121('0x38')]));_0x4cba17[_0x0121('0x37')]=_0x4cba17[_0x0121('0x37')][_0x0121('0x39')]?_0x4cba17[_0x0121('0x37')]:_0x286aaa[_0x0121('0x32')];if(!_0x59e6db['query'][_0x0121('0x3a')]('nolimit')){_0x4cba17[_0x0121('0x3b')]=qs['limit'](_0x59e6db[_0x0121('0x36')][_0x0121('0x3b')]);_0x4cba17[_0x0121('0x1f')]=qs[_0x0121('0x1f')](_0x59e6db[_0x0121('0x36')][_0x0121('0x1f')]);}_0x4cba17[_0x0121('0x3c')]=qs[_0x0121('0x3d')](_0x59e6db[_0x0121('0x36')][_0x0121('0x3d')]);_0x4cba17[_0x0121('0x3e')]=qs['filters'](_[_0x0121('0x3f')](_0x59e6db[_0x0121('0x36')],_0x286aaa['filters']),_0xb7486c);if(_0x59e6db[_0x0121('0x36')][_0x0121('0x40')]){_0x4cba17[_0x0121('0x3e')]=_[_0x0121('0x41')](_0x4cba17['where'],{'$or':_[_0x0121('0x2d')](_0xb7486c,function(_0x28c541){if(_0x28c541[_0x0121('0x30')]!==_0x0121('0x42')){var _0x58fa92={};_0x58fa92[_0x28c541[_0x0121('0x2b')]]={'$like':'%'+_0x59e6db[_0x0121('0x36')][_0x0121('0x40')]+'%'};return _0x58fa92;}})});}_0x4cba17=_[_0x0121('0x41')]({},_0x4cba17,_0x59e6db[_0x0121('0x43')]);var _0x254364={'where':_0x4cba17['where']};return db[_0x0121('0x2e')][_0x0121('0x1e')](_0x254364)[_0x0121('0x26')](function(_0x1bab28){_0x33115f[_0x0121('0x1e')]=_0x1bab28;if(_0x59e6db['query']['includeAll']){_0x4cba17[_0x0121('0x44')]=[{'all':!![]}];}return db[_0x0121('0x2e')]['findAll'](_0x4cba17);})[_0x0121('0x26')](function(_0xf8575d){_0x33115f[_0x0121('0x45')]=_0xf8575d;return _0x33115f;})[_0x0121('0x26')](respondWithFilteredResult(_0x2778bd,_0x4cba17))[_0x0121('0x46')](handleError(_0x2778bd,null));};exports['show']=function(_0x1b95b8,_0x48dee){var _0x5cab9b={'raw':![],'where':{'id':_0x1b95b8[_0x0121('0x47')]['id']}},_0x3138d8={};_0x3138d8[_0x0121('0x32')]=_[_0x0121('0x33')](db[_0x0121('0x2e')][_0x0121('0x48')]);_0x3138d8['query']=_[_0x0121('0x33')](_0x1b95b8[_0x0121('0x36')]);_0x3138d8[_0x0121('0x49')]=_['intersection'](_0x3138d8['model'],_0x3138d8[_0x0121('0x36')]);_0x5cab9b[_0x0121('0x37')]=_[_0x0121('0x35')](_0x3138d8[_0x0121('0x32')],qs[_0x0121('0x38')](_0x1b95b8[_0x0121('0x36')][_0x0121('0x38')]));_0x5cab9b['attributes']=_0x5cab9b[_0x0121('0x37')][_0x0121('0x39')]?_0x5cab9b[_0x0121('0x37')]:_0x3138d8[_0x0121('0x32')];if(_0x1b95b8[_0x0121('0x36')][_0x0121('0x4a')]){_0x5cab9b[_0x0121('0x44')]=[{'all':!![]}];}_0x5cab9b=_[_0x0121('0x41')]({},_0x5cab9b,_0x1b95b8[_0x0121('0x43')]);return db[_0x0121('0x2e')]['find'](_0x5cab9b)['then'](handleEntityNotFound(_0x48dee,null))[_0x0121('0x26')](respondWithResult(_0x48dee,null))[_0x0121('0x46')](handleError(_0x48dee,null));};exports[_0x0121('0x4b')]=function(_0x20b517,_0x15bad9){return db[_0x0121('0x2e')][_0x0121('0x4b')](_0x20b517[_0x0121('0x4c')],{})[_0x0121('0x26')](respondWithResult(_0x15bad9,0xc9))[_0x0121('0x46')](handleError(_0x15bad9,null));};exports['update']=function(_0x55d1de,_0x53dce4){if(_0x55d1de['body']['id']){delete _0x55d1de[_0x0121('0x4c')]['id'];}return db[_0x0121('0x2e')]['find']({'where':{'id':_0x55d1de[_0x0121('0x47')]['id']}})['then'](handleEntityNotFound(_0x53dce4,null))[_0x0121('0x26')](saveUpdates(_0x55d1de[_0x0121('0x4c')],null))[_0x0121('0x26')](respondWithResult(_0x53dce4,null))[_0x0121('0x46')](handleError(_0x53dce4,null));};exports[_0x0121('0x27')]=function(_0x1d985a,_0x11f5a7){return db[_0x0121('0x2e')][_0x0121('0x4d')]({'where':{'id':_0x1d985a[_0x0121('0x47')]['id']}})[_0x0121('0x26')](handleEntityNotFound(_0x11f5a7,null))[_0x0121('0x26')](removeEntity(_0x11f5a7,null))[_0x0121('0x46')](handleError(_0x11f5a7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1ca9ba2..35f5fd0 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 _0xdf1d=['../../config/environment','./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x3ea6e3,_0x58a746){var _0x4d314e=function(_0x1eeac6){while(--_0x1eeac6){_0x3ea6e3['push'](_0x3ea6e3['shift']());}};_0x4d314e(++_0x58a746);}(_0xdf1d,0x68));var _0xddf1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xdf1d[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xddf1('0x0'));var util=require(_0xddf1('0x1'));var logger=require(_0xddf1('0x2'))(_0xddf1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xddf1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xddf1('0x5'));var config=require(_0xddf1('0x6'));var attributes=require(_0xddf1('0x7'));module['exports']=function(_0x32ad78,_0x11c68c){return _0x32ad78[_0xddf1('0x8')](_0xddf1('0x9'),attributes,{'tableName':_0xddf1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa5d5=['define','Integration','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','exports'];(function(_0x53cf89,_0x437980){var _0x4928de=function(_0x24c7b9){while(--_0x24c7b9){_0x53cf89['push'](_0x53cf89['shift']());}};_0x4928de(++_0x437980);}(_0xa5d5,0x176));var _0x5a5d=function(_0x5b7846,_0x5489b0){_0x5b7846=_0x5b7846-0x0;var _0x29861a=_0xa5d5[_0x5b7846];return _0x29861a;};'use strict';var _=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var logger=require(_0x5a5d('0x2'))('api');var moment=require(_0x5a5d('0x3'));var BPromise=require(_0x5a5d('0x4'));var rp=require(_0x5a5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a5d('0x6'));var config=require(_0x5a5d('0x7'));var attributes=require(_0x5a5d('0x8'));module[_0x5a5d('0x9')]=function(_0x582607,_0x1144f2){return _0x582607[_0x5a5d('0xa')](_0x5a5d('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index a66ff6e..7bf1114 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 _0x5af9=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','catch'];(function(_0x51b648,_0x3af80d){var _0x58a6e5=function(_0x588c4d){while(--_0x588c4d){_0x51b648['push'](_0x51b648['shift']());}};_0x58a6e5(++_0x3af80d);}(_0x5af9,0xdc));var _0x95af=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x5af9[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0x95af('0x0'));var util=require(_0x95af('0x1'));var moment=require(_0x95af('0x2'));var BPromise=require('bluebird');var rs=require(_0x95af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95af('0x4'));var logger=require(_0x95af('0x5'))(_0x95af('0x6'));var config=require('../../config/environment');var jayson=require(_0x95af('0x7'));var client=jayson[_0x95af('0x8')][_0x95af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15005f,_0x73307d,_0x5266eb){return new BPromise(function(_0xba1a38,_0x3fdf1b){return client[_0x95af('0xa')](_0x15005f,_0x5266eb)[_0x95af('0xb')](function(_0x4dc1de){logger[_0x95af('0xc')]('Integration,\x20%s,\x20%s',_0x73307d,_0x95af('0xd'));logger[_0x95af('0xe')](_0x95af('0xf'),_0x73307d,_0x95af('0xd'),JSON[_0x95af('0x10')](_0x4dc1de));if(_0x4dc1de[_0x95af('0x11')]){if(_0x4dc1de[_0x95af('0x11')][_0x95af('0x12')]===0x1f4){logger['error'](_0x95af('0x13'),_0x73307d,_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);return _0x3fdf1b(_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);}logger[_0x95af('0x11')]('Integration,\x20%s,\x20%s',_0x73307d,_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);return _0xba1a38(_0x4dc1de[_0x95af('0x11')][_0x95af('0x14')]);}else{logger[_0x95af('0xc')](_0x95af('0x13'),_0x73307d,_0x95af('0xd'));_0xba1a38(_0x4dc1de['result'][_0x95af('0x14')]);}})[_0x95af('0x15')](function(_0x1dee5e){logger[_0x95af('0x11')](_0x95af('0x13'),_0x73307d,_0x1dee5e);_0x3fdf1b(_0x1dee5e);});});} \ No newline at end of file +var _0x7da7=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x50f2b0,_0x32c5f3){var _0x477ebc=function(_0x5e1b2f){while(--_0x5e1b2f){_0x50f2b0['push'](_0x50f2b0['shift']());}};_0x477ebc(++_0x32c5f3);}(_0x7da7,0x10d));var _0x77da=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x7da7[_0x2cfb48];return _0xc4594f;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('Integration,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('Integration,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 25867d0..cf5c485 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 _0x0bb2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34e4a0,_0x1fd446){var _0x3ead3e=function(_0x47adec){while(--_0x47adec){_0x34e4a0['push'](_0x34e4a0['shift']());}};_0x3ead3e(++_0x1fd446);}(_0x0bb2,0x72));var _0x20bb=function(_0x49a5f6,_0x2eea42){_0x49a5f6=_0x49a5f6-0x0;var _0x22fe92=_0x0bb2[_0x49a5f6];return _0x22fe92;};'use strict';var multer=require(_0x20bb('0x0'));var util=require(_0x20bb('0x1'));var path=require(_0x20bb('0x2'));var timeout=require(_0x20bb('0x3'));var express=require(_0x20bb('0x4'));var router=express[_0x20bb('0x5')]();var auth=require(_0x20bb('0x6'));var interaction=require(_0x20bb('0x7'));var config=require(_0x20bb('0x8'));var controller=require(_0x20bb('0x9'));router[_0x20bb('0xa')]('/',auth[_0x20bb('0xb')](),controller[_0x20bb('0xc')]);router[_0x20bb('0xa')]('/describe',auth[_0x20bb('0xb')](),controller[_0x20bb('0xd')]);router[_0x20bb('0xa')](_0x20bb('0xe'),auth['isAuthenticated'](),controller[_0x20bb('0xf')]);router[_0x20bb('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x20bb('0x11')](_0x20bb('0xe'),auth[_0x20bb('0xb')](),controller['update']);router['delete'](_0x20bb('0xe'),auth[_0x20bb('0xb')](),controller[_0x20bb('0x12')]);module[_0x20bb('0x13')]=router; \ No newline at end of file +var _0x6ce7=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./integrationReport.controller'];(function(_0xcf098d,_0x1b9e69){var _0x99daff=function(_0x3aedcc){while(--_0x3aedcc){_0xcf098d['push'](_0xcf098d['shift']());}};_0x99daff(++_0x1b9e69);}(_0x6ce7,0x110));var _0x76ce=function(_0x2b85f4,_0x2140c7){_0x2b85f4=_0x2b85f4-0x0;var _0x14873a=_0x6ce7[_0x2b85f4];return _0x14873a;};'use strict';var multer=require(_0x76ce('0x0'));var util=require(_0x76ce('0x1'));var path=require(_0x76ce('0x2'));var timeout=require(_0x76ce('0x3'));var express=require('express');var router=express[_0x76ce('0x4')]();var auth=require(_0x76ce('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x76ce('0x6'));var controller=require(_0x76ce('0x7'));router[_0x76ce('0x8')]('/',auth[_0x76ce('0x9')](),controller['index']);router[_0x76ce('0x8')](_0x76ce('0xa'),auth[_0x76ce('0x9')](),controller[_0x76ce('0xb')]);router['get'](_0x76ce('0xc'),auth[_0x76ce('0x9')](),controller[_0x76ce('0xd')]);router[_0x76ce('0xe')]('/',auth[_0x76ce('0x9')](),controller[_0x76ce('0xf')]);router[_0x76ce('0x10')]('/:id',auth[_0x76ce('0x9')](),controller[_0x76ce('0x11')]);router[_0x76ce('0x12')](_0x76ce('0xc'),auth[_0x76ce('0x9')](),controller[_0x76ce('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 73291d0..f3d1e66 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 _0x04da=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x04da,0x1f0));var _0xa04d=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x04da[_0x296897];return _0x2b44ab;};'use strict';var Sequelize=require(_0xa04d('0x0'));module[_0xa04d('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xa04d('0x2')]},'exitStatus':{'type':Sequelize[_0xa04d('0x2')]},'ticketId':{'type':Sequelize[_0xa04d('0x2')]},'integrationId':{'type':Sequelize[_0xa04d('0x3')]},'contacts':{'type':Sequelize[_0xa04d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa04d('0x2')]},'calleridname':{'type':Sequelize[_0xa04d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa04d('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa04d('0x4')]},'agentconnectAt':{'type':Sequelize[_0xa04d('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xa04d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa04d('0x4')]},'talktime':{'type':Sequelize[_0xa04d('0x3')]},'agentacw':{'type':Sequelize[_0xa04d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa04d('0x3')]},'reason':{'type':Sequelize[_0xa04d('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa04d('0x4')]},'agentdump':{'type':Sequelize[_0xa04d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xa04d('0x4')]},'lastevent':{'type':Sequelize[_0xa04d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa04d('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa04d('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa04d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa04d('0x2')]},'exten':{'type':Sequelize[_0xa04d('0x2')]},'priority':{'type':Sequelize[_0xa04d('0x2')]},'destchannel':{'type':Sequelize[_0xa04d('0x2')]},'destchannelstate':{'type':Sequelize[_0xa04d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa04d('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa04d('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa04d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xa04d('0x2')]},'destexten':{'type':Sequelize[_0xa04d('0x2')]},'destpriority':{'type':Sequelize[_0xa04d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa04d('0x2')]},'inReplyTo':{'type':Sequelize[_0xa04d('0x2')]},'subject':{'type':Sequelize[_0xa04d('0x2')]},'from':{'type':Sequelize[_0xa04d('0x2')]},'to':{'type':Sequelize[_0xa04d('0x2')]},'cc':{'type':Sequelize[_0xa04d('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xa04d('0x6')]},'text':{'type':Sequelize[_0xa04d('0x6')]},'status':{'type':Sequelize[_0xa04d('0x7')](_0xa04d('0x8'),_0xa04d('0x9'),'RECEIVED',_0xa04d('0xa'))},'url':{'type':Sequelize[_0xa04d('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xa04d('0x3')]}}; \ No newline at end of file +var _0x073f=['SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x073f,0x154));var _0xf073=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x073f[_0x8dc04d];return _0x2f5f28;};'use strict';var Sequelize=require(_0xf073('0x0'));module[_0xf073('0x1')]={'integration':{'type':Sequelize[_0xf073('0x2')]},'eventChannel':{'type':Sequelize[_0xf073('0x2')]},'exitStatus':{'type':Sequelize[_0xf073('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xf073('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xf073('0x2')]},'calleridnum':{'type':Sequelize[_0xf073('0x2')]},'calleridname':{'type':Sequelize[_0xf073('0x2')]},'queue':{'type':Sequelize[_0xf073('0x2')]},'interface':{'type':Sequelize[_0xf073('0x2')]},'membername':{'type':Sequelize[_0xf073('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf073('0x4')]},'agentconnectAt':{'type':Sequelize[_0xf073('0x4')]},'holdtime':{'type':Sequelize[_0xf073('0x3')]},'agentcomplete':{'type':Sequelize[_0xf073('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf073('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf073('0x3')]},'reason':{'type':Sequelize[_0xf073('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf073('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf073('0x4')]},'agentdump':{'type':Sequelize[_0xf073('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf073('0x4')]},'lastevent':{'type':Sequelize[_0xf073('0x2')]},'channel':{'type':Sequelize[_0xf073('0x2')]},'channelstate':{'type':Sequelize[_0xf073('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf073('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf073('0x2')]},'connectedlinename':{'type':Sequelize[_0xf073('0x2')]},'language':{'type':Sequelize[_0xf073('0x2')]},'accountcode':{'type':Sequelize[_0xf073('0x2')]},'context':{'type':Sequelize[_0xf073('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf073('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xf073('0x2')]},'destcalleridnum':{'type':Sequelize[_0xf073('0x2')]},'destcalleridname':{'type':Sequelize[_0xf073('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf073('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf073('0x2')]},'destaccountcode':{'type':Sequelize[_0xf073('0x2')]},'destcontext':{'type':Sequelize[_0xf073('0x2')]},'destexten':{'type':Sequelize[_0xf073('0x2')]},'destpriority':{'type':Sequelize[_0xf073('0x2')]},'destuniqueid':{'type':Sequelize[_0xf073('0x2')]},'messageId':{'type':Sequelize[_0xf073('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xf073('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xf073('0x2')]},'attachment':{'type':Sequelize[_0xf073('0x6')]},'html':{'type':Sequelize[_0xf073('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xf073('0x7')](_0xf073('0x8'),_0xf073('0x9'),_0xf073('0xa'),_0xf073('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xf073('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xf073('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c41f317..2dc3c9d 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 _0xc5bd=['filtears','length','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','model'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xc5bd,0x123));var _0xdc5b=function(_0x1bd63c,_0x28e0ae){_0x1bd63c=_0x1bd63c-0x0;var _0x1b0010=_0xc5bd[_0x1bd63c];return _0x1b0010;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdc5b('0x0'));var rimraf=require(_0xdc5b('0x1'));var zipdir=require(_0xdc5b('0x2'));var jsonpatch=require(_0xdc5b('0x3'));var rp=require(_0xdc5b('0x4'));var moment=require(_0xdc5b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc5b('0x6'));var util=require(_0xdc5b('0x7'));var path=require(_0xdc5b('0x8'));var sox=require(_0xdc5b('0x9'));var csv=require(_0xdc5b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdc5b('0xb'));var crypto=require('crypto');var jsforce=require(_0xdc5b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdc5b('0xa'));var querystring=require('querystring');var Papa=require(_0xdc5b('0xd'));var Redis=require(_0xdc5b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdc5b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc5b('0x10'));var logger=require(_0xdc5b('0x11'))(_0xdc5b('0x12'));var utils=require(_0xdc5b('0x13'));var config=require(_0xdc5b('0x14'));var licenseUtil=require(_0xdc5b('0x15'));var db=require(_0xdc5b('0x16'))['db'];function respondWithStatusCode(_0x2d9957,_0x5df040){_0x5df040=_0x5df040||0xcc;return function(_0x38ebb5){if(_0x38ebb5){return _0x2d9957[_0xdc5b('0x17')](_0x5df040);}return _0x2d9957[_0xdc5b('0x18')](_0x5df040)[_0xdc5b('0x19')]();};}function respondWithResult(_0x5a430c,_0x5cba81){_0x5cba81=_0x5cba81||0xc8;return function(_0x4820ca){if(_0x4820ca){return _0x5a430c[_0xdc5b('0x18')](_0x5cba81)[_0xdc5b('0x1a')](_0x4820ca);}};}function respondWithFilteredResult(_0x5c0c12,_0x5e1e13){return function(_0x36f3b6){if(_0x36f3b6){var _0x3ad1bf=_0x36f3b6[_0xdc5b('0x1b')],_0x41a1c0=_0x5e1e13['offset'],_0x49c64b=_0x5e1e13[_0xdc5b('0x1c')]+_0x5e1e13[_0xdc5b('0x1d')],_0x55e4cd;if(_0x49c64b>=_0x3ad1bf){_0x49c64b=_0x3ad1bf;_0x55e4cd=0xc8;}else{_0x55e4cd=0xce;}_0x5c0c12['status'](_0x55e4cd);return _0x5c0c12['set'](_0xdc5b('0x1e'),_0x41a1c0+'-'+_0x49c64b+'/'+_0x3ad1bf)[_0xdc5b('0x1a')](_0x36f3b6);}return null;};}function patchUpdates(_0x5d543b){return function(_0x316173){try{jsonpatch['apply'](_0x316173,_0x5d543b,!![]);}catch(_0x3ae46c){return BPromise['reject'](_0x3ae46c);}return _0x316173[_0xdc5b('0x1f')]();};}function saveUpdates(_0xb4b088,_0x44e77b){return function(_0x456c9b){if(_0x456c9b){return _0x456c9b[_0xdc5b('0x20')](_0xb4b088)[_0xdc5b('0x21')](function(_0x49f286){return _0x49f286;});}return null;};}function removeEntity(_0x294a57,_0x288a00){return function(_0xf14d5c){if(_0xf14d5c){return _0xf14d5c['destroy']()['then'](function(){_0x294a57['status'](0xcc)[_0xdc5b('0x19')]();});}};}function handleEntityNotFound(_0x59f196,_0xa747b5){return function(_0xbb725f){if(!_0xbb725f){_0x59f196[_0xdc5b('0x17')](0x194);}return _0xbb725f;};}function handleError(_0x52d60b,_0x2d5027){_0x2d5027=_0x2d5027||0x1f4;return function(_0x173cc6){logger[_0xdc5b('0x22')](_0x173cc6[_0xdc5b('0x23')]);if(_0x173cc6[_0xdc5b('0x24')]){delete _0x173cc6[_0xdc5b('0x24')];}_0x52d60b[_0xdc5b('0x18')](_0x2d5027)[_0xdc5b('0x25')](_0x173cc6);};}exports[_0xdc5b('0x26')]=function(_0x2bd3ba,_0x4da3d9){var _0x3992b5={},_0x4775d7={},_0x4b6027={'count':0x0,'rows':[]};var _0x2e8a0e=_[_0xdc5b('0x27')](db[_0xdc5b('0x28')][_0xdc5b('0x29')],function(_0x4eb915){return{'name':_0x4eb915[_0xdc5b('0x2a')],'type':_0x4eb915['type']['key']};});_0x4775d7['model']=_[_0xdc5b('0x27')](_0x2e8a0e,_0xdc5b('0x24'));_0x4775d7[_0xdc5b('0x2b')]=_[_0xdc5b('0x2c')](_0x2bd3ba[_0xdc5b('0x2b')]);_0x4775d7[_0xdc5b('0x2d')]=_[_0xdc5b('0x2e')](_0x4775d7['model'],_0x4775d7[_0xdc5b('0x2b')]);_0x3992b5['attributes']=_[_0xdc5b('0x2e')](_0x4775d7['model'],qs['fields'](_0x2bd3ba['query'][_0xdc5b('0x2f')]));_0x3992b5[_0xdc5b('0x30')]=_0x3992b5[_0xdc5b('0x30')]['length']?_0x3992b5[_0xdc5b('0x30')]:_0x4775d7['model'];if(!_0x2bd3ba[_0xdc5b('0x2b')]['hasOwnProperty'](_0xdc5b('0x31'))){_0x3992b5[_0xdc5b('0x1d')]=qs['limit'](_0x2bd3ba[_0xdc5b('0x2b')]['limit']);_0x3992b5[_0xdc5b('0x1c')]=qs[_0xdc5b('0x1c')](_0x2bd3ba[_0xdc5b('0x2b')][_0xdc5b('0x1c')]);}_0x3992b5[_0xdc5b('0x32')]=qs[_0xdc5b('0x33')](_0x2bd3ba[_0xdc5b('0x2b')]['sort']);_0x3992b5[_0xdc5b('0x34')]=qs[_0xdc5b('0x2d')](_[_0xdc5b('0x35')](_0x2bd3ba[_0xdc5b('0x2b')],_0x4775d7[_0xdc5b('0x2d')]),_0x2e8a0e);if(_0x2bd3ba[_0xdc5b('0x2b')][_0xdc5b('0x36')]){_0x3992b5[_0xdc5b('0x34')]=_[_0xdc5b('0x37')](_0x3992b5[_0xdc5b('0x34')],{'$or':_[_0xdc5b('0x27')](_0x2e8a0e,function(_0x5e05b5){if(_0x5e05b5['type']!==_0xdc5b('0x38')){var _0x283e1c={};_0x283e1c[_0x5e05b5['name']]={'$like':'%'+_0x2bd3ba[_0xdc5b('0x2b')][_0xdc5b('0x36')]+'%'};return _0x283e1c;}})});}_0x3992b5=_[_0xdc5b('0x37')]({},_0x3992b5,_0x2bd3ba[_0xdc5b('0x39')]);var _0x106901={'where':_0x3992b5[_0xdc5b('0x34')]};return db[_0xdc5b('0x28')]['count'](_0x106901)['then'](function(_0x27956e){_0x4b6027[_0xdc5b('0x1b')]=_0x27956e;if(_0x2bd3ba[_0xdc5b('0x2b')][_0xdc5b('0x3a')]){_0x3992b5[_0xdc5b('0x3b')]=[{'all':!![]}];}return db[_0xdc5b('0x28')][_0xdc5b('0x3c')](_0x3992b5);})[_0xdc5b('0x21')](function(_0x2888e1){_0x4b6027['rows']=_0x2888e1;return _0x4b6027;})[_0xdc5b('0x21')](respondWithFilteredResult(_0x4da3d9,_0x3992b5))[_0xdc5b('0x3d')](handleError(_0x4da3d9,null));};exports['show']=function(_0x1993fb,_0x10f22c){var _0x5a4210={'raw':![],'where':{'id':_0x1993fb[_0xdc5b('0x3e')]['id']}},_0x3bbf2e={};_0x3bbf2e[_0xdc5b('0x3f')]=_['keys'](db[_0xdc5b('0x28')][_0xdc5b('0x29')]);_0x3bbf2e[_0xdc5b('0x2b')]=_[_0xdc5b('0x2c')](_0x1993fb['query']);_0x3bbf2e[_0xdc5b('0x40')]=_['intersection'](_0x3bbf2e['model'],_0x3bbf2e['query']);_0x5a4210['attributes']=_[_0xdc5b('0x2e')](_0x3bbf2e['model'],qs[_0xdc5b('0x2f')](_0x1993fb[_0xdc5b('0x2b')][_0xdc5b('0x2f')]));_0x5a4210[_0xdc5b('0x30')]=_0x5a4210[_0xdc5b('0x30')][_0xdc5b('0x41')]?_0x5a4210[_0xdc5b('0x30')]:_0x3bbf2e['model'];if(_0x1993fb[_0xdc5b('0x2b')]['includeAll']){_0x5a4210[_0xdc5b('0x3b')]=[{'all':!![]}];}_0x5a4210=_[_0xdc5b('0x37')]({},_0x5a4210,_0x1993fb[_0xdc5b('0x39')]);return db[_0xdc5b('0x28')]['find'](_0x5a4210)['then'](handleEntityNotFound(_0x10f22c,null))[_0xdc5b('0x21')](respondWithResult(_0x10f22c,null))['catch'](handleError(_0x10f22c,null));};exports[_0xdc5b('0x42')]=function(_0x4af5db,_0x591be4){return db[_0xdc5b('0x28')]['create'](_0x4af5db[_0xdc5b('0x43')],{})[_0xdc5b('0x21')](respondWithResult(_0x591be4,0xc9))[_0xdc5b('0x3d')](handleError(_0x591be4,null));};exports[_0xdc5b('0x20')]=function(_0x149b85,_0x236326){if(_0x149b85['body']['id']){delete _0x149b85['body']['id'];}return db[_0xdc5b('0x28')][_0xdc5b('0x44')]({'where':{'id':_0x149b85['params']['id']}})[_0xdc5b('0x21')](handleEntityNotFound(_0x236326,null))[_0xdc5b('0x21')](saveUpdates(_0x149b85['body'],null))[_0xdc5b('0x21')](respondWithResult(_0x236326,null))[_0xdc5b('0x3d')](handleError(_0x236326,null));};exports[_0xdc5b('0x45')]=function(_0x1c84cd,_0x2dbc7f){return db[_0xdc5b('0x28')][_0xdc5b('0x44')]({'where':{'id':_0x1c84cd[_0xdc5b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2dbc7f,null))['then'](removeEntity(_0x2dbc7f,null))['catch'](handleError(_0x2dbc7f,null));};exports[_0xdc5b('0x46')]=function(_0x514db9,_0x10cf26){return db[_0xdc5b('0x28')][_0xdc5b('0x46')]()['then'](respondWithResult(_0x10cf26,null))[_0xdc5b('0x3d')](handleError(_0x10cf26,null));}; \ No newline at end of file +var _0xca14=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','set','Content-Range','apply','save','then','stack','name','send','index','map','IntegrationReport','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','rows','show','params','rawAttributes','filtears','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x582592,_0x3b192d){var _0x2a2c63=function(_0xb4ab87){while(--_0xb4ab87){_0x582592['push'](_0x582592['shift']());}};_0x2a2c63(++_0x3b192d);}(_0xca14,0x1ba));var _0x4ca1=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0xca14[_0x589eb4];return _0xf50816;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ca1('0x0'));var rimraf=require(_0x4ca1('0x1'));var zipdir=require(_0x4ca1('0x2'));var jsonpatch=require(_0x4ca1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ca1('0x4'));var Mustache=require(_0x4ca1('0x5'));var util=require(_0x4ca1('0x6'));var path=require('path');var sox=require(_0x4ca1('0x7'));var csv=require(_0x4ca1('0x8'));var ejs=require(_0x4ca1('0x9'));var fs=require('fs');var _=require(_0x4ca1('0xa'));var squel=require(_0x4ca1('0xb'));var crypto=require(_0x4ca1('0xc'));var jsforce=require(_0x4ca1('0xd'));var deskjs=require(_0x4ca1('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ca1('0xf'));var Redis=require('ioredis');var authService=require(_0x4ca1('0x10'));var qs=require(_0x4ca1('0x11'));var as=require(_0x4ca1('0x12'));var hardwareService=require(_0x4ca1('0x13'));var logger=require(_0x4ca1('0x14'))(_0x4ca1('0x15'));var utils=require(_0x4ca1('0x16'));var config=require(_0x4ca1('0x17'));var licenseUtil=require(_0x4ca1('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18b941,_0xb8b6e7){_0xb8b6e7=_0xb8b6e7||0xcc;return function(_0x1b5ac1){if(_0x1b5ac1){return _0x18b941[_0x4ca1('0x19')](_0xb8b6e7);}return _0x18b941[_0x4ca1('0x1a')](_0xb8b6e7)[_0x4ca1('0x1b')]();};}function respondWithResult(_0x4fca98,_0x3c8fbe){_0x3c8fbe=_0x3c8fbe||0xc8;return function(_0x3b1dfe){if(_0x3b1dfe){return _0x4fca98[_0x4ca1('0x1a')](_0x3c8fbe)[_0x4ca1('0x1c')](_0x3b1dfe);}};}function respondWithFilteredResult(_0xdf3e85,_0x41c6c2){return function(_0x492a01){if(_0x492a01){var _0x5d53c2=_0x492a01['count'],_0x2b4b7d=_0x41c6c2[_0x4ca1('0x1d')],_0x400710=_0x41c6c2[_0x4ca1('0x1d')]+_0x41c6c2['limit'],_0x7e3f56;if(_0x400710>=_0x5d53c2){_0x400710=_0x5d53c2;_0x7e3f56=0xc8;}else{_0x7e3f56=0xce;}_0xdf3e85[_0x4ca1('0x1a')](_0x7e3f56);return _0xdf3e85[_0x4ca1('0x1e')](_0x4ca1('0x1f'),_0x2b4b7d+'-'+_0x400710+'/'+_0x5d53c2)[_0x4ca1('0x1c')](_0x492a01);}return null;};}function patchUpdates(_0x43214f){return function(_0x37ea0c){try{jsonpatch[_0x4ca1('0x20')](_0x37ea0c,_0x43214f,!![]);}catch(_0x5eacc2){return BPromise['reject'](_0x5eacc2);}return _0x37ea0c[_0x4ca1('0x21')]();};}function saveUpdates(_0x2b91c6,_0x337fda){return function(_0x573d85){if(_0x573d85){return _0x573d85['update'](_0x2b91c6)[_0x4ca1('0x22')](function(_0x18b9ec){return _0x18b9ec;});}return null;};}function removeEntity(_0x1a910f,_0x3a4c75){return function(_0x40204f){if(_0x40204f){return _0x40204f['destroy']()[_0x4ca1('0x22')](function(){_0x1a910f[_0x4ca1('0x1a')](0xcc)[_0x4ca1('0x1b')]();});}};}function handleEntityNotFound(_0x4226e0,_0x21807f){return function(_0x1809e6){if(!_0x1809e6){_0x4226e0[_0x4ca1('0x19')](0x194);}return _0x1809e6;};}function handleError(_0x38bdda,_0x1c0de9){_0x1c0de9=_0x1c0de9||0x1f4;return function(_0x220406){logger['error'](_0x220406[_0x4ca1('0x23')]);if(_0x220406[_0x4ca1('0x24')]){delete _0x220406[_0x4ca1('0x24')];}_0x38bdda[_0x4ca1('0x1a')](_0x1c0de9)[_0x4ca1('0x25')](_0x220406);};}exports[_0x4ca1('0x26')]=function(_0x591ab9,_0x59d811){var _0x322b3a={},_0x19d04e={},_0x3a7ff5={'count':0x0,'rows':[]};var _0xd83a9e=_[_0x4ca1('0x27')](db[_0x4ca1('0x28')]['rawAttributes'],function(_0x200f19){return{'name':_0x200f19['fieldName'],'type':_0x200f19[_0x4ca1('0x29')][_0x4ca1('0x2a')]};});_0x19d04e[_0x4ca1('0x2b')]=_['map'](_0xd83a9e,'name');_0x19d04e['query']=_[_0x4ca1('0x2c')](_0x591ab9[_0x4ca1('0x2d')]);_0x19d04e[_0x4ca1('0x2e')]=_[_0x4ca1('0x2f')](_0x19d04e['model'],_0x19d04e[_0x4ca1('0x2d')]);_0x322b3a[_0x4ca1('0x30')]=_[_0x4ca1('0x2f')](_0x19d04e[_0x4ca1('0x2b')],qs[_0x4ca1('0x31')](_0x591ab9[_0x4ca1('0x2d')][_0x4ca1('0x31')]));_0x322b3a[_0x4ca1('0x30')]=_0x322b3a[_0x4ca1('0x30')][_0x4ca1('0x32')]?_0x322b3a['attributes']:_0x19d04e[_0x4ca1('0x2b')];if(!_0x591ab9['query'][_0x4ca1('0x33')](_0x4ca1('0x34'))){_0x322b3a[_0x4ca1('0x35')]=qs['limit'](_0x591ab9[_0x4ca1('0x2d')][_0x4ca1('0x35')]);_0x322b3a[_0x4ca1('0x1d')]=qs['offset'](_0x591ab9[_0x4ca1('0x2d')]['offset']);}_0x322b3a[_0x4ca1('0x36')]=qs[_0x4ca1('0x37')](_0x591ab9[_0x4ca1('0x2d')]['sort']);_0x322b3a['where']=qs[_0x4ca1('0x2e')](_['pick'](_0x591ab9[_0x4ca1('0x2d')],_0x19d04e[_0x4ca1('0x2e')]),_0xd83a9e);if(_0x591ab9['query'][_0x4ca1('0x38')]){_0x322b3a['where']=_[_0x4ca1('0x39')](_0x322b3a['where'],{'$or':_[_0x4ca1('0x27')](_0xd83a9e,function(_0x4048ab){if(_0x4048ab['type']!==_0x4ca1('0x3a')){var _0x3623ba={};_0x3623ba[_0x4048ab[_0x4ca1('0x24')]]={'$like':'%'+_0x591ab9[_0x4ca1('0x2d')]['filter']+'%'};return _0x3623ba;}})});}_0x322b3a=_[_0x4ca1('0x39')]({},_0x322b3a,_0x591ab9[_0x4ca1('0x3b')]);var _0x307870={'where':_0x322b3a[_0x4ca1('0x3c')]};return db[_0x4ca1('0x28')][_0x4ca1('0x3d')](_0x307870)[_0x4ca1('0x22')](function(_0x2ddd91){_0x3a7ff5[_0x4ca1('0x3d')]=_0x2ddd91;if(_0x591ab9[_0x4ca1('0x2d')][_0x4ca1('0x3e')]){_0x322b3a[_0x4ca1('0x3f')]=[{'all':!![]}];}return db[_0x4ca1('0x28')]['findAll'](_0x322b3a);})['then'](function(_0x37fc12){_0x3a7ff5[_0x4ca1('0x40')]=_0x37fc12;return _0x3a7ff5;})[_0x4ca1('0x22')](respondWithFilteredResult(_0x59d811,_0x322b3a))['catch'](handleError(_0x59d811,null));};exports[_0x4ca1('0x41')]=function(_0x5e460a,_0x497205){var _0x28d5b4={'raw':![],'where':{'id':_0x5e460a[_0x4ca1('0x42')]['id']}},_0xac39ac={};_0xac39ac[_0x4ca1('0x2b')]=_[_0x4ca1('0x2c')](db[_0x4ca1('0x28')][_0x4ca1('0x43')]);_0xac39ac['query']=_['keys'](_0x5e460a['query']);_0xac39ac[_0x4ca1('0x44')]=_[_0x4ca1('0x2f')](_0xac39ac[_0x4ca1('0x2b')],_0xac39ac[_0x4ca1('0x2d')]);_0x28d5b4['attributes']=_[_0x4ca1('0x2f')](_0xac39ac['model'],qs[_0x4ca1('0x31')](_0x5e460a[_0x4ca1('0x2d')][_0x4ca1('0x31')]));_0x28d5b4[_0x4ca1('0x30')]=_0x28d5b4[_0x4ca1('0x30')][_0x4ca1('0x32')]?_0x28d5b4[_0x4ca1('0x30')]:_0xac39ac[_0x4ca1('0x2b')];if(_0x5e460a[_0x4ca1('0x2d')]['includeAll']){_0x28d5b4[_0x4ca1('0x3f')]=[{'all':!![]}];}_0x28d5b4=_['merge']({},_0x28d5b4,_0x5e460a[_0x4ca1('0x3b')]);return db[_0x4ca1('0x28')][_0x4ca1('0x45')](_0x28d5b4)[_0x4ca1('0x22')](handleEntityNotFound(_0x497205,null))[_0x4ca1('0x22')](respondWithResult(_0x497205,null))[_0x4ca1('0x46')](handleError(_0x497205,null));};exports[_0x4ca1('0x47')]=function(_0x8de78b,_0x2d4b36){return db[_0x4ca1('0x28')]['create'](_0x8de78b[_0x4ca1('0x48')],{})[_0x4ca1('0x22')](respondWithResult(_0x2d4b36,0xc9))[_0x4ca1('0x46')](handleError(_0x2d4b36,null));};exports[_0x4ca1('0x49')]=function(_0x5e88c2,_0x587378){if(_0x5e88c2[_0x4ca1('0x48')]['id']){delete _0x5e88c2[_0x4ca1('0x48')]['id'];}return db[_0x4ca1('0x28')][_0x4ca1('0x45')]({'where':{'id':_0x5e88c2[_0x4ca1('0x42')]['id']}})['then'](handleEntityNotFound(_0x587378,null))[_0x4ca1('0x22')](saveUpdates(_0x5e88c2[_0x4ca1('0x48')],null))[_0x4ca1('0x22')](respondWithResult(_0x587378,null))[_0x4ca1('0x46')](handleError(_0x587378,null));};exports[_0x4ca1('0x4a')]=function(_0x15f8c4,_0x5f4491){return db[_0x4ca1('0x28')]['find']({'where':{'id':_0x15f8c4[_0x4ca1('0x42')]['id']}})[_0x4ca1('0x22')](handleEntityNotFound(_0x5f4491,null))[_0x4ca1('0x22')](removeEntity(_0x5f4491,null))['catch'](handleError(_0x5f4491,null));};exports[_0x4ca1('0x4b')]=function(_0x400ae0,_0x537978){return db[_0x4ca1('0x28')][_0x4ca1('0x4b')]()[_0x4ca1('0x22')](respondWithResult(_0x537978,null))[_0x4ca1('0x46')](handleError(_0x537978,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6099012..6d5e619 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 _0x832e=['api','moment','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger'];(function(_0xeb9929,_0x3e76cd){var _0x2091fc=function(_0x32aebb){while(--_0x32aebb){_0xeb9929['push'](_0xeb9929['shift']());}};_0x2091fc(++_0x3e76cd);}(_0x832e,0xa7));var _0xe832=function(_0x4a67e2,_0x359151){_0x4a67e2=_0x4a67e2-0x0;var _0x32b242=_0x832e[_0x4a67e2];return _0x32b242;};'use strict';var _=require('lodash');var util=require(_0xe832('0x0'));var logger=require(_0xe832('0x1'))(_0xe832('0x2'));var moment=require(_0xe832('0x3'));var BPromise=require(_0xe832('0x4'));var rp=require(_0xe832('0x5'));var fs=require('fs');var path=require(_0xe832('0x6'));var rimraf=require('rimraf');var config=require(_0xe832('0x7'));var attributes=require(_0xe832('0x8'));module[_0xe832('0x9')]=function(_0x4259d2,_0x8d615f){return _0x4259d2[_0xe832('0xa')](_0xe832('0xb'),attributes,{'tableName':_0xe832('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8125=['bluebird','request-promise','path','rimraf','../../config/environment','define','IntegrationReport','report_integration','lodash','util','../../config/logger','moment'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x8125,0x188));var _0x5812=function(_0x10fb00,_0x2f5ff2){_0x10fb00=_0x10fb00-0x0;var _0xe98ee4=_0x8125[_0x10fb00];return _0xe98ee4;};'use strict';var _=require(_0x5812('0x0'));var util=require(_0x5812('0x1'));var logger=require(_0x5812('0x2'))('api');var moment=require(_0x5812('0x3'));var BPromise=require(_0x5812('0x4'));var rp=require(_0x5812('0x5'));var fs=require('fs');var path=require(_0x5812('0x6'));var rimraf=require(_0x5812('0x7'));var config=require(_0x5812('0x8'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x2a0a62,_0x2d5e2f){return _0x2a0a62[_0x5812('0x9')](_0x5812('0xa'),attributes,{'tableName':_0x5812('0xb'),'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 475f953..d3f2520 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(_0x2bc0dd,_0x4f88eb){var _0x49ff3d=function(_0x1f697f){while(--_0x1f697f){_0x2bc0dd['push'](_0x2bc0dd['shift']());}};_0x49ff3d(++_0x4f88eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xb10b[_0x2df724];return _0x1b2504;};'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 _0xb7e7=['IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\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(_0x566333,_0x16182){var _0x17bb07=function(_0x1baabe){while(--_0x1baabe){_0x566333['push'](_0x566333['shift']());}};_0x17bb07(++_0x16182);}(_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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 28095f9..d011db5 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 _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0xb419dd,_0x58d460){var _0x367c85=function(_0x342d36){while(--_0x342d36){_0xb419dd['push'](_0xb419dd['shift']());}};_0x367c85(++_0x58d460);}(_0x3e74,0x175));var _0x43e7=function(_0x25d98f,_0x3b90b0){_0x25d98f=_0x25d98f-0x0;var _0xf9c513=_0x3e74[_0x25d98f];return _0xf9c513;};'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')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports'];(function(_0x2defc4,_0x25dbea){var _0x10e80a=function(_0x2c13c1){while(--_0x2c13c1){_0x2defc4['push'](_0x2defc4['shift']());}};_0x10e80a(++_0x25dbea);}(_0x7217,0x19e));var _0x7721=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7217[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);router[_0x7721('0xe')](_0x7721('0x11'),auth[_0x7721('0x8')](),controller[_0x7721('0x12')]);router[_0x7721('0x13')]('/:id',auth[_0x7721('0x8')](),controller[_0x7721('0x14')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);module[_0x7721('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index e40fea3..9654173 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 _0x05dc=['STRING','sequelize'];(function(_0x2ce9d2,_0x21b3f8){var _0x2cc46b=function(_0x3407c7){while(--_0x3407c7){_0x2ce9d2['push'](_0x2ce9d2['shift']());}};_0x2cc46b(++_0x21b3f8);}(_0x05dc,0x17f));var _0xc05d=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x05dc[_0x35c86f];return _0x28c841;};'use strict';var Sequelize=require(_0xc05d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc05d('0x1')]},'interval':{'type':Sequelize[_0xc05d('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x633a=['exports','STRING','sequelize'];(function(_0x2e5ff8,_0x299840){var _0x5dbfc8=function(_0x470fb0){while(--_0x470fb0){_0x2e5ff8['push'](_0x2e5ff8['shift']());}};_0x5dbfc8(++_0x299840);}(_0x633a,0xd7));var _0xa633=function(_0x28b36a,_0x2ce211){_0x28b36a=_0x28b36a-0x0;var _0x5c5dc8=_0x633a[_0x28b36a];return _0x5c5dc8;};'use strict';var Sequelize=require(_0xa633('0x0'));module[_0xa633('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa633('0x2')]},'interval':{'type':Sequelize[_0xa633('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 f46814a..2c67ee2 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 _0xcb66=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','count','offset','limit','reject','save','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','filtears','catch','create','get','role','user','Intervals','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','IntervalId','getIntervals','findOne','order','hasOwnProperty','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x74cf12,_0x2a3028){var _0x15242e=function(_0x988429){while(--_0x988429){_0x74cf12['push'](_0x74cf12['shift']());}};_0x15242e(++_0x2a3028);}(_0xcb66,0x19f));var _0x6cb6=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0xcb66[_0x48999d];return _0x1ad0d1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6cb6('0x0'));var rimraf=require(_0x6cb6('0x1'));var zipdir=require(_0x6cb6('0x2'));var jsonpatch=require(_0x6cb6('0x3'));var rp=require(_0x6cb6('0x4'));var moment=require('moment');var BPromise=require(_0x6cb6('0x5'));var Mustache=require(_0x6cb6('0x6'));var util=require(_0x6cb6('0x7'));var path=require(_0x6cb6('0x8'));var sox=require(_0x6cb6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0xf'));var querystring=require(_0x6cb6('0x10'));var Papa=require(_0x6cb6('0x11'));var Redis=require(_0x6cb6('0x12'));var authService=require(_0x6cb6('0x13'));var qs=require(_0x6cb6('0x14'));var as=require(_0x6cb6('0x15'));var hardwareService=require(_0x6cb6('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x17'));var db=require(_0x6cb6('0x18'))['db'];var extensions=require(_0x6cb6('0x19'));function respondWithStatusCode(_0x2604e7,_0x585233){_0x585233=_0x585233||0xcc;return function(_0x1ab7f2){if(_0x1ab7f2){return _0x2604e7[_0x6cb6('0x1a')](_0x585233);}return _0x2604e7['status'](_0x585233)[_0x6cb6('0x1b')]();};}function respondWithResult(_0x14a581,_0x5af476){_0x5af476=_0x5af476||0xc8;return function(_0x107492){if(_0x107492){return _0x14a581[_0x6cb6('0x1c')](_0x5af476)['json'](_0x107492);}};}function respondWithFilteredResult(_0x5ab865,_0x505b4d){return function(_0x5dd4cd){if(_0x5dd4cd){var _0x380edc=_0x5dd4cd[_0x6cb6('0x1d')],_0x298daa=_0x505b4d[_0x6cb6('0x1e')],_0x9c901a=_0x505b4d['offset']+_0x505b4d[_0x6cb6('0x1f')],_0x43a9c4;if(_0x9c901a>=_0x380edc){_0x9c901a=_0x380edc;_0x43a9c4=0xc8;}else{_0x43a9c4=0xce;}_0x5ab865[_0x6cb6('0x1c')](_0x43a9c4);return _0x5ab865['set']('Content-Range',_0x298daa+'-'+_0x9c901a+'/'+_0x380edc)['json'](_0x5dd4cd);}return null;};}function patchUpdates(_0x5b5dab){return function(_0x57157f){try{jsonpatch['apply'](_0x57157f,_0x5b5dab,!![]);}catch(_0x390c9b){return BPromise[_0x6cb6('0x20')](_0x390c9b);}return _0x57157f[_0x6cb6('0x21')]();};}function saveUpdates(_0x2d41c4,_0xc5dea0){return function(_0x5e14c8){if(_0x5e14c8){return _0x5e14c8['update'](_0x2d41c4)[_0x6cb6('0x22')](function(_0x1d35d1){return _0x1d35d1;});}return null;};}function removeEntity(_0x1c4bcd,_0x153915){return function(_0x5f14f9){if(_0x5f14f9){return _0x5f14f9[_0x6cb6('0x23')]()[_0x6cb6('0x22')](function(){var _0x58a6ed=_0x5f14f9['get']({'plain':!![]});var _0xea5ee5='Intervals';return db[_0x6cb6('0x24')][_0x6cb6('0x23')]({'where':{'type':_0xea5ee5,'resourceId':_0x58a6ed['id']}})[_0x6cb6('0x22')](function(){return _0x5f14f9;});})[_0x6cb6('0x22')](function(){_0x1c4bcd[_0x6cb6('0x1c')](0xcc)[_0x6cb6('0x1b')]();});}};}function handleEntityNotFound(_0x3b57f0,_0xcae6af){return function(_0x1cc1ed){if(!_0x1cc1ed){_0x3b57f0[_0x6cb6('0x1a')](0x194);}return _0x1cc1ed;};}function handleError(_0x47a81b,_0x5c525b){_0x5c525b=_0x5c525b||0x1f4;return function(_0x4ea573){logger[_0x6cb6('0x25')](_0x4ea573[_0x6cb6('0x26')]);if(_0x4ea573[_0x6cb6('0x27')]){delete _0x4ea573[_0x6cb6('0x27')];}_0x47a81b[_0x6cb6('0x1c')](_0x5c525b)[_0x6cb6('0x28')](_0x4ea573);};}exports['index']=function(_0x124291,_0x4d4ad9){var _0x2b2c4b={},_0x4d5471={},_0x13126c={'count':0x0,'rows':[]};var _0x1f59cd=_[_0x6cb6('0x29')](db['Interval'][_0x6cb6('0x2a')],function(_0x1b7428){return{'name':_0x1b7428[_0x6cb6('0x2b')],'type':_0x1b7428['type'][_0x6cb6('0x2c')]};});_0x4d5471[_0x6cb6('0x2d')]=_[_0x6cb6('0x29')](_0x1f59cd,'name');_0x4d5471[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x124291['query']);_0x4d5471[_0x6cb6('0x30')]=_[_0x6cb6('0x31')](_0x4d5471[_0x6cb6('0x2d')],_0x4d5471[_0x6cb6('0x2e')]);_0x2b2c4b[_0x6cb6('0x32')]=_[_0x6cb6('0x31')](_0x4d5471[_0x6cb6('0x2d')],qs[_0x6cb6('0x33')](_0x124291[_0x6cb6('0x2e')][_0x6cb6('0x33')]));_0x2b2c4b['attributes']=_0x2b2c4b[_0x6cb6('0x32')][_0x6cb6('0x34')]?_0x2b2c4b[_0x6cb6('0x32')]:_0x4d5471[_0x6cb6('0x2d')];if(!_0x124291['query']['hasOwnProperty']('nolimit')){_0x2b2c4b[_0x6cb6('0x1f')]=qs[_0x6cb6('0x1f')](_0x124291[_0x6cb6('0x2e')][_0x6cb6('0x1f')]);_0x2b2c4b[_0x6cb6('0x1e')]=qs[_0x6cb6('0x1e')](_0x124291[_0x6cb6('0x2e')][_0x6cb6('0x1e')]);}_0x2b2c4b['order']=qs[_0x6cb6('0x35')](_0x124291['query'][_0x6cb6('0x35')]);_0x2b2c4b[_0x6cb6('0x36')]=qs[_0x6cb6('0x30')](_[_0x6cb6('0x37')](_0x124291[_0x6cb6('0x2e')],_0x4d5471[_0x6cb6('0x30')]),_0x1f59cd);if(_0x124291[_0x6cb6('0x2e')]['filter']){_0x2b2c4b[_0x6cb6('0x36')]=_['merge'](_0x2b2c4b[_0x6cb6('0x36')],{'$or':_[_0x6cb6('0x29')](_0x1f59cd,function(_0x3bb13d){if(_0x3bb13d['type']!=='VIRTUAL'){var _0x95392={};_0x95392[_0x3bb13d['name']]={'$like':'%'+_0x124291[_0x6cb6('0x2e')][_0x6cb6('0x38')]+'%'};return _0x95392;}})});}_0x2b2c4b=_[_0x6cb6('0x39')]({},_0x2b2c4b,_0x124291[_0x6cb6('0x3a')]);var _0x267c95={'where':_0x2b2c4b[_0x6cb6('0x36')]};return db[_0x6cb6('0x3b')]['count'](_0x267c95)[_0x6cb6('0x22')](function(_0x102c1b){_0x13126c['count']=_0x102c1b;if(_0x124291[_0x6cb6('0x2e')][_0x6cb6('0x3c')]){_0x2b2c4b[_0x6cb6('0x3d')]=[{'all':!![]}];}return db[_0x6cb6('0x3b')][_0x6cb6('0x3e')](_0x2b2c4b);})[_0x6cb6('0x22')](function(_0x571cba){_0x13126c['rows']=_0x571cba;return _0x13126c;})[_0x6cb6('0x22')](respondWithFilteredResult(_0x4d4ad9,_0x2b2c4b))['catch'](handleError(_0x4d4ad9,null));};exports['show']=function(_0x605673,_0x49beec){var _0x428d65={'raw':!![],'where':{'id':_0x605673['params']['id']}},_0x7bd70d={};_0x7bd70d['model']=_[_0x6cb6('0x2f')](db['Interval'][_0x6cb6('0x2a')]);_0x7bd70d[_0x6cb6('0x2e')]=_['keys'](_0x605673[_0x6cb6('0x2e')]);_0x7bd70d[_0x6cb6('0x3f')]=_['intersection'](_0x7bd70d[_0x6cb6('0x2d')],_0x7bd70d['query']);_0x428d65[_0x6cb6('0x32')]=_[_0x6cb6('0x31')](_0x7bd70d['model'],qs[_0x6cb6('0x33')](_0x605673[_0x6cb6('0x2e')]['fields']));_0x428d65['attributes']=_0x428d65[_0x6cb6('0x32')][_0x6cb6('0x34')]?_0x428d65[_0x6cb6('0x32')]:_0x7bd70d['model'];if(_0x605673[_0x6cb6('0x2e')][_0x6cb6('0x3c')]){_0x428d65['include']=[{'all':!![]}];}_0x428d65=_[_0x6cb6('0x39')]({},_0x428d65,_0x605673[_0x6cb6('0x3a')]);return db[_0x6cb6('0x3b')]['find'](_0x428d65)[_0x6cb6('0x22')](handleEntityNotFound(_0x49beec,null))[_0x6cb6('0x22')](respondWithResult(_0x49beec,null))[_0x6cb6('0x40')](handleError(_0x49beec,null));};exports[_0x6cb6('0x41')]=function(_0x182daa,_0x32fe78){return db['Interval'][_0x6cb6('0x41')](_0x182daa['body'],{})['then'](function(_0x29cb39){var _0x3eb117=_0x182daa['user'][_0x6cb6('0x42')]({'plain':!![]});if(!_0x3eb117)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3eb117[_0x6cb6('0x43')]===_0x6cb6('0x44')){var _0x3ed800=_0x29cb39['get']({'plain':!![]});var _0x394f72=_0x6cb6('0x45');return db[_0x6cb6('0x46')]['find']({'where':{'name':_0x394f72,'userProfileId':_0x3eb117[_0x6cb6('0x47')]},'raw':!![]})['then'](function(_0x7e4104){if(_0x7e4104&&_0x7e4104[_0x6cb6('0x48')]===0x0){return db[_0x6cb6('0x24')]['create']({'name':_0x3ed800['name'],'resourceId':_0x3ed800['id'],'type':_0x7e4104[_0x6cb6('0x27')],'sectionId':_0x7e4104['id']},{})[_0x6cb6('0x22')](function(){return _0x29cb39;});}else{return _0x29cb39;}})[_0x6cb6('0x40')](function(_0x4c08e4){logger[_0x6cb6('0x25')](_0x6cb6('0x49'),_0x4c08e4);throw _0x4c08e4;});}return _0x29cb39;})[_0x6cb6('0x22')](respondWithResult(_0x32fe78,0xc9))['catch'](handleError(_0x32fe78,null));};exports[_0x6cb6('0x4a')]=function(_0x580f0f,_0x40320e){if(_0x580f0f['body']['id']){delete _0x580f0f[_0x6cb6('0x4b')]['id'];}return db[_0x6cb6('0x3b')][_0x6cb6('0x4c')]({'where':{'id':_0x580f0f[_0x6cb6('0x4d')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x40320e,null))[_0x6cb6('0x22')](saveUpdates(_0x580f0f[_0x6cb6('0x4b')],null))[_0x6cb6('0x22')](respondWithResult(_0x40320e,null))[_0x6cb6('0x40')](handleError(_0x40320e,null));};exports[_0x6cb6('0x23')]=function(_0x2662ab,_0x52ce03){return db['Interval'][_0x6cb6('0x4c')]({'where':{'id':_0x2662ab[_0x6cb6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x52ce03,null))[_0x6cb6('0x22')](removeEntity(_0x52ce03,null))[_0x6cb6('0x40')](handleError(_0x52ce03,null));};exports['addInterval']=function(_0x18787a,_0x23eba3,_0x4ece92){if(_0x18787a['body']['id']){delete _0x18787a[_0x6cb6('0x4b')]['id'];}return db[_0x6cb6('0x3b')][_0x6cb6('0x4c')]({'where':{'id':_0x18787a[_0x6cb6('0x4d')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x23eba3,null))[_0x6cb6('0x22')](function(_0x17a461){if(_0x17a461){_0x18787a[_0x6cb6('0x4b')][_0x6cb6('0x4e')]=_0x17a461['id'];return db[_0x6cb6('0x3b')]['create'](_0x18787a[_0x6cb6('0x4b')]);}})[_0x6cb6('0x22')](respondWithResult(_0x23eba3,null))['catch'](handleError(_0x23eba3,null));};exports[_0x6cb6('0x4f')]=function(_0x555bbd,_0x5818a1,_0x3844a9){var _0x28096c={};var _0xba8fe4={};var _0x34ccd7;var _0x35688e;return db['Interval'][_0x6cb6('0x50')]({'where':{'id':_0x555bbd[_0x6cb6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5818a1,null))[_0x6cb6('0x22')](function(_0x43084b){if(_0x43084b){_0x34ccd7=_0x43084b;_0xba8fe4[_0x6cb6('0x2d')]=_['keys'](db[_0x6cb6('0x3b')][_0x6cb6('0x2a')]);_0xba8fe4[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x555bbd[_0x6cb6('0x2e')]);_0xba8fe4['filters']=_[_0x6cb6('0x31')](_0xba8fe4['model'],_0xba8fe4[_0x6cb6('0x2e')]);_0x28096c['attributes']=_[_0x6cb6('0x31')](_0xba8fe4[_0x6cb6('0x2d')],qs[_0x6cb6('0x33')](_0x555bbd[_0x6cb6('0x2e')][_0x6cb6('0x33')]));_0x28096c['attributes']=_0x28096c[_0x6cb6('0x32')][_0x6cb6('0x34')]?_0x28096c[_0x6cb6('0x32')]:_0xba8fe4[_0x6cb6('0x2d')];_0x28096c[_0x6cb6('0x51')]=qs[_0x6cb6('0x35')](_0x555bbd['query']['sort']);_0x28096c[_0x6cb6('0x36')]=qs[_0x6cb6('0x30')](_[_0x6cb6('0x37')](_0x555bbd['query'],_0xba8fe4[_0x6cb6('0x30')]));if(_0x555bbd[_0x6cb6('0x2e')][_0x6cb6('0x38')]){_0x28096c['where']=_[_0x6cb6('0x39')](_0x28096c[_0x6cb6('0x36')],{'$or':_[_0x6cb6('0x29')](_0x28096c[_0x6cb6('0x32')],function(_0x52594f){var _0xec19da={};_0xec19da[_0x52594f]={'$like':'%'+_0x555bbd['query'][_0x6cb6('0x38')]+'%'};return _0xec19da;})});}_0x28096c=_[_0x6cb6('0x39')]({},_0x28096c,_0x555bbd[_0x6cb6('0x3a')]);return _0x34ccd7['getIntervals'](_0x28096c);}})['then'](function(_0x6fad2e){if(_0x6fad2e){_0x35688e=_0x6fad2e[_0x6cb6('0x34')];if(!_0x555bbd['query'][_0x6cb6('0x52')]('nolimit')){_0x28096c[_0x6cb6('0x1f')]=qs['limit'](_0x555bbd['query']['limit']);_0x28096c[_0x6cb6('0x1e')]=qs[_0x6cb6('0x1e')](_0x555bbd[_0x6cb6('0x2e')][_0x6cb6('0x1e')]);}return _0x34ccd7['getIntervals'](_0x28096c);}})['then'](function(_0x1c136f){if(_0x1c136f){return _0x1c136f?{'count':_0x35688e,'rows':_0x1c136f}:null;}})['then'](respondWithResult(_0x5818a1,null))['catch'](handleError(_0x5818a1,null));};exports[_0x6cb6('0x53')]=function(_0x30f1f9,_0xaadf60,_0x2c0f00){return db['Interval'][_0x6cb6('0x50')]({'where':{'id':_0x30f1f9[_0x6cb6('0x4d')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0xaadf60,null))['then'](function(_0x5d262b){if(_0x5d262b){return db[_0x6cb6('0x54')]['transaction'](function(_0x3755b3){return db['Interval']['destroy']({'where':{'IntervalId':_0x30f1f9[_0x6cb6('0x4d')]['id']},'transaction':_0x3755b3})[_0x6cb6('0x22')](function(_0x2709d4){var _0x39bb7e=_[_0x6cb6('0x29')](_0x30f1f9[_0x6cb6('0x4b')],function(_0xd2db31){delete _0xd2db31['id'];_0xd2db31[_0x6cb6('0x4e')]=_0x30f1f9['params']['id'];return _0xd2db31;});return db[_0x6cb6('0x3b')][_0x6cb6('0x55')](_0x39bb7e,{'transaction':_0x3755b3});});})[_0x6cb6('0x22')](function(){return db[_0x6cb6('0x3b')][_0x6cb6('0x3e')]({'where':{'IntervalId':_0x30f1f9[_0x6cb6('0x4d')]['id']}});});}})[_0x6cb6('0x22')](respondWithResult(_0xaadf60,null))[_0x6cb6('0x40')](handleError(_0xaadf60,null));}; \ No newline at end of file +var _0xbd50=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','Interval','include','findAll','rows','params','filtears','includeAll','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update'];(function(_0x4e16e9,_0x38ed3e){var _0x48a889=function(_0x75f5aa){while(--_0x75f5aa){_0x4e16e9['push'](_0x4e16e9['shift']());}};_0x48a889(++_0x38ed3e);}(_0xbd50,0x196));var _0x0bd5=function(_0x5f0367,_0x9ba767){_0x5f0367=_0x5f0367-0x0;var _0x3868a4=_0xbd50[_0x5f0367];return _0x3868a4;};'use strict';var pdf=require(_0x0bd5('0x0'));var emlformat=require(_0x0bd5('0x1'));var rimraf=require(_0x0bd5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd5('0x3'));var rp=require(_0x0bd5('0x4'));var moment=require(_0x0bd5('0x5'));var BPromise=require(_0x0bd5('0x6'));var Mustache=require(_0x0bd5('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0bd5('0x8'));var ejs=require(_0x0bd5('0x9'));var fs=require('fs');var _=require(_0x0bd5('0xa'));var squel=require(_0x0bd5('0xb'));var crypto=require(_0x0bd5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0x8'));var querystring=require(_0x0bd5('0xd'));var Papa=require(_0x0bd5('0xe'));var Redis=require('ioredis');var authService=require(_0x0bd5('0xf'));var qs=require(_0x0bd5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bd5('0x11'));var logger=require(_0x0bd5('0x12'))('api');var utils=require(_0x0bd5('0x13'));var config=require(_0x0bd5('0x14'));var licenseUtil=require(_0x0bd5('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x0bd5('0x16'));function respondWithStatusCode(_0x23982f,_0x2f9588){_0x2f9588=_0x2f9588||0xcc;return function(_0xc5b4cd){if(_0xc5b4cd){return _0x23982f[_0x0bd5('0x17')](_0x2f9588);}return _0x23982f[_0x0bd5('0x18')](_0x2f9588)[_0x0bd5('0x19')]();};}function respondWithResult(_0x1e961d,_0x4f485b){_0x4f485b=_0x4f485b||0xc8;return function(_0x78f9b8){if(_0x78f9b8){return _0x1e961d[_0x0bd5('0x18')](_0x4f485b)['json'](_0x78f9b8);}};}function respondWithFilteredResult(_0x31349f,_0x23ef4e){return function(_0x3a34e4){if(_0x3a34e4){var _0xc22553=_0x3a34e4[_0x0bd5('0x1a')],_0x55d565=_0x23ef4e[_0x0bd5('0x1b')],_0x14f32c=_0x23ef4e[_0x0bd5('0x1b')]+_0x23ef4e[_0x0bd5('0x1c')],_0x2e4f36;if(_0x14f32c>=_0xc22553){_0x14f32c=_0xc22553;_0x2e4f36=0xc8;}else{_0x2e4f36=0xce;}_0x31349f[_0x0bd5('0x18')](_0x2e4f36);return _0x31349f[_0x0bd5('0x1d')](_0x0bd5('0x1e'),_0x55d565+'-'+_0x14f32c+'/'+_0xc22553)[_0x0bd5('0x1f')](_0x3a34e4);}return null;};}function patchUpdates(_0x27bc1e){return function(_0x415d8f){try{jsonpatch[_0x0bd5('0x20')](_0x415d8f,_0x27bc1e,!![]);}catch(_0x2dc1e5){return BPromise['reject'](_0x2dc1e5);}return _0x415d8f['save']();};}function saveUpdates(_0x596b6a,_0x4ed64e){return function(_0x47d74a){if(_0x47d74a){return _0x47d74a[_0x0bd5('0x21')](_0x596b6a)[_0x0bd5('0x22')](function(_0x13ce46){return _0x13ce46;});}return null;};}function removeEntity(_0x4a6910,_0x6ee1a8){return function(_0x4c74c9){if(_0x4c74c9){return _0x4c74c9[_0x0bd5('0x23')]()[_0x0bd5('0x22')](function(){var _0x38c21d=_0x4c74c9['get']({'plain':!![]});var _0x5b6dde='Intervals';return db['UserProfileResource'][_0x0bd5('0x23')]({'where':{'type':_0x5b6dde,'resourceId':_0x38c21d['id']}})[_0x0bd5('0x22')](function(){return _0x4c74c9;});})[_0x0bd5('0x22')](function(){_0x4a6910['status'](0xcc)[_0x0bd5('0x19')]();});}};}function handleEntityNotFound(_0x5eab3e,_0x456e87){return function(_0x3ffb08){if(!_0x3ffb08){_0x5eab3e[_0x0bd5('0x17')](0x194);}return _0x3ffb08;};}function handleError(_0x2b6b53,_0x3ff237){_0x3ff237=_0x3ff237||0x1f4;return function(_0x2023d5){logger[_0x0bd5('0x24')](_0x2023d5[_0x0bd5('0x25')]);if(_0x2023d5[_0x0bd5('0x26')]){delete _0x2023d5[_0x0bd5('0x26')];}_0x2b6b53[_0x0bd5('0x18')](_0x3ff237)[_0x0bd5('0x27')](_0x2023d5);};}exports[_0x0bd5('0x28')]=function(_0x2704ee,_0x5e5a33){var _0x461ae3={},_0x19eb75={},_0x4c799f={'count':0x0,'rows':[]};var _0x20e6c3=_[_0x0bd5('0x29')](db['Interval'][_0x0bd5('0x2a')],function(_0x1b7cf4){return{'name':_0x1b7cf4[_0x0bd5('0x2b')],'type':_0x1b7cf4[_0x0bd5('0x2c')]['key']};});_0x19eb75[_0x0bd5('0x2d')]=_[_0x0bd5('0x29')](_0x20e6c3,_0x0bd5('0x26'));_0x19eb75[_0x0bd5('0x2e')]=_[_0x0bd5('0x2f')](_0x2704ee[_0x0bd5('0x2e')]);_0x19eb75['filters']=_[_0x0bd5('0x30')](_0x19eb75['model'],_0x19eb75[_0x0bd5('0x2e')]);_0x461ae3[_0x0bd5('0x31')]=_[_0x0bd5('0x30')](_0x19eb75[_0x0bd5('0x2d')],qs[_0x0bd5('0x32')](_0x2704ee[_0x0bd5('0x2e')][_0x0bd5('0x32')]));_0x461ae3[_0x0bd5('0x31')]=_0x461ae3[_0x0bd5('0x31')][_0x0bd5('0x33')]?_0x461ae3[_0x0bd5('0x31')]:_0x19eb75[_0x0bd5('0x2d')];if(!_0x2704ee[_0x0bd5('0x2e')]['hasOwnProperty'](_0x0bd5('0x34'))){_0x461ae3[_0x0bd5('0x1c')]=qs['limit'](_0x2704ee['query'][_0x0bd5('0x1c')]);_0x461ae3[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0x2704ee[_0x0bd5('0x2e')][_0x0bd5('0x1b')]);}_0x461ae3[_0x0bd5('0x35')]=qs[_0x0bd5('0x36')](_0x2704ee[_0x0bd5('0x2e')][_0x0bd5('0x36')]);_0x461ae3[_0x0bd5('0x37')]=qs[_0x0bd5('0x38')](_[_0x0bd5('0x39')](_0x2704ee[_0x0bd5('0x2e')],_0x19eb75['filters']),_0x20e6c3);if(_0x2704ee[_0x0bd5('0x2e')]['filter']){_0x461ae3[_0x0bd5('0x37')]=_[_0x0bd5('0x3a')](_0x461ae3[_0x0bd5('0x37')],{'$or':_[_0x0bd5('0x29')](_0x20e6c3,function(_0x3fdc95){if(_0x3fdc95[_0x0bd5('0x2c')]!=='VIRTUAL'){var _0x35b4b9={};_0x35b4b9[_0x3fdc95[_0x0bd5('0x26')]]={'$like':'%'+_0x2704ee[_0x0bd5('0x2e')][_0x0bd5('0x3b')]+'%'};return _0x35b4b9;}})});}_0x461ae3=_[_0x0bd5('0x3a')]({},_0x461ae3,_0x2704ee[_0x0bd5('0x3c')]);var _0x209335={'where':_0x461ae3[_0x0bd5('0x37')]};return db[_0x0bd5('0x3d')]['count'](_0x209335)[_0x0bd5('0x22')](function(_0x554d79){_0x4c799f[_0x0bd5('0x1a')]=_0x554d79;if(_0x2704ee[_0x0bd5('0x2e')]['includeAll']){_0x461ae3[_0x0bd5('0x3e')]=[{'all':!![]}];}return db[_0x0bd5('0x3d')][_0x0bd5('0x3f')](_0x461ae3);})[_0x0bd5('0x22')](function(_0x1eff38){_0x4c799f[_0x0bd5('0x40')]=_0x1eff38;return _0x4c799f;})[_0x0bd5('0x22')](respondWithFilteredResult(_0x5e5a33,_0x461ae3))['catch'](handleError(_0x5e5a33,null));};exports['show']=function(_0x994f24,_0x545b63){var _0x5dd42b={'raw':!![],'where':{'id':_0x994f24[_0x0bd5('0x41')]['id']}},_0x28892e={};_0x28892e['model']=_['keys'](db['Interval'][_0x0bd5('0x2a')]);_0x28892e['query']=_['keys'](_0x994f24[_0x0bd5('0x2e')]);_0x28892e[_0x0bd5('0x42')]=_['intersection'](_0x28892e['model'],_0x28892e[_0x0bd5('0x2e')]);_0x5dd42b[_0x0bd5('0x31')]=_[_0x0bd5('0x30')](_0x28892e[_0x0bd5('0x2d')],qs['fields'](_0x994f24[_0x0bd5('0x2e')][_0x0bd5('0x32')]));_0x5dd42b[_0x0bd5('0x31')]=_0x5dd42b[_0x0bd5('0x31')][_0x0bd5('0x33')]?_0x5dd42b[_0x0bd5('0x31')]:_0x28892e['model'];if(_0x994f24[_0x0bd5('0x2e')][_0x0bd5('0x43')]){_0x5dd42b[_0x0bd5('0x3e')]=[{'all':!![]}];}_0x5dd42b=_['merge']({},_0x5dd42b,_0x994f24[_0x0bd5('0x3c')]);return db[_0x0bd5('0x3d')][_0x0bd5('0x44')](_0x5dd42b)['then'](handleEntityNotFound(_0x545b63,null))[_0x0bd5('0x22')](respondWithResult(_0x545b63,null))[_0x0bd5('0x45')](handleError(_0x545b63,null));};exports[_0x0bd5('0x46')]=function(_0x18c7c7,_0x4399ba){return db['Interval'][_0x0bd5('0x46')](_0x18c7c7[_0x0bd5('0x47')],{})['then'](function(_0x2db9b0){var _0x20960a=_0x18c7c7[_0x0bd5('0x48')][_0x0bd5('0x49')]({'plain':!![]});if(!_0x20960a)throw new Error(_0x0bd5('0x4a'));if(_0x20960a['role']===_0x0bd5('0x48')){var _0x128df9=_0x2db9b0['get']({'plain':!![]});var _0x70d7ce='Intervals';return db[_0x0bd5('0x4b')][_0x0bd5('0x44')]({'where':{'name':_0x70d7ce,'userProfileId':_0x20960a[_0x0bd5('0x4c')]},'raw':!![]})[_0x0bd5('0x22')](function(_0x5f54bb){if(_0x5f54bb&&_0x5f54bb[_0x0bd5('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x128df9[_0x0bd5('0x26')],'resourceId':_0x128df9['id'],'type':_0x5f54bb[_0x0bd5('0x26')],'sectionId':_0x5f54bb['id']},{})[_0x0bd5('0x22')](function(){return _0x2db9b0;});}else{return _0x2db9b0;}})['catch'](function(_0x424187){logger['error'](_0x0bd5('0x4e'),_0x424187);throw _0x424187;});}return _0x2db9b0;})[_0x0bd5('0x22')](respondWithResult(_0x4399ba,0xc9))[_0x0bd5('0x45')](handleError(_0x4399ba,null));};exports['update']=function(_0x512fe3,_0x4f0467){if(_0x512fe3[_0x0bd5('0x47')]['id']){delete _0x512fe3[_0x0bd5('0x47')]['id'];}return db[_0x0bd5('0x3d')]['find']({'where':{'id':_0x512fe3[_0x0bd5('0x41')]['id']}})[_0x0bd5('0x22')](handleEntityNotFound(_0x4f0467,null))['then'](saveUpdates(_0x512fe3[_0x0bd5('0x47')],null))['then'](respondWithResult(_0x4f0467,null))['catch'](handleError(_0x4f0467,null));};exports[_0x0bd5('0x23')]=function(_0x1e5b5e,_0xe07a97){return db[_0x0bd5('0x3d')]['find']({'where':{'id':_0x1e5b5e[_0x0bd5('0x41')]['id']}})[_0x0bd5('0x22')](handleEntityNotFound(_0xe07a97,null))[_0x0bd5('0x22')](removeEntity(_0xe07a97,null))['catch'](handleError(_0xe07a97,null));};exports[_0x0bd5('0x4f')]=function(_0x4093e8,_0x374701,_0x4851fb){if(_0x4093e8['body']['id']){delete _0x4093e8[_0x0bd5('0x47')]['id'];}return db['Interval'][_0x0bd5('0x44')]({'where':{'id':_0x4093e8[_0x0bd5('0x41')]['id']}})[_0x0bd5('0x22')](handleEntityNotFound(_0x374701,null))['then'](function(_0x9b0dc5){if(_0x9b0dc5){_0x4093e8[_0x0bd5('0x47')][_0x0bd5('0x50')]=_0x9b0dc5['id'];return db[_0x0bd5('0x3d')]['create'](_0x4093e8[_0x0bd5('0x47')]);}})[_0x0bd5('0x22')](respondWithResult(_0x374701,null))[_0x0bd5('0x45')](handleError(_0x374701,null));};exports[_0x0bd5('0x51')]=function(_0xf545c2,_0x478faa,_0xd651f2){var _0x4e6b26={};var _0x9bf551={};var _0x5d6cb3;var _0x572996;return db[_0x0bd5('0x3d')]['findOne']({'where':{'id':_0xf545c2[_0x0bd5('0x41')]['id']}})[_0x0bd5('0x22')](handleEntityNotFound(_0x478faa,null))[_0x0bd5('0x22')](function(_0x5c84f9){if(_0x5c84f9){_0x5d6cb3=_0x5c84f9;_0x9bf551[_0x0bd5('0x2d')]=_[_0x0bd5('0x2f')](db['Interval'][_0x0bd5('0x2a')]);_0x9bf551[_0x0bd5('0x2e')]=_['keys'](_0xf545c2[_0x0bd5('0x2e')]);_0x9bf551['filters']=_[_0x0bd5('0x30')](_0x9bf551[_0x0bd5('0x2d')],_0x9bf551[_0x0bd5('0x2e')]);_0x4e6b26[_0x0bd5('0x31')]=_[_0x0bd5('0x30')](_0x9bf551[_0x0bd5('0x2d')],qs[_0x0bd5('0x32')](_0xf545c2['query'][_0x0bd5('0x32')]));_0x4e6b26[_0x0bd5('0x31')]=_0x4e6b26[_0x0bd5('0x31')]['length']?_0x4e6b26['attributes']:_0x9bf551[_0x0bd5('0x2d')];_0x4e6b26[_0x0bd5('0x35')]=qs[_0x0bd5('0x36')](_0xf545c2[_0x0bd5('0x2e')][_0x0bd5('0x36')]);_0x4e6b26[_0x0bd5('0x37')]=qs[_0x0bd5('0x38')](_[_0x0bd5('0x39')](_0xf545c2[_0x0bd5('0x2e')],_0x9bf551[_0x0bd5('0x38')]));if(_0xf545c2[_0x0bd5('0x2e')][_0x0bd5('0x3b')]){_0x4e6b26[_0x0bd5('0x37')]=_[_0x0bd5('0x3a')](_0x4e6b26[_0x0bd5('0x37')],{'$or':_[_0x0bd5('0x29')](_0x4e6b26[_0x0bd5('0x31')],function(_0x15e2be){var _0x56aa05={};_0x56aa05[_0x15e2be]={'$like':'%'+_0xf545c2[_0x0bd5('0x2e')][_0x0bd5('0x3b')]+'%'};return _0x56aa05;})});}_0x4e6b26=_['merge']({},_0x4e6b26,_0xf545c2[_0x0bd5('0x3c')]);return _0x5d6cb3['getIntervals'](_0x4e6b26);}})[_0x0bd5('0x22')](function(_0xd80562){if(_0xd80562){_0x572996=_0xd80562['length'];if(!_0xf545c2[_0x0bd5('0x2e')][_0x0bd5('0x52')](_0x0bd5('0x34'))){_0x4e6b26[_0x0bd5('0x1c')]=qs[_0x0bd5('0x1c')](_0xf545c2[_0x0bd5('0x2e')][_0x0bd5('0x1c')]);_0x4e6b26[_0x0bd5('0x1b')]=qs[_0x0bd5('0x1b')](_0xf545c2['query'][_0x0bd5('0x1b')]);}return _0x5d6cb3[_0x0bd5('0x51')](_0x4e6b26);}})['then'](function(_0x37d210){if(_0x37d210){return _0x37d210?{'count':_0x572996,'rows':_0x37d210}:null;}})[_0x0bd5('0x22')](respondWithResult(_0x478faa,null))['catch'](handleError(_0x478faa,null));};exports[_0x0bd5('0x53')]=function(_0x333303,_0x4ef0f7,_0x91731d){return db['Interval'][_0x0bd5('0x54')]({'where':{'id':_0x333303[_0x0bd5('0x41')]['id']}})[_0x0bd5('0x22')](handleEntityNotFound(_0x4ef0f7,null))[_0x0bd5('0x22')](function(_0x27fde3){if(_0x27fde3){return db[_0x0bd5('0x55')][_0x0bd5('0x56')](function(_0x367fae){return db[_0x0bd5('0x3d')][_0x0bd5('0x23')]({'where':{'IntervalId':_0x333303[_0x0bd5('0x41')]['id']},'transaction':_0x367fae})[_0x0bd5('0x22')](function(_0x347947){var _0x113e55=_['map'](_0x333303[_0x0bd5('0x47')],function(_0x2bf49b){delete _0x2bf49b['id'];_0x2bf49b[_0x0bd5('0x50')]=_0x333303[_0x0bd5('0x41')]['id'];return _0x2bf49b;});return db[_0x0bd5('0x3d')][_0x0bd5('0x57')](_0x113e55,{'transaction':_0x367fae});});})['then'](function(){return db[_0x0bd5('0x3d')][_0x0bd5('0x3f')]({'where':{'IntervalId':_0x333303[_0x0bd5('0x41')]['id']}});});}})[_0x0bd5('0x22')](respondWithResult(_0x4ef0f7,null))[_0x0bd5('0x45')](handleError(_0x4ef0f7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index bb3f763..995f940 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 _0x47e8=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1bba92,_0x367091){var _0x38f551=function(_0x59d764){while(--_0x59d764){_0x1bba92['push'](_0x1bba92['shift']());}};_0x38f551(++_0x367091);}(_0x47e8,0x6e));var _0x847e=function(_0x3c81b5,_0x3f5ed7){_0x3c81b5=_0x3c81b5-0x0;var _0x5888c4=_0x47e8[_0x3c81b5];return _0x5888c4;};'use strict';var _=require('lodash');var util=require(_0x847e('0x0'));var logger=require(_0x847e('0x1'))('api');var moment=require(_0x847e('0x2'));var BPromise=require(_0x847e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x847e('0x4'));var rimraf=require(_0x847e('0x5'));var config=require(_0x847e('0x6'));var attributes=require(_0x847e('0x7'));var extensions=require(_0x847e('0x8'));module[_0x847e('0x9')]=function(_0x81320f,_0x138ea5){return _0x81320f[_0x847e('0xa')](_0x847e('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x27bf0f,_0x53797b){extensions['rewrite'](_0x81320f,_0x27bf0f);},'afterBulkCreate':function(_0x40bc5a,_0x5bca78,_0x58b9cd){_0x58b9cd();extensions['rewrite'](_0x81320f,_0x40bc5a[0x0]);},'afterUpdate':function(_0x25752d,_0x245989){extensions[_0x847e('0xc')](_0x81320f,_0x25752d);},'afterDestroy':function(_0x1f606d,_0x1e33ba){extensions[_0x847e('0xc')](_0x81320f,_0x1f606d);}}});}; \ No newline at end of file +var _0x42cb=['tools_intervals','rewrite','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','Interval'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x42cb,0x178));var _0xb42c=function(_0x289cff,_0x371fd1){_0x289cff=_0x289cff-0x0;var _0x4330b7=_0x42cb[_0x289cff];return _0x4330b7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb42c('0x0'))('api');var moment=require(_0xb42c('0x1'));var BPromise=require('bluebird');var rp=require(_0xb42c('0x2'));var fs=require('fs');var path=require(_0xb42c('0x3'));var rimraf=require(_0xb42c('0x4'));var config=require(_0xb42c('0x5'));var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');module[_0xb42c('0x6')]=function(_0x6f50a9,_0x14745c){return _0x6f50a9[_0xb42c('0x7')](_0xb42c('0x8'),attributes,{'tableName':_0xb42c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c0806,_0x1a2f25){extensions[_0xb42c('0xa')](_0x6f50a9,_0x3c0806);},'afterBulkCreate':function(_0x930733,_0x2d0ff5,_0x21080c){_0x21080c();extensions[_0xb42c('0xa')](_0x6f50a9,_0x930733[0x0]);},'afterUpdate':function(_0xf3f1a9,_0x4b563e){extensions[_0xb42c('0xa')](_0x6f50a9,_0xf3f1a9);},'afterDestroy':function(_0x113442,_0x311d20){extensions[_0xb42c('0xa')](_0x6f50a9,_0x113442);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7cfd1db..239c3e7 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 _0x3de9=['findAll','options','raw','where','attributes','limit','include','map','model','ShowInterval','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s','message','catch','GetInterval','Interval'];(function(_0x50a4d4,_0x3226a0){var _0x37e9e4=function(_0x282e69){while(--_0x282e69){_0x50a4d4['push'](_0x50a4d4['shift']());}};_0x37e9e4(++_0x3226a0);}(_0x3de9,0x1a3));var _0x93de=function(_0x5781f5,_0x39876d){_0x5781f5=_0x5781f5-0x0;var _0x59b3a0=_0x3de9[_0x5781f5];return _0x59b3a0;};'use strict';var _=require(_0x93de('0x0'));var util=require('util');var moment=require(_0x93de('0x1'));var BPromise=require(_0x93de('0x2'));var rs=require(_0x93de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93de('0x4'))['db'];var utils=require(_0x93de('0x5'));var logger=require('../../config/logger')(_0x93de('0x6'));var config=require(_0x93de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93de('0x8')][_0x93de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x519e11,_0x218f77,_0x515160){return new BPromise(function(_0x48c67e,_0x5be4cb){return client[_0x93de('0xa')](_0x519e11,_0x515160)[_0x93de('0xb')](function(_0x5abbed){logger[_0x93de('0xc')]('Interval,\x20%s,\x20%s',_0x218f77,_0x93de('0xd'));logger[_0x93de('0xe')](_0x93de('0xf'),_0x218f77,_0x93de('0xd'),JSON['stringify'](_0x5abbed));if(_0x5abbed[_0x93de('0x10')]){if(_0x5abbed[_0x93de('0x10')][_0x93de('0x11')]===0x1f4){logger[_0x93de('0x10')](_0x93de('0x12'),_0x218f77,_0x5abbed[_0x93de('0x10')][_0x93de('0x13')]);return _0x5be4cb(_0x5abbed['error'][_0x93de('0x13')]);}logger[_0x93de('0x10')](_0x93de('0x12'),_0x218f77,_0x5abbed[_0x93de('0x10')][_0x93de('0x13')]);return _0x48c67e(_0x5abbed[_0x93de('0x10')][_0x93de('0x13')]);}else{logger[_0x93de('0xc')](_0x93de('0x12'),_0x218f77,_0x93de('0xd'));_0x48c67e(_0x5abbed['result']['message']);}})[_0x93de('0x14')](function(_0x21d24a){logger[_0x93de('0x10')]('Interval,\x20%s,\x20%s',_0x218f77,_0x21d24a);_0x5be4cb(_0x21d24a);});});}exports[_0x93de('0x15')]=function(_0x4b22a2){var _0x135945=this;return new Promise(function(_0x146c43,_0x49e8f8){return db[_0x93de('0x16')][_0x93de('0x17')]({'raw':_0x4b22a2[_0x93de('0x18')]?_0x4b22a2[_0x93de('0x18')][_0x93de('0x19')]===undefined?!![]:![]:!![],'where':_0x4b22a2[_0x93de('0x18')]?_0x4b22a2[_0x93de('0x18')][_0x93de('0x1a')]||null:null,'attributes':_0x4b22a2['options']?_0x4b22a2[_0x93de('0x18')][_0x93de('0x1b')]||null:null,'limit':_0x4b22a2[_0x93de('0x18')]?_0x4b22a2[_0x93de('0x18')][_0x93de('0x1c')]||null:null,'include':_0x4b22a2[_0x93de('0x18')]?_0x4b22a2['options'][_0x93de('0x1d')]?_[_0x93de('0x1e')](_0x4b22a2['options'][_0x93de('0x1d')],function(_0x46dc92){return{'model':db[_0x46dc92[_0x93de('0x1f')]],'as':_0x46dc92['as'],'attributes':_0x46dc92['attributes'],'include':_0x46dc92[_0x93de('0x1d')]?_[_0x93de('0x1e')](_0x46dc92['include'],function(_0x3d7e41){return{'model':db[_0x3d7e41['model']],'as':_0x3d7e41['as'],'attributes':_0x3d7e41[_0x93de('0x1b')],'include':_0x3d7e41[_0x93de('0x1d')]?_['map'](_0x3d7e41['include'],function(_0x26fdb3){return{'model':db[_0x26fdb3[_0x93de('0x1f')]],'as':_0x26fdb3['as'],'attributes':_0x26fdb3[_0x93de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x93de('0xb')](function(_0x1ad595){logger[_0x93de('0xc')]('GetInterval',_0x4b22a2);logger[_0x93de('0xe')](_0x93de('0x15'),_0x4b22a2,JSON['stringify'](_0x1ad595));_0x146c43(_0x1ad595);})['catch'](function(_0x13dd9a){logger[_0x93de('0x10')]('GetInterval',_0x13dd9a[_0x93de('0x13')],_0x4b22a2);_0x49e8f8(_0x135945[_0x93de('0x10')](0x1f4,_0x13dd9a['message']));});});};exports[_0x93de('0x20')]=function(_0x29d8e0){var _0xbbede3=this;return new Promise(function(_0x41c221,_0x303fa5){return db[_0x93de('0x16')][_0x93de('0x21')]({'raw':_0x29d8e0[_0x93de('0x18')]?_0x29d8e0['options']['raw']===undefined?!![]:![]:!![],'where':_0x29d8e0[_0x93de('0x18')]?_0x29d8e0[_0x93de('0x18')][_0x93de('0x1a')]||null:null,'attributes':_0x29d8e0[_0x93de('0x18')]?_0x29d8e0[_0x93de('0x18')]['attributes']||null:null,'include':_0x29d8e0[_0x93de('0x18')]?_0x29d8e0['options'][_0x93de('0x1d')]?_[_0x93de('0x1e')](_0x29d8e0[_0x93de('0x18')][_0x93de('0x1d')],function(_0x5c3df6){return{'model':db[_0x5c3df6['model']],'as':_0x5c3df6['as'],'attributes':_0x5c3df6['attributes'],'include':_0x5c3df6['include']?_[_0x93de('0x1e')](_0x5c3df6[_0x93de('0x1d')],function(_0x12e6ce){return{'model':db[_0x12e6ce[_0x93de('0x1f')]],'as':_0x12e6ce['as'],'attributes':_0x12e6ce[_0x93de('0x1b')],'include':_0x12e6ce['include']?_[_0x93de('0x1e')](_0x12e6ce[_0x93de('0x1d')],function(_0x51aae4){return{'model':db[_0x51aae4[_0x93de('0x1f')]],'as':_0x51aae4['as'],'attributes':_0x51aae4[_0x93de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x93de('0xb')](function(_0x477411){logger[_0x93de('0xc')]('ShowInterval',_0x29d8e0);logger['debug']('ShowInterval',_0x29d8e0,JSON['stringify'](_0x477411));_0x41c221(_0x477411);})['catch'](function(_0x271602){logger[_0x93de('0x10')](_0x93de('0x20'),_0x271602[_0x93de('0x13')],_0x29d8e0);_0x303fa5(_0xbbede3[_0x93de('0x10')](0x1f4,_0x271602['message']));});});}; \ No newline at end of file +var _0xb3af=['Interval','findAll','options','attributes','include','map','model','GetInterval','ShowInterval','find','where','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','Interval,\x20%s,\x20%s','debug','Interval,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x575db1,_0x3f17d7){var _0x314da4=function(_0x1caa11){while(--_0x1caa11){_0x575db1['push'](_0x575db1['shift']());}};_0x314da4(++_0x3f17d7);}(_0xb3af,0x141));var _0xfb3a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb3af[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xfb3a('0x0'));var util=require(_0xfb3a('0x1'));var moment=require(_0xfb3a('0x2'));var BPromise=require(_0xfb3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb3a('0x4'));var logger=require(_0xfb3a('0x5'))(_0xfb3a('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb3a('0x7'));var client=jayson['client'][_0xfb3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5696b0,_0x1fd274,_0x381c00){return new BPromise(function(_0x28bcaf,_0x1aeb5d){return client['request'](_0x5696b0,_0x381c00)[_0xfb3a('0x9')](function(_0x451499){logger[_0xfb3a('0xa')](_0xfb3a('0xb'),_0x1fd274,'request\x20sent');logger[_0xfb3a('0xc')](_0xfb3a('0xd'),_0x1fd274,_0xfb3a('0xe'),JSON[_0xfb3a('0xf')](_0x451499));if(_0x451499[_0xfb3a('0x10')]){if(_0x451499[_0xfb3a('0x10')]['code']===0x1f4){logger['error'](_0xfb3a('0xb'),_0x1fd274,_0x451499[_0xfb3a('0x10')][_0xfb3a('0x11')]);return _0x1aeb5d(_0x451499[_0xfb3a('0x10')][_0xfb3a('0x11')]);}logger[_0xfb3a('0x10')]('Interval,\x20%s,\x20%s',_0x1fd274,_0x451499[_0xfb3a('0x10')][_0xfb3a('0x11')]);return _0x28bcaf(_0x451499[_0xfb3a('0x10')][_0xfb3a('0x11')]);}else{logger[_0xfb3a('0xa')]('Interval,\x20%s,\x20%s',_0x1fd274,_0xfb3a('0xe'));_0x28bcaf(_0x451499[_0xfb3a('0x12')][_0xfb3a('0x11')]);}})[_0xfb3a('0x13')](function(_0x537a76){logger[_0xfb3a('0x10')](_0xfb3a('0xb'),_0x1fd274,_0x537a76);_0x1aeb5d(_0x537a76);});});}exports['GetInterval']=function(_0x12213f){var _0x1fc271=this;return new Promise(function(_0x33f1e7,_0x1d6a0f){return db[_0xfb3a('0x14')][_0xfb3a('0x15')]({'raw':_0x12213f['options']?_0x12213f[_0xfb3a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x12213f['options']?_0x12213f[_0xfb3a('0x16')]['where']||null:null,'attributes':_0x12213f[_0xfb3a('0x16')]?_0x12213f[_0xfb3a('0x16')][_0xfb3a('0x17')]||null:null,'limit':_0x12213f[_0xfb3a('0x16')]?_0x12213f[_0xfb3a('0x16')]['limit']||null:null,'include':_0x12213f[_0xfb3a('0x16')]?_0x12213f[_0xfb3a('0x16')][_0xfb3a('0x18')]?_[_0xfb3a('0x19')](_0x12213f[_0xfb3a('0x16')][_0xfb3a('0x18')],function(_0x288fed){return{'model':db[_0x288fed['model']],'as':_0x288fed['as'],'attributes':_0x288fed[_0xfb3a('0x17')],'include':_0x288fed['include']?_[_0xfb3a('0x19')](_0x288fed['include'],function(_0x418f99){return{'model':db[_0x418f99[_0xfb3a('0x1a')]],'as':_0x418f99['as'],'attributes':_0x418f99['attributes'],'include':_0x418f99[_0xfb3a('0x18')]?_['map'](_0x418f99[_0xfb3a('0x18')],function(_0x43652d){return{'model':db[_0x43652d[_0xfb3a('0x1a')]],'as':_0x43652d['as'],'attributes':_0x43652d[_0xfb3a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cf695){logger['info']('GetInterval',_0x12213f);logger['debug'](_0xfb3a('0x1b'),_0x12213f,JSON[_0xfb3a('0xf')](_0x3cf695));_0x33f1e7(_0x3cf695);})[_0xfb3a('0x13')](function(_0x41272e){logger[_0xfb3a('0x10')](_0xfb3a('0x1b'),_0x41272e['message'],_0x12213f);_0x1d6a0f(_0x1fc271[_0xfb3a('0x10')](0x1f4,_0x41272e[_0xfb3a('0x11')]));});});};exports[_0xfb3a('0x1c')]=function(_0x11e6d7){var _0x20d80e=this;return new Promise(function(_0x441546,_0x155b9b){return db['Interval'][_0xfb3a('0x1d')]({'raw':_0x11e6d7[_0xfb3a('0x16')]?_0x11e6d7[_0xfb3a('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x11e6d7['options']?_0x11e6d7[_0xfb3a('0x16')][_0xfb3a('0x1e')]||null:null,'attributes':_0x11e6d7['options']?_0x11e6d7[_0xfb3a('0x16')]['attributes']||null:null,'include':_0x11e6d7[_0xfb3a('0x16')]?_0x11e6d7[_0xfb3a('0x16')][_0xfb3a('0x18')]?_[_0xfb3a('0x19')](_0x11e6d7['options'][_0xfb3a('0x18')],function(_0x4590a8){return{'model':db[_0x4590a8[_0xfb3a('0x1a')]],'as':_0x4590a8['as'],'attributes':_0x4590a8['attributes'],'include':_0x4590a8[_0xfb3a('0x18')]?_['map'](_0x4590a8['include'],function(_0x2a0a41){return{'model':db[_0x2a0a41[_0xfb3a('0x1a')]],'as':_0x2a0a41['as'],'attributes':_0x2a0a41[_0xfb3a('0x17')],'include':_0x2a0a41[_0xfb3a('0x18')]?_[_0xfb3a('0x19')](_0x2a0a41[_0xfb3a('0x18')],function(_0x453a57){return{'model':db[_0x453a57[_0xfb3a('0x1a')]],'as':_0x453a57['as'],'attributes':_0x453a57[_0xfb3a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfb3a('0x9')](function(_0x40857b){logger[_0xfb3a('0xa')](_0xfb3a('0x1c'),_0x11e6d7);logger['debug'](_0xfb3a('0x1c'),_0x11e6d7,JSON[_0xfb3a('0xf')](_0x40857b));_0x441546(_0x40857b);})[_0xfb3a('0x13')](function(_0x12c17e){logger['error'](_0xfb3a('0x1c'),_0x12c17e['message'],_0x11e6d7);_0x155b9b(_0x20d80e['error'](0x1f4,_0x12c17e[_0xfb3a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 2a005e3..478eb06 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 _0x133a=['../../components/auth/service','./jira.controller','post','send','exports','Router'];(function(_0x2a1a16,_0x4e150c){var _0x421e6d=function(_0x1d1921){while(--_0x1d1921){_0x2a1a16['push'](_0x2a1a16['shift']());}};_0x421e6d(++_0x4e150c);}(_0x133a,0xcb));var _0xa133=function(_0x2bc7c6,_0x1881a5){_0x2bc7c6=_0x2bc7c6-0x0;var _0x540b1d=_0x133a[_0x2bc7c6];return _0x540b1d;};'use strict';var express=require('express');var router=express[_0xa133('0x0')]();var auth=require(_0xa133('0x1'));var controller=require(_0xa133('0x2'));router[_0xa133('0x3')]('/',auth['isAuthenticated'](),controller[_0xa133('0x4')]);module[_0xa133('0x5')]=router; \ No newline at end of file +var _0xdfcf=['Router','../../components/auth/service','post','send','exports','express'];(function(_0x5538b1,_0x45c1ef){var _0x31deff=function(_0xd1ac9b){while(--_0xd1ac9b){_0x5538b1['push'](_0x5538b1['shift']());}};_0x31deff(++_0x45c1ef);}(_0xdfcf,0x1df));var _0xfdfc=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xdfcf[_0x5a95fa];return _0x1a61b8;};'use strict';var express=require(_0xfdfc('0x0'));var router=express[_0xfdfc('0x1')]();var auth=require(_0xfdfc('0x2'));var controller=require('./jira.controller');router[_0xfdfc('0x3')]('/',auth['isAuthenticated'](),controller[_0xfdfc('0x4')]);module[_0xfdfc('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index dd60c19..1149c6f 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 _0x6154=['openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','setEncoding','utf8','data','end','error','status','json','write'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x6154,0x14f));var _0x4615=function(_0x2f4331,_0x59a49f){_0x2f4331=_0x2f4331-0x0;var _0xb7289e=_0x6154[_0x2f4331];return _0xb7289e;};'use strict';var BPromise=require('bluebird');var https=require(_0x4615('0x0'));var logger=require(_0x4615('0x1'))(_0x4615('0x2'));var USERNAME=_0x4615('0x3');var PASSWORD=_0x4615('0x4');function openIssue(_0x166596,_0x5d28aa){var _0x52d8ee={'fields':{'project':{'key':_0x166596['key']||'MOTGUI'},'summary':(_0x166596[_0x4615('0x5')]||_0x4615('0x6'))+_0x4615('0x7')+_0x166596['ip'],'description':_0x166596[_0x4615('0x8')]||JSON[_0x4615('0x9')](_0x166596),'issuetype':{'name':_0x166596[_0x4615('0xa')]||_0x4615('0xb')}}};_0x52d8ee[_0x4615('0xc')][_0x4615('0xd')]=_0x166596[_0x4615('0xe')];_0x52d8ee[_0x4615('0xc')][_0x4615('0xf')]=_0x166596['oldToken'];_0x52d8ee[_0x4615('0xc')][_0x4615('0x10')]=_0x166596[_0x4615('0x11')];_0x52d8ee['fields'][_0x4615('0x12')]=_0x166596[_0x4615('0x13')];_0x52d8ee['fields'][_0x4615('0x14')]=_0x166596['reason'];_0x52d8ee[_0x4615('0xc')][_0x4615('0x15')]=_0x166596['ip'];var _0x4d78e9={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x4615('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x4615('0x17'),'Authorization':_0x4615('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x4615('0x19')]('base64')}};var _0x2e566f=JSON[_0x4615('0x9')](_0x52d8ee);var _0x3b4287=https['request'](_0x4d78e9,function(_0x1bd17d){_0x1bd17d[_0x4615('0x1a')](_0x4615('0x1b'));var _0x59fdb2='';_0x1bd17d['on'](_0x4615('0x1c'),function(_0x53d3d5){_0x59fdb2+=_0x53d3d5;});_0x1bd17d['on'](_0x4615('0x1d'),function(){if(_0x5d28aa){return _0x5d28aa['status'](_0x1bd17d['statusCode'])['json'](JSON['parse'](_0x59fdb2));}});});_0x3b4287['on'](_0x4615('0x1e'),function(_0x23d4b7){if(_0x5d28aa){return _0x5d28aa[_0x4615('0x1f')](0x1f4)[_0x4615('0x20')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x3b4287[_0x4615('0x21')](_0x2e566f);_0x3b4287[_0x4615('0x1d')]();}exports[_0x4615('0x22')]=openIssue;exports[_0x4615('0x23')]=function(_0x4d7d8c,_0x59eb84){_0x4d7d8c[_0x4615('0x24')]['ip']=_0x4d7d8c['headers'][_0x4615('0x25')]||_0x4d7d8c[_0x4615('0x26')][_0x4615('0x27')]||_0x4d7d8c['socket'][_0x4615('0x27')]||_0x4d7d8c[_0x4615('0x26')][_0x4615('0x28')]['remoteAddress'];return openIssue(_0x4d7d8c[_0x4615('0x24')],_0x59eb84);}; \ No newline at end of file +var _0xea68=['name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xea68,0xa2));var _0x8ea6=function(_0x361802,_0x319112){_0x361802=_0x361802-0x0;var _0x1bf1f7=_0xea68[_0x361802];return _0x1bf1f7;};'use strict';var BPromise=require(_0x8ea6('0x0'));var https=require(_0x8ea6('0x1'));var logger=require(_0x8ea6('0x2'))(_0x8ea6('0x3'));var USERNAME='support';var PASSWORD=_0x8ea6('0x4');function openIssue(_0xd3b569,_0x4d70ac){var _0x10c3bb={'fields':{'project':{'key':_0xd3b569[_0x8ea6('0x5')]||_0x8ea6('0x6')},'summary':(_0xd3b569[_0x8ea6('0x7')]||_0x8ea6('0x8'))+_0x8ea6('0x9')+_0xd3b569['ip'],'description':_0xd3b569[_0x8ea6('0xa')]||JSON['stringify'](_0xd3b569),'issuetype':{'name':_0xd3b569['issuetype']||'Bug'}}};_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0xc')]=_0xd3b569[_0x8ea6('0xd')];_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0xe')]=_0xd3b569[_0x8ea6('0xf')];_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0x10')]=_0xd3b569['newToken'];_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0x11')]=_0xd3b569[_0x8ea6('0x12')];_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0x13')]=_0xd3b569[_0x8ea6('0x14')];_0x10c3bb[_0x8ea6('0xb')][_0x8ea6('0x15')]=_0xd3b569['ip'];var _0x4bb25d={'host':_0x8ea6('0x16'),'port':0x1bb,'path':_0x8ea6('0x17'),'method':_0x8ea6('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x8ea6('0x19'),'Authorization':_0x8ea6('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x8ea6('0x1b'))}};var _0x1db967=JSON[_0x8ea6('0x1c')](_0x10c3bb);var _0x3633ed=https['request'](_0x4bb25d,function(_0x1f8144){_0x1f8144[_0x8ea6('0x1d')](_0x8ea6('0x1e'));var _0x2a1d17='';_0x1f8144['on'](_0x8ea6('0x1f'),function(_0x408e8d){_0x2a1d17+=_0x408e8d;});_0x1f8144['on'](_0x8ea6('0x20'),function(){if(_0x4d70ac){return _0x4d70ac[_0x8ea6('0x21')](_0x1f8144['statusCode'])[_0x8ea6('0x22')](JSON[_0x8ea6('0x23')](_0x2a1d17));}});});_0x3633ed['on'](_0x8ea6('0x24'),function(_0x53841e){if(_0x4d70ac){return _0x4d70ac[_0x8ea6('0x21')](0x1f4)[_0x8ea6('0x22')]({'errors':[{'message':_0x8ea6('0x25'),'type':_0x8ea6('0x26')}]});}});_0x3633ed[_0x8ea6('0x27')](_0x1db967);_0x3633ed['end']();}exports['openIssue']=openIssue;exports[_0x8ea6('0x28')]=function(_0x17cce7,_0x121f64){_0x17cce7['body']['ip']=_0x17cce7[_0x8ea6('0x29')]['x-forwarded-for']||_0x17cce7[_0x8ea6('0x2a')][_0x8ea6('0x2b')]||_0x17cce7[_0x8ea6('0x2c')][_0x8ea6('0x2b')]||_0x17cce7[_0x8ea6('0x2a')][_0x8ea6('0x2c')][_0x8ea6('0x2b')];return openIssue(_0x17cce7['body'],_0x121f64);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 39d96ef..09ea5f2 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 _0xb695=['/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe'];(function(_0x2e9368,_0x152cf2){var _0x1dba72=function(_0xc1c8e9){while(--_0xc1c8e9){_0x2e9368['push'](_0x2e9368['shift']());}};_0x1dba72(++_0x152cf2);}(_0xb695,0x97));var _0x5b69=function(_0x39303a,_0x5ab9aa){_0x39303a=_0x39303a-0x0;var _0x1f9f88=_0xb695[_0x39303a];return _0x1f9f88;};'use strict';var multer=require(_0x5b69('0x0'));var util=require(_0x5b69('0x1'));var path=require(_0x5b69('0x2'));var timeout=require(_0x5b69('0x3'));var express=require('express');var router=express[_0x5b69('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5b69('0x5'));var config=require('../../config/environment');var controller=require(_0x5b69('0x6'));router[_0x5b69('0x7')]('/',auth[_0x5b69('0x8')](),controller[_0x5b69('0x9')]);router[_0x5b69('0x7')]('/describe',auth[_0x5b69('0x8')](),controller[_0x5b69('0xa')]);router[_0x5b69('0x7')](_0x5b69('0xb'),auth['isAuthenticated'](),controller[_0x5b69('0xc')]);router[_0x5b69('0xd')]('/',auth[_0x5b69('0x8')](),controller[_0x5b69('0xe')]);router[_0x5b69('0xf')]('/:id',auth[_0x5b69('0x8')](),controller['update']);router['delete'](_0x5b69('0xb'),auth['isAuthenticated'](),controller[_0x5b69('0x10')]);module[_0x5b69('0x11')]=router; \ No newline at end of file +var _0xc447=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x53070d,_0x2249a5){var _0x36fdf0=function(_0x22e0ad){while(--_0x22e0ad){_0x53070d['push'](_0x53070d['shift']());}};_0x36fdf0(++_0x2249a5);}(_0xc447,0xac));var _0x7c44=function(_0x53d76c,_0x39bb65){_0x53d76c=_0x53d76c-0x0;var _0x5b7181=_0xc447[_0x53d76c];return _0x5b7181;};'use strict';var multer=require(_0x7c44('0x0'));var util=require(_0x7c44('0x1'));var path=require(_0x7c44('0x2'));var timeout=require(_0x7c44('0x3'));var express=require(_0x7c44('0x4'));var router=express[_0x7c44('0x5')]();var auth=require(_0x7c44('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7c44('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x7c44('0x8')]('/',auth[_0x7c44('0x9')](),controller['index']);router[_0x7c44('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7c44('0xa')]);router[_0x7c44('0x8')](_0x7c44('0xb'),auth[_0x7c44('0x9')](),controller['show']);router[_0x7c44('0xc')]('/',auth[_0x7c44('0x9')](),controller[_0x7c44('0xd')]);router[_0x7c44('0xe')]('/:id',auth[_0x7c44('0x9')](),controller[_0x7c44('0xf')]);router[_0x7c44('0x10')](_0x7c44('0xb'),auth[_0x7c44('0x9')](),controller[_0x7c44('0x11')]);module[_0x7c44('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 5b3f68d..0be1774 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 _0xd9ff=['STRING','exports'];(function(_0x4cbd8c,_0x4a39f4){var _0x12a2af=function(_0x22e4fa){while(--_0x22e4fa){_0x4cbd8c['push'](_0x4cbd8c['shift']());}};_0x12a2af(++_0x4a39f4);}(_0xd9ff,0xe1));var _0xfd9f=function(_0x2ffde9,_0x13a4ef){_0x2ffde9=_0x2ffde9-0x0;var _0x3fa06a=_0xd9ff[_0x2ffde9];return _0x3fa06a;};'use strict';var Sequelize=require('sequelize');module[_0xfd9f('0x0')]={'question':{'type':Sequelize[_0xfd9f('0x1')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xfd9f('0x1')]},'queue':{'type':Sequelize[_0xfd9f('0x1')]},'uniqueid':{'type':Sequelize[_0xfd9f('0x1')]},'calleridname':{'type':Sequelize[_0xfd9f('0x1')]},'calleridnum':{'type':Sequelize[_0xfd9f('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x998b=['sequelize','exports','STRING','long'];(function(_0x7d84a4,_0x4d12c4){var _0x1c6e77=function(_0x8b1d84){while(--_0x8b1d84){_0x7d84a4['push'](_0x7d84a4['shift']());}};_0x1c6e77(++_0x4d12c4);}(_0x998b,0x1e8));var _0xb998=function(_0x3faa1b,_0xdd7800){_0x3faa1b=_0x3faa1b-0x0;var _0xed6250=_0x998b[_0x3faa1b];return _0xed6250;};'use strict';var Sequelize=require(_0xb998('0x0'));module[_0xb998('0x1')]={'question':{'type':Sequelize[_0xb998('0x2')]},'answer':{'type':Sequelize['TEXT'](_0xb998('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xb998('0x2')]},'queue':{'type':Sequelize[_0xb998('0x2')]},'uniqueid':{'type':Sequelize[_0xb998('0x2')]},'calleridname':{'type':Sequelize[_0xb998('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xb998('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 5c27140..8621211 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 _0xed08=['model','query','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','filtears','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','keys','filters','intersection','attributes'];(function(_0x5ac327,_0x22459b){var _0x2476e9=function(_0x2fb619){while(--_0x2fb619){_0x5ac327['push'](_0x5ac327['shift']());}};_0x2476e9(++_0x22459b);}(_0xed08,0x67));var _0x8ed0=function(_0xd79b54,_0x535175){_0xd79b54=_0xd79b54-0x0;var _0x279594=_0xed08[_0xd79b54];return _0x279594;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ed0('0x0'));var rimraf=require(_0x8ed0('0x1'));var zipdir=require(_0x8ed0('0x2'));var jsonpatch=require(_0x8ed0('0x3'));var rp=require(_0x8ed0('0x4'));var moment=require(_0x8ed0('0x5'));var BPromise=require(_0x8ed0('0x6'));var Mustache=require(_0x8ed0('0x7'));var util=require(_0x8ed0('0x8'));var path=require(_0x8ed0('0x9'));var sox=require(_0x8ed0('0xa'));var csv=require(_0x8ed0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8ed0('0xc'));var squel=require(_0x8ed0('0xd'));var crypto=require(_0x8ed0('0xe'));var jsforce=require(_0x8ed0('0xf'));var deskjs=require(_0x8ed0('0x10'));var toCsv=require(_0x8ed0('0xb'));var querystring=require(_0x8ed0('0x11'));var Papa=require('papaparse');var Redis=require(_0x8ed0('0x12'));var authService=require(_0x8ed0('0x13'));var qs=require(_0x8ed0('0x14'));var as=require(_0x8ed0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ed0('0x16'))(_0x8ed0('0x17'));var utils=require(_0x8ed0('0x18'));var config=require(_0x8ed0('0x19'));var licenseUtil=require(_0x8ed0('0x1a'));var db=require(_0x8ed0('0x1b'))['db'];function respondWithStatusCode(_0x1b2161,_0x431018){_0x431018=_0x431018||0xcc;return function(_0x3ed67b){if(_0x3ed67b){return _0x1b2161[_0x8ed0('0x1c')](_0x431018);}return _0x1b2161['status'](_0x431018)[_0x8ed0('0x1d')]();};}function respondWithResult(_0x14d46a,_0x5e4ea7){_0x5e4ea7=_0x5e4ea7||0xc8;return function(_0x1e729a){if(_0x1e729a){return _0x14d46a[_0x8ed0('0x1e')](_0x5e4ea7)['json'](_0x1e729a);}};}function respondWithFilteredResult(_0x469354,_0x21f4fd){return function(_0x5eda69){if(_0x5eda69){var _0x72bf7a=_0x5eda69[_0x8ed0('0x1f')],_0x280676=_0x21f4fd[_0x8ed0('0x20')],_0x48b5a7=_0x21f4fd['offset']+_0x21f4fd['limit'],_0x2792c8;if(_0x48b5a7>=_0x72bf7a){_0x48b5a7=_0x72bf7a;_0x2792c8=0xc8;}else{_0x2792c8=0xce;}_0x469354['status'](_0x2792c8);return _0x469354[_0x8ed0('0x21')](_0x8ed0('0x22'),_0x280676+'-'+_0x48b5a7+'/'+_0x72bf7a)[_0x8ed0('0x23')](_0x5eda69);}return null;};}function patchUpdates(_0x32e6c3){return function(_0x3548a2){try{jsonpatch[_0x8ed0('0x24')](_0x3548a2,_0x32e6c3,!![]);}catch(_0x3331f6){return BPromise[_0x8ed0('0x25')](_0x3331f6);}return _0x3548a2[_0x8ed0('0x26')]();};}function saveUpdates(_0x5b8dcb,_0x55726a){return function(_0x3dc29d){if(_0x3dc29d){return _0x3dc29d[_0x8ed0('0x27')](_0x5b8dcb)['then'](function(_0x2d5327){return _0x2d5327;});}return null;};}function removeEntity(_0x28351a,_0x322e90){return function(_0xcba4d4){if(_0xcba4d4){return _0xcba4d4['destroy']()[_0x8ed0('0x28')](function(){_0x28351a[_0x8ed0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bf9ef,_0xf6208a){return function(_0xf3a408){if(!_0xf3a408){_0x1bf9ef[_0x8ed0('0x1c')](0x194);}return _0xf3a408;};}function handleError(_0x25e94e,_0x1ef082){_0x1ef082=_0x1ef082||0x1f4;return function(_0x551c91){logger['error'](_0x551c91[_0x8ed0('0x29')]);if(_0x551c91[_0x8ed0('0x2a')]){delete _0x551c91[_0x8ed0('0x2a')];}_0x25e94e[_0x8ed0('0x1e')](_0x1ef082)[_0x8ed0('0x2b')](_0x551c91);};}exports[_0x8ed0('0x2c')]=function(_0x5c404a,_0xbfcca){var _0x436e54={},_0x4886f8={},_0xeedfd9={'count':0x0,'rows':[]};var _0x210f93=_[_0x8ed0('0x2d')](db[_0x8ed0('0x2e')][_0x8ed0('0x2f')],function(_0xec3bd2){return{'name':_0xec3bd2[_0x8ed0('0x30')],'type':_0xec3bd2['type']['key']};});_0x4886f8['model']=_[_0x8ed0('0x2d')](_0x210f93,_0x8ed0('0x2a'));_0x4886f8['query']=_[_0x8ed0('0x31')](_0x5c404a['query']);_0x4886f8[_0x8ed0('0x32')]=_[_0x8ed0('0x33')](_0x4886f8['model'],_0x4886f8['query']);_0x436e54[_0x8ed0('0x34')]=_[_0x8ed0('0x33')](_0x4886f8[_0x8ed0('0x35')],qs['fields'](_0x5c404a[_0x8ed0('0x36')]['fields']));_0x436e54[_0x8ed0('0x34')]=_0x436e54[_0x8ed0('0x34')][_0x8ed0('0x37')]?_0x436e54[_0x8ed0('0x34')]:_0x4886f8[_0x8ed0('0x35')];if(!_0x5c404a['query'][_0x8ed0('0x38')]('nolimit')){_0x436e54[_0x8ed0('0x39')]=qs[_0x8ed0('0x39')](_0x5c404a[_0x8ed0('0x36')][_0x8ed0('0x39')]);_0x436e54[_0x8ed0('0x20')]=qs[_0x8ed0('0x20')](_0x5c404a[_0x8ed0('0x36')][_0x8ed0('0x20')]);}_0x436e54[_0x8ed0('0x3a')]=qs[_0x8ed0('0x3b')](_0x5c404a[_0x8ed0('0x36')][_0x8ed0('0x3b')]);_0x436e54[_0x8ed0('0x3c')]=qs['filters'](_[_0x8ed0('0x3d')](_0x5c404a['query'],_0x4886f8[_0x8ed0('0x32')]),_0x210f93);if(_0x5c404a['query'][_0x8ed0('0x3e')]){_0x436e54[_0x8ed0('0x3c')]=_[_0x8ed0('0x3f')](_0x436e54['where'],{'$or':_[_0x8ed0('0x2d')](_0x210f93,function(_0xb58797){if(_0xb58797[_0x8ed0('0x40')]!=='VIRTUAL'){var _0x5847bd={};_0x5847bd[_0xb58797[_0x8ed0('0x2a')]]={'$like':'%'+_0x5c404a[_0x8ed0('0x36')][_0x8ed0('0x3e')]+'%'};return _0x5847bd;}})});}_0x436e54=_[_0x8ed0('0x3f')]({},_0x436e54,_0x5c404a['options']);var _0x22257b={'where':_0x436e54['where']};return db[_0x8ed0('0x2e')][_0x8ed0('0x1f')](_0x22257b)['then'](function(_0xcbc3f4){_0xeedfd9[_0x8ed0('0x1f')]=_0xcbc3f4;if(_0x5c404a[_0x8ed0('0x36')][_0x8ed0('0x41')]){_0x436e54[_0x8ed0('0x42')]=[{'all':!![]}];}return db[_0x8ed0('0x2e')][_0x8ed0('0x43')](_0x436e54);})['then'](function(_0x19953f){_0xeedfd9[_0x8ed0('0x44')]=_0x19953f;return _0xeedfd9;})[_0x8ed0('0x28')](respondWithFilteredResult(_0xbfcca,_0x436e54))[_0x8ed0('0x45')](handleError(_0xbfcca,null));};exports[_0x8ed0('0x46')]=function(_0xee14e5,_0x5eadb9){var _0x1db377={'raw':!![],'where':{'id':_0xee14e5[_0x8ed0('0x47')]['id']}},_0x1cd43f={};_0x1cd43f[_0x8ed0('0x35')]=_[_0x8ed0('0x31')](db[_0x8ed0('0x2e')][_0x8ed0('0x2f')]);_0x1cd43f[_0x8ed0('0x36')]=_[_0x8ed0('0x31')](_0xee14e5[_0x8ed0('0x36')]);_0x1cd43f[_0x8ed0('0x48')]=_[_0x8ed0('0x33')](_0x1cd43f['model'],_0x1cd43f[_0x8ed0('0x36')]);_0x1db377['attributes']=_[_0x8ed0('0x33')](_0x1cd43f[_0x8ed0('0x35')],qs['fields'](_0xee14e5['query'][_0x8ed0('0x49')]));_0x1db377[_0x8ed0('0x34')]=_0x1db377['attributes'][_0x8ed0('0x37')]?_0x1db377[_0x8ed0('0x34')]:_0x1cd43f[_0x8ed0('0x35')];if(_0xee14e5[_0x8ed0('0x36')][_0x8ed0('0x41')]){_0x1db377[_0x8ed0('0x42')]=[{'all':!![]}];}_0x1db377=_[_0x8ed0('0x3f')]({},_0x1db377,_0xee14e5['options']);return db[_0x8ed0('0x2e')][_0x8ed0('0x4a')](_0x1db377)[_0x8ed0('0x28')](handleEntityNotFound(_0x5eadb9,null))[_0x8ed0('0x28')](respondWithResult(_0x5eadb9,null))[_0x8ed0('0x45')](handleError(_0x5eadb9,null));};exports['create']=function(_0x37de8e,_0x59bae7){return db[_0x8ed0('0x2e')][_0x8ed0('0x4b')](_0x37de8e[_0x8ed0('0x4c')],{})[_0x8ed0('0x28')](respondWithResult(_0x59bae7,0xc9))[_0x8ed0('0x45')](handleError(_0x59bae7,null));};exports[_0x8ed0('0x27')]=function(_0x456196,_0x484945){if(_0x456196[_0x8ed0('0x4c')]['id']){delete _0x456196[_0x8ed0('0x4c')]['id'];}return db[_0x8ed0('0x2e')][_0x8ed0('0x4a')]({'where':{'id':_0x456196['params']['id']}})[_0x8ed0('0x28')](handleEntityNotFound(_0x484945,null))['then'](saveUpdates(_0x456196[_0x8ed0('0x4c')],null))['then'](respondWithResult(_0x484945,null))[_0x8ed0('0x45')](handleError(_0x484945,null));};exports['destroy']=function(_0x226b38,_0x55f1d7){return db[_0x8ed0('0x2e')]['find']({'where':{'id':_0x226b38[_0x8ed0('0x47')]['id']}})['then'](handleEntityNotFound(_0x55f1d7,null))['then'](removeEntity(_0x55f1d7,null))[_0x8ed0('0x45')](handleError(_0x55f1d7,null));};exports[_0x8ed0('0x4d')]=function(_0x3b3a4f,_0x35a6d6){return db[_0x8ed0('0x2e')][_0x8ed0('0x4d')]()[_0x8ed0('0x28')](respondWithResult(_0x35a6d6,null))['catch'](handleError(_0x35a6d6,null));}; \ No newline at end of file +var _0xf494=['filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x303c42,_0x2a3852){var _0x2e44c4=function(_0x45f6ac){while(--_0x45f6ac){_0x303c42['push'](_0x303c42['shift']());}};_0x2e44c4(++_0x2a3852);}(_0xf494,0x1c6));var _0x4f49=function(_0x5e07c9,_0x378748){_0x5e07c9=_0x5e07c9-0x0;var _0x3705b6=_0xf494[_0x5e07c9];return _0x3705b6;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=_0x5878f4['count'],_0x2f0a0d=_0x415e83[_0x4f49('0x1d')],_0x2ecaaa=_0x415e83[_0x4f49('0x1d')]+_0x415e83[_0x4f49('0x1e')],_0x74886e;if(_0x2ecaaa>=_0x5bdfaf){_0x2ecaaa=_0x5bdfaf;_0x74886e=0xc8;}else{_0x74886e=0xce;}_0x1f2d0d['status'](_0x74886e);return _0x1f2d0d['set']('Content-Range',_0x2f0a0d+'-'+_0x2ecaaa+'/'+_0x5bdfaf)['json'](_0x5878f4);}return null;};}function patchUpdates(_0xb2081a){return function(_0x1834f4){try{jsonpatch[_0x4f49('0x1f')](_0x1834f4,_0xb2081a,!![]);}catch(_0x407042){return BPromise['reject'](_0x407042);}return _0x1834f4[_0x4f49('0x20')]();};}function saveUpdates(_0x2aed27,_0x197a49){return function(_0xaab5e7){if(_0xaab5e7){return _0xaab5e7[_0x4f49('0x21')](_0x2aed27)['then'](function(_0x3e7e28){return _0x3e7e28;});}return null;};}function removeEntity(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x22')]()[_0x4f49('0x23')](function(){_0x357446[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x9d30aa,_0x36187b){return function(_0x559d98){if(!_0x559d98){_0x9d30aa['sendStatus'](0x194);}return _0x559d98;};}function handleError(_0x3a947b,_0x429de7){_0x429de7=_0x429de7||0x1f4;return function(_0x4fedbb){logger[_0x4f49('0x24')](_0x4fedbb[_0x4f49('0x25')]);if(_0x4fedbb[_0x4f49('0x26')]){delete _0x4fedbb['name'];}_0x3a947b[_0x4f49('0x1a')](_0x429de7)[_0x4f49('0x27')](_0x4fedbb);};}exports[_0x4f49('0x28')]=function(_0x148153,_0xfefbab){var _0x122404={},_0x4915af={},_0x50c571={'count':0x0,'rows':[]};var _0x239f44=_[_0x4f49('0x29')](db[_0x4f49('0x2a')]['rawAttributes'],function(_0x3cbfbd){return{'name':_0x3cbfbd[_0x4f49('0x2b')],'type':_0x3cbfbd[_0x4f49('0x2c')]['key']};});_0x4915af['model']=_[_0x4f49('0x29')](_0x239f44,_0x4f49('0x26'));_0x4915af[_0x4f49('0x2d')]=_['keys'](_0x148153[_0x4f49('0x2d')]);_0x4915af[_0x4f49('0x2e')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],_0x4915af[_0x4f49('0x2d')]);_0x122404[_0x4f49('0x31')]=_[_0x4f49('0x2f')](_0x4915af[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x122404[_0x4f49('0x31')]=_0x122404[_0x4f49('0x31')][_0x4f49('0x33')]?_0x122404[_0x4f49('0x31')]:_0x4915af[_0x4f49('0x30')];if(!_0x148153[_0x4f49('0x2d')][_0x4f49('0x34')](_0x4f49('0x35'))){_0x122404['limit']=qs[_0x4f49('0x1e')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1e')]);_0x122404[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x1d')]);}_0x122404[_0x4f49('0x36')]=qs[_0x4f49('0x37')](_0x148153[_0x4f49('0x2d')][_0x4f49('0x37')]);_0x122404[_0x4f49('0x38')]=qs[_0x4f49('0x2e')](_['pick'](_0x148153[_0x4f49('0x2d')],_0x4915af[_0x4f49('0x2e')]),_0x239f44);if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x39')]){_0x122404[_0x4f49('0x38')]=_[_0x4f49('0x3a')](_0x122404[_0x4f49('0x38')],{'$or':_[_0x4f49('0x29')](_0x239f44,function(_0x10bfc4){if(_0x10bfc4[_0x4f49('0x2c')]!==_0x4f49('0x3b')){var _0x141db={};_0x141db[_0x10bfc4[_0x4f49('0x26')]]={'$like':'%'+_0x148153[_0x4f49('0x2d')]['filter']+'%'};return _0x141db;}})});}_0x122404=_[_0x4f49('0x3a')]({},_0x122404,_0x148153[_0x4f49('0x3c')]);var _0x543605={'where':_0x122404[_0x4f49('0x38')]};return db[_0x4f49('0x2a')]['count'](_0x543605)[_0x4f49('0x23')](function(_0x1dd1a6){_0x50c571[_0x4f49('0x3d')]=_0x1dd1a6;if(_0x148153[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x122404[_0x4f49('0x3f')]=[{'all':!![]}];}return db[_0x4f49('0x2a')]['findAll'](_0x122404);})['then'](function(_0x55960a){_0x50c571[_0x4f49('0x40')]=_0x55960a;return _0x50c571;})[_0x4f49('0x23')](respondWithFilteredResult(_0xfefbab,_0x122404))[_0x4f49('0x41')](handleError(_0xfefbab,null));};exports[_0x4f49('0x42')]=function(_0x1053b2,_0x1ecf6c){var _0x38aff8={'raw':!![],'where':{'id':_0x1053b2[_0x4f49('0x43')]['id']}},_0x23720a={};_0x23720a['model']=_['keys'](db[_0x4f49('0x2a')][_0x4f49('0x44')]);_0x23720a[_0x4f49('0x2d')]=_['keys'](_0x1053b2[_0x4f49('0x2d')]);_0x23720a['filtears']=_['intersection'](_0x23720a[_0x4f49('0x30')],_0x23720a[_0x4f49('0x2d')]);_0x38aff8[_0x4f49('0x31')]=_['intersection'](_0x23720a[_0x4f49('0x30')],qs[_0x4f49('0x32')](_0x1053b2['query'][_0x4f49('0x32')]));_0x38aff8['attributes']=_0x38aff8[_0x4f49('0x31')][_0x4f49('0x33')]?_0x38aff8[_0x4f49('0x31')]:_0x23720a['model'];if(_0x1053b2[_0x4f49('0x2d')][_0x4f49('0x3e')]){_0x38aff8[_0x4f49('0x3f')]=[{'all':!![]}];}_0x38aff8=_[_0x4f49('0x3a')]({},_0x38aff8,_0x1053b2[_0x4f49('0x3c')]);return db[_0x4f49('0x2a')][_0x4f49('0x45')](_0x38aff8)[_0x4f49('0x23')](handleEntityNotFound(_0x1ecf6c,null))[_0x4f49('0x23')](respondWithResult(_0x1ecf6c,null))[_0x4f49('0x41')](handleError(_0x1ecf6c,null));};exports['create']=function(_0x26c222,_0x44bf1d){return db['JscriptyAnswerReport'][_0x4f49('0x46')](_0x26c222['body'],{})[_0x4f49('0x23')](respondWithResult(_0x44bf1d,0xc9))[_0x4f49('0x41')](handleError(_0x44bf1d,null));};exports[_0x4f49('0x21')]=function(_0x300230,_0x4a91ec){if(_0x300230[_0x4f49('0x47')]['id']){delete _0x300230[_0x4f49('0x47')]['id'];}return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x300230[_0x4f49('0x43')]['id']}})[_0x4f49('0x23')](handleEntityNotFound(_0x4a91ec,null))[_0x4f49('0x23')](saveUpdates(_0x300230[_0x4f49('0x47')],null))[_0x4f49('0x23')](respondWithResult(_0x4a91ec,null))[_0x4f49('0x41')](handleError(_0x4a91ec,null));};exports[_0x4f49('0x22')]=function(_0x4482f7,_0x148031){return db[_0x4f49('0x2a')][_0x4f49('0x45')]({'where':{'id':_0x4482f7[_0x4f49('0x43')]['id']}})['then'](handleEntityNotFound(_0x148031,null))['then'](removeEntity(_0x148031,null))[_0x4f49('0x41')](handleError(_0x148031,null));};exports[_0x4f49('0x48')]=function(_0x36bcc2,_0xe46c90){return db[_0x4f49('0x2a')][_0x4f49('0x48')]()[_0x4f49('0x23')](respondWithResult(_0xe46c90,null))['catch'](handleError(_0xe46c90,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 145e295..a791b46 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 _0xc123=['api','moment','bluebird','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x41dcc9,_0x3ec416){var _0x5de075=function(_0x12d560){while(--_0x12d560){_0x41dcc9['push'](_0x41dcc9['shift']());}};_0x5de075(++_0x3ec416);}(_0xc123,0x195));var _0x3c12=function(_0x35a6e1,_0x2ba0bf){_0x35a6e1=_0x35a6e1-0x0;var _0x3cd96d=_0xc123[_0x35a6e1];return _0x3cd96d;};'use strict';var _=require(_0x3c12('0x0'));var util=require(_0x3c12('0x1'));var logger=require(_0x3c12('0x2'))(_0x3c12('0x3'));var moment=require(_0x3c12('0x4'));var BPromise=require(_0x3c12('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c12('0x6'));var rimraf=require(_0x3c12('0x7'));var config=require(_0x3c12('0x8'));var attributes=require(_0x3c12('0x9'));module[_0x3c12('0xa')]=function(_0x2ed817,_0x2e6735){return _0x2ed817[_0x3c12('0xb')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e9a=['../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e9a,0xfd));var _0xa6e9=function(_0x1d8c86,_0x35919a){_0x1d8c86=_0x1d8c86-0x0;var _0x47c8a5=_0x6e9a[_0x1d8c86];return _0x47c8a5;};'use strict';var _=require(_0xa6e9('0x0'));var util=require(_0xa6e9('0x1'));var logger=require('../../config/logger')(_0xa6e9('0x2'));var moment=require(_0xa6e9('0x3'));var BPromise=require(_0xa6e9('0x4'));var rp=require(_0xa6e9('0x5'));var fs=require('fs');var path=require(_0xa6e9('0x6'));var rimraf=require('rimraf');var config=require(_0xa6e9('0x7'));var attributes=require(_0xa6e9('0x8'));module[_0xa6e9('0x9')]=function(_0xa8e435,_0x1eac28){return _0xa8e435[_0xa6e9('0xa')](_0xa6e9('0xb'),attributes,{'tableName':_0xa6e9('0xc'),'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 d19e2f9..34d8c8b 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 _0x7249=['error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7249,0x116));var _0x9724=function(_0x21bf4e,_0x6620ff){_0x21bf4e=_0x21bf4e-0x0;var _0x582769=_0x7249[_0x21bf4e];return _0x582769;};'use strict';var _=require(_0x9724('0x0'));var util=require('util');var moment=require(_0x9724('0x1'));var BPromise=require(_0x9724('0x2'));var rs=require(_0x9724('0x3'));var fs=require('fs');var Redis=require(_0x9724('0x4'));var db=require(_0x9724('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9724('0x6'))('rpc');var config=require(_0x9724('0x7'));var jayson=require(_0x9724('0x8'));var client=jayson[_0x9724('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x149a39,_0x4b19ae,_0x244ee8){return new BPromise(function(_0x2b477c,_0x81fced){return client[_0x9724('0xa')](_0x149a39,_0x244ee8)[_0x9724('0xb')](function(_0x14660f){logger['info'](_0x9724('0xc'),_0x4b19ae,_0x9724('0xd'));logger[_0x9724('0xe')](_0x9724('0xf'),_0x4b19ae,'request\x20sent',JSON['stringify'](_0x14660f));if(_0x14660f[_0x9724('0x10')]){if(_0x14660f[_0x9724('0x10')][_0x9724('0x11')]===0x1f4){logger[_0x9724('0x10')](_0x9724('0xc'),_0x4b19ae,_0x14660f[_0x9724('0x10')][_0x9724('0x12')]);return _0x81fced(_0x14660f[_0x9724('0x10')][_0x9724('0x12')]);}logger[_0x9724('0x10')](_0x9724('0xc'),_0x4b19ae,_0x14660f[_0x9724('0x10')][_0x9724('0x12')]);return _0x2b477c(_0x14660f[_0x9724('0x10')][_0x9724('0x12')]);}else{logger[_0x9724('0x13')](_0x9724('0xc'),_0x4b19ae,_0x9724('0xd'));_0x2b477c(_0x14660f[_0x9724('0x14')][_0x9724('0x12')]);}})['catch'](function(_0x2ef311){logger[_0x9724('0x10')](_0x9724('0xc'),_0x4b19ae,_0x2ef311);_0x81fced(_0x2ef311);});});} \ No newline at end of file +var _0x0095=['debug','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent'];(function(_0x4025a2,_0x4f9c7d){var _0x585e13=function(_0x46f06e){while(--_0x46f06e){_0x4025a2['push'](_0x4025a2['shift']());}};_0x585e13(++_0x4f9c7d);}(_0x0095,0xc6));var _0x5009=function(_0x27431b,_0x4a4be8){_0x27431b=_0x27431b-0x0;var _0x4f041b=_0x0095[_0x27431b];return _0x4f041b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5009('0x0'));var BPromise=require('bluebird');var rs=require(_0x5009('0x1'));var fs=require('fs');var Redis=require(_0x5009('0x2'));var db=require(_0x5009('0x3'))['db'];var utils=require(_0x5009('0x4'));var logger=require(_0x5009('0x5'))(_0x5009('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5009('0x7')][_0x5009('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x281f86,_0x59dc06,_0x4bc523){return new BPromise(function(_0x5140f6,_0x3a088d){return client[_0x5009('0x9')](_0x281f86,_0x4bc523)[_0x5009('0xa')](function(_0x2b7686){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x59dc06,_0x5009('0xb'));logger[_0x5009('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x59dc06,_0x5009('0xb'),JSON[_0x5009('0xd')](_0x2b7686));if(_0x2b7686[_0x5009('0xe')]){if(_0x2b7686[_0x5009('0xe')][_0x5009('0xf')]===0x1f4){logger[_0x5009('0xe')](_0x5009('0x10'),_0x59dc06,_0x2b7686['error'][_0x5009('0x11')]);return _0x3a088d(_0x2b7686[_0x5009('0xe')][_0x5009('0x11')]);}logger[_0x5009('0xe')](_0x5009('0x10'),_0x59dc06,_0x2b7686['error'][_0x5009('0x11')]);return _0x5140f6(_0x2b7686[_0x5009('0xe')][_0x5009('0x11')]);}else{logger[_0x5009('0x12')](_0x5009('0x10'),_0x59dc06,_0x5009('0xb'));_0x5140f6(_0x2b7686[_0x5009('0x13')][_0x5009('0x11')]);}})[_0x5009('0x14')](function(_0x3a4dd4){logger[_0x5009('0xe')](_0x5009('0x10'),_0x59dc06,_0x3a4dd4);_0x3a088d(_0x3a4dd4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 49a80ec..4528a6a 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 _0x4cc7=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update'];(function(_0x323fca,_0x369c53){var _0x2f4122=function(_0x8d8818){while(--_0x8d8818){_0x323fca['push'](_0x323fca['shift']());}};_0x2f4122(++_0x369c53);}(_0x4cc7,0x1b6));var _0x74cc=function(_0x110c17,_0x716d87){_0x110c17=_0x110c17-0x0;var _0x4ebc1e=_0x4cc7[_0x110c17];return _0x4ebc1e;};'use strict';var multer=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var path=require(_0x74cc('0x2'));var timeout=require(_0x74cc('0x3'));var express=require(_0x74cc('0x4'));var router=express[_0x74cc('0x5')]();var auth=require(_0x74cc('0x6'));var interaction=require(_0x74cc('0x7'));var config=require('../../config/environment');var controller=require(_0x74cc('0x8'));router[_0x74cc('0x9')]('/',auth[_0x74cc('0xa')](),controller[_0x74cc('0xb')]);router[_0x74cc('0x9')](_0x74cc('0xc'),auth[_0x74cc('0xa')](),controller[_0x74cc('0xd')]);router[_0x74cc('0x9')](_0x74cc('0xe'),auth[_0x74cc('0xa')](),controller[_0x74cc('0xf')]);router[_0x74cc('0x9')]('/:id/answers',auth[_0x74cc('0xa')](),controller[_0x74cc('0x10')]);router[_0x74cc('0x9')](_0x74cc('0x11'),auth[_0x74cc('0xa')](),timeout(_0x74cc('0x12')),controller[_0x74cc('0x13')]);router[_0x74cc('0x14')]('/',auth[_0x74cc('0xa')](),controller[_0x74cc('0x15')]);router[_0x74cc('0x14')](_0x74cc('0x16'),auth['isAuthenticated'](),controller[_0x74cc('0x17')]);router[_0x74cc('0x18')](_0x74cc('0xc'),auth['isAuthenticated'](),controller[_0x74cc('0x19')]);router[_0x74cc('0x1a')](_0x74cc('0xc'),auth[_0x74cc('0xa')](),controller[_0x74cc('0x1b')]);module[_0x74cc('0x1c')]=router; \ No newline at end of file +var _0x8bdc=['./jscriptyProject.controller','index','isAuthenticated','show','get','/:id/sessions','getSessions','getAnswers','post','/:id/clone','clone','put','/:id','delete','exports','multer','path','../../config/environment'];(function(_0xed5a98,_0x262e51){var _0x4b49da=function(_0x55fba9){while(--_0x55fba9){_0xed5a98['push'](_0xed5a98['shift']());}};_0x4b49da(++_0x262e51);}(_0x8bdc,0x11d));var _0xc8bd=function(_0x1e9201,_0x7f1404){_0x1e9201=_0x1e9201-0x0;var _0x1290f4=_0x8bdc[_0x1e9201];return _0x1290f4;};'use strict';var multer=require(_0xc8bd('0x0'));var util=require('util');var path=require(_0xc8bd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc8bd('0x2'));var controller=require(_0xc8bd('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0xc8bd('0x4')]);router['get']('/:id',auth[_0xc8bd('0x5')](),controller[_0xc8bd('0x6')]);router[_0xc8bd('0x7')](_0xc8bd('0x8'),auth[_0xc8bd('0x5')](),controller[_0xc8bd('0x9')]);router[_0xc8bd('0x7')]('/:id/answers',auth[_0xc8bd('0x5')](),controller[_0xc8bd('0xa')]);router[_0xc8bd('0x7')]('/:id/summary',auth[_0xc8bd('0x5')](),timeout('30s'),controller['getSummary']);router[_0xc8bd('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc8bd('0xc'),auth[_0xc8bd('0x5')](),controller[_0xc8bd('0xd')]);router[_0xc8bd('0xe')](_0xc8bd('0xf'),auth[_0xc8bd('0x5')](),controller['update']);router[_0xc8bd('0x10')](_0xc8bd('0xf'),auth[_0xc8bd('0x5')](),controller['destroy']);module[_0xc8bd('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 975b7dd..5476991 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 _0xb66d=['BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','getDataValue','description'];(function(_0x12cad2,_0x1f7233){var _0x13fb42=function(_0x292909){while(--_0x292909){_0x12cad2['push'](_0x12cad2['shift']());}};_0x13fb42(++_0x1f7233);}(_0xb66d,0x1cf));var _0xdb66=function(_0x514038,_0x450ef3){_0x514038=_0x514038-0x0;var _0x589720=_0xb66d[_0x514038];return _0x589720;};'use strict';var Sequelize=require(_0xdb66('0x0'));var _=require(_0xdb66('0x1'));var util=require(_0xdb66('0x2'));module['exports']={'name':{'type':Sequelize[_0xdb66('0x3')],'unique':_0xdb66('0x4')},'description':{'type':Sequelize[_0xdb66('0x3')]},'formData':{'type':Sequelize[_0xdb66('0x5')](_0xdb66('0x6')),'set':function(_0x1e6b1b){if(_[_0xdb66('0x7')](_0x1e6b1b)){this[_0xdb66('0x8')](_0xdb66('0x9'),JSON[_0xdb66('0xa')](_0x1e6b1b));}else if(_['isString'](_0x1e6b1b)){this[_0xdb66('0x8')]('formData',_0x1e6b1b);}else{this['setDataValue'](_0xdb66('0x9'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xdb66('0x4'))||'',this[_0xdb66('0xb')](_0xdb66('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdb66('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xec6b=['lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x504154,_0x395724){var _0x20e806=function(_0x67118f){while(--_0x67118f){_0x504154['push'](_0x504154['shift']());}};_0x20e806(++_0x395724);}(_0xec6b,0xa5));var _0xbec6=function(_0x38cf70,_0x2c958e){_0x38cf70=_0x38cf70-0x0;var _0x46b799=_0xec6b[_0x38cf70];return _0x46b799;};'use strict';var Sequelize=require('sequelize');var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));module[_0xbec6('0x2')]={'name':{'type':Sequelize[_0xbec6('0x3')],'unique':_0xbec6('0x4')},'description':{'type':Sequelize[_0xbec6('0x3')]},'formData':{'type':Sequelize[_0xbec6('0x5')](_0xbec6('0x6')),'set':function(_0x427533){if(_[_0xbec6('0x7')](_0x427533)){this[_0xbec6('0x8')]('formData',JSON['stringify'](_0x427533));}else if(_['isString'](_0x427533)){this['setDataValue'](_0xbec6('0x9'),_0x427533);}else{this['setDataValue'](_0xbec6('0x9'),util[_0xbec6('0xa')](_0xbec6('0xb'),this[_0xbec6('0xc')]('name')||'',this[_0xbec6('0xc')](_0xbec6('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xbec6('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d08fbb0..83bf2e5 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 _0xddcb=['Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','filtears','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','intersection','omit','createdAt','updatedAt','body','role','Projects','getSessions','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','answer','push','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader'];(function(_0x3034ff,_0x145ca3){var _0x494367=function(_0x21df61){while(--_0x21df61){_0x3034ff['push'](_0x3034ff['shift']());}};_0x494367(++_0x145ca3);}(_0xddcb,0x79));var _0xbddc=function(_0x5b279d,_0x356b86){_0x5b279d=_0x5b279d-0x0;var _0xb2c4ea=_0xddcb[_0x5b279d];return _0xb2c4ea;};'use strict';var pdf=require(_0xbddc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbddc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbddc('0x2'));var moment=require(_0xbddc('0x3'));var BPromise=require(_0xbddc('0x4'));var Mustache=require(_0xbddc('0x5'));var util=require(_0xbddc('0x6'));var path=require(_0xbddc('0x7'));var sox=require(_0xbddc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbddc('0x9'));var jsforce=require(_0xbddc('0xa'));var deskjs=require(_0xbddc('0xb'));var toCsv=require(_0xbddc('0xc'));var querystring=require('querystring');var Papa=require(_0xbddc('0xd'));var Redis=require(_0xbddc('0xe'));var authService=require(_0xbddc('0xf'));var qs=require(_0xbddc('0x10'));var as=require(_0xbddc('0x11'));var hardwareService=require(_0xbddc('0x12'));var logger=require(_0xbddc('0x13'))(_0xbddc('0x14'));var utils=require(_0xbddc('0x15'));var config=require(_0xbddc('0x16'));var licenseUtil=require(_0xbddc('0x17'));var db=require(_0xbddc('0x18'))['db'];function respondWithStatusCode(_0x543628,_0x5ad15e){_0x5ad15e=_0x5ad15e||0xcc;return function(_0x7c58f0){if(_0x7c58f0){return _0x543628[_0xbddc('0x19')](_0x5ad15e);}return _0x543628['status'](_0x5ad15e)['end']();};}function respondWithResult(_0x48f757,_0x41cc79){_0x41cc79=_0x41cc79||0xc8;return function(_0x442ede){if(_0x442ede){return _0x48f757[_0xbddc('0x1a')](_0x41cc79)[_0xbddc('0x1b')](_0x442ede);}};}function respondWithFilteredResult(_0x1624af,_0x51f127){return function(_0x4be6f0){if(_0x4be6f0){var _0x29ff6e=_0x4be6f0[_0xbddc('0x1c')],_0x3932fe=_0x51f127[_0xbddc('0x1d')],_0xcfe18d=_0x51f127['offset']+_0x51f127[_0xbddc('0x1e')],_0x5d2ae7;if(_0xcfe18d>=_0x29ff6e){_0xcfe18d=_0x29ff6e;_0x5d2ae7=0xc8;}else{_0x5d2ae7=0xce;}_0x1624af[_0xbddc('0x1a')](_0x5d2ae7);return _0x1624af['set'](_0xbddc('0x1f'),_0x3932fe+'-'+_0xcfe18d+'/'+_0x29ff6e)['json'](_0x4be6f0);}return null;};}function patchUpdates(_0x2eeda4){return function(_0x1846cf){try{jsonpatch[_0xbddc('0x20')](_0x1846cf,_0x2eeda4,!![]);}catch(_0x38da10){return BPromise[_0xbddc('0x21')](_0x38da10);}return _0x1846cf['save']();};}function saveUpdates(_0x2bb32e,_0x3de948){return function(_0x392618){if(_0x392618){return _0x392618[_0xbddc('0x22')](_0x2bb32e)[_0xbddc('0x23')](function(_0x438aed){return _0x438aed;});}return null;};}function removeEntity(_0x2758e9,_0x1a23e3){return function(_0x3c6e0f){if(_0x3c6e0f){return _0x3c6e0f['destroy']()[_0xbddc('0x23')](function(){var _0x51549f=_0x3c6e0f[_0xbddc('0x24')]({'plain':!![]});var _0x3c3447='Projects';return db[_0xbddc('0x25')][_0xbddc('0x26')]({'where':{'type':_0x3c3447,'resourceId':_0x51549f['id']}})[_0xbddc('0x23')](function(){return _0x3c6e0f;});})['then'](function(){_0x2758e9[_0xbddc('0x1a')](0xcc)[_0xbddc('0x27')]();});}};}function handleEntityNotFound(_0x422115,_0x133db2){return function(_0x598223){if(!_0x598223){_0x422115[_0xbddc('0x19')](0x194);}return _0x598223;};}function handleError(_0x3d1f64,_0x2be2f4){_0x2be2f4=_0x2be2f4||0x1f4;return function(_0x4adc98){logger[_0xbddc('0x28')](_0x4adc98[_0xbddc('0x29')]);if(_0x4adc98['name']){delete _0x4adc98[_0xbddc('0x2a')];}_0x3d1f64[_0xbddc('0x1a')](_0x2be2f4)[_0xbddc('0x2b')](_0x4adc98);};}exports[_0xbddc('0x2c')]=function(_0x507750,_0x5421d7){var _0x26438b={},_0x2b3802={},_0x3053fd={'count':0x0,'rows':[]};var _0x455e70=_[_0xbddc('0x2d')](db[_0xbddc('0x2e')][_0xbddc('0x2f')],function(_0x4550bc){return{'name':_0x4550bc['fieldName'],'type':_0x4550bc[_0xbddc('0x30')]['key']};});_0x2b3802[_0xbddc('0x31')]=_[_0xbddc('0x2d')](_0x455e70,_0xbddc('0x2a'));_0x2b3802[_0xbddc('0x32')]=_[_0xbddc('0x33')](_0x507750[_0xbddc('0x32')]);_0x2b3802[_0xbddc('0x34')]=_['intersection'](_0x2b3802[_0xbddc('0x31')],_0x2b3802[_0xbddc('0x32')]);_0x26438b[_0xbddc('0x35')]=_['intersection'](_0x2b3802['model'],qs[_0xbddc('0x36')](_0x507750['query']['fields']));_0x26438b[_0xbddc('0x35')]=_0x26438b[_0xbddc('0x35')][_0xbddc('0x37')]?_0x26438b[_0xbddc('0x35')]:_0x2b3802[_0xbddc('0x31')];if(!_0x507750[_0xbddc('0x32')]['hasOwnProperty'](_0xbddc('0x38'))){_0x26438b['limit']=qs[_0xbddc('0x1e')](_0x507750['query']['limit']);_0x26438b['offset']=qs[_0xbddc('0x1d')](_0x507750[_0xbddc('0x32')][_0xbddc('0x1d')]);}_0x26438b[_0xbddc('0x39')]=qs[_0xbddc('0x3a')](_0x507750[_0xbddc('0x32')][_0xbddc('0x3a')]);_0x26438b[_0xbddc('0x3b')]=qs['filters'](_[_0xbddc('0x3c')](_0x507750['query'],_0x2b3802['filters']),_0x455e70);if(_0x507750['query'][_0xbddc('0x3d')]){_0x26438b[_0xbddc('0x3b')]=_[_0xbddc('0x3e')](_0x26438b['where'],{'$or':_[_0xbddc('0x2d')](_0x455e70,function(_0x58c348){if(_0x58c348['type']!==_0xbddc('0x3f')){var _0x2312b4={};_0x2312b4[_0x58c348[_0xbddc('0x2a')]]={'$like':'%'+_0x507750['query'][_0xbddc('0x3d')]+'%'};return _0x2312b4;}})});}_0x26438b=_['merge']({},_0x26438b,_0x507750['options']);var _0x24bbaa={'where':_0x26438b[_0xbddc('0x3b')]};return db[_0xbddc('0x2e')][_0xbddc('0x1c')](_0x24bbaa)['then'](function(_0x2dd943){_0x3053fd['count']=_0x2dd943;if(_0x507750[_0xbddc('0x32')][_0xbddc('0x40')]){_0x26438b[_0xbddc('0x41')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x26438b);})[_0xbddc('0x23')](function(_0x392f82){_0x3053fd[_0xbddc('0x42')]=_0x392f82;return _0x3053fd;})['then'](respondWithFilteredResult(_0x5421d7,_0x26438b))['catch'](handleError(_0x5421d7,null));};exports['show']=function(_0x1e7e06,_0x54cbfe){var _0x2bfee5={'raw':![],'where':{'id':_0x1e7e06['params']['id']}},_0x3ac916={};_0x3ac916['model']=_[_0xbddc('0x33')](db[_0xbddc('0x2e')][_0xbddc('0x2f')]);_0x3ac916[_0xbddc('0x32')]=_[_0xbddc('0x33')](_0x1e7e06[_0xbddc('0x32')]);_0x3ac916[_0xbddc('0x43')]=_['intersection'](_0x3ac916[_0xbddc('0x31')],_0x3ac916[_0xbddc('0x32')]);_0x2bfee5[_0xbddc('0x35')]=_['intersection'](_0x3ac916[_0xbddc('0x31')],qs[_0xbddc('0x36')](_0x1e7e06[_0xbddc('0x32')][_0xbddc('0x36')]));_0x2bfee5[_0xbddc('0x35')]=_0x2bfee5[_0xbddc('0x35')][_0xbddc('0x37')]?_0x2bfee5['attributes']:_0x3ac916[_0xbddc('0x31')];if(_0x1e7e06[_0xbddc('0x32')][_0xbddc('0x40')]){_0x2bfee5[_0xbddc('0x41')]=[{'all':!![]}];}_0x2bfee5=_['merge']({},_0x2bfee5,_0x1e7e06[_0xbddc('0x44')]);return db[_0xbddc('0x2e')]['find'](_0x2bfee5)['then'](handleEntityNotFound(_0x54cbfe,null))['then'](respondWithResult(_0x54cbfe,null))[_0xbddc('0x45')](handleError(_0x54cbfe,null));};exports[_0xbddc('0x46')]=function(_0x5af8eb,_0xff03f3){return db['JscriptyProject'][_0xbddc('0x46')](_0x5af8eb['body'],{})['then'](function(_0x476c96){var _0x52b5ff=_0x5af8eb[_0xbddc('0x47')][_0xbddc('0x24')]({'plain':!![]});if(!_0x52b5ff)throw new Error(_0xbddc('0x48'));if(_0x52b5ff['role']==='user'){var _0x2441fe=_0x476c96[_0xbddc('0x24')]({'plain':!![]});var _0x1333ac='Projects';return db[_0xbddc('0x49')][_0xbddc('0x4a')]({'where':{'name':_0x1333ac,'userProfileId':_0x52b5ff['userProfileId']},'raw':!![]})['then'](function(_0x3533bd){if(_0x3533bd&&_0x3533bd[_0xbddc('0x4b')]===0x0){return db['UserProfileResource']['create']({'name':_0x2441fe[_0xbddc('0x2a')],'resourceId':_0x2441fe['id'],'type':_0x3533bd[_0xbddc('0x2a')],'sectionId':_0x3533bd['id']},{})[_0xbddc('0x23')](function(){return _0x476c96;});}else{return _0x476c96;}})[_0xbddc('0x45')](function(_0x1dd1de){logger[_0xbddc('0x28')](_0xbddc('0x4c'),_0x1dd1de);throw _0x1dd1de;});}return _0x476c96;})[_0xbddc('0x23')](respondWithResult(_0xff03f3,0xc9))['catch'](handleError(_0xff03f3,null));};exports[_0xbddc('0x4d')]=function(_0x31aa69,_0x1d94a1){var _0x23c79e={'where':{'id':_0x31aa69[_0xbddc('0x4e')]['id']}},_0x1e0f1c={};_0x1e0f1c[_0xbddc('0x31')]=_[_0xbddc('0x33')](db[_0xbddc('0x2e')][_0xbddc('0x2f')]);_0x23c79e[_0xbddc('0x35')]=_[_0xbddc('0x4f')](_0x1e0f1c[_0xbddc('0x31')],qs['fields'](_0x31aa69[_0xbddc('0x32')][_0xbddc('0x36')]));_0x23c79e[_0xbddc('0x35')]=_0x23c79e[_0xbddc('0x35')][_0xbddc('0x37')]?_0x23c79e[_0xbddc('0x35')]:_0x1e0f1c['model'];if(_0x31aa69[_0xbddc('0x32')][_0xbddc('0x40')]){_0x23c79e[_0xbddc('0x41')]=[{'all':!![]}];}_0x23c79e=_[_0xbddc('0x3e')]({},_0x23c79e,_0x31aa69[_0xbddc('0x44')]);return db[_0xbddc('0x2e')]['find'](_0x23c79e)[_0xbddc('0x23')](handleEntityNotFound(_0x1d94a1,null))[_0xbddc('0x23')](function(_0x2cb0f8){if(_0x2cb0f8){var _0x2a45aa=_0x2cb0f8[_0xbddc('0x24')]({'plain':!![]});_0x2a45aa=qs[_0xbddc('0x50')](_0x2a45aa,['id',_0xbddc('0x51'),_0xbddc('0x52')]);_0x31aa69[_0xbddc('0x53')]=_['omit'](_0x31aa69['body'],['id',_0xbddc('0x51'),_0xbddc('0x52')]);return db[_0xbddc('0x2e')]['create'](_[_0xbddc('0x3e')](_0x2a45aa,_0x31aa69[_0xbddc('0x53')]),{'include':_0x31aa69['query'][_0xbddc('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x57ee64){var _0xf3b10f=_0x31aa69[_0xbddc('0x47')]['get']({'plain':!![]});if(!_0xf3b10f)throw new Error(_0xbddc('0x48'));if(_0xf3b10f[_0xbddc('0x54')]===_0xbddc('0x47')){var _0x1c8b8d=_0x57ee64[_0xbddc('0x24')]({'plain':!![]});var _0x1383a2=_0xbddc('0x55');return db['UserProfileSection'][_0xbddc('0x4a')]({'where':{'name':_0x1383a2,'userProfileId':_0xf3b10f['userProfileId']},'raw':!![]})['then'](function(_0x49bf6d){if(_0x49bf6d&&_0x49bf6d[_0xbddc('0x4b')]===0x0){return db[_0xbddc('0x25')][_0xbddc('0x46')]({'name':_0x1c8b8d[_0xbddc('0x2a')],'resourceId':_0x1c8b8d['id'],'type':_0x49bf6d[_0xbddc('0x2a')],'sectionId':_0x49bf6d['id']},{})[_0xbddc('0x23')](function(){return _0x57ee64;});}else{return _0x57ee64;}})['catch'](function(_0x1d70fe){logger[_0xbddc('0x28')](_0xbddc('0x4c'),_0x1d70fe);throw _0x1d70fe;});}return _0x57ee64;});}})[_0xbddc('0x23')](respondWithResult(_0x1d94a1,0xc9))[_0xbddc('0x45')](handleError(_0x1d94a1,null));};exports['update']=function(_0x40f3e5,_0xd51fe0){if(_0x40f3e5[_0xbddc('0x53')]['id']){delete _0x40f3e5['body']['id'];}return db[_0xbddc('0x2e')][_0xbddc('0x4a')]({'where':{'id':_0x40f3e5[_0xbddc('0x4e')]['id']}})[_0xbddc('0x23')](handleEntityNotFound(_0xd51fe0,null))[_0xbddc('0x23')](saveUpdates(_0x40f3e5[_0xbddc('0x53')],null))['then'](respondWithResult(_0xd51fe0,null))[_0xbddc('0x45')](handleError(_0xd51fe0,null));};exports[_0xbddc('0x26')]=function(_0x55f9ea,_0x3df217){return db['JscriptyProject'][_0xbddc('0x4a')]({'where':{'id':_0x55f9ea[_0xbddc('0x4e')]['id']}})[_0xbddc('0x23')](handleEntityNotFound(_0x3df217,null))['then'](removeEntity(_0x3df217,null))[_0xbddc('0x45')](handleError(_0x3df217,null));};exports[_0xbddc('0x56')]=function(_0x2ea352,_0x16268b,_0x367b14){var _0x371f87={'raw':!![],'where':{}};var _0x36b268={};var _0x3c1c3d={'count':0x0,'rows':[]};return db[_0xbddc('0x2e')]['findOne']({'where':{'id':_0x2ea352['params']['id']}})[_0xbddc('0x23')](handleEntityNotFound(_0x16268b,null))[_0xbddc('0x23')](function(_0x181c4c){if(_0x181c4c){_0x36b268['model']=_[_0xbddc('0x33')](db['JscriptySessionReport'][_0xbddc('0x2f')]);_0x36b268[_0xbddc('0x32')]=_['keys'](_0x2ea352[_0xbddc('0x32')]);_0x36b268[_0xbddc('0x34')]=_['intersection'](_0x36b268[_0xbddc('0x31')],_0x36b268[_0xbddc('0x32')]);_0x371f87[_0xbddc('0x35')]=_[_0xbddc('0x4f')](_0x36b268[_0xbddc('0x31')],qs[_0xbddc('0x36')](_0x2ea352[_0xbddc('0x32')][_0xbddc('0x36')]));_0x371f87['attributes']=_0x371f87[_0xbddc('0x35')]['length']?_0x371f87['attributes']:_0x36b268[_0xbddc('0x31')];if(!_0x2ea352[_0xbddc('0x32')]['hasOwnProperty'](_0xbddc('0x38'))){_0x371f87[_0xbddc('0x1e')]=qs['limit'](_0x2ea352[_0xbddc('0x32')][_0xbddc('0x1e')]);_0x371f87[_0xbddc('0x1d')]=qs['offset'](_0x2ea352[_0xbddc('0x32')][_0xbddc('0x1d')]);}_0x371f87[_0xbddc('0x39')]=qs[_0xbddc('0x3a')](_0x2ea352['query'][_0xbddc('0x3a')]);_0x371f87[_0xbddc('0x3b')]=qs[_0xbddc('0x34')](_['pick'](_0x2ea352[_0xbddc('0x32')],_0x36b268[_0xbddc('0x34')]));_0x371f87[_0xbddc('0x3b')][_0xbddc('0x57')]=_0x181c4c['id'];if(_0x2ea352[_0xbddc('0x32')][_0xbddc('0x3d')]){_0x371f87[_0xbddc('0x3b')]=_[_0xbddc('0x3e')](_0x371f87['where'],{'$or':_[_0xbddc('0x2d')](_0x371f87['attributes'],function(_0x5c1244){var _0x15d88a={};_0x15d88a[_0x5c1244]={'$like':'%'+_0x2ea352[_0xbddc('0x32')][_0xbddc('0x3d')]+'%'};return _0x15d88a;})});}_0x371f87=_[_0xbddc('0x3e')]({},_0x371f87,_0x2ea352['options']);return db[_0xbddc('0x58')]['count']({'where':_0x371f87['where']})[_0xbddc('0x23')](function(_0x311376){_0x3c1c3d['count']=_0x311376;if(_0x2ea352[_0xbddc('0x32')][_0xbddc('0x40')]){_0x371f87['include']=[{'all':!![]}];}return db[_0xbddc('0x58')][_0xbddc('0x59')](_0x371f87);})[_0xbddc('0x23')](function(_0xf8d456){_0x3c1c3d[_0xbddc('0x42')]=_0xf8d456;return _0x3c1c3d;});}})[_0xbddc('0x23')](respondWithFilteredResult(_0x16268b,_0x371f87))[_0xbddc('0x45')](handleError(_0x16268b,null));};exports[_0xbddc('0x5a')]=function(_0x533f7d,_0x2dd869,_0x226a2f){var _0x151ad1={'raw':!![],'where':{}};var _0x598d41={};var _0x6147f3={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x533f7d[_0xbddc('0x4e')]['id']}})[_0xbddc('0x23')](handleEntityNotFound(_0x2dd869,null))[_0xbddc('0x23')](function(_0x30d4e1){if(_0x30d4e1){_0x598d41['model']=_['keys'](db[_0xbddc('0x5b')]['rawAttributes']);_0x598d41[_0xbddc('0x32')]=_[_0xbddc('0x33')](_0x533f7d['query']);_0x598d41['filters']=_[_0xbddc('0x4f')](_0x598d41[_0xbddc('0x31')],_0x598d41['query']);_0x151ad1[_0xbddc('0x35')]=_[_0xbddc('0x4f')](_0x598d41[_0xbddc('0x31')],qs[_0xbddc('0x36')](_0x533f7d[_0xbddc('0x32')][_0xbddc('0x36')]));_0x151ad1['attributes']=_0x151ad1[_0xbddc('0x35')][_0xbddc('0x37')]?_0x151ad1[_0xbddc('0x35')]:_0x598d41[_0xbddc('0x31')];if(!_0x533f7d['query'][_0xbddc('0x5c')]('nolimit')){_0x151ad1['limit']=qs['limit'](_0x533f7d[_0xbddc('0x32')][_0xbddc('0x1e')]);_0x151ad1[_0xbddc('0x1d')]=qs[_0xbddc('0x1d')](_0x533f7d[_0xbddc('0x32')][_0xbddc('0x1d')]);}_0x151ad1[_0xbddc('0x39')]=qs['sort'](_0x533f7d[_0xbddc('0x32')]['sort']);_0x151ad1['where']=qs[_0xbddc('0x34')](_[_0xbddc('0x3c')](_0x533f7d[_0xbddc('0x32')],_0x598d41[_0xbddc('0x34')]));_0x151ad1[_0xbddc('0x3b')][_0xbddc('0x57')]=_0x30d4e1['id'];if(_0x533f7d[_0xbddc('0x32')][_0xbddc('0x3d')]){_0x151ad1[_0xbddc('0x3b')]=_['merge'](_0x151ad1['where'],{'$or':_['map'](_0x151ad1[_0xbddc('0x35')],function(_0x3548f2){var _0x4ecde1={};_0x4ecde1[_0x3548f2]={'$like':'%'+_0x533f7d[_0xbddc('0x32')][_0xbddc('0x3d')]+'%'};return _0x4ecde1;})});}_0x151ad1=_[_0xbddc('0x3e')]({},_0x151ad1,_0x533f7d['options']);return db['JscriptyAnswerReport'][_0xbddc('0x1c')]({'where':_0x151ad1[_0xbddc('0x3b')]})[_0xbddc('0x23')](function(_0x13e72f){_0x6147f3[_0xbddc('0x1c')]=_0x13e72f;if(_0x533f7d[_0xbddc('0x32')]['includeAll']){_0x151ad1['include']=[{'all':!![]}];}return db[_0xbddc('0x5b')][_0xbddc('0x59')](_0x151ad1);})['then'](function(_0x408a1e){_0x6147f3['rows']=_0x408a1e;return _0x6147f3;});}})['then'](respondWithFilteredResult(_0x2dd869,_0x151ad1))[_0xbddc('0x45')](handleError(_0x2dd869,null));};function char(_0x572f49){return'number'===typeof _0x572f49?String[_0xbddc('0x5d')]['apply'](null,arguments):_0x572f49;}function needsEncapsulation(_0x4f315f){return!!_0x4f315f&&(_0x4f315f[_0xbddc('0x5e')]()[_0xbddc('0x5f')](char(0xd))>=0x0||_0x4f315f[_0xbddc('0x5e')]()[_0xbddc('0x5f')](char(0xa))>=0x0||_0x4f315f[_0xbddc('0x5e')]()[_0xbddc('0x5f')](char(0x2c))>=0x0||_0x4f315f[_0xbddc('0x5e')]()[_0xbddc('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x7216c4){var _0x213881=char(0x22),_0x12708a='\x5c'+char(0x22),_0x3c1698=_0x7216c4[_0xbddc('0x5e')]()[_0xbddc('0x60')](new RegExp(_0x213881,'g'),_0x12708a);return _0x213881+_0x3c1698+_0x213881;}exports[_0xbddc('0x61')]=function(_0x384a36,_0x472a1a,_0x770618){var _0xd9e8f1,_0x35d13c;var _0x3d98b3={'where':{'ProjectId':_0x384a36['params']['id']}};if(_0x384a36[_0xbddc('0x32')]['startTime']){_0x3d98b3['where']['starttime']=JSON[_0xbddc('0x62')](_0x384a36[_0xbddc('0x32')][_0xbddc('0x63')]);}return db['JscriptySessionReport']['findAll'](_0x3d98b3)[_0xbddc('0x23')](handleEntityNotFound(_0x472a1a,null))[_0xbddc('0x23')](function(_0x5c7874){if(_0x5c7874){_0xd9e8f1=_0x5c7874;return db[_0xbddc('0x64')][_0xbddc('0x59')]({'where':{'SessionId':{'$in':_[_0xbddc('0x2d')](_0xd9e8f1,'id')},'ProjectId':_0x384a36['params']['id']},'order':_0xbddc('0x65')});}})[_0xbddc('0x23')](handleEntityNotFound(_0x472a1a,null))[_0xbddc('0x23')](function(_0x1d292b){if(_0x1d292b){_0x35d13c=_0x1d292b;var _0x23ebd3={};for(var _0xb4826f=0x0,_0x4c25c4=_0x35d13c[_0xbddc('0x37')];_0xb4826f<_0x4c25c4;_0xb4826f++){if(!_0x23ebd3['hasOwnProperty'](_0x35d13c[_0xb4826f][_0xbddc('0x66')])){_0x23ebd3[_0x35d13c[_0xb4826f][_0xbddc('0x66')]]=needsEncapsulation(_0x35d13c[_0xb4826f][_0xbddc('0x67')])?encapsulate(_0x35d13c[_0xb4826f][_0xbddc('0x67')]):_0x35d13c[_0xb4826f][_0xbddc('0x67')];}}var _0x2ec9d7=[],_0x39fcc3={};for(var _0x761053=0x0,_0xb76876=_0xd9e8f1[_0xbddc('0x37')];_0x761053<_0xb76876;_0x761053++){_0x39fcc3={'ProjectId':_0x384a36[_0xbddc('0x4e')]['id'],'SessionId':_0xd9e8f1[_0x761053]['id'],'StartTime':moment(_0xd9e8f1[_0x761053][_0xbddc('0x68')])[_0xbddc('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0xacfe9e=0x0,_0x11ac46=_0x35d13c[_0xbddc('0x37')];_0xacfe9e<_0x11ac46;_0xacfe9e++){if(_0x35d13c[_0xacfe9e]['SessionId']==_0xd9e8f1[_0x761053]['id']&&_0x23ebd3[_0xbddc('0x5c')](_0x35d13c[_0xacfe9e][_0xbddc('0x66')])){_0x39fcc3[_0x23ebd3[_0x35d13c[_0xacfe9e][_0xbddc('0x66')]]]=_0x35d13c[_0xacfe9e][_0xbddc('0x6a')];}}for(var _0x31dfb5 in _0x23ebd3){if(!_0x39fcc3[_0xbddc('0x5c')](_0x23ebd3[_0x31dfb5])){_0x39fcc3[_0x23ebd3[_0x31dfb5]]=null;}}_0x2ec9d7[_0xbddc('0x6b')](_0x39fcc3);}return _0x2ec9d7;}})[_0xbddc('0x23')](function(_0x2c68a7){if(!_[_0xbddc('0x6c')](_0x2c68a7)){var _0x493b5f=toCsv(_0x2c68a7);var _0x58d2bb=Date[_0xbddc('0x6d')]();fs[_0xbddc('0x6e')](util[_0xbddc('0x69')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x384a36['params']['id'],_0x58d2bb),_0x493b5f);_0x472a1a['setHeader'](_0xbddc('0x6f'),_0xbddc('0x70')+util[_0xbddc('0x69')](_0xbddc('0x71'),_0x384a36[_0xbddc('0x4e')]['id'],_0x58d2bb));_0x472a1a[_0xbddc('0x72')](_0xbddc('0x73'),'text/csv');return _0x472a1a[_0xbddc('0x74')](util[_0xbddc('0x69')](_0xbddc('0x75'),_0x384a36[_0xbddc('0x4e')]['id'],_0x58d2bb));}else{return _0x472a1a['sendStatus'](0xcc);}})[_0xbddc('0x45')](handleError(_0x472a1a,null));}; \ No newline at end of file +var _0x0fab=['intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','JscriptyProject','includeAll','include','findAll','show','params','filtears','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','updatedAt','createdAt','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','get','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x3764d8,_0xde088b){var _0x566a7d=function(_0x5b8ef3){while(--_0x5b8ef3){_0x3764d8['push'](_0x3764d8['shift']());}};_0x566a7d(++_0xde088b);}(_0x0fab,0x1a5));var _0xb0fa=function(_0x442d3a,_0x5537ee){_0x442d3a=_0x442d3a-0x0;var _0x2fd0b1=_0x0fab[_0x442d3a];return _0x2fd0b1;};'use strict';var pdf=require(_0xb0fa('0x0'));var emlformat=require(_0xb0fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb0fa('0x2'));var jsonpatch=require(_0xb0fa('0x3'));var rp=require(_0xb0fa('0x4'));var moment=require(_0xb0fa('0x5'));var BPromise=require(_0xb0fa('0x6'));var Mustache=require(_0xb0fa('0x7'));var util=require(_0xb0fa('0x8'));var path=require(_0xb0fa('0x9'));var sox=require('sox');var csv=require(_0xb0fa('0xa'));var ejs=require(_0xb0fa('0xb'));var fs=require('fs');var _=require(_0xb0fa('0xc'));var squel=require('squel');var crypto=require(_0xb0fa('0xd'));var jsforce=require(_0xb0fa('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb0fa('0xf'));var Papa=require('papaparse');var Redis=require(_0xb0fa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb0fa('0x11'));var as=require(_0xb0fa('0x12'));var hardwareService=require(_0xb0fa('0x13'));var logger=require(_0xb0fa('0x14'))('api');var utils=require(_0xb0fa('0x15'));var config=require(_0xb0fa('0x16'));var licenseUtil=require(_0xb0fa('0x17'));var db=require(_0xb0fa('0x18'))['db'];function respondWithStatusCode(_0x5166fa,_0x421929){_0x421929=_0x421929||0xcc;return function(_0x5e58a7){if(_0x5e58a7){return _0x5166fa[_0xb0fa('0x19')](_0x421929);}return _0x5166fa['status'](_0x421929)['end']();};}function respondWithResult(_0x494a72,_0x1c56a4){_0x1c56a4=_0x1c56a4||0xc8;return function(_0x4324c7){if(_0x4324c7){return _0x494a72[_0xb0fa('0x1a')](_0x1c56a4)['json'](_0x4324c7);}};}function respondWithFilteredResult(_0x53c26c,_0x35bf4a){return function(_0x3daf6b){if(_0x3daf6b){var _0x1c17a1=_0x3daf6b[_0xb0fa('0x1b')],_0x1b2906=_0x35bf4a['offset'],_0x262b8b=_0x35bf4a[_0xb0fa('0x1c')]+_0x35bf4a[_0xb0fa('0x1d')],_0x2c53aa;if(_0x262b8b>=_0x1c17a1){_0x262b8b=_0x1c17a1;_0x2c53aa=0xc8;}else{_0x2c53aa=0xce;}_0x53c26c[_0xb0fa('0x1a')](_0x2c53aa);return _0x53c26c[_0xb0fa('0x1e')](_0xb0fa('0x1f'),_0x1b2906+'-'+_0x262b8b+'/'+_0x1c17a1)[_0xb0fa('0x20')](_0x3daf6b);}return null;};}function patchUpdates(_0x4dce2e){return function(_0x2f67cf){try{jsonpatch['apply'](_0x2f67cf,_0x4dce2e,!![]);}catch(_0x550ad3){return BPromise['reject'](_0x550ad3);}return _0x2f67cf[_0xb0fa('0x21')]();};}function saveUpdates(_0xd98374,_0xa53f9e){return function(_0xa4db01){if(_0xa4db01){return _0xa4db01[_0xb0fa('0x22')](_0xd98374)[_0xb0fa('0x23')](function(_0x41a31a){return _0x41a31a;});}return null;};}function removeEntity(_0x4847de,_0x5c5e95){return function(_0xd7ac2f){if(_0xd7ac2f){return _0xd7ac2f[_0xb0fa('0x24')]()[_0xb0fa('0x23')](function(){var _0x5ba83f=_0xd7ac2f[_0xb0fa('0x25')]({'plain':!![]});var _0x2f6fc3='Projects';return db[_0xb0fa('0x26')][_0xb0fa('0x24')]({'where':{'type':_0x2f6fc3,'resourceId':_0x5ba83f['id']}})[_0xb0fa('0x23')](function(){return _0xd7ac2f;});})['then'](function(){_0x4847de[_0xb0fa('0x1a')](0xcc)[_0xb0fa('0x27')]();});}};}function handleEntityNotFound(_0x248e31,_0x30b8dd){return function(_0x36029e){if(!_0x36029e){_0x248e31['sendStatus'](0x194);}return _0x36029e;};}function handleError(_0x321b42,_0x3af477){_0x3af477=_0x3af477||0x1f4;return function(_0x36d264){logger[_0xb0fa('0x28')](_0x36d264['stack']);if(_0x36d264['name']){delete _0x36d264[_0xb0fa('0x29')];}_0x321b42[_0xb0fa('0x1a')](_0x3af477)[_0xb0fa('0x2a')](_0x36d264);};}exports['index']=function(_0x3b7851,_0x4a6af2){var _0x3dfc71={},_0x179434={},_0x183327={'count':0x0,'rows':[]};var _0x52f38b=_[_0xb0fa('0x2b')](db['JscriptyProject'][_0xb0fa('0x2c')],function(_0x1f412b){return{'name':_0x1f412b[_0xb0fa('0x2d')],'type':_0x1f412b[_0xb0fa('0x2e')][_0xb0fa('0x2f')]};});_0x179434[_0xb0fa('0x30')]=_[_0xb0fa('0x2b')](_0x52f38b,_0xb0fa('0x29'));_0x179434[_0xb0fa('0x31')]=_[_0xb0fa('0x32')](_0x3b7851['query']);_0x179434['filters']=_[_0xb0fa('0x33')](_0x179434[_0xb0fa('0x30')],_0x179434[_0xb0fa('0x31')]);_0x3dfc71[_0xb0fa('0x34')]=_[_0xb0fa('0x33')](_0x179434[_0xb0fa('0x30')],qs[_0xb0fa('0x35')](_0x3b7851['query'][_0xb0fa('0x35')]));_0x3dfc71['attributes']=_0x3dfc71['attributes'][_0xb0fa('0x36')]?_0x3dfc71['attributes']:_0x179434[_0xb0fa('0x30')];if(!_0x3b7851[_0xb0fa('0x31')]['hasOwnProperty'](_0xb0fa('0x37'))){_0x3dfc71[_0xb0fa('0x1d')]=qs['limit'](_0x3b7851[_0xb0fa('0x31')][_0xb0fa('0x1d')]);_0x3dfc71[_0xb0fa('0x1c')]=qs[_0xb0fa('0x1c')](_0x3b7851[_0xb0fa('0x31')][_0xb0fa('0x1c')]);}_0x3dfc71[_0xb0fa('0x38')]=qs['sort'](_0x3b7851[_0xb0fa('0x31')][_0xb0fa('0x39')]);_0x3dfc71[_0xb0fa('0x3a')]=qs[_0xb0fa('0x3b')](_['pick'](_0x3b7851['query'],_0x179434[_0xb0fa('0x3b')]),_0x52f38b);if(_0x3b7851[_0xb0fa('0x31')][_0xb0fa('0x3c')]){_0x3dfc71[_0xb0fa('0x3a')]=_['merge'](_0x3dfc71['where'],{'$or':_[_0xb0fa('0x2b')](_0x52f38b,function(_0x3071eb){if(_0x3071eb[_0xb0fa('0x2e')]!==_0xb0fa('0x3d')){var _0x4784d4={};_0x4784d4[_0x3071eb[_0xb0fa('0x29')]]={'$like':'%'+_0x3b7851[_0xb0fa('0x31')]['filter']+'%'};return _0x4784d4;}})});}_0x3dfc71=_['merge']({},_0x3dfc71,_0x3b7851[_0xb0fa('0x3e')]);var _0xccce2b={'where':_0x3dfc71[_0xb0fa('0x3a')]};return db[_0xb0fa('0x3f')][_0xb0fa('0x1b')](_0xccce2b)[_0xb0fa('0x23')](function(_0x1d550d){_0x183327['count']=_0x1d550d;if(_0x3b7851['query'][_0xb0fa('0x40')]){_0x3dfc71[_0xb0fa('0x41')]=[{'all':!![]}];}return db[_0xb0fa('0x3f')][_0xb0fa('0x42')](_0x3dfc71);})['then'](function(_0x507489){_0x183327['rows']=_0x507489;return _0x183327;})['then'](respondWithFilteredResult(_0x4a6af2,_0x3dfc71))['catch'](handleError(_0x4a6af2,null));};exports[_0xb0fa('0x43')]=function(_0x198e29,_0x16e666){var _0x1935be={'raw':![],'where':{'id':_0x198e29[_0xb0fa('0x44')]['id']}},_0x58f3ed={};_0x58f3ed[_0xb0fa('0x30')]=_[_0xb0fa('0x32')](db[_0xb0fa('0x3f')][_0xb0fa('0x2c')]);_0x58f3ed[_0xb0fa('0x31')]=_[_0xb0fa('0x32')](_0x198e29['query']);_0x58f3ed[_0xb0fa('0x45')]=_[_0xb0fa('0x33')](_0x58f3ed[_0xb0fa('0x30')],_0x58f3ed['query']);_0x1935be[_0xb0fa('0x34')]=_[_0xb0fa('0x33')](_0x58f3ed[_0xb0fa('0x30')],qs[_0xb0fa('0x35')](_0x198e29[_0xb0fa('0x31')]['fields']));_0x1935be[_0xb0fa('0x34')]=_0x1935be[_0xb0fa('0x34')]['length']?_0x1935be[_0xb0fa('0x34')]:_0x58f3ed[_0xb0fa('0x30')];if(_0x198e29['query'][_0xb0fa('0x40')]){_0x1935be[_0xb0fa('0x41')]=[{'all':!![]}];}_0x1935be=_['merge']({},_0x1935be,_0x198e29[_0xb0fa('0x3e')]);return db[_0xb0fa('0x3f')][_0xb0fa('0x46')](_0x1935be)[_0xb0fa('0x23')](handleEntityNotFound(_0x16e666,null))[_0xb0fa('0x23')](respondWithResult(_0x16e666,null))[_0xb0fa('0x47')](handleError(_0x16e666,null));};exports['create']=function(_0x24b0cf,_0x596af6){return db[_0xb0fa('0x3f')][_0xb0fa('0x48')](_0x24b0cf[_0xb0fa('0x49')],{})[_0xb0fa('0x23')](function(_0x14bbbb){var _0x4c47d8=_0x24b0cf[_0xb0fa('0x4a')][_0xb0fa('0x25')]({'plain':!![]});if(!_0x4c47d8)throw new Error(_0xb0fa('0x4b'));if(_0x4c47d8[_0xb0fa('0x4c')]===_0xb0fa('0x4a')){var _0x2fdfb8=_0x14bbbb[_0xb0fa('0x25')]({'plain':!![]});var _0x2069b5=_0xb0fa('0x4d');return db[_0xb0fa('0x4e')][_0xb0fa('0x46')]({'where':{'name':_0x2069b5,'userProfileId':_0x4c47d8[_0xb0fa('0x4f')]},'raw':!![]})[_0xb0fa('0x23')](function(_0x389491){if(_0x389491&&_0x389491[_0xb0fa('0x50')]===0x0){return db[_0xb0fa('0x26')][_0xb0fa('0x48')]({'name':_0x2fdfb8['name'],'resourceId':_0x2fdfb8['id'],'type':_0x389491[_0xb0fa('0x29')],'sectionId':_0x389491['id']},{})[_0xb0fa('0x23')](function(){return _0x14bbbb;});}else{return _0x14bbbb;}})[_0xb0fa('0x47')](function(_0x1cd3a2){logger[_0xb0fa('0x28')](_0xb0fa('0x51'),_0x1cd3a2);throw _0x1cd3a2;});}return _0x14bbbb;})[_0xb0fa('0x23')](respondWithResult(_0x596af6,0xc9))[_0xb0fa('0x47')](handleError(_0x596af6,null));};exports[_0xb0fa('0x52')]=function(_0x41c28f,_0x50d3f2){var _0x441f1b={'where':{'id':_0x41c28f[_0xb0fa('0x44')]['id']}},_0x3a39ae={};_0x3a39ae[_0xb0fa('0x30')]=_[_0xb0fa('0x32')](db[_0xb0fa('0x3f')]['rawAttributes']);_0x441f1b[_0xb0fa('0x34')]=_[_0xb0fa('0x33')](_0x3a39ae[_0xb0fa('0x30')],qs[_0xb0fa('0x35')](_0x41c28f[_0xb0fa('0x31')][_0xb0fa('0x35')]));_0x441f1b[_0xb0fa('0x34')]=_0x441f1b[_0xb0fa('0x34')][_0xb0fa('0x36')]?_0x441f1b[_0xb0fa('0x34')]:_0x3a39ae['model'];if(_0x41c28f[_0xb0fa('0x31')][_0xb0fa('0x40')]){_0x441f1b[_0xb0fa('0x41')]=[{'all':!![]}];}_0x441f1b=_[_0xb0fa('0x53')]({},_0x441f1b,_0x41c28f[_0xb0fa('0x3e')]);return db[_0xb0fa('0x3f')]['find'](_0x441f1b)[_0xb0fa('0x23')](handleEntityNotFound(_0x50d3f2,null))[_0xb0fa('0x23')](function(_0x5bbcc9){if(_0x5bbcc9){var _0x20cd86=_0x5bbcc9['get']({'plain':!![]});_0x20cd86=qs[_0xb0fa('0x54')](_0x20cd86,['id','createdAt',_0xb0fa('0x55')]);_0x41c28f['body']=_['omit'](_0x41c28f[_0xb0fa('0x49')],['id',_0xb0fa('0x56'),'updatedAt']);return db['JscriptyProject'][_0xb0fa('0x48')](_[_0xb0fa('0x53')](_0x20cd86,_0x41c28f[_0xb0fa('0x49')]),{'include':_0x41c28f[_0xb0fa('0x31')][_0xb0fa('0x40')]?[{'all':!![]}]:undefined})[_0xb0fa('0x23')](function(_0x1a5722){var _0x1559d3=_0x41c28f['user'][_0xb0fa('0x25')]({'plain':!![]});if(!_0x1559d3)throw new Error(_0xb0fa('0x4b'));if(_0x1559d3[_0xb0fa('0x4c')]==='user'){var _0x275190=_0x1a5722[_0xb0fa('0x25')]({'plain':!![]});var _0x39106c=_0xb0fa('0x4d');return db[_0xb0fa('0x4e')][_0xb0fa('0x46')]({'where':{'name':_0x39106c,'userProfileId':_0x1559d3[_0xb0fa('0x4f')]},'raw':!![]})[_0xb0fa('0x23')](function(_0x47ca5e){if(_0x47ca5e&&_0x47ca5e[_0xb0fa('0x50')]===0x0){return db[_0xb0fa('0x26')][_0xb0fa('0x48')]({'name':_0x275190[_0xb0fa('0x29')],'resourceId':_0x275190['id'],'type':_0x47ca5e[_0xb0fa('0x29')],'sectionId':_0x47ca5e['id']},{})['then'](function(){return _0x1a5722;});}else{return _0x1a5722;}})['catch'](function(_0xa1466f){logger['error'](_0xb0fa('0x51'),_0xa1466f);throw _0xa1466f;});}return _0x1a5722;});}})[_0xb0fa('0x23')](respondWithResult(_0x50d3f2,0xc9))['catch'](handleError(_0x50d3f2,null));};exports[_0xb0fa('0x22')]=function(_0x5438fe,_0x5e8a7c){if(_0x5438fe[_0xb0fa('0x49')]['id']){delete _0x5438fe['body']['id'];}return db[_0xb0fa('0x3f')][_0xb0fa('0x46')]({'where':{'id':_0x5438fe[_0xb0fa('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e8a7c,null))[_0xb0fa('0x23')](saveUpdates(_0x5438fe['body'],null))['then'](respondWithResult(_0x5e8a7c,null))['catch'](handleError(_0x5e8a7c,null));};exports[_0xb0fa('0x24')]=function(_0x499cee,_0x14016f){return db[_0xb0fa('0x3f')][_0xb0fa('0x46')]({'where':{'id':_0x499cee[_0xb0fa('0x44')]['id']}})['then'](handleEntityNotFound(_0x14016f,null))[_0xb0fa('0x23')](removeEntity(_0x14016f,null))['catch'](handleError(_0x14016f,null));};exports[_0xb0fa('0x57')]=function(_0x251365,_0x2157d6,_0x58d5bc){var _0x26751d={'raw':!![],'where':{}};var _0x27dc1d={};var _0x27e464={'count':0x0,'rows':[]};return db[_0xb0fa('0x3f')][_0xb0fa('0x58')]({'where':{'id':_0x251365[_0xb0fa('0x44')]['id']}})[_0xb0fa('0x23')](handleEntityNotFound(_0x2157d6,null))[_0xb0fa('0x23')](function(_0x21f4e8){if(_0x21f4e8){_0x27dc1d[_0xb0fa('0x30')]=_[_0xb0fa('0x32')](db[_0xb0fa('0x59')][_0xb0fa('0x2c')]);_0x27dc1d[_0xb0fa('0x31')]=_[_0xb0fa('0x32')](_0x251365[_0xb0fa('0x31')]);_0x27dc1d[_0xb0fa('0x3b')]=_[_0xb0fa('0x33')](_0x27dc1d[_0xb0fa('0x30')],_0x27dc1d[_0xb0fa('0x31')]);_0x26751d[_0xb0fa('0x34')]=_[_0xb0fa('0x33')](_0x27dc1d['model'],qs[_0xb0fa('0x35')](_0x251365[_0xb0fa('0x31')]['fields']));_0x26751d[_0xb0fa('0x34')]=_0x26751d[_0xb0fa('0x34')][_0xb0fa('0x36')]?_0x26751d['attributes']:_0x27dc1d[_0xb0fa('0x30')];if(!_0x251365[_0xb0fa('0x31')][_0xb0fa('0x5a')](_0xb0fa('0x37'))){_0x26751d[_0xb0fa('0x1d')]=qs[_0xb0fa('0x1d')](_0x251365[_0xb0fa('0x31')]['limit']);_0x26751d[_0xb0fa('0x1c')]=qs[_0xb0fa('0x1c')](_0x251365[_0xb0fa('0x31')][_0xb0fa('0x1c')]);}_0x26751d[_0xb0fa('0x38')]=qs[_0xb0fa('0x39')](_0x251365[_0xb0fa('0x31')]['sort']);_0x26751d['where']=qs['filters'](_[_0xb0fa('0x5b')](_0x251365[_0xb0fa('0x31')],_0x27dc1d['filters']));_0x26751d[_0xb0fa('0x3a')][_0xb0fa('0x5c')]=_0x21f4e8['id'];if(_0x251365[_0xb0fa('0x31')][_0xb0fa('0x3c')]){_0x26751d[_0xb0fa('0x3a')]=_[_0xb0fa('0x53')](_0x26751d[_0xb0fa('0x3a')],{'$or':_[_0xb0fa('0x2b')](_0x26751d[_0xb0fa('0x34')],function(_0x3a848c){var _0x50c331={};_0x50c331[_0x3a848c]={'$like':'%'+_0x251365[_0xb0fa('0x31')][_0xb0fa('0x3c')]+'%'};return _0x50c331;})});}_0x26751d=_[_0xb0fa('0x53')]({},_0x26751d,_0x251365[_0xb0fa('0x3e')]);return db[_0xb0fa('0x59')][_0xb0fa('0x1b')]({'where':_0x26751d[_0xb0fa('0x3a')]})[_0xb0fa('0x23')](function(_0x3bf40d){_0x27e464['count']=_0x3bf40d;if(_0x251365[_0xb0fa('0x31')]['includeAll']){_0x26751d['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x26751d);})[_0xb0fa('0x23')](function(_0x238878){_0x27e464[_0xb0fa('0x5d')]=_0x238878;return _0x27e464;});}})[_0xb0fa('0x23')](respondWithFilteredResult(_0x2157d6,_0x26751d))[_0xb0fa('0x47')](handleError(_0x2157d6,null));};exports[_0xb0fa('0x5e')]=function(_0x3cef82,_0x2baf54,_0x5be70e){var _0x38906c={'raw':!![],'where':{}};var _0x3b2f93={};var _0x379ae2={'count':0x0,'rows':[]};return db[_0xb0fa('0x3f')][_0xb0fa('0x58')]({'where':{'id':_0x3cef82[_0xb0fa('0x44')]['id']}})[_0xb0fa('0x23')](handleEntityNotFound(_0x2baf54,null))[_0xb0fa('0x23')](function(_0x1524c7){if(_0x1524c7){_0x3b2f93[_0xb0fa('0x30')]=_[_0xb0fa('0x32')](db[_0xb0fa('0x5f')]['rawAttributes']);_0x3b2f93[_0xb0fa('0x31')]=_[_0xb0fa('0x32')](_0x3cef82[_0xb0fa('0x31')]);_0x3b2f93[_0xb0fa('0x3b')]=_[_0xb0fa('0x33')](_0x3b2f93['model'],_0x3b2f93[_0xb0fa('0x31')]);_0x38906c[_0xb0fa('0x34')]=_[_0xb0fa('0x33')](_0x3b2f93['model'],qs[_0xb0fa('0x35')](_0x3cef82[_0xb0fa('0x31')][_0xb0fa('0x35')]));_0x38906c[_0xb0fa('0x34')]=_0x38906c[_0xb0fa('0x34')][_0xb0fa('0x36')]?_0x38906c['attributes']:_0x3b2f93[_0xb0fa('0x30')];if(!_0x3cef82[_0xb0fa('0x31')]['hasOwnProperty']('nolimit')){_0x38906c[_0xb0fa('0x1d')]=qs[_0xb0fa('0x1d')](_0x3cef82[_0xb0fa('0x31')][_0xb0fa('0x1d')]);_0x38906c[_0xb0fa('0x1c')]=qs[_0xb0fa('0x1c')](_0x3cef82[_0xb0fa('0x31')][_0xb0fa('0x1c')]);}_0x38906c[_0xb0fa('0x38')]=qs[_0xb0fa('0x39')](_0x3cef82[_0xb0fa('0x31')][_0xb0fa('0x39')]);_0x38906c[_0xb0fa('0x3a')]=qs[_0xb0fa('0x3b')](_['pick'](_0x3cef82['query'],_0x3b2f93[_0xb0fa('0x3b')]));_0x38906c[_0xb0fa('0x3a')][_0xb0fa('0x5c')]=_0x1524c7['id'];if(_0x3cef82['query'][_0xb0fa('0x3c')]){_0x38906c[_0xb0fa('0x3a')]=_[_0xb0fa('0x53')](_0x38906c[_0xb0fa('0x3a')],{'$or':_[_0xb0fa('0x2b')](_0x38906c[_0xb0fa('0x34')],function(_0x4bc550){var _0x18889d={};_0x18889d[_0x4bc550]={'$like':'%'+_0x3cef82[_0xb0fa('0x31')][_0xb0fa('0x3c')]+'%'};return _0x18889d;})});}_0x38906c=_[_0xb0fa('0x53')]({},_0x38906c,_0x3cef82[_0xb0fa('0x3e')]);return db['JscriptyAnswerReport']['count']({'where':_0x38906c[_0xb0fa('0x3a')]})['then'](function(_0x538a2e){_0x379ae2['count']=_0x538a2e;if(_0x3cef82[_0xb0fa('0x31')]['includeAll']){_0x38906c['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xb0fa('0x42')](_0x38906c);})[_0xb0fa('0x23')](function(_0x4fc986){_0x379ae2[_0xb0fa('0x5d')]=_0x4fc986;return _0x379ae2;});}})[_0xb0fa('0x23')](respondWithFilteredResult(_0x2baf54,_0x38906c))[_0xb0fa('0x47')](handleError(_0x2baf54,null));};function char(_0x426b65){return _0xb0fa('0x60')===typeof _0x426b65?String[_0xb0fa('0x61')]['apply'](null,arguments):_0x426b65;}function needsEncapsulation(_0x205a70){return!!_0x205a70&&(_0x205a70[_0xb0fa('0x62')]()[_0xb0fa('0x63')](char(0xd))>=0x0||_0x205a70['toString']()[_0xb0fa('0x63')](char(0xa))>=0x0||_0x205a70[_0xb0fa('0x62')]()[_0xb0fa('0x63')](char(0x2c))>=0x0||_0x205a70['toString']()[_0xb0fa('0x63')](char(0x22))>=0x0);}function encapsulate(_0x5918ee){var _0x3174b5=char(0x22),_0x35e752='\x5c'+char(0x22),_0x36486f=_0x5918ee['toString']()[_0xb0fa('0x64')](new RegExp(_0x3174b5,'g'),_0x35e752);return _0x3174b5+_0x36486f+_0x3174b5;}exports[_0xb0fa('0x65')]=function(_0x476a73,_0x4de3fd,_0x2d23b3){var _0x207b95,_0x1487c2;var _0x270d7e={'where':{'ProjectId':_0x476a73[_0xb0fa('0x44')]['id']}};if(_0x476a73['query']['startTime']){_0x270d7e[_0xb0fa('0x3a')][_0xb0fa('0x66')]=JSON['parse'](_0x476a73[_0xb0fa('0x31')][_0xb0fa('0x67')]);}return db[_0xb0fa('0x59')][_0xb0fa('0x42')](_0x270d7e)[_0xb0fa('0x23')](handleEntityNotFound(_0x4de3fd,null))[_0xb0fa('0x23')](function(_0x22cb4c){if(_0x22cb4c){_0x207b95=_0x22cb4c;return db[_0xb0fa('0x68')][_0xb0fa('0x42')]({'where':{'SessionId':{'$in':_[_0xb0fa('0x2b')](_0x207b95,'id')},'ProjectId':_0x476a73[_0xb0fa('0x44')]['id']},'order':_0xb0fa('0x69')});}})[_0xb0fa('0x23')](handleEntityNotFound(_0x4de3fd,null))['then'](function(_0x2bfd07){if(_0x2bfd07){_0x1487c2=_0x2bfd07;var _0x2b074e={};for(var _0x46bd39=0x0,_0x247506=_0x1487c2[_0xb0fa('0x36')];_0x46bd39<_0x247506;_0x46bd39++){if(!_0x2b074e[_0xb0fa('0x5a')](_0x1487c2[_0x46bd39][_0xb0fa('0x6a')])){_0x2b074e[_0x1487c2[_0x46bd39][_0xb0fa('0x6a')]]=needsEncapsulation(_0x1487c2[_0x46bd39][_0xb0fa('0x6b')])?encapsulate(_0x1487c2[_0x46bd39][_0xb0fa('0x6b')]):_0x1487c2[_0x46bd39][_0xb0fa('0x6b')];}}var _0x5291f2=[],_0x2d538c={};for(var _0x5e8158=0x0,_0x4c2b44=_0x207b95[_0xb0fa('0x36')];_0x5e8158<_0x4c2b44;_0x5e8158++){_0x2d538c={'ProjectId':_0x476a73['params']['id'],'SessionId':_0x207b95[_0x5e8158]['id'],'StartTime':moment(_0x207b95[_0x5e8158][_0xb0fa('0x66')])[_0xb0fa('0x6c')](_0xb0fa('0x6d'))};for(var _0x15abed=0x0,_0xfb30f4=_0x1487c2['length'];_0x15abed<_0xfb30f4;_0x15abed++){if(_0x1487c2[_0x15abed]['SessionId']==_0x207b95[_0x5e8158]['id']&&_0x2b074e[_0xb0fa('0x5a')](_0x1487c2[_0x15abed][_0xb0fa('0x6a')])){_0x2d538c[_0x2b074e[_0x1487c2[_0x15abed][_0xb0fa('0x6a')]]]=_0x1487c2[_0x15abed]['answer'];}}for(var _0x2e44bf in _0x2b074e){if(!_0x2d538c[_0xb0fa('0x5a')](_0x2b074e[_0x2e44bf])){_0x2d538c[_0x2b074e[_0x2e44bf]]=null;}}_0x5291f2[_0xb0fa('0x6e')](_0x2d538c);}return _0x5291f2;}})[_0xb0fa('0x23')](function(_0x4a740d){if(!_['isEmpty'](_0x4a740d)){var _0x573571=toCsv(_0x4a740d);var _0x4459d7=Date[_0xb0fa('0x6f')]();fs['writeFileSync'](util[_0xb0fa('0x6c')](_0xb0fa('0x70'),_0x476a73[_0xb0fa('0x44')]['id'],_0x4459d7),_0x573571);_0x4de3fd[_0xb0fa('0x71')](_0xb0fa('0x72'),_0xb0fa('0x73')+util[_0xb0fa('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x476a73['params']['id'],_0x4459d7));_0x4de3fd[_0xb0fa('0x71')](_0xb0fa('0x74'),_0xb0fa('0x75'));return _0x4de3fd['download'](util[_0xb0fa('0x6c')](_0xb0fa('0x70'),_0x476a73[_0xb0fa('0x44')]['id'],_0x4459d7));}else{return _0x4de3fd[_0xb0fa('0x19')](0xcc);}})[_0xb0fa('0x47')](handleError(_0x4de3fd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 59b54a8..88a691e 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 _0x0d72=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x21ece3,_0x53feed){var _0x41439a=function(_0x46af59){while(--_0x46af59){_0x21ece3['push'](_0x21ece3['shift']());}};_0x41439a(++_0x53feed);}(_0x0d72,0x1ba));var _0x20d7=function(_0x5e2064,_0x2a098d){_0x5e2064=_0x5e2064-0x0;var _0x1109f4=_0x0d72[_0x5e2064];return _0x1109f4;};'use strict';var _=require(_0x20d7('0x0'));var util=require(_0x20d7('0x1'));var logger=require(_0x20d7('0x2'))(_0x20d7('0x3'));var moment=require(_0x20d7('0x4'));var BPromise=require(_0x20d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20d7('0x6'));var rimraf=require('rimraf');var config=require(_0x20d7('0x7'));var attributes=require(_0x20d7('0x8'));module[_0x20d7('0x9')]=function(_0x230fd8,_0x587509){return _0x230fd8[_0x20d7('0xa')](_0x20d7('0xb'),attributes,{'tableName':_0x20d7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c3d=['moment','bluebird','request-promise','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api'];(function(_0x31f33c,_0x3b6b32){var _0x362a9c=function(_0x46d120){while(--_0x46d120){_0x31f33c['push'](_0x31f33c['shift']());}};_0x362a9c(++_0x3b6b32);}(_0x1c3d,0xf7));var _0xd1c3=function(_0x46a8c7,_0x59f5b0){_0x46a8c7=_0x46a8c7-0x0;var _0x3cf81d=_0x1c3d[_0x46a8c7];return _0x3cf81d;};'use strict';var _=require(_0xd1c3('0x0'));var util=require('util');var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require(_0xd1c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1c3('0x6'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x27f69d,_0x1b77cf){return _0x27f69d[_0xd1c3('0x7')](_0xd1c3('0x8'),attributes,{'tableName':_0xd1c3('0x9'),'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 ed40e88..3d5bc83 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 _0x5b3e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x38c3ca,_0x47dbb2){var _0x5ec960=function(_0x58e447){while(--_0x58e447){_0x38c3ca['push'](_0x38c3ca['shift']());}};_0x5ec960(++_0x47dbb2);}(_0x5b3e,0x124));var _0xe5b3=function(_0x5e7882,_0x54aa1a){_0x5e7882=_0x5e7882-0x0;var _0x3021c4=_0x5b3e[_0x5e7882];return _0x3021c4;};'use strict';var _=require(_0xe5b3('0x0'));var util=require('util');var moment=require(_0xe5b3('0x1'));var BPromise=require(_0xe5b3('0x2'));var rs=require(_0xe5b3('0x3'));var fs=require('fs');var Redis=require(_0xe5b3('0x4'));var db=require(_0xe5b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5b3('0x6'))(_0xe5b3('0x7'));var config=require(_0xe5b3('0x8'));var jayson=require(_0xe5b3('0x9'));var client=jayson[_0xe5b3('0xa')][_0xe5b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8e2bcb,_0x3e7922,_0x37d4dc){return new BPromise(function(_0x48ff81,_0xdbc619){return client[_0xe5b3('0xc')](_0x8e2bcb,_0x37d4dc)[_0xe5b3('0xd')](function(_0x42db83){logger[_0xe5b3('0xe')](_0xe5b3('0xf'),_0x3e7922,'request\x20sent');logger[_0xe5b3('0x10')](_0xe5b3('0x11'),_0x3e7922,_0xe5b3('0x12'),JSON['stringify'](_0x42db83));if(_0x42db83['error']){if(_0x42db83[_0xe5b3('0x13')]['code']===0x1f4){logger[_0xe5b3('0x13')](_0xe5b3('0xf'),_0x3e7922,_0x42db83[_0xe5b3('0x13')]['message']);return _0xdbc619(_0x42db83[_0xe5b3('0x13')][_0xe5b3('0x14')]);}logger[_0xe5b3('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x3e7922,_0x42db83['error']['message']);return _0x48ff81(_0x42db83[_0xe5b3('0x13')][_0xe5b3('0x14')]);}else{logger[_0xe5b3('0xe')]('JscriptyProject,\x20%s,\x20%s',_0x3e7922,_0xe5b3('0x12'));_0x48ff81(_0x42db83[_0xe5b3('0x15')][_0xe5b3('0x14')]);}})[_0xe5b3('0x16')](function(_0x3775f5){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x3e7922,_0x3775f5);_0xdbc619(_0x3775f5);});});} \ No newline at end of file +var _0x0ddd=['code','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d2f62,_0x69a81b){var _0x6b86bd=function(_0x508049){while(--_0x508049){_0x4d2f62['push'](_0x4d2f62['shift']());}};_0x6b86bd(++_0x69a81b);}(_0x0ddd,0x192));var _0xd0dd=function(_0x36c5d9,_0x684299){_0x36c5d9=_0x36c5d9-0x0;var _0x4043f1=_0x0ddd[_0x36c5d9];return _0x4043f1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd0dd('0x0'));var rs=require(_0xd0dd('0x1'));var fs=require('fs');var Redis=require(_0xd0dd('0x2'));var db=require(_0xd0dd('0x3'))['db'];var utils=require(_0xd0dd('0x4'));var logger=require(_0xd0dd('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd0dd('0x6'));var client=jayson[_0xd0dd('0x7')][_0xd0dd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35abb2,_0x56f0d4,_0x3e69f5){return new BPromise(function(_0xc9056a,_0x45143f){return client['request'](_0x35abb2,_0x3e69f5)['then'](function(_0x200802){logger[_0xd0dd('0x9')](_0xd0dd('0xa'),_0x56f0d4,_0xd0dd('0xb'));logger[_0xd0dd('0xc')](_0xd0dd('0xd'),_0x56f0d4,_0xd0dd('0xb'),JSON[_0xd0dd('0xe')](_0x200802));if(_0x200802[_0xd0dd('0xf')]){if(_0x200802[_0xd0dd('0xf')][_0xd0dd('0x10')]===0x1f4){logger[_0xd0dd('0xf')](_0xd0dd('0xa'),_0x56f0d4,_0x200802[_0xd0dd('0xf')][_0xd0dd('0x11')]);return _0x45143f(_0x200802[_0xd0dd('0xf')]['message']);}logger[_0xd0dd('0xf')](_0xd0dd('0xa'),_0x56f0d4,_0x200802[_0xd0dd('0xf')][_0xd0dd('0x11')]);return _0xc9056a(_0x200802['error'][_0xd0dd('0x11')]);}else{logger[_0xd0dd('0x9')](_0xd0dd('0xa'),_0x56f0d4,'request\x20sent');_0xc9056a(_0x200802['result'][_0xd0dd('0x11')]);}})[_0xd0dd('0x12')](function(_0x5369c1){logger[_0xd0dd('0xf')](_0xd0dd('0xa'),_0x56f0d4,_0x5369c1);_0x45143f(_0x5369c1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index ee3e3ef..02ca315 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 _0x84e6=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','exports'];(function(_0x3db136,_0x477db0){var _0x33b047=function(_0xe0f60a){while(--_0xe0f60a){_0x3db136['push'](_0x3db136['shift']());}};_0x33b047(++_0x477db0);}(_0x84e6,0x156));var _0x684e=function(_0x16759a,_0x424ffc){_0x16759a=_0x16759a-0x0;var _0xc8efbd=_0x84e6[_0x16759a];return _0xc8efbd;};'use strict';var multer=require(_0x684e('0x0'));var util=require(_0x684e('0x1'));var path=require('path');var timeout=require(_0x684e('0x2'));var express=require(_0x684e('0x3'));var router=express[_0x684e('0x4')]();var auth=require(_0x684e('0x5'));var interaction=require(_0x684e('0x6'));var config=require(_0x684e('0x7'));var controller=require(_0x684e('0x8'));router[_0x684e('0x9')]('/',auth[_0x684e('0xa')](),controller[_0x684e('0xb')]);router[_0x684e('0x9')](_0x684e('0xc'),auth[_0x684e('0xa')](),controller[_0x684e('0xd')]);router['get'](_0x684e('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x684e('0xf')]('/',auth[_0x684e('0xa')](),controller['create']);router[_0x684e('0x10')](_0x684e('0xe'),auth['isAuthenticated'](),controller[_0x684e('0x11')]);router['delete'](_0x684e('0xe'),auth[_0x684e('0xa')](),controller['destroy']);module[_0x684e('0x12')]=router; \ No newline at end of file +var _0xbc98=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0xbc98,0x12c));var _0x8bc9=function(_0x594cdb,_0x3ed988){_0x594cdb=_0x594cdb-0x0;var _0x921a8d=_0xbc98[_0x594cdb];return _0x921a8d;};'use strict';var multer=require(_0x8bc9('0x0'));var util=require(_0x8bc9('0x1'));var path=require('path');var timeout=require(_0x8bc9('0x2'));var express=require(_0x8bc9('0x3'));var router=express[_0x8bc9('0x4')]();var auth=require(_0x8bc9('0x5'));var interaction=require(_0x8bc9('0x6'));var config=require(_0x8bc9('0x7'));var controller=require(_0x8bc9('0x8'));router[_0x8bc9('0x9')]('/',auth[_0x8bc9('0xa')](),controller[_0x8bc9('0xb')]);router['get'](_0x8bc9('0xc'),auth[_0x8bc9('0xa')](),controller[_0x8bc9('0xd')]);router['get'](_0x8bc9('0xe'),auth['isAuthenticated'](),controller[_0x8bc9('0xf')]);router[_0x8bc9('0x10')]('/',auth['isAuthenticated'](),controller[_0x8bc9('0x11')]);router[_0x8bc9('0x12')]('/:id',auth[_0x8bc9('0xa')](),controller[_0x8bc9('0x13')]);router[_0x8bc9('0x14')](_0x8bc9('0xe'),auth[_0x8bc9('0xa')](),controller[_0x8bc9('0x15')]);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 8e6c67a..a34ce2a 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 _0x673a=['TEXT','sequelize','exports','STRING'];(function(_0x508229,_0x2c283d){var _0x42a6b5=function(_0x1d624e){while(--_0x1d624e){_0x508229['push'](_0x508229['shift']());}};_0x42a6b5(++_0x2c283d);}(_0x673a,0x175));var _0xa673=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x673a[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0xa673('0x0'));module[_0xa673('0x1')]={'question':{'type':Sequelize[_0xa673('0x2')]},'answer':{'type':Sequelize[_0xa673('0x3')]('long')},'membername':{'type':Sequelize[_0xa673('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa673('0x2')]},'uniqueid':{'type':Sequelize[_0xa673('0x2')]},'calleridname':{'type':Sequelize[_0xa673('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xa673('0x2')]}}; \ No newline at end of file +var _0xe79a=['long','STRING','sequelize','exports'];(function(_0x13e3ae,_0xf4179b){var _0x12af63=function(_0x185416){while(--_0x185416){_0x13e3ae['push'](_0x13e3ae['shift']());}};_0x12af63(++_0xf4179b);}(_0xe79a,0xf6));var _0xae79=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xe79a[_0x114d1f];return _0x5b91d4;};'use strict';var Sequelize=require(_0xae79('0x0'));module[_0xae79('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0xae79('0x2'))},'membername':{'type':Sequelize[_0xae79('0x3')]},'projectname':{'type':Sequelize[_0xae79('0x3')]},'queue':{'type':Sequelize[_0xae79('0x3')]},'uniqueid':{'type':Sequelize[_0xae79('0x3')]},'calleridname':{'type':Sequelize[_0xae79('0x3')]},'calleridnum':{'type':Sequelize[_0xae79('0x3')]},'questionId':{'type':Sequelize[_0xae79('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index a65a9b3..7844d47 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 _0xe92d=['destroy','then','name','JscriptyQuestionReport','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','options','include','rows','catch','show','params','rawAttributes','filtears','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','update'];(function(_0x4be3f3,_0x20efd7){var _0x5278b3=function(_0x147367){while(--_0x147367){_0x4be3f3['push'](_0x4be3f3['shift']());}};_0x5278b3(++_0x20efd7);}(_0xe92d,0x65));var _0xde92=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe92d[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0xde92('0x0'));var emlformat=require(_0xde92('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xde92('0x2'));var jsonpatch=require(_0xde92('0x3'));var rp=require(_0xde92('0x4'));var moment=require(_0xde92('0x5'));var BPromise=require(_0xde92('0x6'));var Mustache=require('mustache');var util=require(_0xde92('0x7'));var path=require('path');var sox=require(_0xde92('0x8'));var csv=require('to-csv');var ejs=require(_0xde92('0x9'));var fs=require('fs');var _=require(_0xde92('0xa'));var squel=require(_0xde92('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xde92('0xc'));var toCsv=require(_0xde92('0xd'));var querystring=require(_0xde92('0xe'));var Papa=require('papaparse');var Redis=require(_0xde92('0xf'));var authService=require(_0xde92('0x10'));var qs=require(_0xde92('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xde92('0x12'));var logger=require(_0xde92('0x13'))(_0xde92('0x14'));var utils=require(_0xde92('0x15'));var config=require(_0xde92('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde92('0x17'))['db'];function respondWithStatusCode(_0x5bae25,_0x349248){_0x349248=_0x349248||0xcc;return function(_0x5392b6){if(_0x5392b6){return _0x5bae25[_0xde92('0x18')](_0x349248);}return _0x5bae25[_0xde92('0x19')](_0x349248)[_0xde92('0x1a')]();};}function respondWithResult(_0x6de73e,_0x3a19f7){_0x3a19f7=_0x3a19f7||0xc8;return function(_0x7cf7af){if(_0x7cf7af){return _0x6de73e[_0xde92('0x19')](_0x3a19f7)[_0xde92('0x1b')](_0x7cf7af);}};}function respondWithFilteredResult(_0x2b2a02,_0x434360){return function(_0x6ed282){if(_0x6ed282){var _0x53ef2d=_0x6ed282[_0xde92('0x1c')],_0x386348=_0x434360[_0xde92('0x1d')],_0x30a13a=_0x434360['offset']+_0x434360[_0xde92('0x1e')],_0x5324be;if(_0x30a13a>=_0x53ef2d){_0x30a13a=_0x53ef2d;_0x5324be=0xc8;}else{_0x5324be=0xce;}_0x2b2a02['status'](_0x5324be);return _0x2b2a02[_0xde92('0x1f')]('Content-Range',_0x386348+'-'+_0x30a13a+'/'+_0x53ef2d)[_0xde92('0x1b')](_0x6ed282);}return null;};}function patchUpdates(_0x4a8ae7){return function(_0x5258fd){try{jsonpatch['apply'](_0x5258fd,_0x4a8ae7,!![]);}catch(_0x28f76e){return BPromise['reject'](_0x28f76e);}return _0x5258fd['save']();};}function saveUpdates(_0x200915,_0x35d247){return function(_0x347bad){if(_0x347bad){return _0x347bad[_0xde92('0x20')](_0x200915)['then'](function(_0x1b6df9){return _0x1b6df9;});}return null;};}function removeEntity(_0x1435d0,_0x2320ba){return function(_0x1e19ff){if(_0x1e19ff){return _0x1e19ff[_0xde92('0x21')]()[_0xde92('0x22')](function(){_0x1435d0['status'](0xcc)[_0xde92('0x1a')]();});}};}function handleEntityNotFound(_0x5f30b2,_0x1f7305){return function(_0x26b656){if(!_0x26b656){_0x5f30b2[_0xde92('0x18')](0x194);}return _0x26b656;};}function handleError(_0xf4d20b,_0xb6fc0){_0xb6fc0=_0xb6fc0||0x1f4;return function(_0x4d904d){logger['error'](_0x4d904d['stack']);if(_0x4d904d[_0xde92('0x23')]){delete _0x4d904d[_0xde92('0x23')];}_0xf4d20b[_0xde92('0x19')](_0xb6fc0)['send'](_0x4d904d);};}exports['index']=function(_0x37eb1e,_0x379c00){var _0x2d19db={},_0x2f7e35={},_0x242c09={'count':0x0,'rows':[]};var _0x84cb00=_['map'](db[_0xde92('0x24')]['rawAttributes'],function(_0x177d6c){return{'name':_0x177d6c[_0xde92('0x25')],'type':_0x177d6c[_0xde92('0x26')]['key']};});_0x2f7e35[_0xde92('0x27')]=_[_0xde92('0x28')](_0x84cb00,_0xde92('0x23'));_0x2f7e35[_0xde92('0x29')]=_[_0xde92('0x2a')](_0x37eb1e['query']);_0x2f7e35[_0xde92('0x2b')]=_[_0xde92('0x2c')](_0x2f7e35['model'],_0x2f7e35[_0xde92('0x29')]);_0x2d19db[_0xde92('0x2d')]=_[_0xde92('0x2c')](_0x2f7e35[_0xde92('0x27')],qs[_0xde92('0x2e')](_0x37eb1e[_0xde92('0x29')][_0xde92('0x2e')]));_0x2d19db[_0xde92('0x2d')]=_0x2d19db[_0xde92('0x2d')][_0xde92('0x2f')]?_0x2d19db['attributes']:_0x2f7e35[_0xde92('0x27')];if(!_0x37eb1e[_0xde92('0x29')][_0xde92('0x30')](_0xde92('0x31'))){_0x2d19db[_0xde92('0x1e')]=qs[_0xde92('0x1e')](_0x37eb1e['query'][_0xde92('0x1e')]);_0x2d19db[_0xde92('0x1d')]=qs[_0xde92('0x1d')](_0x37eb1e['query'][_0xde92('0x1d')]);}_0x2d19db['order']=qs[_0xde92('0x32')](_0x37eb1e[_0xde92('0x29')]['sort']);_0x2d19db['where']=qs['filters'](_[_0xde92('0x33')](_0x37eb1e[_0xde92('0x29')],_0x2f7e35[_0xde92('0x2b')]),_0x84cb00);if(_0x37eb1e[_0xde92('0x29')][_0xde92('0x34')]){_0x2d19db['where']=_[_0xde92('0x35')](_0x2d19db['where'],{'$or':_[_0xde92('0x28')](_0x84cb00,function(_0x551d7e){if(_0x551d7e['type']!=='VIRTUAL'){var _0x122507={};_0x122507[_0x551d7e['name']]={'$like':'%'+_0x37eb1e[_0xde92('0x29')][_0xde92('0x34')]+'%'};return _0x122507;}})});}_0x2d19db=_[_0xde92('0x35')]({},_0x2d19db,_0x37eb1e[_0xde92('0x36')]);var _0x2c55a6={'where':_0x2d19db['where']};return db[_0xde92('0x24')][_0xde92('0x1c')](_0x2c55a6)[_0xde92('0x22')](function(_0x5ce421){_0x242c09[_0xde92('0x1c')]=_0x5ce421;if(_0x37eb1e['query']['includeAll']){_0x2d19db[_0xde92('0x37')]=[{'all':!![]}];}return db[_0xde92('0x24')]['findAll'](_0x2d19db);})[_0xde92('0x22')](function(_0x767c34){_0x242c09[_0xde92('0x38')]=_0x767c34;return _0x242c09;})[_0xde92('0x22')](respondWithFilteredResult(_0x379c00,_0x2d19db))[_0xde92('0x39')](handleError(_0x379c00,null));};exports[_0xde92('0x3a')]=function(_0x1c1073,_0x257b1d){var _0x4d3654={'raw':!![],'where':{'id':_0x1c1073[_0xde92('0x3b')]['id']}},_0x55152d={};_0x55152d[_0xde92('0x27')]=_['keys'](db[_0xde92('0x24')][_0xde92('0x3c')]);_0x55152d[_0xde92('0x29')]=_[_0xde92('0x2a')](_0x1c1073[_0xde92('0x29')]);_0x55152d[_0xde92('0x3d')]=_['intersection'](_0x55152d[_0xde92('0x27')],_0x55152d[_0xde92('0x29')]);_0x4d3654[_0xde92('0x2d')]=_[_0xde92('0x2c')](_0x55152d[_0xde92('0x27')],qs['fields'](_0x1c1073['query'][_0xde92('0x2e')]));_0x4d3654['attributes']=_0x4d3654[_0xde92('0x2d')][_0xde92('0x2f')]?_0x4d3654[_0xde92('0x2d')]:_0x55152d[_0xde92('0x27')];if(_0x1c1073['query'][_0xde92('0x3e')]){_0x4d3654[_0xde92('0x37')]=[{'all':!![]}];}_0x4d3654=_[_0xde92('0x35')]({},_0x4d3654,_0x1c1073[_0xde92('0x36')]);return db[_0xde92('0x24')][_0xde92('0x3f')](_0x4d3654)[_0xde92('0x22')](handleEntityNotFound(_0x257b1d,null))[_0xde92('0x22')](respondWithResult(_0x257b1d,null))[_0xde92('0x39')](handleError(_0x257b1d,null));};exports[_0xde92('0x40')]=function(_0x45ee34,_0x53d557){return db['JscriptyQuestionReport']['create'](_0x45ee34[_0xde92('0x41')],{})[_0xde92('0x22')](respondWithResult(_0x53d557,0xc9))['catch'](handleError(_0x53d557,null));};exports[_0xde92('0x20')]=function(_0x3a580b,_0x50fc0d){if(_0x3a580b[_0xde92('0x41')]['id']){delete _0x3a580b['body']['id'];}return db[_0xde92('0x24')]['find']({'where':{'id':_0x3a580b[_0xde92('0x3b')]['id']}})[_0xde92('0x22')](handleEntityNotFound(_0x50fc0d,null))[_0xde92('0x22')](saveUpdates(_0x3a580b[_0xde92('0x41')],null))[_0xde92('0x22')](respondWithResult(_0x50fc0d,null))[_0xde92('0x39')](handleError(_0x50fc0d,null));};exports[_0xde92('0x21')]=function(_0x454904,_0x51d6b8){return db[_0xde92('0x24')][_0xde92('0x3f')]({'where':{'id':_0x454904[_0xde92('0x3b')]['id']}})[_0xde92('0x22')](handleEntityNotFound(_0x51d6b8,null))[_0xde92('0x22')](removeEntity(_0x51d6b8,null))[_0xde92('0x39')](handleError(_0x51d6b8,null));};exports[_0xde92('0x42')]=function(_0x5f5882,_0x44bf9e){return db[_0xde92('0x24')][_0xde92('0x42')]()['then'](respondWithResult(_0x44bf9e,null))['catch'](handleError(_0x44bf9e,null));}; \ No newline at end of file +var _0x87ca=['offset','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','type','options','include','findAll','then','rows','catch','show','params','filtears','length','includeAll','create','body','update','find','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count'];(function(_0x564728,_0x379bf7){var _0x462f6e=function(_0x405afb){while(--_0x405afb){_0x564728['push'](_0x564728['shift']());}};_0x462f6e(++_0x379bf7);}(_0x87ca,0xc5));var _0xa87c=function(_0x5084da,_0x58f4ea){_0x5084da=_0x5084da-0x0;var _0x1168b7=_0x87ca[_0x5084da];return _0x1168b7;};'use strict';var pdf=require(_0xa87c('0x0'));var emlformat=require(_0xa87c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa87c('0x2'));var rp=require(_0xa87c('0x3'));var moment=require('moment');var BPromise=require(_0xa87c('0x4'));var Mustache=require('mustache');var util=require(_0xa87c('0x5'));var path=require(_0xa87c('0x6'));var sox=require(_0xa87c('0x7'));var csv=require('to-csv');var ejs=require(_0xa87c('0x8'));var fs=require('fs');var _=require(_0xa87c('0x9'));var squel=require(_0xa87c('0xa'));var crypto=require(_0xa87c('0xb'));var jsforce=require(_0xa87c('0xc'));var deskjs=require(_0xa87c('0xd'));var toCsv=require(_0xa87c('0xe'));var querystring=require('querystring');var Papa=require(_0xa87c('0xf'));var Redis=require(_0xa87c('0x10'));var authService=require(_0xa87c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa87c('0x12'));var logger=require(_0xa87c('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa87c('0x14'));var licenseUtil=require(_0xa87c('0x15'));var db=require(_0xa87c('0x16'))['db'];function respondWithStatusCode(_0x892022,_0xec4dba){_0xec4dba=_0xec4dba||0xcc;return function(_0x3ac387){if(_0x3ac387){return _0x892022[_0xa87c('0x17')](_0xec4dba);}return _0x892022['status'](_0xec4dba)[_0xa87c('0x18')]();};}function respondWithResult(_0x445764,_0x4c10fb){_0x4c10fb=_0x4c10fb||0xc8;return function(_0xee656){if(_0xee656){return _0x445764[_0xa87c('0x19')](_0x4c10fb)[_0xa87c('0x1a')](_0xee656);}};}function respondWithFilteredResult(_0x4a6285,_0x4053fc){return function(_0x41b3c0){if(_0x41b3c0){var _0x37a616=_0x41b3c0[_0xa87c('0x1b')],_0xa69ab2=_0x4053fc['offset'],_0x249e40=_0x4053fc[_0xa87c('0x1c')]+_0x4053fc['limit'],_0x153bec;if(_0x249e40>=_0x37a616){_0x249e40=_0x37a616;_0x153bec=0xc8;}else{_0x153bec=0xce;}_0x4a6285[_0xa87c('0x19')](_0x153bec);return _0x4a6285['set'](_0xa87c('0x1d'),_0xa69ab2+'-'+_0x249e40+'/'+_0x37a616)['json'](_0x41b3c0);}return null;};}function patchUpdates(_0x5283ca){return function(_0xcb25fd){try{jsonpatch[_0xa87c('0x1e')](_0xcb25fd,_0x5283ca,!![]);}catch(_0x1806b3){return BPromise[_0xa87c('0x1f')](_0x1806b3);}return _0xcb25fd[_0xa87c('0x20')]();};}function saveUpdates(_0x453e75,_0x1253ac){return function(_0x30c623){if(_0x30c623){return _0x30c623['update'](_0x453e75)['then'](function(_0x214b43){return _0x214b43;});}return null;};}function removeEntity(_0x1cbd75,_0xc1238e){return function(_0x4bc4cc){if(_0x4bc4cc){return _0x4bc4cc[_0xa87c('0x21')]()['then'](function(){_0x1cbd75[_0xa87c('0x19')](0xcc)[_0xa87c('0x18')]();});}};}function handleEntityNotFound(_0x1c4c29,_0xb72c1b){return function(_0x184023){if(!_0x184023){_0x1c4c29[_0xa87c('0x17')](0x194);}return _0x184023;};}function handleError(_0x28b2a4,_0x520c2b){_0x520c2b=_0x520c2b||0x1f4;return function(_0x5acc74){logger['error'](_0x5acc74[_0xa87c('0x22')]);if(_0x5acc74[_0xa87c('0x23')]){delete _0x5acc74[_0xa87c('0x23')];}_0x28b2a4[_0xa87c('0x19')](_0x520c2b)[_0xa87c('0x24')](_0x5acc74);};}exports[_0xa87c('0x25')]=function(_0x46c89d,_0x13ff81){var _0x56938e={},_0x2e438c={},_0x5af79c={'count':0x0,'rows':[]};var _0x199dcb=_[_0xa87c('0x26')](db[_0xa87c('0x27')][_0xa87c('0x28')],function(_0x204c56){return{'name':_0x204c56[_0xa87c('0x29')],'type':_0x204c56['type'][_0xa87c('0x2a')]};});_0x2e438c[_0xa87c('0x2b')]=_['map'](_0x199dcb,_0xa87c('0x23'));_0x2e438c[_0xa87c('0x2c')]=_[_0xa87c('0x2d')](_0x46c89d['query']);_0x2e438c[_0xa87c('0x2e')]=_[_0xa87c('0x2f')](_0x2e438c[_0xa87c('0x2b')],_0x2e438c[_0xa87c('0x2c')]);_0x56938e[_0xa87c('0x30')]=_[_0xa87c('0x2f')](_0x2e438c['model'],qs[_0xa87c('0x31')](_0x46c89d['query'][_0xa87c('0x31')]));_0x56938e[_0xa87c('0x30')]=_0x56938e['attributes']['length']?_0x56938e[_0xa87c('0x30')]:_0x2e438c[_0xa87c('0x2b')];if(!_0x46c89d[_0xa87c('0x2c')][_0xa87c('0x32')](_0xa87c('0x33'))){_0x56938e[_0xa87c('0x34')]=qs['limit'](_0x46c89d[_0xa87c('0x2c')][_0xa87c('0x34')]);_0x56938e[_0xa87c('0x1c')]=qs[_0xa87c('0x1c')](_0x46c89d['query'][_0xa87c('0x1c')]);}_0x56938e[_0xa87c('0x35')]=qs['sort'](_0x46c89d[_0xa87c('0x2c')]['sort']);_0x56938e[_0xa87c('0x36')]=qs[_0xa87c('0x2e')](_[_0xa87c('0x37')](_0x46c89d[_0xa87c('0x2c')],_0x2e438c[_0xa87c('0x2e')]),_0x199dcb);if(_0x46c89d[_0xa87c('0x2c')][_0xa87c('0x38')]){_0x56938e['where']=_[_0xa87c('0x39')](_0x56938e[_0xa87c('0x36')],{'$or':_[_0xa87c('0x26')](_0x199dcb,function(_0x177e7c){if(_0x177e7c[_0xa87c('0x3a')]!=='VIRTUAL'){var _0x5e2695={};_0x5e2695[_0x177e7c[_0xa87c('0x23')]]={'$like':'%'+_0x46c89d[_0xa87c('0x2c')]['filter']+'%'};return _0x5e2695;}})});}_0x56938e=_[_0xa87c('0x39')]({},_0x56938e,_0x46c89d[_0xa87c('0x3b')]);var _0x16e9b4={'where':_0x56938e[_0xa87c('0x36')]};return db['JscriptyQuestionReport']['count'](_0x16e9b4)['then'](function(_0x3ef152){_0x5af79c[_0xa87c('0x1b')]=_0x3ef152;if(_0x46c89d[_0xa87c('0x2c')]['includeAll']){_0x56938e[_0xa87c('0x3c')]=[{'all':!![]}];}return db[_0xa87c('0x27')][_0xa87c('0x3d')](_0x56938e);})[_0xa87c('0x3e')](function(_0x211392){_0x5af79c[_0xa87c('0x3f')]=_0x211392;return _0x5af79c;})[_0xa87c('0x3e')](respondWithFilteredResult(_0x13ff81,_0x56938e))[_0xa87c('0x40')](handleError(_0x13ff81,null));};exports[_0xa87c('0x41')]=function(_0x32875a,_0x1a1b74){var _0x22b898={'raw':!![],'where':{'id':_0x32875a[_0xa87c('0x42')]['id']}},_0x3706fb={};_0x3706fb[_0xa87c('0x2b')]=_[_0xa87c('0x2d')](db[_0xa87c('0x27')]['rawAttributes']);_0x3706fb[_0xa87c('0x2c')]=_[_0xa87c('0x2d')](_0x32875a['query']);_0x3706fb[_0xa87c('0x43')]=_[_0xa87c('0x2f')](_0x3706fb[_0xa87c('0x2b')],_0x3706fb[_0xa87c('0x2c')]);_0x22b898['attributes']=_['intersection'](_0x3706fb[_0xa87c('0x2b')],qs[_0xa87c('0x31')](_0x32875a[_0xa87c('0x2c')][_0xa87c('0x31')]));_0x22b898[_0xa87c('0x30')]=_0x22b898[_0xa87c('0x30')][_0xa87c('0x44')]?_0x22b898[_0xa87c('0x30')]:_0x3706fb[_0xa87c('0x2b')];if(_0x32875a['query'][_0xa87c('0x45')]){_0x22b898[_0xa87c('0x3c')]=[{'all':!![]}];}_0x22b898=_[_0xa87c('0x39')]({},_0x22b898,_0x32875a['options']);return db[_0xa87c('0x27')]['find'](_0x22b898)[_0xa87c('0x3e')](handleEntityNotFound(_0x1a1b74,null))['then'](respondWithResult(_0x1a1b74,null))[_0xa87c('0x40')](handleError(_0x1a1b74,null));};exports['create']=function(_0x58bde7,_0x1a5817){return db[_0xa87c('0x27')][_0xa87c('0x46')](_0x58bde7[_0xa87c('0x47')],{})['then'](respondWithResult(_0x1a5817,0xc9))[_0xa87c('0x40')](handleError(_0x1a5817,null));};exports[_0xa87c('0x48')]=function(_0x22e9ef,_0x20f734){if(_0x22e9ef[_0xa87c('0x47')]['id']){delete _0x22e9ef['body']['id'];}return db['JscriptyQuestionReport'][_0xa87c('0x49')]({'where':{'id':_0x22e9ef[_0xa87c('0x42')]['id']}})[_0xa87c('0x3e')](handleEntityNotFound(_0x20f734,null))[_0xa87c('0x3e')](saveUpdates(_0x22e9ef[_0xa87c('0x47')],null))[_0xa87c('0x3e')](respondWithResult(_0x20f734,null))['catch'](handleError(_0x20f734,null));};exports[_0xa87c('0x21')]=function(_0x277702,_0x228e68){return db[_0xa87c('0x27')]['find']({'where':{'id':_0x277702[_0xa87c('0x42')]['id']}})[_0xa87c('0x3e')](handleEntityNotFound(_0x228e68,null))['then'](removeEntity(_0x228e68,null))[_0xa87c('0x40')](handleError(_0x228e68,null));};exports[_0xa87c('0x4a')]=function(_0x2be544,_0x402c98){return db[_0xa87c('0x27')]['describe']()[_0xa87c('0x3e')](respondWithResult(_0x402c98,null))[_0xa87c('0x40')](handleError(_0x402c98,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8e978eb..188e6de 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 _0x4546=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api'];(function(_0x431b10,_0x19d5d5){var _0x3cd107=function(_0x4c69a9){while(--_0x4c69a9){_0x431b10['push'](_0x431b10['shift']());}};_0x3cd107(++_0x19d5d5);}(_0x4546,0x168));var _0x6454=function(_0x3d59e8,_0x4ad27b){_0x3d59e8=_0x3d59e8-0x0;var _0x590b41=_0x4546[_0x3d59e8];return _0x590b41;};'use strict';var _=require(_0x6454('0x0'));var util=require(_0x6454('0x1'));var logger=require(_0x6454('0x2'))(_0x6454('0x3'));var moment=require('moment');var BPromise=require(_0x6454('0x4'));var rp=require(_0x6454('0x5'));var fs=require('fs');var path=require(_0x6454('0x6'));var rimraf=require(_0x6454('0x7'));var config=require(_0x6454('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x6454('0x9')]=function(_0x143593,_0x271497){return _0x143593[_0x6454('0xa')](_0x6454('0xb'),attributes,{'tableName':_0x6454('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x140f=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x34f43c,_0x5855ec){var _0x3e9019=function(_0x1a1a8d){while(--_0x1a1a8d){_0x34f43c['push'](_0x34f43c['shift']());}};_0x3e9019(++_0x5855ec);}(_0x140f,0xb9));var _0xf140=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x140f[_0x1034ca];return _0x1a023a;};'use strict';var _=require(_0xf140('0x0'));var util=require(_0xf140('0x1'));var logger=require(_0xf140('0x2'))(_0xf140('0x3'));var moment=require(_0xf140('0x4'));var BPromise=require(_0xf140('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf140('0x6'));var config=require('../../config/environment');var attributes=require(_0xf140('0x7'));module[_0xf140('0x8')]=function(_0x2cb025,_0x73f66f){return _0x2cb025[_0xf140('0x9')](_0xf140('0xa'),attributes,{'tableName':_0xf140('0xb'),'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 e490d34..cef9852 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 _0xa406=['error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x104141,_0x4f10a5){var _0x5d41c4=function(_0x2a5a8e){while(--_0x2a5a8e){_0x104141['push'](_0x104141['shift']());}};_0x5d41c4(++_0x4f10a5);}(_0xa406,0x18f));var _0x6a40=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xa406[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x6a40('0x0'));var util=require(_0x6a40('0x1'));var moment=require('moment');var BPromise=require(_0x6a40('0x2'));var rs=require(_0x6a40('0x3'));var fs=require('fs');var Redis=require(_0x6a40('0x4'));var db=require(_0x6a40('0x5'))['db'];var utils=require(_0x6a40('0x6'));var logger=require(_0x6a40('0x7'))(_0x6a40('0x8'));var config=require(_0x6a40('0x9'));var jayson=require(_0x6a40('0xa'));var client=jayson[_0x6a40('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2389,_0x525617,_0x5cbf6e){return new BPromise(function(_0x513478,_0x3c4b7d){return client[_0x6a40('0xc')](_0x1c2389,_0x5cbf6e)[_0x6a40('0xd')](function(_0x3db177){logger[_0x6a40('0xe')](_0x6a40('0xf'),_0x525617,_0x6a40('0x10'));logger[_0x6a40('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x525617,_0x6a40('0x10'),JSON[_0x6a40('0x12')](_0x3db177));if(_0x3db177['error']){if(_0x3db177[_0x6a40('0x13')][_0x6a40('0x14')]===0x1f4){logger[_0x6a40('0x13')](_0x6a40('0xf'),_0x525617,_0x3db177[_0x6a40('0x13')]['message']);return _0x3c4b7d(_0x3db177['error'][_0x6a40('0x15')]);}logger['error'](_0x6a40('0xf'),_0x525617,_0x3db177[_0x6a40('0x13')]['message']);return _0x513478(_0x3db177['error'][_0x6a40('0x15')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x525617,_0x6a40('0x10'));_0x513478(_0x3db177['result'][_0x6a40('0x15')]);}})['catch'](function(_0x3acdf6){logger[_0x6a40('0x13')](_0x6a40('0xf'),_0x525617,_0x3acdf6);_0x3c4b7d(_0x3acdf6);});});} \ No newline at end of file +var _0x2a6a=['request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x8fb5f8,_0x2b147e){var _0x52894e=function(_0x1525f2){while(--_0x1525f2){_0x8fb5f8['push'](_0x8fb5f8['shift']());}};_0x52894e(++_0x2b147e);}(_0x2a6a,0xc3));var _0xa2a6=function(_0x5e8c7c,_0x3429c6){_0x5e8c7c=_0x5e8c7c-0x0;var _0x48f7bd=_0x2a6a[_0x5e8c7c];return _0x48f7bd;};'use strict';var _=require(_0xa2a6('0x0'));var util=require(_0xa2a6('0x1'));var moment=require(_0xa2a6('0x2'));var BPromise=require(_0xa2a6('0x3'));var rs=require(_0xa2a6('0x4'));var fs=require('fs');var Redis=require(_0xa2a6('0x5'));var db=require(_0xa2a6('0x6'))['db'];var utils=require(_0xa2a6('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa2a6('0x8'));var jayson=require(_0xa2a6('0x9'));var client=jayson['client'][_0xa2a6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd0acd7,_0x4e8051,_0x460f4f){return new BPromise(function(_0x56fe59,_0xfff00d){return client[_0xa2a6('0xb')](_0xd0acd7,_0x460f4f)[_0xa2a6('0xc')](function(_0x17f2f8){logger[_0xa2a6('0xd')](_0xa2a6('0xe'),_0x4e8051,_0xa2a6('0xf'));logger['debug'](_0xa2a6('0x10'),_0x4e8051,_0xa2a6('0xf'),JSON[_0xa2a6('0x11')](_0x17f2f8));if(_0x17f2f8[_0xa2a6('0x12')]){if(_0x17f2f8[_0xa2a6('0x12')]['code']===0x1f4){logger[_0xa2a6('0x12')](_0xa2a6('0xe'),_0x4e8051,_0x17f2f8[_0xa2a6('0x12')][_0xa2a6('0x13')]);return _0xfff00d(_0x17f2f8[_0xa2a6('0x12')]['message']);}logger[_0xa2a6('0x12')](_0xa2a6('0xe'),_0x4e8051,_0x17f2f8[_0xa2a6('0x12')][_0xa2a6('0x13')]);return _0x56fe59(_0x17f2f8[_0xa2a6('0x12')]['message']);}else{logger[_0xa2a6('0xd')](_0xa2a6('0xe'),_0x4e8051,'request\x20sent');_0x56fe59(_0x17f2f8[_0xa2a6('0x14')][_0xa2a6('0x13')]);}})['catch'](function(_0x4a9bb8){logger[_0xa2a6('0x12')](_0xa2a6('0xe'),_0x4e8051,_0x4a9bb8);_0xfff00d(_0x4a9bb8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index fbaaad9..d912fc0 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 _0x448a=['get','isAuthenticated','index','/describe','describe','show','/:id/questions','getQuestions','post','put','/:id','update','delete','destroy','exports','util','path','express','../../components/interaction/service','../../config/environment'];(function(_0x3ce7d5,_0x559a41){var _0x43bc85=function(_0xb1af4d){while(--_0xb1af4d){_0x3ce7d5['push'](_0x3ce7d5['shift']());}};_0x43bc85(++_0x559a41);}(_0x448a,0x1ef));var _0xa448=function(_0x340a30,_0x23aa69){_0x340a30=_0x340a30-0x0;var _0x4a54ba=_0x448a[_0x340a30];return _0x4a54ba;};'use strict';var multer=require('multer');var util=require(_0xa448('0x0'));var path=require(_0xa448('0x1'));var timeout=require('connect-timeout');var express=require(_0xa448('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa448('0x3'));var config=require(_0xa448('0x4'));var controller=require('./jscriptySessionReport.controller');router[_0xa448('0x5')]('/',auth[_0xa448('0x6')](),controller[_0xa448('0x7')]);router[_0xa448('0x5')](_0xa448('0x8'),auth[_0xa448('0x6')](),controller[_0xa448('0x9')]);router['get']('/:id',auth[_0xa448('0x6')](),controller[_0xa448('0xa')]);router[_0xa448('0x5')](_0xa448('0xb'),auth[_0xa448('0x6')](),controller[_0xa448('0xc')]);router[_0xa448('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa448('0xe')](_0xa448('0xf'),auth['isAuthenticated'](),controller[_0xa448('0x10')]);router[_0xa448('0x11')](_0xa448('0xf'),auth[_0xa448('0x6')](),controller[_0xa448('0x12')]);module[_0xa448('0x13')]=router; \ No newline at end of file +var _0xb90d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','update','delete','destroy','util','path'];(function(_0x4dacf9,_0x21f87b){var _0x3dc168=function(_0x5af596){while(--_0x5af596){_0x4dacf9['push'](_0x4dacf9['shift']());}};_0x3dc168(++_0x21f87b);}(_0xb90d,0x17a));var _0xdb90=function(_0x50ebc0,_0x143df8){_0x50ebc0=_0x50ebc0-0x0;var _0x173b25=_0xb90d[_0x50ebc0];return _0x173b25;};'use strict';var multer=require('multer');var util=require(_0xdb90('0x0'));var path=require(_0xdb90('0x1'));var timeout=require(_0xdb90('0x2'));var express=require(_0xdb90('0x3'));var router=express[_0xdb90('0x4')]();var auth=require(_0xdb90('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb90('0x6'));var controller=require(_0xdb90('0x7'));router[_0xdb90('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdb90('0x8')](_0xdb90('0x9'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xb')]);router['get'](_0xdb90('0xc'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xd')]);router['get'](_0xdb90('0xe'),auth[_0xdb90('0xa')](),controller[_0xdb90('0xf')]);router[_0xdb90('0x10')]('/',auth[_0xdb90('0xa')](),controller['create']);router['put']('/:id',auth[_0xdb90('0xa')](),controller[_0xdb90('0x11')]);router[_0xdb90('0x12')](_0xdb90('0xc'),auth[_0xdb90('0xa')](),controller[_0xdb90('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 3da5334..6af0e86 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 _0xad78=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x14e00b,_0x553e97){var _0x4c93b4=function(_0x50f49c){while(--_0x50f49c){_0x14e00b['push'](_0x14e00b['shift']());}};_0x4c93b4(++_0x553e97);}(_0xad78,0x1c0));var _0x8ad7=function(_0x29b407,_0x4ba668){_0x29b407=_0x29b407-0x0;var _0x416822=_0xad78[_0x29b407];return _0x416822;};'use strict';var moment=require(_0x8ad7('0x0'));var Sequelize=require('sequelize');module[_0x8ad7('0x1')]={'starttime':{'type':Sequelize[_0x8ad7('0x2')],'set':function(_0xc3814b){this[_0x8ad7('0x3')](_0x8ad7('0x4'),_0xc3814b);this[_0x8ad7('0x3')](_0x8ad7('0x5'),moment()[_0x8ad7('0x6')](_0x8ad7('0x7')));}},'endtime':{'type':Sequelize[_0x8ad7('0x2')]},'membername':{'type':Sequelize[_0x8ad7('0x8')]},'projectname':{'type':Sequelize[_0x8ad7('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8ad7('0x8')]},'calleridname':{'type':Sequelize[_0x8ad7('0x8')]},'calleridnum':{'type':Sequelize[_0x8ad7('0x8')]},'completed':{'type':Sequelize[_0x8ad7('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x221e=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','exports','setDataValue','starttime'];(function(_0x4c3851,_0xbebbfd){var _0x43a1e2=function(_0x271b9f){while(--_0x271b9f){_0x4c3851['push'](_0x4c3851['shift']());}};_0x43a1e2(++_0xbebbfd);}(_0x221e,0x8d));var _0xe221=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x221e[_0x2be8c2];return _0x97f531;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe221('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4d20e1){this[_0xe221('0x1')](_0xe221('0x2'),_0x4d20e1);this[_0xe221('0x1')](_0xe221('0x3'),moment()[_0xe221('0x4')](_0xe221('0x5')));}},'endtime':{'type':Sequelize[_0xe221('0x6')]},'membername':{'type':Sequelize[_0xe221('0x7')]},'projectname':{'type':Sequelize[_0xe221('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xe221('0x7')]},'calleridname':{'type':Sequelize[_0xe221('0x7')]},'calleridnum':{'type':Sequelize[_0xe221('0x7')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index dd70ffd..7ae0938 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 _0x3c1a=['to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','reject','save','then','destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filters','pick','merge','options','where','count','includeAll','rows','catch','show','params','filtears','include','create','update','body','find','describe','getQuestions','JscriptyQuestionReport','sort','filter','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox'];(function(_0x10a827,_0x381036){var _0x28803a=function(_0x1005af){while(--_0x1005af){_0x10a827['push'](_0x10a827['shift']());}};_0x28803a(++_0x381036);}(_0x3c1a,0xda));var _0xa3c1=function(_0x2e53e1,_0x12aed1){_0x2e53e1=_0x2e53e1-0x0;var _0x3a23de=_0x3c1a[_0x2e53e1];return _0x3a23de;};'use strict';var pdf=require(_0xa3c1('0x0'));var emlformat=require(_0xa3c1('0x1'));var rimraf=require(_0xa3c1('0x2'));var zipdir=require(_0xa3c1('0x3'));var jsonpatch=require(_0xa3c1('0x4'));var rp=require(_0xa3c1('0x5'));var moment=require(_0xa3c1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa3c1('0x7'));var util=require('util');var path=require(_0xa3c1('0x8'));var sox=require(_0xa3c1('0x9'));var csv=require(_0xa3c1('0xa'));var ejs=require(_0xa3c1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa3c1('0xc'));var jsforce=require(_0xa3c1('0xd'));var deskjs=require(_0xa3c1('0xe'));var toCsv=require(_0xa3c1('0xa'));var querystring=require(_0xa3c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3c1('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(_0xa3c1('0x11'))(_0xa3c1('0x12'));var utils=require(_0xa3c1('0x13'));var config=require(_0xa3c1('0x14'));var licenseUtil=require(_0xa3c1('0x15'));var db=require(_0xa3c1('0x16'))['db'];function respondWithStatusCode(_0x1ece52,_0x52adac){_0x52adac=_0x52adac||0xcc;return function(_0x2d2499){if(_0x2d2499){return _0x1ece52[_0xa3c1('0x17')](_0x52adac);}return _0x1ece52[_0xa3c1('0x18')](_0x52adac)[_0xa3c1('0x19')]();};}function respondWithResult(_0x17d82a,_0x5af0fa){_0x5af0fa=_0x5af0fa||0xc8;return function(_0x1d3837){if(_0x1d3837){return _0x17d82a['status'](_0x5af0fa)[_0xa3c1('0x1a')](_0x1d3837);}};}function respondWithFilteredResult(_0x344798,_0x53a5df){return function(_0x261ac7){if(_0x261ac7){var _0x19d4d1=_0x261ac7['count'],_0x552144=_0x53a5df[_0xa3c1('0x1b')],_0x5165f4=_0x53a5df['offset']+_0x53a5df['limit'],_0x37d3a6;if(_0x5165f4>=_0x19d4d1){_0x5165f4=_0x19d4d1;_0x37d3a6=0xc8;}else{_0x37d3a6=0xce;}_0x344798[_0xa3c1('0x18')](_0x37d3a6);return _0x344798['set']('Content-Range',_0x552144+'-'+_0x5165f4+'/'+_0x19d4d1)[_0xa3c1('0x1a')](_0x261ac7);}return null;};}function patchUpdates(_0x17dd1e){return function(_0x4c0b39){try{jsonpatch['apply'](_0x4c0b39,_0x17dd1e,!![]);}catch(_0x4bb14a){return BPromise[_0xa3c1('0x1c')](_0x4bb14a);}return _0x4c0b39[_0xa3c1('0x1d')]();};}function saveUpdates(_0x27e5f3,_0x2f94b8){return function(_0x2fe39c){if(_0x2fe39c){return _0x2fe39c['update'](_0x27e5f3)[_0xa3c1('0x1e')](function(_0x4f602b){return _0x4f602b;});}return null;};}function removeEntity(_0x5b8a54,_0x5ec5cf){return function(_0x4f86f7){if(_0x4f86f7){return _0x4f86f7[_0xa3c1('0x1f')]()[_0xa3c1('0x1e')](function(){_0x5b8a54[_0xa3c1('0x18')](0xcc)[_0xa3c1('0x19')]();});}};}function handleEntityNotFound(_0x558713,_0x1f04be){return function(_0x300eef){if(!_0x300eef){_0x558713[_0xa3c1('0x17')](0x194);}return _0x300eef;};}function handleError(_0xe77418,_0x504106){_0x504106=_0x504106||0x1f4;return function(_0x4c4b49){logger[_0xa3c1('0x20')](_0x4c4b49['stack']);if(_0x4c4b49[_0xa3c1('0x21')]){delete _0x4c4b49[_0xa3c1('0x21')];}_0xe77418[_0xa3c1('0x18')](_0x504106)[_0xa3c1('0x22')](_0x4c4b49);};}exports[_0xa3c1('0x23')]=function(_0x57f1e0,_0x11d226){var _0x1680b0={},_0x54d233={},_0x14d229={'count':0x0,'rows':[]};var _0x27d5fc=_[_0xa3c1('0x24')](db[_0xa3c1('0x25')][_0xa3c1('0x26')],function(_0x12e7a5){return{'name':_0x12e7a5[_0xa3c1('0x27')],'type':_0x12e7a5[_0xa3c1('0x28')][_0xa3c1('0x29')]};});_0x54d233[_0xa3c1('0x2a')]=_[_0xa3c1('0x24')](_0x27d5fc,_0xa3c1('0x21'));_0x54d233[_0xa3c1('0x2b')]=_[_0xa3c1('0x2c')](_0x57f1e0[_0xa3c1('0x2b')]);_0x54d233['filters']=_[_0xa3c1('0x2d')](_0x54d233[_0xa3c1('0x2a')],_0x54d233[_0xa3c1('0x2b')]);_0x1680b0[_0xa3c1('0x2e')]=_[_0xa3c1('0x2d')](_0x54d233[_0xa3c1('0x2a')],qs[_0xa3c1('0x2f')](_0x57f1e0[_0xa3c1('0x2b')][_0xa3c1('0x2f')]));_0x1680b0['attributes']=_0x1680b0[_0xa3c1('0x2e')][_0xa3c1('0x30')]?_0x1680b0[_0xa3c1('0x2e')]:_0x54d233[_0xa3c1('0x2a')];if(!_0x57f1e0[_0xa3c1('0x2b')][_0xa3c1('0x31')](_0xa3c1('0x32'))){_0x1680b0[_0xa3c1('0x33')]=qs[_0xa3c1('0x33')](_0x57f1e0[_0xa3c1('0x2b')][_0xa3c1('0x33')]);_0x1680b0[_0xa3c1('0x1b')]=qs[_0xa3c1('0x1b')](_0x57f1e0['query'][_0xa3c1('0x1b')]);}_0x1680b0[_0xa3c1('0x34')]=qs['sort'](_0x57f1e0[_0xa3c1('0x2b')]['sort']);_0x1680b0['where']=qs[_0xa3c1('0x35')](_[_0xa3c1('0x36')](_0x57f1e0['query'],_0x54d233[_0xa3c1('0x35')]),_0x27d5fc);if(_0x57f1e0['query']['filter']){_0x1680b0['where']=_[_0xa3c1('0x37')](_0x1680b0['where'],{'$or':_[_0xa3c1('0x24')](_0x27d5fc,function(_0x116800){if(_0x116800['type']!=='VIRTUAL'){var _0x8672a0={};_0x8672a0[_0x116800[_0xa3c1('0x21')]]={'$like':'%'+_0x57f1e0[_0xa3c1('0x2b')]['filter']+'%'};return _0x8672a0;}})});}_0x1680b0=_[_0xa3c1('0x37')]({},_0x1680b0,_0x57f1e0[_0xa3c1('0x38')]);var _0x863f36={'where':_0x1680b0[_0xa3c1('0x39')]};return db['JscriptySessionReport'][_0xa3c1('0x3a')](_0x863f36)[_0xa3c1('0x1e')](function(_0x1300b4){_0x14d229[_0xa3c1('0x3a')]=_0x1300b4;if(_0x57f1e0[_0xa3c1('0x2b')][_0xa3c1('0x3b')]){_0x1680b0['include']=[{'all':!![]}];}return db[_0xa3c1('0x25')]['findAll'](_0x1680b0);})[_0xa3c1('0x1e')](function(_0x45fc98){_0x14d229[_0xa3c1('0x3c')]=_0x45fc98;return _0x14d229;})[_0xa3c1('0x1e')](respondWithFilteredResult(_0x11d226,_0x1680b0))[_0xa3c1('0x3d')](handleError(_0x11d226,null));};exports[_0xa3c1('0x3e')]=function(_0x27dbb0,_0x4e205a){var _0x1ba4b9={'raw':!![],'where':{'id':_0x27dbb0[_0xa3c1('0x3f')]['id']}},_0x3621db={};_0x3621db[_0xa3c1('0x2a')]=_[_0xa3c1('0x2c')](db[_0xa3c1('0x25')][_0xa3c1('0x26')]);_0x3621db[_0xa3c1('0x2b')]=_['keys'](_0x27dbb0['query']);_0x3621db[_0xa3c1('0x40')]=_[_0xa3c1('0x2d')](_0x3621db[_0xa3c1('0x2a')],_0x3621db[_0xa3c1('0x2b')]);_0x1ba4b9[_0xa3c1('0x2e')]=_[_0xa3c1('0x2d')](_0x3621db['model'],qs[_0xa3c1('0x2f')](_0x27dbb0[_0xa3c1('0x2b')][_0xa3c1('0x2f')]));_0x1ba4b9[_0xa3c1('0x2e')]=_0x1ba4b9[_0xa3c1('0x2e')][_0xa3c1('0x30')]?_0x1ba4b9[_0xa3c1('0x2e')]:_0x3621db[_0xa3c1('0x2a')];if(_0x27dbb0[_0xa3c1('0x2b')][_0xa3c1('0x3b')]){_0x1ba4b9[_0xa3c1('0x41')]=[{'all':!![]}];}_0x1ba4b9=_[_0xa3c1('0x37')]({},_0x1ba4b9,_0x27dbb0[_0xa3c1('0x38')]);return db[_0xa3c1('0x25')]['find'](_0x1ba4b9)[_0xa3c1('0x1e')](handleEntityNotFound(_0x4e205a,null))[_0xa3c1('0x1e')](respondWithResult(_0x4e205a,null))[_0xa3c1('0x3d')](handleError(_0x4e205a,null));};exports[_0xa3c1('0x42')]=function(_0x329645,_0x2434bf){return db['JscriptySessionReport']['create'](_0x329645['body'],{})['then'](respondWithResult(_0x2434bf,0xc9))[_0xa3c1('0x3d')](handleError(_0x2434bf,null));};exports[_0xa3c1('0x43')]=function(_0x136db0,_0xe2c1d1){if(_0x136db0['body']['id']){delete _0x136db0[_0xa3c1('0x44')]['id'];}return db[_0xa3c1('0x25')][_0xa3c1('0x45')]({'where':{'id':_0x136db0[_0xa3c1('0x3f')]['id']}})[_0xa3c1('0x1e')](handleEntityNotFound(_0xe2c1d1,null))[_0xa3c1('0x1e')](saveUpdates(_0x136db0[_0xa3c1('0x44')],null))[_0xa3c1('0x1e')](respondWithResult(_0xe2c1d1,null))[_0xa3c1('0x3d')](handleError(_0xe2c1d1,null));};exports[_0xa3c1('0x1f')]=function(_0x39005b,_0x2746a1){return db[_0xa3c1('0x25')][_0xa3c1('0x45')]({'where':{'id':_0x39005b[_0xa3c1('0x3f')]['id']}})[_0xa3c1('0x1e')](handleEntityNotFound(_0x2746a1,null))['then'](removeEntity(_0x2746a1,null))[_0xa3c1('0x3d')](handleError(_0x2746a1,null));};exports[_0xa3c1('0x46')]=function(_0x7c4cc9,_0x211f7f){return db[_0xa3c1('0x25')][_0xa3c1('0x46')]()[_0xa3c1('0x1e')](respondWithResult(_0x211f7f,null))['catch'](handleError(_0x211f7f,null));};exports[_0xa3c1('0x47')]=function(_0x1a7dfa,_0x3462db,_0x402ae6){var _0x401e74={'raw':!![],'where':{}};var _0x3b1d69={};var _0x4b0799={'count':0x0,'rows':[]};return db[_0xa3c1('0x25')]['findOne']({'where':{'id':_0x1a7dfa['params']['id']}})[_0xa3c1('0x1e')](handleEntityNotFound(_0x3462db,null))[_0xa3c1('0x1e')](function(_0x2893fe){if(_0x2893fe){_0x3b1d69[_0xa3c1('0x2a')]=_[_0xa3c1('0x2c')](db[_0xa3c1('0x48')][_0xa3c1('0x26')]);_0x3b1d69['query']=_[_0xa3c1('0x2c')](_0x1a7dfa[_0xa3c1('0x2b')]);_0x3b1d69[_0xa3c1('0x35')]=_[_0xa3c1('0x2d')](_0x3b1d69[_0xa3c1('0x2a')],_0x3b1d69[_0xa3c1('0x2b')]);_0x401e74[_0xa3c1('0x2e')]=_[_0xa3c1('0x2d')](_0x3b1d69['model'],qs[_0xa3c1('0x2f')](_0x1a7dfa[_0xa3c1('0x2b')][_0xa3c1('0x2f')]));_0x401e74[_0xa3c1('0x2e')]=_0x401e74[_0xa3c1('0x2e')][_0xa3c1('0x30')]?_0x401e74['attributes']:_0x3b1d69[_0xa3c1('0x2a')];if(!_0x1a7dfa[_0xa3c1('0x2b')]['hasOwnProperty'](_0xa3c1('0x32'))){_0x401e74['limit']=qs[_0xa3c1('0x33')](_0x1a7dfa['query'][_0xa3c1('0x33')]);_0x401e74[_0xa3c1('0x1b')]=qs[_0xa3c1('0x1b')](_0x1a7dfa[_0xa3c1('0x2b')][_0xa3c1('0x1b')]);}_0x401e74[_0xa3c1('0x34')]=qs[_0xa3c1('0x49')](_0x1a7dfa['query'][_0xa3c1('0x49')]);_0x401e74[_0xa3c1('0x39')]=qs[_0xa3c1('0x35')](_[_0xa3c1('0x36')](_0x1a7dfa[_0xa3c1('0x2b')],_0x3b1d69[_0xa3c1('0x35')]));_0x401e74[_0xa3c1('0x39')]['SessionId']=_0x2893fe['id'];if(_0x1a7dfa[_0xa3c1('0x2b')][_0xa3c1('0x4a')]){_0x401e74[_0xa3c1('0x39')]=_[_0xa3c1('0x37')](_0x401e74[_0xa3c1('0x39')],{'$or':_[_0xa3c1('0x24')](_0x401e74[_0xa3c1('0x2e')],function(_0x10a377){var _0x5ba544={};_0x5ba544[_0x10a377]={'$like':'%'+_0x1a7dfa['query'][_0xa3c1('0x4a')]+'%'};return _0x5ba544;})});}_0x401e74=_[_0xa3c1('0x37')]({},_0x401e74,_0x1a7dfa['options']);return db['JscriptyQuestionReport'][_0xa3c1('0x3a')]({'where':_0x401e74[_0xa3c1('0x39')]})[_0xa3c1('0x1e')](function(_0x21f632){_0x4b0799[_0xa3c1('0x3a')]=_0x21f632;if(_0x1a7dfa[_0xa3c1('0x2b')]['includeAll']){_0x401e74['include']=[{'all':!![]}];}return db[_0xa3c1('0x48')][_0xa3c1('0x4b')](_0x401e74);})[_0xa3c1('0x1e')](function(_0x42d2c2){_0x4b0799['rows']=_0x42d2c2;return _0x4b0799;});}})[_0xa3c1('0x1e')](respondWithFilteredResult(_0x3462db,_0x401e74))[_0xa3c1('0x3d')](handleError(_0x3462db,null));}; \ No newline at end of file +var _0x1707=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','length','find','create','body','catch','describe','getQuestions','JscriptyQuestionReport','nolimit','SessionId','rows','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','JscriptySessionReport','rawAttributes','type','map','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1707,0x1df));var _0x7170=function(_0x2407fe,_0x351b6c){_0x2407fe=_0x2407fe-0x0;var _0x35dbfd=_0x1707[_0x2407fe];return _0x35dbfd;};'use strict';var pdf=require(_0x7170('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7170('0x1'));var rp=require(_0x7170('0x2'));var moment=require('moment');var BPromise=require(_0x7170('0x3'));var Mustache=require(_0x7170('0x4'));var util=require(_0x7170('0x5'));var path=require(_0x7170('0x6'));var sox=require(_0x7170('0x7'));var csv=require(_0x7170('0x8'));var ejs=require(_0x7170('0x9'));var fs=require('fs');var _=require(_0x7170('0xa'));var squel=require(_0x7170('0xb'));var crypto=require(_0x7170('0xc'));var jsforce=require(_0x7170('0xd'));var deskjs=require(_0x7170('0xe'));var toCsv=require(_0x7170('0x8'));var querystring=require(_0x7170('0xf'));var Papa=require(_0x7170('0x10'));var Redis=require(_0x7170('0x11'));var authService=require(_0x7170('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7170('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7170('0x14'))(_0x7170('0x15'));var utils=require(_0x7170('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd8c1,_0x3193c7){_0x3193c7=_0x3193c7||0xcc;return function(_0x58c1ec){if(_0x58c1ec){return _0x3fd8c1[_0x7170('0x17')](_0x3193c7);}return _0x3fd8c1[_0x7170('0x18')](_0x3193c7)[_0x7170('0x19')]();};}function respondWithResult(_0x414139,_0x369b9e){_0x369b9e=_0x369b9e||0xc8;return function(_0x418282){if(_0x418282){return _0x414139['status'](_0x369b9e)['json'](_0x418282);}};}function respondWithFilteredResult(_0x171f7d,_0x599aa8){return function(_0x31ffb6){if(_0x31ffb6){var _0xabf79a=_0x31ffb6[_0x7170('0x1a')],_0x578f10=_0x599aa8[_0x7170('0x1b')],_0x2c5853=_0x599aa8['offset']+_0x599aa8[_0x7170('0x1c')],_0x53f51d;if(_0x2c5853>=_0xabf79a){_0x2c5853=_0xabf79a;_0x53f51d=0xc8;}else{_0x53f51d=0xce;}_0x171f7d['status'](_0x53f51d);return _0x171f7d[_0x7170('0x1d')](_0x7170('0x1e'),_0x578f10+'-'+_0x2c5853+'/'+_0xabf79a)['json'](_0x31ffb6);}return null;};}function patchUpdates(_0x77cbe9){return function(_0x4f1a04){try{jsonpatch['apply'](_0x4f1a04,_0x77cbe9,!![]);}catch(_0x14896a){return BPromise[_0x7170('0x1f')](_0x14896a);}return _0x4f1a04[_0x7170('0x20')]();};}function saveUpdates(_0x144346,_0x126d87){return function(_0x32b51a){if(_0x32b51a){return _0x32b51a[_0x7170('0x21')](_0x144346)['then'](function(_0x187727){return _0x187727;});}return null;};}function removeEntity(_0x26551f,_0x25e86e){return function(_0x1fa020){if(_0x1fa020){return _0x1fa020[_0x7170('0x22')]()[_0x7170('0x23')](function(){_0x26551f[_0x7170('0x18')](0xcc)[_0x7170('0x19')]();});}};}function handleEntityNotFound(_0x598fe3,_0x1539b4){return function(_0xfa8e3){if(!_0xfa8e3){_0x598fe3[_0x7170('0x17')](0x194);}return _0xfa8e3;};}function handleError(_0x5555b7,_0x2f04d7){_0x2f04d7=_0x2f04d7||0x1f4;return function(_0x44f203){logger[_0x7170('0x24')](_0x44f203[_0x7170('0x25')]);if(_0x44f203[_0x7170('0x26')]){delete _0x44f203['name'];}_0x5555b7[_0x7170('0x18')](_0x2f04d7)['send'](_0x44f203);};}exports[_0x7170('0x27')]=function(_0x19c39d,_0x5217ba){var _0x4d0a73={},_0x1ba393={},_0x13caeb={'count':0x0,'rows':[]};var _0x116ba8=_['map'](db[_0x7170('0x28')][_0x7170('0x29')],function(_0x126985){return{'name':_0x126985['fieldName'],'type':_0x126985[_0x7170('0x2a')]['key']};});_0x1ba393['model']=_[_0x7170('0x2b')](_0x116ba8,_0x7170('0x26'));_0x1ba393[_0x7170('0x2c')]=_[_0x7170('0x2d')](_0x19c39d['query']);_0x1ba393[_0x7170('0x2e')]=_['intersection'](_0x1ba393[_0x7170('0x2f')],_0x1ba393[_0x7170('0x2c')]);_0x4d0a73['attributes']=_[_0x7170('0x30')](_0x1ba393[_0x7170('0x2f')],qs[_0x7170('0x31')](_0x19c39d['query']['fields']));_0x4d0a73[_0x7170('0x32')]=_0x4d0a73['attributes']['length']?_0x4d0a73[_0x7170('0x32')]:_0x1ba393[_0x7170('0x2f')];if(!_0x19c39d['query'][_0x7170('0x33')]('nolimit')){_0x4d0a73[_0x7170('0x1c')]=qs['limit'](_0x19c39d[_0x7170('0x2c')]['limit']);_0x4d0a73[_0x7170('0x1b')]=qs['offset'](_0x19c39d[_0x7170('0x2c')][_0x7170('0x1b')]);}_0x4d0a73[_0x7170('0x34')]=qs[_0x7170('0x35')](_0x19c39d[_0x7170('0x2c')][_0x7170('0x35')]);_0x4d0a73[_0x7170('0x36')]=qs['filters'](_[_0x7170('0x37')](_0x19c39d[_0x7170('0x2c')],_0x1ba393['filters']),_0x116ba8);if(_0x19c39d[_0x7170('0x2c')][_0x7170('0x38')]){_0x4d0a73['where']=_[_0x7170('0x39')](_0x4d0a73[_0x7170('0x36')],{'$or':_[_0x7170('0x2b')](_0x116ba8,function(_0x32ee84){if(_0x32ee84[_0x7170('0x2a')]!==_0x7170('0x3a')){var _0x33eb37={};_0x33eb37[_0x32ee84['name']]={'$like':'%'+_0x19c39d[_0x7170('0x2c')][_0x7170('0x38')]+'%'};return _0x33eb37;}})});}_0x4d0a73=_['merge']({},_0x4d0a73,_0x19c39d[_0x7170('0x3b')]);var _0x4087e7={'where':_0x4d0a73[_0x7170('0x36')]};return db[_0x7170('0x28')][_0x7170('0x1a')](_0x4087e7)[_0x7170('0x23')](function(_0x6a80ce){_0x13caeb[_0x7170('0x1a')]=_0x6a80ce;if(_0x19c39d[_0x7170('0x2c')][_0x7170('0x3c')]){_0x4d0a73[_0x7170('0x3d')]=[{'all':!![]}];}return db[_0x7170('0x28')][_0x7170('0x3e')](_0x4d0a73);})['then'](function(_0x3ad7d4){_0x13caeb['rows']=_0x3ad7d4;return _0x13caeb;})[_0x7170('0x23')](respondWithFilteredResult(_0x5217ba,_0x4d0a73))['catch'](handleError(_0x5217ba,null));};exports[_0x7170('0x3f')]=function(_0x2eef96,_0x4479d8){var _0x293ba5={'raw':!![],'where':{'id':_0x2eef96[_0x7170('0x40')]['id']}},_0x1facfa={};_0x1facfa['model']=_[_0x7170('0x2d')](db[_0x7170('0x28')][_0x7170('0x29')]);_0x1facfa[_0x7170('0x2c')]=_[_0x7170('0x2d')](_0x2eef96[_0x7170('0x2c')]);_0x1facfa['filtears']=_[_0x7170('0x30')](_0x1facfa[_0x7170('0x2f')],_0x1facfa[_0x7170('0x2c')]);_0x293ba5[_0x7170('0x32')]=_['intersection'](_0x1facfa[_0x7170('0x2f')],qs[_0x7170('0x31')](_0x2eef96[_0x7170('0x2c')]['fields']));_0x293ba5[_0x7170('0x32')]=_0x293ba5[_0x7170('0x32')][_0x7170('0x41')]?_0x293ba5[_0x7170('0x32')]:_0x1facfa['model'];if(_0x2eef96[_0x7170('0x2c')]['includeAll']){_0x293ba5['include']=[{'all':!![]}];}_0x293ba5=_['merge']({},_0x293ba5,_0x2eef96[_0x7170('0x3b')]);return db['JscriptySessionReport'][_0x7170('0x42')](_0x293ba5)[_0x7170('0x23')](handleEntityNotFound(_0x4479d8,null))[_0x7170('0x23')](respondWithResult(_0x4479d8,null))['catch'](handleError(_0x4479d8,null));};exports[_0x7170('0x43')]=function(_0x55f8e8,_0x2a6db1){return db[_0x7170('0x28')][_0x7170('0x43')](_0x55f8e8[_0x7170('0x44')],{})['then'](respondWithResult(_0x2a6db1,0xc9))[_0x7170('0x45')](handleError(_0x2a6db1,null));};exports[_0x7170('0x21')]=function(_0x495105,_0x280fe3){if(_0x495105[_0x7170('0x44')]['id']){delete _0x495105[_0x7170('0x44')]['id'];}return db[_0x7170('0x28')][_0x7170('0x42')]({'where':{'id':_0x495105[_0x7170('0x40')]['id']}})[_0x7170('0x23')](handleEntityNotFound(_0x280fe3,null))['then'](saveUpdates(_0x495105[_0x7170('0x44')],null))[_0x7170('0x23')](respondWithResult(_0x280fe3,null))[_0x7170('0x45')](handleError(_0x280fe3,null));};exports[_0x7170('0x22')]=function(_0x4088d5,_0x1a3970){return db[_0x7170('0x28')]['find']({'where':{'id':_0x4088d5[_0x7170('0x40')]['id']}})[_0x7170('0x23')](handleEntityNotFound(_0x1a3970,null))[_0x7170('0x23')](removeEntity(_0x1a3970,null))['catch'](handleError(_0x1a3970,null));};exports[_0x7170('0x46')]=function(_0x19887a,_0x1b47b7){return db[_0x7170('0x28')][_0x7170('0x46')]()[_0x7170('0x23')](respondWithResult(_0x1b47b7,null))[_0x7170('0x45')](handleError(_0x1b47b7,null));};exports[_0x7170('0x47')]=function(_0x125083,_0x595890,_0x4dec37){var _0x3f5f3b={'raw':!![],'where':{}};var _0x2b5b8b={};var _0x9b4c2={'count':0x0,'rows':[]};return db[_0x7170('0x28')]['findOne']({'where':{'id':_0x125083['params']['id']}})[_0x7170('0x23')](handleEntityNotFound(_0x595890,null))['then'](function(_0x23e214){if(_0x23e214){_0x2b5b8b[_0x7170('0x2f')]=_['keys'](db[_0x7170('0x48')][_0x7170('0x29')]);_0x2b5b8b[_0x7170('0x2c')]=_[_0x7170('0x2d')](_0x125083[_0x7170('0x2c')]);_0x2b5b8b[_0x7170('0x2e')]=_[_0x7170('0x30')](_0x2b5b8b[_0x7170('0x2f')],_0x2b5b8b[_0x7170('0x2c')]);_0x3f5f3b[_0x7170('0x32')]=_['intersection'](_0x2b5b8b[_0x7170('0x2f')],qs[_0x7170('0x31')](_0x125083[_0x7170('0x2c')][_0x7170('0x31')]));_0x3f5f3b[_0x7170('0x32')]=_0x3f5f3b[_0x7170('0x32')]['length']?_0x3f5f3b[_0x7170('0x32')]:_0x2b5b8b[_0x7170('0x2f')];if(!_0x125083[_0x7170('0x2c')]['hasOwnProperty'](_0x7170('0x49'))){_0x3f5f3b['limit']=qs['limit'](_0x125083[_0x7170('0x2c')][_0x7170('0x1c')]);_0x3f5f3b[_0x7170('0x1b')]=qs[_0x7170('0x1b')](_0x125083[_0x7170('0x2c')][_0x7170('0x1b')]);}_0x3f5f3b[_0x7170('0x34')]=qs[_0x7170('0x35')](_0x125083['query'][_0x7170('0x35')]);_0x3f5f3b[_0x7170('0x36')]=qs['filters'](_['pick'](_0x125083['query'],_0x2b5b8b[_0x7170('0x2e')]));_0x3f5f3b[_0x7170('0x36')][_0x7170('0x4a')]=_0x23e214['id'];if(_0x125083[_0x7170('0x2c')][_0x7170('0x38')]){_0x3f5f3b[_0x7170('0x36')]=_[_0x7170('0x39')](_0x3f5f3b['where'],{'$or':_[_0x7170('0x2b')](_0x3f5f3b[_0x7170('0x32')],function(_0x4253ea){var _0x854350={};_0x854350[_0x4253ea]={'$like':'%'+_0x125083['query'][_0x7170('0x38')]+'%'};return _0x854350;})});}_0x3f5f3b=_[_0x7170('0x39')]({},_0x3f5f3b,_0x125083['options']);return db[_0x7170('0x48')][_0x7170('0x1a')]({'where':_0x3f5f3b[_0x7170('0x36')]})[_0x7170('0x23')](function(_0x4d7cf5){_0x9b4c2[_0x7170('0x1a')]=_0x4d7cf5;if(_0x125083[_0x7170('0x2c')]['includeAll']){_0x3f5f3b[_0x7170('0x3d')]=[{'all':!![]}];}return db[_0x7170('0x48')][_0x7170('0x3e')](_0x3f5f3b);})['then'](function(_0x2d7d94){_0x9b4c2[_0x7170('0x4b')]=_0x2d7d94;return _0x9b4c2;});}})[_0x7170('0x23')](respondWithFilteredResult(_0x595890,_0x3f5f3b))[_0x7170('0x45')](handleError(_0x595890,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2dc1f04..7234d35 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 _0x7645=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','bluebird','path'];(function(_0x4d367c,_0x58d1ef){var _0x3b432a=function(_0x3ae1dd){while(--_0x3ae1dd){_0x4d367c['push'](_0x4d367c['shift']());}};_0x3b432a(++_0x58d1ef);}(_0x7645,0x178));var _0x5764=function(_0x321755,_0x284d48){_0x321755=_0x321755-0x0;var _0x4e708b=_0x7645[_0x321755];return _0x4e708b;};'use strict';var _=require(_0x5764('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5764('0x1'));var BPromise=require(_0x5764('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5764('0x3'));var rimraf=require(_0x5764('0x4'));var config=require(_0x5764('0x5'));var attributes=require(_0x5764('0x6'));module[_0x5764('0x7')]=function(_0x8743f,_0x47499f){return _0x8743f[_0x5764('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x5764('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaec=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','api','moment'];(function(_0x221950,_0x9d77a3){var _0x35913c=function(_0x552166){while(--_0x552166){_0x221950['push'](_0x221950['shift']());}};_0x35913c(++_0x9d77a3);}(_0xdaec,0x1ae));var _0xcdae=function(_0x181e2d,_0x4ccf91){_0x181e2d=_0x181e2d-0x0;var _0x231d54=_0xdaec[_0x181e2d];return _0x231d54;};'use strict';var _=require(_0xcdae('0x0'));var util=require(_0xcdae('0x1'));var logger=require('../../config/logger')(_0xcdae('0x2'));var moment=require(_0xcdae('0x3'));var BPromise=require(_0xcdae('0x4'));var rp=require(_0xcdae('0x5'));var fs=require('fs');var path=require(_0xcdae('0x6'));var rimraf=require(_0xcdae('0x7'));var config=require(_0xcdae('0x8'));var attributes=require(_0xcdae('0x9'));module[_0xcdae('0xa')]=function(_0x428c8f,_0x146b97){return _0x428c8f[_0xcdae('0xb')](_0xcdae('0xc'),attributes,{'tableName':_0xcdae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 278a120..290bd81 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 _0x2781=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0x2781,0x76));var _0x1278=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2781[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1278('0x0'));var util=require('util');var moment=require(_0x1278('0x1'));var BPromise=require(_0x1278('0x2'));var rs=require(_0x1278('0x3'));var fs=require('fs');var Redis=require(_0x1278('0x4'));var db=require(_0x1278('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1278('0x6'))(_0x1278('0x7'));var config=require(_0x1278('0x8'));var jayson=require(_0x1278('0x9'));var client=jayson['client'][_0x1278('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d8c24,_0x5dc67d,_0x2290b0){return new BPromise(function(_0x576cda,_0x44197c){return client[_0x1278('0xb')](_0x5d8c24,_0x2290b0)[_0x1278('0xc')](function(_0x5f44ba){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x5dc67d,'request\x20sent');logger[_0x1278('0xd')](_0x1278('0xe'),_0x5dc67d,_0x1278('0xf'),JSON[_0x1278('0x10')](_0x5f44ba));if(_0x5f44ba[_0x1278('0x11')]){if(_0x5f44ba['error'][_0x1278('0x12')]===0x1f4){logger[_0x1278('0x11')](_0x1278('0x13'),_0x5dc67d,_0x5f44ba[_0x1278('0x11')][_0x1278('0x14')]);return _0x44197c(_0x5f44ba[_0x1278('0x11')][_0x1278('0x14')]);}logger[_0x1278('0x11')](_0x1278('0x13'),_0x5dc67d,_0x5f44ba[_0x1278('0x11')][_0x1278('0x14')]);return _0x576cda(_0x5f44ba['error'][_0x1278('0x14')]);}else{logger[_0x1278('0x15')](_0x1278('0x13'),_0x5dc67d,'request\x20sent');_0x576cda(_0x5f44ba[_0x1278('0x16')][_0x1278('0x14')]);}})[_0x1278('0x17')](function(_0x3a18a0){logger['error'](_0x1278('0x13'),_0x5dc67d,_0x3a18a0);_0x44197c(_0x3a18a0);});});} \ No newline at end of file +var _0x9795=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0x9795,0x92));var _0x5979=function(_0xd90ca3,_0x47d611){_0xd90ca3=_0xd90ca3-0x0;var _0x35c0ac=_0x9795[_0xd90ca3];return _0x35c0ac;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5979('0x0'));var BPromise=require('bluebird');var rs=require(_0x5979('0x1'));var fs=require('fs');var Redis=require(_0x5979('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5979('0x3'));var logger=require('../../config/logger')(_0x5979('0x4'));var config=require(_0x5979('0x5'));var jayson=require(_0x5979('0x6'));var client=jayson[_0x5979('0x7')][_0x5979('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12e4ae,_0x3415ff,_0x150d7e){return new BPromise(function(_0x35777c,_0x475731){return client[_0x5979('0x9')](_0x12e4ae,_0x150d7e)[_0x5979('0xa')](function(_0x3bddac){logger['info'](_0x5979('0xb'),_0x3415ff,_0x5979('0xc'));logger[_0x5979('0xd')](_0x5979('0xe'),_0x3415ff,_0x5979('0xc'),JSON[_0x5979('0xf')](_0x3bddac));if(_0x3bddac[_0x5979('0x10')]){if(_0x3bddac[_0x5979('0x10')][_0x5979('0x11')]===0x1f4){logger['error'](_0x5979('0xb'),_0x3415ff,_0x3bddac['error']['message']);return _0x475731(_0x3bddac['error'][_0x5979('0x12')]);}logger[_0x5979('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3415ff,_0x3bddac['error'][_0x5979('0x12')]);return _0x35777c(_0x3bddac[_0x5979('0x10')][_0x5979('0x12')]);}else{logger[_0x5979('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x3415ff,_0x5979('0xc'));_0x35777c(_0x3bddac[_0x5979('0x14')][_0x5979('0x12')]);}})['catch'](function(_0x5d14be){logger[_0x5979('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x3415ff,_0x5d14be);_0x475731(_0x5d14be);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index cdd13fa..273dac5 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 _0x71f0=['../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','isAuthenticated','update','exports','multer','util','path','express','Router'];(function(_0x9418f3,_0x4494f4){var _0x5038dc=function(_0x780396){while(--_0x780396){_0x9418f3['push'](_0x9418f3['shift']());}};_0x5038dc(++_0x4494f4);}(_0x71f0,0x79));var _0x071f=function(_0x403484,_0x33b8ba){_0x403484=_0x403484-0x0;var _0x55b2bc=_0x71f0[_0x403484];return _0x55b2bc;};'use strict';var multer=require(_0x071f('0x0'));var util=require(_0x071f('0x1'));var path=require(_0x071f('0x2'));var timeout=require('connect-timeout');var express=require(_0x071f('0x3'));var router=express[_0x071f('0x4')]();var auth=require(_0x071f('0x5'));var interaction=require(_0x071f('0x6'));var config=require('../../config/environment');var controller=require(_0x071f('0x7'));router[_0x071f('0x8')]('/',controller[_0x071f('0x9')]);router[_0x071f('0xa')]('/:id',auth[_0x071f('0xb')](),controller[_0x071f('0xc')]);module[_0x071f('0xd')]=router; \ No newline at end of file +var _0x6c37=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','index','put','/:id','isAuthenticated','exports','multer','util'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x6c37,0x82));var _0x76c3=function(_0x564dff,_0x163258){_0x564dff=_0x564dff-0x0;var _0x5db587=_0x6c37[_0x564dff];return _0x5db587;};'use strict';var multer=require(_0x76c3('0x0'));var util=require(_0x76c3('0x1'));var path=require(_0x76c3('0x2'));var timeout=require(_0x76c3('0x3'));var express=require('express');var router=express[_0x76c3('0x4')]();var auth=require(_0x76c3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x76c3('0x6'));var controller=require('./license.controller');router['get']('/',controller[_0x76c3('0x7')]);router[_0x76c3('0x8')](_0x76c3('0x9'),auth[_0x76c3('0xa')](),controller['update']);module[_0x76c3('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 5597b24..f0906c8 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 _0x1cb9=['STRING','INTEGER','sequelize','TEXT'];(function(_0x3cb659,_0x937e1d){var _0x3946e6=function(_0x12d5e1){while(--_0x12d5e1){_0x3cb659['push'](_0x3cb659['shift']());}};_0x3946e6(++_0x937e1d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x252c10,_0x1656d){_0x252c10=_0x252c10-0x0;var _0xa954e1=_0x1cb9[_0x252c10];return _0xa954e1;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'license':{'type':Sequelize[_0x91cb('0x1')]},'data1':{'type':Sequelize[_0x91cb('0x2')]},'data2':{'type':Sequelize[_0x91cb('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x91cb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdbf5=['exports','STRING','INTEGER'];(function(_0x190acf,_0x3c0824){var _0x5bde5b=function(_0x55b7dc){while(--_0x55b7dc){_0x190acf['push'](_0x190acf['shift']());}};_0x5bde5b(++_0x3c0824);}(_0xdbf5,0x18c));var _0x5dbf=function(_0xc606de,_0x37610b){_0xc606de=_0xc606de-0x0;var _0x2f51cb=_0xdbf5[_0xc606de];return _0x2f51cb;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x5dbf('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x5dbf('0x2')],'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 94cef46..03b8c75 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 _0xdb70=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','limit','reject','save','then','destroy','end','error','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','options','getLicense','body','find','params','get','key','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xdb70,0xa0));var _0x0db7=function(_0x1ab13a,_0x346801){_0x1ab13a=_0x1ab13a-0x0;var _0x2c6a02=_0xdb70[_0x1ab13a];return _0x2c6a02;};'use strict';var pdf=require(_0x0db7('0x0'));var emlformat=require(_0x0db7('0x1'));var rimraf=require(_0x0db7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0db7('0x3'));var rp=require(_0x0db7('0x4'));var moment=require(_0x0db7('0x5'));var BPromise=require(_0x0db7('0x6'));var Mustache=require(_0x0db7('0x7'));var util=require(_0x0db7('0x8'));var path=require(_0x0db7('0x9'));var sox=require(_0x0db7('0xa'));var csv=require(_0x0db7('0xb'));var ejs=require(_0x0db7('0xc'));var fs=require('fs');var _=require(_0x0db7('0xd'));var squel=require('squel');var crypto=require(_0x0db7('0xe'));var jsforce=require(_0x0db7('0xf'));var deskjs=require(_0x0db7('0x10'));var toCsv=require(_0x0db7('0xb'));var querystring=require(_0x0db7('0x11'));var Papa=require(_0x0db7('0x12'));var Redis=require('ioredis');var authService=require(_0x0db7('0x13'));var qs=require(_0x0db7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0db7('0x15'));var logger=require(_0x0db7('0x16'))(_0x0db7('0x17'));var utils=require(_0x0db7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0db7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9aed4f,_0x2959a2){_0x2959a2=_0x2959a2||0xcc;return function(_0x33ec07){if(_0x33ec07){return _0x9aed4f[_0x0db7('0x1a')](_0x2959a2);}return _0x9aed4f[_0x0db7('0x1b')](_0x2959a2)['end']();};}function respondWithResult(_0x76c036,_0x195556){_0x195556=_0x195556||0xc8;return function(_0x45f594){if(_0x45f594){return _0x76c036[_0x0db7('0x1b')](_0x195556)[_0x0db7('0x1c')](_0x45f594);}};}function respondWithFilteredResult(_0x446448,_0x41b2b3){return function(_0x2edbe9){if(_0x2edbe9){var _0xb9127d=_0x2edbe9[_0x0db7('0x1d')],_0x34f136=_0x41b2b3[_0x0db7('0x1e')],_0x4c7746=_0x41b2b3[_0x0db7('0x1e')]+_0x41b2b3[_0x0db7('0x1f')],_0x21cd17;if(_0x4c7746>=_0xb9127d){_0x4c7746=_0xb9127d;_0x21cd17=0xc8;}else{_0x21cd17=0xce;}_0x446448[_0x0db7('0x1b')](_0x21cd17);return _0x446448['set']('Content-Range',_0x34f136+'-'+_0x4c7746+'/'+_0xb9127d)[_0x0db7('0x1c')](_0x2edbe9);}return null;};}function patchUpdates(_0x213358){return function(_0xe9a55d){try{jsonpatch['apply'](_0xe9a55d,_0x213358,!![]);}catch(_0x456716){return BPromise[_0x0db7('0x20')](_0x456716);}return _0xe9a55d[_0x0db7('0x21')]();};}function saveUpdates(_0x211fc0,_0x5a0b04){return function(_0xd88751){if(_0xd88751){return _0xd88751['update'](_0x211fc0)[_0x0db7('0x22')](function(_0x587428){return _0x587428;});}return null;};}function removeEntity(_0x59b7e4,_0x135429){return function(_0x156aaa){if(_0x156aaa){return _0x156aaa[_0x0db7('0x23')]()[_0x0db7('0x22')](function(){_0x59b7e4[_0x0db7('0x1b')](0xcc)[_0x0db7('0x24')]();});}};}function handleEntityNotFound(_0xc05009,_0x274bf1){return function(_0x298c12){if(!_0x298c12){_0xc05009[_0x0db7('0x1a')](0x194);}return _0x298c12;};}function handleError(_0x1a3977,_0x456746){_0x456746=_0x456746||0x1f4;return function(_0x299c22){logger[_0x0db7('0x25')](_0x299c22['stack']);if(_0x299c22['name']){delete _0x299c22['name'];}_0x1a3977['status'](_0x456746)['send'](_0x299c22);};}var utilLicense=require(_0x0db7('0x19'));exports[_0x0db7('0x26')]=function(_0x5ea1dc,_0x55637e){var _0x5d3091={'raw':!![],'where':{'id':0x1}},_0x3279b5={};_0x3279b5[_0x0db7('0x27')]=_[_0x0db7('0x28')](db[_0x0db7('0x29')][_0x0db7('0x2a')]);_0x3279b5[_0x0db7('0x2b')]=_['keys'](_0x5ea1dc[_0x0db7('0x2b')]);_0x3279b5['filters']=_[_0x0db7('0x2c')](_0x3279b5[_0x0db7('0x27')],_0x3279b5[_0x0db7('0x2b')]);_0x5d3091[_0x0db7('0x2d')]=_['intersection'](_0x3279b5[_0x0db7('0x27')],qs['fields'](_0x5ea1dc[_0x0db7('0x2b')][_0x0db7('0x2e')]));_0x5d3091[_0x0db7('0x2d')]=_0x5d3091['attributes'][_0x0db7('0x2f')]?_0x5d3091[_0x0db7('0x2d')]:_0x3279b5['model'];_0x5d3091=_['merge']({},_0x5d3091,_0x5ea1dc[_0x0db7('0x30')]);return utilLicense[_0x0db7('0x31')](_0x5d3091)[_0x0db7('0x22')](respondWithResult(_0x55637e,null))['catch'](handleError(_0x55637e,null));};exports['update']=function(_0x174129,_0x127cfc){if(_0x174129[_0x0db7('0x32')]['id']){delete _0x174129['body']['id'];}return db[_0x0db7('0x29')][_0x0db7('0x33')]({'where':{'id':_0x174129[_0x0db7('0x34')]['id']}})[_0x0db7('0x22')](handleEntityNotFound(_0x127cfc,null))['then'](function(_0x20a5ff){var _0x50a405=_0x20a5ff[_0x0db7('0x35')]({'plain':!![]});return utilLicense['checkLicense'](_0x50a405,_0x174129[_0x0db7('0x32')][_0x0db7('0x36')]);})[_0x0db7('0x22')](function(_0x50e33f){if(!_0x50e33f['demo']){return saveUpdates(_0x174129[_0x0db7('0x32')],null);}return _0x50e33f;})[_0x0db7('0x22')](respondWithResult(_0x127cfc,null))[_0x0db7('0x37')](handleError(_0x127cfc,null));}; \ No newline at end of file +var _0xd6d2=['body','find','params','get','checkLicense','key','demo','catch','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','keys','License','rawAttributes','query','intersection','attributes','model','fields','length','merge','options','getLicense'];(function(_0x4d33d3,_0x3cd7a8){var _0x5ee998=function(_0x2692bb){while(--_0x2692bb){_0x4d33d3['push'](_0x4d33d3['shift']());}};_0x5ee998(++_0x3cd7a8);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x759557,_0x241b19){_0x759557=_0x759557-0x0;var _0x5022d9=_0xd6d2[_0x759557];return _0x5022d9;};'use strict';var pdf=require(_0x2d6d('0x0'));var emlformat=require(_0x2d6d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2d6d('0x2'));var jsonpatch=require(_0x2d6d('0x3'));var rp=require('request-promise');var moment=require(_0x2d6d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2d6d('0x5'));var util=require(_0x2d6d('0x6'));var path=require(_0x2d6d('0x7'));var sox=require('sox');var csv=require(_0x2d6d('0x8'));var ejs=require(_0x2d6d('0x9'));var fs=require('fs');var _=require(_0x2d6d('0xa'));var squel=require(_0x2d6d('0xb'));var crypto=require(_0x2d6d('0xc'));var jsforce=require(_0x2d6d('0xd'));var deskjs=require(_0x2d6d('0xe'));var toCsv=require(_0x2d6d('0x8'));var querystring=require(_0x2d6d('0xf'));var Papa=require(_0x2d6d('0x10'));var Redis=require(_0x2d6d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2d6d('0x12'));var as=require(_0x2d6d('0x13'));var hardwareService=require(_0x2d6d('0x14'));var logger=require(_0x2d6d('0x15'))(_0x2d6d('0x16'));var utils=require('../../config/utils');var config=require(_0x2d6d('0x17'));var licenseUtil=require(_0x2d6d('0x18'));var db=require(_0x2d6d('0x19'))['db'];function respondWithStatusCode(_0x2ad9fc,_0x5c4bf6){_0x5c4bf6=_0x5c4bf6||0xcc;return function(_0x5ef174){if(_0x5ef174){return _0x2ad9fc[_0x2d6d('0x1a')](_0x5c4bf6);}return _0x2ad9fc[_0x2d6d('0x1b')](_0x5c4bf6)[_0x2d6d('0x1c')]();};}function respondWithResult(_0x3528de,_0x58bd29){_0x58bd29=_0x58bd29||0xc8;return function(_0x1ec6aa){if(_0x1ec6aa){return _0x3528de[_0x2d6d('0x1b')](_0x58bd29)['json'](_0x1ec6aa);}};}function respondWithFilteredResult(_0x586085,_0x370096){return function(_0x17340f){if(_0x17340f){var _0x109b49=_0x17340f['count'],_0x54c473=_0x370096['offset'],_0x385613=_0x370096[_0x2d6d('0x1d')]+_0x370096[_0x2d6d('0x1e')],_0x5b8d81;if(_0x385613>=_0x109b49){_0x385613=_0x109b49;_0x5b8d81=0xc8;}else{_0x5b8d81=0xce;}_0x586085[_0x2d6d('0x1b')](_0x5b8d81);return _0x586085[_0x2d6d('0x1f')](_0x2d6d('0x20'),_0x54c473+'-'+_0x385613+'/'+_0x109b49)[_0x2d6d('0x21')](_0x17340f);}return null;};}function patchUpdates(_0x389040){return function(_0xa2c4a7){try{jsonpatch[_0x2d6d('0x22')](_0xa2c4a7,_0x389040,!![]);}catch(_0x4898a7){return BPromise[_0x2d6d('0x23')](_0x4898a7);}return _0xa2c4a7[_0x2d6d('0x24')]();};}function saveUpdates(_0x5b0c61,_0x227e44){return function(_0x7226e6){if(_0x7226e6){return _0x7226e6[_0x2d6d('0x25')](_0x5b0c61)[_0x2d6d('0x26')](function(_0x37b4c8){return _0x37b4c8;});}return null;};}function removeEntity(_0x59234a,_0x4aaa62){return function(_0x42c2f2){if(_0x42c2f2){return _0x42c2f2[_0x2d6d('0x27')]()[_0x2d6d('0x26')](function(){_0x59234a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ae8ad,_0x4e7ec8){return function(_0x4c2fb6){if(!_0x4c2fb6){_0x3ae8ad['sendStatus'](0x194);}return _0x4c2fb6;};}function handleError(_0x14f291,_0xaca9c7){_0xaca9c7=_0xaca9c7||0x1f4;return function(_0x3da83d){logger[_0x2d6d('0x28')](_0x3da83d[_0x2d6d('0x29')]);if(_0x3da83d['name']){delete _0x3da83d[_0x2d6d('0x2a')];}_0x14f291[_0x2d6d('0x1b')](_0xaca9c7)[_0x2d6d('0x2b')](_0x3da83d);};}var utilLicense=require(_0x2d6d('0x18'));exports[_0x2d6d('0x2c')]=function(_0x256d84,_0x3e9f75){var _0x28e182={'raw':!![],'where':{'id':0x1}},_0x27b7d2={};_0x27b7d2['model']=_[_0x2d6d('0x2d')](db[_0x2d6d('0x2e')][_0x2d6d('0x2f')]);_0x27b7d2[_0x2d6d('0x30')]=_['keys'](_0x256d84[_0x2d6d('0x30')]);_0x27b7d2['filters']=_[_0x2d6d('0x31')](_0x27b7d2['model'],_0x27b7d2['query']);_0x28e182[_0x2d6d('0x32')]=_['intersection'](_0x27b7d2[_0x2d6d('0x33')],qs[_0x2d6d('0x34')](_0x256d84['query'][_0x2d6d('0x34')]));_0x28e182['attributes']=_0x28e182[_0x2d6d('0x32')][_0x2d6d('0x35')]?_0x28e182[_0x2d6d('0x32')]:_0x27b7d2[_0x2d6d('0x33')];_0x28e182=_[_0x2d6d('0x36')]({},_0x28e182,_0x256d84[_0x2d6d('0x37')]);return utilLicense[_0x2d6d('0x38')](_0x28e182)[_0x2d6d('0x26')](respondWithResult(_0x3e9f75,null))['catch'](handleError(_0x3e9f75,null));};exports[_0x2d6d('0x25')]=function(_0x1fee00,_0x489f47){if(_0x1fee00[_0x2d6d('0x39')]['id']){delete _0x1fee00[_0x2d6d('0x39')]['id'];}return db[_0x2d6d('0x2e')][_0x2d6d('0x3a')]({'where':{'id':_0x1fee00[_0x2d6d('0x3b')]['id']}})['then'](handleEntityNotFound(_0x489f47,null))['then'](function(_0x512615){var _0x625d2a=_0x512615[_0x2d6d('0x3c')]({'plain':!![]});return utilLicense[_0x2d6d('0x3d')](_0x625d2a,_0x1fee00['body'][_0x2d6d('0x3e')]);})[_0x2d6d('0x26')](function(_0x29dce0){if(!_0x29dce0[_0x2d6d('0x3f')]){return saveUpdates(_0x1fee00['body'],null);}return _0x29dce0;})[_0x2d6d('0x26')](respondWithResult(_0x489f47,null))[_0x2d6d('0x40')](handleError(_0x489f47,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 86fdd79..95ce460 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 _0xa2d5=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x4c3820,_0x1c81d6){var _0x479b06=function(_0x3cd1f2){while(--_0x3cd1f2){_0x4c3820['push'](_0x4c3820['shift']());}};_0x479b06(++_0x1c81d6);}(_0xa2d5,0xc4));var _0x5a2d=function(_0x35bebc,_0xebc2df){_0x35bebc=_0x35bebc-0x0;var _0x59dd6d=_0xa2d5[_0x35bebc];return _0x59dd6d;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var logger=require(_0x5a2d('0x2'))(_0x5a2d('0x3'));var moment=require(_0x5a2d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a2d('0x5'));var fs=require('fs');var path=require(_0x5a2d('0x6'));var rimraf=require(_0x5a2d('0x7'));var config=require(_0x5a2d('0x8'));var attributes=require(_0x5a2d('0x9'));module[_0x5a2d('0xa')]=function(_0x5d6f00,_0x385c77){return _0x5d6f00[_0x5a2d('0xb')](_0x5a2d('0xc'),attributes,{'tableName':_0x5a2d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaa8=['license','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','License'];(function(_0x2b5997,_0x4a19dc){var _0x124ffd=function(_0x1c1dac){while(--_0x1c1dac){_0x2b5997['push'](_0x2b5997['shift']());}};_0x124ffd(++_0x4a19dc);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x27393d,_0x342d57){_0x27393d=_0x27393d-0x0;var _0x1ea664=_0xbaa8[_0x27393d];return _0x1ea664;};'use strict';var _=require(_0x8baa('0x0'));var util=require(_0x8baa('0x1'));var logger=require(_0x8baa('0x2'))(_0x8baa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8baa('0x4'));var fs=require('fs');var path=require(_0x8baa('0x5'));var rimraf=require(_0x8baa('0x6'));var config=require(_0x8baa('0x7'));var attributes=require('./license.attributes');module[_0x8baa('0x8')]=function(_0x40f0ec,_0x5b8cf4){return _0x40f0ec[_0x8baa('0x9')](_0x8baa('0xa'),attributes,{'tableName':_0x8baa('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 862f385..906494a 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 _0x1d90=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1d90,0x13e));var _0x01d9=function(_0x3cf4e2,_0x29d58e){_0x3cf4e2=_0x3cf4e2-0x0;var _0x3340ec=_0x1d90[_0x3cf4e2];return _0x3340ec;};'use strict';var _=require(_0x01d9('0x0'));var util=require('util');var moment=require(_0x01d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x01d9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01d9('0x3'))['db'];var utils=require(_0x01d9('0x4'));var logger=require('../../config/logger')(_0x01d9('0x5'));var config=require(_0x01d9('0x6'));var jayson=require(_0x01d9('0x7'));var client=jayson['client'][_0x01d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1664eb,_0x31c11d,_0x598409){return new BPromise(function(_0xef9d5b,_0x479447){return client['request'](_0x1664eb,_0x598409)[_0x01d9('0x9')](function(_0x2b8e06){logger[_0x01d9('0xa')]('License,\x20%s,\x20%s',_0x31c11d,_0x01d9('0xb'));logger[_0x01d9('0xc')](_0x01d9('0xd'),_0x31c11d,'request\x20sent',JSON[_0x01d9('0xe')](_0x2b8e06));if(_0x2b8e06[_0x01d9('0xf')]){if(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x10')]===0x1f4){logger[_0x01d9('0xf')](_0x01d9('0x11'),_0x31c11d,_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);return _0x479447(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);}logger[_0x01d9('0xf')](_0x01d9('0x11'),_0x31c11d,_0x2b8e06['error'][_0x01d9('0x12')]);return _0xef9d5b(_0x2b8e06[_0x01d9('0xf')][_0x01d9('0x12')]);}else{logger[_0x01d9('0xa')]('License,\x20%s,\x20%s',_0x31c11d,_0x01d9('0xb'));_0xef9d5b(_0x2b8e06[_0x01d9('0x13')][_0x01d9('0x12')]);}})[_0x01d9('0x14')](function(_0x147911){logger['error'](_0x01d9('0x11'),_0x31c11d,_0x147911);_0x479447(_0x147911);});});} \ No newline at end of file +var _0x0490=['debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x80e289,_0x54b9c8){var _0x228203=function(_0x307f33){while(--_0x307f33){_0x80e289['push'](_0x80e289['shift']());}};_0x228203(++_0x54b9c8);}(_0x0490,0x147));var _0x0049=function(_0x36c8aa,_0x2aa1cd){_0x36c8aa=_0x36c8aa-0x0;var _0x1d196c=_0x0490[_0x36c8aa];return _0x1d196c;};'use strict';var _=require('lodash');var util=require(_0x0049('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0049('0x1'))['db'];var utils=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))(_0x0049('0x4'));var config=require(_0x0049('0x5'));var jayson=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28c8d2,_0x57fca5,_0x18bff7){return new BPromise(function(_0xe091c4,_0x154219){return client['request'](_0x28c8d2,_0x18bff7)[_0x0049('0x9')](function(_0x3f2ca1){logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));logger[_0x0049('0xd')](_0x0049('0xe'),_0x57fca5,_0x0049('0xc'),JSON[_0x0049('0xf')](_0x3f2ca1));if(_0x3f2ca1['error']){if(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x11')]===0x1f4){logger[_0x0049('0x10')]('License,\x20%s,\x20%s',_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0x154219(_0x3f2ca1[_0x0049('0x10')][_0x0049('0x12')]);}logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x3f2ca1['error'][_0x0049('0x12')]);return _0xe091c4(_0x3f2ca1[_0x0049('0x10')]['message']);}else{logger[_0x0049('0xa')](_0x0049('0xb'),_0x57fca5,_0x0049('0xc'));_0xe091c4(_0x3f2ca1[_0x0049('0x13')]['message']);}})['catch'](function(_0x4315b5){logger[_0x0049('0x10')](_0x0049('0xb'),_0x57fca5,_0x4315b5);_0x154219(_0x4315b5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 9d6d246..18184dd 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 _0x9df5=['addSmtp','addInteraction','send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','/:id/users','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers'];(function(_0x428fc0,_0x497c13){var _0x4a201e=function(_0x429538){while(--_0x429538){_0x428fc0['push'](_0x428fc0['shift']());}};_0x4a201e(++_0x497c13);}(_0x9df5,0x9b));var _0x59df=function(_0x478f39,_0x393464){_0x478f39=_0x478f39-0x0;var _0x52aa13=_0x9df5[_0x478f39];return _0x52aa13;};'use strict';var multer=require(_0x59df('0x0'));var util=require(_0x59df('0x1'));var path=require(_0x59df('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59df('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x59df('0x4'));var config=require('../../config/environment');var controller=require(_0x59df('0x5'));router[_0x59df('0x6')]('/',auth[_0x59df('0x7')](),controller[_0x59df('0x8')]);router['get'](_0x59df('0x9'),auth[_0x59df('0x7')](),controller['describe']);router[_0x59df('0x6')](_0x59df('0xa'),auth[_0x59df('0x7')](),controller[_0x59df('0xb')]);router[_0x59df('0x6')](_0x59df('0xc'),auth[_0x59df('0x7')](),controller[_0x59df('0xd')]);router[_0x59df('0x6')](_0x59df('0xe'),auth['isAuthenticated'](),controller[_0x59df('0xf')]);router[_0x59df('0x6')](_0x59df('0x10'),auth[_0x59df('0x7')](),controller[_0x59df('0x11')]);router['get']('/:id/out_servers',auth[_0x59df('0x7')](),controller[_0x59df('0x12')]);router[_0x59df('0x6')](_0x59df('0x13'),auth[_0x59df('0x7')](),controller['getInteractions']);router[_0x59df('0x6')](_0x59df('0x14'),auth[_0x59df('0x7')](),controller[_0x59df('0x15')]);router[_0x59df('0x6')](_0x59df('0x16'),auth['isAuthenticated'](),controller[_0x59df('0x17')]);router[_0x59df('0x6')](_0x59df('0x18'),auth[_0x59df('0x7')](),controller[_0x59df('0x19')]);router[_0x59df('0x6')]('/:id/users',auth[_0x59df('0x7')](),controller[_0x59df('0x1a')]);router[_0x59df('0x1b')](_0x59df('0xc'),auth[_0x59df('0x7')](),controller[_0x59df('0x1c')]);router['post'](_0x59df('0xe'),auth['isAuthenticated'](),controller[_0x59df('0x1d')]);router[_0x59df('0x1b')]('/',auth['isAuthenticated'](),controller[_0x59df('0x1e')]);router['post'](_0x59df('0x10'),auth[_0x59df('0x7')](),controller[_0x59df('0x1f')]);router[_0x59df('0x1b')](_0x59df('0x20'),auth[_0x59df('0x7')](),controller[_0x59df('0x21')]);router[_0x59df('0x1b')]('/:id/interactions',auth[_0x59df('0x7')](),controller[_0x59df('0x22')]);router[_0x59df('0x1b')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x59df('0x1b')]('/:id/send',auth[_0x59df('0x7')](),controller[_0x59df('0x23')]);router[_0x59df('0x1b')]('/:id/users',auth[_0x59df('0x7')](),controller['addAgents']);router[_0x59df('0x24')]('/:id',auth[_0x59df('0x7')](),controller[_0x59df('0x25')]);router[_0x59df('0x26')]('/:id/dispositions',auth[_0x59df('0x7')](),controller[_0x59df('0x27')]);router[_0x59df('0x26')](_0x59df('0xe'),auth[_0x59df('0x7')](),controller[_0x59df('0x28')]);router['delete'](_0x59df('0x10'),auth[_0x59df('0x7')](),controller[_0x59df('0x29')]);router[_0x59df('0x26')](_0x59df('0x20'),auth['isAuthenticated'](),controller[_0x59df('0x2a')]);router[_0x59df('0x26')](_0x59df('0xa'),auth[_0x59df('0x7')](),controller[_0x59df('0x2b')]);router[_0x59df('0x26')](_0x59df('0x2c'),auth['isAuthenticated'](),controller[_0x59df('0x2d')]);module[_0x59df('0x2e')]=router; \ No newline at end of file +var _0x3432=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','create','/:id/in_servers','addImap','/:id/interactions','addApplications','/:id/send','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4d6510,_0x3a784d){var _0x5e407e=function(_0x48534f){while(--_0x48534f){_0x4d6510['push'](_0x4d6510['shift']());}};_0x5e407e(++_0x3a784d);}(_0x3432,0x182));var _0x2343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3432[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2343('0x0'));var util=require(_0x2343('0x1'));var path=require(_0x2343('0x2'));var timeout=require(_0x2343('0x3'));var express=require(_0x2343('0x4'));var router=express[_0x2343('0x5')]();var auth=require(_0x2343('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2343('0x7'));var controller=require('./mailAccount.controller');router[_0x2343('0x8')]('/',auth[_0x2343('0x9')](),controller['index']);router[_0x2343('0x8')](_0x2343('0xa'),auth[_0x2343('0x9')](),controller[_0x2343('0xb')]);router[_0x2343('0x8')](_0x2343('0xc'),auth[_0x2343('0x9')](),controller[_0x2343('0xd')]);router[_0x2343('0x8')](_0x2343('0xe'),auth[_0x2343('0x9')](),controller[_0x2343('0xf')]);router[_0x2343('0x8')](_0x2343('0x10'),auth[_0x2343('0x9')](),controller[_0x2343('0x11')]);router[_0x2343('0x8')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x2343('0x12')]);router[_0x2343('0x8')](_0x2343('0x13'),auth[_0x2343('0x9')](),controller[_0x2343('0x14')]);router[_0x2343('0x8')]('/:id/interactions',auth[_0x2343('0x9')](),controller[_0x2343('0x15')]);router[_0x2343('0x8')](_0x2343('0x16'),auth[_0x2343('0x9')](),controller[_0x2343('0x17')]);router[_0x2343('0x8')](_0x2343('0x18'),auth[_0x2343('0x9')](),controller[_0x2343('0x19')]);router[_0x2343('0x8')](_0x2343('0x1a'),auth[_0x2343('0x9')](),controller[_0x2343('0x1b')]);router[_0x2343('0x8')]('/:id/users',auth[_0x2343('0x9')](),controller[_0x2343('0x1c')]);router[_0x2343('0x1d')](_0x2343('0xe'),auth[_0x2343('0x9')](),controller['addDisposition']);router[_0x2343('0x1d')]('/:id/canned_answers',auth[_0x2343('0x9')](),controller['addAnswer']);router[_0x2343('0x1d')]('/',auth[_0x2343('0x9')](),controller[_0x2343('0x1e')]);router[_0x2343('0x1d')](_0x2343('0x1f'),auth[_0x2343('0x9')](),controller[_0x2343('0x20')]);router[_0x2343('0x1d')](_0x2343('0x13'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x2343('0x1d')](_0x2343('0x21'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x2343('0x1d')](_0x2343('0x16'),auth[_0x2343('0x9')](),controller[_0x2343('0x22')]);router['post'](_0x2343('0x23'),auth['isAuthenticated'](),controller[_0x2343('0x24')]);router[_0x2343('0x1d')](_0x2343('0x25'),auth[_0x2343('0x9')](),controller[_0x2343('0x26')]);router[_0x2343('0x27')](_0x2343('0xc'),auth['isAuthenticated'](),controller[_0x2343('0x28')]);router[_0x2343('0x29')](_0x2343('0xe'),auth[_0x2343('0x9')](),controller[_0x2343('0x2a')]);router[_0x2343('0x29')](_0x2343('0x10'),auth[_0x2343('0x9')](),controller[_0x2343('0x2b')]);router['delete'](_0x2343('0x1f'),auth[_0x2343('0x9')](),controller[_0x2343('0x2c')]);router[_0x2343('0x29')](_0x2343('0x13'),auth[_0x2343('0x9')](),controller[_0x2343('0x2d')]);router['delete'](_0x2343('0xc'),auth['isAuthenticated'](),controller[_0x2343('0x2e')]);router['delete'](_0x2343('0x25'),auth['isAuthenticated'](),controller[_0x2343('0x2f')]);module[_0x2343('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 920bf60..0e3033c 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 _0x54bd=['STRING','BOOLEAN','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x4fb551,_0x4dab29){var _0x1f99f5=function(_0x598b09){while(--_0x598b09){_0x4fb551['push'](_0x4fb551['shift']());}};_0x1f99f5(++_0x4dab29);}(_0x54bd,0x11f));var _0xd54b=function(_0x25c879,_0x4e2b80){_0x25c879=_0x25c879-0x0;var _0x3d3ec6=_0x54bd[_0x25c879];return _0x3d3ec6;};'use strict';var Sequelize=require('sequelize');module[_0xd54b('0x0')]={'description':{'type':Sequelize[_0xd54b('0x1')]},'name':{'type':Sequelize[_0xd54b('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd54b('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd54b('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd54b('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0xd54b('0x3')](0x2)[_0xd54b('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd54b('0x5')],'defaultValue':function(){return _0xd54b('0x6');}},'notificationSound':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd54b('0x3')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xd54b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xd54b('0x2')],'defaultValue':![],'comment':_0xd54b('0x8'),'set':function(_0x2c22a3){if(!_0x2c22a3)this[_0xd54b('0x9')](_0xd54b('0xa'),null);this[_0xd54b('0x9')](_0xd54b('0xb'),_0x2c22a3);}}}; \ No newline at end of file +var _0x1187=['exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x1187,0x178));var _0x7118=function(_0x2bb9b1,_0x2ac265){_0x2bb9b1=_0x2bb9b1-0x0;var _0x5d5dbb=_0x1187[_0x2bb9b1];return _0x5d5dbb;};'use strict';var Sequelize=require(_0x7118('0x0'));module[_0x7118('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x7118('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7118('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7118('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7118('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x7118('0x4')]},'markAsUnread':{'type':Sequelize[_0x7118('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7118('0x3')],'allowNull':![],'defaultValue':_0x7118('0x5')},'fontSize':{'type':Sequelize[_0x7118('0x6')](0x2)[_0x7118('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7118('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7118('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7118('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7118('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7118('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7118('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7118('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7118('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7118('0x2')],'defaultValue':![],'comment':_0x7118('0x9'),'set':function(_0x152928){if(!_0x152928)this[_0x7118('0xa')](_0x7118('0xb'),null);this[_0x7118('0xa')](_0x7118('0xc'),_0x152928);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f34f200..01f5c7c 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 _0x1e9b=['ListId','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','end','stack','send','index','MailServerIn','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','Imap','mandatoryDispositionPause','rawAttributes','filtears','catch','body','find','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','email','isNil','active','cauthentication','user','cuser','pass','authentication','host','port','service','cservice','password','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','nolimit','MailInteraction','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail'];(function(_0x212764,_0x1106f8){var _0x1c4cb7=function(_0x5db796){while(--_0x5db796){_0x212764['push'](_0x212764['shift']());}};_0x1c4cb7(++_0x1106f8);}(_0x1e9b,0xd5));var _0xb1e9=function(_0x179276,_0x487408){_0x179276=_0x179276-0x0;var _0x3d2123=_0x1e9b[_0x179276];return _0x3d2123;};'use strict';var pdf=require(_0xb1e9('0x0'));var emlformat=require(_0xb1e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb1e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1e9('0x3'));var moment=require(_0xb1e9('0x4'));var BPromise=require(_0xb1e9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb1e9('0x6'));var sox=require(_0xb1e9('0x7'));var csv=require(_0xb1e9('0x8'));var ejs=require(_0xb1e9('0x9'));var fs=require('fs');var _=require(_0xb1e9('0xa'));var squel=require(_0xb1e9('0xb'));var crypto=require(_0xb1e9('0xc'));var jsforce=require(_0xb1e9('0xd'));var deskjs=require(_0xb1e9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb1e9('0xf'));var Papa=require('papaparse');var Redis=require(_0xb1e9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1e9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb1e9('0x12'))(_0xb1e9('0x13'));var utils=require(_0xb1e9('0x14'));var config=require(_0xb1e9('0x15'));var licenseUtil=require(_0xb1e9('0x16'));var db=require(_0xb1e9('0x17'))['db'];config['redis']=_['defaults'](config[_0xb1e9('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb1e9('0x18')]));require(_0xb1e9('0x19'))[_0xb1e9('0x1a')](socket);var jayson=require(_0xb1e9('0x1b'));var client=jayson[_0xb1e9('0x1c')][_0xb1e9('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x5d5578,_0x3efa71,_0x4089e2,_0x3995fc){return new BPromise(function(_0x3ff3ad,_0x596de9){var _0x20e8dd=_0x3995fc||client;return _0x20e8dd['request'](_0x5d5578,_0x4089e2)[_0xb1e9('0x1e')](function(_0x4ba90f){logger[_0xb1e9('0x1f')](_0xb1e9('0x20'),_0x3efa71,_0xb1e9('0x21'));logger['debug'](_0xb1e9('0x22'),_0x3efa71,_0xb1e9('0x21'),JSON[_0xb1e9('0x23')](_0x4ba90f));if(_0x4ba90f[_0xb1e9('0x24')]){if(_0x4ba90f['error'][_0xb1e9('0x25')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x3efa71,_0x4ba90f[_0xb1e9('0x24')][_0xb1e9('0x26')]);return _0x596de9(_0x4ba90f[_0xb1e9('0x24')][_0xb1e9('0x26')]);}logger['error'](_0xb1e9('0x20'),_0x3efa71,_0x4ba90f[_0xb1e9('0x24')][_0xb1e9('0x26')]);return _0x3ff3ad(_0x4ba90f[_0xb1e9('0x24')][_0xb1e9('0x26')]);}else{logger[_0xb1e9('0x1f')]('MailAccount,\x20%s,\x20%s',_0x3efa71,_0xb1e9('0x21'));_0x3ff3ad(_0x4ba90f[_0xb1e9('0x27')][_0xb1e9('0x26')]);}})['catch'](function(_0x4d93a3){logger[_0xb1e9('0x24')](_0xb1e9('0x20'),_0x3efa71,_0x4d93a3);_0x596de9(_0x4d93a3);});});}function respondWithStatusCode(_0x382683,_0x12d8c2){_0x12d8c2=_0x12d8c2||0xcc;return function(_0x25c252){if(_0x25c252){return _0x382683[_0xb1e9('0x28')](_0x12d8c2);}return _0x382683[_0xb1e9('0x29')](_0x12d8c2)['end']();};}function respondWithResult(_0x162dcb,_0xa3d751){_0xa3d751=_0xa3d751||0xc8;return function(_0x20df06){if(_0x20df06){return _0x162dcb[_0xb1e9('0x29')](_0xa3d751)[_0xb1e9('0x2a')](_0x20df06);}};}function respondWithFilteredResult(_0x197447,_0x390f48){return function(_0x14a730){if(_0x14a730){var _0x214a21=_0x14a730[_0xb1e9('0x2b')],_0x2a0d46=_0x390f48[_0xb1e9('0x2c')],_0x3adf9d=_0x390f48[_0xb1e9('0x2c')]+_0x390f48[_0xb1e9('0x2d')],_0x30bb19;if(_0x3adf9d>=_0x214a21){_0x3adf9d=_0x214a21;_0x30bb19=0xc8;}else{_0x30bb19=0xce;}_0x197447[_0xb1e9('0x29')](_0x30bb19);return _0x197447[_0xb1e9('0x2e')](_0xb1e9('0x2f'),_0x2a0d46+'-'+_0x3adf9d+'/'+_0x214a21)[_0xb1e9('0x2a')](_0x14a730);}return null;};}function patchUpdates(_0x5532f3){return function(_0x271150){try{jsonpatch[_0xb1e9('0x30')](_0x271150,_0x5532f3,!![]);}catch(_0x461f2e){return BPromise[_0xb1e9('0x31')](_0x461f2e);}return _0x271150[_0xb1e9('0x32')]();};}function saveUpdates(_0x4a4ba4,_0x30da1e){return function(_0x752b65){if(_0x752b65){return _0x752b65[_0xb1e9('0x33')](_0x4a4ba4)[_0xb1e9('0x1e')](function(_0x4040da){return _0x4040da;});}return null;};}function removeEntity(_0x6f9702,_0x1f03cb){return function(_0x36620d){if(_0x36620d){return _0x36620d[_0xb1e9('0x34')]()['then'](function(){var _0x206bb4=_0x36620d[_0xb1e9('0x35')]({'plain':!![]});var _0x3091cd=_0xb1e9('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x3091cd,'resourceId':_0x206bb4['id']}})[_0xb1e9('0x1e')](function(){return _0x36620d;});})[_0xb1e9('0x1e')](function(){_0x6f9702[_0xb1e9('0x29')](0xcc)[_0xb1e9('0x37')]();});}};}function handleEntityNotFound(_0x32f7fc,_0x1ea954){return function(_0x36d14a){if(!_0x36d14a){_0x32f7fc['sendStatus'](0x194);}return _0x36d14a;};}function handleError(_0x9b245b,_0x152492){_0x152492=_0x152492||0x1f4;return function(_0x5c72fd){logger[_0xb1e9('0x24')](_0x5c72fd[_0xb1e9('0x38')]);if(_0x5c72fd['name']){delete _0x5c72fd['name'];}_0x9b245b[_0xb1e9('0x29')](_0x152492)[_0xb1e9('0x39')](_0x5c72fd);};}exports[_0xb1e9('0x3a')]=function(_0x2bdc27,_0x5d4d0d){var _0x4fafb3={'include':[{'model':db[_0xb1e9('0x3b')],'as':'Imap'},{'model':db[_0xb1e9('0x3c')],'as':_0xb1e9('0x3d')},{'model':db[_0xb1e9('0x3e')],'as':'mandatoryDispositionPause'}]},_0x591816={},_0x57571c={'count':0x0,'rows':[]};var _0x46a01b=_[_0xb1e9('0x3f')](db[_0xb1e9('0x40')]['rawAttributes'],function(_0xf25371){return{'name':_0xf25371[_0xb1e9('0x41')],'type':_0xf25371[_0xb1e9('0x42')][_0xb1e9('0x43')]};});_0x591816['model']=_[_0xb1e9('0x3f')](_0x46a01b,_0xb1e9('0x44'));_0x591816[_0xb1e9('0x45')]=_[_0xb1e9('0x46')](_0x2bdc27[_0xb1e9('0x45')]);_0x591816[_0xb1e9('0x47')]=_[_0xb1e9('0x48')](_0x591816[_0xb1e9('0x49')],_0x591816[_0xb1e9('0x45')]);_0x4fafb3[_0xb1e9('0x4a')]=_['intersection'](_0x591816['model'],qs[_0xb1e9('0x4b')](_0x2bdc27[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x4fafb3['attributes']=_0x4fafb3['attributes'][_0xb1e9('0x4c')]?_0x4fafb3['attributes']:_0x591816['model'];if(!_0x2bdc27['query']['hasOwnProperty']('nolimit')){_0x4fafb3['limit']=qs[_0xb1e9('0x2d')](_0x2bdc27['query'][_0xb1e9('0x2d')]);_0x4fafb3[_0xb1e9('0x2c')]=qs[_0xb1e9('0x2c')](_0x2bdc27['query'][_0xb1e9('0x2c')]);}_0x4fafb3['order']=qs[_0xb1e9('0x4d')](_0x2bdc27[_0xb1e9('0x45')][_0xb1e9('0x4d')]);_0x4fafb3[_0xb1e9('0x4e')]=qs['filters'](_[_0xb1e9('0x4f')](_0x2bdc27['query'],_0x591816[_0xb1e9('0x47')]),_0x46a01b);if(_0x2bdc27[_0xb1e9('0x45')]['filter']){_0x4fafb3[_0xb1e9('0x4e')]=_[_0xb1e9('0x50')](_0x4fafb3['where'],{'$or':_[_0xb1e9('0x3f')](_0x46a01b,function(_0x1d5678){if(_0x1d5678[_0xb1e9('0x42')]!=='VIRTUAL'){var _0x5a00f2={};_0x5a00f2[_0x1d5678[_0xb1e9('0x44')]]={'$like':'%'+_0x2bdc27[_0xb1e9('0x45')][_0xb1e9('0x51')]+'%'};return _0x5a00f2;}})});}_0x4fafb3=_[_0xb1e9('0x50')]({},_0x4fafb3,_0x2bdc27[_0xb1e9('0x52')]);var _0x1ffeac={'where':_0x4fafb3[_0xb1e9('0x4e')]};return db[_0xb1e9('0x40')][_0xb1e9('0x2b')](_0x1ffeac)[_0xb1e9('0x1e')](function(_0x5a169a){_0x57571c[_0xb1e9('0x2b')]=_0x5a169a;if(_0x2bdc27[_0xb1e9('0x45')][_0xb1e9('0x53')]){_0x4fafb3[_0xb1e9('0x54')]=[{'all':!![]}];}return db[_0xb1e9('0x40')][_0xb1e9('0x55')](_0x4fafb3);})[_0xb1e9('0x1e')](function(_0x6e7f2a){_0x57571c[_0xb1e9('0x56')]=_0x6e7f2a;return _0x57571c;})[_0xb1e9('0x1e')](respondWithFilteredResult(_0x5d4d0d,_0x4fafb3))['catch'](handleError(_0x5d4d0d,null));};exports[_0xb1e9('0x57')]=function(_0x4b1e27,_0x488516){var _0x57cb40={'raw':![],'where':{'id':_0x4b1e27[_0xb1e9('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xb1e9('0x59')},{'model':db[_0xb1e9('0x3c')],'as':_0xb1e9('0x3d')},{'model':db[_0xb1e9('0x3e')],'as':_0xb1e9('0x5a')}]},_0x3aaf1c={};_0x3aaf1c[_0xb1e9('0x49')]=_['keys'](db[_0xb1e9('0x40')][_0xb1e9('0x5b')]);_0x3aaf1c['query']=_[_0xb1e9('0x46')](_0x4b1e27['query']);_0x3aaf1c[_0xb1e9('0x5c')]=_[_0xb1e9('0x48')](_0x3aaf1c[_0xb1e9('0x49')],_0x3aaf1c[_0xb1e9('0x45')]);_0x57cb40[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x3aaf1c['model'],qs[_0xb1e9('0x4b')](_0x4b1e27[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x57cb40['attributes']=_0x57cb40[_0xb1e9('0x4a')]['length']?_0x57cb40[_0xb1e9('0x4a')]:_0x3aaf1c[_0xb1e9('0x49')];if(_0x4b1e27[_0xb1e9('0x45')]['includeAll']){_0x57cb40[_0xb1e9('0x54')]=[{'all':!![]}];}_0x57cb40=_[_0xb1e9('0x50')]({},_0x57cb40,_0x4b1e27['options']);return db['MailAccount']['find'](_0x57cb40)['then'](handleEntityNotFound(_0x488516,null))['then'](respondWithResult(_0x488516,null))[_0xb1e9('0x5d')](handleError(_0x488516,null));};exports[_0xb1e9('0x33')]=function(_0x575c81,_0x3110f6){if(_0x575c81[_0xb1e9('0x5e')]['id']){delete _0x575c81[_0xb1e9('0x5e')]['id'];}return db[_0xb1e9('0x40')][_0xb1e9('0x5f')]({'where':{'id':_0x575c81[_0xb1e9('0x58')]['id']},'include':[{'model':db[_0xb1e9('0x3b')],'as':_0xb1e9('0x59')},{'model':db[_0xb1e9('0x3c')],'as':'Smtp'},{'model':db[_0xb1e9('0x3e')],'as':_0xb1e9('0x5a')}]})[_0xb1e9('0x1e')](handleEntityNotFound(_0x3110f6,null))[_0xb1e9('0x1e')](saveUpdates(_0x575c81[_0xb1e9('0x5e')],null))['then'](function(_0xd4c6f4){if(_0xd4c6f4&&_0x575c81[_0xb1e9('0x5e')][_0xb1e9('0x59')]){return db['MailServerIn'][_0xb1e9('0x33')](_0x575c81[_0xb1e9('0x5e')]['Imap'],{'where':{'MailAccountId':_0xd4c6f4['id']}})[_0xb1e9('0x1e')](function(){return _0xd4c6f4;});}return _0xd4c6f4;})['then'](function(_0x5926fb){if(_0x5926fb&&_0x575c81[_0xb1e9('0x5e')][_0xb1e9('0x3d')]){return db[_0xb1e9('0x3c')][_0xb1e9('0x33')](_0x575c81[_0xb1e9('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x5926fb['id']}})[_0xb1e9('0x1e')](function(){return _0x5926fb;});}return _0x5926fb;})[_0xb1e9('0x1e')](respondWithResult(_0x3110f6,null))[_0xb1e9('0x5d')](handleError(_0x3110f6,null));};exports['describe']=function(_0x50f825,_0x4a0d01){return db[_0xb1e9('0x40')][_0xb1e9('0x60')]()[_0xb1e9('0x1e')](respondWithResult(_0x4a0d01,null))[_0xb1e9('0x5d')](handleError(_0x4a0d01,null));};exports[_0xb1e9('0x61')]=function(_0x564f81,_0x65016f,_0x548fc8){if(_0x564f81[_0xb1e9('0x5e')]['id']){delete _0x564f81['body']['id'];}return db[_0xb1e9('0x40')][_0xb1e9('0x5f')]({'where':{'id':_0x564f81[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x65016f,null))[_0xb1e9('0x1e')](function(_0x3ff64){if(_0x3ff64){_0x564f81[_0xb1e9('0x5e')][_0xb1e9('0x62')]=_0x3ff64['id'];return db[_0xb1e9('0x63')][_0xb1e9('0x64')](_0x564f81[_0xb1e9('0x5e')]);}})[_0xb1e9('0x1e')](respondWithResult(_0x65016f,null))[_0xb1e9('0x5d')](handleError(_0x65016f,null));};exports[_0xb1e9('0x65')]=function(_0x46a8d1,_0x399d04,_0x5f0167){var _0x2e6751={'raw':![],'where':{}};var _0x679e23={};var _0xf87a6c={'count':0x0,'rows':[]};return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x46a8d1['params']['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x399d04,null))['then'](function(_0x58fea6){if(_0x58fea6){_0x679e23['model']=_[_0xb1e9('0x46')](db[_0xb1e9('0x63')][_0xb1e9('0x5b')]);_0x679e23['query']=_[_0xb1e9('0x46')](_0x46a8d1[_0xb1e9('0x45')]);_0x679e23[_0xb1e9('0x47')]=_[_0xb1e9('0x48')](_0x679e23[_0xb1e9('0x49')],_0x679e23[_0xb1e9('0x45')]);_0x2e6751[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x679e23[_0xb1e9('0x49')],qs[_0xb1e9('0x4b')](_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x2e6751[_0xb1e9('0x4a')]=_0x2e6751[_0xb1e9('0x4a')][_0xb1e9('0x4c')]?_0x2e6751[_0xb1e9('0x4a')]:_0x679e23[_0xb1e9('0x49')];if(!_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x67')]('nolimit')){_0x2e6751[_0xb1e9('0x2d')]=qs['limit'](_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x2e6751[_0xb1e9('0x2c')]=qs[_0xb1e9('0x2c')](_0x46a8d1[_0xb1e9('0x45')]['offset']);}_0x2e6751[_0xb1e9('0x68')]=qs[_0xb1e9('0x4d')](_0x46a8d1['query'][_0xb1e9('0x4d')]);_0x2e6751[_0xb1e9('0x4e')]=qs[_0xb1e9('0x47')](_[_0xb1e9('0x4f')](_0x46a8d1['query'],_0x679e23[_0xb1e9('0x47')]));_0x2e6751[_0xb1e9('0x4e')][_0xb1e9('0x62')]=_0x58fea6['id'];if(_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x51')]){_0x2e6751['where']=_['merge'](_0x2e6751[_0xb1e9('0x4e')],{'$or':_[_0xb1e9('0x3f')](_0x2e6751[_0xb1e9('0x4a')],function(_0xbb86d0){var _0x379030={};_0x379030[_0xbb86d0]={'$like':'%'+_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x51')]+'%'};return _0x379030;})});}_0x2e6751=_['merge']({},_0x2e6751,_0x46a8d1[_0xb1e9('0x52')]);return db[_0xb1e9('0x63')]['count']({'where':_0x2e6751[_0xb1e9('0x4e')]})[_0xb1e9('0x1e')](function(_0x40c470){_0xf87a6c[_0xb1e9('0x2b')]=_0x40c470;if(_0x46a8d1[_0xb1e9('0x45')][_0xb1e9('0x53')]){_0x2e6751[_0xb1e9('0x54')]=[{'all':!![]}];}return db[_0xb1e9('0x63')][_0xb1e9('0x55')](_0x2e6751);})['then'](function(_0x371854){_0xf87a6c[_0xb1e9('0x56')]=_0x371854;return _0xf87a6c;});}})['then'](respondWithFilteredResult(_0x399d04,_0x2e6751))[_0xb1e9('0x5d')](handleError(_0x399d04,null));};exports[_0xb1e9('0x69')]=function(_0x4b191f,_0x2ac23f,_0xf74a03){return db[_0xb1e9('0x40')][_0xb1e9('0x5f')]({'where':{'id':_0x4b191f[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x2ac23f,null))['then'](function(_0x51756a){if(_0x51756a){return _0x51756a['removeDispositions'](_0x4b191f['query']['ids']);}})[_0xb1e9('0x1e')](respondWithStatusCode(_0x2ac23f,null))['catch'](handleError(_0x2ac23f,null));};exports[_0xb1e9('0x6a')]=function(_0x2bd9f8,_0x11020b,_0xc64f95){if(_0x2bd9f8[_0xb1e9('0x5e')]['id']){delete _0x2bd9f8[_0xb1e9('0x5e')]['id'];}return db['MailAccount'][_0xb1e9('0x5f')]({'where':{'id':_0x2bd9f8['params']['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x11020b,null))[_0xb1e9('0x1e')](function(_0x1442d8){if(_0x1442d8){_0x2bd9f8[_0xb1e9('0x5e')][_0xb1e9('0x62')]=_0x1442d8['id'];return db[_0xb1e9('0x6b')][_0xb1e9('0x64')](_0x2bd9f8[_0xb1e9('0x5e')]);}})[_0xb1e9('0x1e')](respondWithResult(_0x11020b,null))[_0xb1e9('0x5d')](handleError(_0x11020b,null));};exports[_0xb1e9('0x6c')]=function(_0x224acd,_0x1dfcca,_0x2798d0){var _0x24b3d7={'raw':![],'where':{}};var _0x310b75={};var _0x23e7a5={'count':0x0,'rows':[]};return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x224acd[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x1dfcca,null))[_0xb1e9('0x1e')](function(_0x181ec9){if(_0x181ec9){_0x310b75[_0xb1e9('0x49')]=_[_0xb1e9('0x46')](db[_0xb1e9('0x6b')][_0xb1e9('0x5b')]);_0x310b75['query']=_[_0xb1e9('0x46')](_0x224acd[_0xb1e9('0x45')]);_0x310b75[_0xb1e9('0x47')]=_[_0xb1e9('0x48')](_0x310b75['model'],_0x310b75[_0xb1e9('0x45')]);_0x24b3d7[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x310b75[_0xb1e9('0x49')],qs['fields'](_0x224acd[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x24b3d7[_0xb1e9('0x4a')]=_0x24b3d7[_0xb1e9('0x4a')][_0xb1e9('0x4c')]?_0x24b3d7[_0xb1e9('0x4a')]:_0x310b75[_0xb1e9('0x49')];if(!_0x224acd['query']['hasOwnProperty']('nolimit')){_0x24b3d7[_0xb1e9('0x2d')]=qs[_0xb1e9('0x2d')](_0x224acd[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x24b3d7[_0xb1e9('0x2c')]=qs[_0xb1e9('0x2c')](_0x224acd[_0xb1e9('0x45')][_0xb1e9('0x2c')]);}_0x24b3d7[_0xb1e9('0x68')]=qs[_0xb1e9('0x4d')](_0x224acd[_0xb1e9('0x45')][_0xb1e9('0x4d')]);_0x24b3d7['where']=qs[_0xb1e9('0x47')](_[_0xb1e9('0x4f')](_0x224acd[_0xb1e9('0x45')],_0x310b75[_0xb1e9('0x47')]));_0x24b3d7[_0xb1e9('0x4e')]['MailAccountId']=_0x181ec9['id'];if(_0x224acd['query'][_0xb1e9('0x51')]){_0x24b3d7[_0xb1e9('0x4e')]=_['merge'](_0x24b3d7[_0xb1e9('0x4e')],{'$or':_[_0xb1e9('0x3f')](_0x24b3d7[_0xb1e9('0x4a')],function(_0x4c663b){var _0x26e25c={};_0x26e25c[_0x4c663b]={'$like':'%'+_0x224acd[_0xb1e9('0x45')][_0xb1e9('0x51')]+'%'};return _0x26e25c;})});}_0x24b3d7=_[_0xb1e9('0x50')]({},_0x24b3d7,_0x224acd['options']);return db[_0xb1e9('0x6b')][_0xb1e9('0x2b')]({'where':_0x24b3d7[_0xb1e9('0x4e')]})[_0xb1e9('0x1e')](function(_0x4b31b6){_0x23e7a5['count']=_0x4b31b6;if(_0x224acd['query'][_0xb1e9('0x53')]){_0x24b3d7[_0xb1e9('0x54')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x24b3d7);})['then'](function(_0x4f2800){_0x23e7a5[_0xb1e9('0x56')]=_0x4f2800;return _0x23e7a5;});}})[_0xb1e9('0x1e')](respondWithFilteredResult(_0x1dfcca,_0x24b3d7))[_0xb1e9('0x5d')](handleError(_0x1dfcca,null));};exports[_0xb1e9('0x6d')]=function(_0x3ab42c,_0x159a48,_0x48a09d){return db['MailAccount'][_0xb1e9('0x5f')]({'where':{'id':_0x3ab42c['params']['id']}})['then'](handleEntityNotFound(_0x159a48,null))[_0xb1e9('0x1e')](function(_0x332462){if(_0x332462){return _0x332462[_0xb1e9('0x6d')](_0x3ab42c[_0xb1e9('0x45')][_0xb1e9('0x6e')]);}})['then'](respondWithStatusCode(_0x159a48,null))[_0xb1e9('0x5d')](handleError(_0x159a48,null));};exports['create']=function(_0x25aee7,_0x553478){var _0x52953c={'name':_0x25aee7[_0xb1e9('0x5e')]['name'],'key':_0x25aee7[_0xb1e9('0x5e')]['key'],'email':_0x25aee7['body'][_0xb1e9('0x6f')],'ListId':_0x25aee7['body']['ListId'],'active':!_[_0xb1e9('0x70')](_0x25aee7['body'][_0xb1e9('0x71')])?_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x71')]:!![],'description':_0x25aee7[_0xb1e9('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xb1e9('0x70')](_0x25aee7[_0xb1e9('0x5e')]['cservice'])){if(_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x72')]){_0x52953c[_0xb1e9('0x59')][_0xb1e9('0x73')]=_0x52953c[_0xb1e9('0x3d')]['user']=_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x74')];_0x52953c[_0xb1e9('0x59')]['password']=_0x52953c[_0xb1e9('0x3d')][_0xb1e9('0x75')]=_0x25aee7[_0xb1e9('0x5e')]['cpassword'];}else{_0x52953c['Imap'][_0xb1e9('0x76')]=_0x52953c[_0xb1e9('0x3d')][_0xb1e9('0x76')]=![];}_0x52953c[_0xb1e9('0x59')][_0xb1e9('0x77')]=_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x59')][_0xb1e9('0x77')];_0x52953c[_0xb1e9('0x59')][_0xb1e9('0x78')]=_0x25aee7[_0xb1e9('0x5e')]['Imap'][_0xb1e9('0x78')];_0x52953c[_0xb1e9('0x3d')][_0xb1e9('0x77')]=_0x25aee7[_0xb1e9('0x5e')]['Smtp'][_0xb1e9('0x77')];_0x52953c[_0xb1e9('0x3d')]['port']=_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x3d')][_0xb1e9('0x78')];}else{_0x52953c[_0xb1e9('0x59')]['service']=_0x52953c[_0xb1e9('0x3d')][_0xb1e9('0x79')]=_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x7a')];_0x52953c['Imap'][_0xb1e9('0x73')]=_0x52953c[_0xb1e9('0x3d')]['user']=_0x25aee7[_0xb1e9('0x5e')][_0xb1e9('0x74')];_0x52953c[_0xb1e9('0x59')][_0xb1e9('0x7b')]=_0x52953c[_0xb1e9('0x3d')][_0xb1e9('0x75')]=_0x25aee7['body'][_0xb1e9('0x7c')];}return db[_0xb1e9('0x40')]['create'](_0x52953c,{'include':[{'model':db[_0xb1e9('0x3c')],'as':_0xb1e9('0x3d')},{'model':db[_0xb1e9('0x3b')],'as':'Imap'}]})[_0xb1e9('0x1e')](function(_0x36d95f){var _0x8f11f5=_0x25aee7[_0xb1e9('0x73')][_0xb1e9('0x35')]({'plain':!![]});if(!_0x8f11f5)throw new Error(_0xb1e9('0x7d'));if(_0x8f11f5[_0xb1e9('0x7e')]===_0xb1e9('0x73')){var _0x1e2281=_0x36d95f[_0xb1e9('0x35')]({'plain':!![]});return db[_0xb1e9('0x7f')][_0xb1e9('0x5f')]({'where':{'name':_0xb1e9('0x36'),'userProfileId':_0x8f11f5[_0xb1e9('0x80')]},'raw':!![]})['then'](function(_0x3a553f){if(_0x3a553f&&_0x3a553f[_0xb1e9('0x81')]===0x0){return db[_0xb1e9('0x82')][_0xb1e9('0x64')]({'name':_0x1e2281[_0xb1e9('0x44')],'resourceId':_0x1e2281['id'],'type':_0x3a553f[_0xb1e9('0x44')],'sectionId':_0x3a553f['id']},{})[_0xb1e9('0x1e')](function(){return _0x36d95f;});}else{return _0x36d95f;}})['catch'](function(_0x5acd76){logger['error'](_0xb1e9('0x83'),_0x5acd76);throw _0x5acd76;});}return _0x36d95f;})[_0xb1e9('0x1e')](respondWithResult(_0x553478,0xc9))['catch'](handleError(_0x553478,null));};exports[_0xb1e9('0x84')]=function(_0x3bc03b,_0x386337,_0x5626f3){return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x3bc03b[_0xb1e9('0x58')]['id']}})['then'](handleEntityNotFound(_0x386337,null))[_0xb1e9('0x1e')](function(_0x1c5c83){if(_0x1c5c83){return _0x1c5c83[_0xb1e9('0x84')]();}return null;})[_0xb1e9('0x1e')](respondWithResult(_0x386337,null))[_0xb1e9('0x5d')](handleError(_0x386337,null));};exports[_0xb1e9('0x85')]=function(_0x4f4fb4,_0x542e38,_0x57601a){if(_0x4f4fb4[_0xb1e9('0x5e')]['id']){delete _0x4f4fb4['body']['id'];}return db[_0xb1e9('0x40')]['find']({'where':{'id':_0x4f4fb4[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x542e38,null))[_0xb1e9('0x1e')](function(_0x372a46){if(_0x372a46){_0x4f4fb4[_0xb1e9('0x5e')]['MailAccountId']=_0x372a46['id'];return db[_0xb1e9('0x3b')][_0xb1e9('0x64')](_0x4f4fb4[_0xb1e9('0x5e')]);}})[_0xb1e9('0x1e')](respondWithResult(_0x542e38,null))['catch'](handleError(_0x542e38,null));};exports['removeImap']=function(_0x233763,_0xe0717e,_0x35a0c0){return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x233763[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0xe0717e,null))[_0xb1e9('0x1e')](function(_0x38b904){if(_0x38b904){return _0x38b904[_0xb1e9('0x86')](null);}return null;})['then'](respondWithStatusCode(_0xe0717e,null))[_0xb1e9('0x5d')](handleError(_0xe0717e,null));};exports[_0xb1e9('0x87')]=function(_0x61f063,_0x2b4b92,_0x376551){return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x61f063['params']['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x2b4b92,null))[_0xb1e9('0x1e')](function(_0xc96184){if(_0xc96184){return _0xc96184['getSmtp']();}return null;})[_0xb1e9('0x1e')](respondWithResult(_0x2b4b92,null))[_0xb1e9('0x5d')](handleError(_0x2b4b92,null));};exports[_0xb1e9('0x88')]=function(_0x3d5ef3,_0x34a7a6,_0x3b6eb3){if(_0x3d5ef3[_0xb1e9('0x5e')]['id']){delete _0x3d5ef3[_0xb1e9('0x5e')]['id'];}return db['MailAccount'][_0xb1e9('0x5f')]({'where':{'id':_0x3d5ef3[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x34a7a6,null))[_0xb1e9('0x1e')](function(_0x47a0d2){if(_0x47a0d2){_0x3d5ef3[_0xb1e9('0x5e')][_0xb1e9('0x62')]=_0x47a0d2['id'];return db[_0xb1e9('0x3c')]['create'](_0x3d5ef3['body']);}})[_0xb1e9('0x1e')](respondWithResult(_0x34a7a6,null))[_0xb1e9('0x5d')](handleError(_0x34a7a6,null));};exports[_0xb1e9('0x89')]=function(_0x3a0902,_0x5ad7bb,_0x1f1ba9){return db[_0xb1e9('0x40')]['findOne']({'where':{'id':_0x3a0902[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x5ad7bb,null))[_0xb1e9('0x1e')](function(_0x4e3bcc){if(_0x4e3bcc){return _0x4e3bcc['setSmtp'](null);}return null;})['then'](respondWithStatusCode(_0x5ad7bb,null))[_0xb1e9('0x5d')](handleError(_0x5ad7bb,null));};exports[_0xb1e9('0x8a')]=function(_0x13c2c9,_0x4a5daa,_0x5f4713){return db['MailInteraction'][_0xb1e9('0x5f')]({'where':{'id':_0x13c2c9['params']['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x4a5daa,null))[_0xb1e9('0x1e')](function(_0x4bcc16){if(_0x4bcc16){return _0x4bcc16[_0xb1e9('0x8a')](_0x13c2c9[_0xb1e9('0x5e')][_0xb1e9('0x6e')],_[_0xb1e9('0x8b')](_0x13c2c9[_0xb1e9('0x5e')],[_0xb1e9('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x4a5daa,null))[_0xb1e9('0x5d')](handleError(_0x4a5daa,null));};exports[_0xb1e9('0x8c')]=function(_0xe0d8dc,_0x4b8038,_0x1adb35){var _0x524b52={'raw':![],'where':{}};var _0xeec733={};var _0xfdb5ea={'count':0x0,'rows':[]};return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0xe0d8dc[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x4b8038,null))[_0xb1e9('0x1e')](function(_0x2b75bb){if(_0x2b75bb){_0xeec733['model']=_[_0xb1e9('0x46')](db['MailInteraction']['rawAttributes']);_0xeec733[_0xb1e9('0x45')]=_['keys'](_0xe0d8dc[_0xb1e9('0x45')]);_0xeec733[_0xb1e9('0x47')]=_['intersection'](_0xeec733['model'],_0xeec733[_0xb1e9('0x45')]);_0x524b52[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0xeec733[_0xb1e9('0x49')],qs[_0xb1e9('0x4b')](_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x524b52[_0xb1e9('0x4a')]=_0x524b52['attributes'][_0xb1e9('0x4c')]?_0x524b52[_0xb1e9('0x4a')]:_0xeec733[_0xb1e9('0x49')];if(!_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x67')](_0xb1e9('0x8d'))){_0x524b52['limit']=qs['limit'](_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x524b52[_0xb1e9('0x2c')]=qs[_0xb1e9('0x2c')](_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x2c')]);}_0x524b52['order']=qs[_0xb1e9('0x4d')](_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x4d')]);_0x524b52['where']=qs[_0xb1e9('0x47')](_[_0xb1e9('0x4f')](_0xe0d8dc[_0xb1e9('0x45')],_0xeec733[_0xb1e9('0x47')]));_0x524b52[_0xb1e9('0x4e')][_0xb1e9('0x62')]=_0x2b75bb['id'];if(_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x51')]){_0x524b52[_0xb1e9('0x4e')]=_[_0xb1e9('0x50')](_0x524b52[_0xb1e9('0x4e')],{'$or':_['map'](_0x524b52['attributes'],function(_0x6182e7){var _0x115bf9={};_0x115bf9[_0x6182e7]={'$like':'%'+_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x51')]+'%'};return _0x115bf9;})});}_0x524b52=_[_0xb1e9('0x50')]({},_0x524b52,_0xe0d8dc[_0xb1e9('0x52')]);return db[_0xb1e9('0x8e')][_0xb1e9('0x2b')]({'where':_0x524b52[_0xb1e9('0x4e')]})[_0xb1e9('0x1e')](function(_0x23055f){_0xfdb5ea[_0xb1e9('0x2b')]=_0x23055f;if(_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x53')]){_0x524b52[_0xb1e9('0x54')]=[{'model':db[_0xb1e9('0x8f')],'as':'Contact','required':![]},{'model':db[_0xb1e9('0x90')],'as':_0xb1e9('0x91'),'attributes':[_0xb1e9('0x44'),'fullname',_0xb1e9('0x92')],'required':![]},{'model':db[_0xb1e9('0x93')],'as':_0xb1e9('0x94'),'attributes':['id',_0xb1e9('0x44'),_0xb1e9('0x95')],'where':_0xe0d8dc['query']['tag']?{'id':_0xe0d8dc[_0xb1e9('0x45')]['tag']}:undefined,'required':_0xe0d8dc[_0xb1e9('0x45')][_0xb1e9('0x96')]?!![]:![]}];}return db['MailInteraction'][_0xb1e9('0x55')](_0x524b52);})['then'](function(_0x488883){_0xfdb5ea[_0xb1e9('0x56')]=_0x488883;return _0xfdb5ea;});}})[_0xb1e9('0x1e')](respondWithFilteredResult(_0x4b8038,_0x524b52))[_0xb1e9('0x5d')](handleError(_0x4b8038,null));};exports[_0xb1e9('0x97')]=function(_0x4a25ec,_0x507775,_0x47d1c5){return db['MailAccount'][_0xb1e9('0x66')]({'where':{'id':_0x4a25ec[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x507775,null))[_0xb1e9('0x1e')](function(_0x299ff9){if(_0x299ff9){return db[_0xb1e9('0x98')][_0xb1e9('0x99')](function(_0x291fd8){return db[_0xb1e9('0x9a')]['destroy']({'where':{'MailAccountId':_0x4a25ec['params']['id']},'transaction':_0x291fd8})['then'](function(_0x591c99){var _0x50d440=_[_0xb1e9('0x3f')](_0x4a25ec[_0xb1e9('0x5e')],function(_0x452a38){_0x452a38[_0xb1e9('0x62')]=_0x4a25ec['params']['id'];return _0x452a38;});return db[_0xb1e9('0x9a')]['bulkCreate'](_0x50d440,{'transaction':_0x291fd8});});})[_0xb1e9('0x1e')](function(){return db[_0xb1e9('0x9a')][_0xb1e9('0x9b')]({'where':{'MailAccountId':_0x4a25ec[_0xb1e9('0x58')]['id']},'order':'priority'});});}})[_0xb1e9('0x1e')](respondWithResult(_0x507775,null))[_0xb1e9('0x5d')](handleError(_0x507775,null));};exports[_0xb1e9('0x9c')]=function(_0x781d16,_0x44ca7f,_0x109690){var _0x1228d2={};var _0x185a16={};var _0x1ef699;var _0x1dd075;return db['MailAccount'][_0xb1e9('0x66')]({'where':{'id':_0x781d16[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x44ca7f,null))['then'](function(_0x159500){if(_0x159500){_0x1ef699=_0x159500;_0x185a16[_0xb1e9('0x49')]=_[_0xb1e9('0x46')](db[_0xb1e9('0x9a')][_0xb1e9('0x5b')]);_0x185a16[_0xb1e9('0x45')]=_[_0xb1e9('0x46')](_0x781d16[_0xb1e9('0x45')]);_0x185a16[_0xb1e9('0x47')]=_[_0xb1e9('0x48')](_0x185a16[_0xb1e9('0x49')],_0x185a16[_0xb1e9('0x45')]);_0x1228d2[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x185a16[_0xb1e9('0x49')],qs[_0xb1e9('0x4b')](_0x781d16['query'][_0xb1e9('0x4b')]));_0x1228d2[_0xb1e9('0x4a')]=_0x1228d2['attributes'][_0xb1e9('0x4c')]?_0x1228d2[_0xb1e9('0x4a')]:_0x185a16['model'];_0x1228d2[_0xb1e9('0x68')]=qs[_0xb1e9('0x4d')](_0x781d16['query'][_0xb1e9('0x4d')]);_0x1228d2[_0xb1e9('0x4e')]=qs['filters'](_[_0xb1e9('0x4f')](_0x781d16[_0xb1e9('0x45')],_0x185a16[_0xb1e9('0x47')]));if(_0x781d16[_0xb1e9('0x45')][_0xb1e9('0x51')]){_0x1228d2['where']=_[_0xb1e9('0x50')](_0x1228d2[_0xb1e9('0x4e')],{'$or':_[_0xb1e9('0x3f')](_0x1228d2['attributes'],function(_0x22b40a){var _0x2669f6={};_0x2669f6[_0x22b40a]={'$like':'%'+_0x781d16['query']['filter']+'%'};return _0x2669f6;})});}_0x1228d2=_[_0xb1e9('0x50')]({},_0x1228d2,_0x781d16[_0xb1e9('0x52')]);return _0x1ef699['getApplications'](_0x1228d2);}})[_0xb1e9('0x1e')](function(_0x553e99){if(_0x553e99){_0x1dd075=_0x553e99[_0xb1e9('0x4c')];if(!_0x781d16[_0xb1e9('0x45')]['hasOwnProperty'](_0xb1e9('0x8d'))){_0x1228d2[_0xb1e9('0x2d')]=qs[_0xb1e9('0x2d')](_0x781d16[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x1228d2['offset']=qs[_0xb1e9('0x2c')](_0x781d16[_0xb1e9('0x45')][_0xb1e9('0x2c')]);}return _0x1ef699[_0xb1e9('0x9c')](_0x1228d2);}})['then'](function(_0x18f416){if(_0x18f416){return _0x18f416?{'count':_0x1dd075,'rows':_0x18f416}:null;}})['then'](respondWithResult(_0x44ca7f,null))[_0xb1e9('0x5d')](handleError(_0x44ca7f,null));};exports[_0xb1e9('0x9d')]=function(_0x53237f,_0x292c31,_0xf6aa1e){var _0x4364aa={'raw':!![],'where':{}};var _0x38ca92={};var _0x41e2db={'count':0x0,'rows':[]};return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x53237f[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x292c31,null))[_0xb1e9('0x1e')](function(_0x2e81ef){if(_0x2e81ef){_0x38ca92[_0xb1e9('0x49')]=_[_0xb1e9('0x46')](db[_0xb1e9('0x9e')][_0xb1e9('0x5b')]);_0x38ca92[_0xb1e9('0x45')]=_['keys'](_0x53237f['query']);_0x38ca92[_0xb1e9('0x47')]=_['intersection'](_0x38ca92[_0xb1e9('0x49')],_0x38ca92[_0xb1e9('0x45')]);_0x4364aa[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x38ca92[_0xb1e9('0x49')],qs[_0xb1e9('0x4b')](_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x4b')]));_0x4364aa[_0xb1e9('0x4a')]=_0x4364aa['attributes']['length']?_0x4364aa[_0xb1e9('0x4a')]:_0x38ca92[_0xb1e9('0x49')];if(!_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x67')](_0xb1e9('0x8d'))){_0x4364aa[_0xb1e9('0x2d')]=qs['limit'](_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x4364aa[_0xb1e9('0x2c')]=qs[_0xb1e9('0x2c')](_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x2c')]);}_0x4364aa[_0xb1e9('0x68')]=qs[_0xb1e9('0x4d')](_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x4d')]);_0x4364aa[_0xb1e9('0x4e')]=qs[_0xb1e9('0x47')](_[_0xb1e9('0x4f')](_0x53237f[_0xb1e9('0x45')],_0x38ca92['filters']));_0x4364aa[_0xb1e9('0x4e')]['MailAccountId']=_0x2e81ef['id'];if(_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x51')]){_0x4364aa[_0xb1e9('0x4e')]=_[_0xb1e9('0x50')](_0x4364aa[_0xb1e9('0x4e')],{'$or':_[_0xb1e9('0x3f')](_0x4364aa['attributes'],function(_0x50afe2){var _0x1a3ff9={};_0x1a3ff9[_0x50afe2]={'$like':'%'+_0x53237f['query'][_0xb1e9('0x51')]+'%'};return _0x1a3ff9;})});}if(_0x53237f[_0xb1e9('0x45')][_0xb1e9('0x9f')]){var _0x1ef61f=_0x53237f[_0xb1e9('0x45')]['$gte'][_0xb1e9('0xa0')](',');var _0x288717={};_0x288717[_0x1ef61f[0x0]]={'$gte':moment(_0x1ef61f[0x1])[_0xb1e9('0xa1')](_0xb1e9('0xa2'))};_0x4364aa[_0xb1e9('0x4e')]=_[_0xb1e9('0x50')](_0x4364aa[_0xb1e9('0x4e')],_0x288717);}_0x4364aa=_[_0xb1e9('0x50')]({},_0x4364aa,_0x53237f[_0xb1e9('0x52')]);return db['MailMessage'][_0xb1e9('0x2b')]({'where':_0x4364aa[_0xb1e9('0x4e')]})[_0xb1e9('0x1e')](function(_0x5de4bd){_0x41e2db[_0xb1e9('0x2b')]=_0x5de4bd;if(_0x53237f['query'][_0xb1e9('0x53')]){_0x4364aa[_0xb1e9('0x54')]=[{'all':!![]}];}return db[_0xb1e9('0x9e')]['findAll'](_0x4364aa);})[_0xb1e9('0x1e')](function(_0xd47e85){_0x41e2db['rows']=_0xd47e85;return _0x41e2db;});}})[_0xb1e9('0x1e')](respondWithFilteredResult(_0x292c31,_0x4364aa))[_0xb1e9('0x5d')](handleError(_0x292c31,null));};exports[_0xb1e9('0x39')]=function(_0x27c28d,_0x4fd0ad,_0x5b624d){var _0x11f64b,_0x52d38d={},_0x112a43;if(_0x27c28d[_0xb1e9('0x5e')]['to']){_0x112a43=_0x27c28d[_0xb1e9('0x5e')]['to'][_0xb1e9('0xa0')](',')[0x0];}return db[_0xb1e9('0x40')]['find']({'where':{'id':_0x27c28d[_0xb1e9('0x58')]['id']},'include':[{'model':db[_0xb1e9('0xa3')],'as':_0xb1e9('0xa4'),'include':[{'model':db['CmContact'],'as':_0xb1e9('0xa5'),'where':{'email':_0x112a43},'limit':0x1,'order':[[_0xb1e9('0xa6'),_0xb1e9('0xa7')]]}]},{'model':db[_0xb1e9('0x3c')],'as':_0xb1e9('0x3d'),'raw':!![]}]})[_0xb1e9('0x1e')](handleEntityNotFound(_0x4fd0ad,null))['then'](function(_0x1c6ea8){if(_0x1c6ea8){_0x11f64b=_0x1c6ea8;if(_0x1c6ea8[_0xb1e9('0x3d')]){if(_[_0xb1e9('0x70')](_0x27c28d['body'][_0xb1e9('0xa8')])){_0x27c28d['body'][_0xb1e9('0xa8')]=util[_0xb1e9('0xa1')](_0xb1e9('0xa9'),_0x1c6ea8[_0xb1e9('0x44')],_0x1c6ea8['email']||_0x1c6ea8['Smtp'][_0xb1e9('0x73')]);}if(_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xaa')]&&_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xaa')][_0xb1e9('0x4c')]){for(var _0x492216=0x0;_0x492216<_0x27c28d[_0xb1e9('0x5e')]['attachments'][_0xb1e9('0x4c')];_0x492216+=0x1){_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xaa')][_0x492216]={'filename':_0x27c28d['body'][_0xb1e9('0xaa')][_0x492216]['name'],'path':path[_0xb1e9('0xab')](config[_0xb1e9('0xac')],_0xb1e9('0xad'),_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xaa')][_0x492216][_0xb1e9('0xae')])};}}var _0xb87766={'tls':{'rejectUnauthorized':![]}};if(_[_0xb1e9('0x70')](_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x79')])){if(_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x76')]){_0xb87766[_0xb1e9('0xaf')]={'user':_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x73')],'pass':_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x75')]};}_0xb87766['host']=_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x77')];_0xb87766[_0xb1e9('0x78')]=_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x78')];_0xb87766[_0xb1e9('0xb0')]=_0x1c6ea8[_0xb1e9('0x3d')]['secure'];}else{_0xb87766[_0xb1e9('0x79')]=_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x79')];_0xb87766[_0xb1e9('0xaf')]={'user':_0x1c6ea8['Smtp'][_0xb1e9('0x73')],'pass':_0x1c6ea8[_0xb1e9('0x3d')][_0xb1e9('0x75')]};}return respondWithRpcPromise(_0xb1e9('0xb1'),_0xb1e9('0xb2'),{'account':_0xb87766,'message':_0x27c28d[_0xb1e9('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x3e7c09){if(_0x3e7c09){_0x52d38d=_0x3e7c09;if(_0x11f64b[_0xb1e9('0xa4')]){if(_0x11f64b[_0xb1e9('0xa4')][_0xb1e9('0xa5')][_0xb1e9('0x4c')]){return _0x11f64b[_0xb1e9('0xa4')][_0xb1e9('0xa5')][0x0];}else{return db[_0xb1e9('0x8f')]['create'](_['defaults'](_0x27c28d[_0xb1e9('0x5e')],{'firstName':_0x27c28d['body']['to'],'email':_0x27c28d[_0xb1e9('0x5e')]['to'],'phone':_0x27c28d['body']['to'],'ListId':_0x11f64b[_0xb1e9('0xb3')]}));}}else{throw new Error(_0xb1e9('0xb4'));}}})[_0xb1e9('0x1e')](function(_0x21353f){if(_0x21353f){var _0xd7c058={'UserId':_0x27c28d[_0xb1e9('0x73')]['id'],'ContactId':_0x21353f['id'],'MailAccountId':_0x11f64b['id'],'inReplyTo':_0x52d38d[_0xb1e9('0xb5')],'to':_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xa8')],'cc':_0x27c28d[_0xb1e9('0x5e')]['cc'],'subject':_0x27c28d['body'][_0xb1e9('0xb6')],'attach':_0x27c28d[_0xb1e9('0x5e')]['attach'],'firstMsgDirection':_0xb1e9('0xb7'),'lastMsgAt':moment()['format'](_0xb1e9('0xa2')),'lastMsgDirection':_0xb1e9('0xb7'),'lastMsgBody':_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0x5e')],'Messages':[_['merge'](_0x27c28d[_0xb1e9('0x5e')],{'messageId':_0x52d38d[_0xb1e9('0xb5')],'sentAt':moment()[_0xb1e9('0xa1')](_0xb1e9('0xa2')),'read':!![],'MailAccountId':_0x11f64b['id'],'UserId':_0x27c28d[_0xb1e9('0x73')]['id'],'ContactId':_0x21353f['id']})]};if(_0x27c28d[_0xb1e9('0x5e')][_0xb1e9('0xb8')]){_0xd7c058=_['merge'](_0xd7c058,_0x27c28d['body'][_0xb1e9('0xb8')]);}return db[_0xb1e9('0x8e')][_0xb1e9('0x64')](_0xd7c058,{'include':[{'model':db[_0xb1e9('0x9e')],'as':'Messages'}]});}})[_0xb1e9('0x1e')](respondWithResult(_0x4fd0ad,null))[_0xb1e9('0x5d')](handleError(_0x4fd0ad,null));};exports[_0xb1e9('0xb9')]=function(_0x36c71d,_0x28c7b2,_0x1edfcb){return db[_0xb1e9('0x40')][_0xb1e9('0x5f')]({'where':{'id':_0x36c71d[_0xb1e9('0x58')]['id']},'include':[{'model':db[_0xb1e9('0x3c')],'as':_0xb1e9('0x3d'),'raw':!![]}]})[_0xb1e9('0x1e')](handleEntityNotFound(_0x28c7b2,null))[_0xb1e9('0x1e')](function(_0x30f974){if(_0x30f974&&_0x30f974['Smtp']){var _0x42327f={'id':_0x30f974['id'],'tls':{'rejectUnauthorized':![]}};if(_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x79')]){_0x42327f[_0xb1e9('0x79')]=_0x30f974['Smtp'][_0xb1e9('0x79')];}else{_0x42327f[_0xb1e9('0x77')]=_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x77')];_0x42327f['port']=_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x78')];_0x42327f[_0xb1e9('0xb0')]=_0x30f974['Smtp'][_0xb1e9('0xb0')];}if(_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x76')]){_0x42327f[_0xb1e9('0xaf')]={'user':_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x73')],'pass':_0x30f974[_0xb1e9('0x3d')][_0xb1e9('0x75')]};}return respondWithRpcPromise(_0xb1e9('0xba'),'verifySmtp',{'account':_0x42327f});}})[_0xb1e9('0x1e')](respondWithResult(_0x28c7b2,null))[_0xb1e9('0x5d')](handleError(_0x28c7b2,null));};exports[_0xb1e9('0x34')]=function(_0x3d275a,_0x5dd8b6){return db[_0xb1e9('0x40')]['find']({'where':{'id':_0x3d275a[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x5dd8b6,null))[_0xb1e9('0x1e')](function(_0x146db7){if(_0x146db7&&_0x146db7[_0xb1e9('0x79')]){throw new db['Sequelize'][(_0xb1e9('0xbb'))](_0xb1e9('0xbc'));}return _0x146db7;})[_0xb1e9('0x1e')](removeEntity(_0x5dd8b6,null))[_0xb1e9('0x5d')](handleError(_0x5dd8b6,null));};exports['addAgents']=function(_0x35da9d,_0x110372,_0x558587){return db['MailAccount'][_0xb1e9('0x5f')]({'where':{'id':_0x35da9d[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x110372,null))['then'](function(_0x22a88e){if(_0x22a88e){return _0x22a88e['addAgents'](_0x35da9d[_0xb1e9('0x5e')][_0xb1e9('0x6e')],_[_0xb1e9('0x8b')](_0x35da9d[_0xb1e9('0x5e')],['ids','id'])||{})[_0xb1e9('0xbd')](function(_0x5e1510){for(var _0x811a79=0x0;_0x811a79<_0x35da9d['body']['ids'][_0xb1e9('0x4c')];_0x811a79+=0x1){socket[_0xb1e9('0xbe')](_0xb1e9('0xbf'),{'UserId':_0x35da9d['body']['ids'][_0x811a79],'MailAccountId':_0x35da9d[_0xb1e9('0x58')]['id']});}return _0x5e1510;});}})[_0xb1e9('0x1e')](respondWithResult(_0x110372,null))['catch'](handleError(_0x110372,null));};exports[_0xb1e9('0xc0')]=function(_0x2db9b4,_0x2b0549,_0x46f001){return db['MailAccount'][_0xb1e9('0x5f')]({'where':{'id':_0x2db9b4['params']['id']}})['then'](handleEntityNotFound(_0x2b0549,null))[_0xb1e9('0x1e')](function(_0x478566){if(_0x478566){return _0x478566[_0xb1e9('0xc0')](_0x2db9b4['query'][_0xb1e9('0x6e')])[_0xb1e9('0x1e')](function(){if(_[_0xb1e9('0xc1')](_0x2db9b4['query']['ids'])){for(var _0xbda003=0x0;_0xbda003<_0x2db9b4[_0xb1e9('0x45')]['ids']['length'];_0xbda003+=0x1){socket['emit'](_0xb1e9('0xc2'),{'UserId':Number(_0x2db9b4[_0xb1e9('0x45')]['ids'][_0xbda003]),'MailAccountId':Number(_0x2db9b4['params']['id'])});}}else{socket[_0xb1e9('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x2db9b4[_0xb1e9('0x45')]['ids']),'MailAccountId':Number(_0x2db9b4[_0xb1e9('0x58')]['id'])});}});}})[_0xb1e9('0x1e')](respondWithStatusCode(_0x2b0549,null))[_0xb1e9('0x5d')](handleError(_0x2b0549,null));};exports['getAgents']=function(_0x2f31c4,_0x1658cb,_0x4e516e){var _0x12d221={};var _0x17cac4={};var _0x14dccc;var _0x3c7c16;return db[_0xb1e9('0x40')][_0xb1e9('0x66')]({'where':{'id':_0x2f31c4[_0xb1e9('0x58')]['id']}})[_0xb1e9('0x1e')](handleEntityNotFound(_0x1658cb,null))[_0xb1e9('0x1e')](function(_0xb4743b){if(_0xb4743b){_0x14dccc=_0xb4743b;_0x17cac4['model']=_[_0xb1e9('0x46')](db[_0xb1e9('0x90')]['rawAttributes']);_0x17cac4[_0xb1e9('0x45')]=_[_0xb1e9('0x46')](_0x2f31c4['query']);_0x17cac4[_0xb1e9('0x47')]=_[_0xb1e9('0x48')](_0x17cac4['model'],_0x17cac4[_0xb1e9('0x45')]);_0x12d221[_0xb1e9('0x4a')]=_[_0xb1e9('0x48')](_0x17cac4['model'],qs[_0xb1e9('0x4b')](_0x2f31c4[_0xb1e9('0x45')]['fields']));_0x12d221[_0xb1e9('0x4a')]=_0x12d221[_0xb1e9('0x4a')][_0xb1e9('0x4c')]?_0x12d221[_0xb1e9('0x4a')]:_0x17cac4[_0xb1e9('0x49')];_0x12d221['order']=qs[_0xb1e9('0x4d')](_0x2f31c4['query']['sort']);_0x12d221[_0xb1e9('0x4e')]=qs[_0xb1e9('0x47')](_[_0xb1e9('0x4f')](_0x2f31c4[_0xb1e9('0x45')],_0x17cac4['filters']));if(_0x2f31c4['query'][_0xb1e9('0x51')]){_0x12d221[_0xb1e9('0x4e')]=_['merge'](_0x12d221[_0xb1e9('0x4e')],{'$or':_['map'](_0x12d221[_0xb1e9('0x4a')],function(_0x4b291d){var _0xd40e34={};_0xd40e34[_0x4b291d]={'$like':'%'+_0x2f31c4[_0xb1e9('0x45')][_0xb1e9('0x51')]+'%'};return _0xd40e34;})});}_0x12d221=_[_0xb1e9('0x50')]({},_0x12d221,_0x2f31c4['options']);return _0x14dccc[_0xb1e9('0xc3')](_0x12d221);}})[_0xb1e9('0x1e')](function(_0x3f272c){if(_0x3f272c){_0x3c7c16=_0x3f272c[_0xb1e9('0x4c')];if(!_0x2f31c4[_0xb1e9('0x45')][_0xb1e9('0x67')]('nolimit')){_0x12d221[_0xb1e9('0x2d')]=qs[_0xb1e9('0x2d')](_0x2f31c4[_0xb1e9('0x45')][_0xb1e9('0x2d')]);_0x12d221[_0xb1e9('0x2c')]=qs['offset'](_0x2f31c4[_0xb1e9('0x45')][_0xb1e9('0x2c')]);}return _0x14dccc[_0xb1e9('0xc3')](_0x12d221);}})['then'](function(_0x3ab5d4){if(_0x3ab5d4){return _0x3ab5d4?{'count':_0x3c7c16,'rows':_0x3ab5d4}:null;}})[_0xb1e9('0x1e')](respondWithResult(_0x1658cb,null))[_0xb1e9('0x5d')](handleError(_0x1658cb,null));}; \ No newline at end of file +var _0x1bc6=['Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','MailApplication','bulkCreate','priority','getMessages','MailMessage','$gte','split','format','send','CmList','Contacts','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','addAgents','omit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','get','MailAccounts','sendStatus','stack','name','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','filtears','find','body','MailServerIn','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','include','removeAnswers','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','pick','CmContact'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x1bc6,0xf0));var _0x61bc=function(_0x47dbb7,_0x380958){_0x47dbb7=_0x47dbb7-0x0;var _0x26a32e=_0x1bc6[_0x47dbb7];return _0x26a32e;};'use strict';var pdf=require(_0x61bc('0x0'));var emlformat=require(_0x61bc('0x1'));var rimraf=require(_0x61bc('0x2'));var zipdir=require(_0x61bc('0x3'));var jsonpatch=require(_0x61bc('0x4'));var rp=require(_0x61bc('0x5'));var moment=require(_0x61bc('0x6'));var BPromise=require(_0x61bc('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x61bc('0x8'));var csv=require(_0x61bc('0x9'));var ejs=require(_0x61bc('0xa'));var fs=require('fs');var _=require(_0x61bc('0xb'));var squel=require(_0x61bc('0xc'));var crypto=require(_0x61bc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x61bc('0xe'));var Papa=require(_0x61bc('0xf'));var Redis=require(_0x61bc('0x10'));var authService=require(_0x61bc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x61bc('0x12'));var logger=require(_0x61bc('0x13'))(_0x61bc('0x14'));var utils=require(_0x61bc('0x15'));var config=require(_0x61bc('0x16'));var licenseUtil=require(_0x61bc('0x17'));var db=require('../../mysqldb')['db'];config[_0x61bc('0x18')]=_['defaults'](config[_0x61bc('0x18')],{'host':_0x61bc('0x19'),'port':0x18eb});var socket=require(_0x61bc('0x1a'))(new Redis(config[_0x61bc('0x18')]));require(_0x61bc('0x1b'))[_0x61bc('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x12b29c,_0x479dfa,_0xdc2447,_0x1423c3){return new BPromise(function(_0x822903,_0x1043bd){var _0x57c56c=_0x1423c3||client;return _0x57c56c['request'](_0x12b29c,_0xdc2447)[_0x61bc('0x1d')](function(_0x33ad55){logger[_0x61bc('0x1e')](_0x61bc('0x1f'),_0x479dfa,_0x61bc('0x20'));logger[_0x61bc('0x21')](_0x61bc('0x22'),_0x479dfa,_0x61bc('0x20'),JSON[_0x61bc('0x23')](_0x33ad55));if(_0x33ad55['error']){if(_0x33ad55[_0x61bc('0x24')][_0x61bc('0x25')]===0x1f4){logger[_0x61bc('0x24')]('MailAccount,\x20%s,\x20%s',_0x479dfa,_0x33ad55[_0x61bc('0x24')][_0x61bc('0x26')]);return _0x1043bd(_0x33ad55[_0x61bc('0x24')]['message']);}logger[_0x61bc('0x24')](_0x61bc('0x1f'),_0x479dfa,_0x33ad55['error'][_0x61bc('0x26')]);return _0x822903(_0x33ad55[_0x61bc('0x24')]['message']);}else{logger[_0x61bc('0x1e')](_0x61bc('0x1f'),_0x479dfa,_0x61bc('0x20'));_0x822903(_0x33ad55['result'][_0x61bc('0x26')]);}})['catch'](function(_0x49ef8b){logger[_0x61bc('0x24')](_0x61bc('0x1f'),_0x479dfa,_0x49ef8b);_0x1043bd(_0x49ef8b);});});}function respondWithStatusCode(_0x2a4a63,_0x5dac0b){_0x5dac0b=_0x5dac0b||0xcc;return function(_0xb93b3f){if(_0xb93b3f){return _0x2a4a63['sendStatus'](_0x5dac0b);}return _0x2a4a63[_0x61bc('0x27')](_0x5dac0b)[_0x61bc('0x28')]();};}function respondWithResult(_0x418570,_0x10467d){_0x10467d=_0x10467d||0xc8;return function(_0x299eb5){if(_0x299eb5){return _0x418570[_0x61bc('0x27')](_0x10467d)[_0x61bc('0x29')](_0x299eb5);}};}function respondWithFilteredResult(_0x6cbb3b,_0x1a91b4){return function(_0x59287d){if(_0x59287d){var _0xacd674=_0x59287d[_0x61bc('0x2a')],_0x1f021c=_0x1a91b4[_0x61bc('0x2b')],_0x122ed1=_0x1a91b4[_0x61bc('0x2b')]+_0x1a91b4[_0x61bc('0x2c')],_0x112cac;if(_0x122ed1>=_0xacd674){_0x122ed1=_0xacd674;_0x112cac=0xc8;}else{_0x112cac=0xce;}_0x6cbb3b['status'](_0x112cac);return _0x6cbb3b[_0x61bc('0x2d')](_0x61bc('0x2e'),_0x1f021c+'-'+_0x122ed1+'/'+_0xacd674)[_0x61bc('0x29')](_0x59287d);}return null;};}function patchUpdates(_0x829caf){return function(_0x2d8756){try{jsonpatch['apply'](_0x2d8756,_0x829caf,!![]);}catch(_0x15196a){return BPromise[_0x61bc('0x2f')](_0x15196a);}return _0x2d8756[_0x61bc('0x30')]();};}function saveUpdates(_0x4101b7,_0xb0f8bf){return function(_0x67c083){if(_0x67c083){return _0x67c083[_0x61bc('0x31')](_0x4101b7)['then'](function(_0x2fad95){return _0x2fad95;});}return null;};}function removeEntity(_0xb816fd,_0xd48cb8){return function(_0x881a26){if(_0x881a26){return _0x881a26[_0x61bc('0x32')]()['then'](function(){var _0x2dd10b=_0x881a26[_0x61bc('0x33')]({'plain':!![]});var _0x1ecb97=_0x61bc('0x34');return db['UserProfileResource'][_0x61bc('0x32')]({'where':{'type':_0x1ecb97,'resourceId':_0x2dd10b['id']}})[_0x61bc('0x1d')](function(){return _0x881a26;});})[_0x61bc('0x1d')](function(){_0xb816fd['status'](0xcc)[_0x61bc('0x28')]();});}};}function handleEntityNotFound(_0x1ad752,_0x638ec){return function(_0x32c803){if(!_0x32c803){_0x1ad752[_0x61bc('0x35')](0x194);}return _0x32c803;};}function handleError(_0x38ba51,_0xe1a1c7){_0xe1a1c7=_0xe1a1c7||0x1f4;return function(_0x2111e0){logger[_0x61bc('0x24')](_0x2111e0[_0x61bc('0x36')]);if(_0x2111e0[_0x61bc('0x37')]){delete _0x2111e0['name'];}_0x38ba51['status'](_0xe1a1c7)['send'](_0x2111e0);};}exports['index']=function(_0xd58e3b,_0x109310){var _0x225ebf={'include':[{'model':db['MailServerIn'],'as':_0x61bc('0x38')},{'model':db[_0x61bc('0x39')],'as':_0x61bc('0x3a')},{'model':db[_0x61bc('0x3b')],'as':_0x61bc('0x3c')}]},_0x5af96d={},_0x4a5192={'count':0x0,'rows':[]};var _0x2e91eb=_[_0x61bc('0x3d')](db[_0x61bc('0x3e')]['rawAttributes'],function(_0x51745c){return{'name':_0x51745c[_0x61bc('0x3f')],'type':_0x51745c[_0x61bc('0x40')][_0x61bc('0x41')]};});_0x5af96d[_0x61bc('0x42')]=_['map'](_0x2e91eb,_0x61bc('0x37'));_0x5af96d[_0x61bc('0x43')]=_[_0x61bc('0x44')](_0xd58e3b[_0x61bc('0x43')]);_0x5af96d[_0x61bc('0x45')]=_[_0x61bc('0x46')](_0x5af96d[_0x61bc('0x42')],_0x5af96d['query']);_0x225ebf['attributes']=_[_0x61bc('0x46')](_0x5af96d['model'],qs['fields'](_0xd58e3b[_0x61bc('0x43')][_0x61bc('0x47')]));_0x225ebf[_0x61bc('0x48')]=_0x225ebf['attributes'][_0x61bc('0x49')]?_0x225ebf[_0x61bc('0x48')]:_0x5af96d[_0x61bc('0x42')];if(!_0xd58e3b[_0x61bc('0x43')][_0x61bc('0x4a')](_0x61bc('0x4b'))){_0x225ebf[_0x61bc('0x2c')]=qs[_0x61bc('0x2c')](_0xd58e3b[_0x61bc('0x43')][_0x61bc('0x2c')]);_0x225ebf['offset']=qs[_0x61bc('0x2b')](_0xd58e3b['query'][_0x61bc('0x2b')]);}_0x225ebf[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0xd58e3b['query']['sort']);_0x225ebf[_0x61bc('0x4e')]=qs[_0x61bc('0x45')](_['pick'](_0xd58e3b[_0x61bc('0x43')],_0x5af96d[_0x61bc('0x45')]),_0x2e91eb);if(_0xd58e3b[_0x61bc('0x43')][_0x61bc('0x4f')]){_0x225ebf[_0x61bc('0x4e')]=_[_0x61bc('0x50')](_0x225ebf[_0x61bc('0x4e')],{'$or':_['map'](_0x2e91eb,function(_0x2709cb){if(_0x2709cb[_0x61bc('0x40')]!==_0x61bc('0x51')){var _0x297df6={};_0x297df6[_0x2709cb[_0x61bc('0x37')]]={'$like':'%'+_0xd58e3b['query'][_0x61bc('0x4f')]+'%'};return _0x297df6;}})});}_0x225ebf=_[_0x61bc('0x50')]({},_0x225ebf,_0xd58e3b[_0x61bc('0x52')]);var _0x2482cd={'where':_0x225ebf[_0x61bc('0x4e')]};return db[_0x61bc('0x3e')][_0x61bc('0x2a')](_0x2482cd)[_0x61bc('0x1d')](function(_0x3741c2){_0x4a5192['count']=_0x3741c2;if(_0xd58e3b['query'][_0x61bc('0x53')]){_0x225ebf['include']=[{'all':!![]}];}return db[_0x61bc('0x3e')][_0x61bc('0x54')](_0x225ebf);})[_0x61bc('0x1d')](function(_0xe84916){_0x4a5192[_0x61bc('0x55')]=_0xe84916;return _0x4a5192;})['then'](respondWithFilteredResult(_0x109310,_0x225ebf))[_0x61bc('0x56')](handleError(_0x109310,null));};exports[_0x61bc('0x57')]=function(_0x56865c,_0x5f3f23){var _0x5d4c68={'raw':![],'where':{'id':_0x56865c[_0x61bc('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x61bc('0x38')},{'model':db['MailServerOut'],'as':_0x61bc('0x3a')},{'model':db[_0x61bc('0x3b')],'as':_0x61bc('0x3c')}]},_0x4b7d85={};_0x4b7d85[_0x61bc('0x42')]=_['keys'](db['MailAccount'][_0x61bc('0x59')]);_0x4b7d85['query']=_[_0x61bc('0x44')](_0x56865c[_0x61bc('0x43')]);_0x4b7d85[_0x61bc('0x5a')]=_[_0x61bc('0x46')](_0x4b7d85[_0x61bc('0x42')],_0x4b7d85[_0x61bc('0x43')]);_0x5d4c68['attributes']=_[_0x61bc('0x46')](_0x4b7d85[_0x61bc('0x42')],qs[_0x61bc('0x47')](_0x56865c[_0x61bc('0x43')][_0x61bc('0x47')]));_0x5d4c68[_0x61bc('0x48')]=_0x5d4c68['attributes'][_0x61bc('0x49')]?_0x5d4c68[_0x61bc('0x48')]:_0x4b7d85[_0x61bc('0x42')];if(_0x56865c[_0x61bc('0x43')]['includeAll']){_0x5d4c68['include']=[{'all':!![]}];}_0x5d4c68=_['merge']({},_0x5d4c68,_0x56865c[_0x61bc('0x52')]);return db['MailAccount'][_0x61bc('0x5b')](_0x5d4c68)[_0x61bc('0x1d')](handleEntityNotFound(_0x5f3f23,null))[_0x61bc('0x1d')](respondWithResult(_0x5f3f23,null))['catch'](handleError(_0x5f3f23,null));};exports[_0x61bc('0x31')]=function(_0x564d96,_0x509d6a){if(_0x564d96[_0x61bc('0x5c')]['id']){delete _0x564d96['body']['id'];}return db['MailAccount'][_0x61bc('0x5b')]({'where':{'id':_0x564d96[_0x61bc('0x58')]['id']},'include':[{'model':db[_0x61bc('0x5d')],'as':_0x61bc('0x38')},{'model':db[_0x61bc('0x39')],'as':_0x61bc('0x3a')},{'model':db[_0x61bc('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x61bc('0x1d')](handleEntityNotFound(_0x509d6a,null))['then'](saveUpdates(_0x564d96[_0x61bc('0x5c')],null))[_0x61bc('0x1d')](function(_0x49b59b){if(_0x49b59b&&_0x564d96[_0x61bc('0x5c')]['Imap']){return db['MailServerIn'][_0x61bc('0x31')](_0x564d96['body'][_0x61bc('0x38')],{'where':{'MailAccountId':_0x49b59b['id']}})[_0x61bc('0x1d')](function(){return _0x49b59b;});}return _0x49b59b;})[_0x61bc('0x1d')](function(_0x3129f5){if(_0x3129f5&&_0x564d96[_0x61bc('0x5c')][_0x61bc('0x3a')]){return db['MailServerOut'][_0x61bc('0x31')](_0x564d96[_0x61bc('0x5c')][_0x61bc('0x3a')],{'where':{'MailAccountId':_0x3129f5['id']}})[_0x61bc('0x1d')](function(){return _0x3129f5;});}return _0x3129f5;})[_0x61bc('0x1d')](respondWithResult(_0x509d6a,null))[_0x61bc('0x56')](handleError(_0x509d6a,null));};exports[_0x61bc('0x5e')]=function(_0x8495c5,_0x24f716){return db[_0x61bc('0x3e')][_0x61bc('0x5e')]()['then'](respondWithResult(_0x24f716,null))['catch'](handleError(_0x24f716,null));};exports[_0x61bc('0x5f')]=function(_0x51b5f0,_0x4aa1b5,_0xd21f59){if(_0x51b5f0[_0x61bc('0x5c')]['id']){delete _0x51b5f0[_0x61bc('0x5c')]['id'];}return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x51b5f0['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x4aa1b5,null))[_0x61bc('0x1d')](function(_0x59f524){if(_0x59f524){_0x51b5f0['body'][_0x61bc('0x60')]=_0x59f524['id'];return db[_0x61bc('0x61')]['create'](_0x51b5f0[_0x61bc('0x5c')]);}})['then'](respondWithResult(_0x4aa1b5,null))[_0x61bc('0x56')](handleError(_0x4aa1b5,null));};exports[_0x61bc('0x62')]=function(_0x5bd4ac,_0x1efdbf,_0x45f894){var _0xa28763={'raw':![],'where':{}};var _0x35e00f={};var _0x560269={'count':0x0,'rows':[]};return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x5bd4ac['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x1efdbf,null))[_0x61bc('0x1d')](function(_0x4df3ae){if(_0x4df3ae){_0x35e00f[_0x61bc('0x42')]=_[_0x61bc('0x44')](db['Disposition'][_0x61bc('0x59')]);_0x35e00f[_0x61bc('0x43')]=_[_0x61bc('0x44')](_0x5bd4ac[_0x61bc('0x43')]);_0x35e00f['filters']=_[_0x61bc('0x46')](_0x35e00f['model'],_0x35e00f[_0x61bc('0x43')]);_0xa28763[_0x61bc('0x48')]=_[_0x61bc('0x46')](_0x35e00f[_0x61bc('0x42')],qs[_0x61bc('0x47')](_0x5bd4ac[_0x61bc('0x43')]['fields']));_0xa28763[_0x61bc('0x48')]=_0xa28763[_0x61bc('0x48')][_0x61bc('0x49')]?_0xa28763[_0x61bc('0x48')]:_0x35e00f[_0x61bc('0x42')];if(!_0x5bd4ac[_0x61bc('0x43')][_0x61bc('0x4a')]('nolimit')){_0xa28763[_0x61bc('0x2c')]=qs['limit'](_0x5bd4ac['query'][_0x61bc('0x2c')]);_0xa28763[_0x61bc('0x2b')]=qs['offset'](_0x5bd4ac[_0x61bc('0x43')][_0x61bc('0x2b')]);}_0xa28763['order']=qs[_0x61bc('0x4d')](_0x5bd4ac[_0x61bc('0x43')][_0x61bc('0x4d')]);_0xa28763[_0x61bc('0x4e')]=qs['filters'](_['pick'](_0x5bd4ac[_0x61bc('0x43')],_0x35e00f['filters']));_0xa28763[_0x61bc('0x4e')][_0x61bc('0x60')]=_0x4df3ae['id'];if(_0x5bd4ac['query'][_0x61bc('0x4f')]){_0xa28763['where']=_[_0x61bc('0x50')](_0xa28763[_0x61bc('0x4e')],{'$or':_[_0x61bc('0x3d')](_0xa28763[_0x61bc('0x48')],function(_0x3bfca6){var _0x3b6067={};_0x3b6067[_0x3bfca6]={'$like':'%'+_0x5bd4ac[_0x61bc('0x43')][_0x61bc('0x4f')]+'%'};return _0x3b6067;})});}_0xa28763=_['merge']({},_0xa28763,_0x5bd4ac[_0x61bc('0x52')]);return db[_0x61bc('0x61')][_0x61bc('0x2a')]({'where':_0xa28763['where']})[_0x61bc('0x1d')](function(_0x2a1e60){_0x560269[_0x61bc('0x2a')]=_0x2a1e60;if(_0x5bd4ac[_0x61bc('0x43')][_0x61bc('0x53')]){_0xa28763['include']=[{'all':!![]}];}return db[_0x61bc('0x61')][_0x61bc('0x54')](_0xa28763);})[_0x61bc('0x1d')](function(_0x2a4ae8){_0x560269['rows']=_0x2a4ae8;return _0x560269;});}})[_0x61bc('0x1d')](respondWithFilteredResult(_0x1efdbf,_0xa28763))[_0x61bc('0x56')](handleError(_0x1efdbf,null));};exports[_0x61bc('0x64')]=function(_0x732f56,_0x6568e8,_0x82ad5){return db['MailAccount'][_0x61bc('0x5b')]({'where':{'id':_0x732f56[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x6568e8,null))[_0x61bc('0x1d')](function(_0x2e528b){if(_0x2e528b){return _0x2e528b[_0x61bc('0x64')](_0x732f56[_0x61bc('0x43')][_0x61bc('0x65')]);}})[_0x61bc('0x1d')](respondWithStatusCode(_0x6568e8,null))[_0x61bc('0x56')](handleError(_0x6568e8,null));};exports[_0x61bc('0x66')]=function(_0x1cc450,_0x3aafa7,_0x178c4e){if(_0x1cc450[_0x61bc('0x5c')]['id']){delete _0x1cc450[_0x61bc('0x5c')]['id'];}return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x1cc450[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x3aafa7,null))[_0x61bc('0x1d')](function(_0x11ef10){if(_0x11ef10){_0x1cc450['body'][_0x61bc('0x60')]=_0x11ef10['id'];return db[_0x61bc('0x67')][_0x61bc('0x68')](_0x1cc450['body']);}})[_0x61bc('0x1d')](respondWithResult(_0x3aafa7,null))[_0x61bc('0x56')](handleError(_0x3aafa7,null));};exports[_0x61bc('0x69')]=function(_0x3dfc7e,_0x4bb222,_0x2d6319){var _0x2366ac={'raw':![],'where':{}};var _0x54b351={};var _0x3ea313={'count':0x0,'rows':[]};return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x3dfc7e[_0x61bc('0x58')]['id']}})['then'](handleEntityNotFound(_0x4bb222,null))['then'](function(_0x120684){if(_0x120684){_0x54b351[_0x61bc('0x42')]=_[_0x61bc('0x44')](db['CannedAnswer'][_0x61bc('0x59')]);_0x54b351[_0x61bc('0x43')]=_['keys'](_0x3dfc7e[_0x61bc('0x43')]);_0x54b351['filters']=_[_0x61bc('0x46')](_0x54b351['model'],_0x54b351[_0x61bc('0x43')]);_0x2366ac[_0x61bc('0x48')]=_[_0x61bc('0x46')](_0x54b351[_0x61bc('0x42')],qs[_0x61bc('0x47')](_0x3dfc7e[_0x61bc('0x43')]['fields']));_0x2366ac['attributes']=_0x2366ac['attributes'][_0x61bc('0x49')]?_0x2366ac['attributes']:_0x54b351[_0x61bc('0x42')];if(!_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x4a')](_0x61bc('0x4b'))){_0x2366ac['limit']=qs[_0x61bc('0x2c')](_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x2c')]);_0x2366ac['offset']=qs[_0x61bc('0x2b')](_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x2b')]);}_0x2366ac[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x4d')]);_0x2366ac[_0x61bc('0x4e')]=qs[_0x61bc('0x45')](_['pick'](_0x3dfc7e[_0x61bc('0x43')],_0x54b351[_0x61bc('0x45')]));_0x2366ac['where']['MailAccountId']=_0x120684['id'];if(_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x4f')]){_0x2366ac[_0x61bc('0x4e')]=_[_0x61bc('0x50')](_0x2366ac[_0x61bc('0x4e')],{'$or':_[_0x61bc('0x3d')](_0x2366ac[_0x61bc('0x48')],function(_0xe2d6e0){var _0x16a36c={};_0x16a36c[_0xe2d6e0]={'$like':'%'+_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x4f')]+'%'};return _0x16a36c;})});}_0x2366ac=_['merge']({},_0x2366ac,_0x3dfc7e[_0x61bc('0x52')]);return db[_0x61bc('0x67')][_0x61bc('0x2a')]({'where':_0x2366ac[_0x61bc('0x4e')]})['then'](function(_0x3e99b9){_0x3ea313['count']=_0x3e99b9;if(_0x3dfc7e[_0x61bc('0x43')][_0x61bc('0x53')]){_0x2366ac[_0x61bc('0x6a')]=[{'all':!![]}];}return db[_0x61bc('0x67')]['findAll'](_0x2366ac);})['then'](function(_0x328980){_0x3ea313[_0x61bc('0x55')]=_0x328980;return _0x3ea313;});}})[_0x61bc('0x1d')](respondWithFilteredResult(_0x4bb222,_0x2366ac))[_0x61bc('0x56')](handleError(_0x4bb222,null));};exports[_0x61bc('0x6b')]=function(_0x25110f,_0x23b1f3,_0x347135){return db['MailAccount'][_0x61bc('0x5b')]({'where':{'id':_0x25110f[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x23b1f3,null))['then'](function(_0x388ceb){if(_0x388ceb){return _0x388ceb['removeAnswers'](_0x25110f[_0x61bc('0x43')][_0x61bc('0x65')]);}})[_0x61bc('0x1d')](respondWithStatusCode(_0x23b1f3,null))['catch'](handleError(_0x23b1f3,null));};exports[_0x61bc('0x68')]=function(_0x50d1ef,_0x4022cb){var _0x2ab7b7={'name':_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x37')],'key':_0x50d1ef['body']['key'],'email':_0x50d1ef[_0x61bc('0x5c')]['email'],'ListId':_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x6c')],'active':!_[_0x61bc('0x6d')](_0x50d1ef[_0x61bc('0x5c')]['active'])?_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x6e')]:!![],'description':_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x6f')]||null,'Imap':{},'Smtp':{}};if(_[_0x61bc('0x6d')](_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x70')])){if(_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x71')]){_0x2ab7b7[_0x61bc('0x38')][_0x61bc('0x72')]=_0x2ab7b7[_0x61bc('0x3a')]['user']=_0x50d1ef['body'][_0x61bc('0x73')];_0x2ab7b7[_0x61bc('0x38')][_0x61bc('0x74')]=_0x2ab7b7[_0x61bc('0x3a')][_0x61bc('0x75')]=_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x76')];}else{_0x2ab7b7['Imap'][_0x61bc('0x77')]=_0x2ab7b7['Smtp'][_0x61bc('0x77')]=![];}_0x2ab7b7[_0x61bc('0x38')][_0x61bc('0x78')]=_0x50d1ef[_0x61bc('0x5c')]['Imap'][_0x61bc('0x78')];_0x2ab7b7[_0x61bc('0x38')]['port']=_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x38')][_0x61bc('0x79')];_0x2ab7b7[_0x61bc('0x3a')][_0x61bc('0x78')]=_0x50d1ef[_0x61bc('0x5c')]['Smtp'][_0x61bc('0x78')];_0x2ab7b7[_0x61bc('0x3a')][_0x61bc('0x79')]=_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x3a')][_0x61bc('0x79')];}else{_0x2ab7b7[_0x61bc('0x38')]['service']=_0x2ab7b7[_0x61bc('0x3a')][_0x61bc('0x7a')]=_0x50d1ef[_0x61bc('0x5c')][_0x61bc('0x70')];_0x2ab7b7[_0x61bc('0x38')][_0x61bc('0x72')]=_0x2ab7b7['Smtp'][_0x61bc('0x72')]=_0x50d1ef['body'][_0x61bc('0x73')];_0x2ab7b7[_0x61bc('0x38')][_0x61bc('0x74')]=_0x2ab7b7['Smtp'][_0x61bc('0x75')]=_0x50d1ef[_0x61bc('0x5c')]['cpassword'];}return db[_0x61bc('0x3e')][_0x61bc('0x68')](_0x2ab7b7,{'include':[{'model':db['MailServerOut'],'as':_0x61bc('0x3a')},{'model':db[_0x61bc('0x5d')],'as':_0x61bc('0x38')}]})[_0x61bc('0x1d')](function(_0x290049){var _0x4c392b=_0x50d1ef[_0x61bc('0x72')]['get']({'plain':!![]});if(!_0x4c392b)throw new Error(_0x61bc('0x7b'));if(_0x4c392b[_0x61bc('0x7c')]===_0x61bc('0x72')){var _0x711253=_0x290049['get']({'plain':!![]});return db[_0x61bc('0x7d')][_0x61bc('0x5b')]({'where':{'name':_0x61bc('0x34'),'userProfileId':_0x4c392b[_0x61bc('0x7e')]},'raw':!![]})[_0x61bc('0x1d')](function(_0x1bf9e0){if(_0x1bf9e0&&_0x1bf9e0[_0x61bc('0x7f')]===0x0){return db['UserProfileResource']['create']({'name':_0x711253['name'],'resourceId':_0x711253['id'],'type':_0x1bf9e0[_0x61bc('0x37')],'sectionId':_0x1bf9e0['id']},{})[_0x61bc('0x1d')](function(){return _0x290049;});}else{return _0x290049;}})['catch'](function(_0x479b6f){logger[_0x61bc('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x479b6f);throw _0x479b6f;});}return _0x290049;})['then'](respondWithResult(_0x4022cb,0xc9))[_0x61bc('0x56')](handleError(_0x4022cb,null));};exports['getImap']=function(_0x21c6c2,_0x1888cf,_0x45a3fd){return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x21c6c2['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x1888cf,null))['then'](function(_0x49b396){if(_0x49b396){return _0x49b396[_0x61bc('0x80')]();}return null;})[_0x61bc('0x1d')](respondWithResult(_0x1888cf,null))[_0x61bc('0x56')](handleError(_0x1888cf,null));};exports[_0x61bc('0x81')]=function(_0x34f546,_0x5681e5,_0x348602){if(_0x34f546[_0x61bc('0x5c')]['id']){delete _0x34f546[_0x61bc('0x5c')]['id'];}return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x34f546[_0x61bc('0x58')]['id']}})['then'](handleEntityNotFound(_0x5681e5,null))['then'](function(_0x104371){if(_0x104371){_0x34f546['body'][_0x61bc('0x60')]=_0x104371['id'];return db['MailServerIn'][_0x61bc('0x68')](_0x34f546[_0x61bc('0x5c')]);}})[_0x61bc('0x1d')](respondWithResult(_0x5681e5,null))[_0x61bc('0x56')](handleError(_0x5681e5,null));};exports[_0x61bc('0x82')]=function(_0x35716c,_0x3e586a,_0x470af4){return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x35716c['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x3e586a,null))['then'](function(_0x4670c2){if(_0x4670c2){return _0x4670c2[_0x61bc('0x83')](null);}return null;})[_0x61bc('0x1d')](respondWithStatusCode(_0x3e586a,null))[_0x61bc('0x56')](handleError(_0x3e586a,null));};exports[_0x61bc('0x84')]=function(_0x4f07c6,_0x32a1c4,_0x5d0e0f){return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x4f07c6[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x32a1c4,null))['then'](function(_0xcfff2b){if(_0xcfff2b){return _0xcfff2b[_0x61bc('0x84')]();}return null;})['then'](respondWithResult(_0x32a1c4,null))['catch'](handleError(_0x32a1c4,null));};exports['addSmtp']=function(_0x182052,_0x8e96a8,_0x3c1e02){if(_0x182052[_0x61bc('0x5c')]['id']){delete _0x182052['body']['id'];}return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x182052['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x8e96a8,null))[_0x61bc('0x1d')](function(_0x1713a0){if(_0x1713a0){_0x182052[_0x61bc('0x5c')]['MailAccountId']=_0x1713a0['id'];return db[_0x61bc('0x39')][_0x61bc('0x68')](_0x182052[_0x61bc('0x5c')]);}})['then'](respondWithResult(_0x8e96a8,null))[_0x61bc('0x56')](handleError(_0x8e96a8,null));};exports[_0x61bc('0x85')]=function(_0x386c34,_0x3ff22c,_0x576f9c){return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x386c34[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x3ff22c,null))[_0x61bc('0x1d')](function(_0x28858d){if(_0x28858d){return _0x28858d[_0x61bc('0x86')](null);}return null;})[_0x61bc('0x1d')](respondWithStatusCode(_0x3ff22c,null))[_0x61bc('0x56')](handleError(_0x3ff22c,null));};exports[_0x61bc('0x87')]=function(_0x2b9295,_0x3e1a13,_0x3f8457){return db[_0x61bc('0x88')][_0x61bc('0x5b')]({'where':{'id':_0x2b9295[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x3e1a13,null))[_0x61bc('0x1d')](function(_0x2f13c0){if(_0x2f13c0){return _0x2f13c0[_0x61bc('0x87')](_0x2b9295[_0x61bc('0x5c')][_0x61bc('0x65')],_['omit'](_0x2b9295[_0x61bc('0x5c')],[_0x61bc('0x65'),'id'])||{});}})[_0x61bc('0x1d')](respondWithResult(_0x3e1a13,null))[_0x61bc('0x56')](handleError(_0x3e1a13,null));};exports[_0x61bc('0x89')]=function(_0x4c1a0d,_0x1754c7,_0x42d037){var _0x5a7013={'raw':![],'where':{}};var _0x58cda2={};var _0x36985b={'count':0x0,'rows':[]};return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0x4c1a0d[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x1754c7,null))[_0x61bc('0x1d')](function(_0x4d38ca){if(_0x4d38ca){_0x58cda2[_0x61bc('0x42')]=_[_0x61bc('0x44')](db[_0x61bc('0x88')][_0x61bc('0x59')]);_0x58cda2['query']=_['keys'](_0x4c1a0d[_0x61bc('0x43')]);_0x58cda2[_0x61bc('0x45')]=_['intersection'](_0x58cda2[_0x61bc('0x42')],_0x58cda2['query']);_0x5a7013[_0x61bc('0x48')]=_['intersection'](_0x58cda2[_0x61bc('0x42')],qs[_0x61bc('0x47')](_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x47')]));_0x5a7013[_0x61bc('0x48')]=_0x5a7013[_0x61bc('0x48')][_0x61bc('0x49')]?_0x5a7013[_0x61bc('0x48')]:_0x58cda2[_0x61bc('0x42')];if(!_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x4a')](_0x61bc('0x4b'))){_0x5a7013[_0x61bc('0x2c')]=qs[_0x61bc('0x2c')](_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x2c')]);_0x5a7013['offset']=qs[_0x61bc('0x2b')](_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x2b')]);}_0x5a7013[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x4d')]);_0x5a7013[_0x61bc('0x4e')]=qs['filters'](_[_0x61bc('0x8a')](_0x4c1a0d[_0x61bc('0x43')],_0x58cda2[_0x61bc('0x45')]));_0x5a7013[_0x61bc('0x4e')][_0x61bc('0x60')]=_0x4d38ca['id'];if(_0x4c1a0d[_0x61bc('0x43')]['filter']){_0x5a7013['where']=_[_0x61bc('0x50')](_0x5a7013['where'],{'$or':_[_0x61bc('0x3d')](_0x5a7013['attributes'],function(_0x591127){var _0x1a39a1={};_0x1a39a1[_0x591127]={'$like':'%'+_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x4f')]+'%'};return _0x1a39a1;})});}_0x5a7013=_['merge']({},_0x5a7013,_0x4c1a0d[_0x61bc('0x52')]);return db['MailInteraction']['count']({'where':_0x5a7013[_0x61bc('0x4e')]})['then'](function(_0x2c0eda){_0x36985b[_0x61bc('0x2a')]=_0x2c0eda;if(_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x53')]){_0x5a7013[_0x61bc('0x6a')]=[{'model':db[_0x61bc('0x8b')],'as':_0x61bc('0x8c'),'required':![]},{'model':db[_0x61bc('0x8d')],'as':_0x61bc('0x8e'),'attributes':['name',_0x61bc('0x8f'),_0x61bc('0x90')],'required':![]},{'model':db['Tag'],'as':_0x61bc('0x91'),'attributes':['id',_0x61bc('0x37'),'color'],'where':_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x92')]?{'id':_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x92')]}:undefined,'required':_0x4c1a0d[_0x61bc('0x43')][_0x61bc('0x92')]?!![]:![]}];}return db[_0x61bc('0x88')][_0x61bc('0x54')](_0x5a7013);})[_0x61bc('0x1d')](function(_0x54f92d){_0x36985b['rows']=_0x54f92d;return _0x36985b;});}})[_0x61bc('0x1d')](respondWithFilteredResult(_0x1754c7,_0x5a7013))[_0x61bc('0x56')](handleError(_0x1754c7,null));};exports[_0x61bc('0x93')]=function(_0xd6adf4,_0x3bf13c,_0x2dcea2){return db['MailAccount'][_0x61bc('0x63')]({'where':{'id':_0xd6adf4['params']['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x3bf13c,null))[_0x61bc('0x1d')](function(_0x35ebaa){if(_0x35ebaa){return db[_0x61bc('0x94')]['transaction'](function(_0x38b330){return db[_0x61bc('0x95')][_0x61bc('0x32')]({'where':{'MailAccountId':_0xd6adf4['params']['id']},'transaction':_0x38b330})['then'](function(_0x734ea2){var _0x36c338=_[_0x61bc('0x3d')](_0xd6adf4[_0x61bc('0x5c')],function(_0x5977ad){_0x5977ad[_0x61bc('0x60')]=_0xd6adf4['params']['id'];return _0x5977ad;});return db[_0x61bc('0x95')][_0x61bc('0x96')](_0x36c338,{'transaction':_0x38b330});});})[_0x61bc('0x1d')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0xd6adf4['params']['id']},'order':_0x61bc('0x97')});});}})[_0x61bc('0x1d')](respondWithResult(_0x3bf13c,null))[_0x61bc('0x56')](handleError(_0x3bf13c,null));};exports['getApplications']=function(_0x4248c1,_0x478e78,_0x1f71fc){var _0x42fd2b={};var _0x32a2a4={};var _0x23d1b3;var _0x176f9f;return db['MailAccount'][_0x61bc('0x63')]({'where':{'id':_0x4248c1[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x478e78,null))['then'](function(_0x59eeb9){if(_0x59eeb9){_0x23d1b3=_0x59eeb9;_0x32a2a4[_0x61bc('0x42')]=_[_0x61bc('0x44')](db['MailApplication'][_0x61bc('0x59')]);_0x32a2a4['query']=_[_0x61bc('0x44')](_0x4248c1[_0x61bc('0x43')]);_0x32a2a4[_0x61bc('0x45')]=_[_0x61bc('0x46')](_0x32a2a4[_0x61bc('0x42')],_0x32a2a4[_0x61bc('0x43')]);_0x42fd2b[_0x61bc('0x48')]=_['intersection'](_0x32a2a4[_0x61bc('0x42')],qs[_0x61bc('0x47')](_0x4248c1[_0x61bc('0x43')][_0x61bc('0x47')]));_0x42fd2b[_0x61bc('0x48')]=_0x42fd2b['attributes'][_0x61bc('0x49')]?_0x42fd2b[_0x61bc('0x48')]:_0x32a2a4['model'];_0x42fd2b[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0x4248c1[_0x61bc('0x43')][_0x61bc('0x4d')]);_0x42fd2b[_0x61bc('0x4e')]=qs['filters'](_[_0x61bc('0x8a')](_0x4248c1[_0x61bc('0x43')],_0x32a2a4[_0x61bc('0x45')]));if(_0x4248c1[_0x61bc('0x43')][_0x61bc('0x4f')]){_0x42fd2b['where']=_['merge'](_0x42fd2b[_0x61bc('0x4e')],{'$or':_[_0x61bc('0x3d')](_0x42fd2b[_0x61bc('0x48')],function(_0x2efac0){var _0x40db91={};_0x40db91[_0x2efac0]={'$like':'%'+_0x4248c1[_0x61bc('0x43')][_0x61bc('0x4f')]+'%'};return _0x40db91;})});}_0x42fd2b=_['merge']({},_0x42fd2b,_0x4248c1[_0x61bc('0x52')]);return _0x23d1b3['getApplications'](_0x42fd2b);}})[_0x61bc('0x1d')](function(_0x447000){if(_0x447000){_0x176f9f=_0x447000[_0x61bc('0x49')];if(!_0x4248c1[_0x61bc('0x43')]['hasOwnProperty']('nolimit')){_0x42fd2b[_0x61bc('0x2c')]=qs[_0x61bc('0x2c')](_0x4248c1[_0x61bc('0x43')][_0x61bc('0x2c')]);_0x42fd2b[_0x61bc('0x2b')]=qs[_0x61bc('0x2b')](_0x4248c1['query'][_0x61bc('0x2b')]);}return _0x23d1b3['getApplications'](_0x42fd2b);}})[_0x61bc('0x1d')](function(_0x4d82ea){if(_0x4d82ea){return _0x4d82ea?{'count':_0x176f9f,'rows':_0x4d82ea}:null;}})['then'](respondWithResult(_0x478e78,null))[_0x61bc('0x56')](handleError(_0x478e78,null));};exports[_0x61bc('0x98')]=function(_0xf59f2e,_0x6a4931,_0x38fa14){var _0x162b75={'raw':!![],'where':{}};var _0x5b2c0d={};var _0x2944d1={'count':0x0,'rows':[]};return db[_0x61bc('0x3e')][_0x61bc('0x63')]({'where':{'id':_0xf59f2e[_0x61bc('0x58')]['id']}})['then'](handleEntityNotFound(_0x6a4931,null))[_0x61bc('0x1d')](function(_0x2ffb27){if(_0x2ffb27){_0x5b2c0d[_0x61bc('0x42')]=_[_0x61bc('0x44')](db[_0x61bc('0x99')]['rawAttributes']);_0x5b2c0d[_0x61bc('0x43')]=_[_0x61bc('0x44')](_0xf59f2e['query']);_0x5b2c0d[_0x61bc('0x45')]=_[_0x61bc('0x46')](_0x5b2c0d['model'],_0x5b2c0d[_0x61bc('0x43')]);_0x162b75[_0x61bc('0x48')]=_[_0x61bc('0x46')](_0x5b2c0d[_0x61bc('0x42')],qs['fields'](_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x47')]));_0x162b75[_0x61bc('0x48')]=_0x162b75[_0x61bc('0x48')][_0x61bc('0x49')]?_0x162b75[_0x61bc('0x48')]:_0x5b2c0d[_0x61bc('0x42')];if(!_0xf59f2e[_0x61bc('0x43')]['hasOwnProperty'](_0x61bc('0x4b'))){_0x162b75[_0x61bc('0x2c')]=qs[_0x61bc('0x2c')](_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x2c')]);_0x162b75[_0x61bc('0x2b')]=qs[_0x61bc('0x2b')](_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x2b')]);}_0x162b75[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x4d')]);_0x162b75[_0x61bc('0x4e')]=qs[_0x61bc('0x45')](_[_0x61bc('0x8a')](_0xf59f2e['query'],_0x5b2c0d[_0x61bc('0x45')]));_0x162b75[_0x61bc('0x4e')]['MailAccountId']=_0x2ffb27['id'];if(_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x4f')]){_0x162b75[_0x61bc('0x4e')]=_[_0x61bc('0x50')](_0x162b75[_0x61bc('0x4e')],{'$or':_[_0x61bc('0x3d')](_0x162b75[_0x61bc('0x48')],function(_0x4d7d70){var _0x57010f={};_0x57010f[_0x4d7d70]={'$like':'%'+_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x4f')]+'%'};return _0x57010f;})});}if(_0xf59f2e[_0x61bc('0x43')]['$gte']){var _0x4b09f9=_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x9a')][_0x61bc('0x9b')](',');var _0x311d6c={};_0x311d6c[_0x4b09f9[0x0]]={'$gte':moment(_0x4b09f9[0x1])[_0x61bc('0x9c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x162b75[_0x61bc('0x4e')]=_['merge'](_0x162b75['where'],_0x311d6c);}_0x162b75=_[_0x61bc('0x50')]({},_0x162b75,_0xf59f2e[_0x61bc('0x52')]);return db['MailMessage'][_0x61bc('0x2a')]({'where':_0x162b75[_0x61bc('0x4e')]})[_0x61bc('0x1d')](function(_0x1db1e4){_0x2944d1[_0x61bc('0x2a')]=_0x1db1e4;if(_0xf59f2e[_0x61bc('0x43')][_0x61bc('0x53')]){_0x162b75['include']=[{'all':!![]}];}return db[_0x61bc('0x99')][_0x61bc('0x54')](_0x162b75);})['then'](function(_0x436c5a){_0x2944d1[_0x61bc('0x55')]=_0x436c5a;return _0x2944d1;});}})[_0x61bc('0x1d')](respondWithFilteredResult(_0x6a4931,_0x162b75))['catch'](handleError(_0x6a4931,null));};exports[_0x61bc('0x9d')]=function(_0x3faa5b,_0x87b876,_0x592553){var _0x7ff6e0,_0x12e0c8={},_0x577126;if(_0x3faa5b['body']['to']){_0x577126=_0x3faa5b['body']['to'][_0x61bc('0x9b')](',')[0x0];}return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x3faa5b[_0x61bc('0x58')]['id']},'include':[{'model':db[_0x61bc('0x9e')],'as':'List','include':[{'model':db[_0x61bc('0x8b')],'as':_0x61bc('0x9f'),'where':{'email':_0x577126},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x61bc('0x3a'),'raw':!![]}]})[_0x61bc('0x1d')](handleEntityNotFound(_0x87b876,null))['then'](function(_0x5849d1){if(_0x5849d1){_0x7ff6e0=_0x5849d1;if(_0x5849d1['Smtp']){if(_[_0x61bc('0x6d')](_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa0')])){_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa0')]=util[_0x61bc('0x9c')](_0x61bc('0xa1'),_0x5849d1[_0x61bc('0x37')],_0x5849d1[_0x61bc('0xa2')]||_0x5849d1[_0x61bc('0x3a')][_0x61bc('0x72')]);}if(_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa3')]&&_0x3faa5b['body'][_0x61bc('0xa3')][_0x61bc('0x49')]){for(var _0x6fbb9f=0x0;_0x6fbb9f<_0x3faa5b[_0x61bc('0x5c')]['attachments'][_0x61bc('0x49')];_0x6fbb9f+=0x1){_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa3')][_0x6fbb9f]={'filename':_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa3')][_0x6fbb9f][_0x61bc('0x37')],'path':path[_0x61bc('0xa4')](config['root'],_0x61bc('0xa5'),_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xa3')][_0x6fbb9f][_0x61bc('0xa6')])};}}var _0x352f74={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5849d1['Smtp'][_0x61bc('0x7a')])){if(_0x5849d1[_0x61bc('0x3a')][_0x61bc('0x77')]){_0x352f74[_0x61bc('0xa7')]={'user':_0x5849d1[_0x61bc('0x3a')][_0x61bc('0x72')],'pass':_0x5849d1[_0x61bc('0x3a')][_0x61bc('0x75')]};}_0x352f74['host']=_0x5849d1[_0x61bc('0x3a')][_0x61bc('0x78')];_0x352f74[_0x61bc('0x79')]=_0x5849d1['Smtp'][_0x61bc('0x79')];_0x352f74[_0x61bc('0xa8')]=_0x5849d1[_0x61bc('0x3a')][_0x61bc('0xa8')];}else{_0x352f74['service']=_0x5849d1['Smtp']['service'];_0x352f74[_0x61bc('0xa7')]={'user':_0x5849d1['Smtp'][_0x61bc('0x72')],'pass':_0x5849d1[_0x61bc('0x3a')]['pass']};}return respondWithRpcPromise(_0x61bc('0xa9'),_0x61bc('0xaa'),{'account':_0x352f74,'message':_0x3faa5b[_0x61bc('0x5c')]});}else{throw new Error(_0x61bc('0xab'));}}})[_0x61bc('0x1d')](function(_0x13a5bb){if(_0x13a5bb){_0x12e0c8=_0x13a5bb;if(_0x7ff6e0[_0x61bc('0xac')]){if(_0x7ff6e0[_0x61bc('0xac')][_0x61bc('0x9f')][_0x61bc('0x49')]){return _0x7ff6e0[_0x61bc('0xac')][_0x61bc('0x9f')][0x0];}else{return db[_0x61bc('0x8b')]['create'](_['defaults'](_0x3faa5b[_0x61bc('0x5c')],{'firstName':_0x3faa5b[_0x61bc('0x5c')]['to'],'email':_0x3faa5b[_0x61bc('0x5c')]['to'],'phone':_0x3faa5b[_0x61bc('0x5c')]['to'],'ListId':_0x7ff6e0[_0x61bc('0x6c')]}));}}else{throw new Error(_0x61bc('0xab'));}}})['then'](function(_0x33cf1c){if(_0x33cf1c){var _0x16e839={'UserId':_0x3faa5b['user']['id'],'ContactId':_0x33cf1c['id'],'MailAccountId':_0x7ff6e0['id'],'inReplyTo':_0x12e0c8['messageId'],'to':_0x3faa5b['body'][_0x61bc('0xa0')],'cc':_0x3faa5b['body']['cc'],'subject':_0x3faa5b[_0x61bc('0x5c')]['subject'],'attach':_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xad')],'firstMsgDirection':_0x61bc('0xae'),'lastMsgAt':moment()[_0x61bc('0x9c')](_0x61bc('0xaf')),'lastMsgDirection':_0x61bc('0xae'),'lastMsgBody':_0x3faa5b['body'][_0x61bc('0x5c')],'Messages':[_['merge'](_0x3faa5b[_0x61bc('0x5c')],{'messageId':_0x12e0c8[_0x61bc('0xb0')],'sentAt':moment()[_0x61bc('0x9c')](_0x61bc('0xaf')),'read':!![],'MailAccountId':_0x7ff6e0['id'],'UserId':_0x3faa5b[_0x61bc('0x72')]['id'],'ContactId':_0x33cf1c['id']})]};if(_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xb1')]){_0x16e839=_[_0x61bc('0x50')](_0x16e839,_0x3faa5b[_0x61bc('0x5c')][_0x61bc('0xb1')]);}return db[_0x61bc('0x88')]['create'](_0x16e839,{'include':[{'model':db[_0x61bc('0x99')],'as':_0x61bc('0xb2')}]});}})[_0x61bc('0x1d')](respondWithResult(_0x87b876,null))[_0x61bc('0x56')](handleError(_0x87b876,null));};exports[_0x61bc('0xb3')]=function(_0x2404f6,_0x14fe17,_0x14af05){return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x2404f6['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x61bc('0x3a'),'raw':!![]}]})['then'](handleEntityNotFound(_0x14fe17,null))['then'](function(_0x1cf5b4){if(_0x1cf5b4&&_0x1cf5b4['Smtp']){var _0x1bf35d={'id':_0x1cf5b4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1cf5b4['Smtp'][_0x61bc('0x7a')]){_0x1bf35d[_0x61bc('0x7a')]=_0x1cf5b4['Smtp'][_0x61bc('0x7a')];}else{_0x1bf35d[_0x61bc('0x78')]=_0x1cf5b4['Smtp'][_0x61bc('0x78')];_0x1bf35d[_0x61bc('0x79')]=_0x1cf5b4[_0x61bc('0x3a')][_0x61bc('0x79')];_0x1bf35d[_0x61bc('0xa8')]=_0x1cf5b4[_0x61bc('0x3a')][_0x61bc('0xa8')];}if(_0x1cf5b4['Smtp'][_0x61bc('0x77')]){_0x1bf35d[_0x61bc('0xa7')]={'user':_0x1cf5b4[_0x61bc('0x3a')][_0x61bc('0x72')],'pass':_0x1cf5b4[_0x61bc('0x3a')][_0x61bc('0x75')]};}return respondWithRpcPromise(_0x61bc('0xb4'),_0x61bc('0xb3'),{'account':_0x1bf35d});}})[_0x61bc('0x1d')](respondWithResult(_0x14fe17,null))['catch'](handleError(_0x14fe17,null));};exports[_0x61bc('0x32')]=function(_0x539ecb,_0x4f3729){return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x539ecb[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x4f3729,null))[_0x61bc('0x1d')](function(_0x223abc){if(_0x223abc&&_0x223abc[_0x61bc('0x7a')]){throw new db['Sequelize'][(_0x61bc('0xb5'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x223abc;})['then'](removeEntity(_0x4f3729,null))['catch'](handleError(_0x4f3729,null));};exports[_0x61bc('0xb6')]=function(_0x334b1d,_0x391d48,_0x2bd94b){return db[_0x61bc('0x3e')][_0x61bc('0x5b')]({'where':{'id':_0x334b1d[_0x61bc('0x58')]['id']}})[_0x61bc('0x1d')](handleEntityNotFound(_0x391d48,null))['then'](function(_0x21964d){if(_0x21964d){return _0x21964d['addAgents'](_0x334b1d[_0x61bc('0x5c')][_0x61bc('0x65')],_[_0x61bc('0xb7')](_0x334b1d[_0x61bc('0x5c')],['ids','id'])||{})['spread'](function(_0x2a43f5){for(var _0x613ab9=0x0;_0x613ab9<_0x334b1d[_0x61bc('0x5c')]['ids']['length'];_0x613ab9+=0x1){socket['emit'](_0x61bc('0xb8'),{'UserId':_0x334b1d['body'][_0x61bc('0x65')][_0x613ab9],'MailAccountId':_0x334b1d[_0x61bc('0x58')]['id']});}return _0x2a43f5;});}})[_0x61bc('0x1d')](respondWithResult(_0x391d48,null))[_0x61bc('0x56')](handleError(_0x391d48,null));};exports[_0x61bc('0xb9')]=function(_0x184afd,_0x2d74a5,_0x674e38){return db['MailAccount'][_0x61bc('0x5b')]({'where':{'id':_0x184afd['params']['id']}})['then'](handleEntityNotFound(_0x2d74a5,null))[_0x61bc('0x1d')](function(_0x49048e){if(_0x49048e){return _0x49048e[_0x61bc('0xb9')](_0x184afd['query'][_0x61bc('0x65')])[_0x61bc('0x1d')](function(){if(_[_0x61bc('0xba')](_0x184afd['query'][_0x61bc('0x65')])){for(var _0xc6d48=0x0;_0xc6d48<_0x184afd[_0x61bc('0x43')][_0x61bc('0x65')]['length'];_0xc6d48+=0x1){socket['emit'](_0x61bc('0xbb'),{'UserId':Number(_0x184afd[_0x61bc('0x43')]['ids'][_0xc6d48]),'MailAccountId':Number(_0x184afd[_0x61bc('0x58')]['id'])});}}else{socket[_0x61bc('0xbc')](_0x61bc('0xbb'),{'UserId':Number(_0x184afd['query'][_0x61bc('0x65')]),'MailAccountId':Number(_0x184afd['params']['id'])});}});}})[_0x61bc('0x1d')](respondWithStatusCode(_0x2d74a5,null))[_0x61bc('0x56')](handleError(_0x2d74a5,null));};exports[_0x61bc('0xbd')]=function(_0x4b1800,_0x17de8a,_0xb74e7d){var _0x58ee24={};var _0x55f187={};var _0x244318;var _0x5e7d4b;return db[_0x61bc('0x3e')]['findOne']({'where':{'id':_0x4b1800[_0x61bc('0x58')]['id']}})['then'](handleEntityNotFound(_0x17de8a,null))[_0x61bc('0x1d')](function(_0x1fc1e3){if(_0x1fc1e3){_0x244318=_0x1fc1e3;_0x55f187[_0x61bc('0x42')]=_[_0x61bc('0x44')](db[_0x61bc('0x8d')][_0x61bc('0x59')]);_0x55f187['query']=_[_0x61bc('0x44')](_0x4b1800[_0x61bc('0x43')]);_0x55f187[_0x61bc('0x45')]=_[_0x61bc('0x46')](_0x55f187[_0x61bc('0x42')],_0x55f187[_0x61bc('0x43')]);_0x58ee24['attributes']=_[_0x61bc('0x46')](_0x55f187['model'],qs['fields'](_0x4b1800['query'][_0x61bc('0x47')]));_0x58ee24[_0x61bc('0x48')]=_0x58ee24[_0x61bc('0x48')][_0x61bc('0x49')]?_0x58ee24[_0x61bc('0x48')]:_0x55f187[_0x61bc('0x42')];_0x58ee24[_0x61bc('0x4c')]=qs[_0x61bc('0x4d')](_0x4b1800[_0x61bc('0x43')]['sort']);_0x58ee24[_0x61bc('0x4e')]=qs[_0x61bc('0x45')](_[_0x61bc('0x8a')](_0x4b1800[_0x61bc('0x43')],_0x55f187['filters']));if(_0x4b1800[_0x61bc('0x43')][_0x61bc('0x4f')]){_0x58ee24[_0x61bc('0x4e')]=_['merge'](_0x58ee24['where'],{'$or':_[_0x61bc('0x3d')](_0x58ee24['attributes'],function(_0xa326){var _0x12cd73={};_0x12cd73[_0xa326]={'$like':'%'+_0x4b1800[_0x61bc('0x43')]['filter']+'%'};return _0x12cd73;})});}_0x58ee24=_[_0x61bc('0x50')]({},_0x58ee24,_0x4b1800[_0x61bc('0x52')]);return _0x244318[_0x61bc('0xbd')](_0x58ee24);}})[_0x61bc('0x1d')](function(_0x1e92d7){if(_0x1e92d7){_0x5e7d4b=_0x1e92d7[_0x61bc('0x49')];if(!_0x4b1800[_0x61bc('0x43')][_0x61bc('0x4a')](_0x61bc('0x4b'))){_0x58ee24[_0x61bc('0x2c')]=qs[_0x61bc('0x2c')](_0x4b1800['query']['limit']);_0x58ee24[_0x61bc('0x2b')]=qs[_0x61bc('0x2b')](_0x4b1800[_0x61bc('0x43')][_0x61bc('0x2b')]);}return _0x244318[_0x61bc('0xbd')](_0x58ee24);}})[_0x61bc('0x1d')](function(_0x5517e3){if(_0x5517e3){return _0x5517e3?{'count':_0x5e7d4b,'rows':_0x5517e3}:null;}})[_0x61bc('0x1d')](respondWithResult(_0x17de8a,null))[_0x61bc('0x56')](handleError(_0x17de8a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 51a115b..bd1f4bd 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 _0xb5f2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x14ea4b,_0x2f51ac){var _0x57a908=function(_0x424456){while(--_0x424456){_0x14ea4b['push'](_0x14ea4b['shift']());}};_0x57a908(++_0x2f51ac);}(_0xb5f2,0x71));var _0x2b5f=function(_0x4c3f4a,_0xf27718){_0x4c3f4a=_0x4c3f4a-0x0;var _0x2203b3=_0xb5f2[_0x4c3f4a];return _0x2203b3;};'use strict';var EventEmitter=require(_0x2b5f('0x0'));var MailAccount=require(_0x2b5f('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2b5f('0x2'),'afterUpdate':_0x2b5f('0x3'),'afterDestroy':_0x2b5f('0x4')};function emitEvent(_0x42fe1e){return function(_0x39a59d,_0x25e2fa,_0x463016){MailAccountEvents[_0x2b5f('0x5')](_0x42fe1e+':'+_0x39a59d['id'],_0x39a59d);MailAccountEvents['emit'](_0x42fe1e,_0x39a59d);_0x463016(null);};}for(var e in events){if(events[_0x2b5f('0x6')](e)){var event=events[e];MailAccount[_0x2b5f('0x7')](e,emitEvent(event));}}module[_0x2b5f('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x0a22=['save','update','hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x155b10,_0x470765){var _0x510ae4=function(_0x372ba3){while(--_0x372ba3){_0x155b10['push'](_0x155b10['shift']());}};_0x510ae4(++_0x470765);}(_0x0a22,0x1eb));var _0x20a2=function(_0x3ddc08,_0x394e4a){_0x3ddc08=_0x3ddc08-0x0;var _0x3984a3=_0x0a22[_0x3ddc08];return _0x3984a3;};'use strict';var EventEmitter=require(_0x20a2('0x0'));var MailAccount=require(_0x20a2('0x1'))['db'][_0x20a2('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x20a2('0x3')](0x0);var events={'afterCreate':_0x20a2('0x4'),'afterUpdate':_0x20a2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x299314){return function(_0x1c36da,_0x297b80,_0x246440){MailAccountEvents['emit'](_0x299314+':'+_0x1c36da['id'],_0x1c36da);MailAccountEvents['emit'](_0x299314,_0x1c36da);_0x246440(null);};}for(var e in events){if(events[_0x20a2('0x6')](e)){var event=events[e];MailAccount[_0x20a2('0x7')](e,emitEvent(event));}}module[_0x20a2('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 8bf9e6e..e7478d4 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 _0xcd92=['define','MailAccount','mail_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x2296b5,_0x5efe9c){var _0x1e8ae2=function(_0x45219f){while(--_0x45219f){_0x2296b5['push'](_0x2296b5['shift']());}};_0x1e8ae2(++_0x5efe9c);}(_0xcd92,0xb3));var _0x2cd9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xcd92[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var logger=require(_0x2cd9('0x2'))(_0x2cd9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2cd9('0x4'));var fs=require('fs');var path=require(_0x2cd9('0x5'));var rimraf=require(_0x2cd9('0x6'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0x2cd9('0x7')]=function(_0x5da439,_0x144ef4){return _0x5da439[_0x2cd9('0x8')](_0x2cd9('0x9'),attributes,{'tableName':_0x2cd9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf247=['mail_accounts','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailAccount'];(function(_0x14d532,_0x8f9e66){var _0x4711de=function(_0x4004a1){while(--_0x4004a1){_0x14d532['push'](_0x14d532['shift']());}};_0x4711de(++_0x8f9e66);}(_0xf247,0xa6));var _0x7f24=function(_0xd839e7,_0x4209e9){_0xd839e7=_0xd839e7-0x0;var _0xc3cf23=_0xf247[_0xd839e7];return _0xc3cf23;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f24('0x0'))('api');var moment=require(_0x7f24('0x1'));var BPromise=require(_0x7f24('0x2'));var rp=require(_0x7f24('0x3'));var fs=require('fs');var path=require(_0x7f24('0x4'));var rimraf=require(_0x7f24('0x5'));var config=require(_0x7f24('0x6'));var attributes=require('./mailAccount.attributes');module[_0x7f24('0x7')]=function(_0x1cccbc,_0x77ae7c){return _0x1cccbc[_0x7f24('0x8')](_0x7f24('0x9'),attributes,{'tableName':_0x7f24('0xa'),'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 7499f08..7d8bda1 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 _0xf874=['register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','options','raw','where','limit','include','map','model','attributes','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','body','rawAttributes','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','CmContact','DESC','MailApplication','Applications','MailServerOut','Smtp','omit','List','list','applications','orderBy','asc','autoclose','push','length','Contacts','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailMessage','Messages','MailInteraction','spread','update','YYYY-MM-DD\x20HH:mm:ss','get','interaction','attachments','originTo','originCc','bcc','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','localhost','redis','./mailAccount.socket'];(function(_0x209b3b,_0x1e490c){var _0x2619b7=function(_0x39f2e0){while(--_0x39f2e0){_0x209b3b['push'](_0x209b3b['shift']());}};_0x2619b7(++_0x1e490c);}(_0xf874,0x177));var _0x4f87=function(_0x1163b5,_0x10f93d){_0x1163b5=_0x1163b5-0x0;var _0xa3e8a4=_0xf874[_0x1163b5];return _0xa3e8a4;};'use strict';var _=require(_0x4f87('0x0'));var util=require('util');var moment=require(_0x4f87('0x1'));var BPromise=require(_0x4f87('0x2'));var rs=require(_0x4f87('0x3'));var fs=require('fs');var Redis=require(_0x4f87('0x4'));var db=require(_0x4f87('0x5'))['db'];var utils=require(_0x4f87('0x6'));var logger=require(_0x4f87('0x7'))('rpc');var config=require(_0x4f87('0x8'));var jayson=require(_0x4f87('0x9'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_['defaults'](config['redis'],{'host':_0x4f87('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f87('0xb')]));require(_0x4f87('0xc'))[_0x4f87('0xd')](socket);function respondWithRpcPromise(_0xf43741,_0x4dfb28,_0x25dea7){return new BPromise(function(_0x364d09,_0x363b96){return client[_0x4f87('0xe')](_0xf43741,_0x25dea7)[_0x4f87('0xf')](function(_0x442128){logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4dfb28,_0x4f87('0x12'));logger[_0x4f87('0x13')](_0x4f87('0x14'),_0x4dfb28,'request\x20sent',JSON[_0x4f87('0x15')](_0x442128));if(_0x442128[_0x4f87('0x16')]){if(_0x442128['error']['code']===0x1f4){logger[_0x4f87('0x16')]('MailAccount,\x20%s,\x20%s',_0x4dfb28,_0x442128[_0x4f87('0x16')][_0x4f87('0x17')]);return _0x363b96(_0x442128[_0x4f87('0x16')][_0x4f87('0x17')]);}logger[_0x4f87('0x16')](_0x4f87('0x11'),_0x4dfb28,_0x442128[_0x4f87('0x16')][_0x4f87('0x17')]);return _0x364d09(_0x442128[_0x4f87('0x16')][_0x4f87('0x17')]);}else{logger[_0x4f87('0x10')](_0x4f87('0x11'),_0x4dfb28,_0x4f87('0x12'));_0x364d09(_0x442128[_0x4f87('0x18')][_0x4f87('0x17')]);}})[_0x4f87('0x19')](function(_0x125d3f){logger[_0x4f87('0x16')](_0x4f87('0x11'),_0x4dfb28,_0x125d3f);_0x363b96(_0x125d3f);});});}exports['GetMailAccount']=function(_0x2e84da){var _0x3afcb1=this;return new Promise(function(_0x4f1934,_0x308728){return db[_0x4f87('0x1a')]['findAll']({'raw':_0x2e84da[_0x4f87('0x1b')]?_0x2e84da[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e84da[_0x4f87('0x1b')]?_0x2e84da['options'][_0x4f87('0x1d')]||null:null,'attributes':_0x2e84da[_0x4f87('0x1b')]?_0x2e84da['options']['attributes']||null:null,'limit':_0x2e84da[_0x4f87('0x1b')]?_0x2e84da[_0x4f87('0x1b')][_0x4f87('0x1e')]||null:null,'include':_0x2e84da[_0x4f87('0x1b')]?_0x2e84da[_0x4f87('0x1b')][_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x2e84da[_0x4f87('0x1b')]['include'],function(_0x247a64){return{'model':db[_0x247a64[_0x4f87('0x21')]],'as':_0x247a64['as'],'attributes':_0x247a64[_0x4f87('0x22')],'include':_0x247a64[_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x247a64[_0x4f87('0x1f')],function(_0x24d2bb){return{'model':db[_0x24d2bb[_0x4f87('0x21')]],'as':_0x24d2bb['as'],'attributes':_0x24d2bb[_0x4f87('0x22')],'include':_0x24d2bb[_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x24d2bb[_0x4f87('0x1f')],function(_0x3c2b61){return{'model':db[_0x3c2b61[_0x4f87('0x21')]],'as':_0x3c2b61['as'],'attributes':_0x3c2b61[_0x4f87('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4f87('0xf')](function(_0x284c68){logger[_0x4f87('0x10')](_0x4f87('0x23'),_0x2e84da);logger['debug'](_0x4f87('0x23'),_0x2e84da,JSON[_0x4f87('0x15')](_0x284c68));_0x4f1934(_0x284c68);})['catch'](function(_0xd12c5f){logger[_0x4f87('0x16')](_0x4f87('0x23'),_0xd12c5f[_0x4f87('0x17')],_0x2e84da);_0x308728(_0x3afcb1[_0x4f87('0x16')](0x1f4,_0xd12c5f['message']));});});};exports[_0x4f87('0x24')]=function(_0x370b0f){var _0x3785dc=this;return new Promise(function(_0x54ff9a,_0x8df7f9){return db[_0x4f87('0x1a')][_0x4f87('0x25')]({'raw':_0x370b0f[_0x4f87('0x1b')]?_0x370b0f[_0x4f87('0x1b')][_0x4f87('0x1c')]===undefined?!![]:![]:!![],'where':_0x370b0f['options']?_0x370b0f[_0x4f87('0x1b')][_0x4f87('0x1d')]||null:null,'attributes':_0x370b0f[_0x4f87('0x1b')]?_0x370b0f['options'][_0x4f87('0x22')]||null:null,'include':_0x370b0f[_0x4f87('0x1b')]?_0x370b0f[_0x4f87('0x1b')][_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x370b0f['options'][_0x4f87('0x1f')],function(_0x53cfda){return{'model':db[_0x53cfda[_0x4f87('0x21')]],'as':_0x53cfda['as'],'attributes':_0x53cfda[_0x4f87('0x22')],'include':_0x53cfda[_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x53cfda[_0x4f87('0x1f')],function(_0x20b9a7){return{'model':db[_0x20b9a7[_0x4f87('0x21')]],'as':_0x20b9a7['as'],'attributes':_0x20b9a7[_0x4f87('0x22')],'include':_0x20b9a7[_0x4f87('0x1f')]?_[_0x4f87('0x20')](_0x20b9a7[_0x4f87('0x1f')],function(_0x2aecef){return{'model':db[_0x2aecef['model']],'as':_0x2aecef['as'],'attributes':_0x2aecef['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f87('0xf')](function(_0xf25b60){logger['info']('ShowMailAccount',_0x370b0f);logger[_0x4f87('0x13')]('ShowMailAccount',_0x370b0f,JSON['stringify'](_0xf25b60));_0x54ff9a(_0xf25b60);})[_0x4f87('0x19')](function(_0x36b970){logger['error'](_0x4f87('0x24'),_0x36b970['message'],_0x370b0f);_0x8df7f9(_0x3785dc[_0x4f87('0x16')](0x1f4,_0x36b970[_0x4f87('0x17')]));});});};exports[_0x4f87('0x26')]=function(_0x173773){var _0x59849a=this;return new Promise(function(_0x2a32e6,_0x40c98e){var _0x5a0515={'body':_0x173773[_0x4f87('0x27')],'channel':'mail'};var _0x450ddb=_['difference'](_['keys'](db['CmContact'][_0x4f87('0x28')]),[_0x4f87('0x29'),_0x4f87('0x2a'),'CompanyId','ListId']);var _0x5b7aa4=![];if(_0x173773[_0x4f87('0x27')]['id']){delete _0x173773[_0x4f87('0x27')]['id'];}if(_[_0x4f87('0x2b')](_0x173773['body'][_0x4f87('0x2c')])){return _0x40c98e(_0x59849a[_0x4f87('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x4f87('0x2b')](_0x173773[_0x4f87('0x27')][_0x4f87('0x27')])||_0x173773[_0x4f87('0x27')][_0x4f87('0x27')]===''){return _0x40c98e(_0x59849a[_0x4f87('0x16')](0x1f4,_0x4f87('0x2d')));}if(_['isNil'](_0x173773[_0x4f87('0x27')]['mapKey'])){return _0x40c98e(_0x59849a[_0x4f87('0x16')](0x1f4,_0x4f87('0x2e')+_0x450ddb));}if(!_[_0x4f87('0x2f')](_0x450ddb,_0x173773['body']['mapKey'])){return _0x40c98e(_0x59849a[_0x4f87('0x16')](0x1f4,_0x4f87('0x30')+_0x450ddb));}var _0x370ebf={};_0x370ebf[_0x173773['body'][_0x4f87('0x31')]]=_0x173773['body'][_0x4f87('0x2c')];return db[_0x4f87('0x1a')]['find']({'where':{'id':_0x173773[_0x4f87('0x32')]['id']},'include':[{'model':db[_0x4f87('0x33')],'as':'List','include':[{'model':db[_0x4f87('0x34')],'as':'Contacts','where':_0x370ebf,'limit':0x1,'order':[[_0x4f87('0x2a'),_0x4f87('0x35')]]}]},{'model':db[_0x4f87('0x36')],'as':_0x4f87('0x37')},{'model':db[_0x4f87('0x38')],'as':_0x4f87('0x39')}]})[_0x4f87('0xf')](function(_0x393f2a){if(_0x393f2a&&_0x393f2a['List']){var _0x5238d4=_0x393f2a['get']({'plain':!![]});_0x5a0515['account']=_[_0x4f87('0x3a')](_0x5238d4,[_0x4f87('0x37'),_0x4f87('0x3b')]);_0x5a0515['applications']=_0x5238d4['Applications'];_0x5a0515[_0x4f87('0x3c')]=_0x5238d4['List'];_0x5a0515[_0x4f87('0x3d')]=_[_0x4f87('0x3e')](_0x5a0515[_0x4f87('0x3d')],['priority'],[_0x4f87('0x3f')]);if(_0x5a0515[_0x4f87('0x32')]&&_0x5a0515[_0x4f87('0x32')][_0x4f87('0x40')]){_0x5a0515[_0x4f87('0x3d')][_0x4f87('0x41')]({'id':0x0,'priority':_0x5a0515[_0x4f87('0x3d')][_0x4f87('0x42')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x5a0515[_0x4f87('0x32')][_0x4f87('0x37')]){delete _0x5a0515['account'][_0x4f87('0x37')];}if(_0x5a0515[_0x4f87('0x32')][_0x4f87('0x3b')]){delete _0x5a0515[_0x4f87('0x32')][_0x4f87('0x3b')];}if(_0x5238d4[_0x4f87('0x3b')]['Contacts'][_0x4f87('0x42')]){return _0x5238d4['List'][_0x4f87('0x43')][0x0];}var _0x371277=_['defaults'](_0x173773[_0x4f87('0x27')],{'firstName':_0x173773[_0x4f87('0x27')][_0x4f87('0x2c')],'ListId':_0x5238d4['ListId']});_0x371277[_0x173773[_0x4f87('0x27')]['mapKey']]=_0x173773['body'][_0x4f87('0x2c')];return db[_0x4f87('0x34')][_0x4f87('0x44')](_0x371277);}else{throw new Error(_0x4f87('0x45'));}})['then'](function(_0xb990e5){_0x5a0515[_0x4f87('0x46')]=_0xb990e5;if(_0xb990e5){if(!_0x173773['body'][_0x4f87('0x17')][_0x4f87('0x47')]){_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x47')]=rs[_0x4f87('0x48')]()+'\x20'+_0x173773['body']['message'][_0x4f87('0x2c')];}var _0xdf0532={'ContactId':_0xb990e5['id'],'MailAccountId':_0x173773['account']['id'],'inReplyTo':_0x173773['body']['message'][_0x4f87('0x47')],'to':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')]['from'],'cc':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')]['cc'],'subject':_0x173773[_0x4f87('0x27')]['message'][_0x4f87('0x49')],'attach':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x4a')],'lastMsgAt':moment()[_0x4f87('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x173773[_0x4f87('0x27')]['body']};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x173773[_0x4f87('0x32')]['id']},'include':[{'model':db[_0x4f87('0x4c')],'as':_0x4f87('0x4d'),'attributes':[_0x4f87('0x47')],'where':{'messageId':_0x173773['body'][_0x4f87('0x17')]['inReplyTo']}}]})[_0x4f87('0xf')](function(_0x5283da){if(_0x5283da){return[_0x5283da,![]];}return db[_0x4f87('0x4e')][_0x4f87('0x44')](_0xdf0532)[_0x4f87('0xf')](function(_0x1433ea){return[_0x1433ea,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4f87('0x4f')](function(_0x567104,_0xdd122e){if(_0x567104){_0x5b7aa4=_0xdd122e;if(!_0xdd122e){return _0x567104[_0x4f87('0x50')]({'inReplyTo':_0x173773[_0x4f87('0x27')]['message'][_0x4f87('0x47')],'to':_0x173773[_0x4f87('0x27')]['message'][_0x4f87('0x2c')],'cc':_0x173773['body'][_0x4f87('0x17')]['cc'],'subject':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x49')],'attach':_0x567104[_0x4f87('0x4a')]?_0x567104[_0x4f87('0x4a')]:_0x173773['body'][_0x4f87('0x17')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0x4f87('0x51')),'lastMsgAt':moment()[_0x4f87('0x4b')](_0x4f87('0x51')),'lastMsgDirection':'in','lastMsgBody':_0x173773[_0x4f87('0x27')][_0x4f87('0x27')]});}else{return _0x567104;}}})[_0x4f87('0xf')](function(_0x5d82fb){_0x5a0515['interaction']=_0x5d82fb[_0x4f87('0x52')]({'plain':!![]});_0x5a0515[_0x4f87('0x53')]['created']=_0x5b7aa4;return db[_0x4f87('0x4c')]['create']({'body':_0x173773[_0x4f87('0x27')][_0x4f87('0x27')],'MailAccountId':_0x173773['account']['id'],'MailInteractionId':_0x5d82fb['id'],'direction':'in','ContactId':_0x5a0515[_0x4f87('0x46')]['id'],'messageId':_0x173773[_0x4f87('0x27')]['message'][_0x4f87('0x47')],'from':_0x173773['body']['message'][_0x4f87('0x2c')],'to':_0x173773[_0x4f87('0x27')]['message']['to'],'cc':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')]['cc'],'subject':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x49')],'attach':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x4a')],'Attachments':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x54')],'originTo':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x55')],'originCc':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x56')],'bcc':_0x173773[_0x4f87('0x27')][_0x4f87('0x17')][_0x4f87('0x57')]},{'include':[{'model':db['Attachment'],'as':_0x4f87('0x58')}]});})[_0x4f87('0xf')](function(_0x115e94){_0x5a0515[_0x4f87('0x17')]=_0x115e94;if(_0x5a0515[_0x4f87('0x53')][_0x4f87('0x59')]){return db[_0x4f87('0x5a')]['find']({'attributes':['id','name'],'where':{'id':_0x5a0515['interaction']['UserId']}})[_0x4f87('0xf')](function(_0x41235c){if(_0x41235c){_0x5a0515['applications'][_0x4f87('0x5b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x41235c[_0x4f87('0x5c')]+','+(_0x5a0515[_0x4f87('0x32')][_0x4f87('0x5d')]||0xa),'interval':_0x4f87('0x5e')});}return respondWithRpcPromise('Start',_0x4f87('0x5f'),_0x5a0515);});}return respondWithRpcPromise(_0x4f87('0x60'),_0x4f87('0x5f'),_0x5a0515);})[_0x4f87('0xf')](function(_0x393ff2){_0x2a32e6(_0x393ff2);})[_0x4f87('0x19')](function(_0x28a790){_0x40c98e(_0x59849a[_0x4f87('0x16')](0x1f4,_0x28a790[_0x4f87('0x17')]));});});}; \ No newline at end of file +var _0x876b=['CmContact','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','Smtp','get','omit','Applications','applications','orderBy','priority','asc','autoclose','length','close','defaults','create','List\x20not\x20found','contact','messageId','generate','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Contact\x20not\x20found','spread','update','subject','attach','format','interaction','created','attachments','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetMailAccount','options','raw','attributes','limit','include','map','model','ShowMailAccount','MailAccount','where','NotifyMailAccount','body','mail','difference'];(function(_0x5a70a2,_0xf1e7f9){var _0x1c88fd=function(_0x2b36f3){while(--_0x2b36f3){_0x5a70a2['push'](_0x5a70a2['shift']());}};_0x1c88fd(++_0xf1e7f9);}(_0x876b,0x1ba));var _0xb876=function(_0x3f1c4a,_0x3a8f1b){_0x3f1c4a=_0x3f1c4a-0x0;var _0x346a49=_0x876b[_0x3f1c4a];return _0x346a49;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb876('0x0'));var BPromise=require(_0xb876('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb876('0x2'))['db'];var utils=require(_0xb876('0x3'));var logger=require('../../config/logger')(_0xb876('0x4'));var config=require(_0xb876('0x5'));var jayson=require(_0xb876('0x6'));var client=jayson['client'][_0xb876('0x7')]({'port':0x232c});config[_0xb876('0x8')]=_['defaults'](config[_0xb876('0x8')],{'host':_0xb876('0x9'),'port':0x18eb});var socket=require(_0xb876('0xa'))(new Redis(config[_0xb876('0x8')]));require('./mailAccount.socket')[_0xb876('0xb')](socket);function respondWithRpcPromise(_0x488dc4,_0x4770a2,_0x26bbb5){return new BPromise(function(_0x59a812,_0x5cd511){return client['request'](_0x488dc4,_0x26bbb5)[_0xb876('0xc')](function(_0x5a0da3){logger[_0xb876('0xd')](_0xb876('0xe'),_0x4770a2,'request\x20sent');logger[_0xb876('0xf')](_0xb876('0x10'),_0x4770a2,_0xb876('0x11'),JSON[_0xb876('0x12')](_0x5a0da3));if(_0x5a0da3[_0xb876('0x13')]){if(_0x5a0da3[_0xb876('0x13')][_0xb876('0x14')]===0x1f4){logger[_0xb876('0x13')](_0xb876('0xe'),_0x4770a2,_0x5a0da3[_0xb876('0x13')][_0xb876('0x15')]);return _0x5cd511(_0x5a0da3[_0xb876('0x13')]['message']);}logger[_0xb876('0x13')](_0xb876('0xe'),_0x4770a2,_0x5a0da3[_0xb876('0x13')][_0xb876('0x15')]);return _0x59a812(_0x5a0da3[_0xb876('0x13')][_0xb876('0x15')]);}else{logger['info'](_0xb876('0xe'),_0x4770a2,_0xb876('0x11'));_0x59a812(_0x5a0da3['result']['message']);}})[_0xb876('0x16')](function(_0x2af9c8){logger[_0xb876('0x13')]('MailAccount,\x20%s,\x20%s',_0x4770a2,_0x2af9c8);_0x5cd511(_0x2af9c8);});});}exports[_0xb876('0x17')]=function(_0x19b249){var _0x51a7ab=this;return new Promise(function(_0xf14899,_0x10b085){return db['MailAccount']['findAll']({'raw':_0x19b249['options']?_0x19b249[_0xb876('0x18')][_0xb876('0x19')]===undefined?!![]:![]:!![],'where':_0x19b249[_0xb876('0x18')]?_0x19b249[_0xb876('0x18')]['where']||null:null,'attributes':_0x19b249[_0xb876('0x18')]?_0x19b249[_0xb876('0x18')][_0xb876('0x1a')]||null:null,'limit':_0x19b249[_0xb876('0x18')]?_0x19b249[_0xb876('0x18')][_0xb876('0x1b')]||null:null,'include':_0x19b249[_0xb876('0x18')]?_0x19b249[_0xb876('0x18')][_0xb876('0x1c')]?_[_0xb876('0x1d')](_0x19b249[_0xb876('0x18')][_0xb876('0x1c')],function(_0x30a7f8){return{'model':db[_0x30a7f8[_0xb876('0x1e')]],'as':_0x30a7f8['as'],'attributes':_0x30a7f8[_0xb876('0x1a')],'include':_0x30a7f8[_0xb876('0x1c')]?_[_0xb876('0x1d')](_0x30a7f8['include'],function(_0x118824){return{'model':db[_0x118824[_0xb876('0x1e')]],'as':_0x118824['as'],'attributes':_0x118824[_0xb876('0x1a')],'include':_0x118824['include']?_[_0xb876('0x1d')](_0x118824[_0xb876('0x1c')],function(_0x11c061){return{'model':db[_0x11c061['model']],'as':_0x11c061['as'],'attributes':_0x11c061[_0xb876('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb876('0xc')](function(_0x5d88ac){logger[_0xb876('0xd')]('GetMailAccount',_0x19b249);logger[_0xb876('0xf')](_0xb876('0x17'),_0x19b249,JSON[_0xb876('0x12')](_0x5d88ac));_0xf14899(_0x5d88ac);})[_0xb876('0x16')](function(_0x5bb2b7){logger[_0xb876('0x13')](_0xb876('0x17'),_0x5bb2b7[_0xb876('0x15')],_0x19b249);_0x10b085(_0x51a7ab[_0xb876('0x13')](0x1f4,_0x5bb2b7[_0xb876('0x15')]));});});};exports[_0xb876('0x1f')]=function(_0x427851){var _0x4b4da2=this;return new Promise(function(_0x26c9f9,_0x3843e5){return db[_0xb876('0x20')]['find']({'raw':_0x427851['options']?_0x427851[_0xb876('0x18')][_0xb876('0x19')]===undefined?!![]:![]:!![],'where':_0x427851[_0xb876('0x18')]?_0x427851['options'][_0xb876('0x21')]||null:null,'attributes':_0x427851['options']?_0x427851[_0xb876('0x18')][_0xb876('0x1a')]||null:null,'include':_0x427851[_0xb876('0x18')]?_0x427851['options'][_0xb876('0x1c')]?_[_0xb876('0x1d')](_0x427851[_0xb876('0x18')][_0xb876('0x1c')],function(_0x29b70e){return{'model':db[_0x29b70e[_0xb876('0x1e')]],'as':_0x29b70e['as'],'attributes':_0x29b70e[_0xb876('0x1a')],'include':_0x29b70e[_0xb876('0x1c')]?_['map'](_0x29b70e['include'],function(_0x23148e){return{'model':db[_0x23148e[_0xb876('0x1e')]],'as':_0x23148e['as'],'attributes':_0x23148e[_0xb876('0x1a')],'include':_0x23148e[_0xb876('0x1c')]?_['map'](_0x23148e[_0xb876('0x1c')],function(_0x3d162c){return{'model':db[_0x3d162c[_0xb876('0x1e')]],'as':_0x3d162c['as'],'attributes':_0x3d162c[_0xb876('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb876('0xc')](function(_0xbf8dbc){logger[_0xb876('0xd')](_0xb876('0x1f'),_0x427851);logger['debug'](_0xb876('0x1f'),_0x427851,JSON['stringify'](_0xbf8dbc));_0x26c9f9(_0xbf8dbc);})[_0xb876('0x16')](function(_0x1a7882){logger['error']('ShowMailAccount',_0x1a7882[_0xb876('0x15')],_0x427851);_0x3843e5(_0x4b4da2['error'](0x1f4,_0x1a7882[_0xb876('0x15')]));});});};exports[_0xb876('0x22')]=function(_0x1cc915){var _0x233bdf=this;return new Promise(function(_0x29a102,_0x44b51e){var _0x390336={'body':_0x1cc915[_0xb876('0x23')],'channel':_0xb876('0x24')};var _0x2ae372=_[_0xb876('0x25')](_['keys'](db[_0xb876('0x26')]['rawAttributes']),[_0xb876('0x27'),'updatedAt',_0xb876('0x28'),_0xb876('0x29')]);var _0x142234=![];if(_0x1cc915[_0xb876('0x23')]['id']){delete _0x1cc915[_0xb876('0x23')]['id'];}if(_[_0xb876('0x2a')](_0x1cc915[_0xb876('0x23')][_0xb876('0x2b')])){return _0x44b51e(_0x233bdf[_0xb876('0x13')](0x1f4,_0xb876('0x2c')));}if(_[_0xb876('0x2a')](_0x1cc915['body'][_0xb876('0x23')])||_0x1cc915[_0xb876('0x23')][_0xb876('0x23')]===''){return _0x44b51e(_0x233bdf['error'](0x1f4,_0xb876('0x2d')));}if(_['isNil'](_0x1cc915[_0xb876('0x23')][_0xb876('0x2e')])){return _0x44b51e(_0x233bdf[_0xb876('0x13')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae372));}if(!_[_0xb876('0x2f')](_0x2ae372,_0x1cc915['body'][_0xb876('0x2e')])){return _0x44b51e(_0x233bdf['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2ae372));}var _0x17c650={};_0x17c650[_0x1cc915[_0xb876('0x23')]['mapKey']]=_0x1cc915[_0xb876('0x23')][_0xb876('0x2b')];return db[_0xb876('0x20')]['find']({'where':{'id':_0x1cc915[_0xb876('0x30')]['id']},'include':[{'model':db[_0xb876('0x31')],'as':_0xb876('0x32'),'include':[{'model':db['CmContact'],'as':_0xb876('0x33'),'where':_0x17c650,'limit':0x1,'order':[['updatedAt',_0xb876('0x34')]]}]},{'model':db[_0xb876('0x35')],'as':'Applications'},{'model':db[_0xb876('0x36')],'as':_0xb876('0x37')}]})[_0xb876('0xc')](function(_0x30af05){if(_0x30af05&&_0x30af05[_0xb876('0x32')]){var _0x2cb6a9=_0x30af05[_0xb876('0x38')]({'plain':!![]});_0x390336[_0xb876('0x30')]=_[_0xb876('0x39')](_0x2cb6a9,[_0xb876('0x3a'),_0xb876('0x32')]);_0x390336[_0xb876('0x3b')]=_0x2cb6a9[_0xb876('0x3a')];_0x390336['list']=_0x2cb6a9['List'];_0x390336['applications']=_[_0xb876('0x3c')](_0x390336[_0xb876('0x3b')],[_0xb876('0x3d')],[_0xb876('0x3e')]);if(_0x390336[_0xb876('0x30')]&&_0x390336[_0xb876('0x30')][_0xb876('0x3f')]){_0x390336[_0xb876('0x3b')]['push']({'id':0x0,'priority':_0x390336[_0xb876('0x3b')][_0xb876('0x40')]+0x1,'app':_0xb876('0x41'),'appdata':_0xb876('0x3f'),'interval':'*,*,*,*'});}if(_0x390336[_0xb876('0x30')][_0xb876('0x3a')]){delete _0x390336[_0xb876('0x30')][_0xb876('0x3a')];}if(_0x390336[_0xb876('0x30')][_0xb876('0x32')]){delete _0x390336['account']['List'];}if(_0x2cb6a9[_0xb876('0x32')][_0xb876('0x33')][_0xb876('0x40')]){return _0x2cb6a9[_0xb876('0x32')][_0xb876('0x33')][0x0];}var _0x5cd816=_[_0xb876('0x42')](_0x1cc915[_0xb876('0x23')],{'firstName':_0x1cc915[_0xb876('0x23')][_0xb876('0x2b')],'ListId':_0x2cb6a9[_0xb876('0x29')]});_0x5cd816[_0x1cc915[_0xb876('0x23')]['mapKey']]=_0x1cc915[_0xb876('0x23')][_0xb876('0x2b')];return db[_0xb876('0x26')][_0xb876('0x43')](_0x5cd816);}else{throw new Error(_0xb876('0x44'));}})[_0xb876('0xc')](function(_0x179f1a){_0x390336[_0xb876('0x45')]=_0x179f1a;if(_0x179f1a){if(!_0x1cc915[_0xb876('0x23')][_0xb876('0x15')][_0xb876('0x46')]){_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['messageId']=rs[_0xb876('0x47')]()+'\x20'+_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['from'];}var _0x24e6ba={'ContactId':_0x179f1a['id'],'MailAccountId':_0x1cc915['account']['id'],'inReplyTo':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')][_0xb876('0x46')],'to':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')][_0xb876('0x2b')],'cc':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['cc'],'subject':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['subject'],'attach':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['attach'],'lastMsgAt':moment()['format'](_0xb876('0x48')),'lastMsgDirection':'in','lastMsgBody':_0x1cc915['body'][_0xb876('0x23')]};return db[_0xb876('0x49')][_0xb876('0x4a')]({'where':{'closed':![],'MailAccountId':_0x1cc915[_0xb876('0x30')]['id']},'include':[{'model':db[_0xb876('0x4b')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x1cc915[_0xb876('0x23')]['message']['inReplyTo']}}]})[_0xb876('0xc')](function(_0x4631f8){if(_0x4631f8){return[_0x4631f8,![]];}return db[_0xb876('0x49')][_0xb876('0x43')](_0x24e6ba)[_0xb876('0xc')](function(_0x27556c){return[_0x27556c,!![]];});});}else{throw new Error(_0xb876('0x4c'));}})[_0xb876('0x4d')](function(_0x55ff2f,_0x5ebeea){if(_0x55ff2f){_0x142234=_0x5ebeea;if(!_0x5ebeea){return _0x55ff2f[_0xb876('0x4e')]({'inReplyTo':_0x1cc915[_0xb876('0x23')]['message']['messageId'],'to':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')][_0xb876('0x2b')],'cc':_0x1cc915['body'][_0xb876('0x15')]['cc'],'subject':_0x1cc915['body'][_0xb876('0x15')][_0xb876('0x4f')],'attach':_0x55ff2f[_0xb876('0x50')]?_0x55ff2f[_0xb876('0x50')]:_0x1cc915['body'][_0xb876('0x15')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xb876('0x48')),'lastMsgAt':moment()[_0xb876('0x51')](_0xb876('0x48')),'lastMsgDirection':'in','lastMsgBody':_0x1cc915[_0xb876('0x23')][_0xb876('0x23')]});}else{return _0x55ff2f;}}})[_0xb876('0xc')](function(_0x1c757c){_0x390336['interaction']=_0x1c757c['get']({'plain':!![]});_0x390336[_0xb876('0x52')][_0xb876('0x53')]=_0x142234;return db[_0xb876('0x4b')][_0xb876('0x43')]({'body':_0x1cc915[_0xb876('0x23')][_0xb876('0x23')],'MailAccountId':_0x1cc915['account']['id'],'MailInteractionId':_0x1c757c['id'],'direction':'in','ContactId':_0x390336['contact']['id'],'messageId':_0x1cc915[_0xb876('0x23')]['message']['messageId'],'from':_0x1cc915['body'][_0xb876('0x15')]['from'],'to':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['to'],'cc':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['cc'],'subject':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')][_0xb876('0x4f')],'attach':_0x1cc915[_0xb876('0x23')]['message'][_0xb876('0x50')],'Attachments':_0x1cc915[_0xb876('0x23')]['message'][_0xb876('0x54')],'originTo':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['originTo'],'originCc':_0x1cc915['body']['message']['originCc'],'bcc':_0x1cc915[_0xb876('0x23')][_0xb876('0x15')]['bcc']},{'include':[{'model':db[_0xb876('0x55')],'as':_0xb876('0x56')}]});})[_0xb876('0xc')](function(_0x49dc45){_0x390336['message']=_0x49dc45;if(_0x390336['interaction'][_0xb876('0x57')]){return db[_0xb876('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0x390336[_0xb876('0x52')]['UserId']}})[_0xb876('0xc')](function(_0x470665){if(_0x470665){_0x390336[_0xb876('0x3b')][_0xb876('0x59')]({'id':0x0,'priority':0x0,'app':_0xb876('0x5a'),'appdata':_0x470665[_0xb876('0x5b')]+','+(_0x390336[_0xb876('0x30')][_0xb876('0x5c')]||0xa),'interval':_0xb876('0x5d')});}return respondWithRpcPromise('Start',_0xb876('0x5e'),_0x390336);});}return respondWithRpcPromise(_0xb876('0x5f'),'startRouting',_0x390336);})['then'](function(_0x3c522f){_0x29a102(_0x3c522f);})['catch'](function(_0x51b25f){_0x44b51e(_0x233bdf[_0xb876('0x13')](0x1f4,_0x51b25f[_0xb876('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 8d06a8a..79c9966 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 _0xeff8=['update','emit','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x2b66b2,_0x5350e6){var _0xe7861e=function(_0x2ea2bc){while(--_0x2ea2bc){_0x2b66b2['push'](_0x2b66b2['shift']());}};_0xe7861e(++_0x5350e6);}(_0xeff8,0x186));var _0x8eff=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xeff8[_0xf0bc07];return _0x1c50c2;};'use strict';var MailAccountEvents=require(_0x8eff('0x0'));var events=[_0x8eff('0x1'),'remove',_0x8eff('0x2')];function createListener(_0x354ff4,_0x1e55a0){return function(_0x55e437){_0x1e55a0[_0x8eff('0x3')](_0x354ff4,_0x55e437);};}function removeListener(_0x2a6581,_0x4ba2bf){return function(){MailAccountEvents[_0x8eff('0x4')](_0x2a6581,_0x4ba2bf);};}exports['register']=function(_0x469641){for(var _0xb54063=0x0,_0x3409bc=events[_0x8eff('0x5')];_0xb54063<_0x3409bc;_0xb54063++){var _0x491f01=events[_0xb54063];var _0x3fb9ee=createListener(_0x8eff('0x6')+_0x491f01,_0x469641);MailAccountEvents['on'](_0x491f01,_0x3fb9ee);}}; \ No newline at end of file +var _0x7250=['save','update','emit','removeListener','length','mailAccount:','./mailAccount.events'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7250,0x1b1));var _0x0725=function(_0x103b9f,_0x345f23){_0x103b9f=_0x103b9f-0x0;var _0x5864a1=_0x7250[_0x103b9f];return _0x5864a1;};'use strict';var MailAccountEvents=require(_0x0725('0x0'));var events=[_0x0725('0x1'),'remove',_0x0725('0x2')];function createListener(_0x3e49e4,_0xd0941a){return function(_0x351545){_0xd0941a[_0x0725('0x3')](_0x3e49e4,_0x351545);};}function removeListener(_0x4724ef,_0x53cc59){return function(){MailAccountEvents[_0x0725('0x4')](_0x4724ef,_0x53cc59);};}exports['register']=function(_0x4e8c6c){for(var _0xa32c3f=0x0,_0x4b8653=events[_0x0725('0x5')];_0xa32c3f<_0x4b8653;_0xa32c3f++){var _0x415a9c=events[_0xa32c3f];var _0x49bed0=createListener(_0x0725('0x6')+_0x415a9c,_0x4e8c6c);MailAccountEvents['on'](_0x415a9c,_0x49bed0);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index da51da4..3b7bcb8 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 _0x6b20=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','multer'];(function(_0x589eb0,_0x44ab99){var _0x295c4a=function(_0xa44b4d){while(--_0xa44b4d){_0x589eb0['push'](_0x589eb0['shift']());}};_0x295c4a(++_0x44ab99);}(_0x6b20,0xd1));var _0x06b2=function(_0x30f48b,_0x1a4711){_0x30f48b=_0x30f48b-0x0;var _0xe660ca=_0x6b20[_0x30f48b];return _0xe660ca;};'use strict';var multer=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var path=require('path');var timeout=require(_0x06b2('0x2'));var express=require('express');var router=express[_0x06b2('0x3')]();var auth=require(_0x06b2('0x4'));var interaction=require(_0x06b2('0x5'));var config=require('../../config/environment');var controller=require(_0x06b2('0x6'));router[_0x06b2('0x7')](_0x06b2('0x8'),auth[_0x06b2('0x9')](),controller[_0x06b2('0xa')]);router[_0x06b2('0xb')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xc')]);router[_0x06b2('0xd')](_0x06b2('0x8'),auth['isAuthenticated'](),controller[_0x06b2('0xe')]);module['exports']=router; \ No newline at end of file +var _0x16d2=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update'];(function(_0x16c55d,_0x552273){var _0x2e3c00=function(_0x399e91){while(--_0x399e91){_0x16c55d['push'](_0x16c55d['shift']());}};_0x2e3c00(++_0x552273);}(_0x16d2,0x123));var _0x216d=function(_0x4e7390,_0x38ab2d){_0x4e7390=_0x4e7390-0x0;var _0x51640e=_0x16d2[_0x4e7390];return _0x51640e;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var auth=require(_0x216d('0x6'));var interaction=require(_0x216d('0x7'));var config=require(_0x216d('0x8'));var controller=require('./mailApplication.controller');router[_0x216d('0x9')](_0x216d('0xa'),auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xd')](_0x216d('0xa'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['delete'](_0x216d('0xa'),auth[_0x216d('0xb')](),controller[_0x216d('0xf')]);module[_0x216d('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 34a8359..9dbb7e4 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 _0xa0b5=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x4ad2cc,_0x158255){var _0x4a662b=function(_0x39d532){while(--_0x39d532){_0x4ad2cc['push'](_0x4ad2cc['shift']());}};_0x4a662b(++_0x158255);}(_0xa0b5,0x67));var _0x5a0b=function(_0x240511,_0x412061){_0x240511=_0x240511-0x0;var _0x1a83fb=_0xa0b5[_0x240511];return _0x1a83fb;};'use strict';var Sequelize=require(_0x5a0b('0x0'));module[_0x5a0b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5a0b('0x2')],'allowNull':![],'defaultValue':_0x5a0b('0x3')},'appdata':{'type':Sequelize[_0x5a0b('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5a0b('0x2')],'defaultValue':_0x5a0b('0x5')}}; \ No newline at end of file +var _0xdef5=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x389521,_0x2fda7e){var _0x2c4326=function(_0x26e9a2){while(--_0x26e9a2){_0x389521['push'](_0x389521['shift']());}};_0x2c4326(++_0x2fda7e);}(_0xdef5,0x162));var _0x5def=function(_0x1eaeae,_0x83a004){_0x1eaeae=_0x1eaeae-0x0;var _0x464fcd=_0xdef5[_0x1eaeae];return _0x464fcd;};'use strict';var Sequelize=require(_0x5def('0x0'));module[_0x5def('0x1')]={'priority':{'type':Sequelize[_0x5def('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5def('0x3')],'allowNull':![],'defaultValue':_0x5def('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x5def('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5def('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b0bb862..1195f38 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 _0xb5c8=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','model','keys','MailApplication','rawAttributes','query','filtears','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','params','html-pdf','fast-json-patch','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x484d71,_0x23ff15){var _0x170a1a=function(_0x581d79){while(--_0x581d79){_0x484d71['push'](_0x484d71['shift']());}};_0x170a1a(++_0x23ff15);}(_0xb5c8,0x103));var _0x8b5c=function(_0x4e5481,_0x322281){_0x4e5481=_0x4e5481-0x0;var _0x3b5db7=_0xb5c8[_0x4e5481];return _0x3b5db7;};'use strict';var pdf=require(_0x8b5c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b5c('0x1'));var rp=require(_0x8b5c('0x2'));var moment=require(_0x8b5c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8b5c('0x4'));var util=require('util');var path=require(_0x8b5c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b5c('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b5c('0x7'));var crypto=require(_0x8b5c('0x8'));var jsforce=require(_0x8b5c('0x9'));var deskjs=require(_0x8b5c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b5c('0xb'));var qs=require(_0x8b5c('0xc'));var as=require(_0x8b5c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b5c('0xe'))(_0x8b5c('0xf'));var utils=require(_0x8b5c('0x10'));var config=require(_0x8b5c('0x11'));var licenseUtil=require(_0x8b5c('0x12'));var db=require(_0x8b5c('0x13'))['db'];function respondWithStatusCode(_0x53b699,_0x3f8833){_0x3f8833=_0x3f8833||0xcc;return function(_0x4fdfe3){if(_0x4fdfe3){return _0x53b699['sendStatus'](_0x3f8833);}return _0x53b699[_0x8b5c('0x14')](_0x3f8833)[_0x8b5c('0x15')]();};}function respondWithResult(_0x1e91a6,_0x28c5b9){_0x28c5b9=_0x28c5b9||0xc8;return function(_0x4e8a5c){if(_0x4e8a5c){return _0x1e91a6[_0x8b5c('0x14')](_0x28c5b9)['json'](_0x4e8a5c);}};}function respondWithFilteredResult(_0x21599c,_0x2fc122){return function(_0x357635){if(_0x357635){var _0x2f8f6c=_0x357635[_0x8b5c('0x16')],_0x3614ed=_0x2fc122[_0x8b5c('0x17')],_0x5f4656=_0x2fc122['offset']+_0x2fc122[_0x8b5c('0x18')],_0x422d85;if(_0x5f4656>=_0x2f8f6c){_0x5f4656=_0x2f8f6c;_0x422d85=0xc8;}else{_0x422d85=0xce;}_0x21599c[_0x8b5c('0x14')](_0x422d85);return _0x21599c[_0x8b5c('0x19')](_0x8b5c('0x1a'),_0x3614ed+'-'+_0x5f4656+'/'+_0x2f8f6c)[_0x8b5c('0x1b')](_0x357635);}return null;};}function patchUpdates(_0xf073f8){return function(_0x2743b6){try{jsonpatch['apply'](_0x2743b6,_0xf073f8,!![]);}catch(_0x4d3f44){return BPromise[_0x8b5c('0x1c')](_0x4d3f44);}return _0x2743b6[_0x8b5c('0x1d')]();};}function saveUpdates(_0x5ef23c,_0x3af179){return function(_0x17eb9d){if(_0x17eb9d){return _0x17eb9d[_0x8b5c('0x1e')](_0x5ef23c)[_0x8b5c('0x1f')](function(_0x5df6f2){return _0x5df6f2;});}return null;};}function removeEntity(_0x4a5f51,_0x3be892){return function(_0x13050b){if(_0x13050b){return _0x13050b[_0x8b5c('0x20')]()[_0x8b5c('0x1f')](function(){_0x4a5f51['status'](0xcc)[_0x8b5c('0x15')]();});}};}function handleEntityNotFound(_0x10f93c,_0x30198a){return function(_0x8830ff){if(!_0x8830ff){_0x10f93c['sendStatus'](0x194);}return _0x8830ff;};}function handleError(_0x57df5d,_0x55c503){_0x55c503=_0x55c503||0x1f4;return function(_0x284b4a){logger[_0x8b5c('0x21')](_0x284b4a[_0x8b5c('0x22')]);if(_0x284b4a[_0x8b5c('0x23')]){delete _0x284b4a[_0x8b5c('0x23')];}_0x57df5d[_0x8b5c('0x14')](_0x55c503)[_0x8b5c('0x24')](_0x284b4a);};}exports['show']=function(_0x194cf8,_0x3738df){var _0x1f455f={'raw':!![],'where':{'id':_0x194cf8['params']['id']}},_0x546cd8={};_0x546cd8[_0x8b5c('0x25')]=_[_0x8b5c('0x26')](db[_0x8b5c('0x27')][_0x8b5c('0x28')]);_0x546cd8[_0x8b5c('0x29')]=_[_0x8b5c('0x26')](_0x194cf8[_0x8b5c('0x29')]);_0x546cd8[_0x8b5c('0x2a')]=_[_0x8b5c('0x2b')](_0x546cd8[_0x8b5c('0x25')],_0x546cd8[_0x8b5c('0x29')]);_0x1f455f[_0x8b5c('0x2c')]=_[_0x8b5c('0x2b')](_0x546cd8['model'],qs[_0x8b5c('0x2d')](_0x194cf8['query'][_0x8b5c('0x2d')]));_0x1f455f[_0x8b5c('0x2c')]=_0x1f455f[_0x8b5c('0x2c')][_0x8b5c('0x2e')]?_0x1f455f[_0x8b5c('0x2c')]:_0x546cd8['model'];if(_0x194cf8[_0x8b5c('0x29')][_0x8b5c('0x2f')]){_0x1f455f[_0x8b5c('0x30')]=[{'all':!![]}];}_0x1f455f=_[_0x8b5c('0x31')]({},_0x1f455f,_0x194cf8[_0x8b5c('0x32')]);return db['MailApplication'][_0x8b5c('0x33')](_0x1f455f)[_0x8b5c('0x1f')](handleEntityNotFound(_0x3738df,null))[_0x8b5c('0x1f')](respondWithResult(_0x3738df,null))[_0x8b5c('0x34')](handleError(_0x3738df,null));};exports['update']=function(_0x35678a,_0x1e18d4){if(_0x35678a['body']['id']){delete _0x35678a[_0x8b5c('0x35')]['id'];}return db[_0x8b5c('0x27')]['find']({'where':{'id':_0x35678a[_0x8b5c('0x36')]['id']}})[_0x8b5c('0x1f')](handleEntityNotFound(_0x1e18d4,null))[_0x8b5c('0x1f')](saveUpdates(_0x35678a[_0x8b5c('0x35')],null))[_0x8b5c('0x1f')](respondWithResult(_0x1e18d4,null))[_0x8b5c('0x34')](handleError(_0x1e18d4,null));};exports[_0x8b5c('0x20')]=function(_0x1f42fe,_0x583110){return db[_0x8b5c('0x27')]['find']({'where':{'id':_0x1f42fe['params']['id']}})[_0x8b5c('0x1f')](handleEntityNotFound(_0x583110,null))[_0x8b5c('0x1f')](removeEntity(_0x583110,null))[_0x8b5c('0x34')](handleError(_0x583110,null));}; \ No newline at end of file +var _0x9f18=['stack','name','show','params','keys','MailApplication','rawAttributes','query','intersection','model','attributes','fields','includeAll','include','options','find','catch','update','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','apply','reject','save','then','error'];(function(_0x5189d6,_0x557268){var _0xb04855=function(_0x49d867){while(--_0x49d867){_0x5189d6['push'](_0x5189d6['shift']());}};_0xb04855(++_0x557268);}(_0x9f18,0x1df));var _0x89f1=function(_0x18aaaf,_0x385db6){_0x18aaaf=_0x18aaaf-0x0;var _0x52d892=_0x9f18[_0x18aaaf];return _0x52d892;};'use strict';var pdf=require(_0x89f1('0x0'));var emlformat=require(_0x89f1('0x1'));var rimraf=require(_0x89f1('0x2'));var zipdir=require(_0x89f1('0x3'));var jsonpatch=require(_0x89f1('0x4'));var rp=require(_0x89f1('0x5'));var moment=require(_0x89f1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x89f1('0x7'));var util=require('util');var path=require(_0x89f1('0x8'));var sox=require('sox');var csv=require(_0x89f1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x89f1('0xa'));var squel=require(_0x89f1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89f1('0x9'));var querystring=require(_0x89f1('0xc'));var Papa=require(_0x89f1('0xd'));var Redis=require(_0x89f1('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x89f1('0xf'));var as=require(_0x89f1('0x10'));var hardwareService=require(_0x89f1('0x11'));var logger=require('../../config/logger')(_0x89f1('0x12'));var utils=require(_0x89f1('0x13'));var config=require(_0x89f1('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37753a,_0x1eddce){_0x1eddce=_0x1eddce||0xcc;return function(_0x164c9c){if(_0x164c9c){return _0x37753a[_0x89f1('0x15')](_0x1eddce);}return _0x37753a[_0x89f1('0x16')](_0x1eddce)[_0x89f1('0x17')]();};}function respondWithResult(_0x4d203c,_0x54fc43){_0x54fc43=_0x54fc43||0xc8;return function(_0x196549){if(_0x196549){return _0x4d203c[_0x89f1('0x16')](_0x54fc43)[_0x89f1('0x18')](_0x196549);}};}function respondWithFilteredResult(_0x1dd8c9,_0x783605){return function(_0x866fa9){if(_0x866fa9){var _0x1f67e7=_0x866fa9['count'],_0x4ea229=_0x783605[_0x89f1('0x19')],_0x298c9a=_0x783605['offset']+_0x783605['limit'],_0x1acf5b;if(_0x298c9a>=_0x1f67e7){_0x298c9a=_0x1f67e7;_0x1acf5b=0xc8;}else{_0x1acf5b=0xce;}_0x1dd8c9[_0x89f1('0x16')](_0x1acf5b);return _0x1dd8c9['set']('Content-Range',_0x4ea229+'-'+_0x298c9a+'/'+_0x1f67e7)[_0x89f1('0x18')](_0x866fa9);}return null;};}function patchUpdates(_0x5a86a7){return function(_0x4a8e59){try{jsonpatch[_0x89f1('0x1a')](_0x4a8e59,_0x5a86a7,!![]);}catch(_0x4f056e){return BPromise[_0x89f1('0x1b')](_0x4f056e);}return _0x4a8e59[_0x89f1('0x1c')]();};}function saveUpdates(_0x3b5dc5,_0x51fb8d){return function(_0x2f2494){if(_0x2f2494){return _0x2f2494['update'](_0x3b5dc5)[_0x89f1('0x1d')](function(_0x583281){return _0x583281;});}return null;};}function removeEntity(_0x50c4b1,_0x29b926){return function(_0xff61a2){if(_0xff61a2){return _0xff61a2['destroy']()[_0x89f1('0x1d')](function(){_0x50c4b1[_0x89f1('0x16')](0xcc)[_0x89f1('0x17')]();});}};}function handleEntityNotFound(_0x16c653,_0x3d3054){return function(_0x3eec80){if(!_0x3eec80){_0x16c653[_0x89f1('0x15')](0x194);}return _0x3eec80;};}function handleError(_0x269798,_0x4648c2){_0x4648c2=_0x4648c2||0x1f4;return function(_0x27316a){logger[_0x89f1('0x1e')](_0x27316a[_0x89f1('0x1f')]);if(_0x27316a[_0x89f1('0x20')]){delete _0x27316a[_0x89f1('0x20')];}_0x269798[_0x89f1('0x16')](_0x4648c2)['send'](_0x27316a);};}exports[_0x89f1('0x21')]=function(_0x2e7a99,_0x2b7ded){var _0x882bbd={'raw':!![],'where':{'id':_0x2e7a99[_0x89f1('0x22')]['id']}},_0x2a6847={};_0x2a6847['model']=_[_0x89f1('0x23')](db[_0x89f1('0x24')][_0x89f1('0x25')]);_0x2a6847[_0x89f1('0x26')]=_[_0x89f1('0x23')](_0x2e7a99[_0x89f1('0x26')]);_0x2a6847['filtears']=_[_0x89f1('0x27')](_0x2a6847[_0x89f1('0x28')],_0x2a6847[_0x89f1('0x26')]);_0x882bbd[_0x89f1('0x29')]=_['intersection'](_0x2a6847[_0x89f1('0x28')],qs[_0x89f1('0x2a')](_0x2e7a99['query'][_0x89f1('0x2a')]));_0x882bbd[_0x89f1('0x29')]=_0x882bbd[_0x89f1('0x29')]['length']?_0x882bbd['attributes']:_0x2a6847[_0x89f1('0x28')];if(_0x2e7a99[_0x89f1('0x26')][_0x89f1('0x2b')]){_0x882bbd[_0x89f1('0x2c')]=[{'all':!![]}];}_0x882bbd=_['merge']({},_0x882bbd,_0x2e7a99[_0x89f1('0x2d')]);return db[_0x89f1('0x24')][_0x89f1('0x2e')](_0x882bbd)['then'](handleEntityNotFound(_0x2b7ded,null))[_0x89f1('0x1d')](respondWithResult(_0x2b7ded,null))[_0x89f1('0x2f')](handleError(_0x2b7ded,null));};exports[_0x89f1('0x30')]=function(_0x128bd1,_0x188b4d){if(_0x128bd1[_0x89f1('0x31')]['id']){delete _0x128bd1[_0x89f1('0x31')]['id'];}return db[_0x89f1('0x24')][_0x89f1('0x2e')]({'where':{'id':_0x128bd1[_0x89f1('0x22')]['id']}})[_0x89f1('0x1d')](handleEntityNotFound(_0x188b4d,null))[_0x89f1('0x1d')](saveUpdates(_0x128bd1[_0x89f1('0x31')],null))[_0x89f1('0x1d')](respondWithResult(_0x188b4d,null))[_0x89f1('0x2f')](handleError(_0x188b4d,null));};exports[_0x89f1('0x32')]=function(_0x5149e7,_0x6da494){return db['MailApplication'][_0x89f1('0x2e')]({'where':{'id':_0x5149e7[_0x89f1('0x22')]['id']}})[_0x89f1('0x1d')](handleEntityNotFound(_0x6da494,null))['then'](removeEntity(_0x6da494,null))[_0x89f1('0x2f')](handleError(_0x6da494,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e07b6c7..5ea41fc 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 _0x1f92=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x59ccbf,_0x4c6512){var _0x297837=function(_0x4fd149){while(--_0x4fd149){_0x59ccbf['push'](_0x59ccbf['shift']());}};_0x297837(++_0x4c6512);}(_0x1f92,0x1ad));var _0x21f9=function(_0x4aa399,_0x20874c){_0x4aa399=_0x4aa399-0x0;var _0x335f21=_0x1f92[_0x4aa399];return _0x335f21;};'use strict';var _=require(_0x21f9('0x0'));var util=require('util');var logger=require(_0x21f9('0x1'))(_0x21f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x21f9('0x3'));var fs=require('fs');var path=require(_0x21f9('0x4'));var rimraf=require(_0x21f9('0x5'));var config=require(_0x21f9('0x6'));var attributes=require(_0x21f9('0x7'));module[_0x21f9('0x8')]=function(_0x259f4e,_0x3be0f2){return _0x259f4e[_0x21f9('0x9')](_0x21f9('0xa'),attributes,{'tableName':_0x21f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21f9('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x806d=['request-promise','path','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x49aeb5,_0x19e609){var _0x4f375b=function(_0x1b7d06){while(--_0x1b7d06){_0x49aeb5['push'](_0x49aeb5['shift']());}};_0x4f375b(++_0x19e609);}(_0x806d,0x131));var _0xd806=function(_0x5194e9,_0x59fa02){_0x5194e9=_0x5194e9-0x0;var _0x148d8f=_0x806d[_0x5194e9];return _0x148d8f;};'use strict';var _=require(_0xd806('0x0'));var util=require(_0xd806('0x1'));var logger=require(_0xd806('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd806('0x3'));var fs=require('fs');var path=require(_0xd806('0x4'));var rimraf=require('rimraf');var config=require(_0xd806('0x5'));var attributes=require('./mailApplication.attributes');module[_0xd806('0x6')]=function(_0x70dd3,_0x3d21d4){return _0x70dd3[_0xd806('0x7')](_0xd806('0x8'),attributes,{'tableName':_0xd806('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd806('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5a6d517..661925c 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 _0xc073=['update','body','options','limit','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0xc073,0x1c8));var _0x3c07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc073[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c07('0x0'));var util=require(_0x3c07('0x1'));var moment=require(_0x3c07('0x2'));var BPromise=require('bluebird');var rs=require(_0x3c07('0x3'));var fs=require('fs');var Redis=require(_0x3c07('0x4'));var db=require(_0x3c07('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3c07('0x6'));var config=require(_0x3c07('0x7'));var jayson=require(_0x3c07('0x8'));var client=jayson[_0x3c07('0x9')][_0x3c07('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x363aeb,_0x1334ad,_0x45850b){return new BPromise(function(_0x39ef1e,_0x201a24){return client[_0x3c07('0xb')](_0x363aeb,_0x45850b)[_0x3c07('0xc')](function(_0x4a358d){logger[_0x3c07('0xd')](_0x3c07('0xe'),_0x1334ad,_0x3c07('0xf'));logger['debug'](_0x3c07('0x10'),_0x1334ad,'request\x20sent',JSON[_0x3c07('0x11')](_0x4a358d));if(_0x4a358d[_0x3c07('0x12')]){if(_0x4a358d[_0x3c07('0x12')][_0x3c07('0x13')]===0x1f4){logger['error'](_0x3c07('0xe'),_0x1334ad,_0x4a358d[_0x3c07('0x12')][_0x3c07('0x14')]);return _0x201a24(_0x4a358d[_0x3c07('0x12')]['message']);}logger[_0x3c07('0x12')]('MailApplication,\x20%s,\x20%s',_0x1334ad,_0x4a358d[_0x3c07('0x12')][_0x3c07('0x14')]);return _0x39ef1e(_0x4a358d['error'][_0x3c07('0x14')]);}else{logger[_0x3c07('0xd')](_0x3c07('0xe'),_0x1334ad,_0x3c07('0xf'));_0x39ef1e(_0x4a358d[_0x3c07('0x15')][_0x3c07('0x14')]);}})['catch'](function(_0x3e6696){logger[_0x3c07('0x12')](_0x3c07('0xe'),_0x1334ad,_0x3e6696);_0x201a24(_0x3e6696);});});}exports[_0x3c07('0x16')]=function(_0x30fe28){var _0x35e29c=this;return new Promise(function(_0xed692a,_0x4b9195){return db[_0x3c07('0x17')][_0x3c07('0x18')](_0x30fe28[_0x3c07('0x19')],{'raw':_0x30fe28[_0x3c07('0x1a')]?_0x30fe28[_0x3c07('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30fe28[_0x3c07('0x1a')]?_0x30fe28[_0x3c07('0x1a')]['where']||null:null,'attributes':_0x30fe28[_0x3c07('0x1a')]?_0x30fe28[_0x3c07('0x1a')]['attributes']||null:null,'limit':_0x30fe28['options']?_0x30fe28[_0x3c07('0x1a')][_0x3c07('0x1b')]||null:null})[_0x3c07('0xc')](function(_0x2cbb66){logger['info']('UpdateMailApplication',_0x30fe28);logger[_0x3c07('0x1c')]('UpdateMailApplication',_0x30fe28,JSON[_0x3c07('0x11')](_0x2cbb66));_0xed692a(_0x2cbb66);})[_0x3c07('0x1d')](function(_0x3da9e3){logger['error'](_0x3c07('0x16'),_0x3da9e3[_0x3c07('0x14')],_0x30fe28);_0x4b9195(_0x35e29c[_0x3c07('0x12')](0x1f4,_0x3da9e3['message']));});});}; \ No newline at end of file +var _0x8723=['UpdateMailApplication','body','options','raw','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4e2234,_0x4f2d54){var _0x437a37=function(_0xdc01dd){while(--_0xdc01dd){_0x4e2234['push'](_0x4e2234['shift']());}};_0x437a37(++_0x4f2d54);}(_0x8723,0x80));var _0x3872=function(_0x5d7b48,_0x5d3d03){_0x5d7b48=_0x5d7b48-0x0;var _0x1936ac=_0x8723[_0x5d7b48];return _0x1936ac;};'use strict';var _=require(_0x3872('0x0'));var util=require(_0x3872('0x1'));var moment=require(_0x3872('0x2'));var BPromise=require(_0x3872('0x3'));var rs=require(_0x3872('0x4'));var fs=require('fs');var Redis=require(_0x3872('0x5'));var db=require(_0x3872('0x6'))['db'];var utils=require(_0x3872('0x7'));var logger=require('../../config/logger')(_0x3872('0x8'));var config=require('../../config/environment');var jayson=require(_0x3872('0x9'));var client=jayson[_0x3872('0xa')][_0x3872('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ef241,_0x31e1c6,_0xaceaa0){return new BPromise(function(_0x5853fb,_0x42cb89){return client[_0x3872('0xc')](_0x3ef241,_0xaceaa0)[_0x3872('0xd')](function(_0x378672){logger['info'](_0x3872('0xe'),_0x31e1c6,_0x3872('0xf'));logger[_0x3872('0x10')](_0x3872('0x11'),_0x31e1c6,'request\x20sent',JSON[_0x3872('0x12')](_0x378672));if(_0x378672[_0x3872('0x13')]){if(_0x378672[_0x3872('0x13')]['code']===0x1f4){logger[_0x3872('0x13')](_0x3872('0xe'),_0x31e1c6,_0x378672['error'][_0x3872('0x14')]);return _0x42cb89(_0x378672[_0x3872('0x13')]['message']);}logger['error'](_0x3872('0xe'),_0x31e1c6,_0x378672[_0x3872('0x13')]['message']);return _0x5853fb(_0x378672[_0x3872('0x13')][_0x3872('0x14')]);}else{logger['info'](_0x3872('0xe'),_0x31e1c6,_0x3872('0xf'));_0x5853fb(_0x378672['result']['message']);}})[_0x3872('0x15')](function(_0x2d323a){logger[_0x3872('0x13')](_0x3872('0xe'),_0x31e1c6,_0x2d323a);_0x42cb89(_0x2d323a);});});}exports[_0x3872('0x16')]=function(_0x11234d){var _0x579f6f=this;return new Promise(function(_0x1a8ee5,_0x19a178){return db['MailApplication']['update'](_0x11234d[_0x3872('0x17')],{'raw':_0x11234d[_0x3872('0x18')]?_0x11234d[_0x3872('0x18')][_0x3872('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11234d['options']?_0x11234d[_0x3872('0x18')][_0x3872('0x1a')]||null:null,'attributes':_0x11234d[_0x3872('0x18')]?_0x11234d[_0x3872('0x18')][_0x3872('0x1b')]||null:null,'limit':_0x11234d[_0x3872('0x18')]?_0x11234d[_0x3872('0x18')][_0x3872('0x1c')]||null:null})[_0x3872('0xd')](function(_0xcba1eb){logger[_0x3872('0x1d')](_0x3872('0x16'),_0x11234d);logger['debug']('UpdateMailApplication',_0x11234d,JSON[_0x3872('0x12')](_0xcba1eb));_0x1a8ee5(_0xcba1eb);})[_0x3872('0x15')](function(_0x5172a1){logger[_0x3872('0x13')](_0x3872('0x16'),_0x5172a1[_0x3872('0x14')],_0x11234d);_0x19a178(_0x579f6f[_0x3872('0x13')](0x1f4,_0x5172a1[_0x3872('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5dab3bf..7398399 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 _0xac65=['express','Router','../../components/auth/service','../../config/environment','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','update','mailinteraction:destroy','destroy','delete','removeTags','multer','util','path'];(function(_0x44ecfc,_0x1f8561){var _0x2a3394=function(_0x7ae4b7){while(--_0x7ae4b7){_0x44ecfc['push'](_0x44ecfc['shift']());}};_0x2a3394(++_0x1f8561);}(_0xac65,0x11d));var _0x5ac6=function(_0x35bdd,_0x52169c){_0x35bdd=_0x35bdd-0x0;var _0x57ede5=_0xac65[_0x35bdd];return _0x57ede5;};'use strict';var multer=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var path=require(_0x5ac6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ac6('0x3'));var router=express[_0x5ac6('0x4')]();var auth=require(_0x5ac6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ac6('0x6'));var controller=require(_0x5ac6('0x7'));router[_0x5ac6('0x8')]('/',auth['isAuthenticated'](),controller[_0x5ac6('0x9')]);router[_0x5ac6('0x8')](_0x5ac6('0xa'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0xc')]);router[_0x5ac6('0x8')](_0x5ac6('0xd'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0xe')]);router[_0x5ac6('0x8')](_0x5ac6('0xf'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0x10')]);router[_0x5ac6('0x8')](_0x5ac6('0x11'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0x12')]);router[_0x5ac6('0x13')]('/',auth[_0x5ac6('0xb')](),controller[_0x5ac6('0x14')]);router[_0x5ac6('0x13')](_0x5ac6('0xf'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0x15')]);router[_0x5ac6('0x13')](_0x5ac6('0x16'),auth['isAuthenticated'](),interaction[_0x5ac6('0x17')](_0x5ac6('0x18'),_0x5ac6('0x19')),controller['addTags']);router[_0x5ac6('0x1a')](_0x5ac6('0xd'),auth[_0x5ac6('0xb')](),interaction[_0x5ac6('0x17')](_0x5ac6('0x18'),'mailinteraction:update'),controller[_0x5ac6('0x1b')]);router['delete']('/:id',auth[_0x5ac6('0xb')](),interaction[_0x5ac6('0x17')](_0x5ac6('0x18'),_0x5ac6('0x1c')),controller[_0x5ac6('0x1d')]);router[_0x5ac6('0x1e')](_0x5ac6('0x16'),auth[_0x5ac6('0xb')](),controller[_0x5ac6('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x9aee=['get','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','isAuthenticated'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9aee,0x71));var _0xe9ae=function(_0x2eef32,_0x29f149){_0x2eef32=_0x2eef32-0x0;var _0x279e3f=_0x9aee[_0x2eef32];return _0x279e3f;};'use strict';var multer=require(_0xe9ae('0x0'));var util=require(_0xe9ae('0x1'));var path=require(_0xe9ae('0x2'));var timeout=require(_0xe9ae('0x3'));var express=require(_0xe9ae('0x4'));var router=express[_0xe9ae('0x5')]();var auth=require(_0xe9ae('0x6'));var interaction=require(_0xe9ae('0x7'));var config=require(_0xe9ae('0x8'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe9ae('0x9')]);router['get']('/describe',auth[_0xe9ae('0xa')](),controller['describe']);router[_0xe9ae('0xb')](_0xe9ae('0xc'),auth['isAuthenticated'](),controller[_0xe9ae('0xd')]);router[_0xe9ae('0xb')](_0xe9ae('0xe'),auth['isAuthenticated'](),controller[_0xe9ae('0xf')]);router[_0xe9ae('0xb')](_0xe9ae('0x10'),auth['isAuthenticated'](),controller[_0xe9ae('0x11')]);router['post']('/',auth[_0xe9ae('0xa')](),controller[_0xe9ae('0x12')]);router[_0xe9ae('0x13')](_0xe9ae('0xe'),auth[_0xe9ae('0xa')](),controller[_0xe9ae('0x14')]);router[_0xe9ae('0x13')](_0xe9ae('0x15'),auth['isAuthenticated'](),interaction[_0xe9ae('0x16')](_0xe9ae('0x17'),'mailinteraction:addtags'),controller[_0xe9ae('0x18')]);router[_0xe9ae('0x19')](_0xe9ae('0xc'),auth[_0xe9ae('0xa')](),interaction[_0xe9ae('0x16')](_0xe9ae('0x17'),_0xe9ae('0x1a')),controller[_0xe9ae('0x1b')]);router[_0xe9ae('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0xe9ae('0x16')]('mail',_0xe9ae('0x1d')),controller[_0xe9ae('0x1e')]);router[_0xe9ae('0x1c')](_0xe9ae('0x15'),auth['isAuthenticated'](),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 85f6f5a..fe94f61 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 _0xda03=['STRING','long','TEXT','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x1c7240,_0x3b62b5){var _0x174506=function(_0x259449){while(--_0x259449){_0x1c7240['push'](_0x1c7240['shift']());}};_0x174506(++_0x3b62b5);}(_0xda03,0x176));var _0x3da0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda03[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3da0('0x0'));var iconv=require('iconv');module[_0x3da0('0x1')]={'closed':{'type':Sequelize[_0x3da0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3da0('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3da0('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3da0('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x3da0('0x5'))},'subject':{'type':Sequelize[_0x3da0('0x6')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3da0('0x3')]},'substatus':{'type':Sequelize[_0x3da0('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x3da0('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3da0('0x7')]('in',_0x3da0('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3da0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3da0('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3da0('0x6')](_0x3da0('0x5'))},'lastMsgText':{'type':Sequelize[_0x3da0('0x6')](_0x3da0('0x5'))}}; \ No newline at end of file +var _0x1fbb=['out','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM'];(function(_0x4d7118,_0x48007a){var _0x57d214=function(_0x4406ea){while(--_0x4406ea){_0x4d7118['push'](_0x4d7118['shift']());}};_0x57d214(++_0x48007a);}(_0x1fbb,0x10f));var _0xb1fb=function(_0x1005a1,_0x23e75a){_0x1005a1=_0x1005a1-0x0;var _0x16270f=_0x1fbb[_0x1005a1];return _0x16270f;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb1fb('0x0'));module[_0xb1fb('0x1')]={'closed':{'type':Sequelize[_0xb1fb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb1fb('0x3')]},'disposition':{'type':Sequelize[_0xb1fb('0x4')]},'secondDisposition':{'type':Sequelize[_0xb1fb('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb1fb('0x4')]},'note':{'type':Sequelize[_0xb1fb('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xb1fb('0x4')]},'cc':{'type':Sequelize[_0xb1fb('0x5')](_0xb1fb('0x6'))},'subject':{'type':Sequelize[_0xb1fb('0x5')]()},'attach':{'type':Sequelize[_0xb1fb('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb1fb('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb1fb('0x7')]('in',_0xb1fb('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xb1fb('0x5')](_0xb1fb('0x6'))},'lastMsgText':{'type':Sequelize[_0xb1fb('0x5')](_0xb1fb('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index dcc6457..b5db537 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 _0x0ca5=['headers','Bcc','Attachments','basename','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','MailInteraction','findOne','lastMsgBody','lastMsgText','then','trimStart','fromString','catch','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','plainBody','some','compact','isEmpty','forEach','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','Account.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','MailInteractionId','Setting','enableEmailPreview','rows','show','params','filtears','includeAll','include','options','create','body','describe','addMessage','ids','omit','getMessages','MailMessage','hasOwnProperty','format','addTags','setTags','spread','Tag','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','mkdirSync'];(function(_0xd016ec,_0x7f7454){var _0x5d84dd=function(_0x19dc34){while(--_0x19dc34){_0xd016ec['push'](_0xd016ec['shift']());}};_0x5d84dd(++_0x7f7454);}(_0x0ca5,0xfc));var _0x50ca=function(_0x49692d,_0x419ce9){_0x49692d=_0x49692d-0x0;var _0x277fca=_0x0ca5[_0x49692d];return _0x277fca;};'use strict';var pdf=require(_0x50ca('0x0'));var emlformat=require(_0x50ca('0x1'));var rimraf=require(_0x50ca('0x2'));var zipdir=require(_0x50ca('0x3'));var jsonpatch=require(_0x50ca('0x4'));var rp=require(_0x50ca('0x5'));var moment=require(_0x50ca('0x6'));var BPromise=require(_0x50ca('0x7'));var Mustache=require('mustache');var util=require(_0x50ca('0x8'));var path=require(_0x50ca('0x9'));var sox=require(_0x50ca('0xa'));var csv=require(_0x50ca('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x50ca('0xc'));var squel=require(_0x50ca('0xd'));var crypto=require('crypto');var jsforce=require(_0x50ca('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x50ca('0xb'));var querystring=require('querystring');var Papa=require(_0x50ca('0xf'));var htmlToText=require(_0x50ca('0x10'));var Redis=require(_0x50ca('0x11'));var authService=require(_0x50ca('0x12'));var qs=require(_0x50ca('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x50ca('0x14'))(_0x50ca('0x15'));var utils=require(_0x50ca('0x16'));var config=require(_0x50ca('0x17'));var licenseUtil=require(_0x50ca('0x18'));var db=require(_0x50ca('0x19'))['db'];config[_0x50ca('0x1a')]=_[_0x50ca('0x1b')](config[_0x50ca('0x1a')],{'host':_0x50ca('0x1c'),'port':0x18eb});var socket=require(_0x50ca('0x1d'))(new Redis(config[_0x50ca('0x1a')]));require(_0x50ca('0x1e'))[_0x50ca('0x1f')](socket);function respondWithStatusCode(_0x3653b9,_0x512344){_0x512344=_0x512344||0xcc;return function(_0x168436){if(_0x168436){return _0x3653b9[_0x50ca('0x20')](_0x512344);}return _0x3653b9[_0x50ca('0x21')](_0x512344)[_0x50ca('0x22')]();};}function respondWithResult(_0x1b9e58,_0x4ee39b){_0x4ee39b=_0x4ee39b||0xc8;return function(_0x1566f4){if(_0x1566f4){return _0x1b9e58['status'](_0x4ee39b)[_0x50ca('0x23')](_0x1566f4);}};}function respondWithFilteredResult(_0x13ea58,_0x1b1f61){return function(_0xc2407b){if(_0xc2407b){var _0x4d9cbc=_0xc2407b['count'],_0x32f613=_0x1b1f61['offset'],_0x9f19a9=_0x1b1f61[_0x50ca('0x24')]+_0x1b1f61[_0x50ca('0x25')],_0x2779f9;if(_0x9f19a9>=_0x4d9cbc){_0x9f19a9=_0x4d9cbc;_0x2779f9=0xc8;}else{_0x2779f9=0xce;}_0x13ea58[_0x50ca('0x21')](_0x2779f9);return _0x13ea58[_0x50ca('0x26')](_0x50ca('0x27'),_0x32f613+'-'+_0x9f19a9+'/'+_0x4d9cbc)[_0x50ca('0x23')](_0xc2407b);}return null;};}function patchUpdates(_0x48203d){return function(_0x52027a){try{jsonpatch[_0x50ca('0x28')](_0x52027a,_0x48203d,!![]);}catch(_0x2e522f){return BPromise[_0x50ca('0x29')](_0x2e522f);}return _0x52027a[_0x50ca('0x2a')]();};}function saveUpdates(_0x1f2c49,_0xd6353f){return function(_0x7e6bad){if(_0x7e6bad){return _0x7e6bad[_0x50ca('0x2b')](_0x1f2c49)['then'](function(_0x53e1e7){return _0x53e1e7;});}return null;};}function removeEntity(_0x8ad718,_0x5c6dcd){return function(_0x2c828a){if(_0x2c828a){return _0x2c828a[_0x50ca('0x2c')]()['then'](function(){_0x8ad718[_0x50ca('0x21')](0xcc)[_0x50ca('0x22')]();});}};}function handleEntityNotFound(_0x3b12d9,_0x5a5f19){return function(_0x32cd92){if(!_0x32cd92){_0x3b12d9['sendStatus'](0x194);}return _0x32cd92;};}function handleError(_0x34f536,_0x1ebf0d){_0x1ebf0d=_0x1ebf0d||0x1f4;return function(_0x17cfd0){logger[_0x50ca('0x2d')](_0x17cfd0[_0x50ca('0x2e')]);if(_0x17cfd0['name']){delete _0x17cfd0[_0x50ca('0x2f')];}_0x34f536[_0x50ca('0x21')](_0x1ebf0d)[_0x50ca('0x30')](_0x17cfd0);};}function getInteractionUsers(_0x2707d5,_0xf262a8){return new BPromise(function(_0x119d1f,_0x386d03){try{if(_0xf262a8[_0x2707d5['id']]){_0x2707d5[_0x50ca('0x31')]=_[_0x50ca('0x32')](_0xf262a8[_0x2707d5['id']],function(_0x34aad2){return{'id':_0x34aad2['id'],'fullname':_0x34aad2[_0x50ca('0x33')]};});}}catch(_0x5e4285){_0x386d03(_0x5e4285);}_0x119d1f(_0x2707d5);});}function getInteractionTags(_0x474a2a,_0x2c3133){return new BPromise(function(_0x16e8bf,_0x98b558){try{if(_0x474a2a[_0x50ca('0x34')]){_0x474a2a[_0x50ca('0x35')]=[];_0x474a2a[_0x50ca('0x34')][_0x50ca('0x36')](',')['forEach'](function(_0x7832eb){_0x474a2a[_0x50ca('0x35')][_0x50ca('0x37')](_0x2c3133[_0x7832eb]);});}delete _0x474a2a[_0x50ca('0x34')];}catch(_0x128d82){_0x98b558(_0x128d82);}_0x16e8bf(_0x474a2a);});}function getLastMessageText(_0x4bb24d){return new BPromise(function(_0x2b3f40,_0x55cda7){return db[_0x50ca('0x38')][_0x50ca('0x39')]({'where':{'id':_0x4bb24d['id']},'attributes':[_0x50ca('0x3a'),_0x50ca('0x3b')],'raw':!![]})[_0x50ca('0x3c')](function(_0x5b1d44){if(!_0x5b1d44[_0x50ca('0x3b')]){_0x4bb24d[_0x50ca('0x3b')]=_[_0x50ca('0x3d')](htmlToText[_0x50ca('0x3e')](_0x5b1d44[_0x50ca('0x3a')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4bb24d['lastMsgText']=_0x5b1d44[_0x50ca('0x3b')];}_0x2b3f40(_0x4bb24d);})[_0x50ca('0x3f')](function(_0x5a14f0){_0x55cda7(_0x5a14f0);});});}function updateMailInteraction(_0x35a304,_0x242855,_0x1e59b8,_0x25b2f3){return new BPromise(function(_0x332830,_0x54a83a){return getInteractionUsers(_0x35a304,_0x1e59b8)[_0x50ca('0x3c')](function(_0x420d12){return getInteractionTags(_0x420d12,_0x242855);})[_0x50ca('0x3c')](function(_0x58726e){if(_0x25b2f3){_0x332830(getLastMessageText(_0x58726e));}else{_0x332830(_0x58726e);}})['catch'](function(_0x5470f4){_0x54a83a(_0x5470f4);});});}exports['index']=function(_0x3fac06,_0x54fd06){var _0x6c23a0={},_0x262c57={},_0x27149b={'count':0x0,'rows':[]};var _0xb80389=_[_0x50ca('0x32')](db[_0x50ca('0x38')][_0x50ca('0x40')],function(_0xc4d922){return{'name':_0xc4d922[_0x50ca('0x41')],'type':_0xc4d922[_0x50ca('0x42')]['key']};});_0x262c57[_0x50ca('0x43')]=_[_0x50ca('0x32')](_0xb80389,'name');_0x262c57[_0x50ca('0x44')]=_[_0x50ca('0x45')](_0x3fac06[_0x50ca('0x44')]);_0x262c57[_0x50ca('0x46')]=_[_0x50ca('0x47')](_0x262c57[_0x50ca('0x43')],_0x262c57[_0x50ca('0x44')]);_0x6c23a0[_0x50ca('0x48')]=_[_0x50ca('0x47')](_0x262c57['model'],qs['fields'](_0x3fac06[_0x50ca('0x44')][_0x50ca('0x49')]));_0x6c23a0[_0x50ca('0x48')]=_0x6c23a0[_0x50ca('0x48')][_0x50ca('0x4a')]?_0x6c23a0[_0x50ca('0x48')]:_0x262c57['model'];if(!_0x3fac06['query']['hasOwnProperty'](_0x50ca('0x4b'))){_0x6c23a0['limit']=qs[_0x50ca('0x25')](_0x3fac06[_0x50ca('0x44')][_0x50ca('0x25')]);_0x6c23a0[_0x50ca('0x24')]=qs[_0x50ca('0x24')](_0x3fac06[_0x50ca('0x44')][_0x50ca('0x24')]);}_0x6c23a0[_0x50ca('0x4c')]=qs[_0x50ca('0x4d')](_0x3fac06['query'][_0x50ca('0x4d')]);_0x6c23a0[_0x50ca('0x4e')]=qs[_0x50ca('0x46')](_[_0x50ca('0x4f')](_0x3fac06[_0x50ca('0x44')],_0x262c57['filters']),_0xb80389);var _0x36fe2e=[];var _0x102581=squel[_0x50ca('0x50')]()[_0x50ca('0x51')]('id')[_0x50ca('0x51')]('name')[_0x50ca('0x51')](_0x50ca('0x52'))[_0x50ca('0x53')](_0x50ca('0x54'));var _0x4b27cf=squel[_0x50ca('0x50')]()[_0x50ca('0x51')]('u.id')[_0x50ca('0x51')](_0x50ca('0x55'))[_0x50ca('0x51')](_0x50ca('0x56'))[_0x50ca('0x53')](_0x50ca('0x57'),'ui')[_0x50ca('0x58')](_0x50ca('0x59'),'u',_0x50ca('0x5a'));var _0x2c6f55=squel[_0x50ca('0x50')]()[_0x50ca('0x53')](_0x50ca('0x5b'),'i')[_0x50ca('0x58')](_0x50ca('0x5c'),'c',_0x50ca('0x5d'))[_0x50ca('0x58')](_0x50ca('0x59'),'o','o.id\x20=\x20i.UserId')[_0x50ca('0x58')](_0x50ca('0x5e'),'a','a.id\x20=\x20i.MailAccountId')[_0x50ca('0x58')](_0x50ca('0x5f'),'me',_0x50ca('0x60'))[_0x50ca('0x58')](_0x50ca('0x61'),'it',_0x50ca('0x62'))[_0x50ca('0x58')](_0x50ca('0x54'),'t','t.id\x20=\x20it.TagId');var _0x3e7552=squel[_0x50ca('0x63')]();var _0x535779=[];var _0x27755f=squel[_0x50ca('0x63')]();var _0x531ab7;if(_0x3fac06[_0x50ca('0x44')]['search']){_0x531ab7=as[_0x50ca('0x64')](_0x3fac06[_0x50ca('0x44')]['search']);var _0x497127=_0x531ab7[_0x50ca('0x65')];for(var _0x1c75aa=0x0;_0x1c75aa<_0x531ab7['conditions'][_0x50ca('0x4a')];_0x1c75aa++){var _0x33625f=_0x531ab7[_0x50ca('0x66')][_0x1c75aa];var _0x11811f='i';var _0x57a6fe=_[_0x50ca('0x67')](_0xb80389,[_0x50ca('0x2f'),_0x33625f[_0x50ca('0x51')]]);if(!_0x57a6fe){switch(_0x33625f[_0x50ca('0x51')]){case _0x50ca('0x68'):if(_0x33625f[_0x50ca('0x69')]==0x1){_0x2c6f55[_0x50ca('0x6a')]('`'+_0x33625f[_0x50ca('0x51')]+_0x50ca('0x6b'));}else{_0x2c6f55[_0x50ca('0x6a')]('`'+_0x33625f[_0x50ca('0x51')]+_0x50ca('0x6c'));}break;case'Contact':if(_0x33625f[_0x50ca('0x6d')]==='$substring'){if(_0x33625f[_0x50ca('0x69')][_0x50ca('0x36')]('\x20')[_0x50ca('0x4a')]>0x1){_0x3e7552[_0x497127]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x50ca('0x6e')](_0x33625f[_0x50ca('0x69')]),null);}else{var _0x3ef38d='%'+_0x33625f[_0x50ca('0x69')]+'%';_0x3e7552[_0x497127](_0x50ca('0x6f'),_0x3ef38d,_0x3ef38d,_0x3ef38d);}}else{_0x57a6fe=_['find'](_0xb80389,[_0x50ca('0x2f'),_0x50ca('0x70')]);_0x33625f[_0x50ca('0x51')]=_0x50ca('0x70');_0x50278e=as['buildExpression'](_0x11811f,_0x57a6fe[_0x50ca('0x42')],_0x33625f);_0x3e7552[_0x497127](_0x50278e[_0x50ca('0x71')],_0x50278e[_0x50ca('0x69')][_0x50ca('0x72')],_0x50278e[_0x50ca('0x69')][_0x50ca('0x22')]);}break;case'Tag':var _0x2ffd61=_0x33625f[_0x50ca('0x69')]['split'](',')[_0x50ca('0x32')](function(_0xfaa5ae){return Number(_0xfaa5ae);});_0x2ffd61['forEach'](function(_0x7ae92d){_0x27755f['or'](_0x50ca('0x73'),'%,'+_0x7ae92d+',%');});_0x535779=_['union'](_0x535779,_0x2ffd61);break;case'User':if(_0x33625f['operator']===_0x50ca('0x74')){_0x3e7552[_0x497127](_0x50ca('0x75'),'%'+_0x33625f['value']+'%',null);}else{_0x57a6fe=_['find'](_0xb80389,[_0x50ca('0x2f'),_0x50ca('0x76')]);_0x33625f[_0x50ca('0x51')]=_0x50ca('0x76');_0x50278e=as[_0x50ca('0x77')](_0x11811f,_0x57a6fe[_0x50ca('0x42')],_0x33625f);_0x3e7552[_0x497127](_0x50278e[_0x50ca('0x71')],_0x50278e[_0x50ca('0x69')]['start'],_0x50278e[_0x50ca('0x69')][_0x50ca('0x22')]);}break;case _0x50ca('0x78'):_0x50278e=as[_0x50ca('0x77')]('me',null,_0x33625f);_0x3e7552[_0x497127](_0x50278e[_0x50ca('0x71')],_0x50278e['value'][_0x50ca('0x72')],_0x50278e['value'][_0x50ca('0x22')]);break;}}else{var _0x50278e=as[_0x50ca('0x77')](_0x11811f,_0x57a6fe['type'],_0x33625f);_0x3e7552[_0x497127](_0x50278e[_0x50ca('0x71')],_0x50278e[_0x50ca('0x69')]['start'],_0x50278e['value'][_0x50ca('0x22')]);}}}else{var _0x18c67e=_(_0x3fac06['query'])[_0x50ca('0x45')]()[_0x50ca('0x32')](function(_0x27f51a){return _[_0x50ca('0x79')](_0xb80389,['name',_0x27f51a])?_0x27f51a:undefined;})[_0x50ca('0x7a')]()[_0x50ca('0x69')]();if(!_[_0x50ca('0x7b')](_0x18c67e)){_0x18c67e[_0x50ca('0x7c')](function(_0x4fe37d){if(_0x4fe37d==='MailAccountId'){_0x2c6f55[_0x50ca('0x4e')](_0x50ca('0x7d'),[][_0x50ca('0x7e')](_0x3fac06['query'][_0x4fe37d]));}else if(_0x4fe37d===_0x50ca('0x7f')){var _0x49e45d=JSON[_0x50ca('0x80')](_0x3fac06[_0x50ca('0x44')][_0x4fe37d])[_0x50ca('0x81')];var _0x26b26b=JSON[_0x50ca('0x80')](_0x3fac06[_0x50ca('0x44')][_0x4fe37d])[_0x50ca('0x82')];_0x2c6f55['where'](_0x50ca('0x83'),_0x49e45d,_0x26b26b);}else{if(_0x3fac06['query'][_0x4fe37d]==='null'){_0x2c6f55[_0x50ca('0x4e')]('i.'+_0x4fe37d+_0x50ca('0x84'));}else{_0x2c6f55[_0x50ca('0x4e')]('i.'+_0x4fe37d+_0x50ca('0x85'),_0x3fac06[_0x50ca('0x44')][_0x4fe37d]);}}});}if(_0x3fac06[_0x50ca('0x44')][_0x50ca('0x86')]){if(_0x3fac06[_0x50ca('0x44')]['read']==0x1){_0x2c6f55[_0x50ca('0x6a')](_0x50ca('0x87'));}else{_0x2c6f55['having']('`unreadMessages`\x20>\x200');}}if(_0x3fac06['query'][_0x50ca('0x88')]){_0x535779=_[_0x50ca('0x89')](_0x3fac06[_0x50ca('0x44')][_0x50ca('0x88')])?_0x3fac06[_0x50ca('0x44')][_0x50ca('0x88')]:new Array(_0x3fac06[_0x50ca('0x44')][_0x50ca('0x88')]);_0x535779[_0x50ca('0x7c')](function(_0x4651b9){_0x27755f['or'](_0x50ca('0x73'),'%,'+_0x4651b9+',%');});}if(_0x3fac06[_0x50ca('0x44')][_0x50ca('0x8a')]){var _0x1b8a32=_0x3fac06[_0x50ca('0x44')]['filter']['replace']('\x5c','\x5c\x5c')[_0x50ca('0x8b')]('\x27\x27',_0x50ca('0x8c'));if(qs[_0x50ca('0x8d')](_0x1b8a32)){_0x3e7552['or'](_0x50ca('0x8e'),_0x1b8a32+'%');}else if(qs[_0x50ca('0x8f')](_0x1b8a32)){_0x3e7552['or'](_0x50ca('0x90'),_0x1b8a32+'%');}else{_0x3e7552['or'](_0x50ca('0x91'),qs['getFullTextValue'](_0x1b8a32))['or'](_0x50ca('0x92'),qs['getFullTextValue'](_0x1b8a32));}}}_0x2c6f55[_0x50ca('0x4e')](_0x3e7552);_0x2c6f55[_0x50ca('0x93')](_0x50ca('0x94'));var _0x1a896d={'type':db['Sequelize']['QueryTypes'][_0x50ca('0x95')],'raw':!![]};var _0x59724b=_0x2c6f55[_0x50ca('0x96')]();_0x59724b[_0x50ca('0x51')](_0x50ca('0x94'));_0x59724b['field'](_0x50ca('0x97'),'unreadMessages');if(_0x6c23a0[_0x50ca('0x4c')]){_0x6c23a0[_0x50ca('0x4c')][_0x50ca('0x7c')](function(_0x26af28){_0x2c6f55[_0x50ca('0x4c')]('i.'+_0x26af28[0x0],_0x26af28[0x1]===_0x50ca('0x98')?![]:!![]);});}if(!_[_0x50ca('0x7b')](_0x535779)){_0x2c6f55[_0x50ca('0x6a')](_0x27755f);_0x59724b[_0x50ca('0x4e')](_0x50ca('0x99'),_0x535779);}BPromise[_0x50ca('0x9a')]()[_0x50ca('0x3c')](function(){if(!_0x531ab7){if(_0x3fac06['query'][_0x50ca('0x9b')]||_0x3fac06[_0x50ca('0x44')][_0x50ca('0x9c')])return;_0x59724b[_0x50ca('0x4e')](_0x50ca('0x9d'));_0x2c6f55[_0x50ca('0x4e')](_0x50ca('0x9d'));return;}return _0x3fac06['user'][_0x50ca('0x9e')]({'attributes':['id'],'raw':!![]})[_0x50ca('0x3c')](function(_0x544920){if(_[_0x50ca('0x7b')](_0x544920)){_0x59724b[_0x50ca('0x4e')]('i.MailAccountId\x20IS\x20NULL');_0x2c6f55[_0x50ca('0x4e')](_0x50ca('0x9f'));}else{_0x59724b[_0x50ca('0x4e')](_0x50ca('0x7d'),_[_0x50ca('0x32')](_0x544920,'id'));_0x2c6f55[_0x50ca('0x4e')](_0x50ca('0x7d'),_[_0x50ca('0x32')](_0x544920,'id'));}});})['then'](function(){db[_0x50ca('0xa0')][_0x50ca('0x44')](_0x59724b[_0x50ca('0xa1')](),_0x1a896d)[_0x50ca('0x3c')](function(_0x50f375){_0x27149b[_0x50ca('0xa2')]=_0x50f375[_0x50ca('0x4a')];if(_0x27149b[_0x50ca('0xa2')]===0x0)return[];return db['sequelize'][_0x50ca('0x44')](_0x102581[_0x50ca('0xa1')](),_0x1a896d)[_0x50ca('0x3c')](function(_0x292b2f){_0x36fe2e=_[_0x50ca('0xa3')](_0x292b2f,'id');_0x1a896d=_[_0x50ca('0xa4')](_0x1a896d,{'model':db[_0x50ca('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fac06[_0x50ca('0x44')][_0x50ca('0x49')]){_0x6c23a0['attributes'][_0x50ca('0x7c')](function(_0xf360eb){_0x2c6f55['field']('i.'+_0xf360eb);});}else{_0x2c6f55[_0x50ca('0x51')](_0x50ca('0x97'),'unreadMessages');_0x2c6f55['field']('a.key',_0x50ca('0xa5'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xa6'),'Account.mandatoryDisposition');_0x2c6f55['field'](_0x50ca('0x94'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xa7'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xa8'));_0x2c6f55['field'](_0x50ca('0xa9'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xaa'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xab'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xac'));_0x2c6f55[_0x50ca('0x51')]('i.lastMsgDirection');_0x2c6f55[_0x50ca('0x51')]('i.subject');_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xad'));_0x2c6f55['field'](_0x50ca('0xae'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xaf'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb0'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb1'));_0x2c6f55['field'](_0x50ca('0xb2'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb3'));_0x2c6f55[_0x50ca('0x51')]('i.UserId');_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb4'),'Contact.firstName');_0x2c6f55[_0x50ca('0x51')]('c.lastName','Contact.lastName');_0x2c6f55[_0x50ca('0x51')]('c.email','Contact.email');_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb5'),_0x50ca('0xb6'));_0x2c6f55[_0x50ca('0x51')]('c.mobile',_0x50ca('0xb7'));_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xb8'),'Contact.fax');_0x2c6f55['field'](_0x50ca('0xb9'),_0x50ca('0xba'));_0x2c6f55['field']('o.internal','Owner.internal');_0x2c6f55[_0x50ca('0x51')](_0x50ca('0xbb'),'TagIds');}if(_0x6c23a0[_0x50ca('0x25')])_0x2c6f55[_0x50ca('0x25')](_0x6c23a0[_0x50ca('0x25')]);if(_0x6c23a0['offset'])_0x2c6f55[_0x50ca('0x24')](_0x6c23a0[_0x50ca('0x24')]);return db[_0x50ca('0xa0')]['query'](_0x2c6f55['toString'](),_0x1a896d);})[_0x50ca('0x3c')](function(_0x48fd7a){_0x4b27cf['where'](_0x50ca('0xbc'),_['map'](_0x48fd7a,'id'));return db[_0x50ca('0xa0')][_0x50ca('0x44')](_0x4b27cf['toString'](),_0x1a896d)[_0x50ca('0x3c')](function(_0x45a4c2){var _0x4e8c82=_['groupBy'](_0x45a4c2,_0x50ca('0xbd'));var _0x28c0ca=[];return db[_0x50ca('0xbe')][_0x50ca('0x39')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x50ca('0x3c')](function(_0x7da4d0){var _0x5c12e2=_0x7da4d0[_0x50ca('0xbf')];_0x48fd7a[_0x50ca('0x7c')](function(_0x1c7edb){_0x28c0ca[_0x50ca('0x37')](updateMailInteraction(_0x1c7edb,_0x36fe2e,_0x4e8c82,_0x5c12e2));});return BPromise['all'](_0x28c0ca);});});});})[_0x50ca('0x3c')](function(_0x7b1c63){_0x27149b[_0x50ca('0xc0')]=_0x7b1c63;return _0x27149b;})[_0x50ca('0x3c')](respondWithFilteredResult(_0x54fd06,_0x6c23a0));})[_0x50ca('0x3f')](handleError(_0x54fd06,null));};exports[_0x50ca('0xc1')]=function(_0x30ba4d,_0x316f5e){var _0x55eb09={'raw':![],'where':{'id':_0x30ba4d[_0x50ca('0xc2')]['id']}},_0x5da591={};_0x5da591[_0x50ca('0x43')]=_[_0x50ca('0x45')](db['MailInteraction']['rawAttributes']);_0x5da591[_0x50ca('0x44')]=_['keys'](_0x30ba4d['query']);_0x5da591[_0x50ca('0xc3')]=_[_0x50ca('0x47')](_0x5da591[_0x50ca('0x43')],_0x5da591[_0x50ca('0x44')]);_0x55eb09[_0x50ca('0x48')]=_[_0x50ca('0x47')](_0x5da591[_0x50ca('0x43')],qs[_0x50ca('0x49')](_0x30ba4d[_0x50ca('0x44')]['fields']));_0x55eb09[_0x50ca('0x48')]=_0x55eb09[_0x50ca('0x48')][_0x50ca('0x4a')]?_0x55eb09[_0x50ca('0x48')]:_0x5da591[_0x50ca('0x43')];if(_0x30ba4d[_0x50ca('0x44')][_0x50ca('0xc4')]){_0x55eb09[_0x50ca('0xc5')]=[{'all':!![]}];}_0x55eb09=_['merge']({},_0x55eb09,_0x30ba4d[_0x50ca('0xc6')]);return db[_0x50ca('0x38')][_0x50ca('0x67')](_0x55eb09)[_0x50ca('0x3c')](handleEntityNotFound(_0x316f5e,null))[_0x50ca('0x3c')](respondWithResult(_0x316f5e,null))[_0x50ca('0x3f')](handleError(_0x316f5e,null));};exports[_0x50ca('0xc7')]=function(_0x39df21,_0x3d2360){return db[_0x50ca('0x38')][_0x50ca('0xc7')](_0x39df21[_0x50ca('0xc8')],{})[_0x50ca('0x3c')](respondWithResult(_0x3d2360,0xc9))[_0x50ca('0x3f')](handleError(_0x3d2360,null));};exports[_0x50ca('0x2b')]=function(_0xb039cf,_0xce6e59){if(_0xb039cf[_0x50ca('0xc8')]['id']){delete _0xb039cf[_0x50ca('0xc8')]['id'];}return db[_0x50ca('0x38')][_0x50ca('0x67')]({'where':{'id':_0xb039cf[_0x50ca('0xc2')]['id']}})[_0x50ca('0x3c')](handleEntityNotFound(_0xce6e59,null))[_0x50ca('0x3c')](saveUpdates(_0xb039cf['body'],null))[_0x50ca('0x3c')](respondWithResult(_0xce6e59,null))[_0x50ca('0x3f')](handleError(_0xce6e59,null));};exports[_0x50ca('0x2c')]=function(_0xace756,_0x5c5963){return db[_0x50ca('0x38')]['find']({'where':{'id':_0xace756[_0x50ca('0xc2')]['id']}})[_0x50ca('0x3c')](handleEntityNotFound(_0x5c5963,null))[_0x50ca('0x3c')](removeEntity(_0x5c5963,null))[_0x50ca('0x3f')](handleError(_0x5c5963,null));};exports[_0x50ca('0xc9')]=function(_0x144723,_0x142cdf){return db[_0x50ca('0x38')][_0x50ca('0xc9')]()[_0x50ca('0x3c')](respondWithResult(_0x142cdf,null))[_0x50ca('0x3f')](handleError(_0x142cdf,null));};exports['addMessage']=function(_0x5685bf,_0x444845,_0x4a8a7){return db['MailMessage']['find']({'where':{'id':_0x5685bf['params']['id']}})['then'](handleEntityNotFound(_0x444845,null))[_0x50ca('0x3c')](function(_0x1457c4){if(_0x1457c4){return _0x1457c4[_0x50ca('0xca')](_0x5685bf[_0x50ca('0xc8')][_0x50ca('0xcb')],_[_0x50ca('0xcc')](_0x5685bf[_0x50ca('0xc8')],[_0x50ca('0xcb'),'id'])||{});}})[_0x50ca('0x3c')](respondWithResult(_0x444845,null))[_0x50ca('0x3f')](handleError(_0x444845,null));};exports[_0x50ca('0xcd')]=function(_0x3798ca,_0xdc9aef,_0x331037){var _0x82e5f7={'raw':![],'where':{}};var _0x52ccd4={};var _0x1b85cc={'count':0x0,'rows':[]};return db['MailInteraction'][_0x50ca('0x39')]({'where':{'id':_0x3798ca[_0x50ca('0xc2')]['id']}})[_0x50ca('0x3c')](handleEntityNotFound(_0xdc9aef,null))[_0x50ca('0x3c')](function(_0x31dce6){if(_0x31dce6){_0x52ccd4[_0x50ca('0x43')]=_[_0x50ca('0x45')](db[_0x50ca('0xce')][_0x50ca('0x40')]);_0x52ccd4[_0x50ca('0x44')]=_[_0x50ca('0x45')](_0x3798ca['query']);_0x52ccd4[_0x50ca('0x46')]=_[_0x50ca('0x47')](_0x52ccd4['model'],_0x52ccd4[_0x50ca('0x44')]);_0x82e5f7[_0x50ca('0x48')]=_[_0x50ca('0x47')](_0x52ccd4['model'],qs['fields'](_0x3798ca[_0x50ca('0x44')][_0x50ca('0x49')]));_0x82e5f7[_0x50ca('0x48')]=_0x82e5f7[_0x50ca('0x48')]['length']?_0x82e5f7[_0x50ca('0x48')]:_0x52ccd4[_0x50ca('0x43')];if(!_0x3798ca[_0x50ca('0x44')][_0x50ca('0xcf')]('nolimit')){_0x82e5f7['limit']=qs[_0x50ca('0x25')](_0x3798ca[_0x50ca('0x44')][_0x50ca('0x25')]);_0x82e5f7[_0x50ca('0x24')]=qs[_0x50ca('0x24')](_0x3798ca[_0x50ca('0x44')][_0x50ca('0x24')]);}_0x82e5f7[_0x50ca('0x4c')]=qs[_0x50ca('0x4d')](_0x3798ca[_0x50ca('0x44')]['sort']);_0x82e5f7[_0x50ca('0x4e')]=qs[_0x50ca('0x46')](_[_0x50ca('0x4f')](_0x3798ca[_0x50ca('0x44')],_0x52ccd4[_0x50ca('0x46')]));_0x82e5f7[_0x50ca('0x4e')][_0x50ca('0xbd')]=_0x31dce6['id'];if(_0x3798ca[_0x50ca('0x44')][_0x50ca('0x8a')]){_0x82e5f7[_0x50ca('0x4e')]=_[_0x50ca('0xa4')](_0x82e5f7['where'],{'$or':_[_0x50ca('0x32')](_0x82e5f7[_0x50ca('0x48')],function(_0x590731){var _0x17ce1a={};_0x17ce1a[_0x590731]={'$like':'%'+_0x3798ca[_0x50ca('0x44')][_0x50ca('0x8a')]+'%'};return _0x17ce1a;})});}if(_0x3798ca['query'][_0x50ca('0x81')]){var _0xe8fdab=_0x3798ca[_0x50ca('0x44')][_0x50ca('0x81')][_0x50ca('0x36')](',');var _0x18b2f7={};_0x18b2f7[_0xe8fdab[0x0]]={'$gte':moment(_0xe8fdab[0x1])[_0x50ca('0xd0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x82e5f7[_0x50ca('0x4e')]=_[_0x50ca('0xa4')](_0x82e5f7['where'],_0x18b2f7);}_0x82e5f7=_[_0x50ca('0xa4')]({},_0x82e5f7,_0x3798ca[_0x50ca('0xc6')]);return db[_0x50ca('0xce')][_0x50ca('0xa2')]({'where':_0x82e5f7['where']})[_0x50ca('0x3c')](function(_0x1b49cf){_0x1b85cc[_0x50ca('0xa2')]=_0x1b49cf;if(_0x3798ca[_0x50ca('0x44')]['includeAll']){_0x82e5f7[_0x50ca('0xc5')]=[{'all':!![]}];}return db[_0x50ca('0xce')]['findAll'](_0x82e5f7);})[_0x50ca('0x3c')](function(_0x4edf5c){_0x1b85cc['rows']=_0x4edf5c;return _0x1b85cc;});}})['then'](respondWithFilteredResult(_0xdc9aef,_0x82e5f7))[_0x50ca('0x3f')](handleError(_0xdc9aef,null));};exports[_0x50ca('0xd1')]=function(_0x482746,_0x19d30e,_0x4b74fc){return db[_0x50ca('0x38')][_0x50ca('0x67')]({'where':{'id':_0x482746[_0x50ca('0xc2')]['id']}})[_0x50ca('0x3c')](handleEntityNotFound(_0x19d30e,null))['then'](function(_0x32fe5c){if(_0x32fe5c){return _0x32fe5c[_0x50ca('0xd2')](_0x482746[_0x50ca('0xc8')][_0x50ca('0xcb')],_[_0x50ca('0xcc')](_0x482746[_0x50ca('0xc8')],['ids','id'])||{})[_0x50ca('0xd3')](function(){return db[_0x50ca('0xd4')][_0x50ca('0xd5')]({'attributes':['id','name',_0x50ca('0x52')],'where':{'id':_0x482746[_0x50ca('0xc8')][_0x50ca('0xcb')]}});})[_0x50ca('0x3c')](function(_0x28332c){socket[_0x50ca('0xd6')](_0x50ca('0xd7'),{'id':Number(_0x482746[_0x50ca('0xc2')]['id']),'tags':_0x28332c||[]});return{'id':Number(_0x482746[_0x50ca('0xc2')]['id']),'tags':_0x28332c||[]};});}})[_0x50ca('0x3c')](respondWithResult(_0x19d30e,null))[_0x50ca('0x3f')](handleError(_0x19d30e,null));};exports[_0x50ca('0xd8')]=function(_0x24b5e2,_0x5311c0,_0x3f4cf1){return db[_0x50ca('0x38')][_0x50ca('0x67')]({'where':{'id':_0x24b5e2['params']['id']}})[_0x50ca('0x3c')](handleEntityNotFound(_0x5311c0,null))[_0x50ca('0x3c')](function(_0x438fe2){if(_0x438fe2){return _0x438fe2['removeTags'](_0x24b5e2[_0x50ca('0x44')][_0x50ca('0xcb')]);}})[_0x50ca('0x3c')](respondWithStatusCode(_0x5311c0,null))['catch'](handleError(_0x5311c0,null));};exports[_0x50ca('0xd9')]=function(_0x341337,_0x47cbcf){var _0x3caee3=moment()[_0x50ca('0xda')]()[_0x50ca('0xa1')]();var _0x363054=path[_0x50ca('0xdb')](config['root'],_0x50ca('0xdc'),'files',_0x50ca('0xdd'));var _0x348fa6=path[_0x50ca('0xdb')](config[_0x50ca('0xde')],'server',_0x50ca('0xdf'),_0x50ca('0xe0'));var _0x3babe0=path[_0x50ca('0xdb')](_0x363054,_0x3caee3);var _0x511381=util[_0x50ca('0xd0')](_0x50ca('0xe1'),_0x341337[_0x50ca('0xc2')]['id'],_0x3caee3);var _0x5a331a=path[_0x50ca('0xdb')](_0x363054,_0x511381);var _0x5015cc=[];if(_0x341337[_0x50ca('0x44')][_0x50ca('0xe0')]){_0x5015cc[_0x50ca('0x37')]({'model':db[_0x50ca('0xe2')],'as':'Attachments','raw':!![]});}var _0xa2dcbb=[{'model':db[_0x50ca('0xce')],'as':_0x50ca('0xe3'),'attributes':['id',_0x50ca('0xc8'),_0x50ca('0x53'),'to','cc',_0x50ca('0xe4'),_0x50ca('0xe5'),_0x50ca('0x7f')],'where':{'secret':![]},'order':qs[_0x50ca('0x4d')]('id'),'include':_0x5015cc}];return db[_0x50ca('0x38')][_0x50ca('0x67')]({'where':{'id':_0x341337[_0x50ca('0xc2')]['id']},'include':_0xa2dcbb})[_0x50ca('0x3c')](handleEntityNotFound(_0x47cbcf,null))[_0x50ca('0x3c')](function(_0x57248b){if(_0x57248b&&_0x57248b[_0x50ca('0xe3')]){var _0x4c93e3=_0x57248b[_0x50ca('0xe6')]({'plain':!![]});fs[_0x50ca('0xe7')](_0x3babe0);return BPromise['each'](_0x4c93e3[_0x50ca('0xe3')],function(_0x864829,_0x2b45ba){var _0x16ee21={'from':_0x864829[_0x50ca('0x53')],'to':_0x864829['to'],'subject':_0x864829['subject'],'html':_0x864829['body'],'headers':{'Date':moment(_0x864829[_0x50ca('0x7f')])[_0x50ca('0xd0')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x864829['cc']){_0x16ee21[_0x50ca('0xe8')]['Cc']=_0x864829['cc'];}if(_0x864829['bcc']){_0x16ee21[_0x50ca('0xe8')][_0x50ca('0xe9')]=_0x864829[_0x50ca('0xe4')];}return new BPromise(function(_0x1f53a,_0x1ff0ed){if(_0x864829['Attachments']){for(var _0x1acf57=0x0;_0x1acf57<_0x864829['Attachments']['length'];_0x1acf57++){var _0x581859=_0x864829[_0x50ca('0xea')][_0x1acf57];var _0x37c644=path['join'](_0x348fa6,_0x581859[_0x50ca('0xeb')]);if(fs['existsSync'](_0x37c644)){_0x16ee21[_0x50ca('0xe0')]['push']({'name':_0x581859[_0x50ca('0x2f')],'contentType':_0x581859[_0x50ca('0x42')],'data':fs['readFileSync'](_0x37c644)});}}}emlformat[_0x50ca('0xec')](_0x16ee21,function(_0x258593,_0x145c21){if(_0x258593)return _0x1ff0ed(_0x258593);fs[_0x50ca('0xed')](path[_0x50ca('0xdb')](_0x3babe0,util['format'](_0x50ca('0xee'),_0x2b45ba)),_0x145c21);return _0x1f53a(_0x145c21);});});})['then'](function(){return new BPromise(function(_0x37eb53,_0x490ee4){zipdir(_0x3babe0,{'saveTo':_0x5a331a},function(_0x143541,_0x34ba98){if(_0x143541)return _0x490ee4(_0x143541);return _0x37eb53(_0x34ba98);});})[_0x50ca('0x3c')](function(){return new BPromise(function(_0x5d2325,_0xeed98d){rimraf(_0x3babe0,function(_0x39288e){if(_0x39288e)_0xeed98d(_0x39288e);return _0x5d2325();});});})['then'](function(){return _0x47cbcf[_0x50ca('0xd9')](_0x5a331a,_0x511381,function(_0x40d9b5){if(_0x40d9b5){console[_0x50ca('0xef')](_0x50ca('0xf0'),_0x40d9b5);}else{fs[_0x50ca('0xf1')](_0x5a331a);}});});});}else{return _0x47cbcf[_0x50ca('0x20')](0xc8);}})[_0x50ca('0x3f')](handleError(_0x47cbcf,null));}; \ No newline at end of file +var _0xbe61=['select','field','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','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','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','plainBody','keys','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','groupBy','MailInteractionId','Setting','enableEmailPreview','push','all','rows','params','filtears','include','options','create','body','describe','addMessage','MailMessage','ids','omit','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','spread','color','emit','mailInteractionTags:save','removeTags','unix','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','readFileSync','build','writeFileSync','message%d.eml','download','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','findOne','lastMsgText','trimStart','fromString','catch','MailInteraction','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xbe61,0x192));var _0x1be6=function(_0x39433e,_0x3714ee){_0x39433e=_0x39433e-0x0;var _0x1a4658=_0xbe61[_0x39433e];return _0x1a4658;};'use strict';var pdf=require(_0x1be6('0x0'));var emlformat=require(_0x1be6('0x1'));var rimraf=require(_0x1be6('0x2'));var zipdir=require(_0x1be6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1be6('0x4'));var moment=require(_0x1be6('0x5'));var BPromise=require(_0x1be6('0x6'));var Mustache=require(_0x1be6('0x7'));var util=require(_0x1be6('0x8'));var path=require(_0x1be6('0x9'));var sox=require('sox');var csv=require(_0x1be6('0xa'));var ejs=require(_0x1be6('0xb'));var fs=require('fs');var _=require(_0x1be6('0xc'));var squel=require(_0x1be6('0xd'));var crypto=require(_0x1be6('0xe'));var jsforce=require(_0x1be6('0xf'));var deskjs=require(_0x1be6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1be6('0x11'));var Papa=require(_0x1be6('0x12'));var htmlToText=require(_0x1be6('0x13'));var Redis=require(_0x1be6('0x14'));var authService=require(_0x1be6('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1be6('0x16'));var hardwareService=require(_0x1be6('0x17'));var logger=require(_0x1be6('0x18'))('api');var utils=require(_0x1be6('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1be6('0x1a'));var db=require(_0x1be6('0x1b'))['db'];config[_0x1be6('0x1c')]=_[_0x1be6('0x1d')](config[_0x1be6('0x1c')],{'host':_0x1be6('0x1e'),'port':0x18eb});var socket=require(_0x1be6('0x1f'))(new Redis(config[_0x1be6('0x1c')]));require(_0x1be6('0x20'))[_0x1be6('0x21')](socket);function respondWithStatusCode(_0x2e3964,_0x4078fa){_0x4078fa=_0x4078fa||0xcc;return function(_0x299b07){if(_0x299b07){return _0x2e3964[_0x1be6('0x22')](_0x4078fa);}return _0x2e3964[_0x1be6('0x23')](_0x4078fa)['end']();};}function respondWithResult(_0x386e99,_0x486bf6){_0x486bf6=_0x486bf6||0xc8;return function(_0x2615ce){if(_0x2615ce){return _0x386e99[_0x1be6('0x23')](_0x486bf6)[_0x1be6('0x24')](_0x2615ce);}};}function respondWithFilteredResult(_0x146912,_0x1eb1be){return function(_0xc142ef){if(_0xc142ef){var _0x30b600=_0xc142ef['count'],_0x1b54fb=_0x1eb1be[_0x1be6('0x25')],_0x2a9b06=_0x1eb1be[_0x1be6('0x25')]+_0x1eb1be['limit'],_0x247330;if(_0x2a9b06>=_0x30b600){_0x2a9b06=_0x30b600;_0x247330=0xc8;}else{_0x247330=0xce;}_0x146912['status'](_0x247330);return _0x146912[_0x1be6('0x26')](_0x1be6('0x27'),_0x1b54fb+'-'+_0x2a9b06+'/'+_0x30b600)['json'](_0xc142ef);}return null;};}function patchUpdates(_0x5db378){return function(_0x1254c5){try{jsonpatch[_0x1be6('0x28')](_0x1254c5,_0x5db378,!![]);}catch(_0x4e80e9){return BPromise[_0x1be6('0x29')](_0x4e80e9);}return _0x1254c5[_0x1be6('0x2a')]();};}function saveUpdates(_0xa09295,_0x35fe32){return function(_0x54ef76){if(_0x54ef76){return _0x54ef76[_0x1be6('0x2b')](_0xa09295)['then'](function(_0x1ec8d1){return _0x1ec8d1;});}return null;};}function removeEntity(_0x2acf23,_0x54d743){return function(_0xebb79d){if(_0xebb79d){return _0xebb79d[_0x1be6('0x2c')]()[_0x1be6('0x2d')](function(){_0x2acf23['status'](0xcc)[_0x1be6('0x2e')]();});}};}function handleEntityNotFound(_0x4b826a,_0x1d7ae7){return function(_0x160d79){if(!_0x160d79){_0x4b826a['sendStatus'](0x194);}return _0x160d79;};}function handleError(_0x28c71e,_0x423a31){_0x423a31=_0x423a31||0x1f4;return function(_0x1753cd){logger[_0x1be6('0x2f')](_0x1753cd[_0x1be6('0x30')]);if(_0x1753cd['name']){delete _0x1753cd[_0x1be6('0x31')];}_0x28c71e['status'](_0x423a31)[_0x1be6('0x32')](_0x1753cd);};}function getInteractionUsers(_0x23907c,_0x1714f4){return new BPromise(function(_0xf6fe6e,_0x3523c5){try{if(_0x1714f4[_0x23907c['id']]){_0x23907c[_0x1be6('0x33')]=_[_0x1be6('0x34')](_0x1714f4[_0x23907c['id']],function(_0x598718){return{'id':_0x598718['id'],'fullname':_0x598718[_0x1be6('0x35')]};});}}catch(_0x3c453a){_0x3523c5(_0x3c453a);}_0xf6fe6e(_0x23907c);});}function getInteractionTags(_0xba4628,_0x130bcb){return new BPromise(function(_0x24099b,_0x2ebde0){try{if(_0xba4628[_0x1be6('0x36')]){_0xba4628[_0x1be6('0x37')]=[];_0xba4628[_0x1be6('0x36')]['split'](',')[_0x1be6('0x38')](function(_0x53607e){_0xba4628[_0x1be6('0x37')]['push'](_0x130bcb[_0x53607e]);});}delete _0xba4628[_0x1be6('0x36')];}catch(_0xb37375){_0x2ebde0(_0xb37375);}_0x24099b(_0xba4628);});}function getLastMessageText(_0x4510b4){return new BPromise(function(_0x31c7cb,_0x5ea3e1){return db['MailInteraction'][_0x1be6('0x39')]({'where':{'id':_0x4510b4['id']},'attributes':['lastMsgBody',_0x1be6('0x3a')],'raw':!![]})['then'](function(_0x3a8bfb){if(!_0x3a8bfb[_0x1be6('0x3a')]){_0x4510b4[_0x1be6('0x3a')]=_[_0x1be6('0x3b')](htmlToText[_0x1be6('0x3c')](_0x3a8bfb['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4510b4[_0x1be6('0x3a')]=_0x3a8bfb[_0x1be6('0x3a')];}_0x31c7cb(_0x4510b4);})[_0x1be6('0x3d')](function(_0xcf4deb){_0x5ea3e1(_0xcf4deb);});});}function updateMailInteraction(_0x34b5f7,_0x2c7ef0,_0x3e6250,_0x2cb5e4){return new BPromise(function(_0x447e7f,_0x493b25){return getInteractionUsers(_0x34b5f7,_0x3e6250)[_0x1be6('0x2d')](function(_0x139d0a){return getInteractionTags(_0x139d0a,_0x2c7ef0);})[_0x1be6('0x2d')](function(_0x5af79a){if(_0x2cb5e4){_0x447e7f(getLastMessageText(_0x5af79a));}else{_0x447e7f(_0x5af79a);}})[_0x1be6('0x3d')](function(_0x2d218e){_0x493b25(_0x2d218e);});});}exports['index']=function(_0x259884,_0x360953){var _0x3a4ee1={},_0x4ceaba={},_0x15b678={'count':0x0,'rows':[]};var _0x307cd9=_['map'](db[_0x1be6('0x3e')][_0x1be6('0x3f')],function(_0x409351){return{'name':_0x409351['fieldName'],'type':_0x409351[_0x1be6('0x40')]['key']};});_0x4ceaba[_0x1be6('0x41')]=_[_0x1be6('0x34')](_0x307cd9,_0x1be6('0x31'));_0x4ceaba[_0x1be6('0x42')]=_['keys'](_0x259884[_0x1be6('0x42')]);_0x4ceaba[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x4ceaba[_0x1be6('0x41')],_0x4ceaba[_0x1be6('0x42')]);_0x3a4ee1[_0x1be6('0x45')]=_[_0x1be6('0x44')](_0x4ceaba[_0x1be6('0x41')],qs[_0x1be6('0x46')](_0x259884[_0x1be6('0x42')][_0x1be6('0x46')]));_0x3a4ee1[_0x1be6('0x45')]=_0x3a4ee1[_0x1be6('0x45')][_0x1be6('0x47')]?_0x3a4ee1[_0x1be6('0x45')]:_0x4ceaba[_0x1be6('0x41')];if(!_0x259884[_0x1be6('0x42')][_0x1be6('0x48')](_0x1be6('0x49'))){_0x3a4ee1[_0x1be6('0x4a')]=qs[_0x1be6('0x4a')](_0x259884[_0x1be6('0x42')][_0x1be6('0x4a')]);_0x3a4ee1[_0x1be6('0x25')]=qs[_0x1be6('0x25')](_0x259884[_0x1be6('0x42')][_0x1be6('0x25')]);}_0x3a4ee1[_0x1be6('0x4b')]=qs[_0x1be6('0x4c')](_0x259884[_0x1be6('0x42')][_0x1be6('0x4c')]);_0x3a4ee1[_0x1be6('0x4d')]=qs[_0x1be6('0x43')](_['pick'](_0x259884['query'],_0x4ceaba[_0x1be6('0x43')]),_0x307cd9);var _0x504c26=[];var _0x4af18b=squel[_0x1be6('0x4e')]()[_0x1be6('0x4f')]('id')[_0x1be6('0x4f')](_0x1be6('0x31'))[_0x1be6('0x4f')]('color')[_0x1be6('0x50')]('tools_tags');var _0x22b648=squel[_0x1be6('0x4e')]()[_0x1be6('0x4f')]('u.id')[_0x1be6('0x4f')](_0x1be6('0x51'))['field'](_0x1be6('0x52'))[_0x1be6('0x50')](_0x1be6('0x53'),'ui')['left_join'](_0x1be6('0x54'),'u',_0x1be6('0x55'));var _0xa37bb5=squel['select']()[_0x1be6('0x50')](_0x1be6('0x56'),'i')[_0x1be6('0x57')](_0x1be6('0x58'),'c',_0x1be6('0x59'))['left_join']('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x1be6('0x5a'),'a',_0x1be6('0x5b'))[_0x1be6('0x57')](_0x1be6('0x5c'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it',_0x1be6('0x5d'))[_0x1be6('0x57')](_0x1be6('0x5e'),'t',_0x1be6('0x5f'));var _0x1f9758=squel[_0x1be6('0x60')]();var _0x3b9967=[];var _0x1d2f46=squel[_0x1be6('0x60')]();var _0x46a227;if(_0x259884[_0x1be6('0x42')][_0x1be6('0x61')]){_0x46a227=as[_0x1be6('0x62')](_0x259884['query'][_0x1be6('0x61')]);var _0x219832=_0x46a227[_0x1be6('0x63')];for(var _0x43a687=0x0;_0x43a687<_0x46a227[_0x1be6('0x64')][_0x1be6('0x47')];_0x43a687++){var _0x4ff5d9=_0x46a227[_0x1be6('0x64')][_0x43a687];var _0xe25c3c='i';var _0x2e7dc9=_[_0x1be6('0x65')](_0x307cd9,[_0x1be6('0x31'),_0x4ff5d9[_0x1be6('0x4f')]]);if(!_0x2e7dc9){switch(_0x4ff5d9[_0x1be6('0x4f')]){case _0x1be6('0x66'):if(_0x4ff5d9['value']==0x1){_0xa37bb5[_0x1be6('0x67')]('`'+_0x4ff5d9[_0x1be6('0x4f')]+_0x1be6('0x68'));}else{_0xa37bb5['having']('`'+_0x4ff5d9[_0x1be6('0x4f')]+_0x1be6('0x69'));}break;case _0x1be6('0x6a'):if(_0x4ff5d9[_0x1be6('0x6b')]===_0x1be6('0x6c')){if(_0x4ff5d9[_0x1be6('0x6d')][_0x1be6('0x6e')]('\x20')[_0x1be6('0x47')]>0x1){_0x1f9758[_0x219832](_0x1be6('0x6f'),qs['getFullTextValue'](_0x4ff5d9['value']),null);}else{var _0xb61382='%'+_0x4ff5d9['value']+'%';_0x1f9758[_0x219832](_0x1be6('0x70'),_0xb61382,_0xb61382,_0xb61382);}}else{_0x2e7dc9=_[_0x1be6('0x65')](_0x307cd9,['name',_0x1be6('0x71')]);_0x4ff5d9[_0x1be6('0x4f')]='ContactId';_0x2b7b15=as[_0x1be6('0x72')](_0xe25c3c,_0x2e7dc9[_0x1be6('0x40')],_0x4ff5d9);_0x1f9758[_0x219832](_0x2b7b15[_0x1be6('0x73')],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x74')],_0x2b7b15['value'][_0x1be6('0x2e')]);}break;case _0x1be6('0x75'):var _0xbc6b4e=_0x4ff5d9[_0x1be6('0x6d')][_0x1be6('0x6e')](',')['map'](function(_0x13d8e6){return Number(_0x13d8e6);});_0xbc6b4e['forEach'](function(_0xddde06){_0x1d2f46['or'](_0x1be6('0x76'),'%,'+_0xddde06+',%');});_0x3b9967=_[_0x1be6('0x77')](_0x3b9967,_0xbc6b4e);break;case'User':if(_0x4ff5d9[_0x1be6('0x6b')]===_0x1be6('0x6c')){_0x1f9758[_0x219832](_0x1be6('0x78'),'%'+_0x4ff5d9[_0x1be6('0x6d')]+'%',null);}else{_0x2e7dc9=_[_0x1be6('0x65')](_0x307cd9,[_0x1be6('0x31'),_0x1be6('0x79')]);_0x4ff5d9[_0x1be6('0x4f')]=_0x1be6('0x79');_0x2b7b15=as[_0x1be6('0x72')](_0xe25c3c,_0x2e7dc9[_0x1be6('0x40')],_0x4ff5d9);_0x1f9758[_0x219832](_0x2b7b15[_0x1be6('0x73')],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x74')],_0x2b7b15['value'][_0x1be6('0x2e')]);}break;case _0x1be6('0x7a'):_0x2b7b15=as[_0x1be6('0x72')]('me',null,_0x4ff5d9);_0x1f9758[_0x219832](_0x2b7b15[_0x1be6('0x73')],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x74')],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x2e')]);break;}}else{var _0x2b7b15=as[_0x1be6('0x72')](_0xe25c3c,_0x2e7dc9[_0x1be6('0x40')],_0x4ff5d9);_0x1f9758[_0x219832](_0x2b7b15['text'],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x74')],_0x2b7b15[_0x1be6('0x6d')][_0x1be6('0x2e')]);}}}else{var _0x524c01=_(_0x259884[_0x1be6('0x42')])[_0x1be6('0x7b')]()[_0x1be6('0x34')](function(_0x2c153b){return _[_0x1be6('0x7c')](_0x307cd9,[_0x1be6('0x31'),_0x2c153b])?_0x2c153b:undefined;})[_0x1be6('0x7d')]()[_0x1be6('0x6d')]();if(!_[_0x1be6('0x7e')](_0x524c01)){_0x524c01[_0x1be6('0x38')](function(_0x5de420){if(_0x5de420===_0x1be6('0x7f')){_0xa37bb5['where'](_0x1be6('0x80'),[]['concat'](_0x259884[_0x1be6('0x42')][_0x5de420]));}else if(_0x5de420===_0x1be6('0x81')){var _0x2678b7=JSON[_0x1be6('0x82')](_0x259884[_0x1be6('0x42')][_0x5de420])['$gte'];var _0x58040d=JSON['parse'](_0x259884[_0x1be6('0x42')][_0x5de420])[_0x1be6('0x83')];_0xa37bb5[_0x1be6('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2678b7,_0x58040d);}else{if(_0x259884[_0x1be6('0x42')][_0x5de420]==='null'){_0xa37bb5[_0x1be6('0x4d')]('i.'+_0x5de420+_0x1be6('0x84'));}else{_0xa37bb5['where']('i.'+_0x5de420+_0x1be6('0x85'),_0x259884[_0x1be6('0x42')][_0x5de420]);}}});}if(_0x259884[_0x1be6('0x42')][_0x1be6('0x86')]){if(_0x259884[_0x1be6('0x42')][_0x1be6('0x86')]==0x1){_0xa37bb5[_0x1be6('0x67')](_0x1be6('0x87'));}else{_0xa37bb5[_0x1be6('0x67')]('`unreadMessages`\x20>\x200');}}if(_0x259884['query']['tag']){_0x3b9967=_['isArray'](_0x259884[_0x1be6('0x42')][_0x1be6('0x88')])?_0x259884[_0x1be6('0x42')]['tag']:new Array(_0x259884['query'][_0x1be6('0x88')]);_0x3b9967[_0x1be6('0x38')](function(_0x3196d3){_0x1d2f46['or'](_0x1be6('0x76'),'%,'+_0x3196d3+',%');});}if(_0x259884[_0x1be6('0x42')][_0x1be6('0x89')]){var _0x3460dc=_0x259884['query']['filter'][_0x1be6('0x8a')]('\x5c','\x5c\x5c')[_0x1be6('0x8a')]('\x27\x27',_0x1be6('0x8b'));if(qs[_0x1be6('0x8c')](_0x3460dc)){_0x1f9758['or'](_0x1be6('0x8d'),_0x3460dc+'%');}else if(qs[_0x1be6('0x8e')](_0x3460dc)){_0x1f9758['or']('c.email\x20LIKE\x20?',_0x3460dc+'%');}else{_0x1f9758['or'](_0x1be6('0x8f'),qs[_0x1be6('0x90')](_0x3460dc))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3460dc));}}}_0xa37bb5[_0x1be6('0x4d')](_0x1f9758);_0xa37bb5[_0x1be6('0x91')]('i.id');var _0x1fef3f={'type':db['Sequelize']['QueryTypes'][_0x1be6('0x92')],'raw':!![]};var _0x221ddc=_0xa37bb5[_0x1be6('0x93')]();_0x221ddc[_0x1be6('0x4f')](_0x1be6('0x94'));_0x221ddc['field'](_0x1be6('0x95'),_0x1be6('0x66'));if(_0x3a4ee1[_0x1be6('0x4b')]){_0x3a4ee1[_0x1be6('0x4b')][_0x1be6('0x38')](function(_0x538428){_0xa37bb5[_0x1be6('0x4b')]('i.'+_0x538428[0x0],_0x538428[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1be6('0x7e')](_0x3b9967)){_0xa37bb5[_0x1be6('0x67')](_0x1d2f46);_0x221ddc[_0x1be6('0x4d')]('t.id\x20IN\x20?',_0x3b9967);}BPromise['resolve']()['then'](function(){if(!_0x46a227){if(_0x259884[_0x1be6('0x42')][_0x1be6('0x7f')]||_0x259884['query']['journey'])return;_0x221ddc[_0x1be6('0x4d')](_0x1be6('0x96'));_0xa37bb5['where'](_0x1be6('0x96'));return;}return _0x259884[_0x1be6('0x97')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x1be6('0x2d')](function(_0x13119c){if(_[_0x1be6('0x7e')](_0x13119c)){_0x221ddc['where'](_0x1be6('0x98'));_0xa37bb5[_0x1be6('0x4d')](_0x1be6('0x98'));}else{_0x221ddc[_0x1be6('0x4d')](_0x1be6('0x80'),_[_0x1be6('0x34')](_0x13119c,'id'));_0xa37bb5[_0x1be6('0x4d')](_0x1be6('0x80'),_[_0x1be6('0x34')](_0x13119c,'id'));}});})['then'](function(){db[_0x1be6('0x99')]['query'](_0x221ddc[_0x1be6('0x9a')](),_0x1fef3f)['then'](function(_0x3b5a31){_0x15b678[_0x1be6('0x9b')]=_0x3b5a31['length'];if(_0x15b678['count']===0x0)return[];return db[_0x1be6('0x99')][_0x1be6('0x42')](_0x4af18b[_0x1be6('0x9a')](),_0x1fef3f)[_0x1be6('0x2d')](function(_0x5a2251){_0x504c26=_[_0x1be6('0x9c')](_0x5a2251,'id');_0x1fef3f=_[_0x1be6('0x9d')](_0x1fef3f,{'model':db[_0x1be6('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x259884[_0x1be6('0x42')][_0x1be6('0x46')]){_0x3a4ee1[_0x1be6('0x45')][_0x1be6('0x38')](function(_0x30e0eb){_0xa37bb5[_0x1be6('0x4f')]('i.'+_0x30e0eb);});}else{_0xa37bb5[_0x1be6('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1be6('0x66'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0x9e'),_0x1be6('0x9f'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa0'),'Account.mandatoryDisposition');_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0x94'));_0xa37bb5['field'](_0x1be6('0xa1'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa2'));_0xa37bb5['field'](_0x1be6('0xa3'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa4'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa5'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa6'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa7'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa8'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xa9'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xaa'));_0xa37bb5[_0x1be6('0x4f')]('i.thirdDisposition');_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xab'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xac'));_0xa37bb5['field'](_0x1be6('0xad'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xae'));_0xa37bb5['field']('i.UserId');_0xa37bb5['field']('c.firstName',_0x1be6('0xaf'));_0xa37bb5['field']('c.lastName','Contact.lastName');_0xa37bb5['field']('c.email',_0x1be6('0xb0'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xb1'),_0x1be6('0xb2'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xb3'),_0x1be6('0xb4'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xb5'),_0x1be6('0xb6'));_0xa37bb5[_0x1be6('0x4f')](_0x1be6('0xb7'),_0x1be6('0xb8'));_0xa37bb5['field']('o.internal',_0x1be6('0xb9'));_0xa37bb5[_0x1be6('0x4f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1be6('0x36'));}if(_0x3a4ee1[_0x1be6('0x4a')])_0xa37bb5[_0x1be6('0x4a')](_0x3a4ee1['limit']);if(_0x3a4ee1[_0x1be6('0x25')])_0xa37bb5['offset'](_0x3a4ee1['offset']);return db[_0x1be6('0x99')][_0x1be6('0x42')](_0xa37bb5[_0x1be6('0x9a')](),_0x1fef3f);})['then'](function(_0x1299ab){_0x22b648['where']('ui.MailInteractionId\x20IN\x20?',_['map'](_0x1299ab,'id'));return db[_0x1be6('0x99')][_0x1be6('0x42')](_0x22b648[_0x1be6('0x9a')](),_0x1fef3f)['then'](function(_0x3a8999){var _0x301c79=_[_0x1be6('0xba')](_0x3a8999,_0x1be6('0xbb'));var _0x37b9fd=[];return db[_0x1be6('0xbc')][_0x1be6('0x39')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x5dce92){var _0x7241eb=_0x5dce92[_0x1be6('0xbd')];_0x1299ab['forEach'](function(_0xc7de9){_0x37b9fd[_0x1be6('0xbe')](updateMailInteraction(_0xc7de9,_0x504c26,_0x301c79,_0x7241eb));});return BPromise[_0x1be6('0xbf')](_0x37b9fd);});});});})['then'](function(_0x4cdb25){_0x15b678[_0x1be6('0xc0')]=_0x4cdb25;return _0x15b678;})[_0x1be6('0x2d')](respondWithFilteredResult(_0x360953,_0x3a4ee1));})['catch'](handleError(_0x360953,null));};exports['show']=function(_0x282a87,_0x358cfb){var _0x5bf1b1={'raw':![],'where':{'id':_0x282a87[_0x1be6('0xc1')]['id']}},_0x405584={};_0x405584['model']=_[_0x1be6('0x7b')](db['MailInteraction'][_0x1be6('0x3f')]);_0x405584[_0x1be6('0x42')]=_[_0x1be6('0x7b')](_0x282a87['query']);_0x405584[_0x1be6('0xc2')]=_[_0x1be6('0x44')](_0x405584['model'],_0x405584[_0x1be6('0x42')]);_0x5bf1b1[_0x1be6('0x45')]=_[_0x1be6('0x44')](_0x405584[_0x1be6('0x41')],qs['fields'](_0x282a87[_0x1be6('0x42')][_0x1be6('0x46')]));_0x5bf1b1[_0x1be6('0x45')]=_0x5bf1b1['attributes'][_0x1be6('0x47')]?_0x5bf1b1['attributes']:_0x405584[_0x1be6('0x41')];if(_0x282a87[_0x1be6('0x42')]['includeAll']){_0x5bf1b1[_0x1be6('0xc3')]=[{'all':!![]}];}_0x5bf1b1=_['merge']({},_0x5bf1b1,_0x282a87[_0x1be6('0xc4')]);return db[_0x1be6('0x3e')][_0x1be6('0x65')](_0x5bf1b1)['then'](handleEntityNotFound(_0x358cfb,null))[_0x1be6('0x2d')](respondWithResult(_0x358cfb,null))[_0x1be6('0x3d')](handleError(_0x358cfb,null));};exports['create']=function(_0x292627,_0x46322a){return db[_0x1be6('0x3e')][_0x1be6('0xc5')](_0x292627[_0x1be6('0xc6')],{})[_0x1be6('0x2d')](respondWithResult(_0x46322a,0xc9))[_0x1be6('0x3d')](handleError(_0x46322a,null));};exports[_0x1be6('0x2b')]=function(_0x5122db,_0x7769cb){if(_0x5122db['body']['id']){delete _0x5122db['body']['id'];}return db['MailInteraction'][_0x1be6('0x65')]({'where':{'id':_0x5122db[_0x1be6('0xc1')]['id']}})['then'](handleEntityNotFound(_0x7769cb,null))[_0x1be6('0x2d')](saveUpdates(_0x5122db[_0x1be6('0xc6')],null))[_0x1be6('0x2d')](respondWithResult(_0x7769cb,null))[_0x1be6('0x3d')](handleError(_0x7769cb,null));};exports[_0x1be6('0x2c')]=function(_0x39ea95,_0x3538ff){return db[_0x1be6('0x3e')][_0x1be6('0x65')]({'where':{'id':_0x39ea95[_0x1be6('0xc1')]['id']}})[_0x1be6('0x2d')](handleEntityNotFound(_0x3538ff,null))[_0x1be6('0x2d')](removeEntity(_0x3538ff,null))['catch'](handleError(_0x3538ff,null));};exports[_0x1be6('0xc7')]=function(_0x1c0296,_0x2b9ec0){return db[_0x1be6('0x3e')][_0x1be6('0xc7')]()[_0x1be6('0x2d')](respondWithResult(_0x2b9ec0,null))[_0x1be6('0x3d')](handleError(_0x2b9ec0,null));};exports[_0x1be6('0xc8')]=function(_0x586cdb,_0xc05397,_0x100496){return db[_0x1be6('0xc9')][_0x1be6('0x65')]({'where':{'id':_0x586cdb['params']['id']}})[_0x1be6('0x2d')](handleEntityNotFound(_0xc05397,null))[_0x1be6('0x2d')](function(_0x37a18e){if(_0x37a18e){return _0x37a18e[_0x1be6('0xc8')](_0x586cdb[_0x1be6('0xc6')][_0x1be6('0xca')],_[_0x1be6('0xcb')](_0x586cdb['body'],[_0x1be6('0xca'),'id'])||{});}})[_0x1be6('0x2d')](respondWithResult(_0xc05397,null))[_0x1be6('0x3d')](handleError(_0xc05397,null));};exports['getMessages']=function(_0x40b791,_0x12e5d5,_0x258af7){var _0x8c28a8={'raw':![],'where':{}};var _0x5e362a={};var _0x5d038f={'count':0x0,'rows':[]};return db['MailInteraction'][_0x1be6('0x39')]({'where':{'id':_0x40b791[_0x1be6('0xc1')]['id']}})['then'](handleEntityNotFound(_0x12e5d5,null))[_0x1be6('0x2d')](function(_0x3c978e){if(_0x3c978e){_0x5e362a[_0x1be6('0x41')]=_['keys'](db[_0x1be6('0xc9')][_0x1be6('0x3f')]);_0x5e362a['query']=_['keys'](_0x40b791[_0x1be6('0x42')]);_0x5e362a[_0x1be6('0x43')]=_[_0x1be6('0x44')](_0x5e362a[_0x1be6('0x41')],_0x5e362a['query']);_0x8c28a8['attributes']=_[_0x1be6('0x44')](_0x5e362a[_0x1be6('0x41')],qs['fields'](_0x40b791[_0x1be6('0x42')][_0x1be6('0x46')]));_0x8c28a8[_0x1be6('0x45')]=_0x8c28a8[_0x1be6('0x45')][_0x1be6('0x47')]?_0x8c28a8[_0x1be6('0x45')]:_0x5e362a[_0x1be6('0x41')];if(!_0x40b791[_0x1be6('0x42')][_0x1be6('0x48')](_0x1be6('0x49'))){_0x8c28a8['limit']=qs[_0x1be6('0x4a')](_0x40b791[_0x1be6('0x42')][_0x1be6('0x4a')]);_0x8c28a8['offset']=qs['offset'](_0x40b791[_0x1be6('0x42')]['offset']);}_0x8c28a8[_0x1be6('0x4b')]=qs[_0x1be6('0x4c')](_0x40b791[_0x1be6('0x42')][_0x1be6('0x4c')]);_0x8c28a8[_0x1be6('0x4d')]=qs[_0x1be6('0x43')](_['pick'](_0x40b791[_0x1be6('0x42')],_0x5e362a[_0x1be6('0x43')]));_0x8c28a8[_0x1be6('0x4d')][_0x1be6('0xbb')]=_0x3c978e['id'];if(_0x40b791[_0x1be6('0x42')][_0x1be6('0x89')]){_0x8c28a8['where']=_['merge'](_0x8c28a8['where'],{'$or':_['map'](_0x8c28a8['attributes'],function(_0x5eb715){var _0x50db84={};_0x50db84[_0x5eb715]={'$like':'%'+_0x40b791[_0x1be6('0x42')][_0x1be6('0x89')]+'%'};return _0x50db84;})});}if(_0x40b791[_0x1be6('0x42')]['$gte']){var _0x4cbff3=_0x40b791[_0x1be6('0x42')][_0x1be6('0xcc')]['split'](',');var _0x1f2d0d={};_0x1f2d0d[_0x4cbff3[0x0]]={'$gte':moment(_0x4cbff3[0x1])['format'](_0x1be6('0xcd'))};_0x8c28a8['where']=_['merge'](_0x8c28a8[_0x1be6('0x4d')],_0x1f2d0d);}_0x8c28a8=_[_0x1be6('0x9d')]({},_0x8c28a8,_0x40b791['options']);return db[_0x1be6('0xc9')][_0x1be6('0x9b')]({'where':_0x8c28a8[_0x1be6('0x4d')]})[_0x1be6('0x2d')](function(_0x3fd85a){_0x5d038f[_0x1be6('0x9b')]=_0x3fd85a;if(_0x40b791[_0x1be6('0x42')][_0x1be6('0xce')]){_0x8c28a8[_0x1be6('0xc3')]=[{'all':!![]}];}return db[_0x1be6('0xc9')][_0x1be6('0xcf')](_0x8c28a8);})['then'](function(_0x4f9cf8){_0x5d038f[_0x1be6('0xc0')]=_0x4f9cf8;return _0x5d038f;});}})[_0x1be6('0x2d')](respondWithFilteredResult(_0x12e5d5,_0x8c28a8))['catch'](handleError(_0x12e5d5,null));};exports[_0x1be6('0xd0')]=function(_0x3cc094,_0x3b872c,_0x11b8e0){return db['MailInteraction'][_0x1be6('0x65')]({'where':{'id':_0x3cc094[_0x1be6('0xc1')]['id']}})['then'](handleEntityNotFound(_0x3b872c,null))[_0x1be6('0x2d')](function(_0x3dc41e){if(_0x3dc41e){return _0x3dc41e['setTags'](_0x3cc094['body'][_0x1be6('0xca')],_[_0x1be6('0xcb')](_0x3cc094[_0x1be6('0xc6')],[_0x1be6('0xca'),'id'])||{})[_0x1be6('0xd1')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1be6('0x31'),_0x1be6('0xd2')],'where':{'id':_0x3cc094[_0x1be6('0xc6')]['ids']}});})[_0x1be6('0x2d')](function(_0x41f8e6){socket[_0x1be6('0xd3')](_0x1be6('0xd4'),{'id':Number(_0x3cc094[_0x1be6('0xc1')]['id']),'tags':_0x41f8e6||[]});return{'id':Number(_0x3cc094[_0x1be6('0xc1')]['id']),'tags':_0x41f8e6||[]};});}})[_0x1be6('0x2d')](respondWithResult(_0x3b872c,null))[_0x1be6('0x3d')](handleError(_0x3b872c,null));};exports[_0x1be6('0xd5')]=function(_0x41212e,_0x5e0234,_0x5ce442){return db[_0x1be6('0x3e')][_0x1be6('0x65')]({'where':{'id':_0x41212e[_0x1be6('0xc1')]['id']}})[_0x1be6('0x2d')](handleEntityNotFound(_0x5e0234,null))['then'](function(_0x17b72f){if(_0x17b72f){return _0x17b72f[_0x1be6('0xd5')](_0x41212e[_0x1be6('0x42')]['ids']);}})[_0x1be6('0x2d')](respondWithStatusCode(_0x5e0234,null))[_0x1be6('0x3d')](handleError(_0x5e0234,null));};exports['download']=function(_0x2d9f2e,_0x2ae0a8){var _0x3fc0f8=moment()[_0x1be6('0xd6')]()['toString']();var _0x475cfb=path[_0x1be6('0xd7')](config[_0x1be6('0xd8')],'server','files',_0x1be6('0xd9'));var _0x4c5cbc=path[_0x1be6('0xd7')](config['root'],_0x1be6('0xda'),_0x1be6('0xdb'),_0x1be6('0xdc'));var _0x4e2c81=path[_0x1be6('0xd7')](_0x475cfb,_0x3fc0f8);var _0xd8605d=util[_0x1be6('0xdd')](_0x1be6('0xde'),_0x2d9f2e[_0x1be6('0xc1')]['id'],_0x3fc0f8);var _0x51dffa=path[_0x1be6('0xd7')](_0x475cfb,_0xd8605d);var _0x12d9e4=[];if(_0x2d9f2e['query']['attachments']){_0x12d9e4[_0x1be6('0xbe')]({'model':db[_0x1be6('0xdf')],'as':_0x1be6('0xe0'),'raw':!![]});}var _0x24d2c8=[{'model':db[_0x1be6('0xc9')],'as':_0x1be6('0xe1'),'attributes':['id','body',_0x1be6('0x50'),'to','cc',_0x1be6('0xe2'),_0x1be6('0xe3'),_0x1be6('0x81')],'where':{'secret':![]},'order':qs[_0x1be6('0x4c')]('id'),'include':_0x12d9e4}];return db['MailInteraction'][_0x1be6('0x65')]({'where':{'id':_0x2d9f2e['params']['id']},'include':_0x24d2c8})[_0x1be6('0x2d')](handleEntityNotFound(_0x2ae0a8,null))[_0x1be6('0x2d')](function(_0x3b2416){if(_0x3b2416&&_0x3b2416['Messages']){var _0x344824=_0x3b2416['get']({'plain':!![]});fs[_0x1be6('0xe4')](_0x4e2c81);return BPromise[_0x1be6('0xe5')](_0x344824['Messages'],function(_0x5e7f49,_0x595442){var _0x327981={'from':_0x5e7f49['from'],'to':_0x5e7f49['to'],'subject':_0x5e7f49[_0x1be6('0xe3')],'html':_0x5e7f49[_0x1be6('0xc6')],'headers':{'Date':moment(_0x5e7f49[_0x1be6('0x81')])['format'](_0x1be6('0xe6'))},'attachments':[]};if(_0x5e7f49['cc']){_0x327981[_0x1be6('0xe7')]['Cc']=_0x5e7f49['cc'];}if(_0x5e7f49[_0x1be6('0xe2')]){_0x327981[_0x1be6('0xe7')]['Bcc']=_0x5e7f49[_0x1be6('0xe2')];}return new BPromise(function(_0x324fd5,_0x4e1185){if(_0x5e7f49[_0x1be6('0xe0')]){for(var _0x1ca0e6=0x0;_0x1ca0e6<_0x5e7f49[_0x1be6('0xe0')][_0x1be6('0x47')];_0x1ca0e6++){var _0x2787cd=_0x5e7f49[_0x1be6('0xe0')][_0x1ca0e6];var _0x379e3b=path[_0x1be6('0xd7')](_0x4c5cbc,_0x2787cd[_0x1be6('0xe8')]);if(fs['existsSync'](_0x379e3b)){_0x327981[_0x1be6('0xdc')][_0x1be6('0xbe')]({'name':_0x2787cd['name'],'contentType':_0x2787cd[_0x1be6('0x40')],'data':fs[_0x1be6('0xe9')](_0x379e3b)});}}}emlformat[_0x1be6('0xea')](_0x327981,function(_0x4faa6f,_0x49ac4a){if(_0x4faa6f)return _0x4e1185(_0x4faa6f);fs[_0x1be6('0xeb')](path[_0x1be6('0xd7')](_0x4e2c81,util[_0x1be6('0xdd')](_0x1be6('0xec'),_0x595442)),_0x49ac4a);return _0x324fd5(_0x49ac4a);});});})[_0x1be6('0x2d')](function(){return new BPromise(function(_0x77b156,_0x239508){zipdir(_0x4e2c81,{'saveTo':_0x51dffa},function(_0x2f6faa,_0x169b23){if(_0x2f6faa)return _0x239508(_0x2f6faa);return _0x77b156(_0x169b23);});})[_0x1be6('0x2d')](function(){return new BPromise(function(_0x4a5c57,_0x38ede0){rimraf(_0x4e2c81,function(_0x43ba10){if(_0x43ba10)_0x38ede0(_0x43ba10);return _0x4a5c57();});});})[_0x1be6('0x2d')](function(){return _0x2ae0a8[_0x1be6('0xed')](_0x51dffa,_0xd8605d,function(_0x5630a6){if(_0x5630a6){console[_0x1be6('0xee')](_0x1be6('0xef'),_0x5630a6);}else{fs['unlinkSync'](_0x51dffa);}});});});}else{return _0x2ae0a8[_0x1be6('0x22')](0xc8);}})[_0x1be6('0x3d')](handleError(_0x2ae0a8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c96c61c..ee8f4a7 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 _0xce4c=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x1fc2d8,_0xe76a5a){var _0x3cd535=function(_0x3e644a){while(--_0x3e644a){_0x1fc2d8['push'](_0x1fc2d8['shift']());}};_0x3cd535(++_0xe76a5a);}(_0xce4c,0x148));var _0xcce4=function(_0x13d911,_0x472938){_0x13d911=_0x13d911-0x0;var _0x1bb4ea=_0xce4c[_0x13d911];return _0x1bb4ea;};'use strict';var EventEmitter=require(_0xcce4('0x0'));var MailInteraction=require(_0xcce4('0x1'))['db'][_0xcce4('0x2')];var MailMessage=require(_0xcce4('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcce4('0x3')](0x0);var events={'afterCreate':_0xcce4('0x4'),'afterUpdate':_0xcce4('0x5'),'afterDestroy':_0xcce4('0x6')};function emitEvent(_0x53048b){return function(_0x73f8be,_0x580361,_0x1221d3){_0x73f8be[_0xcce4('0x7')]({'attributes':['id'],'raw':!![]})[_0xcce4('0x8')](function(_0x2ddf9a){_0x73f8be[_0xcce4('0x9')](_0xcce4('0xa'),_0x2ddf9a[_0xcce4('0xb')](function(_0x4e4d68){return{'id':_0x4e4d68['id']};}));return MailMessage[_0xcce4('0xc')]({'where':{'MailInteractionId':_0x73f8be['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcce4('0x8')](function(_0x3a2008){_0x73f8be[_0xcce4('0x9')]('unreadMessages',_0x3a2008[_0xcce4('0xd')]);MailInteractionEvents[_0xcce4('0xe')](_0x53048b+':'+_0x73f8be['id'],_0x73f8be);MailInteractionEvents[_0xcce4('0xe')](_0x53048b,_0x73f8be);_0x1221d3(null);})[_0xcce4('0xf')](_0x1221d3(null));};}for(var e in events){if(events[_0xcce4('0x10')](e)){var event=events[e];MailInteraction[_0xcce4('0x11')](e,emitEvent(event));}}module[_0xcce4('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x635b=['emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','save','update','getUsers','then','setDataValue','map','unreadMessages','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x635b,0x155));var _0xb635=function(_0xc7d63f,_0x266a2b){_0xc7d63f=_0xc7d63f-0x0;var _0x3f8b5e=_0x635b[_0xc7d63f];return _0x3f8b5e;};'use strict';var EventEmitter=require(_0xb635('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xb635('0x1'))['db'][_0xb635('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb635('0x3'),'afterUpdate':_0xb635('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3c1fb1){return function(_0x296fd4,_0x4f8c97,_0x17c3c8){_0x296fd4[_0xb635('0x5')]({'attributes':['id'],'raw':!![]})[_0xb635('0x6')](function(_0x3b4804){_0x296fd4[_0xb635('0x7')]('Users',_0x3b4804[_0xb635('0x8')](function(_0x518319){return{'id':_0x518319['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x296fd4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x20a51f){_0x296fd4[_0xb635('0x7')](_0xb635('0x9'),_0x20a51f[_0xb635('0xa')]);MailInteractionEvents[_0xb635('0xb')](_0x3c1fb1+':'+_0x296fd4['id'],_0x296fd4);MailInteractionEvents['emit'](_0x3c1fb1,_0x296fd4);_0x17c3c8(null);})[_0xb635('0xc')](_0x17c3c8(null));};}for(var e in events){if(events[_0xb635('0xd')](e)){var event=events[e];MailInteraction[_0xb635('0xe')](e,emitEvent(event));}}module[_0xb635('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e71f9cd..dfba585 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 _0x39c4=['changed','substatus','models','get','MailMessage','update','catch','utf8mb4','util','moment','bluebird','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x39c4,0x174));var _0x439c=function(_0x5af19d,_0x160180){_0x5af19d=_0x5af19d-0x0;var _0x43545c=_0x39c4[_0x5af19d];return _0x43545c;};'use strict';var _=require('lodash');var util=require(_0x439c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x439c('0x1'));var BPromise=require(_0x439c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x439c('0x3'));var config=require(_0x439c('0x4'));var attributes=require(_0x439c('0x5'));module[_0x439c('0x6')]=function(_0x105a46,_0x387467){return _0x105a46[_0x439c('0x7')](_0x439c('0x8'),attributes,{'tableName':_0x439c('0x9'),'paranoid':![],'indexes':[{'name':_0x439c('0xa'),'fields':[_0x439c('0xb'),'to'],'type':_0x439c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x253d9c,_0x340316,_0x237e38){if(_0x253d9c['substatus']){_0x253d9c[_0x439c('0xd')]=moment()[_0x439c('0xe')](_0x439c('0xf'));}if(_0x253d9c[_0x439c('0x10')]){_0x253d9c[_0x439c('0x11')]=moment()[_0x439c('0xe')](_0x439c('0xf'));}_0x237e38(null,_0x340316);},'beforeUpdate':function(_0xdc7693,_0x8241cc,_0x2f70f5){if(_0xdc7693[_0x439c('0x12')](_0x439c('0x13'))){_0xdc7693['substatusAt']=_0xdc7693[_0x439c('0x13')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xdc7693[_0x439c('0x12')](_0x439c('0x10'))){_0xdc7693[_0x439c('0x11')]=moment()[_0x439c('0xe')](_0x439c('0xf'));_0xdc7693['substatus']=null;_0xdc7693['substatusAt']=null;}_0x2f70f5(null,_0xdc7693);},'afterUpdate':function(_0x38d60d,_0x5478b4,_0x64d6d1){var _0xa448bd=_0x105a46[_0x439c('0x14')];var _0x5c56fe=_0x38d60d[_0x439c('0x15')]({'plain':!![]});if(_0x5c56fe[_0x439c('0x10')]){return _0xa448bd[_0x439c('0x16')][_0x439c('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x5c56fe['id']}})['then'](function(){_0x64d6d1();})[_0x439c('0x18')](function(_0x6c0a9f){_0x64d6d1(_0x6c0a9f);});}else{_0x64d6d1();}}},'charset':_0x439c('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1948=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','update','then','catch','utf8mb4'];(function(_0x3a042e,_0x580916){var _0x538853=function(_0x41846a){while(--_0x41846a){_0x3a042e['push'](_0x3a042e['shift']());}};_0x538853(++_0x580916);}(_0x1948,0x145));var _0x8194=function(_0x2c78de,_0x37cc0b){_0x2c78de=_0x2c78de-0x0;var _0x169036=_0x1948[_0x2c78de];return _0x169036;};'use strict';var _=require(_0x8194('0x0'));var util=require(_0x8194('0x1'));var logger=require(_0x8194('0x2'))(_0x8194('0x3'));var moment=require(_0x8194('0x4'));var BPromise=require('bluebird');var rp=require(_0x8194('0x5'));var fs=require('fs');var path=require(_0x8194('0x6'));var rimraf=require(_0x8194('0x7'));var config=require(_0x8194('0x8'));var attributes=require(_0x8194('0x9'));module[_0x8194('0xa')]=function(_0x2a3372,_0x23f556){return _0x2a3372['define'](_0x8194('0xb'),attributes,{'tableName':_0x8194('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x8194('0xd'),'to'],'type':_0x8194('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ef5be,_0x4ffc45,_0x181b05){if(_0x4ef5be[_0x8194('0xf')]){_0x4ef5be[_0x8194('0x10')]=moment()[_0x8194('0x11')](_0x8194('0x12'));}if(_0x4ef5be['closed']){_0x4ef5be[_0x8194('0x13')]=moment()[_0x8194('0x11')](_0x8194('0x12'));}_0x181b05(null,_0x4ffc45);},'beforeUpdate':function(_0x47d167,_0x1c7e6b,_0x3d7aea){if(_0x47d167[_0x8194('0x14')](_0x8194('0xf'))){_0x47d167[_0x8194('0x10')]=_0x47d167[_0x8194('0xf')]?moment()['format'](_0x8194('0x12')):null;}if(_0x47d167[_0x8194('0x14')](_0x8194('0x15'))){_0x47d167[_0x8194('0x13')]=moment()[_0x8194('0x11')](_0x8194('0x12'));_0x47d167[_0x8194('0xf')]=null;_0x47d167[_0x8194('0x10')]=null;}_0x3d7aea(null,_0x47d167);},'afterUpdate':function(_0x19c23e,_0x5abd09,_0x49731d){var _0x31adc2=_0x2a3372['models'];var _0x41a11e=_0x19c23e['get']({'plain':!![]});if(_0x41a11e['closed']){return _0x31adc2['MailMessage'][_0x8194('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x41a11e['id']}})[_0x8194('0x17')](function(){_0x49731d();})[_0x8194('0x18')](function(_0x2d543d){_0x49731d(_0x2d543d);});}else{_0x49731d();}}},'charset':_0x8194('0x19'),'collate':_0x8194('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4daa555..94be89e 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 _0x1978=['ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags'];(function(_0xd971e0,_0x13099c){var _0x591fe4=function(_0x271455){while(--_0x271455){_0xd971e0['push'](_0xd971e0['shift']());}};_0x591fe4(++_0x13099c);}(_0x1978,0x174));var _0x8197=function(_0x5ae83a,_0x1256f5){_0x5ae83a=_0x5ae83a-0x0;var _0x1d1814=_0x1978[_0x5ae83a];return _0x1d1814;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var moment=require(_0x8197('0x1'));var BPromise=require(_0x8197('0x2'));var rs=require(_0x8197('0x3'));var fs=require('fs');var Redis=require(_0x8197('0x4'));var db=require(_0x8197('0x5'))['db'];var utils=require(_0x8197('0x6'));var logger=require(_0x8197('0x7'))(_0x8197('0x8'));var config=require(_0x8197('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8197('0xa')][_0x8197('0xb')]({'port':0x232a});config[_0x8197('0xc')]=_[_0x8197('0xd')](config[_0x8197('0xc')],{'host':_0x8197('0xe'),'port':0x18eb});var socket=require(_0x8197('0xf'))(new Redis(config[_0x8197('0xc')]));require(_0x8197('0x10'))[_0x8197('0x11')](socket);function respondWithRpcPromise(_0x471393,_0x20fb39,_0x3d62ac){return new BPromise(function(_0x143695,_0x2e20a2){return client['request'](_0x471393,_0x3d62ac)[_0x8197('0x12')](function(_0x3da9b7){logger[_0x8197('0x13')](_0x8197('0x14'),_0x20fb39,_0x8197('0x15'));logger[_0x8197('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x20fb39,'request\x20sent',JSON[_0x8197('0x17')](_0x3da9b7));if(_0x3da9b7[_0x8197('0x18')]){if(_0x3da9b7[_0x8197('0x18')][_0x8197('0x19')]===0x1f4){logger[_0x8197('0x18')]('MailInteraction,\x20%s,\x20%s',_0x20fb39,_0x3da9b7[_0x8197('0x18')]['message']);return _0x2e20a2(_0x3da9b7[_0x8197('0x18')]['message']);}logger[_0x8197('0x18')]('MailInteraction,\x20%s,\x20%s',_0x20fb39,_0x3da9b7[_0x8197('0x18')][_0x8197('0x1a')]);return _0x143695(_0x3da9b7['error'][_0x8197('0x1a')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x20fb39,_0x8197('0x15'));_0x143695(_0x3da9b7['result'][_0x8197('0x1a')]);}})[_0x8197('0x1b')](function(_0x4d858a){logger[_0x8197('0x18')]('MailInteraction,\x20%s,\x20%s',_0x20fb39,_0x4d858a);_0x2e20a2(_0x4d858a);});});}exports[_0x8197('0x1c')]=function(_0x2938df){var _0x43fdf0=this;return new Promise(function(_0x6506c7,_0x22e831){return db[_0x8197('0x1d')]['update'](_0x2938df[_0x8197('0x1e')],{'raw':_0x2938df[_0x8197('0x1f')]?_0x2938df[_0x8197('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2938df['options']?_0x2938df[_0x8197('0x1f')][_0x8197('0x20')]||null:null,'attributes':_0x2938df[_0x8197('0x1f')]?_0x2938df[_0x8197('0x1f')][_0x8197('0x21')]||null:null,'limit':_0x2938df[_0x8197('0x1f')]?_0x2938df['options'][_0x8197('0x22')]||null:null})[_0x8197('0x12')](function(_0xd7285e){logger['info'](_0x8197('0x1c'),_0x2938df);logger[_0x8197('0x16')](_0x8197('0x1c'),_0x2938df,JSON[_0x8197('0x17')](_0xd7285e));_0x6506c7(_0xd7285e);})[_0x8197('0x1b')](function(_0x306164){logger[_0x8197('0x18')]('UpdateMailInteraction',_0x306164[_0x8197('0x1a')],_0x2938df);_0x22e831(_0x43fdf0[_0x8197('0x18')](0x1f4,_0x306164[_0x8197('0x1a')]));});});};exports[_0x8197('0x23')]=function(_0x1b80b8){return new Promise(function(_0x17c060,_0x4b8729){return db[_0x8197('0x1d')][_0x8197('0x24')]({'where':_0x1b80b8['options']?_0x1b80b8[_0x8197('0x1f')][_0x8197('0x20')]||null:null})['then'](function(_0xdf8961){if(_0xdf8961){return _0xdf8961[_0x8197('0x25')](_0x1b80b8[_0x8197('0x1e')][_0x8197('0x26')],_[_0x8197('0x27')](_0x1b80b8[_0x8197('0x1e')],[_0x8197('0x26'),'id'])||{});}})['spread'](function(_0x4dd000){logger['info'](_0x8197('0x28'),_0x1b80b8);logger[_0x8197('0x16')](_0x8197('0x28'),_0x1b80b8,JSON['stringify'](_0x4dd000));_0x17c060(_0x4dd000);})[_0x8197('0x1b')](function(_0x15318a){logger['error']('AddTags',_0x15318a[_0x8197('0x1a')],_0x1b80b8);_0x4b8729(_this[_0x8197('0x18')](0x1f4,_0x15318a['message']));});});}; \ No newline at end of file +var _0x6a55=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4eaec3,_0x25f06b){var _0x470bca=function(_0x9db832){while(--_0x9db832){_0x4eaec3['push'](_0x4eaec3['shift']());}};_0x470bca(++_0x25f06b);}(_0x6a55,0x154));var _0x56a5=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x6a55[_0x51df00];return _0x198328;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require(_0x56a5('0x1'));var BPromise=require(_0x56a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56a5('0x3'));var db=require(_0x56a5('0x4'))['db'];var utils=require(_0x56a5('0x5'));var logger=require(_0x56a5('0x6'))(_0x56a5('0x7'));var config=require(_0x56a5('0x8'));var jayson=require(_0x56a5('0x9'));var client=jayson[_0x56a5('0xa')][_0x56a5('0xb')]({'port':0x232a});config[_0x56a5('0xc')]=_[_0x56a5('0xd')](config[_0x56a5('0xc')],{'host':_0x56a5('0xe'),'port':0x18eb});var socket=require(_0x56a5('0xf'))(new Redis(config['redis']));require(_0x56a5('0x10'))[_0x56a5('0x11')](socket);function respondWithRpcPromise(_0x4dc973,_0x2915f1,_0x57294d){return new BPromise(function(_0x587e36,_0x15efd5){return client[_0x56a5('0x12')](_0x4dc973,_0x57294d)[_0x56a5('0x13')](function(_0x237add){logger[_0x56a5('0x14')](_0x56a5('0x15'),_0x2915f1,_0x56a5('0x16'));logger[_0x56a5('0x17')](_0x56a5('0x18'),_0x2915f1,'request\x20sent',JSON[_0x56a5('0x19')](_0x237add));if(_0x237add[_0x56a5('0x1a')]){if(_0x237add['error'][_0x56a5('0x1b')]===0x1f4){logger[_0x56a5('0x1a')](_0x56a5('0x15'),_0x2915f1,_0x237add[_0x56a5('0x1a')]['message']);return _0x15efd5(_0x237add[_0x56a5('0x1a')][_0x56a5('0x1c')]);}logger[_0x56a5('0x1a')](_0x56a5('0x15'),_0x2915f1,_0x237add[_0x56a5('0x1a')][_0x56a5('0x1c')]);return _0x587e36(_0x237add[_0x56a5('0x1a')][_0x56a5('0x1c')]);}else{logger[_0x56a5('0x14')]('MailInteraction,\x20%s,\x20%s',_0x2915f1,'request\x20sent');_0x587e36(_0x237add[_0x56a5('0x1d')]['message']);}})[_0x56a5('0x1e')](function(_0x44105e){logger[_0x56a5('0x1a')](_0x56a5('0x15'),_0x2915f1,_0x44105e);_0x15efd5(_0x44105e);});});}exports[_0x56a5('0x1f')]=function(_0x51f753){var _0x4bb926=this;return new Promise(function(_0x3f7174,_0x5882cd){return db[_0x56a5('0x20')]['update'](_0x51f753[_0x56a5('0x21')],{'raw':_0x51f753[_0x56a5('0x22')]?_0x51f753[_0x56a5('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51f753[_0x56a5('0x22')]?_0x51f753['options'][_0x56a5('0x23')]||null:null,'attributes':_0x51f753['options']?_0x51f753['options'][_0x56a5('0x24')]||null:null,'limit':_0x51f753['options']?_0x51f753[_0x56a5('0x22')]['limit']||null:null})[_0x56a5('0x13')](function(_0x2cea66){logger[_0x56a5('0x14')]('UpdateMailInteraction',_0x51f753);logger[_0x56a5('0x17')](_0x56a5('0x1f'),_0x51f753,JSON['stringify'](_0x2cea66));_0x3f7174(_0x2cea66);})[_0x56a5('0x1e')](function(_0x3cb7ae){logger[_0x56a5('0x1a')](_0x56a5('0x1f'),_0x3cb7ae[_0x56a5('0x1c')],_0x51f753);_0x5882cd(_0x4bb926[_0x56a5('0x1a')](0x1f4,_0x3cb7ae['message']));});});};exports[_0x56a5('0x25')]=function(_0x5ecc5f){return new Promise(function(_0x2f897d,_0x42b87b){return db[_0x56a5('0x20')][_0x56a5('0x26')]({'where':_0x5ecc5f[_0x56a5('0x22')]?_0x5ecc5f[_0x56a5('0x22')]['where']||null:null})[_0x56a5('0x13')](function(_0x121f83){if(_0x121f83){return _0x121f83[_0x56a5('0x27')](_0x5ecc5f['body'][_0x56a5('0x28')],_[_0x56a5('0x29')](_0x5ecc5f['body'],['ids','id'])||{});}})[_0x56a5('0x2a')](function(_0xa18865){logger[_0x56a5('0x14')]('AddTags',_0x5ecc5f);logger[_0x56a5('0x17')]('AddTags',_0x5ecc5f,JSON[_0x56a5('0x19')](_0xa18865));_0x2f897d(_0xa18865);})[_0x56a5('0x1e')](function(_0x32aed6){logger[_0x56a5('0x1a')](_0x56a5('0x2b'),_0x32aed6[_0x56a5('0x1c')],_0x5ecc5f);_0x42b87b(_this['error'](0x1f4,_0x32aed6['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a158112..09d4912 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 _0x9648=['./mailInteraction.events','save','update','emit','removeListener','register','length','mailInteraction:'];(function(_0x592606,_0x54daf1){var _0x3551a9=function(_0x41464b){while(--_0x41464b){_0x592606['push'](_0x592606['shift']());}};_0x3551a9(++_0x54daf1);}(_0x9648,0xa0));var _0x8964=function(_0x44bbd0,_0x5b7620){_0x44bbd0=_0x44bbd0-0x0;var _0xdeb081=_0x9648[_0x44bbd0];return _0xdeb081;};'use strict';var MailInteractionEvents=require(_0x8964('0x0'));var events=[_0x8964('0x1'),'remove',_0x8964('0x2')];function createListener(_0x1e51a6,_0x4a439a){return function(_0x1e38ca){_0x4a439a[_0x8964('0x3')](_0x1e51a6,_0x1e38ca);};}function removeListener(_0x529c37,_0x604200){return function(){MailInteractionEvents[_0x8964('0x4')](_0x529c37,_0x604200);};}exports[_0x8964('0x5')]=function(_0x45da00){for(var _0x3ae6cf=0x0,_0x228844=events[_0x8964('0x6')];_0x3ae6cf<_0x228844;_0x3ae6cf++){var _0x367091=events[_0x3ae6cf];var _0x385cb0=createListener(_0x8964('0x7')+_0x367091,_0x45da00);MailInteractionEvents['on'](_0x367091,_0x385cb0);}}; \ No newline at end of file +var _0x3114=['length','mailInteraction:','./mailInteraction.events','save','remove','emit','register'];(function(_0x3decc9,_0x2205f2){var _0x50e68f=function(_0xc3e042){while(--_0xc3e042){_0x3decc9['push'](_0x3decc9['shift']());}};_0x50e68f(++_0x2205f2);}(_0x3114,0x1ad));var _0x4311=function(_0x505abb,_0x4fe510){_0x505abb=_0x505abb-0x0;var _0x4f9e2f=_0x3114[_0x505abb];return _0x4f9e2f;};'use strict';var MailInteractionEvents=require(_0x4311('0x0'));var events=[_0x4311('0x1'),_0x4311('0x2'),'update'];function createListener(_0x36b268,_0x3a0868){return function(_0x5c1680){_0x3a0868[_0x4311('0x3')](_0x36b268,_0x5c1680);};}function removeListener(_0xd292c,_0x4595d3){return function(){MailInteractionEvents['removeListener'](_0xd292c,_0x4595d3);};}exports[_0x4311('0x4')]=function(_0x12fae4){for(var _0x3cc055=0x0,_0x2e7255=events[_0x4311('0x5')];_0x3cc055<_0x2e7255;_0x3cc055++){var _0x183be4=events[_0x3cc055];var _0x17f00c=createListener(_0x4311('0x6')+_0x183be4,_0x12fae4);MailInteractionEvents['on'](_0x183be4,_0x17f00c);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e0c9cdb..496cec4 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 _0xbec5=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x5a9de9,_0x52399e){var _0x1fbbe2=function(_0x26ef0a){while(--_0x26ef0a){_0x5a9de9['push'](_0x5a9de9['shift']());}};_0x1fbbe2(++_0x52399e);}(_0xbec5,0xe5));var _0x5bec=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0xbec5[_0x23c73d];return _0x36ba47;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['get'](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth[_0x5bec('0x9')](),interaction['tracked'](_0x5bec('0x11'),_0x5bec('0x12')),controller[_0x5bec('0x13')]);router['put'](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x14')](_0x5bec('0x15'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x16')]);router[_0x5bec('0x14')](_0x5bec('0x17'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x18')]);router[_0x5bec('0x19')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x1a')]);module[_0x5bec('0x1b')]=router; \ No newline at end of file +var _0x9a19=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','express'];(function(_0x584724,_0x19c03c){var _0x6cbac8=function(_0x56fca5){while(--_0x56fca5){_0x584724['push'](_0x584724['shift']());}};_0x6cbac8(++_0x19c03c);}(_0x9a19,0x114));var _0x99a1=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x9a19[_0x11deef];return _0xe9ba85;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['show']);router['get'](_0x99a1('0xe'),auth[_0x99a1('0xa')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')]('/',auth[_0x99a1('0xa')](),interaction['tracked'](_0x99a1('0x11'),_0x99a1('0x12')),controller[_0x99a1('0x13')]);router[_0x99a1('0x14')](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x15')]);router[_0x99a1('0x14')](_0x99a1('0x16'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x17')]);router[_0x99a1('0x14')](_0x99a1('0x18'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x19')]);router['delete'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x1a')]);module[_0x99a1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9d2df7e..18cf8ec 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 _0xb91a=['BOOLEAN','out','STRING','DATE','lodash','exports','TEXT','long','medium'];(function(_0x5a80a9,_0x403b0e){var _0x58d87d=function(_0x91b234){while(--_0x91b234){_0x5a80a9['push'](_0x5a80a9['shift']());}};_0x58d87d(++_0x403b0e);}(_0xb91a,0xe5));var _0xab91=function(_0x214057,_0x35b076){_0x214057=_0x214057-0x0;var _0x58b10b=_0xb91a[_0x214057];return _0x58b10b;};'use strict';var Sequelize=require('sequelize');var _=require(_0xab91('0x0'));module[_0xab91('0x1')]={'body':{'type':Sequelize[_0xab91('0x2')](_0xab91('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xab91('0x4'))},'read':{'type':Sequelize[_0xab91('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xab91('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xab91('0x7')]},'to':{'type':Sequelize[_0xab91('0x2')]('long')},'cc':{'type':Sequelize[_0xab91('0x2')](_0xab91('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xab91('0x3'))},'subject':{'type':Sequelize[_0xab91('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xab91('0x8')]},'originTo':{'type':Sequelize[_0xab91('0x2')](_0xab91('0x3'))},'originCc':{'type':Sequelize[_0xab91('0x2')]('long')}}; \ No newline at end of file +var _0x3c8b=['out','STRING','DATE','lodash','TEXT','long','BOOLEAN','ENUM'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x16182a,_0x53bf81){_0x16182a=_0x16182a-0x0;var _0x3f5ced=_0x3c8b[_0x16182a];return _0x3f5ced;};'use strict';var Sequelize=require('sequelize');var _=require(_0xb3c8('0x0'));module['exports']={'body':{'type':Sequelize[_0xb3c8('0x1')](_0xb3c8('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xb3c8('0x1')]('medium')},'read':{'type':Sequelize[_0xb3c8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb3c8('0x4')]('in',_0xb3c8('0x5')),'defaultValue':_0xb3c8('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xb3c8('0x6')](0x1fe)},'from':{'type':Sequelize[_0xb3c8('0x6')]},'to':{'type':Sequelize[_0xb3c8('0x1')](_0xb3c8('0x2'))},'cc':{'type':Sequelize['TEXT'](_0xb3c8('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0xb3c8('0x2'))},'subject':{'type':Sequelize[_0xb3c8('0x1')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb3c8('0x7')]},'originTo':{'type':Sequelize[_0xb3c8('0x1')](_0xb3c8('0x2'))},'originCc':{'type':Sequelize['TEXT'](_0xb3c8('0x2'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2898247..eb0ba14 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 _0x087b=['fieldName','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','MailMessage','includeAll','include','findAll','rows','show','keys','intersection','options','find','catch','body','destroy','params','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','List','ListId','SendMail','messageId','stringify','accept','mail','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','read1stAt','interaction','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','readFileSync','build','writeFileSync','log','err','html-pdf','eml-format','fast-json-patch','moment','bluebird','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','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','map','rawAttributes'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x087b,0x11a));var _0xb087=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x087b[_0x432fca];return _0x3adba4;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];config[_0xb087('0x1b')]=_[_0xb087('0x1c')](config['redis'],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1b')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);var jayson=require(_0xb087('0x21'));var client=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232c});var client9003=jayson[_0xb087('0x22')][_0xb087('0x23')]({'port':0x232b});var client9002=jayson['client'][_0xb087('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x412b48,_0x597478,_0xcc4426,_0x2b83b7){return new BPromise(function(_0x2e9e74,_0x5bb80b){var _0x330005=_0x2b83b7||client;return _0x330005[_0xb087('0x24')](_0x412b48,_0xcc4426)[_0xb087('0x25')](function(_0x45d074){logger['info'](_0xb087('0x26'),_0x597478,_0xb087('0x27'));logger[_0xb087('0x28')](_0xb087('0x29'),_0x597478,'request\x20sent',JSON['stringify'](_0x45d074));if(_0x45d074['error']){if(_0x45d074['error'][_0xb087('0x2a')]===0x1f4){logger[_0xb087('0x2b')](_0xb087('0x26'),_0x597478,_0x45d074[_0xb087('0x2b')][_0xb087('0x2c')]);return _0x5bb80b(_0x45d074[_0xb087('0x2b')][_0xb087('0x2c')]);}logger['error'](_0xb087('0x26'),_0x597478,_0x45d074[_0xb087('0x2b')][_0xb087('0x2c')]);return _0x2e9e74(_0x45d074[_0xb087('0x2b')][_0xb087('0x2c')]);}else{logger['info'](_0xb087('0x26'),_0x597478,_0xb087('0x27'));_0x2e9e74(_0x45d074['result']['message']);}})['catch'](function(_0x598b99){logger['error'](_0xb087('0x26'),_0x597478,_0x598b99);_0x5bb80b(_0x598b99);});});}function respondWithStatusCode(_0x45685d,_0x1d124f){_0x1d124f=_0x1d124f||0xcc;return function(_0x3ca2df){if(_0x3ca2df){return _0x45685d[_0xb087('0x2d')](_0x1d124f);}return _0x45685d[_0xb087('0x2e')](_0x1d124f)[_0xb087('0x2f')]();};}function respondWithResult(_0x35a52c,_0x6cfb22){_0x6cfb22=_0x6cfb22||0xc8;return function(_0x1551c3){if(_0x1551c3){return _0x35a52c[_0xb087('0x2e')](_0x6cfb22)[_0xb087('0x30')](_0x1551c3);}};}function respondWithFilteredResult(_0xb0baf6,_0x263259){return function(_0x593b78){if(_0x593b78){var _0x37393a=_0x593b78[_0xb087('0x31')],_0x1335d9=_0x263259[_0xb087('0x32')],_0x20183f=_0x263259[_0xb087('0x32')]+_0x263259[_0xb087('0x33')],_0x15c9ac;if(_0x20183f>=_0x37393a){_0x20183f=_0x37393a;_0x15c9ac=0xc8;}else{_0x15c9ac=0xce;}_0xb0baf6['status'](_0x15c9ac);return _0xb0baf6['set'](_0xb087('0x34'),_0x1335d9+'-'+_0x20183f+'/'+_0x37393a)[_0xb087('0x30')](_0x593b78);}return null;};}function patchUpdates(_0x4cb5a8){return function(_0x60bfe2){try{jsonpatch[_0xb087('0x35')](_0x60bfe2,_0x4cb5a8,!![]);}catch(_0x2a48d3){return BPromise[_0xb087('0x36')](_0x2a48d3);}return _0x60bfe2[_0xb087('0x37')]();};}function saveUpdates(_0x427905,_0xa2ac06){return function(_0x3b7ace){if(_0x3b7ace){return _0x3b7ace[_0xb087('0x38')](_0x427905)[_0xb087('0x25')](function(_0x442a5e){return _0x442a5e;});}return null;};}function removeEntity(_0x3069b5,_0x57ae94){return function(_0x3bec03){if(_0x3bec03){return _0x3bec03['destroy']()[_0xb087('0x25')](function(){_0x3069b5[_0xb087('0x2e')](0xcc)[_0xb087('0x2f')]();});}};}function handleEntityNotFound(_0xd0659e,_0x13cb5d){return function(_0x1a4b17){if(!_0x1a4b17){_0xd0659e[_0xb087('0x2d')](0x194);}return _0x1a4b17;};}function handleError(_0x29df58,_0x8a4c3c){_0x8a4c3c=_0x8a4c3c||0x1f4;return function(_0x521c3f){logger['error'](_0x521c3f[_0xb087('0x39')]);if(_0x521c3f[_0xb087('0x3a')]){delete _0x521c3f[_0xb087('0x3a')];}_0x29df58[_0xb087('0x2e')](_0x8a4c3c)[_0xb087('0x3b')](_0x521c3f);};}exports['index']=function(_0x1f24f4,_0x1fdc19){var _0x48524e={},_0x480e22={},_0x1726c2={'count':0x0,'rows':[]};var _0x1c7d90=_[_0xb087('0x3c')](db['MailMessage'][_0xb087('0x3d')],function(_0x21bad8){return{'name':_0x21bad8[_0xb087('0x3e')],'type':_0x21bad8[_0xb087('0x3f')][_0xb087('0x40')]};});_0x480e22['model']=_[_0xb087('0x3c')](_0x1c7d90,'name');_0x480e22[_0xb087('0x41')]=_['keys'](_0x1f24f4[_0xb087('0x41')]);_0x480e22[_0xb087('0x42')]=_['intersection'](_0x480e22[_0xb087('0x43')],_0x480e22['query']);_0x48524e[_0xb087('0x44')]=_['intersection'](_0x480e22[_0xb087('0x43')],qs[_0xb087('0x45')](_0x1f24f4[_0xb087('0x41')][_0xb087('0x45')]));_0x48524e[_0xb087('0x44')]=_0x48524e[_0xb087('0x44')][_0xb087('0x46')]?_0x48524e['attributes']:_0x480e22[_0xb087('0x43')];if(!_0x1f24f4['query'][_0xb087('0x47')](_0xb087('0x48'))){_0x48524e['limit']=qs[_0xb087('0x33')](_0x1f24f4[_0xb087('0x41')][_0xb087('0x33')]);_0x48524e['offset']=qs[_0xb087('0x32')](_0x1f24f4['query'][_0xb087('0x32')]);}_0x48524e[_0xb087('0x49')]=qs['sort'](_0x1f24f4[_0xb087('0x41')][_0xb087('0x4a')]);_0x48524e['where']=qs[_0xb087('0x42')](_[_0xb087('0x4b')](_0x1f24f4['query'],_0x480e22[_0xb087('0x42')]),_0x1c7d90);if(_0x1f24f4[_0xb087('0x41')][_0xb087('0x4c')]){_0x48524e[_0xb087('0x4d')]=_['merge'](_0x48524e['where'],{'$or':_[_0xb087('0x3c')](_0x1c7d90,function(_0x42e19f){if(_0x42e19f[_0xb087('0x3f')]!==_0xb087('0x4e')){var _0x36a88f={};_0x36a88f[_0x42e19f[_0xb087('0x3a')]]={'$like':'%'+_0x1f24f4['query']['filter']+'%'};return _0x36a88f;}})});}_0x48524e=_[_0xb087('0x4f')]({},_0x48524e,_0x1f24f4['options']);var _0x3a405b={'where':_0x48524e[_0xb087('0x4d')]};return db[_0xb087('0x50')][_0xb087('0x31')](_0x3a405b)['then'](function(_0x2be4f2){_0x1726c2['count']=_0x2be4f2;if(_0x1f24f4[_0xb087('0x41')][_0xb087('0x51')]){_0x48524e[_0xb087('0x52')]=[{'all':!![]}];}return db[_0xb087('0x50')][_0xb087('0x53')](_0x48524e);})['then'](function(_0x21506f){_0x1726c2[_0xb087('0x54')]=_0x21506f;return _0x1726c2;})[_0xb087('0x25')](respondWithFilteredResult(_0x1fdc19,_0x48524e))['catch'](handleError(_0x1fdc19,null));};exports[_0xb087('0x55')]=function(_0x4f0bc3,_0x5383ab){var _0x1c9f8f={'raw':!![],'where':{'id':_0x4f0bc3['params']['id']}},_0x341665={};_0x341665[_0xb087('0x43')]=_[_0xb087('0x56')](db[_0xb087('0x50')]['rawAttributes']);_0x341665['query']=_[_0xb087('0x56')](_0x4f0bc3['query']);_0x341665['filtears']=_[_0xb087('0x57')](_0x341665[_0xb087('0x43')],_0x341665[_0xb087('0x41')]);_0x1c9f8f[_0xb087('0x44')]=_[_0xb087('0x57')](_0x341665[_0xb087('0x43')],qs[_0xb087('0x45')](_0x4f0bc3[_0xb087('0x41')][_0xb087('0x45')]));_0x1c9f8f[_0xb087('0x44')]=_0x1c9f8f[_0xb087('0x44')][_0xb087('0x46')]?_0x1c9f8f['attributes']:_0x341665[_0xb087('0x43')];if(_0x4f0bc3[_0xb087('0x41')]['includeAll']){_0x1c9f8f[_0xb087('0x52')]=[{'all':!![]}];}_0x1c9f8f=_[_0xb087('0x4f')]({},_0x1c9f8f,_0x4f0bc3[_0xb087('0x58')]);return db[_0xb087('0x50')][_0xb087('0x59')](_0x1c9f8f)[_0xb087('0x25')](handleEntityNotFound(_0x5383ab,null))[_0xb087('0x25')](respondWithResult(_0x5383ab,null))[_0xb087('0x5a')](handleError(_0x5383ab,null));};exports[_0xb087('0x38')]=function(_0x357616,_0x17c6d0){if(_0x357616['body']['id']){delete _0x357616[_0xb087('0x5b')]['id'];}return db['MailMessage'][_0xb087('0x59')]({'where':{'id':_0x357616['params']['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x17c6d0,null))[_0xb087('0x25')](saveUpdates(_0x357616[_0xb087('0x5b')],null))[_0xb087('0x25')](respondWithResult(_0x17c6d0,null))[_0xb087('0x5a')](handleError(_0x17c6d0,null));};exports[_0xb087('0x5c')]=function(_0x383304,_0x31436c){return db[_0xb087('0x50')][_0xb087('0x59')]({'where':{'id':_0x383304[_0xb087('0x5d')]['id']}})[_0xb087('0x25')](handleEntityNotFound(_0x31436c,null))[_0xb087('0x25')](removeEntity(_0x31436c,null))[_0xb087('0x5a')](handleError(_0x31436c,null));};exports[_0xb087('0x5e')]=function(_0x122103,_0x217f26){return db[_0xb087('0x50')][_0xb087('0x5e')]()[_0xb087('0x25')](respondWithResult(_0x217f26,null))[_0xb087('0x5a')](handleError(_0x217f26,null));};exports[_0xb087('0x5f')]=function(_0x551274,_0x43be69){return db[_0xb087('0x50')][_0xb087('0x5f')](_0x551274['body'])[_0xb087('0x25')](function(_0x1858fe){if(_0x1858fe){if(_0x1858fe['direction']===_0xb087('0x60')&&!_0x1858fe[_0xb087('0x61')]){var _0x2e3a14,_0x596264,_0x133c58;if(_0x551274[_0xb087('0x5b')]['to']){_0x596264=_0x551274[_0xb087('0x5b')]['to'][_0xb087('0x62')](',')[0x0];}return db[_0xb087('0x63')][_0xb087('0x64')]({'where':{'id':_0x1858fe[_0xb087('0x65')]},'include':[{'model':db[_0xb087('0x66')],'as':'List','include':[{'model':db[_0xb087('0x67')],'as':_0xb087('0x68'),'where':{'email':_0x596264},'limit':0x1,'order':[[_0xb087('0x69'),'DESC']]}]},{'model':db[_0xb087('0x6a')],'as':'Smtp','raw':!![]}]})['then'](function(_0x3516d4){_0x2e3a14=_0x3516d4;if(_0x2e3a14&&_0x2e3a14[_0xb087('0x6b')]){var _0x48c00c={'tls':{'rejectUnauthorized':![]}};if(_[_0xb087('0x6c')](_0x2e3a14['Smtp'][_0xb087('0x6d')])){_0x48c00c[_0xb087('0x6e')]=_0x2e3a14['Smtp']['host'];_0x48c00c[_0xb087('0x6f')]=_0x2e3a14['Smtp']['port'];_0x48c00c[_0xb087('0x70')]=_0x2e3a14['Smtp'][_0xb087('0x70')];if(_0x2e3a14['Smtp'][_0xb087('0x71')]){_0x48c00c[_0xb087('0x72')]={'user':_0x2e3a14[_0xb087('0x6b')][_0xb087('0x73')],'pass':_0x2e3a14[_0xb087('0x6b')][_0xb087('0x74')]};}}else{_0x48c00c['service']=_0x2e3a14[_0xb087('0x6b')]['service'];_0x48c00c[_0xb087('0x72')]={'user':_0x2e3a14[_0xb087('0x6b')][_0xb087('0x73')],'pass':_0x2e3a14['Smtp'][_0xb087('0x74')]};_0x48c00c['secure']=_0x2e3a14[_0xb087('0x6b')][_0xb087('0x70')];}if(_0x551274[_0xb087('0x5b')][_0xb087('0x75')]&&_0x551274[_0xb087('0x5b')][_0xb087('0x75')]['length']){for(var _0x245d68=0x0;_0x245d68<_0x551274[_0xb087('0x5b')]['attachments'][_0xb087('0x46')];_0x245d68+=0x1){_0x551274['body'][_0xb087('0x75')][_0x245d68]={'filename':_0x551274[_0xb087('0x5b')][_0xb087('0x75')][_0x245d68][_0xb087('0x3a')],'path':path[_0xb087('0x76')](config[_0xb087('0x77')],_0xb087('0x78'),_0x551274[_0xb087('0x5b')]['attachments'][_0x245d68]['basename'])};}}_0x133c58={'account':_0x48c00c,'message':_0x551274['body']};return;}})[_0xb087('0x25')](function(){if(_0x2e3a14['List']){if(_0x2e3a14[_0xb087('0x79')]['Contacts'][_0xb087('0x46')]){return _0x2e3a14[_0xb087('0x79')][_0xb087('0x68')][0x0];}else{return db[_0xb087('0x67')]['create'](_[_0xb087('0x1c')](_0x551274['body'],{'firstName':_0x551274[_0xb087('0x5b')]['to'],'email':_0x551274[_0xb087('0x5b')]['to'],'phone':_0x551274[_0xb087('0x5b')]['to'],'ListId':_0x2e3a14[_0xb087('0x7a')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x133c58){return respondWithRpcPromise(_0xb087('0x7b'),'sendMail',_0x133c58,client9003)[_0xb087('0x25')](function(_0x108b84){return _0x1858fe[_0xb087('0x38')]({'read':!![],'messageId':_0x108b84[_0xb087('0x7c')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xb087('0x5a')](function(_0x551f56){logger[_0xb087('0x2b')]('%s',JSON[_0xb087('0x7d')](_0x551f56));return _0x1858fe;});}return _0x1858fe;});}return _0x1858fe;}})[_0xb087('0x25')](respondWithResult(_0x43be69,0xc9))[_0xb087('0x5a')](handleError(_0x43be69,null));};var interaction_log=require(_0xb087('0x16'))('mail-interactions');exports[_0xb087('0x7e')]=function(_0x1105bf,_0x5b9c5f,_0x544ee0){var _0x56f00f={'channel':_0xb087('0x7f')};if(_0x1105bf[_0xb087('0x5b')]['id']){delete _0x1105bf[_0xb087('0x5b')]['id'];}_0x1105bf[_0xb087('0x5b')][_0xb087('0x80')]=!![];_0x1105bf[_0xb087('0x5b')]['readAt']=moment()[_0xb087('0x81')](_0xb087('0x82'));_0x1105bf[_0xb087('0x5b')][_0xb087('0x83')]=_0x1105bf[_0xb087('0x5b')][_0xb087('0x83')]||_0x1105bf[_0xb087('0x73')]['id'];return db['MailMessage'][_0xb087('0x59')]({'where':{'id':_0x1105bf[_0xb087('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0xb087('0x67')],'as':'Contact'}]})[_0xb087('0x25')](handleEntityNotFound(_0x5b9c5f,null))['then'](saveUpdates(_0x1105bf[_0xb087('0x5b')],null))[_0xb087('0x25')](function(_0x45da69){if(_0x45da69){_0x56f00f[_0xb087('0x2c')]=_0x45da69[_0xb087('0x84')]({'plain':!![]});return db[_0xb087('0x85')]['find']({'where':{'id':_0x45da69['MailInteractionId']}});}return null;})[_0xb087('0x25')](handleEntityNotFound(_0x5b9c5f,null))[_0xb087('0x25')](function(_0x5b2ebd){if(_0x5b2ebd){return _0x5b2ebd[_0xb087('0x38')]({'UserId':_0x1105bf[_0xb087('0x5b')][_0xb087('0x83')],'read1stAt':_[_0xb087('0x6c')](_0x5b2ebd[_0xb087('0x86')])?moment()[_0xb087('0x81')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb087('0x25')](function(_0x141859){if(_0x141859){_0x56f00f[_0xb087('0x87')]=_0x141859[_0xb087('0x84')]({'plain':!![]});interaction_log[_0xb087('0x88')](_0xb087('0x89'),_0x1105bf[_0xb087('0x73')]['id'],_0x1105bf[_0xb087('0x73')][_0xb087('0x3a')],_0x1105bf['user'][_0xb087('0x8a')],_0x56f00f['interaction']['id'],_0x1105bf[_0xb087('0x5b')]?JSON[_0xb087('0x7d')](_0x1105bf['body']):_0xb087('0x8b'));return respondWithRpcPromise(_0xb087('0x8c'),_0xb087('0x8d'),_0x56f00f);}return null;})[_0xb087('0x25')](function(_0x3f48b6){if(_0x3f48b6){if(_0x1105bf[_0xb087('0x5b')]['manual']){_0x56f00f[_0xb087('0x2c')][_0xb087('0x8e')]=util[_0xb087('0x81')](_0xb087('0x8f'),_0x1105bf[_0xb087('0x73')]['name']);_0x56f00f[_0xb087('0x2c')][_0xb087('0x90')]=_0x56f00f[_0xb087('0x90')];_0x56f00f[_0xb087('0x2c')][_0xb087('0x91')]=_0xb087('0x7e');return respondWithRpcPromise(_0xb087('0x92'),_0xb087('0x92'),{'event':_0xb087('0x93'),'message':_0x56f00f[_0xb087('0x2c')]},client9002)[_0xb087('0x25')](function(){return _0x56f00f;});}return _0x56f00f;}return null;})['then'](respondWithResult(_0x5b9c5f,null))['catch'](handleError(_0x5b9c5f,null));};var interaction_log=require(_0xb087('0x16'))(_0xb087('0x94'));exports[_0xb087('0x36')]=function(_0x28e3a3,_0x2f49df,_0x4c60b0){var _0x40c9d8={'agent':{},'channel':_0xb087('0x7f')};if(_0x28e3a3[_0xb087('0x5b')]['id']){delete _0x28e3a3[_0xb087('0x5b')]['id'];}_0x28e3a3[_0xb087('0x5b')][_0xb087('0x83')]=_0x28e3a3['body'][_0xb087('0x83')]||_0x28e3a3['user']['id'];_0x40c9d8['agent']['id']=_0x28e3a3[_0xb087('0x5b')][_0xb087('0x83')];return db[_0xb087('0x50')][_0xb087('0x59')]({'where':{'id':_0x28e3a3['params']['id'],'UserId':null}})[_0xb087('0x25')](handleEntityNotFound(_0x2f49df,null))[_0xb087('0x25')](function(_0x59981b){if(_0x59981b){_0x40c9d8[_0xb087('0x2c')]=_0x59981b['get']({'plain':!![]});return db['MailInteraction'][_0xb087('0x59')]({'where':{'id':_0x59981b[_0xb087('0x95')]}});}return null;})[_0xb087('0x25')](handleEntityNotFound(_0x2f49df,null))[_0xb087('0x25')](function(_0x2e67d3){if(_0x2e67d3){_0x40c9d8['interaction']=_0x2e67d3[_0xb087('0x84')]({'plain':!![]});interaction_log[_0xb087('0x88')](_0xb087('0x96'),_0x28e3a3[_0xb087('0x73')]['id'],_0x28e3a3['user']['name'],_0x28e3a3['user']['role'],_0x40c9d8[_0xb087('0x87')]['id'],_0x28e3a3[_0xb087('0x5b')]?JSON[_0xb087('0x7d')](_0x28e3a3[_0xb087('0x5b')]):_0xb087('0x8b'));return respondWithRpcPromise(_0xb087('0x97'),_0xb087('0x98'),_0x40c9d8);}return null;})['then'](function(_0x5d45e7){if(_0x5d45e7){_0x5d45e7[_0xb087('0x2c')][_0xb087('0x8e')]=util[_0xb087('0x81')](_0xb087('0x8f'),_0x28e3a3['user'][_0xb087('0x3a')]);_0x5d45e7['message'][_0xb087('0x90')]=_0x40c9d8['channel'];_0x5d45e7[_0xb087('0x2c')][_0xb087('0x91')]=_0xb087('0x36');respondWithRpcPromise(_0xb087('0x92'),'EventManager',{'event':_0xb087('0x99'),'message':_0x5d45e7['message']},client9002);return _0x40c9d8;}return null;})['then'](respondWithResult(_0x2f49df,null))['catch'](handleError(_0x2f49df,null));};exports[_0xb087('0x9a')]=function(_0x5bee38,_0x32147f){var _0x6f793b=moment()[_0xb087('0x9b')]()[_0xb087('0x9c')]();var _0x99d93a=path[_0xb087('0x76')](config[_0xb087('0x77')],_0xb087('0x9d'),_0xb087('0x9e'),_0xb087('0x9f'));var _0x2d2524=path[_0xb087('0x76')](config[_0xb087('0x77')],_0xb087('0x9d'),_0xb087('0x9e'),_0xb087('0x75'));var _0x2e75af=util[_0xb087('0x81')]('message-%s.eml',_0x6f793b);return db[_0xb087('0x50')]['find']({'where':{'id':_0x5bee38[_0xb087('0x5d')]['id']},'attributes':['id',_0xb087('0x5b'),_0xb087('0xa0'),'to','cc',_0xb087('0xa1'),_0xb087('0xa2'),_0xb087('0xa3')],'include':_0x5bee38[_0xb087('0x41')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xb087('0x25')](handleEntityNotFound(_0x32147f,null))[_0xb087('0x25')](function(_0x3a403f){if(_0x3a403f){var _0x1e2038=_0x3a403f;var _0x18b90b={'from':_0x1e2038[_0xb087('0xa0')],'to':_0x1e2038['to'],'subject':_0x1e2038[_0xb087('0xa2')],'html':_0x1e2038[_0xb087('0x5b')],'headers':{'Date':moment(_0x1e2038[_0xb087('0xa3')])['format'](_0xb087('0xa4'))},'attachments':[]};if(_0x3a403f['cc']){_0x18b90b['headers']['Cc']=_0x3a403f['cc'];}if(_0x3a403f[_0xb087('0xa1')]){_0x18b90b[_0xb087('0xa5')]['Bcc']=_0x3a403f['bcc'];}return new BPromise(function(_0x2f2597,_0x2ae274){if(_0x3a403f[_0xb087('0xa6')]){for(var _0x3cd88d=0x0;_0x3cd88d<_0x3a403f['Attachments'][_0xb087('0x46')];_0x3cd88d++){var _0x385ef7=_0x3a403f['Attachments'][_0x3cd88d];var _0x53dfe2=path[_0xb087('0x76')](_0x2d2524,_0x385ef7['basename']);if(fs['existsSync'](_0x53dfe2)){_0x18b90b[_0xb087('0x75')]['push']({'name':_0x385ef7[_0xb087('0x3a')],'contentType':_0x385ef7[_0xb087('0x3f')],'data':fs[_0xb087('0xa7')](_0x53dfe2)});}}}emlformat[_0xb087('0xa8')](_0x18b90b,function(_0x2de831,_0x1e8686){if(_0x2de831)return _0x2ae274(_0x2de831);fs[_0xb087('0xa9')](path[_0xb087('0x76')](_0x99d93a,_0x2e75af),_0x1e8686);return _0x2f2597(_0x1e8686);});});}})['then'](function(_0x1214aa){if(_0x1214aa){return _0x32147f['download'](path['join'](_0x99d93a,_0x2e75af),_0x2e75af,function(_0x1c29ad){if(_0x1c29ad){console[_0xb087('0xaa')](_0xb087('0xab'),_0x1c29ad);}else{fs['unlinkSync'](path[_0xb087('0x76')](_0x99d93a,_0x2e75af));}});}})[_0xb087('0x5a')](handleError(_0x32147f,null));}; \ No newline at end of file +var _0xe511=['read1stAt','interaction','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','agent','MailInteraction','MailInteractionId','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','reject','rejectmessage','download','root','server','files','tmp','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','MailMessage,\x20%s,\x20%s','result','catch','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','params','options','MailMessage','find','body','create','split','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','authentication','auth','user','pass','secure','attachments','join','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','Contact'];(function(_0x20020a,_0x2e8f87){var _0x3ab313=function(_0x3c72a6){while(--_0x3c72a6){_0x20020a['push'](_0x20020a['shift']());}};_0x3ab313(++_0x2e8f87);}(_0xe511,0x16f));var _0x1e51=function(_0x4d69d1,_0x211712){_0x4d69d1=_0x4d69d1-0x0;var _0x4950ad=_0xe511[_0x4d69d1];return _0x4950ad;};'use strict';var pdf=require(_0x1e51('0x0'));var emlformat=require(_0x1e51('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e51('0x3'));var moment=require(_0x1e51('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e51('0x5'));var util=require(_0x1e51('0x6'));var path=require(_0x1e51('0x7'));var sox=require(_0x1e51('0x8'));var csv=require('to-csv');var ejs=require(_0x1e51('0x9'));var fs=require('fs');var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];config[_0x1e51('0x18')]=_['defaults'](config[_0x1e51('0x18')],{'host':_0x1e51('0x19'),'port':0x18eb});var socket=require(_0x1e51('0x1a'))(new Redis(config[_0x1e51('0x18')]));require(_0x1e51('0x1b'))[_0x1e51('0x1c')](socket);var jayson=require(_0x1e51('0x1d'));var client=jayson[_0x1e51('0x1e')][_0x1e51('0x1f')]({'port':0x232c});var client9003=jayson[_0x1e51('0x1e')]['http']({'port':0x232b});var client9002=jayson[_0x1e51('0x1e')][_0x1e51('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4526b4,_0x5857e2,_0xa3b410,_0x4f7aaf){return new BPromise(function(_0x53d222,_0x1f6f4e){var _0x27dcad=_0x4f7aaf||client;return _0x27dcad[_0x1e51('0x20')](_0x4526b4,_0xa3b410)[_0x1e51('0x21')](function(_0x4d1aae){logger[_0x1e51('0x22')]('MailMessage,\x20%s,\x20%s',_0x5857e2,_0x1e51('0x23'));logger['debug'](_0x1e51('0x24'),_0x5857e2,_0x1e51('0x23'),JSON[_0x1e51('0x25')](_0x4d1aae));if(_0x4d1aae[_0x1e51('0x26')]){if(_0x4d1aae['error']['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5857e2,_0x4d1aae[_0x1e51('0x26')]['message']);return _0x1f6f4e(_0x4d1aae[_0x1e51('0x26')][_0x1e51('0x27')]);}logger[_0x1e51('0x26')](_0x1e51('0x28'),_0x5857e2,_0x4d1aae[_0x1e51('0x26')][_0x1e51('0x27')]);return _0x53d222(_0x4d1aae[_0x1e51('0x26')][_0x1e51('0x27')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x5857e2,_0x1e51('0x23'));_0x53d222(_0x4d1aae[_0x1e51('0x29')][_0x1e51('0x27')]);}})[_0x1e51('0x2a')](function(_0x505d79){logger['error']('MailMessage,\x20%s,\x20%s',_0x5857e2,_0x505d79);_0x1f6f4e(_0x505d79);});});}function respondWithStatusCode(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0xcc;return function(_0x433c2d){if(_0x433c2d){return _0x1eb83f['sendStatus'](_0x2a1561);}return _0x1eb83f[_0x1e51('0x2b')](_0x2a1561)['end']();};}function respondWithResult(_0x5eccee,_0x3349f0){_0x3349f0=_0x3349f0||0xc8;return function(_0x5c5bbd){if(_0x5c5bbd){return _0x5eccee[_0x1e51('0x2b')](_0x3349f0)[_0x1e51('0x2c')](_0x5c5bbd);}};}function respondWithFilteredResult(_0x56722f,_0x3e6ef2){return function(_0x10ee23){if(_0x10ee23){var _0x71c7af=_0x10ee23['count'],_0x6862d1=_0x3e6ef2[_0x1e51('0x2d')],_0x52538c=_0x3e6ef2[_0x1e51('0x2d')]+_0x3e6ef2[_0x1e51('0x2e')],_0x4cf046;if(_0x52538c>=_0x71c7af){_0x52538c=_0x71c7af;_0x4cf046=0xc8;}else{_0x4cf046=0xce;}_0x56722f[_0x1e51('0x2b')](_0x4cf046);return _0x56722f[_0x1e51('0x2f')](_0x1e51('0x30'),_0x6862d1+'-'+_0x52538c+'/'+_0x71c7af)[_0x1e51('0x2c')](_0x10ee23);}return null;};}function patchUpdates(_0x34701c){return function(_0x31b678){try{jsonpatch[_0x1e51('0x31')](_0x31b678,_0x34701c,!![]);}catch(_0x27b550){return BPromise['reject'](_0x27b550);}return _0x31b678[_0x1e51('0x32')]();};}function saveUpdates(_0x366925,_0x92707a){return function(_0x12da89){if(_0x12da89){return _0x12da89[_0x1e51('0x33')](_0x366925)['then'](function(_0x2a54b1){return _0x2a54b1;});}return null;};}function removeEntity(_0x5647c0,_0x2a7b70){return function(_0x3fb57e){if(_0x3fb57e){return _0x3fb57e[_0x1e51('0x34')]()['then'](function(){_0x5647c0[_0x1e51('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x247de2,_0x4e0187){return function(_0x47fb59){if(!_0x47fb59){_0x247de2[_0x1e51('0x35')](0x194);}return _0x47fb59;};}function handleError(_0x26e902,_0x45313e){_0x45313e=_0x45313e||0x1f4;return function(_0x56783a){logger[_0x1e51('0x26')](_0x56783a['stack']);if(_0x56783a[_0x1e51('0x36')]){delete _0x56783a[_0x1e51('0x36')];}_0x26e902['status'](_0x45313e)[_0x1e51('0x37')](_0x56783a);};}exports[_0x1e51('0x38')]=function(_0x433cb1,_0xeeff34){var _0x146c44={},_0x1e08ed={},_0x5c57a6={'count':0x0,'rows':[]};var _0x509f7d=_[_0x1e51('0x39')](db['MailMessage'][_0x1e51('0x3a')],function(_0x152e34){return{'name':_0x152e34[_0x1e51('0x3b')],'type':_0x152e34[_0x1e51('0x3c')][_0x1e51('0x3d')]};});_0x1e08ed[_0x1e51('0x3e')]=_[_0x1e51('0x39')](_0x509f7d,_0x1e51('0x36'));_0x1e08ed[_0x1e51('0x3f')]=_[_0x1e51('0x40')](_0x433cb1[_0x1e51('0x3f')]);_0x1e08ed['filters']=_[_0x1e51('0x41')](_0x1e08ed['model'],_0x1e08ed[_0x1e51('0x3f')]);_0x146c44[_0x1e51('0x42')]=_[_0x1e51('0x41')](_0x1e08ed[_0x1e51('0x3e')],qs[_0x1e51('0x43')](_0x433cb1[_0x1e51('0x3f')][_0x1e51('0x43')]));_0x146c44[_0x1e51('0x42')]=_0x146c44[_0x1e51('0x42')][_0x1e51('0x44')]?_0x146c44[_0x1e51('0x42')]:_0x1e08ed['model'];if(!_0x433cb1['query'][_0x1e51('0x45')](_0x1e51('0x46'))){_0x146c44[_0x1e51('0x2e')]=qs[_0x1e51('0x2e')](_0x433cb1[_0x1e51('0x3f')][_0x1e51('0x2e')]);_0x146c44[_0x1e51('0x2d')]=qs[_0x1e51('0x2d')](_0x433cb1['query'][_0x1e51('0x2d')]);}_0x146c44[_0x1e51('0x47')]=qs[_0x1e51('0x48')](_0x433cb1[_0x1e51('0x3f')][_0x1e51('0x48')]);_0x146c44[_0x1e51('0x49')]=qs[_0x1e51('0x4a')](_['pick'](_0x433cb1[_0x1e51('0x3f')],_0x1e08ed[_0x1e51('0x4a')]),_0x509f7d);if(_0x433cb1['query'][_0x1e51('0x4b')]){_0x146c44[_0x1e51('0x49')]=_[_0x1e51('0x4c')](_0x146c44['where'],{'$or':_[_0x1e51('0x39')](_0x509f7d,function(_0x2ab15a){if(_0x2ab15a[_0x1e51('0x3c')]!==_0x1e51('0x4d')){var _0x3c96a5={};_0x3c96a5[_0x2ab15a[_0x1e51('0x36')]]={'$like':'%'+_0x433cb1[_0x1e51('0x3f')][_0x1e51('0x4b')]+'%'};return _0x3c96a5;}})});}_0x146c44=_[_0x1e51('0x4c')]({},_0x146c44,_0x433cb1['options']);var _0x132625={'where':_0x146c44[_0x1e51('0x49')]};return db['MailMessage'][_0x1e51('0x4e')](_0x132625)[_0x1e51('0x21')](function(_0x139e9f){_0x5c57a6['count']=_0x139e9f;if(_0x433cb1[_0x1e51('0x3f')][_0x1e51('0x4f')]){_0x146c44[_0x1e51('0x50')]=[{'all':!![]}];}return db['MailMessage'][_0x1e51('0x51')](_0x146c44);})['then'](function(_0x581f7a){_0x5c57a6['rows']=_0x581f7a;return _0x5c57a6;})[_0x1e51('0x21')](respondWithFilteredResult(_0xeeff34,_0x146c44))[_0x1e51('0x2a')](handleError(_0xeeff34,null));};exports['show']=function(_0x5c81f5,_0x191a79){var _0x7ffc42={'raw':!![],'where':{'id':_0x5c81f5[_0x1e51('0x52')]['id']}},_0x2a43dd={};_0x2a43dd[_0x1e51('0x3e')]=_[_0x1e51('0x40')](db['MailMessage'][_0x1e51('0x3a')]);_0x2a43dd['query']=_[_0x1e51('0x40')](_0x5c81f5[_0x1e51('0x3f')]);_0x2a43dd['filtears']=_['intersection'](_0x2a43dd['model'],_0x2a43dd[_0x1e51('0x3f')]);_0x7ffc42[_0x1e51('0x42')]=_[_0x1e51('0x41')](_0x2a43dd['model'],qs[_0x1e51('0x43')](_0x5c81f5[_0x1e51('0x3f')][_0x1e51('0x43')]));_0x7ffc42[_0x1e51('0x42')]=_0x7ffc42[_0x1e51('0x42')][_0x1e51('0x44')]?_0x7ffc42[_0x1e51('0x42')]:_0x2a43dd[_0x1e51('0x3e')];if(_0x5c81f5['query'][_0x1e51('0x4f')]){_0x7ffc42[_0x1e51('0x50')]=[{'all':!![]}];}_0x7ffc42=_[_0x1e51('0x4c')]({},_0x7ffc42,_0x5c81f5[_0x1e51('0x53')]);return db[_0x1e51('0x54')][_0x1e51('0x55')](_0x7ffc42)['then'](handleEntityNotFound(_0x191a79,null))[_0x1e51('0x21')](respondWithResult(_0x191a79,null))['catch'](handleError(_0x191a79,null));};exports['update']=function(_0x4807b9,_0xd353e3){if(_0x4807b9[_0x1e51('0x56')]['id']){delete _0x4807b9[_0x1e51('0x56')]['id'];}return db['MailMessage'][_0x1e51('0x55')]({'where':{'id':_0x4807b9[_0x1e51('0x52')]['id']}})[_0x1e51('0x21')](handleEntityNotFound(_0xd353e3,null))['then'](saveUpdates(_0x4807b9[_0x1e51('0x56')],null))[_0x1e51('0x21')](respondWithResult(_0xd353e3,null))[_0x1e51('0x2a')](handleError(_0xd353e3,null));};exports['destroy']=function(_0x2d5e58,_0x1d43e8){return db[_0x1e51('0x54')][_0x1e51('0x55')]({'where':{'id':_0x2d5e58[_0x1e51('0x52')]['id']}})[_0x1e51('0x21')](handleEntityNotFound(_0x1d43e8,null))[_0x1e51('0x21')](removeEntity(_0x1d43e8,null))[_0x1e51('0x2a')](handleError(_0x1d43e8,null));};exports['describe']=function(_0xd21d08,_0x2e78e7){return db['MailMessage']['describe']()['then'](respondWithResult(_0x2e78e7,null))[_0x1e51('0x2a')](handleError(_0x2e78e7,null));};exports[_0x1e51('0x57')]=function(_0x2ffd82,_0x3bdf55){return db[_0x1e51('0x54')][_0x1e51('0x57')](_0x2ffd82[_0x1e51('0x56')])[_0x1e51('0x21')](function(_0x8ba6f4){if(_0x8ba6f4){if(_0x8ba6f4['direction']==='out'&&!_0x8ba6f4['secret']){var _0x1d2daf,_0x4048a4,_0x50c202;if(_0x2ffd82['body']['to']){_0x4048a4=_0x2ffd82[_0x1e51('0x56')]['to'][_0x1e51('0x58')](',')[0x0];}return db['MailAccount'][_0x1e51('0x59')]({'where':{'id':_0x8ba6f4[_0x1e51('0x5a')]},'include':[{'model':db[_0x1e51('0x5b')],'as':_0x1e51('0x5c'),'include':[{'model':db[_0x1e51('0x5d')],'as':_0x1e51('0x5e'),'where':{'email':_0x4048a4},'limit':0x1,'order':[[_0x1e51('0x5f'),_0x1e51('0x60')]]}]},{'model':db[_0x1e51('0x61')],'as':_0x1e51('0x62'),'raw':!![]}]})['then'](function(_0x178baf){_0x1d2daf=_0x178baf;if(_0x1d2daf&&_0x1d2daf[_0x1e51('0x62')]){var _0x3657a2={'tls':{'rejectUnauthorized':![]}};if(_[_0x1e51('0x63')](_0x1d2daf[_0x1e51('0x62')][_0x1e51('0x64')])){_0x3657a2['host']=_0x1d2daf['Smtp'][_0x1e51('0x65')];_0x3657a2[_0x1e51('0x66')]=_0x1d2daf[_0x1e51('0x62')][_0x1e51('0x66')];_0x3657a2['secure']=_0x1d2daf['Smtp']['secure'];if(_0x1d2daf[_0x1e51('0x62')][_0x1e51('0x67')]){_0x3657a2[_0x1e51('0x68')]={'user':_0x1d2daf[_0x1e51('0x62')][_0x1e51('0x69')],'pass':_0x1d2daf['Smtp'][_0x1e51('0x6a')]};}}else{_0x3657a2[_0x1e51('0x64')]=_0x1d2daf[_0x1e51('0x62')]['service'];_0x3657a2[_0x1e51('0x68')]={'user':_0x1d2daf[_0x1e51('0x62')][_0x1e51('0x69')],'pass':_0x1d2daf['Smtp'][_0x1e51('0x6a')]};_0x3657a2[_0x1e51('0x6b')]=_0x1d2daf['Smtp']['secure'];}if(_0x2ffd82[_0x1e51('0x56')]['attachments']&&_0x2ffd82[_0x1e51('0x56')]['attachments'][_0x1e51('0x44')]){for(var _0xe1cfa0=0x0;_0xe1cfa0<_0x2ffd82[_0x1e51('0x56')][_0x1e51('0x6c')]['length'];_0xe1cfa0+=0x1){_0x2ffd82[_0x1e51('0x56')]['attachments'][_0xe1cfa0]={'filename':_0x2ffd82['body'][_0x1e51('0x6c')][_0xe1cfa0][_0x1e51('0x36')],'path':path[_0x1e51('0x6d')](config['root'],_0x1e51('0x6e'),_0x2ffd82[_0x1e51('0x56')][_0x1e51('0x6c')][_0xe1cfa0][_0x1e51('0x6f')])};}}_0x50c202={'account':_0x3657a2,'message':_0x2ffd82['body']};return;}})[_0x1e51('0x21')](function(){if(_0x1d2daf['List']){if(_0x1d2daf['List'][_0x1e51('0x5e')]['length']){return _0x1d2daf[_0x1e51('0x5c')]['Contacts'][0x0];}else{return db[_0x1e51('0x5d')]['create'](_[_0x1e51('0x70')](_0x2ffd82[_0x1e51('0x56')],{'firstName':_0x2ffd82['body']['to'],'email':_0x2ffd82[_0x1e51('0x56')]['to'],'phone':_0x2ffd82['body']['to'],'ListId':_0x1d2daf[_0x1e51('0x71')]}));}}else{throw new Error(_0x1e51('0x72'));}})[_0x1e51('0x21')](function(){if(_0x50c202){return respondWithRpcPromise(_0x1e51('0x73'),_0x1e51('0x74'),_0x50c202,client9003)[_0x1e51('0x21')](function(_0x5428f4){return _0x8ba6f4[_0x1e51('0x33')]({'read':!![],'messageId':_0x5428f4['messageId'],'sentAt':moment()['format'](_0x1e51('0x75'))});})[_0x1e51('0x2a')](function(_0x2c38b4){logger[_0x1e51('0x26')]('%s',JSON[_0x1e51('0x25')](_0x2c38b4));return _0x8ba6f4;});}return _0x8ba6f4;});}return _0x8ba6f4;}})[_0x1e51('0x21')](respondWithResult(_0x3bdf55,0xc9))[_0x1e51('0x2a')](handleError(_0x3bdf55,null));};var interaction_log=require('../../config/logger')(_0x1e51('0x76'));exports[_0x1e51('0x77')]=function(_0xfeb432,_0x4c6920,_0x4da887){var _0xa3209={'channel':_0x1e51('0x78')};if(_0xfeb432['body']['id']){delete _0xfeb432[_0x1e51('0x56')]['id'];}_0xfeb432[_0x1e51('0x56')]['read']=!![];_0xfeb432['body'][_0x1e51('0x79')]=moment()[_0x1e51('0x7a')](_0x1e51('0x75'));_0xfeb432[_0x1e51('0x56')][_0x1e51('0x7b')]=_0xfeb432[_0x1e51('0x56')][_0x1e51('0x7b')]||_0xfeb432['user']['id'];return db['MailMessage'][_0x1e51('0x55')]({'where':{'id':_0xfeb432[_0x1e51('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1e51('0x7c')}]})[_0x1e51('0x21')](handleEntityNotFound(_0x4c6920,null))['then'](saveUpdates(_0xfeb432[_0x1e51('0x56')],null))['then'](function(_0x34b98f){if(_0x34b98f){_0xa3209['message']=_0x34b98f['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x34b98f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4c6920,null))[_0x1e51('0x21')](function(_0x5aa741){if(_0x5aa741){return _0x5aa741[_0x1e51('0x33')]({'UserId':_0xfeb432['body'][_0x1e51('0x7b')],'read1stAt':_[_0x1e51('0x63')](_0x5aa741[_0x1e51('0x7d')])?moment()['format'](_0x1e51('0x75')):undefined});}return null;})[_0x1e51('0x21')](function(_0x4a2b44){if(_0x4a2b44){_0xa3209[_0x1e51('0x7e')]=_0x4a2b44['get']({'plain':!![]});interaction_log[_0x1e51('0x22')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xfeb432[_0x1e51('0x69')]['id'],_0xfeb432[_0x1e51('0x69')][_0x1e51('0x36')],_0xfeb432[_0x1e51('0x69')][_0x1e51('0x7f')],_0xa3209[_0x1e51('0x7e')]['id'],_0xfeb432['body']?JSON[_0x1e51('0x25')](_0xfeb432['body']):_0x1e51('0x80'));return respondWithRpcPromise(_0x1e51('0x81'),_0x1e51('0x82'),_0xa3209);}return null;})[_0x1e51('0x21')](function(_0x526eea){if(_0x526eea){if(_0xfeb432['body']['manual']){_0xa3209[_0x1e51('0x27')][_0x1e51('0x83')]=util[_0x1e51('0x7a')](_0x1e51('0x84'),_0xfeb432['user'][_0x1e51('0x36')]);_0xa3209['message'][_0x1e51('0x85')]=_0xa3209['channel'];_0xa3209['message'][_0x1e51('0x86')]=_0x1e51('0x77');return respondWithRpcPromise('EventManager',_0x1e51('0x87'),{'event':'acceptmessage','message':_0xa3209[_0x1e51('0x27')]},client9002)['then'](function(){return _0xa3209;});}return _0xa3209;}return null;})[_0x1e51('0x21')](respondWithResult(_0x4c6920,null))[_0x1e51('0x2a')](handleError(_0x4c6920,null));};var interaction_log=require('../../config/logger')(_0x1e51('0x76'));exports['reject']=function(_0x284348,_0x29fc47,_0x11c5ee){var _0x26aeb0={'agent':{},'channel':'mail'};if(_0x284348[_0x1e51('0x56')]['id']){delete _0x284348[_0x1e51('0x56')]['id'];}_0x284348[_0x1e51('0x56')]['UserId']=_0x284348['body'][_0x1e51('0x7b')]||_0x284348[_0x1e51('0x69')]['id'];_0x26aeb0[_0x1e51('0x88')]['id']=_0x284348['body']['UserId'];return db['MailMessage'][_0x1e51('0x55')]({'where':{'id':_0x284348[_0x1e51('0x52')]['id'],'UserId':null}})[_0x1e51('0x21')](handleEntityNotFound(_0x29fc47,null))['then'](function(_0x399ca6){if(_0x399ca6){_0x26aeb0[_0x1e51('0x27')]=_0x399ca6['get']({'plain':!![]});return db[_0x1e51('0x89')][_0x1e51('0x55')]({'where':{'id':_0x399ca6[_0x1e51('0x8a')]}});}return null;})['then'](handleEntityNotFound(_0x29fc47,null))[_0x1e51('0x21')](function(_0x5d1484){if(_0x5d1484){_0x26aeb0[_0x1e51('0x7e')]=_0x5d1484[_0x1e51('0x8b')]({'plain':!![]});interaction_log[_0x1e51('0x22')](_0x1e51('0x8c'),_0x284348[_0x1e51('0x69')]['id'],_0x284348[_0x1e51('0x69')][_0x1e51('0x36')],_0x284348[_0x1e51('0x69')][_0x1e51('0x7f')],_0x26aeb0['interaction']['id'],_0x284348[_0x1e51('0x56')]?JSON['stringify'](_0x284348[_0x1e51('0x56')]):'null');return respondWithRpcPromise(_0x1e51('0x8d'),_0x1e51('0x8e'),_0x26aeb0);}return null;})[_0x1e51('0x21')](function(_0x3a546f){if(_0x3a546f){_0x3a546f[_0x1e51('0x27')][_0x1e51('0x83')]=util[_0x1e51('0x7a')](_0x1e51('0x84'),_0x284348[_0x1e51('0x69')]['name']);_0x3a546f[_0x1e51('0x27')][_0x1e51('0x85')]=_0x26aeb0[_0x1e51('0x85')];_0x3a546f['message'][_0x1e51('0x86')]=_0x1e51('0x8f');respondWithRpcPromise(_0x1e51('0x87'),'EventManager',{'event':_0x1e51('0x90'),'message':_0x3a546f[_0x1e51('0x27')]},client9002);return _0x26aeb0;}return null;})[_0x1e51('0x21')](respondWithResult(_0x29fc47,null))[_0x1e51('0x2a')](handleError(_0x29fc47,null));};exports[_0x1e51('0x91')]=function(_0x4dbfae,_0x4e95bd){var _0x1067c2=moment()['unix']()['toString']();var _0x166667=path[_0x1e51('0x6d')](config[_0x1e51('0x92')],_0x1e51('0x93'),_0x1e51('0x94'),_0x1e51('0x95'));var _0x2a8842=path[_0x1e51('0x6d')](config[_0x1e51('0x92')],'server',_0x1e51('0x94'),_0x1e51('0x6c'));var _0x9ae8c5=util['format']('message-%s.eml',_0x1067c2);return db[_0x1e51('0x54')][_0x1e51('0x55')]({'where':{'id':_0x4dbfae['params']['id']},'attributes':['id',_0x1e51('0x56'),_0x1e51('0x96'),'to','cc','bcc',_0x1e51('0x97'),_0x1e51('0x98')],'include':_0x4dbfae[_0x1e51('0x3f')]['attachments']?[{'model':db[_0x1e51('0x99')],'as':_0x1e51('0x9a')}]:undefined})[_0x1e51('0x21')](handleEntityNotFound(_0x4e95bd,null))[_0x1e51('0x21')](function(_0x37a434){if(_0x37a434){var _0x3bcc3c=_0x37a434;var _0x15afa8={'from':_0x3bcc3c[_0x1e51('0x96')],'to':_0x3bcc3c['to'],'subject':_0x3bcc3c[_0x1e51('0x97')],'html':_0x3bcc3c[_0x1e51('0x56')],'headers':{'Date':moment(_0x3bcc3c['createdAt'])['format'](_0x1e51('0x9b'))},'attachments':[]};if(_0x37a434['cc']){_0x15afa8['headers']['Cc']=_0x37a434['cc'];}if(_0x37a434['bcc']){_0x15afa8['headers'][_0x1e51('0x9c')]=_0x37a434['bcc'];}return new BPromise(function(_0x159c58,_0x5494ac){if(_0x37a434[_0x1e51('0x9a')]){for(var _0xb79285=0x0;_0xb79285<_0x37a434['Attachments'][_0x1e51('0x44')];_0xb79285++){var _0x5c4fe6=_0x37a434[_0x1e51('0x9a')][_0xb79285];var _0x3f0cb2=path['join'](_0x2a8842,_0x5c4fe6[_0x1e51('0x6f')]);if(fs[_0x1e51('0x9d')](_0x3f0cb2)){_0x15afa8['attachments']['push']({'name':_0x5c4fe6['name'],'contentType':_0x5c4fe6[_0x1e51('0x3c')],'data':fs[_0x1e51('0x9e')](_0x3f0cb2)});}}}emlformat[_0x1e51('0x9f')](_0x15afa8,function(_0x543c71,_0x4ef044){if(_0x543c71)return _0x5494ac(_0x543c71);fs[_0x1e51('0xa0')](path[_0x1e51('0x6d')](_0x166667,_0x9ae8c5),_0x4ef044);return _0x159c58(_0x4ef044);});});}})[_0x1e51('0x21')](function(_0x554d5e){if(_0x554d5e){return _0x4e95bd[_0x1e51('0x91')](path[_0x1e51('0x6d')](_0x166667,_0x9ae8c5),_0x9ae8c5,function(_0x3de4f3){if(_0x3de4f3){console[_0x1e51('0xa1')](_0x1e51('0xa2'),_0x3de4f3);}else{fs[_0x1e51('0xa3')](path['join'](_0x166667,_0x9ae8c5));}});}})[_0x1e51('0x2a')](handleError(_0x4e95bd,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index eb0753b..ba94478 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 _0xe3b5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe3b5,0xf6));var _0x5e3b=function(_0x2ccc6b,_0x88e480){_0x2ccc6b=_0x2ccc6b-0x0;var _0x2221d4=_0xe3b5[_0x2ccc6b];return _0x2221d4;};'use strict';var EventEmitter=require(_0x5e3b('0x0'));var MailMessage=require(_0x5e3b('0x1'))['db'][_0x5e3b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x5e3b('0x3')](0x0);var events={'afterCreate':_0x5e3b('0x4'),'afterUpdate':_0x5e3b('0x5'),'afterDestroy':_0x5e3b('0x6')};function emitEvent(_0x4c5643){return function(_0x3ab25c,_0x80ff42,_0x352797){MailMessageEvents[_0x5e3b('0x7')](_0x4c5643+':'+_0x3ab25c['id'],_0x3ab25c);MailMessageEvents['emit'](_0x4c5643,_0x3ab25c);_0x352797(null);};}for(var e in events){if(events[_0x5e3b('0x8')](e)){var event=events[e];MailMessage[_0x5e3b('0x9')](e,emitEvent(event));}}module[_0x5e3b('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x8f6d=['hasOwnProperty','hook','events','MailMessage','setMaxListeners','update','emit'];(function(_0x5167bc,_0x20707b){var _0x47c29b=function(_0x1aea5c){while(--_0x1aea5c){_0x5167bc['push'](_0x5167bc['shift']());}};_0x47c29b(++_0x20707b);}(_0x8f6d,0x14b));var _0xd8f6=function(_0x58e5be,_0x5911cc){_0x58e5be=_0x58e5be-0x0;var _0x344bfc=_0x8f6d[_0x58e5be];return _0x344bfc;};'use strict';var EventEmitter=require(_0xd8f6('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xd8f6('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd8f6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd8f6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x385a85){return function(_0x77d468,_0x1dfe5c,_0x4e40f7){MailMessageEvents[_0xd8f6('0x4')](_0x385a85+':'+_0x77d468['id'],_0x77d468);MailMessageEvents[_0xd8f6('0x4')](_0x385a85,_0x77d468);_0x4e40f7(null);};}for(var e in events){if(events[_0xd8f6('0x5')](e)){var event=events[e];MailMessage[_0xd8f6('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d54ac12..fb2952e 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 _0x11cf=['rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','toLowerCase','direction','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','html-to-text','path'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x11cf,0x1c0));var _0xf11c=function(_0x1f1cd4,_0x4a52c9){_0x1f1cd4=_0x1f1cd4-0x0;var _0x2c4bac=_0x11cf[_0x1f1cd4];return _0x2c4bac;};'use strict';var _=require(_0xf11c('0x0'));var util=require(_0xf11c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf11c('0x2'));var BPromise=require(_0xf11c('0x3'));var rp=require(_0xf11c('0x4'));var htmlToText=require(_0xf11c('0x5'));var fs=require('fs');var path=require(_0xf11c('0x6'));var rimraf=require(_0xf11c('0x7'));var config=require(_0xf11c('0x8'));var attributes=require(_0xf11c('0x9'));module['exports']=function(_0x27d2c9,_0x12796e){return _0x27d2c9[_0xf11c('0xa')](_0xf11c('0xb'),attributes,{'tableName':_0xf11c('0xc'),'paranoid':![],'indexes':[{'name':_0xf11c('0xd'),'fields':[_0xf11c('0xd')]},{'name':_0xf11c('0xe'),'fields':[_0xf11c('0xf'),_0xf11c('0x10')],'type':_0xf11c('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x54e444,_0x5964dc,_0x16207b){if(_0x54e444['body']){_0x54e444[_0xf11c('0xf')]=htmlToText[_0xf11c('0x12')](_0x54e444[_0xf11c('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x16207b(null,_0x5964dc);},'afterCreate':function(_0x45d03a,_0x5de1ad,_0x430367){var _0x2382bd=_0x27d2c9[_0xf11c('0x14')];var _0x1137a3=_0x45d03a['get']({'plain':!![]});if(_0x1137a3['direction'][_0xf11c('0x15')]()==='in'||_0x1137a3[_0xf11c('0x16')]['toLowerCase']()===_0xf11c('0x17')&&!_0x1137a3[_0xf11c('0x18')]&&!_[_0xf11c('0x19')](_0x1137a3[_0xf11c('0x1a')])){_0x2382bd['MailInteraction'][_0xf11c('0x1b')]({'where':{'id':_0x1137a3['MailInteractionId']}})[_0xf11c('0x1c')](function(_0x2e96d6){if(_0x2e96d6){_0x2e96d6[_0xf11c('0x1d')]({'lastMsgAt':_0x1137a3[_0xf11c('0x1e')],'lastMsgDirection':_0x1137a3[_0xf11c('0x16')][_0xf11c('0x15')](),'lastMsgBody':_0x1137a3[_0xf11c('0x13')]});}})[_0xf11c('0x1f')](function(_0x109599){console[_0xf11c('0x20')](_0x109599);});}_0x430367();}},'charset':_0xf11c('0x21'),'collate':_0xf11c('0x22')});}; \ No newline at end of file +var _0xadc1=['secret','findOne','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out'];(function(_0x36e2e5,_0x2b520c){var _0x2984ed=function(_0x232080){while(--_0x232080){_0x36e2e5['push'](_0x36e2e5['shift']());}};_0x2984ed(++_0x2b520c);}(_0xadc1,0x146));var _0x1adc=function(_0x3f9584,_0x5ab12c){_0x3f9584=_0x3f9584-0x0;var _0x9d54c=_0xadc1[_0x3f9584];return _0x9d54c;};'use strict';var _=require(_0x1adc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1adc('0x1'));var moment=require(_0x1adc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x1adc('0x3'));var fs=require('fs');var path=require(_0x1adc('0x4'));var rimraf=require(_0x1adc('0x5'));var config=require(_0x1adc('0x6'));var attributes=require('./mailMessage.attributes');module[_0x1adc('0x7')]=function(_0x4cbcec,_0x2943c9){return _0x4cbcec[_0x1adc('0x8')](_0x1adc('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x1adc('0xa'),'fields':[_0x1adc('0xa')]},{'name':_0x1adc('0xb'),'fields':[_0x1adc('0xc'),_0x1adc('0xd')],'type':_0x1adc('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37d7db,_0x295608,_0x9185a3){if(_0x37d7db[_0x1adc('0xf')]){_0x37d7db[_0x1adc('0xc')]=htmlToText[_0x1adc('0x10')](_0x37d7db[_0x1adc('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x9185a3(null,_0x295608);},'afterCreate':function(_0x31961e,_0x5474a9,_0xe11acc){var _0x52fef7=_0x4cbcec[_0x1adc('0x11')];var _0x3d589b=_0x31961e[_0x1adc('0x12')]({'plain':!![]});if(_0x3d589b[_0x1adc('0x13')][_0x1adc('0x14')]()==='in'||_0x3d589b[_0x1adc('0x13')][_0x1adc('0x14')]()===_0x1adc('0x15')&&!_0x3d589b[_0x1adc('0x16')]&&!_['isNil'](_0x3d589b['UserId'])){_0x52fef7['MailInteraction'][_0x1adc('0x17')]({'where':{'id':_0x3d589b['MailInteractionId']}})['then'](function(_0x53e07f){if(_0x53e07f){_0x53e07f['update']({'lastMsgAt':_0x3d589b[_0x1adc('0x18')],'lastMsgDirection':_0x3d589b['direction'][_0x1adc('0x14')](),'lastMsgBody':_0x3d589b[_0x1adc('0xf')]});}})[_0x1adc('0x19')](function(_0x49ca2d){console[_0x1adc('0x1a')](_0x49ca2d);});}_0xe11acc();}},'charset':_0x1adc('0x1b'),'collate':_0x1adc('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 705cac4..deb8c07 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 _0x43b8=['code','message','result','MailMessage','create','body','options','CreateMailMessage','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x18af2d,_0x2a789a){var _0x399479=function(_0x55ba6b){while(--_0x55ba6b){_0x18af2d['push'](_0x18af2d['shift']());}};_0x399479(++_0x2a789a);}(_0x43b8,0x13c));var _0x843b=function(_0x533676,_0x2be01c){_0x533676=_0x533676-0x0;var _0x32f7bd=_0x43b8[_0x533676];return _0x32f7bd;};'use strict';var _=require(_0x843b('0x0'));var util=require(_0x843b('0x1'));var moment=require('moment');var BPromise=require(_0x843b('0x2'));var rs=require(_0x843b('0x3'));var fs=require('fs');var Redis=require(_0x843b('0x4'));var db=require(_0x843b('0x5'))['db'];var utils=require(_0x843b('0x6'));var logger=require(_0x843b('0x7'))(_0x843b('0x8'));var config=require(_0x843b('0x9'));var jayson=require(_0x843b('0xa'));var client=jayson[_0x843b('0xb')][_0x843b('0xc')]({'port':0x232a});config[_0x843b('0xd')]=_['defaults'](config['redis'],{'host':_0x843b('0xe'),'port':0x18eb});var socket=require(_0x843b('0xf'))(new Redis(config[_0x843b('0xd')]));require('./mailMessage.socket')[_0x843b('0x10')](socket);function respondWithRpcPromise(_0x16062f,_0x10dd11,_0x5d7858){return new BPromise(function(_0x5e6315,_0x8625f5){return client['request'](_0x16062f,_0x5d7858)[_0x843b('0x11')](function(_0x475541){logger[_0x843b('0x12')](_0x843b('0x13'),_0x10dd11,'request\x20sent');logger[_0x843b('0x14')](_0x843b('0x15'),_0x10dd11,_0x843b('0x16'),JSON['stringify'](_0x475541));if(_0x475541['error']){if(_0x475541[_0x843b('0x17')][_0x843b('0x18')]===0x1f4){logger[_0x843b('0x17')](_0x843b('0x13'),_0x10dd11,_0x475541[_0x843b('0x17')][_0x843b('0x19')]);return _0x8625f5(_0x475541['error'][_0x843b('0x19')]);}logger[_0x843b('0x17')](_0x843b('0x13'),_0x10dd11,_0x475541[_0x843b('0x17')][_0x843b('0x19')]);return _0x5e6315(_0x475541[_0x843b('0x17')]['message']);}else{logger[_0x843b('0x12')]('MailMessage,\x20%s,\x20%s',_0x10dd11,'request\x20sent');_0x5e6315(_0x475541[_0x843b('0x1a')][_0x843b('0x19')]);}})['catch'](function(_0x176e5f){logger[_0x843b('0x17')](_0x843b('0x13'),_0x10dd11,_0x176e5f);_0x8625f5(_0x176e5f);});});}exports['CreateMailMessage']=function(_0xcc55f4){var _0x3ec5ca=this;return new Promise(function(_0x32b406,_0x480609){return db[_0x843b('0x1b')][_0x843b('0x1c')](_0xcc55f4[_0x843b('0x1d')],{'raw':_0xcc55f4[_0x843b('0x1e')]?_0xcc55f4[_0x843b('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x843b('0x11')](function(_0x198d15){logger[_0x843b('0x12')](_0x843b('0x1f'),_0xcc55f4);logger[_0x843b('0x14')]('CreateMailMessage',_0xcc55f4,JSON[_0x843b('0x20')](_0x198d15));_0x32b406(_0x198d15);})[_0x843b('0x21')](function(_0x555610){logger[_0x843b('0x17')](_0x843b('0x1f'),_0x555610[_0x843b('0x19')],_0xcc55f4);_0x480609(_0x3ec5ca['error'](0x1f4,_0x555610['message']));});});}; \ No newline at end of file +var _0x1c75=['../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1c75,0xf4));var _0x51c7=function(_0x348d8d,_0x25a6dd){_0x348d8d=_0x348d8d-0x0;var _0x2a7d1f=_0x1c75[_0x348d8d];return _0x2a7d1f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x51c7('0x0'));var rs=require(_0x51c7('0x1'));var fs=require('fs');var Redis=require(_0x51c7('0x2'));var db=require(_0x51c7('0x3'))['db'];var utils=require(_0x51c7('0x4'));var logger=require('../../config/logger')(_0x51c7('0x5'));var config=require('../../config/environment');var jayson=require(_0x51c7('0x6'));var client=jayson['client'][_0x51c7('0x7')]({'port':0x232a});config[_0x51c7('0x8')]=_[_0x51c7('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x51c7('0xa'))(new Redis(config[_0x51c7('0x8')]));require(_0x51c7('0xb'))[_0x51c7('0xc')](socket);function respondWithRpcPromise(_0x457754,_0x24bd16,_0x59c875){return new BPromise(function(_0x178427,_0x35b294){return client[_0x51c7('0xd')](_0x457754,_0x59c875)[_0x51c7('0xe')](function(_0x26e274){logger[_0x51c7('0xf')]('MailMessage,\x20%s,\x20%s',_0x24bd16,_0x51c7('0x10'));logger[_0x51c7('0x11')](_0x51c7('0x12'),_0x24bd16,_0x51c7('0x10'),JSON[_0x51c7('0x13')](_0x26e274));if(_0x26e274[_0x51c7('0x14')]){if(_0x26e274[_0x51c7('0x14')]['code']===0x1f4){logger[_0x51c7('0x14')](_0x51c7('0x15'),_0x24bd16,_0x26e274['error'][_0x51c7('0x16')]);return _0x35b294(_0x26e274[_0x51c7('0x14')][_0x51c7('0x16')]);}logger['error'](_0x51c7('0x15'),_0x24bd16,_0x26e274[_0x51c7('0x14')][_0x51c7('0x16')]);return _0x178427(_0x26e274[_0x51c7('0x14')][_0x51c7('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x24bd16,'request\x20sent');_0x178427(_0x26e274[_0x51c7('0x17')][_0x51c7('0x16')]);}})[_0x51c7('0x18')](function(_0x3a0f0b){logger['error'](_0x51c7('0x15'),_0x24bd16,_0x3a0f0b);_0x35b294(_0x3a0f0b);});});}exports[_0x51c7('0x19')]=function(_0x300abf){var _0x1fe376=this;return new Promise(function(_0x357ede,_0x529384){return db[_0x51c7('0x1a')][_0x51c7('0x1b')](_0x300abf[_0x51c7('0x1c')],{'raw':_0x300abf[_0x51c7('0x1d')]?_0x300abf[_0x51c7('0x1d')][_0x51c7('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x329c3e){logger[_0x51c7('0xf')](_0x51c7('0x19'),_0x300abf);logger[_0x51c7('0x11')](_0x51c7('0x19'),_0x300abf,JSON[_0x51c7('0x13')](_0x329c3e));_0x357ede(_0x329c3e);})[_0x51c7('0x18')](function(_0x449a44){logger[_0x51c7('0x14')]('CreateMailMessage',_0x449a44[_0x51c7('0x16')],_0x300abf);_0x529384(_0x1fe376[_0x51c7('0x14')](0x1f4,_0x449a44['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0e93a4a..ad66072 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 _0x3d8f=['length','mailMessage:','save','remove','emit'];(function(_0x36f148,_0x3274e2){var _0x4e078=function(_0x1eac29){while(--_0x1eac29){_0x36f148['push'](_0x36f148['shift']());}};_0x4e078(++_0x3274e2);}(_0x3d8f,0x1d3));var _0xf3d8=function(_0xad9542,_0x204a81){_0xad9542=_0xad9542-0x0;var _0x1099ff=_0x3d8f[_0xad9542];return _0x1099ff;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xf3d8('0x0'),_0xf3d8('0x1'),'update'];function createListener(_0x2f88aa,_0x4488c3){return function(_0x319e3e){_0x4488c3[_0xf3d8('0x2')](_0x2f88aa,_0x319e3e);};}function removeListener(_0x18e91b,_0x50583c){return function(){MailMessageEvents['removeListener'](_0x18e91b,_0x50583c);};}exports['register']=function(_0x2f3410){for(var _0x30a6c5=0x0,_0x5b4c6d=events[_0xf3d8('0x3')];_0x30a6c5<_0x5b4c6d;_0x30a6c5++){var _0x3e4892=events[_0x30a6c5];var _0x3bee82=createListener(_0xf3d8('0x4')+_0x3e4892,_0x2f3410);MailMessageEvents['on'](_0x3e4892,_0x3bee82);}}; \ No newline at end of file +var _0x615a=['remove','emit','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0x4d505a,_0x5aa32f){var _0x4d3b64=function(_0x447934){while(--_0x447934){_0x4d505a['push'](_0x4d505a['shift']());}};_0x4d3b64(++_0x5aa32f);}(_0x615a,0x119));var _0xa615=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0x615a[_0x4c7149];return _0x200122;};'use strict';var MailMessageEvents=require(_0xa615('0x0'));var events=['save',_0xa615('0x1'),'update'];function createListener(_0x7e1c17,_0x33c100){return function(_0x30bb4f){_0x33c100[_0xa615('0x2')](_0x7e1c17,_0x30bb4f);};}function removeListener(_0x52ae35,_0x1d9a38){return function(){MailMessageEvents[_0xa615('0x3')](_0x52ae35,_0x1d9a38);};}exports['register']=function(_0x320680){for(var _0x5d04bd=0x0,_0x44afda=events[_0xa615('0x4')];_0x5d04bd<_0x44afda;_0x5d04bd++){var _0x2db48d=events[_0x5d04bd];var _0x1e714d=createListener(_0xa615('0x5')+_0x2db48d,_0x320680);MailMessageEvents['on'](_0x2db48d,_0x1e714d);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 775d186..9f37c98 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 _0x0cc1=['/describe','isAuthenticated','describe','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','/:id','update','delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0cc1,0x11f));var _0x10cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cc1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x10cc('0x0'));var path=require(_0x10cc('0x1'));var timeout=require(_0x10cc('0x2'));var express=require(_0x10cc('0x3'));var router=express[_0x10cc('0x4')]();var auth=require(_0x10cc('0x5'));var interaction=require(_0x10cc('0x6'));var config=require(_0x10cc('0x7'));var controller=require('./mailQueue.controller');router[_0x10cc('0x8')]('/',auth['isAuthenticated'](),controller[_0x10cc('0x9')]);router[_0x10cc('0x8')](_0x10cc('0xa'),auth[_0x10cc('0xb')](),controller[_0x10cc('0xc')]);router[_0x10cc('0x8')]('/:id',auth[_0x10cc('0xb')](),controller['show']);router[_0x10cc('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x10cc('0xd')]);router[_0x10cc('0x8')]('/:id/teams',auth[_0x10cc('0xb')](),controller[_0x10cc('0xe')]);router[_0x10cc('0x8')](_0x10cc('0xf'),auth[_0x10cc('0xb')](),controller[_0x10cc('0x10')]);router[_0x10cc('0x11')]('/',auth[_0x10cc('0xb')](),controller[_0x10cc('0x12')]);router[_0x10cc('0x11')](_0x10cc('0x13'),auth[_0x10cc('0xb')](),controller[_0x10cc('0x14')]);router[_0x10cc('0x11')](_0x10cc('0xf'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x10cc('0x15'),auth['isAuthenticated'](),controller[_0x10cc('0x16')]);router[_0x10cc('0x17')]('/:id',auth[_0x10cc('0xb')](),controller[_0x10cc('0x18')]);router[_0x10cc('0x17')](_0x10cc('0x13'),auth[_0x10cc('0xb')](),controller[_0x10cc('0x19')]);router['delete']('/:id/users',auth[_0x10cc('0xb')](),controller[_0x10cc('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9061=['destroy','delete','removeTeams','exports','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','put','update'];(function(_0x5b2155,_0x11bf44){var _0x1fd657=function(_0x42de65){while(--_0x42de65){_0x5b2155['push'](_0x5b2155['shift']());}};_0x1fd657(++_0x11bf44);}(_0x9061,0x162));var _0x1906=function(_0x2e4c44,_0x470e6f){_0x2e4c44=_0x2e4c44-0x0;var _0x567921=_0x9061[_0x2e4c44];return _0x567921;};'use strict';var multer=require('multer');var util=require(_0x1906('0x0'));var path=require(_0x1906('0x1'));var timeout=require(_0x1906('0x2'));var express=require('express');var router=express[_0x1906('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1906('0x4'));var controller=require('./mailQueue.controller');router[_0x1906('0x5')]('/',auth[_0x1906('0x6')](),controller[_0x1906('0x7')]);router[_0x1906('0x5')]('/describe',auth[_0x1906('0x6')](),controller[_0x1906('0x8')]);router['get'](_0x1906('0x9'),auth[_0x1906('0x6')](),controller[_0x1906('0xa')]);router[_0x1906('0x5')](_0x1906('0xb'),auth[_0x1906('0x6')](),controller[_0x1906('0xc')]);router[_0x1906('0x5')](_0x1906('0xd'),auth[_0x1906('0x6')](),controller['getTeams']);router['get']('/:id/users',auth[_0x1906('0x6')](),controller[_0x1906('0xe')]);router['post']('/',auth[_0x1906('0x6')](),controller[_0x1906('0xf')]);router[_0x1906('0x10')](_0x1906('0xd'),auth[_0x1906('0x6')](),controller[_0x1906('0x11')]);router[_0x1906('0x10')](_0x1906('0x12'),auth[_0x1906('0x6')](),controller['addAgents']);router[_0x1906('0x13')](_0x1906('0x9'),auth['isAuthenticated'](),controller[_0x1906('0x14')]);router['delete']('/:id',auth[_0x1906('0x6')](),controller[_0x1906('0x15')]);router[_0x1906('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1906('0x17')]);router['delete'](_0x1906('0x12'),auth[_0x1906('0x6')](),controller['removeAgents']);module[_0x1906('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 8bdf84e..41e9173 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 _0x272a=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x48d201,_0x510657){var _0xf654ed=function(_0x5e7232){while(--_0x5e7232){_0x48d201['push'](_0x48d201['shift']());}};_0xf654ed(++_0x510657);}(_0x272a,0x132));var _0xa272=function(_0x17b8a9,_0x3bbf58){_0x17b8a9=_0x17b8a9-0x0;var _0x4add80=_0x272a[_0x17b8a9];return _0x4add80;};'use strict';var Sequelize=require(_0xa272('0x0'));module['exports']={'name':{'type':Sequelize[_0xa272('0x1')],'unique':_0xa272('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa272('0x1')]},'timeout':{'type':Sequelize[_0xa272('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa272('0x4')](_0xa272('0x5'),_0xa272('0x6'),_0xa272('0x7'))}}; \ No newline at end of file +var _0x34bd=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x211973,_0x440b01){var _0x98ede9=function(_0x4c81a3){while(--_0x4c81a3){_0x211973['push'](_0x211973['shift']());}};_0x98ede9(++_0x440b01);}(_0x34bd,0x1d2));var _0xd34b=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x34bd[_0x3c504b];return _0x2e5354;};'use strict';var Sequelize=require(_0xd34b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd34b('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd34b('0x2')]},'timeout':{'type':Sequelize[_0xd34b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd34b('0x4')](_0xd34b('0x5'),_0xd34b('0x6'),_0xd34b('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 2c2ce3c..97e1a48 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 _0xa5f0=['userMailQueue:remove','omit','spread','isArray','getAgents','rimraf','zip-dir','moment','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','MailQueues','UserProfileResource','error','name','index','MailQueue','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','filtears','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','params','describe','getMembers','findOne','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','removeTeams','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','every','TeamId','includes','union','value','transaction','removeAgents','forEach'];(function(_0xa98eeb,_0x37cc88){var _0x3af6b7=function(_0x5a569b){while(--_0x5a569b){_0xa98eeb['push'](_0xa98eeb['shift']());}};_0x3af6b7(++_0x37cc88);}(_0xa5f0,0x1a9));var _0x0a5f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa5f0[_0x46e363];return _0x3fb059;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0a5f('0x0'));var zipdir=require(_0x0a5f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a5f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0a5f('0x3'));var util=require(_0x0a5f('0x4'));var path=require(_0x0a5f('0x5'));var sox=require(_0x0a5f('0x6'));var csv=require(_0x0a5f('0x7'));var ejs=require(_0x0a5f('0x8'));var fs=require('fs');var _=require(_0x0a5f('0x9'));var squel=require(_0x0a5f('0xa'));var crypto=require(_0x0a5f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0a5f('0xc'));var toCsv=require(_0x0a5f('0x7'));var querystring=require('querystring');var Papa=require(_0x0a5f('0xd'));var Redis=require(_0x0a5f('0xe'));var authService=require(_0x0a5f('0xf'));var qs=require(_0x0a5f('0x10'));var as=require(_0x0a5f('0x11'));var hardwareService=require(_0x0a5f('0x12'));var logger=require(_0x0a5f('0x13'))(_0x0a5f('0x14'));var utils=require(_0x0a5f('0x15'));var config=require(_0x0a5f('0x16'));var licenseUtil=require(_0x0a5f('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a5f('0x18')](config[_0x0a5f('0x19')],{'host':_0x0a5f('0x1a'),'port':0x18eb});var socket=require(_0x0a5f('0x1b'))(new Redis(config[_0x0a5f('0x19')]));require(_0x0a5f('0x1c'))[_0x0a5f('0x1d')](socket);function respondWithStatusCode(_0x5365bb,_0x2ab032){_0x2ab032=_0x2ab032||0xcc;return function(_0x5607d0){if(_0x5607d0){return _0x5365bb[_0x0a5f('0x1e')](_0x2ab032);}return _0x5365bb[_0x0a5f('0x1f')](_0x2ab032)[_0x0a5f('0x20')]();};}function respondWithResult(_0x57a9bc,_0x437cb8){_0x437cb8=_0x437cb8||0xc8;return function(_0x39e083){if(_0x39e083){return _0x57a9bc[_0x0a5f('0x1f')](_0x437cb8)[_0x0a5f('0x21')](_0x39e083);}};}function respondWithFilteredResult(_0x3d37d2,_0x336fed){return function(_0x1c3358){if(_0x1c3358){var _0x3346c5=_0x1c3358[_0x0a5f('0x22')],_0xe521c0=_0x336fed[_0x0a5f('0x23')],_0x14ccd8=_0x336fed[_0x0a5f('0x23')]+_0x336fed[_0x0a5f('0x24')],_0xc24143;if(_0x14ccd8>=_0x3346c5){_0x14ccd8=_0x3346c5;_0xc24143=0xc8;}else{_0xc24143=0xce;}_0x3d37d2[_0x0a5f('0x1f')](_0xc24143);return _0x3d37d2['set'](_0x0a5f('0x25'),_0xe521c0+'-'+_0x14ccd8+'/'+_0x3346c5)[_0x0a5f('0x21')](_0x1c3358);}return null;};}function patchUpdates(_0x7faf72){return function(_0x585a70){try{jsonpatch[_0x0a5f('0x26')](_0x585a70,_0x7faf72,!![]);}catch(_0x1a5c70){return BPromise[_0x0a5f('0x27')](_0x1a5c70);}return _0x585a70[_0x0a5f('0x28')]();};}function saveUpdates(_0x198435,_0x3d0070){return function(_0x5aa51e){if(_0x5aa51e){return _0x5aa51e[_0x0a5f('0x29')](_0x198435)['then'](function(_0x2fa9fa){return _0x2fa9fa;});}return null;};}function removeEntity(_0x15c75b,_0x5cf367){return function(_0x24084e){if(_0x24084e){return _0x24084e[_0x0a5f('0x2a')]()[_0x0a5f('0x2b')](function(){var _0x325475=_0x24084e[_0x0a5f('0x2c')]({'plain':!![]});var _0x4fa1c8=_0x0a5f('0x2d');return db[_0x0a5f('0x2e')]['destroy']({'where':{'type':_0x4fa1c8,'resourceId':_0x325475['id']}})[_0x0a5f('0x2b')](function(){return _0x24084e;});})['then'](function(){_0x15c75b[_0x0a5f('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd9870,_0x9a5053){return function(_0x2eae7c){if(!_0x2eae7c){_0xfd9870[_0x0a5f('0x1e')](0x194);}return _0x2eae7c;};}function handleError(_0x37093a,_0x5abf78){_0x5abf78=_0x5abf78||0x1f4;return function(_0x35bd25){logger[_0x0a5f('0x2f')](_0x35bd25['stack']);if(_0x35bd25[_0x0a5f('0x30')]){delete _0x35bd25[_0x0a5f('0x30')];}_0x37093a[_0x0a5f('0x1f')](_0x5abf78)['send'](_0x35bd25);};}exports[_0x0a5f('0x31')]=function(_0x1f38a0,_0x121835){var _0x598ee4={},_0x18525b={},_0x3c0958={'count':0x0,'rows':[]};var _0x3ac2e8=_['map'](db[_0x0a5f('0x32')][_0x0a5f('0x33')],function(_0x251f97){return{'name':_0x251f97[_0x0a5f('0x34')],'type':_0x251f97['type'][_0x0a5f('0x35')]};});_0x18525b['model']=_[_0x0a5f('0x36')](_0x3ac2e8,'name');_0x18525b[_0x0a5f('0x37')]=_[_0x0a5f('0x38')](_0x1f38a0[_0x0a5f('0x37')]);_0x18525b[_0x0a5f('0x39')]=_[_0x0a5f('0x3a')](_0x18525b['model'],_0x18525b[_0x0a5f('0x37')]);_0x598ee4[_0x0a5f('0x3b')]=_[_0x0a5f('0x3a')](_0x18525b[_0x0a5f('0x3c')],qs[_0x0a5f('0x3d')](_0x1f38a0[_0x0a5f('0x37')][_0x0a5f('0x3d')]));_0x598ee4[_0x0a5f('0x3b')]=_0x598ee4[_0x0a5f('0x3b')][_0x0a5f('0x3e')]?_0x598ee4[_0x0a5f('0x3b')]:_0x18525b[_0x0a5f('0x3c')];if(!_0x1f38a0['query']['hasOwnProperty'](_0x0a5f('0x3f'))){_0x598ee4[_0x0a5f('0x24')]=qs[_0x0a5f('0x24')](_0x1f38a0['query']['limit']);_0x598ee4[_0x0a5f('0x23')]=qs[_0x0a5f('0x23')](_0x1f38a0[_0x0a5f('0x37')][_0x0a5f('0x23')]);}_0x598ee4[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0x1f38a0['query'][_0x0a5f('0x41')]);_0x598ee4[_0x0a5f('0x42')]=qs[_0x0a5f('0x39')](_[_0x0a5f('0x43')](_0x1f38a0[_0x0a5f('0x37')],_0x18525b[_0x0a5f('0x39')]),_0x3ac2e8);if(_0x1f38a0['query'][_0x0a5f('0x44')]){_0x598ee4[_0x0a5f('0x42')]=_['merge'](_0x598ee4[_0x0a5f('0x42')],{'$or':_['map'](_0x3ac2e8,function(_0x49d7bb){if(_0x49d7bb[_0x0a5f('0x45')]!==_0x0a5f('0x46')){var _0x5d319e={};_0x5d319e[_0x49d7bb[_0x0a5f('0x30')]]={'$like':'%'+_0x1f38a0[_0x0a5f('0x37')][_0x0a5f('0x44')]+'%'};return _0x5d319e;}})});}_0x598ee4=_[_0x0a5f('0x47')]({},_0x598ee4,_0x1f38a0['options']);var _0x2412e9={'where':_0x598ee4[_0x0a5f('0x42')]};return db[_0x0a5f('0x32')][_0x0a5f('0x22')](_0x2412e9)['then'](function(_0x4d6bb2){_0x3c0958[_0x0a5f('0x22')]=_0x4d6bb2;if(_0x1f38a0[_0x0a5f('0x37')][_0x0a5f('0x48')]){_0x598ee4[_0x0a5f('0x49')]=[{'all':!![]}];}return db[_0x0a5f('0x32')][_0x0a5f('0x4a')](_0x598ee4);})[_0x0a5f('0x2b')](function(_0x56968a){_0x3c0958['rows']=_0x56968a;return _0x3c0958;})[_0x0a5f('0x2b')](respondWithFilteredResult(_0x121835,_0x598ee4))[_0x0a5f('0x4b')](handleError(_0x121835,null));};exports[_0x0a5f('0x4c')]=function(_0x3927f9,_0x2a5b73){var _0x22a561={'raw':!![],'where':{'id':_0x3927f9['params']['id']}},_0x14b7d0={};_0x14b7d0[_0x0a5f('0x3c')]=_[_0x0a5f('0x38')](db[_0x0a5f('0x32')][_0x0a5f('0x33')]);_0x14b7d0['query']=_[_0x0a5f('0x38')](_0x3927f9[_0x0a5f('0x37')]);_0x14b7d0[_0x0a5f('0x4d')]=_[_0x0a5f('0x3a')](_0x14b7d0[_0x0a5f('0x3c')],_0x14b7d0[_0x0a5f('0x37')]);_0x22a561[_0x0a5f('0x3b')]=_[_0x0a5f('0x3a')](_0x14b7d0[_0x0a5f('0x3c')],qs[_0x0a5f('0x3d')](_0x3927f9[_0x0a5f('0x37')][_0x0a5f('0x3d')]));_0x22a561[_0x0a5f('0x3b')]=_0x22a561[_0x0a5f('0x3b')][_0x0a5f('0x3e')]?_0x22a561['attributes']:_0x14b7d0[_0x0a5f('0x3c')];if(_0x3927f9[_0x0a5f('0x37')][_0x0a5f('0x48')]){_0x22a561[_0x0a5f('0x49')]=[{'all':!![]}];}_0x22a561=_[_0x0a5f('0x47')]({},_0x22a561,_0x3927f9[_0x0a5f('0x4e')]);return db[_0x0a5f('0x32')][_0x0a5f('0x4f')](_0x22a561)[_0x0a5f('0x2b')](handleEntityNotFound(_0x2a5b73,null))[_0x0a5f('0x2b')](respondWithResult(_0x2a5b73,null))['catch'](handleError(_0x2a5b73,null));};exports['create']=function(_0x2fb194,_0x509995){return db['MailQueue']['create'](_0x2fb194[_0x0a5f('0x50')],{})[_0x0a5f('0x2b')](function(_0x5beed7){var _0x167a02=_0x2fb194[_0x0a5f('0x51')][_0x0a5f('0x2c')]({'plain':!![]});if(!_0x167a02)throw new Error(_0x0a5f('0x52'));if(_0x167a02['role']===_0x0a5f('0x51')){var _0x68e0b3=_0x5beed7[_0x0a5f('0x2c')]({'plain':!![]});var _0x3ae349=_0x0a5f('0x2d');return db['UserProfileSection'][_0x0a5f('0x4f')]({'where':{'name':_0x3ae349,'userProfileId':_0x167a02['userProfileId']},'raw':!![]})[_0x0a5f('0x2b')](function(_0x5541b5){if(_0x5541b5&&_0x5541b5[_0x0a5f('0x53')]===0x0){return db[_0x0a5f('0x2e')][_0x0a5f('0x54')]({'name':_0x68e0b3[_0x0a5f('0x30')],'resourceId':_0x68e0b3['id'],'type':_0x5541b5[_0x0a5f('0x30')],'sectionId':_0x5541b5['id']},{})[_0x0a5f('0x2b')](function(){return _0x5beed7;});}else{return _0x5beed7;}})[_0x0a5f('0x4b')](function(_0x5cf392){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cf392);throw _0x5cf392;});}return _0x5beed7;})[_0x0a5f('0x2b')](respondWithResult(_0x509995,0xc9))[_0x0a5f('0x4b')](handleError(_0x509995,null));};exports[_0x0a5f('0x29')]=function(_0x5b2cf5,_0x361d95){if(_0x5b2cf5[_0x0a5f('0x50')]['id']){delete _0x5b2cf5['body']['id'];}return db['MailQueue'][_0x0a5f('0x4f')]({'where':{'id':_0x5b2cf5[_0x0a5f('0x55')]['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x361d95,null))[_0x0a5f('0x2b')](saveUpdates(_0x5b2cf5[_0x0a5f('0x50')],null))[_0x0a5f('0x2b')](respondWithResult(_0x361d95,null))['catch'](handleError(_0x361d95,null));};exports[_0x0a5f('0x2a')]=function(_0x2d5388,_0x567bad){return db[_0x0a5f('0x32')][_0x0a5f('0x4f')]({'where':{'id':_0x2d5388[_0x0a5f('0x55')]['id']}})['then'](handleEntityNotFound(_0x567bad,null))[_0x0a5f('0x2b')](removeEntity(_0x567bad,null))[_0x0a5f('0x4b')](handleError(_0x567bad,null));};exports['describe']=function(_0x181240,_0x207e8a){return db['MailQueue'][_0x0a5f('0x56')]()[_0x0a5f('0x2b')](respondWithResult(_0x207e8a,null))['catch'](handleError(_0x207e8a,null));};exports[_0x0a5f('0x57')]=function(_0x55a791,_0x74e1cf,_0x24e66b){var _0x4bf7bb={'raw':!![],'where':{}},_0x24e319={},_0x204686;return db[_0x0a5f('0x32')][_0x0a5f('0x58')]({'where':{'id':_0x55a791[_0x0a5f('0x55')]['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x74e1cf,null))[_0x0a5f('0x2b')](function(_0x2b398e){if(_0x2b398e){_0x204686=_0x2b398e[_0x0a5f('0x2c')]({'plain':!![]});_0x24e319[_0x0a5f('0x3c')]=_[_0x0a5f('0x38')](db['UserMailQueue'][_0x0a5f('0x33')]);_0x24e319[_0x0a5f('0x37')]=_['keys'](_0x55a791[_0x0a5f('0x37')]);_0x24e319[_0x0a5f('0x39')]=_[_0x0a5f('0x3a')](_0x24e319['model'],_0x24e319['query']);_0x4bf7bb['attributes']=_[_0x0a5f('0x3a')](_0x24e319[_0x0a5f('0x3c')],qs['fields'](_0x55a791[_0x0a5f('0x37')][_0x0a5f('0x3d')]));_0x4bf7bb[_0x0a5f('0x3b')]=_0x4bf7bb[_0x0a5f('0x3b')][_0x0a5f('0x3e')]?_0x4bf7bb[_0x0a5f('0x3b')]:_0x24e319[_0x0a5f('0x3c')];if(!_0x55a791[_0x0a5f('0x37')]['hasOwnProperty'](_0x0a5f('0x3f'))){_0x4bf7bb[_0x0a5f('0x24')]=qs[_0x0a5f('0x24')](_0x55a791[_0x0a5f('0x37')]['limit']);_0x4bf7bb[_0x0a5f('0x23')]=qs[_0x0a5f('0x23')](_0x55a791[_0x0a5f('0x37')][_0x0a5f('0x23')]);}_0x4bf7bb[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0x55a791[_0x0a5f('0x37')]['sort']);_0x4bf7bb[_0x0a5f('0x42')]=qs['filters'](_['pick'](_0x55a791['query'],_0x24e319['filters']));_0x4bf7bb[_0x0a5f('0x42')][_0x0a5f('0x59')]=_0x2b398e['id'];if(_0x55a791['query']['filter']){_0x4bf7bb['where']=_['merge'](_0x4bf7bb['where'],{'$or':_['map'](_0x4bf7bb[_0x0a5f('0x3b')],function(_0x1511c2){var _0x3b6805={};_0x3b6805[_0x1511c2]={'$like':'%'+_0x55a791[_0x0a5f('0x37')][_0x0a5f('0x44')]+'%'};return _0x3b6805;})});}_0x4bf7bb=_['merge']({},_0x4bf7bb,_0x55a791['options']);return db[_0x0a5f('0x5a')]['findAll'](_0x4bf7bb);}})[_0x0a5f('0x2b')](function(_0xb45b6e){if(_0xb45b6e){return db[_0x0a5f('0x5b')][_0x0a5f('0x5c')]({'where':{'id':_['map'](_0xb45b6e,_0x0a5f('0x5d')),'role':_0x0a5f('0x5e')},'attributes':['id',_0x0a5f('0x30'),_0x0a5f('0x5f'),_0x0a5f('0x60'),_0x0a5f('0x61')]});}})[_0x0a5f('0x2b')](function(_0x197162){if(_0x197162){return{'count':_0x197162[_0x0a5f('0x22')],'rows':_[_0x0a5f('0x36')](_0x197162[_0x0a5f('0x62')],function(_0x9d9639){return{'membername':_0x9d9639['name'],'UserId':_0x9d9639['id'],'queue_name':_0x204686[_0x0a5f('0x30')],'MailQueueId':_0x204686['id'],'interface':util[_0x0a5f('0x63')](_0x0a5f('0x64'),_0x0a5f('0x65'),_0x9d9639['name']),'penalty':0x0,'paused':_0x9d9639[_0x0a5f('0x5f')],'createdAt':_0x9d9639[_0x0a5f('0x61')],'updatedAt':_0x9d9639[_0x0a5f('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a5f('0x2b')](respondWithFilteredResult(_0x74e1cf,_0x4bf7bb))[_0x0a5f('0x4b')](handleError(_0x74e1cf,null));};exports[_0x0a5f('0x66')]=function(_0x45afc5,_0x1da8d5,_0x57f9c7){var _0x157188={};var _0x36ca0f={};var _0x5aadb8;var _0x2b3f63;return db['MailQueue'][_0x0a5f('0x58')]({'where':{'id':_0x45afc5[_0x0a5f('0x55')]['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x1da8d5,null))[_0x0a5f('0x2b')](function(_0x121502){if(_0x121502){_0x5aadb8=_0x121502;_0x36ca0f[_0x0a5f('0x3c')]=_[_0x0a5f('0x38')](db[_0x0a5f('0x67')][_0x0a5f('0x33')]);_0x36ca0f[_0x0a5f('0x37')]=_[_0x0a5f('0x38')](_0x45afc5[_0x0a5f('0x37')]);_0x36ca0f[_0x0a5f('0x39')]=_['intersection'](_0x36ca0f[_0x0a5f('0x3c')],_0x36ca0f[_0x0a5f('0x37')]);_0x157188['attributes']=_[_0x0a5f('0x3a')](_0x36ca0f[_0x0a5f('0x3c')],qs[_0x0a5f('0x3d')](_0x45afc5['query'][_0x0a5f('0x3d')]));_0x157188[_0x0a5f('0x3b')]=_0x157188[_0x0a5f('0x3b')][_0x0a5f('0x3e')]?_0x157188[_0x0a5f('0x3b')]:_0x36ca0f[_0x0a5f('0x3c')];_0x157188[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0x45afc5[_0x0a5f('0x37')]['sort']);_0x157188['where']=qs[_0x0a5f('0x39')](_[_0x0a5f('0x43')](_0x45afc5[_0x0a5f('0x37')],_0x36ca0f[_0x0a5f('0x39')]));if(_0x45afc5[_0x0a5f('0x37')][_0x0a5f('0x44')]){_0x157188[_0x0a5f('0x42')]=_['merge'](_0x157188['where'],{'$or':_[_0x0a5f('0x36')](_0x157188[_0x0a5f('0x3b')],function(_0x234eba){var _0x409879={};_0x409879[_0x234eba]={'$like':'%'+_0x45afc5[_0x0a5f('0x37')]['filter']+'%'};return _0x409879;})});}_0x157188=_['merge']({},_0x157188,_0x45afc5['options']);return _0x5aadb8[_0x0a5f('0x66')](_0x157188);}})[_0x0a5f('0x2b')](function(_0x4290de){if(_0x4290de){_0x2b3f63=_0x4290de[_0x0a5f('0x3e')];if(!_0x45afc5[_0x0a5f('0x37')]['hasOwnProperty'](_0x0a5f('0x3f'))){_0x157188[_0x0a5f('0x24')]=qs[_0x0a5f('0x24')](_0x45afc5['query'][_0x0a5f('0x24')]);_0x157188[_0x0a5f('0x23')]=qs[_0x0a5f('0x23')](_0x45afc5[_0x0a5f('0x37')][_0x0a5f('0x23')]);}return _0x5aadb8[_0x0a5f('0x66')](_0x157188);}})['then'](function(_0x1b1aa1){if(_0x1b1aa1){return _0x1b1aa1?{'count':_0x2b3f63,'rows':_0x1b1aa1}:null;}})[_0x0a5f('0x2b')](respondWithResult(_0x1da8d5,null))[_0x0a5f('0x4b')](handleError(_0x1da8d5,null));};exports[_0x0a5f('0x68')]=function(_0x4a57a6,_0xc43857,_0x7158ef){var _0x2473f9=_0x4a57a6['body'][_0x0a5f('0x69')];return db['Team']['findAll']({'where':{'id':_0x2473f9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0a5f('0x6a'),'attributes':['id',_0x0a5f('0x30'),_0x0a5f('0x6b'),_0x0a5f('0x6c'),_0x0a5f('0x6d')],'raw':!![]}]})[_0x0a5f('0x2b')](function(_0x4fa150){if(_0x4fa150){var _0x57dc64=_[_0x0a5f('0x6e')](_0x4fa150,function(_0x38aa22){var _0x523d0a=_0x38aa22[_0x0a5f('0x2c')]({'plain':!![]});return _0x523d0a[_0x0a5f('0x6a')];});return db[_0x0a5f('0x32')][_0x0a5f('0x4f')]({'where':{'id':_0x4a57a6['params']['id']}})[_0x0a5f('0x2b')](function(_0x5c889d){return db[_0x0a5f('0x6f')]['transaction'](function(_0x492ade){return _0x5c889d[_0x0a5f('0x68')](_0x2473f9,{'transaction':_0x492ade})[_0x0a5f('0x2b')](function(){return BPromise[_0x0a5f('0x70')](_0x57dc64,function(_0x2bdb01){return db[_0x0a5f('0x5a')][_0x0a5f('0x71')]({'where':{'UserId':_0x2bdb01['id'],'MailQueueId':_0x4a57a6[_0x0a5f('0x55')]['id']},'transaction':_0x492ade});});})[_0x0a5f('0x2b')](function(){_0x57dc64['forEach'](function(_0x332238){socket[_0x0a5f('0x72')]('userMailQueue:save',{'UserId':_0x332238['id'],'MailQueueId':_0x5c889d['id']});});});});});}})[_0x0a5f('0x2b')](respondWithStatusCode(_0xc43857,null))[_0x0a5f('0x4b')](handleError(_0xc43857,null));};exports[_0x0a5f('0x73')]=function(_0x5ee926,_0x3f4ce1,_0x368cfb){return db[_0x0a5f('0x67')][_0x0a5f('0x4a')]({'where':{'id':_0x5ee926['query'][_0x0a5f('0x69')]},'attributes':['id'],'include':[{'model':db[_0x0a5f('0x5b')],'as':_0x0a5f('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x0a5f('0x2b')](handleEntityNotFound(_0x3f4ce1,null))[_0x0a5f('0x2b')](function(_0xcdfa4e){var _0x34ed84=_['map'](_0xcdfa4e,'id');var _0x1809d5=[];var _0x114c90=[];var _0x2b9aeb=squel['select']();_0x2b9aeb['field']('tq.TeamId')[_0x0a5f('0x74')](_0x0a5f('0x75'),'tq')[_0x0a5f('0x76')](_0x0a5f('0x77'),'ut',_0x0a5f('0x78'))[_0x0a5f('0x42')](_0x0a5f('0x79'),_0x5ee926[_0x0a5f('0x55')]['id']);for(var _0x3cacc7=0x0;_0x3cacc7<_0xcdfa4e[_0x0a5f('0x3e')];_0x3cacc7+=0x1){let _0x17bcc9=_0xcdfa4e[_0x3cacc7];for(var _0xa1e12f=0x0;_0xa1e12f<_0x17bcc9[_0x0a5f('0x6a')][_0x0a5f('0x3e')];_0xa1e12f+=0x1){let _0x3e8dd9=_0x17bcc9[_0x0a5f('0x6a')][_0xa1e12f];var _0x28b5f9=_0x2b9aeb[_0x0a5f('0x7a')]();_0x28b5f9['where'](_0x0a5f('0x7b'),_0x3e8dd9['id']);_0x114c90[_0x0a5f('0x7c')](db[_0x0a5f('0x6f')][_0x0a5f('0x37')](_0x28b5f9['toString'](),{'type':db[_0x0a5f('0x6f')][_0x0a5f('0x7d')][_0x0a5f('0x7e')]})[_0x0a5f('0x2b')](function(_0x3c60e3){if(_0x3c60e3['length']===0x1){return _0x3e8dd9['id'];}else{var _0xc2c26e=_[_0x0a5f('0x7f')](_[_0x0a5f('0x36')](_0x3c60e3,_0x0a5f('0x80')),function(_0x5aa95b){return _[_0x0a5f('0x81')](_0x34ed84,_0x5aa95b);});if(_0xc2c26e){return _0x3e8dd9['id'];}}}));}}return BPromise['all'](_0x114c90)[_0x0a5f('0x2b')](function(_0x4d94ad){_0x1809d5=_(_0x1809d5)[_0x0a5f('0x82')](_0x4d94ad)['compact']()[_0x0a5f('0x83')]();return db[_0x0a5f('0x32')][_0x0a5f('0x4f')]({'where':{'id':_0x5ee926[_0x0a5f('0x55')]['id']}})[_0x0a5f('0x2b')](function(_0x3120dd){return db[_0x0a5f('0x6f')][_0x0a5f('0x84')](function(_0x565f0c){return _0x3120dd['removeTeams'](_0x5ee926[_0x0a5f('0x37')][_0x0a5f('0x69')],{'transaction':_0x565f0c})[_0x0a5f('0x2b')](function(){if(!_['isEmpty'](_0x1809d5)){return _0x3120dd[_0x0a5f('0x85')](_0x1809d5,{'transaction':_0x565f0c});}})['then'](function(){_0x1809d5[_0x0a5f('0x86')](function(_0x62aef9){socket['emit'](_0x0a5f('0x87'),{'UserId':_0x62aef9,'MailQueueId':_0x3120dd['id']});});});});});});})[_0x0a5f('0x2b')](respondWithStatusCode(_0x3f4ce1,null))['catch'](handleError(_0x3f4ce1,null));};exports['addAgents']=function(_0x57ee37,_0x175153,_0x11be0b){return db['MailQueue']['find']({'where':{'id':_0x57ee37['params']['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x175153,null))[_0x0a5f('0x2b')](function(_0x1a380d){if(_0x1a380d){return _0x1a380d['addAgents'](_0x57ee37[_0x0a5f('0x50')]['ids'],_[_0x0a5f('0x88')](_0x57ee37[_0x0a5f('0x50')],[_0x0a5f('0x69'),'id'])||{})[_0x0a5f('0x89')](function(_0x59be24){for(var _0xf4af78=0x0;_0xf4af78<_0x57ee37['body']['ids'][_0x0a5f('0x3e')];_0xf4af78+=0x1){socket[_0x0a5f('0x72')]('userMailQueue:save',{'UserId':_0x57ee37[_0x0a5f('0x50')][_0x0a5f('0x69')][_0xf4af78],'MailQueueId':_0x57ee37[_0x0a5f('0x55')]['id']});}return _0x59be24;});}})['then'](respondWithResult(_0x175153,null))[_0x0a5f('0x4b')](handleError(_0x175153,null));};exports[_0x0a5f('0x85')]=function(_0x1d76eb,_0x1d4ae8,_0xb35c61){return db[_0x0a5f('0x32')][_0x0a5f('0x4f')]({'where':{'id':_0x1d76eb[_0x0a5f('0x55')]['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x1d4ae8,null))['then'](function(_0x1bdd80){if(_0x1bdd80){return _0x1bdd80[_0x0a5f('0x85')](_0x1d76eb['query'][_0x0a5f('0x69')])[_0x0a5f('0x2b')](function(){if(_[_0x0a5f('0x8a')](_0x1d76eb[_0x0a5f('0x37')][_0x0a5f('0x69')])){for(var _0x5e30a4=0x0;_0x5e30a4<_0x1d76eb[_0x0a5f('0x37')][_0x0a5f('0x69')][_0x0a5f('0x3e')];_0x5e30a4+=0x1){socket[_0x0a5f('0x72')]('userMailQueue:remove',{'UserId':Number(_0x1d76eb[_0x0a5f('0x37')][_0x0a5f('0x69')][_0x5e30a4]),'MailQueueId':Number(_0x1d76eb[_0x0a5f('0x55')]['id'])});}}else{socket[_0x0a5f('0x72')](_0x0a5f('0x87'),{'UserId':Number(_0x1d76eb[_0x0a5f('0x37')][_0x0a5f('0x69')]),'MailQueueId':Number(_0x1d76eb[_0x0a5f('0x55')]['id'])});}});}})[_0x0a5f('0x2b')](respondWithStatusCode(_0x1d4ae8,null))[_0x0a5f('0x4b')](handleError(_0x1d4ae8,null));};exports['getAgents']=function(_0xe1dfd,_0x1f13a4,_0x4f5ab0){var _0x42376b={};var _0x54d258={};var _0x557ae7;var _0x17dbfb;return db[_0x0a5f('0x32')][_0x0a5f('0x58')]({'where':{'id':_0xe1dfd['params']['id']}})[_0x0a5f('0x2b')](handleEntityNotFound(_0x1f13a4,null))[_0x0a5f('0x2b')](function(_0x143f68){if(_0x143f68){_0x557ae7=_0x143f68;_0x54d258[_0x0a5f('0x3c')]=_[_0x0a5f('0x38')](db['User'][_0x0a5f('0x33')]);_0x54d258['query']=_[_0x0a5f('0x38')](_0xe1dfd[_0x0a5f('0x37')]);_0x54d258[_0x0a5f('0x39')]=_[_0x0a5f('0x3a')](_0x54d258[_0x0a5f('0x3c')],_0x54d258['query']);_0x42376b[_0x0a5f('0x3b')]=_[_0x0a5f('0x3a')](_0x54d258['model'],qs['fields'](_0xe1dfd[_0x0a5f('0x37')]['fields']));_0x42376b['attributes']=_0x42376b[_0x0a5f('0x3b')][_0x0a5f('0x3e')]?_0x42376b[_0x0a5f('0x3b')]:_0x54d258['model'];_0x42376b[_0x0a5f('0x40')]=qs[_0x0a5f('0x41')](_0xe1dfd[_0x0a5f('0x37')][_0x0a5f('0x41')]);_0x42376b['where']=qs[_0x0a5f('0x39')](_[_0x0a5f('0x43')](_0xe1dfd[_0x0a5f('0x37')],_0x54d258[_0x0a5f('0x39')]));if(_0xe1dfd[_0x0a5f('0x37')][_0x0a5f('0x44')]){_0x42376b['where']=_[_0x0a5f('0x47')](_0x42376b[_0x0a5f('0x42')],{'$or':_[_0x0a5f('0x36')](_0x42376b[_0x0a5f('0x3b')],function(_0x25c84a){var _0x591c7c={};_0x591c7c[_0x25c84a]={'$like':'%'+_0xe1dfd[_0x0a5f('0x37')][_0x0a5f('0x44')]+'%'};return _0x591c7c;})});}_0x42376b=_['merge']({},_0x42376b,_0xe1dfd['options']);return _0x557ae7[_0x0a5f('0x8b')](_0x42376b);}})[_0x0a5f('0x2b')](function(_0x1fb26b){if(_0x1fb26b){_0x17dbfb=_0x1fb26b[_0x0a5f('0x3e')];if(!_0xe1dfd[_0x0a5f('0x37')]['hasOwnProperty'](_0x0a5f('0x3f'))){_0x42376b['limit']=qs['limit'](_0xe1dfd[_0x0a5f('0x37')][_0x0a5f('0x24')]);_0x42376b['offset']=qs[_0x0a5f('0x23')](_0xe1dfd['query'][_0x0a5f('0x23')]);}return _0x557ae7['getAgents'](_0x42376b);}})[_0x0a5f('0x2b')](function(_0x22cae8){if(_0x22cae8){return _0x22cae8?{'count':_0x17dbfb,'rows':_0x22cae8}:null;}})[_0x0a5f('0x2b')](respondWithResult(_0x1f13a4,null))[_0x0a5f('0x4b')](handleError(_0x1f13a4,null));}; \ No newline at end of file +var _0x23f6=['spread','removeAgents','isArray','getAgents','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','name','send','map','MailQueue','rawAttributes','key','model','query','intersection','attributes','offset','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','keys','filtears','fields','length','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','pick','MailQueueId','UserMailQueue','User','UserId','agent','updatedAt','rows','format','%s/%s','SIP','mailPause','Team','getTeams','hasOwnProperty','ids','voicePause','flatMap','transaction','addTeams','each','findOrCreate','forEach','removeTeams','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','Agents','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','emit','userMailQueue:remove','addAgents'];(function(_0x52aba8,_0x567e45){var _0x300586=function(_0x347ebd){while(--_0x347ebd){_0x52aba8['push'](_0x52aba8['shift']());}};_0x300586(++_0x567e45);}(_0x23f6,0x8d));var _0x623f=function(_0xc264d4,_0x41fbd0){_0xc264d4=_0xc264d4-0x0;var _0x2d72ab=_0x23f6[_0xc264d4];return _0x2d72ab;};'use strict';var pdf=require(_0x623f('0x0'));var emlformat=require(_0x623f('0x1'));var rimraf=require(_0x623f('0x2'));var zipdir=require(_0x623f('0x3'));var jsonpatch=require(_0x623f('0x4'));var rp=require(_0x623f('0x5'));var moment=require(_0x623f('0x6'));var BPromise=require(_0x623f('0x7'));var Mustache=require('mustache');var util=require(_0x623f('0x8'));var path=require(_0x623f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x623f('0xa'));var fs=require('fs');var _=require(_0x623f('0xb'));var squel=require(_0x623f('0xc'));var crypto=require('crypto');var jsforce=require(_0x623f('0xd'));var deskjs=require(_0x623f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x623f('0xf'));var Papa=require(_0x623f('0x10'));var Redis=require('ioredis');var authService=require(_0x623f('0x11'));var qs=require(_0x623f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x623f('0x13'));var logger=require(_0x623f('0x14'))(_0x623f('0x15'));var utils=require(_0x623f('0x16'));var config=require(_0x623f('0x17'));var licenseUtil=require(_0x623f('0x18'));var db=require('../../mysqldb')['db'];config[_0x623f('0x19')]=_['defaults'](config[_0x623f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x623f('0x1a'))(new Redis(config[_0x623f('0x19')]));require(_0x623f('0x1b'))[_0x623f('0x1c')](socket);function respondWithStatusCode(_0x31c00c,_0xb41a70){_0xb41a70=_0xb41a70||0xcc;return function(_0x2350f9){if(_0x2350f9){return _0x31c00c[_0x623f('0x1d')](_0xb41a70);}return _0x31c00c[_0x623f('0x1e')](_0xb41a70)[_0x623f('0x1f')]();};}function respondWithResult(_0x364b75,_0x2f78bc){_0x2f78bc=_0x2f78bc||0xc8;return function(_0x202a53){if(_0x202a53){return _0x364b75['status'](_0x2f78bc)[_0x623f('0x20')](_0x202a53);}};}function respondWithFilteredResult(_0x9d7a8f,_0x2066e6){return function(_0x392688){if(_0x392688){var _0x5dfe7e=_0x392688[_0x623f('0x21')],_0x28880c=_0x2066e6['offset'],_0x2150b5=_0x2066e6['offset']+_0x2066e6[_0x623f('0x22')],_0x4d4af1;if(_0x2150b5>=_0x5dfe7e){_0x2150b5=_0x5dfe7e;_0x4d4af1=0xc8;}else{_0x4d4af1=0xce;}_0x9d7a8f['status'](_0x4d4af1);return _0x9d7a8f[_0x623f('0x23')](_0x623f('0x24'),_0x28880c+'-'+_0x2150b5+'/'+_0x5dfe7e)[_0x623f('0x20')](_0x392688);}return null;};}function patchUpdates(_0x53cb71){return function(_0x50b924){try{jsonpatch['apply'](_0x50b924,_0x53cb71,!![]);}catch(_0xa1e031){return BPromise[_0x623f('0x25')](_0xa1e031);}return _0x50b924[_0x623f('0x26')]();};}function saveUpdates(_0x5c8f79,_0x4304d0){return function(_0x4cc229){if(_0x4cc229){return _0x4cc229[_0x623f('0x27')](_0x5c8f79)[_0x623f('0x28')](function(_0x4b8dcc){return _0x4b8dcc;});}return null;};}function removeEntity(_0x768df5,_0x46b36f){return function(_0x2ec9e4){if(_0x2ec9e4){return _0x2ec9e4[_0x623f('0x29')]()[_0x623f('0x28')](function(){var _0x3f666a=_0x2ec9e4['get']({'plain':!![]});var _0x33d84d=_0x623f('0x2a');return db[_0x623f('0x2b')]['destroy']({'where':{'type':_0x33d84d,'resourceId':_0x3f666a['id']}})[_0x623f('0x28')](function(){return _0x2ec9e4;});})[_0x623f('0x28')](function(){_0x768df5['status'](0xcc)[_0x623f('0x1f')]();});}};}function handleEntityNotFound(_0x51b8fa,_0x1b89d8){return function(_0x47d547){if(!_0x47d547){_0x51b8fa[_0x623f('0x1d')](0x194);}return _0x47d547;};}function handleError(_0x17ed5a,_0x58a863){_0x58a863=_0x58a863||0x1f4;return function(_0x5c734a){logger[_0x623f('0x2c')](_0x5c734a['stack']);if(_0x5c734a[_0x623f('0x2d')]){delete _0x5c734a[_0x623f('0x2d')];}_0x17ed5a[_0x623f('0x1e')](_0x58a863)[_0x623f('0x2e')](_0x5c734a);};}exports['index']=function(_0x5b7ec5,_0x5a8ea3){var _0x393987={},_0x2a18d9={},_0x29891b={'count':0x0,'rows':[]};var _0x99bfa9=_[_0x623f('0x2f')](db[_0x623f('0x30')][_0x623f('0x31')],function(_0xe15790){return{'name':_0xe15790['fieldName'],'type':_0xe15790['type'][_0x623f('0x32')]};});_0x2a18d9[_0x623f('0x33')]=_['map'](_0x99bfa9,_0x623f('0x2d'));_0x2a18d9[_0x623f('0x34')]=_['keys'](_0x5b7ec5[_0x623f('0x34')]);_0x2a18d9['filters']=_[_0x623f('0x35')](_0x2a18d9[_0x623f('0x33')],_0x2a18d9['query']);_0x393987[_0x623f('0x36')]=_[_0x623f('0x35')](_0x2a18d9[_0x623f('0x33')],qs['fields'](_0x5b7ec5[_0x623f('0x34')]['fields']));_0x393987[_0x623f('0x36')]=_0x393987[_0x623f('0x36')]['length']?_0x393987[_0x623f('0x36')]:_0x2a18d9['model'];if(!_0x5b7ec5['query']['hasOwnProperty']('nolimit')){_0x393987['limit']=qs['limit'](_0x5b7ec5[_0x623f('0x34')][_0x623f('0x22')]);_0x393987[_0x623f('0x37')]=qs['offset'](_0x5b7ec5[_0x623f('0x34')]['offset']);}_0x393987[_0x623f('0x38')]=qs[_0x623f('0x39')](_0x5b7ec5[_0x623f('0x34')][_0x623f('0x39')]);_0x393987[_0x623f('0x3a')]=qs[_0x623f('0x3b')](_['pick'](_0x5b7ec5['query'],_0x2a18d9[_0x623f('0x3b')]),_0x99bfa9);if(_0x5b7ec5[_0x623f('0x34')][_0x623f('0x3c')]){_0x393987[_0x623f('0x3a')]=_['merge'](_0x393987[_0x623f('0x3a')],{'$or':_[_0x623f('0x2f')](_0x99bfa9,function(_0x31179f){if(_0x31179f[_0x623f('0x3d')]!==_0x623f('0x3e')){var _0x3766ba={};_0x3766ba[_0x31179f['name']]={'$like':'%'+_0x5b7ec5[_0x623f('0x34')][_0x623f('0x3c')]+'%'};return _0x3766ba;}})});}_0x393987=_[_0x623f('0x3f')]({},_0x393987,_0x5b7ec5[_0x623f('0x40')]);var _0x2177ae={'where':_0x393987[_0x623f('0x3a')]};return db[_0x623f('0x30')]['count'](_0x2177ae)[_0x623f('0x28')](function(_0x16218e){_0x29891b[_0x623f('0x21')]=_0x16218e;if(_0x5b7ec5['query'][_0x623f('0x41')]){_0x393987['include']=[{'all':!![]}];}return db['MailQueue'][_0x623f('0x42')](_0x393987);})[_0x623f('0x28')](function(_0x433d17){_0x29891b['rows']=_0x433d17;return _0x29891b;})[_0x623f('0x28')](respondWithFilteredResult(_0x5a8ea3,_0x393987))[_0x623f('0x43')](handleError(_0x5a8ea3,null));};exports[_0x623f('0x44')]=function(_0x2c7d65,_0x282d12){var _0x37e3bd={'raw':!![],'where':{'id':_0x2c7d65[_0x623f('0x45')]['id']}},_0x1d3f48={};_0x1d3f48[_0x623f('0x33')]=_[_0x623f('0x46')](db['MailQueue'][_0x623f('0x31')]);_0x1d3f48['query']=_[_0x623f('0x46')](_0x2c7d65['query']);_0x1d3f48[_0x623f('0x47')]=_[_0x623f('0x35')](_0x1d3f48[_0x623f('0x33')],_0x1d3f48[_0x623f('0x34')]);_0x37e3bd[_0x623f('0x36')]=_[_0x623f('0x35')](_0x1d3f48['model'],qs[_0x623f('0x48')](_0x2c7d65[_0x623f('0x34')][_0x623f('0x48')]));_0x37e3bd['attributes']=_0x37e3bd[_0x623f('0x36')][_0x623f('0x49')]?_0x37e3bd[_0x623f('0x36')]:_0x1d3f48['model'];if(_0x2c7d65[_0x623f('0x34')][_0x623f('0x41')]){_0x37e3bd[_0x623f('0x4a')]=[{'all':!![]}];}_0x37e3bd=_['merge']({},_0x37e3bd,_0x2c7d65[_0x623f('0x40')]);return db[_0x623f('0x30')][_0x623f('0x4b')](_0x37e3bd)[_0x623f('0x28')](handleEntityNotFound(_0x282d12,null))[_0x623f('0x28')](respondWithResult(_0x282d12,null))[_0x623f('0x43')](handleError(_0x282d12,null));};exports[_0x623f('0x4c')]=function(_0x2c0bd9,_0x4d3dd0){return db[_0x623f('0x30')]['create'](_0x2c0bd9['body'],{})[_0x623f('0x28')](function(_0x5c757f){var _0x402759=_0x2c0bd9[_0x623f('0x4d')][_0x623f('0x4e')]({'plain':!![]});if(!_0x402759)throw new Error(_0x623f('0x4f'));if(_0x402759['role']==='user'){var _0x4747a1=_0x5c757f[_0x623f('0x4e')]({'plain':!![]});var _0x228b45='MailQueues';return db[_0x623f('0x50')][_0x623f('0x4b')]({'where':{'name':_0x228b45,'userProfileId':_0x402759[_0x623f('0x51')]},'raw':!![]})[_0x623f('0x28')](function(_0x47b827){if(_0x47b827&&_0x47b827['autoAssociation']===0x0){return db[_0x623f('0x2b')][_0x623f('0x4c')]({'name':_0x4747a1['name'],'resourceId':_0x4747a1['id'],'type':_0x47b827[_0x623f('0x2d')],'sectionId':_0x47b827['id']},{})['then'](function(){return _0x5c757f;});}else{return _0x5c757f;}})[_0x623f('0x43')](function(_0x424de5){logger[_0x623f('0x2c')](_0x623f('0x52'),_0x424de5);throw _0x424de5;});}return _0x5c757f;})[_0x623f('0x28')](respondWithResult(_0x4d3dd0,0xc9))[_0x623f('0x43')](handleError(_0x4d3dd0,null));};exports[_0x623f('0x27')]=function(_0x320a95,_0x4fbb0b){if(_0x320a95[_0x623f('0x53')]['id']){delete _0x320a95['body']['id'];}return db[_0x623f('0x30')][_0x623f('0x4b')]({'where':{'id':_0x320a95['params']['id']}})['then'](handleEntityNotFound(_0x4fbb0b,null))[_0x623f('0x28')](saveUpdates(_0x320a95[_0x623f('0x53')],null))[_0x623f('0x28')](respondWithResult(_0x4fbb0b,null))[_0x623f('0x43')](handleError(_0x4fbb0b,null));};exports[_0x623f('0x29')]=function(_0x11dabd,_0x2d15e6){return db['MailQueue']['find']({'where':{'id':_0x11dabd[_0x623f('0x45')]['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x2d15e6,null))[_0x623f('0x28')](removeEntity(_0x2d15e6,null))['catch'](handleError(_0x2d15e6,null));};exports[_0x623f('0x54')]=function(_0x5dbb84,_0x4b91e9){return db[_0x623f('0x30')][_0x623f('0x54')]()[_0x623f('0x28')](respondWithResult(_0x4b91e9,null))[_0x623f('0x43')](handleError(_0x4b91e9,null));};exports[_0x623f('0x55')]=function(_0x43308a,_0x3c6dbd,_0x263b83){var _0x394b36={'raw':!![],'where':{}},_0x23f5e5={},_0x2ebdfe;return db['MailQueue'][_0x623f('0x56')]({'where':{'id':_0x43308a[_0x623f('0x45')]['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x3c6dbd,null))[_0x623f('0x28')](function(_0x34c611){if(_0x34c611){_0x2ebdfe=_0x34c611['get']({'plain':!![]});_0x23f5e5[_0x623f('0x33')]=_[_0x623f('0x46')](db['UserMailQueue'][_0x623f('0x31')]);_0x23f5e5[_0x623f('0x34')]=_['keys'](_0x43308a[_0x623f('0x34')]);_0x23f5e5[_0x623f('0x3b')]=_[_0x623f('0x35')](_0x23f5e5[_0x623f('0x33')],_0x23f5e5[_0x623f('0x34')]);_0x394b36[_0x623f('0x36')]=_[_0x623f('0x35')](_0x23f5e5['model'],qs[_0x623f('0x48')](_0x43308a[_0x623f('0x34')]['fields']));_0x394b36[_0x623f('0x36')]=_0x394b36[_0x623f('0x36')][_0x623f('0x49')]?_0x394b36[_0x623f('0x36')]:_0x23f5e5[_0x623f('0x33')];if(!_0x43308a[_0x623f('0x34')]['hasOwnProperty']('nolimit')){_0x394b36[_0x623f('0x22')]=qs[_0x623f('0x22')](_0x43308a[_0x623f('0x34')][_0x623f('0x22')]);_0x394b36['offset']=qs[_0x623f('0x37')](_0x43308a[_0x623f('0x34')][_0x623f('0x37')]);}_0x394b36['order']=qs[_0x623f('0x39')](_0x43308a['query'][_0x623f('0x39')]);_0x394b36[_0x623f('0x3a')]=qs[_0x623f('0x3b')](_[_0x623f('0x57')](_0x43308a[_0x623f('0x34')],_0x23f5e5['filters']));_0x394b36['where'][_0x623f('0x58')]=_0x34c611['id'];if(_0x43308a['query'][_0x623f('0x3c')]){_0x394b36[_0x623f('0x3a')]=_['merge'](_0x394b36[_0x623f('0x3a')],{'$or':_['map'](_0x394b36[_0x623f('0x36')],function(_0x43207c){var _0xe987c4={};_0xe987c4[_0x43207c]={'$like':'%'+_0x43308a['query'][_0x623f('0x3c')]+'%'};return _0xe987c4;})});}_0x394b36=_[_0x623f('0x3f')]({},_0x394b36,_0x43308a[_0x623f('0x40')]);return db[_0x623f('0x59')][_0x623f('0x42')](_0x394b36);}})['then'](function(_0x3cc11a){if(_0x3cc11a){return db[_0x623f('0x5a')]['findAndCountAll']({'where':{'id':_[_0x623f('0x2f')](_0x3cc11a,_0x623f('0x5b')),'role':_0x623f('0x5c')},'attributes':['id','name','mailPause',_0x623f('0x5d'),'createdAt']});}})[_0x623f('0x28')](function(_0x4f49e3){if(_0x4f49e3){return{'count':_0x4f49e3['count'],'rows':_[_0x623f('0x2f')](_0x4f49e3[_0x623f('0x5e')],function(_0x231ffe){return{'membername':_0x231ffe[_0x623f('0x2d')],'UserId':_0x231ffe['id'],'queue_name':_0x2ebdfe[_0x623f('0x2d')],'MailQueueId':_0x2ebdfe['id'],'interface':util[_0x623f('0x5f')](_0x623f('0x60'),_0x623f('0x61'),_0x231ffe[_0x623f('0x2d')]),'penalty':0x0,'paused':_0x231ffe[_0x623f('0x62')],'createdAt':_0x231ffe['createdAt'],'updatedAt':_0x231ffe[_0x623f('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x623f('0x28')](respondWithFilteredResult(_0x3c6dbd,_0x394b36))['catch'](handleError(_0x3c6dbd,null));};exports['getTeams']=function(_0x2b1df7,_0x5b4de7,_0x3dcd54){var _0x223c1b={};var _0x1bbf2d={};var _0xd0b544;var _0x436cbe;return db['MailQueue']['findOne']({'where':{'id':_0x2b1df7[_0x623f('0x45')]['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x5b4de7,null))[_0x623f('0x28')](function(_0x488418){if(_0x488418){_0xd0b544=_0x488418;_0x1bbf2d[_0x623f('0x33')]=_[_0x623f('0x46')](db[_0x623f('0x63')]['rawAttributes']);_0x1bbf2d['query']=_[_0x623f('0x46')](_0x2b1df7[_0x623f('0x34')]);_0x1bbf2d[_0x623f('0x3b')]=_['intersection'](_0x1bbf2d[_0x623f('0x33')],_0x1bbf2d['query']);_0x223c1b[_0x623f('0x36')]=_['intersection'](_0x1bbf2d['model'],qs[_0x623f('0x48')](_0x2b1df7[_0x623f('0x34')][_0x623f('0x48')]));_0x223c1b[_0x623f('0x36')]=_0x223c1b[_0x623f('0x36')]['length']?_0x223c1b[_0x623f('0x36')]:_0x1bbf2d['model'];_0x223c1b[_0x623f('0x38')]=qs[_0x623f('0x39')](_0x2b1df7[_0x623f('0x34')][_0x623f('0x39')]);_0x223c1b[_0x623f('0x3a')]=qs['filters'](_[_0x623f('0x57')](_0x2b1df7[_0x623f('0x34')],_0x1bbf2d[_0x623f('0x3b')]));if(_0x2b1df7[_0x623f('0x34')]['filter']){_0x223c1b[_0x623f('0x3a')]=_['merge'](_0x223c1b[_0x623f('0x3a')],{'$or':_[_0x623f('0x2f')](_0x223c1b['attributes'],function(_0xeb3b53){var _0x1b3234={};_0x1b3234[_0xeb3b53]={'$like':'%'+_0x2b1df7[_0x623f('0x34')][_0x623f('0x3c')]+'%'};return _0x1b3234;})});}_0x223c1b=_[_0x623f('0x3f')]({},_0x223c1b,_0x2b1df7['options']);return _0xd0b544[_0x623f('0x64')](_0x223c1b);}})[_0x623f('0x28')](function(_0x47d3ae){if(_0x47d3ae){_0x436cbe=_0x47d3ae[_0x623f('0x49')];if(!_0x2b1df7[_0x623f('0x34')][_0x623f('0x65')]('nolimit')){_0x223c1b[_0x623f('0x22')]=qs[_0x623f('0x22')](_0x2b1df7[_0x623f('0x34')][_0x623f('0x22')]);_0x223c1b[_0x623f('0x37')]=qs['offset'](_0x2b1df7[_0x623f('0x34')][_0x623f('0x37')]);}return _0xd0b544['getTeams'](_0x223c1b);}})[_0x623f('0x28')](function(_0x41a766){if(_0x41a766){return _0x41a766?{'count':_0x436cbe,'rows':_0x41a766}:null;}})['then'](respondWithResult(_0x5b4de7,null))['catch'](handleError(_0x5b4de7,null));};exports['addTeams']=function(_0x41e9d9,_0x5e9883,_0x1122bd){var _0x5a7399=_0x41e9d9[_0x623f('0x53')][_0x623f('0x66')];return db['Team'][_0x623f('0x42')]({'where':{'id':_0x5a7399},'attributes':['id'],'include':[{'model':db[_0x623f('0x5a')],'as':'Agents','attributes':['id',_0x623f('0x2d'),'online',_0x623f('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x1f5b08){if(_0x1f5b08){var _0x22d8c9=_[_0x623f('0x68')](_0x1f5b08,function(_0x3cbfe9){var _0x4a3a09=_0x3cbfe9[_0x623f('0x4e')]({'plain':!![]});return _0x4a3a09['Agents'];});return db['MailQueue'][_0x623f('0x4b')]({'where':{'id':_0x41e9d9[_0x623f('0x45')]['id']}})[_0x623f('0x28')](function(_0x22a036){return db['sequelize'][_0x623f('0x69')](function(_0x5a1a26){return _0x22a036[_0x623f('0x6a')](_0x5a7399,{'transaction':_0x5a1a26})[_0x623f('0x28')](function(){return BPromise[_0x623f('0x6b')](_0x22d8c9,function(_0x164caa){return db[_0x623f('0x59')][_0x623f('0x6c')]({'where':{'UserId':_0x164caa['id'],'MailQueueId':_0x41e9d9[_0x623f('0x45')]['id']},'transaction':_0x5a1a26});});})[_0x623f('0x28')](function(){_0x22d8c9[_0x623f('0x6d')](function(_0x1bc779){socket['emit']('userMailQueue:save',{'UserId':_0x1bc779['id'],'MailQueueId':_0x22a036['id']});});});});});}})[_0x623f('0x28')](respondWithStatusCode(_0x5e9883,null))[_0x623f('0x43')](handleError(_0x5e9883,null));};exports[_0x623f('0x6e')]=function(_0x64eac5,_0xa07fdc,_0x3cc531){return db[_0x623f('0x63')][_0x623f('0x42')]({'where':{'id':_0x64eac5[_0x623f('0x34')][_0x623f('0x66')]},'attributes':['id'],'include':[{'model':db[_0x623f('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x623f('0x28')](handleEntityNotFound(_0xa07fdc,null))[_0x623f('0x28')](function(_0x25e5b0){var _0x2b301a=_[_0x623f('0x2f')](_0x25e5b0,'id');var _0x5122b5=[];var _0x2f386d=[];var _0x1dc723=squel['select']();_0x1dc723[_0x623f('0x6f')](_0x623f('0x70'))['from'](_0x623f('0x71'),'tq')[_0x623f('0x72')](_0x623f('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x623f('0x3a')](_0x623f('0x74'),_0x64eac5[_0x623f('0x45')]['id']);for(var _0x43e2a5=0x0;_0x43e2a5<_0x25e5b0[_0x623f('0x49')];_0x43e2a5+=0x1){let _0x5b8604=_0x25e5b0[_0x43e2a5];for(var _0x98e4a3=0x0;_0x98e4a3<_0x5b8604[_0x623f('0x75')]['length'];_0x98e4a3+=0x1){let _0x3490f1=_0x5b8604[_0x623f('0x75')][_0x98e4a3];var _0x61658=_0x1dc723['clone']();_0x61658[_0x623f('0x3a')]('ut.UserId\x20=\x20?',_0x3490f1['id']);_0x2f386d[_0x623f('0x76')](db[_0x623f('0x77')][_0x623f('0x34')](_0x61658['toString'](),{'type':db['sequelize'][_0x623f('0x78')][_0x623f('0x79')]})[_0x623f('0x28')](function(_0x3863dd){if(_0x3863dd[_0x623f('0x49')]===0x1){return _0x3490f1['id'];}else{var _0x338fde=_[_0x623f('0x7a')](_[_0x623f('0x2f')](_0x3863dd,_0x623f('0x7b')),function(_0x37480c){return _[_0x623f('0x7c')](_0x2b301a,_0x37480c);});if(_0x338fde){return _0x3490f1['id'];}}}));}}return BPromise[_0x623f('0x7d')](_0x2f386d)[_0x623f('0x28')](function(_0x1c6120){_0x5122b5=_(_0x5122b5)[_0x623f('0x7e')](_0x1c6120)[_0x623f('0x7f')]()['value']();return db[_0x623f('0x30')][_0x623f('0x4b')]({'where':{'id':_0x64eac5[_0x623f('0x45')]['id']}})['then'](function(_0x6d947c){return db['sequelize']['transaction'](function(_0x59c8cd){return _0x6d947c[_0x623f('0x6e')](_0x64eac5[_0x623f('0x34')][_0x623f('0x66')],{'transaction':_0x59c8cd})[_0x623f('0x28')](function(){if(!_['isEmpty'](_0x5122b5)){return _0x6d947c['removeAgents'](_0x5122b5,{'transaction':_0x59c8cd});}})[_0x623f('0x28')](function(){_0x5122b5['forEach'](function(_0x409538){socket[_0x623f('0x80')](_0x623f('0x81'),{'UserId':_0x409538,'MailQueueId':_0x6d947c['id']});});});});});});})[_0x623f('0x28')](respondWithStatusCode(_0xa07fdc,null))[_0x623f('0x43')](handleError(_0xa07fdc,null));};exports['addAgents']=function(_0x5db674,_0x2de338,_0x4590f7){return db['MailQueue'][_0x623f('0x4b')]({'where':{'id':_0x5db674['params']['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x2de338,null))[_0x623f('0x28')](function(_0x29234a){if(_0x29234a){return _0x29234a[_0x623f('0x82')](_0x5db674[_0x623f('0x53')][_0x623f('0x66')],_['omit'](_0x5db674[_0x623f('0x53')],[_0x623f('0x66'),'id'])||{})[_0x623f('0x83')](function(_0x32573c){for(var _0x1aaf4d=0x0;_0x1aaf4d<_0x5db674['body'][_0x623f('0x66')][_0x623f('0x49')];_0x1aaf4d+=0x1){socket[_0x623f('0x80')]('userMailQueue:save',{'UserId':_0x5db674['body'][_0x623f('0x66')][_0x1aaf4d],'MailQueueId':_0x5db674[_0x623f('0x45')]['id']});}return _0x32573c;});}})[_0x623f('0x28')](respondWithResult(_0x2de338,null))['catch'](handleError(_0x2de338,null));};exports[_0x623f('0x84')]=function(_0x4d30c1,_0x7446db,_0x371ebc){return db[_0x623f('0x30')][_0x623f('0x4b')]({'where':{'id':_0x4d30c1[_0x623f('0x45')]['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x7446db,null))[_0x623f('0x28')](function(_0x208d0b){if(_0x208d0b){return _0x208d0b[_0x623f('0x84')](_0x4d30c1[_0x623f('0x34')][_0x623f('0x66')])[_0x623f('0x28')](function(){if(_[_0x623f('0x85')](_0x4d30c1['query']['ids'])){for(var _0x49df90=0x0;_0x49df90<_0x4d30c1[_0x623f('0x34')][_0x623f('0x66')][_0x623f('0x49')];_0x49df90+=0x1){socket[_0x623f('0x80')]('userMailQueue:remove',{'UserId':Number(_0x4d30c1[_0x623f('0x34')]['ids'][_0x49df90]),'MailQueueId':Number(_0x4d30c1[_0x623f('0x45')]['id'])});}}else{socket[_0x623f('0x80')](_0x623f('0x81'),{'UserId':Number(_0x4d30c1[_0x623f('0x34')][_0x623f('0x66')]),'MailQueueId':Number(_0x4d30c1[_0x623f('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x7446db,null))['catch'](handleError(_0x7446db,null));};exports[_0x623f('0x86')]=function(_0x22875d,_0x182060,_0x3ece09){var _0x2b6fac={};var _0x335f14={};var _0x21102d;var _0x503356;return db[_0x623f('0x30')][_0x623f('0x56')]({'where':{'id':_0x22875d[_0x623f('0x45')]['id']}})[_0x623f('0x28')](handleEntityNotFound(_0x182060,null))[_0x623f('0x28')](function(_0x4a5e1a){if(_0x4a5e1a){_0x21102d=_0x4a5e1a;_0x335f14[_0x623f('0x33')]=_['keys'](db['User'][_0x623f('0x31')]);_0x335f14[_0x623f('0x34')]=_[_0x623f('0x46')](_0x22875d[_0x623f('0x34')]);_0x335f14['filters']=_['intersection'](_0x335f14[_0x623f('0x33')],_0x335f14['query']);_0x2b6fac[_0x623f('0x36')]=_[_0x623f('0x35')](_0x335f14[_0x623f('0x33')],qs[_0x623f('0x48')](_0x22875d[_0x623f('0x34')][_0x623f('0x48')]));_0x2b6fac[_0x623f('0x36')]=_0x2b6fac[_0x623f('0x36')]['length']?_0x2b6fac[_0x623f('0x36')]:_0x335f14[_0x623f('0x33')];_0x2b6fac[_0x623f('0x38')]=qs[_0x623f('0x39')](_0x22875d[_0x623f('0x34')][_0x623f('0x39')]);_0x2b6fac[_0x623f('0x3a')]=qs['filters'](_[_0x623f('0x57')](_0x22875d['query'],_0x335f14['filters']));if(_0x22875d[_0x623f('0x34')][_0x623f('0x3c')]){_0x2b6fac['where']=_['merge'](_0x2b6fac[_0x623f('0x3a')],{'$or':_[_0x623f('0x2f')](_0x2b6fac[_0x623f('0x36')],function(_0xc4004e){var _0x19ddbf={};_0x19ddbf[_0xc4004e]={'$like':'%'+_0x22875d[_0x623f('0x34')]['filter']+'%'};return _0x19ddbf;})});}_0x2b6fac=_['merge']({},_0x2b6fac,_0x22875d[_0x623f('0x40')]);return _0x21102d[_0x623f('0x86')](_0x2b6fac);}})[_0x623f('0x28')](function(_0x921d92){if(_0x921d92){_0x503356=_0x921d92[_0x623f('0x49')];if(!_0x22875d[_0x623f('0x34')]['hasOwnProperty'](_0x623f('0x87'))){_0x2b6fac[_0x623f('0x22')]=qs[_0x623f('0x22')](_0x22875d[_0x623f('0x34')]['limit']);_0x2b6fac[_0x623f('0x37')]=qs[_0x623f('0x37')](_0x22875d[_0x623f('0x34')]['offset']);}return _0x21102d[_0x623f('0x86')](_0x2b6fac);}})[_0x623f('0x28')](function(_0x10b95e){if(_0x10b95e){return _0x10b95e?{'count':_0x503356,'rows':_0x10b95e}:null;}})[_0x623f('0x28')](respondWithResult(_0x182060,null))[_0x623f('0x43')](handleError(_0x182060,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 50a98f0..a892431 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 _0x9d9c=['../../mysqldb','MailQueue','setMaxListeners','remove','emit','hasOwnProperty','exports'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x9d9c,0x1e3));var _0xc9d9=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x9d9c[_0x432fca];return _0x3adba4;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xc9d9('0x0'))['db'][_0xc9d9('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc9d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc9d9('0x3')};function emitEvent(_0x174a91){return function(_0x454e22,_0x4cd609,_0x45232c){MailQueueEvents[_0xc9d9('0x4')](_0x174a91+':'+_0x454e22['id'],_0x454e22);MailQueueEvents[_0xc9d9('0x4')](_0x174a91,_0x454e22);_0x45232c(null);};}for(var e in events){if(events[_0xc9d9('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xc9d9('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x6ede=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','emit'];(function(_0x18d60d,_0x5dd41a){var _0x215743=function(_0x48476f){while(--_0x48476f){_0x18d60d['push'](_0x18d60d['shift']());}};_0x215743(++_0x5dd41a);}(_0x6ede,0xa5));var _0xe6ed=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x6ede[_0x448f8];return _0xa73126;};'use strict';var EventEmitter=require(_0xe6ed('0x0'));var MailQueue=require(_0xe6ed('0x1'))['db'][_0xe6ed('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe6ed('0x3')](0x0);var events={'afterCreate':_0xe6ed('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2738fb){return function(_0x5b0616,_0x3288d5,_0x527ac8){MailQueueEvents[_0xe6ed('0x5')](_0x2738fb+':'+_0x5b0616['id'],_0x5b0616);MailQueueEvents['emit'](_0x2738fb,_0x5b0616);_0x527ac8(null);};}for(var e in events){if(events[_0xe6ed('0x6')](e)){var event=events[e];MailQueue[_0xe6ed('0x7')](e,emitEvent(event));}}module[_0xe6ed('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 82feabc..bd4ee8a 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 _0x14db=['define','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailQueue.attributes','exports'];(function(_0x553d01,_0xb3eb8f){var _0x5af198=function(_0x4285a9){while(--_0x4285a9){_0x553d01['push'](_0x553d01['shift']());}};_0x5af198(++_0xb3eb8f);}(_0x14db,0x7b));var _0xb14d=function(_0x3498e3,_0xbb4ef4){_0x3498e3=_0x3498e3-0x0;var _0x2e48a4=_0x14db[_0x3498e3];return _0x2e48a4;};'use strict';var _=require(_0xb14d('0x0'));var util=require('util');var logger=require(_0xb14d('0x1'))(_0xb14d('0x2'));var moment=require(_0xb14d('0x3'));var BPromise=require(_0xb14d('0x4'));var rp=require(_0xb14d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb14d('0x6'));var config=require('../../config/environment');var attributes=require(_0xb14d('0x7'));module[_0xb14d('0x8')]=function(_0x225007,_0x4a5eb3){return _0x225007[_0xb14d('0x9')](_0xb14d('0xa'),attributes,{'tableName':_0xb14d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x285b=['rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','api','moment','bluebird','request-promise','path'];(function(_0x2dae55,_0x5e721b){var _0x76b564=function(_0x337622){while(--_0x337622){_0x2dae55['push'](_0x2dae55['shift']());}};_0x76b564(++_0x5e721b);}(_0x285b,0x16e));var _0xb285=function(_0x3f9f32,_0x208da4){_0x3f9f32=_0x3f9f32-0x0;var _0x1f23b6=_0x285b[_0x3f9f32];return _0x1f23b6;};'use strict';var _=require(_0xb285('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb285('0x1'));var moment=require(_0xb285('0x2'));var BPromise=require(_0xb285('0x3'));var rp=require(_0xb285('0x4'));var fs=require('fs');var path=require(_0xb285('0x5'));var rimraf=require(_0xb285('0x6'));var config=require('../../config/environment');var attributes=require(_0xb285('0x7'));module[_0xb285('0x8')]=function(_0x3bede2,_0x2e9d90){return _0x3bede2[_0xb285('0x9')](_0xb285('0xa'),attributes,{'tableName':_0xb285('0xb'),'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 ac3ce48..e9eacbf 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 _0x905d=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','options','raw','attributes','limit','include','map','model','then','ShowMailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3f5d1a,_0x33400b){var _0x2db38a=function(_0x1bd67a){while(--_0x1bd67a){_0x3f5d1a['push'](_0x3f5d1a['shift']());}};_0x2db38a(++_0x33400b);}(_0x905d,0xf3));var _0xd905=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x905d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd905('0x0'));var util=require(_0xd905('0x1'));var moment=require(_0xd905('0x2'));var BPromise=require(_0xd905('0x3'));var rs=require(_0xd905('0x4'));var fs=require('fs');var Redis=require(_0xd905('0x5'));var db=require(_0xd905('0x6'))['db'];var utils=require(_0xd905('0x7'));var logger=require('../../config/logger')(_0xd905('0x8'));var config=require(_0xd905('0x9'));var jayson=require(_0xd905('0xa'));var client=jayson[_0xd905('0xb')][_0xd905('0xc')]({'port':0x232a});config[_0xd905('0xd')]=_[_0xd905('0xe')](config['redis'],{'host':_0xd905('0xf'),'port':0x18eb});var socket=require(_0xd905('0x10'))(new Redis(config[_0xd905('0xd')]));require('./mailQueue.socket')[_0xd905('0x11')](socket);function respondWithRpcPromise(_0x3d02e4,_0x16acc0,_0x1d66a2){return new BPromise(function(_0x2ca479,_0x1f3023){return client[_0xd905('0x12')](_0x3d02e4,_0x1d66a2)['then'](function(_0x52a78d){logger[_0xd905('0x13')](_0xd905('0x14'),_0x16acc0,_0xd905('0x15'));logger[_0xd905('0x16')](_0xd905('0x17'),_0x16acc0,'request\x20sent',JSON[_0xd905('0x18')](_0x52a78d));if(_0x52a78d[_0xd905('0x19')]){if(_0x52a78d[_0xd905('0x19')][_0xd905('0x1a')]===0x1f4){logger[_0xd905('0x19')](_0xd905('0x14'),_0x16acc0,_0x52a78d['error']['message']);return _0x1f3023(_0x52a78d[_0xd905('0x19')]['message']);}logger[_0xd905('0x19')](_0xd905('0x14'),_0x16acc0,_0x52a78d['error'][_0xd905('0x1b')]);return _0x2ca479(_0x52a78d['error']['message']);}else{logger[_0xd905('0x13')]('MailQueue,\x20%s,\x20%s',_0x16acc0,_0xd905('0x15'));_0x2ca479(_0x52a78d['result'][_0xd905('0x1b')]);}})[_0xd905('0x1c')](function(_0x4ce0c6){logger[_0xd905('0x19')](_0xd905('0x14'),_0x16acc0,_0x4ce0c6);_0x1f3023(_0x4ce0c6);});});}exports[_0xd905('0x1d')]=function(_0x5cb1cc){var _0x43d5e6=this;return new Promise(function(_0x10d6f8,_0x2514b){return db[_0xd905('0x1e')]['findAll']({'raw':_0x5cb1cc[_0xd905('0x1f')]?_0x5cb1cc[_0xd905('0x1f')][_0xd905('0x20')]===undefined?!![]:![]:!![],'where':_0x5cb1cc[_0xd905('0x1f')]?_0x5cb1cc[_0xd905('0x1f')]['where']||null:null,'attributes':_0x5cb1cc[_0xd905('0x1f')]?_0x5cb1cc[_0xd905('0x1f')][_0xd905('0x21')]||null:null,'limit':_0x5cb1cc[_0xd905('0x1f')]?_0x5cb1cc['options'][_0xd905('0x22')]||null:null,'include':_0x5cb1cc['options']?_0x5cb1cc['options'][_0xd905('0x23')]?_[_0xd905('0x24')](_0x5cb1cc['options'][_0xd905('0x23')],function(_0x33a0e8){return{'model':db[_0x33a0e8[_0xd905('0x25')]],'as':_0x33a0e8['as'],'attributes':_0x33a0e8['attributes'],'include':_0x33a0e8[_0xd905('0x23')]?_[_0xd905('0x24')](_0x33a0e8[_0xd905('0x23')],function(_0x35f18a){return{'model':db[_0x35f18a[_0xd905('0x25')]],'as':_0x35f18a['as'],'attributes':_0x35f18a[_0xd905('0x21')],'include':_0x35f18a[_0xd905('0x23')]?_[_0xd905('0x24')](_0x35f18a[_0xd905('0x23')],function(_0x53346d){return{'model':db[_0x53346d[_0xd905('0x25')]],'as':_0x53346d['as'],'attributes':_0x53346d[_0xd905('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd905('0x26')](function(_0x6e7acf){logger[_0xd905('0x13')](_0xd905('0x1d'),_0x5cb1cc);logger['debug'](_0xd905('0x1d'),_0x5cb1cc,JSON[_0xd905('0x18')](_0x6e7acf));_0x10d6f8(_0x6e7acf);})[_0xd905('0x1c')](function(_0x2df498){logger[_0xd905('0x19')](_0xd905('0x1d'),_0x2df498['message'],_0x5cb1cc);_0x2514b(_0x43d5e6[_0xd905('0x19')](0x1f4,_0x2df498[_0xd905('0x1b')]));});});};exports[_0xd905('0x27')]=function(_0xc3beb1){var _0x7afd77=this;return new Promise(function(_0x1b2bca,_0x573d15){return db[_0xd905('0x1e')][_0xd905('0x28')]({'raw':_0xc3beb1['options']?_0xc3beb1['options'][_0xd905('0x20')]===undefined?!![]:![]:!![],'where':_0xc3beb1[_0xd905('0x1f')]?_0xc3beb1['options'][_0xd905('0x29')]||null:null,'attributes':_0xc3beb1[_0xd905('0x1f')]?_0xc3beb1[_0xd905('0x1f')][_0xd905('0x21')]||null:null,'include':_0xc3beb1['options']?_0xc3beb1[_0xd905('0x1f')]['include']?_[_0xd905('0x24')](_0xc3beb1[_0xd905('0x1f')][_0xd905('0x23')],function(_0x40c68b){return{'model':db[_0x40c68b[_0xd905('0x25')]],'as':_0x40c68b['as'],'attributes':_0x40c68b[_0xd905('0x21')],'include':_0x40c68b[_0xd905('0x23')]?_[_0xd905('0x24')](_0x40c68b['include'],function(_0x132ab6){return{'model':db[_0x132ab6[_0xd905('0x25')]],'as':_0x132ab6['as'],'attributes':_0x132ab6[_0xd905('0x21')],'include':_0x132ab6[_0xd905('0x23')]?_['map'](_0x132ab6[_0xd905('0x23')],function(_0x619d6d){return{'model':db[_0x619d6d[_0xd905('0x25')]],'as':_0x619d6d['as'],'attributes':_0x619d6d[_0xd905('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd905('0x26')](function(_0x252765){logger['info']('ShowMailQueue',_0xc3beb1);logger['debug'](_0xd905('0x27'),_0xc3beb1,JSON['stringify'](_0x252765));_0x1b2bca(_0x252765);})[_0xd905('0x1c')](function(_0x885471){logger[_0xd905('0x19')](_0xd905('0x27'),_0x885471[_0xd905('0x1b')],_0xc3beb1);_0x573d15(_0x7afd77[_0xd905('0x19')](0x1f4,_0x885471[_0xd905('0x1b')]));});});}; \ No newline at end of file +var _0x4ebf=['http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailQueue','MailQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e418e,_0x1698f4){var _0x5d4123=function(_0x1ef303){while(--_0x1ef303){_0x3e418e['push'](_0x3e418e['shift']());}};_0x5d4123(++_0x1698f4);}(_0x4ebf,0x16f));var _0xf4eb=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0x4ebf[_0x564821];return _0x2b604d;};'use strict';var _=require('lodash');var util=require(_0xf4eb('0x0'));var moment=require(_0xf4eb('0x1'));var BPromise=require(_0xf4eb('0x2'));var rs=require(_0xf4eb('0x3'));var fs=require('fs');var Redis=require(_0xf4eb('0x4'));var db=require(_0xf4eb('0x5'))['db'];var utils=require(_0xf4eb('0x6'));var logger=require(_0xf4eb('0x7'))(_0xf4eb('0x8'));var config=require(_0xf4eb('0x9'));var jayson=require(_0xf4eb('0xa'));var client=jayson['client'][_0xf4eb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf4eb('0xc')],{'host':_0xf4eb('0xd'),'port':0x18eb});var socket=require(_0xf4eb('0xe'))(new Redis(config[_0xf4eb('0xc')]));require(_0xf4eb('0xf'))[_0xf4eb('0x10')](socket);function respondWithRpcPromise(_0xdd966b,_0x5bbe19,_0x577bfb){return new BPromise(function(_0x1d393c,_0x21dd5b){return client['request'](_0xdd966b,_0x577bfb)[_0xf4eb('0x11')](function(_0x439ad4){logger[_0xf4eb('0x12')](_0xf4eb('0x13'),_0x5bbe19,_0xf4eb('0x14'));logger[_0xf4eb('0x15')](_0xf4eb('0x16'),_0x5bbe19,_0xf4eb('0x14'),JSON['stringify'](_0x439ad4));if(_0x439ad4['error']){if(_0x439ad4[_0xf4eb('0x17')][_0xf4eb('0x18')]===0x1f4){logger[_0xf4eb('0x17')](_0xf4eb('0x13'),_0x5bbe19,_0x439ad4[_0xf4eb('0x17')][_0xf4eb('0x19')]);return _0x21dd5b(_0x439ad4['error'][_0xf4eb('0x19')]);}logger[_0xf4eb('0x17')](_0xf4eb('0x13'),_0x5bbe19,_0x439ad4[_0xf4eb('0x17')]['message']);return _0x1d393c(_0x439ad4[_0xf4eb('0x17')][_0xf4eb('0x19')]);}else{logger[_0xf4eb('0x12')](_0xf4eb('0x13'),_0x5bbe19,_0xf4eb('0x14'));_0x1d393c(_0x439ad4[_0xf4eb('0x1a')][_0xf4eb('0x19')]);}})[_0xf4eb('0x1b')](function(_0x3d6894){logger[_0xf4eb('0x17')]('MailQueue,\x20%s,\x20%s',_0x5bbe19,_0x3d6894);_0x21dd5b(_0x3d6894);});});}exports[_0xf4eb('0x1c')]=function(_0x5f2f5a){var _0x29806a=this;return new Promise(function(_0x68b0ff,_0x329fad){return db['MailQueue'][_0xf4eb('0x1d')]({'raw':_0x5f2f5a[_0xf4eb('0x1e')]?_0x5f2f5a[_0xf4eb('0x1e')][_0xf4eb('0x1f')]===undefined?!![]:![]:!![],'where':_0x5f2f5a[_0xf4eb('0x1e')]?_0x5f2f5a['options'][_0xf4eb('0x20')]||null:null,'attributes':_0x5f2f5a[_0xf4eb('0x1e')]?_0x5f2f5a[_0xf4eb('0x1e')][_0xf4eb('0x21')]||null:null,'limit':_0x5f2f5a[_0xf4eb('0x1e')]?_0x5f2f5a[_0xf4eb('0x1e')][_0xf4eb('0x22')]||null:null,'include':_0x5f2f5a[_0xf4eb('0x1e')]?_0x5f2f5a[_0xf4eb('0x1e')][_0xf4eb('0x23')]?_[_0xf4eb('0x24')](_0x5f2f5a[_0xf4eb('0x1e')][_0xf4eb('0x23')],function(_0x819287){return{'model':db[_0x819287[_0xf4eb('0x25')]],'as':_0x819287['as'],'attributes':_0x819287[_0xf4eb('0x21')],'include':_0x819287[_0xf4eb('0x23')]?_['map'](_0x819287[_0xf4eb('0x23')],function(_0x4f12a6){return{'model':db[_0x4f12a6[_0xf4eb('0x25')]],'as':_0x4f12a6['as'],'attributes':_0x4f12a6[_0xf4eb('0x21')],'include':_0x4f12a6[_0xf4eb('0x23')]?_['map'](_0x4f12a6[_0xf4eb('0x23')],function(_0x99b05a){return{'model':db[_0x99b05a['model']],'as':_0x99b05a['as'],'attributes':_0x99b05a[_0xf4eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf4eb('0x11')](function(_0xeda473){logger[_0xf4eb('0x12')](_0xf4eb('0x1c'),_0x5f2f5a);logger[_0xf4eb('0x15')](_0xf4eb('0x1c'),_0x5f2f5a,JSON[_0xf4eb('0x26')](_0xeda473));_0x68b0ff(_0xeda473);})['catch'](function(_0x13e02f){logger[_0xf4eb('0x17')](_0xf4eb('0x1c'),_0x13e02f[_0xf4eb('0x19')],_0x5f2f5a);_0x329fad(_0x29806a[_0xf4eb('0x17')](0x1f4,_0x13e02f[_0xf4eb('0x19')]));});});};exports[_0xf4eb('0x27')]=function(_0x4efb34){var _0x332918=this;return new Promise(function(_0x492ae0,_0x35e36e){return db[_0xf4eb('0x28')][_0xf4eb('0x29')]({'raw':_0x4efb34[_0xf4eb('0x1e')]?_0x4efb34[_0xf4eb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4efb34[_0xf4eb('0x1e')]?_0x4efb34[_0xf4eb('0x1e')]['where']||null:null,'attributes':_0x4efb34['options']?_0x4efb34[_0xf4eb('0x1e')][_0xf4eb('0x21')]||null:null,'include':_0x4efb34[_0xf4eb('0x1e')]?_0x4efb34['options'][_0xf4eb('0x23')]?_[_0xf4eb('0x24')](_0x4efb34[_0xf4eb('0x1e')]['include'],function(_0x11e804){return{'model':db[_0x11e804[_0xf4eb('0x25')]],'as':_0x11e804['as'],'attributes':_0x11e804[_0xf4eb('0x21')],'include':_0x11e804['include']?_['map'](_0x11e804[_0xf4eb('0x23')],function(_0x1d9042){return{'model':db[_0x1d9042[_0xf4eb('0x25')]],'as':_0x1d9042['as'],'attributes':_0x1d9042[_0xf4eb('0x21')],'include':_0x1d9042[_0xf4eb('0x23')]?_[_0xf4eb('0x24')](_0x1d9042['include'],function(_0x5ea2c8){return{'model':db[_0x5ea2c8['model']],'as':_0x5ea2c8['as'],'attributes':_0x5ea2c8[_0xf4eb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf4eb('0x11')](function(_0x163d08){logger[_0xf4eb('0x12')]('ShowMailQueue',_0x4efb34);logger[_0xf4eb('0x15')](_0xf4eb('0x27'),_0x4efb34,JSON[_0xf4eb('0x26')](_0x163d08));_0x492ae0(_0x163d08);})[_0xf4eb('0x1b')](function(_0x15e378){logger[_0xf4eb('0x17')](_0xf4eb('0x27'),_0x15e378[_0xf4eb('0x19')],_0x4efb34);_0x35e36e(_0x332918['error'](0x1f4,_0x15e378[_0xf4eb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 862b2be..18f99c9 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 _0x221a=['emit','length','./mailQueue.events','update'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x221a,0xe2));var _0xa221=function(_0x569719,_0x28e9dd){_0x569719=_0x569719-0x0;var _0x368e8b=_0x221a[_0x569719];return _0x368e8b;};'use strict';var MailQueueEvents=require(_0xa221('0x0'));var events=['save','remove',_0xa221('0x1')];function createListener(_0xbfb7a4,_0x15fcdf){return function(_0x223716){_0x15fcdf[_0xa221('0x2')](_0xbfb7a4,_0x223716);};}function removeListener(_0x221c57,_0x45a7cc){return function(){MailQueueEvents['removeListener'](_0x221c57,_0x45a7cc);};}exports['register']=function(_0xa8b8c1){for(var _0x3f5354=0x0,_0x205856=events[_0xa221('0x3')];_0x3f5354<_0x205856;_0x3f5354++){var _0x3c7b82=events[_0x3f5354];var _0x20d944=createListener('mailQueue:'+_0x3c7b82,_0xa8b8c1);MailQueueEvents['on'](_0x3c7b82,_0x20d944);}}; \ No newline at end of file +var _0x5e92=['save','update','emit','removeListener','register','length'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x5e92,0xba));var _0x25e9=function(_0x803229,_0xcb86a2){_0x803229=_0x803229-0x0;var _0x40cab1=_0x5e92[_0x803229];return _0x40cab1;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x25e9('0x0'),'remove',_0x25e9('0x1')];function createListener(_0x451ff7,_0x1c8d82){return function(_0xab0b87){_0x1c8d82[_0x25e9('0x2')](_0x451ff7,_0xab0b87);};}function removeListener(_0x3bb94f,_0x144244){return function(){MailQueueEvents[_0x25e9('0x3')](_0x3bb94f,_0x144244);};}exports[_0x25e9('0x4')]=function(_0xae0134){for(var _0x12a974=0x0,_0x183424=events[_0x25e9('0x5')];_0x12a974<_0x183424;_0x12a974++){var _0x3417c0=events[_0x12a974];var _0x51db60=createListener('mailQueue:'+_0x3417c0,_0xae0134);MailQueueEvents['on'](_0x3417c0,_0x51db60);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 55c5692..e5eb34c 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 _0x5f49=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','update'];(function(_0x19bc63,_0x2f3cc1){var _0x34a691=function(_0x189803){while(--_0x189803){_0x19bc63['push'](_0x19bc63['shift']());}};_0x34a691(++_0x2f3cc1);}(_0x5f49,0x95));var _0x95f4=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x5f49[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x95f4('0x0'));var util=require(_0x95f4('0x1'));var path=require(_0x95f4('0x2'));var timeout=require(_0x95f4('0x3'));var express=require(_0x95f4('0x4'));var router=express[_0x95f4('0x5')]();var auth=require(_0x95f4('0x6'));var interaction=require(_0x95f4('0x7'));var config=require(_0x95f4('0x8'));var controller=require(_0x95f4('0x9'));router[_0x95f4('0xa')]('/',auth[_0x95f4('0xb')](),controller['index']);router[_0x95f4('0xa')](_0x95f4('0xc'),auth[_0x95f4('0xb')](),controller['describe']);router[_0x95f4('0xa')](_0x95f4('0xd'),auth['isAuthenticated'](),controller[_0x95f4('0xe')]);router[_0x95f4('0xf')]('/',auth[_0x95f4('0xb')](),controller[_0x95f4('0x10')]);router[_0x95f4('0x11')](_0x95f4('0xd'),auth[_0x95f4('0xb')](),controller[_0x95f4('0x12')]);router[_0x95f4('0x13')](_0x95f4('0xd'),auth[_0x95f4('0xb')](),controller[_0x95f4('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3b55=['describe','/:id','show','post','put','update','delete','destroy','multer','util','express','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index'];(function(_0x4a38ed,_0x2db0af){var _0x5b7dd5=function(_0x4b49dd){while(--_0x4b49dd){_0x4a38ed['push'](_0x4a38ed['shift']());}};_0x5b7dd5(++_0x2db0af);}(_0x3b55,0xe5));var _0x53b5=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x3b55[_0x616290];return _0x453879;};'use strict';var multer=require(_0x53b5('0x0'));var util=require(_0x53b5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x53b5('0x2'));var router=express['Router']();var auth=require(_0x53b5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x53b5('0x4'));var controller=require(_0x53b5('0x5'));router[_0x53b5('0x6')]('/',auth[_0x53b5('0x7')](),controller[_0x53b5('0x8')]);router[_0x53b5('0x6')]('/describe',auth[_0x53b5('0x7')](),controller[_0x53b5('0x9')]);router[_0x53b5('0x6')](_0x53b5('0xa'),auth[_0x53b5('0x7')](),controller[_0x53b5('0xb')]);router[_0x53b5('0xc')]('/',auth[_0x53b5('0x7')](),controller['create']);router[_0x53b5('0xd')](_0x53b5('0xa'),auth[_0x53b5('0x7')](),controller[_0x53b5('0xe')]);router[_0x53b5('0xf')](_0x53b5('0xa'),auth[_0x53b5('0x7')](),controller[_0x53b5('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index f17ee52..18c18a3 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 _0x2e02=['exports','STRING','DATE','moment'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x2e02,0x10b));var _0x22e0=function(_0x4b57c0,_0xe72b61){_0x4b57c0=_0x4b57c0-0x0;var _0x9eac5b=_0x2e02[_0x4b57c0];return _0x9eac5b;};'use strict';var moment=require(_0x22e0('0x0'));var Sequelize=require('sequelize');module[_0x22e0('0x1')]={'uniqueid':{'type':Sequelize[_0x22e0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x22e0('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x22e0('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x276c=['STRING','moment','sequelize','DATE'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x276c,0x1c1));var _0xc276=function(_0xa0c7cc,_0x1309b4){_0xa0c7cc=_0xa0c7cc-0x0;var _0x4da8cb=_0x276c[_0xa0c7cc];return _0x4da8cb;};'use strict';var moment=require(_0xc276('0x0'));var Sequelize=require(_0xc276('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc276('0x2')]},'leaveAt':{'type':Sequelize[_0xc276('0x2')]},'acceptAt':{'type':Sequelize[_0xc276('0x2')]},'exitAt':{'type':Sequelize[_0xc276('0x2')]},'reason':{'type':Sequelize[_0xc276('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 727ea89..b260d9e 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 _0x99d6=['sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','filtears','find','create','body','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','limit','order'];(function(_0x4deb3a,_0x288752){var _0x282ce3=function(_0xd29251){while(--_0xd29251){_0x4deb3a['push'](_0x4deb3a['shift']());}};_0x282ce3(++_0x288752);}(_0x99d6,0xf5));var _0x699d=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x99d6[_0x5ee3d3];return _0x4b272f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x699d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x699d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x699d('0x2'));var moment=require('moment');var BPromise=require(_0x699d('0x3'));var Mustache=require(_0x699d('0x4'));var util=require(_0x699d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x699d('0x6'));var ejs=require(_0x699d('0x7'));var fs=require('fs');var _=require(_0x699d('0x8'));var squel=require(_0x699d('0x9'));var crypto=require(_0x699d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x699d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x699d('0xc'));var Papa=require('papaparse');var Redis=require(_0x699d('0xd'));var authService=require(_0x699d('0xe'));var qs=require(_0x699d('0xf'));var as=require(_0x699d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x699d('0x11'))(_0x699d('0x12'));var utils=require(_0x699d('0x13'));var config=require(_0x699d('0x14'));var licenseUtil=require(_0x699d('0x15'));var db=require(_0x699d('0x16'))['db'];function respondWithStatusCode(_0x3430ee,_0x21ac79){_0x21ac79=_0x21ac79||0xcc;return function(_0x458c75){if(_0x458c75){return _0x3430ee[_0x699d('0x17')](_0x21ac79);}return _0x3430ee[_0x699d('0x18')](_0x21ac79)[_0x699d('0x19')]();};}function respondWithResult(_0x4687fb,_0x4db8c5){_0x4db8c5=_0x4db8c5||0xc8;return function(_0x58b93d){if(_0x58b93d){return _0x4687fb[_0x699d('0x18')](_0x4db8c5)[_0x699d('0x1a')](_0x58b93d);}};}function respondWithFilteredResult(_0xe07e21,_0xa600fb){return function(_0x19d0a9){if(_0x19d0a9){var _0x403ab0=_0x19d0a9['count'],_0x4d98ff=_0xa600fb[_0x699d('0x1b')],_0x26cb5e=_0xa600fb['offset']+_0xa600fb['limit'],_0x136f66;if(_0x26cb5e>=_0x403ab0){_0x26cb5e=_0x403ab0;_0x136f66=0xc8;}else{_0x136f66=0xce;}_0xe07e21[_0x699d('0x18')](_0x136f66);return _0xe07e21[_0x699d('0x1c')](_0x699d('0x1d'),_0x4d98ff+'-'+_0x26cb5e+'/'+_0x403ab0)[_0x699d('0x1a')](_0x19d0a9);}return null;};}function patchUpdates(_0x564bae){return function(_0x577991){try{jsonpatch[_0x699d('0x1e')](_0x577991,_0x564bae,!![]);}catch(_0x3e9d1c){return BPromise[_0x699d('0x1f')](_0x3e9d1c);}return _0x577991['save']();};}function saveUpdates(_0x5cf192,_0x495e40){return function(_0x263bc0){if(_0x263bc0){return _0x263bc0[_0x699d('0x20')](_0x5cf192)[_0x699d('0x21')](function(_0x14d4ab){return _0x14d4ab;});}return null;};}function removeEntity(_0x5c4784,_0x6624b1){return function(_0x36eb44){if(_0x36eb44){return _0x36eb44[_0x699d('0x22')]()[_0x699d('0x21')](function(){_0x5c4784[_0x699d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x111d1a,_0x2e8119){return function(_0x6fab3){if(!_0x6fab3){_0x111d1a['sendStatus'](0x194);}return _0x6fab3;};}function handleError(_0x15b05f,_0x522fef){_0x522fef=_0x522fef||0x1f4;return function(_0x189750){logger[_0x699d('0x23')](_0x189750['stack']);if(_0x189750[_0x699d('0x24')]){delete _0x189750[_0x699d('0x24')];}_0x15b05f['status'](_0x522fef)[_0x699d('0x25')](_0x189750);};}exports[_0x699d('0x26')]=function(_0x12138d,_0x54307f){var _0x48b633={},_0x192d4d={},_0x2fc3a5={'count':0x0,'rows':[]};var _0x33f465=_[_0x699d('0x27')](db[_0x699d('0x28')][_0x699d('0x29')],function(_0xf5b06f){return{'name':_0xf5b06f[_0x699d('0x2a')],'type':_0xf5b06f[_0x699d('0x2b')][_0x699d('0x2c')]};});_0x192d4d['model']=_[_0x699d('0x27')](_0x33f465,'name');_0x192d4d['query']=_[_0x699d('0x2d')](_0x12138d[_0x699d('0x2e')]);_0x192d4d[_0x699d('0x2f')]=_['intersection'](_0x192d4d[_0x699d('0x30')],_0x192d4d[_0x699d('0x2e')]);_0x48b633[_0x699d('0x31')]=_[_0x699d('0x32')](_0x192d4d[_0x699d('0x30')],qs[_0x699d('0x33')](_0x12138d[_0x699d('0x2e')][_0x699d('0x33')]));_0x48b633[_0x699d('0x31')]=_0x48b633[_0x699d('0x31')][_0x699d('0x34')]?_0x48b633[_0x699d('0x31')]:_0x192d4d['model'];if(!_0x12138d[_0x699d('0x2e')]['hasOwnProperty']('nolimit')){_0x48b633['limit']=qs[_0x699d('0x35')](_0x12138d[_0x699d('0x2e')][_0x699d('0x35')]);_0x48b633[_0x699d('0x1b')]=qs[_0x699d('0x1b')](_0x12138d[_0x699d('0x2e')]['offset']);}_0x48b633[_0x699d('0x36')]=qs[_0x699d('0x37')](_0x12138d[_0x699d('0x2e')][_0x699d('0x37')]);_0x48b633['where']=qs[_0x699d('0x2f')](_[_0x699d('0x38')](_0x12138d['query'],_0x192d4d[_0x699d('0x2f')]),_0x33f465);if(_0x12138d[_0x699d('0x2e')][_0x699d('0x39')]){_0x48b633[_0x699d('0x3a')]=_[_0x699d('0x3b')](_0x48b633[_0x699d('0x3a')],{'$or':_[_0x699d('0x27')](_0x33f465,function(_0x1cc50a){if(_0x1cc50a['type']!==_0x699d('0x3c')){var _0x68a077={};_0x68a077[_0x1cc50a[_0x699d('0x24')]]={'$like':'%'+_0x12138d['query']['filter']+'%'};return _0x68a077;}})});}_0x48b633=_[_0x699d('0x3b')]({},_0x48b633,_0x12138d[_0x699d('0x3d')]);var _0x288af3={'where':_0x48b633[_0x699d('0x3a')]};return db[_0x699d('0x28')]['count'](_0x288af3)[_0x699d('0x21')](function(_0x4064b0){_0x2fc3a5[_0x699d('0x3e')]=_0x4064b0;if(_0x12138d[_0x699d('0x2e')][_0x699d('0x3f')]){_0x48b633[_0x699d('0x40')]=[{'all':!![]}];}return db[_0x699d('0x28')][_0x699d('0x41')](_0x48b633);})['then'](function(_0x4052d5){_0x2fc3a5[_0x699d('0x42')]=_0x4052d5;return _0x2fc3a5;})[_0x699d('0x21')](respondWithFilteredResult(_0x54307f,_0x48b633))[_0x699d('0x43')](handleError(_0x54307f,null));};exports[_0x699d('0x44')]=function(_0x5c583e,_0x2595a8){var _0xaa2a51={'raw':!![],'where':{'id':_0x5c583e['params']['id']}},_0x41c104={};_0x41c104[_0x699d('0x30')]=_[_0x699d('0x2d')](db[_0x699d('0x28')]['rawAttributes']);_0x41c104[_0x699d('0x2e')]=_[_0x699d('0x2d')](_0x5c583e[_0x699d('0x2e')]);_0x41c104[_0x699d('0x45')]=_[_0x699d('0x32')](_0x41c104['model'],_0x41c104[_0x699d('0x2e')]);_0xaa2a51['attributes']=_[_0x699d('0x32')](_0x41c104[_0x699d('0x30')],qs['fields'](_0x5c583e[_0x699d('0x2e')][_0x699d('0x33')]));_0xaa2a51[_0x699d('0x31')]=_0xaa2a51[_0x699d('0x31')][_0x699d('0x34')]?_0xaa2a51[_0x699d('0x31')]:_0x41c104['model'];if(_0x5c583e[_0x699d('0x2e')]['includeAll']){_0xaa2a51[_0x699d('0x40')]=[{'all':!![]}];}_0xaa2a51=_[_0x699d('0x3b')]({},_0xaa2a51,_0x5c583e[_0x699d('0x3d')]);return db[_0x699d('0x28')][_0x699d('0x46')](_0xaa2a51)[_0x699d('0x21')](handleEntityNotFound(_0x2595a8,null))[_0x699d('0x21')](respondWithResult(_0x2595a8,null))['catch'](handleError(_0x2595a8,null));};exports['create']=function(_0x565187,_0x5a72f3){return db['MailQueueReport'][_0x699d('0x47')](_0x565187[_0x699d('0x48')],{})[_0x699d('0x21')](respondWithResult(_0x5a72f3,0xc9))[_0x699d('0x43')](handleError(_0x5a72f3,null));};exports[_0x699d('0x20')]=function(_0xb16357,_0x5ab7b1){if(_0xb16357[_0x699d('0x48')]['id']){delete _0xb16357[_0x699d('0x48')]['id'];}return db[_0x699d('0x28')][_0x699d('0x46')]({'where':{'id':_0xb16357['params']['id']}})[_0x699d('0x21')](handleEntityNotFound(_0x5ab7b1,null))[_0x699d('0x21')](saveUpdates(_0xb16357[_0x699d('0x48')],null))[_0x699d('0x21')](respondWithResult(_0x5ab7b1,null))[_0x699d('0x43')](handleError(_0x5ab7b1,null));};exports['destroy']=function(_0x3c786c,_0x824e4a){return db[_0x699d('0x28')][_0x699d('0x46')]({'where':{'id':_0x3c786c[_0x699d('0x49')]['id']}})[_0x699d('0x21')](handleEntityNotFound(_0x824e4a,null))[_0x699d('0x21')](removeEntity(_0x824e4a,null))[_0x699d('0x43')](handleError(_0x824e4a,null));};exports[_0x699d('0x4a')]=function(_0x2af9da,_0x5f2da4){return db['MailQueueReport'][_0x699d('0x4a')]()[_0x699d('0x21')](respondWithResult(_0x5f2da4,null))[_0x699d('0x43')](handleError(_0x5f2da4,null));}; \ No newline at end of file +var _0x21ee=['json','count','offset','apply','reject','save','update','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4600fe,_0x48d0a6){var _0x185e1a=function(_0x230bc9){while(--_0x230bc9){_0x4600fe['push'](_0x4600fe['shift']());}};_0x185e1a(++_0x48d0a6);}(_0x21ee,0x111));var _0xe21e=function(_0x1a2795,_0x474d5a){_0x1a2795=_0x1a2795-0x0;var _0x324102=_0x21ee[_0x1a2795];return _0x324102;};'use strict';var pdf=require(_0xe21e('0x0'));var emlformat=require(_0xe21e('0x1'));var rimraf=require(_0xe21e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe21e('0x3'));var rp=require(_0xe21e('0x4'));var moment=require(_0xe21e('0x5'));var BPromise=require(_0xe21e('0x6'));var Mustache=require(_0xe21e('0x7'));var util=require('util');var path=require(_0xe21e('0x8'));var sox=require(_0xe21e('0x9'));var csv=require(_0xe21e('0xa'));var ejs=require(_0xe21e('0xb'));var fs=require('fs');var _=require(_0xe21e('0xc'));var squel=require(_0xe21e('0xd'));var crypto=require(_0xe21e('0xe'));var jsforce=require(_0xe21e('0xf'));var deskjs=require(_0xe21e('0x10'));var toCsv=require(_0xe21e('0xa'));var querystring=require(_0xe21e('0x11'));var Papa=require(_0xe21e('0x12'));var Redis=require(_0xe21e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe21e('0x14'));var as=require(_0xe21e('0x15'));var hardwareService=require(_0xe21e('0x16'));var logger=require(_0xe21e('0x17'))(_0xe21e('0x18'));var utils=require('../../config/utils');var config=require(_0xe21e('0x19'));var licenseUtil=require(_0xe21e('0x1a'));var db=require(_0xe21e('0x1b'))['db'];function respondWithStatusCode(_0x52dc28,_0x3b62f6){_0x3b62f6=_0x3b62f6||0xcc;return function(_0x55895c){if(_0x55895c){return _0x52dc28[_0xe21e('0x1c')](_0x3b62f6);}return _0x52dc28[_0xe21e('0x1d')](_0x3b62f6)[_0xe21e('0x1e')]();};}function respondWithResult(_0x2cd896,_0x4da3){_0x4da3=_0x4da3||0xc8;return function(_0x2a2406){if(_0x2a2406){return _0x2cd896[_0xe21e('0x1d')](_0x4da3)[_0xe21e('0x1f')](_0x2a2406);}};}function respondWithFilteredResult(_0x479db3,_0x16fec2){return function(_0x4072ad){if(_0x4072ad){var _0x2cb624=_0x4072ad[_0xe21e('0x20')],_0x40e392=_0x16fec2[_0xe21e('0x21')],_0x46a978=_0x16fec2[_0xe21e('0x21')]+_0x16fec2['limit'],_0x77b00e;if(_0x46a978>=_0x2cb624){_0x46a978=_0x2cb624;_0x77b00e=0xc8;}else{_0x77b00e=0xce;}_0x479db3[_0xe21e('0x1d')](_0x77b00e);return _0x479db3['set']('Content-Range',_0x40e392+'-'+_0x46a978+'/'+_0x2cb624)[_0xe21e('0x1f')](_0x4072ad);}return null;};}function patchUpdates(_0x26f306){return function(_0x3b2a66){try{jsonpatch[_0xe21e('0x22')](_0x3b2a66,_0x26f306,!![]);}catch(_0x4a1f04){return BPromise[_0xe21e('0x23')](_0x4a1f04);}return _0x3b2a66[_0xe21e('0x24')]();};}function saveUpdates(_0x204e3b,_0x770673){return function(_0xc4a244){if(_0xc4a244){return _0xc4a244[_0xe21e('0x25')](_0x204e3b)['then'](function(_0x4c144a){return _0x4c144a;});}return null;};}function removeEntity(_0x318427,_0x430a16){return function(_0x4cd7de){if(_0x4cd7de){return _0x4cd7de[_0xe21e('0x26')]()[_0xe21e('0x27')](function(){_0x318427[_0xe21e('0x1d')](0xcc)[_0xe21e('0x1e')]();});}};}function handleEntityNotFound(_0x3c6d63,_0x3b2f75){return function(_0x956b1){if(!_0x956b1){_0x3c6d63[_0xe21e('0x1c')](0x194);}return _0x956b1;};}function handleError(_0x3fc8d3,_0x50c8c0){_0x50c8c0=_0x50c8c0||0x1f4;return function(_0x2aece6){logger[_0xe21e('0x28')](_0x2aece6['stack']);if(_0x2aece6['name']){delete _0x2aece6[_0xe21e('0x29')];}_0x3fc8d3[_0xe21e('0x1d')](_0x50c8c0)[_0xe21e('0x2a')](_0x2aece6);};}exports[_0xe21e('0x2b')]=function(_0x112215,_0x2694ab){var _0x41e49a={},_0x339d23={},_0x26ad7a={'count':0x0,'rows':[]};var _0x310125=_[_0xe21e('0x2c')](db[_0xe21e('0x2d')][_0xe21e('0x2e')],function(_0x5c6cd9){return{'name':_0x5c6cd9['fieldName'],'type':_0x5c6cd9[_0xe21e('0x2f')][_0xe21e('0x30')]};});_0x339d23[_0xe21e('0x31')]=_[_0xe21e('0x2c')](_0x310125,_0xe21e('0x29'));_0x339d23[_0xe21e('0x32')]=_[_0xe21e('0x33')](_0x112215[_0xe21e('0x32')]);_0x339d23[_0xe21e('0x34')]=_[_0xe21e('0x35')](_0x339d23[_0xe21e('0x31')],_0x339d23['query']);_0x41e49a[_0xe21e('0x36')]=_[_0xe21e('0x35')](_0x339d23[_0xe21e('0x31')],qs[_0xe21e('0x37')](_0x112215[_0xe21e('0x32')][_0xe21e('0x37')]));_0x41e49a[_0xe21e('0x36')]=_0x41e49a[_0xe21e('0x36')][_0xe21e('0x38')]?_0x41e49a[_0xe21e('0x36')]:_0x339d23[_0xe21e('0x31')];if(!_0x112215[_0xe21e('0x32')][_0xe21e('0x39')](_0xe21e('0x3a'))){_0x41e49a['limit']=qs[_0xe21e('0x3b')](_0x112215[_0xe21e('0x32')][_0xe21e('0x3b')]);_0x41e49a[_0xe21e('0x21')]=qs[_0xe21e('0x21')](_0x112215[_0xe21e('0x32')][_0xe21e('0x21')]);}_0x41e49a['order']=qs[_0xe21e('0x3c')](_0x112215[_0xe21e('0x32')][_0xe21e('0x3c')]);_0x41e49a['where']=qs[_0xe21e('0x34')](_[_0xe21e('0x3d')](_0x112215[_0xe21e('0x32')],_0x339d23[_0xe21e('0x34')]),_0x310125);if(_0x112215[_0xe21e('0x32')][_0xe21e('0x3e')]){_0x41e49a[_0xe21e('0x3f')]=_['merge'](_0x41e49a[_0xe21e('0x3f')],{'$or':_[_0xe21e('0x2c')](_0x310125,function(_0x5eb464){if(_0x5eb464[_0xe21e('0x2f')]!==_0xe21e('0x40')){var _0x28e262={};_0x28e262[_0x5eb464[_0xe21e('0x29')]]={'$like':'%'+_0x112215[_0xe21e('0x32')][_0xe21e('0x3e')]+'%'};return _0x28e262;}})});}_0x41e49a=_[_0xe21e('0x41')]({},_0x41e49a,_0x112215[_0xe21e('0x42')]);var _0x4ff2c8={'where':_0x41e49a[_0xe21e('0x3f')]};return db['MailQueueReport']['count'](_0x4ff2c8)[_0xe21e('0x27')](function(_0x18ad83){_0x26ad7a['count']=_0x18ad83;if(_0x112215[_0xe21e('0x32')][_0xe21e('0x43')]){_0x41e49a[_0xe21e('0x44')]=[{'all':!![]}];}return db[_0xe21e('0x2d')]['findAll'](_0x41e49a);})['then'](function(_0x32ab16){_0x26ad7a[_0xe21e('0x45')]=_0x32ab16;return _0x26ad7a;})[_0xe21e('0x27')](respondWithFilteredResult(_0x2694ab,_0x41e49a))[_0xe21e('0x46')](handleError(_0x2694ab,null));};exports['show']=function(_0x3bb4a8,_0x190ab7){var _0x3197c2={'raw':!![],'where':{'id':_0x3bb4a8[_0xe21e('0x47')]['id']}},_0x194795={};_0x194795[_0xe21e('0x31')]=_[_0xe21e('0x33')](db[_0xe21e('0x2d')][_0xe21e('0x2e')]);_0x194795['query']=_['keys'](_0x3bb4a8['query']);_0x194795['filtears']=_[_0xe21e('0x35')](_0x194795[_0xe21e('0x31')],_0x194795['query']);_0x3197c2['attributes']=_[_0xe21e('0x35')](_0x194795[_0xe21e('0x31')],qs['fields'](_0x3bb4a8[_0xe21e('0x32')][_0xe21e('0x37')]));_0x3197c2[_0xe21e('0x36')]=_0x3197c2[_0xe21e('0x36')]['length']?_0x3197c2[_0xe21e('0x36')]:_0x194795[_0xe21e('0x31')];if(_0x3bb4a8['query']['includeAll']){_0x3197c2['include']=[{'all':!![]}];}_0x3197c2=_['merge']({},_0x3197c2,_0x3bb4a8[_0xe21e('0x42')]);return db[_0xe21e('0x2d')][_0xe21e('0x48')](_0x3197c2)[_0xe21e('0x27')](handleEntityNotFound(_0x190ab7,null))[_0xe21e('0x27')](respondWithResult(_0x190ab7,null))[_0xe21e('0x46')](handleError(_0x190ab7,null));};exports[_0xe21e('0x49')]=function(_0x5d4f2b,_0x289ef2){return db[_0xe21e('0x2d')][_0xe21e('0x49')](_0x5d4f2b['body'],{})[_0xe21e('0x27')](respondWithResult(_0x289ef2,0xc9))[_0xe21e('0x46')](handleError(_0x289ef2,null));};exports[_0xe21e('0x25')]=function(_0x1cbaef,_0x523c41){if(_0x1cbaef[_0xe21e('0x4a')]['id']){delete _0x1cbaef['body']['id'];}return db[_0xe21e('0x2d')][_0xe21e('0x48')]({'where':{'id':_0x1cbaef[_0xe21e('0x47')]['id']}})[_0xe21e('0x27')](handleEntityNotFound(_0x523c41,null))[_0xe21e('0x27')](saveUpdates(_0x1cbaef[_0xe21e('0x4a')],null))[_0xe21e('0x27')](respondWithResult(_0x523c41,null))[_0xe21e('0x46')](handleError(_0x523c41,null));};exports[_0xe21e('0x26')]=function(_0x1e5f7b,_0x59aa9f){return db['MailQueueReport'][_0xe21e('0x48')]({'where':{'id':_0x1e5f7b[_0xe21e('0x47')]['id']}})[_0xe21e('0x27')](handleEntityNotFound(_0x59aa9f,null))[_0xe21e('0x27')](removeEntity(_0x59aa9f,null))[_0xe21e('0x46')](handleError(_0x59aa9f,null));};exports[_0xe21e('0x4b')]=function(_0x2763d0,_0x36e2bc){return db[_0xe21e('0x2d')][_0xe21e('0x4b')]()[_0xe21e('0x27')](respondWithResult(_0x36e2bc,null))[_0xe21e('0x46')](handleError(_0x36e2bc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8e3115e..8aedf40 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 _0xa728=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0xb40c64,_0x19d4b5){var _0x33825a=function(_0x2ede11){while(--_0x2ede11){_0xb40c64['push'](_0xb40c64['shift']());}};_0x33825a(++_0x19d4b5);}(_0xa728,0xb2));var _0x8a72=function(_0x3d816a,_0x59f66e){_0x3d816a=_0x3d816a-0x0;var _0x302cb3=_0xa728[_0x3d816a];return _0x302cb3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8a72('0x0'))(_0x8a72('0x1'));var moment=require(_0x8a72('0x2'));var BPromise=require(_0x8a72('0x3'));var rp=require(_0x8a72('0x4'));var fs=require('fs');var path=require(_0x8a72('0x5'));var rimraf=require(_0x8a72('0x6'));var config=require(_0x8a72('0x7'));var attributes=require(_0x8a72('0x8'));module[_0x8a72('0x9')]=function(_0x3066c2,_0x5b8a59){return _0x3066c2[_0x8a72('0xa')](_0x8a72('0xb'),attributes,{'tableName':_0x8a72('0xc'),'paranoid':![],'indexes':[{'name':_0x8a72('0xd'),'fields':[_0x8a72('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x99ab=['rimraf','../../config/environment','report_mail_queue','uniqueid','util','../../config/logger','api','request-promise'];(function(_0x5d9f80,_0x1695f4){var _0x3fbe5b=function(_0x3795e4){while(--_0x3795e4){_0x5d9f80['push'](_0x5d9f80['shift']());}};_0x3fbe5b(++_0x1695f4);}(_0x99ab,0xe4));var _0xb99a=function(_0x24f614,_0x5aca38){_0x24f614=_0x24f614-0x0;var _0x1eff88=_0x99ab[_0x24f614];return _0x1eff88;};'use strict';var _=require('lodash');var util=require(_0xb99a('0x0'));var logger=require(_0xb99a('0x1'))(_0xb99a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb99a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb99a('0x4'));var config=require(_0xb99a('0x5'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x4ae3b0,_0x3c49d2){return _0x4ae3b0['define']('MailQueueReport',attributes,{'tableName':_0xb99a('0x6'),'paranoid':![],'indexes':[{'name':_0xb99a('0x7'),'fields':[_0xb99a('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 56c49e8..6a99a9d 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 _0x4ad7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','util','moment'];(function(_0x5d850b,_0x40466d){var _0x150446=function(_0x54736d){while(--_0x54736d){_0x5d850b['push'](_0x5d850b['shift']());}};_0x150446(++_0x40466d);}(_0x4ad7,0x152));var _0x74ad=function(_0xac3328,_0x23745a){_0xac3328=_0xac3328-0x0;var _0x33aec4=_0x4ad7[_0xac3328];return _0x33aec4;};'use strict';var _=require('lodash');var util=require(_0x74ad('0x0'));var moment=require(_0x74ad('0x1'));var BPromise=require(_0x74ad('0x2'));var rs=require(_0x74ad('0x3'));var fs=require('fs');var Redis=require(_0x74ad('0x4'));var db=require(_0x74ad('0x5'))['db'];var utils=require(_0x74ad('0x6'));var logger=require(_0x74ad('0x7'))(_0x74ad('0x8'));var config=require(_0x74ad('0x9'));var jayson=require(_0x74ad('0xa'));var client=jayson[_0x74ad('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2df090,_0x2e2bfe,_0x341557){return new BPromise(function(_0x2fcb27,_0x4fa9cb){return client[_0x74ad('0xc')](_0x2df090,_0x341557)[_0x74ad('0xd')](function(_0x19b1cf){logger[_0x74ad('0xe')]('MailQueueReport,\x20%s,\x20%s',_0x2e2bfe,_0x74ad('0xf'));logger[_0x74ad('0x10')](_0x74ad('0x11'),_0x2e2bfe,_0x74ad('0xf'),JSON[_0x74ad('0x12')](_0x19b1cf));if(_0x19b1cf[_0x74ad('0x13')]){if(_0x19b1cf[_0x74ad('0x13')][_0x74ad('0x14')]===0x1f4){logger[_0x74ad('0x13')](_0x74ad('0x15'),_0x2e2bfe,_0x19b1cf[_0x74ad('0x13')][_0x74ad('0x16')]);return _0x4fa9cb(_0x19b1cf['error'][_0x74ad('0x16')]);}logger[_0x74ad('0x13')](_0x74ad('0x15'),_0x2e2bfe,_0x19b1cf[_0x74ad('0x13')][_0x74ad('0x16')]);return _0x2fcb27(_0x19b1cf['error'][_0x74ad('0x16')]);}else{logger[_0x74ad('0xe')](_0x74ad('0x15'),_0x2e2bfe,_0x74ad('0xf'));_0x2fcb27(_0x19b1cf[_0x74ad('0x17')]['message']);}})[_0x74ad('0x18')](function(_0x151dd9){logger[_0x74ad('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x2e2bfe,_0x151dd9);_0x4fa9cb(_0x151dd9);});});}exports[_0x74ad('0x19')]=function(_0x4bc211){var _0x36b9a3=this;return new Promise(function(_0x3a5f8d,_0x15c7b8){return db['MailQueueReport'][_0x74ad('0x1a')](_0x4bc211[_0x74ad('0x1b')],{'raw':_0x4bc211[_0x74ad('0x1c')]?_0x4bc211['options'][_0x74ad('0x1d')]===undefined?!![]:![]:!![]})[_0x74ad('0xd')](function(_0x1bee7f){logger[_0x74ad('0xe')](_0x74ad('0x19'),_0x4bc211);logger[_0x74ad('0x10')](_0x74ad('0x19'),_0x4bc211,JSON['stringify'](_0x1bee7f));_0x3a5f8d(_0x1bee7f);})[_0x74ad('0x18')](function(_0x571a41){logger['error'](_0x74ad('0x19'),_0x571a41[_0x74ad('0x16')],_0x4bc211);_0x15c7b8(_0x36b9a3[_0x74ad('0x13')](0x1f4,_0x571a41[_0x74ad('0x16')]));});});};exports[_0x74ad('0x1e')]=function(_0x3998e4){var _0x354aac=this;return new Promise(function(_0x4d230f,_0x4dba4a){return db['MailQueueReport'][_0x74ad('0x1f')](_0x3998e4[_0x74ad('0x1b')],{'raw':_0x3998e4[_0x74ad('0x1c')]?_0x3998e4[_0x74ad('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3998e4['options']?_0x3998e4['options'][_0x74ad('0x20')]||null:null,'attributes':_0x3998e4[_0x74ad('0x1c')]?_0x3998e4['options'][_0x74ad('0x21')]||null:null,'limit':_0x3998e4[_0x74ad('0x1c')]?_0x3998e4[_0x74ad('0x1c')]['limit']||null:null})['then'](function(_0x3b6f81){logger[_0x74ad('0xe')](_0x74ad('0x1e'),_0x3998e4);logger['debug']('UpdateMailQueueReport',_0x3998e4,JSON[_0x74ad('0x12')](_0x3b6f81));_0x4d230f(_0x3b6f81);})[_0x74ad('0x18')](function(_0x2546f2){logger[_0x74ad('0x13')]('UpdateMailQueueReport',_0x2546f2[_0x74ad('0x16')],_0x3998e4);_0x4dba4a(_0x354aac[_0x74ad('0x13')](0x1f4,_0x2546f2[_0x74ad('0x16')]));});});}; \ No newline at end of file +var _0x8e46=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','options','UpdateMailQueueReport','update','body','raw','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x46fe1f,_0x570278){var _0x2e3ec3=function(_0x374ce4){while(--_0x374ce4){_0x46fe1f['push'](_0x46fe1f['shift']());}};_0x2e3ec3(++_0x570278);}(_0x8e46,0xf1));var _0x68e4=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x8e46[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x68e4('0x0'));var util=require(_0x68e4('0x1'));var moment=require('moment');var BPromise=require(_0x68e4('0x2'));var rs=require(_0x68e4('0x3'));var fs=require('fs');var Redis=require(_0x68e4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x68e4('0x5'));var logger=require(_0x68e4('0x6'))(_0x68e4('0x7'));var config=require(_0x68e4('0x8'));var jayson=require(_0x68e4('0x9'));var client=jayson[_0x68e4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x176681,_0x1617a6,_0x4e91a5){return new BPromise(function(_0x3c4ee3,_0x5c8114){return client[_0x68e4('0xb')](_0x176681,_0x4e91a5)[_0x68e4('0xc')](function(_0x2800d1){logger[_0x68e4('0xd')](_0x68e4('0xe'),_0x1617a6,_0x68e4('0xf'));logger[_0x68e4('0x10')](_0x68e4('0x11'),_0x1617a6,_0x68e4('0xf'),JSON[_0x68e4('0x12')](_0x2800d1));if(_0x2800d1[_0x68e4('0x13')]){if(_0x2800d1['error'][_0x68e4('0x14')]===0x1f4){logger[_0x68e4('0x13')](_0x68e4('0xe'),_0x1617a6,_0x2800d1['error'][_0x68e4('0x15')]);return _0x5c8114(_0x2800d1[_0x68e4('0x13')][_0x68e4('0x15')]);}logger[_0x68e4('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x1617a6,_0x2800d1[_0x68e4('0x13')][_0x68e4('0x15')]);return _0x3c4ee3(_0x2800d1['error'][_0x68e4('0x15')]);}else{logger[_0x68e4('0xd')](_0x68e4('0xe'),_0x1617a6,_0x68e4('0xf'));_0x3c4ee3(_0x2800d1[_0x68e4('0x16')][_0x68e4('0x15')]);}})[_0x68e4('0x17')](function(_0x52df1d){logger['error'](_0x68e4('0xe'),_0x1617a6,_0x52df1d);_0x5c8114(_0x52df1d);});});}exports[_0x68e4('0x18')]=function(_0x1986b0){var _0x1e9076=this;return new Promise(function(_0x4b342e,_0x2d43df){return db[_0x68e4('0x19')][_0x68e4('0x1a')](_0x1986b0['body'],{'raw':_0x1986b0['options']?_0x1986b0[_0x68e4('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x198a06){logger[_0x68e4('0xd')]('CreateMailQueueReport',_0x1986b0);logger['debug']('CreateMailQueueReport',_0x1986b0,JSON['stringify'](_0x198a06));_0x4b342e(_0x198a06);})['catch'](function(_0x26276f){logger[_0x68e4('0x13')](_0x68e4('0x18'),_0x26276f['message'],_0x1986b0);_0x2d43df(_0x1e9076[_0x68e4('0x13')](0x1f4,_0x26276f[_0x68e4('0x15')]));});});};exports[_0x68e4('0x1c')]=function(_0x8a86bb){var _0xf28b24=this;return new Promise(function(_0xf6f346,_0x3c1fbf){return db[_0x68e4('0x19')][_0x68e4('0x1d')](_0x8a86bb[_0x68e4('0x1e')],{'raw':_0x8a86bb[_0x68e4('0x1b')]?_0x8a86bb[_0x68e4('0x1b')][_0x68e4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a86bb[_0x68e4('0x1b')]?_0x8a86bb[_0x68e4('0x1b')][_0x68e4('0x20')]||null:null,'attributes':_0x8a86bb[_0x68e4('0x1b')]?_0x8a86bb[_0x68e4('0x1b')][_0x68e4('0x21')]||null:null,'limit':_0x8a86bb['options']?_0x8a86bb[_0x68e4('0x1b')][_0x68e4('0x22')]||null:null})[_0x68e4('0xc')](function(_0x376660){logger[_0x68e4('0xd')](_0x68e4('0x1c'),_0x8a86bb);logger[_0x68e4('0x10')](_0x68e4('0x1c'),_0x8a86bb,JSON[_0x68e4('0x12')](_0x376660));_0xf6f346(_0x376660);})[_0x68e4('0x17')](function(_0x1f0038){logger[_0x68e4('0x13')](_0x68e4('0x1c'),_0x1f0038['message'],_0x8a86bb);_0x3c1fbf(_0xf28b24[_0x68e4('0x13')](0x1f4,_0x1f0038[_0x68e4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 630a051..d4f4e12 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 _0x4e8a=['multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4e8a,0x111));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa4e8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa4e8('0x1'));var express=require(_0xa4e8('0x2'));var router=express[_0xa4e8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4e8('0x4'));var config=require(_0xa4e8('0x5'));module[_0xa4e8('0x6')]=router; \ No newline at end of file +var _0x73e0=['Router','../../components/auth/service','../../config/environment','exports','util','connect-timeout','express'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0x73e0,0x1d9));var _0x073e=function(_0x5581c0,_0x2f013){_0x5581c0=_0x5581c0-0x0;var _0x2b538c=_0x73e0[_0x5581c0];return _0x2b538c;};'use strict';var multer=require('multer');var util=require(_0x073e('0x0'));var path=require('path');var timeout=require(_0x073e('0x1'));var express=require(_0x073e('0x2'));var router=express[_0x073e('0x3')]();var auth=require(_0x073e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x073e('0x5'));module[_0x073e('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 4c084b7..2a5f295 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 _0x4480=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x2d2618,_0x4dc8b2){var _0x3b5c2b=function(_0x24a9db){while(--_0x24a9db){_0x2d2618['push'](_0x2d2618['shift']());}};_0x3b5c2b(++_0x4dc8b2);}(_0x4480,0x9b));var _0x0448=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x4480[_0x456fb1];return _0x4083d6;};'use strict';var Sequelize=require(_0x0448('0x0'));module['exports']={'description':{'type':Sequelize[_0x0448('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0448('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x0448('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0448('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x0448('0x1')],'defaultValue':_0x0448('0x4')},'connTimeout':{'type':Sequelize[_0x0448('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x0448('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x0448('0x1')]}}; \ No newline at end of file +var _0x0855=['BOOLEAN','username','INTEGER','INBOX','exports','STRING'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x0855,0x118));var _0x5085=function(_0x42fbd7,_0x2d511d){_0x42fbd7=_0x42fbd7-0x0;var _0x2f7e9=_0x0855[_0x42fbd7];return _0x2f7e9;};'use strict';var Sequelize=require('sequelize');module[_0x5085('0x0')]={'description':{'type':Sequelize[_0x5085('0x1')]},'host':{'type':Sequelize[_0x5085('0x1')]},'authentication':{'type':Sequelize[_0x5085('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5085('0x1')],'unique':_0x5085('0x3')},'password':{'type':Sequelize[_0x5085('0x1')]},'port':{'type':Sequelize[_0x5085('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5085('0x1')],'defaultValue':_0x5085('0x5')},'connTimeout':{'type':Sequelize[_0x5085('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x5085('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x5085('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 8e523d4..1eb4300 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 _0x5ba3=['request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','api','bluebird'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x5ba3,0x140));var _0x35ba=function(_0x2aaab0,_0x5eab94){_0x2aaab0=_0x2aaab0-0x0;var _0x5b2596=_0x5ba3[_0x2aaab0];return _0x5b2596;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01d3=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0xf5fbb7,_0xdb7f69){var _0x330d55=function(_0x45fd85){while(--_0x45fd85){_0xf5fbb7['push'](_0xf5fbb7['shift']());}};_0x330d55(++_0xdb7f69);}(_0x01d3,0xa2));var _0x301d=function(_0x4ec4e1,_0x29b81b){_0x4ec4e1=_0x4ec4e1-0x0;var _0x436715=_0x01d3[_0x4ec4e1];return _0x436715;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var logger=require(_0x301d('0x2'))(_0x301d('0x3'));var moment=require('moment');var BPromise=require(_0x301d('0x4'));var rp=require(_0x301d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x301d('0x6'));var config=require(_0x301d('0x7'));var attributes=require(_0x301d('0x8'));module[_0x301d('0x9')]=function(_0x5d1462,_0x318074){return _0x5d1462[_0x301d('0xa')](_0x301d('0xb'),attributes,{'tableName':_0x301d('0xc'),'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 9a9179d..3d829c7 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 _0x3621=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','lodash','util','randomstring','ioredis'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x3621,0xe3));var _0x1362=function(_0x1534a2,_0x3dea19){_0x1534a2=_0x1534a2-0x0;var _0x42b620=_0x3621[_0x1534a2];return _0x42b620;};'use strict';var _=require(_0x1362('0x0'));var util=require(_0x1362('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1362('0x2'));var fs=require('fs');var Redis=require(_0x1362('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1362('0x4'))(_0x1362('0x5'));var config=require(_0x1362('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1362('0x7')][_0x1362('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9fe9,_0x3cbcf7,_0x4886e4){return new BPromise(function(_0x19d7f7,_0x2bd47b){return client[_0x1362('0x9')](_0x2c9fe9,_0x4886e4)[_0x1362('0xa')](function(_0x1e941b){logger[_0x1362('0xb')](_0x1362('0xc'),_0x3cbcf7,_0x1362('0xd'));logger[_0x1362('0xe')](_0x1362('0xf'),_0x3cbcf7,_0x1362('0xd'),JSON[_0x1362('0x10')](_0x1e941b));if(_0x1e941b[_0x1362('0x11')]){if(_0x1e941b['error'][_0x1362('0x12')]===0x1f4){logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);return _0x2bd47b(_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);}logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x1e941b['error'][_0x1362('0x13')]);return _0x19d7f7(_0x1e941b[_0x1362('0x11')][_0x1362('0x13')]);}else{logger[_0x1362('0xb')](_0x1362('0xc'),_0x3cbcf7,_0x1362('0xd'));_0x19d7f7(_0x1e941b[_0x1362('0x14')]['message']);}})[_0x1362('0x15')](function(_0x535061){logger[_0x1362('0x11')](_0x1362('0xc'),_0x3cbcf7,_0x535061);_0x2bd47b(_0x535061);});});}exports[_0x1362('0x16')]=function(_0x30e14c){var _0x3374a9=this;return new Promise(function(_0x1a7cf2,_0x4c57d5){return db[_0x1362('0x17')][_0x1362('0x18')]({'raw':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1a')]===undefined?!![]:![]:!![],'where':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1b')]||null:null,'attributes':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')]['attributes']||null:null,'limit':_0x30e14c[_0x1362('0x19')]?_0x30e14c[_0x1362('0x19')][_0x1362('0x1c')]||null:null,'include':_0x30e14c['options']?_0x30e14c[_0x1362('0x19')][_0x1362('0x1d')]?_[_0x1362('0x1e')](_0x30e14c['options']['include'],function(_0x5685f){return{'model':db[_0x5685f[_0x1362('0x1f')]],'as':_0x5685f['as'],'attributes':_0x5685f[_0x1362('0x20')],'include':_0x5685f[_0x1362('0x1d')]?_[_0x1362('0x1e')](_0x5685f[_0x1362('0x1d')],function(_0xfe970c){return{'model':db[_0xfe970c[_0x1362('0x1f')]],'as':_0xfe970c['as'],'attributes':_0xfe970c[_0x1362('0x20')],'include':_0xfe970c[_0x1362('0x1d')]?_[_0x1362('0x1e')](_0xfe970c[_0x1362('0x1d')],function(_0x9dbbca){return{'model':db[_0x9dbbca[_0x1362('0x1f')]],'as':_0x9dbbca['as'],'attributes':_0x9dbbca[_0x1362('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1362('0xa')](function(_0x534d14){logger[_0x1362('0xb')](_0x1362('0x16'),_0x30e14c);logger[_0x1362('0xe')](_0x1362('0x16'),_0x30e14c,JSON[_0x1362('0x10')](_0x534d14));_0x1a7cf2(_0x534d14);})[_0x1362('0x15')](function(_0x2fadd4){logger[_0x1362('0x11')](_0x1362('0x16'),_0x2fadd4['message'],_0x30e14c);_0x4c57d5(_0x3374a9[_0x1362('0x11')](0x1f4,_0x2fadd4[_0x1362('0x13')]));});});}; \ No newline at end of file +var _0x643d=['model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailServerIn','options','where','attributes','limit','include','map'];(function(_0x558e10,_0x4fc19e){var _0x400514=function(_0x3302a8){while(--_0x3302a8){_0x558e10['push'](_0x558e10['shift']());}};_0x400514(++_0x4fc19e);}(_0x643d,0x15d));var _0xd643=function(_0x528e64,_0x5f2d9f){_0x528e64=_0x528e64-0x0;var _0x22dd1e=_0x643d[_0x528e64];return _0x22dd1e;};'use strict';var _=require(_0xd643('0x0'));var util=require(_0xd643('0x1'));var moment=require('moment');var BPromise=require(_0xd643('0x2'));var rs=require(_0xd643('0x3'));var fs=require('fs');var Redis=require(_0xd643('0x4'));var db=require(_0xd643('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd643('0x6'))(_0xd643('0x7'));var config=require(_0xd643('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x47939c,_0x101e14,_0x3adb6a){return new BPromise(function(_0x44d6ca,_0x1d5b52){return client[_0xd643('0x9')](_0x47939c,_0x3adb6a)[_0xd643('0xa')](function(_0x4bbd41){logger[_0xd643('0xb')](_0xd643('0xc'),_0x101e14,_0xd643('0xd'));logger[_0xd643('0xe')](_0xd643('0xf'),_0x101e14,'request\x20sent',JSON[_0xd643('0x10')](_0x4bbd41));if(_0x4bbd41[_0xd643('0x11')]){if(_0x4bbd41[_0xd643('0x11')][_0xd643('0x12')]===0x1f4){logger['error'](_0xd643('0xc'),_0x101e14,_0x4bbd41[_0xd643('0x11')][_0xd643('0x13')]);return _0x1d5b52(_0x4bbd41['error'][_0xd643('0x13')]);}logger[_0xd643('0x11')]('MailServerIn,\x20%s,\x20%s',_0x101e14,_0x4bbd41[_0xd643('0x11')]['message']);return _0x44d6ca(_0x4bbd41[_0xd643('0x11')][_0xd643('0x13')]);}else{logger[_0xd643('0xb')](_0xd643('0xc'),_0x101e14,_0xd643('0xd'));_0x44d6ca(_0x4bbd41['result']['message']);}})[_0xd643('0x14')](function(_0x105e4f){logger[_0xd643('0x11')](_0xd643('0xc'),_0x101e14,_0x105e4f);_0x1d5b52(_0x105e4f);});});}exports[_0xd643('0x15')]=function(_0x4363f7){var _0x4663f9=this;return new Promise(function(_0x3d5f40,_0xb7b4d5){return db['MailServerIn']['findAll']({'raw':_0x4363f7[_0xd643('0x16')]?_0x4363f7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4363f7[_0xd643('0x16')]?_0x4363f7['options'][_0xd643('0x17')]||null:null,'attributes':_0x4363f7[_0xd643('0x16')]?_0x4363f7[_0xd643('0x16')][_0xd643('0x18')]||null:null,'limit':_0x4363f7[_0xd643('0x16')]?_0x4363f7[_0xd643('0x16')][_0xd643('0x19')]||null:null,'include':_0x4363f7['options']?_0x4363f7['options'][_0xd643('0x1a')]?_[_0xd643('0x1b')](_0x4363f7[_0xd643('0x16')]['include'],function(_0x2df613){return{'model':db[_0x2df613[_0xd643('0x1c')]],'as':_0x2df613['as'],'attributes':_0x2df613['attributes'],'include':_0x2df613[_0xd643('0x1a')]?_['map'](_0x2df613['include'],function(_0x29d22f){return{'model':db[_0x29d22f[_0xd643('0x1c')]],'as':_0x29d22f['as'],'attributes':_0x29d22f[_0xd643('0x18')],'include':_0x29d22f[_0xd643('0x1a')]?_[_0xd643('0x1b')](_0x29d22f['include'],function(_0x463c4f){return{'model':db[_0x463c4f['model']],'as':_0x463c4f['as'],'attributes':_0x463c4f['attributes']};}):[]};}):[]};}):[]:[]})[_0xd643('0xa')](function(_0x335694){logger[_0xd643('0xb')]('GetMailServerIn',_0x4363f7);logger[_0xd643('0xe')](_0xd643('0x15'),_0x4363f7,JSON[_0xd643('0x10')](_0x335694));_0x3d5f40(_0x335694);})[_0xd643('0x14')](function(_0x8c58bb){logger[_0xd643('0x11')](_0xd643('0x15'),_0x8c58bb[_0xd643('0x13')],_0x4363f7);_0xb7b4d5(_0x4663f9[_0xd643('0x11')](0x1f4,_0x8c58bb[_0xd643('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ee9d9f0..b62c5c6 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 _0xd43c=['isAuthenticated','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show','post'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xd43c,0xba));var _0xcd43=function(_0x1993a8,_0xd34e39){_0x1993a8=_0x1993a8-0x0;var _0x353428=_0xd43c[_0x1993a8];return _0x353428;};'use strict';var multer=require(_0xcd43('0x0'));var util=require(_0xcd43('0x1'));var path=require(_0xcd43('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd43('0x3'));var router=express[_0xcd43('0x4')]();var auth=require(_0xcd43('0x5'));var interaction=require(_0xcd43('0x6'));var config=require(_0xcd43('0x7'));var controller=require(_0xcd43('0x8'));router[_0xcd43('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd43('0xa')]);router[_0xcd43('0x9')](_0xcd43('0xb'),auth['isAuthenticated'](),controller[_0xcd43('0xc')]);router[_0xcd43('0xd')]('/',auth[_0xcd43('0xe')](),controller[_0xcd43('0xf')]);router[_0xcd43('0x10')](_0xcd43('0xb'),auth[_0xcd43('0xe')](),controller[_0xcd43('0x11')]);router[_0xcd43('0x12')](_0xcd43('0xb'),auth[_0xcd43('0xe')](),controller['destroy']);module[_0xcd43('0x13')]=router; \ No newline at end of file +var _0xe412=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0x5cfa4f,_0x4d8fe9){var _0x2e5acd=function(_0x474d1a){while(--_0x474d1a){_0x5cfa4f['push'](_0x5cfa4f['shift']());}};_0x2e5acd(++_0x4d8fe9);}(_0xe412,0x75));var _0x2e41=function(_0x2d3000,_0x424572){_0x2d3000=_0x2d3000-0x0;var _0xab6ac8=_0xe412[_0x2d3000];return _0xab6ac8;};'use strict';var multer=require(_0x2e41('0x0'));var util=require(_0x2e41('0x1'));var path=require(_0x2e41('0x2'));var timeout=require(_0x2e41('0x3'));var express=require(_0x2e41('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2e41('0x5'));var config=require(_0x2e41('0x6'));var controller=require(_0x2e41('0x7'));router[_0x2e41('0x8')]('/',auth[_0x2e41('0x9')](),controller['index']);router[_0x2e41('0x8')](_0x2e41('0xa'),auth[_0x2e41('0x9')](),controller[_0x2e41('0xb')]);router[_0x2e41('0xc')]('/',auth[_0x2e41('0x9')](),controller[_0x2e41('0xd')]);router[_0x2e41('0xe')](_0x2e41('0xa'),auth['isAuthenticated'](),controller[_0x2e41('0xf')]);router['delete'](_0x2e41('0xa'),auth['isAuthenticated'](),controller[_0x2e41('0x10')]);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 45e9132..2eafae4 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 _0x7dee=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dee,0xb0));var _0xe7de=function(_0x31348e,_0xcc7a46){_0x31348e=_0x31348e-0x0;var _0x45748d=_0x7dee[_0x31348e];return _0x45748d;};'use strict';var Sequelize=require(_0xe7de('0x0'));module['exports']={'description':{'type':Sequelize[_0xe7de('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xe7de('0x1')]},'pass':{'type':Sequelize[_0xe7de('0x1')]},'port':{'type':Sequelize[_0xe7de('0x2')]},'secure':{'type':Sequelize[_0xe7de('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xe7de('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x565e=['BOOLEAN','sequelize','STRING'];(function(_0x4ba431,_0x16f397){var _0x2a655f=function(_0x1a4808){while(--_0x1a4808){_0x4ba431['push'](_0x4ba431['shift']());}};_0x2a655f(++_0x16f397);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe565('0x0'));module['exports']={'description':{'type':Sequelize[_0xe565('0x1')]},'host':{'type':Sequelize[_0xe565('0x1')]},'user':{'type':Sequelize[_0xe565('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xe565('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xe565('0x1')]},'authentication':{'type':Sequelize[_0xe565('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 4326059..9ea46d0 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 _0x9d02=['merge','includeAll','include','findAll','catch','params','filtears','intersection','fields','find','create','body','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x16b617,_0x550147){var _0x5076cf=function(_0x57d54b){while(--_0x57d54b){_0x16b617['push'](_0x16b617['shift']());}};_0x5076cf(++_0x550147);}(_0x9d02,0x118));var _0x29d0=function(_0x1b8e78,_0x371050){_0x1b8e78=_0x1b8e78-0x0;var _0x12a99d=_0x9d02[_0x1b8e78];return _0x12a99d;};'use strict';var pdf=require(_0x29d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29d0('0x2'));var rp=require('request-promise');var moment=require(_0x29d0('0x3'));var BPromise=require(_0x29d0('0x4'));var Mustache=require('mustache');var util=require(_0x29d0('0x5'));var path=require(_0x29d0('0x6'));var sox=require(_0x29d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x29d0('0x8'));var crypto=require(_0x29d0('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x29d0('0xa'));var toCsv=require(_0x29d0('0xb'));var querystring=require('querystring');var Papa=require(_0x29d0('0xc'));var Redis=require(_0x29d0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x29d0('0xe'));var as=require(_0x29d0('0xf'));var hardwareService=require(_0x29d0('0x10'));var logger=require(_0x29d0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x29d0('0x12'));var licenseUtil=require(_0x29d0('0x13'));var db=require(_0x29d0('0x14'))['db'];function respondWithStatusCode(_0x1413fd,_0x12cba7){_0x12cba7=_0x12cba7||0xcc;return function(_0x357120){if(_0x357120){return _0x1413fd[_0x29d0('0x15')](_0x12cba7);}return _0x1413fd[_0x29d0('0x16')](_0x12cba7)[_0x29d0('0x17')]();};}function respondWithResult(_0x4c5eed,_0x22903c){_0x22903c=_0x22903c||0xc8;return function(_0x2474b3){if(_0x2474b3){return _0x4c5eed[_0x29d0('0x16')](_0x22903c)[_0x29d0('0x18')](_0x2474b3);}};}function respondWithFilteredResult(_0x120c96,_0xa0b9dc){return function(_0x55ba12){if(_0x55ba12){var _0x24562f=_0x55ba12[_0x29d0('0x19')],_0x1826d0=_0xa0b9dc[_0x29d0('0x1a')],_0x75a016=_0xa0b9dc[_0x29d0('0x1a')]+_0xa0b9dc[_0x29d0('0x1b')],_0x49e919;if(_0x75a016>=_0x24562f){_0x75a016=_0x24562f;_0x49e919=0xc8;}else{_0x49e919=0xce;}_0x120c96[_0x29d0('0x16')](_0x49e919);return _0x120c96[_0x29d0('0x1c')]('Content-Range',_0x1826d0+'-'+_0x75a016+'/'+_0x24562f)[_0x29d0('0x18')](_0x55ba12);}return null;};}function patchUpdates(_0x3bb3b5){return function(_0x1135f6){try{jsonpatch[_0x29d0('0x1d')](_0x1135f6,_0x3bb3b5,!![]);}catch(_0x46562c){return BPromise[_0x29d0('0x1e')](_0x46562c);}return _0x1135f6['save']();};}function saveUpdates(_0x385e63,_0x170993){return function(_0x1e87f0){if(_0x1e87f0){return _0x1e87f0['update'](_0x385e63)[_0x29d0('0x1f')](function(_0x347c45){return _0x347c45;});}return null;};}function removeEntity(_0x1f9e73,_0x4179a0){return function(_0x5cf0dc){if(_0x5cf0dc){return _0x5cf0dc[_0x29d0('0x20')]()[_0x29d0('0x1f')](function(){_0x1f9e73[_0x29d0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40da12,_0x1c80f2){return function(_0x7e2520){if(!_0x7e2520){_0x40da12[_0x29d0('0x15')](0x194);}return _0x7e2520;};}function handleError(_0x2a976d,_0x286e30){_0x286e30=_0x286e30||0x1f4;return function(_0x39037a){logger['error'](_0x39037a[_0x29d0('0x21')]);if(_0x39037a[_0x29d0('0x22')]){delete _0x39037a[_0x29d0('0x22')];}_0x2a976d[_0x29d0('0x16')](_0x286e30)[_0x29d0('0x23')](_0x39037a);};}exports[_0x29d0('0x24')]=function(_0x5c4be8,_0x342a0d){var _0x4b6012={},_0x435918={},_0x579948={'count':0x0,'rows':[]};var _0x123637=_[_0x29d0('0x25')](db[_0x29d0('0x26')][_0x29d0('0x27')],function(_0x9573ff){return{'name':_0x9573ff[_0x29d0('0x28')],'type':_0x9573ff[_0x29d0('0x29')][_0x29d0('0x2a')]};});_0x435918[_0x29d0('0x2b')]=_[_0x29d0('0x25')](_0x123637,_0x29d0('0x22'));_0x435918['query']=_[_0x29d0('0x2c')](_0x5c4be8[_0x29d0('0x2d')]);_0x435918[_0x29d0('0x2e')]=_['intersection'](_0x435918[_0x29d0('0x2b')],_0x435918['query']);_0x4b6012[_0x29d0('0x2f')]=_['intersection'](_0x435918[_0x29d0('0x2b')],qs['fields'](_0x5c4be8[_0x29d0('0x2d')]['fields']));_0x4b6012[_0x29d0('0x2f')]=_0x4b6012[_0x29d0('0x2f')][_0x29d0('0x30')]?_0x4b6012[_0x29d0('0x2f')]:_0x435918[_0x29d0('0x2b')];if(!_0x5c4be8['query'][_0x29d0('0x31')](_0x29d0('0x32'))){_0x4b6012['limit']=qs['limit'](_0x5c4be8['query']['limit']);_0x4b6012[_0x29d0('0x1a')]=qs['offset'](_0x5c4be8[_0x29d0('0x2d')][_0x29d0('0x1a')]);}_0x4b6012[_0x29d0('0x33')]=qs[_0x29d0('0x34')](_0x5c4be8['query'][_0x29d0('0x34')]);_0x4b6012[_0x29d0('0x35')]=qs[_0x29d0('0x2e')](_['pick'](_0x5c4be8['query'],_0x435918['filters']),_0x123637);if(_0x5c4be8['query'][_0x29d0('0x36')]){_0x4b6012[_0x29d0('0x35')]=_[_0x29d0('0x37')](_0x4b6012[_0x29d0('0x35')],{'$or':_[_0x29d0('0x25')](_0x123637,function(_0x2e77fd){if(_0x2e77fd[_0x29d0('0x29')]!=='VIRTUAL'){var _0x3e7198={};_0x3e7198[_0x2e77fd[_0x29d0('0x22')]]={'$like':'%'+_0x5c4be8[_0x29d0('0x2d')]['filter']+'%'};return _0x3e7198;}})});}_0x4b6012=_[_0x29d0('0x37')]({},_0x4b6012,_0x5c4be8['options']);var _0x2751d5={'where':_0x4b6012['where']};return db['MailServerOut'][_0x29d0('0x19')](_0x2751d5)[_0x29d0('0x1f')](function(_0x3ffece){_0x579948['count']=_0x3ffece;if(_0x5c4be8[_0x29d0('0x2d')][_0x29d0('0x38')]){_0x4b6012[_0x29d0('0x39')]=[{'all':!![]}];}return db[_0x29d0('0x26')][_0x29d0('0x3a')](_0x4b6012);})[_0x29d0('0x1f')](function(_0x2c5bbe){_0x579948['rows']=_0x2c5bbe;return _0x579948;})['then'](respondWithFilteredResult(_0x342a0d,_0x4b6012))[_0x29d0('0x3b')](handleError(_0x342a0d,null));};exports['show']=function(_0x144a10,_0x3f95db){var _0x23a1f1={'raw':!![],'where':{'id':_0x144a10[_0x29d0('0x3c')]['id']}},_0x79ea89={};_0x79ea89['model']=_[_0x29d0('0x2c')](db[_0x29d0('0x26')][_0x29d0('0x27')]);_0x79ea89[_0x29d0('0x2d')]=_['keys'](_0x144a10[_0x29d0('0x2d')]);_0x79ea89[_0x29d0('0x3d')]=_[_0x29d0('0x3e')](_0x79ea89[_0x29d0('0x2b')],_0x79ea89[_0x29d0('0x2d')]);_0x23a1f1[_0x29d0('0x2f')]=_[_0x29d0('0x3e')](_0x79ea89[_0x29d0('0x2b')],qs[_0x29d0('0x3f')](_0x144a10[_0x29d0('0x2d')][_0x29d0('0x3f')]));_0x23a1f1[_0x29d0('0x2f')]=_0x23a1f1[_0x29d0('0x2f')][_0x29d0('0x30')]?_0x23a1f1['attributes']:_0x79ea89[_0x29d0('0x2b')];if(_0x144a10['query'][_0x29d0('0x38')]){_0x23a1f1[_0x29d0('0x39')]=[{'all':!![]}];}_0x23a1f1=_[_0x29d0('0x37')]({},_0x23a1f1,_0x144a10['options']);return db['MailServerOut'][_0x29d0('0x40')](_0x23a1f1)[_0x29d0('0x1f')](handleEntityNotFound(_0x3f95db,null))[_0x29d0('0x1f')](respondWithResult(_0x3f95db,null))[_0x29d0('0x3b')](handleError(_0x3f95db,null));};exports['create']=function(_0x3750b0,_0x1f4d7a){return db[_0x29d0('0x26')][_0x29d0('0x41')](_0x3750b0[_0x29d0('0x42')],{})[_0x29d0('0x1f')](respondWithResult(_0x1f4d7a,0xc9))[_0x29d0('0x3b')](handleError(_0x1f4d7a,null));};exports['update']=function(_0x5ce627,_0x2bfff8){if(_0x5ce627[_0x29d0('0x42')]['id']){delete _0x5ce627['body']['id'];}return db[_0x29d0('0x26')]['find']({'where':{'id':_0x5ce627[_0x29d0('0x3c')]['id']}})[_0x29d0('0x1f')](handleEntityNotFound(_0x2bfff8,null))[_0x29d0('0x1f')](saveUpdates(_0x5ce627['body'],null))['then'](respondWithResult(_0x2bfff8,null))[_0x29d0('0x3b')](handleError(_0x2bfff8,null));};exports[_0x29d0('0x20')]=function(_0x364302,_0x4cc68b){return db['MailServerOut'][_0x29d0('0x40')]({'where':{'id':_0x364302['params']['id']}})[_0x29d0('0x1f')](handleEntityNotFound(_0x4cc68b,null))[_0x29d0('0x1f')](removeEntity(_0x4cc68b,null))['catch'](handleError(_0x4cc68b,null));}; \ No newline at end of file +var _0x390a=['sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','nolimit','order','sort','filter','merge','VIRTUAL','options','MailServerOut','then','include','findAll','rows','params','keys','filtears','includeAll','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x390a,0xc9));var _0xa390=function(_0x1951ef,_0x5f5bf6){_0x1951ef=_0x1951ef-0x0;var _0x476902=_0x390a[_0x1951ef];return _0x476902;};'use strict';var pdf=require(_0xa390('0x0'));var emlformat=require(_0xa390('0x1'));var rimraf=require(_0xa390('0x2'));var zipdir=require(_0xa390('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa390('0x4'));var moment=require(_0xa390('0x5'));var BPromise=require(_0xa390('0x6'));var Mustache=require(_0xa390('0x7'));var util=require('util');var path=require(_0xa390('0x8'));var sox=require(_0xa390('0x9'));var csv=require(_0xa390('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa390('0xb'));var squel=require(_0xa390('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa390('0xd'));var toCsv=require(_0xa390('0xa'));var querystring=require(_0xa390('0xe'));var Papa=require(_0xa390('0xf'));var Redis=require(_0xa390('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa390('0x11'));var hardwareService=require(_0xa390('0x12'));var logger=require(_0xa390('0x13'))('api');var utils=require(_0xa390('0x14'));var config=require(_0xa390('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa390('0x16'))['db'];function respondWithStatusCode(_0x2bee3b,_0x57a89a){_0x57a89a=_0x57a89a||0xcc;return function(_0x5cd158){if(_0x5cd158){return _0x2bee3b[_0xa390('0x17')](_0x57a89a);}return _0x2bee3b[_0xa390('0x18')](_0x57a89a)['end']();};}function respondWithResult(_0x3f26cd,_0x4c484c){_0x4c484c=_0x4c484c||0xc8;return function(_0x554b6b){if(_0x554b6b){return _0x3f26cd['status'](_0x4c484c)[_0xa390('0x19')](_0x554b6b);}};}function respondWithFilteredResult(_0x4c7bb9,_0x23de0c){return function(_0x4645be){if(_0x4645be){var _0x4d4d74=_0x4645be[_0xa390('0x1a')],_0x15204e=_0x23de0c['offset'],_0x180429=_0x23de0c[_0xa390('0x1b')]+_0x23de0c[_0xa390('0x1c')],_0x59d609;if(_0x180429>=_0x4d4d74){_0x180429=_0x4d4d74;_0x59d609=0xc8;}else{_0x59d609=0xce;}_0x4c7bb9[_0xa390('0x18')](_0x59d609);return _0x4c7bb9[_0xa390('0x1d')]('Content-Range',_0x15204e+'-'+_0x180429+'/'+_0x4d4d74)[_0xa390('0x19')](_0x4645be);}return null;};}function patchUpdates(_0x4a803c){return function(_0x59ef38){try{jsonpatch[_0xa390('0x1e')](_0x59ef38,_0x4a803c,!![]);}catch(_0xc2c6f3){return BPromise['reject'](_0xc2c6f3);}return _0x59ef38[_0xa390('0x1f')]();};}function saveUpdates(_0xb10495,_0x5aa3d5){return function(_0x134ace){if(_0x134ace){return _0x134ace[_0xa390('0x20')](_0xb10495)['then'](function(_0x5222bd){return _0x5222bd;});}return null;};}function removeEntity(_0x18a0f0,_0x374ea9){return function(_0x130355){if(_0x130355){return _0x130355['destroy']()['then'](function(){_0x18a0f0[_0xa390('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2840,_0x11a069){return function(_0x2aeb9f){if(!_0x2aeb9f){_0x3f2840['sendStatus'](0x194);}return _0x2aeb9f;};}function handleError(_0x1abdc2,_0x4541a6){_0x4541a6=_0x4541a6||0x1f4;return function(_0xa93d06){logger['error'](_0xa93d06[_0xa390('0x21')]);if(_0xa93d06['name']){delete _0xa93d06[_0xa390('0x22')];}_0x1abdc2['status'](_0x4541a6)[_0xa390('0x23')](_0xa93d06);};}exports[_0xa390('0x24')]=function(_0x7cfd06,_0x19a4ac){var _0x22c5ba={},_0x351913={},_0x55e360={'count':0x0,'rows':[]};var _0x58a01a=_[_0xa390('0x25')](db['MailServerOut'][_0xa390('0x26')],function(_0x45d572){return{'name':_0x45d572[_0xa390('0x27')],'type':_0x45d572[_0xa390('0x28')][_0xa390('0x29')]};});_0x351913[_0xa390('0x2a')]=_['map'](_0x58a01a,_0xa390('0x22'));_0x351913[_0xa390('0x2b')]=_['keys'](_0x7cfd06[_0xa390('0x2b')]);_0x351913[_0xa390('0x2c')]=_['intersection'](_0x351913[_0xa390('0x2a')],_0x351913[_0xa390('0x2b')]);_0x22c5ba['attributes']=_[_0xa390('0x2d')](_0x351913[_0xa390('0x2a')],qs[_0xa390('0x2e')](_0x7cfd06[_0xa390('0x2b')][_0xa390('0x2e')]));_0x22c5ba['attributes']=_0x22c5ba['attributes'][_0xa390('0x2f')]?_0x22c5ba[_0xa390('0x30')]:_0x351913['model'];if(!_0x7cfd06[_0xa390('0x2b')]['hasOwnProperty'](_0xa390('0x31'))){_0x22c5ba[_0xa390('0x1c')]=qs[_0xa390('0x1c')](_0x7cfd06[_0xa390('0x2b')][_0xa390('0x1c')]);_0x22c5ba[_0xa390('0x1b')]=qs[_0xa390('0x1b')](_0x7cfd06[_0xa390('0x2b')][_0xa390('0x1b')]);}_0x22c5ba[_0xa390('0x32')]=qs[_0xa390('0x33')](_0x7cfd06['query'][_0xa390('0x33')]);_0x22c5ba['where']=qs[_0xa390('0x2c')](_['pick'](_0x7cfd06[_0xa390('0x2b')],_0x351913[_0xa390('0x2c')]),_0x58a01a);if(_0x7cfd06[_0xa390('0x2b')][_0xa390('0x34')]){_0x22c5ba['where']=_[_0xa390('0x35')](_0x22c5ba['where'],{'$or':_[_0xa390('0x25')](_0x58a01a,function(_0x47f7ed){if(_0x47f7ed[_0xa390('0x28')]!==_0xa390('0x36')){var _0x2fe9f3={};_0x2fe9f3[_0x47f7ed[_0xa390('0x22')]]={'$like':'%'+_0x7cfd06[_0xa390('0x2b')][_0xa390('0x34')]+'%'};return _0x2fe9f3;}})});}_0x22c5ba=_[_0xa390('0x35')]({},_0x22c5ba,_0x7cfd06[_0xa390('0x37')]);var _0x54c759={'where':_0x22c5ba['where']};return db[_0xa390('0x38')][_0xa390('0x1a')](_0x54c759)[_0xa390('0x39')](function(_0x1fb572){_0x55e360[_0xa390('0x1a')]=_0x1fb572;if(_0x7cfd06[_0xa390('0x2b')]['includeAll']){_0x22c5ba[_0xa390('0x3a')]=[{'all':!![]}];}return db[_0xa390('0x38')][_0xa390('0x3b')](_0x22c5ba);})[_0xa390('0x39')](function(_0x49ec26){_0x55e360[_0xa390('0x3c')]=_0x49ec26;return _0x55e360;})[_0xa390('0x39')](respondWithFilteredResult(_0x19a4ac,_0x22c5ba))['catch'](handleError(_0x19a4ac,null));};exports['show']=function(_0x4b8288,_0x9f74fd){var _0x169233={'raw':!![],'where':{'id':_0x4b8288[_0xa390('0x3d')]['id']}},_0x274230={};_0x274230[_0xa390('0x2a')]=_[_0xa390('0x3e')](db[_0xa390('0x38')][_0xa390('0x26')]);_0x274230[_0xa390('0x2b')]=_['keys'](_0x4b8288[_0xa390('0x2b')]);_0x274230[_0xa390('0x3f')]=_[_0xa390('0x2d')](_0x274230[_0xa390('0x2a')],_0x274230[_0xa390('0x2b')]);_0x169233[_0xa390('0x30')]=_[_0xa390('0x2d')](_0x274230[_0xa390('0x2a')],qs[_0xa390('0x2e')](_0x4b8288[_0xa390('0x2b')][_0xa390('0x2e')]));_0x169233[_0xa390('0x30')]=_0x169233[_0xa390('0x30')][_0xa390('0x2f')]?_0x169233[_0xa390('0x30')]:_0x274230[_0xa390('0x2a')];if(_0x4b8288[_0xa390('0x2b')][_0xa390('0x40')]){_0x169233[_0xa390('0x3a')]=[{'all':!![]}];}_0x169233=_[_0xa390('0x35')]({},_0x169233,_0x4b8288[_0xa390('0x37')]);return db['MailServerOut'][_0xa390('0x41')](_0x169233)[_0xa390('0x39')](handleEntityNotFound(_0x9f74fd,null))[_0xa390('0x39')](respondWithResult(_0x9f74fd,null))[_0xa390('0x42')](handleError(_0x9f74fd,null));};exports[_0xa390('0x43')]=function(_0x414511,_0x49c914){return db[_0xa390('0x38')][_0xa390('0x43')](_0x414511[_0xa390('0x44')],{})['then'](respondWithResult(_0x49c914,0xc9))[_0xa390('0x42')](handleError(_0x49c914,null));};exports[_0xa390('0x20')]=function(_0x685388,_0x48b311){if(_0x685388[_0xa390('0x44')]['id']){delete _0x685388[_0xa390('0x44')]['id'];}return db[_0xa390('0x38')][_0xa390('0x41')]({'where':{'id':_0x685388[_0xa390('0x3d')]['id']}})[_0xa390('0x39')](handleEntityNotFound(_0x48b311,null))[_0xa390('0x39')](saveUpdates(_0x685388[_0xa390('0x44')],null))[_0xa390('0x39')](respondWithResult(_0x48b311,null))[_0xa390('0x42')](handleError(_0x48b311,null));};exports[_0xa390('0x45')]=function(_0x4753b0,_0x30d525){return db[_0xa390('0x38')]['find']({'where':{'id':_0x4753b0['params']['id']}})[_0xa390('0x39')](handleEntityNotFound(_0x30d525,null))[_0xa390('0x39')](removeEntity(_0x30d525,null))['catch'](handleError(_0x30d525,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 0265b95..7c69864 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 _0x187d=['define','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes'];(function(_0x37016e,_0x40346e){var _0xf68530=function(_0xcfbf16){while(--_0xcfbf16){_0x37016e['push'](_0x37016e['shift']());}};_0xf68530(++_0x40346e);}(_0x187d,0x93));var _0xd187=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x187d[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','../../config/logger','api','moment'];(function(_0x468dd3,_0x1e7376){var _0xc9c269=function(_0x4cd5b5){while(--_0x4cd5b5){_0x468dd3['push'](_0x468dd3['shift']());}};_0xc9c269(++_0x1e7376);}(_0x53ec,0x192));var _0xc53e=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x53ec[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'mail_servers_out','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 371d2cd..fb04f7f 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 _0xfeae=['info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x99c2dd,_0x1d32eb){var _0x173349=function(_0x211a30){while(--_0x211a30){_0x99c2dd['push'](_0x99c2dd['shift']());}};_0x173349(++_0x1d32eb);}(_0xfeae,0x185));var _0xefea=function(_0x1b7237,_0x45a411){_0x1b7237=_0x1b7237-0x0;var _0x5bd5c8=_0xfeae[_0x1b7237];return _0x5bd5c8;};'use strict';var _=require(_0xefea('0x0'));var util=require(_0xefea('0x1'));var moment=require(_0xefea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefea('0x3'))['db'];var utils=require(_0xefea('0x4'));var logger=require('../../config/logger')(_0xefea('0x5'));var config=require(_0xefea('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f60,_0x4548bd,_0x146f15){return new BPromise(function(_0x44d8d7,_0x392197){return client[_0xefea('0x8')](_0x5d4f60,_0x146f15)[_0xefea('0x9')](function(_0x2a9d3f){logger[_0xefea('0xa')](_0xefea('0xb'),_0x4548bd,_0xefea('0xc'));logger[_0xefea('0xd')](_0xefea('0xe'),_0x4548bd,_0xefea('0xc'),JSON[_0xefea('0xf')](_0x2a9d3f));if(_0x2a9d3f[_0xefea('0x10')]){if(_0x2a9d3f['error'][_0xefea('0x11')]===0x1f4){logger[_0xefea('0x10')](_0xefea('0xb'),_0x4548bd,_0x2a9d3f[_0xefea('0x10')][_0xefea('0x12')]);return _0x392197(_0x2a9d3f['error'][_0xefea('0x12')]);}logger[_0xefea('0x10')](_0xefea('0xb'),_0x4548bd,_0x2a9d3f[_0xefea('0x10')]['message']);return _0x44d8d7(_0x2a9d3f['error'][_0xefea('0x12')]);}else{logger[_0xefea('0xa')](_0xefea('0xb'),_0x4548bd,_0xefea('0xc'));_0x44d8d7(_0x2a9d3f[_0xefea('0x13')][_0xefea('0x12')]);}})[_0xefea('0x14')](function(_0x3bebbe){logger[_0xefea('0x10')]('MailServerOut,\x20%s,\x20%s',_0x4548bd,_0x3bebbe);_0x392197(_0x3bebbe);});});} \ No newline at end of file +var _0xa6a7=['MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5e4af3,_0x56f1de){var _0xb5db04=function(_0x5aa2a0){while(--_0x5aa2a0){_0x5e4af3['push'](_0x5e4af3['shift']());}};_0xb5db04(++_0x56f1de);}(_0xa6a7,0xd8));var _0x7a6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa6a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a6a('0x0'));var util=require(_0x7a6a('0x1'));var moment=require('moment');var BPromise=require(_0x7a6a('0x2'));var rs=require(_0x7a6a('0x3'));var fs=require('fs');var Redis=require(_0x7a6a('0x4'));var db=require(_0x7a6a('0x5'))['db'];var utils=require(_0x7a6a('0x6'));var logger=require(_0x7a6a('0x7'))(_0x7a6a('0x8'));var config=require(_0x7a6a('0x9'));var jayson=require(_0x7a6a('0xa'));var client=jayson[_0x7a6a('0xb')][_0x7a6a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38129a,_0x551675,_0x55aee0){return new BPromise(function(_0x28adc8,_0x49587e){return client['request'](_0x38129a,_0x55aee0)[_0x7a6a('0xd')](function(_0x5185e3){logger['info'](_0x7a6a('0xe'),_0x551675,'request\x20sent');logger[_0x7a6a('0xf')](_0x7a6a('0x10'),_0x551675,_0x7a6a('0x11'),JSON[_0x7a6a('0x12')](_0x5185e3));if(_0x5185e3[_0x7a6a('0x13')]){if(_0x5185e3[_0x7a6a('0x13')][_0x7a6a('0x14')]===0x1f4){logger[_0x7a6a('0x13')](_0x7a6a('0xe'),_0x551675,_0x5185e3['error'][_0x7a6a('0x15')]);return _0x49587e(_0x5185e3[_0x7a6a('0x13')][_0x7a6a('0x15')]);}logger[_0x7a6a('0x13')](_0x7a6a('0xe'),_0x551675,_0x5185e3[_0x7a6a('0x13')][_0x7a6a('0x15')]);return _0x28adc8(_0x5185e3['error'][_0x7a6a('0x15')]);}else{logger['info'](_0x7a6a('0xe'),_0x551675,'request\x20sent');_0x28adc8(_0x5185e3[_0x7a6a('0x16')][_0x7a6a('0x15')]);}})['catch'](function(_0x37e396){logger[_0x7a6a('0x13')](_0x7a6a('0xe'),_0x551675,_0x37e396);_0x49587e(_0x37e396);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index aca24d2..9b19835 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 _0xd54e=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update'];(function(_0x1951c4,_0x5a923c){var _0x657749=function(_0x53c29a){while(--_0x53c29a){_0x1951c4['push'](_0x1951c4['shift']());}};_0x657749(++_0x5a923c);}(_0xd54e,0x156));var _0xed54=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd54e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xed54('0x0'));var util=require(_0xed54('0x1'));var path=require('path');var timeout=require(_0xed54('0x2'));var express=require(_0xed54('0x3'));var router=express[_0xed54('0x4')]();var auth=require(_0xed54('0x5'));var interaction=require(_0xed54('0x6'));var config=require(_0xed54('0x7'));var controller=require(_0xed54('0x8'));router[_0xed54('0x9')]('/',auth[_0xed54('0xa')](),controller[_0xed54('0xb')]);router[_0xed54('0x9')](_0xed54('0xc'),auth[_0xed54('0xa')](),controller['describe']);router[_0xed54('0x9')](_0xed54('0xd'),auth['isAuthenticated'](),controller[_0xed54('0xe')]);router[_0xed54('0xf')]('/',auth[_0xed54('0xa')](),controller['create']);router[_0xed54('0x10')](_0xed54('0xd'),auth[_0xed54('0xa')](),controller[_0xed54('0x11')]);router['delete'](_0xed54('0xd'),auth['isAuthenticated'](),controller[_0xed54('0x12')]);module[_0xed54('0x13')]=router; \ No newline at end of file +var _0x50d4=['describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index'];(function(_0x515354,_0xf25d81){var _0x191dfb=function(_0x30e279){while(--_0x30e279){_0x515354['push'](_0x515354['shift']());}};_0x191dfb(++_0xf25d81);}(_0x50d4,0x14c));var _0x450d=function(_0xfd79a4,_0xe62fc){_0xfd79a4=_0xfd79a4-0x0;var _0x559103=_0x50d4[_0xfd79a4];return _0x559103;};'use strict';var multer=require(_0x450d('0x0'));var util=require(_0x450d('0x1'));var path=require('path');var timeout=require(_0x450d('0x2'));var express=require(_0x450d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x450d('0x4'));var config=require(_0x450d('0x5'));var controller=require(_0x450d('0x6'));router[_0x450d('0x7')]('/',auth[_0x450d('0x8')](),controller[_0x450d('0x9')]);router[_0x450d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x450d('0xa')]);router[_0x450d('0x7')]('/:id',auth[_0x450d('0x8')](),controller[_0x450d('0xb')]);router[_0x450d('0xc')]('/',auth[_0x450d('0x8')](),controller[_0x450d('0xd')]);router[_0x450d('0xe')](_0x450d('0xf'),auth[_0x450d('0x8')](),controller['update']);router[_0x450d('0x10')](_0x450d('0xf'),auth[_0x450d('0x8')](),controller[_0x450d('0x11')]);module[_0x450d('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index e8cc3c3..0f2d98e 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 _0x2d95=['sequelize','STRING'];(function(_0x3eae0e,_0x1b88ea){var _0x134b62=function(_0x2eb6d7){while(--_0x2eb6d7){_0x3eae0e['push'](_0x3eae0e['shift']());}};_0x134b62(++_0x1b88ea);}(_0x2d95,0xca));var _0x52d9=function(_0x3e2a57,_0x471e99){_0x3e2a57=_0x3e2a57-0x0;var _0x2fcf1e=_0x2d95[_0x3e2a57];return _0x2fcf1e;};'use strict';var Sequelize=require(_0x52d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x52d9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x52d9('0x1')]}}; \ No newline at end of file +var _0x2542=['name','sequelize','exports','STRING'];(function(_0x3edd22,_0x47f56c){var _0x4506d5=function(_0x144507){while(--_0x144507){_0x3edd22['push'](_0x3edd22['shift']());}};_0x4506d5(++_0x47f56c);}(_0x2542,0x169));var _0x2254=function(_0x3f99e8,_0x6c1be8){_0x3f99e8=_0x3f99e8-0x0;var _0x318e70=_0x2542[_0x3f99e8];return _0x318e70;};'use strict';var Sequelize=require(_0x2254('0x0'));module[_0x2254('0x1')]={'name':{'type':Sequelize[_0x2254('0x2')],'unique':_0x2254('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 4cc7b2c..b21efed 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 _0xf62b=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','then','includeAll','findAll','catch','show','rawAttributes','filtears','intersection','include','find','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash'];(function(_0x514e37,_0x147ad3){var _0x261871=function(_0x363456){while(--_0x363456){_0x514e37['push'](_0x514e37['shift']());}};_0x261871(++_0x147ad3);}(_0xf62b,0x91));var _0xbf62=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0xf62b[_0x4f0c2b];return _0x526436;};'use strict';var pdf=require(_0xbf62('0x0'));var emlformat=require(_0xbf62('0x1'));var rimraf=require(_0xbf62('0x2'));var zipdir=require(_0xbf62('0x3'));var jsonpatch=require(_0xbf62('0x4'));var rp=require(_0xbf62('0x5'));var moment=require(_0xbf62('0x6'));var BPromise=require(_0xbf62('0x7'));var Mustache=require(_0xbf62('0x8'));var util=require(_0xbf62('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xbf62('0xa'));var ejs=require(_0xbf62('0xb'));var fs=require('fs');var _=require(_0xbf62('0xc'));var squel=require(_0xbf62('0xd'));var crypto=require(_0xbf62('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xbf62('0xf'));var toCsv=require(_0xbf62('0xa'));var querystring=require(_0xbf62('0x10'));var Papa=require(_0xbf62('0x11'));var Redis=require(_0xbf62('0x12'));var authService=require(_0xbf62('0x13'));var qs=require(_0xbf62('0x14'));var as=require(_0xbf62('0x15'));var hardwareService=require(_0xbf62('0x16'));var logger=require(_0xbf62('0x17'))(_0xbf62('0x18'));var utils=require(_0xbf62('0x19'));var config=require(_0xbf62('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf62('0x1b'))['db'];function respondWithStatusCode(_0x2f9692,_0x20f4dc){_0x20f4dc=_0x20f4dc||0xcc;return function(_0x5d4d20){if(_0x5d4d20){return _0x2f9692[_0xbf62('0x1c')](_0x20f4dc);}return _0x2f9692['status'](_0x20f4dc)['end']();};}function respondWithResult(_0x59e9f2,_0x4a4a7b){_0x4a4a7b=_0x4a4a7b||0xc8;return function(_0x23fc95){if(_0x23fc95){return _0x59e9f2[_0xbf62('0x1d')](_0x4a4a7b)[_0xbf62('0x1e')](_0x23fc95);}};}function respondWithFilteredResult(_0x4f3b68,_0x1cb0e7){return function(_0x53d56e){if(_0x53d56e){var _0x5f5aeb=_0x53d56e['count'],_0x112afe=_0x1cb0e7[_0xbf62('0x1f')],_0x57b1fc=_0x1cb0e7[_0xbf62('0x1f')]+_0x1cb0e7['limit'],_0x3860ca;if(_0x57b1fc>=_0x5f5aeb){_0x57b1fc=_0x5f5aeb;_0x3860ca=0xc8;}else{_0x3860ca=0xce;}_0x4f3b68[_0xbf62('0x1d')](_0x3860ca);return _0x4f3b68[_0xbf62('0x20')](_0xbf62('0x21'),_0x112afe+'-'+_0x57b1fc+'/'+_0x5f5aeb)[_0xbf62('0x1e')](_0x53d56e);}return null;};}function patchUpdates(_0x3ea41b){return function(_0xa7d098){try{jsonpatch[_0xbf62('0x22')](_0xa7d098,_0x3ea41b,!![]);}catch(_0x3d492f){return BPromise[_0xbf62('0x23')](_0x3d492f);}return _0xa7d098['save']();};}function saveUpdates(_0x3dd7aa,_0x1dcc79){return function(_0xea98bc){if(_0xea98bc){return _0xea98bc['update'](_0x3dd7aa)['then'](function(_0x27e02b){return _0x27e02b;});}return null;};}function removeEntity(_0x390c91,_0xd8354f){return function(_0x5dddce){if(_0x5dddce){return _0x5dddce[_0xbf62('0x24')]()['then'](function(){_0x390c91[_0xbf62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b574,_0xa36e84){return function(_0x1cecfe){if(!_0x1cecfe){_0x24b574['sendStatus'](0x194);}return _0x1cecfe;};}function handleError(_0x55c43d,_0x167f5a){_0x167f5a=_0x167f5a||0x1f4;return function(_0x3d96ad){logger[_0xbf62('0x25')](_0x3d96ad[_0xbf62('0x26')]);if(_0x3d96ad[_0xbf62('0x27')]){delete _0x3d96ad[_0xbf62('0x27')];}_0x55c43d[_0xbf62('0x1d')](_0x167f5a)[_0xbf62('0x28')](_0x3d96ad);};}exports[_0xbf62('0x29')]=function(_0x415128,_0x196c81){var _0x5378dc={},_0x12ee63={},_0x1f8f08={'count':0x0,'rows':[]};var _0xe39786=_[_0xbf62('0x2a')](db[_0xbf62('0x2b')]['rawAttributes'],function(_0x795653){return{'name':_0x795653[_0xbf62('0x2c')],'type':_0x795653[_0xbf62('0x2d')][_0xbf62('0x2e')]};});_0x12ee63[_0xbf62('0x2f')]=_[_0xbf62('0x2a')](_0xe39786,_0xbf62('0x27'));_0x12ee63[_0xbf62('0x30')]=_[_0xbf62('0x31')](_0x415128[_0xbf62('0x30')]);_0x12ee63[_0xbf62('0x32')]=_['intersection'](_0x12ee63['model'],_0x12ee63[_0xbf62('0x30')]);_0x5378dc[_0xbf62('0x33')]=_['intersection'](_0x12ee63[_0xbf62('0x2f')],qs[_0xbf62('0x34')](_0x415128[_0xbf62('0x30')][_0xbf62('0x34')]));_0x5378dc[_0xbf62('0x33')]=_0x5378dc[_0xbf62('0x33')][_0xbf62('0x35')]?_0x5378dc[_0xbf62('0x33')]:_0x12ee63[_0xbf62('0x2f')];if(!_0x415128[_0xbf62('0x30')][_0xbf62('0x36')](_0xbf62('0x37'))){_0x5378dc['limit']=qs[_0xbf62('0x38')](_0x415128[_0xbf62('0x30')]['limit']);_0x5378dc['offset']=qs['offset'](_0x415128[_0xbf62('0x30')][_0xbf62('0x1f')]);}_0x5378dc[_0xbf62('0x39')]=qs[_0xbf62('0x3a')](_0x415128[_0xbf62('0x30')]['sort']);_0x5378dc[_0xbf62('0x3b')]=qs[_0xbf62('0x32')](_[_0xbf62('0x3c')](_0x415128['query'],_0x12ee63[_0xbf62('0x32')]),_0xe39786);if(_0x415128[_0xbf62('0x30')][_0xbf62('0x3d')]){_0x5378dc[_0xbf62('0x3b')]=_[_0xbf62('0x3e')](_0x5378dc[_0xbf62('0x3b')],{'$or':_[_0xbf62('0x2a')](_0xe39786,function(_0x1d3cf4){if(_0x1d3cf4['type']!=='VIRTUAL'){var _0x1c0f48={};_0x1c0f48[_0x1d3cf4[_0xbf62('0x27')]]={'$like':'%'+_0x415128['query'][_0xbf62('0x3d')]+'%'};return _0x1c0f48;}})});}_0x5378dc=_[_0xbf62('0x3e')]({},_0x5378dc,_0x415128[_0xbf62('0x3f')]);var _0x4b4076={'where':_0x5378dc[_0xbf62('0x3b')]};return db['MailSubstatus'][_0xbf62('0x40')](_0x4b4076)[_0xbf62('0x41')](function(_0xc201b){_0x1f8f08[_0xbf62('0x40')]=_0xc201b;if(_0x415128['query'][_0xbf62('0x42')]){_0x5378dc['include']=[{'all':!![]}];}return db[_0xbf62('0x2b')][_0xbf62('0x43')](_0x5378dc);})[_0xbf62('0x41')](function(_0x3de57d){_0x1f8f08['rows']=_0x3de57d;return _0x1f8f08;})['then'](respondWithFilteredResult(_0x196c81,_0x5378dc))[_0xbf62('0x44')](handleError(_0x196c81,null));};exports[_0xbf62('0x45')]=function(_0x32bd6d,_0x447fb4){var _0x4275af={'raw':!![],'where':{'id':_0x32bd6d['params']['id']}},_0x172559={};_0x172559['model']=_[_0xbf62('0x31')](db[_0xbf62('0x2b')][_0xbf62('0x46')]);_0x172559[_0xbf62('0x30')]=_[_0xbf62('0x31')](_0x32bd6d['query']);_0x172559[_0xbf62('0x47')]=_[_0xbf62('0x48')](_0x172559['model'],_0x172559[_0xbf62('0x30')]);_0x4275af[_0xbf62('0x33')]=_['intersection'](_0x172559[_0xbf62('0x2f')],qs['fields'](_0x32bd6d[_0xbf62('0x30')][_0xbf62('0x34')]));_0x4275af['attributes']=_0x4275af[_0xbf62('0x33')][_0xbf62('0x35')]?_0x4275af[_0xbf62('0x33')]:_0x172559[_0xbf62('0x2f')];if(_0x32bd6d[_0xbf62('0x30')][_0xbf62('0x42')]){_0x4275af[_0xbf62('0x49')]=[{'all':!![]}];}_0x4275af=_[_0xbf62('0x3e')]({},_0x4275af,_0x32bd6d[_0xbf62('0x3f')]);return db[_0xbf62('0x2b')][_0xbf62('0x4a')](_0x4275af)[_0xbf62('0x41')](handleEntityNotFound(_0x447fb4,null))[_0xbf62('0x41')](respondWithResult(_0x447fb4,null))[_0xbf62('0x44')](handleError(_0x447fb4,null));};exports[_0xbf62('0x4b')]=function(_0x21075b,_0x5c6c1b){return db[_0xbf62('0x2b')][_0xbf62('0x4b')](_0x21075b['body'],{})[_0xbf62('0x41')](respondWithResult(_0x5c6c1b,0xc9))['catch'](handleError(_0x5c6c1b,null));};exports[_0xbf62('0x4c')]=function(_0x5c2f11,_0x35f936){if(_0x5c2f11[_0xbf62('0x4d')]['id']){delete _0x5c2f11['body']['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x5c2f11['params']['id']}})[_0xbf62('0x41')](handleEntityNotFound(_0x35f936,null))['then'](saveUpdates(_0x5c2f11[_0xbf62('0x4d')],null))[_0xbf62('0x41')](respondWithResult(_0x35f936,null))['catch'](handleError(_0x35f936,null));};exports[_0xbf62('0x24')]=function(_0x11dcb0,_0x2b31f1){return db[_0xbf62('0x2b')][_0xbf62('0x4a')]({'where':{'id':_0x11dcb0['params']['id']}})[_0xbf62('0x41')](handleEntityNotFound(_0x2b31f1,null))[_0xbf62('0x41')](removeEntity(_0x2b31f1,null))['catch'](handleError(_0x2b31f1,null));};exports[_0xbf62('0x4e')]=function(_0x595b52,_0x2c8190){return db[_0xbf62('0x2b')][_0xbf62('0x4e')]()[_0xbf62('0x41')](respondWithResult(_0x2c8190,null))[_0xbf62('0x44')](handleError(_0x2c8190,null));}; \ No newline at end of file +var _0xcfd9=['status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','rows','catch','params','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1058ed,_0x109d8d){var _0x4e4661=function(_0x2fc1df){while(--_0x2fc1df){_0x1058ed['push'](_0x1058ed['shift']());}};_0x4e4661(++_0x109d8d);}(_0xcfd9,0x73));var _0x9cfd=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0xcfd9[_0x275f4a];return _0x4b4a21;};'use strict';var pdf=require(_0x9cfd('0x0'));var emlformat=require(_0x9cfd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9cfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9cfd('0x3'));var moment=require(_0x9cfd('0x4'));var BPromise=require(_0x9cfd('0x5'));var Mustache=require(_0x9cfd('0x6'));var util=require(_0x9cfd('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9cfd('0x8'));var ejs=require(_0x9cfd('0x9'));var fs=require('fs');var _=require(_0x9cfd('0xa'));var squel=require(_0x9cfd('0xb'));var crypto=require(_0x9cfd('0xc'));var jsforce=require(_0x9cfd('0xd'));var deskjs=require(_0x9cfd('0xe'));var toCsv=require(_0x9cfd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9cfd('0xf'));var authService=require(_0x9cfd('0x10'));var qs=require(_0x9cfd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9cfd('0x12'));var logger=require(_0x9cfd('0x13'))(_0x9cfd('0x14'));var utils=require(_0x9cfd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9cfd('0x16'));var db=require(_0x9cfd('0x17'))['db'];function respondWithStatusCode(_0x22ed22,_0x1a7600){_0x1a7600=_0x1a7600||0xcc;return function(_0x444135){if(_0x444135){return _0x22ed22[_0x9cfd('0x18')](_0x1a7600);}return _0x22ed22[_0x9cfd('0x19')](_0x1a7600)[_0x9cfd('0x1a')]();};}function respondWithResult(_0x4fb67c,_0x54e7c2){_0x54e7c2=_0x54e7c2||0xc8;return function(_0x226a45){if(_0x226a45){return _0x4fb67c[_0x9cfd('0x19')](_0x54e7c2)[_0x9cfd('0x1b')](_0x226a45);}};}function respondWithFilteredResult(_0x7569f5,_0x1305f1){return function(_0x3e9a2d){if(_0x3e9a2d){var _0x4fe0f4=_0x3e9a2d[_0x9cfd('0x1c')],_0x10fcd2=_0x1305f1['offset'],_0x376282=_0x1305f1[_0x9cfd('0x1d')]+_0x1305f1[_0x9cfd('0x1e')],_0x1bced2;if(_0x376282>=_0x4fe0f4){_0x376282=_0x4fe0f4;_0x1bced2=0xc8;}else{_0x1bced2=0xce;}_0x7569f5['status'](_0x1bced2);return _0x7569f5['set'](_0x9cfd('0x1f'),_0x10fcd2+'-'+_0x376282+'/'+_0x4fe0f4)['json'](_0x3e9a2d);}return null;};}function patchUpdates(_0x51f171){return function(_0x43a314){try{jsonpatch[_0x9cfd('0x20')](_0x43a314,_0x51f171,!![]);}catch(_0x2c7e92){return BPromise[_0x9cfd('0x21')](_0x2c7e92);}return _0x43a314[_0x9cfd('0x22')]();};}function saveUpdates(_0x7a8694,_0x3c5853){return function(_0x15b774){if(_0x15b774){return _0x15b774[_0x9cfd('0x23')](_0x7a8694)[_0x9cfd('0x24')](function(_0x4c27bd){return _0x4c27bd;});}return null;};}function removeEntity(_0x337eba,_0x470fe1){return function(_0x1cf084){if(_0x1cf084){return _0x1cf084[_0x9cfd('0x25')]()[_0x9cfd('0x24')](function(){_0x337eba[_0x9cfd('0x19')](0xcc)[_0x9cfd('0x1a')]();});}};}function handleEntityNotFound(_0x16c9b5,_0x1ab2e8){return function(_0x3b6c75){if(!_0x3b6c75){_0x16c9b5[_0x9cfd('0x18')](0x194);}return _0x3b6c75;};}function handleError(_0x1201d1,_0x1254c0){_0x1254c0=_0x1254c0||0x1f4;return function(_0xba123d){logger[_0x9cfd('0x26')](_0xba123d[_0x9cfd('0x27')]);if(_0xba123d['name']){delete _0xba123d[_0x9cfd('0x28')];}_0x1201d1[_0x9cfd('0x19')](_0x1254c0)['send'](_0xba123d);};}exports[_0x9cfd('0x29')]=function(_0x4b11dd,_0x21f444){var _0x10001={},_0xffabd5={},_0x687090={'count':0x0,'rows':[]};var _0x35ed2f=_[_0x9cfd('0x2a')](db[_0x9cfd('0x2b')][_0x9cfd('0x2c')],function(_0x58c486){return{'name':_0x58c486[_0x9cfd('0x2d')],'type':_0x58c486[_0x9cfd('0x2e')]['key']};});_0xffabd5[_0x9cfd('0x2f')]=_[_0x9cfd('0x2a')](_0x35ed2f,_0x9cfd('0x28'));_0xffabd5['query']=_[_0x9cfd('0x30')](_0x4b11dd[_0x9cfd('0x31')]);_0xffabd5[_0x9cfd('0x32')]=_['intersection'](_0xffabd5['model'],_0xffabd5[_0x9cfd('0x31')]);_0x10001[_0x9cfd('0x33')]=_[_0x9cfd('0x34')](_0xffabd5[_0x9cfd('0x2f')],qs[_0x9cfd('0x35')](_0x4b11dd[_0x9cfd('0x31')]['fields']));_0x10001[_0x9cfd('0x33')]=_0x10001[_0x9cfd('0x33')][_0x9cfd('0x36')]?_0x10001['attributes']:_0xffabd5[_0x9cfd('0x2f')];if(!_0x4b11dd['query'][_0x9cfd('0x37')](_0x9cfd('0x38'))){_0x10001[_0x9cfd('0x1e')]=qs['limit'](_0x4b11dd[_0x9cfd('0x31')]['limit']);_0x10001[_0x9cfd('0x1d')]=qs[_0x9cfd('0x1d')](_0x4b11dd[_0x9cfd('0x31')][_0x9cfd('0x1d')]);}_0x10001['order']=qs[_0x9cfd('0x39')](_0x4b11dd[_0x9cfd('0x31')][_0x9cfd('0x39')]);_0x10001['where']=qs[_0x9cfd('0x32')](_['pick'](_0x4b11dd[_0x9cfd('0x31')],_0xffabd5[_0x9cfd('0x32')]),_0x35ed2f);if(_0x4b11dd[_0x9cfd('0x31')][_0x9cfd('0x3a')]){_0x10001['where']=_[_0x9cfd('0x3b')](_0x10001[_0x9cfd('0x3c')],{'$or':_[_0x9cfd('0x2a')](_0x35ed2f,function(_0x536394){if(_0x536394[_0x9cfd('0x2e')]!=='VIRTUAL'){var _0x155cdc={};_0x155cdc[_0x536394['name']]={'$like':'%'+_0x4b11dd['query'][_0x9cfd('0x3a')]+'%'};return _0x155cdc;}})});}_0x10001=_[_0x9cfd('0x3b')]({},_0x10001,_0x4b11dd[_0x9cfd('0x3d')]);var _0x22d221={'where':_0x10001[_0x9cfd('0x3c')]};return db['MailSubstatus'][_0x9cfd('0x1c')](_0x22d221)[_0x9cfd('0x24')](function(_0x461f5c){_0x687090['count']=_0x461f5c;if(_0x4b11dd[_0x9cfd('0x31')][_0x9cfd('0x3e')]){_0x10001[_0x9cfd('0x3f')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x10001);})['then'](function(_0x5edc52){_0x687090[_0x9cfd('0x40')]=_0x5edc52;return _0x687090;})['then'](respondWithFilteredResult(_0x21f444,_0x10001))[_0x9cfd('0x41')](handleError(_0x21f444,null));};exports['show']=function(_0xc63062,_0x168c12){var _0x4518fb={'raw':!![],'where':{'id':_0xc63062[_0x9cfd('0x42')]['id']}},_0x1139ce={};_0x1139ce[_0x9cfd('0x2f')]=_[_0x9cfd('0x30')](db[_0x9cfd('0x2b')]['rawAttributes']);_0x1139ce[_0x9cfd('0x31')]=_[_0x9cfd('0x30')](_0xc63062[_0x9cfd('0x31')]);_0x1139ce['filtears']=_['intersection'](_0x1139ce[_0x9cfd('0x2f')],_0x1139ce[_0x9cfd('0x31')]);_0x4518fb['attributes']=_[_0x9cfd('0x34')](_0x1139ce[_0x9cfd('0x2f')],qs[_0x9cfd('0x35')](_0xc63062['query']['fields']));_0x4518fb[_0x9cfd('0x33')]=_0x4518fb['attributes'][_0x9cfd('0x36')]?_0x4518fb[_0x9cfd('0x33')]:_0x1139ce[_0x9cfd('0x2f')];if(_0xc63062[_0x9cfd('0x31')][_0x9cfd('0x3e')]){_0x4518fb['include']=[{'all':!![]}];}_0x4518fb=_[_0x9cfd('0x3b')]({},_0x4518fb,_0xc63062[_0x9cfd('0x3d')]);return db[_0x9cfd('0x2b')]['find'](_0x4518fb)[_0x9cfd('0x24')](handleEntityNotFound(_0x168c12,null))[_0x9cfd('0x24')](respondWithResult(_0x168c12,null))[_0x9cfd('0x41')](handleError(_0x168c12,null));};exports['create']=function(_0x2d698e,_0x2bf9aa){return db['MailSubstatus'][_0x9cfd('0x43')](_0x2d698e[_0x9cfd('0x44')],{})[_0x9cfd('0x24')](respondWithResult(_0x2bf9aa,0xc9))['catch'](handleError(_0x2bf9aa,null));};exports[_0x9cfd('0x23')]=function(_0x2171eb,_0x4456d1){if(_0x2171eb[_0x9cfd('0x44')]['id']){delete _0x2171eb[_0x9cfd('0x44')]['id'];}return db[_0x9cfd('0x2b')]['find']({'where':{'id':_0x2171eb['params']['id']}})[_0x9cfd('0x24')](handleEntityNotFound(_0x4456d1,null))[_0x9cfd('0x24')](saveUpdates(_0x2171eb[_0x9cfd('0x44')],null))['then'](respondWithResult(_0x4456d1,null))[_0x9cfd('0x41')](handleError(_0x4456d1,null));};exports[_0x9cfd('0x25')]=function(_0x5df3a1,_0xbc58e){return db[_0x9cfd('0x2b')]['find']({'where':{'id':_0x5df3a1[_0x9cfd('0x42')]['id']}})[_0x9cfd('0x24')](handleEntityNotFound(_0xbc58e,null))['then'](removeEntity(_0xbc58e,null))[_0x9cfd('0x41')](handleError(_0xbc58e,null));};exports[_0x9cfd('0x45')]=function(_0x59bd1b,_0x2eb41d){return db[_0x9cfd('0x2b')][_0x9cfd('0x45')]()[_0x9cfd('0x24')](respondWithResult(_0x2eb41d,null))['catch'](handleError(_0x2eb41d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 77da89e..6022643 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 _0x6739=['MailSubstatus','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./mailSubstatus.attributes','define'];(function(_0x189b87,_0x2325db){var _0x4386e6=function(_0x158381){while(--_0x158381){_0x189b87['push'](_0x189b87['shift']());}};_0x4386e6(++_0x2325db);}(_0x6739,0xd3));var _0x9673=function(_0x2d43be,_0x47c093){_0x2d43be=_0x2d43be-0x0;var _0x4ed02a=_0x6739[_0x2d43be];return _0x4ed02a;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var logger=require(_0x9673('0x2'))(_0x9673('0x3'));var moment=require(_0x9673('0x4'));var BPromise=require(_0x9673('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9673('0x6'));var config=require('../../config/environment');var attributes=require(_0x9673('0x7'));module['exports']=function(_0x57a9d5,_0x27f94b){return _0x57a9d5[_0x9673('0x8')](_0x9673('0x9'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf66=['exports','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0xa28fc6,_0x3c16d3){var _0x35a154=function(_0x210fc0){while(--_0x210fc0){_0xa28fc6['push'](_0xa28fc6['shift']());}};_0x35a154(++_0x3c16d3);}(_0xcf66,0x71));var _0x6cf6=function(_0x5eeaf3,_0x200202){_0x5eeaf3=_0x5eeaf3-0x0;var _0x2ed072=_0xcf66[_0x5eeaf3];return _0x2ed072;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./mailSubstatus.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4d762b8..b5fb7ab 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 _0x70e0=['code','MailSubstatus,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19c3e3,_0x50c17a){var _0x3f2050=function(_0x4c9e3a){while(--_0x4c9e3a){_0x19c3e3['push'](_0x19c3e3['shift']());}};_0x3f2050(++_0x50c17a);}(_0x70e0,0x17b));var _0x070e=function(_0x3fc112,_0x238114){_0x3fc112=_0x3fc112-0x0;var _0x1a44a5=_0x70e0[_0x3fc112];return _0x1a44a5;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x3137ea,_0x4b6bce){var _0x4e3050=function(_0x388838){while(--_0x388838){_0x3137ea['push'](_0x3137ea['shift']());}};_0x4e3050(++_0x4b6bce);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3f362d,_0x4ac087){_0x3f362d=_0x3f362d-0x0;var _0x50d934=_0xa8a8[_0x3f362d];return _0x50d934;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 523a5d9..e0ce545 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 _0x7462=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x7462,0x16a));var _0x2746=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x7462[_0x1b4002];return _0x1716f3;};'use strict';var multer=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var path=require(_0x2746('0x2'));var timeout=require(_0x2746('0x3'));var express=require(_0x2746('0x4'));var router=express[_0x2746('0x5')]();var auth=require(_0x2746('0x6'));var interaction=require(_0x2746('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x2746('0x8')](),controller[_0x2746('0x9')]);router[_0x2746('0xa')](_0x2746('0xb'),auth[_0x2746('0x8')](),controller[_0x2746('0xc')]);router[_0x2746('0xa')](_0x2746('0xd'),auth[_0x2746('0x8')](),controller[_0x2746('0xe')]);router[_0x2746('0xf')]('/',auth['isAuthenticated'](),controller[_0x2746('0x10')]);router['put'](_0x2746('0xd'),auth[_0x2746('0x8')](),controller[_0x2746('0x11')]);router[_0x2746('0x12')]('/:id',auth[_0x2746('0x8')](),controller[_0x2746('0x13')]);module[_0x2746('0x14')]=router; \ No newline at end of file +var _0x4bb7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x4bb7,0x1f4));var _0x74bb=function(_0x251fe4,_0x2bf391){_0x251fe4=_0x251fe4-0x0;var _0x2d3ca4=_0x4bb7[_0x251fe4];return _0x2d3ca4;};'use strict';var multer=require('multer');var util=require(_0x74bb('0x0'));var path=require(_0x74bb('0x1'));var timeout=require(_0x74bb('0x2'));var express=require(_0x74bb('0x3'));var router=express[_0x74bb('0x4')]();var auth=require(_0x74bb('0x5'));var interaction=require(_0x74bb('0x6'));var config=require('../../config/environment');var controller=require(_0x74bb('0x7'));router[_0x74bb('0x8')]('/',auth[_0x74bb('0x9')](),controller[_0x74bb('0xa')]);router['get'](_0x74bb('0xb'),auth[_0x74bb('0x9')](),controller[_0x74bb('0xc')]);router[_0x74bb('0x8')]('/:id',auth[_0x74bb('0x9')](),controller[_0x74bb('0xd')]);router[_0x74bb('0xe')]('/',auth[_0x74bb('0x9')](),controller['create']);router[_0x74bb('0xf')](_0x74bb('0x10'),auth[_0x74bb('0x9')](),controller[_0x74bb('0x11')]);router[_0x74bb('0x12')](_0x74bb('0x10'),auth[_0x74bb('0x9')](),controller[_0x74bb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 87121ed..e27e769 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 _0x8615=['sequelize','ENUM','account','queue','DATE','NOW'];(function(_0x2327d0,_0x12cdc6){var _0x9248db=function(_0x3edb6c){while(--_0x3edb6c){_0x2327d0['push'](_0x2327d0['shift']());}};_0x9248db(++_0x12cdc6);}(_0x8615,0xfc));var _0x5861=function(_0x2dca8c,_0x5583f5){_0x2dca8c=_0x2dca8c-0x0;var _0x1db10c=_0x8615[_0x2dca8c];return _0x1db10c;};'use strict';var moment=require('moment');var Sequelize=require(_0x5861('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5861('0x1')](_0x5861('0x2'),'agent',_0x5861('0x3')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x5861('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x5861('0x5')]}}; \ No newline at end of file +var _0xc17a=['sequelize','exports','STRING','ENUM','queue','DATE','NOW'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xc17a,0x1e3));var _0xac17=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xc17a[_0x819464];return _0x49dcc0;};'use strict';var moment=require('moment');var Sequelize=require(_0xac17('0x0'));module[_0xac17('0x1')]={'uniqueid':{'type':Sequelize[_0xac17('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xac17('0x3')]('account','agent',_0xac17('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xac17('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xac17('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index d85b815..8665aa3 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 _0x351f=['limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','filtears','include','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','index','map','MailTransferReport','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3e10aa,_0x3e2a71){var _0x74b955=function(_0x3cf8bb){while(--_0x3cf8bb){_0x3e10aa['push'](_0x3e10aa['shift']());}};_0x74b955(++_0x3e2a71);}(_0x351f,0xfc));var _0xf351=function(_0x41eb79,_0xbadfc5){_0x41eb79=_0x41eb79-0x0;var _0x5cc473=_0x351f[_0x41eb79];return _0x5cc473;};'use strict';var pdf=require(_0xf351('0x0'));var emlformat=require(_0xf351('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf351('0x2'));var jsonpatch=require(_0xf351('0x3'));var rp=require('request-promise');var moment=require(_0xf351('0x4'));var BPromise=require(_0xf351('0x5'));var Mustache=require(_0xf351('0x6'));var util=require(_0xf351('0x7'));var path=require('path');var sox=require(_0xf351('0x8'));var csv=require(_0xf351('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf351('0xa'));var squel=require(_0xf351('0xb'));var crypto=require(_0xf351('0xc'));var jsforce=require(_0xf351('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf351('0x9'));var querystring=require(_0xf351('0xe'));var Papa=require(_0xf351('0xf'));var Redis=require(_0xf351('0x10'));var authService=require(_0xf351('0x11'));var qs=require(_0xf351('0x12'));var as=require(_0xf351('0x13'));var hardwareService=require(_0xf351('0x14'));var logger=require('../../config/logger')(_0xf351('0x15'));var utils=require(_0xf351('0x16'));var config=require(_0xf351('0x17'));var licenseUtil=require(_0xf351('0x18'));var db=require(_0xf351('0x19'))['db'];function respondWithStatusCode(_0x1e3777,_0x593c36){_0x593c36=_0x593c36||0xcc;return function(_0x277450){if(_0x277450){return _0x1e3777['sendStatus'](_0x593c36);}return _0x1e3777[_0xf351('0x1a')](_0x593c36)['end']();};}function respondWithResult(_0x252e6f,_0x29b457){_0x29b457=_0x29b457||0xc8;return function(_0x313f31){if(_0x313f31){return _0x252e6f[_0xf351('0x1a')](_0x29b457)[_0xf351('0x1b')](_0x313f31);}};}function respondWithFilteredResult(_0x30abbc,_0xb6d2ce){return function(_0x562736){if(_0x562736){var _0x88d889=_0x562736[_0xf351('0x1c')],_0x7322e0=_0xb6d2ce[_0xf351('0x1d')],_0x431cc7=_0xb6d2ce['offset']+_0xb6d2ce['limit'],_0x434b6f;if(_0x431cc7>=_0x88d889){_0x431cc7=_0x88d889;_0x434b6f=0xc8;}else{_0x434b6f=0xce;}_0x30abbc[_0xf351('0x1a')](_0x434b6f);return _0x30abbc[_0xf351('0x1e')](_0xf351('0x1f'),_0x7322e0+'-'+_0x431cc7+'/'+_0x88d889)[_0xf351('0x1b')](_0x562736);}return null;};}function patchUpdates(_0x5ed2b3){return function(_0x1ce4df){try{jsonpatch[_0xf351('0x20')](_0x1ce4df,_0x5ed2b3,!![]);}catch(_0x2d3030){return BPromise[_0xf351('0x21')](_0x2d3030);}return _0x1ce4df[_0xf351('0x22')]();};}function saveUpdates(_0x125c4b,_0x1e2c21){return function(_0x3fbd19){if(_0x3fbd19){return _0x3fbd19['update'](_0x125c4b)['then'](function(_0x286f1d){return _0x286f1d;});}return null;};}function removeEntity(_0x2e7cc8,_0x29c5cc){return function(_0x407c1a){if(_0x407c1a){return _0x407c1a[_0xf351('0x23')]()[_0xf351('0x24')](function(){_0x2e7cc8[_0xf351('0x1a')](0xcc)[_0xf351('0x25')]();});}};}function handleEntityNotFound(_0x546749,_0x14ead9){return function(_0x5a8536){if(!_0x5a8536){_0x546749[_0xf351('0x26')](0x194);}return _0x5a8536;};}function handleError(_0x4418c9,_0x18469f){_0x18469f=_0x18469f||0x1f4;return function(_0xa2d986){logger[_0xf351('0x27')](_0xa2d986[_0xf351('0x28')]);if(_0xa2d986[_0xf351('0x29')]){delete _0xa2d986[_0xf351('0x29')];}_0x4418c9[_0xf351('0x1a')](_0x18469f)['send'](_0xa2d986);};}exports[_0xf351('0x2a')]=function(_0x363eef,_0x126996){var _0x593ddb={},_0x4edefd={},_0x6d06b0={'count':0x0,'rows':[]};var _0x1b8f96=_[_0xf351('0x2b')](db[_0xf351('0x2c')]['rawAttributes'],function(_0x4642c6){return{'name':_0x4642c6[_0xf351('0x2d')],'type':_0x4642c6['type']['key']};});_0x4edefd[_0xf351('0x2e')]=_[_0xf351('0x2b')](_0x1b8f96,_0xf351('0x29'));_0x4edefd['query']=_[_0xf351('0x2f')](_0x363eef[_0xf351('0x30')]);_0x4edefd[_0xf351('0x31')]=_['intersection'](_0x4edefd[_0xf351('0x2e')],_0x4edefd['query']);_0x593ddb['attributes']=_[_0xf351('0x32')](_0x4edefd[_0xf351('0x2e')],qs[_0xf351('0x33')](_0x363eef[_0xf351('0x30')][_0xf351('0x33')]));_0x593ddb[_0xf351('0x34')]=_0x593ddb[_0xf351('0x34')][_0xf351('0x35')]?_0x593ddb[_0xf351('0x34')]:_0x4edefd['model'];if(!_0x363eef[_0xf351('0x30')][_0xf351('0x36')](_0xf351('0x37'))){_0x593ddb[_0xf351('0x38')]=qs['limit'](_0x363eef['query']['limit']);_0x593ddb['offset']=qs[_0xf351('0x1d')](_0x363eef[_0xf351('0x30')]['offset']);}_0x593ddb['order']=qs[_0xf351('0x39')](_0x363eef[_0xf351('0x30')][_0xf351('0x39')]);_0x593ddb[_0xf351('0x3a')]=qs[_0xf351('0x31')](_[_0xf351('0x3b')](_0x363eef['query'],_0x4edefd[_0xf351('0x31')]),_0x1b8f96);if(_0x363eef['query'][_0xf351('0x3c')]){_0x593ddb[_0xf351('0x3a')]=_[_0xf351('0x3d')](_0x593ddb['where'],{'$or':_[_0xf351('0x2b')](_0x1b8f96,function(_0x20e4e3){if(_0x20e4e3[_0xf351('0x3e')]!==_0xf351('0x3f')){var _0x5b996f={};_0x5b996f[_0x20e4e3[_0xf351('0x29')]]={'$like':'%'+_0x363eef[_0xf351('0x30')][_0xf351('0x3c')]+'%'};return _0x5b996f;}})});}_0x593ddb=_[_0xf351('0x3d')]({},_0x593ddb,_0x363eef[_0xf351('0x40')]);var _0x25845d={'where':_0x593ddb[_0xf351('0x3a')]};return db[_0xf351('0x2c')][_0xf351('0x1c')](_0x25845d)[_0xf351('0x24')](function(_0x2cff4d){_0x6d06b0[_0xf351('0x1c')]=_0x2cff4d;if(_0x363eef[_0xf351('0x30')][_0xf351('0x41')]){_0x593ddb['include']=[{'all':!![]}];}return db[_0xf351('0x2c')][_0xf351('0x42')](_0x593ddb);})[_0xf351('0x24')](function(_0x152826){_0x6d06b0[_0xf351('0x43')]=_0x152826;return _0x6d06b0;})[_0xf351('0x24')](respondWithFilteredResult(_0x126996,_0x593ddb))[_0xf351('0x44')](handleError(_0x126996,null));};exports['show']=function(_0x49d7a0,_0x159b92){var _0x115b4c={'raw':!![],'where':{'id':_0x49d7a0[_0xf351('0x45')]['id']}},_0x3058dd={};_0x3058dd[_0xf351('0x2e')]=_[_0xf351('0x2f')](db['MailTransferReport'][_0xf351('0x46')]);_0x3058dd[_0xf351('0x30')]=_['keys'](_0x49d7a0[_0xf351('0x30')]);_0x3058dd[_0xf351('0x47')]=_[_0xf351('0x32')](_0x3058dd[_0xf351('0x2e')],_0x3058dd['query']);_0x115b4c[_0xf351('0x34')]=_[_0xf351('0x32')](_0x3058dd['model'],qs[_0xf351('0x33')](_0x49d7a0[_0xf351('0x30')][_0xf351('0x33')]));_0x115b4c[_0xf351('0x34')]=_0x115b4c[_0xf351('0x34')][_0xf351('0x35')]?_0x115b4c[_0xf351('0x34')]:_0x3058dd[_0xf351('0x2e')];if(_0x49d7a0[_0xf351('0x30')]['includeAll']){_0x115b4c[_0xf351('0x48')]=[{'all':!![]}];}_0x115b4c=_[_0xf351('0x3d')]({},_0x115b4c,_0x49d7a0['options']);return db[_0xf351('0x2c')]['find'](_0x115b4c)[_0xf351('0x24')](handleEntityNotFound(_0x159b92,null))['then'](respondWithResult(_0x159b92,null))[_0xf351('0x44')](handleError(_0x159b92,null));};exports[_0xf351('0x49')]=function(_0x16c2f8,_0x176dc9){return db[_0xf351('0x2c')]['create'](_0x16c2f8[_0xf351('0x4a')],{})[_0xf351('0x24')](respondWithResult(_0x176dc9,0xc9))[_0xf351('0x44')](handleError(_0x176dc9,null));};exports['update']=function(_0xa2b0f9,_0x4b440f){if(_0xa2b0f9[_0xf351('0x4a')]['id']){delete _0xa2b0f9['body']['id'];}return db[_0xf351('0x2c')][_0xf351('0x4b')]({'where':{'id':_0xa2b0f9[_0xf351('0x45')]['id']}})[_0xf351('0x24')](handleEntityNotFound(_0x4b440f,null))[_0xf351('0x24')](saveUpdates(_0xa2b0f9[_0xf351('0x4a')],null))[_0xf351('0x24')](respondWithResult(_0x4b440f,null))['catch'](handleError(_0x4b440f,null));};exports[_0xf351('0x23')]=function(_0x566052,_0x1faa16){return db[_0xf351('0x2c')]['find']({'where':{'id':_0x566052[_0xf351('0x45')]['id']}})[_0xf351('0x24')](handleEntityNotFound(_0x1faa16,null))[_0xf351('0x24')](removeEntity(_0x1faa16,null))[_0xf351('0x44')](handleError(_0x1faa16,null));};exports['describe']=function(_0x4658c5,_0x166831){return db[_0xf351('0x2c')][_0xf351('0x4c')]()['then'](respondWithResult(_0x166831,null))[_0xf351('0x44')](handleError(_0x166831,null));}; \ No newline at end of file +var _0x1cb4=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel'];(function(_0x4f638f,_0x5ae725){var _0x1b3164=function(_0x5ed7ed){while(--_0x5ed7ed){_0x4f638f['push'](_0x4f638f['shift']());}};_0x1b3164(++_0x5ae725);}(_0x1cb4,0x15c));var _0x41cb=function(_0x491efe,_0x34db81){_0x491efe=_0x491efe-0x0;var _0xe09f4c=_0x1cb4[_0x491efe];return _0xe09f4c;};'use strict';var pdf=require(_0x41cb('0x0'));var emlformat=require(_0x41cb('0x1'));var rimraf=require(_0x41cb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41cb('0x3'));var rp=require(_0x41cb('0x4'));var moment=require(_0x41cb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41cb('0x6'));var util=require('util');var path=require('path');var sox=require(_0x41cb('0x7'));var csv=require(_0x41cb('0x8'));var ejs=require(_0x41cb('0x9'));var fs=require('fs');var _=require(_0x41cb('0xa'));var squel=require(_0x41cb('0xb'));var crypto=require('crypto');var jsforce=require(_0x41cb('0xc'));var deskjs=require(_0x41cb('0xd'));var toCsv=require(_0x41cb('0x8'));var querystring=require('querystring');var Papa=require(_0x41cb('0xe'));var Redis=require('ioredis');var authService=require(_0x41cb('0xf'));var qs=require(_0x41cb('0x10'));var as=require(_0x41cb('0x11'));var hardwareService=require(_0x41cb('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x41cb('0x13'));var config=require(_0x41cb('0x14'));var licenseUtil=require(_0x41cb('0x15'));var db=require(_0x41cb('0x16'))['db'];function respondWithStatusCode(_0x36d3ac,_0x376b40){_0x376b40=_0x376b40||0xcc;return function(_0x2e4516){if(_0x2e4516){return _0x36d3ac[_0x41cb('0x17')](_0x376b40);}return _0x36d3ac[_0x41cb('0x18')](_0x376b40)[_0x41cb('0x19')]();};}function respondWithResult(_0x79f6cd,_0x482452){_0x482452=_0x482452||0xc8;return function(_0x31f04c){if(_0x31f04c){return _0x79f6cd[_0x41cb('0x18')](_0x482452)[_0x41cb('0x1a')](_0x31f04c);}};}function respondWithFilteredResult(_0x36361c,_0x1794d8){return function(_0x45be0f){if(_0x45be0f){var _0x19cefa=_0x45be0f[_0x41cb('0x1b')],_0x417728=_0x1794d8[_0x41cb('0x1c')],_0x5c68a5=_0x1794d8[_0x41cb('0x1c')]+_0x1794d8['limit'],_0x34b66c;if(_0x5c68a5>=_0x19cefa){_0x5c68a5=_0x19cefa;_0x34b66c=0xc8;}else{_0x34b66c=0xce;}_0x36361c[_0x41cb('0x18')](_0x34b66c);return _0x36361c[_0x41cb('0x1d')]('Content-Range',_0x417728+'-'+_0x5c68a5+'/'+_0x19cefa)[_0x41cb('0x1a')](_0x45be0f);}return null;};}function patchUpdates(_0x53c3bc){return function(_0x13ebdb){try{jsonpatch[_0x41cb('0x1e')](_0x13ebdb,_0x53c3bc,!![]);}catch(_0xcdc8e2){return BPromise[_0x41cb('0x1f')](_0xcdc8e2);}return _0x13ebdb[_0x41cb('0x20')]();};}function saveUpdates(_0x4d3da2,_0x58909c){return function(_0x5d8029){if(_0x5d8029){return _0x5d8029[_0x41cb('0x21')](_0x4d3da2)[_0x41cb('0x22')](function(_0x4f027a){return _0x4f027a;});}return null;};}function removeEntity(_0x48b3bf,_0x5908bb){return function(_0x27ab88){if(_0x27ab88){return _0x27ab88[_0x41cb('0x23')]()[_0x41cb('0x22')](function(){_0x48b3bf[_0x41cb('0x18')](0xcc)[_0x41cb('0x19')]();});}};}function handleEntityNotFound(_0x1ed00f,_0x214258){return function(_0x459503){if(!_0x459503){_0x1ed00f[_0x41cb('0x17')](0x194);}return _0x459503;};}function handleError(_0x34fe82,_0x32c12e){_0x32c12e=_0x32c12e||0x1f4;return function(_0x36229f){logger['error'](_0x36229f[_0x41cb('0x24')]);if(_0x36229f[_0x41cb('0x25')]){delete _0x36229f['name'];}_0x34fe82['status'](_0x32c12e)[_0x41cb('0x26')](_0x36229f);};}exports[_0x41cb('0x27')]=function(_0x3f32ac,_0x18f43b){var _0x353f05={},_0x22e8f2={},_0x1e2e26={'count':0x0,'rows':[]};var _0x4c6193=_[_0x41cb('0x28')](db[_0x41cb('0x29')][_0x41cb('0x2a')],function(_0x3ec1cb){return{'name':_0x3ec1cb[_0x41cb('0x2b')],'type':_0x3ec1cb[_0x41cb('0x2c')]['key']};});_0x22e8f2[_0x41cb('0x2d')]=_['map'](_0x4c6193,_0x41cb('0x25'));_0x22e8f2['query']=_['keys'](_0x3f32ac[_0x41cb('0x2e')]);_0x22e8f2['filters']=_[_0x41cb('0x2f')](_0x22e8f2[_0x41cb('0x2d')],_0x22e8f2['query']);_0x353f05[_0x41cb('0x30')]=_['intersection'](_0x22e8f2[_0x41cb('0x2d')],qs[_0x41cb('0x31')](_0x3f32ac[_0x41cb('0x2e')][_0x41cb('0x31')]));_0x353f05[_0x41cb('0x30')]=_0x353f05[_0x41cb('0x30')][_0x41cb('0x32')]?_0x353f05[_0x41cb('0x30')]:_0x22e8f2[_0x41cb('0x2d')];if(!_0x3f32ac['query']['hasOwnProperty'](_0x41cb('0x33'))){_0x353f05[_0x41cb('0x34')]=qs[_0x41cb('0x34')](_0x3f32ac[_0x41cb('0x2e')][_0x41cb('0x34')]);_0x353f05[_0x41cb('0x1c')]=qs[_0x41cb('0x1c')](_0x3f32ac[_0x41cb('0x2e')]['offset']);}_0x353f05['order']=qs['sort'](_0x3f32ac['query'][_0x41cb('0x35')]);_0x353f05['where']=qs[_0x41cb('0x36')](_[_0x41cb('0x37')](_0x3f32ac[_0x41cb('0x2e')],_0x22e8f2['filters']),_0x4c6193);if(_0x3f32ac[_0x41cb('0x2e')][_0x41cb('0x38')]){_0x353f05[_0x41cb('0x39')]=_[_0x41cb('0x3a')](_0x353f05[_0x41cb('0x39')],{'$or':_[_0x41cb('0x28')](_0x4c6193,function(_0x35089f){if(_0x35089f[_0x41cb('0x2c')]!=='VIRTUAL'){var _0x2206fb={};_0x2206fb[_0x35089f[_0x41cb('0x25')]]={'$like':'%'+_0x3f32ac[_0x41cb('0x2e')][_0x41cb('0x38')]+'%'};return _0x2206fb;}})});}_0x353f05=_[_0x41cb('0x3a')]({},_0x353f05,_0x3f32ac[_0x41cb('0x3b')]);var _0x4d0f56={'where':_0x353f05[_0x41cb('0x39')]};return db['MailTransferReport']['count'](_0x4d0f56)[_0x41cb('0x22')](function(_0x5d8165){_0x1e2e26[_0x41cb('0x1b')]=_0x5d8165;if(_0x3f32ac['query'][_0x41cb('0x3c')]){_0x353f05[_0x41cb('0x3d')]=[{'all':!![]}];}return db[_0x41cb('0x29')][_0x41cb('0x3e')](_0x353f05);})['then'](function(_0x412641){_0x1e2e26[_0x41cb('0x3f')]=_0x412641;return _0x1e2e26;})['then'](respondWithFilteredResult(_0x18f43b,_0x353f05))[_0x41cb('0x40')](handleError(_0x18f43b,null));};exports[_0x41cb('0x41')]=function(_0x14e5be,_0x4b52b0){var _0xfdbd40={'raw':!![],'where':{'id':_0x14e5be[_0x41cb('0x42')]['id']}},_0x57fa2f={};_0x57fa2f[_0x41cb('0x2d')]=_['keys'](db[_0x41cb('0x29')][_0x41cb('0x2a')]);_0x57fa2f['query']=_['keys'](_0x14e5be[_0x41cb('0x2e')]);_0x57fa2f[_0x41cb('0x43')]=_[_0x41cb('0x2f')](_0x57fa2f['model'],_0x57fa2f[_0x41cb('0x2e')]);_0xfdbd40[_0x41cb('0x30')]=_[_0x41cb('0x2f')](_0x57fa2f[_0x41cb('0x2d')],qs[_0x41cb('0x31')](_0x14e5be[_0x41cb('0x2e')][_0x41cb('0x31')]));_0xfdbd40[_0x41cb('0x30')]=_0xfdbd40[_0x41cb('0x30')][_0x41cb('0x32')]?_0xfdbd40[_0x41cb('0x30')]:_0x57fa2f[_0x41cb('0x2d')];if(_0x14e5be['query']['includeAll']){_0xfdbd40[_0x41cb('0x3d')]=[{'all':!![]}];}_0xfdbd40=_[_0x41cb('0x3a')]({},_0xfdbd40,_0x14e5be[_0x41cb('0x3b')]);return db['MailTransferReport'][_0x41cb('0x44')](_0xfdbd40)['then'](handleEntityNotFound(_0x4b52b0,null))[_0x41cb('0x22')](respondWithResult(_0x4b52b0,null))[_0x41cb('0x40')](handleError(_0x4b52b0,null));};exports[_0x41cb('0x45')]=function(_0x1c0244,_0x47ac06){return db[_0x41cb('0x29')][_0x41cb('0x45')](_0x1c0244['body'],{})['then'](respondWithResult(_0x47ac06,0xc9))[_0x41cb('0x40')](handleError(_0x47ac06,null));};exports[_0x41cb('0x21')]=function(_0x3c0f79,_0x1cbd77){if(_0x3c0f79[_0x41cb('0x46')]['id']){delete _0x3c0f79[_0x41cb('0x46')]['id'];}return db[_0x41cb('0x29')][_0x41cb('0x44')]({'where':{'id':_0x3c0f79[_0x41cb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1cbd77,null))[_0x41cb('0x22')](saveUpdates(_0x3c0f79[_0x41cb('0x46')],null))[_0x41cb('0x22')](respondWithResult(_0x1cbd77,null))['catch'](handleError(_0x1cbd77,null));};exports[_0x41cb('0x23')]=function(_0xdb6b2a,_0x1f04b7){return db[_0x41cb('0x29')][_0x41cb('0x44')]({'where':{'id':_0xdb6b2a[_0x41cb('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f04b7,null))[_0x41cb('0x22')](removeEntity(_0x1f04b7,null))[_0x41cb('0x40')](handleError(_0x1f04b7,null));};exports[_0x41cb('0x47')]=function(_0x37ac9b,_0x520d81){return db[_0x41cb('0x29')]['describe']()[_0x41cb('0x22')](respondWithResult(_0x520d81,null))[_0x41cb('0x40')](handleError(_0x520d81,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index d7590b4..851a733 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 _0x1138=['../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x257d74,_0x4228fa){var _0x1663c5=function(_0x417cad){while(--_0x417cad){_0x257d74['push'](_0x257d74['shift']());}};_0x1663c5(++_0x4228fa);}(_0x1138,0x17e));var _0x8113=function(_0x26a82d,_0x1366be){_0x26a82d=_0x26a82d-0x0;var _0x34b41f=_0x1138[_0x26a82d];return _0x34b41f;};'use strict';var _=require(_0x8113('0x0'));var util=require(_0x8113('0x1'));var logger=require(_0x8113('0x2'))(_0x8113('0x3'));var moment=require('moment');var BPromise=require(_0x8113('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8113('0x5'));var attributes=require('./mailTransferReport.attributes');module[_0x8113('0x6')]=function(_0x3c0746,_0xd255a8){return _0x3c0746[_0x8113('0x7')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x8113('0x8'),'fields':[_0x8113('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8411=['api','bluebird','path','../../config/environment','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0x18a06d,_0x1fa7df){var _0x207efe=function(_0x2cc487){while(--_0x2cc487){_0x18a06d['push'](_0x18a06d['shift']());}};_0x207efe(++_0x1fa7df);}(_0x8411,0x185));var _0x1841=function(_0x2a52ea,_0x422a0e){_0x2a52ea=_0x2a52ea-0x0;var _0x310786=_0x8411[_0x2a52ea];return _0x310786;};'use strict';var _=require('lodash');var util=require(_0x1841('0x0'));var logger=require('../../config/logger')(_0x1841('0x1'));var moment=require('moment');var BPromise=require(_0x1841('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1841('0x3'));var rimraf=require('rimraf');var config=require(_0x1841('0x4'));var attributes=require('./mailTransferReport.attributes');module[_0x1841('0x5')]=function(_0xdf1862,_0x5145bf){return _0xdf1862[_0x1841('0x6')](_0x1841('0x7'),attributes,{'tableName':_0x1841('0x8'),'paranoid':![],'indexes':[{'name':_0x1841('0x9'),'fields':[_0x1841('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index dc34d2a..f624599 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 _0xf6f4=['../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring','ioredis'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0xf6f4,0x88));var _0x4f6f=function(_0x299d2d,_0xa729c6){_0x299d2d=_0x299d2d-0x0;var _0x48ad88=_0xf6f4[_0x299d2d];return _0x48ad88;};'use strict';var _=require(_0x4f6f('0x0'));var util=require(_0x4f6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f6f('0x2'));var fs=require('fs');var Redis=require(_0x4f6f('0x3'));var db=require(_0x4f6f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f6f('0x5'));var config=require(_0x4f6f('0x6'));var jayson=require(_0x4f6f('0x7'));var client=jayson['client'][_0x4f6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1043e4,_0x46bf26,_0x4de183){return new BPromise(function(_0x47e108,_0x5809e1){return client[_0x4f6f('0x9')](_0x1043e4,_0x4de183)[_0x4f6f('0xa')](function(_0x5adb90){logger[_0x4f6f('0xb')](_0x4f6f('0xc'),_0x46bf26,_0x4f6f('0xd'));logger[_0x4f6f('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x46bf26,_0x4f6f('0xd'),JSON[_0x4f6f('0xf')](_0x5adb90));if(_0x5adb90['error']){if(_0x5adb90[_0x4f6f('0x10')][_0x4f6f('0x11')]===0x1f4){logger[_0x4f6f('0x10')](_0x4f6f('0xc'),_0x46bf26,_0x5adb90[_0x4f6f('0x10')][_0x4f6f('0x12')]);return _0x5809e1(_0x5adb90['error'][_0x4f6f('0x12')]);}logger[_0x4f6f('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x46bf26,_0x5adb90[_0x4f6f('0x10')][_0x4f6f('0x12')]);return _0x47e108(_0x5adb90['error'][_0x4f6f('0x12')]);}else{logger['info'](_0x4f6f('0xc'),_0x46bf26,_0x4f6f('0xd'));_0x47e108(_0x5adb90['result'][_0x4f6f('0x12')]);}})[_0x4f6f('0x13')](function(_0x1e7b40){logger[_0x4f6f('0x10')](_0x4f6f('0xc'),_0x46bf26,_0x1e7b40);_0x5809e1(_0x1e7b40);});});} \ No newline at end of file +var _0x2621=['../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x2621,0x1ed));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1262('0x0'));var util=require('util');var moment=require(_0x1262('0x1'));var BPromise=require(_0x1262('0x2'));var rs=require(_0x1262('0x3'));var fs=require('fs');var Redis=require(_0x1262('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1262('0x5'))(_0x1262('0x6'));var config=require(_0x1262('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1262('0x8')][_0x1262('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40a011,_0x18e831,_0x2aca9e){return new BPromise(function(_0x10059d,_0x23d198){return client[_0x1262('0xa')](_0x40a011,_0x2aca9e)[_0x1262('0xb')](function(_0x1a27db){logger[_0x1262('0xc')](_0x1262('0xd'),_0x18e831,'request\x20sent');logger['debug'](_0x1262('0xe'),_0x18e831,_0x1262('0xf'),JSON[_0x1262('0x10')](_0x1a27db));if(_0x1a27db[_0x1262('0x11')]){if(_0x1a27db[_0x1262('0x11')][_0x1262('0x12')]===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x18e831,_0x1a27db[_0x1262('0x11')]['message']);return _0x23d198(_0x1a27db[_0x1262('0x11')][_0x1262('0x13')]);}logger[_0x1262('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x18e831,_0x1a27db[_0x1262('0x11')][_0x1262('0x13')]);return _0x10059d(_0x1a27db['error']['message']);}else{logger[_0x1262('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x18e831,'request\x20sent');_0x10059d(_0x1a27db['result'][_0x1262('0x13')]);}})['catch'](function(_0x27a943){logger[_0x1262('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x18e831,_0x27a943);_0x23d198(_0x27a943);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index f61fa48..00bc3a3 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 _0x04a6=['./memberReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','Router','../../components/auth/service','../../config/environment'];(function(_0x20936e,_0x4d5283){var _0x50a212=function(_0x467a9a){while(--_0x467a9a){_0x20936e['push'](_0x20936e['shift']());}};_0x50a212(++_0x4d5283);}(_0x04a6,0x1a4));var _0x604a=function(_0x5ebb90,_0x389514){_0x5ebb90=_0x5ebb90-0x0;var _0x596d84=_0x04a6[_0x5ebb90];return _0x596d84;};'use strict';var multer=require(_0x604a('0x0'));var util=require(_0x604a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x604a('0x2')]();var auth=require(_0x604a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x604a('0x4'));var controller=require(_0x604a('0x5'));router['get']('/',auth[_0x604a('0x6')](),controller['index']);router[_0x604a('0x7')](_0x604a('0x8'),auth[_0x604a('0x6')](),controller[_0x604a('0x9')]);router[_0x604a('0x7')](_0x604a('0xa'),auth[_0x604a('0x6')](),controller[_0x604a('0xb')]);router[_0x604a('0xc')]('/',auth[_0x604a('0x6')](),controller[_0x604a('0xd')]);router[_0x604a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x604a('0xf')]);router['delete']('/:id',auth[_0x604a('0x6')](),controller[_0x604a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x792d=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./memberReport.controller'];(function(_0x4a1b5a,_0x400e27){var _0x1df893=function(_0x19a370){while(--_0x19a370){_0x4a1b5a['push'](_0x4a1b5a['shift']());}};_0x1df893(++_0x400e27);}(_0x792d,0x111));var _0xd792=function(_0x3cd293,_0x50aca1){_0x3cd293=_0x3cd293-0x0;var _0x5d8feb=_0x792d[_0x3cd293];return _0x5d8feb;};'use strict';var multer=require(_0xd792('0x0'));var util=require(_0xd792('0x1'));var path=require(_0xd792('0x2'));var timeout=require(_0xd792('0x3'));var express=require(_0xd792('0x4'));var router=express[_0xd792('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd792('0x6'));router['get']('/',auth[_0xd792('0x7')](),controller[_0xd792('0x8')]);router[_0xd792('0x9')](_0xd792('0xa'),auth[_0xd792('0x7')](),controller[_0xd792('0xb')]);router[_0xd792('0x9')](_0xd792('0xc'),auth[_0xd792('0x7')](),controller[_0xd792('0xd')]);router[_0xd792('0xe')]('/',auth[_0xd792('0x7')](),controller[_0xd792('0xf')]);router[_0xd792('0x10')](_0xd792('0xc'),auth[_0xd792('0x7')](),controller['update']);router[_0xd792('0x11')](_0xd792('0xc'),auth[_0xd792('0x7')](),controller[_0xd792('0x12')]);module[_0xd792('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 4167c74..7914386 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 _0x4ba9=['seconds','setDataValue','exitAt','talk:[start]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x3bc396,_0x5bf311){var _0x249c7a=function(_0x197587){while(--_0x197587){_0x3bc396['push'](_0x3bc396['shift']());}};_0x249c7a(++_0x5bf311);}(_0x4ba9,0x160));var _0x94ba=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0x4ba9[_0x1b8f5a];return _0x594189;};'use strict';var Sequelize=require(_0x94ba('0x0'));var moment=require(_0x94ba('0x1'));module[_0x94ba('0x2')]={'channel':{'type':Sequelize[_0x94ba('0x3')]},'membername':{'type':Sequelize[_0x94ba('0x3')]},'interface':{'type':Sequelize[_0x94ba('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x94ba('0x4'),'comment':_0x94ba('0x5')},'duration':{'type':Sequelize[_0x94ba('0x6')]},'enterAt':{'type':Sequelize[_0x94ba('0x7')]},'exitAt':{'type':Sequelize[_0x94ba('0x7')],'set':function(_0x1c7960){var _0x34a748=moment(_0x1c7960);var _0x2c3692=moment(this['getDataValue']('enterAt'));var _0x4ddc9d=_0x34a748['diff'](_0x2c3692,_0x94ba('0x8'));this[_0x94ba('0x9')](_0x94ba('0xa'),_0x1c7960);this[_0x94ba('0x9')]('duration',_0x4ddc9d||null);}},'data1':{'type':Sequelize[_0x94ba('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x94ba('0xb')},'data3':{'type':Sequelize[_0x94ba('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x94ba('0x6')]},'uniqueid':{'type':Sequelize[_0x94ba('0x3')]}}; \ No newline at end of file +var _0x9ca1=['talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x254284,_0x6594a7){var _0x5a94e1=function(_0x2ff26a){while(--_0x2ff26a){_0x254284['push'](_0x254284['shift']());}};_0x5a94e1(++_0x6594a7);}(_0x9ca1,0x1cc));var _0x19ca=function(_0x279760,_0x43f00b){_0x279760=_0x279760-0x0;var _0x5c99d5=_0x9ca1[_0x279760];return _0x5c99d5;};'use strict';var Sequelize=require(_0x19ca('0x0'));var moment=require(_0x19ca('0x1'));module[_0x19ca('0x2')]={'channel':{'type':Sequelize[_0x19ca('0x3')]},'membername':{'type':Sequelize[_0x19ca('0x3')]},'interface':{'type':Sequelize[_0x19ca('0x3')]},'type':{'type':Sequelize[_0x19ca('0x3')],'defaultValue':_0x19ca('0x4'),'comment':_0x19ca('0x5')},'duration':{'type':Sequelize[_0x19ca('0x6')]},'enterAt':{'type':Sequelize[_0x19ca('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x219ec1){var _0x19d8ef=moment(_0x219ec1);var _0x233730=moment(this['getDataValue'](_0x19ca('0x8')));var _0x18144a=_0x19d8ef['diff'](_0x233730,_0x19ca('0x9'));this[_0x19ca('0xa')]('exitAt',_0x219ec1);this[_0x19ca('0xa')](_0x19ca('0xb'),_0x18144a||null);}},'data1':{'type':Sequelize[_0x19ca('0x3')],'comment':_0x19ca('0xc')},'data2':{'type':Sequelize[_0x19ca('0x3')],'comment':_0x19ca('0xd')},'data3':{'type':Sequelize[_0x19ca('0x3')],'comment':_0x19ca('0xe')},'data4':{'type':Sequelize[_0x19ca('0x3')],'comment':_0x19ca('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0x19ca('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x19ca('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 7252f00..99c89f5 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 _0x1e03=['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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','MemberReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','show','params','rawAttributes','filtears','intersection','include','options','find','catch','create','body','describe','rimraf','zip-dir','moment','bluebird'];(function(_0x11e833,_0x2955ea){var _0x518478=function(_0x2e7719){while(--_0x2e7719){_0x11e833['push'](_0x11e833['shift']());}};_0x518478(++_0x2955ea);}(_0x1e03,0x134));var _0x31e0=function(_0x3c74a8,_0x66cc22){_0x3c74a8=_0x3c74a8-0x0;var _0x38ed7f=_0x1e03[_0x3c74a8];return _0x38ed7f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x31e0('0x0'));var zipdir=require(_0x31e0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x31e0('0x2'));var BPromise=require(_0x31e0('0x3'));var Mustache=require(_0x31e0('0x4'));var util=require(_0x31e0('0x5'));var path=require('path');var sox=require(_0x31e0('0x6'));var csv=require(_0x31e0('0x7'));var ejs=require(_0x31e0('0x8'));var fs=require('fs');var _=require(_0x31e0('0x9'));var squel=require(_0x31e0('0xa'));var crypto=require('crypto');var jsforce=require(_0x31e0('0xb'));var deskjs=require(_0x31e0('0xc'));var toCsv=require(_0x31e0('0x7'));var querystring=require(_0x31e0('0xd'));var Papa=require(_0x31e0('0xe'));var Redis=require(_0x31e0('0xf'));var authService=require(_0x31e0('0x10'));var qs=require(_0x31e0('0x11'));var as=require(_0x31e0('0x12'));var hardwareService=require(_0x31e0('0x13'));var logger=require(_0x31e0('0x14'))(_0x31e0('0x15'));var utils=require(_0x31e0('0x16'));var config=require(_0x31e0('0x17'));var licenseUtil=require(_0x31e0('0x18'));var db=require(_0x31e0('0x19'))['db'];function respondWithStatusCode(_0x55ec66,_0x4571db){_0x4571db=_0x4571db||0xcc;return function(_0x53541f){if(_0x53541f){return _0x55ec66[_0x31e0('0x1a')](_0x4571db);}return _0x55ec66['status'](_0x4571db)[_0x31e0('0x1b')]();};}function respondWithResult(_0x175b52,_0x8d7d36){_0x8d7d36=_0x8d7d36||0xc8;return function(_0x5bd393){if(_0x5bd393){return _0x175b52['status'](_0x8d7d36)[_0x31e0('0x1c')](_0x5bd393);}};}function respondWithFilteredResult(_0x4bc11a,_0x5f1ca3){return function(_0x19d582){if(_0x19d582){var _0x5323f4=_0x19d582[_0x31e0('0x1d')],_0x1c0e6a=_0x5f1ca3[_0x31e0('0x1e')],_0x4d4ce2=_0x5f1ca3['offset']+_0x5f1ca3['limit'],_0x1e37aa;if(_0x4d4ce2>=_0x5323f4){_0x4d4ce2=_0x5323f4;_0x1e37aa=0xc8;}else{_0x1e37aa=0xce;}_0x4bc11a[_0x31e0('0x1f')](_0x1e37aa);return _0x4bc11a[_0x31e0('0x20')](_0x31e0('0x21'),_0x1c0e6a+'-'+_0x4d4ce2+'/'+_0x5323f4)[_0x31e0('0x1c')](_0x19d582);}return null;};}function patchUpdates(_0xfd948){return function(_0x4bc51d){try{jsonpatch[_0x31e0('0x22')](_0x4bc51d,_0xfd948,!![]);}catch(_0x6237de){return BPromise[_0x31e0('0x23')](_0x6237de);}return _0x4bc51d[_0x31e0('0x24')]();};}function saveUpdates(_0xf244ac,_0x280422){return function(_0x51567b){if(_0x51567b){return _0x51567b[_0x31e0('0x25')](_0xf244ac)[_0x31e0('0x26')](function(_0x501663){return _0x501663;});}return null;};}function removeEntity(_0x3b5abb,_0x33320c){return function(_0x2213e3){if(_0x2213e3){return _0x2213e3[_0x31e0('0x27')]()[_0x31e0('0x26')](function(){_0x3b5abb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b619f,_0x48bcaf){return function(_0x256d1e){if(!_0x256d1e){_0x1b619f['sendStatus'](0x194);}return _0x256d1e;};}function handleError(_0x3c1e33,_0x11112f){_0x11112f=_0x11112f||0x1f4;return function(_0x32e218){logger['error'](_0x32e218[_0x31e0('0x28')]);if(_0x32e218[_0x31e0('0x29')]){delete _0x32e218[_0x31e0('0x29')];}_0x3c1e33[_0x31e0('0x1f')](_0x11112f)['send'](_0x32e218);};}exports[_0x31e0('0x2a')]=function(_0x18c256,_0x313134){var _0x39b31f={},_0x32ab75={},_0x3029db={'count':0x0,'rows':[]};var _0x53266d=_[_0x31e0('0x2b')](db[_0x31e0('0x2c')]['rawAttributes'],function(_0x44db31){return{'name':_0x44db31[_0x31e0('0x2d')],'type':_0x44db31[_0x31e0('0x2e')][_0x31e0('0x2f')]};});_0x32ab75[_0x31e0('0x30')]=_['map'](_0x53266d,_0x31e0('0x29'));_0x32ab75[_0x31e0('0x31')]=_[_0x31e0('0x32')](_0x18c256['query']);_0x32ab75[_0x31e0('0x33')]=_['intersection'](_0x32ab75[_0x31e0('0x30')],_0x32ab75['query']);_0x39b31f[_0x31e0('0x34')]=_['intersection'](_0x32ab75[_0x31e0('0x30')],qs[_0x31e0('0x35')](_0x18c256[_0x31e0('0x31')][_0x31e0('0x35')]));_0x39b31f[_0x31e0('0x34')]=_0x39b31f[_0x31e0('0x34')][_0x31e0('0x36')]?_0x39b31f[_0x31e0('0x34')]:_0x32ab75[_0x31e0('0x30')];if(!_0x18c256[_0x31e0('0x31')][_0x31e0('0x37')]('nolimit')){_0x39b31f[_0x31e0('0x38')]=qs[_0x31e0('0x38')](_0x18c256[_0x31e0('0x31')]['limit']);_0x39b31f[_0x31e0('0x1e')]=qs[_0x31e0('0x1e')](_0x18c256['query']['offset']);}_0x39b31f[_0x31e0('0x39')]=qs[_0x31e0('0x3a')](_0x18c256[_0x31e0('0x31')]['sort']);_0x39b31f[_0x31e0('0x3b')]=qs['filters'](_[_0x31e0('0x3c')](_0x18c256[_0x31e0('0x31')],_0x32ab75[_0x31e0('0x33')]),_0x53266d);if(_0x18c256['query']['filter']){_0x39b31f['where']=_['merge'](_0x39b31f['where'],{'$or':_['map'](_0x53266d,function(_0x47426d){if(_0x47426d[_0x31e0('0x2e')]!==_0x31e0('0x3d')){var _0x4a7360={};_0x4a7360[_0x47426d[_0x31e0('0x29')]]={'$like':'%'+_0x18c256['query'][_0x31e0('0x3e')]+'%'};return _0x4a7360;}})});}_0x39b31f=_[_0x31e0('0x3f')]({},_0x39b31f,_0x18c256['options']);var _0x230c82={'where':_0x39b31f[_0x31e0('0x3b')]};return db['MemberReport'][_0x31e0('0x1d')](_0x230c82)[_0x31e0('0x26')](function(_0x56f9e4){_0x3029db['count']=_0x56f9e4;if(_0x18c256[_0x31e0('0x31')][_0x31e0('0x40')]){_0x39b31f['include']=[{'all':!![]}];}return db[_0x31e0('0x2c')][_0x31e0('0x41')](_0x39b31f);})['then'](function(_0x3c5080){_0x3029db['rows']=_0x3c5080;return _0x3029db;})[_0x31e0('0x26')](respondWithFilteredResult(_0x313134,_0x39b31f))['catch'](handleError(_0x313134,null));};exports[_0x31e0('0x42')]=function(_0x414b7b,_0x2c58bd){var _0x2486e3={'raw':!![],'where':{'id':_0x414b7b[_0x31e0('0x43')]['id']}},_0x46c6f5={};_0x46c6f5[_0x31e0('0x30')]=_['keys'](db[_0x31e0('0x2c')][_0x31e0('0x44')]);_0x46c6f5[_0x31e0('0x31')]=_[_0x31e0('0x32')](_0x414b7b[_0x31e0('0x31')]);_0x46c6f5[_0x31e0('0x45')]=_['intersection'](_0x46c6f5['model'],_0x46c6f5[_0x31e0('0x31')]);_0x2486e3[_0x31e0('0x34')]=_[_0x31e0('0x46')](_0x46c6f5[_0x31e0('0x30')],qs[_0x31e0('0x35')](_0x414b7b[_0x31e0('0x31')][_0x31e0('0x35')]));_0x2486e3[_0x31e0('0x34')]=_0x2486e3[_0x31e0('0x34')]['length']?_0x2486e3['attributes']:_0x46c6f5['model'];if(_0x414b7b[_0x31e0('0x31')][_0x31e0('0x40')]){_0x2486e3[_0x31e0('0x47')]=[{'all':!![]}];}_0x2486e3=_[_0x31e0('0x3f')]({},_0x2486e3,_0x414b7b[_0x31e0('0x48')]);return db['MemberReport'][_0x31e0('0x49')](_0x2486e3)['then'](handleEntityNotFound(_0x2c58bd,null))[_0x31e0('0x26')](respondWithResult(_0x2c58bd,null))[_0x31e0('0x4a')](handleError(_0x2c58bd,null));};exports['create']=function(_0x519c5a,_0x298d99){return db[_0x31e0('0x2c')][_0x31e0('0x4b')](_0x519c5a[_0x31e0('0x4c')],{})[_0x31e0('0x26')](respondWithResult(_0x298d99,0xc9))[_0x31e0('0x4a')](handleError(_0x298d99,null));};exports[_0x31e0('0x25')]=function(_0x3083c4,_0x5dfaa5){if(_0x3083c4[_0x31e0('0x4c')]['id']){delete _0x3083c4[_0x31e0('0x4c')]['id'];}return db[_0x31e0('0x2c')][_0x31e0('0x49')]({'where':{'id':_0x3083c4[_0x31e0('0x43')]['id']}})['then'](handleEntityNotFound(_0x5dfaa5,null))[_0x31e0('0x26')](saveUpdates(_0x3083c4[_0x31e0('0x4c')],null))[_0x31e0('0x26')](respondWithResult(_0x5dfaa5,null))[_0x31e0('0x4a')](handleError(_0x5dfaa5,null));};exports[_0x31e0('0x27')]=function(_0x2c1955,_0x148da2){return db[_0x31e0('0x2c')][_0x31e0('0x49')]({'where':{'id':_0x2c1955[_0x31e0('0x43')]['id']}})['then'](handleEntityNotFound(_0x148da2,null))[_0x31e0('0x26')](removeEntity(_0x148da2,null))['catch'](handleError(_0x148da2,null));};exports[_0x31e0('0x4d')]=function(_0x1fdc60,_0x3ed4ec){return db['MemberReport'][_0x31e0('0x4d')]()[_0x31e0('0x26')](respondWithResult(_0x3ed4ec,null))[_0x31e0('0x4a')](handleError(_0x3ed4ec,null));}; \ No newline at end of file +var _0x9878=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','filtears','includeAll','find','create','body','describe','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0x9878,0xd6));var _0x8987=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9878[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x8987('0x0'));var emlformat=require(_0x8987('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8987('0x2'));var rp=require(_0x8987('0x3'));var moment=require('moment');var BPromise=require(_0x8987('0x4'));var Mustache=require(_0x8987('0x5'));var util=require(_0x8987('0x6'));var path=require(_0x8987('0x7'));var sox=require(_0x8987('0x8'));var csv=require(_0x8987('0x9'));var ejs=require(_0x8987('0xa'));var fs=require('fs');var _=require(_0x8987('0xb'));var squel=require(_0x8987('0xc'));var crypto=require('crypto');var jsforce=require(_0x8987('0xd'));var deskjs=require(_0x8987('0xe'));var toCsv=require(_0x8987('0x9'));var querystring=require(_0x8987('0xf'));var Papa=require(_0x8987('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8987('0x11'));var as=require(_0x8987('0x12'));var hardwareService=require(_0x8987('0x13'));var logger=require(_0x8987('0x14'))('api');var utils=require(_0x8987('0x15'));var config=require(_0x8987('0x16'));var licenseUtil=require(_0x8987('0x17'));var db=require(_0x8987('0x18'))['db'];function respondWithStatusCode(_0x134a9a,_0x4f6983){_0x4f6983=_0x4f6983||0xcc;return function(_0x30d638){if(_0x30d638){return _0x134a9a[_0x8987('0x19')](_0x4f6983);}return _0x134a9a['status'](_0x4f6983)[_0x8987('0x1a')]();};}function respondWithResult(_0x32ad14,_0x3888ff){_0x3888ff=_0x3888ff||0xc8;return function(_0x464deb){if(_0x464deb){return _0x32ad14[_0x8987('0x1b')](_0x3888ff)['json'](_0x464deb);}};}function respondWithFilteredResult(_0x1157aa,_0x210122){return function(_0x3848cc){if(_0x3848cc){var _0x43252f=_0x3848cc[_0x8987('0x1c')],_0x71850d=_0x210122[_0x8987('0x1d')],_0x2c5277=_0x210122[_0x8987('0x1d')]+_0x210122[_0x8987('0x1e')],_0x3c2665;if(_0x2c5277>=_0x43252f){_0x2c5277=_0x43252f;_0x3c2665=0xc8;}else{_0x3c2665=0xce;}_0x1157aa[_0x8987('0x1b')](_0x3c2665);return _0x1157aa[_0x8987('0x1f')](_0x8987('0x20'),_0x71850d+'-'+_0x2c5277+'/'+_0x43252f)[_0x8987('0x21')](_0x3848cc);}return null;};}function patchUpdates(_0x394ad){return function(_0x560ae4){try{jsonpatch['apply'](_0x560ae4,_0x394ad,!![]);}catch(_0x5ce22e){return BPromise['reject'](_0x5ce22e);}return _0x560ae4[_0x8987('0x22')]();};}function saveUpdates(_0x597ef8,_0xfa0e93){return function(_0x53380a){if(_0x53380a){return _0x53380a[_0x8987('0x23')](_0x597ef8)[_0x8987('0x24')](function(_0x544819){return _0x544819;});}return null;};}function removeEntity(_0x13db3e,_0x4af2f4){return function(_0x2786ea){if(_0x2786ea){return _0x2786ea[_0x8987('0x25')]()[_0x8987('0x24')](function(){_0x13db3e[_0x8987('0x1b')](0xcc)[_0x8987('0x1a')]();});}};}function handleEntityNotFound(_0x3050f9,_0x288a88){return function(_0x4f4b5a){if(!_0x4f4b5a){_0x3050f9[_0x8987('0x19')](0x194);}return _0x4f4b5a;};}function handleError(_0x31ed34,_0x353b3a){_0x353b3a=_0x353b3a||0x1f4;return function(_0x5654b0){logger[_0x8987('0x26')](_0x5654b0['stack']);if(_0x5654b0['name']){delete _0x5654b0[_0x8987('0x27')];}_0x31ed34[_0x8987('0x1b')](_0x353b3a)[_0x8987('0x28')](_0x5654b0);};}exports[_0x8987('0x29')]=function(_0x1fcf84,_0x400531){var _0x20ad96={},_0x47fbf0={},_0x5de598={'count':0x0,'rows':[]};var _0x121996=_[_0x8987('0x2a')](db[_0x8987('0x2b')][_0x8987('0x2c')],function(_0x1fa627){return{'name':_0x1fa627[_0x8987('0x2d')],'type':_0x1fa627[_0x8987('0x2e')][_0x8987('0x2f')]};});_0x47fbf0['model']=_[_0x8987('0x2a')](_0x121996,'name');_0x47fbf0[_0x8987('0x30')]=_[_0x8987('0x31')](_0x1fcf84[_0x8987('0x30')]);_0x47fbf0[_0x8987('0x32')]=_[_0x8987('0x33')](_0x47fbf0['model'],_0x47fbf0[_0x8987('0x30')]);_0x20ad96['attributes']=_[_0x8987('0x33')](_0x47fbf0[_0x8987('0x34')],qs[_0x8987('0x35')](_0x1fcf84['query'][_0x8987('0x35')]));_0x20ad96[_0x8987('0x36')]=_0x20ad96[_0x8987('0x36')][_0x8987('0x37')]?_0x20ad96[_0x8987('0x36')]:_0x47fbf0[_0x8987('0x34')];if(!_0x1fcf84['query'][_0x8987('0x38')](_0x8987('0x39'))){_0x20ad96[_0x8987('0x1e')]=qs[_0x8987('0x1e')](_0x1fcf84[_0x8987('0x30')][_0x8987('0x1e')]);_0x20ad96[_0x8987('0x1d')]=qs[_0x8987('0x1d')](_0x1fcf84[_0x8987('0x30')]['offset']);}_0x20ad96[_0x8987('0x3a')]=qs['sort'](_0x1fcf84[_0x8987('0x30')][_0x8987('0x3b')]);_0x20ad96[_0x8987('0x3c')]=qs[_0x8987('0x32')](_[_0x8987('0x3d')](_0x1fcf84[_0x8987('0x30')],_0x47fbf0['filters']),_0x121996);if(_0x1fcf84[_0x8987('0x30')]['filter']){_0x20ad96['where']=_[_0x8987('0x3e')](_0x20ad96[_0x8987('0x3c')],{'$or':_[_0x8987('0x2a')](_0x121996,function(_0x16f726){if(_0x16f726[_0x8987('0x2e')]!==_0x8987('0x3f')){var _0x55abbf={};_0x55abbf[_0x16f726[_0x8987('0x27')]]={'$like':'%'+_0x1fcf84[_0x8987('0x30')][_0x8987('0x40')]+'%'};return _0x55abbf;}})});}_0x20ad96=_[_0x8987('0x3e')]({},_0x20ad96,_0x1fcf84[_0x8987('0x41')]);var _0x36a62e={'where':_0x20ad96['where']};return db[_0x8987('0x2b')][_0x8987('0x1c')](_0x36a62e)[_0x8987('0x24')](function(_0x57abfb){_0x5de598[_0x8987('0x1c')]=_0x57abfb;if(_0x1fcf84[_0x8987('0x30')]['includeAll']){_0x20ad96[_0x8987('0x42')]=[{'all':!![]}];}return db[_0x8987('0x2b')][_0x8987('0x43')](_0x20ad96);})[_0x8987('0x24')](function(_0x416e13){_0x5de598[_0x8987('0x44')]=_0x416e13;return _0x5de598;})[_0x8987('0x24')](respondWithFilteredResult(_0x400531,_0x20ad96))[_0x8987('0x45')](handleError(_0x400531,null));};exports[_0x8987('0x46')]=function(_0x47336d,_0x4defab){var _0x281b52={'raw':!![],'where':{'id':_0x47336d[_0x8987('0x47')]['id']}},_0xce62d9={};_0xce62d9[_0x8987('0x34')]=_['keys'](db[_0x8987('0x2b')][_0x8987('0x2c')]);_0xce62d9[_0x8987('0x30')]=_[_0x8987('0x31')](_0x47336d['query']);_0xce62d9[_0x8987('0x48')]=_['intersection'](_0xce62d9[_0x8987('0x34')],_0xce62d9[_0x8987('0x30')]);_0x281b52[_0x8987('0x36')]=_[_0x8987('0x33')](_0xce62d9[_0x8987('0x34')],qs[_0x8987('0x35')](_0x47336d[_0x8987('0x30')][_0x8987('0x35')]));_0x281b52[_0x8987('0x36')]=_0x281b52[_0x8987('0x36')]['length']?_0x281b52['attributes']:_0xce62d9[_0x8987('0x34')];if(_0x47336d[_0x8987('0x30')][_0x8987('0x49')]){_0x281b52[_0x8987('0x42')]=[{'all':!![]}];}_0x281b52=_[_0x8987('0x3e')]({},_0x281b52,_0x47336d[_0x8987('0x41')]);return db[_0x8987('0x2b')][_0x8987('0x4a')](_0x281b52)[_0x8987('0x24')](handleEntityNotFound(_0x4defab,null))['then'](respondWithResult(_0x4defab,null))[_0x8987('0x45')](handleError(_0x4defab,null));};exports[_0x8987('0x4b')]=function(_0x5b2541,_0x25897e){return db[_0x8987('0x2b')][_0x8987('0x4b')](_0x5b2541[_0x8987('0x4c')],{})[_0x8987('0x24')](respondWithResult(_0x25897e,0xc9))['catch'](handleError(_0x25897e,null));};exports[_0x8987('0x23')]=function(_0x5c4e04,_0x266d42){if(_0x5c4e04[_0x8987('0x4c')]['id']){delete _0x5c4e04[_0x8987('0x4c')]['id'];}return db[_0x8987('0x2b')][_0x8987('0x4a')]({'where':{'id':_0x5c4e04[_0x8987('0x47')]['id']}})[_0x8987('0x24')](handleEntityNotFound(_0x266d42,null))[_0x8987('0x24')](saveUpdates(_0x5c4e04[_0x8987('0x4c')],null))['then'](respondWithResult(_0x266d42,null))[_0x8987('0x45')](handleError(_0x266d42,null));};exports[_0x8987('0x25')]=function(_0x4becbe,_0x459d84){return db[_0x8987('0x2b')][_0x8987('0x4a')]({'where':{'id':_0x4becbe[_0x8987('0x47')]['id']}})[_0x8987('0x24')](handleEntityNotFound(_0x459d84,null))[_0x8987('0x24')](removeEntity(_0x459d84,null))[_0x8987('0x45')](handleError(_0x459d84,null));};exports[_0x8987('0x4d')]=function(_0x4b1890,_0x5748ca){return db[_0x8987('0x2b')][_0x8987('0x4d')]()['then'](respondWithResult(_0x5748ca,null))[_0x8987('0x45')](handleError(_0x5748ca,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4257781..77e0747 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 _0x5cee=['moment','bluebird','request-promise','path','../../config/environment','exports','define','report_member','interface','lodash','../../config/logger','api'];(function(_0x2fd299,_0x34886b){var _0x2a5ab4=function(_0x5b20e4){while(--_0x5b20e4){_0x2fd299['push'](_0x2fd299['shift']());}};_0x2a5ab4(++_0x34886b);}(_0x5cee,0x81));var _0xe5ce=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x5cee[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xe5ce('0x0'));var util=require('util');var logger=require(_0xe5ce('0x1'))(_0xe5ce('0x2'));var moment=require(_0xe5ce('0x3'));var BPromise=require(_0xe5ce('0x4'));var rp=require(_0xe5ce('0x5'));var fs=require('fs');var path=require(_0xe5ce('0x6'));var rimraf=require('rimraf');var config=require(_0xe5ce('0x7'));var attributes=require('./memberReport.attributes');module[_0xe5ce('0x8')]=function(_0x45fc3c,_0x545a6c){return _0x45fc3c[_0xe5ce('0x9')]('MemberReport',attributes,{'tableName':_0xe5ce('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe5ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x40ea=['report_member','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','MemberReport'];(function(_0x130c7d,_0x155870){var _0xaaa03e=function(_0x553bd7){while(--_0x553bd7){_0x130c7d['push'](_0x130c7d['shift']());}};_0xaaa03e(++_0x155870);}(_0x40ea,0xa8));var _0xa40e=function(_0x175328,_0x1dd074){_0x175328=_0x175328-0x0;var _0x13c0b9=_0x40ea[_0x175328];return _0x13c0b9;};'use strict';var _=require(_0xa40e('0x0'));var util=require(_0xa40e('0x1'));var logger=require(_0xa40e('0x2'))(_0xa40e('0x3'));var moment=require(_0xa40e('0x4'));var BPromise=require(_0xa40e('0x5'));var rp=require(_0xa40e('0x6'));var fs=require('fs');var path=require(_0xa40e('0x7'));var rimraf=require('rimraf');var config=require(_0xa40e('0x8'));var attributes=require(_0xa40e('0x9'));module[_0xa40e('0xa')]=function(_0x126790,_0x5be828){return _0x126790['define'](_0xa40e('0xb'),attributes,{'tableName':_0xa40e('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xa40e('0xd'),_0xa40e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 0a782de..858bd86 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 _0xa9f4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','attributes','limit','include','map','model','create','body','raw','CreateMemberReport','UpdateMemberReport','where','lodash','util','bluebird','randomstring','ioredis'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xa9f4,0x76));var _0x4a9f=function(_0x41ed06,_0x3d08e8){_0x41ed06=_0x41ed06-0x0;var _0x2634ff=_0xa9f4[_0x41ed06];return _0x2634ff;};'use strict';var _=require(_0x4a9f('0x0'));var util=require(_0x4a9f('0x1'));var moment=require('moment');var BPromise=require(_0x4a9f('0x2'));var rs=require(_0x4a9f('0x3'));var fs=require('fs');var Redis=require(_0x4a9f('0x4'));var db=require(_0x4a9f('0x5'))['db'];var utils=require(_0x4a9f('0x6'));var logger=require(_0x4a9f('0x7'))(_0x4a9f('0x8'));var config=require(_0x4a9f('0x9'));var jayson=require(_0x4a9f('0xa'));var client=jayson[_0x4a9f('0xb')][_0x4a9f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x199cce,_0x2d1ebf,_0x88efdb){return new BPromise(function(_0x3cc453,_0x33d62c){return client[_0x4a9f('0xd')](_0x199cce,_0x88efdb)[_0x4a9f('0xe')](function(_0x464ec7){logger[_0x4a9f('0xf')](_0x4a9f('0x10'),_0x2d1ebf,_0x4a9f('0x11'));logger[_0x4a9f('0x12')](_0x4a9f('0x13'),_0x2d1ebf,'request\x20sent',JSON[_0x4a9f('0x14')](_0x464ec7));if(_0x464ec7[_0x4a9f('0x15')]){if(_0x464ec7[_0x4a9f('0x15')][_0x4a9f('0x16')]===0x1f4){logger[_0x4a9f('0x15')](_0x4a9f('0x10'),_0x2d1ebf,_0x464ec7['error'][_0x4a9f('0x17')]);return _0x33d62c(_0x464ec7[_0x4a9f('0x15')][_0x4a9f('0x17')]);}logger[_0x4a9f('0x15')]('MemberReport,\x20%s,\x20%s',_0x2d1ebf,_0x464ec7[_0x4a9f('0x15')][_0x4a9f('0x17')]);return _0x3cc453(_0x464ec7['error'][_0x4a9f('0x17')]);}else{logger[_0x4a9f('0xf')](_0x4a9f('0x10'),_0x2d1ebf,_0x4a9f('0x11'));_0x3cc453(_0x464ec7[_0x4a9f('0x18')]['message']);}})[_0x4a9f('0x19')](function(_0x4bd606){logger['error'](_0x4a9f('0x10'),_0x2d1ebf,_0x4bd606);_0x33d62c(_0x4bd606);});});}exports[_0x4a9f('0x1a')]=function(_0x81e87){var _0x5131ae=this;return new Promise(function(_0x3d29f5,_0x1e13f8){return db[_0x4a9f('0x1b')][_0x4a9f('0x1c')]({'raw':_0x81e87[_0x4a9f('0x1d')]?_0x81e87[_0x4a9f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x81e87[_0x4a9f('0x1d')]?_0x81e87[_0x4a9f('0x1d')]['where']||null:null,'attributes':_0x81e87[_0x4a9f('0x1d')]?_0x81e87[_0x4a9f('0x1d')][_0x4a9f('0x1e')]||null:null,'limit':_0x81e87[_0x4a9f('0x1d')]?_0x81e87['options'][_0x4a9f('0x1f')]||null:null,'include':_0x81e87[_0x4a9f('0x1d')]?_0x81e87[_0x4a9f('0x1d')][_0x4a9f('0x20')]?_[_0x4a9f('0x21')](_0x81e87['options'][_0x4a9f('0x20')],function(_0x3c4ccc){return{'model':db[_0x3c4ccc[_0x4a9f('0x22')]],'as':_0x3c4ccc['as'],'attributes':_0x3c4ccc['attributes'],'include':_0x3c4ccc[_0x4a9f('0x20')]?_['map'](_0x3c4ccc[_0x4a9f('0x20')],function(_0x591111){return{'model':db[_0x591111['model']],'as':_0x591111['as'],'attributes':_0x591111[_0x4a9f('0x1e')],'include':_0x591111[_0x4a9f('0x20')]?_['map'](_0x591111[_0x4a9f('0x20')],function(_0x157eaa){return{'model':db[_0x157eaa[_0x4a9f('0x22')]],'as':_0x157eaa['as'],'attributes':_0x157eaa['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a9f('0xe')](function(_0x35efff){logger[_0x4a9f('0xf')](_0x4a9f('0x1a'),_0x81e87);logger[_0x4a9f('0x12')](_0x4a9f('0x1a'),_0x81e87,JSON[_0x4a9f('0x14')](_0x35efff));_0x3d29f5(_0x35efff);})[_0x4a9f('0x19')](function(_0x575182){logger[_0x4a9f('0x15')](_0x4a9f('0x1a'),_0x575182['message'],_0x81e87);_0x1e13f8(_0x5131ae[_0x4a9f('0x15')](0x1f4,_0x575182[_0x4a9f('0x17')]));});});};exports['CreateMemberReport']=function(_0xeb0bae){var _0x29b440=this;return new Promise(function(_0x327666,_0x102fd0){return db['MemberReport'][_0x4a9f('0x23')](_0xeb0bae[_0x4a9f('0x24')],{'raw':_0xeb0bae[_0x4a9f('0x1d')]?_0xeb0bae[_0x4a9f('0x1d')][_0x4a9f('0x25')]===undefined?!![]:![]:!![]})[_0x4a9f('0xe')](function(_0x252bed){logger[_0x4a9f('0xf')](_0x4a9f('0x26'),_0xeb0bae);logger[_0x4a9f('0x12')]('CreateMemberReport',_0xeb0bae,JSON[_0x4a9f('0x14')](_0x252bed));_0x327666(_0x252bed);})[_0x4a9f('0x19')](function(_0x39afb6){logger[_0x4a9f('0x15')](_0x4a9f('0x26'),_0x39afb6[_0x4a9f('0x17')],_0xeb0bae);_0x102fd0(_0x29b440[_0x4a9f('0x15')](0x1f4,_0x39afb6[_0x4a9f('0x17')]));});});};exports[_0x4a9f('0x27')]=function(_0x23d48b){var _0x42a603=this;return new Promise(function(_0x5b3e31,_0x24b1da){return db[_0x4a9f('0x1b')]['update'](_0x23d48b[_0x4a9f('0x24')],{'raw':_0x23d48b[_0x4a9f('0x1d')]?_0x23d48b[_0x4a9f('0x1d')][_0x4a9f('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23d48b[_0x4a9f('0x1d')]?_0x23d48b[_0x4a9f('0x1d')][_0x4a9f('0x28')]||null:null,'attributes':_0x23d48b[_0x4a9f('0x1d')]?_0x23d48b[_0x4a9f('0x1d')]['attributes']||null:null,'limit':_0x23d48b['options']?_0x23d48b[_0x4a9f('0x1d')][_0x4a9f('0x1f')]||null:null})[_0x4a9f('0xe')](function(_0x214216){logger['info'](_0x4a9f('0x27'),_0x23d48b);logger[_0x4a9f('0x12')](_0x4a9f('0x27'),_0x23d48b,JSON[_0x4a9f('0x14')](_0x214216));_0x5b3e31(_0x214216);})[_0x4a9f('0x19')](function(_0x32b1a7){logger[_0x4a9f('0x15')]('UpdateMemberReport',_0x32b1a7[_0x4a9f('0x17')],_0x23d48b);_0x24b1da(_0x42a603[_0x4a9f('0x15')](0x1f4,_0x32b1a7[_0x4a9f('0x17')]));});});}; \ No newline at end of file +var _0xf209=['options','raw','where','attributes','limit','include','map','model','debug','CreateMemberReport','create','UpdateMemberReport','update','body','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x292e9e,_0x3ad179){var _0x95fd40=function(_0x59b1aa){while(--_0x59b1aa){_0x292e9e['push'](_0x292e9e['shift']());}};_0x95fd40(++_0x3ad179);}(_0xf209,0xcc));var _0x9f20=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0xf209[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x9f20('0x0'));var util=require(_0x9f20('0x1'));var moment=require(_0x9f20('0x2'));var BPromise=require(_0x9f20('0x3'));var rs=require(_0x9f20('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9f20('0x5'));var logger=require(_0x9f20('0x6'))(_0x9f20('0x7'));var config=require(_0x9f20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f20('0x9')][_0x9f20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b6073,_0x121327,_0x415278){return new BPromise(function(_0x30ffaa,_0x50e250){return client['request'](_0x5b6073,_0x415278)[_0x9f20('0xb')](function(_0x16766c){logger['info'](_0x9f20('0xc'),_0x121327,_0x9f20('0xd'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x121327,_0x9f20('0xd'),JSON[_0x9f20('0xe')](_0x16766c));if(_0x16766c[_0x9f20('0xf')]){if(_0x16766c[_0x9f20('0xf')][_0x9f20('0x10')]===0x1f4){logger[_0x9f20('0xf')](_0x9f20('0xc'),_0x121327,_0x16766c[_0x9f20('0xf')][_0x9f20('0x11')]);return _0x50e250(_0x16766c[_0x9f20('0xf')]['message']);}logger[_0x9f20('0xf')]('MemberReport,\x20%s,\x20%s',_0x121327,_0x16766c[_0x9f20('0xf')]['message']);return _0x30ffaa(_0x16766c[_0x9f20('0xf')][_0x9f20('0x11')]);}else{logger[_0x9f20('0x12')](_0x9f20('0xc'),_0x121327,_0x9f20('0xd'));_0x30ffaa(_0x16766c[_0x9f20('0x13')][_0x9f20('0x11')]);}})[_0x9f20('0x14')](function(_0x24ff57){logger['error']('MemberReport,\x20%s,\x20%s',_0x121327,_0x24ff57);_0x50e250(_0x24ff57);});});}exports[_0x9f20('0x15')]=function(_0x4bb021){var _0x4e7dec=this;return new Promise(function(_0x2af119,_0xdd55b9){return db[_0x9f20('0x16')][_0x9f20('0x17')]({'raw':_0x4bb021[_0x9f20('0x18')]?_0x4bb021['options'][_0x9f20('0x19')]===undefined?!![]:![]:!![],'where':_0x4bb021[_0x9f20('0x18')]?_0x4bb021[_0x9f20('0x18')][_0x9f20('0x1a')]||null:null,'attributes':_0x4bb021['options']?_0x4bb021[_0x9f20('0x18')][_0x9f20('0x1b')]||null:null,'limit':_0x4bb021['options']?_0x4bb021[_0x9f20('0x18')][_0x9f20('0x1c')]||null:null,'include':_0x4bb021['options']?_0x4bb021[_0x9f20('0x18')][_0x9f20('0x1d')]?_[_0x9f20('0x1e')](_0x4bb021[_0x9f20('0x18')]['include'],function(_0x1cf9a9){return{'model':db[_0x1cf9a9[_0x9f20('0x1f')]],'as':_0x1cf9a9['as'],'attributes':_0x1cf9a9[_0x9f20('0x1b')],'include':_0x1cf9a9[_0x9f20('0x1d')]?_[_0x9f20('0x1e')](_0x1cf9a9[_0x9f20('0x1d')],function(_0x1cd533){return{'model':db[_0x1cd533[_0x9f20('0x1f')]],'as':_0x1cd533['as'],'attributes':_0x1cd533[_0x9f20('0x1b')],'include':_0x1cd533[_0x9f20('0x1d')]?_['map'](_0x1cd533[_0x9f20('0x1d')],function(_0xd4801d){return{'model':db[_0xd4801d[_0x9f20('0x1f')]],'as':_0xd4801d['as'],'attributes':_0xd4801d[_0x9f20('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9f20('0xb')](function(_0x1566c5){logger['info'](_0x9f20('0x15'),_0x4bb021);logger[_0x9f20('0x20')](_0x9f20('0x15'),_0x4bb021,JSON[_0x9f20('0xe')](_0x1566c5));_0x2af119(_0x1566c5);})['catch'](function(_0x24758d){logger[_0x9f20('0xf')](_0x9f20('0x15'),_0x24758d[_0x9f20('0x11')],_0x4bb021);_0xdd55b9(_0x4e7dec[_0x9f20('0xf')](0x1f4,_0x24758d[_0x9f20('0x11')]));});});};exports[_0x9f20('0x21')]=function(_0x4fd412){var _0x1c4a98=this;return new Promise(function(_0x3c0aa6,_0x262358){return db['MemberReport'][_0x9f20('0x22')](_0x4fd412['body'],{'raw':_0x4fd412['options']?_0x4fd412[_0x9f20('0x18')][_0x9f20('0x19')]===undefined?!![]:![]:!![]})[_0x9f20('0xb')](function(_0x9bb5f4){logger[_0x9f20('0x12')](_0x9f20('0x21'),_0x4fd412);logger['debug'](_0x9f20('0x21'),_0x4fd412,JSON['stringify'](_0x9bb5f4));_0x3c0aa6(_0x9bb5f4);})[_0x9f20('0x14')](function(_0x2478ea){logger[_0x9f20('0xf')](_0x9f20('0x21'),_0x2478ea[_0x9f20('0x11')],_0x4fd412);_0x262358(_0x1c4a98[_0x9f20('0xf')](0x1f4,_0x2478ea[_0x9f20('0x11')]));});});};exports[_0x9f20('0x23')]=function(_0x563f13){var _0x4cf33d=this;return new Promise(function(_0x863ee5,_0x5b0c56){return db[_0x9f20('0x16')][_0x9f20('0x24')](_0x563f13[_0x9f20('0x25')],{'raw':_0x563f13[_0x9f20('0x18')]?_0x563f13[_0x9f20('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563f13[_0x9f20('0x18')]?_0x563f13[_0x9f20('0x18')][_0x9f20('0x1a')]||null:null,'attributes':_0x563f13[_0x9f20('0x18')]?_0x563f13[_0x9f20('0x18')]['attributes']||null:null,'limit':_0x563f13[_0x9f20('0x18')]?_0x563f13[_0x9f20('0x18')][_0x9f20('0x1c')]||null:null})[_0x9f20('0xb')](function(_0x289307){logger[_0x9f20('0x12')]('UpdateMemberReport',_0x563f13);logger[_0x9f20('0x20')](_0x9f20('0x23'),_0x563f13,JSON[_0x9f20('0xe')](_0x289307));_0x863ee5(_0x289307);})['catch'](function(_0x4c8311){logger['error'](_0x9f20('0x23'),_0x4c8311[_0x9f20('0x11')],_0x563f13);_0x5b0c56(_0x4cf33d[_0x9f20('0xf')](0x1f4,_0x4c8311[_0x9f20('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index da8c16d..7c41483 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 _0xb688=['express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','util','path','connect-timeout'];(function(_0x4b3d46,_0x56c876){var _0x26f735=function(_0x3160c4){while(--_0x3160c4){_0x4b3d46['push'](_0x4b3d46['shift']());}};_0x26f735(++_0x56c876);}(_0xb688,0xcf));var _0x8b68=function(_0x495223,_0x1832c6){_0x495223=_0x495223-0x0;var _0x39f535=_0xb688[_0x495223];return _0x39f535;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',controller[_0x8b68('0x9')]);module['exports']=router; \ No newline at end of file +var _0xefda=['../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','connect-timeout','express'];(function(_0x5f3de3,_0x40f0f5){var _0x287e0d=function(_0x3189dc){while(--_0x3189dc){_0x5f3de3['push'](_0x5f3de3['shift']());}};_0x287e0d(++_0x40f0f5);}(_0xefda,0x96));var _0xaefd=function(_0x57346f,_0x95b929){_0x57346f=_0x57346f-0x0;var _0x160a50=_0xefda[_0x57346f];return _0x160a50;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var auth=require(_0xaefd('0x3'));var interaction=require(_0xaefd('0x4'));var config=require(_0xaefd('0x5'));var controller=require(_0xaefd('0x6'));router[_0xaefd('0x7')]('/',controller[_0xaefd('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 048e657..a51bf5e 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 _0xd9a3=['sequelize','version'];(function(_0x2a6a2c,_0x14a88f){var _0x46e42e=function(_0x42089c){while(--_0x42089c){_0x2a6a2c['push'](_0x2a6a2c['shift']());}};_0x46e42e(++_0x14a88f);}(_0xd9a3,0x11a));var _0x3d9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd9a3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3d9a('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x3d9a('0x1')}}; \ No newline at end of file +var _0x4a50=['exports','STRING','version','sequelize'];(function(_0x73d817,_0x54eed1){var _0x178cf8=function(_0x3cdf24){while(--_0x3cdf24){_0x73d817['push'](_0x73d817['shift']());}};_0x178cf8(++_0x54eed1);}(_0x4a50,0x93));var _0x04a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4a50[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x04a5('0x0'));module[_0x04a5('0x1')]={'version':{'type':Sequelize[_0x04a5('0x2')],'unique':_0x04a5('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index de868e7..f03a9c4 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 _0xba93=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','then','destroy','sendStatus','error','stack','name','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Migration','includeAll','findAll','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x599d59,_0x422c75){var _0x116eda=function(_0x1e0de0){while(--_0x1e0de0){_0x599d59['push'](_0x599d59['shift']());}};_0x116eda(++_0x422c75);}(_0xba93,0x137));var _0x3ba9=function(_0x3ae2f3,_0xaa9b10){_0x3ae2f3=_0x3ae2f3-0x0;var _0x5247f7=_0xba93[_0x3ae2f3];return _0x5247f7;};'use strict';var pdf=require(_0x3ba9('0x0'));var emlformat=require(_0x3ba9('0x1'));var rimraf=require(_0x3ba9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ba9('0x3'));var rp=require(_0x3ba9('0x4'));var moment=require('moment');var BPromise=require(_0x3ba9('0x5'));var Mustache=require(_0x3ba9('0x6'));var util=require(_0x3ba9('0x7'));var path=require(_0x3ba9('0x8'));var sox=require(_0x3ba9('0x9'));var csv=require(_0x3ba9('0xa'));var ejs=require(_0x3ba9('0xb'));var fs=require('fs');var _=require(_0x3ba9('0xc'));var squel=require(_0x3ba9('0xd'));var crypto=require('crypto');var jsforce=require(_0x3ba9('0xe'));var deskjs=require(_0x3ba9('0xf'));var toCsv=require(_0x3ba9('0xa'));var querystring=require('querystring');var Papa=require(_0x3ba9('0x10'));var Redis=require('ioredis');var authService=require(_0x3ba9('0x11'));var qs=require(_0x3ba9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ba9('0x13'))(_0x3ba9('0x14'));var utils=require(_0x3ba9('0x15'));var config=require(_0x3ba9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ba9('0x17'))['db'];function respondWithStatusCode(_0x225ee9,_0x1cb72f){_0x1cb72f=_0x1cb72f||0xcc;return function(_0x1c3ff3){if(_0x1c3ff3){return _0x225ee9['sendStatus'](_0x1cb72f);}return _0x225ee9[_0x3ba9('0x18')](_0x1cb72f)[_0x3ba9('0x19')]();};}function respondWithResult(_0xb2d431,_0xee06c){_0xee06c=_0xee06c||0xc8;return function(_0x19457b){if(_0x19457b){return _0xb2d431[_0x3ba9('0x18')](_0xee06c)[_0x3ba9('0x1a')](_0x19457b);}};}function respondWithFilteredResult(_0x320444,_0x38a8cc){return function(_0x13b304){if(_0x13b304){var _0xb4f7f7=_0x13b304[_0x3ba9('0x1b')],_0x587c1f=_0x38a8cc[_0x3ba9('0x1c')],_0xefaf74=_0x38a8cc[_0x3ba9('0x1c')]+_0x38a8cc[_0x3ba9('0x1d')],_0x250df7;if(_0xefaf74>=_0xb4f7f7){_0xefaf74=_0xb4f7f7;_0x250df7=0xc8;}else{_0x250df7=0xce;}_0x320444['status'](_0x250df7);return _0x320444[_0x3ba9('0x1e')]('Content-Range',_0x587c1f+'-'+_0xefaf74+'/'+_0xb4f7f7)[_0x3ba9('0x1a')](_0x13b304);}return null;};}function patchUpdates(_0x55c4eb){return function(_0x1f3590){try{jsonpatch['apply'](_0x1f3590,_0x55c4eb,!![]);}catch(_0x3fb37d){return BPromise[_0x3ba9('0x1f')](_0x3fb37d);}return _0x1f3590[_0x3ba9('0x20')]();};}function saveUpdates(_0x5c0f21,_0x36a3a7){return function(_0x52822f){if(_0x52822f){return _0x52822f['update'](_0x5c0f21)[_0x3ba9('0x21')](function(_0x52c8c5){return _0x52c8c5;});}return null;};}function removeEntity(_0x526589,_0x382e0d){return function(_0x253256){if(_0x253256){return _0x253256[_0x3ba9('0x22')]()['then'](function(){_0x526589[_0x3ba9('0x18')](0xcc)[_0x3ba9('0x19')]();});}};}function handleEntityNotFound(_0x131eab,_0x23992f){return function(_0x181ac6){if(!_0x181ac6){_0x131eab[_0x3ba9('0x23')](0x194);}return _0x181ac6;};}function handleError(_0xb1602c,_0x574e41){_0x574e41=_0x574e41||0x1f4;return function(_0x24b29e){logger[_0x3ba9('0x24')](_0x24b29e[_0x3ba9('0x25')]);if(_0x24b29e[_0x3ba9('0x26')]){delete _0x24b29e[_0x3ba9('0x26')];}_0xb1602c[_0x3ba9('0x18')](_0x574e41)['send'](_0x24b29e);};}exports[_0x3ba9('0x27')]=function(_0x5d3e53,_0xcb534c){var _0x5c411d={},_0x360392={},_0x450dc9={'count':0x0,'rows':[]};var _0x3bb9a1=_[_0x3ba9('0x28')](db['Migration']['rawAttributes'],function(_0x5da508){return{'name':_0x5da508['fieldName'],'type':_0x5da508[_0x3ba9('0x29')][_0x3ba9('0x2a')]};});_0x360392[_0x3ba9('0x2b')]=_[_0x3ba9('0x28')](_0x3bb9a1,_0x3ba9('0x26'));_0x360392[_0x3ba9('0x2c')]=_[_0x3ba9('0x2d')](_0x5d3e53['query']);_0x360392[_0x3ba9('0x2e')]=_['intersection'](_0x360392[_0x3ba9('0x2b')],_0x360392[_0x3ba9('0x2c')]);_0x5c411d[_0x3ba9('0x2f')]=_[_0x3ba9('0x30')](_0x360392[_0x3ba9('0x2b')],qs[_0x3ba9('0x31')](_0x5d3e53[_0x3ba9('0x2c')]['fields']));_0x5c411d['attributes']=_0x5c411d[_0x3ba9('0x2f')][_0x3ba9('0x32')]?_0x5c411d[_0x3ba9('0x2f')]:_0x360392['model'];if(!_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x33')](_0x3ba9('0x34'))){_0x5c411d[_0x3ba9('0x1d')]=qs[_0x3ba9('0x1d')](_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x1d')]);_0x5c411d[_0x3ba9('0x1c')]=qs['offset'](_0x5d3e53[_0x3ba9('0x2c')]['offset']);}_0x5c411d[_0x3ba9('0x35')]=qs['sort'](_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x36')]);_0x5c411d[_0x3ba9('0x37')]=qs[_0x3ba9('0x2e')](_[_0x3ba9('0x38')](_0x5d3e53[_0x3ba9('0x2c')],_0x360392['filters']),_0x3bb9a1);if(_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x39')]){_0x5c411d[_0x3ba9('0x37')]=_[_0x3ba9('0x3a')](_0x5c411d[_0x3ba9('0x37')],{'$or':_[_0x3ba9('0x28')](_0x3bb9a1,function(_0x220ab7){if(_0x220ab7[_0x3ba9('0x29')]!==_0x3ba9('0x3b')){var _0x1a8803={};_0x1a8803[_0x220ab7[_0x3ba9('0x26')]]={'$like':'%'+_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x39')]+'%'};return _0x1a8803;}})});}_0x5c411d=_['merge']({},_0x5c411d,_0x5d3e53[_0x3ba9('0x3c')]);var _0x37670a={'where':_0x5c411d['where']};return db[_0x3ba9('0x3d')][_0x3ba9('0x1b')](_0x37670a)[_0x3ba9('0x21')](function(_0x1a3bc8){_0x450dc9[_0x3ba9('0x1b')]=_0x1a3bc8;if(_0x5d3e53[_0x3ba9('0x2c')][_0x3ba9('0x3e')]){_0x5c411d['include']=[{'all':!![]}];}return db[_0x3ba9('0x3d')][_0x3ba9('0x3f')](_0x5c411d);})['then'](function(_0x49bed5){_0x450dc9['rows']=_0x49bed5;return _0x450dc9;})['then'](respondWithFilteredResult(_0xcb534c,_0x5c411d))[_0x3ba9('0x40')](handleError(_0xcb534c,null));}; \ No newline at end of file +var _0xcffe=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Migration','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto'];(function(_0x101802,_0x11f913){var _0x5d61ce=function(_0x4acc0){while(--_0x4acc0){_0x101802['push'](_0x101802['shift']());}};_0x5d61ce(++_0x11f913);}(_0xcffe,0x1a1));var _0xecff=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0xcffe[_0x11503f];return _0x34caab;};'use strict';var pdf=require(_0xecff('0x0'));var emlformat=require(_0xecff('0x1'));var rimraf=require(_0xecff('0x2'));var zipdir=require(_0xecff('0x3'));var jsonpatch=require(_0xecff('0x4'));var rp=require(_0xecff('0x5'));var moment=require(_0xecff('0x6'));var BPromise=require(_0xecff('0x7'));var Mustache=require(_0xecff('0x8'));var util=require(_0xecff('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xecff('0xa'));var ejs=require(_0xecff('0xb'));var fs=require('fs');var _=require(_0xecff('0xc'));var squel=require(_0xecff('0xd'));var crypto=require(_0xecff('0xe'));var jsforce=require(_0xecff('0xf'));var deskjs=require(_0xecff('0x10'));var toCsv=require('to-csv');var querystring=require(_0xecff('0x11'));var Papa=require(_0xecff('0x12'));var Redis=require(_0xecff('0x13'));var authService=require(_0xecff('0x14'));var qs=require(_0xecff('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecff('0x16'));var logger=require(_0xecff('0x17'))(_0xecff('0x18'));var utils=require(_0xecff('0x19'));var config=require(_0xecff('0x1a'));var licenseUtil=require(_0xecff('0x1b'));var db=require(_0xecff('0x1c'))['db'];function respondWithStatusCode(_0x32627c,_0x3e907d){_0x3e907d=_0x3e907d||0xcc;return function(_0x151a79){if(_0x151a79){return _0x32627c[_0xecff('0x1d')](_0x3e907d);}return _0x32627c[_0xecff('0x1e')](_0x3e907d)[_0xecff('0x1f')]();};}function respondWithResult(_0xb8745f,_0x5495f9){_0x5495f9=_0x5495f9||0xc8;return function(_0x4b1893){if(_0x4b1893){return _0xb8745f[_0xecff('0x1e')](_0x5495f9)[_0xecff('0x20')](_0x4b1893);}};}function respondWithFilteredResult(_0x558ecd,_0x35ce1f){return function(_0x362ed0){if(_0x362ed0){var _0x3a7623=_0x362ed0[_0xecff('0x21')],_0x596b09=_0x35ce1f['offset'],_0x52b62f=_0x35ce1f[_0xecff('0x22')]+_0x35ce1f[_0xecff('0x23')],_0x24abef;if(_0x52b62f>=_0x3a7623){_0x52b62f=_0x3a7623;_0x24abef=0xc8;}else{_0x24abef=0xce;}_0x558ecd[_0xecff('0x1e')](_0x24abef);return _0x558ecd[_0xecff('0x24')](_0xecff('0x25'),_0x596b09+'-'+_0x52b62f+'/'+_0x3a7623)[_0xecff('0x20')](_0x362ed0);}return null;};}function patchUpdates(_0x5c2503){return function(_0x229728){try{jsonpatch[_0xecff('0x26')](_0x229728,_0x5c2503,!![]);}catch(_0x2c487c){return BPromise[_0xecff('0x27')](_0x2c487c);}return _0x229728['save']();};}function saveUpdates(_0x4bb94e,_0x2e2bdd){return function(_0x393acf){if(_0x393acf){return _0x393acf[_0xecff('0x28')](_0x4bb94e)[_0xecff('0x29')](function(_0x2402e0){return _0x2402e0;});}return null;};}function removeEntity(_0x494754,_0x14378d){return function(_0x520d6d){if(_0x520d6d){return _0x520d6d['destroy']()[_0xecff('0x29')](function(){_0x494754['status'](0xcc)[_0xecff('0x1f')]();});}};}function handleEntityNotFound(_0x49c0cd,_0x389281){return function(_0x4ced15){if(!_0x4ced15){_0x49c0cd[_0xecff('0x1d')](0x194);}return _0x4ced15;};}function handleError(_0x44f5f7,_0x505e20){_0x505e20=_0x505e20||0x1f4;return function(_0x9f173d){logger[_0xecff('0x2a')](_0x9f173d[_0xecff('0x2b')]);if(_0x9f173d[_0xecff('0x2c')]){delete _0x9f173d[_0xecff('0x2c')];}_0x44f5f7['status'](_0x505e20)['send'](_0x9f173d);};}exports[_0xecff('0x2d')]=function(_0x484415,_0x1281d8){var _0x3ef198={},_0x49a224={},_0x1dfeb6={'count':0x0,'rows':[]};var _0x5c2360=_['map'](db['Migration'][_0xecff('0x2e')],function(_0xabe5da){return{'name':_0xabe5da[_0xecff('0x2f')],'type':_0xabe5da[_0xecff('0x30')]['key']};});_0x49a224[_0xecff('0x31')]=_[_0xecff('0x32')](_0x5c2360,_0xecff('0x2c'));_0x49a224['query']=_[_0xecff('0x33')](_0x484415[_0xecff('0x34')]);_0x49a224[_0xecff('0x35')]=_[_0xecff('0x36')](_0x49a224['model'],_0x49a224[_0xecff('0x34')]);_0x3ef198[_0xecff('0x37')]=_['intersection'](_0x49a224[_0xecff('0x31')],qs[_0xecff('0x38')](_0x484415[_0xecff('0x34')][_0xecff('0x38')]));_0x3ef198['attributes']=_0x3ef198[_0xecff('0x37')][_0xecff('0x39')]?_0x3ef198[_0xecff('0x37')]:_0x49a224['model'];if(!_0x484415[_0xecff('0x34')][_0xecff('0x3a')](_0xecff('0x3b'))){_0x3ef198[_0xecff('0x23')]=qs[_0xecff('0x23')](_0x484415[_0xecff('0x34')]['limit']);_0x3ef198['offset']=qs['offset'](_0x484415[_0xecff('0x34')]['offset']);}_0x3ef198[_0xecff('0x3c')]=qs[_0xecff('0x3d')](_0x484415['query'][_0xecff('0x3d')]);_0x3ef198[_0xecff('0x3e')]=qs[_0xecff('0x35')](_['pick'](_0x484415[_0xecff('0x34')],_0x49a224[_0xecff('0x35')]),_0x5c2360);if(_0x484415[_0xecff('0x34')]['filter']){_0x3ef198[_0xecff('0x3e')]=_[_0xecff('0x3f')](_0x3ef198[_0xecff('0x3e')],{'$or':_[_0xecff('0x32')](_0x5c2360,function(_0x317037){if(_0x317037[_0xecff('0x30')]!==_0xecff('0x40')){var _0x39a5f3={};_0x39a5f3[_0x317037[_0xecff('0x2c')]]={'$like':'%'+_0x484415[_0xecff('0x34')][_0xecff('0x41')]+'%'};return _0x39a5f3;}})});}_0x3ef198=_['merge']({},_0x3ef198,_0x484415[_0xecff('0x42')]);var _0x23c8f1={'where':_0x3ef198[_0xecff('0x3e')]};return db[_0xecff('0x43')][_0xecff('0x21')](_0x23c8f1)[_0xecff('0x29')](function(_0x1753a0){_0x1dfeb6[_0xecff('0x21')]=_0x1753a0;if(_0x484415['query'][_0xecff('0x44')]){_0x3ef198['include']=[{'all':!![]}];}return db[_0xecff('0x43')][_0xecff('0x45')](_0x3ef198);})[_0xecff('0x29')](function(_0x3827b1){_0x1dfeb6[_0xecff('0x46')]=_0x3827b1;return _0x1dfeb6;})[_0xecff('0x29')](respondWithFilteredResult(_0x1281d8,_0x3ef198))[_0xecff('0x47')](handleError(_0x1281d8,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 566e241..e8509fe 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 _0x2826=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash'];(function(_0x1eec6b,_0x358147){var _0x89bb6f=function(_0x29a36c){while(--_0x29a36c){_0x1eec6b['push'](_0x1eec6b['shift']());}};_0x89bb6f(++_0x358147);}(_0x2826,0xa7));var _0x6282=function(_0x315d32,_0x33485b){_0x315d32=_0x315d32-0x0;var _0x3ea98d=_0x2826[_0x315d32];return _0x3ea98d;};'use strict';var _=require(_0x6282('0x0'));var util=require(_0x6282('0x1'));var logger=require(_0x6282('0x2'))(_0x6282('0x3'));var moment=require(_0x6282('0x4'));var BPromise=require(_0x6282('0x5'));var rp=require(_0x6282('0x6'));var fs=require('fs');var path=require(_0x6282('0x7'));var rimraf=require(_0x6282('0x8'));var config=require(_0x6282('0x9'));var attributes=require(_0x6282('0xa'));module[_0x6282('0xb')]=function(_0x236147,_0x572bf5){return _0x236147[_0x6282('0xc')](_0x6282('0xd'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x021a=['../../config/logger','moment','request-promise','./migration.attributes','define','Migration','migrations'];(function(_0x153ba6,_0x196753){var _0x2ae4ee=function(_0x594db0){while(--_0x594db0){_0x153ba6['push'](_0x153ba6['shift']());}};_0x2ae4ee(++_0x196753);}(_0x021a,0x1b2));var _0xa021=function(_0x3a04c6,_0x12a482){_0x3a04c6=_0x3a04c6-0x0;var _0xf4131a=_0x021a[_0x3a04c6];return _0xf4131a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa021('0x0'))('api');var moment=require(_0xa021('0x1'));var BPromise=require('bluebird');var rp=require(_0xa021('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa021('0x3'));module['exports']=function(_0x4d6525,_0x27dec3){return _0x4d6525[_0xa021('0x4')](_0xa021('0x5'),attributes,{'tableName':_0xa021('0x6'),'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 defae7c..814edf0 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 _0x5025=['jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x515339,_0x10eec5){var _0x441b6c=function(_0x26bd3c){while(--_0x26bd3c){_0x515339['push'](_0x515339['shift']());}};_0x441b6c(++_0x10eec5);}(_0x5025,0xdc));var _0x5502=function(_0x35e75a,_0x5ed225){_0x35e75a=_0x35e75a-0x0;var _0xb23c7f=_0x5025[_0x35e75a];return _0xb23c7f;};'use strict';var _=require(_0x5502('0x0'));var util=require(_0x5502('0x1'));var moment=require(_0x5502('0x2'));var BPromise=require(_0x5502('0x3'));var rs=require(_0x5502('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5502('0x5'))['db'];var utils=require(_0x5502('0x6'));var logger=require(_0x5502('0x7'))(_0x5502('0x8'));var config=require(_0x5502('0x9'));var jayson=require(_0x5502('0xa'));var client=jayson['client'][_0x5502('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x191bee,_0x225e21,_0x110620){return new BPromise(function(_0x589407,_0x212384){return client[_0x5502('0xc')](_0x191bee,_0x110620)[_0x5502('0xd')](function(_0xf4bdd0){logger['info'](_0x5502('0xe'),_0x225e21,_0x5502('0xf'));logger['debug'](_0x5502('0x10'),_0x225e21,'request\x20sent',JSON['stringify'](_0xf4bdd0));if(_0xf4bdd0['error']){if(_0xf4bdd0[_0x5502('0x11')][_0x5502('0x12')]===0x1f4){logger['error'](_0x5502('0xe'),_0x225e21,_0xf4bdd0['error'][_0x5502('0x13')]);return _0x212384(_0xf4bdd0[_0x5502('0x11')][_0x5502('0x13')]);}logger[_0x5502('0x11')](_0x5502('0xe'),_0x225e21,_0xf4bdd0['error']['message']);return _0x589407(_0xf4bdd0[_0x5502('0x11')][_0x5502('0x13')]);}else{logger[_0x5502('0x14')](_0x5502('0xe'),_0x225e21,_0x5502('0xf'));_0x589407(_0xf4bdd0[_0x5502('0x15')][_0x5502('0x13')]);}})[_0x5502('0x16')](function(_0xdf8b18){logger[_0x5502('0x11')](_0x5502('0xe'),_0x225e21,_0xdf8b18);_0x212384(_0xdf8b18);});});} \ No newline at end of file +var _0x09eb=['client','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise'];(function(_0x18c4bf,_0x56dfe5){var _0x5c9674=function(_0x46c6e9){while(--_0x46c6e9){_0x18c4bf['push'](_0x18c4bf['shift']());}};_0x5c9674(++_0x56dfe5);}(_0x09eb,0x1b0));var _0xb09e=function(_0x173eff,_0x55a7d0){_0x173eff=_0x173eff-0x0;var _0x119fbd=_0x09eb[_0x173eff];return _0x119fbd;};'use strict';var _=require(_0xb09e('0x0'));var util=require(_0xb09e('0x1'));var moment=require('moment');var BPromise=require(_0xb09e('0x2'));var rs=require(_0xb09e('0x3'));var fs=require('fs');var Redis=require(_0xb09e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb09e('0x5'))(_0xb09e('0x6'));var config=require('../../config/environment');var jayson=require(_0xb09e('0x7'));var client=jayson[_0xb09e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xae62c2,_0x3b6a2,_0xd85de4){return new BPromise(function(_0x19ef9f,_0x4546a5){return client[_0xb09e('0x9')](_0xae62c2,_0xd85de4)[_0xb09e('0xa')](function(_0x436489){logger['info'](_0xb09e('0xb'),_0x3b6a2,_0xb09e('0xc'));logger[_0xb09e('0xd')](_0xb09e('0xe'),_0x3b6a2,'request\x20sent',JSON['stringify'](_0x436489));if(_0x436489['error']){if(_0x436489[_0xb09e('0xf')][_0xb09e('0x10')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x3b6a2,_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);return _0x4546a5(_0x436489['error'][_0xb09e('0x11')]);}logger[_0xb09e('0xf')](_0xb09e('0xb'),_0x3b6a2,_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);return _0x19ef9f(_0x436489[_0xb09e('0xf')][_0xb09e('0x11')]);}else{logger[_0xb09e('0x12')](_0xb09e('0xb'),_0x3b6a2,_0xb09e('0xc'));_0x19ef9f(_0x436489['result'][_0xb09e('0x11')]);}})[_0xb09e('0x13')](function(_0x290074){logger[_0xb09e('0xf')](_0xb09e('0xb'),_0x3b6a2,_0x290074);_0x4546a5(_0x290074);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index db869a9..9d975d1 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 _0xfbc7=['update','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0xfbc7,0x134));var _0x7fbc=function(_0x15ffe4,_0x172ae2){_0x15ffe4=_0x15ffe4-0x0;var _0x29f472=_0xfbc7[_0x15ffe4];return _0x29f472;};'use strict';var multer=require('multer');var util=require(_0x7fbc('0x0'));var path=require(_0x7fbc('0x1'));var timeout=require('connect-timeout');var express=require(_0x7fbc('0x2'));var router=express[_0x7fbc('0x3')]();var auth=require(_0x7fbc('0x4'));var interaction=require(_0x7fbc('0x5'));var config=require(_0x7fbc('0x6'));var controller=require(_0x7fbc('0x7'));router['get']('/',auth[_0x7fbc('0x8')](),controller[_0x7fbc('0x9')]);router[_0x7fbc('0xa')](_0x7fbc('0xb'),auth[_0x7fbc('0x8')](),controller[_0x7fbc('0xc')]);router[_0x7fbc('0xd')]('/',auth[_0x7fbc('0x8')](),controller[_0x7fbc('0xe')]);router['put'](_0x7fbc('0xb'),auth[_0x7fbc('0x8')](),controller[_0x7fbc('0xf')]);router['delete']('/:id',auth[_0x7fbc('0x8')](),controller['destroy']);module[_0x7fbc('0x10')]=router; \ No newline at end of file +var _0xff01=['../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router'];(function(_0x140ba7,_0x2c129c){var _0x120e3b=function(_0x3c2d3a){while(--_0x3c2d3a){_0x140ba7['push'](_0x140ba7['shift']());}};_0x120e3b(++_0x2c129c);}(_0xff01,0xb7));var _0x1ff0=function(_0x1d8ece,_0x255d0d){_0x1d8ece=_0x1d8ece-0x0;var _0x4ee9ca=_0xff01[_0x1d8ece];return _0x4ee9ca;};'use strict';var multer=require(_0x1ff0('0x0'));var util=require(_0x1ff0('0x1'));var path=require('path');var timeout=require(_0x1ff0('0x2'));var express=require('express');var router=express[_0x1ff0('0x3')]();var auth=require(_0x1ff0('0x4'));var interaction=require(_0x1ff0('0x5'));var config=require('../../config/environment');var controller=require(_0x1ff0('0x6'));router['get']('/',auth[_0x1ff0('0x7')](),controller['index']);router[_0x1ff0('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1ff0('0x9')]);router[_0x1ff0('0xa')]('/',auth['isAuthenticated'](),controller[_0x1ff0('0xb')]);router[_0x1ff0('0xc')](_0x1ff0('0xd'),auth[_0x1ff0('0x7')](),controller[_0x1ff0('0xe')]);router['delete'](_0x1ff0('0xd'),auth['isAuthenticated'](),controller[_0x1ff0('0xf')]);module[_0x1ff0('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 8bc2f53..607b6bc 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(_0x4a529b,_0xf6e802){var _0x2bb84f=function(_0x3e9b3f){while(--_0x3e9b3f){_0x4a529b['push'](_0x4a529b['shift']());}};_0x2bb84f(++_0xf6e802);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x5b831c,_0x4260cc){var _0x5ab34d=function(_0xc0dadb){while(--_0xc0dadb){_0x5b831c['push'](_0x5b831c['shift']());}};_0x5ab34d(++_0x4260cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 7098413..afb0026 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 _0xa9e0=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Network','count','includeAll','include','findAll','rows','params','filtears','intersection','find','sequelize','transaction','create','body','STUN','join','server/files/templates/stun_multiple.ejs','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','chan_sip.so','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('Network,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['Network'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':!![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x4f')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x51')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173,_0x14d602){var _0x5bb3ed;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x53d113){return db['Network'][_0x0a9e('0x54')](_0x39d77d['body'],{'raw':!![]})[_0x0a9e('0x2f')](function(_0x4c3845){_0x5bb3ed=_0x4c3845;return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x39d77d[_0x0a9e('0x55')]['type']},'raw':!![]});})[_0x0a9e('0x2f')](function(_0x1bf38a){if(_0x5bb3ed['type']['toUpperCase']()==_0x0a9e('0x56')){var _0x3aedd0=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x58')),'utf8');var _0xe22ccc=ejs['render'](_0x3aedd0,{'networks':_0x1bf38a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xe22ccc);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else if(_0x5bb3ed[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x232830=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x121cef=ejs[_0x0a9e('0x60')](_0x232830,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x62'),_0x121cef);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else{var _0x26bc80=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x63')),'utf8');var _0x4b3c1a=ejs['render'](_0x26bc80,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](util['format'](_0x0a9e('0x64'),_0x39d77d[_0x0a9e('0x55')][_0x0a9e('0x38')][_0x0a9e('0x65')]()),_0x4b3c1a);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x54'),{'module':'chan_sip.so'});}return null;})[_0x0a9e('0x2f')](function(){return _0x5bb3ed;});})['then'](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x22')](handleError(_0x204173,null));};exports[_0x0a9e('0x2e')]=function(_0x51aaf7,_0x5adf8f,_0x453360){var _0x156f1c;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x497d91){return db[_0x0a9e('0x48')][_0x0a9e('0x51')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x2f')](saveUpdates(_0x51aaf7[_0x0a9e('0x55')],null))[_0x0a9e('0x2f')](function(_0x401837){if(_0x401837){_0x156f1c=_0x401837;return db['Network'][_0x0a9e('0x4c')]({'where':{'type':_0x156f1c[_0x0a9e('0x38')]},'raw':!![]});}return null;})[_0x0a9e('0x2f')](function(_0x47bb43){if(_0x156f1c[_0x0a9e('0x38')]['toUpperCase']()=='STUN'){var _0x242745=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0x387489=ejs[_0x0a9e('0x60')](_0x242745,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0x387489);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else if(_0x156f1c[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x2a28c0=fs[_0x0a9e('0x5d')](path['join'](config[_0x0a9e('0x5e')],_0x0a9e('0x67')),_0x0a9e('0x5f'));var _0x4edbb0=ejs[_0x0a9e('0x60')](_0x2a28c0,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x4edbb0);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else{var _0x427946=fs[_0x0a9e('0x5d')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x0a9e('0x5f'));var _0x18bf5d=ejs[_0x0a9e('0x60')](_0x427946,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x51aaf7[_0x0a9e('0x55')][_0x0a9e('0x38')]['toLowerCase']()),_0x18bf5d);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x69')});}return null;})['then'](function(_0x2bdc44){if(_0x2bdc44){return _0x156f1c;}return null;});})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x22')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x30')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7;return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x4c46c1[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](function(_0x371533){_0x2cc7a7=_0x371533;return _0x371533;})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2ed01e,null))['then'](removeEntity(_0x2ed01e,null))[_0x0a9e('0x2f')](function(){if(_0x2cc7a7){return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x2cc7a7[_0x0a9e('0x38')]},'raw':!![]});}})['then'](function(_0x290d43){if(_0x2cc7a7[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x56')){var _0x332367=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0xc4c230=ejs[_0x0a9e('0x60')](_0x332367,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0xc4c230);return respondWithRpcPromise('Reload',_0x0a9e('0x30'),{'module':_0x0a9e('0x5a')});}else if(_0x2cc7a7[_0x0a9e('0x38')]['toUpperCase']()==_0x0a9e('0x5c')){var _0x33dda0=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x2bbdb5=ejs['render'](_0x33dda0,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x2bbdb5);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x28a942=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x63')),_0x0a9e('0x5f'));var _0x444f1f=ejs['render'](_0x28a942,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x4c46c1[_0x0a9e('0x55')]['type'][_0x0a9e('0x65')]()),_0x444f1f);return respondWithRpcPromise(_0x0a9e('0x59'),'destroy',{'module':_0x0a9e('0x69')});}return null;})['catch'](handleError(_0x2ed01e,null));}; \ No newline at end of file +var _0xa9e0=['Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Network','count','includeAll','include','findAll','rows','params','filtears','intersection','find','sequelize','transaction','create','body','STUN','join','server/files/templates/stun_multiple.ejs','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','/etc/asterisk/stun_xcally.conf','server/files/templates/turn_multiple.ejs','format','chan_sip.so','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('Network,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['Network'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':!![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x4f')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x50')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x51')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173,_0x14d602){var _0x5bb3ed;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x53d113){return db['Network'][_0x0a9e('0x54')](_0x39d77d['body'],{'raw':!![]})[_0x0a9e('0x2f')](function(_0x4c3845){_0x5bb3ed=_0x4c3845;return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x39d77d[_0x0a9e('0x55')]['type']},'raw':!![]});})[_0x0a9e('0x2f')](function(_0x1bf38a){if(_0x5bb3ed['type']['toUpperCase']()==_0x0a9e('0x56')){var _0x3aedd0=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x58')),'utf8');var _0xe22ccc=ejs['render'](_0x3aedd0,{'networks':_0x1bf38a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0xe22ccc);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else if(_0x5bb3ed[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x232830=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x121cef=ejs[_0x0a9e('0x60')](_0x232830,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x62'),_0x121cef);return respondWithRpcPromise(_0x0a9e('0x59'),'create',{'module':_0x0a9e('0x5a')});}else{var _0x26bc80=fs['readFileSync'](path[_0x0a9e('0x57')](config['root'],_0x0a9e('0x63')),'utf8');var _0x4b3c1a=ejs['render'](_0x26bc80,{'networks':_0x1bf38a||[]});fs[_0x0a9e('0x61')](util['format'](_0x0a9e('0x64'),_0x39d77d[_0x0a9e('0x55')][_0x0a9e('0x38')][_0x0a9e('0x65')]()),_0x4b3c1a);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x54'),{'module':'chan_sip.so'});}return null;})[_0x0a9e('0x2f')](function(){return _0x5bb3ed;});})['then'](respondWithResult(_0x204173,0xc9))[_0x0a9e('0x22')](handleError(_0x204173,null));};exports[_0x0a9e('0x2e')]=function(_0x51aaf7,_0x5adf8f,_0x453360){var _0x156f1c;return db[_0x0a9e('0x52')][_0x0a9e('0x53')](function(_0x497d91){return db[_0x0a9e('0x48')][_0x0a9e('0x51')]({'where':{'id':_0x51aaf7['params']['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x5adf8f,null))[_0x0a9e('0x2f')](saveUpdates(_0x51aaf7[_0x0a9e('0x55')],null))[_0x0a9e('0x2f')](function(_0x401837){if(_0x401837){_0x156f1c=_0x401837;return db['Network'][_0x0a9e('0x4c')]({'where':{'type':_0x156f1c[_0x0a9e('0x38')]},'raw':!![]});}return null;})[_0x0a9e('0x2f')](function(_0x47bb43){if(_0x156f1c[_0x0a9e('0x38')]['toUpperCase']()=='STUN'){var _0x242745=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0x387489=ejs[_0x0a9e('0x60')](_0x242745,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0x387489);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else if(_0x156f1c[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x5c')){var _0x2a28c0=fs[_0x0a9e('0x5d')](path['join'](config[_0x0a9e('0x5e')],_0x0a9e('0x67')),_0x0a9e('0x5f'));var _0x4edbb0=ejs[_0x0a9e('0x60')](_0x2a28c0,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x4edbb0);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x5a')});}else{var _0x427946=fs[_0x0a9e('0x5d')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x0a9e('0x5f'));var _0x18bf5d=ejs[_0x0a9e('0x60')](_0x427946,{'networks':_0x47bb43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x51aaf7[_0x0a9e('0x55')][_0x0a9e('0x38')]['toLowerCase']()),_0x18bf5d);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x2e'),{'module':_0x0a9e('0x69')});}return null;})['then'](function(_0x2bdc44){if(_0x2bdc44){return _0x156f1c;}return null;});})['then'](respondWithResult(_0x5adf8f,null))[_0x0a9e('0x22')](handleError(_0x5adf8f,null));};exports[_0x0a9e('0x30')]=function(_0x4c46c1,_0x2ed01e,_0x75912a){var _0x2cc7a7;return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x4c46c1[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](function(_0x371533){_0x2cc7a7=_0x371533;return _0x371533;})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2ed01e,null))['then'](removeEntity(_0x2ed01e,null))[_0x0a9e('0x2f')](function(){if(_0x2cc7a7){return db[_0x0a9e('0x48')][_0x0a9e('0x4c')]({'where':{'type':_0x2cc7a7[_0x0a9e('0x38')]},'raw':!![]});}})['then'](function(_0x290d43){if(_0x2cc7a7[_0x0a9e('0x38')][_0x0a9e('0x5b')]()==_0x0a9e('0x56')){var _0x332367=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x58')),_0x0a9e('0x5f'));var _0xc4c230=ejs[_0x0a9e('0x60')](_0x332367,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](_0x0a9e('0x66'),_0xc4c230);return respondWithRpcPromise('Reload',_0x0a9e('0x30'),{'module':_0x0a9e('0x5a')});}else if(_0x2cc7a7[_0x0a9e('0x38')]['toUpperCase']()==_0x0a9e('0x5c')){var _0x33dda0=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x0a9e('0x5f'));var _0x2bbdb5=ejs['render'](_0x33dda0,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')]('/etc/asterisk/turn_xcally.conf',_0x2bbdb5);return respondWithRpcPromise(_0x0a9e('0x59'),_0x0a9e('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x28a942=fs[_0x0a9e('0x5d')](path[_0x0a9e('0x57')](config[_0x0a9e('0x5e')],_0x0a9e('0x63')),_0x0a9e('0x5f'));var _0x444f1f=ejs['render'](_0x28a942,{'networks':_0x290d43||[]});fs[_0x0a9e('0x61')](util[_0x0a9e('0x68')](_0x0a9e('0x64'),_0x4c46c1[_0x0a9e('0x55')]['type'][_0x0a9e('0x65')]()),_0x444f1f);return respondWithRpcPromise(_0x0a9e('0x59'),'destroy',{'module':_0x0a9e('0x69')});}return null;})['catch'](handleError(_0x2ed01e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 33db6f0..97e9f91 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 _0x21e2=['util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Network','lodash'];(function(_0x492145,_0x29e885){var _0x2f8f7f=function(_0x351dc1){while(--_0x351dc1){_0x492145['push'](_0x492145['shift']());}};_0x2f8f7f(++_0x29e885);}(_0x21e2,0x128));var _0x221e=function(_0xa163d,_0x51b3f5){_0xa163d=_0xa163d-0x0;var _0x1bad23=_0x21e2[_0xa163d];return _0x1bad23;};'use strict';var _=require(_0x221e('0x0'));var util=require(_0x221e('0x1'));var logger=require('../../config/logger')(_0x221e('0x2'));var moment=require(_0x221e('0x3'));var BPromise=require(_0x221e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x221e('0x5'));var rimraf=require(_0x221e('0x6'));var config=require(_0x221e('0x7'));var attributes=require('./network.attributes');module[_0x221e('0x8')]=function(_0x938610,_0x58cec4){return _0x938610[_0x221e('0x9')](_0x221e('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b2=['define','Network','network','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5cd26f,_0x5686d8){var _0x379e59=function(_0x4ac480){while(--_0x4ac480){_0x5cd26f['push'](_0x5cd26f['shift']());}};_0x379e59(++_0x5686d8);}(_0x64b2,0xff));var _0x264b=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x64b2[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x264b('0x0'));var util=require(_0x264b('0x1'));var logger=require(_0x264b('0x2'))(_0x264b('0x3'));var moment=require(_0x264b('0x4'));var BPromise=require(_0x264b('0x5'));var rp=require(_0x264b('0x6'));var fs=require('fs');var path=require(_0x264b('0x7'));var rimraf=require(_0x264b('0x8'));var config=require(_0x264b('0x9'));var attributes=require('./network.attributes');module[_0x264b('0xa')]=function(_0x265114,_0x4bd0c7){return _0x265114[_0x264b('0xb')](_0x264b('0xc'),attributes,{'tableName':_0x264b('0xd'),'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 ff5eaaf..1e41ee1 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 _0x52c4=['rpc','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x4f4d8b,_0x5e424c){var _0x36e31e=function(_0x1dda05){while(--_0x1dda05){_0x4f4d8b['push'](_0x4f4d8b['shift']());}};_0x36e31e(++_0x5e424c);}(_0x52c4,0x1b3));var _0x452c=function(_0x17a329,_0x5d2f43){_0x17a329=_0x17a329-0x0;var _0x761387=_0x52c4[_0x17a329];return _0x761387;};'use strict';var _=require(_0x452c('0x0'));var util=require('util');var moment=require(_0x452c('0x1'));var BPromise=require(_0x452c('0x2'));var rs=require(_0x452c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x452c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x452c('0x5'))(_0x452c('0x6'));var config=require('../../config/environment');var jayson=require(_0x452c('0x7'));var client=jayson[_0x452c('0x8')][_0x452c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba5d2,_0x371a68,_0x5ba4fe){return new BPromise(function(_0xb12d97,_0x5ea1e9){return client[_0x452c('0xa')](_0x1ba5d2,_0x5ba4fe)[_0x452c('0xb')](function(_0x3b44bf){logger['info'](_0x452c('0xc'),_0x371a68,'request\x20sent');logger[_0x452c('0xd')](_0x452c('0xe'),_0x371a68,'request\x20sent',JSON[_0x452c('0xf')](_0x3b44bf));if(_0x3b44bf['error']){if(_0x3b44bf[_0x452c('0x10')][_0x452c('0x11')]===0x1f4){logger[_0x452c('0x10')](_0x452c('0xc'),_0x371a68,_0x3b44bf[_0x452c('0x10')][_0x452c('0x12')]);return _0x5ea1e9(_0x3b44bf[_0x452c('0x10')][_0x452c('0x12')]);}logger[_0x452c('0x10')]('Network,\x20%s,\x20%s',_0x371a68,_0x3b44bf[_0x452c('0x10')][_0x452c('0x12')]);return _0xb12d97(_0x3b44bf[_0x452c('0x10')][_0x452c('0x12')]);}else{logger['info'](_0x452c('0xc'),_0x371a68,_0x452c('0x13'));_0xb12d97(_0x3b44bf['result']['message']);}})[_0x452c('0x14')](function(_0x5a951e){logger[_0x452c('0x10')]('Network,\x20%s,\x20%s',_0x371a68,_0x5a951e);_0x5ea1e9(_0x5a951e);});});} \ No newline at end of file +var _0xaf0b=['then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x4aa838,_0x4e38d7){var _0x31c6e1=function(_0x41ed76){while(--_0x41ed76){_0x4aa838['push'](_0x4aa838['shift']());}};_0x31c6e1(++_0x4e38d7);}(_0xaf0b,0x6f));var _0xbaf0=function(_0x106ed1,_0x1730f2){_0x106ed1=_0x106ed1-0x0;var _0x335b60=_0xaf0b[_0x106ed1];return _0x335b60;};'use strict';var _=require(_0xbaf0('0x0'));var util=require('util');var moment=require(_0xbaf0('0x1'));var BPromise=require(_0xbaf0('0x2'));var rs=require(_0xbaf0('0x3'));var fs=require('fs');var Redis=require(_0xbaf0('0x4'));var db=require(_0xbaf0('0x5'))['db'];var utils=require(_0xbaf0('0x6'));var logger=require(_0xbaf0('0x7'))(_0xbaf0('0x8'));var config=require(_0xbaf0('0x9'));var jayson=require(_0xbaf0('0xa'));var client=jayson[_0xbaf0('0xb')][_0xbaf0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c4e24,_0x5ae22f,_0xb2fb0f){return new BPromise(function(_0x430bde,_0x76cd70){return client[_0xbaf0('0xd')](_0x2c4e24,_0xb2fb0f)[_0xbaf0('0xe')](function(_0x42ffb1){logger[_0xbaf0('0xf')](_0xbaf0('0x10'),_0x5ae22f,_0xbaf0('0x11'));logger['debug'](_0xbaf0('0x12'),_0x5ae22f,_0xbaf0('0x11'),JSON[_0xbaf0('0x13')](_0x42ffb1));if(_0x42ffb1['error']){if(_0x42ffb1[_0xbaf0('0x14')][_0xbaf0('0x15')]===0x1f4){logger['error'](_0xbaf0('0x10'),_0x5ae22f,_0x42ffb1[_0xbaf0('0x14')][_0xbaf0('0x16')]);return _0x76cd70(_0x42ffb1[_0xbaf0('0x14')][_0xbaf0('0x16')]);}logger[_0xbaf0('0x14')]('Network,\x20%s,\x20%s',_0x5ae22f,_0x42ffb1[_0xbaf0('0x14')][_0xbaf0('0x16')]);return _0x430bde(_0x42ffb1[_0xbaf0('0x14')][_0xbaf0('0x16')]);}else{logger['info'](_0xbaf0('0x10'),_0x5ae22f,_0xbaf0('0x11'));_0x430bde(_0x42ffb1[_0xbaf0('0x17')][_0xbaf0('0x16')]);}})[_0xbaf0('0x18')](function(_0x52f86e){logger[_0xbaf0('0x14')](_0xbaf0('0x10'),_0x5ae22f,_0x52f86e);_0x76cd70(_0x52f86e);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index cae701b..0971fcf 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 _0x0601=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','exports'];(function(_0x4d0d2d,_0x4b4ca1){var _0x1e1a80=function(_0x3bf93b){while(--_0x3bf93b){_0x4d0d2d['push'](_0x4d0d2d['shift']());}};_0x1e1a80(++_0x4b4ca1);}(_0x0601,0xb0));var _0x1060=function(_0x331173,_0x3ea6ce){_0x331173=_0x331173-0x0;var _0x28cb62=_0x0601[_0x331173];return _0x28cb62;};'use strict';var multer=require(_0x1060('0x0'));var util=require(_0x1060('0x1'));var path=require(_0x1060('0x2'));var timeout=require('connect-timeout');var express=require(_0x1060('0x3'));var router=express[_0x1060('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1060('0x5'));var config=require(_0x1060('0x6'));var controller=require('./notification.controller');router[_0x1060('0x7')]('/',auth[_0x1060('0x8')](),controller[_0x1060('0x9')]);module[_0x1060('0xa')]=router; \ No newline at end of file +var _0xea32=['express','Router','../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util','path','connect-timeout'];(function(_0x210272,_0x202bdb){var _0x4e3fc8=function(_0x5a8468){while(--_0x5a8468){_0x210272['push'](_0x210272['shift']());}};_0x4e3fc8(++_0x202bdb);}(_0xea32,0x1c4));var _0x2ea3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2ea3('0x0'));var util=require(_0x2ea3('0x1'));var path=require(_0x2ea3('0x2'));var timeout=require(_0x2ea3('0x3'));var express=require(_0x2ea3('0x4'));var router=express[_0x2ea3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2ea3('0x6'));var config=require(_0x2ea3('0x7'));var controller=require(_0x2ea3('0x8'));router[_0x2ea3('0x9')]('/',auth[_0x2ea3('0xa')](),controller[_0x2ea3('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 8fb35b6..f2abf99 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 _0xe18a=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe18a,0x155));var _0xae18=function(_0x298f09,_0x1d7e22){_0x298f09=_0x298f09-0x0;var _0x237ebb=_0xe18a[_0x298f09];return _0x237ebb;};'use strict';var Sequelize=require(_0xae18('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xae18('0x1')]},'recipientsDescription':{'type':Sequelize[_0xae18('0x2')]},'beep':{'type':Sequelize[_0xae18('0x3')]}}; \ No newline at end of file +var _0x06ca=['sequelize','exports','TEXT','BOOLEAN'];(function(_0xe2507b,_0x3b5f59){var _0x48c91f=function(_0x308f5f){while(--_0x308f5f){_0xe2507b['push'](_0xe2507b['shift']());}};_0x48c91f(++_0x3b5f59);}(_0x06ca,0x138));var _0xa06c=function(_0x4e79e0,_0x33bd8f){_0x4e79e0=_0x4e79e0-0x0;var _0x11e57d=_0x06ca[_0x4e79e0];return _0x11e57d;};'use strict';var Sequelize=require(_0xa06c('0x0'));module[_0xa06c('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xa06c('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xa06c('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 85a3079..b8d3705 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 _0x570d=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','recipientsId','sortBy','join','sequelize','Notification','create','notification:send','catch','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','toLowerCase','User','ids','replace','queue','Queue','forEach','push','flatten','getAgents','map','html-pdf'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x570d,0x113));var _0xd570=function(_0x5c49b4,_0x4d1512){_0x5c49b4=_0x5c49b4-0x0;var _0x54113d=_0x570d[_0x5c49b4];return _0x54113d;};'use strict';var pdf=require(_0xd570('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd570('0x1'));var zipdir=require(_0xd570('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd570('0x3'));var moment=require(_0xd570('0x4'));var BPromise=require(_0xd570('0x5'));var Mustache=require(_0xd570('0x6'));var util=require(_0xd570('0x7'));var path=require('path');var sox=require(_0xd570('0x8'));var csv=require('to-csv');var ejs=require(_0xd570('0x9'));var fs=require('fs');var _=require(_0xd570('0xa'));var squel=require('squel');var crypto=require(_0xd570('0xb'));var jsforce=require(_0xd570('0xc'));var deskjs=require(_0xd570('0xd'));var toCsv=require(_0xd570('0xe'));var querystring=require(_0xd570('0xf'));var Papa=require(_0xd570('0x10'));var Redis=require(_0xd570('0x11'));var authService=require(_0xd570('0x12'));var qs=require(_0xd570('0x13'));var as=require(_0xd570('0x14'));var hardwareService=require(_0xd570('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd570('0x16'));var config=require(_0xd570('0x17'));var licenseUtil=require(_0xd570('0x18'));var db=require(_0xd570('0x19'))['db'];config['redis']=_['defaults'](config[_0xd570('0x1a')],{'host':_0xd570('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./notification.socket')[_0xd570('0x1c')](socket);function respondWithStatusCode(_0x22fb30,_0xf4988){_0xf4988=_0xf4988||0xcc;return function(_0x276afc){if(_0x276afc){return _0x22fb30[_0xd570('0x1d')](_0xf4988);}return _0x22fb30[_0xd570('0x1e')](_0xf4988)[_0xd570('0x1f')]();};}function respondWithResult(_0x4ead4b,_0x334a26){_0x334a26=_0x334a26||0xc8;return function(_0x339fb9){if(_0x339fb9){return _0x4ead4b[_0xd570('0x1e')](_0x334a26)[_0xd570('0x20')](_0x339fb9);}};}function respondWithFilteredResult(_0x913c65,_0x16f98c){return function(_0x296a24){if(_0x296a24){var _0x9056a1=_0x296a24[_0xd570('0x21')],_0x55b1e7=_0x16f98c['offset'],_0x5be4d3=_0x16f98c['offset']+_0x16f98c[_0xd570('0x22')],_0xe30e2;if(_0x5be4d3>=_0x9056a1){_0x5be4d3=_0x9056a1;_0xe30e2=0xc8;}else{_0xe30e2=0xce;}_0x913c65[_0xd570('0x1e')](_0xe30e2);return _0x913c65[_0xd570('0x23')](_0xd570('0x24'),_0x55b1e7+'-'+_0x5be4d3+'/'+_0x9056a1)['json'](_0x296a24);}return null;};}function patchUpdates(_0x1d0634){return function(_0x4beb4d){try{jsonpatch[_0xd570('0x25')](_0x4beb4d,_0x1d0634,!![]);}catch(_0x59fdd9){return BPromise[_0xd570('0x26')](_0x59fdd9);}return _0x4beb4d[_0xd570('0x27')]();};}function saveUpdates(_0x439ddc,_0x589c3c){return function(_0xdce53){if(_0xdce53){return _0xdce53[_0xd570('0x28')](_0x439ddc)[_0xd570('0x29')](function(_0x11ebbf){return _0x11ebbf;});}return null;};}function removeEntity(_0x55d074,_0x5c81d2){return function(_0x4dab24){if(_0x4dab24){return _0x4dab24['destroy']()[_0xd570('0x29')](function(){_0x55d074[_0xd570('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x405849,_0x28878f){return function(_0x5149c5){if(!_0x5149c5){_0x405849['sendStatus'](0x194);}return _0x5149c5;};}function handleError(_0x4c43a5,_0x452651){_0x452651=_0x452651||0x1f4;return function(_0x5b7bb9){logger[_0xd570('0x2a')](_0x5b7bb9[_0xd570('0x2b')]);if(_0x5b7bb9[_0xd570('0x2c')]){delete _0x5b7bb9[_0xd570('0x2c')];}_0x4c43a5[_0xd570('0x1e')](_0x452651)[_0xd570('0x2d')](_0x5b7bb9);};}exports['sendNotification']=function(_0xa7c326,_0x387637,_0x57fe59){if(!_0xa7c326[_0xd570('0x2e')][_0xd570('0x2f')]('text')&&!_0xa7c326[_0xd570('0x2e')][_0xd570('0x2f')]('TemplateId')){throw new db[(_0xd570('0x30'))][(_0xd570('0x31'))](_0xd570('0x32'));}else{if(_0xa7c326[_0xd570('0x2e')][_0xd570('0x2f')](_0xd570('0x33'))&&!_0xa7c326[_0xd570('0x2e')][_0xd570('0x2f')](_0xd570('0x34'))){throw new db[(_0xd570('0x30'))][(_0xd570('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0xa7c326[_0xd570('0x2e')]['hasOwnProperty'](_0xd570('0x35'))){throw new db['Sequelize'][(_0xd570('0x31'))](_0xd570('0x36'));}else{try{var _0x2796fd=JSON['parse'](_0xa7c326[_0xd570('0x2e')]['recipients']);}catch(_0x12be90){logger['error'](_0x12be90);throw new db[(_0xd570('0x30'))][(_0xd570('0x31'))](_0xd570('0x37'));}var _0x51ad3f=[_0xd570('0x38'),'faxqueue',_0xd570('0x39'),_0xd570('0x3a'),_0xd570('0x3b'),_0xd570('0x3c'),'whatsappqueue','team',_0xd570('0x3d')];if(_['some'](_0x2796fd,function(_0x28725b){return!_[_0xd570('0x3e')](_0x51ad3f,_0x28725b[_0xd570('0x3f')]['toLowerCase']());})){throw new db[(_0xd570('0x30'))][(_0xd570('0x31'))](_0xd570('0x40'));}}}var _0x1c499f={};_0x1c499f[_0xd570('0x41')]=_0xa7c326[_0xd570('0x2e')][_0xd570('0x2f')](_0xd570('0x41'))?_0xa7c326[_0xd570('0x2e')][_0xd570('0x41')]:_0xa7c326[_0xd570('0x3d')]['fullname'];_0x1c499f['recipientsDescription']=_['isEmpty'](_0xa7c326[_0xd570('0x2e')][_0xd570('0x42')])?null:_0xa7c326[_0xd570('0x2e')][_0xd570('0x42')];_0x1c499f['beep']=_0xa7c326[_0xd570('0x2e')]['beep']||![];_0x1c499f['SenderId']=_0xa7c326[_0xd570('0x3d')]['id'];return getContent(_0xa7c326[_0xd570('0x2e')])[_0xd570('0x29')](function(_0x43c01c){_0x1c499f[_0xd570('0x2e')]=_0x43c01c;return getRecipients(_0x2796fd);})[_0xd570('0x29')](function(_0x426949){_0x1c499f[_0xd570('0x43')]=_[_0xd570('0x44')](_0x426949)[_0xd570('0x45')](',');return db[_0xd570('0x46')]['transaction'](function(_0x5b0442){return db[_0xd570('0x47')][_0xd570('0x48')](_0x1c499f,{'raw':!![],'transaction':_0x5b0442})[_0xd570('0x29')](function(_0x581fca){var _0x390195={'sender':_0x1c499f['senderName'],'description':_0x1c499f[_0xd570('0x42')],'content':_0x1c499f['body'],'beep':_0x1c499f['beep']};_0x426949['forEach'](function(_0x1a4e5e){_0x390195['recipient']=_0x1a4e5e;socket['emit'](_0xd570('0x49'),_0x390195);});return _0x581fca;});});})[_0xd570('0x29')](respondWithResult(_0x387637,0xc9))[_0xd570('0x4a')](handleError(_0x387637,null));};function getContent(_0x5cfb83){return new BPromise(function(_0xe44129,_0x32b94d){if(_0x5cfb83[_0xd570('0x4b')]){_0xe44129(_0x5cfb83[_0xd570('0x4b')]);return;}return db[_0xd570('0x4c')][_0xd570('0x4d')]({'attributes':[_0xd570('0x4e')],'where':{'id':_0x5cfb83['TemplateId']},'raw':!![]})[_0xd570('0x29')](function(_0x2ed7ef){if(!_0x2ed7ef)throw new db['Sequelize']['ValidationError'](_0xd570('0x4f'));var _0x5cc523=Mustache[_0xd570('0x50')](_0x2ed7ef['html'],_0x5cfb83[_0xd570('0x34')]);_0xe44129(_0x5cc523);})[_0xd570('0x4a')](function(_0x4e80e4){_0x32b94d(_0x4e80e4);});});}function getRecipients(_0x442333){return new BPromise(function(_0x23a058,_0x22cd28){var _0x3a38ea=[];var _0x3c17cf=[];_0x442333['forEach'](function(_0x3a8709){var _0x244be6=_['startCase'](_0x3a8709['model'][_0xd570('0x51')]());if(_0x244be6===_0xd570('0x52')){_0x3a38ea=_['union'](_0x3a38ea,_0x3a8709[_0xd570('0x53')]);}else{if(_[_0xd570('0x3e')](_0x244be6,'queue'))_0x244be6=_0x244be6[_0xd570('0x54')](_0xd570('0x55'),_0xd570('0x56'));_0x3a8709[_0xd570('0x53')][_0xd570('0x57')](function(_0x4a8560){_0x3c17cf[_0xd570('0x58')](getAgents(_0x244be6,_0x4a8560));});}});return BPromise['all'](_0x3c17cf)[_0xd570('0x29')](function(_0x168368){_0x3a38ea=_['union'](_0x3a38ea,_[_0xd570('0x59')](_0x168368));_0x23a058(_0x3a38ea);})[_0xd570('0x4a')](function(_0x3880ea){_0x22cd28(_0x3880ea);});});}function getAgents(_0x2942c8,_0x427b1e){return new BPromise(function(_0x289cfd,_0x44e505){return db[_0x2942c8][_0xd570('0x4d')]({'where':{'id':_0x427b1e}})['then'](function(_0x244cc5){return _0x244cc5[_0xd570('0x5a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x552569){var _0x2cf8ee=_[_0xd570('0x5b')](_0x552569,'id');_0x289cfd(_0x2cf8ee);});})[_0xd570('0x4a')](function(_0xfe8777){_0x44e505(_0xfe8777);});});} \ No newline at end of file +var _0xc827=['stack','name','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','sortBy','join','sequelize','Notification','create','forEach','emit','notification:send','catch','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','startCase','User','union','ids','queue','push','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','defaults','redis','./notification.socket','register','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','end','error'];(function(_0x2dd390,_0x1bc894){var _0x3afe47=function(_0x42d8d3){while(--_0x42d8d3){_0x2dd390['push'](_0x2dd390['shift']());}};_0x3afe47(++_0x1bc894);}(_0xc827,0xeb));var _0x7c82=function(_0x4afe81,_0x5ca3db){_0x4afe81=_0x4afe81-0x0;var _0x79a307=_0xc827[_0x4afe81];return _0x79a307;};'use strict';var pdf=require(_0x7c82('0x0'));var emlformat=require(_0x7c82('0x1'));var rimraf=require(_0x7c82('0x2'));var zipdir=require(_0x7c82('0x3'));var jsonpatch=require(_0x7c82('0x4'));var rp=require('request-promise');var moment=require(_0x7c82('0x5'));var BPromise=require(_0x7c82('0x6'));var Mustache=require(_0x7c82('0x7'));var util=require(_0x7c82('0x8'));var path=require(_0x7c82('0x9'));var sox=require(_0x7c82('0xa'));var csv=require(_0x7c82('0xb'));var ejs=require(_0x7c82('0xc'));var fs=require('fs');var _=require(_0x7c82('0xd'));var squel=require(_0x7c82('0xe'));var crypto=require(_0x7c82('0xf'));var jsforce=require(_0x7c82('0x10'));var deskjs=require(_0x7c82('0x11'));var toCsv=require(_0x7c82('0xb'));var querystring=require(_0x7c82('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c82('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c82('0x14'));var logger=require('../../config/logger')(_0x7c82('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7c82('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7c82('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c82('0x18')]));require(_0x7c82('0x19'))[_0x7c82('0x1a')](socket);function respondWithStatusCode(_0x3a8fc1,_0x31290c){_0x31290c=_0x31290c||0xcc;return function(_0xbbf516){if(_0xbbf516){return _0x3a8fc1[_0x7c82('0x1b')](_0x31290c);}return _0x3a8fc1[_0x7c82('0x1c')](_0x31290c)['end']();};}function respondWithResult(_0x5e616a,_0x5ded8b){_0x5ded8b=_0x5ded8b||0xc8;return function(_0x25990e){if(_0x25990e){return _0x5e616a['status'](_0x5ded8b)['json'](_0x25990e);}};}function respondWithFilteredResult(_0x47afe1,_0x46f0cc){return function(_0x279e73){if(_0x279e73){var _0x5a1b1f=_0x279e73[_0x7c82('0x1d')],_0x574f63=_0x46f0cc[_0x7c82('0x1e')],_0x1d0b4a=_0x46f0cc[_0x7c82('0x1e')]+_0x46f0cc[_0x7c82('0x1f')],_0x37edc8;if(_0x1d0b4a>=_0x5a1b1f){_0x1d0b4a=_0x5a1b1f;_0x37edc8=0xc8;}else{_0x37edc8=0xce;}_0x47afe1[_0x7c82('0x1c')](_0x37edc8);return _0x47afe1['set'](_0x7c82('0x20'),_0x574f63+'-'+_0x1d0b4a+'/'+_0x5a1b1f)[_0x7c82('0x21')](_0x279e73);}return null;};}function patchUpdates(_0x21988c){return function(_0x5e9402){try{jsonpatch['apply'](_0x5e9402,_0x21988c,!![]);}catch(_0x4deeb4){return BPromise[_0x7c82('0x22')](_0x4deeb4);}return _0x5e9402[_0x7c82('0x23')]();};}function saveUpdates(_0x2edcf4,_0x3b1edf){return function(_0x45d820){if(_0x45d820){return _0x45d820[_0x7c82('0x24')](_0x2edcf4)[_0x7c82('0x25')](function(_0x564886){return _0x564886;});}return null;};}function removeEntity(_0x1cd354,_0x190db3){return function(_0x241a64){if(_0x241a64){return _0x241a64[_0x7c82('0x26')]()[_0x7c82('0x25')](function(){_0x1cd354[_0x7c82('0x1c')](0xcc)[_0x7c82('0x27')]();});}};}function handleEntityNotFound(_0x5b8584,_0xff9dcf){return function(_0x5a2684){if(!_0x5a2684){_0x5b8584[_0x7c82('0x1b')](0x194);}return _0x5a2684;};}function handleError(_0x1ee966,_0x1b8462){_0x1b8462=_0x1b8462||0x1f4;return function(_0x18ee9c){logger[_0x7c82('0x28')](_0x18ee9c[_0x7c82('0x29')]);if(_0x18ee9c[_0x7c82('0x2a')]){delete _0x18ee9c[_0x7c82('0x2a')];}_0x1ee966[_0x7c82('0x1c')](_0x1b8462)['send'](_0x18ee9c);};}exports[_0x7c82('0x2b')]=function(_0x4676b8,_0x28ec69,_0x1d368){if(!_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x2d')](_0x7c82('0x2e'))&&!_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x2d')](_0x7c82('0x2f'))){throw new db[(_0x7c82('0x30'))][(_0x7c82('0x31'))](_0x7c82('0x32'));}else{if(_0x4676b8[_0x7c82('0x2c')]['hasOwnProperty'](_0x7c82('0x2f'))&&!_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x2d')]('view')){throw new db[(_0x7c82('0x30'))][(_0x7c82('0x31'))](_0x7c82('0x33'));}if(!_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x2d')](_0x7c82('0x34'))){throw new db['Sequelize'][(_0x7c82('0x31'))](_0x7c82('0x35'));}else{try{var _0x481cf2=JSON[_0x7c82('0x36')](_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x34')]);}catch(_0x7f46d5){logger[_0x7c82('0x28')](_0x7f46d5);throw new db[(_0x7c82('0x30'))][(_0x7c82('0x31'))](_0x7c82('0x37'));}var _0x1bab57=[_0x7c82('0x38'),_0x7c82('0x39'),'mailqueue','openchannelqueue',_0x7c82('0x3a'),_0x7c82('0x3b'),'whatsappqueue','team',_0x7c82('0x3c')];if(_['some'](_0x481cf2,function(_0xc7e5d){return!_[_0x7c82('0x3d')](_0x1bab57,_0xc7e5d[_0x7c82('0x3e')][_0x7c82('0x3f')]());})){throw new db[(_0x7c82('0x30'))]['ValidationError'](_0x7c82('0x40'));}}}var _0x702524={};_0x702524[_0x7c82('0x41')]=_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x2d')](_0x7c82('0x41'))?_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x41')]:_0x4676b8['user'][_0x7c82('0x42')];_0x702524['recipientsDescription']=_['isEmpty'](_0x4676b8['body']['recipientsDescription'])?null:_0x4676b8[_0x7c82('0x2c')][_0x7c82('0x43')];_0x702524[_0x7c82('0x44')]=_0x4676b8['body'][_0x7c82('0x44')]||![];_0x702524[_0x7c82('0x45')]=_0x4676b8[_0x7c82('0x3c')]['id'];return getContent(_0x4676b8[_0x7c82('0x2c')])['then'](function(_0x858fd1){_0x702524[_0x7c82('0x2c')]=_0x858fd1;return getRecipients(_0x481cf2);})[_0x7c82('0x25')](function(_0x41a078){_0x702524['recipientsId']=_[_0x7c82('0x46')](_0x41a078)[_0x7c82('0x47')](',');return db[_0x7c82('0x48')]['transaction'](function(_0x92b426){return db[_0x7c82('0x49')][_0x7c82('0x4a')](_0x702524,{'raw':!![],'transaction':_0x92b426})[_0x7c82('0x25')](function(_0x105dcf){var _0x463de0={'sender':_0x702524[_0x7c82('0x41')],'description':_0x702524[_0x7c82('0x43')],'content':_0x702524[_0x7c82('0x2c')],'beep':_0x702524[_0x7c82('0x44')]};_0x41a078[_0x7c82('0x4b')](function(_0x14a961){_0x463de0['recipient']=_0x14a961;socket[_0x7c82('0x4c')](_0x7c82('0x4d'),_0x463de0);});return _0x105dcf;});});})[_0x7c82('0x25')](respondWithResult(_0x28ec69,0xc9))[_0x7c82('0x4e')](handleError(_0x28ec69,null));};function getContent(_0x53d78e){return new BPromise(function(_0x1653be,_0x1b5394){if(_0x53d78e[_0x7c82('0x2e')]){_0x1653be(_0x53d78e[_0x7c82('0x2e')]);return;}return db['Template'][_0x7c82('0x4f')]({'attributes':['html'],'where':{'id':_0x53d78e[_0x7c82('0x2f')]},'raw':!![]})[_0x7c82('0x25')](function(_0x28622d){if(!_0x28622d)throw new db['Sequelize'][(_0x7c82('0x31'))](_0x7c82('0x50'));var _0x2b3f43=Mustache[_0x7c82('0x51')](_0x28622d['html'],_0x53d78e[_0x7c82('0x52')]);_0x1653be(_0x2b3f43);})[_0x7c82('0x4e')](function(_0x1c185c){_0x1b5394(_0x1c185c);});});}function getRecipients(_0xfd48f7){return new BPromise(function(_0x4d5983,_0x4a9f2f){var _0x488058=[];var _0x44e18b=[];_0xfd48f7[_0x7c82('0x4b')](function(_0x5a24e4){var _0x12e4ca=_[_0x7c82('0x53')](_0x5a24e4['model']['toLowerCase']());if(_0x12e4ca===_0x7c82('0x54')){_0x488058=_[_0x7c82('0x55')](_0x488058,_0x5a24e4[_0x7c82('0x56')]);}else{if(_['includes'](_0x12e4ca,'queue'))_0x12e4ca=_0x12e4ca['replace'](_0x7c82('0x57'),'Queue');_0x5a24e4[_0x7c82('0x56')]['forEach'](function(_0xb6eeaf){_0x44e18b[_0x7c82('0x58')](getAgents(_0x12e4ca,_0xb6eeaf));});}});return BPromise['all'](_0x44e18b)[_0x7c82('0x25')](function(_0x15c48d){_0x488058=_[_0x7c82('0x55')](_0x488058,_[_0x7c82('0x59')](_0x15c48d));_0x4d5983(_0x488058);})[_0x7c82('0x4e')](function(_0x21f696){_0x4a9f2f(_0x21f696);});});}function getAgents(_0xfb84ae,_0x334e92){return new BPromise(function(_0x2cdcaf,_0x5b1610){return db[_0xfb84ae][_0x7c82('0x4f')]({'where':{'id':_0x334e92}})[_0x7c82('0x25')](function(_0x318a68){return _0x318a68[_0x7c82('0x5a')]({'attributes':['id'],'raw':!![]})[_0x7c82('0x25')](function(_0x10b181){var _0x2aedc8=_[_0x7c82('0x5b')](_0x10b181,'id');_0x2cdcaf(_0x2aedc8);});})[_0x7c82('0x4e')](function(_0x44291f){_0x5b1610(_0x44291f);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 654a81c..d081a54 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x5dc8ad,_0x1aee27){var _0x22cf0e=function(_0x178920){while(--_0x178920){_0x5dc8ad['push'](_0x5dc8ad['shift']());}};_0x22cf0e(++_0x1aee27);}(_0x5f2f,0x73));var _0xf5f2=function(_0x43f6bb,_0x5d3a4b){_0x43f6bb=_0x43f6bb-0x0;var _0xa4a42f=_0x5f2f[_0x43f6bb];return _0xa4a42f;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file +var _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Notification'];(function(_0x13f5a2,_0x435893){var _0x1c2719=function(_0x2e9974){while(--_0x2e9974){_0x13f5a2['push'](_0x13f5a2['shift']());}};_0x1c2719(++_0x435893);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require('events');var Notification=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){NotificationEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);NotificationEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];Notification[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index c31e719..724416f 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 _0xac0d=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4'];(function(_0x93ef1e,_0x3d4bd7){var _0x55c52e=function(_0x452d0a){while(--_0x452d0a){_0x93ef1e['push'](_0x93ef1e['shift']());}};_0x55c52e(++_0x3d4bd7);}(_0xac0d,0x76));var _0xdac0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xac0d[_0x432682];return _0x463d05;};'use strict';var _=require(_0xdac0('0x0'));var util=require(_0xdac0('0x1'));var logger=require(_0xdac0('0x2'))(_0xdac0('0x3'));var moment=require('moment');var BPromise=require(_0xdac0('0x4'));var rp=require(_0xdac0('0x5'));var fs=require('fs');var path=require(_0xdac0('0x6'));var rimraf=require(_0xdac0('0x7'));var config=require(_0xdac0('0x8'));var attributes=require('./notification.attributes');module[_0xdac0('0x9')]=function(_0x20cf0a,_0x486e2f){return _0x20cf0a[_0xdac0('0xa')]('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdac0('0xb'),'collate':_0xdac0('0xc')});}; \ No newline at end of file +var _0xc45a=['path','../../config/environment','exports','define','Notification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x267c84,_0x2b515c){var _0x1170c0=function(_0x39fb32){while(--_0x39fb32){_0x267c84['push'](_0x267c84['shift']());}};_0x1170c0(++_0x2b515c);}(_0xc45a,0x89));var _0xac45=function(_0x243f30,_0x5eabb0){_0x243f30=_0x243f30-0x0;var _0x4c6e03=_0xc45a[_0x243f30];return _0x4c6e03;};'use strict';var _=require(_0xac45('0x0'));var util=require(_0xac45('0x1'));var logger=require(_0xac45('0x2'))(_0xac45('0x3'));var moment=require(_0xac45('0x4'));var BPromise=require(_0xac45('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac45('0x6'));var rimraf=require('rimraf');var config=require(_0xac45('0x7'));var attributes=require('./notification.attributes');module[_0xac45('0x8')]=function(_0x5b06c5,_0x5accb2){return _0x5b06c5[_0xac45('0x9')](_0xac45('0xa'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac45('0xb'),'collate':_0xac45('0xc')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 51d6323..0b027ad 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 _0x2fc7=['error','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s'];(function(_0x247fa0,_0x2f86c2){var _0x42f320=function(_0x16396b){while(--_0x16396b){_0x247fa0['push'](_0x247fa0['shift']());}};_0x42f320(++_0x2f86c2);}(_0x2fc7,0xf8));var _0x72fc=function(_0x27f87c,_0x4d1a82){_0x27f87c=_0x27f87c-0x0;var _0x59f5df=_0x2fc7[_0x27f87c];return _0x59f5df;};'use strict';var _=require(_0x72fc('0x0'));var util=require('util');var moment=require(_0x72fc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72fc('0x2'));var db=require(_0x72fc('0x3'))['db'];var utils=require(_0x72fc('0x4'));var logger=require(_0x72fc('0x5'))(_0x72fc('0x6'));var config=require('../../config/environment');var jayson=require(_0x72fc('0x7'));var client=jayson[_0x72fc('0x8')][_0x72fc('0x9')]({'port':0x232a});config[_0x72fc('0xa')]=_[_0x72fc('0xb')](config[_0x72fc('0xa')],{'host':_0x72fc('0xc'),'port':0x18eb});var socket=require(_0x72fc('0xd'))(new Redis(config[_0x72fc('0xa')]));require(_0x72fc('0xe'))[_0x72fc('0xf')](socket);function respondWithRpcPromise(_0x310712,_0x55d7d0,_0x220fd2){return new BPromise(function(_0x1e9b4d,_0x4ef7da){return client[_0x72fc('0x10')](_0x310712,_0x220fd2)[_0x72fc('0x11')](function(_0x2c824e){logger['info'](_0x72fc('0x12'),_0x55d7d0,_0x72fc('0x13'));logger[_0x72fc('0x14')](_0x72fc('0x15'),_0x55d7d0,_0x72fc('0x13'),JSON['stringify'](_0x2c824e));if(_0x2c824e[_0x72fc('0x16')]){if(_0x2c824e[_0x72fc('0x16')]['code']===0x1f4){logger[_0x72fc('0x16')]('Notification,\x20%s,\x20%s',_0x55d7d0,_0x2c824e[_0x72fc('0x16')][_0x72fc('0x17')]);return _0x4ef7da(_0x2c824e['error'][_0x72fc('0x17')]);}logger[_0x72fc('0x16')]('Notification,\x20%s,\x20%s',_0x55d7d0,_0x2c824e[_0x72fc('0x16')][_0x72fc('0x17')]);return _0x1e9b4d(_0x2c824e[_0x72fc('0x16')][_0x72fc('0x17')]);}else{logger[_0x72fc('0x18')]('Notification,\x20%s,\x20%s',_0x55d7d0,'request\x20sent');_0x1e9b4d(_0x2c824e[_0x72fc('0x19')][_0x72fc('0x17')]);}})[_0x72fc('0x1a')](function(_0x18750e){logger[_0x72fc('0x16')]('Notification,\x20%s,\x20%s',_0x55d7d0,_0x18750e);_0x4ef7da(_0x18750e);});});} \ No newline at end of file +var _0x55fc=['register','request','then','info','debug','stringify','error','code','Notification,\x20%s,\x20%s','message','request\x20sent','result','catch','util','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','socket.io-emitter','redis'];(function(_0x3b35ee,_0xff77e){var _0x48ff9c=function(_0x2eea87){while(--_0x2eea87){_0x3b35ee['push'](_0x3b35ee['shift']());}};_0x48ff9c(++_0xff77e);}(_0x55fc,0x157));var _0xc55f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x55fc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc55f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc55f('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xc55f('0x2'))(_0xc55f('0x3'));var config=require('../../config/environment');var jayson=require(_0xc55f('0x4'));var client=jayson['client'][_0xc55f('0x5')]({'port':0x232a});config['redis']=_[_0xc55f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc55f('0x7'))(new Redis(config[_0xc55f('0x8')]));require('./notification.socket')[_0xc55f('0x9')](socket);function respondWithRpcPromise(_0x40acba,_0x167f6d,_0x80174d){return new BPromise(function(_0x494414,_0x154434){return client[_0xc55f('0xa')](_0x40acba,_0x80174d)[_0xc55f('0xb')](function(_0x2fcf59){logger[_0xc55f('0xc')]('Notification,\x20%s,\x20%s',_0x167f6d,'request\x20sent');logger[_0xc55f('0xd')]('Notification,\x20%s,\x20%s,\x20%s',_0x167f6d,'request\x20sent',JSON[_0xc55f('0xe')](_0x2fcf59));if(_0x2fcf59[_0xc55f('0xf')]){if(_0x2fcf59[_0xc55f('0xf')][_0xc55f('0x10')]===0x1f4){logger[_0xc55f('0xf')](_0xc55f('0x11'),_0x167f6d,_0x2fcf59[_0xc55f('0xf')]['message']);return _0x154434(_0x2fcf59[_0xc55f('0xf')][_0xc55f('0x12')]);}logger[_0xc55f('0xf')]('Notification,\x20%s,\x20%s',_0x167f6d,_0x2fcf59['error'][_0xc55f('0x12')]);return _0x494414(_0x2fcf59[_0xc55f('0xf')][_0xc55f('0x12')]);}else{logger[_0xc55f('0xc')](_0xc55f('0x11'),_0x167f6d,_0xc55f('0x13'));_0x494414(_0x2fcf59[_0xc55f('0x14')][_0xc55f('0x12')]);}})[_0xc55f('0x15')](function(_0x3ab7ed){logger[_0xc55f('0xf')](_0xc55f('0x11'),_0x167f6d,_0x3ab7ed);_0x154434(_0x3ab7ed);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index c55f52e..1826924 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 _0x669a=['remove','update','removeListener','register','length','./notification.events','save'];(function(_0x34d110,_0x5a4e35){var _0x172fbf=function(_0x36a034){while(--_0x36a034){_0x34d110['push'](_0x34d110['shift']());}};_0x172fbf(++_0x5a4e35);}(_0x669a,0x171));var _0xa669=function(_0x1be3b9,_0x46c1dd){_0x1be3b9=_0x1be3b9-0x0;var _0x4c5e51=_0x669a[_0x1be3b9];return _0x4c5e51;};'use strict';var NotificationEvents=require(_0xa669('0x0'));var events=[_0xa669('0x1'),_0xa669('0x2'),_0xa669('0x3')];function createListener(_0xd94c39,_0x4e6e21){return function(_0x2115a9){_0x4e6e21['emit'](_0xd94c39,_0x2115a9);};}function removeListener(_0x1addfd,_0xce1589){return function(){NotificationEvents[_0xa669('0x4')](_0x1addfd,_0xce1589);};}exports[_0xa669('0x5')]=function(_0x29b99a){for(var _0xe7b782=0x0,_0x3c85ab=events[_0xa669('0x6')];_0xe7b782<_0x3c85ab;_0xe7b782++){var _0x3dc449=events[_0xe7b782];var _0x51e729=createListener('notification:'+_0x3dc449,_0x29b99a);NotificationEvents['on'](_0x3dc449,_0x51e729);}}; \ No newline at end of file +var _0xf8d7=['./notification.events','save','remove','update','emit','removeListener','register','length','notification:'];(function(_0x29d261,_0x52122a){var _0x15bab9=function(_0x3ea252){while(--_0x3ea252){_0x29d261['push'](_0x29d261['shift']());}};_0x15bab9(++_0x52122a);}(_0xf8d7,0x1cb));var _0x7f8d=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xf8d7[_0x1f71d8];return _0x10b045;};'use strict';var NotificationEvents=require(_0x7f8d('0x0'));var events=[_0x7f8d('0x1'),_0x7f8d('0x2'),_0x7f8d('0x3')];function createListener(_0x266e6f,_0x21310e){return function(_0x25cdd9){_0x21310e[_0x7f8d('0x4')](_0x266e6f,_0x25cdd9);};}function removeListener(_0x504949,_0x5d967f){return function(){NotificationEvents[_0x7f8d('0x5')](_0x504949,_0x5d967f);};}exports[_0x7f8d('0x6')]=function(_0x103e74){for(var _0x28dd02=0x0,_0x2d0a31=events[_0x7f8d('0x7')];_0x28dd02<_0x2d0a31;_0x28dd02++){var _0x42f3d2=events[_0x28dd02];var _0x38f591=createListener(_0x7f8d('0x8')+_0x42f3d2,_0x103e74);NotificationEvents['on'](_0x42f3d2,_0x38f591);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index d414e07..23a6896 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 _0x19cc=['put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','express','Router','../../config/environment','./openchannelAccount.controller','/describe','get','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','/:id/dispositions','addAnswer','/:id/notify','notify','addAgents'];(function(_0x4744b1,_0x1f53ed){var _0xa1e07=function(_0x3a1e89){while(--_0x3a1e89){_0x4744b1['push'](_0x4744b1['shift']());}};_0xa1e07(++_0x1f53ed);}(_0x19cc,0x168));var _0xc19c=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x19cc[_0x3718b7];return _0xf8c91e;};'use strict';var multer=require(_0xc19c('0x0'));var util=require(_0xc19c('0x1'));var path=require(_0xc19c('0x2'));var timeout=require('connect-timeout');var express=require(_0xc19c('0x3'));var router=express[_0xc19c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc19c('0x5'));var controller=require(_0xc19c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc19c('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xc19c('0x8')]('/:id',auth[_0xc19c('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0xc19c('0x9')](),controller[_0xc19c('0xa')]);router[_0xc19c('0x8')](_0xc19c('0xb'),auth['isAuthenticated'](),controller[_0xc19c('0xc')]);router['get'](_0xc19c('0xd'),auth[_0xc19c('0x9')](),controller['getApplications']);router[_0xc19c('0x8')](_0xc19c('0xe'),auth['isAuthenticated'](),controller[_0xc19c('0xf')]);router[_0xc19c('0x8')](_0xc19c('0x10'),auth['isAuthenticated'](),controller[_0xc19c('0x11')]);router['post']('/',auth[_0xc19c('0x9')](),controller['create']);router[_0xc19c('0x12')](_0xc19c('0x13'),auth[_0xc19c('0x9')](),controller['addDisposition']);router[_0xc19c('0x12')](_0xc19c('0xb'),auth[_0xc19c('0x9')](),controller[_0xc19c('0x14')]);router[_0xc19c('0x12')](_0xc19c('0x15'),controller[_0xc19c('0x16')]);router[_0xc19c('0x12')](_0xc19c('0xd'),auth['isAuthenticated'](),controller['addApplications']);router[_0xc19c('0x12')](_0xc19c('0x10'),auth[_0xc19c('0x9')](),controller[_0xc19c('0x17')]);router[_0xc19c('0x12')]('/:id/send',auth[_0xc19c('0x9')](),controller['send']);router[_0xc19c('0x18')](_0xc19c('0x19'),auth[_0xc19c('0x9')](),controller[_0xc19c('0x1a')]);router[_0xc19c('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xc19c('0x1c')]);router[_0xc19c('0x1b')](_0xc19c('0x13'),auth['isAuthenticated'](),controller[_0xc19c('0x1d')]);router[_0xc19c('0x1b')](_0xc19c('0xb'),auth[_0xc19c('0x9')](),controller[_0xc19c('0x1e')]);router['delete'](_0xc19c('0x10'),auth[_0xc19c('0x9')](),controller['removeAgents']);module[_0xc19c('0x1f')]=router; \ No newline at end of file +var _0x6645=['destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','delete'];(function(_0x1c8e2f,_0x4b4464){var _0x3b099a=function(_0xcfdc17){while(--_0xcfdc17){_0x1c8e2f['push'](_0x1c8e2f['shift']());}};_0x3b099a(++_0x4b4464);}(_0x6645,0x181));var _0x5664=function(_0x5d8d52,_0x412f27){_0x5d8d52=_0x5d8d52-0x0;var _0x4d458c=_0x6645[_0x5d8d52];return _0x4d458c;};'use strict';var multer=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var path=require(_0x5664('0x2'));var timeout=require(_0x5664('0x3'));var express=require(_0x5664('0x4'));var router=express[_0x5664('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5664('0x6'));var config=require(_0x5664('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x5664('0x8')](),controller[_0x5664('0x9')]);router[_0x5664('0xa')](_0x5664('0xb'),auth[_0x5664('0x8')](),controller[_0x5664('0xc')]);router[_0x5664('0xa')](_0x5664('0xd'),auth['isAuthenticated'](),controller[_0x5664('0xe')]);router['get'](_0x5664('0xf'),auth[_0x5664('0x8')](),controller[_0x5664('0x10')]);router[_0x5664('0xa')](_0x5664('0x11'),auth[_0x5664('0x8')](),controller[_0x5664('0x12')]);router['get'](_0x5664('0x13'),auth[_0x5664('0x8')](),controller[_0x5664('0x14')]);router[_0x5664('0xa')](_0x5664('0x15'),auth['isAuthenticated'](),controller[_0x5664('0x16')]);router[_0x5664('0xa')](_0x5664('0x17'),auth[_0x5664('0x8')](),controller['getAgents']);router[_0x5664('0x18')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5664('0x18')](_0x5664('0xf'),auth[_0x5664('0x8')](),controller[_0x5664('0x19')]);router[_0x5664('0x18')]('/:id/canned_answers',auth[_0x5664('0x8')](),controller[_0x5664('0x1a')]);router['post'](_0x5664('0x1b'),controller[_0x5664('0x1c')]);router[_0x5664('0x18')](_0x5664('0x13'),auth[_0x5664('0x8')](),controller[_0x5664('0x1d')]);router[_0x5664('0x18')](_0x5664('0x17'),auth['isAuthenticated'](),controller[_0x5664('0x1e')]);router['post']('/:id/send',auth[_0x5664('0x8')](),controller[_0x5664('0x1f')]);router['put'](_0x5664('0xd'),auth[_0x5664('0x8')](),controller['update']);router[_0x5664('0x20')](_0x5664('0xd'),auth[_0x5664('0x8')](),controller[_0x5664('0x21')]);router[_0x5664('0x20')](_0x5664('0xf'),auth[_0x5664('0x8')](),controller[_0x5664('0x22')]);router['delete'](_0x5664('0x11'),auth[_0x5664('0x8')](),controller[_0x5664('0x23')]);router['delete'](_0x5664('0x17'),auth[_0x5664('0x8')](),controller[_0x5664('0x24')]);module[_0x5664('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 8704617..9bc9df8 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 _0xe6eb=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x239776,_0x46856c){var _0xb2701b=function(_0x4916b4){while(--_0x4916b4){_0x239776['push'](_0x239776['shift']());}};_0xb2701b(++_0x46856c);}(_0xe6eb,0xd3));var _0xbe6e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe6eb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xbe6e('0x0'));var rs=require(_0xbe6e('0x1'));module[_0xbe6e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xbe6e('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xbe6e('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xbe6e('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbe6e('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe6e('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe6e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xbe6e('0x4')]},'queueTransfer':{'type':Sequelize[_0xbe6e('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe6e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe6e('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe6e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe6e('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xbe6e('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbe6e('0x6')],'defaultValue':![],'comment':_0xbe6e('0x9'),'set':function(_0x5b6d8d){if(!_0x5b6d8d)this['setDataValue'](_0xbe6e('0xa'),null);this[_0xbe6e('0xb')](_0xbe6e('0xc'),_0x5b6d8d);}}}; \ No newline at end of file +var _0xd7ad=['randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x1637ad,_0x2d6a20){var _0x5687c5=function(_0x5c4c3d){while(--_0x5c4c3d){_0x1637ad['push'](_0x1637ad['shift']());}};_0x5687c5(++_0x2d6a20);}(_0xd7ad,0x110));var _0xdd7a=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xd7ad[_0x599e60];return _0x468e19;};'use strict';var Sequelize=require(_0xdd7a('0x0'));var rs=require(_0xdd7a('0x1'));module[_0xdd7a('0x2')]={'name':{'type':Sequelize[_0xdd7a('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xdd7a('0x3')],'defaultValue':function(){return rs[_0xdd7a('0x4')]();}},'replyUri':{'type':Sequelize[_0xdd7a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdd7a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdd7a('0x5')],'defaultValue':function(){return _0xdd7a('0x6');}},'notificationSound':{'type':Sequelize[_0xdd7a('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdd7a('0x3')]},'queueTransfer':{'type':Sequelize[_0xdd7a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd7a('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd7a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd7a('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdd7a('0x7')],'defaultValue':![],'comment':_0xdd7a('0x9'),'set':function(_0xfe52e2){if(!_0xfe52e2)this[_0xdd7a('0xa')](_0xdd7a('0xb'),null);this[_0xdd7a('0xa')](_0xdd7a('0xc'),_0xfe52e2);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index fc7dfa8..b778cc8 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 _0x4a3d=['order','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelAccount','includeAll','include','rows','catch','show','params','keys','rawAttributes','filtears','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','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','account','applications','Applications','list','orderBy','asc','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','firstName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','priority','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','status','end','json','count','offset','limit','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x5e96d2,_0x94d7ac){var _0xaecb8e=function(_0x1bac1a){while(--_0x1bac1a){_0x5e96d2['push'](_0x5e96d2['shift']());}};_0xaecb8e(++_0x94d7ac);}(_0x4a3d,0x79));var _0xd4a3=function(_0x12fc65,_0x244643){_0x12fc65=_0x12fc65-0x0;var _0x1aad7d=_0x4a3d[_0x12fc65];return _0x1aad7d;};'use strict';var pdf=require(_0xd4a3('0x0'));var emlformat=require(_0xd4a3('0x1'));var rimraf=require(_0xd4a3('0x2'));var zipdir=require(_0xd4a3('0x3'));var jsonpatch=require(_0xd4a3('0x4'));var rp=require(_0xd4a3('0x5'));var moment=require(_0xd4a3('0x6'));var BPromise=require(_0xd4a3('0x7'));var Mustache=require(_0xd4a3('0x8'));var util=require(_0xd4a3('0x9'));var path=require(_0xd4a3('0xa'));var sox=require(_0xd4a3('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd4a3('0xc'));var squel=require(_0xd4a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd4a3('0xe'));var toCsv=require(_0xd4a3('0xf'));var querystring=require(_0xd4a3('0x10'));var Papa=require(_0xd4a3('0x11'));var Redis=require(_0xd4a3('0x12'));var authService=require(_0xd4a3('0x13'));var qs=require(_0xd4a3('0x14'));var as=require(_0xd4a3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4a3('0x16'))(_0xd4a3('0x17'));var utils=require(_0xd4a3('0x18'));var config=require(_0xd4a3('0x19'));var licenseUtil=require(_0xd4a3('0x1a'));var db=require(_0xd4a3('0x1b'))['db'];config[_0xd4a3('0x1c')]=_['defaults'](config[_0xd4a3('0x1c')],{'host':_0xd4a3('0x1d'),'port':0x18eb});var socket=require(_0xd4a3('0x1e'))(new Redis(config[_0xd4a3('0x1c')]));require(_0xd4a3('0x1f'))[_0xd4a3('0x20')](socket);var jayson=require(_0xd4a3('0x21'));var client=jayson[_0xd4a3('0x22')]['http']({'port':0x232c});var client9002=jayson['client'][_0xd4a3('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2f96bb,_0x124d03,_0xfd502c,_0x1c4dde){return new BPromise(function(_0x454361,_0x4e5e89){var _0x2a3b7e=_0x1c4dde||client;return _0x2a3b7e['request'](_0x2f96bb,_0xfd502c)[_0xd4a3('0x24')](function(_0x592077){logger[_0xd4a3('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x124d03,_0xd4a3('0x26'));logger[_0xd4a3('0x27')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x124d03,_0xd4a3('0x26'),JSON[_0xd4a3('0x28')](_0x592077));if(_0x592077[_0xd4a3('0x29')]){if(_0x592077['error']['code']===0x1f4){logger[_0xd4a3('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x124d03,_0x592077[_0xd4a3('0x29')][_0xd4a3('0x2a')]);return _0x4e5e89(_0x592077['error']['message']);}logger['error'](_0xd4a3('0x2b'),_0x124d03,_0x592077[_0xd4a3('0x29')][_0xd4a3('0x2a')]);return _0x454361(_0x592077['error'][_0xd4a3('0x2a')]);}else{logger[_0xd4a3('0x25')](_0xd4a3('0x2b'),_0x124d03,_0xd4a3('0x26'));_0x454361(_0x592077[_0xd4a3('0x2c')][_0xd4a3('0x2a')]);}})['catch'](function(_0x35a871){logger[_0xd4a3('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x124d03,_0x35a871);_0x4e5e89(_0x35a871);});});}function respondWithStatusCode(_0x2b6cd8,_0x42f100){_0x42f100=_0x42f100||0xcc;return function(_0x26cb96){if(_0x26cb96){return _0x2b6cd8['sendStatus'](_0x42f100);}return _0x2b6cd8[_0xd4a3('0x2d')](_0x42f100)[_0xd4a3('0x2e')]();};}function respondWithResult(_0x20a845,_0x586cd8){_0x586cd8=_0x586cd8||0xc8;return function(_0xd69b56){if(_0xd69b56){return _0x20a845['status'](_0x586cd8)[_0xd4a3('0x2f')](_0xd69b56);}};}function respondWithFilteredResult(_0x523871,_0x3019a4){return function(_0x5d84f2){if(_0x5d84f2){var _0x2769b7=_0x5d84f2[_0xd4a3('0x30')],_0x535ecd=_0x3019a4[_0xd4a3('0x31')],_0x3e471e=_0x3019a4[_0xd4a3('0x31')]+_0x3019a4[_0xd4a3('0x32')],_0x5d1039;if(_0x3e471e>=_0x2769b7){_0x3e471e=_0x2769b7;_0x5d1039=0xc8;}else{_0x5d1039=0xce;}_0x523871[_0xd4a3('0x2d')](_0x5d1039);return _0x523871['set']('Content-Range',_0x535ecd+'-'+_0x3e471e+'/'+_0x2769b7)[_0xd4a3('0x2f')](_0x5d84f2);}return null;};}function patchUpdates(_0xe83b1b){return function(_0x220e0a){try{jsonpatch[_0xd4a3('0x33')](_0x220e0a,_0xe83b1b,!![]);}catch(_0x51840f){return BPromise[_0xd4a3('0x34')](_0x51840f);}return _0x220e0a[_0xd4a3('0x35')]();};}function saveUpdates(_0x515eb6,_0x3ee869){return function(_0x58a0b8){if(_0x58a0b8){return _0x58a0b8[_0xd4a3('0x36')](_0x515eb6)[_0xd4a3('0x24')](function(_0x2794b2){return _0x2794b2;});}return null;};}function removeEntity(_0x372d2a,_0x43746f){return function(_0x119b81){if(_0x119b81){return _0x119b81[_0xd4a3('0x37')]()[_0xd4a3('0x24')](function(){var _0x41a810=_0x119b81['get']({'plain':!![]});var _0x250ca9=_0xd4a3('0x38');return db[_0xd4a3('0x39')]['destroy']({'where':{'type':_0x250ca9,'resourceId':_0x41a810['id']}})[_0xd4a3('0x24')](function(){return _0x119b81;});})[_0xd4a3('0x24')](function(){_0x372d2a[_0xd4a3('0x2d')](0xcc)[_0xd4a3('0x2e')]();});}};}function handleEntityNotFound(_0x3bfb1a,_0x3d2dba){return function(_0x1b8f25){if(!_0x1b8f25){_0x3bfb1a['sendStatus'](0x194);}return _0x1b8f25;};}function handleError(_0x1881fa,_0x539a05){_0x539a05=_0x539a05||0x1f4;return function(_0x5b1610){logger[_0xd4a3('0x29')](_0x5b1610[_0xd4a3('0x3a')]);if(_0x5b1610[_0xd4a3('0x3b')]){delete _0x5b1610[_0xd4a3('0x3b')];}_0x1881fa['status'](_0x539a05)[_0xd4a3('0x3c')](_0x5b1610);};}exports['index']=function(_0x380e73,_0x337c20){var _0xf1c8a4={'include':[{'model':db[_0xd4a3('0x3d')],'as':_0xd4a3('0x3e')}]},_0x19c73a={},_0x4d667a={'count':0x0,'rows':[]};var _0x131ade=_[_0xd4a3('0x3f')](db['OpenchannelAccount']['rawAttributes'],function(_0x17e587){return{'name':_0x17e587[_0xd4a3('0x40')],'type':_0x17e587[_0xd4a3('0x41')][_0xd4a3('0x42')]};});_0x19c73a[_0xd4a3('0x43')]=_[_0xd4a3('0x3f')](_0x131ade,_0xd4a3('0x3b'));_0x19c73a['query']=_['keys'](_0x380e73[_0xd4a3('0x44')]);_0x19c73a[_0xd4a3('0x45')]=_[_0xd4a3('0x46')](_0x19c73a[_0xd4a3('0x43')],_0x19c73a[_0xd4a3('0x44')]);_0xf1c8a4[_0xd4a3('0x47')]=_[_0xd4a3('0x46')](_0x19c73a[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x380e73[_0xd4a3('0x44')]['fields']));_0xf1c8a4[_0xd4a3('0x47')]=_0xf1c8a4[_0xd4a3('0x47')][_0xd4a3('0x49')]?_0xf1c8a4[_0xd4a3('0x47')]:_0x19c73a['model'];if(!_0x380e73[_0xd4a3('0x44')]['hasOwnProperty'](_0xd4a3('0x4a'))){_0xf1c8a4['limit']=qs[_0xd4a3('0x32')](_0x380e73[_0xd4a3('0x44')][_0xd4a3('0x32')]);_0xf1c8a4[_0xd4a3('0x31')]=qs[_0xd4a3('0x31')](_0x380e73['query'][_0xd4a3('0x31')]);}_0xf1c8a4[_0xd4a3('0x4b')]=qs[_0xd4a3('0x4c')](_0x380e73['query'][_0xd4a3('0x4c')]);_0xf1c8a4[_0xd4a3('0x4d')]=qs['filters'](_[_0xd4a3('0x4e')](_0x380e73[_0xd4a3('0x44')],_0x19c73a[_0xd4a3('0x45')]),_0x131ade);if(_0x380e73[_0xd4a3('0x44')][_0xd4a3('0x4f')]){_0xf1c8a4['where']=_['merge'](_0xf1c8a4[_0xd4a3('0x4d')],{'$or':_[_0xd4a3('0x3f')](_0x131ade,function(_0x20e67f){if(_0x20e67f[_0xd4a3('0x41')]!==_0xd4a3('0x50')){var _0x309171={};_0x309171[_0x20e67f[_0xd4a3('0x3b')]]={'$like':'%'+_0x380e73[_0xd4a3('0x44')]['filter']+'%'};return _0x309171;}})});}_0xf1c8a4=_[_0xd4a3('0x51')]({},_0xf1c8a4,_0x380e73[_0xd4a3('0x52')]);var _0x52e74e={'where':_0xf1c8a4['where']};return db[_0xd4a3('0x53')]['count'](_0x52e74e)['then'](function(_0x367a2e){_0x4d667a[_0xd4a3('0x30')]=_0x367a2e;if(_0x380e73[_0xd4a3('0x44')][_0xd4a3('0x54')]){_0xf1c8a4[_0xd4a3('0x55')]=[{'all':!![]}];}return db[_0xd4a3('0x53')]['findAll'](_0xf1c8a4);})['then'](function(_0x58f931){_0x4d667a[_0xd4a3('0x56')]=_0x58f931;return _0x4d667a;})['then'](respondWithFilteredResult(_0x337c20,_0xf1c8a4))[_0xd4a3('0x57')](handleError(_0x337c20,null));};exports[_0xd4a3('0x58')]=function(_0x2cd7d3,_0x8668d){var _0x37cdd3={'raw':![],'where':{'id':_0x2cd7d3[_0xd4a3('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xd4a3('0x3e')}]},_0x1ec9a3={};_0x1ec9a3['model']=_[_0xd4a3('0x5a')](db['OpenchannelAccount'][_0xd4a3('0x5b')]);_0x1ec9a3[_0xd4a3('0x44')]=_['keys'](_0x2cd7d3[_0xd4a3('0x44')]);_0x1ec9a3[_0xd4a3('0x5c')]=_['intersection'](_0x1ec9a3[_0xd4a3('0x43')],_0x1ec9a3[_0xd4a3('0x44')]);_0x37cdd3[_0xd4a3('0x47')]=_['intersection'](_0x1ec9a3[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x2cd7d3[_0xd4a3('0x44')]['fields']));_0x37cdd3[_0xd4a3('0x47')]=_0x37cdd3[_0xd4a3('0x47')]['length']?_0x37cdd3[_0xd4a3('0x47')]:_0x1ec9a3[_0xd4a3('0x43')];if(_0x2cd7d3[_0xd4a3('0x44')][_0xd4a3('0x54')]){_0x37cdd3[_0xd4a3('0x55')]=[{'all':!![]}];}_0x37cdd3=_[_0xd4a3('0x51')]({},_0x37cdd3,_0x2cd7d3['options']);return db[_0xd4a3('0x53')][_0xd4a3('0x5d')](_0x37cdd3)[_0xd4a3('0x24')](handleEntityNotFound(_0x8668d,null))[_0xd4a3('0x24')](respondWithResult(_0x8668d,null))[_0xd4a3('0x57')](handleError(_0x8668d,null));};exports[_0xd4a3('0x5e')]=function(_0x4486a9,_0x60962d){return db[_0xd4a3('0x53')][_0xd4a3('0x5e')](_0x4486a9[_0xd4a3('0x5f')],{})[_0xd4a3('0x24')](function(_0x3da583){var _0x12dd4c=_0x4486a9[_0xd4a3('0x60')][_0xd4a3('0x61')]({'plain':!![]});if(!_0x12dd4c)throw new Error(_0xd4a3('0x62'));if(_0x12dd4c[_0xd4a3('0x63')]==='user'){var _0x25f94f=_0x3da583[_0xd4a3('0x61')]({'plain':!![]});var _0x1aec50=_0xd4a3('0x38');return db[_0xd4a3('0x64')][_0xd4a3('0x5d')]({'where':{'name':_0x1aec50,'userProfileId':_0x12dd4c[_0xd4a3('0x65')]},'raw':!![]})['then'](function(_0x572f29){if(_0x572f29&&_0x572f29[_0xd4a3('0x66')]===0x0){return db['UserProfileResource'][_0xd4a3('0x5e')]({'name':_0x25f94f[_0xd4a3('0x3b')],'resourceId':_0x25f94f['id'],'type':_0x572f29[_0xd4a3('0x3b')],'sectionId':_0x572f29['id']},{})[_0xd4a3('0x24')](function(){return _0x3da583;});}else{return _0x3da583;}})[_0xd4a3('0x57')](function(_0x487b95){logger['error'](_0xd4a3('0x67'),_0x487b95);throw _0x487b95;});}return _0x3da583;})[_0xd4a3('0x24')](respondWithResult(_0x60962d,0xc9))[_0xd4a3('0x57')](handleError(_0x60962d,null));};exports[_0xd4a3('0x36')]=function(_0x487dd2,_0x575a92){if(_0x487dd2[_0xd4a3('0x5f')]['id']){delete _0x487dd2[_0xd4a3('0x5f')]['id'];}return db[_0xd4a3('0x53')]['find']({'where':{'id':_0x487dd2['params']['id']},'include':[{'model':db['Pause'],'as':_0xd4a3('0x3e')}]})['then'](handleEntityNotFound(_0x575a92,null))[_0xd4a3('0x24')](saveUpdates(_0x487dd2[_0xd4a3('0x5f')],null))[_0xd4a3('0x24')](respondWithResult(_0x575a92,null))[_0xd4a3('0x57')](handleError(_0x575a92,null));};exports['destroy']=function(_0x2d152c,_0x4193be){return db['OpenchannelAccount'][_0xd4a3('0x5d')]({'where':{'id':_0x2d152c[_0xd4a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x4193be,null))['then'](removeEntity(_0x4193be,null))['catch'](handleError(_0x4193be,null));};exports[_0xd4a3('0x68')]=function(_0x3b5037,_0x3228c0){return db[_0xd4a3('0x53')][_0xd4a3('0x68')]()[_0xd4a3('0x24')](respondWithResult(_0x3228c0,null))['catch'](handleError(_0x3228c0,null));};exports[_0xd4a3('0x69')]=function(_0x5ab4c0,_0x523fe9,_0x4b48d8){if(_0x5ab4c0[_0xd4a3('0x5f')]['id']){delete _0x5ab4c0[_0xd4a3('0x5f')]['id'];}return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x5ab4c0[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x523fe9,null))[_0xd4a3('0x24')](function(_0x4e5e54){if(_0x4e5e54){_0x5ab4c0[_0xd4a3('0x5f')][_0xd4a3('0x6a')]=_0x4e5e54['id'];return db[_0xd4a3('0x6b')][_0xd4a3('0x5e')](_0x5ab4c0[_0xd4a3('0x5f')]);}})[_0xd4a3('0x24')](respondWithResult(_0x523fe9,null))[_0xd4a3('0x57')](handleError(_0x523fe9,null));};exports[_0xd4a3('0x6c')]=function(_0x2a0b97,_0x320c05,_0x49f4c5){var _0x446d14={'raw':![],'where':{}};var _0x5b688e={};var _0xc80536={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2a0b97['params']['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x320c05,null))[_0xd4a3('0x24')](function(_0x375edd){if(_0x375edd){_0x5b688e['model']=_[_0xd4a3('0x5a')](db['Disposition'][_0xd4a3('0x5b')]);_0x5b688e[_0xd4a3('0x44')]=_[_0xd4a3('0x5a')](_0x2a0b97[_0xd4a3('0x44')]);_0x5b688e['filters']=_[_0xd4a3('0x46')](_0x5b688e[_0xd4a3('0x43')],_0x5b688e[_0xd4a3('0x44')]);_0x446d14[_0xd4a3('0x47')]=_['intersection'](_0x5b688e['model'],qs[_0xd4a3('0x48')](_0x2a0b97[_0xd4a3('0x44')][_0xd4a3('0x48')]));_0x446d14[_0xd4a3('0x47')]=_0x446d14['attributes'][_0xd4a3('0x49')]?_0x446d14['attributes']:_0x5b688e['model'];if(!_0x2a0b97[_0xd4a3('0x44')][_0xd4a3('0x6d')](_0xd4a3('0x4a'))){_0x446d14[_0xd4a3('0x32')]=qs[_0xd4a3('0x32')](_0x2a0b97['query']['limit']);_0x446d14['offset']=qs[_0xd4a3('0x31')](_0x2a0b97[_0xd4a3('0x44')]['offset']);}_0x446d14[_0xd4a3('0x4b')]=qs[_0xd4a3('0x4c')](_0x2a0b97['query'][_0xd4a3('0x4c')]);_0x446d14[_0xd4a3('0x4d')]=qs['filters'](_['pick'](_0x2a0b97[_0xd4a3('0x44')],_0x5b688e[_0xd4a3('0x45')]));_0x446d14[_0xd4a3('0x4d')]['OpenchannelAccountId']=_0x375edd['id'];if(_0x2a0b97[_0xd4a3('0x44')][_0xd4a3('0x4f')]){_0x446d14[_0xd4a3('0x4d')]=_[_0xd4a3('0x51')](_0x446d14[_0xd4a3('0x4d')],{'$or':_[_0xd4a3('0x3f')](_0x446d14[_0xd4a3('0x47')],function(_0x2acd19){var _0xa019d4={};_0xa019d4[_0x2acd19]={'$like':'%'+_0x2a0b97[_0xd4a3('0x44')][_0xd4a3('0x4f')]+'%'};return _0xa019d4;})});}_0x446d14=_['merge']({},_0x446d14,_0x2a0b97[_0xd4a3('0x52')]);return db[_0xd4a3('0x6b')]['count']({'where':_0x446d14[_0xd4a3('0x4d')]})[_0xd4a3('0x24')](function(_0x4e3be0){_0xc80536[_0xd4a3('0x30')]=_0x4e3be0;if(_0x2a0b97[_0xd4a3('0x44')][_0xd4a3('0x54')]){_0x446d14[_0xd4a3('0x55')]=[{'all':!![]}];}return db[_0xd4a3('0x6b')]['findAll'](_0x446d14);})[_0xd4a3('0x24')](function(_0x583fec){_0xc80536['rows']=_0x583fec;return _0xc80536;});}})[_0xd4a3('0x24')](respondWithFilteredResult(_0x320c05,_0x446d14))[_0xd4a3('0x57')](handleError(_0x320c05,null));};exports[_0xd4a3('0x6e')]=function(_0x5ab6c4,_0x552cfe,_0x34bd67){return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x5ab6c4[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x552cfe,null))[_0xd4a3('0x24')](function(_0x3a9d06){if(_0x3a9d06){return _0x3a9d06['removeDispositions'](_0x5ab6c4[_0xd4a3('0x44')]['ids']);}})[_0xd4a3('0x24')](respondWithStatusCode(_0x552cfe,null))[_0xd4a3('0x57')](handleError(_0x552cfe,null));};exports[_0xd4a3('0x6f')]=function(_0x43a5b9,_0x20e0e7,_0x52e1ad){if(_0x43a5b9[_0xd4a3('0x5f')]['id']){delete _0x43a5b9[_0xd4a3('0x5f')]['id'];}return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x43a5b9[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x20e0e7,null))[_0xd4a3('0x24')](function(_0x5599fc){if(_0x5599fc){_0x43a5b9['body'][_0xd4a3('0x6a')]=_0x5599fc['id'];return db[_0xd4a3('0x70')]['create'](_0x43a5b9[_0xd4a3('0x5f')]);}})[_0xd4a3('0x24')](respondWithResult(_0x20e0e7,null))[_0xd4a3('0x57')](handleError(_0x20e0e7,null));};exports[_0xd4a3('0x71')]=function(_0x3be3fe,_0xa5758c,_0x551cae){var _0x3efa19={'raw':![],'where':{}};var _0x1e2e61={};var _0x312c41={'count':0x0,'rows':[]};return db[_0xd4a3('0x53')][_0xd4a3('0x72')]({'where':{'id':_0x3be3fe[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0xa5758c,null))['then'](function(_0x521b6d){if(_0x521b6d){_0x1e2e61['model']=_[_0xd4a3('0x5a')](db[_0xd4a3('0x70')][_0xd4a3('0x5b')]);_0x1e2e61[_0xd4a3('0x44')]=_[_0xd4a3('0x5a')](_0x3be3fe[_0xd4a3('0x44')]);_0x1e2e61['filters']=_[_0xd4a3('0x46')](_0x1e2e61[_0xd4a3('0x43')],_0x1e2e61[_0xd4a3('0x44')]);_0x3efa19[_0xd4a3('0x47')]=_[_0xd4a3('0x46')](_0x1e2e61[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x3be3fe['query'][_0xd4a3('0x48')]));_0x3efa19['attributes']=_0x3efa19[_0xd4a3('0x47')]['length']?_0x3efa19['attributes']:_0x1e2e61['model'];if(!_0x3be3fe[_0xd4a3('0x44')][_0xd4a3('0x6d')](_0xd4a3('0x4a'))){_0x3efa19[_0xd4a3('0x32')]=qs[_0xd4a3('0x32')](_0x3be3fe[_0xd4a3('0x44')][_0xd4a3('0x32')]);_0x3efa19['offset']=qs[_0xd4a3('0x31')](_0x3be3fe['query'][_0xd4a3('0x31')]);}_0x3efa19[_0xd4a3('0x4b')]=qs[_0xd4a3('0x4c')](_0x3be3fe[_0xd4a3('0x44')][_0xd4a3('0x4c')]);_0x3efa19[_0xd4a3('0x4d')]=qs[_0xd4a3('0x45')](_['pick'](_0x3be3fe[_0xd4a3('0x44')],_0x1e2e61[_0xd4a3('0x45')]));_0x3efa19[_0xd4a3('0x4d')][_0xd4a3('0x6a')]=_0x521b6d['id'];if(_0x3be3fe[_0xd4a3('0x44')][_0xd4a3('0x4f')]){_0x3efa19['where']=_[_0xd4a3('0x51')](_0x3efa19[_0xd4a3('0x4d')],{'$or':_[_0xd4a3('0x3f')](_0x3efa19[_0xd4a3('0x47')],function(_0x532398){var _0x1b002e={};_0x1b002e[_0x532398]={'$like':'%'+_0x3be3fe['query']['filter']+'%'};return _0x1b002e;})});}_0x3efa19=_['merge']({},_0x3efa19,_0x3be3fe[_0xd4a3('0x52')]);return db[_0xd4a3('0x70')][_0xd4a3('0x30')]({'where':_0x3efa19[_0xd4a3('0x4d')]})['then'](function(_0x2faa1f){_0x312c41['count']=_0x2faa1f;if(_0x3be3fe['query'][_0xd4a3('0x54')]){_0x3efa19[_0xd4a3('0x55')]=[{'all':!![]}];}return db[_0xd4a3('0x70')][_0xd4a3('0x73')](_0x3efa19);})[_0xd4a3('0x24')](function(_0x186aa4){_0x312c41[_0xd4a3('0x56')]=_0x186aa4;return _0x312c41;});}})[_0xd4a3('0x24')](respondWithFilteredResult(_0xa5758c,_0x3efa19))['catch'](handleError(_0xa5758c,null));};exports[_0xd4a3('0x74')]=function(_0x3766ec,_0x688288,_0x1b0ecd){return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x3766ec[_0xd4a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x688288,null))['then'](function(_0x1eb070){if(_0x1eb070){return _0x1eb070[_0xd4a3('0x74')](_0x3766ec[_0xd4a3('0x44')][_0xd4a3('0x75')]);}})[_0xd4a3('0x24')](respondWithStatusCode(_0x688288,null))['catch'](handleError(_0x688288,null));};exports[_0xd4a3('0x76')]=function(_0x38b733,_0x4539d7,_0x400a26){var _0x36d1e3={'body':_0x38b733[_0xd4a3('0x5f')],'channel':_0xd4a3('0x77')};var _0x42cf72=[];var _0x116039=[];var _0x5a8d90={};var _0x1ca199=![];return db[_0xd4a3('0x78')]['describe']()[_0xd4a3('0x24')](function(_0x5c7e62){if(!_0x5c7e62){throw new db[(_0xd4a3('0x79'))][(_0xd4a3('0x7a'))](_0xd4a3('0x7b'));}_0x42cf72=_['difference'](_[_0xd4a3('0x5a')](_0x5c7e62),[_0xd4a3('0x7c'),_0xd4a3('0x7d')]);_0x116039=_[_0xd4a3('0x7e')](_[_0xd4a3('0x5a')](_0x5c7e62),[_0xd4a3('0x7c'),_0xd4a3('0x7d'),_0xd4a3('0x7f'),_0xd4a3('0x80')]);if(_0x38b733[_0xd4a3('0x5f')]['id']){delete _0x38b733[_0xd4a3('0x5f')]['id'];}if(_[_0xd4a3('0x81')](_0x38b733['body'][_0xd4a3('0x82')])){throw new db[(_0xd4a3('0x79'))][(_0xd4a3('0x7a'))](_0xd4a3('0x83'));}if(_['isNil'](_0x38b733['body'][_0xd4a3('0x5f')])||_0x38b733[_0xd4a3('0x5f')]['body']===''){throw new db['Sequelize'][(_0xd4a3('0x7a'))](_0xd4a3('0x84'));}if(_[_0xd4a3('0x81')](_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x85')])){throw new db[(_0xd4a3('0x79'))][(_0xd4a3('0x7a'))](_0xd4a3('0x86')+_0x116039);}if(!_[_0xd4a3('0x87')](_0x116039,_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x85')])){throw new db[(_0xd4a3('0x79'))][(_0xd4a3('0x7a'))](_0xd4a3('0x88')+_0x116039);}_0x5a8d90[_0x38b733['body']['mapKey']]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x82')];})[_0xd4a3('0x24')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x38b733[_0xd4a3('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xd4a3('0x89'),'include':[{'model':db['CmContact'],'as':_0xd4a3('0x8a'),'where':_0x5a8d90,'limit':0x1,'order':[[_0xd4a3('0x7d'),'DESC']]}]},{'model':db[_0xd4a3('0x8b')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x4539d7,null))[_0xd4a3('0x24')](function(_0x55a9b3){if(_0x55a9b3&&_0x55a9b3[_0xd4a3('0x89')]){_0x36d1e3[_0xd4a3('0x8c')]=_0x55a9b3;_0x36d1e3[_0xd4a3('0x8d')]=_0x55a9b3[_0xd4a3('0x8e')];_0x36d1e3[_0xd4a3('0x8f')]=_0x55a9b3[_0xd4a3('0x89')];_0x36d1e3[_0xd4a3('0x8d')]=_[_0xd4a3('0x90')](_0x36d1e3[_0xd4a3('0x8d')],['priority'],[_0xd4a3('0x91')]);if(_0x36d1e3[_0xd4a3('0x8c')]['Applications']){delete _0x36d1e3[_0xd4a3('0x8c')][_0xd4a3('0x8e')];}if(_0x36d1e3[_0xd4a3('0x8c')]['List']&&_0x36d1e3['account'][_0xd4a3('0x89')][_0xd4a3('0x8a')][_0xd4a3('0x49')]){return _0x36d1e3[_0xd4a3('0x8c')][_0xd4a3('0x89')][_0xd4a3('0x8a')][0x0];}var _0x210167=_[_0xd4a3('0x92')](_0x38b733['body'],{'firstName':_0x38b733[_0xd4a3('0x5f')]['from'],'ListId':_0x55a9b3[_0xd4a3('0x80')]});_0x210167[_0x38b733['body'][_0xd4a3('0x85')]]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x82')];return db[_0xd4a3('0x78')][_0xd4a3('0x5e')](_0x210167,{'fields':_0x42cf72,'raw':!![]});}})[_0xd4a3('0x24')](handleEntityNotFound(_0x4539d7,null))['then'](function(_0x1a04fa){_0x36d1e3[_0xd4a3('0x93')]=_0x1a04fa;if(_0x1a04fa){var _0x176a38={'ContactId':_0x1a04fa['id'],'OpenchannelAccountId':_0x38b733[_0xd4a3('0x59')]['id'],'from':(_0x1a04fa['firstName']||'')+'\x20'+(_0x1a04fa[_0xd4a3('0x94')]||'')};var _0x239540={'OpenchannelAccountId':_0x38b733[_0xd4a3('0x59')]['id'],'closed':![]};if(_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x95')]){_0x239540[_0xd4a3('0x95')]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x95')];return db[_0xd4a3('0x96')][_0xd4a3('0x5d')]({'where':_0x239540})[_0xd4a3('0x24')](function(_0x54f187){if(_0x54f187){return[_0x54f187,![]];}_0x176a38[_0xd4a3('0x95')]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x95')];_0x176a38[_0xd4a3('0x97')]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x97')];return db['OpenchannelInteraction']['create'](_0x176a38)['then'](function(_0x42d828){return[_0x42d828,!![]];});});}else{_0x239540['threadId']=null;}_0x239540[_0xd4a3('0x98')]=_0x1a04fa['id'];return db[_0xd4a3('0x96')][_0xd4a3('0x5d')]({'where':_0x239540})['then'](function(_0xaf00ef){if(_0xaf00ef){return[_0xaf00ef,![]];}return db[_0xd4a3('0x96')][_0xd4a3('0x5e')](_0x176a38)[_0xd4a3('0x24')](function(_0x44aa05){return[_0x44aa05,!![]];});});}})['spread'](function(_0x44b1e8,_0x548f63){if(_0x44b1e8){_0x1ca199=_0x548f63;if(!_0x548f63){var _0x31b809={'from':(_0x36d1e3[_0xd4a3('0x93')][_0xd4a3('0x99')]||'')+'\x20'+(_0x36d1e3[_0xd4a3('0x93')][_0xd4a3('0x94')]||'')};if(_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x95')]&&_0x38b733['body'][_0xd4a3('0x9a')]&&_0x38b733[_0xd4a3('0x5f')]['threadId']!=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x9a')]){_0x31b809[_0xd4a3('0x95')]=_0x38b733[_0xd4a3('0x5f')][_0xd4a3('0x9a')];}return _0x44b1e8[_0xd4a3('0x36')](_0x31b809);}else{return _0x44b1e8;}}})[_0xd4a3('0x24')](function(_0x1cfd74){_0x36d1e3[_0xd4a3('0x9b')]=_0x1cfd74[_0xd4a3('0x61')]({'plain':!![]});_0x36d1e3[_0xd4a3('0x9b')][_0xd4a3('0x9c')]=_0x1ca199;if(_0x36d1e3[_0xd4a3('0x9b')][_0xd4a3('0x9c')]){if(_0x36d1e3['account'][_0xd4a3('0x9d')]){_0x36d1e3[_0xd4a3('0x8d')][_0xd4a3('0x9e')]({'id':0x0,'priority':_0x36d1e3[_0xd4a3('0x8d')][_0xd4a3('0x49')]+0x1,'app':_0xd4a3('0x9f'),'appdata':_0xd4a3('0xa0'),'interval':_0xd4a3('0xa1')});}}return db[_0xd4a3('0xa2')]['create']({'body':_0x38b733['body'][_0xd4a3('0x5f')],'OpenchannelAccountId':_0x38b733['params']['id'],'OpenchannelInteractionId':_0x1cfd74['id'],'direction':'in','ContactId':_0x36d1e3[_0xd4a3('0x93')]['id'],'AttachmentId':_0x38b733['body'][_0xd4a3('0xa3')]});})['then'](function(_0x9d371){_0x36d1e3[_0xd4a3('0x2a')]=_0x9d371;if(_0x36d1e3[_0xd4a3('0x9b')][_0xd4a3('0xa4')]){return db[_0xd4a3('0xa5')]['find']({'attributes':['id',_0xd4a3('0x3b')],'where':{'id':_0x36d1e3[_0xd4a3('0x9b')][_0xd4a3('0xa4')]}})[_0xd4a3('0x24')](function(_0x5086a2){if(_0x5086a2){_0x36d1e3[_0xd4a3('0x8d')][_0xd4a3('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5086a2[_0xd4a3('0x3b')]+','+(_0x36d1e3[_0xd4a3('0x8c')][_0xd4a3('0xa7')]||0xa),'interval':'*,*,*,*'});_0x36d1e3[_0xd4a3('0xa8')]=![];}return respondWithRpcPromise(_0xd4a3('0xa9'),_0xd4a3('0xaa'),_0x36d1e3);});}return respondWithRpcPromise('Start',_0xd4a3('0xaa'),_0x36d1e3);})[_0xd4a3('0x24')](function(_0x3d9e85){respondWithRpcPromise(_0xd4a3('0xab'),'EventManager',{'event':_0xd4a3('0x76'),'message':_0x3d9e85},client9002);return _0x3d9e85;})['then'](respondWithResult(_0x4539d7,null))[_0xd4a3('0x57')](handleError(_0x4539d7,null));};exports['addApplications']=function(_0x262208,_0x3476bc,_0x4e8b77){return db['OpenchannelAccount'][_0xd4a3('0x72')]({'where':{'id':_0x262208['params']['id']}})['then'](handleEntityNotFound(_0x3476bc,null))[_0xd4a3('0x24')](function(_0x3cd26c){if(_0x3cd26c){return db[_0xd4a3('0xac')]['transaction'](function(_0x18c9f3){return db[_0xd4a3('0x8b')][_0xd4a3('0x37')]({'where':{'OpenchannelAccountId':_0x262208[_0xd4a3('0x59')]['id']},'transaction':_0x18c9f3})[_0xd4a3('0x24')](function(_0x3c912c){var _0x2f610a=_[_0xd4a3('0x3f')](_0x262208[_0xd4a3('0x5f')],function(_0x196287){_0x196287[_0xd4a3('0x6a')]=_0x262208[_0xd4a3('0x59')]['id'];return _0x196287;});return db[_0xd4a3('0x8b')]['bulkCreate'](_0x2f610a,{'transaction':_0x18c9f3});});})[_0xd4a3('0x24')](function(){return db[_0xd4a3('0x8b')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x262208[_0xd4a3('0x59')]['id']},'order':_0xd4a3('0xad')});});}})[_0xd4a3('0x24')](respondWithResult(_0x3476bc,null))[_0xd4a3('0x57')](handleError(_0x3476bc,null));};exports[_0xd4a3('0xae')]=function(_0x5f0dfc,_0x575f2b,_0x2b494e){var _0x4836d8={};var _0x836ebc={};var _0x4ab034;var _0x1ac592;return db[_0xd4a3('0x53')][_0xd4a3('0x72')]({'where':{'id':_0x5f0dfc['params']['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x575f2b,null))[_0xd4a3('0x24')](function(_0xd2e64e){if(_0xd2e64e){_0x4ab034=_0xd2e64e;_0x836ebc['model']=_[_0xd4a3('0x5a')](db[_0xd4a3('0x8b')][_0xd4a3('0x5b')]);_0x836ebc[_0xd4a3('0x44')]=_[_0xd4a3('0x5a')](_0x5f0dfc[_0xd4a3('0x44')]);_0x836ebc[_0xd4a3('0x45')]=_['intersection'](_0x836ebc[_0xd4a3('0x43')],_0x836ebc[_0xd4a3('0x44')]);_0x4836d8['attributes']=_[_0xd4a3('0x46')](_0x836ebc[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x5f0dfc[_0xd4a3('0x44')]['fields']));_0x4836d8[_0xd4a3('0x47')]=_0x4836d8['attributes'][_0xd4a3('0x49')]?_0x4836d8[_0xd4a3('0x47')]:_0x836ebc[_0xd4a3('0x43')];_0x4836d8[_0xd4a3('0x4b')]=qs[_0xd4a3('0x4c')](_0x5f0dfc[_0xd4a3('0x44')][_0xd4a3('0x4c')]);_0x4836d8[_0xd4a3('0x4d')]=qs[_0xd4a3('0x45')](_['pick'](_0x5f0dfc[_0xd4a3('0x44')],_0x836ebc['filters']));if(_0x5f0dfc[_0xd4a3('0x44')][_0xd4a3('0x4f')]){_0x4836d8[_0xd4a3('0x4d')]=_[_0xd4a3('0x51')](_0x4836d8[_0xd4a3('0x4d')],{'$or':_[_0xd4a3('0x3f')](_0x4836d8[_0xd4a3('0x47')],function(_0x4afeeb){var _0x46810b={};_0x46810b[_0x4afeeb]={'$like':'%'+_0x5f0dfc[_0xd4a3('0x44')][_0xd4a3('0x4f')]+'%'};return _0x46810b;})});}_0x4836d8=_['merge']({},_0x4836d8,_0x5f0dfc[_0xd4a3('0x52')]);return _0x4ab034[_0xd4a3('0xae')](_0x4836d8);}})[_0xd4a3('0x24')](function(_0x2c24ec){if(_0x2c24ec){_0x1ac592=_0x2c24ec[_0xd4a3('0x49')];if(!_0x5f0dfc['query'][_0xd4a3('0x6d')]('nolimit')){_0x4836d8[_0xd4a3('0x32')]=qs[_0xd4a3('0x32')](_0x5f0dfc[_0xd4a3('0x44')]['limit']);_0x4836d8[_0xd4a3('0x31')]=qs[_0xd4a3('0x31')](_0x5f0dfc[_0xd4a3('0x44')][_0xd4a3('0x31')]);}return _0x4ab034[_0xd4a3('0xae')](_0x4836d8);}})['then'](function(_0x36dc5d){if(_0x36dc5d){return _0x36dc5d?{'count':_0x1ac592,'rows':_0x36dc5d}:null;}})[_0xd4a3('0x24')](respondWithResult(_0x575f2b,null))[_0xd4a3('0x57')](handleError(_0x575f2b,null));};exports[_0xd4a3('0xaf')]=function(_0x5a369a,_0x4c6dba,_0x16e5ed){var _0x1c7841={'raw':![],'where':{}};var _0x5dd594={};var _0x427961={'count':0x0,'rows':[]};return db[_0xd4a3('0x53')]['findOne']({'where':{'id':_0x5a369a[_0xd4a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x4c6dba,null))['then'](function(_0x261428){if(_0x261428){_0x5dd594[_0xd4a3('0x43')]=_[_0xd4a3('0x5a')](db[_0xd4a3('0x96')]['rawAttributes']);_0x5dd594['query']=_[_0xd4a3('0x5a')](_0x5a369a[_0xd4a3('0x44')]);_0x5dd594[_0xd4a3('0x45')]=_[_0xd4a3('0x46')](_0x5dd594[_0xd4a3('0x43')],_0x5dd594[_0xd4a3('0x44')]);_0x1c7841[_0xd4a3('0x47')]=_[_0xd4a3('0x46')](_0x5dd594[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x5a369a[_0xd4a3('0x44')]['fields']));_0x1c7841[_0xd4a3('0x47')]=_0x1c7841[_0xd4a3('0x47')]['length']?_0x1c7841['attributes']:_0x5dd594[_0xd4a3('0x43')];if(!_0x5a369a[_0xd4a3('0x44')][_0xd4a3('0x6d')](_0xd4a3('0x4a'))){_0x1c7841[_0xd4a3('0x32')]=qs[_0xd4a3('0x32')](_0x5a369a['query'][_0xd4a3('0x32')]);_0x1c7841[_0xd4a3('0x31')]=qs['offset'](_0x5a369a[_0xd4a3('0x44')][_0xd4a3('0x31')]);}_0x1c7841[_0xd4a3('0x4b')]=qs[_0xd4a3('0x4c')](_0x5a369a['query'][_0xd4a3('0x4c')]);_0x1c7841[_0xd4a3('0x4d')]=qs['filters'](_[_0xd4a3('0x4e')](_0x5a369a[_0xd4a3('0x44')],_0x5dd594[_0xd4a3('0x45')]));_0x1c7841[_0xd4a3('0x4d')]['OpenchannelAccountId']=_0x261428['id'];if(_0x5a369a['query'][_0xd4a3('0x4f')]){_0x1c7841[_0xd4a3('0x4d')]=_[_0xd4a3('0x51')](_0x1c7841[_0xd4a3('0x4d')],{'$or':_['map'](_0x1c7841[_0xd4a3('0x47')],function(_0x1d5072){var _0x1afaed={};_0x1afaed[_0x1d5072]={'$like':'%'+_0x5a369a[_0xd4a3('0x44')][_0xd4a3('0x4f')]+'%'};return _0x1afaed;})});}_0x1c7841=_['merge']({},_0x1c7841,_0x5a369a[_0xd4a3('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x1c7841['where']})['then'](function(_0xedb52){_0x427961[_0xd4a3('0x30')]=_0xedb52;if(_0x5a369a[_0xd4a3('0x44')][_0xd4a3('0x54')]){_0x1c7841[_0xd4a3('0x55')]=[{'model':db[_0xd4a3('0x78')],'as':'Contact','required':![]},{'model':db[_0xd4a3('0xa5')],'as':_0xd4a3('0xb0'),'attributes':['name',_0xd4a3('0xb1'),_0xd4a3('0xb2')],'required':![]},{'model':db[_0xd4a3('0xb3')],'as':_0xd4a3('0xb4'),'attributes':['id',_0xd4a3('0x3b'),'color'],'where':_0x5a369a[_0xd4a3('0x44')][_0xd4a3('0xb5')]?{'id':_0x5a369a['query'][_0xd4a3('0xb5')]}:undefined,'required':_0x5a369a['query'][_0xd4a3('0xb5')]?!![]:![]}];}return db[_0xd4a3('0x96')]['findAll'](_0x1c7841);})[_0xd4a3('0x24')](function(_0x471207){_0x427961[_0xd4a3('0x56')]=_0x471207;return _0x427961;});}})[_0xd4a3('0x24')](respondWithFilteredResult(_0x4c6dba,_0x1c7841))[_0xd4a3('0x57')](handleError(_0x4c6dba,null));};exports[_0xd4a3('0xb6')]=function(_0x1fa666,_0x301ab4,_0x2ce8a8){return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x1fa666[_0xd4a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x301ab4,null))[_0xd4a3('0x24')](function(_0x61a0bd){if(_0x61a0bd){return _0x61a0bd[_0xd4a3('0xb6')](_0x1fa666[_0xd4a3('0x5f')][_0xd4a3('0x75')],_[_0xd4a3('0xb7')](_0x1fa666['body'],[_0xd4a3('0x75'),'id'])||{})[_0xd4a3('0xb8')](function(_0x4171e4){for(var _0x57366b=0x0;_0x57366b<_0x1fa666[_0xd4a3('0x5f')]['ids'][_0xd4a3('0x49')];_0x57366b+=0x1){socket[_0xd4a3('0xb9')](_0xd4a3('0xba'),{'UserId':_0x1fa666['body']['ids'][_0x57366b],'OpenchannelAccountId':_0x1fa666['params']['id']});}return _0x4171e4;});}})[_0xd4a3('0x24')](respondWithResult(_0x301ab4,null))[_0xd4a3('0x57')](handleError(_0x301ab4,null));};exports[_0xd4a3('0xbb')]=function(_0x1ceeb3,_0x4e7ed9,_0x20399f){return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x1ceeb3['params']['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x4e7ed9,null))[_0xd4a3('0x24')](function(_0x33fac5){if(_0x33fac5){return _0x33fac5[_0xd4a3('0xbb')](_0x1ceeb3[_0xd4a3('0x44')]['ids'])['then'](function(){if(_[_0xd4a3('0xbc')](_0x1ceeb3[_0xd4a3('0x44')][_0xd4a3('0x75')])){for(var _0x4e354b=0x0;_0x4e354b<_0x1ceeb3[_0xd4a3('0x44')][_0xd4a3('0x75')][_0xd4a3('0x49')];_0x4e354b+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1ceeb3[_0xd4a3('0x44')][_0xd4a3('0x75')][_0x4e354b]),'OpenchannelAccountId':Number(_0x1ceeb3[_0xd4a3('0x59')]['id'])});}}else{socket[_0xd4a3('0xb9')](_0xd4a3('0xbd'),{'UserId':Number(_0x1ceeb3[_0xd4a3('0x44')][_0xd4a3('0x75')]),'OpenchannelAccountId':Number(_0x1ceeb3[_0xd4a3('0x59')]['id'])});}});}})[_0xd4a3('0x24')](respondWithStatusCode(_0x4e7ed9,null))[_0xd4a3('0x57')](handleError(_0x4e7ed9,null));};exports[_0xd4a3('0xbe')]=function(_0x5cd635,_0xaf4078,_0x4d0a25){var _0xb969c9={};var _0x32a4c3={};var _0x381952;var _0x2423cf;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5cd635[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0xaf4078,null))[_0xd4a3('0x24')](function(_0x448edb){if(_0x448edb){_0x381952=_0x448edb;_0x32a4c3[_0xd4a3('0x43')]=_[_0xd4a3('0x5a')](db[_0xd4a3('0xa5')][_0xd4a3('0x5b')]);_0x32a4c3[_0xd4a3('0x44')]=_[_0xd4a3('0x5a')](_0x5cd635['query']);_0x32a4c3[_0xd4a3('0x45')]=_['intersection'](_0x32a4c3['model'],_0x32a4c3[_0xd4a3('0x44')]);_0xb969c9[_0xd4a3('0x47')]=_['intersection'](_0x32a4c3[_0xd4a3('0x43')],qs[_0xd4a3('0x48')](_0x5cd635[_0xd4a3('0x44')][_0xd4a3('0x48')]));_0xb969c9[_0xd4a3('0x47')]=_0xb969c9['attributes'][_0xd4a3('0x49')]?_0xb969c9[_0xd4a3('0x47')]:_0x32a4c3[_0xd4a3('0x43')];_0xb969c9['order']=qs['sort'](_0x5cd635[_0xd4a3('0x44')][_0xd4a3('0x4c')]);_0xb969c9['where']=qs[_0xd4a3('0x45')](_[_0xd4a3('0x4e')](_0x5cd635['query'],_0x32a4c3['filters']));if(_0x5cd635[_0xd4a3('0x44')][_0xd4a3('0x4f')]){_0xb969c9['where']=_['merge'](_0xb969c9[_0xd4a3('0x4d')],{'$or':_[_0xd4a3('0x3f')](_0xb969c9[_0xd4a3('0x47')],function(_0x476982){var _0x16eb00={};_0x16eb00[_0x476982]={'$like':'%'+_0x5cd635['query'][_0xd4a3('0x4f')]+'%'};return _0x16eb00;})});}_0xb969c9=_[_0xd4a3('0x51')]({},_0xb969c9,_0x5cd635[_0xd4a3('0x52')]);return _0x381952[_0xd4a3('0xbe')](_0xb969c9);}})[_0xd4a3('0x24')](function(_0x4f74b2){if(_0x4f74b2){_0x2423cf=_0x4f74b2[_0xd4a3('0x49')];if(!_0x5cd635['query'][_0xd4a3('0x6d')](_0xd4a3('0x4a'))){_0xb969c9[_0xd4a3('0x32')]=qs[_0xd4a3('0x32')](_0x5cd635[_0xd4a3('0x44')][_0xd4a3('0x32')]);_0xb969c9[_0xd4a3('0x31')]=qs['offset'](_0x5cd635[_0xd4a3('0x44')][_0xd4a3('0x31')]);}return _0x381952[_0xd4a3('0xbe')](_0xb969c9);}})[_0xd4a3('0x24')](function(_0x2e9064){if(_0x2e9064){return _0x2e9064?{'count':_0x2423cf,'rows':_0x2e9064}:null;}})[_0xd4a3('0x24')](respondWithResult(_0xaf4078,null))[_0xd4a3('0x57')](handleError(_0xaf4078,null));};exports['send']=function(_0x305d7d,_0x351191,_0x59a5eb){var _0x2633dd,_0x1799d9,_0x1d3bca;if(_['isNil'](_0x305d7d[_0xd4a3('0x5f')]['body'])||_0x305d7d['body'][_0xd4a3('0x5f')]===''){throw new db[(_0xd4a3('0x79'))][(_0xd4a3('0x7a'))](_0xd4a3('0x84'));}if(_[_0xd4a3('0x81')](_0x305d7d[_0xd4a3('0x5f')]['to'])){}_0x2633dd=_0x305d7d[_0xd4a3('0x5f')]['to'];return db[_0xd4a3('0x53')][_0xd4a3('0x72')]({'where':{'id':_0x305d7d[_0xd4a3('0x59')]['id']}})[_0xd4a3('0x24')](handleEntityNotFound(_0x351191,null))['then'](function(_0x3ba65f){if(_0x3ba65f){return db[_0xd4a3('0x53')][_0xd4a3('0x5d')]({'where':{'id':_0x3ba65f['id']},'include':[{'model':db[_0xd4a3('0xbf')],'as':_0xd4a3('0x89'),'include':[{'model':db[_0xd4a3('0x78')],'as':_0xd4a3('0x8a'),'where':{[_0x3ba65f[_0xd4a3('0x85')]]:_0x2633dd},'limit':0x1,'order':[[_0xd4a3('0x7d'),_0xd4a3('0xc0')]]}]}]})[_0xd4a3('0x24')](handleEntityNotFound(_0x351191,null))[_0xd4a3('0x24')](function(_0x35a50f){if(_0x35a50f&&_0x35a50f[_0xd4a3('0x89')]){_0x1799d9=_0x35a50f[_0xd4a3('0x61')]({'plain':!![]});if(_0x1799d9[_0xd4a3('0x89')]&&_0x1799d9['List'][_0xd4a3('0x8a')][_0xd4a3('0x49')]){return _0x1799d9[_0xd4a3('0x89')]['Contacts'][0x0];}return db[_0xd4a3('0x78')][_0xd4a3('0x5e')](_[_0xd4a3('0x92')](_0x305d7d[_0xd4a3('0x5f')],{'firstName':_0x2633dd,[_0x35a50f['mapKey']]:_0x2633dd,'phone':_0x2633dd,'ListId':_0x1799d9[_0xd4a3('0x80')]}));}})[_0xd4a3('0x24')](handleEntityNotFound(_0x351191,null))['then'](function(_0x496df1){if(_0x496df1){_0x1d3bca=_0x496df1;return db[_0xd4a3('0x96')][_0xd4a3('0x5d')]({'where':{'ContactId':_0x1d3bca['id'],'closed':![],'OpenchannelAccountId':_0x1799d9['id']}})[_0xd4a3('0x24')](function(_0x28fc5a){if(_0x28fc5a){return[_0x28fc5a,![]];}return db[_0xd4a3('0x96')][_0xd4a3('0x5e')]({'UserId':_0x305d7d[_0xd4a3('0x60')]['id'],'ContactId':_0x1d3bca['id'],'OpenchannelAccountId':_0x1799d9['id'],'lastMsgDirection':_0xd4a3('0xc1'),'Messages':[_['merge'](_0x305d7d[_0xd4a3('0x5f')],{'read':![],'body':_0x305d7d['body'][_0xd4a3('0x5f')],'OpenchannelAccountId':_0x1799d9['id'],'UserId':_0x305d7d[_0xd4a3('0x60')]['id'],'ContactId':_0x1d3bca['id']})]},{'include':[{'model':db[_0xd4a3('0xa2')],'as':_0xd4a3('0xc2')}]})['then'](function(_0x20bff4){return[_0x20bff4,!![]];});});}})[_0xd4a3('0xb8')](function(_0x5a764e,_0x10dcc6){if(_0x10dcc6){return _0x5a764e;}return db['OpenchannelMessage']['create'](_[_0xd4a3('0x51')](_0x305d7d[_0xd4a3('0x5f')],{'read':![],'body':_0x305d7d[_0xd4a3('0x5f')][_0xd4a3('0x5f')],'OpenchannelAccountId':_0x1799d9['id'],'OpenchannelInteractionId':_0x5a764e['id'],'UserId':_0x305d7d[_0xd4a3('0x60')]['id'],'ContactId':_0x1d3bca['id']}))[_0xd4a3('0x24')](function(_0xa4f1ff){_0x5a764e[_0xd4a3('0xc3')]['Messages']=[];_0x5a764e[_0xd4a3('0xc3')][_0xd4a3('0xc2')][_0xd4a3('0x9e')](_0xa4f1ff[_0xd4a3('0xc3')]);return _0x5a764e;});});}})[_0xd4a3('0x24')](respondWithResult(_0x351191,null))[_0xd4a3('0x57')](handleError(_0x351191,null));}; \ No newline at end of file +var _0x851d=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','params','mandatoryDispositionPause','filtears','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','CannedAnswer','getAnswers','ids','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','OpenchannelApplication','account','applications','Applications','list','priority','asc','Contacts','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','forcedOwnership','Start','EventManager','bulkCreate','getApplications','getInteractions','Owner','fullname','internal','Tag','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','user','out','Messages','dataValues','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','name','send','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length'];(function(_0x4b6d41,_0x314ffd){var _0x4f743d=function(_0x486f16){while(--_0x486f16){_0x4b6d41['push'](_0x4b6d41['shift']());}};_0x4f743d(++_0x314ffd);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd851('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd851('0x1'));var zipdir=require(_0xd851('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd851('0x3'));var moment=require(_0xd851('0x4'));var BPromise=require(_0xd851('0x5'));var Mustache=require(_0xd851('0x6'));var util=require(_0xd851('0x7'));var path=require(_0xd851('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd851('0x9'));var fs=require('fs');var _=require(_0xd851('0xa'));var squel=require(_0xd851('0xb'));var crypto=require(_0xd851('0xc'));var jsforce=require(_0xd851('0xd'));var deskjs=require(_0xd851('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd851('0xf'));var Papa=require('papaparse');var Redis=require(_0xd851('0x10'));var authService=require(_0xd851('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd851('0x12'));var hardwareService=require(_0xd851('0x13'));var logger=require(_0xd851('0x14'))(_0xd851('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd851('0x16'));var db=require(_0xd851('0x17'))['db'];config[_0xd851('0x18')]=_[_0xd851('0x19')](config['redis'],{'host':_0xd851('0x1a'),'port':0x18eb});var socket=require(_0xd851('0x1b'))(new Redis(config['redis']));require(_0xd851('0x1c'))[_0xd851('0x1d')](socket);var jayson=require(_0xd851('0x1e'));var client=jayson['client'][_0xd851('0x1f')]({'port':0x232c});var client9002=jayson[_0xd851('0x20')][_0xd851('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1e2ee7,_0x1b3d4c,_0xf011ee,_0x55d0ac){return new BPromise(function(_0x448e31,_0xc6d01){var _0x1f4f98=_0x55d0ac||client;return _0x1f4f98[_0xd851('0x21')](_0x1e2ee7,_0xf011ee)[_0xd851('0x22')](function(_0x2be9c9){logger[_0xd851('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b3d4c,'request\x20sent');logger[_0xd851('0x24')](_0xd851('0x25'),_0x1b3d4c,_0xd851('0x26'),JSON[_0xd851('0x27')](_0x2be9c9));if(_0x2be9c9[_0xd851('0x28')]){if(_0x2be9c9[_0xd851('0x28')][_0xd851('0x29')]===0x1f4){logger[_0xd851('0x28')](_0xd851('0x2a'),_0x1b3d4c,_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);return _0xc6d01(_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);}logger['error'](_0xd851('0x2a'),_0x1b3d4c,_0x2be9c9[_0xd851('0x28')]['message']);return _0x448e31(_0x2be9c9[_0xd851('0x28')][_0xd851('0x2b')]);}else{logger[_0xd851('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b3d4c,'request\x20sent');_0x448e31(_0x2be9c9['result'][_0xd851('0x2b')]);}})[_0xd851('0x2c')](function(_0x2f2009){logger[_0xd851('0x28')](_0xd851('0x2a'),_0x1b3d4c,_0x2f2009);_0xc6d01(_0x2f2009);});});}function respondWithStatusCode(_0x4d5229,_0xe1d3e9){_0xe1d3e9=_0xe1d3e9||0xcc;return function(_0x54b2ea){if(_0x54b2ea){return _0x4d5229[_0xd851('0x2d')](_0xe1d3e9);}return _0x4d5229[_0xd851('0x2e')](_0xe1d3e9)[_0xd851('0x2f')]();};}function respondWithResult(_0x36457c,_0x337da5){_0x337da5=_0x337da5||0xc8;return function(_0x30aa56){if(_0x30aa56){return _0x36457c['status'](_0x337da5)[_0xd851('0x30')](_0x30aa56);}};}function respondWithFilteredResult(_0x441c27,_0x1d68f9){return function(_0x3c3177){if(_0x3c3177){var _0x6c52fb=_0x3c3177[_0xd851('0x31')],_0x181edc=_0x1d68f9[_0xd851('0x32')],_0x352aa2=_0x1d68f9[_0xd851('0x32')]+_0x1d68f9[_0xd851('0x33')],_0x28318e;if(_0x352aa2>=_0x6c52fb){_0x352aa2=_0x6c52fb;_0x28318e=0xc8;}else{_0x28318e=0xce;}_0x441c27['status'](_0x28318e);return _0x441c27[_0xd851('0x34')](_0xd851('0x35'),_0x181edc+'-'+_0x352aa2+'/'+_0x6c52fb)[_0xd851('0x30')](_0x3c3177);}return null;};}function patchUpdates(_0x325729){return function(_0x4f887e){try{jsonpatch[_0xd851('0x36')](_0x4f887e,_0x325729,!![]);}catch(_0x568458){return BPromise['reject'](_0x568458);}return _0x4f887e[_0xd851('0x37')]();};}function saveUpdates(_0x21cdd7,_0x48a5b8){return function(_0x4dae7b){if(_0x4dae7b){return _0x4dae7b[_0xd851('0x38')](_0x21cdd7)[_0xd851('0x22')](function(_0x156641){return _0x156641;});}return null;};}function removeEntity(_0x2028ec,_0x443c94){return function(_0x4c452e){if(_0x4c452e){return _0x4c452e['destroy']()[_0xd851('0x22')](function(){var _0x39311f=_0x4c452e[_0xd851('0x39')]({'plain':!![]});var _0x1f3d7e=_0xd851('0x3a');return db[_0xd851('0x3b')][_0xd851('0x3c')]({'where':{'type':_0x1f3d7e,'resourceId':_0x39311f['id']}})[_0xd851('0x22')](function(){return _0x4c452e;});})['then'](function(){_0x2028ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x210e70,_0x166932){return function(_0x1f9bf5){if(!_0x1f9bf5){_0x210e70[_0xd851('0x2d')](0x194);}return _0x1f9bf5;};}function handleError(_0x832903,_0x4a9bc5){_0x4a9bc5=_0x4a9bc5||0x1f4;return function(_0x189ec7){logger[_0xd851('0x28')](_0x189ec7['stack']);if(_0x189ec7[_0xd851('0x3d')]){delete _0x189ec7[_0xd851('0x3d')];}_0x832903[_0xd851('0x2e')](_0x4a9bc5)[_0xd851('0x3e')](_0x189ec7);};}exports['index']=function(_0x48e9ab,_0x3f8296){var _0x567267={'include':[{'model':db[_0xd851('0x3f')],'as':'mandatoryDispositionPause'}]},_0x187999={},_0x12ee55={'count':0x0,'rows':[]};var _0x4ad910=_[_0xd851('0x40')](db[_0xd851('0x41')][_0xd851('0x42')],function(_0x5e5cfc){return{'name':_0x5e5cfc[_0xd851('0x43')],'type':_0x5e5cfc[_0xd851('0x44')][_0xd851('0x45')]};});_0x187999[_0xd851('0x46')]=_['map'](_0x4ad910,'name');_0x187999[_0xd851('0x47')]=_[_0xd851('0x48')](_0x48e9ab[_0xd851('0x47')]);_0x187999['filters']=_[_0xd851('0x49')](_0x187999[_0xd851('0x46')],_0x187999[_0xd851('0x47')]);_0x567267['attributes']=_[_0xd851('0x49')](_0x187999[_0xd851('0x46')],qs[_0xd851('0x4a')](_0x48e9ab[_0xd851('0x47')][_0xd851('0x4a')]));_0x567267[_0xd851('0x4b')]=_0x567267[_0xd851('0x4b')][_0xd851('0x4c')]?_0x567267[_0xd851('0x4b')]:_0x187999[_0xd851('0x46')];if(!_0x48e9ab[_0xd851('0x47')][_0xd851('0x4d')]('nolimit')){_0x567267['limit']=qs['limit'](_0x48e9ab[_0xd851('0x47')][_0xd851('0x33')]);_0x567267['offset']=qs[_0xd851('0x32')](_0x48e9ab[_0xd851('0x47')][_0xd851('0x32')]);}_0x567267[_0xd851('0x4e')]=qs['sort'](_0x48e9ab[_0xd851('0x47')][_0xd851('0x4f')]);_0x567267[_0xd851('0x50')]=qs[_0xd851('0x51')](_[_0xd851('0x52')](_0x48e9ab['query'],_0x187999[_0xd851('0x51')]),_0x4ad910);if(_0x48e9ab[_0xd851('0x47')][_0xd851('0x53')]){_0x567267[_0xd851('0x50')]=_['merge'](_0x567267[_0xd851('0x50')],{'$or':_[_0xd851('0x40')](_0x4ad910,function(_0x10e155){if(_0x10e155[_0xd851('0x44')]!=='VIRTUAL'){var _0x546563={};_0x546563[_0x10e155[_0xd851('0x3d')]]={'$like':'%'+_0x48e9ab[_0xd851('0x47')][_0xd851('0x53')]+'%'};return _0x546563;}})});}_0x567267=_[_0xd851('0x54')]({},_0x567267,_0x48e9ab[_0xd851('0x55')]);var _0x2a916d={'where':_0x567267[_0xd851('0x50')]};return db[_0xd851('0x41')][_0xd851('0x31')](_0x2a916d)[_0xd851('0x22')](function(_0xd0b87b){_0x12ee55[_0xd851('0x31')]=_0xd0b87b;if(_0x48e9ab[_0xd851('0x47')]['includeAll']){_0x567267[_0xd851('0x56')]=[{'all':!![]}];}return db[_0xd851('0x41')][_0xd851('0x57')](_0x567267);})[_0xd851('0x22')](function(_0x5b9d03){_0x12ee55[_0xd851('0x58')]=_0x5b9d03;return _0x12ee55;})[_0xd851('0x22')](respondWithFilteredResult(_0x3f8296,_0x567267))['catch'](handleError(_0x3f8296,null));};exports['show']=function(_0xced744,_0x2d9ecb){var _0x580226={'raw':![],'where':{'id':_0xced744[_0xd851('0x59')]['id']},'include':[{'model':db[_0xd851('0x3f')],'as':_0xd851('0x5a')}]},_0x95c37e={};_0x95c37e[_0xd851('0x46')]=_['keys'](db[_0xd851('0x41')]['rawAttributes']);_0x95c37e['query']=_[_0xd851('0x48')](_0xced744[_0xd851('0x47')]);_0x95c37e[_0xd851('0x5b')]=_[_0xd851('0x49')](_0x95c37e['model'],_0x95c37e['query']);_0x580226[_0xd851('0x4b')]=_[_0xd851('0x49')](_0x95c37e['model'],qs[_0xd851('0x4a')](_0xced744[_0xd851('0x47')][_0xd851('0x4a')]));_0x580226[_0xd851('0x4b')]=_0x580226['attributes'][_0xd851('0x4c')]?_0x580226[_0xd851('0x4b')]:_0x95c37e['model'];if(_0xced744[_0xd851('0x47')][_0xd851('0x5c')]){_0x580226[_0xd851('0x56')]=[{'all':!![]}];}_0x580226=_[_0xd851('0x54')]({},_0x580226,_0xced744[_0xd851('0x55')]);return db[_0xd851('0x41')][_0xd851('0x5d')](_0x580226)[_0xd851('0x22')](handleEntityNotFound(_0x2d9ecb,null))[_0xd851('0x22')](respondWithResult(_0x2d9ecb,null))['catch'](handleError(_0x2d9ecb,null));};exports[_0xd851('0x5e')]=function(_0x5b0476,_0x1c41ff){return db[_0xd851('0x41')]['create'](_0x5b0476[_0xd851('0x5f')],{})[_0xd851('0x22')](function(_0x1d9b9e){var _0x5ee1e1=_0x5b0476['user'][_0xd851('0x39')]({'plain':!![]});if(!_0x5ee1e1)throw new Error(_0xd851('0x60'));if(_0x5ee1e1[_0xd851('0x61')]==='user'){var _0x290e08=_0x1d9b9e['get']({'plain':!![]});var _0x56384d='OpenchannelAccounts';return db[_0xd851('0x62')][_0xd851('0x5d')]({'where':{'name':_0x56384d,'userProfileId':_0x5ee1e1[_0xd851('0x63')]},'raw':!![]})[_0xd851('0x22')](function(_0x4ba5f5){if(_0x4ba5f5&&_0x4ba5f5[_0xd851('0x64')]===0x0){return db[_0xd851('0x3b')][_0xd851('0x5e')]({'name':_0x290e08[_0xd851('0x3d')],'resourceId':_0x290e08['id'],'type':_0x4ba5f5[_0xd851('0x3d')],'sectionId':_0x4ba5f5['id']},{})['then'](function(){return _0x1d9b9e;});}else{return _0x1d9b9e;}})[_0xd851('0x2c')](function(_0x202463){logger[_0xd851('0x28')](_0xd851('0x65'),_0x202463);throw _0x202463;});}return _0x1d9b9e;})[_0xd851('0x22')](respondWithResult(_0x1c41ff,0xc9))[_0xd851('0x2c')](handleError(_0x1c41ff,null));};exports[_0xd851('0x38')]=function(_0x4211a2,_0x58a5ab){if(_0x4211a2['body']['id']){delete _0x4211a2[_0xd851('0x5f')]['id'];}return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x4211a2[_0xd851('0x59')]['id']},'include':[{'model':db[_0xd851('0x3f')],'as':_0xd851('0x5a')}]})[_0xd851('0x22')](handleEntityNotFound(_0x58a5ab,null))[_0xd851('0x22')](saveUpdates(_0x4211a2[_0xd851('0x5f')],null))[_0xd851('0x22')](respondWithResult(_0x58a5ab,null))['catch'](handleError(_0x58a5ab,null));};exports['destroy']=function(_0x61bddf,_0x4ad937){return db[_0xd851('0x41')]['find']({'where':{'id':_0x61bddf['params']['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x4ad937,null))[_0xd851('0x22')](removeEntity(_0x4ad937,null))['catch'](handleError(_0x4ad937,null));};exports['describe']=function(_0x75df94,_0x373e9d){return db[_0xd851('0x41')][_0xd851('0x66')]()[_0xd851('0x22')](respondWithResult(_0x373e9d,null))[_0xd851('0x2c')](handleError(_0x373e9d,null));};exports['addDisposition']=function(_0x45adcf,_0x10118a,_0x2ac7dc){if(_0x45adcf[_0xd851('0x5f')]['id']){delete _0x45adcf['body']['id'];}return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x45adcf[_0xd851('0x59')]['id']}})['then'](handleEntityNotFound(_0x10118a,null))[_0xd851('0x22')](function(_0x5e4b59){if(_0x5e4b59){_0x45adcf[_0xd851('0x5f')][_0xd851('0x67')]=_0x5e4b59['id'];return db[_0xd851('0x68')][_0xd851('0x5e')](_0x45adcf['body']);}})[_0xd851('0x22')](respondWithResult(_0x10118a,null))[_0xd851('0x2c')](handleError(_0x10118a,null));};exports[_0xd851('0x69')]=function(_0x37133c,_0x115a77,_0x2078fb){var _0x2f728d={'raw':![],'where':{}};var _0xa0265d={};var _0x1c3458={'count':0x0,'rows':[]};return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x37133c['params']['id']}})['then'](handleEntityNotFound(_0x115a77,null))[_0xd851('0x22')](function(_0x3a485a){if(_0x3a485a){_0xa0265d[_0xd851('0x46')]=_[_0xd851('0x48')](db[_0xd851('0x68')][_0xd851('0x42')]);_0xa0265d[_0xd851('0x47')]=_[_0xd851('0x48')](_0x37133c[_0xd851('0x47')]);_0xa0265d[_0xd851('0x51')]=_[_0xd851('0x49')](_0xa0265d[_0xd851('0x46')],_0xa0265d[_0xd851('0x47')]);_0x2f728d[_0xd851('0x4b')]=_[_0xd851('0x49')](_0xa0265d[_0xd851('0x46')],qs[_0xd851('0x4a')](_0x37133c[_0xd851('0x47')][_0xd851('0x4a')]));_0x2f728d[_0xd851('0x4b')]=_0x2f728d[_0xd851('0x4b')][_0xd851('0x4c')]?_0x2f728d[_0xd851('0x4b')]:_0xa0265d[_0xd851('0x46')];if(!_0x37133c[_0xd851('0x47')][_0xd851('0x4d')](_0xd851('0x6b'))){_0x2f728d[_0xd851('0x33')]=qs['limit'](_0x37133c[_0xd851('0x47')][_0xd851('0x33')]);_0x2f728d['offset']=qs['offset'](_0x37133c[_0xd851('0x47')][_0xd851('0x32')]);}_0x2f728d[_0xd851('0x4e')]=qs[_0xd851('0x4f')](_0x37133c[_0xd851('0x47')][_0xd851('0x4f')]);_0x2f728d[_0xd851('0x50')]=qs[_0xd851('0x51')](_[_0xd851('0x52')](_0x37133c[_0xd851('0x47')],_0xa0265d[_0xd851('0x51')]));_0x2f728d[_0xd851('0x50')][_0xd851('0x67')]=_0x3a485a['id'];if(_0x37133c['query'][_0xd851('0x53')]){_0x2f728d['where']=_[_0xd851('0x54')](_0x2f728d[_0xd851('0x50')],{'$or':_[_0xd851('0x40')](_0x2f728d[_0xd851('0x4b')],function(_0x3677f1){var _0x3c78aa={};_0x3c78aa[_0x3677f1]={'$like':'%'+_0x37133c['query'][_0xd851('0x53')]+'%'};return _0x3c78aa;})});}_0x2f728d=_[_0xd851('0x54')]({},_0x2f728d,_0x37133c[_0xd851('0x55')]);return db['Disposition'][_0xd851('0x31')]({'where':_0x2f728d[_0xd851('0x50')]})[_0xd851('0x22')](function(_0x13121f){_0x1c3458[_0xd851('0x31')]=_0x13121f;if(_0x37133c['query']['includeAll']){_0x2f728d[_0xd851('0x56')]=[{'all':!![]}];}return db[_0xd851('0x68')][_0xd851('0x57')](_0x2f728d);})['then'](function(_0x584c0e){_0x1c3458['rows']=_0x584c0e;return _0x1c3458;});}})[_0xd851('0x22')](respondWithFilteredResult(_0x115a77,_0x2f728d))['catch'](handleError(_0x115a77,null));};exports['removeDispositions']=function(_0x26d909,_0x231d58,_0x4dedf6){return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x26d909[_0xd851('0x59')]['id']}})['then'](handleEntityNotFound(_0x231d58,null))['then'](function(_0x1fcdc1){if(_0x1fcdc1){return _0x1fcdc1['removeDispositions'](_0x26d909[_0xd851('0x47')]['ids']);}})[_0xd851('0x22')](respondWithStatusCode(_0x231d58,null))[_0xd851('0x2c')](handleError(_0x231d58,null));};exports['addAnswer']=function(_0x54180d,_0x46853b,_0x2b93a2){if(_0x54180d[_0xd851('0x5f')]['id']){delete _0x54180d[_0xd851('0x5f')]['id'];}return db[_0xd851('0x41')]['find']({'where':{'id':_0x54180d[_0xd851('0x59')]['id']}})['then'](handleEntityNotFound(_0x46853b,null))[_0xd851('0x22')](function(_0x449976){if(_0x449976){_0x54180d[_0xd851('0x5f')]['OpenchannelAccountId']=_0x449976['id'];return db[_0xd851('0x6c')][_0xd851('0x5e')](_0x54180d[_0xd851('0x5f')]);}})[_0xd851('0x22')](respondWithResult(_0x46853b,null))[_0xd851('0x2c')](handleError(_0x46853b,null));};exports[_0xd851('0x6d')]=function(_0x59c142,_0x13fd87,_0x38ca4d){var _0x537803={'raw':![],'where':{}};var _0x3d7a69={};var _0x52f203={'count':0x0,'rows':[]};return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x59c142[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x13fd87,null))[_0xd851('0x22')](function(_0x5ddfb1){if(_0x5ddfb1){_0x3d7a69[_0xd851('0x46')]=_[_0xd851('0x48')](db[_0xd851('0x6c')]['rawAttributes']);_0x3d7a69[_0xd851('0x47')]=_[_0xd851('0x48')](_0x59c142[_0xd851('0x47')]);_0x3d7a69['filters']=_['intersection'](_0x3d7a69[_0xd851('0x46')],_0x3d7a69[_0xd851('0x47')]);_0x537803[_0xd851('0x4b')]=_[_0xd851('0x49')](_0x3d7a69['model'],qs[_0xd851('0x4a')](_0x59c142[_0xd851('0x47')]['fields']));_0x537803['attributes']=_0x537803['attributes'][_0xd851('0x4c')]?_0x537803[_0xd851('0x4b')]:_0x3d7a69[_0xd851('0x46')];if(!_0x59c142[_0xd851('0x47')][_0xd851('0x4d')]('nolimit')){_0x537803[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x59c142[_0xd851('0x47')][_0xd851('0x33')]);_0x537803[_0xd851('0x32')]=qs[_0xd851('0x32')](_0x59c142[_0xd851('0x47')]['offset']);}_0x537803[_0xd851('0x4e')]=qs['sort'](_0x59c142[_0xd851('0x47')][_0xd851('0x4f')]);_0x537803[_0xd851('0x50')]=qs[_0xd851('0x51')](_['pick'](_0x59c142[_0xd851('0x47')],_0x3d7a69[_0xd851('0x51')]));_0x537803[_0xd851('0x50')]['OpenchannelAccountId']=_0x5ddfb1['id'];if(_0x59c142['query'][_0xd851('0x53')]){_0x537803['where']=_[_0xd851('0x54')](_0x537803[_0xd851('0x50')],{'$or':_[_0xd851('0x40')](_0x537803[_0xd851('0x4b')],function(_0x386c9b){var _0x5535f0={};_0x5535f0[_0x386c9b]={'$like':'%'+_0x59c142[_0xd851('0x47')][_0xd851('0x53')]+'%'};return _0x5535f0;})});}_0x537803=_[_0xd851('0x54')]({},_0x537803,_0x59c142[_0xd851('0x55')]);return db['CannedAnswer'][_0xd851('0x31')]({'where':_0x537803[_0xd851('0x50')]})['then'](function(_0x236810){_0x52f203[_0xd851('0x31')]=_0x236810;if(_0x59c142['query'][_0xd851('0x5c')]){_0x537803['include']=[{'all':!![]}];}return db[_0xd851('0x6c')][_0xd851('0x57')](_0x537803);})[_0xd851('0x22')](function(_0x2206db){_0x52f203[_0xd851('0x58')]=_0x2206db;return _0x52f203;});}})[_0xd851('0x22')](respondWithFilteredResult(_0x13fd87,_0x537803))[_0xd851('0x2c')](handleError(_0x13fd87,null));};exports['removeAnswers']=function(_0x5c0329,_0x108572,_0x14cf2e){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c0329[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x108572,null))[_0xd851('0x22')](function(_0x105a42){if(_0x105a42){return _0x105a42['removeAnswers'](_0x5c0329[_0xd851('0x47')][_0xd851('0x6e')]);}})['then'](respondWithStatusCode(_0x108572,null))[_0xd851('0x2c')](handleError(_0x108572,null));};exports[_0xd851('0x6f')]=function(_0x431cf5,_0xa1ef50,_0x40f47b){var _0x5a16b8={'body':_0x431cf5['body'],'channel':'openchannel'};var _0x34cd0c=[];var _0x40dc4a=[];var _0x2da7a9={};var _0x3b3129=![];return db[_0xd851('0x70')]['describe']()[_0xd851('0x22')](function(_0x307995){if(!_0x307995){throw new db['Sequelize'][(_0xd851('0x71'))](_0xd851('0x72'));}_0x34cd0c=_[_0xd851('0x73')](_['keys'](_0x307995),[_0xd851('0x74'),_0xd851('0x75')]);_0x40dc4a=_[_0xd851('0x73')](_[_0xd851('0x48')](_0x307995),[_0xd851('0x74'),'updatedAt',_0xd851('0x76'),_0xd851('0x77')]);if(_0x431cf5[_0xd851('0x5f')]['id']){delete _0x431cf5[_0xd851('0x5f')]['id'];}if(_[_0xd851('0x78')](_0x431cf5[_0xd851('0x5f')]['from'])){throw new db[(_0xd851('0x79'))][(_0xd851('0x71'))](_0xd851('0x7a'));}if(_[_0xd851('0x78')](_0x431cf5[_0xd851('0x5f')]['body'])||_0x431cf5[_0xd851('0x5f')][_0xd851('0x5f')]===''){throw new db[(_0xd851('0x79'))][(_0xd851('0x71'))](_0xd851('0x7b'));}if(_['isNil'](_0x431cf5['body'][_0xd851('0x7c')])){throw new db[(_0xd851('0x79'))][(_0xd851('0x71'))](_0xd851('0x7d')+_0x40dc4a);}if(!_['includes'](_0x40dc4a,_0x431cf5[_0xd851('0x5f')][_0xd851('0x7c')])){throw new db[(_0xd851('0x79'))]['ValidationError'](_0xd851('0x7e')+_0x40dc4a);}_0x2da7a9[_0x431cf5[_0xd851('0x5f')][_0xd851('0x7c')]]=_0x431cf5[_0xd851('0x5f')][_0xd851('0x7f')];})[_0xd851('0x22')](function(){return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x431cf5[_0xd851('0x59')]['id']},'include':[{'model':db[_0xd851('0x80')],'as':_0xd851('0x81'),'include':[{'model':db[_0xd851('0x70')],'as':'Contacts','where':_0x2da7a9,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xd851('0x82')],'as':'Applications'}]});})[_0xd851('0x22')](handleEntityNotFound(_0xa1ef50,null))[_0xd851('0x22')](function(_0x33f0fc){if(_0x33f0fc&&_0x33f0fc[_0xd851('0x81')]){_0x5a16b8[_0xd851('0x83')]=_0x33f0fc;_0x5a16b8[_0xd851('0x84')]=_0x33f0fc[_0xd851('0x85')];_0x5a16b8[_0xd851('0x86')]=_0x33f0fc[_0xd851('0x81')];_0x5a16b8[_0xd851('0x84')]=_['orderBy'](_0x5a16b8[_0xd851('0x84')],[_0xd851('0x87')],[_0xd851('0x88')]);if(_0x5a16b8[_0xd851('0x83')][_0xd851('0x85')]){delete _0x5a16b8['account']['Applications'];}if(_0x5a16b8['account'][_0xd851('0x81')]&&_0x5a16b8[_0xd851('0x83')][_0xd851('0x81')][_0xd851('0x89')][_0xd851('0x4c')]){return _0x5a16b8['account'][_0xd851('0x81')][_0xd851('0x89')][0x0];}var _0x2600a5=_[_0xd851('0x19')](_0x431cf5[_0xd851('0x5f')],{'firstName':_0x431cf5['body']['from'],'ListId':_0x33f0fc[_0xd851('0x77')]});_0x2600a5[_0x431cf5['body'][_0xd851('0x7c')]]=_0x431cf5[_0xd851('0x5f')]['from'];return db['CmContact'][_0xd851('0x5e')](_0x2600a5,{'fields':_0x34cd0c,'raw':!![]});}})[_0xd851('0x22')](handleEntityNotFound(_0xa1ef50,null))[_0xd851('0x22')](function(_0xf8cb7c){_0x5a16b8['contact']=_0xf8cb7c;if(_0xf8cb7c){var _0x2753f1={'ContactId':_0xf8cb7c['id'],'OpenchannelAccountId':_0x431cf5['params']['id'],'from':(_0xf8cb7c[_0xd851('0x8a')]||'')+'\x20'+(_0xf8cb7c[_0xd851('0x8b')]||'')};var _0x152523={'OpenchannelAccountId':_0x431cf5[_0xd851('0x59')]['id'],'closed':![]};if(_0x431cf5[_0xd851('0x5f')][_0xd851('0x8c')]){_0x152523['threadId']=_0x431cf5[_0xd851('0x5f')][_0xd851('0x8c')];return db[_0xd851('0x8d')][_0xd851('0x5d')]({'where':_0x152523})[_0xd851('0x22')](function(_0x56d600){if(_0x56d600){return[_0x56d600,![]];}_0x2753f1[_0xd851('0x8c')]=_0x431cf5['body'][_0xd851('0x8c')];_0x2753f1['externalUrl']=_0x431cf5[_0xd851('0x5f')][_0xd851('0x8e')];return db[_0xd851('0x8d')][_0xd851('0x5e')](_0x2753f1)[_0xd851('0x22')](function(_0x29fec9){return[_0x29fec9,!![]];});});}else{_0x152523['threadId']=null;}_0x152523[_0xd851('0x8f')]=_0xf8cb7c['id'];return db['OpenchannelInteraction'][_0xd851('0x5d')]({'where':_0x152523})['then'](function(_0x834eae){if(_0x834eae){return[_0x834eae,![]];}return db[_0xd851('0x8d')][_0xd851('0x5e')](_0x2753f1)[_0xd851('0x22')](function(_0x250d94){return[_0x250d94,!![]];});});}})[_0xd851('0x90')](function(_0x56b89d,_0x1e45f0){if(_0x56b89d){_0x3b3129=_0x1e45f0;if(!_0x1e45f0){var _0x2d24f2={'from':(_0x5a16b8[_0xd851('0x91')][_0xd851('0x8a')]||'')+'\x20'+(_0x5a16b8[_0xd851('0x91')][_0xd851('0x8b')]||'')};if(_0x431cf5['body'][_0xd851('0x8c')]&&_0x431cf5[_0xd851('0x5f')][_0xd851('0x92')]&&_0x431cf5['body'][_0xd851('0x8c')]!=_0x431cf5[_0xd851('0x5f')][_0xd851('0x92')]){_0x2d24f2[_0xd851('0x8c')]=_0x431cf5[_0xd851('0x5f')][_0xd851('0x92')];}return _0x56b89d[_0xd851('0x38')](_0x2d24f2);}else{return _0x56b89d;}}})[_0xd851('0x22')](function(_0x34229d){_0x5a16b8['interaction']=_0x34229d[_0xd851('0x39')]({'plain':!![]});_0x5a16b8[_0xd851('0x93')][_0xd851('0x94')]=_0x3b3129;if(_0x5a16b8['interaction']['created']){if(_0x5a16b8[_0xd851('0x83')][_0xd851('0x95')]){_0x5a16b8[_0xd851('0x84')][_0xd851('0x96')]({'id':0x0,'priority':_0x5a16b8['applications'][_0xd851('0x4c')]+0x1,'app':_0xd851('0x97'),'appdata':'unmanaged','interval':_0xd851('0x98')});}}return db[_0xd851('0x99')][_0xd851('0x5e')]({'body':_0x431cf5[_0xd851('0x5f')]['body'],'OpenchannelAccountId':_0x431cf5[_0xd851('0x59')]['id'],'OpenchannelInteractionId':_0x34229d['id'],'direction':'in','ContactId':_0x5a16b8[_0xd851('0x91')]['id'],'AttachmentId':_0x431cf5[_0xd851('0x5f')][_0xd851('0x9a')]});})[_0xd851('0x22')](function(_0x41cbb8){_0x5a16b8['message']=_0x41cbb8;if(_0x5a16b8[_0xd851('0x93')][_0xd851('0x9b')]){return db[_0xd851('0x9c')][_0xd851('0x5d')]({'attributes':['id',_0xd851('0x3d')],'where':{'id':_0x5a16b8['interaction'][_0xd851('0x9b')]}})[_0xd851('0x22')](function(_0x273dd1){if(_0x273dd1){_0x5a16b8['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xd851('0x9d'),'appdata':_0x273dd1[_0xd851('0x3d')]+','+(_0x5a16b8['account']['waitForTheAssignedAgent']||0xa),'interval':_0xd851('0x98')});_0x5a16b8[_0xd851('0x9e')]=![];}return respondWithRpcPromise(_0xd851('0x9f'),'startRouting',_0x5a16b8);});}return respondWithRpcPromise(_0xd851('0x9f'),'startRouting',_0x5a16b8);})[_0xd851('0x22')](function(_0x2500b8){respondWithRpcPromise(_0xd851('0xa0'),_0xd851('0xa0'),{'event':_0xd851('0x6f'),'message':_0x2500b8},client9002);return _0x2500b8;})['then'](respondWithResult(_0xa1ef50,null))[_0xd851('0x2c')](handleError(_0xa1ef50,null));};exports['addApplications']=function(_0x11ec45,_0x3c36fc,_0x2af4bd){return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x11ec45['params']['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x3c36fc,null))['then'](function(_0x3541f8){if(_0x3541f8){return db['sequelize']['transaction'](function(_0x2cfdf6){return db[_0xd851('0x82')][_0xd851('0x3c')]({'where':{'OpenchannelAccountId':_0x11ec45[_0xd851('0x59')]['id']},'transaction':_0x2cfdf6})[_0xd851('0x22')](function(_0x11fd18){var _0x418a39=_[_0xd851('0x40')](_0x11ec45[_0xd851('0x5f')],function(_0x308551){_0x308551[_0xd851('0x67')]=_0x11ec45[_0xd851('0x59')]['id'];return _0x308551;});return db[_0xd851('0x82')][_0xd851('0xa1')](_0x418a39,{'transaction':_0x2cfdf6});});})[_0xd851('0x22')](function(){return db[_0xd851('0x82')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x11ec45[_0xd851('0x59')]['id']},'order':_0xd851('0x87')});});}})['then'](respondWithResult(_0x3c36fc,null))[_0xd851('0x2c')](handleError(_0x3c36fc,null));};exports[_0xd851('0xa2')]=function(_0x17d152,_0x32b14f,_0x114cbe){var _0x45d828={};var _0x308260={};var _0x2feb7e;var _0xf3360a;return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x17d152[_0xd851('0x59')]['id']}})['then'](handleEntityNotFound(_0x32b14f,null))[_0xd851('0x22')](function(_0x358f16){if(_0x358f16){_0x2feb7e=_0x358f16;_0x308260[_0xd851('0x46')]=_[_0xd851('0x48')](db['OpenchannelApplication']['rawAttributes']);_0x308260['query']=_['keys'](_0x17d152['query']);_0x308260[_0xd851('0x51')]=_[_0xd851('0x49')](_0x308260[_0xd851('0x46')],_0x308260['query']);_0x45d828[_0xd851('0x4b')]=_[_0xd851('0x49')](_0x308260[_0xd851('0x46')],qs[_0xd851('0x4a')](_0x17d152['query']['fields']));_0x45d828[_0xd851('0x4b')]=_0x45d828[_0xd851('0x4b')][_0xd851('0x4c')]?_0x45d828[_0xd851('0x4b')]:_0x308260[_0xd851('0x46')];_0x45d828[_0xd851('0x4e')]=qs['sort'](_0x17d152[_0xd851('0x47')][_0xd851('0x4f')]);_0x45d828[_0xd851('0x50')]=qs[_0xd851('0x51')](_['pick'](_0x17d152[_0xd851('0x47')],_0x308260[_0xd851('0x51')]));if(_0x17d152['query'][_0xd851('0x53')]){_0x45d828[_0xd851('0x50')]=_[_0xd851('0x54')](_0x45d828[_0xd851('0x50')],{'$or':_[_0xd851('0x40')](_0x45d828[_0xd851('0x4b')],function(_0x500b51){var _0x90827={};_0x90827[_0x500b51]={'$like':'%'+_0x17d152[_0xd851('0x47')]['filter']+'%'};return _0x90827;})});}_0x45d828=_[_0xd851('0x54')]({},_0x45d828,_0x17d152['options']);return _0x2feb7e[_0xd851('0xa2')](_0x45d828);}})[_0xd851('0x22')](function(_0xa1a6cb){if(_0xa1a6cb){_0xf3360a=_0xa1a6cb[_0xd851('0x4c')];if(!_0x17d152[_0xd851('0x47')][_0xd851('0x4d')](_0xd851('0x6b'))){_0x45d828[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x17d152[_0xd851('0x47')][_0xd851('0x33')]);_0x45d828['offset']=qs[_0xd851('0x32')](_0x17d152[_0xd851('0x47')][_0xd851('0x32')]);}return _0x2feb7e[_0xd851('0xa2')](_0x45d828);}})[_0xd851('0x22')](function(_0x290059){if(_0x290059){return _0x290059?{'count':_0xf3360a,'rows':_0x290059}:null;}})[_0xd851('0x22')](respondWithResult(_0x32b14f,null))[_0xd851('0x2c')](handleError(_0x32b14f,null));};exports[_0xd851('0xa3')]=function(_0x53e9c9,_0x2525d6,_0x26ea15){var _0x252cfb={'raw':![],'where':{}};var _0x5d97f0={};var _0xa3982a={'count':0x0,'rows':[]};return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x53e9c9[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x2525d6,null))['then'](function(_0x563a96){if(_0x563a96){_0x5d97f0[_0xd851('0x46')]=_[_0xd851('0x48')](db[_0xd851('0x8d')][_0xd851('0x42')]);_0x5d97f0[_0xd851('0x47')]=_[_0xd851('0x48')](_0x53e9c9[_0xd851('0x47')]);_0x5d97f0[_0xd851('0x51')]=_[_0xd851('0x49')](_0x5d97f0[_0xd851('0x46')],_0x5d97f0[_0xd851('0x47')]);_0x252cfb[_0xd851('0x4b')]=_[_0xd851('0x49')](_0x5d97f0['model'],qs[_0xd851('0x4a')](_0x53e9c9[_0xd851('0x47')][_0xd851('0x4a')]));_0x252cfb['attributes']=_0x252cfb[_0xd851('0x4b')]['length']?_0x252cfb['attributes']:_0x5d97f0[_0xd851('0x46')];if(!_0x53e9c9[_0xd851('0x47')][_0xd851('0x4d')](_0xd851('0x6b'))){_0x252cfb[_0xd851('0x33')]=qs['limit'](_0x53e9c9['query'][_0xd851('0x33')]);_0x252cfb[_0xd851('0x32')]=qs[_0xd851('0x32')](_0x53e9c9[_0xd851('0x47')][_0xd851('0x32')]);}_0x252cfb[_0xd851('0x4e')]=qs[_0xd851('0x4f')](_0x53e9c9[_0xd851('0x47')]['sort']);_0x252cfb['where']=qs[_0xd851('0x51')](_[_0xd851('0x52')](_0x53e9c9[_0xd851('0x47')],_0x5d97f0[_0xd851('0x51')]));_0x252cfb[_0xd851('0x50')]['OpenchannelAccountId']=_0x563a96['id'];if(_0x53e9c9['query']['filter']){_0x252cfb[_0xd851('0x50')]=_[_0xd851('0x54')](_0x252cfb[_0xd851('0x50')],{'$or':_['map'](_0x252cfb[_0xd851('0x4b')],function(_0x3d6ccb){var _0x39e2db={};_0x39e2db[_0x3d6ccb]={'$like':'%'+_0x53e9c9[_0xd851('0x47')]['filter']+'%'};return _0x39e2db;})});}_0x252cfb=_[_0xd851('0x54')]({},_0x252cfb,_0x53e9c9[_0xd851('0x55')]);return db[_0xd851('0x8d')]['count']({'where':_0x252cfb[_0xd851('0x50')]})[_0xd851('0x22')](function(_0x109498){_0xa3982a['count']=_0x109498;if(_0x53e9c9['query']['includeAll']){_0x252cfb[_0xd851('0x56')]=[{'model':db[_0xd851('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xd851('0xa4'),'attributes':[_0xd851('0x3d'),_0xd851('0xa5'),_0xd851('0xa6')],'required':![]},{'model':db[_0xd851('0xa7')],'as':'Tags','attributes':['id',_0xd851('0x3d'),_0xd851('0xa8')],'where':_0x53e9c9[_0xd851('0x47')][_0xd851('0xa9')]?{'id':_0x53e9c9[_0xd851('0x47')][_0xd851('0xa9')]}:undefined,'required':_0x53e9c9[_0xd851('0x47')][_0xd851('0xa9')]?!![]:![]}];}return db[_0xd851('0x8d')][_0xd851('0x57')](_0x252cfb);})[_0xd851('0x22')](function(_0x506a8a){_0xa3982a[_0xd851('0x58')]=_0x506a8a;return _0xa3982a;});}})[_0xd851('0x22')](respondWithFilteredResult(_0x2525d6,_0x252cfb))['catch'](handleError(_0x2525d6,null));};exports[_0xd851('0xaa')]=function(_0x58f952,_0x30a5ed,_0x1fd1bc){return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x58f952[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x30a5ed,null))['then'](function(_0x33ce21){if(_0x33ce21){return _0x33ce21[_0xd851('0xaa')](_0x58f952['body'][_0xd851('0x6e')],_[_0xd851('0xab')](_0x58f952[_0xd851('0x5f')],[_0xd851('0x6e'),'id'])||{})['spread'](function(_0x56f165){for(var _0x82127c=0x0;_0x82127c<_0x58f952['body'][_0xd851('0x6e')][_0xd851('0x4c')];_0x82127c+=0x1){socket[_0xd851('0xac')](_0xd851('0xad'),{'UserId':_0x58f952[_0xd851('0x5f')]['ids'][_0x82127c],'OpenchannelAccountId':_0x58f952[_0xd851('0x59')]['id']});}return _0x56f165;});}})[_0xd851('0x22')](respondWithResult(_0x30a5ed,null))[_0xd851('0x2c')](handleError(_0x30a5ed,null));};exports[_0xd851('0xae')]=function(_0x3addb4,_0x2579b6,_0x45df58){return db['OpenchannelAccount'][_0xd851('0x5d')]({'where':{'id':_0x3addb4[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x2579b6,null))[_0xd851('0x22')](function(_0x18f38e){if(_0x18f38e){return _0x18f38e[_0xd851('0xae')](_0x3addb4[_0xd851('0x47')]['ids'])[_0xd851('0x22')](function(){if(_['isArray'](_0x3addb4[_0xd851('0x47')][_0xd851('0x6e')])){for(var _0x4ba887=0x0;_0x4ba887<_0x3addb4[_0xd851('0x47')][_0xd851('0x6e')]['length'];_0x4ba887+=0x1){socket[_0xd851('0xac')](_0xd851('0xaf'),{'UserId':Number(_0x3addb4[_0xd851('0x47')][_0xd851('0x6e')][_0x4ba887]),'OpenchannelAccountId':Number(_0x3addb4[_0xd851('0x59')]['id'])});}}else{socket[_0xd851('0xac')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3addb4[_0xd851('0x47')]['ids']),'OpenchannelAccountId':Number(_0x3addb4[_0xd851('0x59')]['id'])});}});}})[_0xd851('0x22')](respondWithStatusCode(_0x2579b6,null))[_0xd851('0x2c')](handleError(_0x2579b6,null));};exports[_0xd851('0xb0')]=function(_0x1c2159,_0x4497be,_0xa3260e){var _0x59ef07={};var _0x39a542={};var _0x10a65b;var _0x4ab5c7;return db[_0xd851('0x41')][_0xd851('0x6a')]({'where':{'id':_0x1c2159[_0xd851('0x59')]['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x4497be,null))[_0xd851('0x22')](function(_0x597507){if(_0x597507){_0x10a65b=_0x597507;_0x39a542[_0xd851('0x46')]=_[_0xd851('0x48')](db[_0xd851('0x9c')]['rawAttributes']);_0x39a542[_0xd851('0x47')]=_[_0xd851('0x48')](_0x1c2159['query']);_0x39a542[_0xd851('0x51')]=_[_0xd851('0x49')](_0x39a542[_0xd851('0x46')],_0x39a542['query']);_0x59ef07[_0xd851('0x4b')]=_[_0xd851('0x49')](_0x39a542[_0xd851('0x46')],qs['fields'](_0x1c2159[_0xd851('0x47')]['fields']));_0x59ef07['attributes']=_0x59ef07[_0xd851('0x4b')][_0xd851('0x4c')]?_0x59ef07[_0xd851('0x4b')]:_0x39a542['model'];_0x59ef07[_0xd851('0x4e')]=qs['sort'](_0x1c2159['query'][_0xd851('0x4f')]);_0x59ef07[_0xd851('0x50')]=qs[_0xd851('0x51')](_[_0xd851('0x52')](_0x1c2159['query'],_0x39a542['filters']));if(_0x1c2159[_0xd851('0x47')][_0xd851('0x53')]){_0x59ef07[_0xd851('0x50')]=_[_0xd851('0x54')](_0x59ef07['where'],{'$or':_[_0xd851('0x40')](_0x59ef07[_0xd851('0x4b')],function(_0x2201f7){var _0x2828ba={};_0x2828ba[_0x2201f7]={'$like':'%'+_0x1c2159[_0xd851('0x47')][_0xd851('0x53')]+'%'};return _0x2828ba;})});}_0x59ef07=_[_0xd851('0x54')]({},_0x59ef07,_0x1c2159[_0xd851('0x55')]);return _0x10a65b[_0xd851('0xb0')](_0x59ef07);}})[_0xd851('0x22')](function(_0x526d0c){if(_0x526d0c){_0x4ab5c7=_0x526d0c[_0xd851('0x4c')];if(!_0x1c2159['query']['hasOwnProperty']('nolimit')){_0x59ef07[_0xd851('0x33')]=qs[_0xd851('0x33')](_0x1c2159[_0xd851('0x47')][_0xd851('0x33')]);_0x59ef07[_0xd851('0x32')]=qs[_0xd851('0x32')](_0x1c2159[_0xd851('0x47')][_0xd851('0x32')]);}return _0x10a65b[_0xd851('0xb0')](_0x59ef07);}})[_0xd851('0x22')](function(_0x236df9){if(_0x236df9){return _0x236df9?{'count':_0x4ab5c7,'rows':_0x236df9}:null;}})[_0xd851('0x22')](respondWithResult(_0x4497be,null))[_0xd851('0x2c')](handleError(_0x4497be,null));};exports['send']=function(_0x252b21,_0x10c446,_0x299445){var _0x2de9c5,_0x24c629,_0x53d32b;if(_['isNil'](_0x252b21['body'][_0xd851('0x5f')])||_0x252b21['body'][_0xd851('0x5f')]===''){throw new db['Sequelize'][(_0xd851('0x71'))](_0xd851('0x7b'));}if(_[_0xd851('0x78')](_0x252b21[_0xd851('0x5f')]['to'])){}_0x2de9c5=_0x252b21[_0xd851('0x5f')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x252b21['params']['id']}})[_0xd851('0x22')](handleEntityNotFound(_0x10c446,null))[_0xd851('0x22')](function(_0x128880){if(_0x128880){return db[_0xd851('0x41')][_0xd851('0x5d')]({'where':{'id':_0x128880['id']},'include':[{'model':db[_0xd851('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':_0xd851('0x89'),'where':{[_0x128880[_0xd851('0x7c')]]:_0x2de9c5},'limit':0x1,'order':[[_0xd851('0x75'),_0xd851('0xb1')]]}]}]})['then'](handleEntityNotFound(_0x10c446,null))[_0xd851('0x22')](function(_0xd82cbc){if(_0xd82cbc&&_0xd82cbc[_0xd851('0x81')]){_0x24c629=_0xd82cbc['get']({'plain':!![]});if(_0x24c629[_0xd851('0x81')]&&_0x24c629[_0xd851('0x81')][_0xd851('0x89')][_0xd851('0x4c')]){return _0x24c629[_0xd851('0x81')]['Contacts'][0x0];}return db[_0xd851('0x70')]['create'](_['defaults'](_0x252b21['body'],{'firstName':_0x2de9c5,[_0xd82cbc[_0xd851('0x7c')]]:_0x2de9c5,'phone':_0x2de9c5,'ListId':_0x24c629[_0xd851('0x77')]}));}})[_0xd851('0x22')](handleEntityNotFound(_0x10c446,null))[_0xd851('0x22')](function(_0x36e1f0){if(_0x36e1f0){_0x53d32b=_0x36e1f0;return db['OpenchannelInteraction'][_0xd851('0x5d')]({'where':{'ContactId':_0x53d32b['id'],'closed':![],'OpenchannelAccountId':_0x24c629['id']}})[_0xd851('0x22')](function(_0x18dd91){if(_0x18dd91){return[_0x18dd91,![]];}return db[_0xd851('0x8d')]['create']({'UserId':_0x252b21[_0xd851('0xb2')]['id'],'ContactId':_0x53d32b['id'],'OpenchannelAccountId':_0x24c629['id'],'lastMsgDirection':_0xd851('0xb3'),'Messages':[_['merge'](_0x252b21['body'],{'read':![],'body':_0x252b21[_0xd851('0x5f')][_0xd851('0x5f')],'OpenchannelAccountId':_0x24c629['id'],'UserId':_0x252b21[_0xd851('0xb2')]['id'],'ContactId':_0x53d32b['id']})]},{'include':[{'model':db[_0xd851('0x99')],'as':_0xd851('0xb4')}]})[_0xd851('0x22')](function(_0x16c28d){return[_0x16c28d,!![]];});});}})[_0xd851('0x90')](function(_0x241619,_0x147972){if(_0x147972){return _0x241619;}return db[_0xd851('0x99')][_0xd851('0x5e')](_[_0xd851('0x54')](_0x252b21['body'],{'read':![],'body':_0x252b21['body']['body'],'OpenchannelAccountId':_0x24c629['id'],'OpenchannelInteractionId':_0x241619['id'],'UserId':_0x252b21['user']['id'],'ContactId':_0x53d32b['id']}))['then'](function(_0x4bc8a5){_0x241619[_0xd851('0xb5')][_0xd851('0xb4')]=[];_0x241619[_0xd851('0xb5')][_0xd851('0xb4')][_0xd851('0x96')](_0x4bc8a5['dataValues']);return _0x241619;});});}})[_0xd851('0x22')](respondWithResult(_0x10c446,null))[_0xd851('0x2c')](handleError(_0x10c446,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 2b64c4c..54429bf 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 _0x0116=['../../mysqldb','OpenchannelAccount','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x0116,0xe0));var _0x6011=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0116[_0x36884e];return _0x1cc367;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x6011('0x0'))['db'][_0x6011('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6011('0x2'),'afterUpdate':'update','afterDestroy':_0x6011('0x3')};function emitEvent(_0x569329){return function(_0x1f652c,_0x27d1cc,_0x3e0fc2){OpenchannelAccountEvents['emit'](_0x569329+':'+_0x1f652c['id'],_0x1f652c);OpenchannelAccountEvents[_0x6011('0x4')](_0x569329,_0x1f652c);_0x3e0fc2(null);};}for(var e in events){if(events[_0x6011('0x5')](e)){var event=events[e];OpenchannelAccount[_0x6011('0x6')](e,emitEvent(event));}}module[_0x6011('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x594e=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x44d244,_0x14d257){var _0x3e014b=function(_0x5075ac){while(--_0x5075ac){_0x44d244['push'](_0x44d244['shift']());}};_0x3e014b(++_0x14d257);}(_0x594e,0x164));var _0xe594=function(_0x14cd31,_0x32ae81){_0x14cd31=_0x14cd31-0x0;var _0x31191e=_0x594e[_0x14cd31];return _0x31191e;};'use strict';var EventEmitter=require(_0xe594('0x0'));var OpenchannelAccount=require(_0xe594('0x1'))['db'][_0xe594('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe594('0x3')](0x0);var events={'afterCreate':_0xe594('0x4'),'afterUpdate':_0xe594('0x5'),'afterDestroy':'remove'};function emitEvent(_0x110d64){return function(_0xd4bfde,_0x5282eb,_0x33a473){OpenchannelAccountEvents[_0xe594('0x6')](_0x110d64+':'+_0xd4bfde['id'],_0xd4bfde);OpenchannelAccountEvents[_0xe594('0x6')](_0x110d64,_0xd4bfde);_0x33a473(null);};}for(var e in events){if(events[_0xe594('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe594('0x8')](e,emitEvent(event));}}module[_0xe594('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index cab6591..95be1c6 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 _0xa0ef=['openchannel_accounts','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount'];(function(_0x32dc9c,_0x16451c){var _0x5ec13c=function(_0x121aed){while(--_0x121aed){_0x32dc9c['push'](_0x32dc9c['shift']());}};_0x5ec13c(++_0x16451c);}(_0xa0ef,0xb1));var _0xfa0e=function(_0x17bb21,_0x369098){_0x17bb21=_0x17bb21-0x0;var _0x2956a6=_0xa0ef[_0x17bb21];return _0x2956a6;};'use strict';var _=require(_0xfa0e('0x0'));var util=require('util');var logger=require(_0xfa0e('0x1'))(_0xfa0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa0e('0x3'));var fs=require('fs');var path=require(_0xfa0e('0x4'));var rimraf=require(_0xfa0e('0x5'));var config=require(_0xfa0e('0x6'));var attributes=require(_0xfa0e('0x7'));module[_0xfa0e('0x8')]=function(_0x2715f5,_0xa87618){return _0x2715f5['define'](_0xfa0e('0x9'),attributes,{'tableName':_0xfa0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9ed=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash'];(function(_0x3eac78,_0x55617c){var _0x2d5dbc=function(_0x1c0c8d){while(--_0x1c0c8d){_0x3eac78['push'](_0x3eac78['shift']());}};_0x2d5dbc(++_0x55617c);}(_0xa9ed,0x187));var _0xda9e=function(_0x4063a4,_0x19d730){_0x4063a4=_0x4063a4-0x0;var _0x17908d=_0xa9ed[_0x4063a4];return _0x17908d;};'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/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index cf6aa0a..53b8c05 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 _0x9be7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x323c14,_0x1556fc){var _0x5cf825=function(_0xae3037){while(--_0xae3037){_0x323c14['push'](_0x323c14['shift']());}};_0x5cf825(++_0x1556fc);}(_0x9be7,0x12b));var _0x79be=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x9be7[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0x79be('0x0'));var util=require(_0x79be('0x1'));var moment=require(_0x79be('0x2'));var BPromise=require(_0x79be('0x3'));var rs=require(_0x79be('0x4'));var fs=require('fs');var Redis=require(_0x79be('0x5'));var db=require(_0x79be('0x6'))['db'];var utils=require(_0x79be('0x7'));var logger=require(_0x79be('0x8'))('rpc');var config=require(_0x79be('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x79be('0xa')][_0x79be('0xb')]({'port':0x232a});config[_0x79be('0xc')]=_[_0x79be('0xd')](config[_0x79be('0xc')],{'host':_0x79be('0xe'),'port':0x18eb});var socket=require(_0x79be('0xf'))(new Redis(config[_0x79be('0xc')]));require(_0x79be('0x10'))['register'](socket);function respondWithRpcPromise(_0xb9784f,_0x43e177,_0x180cc6){return new BPromise(function(_0x168933,_0x3007a9){return client[_0x79be('0x11')](_0xb9784f,_0x180cc6)[_0x79be('0x12')](function(_0x367718){logger['info'](_0x79be('0x13'),_0x43e177,_0x79be('0x14'));logger[_0x79be('0x15')](_0x79be('0x16'),_0x43e177,_0x79be('0x14'),JSON[_0x79be('0x17')](_0x367718));if(_0x367718[_0x79be('0x18')]){if(_0x367718[_0x79be('0x18')][_0x79be('0x19')]===0x1f4){logger[_0x79be('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x43e177,_0x367718[_0x79be('0x18')][_0x79be('0x1a')]);return _0x3007a9(_0x367718[_0x79be('0x18')][_0x79be('0x1a')]);}logger[_0x79be('0x18')](_0x79be('0x13'),_0x43e177,_0x367718['error'][_0x79be('0x1a')]);return _0x168933(_0x367718[_0x79be('0x18')]['message']);}else{logger[_0x79be('0x1b')](_0x79be('0x13'),_0x43e177,_0x79be('0x14'));_0x168933(_0x367718[_0x79be('0x1c')]['message']);}})[_0x79be('0x1d')](function(_0x27186b){logger[_0x79be('0x18')](_0x79be('0x13'),_0x43e177,_0x27186b);_0x3007a9(_0x27186b);});});} \ No newline at end of file +var _0xfd9f=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','localhost','socket.io-emitter','redis','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0xdbcd9e,_0x231496){var _0x2e615f=function(_0x2d046f){while(--_0x2d046f){_0xdbcd9e['push'](_0xdbcd9e['shift']());}};_0x2e615f(++_0x231496);}(_0xfd9f,0x179));var _0xffd9=function(_0x50d5da,_0x58c96b){_0x50d5da=_0x50d5da-0x0;var _0x7f8332=_0xfd9f[_0x50d5da];return _0x7f8332;};'use strict';var _=require(_0xffd9('0x0'));var util=require(_0xffd9('0x1'));var moment=require(_0xffd9('0x2'));var BPromise=require(_0xffd9('0x3'));var rs=require(_0xffd9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd9('0x5'))['db'];var utils=require(_0xffd9('0x6'));var logger=require(_0xffd9('0x7'))(_0xffd9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xffd9('0x9')]['http']({'port':0x232a});config['redis']=_[_0xffd9('0xa')](config['redis'],{'host':_0xffd9('0xb'),'port':0x18eb});var socket=require(_0xffd9('0xc'))(new Redis(config[_0xffd9('0xd')]));require('./openchannelAccount.socket')[_0xffd9('0xe')](socket);function respondWithRpcPromise(_0x948238,_0x5099c2,_0x2c100b){return new BPromise(function(_0x309272,_0x481627){return client[_0xffd9('0xf')](_0x948238,_0x2c100b)[_0xffd9('0x10')](function(_0x5014f7){logger['info'](_0xffd9('0x11'),_0x5099c2,_0xffd9('0x12'));logger['debug'](_0xffd9('0x13'),_0x5099c2,'request\x20sent',JSON[_0xffd9('0x14')](_0x5014f7));if(_0x5014f7[_0xffd9('0x15')]){if(_0x5014f7['error'][_0xffd9('0x16')]===0x1f4){logger[_0xffd9('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x5099c2,_0x5014f7[_0xffd9('0x15')][_0xffd9('0x17')]);return _0x481627(_0x5014f7[_0xffd9('0x15')]['message']);}logger[_0xffd9('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x5099c2,_0x5014f7[_0xffd9('0x15')]['message']);return _0x309272(_0x5014f7[_0xffd9('0x15')][_0xffd9('0x17')]);}else{logger[_0xffd9('0x18')](_0xffd9('0x11'),_0x5099c2,'request\x20sent');_0x309272(_0x5014f7[_0xffd9('0x19')][_0xffd9('0x17')]);}})[_0xffd9('0x1a')](function(_0x24c664){logger[_0xffd9('0x15')](_0xffd9('0x11'),_0x5099c2,_0x24c664);_0x481627(_0x24c664);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0322ee5..062fc1e 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 _0xb61a=['remove','emit','openchannelAccount:','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb61a,0x93));var _0xab61=function(_0x36bf51,_0x34a1de){_0x36bf51=_0x36bf51-0x0;var _0x31390b=_0xb61a[_0x36bf51];return _0x31390b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xab61('0x0'),_0xab61('0x1'),'update'];function createListener(_0x131709,_0x1633f1){return function(_0x1de770){_0x1633f1[_0xab61('0x2')](_0x131709,_0x1de770);};}function removeListener(_0x26f1da,_0xf4682a){return function(){OpenchannelAccountEvents['removeListener'](_0x26f1da,_0xf4682a);};}exports['register']=function(_0x816fc4){for(var _0x4d939d=0x0,_0x4cf536=events['length'];_0x4d939d<_0x4cf536;_0x4d939d++){var _0x4d4b4d=events[_0x4d939d];var _0x2305de=createListener(_0xab61('0x3')+_0x4d4b4d,_0x816fc4);OpenchannelAccountEvents['on'](_0x4d4b4d,_0x2305de);}}; \ No newline at end of file +var _0xe1dc=['length','openchannelAccount:','./openchannelAccount.events','update','removeListener','register'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0xe1dc,0x13a));var _0xce1d=function(_0x45ef5d,_0x94c93d){_0x45ef5d=_0x45ef5d-0x0;var _0x1bcbb7=_0xe1dc[_0x45ef5d];return _0x1bcbb7;};'use strict';var OpenchannelAccountEvents=require(_0xce1d('0x0'));var events=['save','remove',_0xce1d('0x1')];function createListener(_0x3018a6,_0x35b6cc){return function(_0x347c01){_0x35b6cc['emit'](_0x3018a6,_0x347c01);};}function removeListener(_0x38b283,_0x47e598){return function(){OpenchannelAccountEvents[_0xce1d('0x2')](_0x38b283,_0x47e598);};}exports[_0xce1d('0x3')]=function(_0x2f1d80){for(var _0x6f5eb3=0x0,_0x57a43c=events[_0xce1d('0x4')];_0x6f5eb3<_0x57a43c;_0x6f5eb3++){var _0x453f0c=events[_0x6f5eb3];var _0x4333ef=createListener(_0xce1d('0x5')+_0x453f0c,_0x2f1d80);OpenchannelAccountEvents['on'](_0x453f0c,_0x4333ef);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 59a9713..62f886b 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 _0xa524=['./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment'];(function(_0xe88944,_0x375858){var _0x3491af=function(_0x4dd5a6){while(--_0x4dd5a6){_0xe88944['push'](_0xe88944['shift']());}};_0x3491af(++_0x375858);}(_0xa524,0x176));var _0x4a52=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xa524[_0x5161fc];return _0x38490b;};'use strict';var multer=require(_0x4a52('0x0'));var util=require(_0x4a52('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4a52('0x2'));var router=express[_0x4a52('0x3')]();var auth=require(_0x4a52('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4a52('0x5'));var controller=require(_0x4a52('0x6'));router[_0x4a52('0x7')]('/',auth[_0x4a52('0x8')](),controller[_0x4a52('0x9')]);router[_0x4a52('0x7')](_0x4a52('0xa'),auth['isAuthenticated'](),controller[_0x4a52('0xb')]);router[_0x4a52('0xc')]('/',auth[_0x4a52('0x8')](),controller[_0x4a52('0xd')]);router[_0x4a52('0xe')](_0x4a52('0xa'),auth[_0x4a52('0x8')](),controller[_0x4a52('0xf')]);router[_0x4a52('0x10')](_0x4a52('0xa'),auth[_0x4a52('0x8')](),controller[_0x4a52('0x11')]);module[_0x4a52('0x12')]=router; \ No newline at end of file +var _0xc62e=['get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x5f6a8a,_0x45f474){var _0x2cce4d=function(_0x590b80){while(--_0x590b80){_0x5f6a8a['push'](_0x5f6a8a['shift']());}};_0x2cce4d(++_0x45f474);}(_0xc62e,0x78));var _0xec62=function(_0x234d44,_0x24a158){_0x234d44=_0x234d44-0x0;var _0x463234=_0xc62e[_0x234d44];return _0x463234;};'use strict';var multer=require(_0xec62('0x0'));var util=require(_0xec62('0x1'));var path=require(_0xec62('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xec62('0x3')]();var auth=require(_0xec62('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xec62('0x5'));var controller=require('./openchannelApplication.controller');router[_0xec62('0x6')]('/',auth['isAuthenticated'](),controller[_0xec62('0x7')]);router['get']('/:id',auth[_0xec62('0x8')](),controller[_0xec62('0x9')]);router[_0xec62('0xa')]('/',auth['isAuthenticated'](),controller[_0xec62('0xb')]);router[_0xec62('0xc')](_0xec62('0xd'),auth[_0xec62('0x8')](),controller[_0xec62('0xe')]);router[_0xec62('0xf')](_0xec62('0xd'),auth[_0xec62('0x8')](),controller[_0xec62('0x10')]);module[_0xec62('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 2c7dbc0..05ccaa0 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 _0x2366=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x50cc40,_0x2ec2e9){var _0x326844=function(_0x44b797){while(--_0x44b797){_0x50cc40['push'](_0x50cc40['shift']());}};_0x326844(++_0x2ec2e9);}(_0x2366,0xc0));var _0x6236=function(_0x2a880e,_0x44beb7){_0x2a880e=_0x2a880e-0x0;var _0x45e0ce=_0x2366[_0x2a880e];return _0x45e0ce;};'use strict';var Sequelize=require('sequelize');module[_0x6236('0x0')]={'priority':{'type':Sequelize[_0x6236('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6236('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6236('0x3')]()},'description':{'type':Sequelize[_0x6236('0x2')]},'interval':{'type':Sequelize[_0x6236('0x2')],'defaultValue':_0x6236('0x4')}}; \ No newline at end of file +var _0x52e0=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0x52e0,0xfb));var _0x052e=function(_0x7c38a9,_0x192f0e){_0x7c38a9=_0x7c38a9-0x0;var _0x16a8a4=_0x52e0[_0x7c38a9];return _0x16a8a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x052e('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x052e('0x1')],'allowNull':![],'defaultValue':_0x052e('0x2')},'appdata':{'type':Sequelize[_0x052e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x052e('0x1')],'defaultValue':_0x052e('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 08b32c7..69c217f 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 _0x27c9=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelApplication','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','rawAttributes','filtears','options','create','body','find','params','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x1ed671,_0x2b9dee){var _0x4cff67=function(_0x116204){while(--_0x116204){_0x1ed671['push'](_0x1ed671['shift']());}};_0x4cff67(++_0x2b9dee);}(_0x27c9,0x1c1));var _0x927c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x27c9[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x927c('0x0'));var jsonpatch=require(_0x927c('0x1'));var rp=require('request-promise');var moment=require(_0x927c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x927c('0x3'));var util=require(_0x927c('0x4'));var path=require(_0x927c('0x5'));var sox=require(_0x927c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x927c('0x7'));var crypto=require(_0x927c('0x8'));var jsforce=require(_0x927c('0x9'));var deskjs=require(_0x927c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x927c('0xb'));var Papa=require(_0x927c('0xc'));var Redis=require(_0x927c('0xd'));var authService=require(_0x927c('0xe'));var qs=require(_0x927c('0xf'));var as=require(_0x927c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x927c('0x11'))(_0x927c('0x12'));var utils=require(_0x927c('0x13'));var config=require(_0x927c('0x14'));var licenseUtil=require(_0x927c('0x15'));var db=require(_0x927c('0x16'))['db'];function respondWithStatusCode(_0x57f743,_0x2e7849){_0x2e7849=_0x2e7849||0xcc;return function(_0x4c8e92){if(_0x4c8e92){return _0x57f743[_0x927c('0x17')](_0x2e7849);}return _0x57f743[_0x927c('0x18')](_0x2e7849)[_0x927c('0x19')]();};}function respondWithResult(_0x5b8167,_0x2fe5ce){_0x2fe5ce=_0x2fe5ce||0xc8;return function(_0x36c23a){if(_0x36c23a){return _0x5b8167[_0x927c('0x18')](_0x2fe5ce)[_0x927c('0x1a')](_0x36c23a);}};}function respondWithFilteredResult(_0x2954be,_0x2caaf4){return function(_0x540656){if(_0x540656){var _0xf7327c=_0x540656[_0x927c('0x1b')],_0x405bbd=_0x2caaf4[_0x927c('0x1c')],_0x59d8d0=_0x2caaf4[_0x927c('0x1c')]+_0x2caaf4[_0x927c('0x1d')],_0x14e746;if(_0x59d8d0>=_0xf7327c){_0x59d8d0=_0xf7327c;_0x14e746=0xc8;}else{_0x14e746=0xce;}_0x2954be[_0x927c('0x18')](_0x14e746);return _0x2954be[_0x927c('0x1e')](_0x927c('0x1f'),_0x405bbd+'-'+_0x59d8d0+'/'+_0xf7327c)[_0x927c('0x1a')](_0x540656);}return null;};}function patchUpdates(_0x1d168d){return function(_0x4264d6){try{jsonpatch[_0x927c('0x20')](_0x4264d6,_0x1d168d,!![]);}catch(_0xb16a7e){return BPromise[_0x927c('0x21')](_0xb16a7e);}return _0x4264d6[_0x927c('0x22')]();};}function saveUpdates(_0xf359b7,_0x303930){return function(_0x583d94){if(_0x583d94){return _0x583d94[_0x927c('0x23')](_0xf359b7)[_0x927c('0x24')](function(_0x985972){return _0x985972;});}return null;};}function removeEntity(_0x5c2cf0,_0x4e50b7){return function(_0x2e9a37){if(_0x2e9a37){return _0x2e9a37[_0x927c('0x25')]()[_0x927c('0x24')](function(){_0x5c2cf0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1d10,_0x2a4cec){return function(_0x166352){if(!_0x166352){_0x2e1d10['sendStatus'](0x194);}return _0x166352;};}function handleError(_0x42322d,_0x42d3dc){_0x42d3dc=_0x42d3dc||0x1f4;return function(_0x3b6133){logger[_0x927c('0x26')](_0x3b6133[_0x927c('0x27')]);if(_0x3b6133[_0x927c('0x28')]){delete _0x3b6133[_0x927c('0x28')];}_0x42322d[_0x927c('0x18')](_0x42d3dc)[_0x927c('0x29')](_0x3b6133);};}exports[_0x927c('0x2a')]=function(_0x53c5ea,_0x1a4c7a){var _0x419ea9={},_0xbafde6={},_0x1425f7={'count':0x0,'rows':[]};var _0x385353=_['map'](db[_0x927c('0x2b')]['rawAttributes'],function(_0x2e27cd){return{'name':_0x2e27cd[_0x927c('0x2c')],'type':_0x2e27cd[_0x927c('0x2d')][_0x927c('0x2e')]};});_0xbafde6['model']=_[_0x927c('0x2f')](_0x385353,_0x927c('0x28'));_0xbafde6['query']=_[_0x927c('0x30')](_0x53c5ea[_0x927c('0x31')]);_0xbafde6[_0x927c('0x32')]=_['intersection'](_0xbafde6[_0x927c('0x33')],_0xbafde6[_0x927c('0x31')]);_0x419ea9[_0x927c('0x34')]=_[_0x927c('0x35')](_0xbafde6[_0x927c('0x33')],qs[_0x927c('0x36')](_0x53c5ea[_0x927c('0x31')]['fields']));_0x419ea9[_0x927c('0x34')]=_0x419ea9[_0x927c('0x34')][_0x927c('0x37')]?_0x419ea9[_0x927c('0x34')]:_0xbafde6[_0x927c('0x33')];if(!_0x53c5ea['query'][_0x927c('0x38')](_0x927c('0x39'))){_0x419ea9[_0x927c('0x1d')]=qs[_0x927c('0x1d')](_0x53c5ea[_0x927c('0x31')][_0x927c('0x1d')]);_0x419ea9['offset']=qs['offset'](_0x53c5ea['query'][_0x927c('0x1c')]);}_0x419ea9[_0x927c('0x3a')]=qs[_0x927c('0x3b')](_0x53c5ea[_0x927c('0x31')][_0x927c('0x3b')]);_0x419ea9[_0x927c('0x3c')]=qs[_0x927c('0x32')](_['pick'](_0x53c5ea[_0x927c('0x31')],_0xbafde6['filters']),_0x385353);if(_0x53c5ea[_0x927c('0x31')][_0x927c('0x3d')]){_0x419ea9[_0x927c('0x3c')]=_['merge'](_0x419ea9[_0x927c('0x3c')],{'$or':_[_0x927c('0x2f')](_0x385353,function(_0x1494ca){if(_0x1494ca[_0x927c('0x2d')]!==_0x927c('0x3e')){var _0x299cf8={};_0x299cf8[_0x1494ca[_0x927c('0x28')]]={'$like':'%'+_0x53c5ea[_0x927c('0x31')][_0x927c('0x3d')]+'%'};return _0x299cf8;}})});}_0x419ea9=_[_0x927c('0x3f')]({},_0x419ea9,_0x53c5ea['options']);var _0x1f27f3={'where':_0x419ea9[_0x927c('0x3c')]};return db[_0x927c('0x2b')][_0x927c('0x1b')](_0x1f27f3)[_0x927c('0x24')](function(_0x2fd281){_0x1425f7[_0x927c('0x1b')]=_0x2fd281;if(_0x53c5ea['query'][_0x927c('0x40')]){_0x419ea9[_0x927c('0x41')]=[{'all':!![]}];}return db[_0x927c('0x2b')]['findAll'](_0x419ea9);})[_0x927c('0x24')](function(_0x46a5de){_0x1425f7[_0x927c('0x42')]=_0x46a5de;return _0x1425f7;})[_0x927c('0x24')](respondWithFilteredResult(_0x1a4c7a,_0x419ea9))[_0x927c('0x43')](handleError(_0x1a4c7a,null));};exports[_0x927c('0x44')]=function(_0x40161a,_0x20f51d){var _0x5e2250={'raw':!![],'where':{'id':_0x40161a['params']['id']}},_0x23246a={};_0x23246a['model']=_['keys'](db[_0x927c('0x2b')][_0x927c('0x45')]);_0x23246a[_0x927c('0x31')]=_[_0x927c('0x30')](_0x40161a['query']);_0x23246a[_0x927c('0x46')]=_['intersection'](_0x23246a[_0x927c('0x33')],_0x23246a[_0x927c('0x31')]);_0x5e2250['attributes']=_[_0x927c('0x35')](_0x23246a[_0x927c('0x33')],qs[_0x927c('0x36')](_0x40161a['query'][_0x927c('0x36')]));_0x5e2250[_0x927c('0x34')]=_0x5e2250[_0x927c('0x34')]['length']?_0x5e2250[_0x927c('0x34')]:_0x23246a[_0x927c('0x33')];if(_0x40161a['query'][_0x927c('0x40')]){_0x5e2250['include']=[{'all':!![]}];}_0x5e2250=_[_0x927c('0x3f')]({},_0x5e2250,_0x40161a[_0x927c('0x47')]);return db['OpenchannelApplication']['find'](_0x5e2250)['then'](handleEntityNotFound(_0x20f51d,null))[_0x927c('0x24')](respondWithResult(_0x20f51d,null))[_0x927c('0x43')](handleError(_0x20f51d,null));};exports[_0x927c('0x48')]=function(_0x50c06b,_0x26918f){return db['OpenchannelApplication'][_0x927c('0x48')](_0x50c06b[_0x927c('0x49')],{})[_0x927c('0x24')](respondWithResult(_0x26918f,0xc9))[_0x927c('0x43')](handleError(_0x26918f,null));};exports[_0x927c('0x23')]=function(_0x42e4d4,_0x21412e){if(_0x42e4d4[_0x927c('0x49')]['id']){delete _0x42e4d4[_0x927c('0x49')]['id'];}return db[_0x927c('0x2b')][_0x927c('0x4a')]({'where':{'id':_0x42e4d4[_0x927c('0x4b')]['id']}})[_0x927c('0x24')](handleEntityNotFound(_0x21412e,null))[_0x927c('0x24')](saveUpdates(_0x42e4d4[_0x927c('0x49')],null))[_0x927c('0x24')](respondWithResult(_0x21412e,null))['catch'](handleError(_0x21412e,null));};exports[_0x927c('0x25')]=function(_0x1cb7a1,_0x561d19){return db['OpenchannelApplication']['find']({'where':{'id':_0x1cb7a1[_0x927c('0x4b')]['id']}})[_0x927c('0x24')](handleEntityNotFound(_0x561d19,null))[_0x927c('0x24')](removeEntity(_0x561d19,null))[_0x927c('0x43')](handleError(_0x561d19,null));}; \ No newline at end of file +var _0x9cac=['type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelApplication','include','findAll','show','filtears','includeAll','find','catch','create','body','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x1c7a8a,_0x4bce53){var _0x3d1cf9=function(_0x540c38){while(--_0x540c38){_0x1c7a8a['push'](_0x1c7a8a['shift']());}};_0x3d1cf9(++_0x4bce53);}(_0x9cac,0xb7));var _0xc9ca=function(_0x55194c,_0x40b4a5){_0x55194c=_0x55194c-0x0;var _0x2d9738=_0x9cac[_0x55194c];return _0x2d9738;};'use strict';var pdf=require(_0xc9ca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc9ca('0x1'));var zipdir=require(_0xc9ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9ca('0x3'));var moment=require(_0xc9ca('0x4'));var BPromise=require(_0xc9ca('0x5'));var Mustache=require(_0xc9ca('0x6'));var util=require(_0xc9ca('0x7'));var path=require(_0xc9ca('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc9ca('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc9ca('0xa'));var crypto=require(_0xc9ca('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc9ca('0xc'));var toCsv=require(_0xc9ca('0xd'));var querystring=require(_0xc9ca('0xe'));var Papa=require(_0xc9ca('0xf'));var Redis=require(_0xc9ca('0x10'));var authService=require(_0xc9ca('0x11'));var qs=require(_0xc9ca('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc9ca('0x13'));var utils=require(_0xc9ca('0x14'));var config=require(_0xc9ca('0x15'));var licenseUtil=require(_0xc9ca('0x16'));var db=require(_0xc9ca('0x17'))['db'];function respondWithStatusCode(_0xca235e,_0x514d7a){_0x514d7a=_0x514d7a||0xcc;return function(_0x522122){if(_0x522122){return _0xca235e[_0xc9ca('0x18')](_0x514d7a);}return _0xca235e[_0xc9ca('0x19')](_0x514d7a)[_0xc9ca('0x1a')]();};}function respondWithResult(_0x7336e0,_0x18ce95){_0x18ce95=_0x18ce95||0xc8;return function(_0x7ee3a3){if(_0x7ee3a3){return _0x7336e0[_0xc9ca('0x19')](_0x18ce95)[_0xc9ca('0x1b')](_0x7ee3a3);}};}function respondWithFilteredResult(_0x4fe350,_0x39168f){return function(_0x24191d){if(_0x24191d){var _0x4456da=_0x24191d[_0xc9ca('0x1c')],_0x6a1d8=_0x39168f[_0xc9ca('0x1d')],_0x73056e=_0x39168f[_0xc9ca('0x1d')]+_0x39168f[_0xc9ca('0x1e')],_0xad7c39;if(_0x73056e>=_0x4456da){_0x73056e=_0x4456da;_0xad7c39=0xc8;}else{_0xad7c39=0xce;}_0x4fe350[_0xc9ca('0x19')](_0xad7c39);return _0x4fe350[_0xc9ca('0x1f')](_0xc9ca('0x20'),_0x6a1d8+'-'+_0x73056e+'/'+_0x4456da)[_0xc9ca('0x1b')](_0x24191d);}return null;};}function patchUpdates(_0x39ae65){return function(_0x3941d0){try{jsonpatch[_0xc9ca('0x21')](_0x3941d0,_0x39ae65,!![]);}catch(_0x3c3502){return BPromise['reject'](_0x3c3502);}return _0x3941d0[_0xc9ca('0x22')]();};}function saveUpdates(_0x543a76,_0x235b04){return function(_0x2bfacb){if(_0x2bfacb){return _0x2bfacb[_0xc9ca('0x23')](_0x543a76)[_0xc9ca('0x24')](function(_0xb44966){return _0xb44966;});}return null;};}function removeEntity(_0x33ba55,_0x29432c){return function(_0xdd3215){if(_0xdd3215){return _0xdd3215[_0xc9ca('0x25')]()[_0xc9ca('0x24')](function(){_0x33ba55[_0xc9ca('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb93e,_0x295a83){return function(_0x1b41f9){if(!_0x1b41f9){_0x4eb93e['sendStatus'](0x194);}return _0x1b41f9;};}function handleError(_0x5263cc,_0x5cd500){_0x5cd500=_0x5cd500||0x1f4;return function(_0x4f62b1){logger[_0xc9ca('0x26')](_0x4f62b1[_0xc9ca('0x27')]);if(_0x4f62b1[_0xc9ca('0x28')]){delete _0x4f62b1[_0xc9ca('0x28')];}_0x5263cc[_0xc9ca('0x19')](_0x5cd500)[_0xc9ca('0x29')](_0x4f62b1);};}exports[_0xc9ca('0x2a')]=function(_0x1dc1b7,_0x540050){var _0x2af4ac={},_0x711fa={},_0x20a7fc={'count':0x0,'rows':[]};var _0x59e689=_['map'](db['OpenchannelApplication'][_0xc9ca('0x2b')],function(_0x32205a){return{'name':_0x32205a[_0xc9ca('0x2c')],'type':_0x32205a[_0xc9ca('0x2d')][_0xc9ca('0x2e')]};});_0x711fa[_0xc9ca('0x2f')]=_[_0xc9ca('0x30')](_0x59e689,_0xc9ca('0x28'));_0x711fa[_0xc9ca('0x31')]=_[_0xc9ca('0x32')](_0x1dc1b7[_0xc9ca('0x31')]);_0x711fa[_0xc9ca('0x33')]=_[_0xc9ca('0x34')](_0x711fa['model'],_0x711fa[_0xc9ca('0x31')]);_0x2af4ac[_0xc9ca('0x35')]=_[_0xc9ca('0x34')](_0x711fa[_0xc9ca('0x2f')],qs['fields'](_0x1dc1b7[_0xc9ca('0x31')][_0xc9ca('0x36')]));_0x2af4ac[_0xc9ca('0x35')]=_0x2af4ac[_0xc9ca('0x35')][_0xc9ca('0x37')]?_0x2af4ac['attributes']:_0x711fa[_0xc9ca('0x2f')];if(!_0x1dc1b7['query'][_0xc9ca('0x38')]('nolimit')){_0x2af4ac[_0xc9ca('0x1e')]=qs[_0xc9ca('0x1e')](_0x1dc1b7['query'][_0xc9ca('0x1e')]);_0x2af4ac[_0xc9ca('0x1d')]=qs[_0xc9ca('0x1d')](_0x1dc1b7[_0xc9ca('0x31')][_0xc9ca('0x1d')]);}_0x2af4ac[_0xc9ca('0x39')]=qs[_0xc9ca('0x3a')](_0x1dc1b7[_0xc9ca('0x31')][_0xc9ca('0x3a')]);_0x2af4ac[_0xc9ca('0x3b')]=qs[_0xc9ca('0x33')](_[_0xc9ca('0x3c')](_0x1dc1b7[_0xc9ca('0x31')],_0x711fa[_0xc9ca('0x33')]),_0x59e689);if(_0x1dc1b7['query']['filter']){_0x2af4ac['where']=_[_0xc9ca('0x3d')](_0x2af4ac[_0xc9ca('0x3b')],{'$or':_['map'](_0x59e689,function(_0x2eeb40){if(_0x2eeb40[_0xc9ca('0x2d')]!==_0xc9ca('0x3e')){var _0x1f11fe={};_0x1f11fe[_0x2eeb40[_0xc9ca('0x28')]]={'$like':'%'+_0x1dc1b7[_0xc9ca('0x31')][_0xc9ca('0x3f')]+'%'};return _0x1f11fe;}})});}_0x2af4ac=_[_0xc9ca('0x3d')]({},_0x2af4ac,_0x1dc1b7[_0xc9ca('0x40')]);var _0x1dceeb={'where':_0x2af4ac[_0xc9ca('0x3b')]};return db[_0xc9ca('0x41')][_0xc9ca('0x1c')](_0x1dceeb)['then'](function(_0x2ca7e7){_0x20a7fc[_0xc9ca('0x1c')]=_0x2ca7e7;if(_0x1dc1b7[_0xc9ca('0x31')]['includeAll']){_0x2af4ac[_0xc9ca('0x42')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc9ca('0x43')](_0x2af4ac);})[_0xc9ca('0x24')](function(_0x54a49c){_0x20a7fc['rows']=_0x54a49c;return _0x20a7fc;})[_0xc9ca('0x24')](respondWithFilteredResult(_0x540050,_0x2af4ac))['catch'](handleError(_0x540050,null));};exports[_0xc9ca('0x44')]=function(_0xc9bd4,_0x204254){var _0x48c3c5={'raw':!![],'where':{'id':_0xc9bd4['params']['id']}},_0x2c5abc={};_0x2c5abc[_0xc9ca('0x2f')]=_[_0xc9ca('0x32')](db[_0xc9ca('0x41')][_0xc9ca('0x2b')]);_0x2c5abc[_0xc9ca('0x31')]=_[_0xc9ca('0x32')](_0xc9bd4[_0xc9ca('0x31')]);_0x2c5abc[_0xc9ca('0x45')]=_[_0xc9ca('0x34')](_0x2c5abc[_0xc9ca('0x2f')],_0x2c5abc['query']);_0x48c3c5[_0xc9ca('0x35')]=_[_0xc9ca('0x34')](_0x2c5abc[_0xc9ca('0x2f')],qs[_0xc9ca('0x36')](_0xc9bd4['query'][_0xc9ca('0x36')]));_0x48c3c5['attributes']=_0x48c3c5[_0xc9ca('0x35')]['length']?_0x48c3c5[_0xc9ca('0x35')]:_0x2c5abc[_0xc9ca('0x2f')];if(_0xc9bd4['query'][_0xc9ca('0x46')]){_0x48c3c5[_0xc9ca('0x42')]=[{'all':!![]}];}_0x48c3c5=_['merge']({},_0x48c3c5,_0xc9bd4[_0xc9ca('0x40')]);return db[_0xc9ca('0x41')][_0xc9ca('0x47')](_0x48c3c5)[_0xc9ca('0x24')](handleEntityNotFound(_0x204254,null))[_0xc9ca('0x24')](respondWithResult(_0x204254,null))[_0xc9ca('0x48')](handleError(_0x204254,null));};exports[_0xc9ca('0x49')]=function(_0x40c607,_0x132f70){return db[_0xc9ca('0x41')][_0xc9ca('0x49')](_0x40c607['body'],{})[_0xc9ca('0x24')](respondWithResult(_0x132f70,0xc9))['catch'](handleError(_0x132f70,null));};exports['update']=function(_0x481c8d,_0x5b2c0f){if(_0x481c8d['body']['id']){delete _0x481c8d[_0xc9ca('0x4a')]['id'];}return db[_0xc9ca('0x41')]['find']({'where':{'id':_0x481c8d['params']['id']}})['then'](handleEntityNotFound(_0x5b2c0f,null))[_0xc9ca('0x24')](saveUpdates(_0x481c8d[_0xc9ca('0x4a')],null))['then'](respondWithResult(_0x5b2c0f,null))[_0xc9ca('0x48')](handleError(_0x5b2c0f,null));};exports[_0xc9ca('0x25')]=function(_0x2e3ed0,_0x11581f){return db[_0xc9ca('0x41')][_0xc9ca('0x47')]({'where':{'id':_0x2e3ed0[_0xc9ca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x11581f,null))['then'](removeEntity(_0x11581f,null))[_0xc9ca('0x48')](handleError(_0x11581f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index e8471c6..3154b4c 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 _0xad3c=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x18b2c4,_0x568ebb){var _0x4f1688=function(_0x30d486){while(--_0x30d486){_0x18b2c4['push'](_0x18b2c4['shift']());}};_0x4f1688(++_0x568ebb);}(_0xad3c,0x1ee));var _0xcad3=function(_0x3a8463,_0x1d531c){_0x3a8463=_0x3a8463-0x0;var _0x3be824=_0xad3c[_0x3a8463];return _0x3be824;};'use strict';var _=require('lodash');var util=require(_0xcad3('0x0'));var logger=require(_0xcad3('0x1'))('api');var moment=require(_0xcad3('0x2'));var BPromise=require(_0xcad3('0x3'));var rp=require(_0xcad3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcad3('0x5'));var config=require('../../config/environment');var attributes=require(_0xcad3('0x6'));module[_0xcad3('0x7')]=function(_0x18199a,_0x2680bf){return _0x18199a[_0xcad3('0x8')](_0xcad3('0x9'),attributes,{'tableName':_0xcad3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcad3('0xb'),'collate':_0xcad3('0xc')});}; \ No newline at end of file +var _0x6551=['api','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x327c93,_0x2a8c61){var _0x227254=function(_0x4ab96f){while(--_0x4ab96f){_0x327c93['push'](_0x327c93['shift']());}};_0x227254(++_0x2a8c61);}(_0x6551,0x1af));var _0x1655=function(_0x25ca9a,_0xd2cde1){_0x25ca9a=_0x25ca9a-0x0;var _0x3e04e7=_0x6551[_0x25ca9a];return _0x3e04e7;};'use strict';var _=require(_0x1655('0x0'));var util=require(_0x1655('0x1'));var logger=require(_0x1655('0x2'))(_0x1655('0x3'));var moment=require('moment');var BPromise=require(_0x1655('0x4'));var rp=require(_0x1655('0x5'));var fs=require('fs');var path=require(_0x1655('0x6'));var rimraf=require(_0x1655('0x7'));var config=require('../../config/environment');var attributes=require(_0x1655('0x8'));module[_0x1655('0x9')]=function(_0xe5d462,_0x35b7eb){return _0xe5d462[_0x1655('0xa')](_0x1655('0xb'),attributes,{'tableName':_0x1655('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1655('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 0f1d785..8a122cb 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 _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(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_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 +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(_0x1ad659,_0x1ab26a){var _0x56d7e2=function(_0x3c3f02){while(--_0x3c3f02){_0x1ad659['push'](_0x1ad659['shift']());}};_0x56d7e2(++_0x1ab26a);}(_0xb10b,0x12a));var _0xbb10=function(_0x2757fc,_0xfbd23){_0x2757fc=_0x2757fc-0x0;var _0x58efc4=_0xb10b[_0x2757fc];return _0x58efc4;};'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 diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index cf8fd67..03c5f7c 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 _0x4f9e=['addTags','openchannelinteraction:update','update','delete','/:id','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/messages','download','post','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x50d8b2,_0x46f88d){var _0x2f9972=function(_0x4f728b){while(--_0x4f728b){_0x50d8b2['push'](_0x50d8b2['shift']());}};_0x2f9972(++_0x46f88d);}(_0x4f9e,0xce));var _0xe4f9=function(_0x40b3f2,_0x2c4f5f){_0x40b3f2=_0x40b3f2-0x0;var _0x4ce90c=_0x4f9e[_0x40b3f2];return _0x4ce90c;};'use strict';var multer=require(_0xe4f9('0x0'));var util=require('util');var path=require(_0xe4f9('0x1'));var timeout=require(_0xe4f9('0x2'));var express=require(_0xe4f9('0x3'));var router=express[_0xe4f9('0x4')]();var auth=require(_0xe4f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe4f9('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xe4f9('0x7')]('/',auth[_0xe4f9('0x8')](),controller['index']);router[_0xe4f9('0x7')](_0xe4f9('0x9'),auth[_0xe4f9('0x8')](),controller[_0xe4f9('0xa')]);router['get']('/:id',auth[_0xe4f9('0x8')](),controller[_0xe4f9('0xb')]);router[_0xe4f9('0x7')](_0xe4f9('0xc'),auth[_0xe4f9('0x8')](),controller['getMessages']);router[_0xe4f9('0x7')]('/:id/download',auth[_0xe4f9('0x8')](),controller[_0xe4f9('0xd')]);router[_0xe4f9('0xe')]('/',auth[_0xe4f9('0x8')](),controller['create']);router[_0xe4f9('0xe')](_0xe4f9('0xc'),auth[_0xe4f9('0x8')](),controller['addMessage']);router[_0xe4f9('0xe')]('/:id/tags',auth[_0xe4f9('0x8')](),interaction[_0xe4f9('0xf')](_0xe4f9('0x10'),_0xe4f9('0x11')),controller[_0xe4f9('0x12')]);router['put']('/:id',auth[_0xe4f9('0x8')](),interaction[_0xe4f9('0xf')](_0xe4f9('0x10'),_0xe4f9('0x13')),controller[_0xe4f9('0x14')]);router[_0xe4f9('0x15')](_0xe4f9('0x16'),auth[_0xe4f9('0x8')](),interaction[_0xe4f9('0xf')](_0xe4f9('0x10'),_0xe4f9('0x17')),controller[_0xe4f9('0x18')]);router[_0xe4f9('0x15')](_0xe4f9('0x19'),auth[_0xe4f9('0x8')](),controller[_0xe4f9('0x1a')]);module[_0xe4f9('0x1b')]=router; \ No newline at end of file +var _0x2234=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','addTags','put','openchannelinteraction:update','update','delete','destroy','removeTags','exports','util'];(function(_0x25795d,_0x45c26e){var _0x1f2cbb=function(_0x3dce1e){while(--_0x3dce1e){_0x25795d['push'](_0x25795d['shift']());}};_0x1f2cbb(++_0x45c26e);}(_0x2234,0x9f));var _0x4223=function(_0x31f308,_0x3db808){_0x31f308=_0x31f308-0x0;var _0x24faed=_0x2234[_0x31f308];return _0x24faed;};'use strict';var multer=require('multer');var util=require(_0x4223('0x0'));var path=require('path');var timeout=require(_0x4223('0x1'));var express=require(_0x4223('0x2'));var router=express[_0x4223('0x3')]();var auth=require(_0x4223('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4223('0x5'));var controller=require(_0x4223('0x6'));router[_0x4223('0x7')]('/',auth[_0x4223('0x8')](),controller[_0x4223('0x9')]);router[_0x4223('0x7')](_0x4223('0xa'),auth[_0x4223('0x8')](),controller[_0x4223('0xb')]);router[_0x4223('0x7')](_0x4223('0xc'),auth[_0x4223('0x8')](),controller[_0x4223('0xd')]);router[_0x4223('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x4223('0xe')]);router[_0x4223('0x7')](_0x4223('0xf'),auth[_0x4223('0x8')](),controller[_0x4223('0x10')]);router[_0x4223('0x11')]('/',auth['isAuthenticated'](),controller[_0x4223('0x12')]);router['post'](_0x4223('0x13'),auth[_0x4223('0x8')](),controller[_0x4223('0x14')]);router['post'](_0x4223('0x15'),auth[_0x4223('0x8')](),interaction[_0x4223('0x16')](_0x4223('0x17'),'openchannelinteraction:addtags'),controller[_0x4223('0x18')]);router[_0x4223('0x19')](_0x4223('0xc'),auth['isAuthenticated'](),interaction[_0x4223('0x16')](_0x4223('0x17'),_0x4223('0x1a')),controller[_0x4223('0x1b')]);router[_0x4223('0x1c')](_0x4223('0xc'),auth[_0x4223('0x8')](),interaction[_0x4223('0x16')](_0x4223('0x17'),'openchannelinteraction:destroy'),controller[_0x4223('0x1d')]);router[_0x4223('0x1c')](_0x4223('0x15'),auth[_0x4223('0x8')](),controller[_0x4223('0x1e')]);module[_0x4223('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 91b3b2e..181501e 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 _0x15fd=['BOOLEAN','DATE','STRING','sequelize','exports'];(function(_0x19c8a6,_0x440f35){var _0x1e0030=function(_0x4d3f58){while(--_0x4d3f58){_0x19c8a6['push'](_0x19c8a6['shift']());}};_0x1e0030(++_0x440f35);}(_0x15fd,0x1d4));var _0xd15f=function(_0x4b3f2e,_0x4fcdd4){_0x4b3f2e=_0x4b3f2e-0x0;var _0x9cbb62=_0x15fd[_0x4b3f2e];return _0x9cbb62;};'use strict';var Sequelize=require(_0xd15f('0x0'));module[_0xd15f('0x1')]={'closed':{'type':Sequelize[_0xd15f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd15f('0x3')]},'disposition':{'type':Sequelize[_0xd15f('0x4')]},'secondDisposition':{'type':Sequelize[_0xd15f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd15f('0x4')]},'note':{'type':Sequelize[_0xd15f('0x4')]},'read1stAt':{'type':Sequelize[_0xd15f('0x3')]},'threadId':{'type':Sequelize[_0xd15f('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xd15f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd15f('0x4')]}}; \ No newline at end of file +var _0xac49=['BOOLEAN','STRING','DATE','out','exports'];(function(_0x5855e4,_0x260c5d){var _0x14efc4=function(_0x307bf9){while(--_0x307bf9){_0x5855e4['push'](_0x5855e4['shift']());}};_0x14efc4(++_0x260c5d);}(_0xac49,0x126));var _0x9ac4=function(_0x1d6b86,_0x54010e){_0x1d6b86=_0x1d6b86-0x0;var _0x977fdf=_0xac49[_0x1d6b86];return _0x977fdf;};'use strict';var Sequelize=require('sequelize');module[_0x9ac4('0x0')]={'closed':{'type':Sequelize[_0x9ac4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9ac4('0x2')]},'secondDisposition':{'type':Sequelize[_0x9ac4('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9ac4('0x2')]},'read1stAt':{'type':Sequelize[_0x9ac4('0x3')]},'threadId':{'type':Sequelize[_0x9ac4('0x2')]},'externalUrl':{'type':Sequelize[_0x9ac4('0x2')]},'lastMsgAt':{'type':Sequelize[_0x9ac4('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ac4('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 099649a..49a4d90 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 _0x0f8f=['Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','params','filtears','includeAll','include','options','create','body','destroy','describe','OpenchannelMessage','omit','getMessages','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','ids','spread','Tag','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','tmp','transcript-%d-%s.zip','fullname','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','firstName','views','downloadInteraction.html','toFile','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','split','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','text','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x0f8f,0x14d));var _0xf0f8=function(_0x160248,_0x2a57e6){_0x160248=_0x160248-0x0;var _0x4e589d=_0x0f8f[_0x160248];return _0x4e589d;};'use strict';var pdf=require(_0xf0f8('0x0'));var emlformat=require(_0xf0f8('0x1'));var rimraf=require(_0xf0f8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0f8('0x3'));var rp=require(_0xf0f8('0x4'));var moment=require(_0xf0f8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf0f8('0x6'));var util=require(_0xf0f8('0x7'));var path=require('path');var sox=require(_0xf0f8('0x8'));var csv=require(_0xf0f8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf0f8('0xa'));var crypto=require(_0xf0f8('0xb'));var jsforce=require(_0xf0f8('0xc'));var deskjs=require(_0xf0f8('0xd'));var toCsv=require(_0xf0f8('0x9'));var querystring=require(_0xf0f8('0xe'));var Papa=require(_0xf0f8('0xf'));var Redis=require(_0xf0f8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf0f8('0x11'));var as=require(_0xf0f8('0x12'));var hardwareService=require(_0xf0f8('0x13'));var logger=require(_0xf0f8('0x14'))(_0xf0f8('0x15'));var utils=require(_0xf0f8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f8('0x17'));var db=require(_0xf0f8('0x18'))['db'];config['redis']=_['defaults'](config[_0xf0f8('0x19')],{'host':_0xf0f8('0x1a'),'port':0x18eb});var socket=require(_0xf0f8('0x1b'))(new Redis(config[_0xf0f8('0x19')]));require(_0xf0f8('0x1c'))['register'](socket);function respondWithStatusCode(_0x48f9a5,_0xfcf218){_0xfcf218=_0xfcf218||0xcc;return function(_0x5e7921){if(_0x5e7921){return _0x48f9a5[_0xf0f8('0x1d')](_0xfcf218);}return _0x48f9a5[_0xf0f8('0x1e')](_0xfcf218)[_0xf0f8('0x1f')]();};}function respondWithResult(_0x541247,_0x39eaef){_0x39eaef=_0x39eaef||0xc8;return function(_0x526c54){if(_0x526c54){return _0x541247[_0xf0f8('0x1e')](_0x39eaef)['json'](_0x526c54);}};}function respondWithFilteredResult(_0x47806,_0x561570){return function(_0x47e9ba){if(_0x47e9ba){var _0x13dbf7=_0x47e9ba[_0xf0f8('0x20')],_0x442787=_0x561570[_0xf0f8('0x21')],_0x8367=_0x561570[_0xf0f8('0x21')]+_0x561570[_0xf0f8('0x22')],_0x3237f3;if(_0x8367>=_0x13dbf7){_0x8367=_0x13dbf7;_0x3237f3=0xc8;}else{_0x3237f3=0xce;}_0x47806[_0xf0f8('0x1e')](_0x3237f3);return _0x47806['set'](_0xf0f8('0x23'),_0x442787+'-'+_0x8367+'/'+_0x13dbf7)['json'](_0x47e9ba);}return null;};}function patchUpdates(_0xf04cd9){return function(_0x3b581d){try{jsonpatch[_0xf0f8('0x24')](_0x3b581d,_0xf04cd9,!![]);}catch(_0x531d53){return BPromise[_0xf0f8('0x25')](_0x531d53);}return _0x3b581d[_0xf0f8('0x26')]();};}function saveUpdates(_0x3d9b12,_0x149dc1){return function(_0x464246){if(_0x464246){return _0x464246[_0xf0f8('0x27')](_0x3d9b12)[_0xf0f8('0x28')](function(_0x260697){return _0x260697;});}return null;};}function removeEntity(_0x2b4ebc,_0x470222){return function(_0x3f8d5d){if(_0x3f8d5d){return _0x3f8d5d['destroy']()[_0xf0f8('0x28')](function(){_0x2b4ebc[_0xf0f8('0x1e')](0xcc)[_0xf0f8('0x1f')]();});}};}function handleEntityNotFound(_0x2e697f,_0x1ea52c){return function(_0x5ed593){if(!_0x5ed593){_0x2e697f[_0xf0f8('0x1d')](0x194);}return _0x5ed593;};}function handleError(_0x17bd6a,_0x5e8b4f){_0x5e8b4f=_0x5e8b4f||0x1f4;return function(_0x4352ad){logger[_0xf0f8('0x29')](_0x4352ad[_0xf0f8('0x2a')]);if(_0x4352ad['name']){delete _0x4352ad[_0xf0f8('0x2b')];}_0x17bd6a[_0xf0f8('0x1e')](_0x5e8b4f)[_0xf0f8('0x2c')](_0x4352ad);};}function getInteractionUsers(_0x3d77ee,_0x36fbce){return new BPromise(function(_0x570036,_0x494bfe){try{if(_0x36fbce[_0x3d77ee['id']]){_0x3d77ee[_0xf0f8('0x2d')]=_[_0xf0f8('0x2e')](_0x36fbce[_0x3d77ee['id']],function(_0x1a8e74){return{'id':_0x1a8e74['id'],'fullname':_0x1a8e74['fullname']};});}}catch(_0x594e91){_0x494bfe(_0x594e91);}_0x570036(_0x3d77ee);});}function getInteractionTags(_0x39a755,_0x162d6d){return new BPromise(function(_0x50fe89,_0x1c17f0){try{if(_0x39a755[_0xf0f8('0x2f')]){_0x39a755[_0xf0f8('0x30')]=[];_0x39a755[_0xf0f8('0x2f')]['split'](',')[_0xf0f8('0x31')](function(_0x375bfb){_0x39a755[_0xf0f8('0x30')][_0xf0f8('0x32')](_0x162d6d[_0x375bfb]);});}delete _0x39a755[_0xf0f8('0x2f')];}catch(_0x12fbba){_0x1c17f0(_0x12fbba);}_0x50fe89(_0x39a755);});}function updateOpenchannelInteraction(_0x583c9d,_0x259c3c,_0x1d1e7c){return new BPromise(function(_0x10c3a8,_0x22a53a){return getInteractionUsers(_0x583c9d,_0x1d1e7c)[_0xf0f8('0x28')](function(_0xfe223){return getInteractionTags(_0xfe223,_0x259c3c);})['then'](function(_0x17c4c2){_0x10c3a8(_0x17c4c2);})[_0xf0f8('0x33')](function(_0x4b6658){_0x22a53a(_0x4b6658);});});}exports[_0xf0f8('0x34')]=function(_0x1a321d,_0x2b7929){var _0xf88bbe={},_0x5c7601={},_0x49bba9={'count':0x0,'rows':[]};var _0x21ac64=_[_0xf0f8('0x2e')](db[_0xf0f8('0x35')][_0xf0f8('0x36')],function(_0x2f1047){return{'name':_0x2f1047[_0xf0f8('0x37')],'type':_0x2f1047['type'][_0xf0f8('0x38')]};});_0x5c7601['model']=_[_0xf0f8('0x2e')](_0x21ac64,_0xf0f8('0x2b'));_0x5c7601[_0xf0f8('0x39')]=_[_0xf0f8('0x3a')](_0x1a321d[_0xf0f8('0x39')]);_0x5c7601[_0xf0f8('0x3b')]=_[_0xf0f8('0x3c')](_0x5c7601[_0xf0f8('0x3d')],_0x5c7601['query']);_0xf88bbe[_0xf0f8('0x3e')]=_['intersection'](_0x5c7601[_0xf0f8('0x3d')],qs['fields'](_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x3f')]));_0xf88bbe[_0xf0f8('0x3e')]=_0xf88bbe['attributes'][_0xf0f8('0x40')]?_0xf88bbe[_0xf0f8('0x3e')]:_0x5c7601[_0xf0f8('0x3d')];if(!_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x41')](_0xf0f8('0x42'))){_0xf88bbe[_0xf0f8('0x22')]=qs['limit'](_0x1a321d['query'][_0xf0f8('0x22')]);_0xf88bbe[_0xf0f8('0x21')]=qs[_0xf0f8('0x21')](_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x21')]);}_0xf88bbe[_0xf0f8('0x43')]=qs[_0xf0f8('0x44')](_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x44')]);_0xf88bbe[_0xf0f8('0x45')]=qs[_0xf0f8('0x3b')](_['pick'](_0x1a321d['query'],_0x5c7601[_0xf0f8('0x3b')]),_0x21ac64);var _0x42a017=[];var _0x29a530=squel[_0xf0f8('0x46')]()[_0xf0f8('0x47')]('id')[_0xf0f8('0x47')](_0xf0f8('0x2b'))['field'](_0xf0f8('0x48'))[_0xf0f8('0x49')](_0xf0f8('0x4a'));var _0x66f1f7=squel['select']()[_0xf0f8('0x47')]('u.id')[_0xf0f8('0x47')](_0xf0f8('0x4b'))[_0xf0f8('0x47')](_0xf0f8('0x4c'))[_0xf0f8('0x49')](_0xf0f8('0x4d'),'ui')[_0xf0f8('0x4e')](_0xf0f8('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x224fd9=squel[_0xf0f8('0x46')]()[_0xf0f8('0x49')](_0xf0f8('0x50'),'i')[_0xf0f8('0x4e')](_0xf0f8('0x51'),'c',_0xf0f8('0x52'))[_0xf0f8('0x4e')](_0xf0f8('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xf0f8('0x4e')](_0xf0f8('0x53'),'a',_0xf0f8('0x54'))['left_join']('openchannel_messages','me',_0xf0f8('0x55'))[_0xf0f8('0x4e')](_0xf0f8('0x56'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xf0f8('0x4e')](_0xf0f8('0x4a'),'t',_0xf0f8('0x57'));var _0xdec7e9=squel[_0xf0f8('0x58')]();var _0xb4d3dc=[];var _0xf7b5d1=squel[_0xf0f8('0x58')]();var _0x55196e;if(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x59')]){_0x55196e=as[_0xf0f8('0x5a')](_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x59')]);var _0xfde0dd=_0x55196e['sqlOperator'];for(var _0x2a64e6=0x0;_0x2a64e6<_0x55196e[_0xf0f8('0x5b')][_0xf0f8('0x40')];_0x2a64e6++){var _0x345282=_0x55196e[_0xf0f8('0x5b')][_0x2a64e6];var _0xdc0a1f='i';var _0x599ea2=_[_0xf0f8('0x5c')](_0x21ac64,[_0xf0f8('0x2b'),_0x345282['field']]);if(!_0x599ea2){switch(_0x345282[_0xf0f8('0x47')]){case'unreadMessages':if(_0x345282[_0xf0f8('0x5d')]==0x1){_0x224fd9['having']('`'+_0x345282[_0xf0f8('0x47')]+_0xf0f8('0x5e'));}else{_0x224fd9[_0xf0f8('0x5f')]('`'+_0x345282[_0xf0f8('0x47')]+_0xf0f8('0x60'));}break;case _0xf0f8('0x61'):if(_0x345282[_0xf0f8('0x62')]===_0xf0f8('0x63')){if(_0x345282[_0xf0f8('0x5d')]['split']('\x20')[_0xf0f8('0x40')]>0x1){_0xdec7e9[_0xfde0dd](_0xf0f8('0x64'),qs[_0xf0f8('0x65')](_0x345282[_0xf0f8('0x5d')]),null);}else{var _0x3458b1='%'+_0x345282[_0xf0f8('0x5d')]+'%';_0xdec7e9[_0xfde0dd]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3458b1,_0x3458b1,_0x3458b1);}}else{_0x599ea2=_[_0xf0f8('0x5c')](_0x21ac64,[_0xf0f8('0x2b'),_0xf0f8('0x66')]);_0x345282[_0xf0f8('0x47')]=_0xf0f8('0x66');_0x538af0=as[_0xf0f8('0x67')](_0xdc0a1f,_0x599ea2['type'],_0x345282);_0xdec7e9[_0xfde0dd](_0x538af0['text'],_0x538af0['value'][_0xf0f8('0x68')],_0x538af0[_0xf0f8('0x5d')][_0xf0f8('0x1f')]);}break;case'Tag':var _0x287840=_0x345282[_0xf0f8('0x5d')][_0xf0f8('0x69')](',')[_0xf0f8('0x2e')](function(_0x222062){return Number(_0x222062);});_0x287840[_0xf0f8('0x31')](function(_0x285ece){_0xf7b5d1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x285ece+',%');});_0xb4d3dc=_[_0xf0f8('0x6a')](_0xb4d3dc,_0x287840);break;case _0xf0f8('0x6b'):if(_0x345282[_0xf0f8('0x62')]==='$substring'){_0xdec7e9[_0xfde0dd](_0xf0f8('0x6c'),'%'+_0x345282[_0xf0f8('0x5d')]+'%',null);}else{_0x599ea2=_[_0xf0f8('0x5c')](_0x21ac64,['name',_0xf0f8('0x6d')]);_0x345282[_0xf0f8('0x47')]='UserId';_0x538af0=as[_0xf0f8('0x67')](_0xdc0a1f,_0x599ea2[_0xf0f8('0x6e')],_0x345282);_0xdec7e9[_0xfde0dd](_0x538af0[_0xf0f8('0x6f')],_0x538af0['value'][_0xf0f8('0x68')],_0x538af0[_0xf0f8('0x5d')][_0xf0f8('0x1f')]);}break;case'body':_0x538af0=as[_0xf0f8('0x67')]('me',null,_0x345282);_0xdec7e9[_0xfde0dd](_0x538af0[_0xf0f8('0x6f')],_0x538af0[_0xf0f8('0x5d')][_0xf0f8('0x68')],_0x538af0[_0xf0f8('0x5d')][_0xf0f8('0x1f')]);break;}}else{var _0x538af0=as['buildExpression'](_0xdc0a1f,_0x599ea2[_0xf0f8('0x6e')],_0x345282);_0xdec7e9[_0xfde0dd](_0x538af0[_0xf0f8('0x6f')],_0x538af0['value'][_0xf0f8('0x68')],_0x538af0[_0xf0f8('0x5d')][_0xf0f8('0x1f')]);}}}else{var _0x456eb6=_(_0x1a321d[_0xf0f8('0x39')])[_0xf0f8('0x3a')]()['map'](function(_0x25a5e7){return _['some'](_0x21ac64,[_0xf0f8('0x2b'),_0x25a5e7])?_0x25a5e7:undefined;})['compact']()[_0xf0f8('0x5d')]();if(!_[_0xf0f8('0x70')](_0x456eb6)){_0x456eb6[_0xf0f8('0x31')](function(_0x46313b){if(_0x46313b===_0xf0f8('0x71')){_0x224fd9[_0xf0f8('0x45')](_0xf0f8('0x72'),[][_0xf0f8('0x73')](_0x1a321d[_0xf0f8('0x39')][_0x46313b]));}else if(_0x46313b===_0xf0f8('0x74')){var _0x1c6c36=JSON[_0xf0f8('0x75')](_0x1a321d[_0xf0f8('0x39')][_0x46313b])['$gte'];var _0x286b0d=JSON[_0xf0f8('0x75')](_0x1a321d[_0xf0f8('0x39')][_0x46313b])[_0xf0f8('0x76')];_0x224fd9[_0xf0f8('0x45')](_0xf0f8('0x77'),_0x1c6c36,_0x286b0d);}else{if(_0x1a321d['query'][_0x46313b]===_0xf0f8('0x78')){_0x224fd9[_0xf0f8('0x45')]('i.'+_0x46313b+_0xf0f8('0x79'));}else{_0x224fd9[_0xf0f8('0x45')]('i.'+_0x46313b+_0xf0f8('0x7a'),_0x1a321d['query'][_0x46313b]);}}});}if(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x7b')]){if(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x7b')]==0x1){_0x224fd9[_0xf0f8('0x5f')](_0xf0f8('0x7c'));}else{_0x224fd9[_0xf0f8('0x5f')](_0xf0f8('0x7d'));}}if(_0x1a321d[_0xf0f8('0x39')]['tag']){_0xb4d3dc=_['isArray'](_0x1a321d['query'][_0xf0f8('0x7e')])?_0x1a321d['query'][_0xf0f8('0x7e')]:new Array(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x7e')]);_0xb4d3dc['forEach'](function(_0x1dada3){_0xf7b5d1['or'](_0xf0f8('0x7f'),'%,'+_0x1dada3+',%');});}if(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x80')]){var _0x51bb34=_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x80')][_0xf0f8('0x81')]('\x5c','\x5c\x5c')[_0xf0f8('0x81')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xf0f8('0x82')](_0x51bb34)){_0xdec7e9['or']('i.id\x20LIKE\x20?',_0x51bb34+'%');}else{_0xdec7e9['or'](_0xf0f8('0x83'),qs[_0xf0f8('0x65')](_0x51bb34))['or'](_0xf0f8('0x84'),_0x51bb34+'%')['or'](_0xf0f8('0x85'),_0x51bb34+'%');}}}_0x224fd9[_0xf0f8('0x45')](_0xdec7e9);_0x224fd9[_0xf0f8('0x86')](_0xf0f8('0x87'));var _0x50eaaf={'type':db[_0xf0f8('0x88')][_0xf0f8('0x89')][_0xf0f8('0x8a')],'raw':!![]};var _0x60a78a=_0x224fd9[_0xf0f8('0x8b')]();_0x60a78a[_0xf0f8('0x47')](_0xf0f8('0x87'));_0x60a78a[_0xf0f8('0x47')](_0xf0f8('0x8c'),_0xf0f8('0x8d'));if(_0xf88bbe[_0xf0f8('0x43')]){_0xf88bbe[_0xf0f8('0x43')]['forEach'](function(_0x32bdf2){_0x224fd9[_0xf0f8('0x43')]('i.'+_0x32bdf2[0x0],_0x32bdf2[0x1]===_0xf0f8('0x8e')?![]:!![]);});}if(!_[_0xf0f8('0x70')](_0xb4d3dc)){_0x224fd9['having'](_0xf7b5d1);_0x60a78a['where'](_0xf0f8('0x8f'),_0xb4d3dc);}BPromise[_0xf0f8('0x90')]()['then'](function(){if(!_0x55196e){if(_0x1a321d[_0xf0f8('0x39')]['OpenchannelAccountId']||_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x91')])return;_0x60a78a[_0xf0f8('0x45')](_0xf0f8('0x92'));_0x224fd9[_0xf0f8('0x45')](_0xf0f8('0x92'));return;}return _0x1a321d[_0xf0f8('0x93')][_0xf0f8('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1142b8){if(_['isEmpty'](_0x1142b8)){_0x60a78a[_0xf0f8('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x224fd9[_0xf0f8('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x60a78a[_0xf0f8('0x45')](_0xf0f8('0x72'),_[_0xf0f8('0x2e')](_0x1142b8,'id'));_0x224fd9[_0xf0f8('0x45')](_0xf0f8('0x72'),_[_0xf0f8('0x2e')](_0x1142b8,'id'));}});})[_0xf0f8('0x28')](function(){db['sequelize']['query'](_0x60a78a[_0xf0f8('0x95')](),_0x50eaaf)[_0xf0f8('0x28')](function(_0x29819f){_0x49bba9['count']=_0x29819f[_0xf0f8('0x40')];if(_0x49bba9[_0xf0f8('0x20')]===0x0)return[];return db[_0xf0f8('0x96')][_0xf0f8('0x39')](_0x29a530[_0xf0f8('0x95')](),_0x50eaaf)[_0xf0f8('0x28')](function(_0x179ae4){_0x42a017=_[_0xf0f8('0x97')](_0x179ae4,'id');_0x50eaaf=_[_0xf0f8('0x98')](_0x50eaaf,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a321d[_0xf0f8('0x39')][_0xf0f8('0x3f')]){_0xf88bbe[_0xf0f8('0x3e')][_0xf0f8('0x31')](function(_0x350f3e){_0x224fd9['field']('i.'+_0x350f3e);});}else{_0x224fd9['field'](_0xf0f8('0x8c'),_0xf0f8('0x8d'));_0x224fd9['field']('a.key',_0xf0f8('0x99'));_0x224fd9['field'](_0xf0f8('0x9a'),_0xf0f8('0x9b'));_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0x9c'));_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0x9d'),_0xf0f8('0x9e'));_0x224fd9[_0xf0f8('0x47')]('c.lastName','Contact.lastName');_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0x9f'),_0xf0f8('0xa0'));_0x224fd9['field'](_0xf0f8('0xa1'),_0xf0f8('0xa2'));_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0xa3'),_0xf0f8('0xa4'));_0x224fd9[_0xf0f8('0x47')]('c.fax','Contact.fax');_0x224fd9[_0xf0f8('0x47')]('o.fullname',_0xf0f8('0xa5'));_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0xa6'),_0xf0f8('0xa7'));_0x224fd9[_0xf0f8('0x47')](_0xf0f8('0xa8'),_0xf0f8('0x2f'));}if(_0xf88bbe[_0xf0f8('0x22')])_0x224fd9[_0xf0f8('0x22')](_0xf88bbe[_0xf0f8('0x22')]);if(_0xf88bbe[_0xf0f8('0x21')])_0x224fd9['offset'](_0xf88bbe[_0xf0f8('0x21')]);return db[_0xf0f8('0x96')][_0xf0f8('0x39')](_0x224fd9[_0xf0f8('0x95')](),_0x50eaaf);})['then'](function(_0x47abd8){_0x66f1f7[_0xf0f8('0x45')](_0xf0f8('0xa9'),_[_0xf0f8('0x2e')](_0x47abd8,'id'));return db['sequelize'][_0xf0f8('0x39')](_0x66f1f7[_0xf0f8('0x95')](),_0x50eaaf)['then'](function(_0x50b33f){var _0x1501ed=_[_0xf0f8('0xaa')](_0x50b33f,_0xf0f8('0xab'));var _0x31e0bf=[];_0x47abd8[_0xf0f8('0x31')](function(_0x8c1104){_0x31e0bf[_0xf0f8('0x32')](updateOpenchannelInteraction(_0x8c1104,_0x42a017,_0x1501ed));});return BPromise[_0xf0f8('0xac')](_0x31e0bf);});});})['then'](function(_0x4a8019){_0x49bba9[_0xf0f8('0xad')]=_0x4a8019;return _0x49bba9;})[_0xf0f8('0x28')](respondWithFilteredResult(_0x2b7929,_0xf88bbe));})['catch'](handleError(_0x2b7929,null));};exports['show']=function(_0xcf69d3,_0x4d3f6d){var _0x2cee48={};if(_0xcf69d3['query']['type']&&_0xcf69d3[_0xf0f8('0x39')][_0xf0f8('0x6e')]===_0xf0f8('0x49')){_0x2cee48[_0xf0f8('0x49')]=_0xcf69d3['params']['id'];}else{_0x2cee48['id']=_0xcf69d3[_0xf0f8('0xae')]['id'];}var _0x304ab6={'raw':![],'where':_0x2cee48},_0x33967a={};_0x33967a[_0xf0f8('0x3d')]=_['keys'](db['OpenchannelInteraction'][_0xf0f8('0x36')]);_0x33967a[_0xf0f8('0x39')]=_['keys'](_0xcf69d3['query']);_0x33967a[_0xf0f8('0xaf')]=_[_0xf0f8('0x3c')](_0x33967a['model'],_0x33967a[_0xf0f8('0x39')]);_0x304ab6['attributes']=_[_0xf0f8('0x3c')](_0x33967a['model'],qs['fields'](_0xcf69d3[_0xf0f8('0x39')]['fields']));_0x304ab6['attributes']=_0x304ab6[_0xf0f8('0x3e')][_0xf0f8('0x40')]?_0x304ab6[_0xf0f8('0x3e')]:_0x33967a[_0xf0f8('0x3d')];if(_0xcf69d3[_0xf0f8('0x39')][_0xf0f8('0xb0')]){_0x304ab6[_0xf0f8('0xb1')]=[{'all':!![]}];}_0x304ab6=_[_0xf0f8('0x98')]({},_0x304ab6,_0xcf69d3[_0xf0f8('0xb2')]);return db[_0xf0f8('0x35')][_0xf0f8('0x5c')](_0x304ab6)[_0xf0f8('0x28')](handleEntityNotFound(_0x4d3f6d,null))[_0xf0f8('0x28')](respondWithResult(_0x4d3f6d,null))[_0xf0f8('0x33')](handleError(_0x4d3f6d,null));};exports['create']=function(_0x341756,_0x442caf){return db[_0xf0f8('0x35')][_0xf0f8('0xb3')](_0x341756[_0xf0f8('0xb4')],{})[_0xf0f8('0x28')](respondWithResult(_0x442caf,0xc9))[_0xf0f8('0x33')](handleError(_0x442caf,null));};exports[_0xf0f8('0x27')]=function(_0x5d18bd,_0x583576){if(_0x5d18bd['body']['id']){delete _0x5d18bd[_0xf0f8('0xb4')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x5d18bd['params']['id']}})[_0xf0f8('0x28')](handleEntityNotFound(_0x583576,null))[_0xf0f8('0x28')](saveUpdates(_0x5d18bd['body'],null))['then'](respondWithResult(_0x583576,null))[_0xf0f8('0x33')](handleError(_0x583576,null));};exports[_0xf0f8('0xb5')]=function(_0x1f6137,_0x502acf){return db[_0xf0f8('0x35')][_0xf0f8('0x5c')]({'where':{'id':_0x1f6137['params']['id']}})['then'](handleEntityNotFound(_0x502acf,null))[_0xf0f8('0x28')](removeEntity(_0x502acf,null))[_0xf0f8('0x33')](handleError(_0x502acf,null));};exports['describe']=function(_0x4290a6,_0x3a23b4){return db[_0xf0f8('0x35')][_0xf0f8('0xb6')]()[_0xf0f8('0x28')](respondWithResult(_0x3a23b4,null))[_0xf0f8('0x33')](handleError(_0x3a23b4,null));};exports['addMessage']=function(_0x24f49b,_0x59db32,_0x63885c){return db[_0xf0f8('0xb7')][_0xf0f8('0x5c')]({'where':{'id':_0x24f49b[_0xf0f8('0xae')]['id']}})[_0xf0f8('0x28')](handleEntityNotFound(_0x59db32,null))[_0xf0f8('0x28')](function(_0x37b581){if(_0x37b581){return _0x37b581['addMessage'](_0x24f49b['body']['ids'],_[_0xf0f8('0xb8')](_0x24f49b[_0xf0f8('0xb4')],['ids','id'])||{});}})[_0xf0f8('0x28')](respondWithResult(_0x59db32,null))[_0xf0f8('0x33')](handleError(_0x59db32,null));};exports[_0xf0f8('0xb9')]=function(_0x210aa1,_0x5489e5,_0x3444e8){var _0x34dcb1={'raw':![],'where':{}};var _0x56d9ed={};var _0x6dcc65={'count':0x0,'rows':[]};return db[_0xf0f8('0x35')]['findOne']({'where':{'id':_0x210aa1['params']['id']}})[_0xf0f8('0x28')](handleEntityNotFound(_0x5489e5,null))['then'](function(_0xf16b76){if(_0xf16b76){_0x56d9ed[_0xf0f8('0x3d')]=_[_0xf0f8('0x3a')](db[_0xf0f8('0xb7')][_0xf0f8('0x36')]);_0x56d9ed['query']=_[_0xf0f8('0x3a')](_0x210aa1['query']);_0x56d9ed[_0xf0f8('0x3b')]=_[_0xf0f8('0x3c')](_0x56d9ed['model'],_0x56d9ed[_0xf0f8('0x39')]);_0x34dcb1['attributes']=_[_0xf0f8('0x3c')](_0x56d9ed['model'],qs[_0xf0f8('0x3f')](_0x210aa1[_0xf0f8('0x39')]['fields']));_0x34dcb1[_0xf0f8('0x3e')]=_0x34dcb1[_0xf0f8('0x3e')][_0xf0f8('0x40')]?_0x34dcb1['attributes']:_0x56d9ed[_0xf0f8('0x3d')];if(!_0x210aa1[_0xf0f8('0x39')]['hasOwnProperty'](_0xf0f8('0x42'))){_0x34dcb1[_0xf0f8('0x22')]=qs[_0xf0f8('0x22')](_0x210aa1[_0xf0f8('0x39')]['limit']);_0x34dcb1[_0xf0f8('0x21')]=qs[_0xf0f8('0x21')](_0x210aa1[_0xf0f8('0x39')][_0xf0f8('0x21')]);}_0x34dcb1['order']=qs['sort'](_0x210aa1[_0xf0f8('0x39')][_0xf0f8('0x44')]);_0x34dcb1[_0xf0f8('0x45')]=qs[_0xf0f8('0x3b')](_[_0xf0f8('0xba')](_0x210aa1[_0xf0f8('0x39')],_0x56d9ed[_0xf0f8('0x3b')]));_0x34dcb1[_0xf0f8('0x45')]['OpenchannelInteractionId']=_0xf16b76['id'];if(_0x210aa1[_0xf0f8('0x39')][_0xf0f8('0x80')]){_0x34dcb1[_0xf0f8('0x45')]=_[_0xf0f8('0x98')](_0x34dcb1['where'],{'$or':_[_0xf0f8('0x2e')](_0x34dcb1[_0xf0f8('0x3e')],function(_0x1f753c){var _0xd5982e={};_0xd5982e[_0x1f753c]={'$like':'%'+_0x210aa1[_0xf0f8('0x39')][_0xf0f8('0x80')]+'%'};return _0xd5982e;})});}if(_0x210aa1['query'][_0xf0f8('0xbb')]){var _0x15dcf4=_0x210aa1[_0xf0f8('0x39')]['$gte']['split'](',');var _0x561331={};_0x561331[_0x15dcf4[0x0]]={'$gte':moment(_0x15dcf4[0x1])[_0xf0f8('0xbc')](_0xf0f8('0xbd'))};_0x34dcb1[_0xf0f8('0x45')]=_[_0xf0f8('0x98')](_0x34dcb1[_0xf0f8('0x45')],_0x561331);}_0x34dcb1=_[_0xf0f8('0x98')]({},_0x34dcb1,_0x210aa1[_0xf0f8('0xb2')]);return db[_0xf0f8('0xb7')][_0xf0f8('0x20')]({'where':_0x34dcb1[_0xf0f8('0x45')]})[_0xf0f8('0x28')](function(_0x39a212){_0x6dcc65['count']=_0x39a212;if(_0x210aa1['query'][_0xf0f8('0xb0')]){_0x34dcb1[_0xf0f8('0xb1')]=[{'all':!![]}];}return db[_0xf0f8('0xb7')][_0xf0f8('0xbe')](_0x34dcb1);})[_0xf0f8('0x28')](function(_0x5026b8){_0x6dcc65[_0xf0f8('0xad')]=_0x5026b8;return _0x6dcc65;});}})[_0xf0f8('0x28')](respondWithFilteredResult(_0x5489e5,_0x34dcb1))[_0xf0f8('0x33')](handleError(_0x5489e5,null));};exports['addTags']=function(_0xa68fce,_0xe7993b,_0x5c8093){return db[_0xf0f8('0x35')][_0xf0f8('0x5c')]({'where':{'id':_0xa68fce[_0xf0f8('0xae')]['id']}})['then'](handleEntityNotFound(_0xe7993b,null))['then'](function(_0x497f0a){if(_0x497f0a){return _0x497f0a[_0xf0f8('0xbf')](_0xa68fce[_0xf0f8('0xb4')][_0xf0f8('0xc0')],_[_0xf0f8('0xb8')](_0xa68fce[_0xf0f8('0xb4')],['ids','id'])||{})[_0xf0f8('0xc1')](function(){return db[_0xf0f8('0xc2')][_0xf0f8('0xbe')]({'attributes':['id',_0xf0f8('0x2b'),_0xf0f8('0x48')],'where':{'id':_0xa68fce['body']['ids']}});})[_0xf0f8('0x28')](function(_0x243cb0){socket[_0xf0f8('0xc3')](_0xf0f8('0xc4'),{'id':Number(_0xa68fce['params']['id']),'tags':_0x243cb0||[]});return{'id':Number(_0xa68fce[_0xf0f8('0xae')]['id']),'tags':_0x243cb0||[]};});}})[_0xf0f8('0x28')](respondWithResult(_0xe7993b,null))['catch'](handleError(_0xe7993b,null));};exports[_0xf0f8('0xc5')]=function(_0x55f883,_0x4ba998,_0x664dac){return db[_0xf0f8('0x35')][_0xf0f8('0x5c')]({'where':{'id':_0x55f883['params']['id']}})[_0xf0f8('0x28')](handleEntityNotFound(_0x4ba998,null))[_0xf0f8('0x28')](function(_0x37f997){if(_0x37f997){return _0x37f997['removeTags'](_0x55f883[_0xf0f8('0x39')][_0xf0f8('0xc0')]);}})[_0xf0f8('0x28')](respondWithStatusCode(_0x4ba998,null))[_0xf0f8('0x33')](handleError(_0x4ba998,null));};exports['download']=function(_0x356294,_0x1dbf6f){var _0x549817=moment()[_0xf0f8('0xc6')]()[_0xf0f8('0x95')]();var _0x5ab61d=path[_0xf0f8('0xc7')](config[_0xf0f8('0xc8')],_0xf0f8('0xc9'),'files',_0xf0f8('0xca'));var _0x191d93=path['join'](config[_0xf0f8('0xc8')],_0xf0f8('0xc9'),'files','attachments');var _0x12b7c8=path['join'](_0x5ab61d,_0x549817);var _0x5a6356=util[_0xf0f8('0xbc')](_0xf0f8('0xcb'),_0x356294['params']['id'],_0x549817);var _0x3e7fb1=path['join'](_0x5ab61d,_0x5a6356);var _0x208d0d=[];_0x208d0d[_0xf0f8('0x32')]({'model':db['User'],'as':_0xf0f8('0x6b'),'attributes':['id',_0xf0f8('0xcc')],'raw':!![]});_0x208d0d[_0xf0f8('0x32')]({'model':db['CmContact'],'as':_0xf0f8('0x61'),'attributes':['id','firstName',_0xf0f8('0xcd')],'raw':!![]});if(_0x356294['query'][_0xf0f8('0xce')]){_0x208d0d[_0xf0f8('0x32')]({'model':db['Attachment'],'as':_0xf0f8('0xcf'),'raw':!![]});}var _0x5b4a75=[{'model':db[_0xf0f8('0xb7')],'as':_0xf0f8('0xd0'),'attributes':['id',_0xf0f8('0xb4'),_0xf0f8('0x74'),_0xf0f8('0xd1'),_0xf0f8('0xd2'),_0xf0f8('0x7b')],'include':_0x208d0d}];_0x5b4a75[_0xf0f8('0x32')]({'model':db[_0xf0f8('0xd3')],'as':_0xf0f8('0xd4'),'attributes':['id',_0xf0f8('0x2b')]});_0x5b4a75[_0xf0f8('0x32')]({'model':db[_0xf0f8('0x6b')],'as':'Owner','attributes':['id','fullname']});return db[_0xf0f8('0x35')]['find']({'where':{'id':_0x356294[_0xf0f8('0xae')]['id']},'include':_0x5b4a75})[_0xf0f8('0x28')](handleEntityNotFound(_0x1dbf6f,null))['then'](function(_0xf8e28d){if(_0xf8e28d){var _0x34ac23=_0xf8e28d[_0xf0f8('0xd5')]({'plain':!![]});fs[_0xf0f8('0xd6')](_0x12b7c8);var _0x49773a={'format':'A4','border':_0xf0f8('0xd7'),'header':{'height':_0xf0f8('0xd8'),'contents':{'first':_0xf0f8('0xd9')}},'footer':{'height':_0xf0f8('0xda'),'contents':{'default':util[_0xf0f8('0xbc')]('\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[_0xf0f8('0xbc')](_0xf0f8('0xdb'),_0xf0f8('0xdc'),_0x34ac23['id']),moment()[_0xf0f8('0xbc')]('YYYY-MM-DD')[_0xf0f8('0x95')]())}}};var _0x43f4f3={'channel':_0xf0f8('0xdc'),'account':_0x34ac23[_0xf0f8('0xd4')][_0xf0f8('0x2b')],'agent':_0x34ac23[_0xf0f8('0xdd')]?_0x34ac23['Owner'][_0xf0f8('0xcc')]:_0xf0f8('0xde'),'createdAt':moment(_0x34ac23[_0xf0f8('0x74')])['format'](_0xf0f8('0xbd'))[_0xf0f8('0x95')](),'closedAt':_0x34ac23['closed']?moment(_0x34ac23[_0xf0f8('0xdf')])['format'](_0xf0f8('0xbd'))[_0xf0f8('0x95')]():'','disposition':_0x34ac23[_0xf0f8('0xe0')],'visibility':_0x34ac23[_0xf0f8('0xe1')]?_0xf0f8('0xe2'):_0xf0f8('0xe3'),'messages':_(_0x34ac23[_0xf0f8('0xd0')])[_0xf0f8('0x80')]({'secret':![]})[_0xf0f8('0x2e')](function(_0x381243){if(_0x381243[_0xf0f8('0xcf')]){var _0x204dfd=path[_0xf0f8('0xc7')](_0x191d93,_0x381243[_0xf0f8('0xcf')]['basename']);if(fs[_0xf0f8('0xe4')](_0x204dfd)){fs[_0xf0f8('0xe5')](_0x204dfd)[_0xf0f8('0xe6')](fs[_0xf0f8('0xe7')](path[_0xf0f8('0xc7')](_0x12b7c8,_0x381243[_0xf0f8('0xcf')][_0xf0f8('0xe8')])));}}return{'date':moment(_0x381243[_0xf0f8('0x74')])[_0xf0f8('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf0f8('0x95')](),'sender':_0x381243[_0xf0f8('0xd1')]===_0xf0f8('0xe9')?_0x381243[_0xf0f8('0x6b')]?_0x381243[_0xf0f8('0x6b')]['fullname']:_0xf0f8('0xea'):_0x381243[_0xf0f8('0x61')][_0xf0f8('0xeb')]+(_0x381243[_0xf0f8('0x61')][_0xf0f8('0xcd')]?'\x20'+_0x381243['Contact'][_0xf0f8('0xcd')]:''),'body':_0x381243[_0xf0f8('0xcf')]?_0x381243['Attachment']['basename']:_0x381243[_0xf0f8('0xb4')],'direction':_0x381243[_0xf0f8('0xd1')]==='out'?'A':'C','secret':_0x381243[_0xf0f8('0xd2')],'read':_0x381243['read'],'attachment':_0x381243[_0xf0f8('0xcf')]};})[_0xf0f8('0x5d')]()};return ejs['renderFile'](path['join'](config[_0xf0f8('0xc8')],_0xf0f8('0xc9'),_0xf0f8('0xec'),_0xf0f8('0xed')),{'interaction':_0x43f4f3})[_0xf0f8('0x28')](function(_0x838962){return new BPromise(function(_0x151942,_0x29da7f){pdf['create'](_0x838962,_0x49773a)[_0xf0f8('0xee')](path[_0xf0f8('0xc7')](_0x12b7c8,_0xf0f8('0xef')+_0x34ac23['id']+'-'+_0x549817+_0xf0f8('0xf0')),function(_0x1f202e,_0x3aa047){if(_0x1f202e)return _0x29da7f(_0x1f202e);_0x151942(_0x3aa047);});});})[_0xf0f8('0x28')](function(){return new BPromise(function(_0xa6605d,_0x55f38f){zipdir(_0x12b7c8,{'saveTo':_0x3e7fb1},function(_0x185ba2,_0x525b5f){if(_0x185ba2)return _0x55f38f(_0x185ba2);return _0xa6605d(_0x525b5f);});})['then'](function(){return new BPromise(function(_0x4f93e8,_0x3dd57f){rimraf(_0x12b7c8,function(_0x201c0d){if(_0x201c0d)_0x3dd57f(_0x201c0d);return _0x4f93e8();});});})['then'](function(){return _0x1dbf6f[_0xf0f8('0xf1')](_0x3e7fb1,_0x5a6356,function(_0x1429ee){if(_0x1429ee){console['log'](_0xf0f8('0xf2'),_0x1429ee);}else{fs[_0xf0f8('0xf3')](_0x3e7fb1);}});});});}else{return _0x1dbf6f[_0xf0f8('0x1d')](0xc8);}})[_0xf0f8('0x33')](handleError(_0x1dbf6f,null));}; \ No newline at end of file +var _0x93da=['CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','isEmpty','OpenchannelAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','SELECT','clone','i.id','DESC','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','filtears','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','OpenchannelMessage','OpenchannelInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','transcript-%d-%s.zip','Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','Account','Owner','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','Openchannel','YYYY-MM-DD','N.A.','createdAt','closed','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','System','out','renderFile','views','downloadInteraction.html','toFile','.pdf','log','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','json','count','offset','status','set','apply','reject','save','update','then','destroy','error','name','map','fullname','Tags','TagIds','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','select','field','tools_tags','u.fullname','from','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','openchannel_interaction_has_tags','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text'];(function(_0x50ae21,_0xc0af16){var _0xcdc7cd=function(_0x23cdde){while(--_0x23cdde){_0x50ae21['push'](_0x50ae21['shift']());}};_0xcdc7cd(++_0xc0af16);}(_0x93da,0x7d));var _0xa93d=function(_0x152ffe,_0x7e95d){_0x152ffe=_0x152ffe-0x0;var _0x35324c=_0x93da[_0x152ffe];return _0x35324c;};'use strict';var pdf=require(_0xa93d('0x0'));var emlformat=require(_0xa93d('0x1'));var rimraf=require(_0xa93d('0x2'));var zipdir=require(_0xa93d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa93d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa93d('0x5'));var util=require(_0xa93d('0x6'));var path=require(_0xa93d('0x7'));var sox=require(_0xa93d('0x8'));var csv=require(_0xa93d('0x9'));var ejs=require(_0xa93d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa93d('0xb'));var jsforce=require(_0xa93d('0xc'));var deskjs=require(_0xa93d('0xd'));var toCsv=require(_0xa93d('0x9'));var querystring=require(_0xa93d('0xe'));var Papa=require(_0xa93d('0xf'));var Redis=require('ioredis');var authService=require(_0xa93d('0x10'));var qs=require(_0xa93d('0x11'));var as=require(_0xa93d('0x12'));var hardwareService=require(_0xa93d('0x13'));var logger=require('../../config/logger')(_0xa93d('0x14'));var utils=require(_0xa93d('0x15'));var config=require(_0xa93d('0x16'));var licenseUtil=require(_0xa93d('0x17'));var db=require(_0xa93d('0x18'))['db'];config['redis']=_[_0xa93d('0x19')](config[_0xa93d('0x1a')],{'host':_0xa93d('0x1b'),'port':0x18eb});var socket=require(_0xa93d('0x1c'))(new Redis(config['redis']));require(_0xa93d('0x1d'))['register'](socket);function respondWithStatusCode(_0x1a0161,_0x2d2ebb){_0x2d2ebb=_0x2d2ebb||0xcc;return function(_0xe96b1a){if(_0xe96b1a){return _0x1a0161[_0xa93d('0x1e')](_0x2d2ebb);}return _0x1a0161['status'](_0x2d2ebb)[_0xa93d('0x1f')]();};}function respondWithResult(_0x1237bf,_0x34ee3e){_0x34ee3e=_0x34ee3e||0xc8;return function(_0xa68de8){if(_0xa68de8){return _0x1237bf['status'](_0x34ee3e)[_0xa93d('0x20')](_0xa68de8);}};}function respondWithFilteredResult(_0x20e5a0,_0x21216d){return function(_0x2e4f62){if(_0x2e4f62){var _0x1bb5f4=_0x2e4f62[_0xa93d('0x21')],_0x3ee4e7=_0x21216d[_0xa93d('0x22')],_0x47828d=_0x21216d[_0xa93d('0x22')]+_0x21216d['limit'],_0x48744b;if(_0x47828d>=_0x1bb5f4){_0x47828d=_0x1bb5f4;_0x48744b=0xc8;}else{_0x48744b=0xce;}_0x20e5a0[_0xa93d('0x23')](_0x48744b);return _0x20e5a0[_0xa93d('0x24')]('Content-Range',_0x3ee4e7+'-'+_0x47828d+'/'+_0x1bb5f4)[_0xa93d('0x20')](_0x2e4f62);}return null;};}function patchUpdates(_0x5768d0){return function(_0x34ea33){try{jsonpatch[_0xa93d('0x25')](_0x34ea33,_0x5768d0,!![]);}catch(_0x41281c){return BPromise[_0xa93d('0x26')](_0x41281c);}return _0x34ea33[_0xa93d('0x27')]();};}function saveUpdates(_0x2f06c1,_0x1d6202){return function(_0x540640){if(_0x540640){return _0x540640[_0xa93d('0x28')](_0x2f06c1)[_0xa93d('0x29')](function(_0x32bb76){return _0x32bb76;});}return null;};}function removeEntity(_0x28fb8f,_0x81384f){return function(_0x4c702f){if(_0x4c702f){return _0x4c702f[_0xa93d('0x2a')]()['then'](function(){_0x28fb8f[_0xa93d('0x23')](0xcc)[_0xa93d('0x1f')]();});}};}function handleEntityNotFound(_0x4b55e6,_0x4edfa0){return function(_0x202a8d){if(!_0x202a8d){_0x4b55e6[_0xa93d('0x1e')](0x194);}return _0x202a8d;};}function handleError(_0x125f36,_0x418ac6){_0x418ac6=_0x418ac6||0x1f4;return function(_0x1f992b){logger[_0xa93d('0x2b')](_0x1f992b['stack']);if(_0x1f992b[_0xa93d('0x2c')]){delete _0x1f992b[_0xa93d('0x2c')];}_0x125f36[_0xa93d('0x23')](_0x418ac6)['send'](_0x1f992b);};}function getInteractionUsers(_0x443ddd,_0x42bbd3){return new BPromise(function(_0x11eced,_0x2d093e){try{if(_0x42bbd3[_0x443ddd['id']]){_0x443ddd['Users']=_[_0xa93d('0x2d')](_0x42bbd3[_0x443ddd['id']],function(_0x1335c5){return{'id':_0x1335c5['id'],'fullname':_0x1335c5[_0xa93d('0x2e')]};});}}catch(_0x42308b){_0x2d093e(_0x42308b);}_0x11eced(_0x443ddd);});}function getInteractionTags(_0x1b3e4e,_0x57a445){return new BPromise(function(_0x4dd4dc,_0x4ecdaa){try{if(_0x1b3e4e['TagIds']){_0x1b3e4e[_0xa93d('0x2f')]=[];_0x1b3e4e[_0xa93d('0x30')]['split'](',')[_0xa93d('0x31')](function(_0x2c4c1d){_0x1b3e4e[_0xa93d('0x2f')][_0xa93d('0x32')](_0x57a445[_0x2c4c1d]);});}delete _0x1b3e4e[_0xa93d('0x30')];}catch(_0x9c2544){_0x4ecdaa(_0x9c2544);}_0x4dd4dc(_0x1b3e4e);});}function updateOpenchannelInteraction(_0x1fde03,_0x502a6a,_0x448272){return new BPromise(function(_0x5e46a2,_0x8340f4){return getInteractionUsers(_0x1fde03,_0x448272)['then'](function(_0x25a8d4){return getInteractionTags(_0x25a8d4,_0x502a6a);})[_0xa93d('0x29')](function(_0xc9fad7){_0x5e46a2(_0xc9fad7);})[_0xa93d('0x33')](function(_0x29a92e){_0x8340f4(_0x29a92e);});});}exports[_0xa93d('0x34')]=function(_0x1e98eb,_0x1fc53b){var _0x2b3194={},_0x4146da={},_0xc5508a={'count':0x0,'rows':[]};var _0x1da31a=_[_0xa93d('0x2d')](db[_0xa93d('0x35')][_0xa93d('0x36')],function(_0x5cdd56){return{'name':_0x5cdd56[_0xa93d('0x37')],'type':_0x5cdd56['type'][_0xa93d('0x38')]};});_0x4146da['model']=_[_0xa93d('0x2d')](_0x1da31a,_0xa93d('0x2c'));_0x4146da[_0xa93d('0x39')]=_[_0xa93d('0x3a')](_0x1e98eb['query']);_0x4146da[_0xa93d('0x3b')]=_[_0xa93d('0x3c')](_0x4146da[_0xa93d('0x3d')],_0x4146da['query']);_0x2b3194['attributes']=_[_0xa93d('0x3c')](_0x4146da[_0xa93d('0x3d')],qs[_0xa93d('0x3e')](_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x3e')]));_0x2b3194['attributes']=_0x2b3194[_0xa93d('0x3f')][_0xa93d('0x40')]?_0x2b3194[_0xa93d('0x3f')]:_0x4146da[_0xa93d('0x3d')];if(!_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x41')]('nolimit')){_0x2b3194[_0xa93d('0x42')]=qs[_0xa93d('0x42')](_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x42')]);_0x2b3194[_0xa93d('0x22')]=qs['offset'](_0x1e98eb['query'][_0xa93d('0x22')]);}_0x2b3194[_0xa93d('0x43')]=qs[_0xa93d('0x44')](_0x1e98eb['query'][_0xa93d('0x44')]);_0x2b3194[_0xa93d('0x45')]=qs[_0xa93d('0x3b')](_[_0xa93d('0x46')](_0x1e98eb[_0xa93d('0x39')],_0x4146da[_0xa93d('0x3b')]),_0x1da31a);var _0x605ecf=[];var _0x4f4d6f=squel[_0xa93d('0x47')]()[_0xa93d('0x48')]('id')['field'](_0xa93d('0x2c'))[_0xa93d('0x48')]('color')['from'](_0xa93d('0x49'));var _0x556eb9=squel[_0xa93d('0x47')]()['field']('u.id')[_0xa93d('0x48')](_0xa93d('0x4a'))[_0xa93d('0x48')]('ui.OpenchannelInteractionId')[_0xa93d('0x4b')](_0xa93d('0x4c'),'ui')[_0xa93d('0x4d')](_0xa93d('0x4e'),'u','u.id\x20=\x20ui.UserId');var _0xa9caec=squel[_0xa93d('0x47')]()[_0xa93d('0x4b')](_0xa93d('0x4f'),'i')[_0xa93d('0x4d')](_0xa93d('0x50'),'c',_0xa93d('0x51'))[_0xa93d('0x4d')](_0xa93d('0x4e'),'o',_0xa93d('0x52'))[_0xa93d('0x4d')](_0xa93d('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xa93d('0x4d')](_0xa93d('0x54'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xa93d('0x4d')](_0xa93d('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xa93d('0x49'),'t','t.id\x20=\x20it.TagId');var _0x5bd1d5=squel[_0xa93d('0x56')]();var _0x42e883=[];var _0x5caaef=squel[_0xa93d('0x56')]();var _0x36fc38;if(_0x1e98eb['query']['search']){_0x36fc38=as[_0xa93d('0x57')](_0x1e98eb[_0xa93d('0x39')]['search']);var _0x138fa4=_0x36fc38[_0xa93d('0x58')];for(var _0x85b839=0x0;_0x85b839<_0x36fc38[_0xa93d('0x59')]['length'];_0x85b839++){var _0x34bb86=_0x36fc38['conditions'][_0x85b839];var _0x5c51a2='i';var _0x34c596=_[_0xa93d('0x5a')](_0x1da31a,[_0xa93d('0x2c'),_0x34bb86[_0xa93d('0x48')]]);if(!_0x34c596){switch(_0x34bb86[_0xa93d('0x48')]){case _0xa93d('0x5b'):if(_0x34bb86[_0xa93d('0x5c')]==0x1){_0xa9caec[_0xa93d('0x5d')]('`'+_0x34bb86[_0xa93d('0x48')]+_0xa93d('0x5e'));}else{_0xa9caec['having']('`'+_0x34bb86[_0xa93d('0x48')]+_0xa93d('0x5f'));}break;case'Contact':if(_0x34bb86['operator']===_0xa93d('0x60')){if(_0x34bb86[_0xa93d('0x5c')][_0xa93d('0x61')]('\x20')[_0xa93d('0x40')]>0x1){_0x5bd1d5[_0x138fa4](_0xa93d('0x62'),qs[_0xa93d('0x63')](_0x34bb86[_0xa93d('0x5c')]),null);}else{var _0x4def35='%'+_0x34bb86[_0xa93d('0x5c')]+'%';_0x5bd1d5[_0x138fa4]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4def35,_0x4def35,_0x4def35);}}else{_0x34c596=_[_0xa93d('0x5a')](_0x1da31a,[_0xa93d('0x2c'),_0xa93d('0x64')]);_0x34bb86[_0xa93d('0x48')]=_0xa93d('0x64');_0x3c0488=as[_0xa93d('0x65')](_0x5c51a2,_0x34c596[_0xa93d('0x66')],_0x34bb86);_0x5bd1d5[_0x138fa4](_0x3c0488[_0xa93d('0x67')],_0x3c0488[_0xa93d('0x5c')]['start'],_0x3c0488[_0xa93d('0x5c')]['end']);}break;case'Tag':var _0x390fa7=_0x34bb86['value'][_0xa93d('0x61')](',')[_0xa93d('0x2d')](function(_0x318836){return Number(_0x318836);});_0x390fa7['forEach'](function(_0x9ce4c2){_0x5caaef['or'](_0xa93d('0x68'),'%,'+_0x9ce4c2+',%');});_0x42e883=_['union'](_0x42e883,_0x390fa7);break;case _0xa93d('0x69'):if(_0x34bb86[_0xa93d('0x6a')]===_0xa93d('0x60')){_0x5bd1d5[_0x138fa4](_0xa93d('0x6b'),'%'+_0x34bb86[_0xa93d('0x5c')]+'%',null);}else{_0x34c596=_[_0xa93d('0x5a')](_0x1da31a,[_0xa93d('0x2c'),'UserId']);_0x34bb86[_0xa93d('0x48')]=_0xa93d('0x6c');_0x3c0488=as[_0xa93d('0x65')](_0x5c51a2,_0x34c596['type'],_0x34bb86);_0x5bd1d5[_0x138fa4](_0x3c0488[_0xa93d('0x67')],_0x3c0488[_0xa93d('0x5c')][_0xa93d('0x6d')],_0x3c0488[_0xa93d('0x5c')][_0xa93d('0x1f')]);}break;case _0xa93d('0x6e'):_0x3c0488=as[_0xa93d('0x65')]('me',null,_0x34bb86);_0x5bd1d5[_0x138fa4](_0x3c0488[_0xa93d('0x67')],_0x3c0488[_0xa93d('0x5c')][_0xa93d('0x6d')],_0x3c0488['value']['end']);break;}}else{var _0x3c0488=as[_0xa93d('0x65')](_0x5c51a2,_0x34c596[_0xa93d('0x66')],_0x34bb86);_0x5bd1d5[_0x138fa4](_0x3c0488[_0xa93d('0x67')],_0x3c0488[_0xa93d('0x5c')][_0xa93d('0x6d')],_0x3c0488[_0xa93d('0x5c')][_0xa93d('0x1f')]);}}}else{var _0x15464f=_(_0x1e98eb[_0xa93d('0x39')])[_0xa93d('0x3a')]()[_0xa93d('0x2d')](function(_0x4dadbb){return _['some'](_0x1da31a,[_0xa93d('0x2c'),_0x4dadbb])?_0x4dadbb:undefined;})['compact']()[_0xa93d('0x5c')]();if(!_[_0xa93d('0x6f')](_0x15464f)){_0x15464f[_0xa93d('0x31')](function(_0x350195){if(_0x350195===_0xa93d('0x70')){_0xa9caec[_0xa93d('0x45')]('i.OpenchannelAccountId\x20IN\x20?',[][_0xa93d('0x71')](_0x1e98eb[_0xa93d('0x39')][_0x350195]));}else if(_0x350195==='createdAt'){var _0x28edf9=JSON[_0xa93d('0x72')](_0x1e98eb[_0xa93d('0x39')][_0x350195])[_0xa93d('0x73')];var _0x851e9e=JSON['parse'](_0x1e98eb[_0xa93d('0x39')][_0x350195])[_0xa93d('0x74')];_0xa9caec[_0xa93d('0x45')](_0xa93d('0x75'),_0x28edf9,_0x851e9e);}else{if(_0x1e98eb[_0xa93d('0x39')][_0x350195]==='null'){_0xa9caec['where']('i.'+_0x350195+_0xa93d('0x76'));}else{_0xa9caec[_0xa93d('0x45')]('i.'+_0x350195+_0xa93d('0x77'),_0x1e98eb[_0xa93d('0x39')][_0x350195]);}}});}if(_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x78')]){if(_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x78')]==0x1){_0xa9caec[_0xa93d('0x5d')](_0xa93d('0x79'));}else{_0xa9caec[_0xa93d('0x5d')](_0xa93d('0x7a'));}}if(_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x7b')]){_0x42e883=_[_0xa93d('0x7c')](_0x1e98eb['query'][_0xa93d('0x7b')])?_0x1e98eb[_0xa93d('0x39')]['tag']:new Array(_0x1e98eb['query']['tag']);_0x42e883[_0xa93d('0x31')](function(_0x4af806){_0x5caaef['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4af806+',%');});}if(_0x1e98eb[_0xa93d('0x39')][_0xa93d('0x7d')]){var _0x45a397=_0x1e98eb[_0xa93d('0x39')]['filter']['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xa93d('0x7e'));if(qs[_0xa93d('0x7f')](_0x45a397)){_0x5bd1d5['or'](_0xa93d('0x80'),_0x45a397+'%');}else{_0x5bd1d5['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa93d('0x63')](_0x45a397))['or']('i.from\x20LIKE\x20?',_0x45a397+'%')['or'](_0xa93d('0x81'),_0x45a397+'%');}}}_0xa9caec[_0xa93d('0x45')](_0x5bd1d5);_0xa9caec[_0xa93d('0x82')]('i.id');var _0x5a673d={'type':db[_0xa93d('0x83')]['QueryTypes'][_0xa93d('0x84')],'raw':!![]};var _0x11a413=_0xa9caec[_0xa93d('0x85')]();_0x11a413[_0xa93d('0x48')](_0xa93d('0x86'));_0x11a413[_0xa93d('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa93d('0x5b'));if(_0x2b3194[_0xa93d('0x43')]){_0x2b3194[_0xa93d('0x43')][_0xa93d('0x31')](function(_0x41c4c5){_0xa9caec[_0xa93d('0x43')]('i.'+_0x41c4c5[0x0],_0x41c4c5[0x1]===_0xa93d('0x87')?![]:!![]);});}if(!_[_0xa93d('0x6f')](_0x42e883)){_0xa9caec[_0xa93d('0x5d')](_0x5caaef);_0x11a413['where'](_0xa93d('0x88'),_0x42e883);}BPromise['resolve']()[_0xa93d('0x29')](function(){if(!_0x36fc38){if(_0x1e98eb[_0xa93d('0x39')]['OpenchannelAccountId']||_0x1e98eb['query'][_0xa93d('0x89')])return;_0x11a413[_0xa93d('0x45')](_0xa93d('0x8a'));_0xa9caec['where'](_0xa93d('0x8a'));return;}return _0x1e98eb[_0xa93d('0x8b')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xa93d('0x29')](function(_0xa40106){if(_[_0xa93d('0x6f')](_0xa40106)){_0x11a413[_0xa93d('0x45')]('i.OpenchannelAccountId\x20IS\x20NULL');_0xa9caec['where'](_0xa93d('0x8c'));}else{_0x11a413['where'](_0xa93d('0x8d'),_[_0xa93d('0x2d')](_0xa40106,'id'));_0xa9caec[_0xa93d('0x45')](_0xa93d('0x8d'),_[_0xa93d('0x2d')](_0xa40106,'id'));}});})[_0xa93d('0x29')](function(){db[_0xa93d('0x8e')][_0xa93d('0x39')](_0x11a413[_0xa93d('0x8f')](),_0x5a673d)[_0xa93d('0x29')](function(_0x26f1b9){_0xc5508a[_0xa93d('0x21')]=_0x26f1b9['length'];if(_0xc5508a[_0xa93d('0x21')]===0x0)return[];return db[_0xa93d('0x8e')][_0xa93d('0x39')](_0x4f4d6f['toString'](),_0x5a673d)[_0xa93d('0x29')](function(_0x2d8fcf){_0x605ecf=_['keyBy'](_0x2d8fcf,'id');_0x5a673d=_[_0xa93d('0x90')](_0x5a673d,{'model':db[_0xa93d('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e98eb['query'][_0xa93d('0x3e')]){_0x2b3194[_0xa93d('0x3f')][_0xa93d('0x31')](function(_0x4c790d){_0xa9caec[_0xa93d('0x48')]('i.'+_0x4c790d);});}else{_0xa9caec[_0xa93d('0x48')](_0xa93d('0x91'),_0xa93d('0x5b'));_0xa9caec[_0xa93d('0x48')](_0xa93d('0x92'),_0xa93d('0x93'));_0xa9caec[_0xa93d('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0xa9caec[_0xa93d('0x48')]('i.*');_0xa9caec[_0xa93d('0x48')](_0xa93d('0x94'),'Contact.firstName');_0xa9caec[_0xa93d('0x48')](_0xa93d('0x95'),_0xa93d('0x96'));_0xa9caec['field'](_0xa93d('0x97'),'Contact.email');_0xa9caec['field'](_0xa93d('0x98'),_0xa93d('0x99'));_0xa9caec[_0xa93d('0x48')](_0xa93d('0x9a'),'Contact.mobile');_0xa9caec[_0xa93d('0x48')]('c.fax',_0xa93d('0x9b'));_0xa9caec[_0xa93d('0x48')](_0xa93d('0x9c'),_0xa93d('0x9d'));_0xa9caec['field'](_0xa93d('0x9e'),_0xa93d('0x9f'));_0xa9caec[_0xa93d('0x48')](_0xa93d('0xa0'),_0xa93d('0x30'));}if(_0x2b3194[_0xa93d('0x42')])_0xa9caec[_0xa93d('0x42')](_0x2b3194['limit']);if(_0x2b3194[_0xa93d('0x22')])_0xa9caec[_0xa93d('0x22')](_0x2b3194['offset']);return db[_0xa93d('0x8e')][_0xa93d('0x39')](_0xa9caec[_0xa93d('0x8f')](),_0x5a673d);})[_0xa93d('0x29')](function(_0x5540af){_0x556eb9[_0xa93d('0x45')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xa93d('0x2d')](_0x5540af,'id'));return db[_0xa93d('0x8e')][_0xa93d('0x39')](_0x556eb9['toString'](),_0x5a673d)['then'](function(_0x25b953){var _0x49feea=_[_0xa93d('0xa1')](_0x25b953,'OpenchannelInteractionId');var _0x5b968e=[];_0x5540af[_0xa93d('0x31')](function(_0xd7e046){_0x5b968e['push'](updateOpenchannelInteraction(_0xd7e046,_0x605ecf,_0x49feea));});return BPromise[_0xa93d('0xa2')](_0x5b968e);});});})[_0xa93d('0x29')](function(_0x5210f6){_0xc5508a[_0xa93d('0xa3')]=_0x5210f6;return _0xc5508a;})[_0xa93d('0x29')](respondWithFilteredResult(_0x1fc53b,_0x2b3194));})[_0xa93d('0x33')](handleError(_0x1fc53b,null));};exports[_0xa93d('0xa4')]=function(_0x515c49,_0x4b2157){var _0x410761={};if(_0x515c49[_0xa93d('0x39')][_0xa93d('0x66')]&&_0x515c49[_0xa93d('0x39')]['type']==='from'){_0x410761[_0xa93d('0x4b')]=_0x515c49[_0xa93d('0xa5')]['id'];}else{_0x410761['id']=_0x515c49[_0xa93d('0xa5')]['id'];}var _0x4ea16f={'raw':![],'where':_0x410761},_0x19f9e8={};_0x19f9e8[_0xa93d('0x3d')]=_[_0xa93d('0x3a')](db[_0xa93d('0x35')]['rawAttributes']);_0x19f9e8[_0xa93d('0x39')]=_['keys'](_0x515c49[_0xa93d('0x39')]);_0x19f9e8[_0xa93d('0xa6')]=_[_0xa93d('0x3c')](_0x19f9e8[_0xa93d('0x3d')],_0x19f9e8[_0xa93d('0x39')]);_0x4ea16f[_0xa93d('0x3f')]=_[_0xa93d('0x3c')](_0x19f9e8['model'],qs['fields'](_0x515c49['query']['fields']));_0x4ea16f[_0xa93d('0x3f')]=_0x4ea16f[_0xa93d('0x3f')][_0xa93d('0x40')]?_0x4ea16f[_0xa93d('0x3f')]:_0x19f9e8[_0xa93d('0x3d')];if(_0x515c49[_0xa93d('0x39')][_0xa93d('0xa7')]){_0x4ea16f[_0xa93d('0xa8')]=[{'all':!![]}];}_0x4ea16f=_['merge']({},_0x4ea16f,_0x515c49[_0xa93d('0xa9')]);return db[_0xa93d('0x35')][_0xa93d('0x5a')](_0x4ea16f)[_0xa93d('0x29')](handleEntityNotFound(_0x4b2157,null))[_0xa93d('0x29')](respondWithResult(_0x4b2157,null))[_0xa93d('0x33')](handleError(_0x4b2157,null));};exports[_0xa93d('0xaa')]=function(_0x466b08,_0x298439){return db[_0xa93d('0x35')][_0xa93d('0xaa')](_0x466b08['body'],{})['then'](respondWithResult(_0x298439,0xc9))[_0xa93d('0x33')](handleError(_0x298439,null));};exports[_0xa93d('0x28')]=function(_0x53df20,_0x597964){if(_0x53df20[_0xa93d('0x6e')]['id']){delete _0x53df20[_0xa93d('0x6e')]['id'];}return db[_0xa93d('0x35')]['find']({'where':{'id':_0x53df20[_0xa93d('0xa5')]['id']}})[_0xa93d('0x29')](handleEntityNotFound(_0x597964,null))[_0xa93d('0x29')](saveUpdates(_0x53df20[_0xa93d('0x6e')],null))['then'](respondWithResult(_0x597964,null))[_0xa93d('0x33')](handleError(_0x597964,null));};exports[_0xa93d('0x2a')]=function(_0x2e73e6,_0x16a0cf){return db[_0xa93d('0x35')][_0xa93d('0x5a')]({'where':{'id':_0x2e73e6[_0xa93d('0xa5')]['id']}})[_0xa93d('0x29')](handleEntityNotFound(_0x16a0cf,null))[_0xa93d('0x29')](removeEntity(_0x16a0cf,null))[_0xa93d('0x33')](handleError(_0x16a0cf,null));};exports[_0xa93d('0xab')]=function(_0x33fcdb,_0x20c971){return db['OpenchannelInteraction']['describe']()[_0xa93d('0x29')](respondWithResult(_0x20c971,null))[_0xa93d('0x33')](handleError(_0x20c971,null));};exports[_0xa93d('0xac')]=function(_0x235b33,_0x3c0391,_0x20d305){return db['OpenchannelMessage'][_0xa93d('0x5a')]({'where':{'id':_0x235b33[_0xa93d('0xa5')]['id']}})[_0xa93d('0x29')](handleEntityNotFound(_0x3c0391,null))[_0xa93d('0x29')](function(_0x2dbd50){if(_0x2dbd50){return _0x2dbd50['addMessage'](_0x235b33[_0xa93d('0x6e')][_0xa93d('0xad')],_[_0xa93d('0xae')](_0x235b33[_0xa93d('0x6e')],[_0xa93d('0xad'),'id'])||{});}})[_0xa93d('0x29')](respondWithResult(_0x3c0391,null))[_0xa93d('0x33')](handleError(_0x3c0391,null));};exports[_0xa93d('0xaf')]=function(_0x1064e6,_0x38cb03,_0x52bb94){var _0x12ee67={'raw':![],'where':{}};var _0x1995db={};var _0x5cb240={'count':0x0,'rows':[]};return db[_0xa93d('0x35')]['findOne']({'where':{'id':_0x1064e6[_0xa93d('0xa5')]['id']}})[_0xa93d('0x29')](handleEntityNotFound(_0x38cb03,null))[_0xa93d('0x29')](function(_0x2a41a3){if(_0x2a41a3){_0x1995db['model']=_[_0xa93d('0x3a')](db[_0xa93d('0xb0')][_0xa93d('0x36')]);_0x1995db[_0xa93d('0x39')]=_['keys'](_0x1064e6[_0xa93d('0x39')]);_0x1995db[_0xa93d('0x3b')]=_['intersection'](_0x1995db[_0xa93d('0x3d')],_0x1995db[_0xa93d('0x39')]);_0x12ee67[_0xa93d('0x3f')]=_[_0xa93d('0x3c')](_0x1995db[_0xa93d('0x3d')],qs[_0xa93d('0x3e')](_0x1064e6[_0xa93d('0x39')][_0xa93d('0x3e')]));_0x12ee67[_0xa93d('0x3f')]=_0x12ee67[_0xa93d('0x3f')][_0xa93d('0x40')]?_0x12ee67['attributes']:_0x1995db[_0xa93d('0x3d')];if(!_0x1064e6[_0xa93d('0x39')][_0xa93d('0x41')]('nolimit')){_0x12ee67[_0xa93d('0x42')]=qs[_0xa93d('0x42')](_0x1064e6[_0xa93d('0x39')][_0xa93d('0x42')]);_0x12ee67[_0xa93d('0x22')]=qs['offset'](_0x1064e6[_0xa93d('0x39')][_0xa93d('0x22')]);}_0x12ee67[_0xa93d('0x43')]=qs[_0xa93d('0x44')](_0x1064e6['query'][_0xa93d('0x44')]);_0x12ee67[_0xa93d('0x45')]=qs['filters'](_['pick'](_0x1064e6[_0xa93d('0x39')],_0x1995db[_0xa93d('0x3b')]));_0x12ee67['where'][_0xa93d('0xb1')]=_0x2a41a3['id'];if(_0x1064e6[_0xa93d('0x39')][_0xa93d('0x7d')]){_0x12ee67[_0xa93d('0x45')]=_[_0xa93d('0x90')](_0x12ee67['where'],{'$or':_['map'](_0x12ee67[_0xa93d('0x3f')],function(_0x335ad7){var _0x14d12f={};_0x14d12f[_0x335ad7]={'$like':'%'+_0x1064e6[_0xa93d('0x39')]['filter']+'%'};return _0x14d12f;})});}if(_0x1064e6[_0xa93d('0x39')][_0xa93d('0x73')]){var _0x2ba4bc=_0x1064e6[_0xa93d('0x39')][_0xa93d('0x73')][_0xa93d('0x61')](',');var _0x14218b={};_0x14218b[_0x2ba4bc[0x0]]={'$gte':moment(_0x2ba4bc[0x1])[_0xa93d('0xb2')](_0xa93d('0xb3'))};_0x12ee67[_0xa93d('0x45')]=_['merge'](_0x12ee67[_0xa93d('0x45')],_0x14218b);}_0x12ee67=_['merge']({},_0x12ee67,_0x1064e6[_0xa93d('0xa9')]);return db[_0xa93d('0xb0')]['count']({'where':_0x12ee67[_0xa93d('0x45')]})[_0xa93d('0x29')](function(_0x4b0979){_0x5cb240[_0xa93d('0x21')]=_0x4b0979;if(_0x1064e6[_0xa93d('0x39')][_0xa93d('0xa7')]){_0x12ee67[_0xa93d('0xa8')]=[{'all':!![]}];}return db[_0xa93d('0xb0')][_0xa93d('0xb4')](_0x12ee67);})[_0xa93d('0x29')](function(_0x3f6c01){_0x5cb240[_0xa93d('0xa3')]=_0x3f6c01;return _0x5cb240;});}})['then'](respondWithFilteredResult(_0x38cb03,_0x12ee67))['catch'](handleError(_0x38cb03,null));};exports[_0xa93d('0xb5')]=function(_0x2cdbdd,_0x406643,_0x3cab53){return db[_0xa93d('0x35')][_0xa93d('0x5a')]({'where':{'id':_0x2cdbdd[_0xa93d('0xa5')]['id']}})[_0xa93d('0x29')](handleEntityNotFound(_0x406643,null))[_0xa93d('0x29')](function(_0x31c698){if(_0x31c698){return _0x31c698[_0xa93d('0xb6')](_0x2cdbdd[_0xa93d('0x6e')]['ids'],_[_0xa93d('0xae')](_0x2cdbdd['body'],[_0xa93d('0xad'),'id'])||{})[_0xa93d('0xb7')](function(){return db['Tag'][_0xa93d('0xb4')]({'attributes':['id',_0xa93d('0x2c'),'color'],'where':{'id':_0x2cdbdd['body']['ids']}});})['then'](function(_0x2c3581){socket[_0xa93d('0xb8')](_0xa93d('0xb9'),{'id':Number(_0x2cdbdd[_0xa93d('0xa5')]['id']),'tags':_0x2c3581||[]});return{'id':Number(_0x2cdbdd[_0xa93d('0xa5')]['id']),'tags':_0x2c3581||[]};});}})[_0xa93d('0x29')](respondWithResult(_0x406643,null))[_0xa93d('0x33')](handleError(_0x406643,null));};exports['removeTags']=function(_0x584c23,_0xec247c,_0xa5cc0a){return db[_0xa93d('0x35')][_0xa93d('0x5a')]({'where':{'id':_0x584c23[_0xa93d('0xa5')]['id']}})['then'](handleEntityNotFound(_0xec247c,null))[_0xa93d('0x29')](function(_0x2be694){if(_0x2be694){return _0x2be694[_0xa93d('0xba')](_0x584c23[_0xa93d('0x39')][_0xa93d('0xad')]);}})[_0xa93d('0x29')](respondWithStatusCode(_0xec247c,null))[_0xa93d('0x33')](handleError(_0xec247c,null));};exports[_0xa93d('0xbb')]=function(_0xbebd7b,_0x255e70){var _0x4f93a7=moment()[_0xa93d('0xbc')]()[_0xa93d('0x8f')]();var _0x3dd33c=path[_0xa93d('0xbd')](config[_0xa93d('0xbe')],'server',_0xa93d('0xbf'),_0xa93d('0xc0'));var _0x27509a=path[_0xa93d('0xbd')](config['root'],_0xa93d('0xc1'),_0xa93d('0xbf'),'attachments');var _0x1a868a=path[_0xa93d('0xbd')](_0x3dd33c,_0x4f93a7);var _0x120478=util[_0xa93d('0xb2')](_0xa93d('0xc2'),_0xbebd7b[_0xa93d('0xa5')]['id'],_0x4f93a7);var _0x4bb842=path[_0xa93d('0xbd')](_0x3dd33c,_0x120478);var _0x328c4f=[];_0x328c4f['push']({'model':db['User'],'as':_0xa93d('0x69'),'attributes':['id',_0xa93d('0x2e')],'raw':!![]});_0x328c4f[_0xa93d('0x32')]({'model':db['CmContact'],'as':_0xa93d('0xc3'),'attributes':['id',_0xa93d('0xc4'),_0xa93d('0xc5')],'raw':!![]});if(_0xbebd7b[_0xa93d('0x39')][_0xa93d('0xc6')]){_0x328c4f[_0xa93d('0x32')]({'model':db['Attachment'],'as':_0xa93d('0xc7'),'raw':!![]});}var _0x1c41d9=[{'model':db[_0xa93d('0xb0')],'as':_0xa93d('0xc8'),'attributes':['id','body','createdAt',_0xa93d('0xc9'),_0xa93d('0xca'),_0xa93d('0x78')],'include':_0x328c4f}];_0x1c41d9['push']({'model':db['OpenchannelAccount'],'as':_0xa93d('0xcb'),'attributes':['id',_0xa93d('0x2c')]});_0x1c41d9[_0xa93d('0x32')]({'model':db[_0xa93d('0x69')],'as':_0xa93d('0xcc'),'attributes':['id',_0xa93d('0x2e')]});return db[_0xa93d('0x35')][_0xa93d('0x5a')]({'where':{'id':_0xbebd7b[_0xa93d('0xa5')]['id']},'include':_0x1c41d9})[_0xa93d('0x29')](handleEntityNotFound(_0x255e70,null))[_0xa93d('0x29')](function(_0x55dc30){if(_0x55dc30){var _0x26bbb4=_0x55dc30[_0xa93d('0xcd')]({'plain':!![]});fs[_0xa93d('0xce')](_0x1a868a);var _0x398280={'format':'A4','border':'10px','header':{'height':_0xa93d('0xcf'),'contents':{'first':_0xa93d('0xd0')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format']('%s\x20#%d',_0xa93d('0xd1'),_0x26bbb4['id']),moment()[_0xa93d('0xb2')](_0xa93d('0xd2'))[_0xa93d('0x8f')]())}}};var _0x41bedf={'channel':'Openchannel','account':_0x26bbb4[_0xa93d('0xcb')][_0xa93d('0x2c')],'agent':_0x26bbb4[_0xa93d('0xcc')]?_0x26bbb4[_0xa93d('0xcc')][_0xa93d('0x2e')]:_0xa93d('0xd3'),'createdAt':moment(_0x26bbb4[_0xa93d('0xd4')])[_0xa93d('0xb2')](_0xa93d('0xb3'))[_0xa93d('0x8f')](),'closedAt':_0x26bbb4[_0xa93d('0xd5')]?moment(_0x26bbb4['closedAt'])[_0xa93d('0xb2')](_0xa93d('0xb3'))[_0xa93d('0x8f')]():'','disposition':_0x26bbb4[_0xa93d('0xd6')],'visibility':_0x26bbb4[_0xa93d('0xd7')]?_0xa93d('0xd8'):'Private','messages':_(_0x26bbb4['Messages'])[_0xa93d('0x7d')]({'secret':![]})[_0xa93d('0x2d')](function(_0x215b5b){if(_0x215b5b[_0xa93d('0xc7')]){var _0x375438=path[_0xa93d('0xbd')](_0x27509a,_0x215b5b['Attachment'][_0xa93d('0xd9')]);if(fs[_0xa93d('0xda')](_0x375438)){fs[_0xa93d('0xdb')](_0x375438)[_0xa93d('0xdc')](fs['createWriteStream'](path[_0xa93d('0xbd')](_0x1a868a,_0x215b5b['Attachment'][_0xa93d('0xd9')])));}}return{'date':moment(_0x215b5b['createdAt'])[_0xa93d('0xb2')](_0xa93d('0xb3'))[_0xa93d('0x8f')](),'sender':_0x215b5b['direction']==='out'?_0x215b5b[_0xa93d('0x69')]?_0x215b5b[_0xa93d('0x69')][_0xa93d('0x2e')]:_0xa93d('0xdd'):_0x215b5b['Contact']['firstName']+(_0x215b5b['Contact'][_0xa93d('0xc5')]?'\x20'+_0x215b5b[_0xa93d('0xc3')][_0xa93d('0xc5')]:''),'body':_0x215b5b[_0xa93d('0xc7')]?_0x215b5b[_0xa93d('0xc7')]['basename']:_0x215b5b[_0xa93d('0x6e')],'direction':_0x215b5b[_0xa93d('0xc9')]===_0xa93d('0xde')?'A':'C','secret':_0x215b5b[_0xa93d('0xca')],'read':_0x215b5b['read'],'attachment':_0x215b5b[_0xa93d('0xc7')]};})[_0xa93d('0x5c')]()};return ejs[_0xa93d('0xdf')](path[_0xa93d('0xbd')](config['root'],_0xa93d('0xc1'),_0xa93d('0xe0'),_0xa93d('0xe1')),{'interaction':_0x41bedf})[_0xa93d('0x29')](function(_0x53f41c){return new BPromise(function(_0x27195a,_0x145a05){pdf['create'](_0x53f41c,_0x398280)[_0xa93d('0xe2')](path[_0xa93d('0xbd')](_0x1a868a,'transcript-'+_0x26bbb4['id']+'-'+_0x4f93a7+_0xa93d('0xe3')),function(_0x5043b2,_0x3bec78){if(_0x5043b2)return _0x145a05(_0x5043b2);_0x27195a(_0x3bec78);});});})[_0xa93d('0x29')](function(){return new BPromise(function(_0x3a027c,_0x5a650e){zipdir(_0x1a868a,{'saveTo':_0x4bb842},function(_0x47339b,_0x14b133){if(_0x47339b)return _0x5a650e(_0x47339b);return _0x3a027c(_0x14b133);});})[_0xa93d('0x29')](function(){return new BPromise(function(_0x57ebba,_0x54ba70){rimraf(_0x1a868a,function(_0x2548a7){if(_0x2548a7)_0x54ba70(_0x2548a7);return _0x57ebba();});});})[_0xa93d('0x29')](function(){return _0x255e70[_0xa93d('0xbb')](_0x4bb842,_0x120478,function(_0x508377){if(_0x508377){console[_0xa93d('0xe4')]('err',_0x508377);}else{fs['unlinkSync'](_0x4bb842);}});});});}else{return _0x255e70['sendStatus'](0xc8);}})[_0xa93d('0x33')](handleError(_0x255e70,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f948bec..c322458 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 _0x62e8=['save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x2b2ed8,_0x67088a){var _0x363324=function(_0x4fc8a0){while(--_0x4fc8a0){_0x2b2ed8['push'](_0x2b2ed8['shift']());}};_0x363324(++_0x67088a);}(_0x62e8,0x166));var _0x862e=function(_0x210801,_0x40fbed){_0x210801=_0x210801-0x0;var _0x2d1e17=_0x62e8[_0x210801];return _0x2d1e17;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x862e('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x862e('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x862e('0x1')](0x0);var events={'afterCreate':_0x862e('0x2'),'afterUpdate':_0x862e('0x3'),'afterDestroy':_0x862e('0x4')};function emitEvent(_0x3f2f00){return function(_0x28797a,_0x5ab5c3,_0x21283d){_0x28797a[_0x862e('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x61b536){_0x28797a[_0x862e('0x6')]('Users',_0x61b536[_0x862e('0x7')](function(_0x289eec){return{'id':_0x289eec['id']};}));return OpenchannelMessage[_0x862e('0x8')]({'where':{'OpenchannelInteractionId':_0x28797a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x862e('0x9')](function(_0x340ccd){_0x28797a[_0x862e('0x6')](_0x862e('0xa'),_0x340ccd['length']);OpenchannelInteractionEvents[_0x862e('0xb')](_0x3f2f00+':'+_0x28797a['id'],_0x28797a);OpenchannelInteractionEvents[_0x862e('0xb')](_0x3f2f00,_0x28797a);_0x21283d(null);})['catch'](_0x21283d(null));};}for(var e in events){if(events[_0x862e('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x862e('0xd')](e,emitEvent(event));}}module[_0x862e('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x82b5=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x52d502,_0x45550f){var _0xd31501=function(_0x17afab){while(--_0x17afab){_0x52d502['push'](_0x52d502['shift']());}};_0xd31501(++_0x45550f);}(_0x82b5,0xd7));var _0x582b=function(_0x4feff7,_0x18cb37){_0x4feff7=_0x4feff7-0x0;var _0x18023d=_0x82b5[_0x4feff7];return _0x18023d;};'use strict';var EventEmitter=require(_0x582b('0x0'));var OpenchannelInteraction=require(_0x582b('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x582b('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x582b('0x2'),'afterUpdate':'update','afterDestroy':_0x582b('0x3')};function emitEvent(_0x3b3937){return function(_0x4b0523,_0x1f1ffe,_0x44f6c7){_0x4b0523[_0x582b('0x4')]({'attributes':['id'],'raw':!![]})[_0x582b('0x5')](function(_0x5e949f){_0x4b0523[_0x582b('0x6')](_0x582b('0x7'),_0x5e949f[_0x582b('0x8')](function(_0x55f50c){return{'id':_0x55f50c['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4b0523['id'],'direction':'in','read':![]},'raw':!![]});})[_0x582b('0x5')](function(_0x23dedb){_0x4b0523[_0x582b('0x6')](_0x582b('0x9'),_0x23dedb[_0x582b('0xa')]);OpenchannelInteractionEvents['emit'](_0x3b3937+':'+_0x4b0523['id'],_0x4b0523);OpenchannelInteractionEvents[_0x582b('0xb')](_0x3b3937,_0x4b0523);_0x44f6c7(null);})['catch'](_0x44f6c7(null));};}for(var e in events){if(events[_0x582b('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x582b('0xd')](e,emitEvent(event));}}module[_0x582b('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 839248e..237b848 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 _0xd2bb=['openchannel_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x5aa541,_0x30a69e){var _0x256a62=function(_0x2442ec){while(--_0x2442ec){_0x5aa541['push'](_0x5aa541['shift']());}};_0x256a62(++_0x30a69e);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x5c52af,_0x6611a8){_0x5c52af=_0x5c52af-0x0;var _0x12291a=_0xd2bb[_0x5c52af];return _0x12291a;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var logger=require('../../config/logger')(_0xbd2b('0x1'));var moment=require(_0xbd2b('0x2'));var BPromise=require(_0xbd2b('0x3'));var rp=require(_0xbd2b('0x4'));var fs=require('fs');var path=require(_0xbd2b('0x5'));var rimraf=require(_0xbd2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xbd2b('0x7'));module[_0xbd2b('0x8')]=function(_0xdcd8bd,_0x2f64a8){return _0xdcd8bd[_0xbd2b('0x9')](_0xbd2b('0xa'),attributes,{'tableName':_0xbd2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30cd3f,_0x259bca,_0x3fc39e){if(_0x30cd3f['changed'](_0xbd2b('0xc'))){_0x30cd3f['closedAt']=moment()[_0xbd2b('0xd')](_0xbd2b('0xe'));}_0x3fc39e(null,_0x30cd3f);}}});}; \ No newline at end of file +var _0x3561=['openchannel_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x273b4b,_0x276c2c){var _0x86dc4b=function(_0x5bc746){while(--_0x5bc746){_0x273b4b['push'](_0x273b4b['shift']());}};_0x86dc4b(++_0x276c2c);}(_0x3561,0x94));var _0x1356=function(_0x3e4c5f,_0x3b3556){_0x3e4c5f=_0x3e4c5f-0x0;var _0x33b986=_0x3561[_0x3e4c5f];return _0x33b986;};'use strict';var _=require(_0x1356('0x0'));var util=require('util');var logger=require(_0x1356('0x1'))(_0x1356('0x2'));var moment=require(_0x1356('0x3'));var BPromise=require(_0x1356('0x4'));var rp=require(_0x1356('0x5'));var fs=require('fs');var path=require(_0x1356('0x6'));var rimraf=require(_0x1356('0x7'));var config=require(_0x1356('0x8'));var attributes=require(_0x1356('0x9'));module[_0x1356('0xa')]=function(_0x417d11,_0x36e81f){return _0x417d11[_0x1356('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x1356('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x33529f,_0x1e98ae,_0x55551e){if(_0x33529f['changed'](_0x1356('0xd'))){_0x33529f[_0x1356('0xe')]=moment()['format'](_0x1356('0xf'));}_0x55551e(null,_0x33529f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index dd11cb4..b5752eb 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 _0xbdcb=['stringify','code','error','OpenchannelInteraction,\x20%s,\x20%s','message','OpenchannelInteraction','update','body','options','raw','UpdateOpenchannelInteraction','debug','catch','AddTagsToOpenchannelInteraction','find','where','ids','omit','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x3eb717,_0xf575a0){var _0x58f2e7=function(_0x18b29b){while(--_0x18b29b){_0x3eb717['push'](_0x3eb717['shift']());}};_0x58f2e7(++_0xf575a0);}(_0xbdcb,0x65));var _0xbbdc=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xbdcb[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xbbdc('0x0'));var util=require(_0xbbdc('0x1'));var moment=require(_0xbbdc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbdc('0x3'));var db=require(_0xbbdc('0x4'))['db'];var utils=require(_0xbbdc('0x5'));var logger=require(_0xbbdc('0x6'))('rpc');var config=require(_0xbbdc('0x7'));var jayson=require(_0xbbdc('0x8'));var client=jayson[_0xbbdc('0x9')][_0xbbdc('0xa')]({'port':0x232a});config['redis']=_[_0xbbdc('0xb')](config[_0xbbdc('0xc')],{'host':_0xbbdc('0xd'),'port':0x18eb});var socket=require(_0xbbdc('0xe'))(new Redis(config['redis']));require(_0xbbdc('0xf'))[_0xbbdc('0x10')](socket);function respondWithRpcPromise(_0x57083d,_0x4b9b41,_0x2170ab){return new BPromise(function(_0x5388eb,_0x1890c3){return client[_0xbbdc('0x11')](_0x57083d,_0x2170ab)[_0xbbdc('0x12')](function(_0x19bbe8){logger[_0xbbdc('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4b9b41,_0xbbdc('0x14'));logger['debug'](_0xbbdc('0x15'),_0x4b9b41,_0xbbdc('0x14'),JSON[_0xbbdc('0x16')](_0x19bbe8));if(_0x19bbe8['error']){if(_0x19bbe8['error'][_0xbbdc('0x17')]===0x1f4){logger[_0xbbdc('0x18')](_0xbbdc('0x19'),_0x4b9b41,_0x19bbe8[_0xbbdc('0x18')][_0xbbdc('0x1a')]);return _0x1890c3(_0x19bbe8[_0xbbdc('0x18')][_0xbbdc('0x1a')]);}logger[_0xbbdc('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4b9b41,_0x19bbe8[_0xbbdc('0x18')]['message']);return _0x5388eb(_0x19bbe8[_0xbbdc('0x18')][_0xbbdc('0x1a')]);}else{logger[_0xbbdc('0x13')](_0xbbdc('0x19'),_0x4b9b41,'request\x20sent');_0x5388eb(_0x19bbe8['result'][_0xbbdc('0x1a')]);}})['catch'](function(_0x3b4748){logger[_0xbbdc('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4b9b41,_0x3b4748);_0x1890c3(_0x3b4748);});});}exports['UpdateOpenchannelInteraction']=function(_0x50b48b){var _0x5eab59=this;return new Promise(function(_0x1be9d4,_0x358981){return db[_0xbbdc('0x1b')][_0xbbdc('0x1c')](_0x50b48b[_0xbbdc('0x1d')],{'raw':_0x50b48b[_0xbbdc('0x1e')]?_0x50b48b[_0xbbdc('0x1e')][_0xbbdc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b48b['options']?_0x50b48b[_0xbbdc('0x1e')]['where']||null:null,'attributes':_0x50b48b[_0xbbdc('0x1e')]?_0x50b48b[_0xbbdc('0x1e')]['attributes']||null:null,'limit':_0x50b48b['options']?_0x50b48b[_0xbbdc('0x1e')]['limit']||null:null})[_0xbbdc('0x12')](function(_0x70acfd){logger[_0xbbdc('0x13')](_0xbbdc('0x20'),_0x50b48b);logger[_0xbbdc('0x21')](_0xbbdc('0x20'),_0x50b48b,JSON[_0xbbdc('0x16')](_0x70acfd));_0x1be9d4(_0x70acfd);})[_0xbbdc('0x22')](function(_0x91a70e){logger[_0xbbdc('0x18')](_0xbbdc('0x20'),_0x91a70e['message'],_0x50b48b);_0x358981(_0x5eab59[_0xbbdc('0x18')](0x1f4,_0x91a70e[_0xbbdc('0x1a')]));});});};exports[_0xbbdc('0x23')]=function(_0xc72295){return new Promise(function(_0x251ebb,_0x1f19fe){return db[_0xbbdc('0x1b')][_0xbbdc('0x24')]({'where':_0xc72295[_0xbbdc('0x1e')]?_0xc72295[_0xbbdc('0x1e')][_0xbbdc('0x25')]||null:null})['then'](function(_0x576035){if(_0x576035){return _0x576035['addTags'](_0xc72295[_0xbbdc('0x1d')][_0xbbdc('0x26')],_[_0xbbdc('0x27')](_0xc72295[_0xbbdc('0x1d')],['ids','id'])||{});}})['spread'](function(_0x5c3dc9){logger[_0xbbdc('0x13')]('AddTags',_0xc72295);logger[_0xbbdc('0x21')](_0xbbdc('0x28'),_0xc72295,JSON[_0xbbdc('0x16')](_0x5c3dc9));_0x251ebb(_0x5c3dc9);})['catch'](function(_0x18875f){logger[_0xbbdc('0x18')](_0xbbdc('0x28'),_0x18875f[_0xbbdc('0x1a')],_0xc72295);_0x1f19fe(_this['error'](0x1f4,_0x18875f['message']));});});}; \ No newline at end of file +var _0x59e2=['stringify','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','limit','then','UpdateOpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x59e2,0x126));var _0x259e=function(_0x392abf,_0x367732){_0x392abf=_0x392abf-0x0;var _0x4808cc=_0x59e2[_0x392abf];return _0x4808cc;};'use strict';var _=require(_0x259e('0x0'));var util=require(_0x259e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x259e('0x2'));var fs=require('fs');var Redis=require(_0x259e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x259e('0x4'));var logger=require(_0x259e('0x5'))(_0x259e('0x6'));var config=require(_0x259e('0x7'));var jayson=require(_0x259e('0x8'));var client=jayson[_0x259e('0x9')][_0x259e('0xa')]({'port':0x232a});config[_0x259e('0xb')]=_['defaults'](config['redis'],{'host':_0x259e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x259e('0xb')]));require(_0x259e('0xd'))[_0x259e('0xe')](socket);function respondWithRpcPromise(_0x10eed5,_0x5395a2,_0x1a5229){return new BPromise(function(_0x32fb88,_0x2c3e4c){return client[_0x259e('0xf')](_0x10eed5,_0x1a5229)['then'](function(_0x258b4a){logger[_0x259e('0x10')](_0x259e('0x11'),_0x5395a2,_0x259e('0x12'));logger[_0x259e('0x13')](_0x259e('0x14'),_0x5395a2,_0x259e('0x12'),JSON['stringify'](_0x258b4a));if(_0x258b4a['error']){if(_0x258b4a[_0x259e('0x15')][_0x259e('0x16')]===0x1f4){logger[_0x259e('0x15')](_0x259e('0x11'),_0x5395a2,_0x258b4a[_0x259e('0x15')][_0x259e('0x17')]);return _0x2c3e4c(_0x258b4a[_0x259e('0x15')][_0x259e('0x17')]);}logger[_0x259e('0x15')](_0x259e('0x11'),_0x5395a2,_0x258b4a[_0x259e('0x15')][_0x259e('0x17')]);return _0x32fb88(_0x258b4a[_0x259e('0x15')]['message']);}else{logger[_0x259e('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5395a2,_0x259e('0x12'));_0x32fb88(_0x258b4a[_0x259e('0x18')][_0x259e('0x17')]);}})[_0x259e('0x19')](function(_0x5efba9){logger[_0x259e('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x5395a2,_0x5efba9);_0x2c3e4c(_0x5efba9);});});}exports['UpdateOpenchannelInteraction']=function(_0x4255e2){var _0x2094ec=this;return new Promise(function(_0x16fd4a,_0x2fdfa2){return db[_0x259e('0x1a')][_0x259e('0x1b')](_0x4255e2[_0x259e('0x1c')],{'raw':_0x4255e2[_0x259e('0x1d')]?_0x4255e2[_0x259e('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4255e2[_0x259e('0x1d')]?_0x4255e2['options'][_0x259e('0x1e')]||null:null,'attributes':_0x4255e2['options']?_0x4255e2[_0x259e('0x1d')]['attributes']||null:null,'limit':_0x4255e2['options']?_0x4255e2[_0x259e('0x1d')][_0x259e('0x1f')]||null:null})[_0x259e('0x20')](function(_0x35e47b){logger[_0x259e('0x10')](_0x259e('0x21'),_0x4255e2);logger['debug']('UpdateOpenchannelInteraction',_0x4255e2,JSON[_0x259e('0x22')](_0x35e47b));_0x16fd4a(_0x35e47b);})[_0x259e('0x19')](function(_0x4a81be){logger[_0x259e('0x15')]('UpdateOpenchannelInteraction',_0x4a81be[_0x259e('0x17')],_0x4255e2);_0x2fdfa2(_0x2094ec[_0x259e('0x15')](0x1f4,_0x4a81be['message']));});});};exports[_0x259e('0x23')]=function(_0x12da8e){return new Promise(function(_0xdab214,_0x25b96e){return db[_0x259e('0x1a')][_0x259e('0x24')]({'where':_0x12da8e[_0x259e('0x1d')]?_0x12da8e[_0x259e('0x1d')][_0x259e('0x1e')]||null:null})[_0x259e('0x20')](function(_0x40b7d2){if(_0x40b7d2){return _0x40b7d2['addTags'](_0x12da8e[_0x259e('0x1c')][_0x259e('0x25')],_[_0x259e('0x26')](_0x12da8e[_0x259e('0x1c')],[_0x259e('0x25'),'id'])||{});}})[_0x259e('0x27')](function(_0x20dd6a){logger['info'](_0x259e('0x28'),_0x12da8e);logger[_0x259e('0x13')]('AddTags',_0x12da8e,JSON['stringify'](_0x20dd6a));_0xdab214(_0x20dd6a);})[_0x259e('0x19')](function(_0x191a14){logger['error']('AddTags',_0x191a14[_0x259e('0x17')],_0x12da8e);_0x25b96e(_this[_0x259e('0x15')](0x1f4,_0x191a14['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b6d3f91..967510a 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 _0x756d=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','remove','emit'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x756d,0x8d));var _0xd756=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x756d[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelInteractionEvents=require(_0xd756('0x0'));var events=['save',_0xd756('0x1'),'update'];function createListener(_0x27b994,_0x279d3e){return function(_0x4e9edf){_0x279d3e[_0xd756('0x2')](_0x27b994,_0x4e9edf);};}function removeListener(_0x3180c0,_0x466af5){return function(){OpenchannelInteractionEvents[_0xd756('0x3')](_0x3180c0,_0x466af5);};}exports['register']=function(_0x1b7a39){for(var _0x4850f3=0x0,_0x5ae606=events[_0xd756('0x4')];_0x4850f3<_0x5ae606;_0x4850f3++){var _0x260289=events[_0x4850f3];var _0x1f24d5=createListener(_0xd756('0x5')+_0x260289,_0x1b7a39);OpenchannelInteractionEvents['on'](_0x260289,_0x1f24d5);}}; \ No newline at end of file +var _0xb234=['length','./openchannelInteraction.events','remove','update','removeListener','register'];(function(_0x120303,_0x1ccbc0){var _0x130a64=function(_0x1afdcb){while(--_0x1afdcb){_0x120303['push'](_0x120303['shift']());}};_0x130a64(++_0x1ccbc0);}(_0xb234,0x8b));var _0x4b23=function(_0x4f17b1,_0x4bd96a){_0x4f17b1=_0x4f17b1-0x0;var _0x58f242=_0xb234[_0x4f17b1];return _0x58f242;};'use strict';var OpenchannelInteractionEvents=require(_0x4b23('0x0'));var events=['save',_0x4b23('0x1'),_0x4b23('0x2')];function createListener(_0x51e5b4,_0x110b05){return function(_0x1d07d1){_0x110b05['emit'](_0x51e5b4,_0x1d07d1);};}function removeListener(_0x899b96,_0x5d09a8){return function(){OpenchannelInteractionEvents[_0x4b23('0x3')](_0x899b96,_0x5d09a8);};}exports[_0x4b23('0x4')]=function(_0x39dc1b){for(var _0x52f98d=0x0,_0x10aa49=events[_0x4b23('0x5')];_0x52f98d<_0x10aa49;_0x52f98d++){var _0x1e2841=events[_0x52f98d];var _0x5e2d9a=createListener('openchannelInteraction:'+_0x1e2841,_0x39dc1b);OpenchannelInteractionEvents['on'](_0x1e2841,_0x5e2d9a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index e3eff5d..3aa72c4 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 _0x18e5=['reject','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x18e5,0x116));var _0x518e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x18e5[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x518e('0x0'));var path=require(_0x518e('0x1'));var timeout=require(_0x518e('0x2'));var express=require('express');var router=express[_0x518e('0x3')]();var auth=require(_0x518e('0x4'));var interaction=require(_0x518e('0x5'));var config=require('../../config/environment');var controller=require(_0x518e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x518e('0x7')]);router[_0x518e('0x8')](_0x518e('0x9'),auth[_0x518e('0xa')](),controller[_0x518e('0xb')]);router[_0x518e('0x8')](_0x518e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x518e('0xd')]('/',auth[_0x518e('0xa')](),interaction[_0x518e('0xe')](_0x518e('0xf'),_0x518e('0x10')),controller[_0x518e('0x11')]);router[_0x518e('0x12')]('/:id',auth[_0x518e('0xa')](),controller['update']);router[_0x518e('0x12')](_0x518e('0x13'),auth[_0x518e('0xa')](),controller[_0x518e('0x14')]);router[_0x518e('0x12')](_0x518e('0x15'),auth[_0x518e('0xa')](),controller[_0x518e('0x16')]);router['delete'](_0x518e('0xc'),auth[_0x518e('0xa')](),controller[_0x518e('0x17')]);module[_0x518e('0x18')]=router; \ No newline at end of file +var _0x9eee=['../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','describe','/:id','post','openchannel','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','exports','util','path','express','Router','../../components/auth/service'];(function(_0x49477f,_0xcd3b07){var _0x15e5bc=function(_0x34fc24){while(--_0x34fc24){_0x49477f['push'](_0x49477f['shift']());}};_0x15e5bc(++_0xcd3b07);}(_0x9eee,0x17b));var _0xe9ee=function(_0x7f02b7,_0x1e8341){_0x7f02b7=_0x7f02b7-0x0;var _0x14d904=_0x9eee[_0x7f02b7];return _0x14d904;};'use strict';var multer=require('multer');var util=require(_0xe9ee('0x0'));var path=require(_0xe9ee('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9ee('0x2'));var router=express[_0xe9ee('0x3')]();var auth=require(_0xe9ee('0x4'));var interaction=require(_0xe9ee('0x5'));var config=require(_0xe9ee('0x6'));var controller=require(_0xe9ee('0x7'));router[_0xe9ee('0x8')]('/',auth[_0xe9ee('0x9')](),controller[_0xe9ee('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe9ee('0xb')]);router[_0xe9ee('0x8')](_0xe9ee('0xc'),auth[_0xe9ee('0x9')](),controller['show']);router[_0xe9ee('0xd')]('/',auth[_0xe9ee('0x9')](),interaction['tracked'](_0xe9ee('0xe'),_0xe9ee('0xf')),controller[_0xe9ee('0x10')]);router['put'](_0xe9ee('0xc'),auth[_0xe9ee('0x9')](),controller['update']);router[_0xe9ee('0x11')](_0xe9ee('0x12'),auth[_0xe9ee('0x9')](),controller[_0xe9ee('0x13')]);router[_0xe9ee('0x11')](_0xe9ee('0x14'),auth['isAuthenticated'](),controller[_0xe9ee('0x15')]);router[_0xe9ee('0x16')](_0xe9ee('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xe9ee('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2a2372d..654f4bc 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 _0xf248=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x244301,_0x307c72){var _0x420e27=function(_0x1a6b9e){while(--_0x1a6b9e){_0x244301['push'](_0x244301['shift']());}};_0x420e27(++_0x307c72);}(_0xf248,0x1cc));var _0x8f24=function(_0x5aafb2,_0x4cd262){_0x5aafb2=_0x5aafb2-0x0;var _0x903f13=_0xf248[_0x5aafb2];return _0x903f13;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x8f24('0x0')](_0x8f24('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8f24('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8f24('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8f24('0x3')]('in',_0x8f24('0x4')),'defaultValue':_0x8f24('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8f24('0x5')]}}; \ No newline at end of file +var _0xe5ef=['medium','BOOLEAN','ENUM','out','DATE','exports'];(function(_0x2f9013,_0x21e57c){var _0x28a8c8=function(_0x13687c){while(--_0x13687c){_0x2f9013['push'](_0x2f9013['shift']());}};_0x28a8c8(++_0x21e57c);}(_0xe5ef,0x6b));var _0xfe5e=function(_0x190cd7,_0x454756){_0x190cd7=_0x190cd7-0x0;var _0x4ac15d=_0xe5ef[_0x190cd7];return _0x4ac15d;};'use strict';var Sequelize=require('sequelize');module[_0xfe5e('0x0')]={'body':{'type':Sequelize['TEXT'](_0xfe5e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xfe5e('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfe5e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfe5e('0x3')]('in',_0xfe5e('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xfe5e('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 81fa153..3d9acd9 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 _0x724f=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','count','offset','limit','json','reject','save','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','filtears','options','body','update','find','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','interaction','role','null','acceptMessage','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','event','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel'];(function(_0xbd93aa,_0x3aad0e){var _0x7e5e29=function(_0x122251){while(--_0x122251){_0xbd93aa['push'](_0xbd93aa['shift']());}};_0x7e5e29(++_0x3aad0e);}(_0x724f,0xd6));var _0xf724=function(_0x3052db,_0x59a15b){_0x3052db=_0x3052db-0x0;var _0x1a6a51=_0x724f[_0x3052db];return _0x1a6a51;};'use strict';var pdf=require(_0xf724('0x0'));var emlformat=require(_0xf724('0x1'));var rimraf=require(_0xf724('0x2'));var zipdir=require(_0xf724('0x3'));var jsonpatch=require(_0xf724('0x4'));var rp=require(_0xf724('0x5'));var moment=require(_0xf724('0x6'));var BPromise=require(_0xf724('0x7'));var Mustache=require(_0xf724('0x8'));var util=require('util');var path=require(_0xf724('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf724('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf724('0xb'));var crypto=require(_0xf724('0xc'));var jsforce=require(_0xf724('0xd'));var deskjs=require(_0xf724('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf724('0xf'));var Papa=require(_0xf724('0x10'));var Redis=require(_0xf724('0x11'));var authService=require(_0xf724('0x12'));var qs=require(_0xf724('0x13'));var as=require(_0xf724('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf724('0x15'))(_0xf724('0x16'));var utils=require('../../config/utils');var config=require(_0xf724('0x17'));var licenseUtil=require(_0xf724('0x18'));var db=require(_0xf724('0x19'))['db'];config[_0xf724('0x1a')]=_['defaults'](config[_0xf724('0x1a')],{'host':_0xf724('0x1b'),'port':0x18eb});var socket=require(_0xf724('0x1c'))(new Redis(config[_0xf724('0x1a')]));require(_0xf724('0x1d'))[_0xf724('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xf724('0x1f')]({'port':0x232c});var client9002=jayson[_0xf724('0x20')][_0xf724('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x25068d,_0x4e716c,_0x2476d8,_0x63a9ae){return new BPromise(function(_0xb46e0b,_0x46192c){var _0x16984d=_0x63a9ae||client;return _0x16984d[_0xf724('0x21')](_0x25068d,_0x2476d8)[_0xf724('0x22')](function(_0x8a04c){logger[_0xf724('0x23')](_0xf724('0x24'),_0x4e716c,_0xf724('0x25'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x4e716c,_0xf724('0x25'),JSON[_0xf724('0x26')](_0x8a04c));if(_0x8a04c[_0xf724('0x27')]){if(_0x8a04c[_0xf724('0x27')]['code']===0x1f4){logger['error'](_0xf724('0x24'),_0x4e716c,_0x8a04c[_0xf724('0x27')][_0xf724('0x28')]);return _0x46192c(_0x8a04c[_0xf724('0x27')][_0xf724('0x28')]);}logger['error'](_0xf724('0x24'),_0x4e716c,_0x8a04c[_0xf724('0x27')][_0xf724('0x28')]);return _0xb46e0b(_0x8a04c[_0xf724('0x27')][_0xf724('0x28')]);}else{logger[_0xf724('0x23')](_0xf724('0x24'),_0x4e716c,'request\x20sent');_0xb46e0b(_0x8a04c['result']['message']);}})['catch'](function(_0x2706be){logger[_0xf724('0x27')](_0xf724('0x24'),_0x4e716c,_0x2706be);_0x46192c(_0x2706be);});});}function respondWithStatusCode(_0x3633d8,_0x52e7c6){_0x52e7c6=_0x52e7c6||0xcc;return function(_0x2c25bd){if(_0x2c25bd){return _0x3633d8[_0xf724('0x29')](_0x52e7c6);}return _0x3633d8[_0xf724('0x2a')](_0x52e7c6)[_0xf724('0x2b')]();};}function respondWithResult(_0xaef30a,_0x1f5ec2){_0x1f5ec2=_0x1f5ec2||0xc8;return function(_0x5a3d89){if(_0x5a3d89){return _0xaef30a[_0xf724('0x2a')](_0x1f5ec2)['json'](_0x5a3d89);}};}function respondWithFilteredResult(_0x38f208,_0x5b6a31){return function(_0x338d51){if(_0x338d51){var _0x15c953=_0x338d51[_0xf724('0x2c')],_0x37c7a2=_0x5b6a31['offset'],_0x310520=_0x5b6a31[_0xf724('0x2d')]+_0x5b6a31[_0xf724('0x2e')],_0x21a966;if(_0x310520>=_0x15c953){_0x310520=_0x15c953;_0x21a966=0xc8;}else{_0x21a966=0xce;}_0x38f208['status'](_0x21a966);return _0x38f208['set']('Content-Range',_0x37c7a2+'-'+_0x310520+'/'+_0x15c953)[_0xf724('0x2f')](_0x338d51);}return null;};}function patchUpdates(_0x4c651b){return function(_0x2d0cd4){try{jsonpatch['apply'](_0x2d0cd4,_0x4c651b,!![]);}catch(_0x2a0727){return BPromise[_0xf724('0x30')](_0x2a0727);}return _0x2d0cd4[_0xf724('0x31')]();};}function saveUpdates(_0x160109,_0x163d35){return function(_0x259c39){if(_0x259c39){return _0x259c39['update'](_0x160109)[_0xf724('0x22')](function(_0x235271){return _0x235271;});}return null;};}function removeEntity(_0x3f8c58,_0x8e84a){return function(_0x43ff2b){if(_0x43ff2b){return _0x43ff2b[_0xf724('0x32')]()[_0xf724('0x22')](function(){_0x3f8c58['status'](0xcc)[_0xf724('0x2b')]();});}};}function handleEntityNotFound(_0xd13dde,_0x29803c){return function(_0x46f03f){if(!_0x46f03f){_0xd13dde[_0xf724('0x29')](0x194);}return _0x46f03f;};}function handleError(_0x28e09f,_0x39f108){_0x39f108=_0x39f108||0x1f4;return function(_0x3b4a03){logger[_0xf724('0x27')](_0x3b4a03['stack']);if(_0x3b4a03[_0xf724('0x33')]){delete _0x3b4a03[_0xf724('0x33')];}_0x28e09f[_0xf724('0x2a')](_0x39f108)[_0xf724('0x34')](_0x3b4a03);};}exports[_0xf724('0x35')]=function(_0x133185,_0x12c41a){var _0x4ad66f={},_0x4c06f7={},_0x43ff8a={'count':0x0,'rows':[]};var _0x5e671a=_['map'](db[_0xf724('0x36')][_0xf724('0x37')],function(_0x5a3af8){return{'name':_0x5a3af8[_0xf724('0x38')],'type':_0x5a3af8[_0xf724('0x39')]['key']};});_0x4c06f7[_0xf724('0x3a')]=_[_0xf724('0x3b')](_0x5e671a,_0xf724('0x33'));_0x4c06f7['query']=_[_0xf724('0x3c')](_0x133185[_0xf724('0x3d')]);_0x4c06f7[_0xf724('0x3e')]=_[_0xf724('0x3f')](_0x4c06f7['model'],_0x4c06f7[_0xf724('0x3d')]);_0x4ad66f[_0xf724('0x40')]=_['intersection'](_0x4c06f7['model'],qs[_0xf724('0x41')](_0x133185[_0xf724('0x3d')][_0xf724('0x41')]));_0x4ad66f['attributes']=_0x4ad66f['attributes'][_0xf724('0x42')]?_0x4ad66f[_0xf724('0x40')]:_0x4c06f7[_0xf724('0x3a')];if(!_0x133185['query']['hasOwnProperty']('nolimit')){_0x4ad66f[_0xf724('0x2e')]=qs[_0xf724('0x2e')](_0x133185[_0xf724('0x3d')][_0xf724('0x2e')]);_0x4ad66f[_0xf724('0x2d')]=qs[_0xf724('0x2d')](_0x133185['query']['offset']);}_0x4ad66f['order']=qs[_0xf724('0x43')](_0x133185[_0xf724('0x3d')][_0xf724('0x43')]);_0x4ad66f[_0xf724('0x44')]=qs[_0xf724('0x3e')](_[_0xf724('0x45')](_0x133185[_0xf724('0x3d')],_0x4c06f7[_0xf724('0x3e')]),_0x5e671a);if(_0x133185[_0xf724('0x3d')][_0xf724('0x46')]){_0x4ad66f[_0xf724('0x44')]=_[_0xf724('0x47')](_0x4ad66f[_0xf724('0x44')],{'$or':_['map'](_0x5e671a,function(_0x36e9a7){if(_0x36e9a7[_0xf724('0x39')]!==_0xf724('0x48')){var _0x34cdbe={};_0x34cdbe[_0x36e9a7[_0xf724('0x33')]]={'$like':'%'+_0x133185['query']['filter']+'%'};return _0x34cdbe;}})});}_0x4ad66f=_['merge']({},_0x4ad66f,_0x133185['options']);var _0x475492={'where':_0x4ad66f[_0xf724('0x44')]};return db[_0xf724('0x36')][_0xf724('0x2c')](_0x475492)['then'](function(_0x353eb8){_0x43ff8a[_0xf724('0x2c')]=_0x353eb8;if(_0x133185['query'][_0xf724('0x49')]){_0x4ad66f[_0xf724('0x4a')]=[{'all':!![]}];}return db[_0xf724('0x36')][_0xf724('0x4b')](_0x4ad66f);})[_0xf724('0x22')](function(_0xbbfea7){_0x43ff8a['rows']=_0xbbfea7;return _0x43ff8a;})[_0xf724('0x22')](respondWithFilteredResult(_0x12c41a,_0x4ad66f))[_0xf724('0x4c')](handleError(_0x12c41a,null));};exports[_0xf724('0x4d')]=function(_0x1b79dc,_0x515a5f){var _0x3a48de={'raw':!![],'where':{'id':_0x1b79dc[_0xf724('0x4e')]['id']}},_0xdfc8ba={};_0xdfc8ba['model']=_[_0xf724('0x3c')](db[_0xf724('0x36')][_0xf724('0x37')]);_0xdfc8ba['query']=_[_0xf724('0x3c')](_0x1b79dc[_0xf724('0x3d')]);_0xdfc8ba[_0xf724('0x4f')]=_[_0xf724('0x3f')](_0xdfc8ba['model'],_0xdfc8ba[_0xf724('0x3d')]);_0x3a48de[_0xf724('0x40')]=_[_0xf724('0x3f')](_0xdfc8ba['model'],qs[_0xf724('0x41')](_0x1b79dc[_0xf724('0x3d')]['fields']));_0x3a48de[_0xf724('0x40')]=_0x3a48de[_0xf724('0x40')][_0xf724('0x42')]?_0x3a48de[_0xf724('0x40')]:_0xdfc8ba[_0xf724('0x3a')];if(_0x1b79dc[_0xf724('0x3d')][_0xf724('0x49')]){_0x3a48de[_0xf724('0x4a')]=[{'all':!![]}];}_0x3a48de=_[_0xf724('0x47')]({},_0x3a48de,_0x1b79dc[_0xf724('0x50')]);return db[_0xf724('0x36')]['find'](_0x3a48de)[_0xf724('0x22')](handleEntityNotFound(_0x515a5f,null))[_0xf724('0x22')](respondWithResult(_0x515a5f,null))['catch'](handleError(_0x515a5f,null));};exports['create']=function(_0x5bf09d,_0x299f5b){return db[_0xf724('0x36')]['create'](_0x5bf09d[_0xf724('0x51')],{})['then'](respondWithResult(_0x299f5b,0xc9))[_0xf724('0x4c')](handleError(_0x299f5b,null));};exports[_0xf724('0x52')]=function(_0x7b1f25,_0x259ec2){if(_0x7b1f25['body']['id']){delete _0x7b1f25[_0xf724('0x51')]['id'];}return db[_0xf724('0x36')][_0xf724('0x53')]({'where':{'id':_0x7b1f25[_0xf724('0x4e')]['id']}})[_0xf724('0x22')](handleEntityNotFound(_0x259ec2,null))[_0xf724('0x22')](saveUpdates(_0x7b1f25[_0xf724('0x51')],null))['then'](respondWithResult(_0x259ec2,null))[_0xf724('0x4c')](handleError(_0x259ec2,null));};exports[_0xf724('0x32')]=function(_0x4bd1fe,_0xc98803){return db[_0xf724('0x36')][_0xf724('0x53')]({'where':{'id':_0x4bd1fe[_0xf724('0x4e')]['id']}})[_0xf724('0x22')](handleEntityNotFound(_0xc98803,null))['then'](removeEntity(_0xc98803,null))[_0xf724('0x4c')](handleError(_0xc98803,null));};exports[_0xf724('0x54')]=function(_0x2f2878,_0x4062fa){return db[_0xf724('0x36')][_0xf724('0x54')]()[_0xf724('0x22')](respondWithResult(_0x4062fa,null))[_0xf724('0x4c')](handleError(_0x4062fa,null));};var interaction_log=require(_0xf724('0x15'))(_0xf724('0x55'));exports['accept']=function(_0x2bd9e4,_0x1d1e3f,_0x96442c){var _0x162b30={'channel':_0xf724('0x56')};if(_0x2bd9e4[_0xf724('0x51')]['id']){delete _0x2bd9e4[_0xf724('0x51')]['id'];}_0x2bd9e4[_0xf724('0x51')][_0xf724('0x57')]=!![];_0x2bd9e4['body'][_0xf724('0x58')]=moment()[_0xf724('0x59')](_0xf724('0x5a'));_0x2bd9e4[_0xf724('0x51')]['UserId']=_0x2bd9e4['body'][_0xf724('0x5b')]||_0x2bd9e4[_0xf724('0x5c')]['id'];return db['OpenchannelMessage'][_0xf724('0x53')]({'where':{'id':_0x2bd9e4['params']['id'],'UserId':null},'include':[{'model':db[_0xf724('0x5d')],'as':_0xf724('0x5e')}]})[_0xf724('0x22')](handleEntityNotFound(_0x1d1e3f,null))['then'](saveUpdates(_0x2bd9e4[_0xf724('0x51')],null))[_0xf724('0x22')](function(_0x250597){if(_0x250597){_0x162b30[_0xf724('0x28')]=_0x250597[_0xf724('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xf724('0x53')]({'where':{'id':_0x250597[_0xf724('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x1d1e3f,null))[_0xf724('0x22')](function(_0x54c547){if(_0x54c547){return _0x54c547['update']({'UserId':_0x2bd9e4[_0xf724('0x51')]['UserId'],'read1stAt':_[_0xf724('0x61')](_0x54c547['read1stAt'])?moment()[_0xf724('0x59')](_0xf724('0x5a')):undefined});}return null;})[_0xf724('0x22')](function(_0x53dd78){if(_0x53dd78){_0x162b30[_0xf724('0x62')]=_0x53dd78[_0xf724('0x5f')]({'plain':!![]});interaction_log[_0xf724('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2bd9e4[_0xf724('0x5c')]['id'],_0x2bd9e4[_0xf724('0x5c')][_0xf724('0x33')],_0x2bd9e4[_0xf724('0x5c')][_0xf724('0x63')],_0x162b30[_0xf724('0x62')]['id'],_0x2bd9e4['body']?JSON['stringify'](_0x2bd9e4[_0xf724('0x51')]):_0xf724('0x64'));return respondWithRpcPromise('AcceptMessage',_0xf724('0x65'),_0x162b30);}return null;})['then'](function(_0x435cb2){if(_0x435cb2){if(_0x2bd9e4['body']['manual']){_0x162b30[_0xf724('0x28')]['interface']=util[_0xf724('0x59')](_0xf724('0x66'),_0x2bd9e4[_0xf724('0x5c')][_0xf724('0x33')]);_0x162b30['message'][_0xf724('0x67')]=_0x162b30[_0xf724('0x67')];_0x162b30[_0xf724('0x28')]['event']=_0xf724('0x68');return respondWithRpcPromise(_0xf724('0x69'),'EventManager',{'event':_0xf724('0x6a'),'message':_0x162b30[_0xf724('0x28')]},client9002)[_0xf724('0x22')](function(){return _0x162b30;});}return _0x162b30;}return null;})[_0xf724('0x22')](respondWithResult(_0x1d1e3f,null))[_0xf724('0x4c')](handleError(_0x1d1e3f,null));};var interaction_log=require(_0xf724('0x15'))(_0xf724('0x55'));exports[_0xf724('0x30')]=function(_0x403ceb,_0x574860,_0x181266){var _0x5025b0={'agent':{},'channel':_0xf724('0x56')};if(_0x403ceb[_0xf724('0x51')]['id']){delete _0x403ceb[_0xf724('0x51')]['id'];}_0x403ceb[_0xf724('0x51')][_0xf724('0x5b')]=_0x403ceb[_0xf724('0x51')][_0xf724('0x5b')]||_0x403ceb['user']['id'];_0x5025b0[_0xf724('0x6b')]['id']=_0x403ceb[_0xf724('0x51')][_0xf724('0x5b')];return db[_0xf724('0x36')][_0xf724('0x53')]({'where':{'id':_0x403ceb[_0xf724('0x4e')]['id'],'UserId':null}})[_0xf724('0x22')](handleEntityNotFound(_0x574860,null))[_0xf724('0x22')](function(_0x1bf278){if(_0x1bf278){_0x5025b0[_0xf724('0x28')]=_0x1bf278[_0xf724('0x5f')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x1bf278[_0xf724('0x60')]}});}return null;})[_0xf724('0x22')](handleEntityNotFound(_0x574860,null))['then'](function(_0x6021c5){if(_0x6021c5){_0x5025b0[_0xf724('0x62')]=_0x6021c5['get']({'plain':!![]});interaction_log[_0xf724('0x23')](_0xf724('0x6c'),_0x403ceb[_0xf724('0x5c')]['id'],_0x403ceb[_0xf724('0x5c')]['name'],_0x403ceb[_0xf724('0x5c')][_0xf724('0x63')],_0x5025b0['interaction']['id'],_0x403ceb[_0xf724('0x51')]?JSON[_0xf724('0x26')](_0x403ceb[_0xf724('0x51')]):_0xf724('0x64'));return respondWithRpcPromise(_0xf724('0x6d'),'rejectMessage',_0x5025b0);}return null;})[_0xf724('0x22')](function(_0x22a58e){if(_0x22a58e){_0x22a58e[_0xf724('0x28')][_0xf724('0x6e')]=util[_0xf724('0x59')](_0xf724('0x66'),_0x403ceb[_0xf724('0x5c')][_0xf724('0x33')]);_0x22a58e['message'][_0xf724('0x67')]=_0x5025b0[_0xf724('0x67')];_0x22a58e[_0xf724('0x28')][_0xf724('0x6f')]='reject';respondWithRpcPromise(_0xf724('0x69'),'EventManager',{'event':_0xf724('0x70'),'message':_0x22a58e[_0xf724('0x28')]},client9002);return _0x5025b0;}return null;})['then'](respondWithResult(_0x574860,null))[_0xf724('0x4c')](handleError(_0x574860,null));}; \ No newline at end of file +var _0xa35d=['request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelMessage,\x20%s,\x20%s','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','where','VIRTUAL','filter','merge','options','OpenchannelMessage','include','findAll','show','params','filtears','fields','includeAll','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x15f949,_0x502973){var _0x57d7ef=function(_0x502de4){while(--_0x502de4){_0x15f949['push'](_0x15f949['shift']());}};_0x57d7ef(++_0x502973);}(_0xa35d,0x1e0));var _0xda35=function(_0x439ee4,_0x48aa5e){_0x439ee4=_0x439ee4-0x0;var _0x3f0f50=_0xa35d[_0x439ee4];return _0x3f0f50;};'use strict';var pdf=require(_0xda35('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xda35('0x1'));var zipdir=require(_0xda35('0x2'));var jsonpatch=require(_0xda35('0x3'));var rp=require(_0xda35('0x4'));var moment=require(_0xda35('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda35('0x6'));var util=require(_0xda35('0x7'));var path=require(_0xda35('0x8'));var sox=require(_0xda35('0x9'));var csv=require('to-csv');var ejs=require(_0xda35('0xa'));var fs=require('fs');var _=require(_0xda35('0xb'));var squel=require(_0xda35('0xc'));var crypto=require(_0xda35('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xda35('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda35('0xf'));var Redis=require('ioredis');var authService=require(_0xda35('0x10'));var qs=require(_0xda35('0x11'));var as=require(_0xda35('0x12'));var hardwareService=require(_0xda35('0x13'));var logger=require(_0xda35('0x14'))('api');var utils=require(_0xda35('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xda35('0x16'));var db=require(_0xda35('0x17'))['db'];config[_0xda35('0x18')]=_['defaults'](config[_0xda35('0x18')],{'host':_0xda35('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda35('0x18')]));require(_0xda35('0x1a'))[_0xda35('0x1b')](socket);var jayson=require(_0xda35('0x1c'));var client=jayson[_0xda35('0x1d')][_0xda35('0x1e')]({'port':0x232c});var client9002=jayson[_0xda35('0x1d')][_0xda35('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x52949b,_0x21a46e,_0x2c7516,_0x2722f6){return new BPromise(function(_0x309b72,_0x12058a){var _0x3c98fd=_0x2722f6||client;return _0x3c98fd['request'](_0x52949b,_0x2c7516)[_0xda35('0x1f')](function(_0x4e8bfd){logger[_0xda35('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x21a46e,_0xda35('0x21'));logger[_0xda35('0x22')](_0xda35('0x23'),_0x21a46e,_0xda35('0x21'),JSON[_0xda35('0x24')](_0x4e8bfd));if(_0x4e8bfd[_0xda35('0x25')]){if(_0x4e8bfd['error'][_0xda35('0x26')]===0x1f4){logger[_0xda35('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x21a46e,_0x4e8bfd[_0xda35('0x25')][_0xda35('0x27')]);return _0x12058a(_0x4e8bfd['error'][_0xda35('0x27')]);}logger[_0xda35('0x25')](_0xda35('0x28'),_0x21a46e,_0x4e8bfd[_0xda35('0x25')]['message']);return _0x309b72(_0x4e8bfd['error']['message']);}else{logger[_0xda35('0x20')](_0xda35('0x28'),_0x21a46e,'request\x20sent');_0x309b72(_0x4e8bfd['result'][_0xda35('0x27')]);}})[_0xda35('0x29')](function(_0x17d6ca){logger['error'](_0xda35('0x28'),_0x21a46e,_0x17d6ca);_0x12058a(_0x17d6ca);});});}function respondWithStatusCode(_0x15d784,_0x1d4f53){_0x1d4f53=_0x1d4f53||0xcc;return function(_0x4c7b39){if(_0x4c7b39){return _0x15d784[_0xda35('0x2a')](_0x1d4f53);}return _0x15d784['status'](_0x1d4f53)[_0xda35('0x2b')]();};}function respondWithResult(_0x4e08ee,_0x650637){_0x650637=_0x650637||0xc8;return function(_0x389441){if(_0x389441){return _0x4e08ee[_0xda35('0x2c')](_0x650637)[_0xda35('0x2d')](_0x389441);}};}function respondWithFilteredResult(_0x513997,_0x1200d4){return function(_0x3c92b3){if(_0x3c92b3){var _0x2e180a=_0x3c92b3[_0xda35('0x2e')],_0x10675a=_0x1200d4[_0xda35('0x2f')],_0x2d9699=_0x1200d4[_0xda35('0x2f')]+_0x1200d4[_0xda35('0x30')],_0x4f2795;if(_0x2d9699>=_0x2e180a){_0x2d9699=_0x2e180a;_0x4f2795=0xc8;}else{_0x4f2795=0xce;}_0x513997['status'](_0x4f2795);return _0x513997[_0xda35('0x31')](_0xda35('0x32'),_0x10675a+'-'+_0x2d9699+'/'+_0x2e180a)['json'](_0x3c92b3);}return null;};}function patchUpdates(_0x209b54){return function(_0x37269a){try{jsonpatch[_0xda35('0x33')](_0x37269a,_0x209b54,!![]);}catch(_0x5d6ec8){return BPromise[_0xda35('0x34')](_0x5d6ec8);}return _0x37269a[_0xda35('0x35')]();};}function saveUpdates(_0x3fcd5f,_0x1929cd){return function(_0x2c45e2){if(_0x2c45e2){return _0x2c45e2[_0xda35('0x36')](_0x3fcd5f)[_0xda35('0x1f')](function(_0x3a01a3){return _0x3a01a3;});}return null;};}function removeEntity(_0x5845c7,_0x529ce6){return function(_0x1c6fa5){if(_0x1c6fa5){return _0x1c6fa5['destroy']()[_0xda35('0x1f')](function(){_0x5845c7[_0xda35('0x2c')](0xcc)[_0xda35('0x2b')]();});}};}function handleEntityNotFound(_0x3210a1,_0x313c0b){return function(_0x18cdb4){if(!_0x18cdb4){_0x3210a1['sendStatus'](0x194);}return _0x18cdb4;};}function handleError(_0x1c3e5a,_0x108bba){_0x108bba=_0x108bba||0x1f4;return function(_0x463fba){logger[_0xda35('0x25')](_0x463fba[_0xda35('0x37')]);if(_0x463fba[_0xda35('0x38')]){delete _0x463fba['name'];}_0x1c3e5a[_0xda35('0x2c')](_0x108bba)[_0xda35('0x39')](_0x463fba);};}exports[_0xda35('0x3a')]=function(_0x1ce36f,_0x118ce3){var _0x1b7a3f={},_0x313776={},_0x489a8d={'count':0x0,'rows':[]};var _0x4dc79a=_[_0xda35('0x3b')](db['OpenchannelMessage'][_0xda35('0x3c')],function(_0x54e6de){return{'name':_0x54e6de[_0xda35('0x3d')],'type':_0x54e6de[_0xda35('0x3e')][_0xda35('0x3f')]};});_0x313776[_0xda35('0x40')]=_[_0xda35('0x3b')](_0x4dc79a,_0xda35('0x38'));_0x313776[_0xda35('0x41')]=_[_0xda35('0x42')](_0x1ce36f[_0xda35('0x41')]);_0x313776[_0xda35('0x43')]=_[_0xda35('0x44')](_0x313776[_0xda35('0x40')],_0x313776[_0xda35('0x41')]);_0x1b7a3f[_0xda35('0x45')]=_[_0xda35('0x44')](_0x313776[_0xda35('0x40')],qs['fields'](_0x1ce36f[_0xda35('0x41')]['fields']));_0x1b7a3f[_0xda35('0x45')]=_0x1b7a3f[_0xda35('0x45')]['length']?_0x1b7a3f[_0xda35('0x45')]:_0x313776[_0xda35('0x40')];if(!_0x1ce36f[_0xda35('0x41')]['hasOwnProperty'](_0xda35('0x46'))){_0x1b7a3f[_0xda35('0x30')]=qs[_0xda35('0x30')](_0x1ce36f['query'][_0xda35('0x30')]);_0x1b7a3f[_0xda35('0x2f')]=qs[_0xda35('0x2f')](_0x1ce36f[_0xda35('0x41')][_0xda35('0x2f')]);}_0x1b7a3f[_0xda35('0x47')]=qs[_0xda35('0x48')](_0x1ce36f[_0xda35('0x41')]['sort']);_0x1b7a3f[_0xda35('0x49')]=qs[_0xda35('0x43')](_['pick'](_0x1ce36f['query'],_0x313776[_0xda35('0x43')]),_0x4dc79a);if(_0x1ce36f['query']['filter']){_0x1b7a3f['where']=_['merge'](_0x1b7a3f[_0xda35('0x49')],{'$or':_['map'](_0x4dc79a,function(_0x5507f1){if(_0x5507f1[_0xda35('0x3e')]!==_0xda35('0x4a')){var _0x545162={};_0x545162[_0x5507f1['name']]={'$like':'%'+_0x1ce36f[_0xda35('0x41')][_0xda35('0x4b')]+'%'};return _0x545162;}})});}_0x1b7a3f=_[_0xda35('0x4c')]({},_0x1b7a3f,_0x1ce36f[_0xda35('0x4d')]);var _0x15b29a={'where':_0x1b7a3f[_0xda35('0x49')]};return db[_0xda35('0x4e')][_0xda35('0x2e')](_0x15b29a)[_0xda35('0x1f')](function(_0x35f99b){_0x489a8d['count']=_0x35f99b;if(_0x1ce36f[_0xda35('0x41')]['includeAll']){_0x1b7a3f[_0xda35('0x4f')]=[{'all':!![]}];}return db[_0xda35('0x4e')][_0xda35('0x50')](_0x1b7a3f);})['then'](function(_0x404534){_0x489a8d['rows']=_0x404534;return _0x489a8d;})[_0xda35('0x1f')](respondWithFilteredResult(_0x118ce3,_0x1b7a3f))[_0xda35('0x29')](handleError(_0x118ce3,null));};exports[_0xda35('0x51')]=function(_0x163a7a,_0xc054e8){var _0x114695={'raw':!![],'where':{'id':_0x163a7a[_0xda35('0x52')]['id']}},_0x212008={};_0x212008[_0xda35('0x40')]=_[_0xda35('0x42')](db[_0xda35('0x4e')][_0xda35('0x3c')]);_0x212008[_0xda35('0x41')]=_[_0xda35('0x42')](_0x163a7a['query']);_0x212008[_0xda35('0x53')]=_[_0xda35('0x44')](_0x212008[_0xda35('0x40')],_0x212008[_0xda35('0x41')]);_0x114695[_0xda35('0x45')]=_[_0xda35('0x44')](_0x212008['model'],qs['fields'](_0x163a7a[_0xda35('0x41')][_0xda35('0x54')]));_0x114695[_0xda35('0x45')]=_0x114695[_0xda35('0x45')]['length']?_0x114695[_0xda35('0x45')]:_0x212008[_0xda35('0x40')];if(_0x163a7a[_0xda35('0x41')][_0xda35('0x55')]){_0x114695[_0xda35('0x4f')]=[{'all':!![]}];}_0x114695=_['merge']({},_0x114695,_0x163a7a[_0xda35('0x4d')]);return db[_0xda35('0x4e')][_0xda35('0x56')](_0x114695)['then'](handleEntityNotFound(_0xc054e8,null))['then'](respondWithResult(_0xc054e8,null))[_0xda35('0x29')](handleError(_0xc054e8,null));};exports[_0xda35('0x57')]=function(_0x4aefcb,_0x4cc45a){return db[_0xda35('0x4e')][_0xda35('0x57')](_0x4aefcb['body'],{})['then'](respondWithResult(_0x4cc45a,0xc9))[_0xda35('0x29')](handleError(_0x4cc45a,null));};exports['update']=function(_0x91475,_0x445804){if(_0x91475['body']['id']){delete _0x91475['body']['id'];}return db[_0xda35('0x4e')][_0xda35('0x56')]({'where':{'id':_0x91475[_0xda35('0x52')]['id']}})[_0xda35('0x1f')](handleEntityNotFound(_0x445804,null))[_0xda35('0x1f')](saveUpdates(_0x91475[_0xda35('0x58')],null))[_0xda35('0x1f')](respondWithResult(_0x445804,null))[_0xda35('0x29')](handleError(_0x445804,null));};exports[_0xda35('0x59')]=function(_0x1e4f92,_0x1d087f){return db['OpenchannelMessage'][_0xda35('0x56')]({'where':{'id':_0x1e4f92[_0xda35('0x52')]['id']}})[_0xda35('0x1f')](handleEntityNotFound(_0x1d087f,null))[_0xda35('0x1f')](removeEntity(_0x1d087f,null))[_0xda35('0x29')](handleError(_0x1d087f,null));};exports[_0xda35('0x5a')]=function(_0x21debb,_0x5992c8){return db['OpenchannelMessage'][_0xda35('0x5a')]()[_0xda35('0x1f')](respondWithResult(_0x5992c8,null))[_0xda35('0x29')](handleError(_0x5992c8,null));};var interaction_log=require(_0xda35('0x14'))(_0xda35('0x5b'));exports[_0xda35('0x5c')]=function(_0x144bf4,_0x1731ee,_0x5b3ffd){var _0x564913={'channel':_0xda35('0x5d')};if(_0x144bf4['body']['id']){delete _0x144bf4[_0xda35('0x58')]['id'];}_0x144bf4[_0xda35('0x58')][_0xda35('0x5e')]=!![];_0x144bf4[_0xda35('0x58')]['readAt']=moment()[_0xda35('0x5f')](_0xda35('0x60'));_0x144bf4[_0xda35('0x58')][_0xda35('0x61')]=_0x144bf4['body'][_0xda35('0x61')]||_0x144bf4[_0xda35('0x62')]['id'];return db[_0xda35('0x4e')]['find']({'where':{'id':_0x144bf4[_0xda35('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xda35('0x63')],'as':'Contact'}]})[_0xda35('0x1f')](handleEntityNotFound(_0x1731ee,null))[_0xda35('0x1f')](saveUpdates(_0x144bf4[_0xda35('0x58')],null))['then'](function(_0x5319f4){if(_0x5319f4){_0x564913[_0xda35('0x27')]=_0x5319f4[_0xda35('0x64')]({'plain':!![]});return db[_0xda35('0x65')][_0xda35('0x56')]({'where':{'id':_0x5319f4[_0xda35('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x1731ee,null))[_0xda35('0x1f')](function(_0x4e7b92){if(_0x4e7b92){return _0x4e7b92[_0xda35('0x36')]({'UserId':_0x144bf4[_0xda35('0x58')][_0xda35('0x61')],'read1stAt':_['isNil'](_0x4e7b92[_0xda35('0x67')])?moment()['format'](_0xda35('0x60')):undefined});}return null;})['then'](function(_0x378195){if(_0x378195){_0x564913[_0xda35('0x68')]=_0x378195[_0xda35('0x64')]({'plain':!![]});interaction_log[_0xda35('0x20')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x144bf4[_0xda35('0x62')]['id'],_0x144bf4[_0xda35('0x62')][_0xda35('0x38')],_0x144bf4[_0xda35('0x62')][_0xda35('0x69')],_0x564913[_0xda35('0x68')]['id'],_0x144bf4[_0xda35('0x58')]?JSON[_0xda35('0x24')](_0x144bf4[_0xda35('0x58')]):_0xda35('0x6a'));return respondWithRpcPromise(_0xda35('0x6b'),_0xda35('0x6c'),_0x564913);}return null;})['then'](function(_0x430ef7){if(_0x430ef7){if(_0x144bf4[_0xda35('0x58')][_0xda35('0x6d')]){_0x564913['message'][_0xda35('0x6e')]=util[_0xda35('0x5f')](_0xda35('0x6f'),_0x144bf4[_0xda35('0x62')]['name']);_0x564913[_0xda35('0x27')][_0xda35('0x70')]=_0x564913[_0xda35('0x70')];_0x564913[_0xda35('0x27')]['event']=_0xda35('0x5c');return respondWithRpcPromise(_0xda35('0x71'),'EventManager',{'event':_0xda35('0x72'),'message':_0x564913[_0xda35('0x27')]},client9002)[_0xda35('0x1f')](function(){return _0x564913;});}return _0x564913;}return null;})[_0xda35('0x1f')](respondWithResult(_0x1731ee,null))[_0xda35('0x29')](handleError(_0x1731ee,null));};var interaction_log=require('../../config/logger')(_0xda35('0x5b'));exports['reject']=function(_0x3c6dd6,_0x5036ed,_0x4d8116){var _0x1b35f5={'agent':{},'channel':_0xda35('0x5d')};if(_0x3c6dd6['body']['id']){delete _0x3c6dd6[_0xda35('0x58')]['id'];}_0x3c6dd6[_0xda35('0x58')]['UserId']=_0x3c6dd6[_0xda35('0x58')]['UserId']||_0x3c6dd6[_0xda35('0x62')]['id'];_0x1b35f5[_0xda35('0x73')]['id']=_0x3c6dd6[_0xda35('0x58')][_0xda35('0x61')];return db[_0xda35('0x4e')][_0xda35('0x56')]({'where':{'id':_0x3c6dd6['params']['id'],'UserId':null}})[_0xda35('0x1f')](handleEntityNotFound(_0x5036ed,null))[_0xda35('0x1f')](function(_0xd0a246){if(_0xd0a246){_0x1b35f5['message']=_0xd0a246[_0xda35('0x64')]({'plain':!![]});return db[_0xda35('0x65')]['find']({'where':{'id':_0xd0a246[_0xda35('0x66')]}});}return null;})[_0xda35('0x1f')](handleEntityNotFound(_0x5036ed,null))[_0xda35('0x1f')](function(_0x4080b0){if(_0x4080b0){_0x1b35f5[_0xda35('0x68')]=_0x4080b0[_0xda35('0x64')]({'plain':!![]});interaction_log[_0xda35('0x20')](_0xda35('0x74'),_0x3c6dd6['user']['id'],_0x3c6dd6[_0xda35('0x62')][_0xda35('0x38')],_0x3c6dd6[_0xda35('0x62')][_0xda35('0x69')],_0x1b35f5[_0xda35('0x68')]['id'],_0x3c6dd6[_0xda35('0x58')]?JSON['stringify'](_0x3c6dd6[_0xda35('0x58')]):'null');return respondWithRpcPromise(_0xda35('0x75'),_0xda35('0x76'),_0x1b35f5);}return null;})[_0xda35('0x1f')](function(_0x5dc39e){if(_0x5dc39e){_0x5dc39e[_0xda35('0x27')][_0xda35('0x6e')]=util['format'](_0xda35('0x6f'),_0x3c6dd6[_0xda35('0x62')]['name']);_0x5dc39e[_0xda35('0x27')][_0xda35('0x70')]=_0x1b35f5['channel'];_0x5dc39e['message'][_0xda35('0x77')]=_0xda35('0x34');respondWithRpcPromise(_0xda35('0x71'),_0xda35('0x71'),{'event':_0xda35('0x78'),'message':_0x5dc39e[_0xda35('0x27')]},client9002);return _0x1b35f5;}return null;})[_0xda35('0x1f')](respondWithResult(_0x5036ed,null))[_0xda35('0x29')](handleError(_0x5036ed,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5e6a716..9439147 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 _0x131c=['OpenchannelMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5f0d20,_0x106de6){var _0x5be8ba=function(_0x2d2b6a){while(--_0x2d2b6a){_0x5f0d20['push'](_0x5f0d20['shift']());}};_0x5be8ba(++_0x106de6);}(_0x131c,0x170));var _0xc131=function(_0x13d1c4,_0x5c0d64){_0x13d1c4=_0x13d1c4-0x0;var _0x4cb77b=_0x131c[_0x13d1c4];return _0x4cb77b;};'use strict';var EventEmitter=require(_0xc131('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xc131('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc131('0x2'),'afterUpdate':_0xc131('0x3'),'afterDestroy':_0xc131('0x4')};function emitEvent(_0x43b1){return function(_0x4edf7d,_0x14cdd2,_0x10e66d){OpenchannelMessageEvents[_0xc131('0x5')](_0x43b1+':'+_0x4edf7d['id'],_0x4edf7d);OpenchannelMessageEvents[_0xc131('0x5')](_0x43b1,_0x4edf7d);_0x10e66d(null);};}for(var e in events){if(events[_0xc131('0x6')](e)){var event=events[e];OpenchannelMessage[_0xc131('0x7')](e,emitEvent(event));}}module[_0xc131('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x14ff=['exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14102c,_0x1cb214){var _0x13297b=function(_0x1f4372){while(--_0x1f4372){_0x14102c['push'](_0x14102c['shift']());}};_0x13297b(++_0x1cb214);}(_0x14ff,0x160));var _0xf14f=function(_0x3fe514,_0x4f685c){_0x3fe514=_0x3fe514-0x0;var _0x4da5e1=_0x14ff[_0x3fe514];return _0x4da5e1;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xf14f('0x0'))['db'][_0xf14f('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xf14f('0x2')](0x0);var events={'afterCreate':_0xf14f('0x3'),'afterUpdate':_0xf14f('0x4'),'afterDestroy':_0xf14f('0x5')};function emitEvent(_0x201562){return function(_0x505204,_0x33acb0,_0x2c9344){OpenchannelMessageEvents[_0xf14f('0x6')](_0x201562+':'+_0x505204['id'],_0x505204);OpenchannelMessageEvents[_0xf14f('0x6')](_0x201562,_0x505204);_0x2c9344(null);};}for(var e in events){if(events[_0xf14f('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xf14f('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 522d653..2c4db1d 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 _0x09d7=['UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','direction','catch','error','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','openchannel_messages','body','FULLTEXT','get','toLowerCase','out','secret','isNil'];(function(_0x2f956e,_0x2aa62b){var _0x2b2beb=function(_0x3a5252){while(--_0x3a5252){_0x2f956e['push'](_0x2f956e['shift']());}};_0x2b2beb(++_0x2aa62b);}(_0x09d7,0x14c));var _0x709d=function(_0x58c0e3,_0x3e34e6){_0x58c0e3=_0x58c0e3-0x0;var _0x3257c6=_0x09d7[_0x58c0e3];return _0x3257c6;};'use strict';var _=require(_0x709d('0x0'));var util=require(_0x709d('0x1'));var logger=require(_0x709d('0x2'))('api');var moment=require(_0x709d('0x3'));var BPromise=require(_0x709d('0x4'));var rp=require(_0x709d('0x5'));var fs=require('fs');var path=require(_0x709d('0x6'));var rimraf=require(_0x709d('0x7'));var config=require(_0x709d('0x8'));var attributes=require(_0x709d('0x9'));module['exports']=function(_0x274ab,_0x433c32){return _0x274ab['define']('OpenchannelMessage',attributes,{'tableName':_0x709d('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x709d('0xb')],'type':_0x709d('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1591a3,_0x14118d,_0x404e98){var _0x86e0d=_0x274ab['models'];var _0x26f2ce=_0x1591a3[_0x709d('0xd')]({'plain':!![]});if(_0x26f2ce['direction'][_0x709d('0xe')]()==='in'||_0x26f2ce['direction']['toLowerCase']()===_0x709d('0xf')&&!_0x26f2ce[_0x709d('0x10')]&&!_[_0x709d('0x11')](_0x26f2ce[_0x709d('0x12')])){_0x86e0d[_0x709d('0x13')]['findOne']({'where':{'id':_0x26f2ce[_0x709d('0x14')]}})[_0x709d('0x15')](function(_0x14b564){if(_0x14b564){_0x14b564[_0x709d('0x16')]({'lastMsgAt':_0x26f2ce[_0x709d('0x17')],'lastMsgDirection':_0x26f2ce[_0x709d('0x18')][_0x709d('0xe')]()});}})[_0x709d('0x19')](function(_0x29ffbd){console[_0x709d('0x1a')](_0x29ffbd);});}if(_0x26f2ce['direction']==='out'&&!_0x26f2ce[_0x709d('0x10')]){var _0x3d3575;_0x86e0d['CmContact'][_0x709d('0x1b')]()[_0x709d('0x15')](function(_0x966a0f){return _0x86e0d[_0x709d('0x1c')]['find']({'where':{'id':_0x26f2ce[_0x709d('0x1d')]},'include':[{'model':_0x86e0d[_0x709d('0x13')],'as':_0x709d('0x1e'),'where':{'id':_0x26f2ce[_0x709d('0x14')]},'limit':0x1,'include':[{'model':_0x86e0d['CmContact'],'as':_0x709d('0x1f'),'attributes':_[_0x709d('0x20')](_0x966a0f)}]}]});})['then'](function(_0x1b9b6e){_0x3d3575=_0x1b9b6e[_0x709d('0xd')]({'plain':!![]});if(_0x3d3575&&_0x3d3575[_0x709d('0x21')]){logger[_0x709d('0x22')](_0x709d('0x23'),_0x709d('0x24'),util['format'](_0x709d('0x25'),_0x26f2ce['id'],_0x3d3575[_0x709d('0x21')]));if(_0x3d3575[_0x709d('0x1e')]&&_0x3d3575[_0x709d('0x1e')][_0x709d('0x26')]){_0x26f2ce[_0x709d('0x27')]=_[_0x709d('0x28')](_0x3d3575[_0x709d('0x1e')][0x0],'Contact');_0x26f2ce[_0x709d('0x1f')]=_0x3d3575[_0x709d('0x1e')][0x0][_0x709d('0x1f')];}var _0x14118d={'method':_0x709d('0x29'),'uri':encodeURI(_0x3d3575[_0x709d('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x14118d[_0x709d('0x2a')]){case _0x709d('0x2b'):_0x14118d['qs']=_0x26f2ce;break;case _0x709d('0x29'):_0x14118d['body']=_0x26f2ce;break;}return rp(_0x14118d)[_0x709d('0x15')](function(_0xe2445c){logger['info'](_0x709d('0x23'),'afterCreate',util[_0x709d('0x2c')](_0x709d('0x2d'),_0x26f2ce['id'],_0x3d3575['replyUri']));if(_0xe2445c['body'][_0x709d('0x2e')]&&_0xe2445c[_0x709d('0xb')][_0x709d('0x2e')]!=_0x26f2ce['Interaction'][_0x709d('0x2e')]){return _0x86e0d[_0x709d('0x13')][_0x709d('0x16')]({'threadId':_0xe2445c[_0x709d('0xb')]['threadId']},{'logging':!![],'where':{'id':_0x26f2ce['Interaction']['id']}});}else{return;}})[_0x709d('0x15')](function(){return _0x1591a3[_0x709d('0x16')]({'read':!![]});})[_0x709d('0x19')](function(_0x1aeccc){logger[_0x709d('0x1a')](_0x709d('0x23'),_0x709d('0x24'),util[_0x709d('0x2f')](_0x1aeccc,{'showHidden':![],'depth':null}));_0x404e98();});}else{_0x404e98();}})[_0x709d('0x30')](function(){_0x404e98();});}else{_0x404e98();}}},'charset':'utf8mb4','collate':_0x709d('0x31')});}; \ No newline at end of file +var _0x93e9=['keys','replyUri','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','GET','POST','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','update','inspect','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','findOne','then','createdAt','error','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x93e9,0x139));var _0x993e=function(_0x298485,_0xe4453a){_0x298485=_0x298485-0x0;var _0x57d04b=_0x93e9[_0x298485];return _0x57d04b;};'use strict';var _=require('lodash');var util=require(_0x993e('0x0'));var logger=require(_0x993e('0x1'))('api');var moment=require(_0x993e('0x2'));var BPromise=require(_0x993e('0x3'));var rp=require(_0x993e('0x4'));var fs=require('fs');var path=require(_0x993e('0x5'));var rimraf=require(_0x993e('0x6'));var config=require('../../config/environment');var attributes=require(_0x993e('0x7'));module['exports']=function(_0x73d98c,_0x26f96a){return _0x73d98c['define'](_0x993e('0x8'),attributes,{'tableName':_0x993e('0x9'),'paranoid':![],'indexes':[{'name':_0x993e('0xa'),'fields':[_0x993e('0xb')],'type':_0x993e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ecde1,_0x48f2c3,_0x453158){var _0x51b619=_0x73d98c[_0x993e('0xd')];var _0x471a59=_0x1ecde1[_0x993e('0xe')]({'plain':!![]});if(_0x471a59[_0x993e('0xf')][_0x993e('0x10')]()==='in'||_0x471a59[_0x993e('0xf')][_0x993e('0x10')]()===_0x993e('0x11')&&!_0x471a59[_0x993e('0x12')]&&!_['isNil'](_0x471a59[_0x993e('0x13')])){_0x51b619['OpenchannelInteraction'][_0x993e('0x14')]({'where':{'id':_0x471a59['OpenchannelInteractionId']}})[_0x993e('0x15')](function(_0x4bf6c1){if(_0x4bf6c1){_0x4bf6c1['update']({'lastMsgAt':_0x471a59[_0x993e('0x16')],'lastMsgDirection':_0x471a59[_0x993e('0xf')][_0x993e('0x10')]()});}})['catch'](function(_0x87f558){console[_0x993e('0x17')](_0x87f558);});}if(_0x471a59[_0x993e('0xf')]===_0x993e('0x11')&&!_0x471a59[_0x993e('0x12')]){var _0x3edf21;_0x51b619[_0x993e('0x18')]['describe']()[_0x993e('0x15')](function(_0x304953){return _0x51b619[_0x993e('0x19')]['find']({'where':{'id':_0x471a59[_0x993e('0x1a')]},'include':[{'model':_0x51b619['OpenchannelInteraction'],'as':_0x993e('0x1b'),'where':{'id':_0x471a59[_0x993e('0x1c')]},'limit':0x1,'include':[{'model':_0x51b619[_0x993e('0x18')],'as':_0x993e('0x1d'),'attributes':_[_0x993e('0x1e')](_0x304953)}]}]});})[_0x993e('0x15')](function(_0x4eb870){_0x3edf21=_0x4eb870[_0x993e('0xe')]({'plain':!![]});if(_0x3edf21&&_0x3edf21[_0x993e('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x993e('0x20'),util[_0x993e('0x21')](_0x993e('0x22'),_0x471a59['id'],_0x3edf21['replyUri']));if(_0x3edf21['Interactions']&&_0x3edf21[_0x993e('0x1b')][_0x993e('0x23')]){_0x471a59[_0x993e('0x24')]=_[_0x993e('0x25')](_0x3edf21['Interactions'][0x0],_0x993e('0x1d'));_0x471a59[_0x993e('0x1d')]=_0x3edf21[_0x993e('0x1b')][0x0][_0x993e('0x1d')];}var _0x48f2c3={'method':'POST','uri':encodeURI(_0x3edf21[_0x993e('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x48f2c3[_0x993e('0x26')]){case _0x993e('0x27'):_0x48f2c3['qs']=_0x471a59;break;case _0x993e('0x28'):_0x48f2c3[_0x993e('0xb')]=_0x471a59;break;}return rp(_0x48f2c3)[_0x993e('0x15')](function(_0x5baccb){logger[_0x993e('0x29')](_0x993e('0x2a'),_0x993e('0x20'),util[_0x993e('0x21')](_0x993e('0x2b'),_0x471a59['id'],_0x3edf21['replyUri']));if(_0x5baccb[_0x993e('0xb')][_0x993e('0x2c')]&&_0x5baccb[_0x993e('0xb')][_0x993e('0x2c')]!=_0x471a59['Interaction'][_0x993e('0x2c')]){return _0x51b619[_0x993e('0x2d')][_0x993e('0x2e')]({'threadId':_0x5baccb[_0x993e('0xb')][_0x993e('0x2c')]},{'logging':!![],'where':{'id':_0x471a59[_0x993e('0x24')]['id']}});}else{return;}})[_0x993e('0x15')](function(){return _0x1ecde1[_0x993e('0x2e')]({'read':!![]});})['catch'](function(_0x279905){logger[_0x993e('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x993e('0x20'),util[_0x993e('0x2f')](_0x279905,{'showHidden':![],'depth':null}));_0x453158();});}else{_0x453158();}})['finally'](function(){_0x453158();});}else{_0x453158();}}},'charset':_0x993e('0x30'),'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 3e13b95..039dc78 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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x168a6d,_0x46a815){var _0x23a3c9=function(_0x327580){while(--_0x327580){_0x168a6d['push'](_0x168a6d['shift']());}};_0x23a3c9(++_0x46a815);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0xd08f80,_0x25dcf3){var _0x5b9dca=function(_0x40aef7){while(--_0x40aef7){_0xd08f80['push'](_0xd08f80['shift']());}};_0x5b9dca(++_0x25dcf3);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0xb10b[_0x1d4923];return _0x14ea9a;};'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')]('OpenchannelMessage,\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')]('OpenchannelMessage,\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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 17ed90c..799c9fc 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 _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x12afef,_0x348cb6){var _0x37919b=function(_0x203b0c){while(--_0x203b0c){_0x12afef['push'](_0x12afef['shift']());}};_0x37919b(++_0x348cb6);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2e937e,_0x514e7e){_0x2e937e=_0x2e937e-0x0;var _0x2cb68f=_0xf4eb[_0x2e937e];return _0x2cb68f;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x1e4870,_0x470ac0){var _0x243d39=function(_0x4d0465){while(--_0x4d0465){_0x1e4870['push'](_0x1e4870['shift']());}};_0x243d39(++_0x470ac0);}(_0xf4eb,0xec));var _0xbf4e=function(_0x48351a,_0x5eb313){_0x48351a=_0x48351a-0x0;var _0x5c0dca=_0xf4eb[_0x48351a];return _0x5c0dca;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f1e0a36..394152d 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 _0x7d10=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','removeTeams','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members'];(function(_0x2ba9a4,_0x53d1d8){var _0x232b8b=function(_0x2a5078){while(--_0x2a5078){_0x2ba9a4['push'](_0x2ba9a4['shift']());}};_0x232b8b(++_0x53d1d8);}(_0x7d10,0x1ce));var _0x07d1=function(_0x28605d,_0x95ee08){_0x28605d=_0x28605d-0x0;var _0x199725=_0x7d10[_0x28605d];return _0x199725;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x07d1('0x4'));var config=require(_0x07d1('0x5'));var controller=require('./openchannelQueue.controller');router[_0x07d1('0x6')]('/',auth[_0x07d1('0x7')](),controller[_0x07d1('0x8')]);router[_0x07d1('0x6')]('/describe',auth[_0x07d1('0x7')](),controller[_0x07d1('0x9')]);router[_0x07d1('0x6')](_0x07d1('0xa'),auth[_0x07d1('0x7')](),controller[_0x07d1('0xb')]);router[_0x07d1('0x6')](_0x07d1('0xc'),auth[_0x07d1('0x7')](),controller[_0x07d1('0xd')]);router[_0x07d1('0x6')](_0x07d1('0xe'),auth[_0x07d1('0x7')](),controller[_0x07d1('0xf')]);router[_0x07d1('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x07d1('0x10')]);router[_0x07d1('0x11')]('/',auth[_0x07d1('0x7')](),controller[_0x07d1('0x12')]);router[_0x07d1('0x11')](_0x07d1('0xe'),auth[_0x07d1('0x7')](),controller[_0x07d1('0x13')]);router[_0x07d1('0x11')](_0x07d1('0x14'),auth['isAuthenticated'](),controller[_0x07d1('0x15')]);router[_0x07d1('0x16')](_0x07d1('0xa'),auth[_0x07d1('0x7')](),controller['update']);router[_0x07d1('0x17')](_0x07d1('0xa'),auth[_0x07d1('0x7')](),controller['destroy']);router[_0x07d1('0x17')](_0x07d1('0xe'),auth[_0x07d1('0x7')](),controller[_0x07d1('0x18')]);router[_0x07d1('0x17')](_0x07d1('0x14'),auth[_0x07d1('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf78f=['/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','index','/describe','isAuthenticated','describe','get'];(function(_0x3b59ed,_0x281a70){var _0x5cf829=function(_0xca820){while(--_0xca820){_0x3b59ed['push'](_0x3b59ed['shift']());}};_0x5cf829(++_0x281a70);}(_0xf78f,0x72));var _0xff78=function(_0x2e4ddb,_0x331113){_0x2e4ddb=_0x2e4ddb-0x0;var _0x1fe762=_0xf78f[_0x2e4ddb];return _0x1fe762;};'use strict';var multer=require('multer');var util=require(_0xff78('0x0'));var path=require(_0xff78('0x1'));var timeout=require(_0xff78('0x2'));var express=require(_0xff78('0x3'));var router=express[_0xff78('0x4')]();var auth=require(_0xff78('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xff78('0x6')]);router['get'](_0xff78('0x7'),auth[_0xff78('0x8')](),controller[_0xff78('0x9')]);router[_0xff78('0xa')](_0xff78('0xb'),auth[_0xff78('0x8')](),controller[_0xff78('0xc')]);router[_0xff78('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0xff78('0xd')]);router[_0xff78('0xa')](_0xff78('0xe'),auth[_0xff78('0x8')](),controller[_0xff78('0xf')]);router[_0xff78('0xa')](_0xff78('0x10'),auth[_0xff78('0x8')](),controller['getAgents']);router[_0xff78('0x11')]('/',auth[_0xff78('0x8')](),controller['create']);router[_0xff78('0x11')]('/:id/teams',auth[_0xff78('0x8')](),controller['addTeams']);router[_0xff78('0x11')](_0xff78('0x10'),auth[_0xff78('0x8')](),controller[_0xff78('0x12')]);router['put'](_0xff78('0xb'),auth[_0xff78('0x8')](),controller[_0xff78('0x13')]);router[_0xff78('0x14')](_0xff78('0xb'),auth[_0xff78('0x8')](),controller[_0xff78('0x15')]);router['delete'](_0xff78('0xe'),auth[_0xff78('0x8')](),controller[_0xff78('0x16')]);router[_0xff78('0x14')](_0xff78('0x10'),auth[_0xff78('0x8')](),controller[_0xff78('0x17')]);module[_0xff78('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5dc9974..3339c3d 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 _0xb7e9=['STRING','INTEGER','ENUM','rrmemory','sequelize','exports'];(function(_0x5820b7,_0x5d5a4c){var _0x58d2d8=function(_0x583372){while(--_0x583372){_0x5820b7['push'](_0x5820b7['shift']());}};_0x58d2d8(++_0x5d5a4c);}(_0xb7e9,0x1b4));var _0x9b7e=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0xb7e9[_0x562cd7];return _0x30f50d;};'use strict';var Sequelize=require(_0x9b7e('0x0'));module[_0x9b7e('0x1')]={'name':{'type':Sequelize[_0x9b7e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9b7e('0x2')]},'timeout':{'type':Sequelize[_0x9b7e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9b7e('0x4')](_0x9b7e('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x8b38=['rrmemory','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x4aa90b,_0x3a9d2a){var _0x4ed595=function(_0x42764f){while(--_0x42764f){_0x4aa90b['push'](_0x4aa90b['shift']());}};_0x4ed595(++_0x3a9d2a);}(_0x8b38,0x159));var _0x88b3=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8b38[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x88b3('0x0'));module[_0x88b3('0x1')]={'name':{'type':Sequelize[_0x88b3('0x2')],'unique':_0x88b3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x88b3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x88b3('0x4')](_0x88b3('0x5'),'beepall',_0x88b3('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8cf1070..ef7caf8 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 _0x0490=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','User','UserId','agent','createdAt','%s/%s','SIP','openchannelPause','Team','rawAttributes','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','getAgents','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','show','params','keys','filtears','length','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x45233f,_0x40d87a){var _0x3cb731=function(_0xbf1f15){while(--_0xbf1f15){_0x45233f['push'](_0x45233f['shift']());}};_0x3cb731(++_0x40d87a);}(_0x0490,0x147));var _0x0049=function(_0x35a123,_0x151622){_0x35a123=_0x35a123-0x0;var _0x281911=_0x0490[_0x35a123];return _0x281911;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0049('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var Mustache=require(_0x0049('0x3'));var util=require(_0x0049('0x4'));var path=require(_0x0049('0x5'));var sox=require(_0x0049('0x6'));var csv=require(_0x0049('0x7'));var ejs=require(_0x0049('0x8'));var fs=require('fs');var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var licenseUtil=require(_0x0049('0x17'));var db=require(_0x0049('0x18'))['db'];config['redis']=_['defaults'](config[_0x0049('0x19')],{'host':_0x0049('0x1a'),'port':0x18eb});var socket=require(_0x0049('0x1b'))(new Redis(config[_0x0049('0x19')]));require(_0x0049('0x1c'))['register'](socket);function respondWithStatusCode(_0x3aabfb,_0x210df0){_0x210df0=_0x210df0||0xcc;return function(_0x573138){if(_0x573138){return _0x3aabfb[_0x0049('0x1d')](_0x210df0);}return _0x3aabfb[_0x0049('0x1e')](_0x210df0)[_0x0049('0x1f')]();};}function respondWithResult(_0x1a62aa,_0x5adcf2){_0x5adcf2=_0x5adcf2||0xc8;return function(_0x502038){if(_0x502038){return _0x1a62aa[_0x0049('0x1e')](_0x5adcf2)[_0x0049('0x20')](_0x502038);}};}function respondWithFilteredResult(_0x291a94,_0x426251){return function(_0x102b40){if(_0x102b40){var _0x4592ad=_0x102b40[_0x0049('0x21')],_0x191a20=_0x426251['offset'],_0x21691=_0x426251[_0x0049('0x22')]+_0x426251[_0x0049('0x23')],_0x6df63c;if(_0x21691>=_0x4592ad){_0x21691=_0x4592ad;_0x6df63c=0xc8;}else{_0x6df63c=0xce;}_0x291a94['status'](_0x6df63c);return _0x291a94[_0x0049('0x24')](_0x0049('0x25'),_0x191a20+'-'+_0x21691+'/'+_0x4592ad)[_0x0049('0x20')](_0x102b40);}return null;};}function patchUpdates(_0x996fa5){return function(_0x144faa){try{jsonpatch['apply'](_0x144faa,_0x996fa5,!![]);}catch(_0x26a9fb){return BPromise[_0x0049('0x26')](_0x26a9fb);}return _0x144faa['save']();};}function saveUpdates(_0x2170d2,_0x1935d1){return function(_0x4d76e0){if(_0x4d76e0){return _0x4d76e0[_0x0049('0x27')](_0x2170d2)[_0x0049('0x28')](function(_0x2e9f44){return _0x2e9f44;});}return null;};}function removeEntity(_0x223c9c,_0x457bb3){return function(_0x57e21f){if(_0x57e21f){return _0x57e21f[_0x0049('0x29')]()[_0x0049('0x28')](function(){var _0x211e5b=_0x57e21f['get']({'plain':!![]});var _0x217a12=_0x0049('0x2a');return db[_0x0049('0x2b')][_0x0049('0x29')]({'where':{'type':_0x217a12,'resourceId':_0x211e5b['id']}})[_0x0049('0x28')](function(){return _0x57e21f;});})['then'](function(){_0x223c9c[_0x0049('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8bb034,_0x3679d0){return function(_0x450698){if(!_0x450698){_0x8bb034[_0x0049('0x1d')](0x194);}return _0x450698;};}function handleError(_0x4bc932,_0x305623){_0x305623=_0x305623||0x1f4;return function(_0x402774){logger[_0x0049('0x2c')](_0x402774[_0x0049('0x2d')]);if(_0x402774[_0x0049('0x2e')]){delete _0x402774['name'];}_0x4bc932[_0x0049('0x1e')](_0x305623)[_0x0049('0x2f')](_0x402774);};}exports[_0x0049('0x30')]=function(_0x4bd71c,_0x9cd191){var _0xf9343={},_0x245599={},_0x25876e={'count':0x0,'rows':[]};var _0x54f407=_[_0x0049('0x31')](db[_0x0049('0x32')]['rawAttributes'],function(_0x1170b8){return{'name':_0x1170b8[_0x0049('0x33')],'type':_0x1170b8['type'][_0x0049('0x34')]};});_0x245599[_0x0049('0x35')]=_[_0x0049('0x31')](_0x54f407,_0x0049('0x2e'));_0x245599[_0x0049('0x36')]=_['keys'](_0x4bd71c[_0x0049('0x36')]);_0x245599[_0x0049('0x37')]=_[_0x0049('0x38')](_0x245599[_0x0049('0x35')],_0x245599[_0x0049('0x36')]);_0xf9343['attributes']=_[_0x0049('0x38')](_0x245599['model'],qs[_0x0049('0x39')](_0x4bd71c[_0x0049('0x36')][_0x0049('0x39')]));_0xf9343['attributes']=_0xf9343[_0x0049('0x3a')]['length']?_0xf9343[_0x0049('0x3a')]:_0x245599[_0x0049('0x35')];if(!_0x4bd71c[_0x0049('0x36')]['hasOwnProperty'](_0x0049('0x3b'))){_0xf9343[_0x0049('0x23')]=qs[_0x0049('0x23')](_0x4bd71c[_0x0049('0x36')][_0x0049('0x23')]);_0xf9343[_0x0049('0x22')]=qs['offset'](_0x4bd71c[_0x0049('0x36')][_0x0049('0x22')]);}_0xf9343['order']=qs['sort'](_0x4bd71c[_0x0049('0x36')][_0x0049('0x3c')]);_0xf9343[_0x0049('0x3d')]=qs[_0x0049('0x37')](_[_0x0049('0x3e')](_0x4bd71c[_0x0049('0x36')],_0x245599[_0x0049('0x37')]),_0x54f407);if(_0x4bd71c[_0x0049('0x36')]['filter']){_0xf9343[_0x0049('0x3d')]=_[_0x0049('0x3f')](_0xf9343[_0x0049('0x3d')],{'$or':_[_0x0049('0x31')](_0x54f407,function(_0xe8a86f){if(_0xe8a86f[_0x0049('0x40')]!==_0x0049('0x41')){var _0x3fa25e={};_0x3fa25e[_0xe8a86f['name']]={'$like':'%'+_0x4bd71c[_0x0049('0x36')][_0x0049('0x42')]+'%'};return _0x3fa25e;}})});}_0xf9343=_[_0x0049('0x3f')]({},_0xf9343,_0x4bd71c[_0x0049('0x43')]);var _0x1fa131={'where':_0xf9343[_0x0049('0x3d')]};return db[_0x0049('0x32')][_0x0049('0x21')](_0x1fa131)[_0x0049('0x28')](function(_0x127d27){_0x25876e[_0x0049('0x21')]=_0x127d27;if(_0x4bd71c[_0x0049('0x36')][_0x0049('0x44')]){_0xf9343['include']=[{'all':!![]}];}return db[_0x0049('0x32')][_0x0049('0x45')](_0xf9343);})[_0x0049('0x28')](function(_0x55df4f){_0x25876e['rows']=_0x55df4f;return _0x25876e;})[_0x0049('0x28')](respondWithFilteredResult(_0x9cd191,_0xf9343))['catch'](handleError(_0x9cd191,null));};exports[_0x0049('0x46')]=function(_0x3d7f52,_0x3539f3){var _0x3fdc1f={'raw':!![],'where':{'id':_0x3d7f52[_0x0049('0x47')]['id']}},_0x376ff9={};_0x376ff9[_0x0049('0x35')]=_[_0x0049('0x48')](db['OpenchannelQueue']['rawAttributes']);_0x376ff9['query']=_[_0x0049('0x48')](_0x3d7f52[_0x0049('0x36')]);_0x376ff9[_0x0049('0x49')]=_['intersection'](_0x376ff9[_0x0049('0x35')],_0x376ff9[_0x0049('0x36')]);_0x3fdc1f[_0x0049('0x3a')]=_['intersection'](_0x376ff9['model'],qs['fields'](_0x3d7f52[_0x0049('0x36')]['fields']));_0x3fdc1f['attributes']=_0x3fdc1f[_0x0049('0x3a')][_0x0049('0x4a')]?_0x3fdc1f[_0x0049('0x3a')]:_0x376ff9[_0x0049('0x35')];if(_0x3d7f52[_0x0049('0x36')]['includeAll']){_0x3fdc1f[_0x0049('0x4b')]=[{'all':!![]}];}_0x3fdc1f=_[_0x0049('0x3f')]({},_0x3fdc1f,_0x3d7f52[_0x0049('0x43')]);return db[_0x0049('0x32')][_0x0049('0x4c')](_0x3fdc1f)[_0x0049('0x28')](handleEntityNotFound(_0x3539f3,null))['then'](respondWithResult(_0x3539f3,null))[_0x0049('0x4d')](handleError(_0x3539f3,null));};exports['create']=function(_0x36cc55,_0x5227b4){return db[_0x0049('0x32')][_0x0049('0x4e')](_0x36cc55[_0x0049('0x4f')],{})[_0x0049('0x28')](function(_0xc3a900){var _0x4e198f=_0x36cc55[_0x0049('0x50')][_0x0049('0x51')]({'plain':!![]});if(!_0x4e198f)throw new Error(_0x0049('0x52'));if(_0x4e198f[_0x0049('0x53')]===_0x0049('0x50')){var _0x152574=_0xc3a900['get']({'plain':!![]});var _0x3e180='OpenchannelQueues';return db[_0x0049('0x54')][_0x0049('0x4c')]({'where':{'name':_0x3e180,'userProfileId':_0x4e198f['userProfileId']},'raw':!![]})[_0x0049('0x28')](function(_0x277d37){if(_0x277d37&&_0x277d37[_0x0049('0x55')]===0x0){return db[_0x0049('0x2b')][_0x0049('0x4e')]({'name':_0x152574[_0x0049('0x2e')],'resourceId':_0x152574['id'],'type':_0x277d37[_0x0049('0x2e')],'sectionId':_0x277d37['id']},{})['then'](function(){return _0xc3a900;});}else{return _0xc3a900;}})['catch'](function(_0x458b4a){logger[_0x0049('0x2c')](_0x0049('0x56'),_0x458b4a);throw _0x458b4a;});}return _0xc3a900;})[_0x0049('0x28')](respondWithResult(_0x5227b4,0xc9))['catch'](handleError(_0x5227b4,null));};exports[_0x0049('0x27')]=function(_0x5e2196,_0x5be63d){if(_0x5e2196['body']['id']){delete _0x5e2196['body']['id'];}return db[_0x0049('0x32')][_0x0049('0x4c')]({'where':{'id':_0x5e2196[_0x0049('0x47')]['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x5be63d,null))[_0x0049('0x28')](saveUpdates(_0x5e2196['body'],null))['then'](respondWithResult(_0x5be63d,null))[_0x0049('0x4d')](handleError(_0x5be63d,null));};exports[_0x0049('0x29')]=function(_0x19435a,_0x2fb003){return db['OpenchannelQueue'][_0x0049('0x4c')]({'where':{'id':_0x19435a[_0x0049('0x47')]['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x2fb003,null))[_0x0049('0x28')](removeEntity(_0x2fb003,null))[_0x0049('0x4d')](handleError(_0x2fb003,null));};exports[_0x0049('0x57')]=function(_0x5a7d80,_0xbe1b2f){return db[_0x0049('0x32')]['describe']()[_0x0049('0x28')](respondWithResult(_0xbe1b2f,null))[_0x0049('0x4d')](handleError(_0xbe1b2f,null));};exports['getMembers']=function(_0x4cb4fd,_0x3a58fe,_0xa2c119){var _0x3b01e7={'raw':!![],'where':{}},_0x15d230={},_0x57c99f;return db['OpenchannelQueue'][_0x0049('0x58')]({'where':{'id':_0x4cb4fd[_0x0049('0x47')]['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x3a58fe,null))[_0x0049('0x28')](function(_0x3f3628){if(_0x3f3628){_0x57c99f=_0x3f3628[_0x0049('0x51')]({'plain':!![]});_0x15d230[_0x0049('0x35')]=_[_0x0049('0x48')](db[_0x0049('0x59')]['rawAttributes']);_0x15d230[_0x0049('0x36')]=_['keys'](_0x4cb4fd['query']);_0x15d230[_0x0049('0x37')]=_[_0x0049('0x38')](_0x15d230[_0x0049('0x35')],_0x15d230[_0x0049('0x36')]);_0x3b01e7['attributes']=_[_0x0049('0x38')](_0x15d230[_0x0049('0x35')],qs[_0x0049('0x39')](_0x4cb4fd[_0x0049('0x36')]['fields']));_0x3b01e7[_0x0049('0x3a')]=_0x3b01e7[_0x0049('0x3a')]['length']?_0x3b01e7[_0x0049('0x3a')]:_0x15d230[_0x0049('0x35')];if(!_0x4cb4fd[_0x0049('0x36')][_0x0049('0x5a')]('nolimit')){_0x3b01e7[_0x0049('0x23')]=qs['limit'](_0x4cb4fd[_0x0049('0x36')]['limit']);_0x3b01e7['offset']=qs['offset'](_0x4cb4fd[_0x0049('0x36')][_0x0049('0x22')]);}_0x3b01e7[_0x0049('0x5b')]=qs[_0x0049('0x3c')](_0x4cb4fd[_0x0049('0x36')][_0x0049('0x3c')]);_0x3b01e7[_0x0049('0x3d')]=qs[_0x0049('0x37')](_[_0x0049('0x3e')](_0x4cb4fd[_0x0049('0x36')],_0x15d230[_0x0049('0x37')]));_0x3b01e7[_0x0049('0x3d')][_0x0049('0x5c')]=_0x3f3628['id'];if(_0x4cb4fd[_0x0049('0x36')][_0x0049('0x42')]){_0x3b01e7[_0x0049('0x3d')]=_[_0x0049('0x3f')](_0x3b01e7[_0x0049('0x3d')],{'$or':_['map'](_0x3b01e7[_0x0049('0x3a')],function(_0x314036){var _0x576dc9={};_0x576dc9[_0x314036]={'$like':'%'+_0x4cb4fd[_0x0049('0x36')][_0x0049('0x42')]+'%'};return _0x576dc9;})});}_0x3b01e7=_['merge']({},_0x3b01e7,_0x4cb4fd[_0x0049('0x43')]);return db[_0x0049('0x59')]['findAll'](_0x3b01e7);}})['then'](function(_0x500816){if(_0x500816){return db[_0x0049('0x5d')]['findAndCountAll']({'where':{'id':_[_0x0049('0x31')](_0x500816,_0x0049('0x5e')),'role':_0x0049('0x5f')},'attributes':['id',_0x0049('0x2e'),'openchannelPause','updatedAt',_0x0049('0x60')]});}})[_0x0049('0x28')](function(_0x41304d){if(_0x41304d){return{'count':_0x41304d['count'],'rows':_[_0x0049('0x31')](_0x41304d['rows'],function(_0xd51681){return{'membername':_0xd51681[_0x0049('0x2e')],'UserId':_0xd51681['id'],'queue_name':_0x57c99f['name'],'OpenchannelQueueId':_0x57c99f['id'],'interface':util['format'](_0x0049('0x61'),_0x0049('0x62'),_0xd51681[_0x0049('0x2e')]),'penalty':0x0,'paused':_0xd51681[_0x0049('0x63')],'createdAt':_0xd51681[_0x0049('0x60')],'updatedAt':_0xd51681['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3a58fe,_0x3b01e7))['catch'](handleError(_0x3a58fe,null));};exports['getTeams']=function(_0x58da32,_0x1d66c0,_0x44d019){var _0x2597cc={};var _0x40c6d5={};var _0x2ba989;var _0x298e08;return db[_0x0049('0x32')][_0x0049('0x58')]({'where':{'id':_0x58da32[_0x0049('0x47')]['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x1d66c0,null))[_0x0049('0x28')](function(_0xa82195){if(_0xa82195){_0x2ba989=_0xa82195;_0x40c6d5[_0x0049('0x35')]=_['keys'](db[_0x0049('0x64')][_0x0049('0x65')]);_0x40c6d5['query']=_['keys'](_0x58da32['query']);_0x40c6d5[_0x0049('0x37')]=_['intersection'](_0x40c6d5[_0x0049('0x35')],_0x40c6d5[_0x0049('0x36')]);_0x2597cc['attributes']=_[_0x0049('0x38')](_0x40c6d5[_0x0049('0x35')],qs[_0x0049('0x39')](_0x58da32[_0x0049('0x36')][_0x0049('0x39')]));_0x2597cc[_0x0049('0x3a')]=_0x2597cc[_0x0049('0x3a')][_0x0049('0x4a')]?_0x2597cc['attributes']:_0x40c6d5['model'];_0x2597cc[_0x0049('0x5b')]=qs[_0x0049('0x3c')](_0x58da32[_0x0049('0x36')][_0x0049('0x3c')]);_0x2597cc[_0x0049('0x3d')]=qs[_0x0049('0x37')](_[_0x0049('0x3e')](_0x58da32[_0x0049('0x36')],_0x40c6d5[_0x0049('0x37')]));if(_0x58da32[_0x0049('0x36')]['filter']){_0x2597cc['where']=_['merge'](_0x2597cc[_0x0049('0x3d')],{'$or':_[_0x0049('0x31')](_0x2597cc[_0x0049('0x3a')],function(_0x183dc9){var _0x5122fc={};_0x5122fc[_0x183dc9]={'$like':'%'+_0x58da32[_0x0049('0x36')][_0x0049('0x42')]+'%'};return _0x5122fc;})});}_0x2597cc=_[_0x0049('0x3f')]({},_0x2597cc,_0x58da32[_0x0049('0x43')]);return _0x2ba989[_0x0049('0x66')](_0x2597cc);}})[_0x0049('0x28')](function(_0x1e78e0){if(_0x1e78e0){_0x298e08=_0x1e78e0[_0x0049('0x4a')];if(!_0x58da32[_0x0049('0x36')][_0x0049('0x5a')](_0x0049('0x3b'))){_0x2597cc['limit']=qs['limit'](_0x58da32[_0x0049('0x36')][_0x0049('0x23')]);_0x2597cc['offset']=qs[_0x0049('0x22')](_0x58da32[_0x0049('0x36')][_0x0049('0x22')]);}return _0x2ba989[_0x0049('0x66')](_0x2597cc);}})[_0x0049('0x28')](function(_0x4ff9f0){if(_0x4ff9f0){return _0x4ff9f0?{'count':_0x298e08,'rows':_0x4ff9f0}:null;}})['then'](respondWithResult(_0x1d66c0,null))[_0x0049('0x4d')](handleError(_0x1d66c0,null));};exports[_0x0049('0x67')]=function(_0x1f0718,_0x256dfd,_0x5b3046){var _0x46d876=_0x1f0718['body'][_0x0049('0x68')];return db[_0x0049('0x64')]['findAll']({'where':{'id':_0x46d876},'attributes':['id'],'include':[{'model':db[_0x0049('0x5d')],'as':_0x0049('0x69'),'attributes':['id',_0x0049('0x2e'),_0x0049('0x6a'),_0x0049('0x6b'),_0x0049('0x6c')],'raw':!![]}]})[_0x0049('0x28')](function(_0x543667){if(_0x543667){var _0xefc5f4=_['flatMap'](_0x543667,function(_0x4e80cd){var _0x503921=_0x4e80cd[_0x0049('0x51')]({'plain':!![]});return _0x503921[_0x0049('0x69')];});return db['OpenchannelQueue'][_0x0049('0x4c')]({'where':{'id':_0x1f0718['params']['id']}})['then'](function(_0x322951){return db[_0x0049('0x6d')]['transaction'](function(_0x1ff4c0){return _0x322951[_0x0049('0x67')](_0x46d876,{'transaction':_0x1ff4c0})[_0x0049('0x28')](function(){return BPromise[_0x0049('0x6e')](_0xefc5f4,function(_0x122833){return db[_0x0049('0x59')][_0x0049('0x6f')]({'where':{'UserId':_0x122833['id'],'OpenchannelQueueId':_0x1f0718[_0x0049('0x47')]['id']},'transaction':_0x1ff4c0});});})[_0x0049('0x28')](function(){_0xefc5f4[_0x0049('0x70')](function(_0x506a41){socket[_0x0049('0x71')](_0x0049('0x72'),{'UserId':_0x506a41['id'],'OpenchannelQueueId':_0x322951['id']});});});});});}})[_0x0049('0x28')](respondWithStatusCode(_0x256dfd,null))[_0x0049('0x4d')](handleError(_0x256dfd,null));};exports[_0x0049('0x73')]=function(_0x216f6f,_0x5018a1,_0x1b56cf){return db['Team'][_0x0049('0x45')]({'where':{'id':_0x216f6f['query'][_0x0049('0x68')]},'attributes':['id'],'include':[{'model':db[_0x0049('0x5d')],'as':_0x0049('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5018a1,null))[_0x0049('0x28')](function(_0x337e14){var _0x32a721=_[_0x0049('0x31')](_0x337e14,'id');var _0x39b1f8=[];var _0x3e21a8=[];var _0x47c4ca=squel[_0x0049('0x74')]();_0x47c4ca[_0x0049('0x75')](_0x0049('0x76'))['from'](_0x0049('0x77'),'tq')[_0x0049('0x78')](_0x0049('0x79'),'ut',_0x0049('0x7a'))[_0x0049('0x3d')]('OpenchannelQueueId\x20=\x20?',_0x216f6f[_0x0049('0x47')]['id']);for(var _0x1a9707=0x0;_0x1a9707<_0x337e14[_0x0049('0x4a')];_0x1a9707+=0x1){let _0x14da5f=_0x337e14[_0x1a9707];for(var _0x34256d=0x0;_0x34256d<_0x14da5f[_0x0049('0x69')][_0x0049('0x4a')];_0x34256d+=0x1){let _0x38ed9f=_0x14da5f[_0x0049('0x69')][_0x34256d];var _0x4e5b0f=_0x47c4ca['clone']();_0x4e5b0f[_0x0049('0x3d')](_0x0049('0x7b'),_0x38ed9f['id']);_0x3e21a8['push'](db['sequelize'][_0x0049('0x36')](_0x4e5b0f[_0x0049('0x7c')](),{'type':db[_0x0049('0x6d')][_0x0049('0x7d')]['SELECT']})[_0x0049('0x28')](function(_0x2aedc3){if(_0x2aedc3[_0x0049('0x4a')]===0x1){return _0x38ed9f['id'];}else{var _0x2118a9=_['every'](_[_0x0049('0x31')](_0x2aedc3,_0x0049('0x7e')),function(_0x3fa223){return _['includes'](_0x32a721,_0x3fa223);});if(_0x2118a9){return _0x38ed9f['id'];}}}));}}return BPromise[_0x0049('0x7f')](_0x3e21a8)[_0x0049('0x28')](function(_0xbb8737){_0x39b1f8=_(_0x39b1f8)[_0x0049('0x80')](_0xbb8737)[_0x0049('0x81')]()[_0x0049('0x82')]();return db['OpenchannelQueue'][_0x0049('0x4c')]({'where':{'id':_0x216f6f[_0x0049('0x47')]['id']}})[_0x0049('0x28')](function(_0x1b8d4d){return db[_0x0049('0x6d')][_0x0049('0x83')](function(_0x57d9e0){return _0x1b8d4d[_0x0049('0x73')](_0x216f6f['query'][_0x0049('0x68')],{'transaction':_0x57d9e0})[_0x0049('0x28')](function(){if(!_[_0x0049('0x84')](_0x39b1f8)){return _0x1b8d4d[_0x0049('0x85')](_0x39b1f8,{'transaction':_0x57d9e0});}})[_0x0049('0x28')](function(){_0x39b1f8[_0x0049('0x70')](function(_0x5d3ccf){socket['emit'](_0x0049('0x86'),{'UserId':_0x5d3ccf,'OpenchannelQueueId':_0x1b8d4d['id']});});});});});});})['then'](respondWithStatusCode(_0x5018a1,null))[_0x0049('0x4d')](handleError(_0x5018a1,null));};exports[_0x0049('0x87')]=function(_0x189941,_0x405d21,_0x246920){return db[_0x0049('0x32')][_0x0049('0x4c')]({'where':{'id':_0x189941['params']['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x405d21,null))[_0x0049('0x28')](function(_0x46c80b){if(_0x46c80b){return _0x46c80b['addAgents'](_0x189941[_0x0049('0x4f')]['ids'],_['omit'](_0x189941['body'],[_0x0049('0x68'),'id'])||{})['spread'](function(_0x33f6dd){for(var _0x80cb7a=0x0;_0x80cb7a<_0x189941['body'][_0x0049('0x68')]['length'];_0x80cb7a+=0x1){socket['emit'](_0x0049('0x72'),{'UserId':_0x189941[_0x0049('0x4f')][_0x0049('0x68')][_0x80cb7a],'OpenchannelQueueId':_0x189941[_0x0049('0x47')]['id']});}return _0x33f6dd;});}})[_0x0049('0x28')](respondWithResult(_0x405d21,null))[_0x0049('0x4d')](handleError(_0x405d21,null));};exports['removeAgents']=function(_0x41668d,_0x5384bd,_0x33f052){return db[_0x0049('0x32')][_0x0049('0x4c')]({'where':{'id':_0x41668d[_0x0049('0x47')]['id']}})['then'](handleEntityNotFound(_0x5384bd,null))[_0x0049('0x28')](function(_0x43b01b){if(_0x43b01b){return _0x43b01b['removeAgents'](_0x41668d['query'][_0x0049('0x68')])[_0x0049('0x28')](function(){if(_['isArray'](_0x41668d[_0x0049('0x36')][_0x0049('0x68')])){for(var _0x29043b=0x0;_0x29043b<_0x41668d[_0x0049('0x36')][_0x0049('0x68')][_0x0049('0x4a')];_0x29043b+=0x1){socket[_0x0049('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x41668d['query'][_0x0049('0x68')][_0x29043b]),'OpenchannelQueueId':Number(_0x41668d[_0x0049('0x47')]['id'])});}}else{socket['emit'](_0x0049('0x86'),{'UserId':Number(_0x41668d['query'][_0x0049('0x68')]),'OpenchannelQueueId':Number(_0x41668d[_0x0049('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x5384bd,null))[_0x0049('0x4d')](handleError(_0x5384bd,null));};exports['getAgents']=function(_0x8bba24,_0x4050f8,_0x599dbc){var _0x5cb6bd={};var _0x32648b={};var _0x3de464;var _0x181f8b;return db[_0x0049('0x32')][_0x0049('0x58')]({'where':{'id':_0x8bba24['params']['id']}})[_0x0049('0x28')](handleEntityNotFound(_0x4050f8,null))['then'](function(_0x2ffb8c){if(_0x2ffb8c){_0x3de464=_0x2ffb8c;_0x32648b[_0x0049('0x35')]=_[_0x0049('0x48')](db[_0x0049('0x5d')][_0x0049('0x65')]);_0x32648b[_0x0049('0x36')]=_['keys'](_0x8bba24[_0x0049('0x36')]);_0x32648b[_0x0049('0x37')]=_[_0x0049('0x38')](_0x32648b[_0x0049('0x35')],_0x32648b[_0x0049('0x36')]);_0x5cb6bd[_0x0049('0x3a')]=_['intersection'](_0x32648b[_0x0049('0x35')],qs[_0x0049('0x39')](_0x8bba24['query'][_0x0049('0x39')]));_0x5cb6bd[_0x0049('0x3a')]=_0x5cb6bd['attributes']['length']?_0x5cb6bd[_0x0049('0x3a')]:_0x32648b['model'];_0x5cb6bd['order']=qs['sort'](_0x8bba24[_0x0049('0x36')][_0x0049('0x3c')]);_0x5cb6bd['where']=qs[_0x0049('0x37')](_[_0x0049('0x3e')](_0x8bba24[_0x0049('0x36')],_0x32648b['filters']));if(_0x8bba24['query'][_0x0049('0x42')]){_0x5cb6bd['where']=_[_0x0049('0x3f')](_0x5cb6bd['where'],{'$or':_['map'](_0x5cb6bd[_0x0049('0x3a')],function(_0x4f3e81){var _0x354a18={};_0x354a18[_0x4f3e81]={'$like':'%'+_0x8bba24[_0x0049('0x36')][_0x0049('0x42')]+'%'};return _0x354a18;})});}_0x5cb6bd=_[_0x0049('0x3f')]({},_0x5cb6bd,_0x8bba24[_0x0049('0x43')]);return _0x3de464[_0x0049('0x88')](_0x5cb6bd);}})[_0x0049('0x28')](function(_0x77a4f6){if(_0x77a4f6){_0x181f8b=_0x77a4f6['length'];if(!_0x8bba24[_0x0049('0x36')]['hasOwnProperty'](_0x0049('0x3b'))){_0x5cb6bd[_0x0049('0x23')]=qs[_0x0049('0x23')](_0x8bba24[_0x0049('0x36')][_0x0049('0x23')]);_0x5cb6bd[_0x0049('0x22')]=qs[_0x0049('0x22')](_0x8bba24[_0x0049('0x36')][_0x0049('0x22')]);}return _0x3de464[_0x0049('0x88')](_0x5cb6bd);}})[_0x0049('0x28')](function(_0x28d925){if(_0x28d925){return _0x28d925?{'count':_0x181f8b,'rows':_0x28d925}:null;}})[_0x0049('0x28')](respondWithResult(_0x4050f8,null))[_0x0049('0x4d')](handleError(_0x4050f8,null));}; \ No newline at end of file +var _0x3f8c=['sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','destroy','get','OpenchannelQueues','UserProfileResource','then','error','name','send','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','catch','params','keys','filtears','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','findAndCountAll','openchannelPause','createdAt','format','updatedAt','findOne','getTeams','ids','Agents','online','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','Team','User','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','SELECT','every','TeamId','includes','union','value','transaction','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x58d48c,_0x5c13f4){var _0x37e0ba=function(_0x221ef5){while(--_0x221ef5){_0x58d48c['push'](_0x58d48c['shift']());}};_0x37e0ba(++_0x5c13f4);}(_0x3f8c,0x104));var _0xc3f8=function(_0x53c8fe,_0x310d6a){_0x53c8fe=_0x53c8fe-0x0;var _0x2fdc0c=_0x3f8c[_0x53c8fe];return _0x2fdc0c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc3f8('0x0'));var zipdir=require(_0xc3f8('0x1'));var jsonpatch=require(_0xc3f8('0x2'));var rp=require(_0xc3f8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc3f8('0x4'));var csv=require(_0xc3f8('0x5'));var ejs=require(_0xc3f8('0x6'));var fs=require('fs');var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x5'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var Redis=require(_0xc3f8('0xd'));var authService=require(_0xc3f8('0xe'));var qs=require(_0xc3f8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f8('0x10'));var logger=require(_0xc3f8('0x11'))(_0xc3f8('0x12'));var utils=require(_0xc3f8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc3f8('0x14'));var db=require(_0xc3f8('0x15'))['db'];config[_0xc3f8('0x16')]=_[_0xc3f8('0x17')](config['redis'],{'host':_0xc3f8('0x18'),'port':0x18eb});var socket=require(_0xc3f8('0x19'))(new Redis(config[_0xc3f8('0x16')]));require(_0xc3f8('0x1a'))[_0xc3f8('0x1b')](socket);function respondWithStatusCode(_0x47754c,_0x29e2b6){_0x29e2b6=_0x29e2b6||0xcc;return function(_0x4731cd){if(_0x4731cd){return _0x47754c[_0xc3f8('0x1c')](_0x29e2b6);}return _0x47754c[_0xc3f8('0x1d')](_0x29e2b6)[_0xc3f8('0x1e')]();};}function respondWithResult(_0x2a9f64,_0x29d031){_0x29d031=_0x29d031||0xc8;return function(_0x58f636){if(_0x58f636){return _0x2a9f64[_0xc3f8('0x1d')](_0x29d031)['json'](_0x58f636);}};}function respondWithFilteredResult(_0x51807b,_0x3df137){return function(_0x2e7c0f){if(_0x2e7c0f){var _0x35500f=_0x2e7c0f[_0xc3f8('0x1f')],_0xb4ab67=_0x3df137['offset'],_0x47a185=_0x3df137[_0xc3f8('0x20')]+_0x3df137['limit'],_0x3e75a4;if(_0x47a185>=_0x35500f){_0x47a185=_0x35500f;_0x3e75a4=0xc8;}else{_0x3e75a4=0xce;}_0x51807b[_0xc3f8('0x1d')](_0x3e75a4);return _0x51807b[_0xc3f8('0x21')](_0xc3f8('0x22'),_0xb4ab67+'-'+_0x47a185+'/'+_0x35500f)['json'](_0x2e7c0f);}return null;};}function patchUpdates(_0x543dca){return function(_0x113cd2){try{jsonpatch[_0xc3f8('0x23')](_0x113cd2,_0x543dca,!![]);}catch(_0x1436d7){return BPromise[_0xc3f8('0x24')](_0x1436d7);}return _0x113cd2[_0xc3f8('0x25')]();};}function saveUpdates(_0x251bf7,_0x43b2b4){return function(_0x42a155){if(_0x42a155){return _0x42a155['update'](_0x251bf7)['then'](function(_0x4b83f0){return _0x4b83f0;});}return null;};}function removeEntity(_0x2559a4,_0x5e1d14){return function(_0x11335){if(_0x11335){return _0x11335[_0xc3f8('0x26')]()['then'](function(){var _0x4569c2=_0x11335[_0xc3f8('0x27')]({'plain':!![]});var _0x2d237e=_0xc3f8('0x28');return db[_0xc3f8('0x29')][_0xc3f8('0x26')]({'where':{'type':_0x2d237e,'resourceId':_0x4569c2['id']}})[_0xc3f8('0x2a')](function(){return _0x11335;});})[_0xc3f8('0x2a')](function(){_0x2559a4[_0xc3f8('0x1d')](0xcc)[_0xc3f8('0x1e')]();});}};}function handleEntityNotFound(_0x22c8e6,_0x394629){return function(_0x238ff5){if(!_0x238ff5){_0x22c8e6[_0xc3f8('0x1c')](0x194);}return _0x238ff5;};}function handleError(_0x59e4dd,_0x58b303){_0x58b303=_0x58b303||0x1f4;return function(_0x2909f8){logger[_0xc3f8('0x2b')](_0x2909f8['stack']);if(_0x2909f8[_0xc3f8('0x2c')]){delete _0x2909f8['name'];}_0x59e4dd[_0xc3f8('0x1d')](_0x58b303)[_0xc3f8('0x2d')](_0x2909f8);};}exports['index']=function(_0x48b32e,_0x21a225){var _0x25df65={},_0xd32b09={},_0x3704e5={'count':0x0,'rows':[]};var _0x3713c5=_[_0xc3f8('0x2e')](db[_0xc3f8('0x2f')][_0xc3f8('0x30')],function(_0x16f53a){return{'name':_0x16f53a[_0xc3f8('0x31')],'type':_0x16f53a['type'][_0xc3f8('0x32')]};});_0xd32b09[_0xc3f8('0x33')]=_[_0xc3f8('0x2e')](_0x3713c5,_0xc3f8('0x2c'));_0xd32b09[_0xc3f8('0x34')]=_['keys'](_0x48b32e['query']);_0xd32b09[_0xc3f8('0x35')]=_[_0xc3f8('0x36')](_0xd32b09[_0xc3f8('0x33')],_0xd32b09[_0xc3f8('0x34')]);_0x25df65[_0xc3f8('0x37')]=_['intersection'](_0xd32b09[_0xc3f8('0x33')],qs[_0xc3f8('0x38')](_0x48b32e[_0xc3f8('0x34')]['fields']));_0x25df65[_0xc3f8('0x37')]=_0x25df65[_0xc3f8('0x37')][_0xc3f8('0x39')]?_0x25df65['attributes']:_0xd32b09[_0xc3f8('0x33')];if(!_0x48b32e[_0xc3f8('0x34')]['hasOwnProperty'](_0xc3f8('0x3a'))){_0x25df65[_0xc3f8('0x3b')]=qs[_0xc3f8('0x3b')](_0x48b32e[_0xc3f8('0x34')][_0xc3f8('0x3b')]);_0x25df65[_0xc3f8('0x20')]=qs['offset'](_0x48b32e[_0xc3f8('0x34')][_0xc3f8('0x20')]);}_0x25df65[_0xc3f8('0x3c')]=qs[_0xc3f8('0x3d')](_0x48b32e[_0xc3f8('0x34')]['sort']);_0x25df65[_0xc3f8('0x3e')]=qs[_0xc3f8('0x35')](_[_0xc3f8('0x3f')](_0x48b32e['query'],_0xd32b09[_0xc3f8('0x35')]),_0x3713c5);if(_0x48b32e[_0xc3f8('0x34')][_0xc3f8('0x40')]){_0x25df65[_0xc3f8('0x3e')]=_['merge'](_0x25df65[_0xc3f8('0x3e')],{'$or':_[_0xc3f8('0x2e')](_0x3713c5,function(_0x2df096){if(_0x2df096[_0xc3f8('0x41')]!=='VIRTUAL'){var _0x3f313e={};_0x3f313e[_0x2df096['name']]={'$like':'%'+_0x48b32e['query'][_0xc3f8('0x40')]+'%'};return _0x3f313e;}})});}_0x25df65=_[_0xc3f8('0x42')]({},_0x25df65,_0x48b32e[_0xc3f8('0x43')]);var _0x400af9={'where':_0x25df65['where']};return db['OpenchannelQueue'][_0xc3f8('0x1f')](_0x400af9)[_0xc3f8('0x2a')](function(_0x7f6156){_0x3704e5[_0xc3f8('0x1f')]=_0x7f6156;if(_0x48b32e[_0xc3f8('0x34')][_0xc3f8('0x44')]){_0x25df65[_0xc3f8('0x45')]=[{'all':!![]}];}return db[_0xc3f8('0x2f')][_0xc3f8('0x46')](_0x25df65);})[_0xc3f8('0x2a')](function(_0x51dd7f){_0x3704e5['rows']=_0x51dd7f;return _0x3704e5;})[_0xc3f8('0x2a')](respondWithFilteredResult(_0x21a225,_0x25df65))[_0xc3f8('0x47')](handleError(_0x21a225,null));};exports['show']=function(_0x1aff20,_0x172f1a){var _0x57dacd={'raw':!![],'where':{'id':_0x1aff20[_0xc3f8('0x48')]['id']}},_0x204fcc={};_0x204fcc[_0xc3f8('0x33')]=_[_0xc3f8('0x49')](db[_0xc3f8('0x2f')][_0xc3f8('0x30')]);_0x204fcc[_0xc3f8('0x34')]=_[_0xc3f8('0x49')](_0x1aff20[_0xc3f8('0x34')]);_0x204fcc[_0xc3f8('0x4a')]=_[_0xc3f8('0x36')](_0x204fcc['model'],_0x204fcc[_0xc3f8('0x34')]);_0x57dacd[_0xc3f8('0x37')]=_['intersection'](_0x204fcc[_0xc3f8('0x33')],qs[_0xc3f8('0x38')](_0x1aff20[_0xc3f8('0x34')][_0xc3f8('0x38')]));_0x57dacd['attributes']=_0x57dacd['attributes'][_0xc3f8('0x39')]?_0x57dacd[_0xc3f8('0x37')]:_0x204fcc[_0xc3f8('0x33')];if(_0x1aff20['query'][_0xc3f8('0x44')]){_0x57dacd[_0xc3f8('0x45')]=[{'all':!![]}];}_0x57dacd=_[_0xc3f8('0x42')]({},_0x57dacd,_0x1aff20[_0xc3f8('0x43')]);return db[_0xc3f8('0x2f')]['find'](_0x57dacd)[_0xc3f8('0x2a')](handleEntityNotFound(_0x172f1a,null))[_0xc3f8('0x2a')](respondWithResult(_0x172f1a,null))['catch'](handleError(_0x172f1a,null));};exports[_0xc3f8('0x4b')]=function(_0x3fcb6a,_0x2eebc8){return db[_0xc3f8('0x2f')][_0xc3f8('0x4b')](_0x3fcb6a[_0xc3f8('0x4c')],{})[_0xc3f8('0x2a')](function(_0x58a66b){var _0x38d132=_0x3fcb6a[_0xc3f8('0x4d')]['get']({'plain':!![]});if(!_0x38d132)throw new Error(_0xc3f8('0x4e'));if(_0x38d132[_0xc3f8('0x4f')]===_0xc3f8('0x4d')){var _0x33e5c5=_0x58a66b[_0xc3f8('0x27')]({'plain':!![]});var _0x41b0df=_0xc3f8('0x28');return db['UserProfileSection'][_0xc3f8('0x50')]({'where':{'name':_0x41b0df,'userProfileId':_0x38d132[_0xc3f8('0x51')]},'raw':!![]})[_0xc3f8('0x2a')](function(_0x267c95){if(_0x267c95&&_0x267c95[_0xc3f8('0x52')]===0x0){return db[_0xc3f8('0x29')][_0xc3f8('0x4b')]({'name':_0x33e5c5[_0xc3f8('0x2c')],'resourceId':_0x33e5c5['id'],'type':_0x267c95['name'],'sectionId':_0x267c95['id']},{})['then'](function(){return _0x58a66b;});}else{return _0x58a66b;}})[_0xc3f8('0x47')](function(_0x206a57){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206a57);throw _0x206a57;});}return _0x58a66b;})[_0xc3f8('0x2a')](respondWithResult(_0x2eebc8,0xc9))['catch'](handleError(_0x2eebc8,null));};exports[_0xc3f8('0x53')]=function(_0xf1e0a6,_0x1d95f5){if(_0xf1e0a6['body']['id']){delete _0xf1e0a6[_0xc3f8('0x4c')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0xf1e0a6[_0xc3f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d95f5,null))[_0xc3f8('0x2a')](saveUpdates(_0xf1e0a6[_0xc3f8('0x4c')],null))[_0xc3f8('0x2a')](respondWithResult(_0x1d95f5,null))['catch'](handleError(_0x1d95f5,null));};exports[_0xc3f8('0x26')]=function(_0x2793f5,_0x159b00){return db[_0xc3f8('0x2f')][_0xc3f8('0x50')]({'where':{'id':_0x2793f5['params']['id']}})['then'](handleEntityNotFound(_0x159b00,null))[_0xc3f8('0x2a')](removeEntity(_0x159b00,null))[_0xc3f8('0x47')](handleError(_0x159b00,null));};exports[_0xc3f8('0x54')]=function(_0x3a268d,_0x1c7f08){return db['OpenchannelQueue'][_0xc3f8('0x54')]()['then'](respondWithResult(_0x1c7f08,null))[_0xc3f8('0x47')](handleError(_0x1c7f08,null));};exports[_0xc3f8('0x55')]=function(_0x163264,_0xd5d6a7,_0x5c6f6e){var _0x2c549e={'raw':!![],'where':{}},_0x591daf={},_0x53f694;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x163264[_0xc3f8('0x48')]['id']}})[_0xc3f8('0x2a')](handleEntityNotFound(_0xd5d6a7,null))[_0xc3f8('0x2a')](function(_0x287ee3){if(_0x287ee3){_0x53f694=_0x287ee3[_0xc3f8('0x27')]({'plain':!![]});_0x591daf[_0xc3f8('0x33')]=_[_0xc3f8('0x49')](db[_0xc3f8('0x56')]['rawAttributes']);_0x591daf[_0xc3f8('0x34')]=_[_0xc3f8('0x49')](_0x163264[_0xc3f8('0x34')]);_0x591daf[_0xc3f8('0x35')]=_[_0xc3f8('0x36')](_0x591daf['model'],_0x591daf[_0xc3f8('0x34')]);_0x2c549e[_0xc3f8('0x37')]=_[_0xc3f8('0x36')](_0x591daf[_0xc3f8('0x33')],qs[_0xc3f8('0x38')](_0x163264['query'][_0xc3f8('0x38')]));_0x2c549e[_0xc3f8('0x37')]=_0x2c549e[_0xc3f8('0x37')][_0xc3f8('0x39')]?_0x2c549e[_0xc3f8('0x37')]:_0x591daf[_0xc3f8('0x33')];if(!_0x163264['query'][_0xc3f8('0x57')](_0xc3f8('0x3a'))){_0x2c549e[_0xc3f8('0x3b')]=qs['limit'](_0x163264[_0xc3f8('0x34')][_0xc3f8('0x3b')]);_0x2c549e['offset']=qs['offset'](_0x163264[_0xc3f8('0x34')][_0xc3f8('0x20')]);}_0x2c549e['order']=qs[_0xc3f8('0x3d')](_0x163264[_0xc3f8('0x34')][_0xc3f8('0x3d')]);_0x2c549e[_0xc3f8('0x3e')]=qs[_0xc3f8('0x35')](_[_0xc3f8('0x3f')](_0x163264[_0xc3f8('0x34')],_0x591daf[_0xc3f8('0x35')]));_0x2c549e['where']['OpenchannelQueueId']=_0x287ee3['id'];if(_0x163264[_0xc3f8('0x34')]['filter']){_0x2c549e['where']=_['merge'](_0x2c549e['where'],{'$or':_['map'](_0x2c549e[_0xc3f8('0x37')],function(_0x652882){var _0x188d39={};_0x188d39[_0x652882]={'$like':'%'+_0x163264[_0xc3f8('0x34')]['filter']+'%'};return _0x188d39;})});}_0x2c549e=_[_0xc3f8('0x42')]({},_0x2c549e,_0x163264[_0xc3f8('0x43')]);return db['UserOpenchannelQueue'][_0xc3f8('0x46')](_0x2c549e);}})[_0xc3f8('0x2a')](function(_0x104eec){if(_0x104eec){return db['User'][_0xc3f8('0x58')]({'where':{'id':_['map'](_0x104eec,'UserId'),'role':'agent'},'attributes':['id',_0xc3f8('0x2c'),_0xc3f8('0x59'),'updatedAt',_0xc3f8('0x5a')]});}})[_0xc3f8('0x2a')](function(_0x56b9db){if(_0x56b9db){return{'count':_0x56b9db[_0xc3f8('0x1f')],'rows':_[_0xc3f8('0x2e')](_0x56b9db['rows'],function(_0x34edb9){return{'membername':_0x34edb9['name'],'UserId':_0x34edb9['id'],'queue_name':_0x53f694[_0xc3f8('0x2c')],'OpenchannelQueueId':_0x53f694['id'],'interface':util[_0xc3f8('0x5b')]('%s/%s','SIP',_0x34edb9[_0xc3f8('0x2c')]),'penalty':0x0,'paused':_0x34edb9[_0xc3f8('0x59')],'createdAt':_0x34edb9['createdAt'],'updatedAt':_0x34edb9[_0xc3f8('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xd5d6a7,_0x2c549e))[_0xc3f8('0x47')](handleError(_0xd5d6a7,null));};exports['getTeams']=function(_0x280e74,_0x19adb5,_0x2795d4){var _0x38d60b={};var _0x3042b3={};var _0xd3a26;var _0x36fa13;return db[_0xc3f8('0x2f')][_0xc3f8('0x5d')]({'where':{'id':_0x280e74['params']['id']}})[_0xc3f8('0x2a')](handleEntityNotFound(_0x19adb5,null))[_0xc3f8('0x2a')](function(_0x528520){if(_0x528520){_0xd3a26=_0x528520;_0x3042b3[_0xc3f8('0x33')]=_[_0xc3f8('0x49')](db['Team'][_0xc3f8('0x30')]);_0x3042b3[_0xc3f8('0x34')]=_[_0xc3f8('0x49')](_0x280e74[_0xc3f8('0x34')]);_0x3042b3[_0xc3f8('0x35')]=_['intersection'](_0x3042b3[_0xc3f8('0x33')],_0x3042b3[_0xc3f8('0x34')]);_0x38d60b[_0xc3f8('0x37')]=_['intersection'](_0x3042b3['model'],qs[_0xc3f8('0x38')](_0x280e74[_0xc3f8('0x34')][_0xc3f8('0x38')]));_0x38d60b[_0xc3f8('0x37')]=_0x38d60b['attributes'][_0xc3f8('0x39')]?_0x38d60b[_0xc3f8('0x37')]:_0x3042b3[_0xc3f8('0x33')];_0x38d60b['order']=qs[_0xc3f8('0x3d')](_0x280e74[_0xc3f8('0x34')]['sort']);_0x38d60b['where']=qs[_0xc3f8('0x35')](_[_0xc3f8('0x3f')](_0x280e74['query'],_0x3042b3[_0xc3f8('0x35')]));if(_0x280e74[_0xc3f8('0x34')]['filter']){_0x38d60b[_0xc3f8('0x3e')]=_['merge'](_0x38d60b[_0xc3f8('0x3e')],{'$or':_['map'](_0x38d60b[_0xc3f8('0x37')],function(_0x1e33d4){var _0x2fafd7={};_0x2fafd7[_0x1e33d4]={'$like':'%'+_0x280e74[_0xc3f8('0x34')][_0xc3f8('0x40')]+'%'};return _0x2fafd7;})});}_0x38d60b=_[_0xc3f8('0x42')]({},_0x38d60b,_0x280e74[_0xc3f8('0x43')]);return _0xd3a26[_0xc3f8('0x5e')](_0x38d60b);}})[_0xc3f8('0x2a')](function(_0x5d196f){if(_0x5d196f){_0x36fa13=_0x5d196f['length'];if(!_0x280e74[_0xc3f8('0x34')]['hasOwnProperty'](_0xc3f8('0x3a'))){_0x38d60b[_0xc3f8('0x3b')]=qs[_0xc3f8('0x3b')](_0x280e74[_0xc3f8('0x34')]['limit']);_0x38d60b[_0xc3f8('0x20')]=qs[_0xc3f8('0x20')](_0x280e74[_0xc3f8('0x34')][_0xc3f8('0x20')]);}return _0xd3a26[_0xc3f8('0x5e')](_0x38d60b);}})[_0xc3f8('0x2a')](function(_0x457c39){if(_0x457c39){return _0x457c39?{'count':_0x36fa13,'rows':_0x457c39}:null;}})[_0xc3f8('0x2a')](respondWithResult(_0x19adb5,null))[_0xc3f8('0x47')](handleError(_0x19adb5,null));};exports['addTeams']=function(_0x5134cf,_0x3d4f30,_0x230d14){var _0x1f2314=_0x5134cf['body'][_0xc3f8('0x5f')];return db['Team'][_0xc3f8('0x46')]({'where':{'id':_0x1f2314},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc3f8('0x60'),'attributes':['id',_0xc3f8('0x2c'),_0xc3f8('0x61'),_0xc3f8('0x62'),_0xc3f8('0x63')],'raw':!![]}]})[_0xc3f8('0x2a')](function(_0x334af6){if(_0x334af6){var _0x1d4830=_['flatMap'](_0x334af6,function(_0x3cd57d){var _0x209748=_0x3cd57d[_0xc3f8('0x27')]({'plain':!![]});return _0x209748[_0xc3f8('0x60')];});return db[_0xc3f8('0x2f')]['find']({'where':{'id':_0x5134cf[_0xc3f8('0x48')]['id']}})[_0xc3f8('0x2a')](function(_0x2576a6){return db[_0xc3f8('0x64')]['transaction'](function(_0x4f603f){return _0x2576a6[_0xc3f8('0x65')](_0x1f2314,{'transaction':_0x4f603f})[_0xc3f8('0x2a')](function(){return BPromise['each'](_0x1d4830,function(_0x4b07e8){return db['UserOpenchannelQueue'][_0xc3f8('0x66')]({'where':{'UserId':_0x4b07e8['id'],'OpenchannelQueueId':_0x5134cf['params']['id']},'transaction':_0x4f603f});});})[_0xc3f8('0x2a')](function(){_0x1d4830[_0xc3f8('0x67')](function(_0x19e469){socket[_0xc3f8('0x68')](_0xc3f8('0x69'),{'UserId':_0x19e469['id'],'OpenchannelQueueId':_0x2576a6['id']});});});});});}})[_0xc3f8('0x2a')](respondWithStatusCode(_0x3d4f30,null))[_0xc3f8('0x47')](handleError(_0x3d4f30,null));};exports['removeTeams']=function(_0x563b6d,_0x55185a,_0x4ea284){return db[_0xc3f8('0x6a')]['findAll']({'where':{'id':_0x563b6d[_0xc3f8('0x34')][_0xc3f8('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xc3f8('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc3f8('0x2a')](handleEntityNotFound(_0x55185a,null))[_0xc3f8('0x2a')](function(_0x59dcf8){var _0x145753=_[_0xc3f8('0x2e')](_0x59dcf8,'id');var _0x1faa05=[];var _0x501b02=[];var _0x3314fc=squel[_0xc3f8('0x6c')]();_0x3314fc[_0xc3f8('0x6d')]('tq.TeamId')[_0xc3f8('0x6e')](_0xc3f8('0x6f'),'tq')[_0xc3f8('0x70')](_0xc3f8('0x71'),'ut',_0xc3f8('0x72'))[_0xc3f8('0x3e')]('OpenchannelQueueId\x20=\x20?',_0x563b6d[_0xc3f8('0x48')]['id']);for(var _0x4fd13c=0x0;_0x4fd13c<_0x59dcf8['length'];_0x4fd13c+=0x1){let _0x32121d=_0x59dcf8[_0x4fd13c];for(var _0xe6f37d=0x0;_0xe6f37d<_0x32121d['Agents'][_0xc3f8('0x39')];_0xe6f37d+=0x1){let _0x455c0d=_0x32121d[_0xc3f8('0x60')][_0xe6f37d];var _0x50e01e=_0x3314fc['clone']();_0x50e01e[_0xc3f8('0x3e')]('ut.UserId\x20=\x20?',_0x455c0d['id']);_0x501b02[_0xc3f8('0x73')](db[_0xc3f8('0x64')][_0xc3f8('0x34')](_0x50e01e['toString'](),{'type':db[_0xc3f8('0x64')][_0xc3f8('0x74')][_0xc3f8('0x75')]})[_0xc3f8('0x2a')](function(_0x8a26cd){if(_0x8a26cd[_0xc3f8('0x39')]===0x1){return _0x455c0d['id'];}else{var _0x4ec8bc=_[_0xc3f8('0x76')](_[_0xc3f8('0x2e')](_0x8a26cd,_0xc3f8('0x77')),function(_0x159de0){return _[_0xc3f8('0x78')](_0x145753,_0x159de0);});if(_0x4ec8bc){return _0x455c0d['id'];}}}));}}return BPromise['all'](_0x501b02)[_0xc3f8('0x2a')](function(_0x3129aa){_0x1faa05=_(_0x1faa05)[_0xc3f8('0x79')](_0x3129aa)['compact']()[_0xc3f8('0x7a')]();return db[_0xc3f8('0x2f')][_0xc3f8('0x50')]({'where':{'id':_0x563b6d[_0xc3f8('0x48')]['id']}})[_0xc3f8('0x2a')](function(_0x5f24e1){return db[_0xc3f8('0x64')][_0xc3f8('0x7b')](function(_0x267ce5){return _0x5f24e1[_0xc3f8('0x7c')](_0x563b6d[_0xc3f8('0x34')][_0xc3f8('0x5f')],{'transaction':_0x267ce5})[_0xc3f8('0x2a')](function(){if(!_[_0xc3f8('0x7d')](_0x1faa05)){return _0x5f24e1[_0xc3f8('0x7e')](_0x1faa05,{'transaction':_0x267ce5});}})[_0xc3f8('0x2a')](function(){_0x1faa05[_0xc3f8('0x67')](function(_0x50a6e0){socket['emit'](_0xc3f8('0x7f'),{'UserId':_0x50a6e0,'OpenchannelQueueId':_0x5f24e1['id']});});});});});});})['then'](respondWithStatusCode(_0x55185a,null))['catch'](handleError(_0x55185a,null));};exports[_0xc3f8('0x80')]=function(_0x254bb0,_0x2a9ea3,_0x23cee1){return db['OpenchannelQueue'][_0xc3f8('0x50')]({'where':{'id':_0x254bb0[_0xc3f8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a9ea3,null))[_0xc3f8('0x2a')](function(_0x429be0){if(_0x429be0){return _0x429be0['addAgents'](_0x254bb0['body']['ids'],_[_0xc3f8('0x81')](_0x254bb0[_0xc3f8('0x4c')],[_0xc3f8('0x5f'),'id'])||{})[_0xc3f8('0x82')](function(_0x2733ea){for(var _0xefe62a=0x0;_0xefe62a<_0x254bb0[_0xc3f8('0x4c')][_0xc3f8('0x5f')][_0xc3f8('0x39')];_0xefe62a+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x254bb0[_0xc3f8('0x4c')][_0xc3f8('0x5f')][_0xefe62a],'OpenchannelQueueId':_0x254bb0[_0xc3f8('0x48')]['id']});}return _0x2733ea;});}})[_0xc3f8('0x2a')](respondWithResult(_0x2a9ea3,null))[_0xc3f8('0x47')](handleError(_0x2a9ea3,null));};exports[_0xc3f8('0x7e')]=function(_0x1b29e7,_0x3b0339,_0x34efa5){return db['OpenchannelQueue'][_0xc3f8('0x50')]({'where':{'id':_0x1b29e7['params']['id']}})['then'](handleEntityNotFound(_0x3b0339,null))[_0xc3f8('0x2a')](function(_0x1115ae){if(_0x1115ae){return _0x1115ae[_0xc3f8('0x7e')](_0x1b29e7[_0xc3f8('0x34')][_0xc3f8('0x5f')])[_0xc3f8('0x2a')](function(){if(_['isArray'](_0x1b29e7[_0xc3f8('0x34')][_0xc3f8('0x5f')])){for(var _0x19ab54=0x0;_0x19ab54<_0x1b29e7['query']['ids'][_0xc3f8('0x39')];_0x19ab54+=0x1){socket[_0xc3f8('0x68')]('userOpenchannelQueue:remove',{'UserId':Number(_0x1b29e7[_0xc3f8('0x34')][_0xc3f8('0x5f')][_0x19ab54]),'OpenchannelQueueId':Number(_0x1b29e7['params']['id'])});}}else{socket[_0xc3f8('0x68')](_0xc3f8('0x7f'),{'UserId':Number(_0x1b29e7[_0xc3f8('0x34')][_0xc3f8('0x5f')]),'OpenchannelQueueId':Number(_0x1b29e7[_0xc3f8('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3b0339,null))[_0xc3f8('0x47')](handleError(_0x3b0339,null));};exports['getAgents']=function(_0x3b01fa,_0x214894,_0x536fb7){var _0x37dc53={};var _0x4425f2={};var _0x1a17df;var _0x89f746;return db[_0xc3f8('0x2f')][_0xc3f8('0x5d')]({'where':{'id':_0x3b01fa[_0xc3f8('0x48')]['id']}})[_0xc3f8('0x2a')](handleEntityNotFound(_0x214894,null))[_0xc3f8('0x2a')](function(_0xa43d11){if(_0xa43d11){_0x1a17df=_0xa43d11;_0x4425f2[_0xc3f8('0x33')]=_[_0xc3f8('0x49')](db[_0xc3f8('0x6b')][_0xc3f8('0x30')]);_0x4425f2[_0xc3f8('0x34')]=_[_0xc3f8('0x49')](_0x3b01fa[_0xc3f8('0x34')]);_0x4425f2[_0xc3f8('0x35')]=_[_0xc3f8('0x36')](_0x4425f2['model'],_0x4425f2[_0xc3f8('0x34')]);_0x37dc53[_0xc3f8('0x37')]=_['intersection'](_0x4425f2[_0xc3f8('0x33')],qs['fields'](_0x3b01fa[_0xc3f8('0x34')]['fields']));_0x37dc53[_0xc3f8('0x37')]=_0x37dc53[_0xc3f8('0x37')][_0xc3f8('0x39')]?_0x37dc53['attributes']:_0x4425f2[_0xc3f8('0x33')];_0x37dc53[_0xc3f8('0x3c')]=qs[_0xc3f8('0x3d')](_0x3b01fa[_0xc3f8('0x34')][_0xc3f8('0x3d')]);_0x37dc53[_0xc3f8('0x3e')]=qs[_0xc3f8('0x35')](_['pick'](_0x3b01fa[_0xc3f8('0x34')],_0x4425f2[_0xc3f8('0x35')]));if(_0x3b01fa[_0xc3f8('0x34')][_0xc3f8('0x40')]){_0x37dc53[_0xc3f8('0x3e')]=_[_0xc3f8('0x42')](_0x37dc53[_0xc3f8('0x3e')],{'$or':_[_0xc3f8('0x2e')](_0x37dc53[_0xc3f8('0x37')],function(_0x2e649c){var _0x1cc82b={};_0x1cc82b[_0x2e649c]={'$like':'%'+_0x3b01fa[_0xc3f8('0x34')][_0xc3f8('0x40')]+'%'};return _0x1cc82b;})});}_0x37dc53=_[_0xc3f8('0x42')]({},_0x37dc53,_0x3b01fa['options']);return _0x1a17df[_0xc3f8('0x83')](_0x37dc53);}})['then'](function(_0x3648b5){if(_0x3648b5){_0x89f746=_0x3648b5['length'];if(!_0x3b01fa['query'][_0xc3f8('0x57')](_0xc3f8('0x3a'))){_0x37dc53[_0xc3f8('0x3b')]=qs['limit'](_0x3b01fa['query'][_0xc3f8('0x3b')]);_0x37dc53[_0xc3f8('0x20')]=qs[_0xc3f8('0x20')](_0x3b01fa[_0xc3f8('0x34')][_0xc3f8('0x20')]);}return _0x1a17df['getAgents'](_0x37dc53);}})[_0xc3f8('0x2a')](function(_0x1568f1){if(_0x1568f1){return _0x1568f1?{'count':_0x89f746,'rows':_0x1568f1}:null;}})[_0xc3f8('0x2a')](respondWithResult(_0x214894,null))['catch'](handleError(_0x214894,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0a4c72a..c585284 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 _0x005a=['hasOwnProperty','exports','events','OpenchannelQueue','setMaxListeners','update','remove','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x005a,0x17a));var _0xa005=function(_0x2a3ead,_0x12ea2b){_0x2a3ead=_0x2a3ead-0x0;var _0x13fe65=_0x005a[_0x2a3ead];return _0x13fe65;};'use strict';var EventEmitter=require(_0xa005('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xa005('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa005('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa005('0x3'),'afterDestroy':_0xa005('0x4')};function emitEvent(_0xd77893){return function(_0x4926eb,_0x2f9a7e,_0x3e74da){OpenchannelQueueEvents[_0xa005('0x5')](_0xd77893+':'+_0x4926eb['id'],_0x4926eb);OpenchannelQueueEvents[_0xa005('0x5')](_0xd77893,_0x4926eb);_0x3e74da(null);};}for(var e in events){if(events[_0xa005('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xa005('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x88c1=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','OpenchannelQueue'];(function(_0x6be24d,_0x36e70a){var _0x2eb6a5=function(_0x382402){while(--_0x382402){_0x6be24d['push'](_0x6be24d['shift']());}};_0x2eb6a5(++_0x36e70a);}(_0x88c1,0x127));var _0x188c=function(_0xa23cf3,_0x4a3b9c){_0xa23cf3=_0xa23cf3-0x0;var _0x538535=_0x88c1[_0xa23cf3];return _0x538535;};'use strict';var EventEmitter=require(_0x188c('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x188c('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x188c('0x2')](0x0);var events={'afterCreate':_0x188c('0x3'),'afterUpdate':_0x188c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51e2f4){return function(_0xd3f01b,_0x5e61c9,_0x4284f4){OpenchannelQueueEvents['emit'](_0x51e2f4+':'+_0xd3f01b['id'],_0xd3f01b);OpenchannelQueueEvents[_0x188c('0x5')](_0x51e2f4,_0xd3f01b);_0x4284f4(null);};}for(var e in events){if(events[_0x188c('0x6')](e)){var event=events[e];OpenchannelQueue[_0x188c('0x7')](e,emitEvent(event));}}module[_0x188c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 1abe4eb..daf6e03 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 _0xc900=['api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','../../config/logger'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0xc900,0xb3));var _0x0c90=function(_0x2532f1,_0x12d270){_0x2532f1=_0x2532f1-0x0;var _0x3eb8c9=_0xc900[_0x2532f1];return _0x3eb8c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c90('0x0'))(_0x0c90('0x1'));var moment=require(_0x0c90('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c90('0x3'));var fs=require('fs');var path=require(_0x0c90('0x4'));var rimraf=require('rimraf');var config=require(_0x0c90('0x5'));var attributes=require(_0x0c90('0x6'));module[_0x0c90('0x7')]=function(_0x718a5c,_0x42f9a3){return _0x718a5c[_0x0c90('0x8')]('OpenchannelQueue',attributes,{'tableName':_0x0c90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c90=['./openchannelQueue.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1c1db1,_0x4486f2){var _0x34bc65=function(_0xbfeeae){while(--_0xbfeeae){_0x1c1db1['push'](_0x1c1db1['shift']());}};_0x34bc65(++_0x4486f2);}(_0x3c90,0xfd));var _0x03c9=function(_0x540f97,_0x5e75cb){_0x540f97=_0x540f97-0x0;var _0x3e2ba3=_0x3c90[_0x540f97];return _0x3e2ba3;};'use strict';var _=require('lodash');var util=require(_0x03c9('0x0'));var logger=require(_0x03c9('0x1'))(_0x03c9('0x2'));var moment=require(_0x03c9('0x3'));var BPromise=require(_0x03c9('0x4'));var rp=require(_0x03c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03c9('0x6'));var config=require('../../config/environment');var attributes=require(_0x03c9('0x7'));module[_0x03c9('0x8')]=function(_0x280b7c,_0x8b4527){return _0x280b7c[_0x03c9('0x9')]('OpenchannelQueue',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 e8f5394..dc9a8c5 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 _0xb538=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','info','result','OpenchannelQueue','findAll','options','raw','where','attributes','include','model','map','GetOpenchannelQueue','catch','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb538,0x180));var _0x8b53=function(_0x4e82eb,_0x5c08bb){_0x4e82eb=_0x4e82eb-0x0;var _0x59baad=_0xb538[_0x4e82eb];return _0x59baad;};'use strict';var _=require(_0x8b53('0x0'));var util=require(_0x8b53('0x1'));var moment=require(_0x8b53('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b53('0x4'))['db'];var utils=require(_0x8b53('0x5'));var logger=require(_0x8b53('0x6'))(_0x8b53('0x7'));var config=require(_0x8b53('0x8'));var jayson=require(_0x8b53('0x9'));var client=jayson[_0x8b53('0xa')][_0x8b53('0xb')]({'port':0x232a});config[_0x8b53('0xc')]=_['defaults'](config[_0x8b53('0xc')],{'host':_0x8b53('0xd'),'port':0x18eb});var socket=require(_0x8b53('0xe'))(new Redis(config[_0x8b53('0xc')]));require(_0x8b53('0xf'))['register'](socket);function respondWithRpcPromise(_0x5c5732,_0x2e712c,_0x36814f){return new BPromise(function(_0x3bf47d,_0x5ebf7c){return client['request'](_0x5c5732,_0x36814f)[_0x8b53('0x10')](function(_0x24dbb6){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2e712c,_0x8b53('0x11'));logger[_0x8b53('0x12')](_0x8b53('0x13'),_0x2e712c,_0x8b53('0x11'),JSON[_0x8b53('0x14')](_0x24dbb6));if(_0x24dbb6[_0x8b53('0x15')]){if(_0x24dbb6['error'][_0x8b53('0x16')]===0x1f4){logger[_0x8b53('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x2e712c,_0x24dbb6[_0x8b53('0x15')]['message']);return _0x5ebf7c(_0x24dbb6[_0x8b53('0x15')][_0x8b53('0x17')]);}logger[_0x8b53('0x15')](_0x8b53('0x18'),_0x2e712c,_0x24dbb6['error'][_0x8b53('0x17')]);return _0x3bf47d(_0x24dbb6[_0x8b53('0x15')][_0x8b53('0x17')]);}else{logger[_0x8b53('0x19')](_0x8b53('0x18'),_0x2e712c,_0x8b53('0x11'));_0x3bf47d(_0x24dbb6[_0x8b53('0x1a')][_0x8b53('0x17')]);}})['catch'](function(_0x523c45){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x2e712c,_0x523c45);_0x5ebf7c(_0x523c45);});});}exports['GetOpenchannelQueue']=function(_0x534ba3){var _0x5f015a=this;return new Promise(function(_0x2719ad,_0x239369){return db[_0x8b53('0x1b')][_0x8b53('0x1c')]({'raw':_0x534ba3[_0x8b53('0x1d')]?_0x534ba3[_0x8b53('0x1d')][_0x8b53('0x1e')]===undefined?!![]:![]:!![],'where':_0x534ba3[_0x8b53('0x1d')]?_0x534ba3[_0x8b53('0x1d')][_0x8b53('0x1f')]||null:null,'attributes':_0x534ba3[_0x8b53('0x1d')]?_0x534ba3[_0x8b53('0x1d')][_0x8b53('0x20')]||null:null,'limit':_0x534ba3[_0x8b53('0x1d')]?_0x534ba3[_0x8b53('0x1d')]['limit']||null:null,'include':_0x534ba3[_0x8b53('0x1d')]?_0x534ba3['options'][_0x8b53('0x21')]?_['map'](_0x534ba3[_0x8b53('0x1d')][_0x8b53('0x21')],function(_0x156b48){return{'model':db[_0x156b48[_0x8b53('0x22')]],'as':_0x156b48['as'],'attributes':_0x156b48[_0x8b53('0x20')],'include':_0x156b48[_0x8b53('0x21')]?_[_0x8b53('0x23')](_0x156b48[_0x8b53('0x21')],function(_0x5478f5){return{'model':db[_0x5478f5['model']],'as':_0x5478f5['as'],'attributes':_0x5478f5['attributes'],'include':_0x5478f5[_0x8b53('0x21')]?_[_0x8b53('0x23')](_0x5478f5[_0x8b53('0x21')],function(_0x33cc45){return{'model':db[_0x33cc45[_0x8b53('0x22')]],'as':_0x33cc45['as'],'attributes':_0x33cc45[_0x8b53('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8b53('0x10')](function(_0x3c7f85){logger[_0x8b53('0x19')](_0x8b53('0x24'),_0x534ba3);logger[_0x8b53('0x12')](_0x8b53('0x24'),_0x534ba3,JSON[_0x8b53('0x14')](_0x3c7f85));_0x2719ad(_0x3c7f85);})[_0x8b53('0x25')](function(_0x2d877d){logger[_0x8b53('0x15')](_0x8b53('0x24'),_0x2d877d[_0x8b53('0x17')],_0x534ba3);_0x239369(_0x5f015a[_0x8b53('0x15')](0x1f4,_0x2d877d[_0x8b53('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0x3bab05){var _0x4716d2=this;return new Promise(function(_0x1b543a,_0x287748){return db[_0x8b53('0x1b')]['find']({'raw':_0x3bab05['options']?_0x3bab05[_0x8b53('0x1d')][_0x8b53('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bab05[_0x8b53('0x1d')]?_0x3bab05['options'][_0x8b53('0x1f')]||null:null,'attributes':_0x3bab05[_0x8b53('0x1d')]?_0x3bab05[_0x8b53('0x1d')][_0x8b53('0x20')]||null:null,'include':_0x3bab05['options']?_0x3bab05[_0x8b53('0x1d')][_0x8b53('0x21')]?_[_0x8b53('0x23')](_0x3bab05[_0x8b53('0x1d')][_0x8b53('0x21')],function(_0x3a2552){return{'model':db[_0x3a2552[_0x8b53('0x22')]],'as':_0x3a2552['as'],'attributes':_0x3a2552[_0x8b53('0x20')],'include':_0x3a2552['include']?_['map'](_0x3a2552[_0x8b53('0x21')],function(_0x696269){return{'model':db[_0x696269[_0x8b53('0x22')]],'as':_0x696269['as'],'attributes':_0x696269[_0x8b53('0x20')],'include':_0x696269['include']?_[_0x8b53('0x23')](_0x696269[_0x8b53('0x21')],function(_0x5369b8){return{'model':db[_0x5369b8[_0x8b53('0x22')]],'as':_0x5369b8['as'],'attributes':_0x5369b8[_0x8b53('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x341e8a){logger[_0x8b53('0x19')](_0x8b53('0x26'),_0x3bab05);logger[_0x8b53('0x12')]('ShowOpenchannelQueue',_0x3bab05,JSON[_0x8b53('0x14')](_0x341e8a));_0x1b543a(_0x341e8a);})[_0x8b53('0x25')](function(_0x215f75){logger[_0x8b53('0x15')](_0x8b53('0x26'),_0x215f75['message'],_0x3bab05);_0x287748(_0x4716d2[_0x8b53('0x15')](0x1f4,_0x215f75['message']));});});}; \ No newline at end of file +var _0x429f=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','request','then','info'];(function(_0x13a3eb,_0xaadb32){var _0x2e812a=function(_0x7d4565){while(--_0x7d4565){_0x13a3eb['push'](_0x13a3eb['shift']());}};_0x2e812a(++_0xaadb32);}(_0x429f,0x13d));var _0xf429=function(_0x58675f,_0x390355){_0x58675f=_0x58675f-0x0;var _0x1cc7f0=_0x429f[_0x58675f];return _0x1cc7f0;};'use strict';var _=require(_0xf429('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf429('0x1'));var fs=require('fs');var Redis=require(_0xf429('0x2'));var db=require(_0xf429('0x3'))['db'];var utils=require(_0xf429('0x4'));var logger=require(_0xf429('0x5'))(_0xf429('0x6'));var config=require('../../config/environment');var jayson=require(_0xf429('0x7'));var client=jayson['client'][_0xf429('0x8')]({'port':0x232a});config[_0xf429('0x9')]=_['defaults'](config[_0xf429('0x9')],{'host':_0xf429('0xa'),'port':0x18eb});var socket=require(_0xf429('0xb'))(new Redis(config[_0xf429('0x9')]));require('./openchannelQueue.socket')[_0xf429('0xc')](socket);function respondWithRpcPromise(_0x262d14,_0x271cb9,_0x49742e){return new BPromise(function(_0x161789,_0x10424c){return client[_0xf429('0xd')](_0x262d14,_0x49742e)[_0xf429('0xe')](function(_0x480f35){logger[_0xf429('0xf')](_0xf429('0x10'),_0x271cb9,_0xf429('0x11'));logger[_0xf429('0x12')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x271cb9,_0xf429('0x11'),JSON[_0xf429('0x13')](_0x480f35));if(_0x480f35[_0xf429('0x14')]){if(_0x480f35[_0xf429('0x14')][_0xf429('0x15')]===0x1f4){logger[_0xf429('0x14')](_0xf429('0x10'),_0x271cb9,_0x480f35[_0xf429('0x14')][_0xf429('0x16')]);return _0x10424c(_0x480f35[_0xf429('0x14')][_0xf429('0x16')]);}logger['error'](_0xf429('0x10'),_0x271cb9,_0x480f35[_0xf429('0x14')][_0xf429('0x16')]);return _0x161789(_0x480f35[_0xf429('0x14')]['message']);}else{logger[_0xf429('0xf')](_0xf429('0x10'),_0x271cb9,_0xf429('0x11'));_0x161789(_0x480f35['result']['message']);}})[_0xf429('0x17')](function(_0x5e58c3){logger[_0xf429('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x271cb9,_0x5e58c3);_0x10424c(_0x5e58c3);});});}exports['GetOpenchannelQueue']=function(_0x2e96c3){var _0x43fd74=this;return new Promise(function(_0x41c18a,_0x1a849b){return db[_0xf429('0x18')][_0xf429('0x19')]({'raw':_0x2e96c3['options']?_0x2e96c3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e96c3['options']?_0x2e96c3[_0xf429('0x1a')][_0xf429('0x1b')]||null:null,'attributes':_0x2e96c3[_0xf429('0x1a')]?_0x2e96c3['options'][_0xf429('0x1c')]||null:null,'limit':_0x2e96c3[_0xf429('0x1a')]?_0x2e96c3[_0xf429('0x1a')][_0xf429('0x1d')]||null:null,'include':_0x2e96c3['options']?_0x2e96c3[_0xf429('0x1a')][_0xf429('0x1e')]?_[_0xf429('0x1f')](_0x2e96c3[_0xf429('0x1a')][_0xf429('0x1e')],function(_0x18d372){return{'model':db[_0x18d372['model']],'as':_0x18d372['as'],'attributes':_0x18d372['attributes'],'include':_0x18d372[_0xf429('0x1e')]?_[_0xf429('0x1f')](_0x18d372['include'],function(_0x175c6d){return{'model':db[_0x175c6d[_0xf429('0x20')]],'as':_0x175c6d['as'],'attributes':_0x175c6d['attributes'],'include':_0x175c6d['include']?_['map'](_0x175c6d[_0xf429('0x1e')],function(_0x2be49b){return{'model':db[_0x2be49b['model']],'as':_0x2be49b['as'],'attributes':_0x2be49b[_0xf429('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fab56){logger[_0xf429('0xf')](_0xf429('0x21'),_0x2e96c3);logger[_0xf429('0x12')](_0xf429('0x21'),_0x2e96c3,JSON[_0xf429('0x13')](_0x3fab56));_0x41c18a(_0x3fab56);})[_0xf429('0x17')](function(_0x4c4ced){logger[_0xf429('0x14')](_0xf429('0x21'),_0x4c4ced['message'],_0x2e96c3);_0x1a849b(_0x43fd74['error'](0x1f4,_0x4c4ced[_0xf429('0x16')]));});});};exports[_0xf429('0x22')]=function(_0x50f18b){var _0x1b9c7a=this;return new Promise(function(_0xab15b0,_0x22f64d){return db[_0xf429('0x18')][_0xf429('0x23')]({'raw':_0x50f18b[_0xf429('0x1a')]?_0x50f18b[_0xf429('0x1a')][_0xf429('0x24')]===undefined?!![]:![]:!![],'where':_0x50f18b[_0xf429('0x1a')]?_0x50f18b['options']['where']||null:null,'attributes':_0x50f18b[_0xf429('0x1a')]?_0x50f18b[_0xf429('0x1a')][_0xf429('0x1c')]||null:null,'include':_0x50f18b['options']?_0x50f18b[_0xf429('0x1a')][_0xf429('0x1e')]?_[_0xf429('0x1f')](_0x50f18b[_0xf429('0x1a')][_0xf429('0x1e')],function(_0x54ec8b){return{'model':db[_0x54ec8b[_0xf429('0x20')]],'as':_0x54ec8b['as'],'attributes':_0x54ec8b[_0xf429('0x1c')],'include':_0x54ec8b[_0xf429('0x1e')]?_[_0xf429('0x1f')](_0x54ec8b[_0xf429('0x1e')],function(_0x2eec43){return{'model':db[_0x2eec43[_0xf429('0x20')]],'as':_0x2eec43['as'],'attributes':_0x2eec43['attributes'],'include':_0x2eec43[_0xf429('0x1e')]?_[_0xf429('0x1f')](_0x2eec43[_0xf429('0x1e')],function(_0x2ee24a){return{'model':db[_0x2ee24a['model']],'as':_0x2ee24a['as'],'attributes':_0x2ee24a[_0xf429('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35b3c7){logger['info'](_0xf429('0x22'),_0x50f18b);logger[_0xf429('0x12')](_0xf429('0x22'),_0x50f18b,JSON[_0xf429('0x13')](_0x35b3c7));_0xab15b0(_0x35b3c7);})[_0xf429('0x17')](function(_0x102ad6){logger[_0xf429('0x14')](_0xf429('0x22'),_0x102ad6['message'],_0x50f18b);_0x22f64d(_0x1b9c7a[_0xf429('0x14')](0x1f4,_0x102ad6[_0xf429('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 217fa92..9dc6929 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 _0xf198=['./openchannelQueue.events','removeListener','register'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xf198,0xc0));var _0x8f19=function(_0x9d72dd,_0x1b6a67){_0x9d72dd=_0x9d72dd-0x0;var _0x192933=_0xf198[_0x9d72dd];return _0x192933;};'use strict';var OpenchannelQueueEvents=require(_0x8f19('0x0'));var events=['save','remove','update'];function createListener(_0x4b0177,_0x3c5acc){return function(_0x1662fe){_0x3c5acc['emit'](_0x4b0177,_0x1662fe);};}function removeListener(_0x598f86,_0x31b9bd){return function(){OpenchannelQueueEvents[_0x8f19('0x1')](_0x598f86,_0x31b9bd);};}exports[_0x8f19('0x2')]=function(_0x238cbb){for(var _0x4e5d7a=0x0,_0x2fdbb6=events['length'];_0x4e5d7a<_0x2fdbb6;_0x4e5d7a++){var _0x2c1053=events[_0x4e5d7a];var _0x2728f9=createListener('openchannelQueue:'+_0x2c1053,_0x238cbb);OpenchannelQueueEvents['on'](_0x2c1053,_0x2728f9);}}; \ No newline at end of file +var _0xff4a=['remove','update','emit','length','openchannelQueue:','./openchannelQueue.events','save'];(function(_0x279c80,_0x3c9692){var _0x4e1f5c=function(_0xe42af3){while(--_0xe42af3){_0x279c80['push'](_0x279c80['shift']());}};_0x4e1f5c(++_0x3c9692);}(_0xff4a,0xde));var _0xaff4=function(_0x4f66d8,_0x196715){_0x4f66d8=_0x4f66d8-0x0;var _0x272498=_0xff4a[_0x4f66d8];return _0x272498;};'use strict';var OpenchannelQueueEvents=require(_0xaff4('0x0'));var events=[_0xaff4('0x1'),_0xaff4('0x2'),_0xaff4('0x3')];function createListener(_0x47c2c1,_0x3c985d){return function(_0x16404a){_0x3c985d[_0xaff4('0x4')](_0x47c2c1,_0x16404a);};}function removeListener(_0xfae161,_0x93ad27){return function(){OpenchannelQueueEvents['removeListener'](_0xfae161,_0x93ad27);};}exports['register']=function(_0x1c5f75){for(var _0x386067=0x0,_0x3000d0=events[_0xaff4('0x5')];_0x386067<_0x3000d0;_0x386067++){var _0x130b82=events[_0x386067];var _0x565fa5=createListener(_0xaff4('0x6')+_0x130b82,_0x1c5f75);OpenchannelQueueEvents['on'](_0x130b82,_0x565fa5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index c03c49a..ea121c1 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 _0x81d0=['isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe'];(function(_0x144d5b,_0xc6249f){var _0xccdcf4=function(_0x39ba75){while(--_0x39ba75){_0x144d5b['push'](_0x144d5b['shift']());}};_0xccdcf4(++_0xc6249f);}(_0x81d0,0x8e));var _0x081d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81d0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x081d('0x0'));var timeout=require(_0x081d('0x1'));var express=require(_0x081d('0x2'));var router=express['Router']();var auth=require(_0x081d('0x3'));var interaction=require(_0x081d('0x4'));var config=require(_0x081d('0x5'));var controller=require(_0x081d('0x6'));router[_0x081d('0x7')]('/',auth['isAuthenticated'](),controller[_0x081d('0x8')]);router[_0x081d('0x7')](_0x081d('0x9'),auth[_0x081d('0xa')](),controller['describe']);router[_0x081d('0x7')](_0x081d('0xb'),auth[_0x081d('0xa')](),controller['show']);router[_0x081d('0xc')]('/',auth[_0x081d('0xa')](),controller[_0x081d('0xd')]);router[_0x081d('0xe')](_0x081d('0xb'),auth[_0x081d('0xa')](),controller[_0x081d('0xf')]);router[_0x081d('0x10')](_0x081d('0xb'),auth['isAuthenticated'](),controller[_0x081d('0x11')]);module[_0x081d('0x12')]=router; \ No newline at end of file +var _0x64bb=['/describe','describe','isAuthenticated','show','post','create','put','update','delete','exports','multer','path','express','Router','./openchannelQueueReport.controller','get','index'];(function(_0x4c78b7,_0xa81a2){var _0x2a0f99=function(_0x3f57ee){while(--_0x3f57ee){_0x4c78b7['push'](_0x4c78b7['shift']());}};_0x2a0f99(++_0xa81a2);}(_0x64bb,0xe7));var _0xb64b=function(_0x127a55,_0x5d23ca){_0x127a55=_0x127a55-0x0;var _0x1b77b3=_0x64bb[_0x127a55];return _0x1b77b3;};'use strict';var multer=require(_0xb64b('0x0'));var util=require('util');var path=require(_0xb64b('0x1'));var timeout=require('connect-timeout');var express=require(_0xb64b('0x2'));var router=express[_0xb64b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb64b('0x4'));router[_0xb64b('0x5')]('/',auth['isAuthenticated'](),controller[_0xb64b('0x6')]);router[_0xb64b('0x5')](_0xb64b('0x7'),auth['isAuthenticated'](),controller[_0xb64b('0x8')]);router[_0xb64b('0x5')]('/:id',auth[_0xb64b('0x9')](),controller[_0xb64b('0xa')]);router[_0xb64b('0xb')]('/',auth[_0xb64b('0x9')](),controller[_0xb64b('0xc')]);router[_0xb64b('0xd')]('/:id',auth[_0xb64b('0x9')](),controller[_0xb64b('0xe')]);router[_0xb64b('0xf')]('/:id',auth[_0xb64b('0x9')](),controller['destroy']);module[_0xb64b('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index aa6d4e1..974b470 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 _0x9069=['sequelize','STRING','DATE','moment'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x9069,0xb3));var _0x9906=function(_0x28e4ea,_0x4856fd){_0x28e4ea=_0x28e4ea-0x0;var _0x545c63=_0x9069[_0x28e4ea];return _0x545c63;};'use strict';var moment=require(_0x9906('0x0'));var Sequelize=require(_0x9906('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x9906('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9906('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9906('0x2')]}}; \ No newline at end of file +var _0xb650=['exports','STRING','DATE','moment','sequelize'];(function(_0x5478c7,_0x478075){var _0x5bb6d3=function(_0x50a9dc){while(--_0x50a9dc){_0x5478c7['push'](_0x5478c7['shift']());}};_0x5bb6d3(++_0x478075);}(_0xb650,0x6c));var _0x0b65=function(_0x1557fd,_0x291f6e){_0x1557fd=_0x1557fd-0x0;var _0x41ce5d=_0xb650[_0x1557fd];return _0x41ce5d;};'use strict';var moment=require(_0x0b65('0x0'));var Sequelize=require(_0x0b65('0x1'));module[_0x0b65('0x2')]={'uniqueid':{'type':Sequelize[_0x0b65('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0b65('0x3')]},'joinAt':{'type':Sequelize[_0x0b65('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0b65('0x4')]},'reason':{'type':Sequelize[_0x0b65('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 026e699..1459bbb 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 _0xadb5=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','OpenchannelQueueReport','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','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','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','fieldName','type','key','model','query','keys'];(function(_0x22c393,_0x1f2389){var _0x161580=function(_0x3bd765){while(--_0x3bd765){_0x22c393['push'](_0x22c393['shift']());}};_0x161580(++_0x1f2389);}(_0xadb5,0xad));var _0x5adb=function(_0xc41493,_0x57241a){_0xc41493=_0xc41493-0x0;var _0x145f4b=_0xadb5[_0xc41493];return _0x145f4b;};'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 licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=_0x42a482[_0x5adb('0x1b')],_0x304784=_0x367d82[_0x5adb('0x1c')],_0x1c0f97=_0x367d82[_0x5adb('0x1c')]+_0x367d82['limit'],_0x39d24d;if(_0x1c0f97>=_0x30614e){_0x1c0f97=_0x30614e;_0x39d24d=0xc8;}else{_0x39d24d=0xce;}_0x518823[_0x5adb('0x19')](_0x39d24d);return _0x518823['set'](_0x5adb('0x1d'),_0x304784+'-'+_0x1c0f97+'/'+_0x30614e)['json'](_0x42a482);}return null;};}function patchUpdates(_0x3ef465){return function(_0x50e84f){try{jsonpatch['apply'](_0x50e84f,_0x3ef465,!![]);}catch(_0x1fbaa5){return BPromise[_0x5adb('0x1e')](_0x1fbaa5);}return _0x50e84f[_0x5adb('0x1f')]();};}function saveUpdates(_0x1fd4a7,_0x99bc6c){return function(_0x5af69d){if(_0x5af69d){return _0x5af69d[_0x5adb('0x20')](_0x1fd4a7)['then'](function(_0x4e9f16){return _0x4e9f16;});}return null;};}function removeEntity(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')]()[_0x5adb('0x22')](function(){_0x3754cc[_0x5adb('0x19')](0xcc)[_0x5adb('0x23')]();});}};}function handleEntityNotFound(_0x4ca150,_0x4b1957){return function(_0x373cc3){if(!_0x373cc3){_0x4ca150[_0x5adb('0x18')](0x194);}return _0x373cc3;};}function handleError(_0x3839fb,_0xeb556c){_0xeb556c=_0xeb556c||0x1f4;return function(_0x49f203){logger[_0x5adb('0x24')](_0x49f203[_0x5adb('0x25')]);if(_0x49f203['name']){delete _0x49f203[_0x5adb('0x26')];}_0x3839fb[_0x5adb('0x19')](_0xeb556c)[_0x5adb('0x27')](_0x49f203);};}exports['index']=function(_0x13ad1d,_0xbe21b1){var _0x3a4fca={},_0x2c64a3={},_0x36459b={'count':0x0,'rows':[]};var _0x1c06c4=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x39bddd){return{'name':_0x39bddd[_0x5adb('0x28')],'type':_0x39bddd[_0x5adb('0x29')][_0x5adb('0x2a')]};});_0x2c64a3[_0x5adb('0x2b')]=_['map'](_0x1c06c4,_0x5adb('0x26'));_0x2c64a3[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](_0x13ad1d[_0x5adb('0x2c')]);_0x2c64a3[_0x5adb('0x2e')]=_[_0x5adb('0x2f')](_0x2c64a3[_0x5adb('0x2b')],_0x2c64a3[_0x5adb('0x2c')]);_0x3a4fca[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x2c64a3['model'],qs[_0x5adb('0x31')](_0x13ad1d['query'][_0x5adb('0x31')]));_0x3a4fca[_0x5adb('0x30')]=_0x3a4fca['attributes'][_0x5adb('0x32')]?_0x3a4fca[_0x5adb('0x30')]:_0x2c64a3[_0x5adb('0x2b')];if(!_0x13ad1d['query'][_0x5adb('0x33')](_0x5adb('0x34'))){_0x3a4fca['limit']=qs['limit'](_0x13ad1d[_0x5adb('0x2c')]['limit']);_0x3a4fca[_0x5adb('0x1c')]=qs[_0x5adb('0x1c')](_0x13ad1d[_0x5adb('0x2c')][_0x5adb('0x1c')]);}_0x3a4fca[_0x5adb('0x35')]=qs['sort'](_0x13ad1d[_0x5adb('0x2c')][_0x5adb('0x36')]);_0x3a4fca[_0x5adb('0x37')]=qs['filters'](_['pick'](_0x13ad1d[_0x5adb('0x2c')],_0x2c64a3[_0x5adb('0x2e')]),_0x1c06c4);if(_0x13ad1d['query'][_0x5adb('0x38')]){_0x3a4fca['where']=_[_0x5adb('0x39')](_0x3a4fca['where'],{'$or':_[_0x5adb('0x3a')](_0x1c06c4,function(_0x4d052f){if(_0x4d052f[_0x5adb('0x29')]!==_0x5adb('0x3b')){var _0x4ccb27={};_0x4ccb27[_0x4d052f[_0x5adb('0x26')]]={'$like':'%'+_0x13ad1d['query'][_0x5adb('0x38')]+'%'};return _0x4ccb27;}})});}_0x3a4fca=_[_0x5adb('0x39')]({},_0x3a4fca,_0x13ad1d[_0x5adb('0x3c')]);var _0x50edd1={'where':_0x3a4fca[_0x5adb('0x37')]};return db[_0x5adb('0x3d')][_0x5adb('0x1b')](_0x50edd1)[_0x5adb('0x22')](function(_0x22aa95){_0x36459b['count']=_0x22aa95;if(_0x13ad1d['query']['includeAll']){_0x3a4fca['include']=[{'all':!![]}];}return db[_0x5adb('0x3d')][_0x5adb('0x3e')](_0x3a4fca);})[_0x5adb('0x22')](function(_0x399489){_0x36459b[_0x5adb('0x3f')]=_0x399489;return _0x36459b;})[_0x5adb('0x22')](respondWithFilteredResult(_0xbe21b1,_0x3a4fca))[_0x5adb('0x40')](handleError(_0xbe21b1,null));};exports[_0x5adb('0x41')]=function(_0x478a70,_0x53f2c6){var _0x27dbb7={'raw':!![],'where':{'id':_0x478a70[_0x5adb('0x42')]['id']}},_0x48eb26={};_0x48eb26[_0x5adb('0x2b')]=_[_0x5adb('0x2d')](db[_0x5adb('0x3d')][_0x5adb('0x43')]);_0x48eb26['query']=_[_0x5adb('0x2d')](_0x478a70[_0x5adb('0x2c')]);_0x48eb26['filtears']=_[_0x5adb('0x2f')](_0x48eb26[_0x5adb('0x2b')],_0x48eb26['query']);_0x27dbb7[_0x5adb('0x30')]=_[_0x5adb('0x2f')](_0x48eb26[_0x5adb('0x2b')],qs[_0x5adb('0x31')](_0x478a70[_0x5adb('0x2c')][_0x5adb('0x31')]));_0x27dbb7[_0x5adb('0x30')]=_0x27dbb7['attributes']['length']?_0x27dbb7[_0x5adb('0x30')]:_0x48eb26[_0x5adb('0x2b')];if(_0x478a70[_0x5adb('0x2c')][_0x5adb('0x44')]){_0x27dbb7['include']=[{'all':!![]}];}_0x27dbb7=_['merge']({},_0x27dbb7,_0x478a70[_0x5adb('0x3c')]);return db[_0x5adb('0x3d')][_0x5adb('0x45')](_0x27dbb7)[_0x5adb('0x22')](handleEntityNotFound(_0x53f2c6,null))[_0x5adb('0x22')](respondWithResult(_0x53f2c6,null))['catch'](handleError(_0x53f2c6,null));};exports[_0x5adb('0x46')]=function(_0x437f52,_0x5b574c){return db[_0x5adb('0x3d')][_0x5adb('0x46')](_0x437f52[_0x5adb('0x47')],{})[_0x5adb('0x22')](respondWithResult(_0x5b574c,0xc9))[_0x5adb('0x40')](handleError(_0x5b574c,null));};exports[_0x5adb('0x20')]=function(_0x39840e,_0x54252){if(_0x39840e['body']['id']){delete _0x39840e[_0x5adb('0x47')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x39840e['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x54252,null))[_0x5adb('0x22')](saveUpdates(_0x39840e[_0x5adb('0x47')],null))['then'](respondWithResult(_0x54252,null))[_0x5adb('0x40')](handleError(_0x54252,null));};exports['destroy']=function(_0x177a81,_0x2c3f21){return db[_0x5adb('0x3d')]['find']({'where':{'id':_0x177a81[_0x5adb('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c3f21,null))[_0x5adb('0x22')](removeEntity(_0x2c3f21,null))[_0x5adb('0x40')](handleError(_0x2c3f21,null));};exports['describe']=function(_0x2402a3,_0x1ab97b){return db[_0x5adb('0x3d')][_0x5adb('0x48')]()[_0x5adb('0x22')](respondWithResult(_0x1ab97b,null))['catch'](handleError(_0x1ab97b,null));}; \ No newline at end of file +var _0x7a54=['mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird'];(function(_0x4d9ce1,_0x527c06){var _0x5578aa=function(_0xd8a750){while(--_0xd8a750){_0x4d9ce1['push'](_0x4d9ce1['shift']());}};_0x5578aa(++_0x527c06);}(_0x7a54,0x106));var _0x47a5=function(_0x40401d,_0xa9ba90){_0x40401d=_0x40401d-0x0;var _0x2d101a=_0x7a54[_0x40401d];return _0x2d101a;};'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 licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=_0x11faf5['count'],_0x2a2cbb=_0x362359[_0x47a5('0x1a')],_0x1ef44c=_0x362359['offset']+_0x362359['limit'],_0x574af6;if(_0x1ef44c>=_0x3b001e){_0x1ef44c=_0x3b001e;_0x574af6=0xc8;}else{_0x574af6=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x574af6);return _0x4e99a8[_0x47a5('0x1b')](_0x47a5('0x1c'),_0x2a2cbb+'-'+_0x1ef44c+'/'+_0x3b001e)[_0x47a5('0x19')](_0x11faf5);}return null;};}function patchUpdates(_0x477b1d){return function(_0x12b98e){try{jsonpatch[_0x47a5('0x1d')](_0x12b98e,_0x477b1d,!![]);}catch(_0xe3c618){return BPromise[_0x47a5('0x1e')](_0xe3c618);}return _0x12b98e['save']();};}function saveUpdates(_0x1570bc,_0xf160ba){return function(_0x47cf3c){if(_0x47cf3c){return _0x47cf3c[_0x47a5('0x1f')](_0x1570bc)[_0x47a5('0x20')](function(_0x36874d){return _0x36874d;});}return null;};}function removeEntity(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x21')]()[_0x47a5('0x20')](function(){_0x4c5910['status'](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x385687,_0x513981){return function(_0x28747d){if(!_0x28747d){_0x385687[_0x47a5('0x16')](0x194);}return _0x28747d;};}function handleError(_0x4437f1,_0x129ce5){_0x129ce5=_0x129ce5||0x1f4;return function(_0x3abd6a){logger['error'](_0x3abd6a['stack']);if(_0x3abd6a[_0x47a5('0x22')]){delete _0x3abd6a['name'];}_0x4437f1[_0x47a5('0x17')](_0x129ce5)['send'](_0x3abd6a);};}exports[_0x47a5('0x23')]=function(_0x378208,_0x36ad34){var _0x1dac65={},_0x21f296={},_0x3ba0b7={'count':0x0,'rows':[]};var _0x24b162=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x1127f8){return{'name':_0x1127f8[_0x47a5('0x27')],'type':_0x1127f8[_0x47a5('0x28')]['key']};});_0x21f296[_0x47a5('0x29')]=_['map'](_0x24b162,_0x47a5('0x22'));_0x21f296[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x378208['query']);_0x21f296[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x21f296[_0x47a5('0x29')],_0x21f296[_0x47a5('0x2a')]);_0x1dac65['attributes']=_['intersection'](_0x21f296[_0x47a5('0x29')],qs[_0x47a5('0x2e')](_0x378208['query']['fields']));_0x1dac65[_0x47a5('0x2f')]=_0x1dac65[_0x47a5('0x2f')]['length']?_0x1dac65[_0x47a5('0x2f')]:_0x21f296['model'];if(!_0x378208[_0x47a5('0x2a')][_0x47a5('0x30')]('nolimit')){_0x1dac65['limit']=qs[_0x47a5('0x31')](_0x378208['query'][_0x47a5('0x31')]);_0x1dac65[_0x47a5('0x1a')]=qs[_0x47a5('0x1a')](_0x378208['query'][_0x47a5('0x1a')]);}_0x1dac65['order']=qs['sort'](_0x378208[_0x47a5('0x2a')]['sort']);_0x1dac65[_0x47a5('0x32')]=qs['filters'](_[_0x47a5('0x33')](_0x378208[_0x47a5('0x2a')],_0x21f296[_0x47a5('0x2c')]),_0x24b162);if(_0x378208[_0x47a5('0x2a')][_0x47a5('0x34')]){_0x1dac65[_0x47a5('0x32')]=_[_0x47a5('0x35')](_0x1dac65[_0x47a5('0x32')],{'$or':_[_0x47a5('0x24')](_0x24b162,function(_0x4caed5){if(_0x4caed5[_0x47a5('0x28')]!==_0x47a5('0x36')){var _0x511c06={};_0x511c06[_0x4caed5[_0x47a5('0x22')]]={'$like':'%'+_0x378208[_0x47a5('0x2a')][_0x47a5('0x34')]+'%'};return _0x511c06;}})});}_0x1dac65=_['merge']({},_0x1dac65,_0x378208[_0x47a5('0x37')]);var _0x10f660={'where':_0x1dac65['where']};return db[_0x47a5('0x25')][_0x47a5('0x38')](_0x10f660)['then'](function(_0x55c5eb){_0x3ba0b7['count']=_0x55c5eb;if(_0x378208[_0x47a5('0x2a')]['includeAll']){_0x1dac65[_0x47a5('0x39')]=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3a')](_0x1dac65);})[_0x47a5('0x20')](function(_0x1b2c80){_0x3ba0b7[_0x47a5('0x3b')]=_0x1b2c80;return _0x3ba0b7;})[_0x47a5('0x20')](respondWithFilteredResult(_0x36ad34,_0x1dac65))[_0x47a5('0x3c')](handleError(_0x36ad34,null));};exports[_0x47a5('0x3d')]=function(_0x36a24e,_0x280500){var _0x1658e8={'raw':!![],'where':{'id':_0x36a24e['params']['id']}},_0x23d6d8={};_0x23d6d8[_0x47a5('0x29')]=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x23d6d8['query']=_[_0x47a5('0x2b')](_0x36a24e['query']);_0x23d6d8['filtears']=_['intersection'](_0x23d6d8['model'],_0x23d6d8[_0x47a5('0x2a')]);_0x1658e8['attributes']=_[_0x47a5('0x2d')](_0x23d6d8[_0x47a5('0x29')],qs[_0x47a5('0x2e')](_0x36a24e['query'][_0x47a5('0x2e')]));_0x1658e8[_0x47a5('0x2f')]=_0x1658e8['attributes']['length']?_0x1658e8[_0x47a5('0x2f')]:_0x23d6d8['model'];if(_0x36a24e[_0x47a5('0x2a')][_0x47a5('0x3e')]){_0x1658e8[_0x47a5('0x39')]=[{'all':!![]}];}_0x1658e8=_[_0x47a5('0x35')]({},_0x1658e8,_0x36a24e[_0x47a5('0x37')]);return db[_0x47a5('0x25')][_0x47a5('0x3f')](_0x1658e8)[_0x47a5('0x20')](handleEntityNotFound(_0x280500,null))[_0x47a5('0x20')](respondWithResult(_0x280500,null))[_0x47a5('0x3c')](handleError(_0x280500,null));};exports[_0x47a5('0x40')]=function(_0x3c3ebf,_0xe28d76){return db[_0x47a5('0x25')][_0x47a5('0x40')](_0x3c3ebf[_0x47a5('0x41')],{})['then'](respondWithResult(_0xe28d76,0xc9))[_0x47a5('0x3c')](handleError(_0xe28d76,null));};exports[_0x47a5('0x1f')]=function(_0x49eab1,_0x52b3a8){if(_0x49eab1[_0x47a5('0x41')]['id']){delete _0x49eab1['body']['id'];}return db[_0x47a5('0x25')][_0x47a5('0x3f')]({'where':{'id':_0x49eab1['params']['id']}})['then'](handleEntityNotFound(_0x52b3a8,null))[_0x47a5('0x20')](saveUpdates(_0x49eab1['body'],null))[_0x47a5('0x20')](respondWithResult(_0x52b3a8,null))[_0x47a5('0x3c')](handleError(_0x52b3a8,null));};exports[_0x47a5('0x21')]=function(_0x3e12a7,_0x44fe8a){return db[_0x47a5('0x25')][_0x47a5('0x3f')]({'where':{'id':_0x3e12a7['params']['id']}})['then'](handleEntityNotFound(_0x44fe8a,null))[_0x47a5('0x20')](removeEntity(_0x44fe8a,null))[_0x47a5('0x3c')](handleError(_0x44fe8a,null));};exports[_0x47a5('0x42')]=function(_0x9ea93e,_0x2c7020){return db[_0x47a5('0x25')][_0x47a5('0x42')]()['then'](respondWithResult(_0x2c7020,null))[_0x47a5('0x3c')](handleError(_0x2c7020,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 8d0e0f5..a30c7a6 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 _0x4f16=['uniqueid','lodash','util','../../config/logger','request-promise','path','../../config/environment','exports','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x3eb18c,_0x26cee9){var _0x10afac=function(_0x34939a){while(--_0x34939a){_0x3eb18c['push'](_0x3eb18c['shift']());}};_0x10afac(++_0x26cee9);}(_0x4f16,0x11f));var _0x64f1=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x4f16[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0x64f1('0x0'));var util=require(_0x64f1('0x1'));var logger=require(_0x64f1('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x64f1('0x3'));var fs=require('fs');var path=require(_0x64f1('0x4'));var rimraf=require('rimraf');var config=require(_0x64f1('0x5'));var attributes=require('./openchannelQueueReport.attributes');module[_0x64f1('0x6')]=function(_0x1ff13e,_0x464433){return _0x1ff13e[_0x64f1('0x7')](_0x64f1('0x8'),attributes,{'tableName':_0x64f1('0x9'),'paranoid':![],'indexes':[{'name':_0x64f1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7ed=['bluebird','path','rimraf','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','moment'];(function(_0x77adbb,_0x182ca0){var _0x37e6e5=function(_0x2c8ead){while(--_0x2c8ead){_0x77adbb['push'](_0x77adbb['shift']());}};_0x37e6e5(++_0x182ca0);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x6c0b0a,_0x496391){_0x6c0b0a=_0x6c0b0a-0x0;var _0x5f456a=_0xf7ed[_0x6c0b0a];return _0x5f456a;};'use strict';var _=require('lodash');var util=require(_0xdf7e('0x0'));var logger=require(_0xdf7e('0x1'))('api');var moment=require(_0xdf7e('0x2'));var BPromise=require(_0xdf7e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf7e('0x4'));var rimraf=require(_0xdf7e('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf7e('0x6'));module[_0xdf7e('0x7')]=function(_0x1c4f77,_0x51db33){return _0x1c4f77[_0xdf7e('0x8')](_0xdf7e('0x9'),attributes,{'tableName':_0xdf7e('0xa'),'paranoid':![],'indexes':[{'name':_0xdf7e('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1ef4212..82d67c3 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 _0xf5b7=['attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','where'];(function(_0x28de32,_0x242d8b){var _0x5ec7a8=function(_0x4c1a27){while(--_0x4c1a27){_0x28de32['push'](_0x28de32['shift']());}};_0x5ec7a8(++_0x242d8b);}(_0xf5b7,0xa2));var _0x7f5b=function(_0x43c70a,_0x4fc349){_0x43c70a=_0x43c70a-0x0;var _0x5d70c0=_0xf5b7[_0x43c70a];return _0x5d70c0;};'use strict';var _=require(_0x7f5b('0x0'));var util=require(_0x7f5b('0x1'));var moment=require(_0x7f5b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f5b('0x3'));var db=require(_0x7f5b('0x4'))['db'];var utils=require(_0x7f5b('0x5'));var logger=require(_0x7f5b('0x6'))(_0x7f5b('0x7'));var config=require(_0x7f5b('0x8'));var jayson=require(_0x7f5b('0x9'));var client=jayson['client'][_0x7f5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e80ce,_0x5e0ee1,_0x414ced){return new BPromise(function(_0x49e2ac,_0x36eb16){return client[_0x7f5b('0xb')](_0x1e80ce,_0x414ced)[_0x7f5b('0xc')](function(_0x2fc32d){logger[_0x7f5b('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0ee1,_0x7f5b('0xe'));logger[_0x7f5b('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x5e0ee1,_0x7f5b('0xe'),JSON[_0x7f5b('0x10')](_0x2fc32d));if(_0x2fc32d[_0x7f5b('0x11')]){if(_0x2fc32d['error'][_0x7f5b('0x12')]===0x1f4){logger[_0x7f5b('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0ee1,_0x2fc32d['error']['message']);return _0x36eb16(_0x2fc32d['error'][_0x7f5b('0x13')]);}logger[_0x7f5b('0x11')](_0x7f5b('0x14'),_0x5e0ee1,_0x2fc32d[_0x7f5b('0x11')][_0x7f5b('0x13')]);return _0x49e2ac(_0x2fc32d[_0x7f5b('0x11')][_0x7f5b('0x13')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0ee1,_0x7f5b('0xe'));_0x49e2ac(_0x2fc32d[_0x7f5b('0x15')][_0x7f5b('0x13')]);}})[_0x7f5b('0x16')](function(_0x3df5e7){logger[_0x7f5b('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x5e0ee1,_0x3df5e7);_0x36eb16(_0x3df5e7);});});}exports[_0x7f5b('0x17')]=function(_0x28ea92){var _0x551c8a=this;return new Promise(function(_0x353082,_0x2452b7){return db[_0x7f5b('0x18')][_0x7f5b('0x19')](_0x28ea92[_0x7f5b('0x1a')],{'raw':_0x28ea92[_0x7f5b('0x1b')]?_0x28ea92['options']['raw']===undefined?!![]:![]:!![]})[_0x7f5b('0xc')](function(_0x486478){logger[_0x7f5b('0xd')](_0x7f5b('0x17'),_0x28ea92);logger[_0x7f5b('0xf')](_0x7f5b('0x17'),_0x28ea92,JSON[_0x7f5b('0x10')](_0x486478));_0x353082(_0x486478);})[_0x7f5b('0x16')](function(_0x2b5ac1){logger[_0x7f5b('0x11')](_0x7f5b('0x17'),_0x2b5ac1['message'],_0x28ea92);_0x2452b7(_0x551c8a[_0x7f5b('0x11')](0x1f4,_0x2b5ac1[_0x7f5b('0x13')]));});});};exports[_0x7f5b('0x1c')]=function(_0x3207ce){var _0x223a04=this;return new Promise(function(_0x368ac4,_0x12787e){return db[_0x7f5b('0x18')]['update'](_0x3207ce['body'],{'raw':_0x3207ce[_0x7f5b('0x1b')]?_0x3207ce[_0x7f5b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3207ce[_0x7f5b('0x1b')]?_0x3207ce[_0x7f5b('0x1b')][_0x7f5b('0x1d')]||null:null,'attributes':_0x3207ce[_0x7f5b('0x1b')]?_0x3207ce['options'][_0x7f5b('0x1e')]||null:null,'limit':_0x3207ce['options']?_0x3207ce['options'][_0x7f5b('0x1f')]||null:null})[_0x7f5b('0xc')](function(_0x32b7ec){logger['info'](_0x7f5b('0x1c'),_0x3207ce);logger[_0x7f5b('0xf')](_0x7f5b('0x1c'),_0x3207ce,JSON[_0x7f5b('0x10')](_0x32b7ec));_0x368ac4(_0x32b7ec);})[_0x7f5b('0x16')](function(_0x472026){logger['error'](_0x7f5b('0x1c'),_0x472026[_0x7f5b('0x13')],_0x3207ce);_0x12787e(_0x223a04['error'](0x1f4,_0x472026[_0x7f5b('0x13')]));});});}; \ No newline at end of file +var _0x6451=['http','info','request\x20sent','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','raw','then','debug','UpdateOpenchannelQueueReport','update','body','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2f86ef,_0x3142e2){var _0x3e54d4=function(_0x7c24b5){while(--_0x7c24b5){_0x2f86ef['push'](_0x2f86ef['shift']());}};_0x3e54d4(++_0x3142e2);}(_0x6451,0xd7));var _0x1645=function(_0xb256af,_0x29a3e2){_0xb256af=_0xb256af-0x0;var _0xd2806d=_0x6451[_0xb256af];return _0xd2806d;};'use strict';var _=require(_0x1645('0x0'));var util=require('util');var moment=require(_0x1645('0x1'));var BPromise=require(_0x1645('0x2'));var rs=require(_0x1645('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1645('0x4'));var logger=require(_0x1645('0x5'))('rpc');var config=require(_0x1645('0x6'));var jayson=require(_0x1645('0x7'));var client=jayson[_0x1645('0x8')][_0x1645('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53262d,_0xe7d80c,_0x220c78){return new BPromise(function(_0xaf7b13,_0x44f80b){return client['request'](_0x53262d,_0x220c78)['then'](function(_0x3ba228){logger[_0x1645('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe7d80c,_0x1645('0xb'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0xe7d80c,_0x1645('0xb'),JSON['stringify'](_0x3ba228));if(_0x3ba228[_0x1645('0xc')]){if(_0x3ba228[_0x1645('0xc')][_0x1645('0xd')]===0x1f4){logger[_0x1645('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe7d80c,_0x3ba228['error'][_0x1645('0xe')]);return _0x44f80b(_0x3ba228[_0x1645('0xc')][_0x1645('0xe')]);}logger[_0x1645('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe7d80c,_0x3ba228['error'][_0x1645('0xe')]);return _0xaf7b13(_0x3ba228[_0x1645('0xc')][_0x1645('0xe')]);}else{logger[_0x1645('0xa')](_0x1645('0xf'),_0xe7d80c,_0x1645('0xb'));_0xaf7b13(_0x3ba228[_0x1645('0x10')][_0x1645('0xe')]);}})[_0x1645('0x11')](function(_0xb2efdb){logger[_0x1645('0xc')](_0x1645('0xf'),_0xe7d80c,_0xb2efdb);_0x44f80b(_0xb2efdb);});});}exports[_0x1645('0x12')]=function(_0x3cca4f){var _0x291f28=this;return new Promise(function(_0x521764,_0x3db25f){return db[_0x1645('0x13')][_0x1645('0x14')](_0x3cca4f['body'],{'raw':_0x3cca4f[_0x1645('0x15')]?_0x3cca4f['options'][_0x1645('0x16')]===undefined?!![]:![]:!![]})[_0x1645('0x17')](function(_0x580b94){logger[_0x1645('0xa')](_0x1645('0x12'),_0x3cca4f);logger[_0x1645('0x18')]('CreateOpenchannelQueueReport',_0x3cca4f,JSON['stringify'](_0x580b94));_0x521764(_0x580b94);})[_0x1645('0x11')](function(_0xa02697){logger[_0x1645('0xc')](_0x1645('0x12'),_0xa02697[_0x1645('0xe')],_0x3cca4f);_0x3db25f(_0x291f28[_0x1645('0xc')](0x1f4,_0xa02697[_0x1645('0xe')]));});});};exports[_0x1645('0x19')]=function(_0x5f11ba){var _0x5d6779=this;return new Promise(function(_0xde192a,_0x527266){return db[_0x1645('0x13')][_0x1645('0x1a')](_0x5f11ba[_0x1645('0x1b')],{'raw':_0x5f11ba[_0x1645('0x15')]?_0x5f11ba['options'][_0x1645('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f11ba[_0x1645('0x15')]?_0x5f11ba[_0x1645('0x15')][_0x1645('0x1c')]||null:null,'attributes':_0x5f11ba[_0x1645('0x15')]?_0x5f11ba[_0x1645('0x15')][_0x1645('0x1d')]||null:null,'limit':_0x5f11ba[_0x1645('0x15')]?_0x5f11ba[_0x1645('0x15')][_0x1645('0x1e')]||null:null})['then'](function(_0x24270a){logger['info']('UpdateOpenchannelQueueReport',_0x5f11ba);logger[_0x1645('0x18')](_0x1645('0x19'),_0x5f11ba,JSON[_0x1645('0x1f')](_0x24270a));_0xde192a(_0x24270a);})['catch'](function(_0xb09275){logger[_0x1645('0xc')](_0x1645('0x19'),_0xb09275[_0x1645('0xe')],_0x5f11ba);_0x527266(_0x5d6779[_0x1645('0xc')](0x1f4,_0xb09275[_0x1645('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e62300f..b82d5b9 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(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 1137858..ccf574f 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 _0xf0ff=['DATE','NOW','moment','exports','STRING','ENUM','account','queue'];(function(_0x1b528b,_0x486928){var _0x6045bc=function(_0x2d24e5){while(--_0x2d24e5){_0x1b528b['push'](_0x1b528b['shift']());}};_0x6045bc(++_0x486928);}(_0xf0ff,0x1ba));var _0xff0f=function(_0x56cbc1,_0x29d241){_0x56cbc1=_0x56cbc1-0x0;var _0x28365e=_0xf0ff[_0x56cbc1];return _0x28365e;};'use strict';var moment=require(_0xff0f('0x0'));var Sequelize=require('sequelize');module[_0xff0f('0x1')]={'uniqueid':{'type':Sequelize[_0xff0f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xff0f('0x3')](_0xff0f('0x4'),'agent',_0xff0f('0x5')),'allowNull':![],'defaultValue':_0xff0f('0x5')},'transferredAt':{'type':Sequelize[_0xff0f('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xff0f('0x7')]}}; \ No newline at end of file +var _0xe36b=['exports','STRING','ENUM','account','agent','moment','sequelize'];(function(_0x7a112,_0x2eb4a0){var _0x136dc5=function(_0x437650){while(--_0x437650){_0x7a112['push'](_0x7a112['shift']());}};_0x136dc5(++_0x2eb4a0);}(_0xe36b,0x1b7));var _0xbe36=function(_0x30d7dd,_0x42bd94){_0x30d7dd=_0x30d7dd-0x0;var _0x4af7ac=_0xe36b[_0x30d7dd];return _0x4af7ac;};'use strict';var moment=require(_0xbe36('0x0'));var Sequelize=require(_0xbe36('0x1'));module[_0xbe36('0x2')]={'uniqueid':{'type':Sequelize[_0xbe36('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xbe36('0x4')](_0xbe36('0x5'),_0xbe36('0x6'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6c179e1..7005a8f 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 _0x9e0d=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','filtears','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','sendStatus','name','send','index','map','OpenchannelTransferReport','type','key','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x33c937,_0x2139ae){var _0x2911a5=function(_0x27bb79){while(--_0x27bb79){_0x33c937['push'](_0x33c937['shift']());}};_0x2911a5(++_0x2139ae);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x16bb69,_0x3492fe){_0x16bb69=_0x16bb69-0x0;var _0x582c2c=_0x9e0d[_0x16bb69];return _0x582c2c;};'use strict';var pdf=require(_0xd9e0('0x0'));var emlformat=require(_0xd9e0('0x1'));var rimraf=require(_0xd9e0('0x2'));var zipdir=require(_0xd9e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9e0('0x4'));var moment=require(_0xd9e0('0x5'));var BPromise=require(_0xd9e0('0x6'));var Mustache=require(_0xd9e0('0x7'));var util=require(_0xd9e0('0x8'));var path=require(_0xd9e0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9e0('0xa'));var fs=require('fs');var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];function respondWithStatusCode(_0x418d84,_0x1fb454){_0x1fb454=_0x1fb454||0xcc;return function(_0x18fdf2){if(_0x18fdf2){return _0x418d84['sendStatus'](_0x1fb454);}return _0x418d84[_0xd9e0('0x1b')](_0x1fb454)['end']();};}function respondWithResult(_0x2f311c,_0x55c704){_0x55c704=_0x55c704||0xc8;return function(_0x24d361){if(_0x24d361){return _0x2f311c[_0xd9e0('0x1b')](_0x55c704)[_0xd9e0('0x1c')](_0x24d361);}};}function respondWithFilteredResult(_0x18301b,_0x3e4c5d){return function(_0x4da900){if(_0x4da900){var _0x58d44c=_0x4da900[_0xd9e0('0x1d')],_0x5aff0b=_0x3e4c5d[_0xd9e0('0x1e')],_0x2eebec=_0x3e4c5d['offset']+_0x3e4c5d[_0xd9e0('0x1f')],_0x386816;if(_0x2eebec>=_0x58d44c){_0x2eebec=_0x58d44c;_0x386816=0xc8;}else{_0x386816=0xce;}_0x18301b['status'](_0x386816);return _0x18301b['set'](_0xd9e0('0x20'),_0x5aff0b+'-'+_0x2eebec+'/'+_0x58d44c)[_0xd9e0('0x1c')](_0x4da900);}return null;};}function patchUpdates(_0x5aac2d){return function(_0x5ac8f5){try{jsonpatch[_0xd9e0('0x21')](_0x5ac8f5,_0x5aac2d,!![]);}catch(_0x3189ef){return BPromise['reject'](_0x3189ef);}return _0x5ac8f5[_0xd9e0('0x22')]();};}function saveUpdates(_0x4cc3c9,_0xd3d455){return function(_0x44c9e6){if(_0x44c9e6){return _0x44c9e6[_0xd9e0('0x23')](_0x4cc3c9)[_0xd9e0('0x24')](function(_0x3a3f7f){return _0x3a3f7f;});}return null;};}function removeEntity(_0x5711a1,_0x19534a){return function(_0x333233){if(_0x333233){return _0x333233['destroy']()[_0xd9e0('0x24')](function(){_0x5711a1[_0xd9e0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x357bd9,_0x5e17d4){return function(_0x274815){if(!_0x274815){_0x357bd9[_0xd9e0('0x25')](0x194);}return _0x274815;};}function handleError(_0x48dbf9,_0xd5846a){_0xd5846a=_0xd5846a||0x1f4;return function(_0x53cf67){logger['error'](_0x53cf67['stack']);if(_0x53cf67[_0xd9e0('0x26')]){delete _0x53cf67[_0xd9e0('0x26')];}_0x48dbf9[_0xd9e0('0x1b')](_0xd5846a)[_0xd9e0('0x27')](_0x53cf67);};}exports[_0xd9e0('0x28')]=function(_0x4c99d3,_0x237dfe){var _0x5d56ba={},_0x28664c={},_0x4bd349={'count':0x0,'rows':[]};var _0x3bfd06=_[_0xd9e0('0x29')](db[_0xd9e0('0x2a')]['rawAttributes'],function(_0x4b4f7d){return{'name':_0x4b4f7d['fieldName'],'type':_0x4b4f7d[_0xd9e0('0x2b')][_0xd9e0('0x2c')]};});_0x28664c['model']=_[_0xd9e0('0x29')](_0x3bfd06,_0xd9e0('0x26'));_0x28664c[_0xd9e0('0x2d')]=_[_0xd9e0('0x2e')](_0x4c99d3[_0xd9e0('0x2d')]);_0x28664c[_0xd9e0('0x2f')]=_[_0xd9e0('0x30')](_0x28664c['model'],_0x28664c[_0xd9e0('0x2d')]);_0x5d56ba[_0xd9e0('0x31')]=_[_0xd9e0('0x30')](_0x28664c[_0xd9e0('0x32')],qs[_0xd9e0('0x33')](_0x4c99d3[_0xd9e0('0x2d')][_0xd9e0('0x33')]));_0x5d56ba[_0xd9e0('0x31')]=_0x5d56ba[_0xd9e0('0x31')][_0xd9e0('0x34')]?_0x5d56ba[_0xd9e0('0x31')]:_0x28664c[_0xd9e0('0x32')];if(!_0x4c99d3['query'][_0xd9e0('0x35')](_0xd9e0('0x36'))){_0x5d56ba[_0xd9e0('0x1f')]=qs[_0xd9e0('0x1f')](_0x4c99d3[_0xd9e0('0x2d')]['limit']);_0x5d56ba[_0xd9e0('0x1e')]=qs[_0xd9e0('0x1e')](_0x4c99d3[_0xd9e0('0x2d')][_0xd9e0('0x1e')]);}_0x5d56ba['order']=qs[_0xd9e0('0x37')](_0x4c99d3['query'][_0xd9e0('0x37')]);_0x5d56ba[_0xd9e0('0x38')]=qs[_0xd9e0('0x2f')](_[_0xd9e0('0x39')](_0x4c99d3[_0xd9e0('0x2d')],_0x28664c[_0xd9e0('0x2f')]),_0x3bfd06);if(_0x4c99d3[_0xd9e0('0x2d')][_0xd9e0('0x3a')]){_0x5d56ba[_0xd9e0('0x38')]=_['merge'](_0x5d56ba[_0xd9e0('0x38')],{'$or':_[_0xd9e0('0x29')](_0x3bfd06,function(_0x2a340c){if(_0x2a340c[_0xd9e0('0x2b')]!=='VIRTUAL'){var _0x38ad8c={};_0x38ad8c[_0x2a340c[_0xd9e0('0x26')]]={'$like':'%'+_0x4c99d3[_0xd9e0('0x2d')][_0xd9e0('0x3a')]+'%'};return _0x38ad8c;}})});}_0x5d56ba=_[_0xd9e0('0x3b')]({},_0x5d56ba,_0x4c99d3[_0xd9e0('0x3c')]);var _0x3fc833={'where':_0x5d56ba[_0xd9e0('0x38')]};return db[_0xd9e0('0x2a')][_0xd9e0('0x1d')](_0x3fc833)[_0xd9e0('0x24')](function(_0x249934){_0x4bd349[_0xd9e0('0x1d')]=_0x249934;if(_0x4c99d3[_0xd9e0('0x2d')][_0xd9e0('0x3d')]){_0x5d56ba[_0xd9e0('0x3e')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xd9e0('0x3f')](_0x5d56ba);})[_0xd9e0('0x24')](function(_0x5ea09d){_0x4bd349[_0xd9e0('0x40')]=_0x5ea09d;return _0x4bd349;})['then'](respondWithFilteredResult(_0x237dfe,_0x5d56ba))[_0xd9e0('0x41')](handleError(_0x237dfe,null));};exports[_0xd9e0('0x42')]=function(_0x6e984b,_0x34a00f){var _0x94c2b4={'raw':!![],'where':{'id':_0x6e984b['params']['id']}},_0x294081={};_0x294081['model']=_[_0xd9e0('0x2e')](db[_0xd9e0('0x2a')][_0xd9e0('0x43')]);_0x294081[_0xd9e0('0x2d')]=_[_0xd9e0('0x2e')](_0x6e984b['query']);_0x294081[_0xd9e0('0x44')]=_[_0xd9e0('0x30')](_0x294081[_0xd9e0('0x32')],_0x294081[_0xd9e0('0x2d')]);_0x94c2b4['attributes']=_[_0xd9e0('0x30')](_0x294081[_0xd9e0('0x32')],qs[_0xd9e0('0x33')](_0x6e984b['query']['fields']));_0x94c2b4[_0xd9e0('0x31')]=_0x94c2b4[_0xd9e0('0x31')]['length']?_0x94c2b4['attributes']:_0x294081[_0xd9e0('0x32')];if(_0x6e984b[_0xd9e0('0x2d')][_0xd9e0('0x3d')]){_0x94c2b4[_0xd9e0('0x3e')]=[{'all':!![]}];}_0x94c2b4=_[_0xd9e0('0x3b')]({},_0x94c2b4,_0x6e984b[_0xd9e0('0x3c')]);return db[_0xd9e0('0x2a')][_0xd9e0('0x45')](_0x94c2b4)['then'](handleEntityNotFound(_0x34a00f,null))[_0xd9e0('0x24')](respondWithResult(_0x34a00f,null))[_0xd9e0('0x41')](handleError(_0x34a00f,null));};exports['create']=function(_0x969085,_0x113f62){return db[_0xd9e0('0x2a')][_0xd9e0('0x46')](_0x969085[_0xd9e0('0x47')],{})[_0xd9e0('0x24')](respondWithResult(_0x113f62,0xc9))[_0xd9e0('0x41')](handleError(_0x113f62,null));};exports[_0xd9e0('0x23')]=function(_0x38102a,_0x2fd13f){if(_0x38102a[_0xd9e0('0x47')]['id']){delete _0x38102a[_0xd9e0('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xd9e0('0x45')]({'where':{'id':_0x38102a[_0xd9e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x2fd13f,null))[_0xd9e0('0x24')](saveUpdates(_0x38102a['body'],null))[_0xd9e0('0x24')](respondWithResult(_0x2fd13f,null))[_0xd9e0('0x41')](handleError(_0x2fd13f,null));};exports[_0xd9e0('0x49')]=function(_0x2a4b6f,_0xaff14b){return db[_0xd9e0('0x2a')][_0xd9e0('0x45')]({'where':{'id':_0x2a4b6f['params']['id']}})[_0xd9e0('0x24')](handleEntityNotFound(_0xaff14b,null))[_0xd9e0('0x24')](removeEntity(_0xaff14b,null))[_0xd9e0('0x41')](handleError(_0xaff14b,null));};exports[_0xd9e0('0x4a')]=function(_0x168021,_0x4c7909){return db['OpenchannelTransferReport'][_0xd9e0('0x4a')]()['then'](respondWithResult(_0x4c7909,null))[_0xd9e0('0x41')](handleError(_0x4c7909,null));}; \ No newline at end of file +var _0xa8b1=['includeAll','findAll','rows','catch','keys','rawAttributes','filtears','intersection','length','include','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','map','OpenchannelTransferReport','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x1c8996,_0x192609){var _0x1abc92=function(_0x2121d8){while(--_0x2121d8){_0x1c8996['push'](_0x1c8996['shift']());}};_0x1abc92(++_0x192609);}(_0xa8b1,0x182));var _0x1a8b=function(_0x5d9dbe,_0x33c112){_0x5d9dbe=_0x5d9dbe-0x0;var _0x4c8ce4=_0xa8b1[_0x5d9dbe];return _0x4c8ce4;};'use strict';var pdf=require(_0x1a8b('0x0'));var emlformat=require(_0x1a8b('0x1'));var rimraf=require(_0x1a8b('0x2'));var zipdir=require(_0x1a8b('0x3'));var jsonpatch=require(_0x1a8b('0x4'));var rp=require(_0x1a8b('0x5'));var moment=require(_0x1a8b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1a8b('0x7'));var path=require(_0x1a8b('0x8'));var sox=require('sox');var csv=require(_0x1a8b('0x9'));var ejs=require(_0x1a8b('0xa'));var fs=require('fs');var _=require(_0x1a8b('0xb'));var squel=require('squel');var crypto=require(_0x1a8b('0xc'));var jsforce=require(_0x1a8b('0xd'));var deskjs=require(_0x1a8b('0xe'));var toCsv=require(_0x1a8b('0x9'));var querystring=require(_0x1a8b('0xf'));var Papa=require(_0x1a8b('0x10'));var Redis=require('ioredis');var authService=require(_0x1a8b('0x11'));var qs=require(_0x1a8b('0x12'));var as=require(_0x1a8b('0x13'));var hardwareService=require(_0x1a8b('0x14'));var logger=require('../../config/logger')(_0x1a8b('0x15'));var utils=require(_0x1a8b('0x16'));var config=require(_0x1a8b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d97fd,_0xf50f79){_0xf50f79=_0xf50f79||0xcc;return function(_0x500075){if(_0x500075){return _0x2d97fd[_0x1a8b('0x18')](_0xf50f79);}return _0x2d97fd[_0x1a8b('0x19')](_0xf50f79)[_0x1a8b('0x1a')]();};}function respondWithResult(_0x32c61c,_0x3e6fd4){_0x3e6fd4=_0x3e6fd4||0xc8;return function(_0x436735){if(_0x436735){return _0x32c61c['status'](_0x3e6fd4)[_0x1a8b('0x1b')](_0x436735);}};}function respondWithFilteredResult(_0x4f34a0,_0x45b2d4){return function(_0x53b754){if(_0x53b754){var _0x3ee045=_0x53b754[_0x1a8b('0x1c')],_0x217a50=_0x45b2d4['offset'],_0x1bce93=_0x45b2d4[_0x1a8b('0x1d')]+_0x45b2d4[_0x1a8b('0x1e')],_0x27d243;if(_0x1bce93>=_0x3ee045){_0x1bce93=_0x3ee045;_0x27d243=0xc8;}else{_0x27d243=0xce;}_0x4f34a0['status'](_0x27d243);return _0x4f34a0['set'](_0x1a8b('0x1f'),_0x217a50+'-'+_0x1bce93+'/'+_0x3ee045)[_0x1a8b('0x1b')](_0x53b754);}return null;};}function patchUpdates(_0x50311e){return function(_0x256817){try{jsonpatch[_0x1a8b('0x20')](_0x256817,_0x50311e,!![]);}catch(_0x2ece0b){return BPromise[_0x1a8b('0x21')](_0x2ece0b);}return _0x256817[_0x1a8b('0x22')]();};}function saveUpdates(_0x3ba964,_0x4b0190){return function(_0x6a5f5f){if(_0x6a5f5f){return _0x6a5f5f['update'](_0x3ba964)[_0x1a8b('0x23')](function(_0x2b6a8c){return _0x2b6a8c;});}return null;};}function removeEntity(_0x5d82ea,_0x270b72){return function(_0x1a1ab8){if(_0x1a1ab8){return _0x1a1ab8[_0x1a8b('0x24')]()[_0x1a8b('0x23')](function(){_0x5d82ea[_0x1a8b('0x19')](0xcc)[_0x1a8b('0x1a')]();});}};}function handleEntityNotFound(_0x25c9db,_0x1ebef9){return function(_0x5ef0ef){if(!_0x5ef0ef){_0x25c9db['sendStatus'](0x194);}return _0x5ef0ef;};}function handleError(_0x557130,_0x3a1459){_0x3a1459=_0x3a1459||0x1f4;return function(_0x46f3ea){logger[_0x1a8b('0x25')](_0x46f3ea['stack']);if(_0x46f3ea[_0x1a8b('0x26')]){delete _0x46f3ea[_0x1a8b('0x26')];}_0x557130[_0x1a8b('0x19')](_0x3a1459)['send'](_0x46f3ea);};}exports['index']=function(_0x2fde28,_0x56f6b3){var _0x3f0772={},_0x1d25a5={},_0x23e9ae={'count':0x0,'rows':[]};var _0x15cef2=_[_0x1a8b('0x27')](db[_0x1a8b('0x28')]['rawAttributes'],function(_0x199aac){return{'name':_0x199aac[_0x1a8b('0x29')],'type':_0x199aac[_0x1a8b('0x2a')]['key']};});_0x1d25a5[_0x1a8b('0x2b')]=_[_0x1a8b('0x27')](_0x15cef2,_0x1a8b('0x26'));_0x1d25a5[_0x1a8b('0x2c')]=_['keys'](_0x2fde28[_0x1a8b('0x2c')]);_0x1d25a5[_0x1a8b('0x2d')]=_['intersection'](_0x1d25a5[_0x1a8b('0x2b')],_0x1d25a5['query']);_0x3f0772[_0x1a8b('0x2e')]=_['intersection'](_0x1d25a5[_0x1a8b('0x2b')],qs[_0x1a8b('0x2f')](_0x2fde28['query']['fields']));_0x3f0772[_0x1a8b('0x2e')]=_0x3f0772[_0x1a8b('0x2e')]['length']?_0x3f0772[_0x1a8b('0x2e')]:_0x1d25a5[_0x1a8b('0x2b')];if(!_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x30')](_0x1a8b('0x31'))){_0x3f0772[_0x1a8b('0x1e')]=qs[_0x1a8b('0x1e')](_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x1e')]);_0x3f0772[_0x1a8b('0x1d')]=qs[_0x1a8b('0x1d')](_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x1d')]);}_0x3f0772[_0x1a8b('0x32')]=qs[_0x1a8b('0x33')](_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x33')]);_0x3f0772[_0x1a8b('0x34')]=qs['filters'](_[_0x1a8b('0x35')](_0x2fde28['query'],_0x1d25a5[_0x1a8b('0x2d')]),_0x15cef2);if(_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x36')]){_0x3f0772[_0x1a8b('0x34')]=_[_0x1a8b('0x37')](_0x3f0772[_0x1a8b('0x34')],{'$or':_[_0x1a8b('0x27')](_0x15cef2,function(_0x4050ad){if(_0x4050ad[_0x1a8b('0x2a')]!==_0x1a8b('0x38')){var _0x22d6bf={};_0x22d6bf[_0x4050ad['name']]={'$like':'%'+_0x2fde28[_0x1a8b('0x2c')]['filter']+'%'};return _0x22d6bf;}})});}_0x3f0772=_[_0x1a8b('0x37')]({},_0x3f0772,_0x2fde28[_0x1a8b('0x39')]);var _0x42be76={'where':_0x3f0772[_0x1a8b('0x34')]};return db[_0x1a8b('0x28')][_0x1a8b('0x1c')](_0x42be76)['then'](function(_0x10a7ce){_0x23e9ae[_0x1a8b('0x1c')]=_0x10a7ce;if(_0x2fde28[_0x1a8b('0x2c')][_0x1a8b('0x3a')]){_0x3f0772['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x1a8b('0x3b')](_0x3f0772);})[_0x1a8b('0x23')](function(_0x47d995){_0x23e9ae[_0x1a8b('0x3c')]=_0x47d995;return _0x23e9ae;})[_0x1a8b('0x23')](respondWithFilteredResult(_0x56f6b3,_0x3f0772))[_0x1a8b('0x3d')](handleError(_0x56f6b3,null));};exports['show']=function(_0x2eb7e1,_0x1ac414){var _0x227dcf={'raw':!![],'where':{'id':_0x2eb7e1['params']['id']}},_0x1d5d32={};_0x1d5d32[_0x1a8b('0x2b')]=_[_0x1a8b('0x3e')](db['OpenchannelTransferReport'][_0x1a8b('0x3f')]);_0x1d5d32['query']=_[_0x1a8b('0x3e')](_0x2eb7e1[_0x1a8b('0x2c')]);_0x1d5d32[_0x1a8b('0x40')]=_[_0x1a8b('0x41')](_0x1d5d32[_0x1a8b('0x2b')],_0x1d5d32['query']);_0x227dcf['attributes']=_[_0x1a8b('0x41')](_0x1d5d32[_0x1a8b('0x2b')],qs[_0x1a8b('0x2f')](_0x2eb7e1[_0x1a8b('0x2c')][_0x1a8b('0x2f')]));_0x227dcf['attributes']=_0x227dcf[_0x1a8b('0x2e')][_0x1a8b('0x42')]?_0x227dcf[_0x1a8b('0x2e')]:_0x1d5d32[_0x1a8b('0x2b')];if(_0x2eb7e1['query'][_0x1a8b('0x3a')]){_0x227dcf[_0x1a8b('0x43')]=[{'all':!![]}];}_0x227dcf=_[_0x1a8b('0x37')]({},_0x227dcf,_0x2eb7e1[_0x1a8b('0x39')]);return db[_0x1a8b('0x28')][_0x1a8b('0x44')](_0x227dcf)[_0x1a8b('0x23')](handleEntityNotFound(_0x1ac414,null))['then'](respondWithResult(_0x1ac414,null))[_0x1a8b('0x3d')](handleError(_0x1ac414,null));};exports[_0x1a8b('0x45')]=function(_0xafcf34,_0x5f2bc8){return db['OpenchannelTransferReport'][_0x1a8b('0x45')](_0xafcf34[_0x1a8b('0x46')],{})[_0x1a8b('0x23')](respondWithResult(_0x5f2bc8,0xc9))[_0x1a8b('0x3d')](handleError(_0x5f2bc8,null));};exports[_0x1a8b('0x47')]=function(_0x627f0d,_0x309b42){if(_0x627f0d[_0x1a8b('0x46')]['id']){delete _0x627f0d[_0x1a8b('0x46')]['id'];}return db['OpenchannelTransferReport'][_0x1a8b('0x44')]({'where':{'id':_0x627f0d[_0x1a8b('0x48')]['id']}})['then'](handleEntityNotFound(_0x309b42,null))[_0x1a8b('0x23')](saveUpdates(_0x627f0d[_0x1a8b('0x46')],null))['then'](respondWithResult(_0x309b42,null))[_0x1a8b('0x3d')](handleError(_0x309b42,null));};exports[_0x1a8b('0x24')]=function(_0xf81696,_0x5727ee){return db['OpenchannelTransferReport'][_0x1a8b('0x44')]({'where':{'id':_0xf81696['params']['id']}})['then'](handleEntityNotFound(_0x5727ee,null))[_0x1a8b('0x23')](removeEntity(_0x5727ee,null))[_0x1a8b('0x3d')](handleError(_0x5727ee,null));};exports[_0x1a8b('0x49')]=function(_0x4f5cf8,_0x1e29e1){return db[_0x1a8b('0x28')]['describe']()[_0x1a8b('0x23')](respondWithResult(_0x1e29e1,null))[_0x1a8b('0x3d')](handleError(_0x1e29e1,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ae61660..c3fed34 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 _0x0727=['uniqueid','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x0727,0x181));var _0x7072=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x0727[_0x5a6644];return _0x3a2a5d;};'use strict';var _=require(_0x7072('0x0'));var util=require('util');var logger=require(_0x7072('0x1'))(_0x7072('0x2'));var moment=require('moment');var BPromise=require(_0x7072('0x3'));var rp=require(_0x7072('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7072('0x5'));var config=require(_0x7072('0x6'));var attributes=require(_0x7072('0x7'));module[_0x7072('0x8')]=function(_0x23ff91,_0x2f8dd0){return _0x23ff91['define'](_0x7072('0x9'),attributes,{'tableName':_0x7072('0xa'),'paranoid':![],'indexes':[{'name':_0x7072('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7ca=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4b1b9e,_0x503a70){var _0x8137ff=function(_0x501f1e){while(--_0x501f1e){_0x4b1b9e['push'](_0x4b1b9e['shift']());}};_0x8137ff(++_0x503a70);}(_0xd7ca,0xf6));var _0xad7c=function(_0x2a121c,_0x14bedb){_0x2a121c=_0x2a121c-0x0;var _0x151bdb=_0xd7ca[_0x2a121c];return _0x151bdb;};'use strict';var _=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var logger=require(_0xad7c('0x2'))('api');var moment=require(_0xad7c('0x3'));var BPromise=require(_0xad7c('0x4'));var rp=require(_0xad7c('0x5'));var fs=require('fs');var path=require(_0xad7c('0x6'));var rimraf=require(_0xad7c('0x7'));var config=require(_0xad7c('0x8'));var attributes=require(_0xad7c('0x9'));module[_0xad7c('0xa')]=function(_0x546881,_0x477418){return _0x546881[_0xad7c('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xad7c('0xc'),'paranoid':![],'indexes':[{'name':_0xad7c('0xd'),'fields':[_0xad7c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 50dbdc1..8c936d7 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 _0x59b7=['result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x26b8b5,_0xf5c2c1){var _0x2150a9=function(_0x1ca1be){while(--_0x1ca1be){_0x26b8b5['push'](_0x26b8b5['shift']());}};_0x2150a9(++_0xf5c2c1);}(_0x59b7,0x1ef));var _0x759b=function(_0x5e00e9,_0x4dab17){_0x5e00e9=_0x5e00e9-0x0;var _0x15718d=_0x59b7[_0x5e00e9];return _0x15718d;};'use strict';var _=require('lodash');var util=require(_0x759b('0x0'));var moment=require(_0x759b('0x1'));var BPromise=require(_0x759b('0x2'));var rs=require(_0x759b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x759b('0x4'));var logger=require(_0x759b('0x5'))(_0x759b('0x6'));var config=require(_0x759b('0x7'));var jayson=require(_0x759b('0x8'));var client=jayson['client'][_0x759b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178be2,_0x27d3ba,_0x383dd2){return new BPromise(function(_0x5baa61,_0x39d107){return client['request'](_0x178be2,_0x383dd2)[_0x759b('0xa')](function(_0x5d3e46){logger[_0x759b('0xb')](_0x759b('0xc'),_0x27d3ba,'request\x20sent');logger['debug'](_0x759b('0xd'),_0x27d3ba,'request\x20sent',JSON[_0x759b('0xe')](_0x5d3e46));if(_0x5d3e46['error']){if(_0x5d3e46[_0x759b('0xf')][_0x759b('0x10')]===0x1f4){logger[_0x759b('0xf')](_0x759b('0xc'),_0x27d3ba,_0x5d3e46[_0x759b('0xf')]['message']);return _0x39d107(_0x5d3e46['error'][_0x759b('0x11')]);}logger[_0x759b('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x27d3ba,_0x5d3e46[_0x759b('0xf')]['message']);return _0x5baa61(_0x5d3e46[_0x759b('0xf')][_0x759b('0x11')]);}else{logger['info'](_0x759b('0xc'),_0x27d3ba,'request\x20sent');_0x5baa61(_0x5d3e46[_0x759b('0x12')][_0x759b('0x11')]);}})['catch'](function(_0x42e657){logger[_0x759b('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x27d3ba,_0x42e657);_0x39d107(_0x42e657);});});} \ No newline at end of file +var _0x7680=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x591907,_0x31905f){var _0x40c966=function(_0x1154bc){while(--_0x1154bc){_0x591907['push'](_0x591907['shift']());}};_0x40c966(++_0x31905f);}(_0x7680,0x178));var _0x0768=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x7680[_0x377a6e];return _0x37f751;};'use strict';var _=require('lodash');var util=require(_0x0768('0x0'));var moment=require(_0x0768('0x1'));var BPromise=require('bluebird');var rs=require(_0x0768('0x2'));var fs=require('fs');var Redis=require(_0x0768('0x3'));var db=require(_0x0768('0x4'))['db'];var utils=require(_0x0768('0x5'));var logger=require(_0x0768('0x6'))(_0x0768('0x7'));var config=require('../../config/environment');var jayson=require(_0x0768('0x8'));var client=jayson[_0x0768('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d31d,_0x188315,_0x4c9b23){return new BPromise(function(_0x1f0e2f,_0x106873){return client[_0x0768('0xa')](_0x54d31d,_0x4c9b23)[_0x0768('0xb')](function(_0x5e8cf5){logger[_0x0768('0xc')](_0x0768('0xd'),_0x188315,_0x0768('0xe'));logger[_0x0768('0xf')](_0x0768('0x10'),_0x188315,'request\x20sent',JSON['stringify'](_0x5e8cf5));if(_0x5e8cf5['error']){if(_0x5e8cf5[_0x0768('0x11')][_0x0768('0x12')]===0x1f4){logger[_0x0768('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x188315,_0x5e8cf5[_0x0768('0x11')]['message']);return _0x106873(_0x5e8cf5[_0x0768('0x11')][_0x0768('0x13')]);}logger[_0x0768('0x11')](_0x0768('0xd'),_0x188315,_0x5e8cf5['error'][_0x0768('0x13')]);return _0x1f0e2f(_0x5e8cf5[_0x0768('0x11')]['message']);}else{logger[_0x0768('0xc')](_0x0768('0xd'),_0x188315,_0x0768('0xe'));_0x1f0e2f(_0x5e8cf5[_0x0768('0x14')][_0x0768('0x13')]);}})[_0x0768('0x15')](function(_0x5c095b){logger['error'](_0x0768('0xd'),_0x188315,_0x5c095b);_0x106873(_0x5c095b);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a9b3988..ddde8da 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 _0x8cd5=['create','put','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','/:id','post'];(function(_0x4fdf9e,_0xad3de4){var _0x597cd3=function(_0xd562dd){while(--_0xd562dd){_0x4fdf9e['push'](_0x4fdf9e['shift']());}};_0x597cd3(++_0xad3de4);}(_0x8cd5,0x74));var _0x58cd=function(_0x487683,_0x58b9b8){_0x487683=_0x487683-0x0;var _0x178a4d=_0x8cd5[_0x487683];return _0x178a4d;};'use strict';var multer=require(_0x58cd('0x0'));var util=require(_0x58cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x58cd('0x2'));var router=express[_0x58cd('0x3')]();var auth=require(_0x58cd('0x4'));var interaction=require(_0x58cd('0x5'));var config=require(_0x58cd('0x6'));var controller=require(_0x58cd('0x7'));router[_0x58cd('0x8')]('/',auth[_0x58cd('0x9')](),controller['index']);router[_0x58cd('0x8')](_0x58cd('0xa'),auth[_0x58cd('0x9')](),controller['show']);router[_0x58cd('0xb')]('/',auth[_0x58cd('0x9')](),controller[_0x58cd('0xc')]);router[_0x58cd('0xd')](_0x58cd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x58cd('0x9')](),controller[_0x58cd('0xe')]);module[_0x58cd('0xf')]=router; \ No newline at end of file +var _0x5aa1=['isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0x22cb11,_0x2af471){var _0x16ad1c=function(_0x3b9b17){while(--_0x3b9b17){_0x22cb11['push'](_0x22cb11['shift']());}};_0x16ad1c(++_0x2af471);}(_0x5aa1,0x92));var _0x15aa=function(_0x5a06a1,_0x421abd){_0x5a06a1=_0x5a06a1-0x0;var _0x4c354f=_0x5aa1[_0x5a06a1];return _0x4c354f;};'use strict';var multer=require(_0x15aa('0x0'));var util=require('util');var path=require(_0x15aa('0x1'));var timeout=require(_0x15aa('0x2'));var express=require(_0x15aa('0x3'));var router=express['Router']();var auth=require(_0x15aa('0x4'));var interaction=require(_0x15aa('0x5'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x15aa('0x6')]('/',auth[_0x15aa('0x7')](),controller[_0x15aa('0x8')]);router[_0x15aa('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x15aa('0x9')]);router[_0x15aa('0xa')]('/',auth[_0x15aa('0x7')](),controller[_0x15aa('0xb')]);router[_0x15aa('0xc')](_0x15aa('0xd'),auth[_0x15aa('0x7')](),controller[_0x15aa('0xe')]);router[_0x15aa('0xf')](_0x15aa('0xd'),auth[_0x15aa('0x7')](),controller['destroy']);module[_0x15aa('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 1bc455f..c6eee43 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 _0x5bba=['STRING','sequelize','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x5bba,0xcd));var _0xa5bb=function(_0x1e6af2,_0x340951){_0x1e6af2=_0x1e6af2-0x0;var _0xef118a=_0x5bba[_0x1e6af2];return _0xef118a;};'use strict';var Sequelize=require(_0xa5bb('0x0'));module[_0xa5bb('0x1')]={'name':{'type':Sequelize[_0xa5bb('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x10fb=['STRING','name','sequelize','exports'];(function(_0x58bf73,_0x4a1765){var _0xd91ff7=function(_0x3fc15b){while(--_0x3fc15b){_0x58bf73['push'](_0x58bf73['shift']());}};_0xd91ff7(++_0x4a1765);}(_0x10fb,0x172));var _0xb10f=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x10fb[_0x2aa48b];return _0x48caf8;};'use strict';var Sequelize=require(_0xb10f('0x0'));module[_0xb10f('0x1')]={'name':{'type':Sequelize[_0xb10f('0x2')],'unique':_0xb10f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb10f('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 908dd26..be08af4 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 _0x98f5=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','Pauses','UserProfileResource','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','Pause','includeAll','include','findAll','rows','params','filtears','merge','options','find','create','body','user','get','role','UserProfileSection','autoAssociation','error','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x270b28,_0x316f8d){var _0x57d73c=function(_0x3969ab){while(--_0x3969ab){_0x270b28['push'](_0x270b28['shift']());}};_0x57d73c(++_0x316f8d);}(_0x98f5,0x132));var _0x598f=function(_0x5d7fa6,_0x26faa6){_0x5d7fa6=_0x5d7fa6-0x0;var _0x5ef826=_0x98f5[_0x5d7fa6];return _0x5ef826;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x598f('0x0'));var zipdir=require(_0x598f('0x1'));var jsonpatch=require(_0x598f('0x2'));var rp=require(_0x598f('0x3'));var moment=require(_0x598f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x598f('0x5'));var path=require('path');var sox=require(_0x598f('0x6'));var csv=require('to-csv');var ejs=require(_0x598f('0x7'));var fs=require('fs');var _=require(_0x598f('0x8'));var squel=require(_0x598f('0x9'));var crypto=require(_0x598f('0xa'));var jsforce=require(_0x598f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x598f('0xc'));var Papa=require(_0x598f('0xd'));var Redis=require(_0x598f('0xe'));var authService=require(_0x598f('0xf'));var qs=require(_0x598f('0x10'));var as=require(_0x598f('0x11'));var hardwareService=require(_0x598f('0x12'));var logger=require(_0x598f('0x13'))(_0x598f('0x14'));var utils=require(_0x598f('0x15'));var config=require(_0x598f('0x16'));var licenseUtil=require(_0x598f('0x17'));var db=require(_0x598f('0x18'))['db'];function respondWithStatusCode(_0x43403c,_0x39bc8e){_0x39bc8e=_0x39bc8e||0xcc;return function(_0x3bcc6a){if(_0x3bcc6a){return _0x43403c[_0x598f('0x19')](_0x39bc8e);}return _0x43403c[_0x598f('0x1a')](_0x39bc8e)[_0x598f('0x1b')]();};}function respondWithResult(_0x260abb,_0x5ed69a){_0x5ed69a=_0x5ed69a||0xc8;return function(_0x12a719){if(_0x12a719){return _0x260abb[_0x598f('0x1a')](_0x5ed69a)[_0x598f('0x1c')](_0x12a719);}};}function respondWithFilteredResult(_0x3f027a,_0x5bcdbd){return function(_0x27003a){if(_0x27003a){var _0x169fe8=_0x27003a[_0x598f('0x1d')],_0x53e520=_0x5bcdbd[_0x598f('0x1e')],_0x28007e=_0x5bcdbd[_0x598f('0x1e')]+_0x5bcdbd[_0x598f('0x1f')],_0x1b6963;if(_0x28007e>=_0x169fe8){_0x28007e=_0x169fe8;_0x1b6963=0xc8;}else{_0x1b6963=0xce;}_0x3f027a[_0x598f('0x1a')](_0x1b6963);return _0x3f027a[_0x598f('0x20')]('Content-Range',_0x53e520+'-'+_0x28007e+'/'+_0x169fe8)[_0x598f('0x1c')](_0x27003a);}return null;};}function patchUpdates(_0x3dfc5b){return function(_0x18a621){try{jsonpatch[_0x598f('0x21')](_0x18a621,_0x3dfc5b,!![]);}catch(_0x4cbcb6){return BPromise['reject'](_0x4cbcb6);}return _0x18a621[_0x598f('0x22')]();};}function saveUpdates(_0x32445a,_0x584422){return function(_0x4f3825){if(_0x4f3825){return _0x4f3825[_0x598f('0x23')](_0x32445a)[_0x598f('0x24')](function(_0x23811d){return _0x23811d;});}return null;};}function removeEntity(_0x2143bf,_0xd45e79){return function(_0x170dae){if(_0x170dae){return _0x170dae[_0x598f('0x25')]()[_0x598f('0x24')](function(){var _0x56c474=_0x170dae['get']({'plain':!![]});var _0x36910b=_0x598f('0x26');return db[_0x598f('0x27')]['destroy']({'where':{'type':_0x36910b,'resourceId':_0x56c474['id']}})['then'](function(){return _0x170dae;});})[_0x598f('0x24')](function(){_0x2143bf[_0x598f('0x1a')](0xcc)[_0x598f('0x1b')]();});}};}function handleEntityNotFound(_0x3bc5c5,_0x107b87){return function(_0x1a34dd){if(!_0x1a34dd){_0x3bc5c5[_0x598f('0x19')](0x194);}return _0x1a34dd;};}function handleError(_0x417af2,_0x6180){_0x6180=_0x6180||0x1f4;return function(_0x4d5a3a){logger['error'](_0x4d5a3a['stack']);if(_0x4d5a3a[_0x598f('0x28')]){delete _0x4d5a3a[_0x598f('0x28')];}_0x417af2[_0x598f('0x1a')](_0x6180)[_0x598f('0x29')](_0x4d5a3a);};}exports[_0x598f('0x2a')]=function(_0x16d7cc,_0x3f15da){var _0x4fc1d2={},_0x3a20c8={},_0x1682cd={'count':0x0,'rows':[]};var _0x221877=_['map'](db['Pause'][_0x598f('0x2b')],function(_0x5180fd){return{'name':_0x5180fd['fieldName'],'type':_0x5180fd[_0x598f('0x2c')][_0x598f('0x2d')]};});_0x3a20c8[_0x598f('0x2e')]=_[_0x598f('0x2f')](_0x221877,'name');_0x3a20c8[_0x598f('0x30')]=_[_0x598f('0x31')](_0x16d7cc[_0x598f('0x30')]);_0x3a20c8[_0x598f('0x32')]=_[_0x598f('0x33')](_0x3a20c8[_0x598f('0x2e')],_0x3a20c8[_0x598f('0x30')]);_0x4fc1d2[_0x598f('0x34')]=_[_0x598f('0x33')](_0x3a20c8[_0x598f('0x2e')],qs['fields'](_0x16d7cc['query'][_0x598f('0x35')]));_0x4fc1d2[_0x598f('0x34')]=_0x4fc1d2[_0x598f('0x34')][_0x598f('0x36')]?_0x4fc1d2[_0x598f('0x34')]:_0x3a20c8[_0x598f('0x2e')];if(!_0x16d7cc[_0x598f('0x30')]['hasOwnProperty'](_0x598f('0x37'))){_0x4fc1d2[_0x598f('0x1f')]=qs[_0x598f('0x1f')](_0x16d7cc[_0x598f('0x30')][_0x598f('0x1f')]);_0x4fc1d2[_0x598f('0x1e')]=qs[_0x598f('0x1e')](_0x16d7cc[_0x598f('0x30')]['offset']);}_0x4fc1d2['order']=qs['sort'](_0x16d7cc[_0x598f('0x30')][_0x598f('0x38')]);_0x4fc1d2['where']=qs['filters'](_[_0x598f('0x39')](_0x16d7cc[_0x598f('0x30')],_0x3a20c8[_0x598f('0x32')]),_0x221877);if(_0x16d7cc[_0x598f('0x30')][_0x598f('0x3a')]){_0x4fc1d2[_0x598f('0x3b')]=_['merge'](_0x4fc1d2[_0x598f('0x3b')],{'$or':_[_0x598f('0x2f')](_0x221877,function(_0x2d577e){if(_0x2d577e[_0x598f('0x2c')]!==_0x598f('0x3c')){var _0xb1e927={};_0xb1e927[_0x2d577e[_0x598f('0x28')]]={'$like':'%'+_0x16d7cc['query'][_0x598f('0x3a')]+'%'};return _0xb1e927;}})});}_0x4fc1d2=_['merge']({},_0x4fc1d2,_0x16d7cc['options']);var _0x3b61ae={'where':_0x4fc1d2['where']};return db[_0x598f('0x3d')][_0x598f('0x1d')](_0x3b61ae)[_0x598f('0x24')](function(_0x116b14){_0x1682cd[_0x598f('0x1d')]=_0x116b14;if(_0x16d7cc[_0x598f('0x30')][_0x598f('0x3e')]){_0x4fc1d2[_0x598f('0x3f')]=[{'all':!![]}];}return db[_0x598f('0x3d')][_0x598f('0x40')](_0x4fc1d2);})[_0x598f('0x24')](function(_0x3b347a){_0x1682cd[_0x598f('0x41')]=_0x3b347a;return _0x1682cd;})[_0x598f('0x24')](respondWithFilteredResult(_0x3f15da,_0x4fc1d2))['catch'](handleError(_0x3f15da,null));};exports['show']=function(_0x7b54c5,_0x69e5c3){var _0x574b17={'raw':!![],'where':{'id':_0x7b54c5[_0x598f('0x42')]['id']}},_0xbfce8e={};_0xbfce8e[_0x598f('0x2e')]=_[_0x598f('0x31')](db['Pause'][_0x598f('0x2b')]);_0xbfce8e[_0x598f('0x30')]=_['keys'](_0x7b54c5[_0x598f('0x30')]);_0xbfce8e[_0x598f('0x43')]=_[_0x598f('0x33')](_0xbfce8e[_0x598f('0x2e')],_0xbfce8e[_0x598f('0x30')]);_0x574b17['attributes']=_[_0x598f('0x33')](_0xbfce8e[_0x598f('0x2e')],qs[_0x598f('0x35')](_0x7b54c5[_0x598f('0x30')][_0x598f('0x35')]));_0x574b17[_0x598f('0x34')]=_0x574b17['attributes'][_0x598f('0x36')]?_0x574b17[_0x598f('0x34')]:_0xbfce8e[_0x598f('0x2e')];if(_0x7b54c5[_0x598f('0x30')][_0x598f('0x3e')]){_0x574b17[_0x598f('0x3f')]=[{'all':!![]}];}_0x574b17=_[_0x598f('0x44')]({},_0x574b17,_0x7b54c5[_0x598f('0x45')]);return db[_0x598f('0x3d')][_0x598f('0x46')](_0x574b17)[_0x598f('0x24')](handleEntityNotFound(_0x69e5c3,null))['then'](respondWithResult(_0x69e5c3,null))['catch'](handleError(_0x69e5c3,null));};exports[_0x598f('0x47')]=function(_0x1a612e,_0x14c023){return db[_0x598f('0x3d')]['create'](_0x1a612e[_0x598f('0x48')],{})[_0x598f('0x24')](function(_0xe662c0){var _0x31296b=_0x1a612e[_0x598f('0x49')][_0x598f('0x4a')]({'plain':!![]});if(!_0x31296b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31296b[_0x598f('0x4b')]==='user'){var _0x37da98=_0xe662c0[_0x598f('0x4a')]({'plain':!![]});var _0x1cfc7d=_0x598f('0x26');return db[_0x598f('0x4c')]['find']({'where':{'name':_0x1cfc7d,'userProfileId':_0x31296b['userProfileId']},'raw':!![]})[_0x598f('0x24')](function(_0x53db07){if(_0x53db07&&_0x53db07[_0x598f('0x4d')]===0x0){return db[_0x598f('0x27')]['create']({'name':_0x37da98[_0x598f('0x28')],'resourceId':_0x37da98['id'],'type':_0x53db07['name'],'sectionId':_0x53db07['id']},{})[_0x598f('0x24')](function(){return _0xe662c0;});}else{return _0xe662c0;}})['catch'](function(_0x4ea11d){logger[_0x598f('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ea11d);throw _0x4ea11d;});}return _0xe662c0;})[_0x598f('0x24')](respondWithResult(_0x14c023,0xc9))['catch'](handleError(_0x14c023,null));};exports[_0x598f('0x23')]=function(_0x2747e3,_0x160dec){if(_0x2747e3[_0x598f('0x48')]['id']){delete _0x2747e3[_0x598f('0x48')]['id'];}return db[_0x598f('0x3d')][_0x598f('0x46')]({'where':{'id':_0x2747e3[_0x598f('0x42')]['id']}})[_0x598f('0x24')](handleEntityNotFound(_0x160dec,null))[_0x598f('0x24')](saveUpdates(_0x2747e3[_0x598f('0x48')],null))['then'](respondWithResult(_0x160dec,null))[_0x598f('0x4f')](handleError(_0x160dec,null));};exports['destroy']=function(_0x25c3fc,_0x50ad43){return db[_0x598f('0x3d')][_0x598f('0x46')]({'where':{'id':_0x25c3fc[_0x598f('0x42')]['id']}})[_0x598f('0x24')](handleEntityNotFound(_0x50ad43,null))[_0x598f('0x24')](removeEntity(_0x50ad43,null))[_0x598f('0x4f')](handleError(_0x50ad43,null));}; \ No newline at end of file +var _0xa0d6=['send','index','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','Pause','includeAll','include','findAll','rows','catch','params','filtears','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','get','Pauses','destroy','error','name'];(function(_0x5ed3b1,_0xac2fd1){var _0x4b9f0d=function(_0x4797d9){while(--_0x4797d9){_0x5ed3b1['push'](_0x5ed3b1['shift']());}};_0x4b9f0d(++_0xac2fd1);}(_0xa0d6,0x1ec));var _0x6a0d=function(_0x4539d6,_0x1f9348){_0x4539d6=_0x4539d6-0x0;var _0x1344bd=_0xa0d6[_0x4539d6];return _0x1344bd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6a0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a0d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a0d('0x2'));var moment=require(_0x6a0d('0x3'));var BPromise=require(_0x6a0d('0x4'));var Mustache=require(_0x6a0d('0x5'));var util=require(_0x6a0d('0x6'));var path=require(_0x6a0d('0x7'));var sox=require('sox');var csv=require(_0x6a0d('0x8'));var ejs=require(_0x6a0d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6a0d('0xa'));var jsforce=require(_0x6a0d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6a0d('0x8'));var querystring=require(_0x6a0d('0xc'));var Papa=require(_0x6a0d('0xd'));var Redis=require(_0x6a0d('0xe'));var authService=require(_0x6a0d('0xf'));var qs=require(_0x6a0d('0x10'));var as=require(_0x6a0d('0x11'));var hardwareService=require(_0x6a0d('0x12'));var logger=require(_0x6a0d('0x13'))('api');var utils=require(_0x6a0d('0x14'));var config=require(_0x6a0d('0x15'));var licenseUtil=require(_0x6a0d('0x16'));var db=require(_0x6a0d('0x17'))['db'];function respondWithStatusCode(_0x659f08,_0x4adf96){_0x4adf96=_0x4adf96||0xcc;return function(_0x3bb300){if(_0x3bb300){return _0x659f08[_0x6a0d('0x18')](_0x4adf96);}return _0x659f08[_0x6a0d('0x19')](_0x4adf96)['end']();};}function respondWithResult(_0x351385,_0x34e3d3){_0x34e3d3=_0x34e3d3||0xc8;return function(_0x32fa09){if(_0x32fa09){return _0x351385[_0x6a0d('0x19')](_0x34e3d3)[_0x6a0d('0x1a')](_0x32fa09);}};}function respondWithFilteredResult(_0x55605b,_0xd812b1){return function(_0x2b054d){if(_0x2b054d){var _0x3d6971=_0x2b054d[_0x6a0d('0x1b')],_0x3b070c=_0xd812b1['offset'],_0x384af7=_0xd812b1[_0x6a0d('0x1c')]+_0xd812b1[_0x6a0d('0x1d')],_0x364ece;if(_0x384af7>=_0x3d6971){_0x384af7=_0x3d6971;_0x364ece=0xc8;}else{_0x364ece=0xce;}_0x55605b[_0x6a0d('0x19')](_0x364ece);return _0x55605b[_0x6a0d('0x1e')](_0x6a0d('0x1f'),_0x3b070c+'-'+_0x384af7+'/'+_0x3d6971)['json'](_0x2b054d);}return null;};}function patchUpdates(_0xa3681d){return function(_0x3675ce){try{jsonpatch[_0x6a0d('0x20')](_0x3675ce,_0xa3681d,!![]);}catch(_0x158dfb){return BPromise['reject'](_0x158dfb);}return _0x3675ce[_0x6a0d('0x21')]();};}function saveUpdates(_0x287839,_0x544ab0){return function(_0x2bd056){if(_0x2bd056){return _0x2bd056['update'](_0x287839)['then'](function(_0x3eb37f){return _0x3eb37f;});}return null;};}function removeEntity(_0x128030,_0x4b304c){return function(_0x4d230a){if(_0x4d230a){return _0x4d230a['destroy']()[_0x6a0d('0x22')](function(){var _0x2ec9d4=_0x4d230a[_0x6a0d('0x23')]({'plain':!![]});var _0x1ed000=_0x6a0d('0x24');return db['UserProfileResource'][_0x6a0d('0x25')]({'where':{'type':_0x1ed000,'resourceId':_0x2ec9d4['id']}})['then'](function(){return _0x4d230a;});})[_0x6a0d('0x22')](function(){_0x128030['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f6649,_0x4308c4){return function(_0x1c77ca){if(!_0x1c77ca){_0x3f6649[_0x6a0d('0x18')](0x194);}return _0x1c77ca;};}function handleError(_0x58e6b5,_0x4e20e9){_0x4e20e9=_0x4e20e9||0x1f4;return function(_0x2a3513){logger[_0x6a0d('0x26')](_0x2a3513['stack']);if(_0x2a3513[_0x6a0d('0x27')]){delete _0x2a3513[_0x6a0d('0x27')];}_0x58e6b5[_0x6a0d('0x19')](_0x4e20e9)[_0x6a0d('0x28')](_0x2a3513);};}exports[_0x6a0d('0x29')]=function(_0x4bfb7,_0x278ab7){var _0x2b4f67={},_0x41bf32={},_0x2ac4cd={'count':0x0,'rows':[]};var _0x4091eb=_['map'](db['Pause'][_0x6a0d('0x2a')],function(_0x2a0524){return{'name':_0x2a0524['fieldName'],'type':_0x2a0524[_0x6a0d('0x2b')]['key']};});_0x41bf32[_0x6a0d('0x2c')]=_[_0x6a0d('0x2d')](_0x4091eb,_0x6a0d('0x27'));_0x41bf32[_0x6a0d('0x2e')]=_[_0x6a0d('0x2f')](_0x4bfb7['query']);_0x41bf32['filters']=_[_0x6a0d('0x30')](_0x41bf32[_0x6a0d('0x2c')],_0x41bf32[_0x6a0d('0x2e')]);_0x2b4f67[_0x6a0d('0x31')]=_[_0x6a0d('0x30')](_0x41bf32['model'],qs[_0x6a0d('0x32')](_0x4bfb7[_0x6a0d('0x2e')]['fields']));_0x2b4f67['attributes']=_0x2b4f67[_0x6a0d('0x31')][_0x6a0d('0x33')]?_0x2b4f67[_0x6a0d('0x31')]:_0x41bf32[_0x6a0d('0x2c')];if(!_0x4bfb7[_0x6a0d('0x2e')][_0x6a0d('0x34')]('nolimit')){_0x2b4f67[_0x6a0d('0x1d')]=qs[_0x6a0d('0x1d')](_0x4bfb7[_0x6a0d('0x2e')][_0x6a0d('0x1d')]);_0x2b4f67['offset']=qs[_0x6a0d('0x1c')](_0x4bfb7[_0x6a0d('0x2e')]['offset']);}_0x2b4f67[_0x6a0d('0x35')]=qs['sort'](_0x4bfb7[_0x6a0d('0x2e')][_0x6a0d('0x36')]);_0x2b4f67[_0x6a0d('0x37')]=qs['filters'](_[_0x6a0d('0x38')](_0x4bfb7[_0x6a0d('0x2e')],_0x41bf32['filters']),_0x4091eb);if(_0x4bfb7['query']['filter']){_0x2b4f67[_0x6a0d('0x37')]=_[_0x6a0d('0x39')](_0x2b4f67[_0x6a0d('0x37')],{'$or':_['map'](_0x4091eb,function(_0x489700){if(_0x489700[_0x6a0d('0x2b')]!==_0x6a0d('0x3a')){var _0x4872ed={};_0x4872ed[_0x489700[_0x6a0d('0x27')]]={'$like':'%'+_0x4bfb7[_0x6a0d('0x2e')]['filter']+'%'};return _0x4872ed;}})});}_0x2b4f67=_[_0x6a0d('0x39')]({},_0x2b4f67,_0x4bfb7['options']);var _0x4507ad={'where':_0x2b4f67[_0x6a0d('0x37')]};return db[_0x6a0d('0x3b')][_0x6a0d('0x1b')](_0x4507ad)[_0x6a0d('0x22')](function(_0x1c1ca5){_0x2ac4cd[_0x6a0d('0x1b')]=_0x1c1ca5;if(_0x4bfb7[_0x6a0d('0x2e')][_0x6a0d('0x3c')]){_0x2b4f67[_0x6a0d('0x3d')]=[{'all':!![]}];}return db[_0x6a0d('0x3b')][_0x6a0d('0x3e')](_0x2b4f67);})['then'](function(_0x13b199){_0x2ac4cd[_0x6a0d('0x3f')]=_0x13b199;return _0x2ac4cd;})[_0x6a0d('0x22')](respondWithFilteredResult(_0x278ab7,_0x2b4f67))[_0x6a0d('0x40')](handleError(_0x278ab7,null));};exports['show']=function(_0x2cc8d7,_0xf4d2f5){var _0x16ece5={'raw':!![],'where':{'id':_0x2cc8d7[_0x6a0d('0x41')]['id']}},_0x11f1d6={};_0x11f1d6[_0x6a0d('0x2c')]=_[_0x6a0d('0x2f')](db[_0x6a0d('0x3b')][_0x6a0d('0x2a')]);_0x11f1d6['query']=_[_0x6a0d('0x2f')](_0x2cc8d7[_0x6a0d('0x2e')]);_0x11f1d6[_0x6a0d('0x42')]=_[_0x6a0d('0x30')](_0x11f1d6[_0x6a0d('0x2c')],_0x11f1d6[_0x6a0d('0x2e')]);_0x16ece5[_0x6a0d('0x31')]=_[_0x6a0d('0x30')](_0x11f1d6[_0x6a0d('0x2c')],qs[_0x6a0d('0x32')](_0x2cc8d7[_0x6a0d('0x2e')][_0x6a0d('0x32')]));_0x16ece5[_0x6a0d('0x31')]=_0x16ece5[_0x6a0d('0x31')][_0x6a0d('0x33')]?_0x16ece5[_0x6a0d('0x31')]:_0x11f1d6[_0x6a0d('0x2c')];if(_0x2cc8d7['query'][_0x6a0d('0x3c')]){_0x16ece5['include']=[{'all':!![]}];}_0x16ece5=_[_0x6a0d('0x39')]({},_0x16ece5,_0x2cc8d7['options']);return db[_0x6a0d('0x3b')][_0x6a0d('0x43')](_0x16ece5)[_0x6a0d('0x22')](handleEntityNotFound(_0xf4d2f5,null))[_0x6a0d('0x22')](respondWithResult(_0xf4d2f5,null))['catch'](handleError(_0xf4d2f5,null));};exports[_0x6a0d('0x44')]=function(_0xd37d1f,_0x49a5a7){return db['Pause'][_0x6a0d('0x44')](_0xd37d1f[_0x6a0d('0x45')],{})['then'](function(_0x2bb98e){var _0x292096=_0xd37d1f['user']['get']({'plain':!![]});if(!_0x292096)throw new Error(_0x6a0d('0x46'));if(_0x292096[_0x6a0d('0x47')]===_0x6a0d('0x48')){var _0x571f66=_0x2bb98e['get']({'plain':!![]});var _0x25673c=_0x6a0d('0x24');return db[_0x6a0d('0x49')][_0x6a0d('0x43')]({'where':{'name':_0x25673c,'userProfileId':_0x292096[_0x6a0d('0x4a')]},'raw':!![]})[_0x6a0d('0x22')](function(_0x345b43){if(_0x345b43&&_0x345b43['autoAssociation']===0x0){return db[_0x6a0d('0x4b')]['create']({'name':_0x571f66[_0x6a0d('0x27')],'resourceId':_0x571f66['id'],'type':_0x345b43[_0x6a0d('0x27')],'sectionId':_0x345b43['id']},{})[_0x6a0d('0x22')](function(){return _0x2bb98e;});}else{return _0x2bb98e;}})['catch'](function(_0xf0e50b){logger[_0x6a0d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf0e50b);throw _0xf0e50b;});}return _0x2bb98e;})[_0x6a0d('0x22')](respondWithResult(_0x49a5a7,0xc9))[_0x6a0d('0x40')](handleError(_0x49a5a7,null));};exports['update']=function(_0x5f3442,_0x111559){if(_0x5f3442[_0x6a0d('0x45')]['id']){delete _0x5f3442['body']['id'];}return db['Pause'][_0x6a0d('0x43')]({'where':{'id':_0x5f3442['params']['id']}})[_0x6a0d('0x22')](handleEntityNotFound(_0x111559,null))[_0x6a0d('0x22')](saveUpdates(_0x5f3442[_0x6a0d('0x45')],null))[_0x6a0d('0x22')](respondWithResult(_0x111559,null))[_0x6a0d('0x40')](handleError(_0x111559,null));};exports['destroy']=function(_0x7325,_0x59ddb3){return db['Pause']['find']({'where':{'id':_0x7325[_0x6a0d('0x41')]['id']}})[_0x6a0d('0x22')](handleEntityNotFound(_0x59ddb3,null))['then'](removeEntity(_0x59ddb3,null))[_0x6a0d('0x40')](handleError(_0x59ddb3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index ba67980..0e429ac 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 _0x7292=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger'];(function(_0x124d96,_0xd6571a){var _0x5654d3=function(_0x4c925c){while(--_0x4c925c){_0x124d96['push'](_0x124d96['shift']());}};_0x5654d3(++_0xd6571a);}(_0x7292,0x107));var _0x2729=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x7292[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var logger=require(_0x2729('0x2'))(_0x2729('0x3'));var moment=require(_0x2729('0x4'));var BPromise=require(_0x2729('0x5'));var rp=require(_0x2729('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2729('0x7'));var config=require(_0x2729('0x8'));var attributes=require(_0x2729('0x9'));module[_0x2729('0xa')]=function(_0x26a3dc,_0x176a7c){return _0x26a3dc[_0x2729('0xb')](_0x2729('0xc'),attributes,{'tableName':_0x2729('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4dc=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x26ee9e,_0x29e0da){var _0x4599e1=function(_0x2aff94){while(--_0x2aff94){_0x26ee9e['push'](_0x26ee9e['shift']());}};_0x4599e1(++_0x29e0da);}(_0xd4dc,0xff));var _0xcd4d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xd4dc[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var logger=require(_0xcd4d('0x1'))(_0xcd4d('0x2'));var moment=require(_0xcd4d('0x3'));var BPromise=require(_0xcd4d('0x4'));var rp=require(_0xcd4d('0x5'));var fs=require('fs');var path=require(_0xcd4d('0x6'));var rimraf=require(_0xcd4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd4d('0x8'));module['exports']=function(_0x5d70fb,_0x3c5bbd){return _0x5d70fb['define'](_0xcd4d('0x9'),attributes,{'tableName':_0xcd4d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e105aae..4bfc6a5 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 _0x087a=['request','info','request\x20sent','error','Pause,\x20%s,\x20%s','message','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http'];(function(_0x13998e,_0x54bfa6){var _0x34782b=function(_0x4b0302){while(--_0x4b0302){_0x13998e['push'](_0x13998e['shift']());}};_0x34782b(++_0x54bfa6);}(_0x087a,0xde));var _0xa087=function(_0x41b212,_0xcd89fc){_0x41b212=_0x41b212-0x0;var _0x35deac=_0x087a[_0x41b212];return _0x35deac;};'use strict';var _=require(_0xa087('0x0'));var util=require(_0xa087('0x1'));var moment=require(_0xa087('0x2'));var BPromise=require(_0xa087('0x3'));var rs=require(_0xa087('0x4'));var fs=require('fs');var Redis=require(_0xa087('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa087('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa087('0x7'));var client=jayson[_0xa087('0x8')][_0xa087('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x274af8,_0x50a138,_0x5ec885){return new BPromise(function(_0x4c8ad8,_0x2c69be){return client[_0xa087('0xa')](_0x274af8,_0x5ec885)['then'](function(_0x4b69e2){logger[_0xa087('0xb')]('Pause,\x20%s,\x20%s',_0x50a138,_0xa087('0xc'));logger['debug']('Pause,\x20%s,\x20%s,\x20%s',_0x50a138,_0xa087('0xc'),JSON['stringify'](_0x4b69e2));if(_0x4b69e2[_0xa087('0xd')]){if(_0x4b69e2[_0xa087('0xd')]['code']===0x1f4){logger[_0xa087('0xd')](_0xa087('0xe'),_0x50a138,_0x4b69e2[_0xa087('0xd')][_0xa087('0xf')]);return _0x2c69be(_0x4b69e2[_0xa087('0xd')][_0xa087('0xf')]);}logger['error'](_0xa087('0xe'),_0x50a138,_0x4b69e2[_0xa087('0xd')][_0xa087('0xf')]);return _0x4c8ad8(_0x4b69e2['error'][_0xa087('0xf')]);}else{logger['info'](_0xa087('0xe'),_0x50a138,_0xa087('0xc'));_0x4c8ad8(_0x4b69e2['result'][_0xa087('0xf')]);}})[_0xa087('0x10')](function(_0x5c3fba){logger[_0xa087('0xd')](_0xa087('0xe'),_0x50a138,_0x5c3fba);_0x2c69be(_0x5c3fba);});});}exports[_0xa087('0x11')]=function(_0x3f0d90){var _0x3cc427=this;return new Promise(function(_0x204bfd,_0x338184){return db[_0xa087('0x12')][_0xa087('0x13')]({'raw':_0x3f0d90[_0xa087('0x14')]?_0x3f0d90[_0xa087('0x14')][_0xa087('0x15')]===undefined?!![]:![]:!![],'where':_0x3f0d90[_0xa087('0x14')]?_0x3f0d90['options'][_0xa087('0x16')]||null:null,'attributes':_0x3f0d90['options']?_0x3f0d90['options'][_0xa087('0x17')]||null:null,'include':_0x3f0d90[_0xa087('0x14')]?_0x3f0d90[_0xa087('0x14')][_0xa087('0x18')]?_[_0xa087('0x19')](_0x3f0d90['options'][_0xa087('0x18')],function(_0x510215){return{'model':db[_0x510215[_0xa087('0x1a')]],'as':_0x510215['as'],'attributes':_0x510215[_0xa087('0x17')],'include':_0x510215['include']?_[_0xa087('0x19')](_0x510215[_0xa087('0x18')],function(_0x53ffb4){return{'model':db[_0x53ffb4[_0xa087('0x1a')]],'as':_0x53ffb4['as'],'attributes':_0x53ffb4[_0xa087('0x17')],'include':_0x53ffb4[_0xa087('0x18')]?_[_0xa087('0x19')](_0x53ffb4[_0xa087('0x18')],function(_0x2fc044){return{'model':db[_0x2fc044['model']],'as':_0x2fc044['as'],'attributes':_0x2fc044[_0xa087('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e3b0e){logger[_0xa087('0xb')](_0xa087('0x11'),_0x3f0d90);logger[_0xa087('0x1b')](_0xa087('0x11'),_0x3f0d90,JSON[_0xa087('0x1c')](_0x5e3b0e));_0x204bfd(_0x5e3b0e);})[_0xa087('0x10')](function(_0x203478){logger[_0xa087('0xd')](_0xa087('0x11'),_0x203478[_0xa087('0xf')],_0x3f0d90);_0x338184(_0x3cc427['error'](0x1f4,_0x203478[_0xa087('0xf')]));});});}; \ No newline at end of file +var _0x8aaa=['attributes','map','info','ShowPause','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','message','Pause,\x20%s,\x20%s','result','catch','Pause','options','where','include','model'];(function(_0xe16947,_0x5ce367){var _0x508b36=function(_0x461179){while(--_0x461179){_0xe16947['push'](_0xe16947['shift']());}};_0x508b36(++_0x5ce367);}(_0x8aaa,0x64));var _0xa8aa=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x8aaa[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0xa8aa('0x0'));var util=require(_0xa8aa('0x1'));var moment=require(_0xa8aa('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8aa('0x3'));var fs=require('fs');var Redis=require(_0xa8aa('0x4'));var db=require(_0xa8aa('0x5'))['db'];var utils=require(_0xa8aa('0x6'));var logger=require(_0xa8aa('0x7'))(_0xa8aa('0x8'));var config=require(_0xa8aa('0x9'));var jayson=require(_0xa8aa('0xa'));var client=jayson['client'][_0xa8aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dbf55,_0x49064c,_0xe28e68){return new BPromise(function(_0x2339b3,_0x5b180f){return client[_0xa8aa('0xc')](_0x4dbf55,_0xe28e68)[_0xa8aa('0xd')](function(_0x4e3e8e){logger['info']('Pause,\x20%s,\x20%s',_0x49064c,_0xa8aa('0xe'));logger[_0xa8aa('0xf')](_0xa8aa('0x10'),_0x49064c,_0xa8aa('0xe'),JSON[_0xa8aa('0x11')](_0x4e3e8e));if(_0x4e3e8e[_0xa8aa('0x12')]){if(_0x4e3e8e[_0xa8aa('0x12')]['code']===0x1f4){logger[_0xa8aa('0x12')]('Pause,\x20%s,\x20%s',_0x49064c,_0x4e3e8e[_0xa8aa('0x12')][_0xa8aa('0x13')]);return _0x5b180f(_0x4e3e8e[_0xa8aa('0x12')]['message']);}logger['error'](_0xa8aa('0x14'),_0x49064c,_0x4e3e8e[_0xa8aa('0x12')]['message']);return _0x2339b3(_0x4e3e8e[_0xa8aa('0x12')][_0xa8aa('0x13')]);}else{logger['info'](_0xa8aa('0x14'),_0x49064c,_0xa8aa('0xe'));_0x2339b3(_0x4e3e8e[_0xa8aa('0x15')][_0xa8aa('0x13')]);}})[_0xa8aa('0x16')](function(_0x5de6fe){logger[_0xa8aa('0x12')](_0xa8aa('0x14'),_0x49064c,_0x5de6fe);_0x5b180f(_0x5de6fe);});});}exports['ShowPause']=function(_0x297e9d){var _0x19d0fa=this;return new Promise(function(_0x3766db,_0x3391a7){return db[_0xa8aa('0x17')]['find']({'raw':_0x297e9d[_0xa8aa('0x18')]?_0x297e9d[_0xa8aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x297e9d[_0xa8aa('0x18')]?_0x297e9d['options'][_0xa8aa('0x19')]||null:null,'attributes':_0x297e9d[_0xa8aa('0x18')]?_0x297e9d[_0xa8aa('0x18')]['attributes']||null:null,'include':_0x297e9d[_0xa8aa('0x18')]?_0x297e9d[_0xa8aa('0x18')][_0xa8aa('0x1a')]?_['map'](_0x297e9d[_0xa8aa('0x18')][_0xa8aa('0x1a')],function(_0x457acf){return{'model':db[_0x457acf[_0xa8aa('0x1b')]],'as':_0x457acf['as'],'attributes':_0x457acf[_0xa8aa('0x1c')],'include':_0x457acf[_0xa8aa('0x1a')]?_[_0xa8aa('0x1d')](_0x457acf[_0xa8aa('0x1a')],function(_0x2735d5){return{'model':db[_0x2735d5[_0xa8aa('0x1b')]],'as':_0x2735d5['as'],'attributes':_0x2735d5[_0xa8aa('0x1c')],'include':_0x2735d5[_0xa8aa('0x1a')]?_[_0xa8aa('0x1d')](_0x2735d5[_0xa8aa('0x1a')],function(_0x2c6f9d){return{'model':db[_0x2c6f9d[_0xa8aa('0x1b')]],'as':_0x2c6f9d['as'],'attributes':_0x2c6f9d['attributes']};}):[]};}):[]};}):[]:[]})[_0xa8aa('0xd')](function(_0x4b69d1){logger[_0xa8aa('0x1e')](_0xa8aa('0x1f'),_0x297e9d);logger[_0xa8aa('0xf')]('ShowPause',_0x297e9d,JSON[_0xa8aa('0x11')](_0x4b69d1));_0x3766db(_0x4b69d1);})[_0xa8aa('0x16')](function(_0x8983dc){logger[_0xa8aa('0x12')]('ShowPause',_0x8983dc[_0xa8aa('0x13')],_0x297e9d);_0x3391a7(_0x19d0fa[_0xa8aa('0x12')](0x1f4,_0x8983dc[_0xa8aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fba93da..e321998 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 _0x76d2=['join','root','server/files/plugins','originalname','%s-%s%s','extname','now','post','file','upload','webhookPost','put','/:id','update','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','show','/:id/download','isAuthenticated','download','diskStorage'];(function(_0x3b623e,_0x4b4f39){var _0x385c0e=function(_0x1ed30e){while(--_0x1ed30e){_0x3b623e['push'](_0x3b623e['shift']());}};_0x385c0e(++_0x4b4f39);}(_0x76d2,0xb0));var _0x276d=function(_0x552e46,_0x1d96b7){_0x552e46=_0x552e46-0x0;var _0x690f34=_0x76d2[_0x552e46];return _0x690f34;};'use strict';var multer=require(_0x276d('0x0'));var util=require(_0x276d('0x1'));var path=require('path');var timeout=require(_0x276d('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x276d('0x3'));var interaction=require(_0x276d('0x4'));var config=require(_0x276d('0x5'));var controller=require(_0x276d('0x6'));router[_0x276d('0x7')]('/',auth['isAuthenticated'](),controller[_0x276d('0x8')]);router[_0x276d('0x7')](_0x276d('0x9'),controller[_0x276d('0xa')]);router[_0x276d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x276d('0xb')]);router[_0x276d('0x7')](_0x276d('0xc'),auth[_0x276d('0xd')](),controller[_0x276d('0xe')]);var upload=multer({'storage':multer[_0x276d('0xf')]({'destination':function(_0x3032b8,_0x242c16,_0x32f8c8){_0x32f8c8(null,path[_0x276d('0x10')](config[_0x276d('0x11')],_0x276d('0x12')));},'filename':function(_0x58e333,_0x472897,_0xd6abf9){_0x472897[_0x276d('0x13')]=_0x472897[_0x276d('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xd6abf9(null,util['format'](_0x276d('0x14'),path['basename'](_0x472897[_0x276d('0x13')],path[_0x276d('0x15')](_0x472897[_0x276d('0x13')])),Date[_0x276d('0x16')](),path['extname'](_0x472897[_0x276d('0x13')])));}})});router[_0x276d('0x17')]('/',upload['single'](_0x276d('0x18')),controller[_0x276d('0x19')]);router[_0x276d('0x17')](_0x276d('0x9'),controller[_0x276d('0x1a')]);router[_0x276d('0x1b')](_0x276d('0x1c'),auth[_0x276d('0xd')](),controller[_0x276d('0x1d')]);router[_0x276d('0x1e')](_0x276d('0x1c'),auth[_0x276d('0xd')](),controller['delete']);module[_0x276d('0x1f')]=router; \ No newline at end of file +var _0x926a=['post','file','upload','/webhook','webhookPost','put','/:id','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','show','/:id/download','diskStorage','join','originalname','replace','format','%s-%s%s','basename','extname','now'];(function(_0x553e28,_0x173d6f){var _0x5417d0=function(_0x94deb){while(--_0x94deb){_0x553e28['push'](_0x553e28['shift']());}};_0x5417d0(++_0x173d6f);}(_0x926a,0x128));var _0xa926=function(_0x1805ff,_0x19ce4e){_0x1805ff=_0x1805ff-0x0;var _0x28312f=_0x926a[_0x1805ff];return _0x28312f;};'use strict';var multer=require(_0xa926('0x0'));var util=require(_0xa926('0x1'));var path=require(_0xa926('0x2'));var timeout=require('connect-timeout');var express=require(_0xa926('0x3'));var router=express[_0xa926('0x4')]();var auth=require(_0xa926('0x5'));var interaction=require(_0xa926('0x6'));var config=require(_0xa926('0x7'));var controller=require(_0xa926('0x8'));router[_0xa926('0x9')]('/',auth[_0xa926('0xa')](),controller[_0xa926('0xb')]);router['get']('/webhook',controller[_0xa926('0xc')]);router[_0xa926('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa926('0xd')]);router[_0xa926('0x9')](_0xa926('0xe'),auth[_0xa926('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xa926('0xf')]({'destination':function(_0x7a6ca2,_0x1b4259,_0x52c7e7){_0x52c7e7(null,path[_0xa926('0x10')](config['root'],'server/files/plugins'));},'filename':function(_0x47643d,_0x5a3003,_0x209f5e){_0x5a3003[_0xa926('0x11')]=_0x5a3003[_0xa926('0x11')][_0xa926('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x209f5e(null,util[_0xa926('0x13')](_0xa926('0x14'),path[_0xa926('0x15')](_0x5a3003[_0xa926('0x11')],path[_0xa926('0x16')](_0x5a3003[_0xa926('0x11')])),Date[_0xa926('0x17')](),path[_0xa926('0x16')](_0x5a3003[_0xa926('0x11')])));}})});router[_0xa926('0x18')]('/',upload['single'](_0xa926('0x19')),controller[_0xa926('0x1a')]);router[_0xa926('0x18')](_0xa926('0x1b'),controller[_0xa926('0x1c')]);router[_0xa926('0x1d')](_0xa926('0x1e'),auth['isAuthenticated'](),controller['update']);router[_0xa926('0x1f')](_0xa926('0x1e'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4ad77e9..c4538f3 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 _0xc368=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','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.','always'];(function(_0x2b51c2,_0x401991){var _0x234ecd=function(_0x352b0a){while(--_0x352b0a){_0x2b51c2['push'](_0x2b51c2['shift']());}};_0x234ecd(++_0x401991);}(_0xc368,0x7b));var _0x8c36=function(_0x2052e7,_0x11d520){_0x2052e7=_0x2052e7-0x0;var _0x49e584=_0xc368[_0x2052e7];return _0x49e584;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8c36('0x1')](_0x8c36('0x2'),_0x8c36('0x3'))},'description':{'type':Sequelize[_0x8c36('0x4')]},'version':{'type':Sequelize[_0x8c36('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0x8c36('0x5')},'active':{'type':Sequelize[_0x8c36('0x6')],'defaultValue':0x0,'comment':_0x8c36('0x7')},'sidebar':{'type':Sequelize[_0x8c36('0x1')]('adminOnly','agentOnly',_0x8c36('0x8'),_0x8c36('0x9')),'defaultValue':_0x8c36('0x8'),'comment':_0x8c36('0xa')},'icon':{'type':Sequelize[_0x8c36('0xb')]},'adminUrl':{'type':Sequelize[_0x8c36('0xb')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f8b=['always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly'];(function(_0x2cd8d1,_0x4b1463){var _0x57ff79=function(_0x2b7388){while(--_0x2b7388){_0x2cd8d1['push'](_0x2cd8d1['shift']());}};_0x57ff79(++_0x4b1463);}(_0x9f8b,0x12e));var _0xb9f8=function(_0xf5e2d0,_0x578e64){_0xf5e2d0=_0xf5e2d0-0x0;var _0x40fe36=_0x9f8b[_0xf5e2d0];return _0x40fe36;};'use strict';var Sequelize=require(_0xb9f8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb9f8('0x1')](_0xb9f8('0x2'),'script')},'description':{'type':Sequelize[_0xb9f8('0x3')]},'version':{'type':Sequelize[_0xb9f8('0x3')]},'path':{'type':Sequelize[_0xb9f8('0x4')],'comment':_0xb9f8('0x5')},'active':{'type':Sequelize[_0xb9f8('0x6')],'defaultValue':0x0,'comment':_0xb9f8('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0xb9f8('0x8'),_0xb9f8('0x9'),_0xb9f8('0xa'),_0xb9f8('0xb')),'defaultValue':'always','comment':_0xb9f8('0xc')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb9f8('0x4')]},'agentUrl':{'type':Sequelize[_0xb9f8('0x4')]},'scriptName':{'type':Sequelize[_0xb9f8('0x4')]},'scriptPath':{'type':Sequelize[_0xb9f8('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index eda835c..0f04656 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 _0xd8e3=['destroy','get','Plugins','UserProfileResource','error','name','send','map','Plugin','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','options','include','findAll','show','params','find','catch','download','join','root','server/files/plugins','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','attachments/**/*','close','existsSync','Error','Plugin\x20not\x20found','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','admin','views','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','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','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','endsWith','statusCode','webhookPost','method','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x352b23,_0x58e078){var _0x5ae4c3=function(_0x1c4371){while(--_0x1c4371){_0x352b23['push'](_0x352b23['shift']());}};_0x5ae4c3(++_0x58e078);}(_0xd8e3,0x7b));var _0x3d8e=function(_0x2b6a5f,_0x330b97){_0x2b6a5f=_0x2b6a5f-0x0;var _0x3e71b6=_0xd8e3[_0x2b6a5f];return _0x3e71b6;};'use strict';var pdf=require(_0x3d8e('0x0'));var emlformat=require(_0x3d8e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d8e('0x3'));var moment=require(_0x3d8e('0x4'));var BPromise=require(_0x3d8e('0x5'));var Mustache=require(_0x3d8e('0x6'));var util=require(_0x3d8e('0x7'));var path=require(_0x3d8e('0x8'));var sox=require(_0x3d8e('0x9'));var csv=require(_0x3d8e('0xa'));var ejs=require(_0x3d8e('0xb'));var fs=require('fs');var _=require(_0x3d8e('0xc'));var squel=require(_0x3d8e('0xd'));var crypto=require(_0x3d8e('0xe'));var jsforce=require(_0x3d8e('0xf'));var deskjs=require(_0x3d8e('0x10'));var toCsv=require(_0x3d8e('0xa'));var querystring=require(_0x3d8e('0x11'));var Papa=require(_0x3d8e('0x12'));var extract=require(_0x3d8e('0x13'));var rimraf=require(_0x3d8e('0x14'));var archiver=require(_0x3d8e('0x15'));var Redis=require(_0x3d8e('0x16'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3d8e('0x17'));var hardwareService=require(_0x3d8e('0x18'));var logger=require(_0x3d8e('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x3d8e('0x1a'));var licenseUtil=require(_0x3d8e('0x1b'));var db=require(_0x3d8e('0x1c'))['db'];config[_0x3d8e('0x1d')]=_[_0x3d8e('0x1e')](config[_0x3d8e('0x1d')],{'host':_0x3d8e('0x1f'),'port':0x18eb});var socket=require(_0x3d8e('0x20'))(new Redis(config[_0x3d8e('0x1d')]));require('./plugin.socket')[_0x3d8e('0x21')](socket);function respondWithStatusCode(_0x4b9b8a,_0x5e3c3e){_0x5e3c3e=_0x5e3c3e||0xcc;return function(_0x3d99d2){if(_0x3d99d2){return _0x4b9b8a[_0x3d8e('0x22')](_0x5e3c3e);}return _0x4b9b8a[_0x3d8e('0x23')](_0x5e3c3e)[_0x3d8e('0x24')]();};}function respondWithResult(_0x202ca4,_0x4a7543){_0x4a7543=_0x4a7543||0xc8;return function(_0xb80af1){if(_0xb80af1){return _0x202ca4[_0x3d8e('0x23')](_0x4a7543)[_0x3d8e('0x25')](_0xb80af1);}};}function respondWithFilteredResult(_0x483713,_0x18d5e1){return function(_0x3de0e4){if(_0x3de0e4){var _0x4bc028=_0x3de0e4[_0x3d8e('0x26')],_0x2e6418=_0x18d5e1['offset'],_0x3a4de5=_0x18d5e1[_0x3d8e('0x27')]+_0x18d5e1[_0x3d8e('0x28')],_0x531490;if(_0x3a4de5>=_0x4bc028){_0x3a4de5=_0x4bc028;_0x531490=0xc8;}else{_0x531490=0xce;}_0x483713[_0x3d8e('0x23')](_0x531490);return _0x483713[_0x3d8e('0x29')](_0x3d8e('0x2a'),_0x2e6418+'-'+_0x3a4de5+'/'+_0x4bc028)['json'](_0x3de0e4);}return null;};}function patchUpdates(_0x6dc134){return function(_0x11dbd2){try{jsonpatch[_0x3d8e('0x2b')](_0x11dbd2,_0x6dc134,!![]);}catch(_0x1faaf7){return BPromise[_0x3d8e('0x2c')](_0x1faaf7);}return _0x11dbd2[_0x3d8e('0x2d')]();};}function saveUpdates(_0x5c48e2,_0x595707){return function(_0x385c0e){if(_0x385c0e){return _0x385c0e[_0x3d8e('0x2e')](_0x5c48e2)[_0x3d8e('0x2f')](function(_0x90333f){return _0x90333f;});}return null;};}function removeEntity(_0x1683cc,_0x491940){return function(_0x5e4be2){if(_0x5e4be2){return _0x5e4be2[_0x3d8e('0x30')]()[_0x3d8e('0x2f')](function(){var _0x1bf6d8=_0x5e4be2[_0x3d8e('0x31')]({'plain':!![]});var _0x26a8da=_0x3d8e('0x32');return db[_0x3d8e('0x33')][_0x3d8e('0x30')]({'where':{'type':_0x26a8da,'resourceId':_0x1bf6d8['id']}})['then'](function(){return _0x5e4be2;});})[_0x3d8e('0x2f')](function(){_0x1683cc[_0x3d8e('0x23')](0xcc)[_0x3d8e('0x24')]();});}};}function handleEntityNotFound(_0x1b095b,_0x18fb2d){return function(_0x1b51ca){if(!_0x1b51ca){_0x1b095b['sendStatus'](0x194);}return _0x1b51ca;};}function handleError(_0xf838d3,_0x56879f){_0x56879f=_0x56879f||0x1f4;return function(_0x30baa4){logger[_0x3d8e('0x34')](_0x30baa4['stack']);if(_0x30baa4['name']){delete _0x30baa4[_0x3d8e('0x35')];}_0xf838d3[_0x3d8e('0x23')](_0x56879f)[_0x3d8e('0x36')](_0x30baa4);};}exports['index']=function(_0x35cda1,_0xbcb1){var _0x482be7={},_0x1f020b={},_0x616b2e={'count':0x0,'rows':[]};var _0x3166e0=_[_0x3d8e('0x37')](db[_0x3d8e('0x38')][_0x3d8e('0x39')],function(_0x59f7e5){return{'name':_0x59f7e5[_0x3d8e('0x3a')],'type':_0x59f7e5['type']['key']};});_0x1f020b[_0x3d8e('0x3b')]=_[_0x3d8e('0x37')](_0x3166e0,'name');_0x1f020b[_0x3d8e('0x3c')]=_[_0x3d8e('0x3d')](_0x35cda1[_0x3d8e('0x3c')]);_0x1f020b[_0x3d8e('0x3e')]=_[_0x3d8e('0x3f')](_0x1f020b[_0x3d8e('0x3b')],_0x1f020b[_0x3d8e('0x3c')]);_0x482be7[_0x3d8e('0x40')]=_[_0x3d8e('0x3f')](_0x1f020b[_0x3d8e('0x3b')],qs[_0x3d8e('0x41')](_0x35cda1[_0x3d8e('0x3c')][_0x3d8e('0x41')]));_0x482be7['attributes']=_0x482be7[_0x3d8e('0x40')][_0x3d8e('0x42')]?_0x482be7[_0x3d8e('0x40')]:_0x1f020b[_0x3d8e('0x3b')];if(!_0x35cda1['query'][_0x3d8e('0x43')](_0x3d8e('0x44'))){_0x482be7['limit']=qs['limit'](_0x35cda1[_0x3d8e('0x3c')][_0x3d8e('0x28')]);_0x482be7[_0x3d8e('0x27')]=qs[_0x3d8e('0x27')](_0x35cda1['query'][_0x3d8e('0x27')]);}_0x482be7['order']=qs[_0x3d8e('0x45')](_0x35cda1[_0x3d8e('0x3c')]['sort']);_0x482be7[_0x3d8e('0x46')]=qs['filters'](_['pick'](_0x35cda1[_0x3d8e('0x3c')],_0x1f020b[_0x3d8e('0x3e')]),_0x3166e0);if(_0x35cda1[_0x3d8e('0x3c')][_0x3d8e('0x47')]){_0x482be7[_0x3d8e('0x46')]=_[_0x3d8e('0x48')](_0x482be7[_0x3d8e('0x46')],{'$or':_[_0x3d8e('0x37')](_0x3166e0,function(_0x1575d9){if(_0x1575d9[_0x3d8e('0x49')]!=='VIRTUAL'){var _0x50b962={};_0x50b962[_0x1575d9['name']]={'$like':'%'+_0x35cda1[_0x3d8e('0x3c')][_0x3d8e('0x47')]+'%'};return _0x50b962;}})});}_0x482be7=_[_0x3d8e('0x48')]({},_0x482be7,_0x35cda1[_0x3d8e('0x4a')]);var _0x5c7f29={'where':_0x482be7[_0x3d8e('0x46')]};return db[_0x3d8e('0x38')]['count'](_0x5c7f29)[_0x3d8e('0x2f')](function(_0x30d2c5){_0x616b2e[_0x3d8e('0x26')]=_0x30d2c5;if(_0x35cda1['query']['includeAll']){_0x482be7[_0x3d8e('0x4b')]=[{'all':!![]}];}return db[_0x3d8e('0x38')][_0x3d8e('0x4c')](_0x482be7);})[_0x3d8e('0x2f')](function(_0x2e78e1){_0x616b2e['rows']=_0x2e78e1;return _0x616b2e;})[_0x3d8e('0x2f')](respondWithFilteredResult(_0xbcb1,_0x482be7))['catch'](handleError(_0xbcb1,null));};exports[_0x3d8e('0x4d')]=function(_0x42c65c,_0x34d0bf){var _0x4a32bd={'raw':!![],'where':{'id':_0x42c65c[_0x3d8e('0x4e')]['id']}},_0x344958={};_0x344958[_0x3d8e('0x3b')]=_[_0x3d8e('0x3d')](db[_0x3d8e('0x38')][_0x3d8e('0x39')]);_0x344958[_0x3d8e('0x3c')]=_[_0x3d8e('0x3d')](_0x42c65c[_0x3d8e('0x3c')]);_0x344958['filtears']=_[_0x3d8e('0x3f')](_0x344958[_0x3d8e('0x3b')],_0x344958[_0x3d8e('0x3c')]);_0x4a32bd['attributes']=_[_0x3d8e('0x3f')](_0x344958[_0x3d8e('0x3b')],qs[_0x3d8e('0x41')](_0x42c65c['query'][_0x3d8e('0x41')]));_0x4a32bd[_0x3d8e('0x40')]=_0x4a32bd['attributes']['length']?_0x4a32bd['attributes']:_0x344958[_0x3d8e('0x3b')];if(_0x42c65c[_0x3d8e('0x3c')]['includeAll']){_0x4a32bd[_0x3d8e('0x4b')]=[{'all':!![]}];}_0x4a32bd=_['merge']({},_0x4a32bd,_0x42c65c['options']);return db[_0x3d8e('0x38')][_0x3d8e('0x4f')](_0x4a32bd)['then'](handleEntityNotFound(_0x34d0bf,null))[_0x3d8e('0x2f')](respondWithResult(_0x34d0bf,null))[_0x3d8e('0x50')](handleError(_0x34d0bf,null));};exports[_0x3d8e('0x51')]=function(_0x59b246,_0x8527b5,_0x48a688){return db[_0x3d8e('0x38')][_0x3d8e('0x4f')]({'where':{'id':_0x59b246[_0x3d8e('0x4e')]['id']},'attributes':[_0x3d8e('0x35'),'path'],'raw':!![]})[_0x3d8e('0x2f')](handleEntityNotFound(_0x8527b5,null))[_0x3d8e('0x2f')](function(_0x5e74f3){if(_0x5e74f3){var _0x2c4cac=path[_0x3d8e('0x52')](config[_0x3d8e('0x53')],_0x3d8e('0x54'),util['format']('%s.zip',path[_0x3d8e('0x55')](_0x5e74f3[_0x3d8e('0x8')])));var _0x6a7b6e=fs[_0x3d8e('0x56')](_0x2c4cac);var _0x13158b=archiver(_0x3d8e('0x57'),{'zlib':{'level':0x9}});_0x13158b['on'](_0x3d8e('0x58'),function(_0xc1c029){if(_0xc1c029['code']===_0x3d8e('0x59')){logger[_0x3d8e('0x34')](_0xc1c029);}else{throw new db[(_0x3d8e('0x5a'))]['Error'](_0x3d8e('0x5b'));}});_0x13158b['on']('error',function(_0x413992){throw new db[(_0x3d8e('0x5a'))]['Error'](_0x3d8e('0x5b'));});_0x13158b[_0x3d8e('0x5c')](_0x6a7b6e);_0x13158b[_0x3d8e('0x5d')]('**/*',{'cwd':path[_0x3d8e('0x52')](config['root'],'server/files/plugins',path[_0x3d8e('0x5e')](_0x5e74f3[_0x3d8e('0x8')])),'ignore':[path[_0x3d8e('0x52')](path[_0x3d8e('0x55')](_0x5e74f3[_0x3d8e('0x8')]),'node_modules/**/*'),path[_0x3d8e('0x52')](path[_0x3d8e('0x55')](_0x5e74f3[_0x3d8e('0x8')]),_0x3d8e('0x5f'))],'nodir':!![]})['finalize']();_0x6a7b6e['on'](_0x3d8e('0x60'),function(){if(!fs[_0x3d8e('0x61')](_0x2c4cac)){throw new db[(_0x3d8e('0x5a'))][(_0x3d8e('0x62'))](_0x3d8e('0x63'));}return _0x8527b5[_0x3d8e('0x51')](_0x2c4cac,util[_0x3d8e('0x64')](_0x3d8e('0x65'),path['basename'](_0x5e74f3[_0x3d8e('0x8')])),function(_0x47549e){if(_0x47549e){throw new db[(_0x3d8e('0x5a'))][(_0x3d8e('0x62'))](_0x3d8e('0x66'));}fs[_0x3d8e('0x67')](_0x2c4cac);logger[_0x3d8e('0x68')](_0x3d8e('0x69'));logger[_0x3d8e('0x68')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x8527b5,null));};exports['upload']=function(_0x490775,_0x23f1cf,_0x5994ee){var _0x2a509f=path[_0x3d8e('0x55')](_0x490775[_0x3d8e('0x6a')]['filename'],path['extname'](_0x490775[_0x3d8e('0x6a')]['filename']));var _0x5595b7=path['join'](config[_0x3d8e('0x53')],'server/files/plugins',_0x490775[_0x3d8e('0x6a')][_0x3d8e('0x6b')]);var _0x34db5a=path[_0x3d8e('0x52')](config[_0x3d8e('0x53')],'server/files/plugins',_0x2a509f);logger[_0x3d8e('0x68')](_0x3d8e('0x6c'),_0x5595b7);logger[_0x3d8e('0x68')](_0x3d8e('0x6d'),_0x34db5a);try{fs[_0x3d8e('0x6e')](_0x5595b7,parseInt(_0x3d8e('0x6f'),0x8));extract(_0x5595b7,{'dir':_0x34db5a},function(_0x2a63bb){if(_0x2a63bb){logger[_0x3d8e('0x34')](_0x2a63bb);handleError(_0x2a63bb,!![]);};var _0x3fbc74=fs['readdirSync'](_0x34db5a);if(_0x3fbc74[_0x3d8e('0x42')]>0x1){removeReferences(_0x5595b7,_0x34db5a);logger[_0x3d8e('0x34')]('Invalid\x20plugin\x20structure');return _0x5994ee(new Error(_0x3d8e('0x70')));}var _0x5bc31b=fs[_0x3d8e('0x71')](path[_0x3d8e('0x52')](_0x34db5a,_0x3fbc74[0x0]));if(_0x5bc31b['isFile']()){removeReferences(_0x5595b7,_0x34db5a);logger[_0x3d8e('0x34')](_0x3d8e('0x70'));return _0x5994ee(new Error('Invalid\x20plugin\x20structure'));}if(_0x5bc31b[_0x3d8e('0x72')]()){var _0x23a05e=fs[_0x3d8e('0x73')](path['join'](_0x34db5a,_0x3fbc74[0x0]));if(_0x23a05e[_0x3d8e('0x42')]===0x0){removeReferences(_0x5595b7,_0x34db5a);logger[_0x3d8e('0x34')](_0x3d8e('0x70'));return _0x5994ee(new Error('Invalid\x20plugin\x20structure'));}var _0x199a24=_0x23a05e[_0x3d8e('0x74')](function(_0x1242ad){return _0x1242ad===_0x3d8e('0x75');});if(!_0x199a24){return _0x5994ee(new Error(_0x3d8e('0x76')));}var _0x1e0215=fs[_0x3d8e('0x77')](path[_0x3d8e('0x52')](_0x34db5a,_0x3fbc74[0x0],_0x3d8e('0x75')));var _0x4d1996=JSON[_0x3d8e('0x78')](_0x1e0215);if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x35')]){return _0x5994ee(new Error(_0x3d8e('0x7a')));}if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x49')]){return _0x5994ee(new Error(_0x3d8e('0x7b')));}if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7c')]){return _0x5994ee(new Error(_0x3d8e('0x7d')));}if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7e')]){return _0x5994ee(new Error(_0x3d8e('0x7f')));}if(_0x4d1996['type']===_0x3d8e('0x80')){if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7e')]['views']){return _0x5994ee(new Error(_0x3d8e('0x81')));}if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7e')]['views'][_0x3d8e('0x82')]&&_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')][_0x3d8e('0x84')]){return _0x5994ee(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4d1996[_0x3d8e('0x49')]==='script'){if(_0x3d8e('0x79')==typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x85')]){return _0x5994ee(new Error(_0x3d8e('0x86')));}if('undefined'==typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x87')]){return _0x5994ee(new Error(_0x3d8e('0x88')));}}else{return _0x5994ee(new Error(_0x3d8e('0x89')));}var _0x1ef5b4=_0x4d1996[_0x3d8e('0x35')];var _0x4fe902=_0x4d1996[_0x3d8e('0x8a')];var _0x1510b9=_0x4d1996[_0x3d8e('0x49')];var _0x5c5300=_0x4d1996['sidebar']?_0x4d1996['sidebar']:'always';var _0x527f0e=_0x4d1996[_0x3d8e('0x8b')]?_0x4d1996['icon']:'icon-apps';var _0x10750a='';var _0x3d4e79='';var _0x1bfaba='';var _0x5b69d0='';var _0x292109=_0x4d1996[_0x3d8e('0x7c')];if(_0x1510b9===_0x3d8e('0x80')){if(_0x3d8e('0x79')!=typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')][_0x3d8e('0x82')]){var _0x2e9794=_0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')][_0x3d8e('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x3d8e('0x8c')](_0x2e9794)){_0x10750a=path[_0x3d8e('0x52')](_0x3d8e('0x8d'),_0x2a509f,_0x3fbc74[0x0],_0x2e9794);}else{_0x10750a=_0x2e9794;}}else{logger['info'](_0x3d8e('0x8e'));}if(_0x3d8e('0x79')!=typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')]['agent']){var _0x5a2933=_0x4d1996[_0x3d8e('0x7e')]['views'][_0x3d8e('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x3d8e('0x8c')](_0x5a2933)){_0x3d4e79=path[_0x3d8e('0x52')](_0x3d8e('0x8d'),_0x2a509f,_0x3fbc74[0x0],_0x5a2933);}else{_0x3d4e79=_0x5a2933;}}else{logger[_0x3d8e('0x68')](_0x3d8e('0x8f'));}}else if(_0x1510b9===_0x3d8e('0x90')){_0x1bfaba=_0x4d1996[_0x3d8e('0x7e')]['scriptName'];_0x5b69d0=_0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x87')];if(_0x3d8e('0x79')!=typeof _0x4d1996['parameters'][_0x3d8e('0x83')]){if(_0x3d8e('0x79')!=typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')]['admin']){var _0x2e9794=_0x4d1996[_0x3d8e('0x7e')]['views'][_0x3d8e('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e9794)){_0x10750a=path['join'](_0x3d8e('0x8d'),_0x2a509f,_0x3fbc74[0x0],_0x2e9794);}else{_0x10750a=_0x2e9794;}}if(_0x3d8e('0x79')!=typeof _0x4d1996[_0x3d8e('0x7e')][_0x3d8e('0x83')][_0x3d8e('0x84')]){var _0x5a2933=_0x4d1996['parameters']['views'][_0x3d8e('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x3d8e('0x8c')](_0x5a2933)){_0x3d4e79=path[_0x3d8e('0x52')](_0x3d8e('0x8d'),_0x2a509f,_0x3fbc74[0x0],_0x5a2933);}else{_0x3d4e79=_0x5a2933;}}}}var _0x515c25={'name':_0x1ef5b4,'description':_0x4fe902,'path':path['join'](_0x2a509f,_0x3fbc74[0x0]),'type':_0x1510b9,'sidebar':_0x5c5300,'icon':_0x527f0e,'adminUrl':_0x10750a,'agentUrl':_0x3d4e79,'scriptName':_0x1bfaba,'scriptPath':_0x5b69d0,'version':_0x292109};removeReferences(_0x5595b7,null);return db['Plugin'][_0x3d8e('0x91')](_0x515c25)[_0x3d8e('0x2f')](function(_0x1fee9f){var _0x4f395f={'role':_0x490775['body']['role'],'userProfileId':_0x490775[_0x3d8e('0x92')][_0x3d8e('0x93')]};if(!_0x4f395f)throw new Error(_0x3d8e('0x94'));if(_0x4f395f[_0x3d8e('0x95')]===_0x3d8e('0x96')){var _0x2ecfa6=_0x1fee9f['get']({'plain':!![]});return db[_0x3d8e('0x97')][_0x3d8e('0x4f')]({'where':{'name':_0x3d8e('0x32'),'userProfileId':_0x4f395f[_0x3d8e('0x93')]},'raw':!![]})[_0x3d8e('0x2f')](function(_0x41b2f1){if(_0x41b2f1&&_0x41b2f1[_0x3d8e('0x98')]===0x0){return db[_0x3d8e('0x33')][_0x3d8e('0x91')]({'name':_0x2ecfa6['name'],'resourceId':_0x2ecfa6['id'],'type':_0x41b2f1[_0x3d8e('0x35')],'sectionId':_0x41b2f1['id']},{})[_0x3d8e('0x2f')](function(){return _0x1fee9f;});}else{return _0x1fee9f;}})[_0x3d8e('0x50')](function(_0x53a378){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53a378);throw _0x53a378;});}return _0x1fee9f;})[_0x3d8e('0x2f')](respondWithResult(_0x23f1cf,null))[_0x3d8e('0x50')](handleError(_0x23f1cf,null));}});}catch(_0x493a06){_0x23f1cf['status'](0x1f4)['send'](_0x493a06);}};function removeReferences(_0x4a52cd,_0x4eed6d){try{if(_0x4a52cd){fs['unlinkSync'](_0x4a52cd);logger[_0x3d8e('0x68')](_0x3d8e('0x99'));}if(_0x4eed6d){rimraf(_0x4eed6d,function(){});logger[_0x3d8e('0x68')](_0x3d8e('0x9a'));}}catch(_0x2b4fbf){logger[_0x3d8e('0x34')](_0x2b4fbf);}}exports[_0x3d8e('0x2e')]=function(_0x4e15d7,_0x483277,_0x91292c){return db[_0x3d8e('0x38')][_0x3d8e('0x4f')]({'where':{'id':_0x4e15d7[_0x3d8e('0x4e')]['id']}})[_0x3d8e('0x2f')](handleEntityNotFound(_0x483277,null))[_0x3d8e('0x2f')](saveUpdates(_0x4e15d7[_0x3d8e('0x92')],null))[_0x3d8e('0x2f')](respondWithResult(_0x483277,null))[_0x3d8e('0x50')](handleError(_0x483277,null));};exports[_0x3d8e('0x9b')]=function(_0x5f3662,_0x48d52d,_0xf0c635){return db[_0x3d8e('0x38')][_0x3d8e('0x4f')]({'where':{'id':_0x5f3662['params']['id']}})['then'](function(_0x3adfd1){if(_0x3adfd1){return _0x3adfd1[_0x3d8e('0x30')]();}})['then'](function(_0x4e3b0b){rimraf(path[_0x3d8e('0x52')](config[_0x3d8e('0x53')],'server/files/plugins',path[_0x3d8e('0x5e')](_0x4e3b0b[_0x3d8e('0x8')])),function(){});return _0x4e3b0b;})[_0x3d8e('0x2f')](handleEntityNotFound(_0x48d52d,null))[_0x3d8e('0x2f')](respondWithStatusCode(_0x48d52d,null))[_0x3d8e('0x50')](handleError(_0x48d52d,null));};exports[_0x3d8e('0x9c')]=function(_0x1f4589,_0x446a84,_0x332fe8){return BPromise[_0x3d8e('0x9d')]()[_0x3d8e('0x2f')](function(){if(!_0x1f4589[_0x3d8e('0x3c')][_0x3d8e('0x8')]){throw new Error(_0x3d8e('0x9e'));}if(!_0x1f4589[_0x3d8e('0x3c')][_0x3d8e('0x9f')]){throw new Error(_0x3d8e('0xa0'));}var _0x370bd8=_0x1f4589[_0x3d8e('0x3c')][_0x3d8e('0xa1')]?_0x1f4589['query'][_0x3d8e('0xa1')]+':'+_0x1f4589['query']['port']:_0x3d8e('0xa2')+_0x1f4589['query'][_0x3d8e('0x9f')];var _0x26abac=_0x1f4589['query']['json']?_0x1f4589[_0x3d8e('0x3c')][_0x3d8e('0x25')]:!![];var _0x166e40=_0x1f4589['query'][_0x3d8e('0xa3')]?_0x1f4589[_0x3d8e('0x3c')]['encoding']:null;var _0x20c8c6={'method':_0x1f4589['method'],'uri':util['format'](_0x3d8e('0xa4'),_0x370bd8,_0x1f4589[_0x3d8e('0x3c')]['path']),'json':_0x26abac,'resolveWithFullResponse':!![],'encoding':_0x166e40,'qs':_0x1f4589[_0x3d8e('0x3c')]};if(_0x1f4589[_0x3d8e('0xa5')]){_0x20c8c6[_0x3d8e('0xa5')]=_0x1f4589[_0x3d8e('0xa5')];if(_0x20c8c6[_0x3d8e('0xa5')][_0x3d8e('0xa6')]){delete _0x20c8c6[_0x3d8e('0xa5')][_0x3d8e('0xa6')];}}if(_0x20c8c6[_0x3d8e('0xa5')]['content-type']){delete _0x20c8c6[_0x3d8e('0xa5')]['content-type'];}return rp(_0x20c8c6);})[_0x3d8e('0x2f')](function(_0xd0079){if(_0xd0079){_0x446a84[_0x3d8e('0x29')](_0xd0079[_0x3d8e('0xa5')]);logger[_0x3d8e('0x68')](_0xd0079[_0x3d8e('0x92')]);if(_[_0x3d8e('0xa7')](_0x1f4589['query'][_0x3d8e('0x8')],_0x3d8e('0x51'))&&_0xd0079[_0x3d8e('0xa8')]==0x1f4){return _0x446a84[_0x3d8e('0x22')](_0xd0079['statusCode']);}else{return _0x446a84[_0x3d8e('0x23')](_0xd0079[_0x3d8e('0xa8')])['send'](_0xd0079[_0x3d8e('0x92')]);}}else{return _0x446a84[_0x3d8e('0x22')](0xc8);}})[_0x3d8e('0x50')](handleError(_0x446a84,null));};exports[_0x3d8e('0xa9')]=function(_0x353fb3,_0x17905b,_0xe5c6bd){return BPromise[_0x3d8e('0x9d')]()[_0x3d8e('0x2f')](function(){if(!_0x353fb3[_0x3d8e('0x3c')]['path']){throw new Error(_0x3d8e('0x9e'));}if(!_0x353fb3[_0x3d8e('0x3c')]['port']){throw new Error(_0x3d8e('0xa0'));}var _0x4c1109=_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0xa1')]?_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0xa1')]+':'+_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0x9f')]:_0x3d8e('0xa2')+_0x353fb3['query'][_0x3d8e('0x9f')];var _0x545e9b=_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0x25')]?_0x353fb3['query'][_0x3d8e('0x25')]:!![];var _0x38b12e=_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0xa3')]?_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0xa3')]:null;var _0x398d2a={'method':_0x353fb3[_0x3d8e('0xaa')],'uri':util['format'](_0x3d8e('0xa4'),_0x4c1109,_0x353fb3[_0x3d8e('0x3c')][_0x3d8e('0x8')]),'json':_0x545e9b,'resolveWithFullResponse':!![],'encoding':_0x38b12e,'body':_0x353fb3['body']};if(_0x353fb3[_0x3d8e('0xa5')]){_0x398d2a[_0x3d8e('0xa5')]=_0x353fb3[_0x3d8e('0xa5')];if(_0x398d2a[_0x3d8e('0xa5')][_0x3d8e('0xa6')]){delete _0x398d2a[_0x3d8e('0xa5')][_0x3d8e('0xa6')];}}if(_0x398d2a['headers']['content-type']){delete _0x398d2a[_0x3d8e('0xa5')]['content-type'];}return rp(_0x398d2a);})[_0x3d8e('0x2f')](function(_0x185929){if(_0x185929){_0x17905b['set'](_0x185929[_0x3d8e('0xa5')]);logger[_0x3d8e('0x68')](_0x185929[_0x3d8e('0x92')]);return _0x17905b[_0x3d8e('0x23')](_0x185929[_0x3d8e('0xa8')])['send'](_0x185929[_0x3d8e('0x92')]);}else{return _0x17905b[_0x3d8e('0x22')](0xc8);}})['catch'](handleError(_0x17905b,null));}; \ No newline at end of file +var _0x5960=['filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','length','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','http://localhost:','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','filtears','merge','find','download','join','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','root','server/files/plugins','dirname','node_modules/**/*','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file'];(function(_0x4759e6,_0x4e9dab){var _0xca75d7=function(_0x14fcb0){while(--_0x14fcb0){_0x4759e6['push'](_0x4759e6['shift']());}};_0xca75d7(++_0x4e9dab);}(_0x5960,0xef));var _0x0596=function(_0x5273da,_0x4dc8d6){_0x5273da=_0x5273da-0x0;var _0x23097d=_0x5960[_0x5273da];return _0x23097d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0596('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0596('0x1'));var rp=require(_0x0596('0x2'));var moment=require(_0x0596('0x3'));var BPromise=require(_0x0596('0x4'));var Mustache=require(_0x0596('0x5'));var util=require('util');var path=require(_0x0596('0x6'));var sox=require(_0x0596('0x7'));var csv=require(_0x0596('0x8'));var ejs=require(_0x0596('0x9'));var fs=require('fs');var _=require(_0x0596('0xa'));var squel=require(_0x0596('0xb'));var crypto=require(_0x0596('0xc'));var jsforce=require(_0x0596('0xd'));var deskjs=require(_0x0596('0xe'));var toCsv=require(_0x0596('0x8'));var querystring=require(_0x0596('0xf'));var Papa=require(_0x0596('0x10'));var extract=require(_0x0596('0x11'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x0596('0x12'));var authService=require(_0x0596('0x13'));var qs=require(_0x0596('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0596('0x15'));var logger=require(_0x0596('0x16'))(_0x0596('0x17'));var utils=require(_0x0596('0x18'));var config=require(_0x0596('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0596('0x1a'))['db'];config[_0x0596('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0596('0x1c'))(new Redis(config[_0x0596('0x1b')]));require(_0x0596('0x1d'))[_0x0596('0x1e')](socket);function respondWithStatusCode(_0x2742f1,_0x3f3a24){_0x3f3a24=_0x3f3a24||0xcc;return function(_0x2af190){if(_0x2af190){return _0x2742f1[_0x0596('0x1f')](_0x3f3a24);}return _0x2742f1[_0x0596('0x20')](_0x3f3a24)[_0x0596('0x21')]();};}function respondWithResult(_0x3c2514,_0x18f099){_0x18f099=_0x18f099||0xc8;return function(_0x47527d){if(_0x47527d){return _0x3c2514['status'](_0x18f099)['json'](_0x47527d);}};}function respondWithFilteredResult(_0x1af8b9,_0x57c9f0){return function(_0x52c44b){if(_0x52c44b){var _0x134dac=_0x52c44b[_0x0596('0x22')],_0x2b5e76=_0x57c9f0[_0x0596('0x23')],_0x1aeb11=_0x57c9f0[_0x0596('0x23')]+_0x57c9f0[_0x0596('0x24')],_0x3d82c2;if(_0x1aeb11>=_0x134dac){_0x1aeb11=_0x134dac;_0x3d82c2=0xc8;}else{_0x3d82c2=0xce;}_0x1af8b9[_0x0596('0x20')](_0x3d82c2);return _0x1af8b9[_0x0596('0x25')](_0x0596('0x26'),_0x2b5e76+'-'+_0x1aeb11+'/'+_0x134dac)[_0x0596('0x27')](_0x52c44b);}return null;};}function patchUpdates(_0x442ec1){return function(_0x2c4bc3){try{jsonpatch[_0x0596('0x28')](_0x2c4bc3,_0x442ec1,!![]);}catch(_0x1b099a){return BPromise[_0x0596('0x29')](_0x1b099a);}return _0x2c4bc3[_0x0596('0x2a')]();};}function saveUpdates(_0x1d2bc0,_0x46fa28){return function(_0xb61d9f){if(_0xb61d9f){return _0xb61d9f[_0x0596('0x2b')](_0x1d2bc0)[_0x0596('0x2c')](function(_0x2dc6a0){return _0x2dc6a0;});}return null;};}function removeEntity(_0x35d034,_0x3c8a97){return function(_0x79893c){if(_0x79893c){return _0x79893c[_0x0596('0x2d')]()[_0x0596('0x2c')](function(){var _0x2dc5e2=_0x79893c[_0x0596('0x2e')]({'plain':!![]});var _0x5116fa=_0x0596('0x2f');return db['UserProfileResource'][_0x0596('0x2d')]({'where':{'type':_0x5116fa,'resourceId':_0x2dc5e2['id']}})[_0x0596('0x2c')](function(){return _0x79893c;});})['then'](function(){_0x35d034['status'](0xcc)[_0x0596('0x21')]();});}};}function handleEntityNotFound(_0x30b25f,_0x1af495){return function(_0x2e9fa0){if(!_0x2e9fa0){_0x30b25f['sendStatus'](0x194);}return _0x2e9fa0;};}function handleError(_0x107d2f,_0x18b040){_0x18b040=_0x18b040||0x1f4;return function(_0x26f262){logger[_0x0596('0x30')](_0x26f262[_0x0596('0x31')]);if(_0x26f262[_0x0596('0x32')]){delete _0x26f262[_0x0596('0x32')];}_0x107d2f[_0x0596('0x20')](_0x18b040)[_0x0596('0x33')](_0x26f262);};}exports[_0x0596('0x34')]=function(_0x42be80,_0x1c9a86){var _0x5bc3f4={},_0x364b28={},_0x18a58b={'count':0x0,'rows':[]};var _0x32c140=_[_0x0596('0x35')](db[_0x0596('0x36')][_0x0596('0x37')],function(_0x37fc37){return{'name':_0x37fc37[_0x0596('0x38')],'type':_0x37fc37[_0x0596('0x39')][_0x0596('0x3a')]};});_0x364b28[_0x0596('0x3b')]=_[_0x0596('0x35')](_0x32c140,_0x0596('0x32'));_0x364b28[_0x0596('0x3c')]=_['keys'](_0x42be80[_0x0596('0x3c')]);_0x364b28[_0x0596('0x3d')]=_[_0x0596('0x3e')](_0x364b28[_0x0596('0x3b')],_0x364b28[_0x0596('0x3c')]);_0x5bc3f4['attributes']=_[_0x0596('0x3e')](_0x364b28[_0x0596('0x3b')],qs['fields'](_0x42be80[_0x0596('0x3c')][_0x0596('0x3f')]));_0x5bc3f4[_0x0596('0x40')]=_0x5bc3f4['attributes']['length']?_0x5bc3f4[_0x0596('0x40')]:_0x364b28[_0x0596('0x3b')];if(!_0x42be80[_0x0596('0x3c')]['hasOwnProperty'](_0x0596('0x41'))){_0x5bc3f4['limit']=qs[_0x0596('0x24')](_0x42be80[_0x0596('0x3c')][_0x0596('0x24')]);_0x5bc3f4[_0x0596('0x23')]=qs['offset'](_0x42be80['query'][_0x0596('0x23')]);}_0x5bc3f4[_0x0596('0x42')]=qs[_0x0596('0x43')](_0x42be80['query'][_0x0596('0x43')]);_0x5bc3f4[_0x0596('0x44')]=qs[_0x0596('0x3d')](_[_0x0596('0x45')](_0x42be80[_0x0596('0x3c')],_0x364b28[_0x0596('0x3d')]),_0x32c140);if(_0x42be80['query'][_0x0596('0x46')]){_0x5bc3f4[_0x0596('0x44')]=_['merge'](_0x5bc3f4[_0x0596('0x44')],{'$or':_[_0x0596('0x35')](_0x32c140,function(_0x546d75){if(_0x546d75['type']!==_0x0596('0x47')){var _0x577328={};_0x577328[_0x546d75[_0x0596('0x32')]]={'$like':'%'+_0x42be80[_0x0596('0x3c')][_0x0596('0x46')]+'%'};return _0x577328;}})});}_0x5bc3f4=_['merge']({},_0x5bc3f4,_0x42be80[_0x0596('0x48')]);var _0x19b906={'where':_0x5bc3f4[_0x0596('0x44')]};return db[_0x0596('0x36')][_0x0596('0x22')](_0x19b906)['then'](function(_0x36b892){_0x18a58b[_0x0596('0x22')]=_0x36b892;if(_0x42be80['query'][_0x0596('0x49')]){_0x5bc3f4[_0x0596('0x4a')]=[{'all':!![]}];}return db[_0x0596('0x36')][_0x0596('0x4b')](_0x5bc3f4);})[_0x0596('0x2c')](function(_0x2bc4fe){_0x18a58b['rows']=_0x2bc4fe;return _0x18a58b;})[_0x0596('0x2c')](respondWithFilteredResult(_0x1c9a86,_0x5bc3f4))[_0x0596('0x4c')](handleError(_0x1c9a86,null));};exports[_0x0596('0x4d')]=function(_0x547b6c,_0x12ebf1){var _0x5d37b7={'raw':!![],'where':{'id':_0x547b6c[_0x0596('0x4e')]['id']}},_0x1aac4a={};_0x1aac4a[_0x0596('0x3b')]=_[_0x0596('0x4f')](db['Plugin']['rawAttributes']);_0x1aac4a['query']=_[_0x0596('0x4f')](_0x547b6c[_0x0596('0x3c')]);_0x1aac4a[_0x0596('0x50')]=_[_0x0596('0x3e')](_0x1aac4a[_0x0596('0x3b')],_0x1aac4a[_0x0596('0x3c')]);_0x5d37b7[_0x0596('0x40')]=_[_0x0596('0x3e')](_0x1aac4a[_0x0596('0x3b')],qs[_0x0596('0x3f')](_0x547b6c[_0x0596('0x3c')]['fields']));_0x5d37b7[_0x0596('0x40')]=_0x5d37b7[_0x0596('0x40')]['length']?_0x5d37b7['attributes']:_0x1aac4a[_0x0596('0x3b')];if(_0x547b6c[_0x0596('0x3c')][_0x0596('0x49')]){_0x5d37b7[_0x0596('0x4a')]=[{'all':!![]}];}_0x5d37b7=_[_0x0596('0x51')]({},_0x5d37b7,_0x547b6c[_0x0596('0x48')]);return db[_0x0596('0x36')][_0x0596('0x52')](_0x5d37b7)[_0x0596('0x2c')](handleEntityNotFound(_0x12ebf1,null))[_0x0596('0x2c')](respondWithResult(_0x12ebf1,null))[_0x0596('0x4c')](handleError(_0x12ebf1,null));};exports[_0x0596('0x53')]=function(_0x5661f8,_0x35864b,_0x19c499){return db[_0x0596('0x36')]['find']({'where':{'id':_0x5661f8[_0x0596('0x4e')]['id']},'attributes':[_0x0596('0x32'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x35864b,null))[_0x0596('0x2c')](function(_0x1f94bd){if(_0x1f94bd){var _0x3baa94=path[_0x0596('0x54')](config['root'],'server/files/plugins',util[_0x0596('0x55')](_0x0596('0x56'),path[_0x0596('0x57')](_0x1f94bd[_0x0596('0x6')])));var _0x219d02=fs[_0x0596('0x58')](_0x3baa94);var _0x19d3f7=archiver('zip',{'zlib':{'level':0x9}});_0x19d3f7['on'](_0x0596('0x59'),function(_0x2376f3){if(_0x2376f3[_0x0596('0x5a')]===_0x0596('0x5b')){logger[_0x0596('0x30')](_0x2376f3);}else{throw new db[(_0x0596('0x5c'))][(_0x0596('0x5d'))](_0x0596('0x5e'));}});_0x19d3f7['on']('error',function(_0x219ab5){throw new db[(_0x0596('0x5c'))][(_0x0596('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x19d3f7[_0x0596('0x5f')](_0x219d02);_0x19d3f7['glob']('**/*',{'cwd':path[_0x0596('0x54')](config[_0x0596('0x60')],_0x0596('0x61'),path[_0x0596('0x62')](_0x1f94bd[_0x0596('0x6')])),'ignore':[path[_0x0596('0x54')](path[_0x0596('0x57')](_0x1f94bd[_0x0596('0x6')]),_0x0596('0x63')),path[_0x0596('0x54')](path[_0x0596('0x57')](_0x1f94bd[_0x0596('0x6')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x219d02['on']('close',function(){if(!fs[_0x0596('0x64')](_0x3baa94)){throw new db['Sequelize'][(_0x0596('0x5d'))](_0x0596('0x65'));}return _0x35864b[_0x0596('0x53')](_0x3baa94,util[_0x0596('0x55')](_0x0596('0x56'),path[_0x0596('0x57')](_0x1f94bd['path'])),function(_0x5dd808){if(_0x5dd808){throw new db['Sequelize'][(_0x0596('0x5d'))](_0x0596('0x66'));}fs[_0x0596('0x67')](_0x3baa94);logger[_0x0596('0x68')]('Download\x20completed');logger[_0x0596('0x68')]('Temporary\x20file\x20removed');});});}return null;})[_0x0596('0x4c')](handleError(_0x35864b,null));};exports[_0x0596('0x69')]=function(_0x4e838e,_0x16ee4f,_0x3732cb){var _0x5224ca=path[_0x0596('0x57')](_0x4e838e[_0x0596('0x6a')][_0x0596('0x6b')],path[_0x0596('0x6c')](_0x4e838e[_0x0596('0x6a')][_0x0596('0x6b')]));var _0x3a7f31=path[_0x0596('0x54')](config[_0x0596('0x60')],_0x0596('0x61'),_0x4e838e[_0x0596('0x6a')][_0x0596('0x6b')]);var _0x2aa27f=path[_0x0596('0x54')](config['root'],'server/files/plugins',_0x5224ca);logger[_0x0596('0x68')](_0x0596('0x6d'),_0x3a7f31);logger['info'](_0x0596('0x6e'),_0x2aa27f);try{fs[_0x0596('0x6f')](_0x3a7f31,parseInt(_0x0596('0x70'),0x8));extract(_0x3a7f31,{'dir':_0x2aa27f},function(_0xb57d4f){if(_0xb57d4f){logger['error'](_0xb57d4f);handleError(_0xb57d4f,!![]);};var _0x15df6c=fs[_0x0596('0x71')](_0x2aa27f);if(_0x15df6c[_0x0596('0x72')]>0x1){removeReferences(_0x3a7f31,_0x2aa27f);logger[_0x0596('0x30')](_0x0596('0x73'));return _0x3732cb(new Error(_0x0596('0x73')));}var _0x42b2c0=fs[_0x0596('0x74')](path[_0x0596('0x54')](_0x2aa27f,_0x15df6c[0x0]));if(_0x42b2c0['isFile']()){removeReferences(_0x3a7f31,_0x2aa27f);logger[_0x0596('0x30')]('Invalid\x20plugin\x20structure');return _0x3732cb(new Error(_0x0596('0x73')));}if(_0x42b2c0[_0x0596('0x75')]()){var _0x1ed671=fs[_0x0596('0x71')](path['join'](_0x2aa27f,_0x15df6c[0x0]));if(_0x1ed671['length']===0x0){removeReferences(_0x3a7f31,_0x2aa27f);logger[_0x0596('0x30')]('Invalid\x20plugin\x20structure');return _0x3732cb(new Error('Invalid\x20plugin\x20structure'));}var _0xdbb319=_0x1ed671[_0x0596('0x76')](function(_0x4305ce){return _0x4305ce===_0x0596('0x77');});if(!_0xdbb319){return _0x3732cb(new Error(_0x0596('0x78')));}var _0x4a165a=fs[_0x0596('0x79')](path[_0x0596('0x54')](_0x2aa27f,_0x15df6c[0x0],'manifest.json'));var _0x56fcdb=JSON[_0x0596('0x7a')](_0x4a165a);if('undefined'==typeof _0x56fcdb[_0x0596('0x32')]){return _0x3732cb(new Error(_0x0596('0x7b')));}if(_0x0596('0x7c')==typeof _0x56fcdb[_0x0596('0x39')]){return _0x3732cb(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x0596('0x7c')==typeof _0x56fcdb[_0x0596('0x7d')]){return _0x3732cb(new Error(_0x0596('0x7e')));}if('undefined'==typeof _0x56fcdb[_0x0596('0x7f')]){return _0x3732cb(new Error(_0x0596('0x80')));}if(_0x56fcdb['type']==='html'){if(_0x0596('0x7c')==typeof _0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')]){return _0x3732cb(new Error(_0x0596('0x82')));}if(_0x0596('0x7c')==typeof _0x56fcdb['parameters'][_0x0596('0x81')][_0x0596('0x83')]&&_0x0596('0x7c')==typeof _0x56fcdb[_0x0596('0x7f')]['views'][_0x0596('0x84')]){return _0x3732cb(new Error(_0x0596('0x85')));}}else if(_0x56fcdb[_0x0596('0x39')]===_0x0596('0x86')){if('undefined'==typeof _0x56fcdb[_0x0596('0x7f')]['scriptName']){return _0x3732cb(new Error(_0x0596('0x87')));}if(_0x0596('0x7c')==typeof _0x56fcdb[_0x0596('0x7f')][_0x0596('0x88')]){return _0x3732cb(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3732cb(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x432353=_0x56fcdb[_0x0596('0x32')];var _0x3110a4=_0x56fcdb['description'];var _0x3dc38a=_0x56fcdb['type'];var _0x2ef32b=_0x56fcdb[_0x0596('0x89')]?_0x56fcdb[_0x0596('0x89')]:_0x0596('0x8a');var _0x2f1ab4=_0x56fcdb['icon']?_0x56fcdb[_0x0596('0x8b')]:_0x0596('0x8c');var _0x209db1='';var _0x210dc9='';var _0x5688f9='';var _0x5cb0d9='';var _0x13cb66=_0x56fcdb[_0x0596('0x7d')];if(_0x3dc38a==='html'){if(_0x0596('0x7c')!=typeof _0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')][_0x0596('0x83')]){var _0x234d29=_0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0596('0x8d')](_0x234d29)){_0x209db1=path['join'](_0x0596('0x8e'),_0x5224ca,_0x15df6c[0x0],_0x234d29);}else{_0x209db1=_0x234d29;}}else{logger[_0x0596('0x68')](_0x0596('0x8f'));}if(_0x0596('0x7c')!=typeof _0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')][_0x0596('0x84')]){var _0x3fb52c=_0x56fcdb['parameters'][_0x0596('0x81')][_0x0596('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x0596('0x8d')](_0x3fb52c)){_0x210dc9=path['join'](_0x0596('0x8e'),_0x5224ca,_0x15df6c[0x0],_0x3fb52c);}else{_0x210dc9=_0x3fb52c;}}else{logger['info'](_0x0596('0x90'));}}else if(_0x3dc38a===_0x0596('0x86')){_0x5688f9=_0x56fcdb[_0x0596('0x7f')][_0x0596('0x91')];_0x5cb0d9=_0x56fcdb[_0x0596('0x7f')][_0x0596('0x88')];if(_0x0596('0x7c')!=typeof _0x56fcdb[_0x0596('0x7f')]['views']){if('undefined'!=typeof _0x56fcdb['parameters'][_0x0596('0x81')]['admin']){var _0x234d29=_0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')][_0x0596('0x83')];if(!/^(f|ht)tps?:\/\//i[_0x0596('0x8d')](_0x234d29)){_0x209db1=path[_0x0596('0x54')](_0x0596('0x8e'),_0x5224ca,_0x15df6c[0x0],_0x234d29);}else{_0x209db1=_0x234d29;}}if(_0x0596('0x7c')!=typeof _0x56fcdb['parameters'][_0x0596('0x81')][_0x0596('0x84')]){var _0x3fb52c=_0x56fcdb[_0x0596('0x7f')][_0x0596('0x81')][_0x0596('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x0596('0x8d')](_0x3fb52c)){_0x210dc9=path[_0x0596('0x54')]('plugins',_0x5224ca,_0x15df6c[0x0],_0x3fb52c);}else{_0x210dc9=_0x3fb52c;}}}}var _0x50525e={'name':_0x432353,'description':_0x3110a4,'path':path[_0x0596('0x54')](_0x5224ca,_0x15df6c[0x0]),'type':_0x3dc38a,'sidebar':_0x2ef32b,'icon':_0x2f1ab4,'adminUrl':_0x209db1,'agentUrl':_0x210dc9,'scriptName':_0x5688f9,'scriptPath':_0x5cb0d9,'version':_0x13cb66};removeReferences(_0x3a7f31,null);return db[_0x0596('0x36')][_0x0596('0x92')](_0x50525e)[_0x0596('0x2c')](function(_0x36fd08){var _0x4bff89={'role':_0x4e838e[_0x0596('0x93')][_0x0596('0x94')],'userProfileId':_0x4e838e[_0x0596('0x93')]['userProfileId']};if(!_0x4bff89)throw new Error(_0x0596('0x95'));if(_0x4bff89['role']===_0x0596('0x96')){var _0x37ee1e=_0x36fd08[_0x0596('0x2e')]({'plain':!![]});return db[_0x0596('0x97')][_0x0596('0x52')]({'where':{'name':_0x0596('0x2f'),'userProfileId':_0x4bff89['userProfileId']},'raw':!![]})['then'](function(_0x45eada){if(_0x45eada&&_0x45eada[_0x0596('0x98')]===0x0){return db[_0x0596('0x99')][_0x0596('0x92')]({'name':_0x37ee1e[_0x0596('0x32')],'resourceId':_0x37ee1e['id'],'type':_0x45eada['name'],'sectionId':_0x45eada['id']},{})['then'](function(){return _0x36fd08;});}else{return _0x36fd08;}})[_0x0596('0x4c')](function(_0x287791){logger[_0x0596('0x30')](_0x0596('0x9a'),_0x287791);throw _0x287791;});}return _0x36fd08;})[_0x0596('0x2c')](respondWithResult(_0x16ee4f,null))['catch'](handleError(_0x16ee4f,null));}});}catch(_0x1f7473){_0x16ee4f[_0x0596('0x20')](0x1f4)[_0x0596('0x33')](_0x1f7473);}};function removeReferences(_0x368018,_0x5f0f91){try{if(_0x368018){fs[_0x0596('0x67')](_0x368018);logger[_0x0596('0x68')](_0x0596('0x9b'));}if(_0x5f0f91){rimraf(_0x5f0f91,function(){});logger['info'](_0x0596('0x9c'));}}catch(_0x52bdd7){logger[_0x0596('0x30')](_0x52bdd7);}}exports[_0x0596('0x2b')]=function(_0x1bf51b,_0x420854,_0x569977){return db[_0x0596('0x36')]['find']({'where':{'id':_0x1bf51b[_0x0596('0x4e')]['id']}})[_0x0596('0x2c')](handleEntityNotFound(_0x420854,null))[_0x0596('0x2c')](saveUpdates(_0x1bf51b['body'],null))[_0x0596('0x2c')](respondWithResult(_0x420854,null))[_0x0596('0x4c')](handleError(_0x420854,null));};exports[_0x0596('0x9d')]=function(_0x2f9a4d,_0x5b2c7b,_0x32cdd1){return db['Plugin'][_0x0596('0x52')]({'where':{'id':_0x2f9a4d[_0x0596('0x4e')]['id']}})[_0x0596('0x2c')](function(_0xa648ca){if(_0xa648ca){return _0xa648ca[_0x0596('0x2d')]();}})[_0x0596('0x2c')](function(_0x52736b){rimraf(path[_0x0596('0x54')](config[_0x0596('0x60')],_0x0596('0x61'),path['dirname'](_0x52736b[_0x0596('0x6')])),function(){});return _0x52736b;})['then'](handleEntityNotFound(_0x5b2c7b,null))[_0x0596('0x2c')](respondWithStatusCode(_0x5b2c7b,null))[_0x0596('0x4c')](handleError(_0x5b2c7b,null));};exports[_0x0596('0x9e')]=function(_0x42367e,_0x13a0e3,_0x47fa27){return BPromise[_0x0596('0x9f')]()['then'](function(){if(!_0x42367e[_0x0596('0x3c')][_0x0596('0x6')]){throw new Error(_0x0596('0xa0'));}if(!_0x42367e[_0x0596('0x3c')][_0x0596('0xa1')]){throw new Error(_0x0596('0xa2'));}var _0x537573=_0x42367e[_0x0596('0x3c')]['hostname']?_0x42367e['query'][_0x0596('0xa3')]+':'+_0x42367e[_0x0596('0x3c')][_0x0596('0xa1')]:'http://localhost:'+_0x42367e['query'][_0x0596('0xa1')];var _0x406e36=_0x42367e[_0x0596('0x3c')][_0x0596('0x27')]?_0x42367e[_0x0596('0x3c')]['json']:!![];var _0x12bbbe=_0x42367e[_0x0596('0x3c')][_0x0596('0xa4')]?_0x42367e[_0x0596('0x3c')][_0x0596('0xa4')]:null;var _0x2f090e={'method':_0x42367e[_0x0596('0xa5')],'uri':util[_0x0596('0x55')](_0x0596('0xa6'),_0x537573,_0x42367e[_0x0596('0x3c')]['path']),'json':_0x406e36,'resolveWithFullResponse':!![],'encoding':_0x12bbbe,'qs':_0x42367e[_0x0596('0x3c')]};if(_0x42367e[_0x0596('0xa7')]){_0x2f090e[_0x0596('0xa7')]=_0x42367e[_0x0596('0xa7')];if(_0x2f090e['headers'][_0x0596('0xa8')]){delete _0x2f090e[_0x0596('0xa7')][_0x0596('0xa8')];}}if(_0x2f090e[_0x0596('0xa7')]['content-type']){delete _0x2f090e[_0x0596('0xa7')][_0x0596('0xa9')];}return rp(_0x2f090e);})[_0x0596('0x2c')](function(_0x464ea3){if(_0x464ea3){_0x13a0e3[_0x0596('0x25')](_0x464ea3['headers']);logger[_0x0596('0x68')](_0x464ea3['body']);if(_[_0x0596('0xaa')](_0x42367e[_0x0596('0x3c')][_0x0596('0x6')],_0x0596('0x53'))&&_0x464ea3[_0x0596('0xab')]==0x1f4){return _0x13a0e3[_0x0596('0x1f')](_0x464ea3[_0x0596('0xab')]);}else{return _0x13a0e3[_0x0596('0x20')](_0x464ea3[_0x0596('0xab')])['send'](_0x464ea3[_0x0596('0x93')]);}}else{return _0x13a0e3[_0x0596('0x1f')](0xc8);}})['catch'](handleError(_0x13a0e3,null));};exports['webhookPost']=function(_0xe47de8,_0x3ebe70,_0x5aaa6a){return BPromise[_0x0596('0x9f')]()[_0x0596('0x2c')](function(){if(!_0xe47de8[_0x0596('0x3c')][_0x0596('0x6')]){throw new Error(_0x0596('0xa0'));}if(!_0xe47de8[_0x0596('0x3c')][_0x0596('0xa1')]){throw new Error(_0x0596('0xa2'));}var _0x41560d=_0xe47de8[_0x0596('0x3c')]['hostname']?_0xe47de8[_0x0596('0x3c')][_0x0596('0xa3')]+':'+_0xe47de8[_0x0596('0x3c')][_0x0596('0xa1')]:_0x0596('0xac')+_0xe47de8[_0x0596('0x3c')][_0x0596('0xa1')];var _0x119087=_0xe47de8[_0x0596('0x3c')][_0x0596('0x27')]?_0xe47de8[_0x0596('0x3c')]['json']:!![];var _0x3ae765=_0xe47de8[_0x0596('0x3c')][_0x0596('0xa4')]?_0xe47de8['query']['encoding']:null;var _0x979942={'method':_0xe47de8[_0x0596('0xa5')],'uri':util[_0x0596('0x55')](_0x0596('0xa6'),_0x41560d,_0xe47de8[_0x0596('0x3c')][_0x0596('0x6')]),'json':_0x119087,'resolveWithFullResponse':!![],'encoding':_0x3ae765,'body':_0xe47de8[_0x0596('0x93')]};if(_0xe47de8[_0x0596('0xa7')]){_0x979942[_0x0596('0xa7')]=_0xe47de8[_0x0596('0xa7')];if(_0x979942[_0x0596('0xa7')][_0x0596('0xa8')]){delete _0x979942[_0x0596('0xa7')][_0x0596('0xa8')];}}if(_0x979942['headers'][_0x0596('0xa9')]){delete _0x979942['headers'][_0x0596('0xa9')];}return rp(_0x979942);})['then'](function(_0x14696b){if(_0x14696b){_0x3ebe70[_0x0596('0x25')](_0x14696b[_0x0596('0xa7')]);logger[_0x0596('0x68')](_0x14696b['body']);return _0x3ebe70[_0x0596('0x20')](_0x14696b[_0x0596('0xab')])[_0x0596('0x33')](_0x14696b['body']);}else{return _0x3ebe70[_0x0596('0x1f')](0xc8);}})[_0x0596('0x4c')](handleError(_0x3ebe70,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 45bbd1f..8bb11a3 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 _0x4137=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x7413('0x0'));var Plugin=require(_0x7413('0x1'))['db'][_0x7413('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x7413('0x3')](0x0);var events={'afterCreate':_0x7413('0x4'),'afterUpdate':_0x7413('0x5'),'afterDestroy':_0x7413('0x6')};function emitEvent(_0x299eea){return function(_0x258255,_0x3dc48a,_0x451a96){PluginEvents[_0x7413('0x7')](_0x299eea+':'+_0x258255['id'],_0x258255);PluginEvents['emit'](_0x299eea,_0x258255);_0x451a96(null);};}for(var e in events){if(events[_0x7413('0x8')](e)){var event=events[e];Plugin[_0x7413('0x9')](e,emitEvent(event));}}module[_0x7413('0xa')]=PluginEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','Plugin'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x2ef3,0xba));var _0x32ef=function(_0x261fe8,_0xf09e3b){_0x261fe8=_0x261fe8-0x0;var _0x2cc049=_0x2ef3[_0x261fe8];return _0x2cc049;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var Plugin=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){PluginEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);PluginEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0da273e..bb8bae7 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 _0x17ba=['define','Plugin','plugins','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x31efc1,_0x1d8ac4){var _0x355853=function(_0xa6d2db){while(--_0xa6d2db){_0x31efc1['push'](_0x31efc1['shift']());}};_0x355853(++_0x1d8ac4);}(_0x17ba,0xab));var _0xa17b=function(_0x468a3e,_0x5c912b){_0x468a3e=_0x468a3e-0x0;var _0x468f80=_0x17ba[_0x468a3e];return _0x468f80;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var logger=require('../../config/logger')(_0xa17b('0x2'));var moment=require(_0xa17b('0x3'));var BPromise=require(_0xa17b('0x4'));var rp=require(_0xa17b('0x5'));var fs=require('fs');var path=require(_0xa17b('0x6'));var rimraf=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var attributes=require(_0xa17b('0x9'));module[_0xa17b('0xa')]=function(_0x3cced2,_0xf72ed4){return _0x3cced2[_0xa17b('0xb')](_0xa17b('0xc'),attributes,{'tableName':_0xa17b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d0e=['define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./plugin.attributes'];(function(_0x1cc090,_0xea68f8){var _0x22bc43=function(_0x4e2ec7){while(--_0x4e2ec7){_0x1cc090['push'](_0x1cc090['shift']());}};_0x22bc43(++_0xea68f8);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2e5b34,_0x416dc7){_0x2e5b34=_0x2e5b34-0x0;var _0x5868b7=_0x8d0e[_0x2e5b34];return _0x5868b7;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'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 7abdf79..094db0c 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 _0x5485=['body','options','raw','CreatePlugin','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create'];(function(_0x47cf7e,_0x747762){var _0x33a890=function(_0x290fb6){while(--_0x290fb6){_0x47cf7e['push'](_0x47cf7e['shift']());}};_0x33a890(++_0x747762);}(_0x5485,0x1b6));var _0x5548=function(_0x5310ab,_0xe14d86){_0x5310ab=_0x5310ab-0x0;var _0xf44734=_0x5485[_0x5310ab];return _0xf44734;};'use strict';var _=require(_0x5548('0x0'));var util=require(_0x5548('0x1'));var moment=require('moment');var BPromise=require(_0x5548('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5548('0x3'));var db=require(_0x5548('0x4'))['db'];var utils=require(_0x5548('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5548('0x6'));var jayson=require(_0x5548('0x7'));var client=jayson[_0x5548('0x8')][_0x5548('0x9')]({'port':0x232a});config[_0x5548('0xa')]=_[_0x5548('0xb')](config[_0x5548('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5548('0xc'))(new Redis(config[_0x5548('0xa')]));require('./plugin.socket')[_0x5548('0xd')](socket);function respondWithRpcPromise(_0x46497b,_0x1c6400,_0x1c590a){return new BPromise(function(_0x2858d9,_0x1cda26){return client['request'](_0x46497b,_0x1c590a)[_0x5548('0xe')](function(_0x2cfece){logger['info'](_0x5548('0xf'),_0x1c6400,_0x5548('0x10'));logger[_0x5548('0x11')](_0x5548('0x12'),_0x1c6400,_0x5548('0x10'),JSON[_0x5548('0x13')](_0x2cfece));if(_0x2cfece[_0x5548('0x14')]){if(_0x2cfece[_0x5548('0x14')][_0x5548('0x15')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x1c6400,_0x2cfece[_0x5548('0x14')][_0x5548('0x16')]);return _0x1cda26(_0x2cfece['error'][_0x5548('0x16')]);}logger[_0x5548('0x14')](_0x5548('0xf'),_0x1c6400,_0x2cfece[_0x5548('0x14')][_0x5548('0x16')]);return _0x2858d9(_0x2cfece[_0x5548('0x14')][_0x5548('0x16')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1c6400,_0x5548('0x10'));_0x2858d9(_0x2cfece[_0x5548('0x17')][_0x5548('0x16')]);}})[_0x5548('0x18')](function(_0x391ae7){logger[_0x5548('0x14')](_0x5548('0xf'),_0x1c6400,_0x391ae7);_0x1cda26(_0x391ae7);});});}exports['CreatePlugin']=function(_0x14bd23){var _0x3549bb=this;return new Promise(function(_0x10acba,_0x3e1c57){return db[_0x5548('0x19')][_0x5548('0x1a')](_0x14bd23[_0x5548('0x1b')],{'raw':_0x14bd23[_0x5548('0x1c')]?_0x14bd23[_0x5548('0x1c')][_0x5548('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4f9362){logger['info'](_0x5548('0x1e'),_0x14bd23);logger[_0x5548('0x11')](_0x5548('0x1e'),_0x14bd23,JSON[_0x5548('0x13')](_0x4f9362));_0x10acba(_0x4f9362);})['catch'](function(_0x1ab4af){logger[_0x5548('0x14')]('CreatePlugin',_0x1ab4af['message'],_0x14bd23);_0x3e1c57(_0x3549bb[_0x5548('0x14')](0x1f4,_0x1ab4af[_0x5548('0x16')]));});});}; \ No newline at end of file +var _0xa078=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','raw','then','CreatePlugin','lodash','util','moment','bluebird'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa078,0xf4));var _0x8a07=function(_0x21e83e,_0x2def5b){_0x21e83e=_0x21e83e-0x0;var _0x4420ef=_0xa078[_0x21e83e];return _0x4420ef;};'use strict';var _=require(_0x8a07('0x0'));var util=require(_0x8a07('0x1'));var moment=require(_0x8a07('0x2'));var BPromise=require(_0x8a07('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a07('0x4'));var db=require(_0x8a07('0x5'))['db'];var utils=require(_0x8a07('0x6'));var logger=require(_0x8a07('0x7'))('rpc');var config=require(_0x8a07('0x8'));var jayson=require(_0x8a07('0x9'));var client=jayson[_0x8a07('0xa')][_0x8a07('0xb')]({'port':0x232a});config[_0x8a07('0xc')]=_[_0x8a07('0xd')](config['redis'],{'host':_0x8a07('0xe'),'port':0x18eb});var socket=require(_0x8a07('0xf'))(new Redis(config[_0x8a07('0xc')]));require(_0x8a07('0x10'))['register'](socket);function respondWithRpcPromise(_0x455017,_0x4ea1df,_0x5b7c8f){return new BPromise(function(_0x519fe8,_0x282a69){return client[_0x8a07('0x11')](_0x455017,_0x5b7c8f)['then'](function(_0xcd5ba4){logger[_0x8a07('0x12')](_0x8a07('0x13'),_0x4ea1df,_0x8a07('0x14'));logger[_0x8a07('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x4ea1df,_0x8a07('0x14'),JSON[_0x8a07('0x16')](_0xcd5ba4));if(_0xcd5ba4[_0x8a07('0x17')]){if(_0xcd5ba4['error'][_0x8a07('0x18')]===0x1f4){logger[_0x8a07('0x17')](_0x8a07('0x13'),_0x4ea1df,_0xcd5ba4['error'][_0x8a07('0x19')]);return _0x282a69(_0xcd5ba4['error']['message']);}logger['error'](_0x8a07('0x13'),_0x4ea1df,_0xcd5ba4[_0x8a07('0x17')]['message']);return _0x519fe8(_0xcd5ba4[_0x8a07('0x17')][_0x8a07('0x19')]);}else{logger[_0x8a07('0x12')](_0x8a07('0x13'),_0x4ea1df,_0x8a07('0x14'));_0x519fe8(_0xcd5ba4[_0x8a07('0x1a')]['message']);}})[_0x8a07('0x1b')](function(_0x3a1093){logger[_0x8a07('0x17')](_0x8a07('0x13'),_0x4ea1df,_0x3a1093);_0x282a69(_0x3a1093);});});}exports['CreatePlugin']=function(_0x3e2c1f){var _0x19fd6b=this;return new Promise(function(_0x556568,_0x3785d4){return db['Plugin']['create'](_0x3e2c1f['body'],{'raw':_0x3e2c1f['options']?_0x3e2c1f['options'][_0x8a07('0x1c')]===undefined?!![]:![]:!![]})[_0x8a07('0x1d')](function(_0x26acd7){logger[_0x8a07('0x12')](_0x8a07('0x1e'),_0x3e2c1f);logger[_0x8a07('0x15')](_0x8a07('0x1e'),_0x3e2c1f,JSON[_0x8a07('0x16')](_0x26acd7));_0x556568(_0x26acd7);})['catch'](function(_0x1fe6d3){logger[_0x8a07('0x17')](_0x8a07('0x1e'),_0x1fe6d3['message'],_0x3e2c1f);_0x3785d4(_0x19fd6b['error'](0x1f4,_0x1fe6d3[_0x8a07('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 558208b..c3e6eb8 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 _0xf534=['save','remove','update','emit','removeListener','register','plugin:','./plugin.events'];(function(_0x236252,_0xcbc917){var _0x3736cc=function(_0x492880){while(--_0x492880){_0x236252['push'](_0x236252['shift']());}};_0x3736cc(++_0xcbc917);}(_0xf534,0x9f));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var PluginEvents=require(_0x4f53('0x0'));var events=[_0x4f53('0x1'),_0x4f53('0x2'),_0x4f53('0x3')];function createListener(_0x396e58,_0x51437d){return function(_0xe1fd01){_0x51437d[_0x4f53('0x4')](_0x396e58,_0xe1fd01);};}function removeListener(_0x585266,_0x15f7e5){return function(){PluginEvents[_0x4f53('0x5')](_0x585266,_0x15f7e5);};}exports[_0x4f53('0x6')]=function(_0x33a4df){for(var _0x5b4f16=0x0,_0x199cd2=events['length'];_0x5b4f16<_0x199cd2;_0x5b4f16++){var _0x34c008=events[_0x5b4f16];var _0x22763e=createListener(_0x4f53('0x7')+_0x34c008,_0x33a4df);PluginEvents['on'](_0x34c008,_0x22763e);}}; \ No newline at end of file +var _0x9e6b=['register','length','./plugin.events','save','update','emit'];(function(_0x5c5255,_0x54b3e1){var _0x413a01=function(_0x4b915a){while(--_0x4b915a){_0x5c5255['push'](_0x5c5255['shift']());}};_0x413a01(++_0x54b3e1);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9e6b[_0x2641f9];return _0x585741;};'use strict';var PluginEvents=require(_0xb9e6('0x0'));var events=[_0xb9e6('0x1'),'remove',_0xb9e6('0x2')];function createListener(_0x54a988,_0x5ab0d0){return function(_0x33d064){_0x5ab0d0[_0xb9e6('0x3')](_0x54a988,_0x33d064);};}function removeListener(_0xb74c07,_0x214661){return function(){PluginEvents['removeListener'](_0xb74c07,_0x214661);};}exports[_0xb9e6('0x4')]=function(_0x1a6a4f){for(var _0x1b9eed=0x0,_0x4bb674=events[_0xb9e6('0x5')];_0x1b9eed<_0x4bb674;_0x1b9eed++){var _0x49565c=events[_0x1b9eed];var _0x5a54db=createListener('plugin:'+_0x49565c,_0x1a6a4f);PluginEvents['on'](_0x49565c,_0x5a54db);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b9e078d..cfebffc 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 _0xd223=['update','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd223,0xed));var _0x3d22=function(_0x212a17,_0x1749f6){_0x212a17=_0x212a17-0x0;var _0x578aa4=_0xd223[_0x212a17];return _0x578aa4;};'use strict';var express=require(_0x3d22('0x0'));var router=express[_0x3d22('0x1')]();var auth=require(_0x3d22('0x2'));var controller=require(_0x3d22('0x3'));router[_0x3d22('0x4')]('/',auth[_0x3d22('0x5')](),controller[_0x3d22('0x6')]);router[_0x3d22('0x4')](_0x3d22('0x7'),auth[_0x3d22('0x5')](),controller[_0x3d22('0x8')]);router[_0x3d22('0x9')]('/',auth[_0x3d22('0x5')](),controller['create']);router['put'](_0x3d22('0x7'),auth[_0x3d22('0x5')](),controller[_0x3d22('0xa')]);router['delete']('/:id',auth[_0x3d22('0x5')](),controller[_0x3d22('0xb')]);module[_0x3d22('0xc')]=router; \ No newline at end of file +var _0xdaf2=['/:id','isAuthenticated','post','create','update','delete','exports','express','../../components/auth/service','./pm2.controller','get','index'];(function(_0x412dc2,_0x5d2f91){var _0x5c9a74=function(_0x447743){while(--_0x447743){_0x412dc2['push'](_0x412dc2['shift']());}};_0x5c9a74(++_0x5d2f91);}(_0xdaf2,0x11b));var _0x2daf=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xdaf2[_0x59bcb1];return _0x4a737f;};'use strict';var express=require(_0x2daf('0x0'));var router=express['Router']();var auth=require(_0x2daf('0x1'));var controller=require(_0x2daf('0x2'));router[_0x2daf('0x3')]('/',auth['isAuthenticated'](),controller[_0x2daf('0x4')]);router[_0x2daf('0x3')](_0x2daf('0x5'),auth[_0x2daf('0x6')](),controller['show']);router[_0x2daf('0x7')]('/',auth[_0x2daf('0x6')](),controller[_0x2daf('0x8')]);router['put'](_0x2daf('0x5'),auth[_0x2daf('0x6')](),controller[_0x2daf('0x9')]);router[_0x2daf('0xa')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2daf('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 c9bdf51..3b3e358 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 _0xa335=['script','cwd','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','bluebird','status','error','name','send','npm\x20install','info','index','reject','express','motion2','then','catch','show','describe','params','join','../../files/plugins','body'];(function(_0x31b4e7,_0x51ed32){var _0x4411e8=function(_0x1fc2bd){while(--_0x1fc2bd){_0x31b4e7['push'](_0x31b4e7['shift']());}};_0x4411e8(++_0x51ed32);}(_0xa335,0xdc));var _0x5a33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa335[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5a33('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x5a33('0x1'))(_0x5a33('0x2'));var path=require(_0x5a33('0x3'));var exec=require(_0x5a33('0x4'))[_0x5a33('0x5')];var BPromise=require(_0x5a33('0x6'));function handleEntityNotFound(_0x14581f,_0x434c82){return function(_0x2a0409){if(!_0x2a0409){_0x14581f['sendStatus'](0x194);;}return _0x2a0409;};}function respondWithResult(_0x486fa1,_0x496178){_0x496178=_0x496178||0xc8;return function(_0x25a166){if(_0x25a166){return _0x486fa1[_0x5a33('0x7')](_0x496178)['json'](_0x25a166);}return null;};}function handleError(_0x394ac3,_0x46fb9b){_0x46fb9b=_0x46fb9b||0x1f4;return function(_0xc37232){logger[_0x5a33('0x8')](_0xc37232['stack']);if(_0xc37232['name']){delete _0xc37232[_0x5a33('0x9')];}_0x394ac3[_0x5a33('0x7')](_0x46fb9b)[_0x5a33('0xa')](_0xc37232);};}function execChildProcess(){return new BPromise(function(_0x27a089,_0x10519d){exec(_0x5a33('0xb'),function(_0x2e9805,_0x3939d3,_0x4521ae){logger[_0x5a33('0xc')](_0x3939d3);logger[_0x5a33('0xc')](_0x4521ae);if(_0x2e9805){logger[_0x5a33('0x8')](_0x2e9805);return _0x10519d(_0x2e9805);}return _0x27a089(_0x3939d3);});});}exports[_0x5a33('0xd')]=function(_0x3f9a2a,_0x579907){return pm2['list']()['then'](function(_0x350a7d){if(_0x350a7d){var _0x4cddf8=_[_0x5a33('0xe')](_0x350a7d,function(_0x3320d0){return _0x3320d0[_0x5a33('0x9')]===_0x5a33('0xf')||_0x3320d0[_0x5a33('0x9')]===_0x5a33('0x10');});return{'rows':_0x4cddf8,'count':_0x4cddf8['length']};}return null;})[_0x5a33('0x11')](respondWithResult(_0x579907,null))[_0x5a33('0x12')](handleError(_0x579907,null));};exports[_0x5a33('0x13')]=function(_0x576bc7,_0x45591c){return pm2[_0x5a33('0x14')](_0x576bc7[_0x5a33('0x15')]['id'])[_0x5a33('0x11')](respondWithResult(_0x45591c,null))[_0x5a33('0x11')](handleEntityNotFound(_0x45591c,null))[_0x5a33('0x12')](handleError(_0x45591c,null));};exports['create']=function(_0x563571,_0x576672){if(_0x563571['body'][_0x5a33('0x9')]&&_0x563571['body']['script']){var _0x4f7c35=path[_0x5a33('0x16')](__dirname,_0x5a33('0x17'),_0x563571[_0x5a33('0x18')][_0x5a33('0x19')]);var _0x576d9e=process[_0x5a33('0x1a')]();process['chdir'](path[_0x5a33('0x1b')](_0x4f7c35));return execChildProcess()[_0x5a33('0x11')](function(_0x6aee58){process['chdir'](_0x576d9e);return pm2[_0x5a33('0x1c')]({'name':_0x563571[_0x5a33('0x18')][_0x5a33('0x9')],'script':_0x4f7c35});})[_0x5a33('0x11')](function(_0x19fcd2){pm2[_0x5a33('0x1d')]();return _0x19fcd2[0x0];})[_0x5a33('0x11')](respondWithResult(_0x576672,0xc9))['catch'](handleError(_0x576672,null));}else{return _0x576672[_0x5a33('0x7')](0x1f4)[_0x5a33('0xa')]({'message':_0x5a33('0x1e')});}};exports[_0x5a33('0x1f')]=function(_0xd6d73e,_0x3d8a6a){if(_0xd6d73e['body']['id']){delete _0xd6d73e['body']['id'];}var _0x4e9759={'online':'restart','stopped':'stop'};if(_0x4e9759['hasOwnProperty'](_0xd6d73e[_0x5a33('0x18')]['status'])){return pm2[_0x4e9759[_0xd6d73e[_0x5a33('0x18')]['status']]](_0xd6d73e[_0x5a33('0x15')]['id'])[_0x5a33('0x11')](respondWithResult(_0x3d8a6a,0xc8))[_0x5a33('0x12')](handleError(_0x3d8a6a,null));}else{return _0x3d8a6a['status'](0x1f4)['send']({'message':_0x5a33('0x20')});}};exports['destroy']=function(_0x4c4e67,_0x535892){if(_0x4c4e67['body']['id']){delete _0x4c4e67['body']['id'];}if(_0x4c4e67[_0x5a33('0x15')]['id']){return pm2[_0x5a33('0x21')](_0x4c4e67[_0x5a33('0x15')]['id'])[_0x5a33('0x11')](function(_0x18a499){pm2[_0x5a33('0x1d')]();return _0x18a499[0x0];})[_0x5a33('0x11')](respondWithResult(_0x535892,null))[_0x5a33('0x12')](handleError(_0x535892,null));}else{return _0x535892[_0x5a33('0x7')](0x1f4)[_0x5a33('0xa')]({'message':_0x5a33('0x22')});}}; \ No newline at end of file +var _0x5439=['../../config/logger','child_process','bluebird','sendStatus','status','json','name','send','info','index','list','then','express','motion2','length','catch','show','describe','params','create','script','join','../../files/plugins','body','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete','dump','../../config/pm2'];(function(_0xbfbc5f,_0x555b03){var _0x43dfb7=function(_0x320733){while(--_0x320733){_0xbfbc5f['push'](_0xbfbc5f['shift']());}};_0x43dfb7(++_0x555b03);}(_0x5439,0x8b));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var pm2=require(_0x9543('0x0'));var logger=require(_0x9543('0x1'))('api');var path=require('path');var exec=require(_0x9543('0x2'))['exec'];var BPromise=require(_0x9543('0x3'));function handleEntityNotFound(_0x51636b,_0x11b297){return function(_0x398a12){if(!_0x398a12){_0x51636b[_0x9543('0x4')](0x194);;}return _0x398a12;};}function respondWithResult(_0x2b35de,_0x34f84e){_0x34f84e=_0x34f84e||0xc8;return function(_0x3fc51a){if(_0x3fc51a){return _0x2b35de[_0x9543('0x5')](_0x34f84e)[_0x9543('0x6')](_0x3fc51a);}return null;};}function handleError(_0x310a46,_0x15e29a){_0x15e29a=_0x15e29a||0x1f4;return function(_0x4e266a){logger['error'](_0x4e266a['stack']);if(_0x4e266a[_0x9543('0x7')]){delete _0x4e266a[_0x9543('0x7')];}_0x310a46[_0x9543('0x5')](_0x15e29a)[_0x9543('0x8')](_0x4e266a);};}function execChildProcess(){return new BPromise(function(_0x27a2ff,_0x2b8fa0){exec('npm\x20install',function(_0x51ba84,_0x30883b,_0x581e28){logger[_0x9543('0x9')](_0x30883b);logger[_0x9543('0x9')](_0x581e28);if(_0x51ba84){logger['error'](_0x51ba84);return _0x2b8fa0(_0x51ba84);}return _0x27a2ff(_0x30883b);});});}exports[_0x9543('0xa')]=function(_0x35fbd9,_0x1c37b7){return pm2[_0x9543('0xb')]()[_0x9543('0xc')](function(_0x4e64d1){if(_0x4e64d1){var _0x55ce73=_['reject'](_0x4e64d1,function(_0x4c511d){return _0x4c511d[_0x9543('0x7')]===_0x9543('0xd')||_0x4c511d[_0x9543('0x7')]===_0x9543('0xe');});return{'rows':_0x55ce73,'count':_0x55ce73[_0x9543('0xf')]};}return null;})[_0x9543('0xc')](respondWithResult(_0x1c37b7,null))[_0x9543('0x10')](handleError(_0x1c37b7,null));};exports[_0x9543('0x11')]=function(_0x41abbd,_0x3e04e2){return pm2[_0x9543('0x12')](_0x41abbd[_0x9543('0x13')]['id'])[_0x9543('0xc')](respondWithResult(_0x3e04e2,null))['then'](handleEntityNotFound(_0x3e04e2,null))[_0x9543('0x10')](handleError(_0x3e04e2,null));};exports[_0x9543('0x14')]=function(_0x4b275c,_0x414c26){if(_0x4b275c['body'][_0x9543('0x7')]&&_0x4b275c['body'][_0x9543('0x15')]){var _0x3b521d=path[_0x9543('0x16')](__dirname,_0x9543('0x17'),_0x4b275c[_0x9543('0x18')][_0x9543('0x15')]);var _0x40825a=process[_0x9543('0x19')]();process[_0x9543('0x1a')](path['dirname'](_0x3b521d));return execChildProcess()[_0x9543('0xc')](function(_0x3db240){process[_0x9543('0x1a')](_0x40825a);return pm2[_0x9543('0x1b')]({'name':_0x4b275c[_0x9543('0x18')][_0x9543('0x7')],'script':_0x3b521d});})['then'](function(_0x53d516){pm2['dump']();return _0x53d516[0x0];})[_0x9543('0xc')](respondWithResult(_0x414c26,0xc9))[_0x9543('0x10')](handleError(_0x414c26,null));}else{return _0x414c26[_0x9543('0x5')](0x1f4)[_0x9543('0x8')]({'message':_0x9543('0x1c')});}};exports[_0x9543('0x1d')]=function(_0x35ddf8,_0x31ee4c){if(_0x35ddf8[_0x9543('0x18')]['id']){delete _0x35ddf8[_0x9543('0x18')]['id'];}var _0x46ee45={'online':_0x9543('0x1e'),'stopped':'stop'};if(_0x46ee45[_0x9543('0x1f')](_0x35ddf8['body'][_0x9543('0x5')])){return pm2[_0x46ee45[_0x35ddf8[_0x9543('0x18')][_0x9543('0x5')]]](_0x35ddf8[_0x9543('0x13')]['id'])[_0x9543('0xc')](respondWithResult(_0x31ee4c,0xc8))[_0x9543('0x10')](handleError(_0x31ee4c,null));}else{return _0x31ee4c['status'](0x1f4)['send']({'message':_0x9543('0x20')});}};exports['destroy']=function(_0x5c607a,_0x2ce061){if(_0x5c607a[_0x9543('0x18')]['id']){delete _0x5c607a[_0x9543('0x18')]['id'];}if(_0x5c607a['params']['id']){return pm2[_0x9543('0x21')](_0x5c607a[_0x9543('0x13')]['id'])[_0x9543('0xc')](function(_0x347e00){pm2[_0x9543('0x22')]();return _0x347e00[0x0];})['then'](respondWithResult(_0x2ce061,null))[_0x9543('0x10')](handleError(_0x2ce061,null));}else{return _0x2ce061[_0x9543('0x5')](0x1f4)[_0x9543('0x8')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 23526d0..8707994 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 _0x5540=['../../config/environment','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x598430,_0x2946c8){var _0x252ba2=function(_0xce9035){while(--_0xce9035){_0x598430['push'](_0x598430['shift']());}};_0x252ba2(++_0x2946c8);}(_0x5540,0x12a));var _0x0554=function(_0xd1378,_0x124efb){_0xd1378=_0xd1378-0x0;var _0x341a4f=_0x5540[_0xd1378];return _0x341a4f;};'use strict';var multer=require(_0x0554('0x0'));var util=require(_0x0554('0x1'));var path=require(_0x0554('0x2'));var timeout=require('connect-timeout');var express=require(_0x0554('0x3'));var router=express[_0x0554('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0554('0x5'));var config=require(_0x0554('0x6'));module[_0x0554('0x7')]=router; \ No newline at end of file +var _0x2a9c=['multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x108fff,_0xeae12b){var _0x5509c6=function(_0x3d984f){while(--_0x3d984f){_0x108fff['push'](_0x108fff['shift']());}};_0x5509c6(++_0xeae12b);}(_0x2a9c,0xb6));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc2a9('0x0'));var util=require(_0xc2a9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc2a9('0x2'));var router=express['Router']();var auth=require(_0xc2a9('0x3'));var interaction=require(_0xc2a9('0x4'));var config=require(_0xc2a9('0x5'));module[_0xc2a9('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 3559634..fbff8af 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 _0xdc6e=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x575d37,_0x48033b){var _0x8046bd=function(_0x6039a8){while(--_0x6039a8){_0x575d37['push'](_0x575d37['shift']());}};_0x8046bd(++_0x48033b);}(_0xdc6e,0x1b1));var _0xedc6=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xdc6e[_0x525c7b];return _0x27b33e;};'use strict';var Sequelize=require(_0xedc6('0x0'));module[_0xedc6('0x1')]={'state':{'type':Sequelize[_0xedc6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xedc6('0x3')]},'scheduledat':{'type':Sequelize[_0xedc6('0x4')]},'uniqueid':{'type':Sequelize[_0xedc6('0x3')]},'starttime':{'type':Sequelize[_0xedc6('0x4')]},'responsetime':{'type':Sequelize[_0xedc6('0x4')]},'ringtime':{'type':Sequelize[_0xedc6('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xedc6('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xedc6('0x3')]}}; \ No newline at end of file +var _0x6e11=['sequelize','STRING','DATE','INTEGER'];(function(_0x3ad88a,_0xf049b0){var _0x43aaf5=function(_0x222fba){while(--_0x222fba){_0x3ad88a['push'](_0x3ad88a['shift']());}};_0x43aaf5(++_0xf049b0);}(_0x6e11,0x110));var _0x16e1=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x6e11[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0x16e1('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x16e1('0x1')]},'scheduledat':{'type':Sequelize[_0x16e1('0x2')]},'uniqueid':{'type':Sequelize[_0x16e1('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x16e1('0x2')]},'ringtime':{'type':Sequelize[_0x16e1('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x16e1('0x1')]},'campaigntype':{'type':Sequelize[_0x16e1('0x1')]},'membername':{'type':Sequelize[_0x16e1('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3db94f1..64f753f 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 _0x1691=['define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x4875e9,_0x39d24b){var _0x1e0c45=function(_0x202b8b){while(--_0x202b8b){_0x4875e9['push'](_0x4875e9['shift']());}};_0x1e0c45(++_0x39d24b);}(_0x1691,0x1b0));var _0x1169=function(_0x5b4d0f,_0x360126){_0x5b4d0f=_0x5b4d0f-0x0;var _0x2b9cfc=_0x1691[_0x5b4d0f];return _0x2b9cfc;};'use strict';var _=require(_0x1169('0x0'));var util=require('util');var logger=require(_0x1169('0x1'))(_0x1169('0x2'));var moment=require(_0x1169('0x3'));var BPromise=require(_0x1169('0x4'));var rp=require(_0x1169('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1169('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x1169('0x7')]=function(_0xbfd506,_0x3aa82d){return _0xbfd506[_0x1169('0x8')](_0x1169('0x9'),attributes,{'tableName':_0x1169('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74b1=['exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74b1,0x197));var _0x174b=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x74b1[_0x5a6de2];return _0x2c0525;};'use strict';var _=require(_0x174b('0x0'));var util=require(_0x174b('0x1'));var logger=require('../../config/logger')(_0x174b('0x2'));var moment=require(_0x174b('0x3'));var BPromise=require(_0x174b('0x4'));var rp=require(_0x174b('0x5'));var fs=require('fs');var path=require(_0x174b('0x6'));var rimraf=require(_0x174b('0x7'));var config=require('../../config/environment');var attributes=require(_0x174b('0x8'));module[_0x174b('0x9')]=function(_0x25d290,_0x41756f){return _0x25d290[_0x174b('0xa')](_0x174b('0xb'),attributes,{'tableName':_0x174b('0xc'),'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 6333249..e6954d4 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 _0xd1c9=['error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x9cf960,_0x4a57bb){var _0x24d60b=function(_0x6bccd6){while(--_0x6bccd6){_0x9cf960['push'](_0x9cf960['shift']());}};_0x24d60b(++_0x4a57bb);}(_0xd1c9,0xfe));var _0x9d1c=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0xd1c9[_0x5951e8];return _0x20a1f5;};'use strict';var _=require(_0x9d1c('0x0'));var util=require('util');var moment=require(_0x9d1c('0x1'));var BPromise=require(_0x9d1c('0x2'));var rs=require(_0x9d1c('0x3'));var fs=require('fs');var Redis=require(_0x9d1c('0x4'));var db=require(_0x9d1c('0x5'))['db'];var utils=require(_0x9d1c('0x6'));var logger=require(_0x9d1c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d1c('0x8'));var client=jayson['client'][_0x9d1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366652,_0x1362df,_0x39f659){return new BPromise(function(_0x5b3a8c,_0x3fcbdf){return client[_0x9d1c('0xa')](_0x366652,_0x39f659)[_0x9d1c('0xb')](function(_0x3f67a8){logger[_0x9d1c('0xc')](_0x9d1c('0xd'),_0x1362df,_0x9d1c('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1362df,_0x9d1c('0xe'),JSON[_0x9d1c('0xf')](_0x3f67a8));if(_0x3f67a8[_0x9d1c('0x10')]){if(_0x3f67a8[_0x9d1c('0x10')][_0x9d1c('0x11')]===0x1f4){logger[_0x9d1c('0x10')](_0x9d1c('0xd'),_0x1362df,_0x3f67a8[_0x9d1c('0x10')]['message']);return _0x3fcbdf(_0x3f67a8['error'][_0x9d1c('0x12')]);}logger[_0x9d1c('0x10')](_0x9d1c('0xd'),_0x1362df,_0x3f67a8[_0x9d1c('0x10')][_0x9d1c('0x12')]);return _0x5b3a8c(_0x3f67a8[_0x9d1c('0x10')][_0x9d1c('0x12')]);}else{logger[_0x9d1c('0xc')](_0x9d1c('0xd'),_0x1362df,_0x9d1c('0xe'));_0x5b3a8c(_0x3f67a8['result'][_0x9d1c('0x12')]);}})[_0x9d1c('0x13')](function(_0x4bbc54){logger[_0x9d1c('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1362df,_0x4bbc54);_0x3fcbdf(_0x4bbc54);});});}exports[_0x9d1c('0x14')]=function(_0x2d9c07){var _0x4bfe2d=this;return new Promise(function(_0x33f780,_0x19ea7e){return db[_0x9d1c('0x15')][_0x9d1c('0x16')](_0x2d9c07[_0x9d1c('0x17')],{'raw':_0x2d9c07[_0x9d1c('0x18')]?_0x2d9c07[_0x9d1c('0x18')][_0x9d1c('0x19')]===undefined?!![]:![]:!![]})[_0x9d1c('0xb')](function(_0x5bcd29){logger['info'](_0x9d1c('0x14'),_0x2d9c07);logger[_0x9d1c('0x1a')](_0x9d1c('0x14'),_0x2d9c07,JSON[_0x9d1c('0xf')](_0x5bcd29));_0x33f780(_0x5bcd29);})[_0x9d1c('0x13')](function(_0x4df25f){logger[_0x9d1c('0x10')](_0x9d1c('0x14'),_0x4df25f['message'],_0x2d9c07);_0x19ea7e(_0x4bfe2d[_0x9d1c('0x10')](0x1f4,_0x4df25f[_0x9d1c('0x12')]));});});}; \ No newline at end of file +var _0x0f21=['CreateReportAgentPreview','lodash','moment','bluebird','randomstring','../../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','stringify','error','message','catch','ReportAgentPreview','create','body','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f21,0x197));var _0x10f2=function(_0x9b8ff0,_0x445d62){_0x9b8ff0=_0x9b8ff0-0x0;var _0x32fe52=_0x0f21[_0x9b8ff0];return _0x32fe52;};'use strict';var _=require(_0x10f2('0x0'));var util=require('util');var moment=require(_0x10f2('0x1'));var BPromise=require(_0x10f2('0x2'));var rs=require(_0x10f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10f2('0x4'))['db'];var utils=require(_0x10f2('0x5'));var logger=require(_0x10f2('0x6'))(_0x10f2('0x7'));var config=require(_0x10f2('0x8'));var jayson=require(_0x10f2('0x9'));var client=jayson[_0x10f2('0xa')][_0x10f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9d1c67,_0x1d42d2,_0x482d8d){return new BPromise(function(_0x53a614,_0x1252bf){return client[_0x10f2('0xc')](_0x9d1c67,_0x482d8d)[_0x10f2('0xd')](function(_0x57749e){logger[_0x10f2('0xe')](_0x10f2('0xf'),_0x1d42d2,_0x10f2('0x10'));logger[_0x10f2('0x11')](_0x10f2('0x12'),_0x1d42d2,'request\x20sent',JSON[_0x10f2('0x13')](_0x57749e));if(_0x57749e[_0x10f2('0x14')]){if(_0x57749e[_0x10f2('0x14')]['code']===0x1f4){logger[_0x10f2('0x14')](_0x10f2('0xf'),_0x1d42d2,_0x57749e['error']['message']);return _0x1252bf(_0x57749e[_0x10f2('0x14')][_0x10f2('0x15')]);}logger['error'](_0x10f2('0xf'),_0x1d42d2,_0x57749e[_0x10f2('0x14')][_0x10f2('0x15')]);return _0x53a614(_0x57749e[_0x10f2('0x14')][_0x10f2('0x15')]);}else{logger[_0x10f2('0xe')](_0x10f2('0xf'),_0x1d42d2,_0x10f2('0x10'));_0x53a614(_0x57749e['result']['message']);}})[_0x10f2('0x16')](function(_0x119f99){logger[_0x10f2('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x1d42d2,_0x119f99);_0x1252bf(_0x119f99);});});}exports['CreateReportAgentPreview']=function(_0x1bcabc){var _0x1e6389=this;return new Promise(function(_0x2138d5,_0x2b45c0){return db[_0x10f2('0x17')][_0x10f2('0x18')](_0x1bcabc[_0x10f2('0x19')],{'raw':_0x1bcabc[_0x10f2('0x1a')]?_0x1bcabc[_0x10f2('0x1a')][_0x10f2('0x1b')]===undefined?!![]:![]:!![]})[_0x10f2('0xd')](function(_0x4278a4){logger[_0x10f2('0xe')](_0x10f2('0x1c'),_0x1bcabc);logger['debug']('CreateReportAgentPreview',_0x1bcabc,JSON['stringify'](_0x4278a4));_0x2138d5(_0x4278a4);})[_0x10f2('0x16')](function(_0x429e1a){logger['error'](_0x10f2('0x1c'),_0x429e1a[_0x10f2('0x15')],_0x1bcabc);_0x2b45c0(_0x1e6389[_0x10f2('0x14')](0x1f4,_0x429e1a[_0x10f2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a18c9ac..80c99da 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 _0xe43f=['outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels'];(function(_0xe2e155,_0x11555d){var _0x137b27=function(_0x373d7f){while(--_0x373d7f){_0xe2e155['push'](_0xe2e155['shift']());}};_0x137b27(++_0x11555d);}(_0xe43f,0x1c9));var _0xfe43=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0xe43f[_0x1f16de];return _0x36cd80;};'use strict';var multer=require(_0xfe43('0x0'));var util=require(_0xfe43('0x1'));var path=require(_0xfe43('0x2'));var express=require(_0xfe43('0x3'));var router=express[_0xfe43('0x4')]();var auth=require(_0xfe43('0x5'));var controller=require('./rpc.controller');router['get'](_0xfe43('0x6'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x8')]);router[_0xfe43('0x9')](_0xfe43('0xa'),auth[_0xfe43('0x7')](),controller['voiceChannelMixMonitor']);router[_0xfe43('0x9')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0xfe43('0xb')]);router[_0xfe43('0x9')](_0xfe43('0xc'),auth[_0xfe43('0x7')](),controller['voiceQueues']);router[_0xfe43('0x9')](_0xfe43('0xd'),auth['isAuthenticated'](),controller[_0xfe43('0xe')]);router[_0xfe43('0x9')](_0xfe43('0xf'),auth['isAuthenticated'](),controller[_0xfe43('0x10')]);router[_0xfe43('0x9')](_0xfe43('0x11'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x12')]);router[_0xfe43('0x9')](_0xfe43('0x13'),auth[_0xfe43('0x7')](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0xfe43('0x7')](),controller['smsQueues']);router[_0xfe43('0x9')]('/whatsapp/queues',auth[_0xfe43('0x7')](),controller[_0xfe43('0x14')]);router[_0xfe43('0x9')](_0xfe43('0x15'),auth['isAuthenticated'](),controller[_0xfe43('0x16')]);router[_0xfe43('0x9')](_0xfe43('0x17'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x18')]);router[_0xfe43('0x9')](_0xfe43('0x19'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x1a')]);router[_0xfe43('0x9')](_0xfe43('0x1b'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x1c')]);router[_0xfe43('0x9')](_0xfe43('0x1d'),auth[_0xfe43('0x7')](),controller['voiceQueuesChannelHangup']);router[_0xfe43('0x9')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xfe43('0x7')](),controller[_0xfe43('0x1e')]);router['get'](_0xfe43('0x1f'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x20')]);router['get'](_0xfe43('0x21'),auth[_0xfe43('0x7')](),controller['outbound']);router[_0xfe43('0x9')](_0xfe43('0x22'),auth['isAuthenticated'](),controller[_0xfe43('0x23')]);router[_0xfe43('0x9')](_0xfe43('0x24'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x25')]);router[_0xfe43('0x26')](_0xfe43('0x27'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x28')]);router[_0xfe43('0x9')](_0xfe43('0x29'),auth['isAuthenticated'](),controller[_0xfe43('0x2a')]);router[_0xfe43('0x9')](_0xfe43('0x2b'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x2c')]);router[_0xfe43('0x9')](_0xfe43('0x2d'),auth['isAuthenticated'](),controller[_0xfe43('0x2e')]);router[_0xfe43('0x9')](_0xfe43('0x2f'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x30')]);router[_0xfe43('0x9')](_0xfe43('0x31'),auth[_0xfe43('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xfe43('0x9')](_0xfe43('0x32'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x33')]);router[_0xfe43('0x9')](_0xfe43('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xfe43('0x9')]('/openchannel/queues/:id/waitinginteractions',auth[_0xfe43('0x7')](),controller[_0xfe43('0x35')]);router['get'](_0xfe43('0x36'),auth['isAuthenticated'](),controller[_0xfe43('0x37')]);router['get'](_0xfe43('0x38'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x39')]);router['get']('/fax/queues/waitinginteractions',auth[_0xfe43('0x7')](),controller[_0xfe43('0x3a')]);router[_0xfe43('0x3b')](_0xfe43('0x3c'),auth[_0xfe43('0x7')](),controller['queueNotify'](_0xfe43('0x3d')));router[_0xfe43('0x9')](_0xfe43('0x3e'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x3f')]);router['post'](_0xfe43('0x40'),auth['isAuthenticated'](),controller[_0xfe43('0x41')](_0xfe43('0x42')));router['get'](_0xfe43('0x43'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x44')]);router[_0xfe43('0x3b')](_0xfe43('0x45'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x41')](_0xfe43('0x46')));router['get'](_0xfe43('0x47'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x48')]);router[_0xfe43('0x3b')](_0xfe43('0x49'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x41')]('openchannel'));router[_0xfe43('0x9')]('/openchannel/queues/:id',auth[_0xfe43('0x7')](),controller[_0xfe43('0x4a')]);router[_0xfe43('0x3b')]('/sms/queues/:id/notify',auth[_0xfe43('0x7')](),controller[_0xfe43('0x41')]('sms'));router['post'](_0xfe43('0x4b'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x41')](_0xfe43('0x4c')));router[_0xfe43('0x9')]('/sms/queues/:id',auth[_0xfe43('0x7')](),controller[_0xfe43('0x4d')]);router[_0xfe43('0x9')](_0xfe43('0x4e'),auth[_0xfe43('0x7')](),controller[_0xfe43('0x4f')]);router[_0xfe43('0x3b')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xfe43('0x50')]);module[_0xfe43('0x51')]=router; \ No newline at end of file +var _0x4da2=['get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','/agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','util','path','express','Router','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4da2,0x133));var _0x24da=function(_0x3cf5ad,_0x2d614b){_0x3cf5ad=_0x3cf5ad-0x0;var _0x3bf761=_0x4da2[_0x3cf5ad];return _0x3bf761;};'use strict';var multer=require('multer');var util=require(_0x24da('0x0'));var path=require(_0x24da('0x1'));var express=require(_0x24da('0x2'));var router=express[_0x24da('0x3')]();var auth=require(_0x24da('0x4'));var controller=require('./rpc.controller');router[_0x24da('0x5')](_0x24da('0x6'),auth[_0x24da('0x7')](),controller[_0x24da('0x8')]);router['get'](_0x24da('0x9'),auth[_0x24da('0x7')](),controller[_0x24da('0xa')]);router[_0x24da('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x24da('0xb')]);router['get'](_0x24da('0xc'),auth[_0x24da('0x7')](),controller['voiceQueues']);router[_0x24da('0x5')]('/chat/queues',auth[_0x24da('0x7')](),controller['chatQueues']);router[_0x24da('0x5')](_0x24da('0xd'),auth[_0x24da('0x7')](),controller['mailQueues']);router['get'](_0x24da('0xe'),auth['isAuthenticated'](),controller[_0x24da('0xf')]);router[_0x24da('0x5')](_0x24da('0x10'),auth[_0x24da('0x7')](),controller[_0x24da('0x11')]);router['get'](_0x24da('0x12'),auth['isAuthenticated'](),controller[_0x24da('0x13')]);router[_0x24da('0x5')](_0x24da('0x14'),auth['isAuthenticated'](),controller[_0x24da('0x15')]);router['get'](_0x24da('0x16'),auth[_0x24da('0x7')](),controller['faxQueues']);router[_0x24da('0x5')](_0x24da('0x17'),auth[_0x24da('0x7')](),controller[_0x24da('0x18')]);router[_0x24da('0x5')](_0x24da('0x19'),auth[_0x24da('0x7')](),controller[_0x24da('0x1a')]);router[_0x24da('0x5')](_0x24da('0x1b'),auth['isAuthenticated'](),controller[_0x24da('0x1c')]);router[_0x24da('0x5')](_0x24da('0x1d'),auth[_0x24da('0x7')](),controller[_0x24da('0x1e')]);router['get'](_0x24da('0x1f'),auth[_0x24da('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x24da('0x5')](_0x24da('0x20'),auth[_0x24da('0x7')](),controller[_0x24da('0x21')]);router[_0x24da('0x5')](_0x24da('0x22'),auth[_0x24da('0x7')](),controller[_0x24da('0x23')]);router['get'](_0x24da('0x24'),auth[_0x24da('0x7')](),controller['outboundChannels']);router[_0x24da('0x5')](_0x24da('0x25'),auth[_0x24da('0x7')](),controller['agents']);router[_0x24da('0x26')](_0x24da('0x27'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x24da('0x5')](_0x24da('0x28'),auth['isAuthenticated'](),controller[_0x24da('0x29')]);router['get'](_0x24da('0x2a'),auth[_0x24da('0x7')](),controller['trunks']);router[_0x24da('0x5')](_0x24da('0x2b'),auth[_0x24da('0x7')](),controller[_0x24da('0x2c')]);router[_0x24da('0x5')](_0x24da('0x2d'),auth['isAuthenticated'](),controller[_0x24da('0x2e')]);router[_0x24da('0x5')](_0x24da('0x2f'),auth[_0x24da('0x7')](),controller[_0x24da('0x30')]);router[_0x24da('0x5')](_0x24da('0x31'),auth[_0x24da('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x24da('0x5')](_0x24da('0x32'),auth['isAuthenticated'](),controller[_0x24da('0x33')]);router[_0x24da('0x5')](_0x24da('0x34'),auth[_0x24da('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x24da('0x35'),auth[_0x24da('0x7')](),controller[_0x24da('0x36')]);router['get'](_0x24da('0x37'),auth['isAuthenticated'](),controller[_0x24da('0x38')]);router[_0x24da('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x24da('0x39')]);router[_0x24da('0x3a')]('/mail/queues/:id/notify',auth[_0x24da('0x7')](),controller[_0x24da('0x3b')]('mail'));router[_0x24da('0x5')](_0x24da('0x3c'),auth[_0x24da('0x7')](),controller[_0x24da('0x3d')]);router['post'](_0x24da('0x3e'),auth['isAuthenticated'](),controller[_0x24da('0x3b')]('chat'));router['get'](_0x24da('0x3f'),auth[_0x24da('0x7')](),controller[_0x24da('0x40')]);router['post'](_0x24da('0x41'),auth[_0x24da('0x7')](),controller[_0x24da('0x3b')]('fax'));router[_0x24da('0x5')](_0x24da('0x42'),auth[_0x24da('0x7')](),controller[_0x24da('0x43')]);router['post'](_0x24da('0x44'),auth[_0x24da('0x7')](),controller[_0x24da('0x3b')]('openchannel'));router[_0x24da('0x5')](_0x24da('0x45'),auth[_0x24da('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x24da('0x46'),auth[_0x24da('0x7')](),controller[_0x24da('0x3b')](_0x24da('0x47')));router[_0x24da('0x3a')]('/whatsapp/queues/:id/notify',auth[_0x24da('0x7')](),controller[_0x24da('0x3b')]('whatsapp'));router[_0x24da('0x5')](_0x24da('0x48'),auth['isAuthenticated'](),controller[_0x24da('0x49')]);router[_0x24da('0x5')]('/whatsapp/queues/:id',auth[_0x24da('0x7')](),controller[_0x24da('0x4a')]);router['post'](_0x24da('0x4b'),auth[_0x24da('0x7')](),controller[_0x24da('0x4c')]);module[_0x24da('0x4d')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index c599df3..ac3eb00 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 _0x820d=['voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','capacity','telephones','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','Message','From','create','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','api','client','http','request','then','error','code','message','result','status','json','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview'];(function(_0x16b51e,_0x30cb17){var _0x27b91a=function(_0x131411){while(--_0x131411){_0x16b51e['push'](_0x16b51e['shift']());}};_0x27b91a(++_0x30cb17);}(_0x820d,0x159));var _0xd820=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x820d[_0x543084];return _0x306a57;};'use strict';var BPromise=require(_0xd820('0x0'));var moment=require('moment');var _=require(_0xd820('0x1'));var util=require(_0xd820('0x2'));var db=require(_0xd820('0x3'))['db'];var logger=require('../../config/logger')(_0xd820('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd820('0x5')][_0xd820('0x6')]({'port':0x232a});var mailClient=jayson[_0xd820('0x5')][_0xd820('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0xd820('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x586c97,_0x463664,_0x5a1c9a){return new BPromise(function(_0x213d2f,_0x3b0bc0){var _0x5bce9b=_0x5a1c9a?_0x5a1c9a:amiClient;return _0x5bce9b[_0xd820('0x7')](_0x586c97,_0x463664)[_0xd820('0x8')](function(_0x5a1945){if(_0x5a1945[_0xd820('0x9')]){if(_0x5a1945['error'][_0xd820('0xa')]===0x1f4){return _0x3b0bc0(_0x5a1945[_0xd820('0x9')]['message']);}return _0x213d2f(_0x5a1945[_0xd820('0x9')][_0xd820('0xb')]);}else{_0x213d2f(_0x5a1945[_0xd820('0xc')]);}})['catch'](function(_0x580145){_0x3b0bc0(_0x580145);});});}function respondWithResult(_0x28e514,_0x4b7d1f){_0x4b7d1f=_0x4b7d1f||0xc8;return function(_0x57ac37){if(_0x57ac37){return _0x28e514[_0xd820('0xd')](_0x4b7d1f)[_0xd820('0xe')](_0x57ac37);}return _0x28e514['sendStatus'](0x194);};}function handleError(_0x1eebfb,_0x48dd08){_0x48dd08=_0x48dd08||0x1f4;return function(_0xb75f6f){logger[_0xd820('0x9')](_0xb75f6f[_0xd820('0xf')]);if(_0xb75f6f['name']){delete _0xb75f6f[_0xd820('0x10')];}_0x1eebfb['status'](_0x48dd08)[_0xd820('0x11')](_0xb75f6f);};}function findById(_0x236808){return function(_0xf0969c){if(!_['isNil'](_0x236808)&&!_[_0xd820('0x12')](_0xf0969c)&&!_[_0xd820('0x12')](_0xf0969c[_0xd820('0x13')])){return _[_0xd820('0x14')](_0xf0969c[_0xd820('0x13')],function(_0x282abc){return _0x282abc['id']==_0x236808;});}return null;};}exports[_0xd820('0x15')]=function(_0x8b2323,_0x5c82e9){return respondWithRpcPromise(_0xd820('0x16'),_0x8b2323[_0xd820('0x17')])['then'](respondWithResult(_0x5c82e9,null))['catch'](handleError(_0x5c82e9,null));};exports[_0xd820('0x18')]=function(_0x510dc9,_0x15f487){return respondWithRpcPromise(_0xd820('0x19'),_['merge'](_0x510dc9[_0xd820('0x17')],_0x510dc9[_0xd820('0x1a')]))['then'](respondWithResult(_0x15f487,null))[_0xd820('0x1b')](handleError(_0x15f487,null));};exports[_0xd820('0x1c')]=function(_0x5234b4,_0xfd2bb9){return respondWithRpcPromise(_0xd820('0x1d'),_[_0xd820('0x1e')](_0x5234b4[_0xd820('0x17')],_0x5234b4['params']))[_0xd820('0x8')](respondWithResult(_0xfd2bb9,null))[_0xd820('0x1b')](handleError(_0xfd2bb9,null));};exports[_0xd820('0x1f')]=function(_0x1d16c9,_0x15d545){return respondWithRpcPromise(_0xd820('0x20'),_0x1d16c9['query'])[_0xd820('0x8')](respondWithResult(_0x15d545,null))[_0xd820('0x1b')](handleError(_0x15d545,null));};exports[_0xd820('0x21')]=function(_0x132d42,_0x13f79f){return respondWithRpcPromise('VoiceQueues',_0x132d42[_0xd820('0x17')])['then'](findById(_0x132d42[_0xd820('0x1a')]['id']))['then'](respondWithResult(_0x13f79f,null))[_0xd820('0x1b')](handleError(_0x13f79f,null));};exports[_0xd820('0x22')]=function(_0x135217,_0x411276){return respondWithRpcPromise(_0xd820('0x23'),_[_0xd820('0x1e')](_0x135217[_0xd820('0x17')],_0x135217[_0xd820('0x1a')]))[_0xd820('0x8')](respondWithResult(_0x411276,null))[_0xd820('0x1b')](handleError(_0x411276,null));};exports[_0xd820('0x24')]=function(_0x38dee3,_0x53508b){return respondWithRpcPromise(_0xd820('0x25'),_0x38dee3[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x53508b,null))[_0xd820('0x1b')](handleError(_0x53508b,null));};exports[_0xd820('0x26')]=function(_0x5a4d8a,_0x4efead){return respondWithRpcPromise(_0xd820('0x27'),_[_0xd820('0x1e')](_0x5a4d8a[_0xd820('0x17')],_0x5a4d8a[_0xd820('0x1a')]))['then'](respondWithResult(_0x4efead,null))[_0xd820('0x1b')](handleError(_0x4efead,null));};exports['voiceQueuesChannelHangup']=function(_0xa66d8f,_0x51e51d){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xd820('0x1e')](_0xa66d8f['query'],_0xa66d8f['params']))[_0xd820('0x8')](respondWithResult(_0x51e51d,null))['catch'](handleError(_0x51e51d,null));};exports[_0xd820('0x28')]=function(_0x33d392,_0x34f15d){return respondWithRpcPromise(_0xd820('0x29'),_[_0xd820('0x1e')](_0x33d392[_0xd820('0x17')],_0x33d392['params']))[_0xd820('0x8')](respondWithResult(_0x34f15d,null))[_0xd820('0x1b')](handleError(_0x34f15d,null));};exports[_0xd820('0x2a')]=function(_0x183533,_0x50f138){return respondWithRpcPromise(_0xd820('0x2b'),_0x183533[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x50f138,null))[_0xd820('0x1b')](handleError(_0x50f138,null));};exports['outboundChannels']=function(_0x27ac33,_0x1857ca){return respondWithRpcPromise(_0xd820('0x2c'),_0x27ac33[_0xd820('0x17')])['then'](respondWithResult(_0x1857ca,null))[_0xd820('0x1b')](handleError(_0x1857ca,null));};exports[_0xd820('0x2d')]=function(_0x4ddeb7,_0xb02afe){var _0x890672;return respondWithRpcPromise(_0xd820('0x2e'),_0x4ddeb7['query'])[_0xd820('0x8')](function(_0x4c95d5){_0x890672=_0x4c95d5;return respondWithRpcPromise(_0xd820('0x2e'),_0x4ddeb7[_0xd820('0x17')],routingClient);})[_0xd820('0x8')](function(_0x3bf648){return _[_0xd820('0x1e')]({},_0x3bf648,_0x890672);})[_0xd820('0x8')](respondWithResult(_0xb02afe,null))[_0xd820('0x1b')](handleError(_0xb02afe,null));};exports[_0xd820('0x2f')]=function(_0xcc9187,_0x111785){if(_0xcc9187[_0xd820('0x30')]&&_0xcc9187[_0xd820('0x30')][_0xd820('0x31')]&&_0xcc9187['user']&&_0xcc9187[_0xd820('0x32')][_0xd820('0x10')]){for(var _0x4d1f36 in _0xcc9187[_0xd820('0x30')][_0xd820('0x31')]){if(_0xcc9187['body'][_0xd820('0x31')][_0xd820('0x33')](_0x4d1f36)){db[_0xd820('0x34')][_0xd820('0x35')]({'where':{'channel':_0x4d1f36,'membername':_0xcc9187[_0xd820('0x32')]['name'],'type':_0xd820('0x36'),'exitAt':null,'uniqueid':_0xcc9187[_0xd820('0x30')][_0xd820('0x31')][_0x4d1f36]&&_0xcc9187['body']['interaction'][_0x4d1f36][_0xd820('0x37')]?{'$notIn':_0xcc9187[_0xd820('0x30')][_0xd820('0x31')][_0x4d1f36]}:{'$ne':null}}})[_0xd820('0x8')](function(_0x136c1b){var _0x4254ad=moment()[_0xd820('0x38')](_0xd820('0x39'));for(var _0xb45ede=0x0,_0x5914a6=_0x136c1b[_0xd820('0x37')];_0xb45ede<_0x5914a6;_0xb45ede+=0x1){_0x136c1b[_0xb45ede][_0xd820('0x3a')]({'exitAt':_0x4254ad});}});for(var _0x4f947b=0x0;_0x4f947b<_0xcc9187[_0xd820('0x30')]['interaction'][_0x4d1f36]['length'];_0x4f947b+=0x1){db[_0xd820('0x34')][_0xd820('0x3b')]({'where':{'channel':_0x4d1f36,'membername':_0xcc9187[_0xd820('0x32')]['name'],'type':_0xd820('0x36'),'uniqueid':_0xcc9187[_0xd820('0x30')][_0xd820('0x31')][_0x4d1f36][_0x4f947b],'exitAt':null},'defaults':{'channel':_0x4d1f36,'membername':_0xcc9187[_0xd820('0x32')][_0xd820('0x10')],'interface':_[_0xd820('0x12')](_0xcc9187['user'][_0xd820('0x3c')])?util['format'](_0xd820('0x3d'),_0xcc9187[_0xd820('0x32')][_0xd820('0x10')]):_0xcc9187['user'][_0xd820('0x3c')],'type':'INTERACTION','enterAt':moment()['format'](_0xd820('0x39')),'role':_0xd820('0x3e'),'internal':_0xcc9187['user'][_0xd820('0x3f')],'uniqueid':_0xcc9187[_0xd820('0x30')][_0xd820('0x31')][_0x4d1f36][_0x4f947b]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xcc9187[_0xd820('0x1a')]['id'],'capacity':_0xcc9187[_0xd820('0x30')][_0xd820('0x40')]},routingClient)['then'](respondWithResult(_0x111785,null))[_0xd820('0x1b')](handleError(_0x111785,null));};exports[_0xd820('0x41')]=function(_0xa8a2d3,_0x4aaa3d){return respondWithRpcPromise(_0xd820('0x42'),_0xa8a2d3[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x4aaa3d,null))[_0xd820('0x1b')](handleError(_0x4aaa3d,null));};exports['trunks']=function(_0x20cc9e,_0x546d09){return respondWithRpcPromise(_0xd820('0x43'),_0x20cc9e[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x546d09,null))[_0xd820('0x1b')](handleError(_0x546d09,null));};exports[_0xd820('0x44')]=function(_0x126d1d,_0x5829c6){return respondWithRpcPromise(_0xd820('0x45'),_0x126d1d[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x5829c6,null))[_0xd820('0x1b')](handleError(_0x5829c6,null));};exports[_0xd820('0x46')]=function(_0x303b22,_0x44f9b9){return respondWithRpcPromise(_0xd820('0x47'),_0x303b22[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x44f9b9,null))['catch'](handleError(_0x44f9b9,null));};exports[_0xd820('0x48')]=function(_0x1219b0,_0x21ff85){return respondWithRpcPromise(_0xd820('0x47'),_0x1219b0[_0xd820('0x17')],routingClient)[_0xd820('0x8')](findById(_0x1219b0[_0xd820('0x1a')]['id']))[_0xd820('0x8')](respondWithResult(_0x21ff85,null))[_0xd820('0x1b')](handleError(_0x21ff85,null));};exports[_0xd820('0x49')]=function(_0x12953a,_0x4fa1b1){return respondWithRpcPromise(_0xd820('0x4a'),_0x12953a[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x4fa1b1,null))[_0xd820('0x1b')](handleError(_0x4fa1b1,null));};exports[_0xd820('0x4b')]=function(_0x37dd6f,_0x193914){return respondWithRpcPromise(_0xd820('0x4a'),_0x37dd6f[_0xd820('0x17')],routingClient)[_0xd820('0x8')](findById(_0x37dd6f['params']['id']))[_0xd820('0x8')](respondWithResult(_0x193914,null))[_0xd820('0x1b')](handleError(_0x193914,null));};exports['mailAccounts']=function(_0xcc31f6,_0x2c8ae0){return respondWithRpcPromise(_0xd820('0x4c'),_0xcc31f6['query'],mailClient)['then'](respondWithResult(_0x2c8ae0,null))[_0xd820('0x1b')](handleError(_0x2c8ae0,null));};exports[_0xd820('0x4d')]=function(_0x25671c,_0x25ae7c){return respondWithRpcPromise('OpenchannelQueues',_0x25671c[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x25ae7c,null))[_0xd820('0x1b')](handleError(_0x25ae7c,null));};exports[_0xd820('0x4e')]=function(_0x4cf093,_0x3844cf){return respondWithRpcPromise(_0xd820('0x4f'),_0x4cf093[_0xd820('0x17')],routingClient)['then'](findById(_0x4cf093[_0xd820('0x1a')]['id']))[_0xd820('0x8')](respondWithResult(_0x3844cf,null))['catch'](handleError(_0x3844cf,null));};exports['smsQueues']=function(_0x4abb12,_0x3e1197){return respondWithRpcPromise(_0xd820('0x50'),_0x4abb12['query'],routingClient)[_0xd820('0x8')](respondWithResult(_0x3e1197,null))[_0xd820('0x1b')](handleError(_0x3e1197,null));};exports[_0xd820('0x51')]=function(_0x29f988,_0x3a1925){return respondWithRpcPromise('SmsQueues',_0x29f988[_0xd820('0x17')],routingClient)[_0xd820('0x8')](findById(_0x29f988[_0xd820('0x1a')]['id']))[_0xd820('0x8')](respondWithResult(_0x3a1925,null))[_0xd820('0x1b')](handleError(_0x3a1925,null));};exports[_0xd820('0x52')]=function(_0x1172dc,_0x90454a){return respondWithRpcPromise(_0xd820('0x53'),_0x1172dc[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x90454a,null))['catch'](handleError(_0x90454a,null));};exports[_0xd820('0x54')]=function(_0x46b886,_0x2056ea){return respondWithRpcPromise(_0xd820('0x53'),_0x46b886[_0xd820('0x17')],routingClient)[_0xd820('0x8')](findById(_0x46b886[_0xd820('0x1a')]['id']))[_0xd820('0x8')](respondWithResult(_0x2056ea,null))[_0xd820('0x1b')](handleError(_0x2056ea,null));};exports['faxQueues']=function(_0x5ea637,_0x2dc89a){return respondWithRpcPromise(_0xd820('0x55'),_0x5ea637['query'],routingClient)['then'](respondWithResult(_0x2dc89a,null))[_0xd820('0x1b')](handleError(_0x2dc89a,null));};exports[_0xd820('0x56')]=function(_0x32c855,_0x423df9){return respondWithRpcPromise(_0xd820('0x55'),_0x32c855['query'],routingClient)[_0xd820('0x8')](findById(_0x32c855['params']['id']))['then'](respondWithResult(_0x423df9,null))['catch'](handleError(_0x423df9,null));};exports[_0xd820('0x57')]=function(_0x209f00,_0x2207cf){return respondWithRpcPromise(_0xd820('0x58'),_0x209f00[_0xd820('0x17')])[_0xd820('0x8')](respondWithResult(_0x2207cf,null))[_0xd820('0x1b')](handleError(_0x2207cf,null));};exports[_0xd820('0x59')]=function(_0x2eec9f,_0x401733){return respondWithRpcPromise(_0xd820('0x5a'),_0x2eec9f[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x401733,null))[_0xd820('0x1b')](handleError(_0x401733,null));};exports[_0xd820('0x5b')]=function(_0x43e1af,_0x1ef4c4){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x43e1af[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x1ef4c4,null))[_0xd820('0x1b')](handleError(_0x1ef4c4,null));};exports[_0xd820('0x5c')]=function(_0x80c591,_0x15f0d1){return respondWithRpcPromise(_0xd820('0x5d'),_0x80c591[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x15f0d1,null))['catch'](handleError(_0x15f0d1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2a8946,_0x4b0efb){return respondWithRpcPromise(_0xd820('0x5d'),_0x2a8946[_0xd820('0x17')],routingClient)[_0xd820('0x8')](function(_0xd56133){if(_0x2a8946[_0xd820('0x17')]['type']!==undefined){var _0x1b20d7=_(_0xd56133[_0xd820('0x13')])['filter']([_0x2a8946[_0xd820('0x17')][_0xd820('0x5e')],_0x2a8946[_0xd820('0x1a')]['id']])['map'](_0xd820('0x5f'))[_0xd820('0x60')]()[_0xd820('0x61')]();return _0xd56133['rows']['filter'](function(_0x28fe8a){return _0x1b20d7['indexOf'](_0x28fe8a[_0xd820('0x5f')])>-0x1;});}else{return _0xd56133[_0xd820('0x13')]['filter'](function(_0x50f08d){return _0x50f08d['queue_id']===parseInt(_0x2a8946[_0xd820('0x1a')]['id']);});}})[_0xd820('0x8')](respondWithResult(_0x4b0efb,null))[_0xd820('0x1b')](handleError(_0x4b0efb,null));};exports[_0xd820('0x62')]=function(_0x81f035,_0x11f91f){return respondWithRpcPromise(_0xd820('0x63'),_0x81f035[_0xd820('0x17')],routingClient)[_0xd820('0x8')](respondWithResult(_0x11f91f,null))['catch'](handleError(_0x11f91f,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x1780f4,_0x279d43){return respondWithRpcPromise(_0xd820('0x64'),_0x1780f4[_0xd820('0x17')],routingClient)['then'](respondWithResult(_0x279d43,null))['catch'](handleError(_0x279d43,null));};exports['faxQueuesWaitingInteractions']=function(_0x594e61,_0x56bb56){return respondWithRpcPromise(_0xd820('0x65'),_0x594e61['query'],routingClient)[_0xd820('0x8')](respondWithResult(_0x56bb56,null))[_0xd820('0x1b')](handleError(_0x56bb56,null));};exports[_0xd820('0x66')]=function(_0x1f3cb2){return function(_0xc7a466,_0x4873f7){var _0x21bfc1,_0x48e8c1;var _0x3dc2ae=_[_0xd820('0x67')](_0x1f3cb2);var _0x58d36d=_0x1f3cb2===_0xd820('0x68')?_0xd820('0x69'):_0xd820('0x6a');return db[_0x3dc2ae+'Queue'][_0xd820('0x6b')]({'raw':!![],'where':{'id':_0xc7a466[_0xd820('0x1a')]['id']}})['then'](function(_0x11519d){if(_[_0xd820('0x12')](_0x11519d)){throw new Error(_0x3dc2ae+_0xd820('0x6c'));}_0x21bfc1=_0x11519d;return db[_0x3dc2ae+'Message'][_0xd820('0x6b')]({'where':{'id':_0xc7a466[_0xd820('0x30')][_0xd820('0x6d')]},'include':[{'model':db[_0x3dc2ae+_0xd820('0x6e')],'as':_0xd820('0x6e')},{'model':db[_0x3dc2ae+_0x58d36d],'as':'Account'}]});})[_0xd820('0x8')](function(_0x26cb44){if(_[_0xd820('0x12')](_0x26cb44)){throw new Error(_0x3dc2ae+_0xd820('0x6f'));}_0x48e8c1=_0x26cb44;return _0x26cb44[_0xd820('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd820('0x8')](function(){var _0x4008c0={'uniqueid':_0x1f3cb2+'.'+_0x48e8c1['id']+'.'+_0x48e8c1[_0xd820('0x6e')]['id'],'FromUserId':_0xc7a466['user']['id'],'type':'queue'};_0x4008c0[_0x3dc2ae+_0xd820('0x71')]=_0x48e8c1['id'];_0x4008c0[_0x3dc2ae+'InteractionId']=_0x48e8c1['Interaction']['id'];_0x4008c0['From'+_0x3dc2ae+_0x58d36d+'Id']=_0x48e8c1[_0xd820('0x6a')]['id'];_0x4008c0['To'+_0x3dc2ae+_0xd820('0x72')]=_0x21bfc1['id'];return db[_0x3dc2ae+_0xd820('0x73')]['create'](_0x4008c0);})[_0xd820('0x8')](function(){return respondWithRpcPromise(_0xd820('0x74'),{'channel':_0x1f3cb2,'interaction':_0x48e8c1['Interaction'],'message':_0x48e8c1,'account':_0x48e8c1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd820('0x75'),'appdata':_0x21bfc1['name']+','+(_0x48e8c1[_0xd820('0x6a')][_0xd820('0x76')]||0x12c),'interval':_0xd820('0x77')}]},routingClient);})[_0xd820('0x8')](respondWithResult(_0x4873f7,null))[_0xd820('0x1b')](handleError(_0x4873f7,null));};};exports[_0xd820('0x78')]=function(_0x361e91,_0x20d060){var _0x18ac85,_0x19ba81;if(_['isNil'](_0x361e91[_0xd820('0x30')]['channel'])){throw new Error(_0xd820('0x79'));}var _0x2336f6=_0x361e91[_0xd820('0x30')]['channel'];var _0x48f38d=_['capitalize'](_0x2336f6);var _0x572e01=_0x2336f6==='chat'?_0xd820('0x69'):'Account';return db['User'][_0xd820('0x6b')]({'raw':!![],'where':{'id':_0x361e91[_0xd820('0x1a')]['id'],'role':_0xd820('0x3e')}})[_0xd820('0x8')](function(_0x5f0ba8){if(_[_0xd820('0x12')](_0x5f0ba8)){throw new Error(_0xd820('0x7a'));}_0x18ac85=_0x5f0ba8;return db[_0x48f38d+_0xd820('0x7b')][_0xd820('0x6b')]({'where':{'id':_0x361e91['body']['messageId']},'include':[{'model':db[_0x48f38d+_0xd820('0x6e')],'as':_0xd820('0x6e')},{'model':db[_0x48f38d+_0x572e01],'as':_0xd820('0x6a')}]});})['then'](function(_0xdf8303){if(_[_0xd820('0x12')](_0xdf8303)){throw new Error(_0x48f38d+_0xd820('0x6f'));}_0x19ba81=_0xdf8303;return _0xdf8303[_0xd820('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd820('0x8')](function(){var _0xd698c6={'uniqueid':_0x2336f6+'.'+_0x19ba81['id']+'.'+_0x19ba81[_0xd820('0x6e')]['id'],'FromUserId':_0x361e91[_0xd820('0x32')]['id'],'type':_0xd820('0x75'),'ToUserId':_0x18ac85['id']};_0xd698c6[_0x48f38d+_0xd820('0x71')]=_0x19ba81['id'];_0xd698c6[_0x48f38d+'InteractionId']=_0x19ba81['Interaction']['id'];_0xd698c6[_0xd820('0x7c')+_0x48f38d+_0x572e01+'Id']=_0x19ba81['Account']['id'];return db[_0x48f38d+_0xd820('0x73')][_0xd820('0x7d')](_0xd698c6);})['then'](function(){return respondWithRpcPromise(_0xd820('0x74'),{'channel':_0x2336f6,'interaction':_0x19ba81[_0xd820('0x6e')],'message':_0x19ba81,'account':_0x19ba81[_0xd820('0x6a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd820('0x3e'),'appdata':_0x18ac85[_0xd820('0x10')]+','+(_0x19ba81[_0xd820('0x6a')][_0xd820('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd820('0x8')](respondWithResult(_0x20d060,null))['catch'](handleError(_0x20d060,null));}; \ No newline at end of file +var _0x71c8=['../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','query','VoiceChannelMixMonitor','merge','params','voiceQueues','showVoiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','outbound','Outbound','outboundChannels','agents','Agents','body','interaction','user','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','agent','AgentCapacity','capacity','Campaigns','chatQueues','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','QueueId','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','From','bluebird','moment','lodash'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x71c8,0x6f));var _0x871c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x71c8[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0x871c('0x0'));var moment=require(_0x871c('0x1'));var _=require(_0x871c('0x2'));var util=require('util');var db=require(_0x871c('0x3'))['db'];var logger=require(_0x871c('0x4'))(_0x871c('0x5'));var jayson=require(_0x871c('0x6'));var amiClient=jayson[_0x871c('0x7')][_0x871c('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x871c('0x8')]({'port':0x232b});var routingClient=jayson[_0x871c('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x13c847,_0x40feb8,_0x170527){return new BPromise(function(_0x2109e1,_0x632f23){var _0x4012dc=_0x170527?_0x170527:amiClient;return _0x4012dc[_0x871c('0x9')](_0x13c847,_0x40feb8)[_0x871c('0xa')](function(_0x3f6441){if(_0x3f6441['error']){if(_0x3f6441[_0x871c('0xb')][_0x871c('0xc')]===0x1f4){return _0x632f23(_0x3f6441[_0x871c('0xb')]['message']);}return _0x2109e1(_0x3f6441['error'][_0x871c('0xd')]);}else{_0x2109e1(_0x3f6441[_0x871c('0xe')]);}})[_0x871c('0xf')](function(_0x1a870b){_0x632f23(_0x1a870b);});});}function respondWithResult(_0x208ade,_0x27eea0){_0x27eea0=_0x27eea0||0xc8;return function(_0x3213b7){if(_0x3213b7){return _0x208ade[_0x871c('0x10')](_0x27eea0)[_0x871c('0x11')](_0x3213b7);}return _0x208ade[_0x871c('0x12')](0x194);};}function handleError(_0x57fd55,_0x351331){_0x351331=_0x351331||0x1f4;return function(_0x23076f){logger[_0x871c('0xb')](_0x23076f[_0x871c('0x13')]);if(_0x23076f[_0x871c('0x14')]){delete _0x23076f[_0x871c('0x14')];}_0x57fd55['status'](_0x351331)[_0x871c('0x15')](_0x23076f);};}function findById(_0x386090){return function(_0x43f12){if(!_[_0x871c('0x16')](_0x386090)&&!_[_0x871c('0x16')](_0x43f12)&&!_[_0x871c('0x16')](_0x43f12[_0x871c('0x17')])){return _['find'](_0x43f12[_0x871c('0x17')],function(_0xb839b){return _0xb839b['id']==_0x386090;});}return null;};}exports['voiceChannels']=function(_0x3d6648,_0x32102d){return respondWithRpcPromise(_0x871c('0x18'),_0x3d6648[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x32102d,null))[_0x871c('0xf')](handleError(_0x32102d,null));};exports['voiceChannelMixMonitor']=function(_0x1bfd88,_0x3f275a){return respondWithRpcPromise(_0x871c('0x1a'),_[_0x871c('0x1b')](_0x1bfd88[_0x871c('0x19')],_0x1bfd88[_0x871c('0x1c')]))[_0x871c('0xa')](respondWithResult(_0x3f275a,null))[_0x871c('0xf')](handleError(_0x3f275a,null));};exports['voiceChannelStopMixMonitor']=function(_0x393da6,_0x39b352){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x871c('0x1b')](_0x393da6['query'],_0x393da6[_0x871c('0x1c')]))[_0x871c('0xa')](respondWithResult(_0x39b352,null))[_0x871c('0xf')](handleError(_0x39b352,null));};exports[_0x871c('0x1d')]=function(_0x2c0fac,_0x845c9a){return respondWithRpcPromise('VoiceQueues',_0x2c0fac[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x845c9a,null))['catch'](handleError(_0x845c9a,null));};exports[_0x871c('0x1e')]=function(_0x25d85a,_0x4bd4b3){return respondWithRpcPromise(_0x871c('0x1f'),_0x25d85a['query'])[_0x871c('0xa')](findById(_0x25d85a[_0x871c('0x1c')]['id']))['then'](respondWithResult(_0x4bd4b3,null))['catch'](handleError(_0x4bd4b3,null));};exports[_0x871c('0x20')]=function(_0x1f7424,_0x39e746){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x871c('0x1b')](_0x1f7424[_0x871c('0x19')],_0x1f7424[_0x871c('0x1c')]))[_0x871c('0xa')](respondWithResult(_0x39e746,null))[_0x871c('0xf')](handleError(_0x39e746,null));};exports[_0x871c('0x21')]=function(_0x5e257b,_0xf85cec){return respondWithRpcPromise(_0x871c('0x22'),_0x5e257b['query'])[_0x871c('0xa')](respondWithResult(_0xf85cec,null))[_0x871c('0xf')](handleError(_0xf85cec,null));};exports[_0x871c('0x23')]=function(_0x3023a9,_0x28ac80){return respondWithRpcPromise(_0x871c('0x24'),_[_0x871c('0x1b')](_0x3023a9[_0x871c('0x19')],_0x3023a9[_0x871c('0x1c')]))[_0x871c('0xa')](respondWithResult(_0x28ac80,null))[_0x871c('0xf')](handleError(_0x28ac80,null));};exports['voiceQueuesChannelHangup']=function(_0x13ae36,_0x5a0cb5){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x871c('0x1b')](_0x13ae36[_0x871c('0x19')],_0x13ae36[_0x871c('0x1c')]))['then'](respondWithResult(_0x5a0cb5,null))[_0x871c('0xf')](handleError(_0x5a0cb5,null));};exports['voiceQueuesChannelRedirect']=function(_0x452747,_0x228916){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x871c('0x1b')](_0x452747['query'],_0x452747['params']))[_0x871c('0xa')](respondWithResult(_0x228916,null))[_0x871c('0xf')](handleError(_0x228916,null));};exports[_0x871c('0x25')]=function(_0x577261,_0x3d5300){return respondWithRpcPromise(_0x871c('0x26'),_0x577261[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x3d5300,null))[_0x871c('0xf')](handleError(_0x3d5300,null));};exports[_0x871c('0x27')]=function(_0x49a761,_0x229959){return respondWithRpcPromise('OutboundChannels',_0x49a761[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x229959,null))['catch'](handleError(_0x229959,null));};exports[_0x871c('0x28')]=function(_0x1acca3,_0x743ff7){var _0x35d0a2;return respondWithRpcPromise(_0x871c('0x29'),_0x1acca3[_0x871c('0x19')])[_0x871c('0xa')](function(_0x5f0712){_0x35d0a2=_0x5f0712;return respondWithRpcPromise(_0x871c('0x29'),_0x1acca3[_0x871c('0x19')],routingClient);})['then'](function(_0x4f8fb9){return _[_0x871c('0x1b')]({},_0x4f8fb9,_0x35d0a2);})[_0x871c('0xa')](respondWithResult(_0x743ff7,null))['catch'](handleError(_0x743ff7,null));};exports['agentCapacity']=function(_0x1f0ffd,_0x27354f){if(_0x1f0ffd[_0x871c('0x2a')]&&_0x1f0ffd['body'][_0x871c('0x2b')]&&_0x1f0ffd['user']&&_0x1f0ffd[_0x871c('0x2c')][_0x871c('0x14')]){for(var _0x3b32eb in _0x1f0ffd['body'][_0x871c('0x2b')]){if(_0x1f0ffd[_0x871c('0x2a')]['interaction']['hasOwnProperty'](_0x3b32eb)){db['MemberReport'][_0x871c('0x2d')]({'where':{'channel':_0x3b32eb,'membername':_0x1f0ffd[_0x871c('0x2c')][_0x871c('0x14')],'type':_0x871c('0x2e'),'exitAt':null,'uniqueid':_0x1f0ffd[_0x871c('0x2a')][_0x871c('0x2b')][_0x3b32eb]&&_0x1f0ffd['body']['interaction'][_0x3b32eb][_0x871c('0x2f')]?{'$notIn':_0x1f0ffd[_0x871c('0x2a')][_0x871c('0x2b')][_0x3b32eb]}:{'$ne':null}}})[_0x871c('0xa')](function(_0x5726c2){var _0xff54b4=moment()[_0x871c('0x30')](_0x871c('0x31'));for(var _0x1a1a35=0x0,_0x2816c1=_0x5726c2[_0x871c('0x2f')];_0x1a1a35<_0x2816c1;_0x1a1a35+=0x1){_0x5726c2[_0x1a1a35][_0x871c('0x32')]({'exitAt':_0xff54b4});}});for(var _0x3fe2c7=0x0;_0x3fe2c7<_0x1f0ffd[_0x871c('0x2a')]['interaction'][_0x3b32eb][_0x871c('0x2f')];_0x3fe2c7+=0x1){db[_0x871c('0x33')]['findOrCreate']({'where':{'channel':_0x3b32eb,'membername':_0x1f0ffd[_0x871c('0x2c')]['name'],'type':_0x871c('0x2e'),'uniqueid':_0x1f0ffd['body'][_0x871c('0x2b')][_0x3b32eb][_0x3fe2c7],'exitAt':null},'defaults':{'channel':_0x3b32eb,'membername':_0x1f0ffd[_0x871c('0x2c')][_0x871c('0x14')],'interface':_[_0x871c('0x16')](_0x1f0ffd[_0x871c('0x2c')]['interface'])?util[_0x871c('0x30')]('SIP/%s',_0x1f0ffd[_0x871c('0x2c')]['name']):_0x1f0ffd[_0x871c('0x2c')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x871c('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x871c('0x34'),'internal':_0x1f0ffd[_0x871c('0x2c')]['internal'],'uniqueid':_0x1f0ffd[_0x871c('0x2a')]['interaction'][_0x3b32eb][_0x3fe2c7]}});}}}}return respondWithRpcPromise(_0x871c('0x35'),{'id':_0x1f0ffd[_0x871c('0x1c')]['id'],'capacity':_0x1f0ffd[_0x871c('0x2a')][_0x871c('0x36')]},routingClient)[_0x871c('0xa')](respondWithResult(_0x27354f,null))[_0x871c('0xf')](handleError(_0x27354f,null));};exports['telephones']=function(_0x4d85c1,_0x4e1968){return respondWithRpcPromise('Telephones',_0x4d85c1[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x4e1968,null))[_0x871c('0xf')](handleError(_0x4e1968,null));};exports['trunks']=function(_0x33a825,_0x554ff1){return respondWithRpcPromise('Trunks',_0x33a825[_0x871c('0x19')])[_0x871c('0xa')](respondWithResult(_0x554ff1,null))[_0x871c('0xf')](handleError(_0x554ff1,null));};exports['campaigns']=function(_0x4cef46,_0x51704c){return respondWithRpcPromise(_0x871c('0x37'),_0x4cef46[_0x871c('0x19')])['then'](respondWithResult(_0x51704c,null))[_0x871c('0xf')](handleError(_0x51704c,null));};exports[_0x871c('0x38')]=function(_0x1b2514,_0x4d6130){return respondWithRpcPromise('ChatQueues',_0x1b2514[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0x4d6130,null))[_0x871c('0xf')](handleError(_0x4d6130,null));};exports[_0x871c('0x39')]=function(_0x3c97f2,_0x449326){return respondWithRpcPromise(_0x871c('0x3a'),_0x3c97f2['query'],routingClient)['then'](findById(_0x3c97f2['params']['id']))[_0x871c('0xa')](respondWithResult(_0x449326,null))[_0x871c('0xf')](handleError(_0x449326,null));};exports['mailQueues']=function(_0x22517d,_0x5a071f){return respondWithRpcPromise(_0x871c('0x3b'),_0x22517d[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0x5a071f,null))[_0x871c('0xf')](handleError(_0x5a071f,null));};exports[_0x871c('0x3c')]=function(_0x1d7313,_0x1203c4){return respondWithRpcPromise('MailQueues',_0x1d7313['query'],routingClient)[_0x871c('0xa')](findById(_0x1d7313[_0x871c('0x1c')]['id']))[_0x871c('0xa')](respondWithResult(_0x1203c4,null))[_0x871c('0xf')](handleError(_0x1203c4,null));};exports[_0x871c('0x3d')]=function(_0xfa7066,_0x26fba6){return respondWithRpcPromise('MailAccounts',_0xfa7066[_0x871c('0x19')],mailClient)['then'](respondWithResult(_0x26fba6,null))[_0x871c('0xf')](handleError(_0x26fba6,null));};exports[_0x871c('0x3e')]=function(_0x331696,_0x1c115f){return respondWithRpcPromise('OpenchannelQueues',_0x331696[_0x871c('0x19')],routingClient)['then'](respondWithResult(_0x1c115f,null))[_0x871c('0xf')](handleError(_0x1c115f,null));};exports['showOpenchannelQueues']=function(_0x1aabec,_0x4dca65){return respondWithRpcPromise('OpenchannelQueues',_0x1aabec[_0x871c('0x19')],routingClient)[_0x871c('0xa')](findById(_0x1aabec[_0x871c('0x1c')]['id']))[_0x871c('0xa')](respondWithResult(_0x4dca65,null))[_0x871c('0xf')](handleError(_0x4dca65,null));};exports['smsQueues']=function(_0x132129,_0x470967){return respondWithRpcPromise(_0x871c('0x3f'),_0x132129['query'],routingClient)[_0x871c('0xa')](respondWithResult(_0x470967,null))[_0x871c('0xf')](handleError(_0x470967,null));};exports[_0x871c('0x40')]=function(_0x150929,_0x575867){return respondWithRpcPromise(_0x871c('0x3f'),_0x150929[_0x871c('0x19')],routingClient)[_0x871c('0xa')](findById(_0x150929[_0x871c('0x1c')]['id']))[_0x871c('0xa')](respondWithResult(_0x575867,null))[_0x871c('0xf')](handleError(_0x575867,null));};exports[_0x871c('0x41')]=function(_0x868870,_0xa4822d){return respondWithRpcPromise('WhatsappQueues',_0x868870[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0xa4822d,null))[_0x871c('0xf')](handleError(_0xa4822d,null));};exports['showWhatsappQueues']=function(_0x4f1177,_0x3c2fea){return respondWithRpcPromise(_0x871c('0x42'),_0x4f1177['query'],routingClient)[_0x871c('0xa')](findById(_0x4f1177[_0x871c('0x1c')]['id']))[_0x871c('0xa')](respondWithResult(_0x3c2fea,null))[_0x871c('0xf')](handleError(_0x3c2fea,null));};exports[_0x871c('0x43')]=function(_0x245d55,_0x5c77ec){return respondWithRpcPromise(_0x871c('0x44'),_0x245d55[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0x5c77ec,null))[_0x871c('0xf')](handleError(_0x5c77ec,null));};exports[_0x871c('0x45')]=function(_0x5dd537,_0x467a0b){return respondWithRpcPromise(_0x871c('0x44'),_0x5dd537[_0x871c('0x19')],routingClient)[_0x871c('0xa')](findById(_0x5dd537[_0x871c('0x1c')]['id']))[_0x871c('0xa')](respondWithResult(_0x467a0b,null))[_0x871c('0xf')](handleError(_0x467a0b,null));};exports[_0x871c('0x46')]=function(_0x11c160,_0x233821){return respondWithRpcPromise(_0x871c('0x47'),_0x11c160['query'])[_0x871c('0xa')](respondWithResult(_0x233821,null))['catch'](handleError(_0x233821,null));};exports[_0x871c('0x48')]=function(_0x192d36,_0xc826da){return respondWithRpcPromise(_0x871c('0x49'),_0x192d36[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0xc826da,null))['catch'](handleError(_0xc826da,null));};exports[_0x871c('0x4a')]=function(_0xb03690,_0x23e18b){return respondWithRpcPromise(_0x871c('0x4b'),_0xb03690[_0x871c('0x19')],routingClient)['then'](respondWithResult(_0x23e18b,null))[_0x871c('0xf')](handleError(_0x23e18b,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x320bcc,_0x67b22d){return respondWithRpcPromise(_0x871c('0x4c'),_0x320bcc[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0x67b22d,null))[_0x871c('0xf')](handleError(_0x67b22d,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x3ae35a,_0x44cf0f){return respondWithRpcPromise(_0x871c('0x4c'),_0x3ae35a[_0x871c('0x19')],routingClient)[_0x871c('0xa')](function(_0x1d5528){if(_0x3ae35a[_0x871c('0x19')][_0x871c('0x4d')]!==undefined){var _0x1b50a4=_(_0x1d5528[_0x871c('0x17')])['filter']([_0x3ae35a[_0x871c('0x19')][_0x871c('0x4d')],_0x3ae35a[_0x871c('0x1c')]['id']])['map']('queue_id')[_0x871c('0x4e')]()[_0x871c('0x4f')]();return _0x1d5528['rows'][_0x871c('0x50')](function(_0x48cdcb){return _0x1b50a4[_0x871c('0x51')](_0x48cdcb[_0x871c('0x52')])>-0x1;});}else{return _0x1d5528[_0x871c('0x17')][_0x871c('0x50')](function(_0x461772){return _0x461772['queue_id']===parseInt(_0x3ae35a[_0x871c('0x1c')]['id']);});}})[_0x871c('0xa')](respondWithResult(_0x44cf0f,null))['catch'](handleError(_0x44cf0f,null));};exports[_0x871c('0x53')]=function(_0x4b0531,_0x552be5){return respondWithRpcPromise(_0x871c('0x54'),_0x4b0531[_0x871c('0x19')],routingClient)['then'](respondWithResult(_0x552be5,null))[_0x871c('0xf')](handleError(_0x552be5,null));};exports[_0x871c('0x55')]=function(_0x530907,_0x3d6793){return respondWithRpcPromise(_0x871c('0x56'),_0x530907[_0x871c('0x19')],routingClient)[_0x871c('0xa')](respondWithResult(_0x3d6793,null))[_0x871c('0xf')](handleError(_0x3d6793,null));};exports[_0x871c('0x57')]=function(_0x200f9e,_0xac29d){return respondWithRpcPromise(_0x871c('0x58'),_0x200f9e['query'],routingClient)[_0x871c('0xa')](respondWithResult(_0xac29d,null))[_0x871c('0xf')](handleError(_0xac29d,null));};exports[_0x871c('0x59')]=function(_0x3d7a34){return function(_0x4b68a4,_0x55a306){var _0x201cca,_0x20c496;var _0x1d4081=_[_0x871c('0x5a')](_0x3d7a34);var _0x5f34fa=_0x3d7a34===_0x871c('0x5b')?_0x871c('0x5c'):_0x871c('0x5d');return db[_0x1d4081+_0x871c('0x5e')][_0x871c('0x5f')]({'raw':!![],'where':{'id':_0x4b68a4[_0x871c('0x1c')]['id']}})[_0x871c('0xa')](function(_0x3f2ddc){if(_[_0x871c('0x16')](_0x3f2ddc)){throw new Error(_0x1d4081+_0x871c('0x60'));}_0x201cca=_0x3f2ddc;return db[_0x1d4081+_0x871c('0x61')][_0x871c('0x5f')]({'where':{'id':_0x4b68a4[_0x871c('0x2a')][_0x871c('0x62')]},'include':[{'model':db[_0x1d4081+_0x871c('0x63')],'as':_0x871c('0x63')},{'model':db[_0x1d4081+_0x5f34fa],'as':_0x871c('0x5d')}]});})[_0x871c('0xa')](function(_0x25a8ba){if(_[_0x871c('0x16')](_0x25a8ba)){throw new Error(_0x1d4081+_0x871c('0x64'));}_0x20c496=_0x25a8ba;return _0x25a8ba['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x871c('0xa')](function(){var _0x3eb42a={'uniqueid':_0x3d7a34+'.'+_0x20c496['id']+'.'+_0x20c496['Interaction']['id'],'FromUserId':_0x4b68a4[_0x871c('0x2c')]['id'],'type':_0x871c('0x65')};_0x3eb42a[_0x1d4081+_0x871c('0x66')]=_0x20c496['id'];_0x3eb42a[_0x1d4081+_0x871c('0x67')]=_0x20c496[_0x871c('0x63')]['id'];_0x3eb42a['From'+_0x1d4081+_0x5f34fa+'Id']=_0x20c496['Account']['id'];_0x3eb42a['To'+_0x1d4081+_0x871c('0x68')]=_0x201cca['id'];return db[_0x1d4081+'TransferReport'][_0x871c('0x69')](_0x3eb42a);})[_0x871c('0xa')](function(){return respondWithRpcPromise(_0x871c('0x6a'),{'channel':_0x3d7a34,'interaction':_0x20c496[_0x871c('0x63')],'message':_0x20c496,'account':_0x20c496[_0x871c('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x871c('0x65'),'appdata':_0x201cca[_0x871c('0x14')]+','+(_0x20c496[_0x871c('0x5d')][_0x871c('0x6b')]||0x12c),'interval':_0x871c('0x6c')}]},routingClient);})[_0x871c('0xa')](respondWithResult(_0x55a306,null))[_0x871c('0xf')](handleError(_0x55a306,null));};};exports[_0x871c('0x6d')]=function(_0x9b0f6c,_0x21154b){var _0x3e52cf,_0x2b5a3e;if(_[_0x871c('0x16')](_0x9b0f6c[_0x871c('0x2a')]['channel'])){throw new Error(_0x871c('0x6e'));}var _0x121582=_0x9b0f6c['body']['channel'];var _0x53c9af=_[_0x871c('0x5a')](_0x121582);var _0xd7b677=_0x121582==='chat'?'Website':'Account';return db[_0x871c('0x6f')][_0x871c('0x5f')]({'raw':!![],'where':{'id':_0x9b0f6c[_0x871c('0x1c')]['id'],'role':'agent'}})[_0x871c('0xa')](function(_0x13e392){if(_[_0x871c('0x16')](_0x13e392)){throw new Error(_0x871c('0x70'));}_0x3e52cf=_0x13e392;return db[_0x53c9af+_0x871c('0x61')]['findOne']({'where':{'id':_0x9b0f6c[_0x871c('0x2a')][_0x871c('0x62')]},'include':[{'model':db[_0x53c9af+_0x871c('0x63')],'as':_0x871c('0x63')},{'model':db[_0x53c9af+_0xd7b677],'as':_0x871c('0x5d')}]});})['then'](function(_0x59c7de){if(_[_0x871c('0x16')](_0x59c7de)){throw new Error(_0x53c9af+_0x871c('0x64'));}_0x2b5a3e=_0x59c7de;return _0x59c7de['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x871c('0xa')](function(){var _0x59cd82={'uniqueid':_0x121582+'.'+_0x2b5a3e['id']+'.'+_0x2b5a3e[_0x871c('0x63')]['id'],'FromUserId':_0x9b0f6c['user']['id'],'type':_0x871c('0x65'),'ToUserId':_0x3e52cf['id']};_0x59cd82[_0x53c9af+_0x871c('0x66')]=_0x2b5a3e['id'];_0x59cd82[_0x53c9af+'InteractionId']=_0x2b5a3e[_0x871c('0x63')]['id'];_0x59cd82[_0x871c('0x71')+_0x53c9af+_0xd7b677+'Id']=_0x2b5a3e[_0x871c('0x5d')]['id'];return db[_0x53c9af+'TransferReport'][_0x871c('0x69')](_0x59cd82);})[_0x871c('0xa')](function(){return respondWithRpcPromise(_0x871c('0x6a'),{'channel':_0x121582,'interaction':_0x2b5a3e[_0x871c('0x63')],'message':_0x2b5a3e,'account':_0x2b5a3e[_0x871c('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x871c('0x34'),'appdata':_0x3e52cf[_0x871c('0x14')]+','+(_0x2b5a3e[_0x871c('0x5d')]['agentTransferTimeout']||0x12c),'interval':_0x871c('0x6c')}]},routingClient);})['then'](respondWithResult(_0x21154b,null))[_0x871c('0xf')](handleError(_0x21154b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index c98b48c..39139de 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 _0x8087=['/:id','delete','destroy','path','express','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','/:id/run','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8087,0x196));var _0x7808=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x8087[_0x279d37];return _0x530173;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7808('0x0'));var timeout=require('connect-timeout');var express=require(_0x7808('0x1'));var router=express['Router']();var auth=require(_0x7808('0x2'));var interaction=require(_0x7808('0x3'));var config=require('../../config/environment');var controller=require(_0x7808('0x4'));router[_0x7808('0x5')]('/',auth[_0x7808('0x6')](),controller['index']);router[_0x7808('0x5')]('/:id',auth[_0x7808('0x6')](),controller['show']);router[_0x7808('0x5')](_0x7808('0x7'),auth[_0x7808('0x6')](),controller['run']);router[_0x7808('0x8')]('/',auth['isAuthenticated'](),controller[_0x7808('0x9')]);router['put'](_0x7808('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x7808('0xb')](_0x7808('0xa'),auth[_0x7808('0x6')](),controller[_0x7808('0xc')]);module['exports']=router; \ No newline at end of file +var _0xc17e=['index','/:id','show','run','post','put','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x14b1e1,_0x4432f8){var _0x33d96e=function(_0x347b6b){while(--_0x347b6b){_0x14b1e1['push'](_0x14b1e1['shift']());}};_0x33d96e(++_0x4432f8);}(_0xc17e,0x76));var _0xec17=function(_0x4296b3,_0x58c241){_0x4296b3=_0x4296b3-0x0;var _0x146ad8=_0xc17e[_0x4296b3];return _0x146ad8;};'use strict';var multer=require(_0xec17('0x0'));var util=require(_0xec17('0x1'));var path=require(_0xec17('0x2'));var timeout=require('connect-timeout');var express=require(_0xec17('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xec17('0x4'));var config=require(_0xec17('0x5'));var controller=require('./schedule.controller');router[_0xec17('0x6')]('/',auth[_0xec17('0x7')](),controller[_0xec17('0x8')]);router[_0xec17('0x6')](_0xec17('0x9'),auth[_0xec17('0x7')](),controller[_0xec17('0xa')]);router[_0xec17('0x6')]('/:id/run',auth[_0xec17('0x7')](),controller[_0xec17('0xb')]);router[_0xec17('0xc')]('/',auth[_0xec17('0x7')](),controller['create']);router[_0xec17('0xd')](_0xec17('0x9'),auth[_0xec17('0x7')](),controller[_0xec17('0xe')]);router[_0xec17('0xf')](_0xec17('0x9'),auth[_0xec17('0x7')](),controller[_0xec17('0x10')]);module[_0xec17('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ede876b..ab228c2 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 _0x53ec=['custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','quarters','weeks','days','minutes','csv','pdf','xlsx'];(function(_0x5a877f,_0x40894c){var _0x492790=function(_0x131cc3){while(--_0x131cc3){_0x5a877f['push'](_0x5a877f['shift']());}};_0x492790(++_0x40894c);}(_0x53ec,0x192));var _0xc53e=function(_0x14b8c7,_0x4839ea){_0x14b8c7=_0x14b8c7-0x0;var _0x4bb5a3=_0x53ec[_0x14b8c7];return _0x4bb5a3;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc53e('0x2')]},'active':{'type':Sequelize[_0xc53e('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc53e('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xc53e('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc53e('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc53e('0x6')]('years',_0xc53e('0x7'),'months',_0xc53e('0x8'),_0xc53e('0x9'),'hours',_0xc53e('0xa')),'allowNull':![],'defaultValue':_0xc53e('0x9')},'output':{'type':Sequelize[_0xc53e('0x6')](_0xc53e('0xb'),_0xc53e('0xc'),_0xc53e('0xd')),'allowNull':![],'defaultValue':_0xc53e('0xb')},'type':{'type':Sequelize[_0xc53e('0x6')](_0xc53e('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xc53e('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xc53e('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xc53e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2675=['DATE','ENUM','years','quarters','months','weeks','days','minutes','csv','xlsx','default','TEXT','sequelize','BOOLEAN','STRING'];(function(_0x8f690b,_0x4d5d58){var _0x3a3e95=function(_0x44a2e7){while(--_0x44a2e7){_0x8f690b['push'](_0x8f690b['shift']());}};_0x3a3e95(++_0x4d5d58);}(_0x2675,0x75));var _0x5267=function(_0x25d12f,_0x3a2d4f){_0x25d12f=_0x25d12f-0x0;var _0x2ac488=_0x2675[_0x25d12f];return _0x2ac488;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5267('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x5267('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5267('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5267('0x4')](_0x5267('0x5'),_0x5267('0x6'),_0x5267('0x7'),_0x5267('0x8'),_0x5267('0x9'),'hours',_0x5267('0xa')),'allowNull':![],'defaultValue':_0x5267('0x9')},'output':{'type':Sequelize['ENUM'](_0x5267('0xb'),'pdf',_0x5267('0xc')),'allowNull':![],'defaultValue':_0x5267('0xb')},'type':{'type':Sequelize[_0x5267('0x4')]('custom',_0x5267('0xd')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5267('0xe')]},'bcc':{'type':Sequelize[_0x5267('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x5267('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 9c85423..336c246 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 _0x92e8=['Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','rows','catch','show','params','filtears','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','find','run','../../config/schedule','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','desk.js','querystring','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','apply','reject','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','send'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92e8,0x7f));var _0x892e=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x92e8[_0x4dae00];return _0x16bf42;};'use strict';var pdf=require(_0x892e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x892e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x892e('0x2'));var moment=require(_0x892e('0x3'));var BPromise=require(_0x892e('0x4'));var Mustache=require(_0x892e('0x5'));var util=require(_0x892e('0x6'));var path=require(_0x892e('0x7'));var sox=require('sox');var csv=require(_0x892e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x892e('0x9'));var squel=require('squel');var crypto=require(_0x892e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x892e('0xb'));var toCsv=require(_0x892e('0x8'));var querystring=require(_0x892e('0xc'));var Papa=require('papaparse');var Redis=require(_0x892e('0xd'));var authService=require(_0x892e('0xe'));var qs=require(_0x892e('0xf'));var as=require(_0x892e('0x10'));var hardwareService=require(_0x892e('0x11'));var logger=require('../../config/logger')(_0x892e('0x12'));var utils=require(_0x892e('0x13'));var config=require(_0x892e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x892e('0x15'))['db'];function respondWithStatusCode(_0x547e3e,_0x348e58){_0x348e58=_0x348e58||0xcc;return function(_0x13cd3d){if(_0x13cd3d){return _0x547e3e[_0x892e('0x16')](_0x348e58);}return _0x547e3e[_0x892e('0x17')](_0x348e58)[_0x892e('0x18')]();};}function respondWithResult(_0x175105,_0x2f727e){_0x2f727e=_0x2f727e||0xc8;return function(_0x24d070){if(_0x24d070){return _0x175105[_0x892e('0x17')](_0x2f727e)[_0x892e('0x19')](_0x24d070);}};}function respondWithFilteredResult(_0xbd35a5,_0x4d66d0){return function(_0x356a4f){if(_0x356a4f){var _0x5a86eb=_0x356a4f[_0x892e('0x1a')],_0x1ff7f3=_0x4d66d0[_0x892e('0x1b')],_0x5b238d=_0x4d66d0[_0x892e('0x1b')]+_0x4d66d0[_0x892e('0x1c')],_0x54da87;if(_0x5b238d>=_0x5a86eb){_0x5b238d=_0x5a86eb;_0x54da87=0xc8;}else{_0x54da87=0xce;}_0xbd35a5[_0x892e('0x17')](_0x54da87);return _0xbd35a5[_0x892e('0x1d')](_0x892e('0x1e'),_0x1ff7f3+'-'+_0x5b238d+'/'+_0x5a86eb)['json'](_0x356a4f);}return null;};}function patchUpdates(_0x3e3805){return function(_0x31cc52){try{jsonpatch[_0x892e('0x1f')](_0x31cc52,_0x3e3805,!![]);}catch(_0x1c46a3){return BPromise[_0x892e('0x20')](_0x1c46a3);}return _0x31cc52[_0x892e('0x21')]();};}function saveUpdates(_0x19c65d,_0x18a359){return function(_0x8acb19){if(_0x8acb19){return _0x8acb19[_0x892e('0x22')](_0x19c65d)[_0x892e('0x23')](function(_0x104a77){return _0x104a77;});}return null;};}function removeEntity(_0x33e415,_0x47ced3){return function(_0x49de36){if(_0x49de36){return _0x49de36[_0x892e('0x24')]()[_0x892e('0x23')](function(){var _0x82e00d=_0x49de36['get']({'plain':!![]});var _0x2a9a0b=_0x892e('0x25');return db[_0x892e('0x26')]['destroy']({'where':{'type':_0x2a9a0b,'resourceId':_0x82e00d['id']}})[_0x892e('0x23')](function(){return _0x49de36;});})['then'](function(){_0x33e415['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19418c,_0x468fa6){return function(_0x1ab645){if(!_0x1ab645){_0x19418c[_0x892e('0x16')](0x194);}return _0x1ab645;};}function handleError(_0x32505d,_0x54b7c1){_0x54b7c1=_0x54b7c1||0x1f4;return function(_0x5bf238){logger[_0x892e('0x27')](_0x5bf238[_0x892e('0x28')]);if(_0x5bf238[_0x892e('0x29')]){delete _0x5bf238['name'];}_0x32505d['status'](_0x54b7c1)[_0x892e('0x2a')](_0x5bf238);};}exports['index']=function(_0x45dc0a,_0x253c76){var _0x53078b={},_0x54f1eb={},_0x32d064={'count':0x0,'rows':[]};var _0x127519=_['map'](db[_0x892e('0x2b')][_0x892e('0x2c')],function(_0x13c488){return{'name':_0x13c488[_0x892e('0x2d')],'type':_0x13c488[_0x892e('0x2e')][_0x892e('0x2f')]};});_0x54f1eb[_0x892e('0x30')]=_[_0x892e('0x31')](_0x127519,_0x892e('0x29'));_0x54f1eb[_0x892e('0x32')]=_[_0x892e('0x33')](_0x45dc0a['query']);_0x54f1eb['filters']=_['intersection'](_0x54f1eb[_0x892e('0x30')],_0x54f1eb[_0x892e('0x32')]);_0x53078b[_0x892e('0x34')]=_[_0x892e('0x35')](_0x54f1eb[_0x892e('0x30')],qs[_0x892e('0x36')](_0x45dc0a['query'][_0x892e('0x36')]));_0x53078b[_0x892e('0x34')]=_0x53078b[_0x892e('0x34')][_0x892e('0x37')]?_0x53078b['attributes']:_0x54f1eb['model'];if(!_0x45dc0a[_0x892e('0x32')][_0x892e('0x38')]('nolimit')){_0x53078b[_0x892e('0x1c')]=qs[_0x892e('0x1c')](_0x45dc0a[_0x892e('0x32')]['limit']);_0x53078b[_0x892e('0x1b')]=qs[_0x892e('0x1b')](_0x45dc0a[_0x892e('0x32')][_0x892e('0x1b')]);}_0x53078b[_0x892e('0x39')]=qs[_0x892e('0x3a')](_0x45dc0a[_0x892e('0x32')][_0x892e('0x3a')]);_0x53078b[_0x892e('0x3b')]=qs['filters'](_[_0x892e('0x3c')](_0x45dc0a[_0x892e('0x32')],_0x54f1eb[_0x892e('0x3d')]),_0x127519);if(_0x45dc0a[_0x892e('0x32')][_0x892e('0x3e')]){_0x53078b['where']=_['merge'](_0x53078b[_0x892e('0x3b')],{'$or':_['map'](_0x127519,function(_0x1eb841){if(_0x1eb841[_0x892e('0x2e')]!==_0x892e('0x3f')){var _0x3bc5db={};_0x3bc5db[_0x1eb841[_0x892e('0x29')]]={'$like':'%'+_0x45dc0a[_0x892e('0x32')]['filter']+'%'};return _0x3bc5db;}})});}_0x53078b=_[_0x892e('0x40')]({},_0x53078b,_0x45dc0a['options']);var _0x23edb1={'where':_0x53078b[_0x892e('0x3b')]};return db['Schedule'][_0x892e('0x1a')](_0x23edb1)[_0x892e('0x23')](function(_0x468895){_0x32d064[_0x892e('0x1a')]=_0x468895;if(_0x45dc0a[_0x892e('0x32')][_0x892e('0x41')]){_0x53078b['include']=[{'all':!![]}];}return db['Schedule']['findAll'](_0x53078b);})['then'](function(_0x45d233){_0x32d064[_0x892e('0x42')]=_0x45d233;return _0x32d064;})['then'](respondWithFilteredResult(_0x253c76,_0x53078b))[_0x892e('0x43')](handleError(_0x253c76,null));};exports[_0x892e('0x44')]=function(_0x33efde,_0x1f2188){var _0xfe6528={'raw':![],'where':{'id':_0x33efde[_0x892e('0x45')]['id']}},_0x34d3dc={};_0x34d3dc[_0x892e('0x30')]=_[_0x892e('0x33')](db[_0x892e('0x2b')][_0x892e('0x2c')]);_0x34d3dc['query']=_['keys'](_0x33efde['query']);_0x34d3dc[_0x892e('0x46')]=_['intersection'](_0x34d3dc[_0x892e('0x30')],_0x34d3dc[_0x892e('0x32')]);_0xfe6528[_0x892e('0x34')]=_[_0x892e('0x35')](_0x34d3dc['model'],qs[_0x892e('0x36')](_0x33efde[_0x892e('0x32')][_0x892e('0x36')]));_0xfe6528[_0x892e('0x34')]=_0xfe6528[_0x892e('0x34')][_0x892e('0x37')]?_0xfe6528['attributes']:_0x34d3dc[_0x892e('0x30')];if(_0x33efde[_0x892e('0x32')][_0x892e('0x41')]){_0xfe6528[_0x892e('0x47')]=[{'all':!![]}];}_0xfe6528=_[_0x892e('0x40')]({},_0xfe6528,_0x33efde[_0x892e('0x48')]);return db[_0x892e('0x2b')]['find'](_0xfe6528)['then'](handleEntityNotFound(_0x1f2188,null))['then'](respondWithResult(_0x1f2188,null))[_0x892e('0x43')](handleError(_0x1f2188,null));};exports[_0x892e('0x49')]=function(_0x3e35f7,_0x5259ce){return db[_0x892e('0x2b')]['create'](_0x3e35f7[_0x892e('0x4a')],{})['then'](function(_0x3919c4){var _0x8b035b=_0x3e35f7[_0x892e('0x4b')]['get']({'plain':!![]});if(!_0x8b035b)throw new Error(_0x892e('0x4c'));if(_0x8b035b[_0x892e('0x4d')]==='user'){var _0x47dda4=_0x3919c4[_0x892e('0x4e')]({'plain':!![]});var _0x5ce2e0='Scheduler';return db[_0x892e('0x4f')]['find']({'where':{'name':_0x5ce2e0,'userProfileId':_0x8b035b[_0x892e('0x50')]},'raw':!![]})[_0x892e('0x23')](function(_0x2f38dc){if(_0x2f38dc&&_0x2f38dc[_0x892e('0x51')]===0x0){return db[_0x892e('0x26')]['create']({'name':_0x47dda4[_0x892e('0x29')],'resourceId':_0x47dda4['id'],'type':_0x2f38dc[_0x892e('0x29')],'sectionId':_0x2f38dc['id']},{})[_0x892e('0x23')](function(){return _0x3919c4;});}else{return _0x3919c4;}})['catch'](function(_0x544f27){logger[_0x892e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x544f27);throw _0x544f27;});}return _0x3919c4;})[_0x892e('0x23')](respondWithResult(_0x5259ce,0xc9))['catch'](handleError(_0x5259ce,null));};exports[_0x892e('0x22')]=function(_0x7ba53d,_0x1b24ba){if(_0x7ba53d[_0x892e('0x4a')]['id']){delete _0x7ba53d[_0x892e('0x4a')]['id'];}return db[_0x892e('0x2b')]['find']({'where':{'id':_0x7ba53d[_0x892e('0x45')]['id']}})[_0x892e('0x23')](handleEntityNotFound(_0x1b24ba,null))[_0x892e('0x23')](saveUpdates(_0x7ba53d['body'],null))['then'](respondWithResult(_0x1b24ba,null))[_0x892e('0x43')](handleError(_0x1b24ba,null));};exports[_0x892e('0x24')]=function(_0x4c522f,_0x50c287){return db[_0x892e('0x2b')][_0x892e('0x52')]({'where':{'id':_0x4c522f[_0x892e('0x45')]['id']}})[_0x892e('0x23')](handleEntityNotFound(_0x50c287,null))[_0x892e('0x23')](removeEntity(_0x50c287,null))[_0x892e('0x43')](handleError(_0x50c287,null));};exports[_0x892e('0x53')]=function(_0x416db6,_0x89b987,_0x5bc6bd){var _0x598d05=require(_0x892e('0x54'));return db[_0x892e('0x2b')][_0x892e('0x52')]({'where':{'id':_0x416db6[_0x892e('0x45')]['id']},'raw':!![]})[_0x892e('0x23')](handleEntityNotFound(_0x89b987,null))['then'](function(){_0x598d05[_0x892e('0x53')](_0x416db6[_0x892e('0x45')]['id']);})[_0x892e('0x23')](respondWithStatusCode(_0x89b987,null))[_0x892e('0x43')](handleError(_0x89b987,null));}; \ No newline at end of file +var _0xfb3f=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','index','map','Schedule','fieldName','type','model','name','keys','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4d51d6,_0x487558){var _0x28a170=function(_0x4bad9d){while(--_0x4bad9d){_0x4d51d6['push'](_0x4d51d6['shift']());}};_0x28a170(++_0x487558);}(_0xfb3f,0xd9));var _0xffb3=function(_0x46734e,_0x41345d){_0x46734e=_0x46734e-0x0;var _0x27b1fa=_0xfb3f[_0x46734e];return _0x27b1fa;};'use strict';var pdf=require(_0xffb3('0x0'));var emlformat=require(_0xffb3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xffb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xffb3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xffb3('0x4'));var util=require(_0xffb3('0x5'));var path=require(_0xffb3('0x6'));var sox=require(_0xffb3('0x7'));var csv=require(_0xffb3('0x8'));var ejs=require(_0xffb3('0x9'));var fs=require('fs');var _=require(_0xffb3('0xa'));var squel=require(_0xffb3('0xb'));var crypto=require('crypto');var jsforce=require(_0xffb3('0xc'));var deskjs=require(_0xffb3('0xd'));var toCsv=require(_0xffb3('0x8'));var querystring=require(_0xffb3('0xe'));var Papa=require(_0xffb3('0xf'));var Redis=require('ioredis');var authService=require(_0xffb3('0x10'));var qs=require(_0xffb3('0x11'));var as=require(_0xffb3('0x12'));var hardwareService=require(_0xffb3('0x13'));var logger=require(_0xffb3('0x14'))(_0xffb3('0x15'));var utils=require(_0xffb3('0x16'));var config=require(_0xffb3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xffb3('0x18'))['db'];function respondWithStatusCode(_0x40c953,_0x55192c){_0x55192c=_0x55192c||0xcc;return function(_0x21924a){if(_0x21924a){return _0x40c953[_0xffb3('0x19')](_0x55192c);}return _0x40c953[_0xffb3('0x1a')](_0x55192c)[_0xffb3('0x1b')]();};}function respondWithResult(_0x65ef59,_0x420156){_0x420156=_0x420156||0xc8;return function(_0x19ce6e){if(_0x19ce6e){return _0x65ef59[_0xffb3('0x1a')](_0x420156)[_0xffb3('0x1c')](_0x19ce6e);}};}function respondWithFilteredResult(_0x3183bd,_0x38daab){return function(_0x2c3ef7){if(_0x2c3ef7){var _0x4d3c48=_0x2c3ef7['count'],_0x46ae17=_0x38daab['offset'],_0x34d09c=_0x38daab[_0xffb3('0x1d')]+_0x38daab[_0xffb3('0x1e')],_0x42b807;if(_0x34d09c>=_0x4d3c48){_0x34d09c=_0x4d3c48;_0x42b807=0xc8;}else{_0x42b807=0xce;}_0x3183bd['status'](_0x42b807);return _0x3183bd[_0xffb3('0x1f')](_0xffb3('0x20'),_0x46ae17+'-'+_0x34d09c+'/'+_0x4d3c48)[_0xffb3('0x1c')](_0x2c3ef7);}return null;};}function patchUpdates(_0x5efd17){return function(_0x2dfb40){try{jsonpatch[_0xffb3('0x21')](_0x2dfb40,_0x5efd17,!![]);}catch(_0x4f54ac){return BPromise[_0xffb3('0x22')](_0x4f54ac);}return _0x2dfb40[_0xffb3('0x23')]();};}function saveUpdates(_0x223ad5,_0x21c9ad){return function(_0x1e75a0){if(_0x1e75a0){return _0x1e75a0[_0xffb3('0x24')](_0x223ad5)[_0xffb3('0x25')](function(_0x5f5655){return _0x5f5655;});}return null;};}function removeEntity(_0x473cff,_0xe4c60e){return function(_0x5e0f48){if(_0x5e0f48){return _0x5e0f48[_0xffb3('0x26')]()['then'](function(){var _0x5b707a=_0x5e0f48[_0xffb3('0x27')]({'plain':!![]});var _0x3d55e6=_0xffb3('0x28');return db[_0xffb3('0x29')][_0xffb3('0x26')]({'where':{'type':_0x3d55e6,'resourceId':_0x5b707a['id']}})[_0xffb3('0x25')](function(){return _0x5e0f48;});})['then'](function(){_0x473cff[_0xffb3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1390c6,_0x2f01ff){return function(_0x5267f7){if(!_0x5267f7){_0x1390c6[_0xffb3('0x19')](0x194);}return _0x5267f7;};}function handleError(_0x5e0474,_0x1eee6b){_0x1eee6b=_0x1eee6b||0x1f4;return function(_0x148ad8){logger[_0xffb3('0x2a')](_0x148ad8[_0xffb3('0x2b')]);if(_0x148ad8['name']){delete _0x148ad8['name'];}_0x5e0474['status'](_0x1eee6b)['send'](_0x148ad8);};}exports[_0xffb3('0x2c')]=function(_0x5d1630,_0x17f601){var _0x3e64bb={},_0x17462d={},_0x28f65d={'count':0x0,'rows':[]};var _0x5a30b5=_[_0xffb3('0x2d')](db[_0xffb3('0x2e')]['rawAttributes'],function(_0x474d85){return{'name':_0x474d85[_0xffb3('0x2f')],'type':_0x474d85[_0xffb3('0x30')]['key']};});_0x17462d[_0xffb3('0x31')]=_[_0xffb3('0x2d')](_0x5a30b5,_0xffb3('0x32'));_0x17462d['query']=_[_0xffb3('0x33')](_0x5d1630[_0xffb3('0x34')]);_0x17462d['filters']=_[_0xffb3('0x35')](_0x17462d[_0xffb3('0x31')],_0x17462d[_0xffb3('0x34')]);_0x3e64bb[_0xffb3('0x36')]=_[_0xffb3('0x35')](_0x17462d['model'],qs[_0xffb3('0x37')](_0x5d1630[_0xffb3('0x34')][_0xffb3('0x37')]));_0x3e64bb['attributes']=_0x3e64bb[_0xffb3('0x36')][_0xffb3('0x38')]?_0x3e64bb['attributes']:_0x17462d[_0xffb3('0x31')];if(!_0x5d1630[_0xffb3('0x34')]['hasOwnProperty'](_0xffb3('0x39'))){_0x3e64bb[_0xffb3('0x1e')]=qs['limit'](_0x5d1630['query']['limit']);_0x3e64bb[_0xffb3('0x1d')]=qs[_0xffb3('0x1d')](_0x5d1630['query'][_0xffb3('0x1d')]);}_0x3e64bb['order']=qs[_0xffb3('0x3a')](_0x5d1630[_0xffb3('0x34')]['sort']);_0x3e64bb[_0xffb3('0x3b')]=qs['filters'](_[_0xffb3('0x3c')](_0x5d1630[_0xffb3('0x34')],_0x17462d['filters']),_0x5a30b5);if(_0x5d1630[_0xffb3('0x34')][_0xffb3('0x3d')]){_0x3e64bb[_0xffb3('0x3b')]=_[_0xffb3('0x3e')](_0x3e64bb[_0xffb3('0x3b')],{'$or':_[_0xffb3('0x2d')](_0x5a30b5,function(_0x19013d){if(_0x19013d[_0xffb3('0x30')]!==_0xffb3('0x3f')){var _0x16982c={};_0x16982c[_0x19013d[_0xffb3('0x32')]]={'$like':'%'+_0x5d1630[_0xffb3('0x34')][_0xffb3('0x3d')]+'%'};return _0x16982c;}})});}_0x3e64bb=_['merge']({},_0x3e64bb,_0x5d1630[_0xffb3('0x40')]);var _0x282431={'where':_0x3e64bb[_0xffb3('0x3b')]};return db['Schedule'][_0xffb3('0x41')](_0x282431)['then'](function(_0x3197f9){_0x28f65d[_0xffb3('0x41')]=_0x3197f9;if(_0x5d1630['query'][_0xffb3('0x42')]){_0x3e64bb[_0xffb3('0x43')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x3e64bb);})[_0xffb3('0x25')](function(_0x341f1d){_0x28f65d['rows']=_0x341f1d;return _0x28f65d;})[_0xffb3('0x25')](respondWithFilteredResult(_0x17f601,_0x3e64bb))[_0xffb3('0x44')](handleError(_0x17f601,null));};exports[_0xffb3('0x45')]=function(_0x1bfa03,_0x2e8564){var _0x4c2d24={'raw':![],'where':{'id':_0x1bfa03[_0xffb3('0x46')]['id']}},_0xf78b44={};_0xf78b44[_0xffb3('0x31')]=_[_0xffb3('0x33')](db[_0xffb3('0x2e')]['rawAttributes']);_0xf78b44['query']=_[_0xffb3('0x33')](_0x1bfa03[_0xffb3('0x34')]);_0xf78b44['filtears']=_[_0xffb3('0x35')](_0xf78b44[_0xffb3('0x31')],_0xf78b44[_0xffb3('0x34')]);_0x4c2d24[_0xffb3('0x36')]=_['intersection'](_0xf78b44['model'],qs[_0xffb3('0x37')](_0x1bfa03[_0xffb3('0x34')][_0xffb3('0x37')]));_0x4c2d24[_0xffb3('0x36')]=_0x4c2d24[_0xffb3('0x36')][_0xffb3('0x38')]?_0x4c2d24['attributes']:_0xf78b44[_0xffb3('0x31')];if(_0x1bfa03['query'][_0xffb3('0x42')]){_0x4c2d24[_0xffb3('0x43')]=[{'all':!![]}];}_0x4c2d24=_[_0xffb3('0x3e')]({},_0x4c2d24,_0x1bfa03[_0xffb3('0x40')]);return db['Schedule']['find'](_0x4c2d24)[_0xffb3('0x25')](handleEntityNotFound(_0x2e8564,null))['then'](respondWithResult(_0x2e8564,null))[_0xffb3('0x44')](handleError(_0x2e8564,null));};exports[_0xffb3('0x47')]=function(_0x1d542e,_0x4cf0f6){return db[_0xffb3('0x2e')][_0xffb3('0x47')](_0x1d542e[_0xffb3('0x48')],{})[_0xffb3('0x25')](function(_0x2f99ed){var _0x4b0fd3=_0x1d542e[_0xffb3('0x49')][_0xffb3('0x27')]({'plain':!![]});if(!_0x4b0fd3)throw new Error(_0xffb3('0x4a'));if(_0x4b0fd3['role']===_0xffb3('0x49')){var _0x641c4e=_0x2f99ed[_0xffb3('0x27')]({'plain':!![]});var _0x4aacc1=_0xffb3('0x28');return db[_0xffb3('0x4b')][_0xffb3('0x4c')]({'where':{'name':_0x4aacc1,'userProfileId':_0x4b0fd3[_0xffb3('0x4d')]},'raw':!![]})['then'](function(_0x525ecf){if(_0x525ecf&&_0x525ecf['autoAssociation']===0x0){return db['UserProfileResource'][_0xffb3('0x47')]({'name':_0x641c4e['name'],'resourceId':_0x641c4e['id'],'type':_0x525ecf['name'],'sectionId':_0x525ecf['id']},{})[_0xffb3('0x25')](function(){return _0x2f99ed;});}else{return _0x2f99ed;}})[_0xffb3('0x44')](function(_0x2edbce){logger[_0xffb3('0x2a')](_0xffb3('0x4e'),_0x2edbce);throw _0x2edbce;});}return _0x2f99ed;})[_0xffb3('0x25')](respondWithResult(_0x4cf0f6,0xc9))[_0xffb3('0x44')](handleError(_0x4cf0f6,null));};exports['update']=function(_0x29ba96,_0x3d11a0){if(_0x29ba96[_0xffb3('0x48')]['id']){delete _0x29ba96[_0xffb3('0x48')]['id'];}return db[_0xffb3('0x2e')][_0xffb3('0x4c')]({'where':{'id':_0x29ba96['params']['id']}})[_0xffb3('0x25')](handleEntityNotFound(_0x3d11a0,null))[_0xffb3('0x25')](saveUpdates(_0x29ba96['body'],null))['then'](respondWithResult(_0x3d11a0,null))[_0xffb3('0x44')](handleError(_0x3d11a0,null));};exports['destroy']=function(_0x3fc354,_0xc9f558){return db[_0xffb3('0x2e')]['find']({'where':{'id':_0x3fc354['params']['id']}})['then'](handleEntityNotFound(_0xc9f558,null))[_0xffb3('0x25')](removeEntity(_0xc9f558,null))['catch'](handleError(_0xc9f558,null));};exports['run']=function(_0x52311f,_0x3175c7,_0x31658b){var _0xe53c31=require('../../config/schedule');return db[_0xffb3('0x2e')]['find']({'where':{'id':_0x52311f[_0xffb3('0x46')]['id']},'raw':!![]})[_0xffb3('0x25')](handleEntityNotFound(_0x3175c7,null))['then'](function(){_0xe53c31[_0xffb3('0x4f')](_0x52311f[_0xffb3('0x46')]['id']);})[_0xffb3('0x25')](respondWithStatusCode(_0x3175c7,null))[_0xffb3('0x44')](handleError(_0x3175c7,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index fe925b3..52badce 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 _0x5d6f=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules','lodash','util'];(function(_0x118309,_0x4777d2){var _0x4f196b=function(_0x56aaca){while(--_0x56aaca){_0x118309['push'](_0x118309['shift']());}};_0x4f196b(++_0x4777d2);}(_0x5d6f,0xfa));var _0xf5d6=function(_0x5920df,_0x11f78f){_0x5920df=_0x5920df-0x0;var _0x3596f8=_0x5d6f[_0x5920df];return _0x3596f8;};'use strict';var _=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var logger=require(_0xf5d6('0x2'))('api');var moment=require(_0xf5d6('0x3'));var BPromise=require(_0xf5d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5d6('0x5'));var rimraf=require(_0xf5d6('0x6'));var config=require(_0xf5d6('0x7'));var attributes=require(_0xf5d6('0x8'));module[_0xf5d6('0x9')]=function(_0x8aa208,_0x28b308){return _0x8aa208['define'](_0xf5d6('0xa'),attributes,{'tableName':_0xf5d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b8e=['../../config/environment','./schedule.attributes','exports','define','lodash','api','moment','bluebird','request-promise','path'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x3b8e,0xc2));var _0xe3b8=function(_0xcca445,_0x17aace){_0xcca445=_0xcca445-0x0;var _0x40ce9a=_0x3b8e[_0xcca445];return _0x40ce9a;};'use strict';var _=require(_0xe3b8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe3b8('0x1'));var moment=require(_0xe3b8('0x2'));var BPromise=require(_0xe3b8('0x3'));var rp=require(_0xe3b8('0x4'));var fs=require('fs');var path=require(_0xe3b8('0x5'));var rimraf=require('rimraf');var config=require(_0xe3b8('0x6'));var attributes=require(_0xe3b8('0x7'));module[_0xe3b8('0x8')]=function(_0x534c4a,_0x7a3bb5){return _0x534c4a[_0xe3b8('0x9')]('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index dec360b..ce74838 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 _0x04fb=['Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x4adfd8,_0x3d0ed4){var _0x567440=function(_0xd1814f){while(--_0xd1814f){_0x4adfd8['push'](_0x4adfd8['shift']());}};_0x567440(++_0x3d0ed4);}(_0x04fb,0x8c));var _0xb04f=function(_0x3a84c7,_0x20850b){_0x3a84c7=_0x3a84c7-0x0;var _0x3a65d3=_0x04fb[_0x3a84c7];return _0x3a65d3;};'use strict';var _=require('lodash');var util=require(_0xb04f('0x0'));var moment=require(_0xb04f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb04f('0x2'));var db=require(_0xb04f('0x3'))['db'];var utils=require(_0xb04f('0x4'));var logger=require(_0xb04f('0x5'))('rpc');var config=require(_0xb04f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb04f('0x7')][_0xb04f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x330967,_0xcf8583,_0x3cbac0){return new BPromise(function(_0x19ac8f,_0x282888){return client['request'](_0x330967,_0x3cbac0)[_0xb04f('0x9')](function(_0x20d761){logger[_0xb04f('0xa')]('Schedule,\x20%s,\x20%s',_0xcf8583,_0xb04f('0xb'));logger['debug'](_0xb04f('0xc'),_0xcf8583,_0xb04f('0xb'),JSON[_0xb04f('0xd')](_0x20d761));if(_0x20d761[_0xb04f('0xe')]){if(_0x20d761['error']['code']===0x1f4){logger[_0xb04f('0xe')](_0xb04f('0xf'),_0xcf8583,_0x20d761[_0xb04f('0xe')][_0xb04f('0x10')]);return _0x282888(_0x20d761[_0xb04f('0xe')][_0xb04f('0x10')]);}logger[_0xb04f('0xe')](_0xb04f('0xf'),_0xcf8583,_0x20d761[_0xb04f('0xe')][_0xb04f('0x10')]);return _0x19ac8f(_0x20d761[_0xb04f('0xe')][_0xb04f('0x10')]);}else{logger[_0xb04f('0xa')](_0xb04f('0xf'),_0xcf8583,'request\x20sent');_0x19ac8f(_0x20d761[_0xb04f('0x11')][_0xb04f('0x10')]);}})[_0xb04f('0x12')](function(_0x3affe2){logger[_0xb04f('0xe')]('Schedule,\x20%s,\x20%s',_0xcf8583,_0x3affe2);_0x282888(_0x3affe2);});});} \ No newline at end of file +var _0xc811=['moment','ioredis','../../mysqldb','../../config/environment','client','http','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util'];(function(_0x4a6823,_0x3c2e38){var _0x308981=function(_0x217f37){while(--_0x217f37){_0x4a6823['push'](_0x4a6823['shift']());}};_0x308981(++_0x3c2e38);}(_0xc811,0x164));var _0x1c81=function(_0x3bafe3,_0x1f3d38){_0x3bafe3=_0x3bafe3-0x0;var _0x4d0924=_0xc811[_0x3bafe3];return _0x4d0924;};'use strict';var _=require('lodash');var util=require(_0x1c81('0x0'));var moment=require(_0x1c81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c81('0x2'));var db=require(_0x1c81('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1c81('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x1c81('0x5')][_0x1c81('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x473b9b,_0x2b436c,_0x5adb48){return new BPromise(function(_0x34f92a,_0x43cd64){return client['request'](_0x473b9b,_0x5adb48)['then'](function(_0x329c77){logger['info'](_0x1c81('0x7'),_0x2b436c,_0x1c81('0x8'));logger[_0x1c81('0x9')](_0x1c81('0xa'),_0x2b436c,_0x1c81('0x8'),JSON[_0x1c81('0xb')](_0x329c77));if(_0x329c77[_0x1c81('0xc')]){if(_0x329c77[_0x1c81('0xc')][_0x1c81('0xd')]===0x1f4){logger[_0x1c81('0xc')]('Schedule,\x20%s,\x20%s',_0x2b436c,_0x329c77[_0x1c81('0xc')][_0x1c81('0xe')]);return _0x43cd64(_0x329c77[_0x1c81('0xc')]['message']);}logger[_0x1c81('0xc')]('Schedule,\x20%s,\x20%s',_0x2b436c,_0x329c77[_0x1c81('0xc')][_0x1c81('0xe')]);return _0x34f92a(_0x329c77[_0x1c81('0xc')][_0x1c81('0xe')]);}else{logger[_0x1c81('0xf')]('Schedule,\x20%s,\x20%s',_0x2b436c,_0x1c81('0x8'));_0x34f92a(_0x329c77[_0x1c81('0x10')][_0x1c81('0xe')]);}})['catch'](function(_0x1c9c38){logger[_0x1c81('0xc')](_0x1c81('0x7'),_0x2b436c,_0x1c9c38);_0x43cd64(_0x1c9c38);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 89ba7e8..87a87ef 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 _0x2dcd=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','download','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x244006,_0x4099d7){var _0x530cb0=function(_0x6f5ec3){while(--_0x6f5ec3){_0x244006['push'](_0x244006['shift']());}};_0x530cb0(++_0x4099d7);}(_0x2dcd,0x12e));var _0xd2dc=function(_0x571a17,_0x63fb3d){_0x571a17=_0x571a17-0x0;var _0x3ef337=_0x2dcd[_0x571a17];return _0x3ef337;};'use strict';var multer=require(_0xd2dc('0x0'));var util=require(_0xd2dc('0x1'));var path=require(_0xd2dc('0x2'));var timeout=require(_0xd2dc('0x3'));var express=require(_0xd2dc('0x4'));var router=express['Router']();var auth=require(_0xd2dc('0x5'));var interaction=require(_0xd2dc('0x6'));var config=require(_0xd2dc('0x7'));var controller=require('./screenRecording.controller');router[_0xd2dc('0x8')]('/',auth[_0xd2dc('0x9')](),controller[_0xd2dc('0xa')]);router[_0xd2dc('0x8')](_0xd2dc('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd2dc('0x8')]('/:id',auth[_0xd2dc('0x9')](),controller[_0xd2dc('0xc')]);router['get']('/:id/download',auth[_0xd2dc('0x9')](),controller[_0xd2dc('0xd')]);router[_0xd2dc('0xe')]('/',auth['isAuthenticated'](),controller[_0xd2dc('0xf')]);router[_0xd2dc('0x10')](_0xd2dc('0x11'),auth[_0xd2dc('0x9')](),controller[_0xd2dc('0x12')]);router[_0xd2dc('0x13')](_0xd2dc('0x11'),auth['isAuthenticated'](),controller[_0xd2dc('0x14')]);module[_0xd2dc('0x15')]=router; \ No newline at end of file +var _0xe207=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xe207,0x196));var _0x7e20=function(_0x593c5d,_0x1b4ce2){_0x593c5d=_0x593c5d-0x0;var _0x1cfd10=_0xe207[_0x593c5d];return _0x1cfd10;};'use strict';var multer=require(_0x7e20('0x0'));var util=require(_0x7e20('0x1'));var path=require(_0x7e20('0x2'));var timeout=require(_0x7e20('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7e20('0x4'));var config=require('../../config/environment');var controller=require('./screenRecording.controller');router[_0x7e20('0x5')]('/',auth[_0x7e20('0x6')](),controller[_0x7e20('0x7')]);router[_0x7e20('0x5')](_0x7e20('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x7e20('0x9'),auth[_0x7e20('0x6')](),controller['show']);router['get']('/:id/download',auth[_0x7e20('0x6')](),controller['download']);router[_0x7e20('0xa')]('/',auth['isAuthenticated'](),controller[_0x7e20('0xb')]);router[_0x7e20('0xc')](_0x7e20('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x7e20('0xd')](_0x7e20('0x9'),auth[_0x7e20('0x6')](),controller[_0x7e20('0xe')]);module[_0x7e20('0xf')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 3cae9e4..7cd8198 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 _0x3eea=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path'];(function(_0x5ec457,_0x58c44f){var _0xe4f054=function(_0x397bca){while(--_0x397bca){_0x5ec457['push'](_0x5ec457['shift']());}};_0xe4f054(++_0x58c44f);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x55e70f,_0x47b0ad){_0x55e70f=_0x55e70f-0x0;var _0x14b691=_0x3eea[_0x55e70f];return _0x14b691;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');var path=require(_0xa3ee('0x1'));var config=require(_0xa3ee('0x2'));module[_0xa3ee('0x3')]={'format':{'type':Sequelize[_0xa3ee('0x4')],'get':function(){return this[_0xa3ee('0x5')](_0xa3ee('0x6'))?path[_0xa3ee('0x7')](this[_0xa3ee('0x5')](_0xa3ee('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa3ee('0x8')]},'channel':{'type':Sequelize[_0xa3ee('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x538bf9){var _0x4183ee=_0x538bf9['replace'](/\\/g,'/');this[_0xa3ee('0x9')]('value',_0x4183ee);}},'rating':{'type':Sequelize[_0xa3ee('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb1b96d){this['setDataValue'](_0xa3ee('0xb'),moment()[_0xa3ee('0xc')](_0xb1b96d,'ms'));this[_0xa3ee('0x9')]('closedAt',moment());this[_0xa3ee('0x9')](_0xa3ee('0xd'),_0xb1b96d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa3ee('0xb')))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')]('closedAt'))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'createdAt':{'type':Sequelize[_0xa3ee('0x11')],'get':function(){return moment(this['getDataValue'](_0xa3ee('0x12')))[_0xa3ee('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')](_0xa3ee('0x13')))[_0xa3ee('0xe')](_0xa3ee('0xf'))['toString']();}}}; \ No newline at end of file +var _0x9f62=['exports','VIRTUAL','extname','getDataValue','value','STRING','replace','setDataValue','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','../../config/environment'];(function(_0x4748d1,_0x461023){var _0xfd98f=function(_0x39502e){while(--_0x39502e){_0x4748d1['push'](_0x4748d1['shift']());}};_0xfd98f(++_0x461023);}(_0x9f62,0x154));var _0x29f6=function(_0x298c33,_0x362af0){_0x298c33=_0x298c33-0x0;var _0x1f0cb6=_0x9f62[_0x298c33];return _0x1f0cb6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29f6('0x0'));var path=require('path');var config=require(_0x29f6('0x1'));module[_0x29f6('0x2')]={'format':{'type':Sequelize[_0x29f6('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x29f6('0x4')](this[_0x29f6('0x5')](_0x29f6('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x29f6('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x29f6('0x7')],'set':function(_0x272876){var _0x9a43fe=_0x272876[_0x29f6('0x8')](/\\/g,'/');this[_0x29f6('0x9')]('value',_0x9a43fe);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x549f64){this[_0x29f6('0x9')](_0x29f6('0xa'),moment()['subtract'](_0x549f64,'ms'));this['setDataValue'](_0x29f6('0xb'),moment());this[_0x29f6('0x9')]('duration',_0x549f64);}},'startedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0xb')))[_0x29f6('0xd')](_0x29f6('0xe'))[_0x29f6('0xf')]();}},'createdAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0x10')))[_0x29f6('0xd')](_0x29f6('0xe'))[_0x29f6('0xf')]();}},'updatedAt':{'type':Sequelize[_0x29f6('0xc')],'get':function(){return moment(this[_0x29f6('0x5')](_0x29f6('0x11')))[_0x29f6('0xd')](_0x29f6('0xe'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 399c937..175a573 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 _0x5d91=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','ScreenRecording','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','filtears','include','create','body','update','createdAt','value','find','describe','../../components/encryptor','uniqueid','join','server/files/screen_recordings','%s.cypher','secrets','recording','root','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis'];(function(_0xccdbba,_0x424726){var _0x825ead=function(_0x22c374){while(--_0x22c374){_0xccdbba['push'](_0xccdbba['shift']());}};_0x825ead(++_0x424726);}(_0x5d91,0xbb));var _0x15d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d91[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x15d9('0x0'));var emlformat=require(_0x15d9('0x1'));var rimraf=require(_0x15d9('0x2'));var zipdir=require(_0x15d9('0x3'));var jsonpatch=require(_0x15d9('0x4'));var rp=require('request-promise');var moment=require(_0x15d9('0x5'));var BPromise=require(_0x15d9('0x6'));var Mustache=require(_0x15d9('0x7'));var util=require('util');var path=require(_0x15d9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x15d9('0x9'));var fs=require('fs');var _=require(_0x15d9('0xa'));var squel=require(_0x15d9('0xb'));var crypto=require(_0x15d9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x15d9('0xd'));var toCsv=require(_0x15d9('0xe'));var querystring=require('querystring');var Papa=require(_0x15d9('0xf'));var Redis=require(_0x15d9('0x10'));var authService=require(_0x15d9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x15d9('0x12'));var hardwareService=require(_0x15d9('0x13'));var logger=require(_0x15d9('0x14'))('api');var utils=require(_0x15d9('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x15d9('0x16'));var db=require(_0x15d9('0x17'))['db'];function respondWithStatusCode(_0x5be3c9,_0x3755f6){_0x3755f6=_0x3755f6||0xcc;return function(_0x21a454){if(_0x21a454){return _0x5be3c9[_0x15d9('0x18')](_0x3755f6);}return _0x5be3c9[_0x15d9('0x19')](_0x3755f6)[_0x15d9('0x1a')]();};}function respondWithResult(_0x333216,_0x9c1c27){_0x9c1c27=_0x9c1c27||0xc8;return function(_0x1f2a05){if(_0x1f2a05){return _0x333216[_0x15d9('0x19')](_0x9c1c27)[_0x15d9('0x1b')](_0x1f2a05);}};}function respondWithFilteredResult(_0x219291,_0x216c9e){return function(_0x3ae9e4){if(_0x3ae9e4){var _0x4a3030=_0x3ae9e4[_0x15d9('0x1c')],_0x5a9111=_0x216c9e[_0x15d9('0x1d')],_0x4fdc73=_0x216c9e[_0x15d9('0x1d')]+_0x216c9e[_0x15d9('0x1e')],_0x5d64c9;if(_0x4fdc73>=_0x4a3030){_0x4fdc73=_0x4a3030;_0x5d64c9=0xc8;}else{_0x5d64c9=0xce;}_0x219291[_0x15d9('0x19')](_0x5d64c9);return _0x219291[_0x15d9('0x1f')]('Content-Range',_0x5a9111+'-'+_0x4fdc73+'/'+_0x4a3030)[_0x15d9('0x1b')](_0x3ae9e4);}return null;};}function patchUpdates(_0x3af62b){return function(_0x610b29){try{jsonpatch[_0x15d9('0x20')](_0x610b29,_0x3af62b,!![]);}catch(_0x2d84b3){return BPromise[_0x15d9('0x21')](_0x2d84b3);}return _0x610b29[_0x15d9('0x22')]();};}function saveUpdates(_0x2d8da2,_0x1dd708){return function(_0x3a86b2){if(_0x3a86b2){return _0x3a86b2['update'](_0x2d8da2)[_0x15d9('0x23')](function(_0x464ac3){return _0x464ac3;});}return null;};}function removeEntity(_0xca1f17,_0x431c9b){return function(_0x137948){if(_0x137948){return _0x137948[_0x15d9('0x24')]()[_0x15d9('0x23')](function(){_0xca1f17[_0x15d9('0x19')](0xcc)[_0x15d9('0x1a')]();});}};}function handleEntityNotFound(_0x5aab79,_0x281d3d){return function(_0x34f213){if(!_0x34f213){_0x5aab79[_0x15d9('0x18')](0x194);}return _0x34f213;};}function handleError(_0x5309c9,_0x48da2a){_0x48da2a=_0x48da2a||0x1f4;return function(_0x1c8e42){logger[_0x15d9('0x25')](_0x1c8e42['stack']);if(_0x1c8e42[_0x15d9('0x26')]){delete _0x1c8e42['name'];}_0x5309c9['status'](_0x48da2a)[_0x15d9('0x27')](_0x1c8e42);};}exports['index']=function(_0x36c617,_0x1b3efa){var _0x182e10={},_0x107d4d={},_0x5ce36c={'count':0x0,'rows':[]};var _0x3330a8=_['map'](db[_0x15d9('0x28')]['rawAttributes'],function(_0x101fbf){return{'name':_0x101fbf['fieldName'],'type':_0x101fbf[_0x15d9('0x29')][_0x15d9('0x2a')]};});_0x107d4d[_0x15d9('0x2b')]=_[_0x15d9('0x2c')](_[_0x15d9('0x2d')](_0x3330a8,'name'),[_0x15d9('0x2e')]);_0x107d4d[_0x15d9('0x2f')]=_[_0x15d9('0x30')](_0x36c617['query']);_0x107d4d[_0x15d9('0x31')]=_[_0x15d9('0x32')](_0x107d4d[_0x15d9('0x2b')],_0x107d4d[_0x15d9('0x2f')]);_0x182e10[_0x15d9('0x33')]=_['intersection'](_0x107d4d[_0x15d9('0x2b')],qs[_0x15d9('0x34')](_0x36c617[_0x15d9('0x2f')][_0x15d9('0x34')]));_0x182e10['attributes']=_0x182e10[_0x15d9('0x33')][_0x15d9('0x35')]?_0x182e10[_0x15d9('0x33')]:_0x107d4d[_0x15d9('0x2b')];if(!_0x36c617[_0x15d9('0x2f')][_0x15d9('0x36')](_0x15d9('0x37'))){_0x182e10[_0x15d9('0x1e')]=qs[_0x15d9('0x1e')](_0x36c617[_0x15d9('0x2f')][_0x15d9('0x1e')]);_0x182e10[_0x15d9('0x1d')]=qs['offset'](_0x36c617[_0x15d9('0x2f')][_0x15d9('0x1d')]);}_0x182e10[_0x15d9('0x38')]=qs[_0x15d9('0x39')](_0x36c617[_0x15d9('0x2f')][_0x15d9('0x39')]);_0x182e10[_0x15d9('0x3a')]=qs[_0x15d9('0x31')](_[_0x15d9('0x3b')](_0x36c617[_0x15d9('0x2f')],_0x107d4d['filters']),_0x3330a8);if(_0x36c617[_0x15d9('0x2f')][_0x15d9('0x3c')]){_0x182e10[_0x15d9('0x3a')]=_[_0x15d9('0x3d')](_0x182e10[_0x15d9('0x3a')],{'$or':_[_0x15d9('0x2d')](_0x3330a8,function(_0x272b3f){if(_0x272b3f[_0x15d9('0x29')]!=='VIRTUAL'){var _0x5634a8={};_0x5634a8[_0x272b3f[_0x15d9('0x26')]]={'$like':'%'+_0x36c617[_0x15d9('0x2f')]['filter']+'%'};return _0x5634a8;}})});}_0x182e10=_['merge']({},_0x182e10,_0x36c617[_0x15d9('0x3e')]);var _0x41c458={'where':_0x182e10['where']};return db[_0x15d9('0x28')][_0x15d9('0x1c')](_0x41c458)[_0x15d9('0x23')](function(_0x41d25b){_0x5ce36c[_0x15d9('0x1c')]=_0x41d25b;if(_0x36c617[_0x15d9('0x2f')][_0x15d9('0x3f')]){_0x182e10['include']=[{'all':!![]}];}return db[_0x15d9('0x28')][_0x15d9('0x40')](_0x182e10);})[_0x15d9('0x23')](function(_0x20820b){_0x5ce36c['rows']=_0x20820b;return _0x5ce36c;})[_0x15d9('0x23')](respondWithFilteredResult(_0x1b3efa,_0x182e10))[_0x15d9('0x41')](handleError(_0x1b3efa,null));};exports[_0x15d9('0x42')]=function(_0x1c4868,_0x597f66){var _0x26af69={'raw':![],'where':{'id':_0x1c4868[_0x15d9('0x43')]['id']}},_0x342ccd={};_0x342ccd[_0x15d9('0x2b')]=_['keys'](db[_0x15d9('0x28')]['rawAttributes']);_0x342ccd[_0x15d9('0x2f')]=_[_0x15d9('0x30')](_0x1c4868[_0x15d9('0x2f')]);_0x342ccd[_0x15d9('0x44')]=_['intersection'](_0x342ccd['model'],_0x342ccd[_0x15d9('0x2f')]);_0x26af69['attributes']=_['intersection'](_0x342ccd[_0x15d9('0x2b')],qs[_0x15d9('0x34')](_0x1c4868[_0x15d9('0x2f')][_0x15d9('0x34')]));_0x26af69[_0x15d9('0x33')]=_0x26af69['attributes'][_0x15d9('0x35')]?_0x26af69[_0x15d9('0x33')]:_0x342ccd['model'];if(_0x1c4868[_0x15d9('0x2f')][_0x15d9('0x3f')]){_0x26af69[_0x15d9('0x45')]=[{'all':!![]}];}_0x26af69=_[_0x15d9('0x3d')]({},_0x26af69,_0x1c4868['options']);return db[_0x15d9('0x28')]['find'](_0x26af69)['then'](handleEntityNotFound(_0x597f66,null))[_0x15d9('0x23')](respondWithResult(_0x597f66,null))[_0x15d9('0x41')](handleError(_0x597f66,null));};exports[_0x15d9('0x46')]=function(_0x195dfb,_0x3cd74b){return db['ScreenRecording'][_0x15d9('0x46')](_0x195dfb[_0x15d9('0x47')],{})[_0x15d9('0x23')](respondWithResult(_0x3cd74b,0xc9))[_0x15d9('0x41')](handleError(_0x3cd74b,null));};exports[_0x15d9('0x48')]=function(_0x406bc7,_0x423c6d){if(_0x406bc7[_0x15d9('0x47')]['id']){delete _0x406bc7[_0x15d9('0x47')]['id'];}delete _0x406bc7[_0x15d9('0x47')]['duration'];delete _0x406bc7[_0x15d9('0x47')][_0x15d9('0x49')];delete _0x406bc7['body']['closedAt'];delete _0x406bc7['body'][_0x15d9('0x4a')];return db[_0x15d9('0x28')][_0x15d9('0x4b')]({'where':{'id':_0x406bc7['params']['id']}})[_0x15d9('0x23')](handleEntityNotFound(_0x423c6d,null))['then'](saveUpdates(_0x406bc7['body'],null))[_0x15d9('0x23')](respondWithResult(_0x423c6d,null))['catch'](handleError(_0x423c6d,null));};exports[_0x15d9('0x4c')]=function(_0x28dc03,_0x2f7341){return db['ScreenRecording'][_0x15d9('0x4c')]()['then'](respondWithResult(_0x2f7341,null))[_0x15d9('0x41')](handleError(_0x2f7341,null));};exports['download']=function(_0x2ba04a,_0xd0870c,_0x270f80){var _0x39bd68=require(_0x15d9('0x4d'));var _0x40c282=![];var _0xaa7086={};if(_0x2ba04a[_0x15d9('0x2f')]['type']&&_0x2ba04a[_0x15d9('0x2f')][_0x15d9('0x29')]===_0x15d9('0x4e')){_0xaa7086[_0x15d9('0x4e')]=_0x2ba04a[_0x15d9('0x43')]['id'];}else{_0xaa7086['id']=_0x2ba04a[_0x15d9('0x43')]['id'];}return db['ScreenRecording'][_0x15d9('0x4b')]({'where':_0xaa7086,'attributes':['id','value'],'raw':!![]})[_0x15d9('0x23')](handleEntityNotFound(_0xd0870c,null))['then'](function(_0x4c3506){if(_0x4c3506){var _0x2593b7=path[_0x15d9('0x4f')](config['root'],_0x15d9('0x50'),_0x4c3506[_0x15d9('0x4a')]);var _0x27c9f4=util[_0x15d9('0x2e')](_0x15d9('0x51'),_0x2593b7);if(fs['existsSync'](_0x27c9f4)){_0x40c282=!![];return _0x39bd68['decryptFile'](_0x27c9f4,_0x2593b7,config[_0x15d9('0x52')][_0x15d9('0x53')])[_0x15d9('0x23')](function(){return _0x4c3506;});}return _0x4c3506;}})[_0x15d9('0x23')](function(_0x1ce80c){if(_0x1ce80c){var _0x5ed50e=path['join'](config[_0x15d9('0x54')],_0x15d9('0x50'),_0x1ce80c['value']);if(!fs[_0x15d9('0x55')](_0x5ed50e)){throw new db[(_0x15d9('0x56'))][(_0x15d9('0x57'))](_0x15d9('0x58'));}if(_0x1ce80c[_0x15d9('0x59')]){return _0xd0870c[_0x15d9('0x5a')](_0x5ed50e,_0x1ce80c[_0x15d9('0x59')]+path[_0x15d9('0x5b')](_0x5ed50e),function(){if(_0x40c282){fs['unlink'](_0x5ed50e);}});}else{return _0xd0870c[_0x15d9('0x5a')](_0x5ed50e,function(_0x142c58){if(_0x40c282){fs[_0x15d9('0x5c')](_0x5ed50e);}});}}})['catch'](function(_0x1cadaf){if(_0x1cadaf[_0x15d9('0x5d')]===_0x15d9('0x58')){_0xd0870c['status'](0x194)['send'](_0x15d9('0x5e'));}else{return handleError(_0xd0870c,null);}});};exports['destroy']=function(_0x4f19a6,_0xce743){return db['ScreenRecording'][_0x15d9('0x4b')]({'where':{'id':_0x4f19a6[_0x15d9('0x43')]['id']}})['then'](function(_0x53e4f8){if(!_0x53e4f8)throw new ReferenceError(_0x15d9('0x5f'));return _0x53e4f8;})['then'](function(_0x482991){var _0xe7336d=path[_0x15d9('0x4f')](config[_0x15d9('0x54')],_0x15d9('0x50'),_0x482991['value']);logger[_0x15d9('0x60')]('cancellazione\x20fisica\x20documento\x20%s',_0xe7336d);if(!_[_0x15d9('0x61')](_0x482991[_0x15d9('0x4a')])&&fs[_0x15d9('0x55')](_0xe7336d)){logger['info'](_0x15d9('0x62')+_0xe7336d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x15d9('0x63')](_0xe7336d);}_0xe7336d=_0xe7336d+_0x15d9('0x64');if(!_[_0x15d9('0x61')](_0x482991[_0x15d9('0x4a')])&&fs[_0x15d9('0x55')](_0xe7336d)){logger[_0x15d9('0x60')](_0x15d9('0x62')+_0xe7336d+_0x15d9('0x65'));fs[_0x15d9('0x63')](_0xe7336d);}return _0x482991;})[_0x15d9('0x23')](function(_0x4d29ad){if(!_0x4d29ad)throw new InternalError();return _0x4d29ad[_0x15d9('0x24')]();})[_0x15d9('0x23')](function(){_0xce743[_0x15d9('0x19')](0xcc)[_0x15d9('0x1a')]();})[_0x15d9('0x41')](handleError(_0xce743,null));}; \ No newline at end of file +var _0xf65b=['update','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','then','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','format','query','keys','intersection','fields','attributes','hasOwnProperty','limit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','params','filtears','find','create'];(function(_0x4edf3f,_0x292078){var _0x45e981=function(_0x3efe02){while(--_0x3efe02){_0x4edf3f['push'](_0x4edf3f['shift']());}};_0x45e981(++_0x292078);}(_0xf65b,0xe9));var _0xbf65=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf65b[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xbf65('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf65('0x1'));var jsonpatch=require(_0xbf65('0x2'));var rp=require(_0xbf65('0x3'));var moment=require(_0xbf65('0x4'));var BPromise=require(_0xbf65('0x5'));var Mustache=require(_0xbf65('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbf65('0x7'));var csv=require(_0xbf65('0x8'));var ejs=require(_0xbf65('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbf65('0xa'));var crypto=require(_0xbf65('0xb'));var jsforce=require(_0xbf65('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbf65('0xd'));var Papa=require(_0xbf65('0xe'));var Redis=require(_0xbf65('0xf'));var authService=require(_0xbf65('0x10'));var qs=require(_0xbf65('0x11'));var as=require(_0xbf65('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf65('0x13'))(_0xbf65('0x14'));var utils=require(_0xbf65('0x15'));var config=require(_0xbf65('0x16'));var licenseUtil=require(_0xbf65('0x17'));var db=require(_0xbf65('0x18'))['db'];function respondWithStatusCode(_0xfe640,_0x2808de){_0x2808de=_0x2808de||0xcc;return function(_0x2bb352){if(_0x2bb352){return _0xfe640['sendStatus'](_0x2808de);}return _0xfe640[_0xbf65('0x19')](_0x2808de)[_0xbf65('0x1a')]();};}function respondWithResult(_0x1af881,_0x3be079){_0x3be079=_0x3be079||0xc8;return function(_0x59f805){if(_0x59f805){return _0x1af881['status'](_0x3be079)[_0xbf65('0x1b')](_0x59f805);}};}function respondWithFilteredResult(_0x5aadc5,_0x410845){return function(_0x40494f){if(_0x40494f){var _0x481ecb=_0x40494f[_0xbf65('0x1c')],_0x139661=_0x410845['offset'],_0xebf381=_0x410845[_0xbf65('0x1d')]+_0x410845['limit'],_0x29b1f0;if(_0xebf381>=_0x481ecb){_0xebf381=_0x481ecb;_0x29b1f0=0xc8;}else{_0x29b1f0=0xce;}_0x5aadc5[_0xbf65('0x19')](_0x29b1f0);return _0x5aadc5[_0xbf65('0x1e')]('Content-Range',_0x139661+'-'+_0xebf381+'/'+_0x481ecb)[_0xbf65('0x1b')](_0x40494f);}return null;};}function patchUpdates(_0x5a5b58){return function(_0x3b7152){try{jsonpatch['apply'](_0x3b7152,_0x5a5b58,!![]);}catch(_0x314be8){return BPromise[_0xbf65('0x1f')](_0x314be8);}return _0x3b7152[_0xbf65('0x20')]();};}function saveUpdates(_0xbbe678,_0x1df383){return function(_0x2fc1cd){if(_0x2fc1cd){return _0x2fc1cd['update'](_0xbbe678)[_0xbf65('0x21')](function(_0x5307ce){return _0x5307ce;});}return null;};}function removeEntity(_0x566fef,_0x373cd3){return function(_0x41a870){if(_0x41a870){return _0x41a870[_0xbf65('0x22')]()[_0xbf65('0x21')](function(){_0x566fef['status'](0xcc)[_0xbf65('0x1a')]();});}};}function handleEntityNotFound(_0x56c537,_0x4d82b3){return function(_0x33b6a1){if(!_0x33b6a1){_0x56c537['sendStatus'](0x194);}return _0x33b6a1;};}function handleError(_0x59b29c,_0x3f2013){_0x3f2013=_0x3f2013||0x1f4;return function(_0x12fa71){logger['error'](_0x12fa71[_0xbf65('0x23')]);if(_0x12fa71['name']){delete _0x12fa71[_0xbf65('0x24')];}_0x59b29c[_0xbf65('0x19')](_0x3f2013)[_0xbf65('0x25')](_0x12fa71);};}exports[_0xbf65('0x26')]=function(_0x3547ae,_0x4057fb){var _0x1e20c9={},_0x481a83={},_0x5af1bc={'count':0x0,'rows':[]};var _0x711b28=_[_0xbf65('0x27')](db[_0xbf65('0x28')][_0xbf65('0x29')],function(_0x35068d){return{'name':_0x35068d[_0xbf65('0x2a')],'type':_0x35068d['type']['key']};});_0x481a83[_0xbf65('0x2b')]=_[_0xbf65('0x2c')](_['map'](_0x711b28,'name'),[_0xbf65('0x2d')]);_0x481a83[_0xbf65('0x2e')]=_[_0xbf65('0x2f')](_0x3547ae[_0xbf65('0x2e')]);_0x481a83['filters']=_[_0xbf65('0x30')](_0x481a83[_0xbf65('0x2b')],_0x481a83[_0xbf65('0x2e')]);_0x1e20c9['attributes']=_[_0xbf65('0x30')](_0x481a83['model'],qs[_0xbf65('0x31')](_0x3547ae['query'][_0xbf65('0x31')]));_0x1e20c9[_0xbf65('0x32')]=_0x1e20c9[_0xbf65('0x32')]['length']?_0x1e20c9[_0xbf65('0x32')]:_0x481a83[_0xbf65('0x2b')];if(!_0x3547ae[_0xbf65('0x2e')][_0xbf65('0x33')]('nolimit')){_0x1e20c9[_0xbf65('0x34')]=qs[_0xbf65('0x34')](_0x3547ae[_0xbf65('0x2e')]['limit']);_0x1e20c9[_0xbf65('0x1d')]=qs[_0xbf65('0x1d')](_0x3547ae[_0xbf65('0x2e')][_0xbf65('0x1d')]);}_0x1e20c9['order']=qs[_0xbf65('0x35')](_0x3547ae[_0xbf65('0x2e')][_0xbf65('0x35')]);_0x1e20c9[_0xbf65('0x36')]=qs[_0xbf65('0x37')](_[_0xbf65('0x38')](_0x3547ae[_0xbf65('0x2e')],_0x481a83[_0xbf65('0x37')]),_0x711b28);if(_0x3547ae['query'][_0xbf65('0x39')]){_0x1e20c9[_0xbf65('0x36')]=_[_0xbf65('0x3a')](_0x1e20c9['where'],{'$or':_[_0xbf65('0x27')](_0x711b28,function(_0x4a0fa5){if(_0x4a0fa5[_0xbf65('0x3b')]!=='VIRTUAL'){var _0x39ed7e={};_0x39ed7e[_0x4a0fa5[_0xbf65('0x24')]]={'$like':'%'+_0x3547ae[_0xbf65('0x2e')][_0xbf65('0x39')]+'%'};return _0x39ed7e;}})});}_0x1e20c9=_[_0xbf65('0x3a')]({},_0x1e20c9,_0x3547ae[_0xbf65('0x3c')]);var _0x4dbca1={'where':_0x1e20c9[_0xbf65('0x36')]};return db[_0xbf65('0x28')]['count'](_0x4dbca1)[_0xbf65('0x21')](function(_0x1da532){_0x5af1bc[_0xbf65('0x1c')]=_0x1da532;if(_0x3547ae[_0xbf65('0x2e')][_0xbf65('0x3d')]){_0x1e20c9[_0xbf65('0x3e')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbf65('0x3f')](_0x1e20c9);})[_0xbf65('0x21')](function(_0x161019){_0x5af1bc['rows']=_0x161019;return _0x5af1bc;})[_0xbf65('0x21')](respondWithFilteredResult(_0x4057fb,_0x1e20c9))[_0xbf65('0x40')](handleError(_0x4057fb,null));};exports[_0xbf65('0x41')]=function(_0x1dc34c,_0x12b880){var _0x19f2ac={'raw':![],'where':{'id':_0x1dc34c[_0xbf65('0x42')]['id']}},_0x3b08a7={};_0x3b08a7[_0xbf65('0x2b')]=_[_0xbf65('0x2f')](db[_0xbf65('0x28')][_0xbf65('0x29')]);_0x3b08a7['query']=_[_0xbf65('0x2f')](_0x1dc34c[_0xbf65('0x2e')]);_0x3b08a7[_0xbf65('0x43')]=_[_0xbf65('0x30')](_0x3b08a7[_0xbf65('0x2b')],_0x3b08a7[_0xbf65('0x2e')]);_0x19f2ac[_0xbf65('0x32')]=_[_0xbf65('0x30')](_0x3b08a7[_0xbf65('0x2b')],qs[_0xbf65('0x31')](_0x1dc34c[_0xbf65('0x2e')][_0xbf65('0x31')]));_0x19f2ac[_0xbf65('0x32')]=_0x19f2ac[_0xbf65('0x32')]['length']?_0x19f2ac['attributes']:_0x3b08a7[_0xbf65('0x2b')];if(_0x1dc34c[_0xbf65('0x2e')][_0xbf65('0x3d')]){_0x19f2ac[_0xbf65('0x3e')]=[{'all':!![]}];}_0x19f2ac=_[_0xbf65('0x3a')]({},_0x19f2ac,_0x1dc34c[_0xbf65('0x3c')]);return db[_0xbf65('0x28')][_0xbf65('0x44')](_0x19f2ac)[_0xbf65('0x21')](handleEntityNotFound(_0x12b880,null))['then'](respondWithResult(_0x12b880,null))[_0xbf65('0x40')](handleError(_0x12b880,null));};exports['create']=function(_0xad80c7,_0x37ca21){return db[_0xbf65('0x28')][_0xbf65('0x45')](_0xad80c7['body'],{})['then'](respondWithResult(_0x37ca21,0xc9))['catch'](handleError(_0x37ca21,null));};exports[_0xbf65('0x46')]=function(_0xb6ac22,_0x47a87e){if(_0xb6ac22[_0xbf65('0x47')]['id']){delete _0xb6ac22[_0xbf65('0x47')]['id'];}delete _0xb6ac22[_0xbf65('0x47')][_0xbf65('0x48')];delete _0xb6ac22[_0xbf65('0x47')][_0xbf65('0x49')];delete _0xb6ac22[_0xbf65('0x47')][_0xbf65('0x4a')];delete _0xb6ac22[_0xbf65('0x47')]['value'];return db['ScreenRecording'][_0xbf65('0x44')]({'where':{'id':_0xb6ac22['params']['id']}})[_0xbf65('0x21')](handleEntityNotFound(_0x47a87e,null))[_0xbf65('0x21')](saveUpdates(_0xb6ac22['body'],null))[_0xbf65('0x21')](respondWithResult(_0x47a87e,null))[_0xbf65('0x40')](handleError(_0x47a87e,null));};exports['describe']=function(_0x5aee27,_0x174fd6){return db[_0xbf65('0x28')][_0xbf65('0x4b')]()[_0xbf65('0x21')](respondWithResult(_0x174fd6,null))[_0xbf65('0x40')](handleError(_0x174fd6,null));};exports[_0xbf65('0x4c')]=function(_0x37ab9d,_0x1368c8,_0x17ba42){var _0x29d98a=require(_0xbf65('0x4d'));var _0x15d825=![];var _0x3d2349={};if(_0x37ab9d[_0xbf65('0x2e')][_0xbf65('0x3b')]&&_0x37ab9d[_0xbf65('0x2e')][_0xbf65('0x3b')]===_0xbf65('0x4e')){_0x3d2349[_0xbf65('0x4e')]=_0x37ab9d[_0xbf65('0x42')]['id'];}else{_0x3d2349['id']=_0x37ab9d['params']['id'];}return db[_0xbf65('0x28')][_0xbf65('0x44')]({'where':_0x3d2349,'attributes':['id',_0xbf65('0x4f')],'raw':!![]})[_0xbf65('0x21')](handleEntityNotFound(_0x1368c8,null))[_0xbf65('0x21')](function(_0x3fd26f){if(_0x3fd26f){var _0x499943=path[_0xbf65('0x50')](config[_0xbf65('0x51')],_0xbf65('0x52'),_0x3fd26f['value']);var _0x37af9b=util[_0xbf65('0x2d')](_0xbf65('0x53'),_0x499943);if(fs[_0xbf65('0x54')](_0x37af9b)){_0x15d825=!![];return _0x29d98a[_0xbf65('0x55')](_0x37af9b,_0x499943,config['secrets'][_0xbf65('0x56')])[_0xbf65('0x21')](function(){return _0x3fd26f;});}return _0x3fd26f;}})[_0xbf65('0x21')](function(_0x380df3){if(_0x380df3){var _0x5902e4=path[_0xbf65('0x50')](config[_0xbf65('0x51')],_0xbf65('0x52'),_0x380df3['value']);if(!fs[_0xbf65('0x54')](_0x5902e4)){throw new db['Sequelize'][(_0xbf65('0x57'))](_0xbf65('0x58'));}if(_0x380df3[_0xbf65('0x59')]){return _0x1368c8['download'](_0x5902e4,_0x380df3[_0xbf65('0x59')]+path[_0xbf65('0x5a')](_0x5902e4),function(){if(_0x15d825){fs[_0xbf65('0x5b')](_0x5902e4);}});}else{return _0x1368c8[_0xbf65('0x4c')](_0x5902e4,function(_0x47cfd9){if(_0x15d825){fs[_0xbf65('0x5b')](_0x5902e4);}});}}})[_0xbf65('0x40')](function(_0xddffe1){if(_0xddffe1[_0xbf65('0x5c')]==='ScreenRecording\x20not\x20found'){_0x1368c8[_0xbf65('0x19')](0x194)[_0xbf65('0x25')](_0xbf65('0x5d'));}else{return handleError(_0x1368c8,null);}});};exports['destroy']=function(_0x1d7771,_0x35b773){return db[_0xbf65('0x28')]['find']({'where':{'id':_0x1d7771['params']['id']}})[_0xbf65('0x21')](function(_0x507b1f){if(!_0x507b1f)throw new ReferenceError(_0xbf65('0x5e'));return _0x507b1f;})[_0xbf65('0x21')](function(_0x143cb1){var _0x3e1aa6=path[_0xbf65('0x50')](config[_0xbf65('0x51')],_0xbf65('0x52'),_0x143cb1[_0xbf65('0x4f')]);logger[_0xbf65('0x5f')](_0xbf65('0x60'),_0x3e1aa6);if(!_[_0xbf65('0x61')](_0x143cb1[_0xbf65('0x4f')])&&fs['existsSync'](_0x3e1aa6)){logger['info'](_0xbf65('0x62')+_0x3e1aa6+_0xbf65('0x63'));fs[_0xbf65('0x64')](_0x3e1aa6);}_0x3e1aa6=_0x3e1aa6+'.cypher';if(!_[_0xbf65('0x61')](_0x143cb1[_0xbf65('0x4f')])&&fs['existsSync'](_0x3e1aa6)){logger[_0xbf65('0x5f')](_0xbf65('0x62')+_0x3e1aa6+_0xbf65('0x63'));fs['unlinkSync'](_0x3e1aa6);}return _0x143cb1;})[_0xbf65('0x21')](function(_0x13e217){if(!_0x13e217)throw new InternalError();return _0x13e217['destroy']();})[_0xbf65('0x21')](function(){_0x35b773['status'](0xcc)[_0xbf65('0x1a')]();})[_0xbf65('0x40')](handleError(_0x35b773,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ed0c026..cd64577 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 _0x8f40=['define','ScreenRecording','interactionid','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3e5dcb,_0x289aab){var _0x49ab74=function(_0x35037a){while(--_0x35037a){_0x3e5dcb['push'](_0x3e5dcb['shift']());}};_0x49ab74(++_0x289aab);}(_0x8f40,0x10b));var _0x08f4=function(_0x1eb610,_0x39a0ee){_0x1eb610=_0x1eb610-0x0;var _0xfadb7b=_0x8f40[_0x1eb610];return _0xfadb7b;};'use strict';var _=require(_0x08f4('0x0'));var util=require('util');var logger=require(_0x08f4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x08f4('0x2'));var rp=require(_0x08f4('0x3'));var fs=require('fs');var path=require(_0x08f4('0x4'));var rimraf=require(_0x08f4('0x5'));var config=require(_0x08f4('0x6'));var attributes=require('./screenRecording.attributes');module[_0x08f4('0x7')]=function(_0x2510e8,_0x2591d1){return _0x2510e8[_0x08f4('0x8')](_0x08f4('0x9'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x08f4('0xa'),'fields':[_0x08f4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd4c=['interactionid','api','bluebird','request-promise','rimraf','screen_recordings'];(function(_0x3f6808,_0x5a3a8b){var _0x52524d=function(_0x1ee109){while(--_0x1ee109){_0x3f6808['push'](_0x3f6808['shift']());}};_0x52524d(++_0x5a3a8b);}(_0xfd4c,0x18d));var _0xcfd4=function(_0x4624f2,_0x343757){_0x4624f2=_0x4624f2-0x0;var _0x585d9f=_0xfd4c[_0x4624f2];return _0x585d9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xcfd4('0x0'));var moment=require('moment');var BPromise=require(_0xcfd4('0x1'));var rp=require(_0xcfd4('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfd4('0x3'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module['exports']=function(_0x3dea39,_0x17327a){return _0x3dea39['define']('ScreenRecording',attributes,{'tableName':_0xcfd4('0x4'),'paranoid':![],'indexes':[{'name':_0xcfd4('0x5'),'fields':[_0xcfd4('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 48b8dac..719d9f1 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(_0x292825,_0xdd5593){var _0x30d8bc=function(_0x238376){while(--_0x238376){_0x292825['push'](_0x292825['shift']());}};_0x30d8bc(++_0xdd5593);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x436575,_0x2836d1){var _0x40eb99=function(_0xcee0a0){while(--_0xcee0a0){_0x436575['push'](_0x436575['shift']());}};_0x40eb99(++_0x2836d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 ca2556a..c1707b1 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 _0x4d0b=['show','getLogo','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','extname','originalname','post','/:id/logo','file','addLogo','%s%s','logologin','/:id/logo_login','addLogoLogin','preferred','addPreferred','single','addFavicon','update','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/:id'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x4d0b,0x13a));var _0xb4d0=function(_0x2c682e,_0x5c1f91){_0x2c682e=_0x2c682e-0x0;var _0x2482d7=_0x4d0b[_0x2c682e];return _0x2482d7;};'use strict';var multer=require(_0xb4d0('0x0'));var util=require('util');var path=require(_0xb4d0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb4d0('0x2')]();var auth=require(_0xb4d0('0x3'));var interaction=require(_0xb4d0('0x4'));var config=require(_0xb4d0('0x5'));var controller=require(_0xb4d0('0x6'));router[_0xb4d0('0x7')]('/',auth['isAuthenticated'](),controller[_0xb4d0('0x8')]);router['get'](_0xb4d0('0x9'),controller[_0xb4d0('0xa')]);router[_0xb4d0('0x7')]('/:id/logo',controller[_0xb4d0('0xb')]);router[_0xb4d0('0x7')]('/:id/logo_login',controller['getLogoLogin']);router[_0xb4d0('0x7')]('/:id/gdpr',controller[_0xb4d0('0xc')]);router[_0xb4d0('0x7')](_0xb4d0('0xd'),controller[_0xb4d0('0xe')]);router[_0xb4d0('0x7')](_0xb4d0('0xf'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb4d0('0x10')]({'destination':function(_0x48fe91,_0x1c08e9,_0x59aaea){_0x59aaea(null,path[_0xb4d0('0x11')](config[_0xb4d0('0x12')],_0xb4d0('0x13')));},'filename':function(_0x3cffc,_0x306e87,_0x44f88e){_0x44f88e(null,util[_0xb4d0('0x14')]('%s%s','logo',path[_0xb4d0('0x15')](_0x306e87[_0xb4d0('0x16')])));}})});router[_0xb4d0('0x17')](_0xb4d0('0x18'),upload['single'](_0xb4d0('0x19')),controller[_0xb4d0('0x1a')]);var upload=multer({'storage':multer[_0xb4d0('0x10')]({'destination':function(_0x55de71,_0x32ca00,_0x39a3b7){_0x39a3b7(null,path[_0xb4d0('0x11')](config[_0xb4d0('0x12')],_0xb4d0('0x13')));},'filename':function(_0x34f8c2,_0x5b8823,_0x42ceb6){_0x42ceb6(null,util[_0xb4d0('0x14')](_0xb4d0('0x1b'),_0xb4d0('0x1c'),path['extname'](_0x5b8823[_0xb4d0('0x16')])));}})});router['post'](_0xb4d0('0x1d'),upload['single'](_0xb4d0('0x19')),controller[_0xb4d0('0x1e')]);var upload=multer({'storage':multer[_0xb4d0('0x10')]({'destination':function(_0x34bdc6,_0x58bab9,_0x4b9d2f){_0x4b9d2f(null,path[_0xb4d0('0x11')](config['root'],_0xb4d0('0x13')));},'filename':function(_0x1ec006,_0x2981ed,_0x1813ca){_0x1813ca(null,util[_0xb4d0('0x14')](_0xb4d0('0x1b'),_0xb4d0('0x1f'),path[_0xb4d0('0x15')](_0x2981ed[_0xb4d0('0x16')])));}})});router[_0xb4d0('0x17')](_0xb4d0('0xd'),upload['single']('file'),controller[_0xb4d0('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x55bfec,_0x418bab,_0x5cf0b4){_0x5cf0b4(null,path[_0xb4d0('0x11')](config[_0xb4d0('0x12')],_0xb4d0('0x13')));},'filename':function(_0x487871,_0x548db8,_0x563899){_0x563899(null,util[_0xb4d0('0x14')](_0xb4d0('0x1b'),'favicon',path[_0xb4d0('0x15')](_0x548db8[_0xb4d0('0x16')])));}})});router[_0xb4d0('0x17')]('/:id/favicon',upload[_0xb4d0('0x21')]('file'),controller[_0xb4d0('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb4d0('0x23')]);module['exports']=router; \ No newline at end of file +var _0x8d14=['logo','extname','originalname','post','/:id/logo','file','addLogo','/:id/logo_login','single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/:id','show','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8d14,0x129));var _0x48d1=function(_0x402e6e,_0xc20f6f){_0x402e6e=_0x402e6e-0x0;var _0x3b49b5=_0x8d14[_0x402e6e];return _0x3b49b5;};'use strict';var multer=require(_0x48d1('0x0'));var util=require(_0x48d1('0x1'));var path=require('path');var timeout=require(_0x48d1('0x2'));var express=require(_0x48d1('0x3'));var router=express[_0x48d1('0x4')]();var auth=require(_0x48d1('0x5'));var interaction=require(_0x48d1('0x6'));var config=require(_0x48d1('0x7'));var controller=require(_0x48d1('0x8'));router[_0x48d1('0x9')]('/',auth['isAuthenticated'](),controller[_0x48d1('0xa')]);router['get'](_0x48d1('0xb'),controller[_0x48d1('0xc')]);router['get']('/:id/logo',controller['getLogo']);router[_0x48d1('0x9')]('/:id/logo_login',controller['getLogoLogin']);router[_0x48d1('0x9')]('/:id/gdpr',controller[_0x48d1('0xd')]);router[_0x48d1('0x9')](_0x48d1('0xe'),controller[_0x48d1('0xf')]);router[_0x48d1('0x9')](_0x48d1('0x10'),controller['getFavicon']);var upload=multer({'storage':multer[_0x48d1('0x11')]({'destination':function(_0x45296a,_0x253015,_0x4944a3){_0x4944a3(null,path[_0x48d1('0x12')](config[_0x48d1('0x13')],_0x48d1('0x14')));},'filename':function(_0x146373,_0x373ed3,_0x48af6c){_0x48af6c(null,util[_0x48d1('0x15')](_0x48d1('0x16'),_0x48d1('0x17'),path[_0x48d1('0x18')](_0x373ed3[_0x48d1('0x19')])));}})});router[_0x48d1('0x1a')](_0x48d1('0x1b'),upload['single'](_0x48d1('0x1c')),controller[_0x48d1('0x1d')]);var upload=multer({'storage':multer[_0x48d1('0x11')]({'destination':function(_0x2b11f4,_0xadd160,_0x4a52d4){_0x4a52d4(null,path['join'](config[_0x48d1('0x13')],_0x48d1('0x14')));},'filename':function(_0x5c6f4b,_0x5a9cb6,_0x5725f1){_0x5725f1(null,util['format']('%s%s','logologin',path[_0x48d1('0x18')](_0x5a9cb6[_0x48d1('0x19')])));}})});router[_0x48d1('0x1a')](_0x48d1('0x1e'),upload[_0x48d1('0x1f')]('file'),controller[_0x48d1('0x20')]);var upload=multer({'storage':multer[_0x48d1('0x11')]({'destination':function(_0x4ad041,_0x31d960,_0x4dcec8){_0x4dcec8(null,path[_0x48d1('0x12')](config['root'],_0x48d1('0x14')));},'filename':function(_0x3200b5,_0x4c3fc4,_0x4d32b5){_0x4d32b5(null,util[_0x48d1('0x15')](_0x48d1('0x16'),_0x48d1('0x21'),path[_0x48d1('0x18')](_0x4c3fc4['originalname'])));}})});router['post']('/:id/preferred',upload['single']('file'),controller[_0x48d1('0x22')]);var upload=multer({'storage':multer[_0x48d1('0x11')]({'destination':function(_0x17ebfe,_0x359eea,_0x1173d8){_0x1173d8(null,path[_0x48d1('0x12')](config[_0x48d1('0x13')],_0x48d1('0x14')));},'filename':function(_0x5b6067,_0x1c2b53,_0x1b1805){_0x1b1805(null,util[_0x48d1('0x15')](_0x48d1('0x16'),_0x48d1('0x23'),path[_0x48d1('0x18')](_0x1c2b53[_0x48d1('0x19')])));}})});router[_0x48d1('0x1a')]('/:id/favicon',upload[_0x48d1('0x1f')](_0x48d1('0x1c')),controller[_0x48d1('0x24')]);router['put'](_0x48d1('0xb'),auth[_0x48d1('0x25')](),controller[_0x48d1('0x26')]);module[_0x48d1('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8a7e4d6..8ae1a61 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 _0x191f=['BOOLEAN','alternate','UNSIGNED','min_internal','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3e83ee,_0xa1d50){var _0x30f544=function(_0x23c132){while(--_0x23c132){_0x3e83ee['push'](_0x3e83ee['shift']());}};_0x30f544(++_0xa1d50);}(_0x191f,0x9b));var _0xf191=function(_0x42da05,_0x26dd4c){_0x42da05=_0x42da05-0x0;var _0x444709=_0x191f[_0x42da05];return _0x444709;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf191('0x0'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf191('0x1')](0xb),'unique':_0xf191('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf191('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf191('0x3')],'defaultValue':_0xf191('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf191('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf191('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xf191('0x3')]},'turnpassword':{'type':Sequelize[_0xf191('0x3')]},'pageTitle':{'type':Sequelize[_0xf191('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf191('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf191('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf191('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf191('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf191('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf191('0x3')],'defaultValue':_0xf191('0x6')},'chatTimeout':{'type':Sequelize[_0xf191('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf191('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xf191('0x3')]},'defaultFavicon':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf191('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf191('0x1')]},'transcribeRegion':{'type':Sequelize[_0xf191('0x3')]},'sentiment':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf191('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf191('0x1')]},'sentimentRegion':{'type':Sequelize[_0xf191('0x3')]},'language':{'type':Sequelize[_0xf191('0x3')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf191('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf191('0x1')](0x2)[_0xf191('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}}}; \ No newline at end of file +var _0x7ad0=['BOOLEAN','UNSIGNED','sequelize','INTEGER','min_internal','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x534216,_0x4fb18e){var _0x254a2e=function(_0x355b03){while(--_0x355b03){_0x534216['push'](_0x534216['shift']());}};_0x254a2e(++_0x4fb18e);}(_0x7ad0,0x11a));var _0x07ad=function(_0x1a28d4,_0x4be774){_0x1a28d4=_0x1a28d4-0x0;var _0x4f5408=_0x7ad0[_0x1a28d4];return _0x4f5408;};'use strict';var Sequelize=require(_0x07ad('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x07ad('0x1')](0xb),'unique':_0x07ad('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x07ad('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x07ad('0x3')],'defaultValue':_0x07ad('0x4')},'logo':{'type':Sequelize[_0x07ad('0x3')]},'defaultLogo':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x07ad('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x07ad('0x3')]},'turnpassword':{'type':Sequelize[_0x07ad('0x3')]},'pageTitle':{'type':Sequelize[_0x07ad('0x3')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x07ad('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x07ad('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x07ad('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x07ad('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x07ad('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x07ad('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x07ad('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x07ad('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x07ad('0x3')]},'defaultFavicon':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x07ad('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x07ad('0x1')]},'transcribeRegion':{'type':Sequelize[_0x07ad('0x3')]},'sentiment':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x07ad('0x1')]},'sentimentRegion':{'type':Sequelize[_0x07ad('0x3')]},'language':{'type':Sequelize[_0x07ad('0x3')]},'bucket':{'type':Sequelize[_0x07ad('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x07ad('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x07ad('0x1')](0x2)[_0x07ad('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f208b3e..2cf0e51 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 _0x7e72=['status','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','end','stack','name','send','index','map','Setting','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','filtears','find','body','addLogo','file','filename','addLogoLogin','getLogo','server/files/images/logos','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','custom','upperFirst','\x20not\x20found','download','getLogoLogin','getLicense','default_loginLogo.svg','Sequelize','ValidationError','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus'];(function(_0x4adc5f,_0x5da2c6){var _0x239b9f=function(_0xca3256){while(--_0xca3256){_0x4adc5f['push'](_0x4adc5f['shift']());}};_0x239b9f(++_0x5da2c6);}(_0x7e72,0x1ce));var _0x27e7=function(_0x2478ed,_0x3c4f73){_0x2478ed=_0x2478ed-0x0;var _0x3b3cf9=_0x7e72[_0x2478ed];return _0x3b3cf9;};'use strict';var pdf=require(_0x27e7('0x0'));var emlformat=require(_0x27e7('0x1'));var rimraf=require(_0x27e7('0x2'));var zipdir=require(_0x27e7('0x3'));var jsonpatch=require(_0x27e7('0x4'));var rp=require(_0x27e7('0x5'));var moment=require(_0x27e7('0x6'));var BPromise=require(_0x27e7('0x7'));var Mustache=require(_0x27e7('0x8'));var util=require('util');var path=require(_0x27e7('0x9'));var sox=require(_0x27e7('0xa'));var csv=require(_0x27e7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x27e7('0xc'));var squel=require(_0x27e7('0xd'));var crypto=require(_0x27e7('0xe'));var jsforce=require(_0x27e7('0xf'));var deskjs=require(_0x27e7('0x10'));var toCsv=require(_0x27e7('0xb'));var querystring=require(_0x27e7('0x11'));var Papa=require(_0x27e7('0x12'));var Redis=require('ioredis');var authService=require(_0x27e7('0x13'));var qs=require(_0x27e7('0x14'));var as=require(_0x27e7('0x15'));var hardwareService=require(_0x27e7('0x16'));var logger=require(_0x27e7('0x17'))(_0x27e7('0x18'));var utils=require('../../config/utils');var config=require(_0x27e7('0x19'));var licenseUtil=require(_0x27e7('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x27e7('0x1b'));var client=jayson[_0x27e7('0x1c')][_0x27e7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xfa64,_0x391f96,_0x2cf08c,_0x5e1f58){return new BPromise(function(_0x21d99d,_0x654215){var _0x12700d=_0x5e1f58||client;return _0x12700d[_0x27e7('0x1e')](_0xfa64,_0x2cf08c)['then'](function(_0x41b88a){logger['info'](_0x27e7('0x1f'),_0x391f96,_0x27e7('0x20'));logger[_0x27e7('0x21')](_0x27e7('0x22'),_0x391f96,_0x27e7('0x20'),JSON[_0x27e7('0x23')](_0x41b88a));if(_0x41b88a[_0x27e7('0x24')]){if(_0x41b88a['error'][_0x27e7('0x25')]===0x1f4){logger['error'](_0x27e7('0x1f'),_0x391f96,_0x41b88a[_0x27e7('0x24')][_0x27e7('0x26')]);return _0x654215(_0x41b88a[_0x27e7('0x24')][_0x27e7('0x26')]);}logger[_0x27e7('0x24')]('Setting,\x20%s,\x20%s',_0x391f96,_0x41b88a[_0x27e7('0x24')][_0x27e7('0x26')]);return _0x21d99d(_0x41b88a[_0x27e7('0x24')][_0x27e7('0x26')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x391f96,_0x27e7('0x20'));_0x21d99d(_0x41b88a[_0x27e7('0x27')]['message']);}})[_0x27e7('0x28')](function(_0x3b4cf4){logger[_0x27e7('0x24')](_0x27e7('0x1f'),_0x391f96,_0x3b4cf4);_0x654215(_0x3b4cf4);});});}function respondWithStatusCode(_0x11475d,_0x41fe8f){_0x41fe8f=_0x41fe8f||0xcc;return function(_0x17d057){if(_0x17d057){return _0x11475d[_0x27e7('0x29')](_0x41fe8f);}return _0x11475d[_0x27e7('0x2a')](_0x41fe8f)['end']();};}function respondWithResult(_0x790f66,_0x3db3d4){_0x3db3d4=_0x3db3d4||0xc8;return function(_0x1cdecf){if(_0x1cdecf){return _0x790f66[_0x27e7('0x2a')](_0x3db3d4)['json'](_0x1cdecf);}};}function respondWithFilteredResult(_0xb3b8d4,_0x588505){return function(_0x2c092b){if(_0x2c092b){var _0xbdf7a3=_0x2c092b['count'],_0x53edaa=_0x588505[_0x27e7('0x2b')],_0x9c3400=_0x588505['offset']+_0x588505[_0x27e7('0x2c')],_0x4b237c;if(_0x9c3400>=_0xbdf7a3){_0x9c3400=_0xbdf7a3;_0x4b237c=0xc8;}else{_0x4b237c=0xce;}_0xb3b8d4[_0x27e7('0x2a')](_0x4b237c);return _0xb3b8d4[_0x27e7('0x2d')](_0x27e7('0x2e'),_0x53edaa+'-'+_0x9c3400+'/'+_0xbdf7a3)[_0x27e7('0x2f')](_0x2c092b);}return null;};}function patchUpdates(_0x458f00){return function(_0x3697bc){try{jsonpatch[_0x27e7('0x30')](_0x3697bc,_0x458f00,!![]);}catch(_0x22e1e9){return BPromise['reject'](_0x22e1e9);}return _0x3697bc[_0x27e7('0x31')]();};}function saveUpdates(_0x5e688c,_0x185318){return function(_0x21a3b1){if(_0x21a3b1){return _0x21a3b1[_0x27e7('0x32')](_0x5e688c)['then'](function(_0xeb0a52){return _0xeb0a52;});}return null;};}function removeEntity(_0x132156,_0xb5a882){return function(_0x9bb320){if(_0x9bb320){return _0x9bb320[_0x27e7('0x33')]()[_0x27e7('0x34')](function(){_0x132156[_0x27e7('0x2a')](0xcc)[_0x27e7('0x35')]();});}};}function handleEntityNotFound(_0x32e3a9,_0x2bda5d){return function(_0x487f4d){if(!_0x487f4d){_0x32e3a9[_0x27e7('0x29')](0x194);}return _0x487f4d;};}function handleError(_0x41b2b4,_0x14174a){_0x14174a=_0x14174a||0x1f4;return function(_0x36ab52){logger[_0x27e7('0x24')](_0x36ab52[_0x27e7('0x36')]);if(_0x36ab52[_0x27e7('0x37')]){delete _0x36ab52[_0x27e7('0x37')];}_0x41b2b4[_0x27e7('0x2a')](_0x14174a)[_0x27e7('0x38')](_0x36ab52);};}exports[_0x27e7('0x39')]=function(_0x4fb1a7,_0x485870){var _0x2612f8={},_0x2c4bee={},_0x4cece8={'count':0x0,'rows':[]};var _0x22b3bd=_[_0x27e7('0x3a')](db[_0x27e7('0x3b')]['rawAttributes'],function(_0x5184db){return{'name':_0x5184db[_0x27e7('0x3c')],'type':_0x5184db['type'][_0x27e7('0x3d')]};});_0x2c4bee[_0x27e7('0x3e')]=_[_0x27e7('0x3a')](_0x22b3bd,'name');_0x2c4bee['query']=_[_0x27e7('0x3f')](_0x4fb1a7['query']);_0x2c4bee[_0x27e7('0x40')]=_[_0x27e7('0x41')](_0x2c4bee[_0x27e7('0x3e')],_0x2c4bee[_0x27e7('0x42')]);_0x2612f8[_0x27e7('0x43')]=_[_0x27e7('0x41')](_0x2c4bee[_0x27e7('0x3e')],qs[_0x27e7('0x44')](_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x44')]));_0x2612f8[_0x27e7('0x43')]=_0x2612f8[_0x27e7('0x43')][_0x27e7('0x45')]?_0x2612f8['attributes']:_0x2c4bee[_0x27e7('0x3e')];if(!_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x46')](_0x27e7('0x47'))){_0x2612f8[_0x27e7('0x2c')]=qs['limit'](_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x2c')]);_0x2612f8['offset']=qs[_0x27e7('0x2b')](_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x2b')]);}_0x2612f8[_0x27e7('0x48')]=qs[_0x27e7('0x49')](_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x49')]);_0x2612f8[_0x27e7('0x4a')]=qs[_0x27e7('0x40')](_[_0x27e7('0x4b')](_0x4fb1a7[_0x27e7('0x42')],_0x2c4bee['filters']),_0x22b3bd);if(_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x4c')]){_0x2612f8[_0x27e7('0x4a')]=_[_0x27e7('0x4d')](_0x2612f8[_0x27e7('0x4a')],{'$or':_[_0x27e7('0x3a')](_0x22b3bd,function(_0x3cfea0){if(_0x3cfea0[_0x27e7('0x4e')]!==_0x27e7('0x4f')){var _0x579c5b={};_0x579c5b[_0x3cfea0[_0x27e7('0x37')]]={'$like':'%'+_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x4c')]+'%'};return _0x579c5b;}})});}_0x2612f8=_[_0x27e7('0x4d')]({},_0x2612f8,_0x4fb1a7[_0x27e7('0x50')]);var _0x5ebe39={'where':_0x2612f8[_0x27e7('0x4a')]};return db[_0x27e7('0x3b')][_0x27e7('0x51')](_0x5ebe39)[_0x27e7('0x34')](function(_0x5ca61e){_0x4cece8[_0x27e7('0x51')]=_0x5ca61e;if(_0x4fb1a7[_0x27e7('0x42')][_0x27e7('0x52')]){_0x2612f8[_0x27e7('0x53')]=[{'all':!![]}];}return db[_0x27e7('0x3b')][_0x27e7('0x54')](_0x2612f8);})['then'](function(_0x4d98b9){_0x4cece8['rows']=_0x4d98b9;return _0x4cece8;})[_0x27e7('0x34')](respondWithFilteredResult(_0x485870,_0x2612f8))[_0x27e7('0x28')](handleError(_0x485870,null));};exports[_0x27e7('0x55')]=function(_0x30e4ce,_0x9f1a25){var _0x58030d={'raw':![],'where':{'id':_0x30e4ce[_0x27e7('0x56')]['id']}},_0x3b40ed={};_0x3b40ed['model']=_[_0x27e7('0x3f')](db[_0x27e7('0x3b')]['rawAttributes']);_0x3b40ed[_0x27e7('0x42')]=_[_0x27e7('0x3f')](_0x30e4ce[_0x27e7('0x42')]);_0x3b40ed[_0x27e7('0x57')]=_[_0x27e7('0x41')](_0x3b40ed[_0x27e7('0x3e')],_0x3b40ed[_0x27e7('0x42')]);_0x58030d[_0x27e7('0x43')]=_['intersection'](_0x3b40ed['model'],qs['fields'](_0x30e4ce[_0x27e7('0x42')][_0x27e7('0x44')]));_0x58030d[_0x27e7('0x43')]=_0x58030d[_0x27e7('0x43')][_0x27e7('0x45')]?_0x58030d[_0x27e7('0x43')]:_0x3b40ed['model'];if(_0x30e4ce[_0x27e7('0x42')][_0x27e7('0x52')]){_0x58030d['include']=[{'all':!![]}];}_0x58030d=_[_0x27e7('0x4d')]({},_0x58030d,_0x30e4ce[_0x27e7('0x50')]);return db[_0x27e7('0x3b')][_0x27e7('0x58')](_0x58030d)[_0x27e7('0x34')](handleEntityNotFound(_0x9f1a25,null))[_0x27e7('0x34')](respondWithResult(_0x9f1a25,null))[_0x27e7('0x28')](handleError(_0x9f1a25,null));};exports[_0x27e7('0x32')]=function(_0x4d2d45,_0x25908b){if(_0x4d2d45[_0x27e7('0x59')]['id']){delete _0x4d2d45[_0x27e7('0x59')]['id'];}return db[_0x27e7('0x3b')][_0x27e7('0x58')]({'where':{'id':_0x4d2d45[_0x27e7('0x56')]['id']}})[_0x27e7('0x34')](handleEntityNotFound(_0x25908b,null))[_0x27e7('0x34')](saveUpdates(_0x4d2d45['body'],null))[_0x27e7('0x34')](respondWithResult(_0x25908b,null))[_0x27e7('0x28')](handleError(_0x25908b,null));};exports[_0x27e7('0x5a')]=function(_0x2de5f2,_0xeb48f5,_0xee3ab4){if(_0x2de5f2['file']&&_0x2de5f2[_0x27e7('0x5b')][_0x27e7('0x5c')]){_0x2de5f2['body']['logo']=_0x2de5f2[_0x27e7('0x5b')][_0x27e7('0x5c')];}return db['Setting'][_0x27e7('0x58')]({'where':{'id':_0x2de5f2[_0x27e7('0x56')]['id']}})[_0x27e7('0x34')](handleEntityNotFound(_0xeb48f5,null))[_0x27e7('0x34')](saveUpdates(_0x2de5f2['body'],null))[_0x27e7('0x34')](respondWithResult(_0xeb48f5,null))[_0x27e7('0x28')](handleError(_0xeb48f5,null));};exports[_0x27e7('0x5d')]=function(_0x263ddd,_0x176214,_0x18c1c0){if(_0x263ddd[_0x27e7('0x5b')]&&_0x263ddd['file']['filename']){_0x263ddd['body']['loginLogo']=_0x263ddd['file'][_0x27e7('0x5c')];}return db[_0x27e7('0x3b')]['find']({'where':{'id':_0x263ddd[_0x27e7('0x56')]['id']}})['then'](handleEntityNotFound(_0x176214,null))[_0x27e7('0x34')](saveUpdates(_0x263ddd[_0x27e7('0x59')],null))[_0x27e7('0x34')](respondWithResult(_0x176214,null))[_0x27e7('0x28')](handleError(_0x176214,null));};var utilLicense=require(_0x27e7('0x1a'));exports[_0x27e7('0x5e')]=function(_0x168347,_0x798467,_0xdccaee){var _0x129e84=_0x27e7('0x5f');var _0x82c34c={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4965d0){if(_0x4965d0){_0x82c34c=_0x4965d0;}return db[_0x27e7('0x3b')]['find']({'where':{'id':_0x168347['params']['id']},'attributes':[_0x27e7('0x60'),_0x27e7('0x61'),_0x27e7('0x62'),_0x27e7('0x63'),_0x27e7('0x64'),_0x27e7('0x65'),_0x27e7('0x66'),_0x27e7('0x67')],'raw':!![]});})[_0x27e7('0x34')](handleEntityNotFound(_0x798467,null))['then'](function(_0x7c74ef){if(_0x7c74ef){var _0x16f64c=_0x7c74ef[_0x27e7('0x60')]&&fs[_0x27e7('0x68')](path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x129e84,_[_0x27e7('0x6b')](_0x7c74ef['logo'])))?path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x129e84,_[_0x27e7('0x6b')](_0x7c74ef['logo'])):path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x129e84,_[_0x27e7('0x6b')](_0x27e7('0x6c')));var _0x26b968=_0x27e7('0x6d')+_['upperFirst'](_0x27e7('0x60'));if(_0x7c74ef[_0x26b968]||!_0x82c34c[_0x27e7('0x6e')]){_0x16f64c=path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x129e84,_[_0x27e7('0x6b')](_0x27e7('0x6c')));}if(!fs[_0x27e7('0x68')](_0x16f64c)){throw new db['Sequelize']['ValidationError'](_[_0x27e7('0x6f')](_0x27e7('0x60'))+_0x27e7('0x70'));}return _0x798467[_0x27e7('0x71')](_0x16f64c);}})[_0x27e7('0x28')](handleError(_0x798467,null));};var utilLicense=require('../../config/license/util');exports[_0x27e7('0x72')]=function(_0x4df611,_0x406ff4,_0x1f1671){var _0x52a9e9=_0x27e7('0x5f');var _0x3cf408={'custom':![]};return utilLicense[_0x27e7('0x73')]()[_0x27e7('0x34')](function(_0x3ddb3b){if(_0x3ddb3b){_0x3cf408=_0x3ddb3b;}return db[_0x27e7('0x3b')][_0x27e7('0x58')]({'where':{'id':_0x4df611[_0x27e7('0x56')]['id']},'attributes':[_0x27e7('0x60'),_0x27e7('0x61'),_0x27e7('0x62'),'favicon',_0x27e7('0x64'),_0x27e7('0x65'),'defaultPreferred',_0x27e7('0x67')],'raw':!![]});})[_0x27e7('0x34')](handleEntityNotFound(_0x406ff4,null))[_0x27e7('0x34')](function(_0x52ab21){if(_0x52ab21){var _0x179cdb=_0x52ab21[_0x27e7('0x61')]&&fs[_0x27e7('0x68')](path['join'](config[_0x27e7('0x6a')],_0x52a9e9,_[_0x27e7('0x6b')](_0x52ab21['loginLogo'])))?path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x52a9e9,_[_0x27e7('0x6b')](_0x52ab21[_0x27e7('0x61')])):path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x52a9e9,_['toLower'](_0x27e7('0x74')));var _0x30ff42=_0x27e7('0x6d')+_['upperFirst'](_0x27e7('0x61'));if(_0x52ab21[_0x30ff42]||!_0x3cf408[_0x27e7('0x6e')]){_0x179cdb=path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x52a9e9,_[_0x27e7('0x6b')](_0x27e7('0x74')));}if(!fs[_0x27e7('0x68')](_0x179cdb)){throw new db[(_0x27e7('0x75'))][(_0x27e7('0x76'))](_[_0x27e7('0x6f')]('loginLogo')+'\x20not\x20found');}return _0x406ff4[_0x27e7('0x71')](_0x179cdb);}})[_0x27e7('0x28')](handleError(_0x406ff4,null));};exports[_0x27e7('0x77')]=function(_0xf70cc1,_0x57d499){return db[_0x27e7('0x3b')]['find']({'where':{'id':_0xf70cc1[_0x27e7('0x56')]['id']},'attributes':[_0x27e7('0x78')]})[_0x27e7('0x34')](respondWithResult(_0x57d499,null))[_0x27e7('0x28')](handleError(_0x57d499,null));};exports[_0x27e7('0x79')]=function(_0x37474e,_0xac72ff,_0x21ce1){if(_0x37474e['file']&&_0x37474e['file']['filename']){_0x37474e[_0x27e7('0x59')][_0x27e7('0x62')]=_0x37474e[_0x27e7('0x5b')][_0x27e7('0x5c')];}return db['Setting'][_0x27e7('0x58')]({'where':{'id':_0x37474e[_0x27e7('0x56')]['id']}})[_0x27e7('0x34')](handleEntityNotFound(_0xac72ff,null))[_0x27e7('0x34')](saveUpdates(_0x37474e[_0x27e7('0x59')],null))[_0x27e7('0x34')](respondWithResult(_0xac72ff,null))[_0x27e7('0x28')](handleError(_0xac72ff,null));};var utilLicense=require(_0x27e7('0x1a'));exports[_0x27e7('0x7a')]=function(_0x19cfd0,_0x1dbfce,_0x2f0ee3){var _0x4d9f7a=_0x27e7('0x5f');var _0x42b339={'custom':![]};return utilLicense[_0x27e7('0x73')]()[_0x27e7('0x34')](function(_0x32f935){if(_0x32f935){_0x42b339=_0x32f935;}return db[_0x27e7('0x3b')]['find']({'where':{'id':_0x19cfd0['params']['id']},'attributes':[_0x27e7('0x60'),_0x27e7('0x61'),_0x27e7('0x62'),_0x27e7('0x63'),'defaultLogo','defaultLoginLogo',_0x27e7('0x66'),_0x27e7('0x67')],'raw':!![]});})[_0x27e7('0x34')](handleEntityNotFound(_0x1dbfce,null))[_0x27e7('0x34')](function(_0x2fcc1f){if(_0x2fcc1f){var _0x145fde=_0x2fcc1f[_0x27e7('0x62')]&&fs[_0x27e7('0x68')](path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x4d9f7a,_[_0x27e7('0x6b')](_0x2fcc1f['preferred'])))?path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x4d9f7a,_[_0x27e7('0x6b')](_0x2fcc1f[_0x27e7('0x62')])):path[_0x27e7('0x69')](config['root'],_0x4d9f7a,_[_0x27e7('0x6b')](_0x27e7('0x7b')));var _0x23bd55='default'+_[_0x27e7('0x6f')](_0x27e7('0x62'));if(_0x2fcc1f[_0x23bd55]||!_0x42b339[_0x27e7('0x6e')]||!_0x42b339[_0x27e7('0x62')]){_0x145fde=path['join'](config['root'],_0x4d9f7a,_[_0x27e7('0x6b')](_0x27e7('0x7b')));}if(!fs[_0x27e7('0x68')](_0x145fde)){throw new db[(_0x27e7('0x75'))]['ValidationError'](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x1dbfce[_0x27e7('0x71')](_0x145fde);}})[_0x27e7('0x28')](handleError(_0x1dbfce,null));};exports['addFavicon']=function(_0x26aa4b,_0x22f0bd,_0x1e41c9){if(_0x26aa4b[_0x27e7('0x5b')]&&_0x26aa4b['file'][_0x27e7('0x5c')]){_0x26aa4b['body']['favicon']=_0x26aa4b['file'][_0x27e7('0x5c')];}return db[_0x27e7('0x3b')][_0x27e7('0x58')]({'where':{'id':_0x26aa4b[_0x27e7('0x56')]['id']}})[_0x27e7('0x34')](handleEntityNotFound(_0x22f0bd,null))[_0x27e7('0x34')](saveUpdates(_0x26aa4b[_0x27e7('0x59')],null))[_0x27e7('0x34')](respondWithResult(_0x22f0bd,null))[_0x27e7('0x28')](handleError(_0x22f0bd,null));};var utilLicense=require(_0x27e7('0x1a'));exports[_0x27e7('0x7c')]=function(_0x2e2475,_0x376041,_0x426506){var _0x4d3f29=_0x27e7('0x5f');var _0x15f402={'custom':![]};return utilLicense[_0x27e7('0x73')]()[_0x27e7('0x34')](function(_0x33dc67){if(_0x33dc67){_0x15f402=_0x33dc67;}return db[_0x27e7('0x3b')][_0x27e7('0x58')]({'where':{'id':_0x2e2475[_0x27e7('0x56')]['id']},'attributes':['logo',_0x27e7('0x61'),_0x27e7('0x62'),'favicon',_0x27e7('0x64'),_0x27e7('0x65'),_0x27e7('0x66'),_0x27e7('0x67')],'raw':!![]});})['then'](handleEntityNotFound(_0x376041,null))[_0x27e7('0x34')](function(_0x1c3175){if(_0x1c3175){var _0x26b944=_0x1c3175[_0x27e7('0x63')]&&fs['existsSync'](path[_0x27e7('0x69')](config['root'],_0x4d3f29,_[_0x27e7('0x6b')](_0x1c3175[_0x27e7('0x63')])))?path['join'](config[_0x27e7('0x6a')],_0x4d3f29,_['toLower'](_0x1c3175[_0x27e7('0x63')])):path[_0x27e7('0x69')](config[_0x27e7('0x6a')],_0x4d3f29,_[_0x27e7('0x6b')](_0x27e7('0x7d')));var _0xb47af7=_0x27e7('0x6d')+_[_0x27e7('0x6f')](_0x27e7('0x63'));if(_0x1c3175[_0xb47af7]||!_0x15f402[_0x27e7('0x6e')]){_0x26b944=path[_0x27e7('0x69')](config['root'],_0x4d3f29,_['toLower'](_0x27e7('0x7d')));}if(!fs[_0x27e7('0x68')](_0x26b944)){throw new db[(_0x27e7('0x75'))][(_0x27e7('0x76'))](_[_0x27e7('0x6f')](_0x27e7('0x63'))+_0x27e7('0x70'));}return _0x376041[_0x27e7('0x71')](_0x26b944);}})['catch'](handleError(_0x376041,null));}; \ No newline at end of file +var _0x6217=['merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','filtears','length','update','body','addLogo','file','filename','logo','addLogoLogin','find','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','download','default','default_loginLogo.svg','gdpr','securePassword','addPreferred','../../config/license/util','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','offset','Content-Range','json','apply','reject','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','filter'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6217,0xa7));var _0x7621=function(_0x4e170e,_0x207e58){_0x4e170e=_0x4e170e-0x0;var _0x338291=_0x6217[_0x4e170e];return _0x338291;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7621('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7621('0x1'));var rp=require(_0x7621('0x2'));var moment=require(_0x7621('0x3'));var BPromise=require(_0x7621('0x4'));var Mustache=require('mustache');var util=require(_0x7621('0x5'));var path=require(_0x7621('0x6'));var sox=require(_0x7621('0x7'));var csv=require(_0x7621('0x8'));var ejs=require(_0x7621('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7621('0xa'));var crypto=require('crypto');var jsforce=require(_0x7621('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7621('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7621('0xd'));var qs=require(_0x7621('0xe'));var as=require(_0x7621('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7621('0x10'));var utils=require(_0x7621('0x11'));var config=require(_0x7621('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x7621('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7621('0x14')][_0x7621('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x11e683,_0x5c636a,_0x5b9b6e,_0x37f9ba){return new BPromise(function(_0x5b3e06,_0x2ffe0c){var _0x298271=_0x37f9ba||client;return _0x298271['request'](_0x11e683,_0x5b9b6e)[_0x7621('0x16')](function(_0x46d704){logger['info'](_0x7621('0x17'),_0x5c636a,_0x7621('0x18'));logger[_0x7621('0x19')](_0x7621('0x1a'),_0x5c636a,'request\x20sent',JSON['stringify'](_0x46d704));if(_0x46d704[_0x7621('0x1b')]){if(_0x46d704['error'][_0x7621('0x1c')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x5c636a,_0x46d704['error'][_0x7621('0x1d')]);return _0x2ffe0c(_0x46d704[_0x7621('0x1b')][_0x7621('0x1d')]);}logger[_0x7621('0x1b')](_0x7621('0x17'),_0x5c636a,_0x46d704[_0x7621('0x1b')][_0x7621('0x1d')]);return _0x5b3e06(_0x46d704['error'][_0x7621('0x1d')]);}else{logger[_0x7621('0x1e')](_0x7621('0x17'),_0x5c636a,_0x7621('0x18'));_0x5b3e06(_0x46d704[_0x7621('0x1f')][_0x7621('0x1d')]);}})[_0x7621('0x20')](function(_0x54b64e){logger[_0x7621('0x1b')](_0x7621('0x17'),_0x5c636a,_0x54b64e);_0x2ffe0c(_0x54b64e);});});}function respondWithStatusCode(_0x2fa8f,_0x3f71b8){_0x3f71b8=_0x3f71b8||0xcc;return function(_0x1c9794){if(_0x1c9794){return _0x2fa8f[_0x7621('0x21')](_0x3f71b8);}return _0x2fa8f[_0x7621('0x22')](_0x3f71b8)[_0x7621('0x23')]();};}function respondWithResult(_0x1355a2,_0x2f1671){_0x2f1671=_0x2f1671||0xc8;return function(_0x51caa1){if(_0x51caa1){return _0x1355a2[_0x7621('0x22')](_0x2f1671)['json'](_0x51caa1);}};}function respondWithFilteredResult(_0x4023c6,_0x5287ea){return function(_0x1852cd){if(_0x1852cd){var _0x33c1cc=_0x1852cd['count'],_0x5e0f35=_0x5287ea[_0x7621('0x24')],_0x56a6e6=_0x5287ea['offset']+_0x5287ea['limit'],_0x20d19b;if(_0x56a6e6>=_0x33c1cc){_0x56a6e6=_0x33c1cc;_0x20d19b=0xc8;}else{_0x20d19b=0xce;}_0x4023c6['status'](_0x20d19b);return _0x4023c6['set'](_0x7621('0x25'),_0x5e0f35+'-'+_0x56a6e6+'/'+_0x33c1cc)[_0x7621('0x26')](_0x1852cd);}return null;};}function patchUpdates(_0x505b9b){return function(_0x4134dd){try{jsonpatch[_0x7621('0x27')](_0x4134dd,_0x505b9b,!![]);}catch(_0x638513){return BPromise[_0x7621('0x28')](_0x638513);}return _0x4134dd['save']();};}function saveUpdates(_0x267a34,_0x2c2fa4){return function(_0x472d87){if(_0x472d87){return _0x472d87['update'](_0x267a34)[_0x7621('0x16')](function(_0x46c6ee){return _0x46c6ee;});}return null;};}function removeEntity(_0x4b0864,_0xb84d89){return function(_0xc24f3){if(_0xc24f3){return _0xc24f3[_0x7621('0x29')]()['then'](function(){_0x4b0864[_0x7621('0x22')](0xcc)[_0x7621('0x23')]();});}};}function handleEntityNotFound(_0x298b70,_0x503375){return function(_0x5e77d3){if(!_0x5e77d3){_0x298b70[_0x7621('0x21')](0x194);}return _0x5e77d3;};}function handleError(_0x151ebd,_0x44317a){_0x44317a=_0x44317a||0x1f4;return function(_0x1661fb){logger['error'](_0x1661fb[_0x7621('0x2a')]);if(_0x1661fb[_0x7621('0x2b')]){delete _0x1661fb[_0x7621('0x2b')];}_0x151ebd['status'](_0x44317a)[_0x7621('0x2c')](_0x1661fb);};}exports[_0x7621('0x2d')]=function(_0x2a2be6,_0x48946a){var _0x17463a={},_0x5ebcac={},_0x1555d2={'count':0x0,'rows':[]};var _0x5ad585=_['map'](db[_0x7621('0x2e')][_0x7621('0x2f')],function(_0x4453f0){return{'name':_0x4453f0[_0x7621('0x30')],'type':_0x4453f0[_0x7621('0x31')][_0x7621('0x32')]};});_0x5ebcac[_0x7621('0x33')]=_[_0x7621('0x34')](_0x5ad585,_0x7621('0x2b'));_0x5ebcac[_0x7621('0x35')]=_[_0x7621('0x36')](_0x2a2be6[_0x7621('0x35')]);_0x5ebcac[_0x7621('0x37')]=_[_0x7621('0x38')](_0x5ebcac['model'],_0x5ebcac[_0x7621('0x35')]);_0x17463a[_0x7621('0x39')]=_[_0x7621('0x38')](_0x5ebcac['model'],qs[_0x7621('0x3a')](_0x2a2be6[_0x7621('0x35')][_0x7621('0x3a')]));_0x17463a[_0x7621('0x39')]=_0x17463a['attributes']['length']?_0x17463a[_0x7621('0x39')]:_0x5ebcac['model'];if(!_0x2a2be6[_0x7621('0x35')]['hasOwnProperty'](_0x7621('0x3b'))){_0x17463a[_0x7621('0x3c')]=qs[_0x7621('0x3c')](_0x2a2be6['query']['limit']);_0x17463a['offset']=qs[_0x7621('0x24')](_0x2a2be6[_0x7621('0x35')][_0x7621('0x24')]);}_0x17463a['order']=qs['sort'](_0x2a2be6[_0x7621('0x35')][_0x7621('0x3d')]);_0x17463a[_0x7621('0x3e')]=qs[_0x7621('0x37')](_[_0x7621('0x3f')](_0x2a2be6[_0x7621('0x35')],_0x5ebcac[_0x7621('0x37')]),_0x5ad585);if(_0x2a2be6['query'][_0x7621('0x40')]){_0x17463a[_0x7621('0x3e')]=_[_0x7621('0x41')](_0x17463a[_0x7621('0x3e')],{'$or':_[_0x7621('0x34')](_0x5ad585,function(_0x12123d){if(_0x12123d[_0x7621('0x31')]!==_0x7621('0x42')){var _0x5e01f8={};_0x5e01f8[_0x12123d['name']]={'$like':'%'+_0x2a2be6[_0x7621('0x35')]['filter']+'%'};return _0x5e01f8;}})});}_0x17463a=_[_0x7621('0x41')]({},_0x17463a,_0x2a2be6[_0x7621('0x43')]);var _0x3bb2a9={'where':_0x17463a['where']};return db[_0x7621('0x2e')][_0x7621('0x44')](_0x3bb2a9)[_0x7621('0x16')](function(_0x58e392){_0x1555d2[_0x7621('0x44')]=_0x58e392;if(_0x2a2be6[_0x7621('0x35')][_0x7621('0x45')]){_0x17463a[_0x7621('0x46')]=[{'all':!![]}];}return db[_0x7621('0x2e')][_0x7621('0x47')](_0x17463a);})[_0x7621('0x16')](function(_0x3bcbc4){_0x1555d2[_0x7621('0x48')]=_0x3bcbc4;return _0x1555d2;})['then'](respondWithFilteredResult(_0x48946a,_0x17463a))[_0x7621('0x20')](handleError(_0x48946a,null));};exports['show']=function(_0x2500fe,_0x546ac4){var _0x2e1999={'raw':![],'where':{'id':_0x2500fe[_0x7621('0x49')]['id']}},_0xb3b501={};_0xb3b501[_0x7621('0x33')]=_[_0x7621('0x36')](db[_0x7621('0x2e')][_0x7621('0x2f')]);_0xb3b501[_0x7621('0x35')]=_[_0x7621('0x36')](_0x2500fe[_0x7621('0x35')]);_0xb3b501[_0x7621('0x4a')]=_['intersection'](_0xb3b501[_0x7621('0x33')],_0xb3b501[_0x7621('0x35')]);_0x2e1999['attributes']=_['intersection'](_0xb3b501[_0x7621('0x33')],qs['fields'](_0x2500fe[_0x7621('0x35')]['fields']));_0x2e1999[_0x7621('0x39')]=_0x2e1999[_0x7621('0x39')][_0x7621('0x4b')]?_0x2e1999['attributes']:_0xb3b501['model'];if(_0x2500fe[_0x7621('0x35')][_0x7621('0x45')]){_0x2e1999['include']=[{'all':!![]}];}_0x2e1999=_['merge']({},_0x2e1999,_0x2500fe[_0x7621('0x43')]);return db['Setting']['find'](_0x2e1999)[_0x7621('0x16')](handleEntityNotFound(_0x546ac4,null))['then'](respondWithResult(_0x546ac4,null))[_0x7621('0x20')](handleError(_0x546ac4,null));};exports[_0x7621('0x4c')]=function(_0x2c6977,_0x3ea90d){if(_0x2c6977[_0x7621('0x4d')]['id']){delete _0x2c6977[_0x7621('0x4d')]['id'];}return db[_0x7621('0x2e')]['find']({'where':{'id':_0x2c6977[_0x7621('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ea90d,null))['then'](saveUpdates(_0x2c6977[_0x7621('0x4d')],null))[_0x7621('0x16')](respondWithResult(_0x3ea90d,null))[_0x7621('0x20')](handleError(_0x3ea90d,null));};exports[_0x7621('0x4e')]=function(_0x3daf2c,_0x256d2b,_0x2a48be){if(_0x3daf2c[_0x7621('0x4f')]&&_0x3daf2c[_0x7621('0x4f')][_0x7621('0x50')]){_0x3daf2c[_0x7621('0x4d')][_0x7621('0x51')]=_0x3daf2c[_0x7621('0x4f')][_0x7621('0x50')];}return db[_0x7621('0x2e')]['find']({'where':{'id':_0x3daf2c[_0x7621('0x49')]['id']}})['then'](handleEntityNotFound(_0x256d2b,null))[_0x7621('0x16')](saveUpdates(_0x3daf2c[_0x7621('0x4d')],null))[_0x7621('0x16')](respondWithResult(_0x256d2b,null))[_0x7621('0x20')](handleError(_0x256d2b,null));};exports[_0x7621('0x52')]=function(_0x1d509f,_0x2f33c8,_0x575f44){if(_0x1d509f[_0x7621('0x4f')]&&_0x1d509f[_0x7621('0x4f')][_0x7621('0x50')]){_0x1d509f[_0x7621('0x4d')]['loginLogo']=_0x1d509f[_0x7621('0x4f')][_0x7621('0x50')];}return db[_0x7621('0x2e')][_0x7621('0x53')]({'where':{'id':_0x1d509f[_0x7621('0x49')]['id']}})[_0x7621('0x16')](handleEntityNotFound(_0x2f33c8,null))[_0x7621('0x16')](saveUpdates(_0x1d509f[_0x7621('0x4d')],null))[_0x7621('0x16')](respondWithResult(_0x2f33c8,null))[_0x7621('0x20')](handleError(_0x2f33c8,null));};var utilLicense=require('../../config/license/util');exports[_0x7621('0x54')]=function(_0x57fb4b,_0x29b529,_0x5caf95){var _0x44409c=_0x7621('0x55');var _0x178f06={'custom':![]};return utilLicense[_0x7621('0x56')]()['then'](function(_0x1b6068){if(_0x1b6068){_0x178f06=_0x1b6068;}return db['Setting'][_0x7621('0x53')]({'where':{'id':_0x57fb4b[_0x7621('0x49')]['id']},'attributes':[_0x7621('0x51'),_0x7621('0x57'),_0x7621('0x58'),_0x7621('0x59'),_0x7621('0x5a'),_0x7621('0x5b'),_0x7621('0x5c'),_0x7621('0x5d')],'raw':!![]});})[_0x7621('0x16')](handleEntityNotFound(_0x29b529,null))[_0x7621('0x16')](function(_0x5a38d0){if(_0x5a38d0){var _0xd7947a=_0x5a38d0[_0x7621('0x51')]&&fs[_0x7621('0x5e')](path['join'](config[_0x7621('0x5f')],_0x44409c,_['toLower'](_0x5a38d0[_0x7621('0x51')])))?path['join'](config[_0x7621('0x5f')],_0x44409c,_[_0x7621('0x60')](_0x5a38d0[_0x7621('0x51')])):path[_0x7621('0x61')](config[_0x7621('0x5f')],_0x44409c,_[_0x7621('0x60')]('default_logo.svg'));var _0x55ceba='default'+_[_0x7621('0x62')](_0x7621('0x51'));if(_0x5a38d0[_0x55ceba]||!_0x178f06[_0x7621('0x63')]){_0xd7947a=path['join'](config[_0x7621('0x5f')],_0x44409c,_[_0x7621('0x60')](_0x7621('0x64')));}if(!fs[_0x7621('0x5e')](_0xd7947a)){throw new db[(_0x7621('0x65'))][(_0x7621('0x66'))](_[_0x7621('0x62')]('logo')+'\x20not\x20found');}return _0x29b529[_0x7621('0x67')](_0xd7947a);}})['catch'](handleError(_0x29b529,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x49e005,_0x413973,_0x2243db){var _0xb5f6a5='server/files/images/logos';var _0x3bb85c={'custom':![]};return utilLicense[_0x7621('0x56')]()['then'](function(_0x148d8e){if(_0x148d8e){_0x3bb85c=_0x148d8e;}return db[_0x7621('0x2e')][_0x7621('0x53')]({'where':{'id':_0x49e005[_0x7621('0x49')]['id']},'attributes':[_0x7621('0x51'),'loginLogo',_0x7621('0x58'),'favicon',_0x7621('0x5a'),'defaultLoginLogo',_0x7621('0x5c'),_0x7621('0x5d')],'raw':!![]});})[_0x7621('0x16')](handleEntityNotFound(_0x413973,null))[_0x7621('0x16')](function(_0x40ef97){if(_0x40ef97){var _0x590d47=_0x40ef97[_0x7621('0x57')]&&fs[_0x7621('0x5e')](path[_0x7621('0x61')](config['root'],_0xb5f6a5,_['toLower'](_0x40ef97[_0x7621('0x57')])))?path[_0x7621('0x61')](config[_0x7621('0x5f')],_0xb5f6a5,_['toLower'](_0x40ef97['loginLogo'])):path['join'](config['root'],_0xb5f6a5,_[_0x7621('0x60')]('default_loginLogo.svg'));var _0x331da1=_0x7621('0x68')+_[_0x7621('0x62')](_0x7621('0x57'));if(_0x40ef97[_0x331da1]||!_0x3bb85c['custom']){_0x590d47=path[_0x7621('0x61')](config[_0x7621('0x5f')],_0xb5f6a5,_[_0x7621('0x60')](_0x7621('0x69')));}if(!fs[_0x7621('0x5e')](_0x590d47)){throw new db['Sequelize'][(_0x7621('0x66'))](_['upperFirst']('loginLogo')+'\x20not\x20found');}return _0x413973[_0x7621('0x67')](_0x590d47);}})['catch'](handleError(_0x413973,null));};exports[_0x7621('0x6a')]=function(_0x418be3,_0xfdf86c){return db[_0x7621('0x2e')][_0x7621('0x53')]({'where':{'id':_0x418be3['params']['id']},'attributes':[_0x7621('0x6b')]})['then'](respondWithResult(_0xfdf86c,null))[_0x7621('0x20')](handleError(_0xfdf86c,null));};exports[_0x7621('0x6c')]=function(_0x48ac27,_0x11bedb,_0x5d2fea){if(_0x48ac27['file']&&_0x48ac27['file']['filename']){_0x48ac27[_0x7621('0x4d')][_0x7621('0x58')]=_0x48ac27['file']['filename'];}return db[_0x7621('0x2e')][_0x7621('0x53')]({'where':{'id':_0x48ac27[_0x7621('0x49')]['id']}})[_0x7621('0x16')](handleEntityNotFound(_0x11bedb,null))[_0x7621('0x16')](saveUpdates(_0x48ac27['body'],null))[_0x7621('0x16')](respondWithResult(_0x11bedb,null))[_0x7621('0x20')](handleError(_0x11bedb,null));};var utilLicense=require(_0x7621('0x6d'));exports[_0x7621('0x6e')]=function(_0x1c825a,_0x489567,_0x2e48c9){var _0x23b84c=_0x7621('0x55');var _0x42b0e0={'custom':![]};return utilLicense[_0x7621('0x56')]()[_0x7621('0x16')](function(_0x2ffd30){if(_0x2ffd30){_0x42b0e0=_0x2ffd30;}return db['Setting'][_0x7621('0x53')]({'where':{'id':_0x1c825a[_0x7621('0x49')]['id']},'attributes':['logo',_0x7621('0x57'),_0x7621('0x58'),'favicon',_0x7621('0x5a'),'defaultLoginLogo',_0x7621('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x7621('0x16')](handleEntityNotFound(_0x489567,null))[_0x7621('0x16')](function(_0x514474){if(_0x514474){var _0x171a26=_0x514474[_0x7621('0x58')]&&fs[_0x7621('0x5e')](path[_0x7621('0x61')](config['root'],_0x23b84c,_['toLower'](_0x514474[_0x7621('0x58')])))?path[_0x7621('0x61')](config[_0x7621('0x5f')],_0x23b84c,_[_0x7621('0x60')](_0x514474[_0x7621('0x58')])):path[_0x7621('0x61')](config[_0x7621('0x5f')],_0x23b84c,_[_0x7621('0x60')]('default_preferred.png'));var _0x19e2d9=_0x7621('0x68')+_[_0x7621('0x62')]('preferred');if(_0x514474[_0x19e2d9]||!_0x42b0e0[_0x7621('0x63')]||!_0x42b0e0['preferred']){_0x171a26=path[_0x7621('0x61')](config[_0x7621('0x5f')],_0x23b84c,_[_0x7621('0x60')](_0x7621('0x6f')));}if(!fs[_0x7621('0x5e')](_0x171a26)){throw new db[(_0x7621('0x65'))][(_0x7621('0x66'))](_[_0x7621('0x62')]('preferred')+_0x7621('0x70'));}return _0x489567[_0x7621('0x67')](_0x171a26);}})[_0x7621('0x20')](handleError(_0x489567,null));};exports[_0x7621('0x71')]=function(_0x2c880f,_0x302c53,_0x5e6d03){if(_0x2c880f[_0x7621('0x4f')]&&_0x2c880f[_0x7621('0x4f')][_0x7621('0x50')]){_0x2c880f[_0x7621('0x4d')]['favicon']=_0x2c880f[_0x7621('0x4f')]['filename'];}return db['Setting'][_0x7621('0x53')]({'where':{'id':_0x2c880f[_0x7621('0x49')]['id']}})['then'](handleEntityNotFound(_0x302c53,null))['then'](saveUpdates(_0x2c880f['body'],null))[_0x7621('0x16')](respondWithResult(_0x302c53,null))[_0x7621('0x20')](handleError(_0x302c53,null));};var utilLicense=require(_0x7621('0x6d'));exports[_0x7621('0x72')]=function(_0x293e55,_0x2cd356,_0x533ee2){var _0x20bb47=_0x7621('0x55');var _0x42f6f1={'custom':![]};return utilLicense[_0x7621('0x56')]()[_0x7621('0x16')](function(_0x1c8c9e){if(_0x1c8c9e){_0x42f6f1=_0x1c8c9e;}return db[_0x7621('0x2e')]['find']({'where':{'id':_0x293e55[_0x7621('0x49')]['id']},'attributes':['logo',_0x7621('0x57'),_0x7621('0x58'),_0x7621('0x59'),_0x7621('0x5a'),_0x7621('0x5b'),_0x7621('0x5c'),_0x7621('0x5d')],'raw':!![]});})[_0x7621('0x16')](handleEntityNotFound(_0x2cd356,null))[_0x7621('0x16')](function(_0x532df0){if(_0x532df0){var _0x227623=_0x532df0[_0x7621('0x59')]&&fs['existsSync'](path[_0x7621('0x61')](config[_0x7621('0x5f')],_0x20bb47,_[_0x7621('0x60')](_0x532df0[_0x7621('0x59')])))?path['join'](config[_0x7621('0x5f')],_0x20bb47,_[_0x7621('0x60')](_0x532df0['favicon'])):path[_0x7621('0x61')](config['root'],_0x20bb47,_[_0x7621('0x60')](_0x7621('0x73')));var _0x4486af=_0x7621('0x68')+_[_0x7621('0x62')](_0x7621('0x59'));if(_0x532df0[_0x4486af]||!_0x42f6f1[_0x7621('0x63')]){_0x227623=path['join'](config[_0x7621('0x5f')],_0x20bb47,_[_0x7621('0x60')](_0x7621('0x73')));}if(!fs[_0x7621('0x5e')](_0x227623)){throw new db[(_0x7621('0x65'))][(_0x7621('0x66'))](_[_0x7621('0x62')](_0x7621('0x59'))+_0x7621('0x70'));}return _0x2cd356['download'](_0x227623);}})[_0x7621('0x20')](handleError(_0x2cd356,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 02bded4..44ad79b 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 _0x7932=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','settings'];(function(_0x85fb66,_0x3b48e9){var _0x440cd7=function(_0x16925b){while(--_0x16925b){_0x85fb66['push'](_0x85fb66['shift']());}};_0x440cd7(++_0x3b48e9);}(_0x7932,0xb6));var _0x2793=function(_0x3fb0cc,_0x22f87a){_0x3fb0cc=_0x3fb0cc-0x0;var _0x248c0c=_0x7932[_0x3fb0cc];return _0x248c0c;};'use strict';var _=require(_0x2793('0x0'));var util=require(_0x2793('0x1'));var logger=require(_0x2793('0x2'))(_0x2793('0x3'));var moment=require(_0x2793('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2793('0x5'));var rimraf=require(_0x2793('0x6'));var config=require(_0x2793('0x7'));var attributes=require(_0x2793('0x8'));module[_0x2793('0x9')]=function(_0xa70778,_0x323083){return _0xa70778[_0x2793('0xa')](_0x2793('0xb'),attributes,{'tableName':_0x2793('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4678=['api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','define','settings','util'];(function(_0x1f653e,_0x54b3ee){var _0x744f60=function(_0x701f10){while(--_0x701f10){_0x1f653e['push'](_0x1f653e['shift']());}};_0x744f60(++_0x54b3ee);}(_0x4678,0x99));var _0x8467=function(_0x4cb2f3,_0x179a2b){_0x4cb2f3=_0x4cb2f3-0x0;var _0x5bda9b=_0x4678[_0x4cb2f3];return _0x5bda9b;};'use strict';var _=require('lodash');var util=require(_0x8467('0x0'));var logger=require('../../config/logger')(_0x8467('0x1'));var moment=require('moment');var BPromise=require(_0x8467('0x2'));var rp=require(_0x8467('0x3'));var fs=require('fs');var path=require(_0x8467('0x4'));var rimraf=require(_0x8467('0x5'));var config=require(_0x8467('0x6'));var attributes=require(_0x8467('0x7'));module[_0x8467('0x8')]=function(_0x291ca4,_0x1ba55c){return _0x291ca4[_0x8467('0x9')]('Setting',attributes,{'tableName':_0x8467('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 62d8a9f..93f4bd6 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 _0x149f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x490c83,_0x5c6ab8){var _0x373997=function(_0x27547f){while(--_0x27547f){_0x490c83['push'](_0x490c83['shift']());}};_0x373997(++_0x5c6ab8);}(_0x149f,0x127));var _0xf149=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x149f[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xf149('0x0'));var util=require(_0xf149('0x1'));var moment=require(_0xf149('0x2'));var BPromise=require('bluebird');var rs=require(_0xf149('0x3'));var fs=require('fs');var Redis=require(_0xf149('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf149('0x5'));var logger=require(_0xf149('0x6'))(_0xf149('0x7'));var config=require(_0xf149('0x8'));var jayson=require(_0xf149('0x9'));var client=jayson[_0xf149('0xa')][_0xf149('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fc1d1,_0x3980db,_0x485bee){return new BPromise(function(_0x1e5d1d,_0x5cd867){return client[_0xf149('0xc')](_0x2fc1d1,_0x485bee)[_0xf149('0xd')](function(_0x303490){logger['info'](_0xf149('0xe'),_0x3980db,_0xf149('0xf'));logger[_0xf149('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x3980db,_0xf149('0xf'),JSON['stringify'](_0x303490));if(_0x303490[_0xf149('0x11')]){if(_0x303490[_0xf149('0x11')][_0xf149('0x12')]===0x1f4){logger[_0xf149('0x11')](_0xf149('0xe'),_0x3980db,_0x303490[_0xf149('0x11')]['message']);return _0x5cd867(_0x303490[_0xf149('0x11')]['message']);}logger[_0xf149('0x11')]('Setting,\x20%s,\x20%s',_0x3980db,_0x303490[_0xf149('0x11')][_0xf149('0x13')]);return _0x1e5d1d(_0x303490[_0xf149('0x11')][_0xf149('0x13')]);}else{logger[_0xf149('0x14')](_0xf149('0xe'),_0x3980db,'request\x20sent');_0x1e5d1d(_0x303490[_0xf149('0x15')][_0xf149('0x13')]);}})[_0xf149('0x16')](function(_0x50418b){logger[_0xf149('0x11')](_0xf149('0xe'),_0x3980db,_0x50418b);_0x5cd867(_0x50418b);});});} \ No newline at end of file +var _0xa161=['../../mysqldb','rpc','client','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x398e76,_0x4aefff){var _0x4e2f9b=function(_0xbf864d){while(--_0xbf864d){_0x398e76['push'](_0x398e76['shift']());}};_0x4e2f9b(++_0x4aefff);}(_0xa161,0x164));var _0x1a16=function(_0x148c6a,_0x16b874){_0x148c6a=_0x148c6a-0x0;var _0x186903=_0xa161[_0x148c6a];return _0x186903;};'use strict';var _=require('lodash');var util=require(_0x1a16('0x0'));var moment=require(_0x1a16('0x1'));var BPromise=require(_0x1a16('0x2'));var rs=require(_0x1a16('0x3'));var fs=require('fs');var Redis=require(_0x1a16('0x4'));var db=require(_0x1a16('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a16('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a16('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186260,_0x4520de,_0x4b3c03){return new BPromise(function(_0x1518a1,_0x38a120){return client['request'](_0x186260,_0x4b3c03)[_0x1a16('0x8')](function(_0x3994c9){logger[_0x1a16('0x9')](_0x1a16('0xa'),_0x4520de,'request\x20sent');logger[_0x1a16('0xb')](_0x1a16('0xc'),_0x4520de,'request\x20sent',JSON['stringify'](_0x3994c9));if(_0x3994c9['error']){if(_0x3994c9[_0x1a16('0xd')][_0x1a16('0xe')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4520de,_0x3994c9['error'][_0x1a16('0xf')]);return _0x38a120(_0x3994c9[_0x1a16('0xd')][_0x1a16('0xf')]);}logger[_0x1a16('0xd')](_0x1a16('0xa'),_0x4520de,_0x3994c9['error'][_0x1a16('0xf')]);return _0x1518a1(_0x3994c9[_0x1a16('0xd')][_0x1a16('0xf')]);}else{logger[_0x1a16('0x9')]('Setting,\x20%s,\x20%s',_0x4520de,_0x1a16('0x10'));_0x1518a1(_0x3994c9[_0x1a16('0x11')][_0x1a16('0xf')]);}})[_0x1a16('0x12')](function(_0x5dac4c){logger['error'](_0x1a16('0xa'),_0x4520de,_0x5dac4c);_0x38a120(_0x5dac4c);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e26d861..4ef60bb 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 _0xb10b=['destroy','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','update','delete'];(function(_0x569a06,_0x410514){var _0x107171=function(_0x16cbfc){while(--_0x16cbfc){_0x569a06['push'](_0x569a06['shift']());}};_0x107171(++_0x410514);}(_0xb10b,0x12a));var _0xbb10=function(_0xbe6d5d,_0x308a41){_0xbe6d5d=_0xbe6d5d-0x0;var _0x2cb584=_0xb10b[_0xbe6d5d];return _0x2cb584;};'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['getDispositions']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x8')](_0xbb10('0x13'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x8')]('/:id/status',controller[_0xbb10('0x15')]);router[_0xbb10('0x8')](_0xbb10('0x16'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x18')](_0xbb10('0xe'),auth['isAuthenticated'](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x18')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x18')](_0xbb10('0x1c'),controller[_0xbb10('0x1d')]);router[_0xbb10('0x18')](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x18')](_0xbb10('0x1f'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x20')]);router[_0xbb10('0x18')]('/:id/status',controller[_0xbb10('0x21')]);router[_0xbb10('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x22')]);router[_0xbb10('0x23')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xbb10('0x9')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0x9')](),controller[_0xbb10('0x28')]);module[_0xbb10('0x29')]=router; \ No newline at end of file +var _0xe706=['getInteractions','/:id/users','post','addDisposition','/:id/notify','addApplications','/:id/send','send','/:id/status','status','addAgents','update','delete','removeAnswers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions'];(function(_0x4557f1,_0x1f5bc6){var _0x20c724=function(_0x38a747){while(--_0x38a747){_0x4557f1['push'](_0x4557f1['shift']());}};_0x20c724(++_0x1f5bc6);}(_0xe706,0xa3));var _0x6e70=function(_0x416586,_0xbdf0b1){_0x416586=_0x416586-0x0;var _0x5cbb10=_0xe706[_0x416586];return _0x5cbb10;};'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('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['getAnswers']);router['get'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x9')](_0x6e70('0x15'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x9')]('/:id/status',controller['statusGet']);router['get'](_0x6e70('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6e70('0x18')]('/',auth[_0x6e70('0xa')](),controller['create']);router[_0x6e70('0x18')]('/:id/dispositions',auth[_0x6e70('0xa')](),controller[_0x6e70('0x19')]);router['post']('/:id/canned_answers',auth[_0x6e70('0xa')](),controller['addAnswer']);router[_0x6e70('0x18')](_0x6e70('0x1a'),controller['notify']);router['post'](_0x6e70('0x13'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1b')]);router[_0x6e70('0x18')](_0x6e70('0x1c'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x1d')]);router[_0x6e70('0x18')](_0x6e70('0x1e'),controller[_0x6e70('0x1f')]);router['post'](_0x6e70('0x17'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x20')]);router['put'](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x21')]);router['delete'](_0x6e70('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller['removeDispositions']);router[_0x6e70('0x22')](_0x6e70('0x12'),auth['isAuthenticated'](),controller[_0x6e70('0x23')]);router[_0x6e70('0x22')](_0x6e70('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6e70('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 3e7a8aa..b2fade4 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 _0x5e5f=['sequelize','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','csc','infobip','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x5e5f,0x18f));var _0xf5e5=function(_0x27e584,_0x4278cb){_0x27e584=_0x27e584-0x0;var _0x52220c=_0x5e5f[_0x27e584];return _0x52220c;};'use strict';var Sequelize=require(_0xf5e5('0x0'));var rs=require('randomstring');module[_0xf5e5('0x1')]={'name':{'type':Sequelize[_0xf5e5('0x2')],'unique':_0xf5e5('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xf5e5('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf5e5('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf5e5('0x2')],'defaultValue':function(){return rs[_0xf5e5('0x4')]();}},'phone':{'type':Sequelize[_0xf5e5('0x2')]},'type':{'type':Sequelize['ENUM'](_0xf5e5('0x5'),_0xf5e5('0x6'),_0xf5e5('0x7'),_0xf5e5('0x8'),'plivo','clickatell',_0xf5e5('0x9'),_0xf5e5('0xa'),_0xf5e5('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf5e5('0x2')]},'smsMethod':{'type':Sequelize[_0xf5e5('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf5e5('0x2')]},'password':{'type':Sequelize[_0xf5e5('0x2')]},'apiKey':{'type':Sequelize[_0xf5e5('0x2')]},'senderString':{'type':Sequelize[_0xf5e5('0x2')]},'deliveryReport':{'type':Sequelize[_0xf5e5('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xf5e5('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf5e5('0xe')],'defaultValue':function(){return _0xf5e5('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf5e5('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf5e5('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf5e5('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf5e5('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf5e5('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf5e5('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf5e5('0x10')],'comment':_0xf5e5('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xf5e5('0xd')],'defaultValue':![],'comment':_0xf5e5('0x12'),'set':function(_0x46dc59){if(!_0x46dc59)this[_0xf5e5('0x13')]('mandatoryDispositionPauseId',null);this[_0xf5e5('0x13')](_0xf5e5('0x14'),_0x46dc59);}}}; \ No newline at end of file +var _0xd8fc=['csc','intelepeer','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','STRING','name','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x563143,_0x1d3735){var _0x22c235=function(_0x8d2643){while(--_0x8d2643){_0x563143['push'](_0x563143['shift']());}};_0x22c235(++_0x1d3735);}(_0xd8fc,0x6e));var _0xcd8f=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xd8fc[_0x648163];return _0x199d4d;};'use strict';var Sequelize=require(_0xcd8f('0x0'));var rs=require(_0xcd8f('0x1'));module[_0xcd8f('0x2')]={'name':{'type':Sequelize[_0xcd8f('0x3')],'unique':_0xcd8f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xcd8f('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xcd8f('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xcd8f('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0xcd8f('0x5'),_0xcd8f('0x6'),_0xcd8f('0x7'),_0xcd8f('0x8'),_0xcd8f('0x9'),_0xcd8f('0xa'),'infobip',_0xcd8f('0xb'))},'accountSid':{'type':Sequelize[_0xcd8f('0x3')]},'authId':{'type':Sequelize[_0xcd8f('0x3')]},'authToken':{'type':Sequelize[_0xcd8f('0x3')]},'smsMethod':{'type':Sequelize[_0xcd8f('0xc')]('SI','TI','GP')},'username':{'type':Sequelize[_0xcd8f('0x3')]},'password':{'type':Sequelize[_0xcd8f('0x3')]},'apiKey':{'type':Sequelize[_0xcd8f('0x3')]},'senderString':{'type':Sequelize[_0xcd8f('0x3')]},'deliveryReport':{'type':Sequelize[_0xcd8f('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xcd8f('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcd8f('0xe')],'defaultValue':function(){return _0xcd8f('0xf');}},'notificationSound':{'type':Sequelize[_0xcd8f('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcd8f('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd8f('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd8f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd8f('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd8f('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd8f('0x10')],'comment':_0xcd8f('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcd8f('0x12'),'set':function(_0x2b9670){if(!_0x2b9670)this[_0xcd8f('0x13')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x2b9670);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 90241f9..a78f5e0 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 _0x2c5f=['error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','apply','save','update','SmsAccounts','UserProfileResource','destroy','name','send','index','Pause','map','SmsAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','filtears','includeAll','find','create','body','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','Disposition','pick','SmsAccountId','ids','CannedAnswer','removeAnswers','notify','sms','Applications','account','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','\x0a','addApplications','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','hasOwnProperty','getInteractions','Owner','fullname','Tag','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x2c5f,0x1cf));var _0xf2c5=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x2c5f[_0x25fa5c];return _0x1bade2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf2c5('0x0'));var zipdir=require(_0xf2c5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2c5('0x2'));var BPromise=require(_0xf2c5('0x3'));var Mustache=require(_0xf2c5('0x4'));var util=require(_0xf2c5('0x5'));var path=require(_0xf2c5('0x6'));var sox=require(_0xf2c5('0x7'));var csv=require(_0xf2c5('0x8'));var ejs=require(_0xf2c5('0x9'));var fs=require('fs');var _=require(_0xf2c5('0xa'));var squel=require(_0xf2c5('0xb'));var crypto=require(_0xf2c5('0xc'));var jsforce=require(_0xf2c5('0xd'));var deskjs=require(_0xf2c5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf2c5('0xf'));var Papa=require(_0xf2c5('0x10'));var Redis=require(_0xf2c5('0x11'));var authService=require(_0xf2c5('0x12'));var qs=require(_0xf2c5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2c5('0x14'))(_0xf2c5('0x15'));var utils=require(_0xf2c5('0x16'));var config=require(_0xf2c5('0x17'));var licenseUtil=require(_0xf2c5('0x18'));var db=require(_0xf2c5('0x19'))['db'];config[_0xf2c5('0x1a')]=_[_0xf2c5('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf2c5('0x1c'))(new Redis(config[_0xf2c5('0x1a')]));require(_0xf2c5('0x1d'))[_0xf2c5('0x1e')](socket);var jayson=require(_0xf2c5('0x1f'));var client=jayson[_0xf2c5('0x20')][_0xf2c5('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x124a2d,_0xfa1d19,_0x2669ae,_0x1e446e){return new BPromise(function(_0x1b1091,_0x462b41){var _0x4070cd=_0x1e446e||client;return _0x4070cd['request'](_0x124a2d,_0x2669ae)[_0xf2c5('0x22')](function(_0x2674fd){logger['info'](_0xf2c5('0x23'),_0xfa1d19,'request\x20sent');logger['debug'](_0xf2c5('0x24'),_0xfa1d19,_0xf2c5('0x25'),JSON['stringify'](_0x2674fd));if(_0x2674fd[_0xf2c5('0x26')]){if(_0x2674fd['error'][_0xf2c5('0x27')]===0x1f4){logger[_0xf2c5('0x26')](_0xf2c5('0x23'),_0xfa1d19,_0x2674fd[_0xf2c5('0x26')][_0xf2c5('0x28')]);return _0x462b41(_0x2674fd['error'][_0xf2c5('0x28')]);}logger[_0xf2c5('0x26')](_0xf2c5('0x23'),_0xfa1d19,_0x2674fd[_0xf2c5('0x26')][_0xf2c5('0x28')]);return _0x1b1091(_0x2674fd[_0xf2c5('0x26')][_0xf2c5('0x28')]);}else{logger[_0xf2c5('0x29')](_0xf2c5('0x23'),_0xfa1d19,'request\x20sent');_0x1b1091(_0x2674fd[_0xf2c5('0x2a')][_0xf2c5('0x28')]);}})[_0xf2c5('0x2b')](function(_0x1f942e){logger[_0xf2c5('0x26')](_0xf2c5('0x23'),_0xfa1d19,_0x1f942e);_0x462b41(_0x1f942e);});});}function respondWithStatusCode(_0x1e47e4,_0x232396){_0x232396=_0x232396||0xcc;return function(_0x4b9e8c){if(_0x4b9e8c){return _0x1e47e4[_0xf2c5('0x2c')](_0x232396);}return _0x1e47e4[_0xf2c5('0x2d')](_0x232396)[_0xf2c5('0x2e')]();};}function respondWithResult(_0x4aea31,_0x38ebdb){_0x38ebdb=_0x38ebdb||0xc8;return function(_0x4d9999){if(_0x4d9999){return _0x4aea31[_0xf2c5('0x2d')](_0x38ebdb)[_0xf2c5('0x2f')](_0x4d9999);}};}function respondWithFilteredResult(_0x1c32b9,_0x2cf040){return function(_0x218de2){if(_0x218de2){var _0x11daa7=_0x218de2['count'],_0x50b1ab=_0x2cf040[_0xf2c5('0x30')],_0xc75ecd=_0x2cf040[_0xf2c5('0x30')]+_0x2cf040[_0xf2c5('0x31')],_0x170db8;if(_0xc75ecd>=_0x11daa7){_0xc75ecd=_0x11daa7;_0x170db8=0xc8;}else{_0x170db8=0xce;}_0x1c32b9[_0xf2c5('0x2d')](_0x170db8);return _0x1c32b9[_0xf2c5('0x32')]('Content-Range',_0x50b1ab+'-'+_0xc75ecd+'/'+_0x11daa7)[_0xf2c5('0x2f')](_0x218de2);}return null;};}function patchUpdates(_0x4a89ac){return function(_0x313fc3){try{jsonpatch[_0xf2c5('0x33')](_0x313fc3,_0x4a89ac,!![]);}catch(_0x30a196){return BPromise['reject'](_0x30a196);}return _0x313fc3[_0xf2c5('0x34')]();};}function saveUpdates(_0x4b48d2,_0x40c453){return function(_0x3061f2){if(_0x3061f2){return _0x3061f2[_0xf2c5('0x35')](_0x4b48d2)[_0xf2c5('0x22')](function(_0x307fcd){return _0x307fcd;});}return null;};}function removeEntity(_0x1ed938,_0x28f5f8){return function(_0x491cac){if(_0x491cac){return _0x491cac['destroy']()[_0xf2c5('0x22')](function(){var _0x1eec5c=_0x491cac['get']({'plain':!![]});var _0x444c80=_0xf2c5('0x36');return db[_0xf2c5('0x37')][_0xf2c5('0x38')]({'where':{'type':_0x444c80,'resourceId':_0x1eec5c['id']}})[_0xf2c5('0x22')](function(){return _0x491cac;});})[_0xf2c5('0x22')](function(){_0x1ed938[_0xf2c5('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b683,_0x4678b9){return function(_0x39b146){if(!_0x39b146){_0x47b683[_0xf2c5('0x2c')](0x194);}return _0x39b146;};}function handleError(_0x534deb,_0x481ca1){_0x481ca1=_0x481ca1||0x1f4;return function(_0x924d12){logger[_0xf2c5('0x26')](_0x924d12['stack']);if(_0x924d12[_0xf2c5('0x39')]){delete _0x924d12[_0xf2c5('0x39')];}_0x534deb[_0xf2c5('0x2d')](_0x481ca1)[_0xf2c5('0x3a')](_0x924d12);};}exports[_0xf2c5('0x3b')]=function(_0x32e695,_0x437323){var _0x2df828={'include':[{'model':db[_0xf2c5('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5e2088={},_0x46d3a2={'count':0x0,'rows':[]};var _0x52350d=_[_0xf2c5('0x3d')](db[_0xf2c5('0x3e')]['rawAttributes'],function(_0x3178a7){return{'name':_0x3178a7[_0xf2c5('0x3f')],'type':_0x3178a7[_0xf2c5('0x40')][_0xf2c5('0x41')]};});_0x5e2088[_0xf2c5('0x42')]=_[_0xf2c5('0x3d')](_0x52350d,_0xf2c5('0x39'));_0x5e2088[_0xf2c5('0x43')]=_[_0xf2c5('0x44')](_0x32e695[_0xf2c5('0x43')]);_0x5e2088[_0xf2c5('0x45')]=_[_0xf2c5('0x46')](_0x5e2088[_0xf2c5('0x42')],_0x5e2088[_0xf2c5('0x43')]);_0x2df828[_0xf2c5('0x47')]=_[_0xf2c5('0x46')](_0x5e2088[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x32e695['query']['fields']));_0x2df828['attributes']=_0x2df828['attributes'][_0xf2c5('0x49')]?_0x2df828['attributes']:_0x5e2088[_0xf2c5('0x42')];if(!_0x32e695['query']['hasOwnProperty'](_0xf2c5('0x4a'))){_0x2df828[_0xf2c5('0x31')]=qs[_0xf2c5('0x31')](_0x32e695[_0xf2c5('0x43')][_0xf2c5('0x31')]);_0x2df828['offset']=qs[_0xf2c5('0x30')](_0x32e695[_0xf2c5('0x43')][_0xf2c5('0x30')]);}_0x2df828[_0xf2c5('0x4b')]=qs['sort'](_0x32e695[_0xf2c5('0x43')][_0xf2c5('0x4c')]);_0x2df828[_0xf2c5('0x4d')]=qs[_0xf2c5('0x45')](_['pick'](_0x32e695[_0xf2c5('0x43')],_0x5e2088[_0xf2c5('0x45')]),_0x52350d);if(_0x32e695['query'][_0xf2c5('0x4e')]){_0x2df828[_0xf2c5('0x4d')]=_[_0xf2c5('0x4f')](_0x2df828[_0xf2c5('0x4d')],{'$or':_[_0xf2c5('0x3d')](_0x52350d,function(_0x4a12ef){if(_0x4a12ef[_0xf2c5('0x40')]!==_0xf2c5('0x50')){var _0x162e1b={};_0x162e1b[_0x4a12ef['name']]={'$like':'%'+_0x32e695[_0xf2c5('0x43')][_0xf2c5('0x4e')]+'%'};return _0x162e1b;}})});}_0x2df828=_[_0xf2c5('0x4f')]({},_0x2df828,_0x32e695[_0xf2c5('0x51')]);var _0x2737fc={'where':_0x2df828[_0xf2c5('0x4d')]};return db['SmsAccount']['count'](_0x2737fc)['then'](function(_0x2e0e03){_0x46d3a2[_0xf2c5('0x52')]=_0x2e0e03;if(_0x32e695['query']['includeAll']){_0x2df828[_0xf2c5('0x53')]=[{'all':!![]}];}return db[_0xf2c5('0x3e')][_0xf2c5('0x54')](_0x2df828);})[_0xf2c5('0x22')](function(_0x4af9db){_0x46d3a2[_0xf2c5('0x55')]=_0x4af9db;return _0x46d3a2;})['then'](respondWithFilteredResult(_0x437323,_0x2df828))['catch'](handleError(_0x437323,null));};exports[_0xf2c5('0x56')]=function(_0x5234fe,_0x352455){var _0x171448={'raw':![],'where':{'id':_0x5234fe[_0xf2c5('0x57')]['id']},'include':[{'model':db[_0xf2c5('0x3c')],'as':_0xf2c5('0x58')}]},_0x19b7d1={};_0x19b7d1['model']=_['keys'](db['SmsAccount'][_0xf2c5('0x59')]);_0x19b7d1[_0xf2c5('0x43')]=_[_0xf2c5('0x44')](_0x5234fe[_0xf2c5('0x43')]);_0x19b7d1[_0xf2c5('0x5a')]=_['intersection'](_0x19b7d1[_0xf2c5('0x42')],_0x19b7d1[_0xf2c5('0x43')]);_0x171448[_0xf2c5('0x47')]=_[_0xf2c5('0x46')](_0x19b7d1[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x5234fe['query']['fields']));_0x171448['attributes']=_0x171448[_0xf2c5('0x47')][_0xf2c5('0x49')]?_0x171448['attributes']:_0x19b7d1['model'];if(_0x5234fe[_0xf2c5('0x43')][_0xf2c5('0x5b')]){_0x171448[_0xf2c5('0x53')]=[{'all':!![]}];}_0x171448=_[_0xf2c5('0x4f')]({},_0x171448,_0x5234fe[_0xf2c5('0x51')]);return db['SmsAccount'][_0xf2c5('0x5c')](_0x171448)['then'](handleEntityNotFound(_0x352455,null))[_0xf2c5('0x22')](respondWithResult(_0x352455,null))[_0xf2c5('0x2b')](handleError(_0x352455,null));};exports[_0xf2c5('0x5d')]=function(_0x1c4e32,_0x10b27c){return db[_0xf2c5('0x3e')]['create'](_0x1c4e32[_0xf2c5('0x5e')],{})[_0xf2c5('0x22')](function(_0xac0ad7){var _0x1c75fe=_0x1c4e32['user'][_0xf2c5('0x5f')]({'plain':!![]});if(!_0x1c75fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c75fe[_0xf2c5('0x60')]===_0xf2c5('0x61')){var _0x2de791=_0xac0ad7[_0xf2c5('0x5f')]({'plain':!![]});var _0x29de76=_0xf2c5('0x36');return db[_0xf2c5('0x62')]['find']({'where':{'name':_0x29de76,'userProfileId':_0x1c75fe['userProfileId']},'raw':!![]})[_0xf2c5('0x22')](function(_0x473c38){if(_0x473c38&&_0x473c38[_0xf2c5('0x63')]===0x0){return db[_0xf2c5('0x37')][_0xf2c5('0x5d')]({'name':_0x2de791[_0xf2c5('0x39')],'resourceId':_0x2de791['id'],'type':_0x473c38['name'],'sectionId':_0x473c38['id']},{})[_0xf2c5('0x22')](function(){return _0xac0ad7;});}else{return _0xac0ad7;}})[_0xf2c5('0x2b')](function(_0x3c5b75){logger[_0xf2c5('0x26')](_0xf2c5('0x64'),_0x3c5b75);throw _0x3c5b75;});}return _0xac0ad7;})[_0xf2c5('0x22')](respondWithResult(_0x10b27c,0xc9))['catch'](handleError(_0x10b27c,null));};exports[_0xf2c5('0x35')]=function(_0x4c2c97,_0x278e5d){if(_0x4c2c97['body']['id']){delete _0x4c2c97[_0xf2c5('0x5e')]['id'];}return db[_0xf2c5('0x3e')]['find']({'where':{'id':_0x4c2c97[_0xf2c5('0x57')]['id']},'include':[{'model':db[_0xf2c5('0x3c')],'as':_0xf2c5('0x58')}]})[_0xf2c5('0x22')](handleEntityNotFound(_0x278e5d,null))[_0xf2c5('0x22')](saveUpdates(_0x4c2c97['body'],null))['then'](respondWithResult(_0x278e5d,null))[_0xf2c5('0x2b')](handleError(_0x278e5d,null));};exports['destroy']=function(_0x491524,_0x595a43){return db['SmsAccount']['find']({'where':{'id':_0x491524[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x595a43,null))['then'](removeEntity(_0x595a43,null))['catch'](handleError(_0x595a43,null));};exports[_0xf2c5('0x65')]=function(_0x3961a3,_0x4ceaee){return db[_0xf2c5('0x3e')][_0xf2c5('0x65')]()[_0xf2c5('0x22')](respondWithResult(_0x4ceaee,null))['catch'](handleError(_0x4ceaee,null));};exports[_0xf2c5('0x66')]=function(_0x49388f,_0x2148f9,_0x3c02ec){if(_0x49388f[_0xf2c5('0x5e')]['id']){delete _0x49388f[_0xf2c5('0x5e')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x49388f['params']['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x2148f9,null))['then'](function(_0x4b5c0e){if(_0x4b5c0e){_0x49388f[_0xf2c5('0x5e')]['SmsAccountId']=_0x4b5c0e['id'];return db['Disposition']['create'](_0x49388f[_0xf2c5('0x5e')]);}})['then'](respondWithResult(_0x2148f9,null))['catch'](handleError(_0x2148f9,null));};exports[_0xf2c5('0x67')]=function(_0x21b959,_0x15dcce,_0x5c88d1){var _0x339e93={'raw':![],'where':{}};var _0x15e041={};var _0x5ac31f={'count':0x0,'rows':[]};return db[_0xf2c5('0x3e')][_0xf2c5('0x68')]({'where':{'id':_0x21b959[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x15dcce,null))[_0xf2c5('0x22')](function(_0x2d205f){if(_0x2d205f){_0x15e041['model']=_[_0xf2c5('0x44')](db[_0xf2c5('0x69')][_0xf2c5('0x59')]);_0x15e041[_0xf2c5('0x43')]=_['keys'](_0x21b959[_0xf2c5('0x43')]);_0x15e041[_0xf2c5('0x45')]=_[_0xf2c5('0x46')](_0x15e041[_0xf2c5('0x42')],_0x15e041['query']);_0x339e93['attributes']=_[_0xf2c5('0x46')](_0x15e041[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x21b959[_0xf2c5('0x43')][_0xf2c5('0x48')]));_0x339e93[_0xf2c5('0x47')]=_0x339e93[_0xf2c5('0x47')][_0xf2c5('0x49')]?_0x339e93[_0xf2c5('0x47')]:_0x15e041[_0xf2c5('0x42')];if(!_0x21b959['query']['hasOwnProperty'](_0xf2c5('0x4a'))){_0x339e93[_0xf2c5('0x31')]=qs[_0xf2c5('0x31')](_0x21b959[_0xf2c5('0x43')]['limit']);_0x339e93[_0xf2c5('0x30')]=qs[_0xf2c5('0x30')](_0x21b959[_0xf2c5('0x43')][_0xf2c5('0x30')]);}_0x339e93[_0xf2c5('0x4b')]=qs[_0xf2c5('0x4c')](_0x21b959['query'][_0xf2c5('0x4c')]);_0x339e93[_0xf2c5('0x4d')]=qs['filters'](_[_0xf2c5('0x6a')](_0x21b959[_0xf2c5('0x43')],_0x15e041[_0xf2c5('0x45')]));_0x339e93[_0xf2c5('0x4d')][_0xf2c5('0x6b')]=_0x2d205f['id'];if(_0x21b959[_0xf2c5('0x43')][_0xf2c5('0x4e')]){_0x339e93[_0xf2c5('0x4d')]=_[_0xf2c5('0x4f')](_0x339e93[_0xf2c5('0x4d')],{'$or':_[_0xf2c5('0x3d')](_0x339e93[_0xf2c5('0x47')],function(_0x463a55){var _0x55872b={};_0x55872b[_0x463a55]={'$like':'%'+_0x21b959[_0xf2c5('0x43')][_0xf2c5('0x4e')]+'%'};return _0x55872b;})});}_0x339e93=_[_0xf2c5('0x4f')]({},_0x339e93,_0x21b959['options']);return db[_0xf2c5('0x69')][_0xf2c5('0x52')]({'where':_0x339e93[_0xf2c5('0x4d')]})['then'](function(_0x106795){_0x5ac31f[_0xf2c5('0x52')]=_0x106795;if(_0x21b959[_0xf2c5('0x43')][_0xf2c5('0x5b')]){_0x339e93[_0xf2c5('0x53')]=[{'all':!![]}];}return db[_0xf2c5('0x69')][_0xf2c5('0x54')](_0x339e93);})[_0xf2c5('0x22')](function(_0x2a1c8c){_0x5ac31f[_0xf2c5('0x55')]=_0x2a1c8c;return _0x5ac31f;});}})['then'](respondWithFilteredResult(_0x15dcce,_0x339e93))[_0xf2c5('0x2b')](handleError(_0x15dcce,null));};exports['removeDispositions']=function(_0x3cb79b,_0x92850a,_0x37693c){return db[_0xf2c5('0x3e')][_0xf2c5('0x5c')]({'where':{'id':_0x3cb79b['params']['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x92850a,null))['then'](function(_0x233894){if(_0x233894){return _0x233894['removeDispositions'](_0x3cb79b[_0xf2c5('0x43')][_0xf2c5('0x6c')]);}})[_0xf2c5('0x22')](respondWithStatusCode(_0x92850a,null))[_0xf2c5('0x2b')](handleError(_0x92850a,null));};exports['addAnswer']=function(_0x1ebd6a,_0x4069cb,_0x2e802d){if(_0x1ebd6a[_0xf2c5('0x5e')]['id']){delete _0x1ebd6a['body']['id'];}return db[_0xf2c5('0x3e')][_0xf2c5('0x5c')]({'where':{'id':_0x1ebd6a[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x4069cb,null))[_0xf2c5('0x22')](function(_0x2008cf){if(_0x2008cf){_0x1ebd6a[_0xf2c5('0x5e')][_0xf2c5('0x6b')]=_0x2008cf['id'];return db['CannedAnswer'][_0xf2c5('0x5d')](_0x1ebd6a[_0xf2c5('0x5e')]);}})['then'](respondWithResult(_0x4069cb,null))[_0xf2c5('0x2b')](handleError(_0x4069cb,null));};exports['getAnswers']=function(_0x27f084,_0x5532aa,_0x4436ca){var _0x2ea6aa={'raw':![],'where':{}};var _0x197b6d={};var _0xdc1c84={'count':0x0,'rows':[]};return db[_0xf2c5('0x3e')][_0xf2c5('0x68')]({'where':{'id':_0x27f084[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x5532aa,null))[_0xf2c5('0x22')](function(_0x5def41){if(_0x5def41){_0x197b6d[_0xf2c5('0x42')]=_[_0xf2c5('0x44')](db[_0xf2c5('0x6d')][_0xf2c5('0x59')]);_0x197b6d['query']=_[_0xf2c5('0x44')](_0x27f084['query']);_0x197b6d[_0xf2c5('0x45')]=_[_0xf2c5('0x46')](_0x197b6d[_0xf2c5('0x42')],_0x197b6d['query']);_0x2ea6aa[_0xf2c5('0x47')]=_[_0xf2c5('0x46')](_0x197b6d[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x27f084[_0xf2c5('0x43')][_0xf2c5('0x48')]));_0x2ea6aa[_0xf2c5('0x47')]=_0x2ea6aa[_0xf2c5('0x47')]['length']?_0x2ea6aa[_0xf2c5('0x47')]:_0x197b6d[_0xf2c5('0x42')];if(!_0x27f084[_0xf2c5('0x43')]['hasOwnProperty'](_0xf2c5('0x4a'))){_0x2ea6aa[_0xf2c5('0x31')]=qs[_0xf2c5('0x31')](_0x27f084['query'][_0xf2c5('0x31')]);_0x2ea6aa['offset']=qs['offset'](_0x27f084[_0xf2c5('0x43')][_0xf2c5('0x30')]);}_0x2ea6aa[_0xf2c5('0x4b')]=qs[_0xf2c5('0x4c')](_0x27f084[_0xf2c5('0x43')][_0xf2c5('0x4c')]);_0x2ea6aa['where']=qs[_0xf2c5('0x45')](_[_0xf2c5('0x6a')](_0x27f084[_0xf2c5('0x43')],_0x197b6d[_0xf2c5('0x45')]));_0x2ea6aa['where']['SmsAccountId']=_0x5def41['id'];if(_0x27f084[_0xf2c5('0x43')]['filter']){_0x2ea6aa['where']=_['merge'](_0x2ea6aa[_0xf2c5('0x4d')],{'$or':_[_0xf2c5('0x3d')](_0x2ea6aa[_0xf2c5('0x47')],function(_0x566d75){var _0x22b56a={};_0x22b56a[_0x566d75]={'$like':'%'+_0x27f084[_0xf2c5('0x43')][_0xf2c5('0x4e')]+'%'};return _0x22b56a;})});}_0x2ea6aa=_[_0xf2c5('0x4f')]({},_0x2ea6aa,_0x27f084['options']);return db[_0xf2c5('0x6d')][_0xf2c5('0x52')]({'where':_0x2ea6aa[_0xf2c5('0x4d')]})[_0xf2c5('0x22')](function(_0x425fba){_0xdc1c84['count']=_0x425fba;if(_0x27f084[_0xf2c5('0x43')][_0xf2c5('0x5b')]){_0x2ea6aa[_0xf2c5('0x53')]=[{'all':!![]}];}return db[_0xf2c5('0x6d')][_0xf2c5('0x54')](_0x2ea6aa);})['then'](function(_0x409c94){_0xdc1c84[_0xf2c5('0x55')]=_0x409c94;return _0xdc1c84;});}})[_0xf2c5('0x22')](respondWithFilteredResult(_0x5532aa,_0x2ea6aa))[_0xf2c5('0x2b')](handleError(_0x5532aa,null));};exports[_0xf2c5('0x6e')]=function(_0x62bf0f,_0x32685d,_0x37c6ad){return db['SmsAccount'][_0xf2c5('0x5c')]({'where':{'id':_0x62bf0f['params']['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x32685d,null))[_0xf2c5('0x22')](function(_0x36a5c0){if(_0x36a5c0){return _0x36a5c0['removeAnswers'](_0x62bf0f['query'][_0xf2c5('0x6c')]);}})[_0xf2c5('0x22')](respondWithStatusCode(_0x32685d,null))['catch'](handleError(_0x32685d,null));};exports[_0xf2c5('0x6f')]=function(_0x469eb5,_0x46745b,_0x39b5b8){var _0x44d50e={'channel':_0xf2c5('0x70')};var _0xfc5fec=[];var _0x13e6f6=[];var _0x5182f3={};return db['SmsAccount'][_0xf2c5('0x5c')]({'where':{'id':_0x469eb5['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xf2c5('0x71')}]})[_0xf2c5('0x22')](handleEntityNotFound(_0x46745b,null))['then'](function(_0x46ed26){_0x44d50e[_0xf2c5('0x72')]=_0x46ed26;_0x44d50e['applications']=_[_0xf2c5('0x73')](_0x46ed26[_0xf2c5('0x71')],['priority'],[_0xf2c5('0x74')]);if(_0x44d50e[_0xf2c5('0x72')][_0xf2c5('0x71')]){delete _0x44d50e[_0xf2c5('0x72')][_0xf2c5('0x71')];}return db[_0xf2c5('0x75')][_0xf2c5('0x65')]();})['then'](function(_0x7a463b){if(!_0x7a463b){throw new db[(_0xf2c5('0x76'))]['ValidationError']('no\x20available\x20attributes');}_0xfc5fec=_[_0xf2c5('0x77')](_[_0xf2c5('0x44')](_0x7a463b),[_0xf2c5('0x78'),'updatedAt']);_0x13e6f6=_[_0xf2c5('0x77')](_[_0xf2c5('0x44')](_0x7a463b),[_0xf2c5('0x78'),_0xf2c5('0x79'),_0xf2c5('0x7a'),_0xf2c5('0x7b')]);_0x44d50e[_0xf2c5('0x5e')]={'mapKey':_0xf2c5('0x7c')};if(_0x44d50e[_0xf2c5('0x72')]['type']){switch(_0x44d50e[_0xf2c5('0x72')]['type']){case _0xf2c5('0x7d'):_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x7f')];_0x44d50e[_0xf2c5('0x5e')]['body']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x80')];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')]=_0x469eb5['body']['MessageSid'];break;case _0xf2c5('0x82'):_0x44d50e[_0xf2c5('0x5e')]['from']='+'+_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x83')];_0x44d50e['body'][_0xf2c5('0x5e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x84')];break;case _0xf2c5('0x85'):_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')]=_0x469eb5[_0xf2c5('0x5e')]['from'];_0x44d50e[_0xf2c5('0x5e')]['body']=_0x469eb5['body'][_0xf2c5('0x28')];break;case _0xf2c5('0x86'):_0x44d50e['body'][_0xf2c5('0x7e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x7e')];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x5e')]=_0x469eb5[_0xf2c5('0x5e')]['body'];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x87')];break;case _0xf2c5('0x88'):_0x44d50e[_0xf2c5('0x5e')]['from']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x7f')];_0x44d50e['body'][_0xf2c5('0x5e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x89')];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8a')];break;case _0xf2c5('0x8b'):_0x44d50e['body'][_0xf2c5('0x7e')]='+'+_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8c')][0x0]['from'];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x5e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8c')][0x0][_0xf2c5('0x84')];_0x44d50e[_0xf2c5('0x5e')]['messageId']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8c')][0x0]['messageId'];break;case _0xf2c5('0x8d'):_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8e')];_0x44d50e['body']['body']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x8f')]['message'];break;case _0xf2c5('0x90'):_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x91')];_0x44d50e['body'][_0xf2c5('0x5e')]=_0x469eb5['body'][_0xf2c5('0x84')];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')]=_0x469eb5['body'][_0xf2c5('0x92')];break;case _0xf2c5('0x93'):_0x44d50e['body']['from']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x7e')];_0x44d50e[_0xf2c5('0x5e')]['body']=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x28')];_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')]=_0x469eb5[_0xf2c5('0x5e')][_0xf2c5('0x94')];break;}}if(_0x44d50e[_0xf2c5('0x5e')]['id']){delete _0x44d50e[_0xf2c5('0x5e')]['id'];}if(_[_0xf2c5('0x95')](_0x44d50e['body']['from'])){throw new db['Sequelize'][(_0xf2c5('0x96'))](_0xf2c5('0x97'));}if(_['isNil'](_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x5e')])||_0x44d50e['body']['body']===''){throw new db['Sequelize'][(_0xf2c5('0x96'))](_0xf2c5('0x98'));}if(_[_0xf2c5('0x95')](_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x99')])){throw new db[(_0xf2c5('0x76'))][(_0xf2c5('0x96'))](_0xf2c5('0x9a')+_0x13e6f6);}if(!_['includes'](_0x13e6f6,_0x44d50e[_0xf2c5('0x5e')]['mapKey'])){throw new db[(_0xf2c5('0x76'))][(_0xf2c5('0x96'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x13e6f6);}_0x5182f3[_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x99')]]=_0x44d50e['body']['from'];return db['CmList'][_0xf2c5('0x5c')]({'where':{'id':_0x44d50e[_0xf2c5('0x72')]['ListId']},'include':[{'model':db[_0xf2c5('0x75')],'as':_0xf2c5('0x9b'),'where':_0x5182f3,'limit':0x1,'order':[[_0xf2c5('0x79'),_0xf2c5('0x9c')]]}]});})['then'](handleEntityNotFound(_0x46745b,null))[_0xf2c5('0x22')](function(_0x19fa08){if(_0x19fa08){_0x44d50e[_0xf2c5('0x9d')]=_['omit'](_0x19fa08,['Contacts']);if(_0x19fa08[_0xf2c5('0x9b')]['length']){return _0x19fa08['Contacts'][0x0];}var _0x5c671e=_[_0xf2c5('0x1b')](_0x44d50e[_0xf2c5('0x5e')],{'firstName':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')],'ListId':_0x19fa08['id']});_0x5c671e[_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x99')]]=_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')];return db[_0xf2c5('0x75')][_0xf2c5('0x5d')](_0x5c671e,{'fields':_0xfc5fec,'raw':!![]});}})['then'](handleEntityNotFound(_0x46745b,null))['then'](function(_0x596aa2){if(_0x596aa2){_0x44d50e['contact']=_0x596aa2;var _0x3c17ab={'ContactId':_0x596aa2['id'],'phone':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')],'SmsAccountId':_0x469eb5['params']['id']};var _0x492e27={'ContactId':_0x596aa2['id'],'SmsAccountId':_0x469eb5['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x492e27})['then'](function(_0x3a150f){if(_0x3a150f){return[_0x3a150f,![]];}return db[_0xf2c5('0x9e')][_0xf2c5('0x5d')](_0x3c17ab)[_0xf2c5('0x22')](function(_0x5e9386){return[_0x5e9386,!![]];});});}})[_0xf2c5('0x9f')](function(_0x150b65,_0x2a448f){_0x44d50e[_0xf2c5('0xa0')]=_0x150b65['get']({'plain':!![]});_0x44d50e[_0xf2c5('0xa0')][_0xf2c5('0xa1')]=![];if(_0x2a448f){if(_0x44d50e['account']['autoclose']){_0x44d50e[_0xf2c5('0xa2')][_0xf2c5('0xa3')]({'id':0x0,'priority':_0x44d50e[_0xf2c5('0xa2')][_0xf2c5('0x49')]+0x1,'app':_0xf2c5('0xa4'),'appdata':_0xf2c5('0xa5'),'interval':'*,*,*,*'});}_0x44d50e[_0xf2c5('0xa0')][_0xf2c5('0xa1')]=!![];}return db[_0xf2c5('0xa6')]['create']({'phone':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x7e')],'messageId':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x81')],'body':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0x5e')],'SmsAccountId':_0x469eb5['params']['id'],'SmsInteractionId':_0x150b65['id'],'direction':'in','ContactId':_0x150b65[_0xf2c5('0xa7')],'AttachmentId':_0x44d50e[_0xf2c5('0x5e')][_0xf2c5('0xa8')]});})[_0xf2c5('0x22')](function(_0x543cbb){_0x44d50e[_0xf2c5('0x28')]=_0x543cbb;if(_0x44d50e['interaction']['UserId']){return db[_0xf2c5('0xa9')][_0xf2c5('0x5c')]({'attributes':['id',_0xf2c5('0x39')],'where':{'id':_0x44d50e['interaction']['UserId']}})['then'](function(_0x45d404){if(_0x45d404){_0x44d50e[_0xf2c5('0xa2')][_0xf2c5('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x45d404['name']+','+(_0x44d50e[_0xf2c5('0x72')][_0xf2c5('0xab')]||0xa),'interval':_0xf2c5('0xac')});}return respondWithRpcPromise('Start',_0xf2c5('0xad'),_0x44d50e);});}return respondWithRpcPromise('Start','startRouting',_0x44d50e);})[_0xf2c5('0x22')](function(_0x127604){if(_0x127604){var _0x3f8161=0xc8;var _0x96dc48=_0xf2c5('0xae');logger[_0xf2c5('0x29')](_0xf2c5('0x24'),_0x96dc48,_0x3f8161,_0xf2c5('0xaf'));logger[_0xf2c5('0xb0')](_0xf2c5('0xb1'),_0x96dc48,_0x3f8161,'entity\x20found',JSON[_0xf2c5('0xb2')](_0x127604));if(_0x44d50e['account'][_0xf2c5('0x40')]===_0xf2c5('0x7d')){return _0x46745b['status'](_0x3f8161)[_0xf2c5('0x32')]('Content-Type','text/xml')['send'](_0xf2c5('0xb3'));}else{return _0x46745b[_0xf2c5('0x2d')](_0x3f8161)['json'](_0x127604);}}})[_0xf2c5('0x2b')](handleError(_0x46745b,null));};exports[_0xf2c5('0xb4')]=function(_0x1b9365,_0x3c9325,_0x5461ea){return db[_0xf2c5('0x3e')][_0xf2c5('0x68')]({'where':{'id':_0x1b9365[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x3c9325,null))[_0xf2c5('0x22')](function(_0x128cb8){if(_0x128cb8){return db['sequelize'][_0xf2c5('0xb5')](function(_0x24f71c){return db[_0xf2c5('0xb6')][_0xf2c5('0x38')]({'where':{'SmsAccountId':_0x1b9365[_0xf2c5('0x57')]['id']},'transaction':_0x24f71c})[_0xf2c5('0x22')](function(_0xb9e9e6){var _0x106ba4=_[_0xf2c5('0x3d')](_0x1b9365[_0xf2c5('0x5e')],function(_0xc43f8){_0xc43f8[_0xf2c5('0x6b')]=_0x1b9365['params']['id'];return _0xc43f8;});return db['SmsApplication'][_0xf2c5('0xb7')](_0x106ba4,{'transaction':_0x24f71c});});})[_0xf2c5('0x22')](function(){return db[_0xf2c5('0xb6')][_0xf2c5('0xb8')]({'where':{'SmsAccountId':_0x1b9365['params']['id']},'order':_0xf2c5('0xb9')});});}})[_0xf2c5('0x22')](respondWithResult(_0x3c9325,null))['catch'](handleError(_0x3c9325,null));};exports[_0xf2c5('0xba')]=function(_0x40e884,_0x48af78,_0x31190d){var _0x1414fd={};var _0x3be359={};var _0x48ae87;var _0x3d8422;return db[_0xf2c5('0x3e')][_0xf2c5('0x68')]({'where':{'id':_0x40e884['params']['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x48af78,null))[_0xf2c5('0x22')](function(_0x46980a){if(_0x46980a){_0x48ae87=_0x46980a;_0x3be359['model']=_[_0xf2c5('0x44')](db[_0xf2c5('0xb6')][_0xf2c5('0x59')]);_0x3be359['query']=_['keys'](_0x40e884['query']);_0x3be359[_0xf2c5('0x45')]=_[_0xf2c5('0x46')](_0x3be359[_0xf2c5('0x42')],_0x3be359[_0xf2c5('0x43')]);_0x1414fd[_0xf2c5('0x47')]=_[_0xf2c5('0x46')](_0x3be359[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x40e884[_0xf2c5('0x43')][_0xf2c5('0x48')]));_0x1414fd['attributes']=_0x1414fd[_0xf2c5('0x47')]['length']?_0x1414fd[_0xf2c5('0x47')]:_0x3be359[_0xf2c5('0x42')];_0x1414fd[_0xf2c5('0x4b')]=qs[_0xf2c5('0x4c')](_0x40e884[_0xf2c5('0x43')][_0xf2c5('0x4c')]);_0x1414fd[_0xf2c5('0x4d')]=qs['filters'](_[_0xf2c5('0x6a')](_0x40e884['query'],_0x3be359[_0xf2c5('0x45')]));if(_0x40e884['query'][_0xf2c5('0x4e')]){_0x1414fd[_0xf2c5('0x4d')]=_[_0xf2c5('0x4f')](_0x1414fd[_0xf2c5('0x4d')],{'$or':_[_0xf2c5('0x3d')](_0x1414fd[_0xf2c5('0x47')],function(_0x18e20a){var _0x5cecfd={};_0x5cecfd[_0x18e20a]={'$like':'%'+_0x40e884[_0xf2c5('0x43')][_0xf2c5('0x4e')]+'%'};return _0x5cecfd;})});}_0x1414fd=_[_0xf2c5('0x4f')]({},_0x1414fd,_0x40e884[_0xf2c5('0x51')]);return _0x48ae87[_0xf2c5('0xba')](_0x1414fd);}})[_0xf2c5('0x22')](function(_0xb2c68){if(_0xb2c68){_0x3d8422=_0xb2c68[_0xf2c5('0x49')];if(!_0x40e884[_0xf2c5('0x43')][_0xf2c5('0xbb')](_0xf2c5('0x4a'))){_0x1414fd[_0xf2c5('0x31')]=qs[_0xf2c5('0x31')](_0x40e884[_0xf2c5('0x43')][_0xf2c5('0x31')]);_0x1414fd[_0xf2c5('0x30')]=qs['offset'](_0x40e884[_0xf2c5('0x43')]['offset']);}return _0x48ae87[_0xf2c5('0xba')](_0x1414fd);}})[_0xf2c5('0x22')](function(_0x21bf0d){if(_0x21bf0d){return _0x21bf0d?{'count':_0x3d8422,'rows':_0x21bf0d}:null;}})[_0xf2c5('0x22')](respondWithResult(_0x48af78,null))[_0xf2c5('0x2b')](handleError(_0x48af78,null));};exports[_0xf2c5('0xbc')]=function(_0x39a1d4,_0x16d599,_0x424989){var _0x1f5abb={'raw':![],'where':{}};var _0x1cc7d8={};var _0x37a50f={'count':0x0,'rows':[]};return db[_0xf2c5('0x3e')][_0xf2c5('0x68')]({'where':{'id':_0x39a1d4['params']['id']}})['then'](handleEntityNotFound(_0x16d599,null))['then'](function(_0x1ad839){if(_0x1ad839){_0x1cc7d8[_0xf2c5('0x42')]=_[_0xf2c5('0x44')](db['SmsInteraction'][_0xf2c5('0x59')]);_0x1cc7d8[_0xf2c5('0x43')]=_[_0xf2c5('0x44')](_0x39a1d4[_0xf2c5('0x43')]);_0x1cc7d8[_0xf2c5('0x45')]=_['intersection'](_0x1cc7d8[_0xf2c5('0x42')],_0x1cc7d8[_0xf2c5('0x43')]);_0x1f5abb[_0xf2c5('0x47')]=_['intersection'](_0x1cc7d8[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0x48')]));_0x1f5abb[_0xf2c5('0x47')]=_0x1f5abb[_0xf2c5('0x47')][_0xf2c5('0x49')]?_0x1f5abb['attributes']:_0x1cc7d8['model'];if(!_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0xbb')](_0xf2c5('0x4a'))){_0x1f5abb[_0xf2c5('0x31')]=qs[_0xf2c5('0x31')](_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0x31')]);_0x1f5abb[_0xf2c5('0x30')]=qs[_0xf2c5('0x30')](_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0x30')]);}_0x1f5abb[_0xf2c5('0x4b')]=qs[_0xf2c5('0x4c')](_0x39a1d4['query'][_0xf2c5('0x4c')]);_0x1f5abb[_0xf2c5('0x4d')]=qs[_0xf2c5('0x45')](_[_0xf2c5('0x6a')](_0x39a1d4[_0xf2c5('0x43')],_0x1cc7d8[_0xf2c5('0x45')]));_0x1f5abb[_0xf2c5('0x4d')][_0xf2c5('0x6b')]=_0x1ad839['id'];if(_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0x4e')]){_0x1f5abb[_0xf2c5('0x4d')]=_[_0xf2c5('0x4f')](_0x1f5abb[_0xf2c5('0x4d')],{'$or':_[_0xf2c5('0x3d')](_0x1f5abb[_0xf2c5('0x47')],function(_0xe97f79){var _0x18a83c={};_0x18a83c[_0xe97f79]={'$like':'%'+_0x39a1d4[_0xf2c5('0x43')]['filter']+'%'};return _0x18a83c;})});}_0x1f5abb=_[_0xf2c5('0x4f')]({},_0x1f5abb,_0x39a1d4[_0xf2c5('0x51')]);return db['SmsInteraction']['count']({'where':_0x1f5abb[_0xf2c5('0x4d')]})['then'](function(_0x59f4fa){_0x37a50f[_0xf2c5('0x52')]=_0x59f4fa;if(_0x39a1d4['query']['includeAll']){_0x1f5abb[_0xf2c5('0x53')]=[{'model':db[_0xf2c5('0x75')],'as':'Contact','required':![]},{'model':db[_0xf2c5('0xa9')],'as':_0xf2c5('0xbd'),'attributes':[_0xf2c5('0x39'),_0xf2c5('0xbe'),'internal'],'required':![]},{'model':db[_0xf2c5('0xbf')],'as':_0xf2c5('0xc0'),'attributes':['id',_0xf2c5('0x39'),'color'],'where':_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0xc1')]?{'id':_0x39a1d4[_0xf2c5('0x43')]['tag']}:undefined,'required':_0x39a1d4[_0xf2c5('0x43')][_0xf2c5('0xc1')]?!![]:![]}];}return db[_0xf2c5('0x9e')][_0xf2c5('0x54')](_0x1f5abb);})[_0xf2c5('0x22')](function(_0xaf09d4){_0x37a50f[_0xf2c5('0x55')]=_0xaf09d4;return _0x37a50f;});}})[_0xf2c5('0x22')](respondWithFilteredResult(_0x16d599,_0x1f5abb))[_0xf2c5('0x2b')](handleError(_0x16d599,null));};exports[_0xf2c5('0x3a')]=function(_0x10665f,_0x4a067e,_0x410903){var _0x2e468e,_0x5aefa4,_0x2151df;if(_['isNil'](_0x10665f['body']['body'])||_0x10665f[_0xf2c5('0x5e')][_0xf2c5('0x5e')]===''){throw new db[(_0xf2c5('0x76'))][(_0xf2c5('0x96'))](_0xf2c5('0x98'));}if(_[_0xf2c5('0x95')](_0x10665f['body']['to'])){throw new db[(_0xf2c5('0x76'))]['ValidationError'](_0xf2c5('0xc2'));}_0x2e468e=_0x10665f[_0xf2c5('0x5e')]['to'];return db['SmsAccount'][_0xf2c5('0x5c')]({'where':{'id':_0x10665f[_0xf2c5('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xf2c5('0xc3'),'include':[{'model':db[_0xf2c5('0x75')],'as':_0xf2c5('0x9b'),'where':{'mobile':_0x2e468e},'limit':0x1,'order':[[_0xf2c5('0x79'),'DESC']]}]}]})[_0xf2c5('0x22')](handleEntityNotFound(_0x4a067e,null))[_0xf2c5('0x22')](function(_0x5c2938){if(_0x5c2938&&_0x5c2938['List']){_0x5aefa4=_0x5c2938[_0xf2c5('0x5f')]({'plain':!![]});if(_0x5aefa4[_0xf2c5('0xc3')]&&_0x5aefa4[_0xf2c5('0xc3')][_0xf2c5('0x9b')]['length']){return _0x5aefa4[_0xf2c5('0xc3')][_0xf2c5('0x9b')][0x0];}return db[_0xf2c5('0x75')][_0xf2c5('0x5d')](_[_0xf2c5('0x1b')](_0x10665f[_0xf2c5('0x5e')],{'firstName':_0x2e468e,'mobile':_0x2e468e,'phone':_0x2e468e,'ListId':_0x5aefa4[_0xf2c5('0x7b')]}));}})['then'](handleEntityNotFound(_0x4a067e,null))[_0xf2c5('0x22')](function(_0x228a5a){if(_0x228a5a){_0x2151df=_0x228a5a;return db[_0xf2c5('0x9e')][_0xf2c5('0x5c')]({'where':{'ContactId':_0x2151df['id'],'closed':![],'SmsAccountId':_0x5aefa4['id']}})[_0xf2c5('0x22')](function(_0x203ddc){if(_0x203ddc){return[_0x203ddc,![]];}return db['SmsInteraction'][_0xf2c5('0x5d')]({'UserId':_0x10665f[_0xf2c5('0x61')]['id'],'ContactId':_0x2151df['id'],'SmsAccountId':_0x5aefa4['id'],'phone':_0x2e468e,'firstMsgDirection':_0xf2c5('0xc4'),'Messages':[_[_0xf2c5('0x4f')](_0x10665f['body'],{'read':![],'body':_0x10665f[_0xf2c5('0x5e')][_0xf2c5('0x5e')],'phone':_0x2e468e,'SmsAccountId':_0x5aefa4['id'],'UserId':_0x10665f[_0xf2c5('0x61')]['id'],'ContactId':_0x2151df['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xf2c5('0xc5')}]})['then'](function(_0x4fa336){return[_0x4fa336,!![]];});});}})['spread'](function(_0x6c7856,_0x151d74){if(_0x151d74){return _0x6c7856;}return db[_0xf2c5('0xa6')][_0xf2c5('0x5d')](_[_0xf2c5('0x4f')](_0x10665f[_0xf2c5('0x5e')],{'read':![],'body':_0x10665f['body'][_0xf2c5('0x5e')],'phone':_0x2e468e,'SmsAccountId':_0x5aefa4['id'],'SmsInteractionId':_0x6c7856['id'],'UserId':_0x10665f[_0xf2c5('0x61')]['id'],'ContactId':_0x2151df['id']}))['then'](function(_0x22903f){_0x6c7856[_0xf2c5('0xc6')][_0xf2c5('0xc5')]=[];_0x6c7856['dataValues'][_0xf2c5('0xc5')][_0xf2c5('0xa3')](_0x22903f['dataValues']);return _0x6c7856;});})[_0xf2c5('0x22')](respondWithResult(_0x4a067e,null))['catch'](handleError(_0x4a067e,null));};exports[_0xf2c5('0x2d')]=function(_0x47cacc,_0x24d176,_0xb74347){if(_0x47cacc['body']['id']){delete _0x47cacc[_0xf2c5('0x5e')]['id'];}console['log'](_0xf2c5('0xc7'),_0x47cacc[_0xf2c5('0x5e')]);var _0xa9b016,_0x1726e3,_0x2efd3d;return db[_0xf2c5('0x3e')][_0xf2c5('0x5c')]({'where':{'id':_0x47cacc[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x24d176,null))['then'](function(_0x254a20){if(_0x254a20){_0x2efd3d=_0x254a20;logger[_0xf2c5('0xb0')](_0xf2c5('0x24'),_0xf2c5('0x2d'),_0xf2c5('0xc8'),_0x254a20['type'],util['inspect'](_0x47cacc['body'],{'showHidden':![],'depth':null}));switch(_0x254a20[_0xf2c5('0x40')]){case'skebby':if(_0x47cacc['body'][_0xf2c5('0xc9')]&&_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x2d')]){_0x1726e3=_0x47cacc[_0xf2c5('0x5e')]['status'];return db[_0xf2c5('0xa6')][_0xf2c5('0x5c')]({'where':{'messageId':_0x47cacc['body'][_0xf2c5('0xc9')]}});}break;case _0xf2c5('0x85'):if(_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xca')]&&_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xcb')]){_0x1726e3=_0x47cacc['body'][_0xf2c5('0xcb')];return db[_0xf2c5('0xa6')][_0xf2c5('0x5c')]({'where':{'messageId':_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xca')]}});}break;case _0xf2c5('0x86'):if(_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x87')]&&_0x47cacc[_0xf2c5('0x5e')]['status_code']){_0x1726e3=_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xcc')];return db[_0xf2c5('0xa6')]['find']({'where':{'messageId':_0x47cacc[_0xf2c5('0x5e')]['message_id']}});}break;case _0xf2c5('0x8b'):var _0x3dbe6b=_0x47cacc['body'][_0xf2c5('0x8c')][0x0];if(_0x3dbe6b[_0xf2c5('0x81')]&&_0x3dbe6b['status'][_0xf2c5('0xcd')]===_0xf2c5('0xce')){_0x1726e3=_0x3dbe6b[_0xf2c5('0x2d')][_0xf2c5('0xcd')];return db['SmsMessage']['find']({'where':{'messageId':_0x3dbe6b[_0xf2c5('0x81')]}});}break;case _0xf2c5('0x90'):if(_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x81')]&&_0x47cacc['body'][_0xf2c5('0x2d')]){_0x1726e3=_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x2d')];return db[_0xf2c5('0xa6')][_0xf2c5('0x5c')]({'where':{'messageId':_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x81')]}});}break;case _0xf2c5('0x93'):if(_0x47cacc['body']['redif']&&_0x47cacc[_0xf2c5('0x5e')]['status']){_0x1726e3=_0x47cacc['body']['status'];return db[_0xf2c5('0xa6')]['find']({'where':{'messageId':_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xcf')]}});}break;}}})[_0xf2c5('0x22')](handleEntityNotFound(_0x24d176,null))[_0xf2c5('0x22')](function(_0x5962c7){if(_0x5962c7){_0xa9b016=_0x5962c7;switch(_0x2efd3d[_0xf2c5('0x40')]){case _0xf2c5('0x82'):if(_0x1726e3===_0xf2c5('0xce')){return _0xa9b016[_0xf2c5('0x35')]({'read':!![]});}else{logger['error'](_0xf2c5('0x24'),'status',_0xf2c5('0x82'),util[_0xf2c5('0xd0')](_0x47cacc[_0xf2c5('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1726e3==='1'){return _0xa9b016['update']({'read':!![]});}else{logger[_0xf2c5('0x26')](_0xf2c5('0x24'),_0xf2c5('0x2d'),_0xf2c5('0x82'),util[_0xf2c5('0xd0')](_0x47cacc[_0xf2c5('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf2c5('0x86'):if(!_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0xd1')]&&_0x1726e3>=0xc8&&_0x1726e3<=0xce){return _0xa9b016[_0xf2c5('0x35')]({'read':!![]});}else{logger[_0xf2c5('0x26')](_0xf2c5('0x24'),'status',_0xf2c5('0x86'),util['inspect'](_0x47cacc['body'],{'showHidden':![],'depth':null}));}break;case _0xf2c5('0x8b'):var _0xd93216=_0x47cacc[_0xf2c5('0x5e')][_0xf2c5('0x8c')][0x0];if(_0xd93216[_0xf2c5('0x2d')]['groupName']===_0xf2c5('0xce')){return _0xa9b016['update']({'read':!![]});}else{logger[_0xf2c5('0x26')](_0xf2c5('0x24'),'status',_0xf2c5('0x8b'),util[_0xf2c5('0xd0')](_0x47cacc[_0xf2c5('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf2c5('0x90'):if(_0x1726e3==_0xf2c5('0xd2')||_0x1726e3==_0xf2c5('0xd3')){return _0xa9b016[_0xf2c5('0x35')]({'read':!![]});}else{logger[_0xf2c5('0x26')](_0xf2c5('0x24'),'status',_0xf2c5('0x90'),util[_0xf2c5('0xd0')](_0x47cacc[_0xf2c5('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1726e3===_0xf2c5('0xd4')||_0x1726e3==='ACCEPTD'){return _0xa9b016[_0xf2c5('0x35')]({'read':!![]});}else{logger[_0xf2c5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf2c5('0x2d'),_0xf2c5('0x93'),util[_0xf2c5('0xd0')](_0x47cacc[_0xf2c5('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0xa9b016;}})[_0xf2c5('0x22')](respondWithResult(_0x24d176,null))[_0xf2c5('0x2b')](handleError(_0x24d176,null));};exports[_0xf2c5('0xd5')]=function(_0x23d078,_0x10338b,_0x3c7b31){var _0x1c24af,_0x44420b,_0x49d174;return db[_0xf2c5('0x3e')]['find']({'where':{'id':_0x23d078['params']['id']}})['then'](handleEntityNotFound(_0x10338b,null))[_0xf2c5('0x22')](function(_0x4d8fca){if(_0x4d8fca){_0x49d174=_0x4d8fca;logger[_0xf2c5('0xb0')](_0xf2c5('0x24'),_0xf2c5('0x2d'),_0xf2c5('0xc8'),_0x4d8fca['type'],util[_0xf2c5('0xd0')](_0x23d078[_0xf2c5('0x43')],{'showHidden':![],'depth':null}));switch(_0x4d8fca['type']){case _0xf2c5('0x8d'):if(_0x23d078[_0xf2c5('0x43')][_0xf2c5('0xd6')]&&_0x23d078['query'][_0xf2c5('0xd7')]){_0x44420b=_0x23d078[_0xf2c5('0x43')][_0xf2c5('0xd7')];return db[_0xf2c5('0xa6')][_0xf2c5('0x5c')]({'where':{'messageId':_0x23d078['query']['message-id']}});}break;}}})[_0xf2c5('0x22')](handleEntityNotFound(_0x10338b,null))[_0xf2c5('0x22')](function(_0x485d14){if(_0x485d14){_0x1c24af=_0x485d14;switch(_0x49d174[_0xf2c5('0x40')]){case _0xf2c5('0x8d'):if(_0x44420b==='2'||_0x44420b==='6'){return _0x1c24af[_0xf2c5('0x35')]({'read':!![]});}else{logger['error'](_0xf2c5('0x24'),_0xf2c5('0x2d'),_0xf2c5('0x8d'),util[_0xf2c5('0xd0')](_0x23d078[_0xf2c5('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1c24af;}})['then'](respondWithResult(_0x10338b,null))['catch'](handleError(_0x10338b,null));};exports[_0xf2c5('0xd8')]=function(_0x2d25ef,_0x247dcd,_0xa2eb20){return db[_0xf2c5('0x3e')][_0xf2c5('0x5c')]({'where':{'id':_0x2d25ef[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x247dcd,null))[_0xf2c5('0x22')](function(_0x553cdc){if(_0x553cdc){return _0x553cdc['addAgents'](_0x2d25ef['body'][_0xf2c5('0x6c')],_[_0xf2c5('0xd9')](_0x2d25ef[_0xf2c5('0x5e')],[_0xf2c5('0x6c'),'id'])||{})['spread'](function(_0x5bd92d){for(var _0x51ffeb=0x0;_0x51ffeb<_0x2d25ef[_0xf2c5('0x5e')][_0xf2c5('0x6c')][_0xf2c5('0x49')];_0x51ffeb+=0x1){socket[_0xf2c5('0xda')](_0xf2c5('0xdb'),{'UserId':_0x2d25ef[_0xf2c5('0x5e')][_0xf2c5('0x6c')][_0x51ffeb],'SmsAccountId':_0x2d25ef[_0xf2c5('0x57')]['id']});}return _0x5bd92d;});}})[_0xf2c5('0x22')](respondWithResult(_0x247dcd,null))[_0xf2c5('0x2b')](handleError(_0x247dcd,null));};exports[_0xf2c5('0xdc')]=function(_0x1f58a9,_0x28fb0b,_0x436b66){return db[_0xf2c5('0x3e')]['find']({'where':{'id':_0x1f58a9[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x28fb0b,null))[_0xf2c5('0x22')](function(_0x4aa181){if(_0x4aa181){return _0x4aa181[_0xf2c5('0xdc')](_0x1f58a9[_0xf2c5('0x43')]['ids'])[_0xf2c5('0x22')](function(){if(_[_0xf2c5('0xdd')](_0x1f58a9[_0xf2c5('0x43')][_0xf2c5('0x6c')])){for(var _0x20be59=0x0;_0x20be59<_0x1f58a9[_0xf2c5('0x43')][_0xf2c5('0x6c')]['length'];_0x20be59+=0x1){socket[_0xf2c5('0xda')](_0xf2c5('0xde'),{'UserId':Number(_0x1f58a9[_0xf2c5('0x43')][_0xf2c5('0x6c')][_0x20be59]),'SmsAccountId':Number(_0x1f58a9['params']['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x1f58a9['query'][_0xf2c5('0x6c')]),'SmsAccountId':Number(_0x1f58a9['params']['id'])});}});}})[_0xf2c5('0x22')](respondWithStatusCode(_0x28fb0b,null))[_0xf2c5('0x2b')](handleError(_0x28fb0b,null));};exports[_0xf2c5('0xdf')]=function(_0x3b8cef,_0x146c70,_0x2f35d0){var _0x1a0be6={};var _0x54729d={};var _0x590d5a;var _0x3c2ebc;return db['SmsAccount'][_0xf2c5('0x68')]({'where':{'id':_0x3b8cef[_0xf2c5('0x57')]['id']}})[_0xf2c5('0x22')](handleEntityNotFound(_0x146c70,null))['then'](function(_0x2702f2){if(_0x2702f2){_0x590d5a=_0x2702f2;_0x54729d[_0xf2c5('0x42')]=_[_0xf2c5('0x44')](db[_0xf2c5('0xa9')][_0xf2c5('0x59')]);_0x54729d['query']=_[_0xf2c5('0x44')](_0x3b8cef[_0xf2c5('0x43')]);_0x54729d['filters']=_['intersection'](_0x54729d[_0xf2c5('0x42')],_0x54729d[_0xf2c5('0x43')]);_0x1a0be6['attributes']=_[_0xf2c5('0x46')](_0x54729d[_0xf2c5('0x42')],qs[_0xf2c5('0x48')](_0x3b8cef[_0xf2c5('0x43')]['fields']));_0x1a0be6[_0xf2c5('0x47')]=_0x1a0be6['attributes']['length']?_0x1a0be6[_0xf2c5('0x47')]:_0x54729d[_0xf2c5('0x42')];_0x1a0be6[_0xf2c5('0x4b')]=qs[_0xf2c5('0x4c')](_0x3b8cef[_0xf2c5('0x43')][_0xf2c5('0x4c')]);_0x1a0be6[_0xf2c5('0x4d')]=qs[_0xf2c5('0x45')](_[_0xf2c5('0x6a')](_0x3b8cef['query'],_0x54729d['filters']));if(_0x3b8cef['query'][_0xf2c5('0x4e')]){_0x1a0be6[_0xf2c5('0x4d')]=_[_0xf2c5('0x4f')](_0x1a0be6[_0xf2c5('0x4d')],{'$or':_['map'](_0x1a0be6[_0xf2c5('0x47')],function(_0x4c5617){var _0x50c5de={};_0x50c5de[_0x4c5617]={'$like':'%'+_0x3b8cef['query'][_0xf2c5('0x4e')]+'%'};return _0x50c5de;})});}_0x1a0be6=_[_0xf2c5('0x4f')]({},_0x1a0be6,_0x3b8cef['options']);return _0x590d5a['getAgents'](_0x1a0be6);}})[_0xf2c5('0x22')](function(_0x40ed5f){if(_0x40ed5f){_0x3c2ebc=_0x40ed5f[_0xf2c5('0x49')];if(!_0x3b8cef['query']['hasOwnProperty'](_0xf2c5('0x4a'))){_0x1a0be6['limit']=qs['limit'](_0x3b8cef['query'][_0xf2c5('0x31')]);_0x1a0be6['offset']=qs[_0xf2c5('0x30')](_0x3b8cef[_0xf2c5('0x43')][_0xf2c5('0x30')]);}return _0x590d5a[_0xf2c5('0xdf')](_0x1a0be6);}})['then'](function(_0xa337f6){if(_0xa337f6){return _0xa337f6?{'count':_0x3c2ebc,'rows':_0xa337f6}:null;}})[_0xf2c5('0x22')](respondWithResult(_0x146c70,null))[_0xf2c5('0x2b')](handleError(_0x146c70,null));}; \ No newline at end of file +var _0xc60e=['User','unshift','agent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','send','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','clickatell','redif','inspect','error_code','DELIVERED_TO_GATEWAY','ACCEPTD','received\x20delivery\x20report\x20from','state','message-id','addAgents','ids','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','destroy','then','SmsAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','filtears','find','create','body','get','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','omit','Contacts','SmsInteraction','spread','interaction','created','autoclose','push','*,*,*,*','ContactId','UserId'];(function(_0x1b9edb,_0x209873){var _0x4b488f=function(_0x5b220f){while(--_0x5b220f){_0x1b9edb['push'](_0x1b9edb['shift']());}};_0x4b488f(++_0x209873);}(_0xc60e,0x115));var _0xec60=function(_0xd2c461,_0x59f2d8){_0xd2c461=_0xd2c461-0x0;var _0x2fe0b4=_0xc60e[_0xd2c461];return _0x2fe0b4;};'use strict';var pdf=require(_0xec60('0x0'));var emlformat=require(_0xec60('0x1'));var rimraf=require(_0xec60('0x2'));var zipdir=require(_0xec60('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec60('0x4'));var moment=require(_0xec60('0x5'));var BPromise=require(_0xec60('0x6'));var Mustache=require(_0xec60('0x7'));var util=require(_0xec60('0x8'));var path=require('path');var sox=require(_0xec60('0x9'));var csv=require(_0xec60('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec60('0xb'));var squel=require(_0xec60('0xc'));var crypto=require(_0xec60('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xec60('0xe'));var toCsv=require(_0xec60('0xa'));var querystring=require(_0xec60('0xf'));var Papa=require(_0xec60('0x10'));var Redis=require('ioredis');var authService=require(_0xec60('0x11'));var qs=require(_0xec60('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xec60('0x13'))(_0xec60('0x14'));var utils=require(_0xec60('0x15'));var config=require(_0xec60('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xec60('0x17'))['db'];config[_0xec60('0x18')]=_[_0xec60('0x19')](config[_0xec60('0x18')],{'host':_0xec60('0x1a'),'port':0x18eb});var socket=require(_0xec60('0x1b'))(new Redis(config[_0xec60('0x18')]));require(_0xec60('0x1c'))[_0xec60('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xec60('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x262c3e,_0x29be3e,_0x4a6c98,_0x116d0d){return new BPromise(function(_0x184d57,_0x1cf2b3){var _0x4dc7f2=_0x116d0d||client;return _0x4dc7f2[_0xec60('0x1f')](_0x262c3e,_0x4a6c98)['then'](function(_0x21de24){logger[_0xec60('0x20')](_0xec60('0x21'),_0x29be3e,_0xec60('0x22'));logger[_0xec60('0x23')](_0xec60('0x24'),_0x29be3e,_0xec60('0x22'),JSON['stringify'](_0x21de24));if(_0x21de24[_0xec60('0x25')]){if(_0x21de24[_0xec60('0x25')]['code']===0x1f4){logger[_0xec60('0x25')]('SmsAccount,\x20%s,\x20%s',_0x29be3e,_0x21de24[_0xec60('0x25')][_0xec60('0x26')]);return _0x1cf2b3(_0x21de24[_0xec60('0x25')][_0xec60('0x26')]);}logger[_0xec60('0x25')](_0xec60('0x21'),_0x29be3e,_0x21de24[_0xec60('0x25')][_0xec60('0x26')]);return _0x184d57(_0x21de24[_0xec60('0x25')][_0xec60('0x26')]);}else{logger[_0xec60('0x20')](_0xec60('0x21'),_0x29be3e,_0xec60('0x22'));_0x184d57(_0x21de24[_0xec60('0x27')][_0xec60('0x26')]);}})[_0xec60('0x28')](function(_0x501cdd){logger[_0xec60('0x25')](_0xec60('0x21'),_0x29be3e,_0x501cdd);_0x1cf2b3(_0x501cdd);});});}function respondWithStatusCode(_0x3a5f59,_0x2978da){_0x2978da=_0x2978da||0xcc;return function(_0xb5c5be){if(_0xb5c5be){return _0x3a5f59[_0xec60('0x29')](_0x2978da);}return _0x3a5f59[_0xec60('0x2a')](_0x2978da)[_0xec60('0x2b')]();};}function respondWithResult(_0x5c0393,_0x237e01){_0x237e01=_0x237e01||0xc8;return function(_0x5317a5){if(_0x5317a5){return _0x5c0393[_0xec60('0x2a')](_0x237e01)[_0xec60('0x2c')](_0x5317a5);}};}function respondWithFilteredResult(_0x46961f,_0x364a9f){return function(_0x3d007e){if(_0x3d007e){var _0x1c47c6=_0x3d007e['count'],_0x33a017=_0x364a9f[_0xec60('0x2d')],_0x21b493=_0x364a9f[_0xec60('0x2d')]+_0x364a9f['limit'],_0x5c56bb;if(_0x21b493>=_0x1c47c6){_0x21b493=_0x1c47c6;_0x5c56bb=0xc8;}else{_0x5c56bb=0xce;}_0x46961f[_0xec60('0x2a')](_0x5c56bb);return _0x46961f[_0xec60('0x2e')](_0xec60('0x2f'),_0x33a017+'-'+_0x21b493+'/'+_0x1c47c6)[_0xec60('0x2c')](_0x3d007e);}return null;};}function patchUpdates(_0x531625){return function(_0x4cb80a){try{jsonpatch[_0xec60('0x30')](_0x4cb80a,_0x531625,!![]);}catch(_0x4f11e2){return BPromise['reject'](_0x4f11e2);}return _0x4cb80a[_0xec60('0x31')]();};}function saveUpdates(_0x35d312,_0x4a7718){return function(_0x1fa814){if(_0x1fa814){return _0x1fa814[_0xec60('0x32')](_0x35d312)['then'](function(_0x4273da){return _0x4273da;});}return null;};}function removeEntity(_0x36ae02,_0x214b50){return function(_0xa3cdd0){if(_0xa3cdd0){return _0xa3cdd0[_0xec60('0x33')]()[_0xec60('0x34')](function(){var _0x148d09=_0xa3cdd0['get']({'plain':!![]});var _0x2799a5=_0xec60('0x35');return db[_0xec60('0x36')][_0xec60('0x33')]({'where':{'type':_0x2799a5,'resourceId':_0x148d09['id']}})['then'](function(){return _0xa3cdd0;});})[_0xec60('0x34')](function(){_0x36ae02[_0xec60('0x2a')](0xcc)[_0xec60('0x2b')]();});}};}function handleEntityNotFound(_0x4372bc,_0x5d20be){return function(_0x49b2d1){if(!_0x49b2d1){_0x4372bc[_0xec60('0x29')](0x194);}return _0x49b2d1;};}function handleError(_0x54f494,_0x56c26c){_0x56c26c=_0x56c26c||0x1f4;return function(_0x3e4530){logger[_0xec60('0x25')](_0x3e4530[_0xec60('0x37')]);if(_0x3e4530[_0xec60('0x38')]){delete _0x3e4530[_0xec60('0x38')];}_0x54f494['status'](_0x56c26c)['send'](_0x3e4530);};}exports[_0xec60('0x39')]=function(_0x19c8ab,_0x159fd1){var _0x149aaa={'include':[{'model':db[_0xec60('0x3a')],'as':_0xec60('0x3b')}]},_0xdfa66a={},_0x267f51={'count':0x0,'rows':[]};var _0x27e728=_['map'](db[_0xec60('0x3c')][_0xec60('0x3d')],function(_0x387768){return{'name':_0x387768[_0xec60('0x3e')],'type':_0x387768[_0xec60('0x3f')][_0xec60('0x40')]};});_0xdfa66a[_0xec60('0x41')]=_[_0xec60('0x42')](_0x27e728,_0xec60('0x38'));_0xdfa66a[_0xec60('0x43')]=_[_0xec60('0x44')](_0x19c8ab[_0xec60('0x43')]);_0xdfa66a[_0xec60('0x45')]=_[_0xec60('0x46')](_0xdfa66a[_0xec60('0x41')],_0xdfa66a['query']);_0x149aaa[_0xec60('0x47')]=_[_0xec60('0x46')](_0xdfa66a[_0xec60('0x41')],qs[_0xec60('0x48')](_0x19c8ab['query'][_0xec60('0x48')]));_0x149aaa[_0xec60('0x47')]=_0x149aaa[_0xec60('0x47')][_0xec60('0x49')]?_0x149aaa['attributes']:_0xdfa66a[_0xec60('0x41')];if(!_0x19c8ab[_0xec60('0x43')][_0xec60('0x4a')](_0xec60('0x4b'))){_0x149aaa[_0xec60('0x4c')]=qs['limit'](_0x19c8ab['query'][_0xec60('0x4c')]);_0x149aaa[_0xec60('0x2d')]=qs[_0xec60('0x2d')](_0x19c8ab[_0xec60('0x43')][_0xec60('0x2d')]);}_0x149aaa[_0xec60('0x4d')]=qs[_0xec60('0x4e')](_0x19c8ab['query']['sort']);_0x149aaa['where']=qs[_0xec60('0x45')](_['pick'](_0x19c8ab[_0xec60('0x43')],_0xdfa66a[_0xec60('0x45')]),_0x27e728);if(_0x19c8ab[_0xec60('0x43')][_0xec60('0x4f')]){_0x149aaa[_0xec60('0x50')]=_[_0xec60('0x51')](_0x149aaa[_0xec60('0x50')],{'$or':_[_0xec60('0x42')](_0x27e728,function(_0x1b0ca5){if(_0x1b0ca5['type']!==_0xec60('0x52')){var _0x45f156={};_0x45f156[_0x1b0ca5[_0xec60('0x38')]]={'$like':'%'+_0x19c8ab[_0xec60('0x43')][_0xec60('0x4f')]+'%'};return _0x45f156;}})});}_0x149aaa=_['merge']({},_0x149aaa,_0x19c8ab[_0xec60('0x53')]);var _0x18fbfa={'where':_0x149aaa[_0xec60('0x50')]};return db['SmsAccount'][_0xec60('0x54')](_0x18fbfa)[_0xec60('0x34')](function(_0x126e73){_0x267f51[_0xec60('0x54')]=_0x126e73;if(_0x19c8ab['query'][_0xec60('0x55')]){_0x149aaa[_0xec60('0x56')]=[{'all':!![]}];}return db[_0xec60('0x3c')][_0xec60('0x57')](_0x149aaa);})[_0xec60('0x34')](function(_0x274355){_0x267f51[_0xec60('0x58')]=_0x274355;return _0x267f51;})[_0xec60('0x34')](respondWithFilteredResult(_0x159fd1,_0x149aaa))[_0xec60('0x28')](handleError(_0x159fd1,null));};exports[_0xec60('0x59')]=function(_0x1e9243,_0x3e5dc9){var _0x14e1ac={'raw':![],'where':{'id':_0x1e9243[_0xec60('0x5a')]['id']},'include':[{'model':db[_0xec60('0x3a')],'as':_0xec60('0x3b')}]},_0x4dd272={};_0x4dd272[_0xec60('0x41')]=_[_0xec60('0x44')](db['SmsAccount']['rawAttributes']);_0x4dd272[_0xec60('0x43')]=_[_0xec60('0x44')](_0x1e9243[_0xec60('0x43')]);_0x4dd272[_0xec60('0x5b')]=_[_0xec60('0x46')](_0x4dd272['model'],_0x4dd272[_0xec60('0x43')]);_0x14e1ac[_0xec60('0x47')]=_[_0xec60('0x46')](_0x4dd272[_0xec60('0x41')],qs[_0xec60('0x48')](_0x1e9243[_0xec60('0x43')][_0xec60('0x48')]));_0x14e1ac[_0xec60('0x47')]=_0x14e1ac[_0xec60('0x47')][_0xec60('0x49')]?_0x14e1ac[_0xec60('0x47')]:_0x4dd272[_0xec60('0x41')];if(_0x1e9243[_0xec60('0x43')][_0xec60('0x55')]){_0x14e1ac[_0xec60('0x56')]=[{'all':!![]}];}_0x14e1ac=_[_0xec60('0x51')]({},_0x14e1ac,_0x1e9243[_0xec60('0x53')]);return db[_0xec60('0x3c')][_0xec60('0x5c')](_0x14e1ac)[_0xec60('0x34')](handleEntityNotFound(_0x3e5dc9,null))[_0xec60('0x34')](respondWithResult(_0x3e5dc9,null))[_0xec60('0x28')](handleError(_0x3e5dc9,null));};exports[_0xec60('0x5d')]=function(_0x229b61,_0x1f93e6){return db[_0xec60('0x3c')][_0xec60('0x5d')](_0x229b61[_0xec60('0x5e')],{})['then'](function(_0x343b6d){var _0x18bf36=_0x229b61['user'][_0xec60('0x5f')]({'plain':!![]});if(!_0x18bf36)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18bf36['role']===_0xec60('0x60')){var _0x10e094=_0x343b6d[_0xec60('0x5f')]({'plain':!![]});var _0x57e7fe=_0xec60('0x35');return db[_0xec60('0x61')]['find']({'where':{'name':_0x57e7fe,'userProfileId':_0x18bf36['userProfileId']},'raw':!![]})[_0xec60('0x34')](function(_0x157603){if(_0x157603&&_0x157603['autoAssociation']===0x0){return db[_0xec60('0x36')][_0xec60('0x5d')]({'name':_0x10e094[_0xec60('0x38')],'resourceId':_0x10e094['id'],'type':_0x157603[_0xec60('0x38')],'sectionId':_0x157603['id']},{})[_0xec60('0x34')](function(){return _0x343b6d;});}else{return _0x343b6d;}})['catch'](function(_0x223b0e){logger[_0xec60('0x25')](_0xec60('0x62'),_0x223b0e);throw _0x223b0e;});}return _0x343b6d;})[_0xec60('0x34')](respondWithResult(_0x1f93e6,0xc9))[_0xec60('0x28')](handleError(_0x1f93e6,null));};exports[_0xec60('0x32')]=function(_0x682bbe,_0x41d9c7){if(_0x682bbe[_0xec60('0x5e')]['id']){delete _0x682bbe[_0xec60('0x5e')]['id'];}return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x682bbe[_0xec60('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xec60('0x34')](handleEntityNotFound(_0x41d9c7,null))[_0xec60('0x34')](saveUpdates(_0x682bbe['body'],null))[_0xec60('0x34')](respondWithResult(_0x41d9c7,null))[_0xec60('0x28')](handleError(_0x41d9c7,null));};exports['destroy']=function(_0x2c6d3e,_0x945e2c){return db['SmsAccount']['find']({'where':{'id':_0x2c6d3e[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x945e2c,null))[_0xec60('0x34')](removeEntity(_0x945e2c,null))[_0xec60('0x28')](handleError(_0x945e2c,null));};exports[_0xec60('0x63')]=function(_0x35c18e,_0x351a31){return db[_0xec60('0x3c')][_0xec60('0x63')]()['then'](respondWithResult(_0x351a31,null))[_0xec60('0x28')](handleError(_0x351a31,null));};exports[_0xec60('0x64')]=function(_0x1f2746,_0x408b26,_0x5c7443){if(_0x1f2746['body']['id']){delete _0x1f2746[_0xec60('0x5e')]['id'];}return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x1f2746[_0xec60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x408b26,null))[_0xec60('0x34')](function(_0x10d46d){if(_0x10d46d){_0x1f2746[_0xec60('0x5e')][_0xec60('0x65')]=_0x10d46d['id'];return db[_0xec60('0x66')][_0xec60('0x5d')](_0x1f2746[_0xec60('0x5e')]);}})[_0xec60('0x34')](respondWithResult(_0x408b26,null))[_0xec60('0x28')](handleError(_0x408b26,null));};exports[_0xec60('0x67')]=function(_0x401990,_0x56eb33,_0x2bcf10){var _0x2cf2a6={'raw':![],'where':{}};var _0x48c30c={};var _0x5a9a4b={'count':0x0,'rows':[]};return db[_0xec60('0x3c')][_0xec60('0x68')]({'where':{'id':_0x401990[_0xec60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x56eb33,null))[_0xec60('0x34')](function(_0xef5ff6){if(_0xef5ff6){_0x48c30c['model']=_[_0xec60('0x44')](db[_0xec60('0x66')][_0xec60('0x3d')]);_0x48c30c[_0xec60('0x43')]=_[_0xec60('0x44')](_0x401990['query']);_0x48c30c[_0xec60('0x45')]=_['intersection'](_0x48c30c['model'],_0x48c30c[_0xec60('0x43')]);_0x2cf2a6['attributes']=_[_0xec60('0x46')](_0x48c30c[_0xec60('0x41')],qs[_0xec60('0x48')](_0x401990[_0xec60('0x43')]['fields']));_0x2cf2a6[_0xec60('0x47')]=_0x2cf2a6[_0xec60('0x47')][_0xec60('0x49')]?_0x2cf2a6[_0xec60('0x47')]:_0x48c30c[_0xec60('0x41')];if(!_0x401990[_0xec60('0x43')]['hasOwnProperty']('nolimit')){_0x2cf2a6[_0xec60('0x4c')]=qs[_0xec60('0x4c')](_0x401990['query'][_0xec60('0x4c')]);_0x2cf2a6[_0xec60('0x2d')]=qs['offset'](_0x401990[_0xec60('0x43')][_0xec60('0x2d')]);}_0x2cf2a6['order']=qs[_0xec60('0x4e')](_0x401990[_0xec60('0x43')]['sort']);_0x2cf2a6[_0xec60('0x50')]=qs['filters'](_[_0xec60('0x69')](_0x401990['query'],_0x48c30c[_0xec60('0x45')]));_0x2cf2a6['where'][_0xec60('0x65')]=_0xef5ff6['id'];if(_0x401990[_0xec60('0x43')][_0xec60('0x4f')]){_0x2cf2a6['where']=_[_0xec60('0x51')](_0x2cf2a6['where'],{'$or':_[_0xec60('0x42')](_0x2cf2a6[_0xec60('0x47')],function(_0x35d03c){var _0x2f8a7c={};_0x2f8a7c[_0x35d03c]={'$like':'%'+_0x401990[_0xec60('0x43')][_0xec60('0x4f')]+'%'};return _0x2f8a7c;})});}_0x2cf2a6=_['merge']({},_0x2cf2a6,_0x401990['options']);return db[_0xec60('0x66')][_0xec60('0x54')]({'where':_0x2cf2a6[_0xec60('0x50')]})[_0xec60('0x34')](function(_0xd12778){_0x5a9a4b[_0xec60('0x54')]=_0xd12778;if(_0x401990[_0xec60('0x43')][_0xec60('0x55')]){_0x2cf2a6['include']=[{'all':!![]}];}return db[_0xec60('0x66')][_0xec60('0x57')](_0x2cf2a6);})['then'](function(_0x4f949d){_0x5a9a4b[_0xec60('0x58')]=_0x4f949d;return _0x5a9a4b;});}})[_0xec60('0x34')](respondWithFilteredResult(_0x56eb33,_0x2cf2a6))['catch'](handleError(_0x56eb33,null));};exports[_0xec60('0x6a')]=function(_0x2b41c1,_0x1dfe7a,_0x40e8db){return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x2b41c1[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x1dfe7a,null))[_0xec60('0x34')](function(_0x130bab){if(_0x130bab){return _0x130bab['removeDispositions'](_0x2b41c1[_0xec60('0x43')]['ids']);}})[_0xec60('0x34')](respondWithStatusCode(_0x1dfe7a,null))[_0xec60('0x28')](handleError(_0x1dfe7a,null));};exports[_0xec60('0x6b')]=function(_0x598eb1,_0x3cdb2e,_0x8f5229){if(_0x598eb1[_0xec60('0x5e')]['id']){delete _0x598eb1[_0xec60('0x5e')]['id'];}return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x598eb1[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x3cdb2e,null))[_0xec60('0x34')](function(_0x554171){if(_0x554171){_0x598eb1['body']['SmsAccountId']=_0x554171['id'];return db[_0xec60('0x6c')][_0xec60('0x5d')](_0x598eb1[_0xec60('0x5e')]);}})[_0xec60('0x34')](respondWithResult(_0x3cdb2e,null))[_0xec60('0x28')](handleError(_0x3cdb2e,null));};exports[_0xec60('0x6d')]=function(_0x575eb3,_0x132f75,_0xfb482e){var _0x1ca1bd={'raw':![],'where':{}};var _0x1a52e8={};var _0x1269d6={'count':0x0,'rows':[]};return db[_0xec60('0x3c')][_0xec60('0x68')]({'where':{'id':_0x575eb3[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x132f75,null))[_0xec60('0x34')](function(_0x3473d5){if(_0x3473d5){_0x1a52e8[_0xec60('0x41')]=_['keys'](db['CannedAnswer'][_0xec60('0x3d')]);_0x1a52e8[_0xec60('0x43')]=_['keys'](_0x575eb3[_0xec60('0x43')]);_0x1a52e8[_0xec60('0x45')]=_['intersection'](_0x1a52e8[_0xec60('0x41')],_0x1a52e8[_0xec60('0x43')]);_0x1ca1bd[_0xec60('0x47')]=_['intersection'](_0x1a52e8[_0xec60('0x41')],qs['fields'](_0x575eb3[_0xec60('0x43')][_0xec60('0x48')]));_0x1ca1bd[_0xec60('0x47')]=_0x1ca1bd[_0xec60('0x47')][_0xec60('0x49')]?_0x1ca1bd[_0xec60('0x47')]:_0x1a52e8[_0xec60('0x41')];if(!_0x575eb3[_0xec60('0x43')]['hasOwnProperty'](_0xec60('0x4b'))){_0x1ca1bd['limit']=qs[_0xec60('0x4c')](_0x575eb3[_0xec60('0x43')][_0xec60('0x4c')]);_0x1ca1bd[_0xec60('0x2d')]=qs[_0xec60('0x2d')](_0x575eb3[_0xec60('0x43')][_0xec60('0x2d')]);}_0x1ca1bd[_0xec60('0x4d')]=qs[_0xec60('0x4e')](_0x575eb3[_0xec60('0x43')][_0xec60('0x4e')]);_0x1ca1bd['where']=qs[_0xec60('0x45')](_['pick'](_0x575eb3[_0xec60('0x43')],_0x1a52e8[_0xec60('0x45')]));_0x1ca1bd[_0xec60('0x50')]['SmsAccountId']=_0x3473d5['id'];if(_0x575eb3[_0xec60('0x43')]['filter']){_0x1ca1bd[_0xec60('0x50')]=_['merge'](_0x1ca1bd[_0xec60('0x50')],{'$or':_[_0xec60('0x42')](_0x1ca1bd[_0xec60('0x47')],function(_0x11d762){var _0x3c39c5={};_0x3c39c5[_0x11d762]={'$like':'%'+_0x575eb3[_0xec60('0x43')][_0xec60('0x4f')]+'%'};return _0x3c39c5;})});}_0x1ca1bd=_[_0xec60('0x51')]({},_0x1ca1bd,_0x575eb3[_0xec60('0x53')]);return db[_0xec60('0x6c')][_0xec60('0x54')]({'where':_0x1ca1bd[_0xec60('0x50')]})[_0xec60('0x34')](function(_0x5752d5){_0x1269d6['count']=_0x5752d5;if(_0x575eb3[_0xec60('0x43')][_0xec60('0x55')]){_0x1ca1bd[_0xec60('0x56')]=[{'all':!![]}];}return db[_0xec60('0x6c')]['findAll'](_0x1ca1bd);})[_0xec60('0x34')](function(_0x444cd1){_0x1269d6['rows']=_0x444cd1;return _0x1269d6;});}})[_0xec60('0x34')](respondWithFilteredResult(_0x132f75,_0x1ca1bd))[_0xec60('0x28')](handleError(_0x132f75,null));};exports[_0xec60('0x6e')]=function(_0xf88680,_0x5e7465,_0x4a02d6){return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0xf88680[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x5e7465,null))[_0xec60('0x34')](function(_0x3398ca){if(_0x3398ca){return _0x3398ca[_0xec60('0x6e')](_0xf88680[_0xec60('0x43')]['ids']);}})[_0xec60('0x34')](respondWithStatusCode(_0x5e7465,null))[_0xec60('0x28')](handleError(_0x5e7465,null));};exports[_0xec60('0x6f')]=function(_0x302982,_0x554cb8,_0xc69261){var _0xc1bf90={'channel':_0xec60('0x70')};var _0x3c0db4=[];var _0x596898=[];var _0x1b19e8={};return db['SmsAccount'][_0xec60('0x5c')]({'where':{'id':_0x302982[_0xec60('0x5a')]['id']},'include':[{'model':db[_0xec60('0x71')],'as':_0xec60('0x72')}]})[_0xec60('0x34')](handleEntityNotFound(_0x554cb8,null))[_0xec60('0x34')](function(_0x9488fe){_0xc1bf90[_0xec60('0x73')]=_0x9488fe;_0xc1bf90[_0xec60('0x74')]=_['orderBy'](_0x9488fe['Applications'],[_0xec60('0x75')],['asc']);if(_0xc1bf90[_0xec60('0x73')][_0xec60('0x72')]){delete _0xc1bf90['account']['Applications'];}return db[_0xec60('0x76')][_0xec60('0x63')]();})[_0xec60('0x34')](function(_0x1bbaf9){if(!_0x1bbaf9){throw new db[(_0xec60('0x77'))][(_0xec60('0x78'))]('no\x20available\x20attributes');}_0x3c0db4=_[_0xec60('0x79')](_[_0xec60('0x44')](_0x1bbaf9),[_0xec60('0x7a'),_0xec60('0x7b')]);_0x596898=_[_0xec60('0x79')](_[_0xec60('0x44')](_0x1bbaf9),[_0xec60('0x7a'),'updatedAt','CompanyId',_0xec60('0x7c')]);_0xc1bf90[_0xec60('0x5e')]={'mapKey':_0xec60('0x7d')};if(_0xc1bf90[_0xec60('0x73')]['type']){switch(_0xc1bf90['account'][_0xec60('0x3f')]){case _0xec60('0x7e'):_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]=_0x302982[_0xec60('0x5e')]['From'];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')][_0xec60('0x80')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x81')]=_0x302982[_0xec60('0x5e')][_0xec60('0x82')];break;case _0xec60('0x83'):_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]='+'+_0x302982['body'][_0xec60('0x84')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')][_0xec60('0x85')];break;case _0xec60('0x86'):_0xc1bf90[_0xec60('0x5e')]['from']=_0x302982[_0xec60('0x5e')][_0xec60('0x7f')];_0xc1bf90['body'][_0xec60('0x5e')]=_0x302982['body'][_0xec60('0x26')];break;case _0xec60('0x87'):_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]=_0x302982[_0xec60('0x5e')][_0xec60('0x7f')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')][_0xec60('0x5e')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x81')]=_0x302982[_0xec60('0x5e')][_0xec60('0x88')];break;case _0xec60('0x89'):_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]=_0x302982['body'][_0xec60('0x8a')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982['body'][_0xec60('0x8b')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x81')]=_0x302982[_0xec60('0x5e')][_0xec60('0x8c')];break;case _0xec60('0x8d'):_0xc1bf90['body'][_0xec60('0x7f')]='+'+_0x302982[_0xec60('0x5e')]['results'][0x0][_0xec60('0x7f')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')]['results'][0x0][_0xec60('0x85')];_0xc1bf90['body']['messageId']=_0x302982[_0xec60('0x5e')][_0xec60('0x8e')][0x0][_0xec60('0x81')];break;case _0xec60('0x8f'):_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]=_0x302982[_0xec60('0x5e')][_0xec60('0x90')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')][_0xec60('0x91')][_0xec60('0x26')];break;case'clickatell':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')]=_0x302982[_0xec60('0x5e')][_0xec60('0x92')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982['body'][_0xec60('0x85')];_0xc1bf90[_0xec60('0x5e')]['messageId']=_0x302982[_0xec60('0x5e')][_0xec60('0x93')];break;case _0xec60('0x94'):_0xc1bf90['body'][_0xec60('0x7f')]=_0x302982[_0xec60('0x5e')]['from'];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]=_0x302982[_0xec60('0x5e')][_0xec60('0x26')];_0xc1bf90[_0xec60('0x5e')][_0xec60('0x81')]=_0x302982[_0xec60('0x5e')][_0xec60('0x95')];break;}}if(_0xc1bf90[_0xec60('0x5e')]['id']){delete _0xc1bf90[_0xec60('0x5e')]['id'];}if(_['isNil'](_0xc1bf90[_0xec60('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xec60('0x96'));}if(_[_0xec60('0x97')](_0xc1bf90['body'][_0xec60('0x5e')])||_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')]===''){throw new db[(_0xec60('0x77'))]['ValidationError'](_0xec60('0x98'));}if(_[_0xec60('0x97')](_0xc1bf90['body'][_0xec60('0x99')])){throw new db[(_0xec60('0x77'))][(_0xec60('0x78'))](_0xec60('0x9a')+_0x596898);}if(!_['includes'](_0x596898,_0xc1bf90['body'][_0xec60('0x99')])){throw new db[(_0xec60('0x77'))][(_0xec60('0x78'))](_0xec60('0x9b')+_0x596898);}_0x1b19e8[_0xc1bf90[_0xec60('0x5e')]['mapKey']]=_0xc1bf90[_0xec60('0x5e')]['from'];return db[_0xec60('0x9c')]['find']({'where':{'id':_0xc1bf90[_0xec60('0x73')][_0xec60('0x7c')]},'include':[{'model':db[_0xec60('0x76')],'as':'Contacts','where':_0x1b19e8,'limit':0x1,'order':[['updatedAt',_0xec60('0x9d')]]}]});})[_0xec60('0x34')](handleEntityNotFound(_0x554cb8,null))[_0xec60('0x34')](function(_0x364ae3){if(_0x364ae3){_0xc1bf90['list']=_[_0xec60('0x9e')](_0x364ae3,[_0xec60('0x9f')]);if(_0x364ae3[_0xec60('0x9f')][_0xec60('0x49')]){return _0x364ae3[_0xec60('0x9f')][0x0];}var _0x204af6=_[_0xec60('0x19')](_0xc1bf90[_0xec60('0x5e')],{'firstName':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')],'ListId':_0x364ae3['id']});_0x204af6[_0xc1bf90[_0xec60('0x5e')]['mapKey']]=_0xc1bf90['body']['from'];return db[_0xec60('0x76')][_0xec60('0x5d')](_0x204af6,{'fields':_0x3c0db4,'raw':!![]});}})[_0xec60('0x34')](handleEntityNotFound(_0x554cb8,null))[_0xec60('0x34')](function(_0x4cd70d){if(_0x4cd70d){_0xc1bf90['contact']=_0x4cd70d;var _0x569ee9={'ContactId':_0x4cd70d['id'],'phone':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')],'SmsAccountId':_0x302982['params']['id']};var _0x4c2ef1={'ContactId':_0x4cd70d['id'],'SmsAccountId':_0x302982['params']['id'],'closed':![]};return db['SmsInteraction'][_0xec60('0x5c')]({'where':_0x4c2ef1})['then'](function(_0x2df3ff){if(_0x2df3ff){return[_0x2df3ff,![]];}return db[_0xec60('0xa0')]['create'](_0x569ee9)[_0xec60('0x34')](function(_0x3d9098){return[_0x3d9098,!![]];});});}})[_0xec60('0xa1')](function(_0x3d4a96,_0x5ec801){_0xc1bf90[_0xec60('0xa2')]=_0x3d4a96[_0xec60('0x5f')]({'plain':!![]});_0xc1bf90[_0xec60('0xa2')][_0xec60('0xa3')]=![];if(_0x5ec801){if(_0xc1bf90['account'][_0xec60('0xa4')]){_0xc1bf90[_0xec60('0x74')][_0xec60('0xa5')]({'id':0x0,'priority':_0xc1bf90[_0xec60('0x74')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0xec60('0xa6')});}_0xc1bf90[_0xec60('0xa2')][_0xec60('0xa3')]=!![];}return db['SmsMessage'][_0xec60('0x5d')]({'phone':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x7f')],'messageId':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x81')],'body':_0xc1bf90[_0xec60('0x5e')][_0xec60('0x5e')],'SmsAccountId':_0x302982[_0xec60('0x5a')]['id'],'SmsInteractionId':_0x3d4a96['id'],'direction':'in','ContactId':_0x3d4a96[_0xec60('0xa7')],'AttachmentId':_0xc1bf90[_0xec60('0x5e')]['AttachmentId']});})[_0xec60('0x34')](function(_0x2b20aa){_0xc1bf90['message']=_0x2b20aa;if(_0xc1bf90[_0xec60('0xa2')][_0xec60('0xa8')]){return db[_0xec60('0xa9')]['find']({'attributes':['id',_0xec60('0x38')],'where':{'id':_0xc1bf90[_0xec60('0xa2')][_0xec60('0xa8')]}})[_0xec60('0x34')](function(_0x15192f){if(_0x15192f){_0xc1bf90[_0xec60('0x74')][_0xec60('0xaa')]({'id':0x0,'priority':0x0,'app':_0xec60('0xab'),'appdata':_0x15192f['name']+','+(_0xc1bf90[_0xec60('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0xec60('0xa6')});}return respondWithRpcPromise(_0xec60('0xac'),_0xec60('0xad'),_0xc1bf90);});}return respondWithRpcPromise(_0xec60('0xac'),'startRouting',_0xc1bf90);})['then'](function(_0x49e758){if(_0x49e758){var _0x480fb1=0xc8;var _0x385ef6='receiveMessage';logger['info'](_0xec60('0x24'),_0x385ef6,_0x480fb1,_0xec60('0xae'));logger[_0xec60('0x23')](_0xec60('0xaf'),_0x385ef6,_0x480fb1,_0xec60('0xae'),JSON[_0xec60('0xb0')](_0x49e758));if(_0xc1bf90[_0xec60('0x73')][_0xec60('0x3f')]===_0xec60('0x7e')){return _0x554cb8[_0xec60('0x2a')](_0x480fb1)[_0xec60('0x2e')](_0xec60('0xb1'),_0xec60('0xb2'))['send'](_0xec60('0xb3'));}else{return _0x554cb8[_0xec60('0x2a')](_0x480fb1)[_0xec60('0x2c')](_0x49e758);}}})['catch'](handleError(_0x554cb8,null));};exports[_0xec60('0xb4')]=function(_0x134e73,_0x2c43de,_0x5d7e6a){return db[_0xec60('0x3c')]['findOne']({'where':{'id':_0x134e73['params']['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x2c43de,null))[_0xec60('0x34')](function(_0xf15ae3){if(_0xf15ae3){return db[_0xec60('0xb5')]['transaction'](function(_0x1d0617){return db[_0xec60('0x71')][_0xec60('0x33')]({'where':{'SmsAccountId':_0x134e73['params']['id']},'transaction':_0x1d0617})['then'](function(_0x44e4bf){var _0x1a45bb=_[_0xec60('0x42')](_0x134e73[_0xec60('0x5e')],function(_0x4b0b81){_0x4b0b81[_0xec60('0x65')]=_0x134e73[_0xec60('0x5a')]['id'];return _0x4b0b81;});return db[_0xec60('0x71')][_0xec60('0xb6')](_0x1a45bb,{'transaction':_0x1d0617});});})[_0xec60('0x34')](function(){return db[_0xec60('0x71')][_0xec60('0xb7')]({'where':{'SmsAccountId':_0x134e73[_0xec60('0x5a')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2c43de,null))[_0xec60('0x28')](handleError(_0x2c43de,null));};exports[_0xec60('0xb8')]=function(_0x5b5ab9,_0x505943,_0x3e11c0){var _0x2dcb03={};var _0x416fde={};var _0x3eb5c5;var _0x3df644;return db[_0xec60('0x3c')]['findOne']({'where':{'id':_0x5b5ab9['params']['id']}})['then'](handleEntityNotFound(_0x505943,null))[_0xec60('0x34')](function(_0x439094){if(_0x439094){_0x3eb5c5=_0x439094;_0x416fde[_0xec60('0x41')]=_[_0xec60('0x44')](db[_0xec60('0x71')][_0xec60('0x3d')]);_0x416fde['query']=_[_0xec60('0x44')](_0x5b5ab9['query']);_0x416fde[_0xec60('0x45')]=_[_0xec60('0x46')](_0x416fde[_0xec60('0x41')],_0x416fde[_0xec60('0x43')]);_0x2dcb03['attributes']=_['intersection'](_0x416fde[_0xec60('0x41')],qs[_0xec60('0x48')](_0x5b5ab9[_0xec60('0x43')]['fields']));_0x2dcb03['attributes']=_0x2dcb03[_0xec60('0x47')][_0xec60('0x49')]?_0x2dcb03[_0xec60('0x47')]:_0x416fde[_0xec60('0x41')];_0x2dcb03[_0xec60('0x4d')]=qs[_0xec60('0x4e')](_0x5b5ab9[_0xec60('0x43')][_0xec60('0x4e')]);_0x2dcb03[_0xec60('0x50')]=qs[_0xec60('0x45')](_[_0xec60('0x69')](_0x5b5ab9[_0xec60('0x43')],_0x416fde[_0xec60('0x45')]));if(_0x5b5ab9[_0xec60('0x43')][_0xec60('0x4f')]){_0x2dcb03[_0xec60('0x50')]=_[_0xec60('0x51')](_0x2dcb03[_0xec60('0x50')],{'$or':_['map'](_0x2dcb03[_0xec60('0x47')],function(_0x12e9ad){var _0x3b58be={};_0x3b58be[_0x12e9ad]={'$like':'%'+_0x5b5ab9[_0xec60('0x43')]['filter']+'%'};return _0x3b58be;})});}_0x2dcb03=_[_0xec60('0x51')]({},_0x2dcb03,_0x5b5ab9['options']);return _0x3eb5c5[_0xec60('0xb8')](_0x2dcb03);}})[_0xec60('0x34')](function(_0x41935b){if(_0x41935b){_0x3df644=_0x41935b[_0xec60('0x49')];if(!_0x5b5ab9['query']['hasOwnProperty'](_0xec60('0x4b'))){_0x2dcb03[_0xec60('0x4c')]=qs['limit'](_0x5b5ab9[_0xec60('0x43')][_0xec60('0x4c')]);_0x2dcb03[_0xec60('0x2d')]=qs[_0xec60('0x2d')](_0x5b5ab9[_0xec60('0x43')][_0xec60('0x2d')]);}return _0x3eb5c5[_0xec60('0xb8')](_0x2dcb03);}})[_0xec60('0x34')](function(_0xd4f139){if(_0xd4f139){return _0xd4f139?{'count':_0x3df644,'rows':_0xd4f139}:null;}})[_0xec60('0x34')](respondWithResult(_0x505943,null))['catch'](handleError(_0x505943,null));};exports[_0xec60('0xb9')]=function(_0x7afb97,_0x59f4c9,_0x4f221c){var _0x3116cf={'raw':![],'where':{}};var _0x2a425a={};var _0x92db46={'count':0x0,'rows':[]};return db[_0xec60('0x3c')][_0xec60('0x68')]({'where':{'id':_0x7afb97['params']['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x59f4c9,null))['then'](function(_0x50f0dd){if(_0x50f0dd){_0x2a425a[_0xec60('0x41')]=_[_0xec60('0x44')](db[_0xec60('0xa0')]['rawAttributes']);_0x2a425a['query']=_[_0xec60('0x44')](_0x7afb97[_0xec60('0x43')]);_0x2a425a[_0xec60('0x45')]=_[_0xec60('0x46')](_0x2a425a[_0xec60('0x41')],_0x2a425a[_0xec60('0x43')]);_0x3116cf[_0xec60('0x47')]=_[_0xec60('0x46')](_0x2a425a[_0xec60('0x41')],qs['fields'](_0x7afb97[_0xec60('0x43')][_0xec60('0x48')]));_0x3116cf[_0xec60('0x47')]=_0x3116cf[_0xec60('0x47')][_0xec60('0x49')]?_0x3116cf['attributes']:_0x2a425a['model'];if(!_0x7afb97[_0xec60('0x43')][_0xec60('0x4a')](_0xec60('0x4b'))){_0x3116cf['limit']=qs[_0xec60('0x4c')](_0x7afb97[_0xec60('0x43')]['limit']);_0x3116cf[_0xec60('0x2d')]=qs[_0xec60('0x2d')](_0x7afb97[_0xec60('0x43')][_0xec60('0x2d')]);}_0x3116cf[_0xec60('0x4d')]=qs[_0xec60('0x4e')](_0x7afb97[_0xec60('0x43')][_0xec60('0x4e')]);_0x3116cf['where']=qs['filters'](_[_0xec60('0x69')](_0x7afb97[_0xec60('0x43')],_0x2a425a[_0xec60('0x45')]));_0x3116cf[_0xec60('0x50')][_0xec60('0x65')]=_0x50f0dd['id'];if(_0x7afb97['query'][_0xec60('0x4f')]){_0x3116cf['where']=_[_0xec60('0x51')](_0x3116cf[_0xec60('0x50')],{'$or':_[_0xec60('0x42')](_0x3116cf[_0xec60('0x47')],function(_0x35868b){var _0x154f69={};_0x154f69[_0x35868b]={'$like':'%'+_0x7afb97[_0xec60('0x43')]['filter']+'%'};return _0x154f69;})});}_0x3116cf=_[_0xec60('0x51')]({},_0x3116cf,_0x7afb97[_0xec60('0x53')]);return db[_0xec60('0xa0')][_0xec60('0x54')]({'where':_0x3116cf['where']})[_0xec60('0x34')](function(_0x534c21){_0x92db46[_0xec60('0x54')]=_0x534c21;if(_0x7afb97[_0xec60('0x43')]['includeAll']){_0x3116cf[_0xec60('0x56')]=[{'model':db[_0xec60('0x76')],'as':_0xec60('0xba'),'required':![]},{'model':db['User'],'as':_0xec60('0xbb'),'attributes':[_0xec60('0x38'),_0xec60('0xbc'),'internal'],'required':![]},{'model':db[_0xec60('0xbd')],'as':_0xec60('0xbe'),'attributes':['id',_0xec60('0x38'),_0xec60('0xbf')],'where':_0x7afb97['query'][_0xec60('0xc0')]?{'id':_0x7afb97[_0xec60('0x43')][_0xec60('0xc0')]}:undefined,'required':_0x7afb97[_0xec60('0x43')]['tag']?!![]:![]}];}return db[_0xec60('0xa0')][_0xec60('0x57')](_0x3116cf);})['then'](function(_0x4b921a){_0x92db46[_0xec60('0x58')]=_0x4b921a;return _0x92db46;});}})[_0xec60('0x34')](respondWithFilteredResult(_0x59f4c9,_0x3116cf))['catch'](handleError(_0x59f4c9,null));};exports[_0xec60('0xc1')]=function(_0x35e448,_0x4e07a5,_0x510ed2){var _0x222818,_0x259e0d,_0x3aa693;if(_[_0xec60('0x97')](_0x35e448[_0xec60('0x5e')][_0xec60('0x5e')])||_0x35e448['body'][_0xec60('0x5e')]===''){throw new db[(_0xec60('0x77'))][(_0xec60('0x78'))](_0xec60('0x98'));}if(_[_0xec60('0x97')](_0x35e448[_0xec60('0x5e')]['to'])){throw new db[(_0xec60('0x77'))]['ValidationError'](_0xec60('0xc2'));}_0x222818=_0x35e448[_0xec60('0x5e')]['to'];return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x35e448[_0xec60('0x5a')]['id']},'include':[{'model':db[_0xec60('0x9c')],'as':_0xec60('0xc3'),'include':[{'model':db[_0xec60('0x76')],'as':_0xec60('0x9f'),'where':{'mobile':_0x222818},'limit':0x1,'order':[[_0xec60('0x7b'),'DESC']]}]}]})[_0xec60('0x34')](handleEntityNotFound(_0x4e07a5,null))['then'](function(_0x1f3570){if(_0x1f3570&&_0x1f3570[_0xec60('0xc3')]){_0x259e0d=_0x1f3570[_0xec60('0x5f')]({'plain':!![]});if(_0x259e0d[_0xec60('0xc3')]&&_0x259e0d['List'][_0xec60('0x9f')][_0xec60('0x49')]){return _0x259e0d[_0xec60('0xc3')][_0xec60('0x9f')][0x0];}return db['CmContact']['create'](_['defaults'](_0x35e448[_0xec60('0x5e')],{'firstName':_0x222818,'mobile':_0x222818,'phone':_0x222818,'ListId':_0x259e0d[_0xec60('0x7c')]}));}})[_0xec60('0x34')](handleEntityNotFound(_0x4e07a5,null))[_0xec60('0x34')](function(_0x428a7d){if(_0x428a7d){_0x3aa693=_0x428a7d;return db['SmsInteraction']['find']({'where':{'ContactId':_0x3aa693['id'],'closed':![],'SmsAccountId':_0x259e0d['id']}})['then'](function(_0x1cd8ac){if(_0x1cd8ac){return[_0x1cd8ac,![]];}return db[_0xec60('0xa0')][_0xec60('0x5d')]({'UserId':_0x35e448[_0xec60('0x60')]['id'],'ContactId':_0x3aa693['id'],'SmsAccountId':_0x259e0d['id'],'phone':_0x222818,'firstMsgDirection':'out','Messages':[_[_0xec60('0x51')](_0x35e448[_0xec60('0x5e')],{'read':![],'body':_0x35e448[_0xec60('0x5e')]['body'],'phone':_0x222818,'SmsAccountId':_0x259e0d['id'],'UserId':_0x35e448[_0xec60('0x60')]['id'],'ContactId':_0x3aa693['id']})]},{'include':[{'model':db[_0xec60('0xc4')],'as':'Messages'}]})[_0xec60('0x34')](function(_0x2f7553){return[_0x2f7553,!![]];});});}})[_0xec60('0xa1')](function(_0x1bf81c,_0x9150cc){if(_0x9150cc){return _0x1bf81c;}return db[_0xec60('0xc4')][_0xec60('0x5d')](_[_0xec60('0x51')](_0x35e448[_0xec60('0x5e')],{'read':![],'body':_0x35e448[_0xec60('0x5e')]['body'],'phone':_0x222818,'SmsAccountId':_0x259e0d['id'],'SmsInteractionId':_0x1bf81c['id'],'UserId':_0x35e448['user']['id'],'ContactId':_0x3aa693['id']}))['then'](function(_0x3618d4){_0x1bf81c['dataValues'][_0xec60('0xc5')]=[];_0x1bf81c[_0xec60('0xc6')][_0xec60('0xc5')][_0xec60('0xa5')](_0x3618d4[_0xec60('0xc6')]);return _0x1bf81c;});})[_0xec60('0x34')](respondWithResult(_0x4e07a5,null))[_0xec60('0x28')](handleError(_0x4e07a5,null));};exports['status']=function(_0x5ed77c,_0x25f186,_0x249f59){if(_0x5ed77c[_0xec60('0x5e')]['id']){delete _0x5ed77c[_0xec60('0x5e')]['id'];}console[_0xec60('0xc7')](_0xec60('0xc8'),_0x5ed77c['body']);var _0x2cb773,_0x3c7511,_0x5c67e6;return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x5ed77c[_0xec60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x25f186,null))[_0xec60('0x34')](function(_0x44bbeb){if(_0x44bbeb){_0x5c67e6=_0x44bbeb;logger['debug'](_0xec60('0x24'),_0xec60('0x2a'),'received\x20delivery\x20report\x20from',_0x44bbeb[_0xec60('0x3f')],util['inspect'](_0x5ed77c[_0xec60('0x5e')],{'showHidden':![],'depth':null}));switch(_0x44bbeb['type']){case _0xec60('0x83'):if(_0x5ed77c['body']['skebby_dispatch_id']&&_0x5ed77c[_0xec60('0x5e')][_0xec60('0x2a')]){_0x3c7511=_0x5ed77c['body'][_0xec60('0x2a')];return db[_0xec60('0xc4')][_0xec60('0x5c')]({'where':{'messageId':_0x5ed77c[_0xec60('0x5e')][_0xec60('0xc9')]}});}break;case'connectel':if(_0x5ed77c[_0xec60('0x5e')][_0xec60('0xca')]&&_0x5ed77c['body'][_0xec60('0xcb')]){_0x3c7511=_0x5ed77c[_0xec60('0x5e')][_0xec60('0xcb')];return db['SmsMessage'][_0xec60('0x5c')]({'where':{'messageId':_0x5ed77c[_0xec60('0x5e')]['requestid']}});}break;case'clicksend':if(_0x5ed77c[_0xec60('0x5e')][_0xec60('0x88')]&&_0x5ed77c['body']['status_code']){_0x3c7511=_0x5ed77c['body']['status_code'];return db[_0xec60('0xc4')][_0xec60('0x5c')]({'where':{'messageId':_0x5ed77c[_0xec60('0x5e')][_0xec60('0x88')]}});}break;case _0xec60('0x8d'):var _0x4f9507=_0x5ed77c[_0xec60('0x5e')][_0xec60('0x8e')][0x0];if(_0x4f9507[_0xec60('0x81')]&&_0x4f9507[_0xec60('0x2a')][_0xec60('0xcc')]===_0xec60('0xcd')){_0x3c7511=_0x4f9507[_0xec60('0x2a')][_0xec60('0xcc')];return db['SmsMessage']['find']({'where':{'messageId':_0x4f9507[_0xec60('0x81')]}});}break;case _0xec60('0xce'):if(_0x5ed77c[_0xec60('0x5e')][_0xec60('0x81')]&&_0x5ed77c[_0xec60('0x5e')]['status']){_0x3c7511=_0x5ed77c['body'][_0xec60('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x5ed77c[_0xec60('0x5e')][_0xec60('0x81')]}});}break;case'intelepeer':if(_0x5ed77c[_0xec60('0x5e')][_0xec60('0xcf')]&&_0x5ed77c[_0xec60('0x5e')]['status']){_0x3c7511=_0x5ed77c['body'][_0xec60('0x2a')];return db[_0xec60('0xc4')][_0xec60('0x5c')]({'where':{'messageId':_0x5ed77c[_0xec60('0x5e')][_0xec60('0xcf')]}});}break;}}})[_0xec60('0x34')](handleEntityNotFound(_0x25f186,null))[_0xec60('0x34')](function(_0x52f780){if(_0x52f780){_0x2cb773=_0x52f780;switch(_0x5c67e6['type']){case'skebby':if(_0x3c7511===_0xec60('0xcd')){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')](_0xec60('0x24'),'status',_0xec60('0x83'),util[_0xec60('0xd0')](_0x5ed77c[_0xec60('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xec60('0x86'):if(_0x3c7511==='1'){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')](_0xec60('0x24'),_0xec60('0x2a'),'skebby',util[_0xec60('0xd0')](_0x5ed77c[_0xec60('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5ed77c[_0xec60('0x5e')][_0xec60('0xd1')]&&_0x3c7511>=0xc8&&_0x3c7511<=0xce){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xec60('0x2a'),_0xec60('0x87'),util['inspect'](_0x5ed77c['body'],{'showHidden':![],'depth':null}));}break;case _0xec60('0x8d'):var _0x49e42b=_0x5ed77c['body'][_0xec60('0x8e')][0x0];if(_0x49e42b[_0xec60('0x2a')]['groupName']==='DELIVERED'){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xec60('0x2a'),_0xec60('0x8d'),util[_0xec60('0xd0')](_0x5ed77c['body'],{'showHidden':![],'depth':null}));}break;case _0xec60('0xce'):if(_0x3c7511==_0xec60('0xd2')||_0x3c7511=='RECEIVED_BY_RECIPIENT'){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')](_0xec60('0x24'),_0xec60('0x2a'),_0xec60('0xce'),util[_0xec60('0xd0')](_0x5ed77c[_0xec60('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xec60('0x94'):if(_0x3c7511==='DELIVRD'||_0x3c7511===_0xec60('0xd3')){return _0x2cb773[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')](_0xec60('0x24'),_0xec60('0x2a'),'intelepeer',util[_0xec60('0xd0')](_0x5ed77c[_0xec60('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2cb773;}})[_0xec60('0x34')](respondWithResult(_0x25f186,null))['catch'](handleError(_0x25f186,null));};exports['statusGet']=function(_0x51087f,_0x21cb11,_0x3e7f84){var _0x335fc2,_0x567fa3,_0x429cdc;return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x51087f['params']['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x21cb11,null))['then'](function(_0xce9184){if(_0xce9184){_0x429cdc=_0xce9184;logger[_0xec60('0x23')](_0xec60('0x24'),_0xec60('0x2a'),_0xec60('0xd4'),_0xce9184['type'],util[_0xec60('0xd0')](_0x51087f[_0xec60('0x43')],{'showHidden':![],'depth':null}));switch(_0xce9184['type']){case _0xec60('0x8f'):if(_0x51087f['query']['message-id']&&_0x51087f[_0xec60('0x43')][_0xec60('0xd5')]){_0x567fa3=_0x51087f[_0xec60('0x43')][_0xec60('0xd5')];return db['SmsMessage'][_0xec60('0x5c')]({'where':{'messageId':_0x51087f['query'][_0xec60('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x21cb11,null))[_0xec60('0x34')](function(_0x3dc111){if(_0x3dc111){_0x335fc2=_0x3dc111;switch(_0x429cdc[_0xec60('0x3f')]){case _0xec60('0x8f'):if(_0x567fa3==='2'||_0x567fa3==='6'){return _0x335fc2[_0xec60('0x32')]({'read':!![]});}else{logger[_0xec60('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xec60('0x2a'),_0xec60('0x8f'),util[_0xec60('0xd0')](_0x51087f['query'],{'showHidden':![],'depth':null}));};break;}return _0x335fc2;}})[_0xec60('0x34')](respondWithResult(_0x21cb11,null))[_0xec60('0x28')](handleError(_0x21cb11,null));};exports[_0xec60('0xd7')]=function(_0x4014ea,_0x5f3b9e,_0x4dc43d){return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x4014ea['params']['id']}})['then'](handleEntityNotFound(_0x5f3b9e,null))[_0xec60('0x34')](function(_0x51de13){if(_0x51de13){return _0x51de13['addAgents'](_0x4014ea[_0xec60('0x5e')][_0xec60('0xd8')],_[_0xec60('0x9e')](_0x4014ea['body'],[_0xec60('0xd8'),'id'])||{})[_0xec60('0xa1')](function(_0x315cbf){for(var _0x5f3742=0x0;_0x5f3742<_0x4014ea[_0xec60('0x5e')][_0xec60('0xd8')][_0xec60('0x49')];_0x5f3742+=0x1){socket['emit'](_0xec60('0xd9'),{'UserId':_0x4014ea[_0xec60('0x5e')][_0xec60('0xd8')][_0x5f3742],'SmsAccountId':_0x4014ea[_0xec60('0x5a')]['id']});}return _0x315cbf;});}})[_0xec60('0x34')](respondWithResult(_0x5f3b9e,null))[_0xec60('0x28')](handleError(_0x5f3b9e,null));};exports['removeAgents']=function(_0x6d3d3d,_0x779720,_0x50b431){return db[_0xec60('0x3c')][_0xec60('0x5c')]({'where':{'id':_0x6d3d3d['params']['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x779720,null))['then'](function(_0x112d54){if(_0x112d54){return _0x112d54[_0xec60('0xda')](_0x6d3d3d[_0xec60('0x43')]['ids'])[_0xec60('0x34')](function(){if(_[_0xec60('0xdb')](_0x6d3d3d[_0xec60('0x43')]['ids'])){for(var _0x5bc198=0x0;_0x5bc198<_0x6d3d3d['query'][_0xec60('0xd8')][_0xec60('0x49')];_0x5bc198+=0x1){socket[_0xec60('0xdc')](_0xec60('0xdd'),{'UserId':Number(_0x6d3d3d[_0xec60('0x43')][_0xec60('0xd8')][_0x5bc198]),'SmsAccountId':Number(_0x6d3d3d[_0xec60('0x5a')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x6d3d3d['query']['ids']),'SmsAccountId':Number(_0x6d3d3d[_0xec60('0x5a')]['id'])});}});}})[_0xec60('0x34')](respondWithStatusCode(_0x779720,null))[_0xec60('0x28')](handleError(_0x779720,null));};exports['getAgents']=function(_0x3f4fda,_0x45123e,_0x58121d){var _0x446828={};var _0x46e53f={};var _0x5238d5;var _0x135afa;return db[_0xec60('0x3c')]['findOne']({'where':{'id':_0x3f4fda[_0xec60('0x5a')]['id']}})[_0xec60('0x34')](handleEntityNotFound(_0x45123e,null))[_0xec60('0x34')](function(_0x403d8c){if(_0x403d8c){_0x5238d5=_0x403d8c;_0x46e53f[_0xec60('0x41')]=_[_0xec60('0x44')](db[_0xec60('0xa9')]['rawAttributes']);_0x46e53f[_0xec60('0x43')]=_[_0xec60('0x44')](_0x3f4fda[_0xec60('0x43')]);_0x46e53f[_0xec60('0x45')]=_[_0xec60('0x46')](_0x46e53f[_0xec60('0x41')],_0x46e53f[_0xec60('0x43')]);_0x446828['attributes']=_[_0xec60('0x46')](_0x46e53f[_0xec60('0x41')],qs[_0xec60('0x48')](_0x3f4fda[_0xec60('0x43')][_0xec60('0x48')]));_0x446828[_0xec60('0x47')]=_0x446828[_0xec60('0x47')][_0xec60('0x49')]?_0x446828[_0xec60('0x47')]:_0x46e53f[_0xec60('0x41')];_0x446828[_0xec60('0x4d')]=qs[_0xec60('0x4e')](_0x3f4fda['query']['sort']);_0x446828[_0xec60('0x50')]=qs[_0xec60('0x45')](_[_0xec60('0x69')](_0x3f4fda['query'],_0x46e53f[_0xec60('0x45')]));if(_0x3f4fda[_0xec60('0x43')][_0xec60('0x4f')]){_0x446828[_0xec60('0x50')]=_[_0xec60('0x51')](_0x446828[_0xec60('0x50')],{'$or':_['map'](_0x446828['attributes'],function(_0x519a90){var _0x3bfd9d={};_0x3bfd9d[_0x519a90]={'$like':'%'+_0x3f4fda['query'][_0xec60('0x4f')]+'%'};return _0x3bfd9d;})});}_0x446828=_[_0xec60('0x51')]({},_0x446828,_0x3f4fda[_0xec60('0x53')]);return _0x5238d5[_0xec60('0xde')](_0x446828);}})[_0xec60('0x34')](function(_0x54a729){if(_0x54a729){_0x135afa=_0x54a729[_0xec60('0x49')];if(!_0x3f4fda['query']['hasOwnProperty'](_0xec60('0x4b'))){_0x446828['limit']=qs['limit'](_0x3f4fda[_0xec60('0x43')][_0xec60('0x4c')]);_0x446828[_0xec60('0x2d')]=qs[_0xec60('0x2d')](_0x3f4fda['query']['offset']);}return _0x5238d5[_0xec60('0xde')](_0x446828);}})[_0xec60('0x34')](function(_0x26709d){if(_0x26709d){return _0x26709d?{'count':_0x135afa,'rows':_0x26709d}:null;}})[_0xec60('0x34')](respondWithResult(_0x45123e,null))[_0xec60('0x28')](handleError(_0x45123e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 87e5adb..89600c8 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 _0x2866=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x2866,0x196));var _0x6286=function(_0x361422,_0xa27d1e){_0x361422=_0x361422-0x0;var _0x2daa43=_0x2866[_0x361422];return _0x2daa43;};'use strict';var EventEmitter=require(_0x6286('0x0'));var SmsAccount=require(_0x6286('0x1'))['db'][_0x6286('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6286('0x3')](0x0);var events={'afterCreate':_0x6286('0x4'),'afterUpdate':_0x6286('0x5'),'afterDestroy':_0x6286('0x6')};function emitEvent(_0x4ae25d){return function(_0x256071,_0x46c347,_0x1b1db4){SmsAccountEvents[_0x6286('0x7')](_0x4ae25d+':'+_0x256071['id'],_0x256071);SmsAccountEvents[_0x6286('0x7')](_0x4ae25d,_0x256071);_0x1b1db4(null);};}for(var e in events){if(events[_0x6286('0x8')](e)){var event=events[e];SmsAccount[_0x6286('0x9')](e,emitEvent(event));}}module[_0x6286('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x9009=['exports','SmsAccount','setMaxListeners','update','emit','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9009,0xfd));var _0x9900=function(_0x4fd022,_0x159c23){_0x4fd022=_0x4fd022-0x0;var _0x247beb=_0x9009[_0x4fd022];return _0x247beb;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x9900('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9900('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9900('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24a1b3){return function(_0x1a549e,_0x40f5ed,_0x3368bf){SmsAccountEvents[_0x9900('0x3')](_0x24a1b3+':'+_0x1a549e['id'],_0x1a549e);SmsAccountEvents[_0x9900('0x3')](_0x24a1b3,_0x1a549e);_0x3368bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x9900('0x4')](e,emitEvent(event));}}module[_0x9900('0x5')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 262c9bc..ad5bdd5 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 _0xf817=['../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x41d2ad,_0x3126e0){var _0x50f082=function(_0x1565a1){while(--_0x1565a1){_0x41d2ad['push'](_0x41d2ad['shift']());}};_0x50f082(++_0x3126e0);}(_0xf817,0x16c));var _0x7f81=function(_0x2be12d,_0x2a9c3b){_0x2be12d=_0x2be12d-0x0;var _0x30b292=_0xf817[_0x2be12d];return _0x30b292;};'use strict';var _=require(_0x7f81('0x0'));var util=require(_0x7f81('0x1'));var logger=require('../../config/logger')(_0x7f81('0x2'));var moment=require(_0x7f81('0x3'));var BPromise=require(_0x7f81('0x4'));var rp=require(_0x7f81('0x5'));var fs=require('fs');var path=require(_0x7f81('0x6'));var rimraf=require(_0x7f81('0x7'));var config=require(_0x7f81('0x8'));var attributes=require(_0x7f81('0x9'));module[_0x7f81('0xa')]=function(_0x283040,_0x542dce){return _0x283040['define']('SmsAccount',attributes,{'tableName':_0x7f81('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1445=['../../config/environment','./smsAccount.attributes','exports','SmsAccount','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1445,0x68));var _0x5144=function(_0x413b19,_0x299538){_0x413b19=_0x413b19-0x0;var _0xb73bb6=_0x1445[_0x413b19];return _0xb73bb6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5144('0x0'))(_0x5144('0x1'));var moment=require(_0x5144('0x2'));var BPromise=require(_0x5144('0x3'));var rp=require(_0x5144('0x4'));var fs=require('fs');var path=require(_0x5144('0x5'));var rimraf=require('rimraf');var config=require(_0x5144('0x6'));var attributes=require(_0x5144('0x7'));module[_0x5144('0x8')]=function(_0x1168ee,_0x465e68){return _0x1168ee['define'](_0x5144('0x9'),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 af6e8a8..c287e45 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 _0x1ce0=['client','http','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','SmsAccount','options','where','attributes','include','model','ShowSmsAccount','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4b013f,_0x1030c7){var _0x2d426b=function(_0x2a1eb8){while(--_0x2a1eb8){_0x4b013f['push'](_0x4b013f['shift']());}};_0x2d426b(++_0x1030c7);}(_0x1ce0,0x178));var _0x01ce=function(_0x24e23d,_0x26684a){_0x24e23d=_0x24e23d-0x0;var _0x14db43=_0x1ce0[_0x24e23d];return _0x14db43;};'use strict';var _=require('lodash');var util=require(_0x01ce('0x0'));var moment=require(_0x01ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x01ce('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01ce('0x3'))['db'];var utils=require(_0x01ce('0x4'));var logger=require(_0x01ce('0x5'))('rpc');var config=require(_0x01ce('0x6'));var jayson=require(_0x01ce('0x7'));var client=jayson[_0x01ce('0x8')][_0x01ce('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x01ce('0xa'),'port':0x18eb});var socket=require(_0x01ce('0xb'))(new Redis(config['redis']));require(_0x01ce('0xc'))[_0x01ce('0xd')](socket);function respondWithRpcPromise(_0x1d4556,_0x2834e0,_0x504656){return new BPromise(function(_0x2bdcac,_0x2d4250){return client['request'](_0x1d4556,_0x504656)[_0x01ce('0xe')](function(_0x23ab8a){logger[_0x01ce('0xf')](_0x01ce('0x10'),_0x2834e0,_0x01ce('0x11'));logger[_0x01ce('0x12')](_0x01ce('0x13'),_0x2834e0,'request\x20sent',JSON[_0x01ce('0x14')](_0x23ab8a));if(_0x23ab8a[_0x01ce('0x15')]){if(_0x23ab8a[_0x01ce('0x15')][_0x01ce('0x16')]===0x1f4){logger[_0x01ce('0x15')](_0x01ce('0x10'),_0x2834e0,_0x23ab8a['error'][_0x01ce('0x17')]);return _0x2d4250(_0x23ab8a[_0x01ce('0x15')][_0x01ce('0x17')]);}logger['error'](_0x01ce('0x10'),_0x2834e0,_0x23ab8a[_0x01ce('0x15')][_0x01ce('0x17')]);return _0x2bdcac(_0x23ab8a[_0x01ce('0x15')]['message']);}else{logger['info'](_0x01ce('0x10'),_0x2834e0,_0x01ce('0x11'));_0x2bdcac(_0x23ab8a['result']['message']);}})[_0x01ce('0x18')](function(_0x603b66){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2834e0,_0x603b66);_0x2d4250(_0x603b66);});});}exports['ShowSmsAccount']=function(_0x1cba76){var _0x5e5a23=this;return new Promise(function(_0x16e632,_0x3b3fb3){return db[_0x01ce('0x19')]['find']({'raw':_0x1cba76[_0x01ce('0x1a')]?_0x1cba76[_0x01ce('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1cba76[_0x01ce('0x1a')]?_0x1cba76[_0x01ce('0x1a')][_0x01ce('0x1b')]||null:null,'attributes':_0x1cba76[_0x01ce('0x1a')]?_0x1cba76['options'][_0x01ce('0x1c')]||null:null,'include':_0x1cba76[_0x01ce('0x1a')]?_0x1cba76[_0x01ce('0x1a')][_0x01ce('0x1d')]?_['map'](_0x1cba76[_0x01ce('0x1a')][_0x01ce('0x1d')],function(_0x33fd6b){return{'model':db[_0x33fd6b[_0x01ce('0x1e')]],'as':_0x33fd6b['as'],'attributes':_0x33fd6b[_0x01ce('0x1c')],'include':_0x33fd6b[_0x01ce('0x1d')]?_['map'](_0x33fd6b['include'],function(_0x29e260){return{'model':db[_0x29e260[_0x01ce('0x1e')]],'as':_0x29e260['as'],'attributes':_0x29e260[_0x01ce('0x1c')],'include':_0x29e260[_0x01ce('0x1d')]?_['map'](_0x29e260[_0x01ce('0x1d')],function(_0xbd8023){return{'model':db[_0xbd8023[_0x01ce('0x1e')]],'as':_0xbd8023['as'],'attributes':_0xbd8023[_0x01ce('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01ce('0xe')](function(_0x5a4526){logger[_0x01ce('0xf')]('ShowSmsAccount',_0x1cba76);logger[_0x01ce('0x12')]('ShowSmsAccount',_0x1cba76,JSON[_0x01ce('0x14')](_0x5a4526));_0x16e632(_0x5a4526);})[_0x01ce('0x18')](function(_0x49a383){logger[_0x01ce('0x15')](_0x01ce('0x1f'),_0x49a383[_0x01ce('0x17')],_0x1cba76);_0x3b3fb3(_0x5e5a23[_0x01ce('0x15')](0x1f4,_0x49a383[_0x01ce('0x17')]));});});}; \ No newline at end of file +var _0x7ffc=['raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','http','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','options'];(function(_0x48981c,_0x296fd6){var _0x16b52e=function(_0xf1c992){while(--_0xf1c992){_0x48981c['push'](_0x48981c['shift']());}};_0x16b52e(++_0x296fd6);}(_0x7ffc,0xd2));var _0xc7ff=function(_0x822a3f,_0x32fd83){_0x822a3f=_0x822a3f-0x0;var _0x1053e7=_0x7ffc[_0x822a3f];return _0x1053e7;};'use strict';var _=require(_0xc7ff('0x0'));var util=require(_0xc7ff('0x1'));var moment=require(_0xc7ff('0x2'));var BPromise=require(_0xc7ff('0x3'));var rs=require(_0xc7ff('0x4'));var fs=require('fs');var Redis=require(_0xc7ff('0x5'));var db=require(_0xc7ff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7ff('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc7ff('0x8')]({'port':0x232a});config[_0xc7ff('0x9')]=_['defaults'](config['redis'],{'host':_0xc7ff('0xa'),'port':0x18eb});var socket=require(_0xc7ff('0xb'))(new Redis(config[_0xc7ff('0x9')]));require(_0xc7ff('0xc'))[_0xc7ff('0xd')](socket);function respondWithRpcPromise(_0x406b8e,_0x1bc9b2,_0x4aa6e0){return new BPromise(function(_0x28d385,_0x22e9be){return client['request'](_0x406b8e,_0x4aa6e0)[_0xc7ff('0xe')](function(_0x4d2c58){logger['info'](_0xc7ff('0xf'),_0x1bc9b2,_0xc7ff('0x10'));logger[_0xc7ff('0x11')](_0xc7ff('0x12'),_0x1bc9b2,'request\x20sent',JSON[_0xc7ff('0x13')](_0x4d2c58));if(_0x4d2c58['error']){if(_0x4d2c58[_0xc7ff('0x14')][_0xc7ff('0x15')]===0x1f4){logger[_0xc7ff('0x14')](_0xc7ff('0xf'),_0x1bc9b2,_0x4d2c58[_0xc7ff('0x14')][_0xc7ff('0x16')]);return _0x22e9be(_0x4d2c58[_0xc7ff('0x14')][_0xc7ff('0x16')]);}logger[_0xc7ff('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1bc9b2,_0x4d2c58['error']['message']);return _0x28d385(_0x4d2c58[_0xc7ff('0x14')][_0xc7ff('0x16')]);}else{logger[_0xc7ff('0x17')](_0xc7ff('0xf'),_0x1bc9b2,_0xc7ff('0x10'));_0x28d385(_0x4d2c58[_0xc7ff('0x18')][_0xc7ff('0x16')]);}})[_0xc7ff('0x19')](function(_0x32a219){logger[_0xc7ff('0x14')]('SmsAccount,\x20%s,\x20%s',_0x1bc9b2,_0x32a219);_0x22e9be(_0x32a219);});});}exports[_0xc7ff('0x1a')]=function(_0x171821){var _0x781632=this;return new Promise(function(_0x32de85,_0x362705){return db['SmsAccount']['find']({'raw':_0x171821[_0xc7ff('0x1b')]?_0x171821['options'][_0xc7ff('0x1c')]===undefined?!![]:![]:!![],'where':_0x171821[_0xc7ff('0x1b')]?_0x171821[_0xc7ff('0x1b')][_0xc7ff('0x1d')]||null:null,'attributes':_0x171821[_0xc7ff('0x1b')]?_0x171821[_0xc7ff('0x1b')][_0xc7ff('0x1e')]||null:null,'include':_0x171821[_0xc7ff('0x1b')]?_0x171821[_0xc7ff('0x1b')][_0xc7ff('0x1f')]?_[_0xc7ff('0x20')](_0x171821['options'][_0xc7ff('0x1f')],function(_0x4b2812){return{'model':db[_0x4b2812[_0xc7ff('0x21')]],'as':_0x4b2812['as'],'attributes':_0x4b2812['attributes'],'include':_0x4b2812['include']?_[_0xc7ff('0x20')](_0x4b2812[_0xc7ff('0x1f')],function(_0x2b4268){return{'model':db[_0x2b4268[_0xc7ff('0x21')]],'as':_0x2b4268['as'],'attributes':_0x2b4268[_0xc7ff('0x1e')],'include':_0x2b4268[_0xc7ff('0x1f')]?_[_0xc7ff('0x20')](_0x2b4268[_0xc7ff('0x1f')],function(_0x3d5bfc){return{'model':db[_0x3d5bfc[_0xc7ff('0x21')]],'as':_0x3d5bfc['as'],'attributes':_0x3d5bfc['attributes']};}):[]};}):[]};}):[]:[]})[_0xc7ff('0xe')](function(_0xd95e44){logger[_0xc7ff('0x17')](_0xc7ff('0x1a'),_0x171821);logger['debug'](_0xc7ff('0x1a'),_0x171821,JSON['stringify'](_0xd95e44));_0x32de85(_0xd95e44);})['catch'](function(_0xd272f8){logger[_0xc7ff('0x14')](_0xc7ff('0x1a'),_0xd272f8['message'],_0x171821);_0x362705(_0x781632[_0xc7ff('0x14')](0x1f4,_0xd272f8[_0xc7ff('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2bfe7ab..08811b1 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 _0x8aaf=['./smsAccount.events','save','update','removeListener','register','length','smsAccount:'];(function(_0x19e166,_0x4cc641){var _0x5e6bed=function(_0xb7fce7){while(--_0xb7fce7){_0x19e166['push'](_0x19e166['shift']());}};_0x5e6bed(++_0x4cc641);}(_0x8aaf,0x93));var _0xf8aa=function(_0x32ab2a,_0x56b70b){_0x32ab2a=_0x32ab2a-0x0;var _0x4c26c1=_0x8aaf[_0x32ab2a];return _0x4c26c1;};'use strict';var SmsAccountEvents=require(_0xf8aa('0x0'));var events=[_0xf8aa('0x1'),'remove',_0xf8aa('0x2')];function createListener(_0xf2c0b4,_0x5c47ac){return function(_0x12eb91){_0x5c47ac['emit'](_0xf2c0b4,_0x12eb91);};}function removeListener(_0x196636,_0x16aa76){return function(){SmsAccountEvents[_0xf8aa('0x3')](_0x196636,_0x16aa76);};}exports[_0xf8aa('0x4')]=function(_0x380d6e){for(var _0x17e813=0x0,_0x533f72=events[_0xf8aa('0x5')];_0x17e813<_0x533f72;_0x17e813++){var _0x484178=events[_0x17e813];var _0x3f7539=createListener(_0xf8aa('0x6')+_0x484178,_0x380d6e);SmsAccountEvents['on'](_0x484178,_0x3f7539);}}; \ No newline at end of file +var _0x2741=['register','length','smsAccount:','./smsAccount.events','save','remove','update','emit','removeListener'];(function(_0x2b2ff6,_0x4a7c82){var _0x5b70fd=function(_0x3a7334){while(--_0x3a7334){_0x2b2ff6['push'](_0x2b2ff6['shift']());}};_0x5b70fd(++_0x4a7c82);}(_0x2741,0xae));var _0x1274=function(_0x48ed63,_0x2b70ef){_0x48ed63=_0x48ed63-0x0;var _0x5f5516=_0x2741[_0x48ed63];return _0x5f5516;};'use strict';var SmsAccountEvents=require(_0x1274('0x0'));var events=[_0x1274('0x1'),_0x1274('0x2'),_0x1274('0x3')];function createListener(_0x4d0b26,_0x346f3c){return function(_0x54b4b4){_0x346f3c[_0x1274('0x4')](_0x4d0b26,_0x54b4b4);};}function removeListener(_0xd6e7d0,_0x414ea4){return function(){SmsAccountEvents[_0x1274('0x5')](_0xd6e7d0,_0x414ea4);};}exports[_0x1274('0x6')]=function(_0x48ebba){for(var _0x47ca65=0x0,_0x5d0d9b=events[_0x1274('0x7')];_0x47ca65<_0x5d0d9b;_0x47ca65++){var _0x2be5ad=events[_0x47ca65];var _0x624b9b=createListener(_0x1274('0x8')+_0x2be5ad,_0x48ebba);SmsAccountEvents['on'](_0x2be5ad,_0x624b9b);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 9c74341..b3065c5 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 _0xd9b0=['../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','/:id','post','isAuthenticated','create','put','destroy','exports','multer','util','express','Router'];(function(_0x1fa7c8,_0x4e196c){var _0x3a2dee=function(_0x10dcb8){while(--_0x10dcb8){_0x1fa7c8['push'](_0x1fa7c8['shift']());}};_0x3a2dee(++_0x4e196c);}(_0xd9b0,0x191));var _0x0d9b=function(_0x20876d,_0x2ce0c7){_0x20876d=_0x20876d-0x0;var _0x492998=_0xd9b0[_0x20876d];return _0x492998;};'use strict';var multer=require(_0x0d9b('0x0'));var util=require(_0x0d9b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d9b('0x2'));var router=express[_0x0d9b('0x3')]();var auth=require(_0x0d9b('0x4'));var interaction=require(_0x0d9b('0x5'));var config=require('../../config/environment');var controller=require(_0x0d9b('0x6'));router[_0x0d9b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0d9b('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x0d9b('0x9')]('/',auth[_0x0d9b('0xa')](),controller[_0x0d9b('0xb')]);router[_0x0d9b('0xc')](_0x0d9b('0x8'),auth[_0x0d9b('0xa')](),controller['update']);router['delete'](_0x0d9b('0x8'),auth[_0x0d9b('0xa')](),controller[_0x0d9b('0xd')]);module[_0x0d9b('0xe')]=router; \ No newline at end of file +var _0xca3c=['../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x405245,_0xe406ae){var _0x227d72=function(_0x8466bb){while(--_0x8466bb){_0x405245['push'](_0x405245['shift']());}};_0x227d72(++_0xe406ae);}(_0xca3c,0x1ca));var _0xcca3=function(_0x5bbd77,_0x4dd37c){_0x5bbd77=_0x5bbd77-0x0;var _0x50ec66=_0xca3c[_0x5bbd77];return _0x50ec66;};'use strict';var multer=require(_0xcca3('0x0'));var util=require(_0xcca3('0x1'));var path=require(_0xcca3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcca3('0x3')]();var auth=require(_0xcca3('0x4'));var interaction=require(_0xcca3('0x5'));var config=require(_0xcca3('0x6'));var controller=require('./smsApplication.controller');router[_0xcca3('0x7')]('/',auth[_0xcca3('0x8')](),controller[_0xcca3('0x9')]);router[_0xcca3('0x7')](_0xcca3('0xa'),auth[_0xcca3('0x8')](),controller[_0xcca3('0xb')]);router[_0xcca3('0xc')]('/',auth[_0xcca3('0x8')](),controller['create']);router[_0xcca3('0xd')](_0xcca3('0xa'),auth[_0xcca3('0x8')](),controller[_0xcca3('0xe')]);router[_0xcca3('0xf')](_0xcca3('0xa'),auth[_0xcca3('0x8')](),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 b89a207..b3177d4 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 _0x0d40=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0xe2412c,_0x373365){var _0xb50d09=function(_0x500fe0){while(--_0x500fe0){_0xe2412c['push'](_0xe2412c['shift']());}};_0xb50d09(++_0x373365);}(_0x0d40,0x155));var _0x00d4=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0x0d40[_0x46ce98];return _0x172f46;};'use strict';var Sequelize=require('sequelize');module[_0x00d4('0x0')]={'priority':{'type':Sequelize[_0x00d4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x00d4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x00d4('0x3')]()},'description':{'type':Sequelize[_0x00d4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x00d4('0x4')}}; \ No newline at end of file +var _0x58ca=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x5b4c10,_0x7f8fdc){var _0x47a997=function(_0x3504a1){while(--_0x3504a1){_0x5b4c10['push'](_0x5b4c10['shift']());}};_0x47a997(++_0x7f8fdc);}(_0x58ca,0x103));var _0xa58c=function(_0x2a0910,_0x3e95c2){_0x2a0910=_0x2a0910-0x0;var _0x30aae8=_0x58ca[_0x2a0910];return _0x30aae8;};'use strict';var Sequelize=require(_0xa58c('0x0'));module[_0xa58c('0x1')]={'priority':{'type':Sequelize[_0xa58c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa58c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xa58c('0x3')]},'interval':{'type':Sequelize[_0xa58c('0x3')],'defaultValue':_0xa58c('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 67cbf9c..9d8ec28 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 _0xc664=['create','body','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','then','destroy','name','send','map','SmsApplication','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','length','include','find'];(function(_0x84b9a1,_0x489b2a){var _0x5a0bf2=function(_0x37d278){while(--_0x37d278){_0x84b9a1['push'](_0x84b9a1['shift']());}};_0x5a0bf2(++_0x489b2a);}(_0xc664,0x90));var _0x4c66=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc664[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4c66('0x0'));var emlformat=require(_0x4c66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4c66('0x2'));var jsonpatch=require(_0x4c66('0x3'));var rp=require(_0x4c66('0x4'));var moment=require(_0x4c66('0x5'));var BPromise=require(_0x4c66('0x6'));var Mustache=require('mustache');var util=require(_0x4c66('0x7'));var path=require(_0x4c66('0x8'));var sox=require(_0x4c66('0x9'));var csv=require(_0x4c66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c66('0xb'));var squel=require(_0x4c66('0xc'));var crypto=require(_0x4c66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4c66('0xa'));var querystring=require(_0x4c66('0xe'));var Papa=require(_0x4c66('0xf'));var Redis=require(_0x4c66('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c66('0x11'));var as=require(_0x4c66('0x12'));var hardwareService=require(_0x4c66('0x13'));var logger=require(_0x4c66('0x14'))(_0x4c66('0x15'));var utils=require(_0x4c66('0x16'));var config=require(_0x4c66('0x17'));var licenseUtil=require(_0x4c66('0x18'));var db=require(_0x4c66('0x19'))['db'];function respondWithStatusCode(_0x497cdf,_0x49d412){_0x49d412=_0x49d412||0xcc;return function(_0x51b6f9){if(_0x51b6f9){return _0x497cdf['sendStatus'](_0x49d412);}return _0x497cdf[_0x4c66('0x1a')](_0x49d412)[_0x4c66('0x1b')]();};}function respondWithResult(_0x1b3135,_0x5833b7){_0x5833b7=_0x5833b7||0xc8;return function(_0x1d37a5){if(_0x1d37a5){return _0x1b3135[_0x4c66('0x1a')](_0x5833b7)[_0x4c66('0x1c')](_0x1d37a5);}};}function respondWithFilteredResult(_0x16b20d,_0x46280e){return function(_0x23d1b6){if(_0x23d1b6){var _0x108f8c=_0x23d1b6[_0x4c66('0x1d')],_0x202e5c=_0x46280e['offset'],_0x7181c4=_0x46280e[_0x4c66('0x1e')]+_0x46280e[_0x4c66('0x1f')],_0x144982;if(_0x7181c4>=_0x108f8c){_0x7181c4=_0x108f8c;_0x144982=0xc8;}else{_0x144982=0xce;}_0x16b20d[_0x4c66('0x1a')](_0x144982);return _0x16b20d['set']('Content-Range',_0x202e5c+'-'+_0x7181c4+'/'+_0x108f8c)['json'](_0x23d1b6);}return null;};}function patchUpdates(_0x4c2667){return function(_0x1cfd00){try{jsonpatch[_0x4c66('0x20')](_0x1cfd00,_0x4c2667,!![]);}catch(_0x48a3c6){return BPromise[_0x4c66('0x21')](_0x48a3c6);}return _0x1cfd00['save']();};}function saveUpdates(_0x160601,_0x53af34){return function(_0x49e3e6){if(_0x49e3e6){return _0x49e3e6['update'](_0x160601)[_0x4c66('0x22')](function(_0x12e46b){return _0x12e46b;});}return null;};}function removeEntity(_0x19c37d,_0x862fa4){return function(_0x20bc50){if(_0x20bc50){return _0x20bc50[_0x4c66('0x23')]()[_0x4c66('0x22')](function(){_0x19c37d[_0x4c66('0x1a')](0xcc)[_0x4c66('0x1b')]();});}};}function handleEntityNotFound(_0x362e69,_0x35084b){return function(_0x2589b6){if(!_0x2589b6){_0x362e69['sendStatus'](0x194);}return _0x2589b6;};}function handleError(_0x195f6e,_0xd88cce){_0xd88cce=_0xd88cce||0x1f4;return function(_0x2881e4){logger['error'](_0x2881e4['stack']);if(_0x2881e4['name']){delete _0x2881e4[_0x4c66('0x24')];}_0x195f6e[_0x4c66('0x1a')](_0xd88cce)[_0x4c66('0x25')](_0x2881e4);};}exports['index']=function(_0x2cfc9f,_0xb9d88a){var _0x5921a7={},_0xa04f8b={},_0x176e95={'count':0x0,'rows':[]};var _0x14c1d3=_[_0x4c66('0x26')](db[_0x4c66('0x27')][_0x4c66('0x28')],function(_0x1f0d96){return{'name':_0x1f0d96[_0x4c66('0x29')],'type':_0x1f0d96[_0x4c66('0x2a')]['key']};});_0xa04f8b[_0x4c66('0x2b')]=_[_0x4c66('0x26')](_0x14c1d3,_0x4c66('0x24'));_0xa04f8b['query']=_[_0x4c66('0x2c')](_0x2cfc9f[_0x4c66('0x2d')]);_0xa04f8b[_0x4c66('0x2e')]=_[_0x4c66('0x2f')](_0xa04f8b[_0x4c66('0x2b')],_0xa04f8b['query']);_0x5921a7['attributes']=_[_0x4c66('0x2f')](_0xa04f8b[_0x4c66('0x2b')],qs[_0x4c66('0x30')](_0x2cfc9f['query'][_0x4c66('0x30')]));_0x5921a7['attributes']=_0x5921a7[_0x4c66('0x31')]['length']?_0x5921a7[_0x4c66('0x31')]:_0xa04f8b[_0x4c66('0x2b')];if(!_0x2cfc9f[_0x4c66('0x2d')][_0x4c66('0x32')](_0x4c66('0x33'))){_0x5921a7[_0x4c66('0x1f')]=qs[_0x4c66('0x1f')](_0x2cfc9f[_0x4c66('0x2d')][_0x4c66('0x1f')]);_0x5921a7[_0x4c66('0x1e')]=qs[_0x4c66('0x1e')](_0x2cfc9f[_0x4c66('0x2d')]['offset']);}_0x5921a7['order']=qs[_0x4c66('0x34')](_0x2cfc9f['query'][_0x4c66('0x34')]);_0x5921a7[_0x4c66('0x35')]=qs[_0x4c66('0x2e')](_[_0x4c66('0x36')](_0x2cfc9f['query'],_0xa04f8b[_0x4c66('0x2e')]),_0x14c1d3);if(_0x2cfc9f[_0x4c66('0x2d')][_0x4c66('0x37')]){_0x5921a7[_0x4c66('0x35')]=_[_0x4c66('0x38')](_0x5921a7[_0x4c66('0x35')],{'$or':_['map'](_0x14c1d3,function(_0x50a48e){if(_0x50a48e['type']!==_0x4c66('0x39')){var _0x5d3aba={};_0x5d3aba[_0x50a48e[_0x4c66('0x24')]]={'$like':'%'+_0x2cfc9f['query'][_0x4c66('0x37')]+'%'};return _0x5d3aba;}})});}_0x5921a7=_['merge']({},_0x5921a7,_0x2cfc9f[_0x4c66('0x3a')]);var _0x20ff63={'where':_0x5921a7[_0x4c66('0x35')]};return db['SmsApplication'][_0x4c66('0x1d')](_0x20ff63)[_0x4c66('0x22')](function(_0x4842ef){_0x176e95[_0x4c66('0x1d')]=_0x4842ef;if(_0x2cfc9f[_0x4c66('0x2d')][_0x4c66('0x3b')]){_0x5921a7['include']=[{'all':!![]}];}return db[_0x4c66('0x27')][_0x4c66('0x3c')](_0x5921a7);})['then'](function(_0x3fd1df){_0x176e95['rows']=_0x3fd1df;return _0x176e95;})[_0x4c66('0x22')](respondWithFilteredResult(_0xb9d88a,_0x5921a7))[_0x4c66('0x3d')](handleError(_0xb9d88a,null));};exports[_0x4c66('0x3e')]=function(_0x5ee046,_0xc7a687){var _0x426ed0={'raw':!![],'where':{'id':_0x5ee046['params']['id']}},_0x5233e2={};_0x5233e2[_0x4c66('0x2b')]=_[_0x4c66('0x2c')](db[_0x4c66('0x27')][_0x4c66('0x28')]);_0x5233e2['query']=_['keys'](_0x5ee046[_0x4c66('0x2d')]);_0x5233e2['filtears']=_['intersection'](_0x5233e2['model'],_0x5233e2[_0x4c66('0x2d')]);_0x426ed0[_0x4c66('0x31')]=_[_0x4c66('0x2f')](_0x5233e2[_0x4c66('0x2b')],qs[_0x4c66('0x30')](_0x5ee046[_0x4c66('0x2d')][_0x4c66('0x30')]));_0x426ed0[_0x4c66('0x31')]=_0x426ed0[_0x4c66('0x31')][_0x4c66('0x3f')]?_0x426ed0[_0x4c66('0x31')]:_0x5233e2['model'];if(_0x5ee046[_0x4c66('0x2d')][_0x4c66('0x3b')]){_0x426ed0[_0x4c66('0x40')]=[{'all':!![]}];}_0x426ed0=_['merge']({},_0x426ed0,_0x5ee046['options']);return db[_0x4c66('0x27')][_0x4c66('0x41')](_0x426ed0)['then'](handleEntityNotFound(_0xc7a687,null))[_0x4c66('0x22')](respondWithResult(_0xc7a687,null))[_0x4c66('0x3d')](handleError(_0xc7a687,null));};exports[_0x4c66('0x42')]=function(_0x520157,_0x2fffb2){return db['SmsApplication'][_0x4c66('0x42')](_0x520157[_0x4c66('0x43')],{})[_0x4c66('0x22')](respondWithResult(_0x2fffb2,0xc9))[_0x4c66('0x3d')](handleError(_0x2fffb2,null));};exports[_0x4c66('0x44')]=function(_0x3b3573,_0x2a5d16){if(_0x3b3573[_0x4c66('0x43')]['id']){delete _0x3b3573[_0x4c66('0x43')]['id'];}return db[_0x4c66('0x27')][_0x4c66('0x41')]({'where':{'id':_0x3b3573[_0x4c66('0x45')]['id']}})[_0x4c66('0x22')](handleEntityNotFound(_0x2a5d16,null))['then'](saveUpdates(_0x3b3573[_0x4c66('0x43')],null))['then'](respondWithResult(_0x2a5d16,null))[_0x4c66('0x3d')](handleError(_0x2a5d16,null));};exports[_0x4c66('0x23')]=function(_0x2444f,_0x33ff7b){return db[_0x4c66('0x27')]['find']({'where':{'id':_0x2444f['params']['id']}})[_0x4c66('0x22')](handleEntityNotFound(_0x33ff7b,null))[_0x4c66('0x22')](removeEntity(_0x33ff7b,null))[_0x4c66('0x3d')](handleError(_0x33ff7b,null));}; \ No newline at end of file +var _0x6a95=['model','attributes','fields','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','count','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsApplication','key','query','keys','filters','intersection'];(function(_0x40eb63,_0x202350){var _0x370c82=function(_0x3a54c6){while(--_0x3a54c6){_0x40eb63['push'](_0x40eb63['shift']());}};_0x370c82(++_0x202350);}(_0x6a95,0x1db));var _0x56a9=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x6a95[_0x1d9aa0];return _0x226868;};'use strict';var pdf=require(_0x56a9('0x0'));var emlformat=require(_0x56a9('0x1'));var rimraf=require(_0x56a9('0x2'));var zipdir=require(_0x56a9('0x3'));var jsonpatch=require(_0x56a9('0x4'));var rp=require(_0x56a9('0x5'));var moment=require(_0x56a9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x56a9('0x7'));var path=require(_0x56a9('0x8'));var sox=require(_0x56a9('0x9'));var csv=require(_0x56a9('0xa'));var ejs=require(_0x56a9('0xb'));var fs=require('fs');var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0xa'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=_0x42007b['count'],_0x5b2637=_0x2a0714['offset'],_0x414cb5=_0x2a0714[_0x56a9('0x1c')]+_0x2a0714[_0x56a9('0x1d')],_0x4853a3;if(_0x414cb5>=_0x46f854){_0x414cb5=_0x46f854;_0x4853a3=0xc8;}else{_0x4853a3=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0x4853a3);return _0x2e0dfd[_0x56a9('0x1e')](_0x56a9('0x1f'),_0x5b2637+'-'+_0x414cb5+'/'+_0x46f854)[_0x56a9('0x20')](_0x42007b);}return null;};}function patchUpdates(_0x4586e5){return function(_0xbfeb1a){try{jsonpatch[_0x56a9('0x21')](_0xbfeb1a,_0x4586e5,!![]);}catch(_0x335cc3){return BPromise[_0x56a9('0x22')](_0x335cc3);}return _0xbfeb1a[_0x56a9('0x23')]();};}function saveUpdates(_0x5f145f,_0x5bc03a){return function(_0x3a2e5e){if(_0x3a2e5e){return _0x3a2e5e[_0x56a9('0x24')](_0x5f145f)[_0x56a9('0x25')](function(_0x13c118){return _0x13c118;});}return null;};}function removeEntity(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')]()[_0x56a9('0x25')](function(){_0x4a09e5['status'](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x32839b,_0x21ab38){return function(_0xd029f7){if(!_0xd029f7){_0x32839b[_0x56a9('0x19')](0x194);}return _0xd029f7;};}function handleError(_0x52016c,_0x2c7211){_0x2c7211=_0x2c7211||0x1f4;return function(_0x217bda){logger[_0x56a9('0x27')](_0x217bda['stack']);if(_0x217bda[_0x56a9('0x28')]){delete _0x217bda['name'];}_0x52016c[_0x56a9('0x1a')](_0x2c7211)[_0x56a9('0x29')](_0x217bda);};}exports[_0x56a9('0x2a')]=function(_0x20432a,_0x45f38c){var _0x1afe8a={},_0x1133e6={},_0xff5f55={'count':0x0,'rows':[]};var _0x51fd64=_[_0x56a9('0x2b')](db[_0x56a9('0x2c')]['rawAttributes'],function(_0x4441ce){return{'name':_0x4441ce['fieldName'],'type':_0x4441ce['type'][_0x56a9('0x2d')]};});_0x1133e6['model']=_[_0x56a9('0x2b')](_0x51fd64,_0x56a9('0x28'));_0x1133e6[_0x56a9('0x2e')]=_[_0x56a9('0x2f')](_0x20432a['query']);_0x1133e6[_0x56a9('0x30')]=_[_0x56a9('0x31')](_0x1133e6[_0x56a9('0x32')],_0x1133e6[_0x56a9('0x2e')]);_0x1afe8a[_0x56a9('0x33')]=_[_0x56a9('0x31')](_0x1133e6[_0x56a9('0x32')],qs[_0x56a9('0x34')](_0x20432a[_0x56a9('0x2e')][_0x56a9('0x34')]));_0x1afe8a[_0x56a9('0x33')]=_0x1afe8a[_0x56a9('0x33')]['length']?_0x1afe8a[_0x56a9('0x33')]:_0x1133e6[_0x56a9('0x32')];if(!_0x20432a[_0x56a9('0x2e')]['hasOwnProperty'](_0x56a9('0x35'))){_0x1afe8a['limit']=qs['limit'](_0x20432a['query'][_0x56a9('0x1d')]);_0x1afe8a[_0x56a9('0x1c')]=qs['offset'](_0x20432a['query'][_0x56a9('0x1c')]);}_0x1afe8a[_0x56a9('0x36')]=qs[_0x56a9('0x37')](_0x20432a[_0x56a9('0x2e')][_0x56a9('0x37')]);_0x1afe8a[_0x56a9('0x38')]=qs[_0x56a9('0x30')](_[_0x56a9('0x39')](_0x20432a[_0x56a9('0x2e')],_0x1133e6[_0x56a9('0x30')]),_0x51fd64);if(_0x20432a['query']['filter']){_0x1afe8a['where']=_['merge'](_0x1afe8a[_0x56a9('0x38')],{'$or':_[_0x56a9('0x2b')](_0x51fd64,function(_0x55b295){if(_0x55b295[_0x56a9('0x3a')]!==_0x56a9('0x3b')){var _0x2a0627={};_0x2a0627[_0x55b295[_0x56a9('0x28')]]={'$like':'%'+_0x20432a[_0x56a9('0x2e')][_0x56a9('0x3c')]+'%'};return _0x2a0627;}})});}_0x1afe8a=_[_0x56a9('0x3d')]({},_0x1afe8a,_0x20432a['options']);var _0x4630c7={'where':_0x1afe8a[_0x56a9('0x38')]};return db['SmsApplication']['count'](_0x4630c7)[_0x56a9('0x25')](function(_0x1180c6){_0xff5f55[_0x56a9('0x3e')]=_0x1180c6;if(_0x20432a[_0x56a9('0x2e')][_0x56a9('0x3f')]){_0x1afe8a[_0x56a9('0x40')]=[{'all':!![]}];}return db[_0x56a9('0x2c')][_0x56a9('0x41')](_0x1afe8a);})[_0x56a9('0x25')](function(_0x24a7e3){_0xff5f55[_0x56a9('0x42')]=_0x24a7e3;return _0xff5f55;})[_0x56a9('0x25')](respondWithFilteredResult(_0x45f38c,_0x1afe8a))[_0x56a9('0x43')](handleError(_0x45f38c,null));};exports[_0x56a9('0x44')]=function(_0xff846,_0xe57cfb){var _0x33a020={'raw':!![],'where':{'id':_0xff846['params']['id']}},_0x261e1e={};_0x261e1e[_0x56a9('0x32')]=_[_0x56a9('0x2f')](db[_0x56a9('0x2c')]['rawAttributes']);_0x261e1e[_0x56a9('0x2e')]=_['keys'](_0xff846[_0x56a9('0x2e')]);_0x261e1e['filtears']=_[_0x56a9('0x31')](_0x261e1e[_0x56a9('0x32')],_0x261e1e[_0x56a9('0x2e')]);_0x33a020[_0x56a9('0x33')]=_['intersection'](_0x261e1e['model'],qs['fields'](_0xff846[_0x56a9('0x2e')][_0x56a9('0x34')]));_0x33a020[_0x56a9('0x33')]=_0x33a020[_0x56a9('0x33')][_0x56a9('0x45')]?_0x33a020[_0x56a9('0x33')]:_0x261e1e[_0x56a9('0x32')];if(_0xff846[_0x56a9('0x2e')][_0x56a9('0x3f')]){_0x33a020[_0x56a9('0x40')]=[{'all':!![]}];}_0x33a020=_[_0x56a9('0x3d')]({},_0x33a020,_0xff846[_0x56a9('0x46')]);return db[_0x56a9('0x2c')][_0x56a9('0x47')](_0x33a020)['then'](handleEntityNotFound(_0xe57cfb,null))[_0x56a9('0x25')](respondWithResult(_0xe57cfb,null))[_0x56a9('0x43')](handleError(_0xe57cfb,null));};exports[_0x56a9('0x48')]=function(_0x5dd24d,_0x468ab5){return db[_0x56a9('0x2c')]['create'](_0x5dd24d[_0x56a9('0x49')],{})[_0x56a9('0x25')](respondWithResult(_0x468ab5,0xc9))[_0x56a9('0x43')](handleError(_0x468ab5,null));};exports[_0x56a9('0x24')]=function(_0x5bd85a,_0x3dc0df){if(_0x5bd85a[_0x56a9('0x49')]['id']){delete _0x5bd85a[_0x56a9('0x49')]['id'];}return db[_0x56a9('0x2c')][_0x56a9('0x47')]({'where':{'id':_0x5bd85a[_0x56a9('0x4a')]['id']}})[_0x56a9('0x25')](handleEntityNotFound(_0x3dc0df,null))[_0x56a9('0x25')](saveUpdates(_0x5bd85a[_0x56a9('0x49')],null))[_0x56a9('0x25')](respondWithResult(_0x3dc0df,null))[_0x56a9('0x43')](handleError(_0x3dc0df,null));};exports['destroy']=function(_0x58d370,_0x46aa63){return db[_0x56a9('0x2c')][_0x56a9('0x47')]({'where':{'id':_0x58d370[_0x56a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46aa63,null))[_0x56a9('0x25')](removeEntity(_0x46aa63,null))[_0x56a9('0x43')](handleError(_0x46aa63,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 348c570..a09f8ce 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 _0x3edd=['SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define'];(function(_0x2a3d0e,_0x495ec7){var _0x237308=function(_0x4f57a2){while(--_0x4f57a2){_0x2a3d0e['push'](_0x2a3d0e['shift']());}};_0x237308(++_0x495ec7);}(_0x3edd,0x6d));var _0xd3ed=function(_0x30f664,_0x13a8c8){_0x30f664=_0x30f664-0x0;var _0x1358b1=_0x3edd[_0x30f664];return _0x1358b1;};'use strict';var _=require(_0xd3ed('0x0'));var util=require(_0xd3ed('0x1'));var logger=require('../../config/logger')(_0xd3ed('0x2'));var moment=require(_0xd3ed('0x3'));var BPromise=require(_0xd3ed('0x4'));var rp=require(_0xd3ed('0x5'));var fs=require('fs');var path=require(_0xd3ed('0x6'));var rimraf=require(_0xd3ed('0x7'));var config=require(_0xd3ed('0x8'));var attributes=require(_0xd3ed('0x9'));module['exports']=function(_0x47df69,_0x4b4d4f){return _0x47df69[_0xd3ed('0xa')](_0xd3ed('0xb'),attributes,{'tableName':_0xd3ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd3ed('0xd'),'collate':_0xd3ed('0xe')});}; \ No newline at end of file +var _0x8f52=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x50cc02,_0x2ecdc2){var _0x34dc25=function(_0x2796ca){while(--_0x2796ca){_0x50cc02['push'](_0x50cc02['shift']());}};_0x34dc25(++_0x2ecdc2);}(_0x8f52,0x193));var _0x28f5=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x8f52[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0x28f5('0x0'));var util=require(_0x28f5('0x1'));var logger=require(_0x28f5('0x2'))(_0x28f5('0x3'));var moment=require(_0x28f5('0x4'));var BPromise=require(_0x28f5('0x5'));var rp=require(_0x28f5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x28f5('0x7'));var attributes=require(_0x28f5('0x8'));module[_0x28f5('0x9')]=function(_0x51cac9,_0x3164a0){return _0x51cac9[_0x28f5('0xa')](_0x28f5('0xb'),attributes,{'tableName':_0x28f5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28f5('0xd'),'collate':_0x28f5('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f74b842..a19ac2a 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 _0x79d3=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','SmsApplication,\x20%s,\x20%s','info','result','catch','lodash'];(function(_0xa522f,_0x5debbc){var _0x2083b0=function(_0x288f01){while(--_0x288f01){_0xa522f['push'](_0xa522f['shift']());}};_0x2083b0(++_0x5debbc);}(_0x79d3,0x15f));var _0x379d=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x79d3[_0xd3b0ac];return _0x3d773e;};'use strict';var _=require(_0x379d('0x0'));var util=require('util');var moment=require(_0x379d('0x1'));var BPromise=require('bluebird');var rs=require(_0x379d('0x2'));var fs=require('fs');var Redis=require(_0x379d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x379d('0x4'));var logger=require(_0x379d('0x5'))(_0x379d('0x6'));var config=require(_0x379d('0x7'));var jayson=require(_0x379d('0x8'));var client=jayson[_0x379d('0x9')][_0x379d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d1b1e,_0x1d344d,_0x4ecccf){return new BPromise(function(_0x3e6051,_0x49bfeb){return client[_0x379d('0xb')](_0x5d1b1e,_0x4ecccf)['then'](function(_0x11b47b){logger['info']('SmsApplication,\x20%s,\x20%s',_0x1d344d,'request\x20sent');logger[_0x379d('0xc')](_0x379d('0xd'),_0x1d344d,_0x379d('0xe'),JSON['stringify'](_0x11b47b));if(_0x11b47b[_0x379d('0xf')]){if(_0x11b47b[_0x379d('0xf')][_0x379d('0x10')]===0x1f4){logger[_0x379d('0xf')]('SmsApplication,\x20%s,\x20%s',_0x1d344d,_0x11b47b[_0x379d('0xf')][_0x379d('0x11')]);return _0x49bfeb(_0x11b47b[_0x379d('0xf')][_0x379d('0x11')]);}logger[_0x379d('0xf')](_0x379d('0x12'),_0x1d344d,_0x11b47b['error']['message']);return _0x3e6051(_0x11b47b[_0x379d('0xf')]['message']);}else{logger[_0x379d('0x13')](_0x379d('0x12'),_0x1d344d,_0x379d('0xe'));_0x3e6051(_0x11b47b[_0x379d('0x14')]['message']);}})[_0x379d('0x15')](function(_0x5785b5){logger['error']('SmsApplication,\x20%s,\x20%s',_0x1d344d,_0x5785b5);_0x49bfeb(_0x5785b5);});});} \ No newline at end of file +var _0x4300=['stringify','error','code','message','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x40c515,_0x3d3d99){var _0x1c80de=function(_0x3983c0){while(--_0x3983c0){_0x40c515['push'](_0x40c515['shift']());}};_0x1c80de(++_0x3d3d99);}(_0x4300,0x1a6));var _0x0430=function(_0x1b8b07,_0x142670){_0x1b8b07=_0x1b8b07-0x0;var _0x31767d=_0x4300[_0x1b8b07];return _0x31767d;};'use strict';var _=require(_0x0430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0430('0x1'));var db=require(_0x0430('0x2'))['db'];var utils=require(_0x0430('0x3'));var logger=require(_0x0430('0x4'))(_0x0430('0x5'));var config=require('../../config/environment');var jayson=require(_0x0430('0x6'));var client=jayson['client'][_0x0430('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5b03ef,_0x2388b9,_0xc83312){return new BPromise(function(_0x408b14,_0x31964e){return client[_0x0430('0x8')](_0x5b03ef,_0xc83312)[_0x0430('0x9')](function(_0x3a9dc1){logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,'request\x20sent');logger[_0x0430('0xc')](_0x0430('0xd'),_0x2388b9,_0x0430('0xe'),JSON[_0x0430('0xf')](_0x3a9dc1));if(_0x3a9dc1[_0x0430('0x10')]){if(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x11')]===0x1f4){logger[_0x0430('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2388b9,_0x3a9dc1['error'][_0x0430('0x12')]);return _0x31964e(_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);}logger[_0x0430('0x10')](_0x0430('0xb'),_0x2388b9,_0x3a9dc1[_0x0430('0x10')][_0x0430('0x12')]);return _0x408b14(_0x3a9dc1['error'][_0x0430('0x12')]);}else{logger[_0x0430('0xa')](_0x0430('0xb'),_0x2388b9,_0x0430('0xe'));_0x408b14(_0x3a9dc1['result']['message']);}})['catch'](function(_0x54fbf8){logger['error']('SmsApplication,\x20%s,\x20%s',_0x2388b9,_0x54fbf8);_0x31964e(_0x54fbf8);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4a6b3da..c6ea9b4 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 _0x145a=['show','/:id/messages','download','post','addMessage','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x1f2128,_0x1c0556){var _0xdca632=function(_0x446359){while(--_0x446359){_0x1f2128['push'](_0x1f2128['shift']());}};_0xdca632(++_0x1c0556);}(_0x145a,0x100));var _0xa145=function(_0x4d7eca,_0xde4941){_0x4d7eca=_0x4d7eca-0x0;var _0xfa53ca=_0x145a[_0x4d7eca];return _0xfa53ca;};'use strict';var multer=require(_0xa145('0x0'));var util=require(_0xa145('0x1'));var path=require(_0xa145('0x2'));var timeout=require(_0xa145('0x3'));var express=require(_0xa145('0x4'));var router=express['Router']();var auth=require(_0xa145('0x5'));var interaction=require(_0xa145('0x6'));var config=require(_0xa145('0x7'));var controller=require(_0xa145('0x8'));router[_0xa145('0x9')]('/',auth[_0xa145('0xa')](),controller[_0xa145('0xb')]);router[_0xa145('0x9')]('/describe',auth[_0xa145('0xa')](),controller[_0xa145('0xc')]);router[_0xa145('0x9')](_0xa145('0xd'),auth[_0xa145('0xa')](),controller[_0xa145('0xe')]);router[_0xa145('0x9')](_0xa145('0xf'),auth[_0xa145('0xa')](),controller['getMessages']);router['get']('/:id/download',auth[_0xa145('0xa')](),controller[_0xa145('0x10')]);router[_0xa145('0x11')]('/',auth[_0xa145('0xa')](),controller['create']);router['post'](_0xa145('0xf'),auth[_0xa145('0xa')](),controller[_0xa145('0x12')]);router[_0xa145('0x11')]('/:id/tags',auth[_0xa145('0xa')](),interaction[_0xa145('0x13')](_0xa145('0x14'),_0xa145('0x15')),controller[_0xa145('0x16')]);router['put'](_0xa145('0xd'),auth['isAuthenticated'](),interaction[_0xa145('0x13')](_0xa145('0x14'),_0xa145('0x17')),controller['update']);router[_0xa145('0x18')]('/:id',auth[_0xa145('0xa')](),interaction[_0xa145('0x13')](_0xa145('0x14'),_0xa145('0x19')),controller[_0xa145('0x1a')]);router[_0xa145('0x18')](_0xa145('0x1b'),auth[_0xa145('0xa')](),controller[_0xa145('0x1c')]);module[_0xa145('0x1d')]=router; \ No newline at end of file +var _0xbc6b=['tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc6b,0x14b));var _0xbbc6=function(_0x4e697a,_0x56a14b){_0x4e697a=_0x4e697a-0x0;var _0x88850c=_0xbc6b[_0x4e697a];return _0x88850c;};'use strict';var multer=require(_0xbbc6('0x0'));var util=require(_0xbbc6('0x1'));var path=require(_0xbbc6('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbc6('0x3'));var router=express[_0xbbc6('0x4')]();var auth=require(_0xbbc6('0x5'));var interaction=require(_0xbbc6('0x6'));var config=require('../../config/environment');var controller=require(_0xbbc6('0x7'));router[_0xbbc6('0x8')]('/',auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xa')]);router[_0xbbc6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xbbc6('0xb')]);router[_0xbbc6('0x8')](_0xbbc6('0xc'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xd')]);router['get']('/:id/messages',auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xe')]);router[_0xbbc6('0x8')]('/:id/download',auth[_0xbbc6('0x9')](),controller[_0xbbc6('0xf')]);router[_0xbbc6('0x10')]('/',auth[_0xbbc6('0x9')](),controller[_0xbbc6('0x11')]);router[_0xbbc6('0x10')](_0xbbc6('0x12'),auth[_0xbbc6('0x9')](),controller[_0xbbc6('0x13')]);router[_0xbbc6('0x10')](_0xbbc6('0x14'),auth[_0xbbc6('0x9')](),interaction[_0xbbc6('0x15')](_0xbbc6('0x16'),_0xbbc6('0x17')),controller[_0xbbc6('0x18')]);router[_0xbbc6('0x19')]('/:id',auth[_0xbbc6('0x9')](),interaction[_0xbbc6('0x15')]('sms',_0xbbc6('0x1a')),controller[_0xbbc6('0x1b')]);router['delete'](_0xbbc6('0xc'),auth['isAuthenticated'](),interaction[_0xbbc6('0x15')](_0xbbc6('0x16'),_0xbbc6('0x1c')),controller[_0xbbc6('0x1d')]);router[_0xbbc6('0x1e')](_0xbbc6('0x14'),auth['isAuthenticated'](),controller['removeTags']);module[_0xbbc6('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 7fa6dbe..6ef1f85 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 _0xf1a0=['out','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x337537,_0x4ea7b8){var _0x4fdd67=function(_0x59ad18){while(--_0x59ad18){_0x337537['push'](_0x337537['shift']());}};_0x4fdd67(++_0x4ea7b8);}(_0xf1a0,0x6a));var _0x0f1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf1a0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0f1a('0x0'));module[_0x0f1a('0x1')]={'closed':{'type':Sequelize[_0x0f1a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0f1a('0x3')]},'disposition':{'type':Sequelize[_0x0f1a('0x4')]},'secondDisposition':{'type':Sequelize[_0x0f1a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0f1a('0x4')]},'note':{'type':Sequelize[_0x0f1a('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x0f1a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0f1a('0x5')]('in',_0x0f1a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0f1a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0f1a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc56b=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x1a8adf,_0x54dbf5){var _0x4fc4b5=function(_0x5cc6e4){while(--_0x5cc6e4){_0x1a8adf['push'](_0x1a8adf['shift']());}};_0x4fc4b5(++_0x54dbf5);}(_0xc56b,0x16c));var _0xbc56=function(_0x219a85,_0x22ca6e){_0x219a85=_0x219a85-0x0;var _0x5ef5aa=_0xc56b[_0x219a85];return _0x5ef5aa;};'use strict';var Sequelize=require(_0xbc56('0x0'));var moment=require(_0xbc56('0x1'));module[_0xbc56('0x2')]={'closed':{'type':Sequelize[_0xbc56('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbc56('0x4')]},'disposition':{'type':Sequelize[_0xbc56('0x5')]},'secondDisposition':{'type':Sequelize[_0xbc56('0x5')]},'thirdDisposition':{'type':Sequelize[_0xbc56('0x5')]},'note':{'type':Sequelize[_0xbc56('0x5')]},'phone':{'type':Sequelize[_0xbc56('0x5')]},'read1stAt':{'type':Sequelize[_0xbc56('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xbc56('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xbc56('0x6')]('in',_0xbc56('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 00ecd5d..98d13f9 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 _0xd785=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','order','DESC','resolve','journey','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','show','params','rawAttributes','filtears','includeAll','include','options','create','destroy','describe','addMessage','SmsMessage','ids','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Account','Owner','get','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','%s\x20#%d','Sms','YYYY-MM-DD','closedAt','disposition','Messages','out','firstName','secret','views','downloadInteraction.html','transcript-','.pdf','unlinkSync','fast-json-patch','moment','bluebird','util','to-csv','ejs','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','count','limit','set','reject','save','update','then','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','sms_interactions','users','o.id\x20=\x20i.UserId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','$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','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','body','start','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x472fd8,_0x3dacd8){var _0x4c2e7f=function(_0x5c74f3){while(--_0x5c74f3){_0x472fd8['push'](_0x472fd8['shift']());}};_0x4c2e7f(++_0x3dacd8);}(_0xd785,0x143));var _0x5d78=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xd785[_0xa990b7];return _0x52c99c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5d78('0x0'));var rp=require('request-promise');var moment=require(_0x5d78('0x1'));var BPromise=require(_0x5d78('0x2'));var Mustache=require('mustache');var util=require(_0x5d78('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x5d78('0x4'));var ejs=require(_0x5d78('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5d78('0x6'));var toCsv=require('to-csv');var querystring=require(_0x5d78('0x7'));var Papa=require('papaparse');var Redis=require(_0x5d78('0x8'));var authService=require(_0x5d78('0x9'));var qs=require(_0x5d78('0xa'));var as=require(_0x5d78('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d78('0xc'))(_0x5d78('0xd'));var utils=require(_0x5d78('0xe'));var config=require(_0x5d78('0xf'));var licenseUtil=require(_0x5d78('0x10'));var db=require('../../mysqldb')['db'];config[_0x5d78('0x11')]=_[_0x5d78('0x12')](config[_0x5d78('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0x5d78('0x13'))(new Redis(config[_0x5d78('0x11')]));require(_0x5d78('0x14'))['register'](socket);function respondWithStatusCode(_0x2fb333,_0xe2780c){_0xe2780c=_0xe2780c||0xcc;return function(_0xd54117){if(_0xd54117){return _0x2fb333[_0x5d78('0x15')](_0xe2780c);}return _0x2fb333[_0x5d78('0x16')](_0xe2780c)['end']();};}function respondWithResult(_0x2077df,_0xbbb74){_0xbbb74=_0xbbb74||0xc8;return function(_0x2aa0d0){if(_0x2aa0d0){return _0x2077df[_0x5d78('0x16')](_0xbbb74)[_0x5d78('0x17')](_0x2aa0d0);}};}function respondWithFilteredResult(_0x4da731,_0x15524b){return function(_0x335f13){if(_0x335f13){var _0x23ac51=_0x335f13[_0x5d78('0x18')],_0x4b4f95=_0x15524b['offset'],_0x43da74=_0x15524b['offset']+_0x15524b[_0x5d78('0x19')],_0xaa9a4e;if(_0x43da74>=_0x23ac51){_0x43da74=_0x23ac51;_0xaa9a4e=0xc8;}else{_0xaa9a4e=0xce;}_0x4da731[_0x5d78('0x16')](_0xaa9a4e);return _0x4da731[_0x5d78('0x1a')]('Content-Range',_0x4b4f95+'-'+_0x43da74+'/'+_0x23ac51)[_0x5d78('0x17')](_0x335f13);}return null;};}function patchUpdates(_0x441d0e){return function(_0x37ea96){try{jsonpatch['apply'](_0x37ea96,_0x441d0e,!![]);}catch(_0x460aa4){return BPromise[_0x5d78('0x1b')](_0x460aa4);}return _0x37ea96[_0x5d78('0x1c')]();};}function saveUpdates(_0x3b6296,_0x4b70a3){return function(_0x13642f){if(_0x13642f){return _0x13642f[_0x5d78('0x1d')](_0x3b6296)[_0x5d78('0x1e')](function(_0x4cb248){return _0x4cb248;});}return null;};}function removeEntity(_0x1aaf20,_0x1b90b6){return function(_0x4459c1){if(_0x4459c1){return _0x4459c1['destroy']()[_0x5d78('0x1e')](function(){_0x1aaf20[_0x5d78('0x16')](0xcc)[_0x5d78('0x1f')]();});}};}function handleEntityNotFound(_0x2ed0f2,_0x5df0ce){return function(_0x55ef2c){if(!_0x55ef2c){_0x2ed0f2[_0x5d78('0x15')](0x194);}return _0x55ef2c;};}function handleError(_0xd11d42,_0xf07978){_0xf07978=_0xf07978||0x1f4;return function(_0x44aae1){logger[_0x5d78('0x20')](_0x44aae1[_0x5d78('0x21')]);if(_0x44aae1[_0x5d78('0x22')]){delete _0x44aae1[_0x5d78('0x22')];}_0xd11d42[_0x5d78('0x16')](_0xf07978)['send'](_0x44aae1);};}function getInteractionUsers(_0x4879b8,_0x1f37d7){return new BPromise(function(_0x59c991,_0x3afefe){try{if(_0x1f37d7[_0x4879b8['id']]){_0x4879b8[_0x5d78('0x23')]=_[_0x5d78('0x24')](_0x1f37d7[_0x4879b8['id']],function(_0x3dcb70){return{'id':_0x3dcb70['id'],'fullname':_0x3dcb70[_0x5d78('0x25')]};});}}catch(_0x2c9f5a){_0x3afefe(_0x2c9f5a);}_0x59c991(_0x4879b8);});}function getInteractionTags(_0x361e65,_0x5ec173){return new BPromise(function(_0x71f45a,_0x296480){try{if(_0x361e65[_0x5d78('0x26')]){_0x361e65[_0x5d78('0x27')]=[];_0x361e65[_0x5d78('0x26')][_0x5d78('0x28')](',')['forEach'](function(_0x457d37){_0x361e65[_0x5d78('0x27')][_0x5d78('0x29')](_0x5ec173[_0x457d37]);});}delete _0x361e65['TagIds'];}catch(_0x4b81d7){_0x296480(_0x4b81d7);}_0x71f45a(_0x361e65);});}function updateSmsInteraction(_0xefcbc2,_0x43b30d,_0x258572){return new BPromise(function(_0x165e3b,_0x583e7a){return getInteractionUsers(_0xefcbc2,_0x258572)[_0x5d78('0x1e')](function(_0x47c75e){return getInteractionTags(_0x47c75e,_0x43b30d);})['then'](function(_0x113069){_0x165e3b(_0x113069);})[_0x5d78('0x2a')](function(_0x59225a){_0x583e7a(_0x59225a);});});}exports[_0x5d78('0x2b')]=function(_0x52811f,_0x325105){var _0x30d9ac={},_0x328a04={},_0x1e4928={'count':0x0,'rows':[]};var _0x35e459=_[_0x5d78('0x24')](db['SmsInteraction']['rawAttributes'],function(_0x53397d){return{'name':_0x53397d[_0x5d78('0x2c')],'type':_0x53397d[_0x5d78('0x2d')][_0x5d78('0x2e')]};});_0x328a04['model']=_[_0x5d78('0x24')](_0x35e459,'name');_0x328a04[_0x5d78('0x2f')]=_[_0x5d78('0x30')](_0x52811f[_0x5d78('0x2f')]);_0x328a04[_0x5d78('0x31')]=_[_0x5d78('0x32')](_0x328a04[_0x5d78('0x33')],_0x328a04[_0x5d78('0x2f')]);_0x30d9ac[_0x5d78('0x34')]=_[_0x5d78('0x32')](_0x328a04['model'],qs[_0x5d78('0x35')](_0x52811f['query'][_0x5d78('0x35')]));_0x30d9ac[_0x5d78('0x34')]=_0x30d9ac['attributes'][_0x5d78('0x36')]?_0x30d9ac['attributes']:_0x328a04['model'];if(!_0x52811f[_0x5d78('0x2f')][_0x5d78('0x37')](_0x5d78('0x38'))){_0x30d9ac['limit']=qs['limit'](_0x52811f[_0x5d78('0x2f')][_0x5d78('0x19')]);_0x30d9ac[_0x5d78('0x39')]=qs['offset'](_0x52811f[_0x5d78('0x2f')]['offset']);}_0x30d9ac['order']=qs[_0x5d78('0x3a')](_0x52811f[_0x5d78('0x2f')][_0x5d78('0x3a')]);_0x30d9ac[_0x5d78('0x3b')]=qs['filters'](_[_0x5d78('0x3c')](_0x52811f[_0x5d78('0x2f')],_0x328a04[_0x5d78('0x31')]),_0x35e459);var _0x3d3ed2=[];var _0x45de32=squel[_0x5d78('0x3d')]()[_0x5d78('0x3e')]('id')['field'](_0x5d78('0x22'))['field'](_0x5d78('0x3f'))['from'](_0x5d78('0x40'));var _0x37aebc=squel[_0x5d78('0x3d')]()[_0x5d78('0x3e')](_0x5d78('0x41'))[_0x5d78('0x3e')](_0x5d78('0x42'))[_0x5d78('0x3e')](_0x5d78('0x43'))[_0x5d78('0x44')](_0x5d78('0x45'),'ui')[_0x5d78('0x46')]('users','u',_0x5d78('0x47'));var _0x15e61a=squel[_0x5d78('0x3d')]()[_0x5d78('0x44')](_0x5d78('0x48'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x5d78('0x49'),'o',_0x5d78('0x4a'))[_0x5d78('0x46')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x5d78('0x4b'),'me',_0x5d78('0x4c'))[_0x5d78('0x46')]('sms_interaction_has_tags','it',_0x5d78('0x4d'))[_0x5d78('0x46')](_0x5d78('0x40'),'t',_0x5d78('0x4e'));var _0x1e6bed=squel[_0x5d78('0x4f')]();var _0x3769ab=[];var _0x4594a4=squel['expr']();var _0x22fd44;if(_0x52811f[_0x5d78('0x2f')][_0x5d78('0x50')]){_0x22fd44=as[_0x5d78('0x51')](_0x52811f[_0x5d78('0x2f')][_0x5d78('0x50')]);var _0x3ebde4=_0x22fd44[_0x5d78('0x52')];for(var _0x35cc10=0x0;_0x35cc10<_0x22fd44[_0x5d78('0x53')]['length'];_0x35cc10++){var _0x1a30f5=_0x22fd44[_0x5d78('0x53')][_0x35cc10];var _0x318e67='i';var _0x1657b0=_[_0x5d78('0x54')](_0x35e459,['name',_0x1a30f5[_0x5d78('0x3e')]]);if(!_0x1657b0){switch(_0x1a30f5['field']){case _0x5d78('0x55'):if(_0x1a30f5[_0x5d78('0x56')]==0x1){_0x15e61a[_0x5d78('0x57')]('`'+_0x1a30f5[_0x5d78('0x3e')]+'`\x20=\x200');}else{_0x15e61a[_0x5d78('0x57')]('`'+_0x1a30f5[_0x5d78('0x3e')]+'`\x20>\x200');}break;case _0x5d78('0x58'):if(_0x1a30f5['operator']===_0x5d78('0x59')){if(_0x1a30f5['value'][_0x5d78('0x28')]('\x20')[_0x5d78('0x36')]>0x1){_0x1e6bed[_0x3ebde4](_0x5d78('0x5a'),qs['getFullTextValue'](_0x1a30f5[_0x5d78('0x56')]),null);}else{var _0x4832da='%'+_0x1a30f5[_0x5d78('0x56')]+'%';_0x1e6bed[_0x3ebde4](_0x5d78('0x5b'),_0x4832da,_0x4832da,_0x4832da);}}else{_0x1657b0=_[_0x5d78('0x54')](_0x35e459,[_0x5d78('0x22'),_0x5d78('0x5c')]);_0x1a30f5['field']=_0x5d78('0x5c');_0x32107e=as[_0x5d78('0x5d')](_0x318e67,_0x1657b0[_0x5d78('0x2d')],_0x1a30f5);_0x1e6bed[_0x3ebde4](_0x32107e[_0x5d78('0x5e')],_0x32107e[_0x5d78('0x56')]['start'],_0x32107e['value'][_0x5d78('0x1f')]);}break;case'Tag':var _0x7c3686=_0x1a30f5['value'][_0x5d78('0x28')](',')['map'](function(_0x3deee5){return Number(_0x3deee5);});_0x7c3686[_0x5d78('0x5f')](function(_0x5d0cb3){_0x4594a4['or'](_0x5d78('0x60'),'%,'+_0x5d0cb3+',%');});_0x3769ab=_['union'](_0x3769ab,_0x7c3686);break;case _0x5d78('0x61'):if(_0x1a30f5['operator']===_0x5d78('0x59')){_0x1e6bed[_0x3ebde4]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1a30f5[_0x5d78('0x56')]+'%',null);}else{_0x1657b0=_[_0x5d78('0x54')](_0x35e459,[_0x5d78('0x22'),_0x5d78('0x62')]);_0x1a30f5[_0x5d78('0x3e')]=_0x5d78('0x62');_0x32107e=as[_0x5d78('0x5d')](_0x318e67,_0x1657b0[_0x5d78('0x2d')],_0x1a30f5);_0x1e6bed[_0x3ebde4](_0x32107e[_0x5d78('0x5e')],_0x32107e[_0x5d78('0x56')]['start'],_0x32107e[_0x5d78('0x56')][_0x5d78('0x1f')]);}break;case _0x5d78('0x63'):_0x32107e=as[_0x5d78('0x5d')]('me',null,_0x1a30f5);_0x1e6bed[_0x3ebde4](_0x32107e[_0x5d78('0x5e')],_0x32107e[_0x5d78('0x56')][_0x5d78('0x64')],_0x32107e['value'][_0x5d78('0x1f')]);break;}}else{var _0x32107e=as[_0x5d78('0x5d')](_0x318e67,_0x1657b0['type'],_0x1a30f5);_0x1e6bed[_0x3ebde4](_0x32107e[_0x5d78('0x5e')],_0x32107e[_0x5d78('0x56')][_0x5d78('0x64')],_0x32107e[_0x5d78('0x56')][_0x5d78('0x1f')]);}}}else{var _0x30c5c7=_(_0x52811f[_0x5d78('0x2f')])[_0x5d78('0x30')]()[_0x5d78('0x24')](function(_0x3b1c6b){return _[_0x5d78('0x65')](_0x35e459,[_0x5d78('0x22'),_0x3b1c6b])?_0x3b1c6b:undefined;})[_0x5d78('0x66')]()[_0x5d78('0x56')]();if(!_[_0x5d78('0x67')](_0x30c5c7)){_0x30c5c7[_0x5d78('0x5f')](function(_0x54587a){if(_0x54587a==='SmsAccountId'){_0x15e61a[_0x5d78('0x3b')](_0x5d78('0x68'),[][_0x5d78('0x69')](_0x52811f[_0x5d78('0x2f')][_0x54587a]));}else if(_0x54587a===_0x5d78('0x6a')){var _0x46642c=JSON['parse'](_0x52811f[_0x5d78('0x2f')][_0x54587a])['$gte'];var _0x186c4e=JSON[_0x5d78('0x6b')](_0x52811f[_0x5d78('0x2f')][_0x54587a])[_0x5d78('0x6c')];_0x15e61a[_0x5d78('0x3b')](_0x5d78('0x6d'),_0x46642c,_0x186c4e);}else{if(_0x52811f[_0x5d78('0x2f')][_0x54587a]===_0x5d78('0x6e')){_0x15e61a[_0x5d78('0x3b')]('i.'+_0x54587a+_0x5d78('0x6f'));}else{_0x15e61a[_0x5d78('0x3b')]('i.'+_0x54587a+_0x5d78('0x70'),_0x52811f['query'][_0x54587a]);}}});}if(_0x52811f[_0x5d78('0x2f')][_0x5d78('0x71')]){if(_0x52811f['query'][_0x5d78('0x71')]==0x1){_0x15e61a[_0x5d78('0x57')]('`unreadMessages`\x20=\x200');}else{_0x15e61a[_0x5d78('0x57')](_0x5d78('0x72'));}}if(_0x52811f[_0x5d78('0x2f')][_0x5d78('0x73')]){_0x3769ab=_[_0x5d78('0x74')](_0x52811f[_0x5d78('0x2f')][_0x5d78('0x73')])?_0x52811f[_0x5d78('0x2f')]['tag']:new Array(_0x52811f[_0x5d78('0x2f')]['tag']);_0x3769ab[_0x5d78('0x5f')](function(_0x4ec136){_0x4594a4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ec136+',%');});}if(_0x52811f[_0x5d78('0x2f')][_0x5d78('0x75')]){var _0x359387=_0x52811f[_0x5d78('0x2f')][_0x5d78('0x75')][_0x5d78('0x76')]('\x5c','\x5c\x5c')[_0x5d78('0x76')]('\x27\x27',_0x5d78('0x77'));if(qs[_0x5d78('0x78')](_0x359387)){_0x1e6bed['or'](_0x5d78('0x79'),_0x359387+'%')['or'](_0x5d78('0x7a'),_0x359387+'%');}else{_0x1e6bed['or'](_0x5d78('0x7b'),qs['getFullTextValue'](_0x359387))['or'](_0x5d78('0x7c'),_0x359387+'%');}}}_0x15e61a['where'](_0x1e6bed);_0x15e61a[_0x5d78('0x7d')](_0x5d78('0x7e'));var _0x3574dc={'type':db[_0x5d78('0x7f')][_0x5d78('0x80')]['SELECT'],'raw':!![]};var _0x3184a5=_0x15e61a[_0x5d78('0x81')]();_0x3184a5[_0x5d78('0x3e')]('i.id');_0x3184a5[_0x5d78('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5d78('0x55'));if(_0x30d9ac[_0x5d78('0x82')]){_0x30d9ac[_0x5d78('0x82')][_0x5d78('0x5f')](function(_0x560ec6){_0x15e61a[_0x5d78('0x82')]('i.'+_0x560ec6[0x0],_0x560ec6[0x1]===_0x5d78('0x83')?![]:!![]);});}if(!_[_0x5d78('0x67')](_0x3769ab)){_0x15e61a['having'](_0x4594a4);_0x3184a5[_0x5d78('0x3b')]('t.id\x20IN\x20?',_0x3769ab);}BPromise[_0x5d78('0x84')]()[_0x5d78('0x1e')](function(){if(!_0x22fd44){if(_0x52811f['query']['SmsAccountId']||_0x52811f[_0x5d78('0x2f')][_0x5d78('0x85')])return;_0x3184a5[_0x5d78('0x3b')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x15e61a[_0x5d78('0x3b')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x52811f[_0x5d78('0x86')][_0x5d78('0x87')]({'attributes':['id'],'raw':!![]})['then'](function(_0xc09d7e){if(_['isEmpty'](_0xc09d7e)){_0x3184a5[_0x5d78('0x3b')](_0x5d78('0x88'));_0x15e61a[_0x5d78('0x3b')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x3184a5[_0x5d78('0x3b')](_0x5d78('0x68'),_[_0x5d78('0x24')](_0xc09d7e,'id'));_0x15e61a[_0x5d78('0x3b')](_0x5d78('0x68'),_[_0x5d78('0x24')](_0xc09d7e,'id'));}});})[_0x5d78('0x1e')](function(){db['sequelize'][_0x5d78('0x2f')](_0x3184a5['toString'](),_0x3574dc)['then'](function(_0x3eab4b){_0x1e4928[_0x5d78('0x18')]=_0x3eab4b[_0x5d78('0x36')];if(_0x1e4928[_0x5d78('0x18')]===0x0)return[];return db[_0x5d78('0x89')][_0x5d78('0x2f')](_0x45de32[_0x5d78('0x8a')](),_0x3574dc)[_0x5d78('0x1e')](function(_0x35e59d){_0x3d3ed2=_[_0x5d78('0x8b')](_0x35e59d,'id');_0x3574dc=_[_0x5d78('0x8c')](_0x3574dc,{'model':db[_0x5d78('0x8d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52811f[_0x5d78('0x2f')]['fields']){_0x30d9ac[_0x5d78('0x34')][_0x5d78('0x5f')](function(_0x3179da){_0x15e61a[_0x5d78('0x3e')]('i.'+_0x3179da);});}else{_0x15e61a[_0x5d78('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5d78('0x55'));_0x15e61a['field'](_0x5d78('0x8e'),_0x5d78('0x8f'));_0x15e61a['field'](_0x5d78('0x90'),'Account.mandatoryDisposition');_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x91'));_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x92'),_0x5d78('0x93'));_0x15e61a[_0x5d78('0x3e')]('c.lastName','Contact.lastName');_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x94'),'Contact.email');_0x15e61a[_0x5d78('0x3e')]('c.phone','Contact.phone');_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x95'),_0x5d78('0x96'));_0x15e61a['field']('c.fax',_0x5d78('0x97'));_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x98'),_0x5d78('0x99'));_0x15e61a[_0x5d78('0x3e')](_0x5d78('0x9a'),_0x5d78('0x9b'));_0x15e61a[_0x5d78('0x3e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5d78('0x26'));}if(_0x30d9ac[_0x5d78('0x19')])_0x15e61a[_0x5d78('0x19')](_0x30d9ac['limit']);if(_0x30d9ac[_0x5d78('0x39')])_0x15e61a[_0x5d78('0x39')](_0x30d9ac[_0x5d78('0x39')]);return db[_0x5d78('0x89')][_0x5d78('0x2f')](_0x15e61a[_0x5d78('0x8a')](),_0x3574dc);})[_0x5d78('0x1e')](function(_0x50c135){_0x37aebc['where'](_0x5d78('0x9c'),_[_0x5d78('0x24')](_0x50c135,'id'));return db[_0x5d78('0x89')][_0x5d78('0x2f')](_0x37aebc[_0x5d78('0x8a')](),_0x3574dc)[_0x5d78('0x1e')](function(_0x1c5b72){var _0x219598=_['groupBy'](_0x1c5b72,_0x5d78('0x9d'));var _0x1d43e5=[];_0x50c135['forEach'](function(_0x1db94d){_0x1d43e5[_0x5d78('0x29')](updateSmsInteraction(_0x1db94d,_0x3d3ed2,_0x219598));});return BPromise[_0x5d78('0x9e')](_0x1d43e5);});});})['then'](function(_0x1d8864){_0x1e4928['rows']=_0x1d8864;return _0x1e4928;})[_0x5d78('0x1e')](respondWithFilteredResult(_0x325105,_0x30d9ac));})[_0x5d78('0x2a')](handleError(_0x325105,null));};exports[_0x5d78('0x9f')]=function(_0xaf93f0,_0xd20ff3){var _0x49f11b={'raw':![],'where':{'id':_0xaf93f0[_0x5d78('0xa0')]['id']}},_0x3e07d6={};_0x3e07d6[_0x5d78('0x33')]=_['keys'](db[_0x5d78('0x8d')][_0x5d78('0xa1')]);_0x3e07d6[_0x5d78('0x2f')]=_[_0x5d78('0x30')](_0xaf93f0[_0x5d78('0x2f')]);_0x3e07d6[_0x5d78('0xa2')]=_[_0x5d78('0x32')](_0x3e07d6['model'],_0x3e07d6[_0x5d78('0x2f')]);_0x49f11b[_0x5d78('0x34')]=_[_0x5d78('0x32')](_0x3e07d6[_0x5d78('0x33')],qs[_0x5d78('0x35')](_0xaf93f0[_0x5d78('0x2f')][_0x5d78('0x35')]));_0x49f11b[_0x5d78('0x34')]=_0x49f11b['attributes'][_0x5d78('0x36')]?_0x49f11b[_0x5d78('0x34')]:_0x3e07d6['model'];if(_0xaf93f0[_0x5d78('0x2f')][_0x5d78('0xa3')]){_0x49f11b[_0x5d78('0xa4')]=[{'all':!![]}];}_0x49f11b=_[_0x5d78('0x8c')]({},_0x49f11b,_0xaf93f0[_0x5d78('0xa5')]);return db[_0x5d78('0x8d')][_0x5d78('0x54')](_0x49f11b)[_0x5d78('0x1e')](handleEntityNotFound(_0xd20ff3,null))[_0x5d78('0x1e')](respondWithResult(_0xd20ff3,null))[_0x5d78('0x2a')](handleError(_0xd20ff3,null));};exports[_0x5d78('0xa6')]=function(_0x455dc3,_0x44b9e3){return db[_0x5d78('0x8d')][_0x5d78('0xa6')](_0x455dc3[_0x5d78('0x63')],{})[_0x5d78('0x1e')](respondWithResult(_0x44b9e3,0xc9))['catch'](handleError(_0x44b9e3,null));};exports[_0x5d78('0x1d')]=function(_0x2140c3,_0x36e2c1){if(_0x2140c3[_0x5d78('0x63')]['id']){delete _0x2140c3['body']['id'];}return db['SmsInteraction'][_0x5d78('0x54')]({'where':{'id':_0x2140c3[_0x5d78('0xa0')]['id']}})[_0x5d78('0x1e')](handleEntityNotFound(_0x36e2c1,null))['then'](saveUpdates(_0x2140c3[_0x5d78('0x63')],null))[_0x5d78('0x1e')](respondWithResult(_0x36e2c1,null))[_0x5d78('0x2a')](handleError(_0x36e2c1,null));};exports[_0x5d78('0xa7')]=function(_0x5ab40a,_0x326544){return db[_0x5d78('0x8d')]['find']({'where':{'id':_0x5ab40a[_0x5d78('0xa0')]['id']}})['then'](handleEntityNotFound(_0x326544,null))[_0x5d78('0x1e')](removeEntity(_0x326544,null))[_0x5d78('0x2a')](handleError(_0x326544,null));};exports[_0x5d78('0xa8')]=function(_0x1bc897,_0x2ab93f){return db[_0x5d78('0x8d')][_0x5d78('0xa8')]()[_0x5d78('0x1e')](respondWithResult(_0x2ab93f,null))[_0x5d78('0x2a')](handleError(_0x2ab93f,null));};exports[_0x5d78('0xa9')]=function(_0x4e4d0e,_0x41daa5,_0x1a4931){return db[_0x5d78('0xaa')]['find']({'where':{'id':_0x4e4d0e[_0x5d78('0xa0')]['id']}})[_0x5d78('0x1e')](handleEntityNotFound(_0x41daa5,null))[_0x5d78('0x1e')](function(_0xf0afad){if(_0xf0afad){return _0xf0afad[_0x5d78('0xa9')](_0x4e4d0e[_0x5d78('0x63')][_0x5d78('0xab')],_['omit'](_0x4e4d0e[_0x5d78('0x63')],[_0x5d78('0xab'),'id'])||{});}})[_0x5d78('0x1e')](respondWithResult(_0x41daa5,null))['catch'](handleError(_0x41daa5,null));};exports[_0x5d78('0xac')]=function(_0x19f173,_0x567fa2,_0x5f2c6e){var _0x20d622={'raw':![],'where':{}};var _0x4fc3d3={};var _0xa34331={'count':0x0,'rows':[]};return db[_0x5d78('0x8d')]['findOne']({'where':{'id':_0x19f173[_0x5d78('0xa0')]['id']}})[_0x5d78('0x1e')](handleEntityNotFound(_0x567fa2,null))[_0x5d78('0x1e')](function(_0x417132){if(_0x417132){_0x4fc3d3['model']=_[_0x5d78('0x30')](db[_0x5d78('0xaa')]['rawAttributes']);_0x4fc3d3[_0x5d78('0x2f')]=_[_0x5d78('0x30')](_0x19f173[_0x5d78('0x2f')]);_0x4fc3d3[_0x5d78('0x31')]=_[_0x5d78('0x32')](_0x4fc3d3['model'],_0x4fc3d3['query']);_0x20d622[_0x5d78('0x34')]=_[_0x5d78('0x32')](_0x4fc3d3[_0x5d78('0x33')],qs['fields'](_0x19f173[_0x5d78('0x2f')][_0x5d78('0x35')]));_0x20d622[_0x5d78('0x34')]=_0x20d622[_0x5d78('0x34')][_0x5d78('0x36')]?_0x20d622['attributes']:_0x4fc3d3[_0x5d78('0x33')];if(!_0x19f173[_0x5d78('0x2f')]['hasOwnProperty'](_0x5d78('0x38'))){_0x20d622[_0x5d78('0x19')]=qs['limit'](_0x19f173[_0x5d78('0x2f')]['limit']);_0x20d622[_0x5d78('0x39')]=qs[_0x5d78('0x39')](_0x19f173[_0x5d78('0x2f')][_0x5d78('0x39')]);}_0x20d622['order']=qs[_0x5d78('0x3a')](_0x19f173[_0x5d78('0x2f')][_0x5d78('0x3a')]);_0x20d622[_0x5d78('0x3b')]=qs[_0x5d78('0x31')](_[_0x5d78('0x3c')](_0x19f173['query'],_0x4fc3d3[_0x5d78('0x31')]));_0x20d622[_0x5d78('0x3b')][_0x5d78('0x9d')]=_0x417132['id'];if(_0x19f173[_0x5d78('0x2f')][_0x5d78('0x75')]){_0x20d622[_0x5d78('0x3b')]=_[_0x5d78('0x8c')](_0x20d622[_0x5d78('0x3b')],{'$or':_['map'](_0x20d622[_0x5d78('0x34')],function(_0x69cd89){var _0x2be710={};_0x2be710[_0x69cd89]={'$like':'%'+_0x19f173[_0x5d78('0x2f')][_0x5d78('0x75')]+'%'};return _0x2be710;})});}if(_0x19f173[_0x5d78('0x2f')][_0x5d78('0xad')]){var _0x1a08c5=_0x19f173[_0x5d78('0x2f')][_0x5d78('0xad')][_0x5d78('0x28')](',');var _0x30cfef={};_0x30cfef[_0x1a08c5[0x0]]={'$gte':moment(_0x1a08c5[0x1])[_0x5d78('0xae')](_0x5d78('0xaf'))};_0x20d622['where']=_[_0x5d78('0x8c')](_0x20d622[_0x5d78('0x3b')],_0x30cfef);}_0x20d622=_[_0x5d78('0x8c')]({},_0x20d622,_0x19f173[_0x5d78('0xa5')]);return db[_0x5d78('0xaa')]['count']({'where':_0x20d622['where']})[_0x5d78('0x1e')](function(_0x2b3ad7){_0xa34331[_0x5d78('0x18')]=_0x2b3ad7;if(_0x19f173[_0x5d78('0x2f')]['includeAll']){_0x20d622[_0x5d78('0xa4')]=[{'all':!![]}];}return db['SmsMessage'][_0x5d78('0xb0')](_0x20d622);})[_0x5d78('0x1e')](function(_0x57bf81){_0xa34331[_0x5d78('0xb1')]=_0x57bf81;return _0xa34331;});}})[_0x5d78('0x1e')](respondWithFilteredResult(_0x567fa2,_0x20d622))['catch'](handleError(_0x567fa2,null));};exports['addTags']=function(_0x52f3fe,_0x5d50ec,_0x5cc174){return db[_0x5d78('0x8d')][_0x5d78('0x54')]({'where':{'id':_0x52f3fe[_0x5d78('0xa0')]['id']}})[_0x5d78('0x1e')](handleEntityNotFound(_0x5d50ec,null))[_0x5d78('0x1e')](function(_0x3c5110){if(_0x3c5110){return _0x3c5110[_0x5d78('0xb2')](_0x52f3fe[_0x5d78('0x63')][_0x5d78('0xab')],_['omit'](_0x52f3fe[_0x5d78('0x63')],[_0x5d78('0xab'),'id'])||{})[_0x5d78('0xb3')](function(){return db['Tag'][_0x5d78('0xb0')]({'attributes':['id','name','color'],'where':{'id':_0x52f3fe[_0x5d78('0x63')][_0x5d78('0xab')]}});})[_0x5d78('0x1e')](function(_0x19bc9a){socket[_0x5d78('0xb4')](_0x5d78('0xb5'),{'id':Number(_0x52f3fe[_0x5d78('0xa0')]['id']),'tags':_0x19bc9a||[]});return{'id':Number(_0x52f3fe[_0x5d78('0xa0')]['id']),'tags':_0x19bc9a||[]};});}})['then'](respondWithResult(_0x5d50ec,null))[_0x5d78('0x2a')](handleError(_0x5d50ec,null));};exports[_0x5d78('0xb6')]=function(_0x3037a5,_0x3dd82a,_0x3954b6){return db['SmsInteraction'][_0x5d78('0x54')]({'where':{'id':_0x3037a5['params']['id']}})[_0x5d78('0x1e')](handleEntityNotFound(_0x3dd82a,null))[_0x5d78('0x1e')](function(_0x437c34){if(_0x437c34){return _0x437c34['removeTags'](_0x3037a5[_0x5d78('0x2f')][_0x5d78('0xab')]);}})[_0x5d78('0x1e')](respondWithStatusCode(_0x3dd82a,null))['catch'](handleError(_0x3dd82a,null));};exports[_0x5d78('0xb7')]=function(_0x370561,_0x32f14c){var _0x2231fa=moment()[_0x5d78('0xb8')]()[_0x5d78('0x8a')]();var _0x10214b=path[_0x5d78('0xb9')](config[_0x5d78('0xba')],_0x5d78('0xbb'),'files',_0x5d78('0xbc'));var _0x559c72=path[_0x5d78('0xb9')](config['root'],'server',_0x5d78('0xbd'),_0x5d78('0xbe'));var _0x2a4689=path[_0x5d78('0xb9')](_0x10214b,_0x2231fa);var _0x388a5a=util['format'](_0x5d78('0xbf'),_0x370561[_0x5d78('0xa0')]['id'],_0x2231fa);var _0x350e5c=path[_0x5d78('0xb9')](_0x10214b,_0x388a5a);var _0xa11f28=[];_0xa11f28[_0x5d78('0x29')]({'model':db[_0x5d78('0x61')],'as':_0x5d78('0x61'),'attributes':['id',_0x5d78('0x25')],'raw':!![]});_0xa11f28[_0x5d78('0x29')]({'model':db[_0x5d78('0xc0')],'as':_0x5d78('0x58'),'attributes':['id','firstName',_0x5d78('0xc1')],'raw':!![]});var _0x29df11=[{'model':db[_0x5d78('0xaa')],'as':'Messages','attributes':['id',_0x5d78('0x63'),_0x5d78('0x6a'),_0x5d78('0xc2'),'secret',_0x5d78('0x71')],'include':_0xa11f28}];_0x29df11['push']({'model':db[_0x5d78('0xc3')],'as':_0x5d78('0xc4'),'attributes':['id',_0x5d78('0x22')]});_0x29df11['push']({'model':db['User'],'as':_0x5d78('0xc5'),'attributes':['id',_0x5d78('0x25')]});return db[_0x5d78('0x8d')][_0x5d78('0x54')]({'where':{'id':_0x370561['params']['id']},'include':_0x29df11})[_0x5d78('0x1e')](handleEntityNotFound(_0x32f14c,null))['then'](function(_0x4d440d){if(_0x4d440d){var _0x4e26e2=_0x4d440d[_0x5d78('0xc6')]({'plain':!![]});fs[_0x5d78('0xc7')](_0x2a4689);var _0x4fae34={'format':'A4','border':_0x5d78('0xc8'),'header':{'height':'40px','contents':{'first':_0x5d78('0xc9')}},'footer':{'height':_0x5d78('0xca'),'contents':{'default':util[_0x5d78('0xae')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x5d78('0xcb'),_0x5d78('0xcc'),_0x4e26e2['id']),moment()[_0x5d78('0xae')](_0x5d78('0xcd'))['toString']())}}};var _0x1da21a={'channel':_0x5d78('0xcc'),'account':_0x4e26e2[_0x5d78('0xc4')][_0x5d78('0x22')],'agent':_0x4e26e2[_0x5d78('0xc5')]?_0x4e26e2[_0x5d78('0xc5')][_0x5d78('0x25')]:'N.A.','createdAt':moment(_0x4e26e2[_0x5d78('0x6a')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5d78('0x8a')](),'closedAt':_0x4e26e2['closed']?moment(_0x4e26e2[_0x5d78('0xce')])[_0x5d78('0xae')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5d78('0x8a')]():'','disposition':_0x4e26e2[_0x5d78('0xcf')],'messages':_(_0x4e26e2[_0x5d78('0xd0')])[_0x5d78('0x75')]({'secret':![]})[_0x5d78('0x24')](function(_0x11d2c2){return{'date':moment(_0x11d2c2[_0x5d78('0x6a')])[_0x5d78('0xae')](_0x5d78('0xaf'))[_0x5d78('0x8a')](),'sender':_0x11d2c2[_0x5d78('0xc2')]===_0x5d78('0xd1')?_0x11d2c2['User']?_0x11d2c2[_0x5d78('0x61')]['fullname']:'System':_0x11d2c2[_0x5d78('0x58')][_0x5d78('0xd2')]+(_0x11d2c2[_0x5d78('0x58')]['lastName']?'\x20'+_0x11d2c2['Contact'][_0x5d78('0xc1')]:''),'body':_0x11d2c2[_0x5d78('0x63')],'direction':_0x11d2c2[_0x5d78('0xc2')]==='out'?'A':'C','secret':_0x11d2c2[_0x5d78('0xd3')],'read':_0x11d2c2[_0x5d78('0x71')]};})[_0x5d78('0x56')]()};return ejs['renderFile'](path[_0x5d78('0xb9')](config['root'],_0x5d78('0xbb'),_0x5d78('0xd4'),_0x5d78('0xd5')),{'interaction':_0x1da21a})[_0x5d78('0x1e')](function(_0x5ca23b){return new BPromise(function(_0x32d054,_0x145f01){pdf[_0x5d78('0xa6')](_0x5ca23b,_0x4fae34)['toFile'](path[_0x5d78('0xb9')](_0x2a4689,_0x5d78('0xd6')+_0x4e26e2['id']+'-'+_0x2231fa+_0x5d78('0xd7')),function(_0xdd9cec,_0x555032){if(_0xdd9cec)return _0x145f01(_0xdd9cec);_0x32d054(_0x555032);});});})[_0x5d78('0x1e')](function(){return new BPromise(function(_0x3aedd5,_0x28a3d1){zipdir(_0x2a4689,{'saveTo':_0x350e5c},function(_0x2995ed,_0xaf0a27){if(_0x2995ed)return _0x28a3d1(_0x2995ed);return _0x3aedd5(_0xaf0a27);});})[_0x5d78('0x1e')](function(){return new BPromise(function(_0x39dffe,_0x2cec8d){rimraf(_0x2a4689,function(_0x2c924b){if(_0x2c924b)_0x2cec8d(_0x2c924b);return _0x39dffe();});});})[_0x5d78('0x1e')](function(){return _0x32f14c['download'](_0x350e5c,_0x388a5a,function(_0xa30db7){if(_0xa30db7){console['log']('err',_0xa30db7);}else{fs[_0x5d78('0xd8')](_0x350e5c);}});});});}else{return _0x32f14c['sendStatus'](0xc8);}})[_0x5d78('0x2a')](handleError(_0x32f14c,null));}; \ No newline at end of file +var _0xcee2=['CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.SmsAccountId\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','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','unreadMessages','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','push','all','show','params','filtears','includeAll','include','create','body','update','describe','SmsMessage','addMessage','ids','findOne','filter','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','spread','smsInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','format','User','SmsAccount','Account','Owner','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','Sms','N.A.','closed','closedAt','disposition','Messages','direction','out','System','firstName','secret','renderFile','views','toFile','.pdf','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','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','Users','fullname','TagIds','split','forEach','Tags','catch','index','map','SmsInteraction','rawAttributes','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','find','value','having','Contact','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x47595c,_0x5180ff){var _0x4a6543=function(_0x261e2c){while(--_0x261e2c){_0x47595c['push'](_0x47595c['shift']());}};_0x4a6543(++_0x5180ff);}(_0xcee2,0x7e));var _0x2cee=function(_0x35be2c,_0x3b9788){_0x35be2c=_0x35be2c-0x0;var _0x13813a=_0xcee2[_0x35be2c];return _0x13813a;};'use strict';var pdf=require(_0x2cee('0x0'));var emlformat=require(_0x2cee('0x1'));var rimraf=require(_0x2cee('0x2'));var zipdir=require(_0x2cee('0x3'));var jsonpatch=require(_0x2cee('0x4'));var rp=require(_0x2cee('0x5'));var moment=require(_0x2cee('0x6'));var BPromise=require(_0x2cee('0x7'));var Mustache=require(_0x2cee('0x8'));var util=require(_0x2cee('0x9'));var path=require(_0x2cee('0xa'));var sox=require(_0x2cee('0xb'));var csv=require(_0x2cee('0xc'));var ejs=require(_0x2cee('0xd'));var fs=require('fs');var _=require(_0x2cee('0xe'));var squel=require(_0x2cee('0xf'));var crypto=require('crypto');var jsforce=require(_0x2cee('0x10'));var deskjs=require(_0x2cee('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2cee('0x12'));var Papa=require(_0x2cee('0x13'));var Redis=require('ioredis');var authService=require(_0x2cee('0x14'));var qs=require(_0x2cee('0x15'));var as=require(_0x2cee('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cee('0x17'))(_0x2cee('0x18'));var utils=require(_0x2cee('0x19'));var config=require(_0x2cee('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2cee('0x1b')]=_[_0x2cee('0x1c')](config[_0x2cee('0x1b')],{'host':_0x2cee('0x1d'),'port':0x18eb});var socket=require(_0x2cee('0x1e'))(new Redis(config[_0x2cee('0x1b')]));require(_0x2cee('0x1f'))[_0x2cee('0x20')](socket);function respondWithStatusCode(_0x23283b,_0x447861){_0x447861=_0x447861||0xcc;return function(_0x574d2c){if(_0x574d2c){return _0x23283b[_0x2cee('0x21')](_0x447861);}return _0x23283b[_0x2cee('0x22')](_0x447861)['end']();};}function respondWithResult(_0x32c36a,_0x76a753){_0x76a753=_0x76a753||0xc8;return function(_0x57d0d0){if(_0x57d0d0){return _0x32c36a[_0x2cee('0x22')](_0x76a753)[_0x2cee('0x23')](_0x57d0d0);}};}function respondWithFilteredResult(_0x34189d,_0x25eeae){return function(_0x5e31e5){if(_0x5e31e5){var _0x576b60=_0x5e31e5[_0x2cee('0x24')],_0x11cde6=_0x25eeae[_0x2cee('0x25')],_0x24b678=_0x25eeae[_0x2cee('0x25')]+_0x25eeae[_0x2cee('0x26')],_0x3a1938;if(_0x24b678>=_0x576b60){_0x24b678=_0x576b60;_0x3a1938=0xc8;}else{_0x3a1938=0xce;}_0x34189d['status'](_0x3a1938);return _0x34189d[_0x2cee('0x27')](_0x2cee('0x28'),_0x11cde6+'-'+_0x24b678+'/'+_0x576b60)[_0x2cee('0x23')](_0x5e31e5);}return null;};}function patchUpdates(_0x5daf0c){return function(_0xc7105e){try{jsonpatch['apply'](_0xc7105e,_0x5daf0c,!![]);}catch(_0x1daba3){return BPromise[_0x2cee('0x29')](_0x1daba3);}return _0xc7105e[_0x2cee('0x2a')]();};}function saveUpdates(_0x771638,_0x243e0b){return function(_0x3d6b5c){if(_0x3d6b5c){return _0x3d6b5c['update'](_0x771638)[_0x2cee('0x2b')](function(_0x55710d){return _0x55710d;});}return null;};}function removeEntity(_0xbd37f3,_0x397b5b){return function(_0x3e9903){if(_0x3e9903){return _0x3e9903[_0x2cee('0x2c')]()[_0x2cee('0x2b')](function(){_0xbd37f3[_0x2cee('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7f2d76,_0x47deaa){return function(_0x4708ad){if(!_0x4708ad){_0x7f2d76[_0x2cee('0x21')](0x194);}return _0x4708ad;};}function handleError(_0x301c28,_0x130873){_0x130873=_0x130873||0x1f4;return function(_0xc14476){logger[_0x2cee('0x2d')](_0xc14476[_0x2cee('0x2e')]);if(_0xc14476[_0x2cee('0x2f')]){delete _0xc14476[_0x2cee('0x2f')];}_0x301c28[_0x2cee('0x22')](_0x130873)[_0x2cee('0x30')](_0xc14476);};}function getInteractionUsers(_0x37b972,_0x505551){return new BPromise(function(_0x3c6a3e,_0x4a89fb){try{if(_0x505551[_0x37b972['id']]){_0x37b972[_0x2cee('0x31')]=_['map'](_0x505551[_0x37b972['id']],function(_0x75d733){return{'id':_0x75d733['id'],'fullname':_0x75d733[_0x2cee('0x32')]};});}}catch(_0x1fcb2e){_0x4a89fb(_0x1fcb2e);}_0x3c6a3e(_0x37b972);});}function getInteractionTags(_0x2e7671,_0x515659){return new BPromise(function(_0x54c1b6,_0x46da18){try{if(_0x2e7671[_0x2cee('0x33')]){_0x2e7671['Tags']=[];_0x2e7671[_0x2cee('0x33')][_0x2cee('0x34')](',')[_0x2cee('0x35')](function(_0x3d3b5e){_0x2e7671[_0x2cee('0x36')]['push'](_0x515659[_0x3d3b5e]);});}delete _0x2e7671[_0x2cee('0x33')];}catch(_0x371608){_0x46da18(_0x371608);}_0x54c1b6(_0x2e7671);});}function updateSmsInteraction(_0x2392ab,_0x4f9938,_0x1ba5b3){return new BPromise(function(_0x14e0cf,_0x50eca5){return getInteractionUsers(_0x2392ab,_0x1ba5b3)[_0x2cee('0x2b')](function(_0x24be08){return getInteractionTags(_0x24be08,_0x4f9938);})[_0x2cee('0x2b')](function(_0x2dafac){_0x14e0cf(_0x2dafac);})[_0x2cee('0x37')](function(_0x73cedc){_0x50eca5(_0x73cedc);});});}exports[_0x2cee('0x38')]=function(_0x5dca5e,_0x507bef){var _0x222cb6={},_0x52e515={},_0x1757bd={'count':0x0,'rows':[]};var _0x34ed2c=_[_0x2cee('0x39')](db[_0x2cee('0x3a')][_0x2cee('0x3b')],function(_0x29c829){return{'name':_0x29c829['fieldName'],'type':_0x29c829[_0x2cee('0x3c')][_0x2cee('0x3d')]};});_0x52e515['model']=_[_0x2cee('0x39')](_0x34ed2c,_0x2cee('0x2f'));_0x52e515[_0x2cee('0x3e')]=_['keys'](_0x5dca5e['query']);_0x52e515[_0x2cee('0x3f')]=_[_0x2cee('0x40')](_0x52e515['model'],_0x52e515[_0x2cee('0x3e')]);_0x222cb6['attributes']=_[_0x2cee('0x40')](_0x52e515['model'],qs[_0x2cee('0x41')](_0x5dca5e['query']['fields']));_0x222cb6[_0x2cee('0x42')]=_0x222cb6['attributes'][_0x2cee('0x43')]?_0x222cb6[_0x2cee('0x42')]:_0x52e515[_0x2cee('0x44')];if(!_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x45')](_0x2cee('0x46'))){_0x222cb6[_0x2cee('0x26')]=qs[_0x2cee('0x26')](_0x5dca5e[_0x2cee('0x3e')]['limit']);_0x222cb6['offset']=qs[_0x2cee('0x25')](_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x25')]);}_0x222cb6[_0x2cee('0x47')]=qs[_0x2cee('0x48')](_0x5dca5e['query'][_0x2cee('0x48')]);_0x222cb6[_0x2cee('0x49')]=qs['filters'](_[_0x2cee('0x4a')](_0x5dca5e['query'],_0x52e515[_0x2cee('0x3f')]),_0x34ed2c);var _0xfc2b99=[];var _0x29e8b3=squel[_0x2cee('0x4b')]()[_0x2cee('0x4c')]('id')[_0x2cee('0x4c')](_0x2cee('0x2f'))[_0x2cee('0x4c')](_0x2cee('0x4d'))[_0x2cee('0x4e')](_0x2cee('0x4f'));var _0x249bd8=squel['select']()[_0x2cee('0x4c')](_0x2cee('0x50'))[_0x2cee('0x4c')]('u.fullname')[_0x2cee('0x4c')](_0x2cee('0x51'))[_0x2cee('0x4e')](_0x2cee('0x52'),'ui')[_0x2cee('0x53')](_0x2cee('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x8c206e=squel[_0x2cee('0x4b')]()[_0x2cee('0x4e')](_0x2cee('0x55'),'i')['left_join'](_0x2cee('0x56'),'c',_0x2cee('0x57'))[_0x2cee('0x53')](_0x2cee('0x54'),'o','o.id\x20=\x20i.UserId')[_0x2cee('0x53')]('sms_accounts','a',_0x2cee('0x58'))[_0x2cee('0x53')](_0x2cee('0x59'),'me',_0x2cee('0x5a'))[_0x2cee('0x53')]('sms_interaction_has_tags','it',_0x2cee('0x5b'))[_0x2cee('0x53')](_0x2cee('0x4f'),'t',_0x2cee('0x5c'));var _0x1b410c=squel[_0x2cee('0x5d')]();var _0x279b04=[];var _0x15d05f=squel[_0x2cee('0x5d')]();var _0x523a63;if(_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x5e')]){_0x523a63=as['parseSearch'](_0x5dca5e[_0x2cee('0x3e')]['search']);var _0x19a462=_0x523a63['sqlOperator'];for(var _0x373ce0=0x0;_0x373ce0<_0x523a63['conditions'][_0x2cee('0x43')];_0x373ce0++){var _0xd02c9f=_0x523a63[_0x2cee('0x5f')][_0x373ce0];var _0xc5e6ec='i';var _0x3d2df6=_[_0x2cee('0x60')](_0x34ed2c,[_0x2cee('0x2f'),_0xd02c9f[_0x2cee('0x4c')]]);if(!_0x3d2df6){switch(_0xd02c9f[_0x2cee('0x4c')]){case'unreadMessages':if(_0xd02c9f[_0x2cee('0x61')]==0x1){_0x8c206e[_0x2cee('0x62')]('`'+_0xd02c9f[_0x2cee('0x4c')]+'`\x20=\x200');}else{_0x8c206e['having']('`'+_0xd02c9f[_0x2cee('0x4c')]+'`\x20>\x200');}break;case _0x2cee('0x63'):if(_0xd02c9f['operator']===_0x2cee('0x64')){if(_0xd02c9f[_0x2cee('0x61')]['split']('\x20')['length']>0x1){_0x1b410c[_0x19a462]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2cee('0x65')](_0xd02c9f['value']),null);}else{var _0x53fa79='%'+_0xd02c9f['value']+'%';_0x1b410c[_0x19a462](_0x2cee('0x66'),_0x53fa79,_0x53fa79,_0x53fa79);}}else{_0x3d2df6=_['find'](_0x34ed2c,[_0x2cee('0x2f'),'ContactId']);_0xd02c9f['field']=_0x2cee('0x67');_0xb09d59=as[_0x2cee('0x68')](_0xc5e6ec,_0x3d2df6[_0x2cee('0x3c')],_0xd02c9f);_0x1b410c[_0x19a462](_0xb09d59[_0x2cee('0x69')],_0xb09d59['value'][_0x2cee('0x6a')],_0xb09d59[_0x2cee('0x61')][_0x2cee('0x6b')]);}break;case _0x2cee('0x6c'):var _0x207dbd=_0xd02c9f['value']['split'](',')[_0x2cee('0x39')](function(_0x2ba0a3){return Number(_0x2ba0a3);});_0x207dbd[_0x2cee('0x35')](function(_0x3a1ed2){_0x15d05f['or'](_0x2cee('0x6d'),'%,'+_0x3a1ed2+',%');});_0x279b04=_[_0x2cee('0x6e')](_0x279b04,_0x207dbd);break;case'User':if(_0xd02c9f['operator']===_0x2cee('0x64')){_0x1b410c[_0x19a462](_0x2cee('0x6f'),'%'+_0xd02c9f[_0x2cee('0x61')]+'%',null);}else{_0x3d2df6=_[_0x2cee('0x60')](_0x34ed2c,[_0x2cee('0x2f'),_0x2cee('0x70')]);_0xd02c9f[_0x2cee('0x4c')]=_0x2cee('0x70');_0xb09d59=as[_0x2cee('0x68')](_0xc5e6ec,_0x3d2df6[_0x2cee('0x3c')],_0xd02c9f);_0x1b410c[_0x19a462](_0xb09d59[_0x2cee('0x69')],_0xb09d59[_0x2cee('0x61')]['start'],_0xb09d59['value'][_0x2cee('0x6b')]);}break;case'body':_0xb09d59=as[_0x2cee('0x68')]('me',null,_0xd02c9f);_0x1b410c[_0x19a462](_0xb09d59[_0x2cee('0x69')],_0xb09d59[_0x2cee('0x61')]['start'],_0xb09d59['value'][_0x2cee('0x6b')]);break;}}else{var _0xb09d59=as[_0x2cee('0x68')](_0xc5e6ec,_0x3d2df6[_0x2cee('0x3c')],_0xd02c9f);_0x1b410c[_0x19a462](_0xb09d59[_0x2cee('0x69')],_0xb09d59[_0x2cee('0x61')][_0x2cee('0x6a')],_0xb09d59[_0x2cee('0x61')][_0x2cee('0x6b')]);}}}else{var _0x591693=_(_0x5dca5e[_0x2cee('0x3e')])[_0x2cee('0x71')]()[_0x2cee('0x39')](function(_0x215bc9){return _[_0x2cee('0x72')](_0x34ed2c,['name',_0x215bc9])?_0x215bc9:undefined;})[_0x2cee('0x73')]()[_0x2cee('0x61')]();if(!_[_0x2cee('0x74')](_0x591693)){_0x591693[_0x2cee('0x35')](function(_0x3e1538){if(_0x3e1538==='SmsAccountId'){_0x8c206e[_0x2cee('0x49')](_0x2cee('0x75'),[][_0x2cee('0x76')](_0x5dca5e[_0x2cee('0x3e')][_0x3e1538]));}else if(_0x3e1538===_0x2cee('0x77')){var _0x2e56af=JSON[_0x2cee('0x78')](_0x5dca5e['query'][_0x3e1538])[_0x2cee('0x79')];var _0x251066=JSON[_0x2cee('0x78')](_0x5dca5e[_0x2cee('0x3e')][_0x3e1538])[_0x2cee('0x7a')];_0x8c206e[_0x2cee('0x49')](_0x2cee('0x7b'),_0x2e56af,_0x251066);}else{if(_0x5dca5e[_0x2cee('0x3e')][_0x3e1538]===_0x2cee('0x7c')){_0x8c206e[_0x2cee('0x49')]('i.'+_0x3e1538+'\x20IS\x20NULL');}else{_0x8c206e[_0x2cee('0x49')]('i.'+_0x3e1538+_0x2cee('0x7d'),_0x5dca5e[_0x2cee('0x3e')][_0x3e1538]);}}});}if(_0x5dca5e['query'][_0x2cee('0x7e')]){if(_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x7e')]==0x1){_0x8c206e[_0x2cee('0x62')](_0x2cee('0x7f'));}else{_0x8c206e[_0x2cee('0x62')](_0x2cee('0x80'));}}if(_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x81')]){_0x279b04=_[_0x2cee('0x82')](_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x81')])?_0x5dca5e['query']['tag']:new Array(_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x81')]);_0x279b04[_0x2cee('0x35')](function(_0x37a0d2){_0x15d05f['or'](_0x2cee('0x6d'),'%,'+_0x37a0d2+',%');});}if(_0x5dca5e[_0x2cee('0x3e')]['filter']){var _0x175b3c=_0x5dca5e['query']['filter'][_0x2cee('0x83')]('\x5c','\x5c\x5c')[_0x2cee('0x83')]('\x27\x27',_0x2cee('0x84'));if(qs[_0x2cee('0x85')](_0x175b3c)){_0x1b410c['or']('i.id\x20LIKE\x20?',_0x175b3c+'%')['or'](_0x2cee('0x86'),_0x175b3c+'%');}else{_0x1b410c['or'](_0x2cee('0x87'),qs[_0x2cee('0x65')](_0x175b3c))['or'](_0x2cee('0x88'),_0x175b3c+'%');}}}_0x8c206e['where'](_0x1b410c);_0x8c206e[_0x2cee('0x89')](_0x2cee('0x8a'));var _0x4213cb={'type':db[_0x2cee('0x8b')][_0x2cee('0x8c')][_0x2cee('0x8d')],'raw':!![]};var _0x2768d5=_0x8c206e['clone']();_0x2768d5['field']('i.id');_0x2768d5[_0x2cee('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2cee('0x8e'));if(_0x222cb6[_0x2cee('0x47')]){_0x222cb6[_0x2cee('0x47')][_0x2cee('0x35')](function(_0x4d851c){_0x8c206e[_0x2cee('0x47')]('i.'+_0x4d851c[0x0],_0x4d851c[0x1]===_0x2cee('0x8f')?![]:!![]);});}if(!_[_0x2cee('0x74')](_0x279b04)){_0x8c206e[_0x2cee('0x62')](_0x15d05f);_0x2768d5['where'](_0x2cee('0x90'),_0x279b04);}BPromise[_0x2cee('0x91')]()[_0x2cee('0x2b')](function(){if(!_0x523a63){if(_0x5dca5e['query'][_0x2cee('0x92')]||_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x93')])return;_0x2768d5[_0x2cee('0x49')](_0x2cee('0x94'));_0x8c206e['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x5dca5e[_0x2cee('0x95')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x2cee('0x2b')](function(_0x488a36){if(_['isEmpty'](_0x488a36)){_0x2768d5['where'](_0x2cee('0x96'));_0x8c206e[_0x2cee('0x49')](_0x2cee('0x96'));}else{_0x2768d5['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x488a36,'id'));_0x8c206e['where']('i.SmsAccountId\x20IN\x20?',_[_0x2cee('0x39')](_0x488a36,'id'));}});})[_0x2cee('0x2b')](function(){db[_0x2cee('0x97')][_0x2cee('0x3e')](_0x2768d5[_0x2cee('0x98')](),_0x4213cb)[_0x2cee('0x2b')](function(_0x94c01b){_0x1757bd['count']=_0x94c01b[_0x2cee('0x43')];if(_0x1757bd[_0x2cee('0x24')]===0x0)return[];return db[_0x2cee('0x97')][_0x2cee('0x3e')](_0x29e8b3[_0x2cee('0x98')](),_0x4213cb)['then'](function(_0x5ca630){_0xfc2b99=_['keyBy'](_0x5ca630,'id');_0x4213cb=_[_0x2cee('0x99')](_0x4213cb,{'model':db[_0x2cee('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5dca5e[_0x2cee('0x3e')][_0x2cee('0x41')]){_0x222cb6[_0x2cee('0x42')][_0x2cee('0x35')](function(_0x3e782c){_0x8c206e[_0x2cee('0x4c')]('i.'+_0x3e782c);});}else{_0x8c206e[_0x2cee('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x8c206e['field'](_0x2cee('0x9a'),_0x2cee('0x9b'));_0x8c206e['field'](_0x2cee('0x9c'),_0x2cee('0x9d'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0x9e'));_0x8c206e[_0x2cee('0x4c')]('c.firstName',_0x2cee('0x9f'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0xa0'),_0x2cee('0xa1'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0xa2'),_0x2cee('0xa3'));_0x8c206e[_0x2cee('0x4c')]('c.phone','Contact.phone');_0x8c206e['field']('c.mobile',_0x2cee('0xa4'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0xa5'),_0x2cee('0xa6'));_0x8c206e['field'](_0x2cee('0xa7'),_0x2cee('0xa8'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0xa9'),_0x2cee('0xaa'));_0x8c206e[_0x2cee('0x4c')](_0x2cee('0xab'),'TagIds');}if(_0x222cb6['limit'])_0x8c206e[_0x2cee('0x26')](_0x222cb6[_0x2cee('0x26')]);if(_0x222cb6[_0x2cee('0x25')])_0x8c206e['offset'](_0x222cb6[_0x2cee('0x25')]);return db[_0x2cee('0x97')][_0x2cee('0x3e')](_0x8c206e[_0x2cee('0x98')](),_0x4213cb);})[_0x2cee('0x2b')](function(_0x2ed8d8){_0x249bd8[_0x2cee('0x49')]('ui.SmsInteractionId\x20IN\x20?',_[_0x2cee('0x39')](_0x2ed8d8,'id'));return db[_0x2cee('0x97')][_0x2cee('0x3e')](_0x249bd8['toString'](),_0x4213cb)[_0x2cee('0x2b')](function(_0x245aa1){var _0x1baf33=_[_0x2cee('0xac')](_0x245aa1,_0x2cee('0xad'));var _0x26c886=[];_0x2ed8d8[_0x2cee('0x35')](function(_0x1576a7){_0x26c886[_0x2cee('0xae')](updateSmsInteraction(_0x1576a7,_0xfc2b99,_0x1baf33));});return BPromise[_0x2cee('0xaf')](_0x26c886);});});})[_0x2cee('0x2b')](function(_0x3b8e77){_0x1757bd['rows']=_0x3b8e77;return _0x1757bd;})[_0x2cee('0x2b')](respondWithFilteredResult(_0x507bef,_0x222cb6));})[_0x2cee('0x37')](handleError(_0x507bef,null));};exports[_0x2cee('0xb0')]=function(_0x48ad3b,_0x493350){var _0x303228={'raw':![],'where':{'id':_0x48ad3b[_0x2cee('0xb1')]['id']}},_0x2b5d4f={};_0x2b5d4f['model']=_['keys'](db['SmsInteraction'][_0x2cee('0x3b')]);_0x2b5d4f[_0x2cee('0x3e')]=_['keys'](_0x48ad3b[_0x2cee('0x3e')]);_0x2b5d4f[_0x2cee('0xb2')]=_[_0x2cee('0x40')](_0x2b5d4f['model'],_0x2b5d4f['query']);_0x303228['attributes']=_['intersection'](_0x2b5d4f[_0x2cee('0x44')],qs[_0x2cee('0x41')](_0x48ad3b[_0x2cee('0x3e')][_0x2cee('0x41')]));_0x303228[_0x2cee('0x42')]=_0x303228[_0x2cee('0x42')]['length']?_0x303228[_0x2cee('0x42')]:_0x2b5d4f['model'];if(_0x48ad3b['query'][_0x2cee('0xb3')]){_0x303228[_0x2cee('0xb4')]=[{'all':!![]}];}_0x303228=_[_0x2cee('0x99')]({},_0x303228,_0x48ad3b['options']);return db[_0x2cee('0x3a')][_0x2cee('0x60')](_0x303228)['then'](handleEntityNotFound(_0x493350,null))[_0x2cee('0x2b')](respondWithResult(_0x493350,null))[_0x2cee('0x37')](handleError(_0x493350,null));};exports[_0x2cee('0xb5')]=function(_0x5858a7,_0x137a08){return db[_0x2cee('0x3a')][_0x2cee('0xb5')](_0x5858a7[_0x2cee('0xb6')],{})[_0x2cee('0x2b')](respondWithResult(_0x137a08,0xc9))['catch'](handleError(_0x137a08,null));};exports[_0x2cee('0xb7')]=function(_0x182972,_0x36e6f3){if(_0x182972['body']['id']){delete _0x182972[_0x2cee('0xb6')]['id'];}return db[_0x2cee('0x3a')][_0x2cee('0x60')]({'where':{'id':_0x182972[_0x2cee('0xb1')]['id']}})[_0x2cee('0x2b')](handleEntityNotFound(_0x36e6f3,null))[_0x2cee('0x2b')](saveUpdates(_0x182972[_0x2cee('0xb6')],null))['then'](respondWithResult(_0x36e6f3,null))[_0x2cee('0x37')](handleError(_0x36e6f3,null));};exports[_0x2cee('0x2c')]=function(_0x2f9c02,_0x10db29){return db[_0x2cee('0x3a')][_0x2cee('0x60')]({'where':{'id':_0x2f9c02['params']['id']}})[_0x2cee('0x2b')](handleEntityNotFound(_0x10db29,null))['then'](removeEntity(_0x10db29,null))['catch'](handleError(_0x10db29,null));};exports[_0x2cee('0xb8')]=function(_0x5c34fb,_0x2c8575){return db[_0x2cee('0x3a')][_0x2cee('0xb8')]()[_0x2cee('0x2b')](respondWithResult(_0x2c8575,null))[_0x2cee('0x37')](handleError(_0x2c8575,null));};exports['addMessage']=function(_0x387e60,_0x58c60f,_0x2f3b1a){return db[_0x2cee('0xb9')]['find']({'where':{'id':_0x387e60[_0x2cee('0xb1')]['id']}})['then'](handleEntityNotFound(_0x58c60f,null))[_0x2cee('0x2b')](function(_0x48f847){if(_0x48f847){return _0x48f847[_0x2cee('0xba')](_0x387e60['body'][_0x2cee('0xbb')],_['omit'](_0x387e60[_0x2cee('0xb6')],[_0x2cee('0xbb'),'id'])||{});}})[_0x2cee('0x2b')](respondWithResult(_0x58c60f,null))[_0x2cee('0x37')](handleError(_0x58c60f,null));};exports['getMessages']=function(_0x3f34bc,_0x1834ff,_0x1c5a75){var _0x42a211={'raw':![],'where':{}};var _0x3ae0a3={};var _0x53b797={'count':0x0,'rows':[]};return db[_0x2cee('0x3a')][_0x2cee('0xbc')]({'where':{'id':_0x3f34bc['params']['id']}})[_0x2cee('0x2b')](handleEntityNotFound(_0x1834ff,null))[_0x2cee('0x2b')](function(_0x127a83){if(_0x127a83){_0x3ae0a3[_0x2cee('0x44')]=_[_0x2cee('0x71')](db[_0x2cee('0xb9')][_0x2cee('0x3b')]);_0x3ae0a3[_0x2cee('0x3e')]=_['keys'](_0x3f34bc['query']);_0x3ae0a3[_0x2cee('0x3f')]=_['intersection'](_0x3ae0a3[_0x2cee('0x44')],_0x3ae0a3[_0x2cee('0x3e')]);_0x42a211['attributes']=_[_0x2cee('0x40')](_0x3ae0a3[_0x2cee('0x44')],qs['fields'](_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x41')]));_0x42a211['attributes']=_0x42a211[_0x2cee('0x42')][_0x2cee('0x43')]?_0x42a211[_0x2cee('0x42')]:_0x3ae0a3['model'];if(!_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x45')](_0x2cee('0x46'))){_0x42a211['limit']=qs[_0x2cee('0x26')](_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x26')]);_0x42a211[_0x2cee('0x25')]=qs['offset'](_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x25')]);}_0x42a211['order']=qs['sort'](_0x3f34bc['query']['sort']);_0x42a211[_0x2cee('0x49')]=qs[_0x2cee('0x3f')](_[_0x2cee('0x4a')](_0x3f34bc[_0x2cee('0x3e')],_0x3ae0a3[_0x2cee('0x3f')]));_0x42a211['where'][_0x2cee('0xad')]=_0x127a83['id'];if(_0x3f34bc['query'][_0x2cee('0xbd')]){_0x42a211[_0x2cee('0x49')]=_[_0x2cee('0x99')](_0x42a211[_0x2cee('0x49')],{'$or':_[_0x2cee('0x39')](_0x42a211[_0x2cee('0x42')],function(_0x551644){var _0x23c99e={};_0x23c99e[_0x551644]={'$like':'%'+_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0xbd')]+'%'};return _0x23c99e;})});}if(_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x79')]){var _0x25b144=_0x3f34bc[_0x2cee('0x3e')][_0x2cee('0x79')][_0x2cee('0x34')](',');var _0x1bc3fd={};_0x1bc3fd[_0x25b144[0x0]]={'$gte':moment(_0x25b144[0x1])['format'](_0x2cee('0xbe'))};_0x42a211[_0x2cee('0x49')]=_['merge'](_0x42a211[_0x2cee('0x49')],_0x1bc3fd);}_0x42a211=_[_0x2cee('0x99')]({},_0x42a211,_0x3f34bc[_0x2cee('0xbf')]);return db[_0x2cee('0xb9')][_0x2cee('0x24')]({'where':_0x42a211[_0x2cee('0x49')]})[_0x2cee('0x2b')](function(_0xdd8909){_0x53b797[_0x2cee('0x24')]=_0xdd8909;if(_0x3f34bc['query'][_0x2cee('0xb3')]){_0x42a211['include']=[{'all':!![]}];}return db[_0x2cee('0xb9')][_0x2cee('0xc0')](_0x42a211);})['then'](function(_0x336d62){_0x53b797['rows']=_0x336d62;return _0x53b797;});}})[_0x2cee('0x2b')](respondWithFilteredResult(_0x1834ff,_0x42a211))[_0x2cee('0x37')](handleError(_0x1834ff,null));};exports[_0x2cee('0xc1')]=function(_0x42c4bf,_0x305f5b,_0x1f4bc1){return db[_0x2cee('0x3a')]['find']({'where':{'id':_0x42c4bf[_0x2cee('0xb1')]['id']}})[_0x2cee('0x2b')](handleEntityNotFound(_0x305f5b,null))[_0x2cee('0x2b')](function(_0x53be4c){if(_0x53be4c){return _0x53be4c[_0x2cee('0xc2')](_0x42c4bf['body'][_0x2cee('0xbb')],_[_0x2cee('0xc3')](_0x42c4bf[_0x2cee('0xb6')],['ids','id'])||{})[_0x2cee('0xc4')](function(){return db[_0x2cee('0x6c')][_0x2cee('0xc0')]({'attributes':['id',_0x2cee('0x2f'),_0x2cee('0x4d')],'where':{'id':_0x42c4bf[_0x2cee('0xb6')][_0x2cee('0xbb')]}});})['then'](function(_0x5bf340){socket['emit'](_0x2cee('0xc5'),{'id':Number(_0x42c4bf['params']['id']),'tags':_0x5bf340||[]});return{'id':Number(_0x42c4bf[_0x2cee('0xb1')]['id']),'tags':_0x5bf340||[]};});}})[_0x2cee('0x2b')](respondWithResult(_0x305f5b,null))[_0x2cee('0x37')](handleError(_0x305f5b,null));};exports[_0x2cee('0xc6')]=function(_0x4e9d8d,_0x1bdab3,_0x423d4d){return db[_0x2cee('0x3a')][_0x2cee('0x60')]({'where':{'id':_0x4e9d8d[_0x2cee('0xb1')]['id']}})[_0x2cee('0x2b')](handleEntityNotFound(_0x1bdab3,null))['then'](function(_0x3b1868){if(_0x3b1868){return _0x3b1868[_0x2cee('0xc6')](_0x4e9d8d[_0x2cee('0x3e')][_0x2cee('0xbb')]);}})[_0x2cee('0x2b')](respondWithStatusCode(_0x1bdab3,null))[_0x2cee('0x37')](handleError(_0x1bdab3,null));};exports[_0x2cee('0xc7')]=function(_0x526665,_0x2ef63b){var _0x369d80=moment()[_0x2cee('0xc8')]()[_0x2cee('0x98')]();var _0xe44179=path[_0x2cee('0xc9')](config[_0x2cee('0xca')],'server',_0x2cee('0xcb'),_0x2cee('0xcc'));var _0x14dc85=path[_0x2cee('0xc9')](config[_0x2cee('0xca')],_0x2cee('0xcd'),_0x2cee('0xcb'),_0x2cee('0xce'));var _0x5da242=path[_0x2cee('0xc9')](_0xe44179,_0x369d80);var _0x1d1865=util[_0x2cee('0xcf')]('transcript-%d-%s.zip',_0x526665[_0x2cee('0xb1')]['id'],_0x369d80);var _0xd018a6=path[_0x2cee('0xc9')](_0xe44179,_0x1d1865);var _0x45b272=[];_0x45b272['push']({'model':db[_0x2cee('0xd0')],'as':_0x2cee('0xd0'),'attributes':['id',_0x2cee('0x32')],'raw':!![]});_0x45b272[_0x2cee('0xae')]({'model':db['CmContact'],'as':_0x2cee('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x39371f=[{'model':db[_0x2cee('0xb9')],'as':'Messages','attributes':['id',_0x2cee('0xb6'),_0x2cee('0x77'),'direction','secret',_0x2cee('0x7e')],'include':_0x45b272}];_0x39371f[_0x2cee('0xae')]({'model':db[_0x2cee('0xd1')],'as':_0x2cee('0xd2'),'attributes':['id',_0x2cee('0x2f')]});_0x39371f[_0x2cee('0xae')]({'model':db[_0x2cee('0xd0')],'as':_0x2cee('0xd3'),'attributes':['id',_0x2cee('0x32')]});return db['SmsInteraction'][_0x2cee('0x60')]({'where':{'id':_0x526665[_0x2cee('0xb1')]['id']},'include':_0x39371f})[_0x2cee('0x2b')](handleEntityNotFound(_0x2ef63b,null))[_0x2cee('0x2b')](function(_0x908aa8){if(_0x908aa8){var _0x197fa3=_0x908aa8[_0x2cee('0xd4')]({'plain':!![]});fs[_0x2cee('0xd5')](_0x5da242);var _0x324843={'format':'A4','border':'10px','header':{'height':_0x2cee('0xd6'),'contents':{'first':_0x2cee('0xd7')}},'footer':{'height':_0x2cee('0xd8'),'contents':{'default':util[_0x2cee('0xcf')](_0x2cee('0xd9'),util[_0x2cee('0xcf')](_0x2cee('0xda'),'Sms',_0x197fa3['id']),moment()['format']('YYYY-MM-DD')[_0x2cee('0x98')]())}}};var _0x282410={'channel':_0x2cee('0xdb'),'account':_0x197fa3[_0x2cee('0xd2')][_0x2cee('0x2f')],'agent':_0x197fa3[_0x2cee('0xd3')]?_0x197fa3[_0x2cee('0xd3')]['fullname']:_0x2cee('0xdc'),'createdAt':moment(_0x197fa3[_0x2cee('0x77')])[_0x2cee('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2cee('0x98')](),'closedAt':_0x197fa3[_0x2cee('0xdd')]?moment(_0x197fa3[_0x2cee('0xde')])[_0x2cee('0xcf')](_0x2cee('0xbe'))['toString']():'','disposition':_0x197fa3[_0x2cee('0xdf')],'messages':_(_0x197fa3[_0x2cee('0xe0')])[_0x2cee('0xbd')]({'secret':![]})[_0x2cee('0x39')](function(_0x1f2b13){return{'date':moment(_0x1f2b13[_0x2cee('0x77')])['format'](_0x2cee('0xbe'))['toString'](),'sender':_0x1f2b13[_0x2cee('0xe1')]===_0x2cee('0xe2')?_0x1f2b13[_0x2cee('0xd0')]?_0x1f2b13[_0x2cee('0xd0')]['fullname']:_0x2cee('0xe3'):_0x1f2b13['Contact'][_0x2cee('0xe4')]+(_0x1f2b13[_0x2cee('0x63')]['lastName']?'\x20'+_0x1f2b13[_0x2cee('0x63')]['lastName']:''),'body':_0x1f2b13['body'],'direction':_0x1f2b13[_0x2cee('0xe1')]===_0x2cee('0xe2')?'A':'C','secret':_0x1f2b13[_0x2cee('0xe5')],'read':_0x1f2b13['read']};})['value']()};return ejs[_0x2cee('0xe6')](path[_0x2cee('0xc9')](config[_0x2cee('0xca')],'server',_0x2cee('0xe7'),'downloadInteraction.html'),{'interaction':_0x282410})[_0x2cee('0x2b')](function(_0x4091f9){return new BPromise(function(_0x4b6170,_0x2eae8c){pdf[_0x2cee('0xb5')](_0x4091f9,_0x324843)[_0x2cee('0xe8')](path['join'](_0x5da242,'transcript-'+_0x197fa3['id']+'-'+_0x369d80+_0x2cee('0xe9')),function(_0x3d91f7,_0x127a73){if(_0x3d91f7)return _0x2eae8c(_0x3d91f7);_0x4b6170(_0x127a73);});});})['then'](function(){return new BPromise(function(_0x337f4c,_0x5c90a3){zipdir(_0x5da242,{'saveTo':_0xd018a6},function(_0x387a6d,_0x54146b){if(_0x387a6d)return _0x5c90a3(_0x387a6d);return _0x337f4c(_0x54146b);});})[_0x2cee('0x2b')](function(){return new BPromise(function(_0x932457,_0x403404){rimraf(_0x5da242,function(_0x2a48a4){if(_0x2a48a4)_0x403404(_0x2a48a4);return _0x932457();});});})[_0x2cee('0x2b')](function(){return _0x2ef63b[_0x2cee('0xc7')](_0xd018a6,_0x1d1865,function(_0xce0b9e){if(_0xce0b9e){console[_0x2cee('0xea')](_0x2cee('0xeb'),_0xce0b9e);}else{fs[_0x2cee('0xec')](_0xd018a6);}});});});}else{return _0x2ef63b[_0x2cee('0x21')](0xc8);}})[_0x2cee('0x37')](handleError(_0x2ef63b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 11016ea..ff7a092 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 _0x85d0=['setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','SmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x85d0,0x164));var _0x085d=function(_0x405582,_0x4c2183){_0x405582=_0x405582-0x0;var _0x1b2650=_0x85d0[_0x405582];return _0x1b2650;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x085d('0x0')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x085d('0x1')](0x0);var events={'afterCreate':_0x085d('0x2'),'afterUpdate':_0x085d('0x3'),'afterDestroy':_0x085d('0x4')};function emitEvent(_0x19ae4c){return function(_0x4818c1,_0x2f37ca,_0x5c917f){_0x4818c1[_0x085d('0x5')]({'attributes':['id'],'raw':!![]})[_0x085d('0x6')](function(_0x2a6902){_0x4818c1['setDataValue'](_0x085d('0x7'),_0x2a6902[_0x085d('0x8')](function(_0x210aa0){return{'id':_0x210aa0['id']};}));return SmsMessage[_0x085d('0x9')]({'where':{'SmsInteractionId':_0x4818c1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x085d('0x6')](function(_0x6450ab){_0x4818c1[_0x085d('0xa')](_0x085d('0xb'),_0x6450ab[_0x085d('0xc')]);SmsInteractionEvents['emit'](_0x19ae4c+':'+_0x4818c1['id'],_0x4818c1);SmsInteractionEvents[_0x085d('0xd')](_0x19ae4c,_0x4818c1);_0x5c917f(null);})[_0x085d('0xe')](_0x5c917f(null));};}for(var e in events){if(events[_0x085d('0xf')](e)){var event=events[e];SmsInteraction[_0x085d('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x9c5a=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook'];(function(_0x13856b,_0x3060ef){var _0x120f29=function(_0x334c11){while(--_0x334c11){_0x13856b['push'](_0x13856b['shift']());}};_0x120f29(++_0x3060ef);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x475812,_0x30e811){_0x475812=_0x475812-0x0;var _0x36517c=_0x9c5a[_0x475812];return _0x36517c;};'use strict';var EventEmitter=require(_0xa9c5('0x0'));var SmsInteraction=require(_0xa9c5('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xa9c5('0x1'))['db'][_0xa9c5('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa9c5('0x3')](0x0);var events={'afterCreate':_0xa9c5('0x4'),'afterUpdate':'update','afterDestroy':_0xa9c5('0x5')};function emitEvent(_0x3051b1){return function(_0x4e9403,_0x1e3c83,_0x4d9c7a){_0x4e9403[_0xa9c5('0x6')]({'attributes':['id'],'raw':!![]})[_0xa9c5('0x7')](function(_0x4cb597){_0x4e9403['setDataValue'](_0xa9c5('0x8'),_0x4cb597[_0xa9c5('0x9')](function(_0x52afb2){return{'id':_0x52afb2['id']};}));return SmsMessage[_0xa9c5('0xa')]({'where':{'SmsInteractionId':_0x4e9403['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa9c5('0x7')](function(_0x51c14c){_0x4e9403[_0xa9c5('0xb')](_0xa9c5('0xc'),_0x51c14c['length']);SmsInteractionEvents['emit'](_0x3051b1+':'+_0x4e9403['id'],_0x4e9403);SmsInteractionEvents[_0xa9c5('0xd')](_0x3051b1,_0x4e9403);_0x4d9c7a(null);})[_0xa9c5('0xe')](_0x4d9c7a(null));};}for(var e in events){if(events[_0xa9c5('0xf')](e)){var event=events[e];SmsInteraction[_0xa9c5('0x10')](e,emitEvent(event));}}module[_0xa9c5('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index a4501bc..38a533d 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 _0x36c9=['request-promise','../../config/environment','./smsInteraction.attributes','exports','sms_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x44cc04,_0x488d9a){var _0x1f1b41=function(_0x3e61a4){while(--_0x3e61a4){_0x44cc04['push'](_0x44cc04['shift']());}};_0x1f1b41(++_0x488d9a);}(_0x36c9,0x1b5));var _0x936c=function(_0x1524e5,_0x3fbc03){_0x1524e5=_0x1524e5-0x0;var _0xfdf9bd=_0x36c9[_0x1524e5];return _0xfdf9bd;};'use strict';var _=require(_0x936c('0x0'));var util=require(_0x936c('0x1'));var logger=require(_0x936c('0x2'))(_0x936c('0x3'));var moment=require(_0x936c('0x4'));var BPromise=require('bluebird');var rp=require(_0x936c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x936c('0x6'));var attributes=require(_0x936c('0x7'));module[_0x936c('0x8')]=function(_0x48fe9e,_0x20abdc){return _0x48fe9e['define']('SmsInteraction',attributes,{'tableName':_0x936c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b5f85,_0x2816fe,_0x2e81f1){if(_0x4b5f85[_0x936c('0xa')]('closed')){_0x4b5f85['closedAt']=moment()[_0x936c('0xb')](_0x936c('0xc'));}_0x2e81f1(null,_0x4b5f85);}}});}; \ No newline at end of file +var _0x5a53=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','closedAt'];(function(_0x2f07c1,_0x54af34){var _0x55cdf2=function(_0xad8901){while(--_0xad8901){_0x2f07c1['push'](_0x2f07c1['shift']());}};_0x55cdf2(++_0x54af34);}(_0x5a53,0x1d2));var _0x35a5=function(_0x3bd6ae,_0x5265df){_0x3bd6ae=_0x3bd6ae-0x0;var _0x1cb74a=_0x5a53[_0x3bd6ae];return _0x1cb74a;};'use strict';var _=require(_0x35a5('0x0'));var util=require(_0x35a5('0x1'));var logger=require(_0x35a5('0x2'))(_0x35a5('0x3'));var moment=require(_0x35a5('0x4'));var BPromise=require(_0x35a5('0x5'));var rp=require(_0x35a5('0x6'));var fs=require('fs');var path=require(_0x35a5('0x7'));var rimraf=require(_0x35a5('0x8'));var config=require(_0x35a5('0x9'));var attributes=require(_0x35a5('0xa'));module['exports']=function(_0x2c4412,_0x3729b0){return _0x2c4412[_0x35a5('0xb')](_0x35a5('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x206801,_0x373810,_0x659beb){if(_0x206801['changed']('closed')){_0x206801[_0x35a5('0xd')]=moment()[_0x35a5('0xe')](_0x35a5('0xf'));}_0x659beb(null,_0x206801);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4c2ff93..6cfa653 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 _0x6b76=['request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','where','attributes','AddTagsToSmsInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x6b76,0x129));var _0x66b7=function(_0x39b245,_0x56a409){_0x39b245=_0x39b245-0x0;var _0x25ef04=_0x6b76[_0x39b245];return _0x25ef04;};'use strict';var _=require(_0x66b7('0x0'));var util=require(_0x66b7('0x1'));var moment=require('moment');var BPromise=require(_0x66b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66b7('0x3'));var db=require(_0x66b7('0x4'))['db'];var utils=require(_0x66b7('0x5'));var logger=require('../../config/logger')(_0x66b7('0x6'));var config=require(_0x66b7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66b7('0x8')]({'port':0x232a});config[_0x66b7('0x9')]=_[_0x66b7('0xa')](config[_0x66b7('0x9')],{'host':_0x66b7('0xb'),'port':0x18eb});var socket=require(_0x66b7('0xc'))(new Redis(config[_0x66b7('0x9')]));require(_0x66b7('0xd'))[_0x66b7('0xe')](socket);function respondWithRpcPromise(_0x128b26,_0x2e3c29,_0x3f0f2a){return new BPromise(function(_0x48bb57,_0x45fc48){return client[_0x66b7('0xf')](_0x128b26,_0x3f0f2a)[_0x66b7('0x10')](function(_0x2b0967){logger['info'](_0x66b7('0x11'),_0x2e3c29,_0x66b7('0x12'));logger[_0x66b7('0x13')](_0x66b7('0x14'),_0x2e3c29,_0x66b7('0x12'),JSON['stringify'](_0x2b0967));if(_0x2b0967[_0x66b7('0x15')]){if(_0x2b0967[_0x66b7('0x15')][_0x66b7('0x16')]===0x1f4){logger[_0x66b7('0x15')](_0x66b7('0x11'),_0x2e3c29,_0x2b0967[_0x66b7('0x15')][_0x66b7('0x17')]);return _0x45fc48(_0x2b0967[_0x66b7('0x15')][_0x66b7('0x17')]);}logger['error'](_0x66b7('0x11'),_0x2e3c29,_0x2b0967[_0x66b7('0x15')]['message']);return _0x48bb57(_0x2b0967[_0x66b7('0x15')]['message']);}else{logger[_0x66b7('0x18')](_0x66b7('0x11'),_0x2e3c29,_0x66b7('0x12'));_0x48bb57(_0x2b0967[_0x66b7('0x19')][_0x66b7('0x17')]);}})[_0x66b7('0x1a')](function(_0xcd78a0){logger['error'](_0x66b7('0x11'),_0x2e3c29,_0xcd78a0);_0x45fc48(_0xcd78a0);});});}exports[_0x66b7('0x1b')]=function(_0x418f27){var _0x2c2917=this;return new Promise(function(_0x5a1230,_0x102a9f){return db[_0x66b7('0x1c')]['update'](_0x418f27[_0x66b7('0x1d')],{'raw':_0x418f27['options']?_0x418f27[_0x66b7('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x418f27[_0x66b7('0x1e')]?_0x418f27[_0x66b7('0x1e')][_0x66b7('0x1f')]||null:null,'attributes':_0x418f27[_0x66b7('0x1e')]?_0x418f27[_0x66b7('0x1e')][_0x66b7('0x20')]||null:null,'limit':_0x418f27[_0x66b7('0x1e')]?_0x418f27[_0x66b7('0x1e')]['limit']||null:null})[_0x66b7('0x10')](function(_0x5f2231){logger[_0x66b7('0x18')](_0x66b7('0x1b'),_0x418f27);logger[_0x66b7('0x13')]('UpdateSmsInteraction',_0x418f27,JSON['stringify'](_0x5f2231));_0x5a1230(_0x5f2231);})[_0x66b7('0x1a')](function(_0x410e8e){logger[_0x66b7('0x15')](_0x66b7('0x1b'),_0x410e8e[_0x66b7('0x17')],_0x418f27);_0x102a9f(_0x2c2917['error'](0x1f4,_0x410e8e[_0x66b7('0x17')]));});});};exports[_0x66b7('0x21')]=function(_0x3c76ef){return new Promise(function(_0x28b814,_0x2bb91f){return db[_0x66b7('0x1c')][_0x66b7('0x22')]({'where':_0x3c76ef[_0x66b7('0x1e')]?_0x3c76ef[_0x66b7('0x1e')][_0x66b7('0x1f')]||null:null})[_0x66b7('0x10')](function(_0x4882f1){if(_0x4882f1){return _0x4882f1[_0x66b7('0x23')](_0x3c76ef[_0x66b7('0x1d')][_0x66b7('0x24')],_[_0x66b7('0x25')](_0x3c76ef[_0x66b7('0x1d')],['ids','id'])||{});}})['spread'](function(_0x146047){logger[_0x66b7('0x18')]('AddTags',_0x3c76ef);logger[_0x66b7('0x13')]('AddTags',_0x3c76ef,JSON['stringify'](_0x146047));_0x28b814(_0x146047);})[_0x66b7('0x1a')](function(_0x424205){logger[_0x66b7('0x15')](_0x66b7('0x26'),_0x424205[_0x66b7('0x17')],_0x3c76ef);_0x2bb91f(_this[_0x66b7('0x15')](0x1f4,_0x424205[_0x66b7('0x17')]));});});}; \ No newline at end of file +var _0xca4e=['SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsInteraction,\x20%s,\x20%s','message','info','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','catch','AddTagsToSmsInteraction','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','socket.io-emitter','./smsInteraction.socket','register','request','then','request\x20sent','debug'];(function(_0x5a2655,_0x3e36c3){var _0x4ddb50=function(_0x484f5e){while(--_0x484f5e){_0x5a2655['push'](_0x5a2655['shift']());}};_0x4ddb50(++_0x3e36c3);}(_0xca4e,0x1af));var _0xeca4=function(_0x6c1af5,_0x2e04ff){_0x6c1af5=_0x6c1af5-0x0;var _0x1c6187=_0xca4e[_0x6c1af5];return _0x1c6187;};'use strict';var _=require(_0xeca4('0x0'));var util=require(_0xeca4('0x1'));var moment=require(_0xeca4('0x2'));var BPromise=require(_0xeca4('0x3'));var rs=require(_0xeca4('0x4'));var fs=require('fs');var Redis=require(_0xeca4('0x5'));var db=require(_0xeca4('0x6'))['db'];var utils=require(_0xeca4('0x7'));var logger=require(_0xeca4('0x8'))(_0xeca4('0x9'));var config=require(_0xeca4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xeca4('0xb')]['http']({'port':0x232a});config[_0xeca4('0xc')]=_['defaults'](config[_0xeca4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeca4('0xd'))(new Redis(config[_0xeca4('0xc')]));require(_0xeca4('0xe'))[_0xeca4('0xf')](socket);function respondWithRpcPromise(_0xf54445,_0x182dd8,_0x9cb051){return new BPromise(function(_0x1c10cc,_0x53eb49){return client[_0xeca4('0x10')](_0xf54445,_0x9cb051)[_0xeca4('0x11')](function(_0x5768d2){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x182dd8,_0xeca4('0x12'));logger[_0xeca4('0x13')](_0xeca4('0x14'),_0x182dd8,_0xeca4('0x12'),JSON[_0xeca4('0x15')](_0x5768d2));if(_0x5768d2['error']){if(_0x5768d2['error'][_0xeca4('0x16')]===0x1f4){logger[_0xeca4('0x17')](_0xeca4('0x18'),_0x182dd8,_0x5768d2[_0xeca4('0x17')][_0xeca4('0x19')]);return _0x53eb49(_0x5768d2['error'][_0xeca4('0x19')]);}logger[_0xeca4('0x17')](_0xeca4('0x18'),_0x182dd8,_0x5768d2[_0xeca4('0x17')][_0xeca4('0x19')]);return _0x1c10cc(_0x5768d2[_0xeca4('0x17')][_0xeca4('0x19')]);}else{logger[_0xeca4('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x182dd8,_0xeca4('0x12'));_0x1c10cc(_0x5768d2['result']['message']);}})['catch'](function(_0x111630){logger[_0xeca4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x182dd8,_0x111630);_0x53eb49(_0x111630);});});}exports[_0xeca4('0x1b')]=function(_0x414a40){var _0x3cb8d9=this;return new Promise(function(_0xe7cca4,_0x40de2d){return db[_0xeca4('0x1c')][_0xeca4('0x1d')](_0x414a40[_0xeca4('0x1e')],{'raw':_0x414a40[_0xeca4('0x1f')]?_0x414a40[_0xeca4('0x1f')][_0xeca4('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414a40['options']?_0x414a40['options'][_0xeca4('0x21')]||null:null,'attributes':_0x414a40[_0xeca4('0x1f')]?_0x414a40['options']['attributes']||null:null,'limit':_0x414a40[_0xeca4('0x1f')]?_0x414a40['options'][_0xeca4('0x22')]||null:null})[_0xeca4('0x11')](function(_0x294bac){logger[_0xeca4('0x1a')](_0xeca4('0x1b'),_0x414a40);logger[_0xeca4('0x13')]('UpdateSmsInteraction',_0x414a40,JSON['stringify'](_0x294bac));_0xe7cca4(_0x294bac);})[_0xeca4('0x23')](function(_0x33e6d1){logger[_0xeca4('0x17')](_0xeca4('0x1b'),_0x33e6d1['message'],_0x414a40);_0x40de2d(_0x3cb8d9['error'](0x1f4,_0x33e6d1[_0xeca4('0x19')]));});});};exports[_0xeca4('0x24')]=function(_0x26a025){return new Promise(function(_0x15ee92,_0x2ee820){return db['SmsInteraction']['find']({'where':_0x26a025[_0xeca4('0x1f')]?_0x26a025[_0xeca4('0x1f')][_0xeca4('0x21')]||null:null})['then'](function(_0x105ad6){if(_0x105ad6){return _0x105ad6[_0xeca4('0x25')](_0x26a025[_0xeca4('0x1e')][_0xeca4('0x26')],_['omit'](_0x26a025[_0xeca4('0x1e')],[_0xeca4('0x26'),'id'])||{});}})[_0xeca4('0x27')](function(_0x1da495){logger[_0xeca4('0x1a')]('AddTags',_0x26a025);logger[_0xeca4('0x13')](_0xeca4('0x28'),_0x26a025,JSON[_0xeca4('0x15')](_0x1da495));_0x15ee92(_0x1da495);})[_0xeca4('0x23')](function(_0x57c5c4){logger['error'](_0xeca4('0x28'),_0x57c5c4['message'],_0x26a025);_0x2ee820(_this[_0xeca4('0x17')](0x1f4,_0x57c5c4[_0xeca4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index dec2b03..4a24002 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 _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0xec80e9,_0x5e008f){var _0xa34342=function(_0xab2ddd){while(--_0xab2ddd){_0xec80e9['push'](_0xec80e9['shift']());}};_0xa34342(++_0x5e008f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file +var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x20bfdf,_0x3ace97){var _0x5e117d=function(_0x58c872){while(--_0x58c872){_0x20bfdf['push'](_0x20bfdf['shift']());}};_0x5e117d(++_0x3ace97);}(_0x757a,0xde));var _0xa757=function(_0x13fba5,_0x20a762){_0x13fba5=_0x13fba5-0x0;var _0xe66b24=_0x757a[_0x13fba5];return _0xe66b24;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a6b4a00..8488a24 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 _0xa407=['isAuthenticated','index','describe','post','tracked','smsmessage:create','/:id/status','status','/:id','update','put','accept','/:id/reject','reject','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x228f8d,_0x146144){var _0x249899=function(_0x4cfbfc){while(--_0x4cfbfc){_0x228f8d['push'](_0x228f8d['shift']());}};_0x249899(++_0x146144);}(_0xa407,0x83));var _0x7a40=function(_0x521693,_0x43f177){_0x521693=_0x521693-0x0;var _0x5c79f6=_0xa407[_0x521693];return _0x5c79f6;};'use strict';var multer=require('multer');var util=require(_0x7a40('0x0'));var path=require(_0x7a40('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a40('0x2')]();var auth=require(_0x7a40('0x3'));var interaction=require(_0x7a40('0x4'));var config=require(_0x7a40('0x5'));var controller=require('./smsMessage.controller');router[_0x7a40('0x6')]('/',auth[_0x7a40('0x7')](),controller[_0x7a40('0x8')]);router['get']('/describe',auth[_0x7a40('0x7')](),controller[_0x7a40('0x9')]);router['get']('/:id',auth[_0x7a40('0x7')](),controller['show']);router[_0x7a40('0xa')]('/',auth[_0x7a40('0x7')](),interaction[_0x7a40('0xb')]('sms',_0x7a40('0xc')),controller['create']);router[_0x7a40('0xa')](_0x7a40('0xd'),controller[_0x7a40('0xe')]);router['put'](_0x7a40('0xf'),auth[_0x7a40('0x7')](),controller[_0x7a40('0x10')]);router[_0x7a40('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x7a40('0x12')]);router[_0x7a40('0x11')](_0x7a40('0x13'),auth[_0x7a40('0x7')](),controller[_0x7a40('0x14')]);router[_0x7a40('0x15')](_0x7a40('0xf'),auth[_0x7a40('0x7')](),controller[_0x7a40('0x16')]);module['exports']=router; \ No newline at end of file +var _0x12db=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','describe','isAuthenticated','show','post','sms','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path'];(function(_0x4f32de,_0x5bd4a){var _0x149821=function(_0x205885){while(--_0x205885){_0x4f32de['push'](_0x4f32de['shift']());}};_0x149821(++_0x5bd4a);}(_0x12db,0x99));var _0xb12d=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x12db[_0xa9a245];return _0x2d0eaa;};'use strict';var multer=require(_0xb12d('0x0'));var util=require(_0xb12d('0x1'));var path=require(_0xb12d('0x2'));var timeout=require(_0xb12d('0x3'));var express=require(_0xb12d('0x4'));var router=express[_0xb12d('0x5')]();var auth=require(_0xb12d('0x6'));var interaction=require(_0xb12d('0x7'));var config=require('../../config/environment');var controller=require(_0xb12d('0x8'));router[_0xb12d('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb12d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb12d('0xa')]);router['get']('/:id',auth[_0xb12d('0xb')](),controller[_0xb12d('0xc')]);router[_0xb12d('0xd')]('/',auth[_0xb12d('0xb')](),interaction['tracked'](_0xb12d('0xe'),'smsmessage:create'),controller[_0xb12d('0xf')]);router[_0xb12d('0xd')](_0xb12d('0x10'),controller[_0xb12d('0x11')]);router[_0xb12d('0x12')](_0xb12d('0x13'),auth['isAuthenticated'](),controller[_0xb12d('0x14')]);router[_0xb12d('0x12')](_0xb12d('0x15'),auth[_0xb12d('0xb')](),controller[_0xb12d('0x16')]);router['put'](_0xb12d('0x17'),auth[_0xb12d('0xb')](),controller['reject']);router['delete'](_0xb12d('0x13'),auth[_0xb12d('0xb')](),controller[_0xb12d('0x18')]);module[_0xb12d('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index caed5c0..60265ea 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 _0x93e7=['medium','BOOLEAN','out','STRING','exports'];(function(_0x53aa47,_0x15a3e3){var _0x56873c=function(_0x3df641){while(--_0x3df641){_0x53aa47['push'](_0x53aa47['shift']());}};_0x56873c(++_0x15a3e3);}(_0x93e7,0x13a));var _0x793e=function(_0x2ef251,_0x3687e5){_0x2ef251=_0x2ef251-0x0;var _0x5c931b=_0x93e7[_0x2ef251];return _0x5c931b;};'use strict';var Sequelize=require('sequelize');module[_0x793e('0x0')]={'body':{'type':Sequelize['TEXT'](_0x793e('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x793e('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x793e('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x793e('0x4')](0xbe)},'phone':{'type':Sequelize[_0x793e('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbcd1=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbcd1,0x1ed));var _0x1bcd=function(_0x4db898,_0x53c18a){_0x4db898=_0x4db898-0x0;var _0x284228=_0xbcd1[_0x4db898];return _0x284228;};'use strict';var Sequelize=require(_0x1bcd('0x0'));module[_0x1bcd('0x1')]={'body':{'type':Sequelize[_0x1bcd('0x2')](_0x1bcd('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1bcd('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1bcd('0x5')]('in','out'),'defaultValue':_0x1bcd('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1bcd('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1bcd('0x8')]},'secret':{'type':Sequelize[_0x1bcd('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1ee0f4c..5e5cfd8 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 _0x0a2e=['send','index','SmsMessage','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','show','params','rawAttributes','filtears','includeAll','options','create','body','find','describe','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','channel','event','EventManager','acceptmessage','agent','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','reject','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','plivio','infobip','results','groupName','DELIVERED','html-pdf','fast-json-patch','request-promise','moment','bluebird','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','apply','save','update','destroy','stack','name'];(function(_0x5954f6,_0x4621f6){var _0x592446=function(_0x397a11){while(--_0x397a11){_0x5954f6['push'](_0x5954f6['shift']());}};_0x592446(++_0x4621f6);}(_0x0a2e,0x176));var _0xe0a2=function(_0x3817a9,_0x29e215){_0x3817a9=_0x3817a9-0x0;var _0x443f30=_0x0a2e[_0x3817a9];return _0x443f30;};'use strict';var pdf=require(_0xe0a2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe0a2('0x1'));var rp=require(_0xe0a2('0x2'));var moment=require(_0xe0a2('0x3'));var BPromise=require(_0xe0a2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe0a2('0x5'));var sox=require(_0xe0a2('0x6'));var csv=require(_0xe0a2('0x7'));var ejs=require(_0xe0a2('0x8'));var fs=require('fs');var _=require(_0xe0a2('0x9'));var squel=require(_0xe0a2('0xa'));var crypto=require(_0xe0a2('0xb'));var jsforce=require(_0xe0a2('0xc'));var deskjs=require(_0xe0a2('0xd'));var toCsv=require(_0xe0a2('0x7'));var querystring=require(_0xe0a2('0xe'));var Papa=require(_0xe0a2('0xf'));var Redis=require(_0xe0a2('0x10'));var authService=require(_0xe0a2('0x11'));var qs=require(_0xe0a2('0x12'));var as=require(_0xe0a2('0x13'));var hardwareService=require(_0xe0a2('0x14'));var logger=require(_0xe0a2('0x15'))(_0xe0a2('0x16'));var utils=require(_0xe0a2('0x17'));var config=require(_0xe0a2('0x18'));var licenseUtil=require(_0xe0a2('0x19'));var db=require(_0xe0a2('0x1a'))['db'];config[_0xe0a2('0x1b')]=_[_0xe0a2('0x1c')](config[_0xe0a2('0x1b')],{'host':_0xe0a2('0x1d'),'port':0x18eb});var socket=require(_0xe0a2('0x1e'))(new Redis(config[_0xe0a2('0x1b')]));require(_0xe0a2('0x1f'))[_0xe0a2('0x20')](socket);var jayson=require(_0xe0a2('0x21'));var client=jayson[_0xe0a2('0x22')][_0xe0a2('0x23')]({'port':0x232c});var client9002=jayson[_0xe0a2('0x22')][_0xe0a2('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x75daf6,_0x1d3aaa,_0x3c34d8,_0x769e30){return new BPromise(function(_0x58f9db,_0x3ea7d7){var _0x59b709=_0x769e30||client;return _0x59b709['request'](_0x75daf6,_0x3c34d8)[_0xe0a2('0x24')](function(_0x1a7f0c){logger[_0xe0a2('0x25')](_0xe0a2('0x26'),_0x1d3aaa,'request\x20sent');logger['debug'](_0xe0a2('0x27'),_0x1d3aaa,'request\x20sent',JSON[_0xe0a2('0x28')](_0x1a7f0c));if(_0x1a7f0c['error']){if(_0x1a7f0c[_0xe0a2('0x29')]['code']===0x1f4){logger[_0xe0a2('0x29')](_0xe0a2('0x26'),_0x1d3aaa,_0x1a7f0c[_0xe0a2('0x29')][_0xe0a2('0x2a')]);return _0x3ea7d7(_0x1a7f0c[_0xe0a2('0x29')]['message']);}logger[_0xe0a2('0x29')](_0xe0a2('0x26'),_0x1d3aaa,_0x1a7f0c[_0xe0a2('0x29')]['message']);return _0x58f9db(_0x1a7f0c[_0xe0a2('0x29')][_0xe0a2('0x2a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x1d3aaa,'request\x20sent');_0x58f9db(_0x1a7f0c[_0xe0a2('0x2b')][_0xe0a2('0x2a')]);}})[_0xe0a2('0x2c')](function(_0x3215e2){logger[_0xe0a2('0x29')](_0xe0a2('0x26'),_0x1d3aaa,_0x3215e2);_0x3ea7d7(_0x3215e2);});});}function respondWithStatusCode(_0x2dd99c,_0x4cabf1){_0x4cabf1=_0x4cabf1||0xcc;return function(_0x319070){if(_0x319070){return _0x2dd99c[_0xe0a2('0x2d')](_0x4cabf1);}return _0x2dd99c['status'](_0x4cabf1)[_0xe0a2('0x2e')]();};}function respondWithResult(_0x4f90a6,_0x1fcd1d){_0x1fcd1d=_0x1fcd1d||0xc8;return function(_0x5845e6){if(_0x5845e6){return _0x4f90a6[_0xe0a2('0x2f')](_0x1fcd1d)[_0xe0a2('0x30')](_0x5845e6);}};}function respondWithFilteredResult(_0x1743fe,_0x576998){return function(_0x52bfe7){if(_0x52bfe7){var _0x3dff80=_0x52bfe7['count'],_0x228407=_0x576998[_0xe0a2('0x31')],_0x4e16c1=_0x576998[_0xe0a2('0x31')]+_0x576998[_0xe0a2('0x32')],_0x386b8e;if(_0x4e16c1>=_0x3dff80){_0x4e16c1=_0x3dff80;_0x386b8e=0xc8;}else{_0x386b8e=0xce;}_0x1743fe[_0xe0a2('0x2f')](_0x386b8e);return _0x1743fe[_0xe0a2('0x33')]('Content-Range',_0x228407+'-'+_0x4e16c1+'/'+_0x3dff80)[_0xe0a2('0x30')](_0x52bfe7);}return null;};}function patchUpdates(_0xb9f37c){return function(_0xe676f9){try{jsonpatch[_0xe0a2('0x34')](_0xe676f9,_0xb9f37c,!![]);}catch(_0x12eddd){return BPromise['reject'](_0x12eddd);}return _0xe676f9[_0xe0a2('0x35')]();};}function saveUpdates(_0xf168c8,_0x42be4b){return function(_0x33f780){if(_0x33f780){return _0x33f780[_0xe0a2('0x36')](_0xf168c8)[_0xe0a2('0x24')](function(_0x228c2a){return _0x228c2a;});}return null;};}function removeEntity(_0x13905d,_0x833079){return function(_0x1d19d2){if(_0x1d19d2){return _0x1d19d2[_0xe0a2('0x37')]()[_0xe0a2('0x24')](function(){_0x13905d[_0xe0a2('0x2f')](0xcc)[_0xe0a2('0x2e')]();});}};}function handleEntityNotFound(_0x312651,_0x43b544){return function(_0x4a199b){if(!_0x4a199b){_0x312651[_0xe0a2('0x2d')](0x194);}return _0x4a199b;};}function handleError(_0x5c44be,_0x517317){_0x517317=_0x517317||0x1f4;return function(_0x36f438){logger[_0xe0a2('0x29')](_0x36f438[_0xe0a2('0x38')]);if(_0x36f438[_0xe0a2('0x39')]){delete _0x36f438['name'];}_0x5c44be[_0xe0a2('0x2f')](_0x517317)[_0xe0a2('0x3a')](_0x36f438);};}exports[_0xe0a2('0x3b')]=function(_0xd82717,_0x54de12){var _0x529359={},_0x410cc1={},_0x177fad={'count':0x0,'rows':[]};var _0x5bf40f=_['map'](db[_0xe0a2('0x3c')]['rawAttributes'],function(_0x1d0427){return{'name':_0x1d0427[_0xe0a2('0x3d')],'type':_0x1d0427[_0xe0a2('0x3e')][_0xe0a2('0x3f')]};});_0x410cc1[_0xe0a2('0x40')]=_[_0xe0a2('0x41')](_0x5bf40f,'name');_0x410cc1[_0xe0a2('0x42')]=_[_0xe0a2('0x43')](_0xd82717[_0xe0a2('0x42')]);_0x410cc1[_0xe0a2('0x44')]=_[_0xe0a2('0x45')](_0x410cc1[_0xe0a2('0x40')],_0x410cc1['query']);_0x529359['attributes']=_[_0xe0a2('0x45')](_0x410cc1[_0xe0a2('0x40')],qs[_0xe0a2('0x46')](_0xd82717['query'][_0xe0a2('0x46')]));_0x529359[_0xe0a2('0x47')]=_0x529359[_0xe0a2('0x47')][_0xe0a2('0x48')]?_0x529359[_0xe0a2('0x47')]:_0x410cc1[_0xe0a2('0x40')];if(!_0xd82717[_0xe0a2('0x42')]['hasOwnProperty'](_0xe0a2('0x49'))){_0x529359[_0xe0a2('0x32')]=qs[_0xe0a2('0x32')](_0xd82717['query']['limit']);_0x529359[_0xe0a2('0x31')]=qs[_0xe0a2('0x31')](_0xd82717[_0xe0a2('0x42')][_0xe0a2('0x31')]);}_0x529359[_0xe0a2('0x4a')]=qs['sort'](_0xd82717[_0xe0a2('0x42')][_0xe0a2('0x4b')]);_0x529359['where']=qs['filters'](_[_0xe0a2('0x4c')](_0xd82717['query'],_0x410cc1[_0xe0a2('0x44')]),_0x5bf40f);if(_0xd82717[_0xe0a2('0x42')][_0xe0a2('0x4d')]){_0x529359[_0xe0a2('0x4e')]=_[_0xe0a2('0x4f')](_0x529359[_0xe0a2('0x4e')],{'$or':_[_0xe0a2('0x41')](_0x5bf40f,function(_0x5036fd){if(_0x5036fd[_0xe0a2('0x3e')]!==_0xe0a2('0x50')){var _0x43f65c={};_0x43f65c[_0x5036fd[_0xe0a2('0x39')]]={'$like':'%'+_0xd82717[_0xe0a2('0x42')][_0xe0a2('0x4d')]+'%'};return _0x43f65c;}})});}_0x529359=_[_0xe0a2('0x4f')]({},_0x529359,_0xd82717['options']);var _0x2f9d2f={'where':_0x529359[_0xe0a2('0x4e')]};return db['SmsMessage'][_0xe0a2('0x51')](_0x2f9d2f)[_0xe0a2('0x24')](function(_0x193ad4){_0x177fad[_0xe0a2('0x51')]=_0x193ad4;if(_0xd82717[_0xe0a2('0x42')]['includeAll']){_0x529359[_0xe0a2('0x52')]=[{'all':!![]}];}return db[_0xe0a2('0x3c')][_0xe0a2('0x53')](_0x529359);})['then'](function(_0x4b0c79){_0x177fad['rows']=_0x4b0c79;return _0x177fad;})[_0xe0a2('0x24')](respondWithFilteredResult(_0x54de12,_0x529359))[_0xe0a2('0x2c')](handleError(_0x54de12,null));};exports[_0xe0a2('0x54')]=function(_0x1a0822,_0x5e7c7c){var _0x129b73={'raw':!![],'where':{'id':_0x1a0822[_0xe0a2('0x55')]['id']}},_0x31553e={};_0x31553e[_0xe0a2('0x40')]=_[_0xe0a2('0x43')](db[_0xe0a2('0x3c')][_0xe0a2('0x56')]);_0x31553e[_0xe0a2('0x42')]=_[_0xe0a2('0x43')](_0x1a0822[_0xe0a2('0x42')]);_0x31553e[_0xe0a2('0x57')]=_[_0xe0a2('0x45')](_0x31553e[_0xe0a2('0x40')],_0x31553e[_0xe0a2('0x42')]);_0x129b73[_0xe0a2('0x47')]=_[_0xe0a2('0x45')](_0x31553e[_0xe0a2('0x40')],qs[_0xe0a2('0x46')](_0x1a0822[_0xe0a2('0x42')]['fields']));_0x129b73[_0xe0a2('0x47')]=_0x129b73['attributes'][_0xe0a2('0x48')]?_0x129b73[_0xe0a2('0x47')]:_0x31553e[_0xe0a2('0x40')];if(_0x1a0822[_0xe0a2('0x42')][_0xe0a2('0x58')]){_0x129b73[_0xe0a2('0x52')]=[{'all':!![]}];}_0x129b73=_['merge']({},_0x129b73,_0x1a0822[_0xe0a2('0x59')]);return db['SmsMessage']['find'](_0x129b73)['then'](handleEntityNotFound(_0x5e7c7c,null))['then'](respondWithResult(_0x5e7c7c,null))[_0xe0a2('0x2c')](handleError(_0x5e7c7c,null));};exports[_0xe0a2('0x5a')]=function(_0x483f2b,_0x59ad75){return db[_0xe0a2('0x3c')]['create'](_0x483f2b[_0xe0a2('0x5b')],{})[_0xe0a2('0x24')](respondWithResult(_0x59ad75,0xc9))[_0xe0a2('0x2c')](handleError(_0x59ad75,null));};exports[_0xe0a2('0x36')]=function(_0x1a2424,_0x4641d8){if(_0x1a2424[_0xe0a2('0x5b')]['id']){delete _0x1a2424['body']['id'];}return db[_0xe0a2('0x3c')][_0xe0a2('0x5c')]({'where':{'id':_0x1a2424['params']['id']}})[_0xe0a2('0x24')](handleEntityNotFound(_0x4641d8,null))[_0xe0a2('0x24')](saveUpdates(_0x1a2424['body'],null))[_0xe0a2('0x24')](respondWithResult(_0x4641d8,null))[_0xe0a2('0x2c')](handleError(_0x4641d8,null));};exports[_0xe0a2('0x37')]=function(_0x1eb33b,_0x44e149){return db['SmsMessage']['find']({'where':{'id':_0x1eb33b['params']['id']}})['then'](handleEntityNotFound(_0x44e149,null))['then'](removeEntity(_0x44e149,null))['catch'](handleError(_0x44e149,null));};exports[_0xe0a2('0x5d')]=function(_0xe6977d,_0x4302be){return db['SmsMessage'][_0xe0a2('0x5d')]()[_0xe0a2('0x24')](respondWithResult(_0x4302be,null))['catch'](handleError(_0x4302be,null));};var interaction_log=require('../../config/logger')(_0xe0a2('0x5e'));exports[_0xe0a2('0x5f')]=function(_0x3f3a58,_0x2a1606,_0x38f9e6){var _0x474182={'channel':_0xe0a2('0x60')};if(_0x3f3a58[_0xe0a2('0x5b')]['id']){delete _0x3f3a58[_0xe0a2('0x5b')]['id'];}_0x3f3a58[_0xe0a2('0x5b')][_0xe0a2('0x61')]=!![];_0x3f3a58['body']['readAt']=moment()[_0xe0a2('0x62')](_0xe0a2('0x63'));_0x3f3a58[_0xe0a2('0x5b')][_0xe0a2('0x64')]=_0x3f3a58[_0xe0a2('0x5b')][_0xe0a2('0x64')]||_0x3f3a58[_0xe0a2('0x65')]['id'];return db[_0xe0a2('0x3c')][_0xe0a2('0x5c')]({'where':{'id':_0x3f3a58[_0xe0a2('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xe0a2('0x66')],'as':_0xe0a2('0x67')}]})[_0xe0a2('0x24')](handleEntityNotFound(_0x2a1606,null))[_0xe0a2('0x24')](saveUpdates(_0x3f3a58[_0xe0a2('0x5b')],null))[_0xe0a2('0x24')](function(_0x21facb){if(_0x21facb){_0x474182['message']=_0x21facb[_0xe0a2('0x68')]({'plain':!![]});return db[_0xe0a2('0x69')][_0xe0a2('0x5c')]({'where':{'id':_0x21facb[_0xe0a2('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x2a1606,null))[_0xe0a2('0x24')](function(_0x3f4dff){if(_0x3f4dff){return _0x3f4dff[_0xe0a2('0x36')]({'UserId':_0x3f3a58['body'][_0xe0a2('0x64')],'read1stAt':_[_0xe0a2('0x6b')](_0x3f4dff['read1stAt'])?moment()[_0xe0a2('0x62')](_0xe0a2('0x63')):undefined});}return null;})[_0xe0a2('0x24')](function(_0x2da3be){if(_0x2da3be){_0x474182['interaction']=_0x2da3be[_0xe0a2('0x68')]({'plain':!![]});interaction_log[_0xe0a2('0x25')](_0xe0a2('0x6c'),_0x3f3a58[_0xe0a2('0x65')]['id'],_0x3f3a58[_0xe0a2('0x65')]['name'],_0x3f3a58['user'][_0xe0a2('0x6d')],_0x474182['interaction']['id'],_0x3f3a58[_0xe0a2('0x5b')]?JSON[_0xe0a2('0x28')](_0x3f3a58[_0xe0a2('0x5b')]):_0xe0a2('0x6e'));return respondWithRpcPromise(_0xe0a2('0x6f'),'acceptMessage',_0x474182);}return null;})[_0xe0a2('0x24')](function(_0x3339cd){if(_0x3339cd){if(_0x3f3a58[_0xe0a2('0x5b')][_0xe0a2('0x70')]){_0x474182[_0xe0a2('0x2a')]['interface']=util[_0xe0a2('0x62')]('SIP/%s',_0x3f3a58[_0xe0a2('0x65')][_0xe0a2('0x39')]);_0x474182[_0xe0a2('0x2a')][_0xe0a2('0x71')]=_0x474182[_0xe0a2('0x71')];_0x474182[_0xe0a2('0x2a')][_0xe0a2('0x72')]=_0xe0a2('0x5f');return respondWithRpcPromise(_0xe0a2('0x73'),_0xe0a2('0x73'),{'event':_0xe0a2('0x74'),'message':_0x474182[_0xe0a2('0x2a')]},client9002)[_0xe0a2('0x24')](function(){return _0x474182;});}return _0x474182;}return null;})[_0xe0a2('0x24')](respondWithResult(_0x2a1606,null))[_0xe0a2('0x2c')](handleError(_0x2a1606,null));};var interaction_log=require(_0xe0a2('0x15'))('sms-interactions');exports['reject']=function(_0x39a57d,_0x473256,_0x58f4e5){var _0x340052={'agent':{},'channel':_0xe0a2('0x60')};if(_0x39a57d['body']['id']){delete _0x39a57d[_0xe0a2('0x5b')]['id'];}_0x39a57d['body'][_0xe0a2('0x64')]=_0x39a57d[_0xe0a2('0x5b')][_0xe0a2('0x64')]||_0x39a57d[_0xe0a2('0x65')]['id'];_0x340052[_0xe0a2('0x75')]['id']=_0x39a57d[_0xe0a2('0x5b')][_0xe0a2('0x64')];return db[_0xe0a2('0x3c')][_0xe0a2('0x5c')]({'where':{'id':_0x39a57d[_0xe0a2('0x55')]['id'],'UserId':null}})[_0xe0a2('0x24')](handleEntityNotFound(_0x473256,null))[_0xe0a2('0x24')](function(_0xf24d1d){if(_0xf24d1d){_0x340052['message']=_0xf24d1d[_0xe0a2('0x68')]({'plain':!![]});return db['SmsInteraction'][_0xe0a2('0x5c')]({'where':{'id':_0xf24d1d[_0xe0a2('0x6a')]}});}return null;})[_0xe0a2('0x24')](handleEntityNotFound(_0x473256,null))[_0xe0a2('0x24')](function(_0x3eae2a){if(_0x3eae2a){_0x340052[_0xe0a2('0x76')]=_0x3eae2a[_0xe0a2('0x68')]({'plain':!![]});interaction_log[_0xe0a2('0x25')](_0xe0a2('0x77'),_0x39a57d[_0xe0a2('0x65')]['id'],_0x39a57d['user'][_0xe0a2('0x39')],_0x39a57d[_0xe0a2('0x65')]['role'],_0x340052[_0xe0a2('0x76')]['id'],_0x39a57d[_0xe0a2('0x5b')]?JSON[_0xe0a2('0x28')](_0x39a57d['body']):'null');return respondWithRpcPromise(_0xe0a2('0x78'),_0xe0a2('0x79'),_0x340052);}return null;})[_0xe0a2('0x24')](function(_0x1ef8e9){if(_0x1ef8e9){_0x1ef8e9[_0xe0a2('0x2a')][_0xe0a2('0x7a')]=util[_0xe0a2('0x62')](_0xe0a2('0x7b'),_0x39a57d[_0xe0a2('0x65')]['name']);_0x1ef8e9['message'][_0xe0a2('0x71')]=_0x340052[_0xe0a2('0x71')];_0x1ef8e9[_0xe0a2('0x2a')][_0xe0a2('0x72')]=_0xe0a2('0x7c');respondWithRpcPromise(_0xe0a2('0x73'),'EventManager',{'event':_0xe0a2('0x7d'),'message':_0x1ef8e9['message']},client9002);return _0x340052;}return null;})['then'](respondWithResult(_0x473256,null))[_0xe0a2('0x2c')](handleError(_0x473256,null));};exports[_0xe0a2('0x2f')]=function(_0x55b633,_0x1faccd,_0x128948){if(_0x55b633[_0xe0a2('0x5b')]['id']){delete _0x55b633[_0xe0a2('0x5b')]['id'];}var _0x12f6f0;return db['SmsMessage'][_0xe0a2('0x5c')]({'where':{'id':_0x55b633[_0xe0a2('0x55')]['id']}})[_0xe0a2('0x24')](handleEntityNotFound(_0x1faccd,null))['then'](function(_0x14269a){if(_0x14269a){_0x12f6f0=_0x14269a;return db[_0xe0a2('0x7e')][_0xe0a2('0x5c')]({'where':{'id':_0x14269a[_0xe0a2('0x7f')]}});}})[_0xe0a2('0x24')](handleEntityNotFound(_0x1faccd,null))[_0xe0a2('0x24')](function(_0x1bfcde){if(_0x1bfcde){logger[_0xe0a2('0x80')](_0xe0a2('0x27'),_0xe0a2('0x2f'),_0xe0a2('0x81'),_0x1bfcde[_0xe0a2('0x3e')],util[_0xe0a2('0x82')](_0x55b633[_0xe0a2('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1bfcde[_0xe0a2('0x3e')]){case _0xe0a2('0x83'):if(_0x55b633[_0xe0a2('0x5b')][_0xe0a2('0x84')]&&_0x55b633[_0xe0a2('0x5b')][_0xe0a2('0x84')]===_0x12f6f0[_0xe0a2('0x85')]){return _0x12f6f0['update']({'read':!![]});}else{logger['error'](_0xe0a2('0x86'),_0xe0a2('0x2f'),_0xe0a2('0x83'),util[_0xe0a2('0x82')](_0x55b633[_0xe0a2('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe0a2('0x87'):if(_0x55b633[_0xe0a2('0x5b')][_0xe0a2('0x88')]&&_0x55b633[_0xe0a2('0x5b')][_0xe0a2('0x88')]===_0x12f6f0[_0xe0a2('0x85')]&&_[_0xe0a2('0x89')](['sent',_0xe0a2('0x8a')],_0x55b633['body']['Status'])>=0x0){return _0x12f6f0[_0xe0a2('0x36')]({'read':!![]});}else{logger[_0xe0a2('0x29')](_0xe0a2('0x86'),_0xe0a2('0x2f'),_0xe0a2('0x8b'),util['inspect'](_0x55b633['body'],{'showHidden':![],'depth':null}));}break;case _0xe0a2('0x8c'):var _0x5d4a9e=_0x55b633[_0xe0a2('0x5b')][_0xe0a2('0x8d')][0x0];if(_0x5d4a9e[_0xe0a2('0x2f')][_0xe0a2('0x8e')]===_0xe0a2('0x8f')){return _0x12f6f0[_0xe0a2('0x36')]({'read':!![]});}else{logger['error'](_0xe0a2('0x86'),_0xe0a2('0x2f'),_0xe0a2('0x8c'),util[_0xe0a2('0x82')](_0x55b633[_0xe0a2('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x12f6f0;}})[_0xe0a2('0x24')](respondWithResult(_0x1faccd,null))[_0xe0a2('0x2c')](handleError(_0x1faccd,null));}; \ No newline at end of file +var _0xfe53=['options','includeAll','include','rows','params','filtears','find','create','body','destroy','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','Contact','get','SmsInteraction','SmsInteractionId','UserId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','delivered','plivio','infobip','results','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','end','stack','name','send','SmsMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x5fb0f1,_0x18deb0){var _0x617eaf=function(_0x586320){while(--_0x586320){_0x5fb0f1['push'](_0x5fb0f1['shift']());}};_0x617eaf(++_0x18deb0);}(_0xfe53,0x146));var _0x3fe5=function(_0x58e92d,_0x1181bd){_0x58e92d=_0x58e92d-0x0;var _0x45d179=_0xfe53[_0x58e92d];return _0x45d179;};'use strict';var pdf=require(_0x3fe5('0x0'));var emlformat=require(_0x3fe5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3fe5('0x2'));var jsonpatch=require(_0x3fe5('0x3'));var rp=require(_0x3fe5('0x4'));var moment=require(_0x3fe5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3fe5('0x6'));var csv=require(_0x3fe5('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fe5('0x8'));var squel=require(_0x3fe5('0x9'));var crypto=require('crypto');var jsforce=require(_0x3fe5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3fe5('0x7'));var querystring=require(_0x3fe5('0xb'));var Papa=require(_0x3fe5('0xc'));var Redis=require(_0x3fe5('0xd'));var authService=require(_0x3fe5('0xe'));var qs=require(_0x3fe5('0xf'));var as=require(_0x3fe5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fe5('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3fe5('0x12'));var licenseUtil=require(_0x3fe5('0x13'));var db=require(_0x3fe5('0x14'))['db'];config[_0x3fe5('0x15')]=_[_0x3fe5('0x16')](config['redis'],{'host':_0x3fe5('0x17'),'port':0x18eb});var socket=require(_0x3fe5('0x18'))(new Redis(config['redis']));require(_0x3fe5('0x19'))['register'](socket);var jayson=require(_0x3fe5('0x1a'));var client=jayson[_0x3fe5('0x1b')][_0x3fe5('0x1c')]({'port':0x232c});var client9002=jayson[_0x3fe5('0x1b')][_0x3fe5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3a5622,_0x39b354,_0x3f9409,_0x55f58f){return new BPromise(function(_0x35b0f1,_0xf32e55){var _0x591f6d=_0x55f58f||client;return _0x591f6d['request'](_0x3a5622,_0x3f9409)[_0x3fe5('0x1d')](function(_0xd387e8){logger['info'](_0x3fe5('0x1e'),_0x39b354,'request\x20sent');logger[_0x3fe5('0x1f')](_0x3fe5('0x20'),_0x39b354,_0x3fe5('0x21'),JSON[_0x3fe5('0x22')](_0xd387e8));if(_0xd387e8['error']){if(_0xd387e8[_0x3fe5('0x23')][_0x3fe5('0x24')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x39b354,_0xd387e8['error'][_0x3fe5('0x25')]);return _0xf32e55(_0xd387e8[_0x3fe5('0x23')]['message']);}logger['error'](_0x3fe5('0x1e'),_0x39b354,_0xd387e8[_0x3fe5('0x23')][_0x3fe5('0x25')]);return _0x35b0f1(_0xd387e8[_0x3fe5('0x23')][_0x3fe5('0x25')]);}else{logger[_0x3fe5('0x26')](_0x3fe5('0x1e'),_0x39b354,'request\x20sent');_0x35b0f1(_0xd387e8[_0x3fe5('0x27')][_0x3fe5('0x25')]);}})[_0x3fe5('0x28')](function(_0x1b71a8){logger['error'](_0x3fe5('0x1e'),_0x39b354,_0x1b71a8);_0xf32e55(_0x1b71a8);});});}function respondWithStatusCode(_0x5f3e8c,_0x5228c0){_0x5228c0=_0x5228c0||0xcc;return function(_0x136133){if(_0x136133){return _0x5f3e8c[_0x3fe5('0x29')](_0x5228c0);}return _0x5f3e8c[_0x3fe5('0x2a')](_0x5228c0)['end']();};}function respondWithResult(_0x4841a1,_0xd081b2){_0xd081b2=_0xd081b2||0xc8;return function(_0x213014){if(_0x213014){return _0x4841a1['status'](_0xd081b2)[_0x3fe5('0x2b')](_0x213014);}};}function respondWithFilteredResult(_0x4d5d74,_0x381eb8){return function(_0x523c8f){if(_0x523c8f){var _0x5a6a9b=_0x523c8f[_0x3fe5('0x2c')],_0x239a7b=_0x381eb8['offset'],_0x35cb1c=_0x381eb8[_0x3fe5('0x2d')]+_0x381eb8[_0x3fe5('0x2e')],_0x49b8bd;if(_0x35cb1c>=_0x5a6a9b){_0x35cb1c=_0x5a6a9b;_0x49b8bd=0xc8;}else{_0x49b8bd=0xce;}_0x4d5d74[_0x3fe5('0x2a')](_0x49b8bd);return _0x4d5d74[_0x3fe5('0x2f')](_0x3fe5('0x30'),_0x239a7b+'-'+_0x35cb1c+'/'+_0x5a6a9b)['json'](_0x523c8f);}return null;};}function patchUpdates(_0x13314d){return function(_0x4656f8){try{jsonpatch[_0x3fe5('0x31')](_0x4656f8,_0x13314d,!![]);}catch(_0x1d60f4){return BPromise[_0x3fe5('0x32')](_0x1d60f4);}return _0x4656f8['save']();};}function saveUpdates(_0x4689f6,_0x22d3a0){return function(_0x9d1a4){if(_0x9d1a4){return _0x9d1a4[_0x3fe5('0x33')](_0x4689f6)[_0x3fe5('0x1d')](function(_0x509c5b){return _0x509c5b;});}return null;};}function removeEntity(_0x378b57,_0x1b0c3a){return function(_0x4cc3a0){if(_0x4cc3a0){return _0x4cc3a0['destroy']()[_0x3fe5('0x1d')](function(){_0x378b57['status'](0xcc)[_0x3fe5('0x34')]();});}};}function handleEntityNotFound(_0x268b34,_0x52206e){return function(_0x213d60){if(!_0x213d60){_0x268b34['sendStatus'](0x194);}return _0x213d60;};}function handleError(_0x3ac9c5,_0x3c2058){_0x3c2058=_0x3c2058||0x1f4;return function(_0x5f240e){logger['error'](_0x5f240e[_0x3fe5('0x35')]);if(_0x5f240e[_0x3fe5('0x36')]){delete _0x5f240e[_0x3fe5('0x36')];}_0x3ac9c5[_0x3fe5('0x2a')](_0x3c2058)[_0x3fe5('0x37')](_0x5f240e);};}exports['index']=function(_0x171221,_0x5254b2){var _0x1abdb2={},_0x19b3d6={},_0xdd0d6={'count':0x0,'rows':[]};var _0x5b5930=_['map'](db[_0x3fe5('0x38')][_0x3fe5('0x39')],function(_0x26342a){return{'name':_0x26342a[_0x3fe5('0x3a')],'type':_0x26342a[_0x3fe5('0x3b')][_0x3fe5('0x3c')]};});_0x19b3d6[_0x3fe5('0x3d')]=_[_0x3fe5('0x3e')](_0x5b5930,_0x3fe5('0x36'));_0x19b3d6[_0x3fe5('0x3f')]=_[_0x3fe5('0x40')](_0x171221[_0x3fe5('0x3f')]);_0x19b3d6[_0x3fe5('0x41')]=_[_0x3fe5('0x42')](_0x19b3d6[_0x3fe5('0x3d')],_0x19b3d6[_0x3fe5('0x3f')]);_0x1abdb2[_0x3fe5('0x43')]=_[_0x3fe5('0x42')](_0x19b3d6[_0x3fe5('0x3d')],qs[_0x3fe5('0x44')](_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x44')]));_0x1abdb2['attributes']=_0x1abdb2[_0x3fe5('0x43')][_0x3fe5('0x45')]?_0x1abdb2[_0x3fe5('0x43')]:_0x19b3d6[_0x3fe5('0x3d')];if(!_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x46')](_0x3fe5('0x47'))){_0x1abdb2[_0x3fe5('0x2e')]=qs[_0x3fe5('0x2e')](_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x2e')]);_0x1abdb2['offset']=qs['offset'](_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x2d')]);}_0x1abdb2[_0x3fe5('0x48')]=qs[_0x3fe5('0x49')](_0x171221['query'][_0x3fe5('0x49')]);_0x1abdb2[_0x3fe5('0x4a')]=qs[_0x3fe5('0x41')](_[_0x3fe5('0x4b')](_0x171221[_0x3fe5('0x3f')],_0x19b3d6[_0x3fe5('0x41')]),_0x5b5930);if(_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x4c')]){_0x1abdb2['where']=_[_0x3fe5('0x4d')](_0x1abdb2['where'],{'$or':_[_0x3fe5('0x3e')](_0x5b5930,function(_0x3bb367){if(_0x3bb367['type']!==_0x3fe5('0x4e')){var _0x3eb4d4={};_0x3eb4d4[_0x3bb367['name']]={'$like':'%'+_0x171221[_0x3fe5('0x3f')]['filter']+'%'};return _0x3eb4d4;}})});}_0x1abdb2=_[_0x3fe5('0x4d')]({},_0x1abdb2,_0x171221[_0x3fe5('0x4f')]);var _0x44b904={'where':_0x1abdb2[_0x3fe5('0x4a')]};return db[_0x3fe5('0x38')]['count'](_0x44b904)[_0x3fe5('0x1d')](function(_0x38b677){_0xdd0d6[_0x3fe5('0x2c')]=_0x38b677;if(_0x171221[_0x3fe5('0x3f')][_0x3fe5('0x50')]){_0x1abdb2[_0x3fe5('0x51')]=[{'all':!![]}];}return db[_0x3fe5('0x38')]['findAll'](_0x1abdb2);})[_0x3fe5('0x1d')](function(_0x203a75){_0xdd0d6[_0x3fe5('0x52')]=_0x203a75;return _0xdd0d6;})[_0x3fe5('0x1d')](respondWithFilteredResult(_0x5254b2,_0x1abdb2))['catch'](handleError(_0x5254b2,null));};exports['show']=function(_0xffa83,_0x524373){var _0x38018f={'raw':!![],'where':{'id':_0xffa83[_0x3fe5('0x53')]['id']}},_0x2f921d={};_0x2f921d['model']=_[_0x3fe5('0x40')](db[_0x3fe5('0x38')]['rawAttributes']);_0x2f921d[_0x3fe5('0x3f')]=_[_0x3fe5('0x40')](_0xffa83['query']);_0x2f921d[_0x3fe5('0x54')]=_[_0x3fe5('0x42')](_0x2f921d[_0x3fe5('0x3d')],_0x2f921d['query']);_0x38018f[_0x3fe5('0x43')]=_[_0x3fe5('0x42')](_0x2f921d[_0x3fe5('0x3d')],qs[_0x3fe5('0x44')](_0xffa83['query'][_0x3fe5('0x44')]));_0x38018f[_0x3fe5('0x43')]=_0x38018f['attributes']['length']?_0x38018f[_0x3fe5('0x43')]:_0x2f921d[_0x3fe5('0x3d')];if(_0xffa83['query']['includeAll']){_0x38018f[_0x3fe5('0x51')]=[{'all':!![]}];}_0x38018f=_[_0x3fe5('0x4d')]({},_0x38018f,_0xffa83[_0x3fe5('0x4f')]);return db[_0x3fe5('0x38')][_0x3fe5('0x55')](_0x38018f)[_0x3fe5('0x1d')](handleEntityNotFound(_0x524373,null))[_0x3fe5('0x1d')](respondWithResult(_0x524373,null))[_0x3fe5('0x28')](handleError(_0x524373,null));};exports[_0x3fe5('0x56')]=function(_0x367a2a,_0x1fe1fb){return db[_0x3fe5('0x38')]['create'](_0x367a2a['body'],{})['then'](respondWithResult(_0x1fe1fb,0xc9))[_0x3fe5('0x28')](handleError(_0x1fe1fb,null));};exports[_0x3fe5('0x33')]=function(_0x2b5e97,_0x72799d){if(_0x2b5e97[_0x3fe5('0x57')]['id']){delete _0x2b5e97[_0x3fe5('0x57')]['id'];}return db[_0x3fe5('0x38')][_0x3fe5('0x55')]({'where':{'id':_0x2b5e97[_0x3fe5('0x53')]['id']}})[_0x3fe5('0x1d')](handleEntityNotFound(_0x72799d,null))[_0x3fe5('0x1d')](saveUpdates(_0x2b5e97[_0x3fe5('0x57')],null))[_0x3fe5('0x1d')](respondWithResult(_0x72799d,null))[_0x3fe5('0x28')](handleError(_0x72799d,null));};exports[_0x3fe5('0x58')]=function(_0x14110e,_0x298528){return db[_0x3fe5('0x38')][_0x3fe5('0x55')]({'where':{'id':_0x14110e[_0x3fe5('0x53')]['id']}})[_0x3fe5('0x1d')](handleEntityNotFound(_0x298528,null))[_0x3fe5('0x1d')](removeEntity(_0x298528,null))[_0x3fe5('0x28')](handleError(_0x298528,null));};exports['describe']=function(_0x17879f,_0x2a675c){return db[_0x3fe5('0x38')][_0x3fe5('0x59')]()[_0x3fe5('0x1d')](respondWithResult(_0x2a675c,null))[_0x3fe5('0x28')](handleError(_0x2a675c,null));};var interaction_log=require(_0x3fe5('0x11'))(_0x3fe5('0x5a'));exports['accept']=function(_0x2e511e,_0xf0594,_0x33f102){var _0x440e3f={'channel':_0x3fe5('0x5b')};if(_0x2e511e['body']['id']){delete _0x2e511e[_0x3fe5('0x57')]['id'];}_0x2e511e[_0x3fe5('0x57')][_0x3fe5('0x5c')]=!![];_0x2e511e[_0x3fe5('0x57')][_0x3fe5('0x5d')]=moment()[_0x3fe5('0x5e')](_0x3fe5('0x5f'));_0x2e511e['body']['UserId']=_0x2e511e[_0x3fe5('0x57')]['UserId']||_0x2e511e[_0x3fe5('0x60')]['id'];return db[_0x3fe5('0x38')]['find']({'where':{'id':_0x2e511e[_0x3fe5('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x3fe5('0x61')}]})[_0x3fe5('0x1d')](handleEntityNotFound(_0xf0594,null))[_0x3fe5('0x1d')](saveUpdates(_0x2e511e['body'],null))[_0x3fe5('0x1d')](function(_0x5b3369){if(_0x5b3369){_0x440e3f[_0x3fe5('0x25')]=_0x5b3369[_0x3fe5('0x62')]({'plain':!![]});return db[_0x3fe5('0x63')]['find']({'where':{'id':_0x5b3369[_0x3fe5('0x64')]}});}return null;})[_0x3fe5('0x1d')](handleEntityNotFound(_0xf0594,null))[_0x3fe5('0x1d')](function(_0x4754cb){if(_0x4754cb){return _0x4754cb[_0x3fe5('0x33')]({'UserId':_0x2e511e[_0x3fe5('0x57')][_0x3fe5('0x65')],'read1stAt':_[_0x3fe5('0x66')](_0x4754cb[_0x3fe5('0x67')])?moment()[_0x3fe5('0x5e')](_0x3fe5('0x5f')):undefined});}return null;})[_0x3fe5('0x1d')](function(_0x3c2a30){if(_0x3c2a30){_0x440e3f[_0x3fe5('0x68')]=_0x3c2a30[_0x3fe5('0x62')]({'plain':!![]});interaction_log[_0x3fe5('0x26')](_0x3fe5('0x69'),_0x2e511e[_0x3fe5('0x60')]['id'],_0x2e511e[_0x3fe5('0x60')][_0x3fe5('0x36')],_0x2e511e['user'][_0x3fe5('0x6a')],_0x440e3f[_0x3fe5('0x68')]['id'],_0x2e511e['body']?JSON[_0x3fe5('0x22')](_0x2e511e[_0x3fe5('0x57')]):_0x3fe5('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x3fe5('0x6c'),_0x440e3f);}return null;})[_0x3fe5('0x1d')](function(_0x57f23f){if(_0x57f23f){if(_0x2e511e['body'][_0x3fe5('0x6d')]){_0x440e3f[_0x3fe5('0x25')][_0x3fe5('0x6e')]=util['format'](_0x3fe5('0x6f'),_0x2e511e[_0x3fe5('0x60')][_0x3fe5('0x36')]);_0x440e3f['message'][_0x3fe5('0x70')]=_0x440e3f['channel'];_0x440e3f[_0x3fe5('0x25')]['event']=_0x3fe5('0x71');return respondWithRpcPromise(_0x3fe5('0x72'),_0x3fe5('0x72'),{'event':_0x3fe5('0x73'),'message':_0x440e3f['message']},client9002)[_0x3fe5('0x1d')](function(){return _0x440e3f;});}return _0x440e3f;}return null;})['then'](respondWithResult(_0xf0594,null))[_0x3fe5('0x28')](handleError(_0xf0594,null));};var interaction_log=require(_0x3fe5('0x11'))(_0x3fe5('0x5a'));exports[_0x3fe5('0x32')]=function(_0x26ce15,_0x2f40f4,_0x17f644){var _0x132933={'agent':{},'channel':_0x3fe5('0x5b')};if(_0x26ce15[_0x3fe5('0x57')]['id']){delete _0x26ce15[_0x3fe5('0x57')]['id'];}_0x26ce15['body'][_0x3fe5('0x65')]=_0x26ce15[_0x3fe5('0x57')][_0x3fe5('0x65')]||_0x26ce15[_0x3fe5('0x60')]['id'];_0x132933[_0x3fe5('0x74')]['id']=_0x26ce15['body'][_0x3fe5('0x65')];return db[_0x3fe5('0x38')]['find']({'where':{'id':_0x26ce15['params']['id'],'UserId':null}})[_0x3fe5('0x1d')](handleEntityNotFound(_0x2f40f4,null))['then'](function(_0x1c805a){if(_0x1c805a){_0x132933[_0x3fe5('0x25')]=_0x1c805a['get']({'plain':!![]});return db['SmsInteraction'][_0x3fe5('0x55')]({'where':{'id':_0x1c805a[_0x3fe5('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2f40f4,null))[_0x3fe5('0x1d')](function(_0x24c5b1){if(_0x24c5b1){_0x132933['interaction']=_0x24c5b1[_0x3fe5('0x62')]({'plain':!![]});interaction_log[_0x3fe5('0x26')](_0x3fe5('0x75'),_0x26ce15[_0x3fe5('0x60')]['id'],_0x26ce15[_0x3fe5('0x60')][_0x3fe5('0x36')],_0x26ce15['user'][_0x3fe5('0x6a')],_0x132933[_0x3fe5('0x68')]['id'],_0x26ce15['body']?JSON[_0x3fe5('0x22')](_0x26ce15[_0x3fe5('0x57')]):_0x3fe5('0x6b'));return respondWithRpcPromise(_0x3fe5('0x76'),_0x3fe5('0x77'),_0x132933);}return null;})[_0x3fe5('0x1d')](function(_0x3ebb6f){if(_0x3ebb6f){_0x3ebb6f['message'][_0x3fe5('0x6e')]=util[_0x3fe5('0x5e')]('SIP/%s',_0x26ce15['user'][_0x3fe5('0x36')]);_0x3ebb6f[_0x3fe5('0x25')][_0x3fe5('0x70')]=_0x132933[_0x3fe5('0x70')];_0x3ebb6f['message']['event']=_0x3fe5('0x32');respondWithRpcPromise(_0x3fe5('0x72'),_0x3fe5('0x72'),{'event':_0x3fe5('0x78'),'message':_0x3ebb6f[_0x3fe5('0x25')]},client9002);return _0x132933;}return null;})['then'](respondWithResult(_0x2f40f4,null))['catch'](handleError(_0x2f40f4,null));};exports[_0x3fe5('0x2a')]=function(_0x4702ad,_0x4caeaf,_0x108bec){if(_0x4702ad[_0x3fe5('0x57')]['id']){delete _0x4702ad[_0x3fe5('0x57')]['id'];}var _0x4b4d68;return db[_0x3fe5('0x38')][_0x3fe5('0x55')]({'where':{'id':_0x4702ad[_0x3fe5('0x53')]['id']}})[_0x3fe5('0x1d')](handleEntityNotFound(_0x4caeaf,null))[_0x3fe5('0x1d')](function(_0x486fee){if(_0x486fee){_0x4b4d68=_0x486fee;return db[_0x3fe5('0x79')]['find']({'where':{'id':_0x486fee[_0x3fe5('0x7a')]}});}})[_0x3fe5('0x1d')](handleEntityNotFound(_0x4caeaf,null))[_0x3fe5('0x1d')](function(_0x38d00c){if(_0x38d00c){logger[_0x3fe5('0x1f')](_0x3fe5('0x20'),'status',_0x3fe5('0x7b'),_0x38d00c[_0x3fe5('0x3b')],util[_0x3fe5('0x7c')](_0x4702ad['body'],{'showHidden':![],'depth':null}));switch(_0x38d00c[_0x3fe5('0x3b')]){case _0x3fe5('0x7d'):if(_0x4702ad['body'][_0x3fe5('0x7e')]&&_0x4702ad[_0x3fe5('0x57')][_0x3fe5('0x7e')]===_0x4b4d68[_0x3fe5('0x7f')]){return _0x4b4d68[_0x3fe5('0x33')]({'read':!![]});}else{logger[_0x3fe5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3fe5('0x7d'),util[_0x3fe5('0x7c')](_0x4702ad['body'],{'showHidden':![],'depth':null}));}break;case _0x3fe5('0x80'):if(_0x4702ad[_0x3fe5('0x57')][_0x3fe5('0x81')]&&_0x4702ad[_0x3fe5('0x57')]['MessageUUID']===_0x4b4d68[_0x3fe5('0x7f')]&&_['indexOf'](['sent',_0x3fe5('0x82')],_0x4702ad[_0x3fe5('0x57')]['Status'])>=0x0){return _0x4b4d68[_0x3fe5('0x33')]({'read':!![]});}else{logger[_0x3fe5('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fe5('0x2a'),_0x3fe5('0x83'),util[_0x3fe5('0x7c')](_0x4702ad[_0x3fe5('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3fe5('0x84'):var _0x2ee9b7=_0x4702ad[_0x3fe5('0x57')][_0x3fe5('0x85')][0x0];if(_0x2ee9b7['status']['groupName']==='DELIVERED'){return _0x4b4d68['update']({'read':!![]});}else{logger[_0x3fe5('0x23')](_0x3fe5('0x86'),_0x3fe5('0x2a'),_0x3fe5('0x84'),util[_0x3fe5('0x7c')](_0x4702ad[_0x3fe5('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4b4d68;}})[_0x3fe5('0x1d')](respondWithResult(_0x4caeaf,null))[_0x3fe5('0x28')](handleError(_0x4caeaf,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 288b1d1..92491bb 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 _0x7c9c=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x160e6d,_0x1bb434){var _0x1309b9=function(_0x1e4a14){while(--_0x1e4a14){_0x160e6d['push'](_0x160e6d['shift']());}};_0x1309b9(++_0x1bb434);}(_0x7c9c,0x134));var _0xc7c9=function(_0x2610db,_0x454344){_0x2610db=_0x2610db-0x0;var _0x5d4d96=_0x7c9c[_0x2610db];return _0x5d4d96;};'use strict';var EventEmitter=require(_0xc7c9('0x0'));var SmsMessage=require(_0xc7c9('0x1'))['db'][_0xc7c9('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc7c9('0x3')](0x0);var events={'afterCreate':_0xc7c9('0x4'),'afterUpdate':_0xc7c9('0x5'),'afterDestroy':_0xc7c9('0x6')};function emitEvent(_0x2f115b){return function(_0x41c63b,_0x1c2b13,_0x381535){SmsMessageEvents[_0xc7c9('0x7')](_0x2f115b+':'+_0x41c63b['id'],_0x41c63b);SmsMessageEvents[_0xc7c9('0x7')](_0x2f115b,_0x41c63b);_0x381535(null);};}for(var e in events){if(events[_0xc7c9('0x8')](e)){var event=events[e];SmsMessage[_0xc7c9('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xc386=['emit','hasOwnProperty','hook','exports','save','remove'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xc386,0x106));var _0x6c38=function(_0x1dd6ac,_0x58ee30){_0x1dd6ac=_0x1dd6ac-0x0;var _0x4c7922=_0xc386[_0x1dd6ac];return _0x4c7922;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c38('0x0'),'afterUpdate':'update','afterDestroy':_0x6c38('0x1')};function emitEvent(_0x54b80e){return function(_0x32c8b2,_0x3601ae,_0x4d6c3c){SmsMessageEvents[_0x6c38('0x2')](_0x54b80e+':'+_0x32c8b2['id'],_0x32c8b2);SmsMessageEvents[_0x6c38('0x2')](_0x54b80e,_0x32c8b2);_0x4d6c3c(null);};}for(var e in events){if(events[_0x6c38('0x3')](e)){var event=events[e];SmsMessage[_0x6c38('0x4')](e,emitEvent(event));}}module[_0x6c38('0x5')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 3043717..8b24e40 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 _0xce51=['authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','token','sid','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','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','clickSend','plivo','/status?token=','authId','Basic\x20%s','toString','message_uuid','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','digest','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','finally','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','SmsAccountId','then','type','twilio'];(function(_0x56c357,_0x5ae4b8){var _0x2751ed=function(_0x360f68){while(--_0x360f68){_0x56c357['push'](_0x56c357['shift']());}};_0x2751ed(++_0x5ae4b8);}(_0xce51,0x13b));var _0x1ce5=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xce51[_0x609988];return _0x159984;};'use strict';var _=require(_0x1ce5('0x0'));var util=require(_0x1ce5('0x1'));var logger=require(_0x1ce5('0x2'))(_0x1ce5('0x3'));var moment=require('moment');var BPromise=require(_0x1ce5('0x4'));var rp=require(_0x1ce5('0x5'));var fs=require('fs');var path=require(_0x1ce5('0x6'));var rimraf=require(_0x1ce5('0x7'));var config=require(_0x1ce5('0x8'));var attributes=require(_0x1ce5('0x9'));module['exports']=function(_0x34afde,_0x1f6661){return _0x34afde[_0x1ce5('0xa')]('SmsMessage',attributes,{'tableName':_0x1ce5('0xb'),'paranoid':![],'indexes':[{'name':_0x1ce5('0xc'),'fields':['messageId']},{'name':_0x1ce5('0xd'),'fields':[_0x1ce5('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55a116,_0x4c6931,_0xd701b5){var _0x566de6=_0x34afde['models'];var _0x61ef45=_0x55a116['get']({'plain':!![]});if(_0x61ef45['direction']['toLowerCase']()==='in'||_0x61ef45[_0x1ce5('0xf')][_0x1ce5('0x10')]()===_0x1ce5('0x11')&&!_0x61ef45[_0x1ce5('0x12')]&&!_[_0x1ce5('0x13')](_0x61ef45[_0x1ce5('0x14')])){_0x566de6[_0x1ce5('0x15')][_0x1ce5('0x16')]({'where':{'id':_0x61ef45[_0x1ce5('0x17')]}})['then'](function(_0x5b6838){if(_0x5b6838){_0x5b6838[_0x1ce5('0x18')]({'lastMsgAt':_0x61ef45[_0x1ce5('0x19')],'lastMsgDirection':_0x61ef45[_0x1ce5('0xf')][_0x1ce5('0x10')]()});}})[_0x1ce5('0x1a')](function(_0x4d388a){console[_0x1ce5('0x1b')](_0x4d388a);});}if(_0x61ef45[_0x1ce5('0xf')]===_0x1ce5('0x11')&&!_0x61ef45[_0x1ce5('0x12')]){var _0x175b56;_0x566de6[_0x1ce5('0x1c')]['find']({'where':{'id':_0x61ef45[_0x1ce5('0x1d')]},'raw':!![]})[_0x1ce5('0x1e')](function(_0x474963){_0x175b56=_0x474963;if(_0x175b56&&_0x175b56[_0x1ce5('0x1f')]){switch(_0x175b56[_0x1ce5('0x1f')]){case _0x1ce5('0x20'):var _0x2422c2=require('twilio');if(_0x175b56['accountSid']&&_0x175b56[_0x1ce5('0x21')]&&_0x175b56[_0x1ce5('0x22')]){var _0x284ced=new _0x2422c2(_0x175b56[_0x1ce5('0x23')],_0x175b56[_0x1ce5('0x21')]);_0x284ced[_0x1ce5('0x24')][_0x1ce5('0x25')]({'body':_0x61ef45[_0x1ce5('0xe')],'to':_0x61ef45['phone'],'from':_0x175b56['phone'],'statusCallback':_0x175b56[_0x1ce5('0x26')]+_0x1ce5('0x27')+_0x61ef45['id']+'/status?token='+_0x175b56[_0x1ce5('0x28')]})[_0x1ce5('0x1e')](function(_0x560212){if(_0x560212[_0x1ce5('0x29')]){return _0x55a116[_0x1ce5('0x18')]({'messageId':_0x560212[_0x1ce5('0x29')]});}})[_0x1ce5('0x1a')](function(_0x215d1b){logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x20'),util['inspect'](_0x215d1b,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),'twilio',_0x1ce5('0x2c'));}break;case _0x1ce5('0x2d'):var _0x4ced7f=_0x1ce5('0x2e');if(_0x175b56[_0x1ce5('0x2f')]&&_0x175b56[_0x1ce5('0x30')]){var _0x530383={'recipient':[_0x61ef45[_0x1ce5('0x22')]],'message':_0x61ef45['body'],'message_type':_0x175b56[_0x1ce5('0x31')]};if(_0x175b56[_0x1ce5('0x31')]&&_0x175b56['smsMethod']!=='SI'){_0x530383[_0x1ce5('0x32')]=_0x175b56[_0x1ce5('0x22')];}var _0x21e543={'url':_0x4ced7f+_0x1ce5('0x33')+_0x175b56[_0x1ce5('0x2f')]+_0x1ce5('0x34')+_0x175b56[_0x1ce5('0x30')],'method':_0x1ce5('0x35')};rp(_0x21e543)[_0x1ce5('0x1e')](function(_0x53415f){var _0x2c8fd8=_0x53415f[_0x1ce5('0x36')](';');var _0x55e9b2={'user_key':_0x2c8fd8[0x0],'session_key':_0x2c8fd8[0x1]};_0x21e543={'url':_0x4ced7f+_0x1ce5('0x37'),'method':_0x1ce5('0x38'),'headers':{'user_key':_0x55e9b2[_0x1ce5('0x39')],'Session_key':_0x55e9b2[_0x1ce5('0x3a')]},'json':!![],'body':_0x530383};return rp(_0x21e543);})[_0x1ce5('0x1e')](function(_0x449c67){if(_0x449c67['total_sent']>=0x1){var _0x457b2b={'messageId':_0x449c67[_0x1ce5('0x3b')]};if(_0x175b56['smsMethod']!=='GP'||!_0x175b56[_0x1ce5('0x3c')]){_0x457b2b[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x457b2b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x2d'),util[_0x1ce5('0x3e')](_0x449c67,{'showHidden':![],'depth':null}));}})['catch'](function(_0x50214d){return logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1ce5('0x2d'),util[_0x1ce5('0x3e')](_0x50214d,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),'afterCreate',_0x1ce5('0x2d'),_0x1ce5('0x3f'));}break;case'connectel':if(_0x175b56['authToken']){var _0x5ef61c={'recipient':_0x61ef45['phone'],'message':_0x61ef45[_0x1ce5('0xe')],'sender':_0x175b56[_0x1ce5('0x40')]||_0x175b56['phone'],'authorization':_0x175b56['authToken']};var _0x4c6931={'method':_0x1ce5('0x38'),'uri':_0x1ce5('0x41'),'body':_0x5ef61c,'json':!![]};rp(_0x4c6931)[_0x1ce5('0x1e')](function(_0x312c43){var _0x39bfe7={'messageId':_0x312c43['requestid']};if(!_0x175b56[_0x1ce5('0x3c')]){_0x39bfe7[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x39bfe7);})[_0x1ce5('0x1a')](function(_0xce4200){logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x42'),util[_0x1ce5('0x3e')](_0xce4200,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),'afterCreate','connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x175b56[_0x1ce5('0x2f')]&&_0x175b56[_0x1ce5('0x30')]){var _0x5ef61c={'messages':[{'source':_0x1ce5('0x43'),'to':_0x61ef45[_0x1ce5('0x22')],'body':_0x61ef45[_0x1ce5('0xe')],'from':_0x175b56['senderString']||_0x175b56[_0x1ce5('0x22')]}]};var _0x3427b4=util[_0x1ce5('0x44')](_0x1ce5('0x45'),_0x175b56[_0x1ce5('0x2f')],_0x175b56[_0x1ce5('0x30')]);var _0x4c6931={'method':_0x1ce5('0x38'),'uri':_0x1ce5('0x46'),'body':_0x5ef61c,'headers':{'Authorization':util[_0x1ce5('0x44')]('Basic\x20%s',new Buffer(_0x3427b4)['toString'](_0x1ce5('0x47')))},'json':!![]};rp(_0x4c6931)[_0x1ce5('0x1e')](function(_0x1757bf){if(_0x1757bf['http_code']>=0xc8&&_0x1757bf[_0x1ce5('0x48')]<=0xce){if(_0x1757bf['data']&&_0x1757bf[_0x1ce5('0x49')][_0x1ce5('0x4a')]>0x0){var _0x506553=_[_0x1ce5('0x4b')](_0x1757bf[_0x1ce5('0x49')][_0x1ce5('0x24')]);var _0x351573={'messageId':_0x506553['message_id']};if(!_0x175b56[_0x1ce5('0x3c')]){_0x351573[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x351573);}else{logger['error'](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x4c'),util['inspect'](_0x1757bf,{'showHidden':![],'depth':null}));}}else{logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x4c'),util[_0x1ce5('0x3e')](_0x1757bf,{'showHidden':![],'depth':null}));}})[_0x1ce5('0x1a')](function(_0x35f7c1){logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),'clickSend',util[_0x1ce5('0x3e')](_0x35f7c1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1ce5('0x2a'),'afterCreate','clickSend',_0x1ce5('0x3f'));}break;case _0x1ce5('0x4d'):if(_0x175b56['authId']&&_0x175b56[_0x1ce5('0x21')]){var _0x5ef61c={'dst':_0x61ef45[_0x1ce5('0x22')],'text':_0x61ef45[_0x1ce5('0xe')],'src':_0x175b56[_0x1ce5('0x40')]||_0x175b56['phone'],'url':_0x175b56['remote']+_0x1ce5('0x27')+_0x61ef45['id']+_0x1ce5('0x4e')+_0x175b56[_0x1ce5('0x28')]};var _0x3427b4=util[_0x1ce5('0x44')](_0x1ce5('0x45'),_0x175b56[_0x1ce5('0x4f')],_0x175b56[_0x1ce5('0x21')]);var _0x4c6931={'method':_0x1ce5('0x38'),'uri':util[_0x1ce5('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x175b56[_0x1ce5('0x4f')]),'body':_0x5ef61c,'headers':{'Authorization':util['format'](_0x1ce5('0x50'),new Buffer(_0x3427b4)[_0x1ce5('0x51')]('base64'))},'json':!![]};rp(_0x4c6931)['then'](function(_0x4bedb4){var _0x2b19e4={'messageId':_0x4bedb4[_0x1ce5('0x52')][0x0]};return _0x55a116['update'](_0x2b19e4);})['catch'](function(_0x1ac507){logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x4d'),util['inspect'](_0x1ac507,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x175b56['username']&&_0x175b56[_0x1ce5('0x30')]){if(_0x175b56[_0x1ce5('0x53')]){var _0x68445f={'method':'POST','uri':_0x175b56[_0x1ce5('0x53')]+'/auth/1/session','body':{'username':_0x175b56[_0x1ce5('0x2f')],'password':_0x175b56['password']},'json':!![]};return rp(_0x68445f)['then'](function(_0x5c5309){var _0x5a07fb={'method':'POST','uri':_0x175b56['baseUrl']+_0x1ce5('0x54'),'body':{'messages':[{'from':_0x175b56[_0x1ce5('0x22')],'destinations':[{'to':_0x61ef45[_0x1ce5('0x22')]}],'text':_0x61ef45[_0x1ce5('0xe')],'notifyUrl':_0x175b56['remote']+'/api/sms/messages/'+_0x61ef45['id']+_0x1ce5('0x4e')+_0x175b56[_0x1ce5('0x28')],'notifyContentType':_0x1ce5('0x55'),'callbackData':_0x175b56[_0x1ce5('0x22')]+';'+_0x61ef45['body']}]},'headers':{'Authorization':_0x1ce5('0x56')+_0x5c5309['token']},'json':!![]};return rp(_0x5a07fb)['then'](function(_0x595f5b){if(_0x595f5b['messages']){var _0x48d0c3={'messageId':_0x595f5b[_0x1ce5('0x24')][0x0][_0x1ce5('0xc')]};if(!_0x175b56[_0x1ce5('0x3c')]){_0x48d0c3[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x48d0c3);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x57'),util[_0x1ce5('0x3e')](_0x595f5b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5bc1de){return logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),'afterCreate','infobip',util[_0x1ce5('0x3e')](_0x5bc1de,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x57'),_0x1ce5('0x58'));}}else{logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x57'),_0x1ce5('0x3f'));}break;case _0x1ce5('0x59'):var _0x1c1c86=require(_0x1ce5('0x5a'));if(_0x175b56[_0x1ce5('0x5b')]){var _0x5372ab={};_0x5372ab[_0x1ce5('0x5c')]=_0x175b56[_0x1ce5('0x2f')];_0x5372ab[_0x1ce5('0x22')]=_0x61ef45['phone'];_0x5372ab[_0x1ce5('0x32')]=_0x175b56[_0x1ce5('0x22')];_0x5372ab[_0x1ce5('0x5d')]=_0x61ef45['body'];_0x5372ab[_0x1ce5('0x5e')]=+new Date();var _0x239c6a='';var _0x5bd69f='';var _0x4b4137=Object[_0x1ce5('0x5f')](_0x5372ab);_0x4b4137[_0x1ce5('0x60')]();for(var _0x4ef965=0x0;_0x4ef965<_0x4b4137['length'];_0x4ef965++){if(_0x239c6a!=''){_0x239c6a+='&';}_0x239c6a+=_0x4b4137[_0x4ef965]+'='+encodeURIComponent(_0x5372ab[_0x4b4137[_0x4ef965]]);_0x5bd69f+=_0x5372ab[_0x4b4137[_0x4ef965]];}_0x5bd69f+=_0x175b56[_0x1ce5('0x5b')];_0x5bd69f=_0x1c1c86[_0x1ce5('0x61')]('md5')[_0x1ce5('0x18')](_0x5bd69f)[_0x1ce5('0x62')]('hex');if(_0x239c6a!==''){_0x239c6a+='&';}_0x239c6a+=_0x1ce5('0x63')+_0x5bd69f;var _0x21e543={'method':_0x1ce5('0x35'),'uri':_0x175b56[_0x1ce5('0x53')]+'/external/get/send.php?'+_0x239c6a,'json':!![]};return rp(_0x21e543)['then'](function(_0x4bd754){var _0xc72603=Object[_0x1ce5('0x5f')](_0x4bd754);if(_0x4bd754[_0xc72603[0x0]][_0x1ce5('0x1b')]&&parseInt(_0x4bd754[_0xc72603[0x0]][_0x1ce5('0x1b')])===0x0){var _0x44f6b5={'messageId':_0x4bd754[_0xc72603[0x0]][_0x1ce5('0x64')]};if(!_0x175b56[_0x1ce5('0x3c')]){_0x44f6b5[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x44f6b5);}else{return logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x59'),util[_0x1ce5('0x3e')](_0x4bd754[_0x1ce5('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x48d069){return logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),'csc',util[_0x1ce5('0x3e')](_0x48d069,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x59'),_0x1ce5('0x65'));}break;case'clickatell':if(_0x175b56[_0x1ce5('0x5b')]){var _0x1886ba={'method':'POST','uri':_0x1ce5('0x66'),'headers':{'Authorization':_0x175b56[_0x1ce5('0x5b')]},'body':{'content':_0x61ef45[_0x1ce5('0xe')],'to':[_0x61ef45[_0x1ce5('0x22')]],'from':_0x175b56[_0x1ce5('0x22')],'binary':![],'clientMessageId':_0x1ce5('0x67'),'charset':_0x1ce5('0x68')},'json':!![]};rp(_0x1886ba)[_0x1ce5('0x1e')](function(_0x227562){if(!_0x227562[_0x1ce5('0x1b')]){var _0x2d0c5d={'messageId':_0x227562[_0x1ce5('0x24')][0x0][_0x1ce5('0x69')]};if(!_0x175b56[_0x1ce5('0x3c')]){_0x2d0c5d[_0x1ce5('0x3d')]=!![];}return _0x55a116[_0x1ce5('0x18')](_0x2d0c5d);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x6a'),util[_0x1ce5('0x3e')](_0x227562[_0x1ce5('0x1b')],{'showHidden':![],'depth':null}));}})[_0x1ce5('0x1a')](function(_0x4fc7db){return logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),_0x1ce5('0x6a'),util['inspect'](_0x4fc7db,{'showHidden':![],'depth':null}));});}else{logger[_0x1ce5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1ce5('0x2b'),'clickatell',_0x1ce5('0x65'));}break;case _0x1ce5('0x6b'):if(_0x175b56[_0x1ce5('0x5b')]){var _0x5f5444={};var _0x21e543={'method':_0x1ce5('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x1ce5('0x6c')+_0x175b56[_0x1ce5('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x175b56['phone'],'to':_0x61ef45[_0x1ce5('0x22')],'text':_0x61ef45['body']},'json':!![]};return rp(_0x21e543)[_0x1ce5('0x1e')](function(_0x438c6e){if(_0x438c6e[_0x1ce5('0x6d')]==0xca){_0x5f5444[_0x1ce5('0x6e')]=_0x438c6e;var _0x46f795={'method':_0x1ce5('0x38'),'uri':_0x1ce5('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x175b56[_0x1ce5('0x5b')],'Content-Type':_0x1ce5('0x55')},'body':{'refid':_0x5f5444[_0x1ce5('0x6e')]['refid']},'json':!![]};return rp(_0x46f795)['then'](function(_0x51d0d6){_0x5f5444[_0x1ce5('0x70')]=_0x51d0d6;var _0x4af250={'messageId':_0x5f5444['message'][_0x1ce5('0x71')],'read':!![]};return _0x55a116[_0x1ce5('0x18')](_0x4af250);});}else{return logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),'intelepeer',util[_0x1ce5('0x3e')](_0x438c6e,{'showHidden':![],'depth':null}));}})[_0x1ce5('0x1a')](function(_0xb24c9b){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x1ce5('0x3e')](_0xb24c9b,{'showHidden':![],'depth':null}));});}else{return logger[_0x1ce5('0x1b')](_0x1ce5('0x2a'),_0x1ce5('0x2b'),_0x1ce5('0x6b'),_0x1ce5('0x72'));}break;}}})[_0x1ce5('0x73')](function(){_0xd701b5();});}else{_0xd701b5();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcf23=['afterCreate','inspect','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','split','sms','POST','session_key','total_sent','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','digest','GET','/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','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','out','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2a0688,_0x411849){var _0x2ea81e=function(_0x3aa952){while(--_0x3aa952){_0x2a0688['push'](_0x2a0688['shift']());}};_0x2ea81e(++_0x411849);}(_0xcf23,0x138));var _0x3cf2=function(_0x4a1b0c,_0x462ab6){_0x4a1b0c=_0x4a1b0c-0x0;var _0x46b04f=_0xcf23[_0x4a1b0c];return _0x46b04f;};'use strict';var _=require(_0x3cf2('0x0'));var util=require(_0x3cf2('0x1'));var logger=require(_0x3cf2('0x2'))(_0x3cf2('0x3'));var moment=require('moment');var BPromise=require(_0x3cf2('0x4'));var rp=require(_0x3cf2('0x5'));var fs=require('fs');var path=require(_0x3cf2('0x6'));var rimraf=require(_0x3cf2('0x7'));var config=require(_0x3cf2('0x8'));var attributes=require(_0x3cf2('0x9'));module[_0x3cf2('0xa')]=function(_0x2d0090,_0x34d5bf){return _0x2d0090['define'](_0x3cf2('0xb'),attributes,{'tableName':_0x3cf2('0xc'),'paranoid':![],'indexes':[{'name':_0x3cf2('0xd'),'fields':['messageId']},{'name':_0x3cf2('0xe'),'fields':[_0x3cf2('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x59fd3f,_0x31cdb2,_0x2efc43){var _0x2813dc=_0x2d0090[_0x3cf2('0x10')];var _0x26e84f=_0x59fd3f[_0x3cf2('0x11')]({'plain':!![]});if(_0x26e84f[_0x3cf2('0x12')][_0x3cf2('0x13')]()==='in'||_0x26e84f[_0x3cf2('0x12')][_0x3cf2('0x13')]()==='out'&&!_0x26e84f[_0x3cf2('0x14')]&&!_[_0x3cf2('0x15')](_0x26e84f[_0x3cf2('0x16')])){_0x2813dc[_0x3cf2('0x17')][_0x3cf2('0x18')]({'where':{'id':_0x26e84f[_0x3cf2('0x19')]}})[_0x3cf2('0x1a')](function(_0x573535){if(_0x573535){_0x573535[_0x3cf2('0x1b')]({'lastMsgAt':_0x26e84f['createdAt'],'lastMsgDirection':_0x26e84f[_0x3cf2('0x12')][_0x3cf2('0x13')]()});}})[_0x3cf2('0x1c')](function(_0x1785d8){console[_0x3cf2('0x1d')](_0x1785d8);});}if(_0x26e84f['direction']===_0x3cf2('0x1e')&&!_0x26e84f[_0x3cf2('0x14')]){var _0x3f90a8;_0x2813dc['SmsAccount'][_0x3cf2('0x1f')]({'where':{'id':_0x26e84f['SmsAccountId']},'raw':!![]})[_0x3cf2('0x1a')](function(_0x5ebd18){_0x3f90a8=_0x5ebd18;if(_0x3f90a8&&_0x3f90a8[_0x3cf2('0x20')]){switch(_0x3f90a8[_0x3cf2('0x20')]){case'twilio':var _0x5a90f8=require(_0x3cf2('0x21'));if(_0x3f90a8[_0x3cf2('0x22')]&&_0x3f90a8[_0x3cf2('0x23')]&&_0x3f90a8[_0x3cf2('0x24')]){var _0xef28b3=new _0x5a90f8(_0x3f90a8[_0x3cf2('0x22')],_0x3f90a8[_0x3cf2('0x23')]);_0xef28b3[_0x3cf2('0x25')][_0x3cf2('0x26')]({'body':_0x26e84f[_0x3cf2('0xf')],'to':_0x26e84f[_0x3cf2('0x24')],'from':_0x3f90a8[_0x3cf2('0x24')],'statusCallback':_0x3f90a8[_0x3cf2('0x27')]+_0x3cf2('0x28')+_0x26e84f['id']+_0x3cf2('0x29')+_0x3f90a8[_0x3cf2('0x2a')]})[_0x3cf2('0x1a')](function(_0x581b9e){if(_0x581b9e[_0x3cf2('0x2b')]){return _0x59fd3f[_0x3cf2('0x1b')]({'messageId':_0x581b9e[_0x3cf2('0x2b')]});}})[_0x3cf2('0x1c')](function(_0xf6676a){logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x21'),util[_0x3cf2('0x2e')](_0xf6676a,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x2b13b2=_0x3cf2('0x2f');if(_0x3f90a8[_0x3cf2('0x30')]&&_0x3f90a8[_0x3cf2('0x31')]){var _0x241d7e={'recipient':[_0x26e84f['phone']],'message':_0x26e84f[_0x3cf2('0xf')],'message_type':_0x3f90a8[_0x3cf2('0x32')]};if(_0x3f90a8[_0x3cf2('0x32')]&&_0x3f90a8['smsMethod']!=='SI'){_0x241d7e['sender']=_0x3f90a8['phone'];}var _0x4b460c={'url':_0x2b13b2+_0x3cf2('0x33')+_0x3f90a8[_0x3cf2('0x30')]+_0x3cf2('0x34')+_0x3f90a8[_0x3cf2('0x31')],'method':'GET'};rp(_0x4b460c)['then'](function(_0x5c1b94){var _0x876b3f=_0x5c1b94[_0x3cf2('0x35')](';');var _0x1c4209={'user_key':_0x876b3f[0x0],'session_key':_0x876b3f[0x1]};_0x4b460c={'url':_0x2b13b2+_0x3cf2('0x36'),'method':_0x3cf2('0x37'),'headers':{'user_key':_0x1c4209['user_key'],'Session_key':_0x1c4209[_0x3cf2('0x38')]},'json':!![],'body':_0x241d7e};return rp(_0x4b460c);})[_0x3cf2('0x1a')](function(_0x54d86a){if(_0x54d86a[_0x3cf2('0x39')]>=0x1){var _0x798878={'messageId':_0x54d86a['internal_order_id']};if(_0x3f90a8[_0x3cf2('0x32')]!=='GP'||!_0x3f90a8[_0x3cf2('0x3a')]){_0x798878[_0x3cf2('0x3b')]=!![];}return _0x59fd3f[_0x3cf2('0x1b')](_0x798878);}else{return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x3c'),util['inspect'](_0x54d86a,{'showHidden':![],'depth':null}));}})[_0x3cf2('0x1c')](function(_0x495daf){return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x3c'),util[_0x3cf2('0x2e')](_0x495daf,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3cf2('0x2c'),_0x3cf2('0x2d'),'skebby',_0x3cf2('0x3d'));}break;case'connectel':if(_0x3f90a8[_0x3cf2('0x23')]){var _0x15519f={'recipient':_0x26e84f['phone'],'message':_0x26e84f[_0x3cf2('0xf')],'sender':_0x3f90a8['senderString']||_0x3f90a8[_0x3cf2('0x24')],'authorization':_0x3f90a8['authToken']};var _0x31cdb2={'method':_0x3cf2('0x37'),'uri':_0x3cf2('0x3e'),'body':_0x15519f,'json':!![]};rp(_0x31cdb2)['then'](function(_0x57fbbe){var _0x6454d3={'messageId':_0x57fbbe[_0x3cf2('0x3f')]};if(!_0x3f90a8[_0x3cf2('0x3a')]){_0x6454d3['read']=!![];}return _0x59fd3f['update'](_0x6454d3);})[_0x3cf2('0x1c')](function(_0x4cb1ca){logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),'connectel',util[_0x3cf2('0x2e')](_0x4cb1ca,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3cf2('0x2d'),_0x3cf2('0x40'),'Missing\x20parameters:\x20authToken');}break;case _0x3cf2('0x41'):if(_0x3f90a8[_0x3cf2('0x30')]&&_0x3f90a8[_0x3cf2('0x31')]){var _0x15519f={'messages':[{'source':_0x3cf2('0x42'),'to':_0x26e84f[_0x3cf2('0x24')],'body':_0x26e84f[_0x3cf2('0xf')],'from':_0x3f90a8[_0x3cf2('0x43')]||_0x3f90a8[_0x3cf2('0x24')]}]};var _0x1c68f8=util[_0x3cf2('0x44')](_0x3cf2('0x45'),_0x3f90a8['username'],_0x3f90a8[_0x3cf2('0x31')]);var _0x31cdb2={'method':_0x3cf2('0x37'),'uri':_0x3cf2('0x46'),'body':_0x15519f,'headers':{'Authorization':util[_0x3cf2('0x44')]('Basic\x20%s',new Buffer(_0x1c68f8)[_0x3cf2('0x47')](_0x3cf2('0x48')))},'json':!![]};rp(_0x31cdb2)[_0x3cf2('0x1a')](function(_0x4787e9){if(_0x4787e9[_0x3cf2('0x49')]>=0xc8&&_0x4787e9[_0x3cf2('0x49')]<=0xce){if(_0x4787e9[_0x3cf2('0x4a')]&&_0x4787e9[_0x3cf2('0x4a')][_0x3cf2('0x4b')]>0x0){var _0x3f1e36=_['head'](_0x4787e9[_0x3cf2('0x4a')][_0x3cf2('0x25')]);var _0x210ab4={'messageId':_0x3f1e36[_0x3cf2('0x4c')]};if(!_0x3f90a8['deliveryReport']){_0x210ab4['read']=!![];}return _0x59fd3f[_0x3cf2('0x1b')](_0x210ab4);}else{logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),'afterCreate',_0x3cf2('0x4d'),util[_0x3cf2('0x2e')](_0x4787e9,{'showHidden':![],'depth':null}));}}else{logger[_0x3cf2('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3cf2('0x2d'),_0x3cf2('0x4d'),util[_0x3cf2('0x2e')](_0x4787e9,{'showHidden':![],'depth':null}));}})[_0x3cf2('0x1c')](function(_0x2d9f13){logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x4d'),util[_0x3cf2('0x2e')](_0x2d9f13,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x4d'),_0x3cf2('0x3d'));}break;case _0x3cf2('0x4e'):if(_0x3f90a8[_0x3cf2('0x4f')]&&_0x3f90a8[_0x3cf2('0x23')]){var _0x15519f={'dst':_0x26e84f[_0x3cf2('0x24')],'text':_0x26e84f[_0x3cf2('0xf')],'src':_0x3f90a8['senderString']||_0x3f90a8[_0x3cf2('0x24')],'url':_0x3f90a8[_0x3cf2('0x27')]+_0x3cf2('0x28')+_0x26e84f['id']+'/status?token='+_0x3f90a8['token']};var _0x1c68f8=util[_0x3cf2('0x44')]('%s:%s',_0x3f90a8['authId'],_0x3f90a8['authToken']);var _0x31cdb2={'method':_0x3cf2('0x37'),'uri':util[_0x3cf2('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3f90a8['authId']),'body':_0x15519f,'headers':{'Authorization':util[_0x3cf2('0x44')]('Basic\x20%s',new Buffer(_0x1c68f8)[_0x3cf2('0x47')](_0x3cf2('0x48')))},'json':!![]};rp(_0x31cdb2)[_0x3cf2('0x1a')](function(_0x3f95ab){var _0x9b8015={'messageId':_0x3f95ab[_0x3cf2('0x50')][0x0]};return _0x59fd3f[_0x3cf2('0x1b')](_0x9b8015);})['catch'](function(_0x40251f){logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x4e'),util[_0x3cf2('0x2e')](_0x40251f,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3cf2('0x2d'),_0x3cf2('0x4e'),_0x3cf2('0x51'));}break;case'infobip':if(_0x3f90a8[_0x3cf2('0x30')]&&_0x3f90a8['password']){if(_0x3f90a8['baseUrl']){var _0x1f8a5d={'method':_0x3cf2('0x37'),'uri':_0x3f90a8['baseUrl']+_0x3cf2('0x52'),'body':{'username':_0x3f90a8[_0x3cf2('0x30')],'password':_0x3f90a8[_0x3cf2('0x31')]},'json':!![]};return rp(_0x1f8a5d)[_0x3cf2('0x1a')](function(_0x29eac1){var _0x3a2ca1={'method':_0x3cf2('0x37'),'uri':_0x3f90a8[_0x3cf2('0x53')]+_0x3cf2('0x54'),'body':{'messages':[{'from':_0x3f90a8[_0x3cf2('0x24')],'destinations':[{'to':_0x26e84f[_0x3cf2('0x24')]}],'text':_0x26e84f[_0x3cf2('0xf')],'notifyUrl':_0x3f90a8['remote']+'/api/sms/messages/'+_0x26e84f['id']+'/status?token='+_0x3f90a8['token'],'notifyContentType':_0x3cf2('0x55'),'callbackData':_0x3f90a8['phone']+';'+_0x26e84f[_0x3cf2('0xf')]}]},'headers':{'Authorization':_0x3cf2('0x56')+_0x29eac1[_0x3cf2('0x2a')]},'json':!![]};return rp(_0x3a2ca1)[_0x3cf2('0x1a')](function(_0x2e2fc8){if(_0x2e2fc8['messages']){var _0x46d20a={'messageId':_0x2e2fc8[_0x3cf2('0x25')][0x0][_0x3cf2('0xd')]};if(!_0x3f90a8['deliveryReport']){_0x46d20a[_0x3cf2('0x3b')]=!![];}return _0x59fd3f['update'](_0x46d20a);}else{return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x57'),util[_0x3cf2('0x2e')](_0x2e2fc8,{'showHidden':![],'depth':null}));}});})[_0x3cf2('0x1c')](function(_0x195b1e){return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x57'),util[_0x3cf2('0x2e')](_0x195b1e,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),'infobip',_0x3cf2('0x3d'));}break;case _0x3cf2('0x58'):var _0x4d819a=require(_0x3cf2('0x59'));if(_0x3f90a8[_0x3cf2('0x5a')]){var _0x56b73c={};_0x56b73c[_0x3cf2('0x5b')]=_0x3f90a8['username'];_0x56b73c[_0x3cf2('0x24')]=_0x26e84f[_0x3cf2('0x24')];_0x56b73c['sender']=_0x3f90a8[_0x3cf2('0x24')];_0x56b73c[_0x3cf2('0x5c')]=_0x26e84f[_0x3cf2('0xf')];_0x56b73c[_0x3cf2('0x5d')]=+new Date();var _0xfc2219='';var _0x3abc43='';var _0x1fd945=Object[_0x3cf2('0x5e')](_0x56b73c);_0x1fd945[_0x3cf2('0x5f')]();for(var _0x98527e=0x0;_0x98527e<_0x1fd945[_0x3cf2('0x60')];_0x98527e++){if(_0xfc2219!=''){_0xfc2219+='&';}_0xfc2219+=_0x1fd945[_0x98527e]+'='+encodeURIComponent(_0x56b73c[_0x1fd945[_0x98527e]]);_0x3abc43+=_0x56b73c[_0x1fd945[_0x98527e]];}_0x3abc43+=_0x3f90a8[_0x3cf2('0x5a')];_0x3abc43=_0x4d819a[_0x3cf2('0x61')]('md5')[_0x3cf2('0x1b')](_0x3abc43)[_0x3cf2('0x62')]('hex');if(_0xfc2219!==''){_0xfc2219+='&';}_0xfc2219+='signature='+_0x3abc43;var _0x4b460c={'method':_0x3cf2('0x63'),'uri':_0x3f90a8['baseUrl']+_0x3cf2('0x64')+_0xfc2219,'json':!![]};return rp(_0x4b460c)[_0x3cf2('0x1a')](function(_0x80ccef){var _0x5e4d21=Object['keys'](_0x80ccef);if(_0x80ccef[_0x5e4d21[0x0]][_0x3cf2('0x1d')]&&parseInt(_0x80ccef[_0x5e4d21[0x0]]['error'])===0x0){var _0x3e5817={'messageId':_0x80ccef[_0x5e4d21[0x0]][_0x3cf2('0x65')]};if(!_0x3f90a8[_0x3cf2('0x3a')]){_0x3e5817[_0x3cf2('0x3b')]=!![];}return _0x59fd3f['update'](_0x3e5817);}else{return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x58'),util[_0x3cf2('0x2e')](_0x80ccef['error'],{'showHidden':![],'depth':null}));}})[_0x3cf2('0x1c')](function(_0x125834){return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x58'),util[_0x3cf2('0x2e')](_0x125834,{'showHidden':![],'depth':null}));});}else{logger[_0x3cf2('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3cf2('0x2d'),'csc',_0x3cf2('0x66'));}break;case _0x3cf2('0x67'):if(_0x3f90a8[_0x3cf2('0x5a')]){var _0x138d3b={'method':_0x3cf2('0x37'),'uri':_0x3cf2('0x68'),'headers':{'Authorization':_0x3f90a8[_0x3cf2('0x5a')]},'body':{'content':_0x26e84f[_0x3cf2('0xf')],'to':[_0x26e84f[_0x3cf2('0x24')]],'from':_0x3f90a8[_0x3cf2('0x24')],'binary':![],'clientMessageId':_0x3cf2('0x69'),'charset':_0x3cf2('0x6a')},'json':!![]};rp(_0x138d3b)[_0x3cf2('0x1a')](function(_0x16c775){if(!_0x16c775[_0x3cf2('0x1d')]){var _0x149e4e={'messageId':_0x16c775[_0x3cf2('0x25')][0x0][_0x3cf2('0x6b')]};if(!_0x3f90a8['deliveryReport']){_0x149e4e['read']=!![];}return _0x59fd3f[_0x3cf2('0x1b')](_0x149e4e);}else{return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x67'),util[_0x3cf2('0x2e')](_0x16c775['error'],{'showHidden':![],'depth':null}));}})[_0x3cf2('0x1c')](function(_0x38bcd4){return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),'afterCreate',_0x3cf2('0x67'),util[_0x3cf2('0x2e')](_0x38bcd4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3cf2('0x2c'),_0x3cf2('0x2d'),'clickatell',_0x3cf2('0x66'));}break;case _0x3cf2('0x6c'):if(_0x3f90a8['apiKey']){var _0x3ba2dd={};var _0x4b460c={'method':_0x3cf2('0x37'),'uri':_0x3cf2('0x6d'),'headers':{'Authorization':_0x3cf2('0x6e')+_0x3f90a8[_0x3cf2('0x5a')],'Content-Type':_0x3cf2('0x55')},'body':{'from':_0x3f90a8[_0x3cf2('0x24')],'to':_0x26e84f['phone'],'text':_0x26e84f[_0x3cf2('0xf')]},'json':!![]};return rp(_0x4b460c)[_0x3cf2('0x1a')](function(_0x39c184){if(_0x39c184[_0x3cf2('0x6f')]==0xca){_0x3ba2dd['message']=_0x39c184;var _0x2e3f95={'method':_0x3cf2('0x37'),'uri':_0x3cf2('0x70'),'headers':{'Authorization':_0x3cf2('0x6e')+_0x3f90a8[_0x3cf2('0x5a')],'Content-Type':_0x3cf2('0x55')},'body':{'refid':_0x3ba2dd['message'][_0x3cf2('0x71')]},'json':!![]};return rp(_0x2e3f95)[_0x3cf2('0x1a')](function(_0x5b6f7c){_0x3ba2dd[_0x3cf2('0x72')]=_0x5b6f7c;var _0x51dc79={'messageId':_0x3ba2dd[_0x3cf2('0x73')]['refid'],'read':!![]};return _0x59fd3f[_0x3cf2('0x1b')](_0x51dc79);});}else{return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),'afterCreate',_0x3cf2('0x6c'),util['inspect'](_0x39c184,{'showHidden':![],'depth':null}));}})[_0x3cf2('0x1c')](function(_0xc231b){return logger[_0x3cf2('0x1d')](_0x3cf2('0x2c'),_0x3cf2('0x2d'),_0x3cf2('0x6c'),util[_0x3cf2('0x2e')](_0xc231b,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3cf2('0x6c'),_0x3cf2('0x74'));}break;}}})[_0x3cf2('0x75')](function(){_0x2efc43();});}else{_0x2efc43();}}},'charset':'utf8mb4','collate':_0x3cf2('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 73a5f6d..6093c9c 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 _0xad4d=['defaults','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','message','result','CreateSmsMessage','SmsMessage','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0x533297,_0xf0830f){var _0x45b9c=function(_0x1f3ee5){while(--_0x1f3ee5){_0x533297['push'](_0x533297['shift']());}};_0x45b9c(++_0xf0830f);}(_0xad4d,0x8f));var _0xdad4=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xad4d[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xdad4('0x0'));var util=require('util');var moment=require(_0xdad4('0x1'));var BPromise=require(_0xdad4('0x2'));var rs=require(_0xdad4('0x3'));var fs=require('fs');var Redis=require(_0xdad4('0x4'));var db=require(_0xdad4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdad4('0x6'))(_0xdad4('0x7'));var config=require(_0xdad4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdad4('0x9')][_0xdad4('0xa')]({'port':0x232a});config[_0xdad4('0xb')]=_[_0xdad4('0xc')](config[_0xdad4('0xb')],{'host':_0xdad4('0xd'),'port':0x18eb});var socket=require(_0xdad4('0xe'))(new Redis(config[_0xdad4('0xb')]));require(_0xdad4('0xf'))['register'](socket);function respondWithRpcPromise(_0x4b4120,_0x1ead22,_0x5b1248){return new BPromise(function(_0x45fb88,_0x1e3f8b){return client['request'](_0x4b4120,_0x5b1248)[_0xdad4('0x10')](function(_0x46d316){logger[_0xdad4('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1ead22,_0xdad4('0x12'));logger[_0xdad4('0x13')](_0xdad4('0x14'),_0x1ead22,_0xdad4('0x12'),JSON[_0xdad4('0x15')](_0x46d316));if(_0x46d316[_0xdad4('0x16')]){if(_0x46d316['error'][_0xdad4('0x17')]===0x1f4){logger[_0xdad4('0x16')](_0xdad4('0x18'),_0x1ead22,_0x46d316[_0xdad4('0x16')][_0xdad4('0x19')]);return _0x1e3f8b(_0x46d316[_0xdad4('0x16')]['message']);}logger['error'](_0xdad4('0x18'),_0x1ead22,_0x46d316[_0xdad4('0x16')][_0xdad4('0x19')]);return _0x45fb88(_0x46d316[_0xdad4('0x16')][_0xdad4('0x19')]);}else{logger[_0xdad4('0x11')]('SmsMessage,\x20%s,\x20%s',_0x1ead22,_0xdad4('0x12'));_0x45fb88(_0x46d316[_0xdad4('0x1a')]['message']);}})['catch'](function(_0x5f43b0){logger['error'](_0xdad4('0x18'),_0x1ead22,_0x5f43b0);_0x1e3f8b(_0x5f43b0);});});}exports[_0xdad4('0x1b')]=function(_0x141011){var _0x47f0c4=this;return new Promise(function(_0x16a803,_0x203a88){return db[_0xdad4('0x1c')]['create'](_0x141011['body'],{'raw':_0x141011['options']?_0x141011['options'][_0xdad4('0x1d')]===undefined?!![]:![]:!![]})[_0xdad4('0x10')](function(_0x3c1a95){logger['info'](_0xdad4('0x1b'),_0x141011);logger[_0xdad4('0x13')]('CreateSmsMessage',_0x141011,JSON[_0xdad4('0x15')](_0x3c1a95));_0x16a803(_0x3c1a95);})[_0xdad4('0x1e')](function(_0x178a82){logger[_0xdad4('0x16')](_0xdad4('0x1b'),_0x178a82['message'],_0x141011);_0x203a88(_0x47f0c4[_0xdad4('0x16')](0x1f4,_0x178a82[_0xdad4('0x19')]));});});}; \ No newline at end of file +var _0x9be6=['request\x20sent','error','code','message','result','catch','CreateSmsMessage','create','options','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','register','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x11895f,_0x46537c){var _0x25cd20=function(_0x5cad36){while(--_0x5cad36){_0x11895f['push'](_0x11895f['shift']());}};_0x25cd20(++_0x46537c);}(_0x9be6,0xd6));var _0x69be=function(_0x439f13,_0x300c0a){_0x439f13=_0x439f13-0x0;var _0x1e8330=_0x9be6[_0x439f13];return _0x1e8330;};'use strict';var _=require(_0x69be('0x0'));var util=require(_0x69be('0x1'));var moment=require('moment');var BPromise=require(_0x69be('0x2'));var rs=require(_0x69be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69be('0x4'))['db'];var utils=require(_0x69be('0x5'));var logger=require(_0x69be('0x6'))(_0x69be('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x69be('0x8')]['http']({'port':0x232a});config[_0x69be('0x9')]=_[_0x69be('0xa')](config[_0x69be('0x9')],{'host':_0x69be('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x69be('0x9')]));require('./smsMessage.socket')[_0x69be('0xc')](socket);function respondWithRpcPromise(_0xc3b6ac,_0xd1a85e,_0x27cc85){return new BPromise(function(_0x20a37c,_0x3f76eb){return client[_0x69be('0xd')](_0xc3b6ac,_0x27cc85)[_0x69be('0xe')](function(_0xaa8368){logger[_0x69be('0xf')](_0x69be('0x10'),_0xd1a85e,'request\x20sent');logger['debug'](_0x69be('0x11'),_0xd1a85e,_0x69be('0x12'),JSON['stringify'](_0xaa8368));if(_0xaa8368[_0x69be('0x13')]){if(_0xaa8368[_0x69be('0x13')][_0x69be('0x14')]===0x1f4){logger[_0x69be('0x13')](_0x69be('0x10'),_0xd1a85e,_0xaa8368[_0x69be('0x13')][_0x69be('0x15')]);return _0x3f76eb(_0xaa8368[_0x69be('0x13')]['message']);}logger[_0x69be('0x13')](_0x69be('0x10'),_0xd1a85e,_0xaa8368['error'][_0x69be('0x15')]);return _0x20a37c(_0xaa8368[_0x69be('0x13')]['message']);}else{logger[_0x69be('0xf')](_0x69be('0x10'),_0xd1a85e,_0x69be('0x12'));_0x20a37c(_0xaa8368[_0x69be('0x16')][_0x69be('0x15')]);}})[_0x69be('0x17')](function(_0x6d32fe){logger['error'](_0x69be('0x10'),_0xd1a85e,_0x6d32fe);_0x3f76eb(_0x6d32fe);});});}exports[_0x69be('0x18')]=function(_0x3f2393){var _0x3bddbe=this;return new Promise(function(_0x55e12d,_0x102cea){return db['SmsMessage'][_0x69be('0x19')](_0x3f2393['body'],{'raw':_0x3f2393[_0x69be('0x1a')]?_0x3f2393[_0x69be('0x1a')][_0x69be('0x1b')]===undefined?!![]:![]:!![]})[_0x69be('0xe')](function(_0x5b895c){logger[_0x69be('0xf')](_0x69be('0x18'),_0x3f2393);logger[_0x69be('0x1c')](_0x69be('0x18'),_0x3f2393,JSON['stringify'](_0x5b895c));_0x55e12d(_0x5b895c);})['catch'](function(_0x582e77){logger[_0x69be('0x13')](_0x69be('0x18'),_0x582e77[_0x69be('0x15')],_0x3f2393);_0x102cea(_0x3bddbe['error'](0x1f4,_0x582e77['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index bb599f5..8761678 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 _0x9e4a=['removeListener','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0x18f2c5,_0x2bc9e1){var _0x1ef5c7=function(_0x4792e3){while(--_0x4792e3){_0x18f2c5['push'](_0x18f2c5['shift']());}};_0x1ef5c7(++_0x2bc9e1);}(_0x9e4a,0xb6));var _0xa9e4=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9e4a[_0x3070dc];return _0x431489;};'use strict';var SmsMessageEvents=require(_0xa9e4('0x0'));var events=[_0xa9e4('0x1'),_0xa9e4('0x2'),_0xa9e4('0x3')];function createListener(_0x31b2c3,_0x352998){return function(_0x1493ca){_0x352998['emit'](_0x31b2c3,_0x1493ca);};}function removeListener(_0x1592de,_0x7b15cc){return function(){SmsMessageEvents[_0xa9e4('0x4')](_0x1592de,_0x7b15cc);};}exports['register']=function(_0x5731b4){for(var _0x4529b5=0x0,_0x51ad11=events['length'];_0x4529b5<_0x51ad11;_0x4529b5++){var _0x3c2bdc=events[_0x4529b5];var _0x364c60=createListener(_0xa9e4('0x5')+_0x3c2bdc,_0x5731b4);SmsMessageEvents['on'](_0x3c2bdc,_0x364c60);}}; \ No newline at end of file +var _0xa460=['./smsMessage.events','save','remove','update','register','length','smsMessage:'];(function(_0xfc7e18,_0x5743f3){var _0x1eb07c=function(_0x1d7a13){while(--_0x1d7a13){_0xfc7e18['push'](_0xfc7e18['shift']());}};_0x1eb07c(++_0x5743f3);}(_0xa460,0x85));var _0x0a46=function(_0xd04611,_0x6f7365){_0xd04611=_0xd04611-0x0;var _0x72e2db=_0xa460[_0xd04611];return _0x72e2db;};'use strict';var SmsMessageEvents=require(_0x0a46('0x0'));var events=[_0x0a46('0x1'),_0x0a46('0x2'),_0x0a46('0x3')];function createListener(_0x26e108,_0x53e3b8){return function(_0x592be0){_0x53e3b8['emit'](_0x26e108,_0x592be0);};}function removeListener(_0x45c8fc,_0x270d79){return function(){SmsMessageEvents['removeListener'](_0x45c8fc,_0x270d79);};}exports[_0x0a46('0x4')]=function(_0x308e17){for(var _0xfbcde3=0x0,_0x770803=events[_0x0a46('0x5')];_0xfbcde3<_0x770803;_0xfbcde3++){var _0x59a3d4=events[_0xfbcde3];var _0x1aa21c=createListener(_0x0a46('0x6')+_0x59a3d4,_0x308e17);SmsMessageEvents['on'](_0x59a3d4,_0x1aa21c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3ae6a95..07b2bd9 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 _0x7ebb=['destroy','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','/:id','update','delete'];(function(_0x15fc07,_0x41cc0c){var _0x3d2c0f=function(_0x2a9a17){while(--_0x2a9a17){_0x15fc07['push'](_0x15fc07['shift']());}};_0x3d2c0f(++_0x41cc0c);}(_0x7ebb,0x161));var _0xb7eb=function(_0xaf326d,_0xc3a37c){_0xaf326d=_0xaf326d-0x0;var _0x4aacda=_0x7ebb[_0xaf326d];return _0x4aacda;};'use strict';var multer=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var path=require(_0xb7eb('0x2'));var timeout=require(_0xb7eb('0x3'));var express=require(_0xb7eb('0x4'));var router=express[_0xb7eb('0x5')]();var auth=require(_0xb7eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb7eb('0x7'));var controller=require(_0xb7eb('0x8'));router[_0xb7eb('0x9')]('/',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xb')]);router[_0xb7eb('0x9')](_0xb7eb('0xc'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0xd')]);router[_0xb7eb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb7eb('0xe')]);router[_0xb7eb('0x9')](_0xb7eb('0xf'),auth[_0xb7eb('0xa')](),controller['getMembers']);router[_0xb7eb('0x9')](_0xb7eb('0x10'),auth['isAuthenticated'](),controller[_0xb7eb('0x11')]);router[_0xb7eb('0x9')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x13')]);router[_0xb7eb('0x14')]('/',auth[_0xb7eb('0xa')](),controller['create']);router[_0xb7eb('0x14')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['addTeams']);router[_0xb7eb('0x14')](_0xb7eb('0x12'),auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x15')]);router['put'](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x17')]);router[_0xb7eb('0x18')](_0xb7eb('0x16'),auth['isAuthenticated'](),controller[_0xb7eb('0x19')]);router[_0xb7eb('0x18')](_0xb7eb('0x10'),auth[_0xb7eb('0xa')](),controller['removeTeams']);router[_0xb7eb('0x18')]('/:id/users',auth[_0xb7eb('0xa')](),controller[_0xb7eb('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x482d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x17665a,_0x55b537){var _0x5684fc=function(_0x22eef0){while(--_0x22eef0){_0x17665a['push'](_0x17665a['shift']());}};_0x5684fc(++_0x55b537);}(_0x482d,0x16c));var _0xd482=function(_0x25d66b,_0x2bd29d){_0x25d66b=_0x25d66b-0x0;var _0x27d0ac=_0x482d[_0x25d66b];return _0x27d0ac;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd482('0x0'));var timeout=require(_0xd482('0x1'));var express=require(_0xd482('0x2'));var router=express[_0xd482('0x3')]();var auth=require(_0xd482('0x4'));var interaction=require(_0xd482('0x5'));var config=require('../../config/environment');var controller=require(_0xd482('0x6'));router[_0xd482('0x7')]('/',auth[_0xd482('0x8')](),controller['index']);router[_0xd482('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd482('0x7')](_0xd482('0x9'),auth[_0xd482('0x8')](),controller['show']);router[_0xd482('0x7')](_0xd482('0xa'),auth[_0xd482('0x8')](),controller[_0xd482('0xb')]);router[_0xd482('0x7')](_0xd482('0xc'),auth[_0xd482('0x8')](),controller[_0xd482('0xd')]);router['get'](_0xd482('0xe'),auth[_0xd482('0x8')](),controller[_0xd482('0xf')]);router[_0xd482('0x10')]('/',auth['isAuthenticated'](),controller[_0xd482('0x11')]);router[_0xd482('0x10')](_0xd482('0xc'),auth['isAuthenticated'](),controller[_0xd482('0x12')]);router['post']('/:id/users',auth[_0xd482('0x8')](),controller['addAgents']);router[_0xd482('0x13')](_0xd482('0x9'),auth['isAuthenticated'](),controller[_0xd482('0x14')]);router[_0xd482('0x15')](_0xd482('0x9'),auth[_0xd482('0x8')](),controller[_0xd482('0x16')]);router['delete'](_0xd482('0xc'),auth[_0xd482('0x8')](),controller[_0xd482('0x17')]);router['delete'](_0xd482('0xe'),auth[_0xd482('0x8')](),controller[_0xd482('0x18')]);module[_0xd482('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index bdee4a5..0655a37 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 _0xec62=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xec62,0x118));var _0x2ec6=function(_0x44960d,_0x27ab5f){_0x44960d=_0x44960d-0x0;var _0x370dbf=_0xec62[_0x44960d];return _0x370dbf;};'use strict';var Sequelize=require(_0x2ec6('0x0'));module['exports']={'name':{'type':Sequelize[_0x2ec6('0x1')],'unique':_0x2ec6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2ec6('0x1')]},'timeout':{'type':Sequelize[_0x2ec6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2ec6('0x4')](_0x2ec6('0x5'),_0x2ec6('0x6'),_0x2ec6('0x7'))}}; \ No newline at end of file +var _0xa13d=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x3984a6,_0x4adaba){var _0x2cc75f=function(_0x4a3849){while(--_0x4a3849){_0x3984a6['push'](_0x3984a6['shift']());}};_0x2cc75f(++_0x4adaba);}(_0xa13d,0x86));var _0xda13=function(_0x18baf7,_0x4cc1a2){_0x18baf7=_0x18baf7-0x0;var _0x3fc89e=_0xa13d[_0x18baf7];return _0x3fc89e;};'use strict';var Sequelize=require(_0xda13('0x0'));module['exports']={'name':{'type':Sequelize[_0xda13('0x1')],'unique':_0xda13('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xda13('0x1')]},'timeout':{'type':Sequelize[_0xda13('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda13('0x4')]('rrmemory',_0xda13('0x5'),_0xda13('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f351e74..9636139 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 _0x793b=['type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','filtears','create','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','SmsQueueId','findAll','UserId','updatedAt','createdAt','smsPause','getTeams','findOne','addTeams','ids','Team','User','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','end','error','stack','send','index','map','SmsQueue','rawAttributes','fieldName'];(function(_0x40f55a,_0x2bbeff){var _0x403176=function(_0x4b36aa){while(--_0x4b36aa){_0x40f55a['push'](_0x40f55a['shift']());}};_0x403176(++_0x2bbeff);}(_0x793b,0x1f2));var _0xb793=function(_0x2bac0a,_0x41ec84){_0x2bac0a=_0x2bac0a-0x0;var _0x493944=_0x793b[_0x2bac0a];return _0x493944;};'use strict';var pdf=require(_0xb793('0x0'));var emlformat=require(_0xb793('0x1'));var rimraf=require(_0xb793('0x2'));var zipdir=require(_0xb793('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb793('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb793('0x5'));var util=require('util');var path=require(_0xb793('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb793('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb793('0x8'));var crypto=require(_0xb793('0x9'));var jsforce=require(_0xb793('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb793('0xb'));var querystring=require(_0xb793('0xc'));var Papa=require(_0xb793('0xd'));var Redis=require(_0xb793('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb793('0xf'));var logger=require(_0xb793('0x10'))(_0xb793('0x11'));var utils=require('../../config/utils');var config=require(_0xb793('0x12'));var licenseUtil=require(_0xb793('0x13'));var db=require(_0xb793('0x14'))['db'];config[_0xb793('0x15')]=_[_0xb793('0x16')](config[_0xb793('0x15')],{'host':_0xb793('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb793('0x15')]));require(_0xb793('0x18'))[_0xb793('0x19')](socket);function respondWithStatusCode(_0x4274fa,_0x24524f){_0x24524f=_0x24524f||0xcc;return function(_0xe391be){if(_0xe391be){return _0x4274fa[_0xb793('0x1a')](_0x24524f);}return _0x4274fa[_0xb793('0x1b')](_0x24524f)['end']();};}function respondWithResult(_0x468a31,_0x566fa1){_0x566fa1=_0x566fa1||0xc8;return function(_0x41e740){if(_0x41e740){return _0x468a31[_0xb793('0x1b')](_0x566fa1)[_0xb793('0x1c')](_0x41e740);}};}function respondWithFilteredResult(_0x49b39c,_0x2a0ce3){return function(_0x33e423){if(_0x33e423){var _0xe9c04a=_0x33e423[_0xb793('0x1d')],_0x3dbd66=_0x2a0ce3[_0xb793('0x1e')],_0x4274f0=_0x2a0ce3['offset']+_0x2a0ce3[_0xb793('0x1f')],_0x2d6a77;if(_0x4274f0>=_0xe9c04a){_0x4274f0=_0xe9c04a;_0x2d6a77=0xc8;}else{_0x2d6a77=0xce;}_0x49b39c[_0xb793('0x1b')](_0x2d6a77);return _0x49b39c['set']('Content-Range',_0x3dbd66+'-'+_0x4274f0+'/'+_0xe9c04a)[_0xb793('0x1c')](_0x33e423);}return null;};}function patchUpdates(_0x51e03d){return function(_0x3ad561){try{jsonpatch[_0xb793('0x20')](_0x3ad561,_0x51e03d,!![]);}catch(_0x4ff8c2){return BPromise[_0xb793('0x21')](_0x4ff8c2);}return _0x3ad561[_0xb793('0x22')]();};}function saveUpdates(_0x1274c0,_0x497d3c){return function(_0x47814f){if(_0x47814f){return _0x47814f[_0xb793('0x23')](_0x1274c0)[_0xb793('0x24')](function(_0x300cc8){return _0x300cc8;});}return null;};}function removeEntity(_0x4503fb,_0x2b2cb1){return function(_0x3963f1){if(_0x3963f1){return _0x3963f1[_0xb793('0x25')]()['then'](function(){var _0x28384b=_0x3963f1[_0xb793('0x26')]({'plain':!![]});var _0x2d47dd=_0xb793('0x27');return db[_0xb793('0x28')][_0xb793('0x25')]({'where':{'type':_0x2d47dd,'resourceId':_0x28384b['id']}})['then'](function(){return _0x3963f1;});})[_0xb793('0x24')](function(){_0x4503fb[_0xb793('0x1b')](0xcc)[_0xb793('0x29')]();});}};}function handleEntityNotFound(_0x5676cd,_0x2cf3fd){return function(_0x3fcc3e){if(!_0x3fcc3e){_0x5676cd[_0xb793('0x1a')](0x194);}return _0x3fcc3e;};}function handleError(_0x2328bd,_0x4ba1be){_0x4ba1be=_0x4ba1be||0x1f4;return function(_0x5b1fc5){logger[_0xb793('0x2a')](_0x5b1fc5[_0xb793('0x2b')]);if(_0x5b1fc5['name']){delete _0x5b1fc5['name'];}_0x2328bd[_0xb793('0x1b')](_0x4ba1be)[_0xb793('0x2c')](_0x5b1fc5);};}exports[_0xb793('0x2d')]=function(_0xe8c4b7,_0x47b4ad){var _0x380bb0={},_0x618421={},_0xe3816a={'count':0x0,'rows':[]};var _0x5cb46f=_[_0xb793('0x2e')](db[_0xb793('0x2f')][_0xb793('0x30')],function(_0x26ed54){return{'name':_0x26ed54[_0xb793('0x31')],'type':_0x26ed54[_0xb793('0x32')]['key']};});_0x618421[_0xb793('0x33')]=_[_0xb793('0x2e')](_0x5cb46f,_0xb793('0x34'));_0x618421[_0xb793('0x35')]=_[_0xb793('0x36')](_0xe8c4b7[_0xb793('0x35')]);_0x618421[_0xb793('0x37')]=_['intersection'](_0x618421['model'],_0x618421[_0xb793('0x35')]);_0x380bb0['attributes']=_[_0xb793('0x38')](_0x618421[_0xb793('0x33')],qs['fields'](_0xe8c4b7[_0xb793('0x35')][_0xb793('0x39')]));_0x380bb0[_0xb793('0x3a')]=_0x380bb0[_0xb793('0x3a')][_0xb793('0x3b')]?_0x380bb0[_0xb793('0x3a')]:_0x618421['model'];if(!_0xe8c4b7[_0xb793('0x35')][_0xb793('0x3c')](_0xb793('0x3d'))){_0x380bb0[_0xb793('0x1f')]=qs[_0xb793('0x1f')](_0xe8c4b7[_0xb793('0x35')][_0xb793('0x1f')]);_0x380bb0[_0xb793('0x1e')]=qs[_0xb793('0x1e')](_0xe8c4b7[_0xb793('0x35')][_0xb793('0x1e')]);}_0x380bb0[_0xb793('0x3e')]=qs[_0xb793('0x3f')](_0xe8c4b7['query']['sort']);_0x380bb0[_0xb793('0x40')]=qs['filters'](_[_0xb793('0x41')](_0xe8c4b7['query'],_0x618421[_0xb793('0x37')]),_0x5cb46f);if(_0xe8c4b7[_0xb793('0x35')]['filter']){_0x380bb0[_0xb793('0x40')]=_[_0xb793('0x42')](_0x380bb0['where'],{'$or':_[_0xb793('0x2e')](_0x5cb46f,function(_0x2a0625){if(_0x2a0625[_0xb793('0x32')]!==_0xb793('0x43')){var _0x44fe9a={};_0x44fe9a[_0x2a0625[_0xb793('0x34')]]={'$like':'%'+_0xe8c4b7['query'][_0xb793('0x44')]+'%'};return _0x44fe9a;}})});}_0x380bb0=_['merge']({},_0x380bb0,_0xe8c4b7[_0xb793('0x45')]);var _0x309aa8={'where':_0x380bb0['where']};return db[_0xb793('0x2f')][_0xb793('0x1d')](_0x309aa8)[_0xb793('0x24')](function(_0x1c6cc9){_0xe3816a[_0xb793('0x1d')]=_0x1c6cc9;if(_0xe8c4b7[_0xb793('0x35')][_0xb793('0x46')]){_0x380bb0[_0xb793('0x47')]=[{'all':!![]}];}return db[_0xb793('0x2f')]['findAll'](_0x380bb0);})[_0xb793('0x24')](function(_0x361a70){_0xe3816a[_0xb793('0x48')]=_0x361a70;return _0xe3816a;})[_0xb793('0x24')](respondWithFilteredResult(_0x47b4ad,_0x380bb0))[_0xb793('0x49')](handleError(_0x47b4ad,null));};exports[_0xb793('0x4a')]=function(_0x57ab13,_0x4dd9c6){var _0x345a5f={'raw':!![],'where':{'id':_0x57ab13[_0xb793('0x4b')]['id']}},_0x270e45={};_0x270e45[_0xb793('0x33')]=_[_0xb793('0x36')](db['SmsQueue'][_0xb793('0x30')]);_0x270e45[_0xb793('0x35')]=_[_0xb793('0x36')](_0x57ab13['query']);_0x270e45[_0xb793('0x4c')]=_[_0xb793('0x38')](_0x270e45[_0xb793('0x33')],_0x270e45[_0xb793('0x35')]);_0x345a5f[_0xb793('0x3a')]=_['intersection'](_0x270e45[_0xb793('0x33')],qs[_0xb793('0x39')](_0x57ab13[_0xb793('0x35')]['fields']));_0x345a5f[_0xb793('0x3a')]=_0x345a5f[_0xb793('0x3a')]['length']?_0x345a5f[_0xb793('0x3a')]:_0x270e45[_0xb793('0x33')];if(_0x57ab13[_0xb793('0x35')][_0xb793('0x46')]){_0x345a5f[_0xb793('0x47')]=[{'all':!![]}];}_0x345a5f=_[_0xb793('0x42')]({},_0x345a5f,_0x57ab13['options']);return db[_0xb793('0x2f')]['find'](_0x345a5f)[_0xb793('0x24')](handleEntityNotFound(_0x4dd9c6,null))[_0xb793('0x24')](respondWithResult(_0x4dd9c6,null))[_0xb793('0x49')](handleError(_0x4dd9c6,null));};exports[_0xb793('0x4d')]=function(_0x2cc9e6,_0x58ae06){return db[_0xb793('0x2f')]['create'](_0x2cc9e6['body'],{})['then'](function(_0x36f639){var _0x3424ea=_0x2cc9e6[_0xb793('0x4e')]['get']({'plain':!![]});if(!_0x3424ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3424ea['role']===_0xb793('0x4e')){var _0x4b8d2e=_0x36f639[_0xb793('0x26')]({'plain':!![]});var _0x4253d9=_0xb793('0x27');return db[_0xb793('0x4f')][_0xb793('0x50')]({'where':{'name':_0x4253d9,'userProfileId':_0x3424ea[_0xb793('0x51')]},'raw':!![]})[_0xb793('0x24')](function(_0x21f690){if(_0x21f690&&_0x21f690[_0xb793('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b8d2e[_0xb793('0x34')],'resourceId':_0x4b8d2e['id'],'type':_0x21f690['name'],'sectionId':_0x21f690['id']},{})['then'](function(){return _0x36f639;});}else{return _0x36f639;}})['catch'](function(_0x5b391e){logger['error'](_0xb793('0x53'),_0x5b391e);throw _0x5b391e;});}return _0x36f639;})[_0xb793('0x24')](respondWithResult(_0x58ae06,0xc9))[_0xb793('0x49')](handleError(_0x58ae06,null));};exports['update']=function(_0x3f6b68,_0x34aa3d){if(_0x3f6b68['body']['id']){delete _0x3f6b68['body']['id'];}return db[_0xb793('0x2f')][_0xb793('0x50')]({'where':{'id':_0x3f6b68[_0xb793('0x4b')]['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x34aa3d,null))[_0xb793('0x24')](saveUpdates(_0x3f6b68[_0xb793('0x54')],null))[_0xb793('0x24')](respondWithResult(_0x34aa3d,null))[_0xb793('0x49')](handleError(_0x34aa3d,null));};exports[_0xb793('0x25')]=function(_0x3a61e9,_0x4a4354){return db[_0xb793('0x2f')][_0xb793('0x50')]({'where':{'id':_0x3a61e9['params']['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x4a4354,null))[_0xb793('0x24')](removeEntity(_0x4a4354,null))['catch'](handleError(_0x4a4354,null));};exports['describe']=function(_0x36d0b4,_0x5110c9){return db['SmsQueue'][_0xb793('0x55')]()[_0xb793('0x24')](respondWithResult(_0x5110c9,null))[_0xb793('0x49')](handleError(_0x5110c9,null));};exports[_0xb793('0x56')]=function(_0x30c5e5,_0x595dce,_0x52ae29){var _0x5cd7a0={'raw':!![],'where':{}},_0x5f13e3={},_0x81cb7b;return db[_0xb793('0x2f')]['findOne']({'where':{'id':_0x30c5e5[_0xb793('0x4b')]['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x595dce,null))[_0xb793('0x24')](function(_0x2ef7ac){if(_0x2ef7ac){_0x81cb7b=_0x2ef7ac[_0xb793('0x26')]({'plain':!![]});_0x5f13e3[_0xb793('0x33')]=_[_0xb793('0x36')](db[_0xb793('0x57')]['rawAttributes']);_0x5f13e3[_0xb793('0x35')]=_['keys'](_0x30c5e5['query']);_0x5f13e3[_0xb793('0x37')]=_[_0xb793('0x38')](_0x5f13e3[_0xb793('0x33')],_0x5f13e3[_0xb793('0x35')]);_0x5cd7a0[_0xb793('0x3a')]=_[_0xb793('0x38')](_0x5f13e3[_0xb793('0x33')],qs[_0xb793('0x39')](_0x30c5e5[_0xb793('0x35')][_0xb793('0x39')]));_0x5cd7a0[_0xb793('0x3a')]=_0x5cd7a0['attributes'][_0xb793('0x3b')]?_0x5cd7a0[_0xb793('0x3a')]:_0x5f13e3[_0xb793('0x33')];if(!_0x30c5e5[_0xb793('0x35')][_0xb793('0x3c')](_0xb793('0x3d'))){_0x5cd7a0[_0xb793('0x1f')]=qs['limit'](_0x30c5e5[_0xb793('0x35')]['limit']);_0x5cd7a0[_0xb793('0x1e')]=qs['offset'](_0x30c5e5[_0xb793('0x35')][_0xb793('0x1e')]);}_0x5cd7a0[_0xb793('0x3e')]=qs[_0xb793('0x3f')](_0x30c5e5[_0xb793('0x35')]['sort']);_0x5cd7a0[_0xb793('0x40')]=qs[_0xb793('0x37')](_[_0xb793('0x41')](_0x30c5e5[_0xb793('0x35')],_0x5f13e3[_0xb793('0x37')]));_0x5cd7a0[_0xb793('0x40')][_0xb793('0x58')]=_0x2ef7ac['id'];if(_0x30c5e5[_0xb793('0x35')][_0xb793('0x44')]){_0x5cd7a0[_0xb793('0x40')]=_[_0xb793('0x42')](_0x5cd7a0[_0xb793('0x40')],{'$or':_[_0xb793('0x2e')](_0x5cd7a0[_0xb793('0x3a')],function(_0x95611b){var _0x1fc269={};_0x1fc269[_0x95611b]={'$like':'%'+_0x30c5e5[_0xb793('0x35')][_0xb793('0x44')]+'%'};return _0x1fc269;})});}_0x5cd7a0=_[_0xb793('0x42')]({},_0x5cd7a0,_0x30c5e5[_0xb793('0x45')]);return db[_0xb793('0x57')][_0xb793('0x59')](_0x5cd7a0);}})['then'](function(_0x48ecfd){if(_0x48ecfd){return db['User']['findAndCountAll']({'where':{'id':_[_0xb793('0x2e')](_0x48ecfd,_0xb793('0x5a')),'role':'agent'},'attributes':['id','name','smsPause',_0xb793('0x5b'),_0xb793('0x5c')]});}})['then'](function(_0x10787f){if(_0x10787f){return{'count':_0x10787f['count'],'rows':_[_0xb793('0x2e')](_0x10787f[_0xb793('0x48')],function(_0x5827cd){return{'membername':_0x5827cd[_0xb793('0x34')],'UserId':_0x5827cd['id'],'queue_name':_0x81cb7b[_0xb793('0x34')],'SmsQueueId':_0x81cb7b['id'],'interface':util['format']('%s/%s','SIP',_0x5827cd[_0xb793('0x34')]),'penalty':0x0,'paused':_0x5827cd[_0xb793('0x5d')],'createdAt':_0x5827cd[_0xb793('0x5c')],'updatedAt':_0x5827cd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x595dce,_0x5cd7a0))['catch'](handleError(_0x595dce,null));};exports[_0xb793('0x5e')]=function(_0x279470,_0x124553,_0x244bcb){var _0x44dac2={};var _0x1fbf8e={};var _0xb926df;var _0x4779e;return db[_0xb793('0x2f')][_0xb793('0x5f')]({'where':{'id':_0x279470['params']['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x124553,null))['then'](function(_0x1c0671){if(_0x1c0671){_0xb926df=_0x1c0671;_0x1fbf8e[_0xb793('0x33')]=_[_0xb793('0x36')](db['Team'][_0xb793('0x30')]);_0x1fbf8e[_0xb793('0x35')]=_[_0xb793('0x36')](_0x279470[_0xb793('0x35')]);_0x1fbf8e['filters']=_[_0xb793('0x38')](_0x1fbf8e[_0xb793('0x33')],_0x1fbf8e['query']);_0x44dac2[_0xb793('0x3a')]=_[_0xb793('0x38')](_0x1fbf8e[_0xb793('0x33')],qs[_0xb793('0x39')](_0x279470['query']['fields']));_0x44dac2[_0xb793('0x3a')]=_0x44dac2['attributes'][_0xb793('0x3b')]?_0x44dac2[_0xb793('0x3a')]:_0x1fbf8e[_0xb793('0x33')];_0x44dac2['order']=qs['sort'](_0x279470['query']['sort']);_0x44dac2['where']=qs['filters'](_[_0xb793('0x41')](_0x279470[_0xb793('0x35')],_0x1fbf8e[_0xb793('0x37')]));if(_0x279470[_0xb793('0x35')][_0xb793('0x44')]){_0x44dac2[_0xb793('0x40')]=_[_0xb793('0x42')](_0x44dac2[_0xb793('0x40')],{'$or':_['map'](_0x44dac2[_0xb793('0x3a')],function(_0x163d17){var _0x15de9c={};_0x15de9c[_0x163d17]={'$like':'%'+_0x279470[_0xb793('0x35')][_0xb793('0x44')]+'%'};return _0x15de9c;})});}_0x44dac2=_[_0xb793('0x42')]({},_0x44dac2,_0x279470[_0xb793('0x45')]);return _0xb926df[_0xb793('0x5e')](_0x44dac2);}})[_0xb793('0x24')](function(_0x167a9f){if(_0x167a9f){_0x4779e=_0x167a9f[_0xb793('0x3b')];if(!_0x279470['query']['hasOwnProperty'](_0xb793('0x3d'))){_0x44dac2[_0xb793('0x1f')]=qs[_0xb793('0x1f')](_0x279470[_0xb793('0x35')][_0xb793('0x1f')]);_0x44dac2['offset']=qs['offset'](_0x279470[_0xb793('0x35')]['offset']);}return _0xb926df[_0xb793('0x5e')](_0x44dac2);}})[_0xb793('0x24')](function(_0x5b0ad6){if(_0x5b0ad6){return _0x5b0ad6?{'count':_0x4779e,'rows':_0x5b0ad6}:null;}})[_0xb793('0x24')](respondWithResult(_0x124553,null))['catch'](handleError(_0x124553,null));};exports[_0xb793('0x60')]=function(_0x832cf7,_0x49e20c,_0x53672c){var _0x3264a9=_0x832cf7[_0xb793('0x54')][_0xb793('0x61')];return db[_0xb793('0x62')][_0xb793('0x59')]({'where':{'id':_0x3264a9},'attributes':['id'],'include':[{'model':db[_0xb793('0x63')],'as':'Agents','attributes':['id',_0xb793('0x34'),_0xb793('0x64'),_0xb793('0x65'),'interface'],'raw':!![]}]})[_0xb793('0x24')](function(_0x520d1d){if(_0x520d1d){var _0x66c0b9=_[_0xb793('0x66')](_0x520d1d,function(_0x413835){var _0x391f54=_0x413835['get']({'plain':!![]});return _0x391f54['Agents'];});return db[_0xb793('0x2f')]['find']({'where':{'id':_0x832cf7['params']['id']}})[_0xb793('0x24')](function(_0x96760b){return db[_0xb793('0x67')]['transaction'](function(_0x3aab29){return _0x96760b['addTeams'](_0x3264a9,{'transaction':_0x3aab29})[_0xb793('0x24')](function(){return BPromise[_0xb793('0x68')](_0x66c0b9,function(_0xb09c49){return db[_0xb793('0x57')][_0xb793('0x69')]({'where':{'UserId':_0xb09c49['id'],'SmsQueueId':_0x832cf7[_0xb793('0x4b')]['id']},'transaction':_0x3aab29});});})['then'](function(){_0x66c0b9[_0xb793('0x6a')](function(_0x5d52b9){socket[_0xb793('0x6b')](_0xb793('0x6c'),{'UserId':_0x5d52b9['id'],'SmsQueueId':_0x96760b['id']});});});});});}})[_0xb793('0x24')](respondWithStatusCode(_0x49e20c,null))[_0xb793('0x49')](handleError(_0x49e20c,null));};exports[_0xb793('0x6d')]=function(_0x57111e,_0x42020a,_0x298297){return db['Team']['findAll']({'where':{'id':_0x57111e[_0xb793('0x35')][_0xb793('0x61')]},'attributes':['id'],'include':[{'model':db[_0xb793('0x63')],'as':_0xb793('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xb793('0x24')](handleEntityNotFound(_0x42020a,null))[_0xb793('0x24')](function(_0x445614){var _0x406831=_[_0xb793('0x2e')](_0x445614,'id');var _0x31491e=[];var _0x4a6346=[];var _0x346793=squel[_0xb793('0x6f')]();_0x346793[_0xb793('0x70')](_0xb793('0x71'))[_0xb793('0x72')](_0xb793('0x73'),'tq')[_0xb793('0x74')](_0xb793('0x75'),'ut',_0xb793('0x76'))[_0xb793('0x40')](_0xb793('0x77'),_0x57111e[_0xb793('0x4b')]['id']);for(var _0x37af47=0x0;_0x37af47<_0x445614[_0xb793('0x3b')];_0x37af47+=0x1){let _0x4b4d85=_0x445614[_0x37af47];for(var _0x333fef=0x0;_0x333fef<_0x4b4d85[_0xb793('0x6e')][_0xb793('0x3b')];_0x333fef+=0x1){let _0x29b014=_0x4b4d85[_0xb793('0x6e')][_0x333fef];var _0x3af4a0=_0x346793['clone']();_0x3af4a0[_0xb793('0x40')](_0xb793('0x78'),_0x29b014['id']);_0x4a6346[_0xb793('0x79')](db[_0xb793('0x67')][_0xb793('0x35')](_0x3af4a0[_0xb793('0x7a')](),{'type':db[_0xb793('0x67')][_0xb793('0x7b')]['SELECT']})[_0xb793('0x24')](function(_0x462d1f){if(_0x462d1f[_0xb793('0x3b')]===0x1){return _0x29b014['id'];}else{var _0x138307=_[_0xb793('0x7c')](_[_0xb793('0x2e')](_0x462d1f,_0xb793('0x7d')),function(_0x11ae8e){return _[_0xb793('0x7e')](_0x406831,_0x11ae8e);});if(_0x138307){return _0x29b014['id'];}}}));}}return BPromise[_0xb793('0x7f')](_0x4a6346)['then'](function(_0x405053){_0x31491e=_(_0x31491e)[_0xb793('0x80')](_0x405053)[_0xb793('0x81')]()[_0xb793('0x82')]();return db[_0xb793('0x2f')]['find']({'where':{'id':_0x57111e[_0xb793('0x4b')]['id']}})['then'](function(_0x3ea673){return db[_0xb793('0x67')][_0xb793('0x83')](function(_0xafe626){return _0x3ea673[_0xb793('0x6d')](_0x57111e[_0xb793('0x35')][_0xb793('0x61')],{'transaction':_0xafe626})[_0xb793('0x24')](function(){if(!_['isEmpty'](_0x31491e)){return _0x3ea673[_0xb793('0x84')](_0x31491e,{'transaction':_0xafe626});}})['then'](function(){_0x31491e[_0xb793('0x6a')](function(_0x18298e){socket[_0xb793('0x6b')](_0xb793('0x85'),{'UserId':_0x18298e,'SmsQueueId':_0x3ea673['id']});});});});});});})['then'](respondWithStatusCode(_0x42020a,null))['catch'](handleError(_0x42020a,null));};exports[_0xb793('0x86')]=function(_0x38c3e4,_0x350d50,_0x5fd848){return db['SmsQueue'][_0xb793('0x50')]({'where':{'id':_0x38c3e4[_0xb793('0x4b')]['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x350d50,null))[_0xb793('0x24')](function(_0x138ab9){if(_0x138ab9){return _0x138ab9[_0xb793('0x86')](_0x38c3e4['body'][_0xb793('0x61')],_['omit'](_0x38c3e4[_0xb793('0x54')],[_0xb793('0x61'),'id'])||{})[_0xb793('0x87')](function(_0x56956c){for(var _0x282ae1=0x0;_0x282ae1<_0x38c3e4[_0xb793('0x54')][_0xb793('0x61')][_0xb793('0x3b')];_0x282ae1+=0x1){socket[_0xb793('0x6b')]('userSmsQueue:save',{'UserId':_0x38c3e4[_0xb793('0x54')][_0xb793('0x61')][_0x282ae1],'SmsQueueId':_0x38c3e4[_0xb793('0x4b')]['id']});}return _0x56956c;});}})['then'](respondWithResult(_0x350d50,null))[_0xb793('0x49')](handleError(_0x350d50,null));};exports[_0xb793('0x84')]=function(_0x472ee8,_0x5063c6,_0xdbea66){return db[_0xb793('0x2f')][_0xb793('0x50')]({'where':{'id':_0x472ee8[_0xb793('0x4b')]['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x5063c6,null))[_0xb793('0x24')](function(_0x377fb1){if(_0x377fb1){return _0x377fb1[_0xb793('0x84')](_0x472ee8[_0xb793('0x35')]['ids'])['then'](function(){if(_['isArray'](_0x472ee8[_0xb793('0x35')][_0xb793('0x61')])){for(var _0x5cc31e=0x0;_0x5cc31e<_0x472ee8[_0xb793('0x35')]['ids']['length'];_0x5cc31e+=0x1){socket[_0xb793('0x6b')](_0xb793('0x85'),{'UserId':Number(_0x472ee8[_0xb793('0x35')][_0xb793('0x61')][_0x5cc31e]),'SmsQueueId':Number(_0x472ee8[_0xb793('0x4b')]['id'])});}}else{socket[_0xb793('0x6b')](_0xb793('0x85'),{'UserId':Number(_0x472ee8['query'][_0xb793('0x61')]),'SmsQueueId':Number(_0x472ee8[_0xb793('0x4b')]['id'])});}});}})[_0xb793('0x24')](respondWithStatusCode(_0x5063c6,null))[_0xb793('0x49')](handleError(_0x5063c6,null));};exports[_0xb793('0x88')]=function(_0x363a39,_0x581be6,_0x136e70){var _0x545c9e={};var _0x38e82f={};var _0x525379;var _0x3a29d0;return db[_0xb793('0x2f')][_0xb793('0x5f')]({'where':{'id':_0x363a39[_0xb793('0x4b')]['id']}})[_0xb793('0x24')](handleEntityNotFound(_0x581be6,null))[_0xb793('0x24')](function(_0x119cfd){if(_0x119cfd){_0x525379=_0x119cfd;_0x38e82f[_0xb793('0x33')]=_['keys'](db[_0xb793('0x63')][_0xb793('0x30')]);_0x38e82f['query']=_['keys'](_0x363a39[_0xb793('0x35')]);_0x38e82f['filters']=_[_0xb793('0x38')](_0x38e82f[_0xb793('0x33')],_0x38e82f['query']);_0x545c9e[_0xb793('0x3a')]=_[_0xb793('0x38')](_0x38e82f['model'],qs[_0xb793('0x39')](_0x363a39[_0xb793('0x35')][_0xb793('0x39')]));_0x545c9e[_0xb793('0x3a')]=_0x545c9e[_0xb793('0x3a')][_0xb793('0x3b')]?_0x545c9e[_0xb793('0x3a')]:_0x38e82f['model'];_0x545c9e['order']=qs['sort'](_0x363a39[_0xb793('0x35')][_0xb793('0x3f')]);_0x545c9e[_0xb793('0x40')]=qs[_0xb793('0x37')](_[_0xb793('0x41')](_0x363a39[_0xb793('0x35')],_0x38e82f[_0xb793('0x37')]));if(_0x363a39['query'][_0xb793('0x44')]){_0x545c9e[_0xb793('0x40')]=_[_0xb793('0x42')](_0x545c9e[_0xb793('0x40')],{'$or':_[_0xb793('0x2e')](_0x545c9e[_0xb793('0x3a')],function(_0x288311){var _0x1adc4c={};_0x1adc4c[_0x288311]={'$like':'%'+_0x363a39[_0xb793('0x35')]['filter']+'%'};return _0x1adc4c;})});}_0x545c9e=_['merge']({},_0x545c9e,_0x363a39[_0xb793('0x45')]);return _0x525379['getAgents'](_0x545c9e);}})[_0xb793('0x24')](function(_0x491b65){if(_0x491b65){_0x3a29d0=_0x491b65[_0xb793('0x3b')];if(!_0x363a39['query'][_0xb793('0x3c')](_0xb793('0x3d'))){_0x545c9e[_0xb793('0x1f')]=qs['limit'](_0x363a39[_0xb793('0x35')]['limit']);_0x545c9e['offset']=qs[_0xb793('0x1e')](_0x363a39[_0xb793('0x35')][_0xb793('0x1e')]);}return _0x525379[_0xb793('0x88')](_0x545c9e);}})['then'](function(_0x46e830){if(_0x46e830){return _0x46e830?{'count':_0x3a29d0,'rows':_0x46e830}:null;}})['then'](respondWithResult(_0x581be6,null))[_0xb793('0x49')](handleError(_0x581be6,null));}; \ No newline at end of file +var _0x0cf3=['TeamId','includes','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','../../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','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','update','then','destroy','get','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','includeAll','findAll','rows','show','params','filtears','include','options','find','catch','create','body','user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','SmsQueueId','filter','UserId','agent','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserSmsQueue','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT'];(function(_0x36f271,_0x2bbe64){var _0x2de58b=function(_0x1371f1){while(--_0x1371f1){_0x36f271['push'](_0x36f271['shift']());}};_0x2de58b(++_0x2bbe64);}(_0x0cf3,0x95));var _0x30cf=function(_0x4b5d37,_0x579c92){_0x4b5d37=_0x4b5d37-0x0;var _0x3fb945=_0x0cf3[_0x4b5d37];return _0x3fb945;};'use strict';var pdf=require(_0x30cf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30cf('0x1'));var rp=require(_0x30cf('0x2'));var moment=require(_0x30cf('0x3'));var BPromise=require(_0x30cf('0x4'));var Mustache=require(_0x30cf('0x5'));var util=require('util');var path=require(_0x30cf('0x6'));var sox=require(_0x30cf('0x7'));var csv=require('to-csv');var ejs=require(_0x30cf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x30cf('0x9'));var crypto=require(_0x30cf('0xa'));var jsforce=require(_0x30cf('0xb'));var deskjs=require(_0x30cf('0xc'));var toCsv=require(_0x30cf('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30cf('0xe'));var qs=require(_0x30cf('0xf'));var as=require(_0x30cf('0x10'));var hardwareService=require(_0x30cf('0x11'));var logger=require(_0x30cf('0x12'))(_0x30cf('0x13'));var utils=require(_0x30cf('0x14'));var config=require(_0x30cf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x30cf('0x16'))['db'];config[_0x30cf('0x17')]=_[_0x30cf('0x18')](config[_0x30cf('0x17')],{'host':_0x30cf('0x19'),'port':0x18eb});var socket=require(_0x30cf('0x1a'))(new Redis(config['redis']));require(_0x30cf('0x1b'))[_0x30cf('0x1c')](socket);function respondWithStatusCode(_0x4b3b6f,_0x157fc4){_0x157fc4=_0x157fc4||0xcc;return function(_0x48cf0c){if(_0x48cf0c){return _0x4b3b6f[_0x30cf('0x1d')](_0x157fc4);}return _0x4b3b6f[_0x30cf('0x1e')](_0x157fc4)[_0x30cf('0x1f')]();};}function respondWithResult(_0x27e0ab,_0x3013ea){_0x3013ea=_0x3013ea||0xc8;return function(_0x38836d){if(_0x38836d){return _0x27e0ab[_0x30cf('0x1e')](_0x3013ea)[_0x30cf('0x20')](_0x38836d);}};}function respondWithFilteredResult(_0x2325c1,_0x329c55){return function(_0xfc3987){if(_0xfc3987){var _0x4a458=_0xfc3987[_0x30cf('0x21')],_0x384c75=_0x329c55[_0x30cf('0x22')],_0x3a9fbe=_0x329c55['offset']+_0x329c55['limit'],_0x1a8f19;if(_0x3a9fbe>=_0x4a458){_0x3a9fbe=_0x4a458;_0x1a8f19=0xc8;}else{_0x1a8f19=0xce;}_0x2325c1[_0x30cf('0x1e')](_0x1a8f19);return _0x2325c1[_0x30cf('0x23')]('Content-Range',_0x384c75+'-'+_0x3a9fbe+'/'+_0x4a458)[_0x30cf('0x20')](_0xfc3987);}return null;};}function patchUpdates(_0x234fce){return function(_0x749ba){try{jsonpatch[_0x30cf('0x24')](_0x749ba,_0x234fce,!![]);}catch(_0x39475a){return BPromise['reject'](_0x39475a);}return _0x749ba['save']();};}function saveUpdates(_0x51c996,_0x592062){return function(_0x42cc8a){if(_0x42cc8a){return _0x42cc8a[_0x30cf('0x25')](_0x51c996)[_0x30cf('0x26')](function(_0x3dc24f){return _0x3dc24f;});}return null;};}function removeEntity(_0x36c6bb,_0x582880){return function(_0x166f75){if(_0x166f75){return _0x166f75[_0x30cf('0x27')]()[_0x30cf('0x26')](function(){var _0x43dc37=_0x166f75[_0x30cf('0x28')]({'plain':!![]});var _0x5d9403='SmsQueues';return db[_0x30cf('0x29')][_0x30cf('0x27')]({'where':{'type':_0x5d9403,'resourceId':_0x43dc37['id']}})[_0x30cf('0x26')](function(){return _0x166f75;});})[_0x30cf('0x26')](function(){_0x36c6bb[_0x30cf('0x1e')](0xcc)[_0x30cf('0x1f')]();});}};}function handleEntityNotFound(_0x4105a9,_0x2b0c2e){return function(_0x420800){if(!_0x420800){_0x4105a9[_0x30cf('0x1d')](0x194);}return _0x420800;};}function handleError(_0x1b5619,_0x2629e4){_0x2629e4=_0x2629e4||0x1f4;return function(_0x427e6a){logger[_0x30cf('0x2a')](_0x427e6a[_0x30cf('0x2b')]);if(_0x427e6a['name']){delete _0x427e6a[_0x30cf('0x2c')];}_0x1b5619[_0x30cf('0x1e')](_0x2629e4)['send'](_0x427e6a);};}exports['index']=function(_0x32315f,_0x58320e){var _0x32da8d={},_0x67d2cf={},_0x29d570={'count':0x0,'rows':[]};var _0x58395b=_[_0x30cf('0x2d')](db[_0x30cf('0x2e')][_0x30cf('0x2f')],function(_0x37a5cd){return{'name':_0x37a5cd[_0x30cf('0x30')],'type':_0x37a5cd[_0x30cf('0x31')]['key']};});_0x67d2cf[_0x30cf('0x32')]=_[_0x30cf('0x2d')](_0x58395b,_0x30cf('0x2c'));_0x67d2cf[_0x30cf('0x33')]=_[_0x30cf('0x34')](_0x32315f[_0x30cf('0x33')]);_0x67d2cf[_0x30cf('0x35')]=_[_0x30cf('0x36')](_0x67d2cf['model'],_0x67d2cf[_0x30cf('0x33')]);_0x32da8d[_0x30cf('0x37')]=_[_0x30cf('0x36')](_0x67d2cf[_0x30cf('0x32')],qs[_0x30cf('0x38')](_0x32315f[_0x30cf('0x33')][_0x30cf('0x38')]));_0x32da8d[_0x30cf('0x37')]=_0x32da8d['attributes'][_0x30cf('0x39')]?_0x32da8d[_0x30cf('0x37')]:_0x67d2cf[_0x30cf('0x32')];if(!_0x32315f[_0x30cf('0x33')][_0x30cf('0x3a')](_0x30cf('0x3b'))){_0x32da8d[_0x30cf('0x3c')]=qs[_0x30cf('0x3c')](_0x32315f[_0x30cf('0x33')][_0x30cf('0x3c')]);_0x32da8d[_0x30cf('0x22')]=qs[_0x30cf('0x22')](_0x32315f[_0x30cf('0x33')][_0x30cf('0x22')]);}_0x32da8d[_0x30cf('0x3d')]=qs[_0x30cf('0x3e')](_0x32315f[_0x30cf('0x33')][_0x30cf('0x3e')]);_0x32da8d['where']=qs[_0x30cf('0x35')](_[_0x30cf('0x3f')](_0x32315f[_0x30cf('0x33')],_0x67d2cf[_0x30cf('0x35')]),_0x58395b);if(_0x32315f[_0x30cf('0x33')]['filter']){_0x32da8d['where']=_[_0x30cf('0x40')](_0x32da8d[_0x30cf('0x41')],{'$or':_[_0x30cf('0x2d')](_0x58395b,function(_0x3f53dc){if(_0x3f53dc['type']!=='VIRTUAL'){var _0xea772b={};_0xea772b[_0x3f53dc[_0x30cf('0x2c')]]={'$like':'%'+_0x32315f[_0x30cf('0x33')]['filter']+'%'};return _0xea772b;}})});}_0x32da8d=_[_0x30cf('0x40')]({},_0x32da8d,_0x32315f['options']);var _0x2f1e0c={'where':_0x32da8d[_0x30cf('0x41')]};return db['SmsQueue'][_0x30cf('0x21')](_0x2f1e0c)['then'](function(_0x34b8b6){_0x29d570['count']=_0x34b8b6;if(_0x32315f[_0x30cf('0x33')][_0x30cf('0x42')]){_0x32da8d['include']=[{'all':!![]}];}return db[_0x30cf('0x2e')][_0x30cf('0x43')](_0x32da8d);})[_0x30cf('0x26')](function(_0x27adc6){_0x29d570[_0x30cf('0x44')]=_0x27adc6;return _0x29d570;})['then'](respondWithFilteredResult(_0x58320e,_0x32da8d))['catch'](handleError(_0x58320e,null));};exports[_0x30cf('0x45')]=function(_0x790321,_0x1fcbdb){var _0x23c289={'raw':!![],'where':{'id':_0x790321[_0x30cf('0x46')]['id']}},_0x2cb31b={};_0x2cb31b[_0x30cf('0x32')]=_[_0x30cf('0x34')](db['SmsQueue']['rawAttributes']);_0x2cb31b[_0x30cf('0x33')]=_['keys'](_0x790321[_0x30cf('0x33')]);_0x2cb31b[_0x30cf('0x47')]=_[_0x30cf('0x36')](_0x2cb31b[_0x30cf('0x32')],_0x2cb31b[_0x30cf('0x33')]);_0x23c289[_0x30cf('0x37')]=_[_0x30cf('0x36')](_0x2cb31b['model'],qs[_0x30cf('0x38')](_0x790321['query']['fields']));_0x23c289[_0x30cf('0x37')]=_0x23c289['attributes']['length']?_0x23c289[_0x30cf('0x37')]:_0x2cb31b[_0x30cf('0x32')];if(_0x790321[_0x30cf('0x33')][_0x30cf('0x42')]){_0x23c289[_0x30cf('0x48')]=[{'all':!![]}];}_0x23c289=_[_0x30cf('0x40')]({},_0x23c289,_0x790321[_0x30cf('0x49')]);return db[_0x30cf('0x2e')][_0x30cf('0x4a')](_0x23c289)[_0x30cf('0x26')](handleEntityNotFound(_0x1fcbdb,null))[_0x30cf('0x26')](respondWithResult(_0x1fcbdb,null))[_0x30cf('0x4b')](handleError(_0x1fcbdb,null));};exports['create']=function(_0x4aadcd,_0x54fcc1){return db[_0x30cf('0x2e')][_0x30cf('0x4c')](_0x4aadcd[_0x30cf('0x4d')],{})['then'](function(_0x523c47){var _0x5fdf3d=_0x4aadcd[_0x30cf('0x4e')][_0x30cf('0x28')]({'plain':!![]});if(!_0x5fdf3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5fdf3d[_0x30cf('0x4f')]===_0x30cf('0x4e')){var _0x1c097e=_0x523c47[_0x30cf('0x28')]({'plain':!![]});var _0x2d11ae=_0x30cf('0x50');return db[_0x30cf('0x51')][_0x30cf('0x4a')]({'where':{'name':_0x2d11ae,'userProfileId':_0x5fdf3d[_0x30cf('0x52')]},'raw':!![]})['then'](function(_0x10ab00){if(_0x10ab00&&_0x10ab00[_0x30cf('0x53')]===0x0){return db[_0x30cf('0x29')][_0x30cf('0x4c')]({'name':_0x1c097e[_0x30cf('0x2c')],'resourceId':_0x1c097e['id'],'type':_0x10ab00[_0x30cf('0x2c')],'sectionId':_0x10ab00['id']},{})[_0x30cf('0x26')](function(){return _0x523c47;});}else{return _0x523c47;}})[_0x30cf('0x4b')](function(_0x3e9ebc){logger[_0x30cf('0x2a')](_0x30cf('0x54'),_0x3e9ebc);throw _0x3e9ebc;});}return _0x523c47;})['then'](respondWithResult(_0x54fcc1,0xc9))[_0x30cf('0x4b')](handleError(_0x54fcc1,null));};exports['update']=function(_0x3e7b26,_0x399cd1){if(_0x3e7b26['body']['id']){delete _0x3e7b26[_0x30cf('0x4d')]['id'];}return db[_0x30cf('0x2e')]['find']({'where':{'id':_0x3e7b26[_0x30cf('0x46')]['id']}})[_0x30cf('0x26')](handleEntityNotFound(_0x399cd1,null))[_0x30cf('0x26')](saveUpdates(_0x3e7b26['body'],null))[_0x30cf('0x26')](respondWithResult(_0x399cd1,null))[_0x30cf('0x4b')](handleError(_0x399cd1,null));};exports[_0x30cf('0x27')]=function(_0x4360d2,_0x10f174){return db[_0x30cf('0x2e')]['find']({'where':{'id':_0x4360d2[_0x30cf('0x46')]['id']}})[_0x30cf('0x26')](handleEntityNotFound(_0x10f174,null))['then'](removeEntity(_0x10f174,null))[_0x30cf('0x4b')](handleError(_0x10f174,null));};exports['describe']=function(_0x2c3001,_0x420cb0){return db['SmsQueue'][_0x30cf('0x55')]()[_0x30cf('0x26')](respondWithResult(_0x420cb0,null))[_0x30cf('0x4b')](handleError(_0x420cb0,null));};exports['getMembers']=function(_0x301c36,_0x4583d3,_0x215bfb){var _0x5bbb4b={'raw':!![],'where':{}},_0x38e3d8={},_0x27eb19;return db['SmsQueue'][_0x30cf('0x56')]({'where':{'id':_0x301c36[_0x30cf('0x46')]['id']}})[_0x30cf('0x26')](handleEntityNotFound(_0x4583d3,null))['then'](function(_0x2c7196){if(_0x2c7196){_0x27eb19=_0x2c7196[_0x30cf('0x28')]({'plain':!![]});_0x38e3d8[_0x30cf('0x32')]=_[_0x30cf('0x34')](db['UserSmsQueue'][_0x30cf('0x2f')]);_0x38e3d8['query']=_['keys'](_0x301c36[_0x30cf('0x33')]);_0x38e3d8[_0x30cf('0x35')]=_['intersection'](_0x38e3d8[_0x30cf('0x32')],_0x38e3d8[_0x30cf('0x33')]);_0x5bbb4b[_0x30cf('0x37')]=_[_0x30cf('0x36')](_0x38e3d8[_0x30cf('0x32')],qs[_0x30cf('0x38')](_0x301c36['query']['fields']));_0x5bbb4b[_0x30cf('0x37')]=_0x5bbb4b[_0x30cf('0x37')][_0x30cf('0x39')]?_0x5bbb4b[_0x30cf('0x37')]:_0x38e3d8[_0x30cf('0x32')];if(!_0x301c36['query']['hasOwnProperty'](_0x30cf('0x3b'))){_0x5bbb4b[_0x30cf('0x3c')]=qs['limit'](_0x301c36['query'][_0x30cf('0x3c')]);_0x5bbb4b[_0x30cf('0x22')]=qs[_0x30cf('0x22')](_0x301c36['query']['offset']);}_0x5bbb4b[_0x30cf('0x3d')]=qs[_0x30cf('0x3e')](_0x301c36[_0x30cf('0x33')][_0x30cf('0x3e')]);_0x5bbb4b[_0x30cf('0x41')]=qs[_0x30cf('0x35')](_['pick'](_0x301c36[_0x30cf('0x33')],_0x38e3d8['filters']));_0x5bbb4b[_0x30cf('0x41')][_0x30cf('0x57')]=_0x2c7196['id'];if(_0x301c36[_0x30cf('0x33')][_0x30cf('0x58')]){_0x5bbb4b['where']=_[_0x30cf('0x40')](_0x5bbb4b[_0x30cf('0x41')],{'$or':_[_0x30cf('0x2d')](_0x5bbb4b[_0x30cf('0x37')],function(_0x50d55d){var _0x5386fa={};_0x5386fa[_0x50d55d]={'$like':'%'+_0x301c36[_0x30cf('0x33')][_0x30cf('0x58')]+'%'};return _0x5386fa;})});}_0x5bbb4b=_[_0x30cf('0x40')]({},_0x5bbb4b,_0x301c36[_0x30cf('0x49')]);return db['UserSmsQueue'][_0x30cf('0x43')](_0x5bbb4b);}})[_0x30cf('0x26')](function(_0x4296b9){if(_0x4296b9){return db['User']['findAndCountAll']({'where':{'id':_[_0x30cf('0x2d')](_0x4296b9,_0x30cf('0x59')),'role':_0x30cf('0x5a')},'attributes':['id',_0x30cf('0x2c'),'smsPause',_0x30cf('0x5b'),_0x30cf('0x5c')]});}})[_0x30cf('0x26')](function(_0x15c255){if(_0x15c255){return{'count':_0x15c255['count'],'rows':_[_0x30cf('0x2d')](_0x15c255[_0x30cf('0x44')],function(_0x27e9ad){return{'membername':_0x27e9ad[_0x30cf('0x2c')],'UserId':_0x27e9ad['id'],'queue_name':_0x27eb19[_0x30cf('0x2c')],'SmsQueueId':_0x27eb19['id'],'interface':util['format'](_0x30cf('0x5d'),_0x30cf('0x5e'),_0x27e9ad[_0x30cf('0x2c')]),'penalty':0x0,'paused':_0x27e9ad['smsPause'],'createdAt':_0x27e9ad[_0x30cf('0x5c')],'updatedAt':_0x27e9ad[_0x30cf('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4583d3,_0x5bbb4b))[_0x30cf('0x4b')](handleError(_0x4583d3,null));};exports['getTeams']=function(_0x44d688,_0x3e4240,_0xe52f34){var _0x50f991={};var _0x2b91c0={};var _0x2741a0;var _0x241178;return db[_0x30cf('0x2e')]['findOne']({'where':{'id':_0x44d688[_0x30cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e4240,null))['then'](function(_0x3bcbf0){if(_0x3bcbf0){_0x2741a0=_0x3bcbf0;_0x2b91c0[_0x30cf('0x32')]=_[_0x30cf('0x34')](db[_0x30cf('0x5f')][_0x30cf('0x2f')]);_0x2b91c0[_0x30cf('0x33')]=_[_0x30cf('0x34')](_0x44d688['query']);_0x2b91c0[_0x30cf('0x35')]=_[_0x30cf('0x36')](_0x2b91c0[_0x30cf('0x32')],_0x2b91c0[_0x30cf('0x33')]);_0x50f991['attributes']=_[_0x30cf('0x36')](_0x2b91c0['model'],qs[_0x30cf('0x38')](_0x44d688[_0x30cf('0x33')]['fields']));_0x50f991['attributes']=_0x50f991[_0x30cf('0x37')][_0x30cf('0x39')]?_0x50f991[_0x30cf('0x37')]:_0x2b91c0[_0x30cf('0x32')];_0x50f991[_0x30cf('0x3d')]=qs[_0x30cf('0x3e')](_0x44d688['query'][_0x30cf('0x3e')]);_0x50f991['where']=qs['filters'](_['pick'](_0x44d688[_0x30cf('0x33')],_0x2b91c0[_0x30cf('0x35')]));if(_0x44d688[_0x30cf('0x33')][_0x30cf('0x58')]){_0x50f991['where']=_['merge'](_0x50f991[_0x30cf('0x41')],{'$or':_[_0x30cf('0x2d')](_0x50f991[_0x30cf('0x37')],function(_0x879a66){var _0x3ca261={};_0x3ca261[_0x879a66]={'$like':'%'+_0x44d688[_0x30cf('0x33')][_0x30cf('0x58')]+'%'};return _0x3ca261;})});}_0x50f991=_[_0x30cf('0x40')]({},_0x50f991,_0x44d688[_0x30cf('0x49')]);return _0x2741a0[_0x30cf('0x60')](_0x50f991);}})[_0x30cf('0x26')](function(_0x2887bf){if(_0x2887bf){_0x241178=_0x2887bf[_0x30cf('0x39')];if(!_0x44d688[_0x30cf('0x33')][_0x30cf('0x3a')](_0x30cf('0x3b'))){_0x50f991[_0x30cf('0x3c')]=qs[_0x30cf('0x3c')](_0x44d688['query'][_0x30cf('0x3c')]);_0x50f991[_0x30cf('0x22')]=qs[_0x30cf('0x22')](_0x44d688[_0x30cf('0x33')][_0x30cf('0x22')]);}return _0x2741a0[_0x30cf('0x60')](_0x50f991);}})[_0x30cf('0x26')](function(_0x1cb62d){if(_0x1cb62d){return _0x1cb62d?{'count':_0x241178,'rows':_0x1cb62d}:null;}})[_0x30cf('0x26')](respondWithResult(_0x3e4240,null))[_0x30cf('0x4b')](handleError(_0x3e4240,null));};exports[_0x30cf('0x61')]=function(_0x228fe6,_0x1628ab,_0x138c74){var _0x4780de=_0x228fe6['body']['ids'];return db[_0x30cf('0x5f')][_0x30cf('0x43')]({'where':{'id':_0x4780de},'attributes':['id'],'include':[{'model':db[_0x30cf('0x62')],'as':_0x30cf('0x63'),'attributes':['id',_0x30cf('0x2c'),'online',_0x30cf('0x64'),_0x30cf('0x65')],'raw':!![]}]})[_0x30cf('0x26')](function(_0x6d0c5c){if(_0x6d0c5c){var _0x4c4841=_[_0x30cf('0x66')](_0x6d0c5c,function(_0x546b86){var _0x1febea=_0x546b86['get']({'plain':!![]});return _0x1febea['Agents'];});return db['SmsQueue'][_0x30cf('0x4a')]({'where':{'id':_0x228fe6[_0x30cf('0x46')]['id']}})[_0x30cf('0x26')](function(_0x278e33){return db[_0x30cf('0x67')][_0x30cf('0x68')](function(_0x4b0473){return _0x278e33[_0x30cf('0x61')](_0x4780de,{'transaction':_0x4b0473})[_0x30cf('0x26')](function(){return BPromise[_0x30cf('0x69')](_0x4c4841,function(_0x173c80){return db[_0x30cf('0x6a')][_0x30cf('0x6b')]({'where':{'UserId':_0x173c80['id'],'SmsQueueId':_0x228fe6[_0x30cf('0x46')]['id']},'transaction':_0x4b0473});});})['then'](function(){_0x4c4841[_0x30cf('0x6c')](function(_0x41c46f){socket[_0x30cf('0x6d')]('userSmsQueue:save',{'UserId':_0x41c46f['id'],'SmsQueueId':_0x278e33['id']});});});});});}})['then'](respondWithStatusCode(_0x1628ab,null))[_0x30cf('0x4b')](handleError(_0x1628ab,null));};exports[_0x30cf('0x6e')]=function(_0x124e42,_0x11f4f0,_0x82faaa){return db[_0x30cf('0x5f')]['findAll']({'where':{'id':_0x124e42[_0x30cf('0x33')][_0x30cf('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x30cf('0x62')],'as':_0x30cf('0x63'),'attributes':['id'],'raw':!![]}]})[_0x30cf('0x26')](handleEntityNotFound(_0x11f4f0,null))['then'](function(_0x4d6e36){var _0x3b935f=_[_0x30cf('0x2d')](_0x4d6e36,'id');var _0x571123=[];var _0x5cf10a=[];var _0x41d85c=squel[_0x30cf('0x70')]();_0x41d85c[_0x30cf('0x71')](_0x30cf('0x72'))['from'](_0x30cf('0x73'),'tq')[_0x30cf('0x74')]('user_has_teams','ut',_0x30cf('0x75'))['where'](_0x30cf('0x76'),_0x124e42[_0x30cf('0x46')]['id']);for(var _0x2a8155=0x0;_0x2a8155<_0x4d6e36[_0x30cf('0x39')];_0x2a8155+=0x1){let _0x37980b=_0x4d6e36[_0x2a8155];for(var _0x5745d8=0x0;_0x5745d8<_0x37980b[_0x30cf('0x63')][_0x30cf('0x39')];_0x5745d8+=0x1){let _0x55ad05=_0x37980b['Agents'][_0x5745d8];var _0x3ea389=_0x41d85c[_0x30cf('0x77')]();_0x3ea389[_0x30cf('0x41')](_0x30cf('0x78'),_0x55ad05['id']);_0x5cf10a[_0x30cf('0x79')](db['sequelize'][_0x30cf('0x33')](_0x3ea389[_0x30cf('0x7a')](),{'type':db[_0x30cf('0x67')][_0x30cf('0x7b')][_0x30cf('0x7c')]})[_0x30cf('0x26')](function(_0x1ce05e){if(_0x1ce05e[_0x30cf('0x39')]===0x1){return _0x55ad05['id'];}else{var _0x2f1127=_['every'](_[_0x30cf('0x2d')](_0x1ce05e,_0x30cf('0x7d')),function(_0x4848d0){return _[_0x30cf('0x7e')](_0x3b935f,_0x4848d0);});if(_0x2f1127){return _0x55ad05['id'];}}}));}}return BPromise[_0x30cf('0x7f')](_0x5cf10a)[_0x30cf('0x26')](function(_0x2d1635){_0x571123=_(_0x571123)[_0x30cf('0x80')](_0x2d1635)['compact']()[_0x30cf('0x81')]();return db['SmsQueue'][_0x30cf('0x4a')]({'where':{'id':_0x124e42[_0x30cf('0x46')]['id']}})[_0x30cf('0x26')](function(_0x1e9b04){return db[_0x30cf('0x67')]['transaction'](function(_0x4b9eb7){return _0x1e9b04[_0x30cf('0x6e')](_0x124e42[_0x30cf('0x33')]['ids'],{'transaction':_0x4b9eb7})[_0x30cf('0x26')](function(){if(!_[_0x30cf('0x82')](_0x571123)){return _0x1e9b04[_0x30cf('0x83')](_0x571123,{'transaction':_0x4b9eb7});}})[_0x30cf('0x26')](function(){_0x571123[_0x30cf('0x6c')](function(_0x3b675e){socket[_0x30cf('0x6d')](_0x30cf('0x84'),{'UserId':_0x3b675e,'SmsQueueId':_0x1e9b04['id']});});});});});});})[_0x30cf('0x26')](respondWithStatusCode(_0x11f4f0,null))['catch'](handleError(_0x11f4f0,null));};exports['addAgents']=function(_0x310469,_0x19f800,_0x4358cb){return db['SmsQueue']['find']({'where':{'id':_0x310469[_0x30cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x19f800,null))[_0x30cf('0x26')](function(_0xfe1849){if(_0xfe1849){return _0xfe1849[_0x30cf('0x85')](_0x310469['body'][_0x30cf('0x6f')],_[_0x30cf('0x86')](_0x310469[_0x30cf('0x4d')],[_0x30cf('0x6f'),'id'])||{})['spread'](function(_0xbe4ac4){for(var _0x586cd3=0x0;_0x586cd3<_0x310469[_0x30cf('0x4d')][_0x30cf('0x6f')][_0x30cf('0x39')];_0x586cd3+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x310469[_0x30cf('0x4d')][_0x30cf('0x6f')][_0x586cd3],'SmsQueueId':_0x310469['params']['id']});}return _0xbe4ac4;});}})[_0x30cf('0x26')](respondWithResult(_0x19f800,null))['catch'](handleError(_0x19f800,null));};exports[_0x30cf('0x83')]=function(_0x185eab,_0x3c7d79,_0x8d8329){return db[_0x30cf('0x2e')][_0x30cf('0x4a')]({'where':{'id':_0x185eab['params']['id']}})['then'](handleEntityNotFound(_0x3c7d79,null))[_0x30cf('0x26')](function(_0x49e4fd){if(_0x49e4fd){return _0x49e4fd['removeAgents'](_0x185eab[_0x30cf('0x33')][_0x30cf('0x6f')])[_0x30cf('0x26')](function(){if(_[_0x30cf('0x87')](_0x185eab['query']['ids'])){for(var _0x1bc87f=0x0;_0x1bc87f<_0x185eab[_0x30cf('0x33')][_0x30cf('0x6f')]['length'];_0x1bc87f+=0x1){socket[_0x30cf('0x6d')](_0x30cf('0x84'),{'UserId':Number(_0x185eab[_0x30cf('0x33')][_0x30cf('0x6f')][_0x1bc87f]),'SmsQueueId':Number(_0x185eab[_0x30cf('0x46')]['id'])});}}else{socket[_0x30cf('0x6d')](_0x30cf('0x84'),{'UserId':Number(_0x185eab['query']['ids']),'SmsQueueId':Number(_0x185eab[_0x30cf('0x46')]['id'])});}});}})[_0x30cf('0x26')](respondWithStatusCode(_0x3c7d79,null))[_0x30cf('0x4b')](handleError(_0x3c7d79,null));};exports[_0x30cf('0x88')]=function(_0x264d0e,_0xd3a059,_0x48e9f9){var _0x2818fb={};var _0x5a6f89={};var _0x3c95a8;var _0x49f519;return db[_0x30cf('0x2e')][_0x30cf('0x56')]({'where':{'id':_0x264d0e[_0x30cf('0x46')]['id']}})['then'](handleEntityNotFound(_0xd3a059,null))['then'](function(_0x4342b6){if(_0x4342b6){_0x3c95a8=_0x4342b6;_0x5a6f89[_0x30cf('0x32')]=_[_0x30cf('0x34')](db[_0x30cf('0x62')]['rawAttributes']);_0x5a6f89[_0x30cf('0x33')]=_[_0x30cf('0x34')](_0x264d0e[_0x30cf('0x33')]);_0x5a6f89[_0x30cf('0x35')]=_[_0x30cf('0x36')](_0x5a6f89[_0x30cf('0x32')],_0x5a6f89[_0x30cf('0x33')]);_0x2818fb[_0x30cf('0x37')]=_['intersection'](_0x5a6f89[_0x30cf('0x32')],qs[_0x30cf('0x38')](_0x264d0e[_0x30cf('0x33')]['fields']));_0x2818fb['attributes']=_0x2818fb[_0x30cf('0x37')][_0x30cf('0x39')]?_0x2818fb[_0x30cf('0x37')]:_0x5a6f89[_0x30cf('0x32')];_0x2818fb[_0x30cf('0x3d')]=qs[_0x30cf('0x3e')](_0x264d0e[_0x30cf('0x33')][_0x30cf('0x3e')]);_0x2818fb[_0x30cf('0x41')]=qs[_0x30cf('0x35')](_[_0x30cf('0x3f')](_0x264d0e['query'],_0x5a6f89[_0x30cf('0x35')]));if(_0x264d0e[_0x30cf('0x33')][_0x30cf('0x58')]){_0x2818fb['where']=_[_0x30cf('0x40')](_0x2818fb['where'],{'$or':_[_0x30cf('0x2d')](_0x2818fb[_0x30cf('0x37')],function(_0x273304){var _0x23fb98={};_0x23fb98[_0x273304]={'$like':'%'+_0x264d0e[_0x30cf('0x33')][_0x30cf('0x58')]+'%'};return _0x23fb98;})});}_0x2818fb=_[_0x30cf('0x40')]({},_0x2818fb,_0x264d0e[_0x30cf('0x49')]);return _0x3c95a8[_0x30cf('0x88')](_0x2818fb);}})['then'](function(_0x58694a){if(_0x58694a){_0x49f519=_0x58694a['length'];if(!_0x264d0e[_0x30cf('0x33')]['hasOwnProperty'](_0x30cf('0x3b'))){_0x2818fb[_0x30cf('0x3c')]=qs[_0x30cf('0x3c')](_0x264d0e[_0x30cf('0x33')][_0x30cf('0x3c')]);_0x2818fb[_0x30cf('0x22')]=qs[_0x30cf('0x22')](_0x264d0e['query'][_0x30cf('0x22')]);}return _0x3c95a8[_0x30cf('0x88')](_0x2818fb);}})[_0x30cf('0x26')](function(_0x55ee1a){if(_0x55ee1a){return _0x55ee1a?{'count':_0x49f519,'rows':_0x55ee1a}:null;}})['then'](respondWithResult(_0xd3a059,null))[_0x30cf('0x4b')](handleError(_0xd3a059,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f62f405..b409a23 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 _0x3df4=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x756ac4,_0x5289fa){var _0x4cbbee=function(_0x1e44ca){while(--_0x1e44ca){_0x756ac4['push'](_0x756ac4['shift']());}};_0x4cbbee(++_0x5289fa);}(_0x3df4,0x173));var _0x43df=function(_0x283e0b,_0x4fe1f6){_0x283e0b=_0x283e0b-0x0;var _0x2cf2b7=_0x3df4[_0x283e0b];return _0x2cf2b7;};'use strict';var EventEmitter=require(_0x43df('0x0'));var SmsQueue=require(_0x43df('0x1'))['db'][_0x43df('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x43df('0x3')](0x0);var events={'afterCreate':_0x43df('0x4'),'afterUpdate':_0x43df('0x5'),'afterDestroy':_0x43df('0x6')};function emitEvent(_0x132358){return function(_0x12f08c,_0x35c5bc,_0x5ece4d){SmsQueueEvents[_0x43df('0x7')](_0x132358+':'+_0x12f08c['id'],_0x12f08c);SmsQueueEvents[_0x43df('0x7')](_0x132358,_0x12f08c);_0x5ece4d(null);};}for(var e in events){if(events[_0x43df('0x8')](e)){var event=events[e];SmsQueue[_0x43df('0x9')](e,emitEvent(event));}}module[_0x43df('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xe5e8=['events','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5dd5e0,_0x9a177c){var _0x4a6e5b=function(_0x4a364e){while(--_0x4a364e){_0x5dd5e0['push'](_0x5dd5e0['shift']());}};_0x4a6e5b(++_0x9a177c);}(_0xe5e8,0x13b));var _0x8e5e=function(_0x1163fe,_0x3211d2){_0x1163fe=_0x1163fe-0x0;var _0x59e25c=_0xe5e8[_0x1163fe];return _0x59e25c;};'use strict';var EventEmitter=require(_0x8e5e('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x8e5e('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8e5e('0x2')](0x0);var events={'afterCreate':_0x8e5e('0x3'),'afterUpdate':'update','afterDestroy':_0x8e5e('0x4')};function emitEvent(_0x44dcb1){return function(_0x4b1eca,_0x66f552,_0x44fa69){SmsQueueEvents[_0x8e5e('0x5')](_0x44dcb1+':'+_0x4b1eca['id'],_0x4b1eca);SmsQueueEvents['emit'](_0x44dcb1,_0x4b1eca);_0x44fa69(null);};}for(var e in events){if(events[_0x8e5e('0x6')](e)){var event=events[e];SmsQueue[_0x8e5e('0x7')](e,emitEvent(event));}}module[_0x8e5e('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 7796a8f..c15be93 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 _0x977d=['util','api','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','lodash'];(function(_0x83bfd9,_0x4616c2){var _0x32ffe2=function(_0x455bcb){while(--_0x455bcb){_0x83bfd9['push'](_0x83bfd9['shift']());}};_0x32ffe2(++_0x4616c2);}(_0x977d,0xc7));var _0xd977=function(_0x498543,_0x3a482a){_0x498543=_0x498543-0x0;var _0x503a41=_0x977d[_0x498543];return _0x503a41;};'use strict';var _=require(_0xd977('0x0'));var util=require(_0xd977('0x1'));var logger=require('../../config/logger')(_0xd977('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd977('0x3'));var fs=require('fs');var path=require(_0xd977('0x4'));var rimraf=require(_0xd977('0x5'));var config=require(_0xd977('0x6'));var attributes=require(_0xd977('0x7'));module['exports']=function(_0x3af263,_0x52eda3){return _0x3af263[_0xd977('0x8')](_0xd977('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2fc=['moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0x2afa96,_0x4f9160){var _0x3194a0=function(_0x31b721){while(--_0x31b721){_0x2afa96['push'](_0x2afa96['shift']());}};_0x3194a0(++_0x4f9160);}(_0xc2fc,0xda));var _0xcc2f=function(_0x11be7c,_0x565bd1){_0x11be7c=_0x11be7c-0x0;var _0x4d1a3e=_0xc2fc[_0x11be7c];return _0x4d1a3e;};'use strict';var _=require(_0xcc2f('0x0'));var util=require(_0xcc2f('0x1'));var logger=require(_0xcc2f('0x2'))('api');var moment=require(_0xcc2f('0x3'));var BPromise=require(_0xcc2f('0x4'));var rp=require(_0xcc2f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc2f('0x6'));var config=require(_0xcc2f('0x7'));var attributes=require(_0xcc2f('0x8'));module[_0xcc2f('0x9')]=function(_0x36c8d1,_0x20a903){return _0x36c8d1[_0xcc2f('0xa')](_0xcc2f('0xb'),attributes,{'tableName':_0xcc2f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 87d9ea4..a8a2346 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 _0x66ae=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','raw','options','where','attributes','limit','include','map','model','then','GetSmsQueue','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x66ae,0x10c));var _0xe66a=function(_0x66952c,_0x557f85){_0x66952c=_0x66952c-0x0;var _0x41b526=_0x66ae[_0x66952c];return _0x41b526;};'use strict';var _=require(_0xe66a('0x0'));var util=require(_0xe66a('0x1'));var moment=require(_0xe66a('0x2'));var BPromise=require(_0xe66a('0x3'));var rs=require(_0xe66a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe66a('0x5'))['db'];var utils=require(_0xe66a('0x6'));var logger=require(_0xe66a('0x7'))(_0xe66a('0x8'));var config=require(_0xe66a('0x9'));var jayson=require(_0xe66a('0xa'));var client=jayson[_0xe66a('0xb')]['http']({'port':0x232a});config[_0xe66a('0xc')]=_['defaults'](config[_0xe66a('0xc')],{'host':_0xe66a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe66a('0xc')]));require('./smsQueue.socket')[_0xe66a('0xe')](socket);function respondWithRpcPromise(_0x5821ce,_0x1f7cb0,_0x2ff832){return new BPromise(function(_0x33f89c,_0x41baa1){return client[_0xe66a('0xf')](_0x5821ce,_0x2ff832)['then'](function(_0x3f8eac){logger[_0xe66a('0x10')](_0xe66a('0x11'),_0x1f7cb0,_0xe66a('0x12'));logger[_0xe66a('0x13')](_0xe66a('0x14'),_0x1f7cb0,_0xe66a('0x12'),JSON[_0xe66a('0x15')](_0x3f8eac));if(_0x3f8eac[_0xe66a('0x16')]){if(_0x3f8eac['error'][_0xe66a('0x17')]===0x1f4){logger[_0xe66a('0x16')](_0xe66a('0x11'),_0x1f7cb0,_0x3f8eac['error'][_0xe66a('0x18')]);return _0x41baa1(_0x3f8eac[_0xe66a('0x16')][_0xe66a('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x1f7cb0,_0x3f8eac['error'][_0xe66a('0x18')]);return _0x33f89c(_0x3f8eac[_0xe66a('0x16')]['message']);}else{logger[_0xe66a('0x10')](_0xe66a('0x11'),_0x1f7cb0,_0xe66a('0x12'));_0x33f89c(_0x3f8eac[_0xe66a('0x19')][_0xe66a('0x18')]);}})[_0xe66a('0x1a')](function(_0x31b5c1){logger['error']('SmsQueue,\x20%s,\x20%s',_0x1f7cb0,_0x31b5c1);_0x41baa1(_0x31b5c1);});});}exports['GetSmsQueue']=function(_0xcad0c){var _0x108686=this;return new Promise(function(_0x2df518,_0x35a8d7){return db[_0xe66a('0x1b')][_0xe66a('0x1c')]({'raw':_0xcad0c['options']?_0xcad0c['options'][_0xe66a('0x1d')]===undefined?!![]:![]:!![],'where':_0xcad0c['options']?_0xcad0c[_0xe66a('0x1e')][_0xe66a('0x1f')]||null:null,'attributes':_0xcad0c['options']?_0xcad0c[_0xe66a('0x1e')][_0xe66a('0x20')]||null:null,'limit':_0xcad0c['options']?_0xcad0c['options'][_0xe66a('0x21')]||null:null,'include':_0xcad0c['options']?_0xcad0c['options'][_0xe66a('0x22')]?_[_0xe66a('0x23')](_0xcad0c[_0xe66a('0x1e')][_0xe66a('0x22')],function(_0x15b51b){return{'model':db[_0x15b51b['model']],'as':_0x15b51b['as'],'attributes':_0x15b51b['attributes'],'include':_0x15b51b[_0xe66a('0x22')]?_['map'](_0x15b51b[_0xe66a('0x22')],function(_0x1525a5){return{'model':db[_0x1525a5[_0xe66a('0x24')]],'as':_0x1525a5['as'],'attributes':_0x1525a5['attributes'],'include':_0x1525a5[_0xe66a('0x22')]?_[_0xe66a('0x23')](_0x1525a5[_0xe66a('0x22')],function(_0x419e76){return{'model':db[_0x419e76['model']],'as':_0x419e76['as'],'attributes':_0x419e76['attributes']};}):[]};}):[]};}):[]:[]})[_0xe66a('0x25')](function(_0x3d4ffd){logger[_0xe66a('0x10')]('GetSmsQueue',_0xcad0c);logger[_0xe66a('0x13')](_0xe66a('0x26'),_0xcad0c,JSON[_0xe66a('0x15')](_0x3d4ffd));_0x2df518(_0x3d4ffd);})[_0xe66a('0x1a')](function(_0x67bfec){logger[_0xe66a('0x16')](_0xe66a('0x26'),_0x67bfec[_0xe66a('0x18')],_0xcad0c);_0x35a8d7(_0x108686[_0xe66a('0x16')](0x1f4,_0x67bfec['message']));});});};exports['ShowSmsQueue']=function(_0x44cbe6){var _0x252600=this;return new Promise(function(_0x4effb4,_0x7f60f3){return db['SmsQueue'][_0xe66a('0x27')]({'raw':_0x44cbe6[_0xe66a('0x1e')]?_0x44cbe6[_0xe66a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x44cbe6[_0xe66a('0x1e')]?_0x44cbe6[_0xe66a('0x1e')][_0xe66a('0x1f')]||null:null,'attributes':_0x44cbe6['options']?_0x44cbe6[_0xe66a('0x1e')][_0xe66a('0x20')]||null:null,'include':_0x44cbe6['options']?_0x44cbe6[_0xe66a('0x1e')][_0xe66a('0x22')]?_[_0xe66a('0x23')](_0x44cbe6[_0xe66a('0x1e')][_0xe66a('0x22')],function(_0x545230){return{'model':db[_0x545230[_0xe66a('0x24')]],'as':_0x545230['as'],'attributes':_0x545230[_0xe66a('0x20')],'include':_0x545230[_0xe66a('0x22')]?_['map'](_0x545230[_0xe66a('0x22')],function(_0x57bd7b){return{'model':db[_0x57bd7b[_0xe66a('0x24')]],'as':_0x57bd7b['as'],'attributes':_0x57bd7b[_0xe66a('0x20')],'include':_0x57bd7b[_0xe66a('0x22')]?_[_0xe66a('0x23')](_0x57bd7b[_0xe66a('0x22')],function(_0x57db07){return{'model':db[_0x57db07[_0xe66a('0x24')]],'as':_0x57db07['as'],'attributes':_0x57db07['attributes']};}):[]};}):[]};}):[]:[]})[_0xe66a('0x25')](function(_0x1f550e){logger['info'](_0xe66a('0x28'),_0x44cbe6);logger['debug'](_0xe66a('0x28'),_0x44cbe6,JSON[_0xe66a('0x15')](_0x1f550e));_0x4effb4(_0x1f550e);})[_0xe66a('0x1a')](function(_0x1b630){logger[_0xe66a('0x16')](_0xe66a('0x28'),_0x1b630['message'],_0x44cbe6);_0x7f60f3(_0x252600['error'](0x1f4,_0x1b630[_0xe66a('0x18')]));});});}; \ No newline at end of file +var _0x7ddc=['SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','model','map','include','debug','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','localhost','socket.io-emitter','./smsQueue.socket','register','then'];(function(_0x557f46,_0x1733d9){var _0x54395f=function(_0x51c206){while(--_0x51c206){_0x557f46['push'](_0x557f46['shift']());}};_0x54395f(++_0x1733d9);}(_0x7ddc,0xd4));var _0xc7dd=function(_0x590b3f,_0x351ce6){_0x590b3f=_0x590b3f-0x0;var _0xe4d27d=_0x7ddc[_0x590b3f];return _0xe4d27d;};'use strict';var _=require(_0xc7dd('0x0'));var util=require(_0xc7dd('0x1'));var moment=require(_0xc7dd('0x2'));var BPromise=require(_0xc7dd('0x3'));var rs=require(_0xc7dd('0x4'));var fs=require('fs');var Redis=require(_0xc7dd('0x5'));var db=require(_0xc7dd('0x6'))['db'];var utils=require(_0xc7dd('0x7'));var logger=require(_0xc7dd('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc7dd('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xc7dd('0xa')],{'host':_0xc7dd('0xb'),'port':0x18eb});var socket=require(_0xc7dd('0xc'))(new Redis(config[_0xc7dd('0xa')]));require(_0xc7dd('0xd'))[_0xc7dd('0xe')](socket);function respondWithRpcPromise(_0xeb72e2,_0x368937,_0x26cf25){return new BPromise(function(_0x1b301e,_0x11d7a3){return client['request'](_0xeb72e2,_0x26cf25)[_0xc7dd('0xf')](function(_0x3979c2){logger['info'](_0xc7dd('0x10'),_0x368937,_0xc7dd('0x11'));logger['debug'](_0xc7dd('0x12'),_0x368937,'request\x20sent',JSON[_0xc7dd('0x13')](_0x3979c2));if(_0x3979c2['error']){if(_0x3979c2[_0xc7dd('0x14')][_0xc7dd('0x15')]===0x1f4){logger[_0xc7dd('0x14')](_0xc7dd('0x10'),_0x368937,_0x3979c2['error'][_0xc7dd('0x16')]);return _0x11d7a3(_0x3979c2[_0xc7dd('0x14')][_0xc7dd('0x16')]);}logger[_0xc7dd('0x14')](_0xc7dd('0x10'),_0x368937,_0x3979c2['error'][_0xc7dd('0x16')]);return _0x1b301e(_0x3979c2[_0xc7dd('0x14')][_0xc7dd('0x16')]);}else{logger[_0xc7dd('0x17')](_0xc7dd('0x10'),_0x368937,_0xc7dd('0x11'));_0x1b301e(_0x3979c2['result'][_0xc7dd('0x16')]);}})[_0xc7dd('0x18')](function(_0x2038c8){logger[_0xc7dd('0x14')](_0xc7dd('0x10'),_0x368937,_0x2038c8);_0x11d7a3(_0x2038c8);});});}exports[_0xc7dd('0x19')]=function(_0x52649c){var _0x49dec0=this;return new Promise(function(_0x11e55e,_0x437423){return db[_0xc7dd('0x1a')][_0xc7dd('0x1b')]({'raw':_0x52649c[_0xc7dd('0x1c')]?_0x52649c[_0xc7dd('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x52649c[_0xc7dd('0x1c')]?_0x52649c[_0xc7dd('0x1c')]['where']||null:null,'attributes':_0x52649c[_0xc7dd('0x1c')]?_0x52649c[_0xc7dd('0x1c')][_0xc7dd('0x1d')]||null:null,'limit':_0x52649c[_0xc7dd('0x1c')]?_0x52649c['options'][_0xc7dd('0x1e')]||null:null,'include':_0x52649c[_0xc7dd('0x1c')]?_0x52649c['options']['include']?_['map'](_0x52649c['options']['include'],function(_0xb3fab0){return{'model':db[_0xb3fab0[_0xc7dd('0x1f')]],'as':_0xb3fab0['as'],'attributes':_0xb3fab0[_0xc7dd('0x1d')],'include':_0xb3fab0['include']?_[_0xc7dd('0x20')](_0xb3fab0[_0xc7dd('0x21')],function(_0x3b78aa){return{'model':db[_0x3b78aa[_0xc7dd('0x1f')]],'as':_0x3b78aa['as'],'attributes':_0x3b78aa['attributes'],'include':_0x3b78aa[_0xc7dd('0x21')]?_[_0xc7dd('0x20')](_0x3b78aa[_0xc7dd('0x21')],function(_0x548ae3){return{'model':db[_0x548ae3[_0xc7dd('0x1f')]],'as':_0x548ae3['as'],'attributes':_0x548ae3[_0xc7dd('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40ca45){logger[_0xc7dd('0x17')](_0xc7dd('0x19'),_0x52649c);logger[_0xc7dd('0x22')](_0xc7dd('0x19'),_0x52649c,JSON[_0xc7dd('0x13')](_0x40ca45));_0x11e55e(_0x40ca45);})[_0xc7dd('0x18')](function(_0x25f343){logger[_0xc7dd('0x14')](_0xc7dd('0x19'),_0x25f343[_0xc7dd('0x16')],_0x52649c);_0x437423(_0x49dec0[_0xc7dd('0x14')](0x1f4,_0x25f343[_0xc7dd('0x16')]));});});};exports['ShowSmsQueue']=function(_0x2719fd){var _0x2e8b8b=this;return new Promise(function(_0x2ebd2e,_0x45daa9){return db[_0xc7dd('0x1a')][_0xc7dd('0x23')]({'raw':_0x2719fd[_0xc7dd('0x1c')]?_0x2719fd[_0xc7dd('0x1c')][_0xc7dd('0x24')]===undefined?!![]:![]:!![],'where':_0x2719fd[_0xc7dd('0x1c')]?_0x2719fd[_0xc7dd('0x1c')]['where']||null:null,'attributes':_0x2719fd[_0xc7dd('0x1c')]?_0x2719fd[_0xc7dd('0x1c')]['attributes']||null:null,'include':_0x2719fd[_0xc7dd('0x1c')]?_0x2719fd['options']['include']?_[_0xc7dd('0x20')](_0x2719fd[_0xc7dd('0x1c')][_0xc7dd('0x21')],function(_0x535709){return{'model':db[_0x535709[_0xc7dd('0x1f')]],'as':_0x535709['as'],'attributes':_0x535709[_0xc7dd('0x1d')],'include':_0x535709[_0xc7dd('0x21')]?_[_0xc7dd('0x20')](_0x535709[_0xc7dd('0x21')],function(_0x500f03){return{'model':db[_0x500f03['model']],'as':_0x500f03['as'],'attributes':_0x500f03['attributes'],'include':_0x500f03[_0xc7dd('0x21')]?_[_0xc7dd('0x20')](_0x500f03[_0xc7dd('0x21')],function(_0x18dfab){return{'model':db[_0x18dfab[_0xc7dd('0x1f')]],'as':_0x18dfab['as'],'attributes':_0x18dfab[_0xc7dd('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc7dd('0xf')](function(_0x5a62d0){logger[_0xc7dd('0x17')](_0xc7dd('0x25'),_0x2719fd);logger[_0xc7dd('0x22')](_0xc7dd('0x25'),_0x2719fd,JSON[_0xc7dd('0x13')](_0x5a62d0));_0x2ebd2e(_0x5a62d0);})[_0xc7dd('0x18')](function(_0x4fb4ff){logger[_0xc7dd('0x14')]('ShowSmsQueue',_0x4fb4ff[_0xc7dd('0x16')],_0x2719fd);_0x45daa9(_0x2e8b8b[_0xc7dd('0x14')](0x1f4,_0x4fb4ff[_0xc7dd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index fc0f4e7..c4e26fa 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 _0x4b48=['save','update','emit','removeListener','length','smsQueue:','./smsQueue.events'];(function(_0x2c5624,_0x227f72){var _0x386bfa=function(_0x286da4){while(--_0x286da4){_0x2c5624['push'](_0x2c5624['shift']());}};_0x386bfa(++_0x227f72);}(_0x4b48,0xae));var _0x84b4=function(_0x59fa4e,_0x4ced18){_0x59fa4e=_0x59fa4e-0x0;var _0x589cb0=_0x4b48[_0x59fa4e];return _0x589cb0;};'use strict';var SmsQueueEvents=require(_0x84b4('0x0'));var events=[_0x84b4('0x1'),'remove',_0x84b4('0x2')];function createListener(_0x142484,_0x2f16cc){return function(_0x211ced){_0x2f16cc[_0x84b4('0x3')](_0x142484,_0x211ced);};}function removeListener(_0x45cc6a,_0x27df05){return function(){SmsQueueEvents[_0x84b4('0x4')](_0x45cc6a,_0x27df05);};}exports['register']=function(_0x5ba9ea){for(var _0x4343f3=0x0,_0x39ca98=events[_0x84b4('0x5')];_0x4343f3<_0x39ca98;_0x4343f3++){var _0x13b110=events[_0x4343f3];var _0x16906f=createListener(_0x84b4('0x6')+_0x13b110,_0x5ba9ea);SmsQueueEvents['on'](_0x13b110,_0x16906f);}}; \ No newline at end of file +var _0x05df=['removeListener','register','save','update','emit'];(function(_0xdbec0a,_0xc83316){var _0x45175d=function(_0x32a9df){while(--_0x32a9df){_0xdbec0a['push'](_0xdbec0a['shift']());}};_0x45175d(++_0xc83316);}(_0x05df,0x1f1));var _0xf05d=function(_0x53fd9d,_0x238ac9){_0x53fd9d=_0x53fd9d-0x0;var _0x5d3560=_0x05df[_0x53fd9d];return _0x5d3560;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xf05d('0x0'),'remove',_0xf05d('0x1')];function createListener(_0x57628a,_0x226356){return function(_0x11f34c){_0x226356[_0xf05d('0x2')](_0x57628a,_0x11f34c);};}function removeListener(_0x19573f,_0x4d1a55){return function(){SmsQueueEvents[_0xf05d('0x3')](_0x19573f,_0x4d1a55);};}exports[_0xf05d('0x4')]=function(_0x229b07){for(var _0x2d0b7e=0x0,_0x10de30=events['length'];_0x2d0b7e<_0x10de30;_0x2d0b7e++){var _0x537671=events[_0x2d0b7e];var _0x2a22cd=createListener('smsQueue:'+_0x537671,_0x229b07);SmsQueueEvents['on'](_0x537671,_0x2a22cd);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b2356b7..a7efd53 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 _0x1055=['delete','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x4605dc,_0x3f7ae5){var _0x5d3e81=function(_0x1d0375){while(--_0x1d0375){_0x4605dc['push'](_0x4605dc['shift']());}};_0x5d3e81(++_0x3f7ae5);}(_0x1055,0x101));var _0x5105=function(_0x1e45ec,_0x2e11eb){_0x1e45ec=_0x1e45ec-0x0;var _0x42f22d=_0x1055[_0x1e45ec];return _0x42f22d;};'use strict';var multer=require('multer');var util=require(_0x5105('0x0'));var path=require(_0x5105('0x1'));var timeout=require('connect-timeout');var express=require(_0x5105('0x2'));var router=express[_0x5105('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5105('0x4'));var config=require(_0x5105('0x5'));var controller=require(_0x5105('0x6'));router[_0x5105('0x7')]('/',auth[_0x5105('0x8')](),controller[_0x5105('0x9')]);router[_0x5105('0x7')]('/describe',auth[_0x5105('0x8')](),controller[_0x5105('0xa')]);router[_0x5105('0x7')](_0x5105('0xb'),auth[_0x5105('0x8')](),controller[_0x5105('0xc')]);router[_0x5105('0xd')]('/',auth[_0x5105('0x8')](),controller['create']);router[_0x5105('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5105('0xf')](_0x5105('0xb'),auth[_0x5105('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe650=['path','express','Router','../../components/auth/service','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','destroy','exports','multer','util'];(function(_0x260202,_0x2a59d4){var _0x560191=function(_0x26e44){while(--_0x26e44){_0x260202['push'](_0x260202['shift']());}};_0x560191(++_0x2a59d4);}(_0xe650,0xfd));var _0x0e65=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0xe650[_0x2cde2a];return _0x110f55;};'use strict';var multer=require(_0x0e65('0x0'));var util=require(_0x0e65('0x1'));var path=require(_0x0e65('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e65('0x3'));var router=express[_0x0e65('0x4')]();var auth=require(_0x0e65('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0e65('0x6'));router[_0x0e65('0x7')]('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0x9')]);router[_0x0e65('0x7')]('/describe',auth[_0x0e65('0x8')](),controller[_0x0e65('0xa')]);router[_0x0e65('0x7')](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller['show']);router['post']('/',auth[_0x0e65('0x8')](),controller[_0x0e65('0xc')]);router[_0x0e65('0xd')](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller[_0x0e65('0xe')]);router['delete'](_0x0e65('0xb'),auth[_0x0e65('0x8')](),controller[_0x0e65('0xf')]);module[_0x0e65('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3ee9693..b5bf89c 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 _0x418f=['DATE','moment','sequelize','exports','STRING'];(function(_0x3a04ab,_0x31b9fd){var _0x4bff6d=function(_0x125f7e){while(--_0x125f7e){_0x3a04ab['push'](_0x3a04ab['shift']());}};_0x4bff6d(++_0x31b9fd);}(_0x418f,0x1f0));var _0xf418=function(_0x315778,_0xfae71b){_0x315778=_0x315778-0x0;var _0x2730d1=_0x418f[_0x315778];return _0x2730d1;};'use strict';var moment=require(_0xf418('0x0'));var Sequelize=require(_0xf418('0x1'));module[_0xf418('0x2')]={'uniqueid':{'type':Sequelize[_0xf418('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf418('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xf418('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf418('0x4')]},'reason':{'type':Sequelize[_0xf418('0x3')]}}; \ No newline at end of file +var _0x27ff=['STRING','DATE','sequelize','exports'];(function(_0x20f8f5,_0x53884a){var _0x75788=function(_0x29c0cc){while(--_0x29c0cc){_0x20f8f5['push'](_0x20f8f5['shift']());}};_0x75788(++_0x53884a);}(_0x27ff,0xaa));var _0xf27f=function(_0x3720f6,_0x4ab838){_0x3720f6=_0x3720f6-0x0;var _0x5a2527=_0x27ff[_0x3720f6];return _0x5a2527;};'use strict';var moment=require('moment');var Sequelize=require(_0xf27f('0x0'));module[_0xf27f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf27f('0x2')]},'joinAt':{'type':Sequelize[_0xf27f('0x3')]},'leaveAt':{'type':Sequelize[_0xf27f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf27f('0x3')]},'reason':{'type':Sequelize[_0xf27f('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 078f207..6f80dd6 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 _0x4aa8=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','error','name','index','SmsQueueReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x115930,_0x5f5dd1){var _0x43208e=function(_0x103359){while(--_0x103359){_0x115930['push'](_0x115930['shift']());}};_0x43208e(++_0x5f5dd1);}(_0x4aa8,0x88));var _0x84aa=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x4aa8[_0x342700];return _0x53406f;};'use strict';var pdf=require(_0x84aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x84aa('0x1'));var zipdir=require(_0x84aa('0x2'));var jsonpatch=require(_0x84aa('0x3'));var rp=require(_0x84aa('0x4'));var moment=require(_0x84aa('0x5'));var BPromise=require(_0x84aa('0x6'));var Mustache=require(_0x84aa('0x7'));var util=require(_0x84aa('0x8'));var path=require(_0x84aa('0x9'));var sox=require('sox');var csv=require(_0x84aa('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x84aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x84aa('0xc'));var deskjs=require(_0x84aa('0xd'));var toCsv=require(_0x84aa('0xa'));var querystring=require(_0x84aa('0xe'));var Papa=require(_0x84aa('0xf'));var Redis=require(_0x84aa('0x10'));var authService=require(_0x84aa('0x11'));var qs=require(_0x84aa('0x12'));var as=require(_0x84aa('0x13'));var hardwareService=require(_0x84aa('0x14'));var logger=require(_0x84aa('0x15'))(_0x84aa('0x16'));var utils=require('../../config/utils');var config=require(_0x84aa('0x17'));var licenseUtil=require(_0x84aa('0x18'));var db=require(_0x84aa('0x19'))['db'];function respondWithStatusCode(_0x3653bb,_0x437acf){_0x437acf=_0x437acf||0xcc;return function(_0x248248){if(_0x248248){return _0x3653bb[_0x84aa('0x1a')](_0x437acf);}return _0x3653bb[_0x84aa('0x1b')](_0x437acf)[_0x84aa('0x1c')]();};}function respondWithResult(_0x52faf0,_0x5b9089){_0x5b9089=_0x5b9089||0xc8;return function(_0x5db879){if(_0x5db879){return _0x52faf0[_0x84aa('0x1b')](_0x5b9089)[_0x84aa('0x1d')](_0x5db879);}};}function respondWithFilteredResult(_0x14b055,_0x1cde5c){return function(_0x5d454f){if(_0x5d454f){var _0x5eadaf=_0x5d454f[_0x84aa('0x1e')],_0x3d2469=_0x1cde5c[_0x84aa('0x1f')],_0xad2d3e=_0x1cde5c['offset']+_0x1cde5c[_0x84aa('0x20')],_0x2fc1b8;if(_0xad2d3e>=_0x5eadaf){_0xad2d3e=_0x5eadaf;_0x2fc1b8=0xc8;}else{_0x2fc1b8=0xce;}_0x14b055[_0x84aa('0x1b')](_0x2fc1b8);return _0x14b055[_0x84aa('0x21')](_0x84aa('0x22'),_0x3d2469+'-'+_0xad2d3e+'/'+_0x5eadaf)[_0x84aa('0x1d')](_0x5d454f);}return null;};}function patchUpdates(_0x1d7721){return function(_0x410ad1){try{jsonpatch[_0x84aa('0x23')](_0x410ad1,_0x1d7721,!![]);}catch(_0x579cc3){return BPromise[_0x84aa('0x24')](_0x579cc3);}return _0x410ad1[_0x84aa('0x25')]();};}function saveUpdates(_0x155410,_0x44b499){return function(_0x430b55){if(_0x430b55){return _0x430b55['update'](_0x155410)['then'](function(_0x180f97){return _0x180f97;});}return null;};}function removeEntity(_0x24a432,_0x2c20d4){return function(_0x4ea18a){if(_0x4ea18a){return _0x4ea18a['destroy']()['then'](function(){_0x24a432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d389e,_0x4e6df6){return function(_0x3b9376){if(!_0x3b9376){_0x3d389e[_0x84aa('0x1a')](0x194);}return _0x3b9376;};}function handleError(_0x3b59c6,_0x543b7d){_0x543b7d=_0x543b7d||0x1f4;return function(_0x1e4487){logger[_0x84aa('0x26')](_0x1e4487['stack']);if(_0x1e4487[_0x84aa('0x27')]){delete _0x1e4487[_0x84aa('0x27')];}_0x3b59c6[_0x84aa('0x1b')](_0x543b7d)['send'](_0x1e4487);};}exports[_0x84aa('0x28')]=function(_0x3649b4,_0x44e800){var _0x35c7fe={},_0x44cbdf={},_0x5f36fe={'count':0x0,'rows':[]};var _0x13c7c7=_['map'](db[_0x84aa('0x29')][_0x84aa('0x2a')],function(_0x1cf07c){return{'name':_0x1cf07c[_0x84aa('0x2b')],'type':_0x1cf07c['type'][_0x84aa('0x2c')]};});_0x44cbdf[_0x84aa('0x2d')]=_[_0x84aa('0x2e')](_0x13c7c7,_0x84aa('0x27'));_0x44cbdf['query']=_[_0x84aa('0x2f')](_0x3649b4['query']);_0x44cbdf[_0x84aa('0x30')]=_[_0x84aa('0x31')](_0x44cbdf[_0x84aa('0x2d')],_0x44cbdf[_0x84aa('0x32')]);_0x35c7fe[_0x84aa('0x33')]=_[_0x84aa('0x31')](_0x44cbdf[_0x84aa('0x2d')],qs['fields'](_0x3649b4[_0x84aa('0x32')][_0x84aa('0x34')]));_0x35c7fe[_0x84aa('0x33')]=_0x35c7fe['attributes'][_0x84aa('0x35')]?_0x35c7fe[_0x84aa('0x33')]:_0x44cbdf[_0x84aa('0x2d')];if(!_0x3649b4[_0x84aa('0x32')]['hasOwnProperty'](_0x84aa('0x36'))){_0x35c7fe[_0x84aa('0x20')]=qs[_0x84aa('0x20')](_0x3649b4[_0x84aa('0x32')][_0x84aa('0x20')]);_0x35c7fe[_0x84aa('0x1f')]=qs['offset'](_0x3649b4[_0x84aa('0x32')][_0x84aa('0x1f')]);}_0x35c7fe[_0x84aa('0x37')]=qs[_0x84aa('0x38')](_0x3649b4[_0x84aa('0x32')][_0x84aa('0x38')]);_0x35c7fe[_0x84aa('0x39')]=qs[_0x84aa('0x30')](_[_0x84aa('0x3a')](_0x3649b4['query'],_0x44cbdf[_0x84aa('0x30')]),_0x13c7c7);if(_0x3649b4[_0x84aa('0x32')][_0x84aa('0x3b')]){_0x35c7fe[_0x84aa('0x39')]=_[_0x84aa('0x3c')](_0x35c7fe[_0x84aa('0x39')],{'$or':_[_0x84aa('0x2e')](_0x13c7c7,function(_0x3f21f9){if(_0x3f21f9[_0x84aa('0x3d')]!==_0x84aa('0x3e')){var _0x35515d={};_0x35515d[_0x3f21f9[_0x84aa('0x27')]]={'$like':'%'+_0x3649b4[_0x84aa('0x32')][_0x84aa('0x3b')]+'%'};return _0x35515d;}})});}_0x35c7fe=_[_0x84aa('0x3c')]({},_0x35c7fe,_0x3649b4[_0x84aa('0x3f')]);var _0x321074={'where':_0x35c7fe[_0x84aa('0x39')]};return db[_0x84aa('0x29')]['count'](_0x321074)[_0x84aa('0x40')](function(_0x4d8a45){_0x5f36fe[_0x84aa('0x1e')]=_0x4d8a45;if(_0x3649b4[_0x84aa('0x32')][_0x84aa('0x41')]){_0x35c7fe[_0x84aa('0x42')]=[{'all':!![]}];}return db[_0x84aa('0x29')][_0x84aa('0x43')](_0x35c7fe);})[_0x84aa('0x40')](function(_0x762dfe){_0x5f36fe[_0x84aa('0x44')]=_0x762dfe;return _0x5f36fe;})[_0x84aa('0x40')](respondWithFilteredResult(_0x44e800,_0x35c7fe))[_0x84aa('0x45')](handleError(_0x44e800,null));};exports[_0x84aa('0x46')]=function(_0x6aaf63,_0xa80306){var _0x2ab9b1={'raw':!![],'where':{'id':_0x6aaf63[_0x84aa('0x47')]['id']}},_0xb11296={};_0xb11296[_0x84aa('0x2d')]=_[_0x84aa('0x2f')](db[_0x84aa('0x29')][_0x84aa('0x2a')]);_0xb11296[_0x84aa('0x32')]=_[_0x84aa('0x2f')](_0x6aaf63[_0x84aa('0x32')]);_0xb11296[_0x84aa('0x48')]=_[_0x84aa('0x31')](_0xb11296[_0x84aa('0x2d')],_0xb11296[_0x84aa('0x32')]);_0x2ab9b1[_0x84aa('0x33')]=_[_0x84aa('0x31')](_0xb11296[_0x84aa('0x2d')],qs[_0x84aa('0x34')](_0x6aaf63['query']['fields']));_0x2ab9b1[_0x84aa('0x33')]=_0x2ab9b1[_0x84aa('0x33')]['length']?_0x2ab9b1[_0x84aa('0x33')]:_0xb11296['model'];if(_0x6aaf63['query'][_0x84aa('0x41')]){_0x2ab9b1[_0x84aa('0x42')]=[{'all':!![]}];}_0x2ab9b1=_[_0x84aa('0x3c')]({},_0x2ab9b1,_0x6aaf63[_0x84aa('0x3f')]);return db['SmsQueueReport'][_0x84aa('0x49')](_0x2ab9b1)['then'](handleEntityNotFound(_0xa80306,null))['then'](respondWithResult(_0xa80306,null))[_0x84aa('0x45')](handleError(_0xa80306,null));};exports['create']=function(_0x29b27d,_0x552e55){return db[_0x84aa('0x29')][_0x84aa('0x4a')](_0x29b27d[_0x84aa('0x4b')],{})[_0x84aa('0x40')](respondWithResult(_0x552e55,0xc9))[_0x84aa('0x45')](handleError(_0x552e55,null));};exports[_0x84aa('0x4c')]=function(_0x110ca2,_0x1f3f5e){if(_0x110ca2['body']['id']){delete _0x110ca2[_0x84aa('0x4b')]['id'];}return db[_0x84aa('0x29')][_0x84aa('0x49')]({'where':{'id':_0x110ca2[_0x84aa('0x47')]['id']}})[_0x84aa('0x40')](handleEntityNotFound(_0x1f3f5e,null))[_0x84aa('0x40')](saveUpdates(_0x110ca2[_0x84aa('0x4b')],null))[_0x84aa('0x40')](respondWithResult(_0x1f3f5e,null))[_0x84aa('0x45')](handleError(_0x1f3f5e,null));};exports['destroy']=function(_0x4e00de,_0x623fa){return db[_0x84aa('0x29')]['find']({'where':{'id':_0x4e00de[_0x84aa('0x47')]['id']}})[_0x84aa('0x40')](handleEntityNotFound(_0x623fa,null))[_0x84aa('0x40')](removeEntity(_0x623fa,null))[_0x84aa('0x45')](handleError(_0x623fa,null));};exports[_0x84aa('0x4d')]=function(_0xa9f7,_0x1621fc){return db[_0x84aa('0x29')][_0x84aa('0x4d')]()[_0x84aa('0x40')](respondWithResult(_0x1621fc,null))[_0x84aa('0x45')](handleError(_0x1621fc,null));}; \ No newline at end of file +var _0x669b=['attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','catch','create','body','update','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','then','destroy','end','error','send','map','SmsQueueReport','rawAttributes','fieldName','type','name','query','filters','model'];(function(_0x389d80,_0x5c8721){var _0xa26b41=function(_0x370f9d){while(--_0x370f9d){_0x389d80['push'](_0x389d80['shift']());}};_0xa26b41(++_0x5c8721);}(_0x669b,0x1c8));var _0xb669=function(_0x31ca76,_0x4a0e91){_0x31ca76=_0x31ca76-0x0;var _0x5ca3a0=_0x669b[_0x31ca76];return _0x5ca3a0;};'use strict';var pdf=require(_0xb669('0x0'));var emlformat=require(_0xb669('0x1'));var rimraf=require(_0xb669('0x2'));var zipdir=require(_0xb669('0x3'));var jsonpatch=require(_0xb669('0x4'));var rp=require(_0xb669('0x5'));var moment=require(_0xb669('0x6'));var BPromise=require(_0xb669('0x7'));var Mustache=require(_0xb669('0x8'));var util=require(_0xb669('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xb669('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb669('0xb'));var squel=require(_0xb669('0xc'));var crypto=require('crypto');var jsforce=require(_0xb669('0xd'));var deskjs=require(_0xb669('0xe'));var toCsv=require(_0xb669('0xa'));var querystring=require(_0xb669('0xf'));var Papa=require(_0xb669('0x10'));var Redis=require('ioredis');var authService=require(_0xb669('0x11'));var qs=require(_0xb669('0x12'));var as=require(_0xb669('0x13'));var hardwareService=require(_0xb669('0x14'));var logger=require('../../config/logger')(_0xb669('0x15'));var utils=require(_0xb669('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb669('0x17'));var db=require(_0xb669('0x18'))['db'];function respondWithStatusCode(_0x3f3234,_0x27e1b9){_0x27e1b9=_0x27e1b9||0xcc;return function(_0x398139){if(_0x398139){return _0x3f3234[_0xb669('0x19')](_0x27e1b9);}return _0x3f3234[_0xb669('0x1a')](_0x27e1b9)['end']();};}function respondWithResult(_0x148c6f,_0x2d09dc){_0x2d09dc=_0x2d09dc||0xc8;return function(_0x4513bb){if(_0x4513bb){return _0x148c6f[_0xb669('0x1a')](_0x2d09dc)['json'](_0x4513bb);}};}function respondWithFilteredResult(_0x2641bb,_0xed0c20){return function(_0x4df512){if(_0x4df512){var _0x4deb88=_0x4df512[_0xb669('0x1b')],_0x361e27=_0xed0c20[_0xb669('0x1c')],_0x4525b8=_0xed0c20[_0xb669('0x1c')]+_0xed0c20[_0xb669('0x1d')],_0x2abe39;if(_0x4525b8>=_0x4deb88){_0x4525b8=_0x4deb88;_0x2abe39=0xc8;}else{_0x2abe39=0xce;}_0x2641bb[_0xb669('0x1a')](_0x2abe39);return _0x2641bb['set'](_0xb669('0x1e'),_0x361e27+'-'+_0x4525b8+'/'+_0x4deb88)[_0xb669('0x1f')](_0x4df512);}return null;};}function patchUpdates(_0x3c1215){return function(_0x59c443){try{jsonpatch['apply'](_0x59c443,_0x3c1215,!![]);}catch(_0x2b9d06){return BPromise[_0xb669('0x20')](_0x2b9d06);}return _0x59c443[_0xb669('0x21')]();};}function saveUpdates(_0x4e97e4,_0x4ecd67){return function(_0x565176){if(_0x565176){return _0x565176['update'](_0x4e97e4)[_0xb669('0x22')](function(_0x4380ed){return _0x4380ed;});}return null;};}function removeEntity(_0x1ed6ac,_0x285a3b){return function(_0x414d0e){if(_0x414d0e){return _0x414d0e[_0xb669('0x23')]()[_0xb669('0x22')](function(){_0x1ed6ac['status'](0xcc)[_0xb669('0x24')]();});}};}function handleEntityNotFound(_0x28f7bd,_0x4878a5){return function(_0x2025ae){if(!_0x2025ae){_0x28f7bd['sendStatus'](0x194);}return _0x2025ae;};}function handleError(_0x1036d3,_0x27b0f8){_0x27b0f8=_0x27b0f8||0x1f4;return function(_0x14c5d8){logger[_0xb669('0x25')](_0x14c5d8['stack']);if(_0x14c5d8['name']){delete _0x14c5d8['name'];}_0x1036d3[_0xb669('0x1a')](_0x27b0f8)[_0xb669('0x26')](_0x14c5d8);};}exports['index']=function(_0x479ed1,_0x3543fd){var _0x1521c4={},_0x24d13c={},_0x5b71db={'count':0x0,'rows':[]};var _0x1e96c4=_[_0xb669('0x27')](db[_0xb669('0x28')][_0xb669('0x29')],function(_0x595d9f){return{'name':_0x595d9f[_0xb669('0x2a')],'type':_0x595d9f[_0xb669('0x2b')]['key']};});_0x24d13c['model']=_[_0xb669('0x27')](_0x1e96c4,_0xb669('0x2c'));_0x24d13c[_0xb669('0x2d')]=_['keys'](_0x479ed1[_0xb669('0x2d')]);_0x24d13c[_0xb669('0x2e')]=_['intersection'](_0x24d13c[_0xb669('0x2f')],_0x24d13c[_0xb669('0x2d')]);_0x1521c4[_0xb669('0x30')]=_[_0xb669('0x31')](_0x24d13c[_0xb669('0x2f')],qs['fields'](_0x479ed1['query'][_0xb669('0x32')]));_0x1521c4[_0xb669('0x30')]=_0x1521c4[_0xb669('0x30')]['length']?_0x1521c4[_0xb669('0x30')]:_0x24d13c[_0xb669('0x2f')];if(!_0x479ed1[_0xb669('0x2d')][_0xb669('0x33')]('nolimit')){_0x1521c4['limit']=qs[_0xb669('0x1d')](_0x479ed1['query']['limit']);_0x1521c4[_0xb669('0x1c')]=qs['offset'](_0x479ed1[_0xb669('0x2d')][_0xb669('0x1c')]);}_0x1521c4[_0xb669('0x34')]=qs[_0xb669('0x35')](_0x479ed1['query']['sort']);_0x1521c4[_0xb669('0x36')]=qs[_0xb669('0x2e')](_[_0xb669('0x37')](_0x479ed1['query'],_0x24d13c['filters']),_0x1e96c4);if(_0x479ed1[_0xb669('0x2d')][_0xb669('0x38')]){_0x1521c4[_0xb669('0x36')]=_[_0xb669('0x39')](_0x1521c4[_0xb669('0x36')],{'$or':_[_0xb669('0x27')](_0x1e96c4,function(_0x3cc214){if(_0x3cc214[_0xb669('0x2b')]!=='VIRTUAL'){var _0x1628ef={};_0x1628ef[_0x3cc214[_0xb669('0x2c')]]={'$like':'%'+_0x479ed1[_0xb669('0x2d')][_0xb669('0x38')]+'%'};return _0x1628ef;}})});}_0x1521c4=_[_0xb669('0x39')]({},_0x1521c4,_0x479ed1[_0xb669('0x3a')]);var _0x55f142={'where':_0x1521c4[_0xb669('0x36')]};return db['SmsQueueReport'][_0xb669('0x1b')](_0x55f142)[_0xb669('0x22')](function(_0x3848c7){_0x5b71db['count']=_0x3848c7;if(_0x479ed1['query'][_0xb669('0x3b')]){_0x1521c4[_0xb669('0x3c')]=[{'all':!![]}];}return db[_0xb669('0x28')][_0xb669('0x3d')](_0x1521c4);})['then'](function(_0x2c18eb){_0x5b71db[_0xb669('0x3e')]=_0x2c18eb;return _0x5b71db;})[_0xb669('0x22')](respondWithFilteredResult(_0x3543fd,_0x1521c4))['catch'](handleError(_0x3543fd,null));};exports[_0xb669('0x3f')]=function(_0x34654b,_0x5abfe1){var _0x1f1ce6={'raw':!![],'where':{'id':_0x34654b['params']['id']}},_0x1e61ad={};_0x1e61ad[_0xb669('0x2f')]=_[_0xb669('0x40')](db['SmsQueueReport'][_0xb669('0x29')]);_0x1e61ad[_0xb669('0x2d')]=_[_0xb669('0x40')](_0x34654b[_0xb669('0x2d')]);_0x1e61ad['filtears']=_['intersection'](_0x1e61ad[_0xb669('0x2f')],_0x1e61ad[_0xb669('0x2d')]);_0x1f1ce6[_0xb669('0x30')]=_[_0xb669('0x31')](_0x1e61ad[_0xb669('0x2f')],qs[_0xb669('0x32')](_0x34654b['query']['fields']));_0x1f1ce6[_0xb669('0x30')]=_0x1f1ce6[_0xb669('0x30')]['length']?_0x1f1ce6['attributes']:_0x1e61ad[_0xb669('0x2f')];if(_0x34654b[_0xb669('0x2d')]['includeAll']){_0x1f1ce6['include']=[{'all':!![]}];}_0x1f1ce6=_[_0xb669('0x39')]({},_0x1f1ce6,_0x34654b[_0xb669('0x3a')]);return db[_0xb669('0x28')]['find'](_0x1f1ce6)[_0xb669('0x22')](handleEntityNotFound(_0x5abfe1,null))[_0xb669('0x22')](respondWithResult(_0x5abfe1,null))[_0xb669('0x41')](handleError(_0x5abfe1,null));};exports['create']=function(_0x4793a1,_0xcd7e4){return db[_0xb669('0x28')][_0xb669('0x42')](_0x4793a1[_0xb669('0x43')],{})[_0xb669('0x22')](respondWithResult(_0xcd7e4,0xc9))['catch'](handleError(_0xcd7e4,null));};exports[_0xb669('0x44')]=function(_0x285c63,_0x582d87){if(_0x285c63[_0xb669('0x43')]['id']){delete _0x285c63[_0xb669('0x43')]['id'];}return db[_0xb669('0x28')][_0xb669('0x45')]({'where':{'id':_0x285c63[_0xb669('0x46')]['id']}})[_0xb669('0x22')](handleEntityNotFound(_0x582d87,null))[_0xb669('0x22')](saveUpdates(_0x285c63[_0xb669('0x43')],null))[_0xb669('0x22')](respondWithResult(_0x582d87,null))[_0xb669('0x41')](handleError(_0x582d87,null));};exports[_0xb669('0x23')]=function(_0x2a1cfc,_0x499196){return db[_0xb669('0x28')][_0xb669('0x45')]({'where':{'id':_0x2a1cfc[_0xb669('0x46')]['id']}})[_0xb669('0x22')](handleEntityNotFound(_0x499196,null))['then'](removeEntity(_0x499196,null))[_0xb669('0x41')](handleError(_0x499196,null));};exports[_0xb669('0x47')]=function(_0x5f1768,_0x3aa3c1){return db[_0xb669('0x28')][_0xb669('0x47')]()[_0xb669('0x22')](respondWithResult(_0x3aa3c1,null))[_0xb669('0x41')](handleError(_0x3aa3c1,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 1a2a3f1..963ce80 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 _0xa396=['uniqueid','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport'];(function(_0x2e86ac,_0x237fb2){var _0x25966b=function(_0x539362){while(--_0x539362){_0x2e86ac['push'](_0x2e86ac['shift']());}};_0x25966b(++_0x237fb2);}(_0xa396,0xaa));var _0x6a39=function(_0x5a84d6,_0x5b7170){_0x5a84d6=_0x5a84d6-0x0;var _0x304a66=_0xa396[_0x5a84d6];return _0x304a66;};'use strict';var _=require(_0x6a39('0x0'));var util=require(_0x6a39('0x1'));var logger=require('../../config/logger')(_0x6a39('0x2'));var moment=require(_0x6a39('0x3'));var BPromise=require('bluebird');var rp=require(_0x6a39('0x4'));var fs=require('fs');var path=require(_0x6a39('0x5'));var rimraf=require(_0x6a39('0x6'));var config=require(_0x6a39('0x7'));var attributes=require(_0x6a39('0x8'));module[_0x6a39('0x9')]=function(_0x1cd04b,_0x44279c){return _0x1cd04b[_0x6a39('0xa')](_0x6a39('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x6a39('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xec1c=['util','../../config/logger','bluebird','request-promise','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xec1c,0x1c3));var _0xcec1=function(_0x36610a,_0x5954f0){_0x36610a=_0x36610a-0x0;var _0x56e2ad=_0xec1c[_0x36610a];return _0x56e2ad;};'use strict';var _=require('lodash');var util=require(_0xcec1('0x0'));var logger=require(_0xcec1('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcec1('0x2'));var rp=require(_0xcec1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcec1('0x4'));var config=require('../../config/environment');var attributes=require(_0xcec1('0x5'));module[_0xcec1('0x6')]=function(_0x5f3288,_0x3a45e2){return _0x5f3288[_0xcec1('0x7')](_0xcec1('0x8'),attributes,{'tableName':_0xcec1('0x9'),'paranoid':![],'indexes':[{'name':_0xcec1('0xa'),'fields':[_0xcec1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 9bbc213..e8f7ba6 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 _0xb2a1=['then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','catch','UpdateSmsQueueReport','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0xea34ea,_0x5d8657){var _0x153b59=function(_0x261675){while(--_0x261675){_0xea34ea['push'](_0xea34ea['shift']());}};_0x153b59(++_0x5d8657);}(_0xb2a1,0xb9));var _0x1b2a=function(_0x5713f,_0x4cafff){_0x5713f=_0x5713f-0x0;var _0x19095b=_0xb2a1[_0x5713f];return _0x19095b;};'use strict';var _=require(_0x1b2a('0x0'));var util=require(_0x1b2a('0x1'));var moment=require(_0x1b2a('0x2'));var BPromise=require(_0x1b2a('0x3'));var rs=require(_0x1b2a('0x4'));var fs=require('fs');var Redis=require(_0x1b2a('0x5'));var db=require(_0x1b2a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b2a('0x7'))(_0x1b2a('0x8'));var config=require(_0x1b2a('0x9'));var jayson=require(_0x1b2a('0xa'));var client=jayson[_0x1b2a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225ae8,_0x3db1d2,_0x347d36){return new BPromise(function(_0x5f09e3,_0x491d2b){return client[_0x1b2a('0xc')](_0x225ae8,_0x347d36)[_0x1b2a('0xd')](function(_0x2d00a1){logger[_0x1b2a('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3db1d2,_0x1b2a('0xf'));logger[_0x1b2a('0x10')](_0x1b2a('0x11'),_0x3db1d2,_0x1b2a('0xf'),JSON[_0x1b2a('0x12')](_0x2d00a1));if(_0x2d00a1[_0x1b2a('0x13')]){if(_0x2d00a1[_0x1b2a('0x13')][_0x1b2a('0x14')]===0x1f4){logger[_0x1b2a('0x13')](_0x1b2a('0x15'),_0x3db1d2,_0x2d00a1['error']['message']);return _0x491d2b(_0x2d00a1[_0x1b2a('0x13')][_0x1b2a('0x16')]);}logger['error'](_0x1b2a('0x15'),_0x3db1d2,_0x2d00a1['error'][_0x1b2a('0x16')]);return _0x5f09e3(_0x2d00a1[_0x1b2a('0x13')]['message']);}else{logger[_0x1b2a('0xe')](_0x1b2a('0x15'),_0x3db1d2,_0x1b2a('0xf'));_0x5f09e3(_0x2d00a1[_0x1b2a('0x17')][_0x1b2a('0x16')]);}})['catch'](function(_0x4fcf6d){logger[_0x1b2a('0x13')](_0x1b2a('0x15'),_0x3db1d2,_0x4fcf6d);_0x491d2b(_0x4fcf6d);});});}exports[_0x1b2a('0x18')]=function(_0x1d72a7){var _0x1c8711=this;return new Promise(function(_0x1ecaef,_0x45bb8f){return db[_0x1b2a('0x19')][_0x1b2a('0x1a')](_0x1d72a7['body'],{'raw':_0x1d72a7[_0x1b2a('0x1b')]?_0x1d72a7['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x20f964){logger['info'](_0x1b2a('0x18'),_0x1d72a7);logger[_0x1b2a('0x10')](_0x1b2a('0x18'),_0x1d72a7,JSON['stringify'](_0x20f964));_0x1ecaef(_0x20f964);})[_0x1b2a('0x1c')](function(_0x3bfcad){logger['error']('CreateSmsQueueReport',_0x3bfcad[_0x1b2a('0x16')],_0x1d72a7);_0x45bb8f(_0x1c8711[_0x1b2a('0x13')](0x1f4,_0x3bfcad[_0x1b2a('0x16')]));});});};exports[_0x1b2a('0x1d')]=function(_0x5c0c57){var _0x14f9ac=this;return new Promise(function(_0x2668ce,_0x2ca93f){return db[_0x1b2a('0x19')]['update'](_0x5c0c57[_0x1b2a('0x1e')],{'raw':_0x5c0c57[_0x1b2a('0x1b')]?_0x5c0c57[_0x1b2a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0c57[_0x1b2a('0x1b')]?_0x5c0c57['options'][_0x1b2a('0x1f')]||null:null,'attributes':_0x5c0c57[_0x1b2a('0x1b')]?_0x5c0c57[_0x1b2a('0x1b')][_0x1b2a('0x20')]||null:null,'limit':_0x5c0c57[_0x1b2a('0x1b')]?_0x5c0c57[_0x1b2a('0x1b')]['limit']||null:null})[_0x1b2a('0xd')](function(_0x1dd781){logger[_0x1b2a('0xe')](_0x1b2a('0x1d'),_0x5c0c57);logger['debug'](_0x1b2a('0x1d'),_0x5c0c57,JSON['stringify'](_0x1dd781));_0x2668ce(_0x1dd781);})[_0x1b2a('0x1c')](function(_0x3258ae){logger[_0x1b2a('0x13')](_0x1b2a('0x1d'),_0x3258ae[_0x1b2a('0x16')],_0x5c0c57);_0x2ca93f(_0x14f9ac[_0x1b2a('0x13')](0x1f4,_0x3258ae['message']));});});}; \ No newline at end of file +var _0xcf53=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','options','raw','catch','update','body','where','attributes','UpdateSmsQueueReport','lodash','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcf53,0x1b6));var _0x3cf5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcf53[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3cf5('0x0'));var util=require('util');var moment=require(_0x3cf5('0x1'));var BPromise=require(_0x3cf5('0x2'));var rs=require(_0x3cf5('0x3'));var fs=require('fs');var Redis=require(_0x3cf5('0x4'));var db=require(_0x3cf5('0x5'))['db'];var utils=require(_0x3cf5('0x6'));var logger=require(_0x3cf5('0x7'))(_0x3cf5('0x8'));var config=require(_0x3cf5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3cf5('0xa')][_0x3cf5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f16a3,_0x4137d8,_0x353fc5){return new BPromise(function(_0x5d2f30,_0x2de0bc){return client[_0x3cf5('0xc')](_0x4f16a3,_0x353fc5)[_0x3cf5('0xd')](function(_0x41ea90){logger[_0x3cf5('0xe')](_0x3cf5('0xf'),_0x4137d8,'request\x20sent');logger[_0x3cf5('0x10')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x4137d8,_0x3cf5('0x11'),JSON[_0x3cf5('0x12')](_0x41ea90));if(_0x41ea90[_0x3cf5('0x13')]){if(_0x41ea90['error'][_0x3cf5('0x14')]===0x1f4){logger[_0x3cf5('0x13')](_0x3cf5('0xf'),_0x4137d8,_0x41ea90[_0x3cf5('0x13')][_0x3cf5('0x15')]);return _0x2de0bc(_0x41ea90[_0x3cf5('0x13')][_0x3cf5('0x15')]);}logger[_0x3cf5('0x13')](_0x3cf5('0xf'),_0x4137d8,_0x41ea90[_0x3cf5('0x13')][_0x3cf5('0x15')]);return _0x5d2f30(_0x41ea90[_0x3cf5('0x13')][_0x3cf5('0x15')]);}else{logger[_0x3cf5('0xe')](_0x3cf5('0xf'),_0x4137d8,_0x3cf5('0x11'));_0x5d2f30(_0x41ea90[_0x3cf5('0x16')][_0x3cf5('0x15')]);}})['catch'](function(_0xc71019){logger[_0x3cf5('0x13')](_0x3cf5('0xf'),_0x4137d8,_0xc71019);_0x2de0bc(_0xc71019);});});}exports[_0x3cf5('0x17')]=function(_0x4b86dc){var _0x76c15f=this;return new Promise(function(_0x320daf,_0xba4c09){return db[_0x3cf5('0x18')][_0x3cf5('0x19')](_0x4b86dc['body'],{'raw':_0x4b86dc['options']?_0x4b86dc[_0x3cf5('0x1a')][_0x3cf5('0x1b')]===undefined?!![]:![]:!![]})[_0x3cf5('0xd')](function(_0x590612){logger['info']('CreateSmsQueueReport',_0x4b86dc);logger[_0x3cf5('0x10')](_0x3cf5('0x17'),_0x4b86dc,JSON[_0x3cf5('0x12')](_0x590612));_0x320daf(_0x590612);})[_0x3cf5('0x1c')](function(_0x2cb807){logger[_0x3cf5('0x13')](_0x3cf5('0x17'),_0x2cb807['message'],_0x4b86dc);_0xba4c09(_0x76c15f[_0x3cf5('0x13')](0x1f4,_0x2cb807[_0x3cf5('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0xbe6998){var _0x3a6f96=this;return new Promise(function(_0x89014c,_0x2fad94){return db[_0x3cf5('0x18')][_0x3cf5('0x1d')](_0xbe6998[_0x3cf5('0x1e')],{'raw':_0xbe6998['options']?_0xbe6998['options'][_0x3cf5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbe6998['options']?_0xbe6998['options'][_0x3cf5('0x1f')]||null:null,'attributes':_0xbe6998[_0x3cf5('0x1a')]?_0xbe6998['options'][_0x3cf5('0x20')]||null:null,'limit':_0xbe6998[_0x3cf5('0x1a')]?_0xbe6998['options']['limit']||null:null})['then'](function(_0x45add3){logger[_0x3cf5('0xe')](_0x3cf5('0x21'),_0xbe6998);logger['debug'](_0x3cf5('0x21'),_0xbe6998,JSON[_0x3cf5('0x12')](_0x45add3));_0x89014c(_0x45add3);})[_0x3cf5('0x1c')](function(_0x12b6cf){logger[_0x3cf5('0x13')](_0x3cf5('0x21'),_0x12b6cf[_0x3cf5('0x15')],_0xbe6998);_0x2fad94(_0x3a6f96[_0x3cf5('0x13')](0x1f4,_0x12b6cf[_0x3cf5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c7d8aad..94b4f7b 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 _0xf4f4=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x25a6c8,_0x2ef4d8){var _0x235547=function(_0x460454){while(--_0x460454){_0x25a6c8['push'](_0x25a6c8['shift']());}};_0x235547(++_0x2ef4d8);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1377be,_0x536cda){_0x1377be=_0x1377be-0x0;var _0x344720=_0xf4f4[_0x1377be];return _0x344720;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x12')]);router['delete']('/:id',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);module[_0x4f4f('0x14')]=router; \ No newline at end of file +var _0x1775=['./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x358b23,_0xf8ee){var _0x518a27=function(_0x5a54f6){while(--_0x5a54f6){_0x358b23['push'](_0x358b23['shift']());}};_0x518a27(++_0xf8ee);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var auth=require(_0x5177('0x5'));var interaction=require(_0x5177('0x6'));var config=require(_0x5177('0x7'));var controller=require(_0x5177('0x8'));router[_0x5177('0x9')]('/',auth[_0x5177('0xa')](),controller[_0x5177('0xb')]);router[_0x5177('0x9')](_0x5177('0xc'),auth[_0x5177('0xa')](),controller[_0x5177('0xd')]);router[_0x5177('0x9')](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0xf')]);router[_0x5177('0x10')]('/',auth[_0x5177('0xa')](),controller['create']);router['put'](_0x5177('0xe'),auth[_0x5177('0xa')](),controller[_0x5177('0x11')]);router[_0x5177('0x12')](_0x5177('0xe'),auth['isAuthenticated'](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index fe6c7b4..2fe6455 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 _0x1b61=['queue','DATE','NOW','sequelize','exports','account','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b61,0x122));var _0x11b6=function(_0xc117c,_0x128630){_0xc117c=_0xc117c-0x0;var _0x370c3f=_0x1b61[_0xc117c];return _0x370c3f;};'use strict';var moment=require('moment');var Sequelize=require(_0x11b6('0x0'));module[_0x11b6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x11b6('0x2'),_0x11b6('0x3'),_0x11b6('0x4')),'allowNull':![],'defaultValue':_0x11b6('0x4')},'transferredAt':{'type':Sequelize[_0x11b6('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x11b6('0x6')]}}; \ No newline at end of file +var _0xc398=['agent','queue','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x936912,_0x42167e){var _0x42577e=function(_0x570a4a){while(--_0x570a4a){_0x936912['push'](_0x936912['shift']());}};_0x42577e(++_0x42167e);}(_0xc398,0x174));var _0x8c39=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0xc398[_0x3d9b04];return _0x557936;};'use strict';var moment=require(_0x8c39('0x0'));var Sequelize=require(_0x8c39('0x1'));module[_0x8c39('0x2')]={'uniqueid':{'type':Sequelize[_0x8c39('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8c39('0x4')](_0x8c39('0x5'),_0x8c39('0x6'),_0x8c39('0x7')),'allowNull':![],'defaultValue':_0x8c39('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x8c39('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 8929f52..893120c 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 _0x1a37=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','filtears','merge','options','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1a37,0x127));var _0x71a3=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x1a37[_0x2dea24];return _0x309d58;};'use strict';var pdf=require(_0x71a3('0x0'));var emlformat=require(_0x71a3('0x1'));var rimraf=require(_0x71a3('0x2'));var zipdir=require(_0x71a3('0x3'));var jsonpatch=require(_0x71a3('0x4'));var rp=require(_0x71a3('0x5'));var moment=require(_0x71a3('0x6'));var BPromise=require(_0x71a3('0x7'));var Mustache=require(_0x71a3('0x8'));var util=require(_0x71a3('0x9'));var path=require(_0x71a3('0xa'));var sox=require(_0x71a3('0xb'));var csv=require(_0x71a3('0xc'));var ejs=require(_0x71a3('0xd'));var fs=require('fs');var _=require(_0x71a3('0xe'));var squel=require(_0x71a3('0xf'));var crypto=require(_0x71a3('0x10'));var jsforce=require(_0x71a3('0x11'));var deskjs=require(_0x71a3('0x12'));var toCsv=require(_0x71a3('0xc'));var querystring=require('querystring');var Papa=require(_0x71a3('0x13'));var Redis=require(_0x71a3('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x71a3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71a3('0x16'))(_0x71a3('0x17'));var utils=require(_0x71a3('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ed78,_0x928261){_0x928261=_0x928261||0xcc;return function(_0x2ffac5){if(_0x2ffac5){return _0x24ed78[_0x71a3('0x19')](_0x928261);}return _0x24ed78[_0x71a3('0x1a')](_0x928261)[_0x71a3('0x1b')]();};}function respondWithResult(_0x1b24d8,_0x1d1b33){_0x1d1b33=_0x1d1b33||0xc8;return function(_0x1a95ea){if(_0x1a95ea){return _0x1b24d8[_0x71a3('0x1a')](_0x1d1b33)['json'](_0x1a95ea);}};}function respondWithFilteredResult(_0x380434,_0xf31d1e){return function(_0x558073){if(_0x558073){var _0x292afc=_0x558073['count'],_0x29e2fe=_0xf31d1e[_0x71a3('0x1c')],_0xa50624=_0xf31d1e[_0x71a3('0x1c')]+_0xf31d1e[_0x71a3('0x1d')],_0x35c716;if(_0xa50624>=_0x292afc){_0xa50624=_0x292afc;_0x35c716=0xc8;}else{_0x35c716=0xce;}_0x380434[_0x71a3('0x1a')](_0x35c716);return _0x380434[_0x71a3('0x1e')](_0x71a3('0x1f'),_0x29e2fe+'-'+_0xa50624+'/'+_0x292afc)[_0x71a3('0x20')](_0x558073);}return null;};}function patchUpdates(_0x276752){return function(_0x48fee0){try{jsonpatch[_0x71a3('0x21')](_0x48fee0,_0x276752,!![]);}catch(_0x41c124){return BPromise['reject'](_0x41c124);}return _0x48fee0['save']();};}function saveUpdates(_0x523935,_0x113cdd){return function(_0x2a1f92){if(_0x2a1f92){return _0x2a1f92[_0x71a3('0x22')](_0x523935)[_0x71a3('0x23')](function(_0x3ff3a6){return _0x3ff3a6;});}return null;};}function removeEntity(_0x273720,_0x5a193a){return function(_0x6f512a){if(_0x6f512a){return _0x6f512a[_0x71a3('0x24')]()['then'](function(){_0x273720['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bc502,_0x13915d){return function(_0x7b723){if(!_0x7b723){_0x1bc502[_0x71a3('0x19')](0x194);}return _0x7b723;};}function handleError(_0x9c0e29,_0x2aa791){_0x2aa791=_0x2aa791||0x1f4;return function(_0xd94a1f){logger['error'](_0xd94a1f[_0x71a3('0x25')]);if(_0xd94a1f[_0x71a3('0x26')]){delete _0xd94a1f['name'];}_0x9c0e29[_0x71a3('0x1a')](_0x2aa791)[_0x71a3('0x27')](_0xd94a1f);};}exports[_0x71a3('0x28')]=function(_0x2d42d9,_0x5b918b){var _0x3503bc={},_0x559c62={},_0x3a5651={'count':0x0,'rows':[]};var _0x32da2c=_[_0x71a3('0x29')](db[_0x71a3('0x2a')][_0x71a3('0x2b')],function(_0x3744d4){return{'name':_0x3744d4['fieldName'],'type':_0x3744d4[_0x71a3('0x2c')]['key']};});_0x559c62[_0x71a3('0x2d')]=_[_0x71a3('0x29')](_0x32da2c,_0x71a3('0x26'));_0x559c62[_0x71a3('0x2e')]=_[_0x71a3('0x2f')](_0x2d42d9[_0x71a3('0x2e')]);_0x559c62['filters']=_[_0x71a3('0x30')](_0x559c62[_0x71a3('0x2d')],_0x559c62[_0x71a3('0x2e')]);_0x3503bc[_0x71a3('0x31')]=_[_0x71a3('0x30')](_0x559c62[_0x71a3('0x2d')],qs[_0x71a3('0x32')](_0x2d42d9[_0x71a3('0x2e')][_0x71a3('0x32')]));_0x3503bc[_0x71a3('0x31')]=_0x3503bc[_0x71a3('0x31')][_0x71a3('0x33')]?_0x3503bc[_0x71a3('0x31')]:_0x559c62['model'];if(!_0x2d42d9[_0x71a3('0x2e')][_0x71a3('0x34')](_0x71a3('0x35'))){_0x3503bc[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x2d42d9[_0x71a3('0x2e')]['limit']);_0x3503bc[_0x71a3('0x1c')]=qs[_0x71a3('0x1c')](_0x2d42d9[_0x71a3('0x2e')][_0x71a3('0x1c')]);}_0x3503bc[_0x71a3('0x36')]=qs[_0x71a3('0x37')](_0x2d42d9[_0x71a3('0x2e')]['sort']);_0x3503bc[_0x71a3('0x38')]=qs['filters'](_[_0x71a3('0x39')](_0x2d42d9[_0x71a3('0x2e')],_0x559c62[_0x71a3('0x3a')]),_0x32da2c);if(_0x2d42d9[_0x71a3('0x2e')]['filter']){_0x3503bc[_0x71a3('0x38')]=_['merge'](_0x3503bc[_0x71a3('0x38')],{'$or':_[_0x71a3('0x29')](_0x32da2c,function(_0x14f5b3){if(_0x14f5b3[_0x71a3('0x2c')]!==_0x71a3('0x3b')){var _0x427bf8={};_0x427bf8[_0x14f5b3['name']]={'$like':'%'+_0x2d42d9[_0x71a3('0x2e')][_0x71a3('0x3c')]+'%'};return _0x427bf8;}})});}_0x3503bc=_['merge']({},_0x3503bc,_0x2d42d9['options']);var _0x276dad={'where':_0x3503bc[_0x71a3('0x38')]};return db[_0x71a3('0x2a')]['count'](_0x276dad)[_0x71a3('0x23')](function(_0x4b79b8){_0x3a5651[_0x71a3('0x3d')]=_0x4b79b8;if(_0x2d42d9[_0x71a3('0x2e')][_0x71a3('0x3e')]){_0x3503bc[_0x71a3('0x3f')]=[{'all':!![]}];}return db[_0x71a3('0x2a')][_0x71a3('0x40')](_0x3503bc);})[_0x71a3('0x23')](function(_0x2b78cc){_0x3a5651[_0x71a3('0x41')]=_0x2b78cc;return _0x3a5651;})[_0x71a3('0x23')](respondWithFilteredResult(_0x5b918b,_0x3503bc))[_0x71a3('0x42')](handleError(_0x5b918b,null));};exports[_0x71a3('0x43')]=function(_0x4b2761,_0x5736e2){var _0x2ea752={'raw':!![],'where':{'id':_0x4b2761[_0x71a3('0x44')]['id']}},_0x1f6534={};_0x1f6534[_0x71a3('0x2d')]=_[_0x71a3('0x2f')](db[_0x71a3('0x2a')][_0x71a3('0x2b')]);_0x1f6534[_0x71a3('0x2e')]=_['keys'](_0x4b2761[_0x71a3('0x2e')]);_0x1f6534[_0x71a3('0x45')]=_[_0x71a3('0x30')](_0x1f6534[_0x71a3('0x2d')],_0x1f6534[_0x71a3('0x2e')]);_0x2ea752[_0x71a3('0x31')]=_[_0x71a3('0x30')](_0x1f6534[_0x71a3('0x2d')],qs['fields'](_0x4b2761[_0x71a3('0x2e')][_0x71a3('0x32')]));_0x2ea752[_0x71a3('0x31')]=_0x2ea752[_0x71a3('0x31')][_0x71a3('0x33')]?_0x2ea752[_0x71a3('0x31')]:_0x1f6534[_0x71a3('0x2d')];if(_0x4b2761[_0x71a3('0x2e')][_0x71a3('0x3e')]){_0x2ea752[_0x71a3('0x3f')]=[{'all':!![]}];}_0x2ea752=_[_0x71a3('0x46')]({},_0x2ea752,_0x4b2761[_0x71a3('0x47')]);return db[_0x71a3('0x2a')][_0x71a3('0x48')](_0x2ea752)[_0x71a3('0x23')](handleEntityNotFound(_0x5736e2,null))[_0x71a3('0x23')](respondWithResult(_0x5736e2,null))[_0x71a3('0x42')](handleError(_0x5736e2,null));};exports['create']=function(_0x4a6204,_0x5edd7a){return db[_0x71a3('0x2a')]['create'](_0x4a6204[_0x71a3('0x49')],{})[_0x71a3('0x23')](respondWithResult(_0x5edd7a,0xc9))[_0x71a3('0x42')](handleError(_0x5edd7a,null));};exports[_0x71a3('0x22')]=function(_0x11dde8,_0x244319){if(_0x11dde8[_0x71a3('0x49')]['id']){delete _0x11dde8[_0x71a3('0x49')]['id'];}return db['SmsTransferReport'][_0x71a3('0x48')]({'where':{'id':_0x11dde8[_0x71a3('0x44')]['id']}})[_0x71a3('0x23')](handleEntityNotFound(_0x244319,null))[_0x71a3('0x23')](saveUpdates(_0x11dde8[_0x71a3('0x49')],null))[_0x71a3('0x23')](respondWithResult(_0x244319,null))[_0x71a3('0x42')](handleError(_0x244319,null));};exports[_0x71a3('0x24')]=function(_0x202af0,_0x1fc4be){return db[_0x71a3('0x2a')][_0x71a3('0x48')]({'where':{'id':_0x202af0[_0x71a3('0x44')]['id']}})[_0x71a3('0x23')](handleEntityNotFound(_0x1fc4be,null))[_0x71a3('0x23')](removeEntity(_0x1fc4be,null))[_0x71a3('0x42')](handleError(_0x1fc4be,null));};exports['describe']=function(_0x4eb98c,_0xae2d17){return db[_0x71a3('0x2a')][_0x71a3('0x4a')]()[_0x71a3('0x23')](respondWithResult(_0xae2d17,null))[_0x71a3('0x42')](handleError(_0xae2d17,null));}; \ No newline at end of file +var _0xccac=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x377cfd,_0x1e790d){var _0x2cc98e=function(_0x3b780b){while(--_0x3b780b){_0x377cfd['push'](_0x377cfd['shift']());}};_0x2cc98e(++_0x1e790d);}(_0xccac,0x1cb));var _0xccca=function(_0x1fa8a2,_0x5d8012){_0x1fa8a2=_0x1fa8a2-0x0;var _0x42799c=_0xccac[_0x1fa8a2];return _0x42799c;};'use strict';var pdf=require(_0xccca('0x0'));var emlformat=require(_0xccca('0x1'));var rimraf=require(_0xccca('0x2'));var zipdir=require(_0xccca('0x3'));var jsonpatch=require(_0xccca('0x4'));var rp=require(_0xccca('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xccca('0x6'));var util=require('util');var path=require(_0xccca('0x7'));var sox=require(_0xccca('0x8'));var csv=require(_0xccca('0x9'));var ejs=require(_0xccca('0xa'));var fs=require('fs');var _=require(_0xccca('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xccca('0xc'));var deskjs=require(_0xccca('0xd'));var toCsv=require(_0xccca('0x9'));var querystring=require(_0xccca('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xccca('0xf'));var as=require(_0xccca('0x10'));var hardwareService=require(_0xccca('0x11'));var logger=require(_0xccca('0x12'))(_0xccca('0x13'));var utils=require(_0xccca('0x14'));var config=require(_0xccca('0x15'));var licenseUtil=require(_0xccca('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38ff4a,_0x1f2a99){_0x1f2a99=_0x1f2a99||0xcc;return function(_0x27d396){if(_0x27d396){return _0x38ff4a['sendStatus'](_0x1f2a99);}return _0x38ff4a[_0xccca('0x17')](_0x1f2a99)[_0xccca('0x18')]();};}function respondWithResult(_0x1b5567,_0x509f0f){_0x509f0f=_0x509f0f||0xc8;return function(_0x51c1c3){if(_0x51c1c3){return _0x1b5567[_0xccca('0x17')](_0x509f0f)[_0xccca('0x19')](_0x51c1c3);}};}function respondWithFilteredResult(_0x512b97,_0x1a5a89){return function(_0x24e908){if(_0x24e908){var _0x1c6220=_0x24e908['count'],_0x309ade=_0x1a5a89[_0xccca('0x1a')],_0x304d94=_0x1a5a89['offset']+_0x1a5a89[_0xccca('0x1b')],_0x42d1a8;if(_0x304d94>=_0x1c6220){_0x304d94=_0x1c6220;_0x42d1a8=0xc8;}else{_0x42d1a8=0xce;}_0x512b97[_0xccca('0x17')](_0x42d1a8);return _0x512b97['set'](_0xccca('0x1c'),_0x309ade+'-'+_0x304d94+'/'+_0x1c6220)[_0xccca('0x19')](_0x24e908);}return null;};}function patchUpdates(_0x4571fc){return function(_0x31273e){try{jsonpatch['apply'](_0x31273e,_0x4571fc,!![]);}catch(_0x5f4e47){return BPromise[_0xccca('0x1d')](_0x5f4e47);}return _0x31273e[_0xccca('0x1e')]();};}function saveUpdates(_0x42ed1f,_0x21af29){return function(_0x156d33){if(_0x156d33){return _0x156d33[_0xccca('0x1f')](_0x42ed1f)[_0xccca('0x20')](function(_0x2ed378){return _0x2ed378;});}return null;};}function removeEntity(_0x9c3cfb,_0x309339){return function(_0x4632a2){if(_0x4632a2){return _0x4632a2[_0xccca('0x21')]()[_0xccca('0x20')](function(){_0x9c3cfb[_0xccca('0x17')](0xcc)[_0xccca('0x18')]();});}};}function handleEntityNotFound(_0x188bac,_0x396f81){return function(_0x22f916){if(!_0x22f916){_0x188bac['sendStatus'](0x194);}return _0x22f916;};}function handleError(_0x154ae6,_0x549c6b){_0x549c6b=_0x549c6b||0x1f4;return function(_0x2edf05){logger[_0xccca('0x22')](_0x2edf05[_0xccca('0x23')]);if(_0x2edf05[_0xccca('0x24')]){delete _0x2edf05['name'];}_0x154ae6[_0xccca('0x17')](_0x549c6b)[_0xccca('0x25')](_0x2edf05);};}exports['index']=function(_0x3bca3c,_0x118036){var _0x18e953={},_0x26d19a={},_0x2a628d={'count':0x0,'rows':[]};var _0x2f4a83=_['map'](db[_0xccca('0x26')][_0xccca('0x27')],function(_0x6c9739){return{'name':_0x6c9739[_0xccca('0x28')],'type':_0x6c9739[_0xccca('0x29')][_0xccca('0x2a')]};});_0x26d19a[_0xccca('0x2b')]=_['map'](_0x2f4a83,_0xccca('0x24'));_0x26d19a[_0xccca('0x2c')]=_[_0xccca('0x2d')](_0x3bca3c['query']);_0x26d19a[_0xccca('0x2e')]=_[_0xccca('0x2f')](_0x26d19a[_0xccca('0x2b')],_0x26d19a[_0xccca('0x2c')]);_0x18e953[_0xccca('0x30')]=_[_0xccca('0x2f')](_0x26d19a['model'],qs[_0xccca('0x31')](_0x3bca3c[_0xccca('0x2c')][_0xccca('0x31')]));_0x18e953[_0xccca('0x30')]=_0x18e953[_0xccca('0x30')][_0xccca('0x32')]?_0x18e953['attributes']:_0x26d19a[_0xccca('0x2b')];if(!_0x3bca3c[_0xccca('0x2c')][_0xccca('0x33')](_0xccca('0x34'))){_0x18e953['limit']=qs[_0xccca('0x1b')](_0x3bca3c['query']['limit']);_0x18e953[_0xccca('0x1a')]=qs['offset'](_0x3bca3c['query'][_0xccca('0x1a')]);}_0x18e953[_0xccca('0x35')]=qs['sort'](_0x3bca3c[_0xccca('0x2c')][_0xccca('0x36')]);_0x18e953[_0xccca('0x37')]=qs[_0xccca('0x2e')](_[_0xccca('0x38')](_0x3bca3c['query'],_0x26d19a[_0xccca('0x2e')]),_0x2f4a83);if(_0x3bca3c[_0xccca('0x2c')][_0xccca('0x39')]){_0x18e953[_0xccca('0x37')]=_[_0xccca('0x3a')](_0x18e953[_0xccca('0x37')],{'$or':_[_0xccca('0x3b')](_0x2f4a83,function(_0xa1637b){if(_0xa1637b['type']!==_0xccca('0x3c')){var _0x410a9a={};_0x410a9a[_0xa1637b[_0xccca('0x24')]]={'$like':'%'+_0x3bca3c[_0xccca('0x2c')][_0xccca('0x39')]+'%'};return _0x410a9a;}})});}_0x18e953=_[_0xccca('0x3a')]({},_0x18e953,_0x3bca3c[_0xccca('0x3d')]);var _0x22f497={'where':_0x18e953[_0xccca('0x37')]};return db[_0xccca('0x26')]['count'](_0x22f497)[_0xccca('0x20')](function(_0x23eafa){_0x2a628d['count']=_0x23eafa;if(_0x3bca3c[_0xccca('0x2c')]['includeAll']){_0x18e953[_0xccca('0x3e')]=[{'all':!![]}];}return db[_0xccca('0x26')][_0xccca('0x3f')](_0x18e953);})[_0xccca('0x20')](function(_0x4424f2){_0x2a628d[_0xccca('0x40')]=_0x4424f2;return _0x2a628d;})[_0xccca('0x20')](respondWithFilteredResult(_0x118036,_0x18e953))[_0xccca('0x41')](handleError(_0x118036,null));};exports[_0xccca('0x42')]=function(_0x162186,_0x5d1591){var _0x361259={'raw':!![],'where':{'id':_0x162186[_0xccca('0x43')]['id']}},_0x30d1b2={};_0x30d1b2['model']=_[_0xccca('0x2d')](db[_0xccca('0x26')][_0xccca('0x27')]);_0x30d1b2[_0xccca('0x2c')]=_[_0xccca('0x2d')](_0x162186[_0xccca('0x2c')]);_0x30d1b2['filtears']=_['intersection'](_0x30d1b2[_0xccca('0x2b')],_0x30d1b2[_0xccca('0x2c')]);_0x361259[_0xccca('0x30')]=_[_0xccca('0x2f')](_0x30d1b2[_0xccca('0x2b')],qs['fields'](_0x162186[_0xccca('0x2c')][_0xccca('0x31')]));_0x361259['attributes']=_0x361259[_0xccca('0x30')][_0xccca('0x32')]?_0x361259['attributes']:_0x30d1b2[_0xccca('0x2b')];if(_0x162186[_0xccca('0x2c')]['includeAll']){_0x361259[_0xccca('0x3e')]=[{'all':!![]}];}_0x361259=_['merge']({},_0x361259,_0x162186[_0xccca('0x3d')]);return db[_0xccca('0x26')]['find'](_0x361259)[_0xccca('0x20')](handleEntityNotFound(_0x5d1591,null))[_0xccca('0x20')](respondWithResult(_0x5d1591,null))['catch'](handleError(_0x5d1591,null));};exports['create']=function(_0xf3c60,_0x57bd3d){return db[_0xccca('0x26')][_0xccca('0x44')](_0xf3c60[_0xccca('0x45')],{})[_0xccca('0x20')](respondWithResult(_0x57bd3d,0xc9))[_0xccca('0x41')](handleError(_0x57bd3d,null));};exports[_0xccca('0x1f')]=function(_0x241ebe,_0x255333){if(_0x241ebe[_0xccca('0x45')]['id']){delete _0x241ebe[_0xccca('0x45')]['id'];}return db[_0xccca('0x26')][_0xccca('0x46')]({'where':{'id':_0x241ebe[_0xccca('0x43')]['id']}})[_0xccca('0x20')](handleEntityNotFound(_0x255333,null))['then'](saveUpdates(_0x241ebe[_0xccca('0x45')],null))[_0xccca('0x20')](respondWithResult(_0x255333,null))[_0xccca('0x41')](handleError(_0x255333,null));};exports[_0xccca('0x21')]=function(_0x3f874c,_0x5f334b){return db[_0xccca('0x26')]['find']({'where':{'id':_0x3f874c[_0xccca('0x43')]['id']}})[_0xccca('0x20')](handleEntityNotFound(_0x5f334b,null))['then'](removeEntity(_0x5f334b,null))['catch'](handleError(_0x5f334b,null));};exports[_0xccca('0x47')]=function(_0x12ff3c,_0x47f1f3){return db[_0xccca('0x26')][_0xccca('0x47')]()[_0xccca('0x20')](respondWithResult(_0x47f1f3,null))[_0xccca('0x41')](handleError(_0x47f1f3,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e1b61a7..bc866be 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 _0x7b84=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x7b84,0x17c));var _0x47b8=function(_0x448cc4,_0x17b214){_0x448cc4=_0x448cc4-0x0;var _0xe97b06=_0x7b84[_0x448cc4];return _0xe97b06;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[{'name':_0x47b8('0xd'),'fields':[_0x47b8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./smsTransferReport.attributes','exports'];(function(_0x31604a,_0x15363e){var _0x591eb3=function(_0x2bb3b5){while(--_0x2bb3b5){_0x31604a['push'](_0x31604a['shift']());}};_0x591eb3(++_0x15363e);}(_0x2ef3,0xba));var _0x32ef=function(_0x4e3456,_0x11e2ac){_0x4e3456=_0x4e3456-0x0;var _0x5384ed=_0x2ef3[_0x4e3456];return _0x5384ed;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fd84962..865cffd 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 _0x2342=['request','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3ebdea,_0x4d0ea4){var _0x325deb=function(_0x319077){while(--_0x319077){_0x3ebdea['push'](_0x3ebdea['shift']());}};_0x325deb(++_0x4d0ea4);}(_0x2342,0xdf));var _0x2234=function(_0x2cc8a9,_0x4d2c4f){_0x2cc8a9=_0x2cc8a9-0x0;var _0x216d87=_0x2342[_0x2cc8a9];return _0x216d87;};'use strict';var _=require('lodash');var util=require(_0x2234('0x0'));var moment=require(_0x2234('0x1'));var BPromise=require(_0x2234('0x2'));var rs=require(_0x2234('0x3'));var fs=require('fs');var Redis=require(_0x2234('0x4'));var db=require(_0x2234('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2234('0x6'))('rpc');var config=require(_0x2234('0x7'));var jayson=require(_0x2234('0x8'));var client=jayson[_0x2234('0x9')][_0x2234('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43181a,_0x3de78b,_0x3e5197){return new BPromise(function(_0x519100,_0x3c0b6e){return client[_0x2234('0xb')](_0x43181a,_0x3e5197)['then'](function(_0x5469fe){logger[_0x2234('0xc')](_0x2234('0xd'),_0x3de78b,'request\x20sent');logger['debug'](_0x2234('0xe'),_0x3de78b,_0x2234('0xf'),JSON['stringify'](_0x5469fe));if(_0x5469fe[_0x2234('0x10')]){if(_0x5469fe['error']['code']===0x1f4){logger[_0x2234('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3de78b,_0x5469fe[_0x2234('0x10')]['message']);return _0x3c0b6e(_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);}logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x5469fe[_0x2234('0x10')][_0x2234('0x11')]);return _0x519100(_0x5469fe['error'][_0x2234('0x11')]);}else{logger[_0x2234('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x3de78b,'request\x20sent');_0x519100(_0x5469fe['result'][_0x2234('0x11')]);}})['catch'](function(_0x1049f0){logger[_0x2234('0x10')](_0x2234('0xd'),_0x3de78b,_0x1049f0);_0x3c0b6e(_0x1049f0);});});} \ No newline at end of file +var _0xcccd=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2dcada,_0x1d67a4){var _0x5e24d3=function(_0x10ca83){while(--_0x10ca83){_0x2dcada['push'](_0x2dcada['shift']());}};_0x5e24d3(++_0x1d67a4);}(_0xcccd,0xb7));var _0xdccc=function(_0x6148ee,_0x4d2fca){_0x6148ee=_0x6148ee-0x0;var _0x5afc74=_0xcccd[_0x6148ee];return _0x5afc74;};'use strict';var _=require(_0xdccc('0x0'));var util=require('util');var moment=require(_0xdccc('0x1'));var BPromise=require(_0xdccc('0x2'));var rs=require(_0xdccc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdccc('0x4'))['db'];var utils=require(_0xdccc('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdccc('0x6'));var jayson=require(_0xdccc('0x7'));var client=jayson[_0xdccc('0x8')][_0xdccc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55f882,_0xa3094c,_0x193f3d){return new BPromise(function(_0x1b35b3,_0x4275ce){return client[_0xdccc('0xa')](_0x55f882,_0x193f3d)[_0xdccc('0xb')](function(_0x161d37){logger[_0xdccc('0xc')](_0xdccc('0xd'),_0xa3094c,_0xdccc('0xe'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0xa3094c,'request\x20sent',JSON[_0xdccc('0xf')](_0x161d37));if(_0x161d37[_0xdccc('0x10')]){if(_0x161d37[_0xdccc('0x10')]['code']===0x1f4){logger[_0xdccc('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0xa3094c,_0x161d37[_0xdccc('0x10')]['message']);return _0x4275ce(_0x161d37['error'][_0xdccc('0x11')]);}logger[_0xdccc('0x10')](_0xdccc('0xd'),_0xa3094c,_0x161d37[_0xdccc('0x10')][_0xdccc('0x11')]);return _0x1b35b3(_0x161d37[_0xdccc('0x10')][_0xdccc('0x11')]);}else{logger[_0xdccc('0xc')](_0xdccc('0xd'),_0xa3094c,'request\x20sent');_0x1b35b3(_0x161d37[_0xdccc('0x12')][_0xdccc('0x11')]);}})[_0xdccc('0x13')](function(_0x7e6612){logger[_0xdccc('0x10')](_0xdccc('0xd'),_0xa3094c,_0x7e6612);_0x4275ce(_0x7e6612);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0ea3c1e..b0c0843 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 _0x3d8b=['isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','single','file','create','put','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d8b,0x1a9));var _0xb3d8=function(_0x15cae4,_0x4a4676){_0x15cae4=_0x15cae4-0x0;var _0x26f9c9=_0x3d8b[_0x15cae4];return _0x26f9c9;};'use strict';var multer=require(_0xb3d8('0x0'));var util=require(_0xb3d8('0x1'));var path=require('path');var timeout=require(_0xb3d8('0x2'));var express=require(_0xb3d8('0x3'));var router=express[_0xb3d8('0x4')]();var auth=require(_0xb3d8('0x5'));var interaction=require(_0xb3d8('0x6'));var config=require(_0xb3d8('0x7'));var controller=require(_0xb3d8('0x8'));router[_0xb3d8('0x9')]('/',auth[_0xb3d8('0xa')](),controller['index']);router[_0xb3d8('0x9')](_0xb3d8('0xb'),auth[_0xb3d8('0xa')](),controller[_0xb3d8('0xc')]);router[_0xb3d8('0x9')](_0xb3d8('0xd'),auth[_0xb3d8('0xa')](),controller[_0xb3d8('0xe')]);var upload=multer({'storage':multer[_0xb3d8('0xf')]({'destination':function(_0x4ffc8c,_0x2aaa60,_0x14a82b){_0x14a82b(null,path[_0xb3d8('0x10')](config[_0xb3d8('0x11')],_0xb3d8('0x12')));},'filename':function(_0x21e5c8,_0x567499,_0x416e0a){_0x567499[_0xb3d8('0x13')]=_0x567499[_0xb3d8('0x13')][_0xb3d8('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x416e0a(null,util[_0xb3d8('0x15')]('%s-%s%s',path[_0xb3d8('0x16')](_0x567499['originalname'],path[_0xb3d8('0x17')](_0x567499[_0xb3d8('0x13')])),Date['now'](),path[_0xb3d8('0x17')](_0x567499['originalname'])));}})});router['post']('/',upload[_0xb3d8('0x18')](_0xb3d8('0x19')),controller[_0xb3d8('0x1a')]);router[_0xb3d8('0x1b')]('/:id',auth[_0xb3d8('0xa')](),controller['update']);router[_0xb3d8('0x1c')](_0xb3d8('0xb'),auth[_0xb3d8('0xa')](),controller[_0xb3d8('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x6a35=['isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','post','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a35,0x17e));var _0x56a3=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x6a35[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x56a3('0x0'));var util=require(_0x56a3('0x1'));var path=require('path');var timeout=require(_0x56a3('0x2'));var express=require(_0x56a3('0x3'));var router=express[_0x56a3('0x4')]();var auth=require(_0x56a3('0x5'));var interaction=require(_0x56a3('0x6'));var config=require(_0x56a3('0x7'));var controller=require(_0x56a3('0x8'));router[_0x56a3('0x9')]('/',auth[_0x56a3('0xa')](),controller[_0x56a3('0xb')]);router[_0x56a3('0x9')](_0x56a3('0xc'),auth[_0x56a3('0xa')](),controller[_0x56a3('0xd')]);router[_0x56a3('0x9')](_0x56a3('0xe'),auth[_0x56a3('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x56a3('0xf')]({'destination':function(_0xc209b,_0x573cf5,_0x1adbba){_0x1adbba(null,path[_0x56a3('0x10')](config['root'],_0x56a3('0x11')));},'filename':function(_0x4bd902,_0x3b839f,_0x584987){_0x3b839f[_0x56a3('0x12')]=_0x3b839f[_0x56a3('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x584987(null,util[_0x56a3('0x13')](_0x56a3('0x14'),path[_0x56a3('0x15')](_0x3b839f[_0x56a3('0x12')],path[_0x56a3('0x16')](_0x3b839f['originalname'])),Date[_0x56a3('0x17')](),path[_0x56a3('0x16')](_0x3b839f[_0x56a3('0x12')])));}})});router[_0x56a3('0x18')]('/',upload['single']('file'),controller['create']);router[_0x56a3('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x56a3('0x1a')]);router['delete'](_0x56a3('0xc'),auth[_0x56a3('0xa')](),controller['delete']);module[_0x56a3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a7c12d4..671a85e 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 _0x8260=['exports','STRING','name','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x221246,_0x168ceb){var _0x13e1ea=function(_0x17ee22){while(--_0x17ee22){_0x221246['push'](_0x221246['shift']());}};_0x13e1ea(++_0x168ceb);}(_0x8260,0x1b8));var _0x0826=function(_0x2073f8,_0x34a29d){_0x2073f8=_0x2073f8-0x0;var _0x11c069=_0x8260[_0x2073f8];return _0x11c069;};'use strict';var Sequelize=require(_0x0826('0x0'));module[_0x0826('0x1')]={'name':{'type':Sequelize[_0x0826('0x2')],'unique':_0x0826('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x0826('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x0826('0x2')]},'original_duration':{'type':Sequelize[_0x0826('0x4')]},'original_sampleCount':{'type':Sequelize[_0x0826('0x5')]},'original_channelCount':{'type':Sequelize[_0x0826('0x6')]},'original_bitRate':{'type':Sequelize[_0x0826('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x0826('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x0826('0x5')]},'converted_channelCount':{'type':Sequelize[_0x0826('0x6')]},'converted_bitRate':{'type':Sequelize[_0x0826('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x0826('0x6')]}}; \ No newline at end of file +var _0xfa5b=['sequelize','exports','STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x941387,_0x1baf26){var _0x3861e9=function(_0x3dd17b){while(--_0x3dd17b){_0x941387['push'](_0x941387['shift']());}};_0x3861e9(++_0x1baf26);}(_0xfa5b,0x1e3));var _0xbfa5=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0xfa5b[_0x2a55f8];return _0x245efd;};'use strict';var Sequelize=require(_0xbfa5('0x0'));module[_0xbfa5('0x1')]={'name':{'type':Sequelize[_0xbfa5('0x2')],'unique':_0xbfa5('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbfa5('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xbfa5('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xbfa5('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xbfa5('0x5')]},'original_bitRate':{'type':Sequelize[_0xbfa5('0x6')]},'original_sampleRate':{'type':Sequelize[_0xbfa5('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xbfa5('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xbfa5('0x6')]},'converted_channelCount':{'type':Sequelize[_0xbfa5('0x5')]},'converted_bitRate':{'type':Sequelize[_0xbfa5('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xbfa5('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 2cb46e8..28f69f8 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 _0x84f7=['sendStatus','status','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Sounds','UserProfileResource','end','error','stack','name','send','map','Sound','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','format','create','file','extname','originalname','basename','filename','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x84f7,0x1e6));var _0x784f=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x84f7[_0x3b150c];return _0x5cd414;};'use strict';var pdf=require(_0x784f('0x0'));var emlformat=require(_0x784f('0x1'));var rimraf=require(_0x784f('0x2'));var zipdir=require(_0x784f('0x3'));var jsonpatch=require(_0x784f('0x4'));var rp=require(_0x784f('0x5'));var moment=require(_0x784f('0x6'));var BPromise=require(_0x784f('0x7'));var Mustache=require('mustache');var util=require(_0x784f('0x8'));var path=require(_0x784f('0x9'));var sox=require(_0x784f('0xa'));var csv=require(_0x784f('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x784f('0xc'));var jsforce=require(_0x784f('0xd'));var deskjs=require(_0x784f('0xe'));var toCsv=require(_0x784f('0xb'));var querystring=require(_0x784f('0xf'));var Papa=require(_0x784f('0x10'));var Redis=require(_0x784f('0x11'));var authService=require(_0x784f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x784f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x784f('0x14'))(_0x784f('0x15'));var utils=require(_0x784f('0x16'));var config=require(_0x784f('0x17'));var licenseUtil=require(_0x784f('0x18'));var db=require(_0x784f('0x19'))['db'];function respondWithStatusCode(_0x4c58a4,_0x12ba16){_0x12ba16=_0x12ba16||0xcc;return function(_0x49f29b){if(_0x49f29b){return _0x4c58a4[_0x784f('0x1a')](_0x12ba16);}return _0x4c58a4[_0x784f('0x1b')](_0x12ba16)['end']();};}function respondWithResult(_0x4b9217,_0x1e3eaa){_0x1e3eaa=_0x1e3eaa||0xc8;return function(_0xc0c2bd){if(_0xc0c2bd){return _0x4b9217[_0x784f('0x1b')](_0x1e3eaa)['json'](_0xc0c2bd);}};}function respondWithFilteredResult(_0x22ef38,_0x3af0b2){return function(_0x43af1c){if(_0x43af1c){var _0x3bbd66=_0x43af1c[_0x784f('0x1c')],_0x416a0a=_0x3af0b2[_0x784f('0x1d')],_0x4dc0e9=_0x3af0b2['offset']+_0x3af0b2['limit'],_0x237d7e;if(_0x4dc0e9>=_0x3bbd66){_0x4dc0e9=_0x3bbd66;_0x237d7e=0xc8;}else{_0x237d7e=0xce;}_0x22ef38['status'](_0x237d7e);return _0x22ef38['set'](_0x784f('0x1e'),_0x416a0a+'-'+_0x4dc0e9+'/'+_0x3bbd66)[_0x784f('0x1f')](_0x43af1c);}return null;};}function patchUpdates(_0x5b5ea1){return function(_0x3b3b07){try{jsonpatch['apply'](_0x3b3b07,_0x5b5ea1,!![]);}catch(_0x4d2599){return BPromise[_0x784f('0x20')](_0x4d2599);}return _0x3b3b07[_0x784f('0x21')]();};}function saveUpdates(_0x544e21,_0x5a34fe){return function(_0x96e8e7){if(_0x96e8e7){return _0x96e8e7[_0x784f('0x22')](_0x544e21)[_0x784f('0x23')](function(_0xb10174){return _0xb10174;});}return null;};}function removeEntity(_0x1185af,_0x126367){return function(_0x214f70){if(_0x214f70){return _0x214f70[_0x784f('0x24')]()['then'](function(){var _0x50d692=_0x214f70[_0x784f('0x25')]({'plain':!![]});var _0x43c7a2=_0x784f('0x26');return db[_0x784f('0x27')]['destroy']({'where':{'type':_0x43c7a2,'resourceId':_0x50d692['id']}})[_0x784f('0x23')](function(){return _0x214f70;});})[_0x784f('0x23')](function(){_0x1185af['status'](0xcc)[_0x784f('0x28')]();});}};}function handleEntityNotFound(_0x296176,_0x470527){return function(_0x472e65){if(!_0x472e65){_0x296176[_0x784f('0x1a')](0x194);}return _0x472e65;};}function handleError(_0x4b3296,_0x68bb07){_0x68bb07=_0x68bb07||0x1f4;return function(_0x18496c){logger[_0x784f('0x29')](_0x18496c[_0x784f('0x2a')]);if(_0x18496c[_0x784f('0x2b')]){delete _0x18496c[_0x784f('0x2b')];}_0x4b3296['status'](_0x68bb07)[_0x784f('0x2c')](_0x18496c);};}exports['index']=function(_0x38df0c,_0x17f662){var _0x56c49e={},_0x23c5b2={},_0x4d7c0d={'count':0x0,'rows':[]};var _0x2ab21a=_[_0x784f('0x2d')](db[_0x784f('0x2e')][_0x784f('0x2f')],function(_0x147810){return{'name':_0x147810[_0x784f('0x30')],'type':_0x147810['type'][_0x784f('0x31')]};});_0x23c5b2[_0x784f('0x32')]=_[_0x784f('0x2d')](_0x2ab21a,_0x784f('0x2b'));_0x23c5b2[_0x784f('0x33')]=_[_0x784f('0x34')](_0x38df0c[_0x784f('0x33')]);_0x23c5b2[_0x784f('0x35')]=_[_0x784f('0x36')](_0x23c5b2['model'],_0x23c5b2[_0x784f('0x33')]);_0x56c49e[_0x784f('0x37')]=_[_0x784f('0x36')](_0x23c5b2[_0x784f('0x32')],qs[_0x784f('0x38')](_0x38df0c['query'][_0x784f('0x38')]));_0x56c49e['attributes']=_0x56c49e[_0x784f('0x37')][_0x784f('0x39')]?_0x56c49e[_0x784f('0x37')]:_0x23c5b2[_0x784f('0x32')];if(!_0x38df0c[_0x784f('0x33')][_0x784f('0x3a')](_0x784f('0x3b'))){_0x56c49e['limit']=qs[_0x784f('0x3c')](_0x38df0c[_0x784f('0x33')][_0x784f('0x3c')]);_0x56c49e[_0x784f('0x1d')]=qs['offset'](_0x38df0c[_0x784f('0x33')][_0x784f('0x1d')]);}_0x56c49e[_0x784f('0x3d')]=qs['sort'](_0x38df0c[_0x784f('0x33')][_0x784f('0x3e')]);_0x56c49e[_0x784f('0x3f')]=qs['filters'](_[_0x784f('0x40')](_0x38df0c[_0x784f('0x33')],_0x23c5b2['filters']),_0x2ab21a);if(_0x38df0c['query'][_0x784f('0x41')]){_0x56c49e[_0x784f('0x3f')]=_[_0x784f('0x42')](_0x56c49e[_0x784f('0x3f')],{'$or':_[_0x784f('0x2d')](_0x2ab21a,function(_0x31c47d){if(_0x31c47d[_0x784f('0x43')]!==_0x784f('0x44')){var _0x2842ef={};_0x2842ef[_0x31c47d[_0x784f('0x2b')]]={'$like':'%'+_0x38df0c[_0x784f('0x33')]['filter']+'%'};return _0x2842ef;}})});}_0x56c49e=_[_0x784f('0x42')]({},_0x56c49e,_0x38df0c[_0x784f('0x45')]);var _0x5635c3={'where':_0x56c49e[_0x784f('0x3f')]};return db[_0x784f('0x2e')][_0x784f('0x1c')](_0x5635c3)[_0x784f('0x23')](function(_0x4d8160){_0x4d7c0d[_0x784f('0x1c')]=_0x4d8160;if(_0x38df0c[_0x784f('0x33')][_0x784f('0x46')]){_0x56c49e[_0x784f('0x47')]=[{'all':!![]}];}return db[_0x784f('0x2e')][_0x784f('0x48')](_0x56c49e);})['then'](function(_0x128344){_0x4d7c0d[_0x784f('0x49')]=_0x128344;return _0x4d7c0d;})['then'](respondWithFilteredResult(_0x17f662,_0x56c49e))[_0x784f('0x4a')](handleError(_0x17f662,null));};exports[_0x784f('0x4b')]=function(_0x4a3d46,_0x48de1d){var _0x38ef87={'raw':!![],'where':{'id':_0x4a3d46[_0x784f('0x4c')]['id']}},_0x74dca8={};_0x74dca8[_0x784f('0x32')]=_['keys'](db[_0x784f('0x2e')][_0x784f('0x2f')]);_0x74dca8['query']=_[_0x784f('0x34')](_0x4a3d46[_0x784f('0x33')]);_0x74dca8[_0x784f('0x4d')]=_[_0x784f('0x36')](_0x74dca8[_0x784f('0x32')],_0x74dca8[_0x784f('0x33')]);_0x38ef87['attributes']=_['intersection'](_0x74dca8[_0x784f('0x32')],qs[_0x784f('0x38')](_0x4a3d46['query']['fields']));_0x38ef87[_0x784f('0x37')]=_0x38ef87[_0x784f('0x37')][_0x784f('0x39')]?_0x38ef87[_0x784f('0x37')]:_0x74dca8['model'];if(_0x4a3d46[_0x784f('0x33')][_0x784f('0x46')]){_0x38ef87['include']=[{'all':!![]}];}_0x38ef87=_[_0x784f('0x42')]({},_0x38ef87,_0x4a3d46[_0x784f('0x45')]);return db['Sound'][_0x784f('0x4e')](_0x38ef87)['then'](handleEntityNotFound(_0x48de1d,null))[_0x784f('0x23')](respondWithResult(_0x48de1d,null))[_0x784f('0x4a')](handleError(_0x48de1d,null));};exports[_0x784f('0x4f')]=function(_0x419e26,_0x1b10ca,_0xbb1758){return db[_0x784f('0x2e')][_0x784f('0x4e')]({'where':{'id':_0x419e26[_0x784f('0x4c')]['id']},'attributes':[_0x784f('0x2b'),_0x784f('0x50'),'converted_format'],'raw':!![]})[_0x784f('0x23')](handleEntityNotFound(_0x1b10ca,null))[_0x784f('0x23')](function(_0x5d69d5){if(_0x5d69d5){if(!fs[_0x784f('0x51')](path[_0x784f('0x52')](config[_0x784f('0x53')],_0x784f('0x54'),_0x5d69d5['save_name']+'.'+_0x5d69d5[_0x784f('0x55')]))){throw new db['Sequelize'][(_0x784f('0x56'))](_0x784f('0x57'));}return _0x1b10ca[_0x784f('0x4f')](path[_0x784f('0x52')](config[_0x784f('0x53')],_0x784f('0x54'),util['format']('%s.%s',_0x5d69d5['save_name'],_0x5d69d5['converted_format'])),util[_0x784f('0x58')]('%s.%s',_0x5d69d5['name'],_0x5d69d5[_0x784f('0x55')]));}return null;})[_0x784f('0x4a')](handleError(_0x1b10ca,null));};exports[_0x784f('0x59')]=function(_0x3ee321,_0x5047b1,_0x166e80){var _0xdbeae9={'name':path['basename'](_0x3ee321[_0x784f('0x5a')]['originalname'],path[_0x784f('0x5b')](_0x3ee321['file'][_0x784f('0x5c')])),'save_name':path[_0x784f('0x5d')](_0x3ee321['file'][_0x784f('0x5e')],path[_0x784f('0x5b')](_0x3ee321[_0x784f('0x5a')]['filename'])),'original_format':path[_0x784f('0x5b')](_0x3ee321[_0x784f('0x5a')][_0x784f('0x5c')])[_0x784f('0x5f')](0x1),'converted_format':_0x784f('0x60')};var _0x4da9ca=path[_0x784f('0x52')](config[_0x784f('0x53')],_0x784f('0x61'),_0x3ee321[_0x784f('0x5a')][_0x784f('0x5e')]);var _0x4dfbb5=path[_0x784f('0x52')](config[_0x784f('0x53')],'server/files/sounds/converted',util[_0x784f('0x58')](_0x784f('0x62'),path[_0x784f('0x5d')](_0x3ee321[_0x784f('0x5a')][_0x784f('0x5e')],path[_0x784f('0x5b')](_0x3ee321[_0x784f('0x5a')][_0x784f('0x5e')])),_0xdbeae9['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x4da9ca);logger[_0x784f('0x63')](_0x784f('0x64'),_0x4dfbb5);try{fs[_0x784f('0x65')](_0x4da9ca,parseInt(_0x784f('0x66'),0x8));var _0x48c0c3=sox[_0x784f('0x67')](_0x4da9ca,_0x4dfbb5,{'sampleRate':0x1f40,'format':_0x784f('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x48c0c3['on'](_0x784f('0x29'),function(_0x35005d){fs[_0x784f('0x68')](_0x4da9ca);_0x5047b1[_0x784f('0x1b')](0x1f4)[_0x784f('0x2c')](_0x35005d);});_0x48c0c3['on'](_0x784f('0x69'),function(_0x4aab2f){_0xdbeae9[_0x784f('0x6a')]=isNaN(_0x4aab2f[_0x784f('0x6b')])?null:_0x4aab2f[_0x784f('0x6b')]*0x3e8;_0xdbeae9['original_sampleCount']=isNaN(_0x4aab2f['sampleCount'])?null:_0x4aab2f[_0x784f('0x6c')];_0xdbeae9['original_channelCount']=isNaN(_0x4aab2f['channelCount'])?null:_0x4aab2f[_0x784f('0x6d')];_0xdbeae9[_0x784f('0x6e')]=isNaN(_0x4aab2f[_0x784f('0x6f')])?null:_0x4aab2f['bitRate'];_0xdbeae9['original_sampleRate']=isNaN(_0x4aab2f[_0x784f('0x70')])?null:_0x4aab2f['sampleRate'];});_0x48c0c3['on']('dest',function(_0x56f730){_0xdbeae9[_0x784f('0x71')]=isNaN(_0x56f730['duration'])?null:_0x56f730[_0x784f('0x6b')]*0x3e8;_0xdbeae9[_0x784f('0x72')]=isNaN(_0x56f730[_0x784f('0x6c')])?null:_0x56f730[_0x784f('0x6c')];_0xdbeae9[_0x784f('0x73')]=isNaN(_0x56f730[_0x784f('0x6d')])?null:_0x56f730['channelCount'];_0xdbeae9[_0x784f('0x74')]=isNaN(_0x56f730[_0x784f('0x6f')])?null:_0x56f730[_0x784f('0x6f')];_0xdbeae9[_0x784f('0x75')]=isNaN(_0x56f730['sampleRate'])?null:_0x56f730[_0x784f('0x70')];});_0x48c0c3['on']('end',function(){fs[_0x784f('0x65')](_0x4dfbb5,parseInt(_0x784f('0x66'),0x8));return db[_0x784f('0x2e')]['create'](_0xdbeae9)['then'](function(_0x101b41){var _0x36c72b={'role':_0x3ee321[_0x784f('0x76')][_0x784f('0x77')],'userProfileId':_0x3ee321['body']['userProfileId']};if(!_0x36c72b)throw new Error(_0x784f('0x78'));if(_0x36c72b[_0x784f('0x77')]===_0x784f('0x79')){var _0x28bc42=_0x101b41[_0x784f('0x25')]({'plain':!![]});return db[_0x784f('0x7a')][_0x784f('0x4e')]({'where':{'name':_0x784f('0x26'),'userProfileId':_0x36c72b['userProfileId']},'raw':!![]})[_0x784f('0x23')](function(_0x17e9a5){if(_0x17e9a5&&_0x17e9a5[_0x784f('0x7b')]===0x0){return db[_0x784f('0x27')][_0x784f('0x59')]({'name':_0x28bc42[_0x784f('0x2b')],'resourceId':_0x28bc42['id'],'type':_0x17e9a5[_0x784f('0x2b')],'sectionId':_0x17e9a5['id']},{})[_0x784f('0x23')](function(){return _0x101b41;});}else{return _0x101b41;}})[_0x784f('0x4a')](function(_0x58689c){logger['error'](_0x784f('0x7c'),_0x58689c);throw _0x58689c;});}return _0x101b41;})[_0x784f('0x23')](respondWithResult(_0x5047b1,null))[_0x784f('0x4a')](handleError(_0x5047b1,null));});_0x48c0c3['start']();}catch(_0x51e13b){_0x5047b1[_0x784f('0x1b')](0x1f4)[_0x784f('0x2c')](_0x51e13b);}};exports[_0x784f('0x22')]=function(_0x25acc6,_0x588dd3,_0x499d12){return db[_0x784f('0x2e')][_0x784f('0x4e')]({'where':{'id':_0x25acc6['params']['id']}})[_0x784f('0x23')](handleEntityNotFound(_0x588dd3,null))[_0x784f('0x23')](saveUpdates(_[_0x784f('0x40')](_0x25acc6[_0x784f('0x76')],['name',_0x784f('0x7d')]),null))[_0x784f('0x23')](respondWithResult(_0x588dd3,null))[_0x784f('0x4a')](handleError(_0x588dd3,null));};exports[_0x784f('0x7e')]=function(_0x3e2488,_0x485f4e,_0x354876){return db[_0x784f('0x2e')]['find']({'where':{'id':_0x3e2488[_0x784f('0x4c')]['id']}})[_0x784f('0x23')](function(_0x404519){if(_0x404519){return _0x404519[_0x784f('0x24')]();}})['then'](function(_0xbaf85f){var _0x2e1e9b=path['join'](config['root'],'server/files/sounds/original',util['format'](_0x784f('0x62'),_0xbaf85f[_0x784f('0x50')],_0xbaf85f[_0x784f('0x7f')]));var _0x44a4a2=path[_0x784f('0x52')](config[_0x784f('0x53')],'server/files/sounds/converted',util['format'](_0x784f('0x62'),_0xbaf85f[_0x784f('0x50')],_0xbaf85f['converted_format']));fs[_0x784f('0x68')](_0x2e1e9b);fs[_0x784f('0x68')](_0x44a4a2);return _0xbaf85f;})[_0x784f('0x23')](function(_0x3a4659){if(_0x3a4659){return _0x485f4e[_0x784f('0x1b')](0xcc)['end']();}})[_0x784f('0x23')](handleEntityNotFound(_0x485f4e,null))[_0x784f('0x4a')](handleError(_0x485f4e,null));}; \ No newline at end of file +var _0x3aba=['save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','description','delete','original_format','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','stack','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','name','merge','options','includeAll','rows','catch','show','params','filtears','include','find'];(function(_0x547ff4,_0x416fa1){var _0xe41057=function(_0x1afe63){while(--_0x1afe63){_0x547ff4['push'](_0x547ff4['shift']());}};_0xe41057(++_0x416fa1);}(_0x3aba,0xb3));var _0xa3ab=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x3aba[_0x45bf86];return _0x1f02b7;};'use strict';var pdf=require(_0xa3ab('0x0'));var emlformat=require(_0xa3ab('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa3ab('0x2'));var rp=require(_0xa3ab('0x3'));var moment=require(_0xa3ab('0x4'));var BPromise=require(_0xa3ab('0x5'));var Mustache=require(_0xa3ab('0x6'));var util=require(_0xa3ab('0x7'));var path=require('path');var sox=require(_0xa3ab('0x8'));var csv=require('to-csv');var ejs=require(_0xa3ab('0x9'));var fs=require('fs');var _=require(_0xa3ab('0xa'));var squel=require(_0xa3ab('0xb'));var crypto=require('crypto');var jsforce=require(_0xa3ab('0xc'));var deskjs=require(_0xa3ab('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa3ab('0xe'));var Redis=require(_0xa3ab('0xf'));var authService=require(_0xa3ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3ab('0x11'));var logger=require(_0xa3ab('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa3ab('0x13'));var licenseUtil=require(_0xa3ab('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a130b,_0x512fd7){_0x512fd7=_0x512fd7||0xcc;return function(_0x271246){if(_0x271246){return _0x3a130b['sendStatus'](_0x512fd7);}return _0x3a130b[_0xa3ab('0x15')](_0x512fd7)[_0xa3ab('0x16')]();};}function respondWithResult(_0x4f549b,_0x297914){_0x297914=_0x297914||0xc8;return function(_0x56850d){if(_0x56850d){return _0x4f549b['status'](_0x297914)[_0xa3ab('0x17')](_0x56850d);}};}function respondWithFilteredResult(_0x1c6c74,_0x5d0f8b){return function(_0x1d65ab){if(_0x1d65ab){var _0x4cda49=_0x1d65ab[_0xa3ab('0x18')],_0x2fde14=_0x5d0f8b[_0xa3ab('0x19')],_0x5410b0=_0x5d0f8b[_0xa3ab('0x19')]+_0x5d0f8b[_0xa3ab('0x1a')],_0x535afe;if(_0x5410b0>=_0x4cda49){_0x5410b0=_0x4cda49;_0x535afe=0xc8;}else{_0x535afe=0xce;}_0x1c6c74[_0xa3ab('0x15')](_0x535afe);return _0x1c6c74[_0xa3ab('0x1b')](_0xa3ab('0x1c'),_0x2fde14+'-'+_0x5410b0+'/'+_0x4cda49)[_0xa3ab('0x17')](_0x1d65ab);}return null;};}function patchUpdates(_0x3c4f94){return function(_0x29d6ba){try{jsonpatch[_0xa3ab('0x1d')](_0x29d6ba,_0x3c4f94,!![]);}catch(_0x24e1e4){return BPromise[_0xa3ab('0x1e')](_0x24e1e4);}return _0x29d6ba[_0xa3ab('0x1f')]();};}function saveUpdates(_0x4ed262,_0x3c0313){return function(_0x83e5cd){if(_0x83e5cd){return _0x83e5cd[_0xa3ab('0x20')](_0x4ed262)[_0xa3ab('0x21')](function(_0x21356f){return _0x21356f;});}return null;};}function removeEntity(_0x24cee3,_0x40f819){return function(_0x5490b5){if(_0x5490b5){return _0x5490b5[_0xa3ab('0x22')]()[_0xa3ab('0x21')](function(){var _0x5aad2d=_0x5490b5[_0xa3ab('0x23')]({'plain':!![]});var _0x3ccc6a=_0xa3ab('0x24');return db[_0xa3ab('0x25')][_0xa3ab('0x22')]({'where':{'type':_0x3ccc6a,'resourceId':_0x5aad2d['id']}})[_0xa3ab('0x21')](function(){return _0x5490b5;});})[_0xa3ab('0x21')](function(){_0x24cee3['status'](0xcc)[_0xa3ab('0x16')]();});}};}function handleEntityNotFound(_0x2e967b,_0x19e650){return function(_0x343504){if(!_0x343504){_0x2e967b[_0xa3ab('0x26')](0x194);}return _0x343504;};}function handleError(_0x39c721,_0x4840f0){_0x4840f0=_0x4840f0||0x1f4;return function(_0x221af5){logger[_0xa3ab('0x27')](_0x221af5[_0xa3ab('0x28')]);if(_0x221af5['name']){delete _0x221af5['name'];}_0x39c721['status'](_0x4840f0)[_0xa3ab('0x29')](_0x221af5);};}exports[_0xa3ab('0x2a')]=function(_0x2e3517,_0x3b6f04){var _0x59f797={},_0x32d149={},_0x1c75c9={'count':0x0,'rows':[]};var _0x1e7e13=_[_0xa3ab('0x2b')](db[_0xa3ab('0x2c')][_0xa3ab('0x2d')],function(_0x24cf65){return{'name':_0x24cf65[_0xa3ab('0x2e')],'type':_0x24cf65[_0xa3ab('0x2f')][_0xa3ab('0x30')]};});_0x32d149[_0xa3ab('0x31')]=_['map'](_0x1e7e13,'name');_0x32d149[_0xa3ab('0x32')]=_[_0xa3ab('0x33')](_0x2e3517[_0xa3ab('0x32')]);_0x32d149['filters']=_[_0xa3ab('0x34')](_0x32d149[_0xa3ab('0x31')],_0x32d149[_0xa3ab('0x32')]);_0x59f797[_0xa3ab('0x35')]=_['intersection'](_0x32d149[_0xa3ab('0x31')],qs['fields'](_0x2e3517[_0xa3ab('0x32')][_0xa3ab('0x36')]));_0x59f797[_0xa3ab('0x35')]=_0x59f797['attributes'][_0xa3ab('0x37')]?_0x59f797[_0xa3ab('0x35')]:_0x32d149[_0xa3ab('0x31')];if(!_0x2e3517[_0xa3ab('0x32')][_0xa3ab('0x38')](_0xa3ab('0x39'))){_0x59f797['limit']=qs[_0xa3ab('0x1a')](_0x2e3517[_0xa3ab('0x32')][_0xa3ab('0x1a')]);_0x59f797[_0xa3ab('0x19')]=qs['offset'](_0x2e3517['query']['offset']);}_0x59f797[_0xa3ab('0x3a')]=qs[_0xa3ab('0x3b')](_0x2e3517[_0xa3ab('0x32')]['sort']);_0x59f797[_0xa3ab('0x3c')]=qs[_0xa3ab('0x3d')](_['pick'](_0x2e3517['query'],_0x32d149[_0xa3ab('0x3d')]),_0x1e7e13);if(_0x2e3517[_0xa3ab('0x32')][_0xa3ab('0x3e')]){_0x59f797['where']=_['merge'](_0x59f797[_0xa3ab('0x3c')],{'$or':_[_0xa3ab('0x2b')](_0x1e7e13,function(_0x128216){if(_0x128216['type']!==_0xa3ab('0x3f')){var _0xa63672={};_0xa63672[_0x128216[_0xa3ab('0x40')]]={'$like':'%'+_0x2e3517[_0xa3ab('0x32')]['filter']+'%'};return _0xa63672;}})});}_0x59f797=_[_0xa3ab('0x41')]({},_0x59f797,_0x2e3517[_0xa3ab('0x42')]);var _0x1bec09={'where':_0x59f797['where']};return db['Sound']['count'](_0x1bec09)[_0xa3ab('0x21')](function(_0x46f0b4){_0x1c75c9[_0xa3ab('0x18')]=_0x46f0b4;if(_0x2e3517[_0xa3ab('0x32')][_0xa3ab('0x43')]){_0x59f797['include']=[{'all':!![]}];}return db[_0xa3ab('0x2c')]['findAll'](_0x59f797);})[_0xa3ab('0x21')](function(_0x56f85b){_0x1c75c9[_0xa3ab('0x44')]=_0x56f85b;return _0x1c75c9;})[_0xa3ab('0x21')](respondWithFilteredResult(_0x3b6f04,_0x59f797))[_0xa3ab('0x45')](handleError(_0x3b6f04,null));};exports[_0xa3ab('0x46')]=function(_0x421cfa,_0x26fb27){var _0x2f325c={'raw':!![],'where':{'id':_0x421cfa[_0xa3ab('0x47')]['id']}},_0x39b29a={};_0x39b29a[_0xa3ab('0x31')]=_[_0xa3ab('0x33')](db['Sound'][_0xa3ab('0x2d')]);_0x39b29a[_0xa3ab('0x32')]=_[_0xa3ab('0x33')](_0x421cfa[_0xa3ab('0x32')]);_0x39b29a[_0xa3ab('0x48')]=_[_0xa3ab('0x34')](_0x39b29a['model'],_0x39b29a['query']);_0x2f325c[_0xa3ab('0x35')]=_[_0xa3ab('0x34')](_0x39b29a[_0xa3ab('0x31')],qs['fields'](_0x421cfa[_0xa3ab('0x32')]['fields']));_0x2f325c['attributes']=_0x2f325c[_0xa3ab('0x35')][_0xa3ab('0x37')]?_0x2f325c['attributes']:_0x39b29a[_0xa3ab('0x31')];if(_0x421cfa['query'][_0xa3ab('0x43')]){_0x2f325c[_0xa3ab('0x49')]=[{'all':!![]}];}_0x2f325c=_['merge']({},_0x2f325c,_0x421cfa[_0xa3ab('0x42')]);return db[_0xa3ab('0x2c')][_0xa3ab('0x4a')](_0x2f325c)[_0xa3ab('0x21')](handleEntityNotFound(_0x26fb27,null))['then'](respondWithResult(_0x26fb27,null))[_0xa3ab('0x45')](handleError(_0x26fb27,null));};exports['download']=function(_0x38e9e9,_0x1e4b9b,_0x1c4d3a){return db['Sound'][_0xa3ab('0x4a')]({'where':{'id':_0x38e9e9['params']['id']},'attributes':[_0xa3ab('0x40'),_0xa3ab('0x4b'),_0xa3ab('0x4c')],'raw':!![]})[_0xa3ab('0x21')](handleEntityNotFound(_0x1e4b9b,null))[_0xa3ab('0x21')](function(_0x2d55a2){if(_0x2d55a2){if(!fs[_0xa3ab('0x4d')](path[_0xa3ab('0x4e')](config['root'],_0xa3ab('0x4f'),_0x2d55a2[_0xa3ab('0x4b')]+'.'+_0x2d55a2[_0xa3ab('0x4c')]))){throw new db[(_0xa3ab('0x50'))]['ValidationError'](_0xa3ab('0x51'));}return _0x1e4b9b[_0xa3ab('0x52')](path[_0xa3ab('0x4e')](config[_0xa3ab('0x53')],_0xa3ab('0x4f'),util[_0xa3ab('0x54')](_0xa3ab('0x55'),_0x2d55a2['save_name'],_0x2d55a2[_0xa3ab('0x4c')])),util[_0xa3ab('0x54')](_0xa3ab('0x55'),_0x2d55a2[_0xa3ab('0x40')],_0x2d55a2[_0xa3ab('0x4c')]));}return null;})[_0xa3ab('0x45')](handleError(_0x1e4b9b,null));};exports[_0xa3ab('0x56')]=function(_0xdc0812,_0x3269c5,_0x49f8d0){var _0x584a1b={'name':path[_0xa3ab('0x57')](_0xdc0812[_0xa3ab('0x58')][_0xa3ab('0x59')],path['extname'](_0xdc0812['file']['originalname'])),'save_name':path[_0xa3ab('0x57')](_0xdc0812[_0xa3ab('0x58')]['filename'],path[_0xa3ab('0x5a')](_0xdc0812['file'][_0xa3ab('0x5b')])),'original_format':path[_0xa3ab('0x5a')](_0xdc0812['file'][_0xa3ab('0x59')])[_0xa3ab('0x5c')](0x1),'converted_format':_0xa3ab('0x5d')};var _0x333e23=path['join'](config[_0xa3ab('0x53')],_0xa3ab('0x5e'),_0xdc0812[_0xa3ab('0x58')][_0xa3ab('0x5b')]);var _0x533fee=path['join'](config['root'],_0xa3ab('0x4f'),util[_0xa3ab('0x54')](_0xa3ab('0x55'),path[_0xa3ab('0x57')](_0xdc0812[_0xa3ab('0x58')]['filename'],path['extname'](_0xdc0812['file'][_0xa3ab('0x5b')])),_0x584a1b[_0xa3ab('0x4c')]));logger['info'](_0xa3ab('0x5f'),_0x333e23);logger[_0xa3ab('0x60')](_0xa3ab('0x61'),_0x533fee);try{fs[_0xa3ab('0x62')](_0x333e23,parseInt('0777',0x8));var _0x321324=sox[_0xa3ab('0x63')](_0x333e23,_0x533fee,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x321324['on'](_0xa3ab('0x27'),function(_0x464eb2){fs[_0xa3ab('0x64')](_0x333e23);_0x3269c5[_0xa3ab('0x15')](0x1f4)[_0xa3ab('0x29')](_0x464eb2);});_0x321324['on'](_0xa3ab('0x65'),function(_0x12f936){_0x584a1b[_0xa3ab('0x66')]=isNaN(_0x12f936[_0xa3ab('0x67')])?null:_0x12f936[_0xa3ab('0x67')]*0x3e8;_0x584a1b['original_sampleCount']=isNaN(_0x12f936['sampleCount'])?null:_0x12f936['sampleCount'];_0x584a1b[_0xa3ab('0x68')]=isNaN(_0x12f936['channelCount'])?null:_0x12f936[_0xa3ab('0x69')];_0x584a1b['original_bitRate']=isNaN(_0x12f936[_0xa3ab('0x6a')])?null:_0x12f936[_0xa3ab('0x6a')];_0x584a1b[_0xa3ab('0x6b')]=isNaN(_0x12f936['sampleRate'])?null:_0x12f936[_0xa3ab('0x6c')];});_0x321324['on'](_0xa3ab('0x6d'),function(_0x5e54cf){_0x584a1b[_0xa3ab('0x6e')]=isNaN(_0x5e54cf[_0xa3ab('0x67')])?null:_0x5e54cf[_0xa3ab('0x67')]*0x3e8;_0x584a1b[_0xa3ab('0x6f')]=isNaN(_0x5e54cf[_0xa3ab('0x70')])?null:_0x5e54cf[_0xa3ab('0x70')];_0x584a1b[_0xa3ab('0x71')]=isNaN(_0x5e54cf['channelCount'])?null:_0x5e54cf['channelCount'];_0x584a1b[_0xa3ab('0x72')]=isNaN(_0x5e54cf['bitRate'])?null:_0x5e54cf[_0xa3ab('0x6a')];_0x584a1b[_0xa3ab('0x73')]=isNaN(_0x5e54cf[_0xa3ab('0x6c')])?null:_0x5e54cf['sampleRate'];});_0x321324['on'](_0xa3ab('0x16'),function(){fs['chmodSync'](_0x533fee,parseInt('0777',0x8));return db['Sound'][_0xa3ab('0x56')](_0x584a1b)[_0xa3ab('0x21')](function(_0xe989b6){var _0x33ada2={'role':_0xdc0812[_0xa3ab('0x74')][_0xa3ab('0x75')],'userProfileId':_0xdc0812[_0xa3ab('0x74')][_0xa3ab('0x76')]};if(!_0x33ada2)throw new Error(_0xa3ab('0x77'));if(_0x33ada2[_0xa3ab('0x75')]===_0xa3ab('0x78')){var _0x5742b8=_0xe989b6[_0xa3ab('0x23')]({'plain':!![]});return db[_0xa3ab('0x79')][_0xa3ab('0x4a')]({'where':{'name':_0xa3ab('0x24'),'userProfileId':_0x33ada2[_0xa3ab('0x76')]},'raw':!![]})['then'](function(_0x48c6f6){if(_0x48c6f6&&_0x48c6f6['autoAssociation']===0x0){return db['UserProfileResource'][_0xa3ab('0x56')]({'name':_0x5742b8[_0xa3ab('0x40')],'resourceId':_0x5742b8['id'],'type':_0x48c6f6[_0xa3ab('0x40')],'sectionId':_0x48c6f6['id']},{})[_0xa3ab('0x21')](function(){return _0xe989b6;});}else{return _0xe989b6;}})[_0xa3ab('0x45')](function(_0x18846e){logger[_0xa3ab('0x27')](_0xa3ab('0x7a'),_0x18846e);throw _0x18846e;});}return _0xe989b6;})[_0xa3ab('0x21')](respondWithResult(_0x3269c5,null))[_0xa3ab('0x45')](handleError(_0x3269c5,null));});_0x321324['start']();}catch(_0x2ef0dd){_0x3269c5[_0xa3ab('0x15')](0x1f4)[_0xa3ab('0x29')](_0x2ef0dd);}};exports[_0xa3ab('0x20')]=function(_0x54da61,_0x37f7b5,_0x1cf64b){return db[_0xa3ab('0x2c')]['find']({'where':{'id':_0x54da61[_0xa3ab('0x47')]['id']}})[_0xa3ab('0x21')](handleEntityNotFound(_0x37f7b5,null))[_0xa3ab('0x21')](saveUpdates(_[_0xa3ab('0x7b')](_0x54da61['body'],['name',_0xa3ab('0x7c')]),null))[_0xa3ab('0x21')](respondWithResult(_0x37f7b5,null))[_0xa3ab('0x45')](handleError(_0x37f7b5,null));};exports[_0xa3ab('0x7d')]=function(_0x885eb0,_0x370f3c,_0x12a247){return db['Sound']['find']({'where':{'id':_0x885eb0[_0xa3ab('0x47')]['id']}})['then'](function(_0x20c6b3){if(_0x20c6b3){return _0x20c6b3['destroy']();}})['then'](function(_0xa3225){var _0x2ce1a5=path['join'](config[_0xa3ab('0x53')],'server/files/sounds/original',util['format'](_0xa3ab('0x55'),_0xa3225[_0xa3ab('0x4b')],_0xa3225[_0xa3ab('0x7e')]));var _0x214950=path[_0xa3ab('0x4e')](config['root'],_0xa3ab('0x4f'),util['format'](_0xa3ab('0x55'),_0xa3225[_0xa3ab('0x4b')],_0xa3225[_0xa3ab('0x4c')]));fs[_0xa3ab('0x64')](_0x2ce1a5);fs[_0xa3ab('0x64')](_0x214950);return _0xa3225;})[_0xa3ab('0x21')](function(_0x1dca39){if(_0x1dca39){return _0x370f3c[_0xa3ab('0x15')](0xcc)[_0xa3ab('0x16')]();}})[_0xa3ab('0x21')](handleEntityNotFound(_0x370f3c,null))[_0xa3ab('0x45')](handleError(_0x370f3c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index f27cfa5..7244097 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 _0x960c=['Sound','tools_sounds','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x468c5c,_0x20b8c8){var _0x266db0=function(_0x2bd9ad){while(--_0x2bd9ad){_0x468c5c['push'](_0x468c5c['shift']());}};_0x266db0(++_0x20b8c8);}(_0x960c,0xb6));var _0xc960=function(_0xb69b4e,_0x242450){_0xb69b4e=_0xb69b4e-0x0;var _0x12791a=_0x960c[_0xb69b4e];return _0x12791a;};'use strict';var _=require(_0xc960('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc960('0x1'));var moment=require(_0xc960('0x2'));var BPromise=require(_0xc960('0x3'));var rp=require(_0xc960('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc960('0x5'));var config=require(_0xc960('0x6'));var attributes=require(_0xc960('0x7'));module[_0xc960('0x8')]=function(_0x4aa46d,_0x148d50){return _0x4aa46d[_0xc960('0x9')](_0xc960('0xa'),attributes,{'tableName':_0xc960('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f58=['../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','request-promise','path','rimraf'];(function(_0x44319e,_0x4da35b){var _0x29aa48=function(_0xc69c3b){while(--_0xc69c3b){_0x44319e['push'](_0x44319e['shift']());}};_0x29aa48(++_0x4da35b);}(_0x2f58,0xcd));var _0x82f5=function(_0x488a2f,_0x2c2dc8){_0x488a2f=_0x488a2f-0x0;var _0x6c241c=_0x2f58[_0x488a2f];return _0x6c241c;};'use strict';var _=require(_0x82f5('0x0'));var util=require(_0x82f5('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x82f5('0x2'));var fs=require('fs');var path=require(_0x82f5('0x3'));var rimraf=require(_0x82f5('0x4'));var config=require(_0x82f5('0x5'));var attributes=require(_0x82f5('0x6'));module['exports']=function(_0x3e24ab,_0x12ce1c){return _0x3e24ab[_0x82f5('0x7')](_0x82f5('0x8'),attributes,{'tableName':_0x82f5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 867a5cb..795162e 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 _0xda41=['error','message','Sound,\x20%s,\x20%s','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x119b85,_0x437900){var _0x551478=function(_0x1004cf){while(--_0x1004cf){_0x119b85['push'](_0x119b85['shift']());}};_0x551478(++_0x437900);}(_0xda41,0x70));var _0x1da4=function(_0x590c14,_0x1b325b){_0x590c14=_0x590c14-0x0;var _0x301ba8=_0xda41[_0x590c14];return _0x301ba8;};'use strict';var _=require(_0x1da4('0x0'));var util=require(_0x1da4('0x1'));var moment=require(_0x1da4('0x2'));var BPromise=require(_0x1da4('0x3'));var rs=require(_0x1da4('0x4'));var fs=require('fs');var Redis=require(_0x1da4('0x5'));var db=require(_0x1da4('0x6'))['db'];var utils=require(_0x1da4('0x7'));var logger=require('../../config/logger')(_0x1da4('0x8'));var config=require(_0x1da4('0x9'));var jayson=require(_0x1da4('0xa'));var client=jayson[_0x1da4('0xb')][_0x1da4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2f6083,_0xd32382,_0x1bdf85){return new BPromise(function(_0x88d38,_0x1f3358){return client[_0x1da4('0xd')](_0x2f6083,_0x1bdf85)[_0x1da4('0xe')](function(_0x52d521){logger[_0x1da4('0xf')]('Sound,\x20%s,\x20%s',_0xd32382,'request\x20sent');logger[_0x1da4('0x10')](_0x1da4('0x11'),_0xd32382,_0x1da4('0x12'),JSON[_0x1da4('0x13')](_0x52d521));if(_0x52d521[_0x1da4('0x14')]){if(_0x52d521[_0x1da4('0x14')]['code']===0x1f4){logger[_0x1da4('0x14')]('Sound,\x20%s,\x20%s',_0xd32382,_0x52d521[_0x1da4('0x14')][_0x1da4('0x15')]);return _0x1f3358(_0x52d521[_0x1da4('0x14')][_0x1da4('0x15')]);}logger['error'](_0x1da4('0x16'),_0xd32382,_0x52d521[_0x1da4('0x14')]['message']);return _0x88d38(_0x52d521[_0x1da4('0x14')][_0x1da4('0x15')]);}else{logger[_0x1da4('0xf')](_0x1da4('0x16'),_0xd32382,_0x1da4('0x12'));_0x88d38(_0x52d521['result'][_0x1da4('0x15')]);}})[_0x1da4('0x17')](function(_0x32fd8e){logger[_0x1da4('0x14')](_0x1da4('0x16'),_0xd32382,_0x32fd8e);_0x1f3358(_0x32fd8e);});});}exports['ShowSound']=function(_0x59e712){var _0x4bdfe8=this;return new Promise(function(_0x49d24d,_0x4b3daa){return db['Sound'][_0x1da4('0x18')]({'raw':_0x59e712[_0x1da4('0x19')]?_0x59e712['options'][_0x1da4('0x1a')]===undefined?!![]:![]:!![],'where':_0x59e712['options']?_0x59e712[_0x1da4('0x19')][_0x1da4('0x1b')]||null:null,'attributes':_0x59e712['options']?_0x59e712[_0x1da4('0x19')][_0x1da4('0x1c')]||null:null,'include':_0x59e712['options']?_0x59e712[_0x1da4('0x19')][_0x1da4('0x1d')]?_[_0x1da4('0x1e')](_0x59e712[_0x1da4('0x19')]['include'],function(_0x5a5d93){return{'model':db[_0x5a5d93['model']],'as':_0x5a5d93['as'],'attributes':_0x5a5d93[_0x1da4('0x1c')],'include':_0x5a5d93['include']?_['map'](_0x5a5d93['include'],function(_0x45a424){return{'model':db[_0x45a424[_0x1da4('0x1f')]],'as':_0x45a424['as'],'attributes':_0x45a424[_0x1da4('0x1c')],'include':_0x45a424[_0x1da4('0x1d')]?_[_0x1da4('0x1e')](_0x45a424[_0x1da4('0x1d')],function(_0x467853){return{'model':db[_0x467853[_0x1da4('0x1f')]],'as':_0x467853['as'],'attributes':_0x467853['attributes']};}):[]};}):[]};}):[]:[]})[_0x1da4('0xe')](function(_0x511b87){logger['info'](_0x1da4('0x20'),_0x59e712);logger[_0x1da4('0x10')](_0x1da4('0x20'),_0x59e712,JSON[_0x1da4('0x13')](_0x511b87));_0x49d24d(_0x511b87);})['catch'](function(_0x365519){logger[_0x1da4('0x14')](_0x1da4('0x20'),_0x365519[_0x1da4('0x15')],_0x59e712);_0x4b3daa(_0x4bdfe8['error'](0x1f4,_0x365519['message']));});});}; \ No newline at end of file +var _0x574c=['lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSound','Sound','options','where','attributes','include','map','model','debug','stringify','catch'];(function(_0x2c0515,_0x1082b6){var _0x4461a5=function(_0x2133bc){while(--_0x2133bc){_0x2c0515['push'](_0x2c0515['shift']());}};_0x4461a5(++_0x1082b6);}(_0x574c,0x15c));var _0xc574=function(_0x51fca8,_0x395683){_0x51fca8=_0x51fca8-0x0;var _0x8977a6=_0x574c[_0x51fca8];return _0x8977a6;};'use strict';var _=require(_0xc574('0x0'));var util=require(_0xc574('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc574('0x2'));var fs=require('fs');var Redis=require(_0xc574('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc574('0x4'))('rpc');var config=require(_0xc574('0x5'));var jayson=require(_0xc574('0x6'));var client=jayson['client'][_0xc574('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2aba1f,_0x4a163e,_0x1d9f66){return new BPromise(function(_0x5bb417,_0x52254d){return client[_0xc574('0x8')](_0x2aba1f,_0x1d9f66)[_0xc574('0x9')](function(_0x3c2eed){logger[_0xc574('0xa')](_0xc574('0xb'),_0x4a163e,_0xc574('0xc'));logger['debug'](_0xc574('0xd'),_0x4a163e,_0xc574('0xc'),JSON['stringify'](_0x3c2eed));if(_0x3c2eed['error']){if(_0x3c2eed[_0xc574('0xe')][_0xc574('0xf')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x4a163e,_0x3c2eed['error']['message']);return _0x52254d(_0x3c2eed['error']['message']);}logger[_0xc574('0xe')](_0xc574('0xb'),_0x4a163e,_0x3c2eed[_0xc574('0xe')][_0xc574('0x10')]);return _0x5bb417(_0x3c2eed[_0xc574('0xe')][_0xc574('0x10')]);}else{logger[_0xc574('0xa')](_0xc574('0xb'),_0x4a163e,_0xc574('0xc'));_0x5bb417(_0x3c2eed[_0xc574('0x11')][_0xc574('0x10')]);}})['catch'](function(_0x317340){logger[_0xc574('0xe')]('Sound,\x20%s,\x20%s',_0x4a163e,_0x317340);_0x52254d(_0x317340);});});}exports[_0xc574('0x12')]=function(_0x5c0f27){var _0x458bcb=this;return new Promise(function(_0x52be00,_0x5657a5){return db[_0xc574('0x13')]['find']({'raw':_0x5c0f27[_0xc574('0x14')]?_0x5c0f27[_0xc574('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x5c0f27[_0xc574('0x14')]?_0x5c0f27['options'][_0xc574('0x15')]||null:null,'attributes':_0x5c0f27[_0xc574('0x14')]?_0x5c0f27[_0xc574('0x14')][_0xc574('0x16')]||null:null,'include':_0x5c0f27[_0xc574('0x14')]?_0x5c0f27[_0xc574('0x14')][_0xc574('0x17')]?_[_0xc574('0x18')](_0x5c0f27[_0xc574('0x14')][_0xc574('0x17')],function(_0x5489e3){return{'model':db[_0x5489e3[_0xc574('0x19')]],'as':_0x5489e3['as'],'attributes':_0x5489e3[_0xc574('0x16')],'include':_0x5489e3['include']?_[_0xc574('0x18')](_0x5489e3[_0xc574('0x17')],function(_0x1256c7){return{'model':db[_0x1256c7[_0xc574('0x19')]],'as':_0x1256c7['as'],'attributes':_0x1256c7[_0xc574('0x16')],'include':_0x1256c7['include']?_['map'](_0x1256c7[_0xc574('0x17')],function(_0x208021){return{'model':db[_0x208021[_0xc574('0x19')]],'as':_0x208021['as'],'attributes':_0x208021[_0xc574('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc574('0x9')](function(_0xd9571b){logger[_0xc574('0xa')](_0xc574('0x12'),_0x5c0f27);logger[_0xc574('0x1a')](_0xc574('0x12'),_0x5c0f27,JSON[_0xc574('0x1b')](_0xd9571b));_0x52be00(_0xd9571b);})[_0xc574('0x1c')](function(_0x10b15d){logger['error'](_0xc574('0x12'),_0x10b15d[_0xc574('0x10')],_0x5c0f27);_0x5657a5(_0x458bcb[_0xc574('0xe')](0x1f4,_0x10b15d[_0xc574('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index db40009..efe9fde 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 _0xcfcc=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0xcfcc,0x8a));var _0xccfc=function(_0x1ce17a,_0x233982){_0x1ce17a=_0x1ce17a-0x0;var _0x3e3c3b=_0xcfcc[_0x1ce17a];return _0x3e3c3b;};'use strict';var multer=require(_0xccfc('0x0'));var util=require(_0xccfc('0x1'));var path=require('path');var timeout=require(_0xccfc('0x2'));var express=require(_0xccfc('0x3'));var router=express['Router']();var auth=require(_0xccfc('0x4'));var interaction=require(_0xccfc('0x5'));var config=require(_0xccfc('0x6'));var controller=require(_0xccfc('0x7'));router[_0xccfc('0x8')]('/',auth[_0xccfc('0x9')](),controller[_0xccfc('0xa')]);router[_0xccfc('0x8')](_0xccfc('0xb'),auth[_0xccfc('0x9')](),controller[_0xccfc('0xc')]);router[_0xccfc('0xd')]('/',auth[_0xccfc('0x9')](),controller['create']);router[_0xccfc('0xe')]('/:id',auth[_0xccfc('0x9')](),controller[_0xccfc('0xf')]);router[_0xccfc('0x10')](_0xccfc('0xb'),auth['isAuthenticated'](),controller[_0xccfc('0x11')]);module[_0xccfc('0x12')]=router; \ No newline at end of file +var _0x4143=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','exports'];(function(_0x3cfde9,_0x199294){var _0x65b377=function(_0x2a6f65){while(--_0x2a6f65){_0x3cfde9['push'](_0x3cfde9['shift']());}};_0x65b377(++_0x199294);}(_0x4143,0x7e));var _0x3414=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x4143[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x3414('0x0'));var util=require(_0x3414('0x1'));var path=require(_0x3414('0x2'));var timeout=require(_0x3414('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3414('0x4'));var interaction=require(_0x3414('0x5'));var config=require(_0x3414('0x6'));var controller=require(_0x3414('0x7'));router[_0x3414('0x8')]('/',auth[_0x3414('0x9')](),controller[_0x3414('0xa')]);router[_0x3414('0x8')]('/:id',auth[_0x3414('0x9')](),controller[_0x3414('0xb')]);router[_0x3414('0xc')]('/',auth[_0x3414('0x9')](),controller[_0x3414('0xd')]);router[_0x3414('0xe')](_0x3414('0xf'),auth[_0x3414('0x9')](),controller[_0x3414('0x10')]);router['delete'](_0x3414('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x3414('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 86da9f2..e146e58 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 _0x394d=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x29baef,_0x1d0da6){var _0x11cc52=function(_0x2451dc){while(--_0x2451dc){_0x29baef['push'](_0x29baef['shift']());}};_0x11cc52(++_0x1d0da6);}(_0x394d,0x133));var _0xd394=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x394d[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0xd394('0x0'));module[_0xd394('0x1')]={'uniqueid':{'type':Sequelize[_0xd394('0x2')]},'body':{'type':Sequelize[_0xd394('0x3')](_0xd394('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xd394('0x5')]('in',_0xd394('0x6')),'defaultValue':_0xd394('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x778f=['out','sequelize'];(function(_0x505a15,_0xe87c0c){var _0x22d36f=function(_0x443236){while(--_0x443236){_0x505a15['push'](_0x505a15['shift']());}};_0x22d36f(++_0xe87c0c);}(_0x778f,0x11f));var _0xf778=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x778f[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xf778('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf778('0x1'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 645dec3..1e4fa2a 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 _0xb11f=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','catch','show','filtears','find','create','body','params','html-pdf','rimraf','request-promise','moment','bluebird'];(function(_0x5d8500,_0x5a5b39){var _0x4db1b2=function(_0x2bceff){while(--_0x2bceff){_0x5d8500['push'](_0x5d8500['shift']());}};_0x4db1b2(++_0x5a5b39);}(_0xb11f,0x154));var _0xfb11=function(_0x4afb11,_0x1a07da){_0x4afb11=_0x4afb11-0x0;var _0x475934=_0xb11f[_0x4afb11];return _0x475934;};'use strict';var pdf=require(_0xfb11('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfb11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfb11('0x2'));var moment=require(_0xfb11('0x3'));var BPromise=require(_0xfb11('0x4'));var Mustache=require(_0xfb11('0x5'));var util=require(_0xfb11('0x6'));var path=require(_0xfb11('0x7'));var sox=require('sox');var csv=require(_0xfb11('0x8'));var ejs=require(_0xfb11('0x9'));var fs=require('fs');var _=require(_0xfb11('0xa'));var squel=require('squel');var crypto=require(_0xfb11('0xb'));var jsforce=require(_0xfb11('0xc'));var deskjs=require(_0xfb11('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb11('0xe'));var Papa=require('papaparse');var Redis=require(_0xfb11('0xf'));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('../../config/logger')(_0xfb11('0x10'));var utils=require('../../config/utils');var config=require(_0xfb11('0x11'));var licenseUtil=require(_0xfb11('0x12'));var db=require(_0xfb11('0x13'))['db'];function respondWithStatusCode(_0xdc03a9,_0xebf2fb){_0xebf2fb=_0xebf2fb||0xcc;return function(_0xc7fbfc){if(_0xc7fbfc){return _0xdc03a9[_0xfb11('0x14')](_0xebf2fb);}return _0xdc03a9[_0xfb11('0x15')](_0xebf2fb)['end']();};}function respondWithResult(_0x4bf0fc,_0x131982){_0x131982=_0x131982||0xc8;return function(_0x1b5f86){if(_0x1b5f86){return _0x4bf0fc[_0xfb11('0x15')](_0x131982)['json'](_0x1b5f86);}};}function respondWithFilteredResult(_0x564724,_0x25333c){return function(_0x5ef80d){if(_0x5ef80d){var _0x1b1c51=_0x5ef80d['count'],_0x5dae9b=_0x25333c[_0xfb11('0x16')],_0x110d30=_0x25333c[_0xfb11('0x16')]+_0x25333c[_0xfb11('0x17')],_0x25ec54;if(_0x110d30>=_0x1b1c51){_0x110d30=_0x1b1c51;_0x25ec54=0xc8;}else{_0x25ec54=0xce;}_0x564724[_0xfb11('0x15')](_0x25ec54);return _0x564724[_0xfb11('0x18')]('Content-Range',_0x5dae9b+'-'+_0x110d30+'/'+_0x1b1c51)[_0xfb11('0x19')](_0x5ef80d);}return null;};}function patchUpdates(_0x2a310c){return function(_0x1b3548){try{jsonpatch[_0xfb11('0x1a')](_0x1b3548,_0x2a310c,!![]);}catch(_0x53d46f){return BPromise[_0xfb11('0x1b')](_0x53d46f);}return _0x1b3548[_0xfb11('0x1c')]();};}function saveUpdates(_0x3017e5,_0x496182){return function(_0x4863a6){if(_0x4863a6){return _0x4863a6[_0xfb11('0x1d')](_0x3017e5)['then'](function(_0x3aef0b){return _0x3aef0b;});}return null;};}function removeEntity(_0x5348a6,_0x334b0e){return function(_0x36dff1){if(_0x36dff1){return _0x36dff1['destroy']()[_0xfb11('0x1e')](function(){_0x5348a6[_0xfb11('0x15')](0xcc)[_0xfb11('0x1f')]();});}};}function handleEntityNotFound(_0x4fac50,_0x221cfd){return function(_0x3f9be3){if(!_0x3f9be3){_0x4fac50['sendStatus'](0x194);}return _0x3f9be3;};}function handleError(_0x357601,_0x2d8f39){_0x2d8f39=_0x2d8f39||0x1f4;return function(_0x562e80){logger[_0xfb11('0x20')](_0x562e80[_0xfb11('0x21')]);if(_0x562e80[_0xfb11('0x22')]){delete _0x562e80[_0xfb11('0x22')];}_0x357601['status'](_0x2d8f39)[_0xfb11('0x23')](_0x562e80);};}exports[_0xfb11('0x24')]=function(_0x2bd9f2,_0x182fef){var _0x1be11d={},_0x571f90={},_0x6a162c={'count':0x0,'rows':[]};var _0x35fa1f=_[_0xfb11('0x25')](db[_0xfb11('0x26')][_0xfb11('0x27')],function(_0x2b64f3){return{'name':_0x2b64f3[_0xfb11('0x28')],'type':_0x2b64f3[_0xfb11('0x29')][_0xfb11('0x2a')]};});_0x571f90[_0xfb11('0x2b')]=_[_0xfb11('0x25')](_0x35fa1f,_0xfb11('0x22'));_0x571f90[_0xfb11('0x2c')]=_[_0xfb11('0x2d')](_0x2bd9f2['query']);_0x571f90[_0xfb11('0x2e')]=_[_0xfb11('0x2f')](_0x571f90[_0xfb11('0x2b')],_0x571f90[_0xfb11('0x2c')]);_0x1be11d[_0xfb11('0x30')]=_['intersection'](_0x571f90[_0xfb11('0x2b')],qs[_0xfb11('0x31')](_0x2bd9f2[_0xfb11('0x2c')][_0xfb11('0x31')]));_0x1be11d[_0xfb11('0x30')]=_0x1be11d['attributes'][_0xfb11('0x32')]?_0x1be11d['attributes']:_0x571f90[_0xfb11('0x2b')];if(!_0x2bd9f2[_0xfb11('0x2c')][_0xfb11('0x33')](_0xfb11('0x34'))){_0x1be11d[_0xfb11('0x17')]=qs[_0xfb11('0x17')](_0x2bd9f2[_0xfb11('0x2c')][_0xfb11('0x17')]);_0x1be11d[_0xfb11('0x16')]=qs[_0xfb11('0x16')](_0x2bd9f2['query']['offset']);}_0x1be11d['order']=qs['sort'](_0x2bd9f2[_0xfb11('0x2c')]['sort']);_0x1be11d[_0xfb11('0x35')]=qs['filters'](_[_0xfb11('0x36')](_0x2bd9f2[_0xfb11('0x2c')],_0x571f90['filters']),_0x35fa1f);if(_0x2bd9f2[_0xfb11('0x2c')][_0xfb11('0x37')]){_0x1be11d[_0xfb11('0x35')]=_['merge'](_0x1be11d[_0xfb11('0x35')],{'$or':_[_0xfb11('0x25')](_0x35fa1f,function(_0x5b2c90){if(_0x5b2c90['type']!==_0xfb11('0x38')){var _0xbf3df0={};_0xbf3df0[_0x5b2c90[_0xfb11('0x22')]]={'$like':'%'+_0x2bd9f2['query'][_0xfb11('0x37')]+'%'};return _0xbf3df0;}})});}_0x1be11d=_[_0xfb11('0x39')]({},_0x1be11d,_0x2bd9f2[_0xfb11('0x3a')]);var _0x231c63={'where':_0x1be11d[_0xfb11('0x35')]};return db[_0xfb11('0x26')][_0xfb11('0x3b')](_0x231c63)['then'](function(_0x1788e9){_0x6a162c[_0xfb11('0x3b')]=_0x1788e9;if(_0x2bd9f2[_0xfb11('0x2c')][_0xfb11('0x3c')]){_0x1be11d[_0xfb11('0x3d')]=[{'all':!![]}];}return db[_0xfb11('0x26')]['findAll'](_0x1be11d);})['then'](function(_0x28eea5){_0x6a162c['rows']=_0x28eea5;return _0x6a162c;})[_0xfb11('0x1e')](respondWithFilteredResult(_0x182fef,_0x1be11d))[_0xfb11('0x3e')](handleError(_0x182fef,null));};exports[_0xfb11('0x3f')]=function(_0x23d665,_0xef81a6){var _0xa33d1={'raw':!![],'where':{'id':_0x23d665['params']['id']}},_0x8a4d8c={};_0x8a4d8c[_0xfb11('0x2b')]=_[_0xfb11('0x2d')](db[_0xfb11('0x26')][_0xfb11('0x27')]);_0x8a4d8c[_0xfb11('0x2c')]=_[_0xfb11('0x2d')](_0x23d665['query']);_0x8a4d8c[_0xfb11('0x40')]=_['intersection'](_0x8a4d8c[_0xfb11('0x2b')],_0x8a4d8c['query']);_0xa33d1[_0xfb11('0x30')]=_[_0xfb11('0x2f')](_0x8a4d8c[_0xfb11('0x2b')],qs[_0xfb11('0x31')](_0x23d665[_0xfb11('0x2c')]['fields']));_0xa33d1[_0xfb11('0x30')]=_0xa33d1['attributes'][_0xfb11('0x32')]?_0xa33d1[_0xfb11('0x30')]:_0x8a4d8c['model'];if(_0x23d665[_0xfb11('0x2c')][_0xfb11('0x3c')]){_0xa33d1['include']=[{'all':!![]}];}_0xa33d1=_[_0xfb11('0x39')]({},_0xa33d1,_0x23d665[_0xfb11('0x3a')]);return db[_0xfb11('0x26')][_0xfb11('0x41')](_0xa33d1)['then'](handleEntityNotFound(_0xef81a6,null))[_0xfb11('0x1e')](respondWithResult(_0xef81a6,null))[_0xfb11('0x3e')](handleError(_0xef81a6,null));};exports[_0xfb11('0x42')]=function(_0x289736,_0x9ef76f){return db[_0xfb11('0x26')][_0xfb11('0x42')](_0x289736['body'],{})[_0xfb11('0x1e')](respondWithResult(_0x9ef76f,0xc9))[_0xfb11('0x3e')](handleError(_0x9ef76f,null));};exports['update']=function(_0x32f277,_0x286bf7){if(_0x32f277[_0xfb11('0x43')]['id']){delete _0x32f277[_0xfb11('0x43')]['id'];}return db[_0xfb11('0x26')]['find']({'where':{'id':_0x32f277[_0xfb11('0x44')]['id']}})[_0xfb11('0x1e')](handleEntityNotFound(_0x286bf7,null))[_0xfb11('0x1e')](saveUpdates(_0x32f277[_0xfb11('0x43')],null))[_0xfb11('0x1e')](respondWithResult(_0x286bf7,null))[_0xfb11('0x3e')](handleError(_0x286bf7,null));};exports['destroy']=function(_0x580104,_0x5df979){return db['SquareMessage'][_0xfb11('0x41')]({'where':{'id':_0x580104[_0xfb11('0x44')]['id']}})['then'](handleEntityNotFound(_0x5df979,null))[_0xfb11('0x1e')](removeEntity(_0x5df979,null))[_0xfb11('0x3e')](handleError(_0x5df979,null));}; \ No newline at end of file +var _0x405b=['ejs','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','nolimit','offset','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','show','SquareMessage','filtears','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x6b6f0d,_0xd9d2b5){var _0x511649=function(_0x278886){while(--_0x278886){_0x6b6f0d['push'](_0x6b6f0d['shift']());}};_0x511649(++_0xd9d2b5);}(_0x405b,0x16f));var _0xb405=function(_0x78c21,_0xdce280){_0x78c21=_0x78c21-0x0;var _0x158194=_0x405b[_0x78c21];return _0x158194;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb405('0x0'));var rimraf=require(_0xb405('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb405('0x2'));var rp=require(_0xb405('0x3'));var moment=require('moment');var BPromise=require(_0xb405('0x4'));var Mustache=require(_0xb405('0x5'));var util=require(_0xb405('0x6'));var path=require('path');var sox=require(_0xb405('0x7'));var csv=require('to-csv');var ejs=require(_0xb405('0x8'));var fs=require('fs');var _=require(_0xb405('0x9'));var squel=require('squel');var crypto=require(_0xb405('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb405('0xb'));var querystring=require(_0xb405('0xc'));var Papa=require(_0xb405('0xd'));var Redis=require(_0xb405('0xe'));var authService=require(_0xb405('0xf'));var qs=require(_0xb405('0x10'));var as=require(_0xb405('0x11'));var hardwareService=require(_0xb405('0x12'));var logger=require(_0xb405('0x13'))(_0xb405('0x14'));var utils=require(_0xb405('0x15'));var config=require(_0xb405('0x16'));var licenseUtil=require(_0xb405('0x17'));var db=require(_0xb405('0x18'))['db'];function respondWithStatusCode(_0x41f5cb,_0x16487c){_0x16487c=_0x16487c||0xcc;return function(_0x468d86){if(_0x468d86){return _0x41f5cb[_0xb405('0x19')](_0x16487c);}return _0x41f5cb['status'](_0x16487c)[_0xb405('0x1a')]();};}function respondWithResult(_0x4a7d50,_0x3fcb96){_0x3fcb96=_0x3fcb96||0xc8;return function(_0x52b2fa){if(_0x52b2fa){return _0x4a7d50[_0xb405('0x1b')](_0x3fcb96)['json'](_0x52b2fa);}};}function respondWithFilteredResult(_0x39e8a6,_0x1dc356){return function(_0x4c028f){if(_0x4c028f){var _0x32eb14=_0x4c028f[_0xb405('0x1c')],_0x46ffcc=_0x1dc356['offset'],_0x325fc4=_0x1dc356['offset']+_0x1dc356[_0xb405('0x1d')],_0x323241;if(_0x325fc4>=_0x32eb14){_0x325fc4=_0x32eb14;_0x323241=0xc8;}else{_0x323241=0xce;}_0x39e8a6['status'](_0x323241);return _0x39e8a6[_0xb405('0x1e')](_0xb405('0x1f'),_0x46ffcc+'-'+_0x325fc4+'/'+_0x32eb14)[_0xb405('0x20')](_0x4c028f);}return null;};}function patchUpdates(_0x244216){return function(_0x3811b3){try{jsonpatch[_0xb405('0x21')](_0x3811b3,_0x244216,!![]);}catch(_0x146d96){return BPromise[_0xb405('0x22')](_0x146d96);}return _0x3811b3[_0xb405('0x23')]();};}function saveUpdates(_0x3e12cc,_0x427cf8){return function(_0x405e5e){if(_0x405e5e){return _0x405e5e[_0xb405('0x24')](_0x3e12cc)['then'](function(_0x44a5d0){return _0x44a5d0;});}return null;};}function removeEntity(_0x4a55f9,_0xa4ce38){return function(_0x1d78b9){if(_0x1d78b9){return _0x1d78b9[_0xb405('0x25')]()[_0xb405('0x26')](function(){_0x4a55f9[_0xb405('0x1b')](0xcc)[_0xb405('0x1a')]();});}};}function handleEntityNotFound(_0x2f3a4f,_0xf4a320){return function(_0x373daa){if(!_0x373daa){_0x2f3a4f[_0xb405('0x19')](0x194);}return _0x373daa;};}function handleError(_0x9dc79f,_0x51c4c0){_0x51c4c0=_0x51c4c0||0x1f4;return function(_0x3787f9){logger[_0xb405('0x27')](_0x3787f9[_0xb405('0x28')]);if(_0x3787f9[_0xb405('0x29')]){delete _0x3787f9['name'];}_0x9dc79f[_0xb405('0x1b')](_0x51c4c0)[_0xb405('0x2a')](_0x3787f9);};}exports['index']=function(_0x26fe3e,_0x16de38){var _0x154347={},_0x33c37b={},_0x397051={'count':0x0,'rows':[]};var _0x59771f=_['map'](db['SquareMessage'][_0xb405('0x2b')],function(_0xcde06d){return{'name':_0xcde06d[_0xb405('0x2c')],'type':_0xcde06d['type'][_0xb405('0x2d')]};});_0x33c37b[_0xb405('0x2e')]=_[_0xb405('0x2f')](_0x59771f,_0xb405('0x29'));_0x33c37b[_0xb405('0x30')]=_[_0xb405('0x31')](_0x26fe3e[_0xb405('0x30')]);_0x33c37b[_0xb405('0x32')]=_['intersection'](_0x33c37b[_0xb405('0x2e')],_0x33c37b[_0xb405('0x30')]);_0x154347[_0xb405('0x33')]=_[_0xb405('0x34')](_0x33c37b[_0xb405('0x2e')],qs[_0xb405('0x35')](_0x26fe3e[_0xb405('0x30')][_0xb405('0x35')]));_0x154347[_0xb405('0x33')]=_0x154347[_0xb405('0x33')]['length']?_0x154347[_0xb405('0x33')]:_0x33c37b[_0xb405('0x2e')];if(!_0x26fe3e[_0xb405('0x30')]['hasOwnProperty'](_0xb405('0x36'))){_0x154347[_0xb405('0x1d')]=qs[_0xb405('0x1d')](_0x26fe3e[_0xb405('0x30')][_0xb405('0x1d')]);_0x154347['offset']=qs[_0xb405('0x37')](_0x26fe3e[_0xb405('0x30')][_0xb405('0x37')]);}_0x154347[_0xb405('0x38')]=qs['sort'](_0x26fe3e[_0xb405('0x30')][_0xb405('0x39')]);_0x154347[_0xb405('0x3a')]=qs[_0xb405('0x32')](_[_0xb405('0x3b')](_0x26fe3e['query'],_0x33c37b['filters']),_0x59771f);if(_0x26fe3e[_0xb405('0x30')][_0xb405('0x3c')]){_0x154347[_0xb405('0x3a')]=_[_0xb405('0x3d')](_0x154347['where'],{'$or':_[_0xb405('0x2f')](_0x59771f,function(_0x36d461){if(_0x36d461[_0xb405('0x3e')]!=='VIRTUAL'){var _0x452c4c={};_0x452c4c[_0x36d461[_0xb405('0x29')]]={'$like':'%'+_0x26fe3e[_0xb405('0x30')][_0xb405('0x3c')]+'%'};return _0x452c4c;}})});}_0x154347=_[_0xb405('0x3d')]({},_0x154347,_0x26fe3e[_0xb405('0x3f')]);var _0x519087={'where':_0x154347[_0xb405('0x3a')]};return db['SquareMessage'][_0xb405('0x1c')](_0x519087)[_0xb405('0x26')](function(_0x25a62e){_0x397051[_0xb405('0x1c')]=_0x25a62e;if(_0x26fe3e[_0xb405('0x30')][_0xb405('0x40')]){_0x154347[_0xb405('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0xb405('0x42')](_0x154347);})['then'](function(_0x9a32b1){_0x397051['rows']=_0x9a32b1;return _0x397051;})[_0xb405('0x26')](respondWithFilteredResult(_0x16de38,_0x154347))[_0xb405('0x43')](handleError(_0x16de38,null));};exports[_0xb405('0x44')]=function(_0x4b61c9,_0x40fe89){var _0x400329={'raw':!![],'where':{'id':_0x4b61c9['params']['id']}},_0x3c5619={};_0x3c5619[_0xb405('0x2e')]=_[_0xb405('0x31')](db[_0xb405('0x45')][_0xb405('0x2b')]);_0x3c5619[_0xb405('0x30')]=_['keys'](_0x4b61c9['query']);_0x3c5619[_0xb405('0x46')]=_[_0xb405('0x34')](_0x3c5619['model'],_0x3c5619[_0xb405('0x30')]);_0x400329['attributes']=_[_0xb405('0x34')](_0x3c5619[_0xb405('0x2e')],qs[_0xb405('0x35')](_0x4b61c9[_0xb405('0x30')][_0xb405('0x35')]));_0x400329[_0xb405('0x33')]=_0x400329[_0xb405('0x33')]['length']?_0x400329[_0xb405('0x33')]:_0x3c5619[_0xb405('0x2e')];if(_0x4b61c9[_0xb405('0x30')][_0xb405('0x40')]){_0x400329[_0xb405('0x41')]=[{'all':!![]}];}_0x400329=_['merge']({},_0x400329,_0x4b61c9[_0xb405('0x3f')]);return db[_0xb405('0x45')][_0xb405('0x47')](_0x400329)['then'](handleEntityNotFound(_0x40fe89,null))[_0xb405('0x26')](respondWithResult(_0x40fe89,null))['catch'](handleError(_0x40fe89,null));};exports[_0xb405('0x48')]=function(_0x181493,_0x6f37cc){return db[_0xb405('0x45')][_0xb405('0x48')](_0x181493[_0xb405('0x49')],{})[_0xb405('0x26')](respondWithResult(_0x6f37cc,0xc9))[_0xb405('0x43')](handleError(_0x6f37cc,null));};exports[_0xb405('0x24')]=function(_0x4116e6,_0x2f68e9){if(_0x4116e6[_0xb405('0x49')]['id']){delete _0x4116e6['body']['id'];}return db[_0xb405('0x45')]['find']({'where':{'id':_0x4116e6[_0xb405('0x4a')]['id']}})[_0xb405('0x26')](handleEntityNotFound(_0x2f68e9,null))[_0xb405('0x26')](saveUpdates(_0x4116e6[_0xb405('0x49')],null))[_0xb405('0x26')](respondWithResult(_0x2f68e9,null))[_0xb405('0x43')](handleError(_0x2f68e9,null));};exports[_0xb405('0x25')]=function(_0x4db010,_0x370b6b){return db[_0xb405('0x45')][_0xb405('0x47')]({'where':{'id':_0x4db010[_0xb405('0x4a')]['id']}})['then'](handleEntityNotFound(_0x370b6b,null))[_0xb405('0x26')](removeEntity(_0x370b6b,null))[_0xb405('0x43')](handleError(_0x370b6b,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 628c607..35672d9 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 _0xa68a=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','util','bluebird','request-promise','path','rimraf'];(function(_0x1d8b26,_0x4c3dc2){var _0x5a44de=function(_0xca076d){while(--_0xca076d){_0x1d8b26['push'](_0x1d8b26['shift']());}};_0x5a44de(++_0x4c3dc2);}(_0xa68a,0x87));var _0xaa68=function(_0x55e0d9,_0x230135){_0x55e0d9=_0x55e0d9-0x0;var _0x739c5a=_0xa68a[_0x55e0d9];return _0x739c5a;};'use strict';var _=require('lodash');var util=require(_0xaa68('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa68('0x1'));var rp=require(_0xaa68('0x2'));var fs=require('fs');var path=require(_0xaa68('0x3'));var rimraf=require(_0xaa68('0x4'));var config=require('../../config/environment');var attributes=require(_0xaa68('0x5'));module[_0xaa68('0x6')]=function(_0x1a0431,_0x1f5acb){return _0x1a0431[_0xaa68('0x7')](_0xaa68('0x8'),attributes,{'tableName':_0xaa68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7eb9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x2f25ed,_0x3e0622){var _0x19c980=function(_0x2e1e53){while(--_0x2e1e53){_0x2f25ed['push'](_0x2f25ed['shift']());}};_0x19c980(++_0x3e0622);}(_0x7eb9,0x19e));var _0x97eb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7eb9[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x97eb('0x0'));var util=require(_0x97eb('0x1'));var logger=require('../../config/logger')(_0x97eb('0x2'));var moment=require(_0x97eb('0x3'));var BPromise=require(_0x97eb('0x4'));var rp=require(_0x97eb('0x5'));var fs=require('fs');var path=require(_0x97eb('0x6'));var rimraf=require(_0x97eb('0x7'));var config=require(_0x97eb('0x8'));var attributes=require('./squareMessage.attributes');module[_0x97eb('0x9')]=function(_0x2c9b15,_0x104ffb){return _0x2c9b15[_0x97eb('0xa')](_0x97eb('0xb'),attributes,{'tableName':_0x97eb('0xc'),'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 dc224ba..4905669 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x25ca67,_0x484019){var _0x230a64=function(_0x4ce7bb){while(--_0x4ce7bb){_0x25ca67['push'](_0x25ca67['shift']());}};_0x230a64(++_0x484019);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x152e36,_0x4d4ee1){var _0x2b1f92=function(_0x1d546c){while(--_0x1d546c){_0x152e36['push'](_0x152e36['shift']());}};_0x2b1f92(++_0x4d4ee1);}(_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 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['CreateSquareMessage']=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?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index d183adf..39be5ee 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 _0x2784=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','update','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2784,0xfd));var _0x4278=function(_0x1df28d,_0x3fa12f){_0x1df28d=_0x1df28d-0x0;var _0x5a8d89=_0x2784[_0x1df28d];return _0x5a8d89;};'use strict';var multer=require('multer');var util=require(_0x4278('0x0'));var path=require(_0x4278('0x1'));var timeout=require(_0x4278('0x2'));var express=require(_0x4278('0x3'));var router=express[_0x4278('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4278('0x5'));var config=require(_0x4278('0x6'));var controller=require('./squareOdbc.controller');router[_0x4278('0x7')]('/',auth[_0x4278('0x8')](),controller[_0x4278('0x9')]);router['get'](_0x4278('0xa'),auth[_0x4278('0x8')](),controller[_0x4278('0xb')]);router['get'](_0x4278('0xc'),auth[_0x4278('0x8')](),timeout(_0x4278('0xd')),controller[_0x4278('0xe')]);router[_0x4278('0xf')]('/',auth[_0x4278('0x8')](),controller[_0x4278('0x10')]);router[_0x4278('0x11')](_0x4278('0xa'),auth['isAuthenticated'](),controller[_0x4278('0x12')]);router['delete'](_0x4278('0xa'),auth[_0x4278('0x8')](),controller[_0x4278('0x13')]);module[_0x4278('0x14')]=router; \ No newline at end of file +var _0xa357=['test','create','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','15s'];(function(_0x4ef973,_0x11c5a6){var _0x1a9c89=function(_0x1c42ef){while(--_0x1c42ef){_0x4ef973['push'](_0x4ef973['shift']());}};_0x1a9c89(++_0x11c5a6);}(_0xa357,0x137));var _0x7a35=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xa357[_0x35007a];return _0x574f68;};'use strict';var multer=require(_0x7a35('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7a35('0x1'));var express=require(_0x7a35('0x2'));var router=express[_0x7a35('0x3')]();var auth=require(_0x7a35('0x4'));var interaction=require(_0x7a35('0x5'));var config=require(_0x7a35('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x7a35('0x7')]);router[_0x7a35('0x8')](_0x7a35('0x9'),auth[_0x7a35('0xa')](),controller[_0x7a35('0xb')]);router[_0x7a35('0x8')]('/:id/test',auth[_0x7a35('0xa')](),timeout(_0x7a35('0xc')),controller[_0x7a35('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7a35('0xe')]);router['put']('/:id',auth[_0x7a35('0xa')](),controller[_0x7a35('0xf')]);router[_0x7a35('0x10')](_0x7a35('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x7a35('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 54e752d..1340562 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 _0x555d=['STRING','name','sequelize','exports'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x555d,0x11a));var _0xd555=function(_0x549d2b,_0x2acfaa){_0x549d2b=_0x549d2b-0x0;var _0x2f7f64=_0x555d[_0x549d2b];return _0x2f7f64;};'use strict';var Sequelize=require(_0xd555('0x0'));module[_0xd555('0x1')]={'name':{'type':Sequelize[_0xd555('0x2')],'unique':_0xd555('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd555('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x29d6=['sequelize','exports','STRING','name'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x29d6,0xa0));var _0x629d=function(_0x5eed71,_0x14aac9){_0x5eed71=_0x5eed71-0x0;var _0x19f064=_0x29d6[_0x5eed71];return _0x19f064;};'use strict';var Sequelize=require(_0x629d('0x0'));module[_0x629d('0x1')]={'name':{'type':Sequelize[_0x629d('0x2')],'unique':_0x629d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x629d('0x2')]},'description':{'type':Sequelize[_0x629d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 64f88f8..e73e5dd 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 _0x8b13=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','dsn','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','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','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','error','stack','name','send','index','map','SquareOdbc','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','merge','options','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x8b13,0x101));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x38b1('0x0'));var emlformat=require(_0x38b1('0x1'));var rimraf=require(_0x38b1('0x2'));var zipdir=require(_0x38b1('0x3'));var jsonpatch=require(_0x38b1('0x4'));var rp=require('request-promise');var moment=require(_0x38b1('0x5'));var BPromise=require(_0x38b1('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38b1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38b1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x38b1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x38b1('0xa'));var querystring=require(_0x38b1('0xb'));var Papa=require(_0x38b1('0xc'));var Redis=require(_0x38b1('0xd'));var authService=require(_0x38b1('0xe'));var qs=require(_0x38b1('0xf'));var as=require(_0x38b1('0x10'));var hardwareService=require(_0x38b1('0x11'));var logger=require(_0x38b1('0x12'))(_0x38b1('0x13'));var utils=require(_0x38b1('0x14'));var config=require(_0x38b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f24e9,_0x16f673){_0x16f673=_0x16f673||0xcc;return function(_0x24bea8){if(_0x24bea8){return _0x4f24e9[_0x38b1('0x16')](_0x16f673);}return _0x4f24e9[_0x38b1('0x17')](_0x16f673)[_0x38b1('0x18')]();};}function respondWithResult(_0x58bb20,_0x19a0af){_0x19a0af=_0x19a0af||0xc8;return function(_0x2ab08f){if(_0x2ab08f){return _0x58bb20[_0x38b1('0x17')](_0x19a0af)[_0x38b1('0x19')](_0x2ab08f);}};}function respondWithFilteredResult(_0x5b3283,_0x56fa42){return function(_0x7fadb1){if(_0x7fadb1){var _0x33fe4e=_0x7fadb1['count'],_0x4f71f5=_0x56fa42[_0x38b1('0x1a')],_0x4ae8dc=_0x56fa42[_0x38b1('0x1a')]+_0x56fa42[_0x38b1('0x1b')],_0x2f9d13;if(_0x4ae8dc>=_0x33fe4e){_0x4ae8dc=_0x33fe4e;_0x2f9d13=0xc8;}else{_0x2f9d13=0xce;}_0x5b3283[_0x38b1('0x17')](_0x2f9d13);return _0x5b3283[_0x38b1('0x1c')](_0x38b1('0x1d'),_0x4f71f5+'-'+_0x4ae8dc+'/'+_0x33fe4e)['json'](_0x7fadb1);}return null;};}function patchUpdates(_0x1bbd7f){return function(_0x42ca02){try{jsonpatch[_0x38b1('0x1e')](_0x42ca02,_0x1bbd7f,!![]);}catch(_0x4fe0c9){return BPromise[_0x38b1('0x1f')](_0x4fe0c9);}return _0x42ca02[_0x38b1('0x20')]();};}function saveUpdates(_0x8155e7,_0x1c24e7){return function(_0x25bc90){if(_0x25bc90){return _0x25bc90[_0x38b1('0x21')](_0x8155e7)['then'](function(_0x70c505){return _0x70c505;});}return null;};}function removeEntity(_0x3ccd39,_0x4092d6){return function(_0x38941e){if(_0x38941e){return _0x38941e[_0x38b1('0x22')]()[_0x38b1('0x23')](function(){var _0x45f365=_0x38941e[_0x38b1('0x24')]({'plain':!![]});var _0x355680=_0x38b1('0x25');return db['UserProfileResource'][_0x38b1('0x22')]({'where':{'type':_0x355680,'resourceId':_0x45f365['id']}})['then'](function(){return _0x38941e;});})[_0x38b1('0x23')](function(){_0x3ccd39[_0x38b1('0x17')](0xcc)[_0x38b1('0x18')]();});}};}function handleEntityNotFound(_0x2a5cfd,_0x1a8720){return function(_0x5258a9){if(!_0x5258a9){_0x2a5cfd['sendStatus'](0x194);}return _0x5258a9;};}function handleError(_0x45649b,_0x273583){_0x273583=_0x273583||0x1f4;return function(_0x9e68a5){logger[_0x38b1('0x26')](_0x9e68a5[_0x38b1('0x27')]);if(_0x9e68a5[_0x38b1('0x28')]){delete _0x9e68a5[_0x38b1('0x28')];}_0x45649b[_0x38b1('0x17')](_0x273583)[_0x38b1('0x29')](_0x9e68a5);};}exports[_0x38b1('0x2a')]=function(_0x18fbd3,_0x3c4350){var _0x2e2c8d={},_0x5ec7f1={},_0x3ef4ca={'count':0x0,'rows':[]};var _0x146b26=_[_0x38b1('0x2b')](db[_0x38b1('0x2c')][_0x38b1('0x2d')],function(_0x23facd){return{'name':_0x23facd['fieldName'],'type':_0x23facd['type'][_0x38b1('0x2e')]};});_0x5ec7f1[_0x38b1('0x2f')]=_[_0x38b1('0x2b')](_0x146b26,_0x38b1('0x28'));_0x5ec7f1[_0x38b1('0x30')]=_['keys'](_0x18fbd3[_0x38b1('0x30')]);_0x5ec7f1['filters']=_[_0x38b1('0x31')](_0x5ec7f1['model'],_0x5ec7f1[_0x38b1('0x30')]);_0x2e2c8d[_0x38b1('0x32')]=_[_0x38b1('0x31')](_0x5ec7f1['model'],qs[_0x38b1('0x33')](_0x18fbd3['query']['fields']));_0x2e2c8d[_0x38b1('0x32')]=_0x2e2c8d[_0x38b1('0x32')][_0x38b1('0x34')]?_0x2e2c8d[_0x38b1('0x32')]:_0x5ec7f1[_0x38b1('0x2f')];if(!_0x18fbd3[_0x38b1('0x30')][_0x38b1('0x35')](_0x38b1('0x36'))){_0x2e2c8d['limit']=qs[_0x38b1('0x1b')](_0x18fbd3['query'][_0x38b1('0x1b')]);_0x2e2c8d['offset']=qs[_0x38b1('0x1a')](_0x18fbd3['query'][_0x38b1('0x1a')]);}_0x2e2c8d[_0x38b1('0x37')]=qs['sort'](_0x18fbd3[_0x38b1('0x30')]['sort']);_0x2e2c8d[_0x38b1('0x38')]=qs[_0x38b1('0x39')](_[_0x38b1('0x3a')](_0x18fbd3[_0x38b1('0x30')],_0x5ec7f1[_0x38b1('0x39')]),_0x146b26);if(_0x18fbd3[_0x38b1('0x30')][_0x38b1('0x3b')]){_0x2e2c8d[_0x38b1('0x38')]=_['merge'](_0x2e2c8d[_0x38b1('0x38')],{'$or':_['map'](_0x146b26,function(_0x400ac9){if(_0x400ac9['type']!==_0x38b1('0x3c')){var _0x3dda08={};_0x3dda08[_0x400ac9[_0x38b1('0x28')]]={'$like':'%'+_0x18fbd3['query'][_0x38b1('0x3b')]+'%'};return _0x3dda08;}})});}_0x2e2c8d=_['merge']({},_0x2e2c8d,_0x18fbd3['options']);var _0x48643c={'where':_0x2e2c8d[_0x38b1('0x38')]};return db[_0x38b1('0x2c')][_0x38b1('0x3d')](_0x48643c)[_0x38b1('0x23')](function(_0x2e7447){_0x3ef4ca[_0x38b1('0x3d')]=_0x2e7447;if(_0x18fbd3[_0x38b1('0x30')][_0x38b1('0x3e')]){_0x2e2c8d[_0x38b1('0x3f')]=[{'all':!![]}];}return db[_0x38b1('0x2c')][_0x38b1('0x40')](_0x2e2c8d);})['then'](function(_0x401388){_0x3ef4ca[_0x38b1('0x41')]=_0x401388;return _0x3ef4ca;})[_0x38b1('0x23')](respondWithFilteredResult(_0x3c4350,_0x2e2c8d))[_0x38b1('0x42')](handleError(_0x3c4350,null));};exports[_0x38b1('0x43')]=function(_0x45a21b,_0x473cf7){var _0x28b5c6={'raw':!![],'where':{'id':_0x45a21b[_0x38b1('0x44')]['id']}},_0x2821d7={};_0x2821d7[_0x38b1('0x2f')]=_[_0x38b1('0x45')](db[_0x38b1('0x2c')][_0x38b1('0x2d')]);_0x2821d7[_0x38b1('0x30')]=_[_0x38b1('0x45')](_0x45a21b[_0x38b1('0x30')]);_0x2821d7['filtears']=_[_0x38b1('0x31')](_0x2821d7['model'],_0x2821d7[_0x38b1('0x30')]);_0x28b5c6[_0x38b1('0x32')]=_[_0x38b1('0x31')](_0x2821d7[_0x38b1('0x2f')],qs['fields'](_0x45a21b[_0x38b1('0x30')][_0x38b1('0x33')]));_0x28b5c6[_0x38b1('0x32')]=_0x28b5c6['attributes'][_0x38b1('0x34')]?_0x28b5c6['attributes']:_0x2821d7[_0x38b1('0x2f')];if(_0x45a21b[_0x38b1('0x30')][_0x38b1('0x3e')]){_0x28b5c6[_0x38b1('0x3f')]=[{'all':!![]}];}_0x28b5c6=_[_0x38b1('0x46')]({},_0x28b5c6,_0x45a21b[_0x38b1('0x47')]);return db[_0x38b1('0x2c')]['find'](_0x28b5c6)[_0x38b1('0x23')](handleEntityNotFound(_0x473cf7,null))[_0x38b1('0x23')](respondWithResult(_0x473cf7,null))[_0x38b1('0x42')](handleError(_0x473cf7,null));};exports[_0x38b1('0x48')]=function(_0x3edf79,_0x2d2ef4){return db[_0x38b1('0x2c')][_0x38b1('0x48')](_0x3edf79[_0x38b1('0x49')],{})[_0x38b1('0x23')](function(_0x52b299){var _0x1a00f1=_0x3edf79[_0x38b1('0x4a')]['get']({'plain':!![]});if(!_0x1a00f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a00f1[_0x38b1('0x4b')]===_0x38b1('0x4a')){var _0x463b84=_0x52b299['get']({'plain':!![]});var _0x24f365=_0x38b1('0x25');return db[_0x38b1('0x4c')]['find']({'where':{'name':_0x24f365,'userProfileId':_0x1a00f1['userProfileId']},'raw':!![]})[_0x38b1('0x23')](function(_0x530ded){if(_0x530ded&&_0x530ded[_0x38b1('0x4d')]===0x0){return db[_0x38b1('0x4e')]['create']({'name':_0x463b84[_0x38b1('0x28')],'resourceId':_0x463b84['id'],'type':_0x530ded[_0x38b1('0x28')],'sectionId':_0x530ded['id']},{})[_0x38b1('0x23')](function(){return _0x52b299;});}else{return _0x52b299;}})[_0x38b1('0x42')](function(_0xeb8bcf){logger['error'](_0x38b1('0x4f'),_0xeb8bcf);throw _0xeb8bcf;});}return _0x52b299;})[_0x38b1('0x23')](respondWithResult(_0x2d2ef4,0xc9))['catch'](handleError(_0x2d2ef4,null));};exports[_0x38b1('0x21')]=function(_0x2c63ff,_0x44cb9c){if(_0x2c63ff[_0x38b1('0x49')]['id']){delete _0x2c63ff[_0x38b1('0x49')]['id'];}return db[_0x38b1('0x2c')][_0x38b1('0x50')]({'where':{'id':_0x2c63ff[_0x38b1('0x44')]['id']}})[_0x38b1('0x23')](handleEntityNotFound(_0x44cb9c,null))['then'](saveUpdates(_0x2c63ff[_0x38b1('0x49')],null))[_0x38b1('0x23')](respondWithResult(_0x44cb9c,null))['catch'](handleError(_0x44cb9c,null));};exports[_0x38b1('0x22')]=function(_0x3ed5dc,_0x104bd5){return db[_0x38b1('0x2c')][_0x38b1('0x50')]({'where':{'id':_0x3ed5dc[_0x38b1('0x44')]['id']}})[_0x38b1('0x23')](handleEntityNotFound(_0x104bd5,null))[_0x38b1('0x23')](removeEntity(_0x104bd5,null))[_0x38b1('0x42')](handleError(_0x104bd5,null));};exports['test']=function(_0x53759b,_0x217797,_0x373c70){var _0xb5ba34;return db[_0x38b1('0x2c')][_0x38b1('0x50')]({'where':{'id':_0x53759b[_0x38b1('0x44')]['id']},'attributes':['id',_0x38b1('0x51')]})['then'](handleEntityNotFound(_0x217797,null))[_0x38b1('0x23')](function(_0xb30156){if(_0xb30156){var _0x28d981=require('odbc')();_0x28d981[_0x38b1('0x52')](_0xb30156[_0x38b1('0x51')]);_0x28d981[_0x38b1('0x53')]();return _0xb30156;}})['then'](respondWithResult(_0x217797,null))['catch'](handleError(_0x217797,null));}; \ No newline at end of file +var _0xcae8=['create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','odbc','dsn','closeSync','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','destroy','then','ODBC','UserProfileResource','stack','name','send','map','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','catch','rawAttributes','filtears','length','find'];(function(_0x2867a6,_0x10d905){var _0x4afc2b=function(_0x457840){while(--_0x457840){_0x2867a6['push'](_0x2867a6['shift']());}};_0x4afc2b(++_0x10d905);}(_0xcae8,0x118));var _0x8cae=function(_0x39d980,_0x15c127){_0x39d980=_0x39d980-0x0;var _0x33fcbc=_0xcae8[_0x39d980];return _0x33fcbc;};'use strict';var pdf=require(_0x8cae('0x0'));var emlformat=require(_0x8cae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8cae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cae('0x3'));var moment=require(_0x8cae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cae('0x5'));var util=require(_0x8cae('0x6'));var path=require('path');var sox=require(_0x8cae('0x7'));var csv=require(_0x8cae('0x8'));var ejs=require(_0x8cae('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8cae('0xa'));var crypto=require(_0x8cae('0xb'));var jsforce=require(_0x8cae('0xc'));var deskjs=require(_0x8cae('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cae('0xe'));var Papa=require(_0x8cae('0xf'));var Redis=require(_0x8cae('0x10'));var authService=require(_0x8cae('0x11'));var qs=require(_0x8cae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8cae('0x13'));var logger=require(_0x8cae('0x14'))(_0x8cae('0x15'));var utils=require(_0x8cae('0x16'));var config=require(_0x8cae('0x17'));var licenseUtil=require(_0x8cae('0x18'));var db=require(_0x8cae('0x19'))['db'];function respondWithStatusCode(_0x5d3a94,_0x2d02c2){_0x2d02c2=_0x2d02c2||0xcc;return function(_0xa2c8c0){if(_0xa2c8c0){return _0x5d3a94[_0x8cae('0x1a')](_0x2d02c2);}return _0x5d3a94['status'](_0x2d02c2)[_0x8cae('0x1b')]();};}function respondWithResult(_0x2388f1,_0x112ccd){_0x112ccd=_0x112ccd||0xc8;return function(_0x1c810a){if(_0x1c810a){return _0x2388f1[_0x8cae('0x1c')](_0x112ccd)[_0x8cae('0x1d')](_0x1c810a);}};}function respondWithFilteredResult(_0x165107,_0x557fef){return function(_0x531891){if(_0x531891){var _0x10c541=_0x531891['count'],_0x50d0f8=_0x557fef['offset'],_0x1e84d1=_0x557fef[_0x8cae('0x1e')]+_0x557fef['limit'],_0x101015;if(_0x1e84d1>=_0x10c541){_0x1e84d1=_0x10c541;_0x101015=0xc8;}else{_0x101015=0xce;}_0x165107['status'](_0x101015);return _0x165107[_0x8cae('0x1f')](_0x8cae('0x20'),_0x50d0f8+'-'+_0x1e84d1+'/'+_0x10c541)[_0x8cae('0x1d')](_0x531891);}return null;};}function patchUpdates(_0x3c3506){return function(_0x123d24){try{jsonpatch[_0x8cae('0x21')](_0x123d24,_0x3c3506,!![]);}catch(_0x18a9a0){return BPromise[_0x8cae('0x22')](_0x18a9a0);}return _0x123d24[_0x8cae('0x23')]();};}function saveUpdates(_0x1ed205,_0x45dcd8){return function(_0x2dee88){if(_0x2dee88){return _0x2dee88['update'](_0x1ed205)['then'](function(_0x564f82){return _0x564f82;});}return null;};}function removeEntity(_0x4c80f5,_0x29a49b){return function(_0xbe9e){if(_0xbe9e){return _0xbe9e[_0x8cae('0x24')]()[_0x8cae('0x25')](function(){var _0x4993c4=_0xbe9e['get']({'plain':!![]});var _0x3c8342=_0x8cae('0x26');return db[_0x8cae('0x27')][_0x8cae('0x24')]({'where':{'type':_0x3c8342,'resourceId':_0x4993c4['id']}})[_0x8cae('0x25')](function(){return _0xbe9e;});})[_0x8cae('0x25')](function(){_0x4c80f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4767b0,_0x1158d2){return function(_0x1e63bb){if(!_0x1e63bb){_0x4767b0['sendStatus'](0x194);}return _0x1e63bb;};}function handleError(_0x36be32,_0x4e1092){_0x4e1092=_0x4e1092||0x1f4;return function(_0x52dc58){logger['error'](_0x52dc58[_0x8cae('0x28')]);if(_0x52dc58[_0x8cae('0x29')]){delete _0x52dc58['name'];}_0x36be32[_0x8cae('0x1c')](_0x4e1092)[_0x8cae('0x2a')](_0x52dc58);};}exports['index']=function(_0x41c9b6,_0x43df99){var _0x5e8d4d={},_0x19c279={},_0x11ec90={'count':0x0,'rows':[]};var _0x173d24=_[_0x8cae('0x2b')](db['SquareOdbc']['rawAttributes'],function(_0x371363){return{'name':_0x371363['fieldName'],'type':_0x371363['type'][_0x8cae('0x2c')]};});_0x19c279[_0x8cae('0x2d')]=_['map'](_0x173d24,_0x8cae('0x29'));_0x19c279[_0x8cae('0x2e')]=_[_0x8cae('0x2f')](_0x41c9b6['query']);_0x19c279[_0x8cae('0x30')]=_[_0x8cae('0x31')](_0x19c279[_0x8cae('0x2d')],_0x19c279[_0x8cae('0x2e')]);_0x5e8d4d['attributes']=_[_0x8cae('0x31')](_0x19c279[_0x8cae('0x2d')],qs[_0x8cae('0x32')](_0x41c9b6[_0x8cae('0x2e')][_0x8cae('0x32')]));_0x5e8d4d[_0x8cae('0x33')]=_0x5e8d4d['attributes']['length']?_0x5e8d4d['attributes']:_0x19c279[_0x8cae('0x2d')];if(!_0x41c9b6['query'][_0x8cae('0x34')]('nolimit')){_0x5e8d4d[_0x8cae('0x35')]=qs[_0x8cae('0x35')](_0x41c9b6[_0x8cae('0x2e')][_0x8cae('0x35')]);_0x5e8d4d['offset']=qs['offset'](_0x41c9b6['query']['offset']);}_0x5e8d4d[_0x8cae('0x36')]=qs[_0x8cae('0x37')](_0x41c9b6[_0x8cae('0x2e')][_0x8cae('0x37')]);_0x5e8d4d[_0x8cae('0x38')]=qs['filters'](_['pick'](_0x41c9b6['query'],_0x19c279[_0x8cae('0x30')]),_0x173d24);if(_0x41c9b6['query'][_0x8cae('0x39')]){_0x5e8d4d['where']=_[_0x8cae('0x3a')](_0x5e8d4d['where'],{'$or':_[_0x8cae('0x2b')](_0x173d24,function(_0xb822c5){if(_0xb822c5[_0x8cae('0x3b')]!==_0x8cae('0x3c')){var _0xfeaf35={};_0xfeaf35[_0xb822c5[_0x8cae('0x29')]]={'$like':'%'+_0x41c9b6[_0x8cae('0x2e')][_0x8cae('0x39')]+'%'};return _0xfeaf35;}})});}_0x5e8d4d=_[_0x8cae('0x3a')]({},_0x5e8d4d,_0x41c9b6[_0x8cae('0x3d')]);var _0x1ff242={'where':_0x5e8d4d[_0x8cae('0x38')]};return db[_0x8cae('0x3e')]['count'](_0x1ff242)[_0x8cae('0x25')](function(_0x450160){_0x11ec90['count']=_0x450160;if(_0x41c9b6[_0x8cae('0x2e')][_0x8cae('0x3f')]){_0x5e8d4d[_0x8cae('0x40')]=[{'all':!![]}];}return db[_0x8cae('0x3e')][_0x8cae('0x41')](_0x5e8d4d);})[_0x8cae('0x25')](function(_0x5b5915){_0x11ec90[_0x8cae('0x42')]=_0x5b5915;return _0x11ec90;})[_0x8cae('0x25')](respondWithFilteredResult(_0x43df99,_0x5e8d4d))[_0x8cae('0x43')](handleError(_0x43df99,null));};exports['show']=function(_0x80af09,_0x465a96){var _0x2a2b3b={'raw':!![],'where':{'id':_0x80af09['params']['id']}},_0x316bc3={};_0x316bc3[_0x8cae('0x2d')]=_[_0x8cae('0x2f')](db[_0x8cae('0x3e')][_0x8cae('0x44')]);_0x316bc3['query']=_[_0x8cae('0x2f')](_0x80af09['query']);_0x316bc3[_0x8cae('0x45')]=_[_0x8cae('0x31')](_0x316bc3['model'],_0x316bc3['query']);_0x2a2b3b[_0x8cae('0x33')]=_[_0x8cae('0x31')](_0x316bc3[_0x8cae('0x2d')],qs[_0x8cae('0x32')](_0x80af09[_0x8cae('0x2e')][_0x8cae('0x32')]));_0x2a2b3b[_0x8cae('0x33')]=_0x2a2b3b[_0x8cae('0x33')][_0x8cae('0x46')]?_0x2a2b3b[_0x8cae('0x33')]:_0x316bc3[_0x8cae('0x2d')];if(_0x80af09[_0x8cae('0x2e')]['includeAll']){_0x2a2b3b[_0x8cae('0x40')]=[{'all':!![]}];}_0x2a2b3b=_[_0x8cae('0x3a')]({},_0x2a2b3b,_0x80af09[_0x8cae('0x3d')]);return db[_0x8cae('0x3e')][_0x8cae('0x47')](_0x2a2b3b)[_0x8cae('0x25')](handleEntityNotFound(_0x465a96,null))[_0x8cae('0x25')](respondWithResult(_0x465a96,null))[_0x8cae('0x43')](handleError(_0x465a96,null));};exports[_0x8cae('0x48')]=function(_0x57d8f0,_0x1ae53e){return db[_0x8cae('0x3e')][_0x8cae('0x48')](_0x57d8f0[_0x8cae('0x49')],{})[_0x8cae('0x25')](function(_0x3fc71e){var _0x4a7c85=_0x57d8f0['user'][_0x8cae('0x4a')]({'plain':!![]});if(!_0x4a7c85)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a7c85[_0x8cae('0x4b')]===_0x8cae('0x4c')){var _0x2786c8=_0x3fc71e[_0x8cae('0x4a')]({'plain':!![]});var _0x3d9fb0=_0x8cae('0x26');return db[_0x8cae('0x4d')]['find']({'where':{'name':_0x3d9fb0,'userProfileId':_0x4a7c85[_0x8cae('0x4e')]},'raw':!![]})[_0x8cae('0x25')](function(_0x436d7e){if(_0x436d7e&&_0x436d7e[_0x8cae('0x4f')]===0x0){return db['UserProfileResource'][_0x8cae('0x48')]({'name':_0x2786c8[_0x8cae('0x29')],'resourceId':_0x2786c8['id'],'type':_0x436d7e[_0x8cae('0x29')],'sectionId':_0x436d7e['id']},{})[_0x8cae('0x25')](function(){return _0x3fc71e;});}else{return _0x3fc71e;}})[_0x8cae('0x43')](function(_0x1bf871){logger[_0x8cae('0x50')](_0x8cae('0x51'),_0x1bf871);throw _0x1bf871;});}return _0x3fc71e;})[_0x8cae('0x25')](respondWithResult(_0x1ae53e,0xc9))[_0x8cae('0x43')](handleError(_0x1ae53e,null));};exports[_0x8cae('0x52')]=function(_0x229aa6,_0xf2fdac){if(_0x229aa6[_0x8cae('0x49')]['id']){delete _0x229aa6['body']['id'];}return db[_0x8cae('0x3e')][_0x8cae('0x47')]({'where':{'id':_0x229aa6[_0x8cae('0x53')]['id']}})['then'](handleEntityNotFound(_0xf2fdac,null))[_0x8cae('0x25')](saveUpdates(_0x229aa6[_0x8cae('0x49')],null))[_0x8cae('0x25')](respondWithResult(_0xf2fdac,null))[_0x8cae('0x43')](handleError(_0xf2fdac,null));};exports[_0x8cae('0x24')]=function(_0xc35aa1,_0xa47871){return db[_0x8cae('0x3e')][_0x8cae('0x47')]({'where':{'id':_0xc35aa1[_0x8cae('0x53')]['id']}})[_0x8cae('0x25')](handleEntityNotFound(_0xa47871,null))[_0x8cae('0x25')](removeEntity(_0xa47871,null))[_0x8cae('0x43')](handleError(_0xa47871,null));};exports[_0x8cae('0x54')]=function(_0x2a8947,_0x4f8786,_0x79a8cc){var _0x1a8891;return db['SquareOdbc'][_0x8cae('0x47')]({'where':{'id':_0x2a8947['params']['id']},'attributes':['id','dsn']})[_0x8cae('0x25')](handleEntityNotFound(_0x4f8786,null))[_0x8cae('0x25')](function(_0x251b72){if(_0x251b72){var _0x35b0a7=require(_0x8cae('0x55'))();_0x35b0a7['openSync'](_0x251b72[_0x8cae('0x56')]);_0x35b0a7[_0x8cae('0x57')]();return _0x251b72;}})['then'](respondWithResult(_0x4f8786,null))['catch'](handleError(_0x4f8786,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index d62af79..cc24d96 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 _0xec18=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util'];(function(_0x372b3f,_0x5a6db0){var _0x318f67=function(_0x5f1161){while(--_0x5f1161){_0x372b3f['push'](_0x372b3f['shift']());}};_0x318f67(++_0x5a6db0);}(_0xec18,0x12a));var _0x8ec1=function(_0x391a22,_0x55de8c){_0x391a22=_0x391a22-0x0;var _0x472d79=_0xec18[_0x391a22];return _0x472d79;};'use strict';var _=require('lodash');var util=require(_0x8ec1('0x0'));var logger=require(_0x8ec1('0x1'))(_0x8ec1('0x2'));var moment=require('moment');var BPromise=require(_0x8ec1('0x3'));var rp=require(_0x8ec1('0x4'));var fs=require('fs');var path=require(_0x8ec1('0x5'));var rimraf=require(_0x8ec1('0x6'));var config=require(_0x8ec1('0x7'));var attributes=require(_0x8ec1('0x8'));module[_0x8ec1('0x9')]=function(_0x5b2b75,_0x8fdcda){return _0x5b2b75[_0x8ec1('0xa')](_0x8ec1('0xb'),attributes,{'tableName':_0x8ec1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9421=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x31d525,_0x186377){var _0x3febd5=function(_0x563b53){while(--_0x563b53){_0x31d525['push'](_0x31d525['shift']());}};_0x3febd5(++_0x186377);}(_0x9421,0x155));var _0x1942=function(_0x5d8772,_0x599ece){_0x5d8772=_0x5d8772-0x0;var _0x26d4fb=_0x9421[_0x5d8772];return _0x26d4fb;};'use strict';var _=require(_0x1942('0x0'));var util=require(_0x1942('0x1'));var logger=require(_0x1942('0x2'))(_0x1942('0x3'));var moment=require(_0x1942('0x4'));var BPromise=require('bluebird');var rp=require(_0x1942('0x5'));var fs=require('fs');var path=require(_0x1942('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1942('0x7'));module[_0x1942('0x8')]=function(_0x2db4b5,_0x5c4801){return _0x2db4b5[_0x1942('0x9')](_0x1942('0xa'),attributes,{'tableName':_0x1942('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 7de1f59..069075b 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 _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','options','where','include','map','attributes'];(function(_0x2fda8e,_0x328fb){var _0xe83a8=function(_0x5eefaa){while(--_0x5eefaa){_0x2fda8e['push'](_0x2fda8e['shift']());}};_0xe83a8(++_0x328fb);}(_0x814b,0x1a2));var _0xb814=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x814b[_0x9fd887];return _0x1a54ab;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['SquareOdbc']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowSquareOdbc',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x5289d6,_0x7bd6d2){var _0x52b145=function(_0x11fb06){while(--_0x11fb06){_0x5289d6['push'](_0x5289d6['shift']());}};_0x52b145(++_0x7bd6d2);}(_0x008c,0x188));var _0xc008=function(_0x48bb8f,_0x15ae9f){_0x48bb8f=_0x48bb8f-0x0;var _0x115417=_0x008c[_0x48bb8f];return _0x115417;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a508484..62e4bf3 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 _0xdd4f=['destroy','removeUsers','multer','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','getUsers','post','create','/:id/users','addUsers','put','update','delete'];(function(_0x40fb24,_0x14b78d){var _0x1ee22c=function(_0x2f632c){while(--_0x2f632c){_0x40fb24['push'](_0x40fb24['shift']());}};_0x1ee22c(++_0x14b78d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5a2f6a,_0x1ce97a){_0x5a2f6a=_0x5a2f6a-0x0;var _0x4c836f=_0xdd4f[_0x5a2f6a];return _0x4c836f;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdd4('0x3'));var config=require(_0xfdd4('0x4'));var controller=require(_0xfdd4('0x5'));router['get']('/',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x7')]);router[_0xfdd4('0x8')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller['show']);router[_0xfdd4('0x8')]('/:id/users',auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xa')]);router[_0xfdd4('0xb')]('/',auth['isAuthenticated'](),controller[_0xfdd4('0xc')]);router['post'](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0xf')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')](_0xfdd4('0x9'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x12')]);router['delete'](_0xfdd4('0xd'),auth[_0xfdd4('0x6')](),controller[_0xfdd4('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc900=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create','addUsers','put','delete','destroy','exports','path'];(function(_0xc70d43,_0x17b0be){var _0x3dbb18=function(_0x4937c2){while(--_0x4937c2){_0xc70d43['push'](_0xc70d43['shift']());}};_0x3dbb18(++_0x17b0be);}(_0xc900,0xb3));var _0x0c90=function(_0x362c69,_0x550d22){_0x362c69=_0x362c69-0x0;var _0x5e4b85=_0xc900[_0x362c69];return _0x5e4b85;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var auth=require(_0x0c90('0x3'));var interaction=require(_0x0c90('0x4'));var config=require('../../config/environment');var controller=require(_0x0c90('0x5'));router[_0x0c90('0x6')]('/',auth[_0x0c90('0x7')](),controller[_0x0c90('0x8')]);router[_0x0c90('0x6')](_0x0c90('0x9'),auth['isAuthenticated'](),controller[_0x0c90('0xa')]);router[_0x0c90('0x6')](_0x0c90('0xb'),auth[_0x0c90('0x7')](),controller[_0x0c90('0xc')]);router[_0x0c90('0xd')]('/',auth[_0x0c90('0x7')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xd')](_0x0c90('0xb'),auth[_0x0c90('0x7')](),controller[_0x0c90('0xf')]);router[_0x0c90('0x10')]('/:id',auth[_0x0c90('0x7')](),controller['update']);router[_0x0c90('0x11')]('/:id',auth[_0x0c90('0x7')](),controller[_0x0c90('0x12')]);router[_0x0c90('0x11')](_0x0c90('0xb'),auth[_0x0c90('0x7')](),controller['removeUsers']);module[_0x0c90('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 4361ca0..ece79e7 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 _0xfbb5=['preproduction','toString','production','utf8','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x129d61,_0x4f611b){var _0x58bf5a=function(_0x5cb667){while(--_0x5cb667){_0x129d61['push'](_0x129d61['shift']());}};_0x58bf5a(++_0x4f611b);}(_0xfbb5,0x190));var _0x5fbb=function(_0xffdcef,_0x4ddad2){_0xffdcef=_0xffdcef-0x0;var _0x434328=_0xfbb5[_0xffdcef];return _0x434328;};'use strict';var Sequelize=require('sequelize');module[_0x5fbb('0x0')]={'name':{'type':Sequelize[_0x5fbb('0x1')],'unique':_0x5fbb('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x5fbb('0x3')]},'preproduction':{'type':Sequelize[_0x5fbb('0x4')](_0x5fbb('0x5')),'get':function(){if(this[_0x5fbb('0x6')](_0x5fbb('0x7'))){return this[_0x5fbb('0x6')]('preproduction')[_0x5fbb('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x5fbb('0x4')](_0x5fbb('0x5')),'get':function(){if(this[_0x5fbb('0x6')](_0x5fbb('0x9'))){return this['getDataValue'](_0x5fbb('0x9'))[_0x5fbb('0x8')](_0x5fbb('0xa'));}}}}; \ No newline at end of file +var _0x0927=['BLOB','long','getDataValue','preproduction','toString','utf8','production','sequelize','exports','STRING','name','TEXT'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x0927,0xd3));var _0x7092=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0927[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7092('0x0'));module[_0x7092('0x1')]={'name':{'type':Sequelize[_0x7092('0x2')],'unique':_0x7092('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x7092('0x4')]},'preproduction':{'type':Sequelize[_0x7092('0x5')](_0x7092('0x6')),'get':function(){if(this[_0x7092('0x7')](_0x7092('0x8'))){return this[_0x7092('0x7')](_0x7092('0x8'))[_0x7092('0x9')](_0x7092('0xa'));}}},'production':{'type':Sequelize[_0x7092('0x5')](_0x7092('0x6')),'get':function(){if(this[_0x7092('0x7')](_0x7092('0xb'))){return this[_0x7092('0x7')](_0x7092('0xb'))[_0x7092('0x9')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index dab3113..d56d6ac 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 _0x62f7=['attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','filtears','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','User','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','UserProfileResource','error','name','send','index','SquareProject','rawAttributes','type','key','model','map','query','keys','filters','intersection'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x62f7,0x1ad));var _0x762f=function(_0x264a4f,_0x432d1e){_0x264a4f=_0x264a4f-0x0;var _0x49af90=_0x62f7[_0x264a4f];return _0x49af90;};'use strict';var pdf=require(_0x762f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x762f('0x1'));var zipdir=require(_0x762f('0x2'));var jsonpatch=require(_0x762f('0x3'));var rp=require(_0x762f('0x4'));var moment=require(_0x762f('0x5'));var BPromise=require(_0x762f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x762f('0x7'));var sox=require('sox');var csv=require(_0x762f('0x8'));var ejs=require(_0x762f('0x9'));var fs=require('fs');var _=require(_0x762f('0xa'));var squel=require(_0x762f('0xb'));var crypto=require(_0x762f('0xc'));var jsforce=require(_0x762f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x762f('0x8'));var querystring=require('querystring');var Papa=require(_0x762f('0xe'));var Redis=require('ioredis');var authService=require(_0x762f('0xf'));var qs=require(_0x762f('0x10'));var as=require(_0x762f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x762f('0x12'));var utils=require(_0x762f('0x13'));var config=require(_0x762f('0x14'));var licenseUtil=require(_0x762f('0x15'));var db=require(_0x762f('0x16'))['db'];config[_0x762f('0x17')]=_[_0x762f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x762f('0x19'))(new Redis(config[_0x762f('0x17')]));require(_0x762f('0x1a'))[_0x762f('0x1b')](socket);function respondWithStatusCode(_0xe00dfc,_0x206e77){_0x206e77=_0x206e77||0xcc;return function(_0x48c4c7){if(_0x48c4c7){return _0xe00dfc[_0x762f('0x1c')](_0x206e77);}return _0xe00dfc[_0x762f('0x1d')](_0x206e77)[_0x762f('0x1e')]();};}function respondWithResult(_0x5d49fa,_0x2bca3e){_0x2bca3e=_0x2bca3e||0xc8;return function(_0xafae1b){if(_0xafae1b){return _0x5d49fa[_0x762f('0x1d')](_0x2bca3e)[_0x762f('0x1f')](_0xafae1b);}};}function respondWithFilteredResult(_0x1ab3e0,_0x3936ad){return function(_0x4c22a6){if(_0x4c22a6){var _0x3ed4d0=_0x4c22a6[_0x762f('0x20')],_0x4c3906=_0x3936ad[_0x762f('0x21')],_0x4fdc45=_0x3936ad[_0x762f('0x21')]+_0x3936ad['limit'],_0x3c81c7;if(_0x4fdc45>=_0x3ed4d0){_0x4fdc45=_0x3ed4d0;_0x3c81c7=0xc8;}else{_0x3c81c7=0xce;}_0x1ab3e0[_0x762f('0x1d')](_0x3c81c7);return _0x1ab3e0[_0x762f('0x22')]('Content-Range',_0x4c3906+'-'+_0x4fdc45+'/'+_0x3ed4d0)['json'](_0x4c22a6);}return null;};}function patchUpdates(_0x303d0a){return function(_0x34206a){try{jsonpatch[_0x762f('0x23')](_0x34206a,_0x303d0a,!![]);}catch(_0x4ad26d){return BPromise[_0x762f('0x24')](_0x4ad26d);}return _0x34206a[_0x762f('0x25')]();};}function saveUpdates(_0x31333e,_0x160e6a){return function(_0x42d4c3){if(_0x42d4c3){return _0x42d4c3['update'](_0x31333e)[_0x762f('0x26')](function(_0x1cc834){return _0x1cc834;});}return null;};}function removeEntity(_0x29fda9,_0x2639cd){return function(_0x41eb47){if(_0x41eb47){return _0x41eb47[_0x762f('0x27')]()[_0x762f('0x26')](function(){var _0x16dbf8=_0x41eb47[_0x762f('0x28')]({'plain':!![]});var _0x4e0ec6='SquareProjects';return db[_0x762f('0x29')][_0x762f('0x27')]({'where':{'type':_0x4e0ec6,'resourceId':_0x16dbf8['id']}})[_0x762f('0x26')](function(){return _0x41eb47;});})['then'](function(){_0x29fda9[_0x762f('0x1d')](0xcc)[_0x762f('0x1e')]();});}};}function handleEntityNotFound(_0x504942,_0x42ac3a){return function(_0xe7173c){if(!_0xe7173c){_0x504942[_0x762f('0x1c')](0x194);}return _0xe7173c;};}function handleError(_0x514413,_0x49c673){_0x49c673=_0x49c673||0x1f4;return function(_0x9ebfc6){logger[_0x762f('0x2a')](_0x9ebfc6['stack']);if(_0x9ebfc6[_0x762f('0x2b')]){delete _0x9ebfc6['name'];}_0x514413[_0x762f('0x1d')](_0x49c673)[_0x762f('0x2c')](_0x9ebfc6);};}exports[_0x762f('0x2d')]=function(_0x36d99f,_0x3d2883){var _0x3a4049={},_0x4f73aa={},_0x196a04={'count':0x0,'rows':[]};var _0x3d1ffa=_['map'](db[_0x762f('0x2e')][_0x762f('0x2f')],function(_0x422480){return{'name':_0x422480['fieldName'],'type':_0x422480[_0x762f('0x30')][_0x762f('0x31')]};});_0x4f73aa[_0x762f('0x32')]=_[_0x762f('0x33')](_0x3d1ffa,_0x762f('0x2b'));_0x4f73aa[_0x762f('0x34')]=_[_0x762f('0x35')](_0x36d99f[_0x762f('0x34')]);_0x4f73aa[_0x762f('0x36')]=_[_0x762f('0x37')](_0x4f73aa[_0x762f('0x32')],_0x4f73aa[_0x762f('0x34')]);_0x3a4049[_0x762f('0x38')]=_[_0x762f('0x37')](_0x4f73aa[_0x762f('0x32')],qs['fields'](_0x36d99f['query'][_0x762f('0x39')]));_0x3a4049[_0x762f('0x38')]=_0x3a4049['attributes']['length']?_0x3a4049[_0x762f('0x38')]:_0x4f73aa[_0x762f('0x32')];if(!_0x36d99f[_0x762f('0x34')]['hasOwnProperty'](_0x762f('0x3a'))){_0x3a4049[_0x762f('0x3b')]=qs[_0x762f('0x3b')](_0x36d99f[_0x762f('0x34')][_0x762f('0x3b')]);_0x3a4049[_0x762f('0x21')]=qs[_0x762f('0x21')](_0x36d99f[_0x762f('0x34')][_0x762f('0x21')]);}_0x3a4049['order']=qs[_0x762f('0x3c')](_0x36d99f[_0x762f('0x34')]['sort']);_0x3a4049[_0x762f('0x3d')]=qs[_0x762f('0x36')](_[_0x762f('0x3e')](_0x36d99f[_0x762f('0x34')],_0x4f73aa['filters']),_0x3d1ffa);if(_0x36d99f[_0x762f('0x34')][_0x762f('0x3f')]){_0x3a4049[_0x762f('0x3d')]=_[_0x762f('0x40')](_0x3a4049['where'],{'$or':_['map'](_0x3d1ffa,function(_0x66a1cf){if(_0x66a1cf['type']!==_0x762f('0x41')){var _0x5a5c67={};_0x5a5c67[_0x66a1cf[_0x762f('0x2b')]]={'$like':'%'+_0x36d99f[_0x762f('0x34')][_0x762f('0x3f')]+'%'};return _0x5a5c67;}})});}_0x3a4049=_[_0x762f('0x40')]({},_0x3a4049,_0x36d99f[_0x762f('0x42')]);var _0x16d0c5={'where':_0x3a4049['where']};return db[_0x762f('0x2e')]['count'](_0x16d0c5)[_0x762f('0x26')](function(_0x5939e2){_0x196a04[_0x762f('0x20')]=_0x5939e2;if(_0x36d99f['query']['includeAll']){_0x3a4049['include']=[{'all':!![]}];}return db[_0x762f('0x2e')][_0x762f('0x43')](_0x3a4049);})[_0x762f('0x26')](function(_0x2aec3c){_0x196a04[_0x762f('0x44')]=_0x2aec3c;return _0x196a04;})['then'](respondWithFilteredResult(_0x3d2883,_0x3a4049))[_0x762f('0x45')](handleError(_0x3d2883,null));};exports['show']=function(_0x406f89,_0x4532de){var _0x38ef07={'raw':![],'where':{'id':_0x406f89[_0x762f('0x46')]['id']}},_0x58a40d={};_0x58a40d['model']=_[_0x762f('0x35')](db[_0x762f('0x2e')][_0x762f('0x2f')]);_0x58a40d[_0x762f('0x34')]=_[_0x762f('0x35')](_0x406f89[_0x762f('0x34')]);_0x58a40d[_0x762f('0x47')]=_[_0x762f('0x37')](_0x58a40d['model'],_0x58a40d[_0x762f('0x34')]);_0x38ef07[_0x762f('0x38')]=_[_0x762f('0x37')](_0x58a40d[_0x762f('0x32')],qs[_0x762f('0x39')](_0x406f89[_0x762f('0x34')]['fields']));_0x38ef07[_0x762f('0x38')]=_0x38ef07[_0x762f('0x38')]['length']?_0x38ef07[_0x762f('0x38')]:_0x58a40d[_0x762f('0x32')];if(_0x406f89[_0x762f('0x34')][_0x762f('0x48')]){_0x38ef07[_0x762f('0x49')]=[{'all':!![]}];}_0x38ef07=_[_0x762f('0x40')]({},_0x38ef07,_0x406f89['options']);return db[_0x762f('0x2e')][_0x762f('0x4a')](_0x38ef07)[_0x762f('0x26')](handleEntityNotFound(_0x4532de,null))[_0x762f('0x26')](respondWithResult(_0x4532de,null))[_0x762f('0x45')](handleError(_0x4532de,null));};exports[_0x762f('0x4b')]=function(_0x3d5edb,_0x2a9540){return db['SquareProject']['create'](_0x3d5edb[_0x762f('0x4c')],{})[_0x762f('0x26')](function(_0x46b6a8){var _0x24d482=_0x3d5edb['user'][_0x762f('0x28')]({'plain':!![]});if(!_0x24d482)throw new Error(_0x762f('0x4d'));if(_0x24d482[_0x762f('0x4e')]===_0x762f('0x4f')){var _0x5ba400=_0x46b6a8[_0x762f('0x28')]({'plain':!![]});var _0x5cc1e4=_0x762f('0x50');return db[_0x762f('0x51')][_0x762f('0x4a')]({'where':{'name':_0x5cc1e4,'userProfileId':_0x24d482[_0x762f('0x52')]},'raw':!![]})[_0x762f('0x26')](function(_0x4232a4){if(_0x4232a4&&_0x4232a4[_0x762f('0x53')]===0x0){return db[_0x762f('0x29')][_0x762f('0x4b')]({'name':_0x5ba400['name'],'resourceId':_0x5ba400['id'],'type':_0x4232a4['name'],'sectionId':_0x4232a4['id']},{})[_0x762f('0x26')](function(){return _0x46b6a8;});}else{return _0x46b6a8;}})['catch'](function(_0x2ca9cf){logger['error'](_0x762f('0x54'),_0x2ca9cf);throw _0x2ca9cf;});}return _0x46b6a8;})[_0x762f('0x26')](respondWithResult(_0x2a9540,0xc9))['catch'](handleError(_0x2a9540,null));};exports[_0x762f('0x55')]=function(_0x3b8e49,_0x4c3d2b){if(_0x3b8e49['body']['id']){delete _0x3b8e49[_0x762f('0x4c')]['id'];}return db[_0x762f('0x2e')][_0x762f('0x4a')]({'where':{'id':_0x3b8e49['params']['id']}})['then'](handleEntityNotFound(_0x4c3d2b,null))[_0x762f('0x26')](saveUpdates(_0x3b8e49[_0x762f('0x4c')],null))['then'](respondWithResult(_0x4c3d2b,null))[_0x762f('0x45')](handleError(_0x4c3d2b,null));};exports[_0x762f('0x27')]=function(_0x14f628,_0x162215){return db[_0x762f('0x2e')][_0x762f('0x4a')]({'where':{'id':_0x14f628[_0x762f('0x46')]['id']}})[_0x762f('0x26')](handleEntityNotFound(_0x162215,null))['then'](removeEntity(_0x162215,null))['catch'](handleError(_0x162215,null));};exports[_0x762f('0x56')]=function(_0x572b36,_0x17db1b,_0x57d1a5){return db[_0x762f('0x2e')][_0x762f('0x4a')]({'where':{'id':_0x572b36['params']['id']}})[_0x762f('0x26')](handleEntityNotFound(_0x17db1b,null))[_0x762f('0x26')](function(_0x5fc1f3){if(_0x5fc1f3){return _0x5fc1f3[_0x762f('0x56')](_0x572b36[_0x762f('0x4c')][_0x762f('0x57')],_[_0x762f('0x58')](_0x572b36[_0x762f('0x4c')],['ids','id'])||{});}})[_0x762f('0x26')](respondWithResult(_0x17db1b,null))[_0x762f('0x45')](handleError(_0x17db1b,null));};exports[_0x762f('0x59')]=function(_0xa017e5,_0x17c5d4,_0x183031){return db['SquareProject'][_0x762f('0x4a')]({'where':{'id':_0xa017e5[_0x762f('0x46')]['id']}})[_0x762f('0x26')](handleEntityNotFound(_0x17c5d4,null))[_0x762f('0x26')](function(_0x1049a7){if(_0x1049a7){return _0x1049a7[_0x762f('0x59')](_0xa017e5['query'][_0x762f('0x57')])[_0x762f('0x26')](function(){if(_[_0x762f('0x5a')](_0xa017e5[_0x762f('0x34')]['ids'])){for(var _0x55bb2b=0x0;_0x55bb2b<_0xa017e5[_0x762f('0x34')][_0x762f('0x57')][_0x762f('0x5b')];_0x55bb2b+=0x1){socket[_0x762f('0x5c')](_0x762f('0x5d'),{'UserId':Number(_0xa017e5['query'][_0x762f('0x57')][_0x55bb2b]),'SquareProjectId':Number(_0xa017e5[_0x762f('0x46')]['id'])});}}else{socket[_0x762f('0x5c')](_0x762f('0x5d'),{'UserId':Number(_0xa017e5['query'][_0x762f('0x57')]),'SquareProjectId':Number(_0xa017e5[_0x762f('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x17c5d4,null))[_0x762f('0x45')](handleError(_0x17c5d4,null));};exports[_0x762f('0x5e')]=function(_0x490ef8,_0x1663eb,_0x5cd8a4){var _0x273e93={};var _0x332faa={};var _0xa40f07;var _0x122e07;return db['SquareProject']['findOne']({'where':{'id':_0x490ef8[_0x762f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1663eb,null))[_0x762f('0x26')](function(_0x2150c6){if(_0x2150c6){_0xa40f07=_0x2150c6;_0x332faa[_0x762f('0x32')]=_[_0x762f('0x35')](db[_0x762f('0x5f')][_0x762f('0x2f')]);_0x332faa[_0x762f('0x34')]=_['keys'](_0x490ef8[_0x762f('0x34')]);_0x332faa['filters']=_[_0x762f('0x37')](_0x332faa['model'],_0x332faa[_0x762f('0x34')]);_0x273e93[_0x762f('0x38')]=_['intersection'](_0x332faa[_0x762f('0x32')],qs[_0x762f('0x39')](_0x490ef8[_0x762f('0x34')][_0x762f('0x39')]));_0x273e93[_0x762f('0x38')]=_0x273e93[_0x762f('0x38')][_0x762f('0x5b')]?_0x273e93[_0x762f('0x38')]:_0x332faa[_0x762f('0x32')];_0x273e93['order']=qs['sort'](_0x490ef8['query'][_0x762f('0x3c')]);_0x273e93[_0x762f('0x3d')]=qs[_0x762f('0x36')](_[_0x762f('0x3e')](_0x490ef8[_0x762f('0x34')],_0x332faa['filters']));if(_0x490ef8[_0x762f('0x34')][_0x762f('0x3f')]){_0x273e93[_0x762f('0x3d')]=_['merge'](_0x273e93[_0x762f('0x3d')],{'$or':_['map'](_0x273e93[_0x762f('0x38')],function(_0xaeb91f){var _0x125d3f={};_0x125d3f[_0xaeb91f]={'$like':'%'+_0x490ef8['query']['filter']+'%'};return _0x125d3f;})});}_0x273e93=_[_0x762f('0x40')]({},_0x273e93,_0x490ef8['options']);return _0xa40f07[_0x762f('0x5e')](_0x273e93);}})[_0x762f('0x26')](function(_0xefa84c){if(_0xefa84c){_0x122e07=_0xefa84c[_0x762f('0x5b')];if(!_0x490ef8[_0x762f('0x34')][_0x762f('0x60')](_0x762f('0x3a'))){_0x273e93[_0x762f('0x3b')]=qs[_0x762f('0x3b')](_0x490ef8['query'][_0x762f('0x3b')]);_0x273e93[_0x762f('0x21')]=qs[_0x762f('0x21')](_0x490ef8['query']['offset']);}return _0xa40f07[_0x762f('0x5e')](_0x273e93);}})[_0x762f('0x26')](function(_0xfd343){if(_0xfd343){return _0xfd343?{'count':_0x122e07,'rows':_0xfd343}:null;}})['then'](respondWithResult(_0x1663eb,null))[_0x762f('0x45')](handleError(_0x1663eb,null));}; \ No newline at end of file +var _0x9add=['order','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','findOne','User','sort','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','destroy','get','SquareProjects','end','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x77651c,_0x2bd29b){var _0x1cba5d=function(_0x241ab3){while(--_0x241ab3){_0x77651c['push'](_0x77651c['shift']());}};_0x1cba5d(++_0x2bd29b);}(_0x9add,0x136));var _0xd9ad=function(_0x2b1b89,_0x1d53f7){_0x2b1b89=_0x2b1b89-0x0;var _0x45034a=_0x9add[_0x2b1b89];return _0x45034a;};'use strict';var pdf=require(_0xd9ad('0x0'));var emlformat=require(_0xd9ad('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd9ad('0x2'));var jsonpatch=require(_0xd9ad('0x3'));var rp=require(_0xd9ad('0x4'));var moment=require(_0xd9ad('0x5'));var BPromise=require(_0xd9ad('0x6'));var Mustache=require(_0xd9ad('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd9ad('0x8'));var ejs=require(_0xd9ad('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd9ad('0xa'));var crypto=require(_0xd9ad('0xb'));var jsforce=require(_0xd9ad('0xc'));var deskjs=require(_0xd9ad('0xd'));var toCsv=require(_0xd9ad('0x8'));var querystring=require(_0xd9ad('0xe'));var Papa=require('papaparse');var Redis=require(_0xd9ad('0xf'));var authService=require(_0xd9ad('0x10'));var qs=require(_0xd9ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd9ad('0x12'));var db=require(_0xd9ad('0x13'))['db'];config['redis']=_['defaults'](config[_0xd9ad('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd9ad('0x15'))(new Redis(config[_0xd9ad('0x14')]));require(_0xd9ad('0x16'))[_0xd9ad('0x17')](socket);function respondWithStatusCode(_0x5c0562,_0x1fff7c){_0x1fff7c=_0x1fff7c||0xcc;return function(_0x2dc047){if(_0x2dc047){return _0x5c0562[_0xd9ad('0x18')](_0x1fff7c);}return _0x5c0562[_0xd9ad('0x19')](_0x1fff7c)['end']();};}function respondWithResult(_0x5075bc,_0x5dccac){_0x5dccac=_0x5dccac||0xc8;return function(_0x82d551){if(_0x82d551){return _0x5075bc['status'](_0x5dccac)[_0xd9ad('0x1a')](_0x82d551);}};}function respondWithFilteredResult(_0x1eec07,_0x3d6e8d){return function(_0x2a46ab){if(_0x2a46ab){var _0x141a45=_0x2a46ab[_0xd9ad('0x1b')],_0x1f6de4=_0x3d6e8d[_0xd9ad('0x1c')],_0x1f28ec=_0x3d6e8d[_0xd9ad('0x1c')]+_0x3d6e8d[_0xd9ad('0x1d')],_0x431531;if(_0x1f28ec>=_0x141a45){_0x1f28ec=_0x141a45;_0x431531=0xc8;}else{_0x431531=0xce;}_0x1eec07[_0xd9ad('0x19')](_0x431531);return _0x1eec07[_0xd9ad('0x1e')]('Content-Range',_0x1f6de4+'-'+_0x1f28ec+'/'+_0x141a45)[_0xd9ad('0x1a')](_0x2a46ab);}return null;};}function patchUpdates(_0x495a1e){return function(_0x20c000){try{jsonpatch[_0xd9ad('0x1f')](_0x20c000,_0x495a1e,!![]);}catch(_0x1d45f9){return BPromise['reject'](_0x1d45f9);}return _0x20c000[_0xd9ad('0x20')]();};}function saveUpdates(_0x26c613,_0xf80c2f){return function(_0x357fa3){if(_0x357fa3){return _0x357fa3[_0xd9ad('0x21')](_0x26c613)[_0xd9ad('0x22')](function(_0xc2837b){return _0xc2837b;});}return null;};}function removeEntity(_0xc4617d,_0x50450a){return function(_0x1507c1){if(_0x1507c1){return _0x1507c1[_0xd9ad('0x23')]()[_0xd9ad('0x22')](function(){var _0x401d59=_0x1507c1[_0xd9ad('0x24')]({'plain':!![]});var _0x4a1c42=_0xd9ad('0x25');return db['UserProfileResource'][_0xd9ad('0x23')]({'where':{'type':_0x4a1c42,'resourceId':_0x401d59['id']}})[_0xd9ad('0x22')](function(){return _0x1507c1;});})[_0xd9ad('0x22')](function(){_0xc4617d['status'](0xcc)[_0xd9ad('0x26')]();});}};}function handleEntityNotFound(_0x1c5890,_0x631d66){return function(_0x23f41f){if(!_0x23f41f){_0x1c5890[_0xd9ad('0x18')](0x194);}return _0x23f41f;};}function handleError(_0xac832b,_0x41aaa7){_0x41aaa7=_0x41aaa7||0x1f4;return function(_0x2c2926){logger[_0xd9ad('0x27')](_0x2c2926[_0xd9ad('0x28')]);if(_0x2c2926[_0xd9ad('0x29')]){delete _0x2c2926[_0xd9ad('0x29')];}_0xac832b[_0xd9ad('0x19')](_0x41aaa7)[_0xd9ad('0x2a')](_0x2c2926);};}exports['index']=function(_0x3bb468,_0x266329){var _0x51c63e={},_0x4b2a63={},_0x2b7286={'count':0x0,'rows':[]};var _0xdc2197=_[_0xd9ad('0x2b')](db[_0xd9ad('0x2c')][_0xd9ad('0x2d')],function(_0x31aa07){return{'name':_0x31aa07['fieldName'],'type':_0x31aa07[_0xd9ad('0x2e')][_0xd9ad('0x2f')]};});_0x4b2a63[_0xd9ad('0x30')]=_[_0xd9ad('0x2b')](_0xdc2197,_0xd9ad('0x29'));_0x4b2a63[_0xd9ad('0x31')]=_[_0xd9ad('0x32')](_0x3bb468[_0xd9ad('0x31')]);_0x4b2a63[_0xd9ad('0x33')]=_[_0xd9ad('0x34')](_0x4b2a63[_0xd9ad('0x30')],_0x4b2a63['query']);_0x51c63e['attributes']=_[_0xd9ad('0x34')](_0x4b2a63[_0xd9ad('0x30')],qs[_0xd9ad('0x35')](_0x3bb468[_0xd9ad('0x31')]['fields']));_0x51c63e[_0xd9ad('0x36')]=_0x51c63e[_0xd9ad('0x36')][_0xd9ad('0x37')]?_0x51c63e[_0xd9ad('0x36')]:_0x4b2a63[_0xd9ad('0x30')];if(!_0x3bb468[_0xd9ad('0x31')][_0xd9ad('0x38')](_0xd9ad('0x39'))){_0x51c63e[_0xd9ad('0x1d')]=qs[_0xd9ad('0x1d')](_0x3bb468[_0xd9ad('0x31')]['limit']);_0x51c63e[_0xd9ad('0x1c')]=qs[_0xd9ad('0x1c')](_0x3bb468[_0xd9ad('0x31')][_0xd9ad('0x1c')]);}_0x51c63e[_0xd9ad('0x3a')]=qs['sort'](_0x3bb468['query']['sort']);_0x51c63e[_0xd9ad('0x3b')]=qs[_0xd9ad('0x33')](_['pick'](_0x3bb468[_0xd9ad('0x31')],_0x4b2a63[_0xd9ad('0x33')]),_0xdc2197);if(_0x3bb468[_0xd9ad('0x31')]['filter']){_0x51c63e[_0xd9ad('0x3b')]=_['merge'](_0x51c63e['where'],{'$or':_['map'](_0xdc2197,function(_0x411f69){if(_0x411f69[_0xd9ad('0x2e')]!==_0xd9ad('0x3c')){var _0x540f75={};_0x540f75[_0x411f69[_0xd9ad('0x29')]]={'$like':'%'+_0x3bb468['query'][_0xd9ad('0x3d')]+'%'};return _0x540f75;}})});}_0x51c63e=_[_0xd9ad('0x3e')]({},_0x51c63e,_0x3bb468[_0xd9ad('0x3f')]);var _0xd38935={'where':_0x51c63e[_0xd9ad('0x3b')]};return db[_0xd9ad('0x2c')]['count'](_0xd38935)[_0xd9ad('0x22')](function(_0x52edb9){_0x2b7286[_0xd9ad('0x1b')]=_0x52edb9;if(_0x3bb468['query'][_0xd9ad('0x40')]){_0x51c63e[_0xd9ad('0x41')]=[{'all':!![]}];}return db[_0xd9ad('0x2c')][_0xd9ad('0x42')](_0x51c63e);})[_0xd9ad('0x22')](function(_0xcc11d){_0x2b7286[_0xd9ad('0x43')]=_0xcc11d;return _0x2b7286;})[_0xd9ad('0x22')](respondWithFilteredResult(_0x266329,_0x51c63e))[_0xd9ad('0x44')](handleError(_0x266329,null));};exports[_0xd9ad('0x45')]=function(_0x371a78,_0x7013ee){var _0x577386={'raw':![],'where':{'id':_0x371a78[_0xd9ad('0x46')]['id']}},_0x115a06={};_0x115a06[_0xd9ad('0x30')]=_[_0xd9ad('0x32')](db[_0xd9ad('0x2c')]['rawAttributes']);_0x115a06[_0xd9ad('0x31')]=_['keys'](_0x371a78[_0xd9ad('0x31')]);_0x115a06[_0xd9ad('0x47')]=_['intersection'](_0x115a06[_0xd9ad('0x30')],_0x115a06['query']);_0x577386[_0xd9ad('0x36')]=_[_0xd9ad('0x34')](_0x115a06[_0xd9ad('0x30')],qs[_0xd9ad('0x35')](_0x371a78[_0xd9ad('0x31')]['fields']));_0x577386[_0xd9ad('0x36')]=_0x577386[_0xd9ad('0x36')]['length']?_0x577386[_0xd9ad('0x36')]:_0x115a06[_0xd9ad('0x30')];if(_0x371a78[_0xd9ad('0x31')][_0xd9ad('0x40')]){_0x577386[_0xd9ad('0x41')]=[{'all':!![]}];}_0x577386=_[_0xd9ad('0x3e')]({},_0x577386,_0x371a78[_0xd9ad('0x3f')]);return db[_0xd9ad('0x2c')][_0xd9ad('0x48')](_0x577386)[_0xd9ad('0x22')](handleEntityNotFound(_0x7013ee,null))[_0xd9ad('0x22')](respondWithResult(_0x7013ee,null))[_0xd9ad('0x44')](handleError(_0x7013ee,null));};exports[_0xd9ad('0x49')]=function(_0x161814,_0x202344){return db['SquareProject'][_0xd9ad('0x49')](_0x161814['body'],{})['then'](function(_0x5847f7){var _0x482127=_0x161814['user'][_0xd9ad('0x24')]({'plain':!![]});if(!_0x482127)throw new Error(_0xd9ad('0x4a'));if(_0x482127[_0xd9ad('0x4b')]===_0xd9ad('0x4c')){var _0x370698=_0x5847f7[_0xd9ad('0x24')]({'plain':!![]});var _0x36dcd6=_0xd9ad('0x25');return db[_0xd9ad('0x4d')][_0xd9ad('0x48')]({'where':{'name':_0x36dcd6,'userProfileId':_0x482127[_0xd9ad('0x4e')]},'raw':!![]})[_0xd9ad('0x22')](function(_0x454f21){if(_0x454f21&&_0x454f21[_0xd9ad('0x4f')]===0x0){return db['UserProfileResource'][_0xd9ad('0x49')]({'name':_0x370698['name'],'resourceId':_0x370698['id'],'type':_0x454f21[_0xd9ad('0x29')],'sectionId':_0x454f21['id']},{})[_0xd9ad('0x22')](function(){return _0x5847f7;});}else{return _0x5847f7;}})[_0xd9ad('0x44')](function(_0x535b08){logger[_0xd9ad('0x27')](_0xd9ad('0x50'),_0x535b08);throw _0x535b08;});}return _0x5847f7;})[_0xd9ad('0x22')](respondWithResult(_0x202344,0xc9))[_0xd9ad('0x44')](handleError(_0x202344,null));};exports[_0xd9ad('0x21')]=function(_0x3150b0,_0x104ac0){if(_0x3150b0[_0xd9ad('0x51')]['id']){delete _0x3150b0[_0xd9ad('0x51')]['id'];}return db[_0xd9ad('0x2c')]['find']({'where':{'id':_0x3150b0[_0xd9ad('0x46')]['id']}})[_0xd9ad('0x22')](handleEntityNotFound(_0x104ac0,null))[_0xd9ad('0x22')](saveUpdates(_0x3150b0['body'],null))[_0xd9ad('0x22')](respondWithResult(_0x104ac0,null))[_0xd9ad('0x44')](handleError(_0x104ac0,null));};exports[_0xd9ad('0x23')]=function(_0x2049ab,_0x45de3b){return db[_0xd9ad('0x2c')][_0xd9ad('0x48')]({'where':{'id':_0x2049ab[_0xd9ad('0x46')]['id']}})[_0xd9ad('0x22')](handleEntityNotFound(_0x45de3b,null))[_0xd9ad('0x22')](removeEntity(_0x45de3b,null))[_0xd9ad('0x44')](handleError(_0x45de3b,null));};exports[_0xd9ad('0x52')]=function(_0x2fa611,_0x1a9a06,_0xdd0e6b){return db['SquareProject'][_0xd9ad('0x48')]({'where':{'id':_0x2fa611[_0xd9ad('0x46')]['id']}})[_0xd9ad('0x22')](handleEntityNotFound(_0x1a9a06,null))['then'](function(_0x3c11c6){if(_0x3c11c6){return _0x3c11c6[_0xd9ad('0x52')](_0x2fa611[_0xd9ad('0x51')][_0xd9ad('0x53')],_[_0xd9ad('0x54')](_0x2fa611[_0xd9ad('0x51')],[_0xd9ad('0x53'),'id'])||{});}})[_0xd9ad('0x22')](respondWithResult(_0x1a9a06,null))[_0xd9ad('0x44')](handleError(_0x1a9a06,null));};exports['removeUsers']=function(_0x42a684,_0x14314b,_0x5f57f8){return db[_0xd9ad('0x2c')][_0xd9ad('0x48')]({'where':{'id':_0x42a684['params']['id']}})[_0xd9ad('0x22')](handleEntityNotFound(_0x14314b,null))['then'](function(_0x1dc2bd){if(_0x1dc2bd){return _0x1dc2bd[_0xd9ad('0x55')](_0x42a684[_0xd9ad('0x31')][_0xd9ad('0x53')])[_0xd9ad('0x22')](function(){if(_['isArray'](_0x42a684['query'][_0xd9ad('0x53')])){for(var _0x1b87fc=0x0;_0x1b87fc<_0x42a684[_0xd9ad('0x31')][_0xd9ad('0x53')][_0xd9ad('0x37')];_0x1b87fc+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x42a684['query']['ids'][_0x1b87fc]),'SquareProjectId':Number(_0x42a684[_0xd9ad('0x46')]['id'])});}}else{socket[_0xd9ad('0x56')](_0xd9ad('0x57'),{'UserId':Number(_0x42a684[_0xd9ad('0x31')]['ids']),'SquareProjectId':Number(_0x42a684[_0xd9ad('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x14314b,null))['catch'](handleError(_0x14314b,null));};exports[_0xd9ad('0x58')]=function(_0x121eef,_0x432898,_0x276ff0){var _0x252f6b={};var _0xc796f1={};var _0x25ae75;var _0xb9d4b4;return db[_0xd9ad('0x2c')][_0xd9ad('0x59')]({'where':{'id':_0x121eef[_0xd9ad('0x46')]['id']}})[_0xd9ad('0x22')](handleEntityNotFound(_0x432898,null))[_0xd9ad('0x22')](function(_0x4436cf){if(_0x4436cf){_0x25ae75=_0x4436cf;_0xc796f1[_0xd9ad('0x30')]=_[_0xd9ad('0x32')](db[_0xd9ad('0x5a')][_0xd9ad('0x2d')]);_0xc796f1['query']=_['keys'](_0x121eef['query']);_0xc796f1[_0xd9ad('0x33')]=_[_0xd9ad('0x34')](_0xc796f1[_0xd9ad('0x30')],_0xc796f1['query']);_0x252f6b[_0xd9ad('0x36')]=_[_0xd9ad('0x34')](_0xc796f1[_0xd9ad('0x30')],qs[_0xd9ad('0x35')](_0x121eef[_0xd9ad('0x31')]['fields']));_0x252f6b[_0xd9ad('0x36')]=_0x252f6b['attributes'][_0xd9ad('0x37')]?_0x252f6b[_0xd9ad('0x36')]:_0xc796f1[_0xd9ad('0x30')];_0x252f6b[_0xd9ad('0x3a')]=qs[_0xd9ad('0x5b')](_0x121eef[_0xd9ad('0x31')][_0xd9ad('0x5b')]);_0x252f6b['where']=qs[_0xd9ad('0x33')](_['pick'](_0x121eef[_0xd9ad('0x31')],_0xc796f1['filters']));if(_0x121eef[_0xd9ad('0x31')]['filter']){_0x252f6b[_0xd9ad('0x3b')]=_['merge'](_0x252f6b[_0xd9ad('0x3b')],{'$or':_['map'](_0x252f6b[_0xd9ad('0x36')],function(_0x1c29ee){var _0x393aaf={};_0x393aaf[_0x1c29ee]={'$like':'%'+_0x121eef['query']['filter']+'%'};return _0x393aaf;})});}_0x252f6b=_['merge']({},_0x252f6b,_0x121eef[_0xd9ad('0x3f')]);return _0x25ae75[_0xd9ad('0x58')](_0x252f6b);}})['then'](function(_0x2338e1){if(_0x2338e1){_0xb9d4b4=_0x2338e1[_0xd9ad('0x37')];if(!_0x121eef['query']['hasOwnProperty'](_0xd9ad('0x39'))){_0x252f6b[_0xd9ad('0x1d')]=qs[_0xd9ad('0x1d')](_0x121eef[_0xd9ad('0x31')][_0xd9ad('0x1d')]);_0x252f6b[_0xd9ad('0x1c')]=qs[_0xd9ad('0x1c')](_0x121eef[_0xd9ad('0x31')][_0xd9ad('0x1c')]);}return _0x25ae75['getUsers'](_0x252f6b);}})[_0xd9ad('0x22')](function(_0x4688a4){if(_0x4688a4){return _0x4688a4?{'count':_0xb9d4b4,'rows':_0x4688a4}:null;}})[_0xd9ad('0x22')](respondWithResult(_0x432898,null))[_0xd9ad('0x44')](handleError(_0x432898,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ad06107..33c996d 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 _0x2a5e=['hook','events','setMaxListeners','save','update','remove','emit'];(function(_0x301148,_0x25b884){var _0x42ce24=function(_0x44ba51){while(--_0x44ba51){_0x301148['push'](_0x301148['shift']());}};_0x42ce24(++_0x25b884);}(_0x2a5e,0xf6));var _0xe2a5=function(_0x22b515,_0x3fadc7){_0x22b515=_0x22b515-0x0;var _0x5011d5=_0x2a5e[_0x22b515];return _0x5011d5;};'use strict';var EventEmitter=require(_0xe2a5('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe2a5('0x1')](0x0);var events={'afterCreate':_0xe2a5('0x2'),'afterUpdate':_0xe2a5('0x3'),'afterDestroy':_0xe2a5('0x4')};function emitEvent(_0x380a24){return function(_0x409a51,_0x75f3ea,_0x913464){SquareProjectEvents['emit'](_0x380a24+':'+_0x409a51['id'],_0x409a51);SquareProjectEvents[_0xe2a5('0x5')](_0x380a24,_0x409a51);_0x913464(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xe2a5('0x6')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xde0f=['hasOwnProperty','hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x340c40,_0x144d72){var _0x401b0d=function(_0x2cb157){while(--_0x2cb157){_0x340c40['push'](_0x340c40['shift']());}};_0x401b0d(++_0x144d72);}(_0xde0f,0x1ab));var _0xfde0=function(_0x309697,_0x1a4cc4){_0x309697=_0x309697-0x0;var _0x4ef6fa=_0xde0f[_0x309697];return _0x4ef6fa;};'use strict';var EventEmitter=require(_0xfde0('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xfde0('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfde0('0x2'),'afterDestroy':_0xfde0('0x3')};function emitEvent(_0x30a1fe){return function(_0x5c29c8,_0xb03d1f,_0x3efb6a){SquareProjectEvents[_0xfde0('0x4')](_0x30a1fe+':'+_0x5c29c8['id'],_0x5c29c8);SquareProjectEvents[_0xfde0('0x4')](_0x30a1fe,_0x5c29c8);_0x3efb6a(null);};}for(var e in events){if(events[_0xfde0('0x5')](e)){var event=events[e];SquareProject[_0xfde0('0x6')](e,emitEvent(event));}}module[_0xfde0('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 1578182..f32662a 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 _0xe798=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xe798,0x141));var _0x8e79=function(_0x3b95be,_0x5b8965){_0x3b95be=_0x3b95be-0x0;var _0x8bb6c5=_0xe798[_0x3b95be];return _0x8bb6c5;};'use strict';var _=require(_0x8e79('0x0'));var util=require(_0x8e79('0x1'));var logger=require(_0x8e79('0x2'))('api');var moment=require(_0x8e79('0x3'));var BPromise=require(_0x8e79('0x4'));var rp=require(_0x8e79('0x5'));var fs=require('fs');var path=require(_0x8e79('0x6'));var rimraf=require(_0x8e79('0x7'));var config=require(_0x8e79('0x8'));var attributes=require(_0x8e79('0x9'));module[_0x8e79('0xa')]=function(_0x26c279,_0x104b9f){return _0x26c279[_0x8e79('0xb')](_0x8e79('0xc'),attributes,{'tableName':_0x8e79('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90a5=['SquareProject','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90a5,0x187));var _0x590a=function(_0x155796,_0x1a7735){_0x155796=_0x155796-0x0;var _0x4924aa=_0x90a5[_0x155796];return _0x4924aa;};'use strict';var _=require(_0x590a('0x0'));var util=require(_0x590a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x590a('0x2'));var BPromise=require(_0x590a('0x3'));var rp=require(_0x590a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x590a('0x5'));var config=require(_0x590a('0x6'));var attributes=require(_0x590a('0x7'));module['exports']=function(_0x26d598,_0x311554){return _0x26d598[_0x590a('0x8')](_0x590a('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 0870868..e81966d 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 _0xefc5=['map','include','model','ShowSquareProject','debug','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','find','options','raw','where','attributes'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xefc5,0x146));var _0x5efc=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xefc5[_0x650e11];return _0x1a9b47;};'use strict';var _=require(_0x5efc('0x0'));var util=require(_0x5efc('0x1'));var moment=require(_0x5efc('0x2'));var BPromise=require('bluebird');var rs=require(_0x5efc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5efc('0x4'))['db'];var utils=require(_0x5efc('0x5'));var logger=require(_0x5efc('0x6'))(_0x5efc('0x7'));var config=require('../../config/environment');var jayson=require(_0x5efc('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5efc('0x9')]=_['defaults'](config['redis'],{'host':_0x5efc('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5efc('0x9')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x3fdd2e,_0x421fd6,_0x2ea7a4){return new BPromise(function(_0x57612d,_0x47d16f){return client[_0x5efc('0xb')](_0x3fdd2e,_0x2ea7a4)[_0x5efc('0xc')](function(_0x460511){logger[_0x5efc('0xd')](_0x5efc('0xe'),_0x421fd6,_0x5efc('0xf'));logger['debug'](_0x5efc('0x10'),_0x421fd6,'request\x20sent',JSON[_0x5efc('0x11')](_0x460511));if(_0x460511[_0x5efc('0x12')]){if(_0x460511[_0x5efc('0x12')][_0x5efc('0x13')]===0x1f4){logger[_0x5efc('0x12')](_0x5efc('0xe'),_0x421fd6,_0x460511['error'][_0x5efc('0x14')]);return _0x47d16f(_0x460511[_0x5efc('0x12')][_0x5efc('0x14')]);}logger[_0x5efc('0x12')]('SquareProject,\x20%s,\x20%s',_0x421fd6,_0x460511[_0x5efc('0x12')]['message']);return _0x57612d(_0x460511[_0x5efc('0x12')][_0x5efc('0x14')]);}else{logger[_0x5efc('0xd')](_0x5efc('0xe'),_0x421fd6,_0x5efc('0xf'));_0x57612d(_0x460511['result'][_0x5efc('0x14')]);}})['catch'](function(_0x33dd69){logger[_0x5efc('0x12')]('SquareProject,\x20%s,\x20%s',_0x421fd6,_0x33dd69);_0x47d16f(_0x33dd69);});});}exports['ShowSquareProject']=function(_0x4b7948){var _0x25205b=this;return new Promise(function(_0x1795cc,_0x220e0c){return db['SquareProject'][_0x5efc('0x15')]({'raw':_0x4b7948['options']?_0x4b7948[_0x5efc('0x16')][_0x5efc('0x17')]===undefined?!![]:![]:!![],'where':_0x4b7948[_0x5efc('0x16')]?_0x4b7948[_0x5efc('0x16')][_0x5efc('0x18')]||null:null,'attributes':_0x4b7948['options']?_0x4b7948['options'][_0x5efc('0x19')]||null:null,'include':_0x4b7948['options']?_0x4b7948[_0x5efc('0x16')]['include']?_[_0x5efc('0x1a')](_0x4b7948[_0x5efc('0x16')][_0x5efc('0x1b')],function(_0x465cdb){return{'model':db[_0x465cdb[_0x5efc('0x1c')]],'as':_0x465cdb['as'],'attributes':_0x465cdb['attributes'],'include':_0x465cdb[_0x5efc('0x1b')]?_[_0x5efc('0x1a')](_0x465cdb['include'],function(_0x59c2cc){return{'model':db[_0x59c2cc[_0x5efc('0x1c')]],'as':_0x59c2cc['as'],'attributes':_0x59c2cc[_0x5efc('0x19')],'include':_0x59c2cc[_0x5efc('0x1b')]?_['map'](_0x59c2cc[_0x5efc('0x1b')],function(_0x35739e){return{'model':db[_0x35739e[_0x5efc('0x1c')]],'as':_0x35739e['as'],'attributes':_0x35739e[_0x5efc('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5efc('0xc')](function(_0x15e00c){logger[_0x5efc('0xd')](_0x5efc('0x1d'),_0x4b7948);logger[_0x5efc('0x1e')](_0x5efc('0x1d'),_0x4b7948,JSON[_0x5efc('0x11')](_0x15e00c));_0x1795cc(_0x15e00c);})[_0x5efc('0x1f')](function(_0x242478){logger[_0x5efc('0x12')](_0x5efc('0x1d'),_0x242478['message'],_0x4b7948);_0x220e0c(_0x25205b[_0x5efc('0x12')](0x1f4,_0x242478[_0x5efc('0x14')]));});});}; \ No newline at end of file +var _0x524d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','then','info','lodash','util','moment'];(function(_0x2cfbf0,_0x55f7b8){var _0x21cff2=function(_0x3590eb){while(--_0x3590eb){_0x2cfbf0['push'](_0x2cfbf0['shift']());}};_0x21cff2(++_0x55f7b8);}(_0x524d,0xca));var _0xd524=function(_0x404a5d,_0x5de362){_0x404a5d=_0x404a5d-0x0;var _0xff184b=_0x524d[_0x404a5d];return _0xff184b;};'use strict';var _=require(_0xd524('0x0'));var util=require(_0xd524('0x1'));var moment=require(_0xd524('0x2'));var BPromise=require(_0xd524('0x3'));var rs=require(_0xd524('0x4'));var fs=require('fs');var Redis=require(_0xd524('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd524('0x6'));var logger=require(_0xd524('0x7'))(_0xd524('0x8'));var config=require(_0xd524('0x9'));var jayson=require(_0xd524('0xa'));var client=jayson[_0xd524('0xb')][_0xd524('0xc')]({'port':0x232a});config[_0xd524('0xd')]=_[_0xd524('0xe')](config[_0xd524('0xd')],{'host':_0xd524('0xf'),'port':0x18eb});var socket=require(_0xd524('0x10'))(new Redis(config[_0xd524('0xd')]));require(_0xd524('0x11'))[_0xd524('0x12')](socket);function respondWithRpcPromise(_0x5db217,_0x5dfdf8,_0x2e3e95){return new BPromise(function(_0x230a00,_0x2f79e9){return client['request'](_0x5db217,_0x2e3e95)['then'](function(_0x2d40e0){logger['info']('SquareProject,\x20%s,\x20%s',_0x5dfdf8,_0xd524('0x13'));logger[_0xd524('0x14')](_0xd524('0x15'),_0x5dfdf8,'request\x20sent',JSON[_0xd524('0x16')](_0x2d40e0));if(_0x2d40e0['error']){if(_0x2d40e0['error'][_0xd524('0x17')]===0x1f4){logger[_0xd524('0x18')](_0xd524('0x19'),_0x5dfdf8,_0x2d40e0[_0xd524('0x18')]['message']);return _0x2f79e9(_0x2d40e0[_0xd524('0x18')][_0xd524('0x1a')]);}logger[_0xd524('0x18')]('SquareProject,\x20%s,\x20%s',_0x5dfdf8,_0x2d40e0['error'][_0xd524('0x1a')]);return _0x230a00(_0x2d40e0[_0xd524('0x18')][_0xd524('0x1a')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x5dfdf8,'request\x20sent');_0x230a00(_0x2d40e0[_0xd524('0x1b')][_0xd524('0x1a')]);}})[_0xd524('0x1c')](function(_0x5ae5e3){logger[_0xd524('0x18')](_0xd524('0x19'),_0x5dfdf8,_0x5ae5e3);_0x2f79e9(_0x5ae5e3);});});}exports[_0xd524('0x1d')]=function(_0x537140){var _0x589e2f=this;return new Promise(function(_0xd8fc76,_0x5c3657){return db[_0xd524('0x1e')][_0xd524('0x1f')]({'raw':_0x537140[_0xd524('0x20')]?_0x537140[_0xd524('0x20')][_0xd524('0x21')]===undefined?!![]:![]:!![],'where':_0x537140[_0xd524('0x20')]?_0x537140[_0xd524('0x20')][_0xd524('0x22')]||null:null,'attributes':_0x537140[_0xd524('0x20')]?_0x537140[_0xd524('0x20')][_0xd524('0x23')]||null:null,'include':_0x537140['options']?_0x537140[_0xd524('0x20')][_0xd524('0x24')]?_[_0xd524('0x25')](_0x537140[_0xd524('0x20')][_0xd524('0x24')],function(_0x5da076){return{'model':db[_0x5da076[_0xd524('0x26')]],'as':_0x5da076['as'],'attributes':_0x5da076[_0xd524('0x23')],'include':_0x5da076[_0xd524('0x24')]?_[_0xd524('0x25')](_0x5da076[_0xd524('0x24')],function(_0x370f7b){return{'model':db[_0x370f7b[_0xd524('0x26')]],'as':_0x370f7b['as'],'attributes':_0x370f7b['attributes'],'include':_0x370f7b[_0xd524('0x24')]?_[_0xd524('0x25')](_0x370f7b['include'],function(_0x5a9162){return{'model':db[_0x5a9162[_0xd524('0x26')]],'as':_0x5a9162['as'],'attributes':_0x5a9162[_0xd524('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd524('0x27')](function(_0x36f1aa){logger[_0xd524('0x28')](_0xd524('0x1d'),_0x537140);logger[_0xd524('0x14')]('ShowSquareProject',_0x537140,JSON[_0xd524('0x16')](_0x36f1aa));_0xd8fc76(_0x36f1aa);})['catch'](function(_0x14d7a0){logger[_0xd524('0x18')](_0xd524('0x1d'),_0x14d7a0[_0xd524('0x1a')],_0x537140);_0x5c3657(_0x589e2f[_0xd524('0x18')](0x1f4,_0x14d7a0[_0xd524('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 619df70..fb75254 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 _0x2a07=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0xec9fa8,_0x24954a){var _0x37db41=function(_0x3c0e32){while(--_0x3c0e32){_0xec9fa8['push'](_0xec9fa8['shift']());}};_0x37db41(++_0x24954a);}(_0x2a07,0x74));var _0x72a0=function(_0x1716ac,_0x245897){_0x1716ac=_0x1716ac-0x0;var _0xa54aaa=_0x2a07[_0x1716ac];return _0xa54aaa;};'use strict';var SquareProjectEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){SquareProjectEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);SquareProjectEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file +var _0x2ef3=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x3a3930,_0x281f7e){var _0x46f754=function(_0x155e54){while(--_0x155e54){_0x3a3930['push'](_0x3a3930['shift']());}};_0x46f754(++_0x281f7e);}(_0x2ef3,0xba));var _0x32ef=function(_0x1cdd7c,_0x3699f0){_0x1cdd7c=_0x1cdd7c-0x0;var _0x56858d=_0x2ef3[_0x1cdd7c];return _0x56858d;};'use strict';var SquareProjectEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){SquareProjectEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);SquareProjectEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 406ca17..dda9834 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 _0x659b=['../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0x659b,0x124));var _0xb659=function(_0x11d344,_0x38e504){_0x11d344=_0x11d344-0x0;var _0x21628c=_0x659b[_0x11d344];return _0x21628c;};'use strict';var multer=require(_0xb659('0x0'));var util=require(_0xb659('0x1'));var path=require(_0xb659('0x2'));var timeout=require(_0xb659('0x3'));var express=require(_0xb659('0x4'));var router=express[_0xb659('0x5')]();var auth=require(_0xb659('0x6'));var interaction=require(_0xb659('0x7'));var config=require(_0xb659('0x8'));var controller=require(_0xb659('0x9'));router[_0xb659('0xa')]('/',auth[_0xb659('0xb')](),controller['index']);router[_0xb659('0xa')](_0xb659('0xc'),auth[_0xb659('0xb')](),controller[_0xb659('0xd')]);router[_0xb659('0xa')](_0xb659('0xe'),auth['isAuthenticated'](),controller[_0xb659('0xf')]);router[_0xb659('0x10')]('/',auth[_0xb659('0xb')](),controller['create']);router['put']('/:id',auth[_0xb659('0xb')](),controller[_0xb659('0x11')]);router['delete']('/:id/delete',auth[_0xb659('0xb')](),controller[_0xb659('0x12')]);module[_0xb659('0x13')]=router; \ No newline at end of file +var _0xdeff=['isAuthenticated','index','/:id','show','/:id/download','download','post','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xdeff,0x12a));var _0xfdef=function(_0xd8a8af,_0x1e93f0){_0xd8a8af=_0xd8a8af-0x0;var _0x5b7278=_0xdeff[_0xd8a8af];return _0x5b7278;};'use strict';var multer=require(_0xfdef('0x0'));var util=require('util');var path=require(_0xfdef('0x1'));var timeout=require('connect-timeout');var express=require(_0xfdef('0x2'));var router=express[_0xfdef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdef('0x4'));var config=require(_0xfdef('0x5'));var controller=require(_0xfdef('0x6'));router[_0xfdef('0x7')]('/',auth[_0xfdef('0x8')](),controller[_0xfdef('0x9')]);router[_0xfdef('0x7')](_0xfdef('0xa'),auth[_0xfdef('0x8')](),controller[_0xfdef('0xb')]);router['get'](_0xfdef('0xc'),auth['isAuthenticated'](),controller[_0xfdef('0xd')]);router[_0xfdef('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfdef('0xa'),auth[_0xfdef('0x8')](),controller[_0xfdef('0xf')]);router['delete']('/:id/delete',auth[_0xfdef('0x8')](),controller['destroy']);module[_0xfdef('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 771060f..8e7be42 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 _0x7670=['exports','STRING','VIRTUAL','getDataValue','sequelize'];(function(_0xc2b3ce,_0x533dfd){var _0x30e6bb=function(_0x1f24aa){while(--_0x1f24aa){_0xc2b3ce['push'](_0xc2b3ce['shift']());}};_0x30e6bb(++_0x533dfd);}(_0x7670,0x162));var _0x0767=function(_0x337f68,_0x7a2fb0){_0x337f68=_0x337f68-0x0;var _0x2ef242=_0x7670[_0x337f68];return _0x2ef242;};'use strict';var Sequelize=require(_0x0767('0x0'));module[_0x0767('0x1')]={'uniqueid':{'type':Sequelize[_0x0767('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0767('0x2')]},'context':{'type':Sequelize[_0x0767('0x2')]},'extension':{'type':Sequelize[_0x0767('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0767('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x0767('0x2')]},'saveName':{'type':Sequelize[_0x0767('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x0767('0x2')]},'format':{'type':Sequelize[_0x0767('0x3')],'get':function(){var _0x2e8eb0='';var _0x38c263=this[_0x0767('0x4')]('savePath');if(_0x38c263){_0x2e8eb0=_0x38c263['substring'](_0x38c263['lastIndexOf']('.'));}return _0x2e8eb0;}}}; \ No newline at end of file +var _0x2e4f=['sequelize','exports','STRING','getDataValue','lastIndexOf'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x2e4f,0x181));var _0xf2e4=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x2e4f[_0xa3fadc];return _0x23ecb8;};'use strict';var Sequelize=require(_0xf2e4('0x0'));module[_0xf2e4('0x1')]={'uniqueid':{'type':Sequelize[_0xf2e4('0x2')]},'callerid':{'type':Sequelize[_0xf2e4('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf2e4('0x2')]},'extension':{'type':Sequelize[_0xf2e4('0x2')]},'priority':{'type':Sequelize[_0xf2e4('0x2')]},'accountcode':{'type':Sequelize[_0xf2e4('0x2')]},'dnid':{'type':Sequelize[_0xf2e4('0x2')]},'projectName':{'type':Sequelize[_0xf2e4('0x2')]},'saveName':{'type':Sequelize[_0xf2e4('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x31e183='';var _0x251371=this[_0xf2e4('0x3')]('savePath');if(_0x251371){_0x31e183=_0x251371['substring'](_0x251371[_0xf2e4('0x4')]('.'));}return _0x31e183;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index b483c23..852cd61 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 _0x164e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','show','params','filtears','length','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','%s.cypher','existsSync','secrets','ValidationError','extname','unlink','SquareRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring'];(function(_0x40686f,_0x3f24bf){var _0x53b21c=function(_0x3f2829){while(--_0x3f2829){_0x40686f['push'](_0x40686f['shift']());}};_0x53b21c(++_0x3f24bf);}(_0x164e,0xb0));var _0xe164=function(_0x319cad,_0x456ab4){_0x319cad=_0x319cad-0x0;var _0x4524fc=_0x164e[_0x319cad];return _0x4524fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe164('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe164('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe164('0x2'));var moment=require(_0xe164('0x3'));var BPromise=require(_0xe164('0x4'));var Mustache=require(_0xe164('0x5'));var util=require(_0xe164('0x6'));var path=require(_0xe164('0x7'));var sox=require(_0xe164('0x8'));var csv=require('to-csv');var ejs=require(_0xe164('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe164('0xa'));var crypto=require(_0xe164('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe164('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe164('0xd'));var Papa=require('papaparse');var Redis=require(_0xe164('0xe'));var authService=require(_0xe164('0xf'));var qs=require(_0xe164('0x10'));var as=require(_0xe164('0x11'));var hardwareService=require(_0xe164('0x12'));var logger=require(_0xe164('0x13'))(_0xe164('0x14'));var utils=require(_0xe164('0x15'));var config=require(_0xe164('0x16'));var licenseUtil=require(_0xe164('0x17'));var db=require(_0xe164('0x18'))['db'];function respondWithStatusCode(_0x48a9a2,_0x5c4306){_0x5c4306=_0x5c4306||0xcc;return function(_0x84c246){if(_0x84c246){return _0x48a9a2[_0xe164('0x19')](_0x5c4306);}return _0x48a9a2['status'](_0x5c4306)[_0xe164('0x1a')]();};}function respondWithResult(_0x2ca70e,_0x3fe3b9){_0x3fe3b9=_0x3fe3b9||0xc8;return function(_0x5ba2c0){if(_0x5ba2c0){return _0x2ca70e[_0xe164('0x1b')](_0x3fe3b9)[_0xe164('0x1c')](_0x5ba2c0);}};}function respondWithFilteredResult(_0x57d37c,_0xb17ebc){return function(_0x243caa){if(_0x243caa){var _0x14a7d7=_0x243caa[_0xe164('0x1d')],_0x151b74=_0xb17ebc['offset'],_0x2e1a38=_0xb17ebc['offset']+_0xb17ebc[_0xe164('0x1e')],_0x3ef1eb;if(_0x2e1a38>=_0x14a7d7){_0x2e1a38=_0x14a7d7;_0x3ef1eb=0xc8;}else{_0x3ef1eb=0xce;}_0x57d37c[_0xe164('0x1b')](_0x3ef1eb);return _0x57d37c['set'](_0xe164('0x1f'),_0x151b74+'-'+_0x2e1a38+'/'+_0x14a7d7)[_0xe164('0x1c')](_0x243caa);}return null;};}function patchUpdates(_0x48a09a){return function(_0x5ee70f){try{jsonpatch[_0xe164('0x20')](_0x5ee70f,_0x48a09a,!![]);}catch(_0x1f586c){return BPromise['reject'](_0x1f586c);}return _0x5ee70f['save']();};}function saveUpdates(_0x222131,_0x73ad25){return function(_0x4186a4){if(_0x4186a4){return _0x4186a4[_0xe164('0x21')](_0x222131)[_0xe164('0x22')](function(_0x4b8ead){return _0x4b8ead;});}return null;};}function removeEntity(_0x51fafc,_0x411470){return function(_0xd6dda6){if(_0xd6dda6){return _0xd6dda6[_0xe164('0x23')]()['then'](function(){_0x51fafc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bbbd7,_0x517f04){return function(_0x5015d0){if(!_0x5015d0){_0x3bbbd7['sendStatus'](0x194);}return _0x5015d0;};}function handleError(_0x26c084,_0x50c52e){_0x50c52e=_0x50c52e||0x1f4;return function(_0x3537ea){logger[_0xe164('0x24')](_0x3537ea[_0xe164('0x25')]);if(_0x3537ea[_0xe164('0x26')]){delete _0x3537ea[_0xe164('0x26')];}_0x26c084[_0xe164('0x1b')](_0x50c52e)['send'](_0x3537ea);};}exports[_0xe164('0x27')]=function(_0x18a842,_0x62bfc0){var _0x5e554a={},_0x3a177c={},_0x4f126b={'count':0x0,'rows':[]};var _0x366708=_[_0xe164('0x28')](db['SquareRecording']['rawAttributes'],function(_0x5bb96a){return{'name':_0x5bb96a[_0xe164('0x29')],'type':_0x5bb96a[_0xe164('0x2a')][_0xe164('0x2b')]};});_0x3a177c[_0xe164('0x2c')]=_[_0xe164('0x28')](_0x366708,_0xe164('0x26'));_0x3a177c[_0xe164('0x2d')]=_[_0xe164('0x2e')](_0x18a842['query']);_0x3a177c[_0xe164('0x2f')]=_[_0xe164('0x30')](_0x3a177c[_0xe164('0x2c')],_0x3a177c[_0xe164('0x2d')]);_0x5e554a[_0xe164('0x31')]=_[_0xe164('0x30')](_0x3a177c[_0xe164('0x2c')],qs['fields'](_0x18a842[_0xe164('0x2d')][_0xe164('0x32')]));_0x5e554a[_0xe164('0x31')]=_0x5e554a['attributes']['length']?_0x5e554a[_0xe164('0x31')]:_0x3a177c[_0xe164('0x2c')];if(!_0x18a842[_0xe164('0x2d')][_0xe164('0x33')](_0xe164('0x34'))){_0x5e554a[_0xe164('0x1e')]=qs[_0xe164('0x1e')](_0x18a842[_0xe164('0x2d')][_0xe164('0x1e')]);_0x5e554a[_0xe164('0x35')]=qs['offset'](_0x18a842['query'][_0xe164('0x35')]);}_0x5e554a[_0xe164('0x36')]=qs[_0xe164('0x37')](_0x18a842[_0xe164('0x2d')][_0xe164('0x37')]);_0x5e554a[_0xe164('0x38')]=qs[_0xe164('0x2f')](_[_0xe164('0x39')](_0x18a842[_0xe164('0x2d')],_0x3a177c[_0xe164('0x2f')]),_0x366708);if(_0x18a842['query'][_0xe164('0x3a')]){_0x5e554a[_0xe164('0x38')]=_[_0xe164('0x3b')](_0x5e554a['where'],{'$or':_['map'](_0x366708,function(_0x4103b2){if(_0x4103b2[_0xe164('0x2a')]!==_0xe164('0x3c')){var _0x570a14={};_0x570a14[_0x4103b2['name']]={'$like':'%'+_0x18a842[_0xe164('0x2d')][_0xe164('0x3a')]+'%'};return _0x570a14;}})});}_0x5e554a=_['merge']({},_0x5e554a,_0x18a842[_0xe164('0x3d')]);var _0x2bf243={'where':_0x5e554a[_0xe164('0x38')]};return db[_0xe164('0x3e')][_0xe164('0x1d')](_0x2bf243)[_0xe164('0x22')](function(_0x4bf6d2){_0x4f126b[_0xe164('0x1d')]=_0x4bf6d2;if(_0x18a842[_0xe164('0x2d')][_0xe164('0x3f')]){_0x5e554a[_0xe164('0x40')]=[{'all':!![]}];}return db[_0xe164('0x3e')][_0xe164('0x41')](_0x5e554a);})[_0xe164('0x22')](function(_0x247f55){_0x4f126b[_0xe164('0x42')]=_0x247f55;return _0x4f126b;})[_0xe164('0x22')](respondWithFilteredResult(_0x62bfc0,_0x5e554a))['catch'](handleError(_0x62bfc0,null));};exports[_0xe164('0x43')]=function(_0x41849a,_0x2b92e6){var _0x25a867={'raw':!![],'where':{'id':_0x41849a[_0xe164('0x44')]['id']}},_0x502a7={};_0x502a7[_0xe164('0x2c')]=_[_0xe164('0x2e')](db[_0xe164('0x3e')]['rawAttributes']);_0x502a7['query']=_[_0xe164('0x2e')](_0x41849a['query']);_0x502a7[_0xe164('0x45')]=_[_0xe164('0x30')](_0x502a7[_0xe164('0x2c')],_0x502a7[_0xe164('0x2d')]);_0x25a867[_0xe164('0x31')]=_[_0xe164('0x30')](_0x502a7['model'],qs['fields'](_0x41849a[_0xe164('0x2d')][_0xe164('0x32')]));_0x25a867['attributes']=_0x25a867[_0xe164('0x31')][_0xe164('0x46')]?_0x25a867['attributes']:_0x502a7[_0xe164('0x2c')];if(_0x41849a[_0xe164('0x2d')][_0xe164('0x3f')]){_0x25a867[_0xe164('0x40')]=[{'all':!![]}];}_0x25a867=_[_0xe164('0x3b')]({},_0x25a867,_0x41849a[_0xe164('0x3d')]);return db[_0xe164('0x3e')][_0xe164('0x47')](_0x25a867)[_0xe164('0x22')](handleEntityNotFound(_0x2b92e6,null))[_0xe164('0x22')](respondWithResult(_0x2b92e6,null))[_0xe164('0x48')](handleError(_0x2b92e6,null));};exports[_0xe164('0x49')]=function(_0x16b58d,_0x32032a){return db[_0xe164('0x3e')][_0xe164('0x49')](_0x16b58d[_0xe164('0x4a')],{})[_0xe164('0x22')](respondWithResult(_0x32032a,0xc9))[_0xe164('0x48')](handleError(_0x32032a,null));};exports[_0xe164('0x21')]=function(_0x1ef3e1,_0x482f95){if(_0x1ef3e1['body']['id']){delete _0x1ef3e1['body']['id'];}return db[_0xe164('0x3e')][_0xe164('0x47')]({'where':{'id':_0x1ef3e1[_0xe164('0x44')]['id']}})[_0xe164('0x22')](handleEntityNotFound(_0x482f95,null))['then'](saveUpdates(_0x1ef3e1[_0xe164('0x4a')],null))['then'](respondWithResult(_0x482f95,null))['catch'](handleError(_0x482f95,null));};exports[_0xe164('0x4b')]=function(_0x2f891a,_0xb96ae9,_0x8a050e){var _0x235da2=require(_0xe164('0x4c'));var _0x450d19=![];var _0x46a35d={};if(_0x2f891a[_0xe164('0x2d')]['type']&&_0x2f891a['query']['type']===_0xe164('0x4d')){_0x46a35d['uniqueid']=_0x2f891a[_0xe164('0x44')]['id'];}else{_0x46a35d['id']=_0x2f891a[_0xe164('0x44')]['id'];}return db['SquareRecording'][_0xe164('0x47')]({'where':_0x46a35d,'attributes':['id',_0xe164('0x4e'),_0xe164('0x4f')],'raw':!![]})[_0xe164('0x22')](handleEntityNotFound(_0xb96ae9,null))[_0xe164('0x22')](function(_0x5e4215){if(_0x5e4215){var _0x20647d=_0x5e4215[_0xe164('0x4e')];var _0x268c82=util['format'](_0xe164('0x50'),_0x20647d);if(fs[_0xe164('0x51')](_0x268c82)){_0x450d19=!![];return _0x235da2['decryptFile'](_0x268c82,_0x20647d,config[_0xe164('0x52')]['recording'])[_0xe164('0x22')](function(){return _0x5e4215;});}return _0x5e4215;}})['then'](function(_0x396aa7){if(_0x396aa7){var _0x1d3cd4=_0x396aa7['savePath'];if(!fs['existsSync'](_0x1d3cd4)){throw new db['Sequelize'][(_0xe164('0x53'))]('SquareRecording\x20not\x20found');}if(_0x396aa7['filename']){return _0xb96ae9[_0xe164('0x4b')](_0x1d3cd4,_0x396aa7[_0xe164('0x4f')]+path[_0xe164('0x54')](_0x1d3cd4),function(){if(_0x450d19){fs['unlink'](_0x1d3cd4);}});}else{return _0xb96ae9['download'](_0x1d3cd4,function(_0x42348f){if(_0x450d19){fs[_0xe164('0x55')](_0x1d3cd4);}});}}})[_0xe164('0x48')](function(_0x27b9f6){if(_0x27b9f6['message']===_0xe164('0x56')){_0xb96ae9[_0xe164('0x1b')](0x194)[_0xe164('0x57')](_0xe164('0x58'));}else{return handleError(_0xb96ae9,null);}});};exports[_0xe164('0x23')]=function(_0x52deb5,_0x5a0f9f){return db['SquareRecording'][_0xe164('0x47')]({'where':{'id':_0x52deb5[_0xe164('0x44')]['id']}})[_0xe164('0x22')](function(_0x211c7f){if(!_0x211c7f)throw new ReferenceError(_0xe164('0x59'));return _0x211c7f;})[_0xe164('0x22')](function(_0x2b18ff){var _0x489a8c=_0x2b18ff[_0xe164('0x4e')];logger[_0xe164('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x489a8c);if(!_['isNil'](_0x2b18ff[_0xe164('0x4e')])&&fs[_0xe164('0x51')](_0x489a8c)){logger[_0xe164('0x5a')](_0xe164('0x5b')+_0x489a8c+_0xe164('0x5c'));fs[_0xe164('0x5d')](_0x489a8c);}_0x489a8c=_0x489a8c+'.cypher';if(!_[_0xe164('0x5e')](_0x2b18ff['savePath'])&&fs[_0xe164('0x51')](_0x489a8c)){logger[_0xe164('0x5a')]('File:\x20\x22'+_0x489a8c+_0xe164('0x5c'));fs[_0xe164('0x5d')](_0x489a8c);}return _0x2b18ff;})[_0xe164('0x22')](function(_0x26bde1){if(!_0x26bde1)throw new InternalError();return _0x26bde1[_0xe164('0x23')]();})[_0xe164('0x22')](function(){_0x5a0f9f[_0xe164('0x1b')](0xcc)[_0xe164('0x1a')]();})[_0xe164('0x48')](handleError(_0x5a0f9f,null));}; \ No newline at end of file +var _0x5dc8=['info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','filtears','includeAll','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Entity\x20not\x20found'];(function(_0x3dfff2,_0x43ce4b){var _0x49a9da=function(_0x4f2568){while(--_0x4f2568){_0x3dfff2['push'](_0x3dfff2['shift']());}};_0x49a9da(++_0x43ce4b);}(_0x5dc8,0x196));var _0x85dc=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0x5dc8[_0x2e0ffa];return _0x24d627;};'use strict';var pdf=require(_0x85dc('0x0'));var emlformat=require(_0x85dc('0x1'));var rimraf=require(_0x85dc('0x2'));var zipdir=require(_0x85dc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85dc('0x4'));var moment=require(_0x85dc('0x5'));var BPromise=require(_0x85dc('0x6'));var Mustache=require(_0x85dc('0x7'));var util=require(_0x85dc('0x8'));var path=require(_0x85dc('0x9'));var sox=require('sox');var csv=require(_0x85dc('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x85dc('0xb'));var squel=require('squel');var crypto=require(_0x85dc('0xc'));var jsforce=require(_0x85dc('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x85dc('0xe'));var Papa=require(_0x85dc('0xf'));var Redis=require(_0x85dc('0x10'));var authService=require(_0x85dc('0x11'));var qs=require(_0x85dc('0x12'));var as=require(_0x85dc('0x13'));var hardwareService=require(_0x85dc('0x14'));var logger=require('../../config/logger')(_0x85dc('0x15'));var utils=require(_0x85dc('0x16'));var config=require(_0x85dc('0x17'));var licenseUtil=require(_0x85dc('0x18'));var db=require(_0x85dc('0x19'))['db'];function respondWithStatusCode(_0x4bb5bb,_0x2632e8){_0x2632e8=_0x2632e8||0xcc;return function(_0x197852){if(_0x197852){return _0x4bb5bb[_0x85dc('0x1a')](_0x2632e8);}return _0x4bb5bb[_0x85dc('0x1b')](_0x2632e8)[_0x85dc('0x1c')]();};}function respondWithResult(_0xa1baff,_0x1b86cf){_0x1b86cf=_0x1b86cf||0xc8;return function(_0x19267c){if(_0x19267c){return _0xa1baff['status'](_0x1b86cf)['json'](_0x19267c);}};}function respondWithFilteredResult(_0x4e782e,_0xf418d8){return function(_0x556296){if(_0x556296){var _0x3523bc=_0x556296[_0x85dc('0x1d')],_0x42e339=_0xf418d8[_0x85dc('0x1e')],_0x46296d=_0xf418d8[_0x85dc('0x1e')]+_0xf418d8['limit'],_0x221594;if(_0x46296d>=_0x3523bc){_0x46296d=_0x3523bc;_0x221594=0xc8;}else{_0x221594=0xce;}_0x4e782e[_0x85dc('0x1b')](_0x221594);return _0x4e782e[_0x85dc('0x1f')]('Content-Range',_0x42e339+'-'+_0x46296d+'/'+_0x3523bc)[_0x85dc('0x20')](_0x556296);}return null;};}function patchUpdates(_0x509b7a){return function(_0x4f458a){try{jsonpatch[_0x85dc('0x21')](_0x4f458a,_0x509b7a,!![]);}catch(_0x36b1f4){return BPromise[_0x85dc('0x22')](_0x36b1f4);}return _0x4f458a[_0x85dc('0x23')]();};}function saveUpdates(_0x410d89,_0x4dfc39){return function(_0x449c47){if(_0x449c47){return _0x449c47[_0x85dc('0x24')](_0x410d89)['then'](function(_0x332adb){return _0x332adb;});}return null;};}function removeEntity(_0xdf00e2,_0x2aaef3){return function(_0x358976){if(_0x358976){return _0x358976[_0x85dc('0x25')]()[_0x85dc('0x26')](function(){_0xdf00e2[_0x85dc('0x1b')](0xcc)[_0x85dc('0x1c')]();});}};}function handleEntityNotFound(_0xdaef2b,_0x54453c){return function(_0x10c91a){if(!_0x10c91a){_0xdaef2b[_0x85dc('0x1a')](0x194);}return _0x10c91a;};}function handleError(_0x354020,_0x13671b){_0x13671b=_0x13671b||0x1f4;return function(_0x23efd2){logger[_0x85dc('0x27')](_0x23efd2[_0x85dc('0x28')]);if(_0x23efd2[_0x85dc('0x29')]){delete _0x23efd2['name'];}_0x354020[_0x85dc('0x1b')](_0x13671b)[_0x85dc('0x2a')](_0x23efd2);};}exports[_0x85dc('0x2b')]=function(_0x172a67,_0x3775d6){var _0x541846={},_0x427558={},_0xe8ae43={'count':0x0,'rows':[]};var _0x17a86f=_[_0x85dc('0x2c')](db[_0x85dc('0x2d')]['rawAttributes'],function(_0x1c34b7){return{'name':_0x1c34b7[_0x85dc('0x2e')],'type':_0x1c34b7[_0x85dc('0x2f')][_0x85dc('0x30')]};});_0x427558[_0x85dc('0x31')]=_[_0x85dc('0x2c')](_0x17a86f,_0x85dc('0x29'));_0x427558['query']=_[_0x85dc('0x32')](_0x172a67[_0x85dc('0x33')]);_0x427558[_0x85dc('0x34')]=_[_0x85dc('0x35')](_0x427558[_0x85dc('0x31')],_0x427558[_0x85dc('0x33')]);_0x541846['attributes']=_['intersection'](_0x427558[_0x85dc('0x31')],qs[_0x85dc('0x36')](_0x172a67['query'][_0x85dc('0x36')]));_0x541846[_0x85dc('0x37')]=_0x541846['attributes'][_0x85dc('0x38')]?_0x541846[_0x85dc('0x37')]:_0x427558[_0x85dc('0x31')];if(!_0x172a67['query'][_0x85dc('0x39')](_0x85dc('0x3a'))){_0x541846[_0x85dc('0x3b')]=qs['limit'](_0x172a67[_0x85dc('0x33')][_0x85dc('0x3b')]);_0x541846[_0x85dc('0x1e')]=qs[_0x85dc('0x1e')](_0x172a67[_0x85dc('0x33')]['offset']);}_0x541846[_0x85dc('0x3c')]=qs[_0x85dc('0x3d')](_0x172a67[_0x85dc('0x33')][_0x85dc('0x3d')]);_0x541846[_0x85dc('0x3e')]=qs['filters'](_[_0x85dc('0x3f')](_0x172a67[_0x85dc('0x33')],_0x427558[_0x85dc('0x34')]),_0x17a86f);if(_0x172a67[_0x85dc('0x33')][_0x85dc('0x40')]){_0x541846['where']=_[_0x85dc('0x41')](_0x541846['where'],{'$or':_[_0x85dc('0x2c')](_0x17a86f,function(_0x5f2b93){if(_0x5f2b93[_0x85dc('0x2f')]!==_0x85dc('0x42')){var _0x4cc402={};_0x4cc402[_0x5f2b93[_0x85dc('0x29')]]={'$like':'%'+_0x172a67[_0x85dc('0x33')][_0x85dc('0x40')]+'%'};return _0x4cc402;}})});}_0x541846=_['merge']({},_0x541846,_0x172a67[_0x85dc('0x43')]);var _0x175ab5={'where':_0x541846['where']};return db[_0x85dc('0x2d')][_0x85dc('0x1d')](_0x175ab5)['then'](function(_0x5a369b){_0xe8ae43[_0x85dc('0x1d')]=_0x5a369b;if(_0x172a67[_0x85dc('0x33')]['includeAll']){_0x541846[_0x85dc('0x44')]=[{'all':!![]}];}return db[_0x85dc('0x2d')]['findAll'](_0x541846);})[_0x85dc('0x26')](function(_0x518528){_0xe8ae43['rows']=_0x518528;return _0xe8ae43;})[_0x85dc('0x26')](respondWithFilteredResult(_0x3775d6,_0x541846))[_0x85dc('0x45')](handleError(_0x3775d6,null));};exports[_0x85dc('0x46')]=function(_0x1095d6,_0x3f53b3){var _0x43dd74={'raw':!![],'where':{'id':_0x1095d6[_0x85dc('0x47')]['id']}},_0x28db12={};_0x28db12[_0x85dc('0x31')]=_[_0x85dc('0x32')](db[_0x85dc('0x2d')]['rawAttributes']);_0x28db12[_0x85dc('0x33')]=_[_0x85dc('0x32')](_0x1095d6[_0x85dc('0x33')]);_0x28db12[_0x85dc('0x48')]=_[_0x85dc('0x35')](_0x28db12[_0x85dc('0x31')],_0x28db12[_0x85dc('0x33')]);_0x43dd74[_0x85dc('0x37')]=_[_0x85dc('0x35')](_0x28db12[_0x85dc('0x31')],qs[_0x85dc('0x36')](_0x1095d6[_0x85dc('0x33')]['fields']));_0x43dd74[_0x85dc('0x37')]=_0x43dd74[_0x85dc('0x37')][_0x85dc('0x38')]?_0x43dd74['attributes']:_0x28db12[_0x85dc('0x31')];if(_0x1095d6[_0x85dc('0x33')][_0x85dc('0x49')]){_0x43dd74[_0x85dc('0x44')]=[{'all':!![]}];}_0x43dd74=_['merge']({},_0x43dd74,_0x1095d6['options']);return db['SquareRecording'][_0x85dc('0x4a')](_0x43dd74)[_0x85dc('0x26')](handleEntityNotFound(_0x3f53b3,null))[_0x85dc('0x26')](respondWithResult(_0x3f53b3,null))[_0x85dc('0x45')](handleError(_0x3f53b3,null));};exports[_0x85dc('0x4b')]=function(_0x463888,_0x25cd8a){return db[_0x85dc('0x2d')][_0x85dc('0x4b')](_0x463888[_0x85dc('0x4c')],{})[_0x85dc('0x26')](respondWithResult(_0x25cd8a,0xc9))[_0x85dc('0x45')](handleError(_0x25cd8a,null));};exports[_0x85dc('0x24')]=function(_0x343d92,_0x49a7b6){if(_0x343d92[_0x85dc('0x4c')]['id']){delete _0x343d92[_0x85dc('0x4c')]['id'];}return db[_0x85dc('0x2d')][_0x85dc('0x4a')]({'where':{'id':_0x343d92[_0x85dc('0x47')]['id']}})[_0x85dc('0x26')](handleEntityNotFound(_0x49a7b6,null))[_0x85dc('0x26')](saveUpdates(_0x343d92[_0x85dc('0x4c')],null))['then'](respondWithResult(_0x49a7b6,null))['catch'](handleError(_0x49a7b6,null));};exports[_0x85dc('0x4d')]=function(_0x4d6f0e,_0x1f3e69,_0x50c9da){var _0x4e9269=require(_0x85dc('0x4e'));var _0x458585=![];var _0x3b5a44={};if(_0x4d6f0e[_0x85dc('0x33')][_0x85dc('0x2f')]&&_0x4d6f0e[_0x85dc('0x33')][_0x85dc('0x2f')]===_0x85dc('0x4f')){_0x3b5a44[_0x85dc('0x4f')]=_0x4d6f0e['params']['id'];}else{_0x3b5a44['id']=_0x4d6f0e[_0x85dc('0x47')]['id'];}return db[_0x85dc('0x2d')][_0x85dc('0x4a')]({'where':_0x3b5a44,'attributes':['id',_0x85dc('0x50'),_0x85dc('0x51')],'raw':!![]})[_0x85dc('0x26')](handleEntityNotFound(_0x1f3e69,null))[_0x85dc('0x26')](function(_0x4613a1){if(_0x4613a1){var _0x151b71=_0x4613a1['savePath'];var _0x2a0d84=util[_0x85dc('0x52')](_0x85dc('0x53'),_0x151b71);if(fs[_0x85dc('0x54')](_0x2a0d84)){_0x458585=!![];return _0x4e9269[_0x85dc('0x55')](_0x2a0d84,_0x151b71,config['secrets'][_0x85dc('0x56')])[_0x85dc('0x26')](function(){return _0x4613a1;});}return _0x4613a1;}})['then'](function(_0xe947f6){if(_0xe947f6){var _0xa7148d=_0xe947f6[_0x85dc('0x50')];if(!fs[_0x85dc('0x54')](_0xa7148d)){throw new db[(_0x85dc('0x57'))][(_0x85dc('0x58'))](_0x85dc('0x59'));}if(_0xe947f6[_0x85dc('0x51')]){return _0x1f3e69[_0x85dc('0x4d')](_0xa7148d,_0xe947f6[_0x85dc('0x51')]+path[_0x85dc('0x5a')](_0xa7148d),function(){if(_0x458585){fs[_0x85dc('0x5b')](_0xa7148d);}});}else{return _0x1f3e69[_0x85dc('0x4d')](_0xa7148d,function(_0x3bf776){if(_0x458585){fs[_0x85dc('0x5b')](_0xa7148d);}});}}})['catch'](function(_0x369386){if(_0x369386[_0x85dc('0x5c')]==='SquareRecording\x20not\x20found'){_0x1f3e69[_0x85dc('0x1b')](0x194)[_0x85dc('0x2a')]('Not\x20found');}else{return handleError(_0x1f3e69,null);}});};exports[_0x85dc('0x25')]=function(_0x3fc864,_0x3aa84b){return db['SquareRecording']['find']({'where':{'id':_0x3fc864['params']['id']}})['then'](function(_0x285f09){if(!_0x285f09)throw new ReferenceError(_0x85dc('0x5d'));return _0x285f09;})[_0x85dc('0x26')](function(_0x3dc8f0){var _0x45db50=_0x3dc8f0['savePath'];logger[_0x85dc('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x45db50);if(!_[_0x85dc('0x5f')](_0x3dc8f0[_0x85dc('0x50')])&&fs['existsSync'](_0x45db50)){logger[_0x85dc('0x5e')](_0x85dc('0x60')+_0x45db50+_0x85dc('0x61'));fs[_0x85dc('0x62')](_0x45db50);}_0x45db50=_0x45db50+_0x85dc('0x63');if(!_[_0x85dc('0x5f')](_0x3dc8f0[_0x85dc('0x50')])&&fs[_0x85dc('0x54')](_0x45db50)){logger[_0x85dc('0x5e')](_0x85dc('0x60')+_0x45db50+_0x85dc('0x61'));fs[_0x85dc('0x62')](_0x45db50);}return _0x3dc8f0;})[_0x85dc('0x26')](function(_0x4e7631){if(!_0x4e7631)throw new InternalError();return _0x4e7631[_0x85dc('0x25')]();})[_0x85dc('0x26')](function(){_0x3aa84b[_0x85dc('0x1b')](0xcc)[_0x85dc('0x1c')]();})[_0x85dc('0x45')](handleError(_0x3aa84b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c5ec078..bc8dcb0 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 _0xda2d=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x13f87d,_0x59bed0){var _0x1c42db=function(_0x5efa94){while(--_0x5efa94){_0x13f87d['push'](_0x13f87d['shift']());}};_0x1c42db(++_0x59bed0);}(_0xda2d,0x102));var _0xdda2=function(_0x11aa11,_0x4fec69){_0x11aa11=_0x11aa11-0x0;var _0xf623e1=_0xda2d[_0x11aa11];return _0xf623e1;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda2('0x5'));var attributes=require(_0xdda2('0x6'));module[_0xdda2('0x7')]=function(_0x39f6c9,_0xc256bc){return _0x39f6c9[_0xdda2('0x8')](_0xdda2('0x9'),attributes,{'tableName':_0xdda2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa693=['util','../../config/logger','api','moment','bluebird','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0xa693,0xf1));var _0x3a69=function(_0x764874,_0x3ed544){_0x764874=_0x764874-0x0;var _0x29f9d5=_0xa693[_0x764874];return _0x29f9d5;};'use strict';var _=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var logger=require(_0x3a69('0x2'))(_0x3a69('0x3'));var moment=require(_0x3a69('0x4'));var BPromise=require(_0x3a69('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a69('0x6'));var attributes=require(_0x3a69('0x7'));module[_0x3a69('0x8')]=function(_0x363363,_0x3a05e0){return _0x363363[_0x3a69('0x9')](_0x3a69('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 3894830..86b8788 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 _0x121d=['stringify','error','message','result','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x298d5a,_0x389846){var _0x320661=function(_0x2da588){while(--_0x2da588){_0x298d5a['push'](_0x298d5a['shift']());}};_0x320661(++_0x389846);}(_0x121d,0x1ce));var _0xd121=function(_0x4d3a94,_0xa86dda){_0x4d3a94=_0x4d3a94-0x0;var _0x46aa90=_0x121d[_0x4d3a94];return _0x46aa90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd121('0x0'));var BPromise=require('bluebird');var rs=require(_0xd121('0x1'));var fs=require('fs');var Redis=require(_0xd121('0x2'));var db=require(_0xd121('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd121('0x4'));var config=require(_0xd121('0x5'));var jayson=require(_0xd121('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x612d15,_0x161595,_0x37c70a){return new BPromise(function(_0x514c27,_0x3e00ed){return client[_0xd121('0x7')](_0x612d15,_0x37c70a)['then'](function(_0xdbddff){logger[_0xd121('0x8')](_0xd121('0x9'),_0x161595,'request\x20sent');logger[_0xd121('0xa')](_0xd121('0xb'),_0x161595,_0xd121('0xc'),JSON[_0xd121('0xd')](_0xdbddff));if(_0xdbddff[_0xd121('0xe')]){if(_0xdbddff['error']['code']===0x1f4){logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xdbddff[_0xd121('0xe')]['message']);return _0x3e00ed(_0xdbddff['error'][_0xd121('0xf')]);}logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xdbddff[_0xd121('0xe')][_0xd121('0xf')]);return _0x514c27(_0xdbddff[_0xd121('0xe')][_0xd121('0xf')]);}else{logger[_0xd121('0x8')](_0xd121('0x9'),_0x161595,_0xd121('0xc'));_0x514c27(_0xdbddff[_0xd121('0x10')]['message']);}})[_0xd121('0x11')](function(_0xd1e404){logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xd1e404);_0x3e00ed(_0xd1e404);});});}exports['CreateSquareRecording']=function(_0x30b20e){var _0x38f2b8=this;return new Promise(function(_0x4a22bd,_0x4b457a){return db[_0xd121('0x12')][_0xd121('0x13')](_0x30b20e[_0xd121('0x14')],{'raw':_0x30b20e[_0xd121('0x15')]?_0x30b20e[_0xd121('0x15')][_0xd121('0x16')]===undefined?!![]:![]:!![]})[_0xd121('0x17')](function(_0x1f9097){logger[_0xd121('0x8')](_0xd121('0x18'),_0x30b20e);logger[_0xd121('0xa')](_0xd121('0x18'),_0x30b20e,JSON[_0xd121('0xd')](_0x1f9097));_0x4a22bd(_0x1f9097);})[_0xd121('0x11')](function(_0x4b7f34){logger['error'](_0xd121('0x18'),_0x4b7f34[_0xd121('0xf')],_0x30b20e);_0x4b457a(_0x38f2b8[_0xd121('0xe')](0x1f4,_0x4b7f34['message']));});});}; \ No newline at end of file +var _0xce65=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x10784b,_0x59bd34){var _0x3123b4=function(_0x2a58a5){while(--_0x2a58a5){_0x10784b['push'](_0x10784b['shift']());}};_0x3123b4(++_0x59bd34);}(_0xce65,0x145));var _0x5ce6=function(_0x3aa8e3,_0xaa3ed4){_0x3aa8e3=_0x3aa8e3-0x0;var _0xe1b4af=_0xce65[_0x3aa8e3];return _0xe1b4af;};'use strict';var _=require(_0x5ce6('0x0'));var util=require(_0x5ce6('0x1'));var moment=require(_0x5ce6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ce6('0x3'));var fs=require('fs');var Redis=require(_0x5ce6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ce6('0x5'))(_0x5ce6('0x6'));var config=require(_0x5ce6('0x7'));var jayson=require(_0x5ce6('0x8'));var client=jayson[_0x5ce6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c28e4,_0xe2242e,_0xae0298){return new BPromise(function(_0x8b1596,_0x995640){return client[_0x5ce6('0xa')](_0x3c28e4,_0xae0298)[_0x5ce6('0xb')](function(_0x1189b1){logger[_0x5ce6('0xc')](_0x5ce6('0xd'),_0xe2242e,_0x5ce6('0xe'));logger[_0x5ce6('0xf')](_0x5ce6('0x10'),_0xe2242e,'request\x20sent',JSON['stringify'](_0x1189b1));if(_0x1189b1[_0x5ce6('0x11')]){if(_0x1189b1[_0x5ce6('0x11')][_0x5ce6('0x12')]===0x1f4){logger[_0x5ce6('0x11')](_0x5ce6('0xd'),_0xe2242e,_0x1189b1[_0x5ce6('0x11')]['message']);return _0x995640(_0x1189b1[_0x5ce6('0x11')][_0x5ce6('0x13')]);}logger[_0x5ce6('0x11')](_0x5ce6('0xd'),_0xe2242e,_0x1189b1['error']['message']);return _0x8b1596(_0x1189b1[_0x5ce6('0x11')][_0x5ce6('0x13')]);}else{logger[_0x5ce6('0xc')]('SquareRecording,\x20%s,\x20%s',_0xe2242e,_0x5ce6('0xe'));_0x8b1596(_0x1189b1['result']['message']);}})[_0x5ce6('0x14')](function(_0x2766a7){logger[_0x5ce6('0x11')](_0x5ce6('0xd'),_0xe2242e,_0x2766a7);_0x995640(_0x2766a7);});});}exports[_0x5ce6('0x15')]=function(_0x55ac4a){var _0x552375=this;return new Promise(function(_0xcc8171,_0x5c94c6){return db[_0x5ce6('0x16')][_0x5ce6('0x17')](_0x55ac4a[_0x5ce6('0x18')],{'raw':_0x55ac4a['options']?_0x55ac4a[_0x5ce6('0x19')][_0x5ce6('0x1a')]===undefined?!![]:![]:!![]})[_0x5ce6('0xb')](function(_0x499d00){logger[_0x5ce6('0xc')]('CreateSquareRecording',_0x55ac4a);logger[_0x5ce6('0xf')](_0x5ce6('0x15'),_0x55ac4a,JSON[_0x5ce6('0x1b')](_0x499d00));_0xcc8171(_0x499d00);})[_0x5ce6('0x14')](function(_0x30dbf3){logger[_0x5ce6('0x11')]('CreateSquareRecording',_0x30dbf3['message'],_0x55ac4a);_0x5c94c6(_0x552375['error'](0x1f4,_0x30dbf3[_0x5ce6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 74224e4..db993fb 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 _0xb21d=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','post'];(function(_0x506185,_0x241bf6){var _0x40c77c=function(_0x4e4c00){while(--_0x4e4c00){_0x506185['push'](_0x506185['shift']());}};_0x40c77c(++_0x241bf6);}(_0xb21d,0xc4));var _0xdb21=function(_0x2a81d4,_0x530982){_0x2a81d4=_0x2a81d4-0x0;var _0x2fc567=_0xb21d[_0x2a81d4];return _0x2fc567;};'use strict';var multer=require(_0xdb21('0x0'));var util=require(_0xdb21('0x1'));var path=require('path');var timeout=require(_0xdb21('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdb21('0x3'));var interaction=require(_0xdb21('0x4'));var config=require(_0xdb21('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdb21('0x6'),auth[_0xdb21('0x7')](),controller[_0xdb21('0x8')]);router[_0xdb21('0x9')](_0xdb21('0xa'),auth[_0xdb21('0x7')](),controller[_0xdb21('0xb')]);router[_0xdb21('0xc')]('/',auth[_0xdb21('0x7')](),controller[_0xdb21('0xd')]);router[_0xdb21('0xe')](_0xdb21('0xa'),auth[_0xdb21('0x7')](),controller[_0xdb21('0xf')]);router[_0xdb21('0x10')](_0xdb21('0xa'),auth[_0xdb21('0x7')](),controller[_0xdb21('0x11')]);module[_0xdb21('0x12')]=router; \ No newline at end of file +var _0xd587=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x275f90,_0x4a8482){var _0x224b0f=function(_0x5bfb56){while(--_0x5bfb56){_0x275f90['push'](_0x275f90['shift']());}};_0x224b0f(++_0x4a8482);}(_0xd587,0x16f));var _0x7d58=function(_0x769677,_0x213c8e){_0x769677=_0x769677-0x0;var _0x13fade=_0xd587[_0x769677];return _0x13fade;};'use strict';var multer=require(_0x7d58('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7d58('0x1'));var express=require(_0x7d58('0x2'));var router=express['Router']();var auth=require(_0x7d58('0x3'));var interaction=require(_0x7d58('0x4'));var config=require(_0x7d58('0x5'));var controller=require(_0x7d58('0x6'));router[_0x7d58('0x7')]('/',auth[_0x7d58('0x8')](),controller[_0x7d58('0x9')]);router[_0x7d58('0x7')]('/describe',auth[_0x7d58('0x8')](),controller[_0x7d58('0xa')]);router[_0x7d58('0x7')](_0x7d58('0xb'),auth[_0x7d58('0x8')](),controller[_0x7d58('0xc')]);router[_0x7d58('0xd')]('/',auth[_0x7d58('0x8')](),controller[_0x7d58('0xe')]);router[_0x7d58('0xf')]('/:id',auth[_0x7d58('0x8')](),controller[_0x7d58('0x10')]);router[_0x7d58('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7d58('0x12')]);module[_0x7d58('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 95e61a0..faea3c0 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 _0xad2b=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xad2b,0x152));var _0xbad2=function(_0x127ff6,_0x49a0cb){_0x127ff6=_0x127ff6-0x0;var _0x4fa5fc=_0xad2b[_0x127ff6];return _0x4fa5fc;};'use strict';var Sequelize=require(_0xbad2('0x0'));module[_0xbad2('0x1')]={'network':{'type':Sequelize[_0xbad2('0x2')]},'network_script':{'type':Sequelize[_0xbad2('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbad2('0x2')]},'language':{'type':Sequelize[_0xbad2('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xbad2('0x2')]},'callerid':{'type':Sequelize[_0xbad2('0x2')]},'calleridname':{'type':Sequelize[_0xbad2('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xbad2('0x2')]},'callington':{'type':Sequelize[_0xbad2('0x2')]},'callingtns':{'type':Sequelize[_0xbad2('0x2')]},'dnid':{'type':Sequelize[_0xbad2('0x2')]},'rdnis':{'type':Sequelize[_0xbad2('0x2')]},'context':{'type':Sequelize[_0xbad2('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbad2('0x2')]},'enhanced':{'type':Sequelize[_0xbad2('0x2')]},'accountcode':{'type':Sequelize[_0xbad2('0x2')]},'threadid':{'type':Sequelize[_0xbad2('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbad2('0x3')]},'leaveAt':{'type':Sequelize[_0xbad2('0x3')]},'bot':{'type':Sequelize[_0xbad2('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4dcc=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x29362f,_0x190c2f){var _0x584532=function(_0x2f5bd1){while(--_0x2f5bd1){_0x29362f['push'](_0x29362f['shift']());}};_0x584532(++_0x190c2f);}(_0x4dcc,0x84));var _0xc4dc=function(_0x26a351,_0x5dd04c){_0x26a351=_0x26a351-0x0;var _0x1ef7fe=_0x4dcc[_0x26a351];return _0x1ef7fe;};'use strict';var Sequelize=require(_0xc4dc('0x0'));module['exports']={'network':{'type':Sequelize[_0xc4dc('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc4dc('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc4dc('0x1')]},'version':{'type':Sequelize[_0xc4dc('0x1')]},'callerid':{'type':Sequelize[_0xc4dc('0x1')]},'calleridname':{'type':Sequelize[_0xc4dc('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc4dc('0x1')]},'callington':{'type':Sequelize[_0xc4dc('0x1')]},'callingtns':{'type':Sequelize[_0xc4dc('0x1')]},'dnid':{'type':Sequelize[_0xc4dc('0x1')]},'rdnis':{'type':Sequelize[_0xc4dc('0x1')]},'context':{'type':Sequelize[_0xc4dc('0x1')]},'extension':{'type':Sequelize[_0xc4dc('0x1')]},'priority':{'type':Sequelize[_0xc4dc('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc4dc('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc4dc('0x1')]},'joinAt':{'type':Sequelize[_0xc4dc('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xc4dc('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a3a1f24..60e26ee 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 _0x152f=['SquareReport','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','rows','catch','show','params','rawAttributes','filtears','includeAll','create','body','update','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','then','destroy','end','stack','name','send','index'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x152f,0x144));var _0xf152=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x152f[_0x20c9b2];return _0x2c6030;};'use strict';var pdf=require(_0xf152('0x0'));var emlformat=require(_0xf152('0x1'));var rimraf=require(_0xf152('0x2'));var zipdir=require(_0xf152('0x3'));var jsonpatch=require(_0xf152('0x4'));var rp=require('request-promise');var moment=require(_0xf152('0x5'));var BPromise=require(_0xf152('0x6'));var Mustache=require(_0xf152('0x7'));var util=require(_0xf152('0x8'));var path=require('path');var sox=require(_0xf152('0x9'));var csv=require('to-csv');var ejs=require(_0xf152('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf152('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf152('0xc'));var toCsv=require(_0xf152('0xd'));var querystring=require('querystring');var Papa=require(_0xf152('0xe'));var Redis=require(_0xf152('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf152('0x10'));var as=require(_0xf152('0x11'));var hardwareService=require(_0xf152('0x12'));var logger=require(_0xf152('0x13'))(_0xf152('0x14'));var utils=require(_0xf152('0x15'));var config=require(_0xf152('0x16'));var licenseUtil=require(_0xf152('0x17'));var db=require(_0xf152('0x18'))['db'];function respondWithStatusCode(_0xca854f,_0x3424c7){_0x3424c7=_0x3424c7||0xcc;return function(_0x445e61){if(_0x445e61){return _0xca854f[_0xf152('0x19')](_0x3424c7);}return _0xca854f[_0xf152('0x1a')](_0x3424c7)['end']();};}function respondWithResult(_0x321ef1,_0x26b0c2){_0x26b0c2=_0x26b0c2||0xc8;return function(_0x4cf355){if(_0x4cf355){return _0x321ef1[_0xf152('0x1a')](_0x26b0c2)[_0xf152('0x1b')](_0x4cf355);}};}function respondWithFilteredResult(_0x428239,_0x5a6869){return function(_0x3bf2ab){if(_0x3bf2ab){var _0x286f0a=_0x3bf2ab[_0xf152('0x1c')],_0x5f0cbf=_0x5a6869[_0xf152('0x1d')],_0x986a0=_0x5a6869['offset']+_0x5a6869[_0xf152('0x1e')],_0x29bad9;if(_0x986a0>=_0x286f0a){_0x986a0=_0x286f0a;_0x29bad9=0xc8;}else{_0x29bad9=0xce;}_0x428239['status'](_0x29bad9);return _0x428239[_0xf152('0x1f')]('Content-Range',_0x5f0cbf+'-'+_0x986a0+'/'+_0x286f0a)[_0xf152('0x1b')](_0x3bf2ab);}return null;};}function patchUpdates(_0x3dab73){return function(_0x439f31){try{jsonpatch[_0xf152('0x20')](_0x439f31,_0x3dab73,!![]);}catch(_0x397ed3){return BPromise[_0xf152('0x21')](_0x397ed3);}return _0x439f31['save']();};}function saveUpdates(_0x2488a6,_0x11c151){return function(_0x2c0433){if(_0x2c0433){return _0x2c0433['update'](_0x2488a6)[_0xf152('0x22')](function(_0x1f2710){return _0x1f2710;});}return null;};}function removeEntity(_0x2cb87f,_0x35442a){return function(_0xc65d65){if(_0xc65d65){return _0xc65d65[_0xf152('0x23')]()['then'](function(){_0x2cb87f['status'](0xcc)[_0xf152('0x24')]();});}};}function handleEntityNotFound(_0x26a63f,_0x201fcb){return function(_0x363379){if(!_0x363379){_0x26a63f['sendStatus'](0x194);}return _0x363379;};}function handleError(_0x36d624,_0x1dcb58){_0x1dcb58=_0x1dcb58||0x1f4;return function(_0x27ddaa){logger['error'](_0x27ddaa[_0xf152('0x25')]);if(_0x27ddaa[_0xf152('0x26')]){delete _0x27ddaa[_0xf152('0x26')];}_0x36d624['status'](_0x1dcb58)[_0xf152('0x27')](_0x27ddaa);};}exports[_0xf152('0x28')]=function(_0x3355f1,_0x1d1f9c){var _0x3d0644={},_0x3ebb53={},_0x14b21b={'count':0x0,'rows':[]};var _0x7a8d0e=_['map'](db[_0xf152('0x29')]['rawAttributes'],function(_0x30a408){return{'name':_0x30a408['fieldName'],'type':_0x30a408[_0xf152('0x2a')][_0xf152('0x2b')]};});_0x3ebb53[_0xf152('0x2c')]=_[_0xf152('0x2d')](_0x7a8d0e,_0xf152('0x26'));_0x3ebb53[_0xf152('0x2e')]=_[_0xf152('0x2f')](_0x3355f1['query']);_0x3ebb53[_0xf152('0x30')]=_['intersection'](_0x3ebb53['model'],_0x3ebb53[_0xf152('0x2e')]);_0x3d0644[_0xf152('0x31')]=_[_0xf152('0x32')](_0x3ebb53[_0xf152('0x2c')],qs[_0xf152('0x33')](_0x3355f1[_0xf152('0x2e')][_0xf152('0x33')]));_0x3d0644['attributes']=_0x3d0644['attributes'][_0xf152('0x34')]?_0x3d0644[_0xf152('0x31')]:_0x3ebb53[_0xf152('0x2c')];if(!_0x3355f1[_0xf152('0x2e')][_0xf152('0x35')](_0xf152('0x36'))){_0x3d0644[_0xf152('0x1e')]=qs['limit'](_0x3355f1[_0xf152('0x2e')][_0xf152('0x1e')]);_0x3d0644['offset']=qs[_0xf152('0x1d')](_0x3355f1[_0xf152('0x2e')][_0xf152('0x1d')]);}_0x3d0644['order']=qs[_0xf152('0x37')](_0x3355f1[_0xf152('0x2e')]['sort']);_0x3d0644[_0xf152('0x38')]=qs['filters'](_['pick'](_0x3355f1[_0xf152('0x2e')],_0x3ebb53[_0xf152('0x30')]),_0x7a8d0e);if(_0x3355f1['query'][_0xf152('0x39')]){_0x3d0644[_0xf152('0x38')]=_[_0xf152('0x3a')](_0x3d0644[_0xf152('0x38')],{'$or':_['map'](_0x7a8d0e,function(_0x21b688){if(_0x21b688[_0xf152('0x2a')]!==_0xf152('0x3b')){var _0x16456e={};_0x16456e[_0x21b688[_0xf152('0x26')]]={'$like':'%'+_0x3355f1['query'][_0xf152('0x39')]+'%'};return _0x16456e;}})});}_0x3d0644=_['merge']({},_0x3d0644,_0x3355f1[_0xf152('0x3c')]);var _0x53a90b={'where':_0x3d0644[_0xf152('0x38')]};return db[_0xf152('0x29')][_0xf152('0x1c')](_0x53a90b)[_0xf152('0x22')](function(_0x1b42f1){_0x14b21b[_0xf152('0x1c')]=_0x1b42f1;if(_0x3355f1['query']['includeAll']){_0x3d0644['include']=[{'all':!![]}];}return db['SquareReport']['findAll'](_0x3d0644);})[_0xf152('0x22')](function(_0xc8cc0b){_0x14b21b[_0xf152('0x3d')]=_0xc8cc0b;return _0x14b21b;})['then'](respondWithFilteredResult(_0x1d1f9c,_0x3d0644))[_0xf152('0x3e')](handleError(_0x1d1f9c,null));};exports[_0xf152('0x3f')]=function(_0x1f68e1,_0x4444e3){var _0x5709e5={'raw':!![],'where':{'id':_0x1f68e1[_0xf152('0x40')]['id']}},_0x2f878e={};_0x2f878e[_0xf152('0x2c')]=_[_0xf152('0x2f')](db[_0xf152('0x29')][_0xf152('0x41')]);_0x2f878e[_0xf152('0x2e')]=_['keys'](_0x1f68e1['query']);_0x2f878e[_0xf152('0x42')]=_[_0xf152('0x32')](_0x2f878e['model'],_0x2f878e[_0xf152('0x2e')]);_0x5709e5[_0xf152('0x31')]=_['intersection'](_0x2f878e[_0xf152('0x2c')],qs[_0xf152('0x33')](_0x1f68e1['query'][_0xf152('0x33')]));_0x5709e5['attributes']=_0x5709e5[_0xf152('0x31')][_0xf152('0x34')]?_0x5709e5['attributes']:_0x2f878e[_0xf152('0x2c')];if(_0x1f68e1[_0xf152('0x2e')][_0xf152('0x43')]){_0x5709e5['include']=[{'all':!![]}];}_0x5709e5=_['merge']({},_0x5709e5,_0x1f68e1[_0xf152('0x3c')]);return db[_0xf152('0x29')]['find'](_0x5709e5)[_0xf152('0x22')](handleEntityNotFound(_0x4444e3,null))[_0xf152('0x22')](respondWithResult(_0x4444e3,null))['catch'](handleError(_0x4444e3,null));};exports[_0xf152('0x44')]=function(_0x19f8a9,_0xe2cd){return db['SquareReport']['create'](_0x19f8a9[_0xf152('0x45')],{})['then'](respondWithResult(_0xe2cd,0xc9))['catch'](handleError(_0xe2cd,null));};exports[_0xf152('0x46')]=function(_0x26c96c,_0x433abd){if(_0x26c96c['body']['id']){delete _0x26c96c[_0xf152('0x45')]['id'];}return db[_0xf152('0x29')][_0xf152('0x47')]({'where':{'id':_0x26c96c['params']['id']}})[_0xf152('0x22')](handleEntityNotFound(_0x433abd,null))[_0xf152('0x22')](saveUpdates(_0x26c96c[_0xf152('0x45')],null))[_0xf152('0x22')](respondWithResult(_0x433abd,null))[_0xf152('0x3e')](handleError(_0x433abd,null));};exports['destroy']=function(_0x4597f6,_0x1e8df5){return db[_0xf152('0x29')][_0xf152('0x47')]({'where':{'id':_0x4597f6['params']['id']}})['then'](handleEntityNotFound(_0x1e8df5,null))[_0xf152('0x22')](removeEntity(_0x1e8df5,null))[_0xf152('0x3e')](handleError(_0x1e8df5,null));};exports[_0xf152('0x48')]=function(_0x134652,_0x51f2c7){return db[_0xf152('0x29')][_0xf152('0x48')]()[_0xf152('0x22')](respondWithResult(_0x51f2c7,null))[_0xf152('0x3e')](handleError(_0x51f2c7,null));}; \ No newline at end of file +var _0xd523=['hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','filtears','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x3fa856,_0x4672eb){var _0x319de9=function(_0x355450){while(--_0x355450){_0x3fa856['push'](_0x3fa856['shift']());}};_0x319de9(++_0x4672eb);}(_0xd523,0x153));var _0x3d52=function(_0x5d3d42,_0x1b5569){_0x5d3d42=_0x5d3d42-0x0;var _0x2f36a1=_0xd523[_0x5d3d42];return _0x2f36a1;};'use strict';var pdf=require(_0x3d52('0x0'));var emlformat=require(_0x3d52('0x1'));var rimraf=require(_0x3d52('0x2'));var zipdir=require(_0x3d52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d52('0x4'));var moment=require(_0x3d52('0x5'));var BPromise=require(_0x3d52('0x6'));var Mustache=require('mustache');var util=require(_0x3d52('0x7'));var path=require(_0x3d52('0x8'));var sox=require(_0x3d52('0x9'));var csv=require(_0x3d52('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3d52('0xb'));var crypto=require(_0x3d52('0xc'));var jsforce=require(_0x3d52('0xd'));var deskjs=require(_0x3d52('0xe'));var toCsv=require(_0x3d52('0xa'));var querystring=require(_0x3d52('0xf'));var Papa=require(_0x3d52('0x10'));var Redis=require(_0x3d52('0x11'));var authService=require(_0x3d52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d52('0x13'));var hardwareService=require(_0x3d52('0x14'));var logger=require(_0x3d52('0x15'))(_0x3d52('0x16'));var utils=require(_0x3d52('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3d52('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47bc45,_0x3e2235){_0x3e2235=_0x3e2235||0xcc;return function(_0x42b184){if(_0x42b184){return _0x47bc45['sendStatus'](_0x3e2235);}return _0x47bc45['status'](_0x3e2235)['end']();};}function respondWithResult(_0xea5c9,_0x3ddc64){_0x3ddc64=_0x3ddc64||0xc8;return function(_0x1430c1){if(_0x1430c1){return _0xea5c9[_0x3d52('0x19')](_0x3ddc64)[_0x3d52('0x1a')](_0x1430c1);}};}function respondWithFilteredResult(_0x5add11,_0x1aaa98){return function(_0x36acb8){if(_0x36acb8){var _0x2e956d=_0x36acb8[_0x3d52('0x1b')],_0x360659=_0x1aaa98[_0x3d52('0x1c')],_0x153c89=_0x1aaa98[_0x3d52('0x1c')]+_0x1aaa98['limit'],_0x15cc02;if(_0x153c89>=_0x2e956d){_0x153c89=_0x2e956d;_0x15cc02=0xc8;}else{_0x15cc02=0xce;}_0x5add11[_0x3d52('0x19')](_0x15cc02);return _0x5add11[_0x3d52('0x1d')](_0x3d52('0x1e'),_0x360659+'-'+_0x153c89+'/'+_0x2e956d)['json'](_0x36acb8);}return null;};}function patchUpdates(_0x3b90a6){return function(_0x5b5069){try{jsonpatch[_0x3d52('0x1f')](_0x5b5069,_0x3b90a6,!![]);}catch(_0x534fc4){return BPromise[_0x3d52('0x20')](_0x534fc4);}return _0x5b5069[_0x3d52('0x21')]();};}function saveUpdates(_0x1163c5,_0x15ca40){return function(_0x3bd95f){if(_0x3bd95f){return _0x3bd95f[_0x3d52('0x22')](_0x1163c5)[_0x3d52('0x23')](function(_0x34b572){return _0x34b572;});}return null;};}function removeEntity(_0x5bc83f,_0x419c05){return function(_0x10f432){if(_0x10f432){return _0x10f432[_0x3d52('0x24')]()['then'](function(){_0x5bc83f[_0x3d52('0x19')](0xcc)[_0x3d52('0x25')]();});}};}function handleEntityNotFound(_0x423d33,_0xc6c76){return function(_0x3816bc){if(!_0x3816bc){_0x423d33[_0x3d52('0x26')](0x194);}return _0x3816bc;};}function handleError(_0xdf73cd,_0xd8b0a4){_0xd8b0a4=_0xd8b0a4||0x1f4;return function(_0x44ba59){logger[_0x3d52('0x27')](_0x44ba59[_0x3d52('0x28')]);if(_0x44ba59['name']){delete _0x44ba59[_0x3d52('0x29')];}_0xdf73cd[_0x3d52('0x19')](_0xd8b0a4)[_0x3d52('0x2a')](_0x44ba59);};}exports[_0x3d52('0x2b')]=function(_0x490ce5,_0x4befc8){var _0x473842={},_0x11bf44={},_0x28e50d={'count':0x0,'rows':[]};var _0x5adddf=_[_0x3d52('0x2c')](db[_0x3d52('0x2d')][_0x3d52('0x2e')],function(_0x2f2934){return{'name':_0x2f2934['fieldName'],'type':_0x2f2934[_0x3d52('0x2f')][_0x3d52('0x30')]};});_0x11bf44[_0x3d52('0x31')]=_[_0x3d52('0x2c')](_0x5adddf,'name');_0x11bf44[_0x3d52('0x32')]=_['keys'](_0x490ce5[_0x3d52('0x32')]);_0x11bf44[_0x3d52('0x33')]=_[_0x3d52('0x34')](_0x11bf44['model'],_0x11bf44[_0x3d52('0x32')]);_0x473842['attributes']=_[_0x3d52('0x34')](_0x11bf44['model'],qs['fields'](_0x490ce5[_0x3d52('0x32')][_0x3d52('0x35')]));_0x473842[_0x3d52('0x36')]=_0x473842[_0x3d52('0x36')][_0x3d52('0x37')]?_0x473842[_0x3d52('0x36')]:_0x11bf44[_0x3d52('0x31')];if(!_0x490ce5[_0x3d52('0x32')][_0x3d52('0x38')]('nolimit')){_0x473842[_0x3d52('0x39')]=qs[_0x3d52('0x39')](_0x490ce5[_0x3d52('0x32')][_0x3d52('0x39')]);_0x473842['offset']=qs[_0x3d52('0x1c')](_0x490ce5[_0x3d52('0x32')]['offset']);}_0x473842[_0x3d52('0x3a')]=qs['sort'](_0x490ce5[_0x3d52('0x32')][_0x3d52('0x3b')]);_0x473842[_0x3d52('0x3c')]=qs['filters'](_[_0x3d52('0x3d')](_0x490ce5['query'],_0x11bf44[_0x3d52('0x33')]),_0x5adddf);if(_0x490ce5[_0x3d52('0x32')][_0x3d52('0x3e')]){_0x473842['where']=_['merge'](_0x473842[_0x3d52('0x3c')],{'$or':_[_0x3d52('0x2c')](_0x5adddf,function(_0x98706f){if(_0x98706f['type']!==_0x3d52('0x3f')){var _0x22262c={};_0x22262c[_0x98706f[_0x3d52('0x29')]]={'$like':'%'+_0x490ce5[_0x3d52('0x32')]['filter']+'%'};return _0x22262c;}})});}_0x473842=_[_0x3d52('0x40')]({},_0x473842,_0x490ce5['options']);var _0x563fe5={'where':_0x473842[_0x3d52('0x3c')]};return db['SquareReport'][_0x3d52('0x1b')](_0x563fe5)['then'](function(_0x2099d3){_0x28e50d['count']=_0x2099d3;if(_0x490ce5[_0x3d52('0x32')][_0x3d52('0x41')]){_0x473842[_0x3d52('0x42')]=[{'all':!![]}];}return db['SquareReport'][_0x3d52('0x43')](_0x473842);})[_0x3d52('0x23')](function(_0x5a4c0b){_0x28e50d[_0x3d52('0x44')]=_0x5a4c0b;return _0x28e50d;})[_0x3d52('0x23')](respondWithFilteredResult(_0x4befc8,_0x473842))[_0x3d52('0x45')](handleError(_0x4befc8,null));};exports[_0x3d52('0x46')]=function(_0x9a2811,_0x46091f){var _0x317a53={'raw':!![],'where':{'id':_0x9a2811['params']['id']}},_0x5cf4b9={};_0x5cf4b9['model']=_['keys'](db['SquareReport'][_0x3d52('0x2e')]);_0x5cf4b9['query']=_[_0x3d52('0x47')](_0x9a2811['query']);_0x5cf4b9[_0x3d52('0x48')]=_[_0x3d52('0x34')](_0x5cf4b9[_0x3d52('0x31')],_0x5cf4b9[_0x3d52('0x32')]);_0x317a53['attributes']=_[_0x3d52('0x34')](_0x5cf4b9[_0x3d52('0x31')],qs['fields'](_0x9a2811[_0x3d52('0x32')][_0x3d52('0x35')]));_0x317a53[_0x3d52('0x36')]=_0x317a53['attributes'][_0x3d52('0x37')]?_0x317a53['attributes']:_0x5cf4b9['model'];if(_0x9a2811['query']['includeAll']){_0x317a53[_0x3d52('0x42')]=[{'all':!![]}];}_0x317a53=_[_0x3d52('0x40')]({},_0x317a53,_0x9a2811[_0x3d52('0x49')]);return db['SquareReport'][_0x3d52('0x4a')](_0x317a53)['then'](handleEntityNotFound(_0x46091f,null))[_0x3d52('0x23')](respondWithResult(_0x46091f,null))[_0x3d52('0x45')](handleError(_0x46091f,null));};exports['create']=function(_0x3ff09c,_0x183d14){return db[_0x3d52('0x2d')][_0x3d52('0x4b')](_0x3ff09c['body'],{})['then'](respondWithResult(_0x183d14,0xc9))[_0x3d52('0x45')](handleError(_0x183d14,null));};exports['update']=function(_0x42a438,_0x146a89){if(_0x42a438[_0x3d52('0x4c')]['id']){delete _0x42a438[_0x3d52('0x4c')]['id'];}return db['SquareReport'][_0x3d52('0x4a')]({'where':{'id':_0x42a438['params']['id']}})[_0x3d52('0x23')](handleEntityNotFound(_0x146a89,null))[_0x3d52('0x23')](saveUpdates(_0x42a438['body'],null))[_0x3d52('0x23')](respondWithResult(_0x146a89,null))[_0x3d52('0x45')](handleError(_0x146a89,null));};exports[_0x3d52('0x24')]=function(_0x432521,_0x2b0c0e){return db[_0x3d52('0x2d')][_0x3d52('0x4a')]({'where':{'id':_0x432521[_0x3d52('0x4d')]['id']}})[_0x3d52('0x23')](handleEntityNotFound(_0x2b0c0e,null))['then'](removeEntity(_0x2b0c0e,null))[_0x3d52('0x45')](handleError(_0x2b0c0e,null));};exports[_0x3d52('0x4e')]=function(_0x569e47,_0x237a6e){return db['SquareReport'][_0x3d52('0x4e')]()[_0x3d52('0x23')](respondWithResult(_0x237a6e,null))[_0x3d52('0x45')](handleError(_0x237a6e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index ad91dc3..285d4fe 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 _0x3be0=['report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define','SquareReport'];(function(_0x4b404c,_0x3a521c){var _0x253982=function(_0x3feba4){while(--_0x3feba4){_0x4b404c['push'](_0x4b404c['shift']());}};_0x253982(++_0x3a521c);}(_0x3be0,0x17c));var _0x03be=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x3be0[_0x471273];return _0x56c63e;};'use strict';var _=require(_0x03be('0x0'));var util=require(_0x03be('0x1'));var logger=require(_0x03be('0x2'))(_0x03be('0x3'));var moment=require('moment');var BPromise=require(_0x03be('0x4'));var rp=require(_0x03be('0x5'));var fs=require('fs');var path=require(_0x03be('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x03be('0x7')]=function(_0x4266e8,_0x5560d6){return _0x4266e8[_0x03be('0x8')](_0x03be('0x9'),attributes,{'tableName':_0x03be('0xa'),'paranoid':![],'indexes':[{'name':_0x03be('0xb'),'fields':[_0x03be('0xc'),_0x03be('0xd')]},{'name':_0x03be('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7da3=['../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','leaveAt','lodash','api','bluebird','request-promise','rimraf'];(function(_0x22d623,_0x34de81){var _0x2b0105=function(_0x3b5053){while(--_0x3b5053){_0x22d623['push'](_0x22d623['shift']());}};_0x2b0105(++_0x34de81);}(_0x7da3,0xb1));var _0x37da=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x7da3[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x37da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x37da('0x1'));var moment=require('moment');var BPromise=require(_0x37da('0x2'));var rp=require(_0x37da('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37da('0x4'));var config=require(_0x37da('0x5'));var attributes=require('./squareReport.attributes');module[_0x37da('0x6')]=function(_0x564668,_0x30eec6){return _0x564668[_0x37da('0x7')](_0x37da('0x8'),attributes,{'tableName':_0x37da('0x9'),'paranoid':![],'indexes':[{'name':_0x37da('0xa'),'fields':[_0x37da('0xb'),'project_name']},{'name':_0x37da('0xc'),'fields':[_0x37da('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 5947c8c..20de77f 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 _0x46ed=['options','raw','CreateSquareReport','catch','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body'];(function(_0x380af2,_0x36cf66){var _0x1789dc=function(_0x37b604){while(--_0x37b604){_0x380af2['push'](_0x380af2['shift']());}};_0x1789dc(++_0x36cf66);}(_0x46ed,0x168));var _0xd46e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x46ed[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareReport,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareReport']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareReport'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});};exports[_0xd46e('0x1c')]=function(_0x62dea5){var _0x4cf899=this;return new Promise(function(_0x314570,_0x5424e5){return db['SquareReport'][_0xd46e('0x1d')](_0x62dea5[_0xd46e('0x17')],{'raw':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')]['where']||null:null,'attributes':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1e')]||null:null,'limit':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1f')]||null:null})['then'](function(_0x465d54){logger[_0xd46e('0xd')](_0xd46e('0x1c'),_0x62dea5);logger[_0xd46e('0xf')](_0xd46e('0x1c'),_0x62dea5,JSON[_0xd46e('0x12')](_0x465d54));_0x314570(_0x465d54);})[_0xd46e('0x1b')](function(_0x2c5ec7){logger[_0xd46e('0x13')](_0xd46e('0x1c'),_0x2c5ec7[_0xd46e('0x14')],_0x62dea5);_0x5424e5(_0x4cf899[_0xd46e('0x13')](0x1f4,_0x2c5ec7[_0xd46e('0x14')]));});});}; \ No newline at end of file +var _0xdc97=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x1bd78f,_0x375e67){var _0x49b5eb=function(_0x4ef8bb){while(--_0x4ef8bb){_0x1bd78f['push'](_0x1bd78f['shift']());}};_0x49b5eb(++_0x375e67);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2e0bac,_0x23ee7a){_0x2e0bac=_0x2e0bac-0x0;var _0x3a67a6=_0xdc97[_0x2e0bac];return _0x3a67a6;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});}exports['CreateSquareReport']=function(_0x22577e){var _0x4afb47=this;return new Promise(function(_0x1f5906,_0x1cc237){return db['SquareReport'][_0x7dc9('0x16')](_0x22577e[_0x7dc9('0x17')],{'raw':_0x22577e[_0x7dc9('0x18')]?_0x22577e[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![]})[_0x7dc9('0xb')](function(_0x2dad65){logger[_0x7dc9('0x13')](_0x7dc9('0x1a'),_0x22577e);logger[_0x7dc9('0xe')]('CreateSquareReport',_0x22577e,JSON['stringify'](_0x2dad65));_0x1f5906(_0x2dad65);})[_0x7dc9('0x15')](function(_0x5981e2){logger['error'](_0x7dc9('0x1a'),_0x5981e2[_0x7dc9('0x12')],_0x22577e);_0x1cc237(_0x4afb47['error'](0x1f4,_0x5981e2[_0x7dc9('0x12')]));});});};exports[_0x7dc9('0x1b')]=function(_0x41110a){var _0x4906b1=this;return new Promise(function(_0x424763,_0x1e3a8d){return db[_0x7dc9('0x1c')]['update'](_0x41110a['body'],{'raw':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41110a['options']?_0x41110a['options'][_0x7dc9('0x1d')]||null:null,'attributes':_0x41110a['options']?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1e')]||null:null,'limit':_0x41110a[_0x7dc9('0x18')]?_0x41110a[_0x7dc9('0x18')][_0x7dc9('0x1f')]||null:null})[_0x7dc9('0xb')](function(_0x236d42){logger[_0x7dc9('0x13')](_0x7dc9('0x1b'),_0x41110a);logger[_0x7dc9('0xe')](_0x7dc9('0x1b'),_0x41110a,JSON[_0x7dc9('0x10')](_0x236d42));_0x424763(_0x236d42);})['catch'](function(_0x4e929c){logger['error']('UpdateSquareReport',_0x4e929c['message'],_0x41110a);_0x1e3a8d(_0x4906b1['error'](0x1f4,_0x4e929c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 9282a9e..92b265a 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(_0x5cb6ca,_0xab5bd0){var _0x1c8126=function(_0x4e37ef){while(--_0x4e37ef){_0x5cb6ca['push'](_0x5cb6ca['shift']());}};_0x1c8126(++_0xab5bd0);}(_0x7a54,0x106));var _0x47a5=function(_0x46b81f,_0x5a9f1e){_0x46b81f=_0x46b81f-0x0;var _0x249c71=_0x7a54[_0x46b81f];return _0x249c71;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x2c5d16,_0x234577){var _0x5e3f87=function(_0x268907){while(--_0x268907){_0x2c5d16['push'](_0x2c5d16['shift']());}};_0x5e3f87(++_0x234577);}(_0x7a54,0x106));var _0x47a5=function(_0x4dba27,_0x4505b5){_0x4dba27=_0x4dba27-0x0;var _0x5b8833=_0x7a54[_0x4dba27];return _0x5b8833;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f161de6..95dc14e 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 _0x50a8=['sequelize','STRING','TEXT'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x50a8,0x1b6));var _0x850a=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x50a8[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x850a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x850a('0x1')]},'node':{'type':Sequelize[_0x850a('0x1')]},'application':{'type':Sequelize[_0x850a('0x1')]},'data':{'type':Sequelize[_0x850a('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x850a('0x1')]}}; \ No newline at end of file +var _0x8213=['exports','STRING'];(function(_0x3f035c,_0x2ddd67){var _0x1c4c36=function(_0x5bf2f8){while(--_0x5bf2f8){_0x3f035c['push'](_0x3f035c['shift']());}};_0x1c4c36(++_0x2ddd67);}(_0x8213,0x1a4));var _0x3821=function(_0x26576c,_0x3d0f6e){_0x26576c=_0x26576c-0x0;var _0x228119=_0x8213[_0x26576c];return _0x228119;};'use strict';var Sequelize=require('sequelize');module[_0x3821('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3821('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3821('0x1')]},'callerid':{'type':Sequelize[_0x3821('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 189bb23..1ef5b83 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 _0x56e7=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','filtears','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis'];(function(_0x59ee42,_0x224ab8){var _0xcc23d8=function(_0x36db96){while(--_0x36db96){_0x59ee42['push'](_0x59ee42['shift']());}};_0xcc23d8(++_0x224ab8);}(_0x56e7,0x7b));var _0x756e=function(_0x15bb84,_0x12876a){_0x15bb84=_0x15bb84-0x0;var _0x2c334c=_0x56e7[_0x15bb84];return _0x2c334c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x756e('0x0'));var rimraf=require(_0x756e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x756e('0x2'));var rp=require(_0x756e('0x3'));var moment=require(_0x756e('0x4'));var BPromise=require(_0x756e('0x5'));var Mustache=require(_0x756e('0x6'));var util=require(_0x756e('0x7'));var path=require(_0x756e('0x8'));var sox=require('sox');var csv=require(_0x756e('0x9'));var ejs=require(_0x756e('0xa'));var fs=require('fs');var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0x9'));var querystring=require(_0x756e('0xe'));var Papa=require(_0x756e('0xf'));var Redis=require(_0x756e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x11'));var hardwareService=require(_0x756e('0x12'));var logger=require(_0x756e('0x13'))('api');var utils=require(_0x756e('0x14'));var config=require(_0x756e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b68ef,_0x569e8f){_0x569e8f=_0x569e8f||0xcc;return function(_0x459237){if(_0x459237){return _0x1b68ef[_0x756e('0x16')](_0x569e8f);}return _0x1b68ef[_0x756e('0x17')](_0x569e8f)[_0x756e('0x18')]();};}function respondWithResult(_0x252333,_0x4ae32a){_0x4ae32a=_0x4ae32a||0xc8;return function(_0x4b3660){if(_0x4b3660){return _0x252333[_0x756e('0x17')](_0x4ae32a)[_0x756e('0x19')](_0x4b3660);}};}function respondWithFilteredResult(_0xccccd4,_0x59956f){return function(_0x530e36){if(_0x530e36){var _0x1f7161=_0x530e36[_0x756e('0x1a')],_0x33dd9c=_0x59956f[_0x756e('0x1b')],_0x1cf73d=_0x59956f[_0x756e('0x1b')]+_0x59956f[_0x756e('0x1c')],_0x296b14;if(_0x1cf73d>=_0x1f7161){_0x1cf73d=_0x1f7161;_0x296b14=0xc8;}else{_0x296b14=0xce;}_0xccccd4[_0x756e('0x17')](_0x296b14);return _0xccccd4['set'](_0x756e('0x1d'),_0x33dd9c+'-'+_0x1cf73d+'/'+_0x1f7161)['json'](_0x530e36);}return null;};}function patchUpdates(_0x4d7581){return function(_0x157be3){try{jsonpatch[_0x756e('0x1e')](_0x157be3,_0x4d7581,!![]);}catch(_0x30bc11){return BPromise[_0x756e('0x1f')](_0x30bc11);}return _0x157be3[_0x756e('0x20')]();};}function saveUpdates(_0x4e99a2,_0xb00195){return function(_0x27e1eb){if(_0x27e1eb){return _0x27e1eb[_0x756e('0x21')](_0x4e99a2)[_0x756e('0x22')](function(_0x147929){return _0x147929;});}return null;};}function removeEntity(_0x83cdb5,_0x42173f){return function(_0x24d4ad){if(_0x24d4ad){return _0x24d4ad[_0x756e('0x23')]()[_0x756e('0x22')](function(){_0x83cdb5['status'](0xcc)[_0x756e('0x18')]();});}};}function handleEntityNotFound(_0x4b38b4,_0x256dc1){return function(_0x4152bd){if(!_0x4152bd){_0x4b38b4[_0x756e('0x16')](0x194);}return _0x4152bd;};}function handleError(_0x2722eb,_0x506986){_0x506986=_0x506986||0x1f4;return function(_0x3ef5ef){logger[_0x756e('0x24')](_0x3ef5ef[_0x756e('0x25')]);if(_0x3ef5ef['name']){delete _0x3ef5ef[_0x756e('0x26')];}_0x2722eb[_0x756e('0x17')](_0x506986)[_0x756e('0x27')](_0x3ef5ef);};}exports['index']=function(_0xf09ae3,_0x9db13b){var _0x5b4bf0={},_0x39befb={},_0x43df79={'count':0x0,'rows':[]};var _0x345162=_['map'](db[_0x756e('0x28')][_0x756e('0x29')],function(_0x5c6949){return{'name':_0x5c6949[_0x756e('0x2a')],'type':_0x5c6949[_0x756e('0x2b')]['key']};});_0x39befb[_0x756e('0x2c')]=_[_0x756e('0x2d')](_0x345162,_0x756e('0x26'));_0x39befb[_0x756e('0x2e')]=_[_0x756e('0x2f')](_0xf09ae3['query']);_0x39befb[_0x756e('0x30')]=_['intersection'](_0x39befb['model'],_0x39befb[_0x756e('0x2e')]);_0x5b4bf0['attributes']=_[_0x756e('0x31')](_0x39befb[_0x756e('0x2c')],qs[_0x756e('0x32')](_0xf09ae3[_0x756e('0x2e')][_0x756e('0x32')]));_0x5b4bf0[_0x756e('0x33')]=_0x5b4bf0[_0x756e('0x33')][_0x756e('0x34')]?_0x5b4bf0[_0x756e('0x33')]:_0x39befb[_0x756e('0x2c')];if(!_0xf09ae3[_0x756e('0x2e')][_0x756e('0x35')]('nolimit')){_0x5b4bf0['limit']=qs[_0x756e('0x1c')](_0xf09ae3[_0x756e('0x2e')][_0x756e('0x1c')]);_0x5b4bf0[_0x756e('0x1b')]=qs[_0x756e('0x1b')](_0xf09ae3[_0x756e('0x2e')][_0x756e('0x1b')]);}_0x5b4bf0['order']=qs['sort'](_0xf09ae3['query'][_0x756e('0x36')]);_0x5b4bf0[_0x756e('0x37')]=qs[_0x756e('0x30')](_['pick'](_0xf09ae3[_0x756e('0x2e')],_0x39befb[_0x756e('0x30')]),_0x345162);if(_0xf09ae3['query'][_0x756e('0x38')]){_0x5b4bf0[_0x756e('0x37')]=_[_0x756e('0x39')](_0x5b4bf0[_0x756e('0x37')],{'$or':_[_0x756e('0x2d')](_0x345162,function(_0x26965c){if(_0x26965c[_0x756e('0x2b')]!==_0x756e('0x3a')){var _0x4a649b={};_0x4a649b[_0x26965c[_0x756e('0x26')]]={'$like':'%'+_0xf09ae3[_0x756e('0x2e')][_0x756e('0x38')]+'%'};return _0x4a649b;}})});}_0x5b4bf0=_[_0x756e('0x39')]({},_0x5b4bf0,_0xf09ae3[_0x756e('0x3b')]);var _0x3a66fe={'where':_0x5b4bf0[_0x756e('0x37')]};return db[_0x756e('0x28')][_0x756e('0x1a')](_0x3a66fe)[_0x756e('0x22')](function(_0x5bb3bd){_0x43df79[_0x756e('0x1a')]=_0x5bb3bd;if(_0xf09ae3[_0x756e('0x2e')]['includeAll']){_0x5b4bf0[_0x756e('0x3c')]=[{'all':!![]}];}return db[_0x756e('0x28')][_0x756e('0x3d')](_0x5b4bf0);})['then'](function(_0xd3258b){_0x43df79[_0x756e('0x3e')]=_0xd3258b;return _0x43df79;})[_0x756e('0x22')](respondWithFilteredResult(_0x9db13b,_0x5b4bf0))['catch'](handleError(_0x9db13b,null));};exports[_0x756e('0x3f')]=function(_0x3c326d,_0x5856f){var _0x1fc45c={'raw':!![],'where':{'id':_0x3c326d[_0x756e('0x40')]['id']}},_0x3eece7={};_0x3eece7['model']=_[_0x756e('0x2f')](db[_0x756e('0x28')]['rawAttributes']);_0x3eece7[_0x756e('0x2e')]=_[_0x756e('0x2f')](_0x3c326d[_0x756e('0x2e')]);_0x3eece7[_0x756e('0x41')]=_[_0x756e('0x31')](_0x3eece7[_0x756e('0x2c')],_0x3eece7[_0x756e('0x2e')]);_0x1fc45c[_0x756e('0x33')]=_[_0x756e('0x31')](_0x3eece7['model'],qs[_0x756e('0x32')](_0x3c326d['query'][_0x756e('0x32')]));_0x1fc45c[_0x756e('0x33')]=_0x1fc45c[_0x756e('0x33')]['length']?_0x1fc45c[_0x756e('0x33')]:_0x3eece7[_0x756e('0x2c')];if(_0x3c326d[_0x756e('0x2e')]['includeAll']){_0x1fc45c['include']=[{'all':!![]}];}_0x1fc45c=_[_0x756e('0x39')]({},_0x1fc45c,_0x3c326d[_0x756e('0x3b')]);return db['SquareDetailsReport']['find'](_0x1fc45c)[_0x756e('0x22')](handleEntityNotFound(_0x5856f,null))[_0x756e('0x22')](respondWithResult(_0x5856f,null))[_0x756e('0x42')](handleError(_0x5856f,null));};exports['create']=function(_0x3c70a1,_0x47c888){return db[_0x756e('0x28')][_0x756e('0x43')](_0x3c70a1[_0x756e('0x44')],{})['then'](respondWithResult(_0x47c888,0xc9))[_0x756e('0x42')](handleError(_0x47c888,null));};exports['update']=function(_0x5064a3,_0x44faf4){if(_0x5064a3['body']['id']){delete _0x5064a3[_0x756e('0x44')]['id'];}return db[_0x756e('0x28')][_0x756e('0x45')]({'where':{'id':_0x5064a3[_0x756e('0x40')]['id']}})[_0x756e('0x22')](handleEntityNotFound(_0x44faf4,null))[_0x756e('0x22')](saveUpdates(_0x5064a3['body'],null))[_0x756e('0x22')](respondWithResult(_0x44faf4,null))['catch'](handleError(_0x44faf4,null));};exports[_0x756e('0x23')]=function(_0x555d22,_0x34c252){return db['SquareDetailsReport'][_0x756e('0x45')]({'where':{'id':_0x555d22['params']['id']}})[_0x756e('0x22')](handleEntityNotFound(_0x34c252,null))[_0x756e('0x22')](removeEntity(_0x34c252,null))[_0x756e('0x42')](handleError(_0x34c252,null));};exports['describe']=function(_0x424578,_0xd813e1){return db['SquareDetailsReport']['describe']()[_0x756e('0x22')](respondWithResult(_0xd813e1,null))[_0x756e('0x42')](handleError(_0xd813e1,null));}; \ No newline at end of file +var _0x3eea=['update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','filtears','fields','find','create','body'];(function(_0x3501ab,_0x12ddca){var _0x24e8af=function(_0x38665f){while(--_0x38665f){_0x3501ab['push'](_0x3501ab['shift']());}};_0x24e8af(++_0x12ddca);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x330a07,_0x56e612){_0x330a07=_0x330a07-0x0;var _0x27eecb=_0x3eea[_0x330a07];return _0x27eecb;};'use strict';var pdf=require(_0xa3ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa3ee('0x1'));var zipdir=require(_0xa3ee('0x2'));var jsonpatch=require(_0xa3ee('0x3'));var rp=require(_0xa3ee('0x4'));var moment=require(_0xa3ee('0x5'));var BPromise=require(_0xa3ee('0x6'));var Mustache=require(_0xa3ee('0x7'));var util=require(_0xa3ee('0x8'));var path=require(_0xa3ee('0x9'));var sox=require(_0xa3ee('0xa'));var csv=require(_0xa3ee('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa3ee('0xc'));var crypto=require('crypto');var jsforce=require(_0xa3ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa3ee('0xb'));var querystring=require('querystring');var Papa=require(_0xa3ee('0xe'));var Redis=require('ioredis');var authService=require(_0xa3ee('0xf'));var qs=require(_0xa3ee('0x10'));var as=require(_0xa3ee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3ee('0x12'))(_0xa3ee('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa3ee('0x14'));var db=require(_0xa3ee('0x15'))['db'];function respondWithStatusCode(_0x403518,_0x4363d1){_0x4363d1=_0x4363d1||0xcc;return function(_0x594c88){if(_0x594c88){return _0x403518[_0xa3ee('0x16')](_0x4363d1);}return _0x403518['status'](_0x4363d1)[_0xa3ee('0x17')]();};}function respondWithResult(_0x20535f,_0x2c34cf){_0x2c34cf=_0x2c34cf||0xc8;return function(_0x150e20){if(_0x150e20){return _0x20535f['status'](_0x2c34cf)[_0xa3ee('0x18')](_0x150e20);}};}function respondWithFilteredResult(_0x23df7d,_0x5da681){return function(_0x5358aa){if(_0x5358aa){var _0x4b2c66=_0x5358aa[_0xa3ee('0x19')],_0x40decb=_0x5da681['offset'],_0x7277cd=_0x5da681[_0xa3ee('0x1a')]+_0x5da681[_0xa3ee('0x1b')],_0x354dd5;if(_0x7277cd>=_0x4b2c66){_0x7277cd=_0x4b2c66;_0x354dd5=0xc8;}else{_0x354dd5=0xce;}_0x23df7d[_0xa3ee('0x1c')](_0x354dd5);return _0x23df7d[_0xa3ee('0x1d')](_0xa3ee('0x1e'),_0x40decb+'-'+_0x7277cd+'/'+_0x4b2c66)['json'](_0x5358aa);}return null;};}function patchUpdates(_0x377b9d){return function(_0x18b738){try{jsonpatch[_0xa3ee('0x1f')](_0x18b738,_0x377b9d,!![]);}catch(_0xad8187){return BPromise[_0xa3ee('0x20')](_0xad8187);}return _0x18b738[_0xa3ee('0x21')]();};}function saveUpdates(_0x4f8c56,_0x3f5d70){return function(_0x446971){if(_0x446971){return _0x446971['update'](_0x4f8c56)[_0xa3ee('0x22')](function(_0x4e7f32){return _0x4e7f32;});}return null;};}function removeEntity(_0x2fab5,_0x29df43){return function(_0x1d3022){if(_0x1d3022){return _0x1d3022[_0xa3ee('0x23')]()[_0xa3ee('0x22')](function(){_0x2fab5[_0xa3ee('0x1c')](0xcc)[_0xa3ee('0x17')]();});}};}function handleEntityNotFound(_0x12108e,_0x5ae0a1){return function(_0x3aa81d){if(!_0x3aa81d){_0x12108e['sendStatus'](0x194);}return _0x3aa81d;};}function handleError(_0x1998b9,_0x1dca29){_0x1dca29=_0x1dca29||0x1f4;return function(_0x157071){logger[_0xa3ee('0x24')](_0x157071[_0xa3ee('0x25')]);if(_0x157071['name']){delete _0x157071[_0xa3ee('0x26')];}_0x1998b9[_0xa3ee('0x1c')](_0x1dca29)[_0xa3ee('0x27')](_0x157071);};}exports[_0xa3ee('0x28')]=function(_0x42e97c,_0xa9e4d6){var _0x443507={},_0x30b12b={},_0xea54fe={'count':0x0,'rows':[]};var _0x298cb4=_['map'](db['SquareDetailsReport']['rawAttributes'],function(_0x78e581){return{'name':_0x78e581['fieldName'],'type':_0x78e581[_0xa3ee('0x29')][_0xa3ee('0x2a')]};});_0x30b12b[_0xa3ee('0x2b')]=_[_0xa3ee('0x2c')](_0x298cb4,_0xa3ee('0x26'));_0x30b12b[_0xa3ee('0x2d')]=_[_0xa3ee('0x2e')](_0x42e97c[_0xa3ee('0x2d')]);_0x30b12b[_0xa3ee('0x2f')]=_[_0xa3ee('0x30')](_0x30b12b['model'],_0x30b12b[_0xa3ee('0x2d')]);_0x443507['attributes']=_[_0xa3ee('0x30')](_0x30b12b[_0xa3ee('0x2b')],qs['fields'](_0x42e97c[_0xa3ee('0x2d')]['fields']));_0x443507[_0xa3ee('0x31')]=_0x443507['attributes'][_0xa3ee('0x32')]?_0x443507[_0xa3ee('0x31')]:_0x30b12b[_0xa3ee('0x2b')];if(!_0x42e97c[_0xa3ee('0x2d')][_0xa3ee('0x33')]('nolimit')){_0x443507[_0xa3ee('0x1b')]=qs[_0xa3ee('0x1b')](_0x42e97c[_0xa3ee('0x2d')]['limit']);_0x443507[_0xa3ee('0x1a')]=qs['offset'](_0x42e97c[_0xa3ee('0x2d')]['offset']);}_0x443507[_0xa3ee('0x34')]=qs['sort'](_0x42e97c[_0xa3ee('0x2d')][_0xa3ee('0x35')]);_0x443507[_0xa3ee('0x36')]=qs[_0xa3ee('0x2f')](_[_0xa3ee('0x37')](_0x42e97c[_0xa3ee('0x2d')],_0x30b12b[_0xa3ee('0x2f')]),_0x298cb4);if(_0x42e97c[_0xa3ee('0x2d')][_0xa3ee('0x38')]){_0x443507[_0xa3ee('0x36')]=_[_0xa3ee('0x39')](_0x443507[_0xa3ee('0x36')],{'$or':_[_0xa3ee('0x2c')](_0x298cb4,function(_0x595b55){if(_0x595b55[_0xa3ee('0x29')]!==_0xa3ee('0x3a')){var _0x2aec25={};_0x2aec25[_0x595b55[_0xa3ee('0x26')]]={'$like':'%'+_0x42e97c['query'][_0xa3ee('0x38')]+'%'};return _0x2aec25;}})});}_0x443507=_[_0xa3ee('0x39')]({},_0x443507,_0x42e97c[_0xa3ee('0x3b')]);var _0x5b95e3={'where':_0x443507[_0xa3ee('0x36')]};return db[_0xa3ee('0x3c')]['count'](_0x5b95e3)[_0xa3ee('0x22')](function(_0x3ecbe6){_0xea54fe['count']=_0x3ecbe6;if(_0x42e97c[_0xa3ee('0x2d')][_0xa3ee('0x3d')]){_0x443507[_0xa3ee('0x3e')]=[{'all':!![]}];}return db[_0xa3ee('0x3c')][_0xa3ee('0x3f')](_0x443507);})[_0xa3ee('0x22')](function(_0x2ca04f){_0xea54fe[_0xa3ee('0x40')]=_0x2ca04f;return _0xea54fe;})[_0xa3ee('0x22')](respondWithFilteredResult(_0xa9e4d6,_0x443507))[_0xa3ee('0x41')](handleError(_0xa9e4d6,null));};exports[_0xa3ee('0x42')]=function(_0x549d74,_0x5aa4b3){var _0x548534={'raw':!![],'where':{'id':_0x549d74[_0xa3ee('0x43')]['id']}},_0x45aeec={};_0x45aeec['model']=_[_0xa3ee('0x2e')](db[_0xa3ee('0x3c')][_0xa3ee('0x44')]);_0x45aeec['query']=_[_0xa3ee('0x2e')](_0x549d74['query']);_0x45aeec[_0xa3ee('0x45')]=_[_0xa3ee('0x30')](_0x45aeec[_0xa3ee('0x2b')],_0x45aeec[_0xa3ee('0x2d')]);_0x548534[_0xa3ee('0x31')]=_[_0xa3ee('0x30')](_0x45aeec[_0xa3ee('0x2b')],qs[_0xa3ee('0x46')](_0x549d74[_0xa3ee('0x2d')][_0xa3ee('0x46')]));_0x548534[_0xa3ee('0x31')]=_0x548534[_0xa3ee('0x31')][_0xa3ee('0x32')]?_0x548534[_0xa3ee('0x31')]:_0x45aeec[_0xa3ee('0x2b')];if(_0x549d74[_0xa3ee('0x2d')][_0xa3ee('0x3d')]){_0x548534[_0xa3ee('0x3e')]=[{'all':!![]}];}_0x548534=_['merge']({},_0x548534,_0x549d74[_0xa3ee('0x3b')]);return db[_0xa3ee('0x3c')][_0xa3ee('0x47')](_0x548534)[_0xa3ee('0x22')](handleEntityNotFound(_0x5aa4b3,null))['then'](respondWithResult(_0x5aa4b3,null))[_0xa3ee('0x41')](handleError(_0x5aa4b3,null));};exports['create']=function(_0x3d6512,_0x3679b5){return db[_0xa3ee('0x3c')][_0xa3ee('0x48')](_0x3d6512[_0xa3ee('0x49')],{})[_0xa3ee('0x22')](respondWithResult(_0x3679b5,0xc9))[_0xa3ee('0x41')](handleError(_0x3679b5,null));};exports[_0xa3ee('0x4a')]=function(_0x3c3677,_0xd6160e){if(_0x3c3677['body']['id']){delete _0x3c3677[_0xa3ee('0x49')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x3c3677[_0xa3ee('0x43')]['id']}})[_0xa3ee('0x22')](handleEntityNotFound(_0xd6160e,null))[_0xa3ee('0x22')](saveUpdates(_0x3c3677[_0xa3ee('0x49')],null))[_0xa3ee('0x22')](respondWithResult(_0xd6160e,null))[_0xa3ee('0x41')](handleError(_0xd6160e,null));};exports[_0xa3ee('0x23')]=function(_0x501dad,_0x2d67f7){return db[_0xa3ee('0x3c')]['find']({'where':{'id':_0x501dad[_0xa3ee('0x43')]['id']}})[_0xa3ee('0x22')](handleEntityNotFound(_0x2d67f7,null))[_0xa3ee('0x22')](removeEntity(_0x2d67f7,null))['catch'](handleError(_0x2d67f7,null));};exports['describe']=function(_0x14335c,_0x345b5b){return db[_0xa3ee('0x3c')][_0xa3ee('0x4b')]()[_0xa3ee('0x22')](respondWithResult(_0x345b5b,null))['catch'](handleError(_0x345b5b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a2e16c4..01dd31f 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 _0x39bd=['define','SquareDetailsReport','report_square_details','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0x39bd,0x7c));var _0xd39b=function(_0x1efe72,_0x17dbd8){_0x1efe72=_0x1efe72-0x0;var _0x23af79=_0x39bd[_0x1efe72];return _0x23af79;};'use strict';var _=require(_0xd39b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd39b('0x1'));var moment=require('moment');var BPromise=require(_0xd39b('0x2'));var rp=require(_0xd39b('0x3'));var fs=require('fs');var path=require(_0xd39b('0x4'));var rimraf=require(_0xd39b('0x5'));var config=require(_0xd39b('0x6'));var attributes=require(_0xd39b('0x7'));module['exports']=function(_0x59c87e,_0x4746e8){return _0x59c87e[_0xd39b('0x8')](_0xd39b('0x9'),attributes,{'tableName':_0xd39b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e36=['exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x45f42e,_0x417bb){var _0x5704b6=function(_0x4d1621){while(--_0x4d1621){_0x45f42e['push'](_0x45f42e['shift']());}};_0x5704b6(++_0x417bb);}(_0x5e36,0xc8));var _0x65e3=function(_0x5c4a01,_0x172c0d){_0x5c4a01=_0x5c4a01-0x0;var _0x428950=_0x5e36[_0x5c4a01];return _0x428950;};'use strict';var _=require(_0x65e3('0x0'));var util=require(_0x65e3('0x1'));var logger=require('../../config/logger')(_0x65e3('0x2'));var moment=require(_0x65e3('0x3'));var BPromise=require(_0x65e3('0x4'));var rp=require(_0x65e3('0x5'));var fs=require('fs');var path=require(_0x65e3('0x6'));var rimraf=require(_0x65e3('0x7'));var config=require(_0x65e3('0x8'));var attributes=require(_0x65e3('0x9'));module[_0x65e3('0xa')]=function(_0x59a502,_0x35060c){return _0x59a502[_0x65e3('0xb')](_0x65e3('0xc'),attributes,{'tableName':_0x65e3('0xd'),'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 e852d9b..63276a3 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 _0x7f9f=['raw','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x3a14ac,_0x55403f){var _0x5e3bc3=function(_0x11f956){while(--_0x11f956){_0x3a14ac['push'](_0x3a14ac['shift']());}};_0x5e3bc3(++_0x55403f);}(_0x7f9f,0x124));var _0xf7f9=function(_0x3b0a41,_0x2032a3){_0x3b0a41=_0x3b0a41-0x0;var _0x2fafb0=_0x7f9f[_0x3b0a41];return _0x2fafb0;};'use strict';var _=require(_0xf7f9('0x0'));var util=require(_0xf7f9('0x1'));var moment=require(_0xf7f9('0x2'));var BPromise=require(_0xf7f9('0x3'));var rs=require(_0xf7f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf7f9('0x5'));var logger=require(_0xf7f9('0x6'))('rpc');var config=require(_0xf7f9('0x7'));var jayson=require(_0xf7f9('0x8'));var client=jayson[_0xf7f9('0x9')][_0xf7f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2df12b,_0x2c4225,_0x11c70d){return new BPromise(function(_0x12f286,_0x2ed421){return client['request'](_0x2df12b,_0x11c70d)[_0xf7f9('0xb')](function(_0x5f930d){logger[_0xf7f9('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2c4225,_0xf7f9('0xd'));logger[_0xf7f9('0xe')](_0xf7f9('0xf'),_0x2c4225,'request\x20sent',JSON['stringify'](_0x5f930d));if(_0x5f930d[_0xf7f9('0x10')]){if(_0x5f930d[_0xf7f9('0x10')][_0xf7f9('0x11')]===0x1f4){logger['error'](_0xf7f9('0x12'),_0x2c4225,_0x5f930d[_0xf7f9('0x10')][_0xf7f9('0x13')]);return _0x2ed421(_0x5f930d[_0xf7f9('0x10')][_0xf7f9('0x13')]);}logger[_0xf7f9('0x10')](_0xf7f9('0x12'),_0x2c4225,_0x5f930d['error'][_0xf7f9('0x13')]);return _0x12f286(_0x5f930d[_0xf7f9('0x10')][_0xf7f9('0x13')]);}else{logger[_0xf7f9('0xc')](_0xf7f9('0x12'),_0x2c4225,_0xf7f9('0xd'));_0x12f286(_0x5f930d[_0xf7f9('0x14')][_0xf7f9('0x13')]);}})[_0xf7f9('0x15')](function(_0xe907cb){logger[_0xf7f9('0x10')](_0xf7f9('0x12'),_0x2c4225,_0xe907cb);_0x2ed421(_0xe907cb);});});}exports[_0xf7f9('0x16')]=function(_0x381dbe){var _0x1a4e17=this;return new Promise(function(_0x53a1b8,_0x51f17c){return db[_0xf7f9('0x17')][_0xf7f9('0x18')](_0x381dbe[_0xf7f9('0x19')],{'raw':_0x381dbe['options']?_0x381dbe[_0xf7f9('0x1a')][_0xf7f9('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x155691){logger['info'](_0xf7f9('0x16'),_0x381dbe);logger[_0xf7f9('0xe')](_0xf7f9('0x16'),_0x381dbe,JSON[_0xf7f9('0x1c')](_0x155691));_0x53a1b8(_0x155691);})[_0xf7f9('0x15')](function(_0x25e9a1){logger[_0xf7f9('0x10')]('CreateSquareDetailsReport',_0x25e9a1[_0xf7f9('0x13')],_0x381dbe);_0x51f17c(_0x1a4e17[_0xf7f9('0x10')](0x1f4,_0x25e9a1['message']));});});}; \ No newline at end of file +var _0x2fa7=['error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','debug','stringify','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent'];(function(_0x77a96,_0x78d70a){var _0x168e07=function(_0x3d8581){while(--_0x3d8581){_0x77a96['push'](_0x77a96['shift']());}};_0x168e07(++_0x78d70a);}(_0x2fa7,0x187));var _0x72fa=function(_0xd4e952,_0x291af9){_0xd4e952=_0xd4e952-0x0;var _0x14ea3e=_0x2fa7[_0xd4e952];return _0x14ea3e;};'use strict';var _=require(_0x72fa('0x0'));var util=require('util');var moment=require(_0x72fa('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72fa('0x2'));var db=require(_0x72fa('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x72fa('0x4'))(_0x72fa('0x5'));var config=require('../../config/environment');var jayson=require(_0x72fa('0x6'));var client=jayson[_0x72fa('0x7')][_0x72fa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36bb34,_0x1e2f81,_0xa00e64){return new BPromise(function(_0x464fa3,_0x2b6367){return client[_0x72fa('0x9')](_0x36bb34,_0xa00e64)[_0x72fa('0xa')](function(_0x15a251){logger[_0x72fa('0xb')](_0x72fa('0xc'),_0x1e2f81,_0x72fa('0xd'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1e2f81,'request\x20sent',JSON['stringify'](_0x15a251));if(_0x15a251[_0x72fa('0xe')]){if(_0x15a251[_0x72fa('0xe')][_0x72fa('0xf')]===0x1f4){logger[_0x72fa('0xe')](_0x72fa('0xc'),_0x1e2f81,_0x15a251[_0x72fa('0xe')][_0x72fa('0x10')]);return _0x2b6367(_0x15a251['error'][_0x72fa('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1e2f81,_0x15a251[_0x72fa('0xe')][_0x72fa('0x10')]);return _0x464fa3(_0x15a251[_0x72fa('0xe')][_0x72fa('0x10')]);}else{logger[_0x72fa('0xb')](_0x72fa('0xc'),_0x1e2f81,'request\x20sent');_0x464fa3(_0x15a251[_0x72fa('0x11')]['message']);}})['catch'](function(_0x359d2f){logger[_0x72fa('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1e2f81,_0x359d2f);_0x2b6367(_0x359d2f);});});}exports[_0x72fa('0x12')]=function(_0x2e37b7){var _0x3fa6ba=this;return new Promise(function(_0x19f0c1,_0x3e0b24){return db[_0x72fa('0x13')][_0x72fa('0x14')](_0x2e37b7[_0x72fa('0x15')],{'raw':_0x2e37b7[_0x72fa('0x16')]?_0x2e37b7['options'][_0x72fa('0x17')]===undefined?!![]:![]:!![]})[_0x72fa('0xa')](function(_0x1de718){logger[_0x72fa('0xb')](_0x72fa('0x12'),_0x2e37b7);logger[_0x72fa('0x18')](_0x72fa('0x12'),_0x2e37b7,JSON[_0x72fa('0x19')](_0x1de718));_0x19f0c1(_0x1de718);})[_0x72fa('0x1a')](function(_0x4d7085){logger[_0x72fa('0xe')]('CreateSquareDetailsReport',_0x4d7085[_0x72fa('0x10')],_0x2e37b7);_0x3e0b24(_0x3fa6ba[_0x72fa('0xe')](0x1f4,_0x4d7085[_0x72fa('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 2dc4a59..fc57ba2 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 _0x560c=['isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x560c,0xdc));var _0xc560=function(_0x1fd7ad,_0x5f5442){_0x1fd7ad=_0x1fd7ad-0x0;var _0x561f75=_0x560c[_0x1fd7ad];return _0x561f75;};'use strict';var express=require(_0xc560('0x0'));var router=express[_0xc560('0x1')]();var auth=require(_0xc560('0x2'));var controller=require(_0xc560('0x3'));router[_0xc560('0x4')]('/',auth[_0xc560('0x5')](),controller[_0xc560('0x6')]);router[_0xc560('0x4')](_0xc560('0x7'),auth[_0xc560('0x5')](),controller['killProcess']);module[_0xc560('0x8')]=router; \ No newline at end of file +var _0xaeff=['exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0xfbd82,_0x2f6818){var _0x21a6dc=function(_0x37d850){while(--_0x37d850){_0xfbd82['push'](_0xfbd82['shift']());}};_0x21a6dc(++_0x2f6818);}(_0xaeff,0x71));var _0xfaef=function(_0x4cad2c,_0x1647e6){_0x4cad2c=_0x4cad2c-0x0;var _0x5109bd=_0xaeff[_0x4cad2c];return _0x5109bd;};'use strict';var express=require(_0xfaef('0x0'));var router=express['Router']();var auth=require(_0xfaef('0x1'));var controller=require(_0xfaef('0x2'));router[_0xfaef('0x3')]('/',auth[_0xfaef('0x4')](),controller[_0xfaef('0x5')]);router[_0xfaef('0x3')](_0xfaef('0x6'),auth[_0xfaef('0x4')](),controller['killProcess']);module[_0xfaef('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0882f92..e0effec 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 _0x6bf6=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','api','util','bluebird'];(function(_0x5508a4,_0x1f8596){var _0x3aac6f=function(_0xafa9c0){while(--_0xafa9c0){_0x5508a4['push'](_0x5508a4['shift']());}};_0x3aac6f(++_0x1f8596);}(_0x6bf6,0x11c));var _0x66bf=function(_0x43576f,_0x1356ed){_0x43576f=_0x43576f-0x0;var _0x4d2466=_0x6bf6[_0x43576f];return _0x4d2466;};'use strict';var info=require(_0x66bf('0x0'));var exec=require(_0x66bf('0x1'))[_0x66bf('0x2')];var logger=require('../../config/logger')(_0x66bf('0x3'));var util=require(_0x66bf('0x4'));var BPromise=require(_0x66bf('0x5'));var _=require(_0x66bf('0x6'));function handleError(_0x5143e2,_0x5877f8,_0x4dd1e0){_0x5877f8=_0x5877f8||0x1f4;return function(_0x1405d2){logger[_0x66bf('0x7')](_0x66bf('0x8'),_0x4dd1e0,_0x5877f8,util[_0x66bf('0x9')](_0x1405d2,{'showHidden':![],'depth':null}));delete _0x1405d2[_0x66bf('0xa')];_0x5143e2[_0x66bf('0xb')](_0x5877f8)[_0x66bf('0xc')](_0x1405d2);};}exports['index']=function(_0x1bc41c,_0x54d8c6){return info[_0x66bf('0xd')]()['then'](function(_0x47524c){return _0x54d8c6[_0x66bf('0xb')](0xc8)[_0x66bf('0xe')](_0x47524c);})[_0x66bf('0xf')](function(_0x5e12c8){return _0x54d8c6['status'](0x1f4)[_0x66bf('0xe')](_0x5e12c8);});};exports[_0x66bf('0x10')]=function(_0x4b3a11,_0x1604b1){var _0x4b5315=[_0x66bf('0x11')];return new BPromise(function(_0x569eee,_0x72f3f8){return exec(util[_0x66bf('0x12')](_0x66bf('0x13'),_0x4b3a11[_0x66bf('0x14')][_0x66bf('0x15')]),function(_0x3b36c0,_0x28af64,_0x358aa9){if(_0x3b36c0){return _0x72f3f8(_0x3b36c0);}return _0x569eee(_0x28af64);});})[_0x66bf('0x16')](function(_0x3e0472){var _0xf9c261=![];var _0x40fbeb=_0x3e0472[_0x66bf('0x17')](/\n/);for(var _0xb84a5f=0x0,_0x292551=_0x4b5315['length'];_0xb84a5f<_0x292551,_0xf9c261===![];_0xb84a5f+=0x1){if(_0x3e0472[_0x66bf('0x18')](_0x4b5315[_0xb84a5f])>=0x0){_0xf9c261=!![];}}if(!_0xf9c261){throw new Error(util[_0x66bf('0x12')](_0x66bf('0x19'),_0x4b3a11[_0x66bf('0x14')]['pid']));}process[_0x66bf('0x1a')](_0x4b3a11[_0x66bf('0x14')]['pid'],_0x66bf('0x1b'));return _0x1604b1[_0x66bf('0xb')](0xc8)[_0x66bf('0xe')]({'message':util['format'](_0x66bf('0x1c'),_0x4b3a11[_0x66bf('0x14')][_0x66bf('0x15')])});})[_0x66bf('0xf')](handleError(_0x1604b1,null,_0x66bf('0x10')));}; \ No newline at end of file +var _0x35b5=['pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','then','json','catch','killProcess','components/import/cm','format'];(function(_0x308dcc,_0x2d1178){var _0x361717=function(_0x618aae){while(--_0x618aae){_0x308dcc['push'](_0x308dcc['shift']());}};_0x361717(++_0x2d1178);}(_0x35b5,0xd4));var _0x535b=function(_0x21fdda,_0x330287){_0x21fdda=_0x21fdda-0x0;var _0x410ff3=_0x35b5[_0x21fdda];return _0x410ff3;};'use strict';var info=require(_0x535b('0x0'));var exec=require(_0x535b('0x1'))[_0x535b('0x2')];var logger=require(_0x535b('0x3'))(_0x535b('0x4'));var util=require(_0x535b('0x5'));var BPromise=require(_0x535b('0x6'));var _=require(_0x535b('0x7'));function handleError(_0x343abe,_0x4610f1,_0x23e85c){_0x4610f1=_0x4610f1||0x1f4;return function(_0x16208f){logger[_0x535b('0x8')](_0x535b('0x9'),_0x23e85c,_0x4610f1,util['inspect'](_0x16208f,{'showHidden':![],'depth':null}));delete _0x16208f[_0x535b('0xa')];_0x343abe[_0x535b('0xb')](_0x4610f1)[_0x535b('0xc')](_0x16208f);};}exports[_0x535b('0xd')]=function(_0xc7aabc,_0x10dbbe){return info['getAllData']()[_0x535b('0xe')](function(_0x5b8cbc){return _0x10dbbe['status'](0xc8)[_0x535b('0xf')](_0x5b8cbc);})[_0x535b('0x10')](function(_0x218d51){return _0x10dbbe[_0x535b('0xb')](0x1f4)[_0x535b('0xf')](_0x218d51);});};exports[_0x535b('0x11')]=function(_0x56a95f,_0x3134d2){var _0x56e1dd=[_0x535b('0x12')];return new BPromise(function(_0x521ea1,_0x32f895){return exec(util[_0x535b('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x56a95f['params'][_0x535b('0x14')]),function(_0xa500c9,_0x2839b0,_0x554f0c){if(_0xa500c9){return _0x32f895(_0xa500c9);}return _0x521ea1(_0x2839b0);});})['then'](function(_0x5c80d9){var _0x304a3b=![];var _0x3513ea=_0x5c80d9[_0x535b('0x15')](/\n/);for(var _0xafb10=0x0,_0x510e49=_0x56e1dd[_0x535b('0x16')];_0xafb10<_0x510e49,_0x304a3b===![];_0xafb10+=0x1){if(_0x5c80d9[_0x535b('0x17')](_0x56e1dd[_0xafb10])>=0x0){_0x304a3b=!![];}}if(!_0x304a3b){throw new Error(util[_0x535b('0x13')](_0x535b('0x18'),_0x56a95f[_0x535b('0x19')][_0x535b('0x14')]));}process[_0x535b('0x1a')](_0x56a95f['params'][_0x535b('0x14')],_0x535b('0x1b'));return _0x3134d2['status'](0xc8)['json']({'message':util[_0x535b('0x13')](_0x535b('0x1c'),_0x56a95f['params'][_0x535b('0x14')])});})[_0x535b('0x10')](handleError(_0x3134d2,null,_0x535b('0x11')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b694fec..b011033 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 _0x750a=['/:id','show','create','delete','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x52f384,_0x28c037){var _0x3358aa=function(_0x43078c){while(--_0x43078c){_0x52f384['push'](_0x52f384['shift']());}};_0x3358aa(++_0x28c037);}(_0x750a,0x140));var _0xa750=function(_0x14c0a6,_0x4a3641){_0x14c0a6=_0x14c0a6-0x0;var _0x30c5be=_0x750a[_0x14c0a6];return _0x30c5be;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var auth=require(_0xa750('0x3'));var interaction=require(_0xa750('0x4'));var config=require(_0xa750('0x5'));var controller=require(_0xa750('0x6'));router[_0xa750('0x7')]('/',auth[_0xa750('0x8')](),controller[_0xa750('0x9')]);router[_0xa750('0x7')](_0xa750('0xa'),auth[_0xa750('0x8')](),controller[_0xa750('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa750('0xc')]);router['put'](_0xa750('0xa'),auth[_0xa750('0x8')](),controller['update']);router[_0xa750('0xd')](_0xa750('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xa750('0xe')]=router; \ No newline at end of file +var _0x2dae=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x44bd77,_0xad5a3c){var _0x3bc9f3=function(_0x3bdec8){while(--_0x3bdec8){_0x44bd77['push'](_0x44bd77['shift']());}};_0x3bc9f3(++_0xad5a3c);}(_0x2dae,0xc3));var _0xe2da=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x2dae[_0xd4636c];return _0x5ee17d;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var auth=require(_0xe2da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x6'));var controller=require(_0xe2da('0x7'));router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0xb')]);router[_0xe2da('0xc')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xf')]);router[_0xe2da('0x10')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 5b47fb3..4bfc5e1 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 _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x371d29,_0x2f1314){var _0x48e1fd=function(_0x1ba54a){while(--_0x1ba54a){_0x371d29['push'](_0x371d29['shift']());}};_0x48e1fd(++_0x2f1314);}(_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')]={'name':{'type':Sequelize[_0x0baf('0x1')],'unique':_0x0baf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x3')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x087b=['sequelize','exports','STRING'];(function(_0x2e1b3a,_0x2acefc){var _0x5d7a3a=function(_0x3c8b5c){while(--_0x3c8b5c){_0x2e1b3a['push'](_0x2e1b3a['shift']());}};_0x5d7a3a(++_0x2acefc);}(_0x087b,0x11a));var _0xb087=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x087b[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb087('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xb087('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 29dc288..b7c9879 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 _0x7ac8=['query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','Tag','findAll','rows','catch','keys','filtears','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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','set','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x1e990c,_0xbfa640){var _0x530742=function(_0x30999b){while(--_0x30999b){_0x1e990c['push'](_0x1e990c['shift']());}};_0x530742(++_0xbfa640);}(_0x7ac8,0x74));var _0x87ac=function(_0x3ec0dd,_0x3a5e67){_0x3ec0dd=_0x3ec0dd-0x0;var _0x2818c7=_0x7ac8[_0x3ec0dd];return _0x2818c7;};'use strict';var pdf=require(_0x87ac('0x0'));var emlformat=require(_0x87ac('0x1'));var rimraf=require(_0x87ac('0x2'));var zipdir=require(_0x87ac('0x3'));var jsonpatch=require(_0x87ac('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x87ac('0x5'));var Mustache=require(_0x87ac('0x6'));var util=require('util');var path=require(_0x87ac('0x7'));var sox=require('sox');var csv=require(_0x87ac('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x87ac('0x9'));var squel=require(_0x87ac('0xa'));var crypto=require('crypto');var jsforce=require(_0x87ac('0xb'));var deskjs=require(_0x87ac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x87ac('0xd'));var Papa=require(_0x87ac('0xe'));var Redis=require(_0x87ac('0xf'));var authService=require(_0x87ac('0x10'));var qs=require(_0x87ac('0x11'));var as=require(_0x87ac('0x12'));var hardwareService=require(_0x87ac('0x13'));var logger=require(_0x87ac('0x14'))(_0x87ac('0x15'));var utils=require(_0x87ac('0x16'));var config=require(_0x87ac('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x87ac('0x18'))['db'];function respondWithStatusCode(_0xa317a2,_0x2ceb9f){_0x2ceb9f=_0x2ceb9f||0xcc;return function(_0x17b7a1){if(_0x17b7a1){return _0xa317a2[_0x87ac('0x19')](_0x2ceb9f);}return _0xa317a2[_0x87ac('0x1a')](_0x2ceb9f)[_0x87ac('0x1b')]();};}function respondWithResult(_0x4d1ea9,_0x1cd54b){_0x1cd54b=_0x1cd54b||0xc8;return function(_0x5c6851){if(_0x5c6851){return _0x4d1ea9[_0x87ac('0x1a')](_0x1cd54b)[_0x87ac('0x1c')](_0x5c6851);}};}function respondWithFilteredResult(_0x205aa3,_0x36b9d1){return function(_0x56029d){if(_0x56029d){var _0x3f2436=_0x56029d['count'],_0x21075b=_0x36b9d1[_0x87ac('0x1d')],_0x366b07=_0x36b9d1[_0x87ac('0x1d')]+_0x36b9d1['limit'],_0x4160b6;if(_0x366b07>=_0x3f2436){_0x366b07=_0x3f2436;_0x4160b6=0xc8;}else{_0x4160b6=0xce;}_0x205aa3[_0x87ac('0x1a')](_0x4160b6);return _0x205aa3[_0x87ac('0x1e')]('Content-Range',_0x21075b+'-'+_0x366b07+'/'+_0x3f2436)['json'](_0x56029d);}return null;};}function patchUpdates(_0x1e212c){return function(_0x3e92e8){try{jsonpatch[_0x87ac('0x1f')](_0x3e92e8,_0x1e212c,!![]);}catch(_0x72a934){return BPromise[_0x87ac('0x20')](_0x72a934);}return _0x3e92e8[_0x87ac('0x21')]();};}function saveUpdates(_0x21dc94,_0x446b45){return function(_0x20652e){if(_0x20652e){return _0x20652e['update'](_0x21dc94)[_0x87ac('0x22')](function(_0x37e105){return _0x37e105;});}return null;};}function removeEntity(_0x1d88ee,_0x4be832){return function(_0x200ddd){if(_0x200ddd){return _0x200ddd[_0x87ac('0x23')]()[_0x87ac('0x22')](function(){var _0xe98c7d=_0x200ddd[_0x87ac('0x24')]({'plain':!![]});var _0x54ebed='Tags';return db[_0x87ac('0x25')]['destroy']({'where':{'type':_0x54ebed,'resourceId':_0xe98c7d['id']}})['then'](function(){return _0x200ddd;});})[_0x87ac('0x22')](function(){_0x1d88ee[_0x87ac('0x1a')](0xcc)[_0x87ac('0x1b')]();});}};}function handleEntityNotFound(_0x4d6cca,_0x44daa6){return function(_0x2db326){if(!_0x2db326){_0x4d6cca[_0x87ac('0x19')](0x194);}return _0x2db326;};}function handleError(_0x9a1aa8,_0x55ea8c){_0x55ea8c=_0x55ea8c||0x1f4;return function(_0xc0d8ce){logger[_0x87ac('0x26')](_0xc0d8ce[_0x87ac('0x27')]);if(_0xc0d8ce[_0x87ac('0x28')]){delete _0xc0d8ce[_0x87ac('0x28')];}_0x9a1aa8[_0x87ac('0x1a')](_0x55ea8c)['send'](_0xc0d8ce);};}exports[_0x87ac('0x29')]=function(_0x36472e,_0x225c6e){var _0x3a058f={},_0x393087={},_0x34ce66={'count':0x0,'rows':[]};var _0xb372c7=_[_0x87ac('0x2a')](db['Tag'][_0x87ac('0x2b')],function(_0xce3e36){return{'name':_0xce3e36[_0x87ac('0x2c')],'type':_0xce3e36[_0x87ac('0x2d')][_0x87ac('0x2e')]};});_0x393087[_0x87ac('0x2f')]=_[_0x87ac('0x2a')](_0xb372c7,_0x87ac('0x28'));_0x393087[_0x87ac('0x30')]=_['keys'](_0x36472e[_0x87ac('0x30')]);_0x393087[_0x87ac('0x31')]=_[_0x87ac('0x32')](_0x393087[_0x87ac('0x2f')],_0x393087[_0x87ac('0x30')]);_0x3a058f[_0x87ac('0x33')]=_[_0x87ac('0x32')](_0x393087[_0x87ac('0x2f')],qs[_0x87ac('0x34')](_0x36472e['query']['fields']));_0x3a058f['attributes']=_0x3a058f[_0x87ac('0x33')][_0x87ac('0x35')]?_0x3a058f[_0x87ac('0x33')]:_0x393087[_0x87ac('0x2f')];if(!_0x36472e['query'][_0x87ac('0x36')]('nolimit')){_0x3a058f[_0x87ac('0x37')]=qs['limit'](_0x36472e[_0x87ac('0x30')]['limit']);_0x3a058f[_0x87ac('0x1d')]=qs[_0x87ac('0x1d')](_0x36472e['query'][_0x87ac('0x1d')]);}_0x3a058f[_0x87ac('0x38')]=qs[_0x87ac('0x39')](_0x36472e[_0x87ac('0x30')][_0x87ac('0x39')]);_0x3a058f[_0x87ac('0x3a')]=qs[_0x87ac('0x31')](_[_0x87ac('0x3b')](_0x36472e[_0x87ac('0x30')],_0x393087['filters']),_0xb372c7);if(_0x36472e[_0x87ac('0x30')][_0x87ac('0x3c')]){_0x3a058f[_0x87ac('0x3a')]=_[_0x87ac('0x3d')](_0x3a058f[_0x87ac('0x3a')],{'$or':_[_0x87ac('0x2a')](_0xb372c7,function(_0x35ca7d){if(_0x35ca7d['type']!==_0x87ac('0x3e')){var _0x886eba={};_0x886eba[_0x35ca7d[_0x87ac('0x28')]]={'$like':'%'+_0x36472e['query']['filter']+'%'};return _0x886eba;}})});}_0x3a058f=_[_0x87ac('0x3d')]({},_0x3a058f,_0x36472e['options']);var _0x4abb5d={'where':_0x3a058f[_0x87ac('0x3a')]};return db['Tag']['count'](_0x4abb5d)['then'](function(_0x1cafba){_0x34ce66['count']=_0x1cafba;if(_0x36472e[_0x87ac('0x30')]['includeAll']){_0x3a058f['include']=[{'all':!![]}];}return db[_0x87ac('0x3f')][_0x87ac('0x40')](_0x3a058f);})[_0x87ac('0x22')](function(_0x381655){_0x34ce66[_0x87ac('0x41')]=_0x381655;return _0x34ce66;})[_0x87ac('0x22')](respondWithFilteredResult(_0x225c6e,_0x3a058f))[_0x87ac('0x42')](handleError(_0x225c6e,null));};exports['show']=function(_0x2712a0,_0x45e19a){var _0x5db615={'raw':!![],'where':{'id':_0x2712a0['params']['id']}},_0x373f36={};_0x373f36['model']=_[_0x87ac('0x43')](db[_0x87ac('0x3f')][_0x87ac('0x2b')]);_0x373f36[_0x87ac('0x30')]=_[_0x87ac('0x43')](_0x2712a0[_0x87ac('0x30')]);_0x373f36[_0x87ac('0x44')]=_['intersection'](_0x373f36[_0x87ac('0x2f')],_0x373f36[_0x87ac('0x30')]);_0x5db615['attributes']=_[_0x87ac('0x32')](_0x373f36[_0x87ac('0x2f')],qs[_0x87ac('0x34')](_0x2712a0[_0x87ac('0x30')][_0x87ac('0x34')]));_0x5db615[_0x87ac('0x33')]=_0x5db615['attributes'][_0x87ac('0x35')]?_0x5db615[_0x87ac('0x33')]:_0x373f36['model'];if(_0x2712a0[_0x87ac('0x30')]['includeAll']){_0x5db615[_0x87ac('0x45')]=[{'all':!![]}];}_0x5db615=_[_0x87ac('0x3d')]({},_0x5db615,_0x2712a0[_0x87ac('0x46')]);return db[_0x87ac('0x3f')][_0x87ac('0x47')](_0x5db615)[_0x87ac('0x22')](handleEntityNotFound(_0x45e19a,null))[_0x87ac('0x22')](respondWithResult(_0x45e19a,null))[_0x87ac('0x42')](handleError(_0x45e19a,null));};exports[_0x87ac('0x48')]=function(_0x33e75f,_0x3d28a8){return db[_0x87ac('0x3f')][_0x87ac('0x48')](_0x33e75f[_0x87ac('0x49')],{})['then'](function(_0x1fb29c){var _0x30cff8=_0x33e75f[_0x87ac('0x4a')][_0x87ac('0x24')]({'plain':!![]});if(!_0x30cff8)throw new Error(_0x87ac('0x4b'));if(_0x30cff8['role']===_0x87ac('0x4a')){var _0x54237c=_0x1fb29c[_0x87ac('0x24')]({'plain':!![]});var _0x9efdfe=_0x87ac('0x4c');return db[_0x87ac('0x4d')]['find']({'where':{'name':_0x9efdfe,'userProfileId':_0x30cff8['userProfileId']},'raw':!![]})[_0x87ac('0x22')](function(_0x5295c4){if(_0x5295c4&&_0x5295c4[_0x87ac('0x4e')]===0x0){return db[_0x87ac('0x25')][_0x87ac('0x48')]({'name':_0x54237c['name'],'resourceId':_0x54237c['id'],'type':_0x5295c4[_0x87ac('0x28')],'sectionId':_0x5295c4['id']},{})[_0x87ac('0x22')](function(){return _0x1fb29c;});}else{return _0x1fb29c;}})[_0x87ac('0x42')](function(_0x3a7ce9){logger[_0x87ac('0x26')](_0x87ac('0x4f'),_0x3a7ce9);throw _0x3a7ce9;});}return _0x1fb29c;})[_0x87ac('0x22')](respondWithResult(_0x3d28a8,0xc9))[_0x87ac('0x42')](handleError(_0x3d28a8,null));};exports[_0x87ac('0x50')]=function(_0x1c4783,_0x13ec6){if(_0x1c4783[_0x87ac('0x49')]['id']){delete _0x1c4783[_0x87ac('0x49')]['id'];}return db[_0x87ac('0x3f')][_0x87ac('0x47')]({'where':{'id':_0x1c4783[_0x87ac('0x51')]['id']}})[_0x87ac('0x22')](handleEntityNotFound(_0x13ec6,null))['then'](saveUpdates(_0x1c4783[_0x87ac('0x49')],null))['then'](respondWithResult(_0x13ec6,null))['catch'](handleError(_0x13ec6,null));};exports[_0x87ac('0x23')]=function(_0xe5db26,_0x58659b){return db[_0x87ac('0x3f')][_0x87ac('0x47')]({'where':{'id':_0xe5db26[_0x87ac('0x51')]['id']}})[_0x87ac('0x22')](handleEntityNotFound(_0x58659b,null))['then'](removeEntity(_0x58659b,null))[_0x87ac('0x42')](handleError(_0x58659b,null));}; \ No newline at end of file +var _0x2a91=['name','index','map','Tag','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','destroy','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','get','Tags','error','stack'];(function(_0x1dddd6,_0x4c3f73){var _0x6bed0=function(_0x1a5b79){while(--_0x1a5b79){_0x1dddd6['push'](_0x1dddd6['shift']());}};_0x6bed0(++_0x4c3f73);}(_0x2a91,0x160));var _0x12a9=function(_0xb54d71,_0x40568b){_0xb54d71=_0xb54d71-0x0;var _0x4fb713=_0x2a91[_0xb54d71];return _0x4fb713;};'use strict';var pdf=require(_0x12a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x12a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x12a9('0x2'));var moment=require(_0x12a9('0x3'));var BPromise=require(_0x12a9('0x4'));var Mustache=require(_0x12a9('0x5'));var util=require(_0x12a9('0x6'));var path=require(_0x12a9('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12a9('0x8'));var fs=require('fs');var _=require(_0x12a9('0x9'));var squel=require(_0x12a9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x12a9('0xb'));var toCsv=require(_0x12a9('0xc'));var querystring=require(_0x12a9('0xd'));var Papa=require(_0x12a9('0xe'));var Redis=require(_0x12a9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x12a9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12a9('0x11'));var logger=require(_0x12a9('0x12'))(_0x12a9('0x13'));var utils=require(_0x12a9('0x14'));var config=require(_0x12a9('0x15'));var licenseUtil=require(_0x12a9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43af29,_0x195713){_0x195713=_0x195713||0xcc;return function(_0x1c5b2a){if(_0x1c5b2a){return _0x43af29[_0x12a9('0x17')](_0x195713);}return _0x43af29[_0x12a9('0x18')](_0x195713)[_0x12a9('0x19')]();};}function respondWithResult(_0x1de610,_0x53bd19){_0x53bd19=_0x53bd19||0xc8;return function(_0x245606){if(_0x245606){return _0x1de610[_0x12a9('0x18')](_0x53bd19)[_0x12a9('0x1a')](_0x245606);}};}function respondWithFilteredResult(_0x384005,_0x2ea787){return function(_0x32a148){if(_0x32a148){var _0x51360b=_0x32a148[_0x12a9('0x1b')],_0x54951d=_0x2ea787[_0x12a9('0x1c')],_0x1fd7a6=_0x2ea787['offset']+_0x2ea787[_0x12a9('0x1d')],_0x5d11aa;if(_0x1fd7a6>=_0x51360b){_0x1fd7a6=_0x51360b;_0x5d11aa=0xc8;}else{_0x5d11aa=0xce;}_0x384005[_0x12a9('0x18')](_0x5d11aa);return _0x384005[_0x12a9('0x1e')](_0x12a9('0x1f'),_0x54951d+'-'+_0x1fd7a6+'/'+_0x51360b)['json'](_0x32a148);}return null;};}function patchUpdates(_0x16fa3e){return function(_0x38f1b2){try{jsonpatch['apply'](_0x38f1b2,_0x16fa3e,!![]);}catch(_0x617a55){return BPromise[_0x12a9('0x20')](_0x617a55);}return _0x38f1b2['save']();};}function saveUpdates(_0x205b94,_0x2b35be){return function(_0x48b9ac){if(_0x48b9ac){return _0x48b9ac[_0x12a9('0x21')](_0x205b94)['then'](function(_0x73dd1a){return _0x73dd1a;});}return null;};}function removeEntity(_0x446b34,_0x546ecc){return function(_0x1604e5){if(_0x1604e5){return _0x1604e5['destroy']()['then'](function(){var _0x1da957=_0x1604e5[_0x12a9('0x22')]({'plain':!![]});var _0x5a136c=_0x12a9('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a136c,'resourceId':_0x1da957['id']}})['then'](function(){return _0x1604e5;});})['then'](function(){_0x446b34[_0x12a9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1bb,_0x5a0b5f){return function(_0x2337ba){if(!_0x2337ba){_0x5de1bb[_0x12a9('0x17')](0x194);}return _0x2337ba;};}function handleError(_0x117d2d,_0x15905c){_0x15905c=_0x15905c||0x1f4;return function(_0x56ad23){logger[_0x12a9('0x24')](_0x56ad23[_0x12a9('0x25')]);if(_0x56ad23[_0x12a9('0x26')]){delete _0x56ad23[_0x12a9('0x26')];}_0x117d2d[_0x12a9('0x18')](_0x15905c)['send'](_0x56ad23);};}exports[_0x12a9('0x27')]=function(_0x151e4,_0x5edf6e){var _0x4e6ff7={},_0x4a67cc={},_0x11aaa2={'count':0x0,'rows':[]};var _0x507d68=_[_0x12a9('0x28')](db[_0x12a9('0x29')]['rawAttributes'],function(_0xdbc5a0){return{'name':_0xdbc5a0['fieldName'],'type':_0xdbc5a0['type']['key']};});_0x4a67cc['model']=_['map'](_0x507d68,_0x12a9('0x26'));_0x4a67cc[_0x12a9('0x2a')]=_[_0x12a9('0x2b')](_0x151e4[_0x12a9('0x2a')]);_0x4a67cc['filters']=_['intersection'](_0x4a67cc[_0x12a9('0x2c')],_0x4a67cc[_0x12a9('0x2a')]);_0x4e6ff7[_0x12a9('0x2d')]=_[_0x12a9('0x2e')](_0x4a67cc['model'],qs[_0x12a9('0x2f')](_0x151e4[_0x12a9('0x2a')]['fields']));_0x4e6ff7[_0x12a9('0x2d')]=_0x4e6ff7[_0x12a9('0x2d')][_0x12a9('0x30')]?_0x4e6ff7['attributes']:_0x4a67cc[_0x12a9('0x2c')];if(!_0x151e4[_0x12a9('0x2a')]['hasOwnProperty'](_0x12a9('0x31'))){_0x4e6ff7['limit']=qs[_0x12a9('0x1d')](_0x151e4['query'][_0x12a9('0x1d')]);_0x4e6ff7['offset']=qs[_0x12a9('0x1c')](_0x151e4[_0x12a9('0x2a')][_0x12a9('0x1c')]);}_0x4e6ff7[_0x12a9('0x32')]=qs[_0x12a9('0x33')](_0x151e4[_0x12a9('0x2a')][_0x12a9('0x33')]);_0x4e6ff7['where']=qs[_0x12a9('0x34')](_[_0x12a9('0x35')](_0x151e4[_0x12a9('0x2a')],_0x4a67cc[_0x12a9('0x34')]),_0x507d68);if(_0x151e4[_0x12a9('0x2a')][_0x12a9('0x36')]){_0x4e6ff7[_0x12a9('0x37')]=_[_0x12a9('0x38')](_0x4e6ff7[_0x12a9('0x37')],{'$or':_[_0x12a9('0x28')](_0x507d68,function(_0x410812){if(_0x410812[_0x12a9('0x39')]!==_0x12a9('0x3a')){var _0x3b6aac={};_0x3b6aac[_0x410812[_0x12a9('0x26')]]={'$like':'%'+_0x151e4[_0x12a9('0x2a')][_0x12a9('0x36')]+'%'};return _0x3b6aac;}})});}_0x4e6ff7=_[_0x12a9('0x38')]({},_0x4e6ff7,_0x151e4['options']);var _0x39c279={'where':_0x4e6ff7[_0x12a9('0x37')]};return db[_0x12a9('0x29')][_0x12a9('0x1b')](_0x39c279)[_0x12a9('0x3b')](function(_0x1dab64){_0x11aaa2[_0x12a9('0x1b')]=_0x1dab64;if(_0x151e4[_0x12a9('0x2a')][_0x12a9('0x3c')]){_0x4e6ff7[_0x12a9('0x3d')]=[{'all':!![]}];}return db[_0x12a9('0x29')][_0x12a9('0x3e')](_0x4e6ff7);})[_0x12a9('0x3b')](function(_0x388bc3){_0x11aaa2[_0x12a9('0x3f')]=_0x388bc3;return _0x11aaa2;})[_0x12a9('0x3b')](respondWithFilteredResult(_0x5edf6e,_0x4e6ff7))['catch'](handleError(_0x5edf6e,null));};exports['show']=function(_0x53a3a2,_0x1b478b){var _0x597ce2={'raw':!![],'where':{'id':_0x53a3a2['params']['id']}},_0x1eefc9={};_0x1eefc9['model']=_['keys'](db[_0x12a9('0x29')]['rawAttributes']);_0x1eefc9[_0x12a9('0x2a')]=_[_0x12a9('0x2b')](_0x53a3a2[_0x12a9('0x2a')]);_0x1eefc9['filtears']=_[_0x12a9('0x2e')](_0x1eefc9[_0x12a9('0x2c')],_0x1eefc9[_0x12a9('0x2a')]);_0x597ce2[_0x12a9('0x2d')]=_[_0x12a9('0x2e')](_0x1eefc9['model'],qs[_0x12a9('0x2f')](_0x53a3a2['query']['fields']));_0x597ce2[_0x12a9('0x2d')]=_0x597ce2[_0x12a9('0x2d')][_0x12a9('0x30')]?_0x597ce2[_0x12a9('0x2d')]:_0x1eefc9[_0x12a9('0x2c')];if(_0x53a3a2[_0x12a9('0x2a')][_0x12a9('0x3c')]){_0x597ce2[_0x12a9('0x3d')]=[{'all':!![]}];}_0x597ce2=_[_0x12a9('0x38')]({},_0x597ce2,_0x53a3a2[_0x12a9('0x40')]);return db[_0x12a9('0x29')]['find'](_0x597ce2)['then'](handleEntityNotFound(_0x1b478b,null))[_0x12a9('0x3b')](respondWithResult(_0x1b478b,null))[_0x12a9('0x41')](handleError(_0x1b478b,null));};exports[_0x12a9('0x42')]=function(_0x9385a,_0x38aa0b){return db[_0x12a9('0x29')][_0x12a9('0x42')](_0x9385a[_0x12a9('0x43')],{})[_0x12a9('0x3b')](function(_0x57c74e){var _0x139ba2=_0x9385a[_0x12a9('0x44')][_0x12a9('0x22')]({'plain':!![]});if(!_0x139ba2)throw new Error(_0x12a9('0x45'));if(_0x139ba2[_0x12a9('0x46')]===_0x12a9('0x44')){var _0x1401eb=_0x57c74e[_0x12a9('0x22')]({'plain':!![]});var _0x31e8d1=_0x12a9('0x23');return db[_0x12a9('0x47')]['find']({'where':{'name':_0x31e8d1,'userProfileId':_0x139ba2['userProfileId']},'raw':!![]})[_0x12a9('0x3b')](function(_0x5a7839){if(_0x5a7839&&_0x5a7839[_0x12a9('0x48')]===0x0){return db[_0x12a9('0x49')]['create']({'name':_0x1401eb['name'],'resourceId':_0x1401eb['id'],'type':_0x5a7839[_0x12a9('0x26')],'sectionId':_0x5a7839['id']},{})['then'](function(){return _0x57c74e;});}else{return _0x57c74e;}})[_0x12a9('0x41')](function(_0x21a9bf){logger[_0x12a9('0x24')](_0x12a9('0x4a'),_0x21a9bf);throw _0x21a9bf;});}return _0x57c74e;})[_0x12a9('0x3b')](respondWithResult(_0x38aa0b,0xc9))['catch'](handleError(_0x38aa0b,null));};exports[_0x12a9('0x21')]=function(_0x11d3fe,_0x1ae56f){if(_0x11d3fe[_0x12a9('0x43')]['id']){delete _0x11d3fe[_0x12a9('0x43')]['id'];}return db[_0x12a9('0x29')][_0x12a9('0x4b')]({'where':{'id':_0x11d3fe[_0x12a9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ae56f,null))['then'](saveUpdates(_0x11d3fe[_0x12a9('0x43')],null))[_0x12a9('0x3b')](respondWithResult(_0x1ae56f,null))[_0x12a9('0x41')](handleError(_0x1ae56f,null));};exports[_0x12a9('0x4d')]=function(_0x4f4f09,_0x466355){return db[_0x12a9('0x29')][_0x12a9('0x4b')]({'where':{'id':_0x4f4f09[_0x12a9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x466355,null))[_0x12a9('0x3b')](removeEntity(_0x466355,null))[_0x12a9('0x41')](handleError(_0x466355,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 02ca8d7..11df577 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 _0xeff5=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','path','./tag.attributes','exports','define'];(function(_0x4f7dd0,_0x4eec9d){var _0x52a87d=function(_0x419543){while(--_0x419543){_0x4f7dd0['push'](_0x4f7dd0['shift']());}};_0x52a87d(++_0x4eec9d);}(_0xeff5,0x182));var _0x5eff=function(_0x24bf30,_0x1fafea){_0x24bf30=_0x24bf30-0x0;var _0x159d47=_0xeff5[_0x24bf30];return _0x159d47;};'use strict';var _=require(_0x5eff('0x0'));var util=require(_0x5eff('0x1'));var logger=require(_0x5eff('0x2'))(_0x5eff('0x3'));var moment=require(_0x5eff('0x4'));var BPromise=require(_0x5eff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5eff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5eff('0x7'));module[_0x5eff('0x8')]=function(_0xad75ca,_0x5c523d){return _0xad75ca[_0x5eff('0x9')]('Tag',attributes,{'tableName':_0x5eff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea1=['bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','util','api','moment'];(function(_0x3930ea,_0x471866){var _0x55ca07=function(_0x2894d2){while(--_0x2894d2){_0x3930ea['push'](_0x3930ea['shift']());}};_0x55ca07(++_0x471866);}(_0xcea1,0x17d));var _0x1cea=function(_0x5ade35,_0x35cec6){_0x5ade35=_0x5ade35-0x0;var _0x21d317=_0xcea1[_0x5ade35];return _0x21d317;};'use strict';var _=require('lodash');var util=require(_0x1cea('0x0'));var logger=require('../../config/logger')(_0x1cea('0x1'));var moment=require(_0x1cea('0x2'));var BPromise=require(_0x1cea('0x3'));var rp=require(_0x1cea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cea('0x5'));var config=require(_0x1cea('0x6'));var attributes=require(_0x1cea('0x7'));module[_0x1cea('0x8')]=function(_0x48e71e,_0x19273d){return _0x48e71e[_0x1cea('0x9')](_0x1cea('0xa'),attributes,{'tableName':_0x1cea('0xb'),'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 5144e05..44d3d43 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 _0x4e81=['Tag,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x530cda,_0x5a4376){var _0x2f6849=function(_0xe19ca9){while(--_0xe19ca9){_0x530cda['push'](_0x530cda['shift']());}};_0x2f6849(++_0x5a4376);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x4e81[_0x1bc013];return _0x55df36;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('Tag,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});} \ No newline at end of file +var _0x3667=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x515e9b,_0x37f672){var _0x4d38b1=function(_0x11e730){while(--_0x11e730){_0x515e9b['push'](_0x515e9b['shift']());}};_0x4d38b1(++_0x37f672);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var moment=require(_0x7366('0x2'));var BPromise=require(_0x7366('0x3'));var rs=require(_0x7366('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7366('0x5'))['db'];var utils=require(_0x7366('0x6'));var logger=require('../../config/logger')(_0x7366('0x7'));var config=require(_0x7366('0x8'));var jayson=require(_0x7366('0x9'));var client=jayson[_0x7366('0xa')][_0x7366('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x589397,_0x28f6c8,_0xa1a3c5){return new BPromise(function(_0x2dd32b,_0x26e9a9){return client[_0x7366('0xc')](_0x589397,_0xa1a3c5)[_0x7366('0xd')](function(_0x1995c7){logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));logger[_0x7366('0x11')](_0x7366('0x12'),_0x28f6c8,_0x7366('0x10'),JSON[_0x7366('0x13')](_0x1995c7));if(_0x1995c7[_0x7366('0x14')]){if(_0x1995c7[_0x7366('0x14')][_0x7366('0x15')]===0x1f4){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x26e9a9(_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);}logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x1995c7[_0x7366('0x14')][_0x7366('0x16')]);return _0x2dd32b(_0x1995c7[_0x7366('0x14')]['message']);}else{logger[_0x7366('0xe')](_0x7366('0xf'),_0x28f6c8,_0x7366('0x10'));_0x2dd32b(_0x1995c7[_0x7366('0x17')][_0x7366('0x16')]);}})[_0x7366('0x18')](function(_0x2bc2af){logger[_0x7366('0x14')](_0x7366('0xf'),_0x28f6c8,_0x2bc2af);_0x26e9a9(_0x2bc2af);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 22870c4..31cfe91 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 _0x7266=['isAuthenticated','delete','destroy','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','show','/:id/queues','getQueues','/:id/users','post','addQueues'];(function(_0x1e4caf,_0x3f7947){var _0x5408a4=function(_0x3dd436){while(--_0x3dd436){_0x1e4caf['push'](_0x1e4caf['shift']());}};_0x5408a4(++_0x3f7947);}(_0x7266,0x1e9));var _0x6726=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x7266[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x6726('0x0'));var util=require(_0x6726('0x1'));var path=require('path');var timeout=require(_0x6726('0x2'));var express=require(_0x6726('0x3'));var router=express[_0x6726('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6726('0x5'));var config=require(_0x6726('0x6'));var controller=require(_0x6726('0x7'));router[_0x6726('0x8')]('/',auth['isAuthenticated'](),controller[_0x6726('0x9')]);router[_0x6726('0x8')](_0x6726('0xa'),auth['isAuthenticated'](),controller[_0x6726('0xb')]);router[_0x6726('0x8')](_0x6726('0xc'),auth['isAuthenticated'](),controller[_0x6726('0xd')]);router['get'](_0x6726('0xe'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6726('0xf')](_0x6726('0xc'),auth['isAuthenticated'](),controller[_0x6726('0x10')]);router[_0x6726('0xf')](_0x6726('0xe'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x6726('0xa'),auth[_0x6726('0x11')](),controller['update']);router[_0x6726('0x12')](_0x6726('0xa'),auth['isAuthenticated'](),controller[_0x6726('0x13')]);router[_0x6726('0x12')](_0x6726('0xc'),auth['isAuthenticated'](),controller[_0x6726('0x14')]);router[_0x6726('0x12')](_0x6726('0xe'),auth['isAuthenticated'](),controller[_0x6726('0x15')]);module[_0x6726('0x16')]=router; \ No newline at end of file +var _0x7f88=['get','isAuthenticated','index','show','/:id/queues','getQueues','getAgents','post','addQueues','/:id/users','addAgents','put','update','delete','removeQueues','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./team.controller'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7f88,0x94));var _0x87f8=function(_0x383995,_0x237136){_0x383995=_0x383995-0x0;var _0x27811d=_0x7f88[_0x383995];return _0x27811d;};'use strict';var multer=require(_0x87f8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x87f8('0x1'));var express=require('express');var router=express[_0x87f8('0x2')]();var auth=require(_0x87f8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x87f8('0x4'));var controller=require(_0x87f8('0x5'));router[_0x87f8('0x6')]('/',auth[_0x87f8('0x7')](),controller[_0x87f8('0x8')]);router[_0x87f8('0x6')]('/:id',auth[_0x87f8('0x7')](),controller[_0x87f8('0x9')]);router[_0x87f8('0x6')](_0x87f8('0xa'),auth[_0x87f8('0x7')](),controller[_0x87f8('0xb')]);router[_0x87f8('0x6')]('/:id/users',auth[_0x87f8('0x7')](),controller[_0x87f8('0xc')]);router[_0x87f8('0xd')]('/',auth[_0x87f8('0x7')](),controller['create']);router['post'](_0x87f8('0xa'),auth[_0x87f8('0x7')](),controller[_0x87f8('0xe')]);router[_0x87f8('0xd')](_0x87f8('0xf'),auth[_0x87f8('0x7')](),controller[_0x87f8('0x10')]);router[_0x87f8('0x11')]('/:id',auth[_0x87f8('0x7')](),controller[_0x87f8('0x12')]);router[_0x87f8('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x87f8('0xa'),auth[_0x87f8('0x7')](),controller[_0x87f8('0x14')]);router[_0x87f8('0x13')]('/:id/users',auth[_0x87f8('0x7')](),controller['removeAgents']);module[_0x87f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e7e5e0f..5ab9eb1 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 _0x0c6c=['sequelize','exports','STRING','name'];(function(_0x21d0d7,_0x4c55a3){var _0x5e725b=function(_0x35acf8){while(--_0x35acf8){_0x21d0d7['push'](_0x21d0d7['shift']());}};_0x5e725b(++_0x4c55a3);}(_0x0c6c,0x168));var _0xc0c6=function(_0x25f686,_0x199629){_0x25f686=_0x25f686-0x0;var _0x54ad10=_0x0c6c[_0x25f686];return _0x54ad10;};'use strict';var Sequelize=require(_0xc0c6('0x0'));module[_0xc0c6('0x1')]={'name':{'type':Sequelize[_0xc0c6('0x2')],'allowNull':![],'unique':_0xc0c6('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa62c=['exports','STRING','name','sequelize'];(function(_0x24c0a3,_0x443029){var _0xd4cfbb=function(_0x5de2e8){while(--_0x5de2e8){_0x24c0a3['push'](_0x24c0a3['shift']());}};_0xd4cfbb(++_0x443029);}(_0xa62c,0x18f));var _0xca62=function(_0x5f3de3,_0x40f0f5){_0x5f3de3=_0x5f3de3-0x0;var _0x287e0d=_0xa62c[_0x5f3de3];return _0x287e0d;};'use strict';var Sequelize=require(_0xca62('0x0'));module[_0xca62('0x1')]={'name':{'type':Sequelize[_0xca62('0x2')],'allowNull':![],'unique':_0xca62('0x3')},'description':{'type':Sequelize[_0xca62('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 5bd9df4..a5ee396 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 _0x79bc=['save','then','destroy','get','Teams','UserProfileResource','error','name','send','Team','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','length','attributes','hasOwnProperty','limit','query','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','filtears','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','Sequelize','ValidationError','Unknown\x20channel','capitalize','channel','Queue','options','toLowerCase','isValidChannel','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Openchannel','each','User','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','omit','spread','emit','removeAgents','voice','chat','mail','sms','fax','openchannel','whatsapp','isArray','userTeam:remove','getAgents','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','set','Content-Range','apply','reject'];(function(_0x303b06,_0x570a99){var _0x3a1ca0=function(_0x10354d){while(--_0x10354d){_0x303b06['push'](_0x303b06['shift']());}};_0x3a1ca0(++_0x570a99);}(_0x79bc,0x1e7));var _0xc79b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x79bc[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xc79b('0x0'));var emlformat=require(_0xc79b('0x1'));var rimraf=require(_0xc79b('0x2'));var zipdir=require(_0xc79b('0x3'));var jsonpatch=require(_0xc79b('0x4'));var rp=require(_0xc79b('0x5'));var moment=require(_0xc79b('0x6'));var BPromise=require(_0xc79b('0x7'));var Mustache=require(_0xc79b('0x8'));var util=require(_0xc79b('0x9'));var path=require(_0xc79b('0xa'));var sox=require(_0xc79b('0xb'));var csv=require('to-csv');var ejs=require(_0xc79b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc79b('0xd'));var crypto=require(_0xc79b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc79b('0xf'));var toCsv=require(_0xc79b('0x10'));var querystring=require(_0xc79b('0x11'));var Papa=require(_0xc79b('0x12'));var Redis=require('ioredis');var authService=require(_0xc79b('0x13'));var qs=require(_0xc79b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc79b('0x15'));var logger=require(_0xc79b('0x16'))(_0xc79b('0x17'));var utils=require('../../config/utils');var config=require(_0xc79b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc79b('0x19'))['db'];config[_0xc79b('0x1a')]=_[_0xc79b('0x1b')](config[_0xc79b('0x1a')],{'host':_0xc79b('0x1c'),'port':0x18eb});var socket=require(_0xc79b('0x1d'))(new Redis(config['redis']));require(_0xc79b('0x1e'))[_0xc79b('0x1f')](socket);function respondWithStatusCode(_0x175eb4,_0x2f5366){_0x2f5366=_0x2f5366||0xcc;return function(_0x3ea054){if(_0x3ea054){return _0x175eb4['sendStatus'](_0x2f5366);}return _0x175eb4[_0xc79b('0x20')](_0x2f5366)[_0xc79b('0x21')]();};}function respondWithResult(_0x50959e,_0x7ea4be){_0x7ea4be=_0x7ea4be||0xc8;return function(_0x88f646){if(_0x88f646){return _0x50959e['status'](_0x7ea4be)[_0xc79b('0x22')](_0x88f646);}};}function respondWithFilteredResult(_0x2b8839,_0xb53790){return function(_0x5bdc28){if(_0x5bdc28){var _0x773e41=_0x5bdc28[_0xc79b('0x23')],_0x296579=_0xb53790[_0xc79b('0x24')],_0x293147=_0xb53790[_0xc79b('0x24')]+_0xb53790['limit'],_0x25a57c;if(_0x293147>=_0x773e41){_0x293147=_0x773e41;_0x25a57c=0xc8;}else{_0x25a57c=0xce;}_0x2b8839[_0xc79b('0x20')](_0x25a57c);return _0x2b8839[_0xc79b('0x25')](_0xc79b('0x26'),_0x296579+'-'+_0x293147+'/'+_0x773e41)[_0xc79b('0x22')](_0x5bdc28);}return null;};}function patchUpdates(_0x47be6a){return function(_0x3f24e6){try{jsonpatch[_0xc79b('0x27')](_0x3f24e6,_0x47be6a,!![]);}catch(_0x551b23){return BPromise[_0xc79b('0x28')](_0x551b23);}return _0x3f24e6[_0xc79b('0x29')]();};}function saveUpdates(_0x5d5ae8,_0x5c898d){return function(_0x537f7c){if(_0x537f7c){return _0x537f7c['update'](_0x5d5ae8)[_0xc79b('0x2a')](function(_0x316af7){return _0x316af7;});}return null;};}function removeEntity(_0x4e1a9c,_0x367ec4){return function(_0x555053){if(_0x555053){return _0x555053[_0xc79b('0x2b')]()['then'](function(){var _0x2a4225=_0x555053[_0xc79b('0x2c')]({'plain':!![]});var _0x319471=_0xc79b('0x2d');return db[_0xc79b('0x2e')]['destroy']({'where':{'type':_0x319471,'resourceId':_0x2a4225['id']}})[_0xc79b('0x2a')](function(){return _0x555053;});})[_0xc79b('0x2a')](function(){_0x4e1a9c[_0xc79b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55a62b,_0x52eef8){return function(_0x141289){if(!_0x141289){_0x55a62b['sendStatus'](0x194);}return _0x141289;};}function handleError(_0x40271e,_0xcd888a){_0xcd888a=_0xcd888a||0x1f4;return function(_0x253b3e){logger[_0xc79b('0x2f')](_0x253b3e['stack']);if(_0x253b3e[_0xc79b('0x30')]){delete _0x253b3e[_0xc79b('0x30')];}_0x40271e['status'](_0xcd888a)[_0xc79b('0x31')](_0x253b3e);};}exports['index']=function(_0x17cc03,_0x2cd730){var _0x40d80f={},_0x4c8db6={},_0x210a4e={'count':0x0,'rows':[]};var _0x5052ba=_['map'](db[_0xc79b('0x32')][_0xc79b('0x33')],function(_0x39271e){return{'name':_0x39271e[_0xc79b('0x34')],'type':_0x39271e[_0xc79b('0x35')][_0xc79b('0x36')]};});_0x4c8db6[_0xc79b('0x37')]=_['map'](_0x5052ba,'name');_0x4c8db6['query']=_[_0xc79b('0x38')](_0x17cc03['query']);_0x4c8db6[_0xc79b('0x39')]=_[_0xc79b('0x3a')](_0x4c8db6[_0xc79b('0x37')],_0x4c8db6['query']);_0x40d80f['attributes']=_[_0xc79b('0x3a')](_0x4c8db6[_0xc79b('0x37')],qs[_0xc79b('0x3b')](_0x17cc03['query']['fields']));_0x40d80f['attributes']=_0x40d80f['attributes'][_0xc79b('0x3c')]?_0x40d80f[_0xc79b('0x3d')]:_0x4c8db6[_0xc79b('0x37')];if(!_0x17cc03['query'][_0xc79b('0x3e')]('nolimit')){_0x40d80f['limit']=qs[_0xc79b('0x3f')](_0x17cc03[_0xc79b('0x40')][_0xc79b('0x3f')]);_0x40d80f['offset']=qs[_0xc79b('0x24')](_0x17cc03[_0xc79b('0x40')][_0xc79b('0x24')]);}_0x40d80f[_0xc79b('0x41')]=qs['sort'](_0x17cc03[_0xc79b('0x40')][_0xc79b('0x42')]);_0x40d80f[_0xc79b('0x43')]=qs[_0xc79b('0x39')](_[_0xc79b('0x44')](_0x17cc03['query'],_0x4c8db6[_0xc79b('0x39')]),_0x5052ba);if(_0x17cc03[_0xc79b('0x40')][_0xc79b('0x45')]){_0x40d80f[_0xc79b('0x43')]=_[_0xc79b('0x46')](_0x40d80f[_0xc79b('0x43')],{'$or':_[_0xc79b('0x47')](_0x5052ba,function(_0x41f4db){if(_0x41f4db[_0xc79b('0x35')]!==_0xc79b('0x48')){var _0x305227={};_0x305227[_0x41f4db[_0xc79b('0x30')]]={'$like':'%'+_0x17cc03[_0xc79b('0x40')][_0xc79b('0x45')]+'%'};return _0x305227;}})});}_0x40d80f=_['merge']({},_0x40d80f,_0x17cc03['options']);var _0x2108a3={'where':_0x40d80f[_0xc79b('0x43')]};return db[_0xc79b('0x32')][_0xc79b('0x23')](_0x2108a3)['then'](function(_0x3c8d69){_0x210a4e[_0xc79b('0x23')]=_0x3c8d69;if(_0x17cc03['query'][_0xc79b('0x49')]){_0x40d80f[_0xc79b('0x4a')]=[{'all':!![]}];}return db[_0xc79b('0x32')]['findAll'](_0x40d80f);})[_0xc79b('0x2a')](function(_0x5b46a4){_0x210a4e[_0xc79b('0x4b')]=_0x5b46a4;return _0x210a4e;})[_0xc79b('0x2a')](respondWithFilteredResult(_0x2cd730,_0x40d80f))[_0xc79b('0x4c')](handleError(_0x2cd730,null));};exports[_0xc79b('0x4d')]=function(_0x4cc04c,_0x57a68c){var _0x484383={'raw':![],'where':{'id':_0x4cc04c[_0xc79b('0x4e')]['id']}},_0x482a4d={};_0x482a4d[_0xc79b('0x37')]=_['keys'](db[_0xc79b('0x32')]['rawAttributes']);_0x482a4d['query']=_[_0xc79b('0x38')](_0x4cc04c['query']);_0x482a4d[_0xc79b('0x4f')]=_[_0xc79b('0x3a')](_0x482a4d['model'],_0x482a4d[_0xc79b('0x40')]);_0x484383['attributes']=_[_0xc79b('0x3a')](_0x482a4d[_0xc79b('0x37')],qs[_0xc79b('0x3b')](_0x4cc04c['query'][_0xc79b('0x3b')]));_0x484383['attributes']=_0x484383['attributes'][_0xc79b('0x3c')]?_0x484383['attributes']:_0x482a4d[_0xc79b('0x37')];if(_0x4cc04c['query'][_0xc79b('0x49')]){_0x484383[_0xc79b('0x4a')]=[{'all':!![]}];}_0x484383=_['merge']({},_0x484383,_0x4cc04c['options']);return db[_0xc79b('0x32')][_0xc79b('0x50')](_0x484383)['then'](handleEntityNotFound(_0x57a68c,null))[_0xc79b('0x2a')](respondWithResult(_0x57a68c,null))[_0xc79b('0x4c')](handleError(_0x57a68c,null));};exports[_0xc79b('0x51')]=function(_0x442da7,_0x37c09a){return db['Team'][_0xc79b('0x51')](_0x442da7[_0xc79b('0x52')],{})['then'](function(_0x3c504e){var _0x2f2804=_0x442da7['user'][_0xc79b('0x2c')]({'plain':!![]});if(!_0x2f2804)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f2804[_0xc79b('0x53')]===_0xc79b('0x54')){var _0xef5125=_0x3c504e[_0xc79b('0x2c')]({'plain':!![]});var _0xca6190=_0xc79b('0x2d');return db[_0xc79b('0x55')][_0xc79b('0x50')]({'where':{'name':_0xca6190,'userProfileId':_0x2f2804[_0xc79b('0x56')]},'raw':!![]})[_0xc79b('0x2a')](function(_0x3db431){if(_0x3db431&&_0x3db431[_0xc79b('0x57')]===0x0){return db[_0xc79b('0x2e')]['create']({'name':_0xef5125[_0xc79b('0x30')],'resourceId':_0xef5125['id'],'type':_0x3db431[_0xc79b('0x30')],'sectionId':_0x3db431['id']},{})[_0xc79b('0x2a')](function(){return _0x3c504e;});}else{return _0x3c504e;}})['catch'](function(_0x1f2f96){logger[_0xc79b('0x2f')](_0xc79b('0x58'),_0x1f2f96);throw _0x1f2f96;});}return _0x3c504e;})[_0xc79b('0x2a')](respondWithResult(_0x37c09a,0xc9))[_0xc79b('0x4c')](handleError(_0x37c09a,null));};exports[_0xc79b('0x59')]=function(_0x5610fd,_0x240776){if(_0x5610fd[_0xc79b('0x52')]['id']){delete _0x5610fd['body']['id'];}return db[_0xc79b('0x32')][_0xc79b('0x50')]({'where':{'id':_0x5610fd['params']['id']}})[_0xc79b('0x2a')](handleEntityNotFound(_0x240776,null))['then'](saveUpdates(_0x5610fd[_0xc79b('0x52')],null))[_0xc79b('0x2a')](respondWithResult(_0x240776,null))[_0xc79b('0x4c')](handleError(_0x240776,null));};exports[_0xc79b('0x2b')]=function(_0x17c454,_0x1cdcec){return db[_0xc79b('0x32')][_0xc79b('0x50')]({'where':{'id':_0x17c454['params']['id']}})['then'](handleEntityNotFound(_0x1cdcec,null))['then'](removeEntity(_0x1cdcec,null))['catch'](handleError(_0x1cdcec,null));};exports[_0xc79b('0x5a')]=function(_0x5743ee,_0x75f81d,_0x163af1){return db[_0xc79b('0x32')]['findOne']({'where':{'id':_0x5743ee['params']['id']}})[_0xc79b('0x2a')](handleEntityNotFound(_0x75f81d,null))[_0xc79b('0x2a')](function(_0x2bf907){if(!_0x5743ee[_0xc79b('0x40')]['channel']||!utils['isValidChannel'](_0x5743ee[_0xc79b('0x40')]['channel'])){throw new db[(_0xc79b('0x5b'))][(_0xc79b('0x5c'))](_0xc79b('0x5d'));}var _0x34d9af={};var _0x3e999a={};_0x3e999a['model']=_[_0xc79b('0x38')](db[_[_0xc79b('0x5e')](_0x5743ee[_0xc79b('0x40')][_0xc79b('0x5f')]['toLowerCase']())+_0xc79b('0x60')][_0xc79b('0x33')]);_0x3e999a[_0xc79b('0x40')]=_[_0xc79b('0x38')](_0x5743ee['query']);_0x3e999a[_0xc79b('0x39')]=_[_0xc79b('0x3a')](_0x3e999a[_0xc79b('0x37')],_0x3e999a[_0xc79b('0x40')]);_0x34d9af[_0xc79b('0x3d')]=_[_0xc79b('0x3a')](_0x3e999a[_0xc79b('0x37')],qs[_0xc79b('0x3b')](_0x5743ee[_0xc79b('0x40')][_0xc79b('0x3b')]));_0x34d9af['attributes']=_0x34d9af['attributes'][_0xc79b('0x3c')]?_0x34d9af[_0xc79b('0x3d')]:_0x3e999a[_0xc79b('0x37')];_0x34d9af[_0xc79b('0x3f')]=qs[_0xc79b('0x3f')](_0x5743ee[_0xc79b('0x40')][_0xc79b('0x3f')]);_0x34d9af[_0xc79b('0x24')]=qs[_0xc79b('0x24')](_0x5743ee[_0xc79b('0x40')][_0xc79b('0x24')]);_0x34d9af[_0xc79b('0x41')]=qs[_0xc79b('0x42')](_0x5743ee['query'][_0xc79b('0x42')]);_0x34d9af['where']=qs[_0xc79b('0x39')](_[_0xc79b('0x44')](_0x5743ee[_0xc79b('0x40')],_0x3e999a[_0xc79b('0x39')]));_0x34d9af=_[_0xc79b('0x46')]({},_0x34d9af,_0x5743ee[_0xc79b('0x61')]);return _0x2bf907[_0xc79b('0x2c')+_[_0xc79b('0x5e')](_0x5743ee[_0xc79b('0x40')][_0xc79b('0x5f')][_0xc79b('0x62')]())+'Queues'](_0x34d9af);})[_0xc79b('0x2a')](respondWithResult(_0x75f81d,null))['catch'](handleError(_0x75f81d,null));};exports['addQueues']=function(_0x3111ef,_0xbd4dbd,_0x22e644){return db[_0xc79b('0x32')]['findOne']({'where':{'id':_0x3111ef[_0xc79b('0x4e')]['id']}})[_0xc79b('0x2a')](function(_0x598882){if(_0x598882){if(!_0x3111ef[_0xc79b('0x52')][_0xc79b('0x5f')]||!utils[_0xc79b('0x63')](_0x3111ef['body'][_0xc79b('0x5f')])){throw new db[(_0xc79b('0x5b'))][(_0xc79b('0x5c'))](_0xc79b('0x5d'));}return _0x598882[_0xc79b('0x64')+_[_0xc79b('0x5e')](_0x3111ef[_0xc79b('0x52')]['channel']['toLowerCase']())+_0xc79b('0x65')](_0x3111ef[_0xc79b('0x52')][_0xc79b('0x66')]);}return null;})[_0xc79b('0x2a')](handleEntityNotFound(_0xbd4dbd,null))[_0xc79b('0x2a')](respondWithStatusCode(_0xbd4dbd,null))[_0xc79b('0x4c')](handleError(_0xbd4dbd,null));};exports[_0xc79b('0x67')]=function(_0x1b477a,_0x3df836,_0x392d1b){return db[_0xc79b('0x32')]['findOne']({'where':{'id':_0x1b477a[_0xc79b('0x4e')]['id']}})[_0xc79b('0x2a')](function(_0x14c8fe){if(_0x14c8fe){if(!_0x1b477a['query'][_0xc79b('0x5f')]||!utils[_0xc79b('0x63')](_0x1b477a[_0xc79b('0x40')][_0xc79b('0x5f')])){throw new db[(_0xc79b('0x5b'))][(_0xc79b('0x5c'))](_0xc79b('0x5d'));}return _0x14c8fe[_0xc79b('0x68')+_['capitalize'](_0x1b477a['query']['channel'][_0xc79b('0x62')]())+_0xc79b('0x65')](_0x1b477a[_0xc79b('0x40')][_0xc79b('0x66')]);}return null;})[_0xc79b('0x2a')](handleEntityNotFound(_0x3df836,null))[_0xc79b('0x2a')](respondWithStatusCode(_0x3df836,null))[_0xc79b('0x4c')](handleError(_0x3df836,null));};exports[_0xc79b('0x69')]=function(_0x1bd74d,_0x5c7ed5,_0x3064e9){return db[_0xc79b('0x32')][_0xc79b('0x50')]({'where':{'id':_0x1bd74d[_0xc79b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5c7ed5,null))[_0xc79b('0x2a')](function(_0xb85e72){if(_0xb85e72){var _0x2d2f87=[_0xc79b('0x6a'),_0xc79b('0x6b'),_0xc79b('0x6c'),'Sms','Fax',_0xc79b('0x6d'),'Whatsapp'];return BPromise[_0xc79b('0x6e')](_0x2d2f87,function(_0x356094){return _0xb85e72['get'+_0x356094+_0xc79b('0x65')]({'attributes':['id',_0xc79b('0x30')]})[_0xc79b('0x2a')](function(_0x20e98f){return BPromise[_0xc79b('0x6e')](_0x20e98f,function(_0x14a690){return _0x14a690[_0xc79b('0x69')](_0x1bd74d['body'][_0xc79b('0x66')])[_0xc79b('0x2a')](function(){if(_0x356094==='Voice'){return db[_0xc79b('0x6f')]['findAll']({'where':{'id':_0x1bd74d['body']['ids']},'attributes':['id',_0xc79b('0x30'),'online',_0xc79b('0x70'),_0xc79b('0x71')],'raw':!![]})[_0xc79b('0x2a')](function(_0x41a505){return BPromise[_0xc79b('0x6e')](_[_0xc79b('0x45')](_0x41a505,{'online':0x1}),function(_0x54c6b8){return db[_0xc79b('0x72')]['upsert']({'membername':_0x54c6b8[_0xc79b('0x30')],'UserId':_0x54c6b8['id'],'queue_name':_0x14a690['name'],'VoiceQueueId':_0x14a690['id'],'interface':_['isNil'](_0x54c6b8[_0xc79b('0x71')])?util[_0xc79b('0x73')](_0xc79b('0x74'),_0x54c6b8[_0xc79b('0x30')]):_0x54c6b8['interface'],'paused':_0x54c6b8[_0xc79b('0x70')]||![],'penalty':0x0});});});}});});})[_0xc79b('0x2a')](function(){return _0xb85e72;});})[_0xc79b('0x2a')](function(){return _0xb85e72;});}})[_0xc79b('0x2a')](function(_0x26dd4c){if(_0x26dd4c){return _0x26dd4c[_0xc79b('0x69')](_0x1bd74d[_0xc79b('0x52')]['ids'],_[_0xc79b('0x75')](_0x1bd74d[_0xc79b('0x52')],['ids','id'])||{})[_0xc79b('0x76')](function(_0x309fcc){for(var _0x4d19f1=0x0;_0x4d19f1<_0x1bd74d['body'][_0xc79b('0x66')][_0xc79b('0x3c')];_0x4d19f1+=0x1){socket[_0xc79b('0x77')]('userTeam:save',{'UserId':_0x1bd74d['body']['ids'][_0x4d19f1],'TeamId':_0x1bd74d[_0xc79b('0x4e')]['id']});}return _0x309fcc;});}})['then'](respondWithResult(_0x5c7ed5,null))[_0xc79b('0x4c')](handleError(_0x5c7ed5,null));};exports[_0xc79b('0x78')]=function(_0x29b071,_0x402a9a,_0x2a1cab){return db['Team']['find']({'where':{'id':_0x29b071[_0xc79b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x402a9a,null))[_0xc79b('0x2a')](function(_0x41f763){if(_0x41f763){return BPromise[_0xc79b('0x6e')]([_0xc79b('0x79'),_0xc79b('0x7a'),_0xc79b('0x7b'),_0xc79b('0x7c'),_0xc79b('0x7d'),_0xc79b('0x7e'),_0xc79b('0x7f')],function(_0x45506d){return _0x41f763[_0xc79b('0x2c')+_['capitalize'](_0x45506d)+'Queues']({'attributes':['id',_0xc79b('0x30')]})[_0xc79b('0x2a')](function(_0x1987a3){return BPromise[_0xc79b('0x6e')](_0x1987a3,function(_0x487cd8){return _0x487cd8[_0xc79b('0x78')](_0x29b071[_0xc79b('0x40')][_0xc79b('0x66')])[_0xc79b('0x2a')](function(){if(_0x45506d==='voice'){return db[_0xc79b('0x72')][_0xc79b('0x2b')]({'where':{'VoiceQueueId':_0x487cd8['id'],'UserId':_0x29b071[_0xc79b('0x40')][_0xc79b('0x66')]}});}});});})[_0xc79b('0x2a')](function(){return _0x41f763;});})[_0xc79b('0x2a')](function(){return _0x41f763;});}})['then'](function(_0x236e9e){if(_0x236e9e){return _0x236e9e[_0xc79b('0x78')](_0x29b071[_0xc79b('0x40')]['ids'])[_0xc79b('0x2a')](function(){if(_[_0xc79b('0x80')](_0x29b071[_0xc79b('0x40')][_0xc79b('0x66')])){for(var _0x55c5c8=0x0;_0x55c5c8<_0x29b071['query'][_0xc79b('0x66')][_0xc79b('0x3c')];_0x55c5c8+=0x1){socket[_0xc79b('0x77')](_0xc79b('0x81'),{'UserId':Number(_0x29b071[_0xc79b('0x40')][_0xc79b('0x66')][_0x55c5c8]),'TeamId':Number(_0x29b071[_0xc79b('0x4e')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x29b071[_0xc79b('0x40')][_0xc79b('0x66')]),'TeamId':Number(_0x29b071[_0xc79b('0x4e')]['id'])});}});}})[_0xc79b('0x2a')](respondWithStatusCode(_0x402a9a,null))[_0xc79b('0x4c')](handleError(_0x402a9a,null));};exports[_0xc79b('0x82')]=function(_0x115c42,_0x16be40,_0x5e9560){var _0xb58c2f={};var _0x516934={};var _0x34e4d4;var _0x54cc21;return db['Team'][_0xc79b('0x83')]({'where':{'id':_0x115c42[_0xc79b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16be40,null))[_0xc79b('0x2a')](function(_0x1c170e){if(_0x1c170e){_0x34e4d4=_0x1c170e;_0x516934[_0xc79b('0x37')]=_[_0xc79b('0x38')](db[_0xc79b('0x6f')][_0xc79b('0x33')]);_0x516934[_0xc79b('0x40')]=_[_0xc79b('0x38')](_0x115c42[_0xc79b('0x40')]);_0x516934[_0xc79b('0x39')]=_['intersection'](_0x516934[_0xc79b('0x37')],_0x516934['query']);_0xb58c2f[_0xc79b('0x3d')]=_['intersection'](_0x516934[_0xc79b('0x37')],qs[_0xc79b('0x3b')](_0x115c42['query'][_0xc79b('0x3b')]));_0xb58c2f[_0xc79b('0x3d')]=_0xb58c2f['attributes'][_0xc79b('0x3c')]?_0xb58c2f['attributes']:_0x516934[_0xc79b('0x37')];_0xb58c2f['order']=qs['sort'](_0x115c42['query'][_0xc79b('0x42')]);_0xb58c2f[_0xc79b('0x43')]=qs['filters'](_[_0xc79b('0x44')](_0x115c42['query'],_0x516934[_0xc79b('0x39')]));if(_0x115c42[_0xc79b('0x40')]['filter']){_0xb58c2f[_0xc79b('0x43')]=_[_0xc79b('0x46')](_0xb58c2f[_0xc79b('0x43')],{'$or':_[_0xc79b('0x47')](_0xb58c2f[_0xc79b('0x3d')],function(_0x2fafb4){var _0x31cec5={};_0x31cec5[_0x2fafb4]={'$like':'%'+_0x115c42['query'][_0xc79b('0x45')]+'%'};return _0x31cec5;})});}_0xb58c2f=_[_0xc79b('0x46')]({},_0xb58c2f,_0x115c42[_0xc79b('0x61')]);return _0x34e4d4[_0xc79b('0x82')](_0xb58c2f);}})[_0xc79b('0x2a')](function(_0x3f988b){if(_0x3f988b){_0x54cc21=_0x3f988b[_0xc79b('0x3c')];if(!_0x115c42[_0xc79b('0x40')][_0xc79b('0x3e')]('nolimit')){_0xb58c2f[_0xc79b('0x3f')]=qs[_0xc79b('0x3f')](_0x115c42[_0xc79b('0x40')][_0xc79b('0x3f')]);_0xb58c2f[_0xc79b('0x24')]=qs[_0xc79b('0x24')](_0x115c42[_0xc79b('0x40')]['offset']);}return _0x34e4d4[_0xc79b('0x82')](_0xb58c2f);}})[_0xc79b('0x2a')](function(_0x2188f9){if(_0x2188f9){return _0x2188f9?{'count':_0x54cc21,'rows':_0x2188f9}:null;}})['then'](respondWithResult(_0x16be40,null))['catch'](handleError(_0x16be40,null));}; \ No newline at end of file +var _0xacac=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','Teams','end','stack','name','send','index','Team','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','addQueues','Queues','removeQueues','remove','ids','addAgents','Voice','Chat','Mail','each','User','findAll','online','upsert','isNil','interface','format','SIP/%s','voicePause','omit','emit','removeAgents','fax','voice','userTeam:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xe8a7df,_0x21915c){var _0x22b8ed=function(_0x5acdf9){while(--_0x5acdf9){_0xe8a7df['push'](_0xe8a7df['shift']());}};_0x22b8ed(++_0x21915c);}(_0xacac,0x1d8));var _0xcaca=function(_0x2acef9,_0x5f41d8){_0x2acef9=_0x2acef9-0x0;var _0x56ee6e=_0xacac[_0x2acef9];return _0x56ee6e;};'use strict';var pdf=require(_0xcaca('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcaca('0x1'));var zipdir=require(_0xcaca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaca('0x3'));var moment=require(_0xcaca('0x4'));var BPromise=require(_0xcaca('0x5'));var Mustache=require(_0xcaca('0x6'));var util=require(_0xcaca('0x7'));var path=require('path');var sox=require(_0xcaca('0x8'));var csv=require(_0xcaca('0x9'));var ejs=require(_0xcaca('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcaca('0xb'));var crypto=require(_0xcaca('0xc'));var jsforce=require(_0xcaca('0xd'));var deskjs=require(_0xcaca('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcaca('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcaca('0x10'));var as=require(_0xcaca('0x11'));var hardwareService=require(_0xcaca('0x12'));var logger=require('../../config/logger')(_0xcaca('0x13'));var utils=require(_0xcaca('0x14'));var config=require(_0xcaca('0x15'));var licenseUtil=require(_0xcaca('0x16'));var db=require(_0xcaca('0x17'))['db'];config[_0xcaca('0x18')]=_[_0xcaca('0x19')](config[_0xcaca('0x18')],{'host':_0xcaca('0x1a'),'port':0x18eb});var socket=require(_0xcaca('0x1b'))(new Redis(config[_0xcaca('0x18')]));require('./team.socket')[_0xcaca('0x1c')](socket);function respondWithStatusCode(_0xfdeec4,_0x255981){_0x255981=_0x255981||0xcc;return function(_0x5c54b0){if(_0x5c54b0){return _0xfdeec4[_0xcaca('0x1d')](_0x255981);}return _0xfdeec4[_0xcaca('0x1e')](_0x255981)['end']();};}function respondWithResult(_0x5a59c2,_0x2d7437){_0x2d7437=_0x2d7437||0xc8;return function(_0x55389c){if(_0x55389c){return _0x5a59c2[_0xcaca('0x1e')](_0x2d7437)['json'](_0x55389c);}};}function respondWithFilteredResult(_0x5dfc2f,_0x80fd17){return function(_0x199ec8){if(_0x199ec8){var _0x33bde6=_0x199ec8[_0xcaca('0x1f')],_0x1aa536=_0x80fd17[_0xcaca('0x20')],_0x5246a7=_0x80fd17[_0xcaca('0x20')]+_0x80fd17[_0xcaca('0x21')],_0x928ef8;if(_0x5246a7>=_0x33bde6){_0x5246a7=_0x33bde6;_0x928ef8=0xc8;}else{_0x928ef8=0xce;}_0x5dfc2f[_0xcaca('0x1e')](_0x928ef8);return _0x5dfc2f[_0xcaca('0x22')](_0xcaca('0x23'),_0x1aa536+'-'+_0x5246a7+'/'+_0x33bde6)[_0xcaca('0x24')](_0x199ec8);}return null;};}function patchUpdates(_0x2c0690){return function(_0x31c62b){try{jsonpatch[_0xcaca('0x25')](_0x31c62b,_0x2c0690,!![]);}catch(_0xac867d){return BPromise[_0xcaca('0x26')](_0xac867d);}return _0x31c62b[_0xcaca('0x27')]();};}function saveUpdates(_0x2b5e7e,_0x79f4ca){return function(_0x3062ea){if(_0x3062ea){return _0x3062ea[_0xcaca('0x28')](_0x2b5e7e)[_0xcaca('0x29')](function(_0x1fcbbc){return _0x1fcbbc;});}return null;};}function removeEntity(_0x517bad,_0x221b75){return function(_0x3c78e4){if(_0x3c78e4){return _0x3c78e4[_0xcaca('0x2a')]()[_0xcaca('0x29')](function(){var _0x4cd864=_0x3c78e4['get']({'plain':!![]});var _0x56b032=_0xcaca('0x2b');return db['UserProfileResource'][_0xcaca('0x2a')]({'where':{'type':_0x56b032,'resourceId':_0x4cd864['id']}})['then'](function(){return _0x3c78e4;});})[_0xcaca('0x29')](function(){_0x517bad['status'](0xcc)[_0xcaca('0x2c')]();});}};}function handleEntityNotFound(_0x43dfed,_0x3553b3){return function(_0x1492f8){if(!_0x1492f8){_0x43dfed[_0xcaca('0x1d')](0x194);}return _0x1492f8;};}function handleError(_0x46a2d5,_0x3b6246){_0x3b6246=_0x3b6246||0x1f4;return function(_0x590894){logger['error'](_0x590894[_0xcaca('0x2d')]);if(_0x590894['name']){delete _0x590894[_0xcaca('0x2e')];}_0x46a2d5[_0xcaca('0x1e')](_0x3b6246)[_0xcaca('0x2f')](_0x590894);};}exports[_0xcaca('0x30')]=function(_0x597ce9,_0x9264f9){var _0x286cb5={},_0xb8fa90={},_0x3eee44={'count':0x0,'rows':[]};var _0x578cac=_['map'](db[_0xcaca('0x31')][_0xcaca('0x32')],function(_0x13e012){return{'name':_0x13e012[_0xcaca('0x33')],'type':_0x13e012[_0xcaca('0x34')]['key']};});_0xb8fa90['model']=_[_0xcaca('0x35')](_0x578cac,_0xcaca('0x2e'));_0xb8fa90[_0xcaca('0x36')]=_[_0xcaca('0x37')](_0x597ce9[_0xcaca('0x36')]);_0xb8fa90[_0xcaca('0x38')]=_[_0xcaca('0x39')](_0xb8fa90[_0xcaca('0x3a')],_0xb8fa90[_0xcaca('0x36')]);_0x286cb5[_0xcaca('0x3b')]=_[_0xcaca('0x39')](_0xb8fa90['model'],qs[_0xcaca('0x3c')](_0x597ce9[_0xcaca('0x36')][_0xcaca('0x3c')]));_0x286cb5[_0xcaca('0x3b')]=_0x286cb5[_0xcaca('0x3b')][_0xcaca('0x3d')]?_0x286cb5['attributes']:_0xb8fa90['model'];if(!_0x597ce9[_0xcaca('0x36')][_0xcaca('0x3e')](_0xcaca('0x3f'))){_0x286cb5['limit']=qs[_0xcaca('0x21')](_0x597ce9['query'][_0xcaca('0x21')]);_0x286cb5[_0xcaca('0x20')]=qs[_0xcaca('0x20')](_0x597ce9[_0xcaca('0x36')][_0xcaca('0x20')]);}_0x286cb5[_0xcaca('0x40')]=qs[_0xcaca('0x41')](_0x597ce9[_0xcaca('0x36')][_0xcaca('0x41')]);_0x286cb5[_0xcaca('0x42')]=qs[_0xcaca('0x38')](_['pick'](_0x597ce9[_0xcaca('0x36')],_0xb8fa90[_0xcaca('0x38')]),_0x578cac);if(_0x597ce9['query'][_0xcaca('0x43')]){_0x286cb5['where']=_['merge'](_0x286cb5[_0xcaca('0x42')],{'$or':_[_0xcaca('0x35')](_0x578cac,function(_0x5b0f5f){if(_0x5b0f5f[_0xcaca('0x34')]!=='VIRTUAL'){var _0xa99c85={};_0xa99c85[_0x5b0f5f[_0xcaca('0x2e')]]={'$like':'%'+_0x597ce9[_0xcaca('0x36')][_0xcaca('0x43')]+'%'};return _0xa99c85;}})});}_0x286cb5=_[_0xcaca('0x44')]({},_0x286cb5,_0x597ce9[_0xcaca('0x45')]);var _0x63876c={'where':_0x286cb5[_0xcaca('0x42')]};return db[_0xcaca('0x31')]['count'](_0x63876c)[_0xcaca('0x29')](function(_0x2a2dc2){_0x3eee44[_0xcaca('0x1f')]=_0x2a2dc2;if(_0x597ce9['query'][_0xcaca('0x46')]){_0x286cb5[_0xcaca('0x47')]=[{'all':!![]}];}return db[_0xcaca('0x31')]['findAll'](_0x286cb5);})[_0xcaca('0x29')](function(_0x5433d0){_0x3eee44[_0xcaca('0x48')]=_0x5433d0;return _0x3eee44;})[_0xcaca('0x29')](respondWithFilteredResult(_0x9264f9,_0x286cb5))['catch'](handleError(_0x9264f9,null));};exports[_0xcaca('0x49')]=function(_0xd18346,_0xed721b){var _0x299f23={'raw':![],'where':{'id':_0xd18346[_0xcaca('0x4a')]['id']}},_0x1e8466={};_0x1e8466['model']=_[_0xcaca('0x37')](db['Team']['rawAttributes']);_0x1e8466[_0xcaca('0x36')]=_[_0xcaca('0x37')](_0xd18346['query']);_0x1e8466['filtears']=_[_0xcaca('0x39')](_0x1e8466['model'],_0x1e8466[_0xcaca('0x36')]);_0x299f23[_0xcaca('0x3b')]=_['intersection'](_0x1e8466['model'],qs[_0xcaca('0x3c')](_0xd18346['query'][_0xcaca('0x3c')]));_0x299f23[_0xcaca('0x3b')]=_0x299f23[_0xcaca('0x3b')]['length']?_0x299f23[_0xcaca('0x3b')]:_0x1e8466[_0xcaca('0x3a')];if(_0xd18346[_0xcaca('0x36')][_0xcaca('0x46')]){_0x299f23[_0xcaca('0x47')]=[{'all':!![]}];}_0x299f23=_[_0xcaca('0x44')]({},_0x299f23,_0xd18346[_0xcaca('0x45')]);return db[_0xcaca('0x31')][_0xcaca('0x4b')](_0x299f23)[_0xcaca('0x29')](handleEntityNotFound(_0xed721b,null))[_0xcaca('0x29')](respondWithResult(_0xed721b,null))[_0xcaca('0x4c')](handleError(_0xed721b,null));};exports[_0xcaca('0x4d')]=function(_0x4a1ed8,_0x52c56a){return db['Team'][_0xcaca('0x4d')](_0x4a1ed8[_0xcaca('0x4e')],{})['then'](function(_0x3f5b3b){var _0x2ed004=_0x4a1ed8[_0xcaca('0x4f')][_0xcaca('0x50')]({'plain':!![]});if(!_0x2ed004)throw new Error(_0xcaca('0x51'));if(_0x2ed004[_0xcaca('0x52')]===_0xcaca('0x4f')){var _0x14d0ea=_0x3f5b3b[_0xcaca('0x50')]({'plain':!![]});var _0x26bde5=_0xcaca('0x2b');return db['UserProfileSection'][_0xcaca('0x4b')]({'where':{'name':_0x26bde5,'userProfileId':_0x2ed004[_0xcaca('0x53')]},'raw':!![]})[_0xcaca('0x29')](function(_0x48ced5){if(_0x48ced5&&_0x48ced5['autoAssociation']===0x0){return db['UserProfileResource'][_0xcaca('0x4d')]({'name':_0x14d0ea['name'],'resourceId':_0x14d0ea['id'],'type':_0x48ced5[_0xcaca('0x2e')],'sectionId':_0x48ced5['id']},{})[_0xcaca('0x29')](function(){return _0x3f5b3b;});}else{return _0x3f5b3b;}})[_0xcaca('0x4c')](function(_0x52747c){logger[_0xcaca('0x54')](_0xcaca('0x55'),_0x52747c);throw _0x52747c;});}return _0x3f5b3b;})[_0xcaca('0x29')](respondWithResult(_0x52c56a,0xc9))[_0xcaca('0x4c')](handleError(_0x52c56a,null));};exports['update']=function(_0x4c0124,_0x4ce392){if(_0x4c0124['body']['id']){delete _0x4c0124['body']['id'];}return db[_0xcaca('0x31')]['find']({'where':{'id':_0x4c0124[_0xcaca('0x4a')]['id']}})[_0xcaca('0x29')](handleEntityNotFound(_0x4ce392,null))[_0xcaca('0x29')](saveUpdates(_0x4c0124['body'],null))[_0xcaca('0x29')](respondWithResult(_0x4ce392,null))[_0xcaca('0x4c')](handleError(_0x4ce392,null));};exports[_0xcaca('0x2a')]=function(_0x42b40d,_0x281bf0){return db[_0xcaca('0x31')][_0xcaca('0x4b')]({'where':{'id':_0x42b40d[_0xcaca('0x4a')]['id']}})['then'](handleEntityNotFound(_0x281bf0,null))[_0xcaca('0x29')](removeEntity(_0x281bf0,null))[_0xcaca('0x4c')](handleError(_0x281bf0,null));};exports['getQueues']=function(_0x2417c0,_0x5f4151,_0x11fd03){return db[_0xcaca('0x31')][_0xcaca('0x56')]({'where':{'id':_0x2417c0['params']['id']}})['then'](handleEntityNotFound(_0x5f4151,null))[_0xcaca('0x29')](function(_0x3a401c){if(!_0x2417c0[_0xcaca('0x36')][_0xcaca('0x57')]||!utils[_0xcaca('0x58')](_0x2417c0[_0xcaca('0x36')]['channel'])){throw new db[(_0xcaca('0x59'))][(_0xcaca('0x5a'))](_0xcaca('0x5b'));}var _0x2cb8e6={};var _0x4647f4={};_0x4647f4[_0xcaca('0x3a')]=_['keys'](db[_[_0xcaca('0x5c')](_0x2417c0[_0xcaca('0x36')]['channel'][_0xcaca('0x5d')]())+_0xcaca('0x5e')][_0xcaca('0x32')]);_0x4647f4['query']=_[_0xcaca('0x37')](_0x2417c0[_0xcaca('0x36')]);_0x4647f4['filters']=_[_0xcaca('0x39')](_0x4647f4[_0xcaca('0x3a')],_0x4647f4['query']);_0x2cb8e6[_0xcaca('0x3b')]=_[_0xcaca('0x39')](_0x4647f4[_0xcaca('0x3a')],qs[_0xcaca('0x3c')](_0x2417c0[_0xcaca('0x36')][_0xcaca('0x3c')]));_0x2cb8e6[_0xcaca('0x3b')]=_0x2cb8e6[_0xcaca('0x3b')]['length']?_0x2cb8e6[_0xcaca('0x3b')]:_0x4647f4['model'];_0x2cb8e6[_0xcaca('0x21')]=qs[_0xcaca('0x21')](_0x2417c0[_0xcaca('0x36')][_0xcaca('0x21')]);_0x2cb8e6[_0xcaca('0x20')]=qs[_0xcaca('0x20')](_0x2417c0['query'][_0xcaca('0x20')]);_0x2cb8e6[_0xcaca('0x40')]=qs[_0xcaca('0x41')](_0x2417c0[_0xcaca('0x36')]['sort']);_0x2cb8e6[_0xcaca('0x42')]=qs[_0xcaca('0x38')](_[_0xcaca('0x5f')](_0x2417c0[_0xcaca('0x36')],_0x4647f4['filters']));_0x2cb8e6=_[_0xcaca('0x44')]({},_0x2cb8e6,_0x2417c0[_0xcaca('0x45')]);return _0x3a401c[_0xcaca('0x50')+_[_0xcaca('0x5c')](_0x2417c0[_0xcaca('0x36')][_0xcaca('0x57')][_0xcaca('0x5d')]())+'Queues'](_0x2cb8e6);})[_0xcaca('0x29')](respondWithResult(_0x5f4151,null))[_0xcaca('0x4c')](handleError(_0x5f4151,null));};exports[_0xcaca('0x60')]=function(_0x354963,_0x5003bf,_0x336d83){return db[_0xcaca('0x31')][_0xcaca('0x56')]({'where':{'id':_0x354963['params']['id']}})['then'](function(_0x5787a2){if(_0x5787a2){if(!_0x354963['body'][_0xcaca('0x57')]||!utils[_0xcaca('0x58')](_0x354963[_0xcaca('0x4e')][_0xcaca('0x57')])){throw new db['Sequelize'][(_0xcaca('0x5a'))](_0xcaca('0x5b'));}return _0x5787a2['add'+_[_0xcaca('0x5c')](_0x354963[_0xcaca('0x4e')][_0xcaca('0x57')][_0xcaca('0x5d')]())+_0xcaca('0x61')](_0x354963[_0xcaca('0x4e')]['ids']);}return null;})[_0xcaca('0x29')](handleEntityNotFound(_0x5003bf,null))[_0xcaca('0x29')](respondWithStatusCode(_0x5003bf,null))[_0xcaca('0x4c')](handleError(_0x5003bf,null));};exports[_0xcaca('0x62')]=function(_0x331804,_0x1980f6,_0x17b95a){return db[_0xcaca('0x31')][_0xcaca('0x56')]({'where':{'id':_0x331804[_0xcaca('0x4a')]['id']}})[_0xcaca('0x29')](function(_0x3e14e7){if(_0x3e14e7){if(!_0x331804[_0xcaca('0x36')][_0xcaca('0x57')]||!utils[_0xcaca('0x58')](_0x331804['query'][_0xcaca('0x57')])){throw new db[(_0xcaca('0x59'))][(_0xcaca('0x5a'))](_0xcaca('0x5b'));}return _0x3e14e7[_0xcaca('0x63')+_[_0xcaca('0x5c')](_0x331804[_0xcaca('0x36')][_0xcaca('0x57')][_0xcaca('0x5d')]())+_0xcaca('0x61')](_0x331804[_0xcaca('0x36')][_0xcaca('0x64')]);}return null;})[_0xcaca('0x29')](handleEntityNotFound(_0x1980f6,null))[_0xcaca('0x29')](respondWithStatusCode(_0x1980f6,null))[_0xcaca('0x4c')](handleError(_0x1980f6,null));};exports[_0xcaca('0x65')]=function(_0x75506d,_0x3e0a0f,_0x11673d){return db[_0xcaca('0x31')][_0xcaca('0x4b')]({'where':{'id':_0x75506d[_0xcaca('0x4a')]['id']}})[_0xcaca('0x29')](handleEntityNotFound(_0x3e0a0f,null))[_0xcaca('0x29')](function(_0x55d9af){if(_0x55d9af){var _0x121d84=[_0xcaca('0x66'),_0xcaca('0x67'),_0xcaca('0x68'),'Sms','Fax','Openchannel','Whatsapp'];return BPromise[_0xcaca('0x69')](_0x121d84,function(_0x544381){return _0x55d9af[_0xcaca('0x50')+_0x544381+_0xcaca('0x61')]({'attributes':['id','name']})[_0xcaca('0x29')](function(_0x5d41bb){return BPromise['each'](_0x5d41bb,function(_0x1889b9){return _0x1889b9[_0xcaca('0x65')](_0x75506d[_0xcaca('0x4e')][_0xcaca('0x64')])[_0xcaca('0x29')](function(){if(_0x544381==='Voice'){return db[_0xcaca('0x6a')][_0xcaca('0x6b')]({'where':{'id':_0x75506d[_0xcaca('0x4e')][_0xcaca('0x64')]},'attributes':['id',_0xcaca('0x2e'),_0xcaca('0x6c'),'voicePause','interface'],'raw':!![]})[_0xcaca('0x29')](function(_0x1fbe65){return BPromise[_0xcaca('0x69')](_['filter'](_0x1fbe65,{'online':0x1}),function(_0x5645c6){return db['UserVoiceQueueRt'][_0xcaca('0x6d')]({'membername':_0x5645c6['name'],'UserId':_0x5645c6['id'],'queue_name':_0x1889b9['name'],'VoiceQueueId':_0x1889b9['id'],'interface':_[_0xcaca('0x6e')](_0x5645c6[_0xcaca('0x6f')])?util[_0xcaca('0x70')](_0xcaca('0x71'),_0x5645c6[_0xcaca('0x2e')]):_0x5645c6['interface'],'paused':_0x5645c6[_0xcaca('0x72')]||![],'penalty':0x0});});});}});});})[_0xcaca('0x29')](function(){return _0x55d9af;});})['then'](function(){return _0x55d9af;});}})[_0xcaca('0x29')](function(_0x1e8f0e){if(_0x1e8f0e){return _0x1e8f0e[_0xcaca('0x65')](_0x75506d[_0xcaca('0x4e')]['ids'],_[_0xcaca('0x73')](_0x75506d[_0xcaca('0x4e')],[_0xcaca('0x64'),'id'])||{})['spread'](function(_0x3aefa3){for(var _0x1f402e=0x0;_0x1f402e<_0x75506d['body'][_0xcaca('0x64')]['length'];_0x1f402e+=0x1){socket[_0xcaca('0x74')]('userTeam:save',{'UserId':_0x75506d[_0xcaca('0x4e')][_0xcaca('0x64')][_0x1f402e],'TeamId':_0x75506d[_0xcaca('0x4a')]['id']});}return _0x3aefa3;});}})[_0xcaca('0x29')](respondWithResult(_0x3e0a0f,null))[_0xcaca('0x4c')](handleError(_0x3e0a0f,null));};exports[_0xcaca('0x75')]=function(_0x5d2005,_0x3c1010,_0x231379){return db[_0xcaca('0x31')][_0xcaca('0x4b')]({'where':{'id':_0x5d2005['params']['id']}})['then'](handleEntityNotFound(_0x3c1010,null))[_0xcaca('0x29')](function(_0x3b1127){if(_0x3b1127){return BPromise[_0xcaca('0x69')](['voice','chat','mail','sms',_0xcaca('0x76'),'openchannel','whatsapp'],function(_0x4a722f){return _0x3b1127[_0xcaca('0x50')+_[_0xcaca('0x5c')](_0x4a722f)+_0xcaca('0x61')]({'attributes':['id',_0xcaca('0x2e')]})[_0xcaca('0x29')](function(_0x3b34bc){return BPromise[_0xcaca('0x69')](_0x3b34bc,function(_0x514673){return _0x514673[_0xcaca('0x75')](_0x5d2005['query'][_0xcaca('0x64')])[_0xcaca('0x29')](function(){if(_0x4a722f===_0xcaca('0x77')){return db['UserVoiceQueueRt'][_0xcaca('0x2a')]({'where':{'VoiceQueueId':_0x514673['id'],'UserId':_0x5d2005[_0xcaca('0x36')][_0xcaca('0x64')]}});}});});})[_0xcaca('0x29')](function(){return _0x3b1127;});})[_0xcaca('0x29')](function(){return _0x3b1127;});}})[_0xcaca('0x29')](function(_0x204423){if(_0x204423){return _0x204423[_0xcaca('0x75')](_0x5d2005[_0xcaca('0x36')]['ids'])[_0xcaca('0x29')](function(){if(_['isArray'](_0x5d2005[_0xcaca('0x36')]['ids'])){for(var _0x1fedeb=0x0;_0x1fedeb<_0x5d2005['query'][_0xcaca('0x64')][_0xcaca('0x3d')];_0x1fedeb+=0x1){socket[_0xcaca('0x74')](_0xcaca('0x78'),{'UserId':Number(_0x5d2005[_0xcaca('0x36')][_0xcaca('0x64')][_0x1fedeb]),'TeamId':Number(_0x5d2005[_0xcaca('0x4a')]['id'])});}}else{socket[_0xcaca('0x74')](_0xcaca('0x78'),{'UserId':Number(_0x5d2005['query'][_0xcaca('0x64')]),'TeamId':Number(_0x5d2005[_0xcaca('0x4a')]['id'])});}});}})[_0xcaca('0x29')](respondWithStatusCode(_0x3c1010,null))[_0xcaca('0x4c')](handleError(_0x3c1010,null));};exports[_0xcaca('0x79')]=function(_0x1bcaa1,_0x3daa2c,_0x252dfe){var _0x2d1bec={};var _0xe71cf9={};var _0x12f934;var _0x471049;return db[_0xcaca('0x31')][_0xcaca('0x56')]({'where':{'id':_0x1bcaa1[_0xcaca('0x4a')]['id']}})[_0xcaca('0x29')](handleEntityNotFound(_0x3daa2c,null))[_0xcaca('0x29')](function(_0x5a48eb){if(_0x5a48eb){_0x12f934=_0x5a48eb;_0xe71cf9['model']=_['keys'](db[_0xcaca('0x6a')][_0xcaca('0x32')]);_0xe71cf9[_0xcaca('0x36')]=_[_0xcaca('0x37')](_0x1bcaa1[_0xcaca('0x36')]);_0xe71cf9[_0xcaca('0x38')]=_[_0xcaca('0x39')](_0xe71cf9['model'],_0xe71cf9['query']);_0x2d1bec['attributes']=_[_0xcaca('0x39')](_0xe71cf9['model'],qs[_0xcaca('0x3c')](_0x1bcaa1[_0xcaca('0x36')][_0xcaca('0x3c')]));_0x2d1bec[_0xcaca('0x3b')]=_0x2d1bec[_0xcaca('0x3b')][_0xcaca('0x3d')]?_0x2d1bec[_0xcaca('0x3b')]:_0xe71cf9[_0xcaca('0x3a')];_0x2d1bec[_0xcaca('0x40')]=qs[_0xcaca('0x41')](_0x1bcaa1[_0xcaca('0x36')][_0xcaca('0x41')]);_0x2d1bec[_0xcaca('0x42')]=qs[_0xcaca('0x38')](_[_0xcaca('0x5f')](_0x1bcaa1['query'],_0xe71cf9[_0xcaca('0x38')]));if(_0x1bcaa1['query'][_0xcaca('0x43')]){_0x2d1bec[_0xcaca('0x42')]=_[_0xcaca('0x44')](_0x2d1bec[_0xcaca('0x42')],{'$or':_['map'](_0x2d1bec['attributes'],function(_0x303831){var _0x57f9d4={};_0x57f9d4[_0x303831]={'$like':'%'+_0x1bcaa1[_0xcaca('0x36')][_0xcaca('0x43')]+'%'};return _0x57f9d4;})});}_0x2d1bec=_[_0xcaca('0x44')]({},_0x2d1bec,_0x1bcaa1[_0xcaca('0x45')]);return _0x12f934[_0xcaca('0x79')](_0x2d1bec);}})['then'](function(_0x37083a){if(_0x37083a){_0x471049=_0x37083a[_0xcaca('0x3d')];if(!_0x1bcaa1['query'][_0xcaca('0x3e')](_0xcaca('0x3f'))){_0x2d1bec['limit']=qs['limit'](_0x1bcaa1[_0xcaca('0x36')]['limit']);_0x2d1bec['offset']=qs[_0xcaca('0x20')](_0x1bcaa1['query'][_0xcaca('0x20')]);}return _0x12f934[_0xcaca('0x79')](_0x2d1bec);}})[_0xcaca('0x29')](function(_0x2c2cb2){if(_0x2c2cb2){return _0x2c2cb2?{'count':_0x471049,'rows':_0x2c2cb2}:null;}})[_0xcaca('0x29')](respondWithResult(_0x3daa2c,null))[_0xcaca('0x4c')](handleError(_0x3daa2c,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index a20bb6f..48b42e1 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 _0x5c71=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x2af2fa,_0x3baaba){var _0x2917a4=function(_0x3cfe65){while(--_0x3cfe65){_0x2af2fa['push'](_0x2af2fa['shift']());}};_0x2917a4(++_0x3baaba);}(_0x5c71,0x197));var _0x15c7=function(_0x2190d1,_0x5f40fe){_0x2190d1=_0x2190d1-0x0;var _0x2c0e46=_0x5c71[_0x2190d1];return _0x2c0e46;};'use strict';var EventEmitter=require(_0x15c7('0x0'));var Team=require(_0x15c7('0x1'))['db'][_0x15c7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x15c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x15c7('0x4'),'afterDestroy':_0x15c7('0x5')};function emitEvent(_0x4b89f0){return function(_0x3a39a5,_0x16118d,_0x49d275){TeamEvents[_0x15c7('0x6')](_0x4b89f0+':'+_0x3a39a5['id'],_0x3a39a5);TeamEvents[_0x15c7('0x6')](_0x4b89f0,_0x3a39a5);_0x49d275(null);};}for(var e in events){if(events[_0x15c7('0x7')](e)){var event=events[e];Team[_0x15c7('0x8')](e,emitEvent(event));}}module[_0x15c7('0x9')]=TeamEvents; \ No newline at end of file +var _0x5ce9=['emit','hook','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x313df3,_0x4fca45){var _0x241d59=function(_0x452786){while(--_0x452786){_0x313df3['push'](_0x313df3['shift']());}};_0x241d59(++_0x4fca45);}(_0x5ce9,0x191));var _0x95ce=function(_0x13fdf3,_0x4bb8b2){_0x13fdf3=_0x13fdf3-0x0;var _0x3f7af7=_0x5ce9[_0x13fdf3];return _0x3f7af7;};'use strict';var EventEmitter=require(_0x95ce('0x0'));var Team=require(_0x95ce('0x1'))['db'][_0x95ce('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x95ce('0x3')](0x0);var events={'afterCreate':_0x95ce('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x121c96){return function(_0xb0abe4,_0x258b6b,_0x37e448){TeamEvents['emit'](_0x121c96+':'+_0xb0abe4['id'],_0xb0abe4);TeamEvents[_0x95ce('0x5')](_0x121c96,_0xb0abe4);_0x37e448(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x95ce('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c3dafcc..322f294 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 _0x7ccd=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Team','teams','lodash'];(function(_0x368c8f,_0x350044){var _0x7a27f1=function(_0x5745d8){while(--_0x5745d8){_0x368c8f['push'](_0x368c8f['shift']());}};_0x7a27f1(++_0x350044);}(_0x7ccd,0xa8));var _0xd7cc=function(_0x305b6d,_0x2d4b34){_0x305b6d=_0x305b6d-0x0;var _0x1a1af3=_0x7ccd[_0x305b6d];return _0x1a1af3;};'use strict';var _=require(_0xd7cc('0x0'));var util=require(_0xd7cc('0x1'));var logger=require(_0xd7cc('0x2'))('api');var moment=require(_0xd7cc('0x3'));var BPromise=require(_0xd7cc('0x4'));var rp=require(_0xd7cc('0x5'));var fs=require('fs');var path=require(_0xd7cc('0x6'));var rimraf=require(_0xd7cc('0x7'));var config=require(_0xd7cc('0x8'));var attributes=require('./team.attributes');module[_0xd7cc('0x9')]=function(_0x40da79,_0x276cf8){return _0x40da79[_0xd7cc('0xa')](_0xd7cc('0xb'),attributes,{'tableName':_0xd7cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd884=['exports','define','teams','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x385037,_0xa43f49){var _0x492564=function(_0x1b5dcd){while(--_0x1b5dcd){_0x385037['push'](_0x385037['shift']());}};_0x492564(++_0xa43f49);}(_0xd884,0x1f2));var _0x4d88=function(_0x3cdb0d,_0x1d6c58){_0x3cdb0d=_0x3cdb0d-0x0;var _0x151700=_0xd884[_0x3cdb0d];return _0x151700;};'use strict';var _=require('lodash');var util=require(_0x4d88('0x0'));var logger=require(_0x4d88('0x1'))(_0x4d88('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d88('0x4'));var config=require(_0x4d88('0x5'));var attributes=require('./team.attributes');module[_0x4d88('0x6')]=function(_0x15e934,_0x4fe02c){return _0x15e934[_0x4d88('0x7')]('Team',attributes,{'tableName':_0x4d88('0x8'),'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 b970370..fd3be52 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 _0xd959=['localhost','socket.io-emitter','./team.socket','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x53d255,_0x1671f7){var _0x1a2597=function(_0x303d07){while(--_0x303d07){_0x53d255['push'](_0x53d255['shift']());}};_0x1a2597(++_0x1671f7);}(_0xd959,0xec));var _0x9d95=function(_0x5c73ab,_0x122592){_0x5c73ab=_0x5c73ab-0x0;var _0x4831ca=_0xd959[_0x5c73ab];return _0x4831ca;};'use strict';var _=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var moment=require(_0x9d95('0x2'));var BPromise=require(_0x9d95('0x3'));var rs=require(_0x9d95('0x4'));var fs=require('fs');var Redis=require(_0x9d95('0x5'));var db=require(_0x9d95('0x6'))['db'];var utils=require(_0x9d95('0x7'));var logger=require(_0x9d95('0x8'))(_0x9d95('0x9'));var config=require(_0x9d95('0xa'));var jayson=require(_0x9d95('0xb'));var client=jayson[_0x9d95('0xc')][_0x9d95('0xd')]({'port':0x232a});config['redis']=_[_0x9d95('0xe')](config[_0x9d95('0xf')],{'host':_0x9d95('0x10'),'port':0x18eb});var socket=require(_0x9d95('0x11'))(new Redis(config[_0x9d95('0xf')]));require(_0x9d95('0x12'))['register'](socket);function respondWithRpcPromise(_0x517dbf,_0x5903d9,_0x3bcb6a){return new BPromise(function(_0x444cdd,_0x4c93eb){return client['request'](_0x517dbf,_0x3bcb6a)[_0x9d95('0x13')](function(_0x3614b7){logger[_0x9d95('0x14')](_0x9d95('0x15'),_0x5903d9,'request\x20sent');logger['debug'](_0x9d95('0x16'),_0x5903d9,'request\x20sent',JSON['stringify'](_0x3614b7));if(_0x3614b7[_0x9d95('0x17')]){if(_0x3614b7[_0x9d95('0x17')][_0x9d95('0x18')]===0x1f4){logger[_0x9d95('0x17')](_0x9d95('0x15'),_0x5903d9,_0x3614b7['error'][_0x9d95('0x19')]);return _0x4c93eb(_0x3614b7[_0x9d95('0x17')][_0x9d95('0x19')]);}logger['error'](_0x9d95('0x15'),_0x5903d9,_0x3614b7['error'][_0x9d95('0x19')]);return _0x444cdd(_0x3614b7[_0x9d95('0x17')]['message']);}else{logger[_0x9d95('0x14')](_0x9d95('0x15'),_0x5903d9,'request\x20sent');_0x444cdd(_0x3614b7[_0x9d95('0x1a')][_0x9d95('0x19')]);}})[_0x9d95('0x1b')](function(_0x566746){logger[_0x9d95('0x17')](_0x9d95('0x15'),_0x5903d9,_0x566746);_0x4c93eb(_0x566746);});});} \ No newline at end of file +var _0x1497=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','lodash','util'];(function(_0xb3e7fc,_0x3ebb02){var _0x277e5e=function(_0x59df61){while(--_0x59df61){_0xb3e7fc['push'](_0xb3e7fc['shift']());}};_0x277e5e(++_0x3ebb02);}(_0x1497,0xfa));var _0x7149=function(_0x2d7cad,_0x2e3e35){_0x2d7cad=_0x2d7cad-0x0;var _0x1a9af2=_0x1497[_0x2d7cad];return _0x1a9af2;};'use strict';var _=require(_0x7149('0x0'));var util=require(_0x7149('0x1'));var moment=require(_0x7149('0x2'));var BPromise=require(_0x7149('0x3'));var rs=require(_0x7149('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7149('0x5'))['db'];var utils=require(_0x7149('0x6'));var logger=require('../../config/logger')(_0x7149('0x7'));var config=require(_0x7149('0x8'));var jayson=require(_0x7149('0x9'));var client=jayson[_0x7149('0xa')][_0x7149('0xb')]({'port':0x232a});config[_0x7149('0xc')]=_[_0x7149('0xd')](config['redis'],{'host':_0x7149('0xe'),'port':0x18eb});var socket=require(_0x7149('0xf'))(new Redis(config[_0x7149('0xc')]));require(_0x7149('0x10'))[_0x7149('0x11')](socket);function respondWithRpcPromise(_0x2d6ecf,_0x57b936,_0x3580fa){return new BPromise(function(_0x3b5059,_0x34f0e0){return client[_0x7149('0x12')](_0x2d6ecf,_0x3580fa)[_0x7149('0x13')](function(_0x3d40da){logger['info'](_0x7149('0x14'),_0x57b936,'request\x20sent');logger[_0x7149('0x15')](_0x7149('0x16'),_0x57b936,_0x7149('0x17'),JSON['stringify'](_0x3d40da));if(_0x3d40da['error']){if(_0x3d40da[_0x7149('0x18')][_0x7149('0x19')]===0x1f4){logger['error'](_0x7149('0x14'),_0x57b936,_0x3d40da[_0x7149('0x18')][_0x7149('0x1a')]);return _0x34f0e0(_0x3d40da[_0x7149('0x18')][_0x7149('0x1a')]);}logger['error'](_0x7149('0x14'),_0x57b936,_0x3d40da[_0x7149('0x18')][_0x7149('0x1a')]);return _0x3b5059(_0x3d40da[_0x7149('0x18')][_0x7149('0x1a')]);}else{logger[_0x7149('0x1b')]('Team,\x20%s,\x20%s',_0x57b936,_0x7149('0x17'));_0x3b5059(_0x3d40da['result'][_0x7149('0x1a')]);}})['catch'](function(_0x383cab){logger[_0x7149('0x18')](_0x7149('0x14'),_0x57b936,_0x383cab);_0x34f0e0(_0x383cab);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3ad9b10..970ae70 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 _0x2ef3=['update','emit','removeListener','register','length','team:','./team.events','save','remove'];(function(_0x42ec66,_0x4df630){var _0xaf1f9a=function(_0x3640c8){while(--_0x3640c8){_0x42ec66['push'](_0x42ec66['shift']());}};_0xaf1f9a(++_0x4df630);}(_0x2ef3,0xba));var _0x32ef=function(_0x163159,_0x17045c){_0x163159=_0x163159-0x0;var _0x2c7c79=_0x2ef3[_0x163159];return _0x2c7c79;};'use strict';var TeamEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){TeamEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);TeamEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x81d4=['remove','removeListener','register','length','team:','save'];(function(_0x536696,_0x5e2859){var _0x2c3bea=function(_0x318894){while(--_0x318894){_0x536696['push'](_0x536696['shift']());}};_0x2c3bea(++_0x5e2859);}(_0x81d4,0x197));var _0x481d=function(_0x555767,_0x296db3){_0x555767=_0x555767-0x0;var _0x44b1af=_0x81d4[_0x555767];return _0x44b1af;};'use strict';var TeamEvents=require('./team.events');var events=[_0x481d('0x0'),_0x481d('0x1'),'update'];function createListener(_0xf5135,_0x369cf6){return function(_0x266766){_0x369cf6['emit'](_0xf5135,_0x266766);};}function removeListener(_0x5af777,_0x37813e){return function(){TeamEvents[_0x481d('0x2')](_0x5af777,_0x37813e);};}exports[_0x481d('0x3')]=function(_0x5c0761){for(var _0x1ef8ca=0x0,_0x17d32a=events[_0x481d('0x4')];_0x1ef8ca<_0x17d32a;_0x1ef8ca++){var _0x271b33=events[_0x1ef8ca];var _0x1d9263=createListener(_0x481d('0x5')+_0x271b33,_0x5c0761);TeamEvents['on'](_0x271b33,_0x1d9263);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3cc6b7c..ae2a410 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 _0x3a03=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x167fa4,_0x22aaff){var _0x103075=function(_0x551aa0){while(--_0x551aa0){_0x167fa4['push'](_0x167fa4['shift']());}};_0x103075(++_0x22aaff);}(_0x3a03,0x16a));var _0x33a0=function(_0xdd9a3b,_0x27b48f){_0xdd9a3b=_0xdd9a3b-0x0;var _0xf79807=_0x3a03[_0xdd9a3b];return _0xf79807;};'use strict';var multer=require(_0x33a0('0x0'));var util=require(_0x33a0('0x1'));var path=require('path');var timeout=require(_0x33a0('0x2'));var express=require(_0x33a0('0x3'));var router=express[_0x33a0('0x4')]();var auth=require(_0x33a0('0x5'));var interaction=require(_0x33a0('0x6'));var config=require(_0x33a0('0x7'));var controller=require(_0x33a0('0x8'));router[_0x33a0('0x9')]('/',auth[_0x33a0('0xa')](),controller[_0x33a0('0xb')]);router[_0x33a0('0x9')](_0x33a0('0xc'),auth[_0x33a0('0xa')](),controller['show']);router[_0x33a0('0xd')]('/',auth['isAuthenticated'](),controller[_0x33a0('0xe')]);router[_0x33a0('0xf')](_0x33a0('0xc'),auth[_0x33a0('0xa')](),controller[_0x33a0('0x10')]);router[_0x33a0('0x11')](_0x33a0('0xc'),auth[_0x33a0('0xa')](),controller[_0x33a0('0x12')]);module[_0x33a0('0x13')]=router; \ No newline at end of file +var _0x4148=['path','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x3103f5,_0x2bc534){var _0x424853=function(_0x53a56e){while(--_0x53a56e){_0x3103f5['push'](_0x3103f5['shift']());}};_0x424853(++_0x2bc534);}(_0x4148,0x10e));var _0x8414=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0x4148[_0x414ff1];return _0x29c53f;};'use strict';var multer=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var path=require(_0x8414('0x2'));var timeout=require('connect-timeout');var express=require(_0x8414('0x3'));var router=express[_0x8414('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8414('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x8414('0x6')]('/',auth['isAuthenticated'](),controller[_0x8414('0x7')]);router[_0x8414('0x6')](_0x8414('0x8'),auth[_0x8414('0x9')](),controller[_0x8414('0xa')]);router[_0x8414('0xb')]('/',auth[_0x8414('0x9')](),controller['create']);router[_0x8414('0xc')](_0x8414('0x8'),auth[_0x8414('0x9')](),controller[_0x8414('0xd')]);router[_0x8414('0xe')](_0x8414('0x8'),auth[_0x8414('0x9')](),controller[_0x8414('0xf')]);module[_0x8414('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 c72842f..a4a66be 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 _0x7f90=['sequelize','STRING'];(function(_0x866865,_0x3f0cea){var _0x440e6b=function(_0x2d1cfb){while(--_0x2d1cfb){_0x866865['push'](_0x866865['shift']());}};_0x440e6b(++_0x3f0cea);}(_0x7f90,0x178));var _0x07f9=function(_0x585219,_0x23ba0b){_0x585219=_0x585219-0x0;var _0x32c6fe=_0x7f90[_0x585219];return _0x32c6fe;};'use strict';var Sequelize=require(_0x07f9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x07f9('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9e4e=['sequelize','exports','STRING'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x9e4e,0x17d));var _0xe9e4=function(_0x16ad4b,_0xf0c366){_0x16ad4b=_0x16ad4b-0x0;var _0x180b17=_0x9e4e[_0x16ad4b];return _0x180b17;};'use strict';var Sequelize=require(_0xe9e4('0x0'));module[_0xe9e4('0x1')]={'name':{'type':Sequelize[_0xe9e4('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 348e234..9adeffc 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 _0x3d4b=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','json','apply','reject','save','destroy','get','Templates','then','sendStatus','error','name','send','map','Template','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','filtears','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x27a28d,_0x1b546d){var _0x282be6=function(_0x433978){while(--_0x433978){_0x27a28d['push'](_0x27a28d['shift']());}};_0x282be6(++_0x1b546d);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x485777,_0x2b7406){_0x485777=_0x485777-0x0;var _0x53bb38=_0x3d4b[_0x485777];return _0x53bb38;};'use strict';var pdf=require(_0xb3d4('0x0'));var emlformat=require(_0xb3d4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb3d4('0x2'));var jsonpatch=require(_0xb3d4('0x3'));var rp=require(_0xb3d4('0x4'));var moment=require('moment');var BPromise=require(_0xb3d4('0x5'));var Mustache=require(_0xb3d4('0x6'));var util=require(_0xb3d4('0x7'));var path=require(_0xb3d4('0x8'));var sox=require(_0xb3d4('0x9'));var csv=require(_0xb3d4('0xa'));var ejs=require(_0xb3d4('0xb'));var fs=require('fs');var _=require(_0xb3d4('0xc'));var squel=require(_0xb3d4('0xd'));var crypto=require(_0xb3d4('0xe'));var jsforce=require(_0xb3d4('0xf'));var deskjs=require(_0xb3d4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb3d4('0x11'));var Redis=require(_0xb3d4('0x12'));var authService=require(_0xb3d4('0x13'));var qs=require(_0xb3d4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3d4('0x15'));var logger=require(_0xb3d4('0x16'))(_0xb3d4('0x17'));var utils=require(_0xb3d4('0x18'));var config=require(_0xb3d4('0x19'));var licenseUtil=require(_0xb3d4('0x1a'));var db=require(_0xb3d4('0x1b'))['db'];function respondWithStatusCode(_0x211b10,_0x199f95){_0x199f95=_0x199f95||0xcc;return function(_0x49c596){if(_0x49c596){return _0x211b10['sendStatus'](_0x199f95);}return _0x211b10[_0xb3d4('0x1c')](_0x199f95)[_0xb3d4('0x1d')]();};}function respondWithResult(_0x193434,_0x59c9bf){_0x59c9bf=_0x59c9bf||0xc8;return function(_0x30bc93){if(_0x30bc93){return _0x193434[_0xb3d4('0x1c')](_0x59c9bf)['json'](_0x30bc93);}};}function respondWithFilteredResult(_0x252bd8,_0x36d2d3){return function(_0x494847){if(_0x494847){var _0x2d0dd4=_0x494847['count'],_0x485f59=_0x36d2d3[_0xb3d4('0x1e')],_0x4ddf7f=_0x36d2d3[_0xb3d4('0x1e')]+_0x36d2d3[_0xb3d4('0x1f')],_0x539d5;if(_0x4ddf7f>=_0x2d0dd4){_0x4ddf7f=_0x2d0dd4;_0x539d5=0xc8;}else{_0x539d5=0xce;}_0x252bd8[_0xb3d4('0x1c')](_0x539d5);return _0x252bd8[_0xb3d4('0x20')]('Content-Range',_0x485f59+'-'+_0x4ddf7f+'/'+_0x2d0dd4)[_0xb3d4('0x21')](_0x494847);}return null;};}function patchUpdates(_0x1cbe0c){return function(_0x373041){try{jsonpatch[_0xb3d4('0x22')](_0x373041,_0x1cbe0c,!![]);}catch(_0x1f4823){return BPromise[_0xb3d4('0x23')](_0x1f4823);}return _0x373041[_0xb3d4('0x24')]();};}function saveUpdates(_0x4ceff6,_0x43a8f6){return function(_0x398057){if(_0x398057){return _0x398057['update'](_0x4ceff6)['then'](function(_0x5d62b9){return _0x5d62b9;});}return null;};}function removeEntity(_0x22eeb1,_0x42caac){return function(_0x7b8413){if(_0x7b8413){return _0x7b8413[_0xb3d4('0x25')]()['then'](function(){var _0x4b10fa=_0x7b8413[_0xb3d4('0x26')]({'plain':!![]});var _0x51c3a9=_0xb3d4('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x51c3a9,'resourceId':_0x4b10fa['id']}})[_0xb3d4('0x28')](function(){return _0x7b8413;});})[_0xb3d4('0x28')](function(){_0x22eeb1[_0xb3d4('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249636,_0x5009d3){return function(_0x56fa52){if(!_0x56fa52){_0x249636[_0xb3d4('0x29')](0x194);}return _0x56fa52;};}function handleError(_0x5482a4,_0x4455d7){_0x4455d7=_0x4455d7||0x1f4;return function(_0x3db429){logger[_0xb3d4('0x2a')](_0x3db429['stack']);if(_0x3db429['name']){delete _0x3db429[_0xb3d4('0x2b')];}_0x5482a4[_0xb3d4('0x1c')](_0x4455d7)[_0xb3d4('0x2c')](_0x3db429);};}exports['index']=function(_0x53b592,_0x4921c1){var _0x11e4cc={},_0x240cda={},_0x3ff8b7={'count':0x0,'rows':[]};var _0x48bf8c=_[_0xb3d4('0x2d')](db[_0xb3d4('0x2e')][_0xb3d4('0x2f')],function(_0x5a3fe7){return{'name':_0x5a3fe7[_0xb3d4('0x30')],'type':_0x5a3fe7[_0xb3d4('0x31')]['key']};});_0x240cda[_0xb3d4('0x32')]=_['map'](_0x48bf8c,'name');_0x240cda[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0x53b592[_0xb3d4('0x33')]);_0x240cda[_0xb3d4('0x35')]=_[_0xb3d4('0x36')](_0x240cda[_0xb3d4('0x32')],_0x240cda[_0xb3d4('0x33')]);_0x11e4cc[_0xb3d4('0x37')]=_[_0xb3d4('0x36')](_0x240cda['model'],qs[_0xb3d4('0x38')](_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x38')]));_0x11e4cc['attributes']=_0x11e4cc[_0xb3d4('0x37')]['length']?_0x11e4cc['attributes']:_0x240cda['model'];if(!_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x39')]('nolimit')){_0x11e4cc[_0xb3d4('0x1f')]=qs['limit'](_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x1f')]);_0x11e4cc['offset']=qs[_0xb3d4('0x1e')](_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x1e')]);}_0x11e4cc[_0xb3d4('0x3a')]=qs['sort'](_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x3b')]);_0x11e4cc[_0xb3d4('0x3c')]=qs[_0xb3d4('0x35')](_[_0xb3d4('0x3d')](_0x53b592[_0xb3d4('0x33')],_0x240cda[_0xb3d4('0x35')]),_0x48bf8c);if(_0x53b592['query']['filter']){_0x11e4cc[_0xb3d4('0x3c')]=_['merge'](_0x11e4cc[_0xb3d4('0x3c')],{'$or':_[_0xb3d4('0x2d')](_0x48bf8c,function(_0x5e5b95){if(_0x5e5b95[_0xb3d4('0x31')]!==_0xb3d4('0x3e')){var _0x585388={};_0x585388[_0x5e5b95[_0xb3d4('0x2b')]]={'$like':'%'+_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x3f')]+'%'};return _0x585388;}})});}_0x11e4cc=_['merge']({},_0x11e4cc,_0x53b592[_0xb3d4('0x40')]);var _0x44c267={'where':_0x11e4cc[_0xb3d4('0x3c')]};return db['Template'][_0xb3d4('0x41')](_0x44c267)['then'](function(_0x34ffe1){_0x3ff8b7[_0xb3d4('0x41')]=_0x34ffe1;if(_0x53b592[_0xb3d4('0x33')][_0xb3d4('0x42')]){_0x11e4cc[_0xb3d4('0x43')]=[{'all':!![]}];}return db['Template'][_0xb3d4('0x44')](_0x11e4cc);})[_0xb3d4('0x28')](function(_0x303587){_0x3ff8b7['rows']=_0x303587;return _0x3ff8b7;})['then'](respondWithFilteredResult(_0x4921c1,_0x11e4cc))[_0xb3d4('0x45')](handleError(_0x4921c1,null));};exports[_0xb3d4('0x46')]=function(_0xe02641,_0x36b77a){var _0x21e09e={'raw':!![],'where':{'id':_0xe02641['params']['id']}},_0x1087ab={};_0x1087ab[_0xb3d4('0x32')]=_['keys'](db[_0xb3d4('0x2e')][_0xb3d4('0x2f')]);_0x1087ab[_0xb3d4('0x33')]=_[_0xb3d4('0x34')](_0xe02641[_0xb3d4('0x33')]);_0x1087ab[_0xb3d4('0x47')]=_[_0xb3d4('0x36')](_0x1087ab[_0xb3d4('0x32')],_0x1087ab[_0xb3d4('0x33')]);_0x21e09e[_0xb3d4('0x37')]=_[_0xb3d4('0x36')](_0x1087ab[_0xb3d4('0x32')],qs[_0xb3d4('0x38')](_0xe02641[_0xb3d4('0x33')][_0xb3d4('0x38')]));_0x21e09e['attributes']=_0x21e09e['attributes']['length']?_0x21e09e[_0xb3d4('0x37')]:_0x1087ab[_0xb3d4('0x32')];if(_0xe02641[_0xb3d4('0x33')]['includeAll']){_0x21e09e[_0xb3d4('0x43')]=[{'all':!![]}];}_0x21e09e=_[_0xb3d4('0x48')]({},_0x21e09e,_0xe02641['options']);return db[_0xb3d4('0x2e')]['find'](_0x21e09e)[_0xb3d4('0x28')](handleEntityNotFound(_0x36b77a,null))[_0xb3d4('0x28')](respondWithResult(_0x36b77a,null))['catch'](handleError(_0x36b77a,null));};exports[_0xb3d4('0x49')]=function(_0xce4362,_0xfa192c){return db['Template'][_0xb3d4('0x49')](_0xce4362[_0xb3d4('0x4a')],{})[_0xb3d4('0x28')](function(_0x2b4a16){var _0x2490d2=_0xce4362[_0xb3d4('0x4b')][_0xb3d4('0x26')]({'plain':!![]});if(!_0x2490d2)throw new Error(_0xb3d4('0x4c'));if(_0x2490d2[_0xb3d4('0x4d')]==='user'){var _0x48077c=_0x2b4a16['get']({'plain':!![]});var _0x26122b=_0xb3d4('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x26122b,'userProfileId':_0x2490d2[_0xb3d4('0x4e')]},'raw':!![]})[_0xb3d4('0x28')](function(_0x5956b0){if(_0x5956b0&&_0x5956b0['autoAssociation']===0x0){return db[_0xb3d4('0x4f')][_0xb3d4('0x49')]({'name':_0x48077c['name'],'resourceId':_0x48077c['id'],'type':_0x5956b0['name'],'sectionId':_0x5956b0['id']},{})['then'](function(){return _0x2b4a16;});}else{return _0x2b4a16;}})[_0xb3d4('0x45')](function(_0x4533d9){logger['error'](_0xb3d4('0x50'),_0x4533d9);throw _0x4533d9;});}return _0x2b4a16;})[_0xb3d4('0x28')](respondWithResult(_0xfa192c,0xc9))['catch'](handleError(_0xfa192c,null));};exports[_0xb3d4('0x51')]=function(_0x2742f2,_0x2bffc4){if(_0x2742f2[_0xb3d4('0x4a')]['id']){delete _0x2742f2[_0xb3d4('0x4a')]['id'];}return db[_0xb3d4('0x2e')][_0xb3d4('0x52')]({'where':{'id':_0x2742f2['params']['id']}})[_0xb3d4('0x28')](handleEntityNotFound(_0x2bffc4,null))['then'](saveUpdates(_0x2742f2['body'],null))[_0xb3d4('0x28')](respondWithResult(_0x2bffc4,null))['catch'](handleError(_0x2bffc4,null));};exports[_0xb3d4('0x25')]=function(_0x23e320,_0x3c5847){return db[_0xb3d4('0x2e')][_0xb3d4('0x52')]({'where':{'id':_0x23e320['params']['id']}})[_0xb3d4('0x28')](handleEntityNotFound(_0x3c5847,null))[_0xb3d4('0x28')](removeEntity(_0x3c5847,null))[_0xb3d4('0x45')](handleError(_0x3c5847,null));}; \ No newline at end of file +var _0x7923=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Templates','stack','name','map','Template','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll','rows','catch','params','keys','filtears','fields','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','lodash','squel','desk.js','to-csv','papaparse'];(function(_0x28be72,_0x2b83af){var _0x46c5da=function(_0x312911){while(--_0x312911){_0x28be72['push'](_0x28be72['shift']());}};_0x46c5da(++_0x2b83af);}(_0x7923,0x8f));var _0x3792=function(_0x48a0fc,_0x70cd50){_0x48a0fc=_0x48a0fc-0x0;var _0x18cefb=_0x7923[_0x48a0fc];return _0x18cefb;};'use strict';var pdf=require(_0x3792('0x0'));var emlformat=require(_0x3792('0x1'));var rimraf=require(_0x3792('0x2'));var zipdir=require(_0x3792('0x3'));var jsonpatch=require(_0x3792('0x4'));var rp=require(_0x3792('0x5'));var moment=require(_0x3792('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3792('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3792('0x8'));var csv=require('to-csv');var ejs=require(_0x3792('0x9'));var fs=require('fs');var _=require(_0x3792('0xa'));var squel=require(_0x3792('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3792('0xc'));var toCsv=require(_0x3792('0xd'));var querystring=require('querystring');var Papa=require(_0x3792('0xe'));var Redis=require(_0x3792('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3792('0x10'));var as=require(_0x3792('0x11'));var hardwareService=require(_0x3792('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3792('0x13'));var config=require(_0x3792('0x14'));var licenseUtil=require(_0x3792('0x15'));var db=require(_0x3792('0x16'))['db'];function respondWithStatusCode(_0x5a6d8e,_0x506ec4){_0x506ec4=_0x506ec4||0xcc;return function(_0x3fed73){if(_0x3fed73){return _0x5a6d8e[_0x3792('0x17')](_0x506ec4);}return _0x5a6d8e[_0x3792('0x18')](_0x506ec4)[_0x3792('0x19')]();};}function respondWithResult(_0x10913e,_0x2b86ce){_0x2b86ce=_0x2b86ce||0xc8;return function(_0x41139d){if(_0x41139d){return _0x10913e[_0x3792('0x18')](_0x2b86ce)[_0x3792('0x1a')](_0x41139d);}};}function respondWithFilteredResult(_0x11910c,_0x427b53){return function(_0x183c42){if(_0x183c42){var _0x4247cd=_0x183c42[_0x3792('0x1b')],_0x26a4ba=_0x427b53['offset'],_0x46653b=_0x427b53[_0x3792('0x1c')]+_0x427b53[_0x3792('0x1d')],_0x683ede;if(_0x46653b>=_0x4247cd){_0x46653b=_0x4247cd;_0x683ede=0xc8;}else{_0x683ede=0xce;}_0x11910c[_0x3792('0x18')](_0x683ede);return _0x11910c[_0x3792('0x1e')](_0x3792('0x1f'),_0x26a4ba+'-'+_0x46653b+'/'+_0x4247cd)['json'](_0x183c42);}return null;};}function patchUpdates(_0x350f32){return function(_0xc75467){try{jsonpatch[_0x3792('0x20')](_0xc75467,_0x350f32,!![]);}catch(_0x3c36b5){return BPromise[_0x3792('0x21')](_0x3c36b5);}return _0xc75467['save']();};}function saveUpdates(_0x4cd50b,_0x2c1f8a){return function(_0x1bcd32){if(_0x1bcd32){return _0x1bcd32[_0x3792('0x22')](_0x4cd50b)[_0x3792('0x23')](function(_0x17277b){return _0x17277b;});}return null;};}function removeEntity(_0x386b88,_0x5c2c70){return function(_0x4ca818){if(_0x4ca818){return _0x4ca818[_0x3792('0x24')]()[_0x3792('0x23')](function(){var _0x3fa77a=_0x4ca818[_0x3792('0x25')]({'plain':!![]});var _0x54d99b=_0x3792('0x26');return db['UserProfileResource'][_0x3792('0x24')]({'where':{'type':_0x54d99b,'resourceId':_0x3fa77a['id']}})[_0x3792('0x23')](function(){return _0x4ca818;});})['then'](function(){_0x386b88['status'](0xcc)[_0x3792('0x19')]();});}};}function handleEntityNotFound(_0x2328fe,_0x401080){return function(_0x516929){if(!_0x516929){_0x2328fe['sendStatus'](0x194);}return _0x516929;};}function handleError(_0x44499b,_0xd53563){_0xd53563=_0xd53563||0x1f4;return function(_0x53369e){logger['error'](_0x53369e[_0x3792('0x27')]);if(_0x53369e[_0x3792('0x28')]){delete _0x53369e[_0x3792('0x28')];}_0x44499b[_0x3792('0x18')](_0xd53563)['send'](_0x53369e);};}exports['index']=function(_0x3d2091,_0xcc56d5){var _0x3b9b67={},_0x2d3131={},_0x3b0677={'count':0x0,'rows':[]};var _0x44e286=_[_0x3792('0x29')](db[_0x3792('0x2a')][_0x3792('0x2b')],function(_0x4b2ba4){return{'name':_0x4b2ba4[_0x3792('0x2c')],'type':_0x4b2ba4[_0x3792('0x2d')][_0x3792('0x2e')]};});_0x2d3131[_0x3792('0x2f')]=_[_0x3792('0x29')](_0x44e286,'name');_0x2d3131['query']=_['keys'](_0x3d2091[_0x3792('0x30')]);_0x2d3131['filters']=_[_0x3792('0x31')](_0x2d3131['model'],_0x2d3131[_0x3792('0x30')]);_0x3b9b67[_0x3792('0x32')]=_[_0x3792('0x31')](_0x2d3131[_0x3792('0x2f')],qs['fields'](_0x3d2091[_0x3792('0x30')]['fields']));_0x3b9b67['attributes']=_0x3b9b67[_0x3792('0x32')][_0x3792('0x33')]?_0x3b9b67[_0x3792('0x32')]:_0x2d3131[_0x3792('0x2f')];if(!_0x3d2091['query']['hasOwnProperty'](_0x3792('0x34'))){_0x3b9b67[_0x3792('0x1d')]=qs[_0x3792('0x1d')](_0x3d2091[_0x3792('0x30')][_0x3792('0x1d')]);_0x3b9b67[_0x3792('0x1c')]=qs['offset'](_0x3d2091[_0x3792('0x30')][_0x3792('0x1c')]);}_0x3b9b67[_0x3792('0x35')]=qs[_0x3792('0x36')](_0x3d2091[_0x3792('0x30')][_0x3792('0x36')]);_0x3b9b67[_0x3792('0x37')]=qs[_0x3792('0x38')](_['pick'](_0x3d2091['query'],_0x2d3131['filters']),_0x44e286);if(_0x3d2091[_0x3792('0x30')][_0x3792('0x39')]){_0x3b9b67[_0x3792('0x37')]=_['merge'](_0x3b9b67['where'],{'$or':_[_0x3792('0x29')](_0x44e286,function(_0x151523){if(_0x151523['type']!==_0x3792('0x3a')){var _0x2e17fe={};_0x2e17fe[_0x151523[_0x3792('0x28')]]={'$like':'%'+_0x3d2091['query'][_0x3792('0x39')]+'%'};return _0x2e17fe;}})});}_0x3b9b67=_['merge']({},_0x3b9b67,_0x3d2091[_0x3792('0x3b')]);var _0x12542f={'where':_0x3b9b67[_0x3792('0x37')]};return db['Template'][_0x3792('0x1b')](_0x12542f)[_0x3792('0x23')](function(_0x16989c){_0x3b0677[_0x3792('0x1b')]=_0x16989c;if(_0x3d2091[_0x3792('0x30')]['includeAll']){_0x3b9b67[_0x3792('0x3c')]=[{'all':!![]}];}return db[_0x3792('0x2a')][_0x3792('0x3d')](_0x3b9b67);})[_0x3792('0x23')](function(_0x5692bb){_0x3b0677[_0x3792('0x3e')]=_0x5692bb;return _0x3b0677;})[_0x3792('0x23')](respondWithFilteredResult(_0xcc56d5,_0x3b9b67))[_0x3792('0x3f')](handleError(_0xcc56d5,null));};exports['show']=function(_0xaf6c79,_0x32f9a7){var _0x4651e3={'raw':!![],'where':{'id':_0xaf6c79[_0x3792('0x40')]['id']}},_0x20bc62={};_0x20bc62[_0x3792('0x2f')]=_[_0x3792('0x41')](db[_0x3792('0x2a')][_0x3792('0x2b')]);_0x20bc62[_0x3792('0x30')]=_[_0x3792('0x41')](_0xaf6c79[_0x3792('0x30')]);_0x20bc62[_0x3792('0x42')]=_[_0x3792('0x31')](_0x20bc62[_0x3792('0x2f')],_0x20bc62[_0x3792('0x30')]);_0x4651e3[_0x3792('0x32')]=_[_0x3792('0x31')](_0x20bc62[_0x3792('0x2f')],qs[_0x3792('0x43')](_0xaf6c79[_0x3792('0x30')][_0x3792('0x43')]));_0x4651e3['attributes']=_0x4651e3[_0x3792('0x32')]['length']?_0x4651e3[_0x3792('0x32')]:_0x20bc62[_0x3792('0x2f')];if(_0xaf6c79[_0x3792('0x30')]['includeAll']){_0x4651e3[_0x3792('0x3c')]=[{'all':!![]}];}_0x4651e3=_[_0x3792('0x44')]({},_0x4651e3,_0xaf6c79['options']);return db[_0x3792('0x2a')][_0x3792('0x45')](_0x4651e3)[_0x3792('0x23')](handleEntityNotFound(_0x32f9a7,null))[_0x3792('0x23')](respondWithResult(_0x32f9a7,null))[_0x3792('0x3f')](handleError(_0x32f9a7,null));};exports[_0x3792('0x46')]=function(_0x1268f7,_0x70e5b7){return db[_0x3792('0x2a')][_0x3792('0x46')](_0x1268f7[_0x3792('0x47')],{})[_0x3792('0x23')](function(_0x37e5fc){var _0x246143=_0x1268f7[_0x3792('0x48')][_0x3792('0x25')]({'plain':!![]});if(!_0x246143)throw new Error(_0x3792('0x49'));if(_0x246143[_0x3792('0x4a')]===_0x3792('0x48')){var _0x414a3e=_0x37e5fc[_0x3792('0x25')]({'plain':!![]});var _0xf5a32=_0x3792('0x26');return db[_0x3792('0x4b')][_0x3792('0x45')]({'where':{'name':_0xf5a32,'userProfileId':_0x246143['userProfileId']},'raw':!![]})['then'](function(_0x4e23b9){if(_0x4e23b9&&_0x4e23b9[_0x3792('0x4c')]===0x0){return db[_0x3792('0x4d')][_0x3792('0x46')]({'name':_0x414a3e['name'],'resourceId':_0x414a3e['id'],'type':_0x4e23b9[_0x3792('0x28')],'sectionId':_0x4e23b9['id']},{})[_0x3792('0x23')](function(){return _0x37e5fc;});}else{return _0x37e5fc;}})[_0x3792('0x3f')](function(_0x1da217){logger[_0x3792('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1da217);throw _0x1da217;});}return _0x37e5fc;})[_0x3792('0x23')](respondWithResult(_0x70e5b7,0xc9))[_0x3792('0x3f')](handleError(_0x70e5b7,null));};exports[_0x3792('0x22')]=function(_0xd42fc4,_0x551c33){if(_0xd42fc4[_0x3792('0x47')]['id']){delete _0xd42fc4[_0x3792('0x47')]['id'];}return db[_0x3792('0x2a')][_0x3792('0x45')]({'where':{'id':_0xd42fc4['params']['id']}})['then'](handleEntityNotFound(_0x551c33,null))['then'](saveUpdates(_0xd42fc4[_0x3792('0x47')],null))['then'](respondWithResult(_0x551c33,null))[_0x3792('0x3f')](handleError(_0x551c33,null));};exports['destroy']=function(_0x577faa,_0x4c6ad2){return db['Template'][_0x3792('0x45')]({'where':{'id':_0x577faa[_0x3792('0x40')]['id']}})[_0x3792('0x23')](handleEntityNotFound(_0x4c6ad2,null))['then'](removeEntity(_0x4c6ad2,null))[_0x3792('0x3f')](handleError(_0x4c6ad2,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2ee0490..e4e58ab 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 _0x5c71=['lodash','util','../../config/logger','moment','../../config/environment','./template.attributes','define','Template'];(function(_0x287468,_0x47585b){var _0x9309b8=function(_0x4e64ab){while(--_0x4e64ab){_0x287468['push'](_0x287468['shift']());}};_0x9309b8(++_0x47585b);}(_0x5c71,0x68));var _0x15c7=function(_0x5e1158,_0x5d520c){_0x5e1158=_0x5e1158-0x0;var _0x437f1b=_0x5c71[_0x5e1158];return _0x437f1b;};'use strict';var _=require(_0x15c7('0x0'));var util=require(_0x15c7('0x1'));var logger=require(_0x15c7('0x2'))('api');var moment=require(_0x15c7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x15c7('0x4'));var attributes=require(_0x15c7('0x5'));module['exports']=function(_0x32f6ef,_0x41d73c){return _0x32f6ef[_0x15c7('0x6')](_0x15c7('0x7'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed97=['tools_templates','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template'];(function(_0x46d955,_0x16cbc1){var _0x142c12=function(_0x2cf073){while(--_0x2cf073){_0x46d955['push'](_0x46d955['shift']());}};_0x142c12(++_0x16cbc1);}(_0xed97,0x12d));var _0x7ed9=function(_0x452b2b,_0x2cf856){_0x452b2b=_0x452b2b-0x0;var _0x565ce9=_0xed97[_0x452b2b];return _0x565ce9;};'use strict';var _=require(_0x7ed9('0x0'));var util=require('util');var logger=require(_0x7ed9('0x1'))(_0x7ed9('0x2'));var moment=require('moment');var BPromise=require(_0x7ed9('0x3'));var rp=require(_0x7ed9('0x4'));var fs=require('fs');var path=require(_0x7ed9('0x5'));var rimraf=require(_0x7ed9('0x6'));var config=require(_0x7ed9('0x7'));var attributes=require('./template.attributes');module[_0x7ed9('0x8')]=function(_0x4966ca,_0xd88a6e){return _0x4966ca[_0x7ed9('0x9')](_0x7ed9('0xa'),attributes,{'tableName':_0x7ed9('0xb'),'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 a707684..78d843c 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 _0x9da0=['stringify','error','code','Template,\x20%s,\x20%s','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','include','model','map','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0xb86784,_0xd28a6d){var _0x259527=function(_0x4607af){while(--_0x4607af){_0xb86784['push'](_0xb86784['shift']());}};_0x259527(++_0xd28a6d);}(_0x9da0,0x9a));var _0x09da=function(_0xd4acca,_0x57487e){_0xd4acca=_0xd4acca-0x0;var _0x5ac22b=_0x9da0[_0xd4acca];return _0x5ac22b;};'use strict';var _=require(_0x09da('0x0'));var util=require('util');var moment=require(_0x09da('0x1'));var BPromise=require(_0x09da('0x2'));var rs=require(_0x09da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09da('0x4'))['db'];var utils=require(_0x09da('0x5'));var logger=require(_0x09da('0x6'))(_0x09da('0x7'));var config=require(_0x09da('0x8'));var jayson=require(_0x09da('0x9'));var client=jayson[_0x09da('0xa')][_0x09da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57d4e8,_0x273787,_0x50fd19){return new BPromise(function(_0x5f593f,_0x457f1d){return client[_0x09da('0xc')](_0x57d4e8,_0x50fd19)[_0x09da('0xd')](function(_0x3b7552){logger[_0x09da('0xe')]('Template,\x20%s,\x20%s',_0x273787,_0x09da('0xf'));logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x273787,_0x09da('0xf'),JSON[_0x09da('0x10')](_0x3b7552));if(_0x3b7552[_0x09da('0x11')]){if(_0x3b7552[_0x09da('0x11')][_0x09da('0x12')]===0x1f4){logger[_0x09da('0x11')](_0x09da('0x13'),_0x273787,_0x3b7552[_0x09da('0x11')]['message']);return _0x457f1d(_0x3b7552[_0x09da('0x11')][_0x09da('0x14')]);}logger[_0x09da('0x11')](_0x09da('0x13'),_0x273787,_0x3b7552['error'][_0x09da('0x14')]);return _0x5f593f(_0x3b7552[_0x09da('0x11')]['message']);}else{logger['info'](_0x09da('0x13'),_0x273787,_0x09da('0xf'));_0x5f593f(_0x3b7552[_0x09da('0x15')][_0x09da('0x14')]);}})['catch'](function(_0x52b87b){logger[_0x09da('0x11')](_0x09da('0x13'),_0x273787,_0x52b87b);_0x457f1d(_0x52b87b);});});}exports[_0x09da('0x16')]=function(_0x5c23ca){var _0x1c9bb0=this;return new Promise(function(_0x1b1f9c,_0x1b7cd6){return db[_0x09da('0x17')][_0x09da('0x18')]({'raw':_0x5c23ca[_0x09da('0x19')]?_0x5c23ca['options'][_0x09da('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c23ca[_0x09da('0x19')]?_0x5c23ca[_0x09da('0x19')][_0x09da('0x1b')]||null:null,'attributes':_0x5c23ca[_0x09da('0x19')]?_0x5c23ca['options'][_0x09da('0x1c')]||null:null,'limit':_0x5c23ca[_0x09da('0x19')]?_0x5c23ca['options']['limit']||null:null,'include':_0x5c23ca[_0x09da('0x19')]?_0x5c23ca[_0x09da('0x19')][_0x09da('0x1d')]?_['map'](_0x5c23ca[_0x09da('0x19')][_0x09da('0x1d')],function(_0x3b4fa5){return{'model':db[_0x3b4fa5[_0x09da('0x1e')]],'as':_0x3b4fa5['as'],'attributes':_0x3b4fa5['attributes'],'include':_0x3b4fa5[_0x09da('0x1d')]?_[_0x09da('0x1f')](_0x3b4fa5['include'],function(_0x47d0b3){return{'model':db[_0x47d0b3[_0x09da('0x1e')]],'as':_0x47d0b3['as'],'attributes':_0x47d0b3[_0x09da('0x1c')],'include':_0x47d0b3[_0x09da('0x1d')]?_[_0x09da('0x1f')](_0x47d0b3[_0x09da('0x1d')],function(_0x5d60f2){return{'model':db[_0x5d60f2[_0x09da('0x1e')]],'as':_0x5d60f2['as'],'attributes':_0x5d60f2[_0x09da('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c569d){logger[_0x09da('0xe')]('GetTemplate',_0x5c23ca);logger[_0x09da('0x20')](_0x09da('0x16'),_0x5c23ca,JSON[_0x09da('0x10')](_0x3c569d));_0x1b1f9c(_0x3c569d);})[_0x09da('0x21')](function(_0x3280b9){logger[_0x09da('0x11')](_0x09da('0x16'),_0x3280b9[_0x09da('0x14')],_0x5c23ca);_0x1b7cd6(_0x1c9bb0[_0x09da('0x11')](0x1f4,_0x3280b9[_0x09da('0x14')]));});});}; \ No newline at end of file +var _0x6145=['attributes','limit','map','include','model','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Template,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch','GetTemplate','Template','options','raw','where'];(function(_0x1685c4,_0x2d3c5d){var _0x3207a3=function(_0x14ee45){while(--_0x14ee45){_0x1685c4['push'](_0x1685c4['shift']());}};_0x3207a3(++_0x2d3c5d);}(_0x6145,0x6a));var _0x5614=function(_0x7a6e0,_0x35f1d3){_0x7a6e0=_0x7a6e0-0x0;var _0x2ef4a7=_0x6145[_0x7a6e0];return _0x2ef4a7;};'use strict';var _=require(_0x5614('0x0'));var util=require('util');var moment=require(_0x5614('0x1'));var BPromise=require(_0x5614('0x2'));var rs=require(_0x5614('0x3'));var fs=require('fs');var Redis=require(_0x5614('0x4'));var db=require(_0x5614('0x5'))['db'];var utils=require(_0x5614('0x6'));var logger=require(_0x5614('0x7'))(_0x5614('0x8'));var config=require(_0x5614('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5614('0xa')][_0x5614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bbccd,_0x8c49d5,_0xc0782b){return new BPromise(function(_0x1a3fc7,_0x119f94){return client[_0x5614('0xc')](_0x2bbccd,_0xc0782b)['then'](function(_0x2c7595){logger['info'](_0x5614('0xd'),_0x8c49d5,_0x5614('0xe'));logger[_0x5614('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x8c49d5,_0x5614('0xe'),JSON['stringify'](_0x2c7595));if(_0x2c7595[_0x5614('0x10')]){if(_0x2c7595['error']['code']===0x1f4){logger['error'](_0x5614('0xd'),_0x8c49d5,_0x2c7595[_0x5614('0x10')][_0x5614('0x11')]);return _0x119f94(_0x2c7595[_0x5614('0x10')][_0x5614('0x11')]);}logger['error'](_0x5614('0xd'),_0x8c49d5,_0x2c7595[_0x5614('0x10')][_0x5614('0x11')]);return _0x1a3fc7(_0x2c7595['error'][_0x5614('0x11')]);}else{logger[_0x5614('0x12')](_0x5614('0xd'),_0x8c49d5,'request\x20sent');_0x1a3fc7(_0x2c7595[_0x5614('0x13')][_0x5614('0x11')]);}})[_0x5614('0x14')](function(_0x227915){logger[_0x5614('0x10')](_0x5614('0xd'),_0x8c49d5,_0x227915);_0x119f94(_0x227915);});});}exports[_0x5614('0x15')]=function(_0x26a3fd){var _0x170b20=this;return new Promise(function(_0x35f6cf,_0x140fff){return db[_0x5614('0x16')]['findAll']({'raw':_0x26a3fd[_0x5614('0x17')]?_0x26a3fd[_0x5614('0x17')][_0x5614('0x18')]===undefined?!![]:![]:!![],'where':_0x26a3fd[_0x5614('0x17')]?_0x26a3fd['options'][_0x5614('0x19')]||null:null,'attributes':_0x26a3fd[_0x5614('0x17')]?_0x26a3fd['options'][_0x5614('0x1a')]||null:null,'limit':_0x26a3fd['options']?_0x26a3fd[_0x5614('0x17')][_0x5614('0x1b')]||null:null,'include':_0x26a3fd[_0x5614('0x17')]?_0x26a3fd['options']['include']?_[_0x5614('0x1c')](_0x26a3fd[_0x5614('0x17')][_0x5614('0x1d')],function(_0x3cef97){return{'model':db[_0x3cef97['model']],'as':_0x3cef97['as'],'attributes':_0x3cef97[_0x5614('0x1a')],'include':_0x3cef97['include']?_['map'](_0x3cef97[_0x5614('0x1d')],function(_0x410891){return{'model':db[_0x410891[_0x5614('0x1e')]],'as':_0x410891['as'],'attributes':_0x410891['attributes'],'include':_0x410891['include']?_['map'](_0x410891['include'],function(_0x138f90){return{'model':db[_0x138f90[_0x5614('0x1e')]],'as':_0x138f90['as'],'attributes':_0x138f90[_0x5614('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5614('0x1f')](function(_0x285e06){logger['info'](_0x5614('0x15'),_0x26a3fd);logger['debug'](_0x5614('0x15'),_0x26a3fd,JSON[_0x5614('0x20')](_0x285e06));_0x35f6cf(_0x285e06);})['catch'](function(_0xb605f9){logger[_0x5614('0x10')](_0x5614('0x15'),_0xb605f9[_0x5614('0x11')],_0x26a3fd);_0x140fff(_0x170b20['error'](0x1f4,_0xb605f9[_0x5614('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index daab297..2553afd 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 _0x5b3f=['/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAction','put','update','delete','/:id','destroy','util','path','Router','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','show','getAllConditions'];(function(_0x27e499,_0xe54ec3){var _0x52e3fc=function(_0x42ffaa){while(--_0x42ffaa){_0x27e499['push'](_0x27e499['shift']());}};_0x52e3fc(++_0xe54ec3);}(_0x5b3f,0x1c4));var _0xf5b3=function(_0x28dbde,_0x4fd816){_0x28dbde=_0x28dbde-0x0;var _0x3046bc=_0x5b3f[_0x28dbde];return _0x3046bc;};'use strict';var multer=require('multer');var util=require(_0xf5b3('0x0'));var path=require(_0xf5b3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf5b3('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xf5b3('0x3'));var config=require('../../config/environment');var controller=require(_0xf5b3('0x4'));router[_0xf5b3('0x5')]('/',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0x7')]);router[_0xf5b3('0x5')]('/:id',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0x8')]);router[_0xf5b3('0x5')]('/:id/all_conditions',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0x9')]);router[_0xf5b3('0x5')]('/:id/any_conditions',auth['isAuthenticated'](),controller['getAnyConditions']);router[_0xf5b3('0x5')](_0xf5b3('0xa'),auth[_0xf5b3('0x6')](),controller[_0xf5b3('0xb')]);router[_0xf5b3('0xc')]('/',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0xd')]);router[_0xf5b3('0xc')]('/:id/all_conditions',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0xe')]);router[_0xf5b3('0xc')](_0xf5b3('0xf'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0xf5b3('0xc')](_0xf5b3('0xa'),auth[_0xf5b3('0x6')](),controller[_0xf5b3('0x10')]);router[_0xf5b3('0x11')]('/:id',auth[_0xf5b3('0x6')](),controller[_0xf5b3('0x12')]);router[_0xf5b3('0x13')](_0xf5b3('0x14'),auth['isAuthenticated'](),controller[_0xf5b3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xfb81=['get','isAuthenticated','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./trigger.controller'];(function(_0x5cd75e,_0x141dd8){var _0x1805ed=function(_0x3613de){while(--_0x3613de){_0x5cd75e['push'](_0x5cd75e['shift']());}};_0x1805ed(++_0x141dd8);}(_0xfb81,0x1f1));var _0x1fb8=function(_0x337085,_0x5d1ab3){_0x337085=_0x337085-0x0;var _0x166cab=_0xfb81[_0x337085];return _0x166cab;};'use strict';var multer=require(_0x1fb8('0x0'));var util=require(_0x1fb8('0x1'));var path=require('path');var timeout=require(_0x1fb8('0x2'));var express=require('express');var router=express[_0x1fb8('0x3')]();var auth=require(_0x1fb8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb8('0x5'));var controller=require(_0x1fb8('0x6'));router[_0x1fb8('0x7')]('/',auth[_0x1fb8('0x8')](),controller['index']);router[_0x1fb8('0x7')](_0x1fb8('0x9'),auth[_0x1fb8('0x8')](),controller[_0x1fb8('0xa')]);router['get']('/:id/all_conditions',auth[_0x1fb8('0x8')](),controller[_0x1fb8('0xb')]);router['get'](_0x1fb8('0xc'),auth['isAuthenticated'](),controller[_0x1fb8('0xd')]);router['get'](_0x1fb8('0xe'),auth[_0x1fb8('0x8')](),controller[_0x1fb8('0xf')]);router[_0x1fb8('0x10')]('/',auth[_0x1fb8('0x8')](),controller['create']);router[_0x1fb8('0x10')]('/:id/all_conditions',auth[_0x1fb8('0x8')](),controller[_0x1fb8('0x11')]);router[_0x1fb8('0x10')](_0x1fb8('0xc'),auth[_0x1fb8('0x8')](),controller[_0x1fb8('0x12')]);router[_0x1fb8('0x10')](_0x1fb8('0xe'),auth[_0x1fb8('0x8')](),controller[_0x1fb8('0x13')]);router[_0x1fb8('0x14')]('/:id',auth[_0x1fb8('0x8')](),controller[_0x1fb8('0x15')]);router[_0x1fb8('0x16')](_0x1fb8('0x9'),auth[_0x1fb8('0x8')](),controller[_0x1fb8('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 27f7a52..efcd7de 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 _0xb2ce=['exports','STRING','BOOLEAN','sequelize'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xb2ce,0x133));var _0xeb2c=function(_0x548f68,_0x2db63e){_0x548f68=_0x548f68-0x0;var _0x1adf80=_0xb2ce[_0x548f68];return _0x1adf80;};'use strict';var Sequelize=require(_0xeb2c('0x0'));module[_0xeb2c('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeb2c('0x2')]},'description':{'type':Sequelize[_0xeb2c('0x2')]},'status':{'type':Sequelize[_0xeb2c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xca93=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xca93,0xe7));var _0x3ca9=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xca93[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x3ca9('0x0'));module[_0x3ca9('0x1')]={'name':{'type':Sequelize[_0x3ca9('0x2')]},'channel':{'type':Sequelize[_0x3ca9('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x3ca9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index d7d6b98..9bae8e7 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 _0xea28=['includeAll','include','findAll','rows','params','keys','filtears','intersection','find','catch','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','Triggers','end','error','stack','name','send','map','Trigger','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options'];(function(_0x3c6a73,_0x48d090){var _0x52e110=function(_0x50b7ae){while(--_0x50b7ae){_0x3c6a73['push'](_0x3c6a73['shift']());}};_0x52e110(++_0x48d090);}(_0xea28,0x13a));var _0x8ea2=function(_0x17923a,_0x246ada){_0x17923a=_0x17923a-0x0;var _0x10d8b5=_0xea28[_0x17923a];return _0x10d8b5;};'use strict';var pdf=require(_0x8ea2('0x0'));var emlformat=require(_0x8ea2('0x1'));var rimraf=require(_0x8ea2('0x2'));var zipdir=require(_0x8ea2('0x3'));var jsonpatch=require(_0x8ea2('0x4'));var rp=require(_0x8ea2('0x5'));var moment=require(_0x8ea2('0x6'));var BPromise=require(_0x8ea2('0x7'));var Mustache=require('mustache');var util=require(_0x8ea2('0x8'));var path=require(_0x8ea2('0x9'));var sox=require(_0x8ea2('0xa'));var csv=require('to-csv');var ejs=require(_0x8ea2('0xb'));var fs=require('fs');var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0x11'));var querystring=require(_0x8ea2('0x12'));var Papa=require(_0x8ea2('0x13'));var Redis=require(_0x8ea2('0x14'));var authService=require(_0x8ea2('0x15'));var qs=require(_0x8ea2('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require(_0x8ea2('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1c')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1c')](_0x772bad)[_0x8ea2('0x1d')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=_0x3cff96[_0x8ea2('0x1e')],_0x474873=_0xbb9bd1[_0x8ea2('0x1f')],_0x396aab=_0xbb9bd1[_0x8ea2('0x1f')]+_0xbb9bd1[_0x8ea2('0x20')],_0x2dfa7c;if(_0x396aab>=_0x11f5e8){_0x396aab=_0x11f5e8;_0x2dfa7c=0xc8;}else{_0x2dfa7c=0xce;}_0x393faf[_0x8ea2('0x1c')](_0x2dfa7c);return _0x393faf[_0x8ea2('0x21')](_0x8ea2('0x22'),_0x474873+'-'+_0x396aab+'/'+_0x11f5e8)[_0x8ea2('0x1d')](_0x3cff96);}return null;};}function patchUpdates(_0x233a40){return function(_0x134cbe){try{jsonpatch[_0x8ea2('0x23')](_0x134cbe,_0x233a40,!![]);}catch(_0x52b58c){return BPromise['reject'](_0x52b58c);}return _0x134cbe[_0x8ea2('0x24')]();};}function saveUpdates(_0x248c18,_0x29151a){return function(_0x5ebc04){if(_0x5ebc04){return _0x5ebc04[_0x8ea2('0x25')](_0x248c18)[_0x8ea2('0x26')](function(_0x5c057a){return _0x5c057a;});}return null;};}function removeEntity(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x27')]()[_0x8ea2('0x26')](function(){var _0xe5c943=_0x37229a[_0x8ea2('0x28')]({'plain':!![]});var _0x1e4cc9=_0x8ea2('0x29');return db['UserProfileResource'][_0x8ea2('0x27')]({'where':{'type':_0x1e4cc9,'resourceId':_0xe5c943['id']}})['then'](function(){return _0x37229a;});})[_0x8ea2('0x26')](function(){_0x3d593b[_0x8ea2('0x1c')](0xcc)[_0x8ea2('0x2a')]();});}};}function handleEntityNotFound(_0x4e2106,_0x53ed43){return function(_0x2e4da3){if(!_0x2e4da3){_0x4e2106['sendStatus'](0x194);}return _0x2e4da3;};}function handleError(_0x200a49,_0x4e786d){_0x4e786d=_0x4e786d||0x1f4;return function(_0x3be291){logger[_0x8ea2('0x2b')](_0x3be291[_0x8ea2('0x2c')]);if(_0x3be291[_0x8ea2('0x2d')]){delete _0x3be291['name'];}_0x200a49['status'](_0x4e786d)[_0x8ea2('0x2e')](_0x3be291);};}exports['index']=function(_0x4a9875,_0x287078){var _0x24f187={},_0x41f482={},_0x307c74={'count':0x0,'rows':[]};var _0x3eb7ac=_[_0x8ea2('0x2f')](db[_0x8ea2('0x30')][_0x8ea2('0x31')],function(_0x9c5fac){return{'name':_0x9c5fac['fieldName'],'type':_0x9c5fac['type'][_0x8ea2('0x32')]};});_0x41f482[_0x8ea2('0x33')]=_['map'](_0x3eb7ac,'name');_0x41f482[_0x8ea2('0x34')]=_['keys'](_0x4a9875[_0x8ea2('0x34')]);_0x41f482[_0x8ea2('0x35')]=_['intersection'](_0x41f482[_0x8ea2('0x33')],_0x41f482[_0x8ea2('0x34')]);_0x24f187[_0x8ea2('0x36')]=_['intersection'](_0x41f482['model'],qs['fields'](_0x4a9875[_0x8ea2('0x34')][_0x8ea2('0x37')]));_0x24f187[_0x8ea2('0x36')]=_0x24f187['attributes'][_0x8ea2('0x38')]?_0x24f187[_0x8ea2('0x36')]:_0x41f482[_0x8ea2('0x33')];if(!_0x4a9875[_0x8ea2('0x34')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x24f187[_0x8ea2('0x20')]=qs[_0x8ea2('0x20')](_0x4a9875['query'][_0x8ea2('0x20')]);_0x24f187[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x4a9875[_0x8ea2('0x34')]['offset']);}_0x24f187[_0x8ea2('0x3b')]=qs['sort'](_0x4a9875[_0x8ea2('0x34')][_0x8ea2('0x3c')]);_0x24f187[_0x8ea2('0x3d')]=qs[_0x8ea2('0x35')](_['pick'](_0x4a9875[_0x8ea2('0x34')],_0x41f482['filters']),_0x3eb7ac);if(_0x4a9875['query'][_0x8ea2('0x3e')]){_0x24f187['where']=_[_0x8ea2('0x3f')](_0x24f187[_0x8ea2('0x3d')],{'$or':_[_0x8ea2('0x2f')](_0x3eb7ac,function(_0x49446e){if(_0x49446e[_0x8ea2('0x40')]!=='VIRTUAL'){var _0x84685d={};_0x84685d[_0x49446e['name']]={'$like':'%'+_0x4a9875[_0x8ea2('0x34')][_0x8ea2('0x3e')]+'%'};return _0x84685d;}})});}_0x24f187=_[_0x8ea2('0x3f')]({},_0x24f187,_0x4a9875[_0x8ea2('0x41')]);var _0x4f9a8c={'where':_0x24f187[_0x8ea2('0x3d')]};return db['Trigger'][_0x8ea2('0x1e')](_0x4f9a8c)['then'](function(_0x2ee78b){_0x307c74[_0x8ea2('0x1e')]=_0x2ee78b;if(_0x4a9875[_0x8ea2('0x34')][_0x8ea2('0x42')]){_0x24f187[_0x8ea2('0x43')]=[{'all':!![]}];}return db[_0x8ea2('0x30')][_0x8ea2('0x44')](_0x24f187);})['then'](function(_0x52a34e){_0x307c74[_0x8ea2('0x45')]=_0x52a34e;return _0x307c74;})['then'](respondWithFilteredResult(_0x287078,_0x24f187))['catch'](handleError(_0x287078,null));};exports['show']=function(_0x3cbc09,_0x5d9ba0){var _0x40a532={'raw':![],'where':{'id':_0x3cbc09[_0x8ea2('0x46')]['id']}},_0x1b8028={};_0x1b8028[_0x8ea2('0x33')]=_[_0x8ea2('0x47')](db[_0x8ea2('0x30')][_0x8ea2('0x31')]);_0x1b8028[_0x8ea2('0x34')]=_['keys'](_0x3cbc09[_0x8ea2('0x34')]);_0x1b8028[_0x8ea2('0x48')]=_[_0x8ea2('0x49')](_0x1b8028['model'],_0x1b8028[_0x8ea2('0x34')]);_0x40a532[_0x8ea2('0x36')]=_[_0x8ea2('0x49')](_0x1b8028[_0x8ea2('0x33')],qs[_0x8ea2('0x37')](_0x3cbc09['query'][_0x8ea2('0x37')]));_0x40a532[_0x8ea2('0x36')]=_0x40a532[_0x8ea2('0x36')]['length']?_0x40a532[_0x8ea2('0x36')]:_0x1b8028[_0x8ea2('0x33')];if(_0x3cbc09[_0x8ea2('0x34')][_0x8ea2('0x42')]){_0x40a532[_0x8ea2('0x43')]=[{'all':!![]}];}_0x40a532=_[_0x8ea2('0x3f')]({},_0x40a532,_0x3cbc09[_0x8ea2('0x41')]);return db[_0x8ea2('0x30')][_0x8ea2('0x4a')](_0x40a532)[_0x8ea2('0x26')](handleEntityNotFound(_0x5d9ba0,null))[_0x8ea2('0x26')](respondWithResult(_0x5d9ba0,null))[_0x8ea2('0x4b')](handleError(_0x5d9ba0,null));};exports[_0x8ea2('0x4c')]=function(_0x12e81f,_0x5c1212){return db[_0x8ea2('0x30')][_0x8ea2('0x4c')](_0x12e81f[_0x8ea2('0x4d')],{})[_0x8ea2('0x26')](function(_0x182a46){var _0x1daa25=_0x12e81f[_0x8ea2('0x4e')][_0x8ea2('0x28')]({'plain':!![]});if(!_0x1daa25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1daa25[_0x8ea2('0x4f')]===_0x8ea2('0x4e')){var _0x24dddb=_0x182a46['get']({'plain':!![]});var _0x4fcc19=_0x8ea2('0x29');return db[_0x8ea2('0x50')][_0x8ea2('0x4a')]({'where':{'name':_0x4fcc19,'userProfileId':_0x1daa25['userProfileId']},'raw':!![]})[_0x8ea2('0x26')](function(_0x315b5d){if(_0x315b5d&&_0x315b5d[_0x8ea2('0x51')]===0x0){return db[_0x8ea2('0x52')][_0x8ea2('0x4c')]({'name':_0x24dddb['name'],'resourceId':_0x24dddb['id'],'type':_0x315b5d['name'],'sectionId':_0x315b5d['id']},{})[_0x8ea2('0x26')](function(){return _0x182a46;});}else{return _0x182a46;}})[_0x8ea2('0x4b')](function(_0x1b8c4b){logger['error'](_0x8ea2('0x53'),_0x1b8c4b);throw _0x1b8c4b;});}return _0x182a46;})[_0x8ea2('0x26')](respondWithResult(_0x5c1212,0xc9))[_0x8ea2('0x4b')](handleError(_0x5c1212,null));};exports['update']=function(_0x5c6524,_0x48aebf){if(_0x5c6524['body']['id']){delete _0x5c6524['body']['id'];}return db[_0x8ea2('0x30')][_0x8ea2('0x4a')]({'where':{'id':_0x5c6524['params']['id']}})['then'](handleEntityNotFound(_0x48aebf,null))[_0x8ea2('0x26')](saveUpdates(_0x5c6524[_0x8ea2('0x4d')],null))[_0x8ea2('0x26')](respondWithResult(_0x48aebf,null))['catch'](handleError(_0x48aebf,null));};exports[_0x8ea2('0x27')]=function(_0x30ebd3,_0x59e3df){return db[_0x8ea2('0x30')][_0x8ea2('0x4a')]({'where':{'id':_0x30ebd3[_0x8ea2('0x46')]['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x59e3df,null))[_0x8ea2('0x26')](removeEntity(_0x59e3df,null))['catch'](handleError(_0x59e3df,null));};exports['addAllCondition']=function(_0x577049,_0x334402,_0x3c9fed){if(_0x577049[_0x8ea2('0x4d')]['id']){delete _0x577049[_0x8ea2('0x4d')]['id'];}return db[_0x8ea2('0x30')][_0x8ea2('0x4a')]({'where':{'id':_0x577049[_0x8ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x334402,null))['then'](function(_0x58f9b9){if(_0x58f9b9){_0x577049[_0x8ea2('0x4d')][_0x8ea2('0x54')]=_0x58f9b9['id'];return db[_0x8ea2('0x55')][_0x8ea2('0x4c')](_0x577049['body']);}})[_0x8ea2('0x26')](respondWithResult(_0x334402,null))[_0x8ea2('0x4b')](handleError(_0x334402,null));};exports['addAnyCondition']=function(_0x21485a,_0x193c32,_0x142ede){if(_0x21485a[_0x8ea2('0x4d')]['id']){delete _0x21485a[_0x8ea2('0x4d')]['id'];}return db['Trigger']['find']({'where':{'id':_0x21485a['params']['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x193c32,null))[_0x8ea2('0x26')](function(_0x2fd365){if(_0x2fd365){_0x21485a[_0x8ea2('0x4d')][_0x8ea2('0x56')]=_0x2fd365['id'];return db['Condition'][_0x8ea2('0x4c')](_0x21485a[_0x8ea2('0x4d')]);}})[_0x8ea2('0x26')](respondWithResult(_0x193c32,null))[_0x8ea2('0x4b')](handleError(_0x193c32,null));};exports['getAllConditions']=function(_0x3f4f7b,_0x4846f4,_0x38d972){var _0x57728a={};var _0x361bb3={};var _0x3021c1;var _0x4ad944;return db['Trigger'][_0x8ea2('0x57')]({'where':{'id':_0x3f4f7b['params']['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x4846f4,null))[_0x8ea2('0x26')](function(_0x1c5489){if(_0x1c5489){_0x3021c1=_0x1c5489;_0x361bb3[_0x8ea2('0x33')]=_['keys'](db[_0x8ea2('0x55')][_0x8ea2('0x31')]);_0x361bb3[_0x8ea2('0x34')]=_[_0x8ea2('0x47')](_0x3f4f7b[_0x8ea2('0x34')]);_0x361bb3[_0x8ea2('0x35')]=_[_0x8ea2('0x49')](_0x361bb3[_0x8ea2('0x33')],_0x361bb3[_0x8ea2('0x34')]);_0x57728a[_0x8ea2('0x36')]=_[_0x8ea2('0x49')](_0x361bb3[_0x8ea2('0x33')],qs['fields'](_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x37')]));_0x57728a[_0x8ea2('0x36')]=_0x57728a[_0x8ea2('0x36')][_0x8ea2('0x38')]?_0x57728a[_0x8ea2('0x36')]:_0x361bb3[_0x8ea2('0x33')];_0x57728a[_0x8ea2('0x3b')]=qs[_0x8ea2('0x3c')](_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x3c')]);_0x57728a[_0x8ea2('0x3d')]=qs['filters'](_[_0x8ea2('0x58')](_0x3f4f7b[_0x8ea2('0x34')],_0x361bb3[_0x8ea2('0x35')]));if(_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x3e')]){_0x57728a['where']=_['merge'](_0x57728a['where'],{'$or':_[_0x8ea2('0x2f')](_0x57728a[_0x8ea2('0x36')],function(_0x380066){var _0x31bda0={};_0x31bda0[_0x380066]={'$like':'%'+_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x3e')]+'%'};return _0x31bda0;})});}_0x57728a=_['merge']({},_0x57728a,_0x3f4f7b[_0x8ea2('0x41')]);return _0x3021c1[_0x8ea2('0x59')](_0x57728a);}})['then'](function(_0x55f929){if(_0x55f929){_0x4ad944=_0x55f929[_0x8ea2('0x38')];if(!_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x57728a[_0x8ea2('0x20')]=qs[_0x8ea2('0x20')](_0x3f4f7b[_0x8ea2('0x34')]['limit']);_0x57728a[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x3f4f7b[_0x8ea2('0x34')][_0x8ea2('0x1f')]);}return _0x3021c1['getAllConditions'](_0x57728a);}})[_0x8ea2('0x26')](function(_0x356099){if(_0x356099){return _0x356099?{'count':_0x4ad944,'rows':_0x356099}:null;}})[_0x8ea2('0x26')](respondWithResult(_0x4846f4,null))['catch'](handleError(_0x4846f4,null));};exports[_0x8ea2('0x5a')]=function(_0x5c2d05,_0x505c80,_0x188809){var _0x452c82={};var _0x54db43={};var _0x5a6543;var _0x47df4c;return db[_0x8ea2('0x30')]['findOne']({'where':{'id':_0x5c2d05['params']['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x505c80,null))[_0x8ea2('0x26')](function(_0xa08c2){if(_0xa08c2){_0x5a6543=_0xa08c2;_0x54db43[_0x8ea2('0x33')]=_[_0x8ea2('0x47')](db[_0x8ea2('0x55')][_0x8ea2('0x31')]);_0x54db43[_0x8ea2('0x34')]=_[_0x8ea2('0x47')](_0x5c2d05[_0x8ea2('0x34')]);_0x54db43[_0x8ea2('0x35')]=_[_0x8ea2('0x49')](_0x54db43[_0x8ea2('0x33')],_0x54db43[_0x8ea2('0x34')]);_0x452c82['attributes']=_[_0x8ea2('0x49')](_0x54db43[_0x8ea2('0x33')],qs[_0x8ea2('0x37')](_0x5c2d05['query'][_0x8ea2('0x37')]));_0x452c82['attributes']=_0x452c82[_0x8ea2('0x36')]['length']?_0x452c82[_0x8ea2('0x36')]:_0x54db43['model'];_0x452c82[_0x8ea2('0x3b')]=qs[_0x8ea2('0x3c')](_0x5c2d05['query'][_0x8ea2('0x3c')]);_0x452c82['where']=qs[_0x8ea2('0x35')](_[_0x8ea2('0x58')](_0x5c2d05[_0x8ea2('0x34')],_0x54db43[_0x8ea2('0x35')]));if(_0x5c2d05[_0x8ea2('0x34')]['filter']){_0x452c82['where']=_[_0x8ea2('0x3f')](_0x452c82['where'],{'$or':_[_0x8ea2('0x2f')](_0x452c82[_0x8ea2('0x36')],function(_0x794819){var _0x1c365e={};_0x1c365e[_0x794819]={'$like':'%'+_0x5c2d05[_0x8ea2('0x34')][_0x8ea2('0x3e')]+'%'};return _0x1c365e;})});}_0x452c82=_['merge']({},_0x452c82,_0x5c2d05['options']);return _0x5a6543['getAnyConditions'](_0x452c82);}})[_0x8ea2('0x26')](function(_0x576075){if(_0x576075){_0x47df4c=_0x576075[_0x8ea2('0x38')];if(!_0x5c2d05[_0x8ea2('0x34')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x452c82[_0x8ea2('0x20')]=qs[_0x8ea2('0x20')](_0x5c2d05['query'][_0x8ea2('0x20')]);_0x452c82[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x5c2d05[_0x8ea2('0x34')][_0x8ea2('0x1f')]);}return _0x5a6543['getAnyConditions'](_0x452c82);}})['then'](function(_0x161b33){if(_0x161b33){return _0x161b33?{'count':_0x47df4c,'rows':_0x161b33}:null;}})[_0x8ea2('0x26')](respondWithResult(_0x505c80,null))[_0x8ea2('0x4b')](handleError(_0x505c80,null));};exports[_0x8ea2('0x5b')]=function(_0x2b6b38,_0x201087,_0x2e0bbe){if(_0x2b6b38[_0x8ea2('0x4d')]['id']){delete _0x2b6b38[_0x8ea2('0x4d')]['id'];}return db[_0x8ea2('0x30')][_0x8ea2('0x4a')]({'where':{'id':_0x2b6b38[_0x8ea2('0x46')]['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x201087,null))[_0x8ea2('0x26')](function(_0x3f996b){if(_0x3f996b){_0x2b6b38[_0x8ea2('0x4d')][_0x8ea2('0x5c')]=_0x3f996b['id'];return db['Action']['create'](_0x2b6b38[_0x8ea2('0x4d')]);}})['then'](respondWithResult(_0x201087,null))[_0x8ea2('0x4b')](handleError(_0x201087,null));};exports[_0x8ea2('0x5d')]=function(_0x5b527b,_0x84e87a,_0x580a1c){var _0x3e93f7={};var _0x1f4eaf={};var _0x4a3326;var _0x17dee8;return db[_0x8ea2('0x30')][_0x8ea2('0x57')]({'where':{'id':_0x5b527b[_0x8ea2('0x46')]['id']}})[_0x8ea2('0x26')](handleEntityNotFound(_0x84e87a,null))[_0x8ea2('0x26')](function(_0x3c3d18){if(_0x3c3d18){_0x4a3326=_0x3c3d18;_0x1f4eaf[_0x8ea2('0x33')]=_[_0x8ea2('0x47')](db[_0x8ea2('0x5e')]['rawAttributes']);_0x1f4eaf[_0x8ea2('0x34')]=_[_0x8ea2('0x47')](_0x5b527b['query']);_0x1f4eaf[_0x8ea2('0x35')]=_['intersection'](_0x1f4eaf['model'],_0x1f4eaf['query']);_0x3e93f7[_0x8ea2('0x36')]=_['intersection'](_0x1f4eaf[_0x8ea2('0x33')],qs[_0x8ea2('0x37')](_0x5b527b[_0x8ea2('0x34')][_0x8ea2('0x37')]));_0x3e93f7[_0x8ea2('0x36')]=_0x3e93f7[_0x8ea2('0x36')]['length']?_0x3e93f7[_0x8ea2('0x36')]:_0x1f4eaf['model'];_0x3e93f7[_0x8ea2('0x3b')]=qs[_0x8ea2('0x3c')](_0x5b527b[_0x8ea2('0x34')][_0x8ea2('0x3c')]);_0x3e93f7[_0x8ea2('0x3d')]=qs['filters'](_[_0x8ea2('0x58')](_0x5b527b[_0x8ea2('0x34')],_0x1f4eaf[_0x8ea2('0x35')]));if(_0x5b527b[_0x8ea2('0x34')][_0x8ea2('0x3e')]){_0x3e93f7[_0x8ea2('0x3d')]=_[_0x8ea2('0x3f')](_0x3e93f7[_0x8ea2('0x3d')],{'$or':_[_0x8ea2('0x2f')](_0x3e93f7[_0x8ea2('0x36')],function(_0x16fefb){var _0x57e5fd={};_0x57e5fd[_0x16fefb]={'$like':'%'+_0x5b527b[_0x8ea2('0x34')][_0x8ea2('0x3e')]+'%'};return _0x57e5fd;})});}_0x3e93f7=_[_0x8ea2('0x3f')]({},_0x3e93f7,_0x5b527b[_0x8ea2('0x41')]);return _0x4a3326[_0x8ea2('0x5d')](_0x3e93f7);}})['then'](function(_0x1bc067){if(_0x1bc067){_0x17dee8=_0x1bc067['length'];if(!_0x5b527b['query'][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x3e93f7['limit']=qs[_0x8ea2('0x20')](_0x5b527b[_0x8ea2('0x34')]['limit']);_0x3e93f7[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x5b527b['query'][_0x8ea2('0x1f')]);}return _0x4a3326[_0x8ea2('0x5d')](_0x3e93f7);}})[_0x8ea2('0x26')](function(_0xdfe7){if(_0xdfe7){return _0xdfe7?{'count':_0x17dee8,'rows':_0xdfe7}:null;}})[_0x8ea2('0x26')](respondWithResult(_0x84e87a,null))['catch'](handleError(_0x84e87a,null));}; \ No newline at end of file +var _0x0abf=['length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','filtears','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','order','pick','getAnyConditions','addAction','getActions','Action','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','stack','send','index','map','Trigger','rawAttributes','fieldName','type','name','query','filters','model','attributes','intersection','fields'];(function(_0x5347f1,_0x1122ab){var _0x31216d=function(_0x2f816d){while(--_0x2f816d){_0x5347f1['push'](_0x5347f1['shift']());}};_0x31216d(++_0x1122ab);}(_0x0abf,0xe8));var _0xf0ab=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0abf[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=_0x20f453['count'],_0x200cf5=_0x3c5bfd[_0xf0ab('0x1b')],_0x2f4618=_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1c')],_0x230f40;if(_0x2f4618>=_0x221bac){_0x2f4618=_0x221bac;_0x230f40=0xc8;}else{_0x230f40=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x230f40);return _0x180d0b[_0xf0ab('0x1d')](_0xf0ab('0x1e'),_0x200cf5+'-'+_0x2f4618+'/'+_0x221bac)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x263e2b){return function(_0x1713d6){try{jsonpatch[_0xf0ab('0x1f')](_0x1713d6,_0x263e2b,!![]);}catch(_0x715579){return BPromise[_0xf0ab('0x20')](_0x715579);}return _0x1713d6[_0xf0ab('0x21')]();};}function saveUpdates(_0x22a205,_0x2cd961){return function(_0x45c1c9){if(_0x45c1c9){return _0x45c1c9['update'](_0x22a205)[_0xf0ab('0x22')](function(_0x6fa888){return _0x6fa888;});}return null;};}function removeEntity(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x23')]()[_0xf0ab('0x22')](function(){var _0x20140b=_0x3bf6a1[_0xf0ab('0x24')]({'plain':!![]});var _0x18bb37=_0xf0ab('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x18bb37,'resourceId':_0x20140b['id']}})['then'](function(){return _0x3bf6a1;});})[_0xf0ab('0x22')](function(){_0x1e1483['status'](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x16b979,_0x51ac90){return function(_0x163078){if(!_0x163078){_0x16b979[_0xf0ab('0x17')](0x194);}return _0x163078;};}function handleError(_0x10bf5f,_0x38fb71){_0x38fb71=_0x38fb71||0x1f4;return function(_0x7d4ff9){logger['error'](_0x7d4ff9[_0xf0ab('0x26')]);if(_0x7d4ff9['name']){delete _0x7d4ff9['name'];}_0x10bf5f[_0xf0ab('0x18')](_0x38fb71)[_0xf0ab('0x27')](_0x7d4ff9);};}exports[_0xf0ab('0x28')]=function(_0x445160,_0x43476c){var _0x174052={},_0x367302={},_0x14da9c={'count':0x0,'rows':[]};var _0x76a3f3=_[_0xf0ab('0x29')](db[_0xf0ab('0x2a')][_0xf0ab('0x2b')],function(_0x58cbe1){return{'name':_0x58cbe1[_0xf0ab('0x2c')],'type':_0x58cbe1[_0xf0ab('0x2d')]['key']};});_0x367302['model']=_[_0xf0ab('0x29')](_0x76a3f3,_0xf0ab('0x2e'));_0x367302[_0xf0ab('0x2f')]=_['keys'](_0x445160['query']);_0x367302[_0xf0ab('0x30')]=_['intersection'](_0x367302[_0xf0ab('0x31')],_0x367302['query']);_0x174052[_0xf0ab('0x32')]=_[_0xf0ab('0x33')](_0x367302['model'],qs['fields'](_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x34')]));_0x174052[_0xf0ab('0x32')]=_0x174052[_0xf0ab('0x32')][_0xf0ab('0x35')]?_0x174052[_0xf0ab('0x32')]:_0x367302[_0xf0ab('0x31')];if(!_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x174052[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);_0x174052['offset']=qs[_0xf0ab('0x1b')](_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x1b')]);}_0x174052['order']=qs[_0xf0ab('0x38')](_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x38')]);_0x174052['where']=qs[_0xf0ab('0x30')](_['pick'](_0x445160[_0xf0ab('0x2f')],_0x367302['filters']),_0x76a3f3);if(_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x39')]){_0x174052[_0xf0ab('0x3a')]=_[_0xf0ab('0x3b')](_0x174052[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x29')](_0x76a3f3,function(_0x4e3ade){if(_0x4e3ade[_0xf0ab('0x2d')]!==_0xf0ab('0x3c')){var _0x5a6df5={};_0x5a6df5[_0x4e3ade[_0xf0ab('0x2e')]]={'$like':'%'+_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x39')]+'%'};return _0x5a6df5;}})});}_0x174052=_[_0xf0ab('0x3b')]({},_0x174052,_0x445160[_0xf0ab('0x3d')]);var _0x11e3b7={'where':_0x174052[_0xf0ab('0x3a')]};return db['Trigger'][_0xf0ab('0x3e')](_0x11e3b7)[_0xf0ab('0x22')](function(_0x7c4629){_0x14da9c['count']=_0x7c4629;if(_0x445160[_0xf0ab('0x2f')][_0xf0ab('0x3f')]){_0x174052[_0xf0ab('0x40')]=[{'all':!![]}];}return db[_0xf0ab('0x2a')][_0xf0ab('0x41')](_0x174052);})['then'](function(_0x1b7974){_0x14da9c[_0xf0ab('0x42')]=_0x1b7974;return _0x14da9c;})[_0xf0ab('0x22')](respondWithFilteredResult(_0x43476c,_0x174052))[_0xf0ab('0x43')](handleError(_0x43476c,null));};exports[_0xf0ab('0x44')]=function(_0x17a73,_0x45849c){var _0x413f5c={'raw':![],'where':{'id':_0x17a73[_0xf0ab('0x45')]['id']}},_0x8ad4ad={};_0x8ad4ad[_0xf0ab('0x31')]=_[_0xf0ab('0x46')](db[_0xf0ab('0x2a')]['rawAttributes']);_0x8ad4ad['query']=_[_0xf0ab('0x46')](_0x17a73['query']);_0x8ad4ad[_0xf0ab('0x47')]=_[_0xf0ab('0x33')](_0x8ad4ad['model'],_0x8ad4ad[_0xf0ab('0x2f')]);_0x413f5c[_0xf0ab('0x32')]=_['intersection'](_0x8ad4ad[_0xf0ab('0x31')],qs[_0xf0ab('0x34')](_0x17a73[_0xf0ab('0x2f')][_0xf0ab('0x34')]));_0x413f5c[_0xf0ab('0x32')]=_0x413f5c[_0xf0ab('0x32')][_0xf0ab('0x35')]?_0x413f5c[_0xf0ab('0x32')]:_0x8ad4ad[_0xf0ab('0x31')];if(_0x17a73[_0xf0ab('0x2f')][_0xf0ab('0x3f')]){_0x413f5c[_0xf0ab('0x40')]=[{'all':!![]}];}_0x413f5c=_[_0xf0ab('0x3b')]({},_0x413f5c,_0x17a73[_0xf0ab('0x3d')]);return db['Trigger']['find'](_0x413f5c)[_0xf0ab('0x22')](handleEntityNotFound(_0x45849c,null))['then'](respondWithResult(_0x45849c,null))['catch'](handleError(_0x45849c,null));};exports['create']=function(_0xc3b68d,_0x45b32c){return db[_0xf0ab('0x2a')][_0xf0ab('0x48')](_0xc3b68d[_0xf0ab('0x49')],{})[_0xf0ab('0x22')](function(_0x472c1b){var _0x1a0f21=_0xc3b68d[_0xf0ab('0x4a')][_0xf0ab('0x24')]({'plain':!![]});if(!_0x1a0f21)throw new Error(_0xf0ab('0x4b'));if(_0x1a0f21[_0xf0ab('0x4c')]==='user'){var _0x393c9a=_0x472c1b[_0xf0ab('0x24')]({'plain':!![]});var _0x43abde=_0xf0ab('0x25');return db[_0xf0ab('0x4d')][_0xf0ab('0x4e')]({'where':{'name':_0x43abde,'userProfileId':_0x1a0f21[_0xf0ab('0x4f')]},'raw':!![]})[_0xf0ab('0x22')](function(_0x47f564){if(_0x47f564&&_0x47f564['autoAssociation']===0x0){return db['UserProfileResource'][_0xf0ab('0x48')]({'name':_0x393c9a[_0xf0ab('0x2e')],'resourceId':_0x393c9a['id'],'type':_0x47f564['name'],'sectionId':_0x47f564['id']},{})[_0xf0ab('0x22')](function(){return _0x472c1b;});}else{return _0x472c1b;}})[_0xf0ab('0x43')](function(_0x4edb01){logger[_0xf0ab('0x50')](_0xf0ab('0x51'),_0x4edb01);throw _0x4edb01;});}return _0x472c1b;})[_0xf0ab('0x22')](respondWithResult(_0x45b32c,0xc9))[_0xf0ab('0x43')](handleError(_0x45b32c,null));};exports[_0xf0ab('0x52')]=function(_0x33112b,_0x26508b){if(_0x33112b['body']['id']){delete _0x33112b[_0xf0ab('0x49')]['id'];}return db['Trigger'][_0xf0ab('0x4e')]({'where':{'id':_0x33112b['params']['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x26508b,null))['then'](saveUpdates(_0x33112b['body'],null))[_0xf0ab('0x22')](respondWithResult(_0x26508b,null))['catch'](handleError(_0x26508b,null));};exports[_0xf0ab('0x23')]=function(_0x54efed,_0x2eff07){return db['Trigger'][_0xf0ab('0x4e')]({'where':{'id':_0x54efed[_0xf0ab('0x45')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x2eff07,null))['then'](removeEntity(_0x2eff07,null))['catch'](handleError(_0x2eff07,null));};exports['addAllCondition']=function(_0x2db43d,_0x421d93,_0x57d6c3){if(_0x2db43d['body']['id']){delete _0x2db43d[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2a')][_0xf0ab('0x4e')]({'where':{'id':_0x2db43d[_0xf0ab('0x45')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x421d93,null))[_0xf0ab('0x22')](function(_0x2d3aa8){if(_0x2d3aa8){_0x2db43d[_0xf0ab('0x49')][_0xf0ab('0x53')]=_0x2d3aa8['id'];return db[_0xf0ab('0x54')][_0xf0ab('0x48')](_0x2db43d['body']);}})[_0xf0ab('0x22')](respondWithResult(_0x421d93,null))['catch'](handleError(_0x421d93,null));};exports[_0xf0ab('0x55')]=function(_0x61d3db,_0x14e4ee,_0xa946f1){if(_0x61d3db[_0xf0ab('0x49')]['id']){delete _0x61d3db[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2a')][_0xf0ab('0x4e')]({'where':{'id':_0x61d3db[_0xf0ab('0x45')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x14e4ee,null))['then'](function(_0x3b5c5e){if(_0x3b5c5e){_0x61d3db[_0xf0ab('0x49')][_0xf0ab('0x56')]=_0x3b5c5e['id'];return db[_0xf0ab('0x54')][_0xf0ab('0x48')](_0x61d3db[_0xf0ab('0x49')]);}})[_0xf0ab('0x22')](respondWithResult(_0x14e4ee,null))[_0xf0ab('0x43')](handleError(_0x14e4ee,null));};exports[_0xf0ab('0x57')]=function(_0x570379,_0x59455b,_0x7e0318){var _0x5c286d={};var _0x3bb602={};var _0x52058a;var _0x3f6c02;return db[_0xf0ab('0x2a')][_0xf0ab('0x58')]({'where':{'id':_0x570379['params']['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x59455b,null))[_0xf0ab('0x22')](function(_0x3fc57e){if(_0x3fc57e){_0x52058a=_0x3fc57e;_0x3bb602[_0xf0ab('0x31')]=_[_0xf0ab('0x46')](db['Condition'][_0xf0ab('0x2b')]);_0x3bb602[_0xf0ab('0x2f')]=_[_0xf0ab('0x46')](_0x570379[_0xf0ab('0x2f')]);_0x3bb602[_0xf0ab('0x30')]=_[_0xf0ab('0x33')](_0x3bb602[_0xf0ab('0x31')],_0x3bb602[_0xf0ab('0x2f')]);_0x5c286d[_0xf0ab('0x32')]=_[_0xf0ab('0x33')](_0x3bb602[_0xf0ab('0x31')],qs[_0xf0ab('0x34')](_0x570379[_0xf0ab('0x2f')]['fields']));_0x5c286d['attributes']=_0x5c286d[_0xf0ab('0x32')][_0xf0ab('0x35')]?_0x5c286d[_0xf0ab('0x32')]:_0x3bb602['model'];_0x5c286d[_0xf0ab('0x59')]=qs['sort'](_0x570379[_0xf0ab('0x2f')][_0xf0ab('0x38')]);_0x5c286d[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x5a')](_0x570379['query'],_0x3bb602['filters']));if(_0x570379[_0xf0ab('0x2f')][_0xf0ab('0x39')]){_0x5c286d[_0xf0ab('0x3a')]=_['merge'](_0x5c286d[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x29')](_0x5c286d[_0xf0ab('0x32')],function(_0x122c41){var _0x5b6923={};_0x5b6923[_0x122c41]={'$like':'%'+_0x570379['query']['filter']+'%'};return _0x5b6923;})});}_0x5c286d=_[_0xf0ab('0x3b')]({},_0x5c286d,_0x570379[_0xf0ab('0x3d')]);return _0x52058a[_0xf0ab('0x57')](_0x5c286d);}})[_0xf0ab('0x22')](function(_0x2013b6){if(_0x2013b6){_0x3f6c02=_0x2013b6[_0xf0ab('0x35')];if(!_0x570379[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x5c286d[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x570379['query'][_0xf0ab('0x1c')]);_0x5c286d[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x570379[_0xf0ab('0x2f')][_0xf0ab('0x1b')]);}return _0x52058a[_0xf0ab('0x57')](_0x5c286d);}})[_0xf0ab('0x22')](function(_0x42f067){if(_0x42f067){return _0x42f067?{'count':_0x3f6c02,'rows':_0x42f067}:null;}})['then'](respondWithResult(_0x59455b,null))[_0xf0ab('0x43')](handleError(_0x59455b,null));};exports[_0xf0ab('0x5b')]=function(_0x4c8e95,_0x515e2f,_0x4b1a28){var _0x331433={};var _0x1a00fd={};var _0x23864d;var _0x14d3e5;return db[_0xf0ab('0x2a')][_0xf0ab('0x58')]({'where':{'id':_0x4c8e95['params']['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x515e2f,null))['then'](function(_0x208032){if(_0x208032){_0x23864d=_0x208032;_0x1a00fd['model']=_[_0xf0ab('0x46')](db['Condition'][_0xf0ab('0x2b')]);_0x1a00fd['query']=_['keys'](_0x4c8e95[_0xf0ab('0x2f')]);_0x1a00fd[_0xf0ab('0x30')]=_[_0xf0ab('0x33')](_0x1a00fd[_0xf0ab('0x31')],_0x1a00fd[_0xf0ab('0x2f')]);_0x331433[_0xf0ab('0x32')]=_[_0xf0ab('0x33')](_0x1a00fd[_0xf0ab('0x31')],qs[_0xf0ab('0x34')](_0x4c8e95[_0xf0ab('0x2f')][_0xf0ab('0x34')]));_0x331433[_0xf0ab('0x32')]=_0x331433[_0xf0ab('0x32')]['length']?_0x331433[_0xf0ab('0x32')]:_0x1a00fd[_0xf0ab('0x31')];_0x331433[_0xf0ab('0x59')]=qs[_0xf0ab('0x38')](_0x4c8e95[_0xf0ab('0x2f')][_0xf0ab('0x38')]);_0x331433[_0xf0ab('0x3a')]=qs[_0xf0ab('0x30')](_[_0xf0ab('0x5a')](_0x4c8e95[_0xf0ab('0x2f')],_0x1a00fd[_0xf0ab('0x30')]));if(_0x4c8e95[_0xf0ab('0x2f')]['filter']){_0x331433[_0xf0ab('0x3a')]=_[_0xf0ab('0x3b')](_0x331433[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x29')](_0x331433['attributes'],function(_0x1afade){var _0x177f79={};_0x177f79[_0x1afade]={'$like':'%'+_0x4c8e95[_0xf0ab('0x2f')][_0xf0ab('0x39')]+'%'};return _0x177f79;})});}_0x331433=_[_0xf0ab('0x3b')]({},_0x331433,_0x4c8e95['options']);return _0x23864d[_0xf0ab('0x5b')](_0x331433);}})[_0xf0ab('0x22')](function(_0x491dc3){if(_0x491dc3){_0x14d3e5=_0x491dc3[_0xf0ab('0x35')];if(!_0x4c8e95['query'][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x331433['limit']=qs[_0xf0ab('0x1c')](_0x4c8e95[_0xf0ab('0x2f')]['limit']);_0x331433['offset']=qs[_0xf0ab('0x1b')](_0x4c8e95['query'][_0xf0ab('0x1b')]);}return _0x23864d[_0xf0ab('0x5b')](_0x331433);}})['then'](function(_0x54729d){if(_0x54729d){return _0x54729d?{'count':_0x14d3e5,'rows':_0x54729d}:null;}})['then'](respondWithResult(_0x515e2f,null))[_0xf0ab('0x43')](handleError(_0x515e2f,null));};exports[_0xf0ab('0x5c')]=function(_0x365dea,_0x26715c,_0x49c89f){if(_0x365dea[_0xf0ab('0x49')]['id']){delete _0x365dea[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2a')][_0xf0ab('0x4e')]({'where':{'id':_0x365dea[_0xf0ab('0x45')]['id']}})['then'](handleEntityNotFound(_0x26715c,null))['then'](function(_0x3635c5){if(_0x3635c5){_0x365dea[_0xf0ab('0x49')]['TriggerId']=_0x3635c5['id'];return db['Action'][_0xf0ab('0x48')](_0x365dea[_0xf0ab('0x49')]);}})[_0xf0ab('0x22')](respondWithResult(_0x26715c,null))[_0xf0ab('0x43')](handleError(_0x26715c,null));};exports[_0xf0ab('0x5d')]=function(_0xb53eb2,_0x8cc011,_0x2b750b){var _0x3068f3={};var _0x181eef={};var _0x3c40c2;var _0x52eca9;return db['Trigger'][_0xf0ab('0x58')]({'where':{'id':_0xb53eb2['params']['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x8cc011,null))[_0xf0ab('0x22')](function(_0x3db0f4){if(_0x3db0f4){_0x3c40c2=_0x3db0f4;_0x181eef[_0xf0ab('0x31')]=_['keys'](db[_0xf0ab('0x5e')][_0xf0ab('0x2b')]);_0x181eef[_0xf0ab('0x2f')]=_[_0xf0ab('0x46')](_0xb53eb2[_0xf0ab('0x2f')]);_0x181eef[_0xf0ab('0x30')]=_[_0xf0ab('0x33')](_0x181eef[_0xf0ab('0x31')],_0x181eef[_0xf0ab('0x2f')]);_0x3068f3[_0xf0ab('0x32')]=_[_0xf0ab('0x33')](_0x181eef[_0xf0ab('0x31')],qs[_0xf0ab('0x34')](_0xb53eb2[_0xf0ab('0x2f')]['fields']));_0x3068f3[_0xf0ab('0x32')]=_0x3068f3[_0xf0ab('0x32')][_0xf0ab('0x35')]?_0x3068f3[_0xf0ab('0x32')]:_0x181eef[_0xf0ab('0x31')];_0x3068f3[_0xf0ab('0x59')]=qs[_0xf0ab('0x38')](_0xb53eb2['query']['sort']);_0x3068f3[_0xf0ab('0x3a')]=qs[_0xf0ab('0x30')](_[_0xf0ab('0x5a')](_0xb53eb2['query'],_0x181eef[_0xf0ab('0x30')]));if(_0xb53eb2[_0xf0ab('0x2f')][_0xf0ab('0x39')]){_0x3068f3[_0xf0ab('0x3a')]=_[_0xf0ab('0x3b')](_0x3068f3['where'],{'$or':_['map'](_0x3068f3[_0xf0ab('0x32')],function(_0x5b9e00){var _0x346ca0={};_0x346ca0[_0x5b9e00]={'$like':'%'+_0xb53eb2[_0xf0ab('0x2f')]['filter']+'%'};return _0x346ca0;})});}_0x3068f3=_[_0xf0ab('0x3b')]({},_0x3068f3,_0xb53eb2[_0xf0ab('0x3d')]);return _0x3c40c2[_0xf0ab('0x5d')](_0x3068f3);}})[_0xf0ab('0x22')](function(_0x263cec){if(_0x263cec){_0x52eca9=_0x263cec['length'];if(!_0xb53eb2[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x3068f3[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0xb53eb2['query'][_0xf0ab('0x1c')]);_0x3068f3[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0xb53eb2[_0xf0ab('0x2f')][_0xf0ab('0x1b')]);}return _0x3c40c2['getActions'](_0x3068f3);}})[_0xf0ab('0x22')](function(_0x1fa283){if(_0x1fa283){return _0x1fa283?{'count':_0x52eca9,'rows':_0x1fa283}:null;}})[_0xf0ab('0x22')](respondWithResult(_0x8cc011,null))['catch'](handleError(_0x8cc011,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index f0d832f..fd4b6d8 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 _0x592e=['../../config/environment','./trigger.attributes','tools_triggers','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x592e,0x1cf));var _0xe592=function(_0x8f481c,_0x3d9c61){_0x8f481c=_0x8f481c-0x0;var _0x1ae2f7=_0x592e[_0x8f481c];return _0x1ae2f7;};'use strict';var _=require(_0xe592('0x0'));var util=require(_0xe592('0x1'));var logger=require(_0xe592('0x2'))('api');var moment=require(_0xe592('0x3'));var BPromise=require('bluebird');var rp=require(_0xe592('0x4'));var fs=require('fs');var path=require(_0xe592('0x5'));var rimraf=require(_0xe592('0x6'));var config=require(_0xe592('0x7'));var attributes=require(_0xe592('0x8'));module['exports']=function(_0x27db1c,_0x3f7e23){return _0x27db1c['define']('Trigger',attributes,{'tableName':_0xe592('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf5c=['exports','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x1bf77e,_0x59e7fb){var _0x32e3f1=function(_0x413e38){while(--_0x413e38){_0x1bf77e['push'](_0x1bf77e['shift']());}};_0x32e3f1(++_0x59e7fb);}(_0xaf5c,0x137));var _0xcaf5=function(_0x313153,_0x333fa6){_0x313153=_0x313153-0x0;var _0x5d0d45=_0xaf5c[_0x313153];return _0x5d0d45;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcaf5('0x0'))(_0xcaf5('0x1'));var moment=require(_0xcaf5('0x2'));var BPromise=require(_0xcaf5('0x3'));var rp=require(_0xcaf5('0x4'));var fs=require('fs');var path=require(_0xcaf5('0x5'));var rimraf=require(_0xcaf5('0x6'));var config=require(_0xcaf5('0x7'));var attributes=require(_0xcaf5('0x8'));module[_0xcaf5('0x9')]=function(_0xc354b1,_0x592680){return _0xc354b1['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 50c1400..a6f56ae 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 _0xfcbb=['info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then'];(function(_0x21bc94,_0x2a03c1){var _0x27ba11=function(_0x36e846){while(--_0x36e846){_0x21bc94['push'](_0x21bc94['shift']());}};_0x27ba11(++_0x2a03c1);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x57bf28,_0x4d4c3e){_0x57bf28=_0x57bf28-0x0;var _0x19ef1f=_0xfcbb[_0x57bf28];return _0x19ef1f;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('Trigger,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')]({'raw':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1a')]===undefined?!![]:![]:!![],'where':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1b')]||null:null,'attributes':_0xba1d6['options']?_0xba1d6['options'][_0xbfcb('0x1c')]||null:null,'limit':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1d')]||null:null,'include':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6['options'][_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1e')],function(_0x1651e5){return{'model':db[_0x1651e5[_0xbfcb('0x20')]],'as':_0x1651e5['as'],'attributes':_0x1651e5[_0xbfcb('0x1c')],'include':_0x1651e5[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x1651e5[_0xbfcb('0x1e')],function(_0x1ca8c3){return{'model':db[_0x1ca8c3[_0xbfcb('0x20')]],'as':_0x1ca8c3['as'],'attributes':_0x1ca8c3[_0xbfcb('0x1c')],'include':_0x1ca8c3[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x1ca8c3[_0xbfcb('0x1e')],function(_0x5cd703){return{'model':db[_0x5cd703[_0xbfcb('0x20')]],'as':_0x5cd703['as'],'attributes':_0x5cd703[_0xbfcb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64a69){logger[_0xbfcb('0xb')](_0xbfcb('0x16'),_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x64a69));_0x3404aa(_0x64a69);})[_0xbfcb('0x15')](function(_0x1a5db2){logger[_0xbfcb('0x10')](_0xbfcb('0x16'),_0x1a5db2['message'],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1a5db2[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x21')]=function(_0x43de3c){var _0x1f45fc=this;return new Promise(function(_0x14f6f5,_0x286fb7){return db[_0xbfcb('0x17')][_0xbfcb('0x22')]({'raw':_0x43de3c['options']?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1a')]===undefined?!![]:![]:!![],'where':_0x43de3c[_0xbfcb('0x19')]?_0x43de3c[_0xbfcb('0x19')]['where']||null:null,'attributes':_0x43de3c['options']?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1c')]||null:null,'include':_0x43de3c[_0xbfcb('0x19')]?_0x43de3c[_0xbfcb('0x19')][_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x43de3c[_0xbfcb('0x19')]['include'],function(_0x504d81){return{'model':db[_0x504d81['model']],'as':_0x504d81['as'],'attributes':_0x504d81[_0xbfcb('0x1c')],'include':_0x504d81['include']?_[_0xbfcb('0x1f')](_0x504d81[_0xbfcb('0x1e')],function(_0x505b0d){return{'model':db[_0x505b0d['model']],'as':_0x505b0d['as'],'attributes':_0x505b0d[_0xbfcb('0x1c')],'include':_0x505b0d[_0xbfcb('0x1e')]?_[_0xbfcb('0x1f')](_0x505b0d[_0xbfcb('0x1e')],function(_0x530208){return{'model':db[_0x530208[_0xbfcb('0x20')]],'as':_0x530208['as'],'attributes':_0x530208[_0xbfcb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47ac13){logger[_0xbfcb('0xb')]('ShowTrigger',_0x43de3c);logger['debug'](_0xbfcb('0x21'),_0x43de3c,JSON[_0xbfcb('0xf')](_0x47ac13));_0x14f6f5(_0x47ac13);})[_0xbfcb('0x15')](function(_0x42ad5d){logger['error'](_0xbfcb('0x21'),_0x42ad5d[_0xbfcb('0x13')],_0x43de3c);_0x286fb7(_0x1f45fc[_0xbfcb('0x10')](0x1f4,_0x42ad5d[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x9c00=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','limit','include','model','map','GetTrigger','ShowTrigger','Trigger','raw'];(function(_0x5863ff,_0x521214){var _0x50ce18=function(_0xf0cfda){while(--_0xf0cfda){_0x5863ff['push'](_0x5863ff['shift']());}};_0x50ce18(++_0x521214);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4de2e3,_0x7c3e2a){_0x4de2e3=_0x4de2e3-0x0;var _0x5df1c7=_0x9c00[_0x4de2e3];return _0x5df1c7;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['GetTrigger']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['Trigger'][_0x09c0('0x14')]({'raw':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x16')]||null:null,'attributes':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x17')]||null:null,'limit':_0x2c4440[_0x09c0('0x15')]?_0x2c4440['options'][_0x09c0('0x18')]||null:null,'include':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x19')]?_['map'](_0x2c4440['options'][_0x09c0('0x19')],function(_0x25fdb5){return{'model':db[_0x25fdb5[_0x09c0('0x1a')]],'as':_0x25fdb5['as'],'attributes':_0x25fdb5[_0x09c0('0x17')],'include':_0x25fdb5['include']?_[_0x09c0('0x1b')](_0x25fdb5[_0x09c0('0x19')],function(_0x56d883){return{'model':db[_0x56d883[_0x09c0('0x1a')]],'as':_0x56d883['as'],'attributes':_0x56d883[_0x09c0('0x17')],'include':_0x56d883[_0x09c0('0x19')]?_[_0x09c0('0x1b')](_0x56d883[_0x09c0('0x19')],function(_0x1d2d9d){return{'model':db[_0x1d2d9d[_0x09c0('0x1a')]],'as':_0x1d2d9d['as'],'attributes':_0x1d2d9d[_0x09c0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09c0('0x9')](function(_0x1aa80e){logger[_0x09c0('0xa')]('GetTrigger',_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x1c'),_0x2c4440,JSON['stringify'](_0x1aa80e));_0x4c29a7(_0x1aa80e);})[_0x09c0('0x13')](function(_0x5aa0b9){logger[_0x09c0('0x10')]('GetTrigger',_0x5aa0b9[_0x09c0('0x12')],_0x2c4440);_0x2c12da(_0x4aa8a5[_0x09c0('0x10')](0x1f4,_0x5aa0b9[_0x09c0('0x12')]));});});};exports[_0x09c0('0x1d')]=function(_0x4e999a){var _0x5478b7=this;return new Promise(function(_0x17c374,_0x38a315){return db[_0x09c0('0x1e')]['find']({'raw':_0x4e999a[_0x09c0('0x15')]?_0x4e999a['options'][_0x09c0('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')]['where']||null:null,'attributes':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')][_0x09c0('0x17')]||null:null,'include':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')][_0x09c0('0x19')]?_[_0x09c0('0x1b')](_0x4e999a['options'][_0x09c0('0x19')],function(_0x2c19be){return{'model':db[_0x2c19be[_0x09c0('0x1a')]],'as':_0x2c19be['as'],'attributes':_0x2c19be[_0x09c0('0x17')],'include':_0x2c19be[_0x09c0('0x19')]?_['map'](_0x2c19be[_0x09c0('0x19')],function(_0x20349e){return{'model':db[_0x20349e[_0x09c0('0x1a')]],'as':_0x20349e['as'],'attributes':_0x20349e[_0x09c0('0x17')],'include':_0x20349e[_0x09c0('0x19')]?_['map'](_0x20349e[_0x09c0('0x19')],function(_0x476537){return{'model':db[_0x476537[_0x09c0('0x1a')]],'as':_0x476537['as'],'attributes':_0x476537[_0x09c0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09c0('0x9')](function(_0x3e8b74){logger[_0x09c0('0xa')]('ShowTrigger',_0x4e999a);logger[_0x09c0('0xd')](_0x09c0('0x1d'),_0x4e999a,JSON[_0x09c0('0xf')](_0x3e8b74));_0x17c374(_0x3e8b74);})[_0x09c0('0x13')](function(_0x453c23){logger['error']('ShowTrigger',_0x453c23['message'],_0x4e999a);_0x38a315(_0x5478b7['error'](0x1f4,_0x453c23[_0x09c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1013a81..266599a 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 _0xedd9=['get','isAuthenticated','index','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x361ef5,_0x309214){var _0x271a93=function(_0x1d846c){while(--_0x1d846c){_0x361ef5['push'](_0x361ef5['shift']());}};_0x271a93(++_0x309214);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a8b9b,_0x21e4e1){_0x4a8b9b=_0x4a8b9b-0x0;var _0x1e50ca=_0xedd9[_0x4a8b9b];return _0x1e50ca;};'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('./trunk.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')](_0x9edd('0xc'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xd')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);module[_0x9edd('0x13')]=router; \ No newline at end of file +var _0x4c4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1b8e7e,_0x4fa73c){_0x1b8e7e=_0x1b8e7e-0x0;var _0x506f78=_0x4c4e[_0x1b8e7e];return _0x506f78;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./trunk.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0xc')](_0xe4c4('0xd'),auth[_0xe4c4('0xa')](),controller['clone']);router['post']('/',auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xe')]);router[_0xe4c4('0xf')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x10')]);router['delete'](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x11')]);module[_0xe4c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 9ee9c6b..2e0d573 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 _0x6772=['certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','user','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','auto','rfc2833','nonat','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','yes','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint'];(function(_0x27fdb6,_0x3b4b68){var _0x2f2f31=function(_0x19299a){while(--_0x19299a){_0x27fdb6['push'](_0x27fdb6['shift']());}};_0x2f2f31(++_0x3b4b68);}(_0x6772,0xfc));var _0x2677=function(_0x3ed3bd,_0x33afae){_0x3ed3bd=_0x3ed3bd-0x0;var _0x1ff90a=_0x6772[_0x3ed3bd];return _0x1ff90a;};'use strict';var Sequelize=require(_0x2677('0x0'));module[_0x2677('0x1')]={'name':{'type':Sequelize[_0x2677('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2677('0x3')]('friend',_0x2677('0x4'),_0x2677('0x5')),'allowNull':![],'defaultValue':_0x2677('0x6')},'context':{'type':Sequelize[_0x2677('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x7'),_0x2677('0x8'),_0x2677('0x9'),_0x2677('0xa'),_0x2677('0xb'),'PROHIB_PASSED_SCREEN',_0x2677('0xc'),_0x2677('0xd'))},'deny':{'type':Sequelize[_0x2677('0x2')]},'permit':{'type':Sequelize[_0x2677('0x2')]},'secret':{'type':Sequelize[_0x2677('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x2677('0x2')],'defaultValue':'udp','set':function(_0x15a7ae){this[_0x2677('0xe')](_0x2677('0xf'),_0x15a7ae?_0x15a7ae[_0x2677('0x10')](','):null);},'get':function(){return this[_0x2677('0x11')](_0x2677('0xf'))?this[_0x2677('0x11')](_0x2677('0xf'))[_0x2677('0x12')](','):null;},'comment':_0x2677('0x13')},'dtmfmode':{'type':Sequelize[_0x2677('0x3')]('rfc2833','info',_0x2677('0x14'),'inband',_0x2677('0x15')),'defaultValue':_0x2677('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2677('0x17'),'update',_0x2677('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2677('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2677('0x2')]},'nat':{'type':Sequelize[_0x2677('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x4d5297){this[_0x2677('0xe')](_0x2677('0x19'),_0x4d5297?_0x4d5297[_0x2677('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x2677('0x19'))?this['getDataValue'](_0x2677('0x19'))['split'](','):null;},'comment':_0x2677('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2677('0x2')]},'pickupgroup':{'type':Sequelize[_0x2677('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2677('0x2')]},'language':{'type':Sequelize[_0x2677('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2677('0x1b')},'allow':{'type':Sequelize[_0x2677('0x2')],'allowNull':![],'defaultValue':_0x2677('0x1c'),'set':function(_0x19afcf){this[_0x2677('0xe')](_0x2677('0x1d'),_0x19afcf?_0x19afcf[_0x2677('0x10')](';'):_0x2677('0x1c'));},'get':function(){return this[_0x2677('0x11')](_0x2677('0x1d'))?this[_0x2677('0x11')](_0x2677('0x1d'))[_0x2677('0x12')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'insecure':{'type':Sequelize[_0x2677('0x2')],'defaultValue':'port,invite','set':function(_0x2722df){this[_0x2677('0xe')](_0x2677('0x1f'),_0x2722df?_0x2722df[_0x2677('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x2677('0x1f'))?this[_0x2677('0x11')](_0x2677('0x1f'))[_0x2677('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2677('0x3')]('yes','no',_0x2677('0x20'))},'promiscredir':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'useclientcode':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'accountcode':{'type':Sequelize[_0x2677('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2677('0x2')],'defaultValue':_0x2677('0x22')},'amaflags':{'type':Sequelize[_0x2677('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no'),'defaultValue':_0x2677('0x1e')},'busylevel':{'type':Sequelize[_0x2677('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x2677('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'subscribecontext':{'type':Sequelize[_0x2677('0x2')]},'template':{'type':Sequelize[_0x2677('0x2')]},'videosupport':{'type':Sequelize[_0x2677('0x3')]('yes','no',_0x2677('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2677('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no')},'mailbox':{'type':Sequelize[_0x2677('0x2')]},'session_timers':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x24'),_0x2677('0x25'),_0x2677('0x26'))},'session_expires':{'type':Sequelize[_0x2677('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x2677('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x27'),'uas'),'defaultValue':_0x2677('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x2677('0x2')]},'regexten':{'type':Sequelize[_0x2677('0x2')]},'fromdomain':{'type':Sequelize[_0x2677('0x2')]},'fromuser':{'type':Sequelize[_0x2677('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2677('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x2677('0x2')]},'rtptimeout':{'type':Sequelize[_0x2677('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2677('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2677('0x21')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2677('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2677('0x21')](0xb)},'timerb':{'type':Sequelize[_0x2677('0x21')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2677('0x21')](0xb)},'contactpermit':{'type':Sequelize[_0x2677('0x2')]},'contactdeny':{'type':Sequelize[_0x2677('0x2')]},'contactacl':{'type':Sequelize[_0x2677('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2677('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2677('0x2')]},'maxforwards':{'type':Sequelize[_0x2677('0x21')](0xb)},'encryption':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no')},'force_avp':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'icesupport':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2677('0x1e'),'no')},'dtlsverify':{'type':Sequelize[_0x2677('0x3')]('yes','no',_0x2677('0x29'),_0x2677('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x2677('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2677('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x2677('0x2')]},'dtlscafile':{'type':Sequelize[_0x2677('0x2')]},'dtlscapath':{'type':Sequelize[_0x2677('0x2')]},'dtlssetup':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x2b'),_0x2677('0x2c'),_0x2677('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2677('0x2')]},'usereqphone':{'type':Sequelize[_0x2677('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2677('0x2')]},'recordofffeature':{'type':Sequelize[_0x2677('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2677('0x3')](_0x2677('0x1e'),'no')},'subscribemwi':{'type':Sequelize[_0x2677('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x2677('0x2')]},'mohinterpret':{'type':Sequelize[_0x2677('0x2')]},'mohsuggest':{'type':Sequelize[_0x2677('0x2')]},'parkinglot':{'type':Sequelize[_0x2677('0x2')]},'description':{'type':Sequelize[_0x2677('0x2')]},'host':{'type':Sequelize[_0x2677('0x2')],'defaultValue':_0x2677('0x2e')},'canreinvite':{'type':Sequelize[_0x2677('0x3')]('yes','no',_0x2677('0x17'),'update',_0x2677('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2677('0x2')]},'otherFields':{'type':Sequelize[_0x2677('0x2')]},'active':{'type':Sequelize[_0x2677('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2677('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5ede=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','originate','INTEGER','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','sequelize','exports','STRING','ENUM','user','peer','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','join','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow'];(function(_0xea15c2,_0x46caf7){var _0x1562cc=function(_0x1a602e){while(--_0x1a602e){_0xea15c2['push'](_0xea15c2['shift']());}};_0x1562cc(++_0x46caf7);}(_0x5ede,0x1ba));var _0xe5ed=function(_0xb93278,_0x59c02f){_0xb93278=_0xb93278-0x0;var _0x1cca3b=_0x5ede[_0xb93278];return _0x1cca3b;};'use strict';var Sequelize=require(_0xe5ed('0x0'));module[_0xe5ed('0x1')]={'name':{'type':Sequelize[_0xe5ed('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe5ed('0x3')]('friend',_0xe5ed('0x4'),_0xe5ed('0x5')),'allowNull':![],'defaultValue':_0xe5ed('0x6')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe5ed('0x7')},'callingpres':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x8'),_0xe5ed('0x9'),_0xe5ed('0xa'),_0xe5ed('0xb'),_0xe5ed('0xc'),_0xe5ed('0xd'),'PROHIB_FAILED_SCREEN',_0xe5ed('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xe5ed('0x2')]},'secret':{'type':Sequelize[_0xe5ed('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe5ed('0x2')]},'transport':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':_0xe5ed('0xf'),'set':function(_0x347469){this[_0xe5ed('0x10')]('transport',_0x347469?_0x347469[_0xe5ed('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xe5ed('0x12'))?this[_0xe5ed('0x13')](_0xe5ed('0x12'))['split'](','):null;},'comment':_0xe5ed('0x14')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xe5ed('0x15'),'shortinfo',_0xe5ed('0x16'),_0xe5ed('0x17')),'defaultValue':_0xe5ed('0x18')},'directmedia':{'type':Sequelize['ENUM'](_0xe5ed('0x19'),'no','nonat',_0xe5ed('0x1a'),_0xe5ed('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xe5ed('0x2')]},'nat':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':_0xe5ed('0x1c'),'set':function(_0xad85d0){this[_0xe5ed('0x10')](_0xe5ed('0x1d'),_0xad85d0?_0xad85d0[_0xe5ed('0x11')](','):null);},'get':function(){return this[_0xe5ed('0x13')](_0xe5ed('0x1d'))?this[_0xe5ed('0x13')]('nat')[_0xe5ed('0x1e')](','):null;},'comment':_0xe5ed('0x1f')},'callgroup':{'type':Sequelize[_0xe5ed('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe5ed('0x2')]},'pickupgroup':{'type':Sequelize[_0xe5ed('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe5ed('0x2')]},'language':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':_0xe5ed('0x20')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe5ed('0x21'),'set':function(_0x2be2f5){this[_0xe5ed('0x10')](_0xe5ed('0x22'),_0x2be2f5?_0x2be2f5[_0xe5ed('0x11')](';'):_0xe5ed('0x21'));},'get':function(){return this['getDataValue'](_0xe5ed('0x22'))?this[_0xe5ed('0x13')]('allow')[_0xe5ed('0x1e')](';'):null;},'comment':_0xe5ed('0x23')},'autoframing':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'insecure':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':'port,invite','set':function(_0x5908f9){this[_0xe5ed('0x10')](_0xe5ed('0x24'),_0x5908f9?_0x5908f9[_0xe5ed('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xe5ed('0x24'))?this['getDataValue'](_0xe5ed('0x24'))[_0xe5ed('0x1e')](','):null;},'comment':_0xe5ed('0x25')},'trustrpid':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0xe5ed('0x26'))},'promiscredir':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xe5ed('0x3')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xe5ed('0x2')]},'callerid':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':_0xe5ed('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0xe5ed('0x19'),'no'),'defaultValue':_0xe5ed('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xe5ed('0x2')]},'template':{'type':Sequelize[_0xe5ed('0x2')]},'videosupport':{'type':Sequelize[_0xe5ed('0x3')]('yes','no',_0xe5ed('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'mailbox':{'type':Sequelize[_0xe5ed('0x2')]},'session_timers':{'type':Sequelize[_0xe5ed('0x3')]('accept','refuse',_0xe5ed('0x29'))},'session_expires':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x2b'),_0xe5ed('0x2c')),'defaultValue':_0xe5ed('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xe5ed('0x2')]},'regexten':{'type':Sequelize[_0xe5ed('0x2')]},'fromdomain':{'type':Sequelize[_0xe5ed('0x2')]},'fromuser':{'type':Sequelize[_0xe5ed('0x2')]},'port':{'type':Sequelize[_0xe5ed('0x2a')](0x5)},'qualify':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'defaultip':{'type':Sequelize[_0xe5ed('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'sendrpid':{'type':Sequelize[_0xe5ed('0x3')]('yes','no',_0xe5ed('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe5ed('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xe5ed('0x2')]},'contactdeny':{'type':Sequelize[_0xe5ed('0x2')]},'contactacl':{'type':Sequelize[_0xe5ed('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xe5ed('0x2')]},'use_q850_reason':{'type':Sequelize[_0xe5ed('0x2')]},'maxforwards':{'type':Sequelize[_0xe5ed('0x2a')](0xb)},'encryption':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xe5ed('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x19'),'no',_0xe5ed('0x2e'),_0xe5ed('0x2f'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xe5ed('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xe5ed('0x2')]},'dtlscipher':{'type':Sequelize[_0xe5ed('0x2')]},'dtlscafile':{'type':Sequelize[_0xe5ed('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xe5ed('0x3')](_0xe5ed('0x30'),_0xe5ed('0x31'),_0xe5ed('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe5ed('0x2')]},'usereqphone':{'type':Sequelize[_0xe5ed('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe5ed('0x2')]},'recordofffeature':{'type':Sequelize[_0xe5ed('0x2')]},'call_limit':{'type':Sequelize[_0xe5ed('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xe5ed('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xe5ed('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xe5ed('0x2')]},'mohinterpret':{'type':Sequelize[_0xe5ed('0x2')]},'mohsuggest':{'type':Sequelize[_0xe5ed('0x2')]},'parkinglot':{'type':Sequelize[_0xe5ed('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':_0xe5ed('0x33')},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0xe5ed('0x1a'),_0xe5ed('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xe5ed('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe5ed('0x2')],'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 54e50ee..7d472da 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 _0xa6c9=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','server/files/templates/trunk.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','sendStatus','name','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','show','params','length','find','clone','omit','createdAt','updatedAt','body','user'];(function(_0x3c53bf,_0x43f522){var _0x55ebb6=function(_0x5a73ec){while(--_0x5a73ec){_0x3c53bf['push'](_0x3c53bf['shift']());}};_0x55ebb6(++_0x43f522);}(_0xa6c9,0xef));var _0x9a6c=function(_0x45b992,_0x2c390a){_0x45b992=_0x45b992-0x0;var _0x4b92df=_0xa6c9[_0x45b992];return _0x4b92df;};'use strict';var pdf=require(_0x9a6c('0x0'));var emlformat=require(_0x9a6c('0x1'));var rimraf=require(_0x9a6c('0x2'));var zipdir=require(_0x9a6c('0x3'));var jsonpatch=require(_0x9a6c('0x4'));var rp=require(_0x9a6c('0x5'));var moment=require(_0x9a6c('0x6'));var BPromise=require(_0x9a6c('0x7'));var Mustache=require('mustache');var util=require(_0x9a6c('0x8'));var path=require('path');var sox=require(_0x9a6c('0x9'));var csv=require('to-csv');var ejs=require(_0x9a6c('0xa'));var fs=require('fs');var _=require(_0x9a6c('0xb'));var squel=require(_0x9a6c('0xc'));var crypto=require(_0x9a6c('0xd'));var jsforce=require(_0x9a6c('0xe'));var deskjs=require(_0x9a6c('0xf'));var toCsv=require(_0x9a6c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a6c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a6c('0x12'));var logger=require(_0x9a6c('0x13'))(_0x9a6c('0x14'));var utils=require('../../config/utils');var config=require(_0x9a6c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9a6c('0x16'));var client=jayson[_0x9a6c('0x17')][_0x9a6c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4e3558,_0x2ca500,_0x5bc2e5,_0x3248a5){return new BPromise(function(_0x4d8f37,_0x2064d2){var _0x3fc7aa=_0x3248a5||client;return _0x3fc7aa[_0x9a6c('0x19')](_0x4e3558,_0x5bc2e5)[_0x9a6c('0x1a')](function(_0x4b4dd4){logger[_0x9a6c('0x1b')](_0x9a6c('0x1c'),_0x2ca500,_0x9a6c('0x1d'));logger[_0x9a6c('0x1e')](_0x9a6c('0x1f'),_0x2ca500,_0x9a6c('0x1d'),JSON[_0x9a6c('0x20')](_0x4b4dd4));if(_0x4b4dd4['error']){if(_0x4b4dd4[_0x9a6c('0x21')][_0x9a6c('0x22')]===0x1f4){logger['error'](_0x9a6c('0x1c'),_0x2ca500,_0x4b4dd4['error'][_0x9a6c('0x23')]);return _0x2064d2(_0x4b4dd4['error']['message']);}logger[_0x9a6c('0x21')](_0x9a6c('0x1c'),_0x2ca500,_0x4b4dd4[_0x9a6c('0x21')]['message']);return _0x4d8f37(_0x4b4dd4[_0x9a6c('0x21')][_0x9a6c('0x23')]);}else{logger['info'](_0x9a6c('0x1c'),_0x2ca500,'request\x20sent');_0x4d8f37(_0x4b4dd4[_0x9a6c('0x24')][_0x9a6c('0x23')]);}})[_0x9a6c('0x25')](function(_0x2ebcfe){logger[_0x9a6c('0x21')](_0x9a6c('0x1c'),_0x2ca500,_0x2ebcfe);_0x2064d2(_0x2ebcfe);});});}function respondWithStatusCode(_0x1e90ee,_0x461429){_0x461429=_0x461429||0xcc;return function(_0x3e9301){if(_0x3e9301){return _0x1e90ee['sendStatus'](_0x461429);}return _0x1e90ee[_0x9a6c('0x26')](_0x461429)[_0x9a6c('0x27')]();};}function respondWithResult(_0xf68bfc,_0x35a55c){_0x35a55c=_0x35a55c||0xc8;return function(_0x4a96e9){if(_0x4a96e9){return _0xf68bfc['status'](_0x35a55c)[_0x9a6c('0x28')](_0x4a96e9);}};}function respondWithFilteredResult(_0x3948d4,_0x1dcdec){return function(_0x206c48){if(_0x206c48){var _0x97318c=_0x206c48[_0x9a6c('0x29')],_0x3a3759=_0x1dcdec[_0x9a6c('0x2a')],_0x3e67e5=_0x1dcdec['offset']+_0x1dcdec[_0x9a6c('0x2b')],_0x2b305a;if(_0x3e67e5>=_0x97318c){_0x3e67e5=_0x97318c;_0x2b305a=0xc8;}else{_0x2b305a=0xce;}_0x3948d4[_0x9a6c('0x26')](_0x2b305a);return _0x3948d4[_0x9a6c('0x2c')](_0x9a6c('0x2d'),_0x3a3759+'-'+_0x3e67e5+'/'+_0x97318c)[_0x9a6c('0x28')](_0x206c48);}return null;};}function patchUpdates(_0x1e6f96){return function(_0x38e93d){try{jsonpatch[_0x9a6c('0x2e')](_0x38e93d,_0x1e6f96,!![]);}catch(_0xe31e68){return BPromise[_0x9a6c('0x2f')](_0xe31e68);}return _0x38e93d['save']();};}function saveUpdates(_0x1e8468,_0x4c445b){return function(_0x401d47){if(_0x401d47){return _0x401d47[_0x9a6c('0x30')](_0x1e8468)[_0x9a6c('0x1a')](function(_0x4c6231){return _0x4c6231;});}return null;};}function removeEntity(_0xac3a90,_0x57d685){return function(_0x5145eb){if(_0x5145eb){return _0x5145eb[_0x9a6c('0x31')]()[_0x9a6c('0x1a')](function(){var _0xe0b93e=_0x5145eb[_0x9a6c('0x32')]({'plain':!![]});var _0x430d6b=_0x9a6c('0x33');return db[_0x9a6c('0x34')][_0x9a6c('0x31')]({'where':{'type':_0x430d6b,'resourceId':_0xe0b93e['id']}})[_0x9a6c('0x1a')](function(){return _0x5145eb;});})['then'](function(){_0xac3a90[_0x9a6c('0x26')](0xcc)[_0x9a6c('0x27')]();});}};}function handleEntityNotFound(_0x55098c,_0x9ca83d){return function(_0x367a79){if(!_0x367a79){_0x55098c[_0x9a6c('0x35')](0x194);}return _0x367a79;};}function handleError(_0x1fd9e9,_0x2af215){_0x2af215=_0x2af215||0x1f4;return function(_0x40acd7){logger[_0x9a6c('0x21')](_0x40acd7['stack']);if(_0x40acd7[_0x9a6c('0x36')]){delete _0x40acd7[_0x9a6c('0x36')];}_0x1fd9e9[_0x9a6c('0x26')](_0x2af215)['send'](_0x40acd7);};}exports[_0x9a6c('0x37')]=function(_0x38d660,_0x3a6229){var _0x4ddc2e={},_0x3a13eb={},_0x4113a1={'count':0x0,'rows':[]};var _0x2de9c0=_[_0x9a6c('0x38')](db[_0x9a6c('0x39')][_0x9a6c('0x3a')],function(_0x5448eb){return{'name':_0x5448eb['fieldName'],'type':_0x5448eb['type'][_0x9a6c('0x3b')]};});_0x3a13eb[_0x9a6c('0x3c')]=_[_0x9a6c('0x38')](_0x2de9c0,_0x9a6c('0x36'));_0x3a13eb[_0x9a6c('0x3d')]=_[_0x9a6c('0x3e')](_0x38d660[_0x9a6c('0x3d')]);_0x3a13eb['filters']=_[_0x9a6c('0x3f')](_0x3a13eb[_0x9a6c('0x3c')],_0x3a13eb[_0x9a6c('0x3d')]);_0x4ddc2e[_0x9a6c('0x40')]=_['intersection'](_0x3a13eb['model'],qs['fields'](_0x38d660[_0x9a6c('0x3d')][_0x9a6c('0x41')]));_0x4ddc2e['attributes']=_0x4ddc2e[_0x9a6c('0x40')]['length']?_0x4ddc2e['attributes']:_0x3a13eb[_0x9a6c('0x3c')];if(!_0x38d660[_0x9a6c('0x3d')]['hasOwnProperty'](_0x9a6c('0x42'))){_0x4ddc2e[_0x9a6c('0x2b')]=qs[_0x9a6c('0x2b')](_0x38d660['query']['limit']);_0x4ddc2e['offset']=qs[_0x9a6c('0x2a')](_0x38d660[_0x9a6c('0x3d')][_0x9a6c('0x2a')]);}_0x4ddc2e['order']=qs[_0x9a6c('0x43')](_0x38d660[_0x9a6c('0x3d')]['sort']);_0x4ddc2e[_0x9a6c('0x44')]=qs[_0x9a6c('0x45')](_[_0x9a6c('0x46')](_0x38d660[_0x9a6c('0x3d')],_0x3a13eb[_0x9a6c('0x45')]),_0x2de9c0);if(_0x38d660[_0x9a6c('0x3d')]['filter']){_0x4ddc2e[_0x9a6c('0x44')]=_[_0x9a6c('0x47')](_0x4ddc2e['where'],{'$or':_['map'](_0x2de9c0,function(_0x7382a9){if(_0x7382a9[_0x9a6c('0x48')]!==_0x9a6c('0x49')){var _0x23cc82={};_0x23cc82[_0x7382a9[_0x9a6c('0x36')]]={'$like':'%'+_0x38d660['query'][_0x9a6c('0x4a')]+'%'};return _0x23cc82;}})});}_0x4ddc2e=_[_0x9a6c('0x47')]({},_0x4ddc2e,_0x38d660[_0x9a6c('0x4b')]);var _0x1e5de3={'where':_0x4ddc2e[_0x9a6c('0x44')]};return db['Trunk'][_0x9a6c('0x29')](_0x1e5de3)[_0x9a6c('0x1a')](function(_0x2fee76){_0x4113a1[_0x9a6c('0x29')]=_0x2fee76;if(_0x38d660[_0x9a6c('0x3d')][_0x9a6c('0x4c')]){_0x4ddc2e[_0x9a6c('0x4d')]=[{'all':!![]}];}return db[_0x9a6c('0x39')]['findAll'](_0x4ddc2e);})['then'](function(_0x174db2){_0x4113a1['rows']=_0x174db2;return _0x4113a1;})[_0x9a6c('0x1a')](respondWithFilteredResult(_0x3a6229,_0x4ddc2e))[_0x9a6c('0x25')](handleError(_0x3a6229,null));};exports[_0x9a6c('0x4e')]=function(_0x2db865,_0x5c94d5){var _0x2c9332={'raw':![],'where':{'id':_0x2db865[_0x9a6c('0x4f')]['id']}},_0xe43d2={};_0xe43d2['model']=_['keys'](db['Trunk']['rawAttributes']);_0xe43d2[_0x9a6c('0x3d')]=_[_0x9a6c('0x3e')](_0x2db865[_0x9a6c('0x3d')]);_0xe43d2['filtears']=_[_0x9a6c('0x3f')](_0xe43d2[_0x9a6c('0x3c')],_0xe43d2[_0x9a6c('0x3d')]);_0x2c9332[_0x9a6c('0x40')]=_[_0x9a6c('0x3f')](_0xe43d2[_0x9a6c('0x3c')],qs[_0x9a6c('0x41')](_0x2db865[_0x9a6c('0x3d')]['fields']));_0x2c9332['attributes']=_0x2c9332['attributes'][_0x9a6c('0x50')]?_0x2c9332['attributes']:_0xe43d2['model'];if(_0x2db865[_0x9a6c('0x3d')][_0x9a6c('0x4c')]){_0x2c9332[_0x9a6c('0x4d')]=[{'all':!![]}];}_0x2c9332=_[_0x9a6c('0x47')]({},_0x2c9332,_0x2db865['options']);return db[_0x9a6c('0x39')][_0x9a6c('0x51')](_0x2c9332)['then'](handleEntityNotFound(_0x5c94d5,null))[_0x9a6c('0x1a')](respondWithResult(_0x5c94d5,null))[_0x9a6c('0x25')](handleError(_0x5c94d5,null));};exports[_0x9a6c('0x52')]=function(_0x4432db,_0x32cc29){var _0x169e71={'where':{'id':_0x4432db['params']['id']}},_0x32ff9e={};_0x32ff9e[_0x9a6c('0x3c')]=_[_0x9a6c('0x3e')](db[_0x9a6c('0x39')][_0x9a6c('0x3a')]);_0x169e71[_0x9a6c('0x40')]=_[_0x9a6c('0x3f')](_0x32ff9e[_0x9a6c('0x3c')],qs[_0x9a6c('0x41')](_0x4432db['query'][_0x9a6c('0x41')]));_0x169e71['attributes']=_0x169e71[_0x9a6c('0x40')]['length']?_0x169e71[_0x9a6c('0x40')]:_0x32ff9e[_0x9a6c('0x3c')];if(_0x4432db[_0x9a6c('0x3d')][_0x9a6c('0x4c')]){_0x169e71[_0x9a6c('0x4d')]=[{'all':!![]}];}_0x169e71=_[_0x9a6c('0x47')]({},_0x169e71,_0x4432db[_0x9a6c('0x4b')]);return db['Trunk'][_0x9a6c('0x51')](_0x169e71)['then'](handleEntityNotFound(_0x32cc29,null))['then'](function(_0x2fcbb6){if(_0x2fcbb6){var _0x3860fb=_0x2fcbb6[_0x9a6c('0x32')]({'plain':!![]});_0x3860fb=qs[_0x9a6c('0x53')](_0x3860fb,['id',_0x9a6c('0x54'),_0x9a6c('0x55')]);_0x4432db[_0x9a6c('0x56')]=_[_0x9a6c('0x53')](_0x4432db['body'],['id',_0x9a6c('0x54'),'updatedAt']);return db[_0x9a6c('0x39')]['create'](_[_0x9a6c('0x47')](_0x3860fb,_0x4432db['body']),{'include':_0x4432db[_0x9a6c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x9a6c('0x1a')](function(_0x173e18){var _0x15d1c2=_0x4432db[_0x9a6c('0x57')][_0x9a6c('0x32')]({'plain':!![]});if(!_0x15d1c2)throw new Error(_0x9a6c('0x58'));if(_0x15d1c2[_0x9a6c('0x59')]===_0x9a6c('0x57')){var _0x1c0284=_0x173e18[_0x9a6c('0x32')]({'plain':!![]});var _0x1ff8d5='Trunks';return db[_0x9a6c('0x5a')]['find']({'where':{'name':_0x1ff8d5,'userProfileId':_0x15d1c2[_0x9a6c('0x5b')]},'raw':!![]})['then'](function(_0x23da52){if(_0x23da52&&_0x23da52[_0x9a6c('0x5c')]===0x0){return db[_0x9a6c('0x34')][_0x9a6c('0x5d')]({'name':_0x1c0284[_0x9a6c('0x36')],'resourceId':_0x1c0284['id'],'type':_0x23da52[_0x9a6c('0x36')],'sectionId':_0x23da52['id']},{})['then'](function(){return _0x173e18;});}else{return _0x173e18;}})['catch'](function(_0x5192c4){logger[_0x9a6c('0x21')](_0x9a6c('0x5e'),_0x5192c4);throw _0x5192c4;});}return _0x173e18;});}})['then'](respondWithResult(_0x32cc29,0xc9))['catch'](handleError(_0x32cc29,null));};exports['create']=function(_0x266e84,_0x295e87,_0x361841){var _0x57545c;return db[_0x9a6c('0x39')][_0x9a6c('0x5d')](_0x266e84[_0x9a6c('0x56')],{'raw':!![]})[_0x9a6c('0x1a')](function(_0x10b09b){_0x57545c=_0x10b09b;return db[_0x9a6c('0x39')][_0x9a6c('0x5f')]({'raw':!![]});})[_0x9a6c('0x1a')](function(_0xce7ab9){var _0x3991df=fs[_0x9a6c('0x60')](path[_0x9a6c('0x61')](config[_0x9a6c('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x20db48=fs[_0x9a6c('0x60')](path[_0x9a6c('0x61')](config[_0x9a6c('0x62')],_0x9a6c('0x63')),_0x9a6c('0x64'));var _0x1e1351=ejs['render'](_0x3991df,{'trunks':_0xce7ab9||[]});fs[_0x9a6c('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1e1351);if(_0x57545c[_0x9a6c('0x66')]){var _0x56b447=ejs[_0x9a6c('0x67')](_0x20db48,{'trunks':_0xce7ab9||[]});fs['writeFileSync'](_0x9a6c('0x68'),_0x56b447);}})[_0x9a6c('0x1a')](function(){return respondWithRpcPromise(_0x9a6c('0x69'),_0x9a6c('0x5d'),{'module':'chan_sip.so'});})['then'](function(){var _0x273230=_0x266e84['user'][_0x9a6c('0x32')]({'plain':!![]});if(!_0x273230)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x273230[_0x9a6c('0x59')]==='user'){var _0x19901f=_0x57545c[_0x9a6c('0x32')]({'plain':!![]});return db[_0x9a6c('0x5a')]['find']({'where':{'name':'Trunks','userProfileId':_0x273230['userProfileId']},'raw':!![]})[_0x9a6c('0x1a')](function(_0x15cf07){if(_0x15cf07&&_0x15cf07[_0x9a6c('0x5c')]===0x0){return db[_0x9a6c('0x34')]['create']({'name':_0x19901f['name'],'resourceId':_0x19901f['id'],'type':_0x15cf07['name'],'sectionId':_0x15cf07['id']},{})['then'](function(){return _0x57545c;});}else{return _0x57545c;}})[_0x9a6c('0x25')](function(_0x451fe7){logger[_0x9a6c('0x21')](_0x9a6c('0x5e'),_0x451fe7);throw _0x451fe7;});}return _0x57545c;})[_0x9a6c('0x1a')](respondWithResult(_0x295e87,0xc9))['catch'](handleError(_0x295e87,null));};exports[_0x9a6c('0x30')]=function(_0x119a40,_0x58376a,_0x1c4cd4){var _0x4ab137;return db[_0x9a6c('0x39')]['find']({'where':{'id':_0x119a40[_0x9a6c('0x4f')]['id']}})[_0x9a6c('0x1a')](handleEntityNotFound(_0x58376a,null))[_0x9a6c('0x1a')](saveUpdates(_0x119a40[_0x9a6c('0x56')],null))[_0x9a6c('0x1a')](function(_0x2c51cf){if(_0x2c51cf){_0x4ab137=_0x2c51cf;return db['Trunk']['findAll']({'raw':!![]});}})[_0x9a6c('0x1a')](function(_0x361b5f){if(_0x361b5f){var _0x2dea6e=fs[_0x9a6c('0x60')](path['join'](config[_0x9a6c('0x62')],'server/files/templates/trunk.ejs'),_0x9a6c('0x64'));var _0x4e7e28=fs['readFileSync'](path[_0x9a6c('0x61')](config[_0x9a6c('0x62')],'server/files/templates/registry.ejs'),_0x9a6c('0x64'));var _0x3a06d3=ejs[_0x9a6c('0x67')](_0x2dea6e,{'trunks':_0x361b5f||[]});fs[_0x9a6c('0x65')](_0x9a6c('0x6a'),_0x3a06d3);var _0x42e314=ejs['render'](_0x4e7e28,{'trunks':_0x361b5f||[]});fs[_0x9a6c('0x65')](_0x9a6c('0x68'),_0x42e314);return respondWithRpcPromise(_0x9a6c('0x69'),_0x9a6c('0x30'),{'module':_0x9a6c('0x6b')});}return null;})[_0x9a6c('0x1a')](function(_0x1b0900){if(_0x1b0900){return _0x4ab137;}})[_0x9a6c('0x1a')](respondWithResult(_0x58376a,null))[_0x9a6c('0x25')](handleError(_0x58376a,null));};exports['destroy']=function(_0x1130be,_0x5b130f,_0x39b8d7){var _0x1156f1;return db[_0x9a6c('0x39')][_0x9a6c('0x51')]({'where':{'id':_0x1130be[_0x9a6c('0x4f')]['id']}})[_0x9a6c('0x1a')](handleEntityNotFound(_0x5b130f,null))[_0x9a6c('0x1a')](removeEntity(_0x5b130f,null))[_0x9a6c('0x1a')](function(){return db[_0x9a6c('0x39')][_0x9a6c('0x5f')]({'raw':!![]});})['then'](function(_0xdbc750){var _0x59e947=fs['readFileSync'](path['join'](config[_0x9a6c('0x62')],_0x9a6c('0x6c')),_0x9a6c('0x64'));var _0x5548b0=fs[_0x9a6c('0x60')](path['join'](config[_0x9a6c('0x62')],_0x9a6c('0x63')),_0x9a6c('0x64'));var _0x45f81a=ejs[_0x9a6c('0x67')](_0x59e947,{'trunks':_0xdbc750});var _0x3ed3cd=ejs[_0x9a6c('0x67')](_0x5548b0,{'trunks':_0xdbc750});fs[_0x9a6c('0x65')](_0x9a6c('0x6a'),_0x45f81a);fs[_0x9a6c('0x65')](_0x9a6c('0x68'),_0x3ed3cd);return respondWithRpcPromise(_0x9a6c('0x69'),'destroy',{'module':_0x9a6c('0x6b')});})[_0x9a6c('0x25')](handleError(_0x5b130f,null));}; \ No newline at end of file +var _0x4b0c=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','writeFileSync','registry','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','render','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','get','Trunks','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','where','pick','filter','merge','options','Trunk','count','includeAll','include','rows','catch','show','params','filtears','find','clone','omit','createdAt','updatedAt','body','create'];(function(_0x179fa9,_0x451588){var _0x2017e9=function(_0x4d5af6){while(--_0x4d5af6){_0x179fa9['push'](_0x179fa9['shift']());}};_0x2017e9(++_0x451588);}(_0x4b0c,0x85));var _0xc4b0=function(_0x603f59,_0x215b88){_0x603f59=_0x603f59-0x0;var _0x47ed14=_0x4b0c[_0x603f59];return _0x47ed14;};'use strict';var pdf=require(_0xc4b0('0x0'));var emlformat=require(_0xc4b0('0x1'));var rimraf=require(_0xc4b0('0x2'));var zipdir=require(_0xc4b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc4b0('0x4'));var BPromise=require(_0xc4b0('0x5'));var Mustache=require(_0xc4b0('0x6'));var util=require(_0xc4b0('0x7'));var path=require(_0xc4b0('0x8'));var sox=require(_0xc4b0('0x9'));var csv=require(_0xc4b0('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc4b0('0xb'));var crypto=require(_0xc4b0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4b0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc4b0('0xe'));var Papa=require(_0xc4b0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4b0('0x10'));var as=require(_0xc4b0('0x11'));var hardwareService=require(_0xc4b0('0x12'));var logger=require(_0xc4b0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xc4b0('0x14'));var licenseUtil=require(_0xc4b0('0x15'));var db=require(_0xc4b0('0x16'))['db'];var jayson=require(_0xc4b0('0x17'));var client=jayson[_0xc4b0('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30f923,_0x4596c1,_0x4a2bbf,_0x3b3d2d){return new BPromise(function(_0x1b18fc,_0x2000db){var _0x16fe06=_0x3b3d2d||client;return _0x16fe06[_0xc4b0('0x19')](_0x30f923,_0x4a2bbf)[_0xc4b0('0x1a')](function(_0x453f0b){logger[_0xc4b0('0x1b')](_0xc4b0('0x1c'),_0x4596c1,'request\x20sent');logger[_0xc4b0('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x4596c1,_0xc4b0('0x1e'),JSON[_0xc4b0('0x1f')](_0x453f0b));if(_0x453f0b[_0xc4b0('0x20')]){if(_0x453f0b[_0xc4b0('0x20')][_0xc4b0('0x21')]===0x1f4){logger[_0xc4b0('0x20')]('Trunk,\x20%s,\x20%s',_0x4596c1,_0x453f0b['error'][_0xc4b0('0x22')]);return _0x2000db(_0x453f0b['error'][_0xc4b0('0x22')]);}logger[_0xc4b0('0x20')]('Trunk,\x20%s,\x20%s',_0x4596c1,_0x453f0b[_0xc4b0('0x20')][_0xc4b0('0x22')]);return _0x1b18fc(_0x453f0b[_0xc4b0('0x20')][_0xc4b0('0x22')]);}else{logger['info'](_0xc4b0('0x1c'),_0x4596c1,_0xc4b0('0x1e'));_0x1b18fc(_0x453f0b[_0xc4b0('0x23')]['message']);}})['catch'](function(_0x486588){logger[_0xc4b0('0x20')](_0xc4b0('0x1c'),_0x4596c1,_0x486588);_0x2000db(_0x486588);});});}function respondWithStatusCode(_0x13c43e,_0xedbc73){_0xedbc73=_0xedbc73||0xcc;return function(_0xb5f8a2){if(_0xb5f8a2){return _0x13c43e[_0xc4b0('0x24')](_0xedbc73);}return _0x13c43e['status'](_0xedbc73)['end']();};}function respondWithResult(_0x3dabc,_0x2ba7b5){_0x2ba7b5=_0x2ba7b5||0xc8;return function(_0x32d52a){if(_0x32d52a){return _0x3dabc[_0xc4b0('0x25')](_0x2ba7b5)[_0xc4b0('0x26')](_0x32d52a);}};}function respondWithFilteredResult(_0x42c5dc,_0x50fcbb){return function(_0x828b0b){if(_0x828b0b){var _0x18eecf=_0x828b0b['count'],_0x363ed0=_0x50fcbb[_0xc4b0('0x27')],_0x24c1f6=_0x50fcbb[_0xc4b0('0x27')]+_0x50fcbb['limit'],_0x1db8bf;if(_0x24c1f6>=_0x18eecf){_0x24c1f6=_0x18eecf;_0x1db8bf=0xc8;}else{_0x1db8bf=0xce;}_0x42c5dc[_0xc4b0('0x25')](_0x1db8bf);return _0x42c5dc[_0xc4b0('0x28')](_0xc4b0('0x29'),_0x363ed0+'-'+_0x24c1f6+'/'+_0x18eecf)[_0xc4b0('0x26')](_0x828b0b);}return null;};}function patchUpdates(_0xe729ab){return function(_0x2ef180){try{jsonpatch[_0xc4b0('0x2a')](_0x2ef180,_0xe729ab,!![]);}catch(_0x3e2bb3){return BPromise[_0xc4b0('0x2b')](_0x3e2bb3);}return _0x2ef180[_0xc4b0('0x2c')]();};}function saveUpdates(_0x191ed4,_0x46deac){return function(_0x24b798){if(_0x24b798){return _0x24b798[_0xc4b0('0x2d')](_0x191ed4)[_0xc4b0('0x1a')](function(_0x4474c5){return _0x4474c5;});}return null;};}function removeEntity(_0x1ef3dd,_0x4f2c10){return function(_0x28df6f){if(_0x28df6f){return _0x28df6f[_0xc4b0('0x2e')]()[_0xc4b0('0x1a')](function(){var _0x24cccc=_0x28df6f[_0xc4b0('0x2f')]({'plain':!![]});var _0x303377=_0xc4b0('0x30');return db['UserProfileResource'][_0xc4b0('0x2e')]({'where':{'type':_0x303377,'resourceId':_0x24cccc['id']}})[_0xc4b0('0x1a')](function(){return _0x28df6f;});})[_0xc4b0('0x1a')](function(){_0x1ef3dd[_0xc4b0('0x25')](0xcc)[_0xc4b0('0x31')]();});}};}function handleEntityNotFound(_0x234810,_0x5b84e9){return function(_0x48b9f8){if(!_0x48b9f8){_0x234810[_0xc4b0('0x24')](0x194);}return _0x48b9f8;};}function handleError(_0x385725,_0x480bfb){_0x480bfb=_0x480bfb||0x1f4;return function(_0x15628d){logger[_0xc4b0('0x20')](_0x15628d[_0xc4b0('0x32')]);if(_0x15628d[_0xc4b0('0x33')]){delete _0x15628d[_0xc4b0('0x33')];}_0x385725[_0xc4b0('0x25')](_0x480bfb)[_0xc4b0('0x34')](_0x15628d);};}exports[_0xc4b0('0x35')]=function(_0x477ed6,_0x3ab939){var _0x14e66a={},_0x5cc325={},_0x474747={'count':0x0,'rows':[]};var _0x446a9a=_['map'](db['Trunk'][_0xc4b0('0x36')],function(_0x5f08c6){return{'name':_0x5f08c6[_0xc4b0('0x37')],'type':_0x5f08c6[_0xc4b0('0x38')][_0xc4b0('0x39')]};});_0x5cc325[_0xc4b0('0x3a')]=_[_0xc4b0('0x3b')](_0x446a9a,'name');_0x5cc325[_0xc4b0('0x3c')]=_[_0xc4b0('0x3d')](_0x477ed6[_0xc4b0('0x3c')]);_0x5cc325[_0xc4b0('0x3e')]=_['intersection'](_0x5cc325[_0xc4b0('0x3a')],_0x5cc325['query']);_0x14e66a[_0xc4b0('0x3f')]=_[_0xc4b0('0x40')](_0x5cc325['model'],qs[_0xc4b0('0x41')](_0x477ed6['query'][_0xc4b0('0x41')]));_0x14e66a['attributes']=_0x14e66a['attributes'][_0xc4b0('0x42')]?_0x14e66a[_0xc4b0('0x3f')]:_0x5cc325[_0xc4b0('0x3a')];if(!_0x477ed6['query'][_0xc4b0('0x43')]('nolimit')){_0x14e66a[_0xc4b0('0x44')]=qs[_0xc4b0('0x44')](_0x477ed6[_0xc4b0('0x3c')][_0xc4b0('0x44')]);_0x14e66a[_0xc4b0('0x27')]=qs[_0xc4b0('0x27')](_0x477ed6[_0xc4b0('0x3c')][_0xc4b0('0x27')]);}_0x14e66a[_0xc4b0('0x45')]=qs['sort'](_0x477ed6['query']['sort']);_0x14e66a[_0xc4b0('0x46')]=qs[_0xc4b0('0x3e')](_[_0xc4b0('0x47')](_0x477ed6[_0xc4b0('0x3c')],_0x5cc325[_0xc4b0('0x3e')]),_0x446a9a);if(_0x477ed6['query'][_0xc4b0('0x48')]){_0x14e66a[_0xc4b0('0x46')]=_[_0xc4b0('0x49')](_0x14e66a[_0xc4b0('0x46')],{'$or':_[_0xc4b0('0x3b')](_0x446a9a,function(_0x281d3f){if(_0x281d3f[_0xc4b0('0x38')]!=='VIRTUAL'){var _0x517d8={};_0x517d8[_0x281d3f[_0xc4b0('0x33')]]={'$like':'%'+_0x477ed6['query'][_0xc4b0('0x48')]+'%'};return _0x517d8;}})});}_0x14e66a=_['merge']({},_0x14e66a,_0x477ed6[_0xc4b0('0x4a')]);var _0x37354c={'where':_0x14e66a[_0xc4b0('0x46')]};return db[_0xc4b0('0x4b')][_0xc4b0('0x4c')](_0x37354c)['then'](function(_0x1b359b){_0x474747['count']=_0x1b359b;if(_0x477ed6[_0xc4b0('0x3c')][_0xc4b0('0x4d')]){_0x14e66a[_0xc4b0('0x4e')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x14e66a);})[_0xc4b0('0x1a')](function(_0x155344){_0x474747[_0xc4b0('0x4f')]=_0x155344;return _0x474747;})['then'](respondWithFilteredResult(_0x3ab939,_0x14e66a))[_0xc4b0('0x50')](handleError(_0x3ab939,null));};exports[_0xc4b0('0x51')]=function(_0x380977,_0x1cddf7){var _0x364dae={'raw':![],'where':{'id':_0x380977[_0xc4b0('0x52')]['id']}},_0x47bb4a={};_0x47bb4a[_0xc4b0('0x3a')]=_['keys'](db['Trunk'][_0xc4b0('0x36')]);_0x47bb4a[_0xc4b0('0x3c')]=_[_0xc4b0('0x3d')](_0x380977['query']);_0x47bb4a[_0xc4b0('0x53')]=_[_0xc4b0('0x40')](_0x47bb4a[_0xc4b0('0x3a')],_0x47bb4a[_0xc4b0('0x3c')]);_0x364dae[_0xc4b0('0x3f')]=_[_0xc4b0('0x40')](_0x47bb4a[_0xc4b0('0x3a')],qs['fields'](_0x380977[_0xc4b0('0x3c')][_0xc4b0('0x41')]));_0x364dae['attributes']=_0x364dae[_0xc4b0('0x3f')][_0xc4b0('0x42')]?_0x364dae[_0xc4b0('0x3f')]:_0x47bb4a[_0xc4b0('0x3a')];if(_0x380977[_0xc4b0('0x3c')][_0xc4b0('0x4d')]){_0x364dae[_0xc4b0('0x4e')]=[{'all':!![]}];}_0x364dae=_[_0xc4b0('0x49')]({},_0x364dae,_0x380977[_0xc4b0('0x4a')]);return db[_0xc4b0('0x4b')][_0xc4b0('0x54')](_0x364dae)[_0xc4b0('0x1a')](handleEntityNotFound(_0x1cddf7,null))[_0xc4b0('0x1a')](respondWithResult(_0x1cddf7,null))[_0xc4b0('0x50')](handleError(_0x1cddf7,null));};exports[_0xc4b0('0x55')]=function(_0x1f8504,_0x357fb0){var _0x3509cd={'where':{'id':_0x1f8504[_0xc4b0('0x52')]['id']}},_0x4f5b32={};_0x4f5b32[_0xc4b0('0x3a')]=_['keys'](db[_0xc4b0('0x4b')]['rawAttributes']);_0x3509cd[_0xc4b0('0x3f')]=_['intersection'](_0x4f5b32[_0xc4b0('0x3a')],qs['fields'](_0x1f8504[_0xc4b0('0x3c')]['fields']));_0x3509cd['attributes']=_0x3509cd[_0xc4b0('0x3f')][_0xc4b0('0x42')]?_0x3509cd['attributes']:_0x4f5b32[_0xc4b0('0x3a')];if(_0x1f8504['query'][_0xc4b0('0x4d')]){_0x3509cd[_0xc4b0('0x4e')]=[{'all':!![]}];}_0x3509cd=_[_0xc4b0('0x49')]({},_0x3509cd,_0x1f8504['options']);return db[_0xc4b0('0x4b')][_0xc4b0('0x54')](_0x3509cd)[_0xc4b0('0x1a')](handleEntityNotFound(_0x357fb0,null))[_0xc4b0('0x1a')](function(_0x76ad0b){if(_0x76ad0b){var _0x1a128d=_0x76ad0b[_0xc4b0('0x2f')]({'plain':!![]});_0x1a128d=qs[_0xc4b0('0x56')](_0x1a128d,['id',_0xc4b0('0x57'),_0xc4b0('0x58')]);_0x1f8504['body']=_['omit'](_0x1f8504[_0xc4b0('0x59')],['id',_0xc4b0('0x57'),_0xc4b0('0x58')]);return db[_0xc4b0('0x4b')][_0xc4b0('0x5a')](_[_0xc4b0('0x49')](_0x1a128d,_0x1f8504[_0xc4b0('0x59')]),{'include':_0x1f8504[_0xc4b0('0x3c')][_0xc4b0('0x4d')]?[{'all':!![]}]:undefined})[_0xc4b0('0x1a')](function(_0x474477){var _0x570165=_0x1f8504['user']['get']({'plain':!![]});if(!_0x570165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x570165['role']===_0xc4b0('0x5b')){var _0xada4bb=_0x474477[_0xc4b0('0x2f')]({'plain':!![]});var _0x1658c1=_0xc4b0('0x30');return db[_0xc4b0('0x5c')][_0xc4b0('0x54')]({'where':{'name':_0x1658c1,'userProfileId':_0x570165[_0xc4b0('0x5d')]},'raw':!![]})[_0xc4b0('0x1a')](function(_0x386340){if(_0x386340&&_0x386340[_0xc4b0('0x5e')]===0x0){return db['UserProfileResource'][_0xc4b0('0x5a')]({'name':_0xada4bb[_0xc4b0('0x33')],'resourceId':_0xada4bb['id'],'type':_0x386340[_0xc4b0('0x33')],'sectionId':_0x386340['id']},{})[_0xc4b0('0x1a')](function(){return _0x474477;});}else{return _0x474477;}})[_0xc4b0('0x50')](function(_0x107508){logger[_0xc4b0('0x20')](_0xc4b0('0x5f'),_0x107508);throw _0x107508;});}return _0x474477;});}})[_0xc4b0('0x1a')](respondWithResult(_0x357fb0,0xc9))[_0xc4b0('0x50')](handleError(_0x357fb0,null));};exports[_0xc4b0('0x5a')]=function(_0x566ad0,_0x3a1402,_0x376c10){var _0x27ab66;return db[_0xc4b0('0x4b')]['create'](_0x566ad0[_0xc4b0('0x59')],{'raw':!![]})[_0xc4b0('0x1a')](function(_0x1056b8){_0x27ab66=_0x1056b8;return db[_0xc4b0('0x4b')][_0xc4b0('0x60')]({'raw':!![]});})['then'](function(_0x3ed038){var _0x4d0926=fs[_0xc4b0('0x61')](path['join'](config[_0xc4b0('0x62')],_0xc4b0('0x63')),_0xc4b0('0x64'));var _0x10a864=fs[_0xc4b0('0x61')](path[_0xc4b0('0x65')](config[_0xc4b0('0x62')],_0xc4b0('0x66')),'utf8');var _0x59125c=ejs['render'](_0x4d0926,{'trunks':_0x3ed038||[]});fs[_0xc4b0('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x59125c);if(_0x27ab66[_0xc4b0('0x68')]){var _0x123183=ejs['render'](_0x10a864,{'trunks':_0x3ed038||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x123183);}})[_0xc4b0('0x1a')](function(){return respondWithRpcPromise(_0xc4b0('0x69'),_0xc4b0('0x5a'),{'module':_0xc4b0('0x6a')});})['then'](function(){var _0x61f435=_0x566ad0[_0xc4b0('0x5b')]['get']({'plain':!![]});if(!_0x61f435)throw new Error(_0xc4b0('0x6b'));if(_0x61f435[_0xc4b0('0x6c')]==='user'){var _0x5a4f49=_0x27ab66[_0xc4b0('0x2f')]({'plain':!![]});return db[_0xc4b0('0x5c')]['find']({'where':{'name':_0xc4b0('0x30'),'userProfileId':_0x61f435['userProfileId']},'raw':!![]})[_0xc4b0('0x1a')](function(_0x5021c8){if(_0x5021c8&&_0x5021c8[_0xc4b0('0x5e')]===0x0){return db['UserProfileResource'][_0xc4b0('0x5a')]({'name':_0x5a4f49['name'],'resourceId':_0x5a4f49['id'],'type':_0x5021c8[_0xc4b0('0x33')],'sectionId':_0x5021c8['id']},{})[_0xc4b0('0x1a')](function(){return _0x27ab66;});}else{return _0x27ab66;}})[_0xc4b0('0x50')](function(_0x5a028f){logger[_0xc4b0('0x20')](_0xc4b0('0x5f'),_0x5a028f);throw _0x5a028f;});}return _0x27ab66;})['then'](respondWithResult(_0x3a1402,0xc9))['catch'](handleError(_0x3a1402,null));};exports[_0xc4b0('0x2d')]=function(_0x53d192,_0x408d4e,_0x59cc16){var _0x6dd108;return db[_0xc4b0('0x4b')]['find']({'where':{'id':_0x53d192['params']['id']}})[_0xc4b0('0x1a')](handleEntityNotFound(_0x408d4e,null))['then'](saveUpdates(_0x53d192['body'],null))[_0xc4b0('0x1a')](function(_0x363ab5){if(_0x363ab5){_0x6dd108=_0x363ab5;return db[_0xc4b0('0x4b')][_0xc4b0('0x60')]({'raw':!![]});}})[_0xc4b0('0x1a')](function(_0x24c542){if(_0x24c542){var _0x226b52=fs[_0xc4b0('0x61')](path[_0xc4b0('0x65')](config[_0xc4b0('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x3e874e=fs[_0xc4b0('0x61')](path[_0xc4b0('0x65')](config['root'],_0xc4b0('0x66')),'utf8');var _0x5b06e6=ejs[_0xc4b0('0x6d')](_0x226b52,{'trunks':_0x24c542||[]});fs[_0xc4b0('0x67')](_0xc4b0('0x6e'),_0x5b06e6);var _0x355d13=ejs[_0xc4b0('0x6d')](_0x3e874e,{'trunks':_0x24c542||[]});fs[_0xc4b0('0x67')](_0xc4b0('0x6f'),_0x355d13);return respondWithRpcPromise('Reload',_0xc4b0('0x2d'),{'module':_0xc4b0('0x6a')});}return null;})[_0xc4b0('0x1a')](function(_0x4b3877){if(_0x4b3877){return _0x6dd108;}})[_0xc4b0('0x1a')](respondWithResult(_0x408d4e,null))[_0xc4b0('0x50')](handleError(_0x408d4e,null));};exports[_0xc4b0('0x2e')]=function(_0x2da617,_0x3c1587,_0x4a928d){var _0x4a2059;return db[_0xc4b0('0x4b')][_0xc4b0('0x54')]({'where':{'id':_0x2da617['params']['id']}})[_0xc4b0('0x1a')](handleEntityNotFound(_0x3c1587,null))['then'](removeEntity(_0x3c1587,null))['then'](function(){return db['Trunk'][_0xc4b0('0x60')]({'raw':!![]});})[_0xc4b0('0x1a')](function(_0x46b703){var _0x52f156=fs[_0xc4b0('0x61')](path[_0xc4b0('0x65')](config[_0xc4b0('0x62')],_0xc4b0('0x63')),_0xc4b0('0x64'));var _0x47d6a2=fs[_0xc4b0('0x61')](path[_0xc4b0('0x65')](config[_0xc4b0('0x62')],_0xc4b0('0x66')),_0xc4b0('0x64'));var _0x37342c=ejs[_0xc4b0('0x6d')](_0x52f156,{'trunks':_0x46b703});var _0x1c3992=ejs['render'](_0x47d6a2,{'trunks':_0x46b703});fs[_0xc4b0('0x67')](_0xc4b0('0x6e'),_0x37342c);fs[_0xc4b0('0x67')](_0xc4b0('0x6f'),_0x1c3992);return respondWithRpcPromise(_0xc4b0('0x69'),_0xc4b0('0x2e'),{'module':_0xc4b0('0x6a')});})['catch'](handleError(_0x3c1587,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fdf9a40..01b6290 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 _0x9639=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','path','rimraf'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9639,0xf6));var _0x9963=function(_0x2891d1,_0x2ddd3e){_0x2891d1=_0x2891d1-0x0;var _0x486948=_0x9639[_0x2891d1];return _0x486948;};'use strict';var _=require(_0x9963('0x0'));var util=require(_0x9963('0x1'));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(_0x9963('0x2'));var rimraf=require(_0x9963('0x3'));var config=require(_0x9963('0x4'));var attributes=require(_0x9963('0x5'));module[_0x9963('0x6')]=function(_0x9a8652,_0x3b331d){return _0x9a8652[_0x9963('0x7')](_0x9963('0x8'),attributes,{'tableName':_0x9963('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7ab=['util','api','moment','bluebird','path','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xa7ab,0x1ac));var _0xba7a=function(_0x4c95a0,_0xd8ca5b){_0x4c95a0=_0x4c95a0-0x0;var _0x5cec9d=_0xa7ab[_0x4c95a0];return _0x5cec9d;};'use strict';var _=require(_0xba7a('0x0'));var util=require(_0xba7a('0x1'));var logger=require('../../config/logger')(_0xba7a('0x2'));var moment=require(_0xba7a('0x3'));var BPromise=require(_0xba7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba7a('0x5'));var rimraf=require('rimraf');var config=require(_0xba7a('0x6'));var attributes=require(_0xba7a('0x7'));module[_0xba7a('0x8')]=function(_0x42e5a8,_0x3a02a4){return _0x42e5a8[_0xba7a('0x9')]('Trunk',attributes,{'tableName':_0xba7a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 390b4c2..b3afb52 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 _0x5eb8=['where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','catch','Trunk','findAll','options','raw','limit','include','model','attributes','map','then','GetTrunk','stringify','ShowTrunk'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5eb8,0xb0));var _0x85eb=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5eb8[_0x88cd7b];return _0x56fcc8;};'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')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('Trunk,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['GetTrunk']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')]({'raw':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8['options'][_0x85eb('0x18')]===undefined?!![]:![]:!![],'where':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')]['where']||null:null,'attributes':_0x50d2a8['options']?_0x50d2a8['options']['attributes']||null:null,'limit':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x19')]||null:null,'include':_0x50d2a8[_0x85eb('0x17')]?_0x50d2a8[_0x85eb('0x17')][_0x85eb('0x1a')]?_['map'](_0x50d2a8['options']['include'],function(_0x298e84){return{'model':db[_0x298e84[_0x85eb('0x1b')]],'as':_0x298e84['as'],'attributes':_0x298e84[_0x85eb('0x1c')],'include':_0x298e84[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x298e84[_0x85eb('0x1a')],function(_0x5dfc96){return{'model':db[_0x5dfc96[_0x85eb('0x1b')]],'as':_0x5dfc96['as'],'attributes':_0x5dfc96[_0x85eb('0x1c')],'include':_0x5dfc96[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x5dfc96[_0x85eb('0x1a')],function(_0x57a03c){return{'model':db[_0x57a03c[_0x85eb('0x1b')]],'as':_0x57a03c['as'],'attributes':_0x57a03c[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x3e7eb9){logger[_0x85eb('0xd')](_0x85eb('0x1f'),_0x50d2a8);logger['debug']('GetTrunk',_0x50d2a8,JSON[_0x85eb('0x20')](_0x3e7eb9));_0x39ca96(_0x3e7eb9);})['catch'](function(_0xa9b14f){logger['error'](_0x85eb('0x1f'),_0xa9b14f[_0x85eb('0x13')],_0x50d2a8);_0x10cf2f(_0xe198ca[_0x85eb('0x12')](0x1f4,_0xa9b14f[_0x85eb('0x13')]));});});};exports[_0x85eb('0x21')]=function(_0xf4ac13){var _0x41ed76=this;return new Promise(function(_0x5decd5,_0x237f19){return db[_0x85eb('0x15')]['find']({'raw':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13['options']['raw']===undefined?!![]:![]:!![],'where':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x22')]||null:null,'attributes':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1c')]||null:null,'include':_0xf4ac13[_0x85eb('0x17')]?_0xf4ac13[_0x85eb('0x17')][_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0xf4ac13['options'][_0x85eb('0x1a')],function(_0x3a5b87){return{'model':db[_0x3a5b87['model']],'as':_0x3a5b87['as'],'attributes':_0x3a5b87['attributes'],'include':_0x3a5b87[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x3a5b87[_0x85eb('0x1a')],function(_0x12cb4c){return{'model':db[_0x12cb4c[_0x85eb('0x1b')]],'as':_0x12cb4c['as'],'attributes':_0x12cb4c[_0x85eb('0x1c')],'include':_0x12cb4c[_0x85eb('0x1a')]?_[_0x85eb('0x1d')](_0x12cb4c[_0x85eb('0x1a')],function(_0x373e5f){return{'model':db[_0x373e5f[_0x85eb('0x1b')]],'as':_0x373e5f['as'],'attributes':_0x373e5f[_0x85eb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x85eb('0x1e')](function(_0x33605a){logger['info'](_0x85eb('0x21'),_0xf4ac13);logger[_0x85eb('0x10')]('ShowTrunk',_0xf4ac13,JSON['stringify'](_0x33605a));_0x5decd5(_0x33605a);})[_0x85eb('0x14')](function(_0xe22d16){logger['error'](_0x85eb('0x21'),_0xe22d16['message'],_0xf4ac13);_0x237f19(_0x41ed76[_0x85eb('0x12')](0x1f4,_0xe22d16['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x560dae,_0x5909d4){var _0x149872=function(_0x59fdb3){while(--_0x59fdb3){_0x560dae['push'](_0x560dae['shift']());}};_0x149872(++_0x5909d4);}(_0x757a,0xde));var _0xa757=function(_0x3f2604,_0x2e45fc){_0x3f2604=_0x3f2604-0x0;var _0x1c5999=_0x757a[_0x3f2604];return _0x1c5999;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9d65e9e..26aecfc 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 _0x4228=['get','isAuthenticated','index','/whoami','/:id','show','/:id/avatar','getAvatar','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','create','post','bulkCreate','addQueues','diskStorage','server/files/images/','format','%s-%s','single','file','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/mail_interactions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./user.controller'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x4228,0x1a8));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8422('0x0'));var util=require(_0x8422('0x1'));var path=require(_0x8422('0x2'));var timeout=require('connect-timeout');var express=require(_0x8422('0x3'));var router=express[_0x8422('0x4')]();var auth=require(_0x8422('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8422('0x6'));var controller=require(_0x8422('0x7'));router[_0x8422('0x8')]('/',auth[_0x8422('0x9')](),controller[_0x8422('0xa')]);router['get']('/describe',auth[_0x8422('0x9')](),controller['describe']);router[_0x8422('0x8')](_0x8422('0xb'),auth[_0x8422('0x9')](),controller['whoami']);router['get'](_0x8422('0xc'),auth['isAuthenticated'](),controller[_0x8422('0xd')]);router[_0x8422('0x8')](_0x8422('0xe'),controller[_0x8422('0xf')]);router['get']('/:id/contacts',auth[_0x8422('0x9')](),controller['getContacts']);router[_0x8422('0x8')](_0x8422('0x10'),auth[_0x8422('0x9')](),controller[_0x8422('0x11')]);router[_0x8422('0x8')](_0x8422('0x12'),auth['isAuthenticated'](),controller[_0x8422('0x13')]);router[_0x8422('0x8')](_0x8422('0x14'),auth[_0x8422('0x9')](),controller[_0x8422('0x15')]);router[_0x8422('0x8')](_0x8422('0x16'),auth[_0x8422('0x9')](),controller['getRecordings']);router[_0x8422('0x8')](_0x8422('0x17'),auth[_0x8422('0x9')](),controller[_0x8422('0x18')]);router[_0x8422('0x8')](_0x8422('0x19'),auth[_0x8422('0x9')](),controller[_0x8422('0x1a')]);router[_0x8422('0x8')](_0x8422('0x1b'),auth['isAuthenticated'](),controller[_0x8422('0x1c')]);router[_0x8422('0x8')](_0x8422('0x1d'),auth[_0x8422('0x9')](),controller[_0x8422('0x1e')]);router['get'](_0x8422('0x1f'),auth[_0x8422('0x9')](),controller[_0x8422('0x20')]);router['get'](_0x8422('0x21'),auth[_0x8422('0x9')](),controller[_0x8422('0x22')]);router[_0x8422('0x8')](_0x8422('0x23'),auth[_0x8422('0x9')](),controller[_0x8422('0x24')]);router[_0x8422('0x8')]('/:id/teams',auth[_0x8422('0x9')](),controller[_0x8422('0x25')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x8422('0x8')]('/:id/agents',auth['isAuthenticated'](),controller[_0x8422('0x26')]);router[_0x8422('0x8')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x8422('0x27')]);router[_0x8422('0x8')](_0x8422('0x28'),auth['isAuthenticated'](),controller[_0x8422('0x29')]);router['get'](_0x8422('0x2a'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x8422('0x8')](_0x8422('0x2b'),auth['isAuthenticated'](),controller[_0x8422('0x2c')]);router[_0x8422('0x8')](_0x8422('0x2d'),auth['isAuthenticated'](),controller[_0x8422('0x2e')]);router[_0x8422('0x8')](_0x8422('0x2f'),auth[_0x8422('0x9')](),controller[_0x8422('0x30')]);router[_0x8422('0x8')]('/:id/whatsapp_accounts',auth[_0x8422('0x9')](),controller['getWhatsappAccounts']);router[_0x8422('0x8')](_0x8422('0x31'),auth['isAuthenticated'](),controller[_0x8422('0x32')]);router[_0x8422('0x8')](_0x8422('0x33'),auth[_0x8422('0x9')](),controller['getScheduledCalls']);router[_0x8422('0x8')](_0x8422('0x34'),auth[_0x8422('0x9')](),controller[_0x8422('0x35')]);router['post']('/:id/contacts',auth[_0x8422('0x9')](),controller[_0x8422('0x36')]);router['post']('/',auth[_0x8422('0x9')](),controller[_0x8422('0x37')]);router[_0x8422('0x38')]('/create_many',auth['isAuthenticated'](),controller[_0x8422('0x39')]);router[_0x8422('0x38')](_0x8422('0x10'),auth[_0x8422('0x9')](),controller[_0x8422('0x3a')]);var upload=multer({'storage':multer[_0x8422('0x3b')]({'destination':function(_0x544073,_0x4ea4c4,_0x1fa792){_0x1fa792(null,path['join'](config['root'],_0x8422('0x3c')));},'filename':function(_0x4264d1,_0x5c9e31,_0x3790cc){_0x3790cc(null,util[_0x8422('0x3d')](_0x8422('0x3e'),Date['now'](),_0x5c9e31['originalname']));}})});router[_0x8422('0x38')]('/:id/avatar',upload[_0x8422('0x3f')](_0x8422('0x40')),controller['addAvatar']);router[_0x8422('0x38')]('/:id/login',auth[_0x8422('0x9')](),controller['login']);router[_0x8422('0x38')](_0x8422('0x41'),auth[_0x8422('0x9')](),controller[_0x8422('0x42')]);router[_0x8422('0x38')](_0x8422('0x43'),auth[_0x8422('0x9')](),controller[_0x8422('0x44')]);router[_0x8422('0x38')](_0x8422('0x45'),auth[_0x8422('0x9')](),controller[_0x8422('0x46')]);router[_0x8422('0x38')](_0x8422('0x47'),auth[_0x8422('0x9')](),controller[_0x8422('0x48')]);router[_0x8422('0x38')](_0x8422('0x49'),auth['isAuthenticated'](),controller[_0x8422('0x4a')]);router['post']('/:id/mail_interactions',auth[_0x8422('0x9')](),controller[_0x8422('0x4b')]);router[_0x8422('0x38')](_0x8422('0x4c'),auth['isAuthenticated'](),controller[_0x8422('0x4d')]);router[_0x8422('0x38')](_0x8422('0x4e'),auth[_0x8422('0x9')](),controller[_0x8422('0x4f')]);router[_0x8422('0x38')](_0x8422('0x50'),auth[_0x8422('0x9')](),controller[_0x8422('0x51')]);router[_0x8422('0x38')]('/:id/whatsapp_interactions',auth[_0x8422('0x9')](),controller[_0x8422('0x52')]);router[_0x8422('0x38')](_0x8422('0x28'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x8422('0x38')](_0x8422('0x2a'),auth[_0x8422('0x9')](),controller[_0x8422('0x53')]);router[_0x8422('0x38')](_0x8422('0x2b'),auth[_0x8422('0x9')](),controller['addOpenchannelAccounts']);router[_0x8422('0x38')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x8422('0x54')]);router[_0x8422('0x38')](_0x8422('0x2f'),auth[_0x8422('0x9')](),controller[_0x8422('0x55')]);router['post'](_0x8422('0x56'),auth[_0x8422('0x9')](),controller[_0x8422('0x57')]);router['post'](_0x8422('0x31'),auth[_0x8422('0x9')](),controller[_0x8422('0x58')]);router[_0x8422('0x38')]('/:id/api_key',auth[_0x8422('0x9')](),controller[_0x8422('0x59')]);router[_0x8422('0x5a')]('/:id',auth[_0x8422('0x9')](),controller[_0x8422('0x5b')]);router[_0x8422('0x5a')]('/:id/password',auth[_0x8422('0x9')](),controller[_0x8422('0x5c')]);router[_0x8422('0x5d')](_0x8422('0x10'),auth[_0x8422('0x9')](),controller[_0x8422('0x5e')]);router[_0x8422('0x5d')]('/:id/teams',auth[_0x8422('0x9')](),controller[_0x8422('0x5f')]);router[_0x8422('0x5d')](_0x8422('0xc'),auth[_0x8422('0x9')](),controller[_0x8422('0x60')]);router['delete'](_0x8422('0x49'),auth[_0x8422('0x9')](),controller[_0x8422('0x61')]);router[_0x8422('0x5d')](_0x8422('0x62'),auth[_0x8422('0x9')](),controller['removeMailInteractions']);router['delete'](_0x8422('0x4c'),auth[_0x8422('0x9')](),controller[_0x8422('0x63')]);router[_0x8422('0x5d')](_0x8422('0x4e'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x8422('0x5d')](_0x8422('0x50'),auth[_0x8422('0x9')](),controller[_0x8422('0x64')]);router[_0x8422('0x5d')](_0x8422('0x65'),auth['isAuthenticated'](),controller[_0x8422('0x66')]);router[_0x8422('0x5d')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x8422('0x5d')]('/:id/mail_accounts',auth[_0x8422('0x9')](),controller[_0x8422('0x67')]);router[_0x8422('0x5d')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x8422('0x5d')](_0x8422('0x2d'),auth[_0x8422('0x9')](),controller[_0x8422('0x68')]);router[_0x8422('0x5d')]('/:id/chat_websites',auth[_0x8422('0x9')](),controller[_0x8422('0x69')]);router['delete'](_0x8422('0x56'),auth[_0x8422('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x8422('0x31'),auth['isAuthenticated'](),controller['removeSquareProjects']);router[_0x8422('0x5d')](_0x8422('0x34'),auth[_0x8422('0x9')](),controller[_0x8422('0x6a')]);module[_0x8422('0x6b')]=router; \ No newline at end of file +var _0xf172=['login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','exports','util','path','express','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','now','originalname','single'];(function(_0xed129b,_0x3bb5e9){var _0x404daa=function(_0x2d8d88){while(--_0x2d8d88){_0xed129b['push'](_0xed129b['shift']());}};_0x404daa(++_0x3bb5e9);}(_0xf172,0x95));var _0x2f17=function(_0x1ec29a,_0x3f2404){_0x1ec29a=_0x1ec29a-0x0;var _0x6a10b9=_0xf172[_0x1ec29a];return _0x6a10b9;};'use strict';var multer=require('multer');var util=require(_0x2f17('0x0'));var path=require(_0x2f17('0x1'));var timeout=require('connect-timeout');var express=require(_0x2f17('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2f17('0x3'));var controller=require(_0x2f17('0x4'));router[_0x2f17('0x5')]('/',auth[_0x2f17('0x6')](),controller[_0x2f17('0x7')]);router['get']('/describe',auth[_0x2f17('0x6')](),controller[_0x2f17('0x8')]);router['get'](_0x2f17('0x9'),auth[_0x2f17('0x6')](),controller[_0x2f17('0xa')]);router['get'](_0x2f17('0xb'),auth[_0x2f17('0x6')](),controller[_0x2f17('0xc')]);router['get'](_0x2f17('0xd'),controller[_0x2f17('0xe')]);router[_0x2f17('0x5')]('/:id/contacts',auth[_0x2f17('0x6')](),controller[_0x2f17('0xf')]);router[_0x2f17('0x5')](_0x2f17('0x10'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x11')]);router[_0x2f17('0x5')](_0x2f17('0x12'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x13')]);router['get'](_0x2f17('0x14'),auth[_0x2f17('0x6')](),controller['getGroups']);router[_0x2f17('0x5')](_0x2f17('0x15'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x16')]);router[_0x2f17('0x5')]('/:id/screen_recordings',auth[_0x2f17('0x6')](),controller[_0x2f17('0x17')]);router[_0x2f17('0x5')](_0x2f17('0x18'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x19')]);router[_0x2f17('0x5')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router['get'](_0x2f17('0x1a'),auth['isAuthenticated'](),controller[_0x2f17('0x1b')]);router[_0x2f17('0x5')](_0x2f17('0x1c'),auth['isAuthenticated'](),controller[_0x2f17('0x1d')]);router[_0x2f17('0x5')](_0x2f17('0x1e'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x1f')]);router[_0x2f17('0x5')](_0x2f17('0x20'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x21')]);router[_0x2f17('0x5')](_0x2f17('0x22'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x23')]);router[_0x2f17('0x5')](_0x2f17('0x24'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x25')]);router['get'](_0x2f17('0x26'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x27')]);router[_0x2f17('0x5')](_0x2f17('0x28'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0x2f17('0x5')](_0x2f17('0x29'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x2a')]);router[_0x2f17('0x5')](_0x2f17('0x2b'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x2c')]);router[_0x2f17('0x5')](_0x2f17('0x2d'),auth[_0x2f17('0x6')](),controller['getOpenchannelAccounts']);router[_0x2f17('0x5')]('/:id/sms_accounts',auth[_0x2f17('0x6')](),controller[_0x2f17('0x2e')]);router[_0x2f17('0x5')](_0x2f17('0x2f'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x30')]);router[_0x2f17('0x5')](_0x2f17('0x31'),auth['isAuthenticated'](),controller[_0x2f17('0x32')]);router[_0x2f17('0x5')]('/:id/square_projects',auth[_0x2f17('0x6')](),controller['getSquareProjects']);router[_0x2f17('0x5')](_0x2f17('0x33'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x34')]);router[_0x2f17('0x5')](_0x2f17('0x35'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x36')]);router[_0x2f17('0x37')]('/:id/contacts',auth[_0x2f17('0x6')](),controller[_0x2f17('0x38')]);router[_0x2f17('0x37')]('/',auth[_0x2f17('0x6')](),controller['create']);router[_0x2f17('0x37')](_0x2f17('0x39'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x3a')]);router[_0x2f17('0x37')]('/:id/queues',auth['isAuthenticated'](),controller[_0x2f17('0x3b')]);var upload=multer({'storage':multer[_0x2f17('0x3c')]({'destination':function(_0x515766,_0x9d36ba,_0x3f7d1c){_0x3f7d1c(null,path[_0x2f17('0x3d')](config[_0x2f17('0x3e')],_0x2f17('0x3f')));},'filename':function(_0x34fe55,_0xb4e9e8,_0x3832b3){_0x3832b3(null,util['format']('%s-%s',Date[_0x2f17('0x40')](),_0xb4e9e8[_0x2f17('0x41')]));}})});router[_0x2f17('0x37')](_0x2f17('0xd'),upload[_0x2f17('0x42')]('file'),controller['addAvatar']);router[_0x2f17('0x37')]('/:id/login',auth[_0x2f17('0x6')](),controller[_0x2f17('0x43')]);router[_0x2f17('0x37')](_0x2f17('0x44'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x45')]);router[_0x2f17('0x37')](_0x2f17('0x46'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x47')]);router[_0x2f17('0x37')](_0x2f17('0x48'),auth[_0x2f17('0x6')](),controller['unpause']);router[_0x2f17('0x37')](_0x2f17('0x22'),auth[_0x2f17('0x6')](),controller['addTeams']);router[_0x2f17('0x37')](_0x2f17('0x49'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x4a')]);router[_0x2f17('0x37')](_0x2f17('0x4b'),auth[_0x2f17('0x6')](),controller['addMailInteractions']);router[_0x2f17('0x37')](_0x2f17('0x4c'),auth[_0x2f17('0x6')](),controller['addFaxInteractions']);router['post'](_0x2f17('0x4d'),auth['isAuthenticated'](),controller[_0x2f17('0x4e')]);router['post'](_0x2f17('0x4f'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x50')]);router[_0x2f17('0x37')](_0x2f17('0x51'),auth[_0x2f17('0x6')](),controller['addWhatsappInteractions']);router['post'](_0x2f17('0x29'),auth['isAuthenticated'](),controller[_0x2f17('0x52')]);router[_0x2f17('0x37')](_0x2f17('0x2b'),auth['isAuthenticated'](),controller[_0x2f17('0x53')]);router[_0x2f17('0x37')](_0x2f17('0x2d'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x54')]);router['post'](_0x2f17('0x55'),auth[_0x2f17('0x6')](),controller['addSmsAccounts']);router[_0x2f17('0x37')](_0x2f17('0x2f'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x2f17('0x31'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x56')]);router['post']('/:id/square_projects',auth[_0x2f17('0x6')](),controller[_0x2f17('0x57')]);router[_0x2f17('0x37')](_0x2f17('0x35'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x58')]);router[_0x2f17('0x59')]('/:id',auth[_0x2f17('0x6')](),controller[_0x2f17('0x5a')]);router[_0x2f17('0x59')](_0x2f17('0x5b'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x5c')]);router[_0x2f17('0x5d')](_0x2f17('0x10'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x5e')]);router['delete'](_0x2f17('0x22'),auth['isAuthenticated'](),controller[_0x2f17('0x5f')]);router[_0x2f17('0x5d')](_0x2f17('0xb'),auth['isAuthenticated'](),controller[_0x2f17('0x60')]);router[_0x2f17('0x5d')](_0x2f17('0x49'),auth[_0x2f17('0x6')](),controller['removeChatInteractions']);router[_0x2f17('0x5d')](_0x2f17('0x4b'),auth[_0x2f17('0x6')](),controller['removeMailInteractions']);router[_0x2f17('0x5d')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x2f17('0x61')]);router[_0x2f17('0x5d')]('/:id/sms_interactions',auth[_0x2f17('0x6')](),controller[_0x2f17('0x62')]);router[_0x2f17('0x5d')](_0x2f17('0x4f'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x63')]);router[_0x2f17('0x5d')](_0x2f17('0x51'),auth[_0x2f17('0x6')](),controller['removeWhatsappInteractions']);router['delete'](_0x2f17('0x29'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x64')]);router[_0x2f17('0x5d')]('/:id/mail_accounts',auth[_0x2f17('0x6')](),controller[_0x2f17('0x65')]);router[_0x2f17('0x5d')](_0x2f17('0x2d'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x66')]);router[_0x2f17('0x5d')]('/:id/sms_accounts',auth[_0x2f17('0x6')](),controller['removeSmsAccounts']);router[_0x2f17('0x5d')](_0x2f17('0x2f'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x2f17('0x5d')](_0x2f17('0x31'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x67')]);router[_0x2f17('0x5d')](_0x2f17('0x68'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x69')]);router[_0x2f17('0x5d')](_0x2f17('0x35'),auth[_0x2f17('0x6')](),controller[_0x2f17('0x6a')]);module[_0x2f17('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 52d48e5..20d21b5 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 _0x3ef1=['DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active','passive','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','dtlsverify','/etc/pki/tls/private/motion.key','TEXT','permissions','VIRTUAL','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','telephone','local','accountcode','fullname','BOOLEAN','DATE'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x3ef1,0x1b9));var _0x13ef=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3ef1[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x13ef('0x0'));var moment=require(_0x13ef('0x1'));var util=require(_0x13ef('0x2'));var _=require('lodash');module[_0x13ef('0x3')]={'name':{'type':Sequelize[_0x13ef('0x4')],'allowNull':![],'unique':_0x13ef('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x54dc02){this[_0x13ef('0x6')](_0x13ef('0x5'),_0x54dc02);this[_0x13ef('0x6')](_0x13ef('0x7'),_0x54dc02);},'comment':_0x13ef('0x8')},'fullname':{'type':Sequelize[_0x13ef('0x4')],'allowNull':![],'set':function(_0x230775){this['setDataValue']('fullname',_0x230775);this[_0x13ef('0x6')](_0x13ef('0x9'),util[_0x13ef('0xa')](_0x13ef('0xb'),_0x230775,this[_0x13ef('0xc')](_0x13ef('0xd'))));}},'alias':{'type':Sequelize[_0x13ef('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4066d){if(_0x4066d){this[_0x13ef('0x6')](_0x13ef('0xe'),_0x4066d['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x13ef('0xf'),_0x13ef('0x10'),_0x13ef('0x11'),_0x13ef('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x13ef('0x4')],'defaultValue':_0x13ef('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x13ef('0xd'),'set':function(_0x11a3ba){this[_0x13ef('0x6')](_0x13ef('0xd'),_0x11a3ba);this['setDataValue'](_0x13ef('0x14'),_0x11a3ba);this[_0x13ef('0x6')](_0x13ef('0x9'),util['format'](_0x13ef('0xb'),this[_0x13ef('0xc')](_0x13ef('0x15')),_0x11a3ba));}},'salt':{'type':Sequelize[_0x13ef('0x4')]},'phone':{'type':Sequelize[_0x13ef('0x4')]},'mobile':{'type':Sequelize[_0x13ef('0x4')]},'address':{'type':Sequelize[_0x13ef('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x13ef('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x13ef('0x4')]},'online':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x13ef('0x17')]},'voicePause':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x13ef('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x13ef('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![],'defaultValue':_0x13ef('0x1a')},'ipaddr':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x13ef('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x1c'),_0x13ef('0x10'),_0x13ef('0x1d')),'allowNull':!![],'defaultValue':_0x13ef('0x1c')},'context':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x1e'),_0x13ef('0x1f'),_0x13ef('0x20'),_0x13ef('0x21'),_0x13ef('0x22'),'PROHIB_PASSED_SCREEN',_0x13ef('0x23'),_0x13ef('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x13ef('0x25'),'set':function(_0x43980f){this[_0x13ef('0x6')](_0x13ef('0x26'),_0x43980f?_0x43980f[_0x13ef('0x27')](','):null);},'get':function(){return this[_0x13ef('0xc')]('transport')?this['getDataValue']('transport')[_0x13ef('0x28')](','):null;},'comment':_0x13ef('0x29')},'dtmfmode':{'type':Sequelize['ENUM'](_0x13ef('0x2a'),_0x13ef('0x2b'),_0x13ef('0x2c'),_0x13ef('0x2d'),_0x13ef('0x2e')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no',_0x13ef('0x30'),_0x13ef('0x31'),_0x13ef('0x32')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![],'defaultValue':_0x13ef('0x33'),'set':function(_0x2e2195){this[_0x13ef('0x6')](_0x13ef('0x34'),_0x2e2195?_0x2e2195['join'](','):null);},'get':function(){return this[_0x13ef('0xc')](_0x13ef('0x34'))?this[_0x13ef('0xc')](_0x13ef('0x34'))[_0x13ef('0x28')](','):null;},'comment':_0x13ef('0x35')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x13ef('0x4')]},'language':{'type':Sequelize[_0x13ef('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x13ef('0x4')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x13ef('0x36'),'set':function(_0x50129c){this['setDataValue']('allow',_0x50129c?_0x50129c[_0x13ef('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x13ef('0xc')](_0x13ef('0x37'))?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x13ef('0x38')},'autoframing':{'type':Sequelize[_0x13ef('0x1b')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![],'set':function(_0xd67271){this[_0x13ef('0x6')](_0x13ef('0x39'),_0xd67271?_0xd67271['join'](','):null);},'get':function(){return this[_0x13ef('0xc')]('insecure')?this[_0x13ef('0xc')](_0x13ef('0x39'))[_0x13ef('0x28')](','):null;},'comment':_0x13ef('0x3a')},'trustrpid':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no',_0x13ef('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x13ef('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![],'defaultValue':_0x13ef('0x3c')},'amaflags':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x13ef('0x1b')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no',_0x13ef('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x3e'),_0x13ef('0x3f'),_0x13ef('0x40')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x41'),_0x13ef('0x42')),'allowNull':!![],'defaultValue':_0x13ef('0x42')},'t38pt_usertpsource':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x13ef('0x2f')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x13ef('0x1b')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no','fingerprint',_0x13ef('0x43')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x13ef('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x44'),_0x13ef('0x45'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x13ef('0x2f'),'no',_0x13ef('0x30'),_0x13ef('0x31'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x13ef('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x13ef('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x13ef('0x4')]},'showWebBar':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0,'set':function(_0x4bcce2){this[_0x13ef('0x6')](_0x13ef('0x46'),_0x4bcce2);var _0xaf6c13=this[_0x13ef('0x47')]({'plain':!![]});switch(_0x4bcce2){case 0x0:case 0x1:var _0x3222c3=_0xaf6c13[_0x13ef('0x26')]?_[_0x13ef('0x48')](_0xaf6c13[_0x13ef('0x26')])?_0xaf6c13[_0x13ef('0x26')][_0x13ef('0x27')]():_0xaf6c13[_0x13ef('0x26')]:'udp';if(_0x3222c3==='wss'){_0x3222c3=_0x13ef('0x25');}this[_0x13ef('0x6')](_0x13ef('0x26'),_0x3222c3);this[_0x13ef('0x6')](_0x13ef('0x49'),'no');this[_0x13ef('0x6')](_0x13ef('0x4a'),null);this['setDataValue'](_0x13ef('0x4b'),null);this[_0x13ef('0x6')](_0x13ef('0x4c'),null);this['setDataValue'](_0x13ef('0x4d'),null);this[_0x13ef('0x6')]('dtlsverify',null);this['setDataValue'](_0x13ef('0x4e'),null);this[_0x13ef('0x6')](_0x13ef('0x4f'),null);this[_0x13ef('0x6')](_0x13ef('0x50'),null);this['setDataValue'](_0x13ef('0x51'),'no');break;case 0x2:this[_0x13ef('0x6')]('transport',_0x13ef('0x52'));this[_0x13ef('0x6')]('encryption',_0x13ef('0x2f'));this[_0x13ef('0x6')]('avpf','yes');this[_0x13ef('0x6')]('force_avp',_0x13ef('0x2f'));this[_0x13ef('0x6')](_0x13ef('0x4c'),_0x13ef('0x2f'));this[_0x13ef('0x6')](_0x13ef('0x4d'),_0x13ef('0x2f'));this[_0x13ef('0x6')](_0x13ef('0x53'),'no');this[_0x13ef('0x6')](_0x13ef('0x4e'),'actpass');this['setDataValue'](_0x13ef('0x4f'),_0xaf6c13['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x13ef('0x6')]('dtlsprivatekey',_0xaf6c13[_0x13ef('0x50')]||_0x13ef('0x54'));this['setDataValue']('rtcp_mux',_0x13ef('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x13ef('0x55')],'set':function(_0x30829e){this[_0x13ef('0x6')](_0x13ef('0x56'),_0x30829e?_0x30829e['join'](','):[]);},'get':function(){return this['getDataValue'](_0x13ef('0x56'))?_['map'](this[_0x13ef('0xc')](_0x13ef('0x56'))[_0x13ef('0x28')](','),function(_0x1485e6){return parseInt(_0x1485e6,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x13ef('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x13ef('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x13ef('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x13ef('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x13ef('0x1b')](_0x13ef('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x13ef('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x13ef('0x57')],'get':function(){return this[_0x13ef('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x13ef('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x13ef('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![],'set':function(_0x20918e){if(typeof _0x20918e==='string'){var _0x213bae=_0x20918e==='1'?!![]:_0x20918e==='0'?![]:_0x20918e==='true'?!![]:_0x20918e===_0x13ef('0x58')?![]:![];this['setDataValue'](_0x13ef('0x59'),_0x213bae);}else{this[_0x13ef('0x6')](_0x13ef('0x59'),_0x20918e);}}},'blocked':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':![],'set':function(_0x4c1849){this[_0x13ef('0x6')](_0x13ef('0x5a'),_0x4c1849);if(_0x4c1849===!![]){this[_0x13ef('0x6')](_0x13ef('0x5b'),moment());this['setDataValue'](_0x13ef('0x5c'),0x0);}else{this[_0x13ef('0x6')](_0x13ef('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x13ef('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x13ef('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb443=['PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','originate','uac','uas','certificate','passive','actpass','update','update,nonat','showWebBar','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','rtcp_mux','wss','encryption','icesupport','dtlssetup','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','ENUM','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED'];(function(_0x104116,_0x618e32){var _0x357573=function(_0x3e9b71){while(--_0x3e9b71){_0x104116['push'](_0x104116['shift']());}};_0x357573(++_0x618e32);}(_0xb443,0x137));var _0x3b44=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xb443[_0x1b2ff7];return _0x31656a;};'use strict';var Sequelize=require(_0x3b44('0x0'));var moment=require(_0x3b44('0x1'));var util=require(_0x3b44('0x2'));var _=require(_0x3b44('0x3'));module[_0x3b44('0x4')]={'name':{'type':Sequelize[_0x3b44('0x5')],'allowNull':![],'unique':_0x3b44('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5e783c){this[_0x3b44('0x7')](_0x3b44('0x6'),_0x5e783c);this[_0x3b44('0x7')](_0x3b44('0x8'),_0x5e783c);},'comment':_0x3b44('0x9')},'fullname':{'type':Sequelize[_0x3b44('0x5')],'allowNull':![],'set':function(_0x2d5db1){this[_0x3b44('0x7')]('fullname',_0x2d5db1);this[_0x3b44('0x7')](_0x3b44('0xa'),util['format'](_0x3b44('0xb'),_0x2d5db1,this[_0x3b44('0xc')](_0x3b44('0xd'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3b44('0x5')],'allowNull':![],'unique':_0x3b44('0xe'),'validate':{'isEmail':!![]},'set':function(_0x488716){if(_0x488716){this['setDataValue'](_0x3b44('0xe'),_0x488716[_0x3b44('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0x3b44('0x10'),_0x3b44('0x11'),'agent',_0x3b44('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x3b44('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3b44('0x5')],'defaultValue':_0x3b44('0x13')},'internal':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':![],'unique':_0x3b44('0xd'),'set':function(_0x419768){this[_0x3b44('0x7')](_0x3b44('0xd'),_0x419768);this['setDataValue'](_0x3b44('0x15'),_0x419768);this[_0x3b44('0x7')](_0x3b44('0xa'),util['format'](_0x3b44('0xb'),this[_0x3b44('0xc')](_0x3b44('0x16')),_0x419768));}},'salt':{'type':Sequelize[_0x3b44('0x5')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3b44('0x5')]},'address':{'type':Sequelize[_0x3b44('0x5')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x3b44('0x5')]},'city':{'type':Sequelize[_0x3b44('0x5')]},'country':{'type':Sequelize[_0x3b44('0x5')]},'online':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3b44('0x18')]},'voicePause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x3b44('0x18')]},'chatCapacity':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3b44('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3b44('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3b44('0x19')},'ipaddr':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3b44('0x1a')]('friend',_0x3b44('0x11'),_0x3b44('0x1b')),'allowNull':!![],'defaultValue':_0x3b44('0x1c')},'context':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x1d'),_0x3b44('0x1e'),_0x3b44('0x1f'),_0x3b44('0x20'),_0x3b44('0x21'),'PROHIB_PASSED_SCREEN',_0x3b44('0x22'),_0x3b44('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![],'defaultValue':_0x3b44('0x24'),'set':function(_0x5df722){this[_0x3b44('0x7')](_0x3b44('0x25'),_0x5df722?_0x5df722[_0x3b44('0x26')](','):null);},'get':function(){return this[_0x3b44('0xc')]('transport')?this[_0x3b44('0xc')](_0x3b44('0x25'))[_0x3b44('0x27')](','):null;},'comment':_0x3b44('0x28')},'dtmfmode':{'type':Sequelize[_0x3b44('0x1a')]('rfc2833',_0x3b44('0x29'),_0x3b44('0x2a'),_0x3b44('0x2b'),_0x3b44('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no',_0x3b44('0x2e'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x102cf0){this[_0x3b44('0x7')](_0x3b44('0x2f'),_0x102cf0?_0x102cf0['join'](','):null);},'get':function(){return this[_0x3b44('0xc')]('nat')?this[_0x3b44('0xc')](_0x3b44('0x2f'))[_0x3b44('0x27')](','):null;},'comment':_0x3b44('0x30')},'callgroup':{'type':Sequelize[_0x3b44('0x5')]},'namedcallgroup':{'type':Sequelize[_0x3b44('0x5')]},'pickupgroup':{'type':Sequelize[_0x3b44('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x3b44('0x5')]},'language':{'type':Sequelize[_0x3b44('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b44('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b44('0x32'),'set':function(_0xd88e25){this[_0x3b44('0x7')]('allow',_0xd88e25?_0xd88e25[_0x3b44('0x26')](';'):_0x3b44('0x32'));},'get':function(){return this[_0x3b44('0xc')]('allow')?this['getDataValue']('allow')['split'](';'):null;},'comment':_0x3b44('0x33')},'autoframing':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![],'set':function(_0x5b3150){this[_0x3b44('0x7')](_0x3b44('0x34'),_0x5b3150?_0x5b3150[_0x3b44('0x26')](','):null);},'get':function(){return this[_0x3b44('0xc')](_0x3b44('0x34'))?this[_0x3b44('0xc')](_0x3b44('0x34'))[_0x3b44('0x27')](','):null;},'comment':_0x3b44('0x35')},'trustrpid':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3b44('0x1a')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x3b44('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3b44('0x1a')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no',_0x3b44('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3b44('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3b44('0x1a')]('accept','refuse',_0x3b44('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x3b44('0x38'),_0x3b44('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3b44('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':_0x3b44('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3b44('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no','fingerprint',_0x3b44('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x3b44('0x1a')]('active',_0x3b44('0x3b'),_0x3b44('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3b44('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3b44('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3b44('0x1a')](_0x3b44('0x2d'),'no','nonat',_0x3b44('0x3d'),_0x3b44('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3b44('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x3b44('0x18')]},'passwordResetAt':{'type':Sequelize[_0x3b44('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x3b44('0x5')]},'showWebBar':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0,'set':function(_0x5d50dd){this[_0x3b44('0x7')](_0x3b44('0x3f'),_0x5d50dd);var _0x3408bb=this['get']({'plain':!![]});switch(_0x5d50dd){case 0x0:case 0x1:var _0x472367=_0x3408bb[_0x3b44('0x25')]?_['isArray'](_0x3408bb['transport'])?_0x3408bb[_0x3b44('0x25')]['join']():_0x3408bb[_0x3b44('0x25')]:_0x3b44('0x24');if(_0x472367==='wss'){_0x472367=_0x3b44('0x24');}this[_0x3b44('0x7')](_0x3b44('0x25'),_0x472367);this[_0x3b44('0x7')]('encryption','no');this[_0x3b44('0x7')](_0x3b44('0x40'),null);this[_0x3b44('0x7')](_0x3b44('0x41'),null);this[_0x3b44('0x7')]('icesupport',null);this[_0x3b44('0x7')](_0x3b44('0x42'),null);this[_0x3b44('0x7')](_0x3b44('0x43'),null);this[_0x3b44('0x7')]('dtlssetup',null);this[_0x3b44('0x7')](_0x3b44('0x44'),null);this[_0x3b44('0x7')]('dtlsprivatekey',null);this['setDataValue'](_0x3b44('0x45'),'no');break;case 0x2:this[_0x3b44('0x7')](_0x3b44('0x25'),_0x3b44('0x46'));this[_0x3b44('0x7')](_0x3b44('0x47'),_0x3b44('0x2d'));this['setDataValue'](_0x3b44('0x40'),_0x3b44('0x2d'));this['setDataValue'](_0x3b44('0x41'),_0x3b44('0x2d'));this[_0x3b44('0x7')](_0x3b44('0x48'),'yes');this[_0x3b44('0x7')](_0x3b44('0x42'),'yes');this[_0x3b44('0x7')]('dtlsverify','no');this[_0x3b44('0x7')](_0x3b44('0x49'),_0x3b44('0x3c'));this[_0x3b44('0x7')]('dtlscertfile',_0x3408bb['dtlscertfile']||_0x3b44('0x4a'));this[_0x3b44('0x7')](_0x3b44('0x4b'),_0x3408bb[_0x3b44('0x4b')]||_0x3b44('0x4c'));this[_0x3b44('0x7')](_0x3b44('0x45'),_0x3b44('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0x3b44('0x4d')],'set':function(_0x73cd21){this[_0x3b44('0x7')](_0x3b44('0x4e'),_0x73cd21?_0x73cd21[_0x3b44('0x26')](','):[]);},'get':function(){return this[_0x3b44('0xc')](_0x3b44('0x4e'))?_['map'](this[_0x3b44('0xc')]('permissions')[_0x3b44('0x27')](','),function(_0x39367a){return parseInt(_0x39367a,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3b44('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x3b44('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3b44('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3b44('0x1a')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3b44('0xc')](_0x3b44('0x4f'))?this[_0x3b44('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3b44('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3b44('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![],'set':function(_0x313958){if(typeof _0x313958===_0x3b44('0x50')){var _0x4431b5=_0x313958==='1'?!![]:_0x313958==='0'?![]:_0x313958==='true'?!![]:_0x313958===_0x3b44('0x51')?![]:![];this[_0x3b44('0x7')]('screenrecording',_0x4431b5);}else{this[_0x3b44('0x7')](_0x3b44('0x52'),_0x313958);}}},'blocked':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![],'set':function(_0x5a6855){this['setDataValue'](_0x3b44('0x53'),_0x5a6855);if(_0x5a6855===!![]){this[_0x3b44('0x7')](_0x3b44('0x54'),moment());this[_0x3b44('0x7')](_0x3b44('0x55'),0x0);}else{this[_0x3b44('0x7')](_0x3b44('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x3b44('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3b44('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3b44('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3b44('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 4d17eaf..45681a0 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 _0x785b=['online','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','QueueId','emit','Queue:save','voice','VoiceQueue','format','removeQueues','remove','Queues','Queue:remove','UserVoiceQueueRt','userpic','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','CmContact','CmList','List','Tag','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','x-forwarded-for','socket','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','update','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','isValidChannel','manual','mail','fax','sms','whatsapp','openchannel','Pause','getTeams','addTeams','Team','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','getDataValue','upsert','removeTeams','getChatQueues','getWhatsappQueues','transaction','removeAgent','getLists','getAgents','values','send','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','concat','$and','$or','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$any','firstName','Contact','dialActive','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','http','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','User,\x20%s,\x20%s','message','result','catch','count','offset','limit','status','set','json','apply','reject','save','destroy','get','admin','Users','Agents','agent','Telephones','ignore','map','value','includes','find','role','sendStatus','name','index','User','rawAttributes','fieldName','type','key','model','differenceBy','salt','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','sequelize','lower','col','includeAll','include','findAll','rows','show','params','password','filtears','options','body','describe','omit','ids','findById','securePassword','max','internal','isNil','min_internal','QueryTypes','SELECT','from','voicemail','VoiceMail','email','permissions','113','110','104','105','107','108','100','111','114','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','create','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','push','each','telephone','UserProfileSection','isEmpty','compact','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0x785b,0xd2));var _0xb785=function(_0x3ceb74,_0xf4dd5f){_0x3ceb74=_0x3ceb74-0x0;var _0x2bded6=_0x785b[_0x3ceb74];return _0x2bded6;};'use strict';var pdf=require(_0xb785('0x0'));var emlformat=require(_0xb785('0x1'));var rimraf=require(_0xb785('0x2'));var zipdir=require(_0xb785('0x3'));var jsonpatch=require(_0xb785('0x4'));var rp=require(_0xb785('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb785('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb785('0x7'));var csv=require(_0xb785('0x8'));var ejs=require(_0xb785('0x9'));var fs=require('fs');var _=require(_0xb785('0xa'));var squel=require(_0xb785('0xb'));var crypto=require(_0xb785('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb785('0xd'));var Papa=require(_0xb785('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb785('0xf'));var as=require(_0xb785('0x10'));var hardwareService=require(_0xb785('0x11'));var logger=require(_0xb785('0x12'))(_0xb785('0x13'));var utils=require(_0xb785('0x14'));var config=require(_0xb785('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb785('0x16'))['db'];config[_0xb785('0x17')]=_[_0xb785('0x18')](config[_0xb785('0x17')],{'host':_0xb785('0x19'),'port':0x18eb});var socket=require(_0xb785('0x1a'))(new Redis(config[_0xb785('0x17')]));require(_0xb785('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb785('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x51c9e0,_0x6d3521,_0xa69152,_0x59ccb0){return new BPromise(function(_0x18cfed,_0x3718f2){var _0x25145c=_0x59ccb0||client;return _0x25145c['request'](_0x51c9e0,_0xa69152)[_0xb785('0x1d')](function(_0x37ff9d){logger[_0xb785('0x1e')]('User,\x20%s,\x20%s',_0x6d3521,_0xb785('0x1f'));logger[_0xb785('0x20')](_0xb785('0x21'),_0x6d3521,_0xb785('0x1f'),JSON[_0xb785('0x22')](_0x37ff9d));if(_0x37ff9d[_0xb785('0x23')]){if(_0x37ff9d[_0xb785('0x23')]['code']===0x1f4){logger['error'](_0xb785('0x24'),_0x6d3521,_0x37ff9d[_0xb785('0x23')][_0xb785('0x25')]);return _0x3718f2(_0x37ff9d[_0xb785('0x23')][_0xb785('0x25')]);}logger[_0xb785('0x23')](_0xb785('0x24'),_0x6d3521,_0x37ff9d[_0xb785('0x23')]['message']);return _0x18cfed(_0x37ff9d[_0xb785('0x23')][_0xb785('0x25')]);}else{logger[_0xb785('0x1e')]('User,\x20%s,\x20%s',_0x6d3521,_0xb785('0x1f'));_0x18cfed(_0x37ff9d[_0xb785('0x26')]['message']);}})[_0xb785('0x27')](function(_0x255b67){logger[_0xb785('0x23')](_0xb785('0x24'),_0x6d3521,_0x255b67);_0x3718f2(_0x255b67);});});}function respondWithStatusCode(_0xbc2c27,_0x153f0e){_0x153f0e=_0x153f0e||0xcc;return function(_0xf20016){if(_0xf20016){return _0xbc2c27['sendStatus'](_0x153f0e);}return _0xbc2c27['status'](_0x153f0e)['end']();};}function respondWithResult(_0x44b0f9,_0x44773f){_0x44773f=_0x44773f||0xc8;return function(_0x5a6b0b){if(_0x5a6b0b){return _0x44b0f9['status'](_0x44773f)['json'](_0x5a6b0b);}};}function respondWithFilteredResult(_0x1e0781,_0x2d4d50){return function(_0x12de8c){if(_0x12de8c){var _0x391e1e=_0x12de8c[_0xb785('0x28')],_0x12b9ae=_0x2d4d50['offset'],_0x338c59=_0x2d4d50[_0xb785('0x29')]+_0x2d4d50[_0xb785('0x2a')],_0x5480e8;if(_0x338c59>=_0x391e1e){_0x338c59=_0x391e1e;_0x5480e8=0xc8;}else{_0x5480e8=0xce;}_0x1e0781[_0xb785('0x2b')](_0x5480e8);return _0x1e0781[_0xb785('0x2c')]('Content-Range',_0x12b9ae+'-'+_0x338c59+'/'+_0x391e1e)[_0xb785('0x2d')](_0x12de8c);}return null;};}function patchUpdates(_0xa4cbe){return function(_0x4bbffd){try{jsonpatch[_0xb785('0x2e')](_0x4bbffd,_0xa4cbe,!![]);}catch(_0x364fb3){return BPromise[_0xb785('0x2f')](_0x364fb3);}return _0x4bbffd[_0xb785('0x30')]();};}function saveUpdates(_0x367e5d,_0x275e18){return function(_0x3cf6f9){if(_0x3cf6f9){return _0x3cf6f9['update'](_0x367e5d)['then'](function(_0x33fb46){return _0x33fb46;});}return null;};}function removeEntity(_0x2d3026,_0x3472cc){return function(_0x262b27){if(_0x262b27){return _0x262b27[_0xb785('0x31')]()['then'](function(){var _0x39c585=_0x262b27[_0xb785('0x32')]({'plain':!![]});if(_0x39c585['role']===_0xb785('0x33'))return;var _0x590081=[{'name':_0xb785('0x34'),'value':'user','ignore':!![]},{'name':_0xb785('0x35'),'value':_0xb785('0x36'),'ignore':![]},{'name':_0xb785('0x37'),'value':'telephone','ignore':![]}];var _0x346235=_(_0x590081)['filter'](_0xb785('0x38'))[_0xb785('0x39')](_0xb785('0x3a'))['value']();if(_[_0xb785('0x3b')](_0x346235,_0x39c585['role'])){return;}var _0x21cd94=_[_0xb785('0x3c')](_0x590081,[_0xb785('0x3a'),_0x39c585[_0xb785('0x3d')]])['name'];return db['UserProfileResource'][_0xb785('0x31')]({'where':{'type':_0x21cd94,'resourceId':_0x39c585['id']}})['then'](function(){return _0x262b27;});})['then'](function(){_0x2d3026[_0xb785('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd355c7,_0xae34ee){return function(_0x166e14){if(!_0x166e14){_0xd355c7[_0xb785('0x3e')](0x194);}return _0x166e14;};}function handleError(_0x3015f4,_0x37aaab){_0x37aaab=_0x37aaab||0x1f4;return function(_0x4571db){logger[_0xb785('0x23')](_0x4571db['stack']);if(_0x4571db[_0xb785('0x3f')]){delete _0x4571db[_0xb785('0x3f')];}_0x3015f4[_0xb785('0x2b')](_0x37aaab)['send'](_0x4571db);};}exports[_0xb785('0x40')]=function(_0x344927,_0x32e3a0){var _0x1e27dd={},_0xecfa83={},_0x252446={'count':0x0,'rows':[]};var _0x2adc11=_[_0xb785('0x39')](db[_0xb785('0x41')][_0xb785('0x42')],function(_0x42bd78){return{'name':_0x42bd78[_0xb785('0x43')],'type':_0x42bd78[_0xb785('0x44')][_0xb785('0x45')]};});_0xecfa83[_0xb785('0x46')]=_[_0xb785('0x47')](_['map'](_0x2adc11,_0xb785('0x3f')),['password',_0xb785('0x48')]);_0xecfa83[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x344927[_0xb785('0x49')]);_0xecfa83['filters']=_[_0xb785('0x4b')](_0xecfa83[_0xb785('0x46')],_0xecfa83[_0xb785('0x49')]);_0x1e27dd[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0xecfa83[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x344927[_0xb785('0x49')][_0xb785('0x4d')]));_0x1e27dd[_0xb785('0x4c')]=_0x1e27dd[_0xb785('0x4c')][_0xb785('0x4e')]?_0x1e27dd[_0xb785('0x4c')]:_0xecfa83[_0xb785('0x46')];if(!_0x344927[_0xb785('0x49')][_0xb785('0x4f')]('nolimit')){_0x1e27dd['limit']=qs[_0xb785('0x2a')](_0x344927[_0xb785('0x49')][_0xb785('0x2a')]);_0x1e27dd[_0xb785('0x29')]=qs['offset'](_0x344927['query']['offset']);}_0x1e27dd[_0xb785('0x50')]=qs['sort'](_0x344927[_0xb785('0x49')][_0xb785('0x51')]);_0x1e27dd[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x344927[_0xb785('0x49')],_0xecfa83[_0xb785('0x53')]),_0x2adc11);if(_0x344927['query'][_0xb785('0x55')]){_0x1e27dd['where']=_[_0xb785('0x56')](_0x1e27dd[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x2adc11,function(_0x109ebc){if(_0x109ebc[_0xb785('0x44')]!==_0xb785('0x57')){return db[_0xb785('0x58')]['where'](db[_0xb785('0x58')]['fn'](_0xb785('0x59'),db[_0xb785('0x58')][_0xb785('0x5a')](_0x109ebc['name'])),{'$like':db['sequelize']['fn'](_0xb785('0x59'),'%'+_0x344927[_0xb785('0x49')][_0xb785('0x55')]+'%')});}})});}_0x1e27dd=_[_0xb785('0x56')]({},_0x1e27dd,_0x344927['options']);var _0xa5645c={'where':_0x1e27dd[_0xb785('0x52')]};return db[_0xb785('0x41')][_0xb785('0x28')](_0xa5645c)[_0xb785('0x1d')](function(_0x46dda3){_0x252446[_0xb785('0x28')]=_0x46dda3;if(_0x344927['query'][_0xb785('0x5b')]){_0x1e27dd[_0xb785('0x5c')]=[{'all':!![]}];}return db[_0xb785('0x41')][_0xb785('0x5d')](_0x1e27dd);})[_0xb785('0x1d')](function(_0x5e6dd1){_0x252446[_0xb785('0x5e')]=_0x5e6dd1;return _0x252446;})[_0xb785('0x1d')](respondWithFilteredResult(_0x32e3a0,_0x1e27dd))[_0xb785('0x27')](handleError(_0x32e3a0,null));};exports[_0xb785('0x5f')]=function(_0x482c12,_0x1591ca){var _0x5177cc={'raw':![],'where':{'id':_0x482c12[_0xb785('0x60')]['id']}},_0x2d5de3={};_0x2d5de3[_0xb785('0x46')]=_[_0xb785('0x47')](_[_0xb785('0x4a')](db[_0xb785('0x41')]['rawAttributes']),[_0xb785('0x61'),_0xb785('0x48')]);_0x2d5de3[_0xb785('0x49')]=_['keys'](_0x482c12['query']);_0x2d5de3[_0xb785('0x62')]=_[_0xb785('0x4b')](_0x2d5de3[_0xb785('0x46')],_0x2d5de3['query']);_0x5177cc['attributes']=_[_0xb785('0x4b')](_0x2d5de3[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x482c12['query'][_0xb785('0x4d')]));_0x5177cc[_0xb785('0x4c')]=_0x5177cc['attributes']['length']?_0x5177cc[_0xb785('0x4c')]:_0x2d5de3[_0xb785('0x46')];if(_0x482c12[_0xb785('0x49')]['includeAll']){_0x5177cc[_0xb785('0x5c')]=[{'all':!![]}];}_0x5177cc=_['merge']({},_0x5177cc,_0x482c12[_0xb785('0x63')]);return db[_0xb785('0x41')][_0xb785('0x3c')](_0x5177cc)[_0xb785('0x1d')](handleEntityNotFound(_0x1591ca,null))[_0xb785('0x1d')](respondWithResult(_0x1591ca,null))[_0xb785('0x27')](handleError(_0x1591ca,null));};exports['update']=function(_0xf9bd69,_0x396e16){if(_0xf9bd69[_0xb785('0x64')]['id']){delete _0xf9bd69[_0xb785('0x64')]['id'];}delete _0xf9bd69[_0xb785('0x64')][_0xb785('0x3d')];return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0xf9bd69['params']['id']}})['then'](handleEntityNotFound(_0x396e16,null))[_0xb785('0x1d')](saveUpdates(_0xf9bd69[_0xb785('0x64')],null))['then'](respondWithResult(_0x396e16,null))[_0xb785('0x27')](handleError(_0x396e16,null));};exports[_0xb785('0x65')]=function(_0x37fb8c,_0x2a470a){return db[_0xb785('0x41')][_0xb785('0x65')]()[_0xb785('0x1d')](respondWithResult(_0x2a470a,null))[_0xb785('0x27')](handleError(_0x2a470a,null));};exports['addContacts']=function(_0x15e0e9,_0x444237,_0x4f7b8a){return db['User'][_0xb785('0x3c')]({'where':{'id':_0x15e0e9['params']['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x444237,null))[_0xb785('0x1d')](function(_0xe4cd99){if(_0xe4cd99){return _0xe4cd99['addContacts'](_0x15e0e9[_0xb785('0x64')]['ids'],_[_0xb785('0x66')](_0x15e0e9[_0xb785('0x64')],[_0xb785('0x67'),'id'])||{});}})[_0xb785('0x1d')](respondWithResult(_0x444237,null))[_0xb785('0x27')](handleError(_0x444237,null));};function validateUser(_0x236a67){return new BPromise(function(_0x5a0fe3,_0x25008d){if(_0x236a67['internal'])return _0x5a0fe3();return db['Setting'][_0xb785('0x68')](0x1)[_0xb785('0x1d')](function(_0x26b702){if(_0x26b702[_0xb785('0x69')])authService['validatePasswordPattern'](_0x236a67[_0xb785('0x61')]);db['User'][_0xb785('0x6a')](_0xb785('0x6b'))[_0xb785('0x1d')](function(_0x2e13ec){if(_[_0xb785('0x6c')](_0x2e13ec)){_0x236a67[_0xb785('0x6b')]=_0x26b702['min_internal']||0x1;return;}if(_['isNil'](_0x26b702['min_internal'])||_0x26b702[_0xb785('0x6d')]===_0x2e13ec){_0x236a67['internal']=_0x2e13ec+0x1;return;}if(_0x26b702[_0xb785('0x6d')]>_0x2e13ec){_0x236a67[_0xb785('0x6b')]=_0x26b702['min_internal'];return;}return db[_0xb785('0x58')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xb785('0x58')][_0xb785('0x6e')][_0xb785('0x6f')]})['then'](function(_0x166f0b){if(_0x166f0b&&_0x166f0b[_0xb785('0x4e')]){for(var _0x469388=0x0,_0xd81fe8=_0x166f0b[_0xb785('0x4e')];_0x469388<_0xd81fe8&&_['isNil'](_0x236a67[_0xb785('0x6b')]);_0x469388++){if(_0x26b702[_0xb785('0x6d')]<=_0x166f0b[_0x469388][_0xb785('0x70')]){_0x236a67['internal']=_0x166f0b[_0x469388][_0xb785('0x70')];}else if(_0x26b702[_0xb785('0x6d')]>_0x166f0b[_0x469388][_0xb785('0x70')]&&_0x26b702[_0xb785('0x6d')]<=_0x166f0b[_0x469388]['to']){_0x236a67[_0xb785('0x6b')]=_0x26b702['min_internal'];}}}if(_[_0xb785('0x6c')](_0x236a67[_0xb785('0x6b')])){_0x236a67[_0xb785('0x6b')]=_0x2e13ec+0x1;}return _0x5a0fe3(_0x236a67);});});})[_0xb785('0x27')](function(_0x5c0160){_0x25008d(_0x5c0160);});});}function updateUser(_0x16e370){return new BPromise(function(_0x36d7cb,_0x59737f){try{if(_0x16e370[_0xb785('0x71')]){_0x16e370['mailbox']=_0x16e370[_0xb785('0x6b')];_0x16e370[_0xb785('0x72')]={'mailbox':_0x16e370[_0xb785('0x6b')],'password':_0x16e370['password'],'fullname':_0x16e370['fullname'],'email':_0x16e370[_0xb785('0x73')]};}if(_0x16e370[_0xb785('0x3d')]===_0xb785('0x36')){if(!_0x16e370[_0xb785('0x74')])_0x16e370[_0xb785('0x74')]=['101','102','103',_0xb785('0x75'),_0xb785('0x76'),_0xb785('0x77'),_0xb785('0x78'),'106',_0xb785('0x79'),_0xb785('0x7a'),'109',_0xb785('0x7b'),_0xb785('0x7c'),_0xb785('0x7d')];}_0x36d7cb(_0x16e370);}catch(_0xd1a346){_0x59737f(_0xd1a346);}});}exports['create']=function(_0x4063b3,_0x58be1a){if(_0x4063b3[_0xb785('0x7e')][_0xb785('0x3d')]===_0xb785('0x36'))throw new Error(_0xb785('0x7f'));if(_0x4063b3[_0xb785('0x64')]['role']===_0xb785('0x7e')&&_0x4063b3[_0xb785('0x7e')][_0xb785('0x3d')]!==_0xb785('0x33')){throw new Error(_0xb785('0x80'));}if(_0x4063b3['body'][_0xb785('0x3d')]===_0xb785('0x33')&&_0x4063b3[_0xb785('0x7e')][_0xb785('0x3d')]!==_0xb785('0x33')){throw new Error(_0xb785('0x81'));}return licenseUtil['checkUserLimits']([_0x4063b3[_0xb785('0x64')]])[_0xb785('0x1d')](function(){return validateUser(_0x4063b3['body']);})[_0xb785('0x1d')](function(_0x29763f){return updateUser(_0x29763f)['then'](function(_0x41b554){if(_0x41b554['role']==='admin'){_0x41b554[_0xb785('0x82')]=_0x4063b3['user'][_0xb785('0x82')];delete _0x41b554[_0xb785('0x83')];}return _0x41b554;});})[_0xb785('0x1d')](function(_0x28b492){return db[_0xb785('0x41')][_0xb785('0x84')](_0x28b492,{'include':[{'model':db['VoiceMail'],'as':_0xb785('0x72')}]});})[_0xb785('0x1d')](function(_0xbc024){if(_0x4063b3[_0xb785('0x64')]['role']===_0xb785('0x7e'))return _0xbc024;if(_0x4063b3[_0xb785('0x7e')][_0xb785('0x3d')]!==_0xb785('0x7e'))return _0xbc024;return db['UserProfileSection'][_0xb785('0x3c')]({'where':{'name':_0xbc024[_0xb785('0x3d')]===_0xb785('0x36')?_0xb785('0x35'):_0xb785('0x37'),'userProfileId':_0x4063b3[_0xb785('0x7e')][_0xb785('0x83')]},'raw':!![]})['then'](function(_0x249dab){if(!_0x249dab||_0x249dab[_0xb785('0x85')]!=0x0)return _0xbc024;return db[_0xb785('0x86')][_0xb785('0x84')]({'name':_0xbc024[_0xb785('0x3f')],'resourceId':_0xbc024['id'],'type':_0x249dab[_0xb785('0x3f')],'sectionId':_0x249dab['id']},{})['then'](function(){return _0xbc024;});})[_0xb785('0x27')](function(_0x259d45){logger[_0xb785('0x23')](_0xb785('0x87'),_0x259d45);throw _0x259d45;});})[_0xb785('0x1d')](respondWithResult(_0x58be1a,0xc9))[_0xb785('0x27')](handleError(_0x58be1a,null));};exports[_0xb785('0x88')]=function(_0x617478,_0x20840c){var _0x1ee61f=_0x617478[_0xb785('0x64')];var _0x33044d=[];if(_0x617478[_0xb785('0x7e')][_0xb785('0x3d')]===_0xb785('0x36'))throw new Error(_0xb785('0x7f'));if(_[_0xb785('0x89')](_0x1ee61f,[_0xb785('0x3d'),_0xb785('0x7e')])&&_0x617478['user'][_0xb785('0x3d')]!==_0xb785('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x1ee61f,['role','admin'])&&_0x617478[_0xb785('0x7e')][_0xb785('0x3d')]!=='admin'){throw new Error(_0xb785('0x8a'));}return licenseUtil['checkUserLimits'](_0x1ee61f)[_0xb785('0x1d')](function(){return validateUser(_0x1ee61f[0x0]);})[_0xb785('0x1d')](function(){for(var _0x264150=0x1;_0x264150<_0x1ee61f[_0xb785('0x4e')];_0x264150++){var _0x2c3f38=_0x1ee61f[_0x264150-0x1]['internal'];if(!_0x1ee61f[_0x264150][_0xb785('0x6b')])_0x1ee61f[_0x264150][_0xb785('0x6b')]=_0x2c3f38+0x1;_0x33044d['push'](validateUser(_0x1ee61f[_0x264150]));}return BPromise[_0xb785('0x8b')](_0x33044d);})[_0xb785('0x1d')](function(){_0x33044d=[];for(var _0x58d2d7=0x0;_0x58d2d7<_0x1ee61f[_0xb785('0x4e')];_0x58d2d7++){_0x33044d[_0xb785('0x8c')](updateUser(_0x1ee61f[_0x58d2d7]));}return BPromise['all'](_0x33044d);})[_0xb785('0x1d')](function(){return BPromise[_0xb785('0x8d')](_0x1ee61f,function(_0x4fd205){return db[_0xb785('0x41')][_0xb785('0x84')](_0x4fd205,{'include':[{'model':db['VoiceMail'],'as':_0xb785('0x72')}]})[_0xb785('0x1d')](function(_0x3bc3c9){_0x4fd205['id']=_0x3bc3c9['id'];return _0x4fd205;});});})[_0xb785('0x1d')](function(_0x291ad5){if(_0x617478[_0xb785('0x64')][_0xb785('0x3d')]===_0xb785('0x7e'))return _0x291ad5;if(_0x617478[_0xb785('0x7e')][_0xb785('0x3d')]!=='user')return _0x291ad5;var _0x44f2e2=_[_0xb785('0x89')](_0x291ad5,function(_0x5bb467){return _0x5bb467[_0xb785('0x3d')]===_0xb785('0x36')||_0x5bb467[_0xb785('0x3d')]===_0xb785('0x8e');});if(!_0x44f2e2)return _0x291ad5;return db[_0xb785('0x8f')]['findAll']({'where':{'name':{'$or':[_0xb785('0x35'),'Telephones']},'userProfileId':_0x617478[_0xb785('0x7e')][_0xb785('0x83')]},'raw':!![]})[_0xb785('0x1d')](function(_0x46790d){if(_[_0xb785('0x90')](_0x46790d)||!_[_0xb785('0x89')](_0x46790d,[_0xb785('0x85'),0x0]))return _0x291ad5;_0x33044d=[];var _0x17d5b1=_(_0x46790d)[_0xb785('0x39')](function(_0x11d964){if(_0x11d964[_0xb785('0x85')]===0x1)return;return _0x11d964[_0xb785('0x3f')]===_0xb785('0x35')?'agent':_0xb785('0x8e');})[_0xb785('0x91')]()[_0xb785('0x3a')]();for(var _0x800da1=0x0;_0x800da1<_0x291ad5['length'];_0x800da1++){if(!_[_0xb785('0x3b')](_0x17d5b1,_0x291ad5[_0x800da1][_0xb785('0x3d')]))return;var _0x1c12a7=_0x291ad5[_0x800da1][_0xb785('0x3d')]===_0xb785('0x36')?_0xb785('0x35'):_0xb785('0x37');_0x33044d[_0xb785('0x8c')](db['UserProfileResource']['create']({'name':_0x291ad5[_0x800da1][_0xb785('0x3f')],'resourceId':_0x291ad5[_0x800da1]['id'],'type':_0x1c12a7,'sectionId':_[_0xb785('0x3c')](_0x46790d,[_0xb785('0x3f'),_0x1c12a7])['id']},{}));}return BPromise['all'](_0x33044d);})[_0xb785('0x1d')](respondWithResult(_0x20840c,0xc9))[_0xb785('0x27')](handleError(_0x20840c,null));});};exports[_0xb785('0x92')]=function(_0x57adbf,_0x1497ee,_0x2d9f2a){if(_0x57adbf[_0xb785('0x64')]['id']){delete _0x57adbf['body']['id'];}return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0x57adbf[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](function(_0x32ca0a){if(!_0x32ca0a)return null;if(_0x32ca0a['id']===_0x57adbf[_0xb785('0x7e')]['id']){if(!_0x57adbf[_0xb785('0x64')][_0xb785('0x93')]||!_0x57adbf[_0xb785('0x64')]['newPassword']){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))](_0xb785('0x96'));}if(!_0x32ca0a['authenticate'](_0x57adbf[_0xb785('0x64')][_0xb785('0x93')])){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))](_0xb785('0x97'));}if(_0x57adbf[_0xb785('0x64')]['oldPassword']===_0x57adbf[_0xb785('0x64')][_0xb785('0x98')]){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x57adbf[_0xb785('0x7e')][_0xb785('0x3d')]===_0xb785('0x33')){if(!_0x57adbf['body'][_0xb785('0x98')]){throw new db[(_0xb785('0x94'))]['ValidationError'](_0xb785('0x99'));}}else if(_0x57adbf[_0xb785('0x7e')][_0xb785('0x3d')]===_0xb785('0x7e')){if(!_0x57adbf[_0xb785('0x64')]['newPassword']){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x32ca0a[_0xb785('0x3d')]!==_0xb785('0x36')){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))](_0xb785('0x7f'));}}else{throw new db[(_0xb785('0x94'))]['ValidationError']('Unauthorized');}return _0x32ca0a;})[_0xb785('0x1d')](handleEntityNotFound(_0x1497ee,null))[_0xb785('0x1d')](function(_0x4361dd){return db[_0xb785('0x9a')][_0xb785('0x9b')]({'attributes':['id',_0xb785('0x69'),_0xb785('0x9c'),'passwordHistoryLimit']})['then'](function(_0x2fbf0c){if(_0x2fbf0c[_0xb785('0x69')])authService['validatePasswordPattern'](_0x57adbf[_0xb785('0x64')]['newPassword']);if(!_0x2fbf0c['enforcePasswordHistory']||!_0x4361dd['previousPasswords'])return _0x4361dd;authService[_0xb785('0x9d')](_0x57adbf[_0xb785('0x64')][_0xb785('0x98')],_0x4361dd[_0xb785('0x9e')],_0x2fbf0c[_0xb785('0x9f')]);return _0x4361dd;})[_0xb785('0x1d')](saveUpdates({'password':_0x57adbf[_0xb785('0x64')][_0xb785('0x98')],'passwordResetAt':_0x57adbf[_0xb785('0x7e')]['id']==_0x57adbf[_0xb785('0x60')]['id']?moment():null,'previousPasswords':authService[_0xb785('0xa0')](_0x57adbf['body'][_0xb785('0x98')],_0x4361dd[_0xb785('0x9e')])},null));})[_0xb785('0x1d')](respondWithResult(_0x1497ee,null))[_0xb785('0x27')](handleError(_0x1497ee,null));};exports[_0xb785('0xa1')]=function(_0x45c2da,_0x36a588,_0x13d8f3){var _0x27215e=_0x45c2da[_0xb785('0x64')][_0xb785('0xa2')];return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0x45c2da[_0xb785('0x60')]['id']},'attributes':['id',_0xb785('0x3f'),_0xb785('0x3d'),_0xb785('0xa3'),_0xb785('0xa4'),_0xb785('0xa5'),_0xb785('0xa6')]})[_0xb785('0x1d')](handleEntityNotFound(_0x36a588,null))[_0xb785('0x1d')](function(_0x5995ee){if(_0x5995ee){if(!utils['isValidChannel'](_0x27215e)){throw new db[(_0xb785('0x94'))]['ValidationError'](_0xb785('0xa7'));}return _0x5995ee[_0xb785('0xa8')+_['capitalize'](_0x27215e[_0xb785('0xa9')]())+'Queues'](_0x45c2da[_0xb785('0x64')][_0xb785('0x67')],{'penalty':_0x45c2da[_0xb785('0x64')][_0xb785('0xaa')]||0x0})[_0xb785('0xab')](function(_0x26ebe0){for(var _0x423936=0x0;_0x423936<_0x45c2da[_0xb785('0x64')]['ids'][_0xb785('0x4e')];_0x423936+=0x1){var _0x1586d3={'UserId':_0x45c2da[_0xb785('0x60')]['id']};_0x1586d3[_[_0xb785('0xac')](_0x27215e['toLowerCase']())+_0xb785('0xad')]=_0x45c2da[_0xb785('0x64')][_0xb785('0x67')][_0x423936];socket[_0xb785('0xae')]('user'+_[_0xb785('0xac')](_0x27215e[_0xb785('0xa9')]())+_0xb785('0xaf'),_0x1586d3);}return _0x26ebe0;})[_0xb785('0x1d')](function(){if(_0x27215e===_0xb785('0xb0')){return db[_0xb785('0xb1')][_0xb785('0x5d')]({'where':{'id':_0x45c2da[_0xb785('0x64')]['ids']||[]},'raw':!![],'attributes':['id',_0xb785('0x3f')]});}})[_0xb785('0x1d')](function(_0x31cdb2){var _0x5b3576=_0x5995ee[_0xb785('0x32')]({'plain':!![]});var _0x4826c3=[];if(_0x27215e===_0xb785('0xb0')&&_0x5b3576[_0xb785('0x3d')]===_0xb785('0x36')&&_0x5b3576['online']){for(var _0x411375=0x0;_0x411375<_0x31cdb2['length'];_0x411375+=0x1){_0x4826c3[_0xb785('0x8c')]({'membername':_0x5b3576[_0xb785('0x3f')],'UserId':_0x5b3576['id'],'queue_name':_0x31cdb2[_0x411375][_0xb785('0x3f')],'VoiceQueueId':_0x31cdb2[_0x411375]['id'],'interface':_['isNil'](_0x5b3576['interface'])?util[_0xb785('0xb2')]('SIP/%s',_0x5b3576[_0xb785('0x3f')]):_0x5b3576[_0xb785('0xa6')],'paused':_0x5b3576['voicePause']||![],'penalty':_0x45c2da['body'][_0xb785('0xaa')]||0x0});}return BPromise[_0xb785('0x8d')](_0x4826c3,function(_0x463e32){return db['UserVoiceQueueRt']['upsert'](_0x463e32);});}return _0x5995ee;});}})[_0xb785('0x1d')](respondWithStatusCode(_0x36a588,null))[_0xb785('0x27')](handleError(_0x36a588,null));};exports[_0xb785('0xb3')]=function(_0x50b57c,_0x2ce335,_0x5e39b2){var _0x41905f;return db['User']['find']({'where':{'id':_0x50b57c[_0xb785('0x60')]['id']},'attributes':['id',_0xb785('0x3f'),_0xb785('0x3d')]})[_0xb785('0x1d')](handleEntityNotFound(_0x2ce335,null))[_0xb785('0x1d')](function(_0xf78c86){if(_0xf78c86){_0x41905f=_0xf78c86;if(!_0x50b57c[_0xb785('0x49')][_0xb785('0xa2')]||!utils['isValidChannel'](_0x50b57c[_0xb785('0x49')][_0xb785('0xa2')])){throw new db['Sequelize'][(_0xb785('0x95'))](_0xb785('0xa7'));}return _0xf78c86[_0xb785('0xb4')+_['capitalize'](_0x50b57c[_0xb785('0x49')][_0xb785('0xa2')][_0xb785('0xa9')]())+_0xb785('0xb5')](_0x50b57c[_0xb785('0x49')][_0xb785('0x67')]);}})['then'](function(_0x325a9a){for(var _0x46b51f=0x0;_0x46b51f<_0x50b57c['query'][_0xb785('0x67')]['length'];_0x46b51f+=0x1){var _0x4038de={'UserId':_0x50b57c[_0xb785('0x60')]['id']};_0x4038de[_['capitalize'](_0x50b57c['query'][_0xb785('0xa2')][_0xb785('0xa9')]())+_0xb785('0xad')]=_0x50b57c[_0xb785('0x49')][_0xb785('0x67')][_0x46b51f];socket[_0xb785('0xae')](_0xb785('0x7e')+_[_0xb785('0xac')](_0x50b57c['query']['channel']['toLowerCase']())+_0xb785('0xb6'),_0x4038de);}return _0x325a9a;})[_0xb785('0x1d')](function(){if(_0x50b57c[_0xb785('0x49')]['channel']===_0xb785('0xb0')){return db[_0xb785('0xb7')][_0xb785('0x31')]({'where':{'UserId':_0x50b57c['params']['id'],'VoiceQueueId':_0x50b57c[_0xb785('0x49')][_0xb785('0x67')]},'individualHooks':!![]})[_0xb785('0x1d')](function(){return _0x41905f;});}return _0x41905f;})[_0xb785('0x1d')](respondWithStatusCode(_0x2ce335,null))[_0xb785('0x27')](handleError(_0x2ce335,null));};exports['addAvatar']=function(_0x30d26f,_0x4f94d5,_0x18f86a){_0x30d26f[_0xb785('0x64')][_0xb785('0xb8')]=_0x30d26f['file'][_0xb785('0xb9')];return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0x30d26f['params']['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x4f94d5,null))[_0xb785('0x1d')](saveUpdates(_0x30d26f['body'],null))[_0xb785('0x1d')](respondWithResult(_0x4f94d5,null))['catch'](handleError(_0x4f94d5,null));};exports['getAvatar']=function(_0x3d75f6,_0x233a57,_0xfda445){var _0x2f5fdc=path[_0xb785('0xba')](config[_0xb785('0xbb')],_0xb785('0xbc'));return db[_0xb785('0x41')]['find']({'where':{'id':_0x3d75f6[_0xb785('0x60')]['id']},'attributes':['id',_0xb785('0xb8')],'raw':!![]})[_0xb785('0x1d')](handleEntityNotFound(_0x233a57,null))[_0xb785('0x1d')](function(_0x3d5f11){if(_0x3d5f11){if(_[_0xb785('0x6c')](_0x3d5f11['userpic'])){return _0x233a57[_0xb785('0xbd')](_0x2f5fdc);}else{if(!fs[_0xb785('0xbe')](path[_0xb785('0xba')](config[_0xb785('0xbb')],'server/files/images/',_0x3d5f11[_0xb785('0xb8')]))){return _0x233a57[_0xb785('0xbd')](_0x2f5fdc);}return _0x233a57[_0xb785('0xbd')](path['join'](config[_0xb785('0xbb')],_0xb785('0xbf'),_0x3d5f11[_0xb785('0xb8')]));}}})[_0xb785('0x27')](handleError(_0x233a57,null));};exports[_0xb785('0xc0')]=function(_0xfcc8bc,_0x10ff4f,_0x8ed4c2){var _0x20d765={};var _0xe0a10d={};var _0x5954bb;var _0x31d05a;return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0xfcc8bc[_0xb785('0x60')]['id']}})['then'](handleEntityNotFound(_0x10ff4f,null))[_0xb785('0x1d')](function(_0x53f58a){if(_0x53f58a){_0x5954bb=_0x53f58a;_0xe0a10d[_0xb785('0x46')]=_['keys'](db[_0xb785('0xc1')][_0xb785('0x42')]);_0xe0a10d['query']=_['keys'](_0xfcc8bc['query']);_0xe0a10d[_0xb785('0x53')]=_['intersection'](_0xe0a10d[_0xb785('0x46')],_0xe0a10d[_0xb785('0x49')]);_0x20d765[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0xe0a10d[_0xb785('0x46')],qs[_0xb785('0x4d')](_0xfcc8bc['query'][_0xb785('0x4d')]));_0x20d765[_0xb785('0x4c')]=_0x20d765[_0xb785('0x4c')]['length']?_0x20d765[_0xb785('0x4c')]:_0xe0a10d[_0xb785('0x46')];_0x20d765[_0xb785('0x50')]=qs[_0xb785('0x51')](_0xfcc8bc[_0xb785('0x49')][_0xb785('0x51')]);_0x20d765['where']=qs[_0xb785('0x53')](_['pick'](_0xfcc8bc['query'],_0xe0a10d['filters']));if(_0xfcc8bc[_0xb785('0x49')][_0xb785('0x55')]){_0x20d765[_0xb785('0x52')]=_[_0xb785('0x56')](_0x20d765[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x20d765['attributes'],function(_0x1f7396){var _0x361716={};_0x361716[_0x1f7396]={'$like':'%'+_0xfcc8bc[_0xb785('0x49')]['filter']+'%'};return _0x361716;})});}_0x20d765=_[_0xb785('0x56')]({},_0x20d765,_0xfcc8bc[_0xb785('0x63')]);return _0x5954bb['getContacts'](_0x20d765);}})[_0xb785('0x1d')](function(_0x1c2d3a){if(_0x1c2d3a){_0x31d05a=_0x1c2d3a['length'];if(_0xfcc8bc[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0x5b'))){_0x20d765[_0xb785('0x5c')]=[{'model':db[_0xb785('0xc2')],'as':_0xb785('0xc3'),'required':![]},{'model':db[_0xb785('0xc4')],'as':_0xb785('0xc5'),'attributes':['id',_0xb785('0x3f'),_0xb785('0xc6')],'where':_0xfcc8bc['query']['tag']?{'id':_0xfcc8bc[_0xb785('0x49')]['tag']}:undefined,'required':_0xfcc8bc['query'][_0xb785('0xc7')]?!![]:![]}];}if(!_0xfcc8bc[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x20d765[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0xfcc8bc[_0xb785('0x49')][_0xb785('0x2a')]);_0x20d765[_0xb785('0x29')]=qs[_0xb785('0x29')](_0xfcc8bc[_0xb785('0x49')]['offset']);}return _0x5954bb[_0xb785('0xc0')](_0x20d765);}})[_0xb785('0x1d')](function(_0x53831d){if(_0x53831d){return _0x53831d?{'count':_0x31d05a,'rows':_0x53831d}:null;}})[_0xb785('0x1d')](respondWithResult(_0x10ff4f,null))['catch'](handleError(_0x10ff4f,null));};exports[_0xb785('0xc9')]=function(_0x7d7a6,_0x1ebb51,_0x2b7026){var _0x1005e7;var _0x527542;var _0x3a4c90={};var _0x577890;return db[_0xb785('0x41')]['findOne']({'where':{'id':_0x7d7a6[_0xb785('0x60')]['id']},'attributes':['id',_0xb785('0x3f'),_0xb785('0x3d')]})[_0xb785('0x1d')](handleEntityNotFound(_0x1ebb51,null))[_0xb785('0x1d')](function(_0x338627){if(!utils['isValidChannel'](_0x7d7a6[_0xb785('0x49')][_0xb785('0xa2')])){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))]('Unknown\x20channel');}_0x1005e7=_0x338627;var _0x5ee3d6={};_0x5ee3d6[_0xb785('0x46')]=_['keys'](db[_[_0xb785('0xac')](_0x7d7a6['query']['channel'])+_0xb785('0xca')][_0xb785('0x42')]);_0x5ee3d6['query']=_['keys'](_0x7d7a6['query']);_0x5ee3d6[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x5ee3d6['model'],_0x5ee3d6['query']);_0x3a4c90[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x5ee3d6[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x7d7a6[_0xb785('0x49')][_0xb785('0x4d')]));_0x3a4c90['attributes']=_0x3a4c90[_0xb785('0x4c')][_0xb785('0x4e')]?_0x3a4c90[_0xb785('0x4c')]:_0x5ee3d6['model'];_0x3a4c90['order']=qs['sort'](_0x7d7a6[_0xb785('0x49')][_0xb785('0x51')]);_0x3a4c90['where']=qs[_0xb785('0x53')](_['pick'](_0x7d7a6[_0xb785('0x49')],_0x5ee3d6[_0xb785('0x53')]));if(_0x7d7a6[_0xb785('0x49')][_0xb785('0x55')]){_0x3a4c90[_0xb785('0x52')]=_[_0xb785('0x56')](_0x3a4c90[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x3a4c90['attributes'],function(_0x1ecee6){var _0x39c7ac={};_0x39c7ac[_0x1ecee6]={'$like':'%'+_0x7d7a6[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x39c7ac;})});}_0x3a4c90=_[_0xb785('0x56')]({},_0x3a4c90,_0x7d7a6[_0xb785('0x63')]);switch(_0x1005e7['role']){case'admin':return db[_['capitalize'](_0x7d7a6[_0xb785('0x49')]['channel'])+_0xb785('0xca')]['findAll'](_0x3a4c90);case _0xb785('0x7e'):case _0xb785('0x36'):return _0x1005e7[_0xb785('0x32')+_['capitalize'](_0x7d7a6[_0xb785('0x49')][_0xb785('0xa2')])+'Queues'](_0x3a4c90);default:throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))](_0xb785('0xcb'));}})[_0xb785('0x1d')](function(_0x45b730){_0x577890=_0x45b730[_0xb785('0x4e')];if(!_0x7d7a6[_0xb785('0x49')][_0xb785('0x4f')]('nolimit')){_0x3a4c90[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x7d7a6['query'][_0xb785('0x2a')]);_0x3a4c90[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x7d7a6['query'][_0xb785('0x29')]);}switch(_0x1005e7[_0xb785('0x3d')]){case _0xb785('0x33'):return db[_[_0xb785('0xac')](_0x7d7a6['query'][_0xb785('0xa2')])+_0xb785('0xca')][_0xb785('0x5d')](_0x3a4c90);case'user':case'agent':return _0x1005e7[_0xb785('0x32')+_[_0xb785('0xac')](_0x7d7a6[_0xb785('0x49')][_0xb785('0xa2')])+_0xb785('0xb5')](_0x3a4c90);}})[_0xb785('0x1d')](function(_0x2b124d){return{'count':_0x577890,'rows':_0x2b124d};})[_0xb785('0x1d')](respondWithResult(_0x1ebb51,null))[_0xb785('0x27')](handleError(_0x1ebb51,null));};exports[_0xb785('0xcc')]=function(_0x237931,_0x18d629,_0xe0e47a){var _0x43cf6e={};var _0x4fd72c={};var _0x4fbe34;var _0x49c5a9;return db[_0xb785('0x41')]['findOne']({'where':{'id':_0x237931[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x18d629,null))[_0xb785('0x1d')](function(_0x2d060f){if(_0x2d060f){_0x4fbe34=_0x2d060f;_0x4fd72c[_0xb785('0x46')]=_[_0xb785('0x4a')](db[_0xb785('0xb7')][_0xb785('0x42')]);_0x4fd72c[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x237931[_0xb785('0x49')]);_0x4fd72c[_0xb785('0x53')]=_['intersection'](_0x4fd72c[_0xb785('0x46')],_0x4fd72c[_0xb785('0x49')]);_0x43cf6e[_0xb785('0x4c')]=_['intersection'](_0x4fd72c['model'],qs[_0xb785('0x4d')](_0x237931[_0xb785('0x49')][_0xb785('0x4d')]));_0x43cf6e['attributes']=_0x43cf6e[_0xb785('0x4c')][_0xb785('0x4e')]?_0x43cf6e[_0xb785('0x4c')]:_0x4fd72c[_0xb785('0x46')];_0x43cf6e[_0xb785('0x50')]=qs['sort'](_0x237931[_0xb785('0x49')]['sort']);_0x43cf6e[_0xb785('0x52')]=qs['filters'](_[_0xb785('0x54')](_0x237931[_0xb785('0x49')],_0x4fd72c[_0xb785('0x53')]));if(_0x237931['query'][_0xb785('0x55')]){_0x43cf6e[_0xb785('0x52')]=_[_0xb785('0x56')](_0x43cf6e[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x43cf6e['attributes'],function(_0x1b0e57){var _0x5ae6f1={};_0x5ae6f1[_0x1b0e57]={'$like':'%'+_0x237931[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x5ae6f1;})});}_0x43cf6e=_[_0xb785('0x56')]({},_0x43cf6e,_0x237931[_0xb785('0x63')]);return _0x4fbe34['getVoiceQueuesRt'](_0x43cf6e);}})['then'](function(_0x481f3b){if(_0x481f3b){_0x49c5a9=_0x481f3b['length'];if(!_0x237931['query'][_0xb785('0x4f')](_0xb785('0xc8'))){_0x43cf6e[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x237931[_0xb785('0x49')]['limit']);_0x43cf6e[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x237931[_0xb785('0x49')]['offset']);}return _0x4fbe34[_0xb785('0xcc')](_0x43cf6e);}})[_0xb785('0x1d')](function(_0x15e46c){if(_0x15e46c){return _0x15e46c?{'count':_0x49c5a9,'rows':_0x15e46c}:null;}})[_0xb785('0x1d')](respondWithResult(_0x18d629,null))[_0xb785('0x27')](handleError(_0x18d629,null));};exports[_0xb785('0xcd')]=function(_0xa74b91,_0x120b01,_0x2d4691){var _0x50c18e={};var _0x35e28a={};var _0x2edf7e;var _0xa53bd7;return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0xa74b91[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x120b01,null))[_0xb785('0x1d')](function(_0x436ece){if(_0x436ece){_0x2edf7e=_0x436ece;_0x35e28a[_0xb785('0x46')]=_[_0xb785('0x4a')](db['ChatGroup'][_0xb785('0x42')]);_0x35e28a[_0xb785('0x49')]=_[_0xb785('0x4a')](_0xa74b91[_0xb785('0x49')]);_0x35e28a[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x35e28a[_0xb785('0x46')],_0x35e28a['query']);_0x50c18e[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x35e28a[_0xb785('0x46')],qs[_0xb785('0x4d')](_0xa74b91[_0xb785('0x49')][_0xb785('0x4d')]));_0x50c18e[_0xb785('0x4c')]=_0x50c18e['attributes'][_0xb785('0x4e')]?_0x50c18e[_0xb785('0x4c')]:_0x35e28a[_0xb785('0x46')];_0x50c18e[_0xb785('0x50')]=qs[_0xb785('0x51')](_0xa74b91[_0xb785('0x49')][_0xb785('0x51')]);_0x50c18e[_0xb785('0x52')]=qs['filters'](_['pick'](_0xa74b91[_0xb785('0x49')],_0x35e28a[_0xb785('0x53')]));if(_0xa74b91['query'][_0xb785('0x55')]){_0x50c18e['where']=_[_0xb785('0x56')](_0x50c18e['where'],{'$or':_[_0xb785('0x39')](_0x50c18e[_0xb785('0x4c')],function(_0x48dadc){var _0x45df31={};_0x45df31[_0x48dadc]={'$like':'%'+_0xa74b91[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x45df31;})});}_0x50c18e=_[_0xb785('0x56')]({},_0x50c18e,_0xa74b91[_0xb785('0x63')]);return _0x2edf7e[_0xb785('0xcd')](_0x50c18e);}})[_0xb785('0x1d')](function(_0x49866e){if(_0x49866e){_0xa53bd7=_0x49866e[_0xb785('0x4e')];if(!_0xa74b91[_0xb785('0x49')]['hasOwnProperty'](_0xb785('0xc8'))){_0x50c18e['limit']=qs[_0xb785('0x2a')](_0xa74b91[_0xb785('0x49')][_0xb785('0x2a')]);_0x50c18e[_0xb785('0x29')]=qs['offset'](_0xa74b91[_0xb785('0x49')][_0xb785('0x29')]);}return _0x2edf7e[_0xb785('0xcd')](_0x50c18e);}})[_0xb785('0x1d')](function(_0x289e40){if(_0x289e40){return _0x289e40?{'count':_0xa53bd7,'rows':_0x289e40}:null;}})[_0xb785('0x1d')](respondWithResult(_0x120b01,null))[_0xb785('0x27')](handleError(_0x120b01,null));};exports[_0xb785('0xce')]=function(_0x243d6b,_0x5e0be0,_0x59ecdd){var _0x24adb3={'raw':!![],'where':{}};var _0x7f8d8={};var _0x5ae3f9={'count':0x0,'rows':[]};return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x243d6b[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x5e0be0,null))[_0xb785('0x1d')](function(_0x73f07c){if(_0x73f07c){_0x7f8d8[_0xb785('0x46')]=_['keys'](db[_0xb785('0xcf')][_0xb785('0x42')]);_0x7f8d8[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x243d6b['query']);_0x7f8d8[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x7f8d8[_0xb785('0x46')],_0x7f8d8[_0xb785('0x49')]);_0x24adb3['attributes']=_[_0xb785('0x4b')](_0x7f8d8[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x243d6b[_0xb785('0x49')][_0xb785('0x4d')]));_0x24adb3['attributes']=_0x24adb3['attributes']['length']?_0x24adb3['attributes']:_0x7f8d8[_0xb785('0x46')];if(!_0x243d6b[_0xb785('0x49')][_0xb785('0x4f')]('nolimit')){_0x24adb3[_0xb785('0x2a')]=qs['limit'](_0x243d6b[_0xb785('0x49')][_0xb785('0x2a')]);_0x24adb3[_0xb785('0x29')]=qs['offset'](_0x243d6b[_0xb785('0x49')][_0xb785('0x29')]);}_0x24adb3['order']=qs[_0xb785('0x51')](_0x243d6b['query'][_0xb785('0x51')]);_0x24adb3[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x243d6b['query'],_0x7f8d8['filters']));_0x24adb3[_0xb785('0x52')][_0xb785('0xd0')]=_0x73f07c['id'];if(_0x243d6b[_0xb785('0x49')]['filter']){_0x24adb3[_0xb785('0x52')]=_[_0xb785('0x56')](_0x24adb3[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x24adb3['attributes'],function(_0x14b329){var _0x5cb96c={};_0x5cb96c[_0x14b329]={'$like':'%'+_0x243d6b['query'][_0xb785('0x55')]+'%'};return _0x5cb96c;})});}_0x24adb3=_['merge']({},_0x24adb3,_0x243d6b[_0xb785('0x63')]);return db['VoiceRecording'][_0xb785('0x28')]({'where':_0x24adb3[_0xb785('0x52')]})[_0xb785('0x1d')](function(_0x2fcada){_0x5ae3f9['count']=_0x2fcada;if(_0x243d6b[_0xb785('0x49')][_0xb785('0x5b')]){_0x24adb3[_0xb785('0x5c')]=[{'all':!![]}];}return db[_0xb785('0xcf')][_0xb785('0x5d')](_0x24adb3);})[_0xb785('0x1d')](function(_0x39db34){_0x5ae3f9[_0xb785('0x5e')]=_0x39db34;return _0x5ae3f9;});}})[_0xb785('0x1d')](respondWithFilteredResult(_0x5e0be0,_0x24adb3))['catch'](handleError(_0x5e0be0,null));};exports[_0xb785('0xd1')]=function(_0x243c0a,_0x3fcc69,_0x2dd880){var _0x4008b7={'raw':!![],'where':{}};var _0x532336={};var _0x50fc7b={'count':0x0,'rows':[]};return db['User'][_0xb785('0x9b')]({'where':{'id':_0x243c0a[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x3fcc69,null))[_0xb785('0x1d')](function(_0x3cd69e){if(_0x3cd69e){_0x532336['model']=_[_0xb785('0x4a')](db['ScreenRecording'][_0xb785('0x42')]);_0x532336[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x243c0a[_0xb785('0x49')]);_0x532336[_0xb785('0x53')]=_['intersection'](_0x532336['model'],_0x532336['query']);_0x4008b7['attributes']=_[_0xb785('0x4b')](_0x532336['model'],qs[_0xb785('0x4d')](_0x243c0a[_0xb785('0x49')][_0xb785('0x4d')]));_0x4008b7['attributes']=_0x4008b7[_0xb785('0x4c')][_0xb785('0x4e')]?_0x4008b7['attributes']:_0x532336[_0xb785('0x46')];if(!_0x243c0a['query'][_0xb785('0x4f')](_0xb785('0xc8'))){_0x4008b7[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x243c0a['query'][_0xb785('0x2a')]);_0x4008b7['offset']=qs[_0xb785('0x29')](_0x243c0a[_0xb785('0x49')][_0xb785('0x29')]);}_0x4008b7[_0xb785('0x50')]=qs[_0xb785('0x51')](_0x243c0a['query'][_0xb785('0x51')]);_0x4008b7['where']=qs[_0xb785('0x53')](_['pick'](_0x243c0a['query'],_0x532336['filters']));_0x4008b7['where'][_0xb785('0xd0')]=_0x3cd69e['id'];if(_0x243c0a[_0xb785('0x49')][_0xb785('0x55')]){_0x4008b7['where']=_[_0xb785('0x56')](_0x4008b7[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x4008b7[_0xb785('0x4c')],function(_0x1ba7de){var _0x2e4b57={};_0x2e4b57[_0x1ba7de]={'$like':'%'+_0x243c0a['query'][_0xb785('0x55')]+'%'};return _0x2e4b57;})});}_0x4008b7=_[_0xb785('0x56')]({},_0x4008b7,_0x243c0a[_0xb785('0x63')]);return db[_0xb785('0xd2')][_0xb785('0x28')]({'where':_0x4008b7['where']})[_0xb785('0x1d')](function(_0x460a17){_0x50fc7b[_0xb785('0x28')]=_0x460a17;if(_0x243c0a['query'][_0xb785('0x5b')]){_0x4008b7[_0xb785('0x5c')]=[{'all':!![]}];}return db[_0xb785('0xd2')][_0xb785('0x5d')](_0x4008b7);})[_0xb785('0x1d')](function(_0x2895b7){_0x50fc7b['rows']=_0x2895b7;return _0x50fc7b;});}})[_0xb785('0x1d')](respondWithFilteredResult(_0x3fcc69,_0x4008b7))[_0xb785('0x27')](handleError(_0x3fcc69,null));};exports[_0xb785('0xd3')]=function(_0x43b171,_0x2c814e,_0x3fd96c){var _0x220255={};var _0xc25217={};var _0x4c4c0d;var _0x2faae6;return db[_0xb785('0x41')]['findOne']({'where':{'id':_0x43b171[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x2c814e,null))['then'](function(_0xbafee1){if(_0xbafee1){_0x4c4c0d=_0xbafee1;_0xc25217['model']=_['keys'](db['ChatInteraction'][_0xb785('0x42')]);_0xc25217['query']=_['keys'](_0x43b171[_0xb785('0x49')]);_0xc25217[_0xb785('0x53')]=_['intersection'](_0xc25217[_0xb785('0x46')],_0xc25217[_0xb785('0x49')]);_0x220255[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0xc25217['model'],qs[_0xb785('0x4d')](_0x43b171[_0xb785('0x49')][_0xb785('0x4d')]));_0x220255[_0xb785('0x4c')]=_0x220255[_0xb785('0x4c')]['length']?_0x220255[_0xb785('0x4c')]:_0xc25217[_0xb785('0x46')];_0x220255['order']=qs[_0xb785('0x51')](_0x43b171[_0xb785('0x49')][_0xb785('0x51')]);_0x220255[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x43b171[_0xb785('0x49')],_0xc25217[_0xb785('0x53')]));if(_0x43b171[_0xb785('0x49')][_0xb785('0x55')]){_0x220255[_0xb785('0x52')]=_[_0xb785('0x56')](_0x220255[_0xb785('0x52')],{'$or':_['map'](_0x220255[_0xb785('0x4c')],function(_0xb24567){var _0x29a8a3={};_0x29a8a3[_0xb24567]={'$like':'%'+_0x43b171['query'][_0xb785('0x55')]+'%'};return _0x29a8a3;})});}_0x220255=_[_0xb785('0x56')]({},_0x220255,_0x43b171[_0xb785('0x63')]);return _0x4c4c0d[_0xb785('0xd3')](_0x220255);}})[_0xb785('0x1d')](function(_0x303491){if(_0x303491){_0x2faae6=_0x303491[_0xb785('0x4e')];if(!_0x43b171[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x220255[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x43b171['query']['limit']);_0x220255[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x43b171[_0xb785('0x49')]['offset']);}return _0x4c4c0d[_0xb785('0xd3')](_0x220255);}})[_0xb785('0x1d')](function(_0x7f328c){if(_0x7f328c){return _0x7f328c?{'count':_0x2faae6,'rows':_0x7f328c}:null;}})[_0xb785('0x1d')](respondWithResult(_0x2c814e,null))[_0xb785('0x27')](handleError(_0x2c814e,null));};exports['getOpenchannelInteractions']=function(_0x22e145,_0x1a021b,_0x2e335a){var _0x2ff01a={};var _0x2edc1d={};var _0x535eff;var _0x4702f2;return db['User'][_0xb785('0x9b')]({'where':{'id':_0x22e145[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x1a021b,null))[_0xb785('0x1d')](function(_0xfa784c){if(_0xfa784c){_0x535eff=_0xfa784c;_0x2edc1d['model']=_[_0xb785('0x4a')](db[_0xb785('0xd4')][_0xb785('0x42')]);_0x2edc1d['query']=_[_0xb785('0x4a')](_0x22e145[_0xb785('0x49')]);_0x2edc1d[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x2edc1d[_0xb785('0x46')],_0x2edc1d[_0xb785('0x49')]);_0x2ff01a[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x2edc1d[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x22e145[_0xb785('0x49')]['fields']));_0x2ff01a[_0xb785('0x4c')]=_0x2ff01a['attributes']['length']?_0x2ff01a[_0xb785('0x4c')]:_0x2edc1d['model'];_0x2ff01a[_0xb785('0x50')]=qs[_0xb785('0x51')](_0x22e145[_0xb785('0x49')][_0xb785('0x51')]);_0x2ff01a[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x22e145[_0xb785('0x49')],_0x2edc1d[_0xb785('0x53')]));if(_0x22e145[_0xb785('0x49')][_0xb785('0x55')]){_0x2ff01a[_0xb785('0x52')]=_[_0xb785('0x56')](_0x2ff01a[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x2ff01a[_0xb785('0x4c')],function(_0x73e0c8){var _0x145ead={};_0x145ead[_0x73e0c8]={'$like':'%'+_0x22e145[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x145ead;})});}_0x2ff01a=_['merge']({},_0x2ff01a,_0x22e145['options']);return _0x535eff[_0xb785('0xd5')](_0x2ff01a);}})['then'](function(_0x4bf348){if(_0x4bf348){_0x4702f2=_0x4bf348['length'];if(!_0x22e145['query']['hasOwnProperty'](_0xb785('0xc8'))){_0x2ff01a[_0xb785('0x2a')]=qs['limit'](_0x22e145[_0xb785('0x49')][_0xb785('0x2a')]);_0x2ff01a['offset']=qs['offset'](_0x22e145['query'][_0xb785('0x29')]);}return _0x535eff[_0xb785('0xd5')](_0x2ff01a);}})[_0xb785('0x1d')](function(_0x25ca3b){if(_0x25ca3b){return _0x25ca3b?{'count':_0x4702f2,'rows':_0x25ca3b}:null;}})[_0xb785('0x1d')](respondWithResult(_0x1a021b,null))[_0xb785('0x27')](handleError(_0x1a021b,null));};exports['getMailInteractions']=function(_0x2593d1,_0x5bcc8a,_0x3c1938){var _0x582710={'raw':!![],'where':{}};var _0x5115ef={};var _0x44dfb5={'count':0x0,'rows':[]};return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x2593d1['params']['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x5bcc8a,null))[_0xb785('0x1d')](function(_0x5a5515){if(_0x5a5515){_0x5115ef[_0xb785('0x46')]=_[_0xb785('0x4a')](db['MailInteraction'][_0xb785('0x42')]);_0x5115ef['query']=_[_0xb785('0x4a')](_0x2593d1[_0xb785('0x49')]);_0x5115ef[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x5115ef[_0xb785('0x46')],_0x5115ef[_0xb785('0x49')]);_0x582710[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x5115ef[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x2593d1[_0xb785('0x49')][_0xb785('0x4d')]));_0x582710[_0xb785('0x4c')]=_0x582710[_0xb785('0x4c')][_0xb785('0x4e')]?_0x582710[_0xb785('0x4c')]:_0x5115ef[_0xb785('0x46')];if(!_0x2593d1[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x582710['limit']=qs[_0xb785('0x2a')](_0x2593d1[_0xb785('0x49')][_0xb785('0x2a')]);_0x582710[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x2593d1[_0xb785('0x49')][_0xb785('0x29')]);}_0x582710[_0xb785('0x50')]=qs['sort'](_0x2593d1[_0xb785('0x49')][_0xb785('0x51')]);_0x582710[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x2593d1['query'],_0x5115ef[_0xb785('0x53')]));_0x582710['where'][_0xb785('0xd0')]=_0x5a5515['id'];if(_0x2593d1[_0xb785('0x49')][_0xb785('0x55')]){_0x582710[_0xb785('0x52')]=_['merge'](_0x582710[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x582710[_0xb785('0x4c')],function(_0x412f97){var _0x39120a={};_0x39120a[_0x412f97]={'$like':'%'+_0x2593d1[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x39120a;})});}_0x582710=_['merge']({},_0x582710,_0x2593d1[_0xb785('0x63')]);return db[_0xb785('0xd6')]['count']({'where':_0x582710[_0xb785('0x52')]})[_0xb785('0x1d')](function(_0x505552){_0x44dfb5[_0xb785('0x28')]=_0x505552;if(_0x2593d1[_0xb785('0x49')][_0xb785('0x5b')]){_0x582710[_0xb785('0x5c')]=[{'all':!![]}];}return db[_0xb785('0xd6')][_0xb785('0x5d')](_0x582710);})[_0xb785('0x1d')](function(_0x481642){_0x44dfb5[_0xb785('0x5e')]=_0x481642;return _0x44dfb5;});}})['then'](respondWithFilteredResult(_0x5bcc8a,_0x582710))['catch'](handleError(_0x5bcc8a,null));};exports[_0xb785('0xd7')]=function(_0x49d2b3,_0x380b34,_0x112364){var _0x311dfe={};var _0x408c5e={};var _0x2b83d7;var _0x373a64;return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x49d2b3[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x380b34,null))[_0xb785('0x1d')](function(_0x5c30d1){if(_0x5c30d1){_0x2b83d7=_0x5c30d1;_0x408c5e[_0xb785('0x46')]=_['keys'](db[_0xb785('0xd8')]['rawAttributes']);_0x408c5e[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x49d2b3['query']);_0x408c5e[_0xb785('0x53')]=_['intersection'](_0x408c5e[_0xb785('0x46')],_0x408c5e['query']);_0x311dfe[_0xb785('0x4c')]=_['intersection'](_0x408c5e['model'],qs[_0xb785('0x4d')](_0x49d2b3['query'][_0xb785('0x4d')]));_0x311dfe[_0xb785('0x4c')]=_0x311dfe['attributes'][_0xb785('0x4e')]?_0x311dfe[_0xb785('0x4c')]:_0x408c5e['model'];_0x311dfe['order']=qs[_0xb785('0x51')](_0x49d2b3[_0xb785('0x49')]['sort']);_0x311dfe['where']=qs['filters'](_[_0xb785('0x54')](_0x49d2b3[_0xb785('0x49')],_0x408c5e[_0xb785('0x53')]));if(_0x49d2b3[_0xb785('0x49')][_0xb785('0x55')]){_0x311dfe[_0xb785('0x52')]=_[_0xb785('0x56')](_0x311dfe[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x311dfe['attributes'],function(_0xc564a5){var _0x10c834={};_0x10c834[_0xc564a5]={'$like':'%'+_0x49d2b3[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x10c834;})});}_0x311dfe=_[_0xb785('0x56')]({},_0x311dfe,_0x49d2b3[_0xb785('0x63')]);return _0x2b83d7[_0xb785('0xd7')](_0x311dfe);}})['then'](function(_0x365ca3){if(_0x365ca3){_0x373a64=_0x365ca3[_0xb785('0x4e')];if(!_0x49d2b3[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x311dfe[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x49d2b3['query'][_0xb785('0x2a')]);_0x311dfe[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x49d2b3[_0xb785('0x49')][_0xb785('0x29')]);}return _0x2b83d7[_0xb785('0xd7')](_0x311dfe);}})[_0xb785('0x1d')](function(_0x525f0d){if(_0x525f0d){return _0x525f0d?{'count':_0x373a64,'rows':_0x525f0d}:null;}})[_0xb785('0x1d')](respondWithResult(_0x380b34,null))['catch'](handleError(_0x380b34,null));};exports['getFaxInteractions']=function(_0x227ee3,_0x162b6e,_0x3aea7e){var _0x10bdea={};var _0x18818e={};var _0x2c1827;var _0x56892e;return db['User'][_0xb785('0x9b')]({'where':{'id':_0x227ee3[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x162b6e,null))[_0xb785('0x1d')](function(_0x3a0ef5){if(_0x3a0ef5){_0x2c1827=_0x3a0ef5;_0x18818e['model']=_[_0xb785('0x4a')](db['FaxInteraction'][_0xb785('0x42')]);_0x18818e['query']=_['keys'](_0x227ee3[_0xb785('0x49')]);_0x18818e[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x18818e['model'],_0x18818e['query']);_0x10bdea[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x18818e[_0xb785('0x46')],qs['fields'](_0x227ee3[_0xb785('0x49')][_0xb785('0x4d')]));_0x10bdea[_0xb785('0x4c')]=_0x10bdea[_0xb785('0x4c')]['length']?_0x10bdea['attributes']:_0x18818e[_0xb785('0x46')];_0x10bdea[_0xb785('0x50')]=qs[_0xb785('0x51')](_0x227ee3[_0xb785('0x49')][_0xb785('0x51')]);_0x10bdea[_0xb785('0x52')]=qs['filters'](_[_0xb785('0x54')](_0x227ee3[_0xb785('0x49')],_0x18818e[_0xb785('0x53')]));if(_0x227ee3['query']['filter']){_0x10bdea[_0xb785('0x52')]=_[_0xb785('0x56')](_0x10bdea['where'],{'$or':_['map'](_0x10bdea[_0xb785('0x4c')],function(_0x372469){var _0x358b51={};_0x358b51[_0x372469]={'$like':'%'+_0x227ee3[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x358b51;})});}_0x10bdea=_[_0xb785('0x56')]({},_0x10bdea,_0x227ee3[_0xb785('0x63')]);return _0x2c1827[_0xb785('0xd9')](_0x10bdea);}})[_0xb785('0x1d')](function(_0xf58aa9){if(_0xf58aa9){_0x56892e=_0xf58aa9[_0xb785('0x4e')];if(!_0x227ee3[_0xb785('0x49')]['hasOwnProperty'](_0xb785('0xc8'))){_0x10bdea['limit']=qs[_0xb785('0x2a')](_0x227ee3[_0xb785('0x49')][_0xb785('0x2a')]);_0x10bdea[_0xb785('0x29')]=qs['offset'](_0x227ee3[_0xb785('0x49')][_0xb785('0x29')]);}return _0x2c1827[_0xb785('0xd9')](_0x10bdea);}})[_0xb785('0x1d')](function(_0x165ecc){if(_0x165ecc){return _0x165ecc?{'count':_0x56892e,'rows':_0x165ecc}:null;}})[_0xb785('0x1d')](respondWithResult(_0x162b6e,null))[_0xb785('0x27')](handleError(_0x162b6e,null));};exports[_0xb785('0xda')]=function(_0x4f0c0e,_0x129c56,_0x4a0e84){var _0x2a7e0c={};var _0x3448d7={};var _0x5f203f;var _0x8a4b9f;return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x4f0c0e['params']['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x129c56,null))[_0xb785('0x1d')](function(_0x515f47){if(_0x515f47){_0x5f203f=_0x515f47;_0x3448d7[_0xb785('0x46')]=_[_0xb785('0x4a')](db[_0xb785('0xdb')]['rawAttributes']);_0x3448d7['query']=_['keys'](_0x4f0c0e[_0xb785('0x49')]);_0x3448d7['filters']=_[_0xb785('0x4b')](_0x3448d7[_0xb785('0x46')],_0x3448d7[_0xb785('0x49')]);_0x2a7e0c[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x3448d7[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x4f0c0e['query'][_0xb785('0x4d')]));_0x2a7e0c[_0xb785('0x4c')]=_0x2a7e0c['attributes'][_0xb785('0x4e')]?_0x2a7e0c[_0xb785('0x4c')]:_0x3448d7[_0xb785('0x46')];_0x2a7e0c[_0xb785('0x50')]=qs[_0xb785('0x51')](_0x4f0c0e[_0xb785('0x49')][_0xb785('0x51')]);_0x2a7e0c[_0xb785('0x52')]=qs[_0xb785('0x53')](_['pick'](_0x4f0c0e['query'],_0x3448d7[_0xb785('0x53')]));if(_0x4f0c0e[_0xb785('0x49')][_0xb785('0x55')]){_0x2a7e0c[_0xb785('0x52')]=_[_0xb785('0x56')](_0x2a7e0c[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x2a7e0c[_0xb785('0x4c')],function(_0x4d6162){var _0x4abf2b={};_0x4abf2b[_0x4d6162]={'$like':'%'+_0x4f0c0e[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x4abf2b;})});}_0x2a7e0c=_[_0xb785('0x56')]({},_0x2a7e0c,_0x4f0c0e[_0xb785('0x63')]);return _0x5f203f[_0xb785('0xda')](_0x2a7e0c);}})['then'](function(_0x48e685){if(_0x48e685){_0x8a4b9f=_0x48e685[_0xb785('0x4e')];if(!_0x4f0c0e[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x2a7e0c[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x4f0c0e[_0xb785('0x49')][_0xb785('0x2a')]);_0x2a7e0c[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x4f0c0e['query'][_0xb785('0x29')]);}return _0x5f203f['getWhatsappInteractions'](_0x2a7e0c);}})[_0xb785('0x1d')](function(_0x27da82){if(_0x27da82){return _0x27da82?{'count':_0x8a4b9f,'rows':_0x27da82}:null;}})[_0xb785('0x1d')](respondWithResult(_0x129c56,null))[_0xb785('0x27')](handleError(_0x129c56,null));};exports['login']=function(_0x396d22,_0x42b7e3,_0x356fcd){var _0x361c97;var _0x2bf0b5;var _0xc60b15;var _0x1e0931=!_[_0xb785('0x6c')](_0x396d22[_0xb785('0x60')]['id'])?_0x396d22[_0xb785('0x60')]['id']:!_[_0xb785('0x6c')](_0x396d22['user']['id'])?_0x396d22[_0xb785('0x7e')]['id']:null;return db['User'][_0xb785('0x3c')]({'where':{'id':_0x1e0931,'role':{'$or':[_0xb785('0x33'),'user','agent']}},'attributes':['id','name',_0xb785('0xdc'),_0xb785('0xdd'),_0xb785('0x3d'),_0xb785('0x6b'),_0xb785('0xa4')]})[_0xb785('0x1d')](function(_0x54eb65){if(_0x54eb65){if(_0x54eb65[_0xb785('0x3d')]==='agent'){_0x361c97=_0x54eb65;if(_0x396d22[_0xb785('0x64')][_0xb785('0xa6')]){_0xc60b15=util['format'](_0xb785('0xde'),_0x361c97[_0x396d22[_0xb785('0x64')][_0xb785('0xa6')]]);}else if(_0x396d22[_0xb785('0x64')][_0xb785('0xdf')]){_0xc60b15=util[_0xb785('0xb2')](_0xb785('0xe0'),_0x396d22[_0xb785('0x64')][_0xb785('0xdf')]);}else{_0xc60b15=util[_0xb785('0xb2')]('SIP/%s',_0x361c97[_0xb785('0x3f')]);}socket['to'](util['format'](_0xb785('0xe1'),_0x361c97[_0xb785('0x3f')]))[_0xb785('0xae')](_0xb785('0xe2'),{'ip':_0x396d22['headers'][_0xb785('0xe3')]||_0x396d22['connection']['remoteAddress']||_0x396d22[_0xb785('0xe4')][_0xb785('0xe5')]||_0x396d22[_0xb785('0xe6')][_0xb785('0xe4')]['remoteAddress']});return db['UserVoiceQueueRt'][_0xb785('0x31')]({'where':{'membername':_0x361c97[_0xb785('0x3f')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError'](_0xb785('0xe7'));}})[_0xb785('0x1d')](function(){if(_0x361c97){return _0x361c97[_0xb785('0xe8')]({'raw':!![]});}})[_0xb785('0x1d')](function(_0x534ebe){if(_0x361c97){var _0xb37e58=[];if(_0x534ebe){_0x2bf0b5=_0x534ebe;if(_0x2bf0b5[_0xb785('0x4e')]){for(var _0x5cc2c3=0x0;_0x5cc2c3<_0x2bf0b5[_0xb785('0x4e')];_0x5cc2c3++){_0xb37e58['push']({'membername':_0x361c97[_0xb785('0x3f')],'UserId':_0x361c97['id'],'queue_name':_0x2bf0b5[_0x5cc2c3][_0xb785('0x3f')],'VoiceQueueId':_0x2bf0b5[_0x5cc2c3]['id'],'interface':_0xc60b15,'paused':_0x361c97['loginInPause']||![],'penalty':_0x2bf0b5[_0x5cc2c3]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xb785('0x8d')](_0xb37e58,function(_0x137ea0){return db['UserVoiceQueueRt']['upsert'](_0x137ea0);});}}}})[_0xb785('0x1d')](function(){if(_0x361c97){return db[_0xb785('0xe9')]['findAll']({'where':{'membername':_0x361c97['name'],'exitAt':null}});}})['then'](function(_0x1b0823){if(_0x361c97){var _0x36dd58=[];_0x1b0823[_0xb785('0xea')](function(_0x1da591){_0x36dd58[_0xb785('0x8c')](_0x1da591['update']({'exitAt':moment()['format'](_0xb785('0xeb'))}));});return BPromise[_0xb785('0x8b')](_0x36dd58);}})[_0xb785('0x1d')](function(){if(_0x361c97){var _0x5d5920=[];var _0x3f8b6f=[];var _0xad8bc1=utils[_0xb785('0xec')]();var _0x317e30={'membername':_0x361c97[_0xb785('0x3f')],'interface':_0xc60b15,'enterAt':moment()['format'](_0xb785('0xeb')),'role':_0x361c97[_0xb785('0x3d')],'internal':_0x361c97['internal']};_0xad8bc1['forEach'](function(_0x481c16){_0x5d5920[_0xb785('0x8c')](_[_0xb785('0x56')]({'channel':_0x481c16,'type':_0xb785('0xed'),'data1':_0x396d22[_0xb785('0x64')][_0xb785('0xee')],'data2':_0xc60b15},_0x317e30));if(_0x361c97[_0xb785('0xa4')]){_0x3f8b6f[_0xb785('0x8c')](_['merge']({'channel':_0x481c16,'type':_0xb785('0xef'),'data1':_0xb785('0xf0')},_0x317e30));}});return db['MemberReport']['bulkCreate'](_0x5d5920['concat'](_0x3f8b6f),{'individualHooks':!![]});}})['then'](function(){if(_0x361c97){return _0x361c97[_0xb785('0xf1')]({'online':!![],'lastLoginAt':moment()[_0xb785('0xb2')](_0xb785('0xeb')),'voicePause':_0x361c97[_0xb785('0xa4')]||![],'mailPause':_0x361c97[_0xb785('0xa4')]||![],'chatPause':_0x361c97[_0xb785('0xa4')]||![],'faxPause':_0x361c97['loginInPause']||![],'smsPause':_0x361c97[_0xb785('0xa4')]||![],'openchannelPause':_0x361c97[_0xb785('0xa4')]||![],'whatsappPause':_0x361c97[_0xb785('0xa4')]||![],'pauseType':_0x361c97[_0xb785('0xa4')]?'LOGININPAUSE':null,'interface':_0xc60b15,'lastPauseAt':moment()[_0xb785('0xb2')](_0xb785('0xeb'))});}})['then'](function(_0x187990){if(_0x396d22[_0xb785('0xf2')]){return _0x356fcd();}else{return BPromise[_0xb785('0xf3')](_0x187990)['then'](respondWithResult(_0x42b7e3,null));}})[_0xb785('0x27')](handleError(_0x42b7e3,null));};exports[_0xb785('0xf4')]=function(_0x49e9dc,_0x2ee70e,_0x1043f9){var _0x37cba1;return db[_0xb785('0x41')]['find']({'where':{'id':_0x49e9dc[_0xb785('0x60')]['id'],'role':_0xb785('0x36')},'attributes':['id','name',_0xb785('0x3d')]})[_0xb785('0x1d')](handleEntityNotFound(_0x2ee70e,null))['then'](function(_0x559983){if(_0x559983){_0x37cba1=_0x559983;return db[_0xb785('0xb7')][_0xb785('0x31')]({'where':{'membername':_0x37cba1[_0xb785('0x3f')]},'individualHooks':!![]});}})['then'](function(){return db[_0xb785('0xe9')]['findAll']({'where':{'membername':_0x37cba1[_0xb785('0x3f')],'exitAt':null}});})[_0xb785('0x1d')](function(_0x289efb){var _0x707383=[];_0x289efb[_0xb785('0xea')](function(_0x2afa5f){_0x707383['push'](_0x2afa5f[_0xb785('0xf1')]({'exitAt':moment()[_0xb785('0xb2')](_0xb785('0xeb'))}));});return BPromise['all'](_0x707383);})[_0xb785('0x1d')](function(){return _0x37cba1[_0xb785('0xf1')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x2ee70e,null))['catch'](handleError(_0x2ee70e,null));};exports['pause']=function(_0x20e4b9,_0x2e8525,_0x4862f1){var _0x4ea87b;return db[_0xb785('0xb7')][_0xb785('0xf1')]({'paused':0x1},{'where':{'UserId':_0x20e4b9[_0xb785('0x60')]['id']},'individualHooks':!![]})[_0xb785('0x1d')](function(){return db['User']['find']({'where':{'id':_0x20e4b9[_0xb785('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0xb785('0x3d'),_0xb785('0x6b'),_0xb785('0xa6')]});})[_0xb785('0x1d')](handleEntityNotFound(_0x2e8525,null))[_0xb785('0x1d')](function(_0x18a75d){if(_0x18a75d){_0x4ea87b=_0x18a75d;return respondWithRpcPromise(_0xb785('0xf5'),_0xb785('0xf6'),{'id':_0x4ea87b['id'],'name':_0x4ea87b[_0xb785('0x3f')],'pause':!![]});}})[_0xb785('0x1d')](function(){if(_0x4ea87b){return db[_0xb785('0xe9')]['findAll']({'where':{'membername':_0x4ea87b[_0xb785('0x3f')],'type':_0xb785('0xef'),'exitAt':null}});}})[_0xb785('0x1d')](function(_0x3beb86){if(_0x3beb86[_0xb785('0x4e')]){var _0x1e7f96=moment()[_0xb785('0xb2')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x13aac3=0x0,_0x3832e1=_0x3beb86[_0xb785('0x4e')];_0x13aac3<_0x3832e1;_0x13aac3++){_0x3beb86[_0x13aac3][_0xb785('0xf7')]({'exitAt':_0x1e7f96});}}})[_0xb785('0x1d')](function(){var _0x31924d=[];var _0x2448ab=utils[_0xb785('0xec')]();_0x2448ab[_0xb785('0xea')](function(_0x39c04b){_0x31924d['push']({'channel':_0x39c04b,'membername':_0x4ea87b[_0xb785('0x3f')],'interface':_[_0xb785('0x6c')](_0x4ea87b[_0xb785('0xa6')])?util[_0xb785('0xb2')](_0xb785('0xe0'),_0x4ea87b['name']):_0x4ea87b['interface'],'type':_0xb785('0xef'),'enterAt':moment()['format'](_0xb785('0xeb')),'data1':_0x20e4b9[_0xb785('0x64')]['type']||_0xb785('0xf8'),'role':_0x4ea87b[_0xb785('0x3d')],'internal':_0x4ea87b[_0xb785('0x6b')]});});return db[_0xb785('0xe9')][_0xb785('0x88')](_0x31924d,{'individualHooks':!![]});})[_0xb785('0x1d')](function(){return _0x4ea87b[_0xb785('0xf1')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x20e4b9[_0xb785('0x64')]['type']||_0xb785('0xf8'),'lastPauseAt':moment()['format'](_0xb785('0xeb'))});})[_0xb785('0x1d')](respondWithResult(_0x2e8525,null))['catch'](handleError(_0x2e8525,null));};exports[_0xb785('0xf9')]=function(_0x427082,_0x342bb2,_0x38fd9d){var _0x2f76b8;return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0x427082[_0xb785('0x60')]['id']},'attributes':['id','name',_0xb785('0x3d'),'voicePause',_0xb785('0xfa'),'chatPause',_0xb785('0xfb'),_0xb785('0xfc'),_0xb785('0xfd'),_0xb785('0xfe'),'pauseType',_0xb785('0xff')]})[_0xb785('0x1d')](handleEntityNotFound(_0x342bb2,null))[_0xb785('0x1d')](function(_0x4e171f){if(_0x4e171f){_0x2f76b8=_0x4e171f;if(_0x427082['body']['channel']&&!utils[_0xb785('0x100')](_0x427082['body']['channel'])){throw new db[(_0xb785('0x94'))][(_0xb785('0x95'))]('Unknown\x20channel');}switch(_0x427082['body']['channel']){case _0xb785('0xb0'):return respondWithRpcPromise('QueuePause',_0xb785('0xf9'),{'id':_0x2f76b8['id'],'name':_0x2f76b8[_0xb785('0x3f')],'pause':![]})['then'](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x2f76b8['id']},'individualHooks':!![]});})[_0xb785('0x1d')](function(){return db[_0xb785('0xe9')][_0xb785('0x3c')]({'where':{'channel':_0x427082['body'][_0xb785('0xa2')],'membername':_0x2f76b8['name'],'type':_0xb785('0xef'),'exitAt':null}});})['then'](function(_0x1c92ea){if(_0x1c92ea){return _0x1c92ea[_0xb785('0xf1')]({'exitAt':moment()['format'](_0xb785('0xeb')),'data2':_0xb785('0x101')},{'individualHooks':!![]});}return null;})[_0xb785('0x1d')](function(){return _0x2f76b8[_0xb785('0xf1')]({'voicePause':![]});});case _0xb785('0x102'):case'chat':case _0xb785('0x103'):case _0xb785('0x104'):case _0xb785('0x105'):case _0xb785('0x106'):return db[_0xb785('0xe9')][_0xb785('0x3c')]({'where':{'channel':_0x427082['body'][_0xb785('0xa2')],'membername':_0x2f76b8[_0xb785('0x3f')],'type':_0xb785('0xef'),'exitAt':null}})[_0xb785('0x1d')](function(_0x109fb1){if(_0x109fb1){return _0x109fb1[_0xb785('0xf1')]({'exitAt':moment()[_0xb785('0xb2')](_0xb785('0xeb')),'data2':_0xb785('0x101')},{'individualHooks':!![]});}return null;})[_0xb785('0x1d')](function(){var _0x373651={};_['set'](_0x373651,util[_0xb785('0xb2')]('%s%s',_0x427082[_0xb785('0x64')][_0xb785('0xa2')],_0xb785('0x107')),![]);return _0x2f76b8[_0xb785('0xf1')](_0x373651);});default:return respondWithRpcPromise(_0xb785('0xf5'),_0xb785('0xf9'),{'id':_0x2f76b8['id'],'name':_0x2f76b8['name'],'pause':![]})[_0xb785('0x1d')](function(){return db[_0xb785('0xb7')]['update']({'paused':0x0},{'where':{'UserId':_0x2f76b8['id']}});})[_0xb785('0x1d')](function(){return db[_0xb785('0xe9')][_0xb785('0x5d')]({'where':{'membername':_0x2f76b8[_0xb785('0x3f')],'type':_0xb785('0xef'),'exitAt':null}});})[_0xb785('0x1d')](function(_0x218877){var _0x21f576=[];_0x218877[_0xb785('0xea')](function(_0xdb24cd){_0x21f576['push'](_0xdb24cd[_0xb785('0xf1')]({'exitAt':moment()[_0xb785('0xb2')](_0xb785('0xeb')),'data2':'manual'}));});return BPromise[_0xb785('0x8b')](_0x21f576);})[_0xb785('0x1d')](function(){return _0x2f76b8['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xb785('0x1d')](respondWithResult(_0x342bb2,null))['catch'](handleError(_0x342bb2,null));};exports['getTeams']=function(_0x560add,_0x20dd46,_0x4ea13b){var _0x34a38e={};var _0x1d255e={};var _0x23ae81;var _0x5c6570;return db['User']['findOne']({'where':{'id':_0x560add[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x20dd46,null))[_0xb785('0x1d')](function(_0x301e8a){if(_0x301e8a){_0x23ae81=_0x301e8a;_0x1d255e[_0xb785('0x46')]=_[_0xb785('0x4a')](db['Team'][_0xb785('0x42')]);_0x1d255e[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x560add[_0xb785('0x49')]);_0x1d255e[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x1d255e[_0xb785('0x46')],_0x1d255e[_0xb785('0x49')]);_0x34a38e['attributes']=_[_0xb785('0x4b')](_0x1d255e[_0xb785('0x46')],qs['fields'](_0x560add['query'][_0xb785('0x4d')]));_0x34a38e[_0xb785('0x4c')]=_0x34a38e['attributes'][_0xb785('0x4e')]?_0x34a38e['attributes']:_0x1d255e[_0xb785('0x46')];_0x34a38e[_0xb785('0x50')]=qs[_0xb785('0x51')](_0x560add[_0xb785('0x49')][_0xb785('0x51')]);_0x34a38e['where']=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x560add[_0xb785('0x49')],_0x1d255e[_0xb785('0x53')]));if(_0x560add[_0xb785('0x49')][_0xb785('0x55')]){_0x34a38e[_0xb785('0x52')]=_[_0xb785('0x56')](_0x34a38e[_0xb785('0x52')],{'$or':_['map'](_0x34a38e[_0xb785('0x4c')],function(_0x1cedf4){var _0x24500e={};_0x24500e[_0x1cedf4]={'$like':'%'+_0x560add[_0xb785('0x49')][_0xb785('0x55')]+'%'};return _0x24500e;})});}_0x34a38e=_[_0xb785('0x56')]({},_0x34a38e,_0x560add[_0xb785('0x63')]);return _0x23ae81[_0xb785('0x108')](_0x34a38e);}})[_0xb785('0x1d')](function(_0x1d454a){if(_0x1d454a){_0x5c6570=_0x1d454a[_0xb785('0x4e')];if(!_0x560add[_0xb785('0x49')][_0xb785('0x4f')](_0xb785('0xc8'))){_0x34a38e[_0xb785('0x2a')]=qs['limit'](_0x560add[_0xb785('0x49')][_0xb785('0x2a')]);_0x34a38e[_0xb785('0x29')]=qs['offset'](_0x560add[_0xb785('0x49')]['offset']);}return _0x23ae81['getTeams'](_0x34a38e);}})[_0xb785('0x1d')](function(_0x17de29){if(_0x17de29){return _0x17de29?{'count':_0x5c6570,'rows':_0x17de29}:null;}})['then'](respondWithResult(_0x20dd46,null))['catch'](handleError(_0x20dd46,null));};exports[_0xb785('0x109')]=function(_0x55dee7,_0x2c33f2){return db[_0xb785('0x41')][_0xb785('0x3c')]({'where':{'id':_0x55dee7['params']['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x2c33f2,null))[_0xb785('0x1d')](function(_0x5ef2b1){if(_0x5ef2b1){var _0x42f52e=_0x5ef2b1['get']({'plain':!![]});return _0x5ef2b1[_0xb785('0x109')](_0x55dee7[_0xb785('0x64')][_0xb785('0x67')],_['omit'](_0x55dee7[_0xb785('0x64')],[_0xb785('0x67'),'id'])||{})[_0xb785('0x1d')](function(){for(var _0x4a521b=0x0;_0x4a521b<_0x55dee7[_0xb785('0x64')][_0xb785('0x67')][_0xb785('0x4e')];_0x4a521b++){var _0x1c72dc=[];db[_0xb785('0x10a')][_0xb785('0x9b')]({'where':{'id':_0x55dee7[_0xb785('0x64')]['ids'][_0x4a521b]}})['then'](function(_0x1bd9e7){_0x1c72dc[_0xb785('0x8c')](_0x1bd9e7[_0xb785('0xe8')]()[_0xb785('0x1d')](function(_0x1629eb){for(var _0x2e7a31=0x0;_0x2e7a31<_0x1629eb[_0xb785('0x4e')];_0x2e7a31++){_0x1629eb[_0x2e7a31][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x10c'));}return _0x1629eb;}));_0x1c72dc[_0xb785('0x8c')](_0x1bd9e7['getChatQueues']()[_0xb785('0x1d')](function(_0x3397a6){for(var _0x35eebf=0x0;_0x35eebf<_0x3397a6['length'];_0x35eebf++){_0x3397a6[_0x35eebf][_0xb785('0x10b')]('channel',_0xb785('0x10d'));}return _0x3397a6;}));_0x1c72dc[_0xb785('0x8c')](_0x1bd9e7[_0xb785('0x10e')]()['then'](function(_0xcb8a32){for(var _0x43e2c5=0x0;_0x43e2c5<_0xcb8a32[_0xb785('0x4e')];_0x43e2c5++){_0xcb8a32[_0x43e2c5][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x10f'));}return _0xcb8a32;}));_0x1c72dc['push'](_0x1bd9e7[_0xb785('0x110')]()[_0xb785('0x1d')](function(_0x20dcbc){for(var _0x200505=0x0;_0x200505<_0x20dcbc[_0xb785('0x4e')];_0x200505++){_0x20dcbc[_0x200505]['setDataValue'](_0xb785('0xa2'),_0xb785('0x111'));}return _0x20dcbc;}));_0x1c72dc['push'](_0x1bd9e7['getWhatsappQueues']()[_0xb785('0x1d')](function(_0x329446){for(var _0x2af322=0x0;_0x2af322<_0x329446['length'];_0x2af322++){_0x329446[_0x2af322][_0xb785('0x10b')](_0xb785('0xa2'),'Whatsapp');}return _0x329446;}));_0x1c72dc['push'](_0x1bd9e7[_0xb785('0x112')]()[_0xb785('0x1d')](function(_0x324b59){for(var _0x429653=0x0;_0x429653<_0x324b59[_0xb785('0x4e')];_0x429653++){_0x324b59[_0x429653][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x113'));}return _0x324b59;}));_0x1c72dc[_0xb785('0x8c')](_0x1bd9e7[_0xb785('0x114')]()[_0xb785('0x1d')](function(_0x53ae1e){for(var _0x2c79fd=0x0;_0x2c79fd<_0x53ae1e['length'];_0x2c79fd++){_0x53ae1e[_0x2c79fd][_0xb785('0x10b')]('channel',_0xb785('0x115'));}return _0x53ae1e;}));return BPromise[_0xb785('0x8b')](_0x1c72dc);})['then'](function(_0x2c321f){var _0x249b9a=_[_0xb785('0x116')](_0x2c321f);_0x1c72dc=[];return db[_0xb785('0x58')]['transaction'](function(_0x4489db){for(var _0x372b7b=0x0;_0x372b7b<_0x249b9a[_0xb785('0x4e')];_0x372b7b++){_0x1c72dc['push'](_0x249b9a[_0x372b7b]['addAgent'](_0x42f52e['id']),{'transaction':_0x4489db});}return BPromise[_0xb785('0x8b')](_0x1c72dc)['then'](function(){if(_0x42f52e['online']){return BPromise['each'](_['filter'](_0x249b9a,function(_0x4e4faf){return _0x4e4faf[_0xb785('0x117')](_0xb785('0xa2'))===_0xb785('0x10c');}),function(_0x304e1c){return db[_0xb785('0xb7')][_0xb785('0x118')]({'membername':_0x42f52e[_0xb785('0x3f')],'UserId':_0x42f52e['id'],'queue_name':_0x304e1c['name'],'VoiceQueueId':_0x304e1c['id'],'interface':_[_0xb785('0x6c')](_0x42f52e[_0xb785('0xa6')])?util[_0xb785('0xb2')](_0xb785('0xe0'),_0x42f52e[_0xb785('0x3f')]):_0x42f52e[_0xb785('0xa6')],'paused':_0x42f52e[_0xb785('0xa5')]||![],'penalty':_0x42f52e[_0xb785('0xaa')]},{'transaction':_0x4489db});});}else{return;}})['then'](function(){for(var _0x1118d0=0x0;_0x1118d0<_0x249b9a[_0xb785('0x4e')];_0x1118d0++){var _0x22448c=_0x249b9a[_0x1118d0][_0xb785('0x117')](_0xb785('0xa2'));var _0x29c4c1=_0x22448c+_0xb785('0xad');socket['emit'](_0xb785('0x7e')+_0x22448c+_0xb785('0xaf'),{'UserId':_0x42f52e['id'],['queueField']:_0x249b9a[_0x1118d0]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x2c33f2,null))[_0xb785('0x27')](handleError(_0x2c33f2,null));};exports[_0xb785('0x119')]=function(_0x5dee72,_0x211f12){return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x5dee72[_0xb785('0x60')]['id']}})['then'](handleEntityNotFound(_0x211f12,null))[_0xb785('0x1d')](function(_0x20cb7b){if(_0x20cb7b){var _0x1546dd=_0x20cb7b[_0xb785('0x32')]({'plain':!![]});var _0x44d583=_0x5dee72[_0xb785('0x49')][_0xb785('0x67')];return _0x20cb7b['removeTeams'](_0x44d583)[_0xb785('0x1d')](function(){for(var _0x1eebb8=0x0;_0x1eebb8<_0x44d583[_0xb785('0x4e')];_0x1eebb8++){var _0x1ce905=[];db[_0xb785('0x10a')]['findOne']({'where':{'id':_0x44d583[_0x1eebb8]}})[_0xb785('0x1d')](function(_0x230d9e){_0x1ce905[_0xb785('0x8c')](_0x230d9e[_0xb785('0xe8')]()[_0xb785('0x1d')](function(_0x5651cd){for(var _0x24f441=0x0;_0x24f441<_0x5651cd[_0xb785('0x4e')];_0x24f441++){_0x5651cd[_0x24f441][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x10c'));}return _0x5651cd;}));_0x1ce905['push'](_0x230d9e[_0xb785('0x11a')]()[_0xb785('0x1d')](function(_0xe641b2){for(var _0x1deb7a=0x0;_0x1deb7a<_0xe641b2[_0xb785('0x4e')];_0x1deb7a++){_0xe641b2[_0x1deb7a][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x10d'));}return _0xe641b2;}));_0x1ce905[_0xb785('0x8c')](_0x230d9e[_0xb785('0x10e')]()[_0xb785('0x1d')](function(_0x30b29f){for(var _0x12fd1=0x0;_0x12fd1<_0x30b29f['length'];_0x12fd1++){_0x30b29f[_0x12fd1][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x10f'));}return _0x30b29f;}));_0x1ce905[_0xb785('0x8c')](_0x230d9e[_0xb785('0x110')]()['then'](function(_0x1c78af){for(var _0x44d15a=0x0;_0x44d15a<_0x1c78af['length'];_0x44d15a++){_0x1c78af[_0x44d15a][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x111'));}return _0x1c78af;}));_0x1ce905['push'](_0x230d9e[_0xb785('0x11b')]()[_0xb785('0x1d')](function(_0x5623c9){for(var _0x19db69=0x0;_0x19db69<_0x5623c9['length'];_0x19db69++){_0x5623c9[_0x19db69]['setDataValue']('channel','Whatsapp');}return _0x5623c9;}));_0x1ce905[_0xb785('0x8c')](_0x230d9e[_0xb785('0x112')]()[_0xb785('0x1d')](function(_0x285806){for(var _0x4c40ad=0x0;_0x4c40ad<_0x285806[_0xb785('0x4e')];_0x4c40ad++){_0x285806[_0x4c40ad][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x113'));}return _0x285806;}));_0x1ce905[_0xb785('0x8c')](_0x230d9e['getOpenchannelQueues']()[_0xb785('0x1d')](function(_0x4d48ab){for(var _0x4a06c7=0x0;_0x4a06c7<_0x4d48ab[_0xb785('0x4e')];_0x4a06c7++){_0x4d48ab[_0x4a06c7][_0xb785('0x10b')](_0xb785('0xa2'),_0xb785('0x115'));}return _0x4d48ab;}));return BPromise['all'](_0x1ce905);})['then'](function(_0x5933f1){var _0x29451d=_[_0xb785('0x116')](_0x5933f1);_0x1ce905=[];return db[_0xb785('0x58')][_0xb785('0x11c')](function(_0x2147ff){for(var _0x1a373d=0x0;_0x1a373d<_0x29451d['length'];_0x1a373d++){_0x1ce905['push'](_0x29451d[_0x1a373d][_0xb785('0x11d')](_0x1546dd['id']),{'transaction':_0x2147ff});}return BPromise[_0xb785('0x8b')](_0x1ce905)['then'](function(){if(_0x1546dd[_0xb785('0xa3')]){return BPromise['each'](_[_0xb785('0x55')](_0x29451d,function(_0x1b93e5){return _0x1b93e5[_0xb785('0x117')](_0xb785('0xa2'))===_0xb785('0x10c');}),function(_0x1c8bd7){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x1c8bd7['id'],'UserId':_0x1546dd['id']},'transaction':_0x2147ff});});}else{return;}})['then'](function(){for(var _0xcafc48=0x0;_0xcafc48<_0x29451d[_0xb785('0x4e')];_0xcafc48++){var _0x13e3fb=_0x29451d[_0xcafc48][_0xb785('0x117')](_0xb785('0xa2'));var _0x50c088=_0x13e3fb+'QueueId';socket[_0xb785('0xae')](_0xb785('0x7e')+_0x13e3fb+_0xb785('0xb6'),{'UserId':_0x1546dd['id'],['queueField']:_0x29451d[_0xcafc48]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x211f12,null))['catch'](handleError(_0x211f12,null));};exports[_0xb785('0x11e')]=function(_0x4fe934,_0x1b3d7b,_0x32b066){var _0x347e54={};var _0x1385bd={};var _0x8e0984;var _0x24aa80;return db['User']['findOne']({'where':{'id':_0x4fe934[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x1b3d7b,null))[_0xb785('0x1d')](function(_0x58fc90){if(_0x58fc90){_0x8e0984=_0x58fc90;_0x1385bd[_0xb785('0x46')]=_['keys'](db[_0xb785('0xc2')]['rawAttributes']);_0x1385bd[_0xb785('0x49')]=_['keys'](_0x4fe934[_0xb785('0x49')]);_0x1385bd[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x1385bd[_0xb785('0x46')],_0x1385bd['query']);_0x347e54[_0xb785('0x4c')]=_[_0xb785('0x4b')](_0x1385bd[_0xb785('0x46')],qs[_0xb785('0x4d')](_0x4fe934['query']['fields']));_0x347e54[_0xb785('0x4c')]=_0x347e54[_0xb785('0x4c')]['length']?_0x347e54[_0xb785('0x4c')]:_0x1385bd[_0xb785('0x46')];_0x347e54[_0xb785('0x50')]=qs['sort'](_0x4fe934[_0xb785('0x49')][_0xb785('0x51')]);_0x347e54['where']=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x4fe934[_0xb785('0x49')],_0x1385bd[_0xb785('0x53')]));if(_0x4fe934['query']['filter']){_0x347e54['where']=_[_0xb785('0x56')](_0x347e54['where'],{'$or':_[_0xb785('0x39')](_0x347e54['attributes'],function(_0x133510){var _0x5a16f9={};_0x5a16f9[_0x133510]={'$like':'%'+_0x4fe934[_0xb785('0x49')]['filter']+'%'};return _0x5a16f9;})});}_0x347e54=_['merge']({},_0x347e54,_0x4fe934[_0xb785('0x63')]);return _0x8e0984[_0xb785('0x11e')](_0x347e54);}})[_0xb785('0x1d')](function(_0x38b378){if(_0x38b378){_0x24aa80=_0x38b378[_0xb785('0x4e')];if(!_0x4fe934['query']['hasOwnProperty'](_0xb785('0xc8'))){_0x347e54[_0xb785('0x2a')]=qs[_0xb785('0x2a')](_0x4fe934[_0xb785('0x49')][_0xb785('0x2a')]);_0x347e54[_0xb785('0x29')]=qs[_0xb785('0x29')](_0x4fe934[_0xb785('0x49')][_0xb785('0x29')]);}return _0x8e0984[_0xb785('0x11e')](_0x347e54);}})['then'](function(_0x2a71e7){if(_0x2a71e7){return _0x2a71e7?{'count':_0x24aa80,'rows':_0x2a71e7}:null;}})[_0xb785('0x1d')](respondWithResult(_0x1b3d7b,null))[_0xb785('0x27')](handleError(_0x1b3d7b,null));};exports[_0xb785('0x11f')]=function(_0x3c0df2,_0x2b90f1,_0x58b3a4){var _0x36191f={};var _0x5cc168={};var _0x581cd5;var _0x104125;return db[_0xb785('0x41')][_0xb785('0x9b')]({'where':{'id':_0x3c0df2[_0xb785('0x60')]['id']}})[_0xb785('0x1d')](handleEntityNotFound(_0x2b90f1,null))[_0xb785('0x1d')](function(_0x4b66fb){if(_0x4b66fb){_0x581cd5=_0x4b66fb;_0x5cc168[_0xb785('0x46')]=_['keys'](db[_0xb785('0x41')]['rawAttributes']);_0x5cc168[_0xb785('0x49')]=_[_0xb785('0x4a')](_0x3c0df2[_0xb785('0x49')]);_0x5cc168[_0xb785('0x53')]=_[_0xb785('0x4b')](_0x5cc168[_0xb785('0x46')],_0x5cc168[_0xb785('0x49')]);_0x36191f['attributes']=_['intersection'](_0x5cc168['model'],qs[_0xb785('0x4d')](_0x3c0df2[_0xb785('0x49')][_0xb785('0x4d')]));_0x36191f['attributes']=_0x36191f[_0xb785('0x4c')][_0xb785('0x4e')]?_0x36191f[_0xb785('0x4c')]:_0x5cc168[_0xb785('0x46')];_0x36191f[_0xb785('0x50')]=qs['sort'](_0x3c0df2[_0xb785('0x49')][_0xb785('0x51')]);_0x36191f[_0xb785('0x52')]=qs[_0xb785('0x53')](_[_0xb785('0x54')](_0x3c0df2['query'],_0x5cc168[_0xb785('0x53')]));if(_0x3c0df2[_0xb785('0x49')][_0xb785('0x55')]){_0x36191f[_0xb785('0x52')]=_[_0xb785('0x56')](_0x36191f[_0xb785('0x52')],{'$or':_[_0xb785('0x39')](_0x36191f[_0xb785('0x4c')],function(_0x3cd667){var _0x546f45={};_0x546f45[_0x3cd667]={'$like':'%'+_0x3c0df2[_0xb785('0x49')]['filter']+'%'};return _0x546f45;})});}_0x36191f['model']=db[_0xb785('0x41')];_0x36191f['as']=_0xb785('0x35');_0x36191f=_['merge']({},_0x36191f,_0x3c0df2[_0xb785('0x63')]);return _0x581cd5['getVoiceQueues']({'include':[_0x36191f]});}})['then'](function(_0xd78354){if(_0xd78354){var _0x3c7f20={},_0x1544ac=[],_0x4471d2=0x0;for(var _0x589c05=0x0;_0x589c05<_0xd78354[_0xb785('0x4e')];_0x589c05+=0x1){for(var _0xc64505=0x0,_0x2793b1;_0xc64505<_0xd78354[_0x589c05][_0xb785('0x35')]['length'];_0xc64505+=0x1){_0x2793b1=_0xd78354[_0x589c05]['Agents'][_0xc64505]['get']({'plain':!![]});_0x3c7f20[_0x2793b1['id']]=_0x2793b1;}}_0x3c7f20=_[_0xb785('0x120')](_0x3c7f20);for(var _0x1c3413=qs[_0xb785('0x29')](_0x3c0df2[_0xb785('0x49')][_0xb785('0x29')]);_0x1c3413<_0x3c7f20[_0xb785('0x4e')]&&_0x1544ac[_0xb785('0x4e')]=_0xb88d5){_0x3b505b=_0xb88d5;_0x3b9fb2=0xc8;}else{_0x3b9fb2=0xce;}_0x2d2fca[_0x7a25('0x2b')](_0x3b9fb2);return _0x2d2fca[_0x7a25('0x31')](_0x7a25('0x32'),_0x161c86+'-'+_0x3b505b+'/'+_0xb88d5)[_0x7a25('0x2d')](_0xeba023);}return null;};}function patchUpdates(_0x48156b){return function(_0x12d393){try{jsonpatch[_0x7a25('0x33')](_0x12d393,_0x48156b,!![]);}catch(_0x20c2ae){return BPromise['reject'](_0x20c2ae);}return _0x12d393['save']();};}function saveUpdates(_0x4ccc5a,_0x54ea95){return function(_0x2b95ec){if(_0x2b95ec){return _0x2b95ec[_0x7a25('0x34')](_0x4ccc5a)[_0x7a25('0x35')](function(_0x2b1e9c){return _0x2b1e9c;});}return null;};}function removeEntity(_0x349c89,_0x3f9a7c){return function(_0x3c09d7){if(_0x3c09d7){return _0x3c09d7['destroy']()['then'](function(){var _0x2c4e3c=_0x3c09d7[_0x7a25('0x36')]({'plain':!![]});if(_0x2c4e3c[_0x7a25('0x37')]===_0x7a25('0x38'))return;var _0x19ee72=[{'name':_0x7a25('0x39'),'value':_0x7a25('0x3a'),'ignore':!![]},{'name':_0x7a25('0x3b'),'value':_0x7a25('0x3c'),'ignore':![]},{'name':_0x7a25('0x3d'),'value':_0x7a25('0x3e'),'ignore':![]}];var _0x41a14b=_(_0x19ee72)[_0x7a25('0x3f')]('ignore')[_0x7a25('0x40')](_0x7a25('0x41'))['value']();if(_[_0x7a25('0x42')](_0x41a14b,_0x2c4e3c[_0x7a25('0x37')])){return;}var _0x41ed43=_['find'](_0x19ee72,['value',_0x2c4e3c[_0x7a25('0x37')]])['name'];return db[_0x7a25('0x43')][_0x7a25('0x44')]({'where':{'type':_0x41ed43,'resourceId':_0x2c4e3c['id']}})[_0x7a25('0x35')](function(){return _0x3c09d7;});})[_0x7a25('0x35')](function(){_0x349c89[_0x7a25('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x300629,_0x1fd5fb){return function(_0x451c5b){if(!_0x451c5b){_0x300629[_0x7a25('0x45')](0x194);}return _0x451c5b;};}function handleError(_0x2b76c7,_0x202e4b){_0x202e4b=_0x202e4b||0x1f4;return function(_0x2d3c8d){logger[_0x7a25('0x25')](_0x2d3c8d[_0x7a25('0x46')]);if(_0x2d3c8d[_0x7a25('0x47')]){delete _0x2d3c8d[_0x7a25('0x47')];}_0x2b76c7[_0x7a25('0x2b')](_0x202e4b)[_0x7a25('0x48')](_0x2d3c8d);};}exports[_0x7a25('0x49')]=function(_0x42e858,_0x21630e){var _0x415d00={},_0x55f9a2={},_0x1a2041={'count':0x0,'rows':[]};var _0x3c33c7=_[_0x7a25('0x40')](db[_0x7a25('0x4a')][_0x7a25('0x4b')],function(_0x11c277){return{'name':_0x11c277['fieldName'],'type':_0x11c277[_0x7a25('0x4c')][_0x7a25('0x4d')]};});_0x55f9a2['model']=_[_0x7a25('0x4e')](_[_0x7a25('0x40')](_0x3c33c7,'name'),[_0x7a25('0x4f'),_0x7a25('0x50')]);_0x55f9a2[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x42e858['query']);_0x55f9a2[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x55f9a2['model'],_0x55f9a2['query']);_0x415d00[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x55f9a2[_0x7a25('0x56')],qs['fields'](_0x42e858[_0x7a25('0x51')][_0x7a25('0x57')]));_0x415d00[_0x7a25('0x55')]=_0x415d00[_0x7a25('0x55')][_0x7a25('0x58')]?_0x415d00[_0x7a25('0x55')]:_0x55f9a2[_0x7a25('0x56')];if(!_0x42e858[_0x7a25('0x51')][_0x7a25('0x59')]('nolimit')){_0x415d00[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x42e858['query']['limit']);_0x415d00[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x42e858[_0x7a25('0x51')][_0x7a25('0x2f')]);}_0x415d00['order']=qs['sort'](_0x42e858[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x415d00[_0x7a25('0x5b')]=qs['filters'](_['pick'](_0x42e858[_0x7a25('0x51')],_0x55f9a2['filters']),_0x3c33c7);if(_0x42e858[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x415d00[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x415d00[_0x7a25('0x5b')],{'$or':_['map'](_0x3c33c7,function(_0x144ec7){if(_0x144ec7[_0x7a25('0x4c')]!==_0x7a25('0x5d')){return db[_0x7a25('0x5e')][_0x7a25('0x5b')](db[_0x7a25('0x5e')]['fn'](_0x7a25('0x5f'),db['sequelize'][_0x7a25('0x60')](_0x144ec7[_0x7a25('0x47')])),{'$like':db['sequelize']['fn'](_0x7a25('0x5f'),'%'+_0x42e858['query'][_0x7a25('0x3f')]+'%')});}})});}_0x415d00=_['merge']({},_0x415d00,_0x42e858[_0x7a25('0x61')]);var _0x8df1c8={'where':_0x415d00[_0x7a25('0x5b')]};return db[_0x7a25('0x4a')]['count'](_0x8df1c8)[_0x7a25('0x35')](function(_0x37526c){_0x1a2041['count']=_0x37526c;if(_0x42e858[_0x7a25('0x51')][_0x7a25('0x62')]){_0x415d00[_0x7a25('0x63')]=[{'all':!![]}];}return db['User']['findAll'](_0x415d00);})[_0x7a25('0x35')](function(_0x4c9b33){_0x1a2041[_0x7a25('0x64')]=_0x4c9b33;return _0x1a2041;})['then'](respondWithFilteredResult(_0x21630e,_0x415d00))[_0x7a25('0x2a')](handleError(_0x21630e,null));};exports[_0x7a25('0x65')]=function(_0x576aeb,_0x424553){var _0x33e352={'raw':![],'where':{'id':_0x576aeb[_0x7a25('0x66')]['id']}},_0x50921e={};_0x50921e[_0x7a25('0x56')]=_['differenceBy'](_[_0x7a25('0x52')](db[_0x7a25('0x4a')][_0x7a25('0x4b')]),[_0x7a25('0x4f'),_0x7a25('0x50')]);_0x50921e[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x576aeb[_0x7a25('0x51')]);_0x50921e['filtears']=_[_0x7a25('0x54')](_0x50921e[_0x7a25('0x56')],_0x50921e['query']);_0x33e352[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x50921e['model'],qs[_0x7a25('0x57')](_0x576aeb[_0x7a25('0x51')][_0x7a25('0x57')]));_0x33e352[_0x7a25('0x55')]=_0x33e352[_0x7a25('0x55')]['length']?_0x33e352[_0x7a25('0x55')]:_0x50921e[_0x7a25('0x56')];if(_0x576aeb['query'][_0x7a25('0x62')]){_0x33e352[_0x7a25('0x63')]=[{'all':!![]}];}_0x33e352=_[_0x7a25('0x5c')]({},_0x33e352,_0x576aeb[_0x7a25('0x61')]);return db['User']['find'](_0x33e352)[_0x7a25('0x35')](handleEntityNotFound(_0x424553,null))[_0x7a25('0x35')](respondWithResult(_0x424553,null))[_0x7a25('0x2a')](handleError(_0x424553,null));};exports['update']=function(_0xd2d52c,_0x6d08a0){if(_0xd2d52c[_0x7a25('0x67')]['id']){delete _0xd2d52c[_0x7a25('0x67')]['id'];}delete _0xd2d52c[_0x7a25('0x67')][_0x7a25('0x37')];return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0xd2d52c[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x6d08a0,null))['then'](saveUpdates(_0xd2d52c[_0x7a25('0x67')],null))['then'](respondWithResult(_0x6d08a0,null))['catch'](handleError(_0x6d08a0,null));};exports[_0x7a25('0x69')]=function(_0x5206c4,_0x3dea5c){return db['User']['describe']()[_0x7a25('0x35')](respondWithResult(_0x3dea5c,null))[_0x7a25('0x2a')](handleError(_0x3dea5c,null));};exports[_0x7a25('0x6a')]=function(_0x207cc4,_0x2346fb,_0x3fbc8a){return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0x207cc4[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x2346fb,null))[_0x7a25('0x35')](function(_0x1cc004){if(_0x1cc004){return _0x1cc004['addContacts'](_0x207cc4['body'][_0x7a25('0x6b')],_[_0x7a25('0x6c')](_0x207cc4['body'],[_0x7a25('0x6b'),'id'])||{});}})[_0x7a25('0x35')](respondWithResult(_0x2346fb,null))[_0x7a25('0x2a')](handleError(_0x2346fb,null));};function validateUser(_0x182ce7){return new BPromise(function(_0x4c3d27,_0x497f03){if(_0x182ce7[_0x7a25('0x6d')])return _0x4c3d27();return db[_0x7a25('0x6e')][_0x7a25('0x6f')](0x1)[_0x7a25('0x35')](function(_0x48e215){if(_0x48e215['securePassword'])authService[_0x7a25('0x70')](_0x182ce7[_0x7a25('0x4f')]);db[_0x7a25('0x4a')][_0x7a25('0x71')]('internal')[_0x7a25('0x35')](function(_0xae0514){if(_[_0x7a25('0x72')](_0xae0514)){_0x182ce7[_0x7a25('0x6d')]=_0x48e215[_0x7a25('0x73')]||0x1;return;}if(_['isNil'](_0x48e215[_0x7a25('0x73')])||_0x48e215[_0x7a25('0x73')]===_0xae0514){_0x182ce7[_0x7a25('0x6d')]=_0xae0514+0x1;return;}if(_0x48e215[_0x7a25('0x73')]>_0xae0514){_0x182ce7[_0x7a25('0x6d')]=_0x48e215[_0x7a25('0x73')];return;}return db[_0x7a25('0x5e')][_0x7a25('0x51')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7a25('0x5e')][_0x7a25('0x74')][_0x7a25('0x75')]})[_0x7a25('0x35')](function(_0x282bca){if(_0x282bca&&_0x282bca[_0x7a25('0x58')]){for(var _0x33d122=0x0,_0x280651=_0x282bca[_0x7a25('0x58')];_0x33d122<_0x280651&&_[_0x7a25('0x72')](_0x182ce7[_0x7a25('0x6d')]);_0x33d122++){if(_0x48e215[_0x7a25('0x73')]<=_0x282bca[_0x33d122][_0x7a25('0x76')]){_0x182ce7[_0x7a25('0x6d')]=_0x282bca[_0x33d122]['from'];}else if(_0x48e215[_0x7a25('0x73')]>_0x282bca[_0x33d122][_0x7a25('0x76')]&&_0x48e215[_0x7a25('0x73')]<=_0x282bca[_0x33d122]['to']){_0x182ce7[_0x7a25('0x6d')]=_0x48e215[_0x7a25('0x73')];}}}if(_[_0x7a25('0x72')](_0x182ce7[_0x7a25('0x6d')])){_0x182ce7['internal']=_0xae0514+0x1;}return _0x4c3d27(_0x182ce7);});});})['catch'](function(_0xc52615){_0x497f03(_0xc52615);});});}function updateUser(_0x513b92){return new BPromise(function(_0x4fc3d8,_0x868b26){try{if(_0x513b92[_0x7a25('0x77')]){_0x513b92[_0x7a25('0x78')]=_0x513b92['internal'];_0x513b92[_0x7a25('0x79')]={'mailbox':_0x513b92['internal'],'password':_0x513b92[_0x7a25('0x4f')],'fullname':_0x513b92[_0x7a25('0x7a')],'email':_0x513b92[_0x7a25('0x7b')]};}if(_0x513b92[_0x7a25('0x37')]==='agent'){if(!_0x513b92[_0x7a25('0x7c')])_0x513b92[_0x7a25('0x7c')]=[_0x7a25('0x7d'),_0x7a25('0x7e'),_0x7a25('0x7f'),_0x7a25('0x80'),'110','104',_0x7a25('0x81'),_0x7a25('0x82'),_0x7a25('0x83'),'108','109','100',_0x7a25('0x84'),_0x7a25('0x85')];}_0x4fc3d8(_0x513b92);}catch(_0x516555){_0x868b26(_0x516555);}});}exports[_0x7a25('0x86')]=function(_0x589369,_0x36a36f){if(_0x589369[_0x7a25('0x3a')][_0x7a25('0x37')]==='agent')throw new Error(_0x7a25('0x87'));if(_0x589369['body']['role']==='user'&&_0x589369[_0x7a25('0x3a')]['role']!=='admin'){throw new Error(_0x7a25('0x88'));}if(_0x589369[_0x7a25('0x67')][_0x7a25('0x37')]==='admin'&&_0x589369[_0x7a25('0x3a')][_0x7a25('0x37')]!==_0x7a25('0x38')){throw new Error(_0x7a25('0x89'));}return licenseUtil['checkUserLimits']([_0x589369['body']])[_0x7a25('0x35')](function(){return validateUser(_0x589369[_0x7a25('0x67')]);})[_0x7a25('0x35')](function(_0x234433){return updateUser(_0x234433)[_0x7a25('0x35')](function(_0x3eb1d7){if(_0x3eb1d7[_0x7a25('0x37')]===_0x7a25('0x38')){_0x3eb1d7[_0x7a25('0x8a')]=_0x589369['user'][_0x7a25('0x8a')];delete _0x3eb1d7[_0x7a25('0x8b')];}return _0x3eb1d7;});})[_0x7a25('0x35')](function(_0x24dd52){return db[_0x7a25('0x4a')][_0x7a25('0x86')](_0x24dd52,{'include':[{'model':db['VoiceMail'],'as':_0x7a25('0x79')}]});})['then'](function(_0xfa27b8){if(_0x589369['body']['role']===_0x7a25('0x3a'))return _0xfa27b8;if(_0x589369[_0x7a25('0x3a')]['role']!==_0x7a25('0x3a'))return _0xfa27b8;return db[_0x7a25('0x8c')][_0x7a25('0x68')]({'where':{'name':_0xfa27b8[_0x7a25('0x37')]===_0x7a25('0x3c')?_0x7a25('0x3b'):'Telephones','userProfileId':_0x589369[_0x7a25('0x3a')][_0x7a25('0x8b')]},'raw':!![]})['then'](function(_0x371e7a){if(!_0x371e7a||_0x371e7a[_0x7a25('0x8d')]!=0x0)return _0xfa27b8;return db['UserProfileResource'][_0x7a25('0x86')]({'name':_0xfa27b8[_0x7a25('0x47')],'resourceId':_0xfa27b8['id'],'type':_0x371e7a[_0x7a25('0x47')],'sectionId':_0x371e7a['id']},{})[_0x7a25('0x35')](function(){return _0xfa27b8;});})[_0x7a25('0x2a')](function(_0x33a072){logger[_0x7a25('0x25')](_0x7a25('0x8e'),_0x33a072);throw _0x33a072;});})[_0x7a25('0x35')](respondWithResult(_0x36a36f,0xc9))[_0x7a25('0x2a')](handleError(_0x36a36f,null));};exports[_0x7a25('0x8f')]=function(_0x1d311e,_0x3e17b2){var _0x9cb9e4=_0x1d311e[_0x7a25('0x67')];var _0x5402d4=[];if(_0x1d311e[_0x7a25('0x3a')][_0x7a25('0x37')]===_0x7a25('0x3c'))throw new Error(_0x7a25('0x87'));if(_[_0x7a25('0x90')](_0x9cb9e4,[_0x7a25('0x37'),_0x7a25('0x3a')])&&_0x1d311e['user'][_0x7a25('0x37')]!==_0x7a25('0x38')){throw new Error(_0x7a25('0x88'));}if(_[_0x7a25('0x90')](_0x9cb9e4,[_0x7a25('0x37'),'admin'])&&_0x1d311e[_0x7a25('0x3a')][_0x7a25('0x37')]!==_0x7a25('0x38')){throw new Error(_0x7a25('0x91'));}return licenseUtil[_0x7a25('0x92')](_0x9cb9e4)[_0x7a25('0x35')](function(){return validateUser(_0x9cb9e4[0x0]);})[_0x7a25('0x35')](function(){for(var _0x5638b7=0x1;_0x5638b7<_0x9cb9e4['length'];_0x5638b7++){var _0x5338fc=_0x9cb9e4[_0x5638b7-0x1][_0x7a25('0x6d')];if(!_0x9cb9e4[_0x5638b7]['internal'])_0x9cb9e4[_0x5638b7][_0x7a25('0x6d')]=_0x5338fc+0x1;_0x5402d4['push'](validateUser(_0x9cb9e4[_0x5638b7]));}return BPromise[_0x7a25('0x93')](_0x5402d4);})[_0x7a25('0x35')](function(){_0x5402d4=[];for(var _0x2f1a4c=0x0;_0x2f1a4c<_0x9cb9e4[_0x7a25('0x58')];_0x2f1a4c++){_0x5402d4['push'](updateUser(_0x9cb9e4[_0x2f1a4c]));}return BPromise[_0x7a25('0x93')](_0x5402d4);})[_0x7a25('0x35')](function(){return BPromise[_0x7a25('0x94')](_0x9cb9e4,function(_0x11fd84){return db[_0x7a25('0x4a')]['create'](_0x11fd84,{'include':[{'model':db[_0x7a25('0x79')],'as':_0x7a25('0x79')}]})[_0x7a25('0x35')](function(_0x233a2b){_0x11fd84['id']=_0x233a2b['id'];return _0x11fd84;});});})[_0x7a25('0x35')](function(_0x63086f){if(_0x1d311e[_0x7a25('0x67')][_0x7a25('0x37')]===_0x7a25('0x3a'))return _0x63086f;if(_0x1d311e[_0x7a25('0x3a')]['role']!=='user')return _0x63086f;var _0x4fd5c1=_[_0x7a25('0x90')](_0x63086f,function(_0x2f5a26){return _0x2f5a26[_0x7a25('0x37')]==='agent'||_0x2f5a26[_0x7a25('0x37')]===_0x7a25('0x3e');});if(!_0x4fd5c1)return _0x63086f;return db[_0x7a25('0x8c')]['findAll']({'where':{'name':{'$or':['Agents',_0x7a25('0x3d')]},'userProfileId':_0x1d311e[_0x7a25('0x3a')]['userProfileId']},'raw':!![]})['then'](function(_0x1f01b9){if(_[_0x7a25('0x95')](_0x1f01b9)||!_[_0x7a25('0x90')](_0x1f01b9,['autoAssociation',0x0]))return _0x63086f;_0x5402d4=[];var _0x3c84b6=_(_0x1f01b9)['map'](function(_0x509f7e){if(_0x509f7e[_0x7a25('0x8d')]===0x1)return;return _0x509f7e['name']==='Agents'?'agent':_0x7a25('0x3e');})[_0x7a25('0x96')]()[_0x7a25('0x41')]();for(var _0x9daba3=0x0;_0x9daba3<_0x63086f[_0x7a25('0x58')];_0x9daba3++){if(!_[_0x7a25('0x42')](_0x3c84b6,_0x63086f[_0x9daba3][_0x7a25('0x37')]))return;var _0x1f36ec=_0x63086f[_0x9daba3]['role']===_0x7a25('0x3c')?_0x7a25('0x3b'):_0x7a25('0x3d');_0x5402d4[_0x7a25('0x97')](db[_0x7a25('0x43')][_0x7a25('0x86')]({'name':_0x63086f[_0x9daba3][_0x7a25('0x47')],'resourceId':_0x63086f[_0x9daba3]['id'],'type':_0x1f36ec,'sectionId':_[_0x7a25('0x68')](_0x1f01b9,[_0x7a25('0x47'),_0x1f36ec])['id']},{}));}return BPromise['all'](_0x5402d4);})[_0x7a25('0x35')](respondWithResult(_0x3e17b2,0xc9))['catch'](handleError(_0x3e17b2,null));});};exports[_0x7a25('0x98')]=function(_0x9f321e,_0x105928,_0x27bf74){if(_0x9f321e[_0x7a25('0x67')]['id']){delete _0x9f321e[_0x7a25('0x67')]['id'];}return db[_0x7a25('0x4a')]['find']({'where':{'id':_0x9f321e[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](function(_0x414e28){if(!_0x414e28)return null;if(_0x414e28['id']===_0x9f321e[_0x7a25('0x3a')]['id']){if(!_0x9f321e[_0x7a25('0x67')][_0x7a25('0x99')]||!_0x9f321e[_0x7a25('0x67')][_0x7a25('0x9a')]){throw new db['Sequelize'][(_0x7a25('0x9b'))](_0x7a25('0x9c'));}if(!_0x414e28['authenticate'](_0x9f321e[_0x7a25('0x67')][_0x7a25('0x99')])){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))](_0x7a25('0x9e'));}if(_0x9f321e[_0x7a25('0x67')][_0x7a25('0x99')]===_0x9f321e[_0x7a25('0x67')][_0x7a25('0x9a')]){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))](_0x7a25('0x9f'));}}else if(_0x9f321e['user'][_0x7a25('0x37')]==='admin'){if(!_0x9f321e[_0x7a25('0x67')]['newPassword']){throw new db[(_0x7a25('0x9d'))]['ValidationError'](_0x7a25('0xa0'));}}else if(_0x9f321e[_0x7a25('0x3a')][_0x7a25('0x37')]===_0x7a25('0x3a')){if(!_0x9f321e['body'][_0x7a25('0x9a')]){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))](_0x7a25('0xa0'));}if(_0x414e28['role']!==_0x7a25('0x3c')){throw new db['Sequelize'][(_0x7a25('0x9b'))](_0x7a25('0x87'));}}else{throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))]('Unauthorized');}return _0x414e28;})[_0x7a25('0x35')](handleEntityNotFound(_0x105928,null))[_0x7a25('0x35')](function(_0x1f0142){return db[_0x7a25('0x6e')][_0x7a25('0xa1')]({'attributes':['id',_0x7a25('0xa2'),_0x7a25('0xa3'),_0x7a25('0xa4')]})['then'](function(_0x2e3342){if(_0x2e3342['securePassword'])authService[_0x7a25('0x70')](_0x9f321e[_0x7a25('0x67')][_0x7a25('0x9a')]);if(!_0x2e3342[_0x7a25('0xa3')]||!_0x1f0142[_0x7a25('0xa5')])return _0x1f0142;authService[_0x7a25('0xa6')](_0x9f321e['body'][_0x7a25('0x9a')],_0x1f0142['previousPasswords'],_0x2e3342[_0x7a25('0xa4')]);return _0x1f0142;})[_0x7a25('0x35')](saveUpdates({'password':_0x9f321e['body'][_0x7a25('0x9a')],'passwordResetAt':_0x9f321e[_0x7a25('0x3a')]['id']==_0x9f321e[_0x7a25('0x66')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x9f321e['body'][_0x7a25('0x9a')],_0x1f0142[_0x7a25('0xa5')])},null));})[_0x7a25('0x35')](respondWithResult(_0x105928,null))[_0x7a25('0x2a')](handleError(_0x105928,null));};exports['addQueues']=function(_0x1fd14d,_0x14aaa2,_0x237069){var _0x290ecb=_0x1fd14d[_0x7a25('0x67')][_0x7a25('0xa7')];return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0x1fd14d[_0x7a25('0x66')]['id']},'attributes':['id',_0x7a25('0x47'),_0x7a25('0x37'),_0x7a25('0xa8'),'loginInPause',_0x7a25('0xa9'),_0x7a25('0xaa')]})[_0x7a25('0x35')](handleEntityNotFound(_0x14aaa2,null))[_0x7a25('0x35')](function(_0xb1cc22){if(_0xb1cc22){if(!utils[_0x7a25('0xab')](_0x290ecb)){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))]('Unknown\x20channel');}return _0xb1cc22[_0x7a25('0xac')+_['capitalize'](_0x290ecb[_0x7a25('0xad')]())+'Queues'](_0x1fd14d['body'][_0x7a25('0x6b')],{'penalty':_0x1fd14d[_0x7a25('0x67')][_0x7a25('0xae')]||0x0})[_0x7a25('0xaf')](function(_0x3f678f){for(var _0x1ce9d5=0x0;_0x1ce9d5<_0x1fd14d[_0x7a25('0x67')]['ids']['length'];_0x1ce9d5+=0x1){var _0x84e06c={'UserId':_0x1fd14d['params']['id']};_0x84e06c[_[_0x7a25('0xb0')](_0x290ecb[_0x7a25('0xad')]())+_0x7a25('0xb1')]=_0x1fd14d['body'][_0x7a25('0x6b')][_0x1ce9d5];socket[_0x7a25('0xb2')](_0x7a25('0x3a')+_[_0x7a25('0xb0')](_0x290ecb['toLowerCase']())+_0x7a25('0xb3'),_0x84e06c);}return _0x3f678f;})[_0x7a25('0x35')](function(){if(_0x290ecb===_0x7a25('0xb4')){return db['VoiceQueue'][_0x7a25('0xb5')]({'where':{'id':_0x1fd14d['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x7a25('0x35')](function(_0x56f3a9){var _0x14d89c=_0xb1cc22[_0x7a25('0x36')]({'plain':!![]});var _0x3de291=[];if(_0x290ecb===_0x7a25('0xb4')&&_0x14d89c['role']===_0x7a25('0x3c')&&_0x14d89c[_0x7a25('0xa8')]){for(var _0x53333a=0x0;_0x53333a<_0x56f3a9[_0x7a25('0x58')];_0x53333a+=0x1){_0x3de291['push']({'membername':_0x14d89c[_0x7a25('0x47')],'UserId':_0x14d89c['id'],'queue_name':_0x56f3a9[_0x53333a][_0x7a25('0x47')],'VoiceQueueId':_0x56f3a9[_0x53333a]['id'],'interface':_[_0x7a25('0x72')](_0x14d89c[_0x7a25('0xaa')])?util['format'](_0x7a25('0xb6'),_0x14d89c['name']):_0x14d89c[_0x7a25('0xaa')],'paused':_0x14d89c[_0x7a25('0xa9')]||![],'penalty':_0x1fd14d[_0x7a25('0x67')][_0x7a25('0xae')]||0x0});}return BPromise[_0x7a25('0x94')](_0x3de291,function(_0x2e6a52){return db[_0x7a25('0xb7')][_0x7a25('0xb8')](_0x2e6a52);});}return _0xb1cc22;});}})[_0x7a25('0x35')](respondWithStatusCode(_0x14aaa2,null))['catch'](handleError(_0x14aaa2,null));};exports['removeQueues']=function(_0x45187b,_0x2e7ccb,_0x355b2d){var _0x310ea8;return db[_0x7a25('0x4a')]['find']({'where':{'id':_0x45187b[_0x7a25('0x66')]['id']},'attributes':['id',_0x7a25('0x47'),_0x7a25('0x37')]})[_0x7a25('0x35')](handleEntityNotFound(_0x2e7ccb,null))[_0x7a25('0x35')](function(_0x40c5a4){if(_0x40c5a4){_0x310ea8=_0x40c5a4;if(!_0x45187b['query'][_0x7a25('0xa7')]||!utils[_0x7a25('0xab')](_0x45187b[_0x7a25('0x51')][_0x7a25('0xa7')])){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))](_0x7a25('0xb9'));}return _0x40c5a4[_0x7a25('0xba')+_[_0x7a25('0xb0')](_0x45187b[_0x7a25('0x51')][_0x7a25('0xa7')][_0x7a25('0xad')]())+'Queues'](_0x45187b[_0x7a25('0x51')][_0x7a25('0x6b')]);}})[_0x7a25('0x35')](function(_0x38e87d){for(var _0x4c773f=0x0;_0x4c773f<_0x45187b['query'][_0x7a25('0x6b')][_0x7a25('0x58')];_0x4c773f+=0x1){var _0x5d11d1={'UserId':_0x45187b['params']['id']};_0x5d11d1[_[_0x7a25('0xb0')](_0x45187b[_0x7a25('0x51')]['channel'][_0x7a25('0xad')]())+_0x7a25('0xb1')]=_0x45187b[_0x7a25('0x51')][_0x7a25('0x6b')][_0x4c773f];socket[_0x7a25('0xb2')](_0x7a25('0x3a')+_[_0x7a25('0xb0')](_0x45187b[_0x7a25('0x51')][_0x7a25('0xa7')][_0x7a25('0xad')]())+_0x7a25('0xbb'),_0x5d11d1);}return _0x38e87d;})['then'](function(){if(_0x45187b['query'][_0x7a25('0xa7')]===_0x7a25('0xb4')){return db['UserVoiceQueueRt'][_0x7a25('0x44')]({'where':{'UserId':_0x45187b['params']['id'],'VoiceQueueId':_0x45187b[_0x7a25('0x51')]['ids']},'individualHooks':!![]})[_0x7a25('0x35')](function(){return _0x310ea8;});}return _0x310ea8;})[_0x7a25('0x35')](respondWithStatusCode(_0x2e7ccb,null))[_0x7a25('0x2a')](handleError(_0x2e7ccb,null));};exports[_0x7a25('0xbc')]=function(_0x237e9e,_0x481cd5,_0x7f81b7){_0x237e9e[_0x7a25('0x67')][_0x7a25('0xbd')]=_0x237e9e['file'][_0x7a25('0xbe')];return db['User'][_0x7a25('0x68')]({'where':{'id':_0x237e9e[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x481cd5,null))[_0x7a25('0x35')](saveUpdates(_0x237e9e[_0x7a25('0x67')],null))['then'](respondWithResult(_0x481cd5,null))[_0x7a25('0x2a')](handleError(_0x481cd5,null));};exports[_0x7a25('0xbf')]=function(_0x2ff4d1,_0x4d8835,_0x3962ac){var _0x3f0ccb=path[_0x7a25('0xc0')](config[_0x7a25('0xc1')],_0x7a25('0xc2'));return db['User'][_0x7a25('0x68')]({'where':{'id':_0x2ff4d1[_0x7a25('0x66')]['id']},'attributes':['id',_0x7a25('0xbd')],'raw':!![]})[_0x7a25('0x35')](handleEntityNotFound(_0x4d8835,null))[_0x7a25('0x35')](function(_0x5f0ba8){if(_0x5f0ba8){if(_[_0x7a25('0x72')](_0x5f0ba8[_0x7a25('0xbd')])){return _0x4d8835[_0x7a25('0xc3')](_0x3f0ccb);}else{if(!fs[_0x7a25('0xc4')](path[_0x7a25('0xc0')](config[_0x7a25('0xc1')],'server/files/images/',_0x5f0ba8['userpic']))){return _0x4d8835[_0x7a25('0xc3')](_0x3f0ccb);}return _0x4d8835['download'](path[_0x7a25('0xc0')](config[_0x7a25('0xc1')],_0x7a25('0xc5'),_0x5f0ba8['userpic']));}}})[_0x7a25('0x2a')](handleError(_0x4d8835,null));};exports[_0x7a25('0xc6')]=function(_0x18feb5,_0x55ba9a,_0xda7661){var _0x47d10f={};var _0x4f5ca7={};var _0x336b82;var _0x172c3e;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x18feb5[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x55ba9a,null))[_0x7a25('0x35')](function(_0x1c3c47){if(_0x1c3c47){_0x336b82=_0x1c3c47;_0x4f5ca7['model']=_[_0x7a25('0x52')](db['CmContact'][_0x7a25('0x4b')]);_0x4f5ca7['query']=_['keys'](_0x18feb5['query']);_0x4f5ca7['filters']=_[_0x7a25('0x54')](_0x4f5ca7[_0x7a25('0x56')],_0x4f5ca7[_0x7a25('0x51')]);_0x47d10f[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x4f5ca7['model'],qs['fields'](_0x18feb5[_0x7a25('0x51')]['fields']));_0x47d10f[_0x7a25('0x55')]=_0x47d10f[_0x7a25('0x55')][_0x7a25('0x58')]?_0x47d10f[_0x7a25('0x55')]:_0x4f5ca7[_0x7a25('0x56')];_0x47d10f[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x18feb5[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x47d10f[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x18feb5[_0x7a25('0x51')],_0x4f5ca7[_0x7a25('0x53')]));if(_0x18feb5['query'][_0x7a25('0x3f')]){_0x47d10f[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x47d10f[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x47d10f[_0x7a25('0x55')],function(_0x284b6e){var _0x2fbc3f={};_0x2fbc3f[_0x284b6e]={'$like':'%'+_0x18feb5[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x2fbc3f;})});}_0x47d10f=_[_0x7a25('0x5c')]({},_0x47d10f,_0x18feb5[_0x7a25('0x61')]);return _0x336b82[_0x7a25('0xc6')](_0x47d10f);}})[_0x7a25('0x35')](function(_0x20e665){if(_0x20e665){_0x172c3e=_0x20e665['length'];if(_0x18feb5[_0x7a25('0x51')][_0x7a25('0x59')]('includeAll')){_0x47d10f[_0x7a25('0x63')]=[{'model':db[_0x7a25('0xc9')],'as':_0x7a25('0xca'),'required':![]},{'model':db[_0x7a25('0xcb')],'as':_0x7a25('0xcc'),'attributes':['id',_0x7a25('0x47'),_0x7a25('0xcd')],'where':_0x18feb5[_0x7a25('0x51')][_0x7a25('0xce')]?{'id':_0x18feb5['query'][_0x7a25('0xce')]}:undefined,'required':_0x18feb5[_0x7a25('0x51')][_0x7a25('0xce')]?!![]:![]}];}if(!_0x18feb5[_0x7a25('0x51')]['hasOwnProperty']('nolimit')){_0x47d10f[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x18feb5[_0x7a25('0x51')][_0x7a25('0x30')]);_0x47d10f[_0x7a25('0x2f')]=qs['offset'](_0x18feb5[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x336b82[_0x7a25('0xc6')](_0x47d10f);}})[_0x7a25('0x35')](function(_0x5c57f8){if(_0x5c57f8){return _0x5c57f8?{'count':_0x172c3e,'rows':_0x5c57f8}:null;}})['then'](respondWithResult(_0x55ba9a,null))[_0x7a25('0x2a')](handleError(_0x55ba9a,null));};exports[_0x7a25('0xcf')]=function(_0x3ffa2b,_0x3dadd5,_0x169bdc){var _0x27a4bf;var _0x4a569f;var _0x2ca41a={};var _0x4e54c4;return db['User'][_0x7a25('0xa1')]({'where':{'id':_0x3ffa2b[_0x7a25('0x66')]['id']},'attributes':['id',_0x7a25('0x47'),'role']})[_0x7a25('0x35')](handleEntityNotFound(_0x3dadd5,null))[_0x7a25('0x35')](function(_0x66b6a2){if(!utils[_0x7a25('0xab')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0xa7')])){throw new db['Sequelize'][(_0x7a25('0x9b'))](_0x7a25('0xb9'));}_0x27a4bf=_0x66b6a2;var _0x5325cd={};_0x5325cd['model']=_[_0x7a25('0x52')](db[_[_0x7a25('0xb0')](_0x3ffa2b['query'][_0x7a25('0xa7')])+'Queue'][_0x7a25('0x4b')]);_0x5325cd['query']=_[_0x7a25('0x52')](_0x3ffa2b['query']);_0x5325cd[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x5325cd[_0x7a25('0x56')],_0x5325cd[_0x7a25('0x51')]);_0x2ca41a[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x5325cd[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x57')]));_0x2ca41a[_0x7a25('0x55')]=_0x2ca41a[_0x7a25('0x55')]['length']?_0x2ca41a['attributes']:_0x5325cd[_0x7a25('0x56')];_0x2ca41a[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x2ca41a[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x3ffa2b[_0x7a25('0x51')],_0x5325cd[_0x7a25('0x53')]));if(_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x2ca41a[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x2ca41a[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x2ca41a[_0x7a25('0x55')],function(_0x1b11d7){var _0x1aa08f={};_0x1aa08f[_0x1b11d7]={'$like':'%'+_0x3ffa2b[_0x7a25('0x51')]['filter']+'%'};return _0x1aa08f;})});}_0x2ca41a=_['merge']({},_0x2ca41a,_0x3ffa2b[_0x7a25('0x61')]);switch(_0x27a4bf[_0x7a25('0x37')]){case _0x7a25('0x38'):return db[_[_0x7a25('0xb0')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0xa7')])+'Queue']['findAll'](_0x2ca41a);case _0x7a25('0x3a'):case _0x7a25('0x3c'):return _0x27a4bf[_0x7a25('0x36')+_[_0x7a25('0xb0')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0xa7')])+_0x7a25('0xd0')](_0x2ca41a);default:throw new db['Sequelize'][(_0x7a25('0x9b'))](_0x7a25('0xd1'));}})['then'](function(_0x4d36bb){_0x4e54c4=_0x4d36bb['length'];if(!_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x2ca41a[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x30')]);_0x2ca41a[_0x7a25('0x2f')]=qs['offset'](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0x2f')]);}switch(_0x27a4bf['role']){case _0x7a25('0x38'):return db[_[_0x7a25('0xb0')](_0x3ffa2b[_0x7a25('0x51')][_0x7a25('0xa7')])+_0x7a25('0xd3')]['findAll'](_0x2ca41a);case _0x7a25('0x3a'):case _0x7a25('0x3c'):return _0x27a4bf[_0x7a25('0x36')+_['capitalize'](_0x3ffa2b['query'][_0x7a25('0xa7')])+_0x7a25('0xd0')](_0x2ca41a);}})['then'](function(_0x1b2cd2){return{'count':_0x4e54c4,'rows':_0x1b2cd2};})[_0x7a25('0x35')](respondWithResult(_0x3dadd5,null))['catch'](handleError(_0x3dadd5,null));};exports[_0x7a25('0xd4')]=function(_0x43ddbb,_0x1d6d53,_0x579b1d){var _0x1586a1={};var _0x2178c2={};var _0x58ca66;var _0x397b30;return db['User']['findOne']({'where':{'id':_0x43ddbb[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x1d6d53,null))[_0x7a25('0x35')](function(_0x122831){if(_0x122831){_0x58ca66=_0x122831;_0x2178c2[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xb7')][_0x7a25('0x4b')]);_0x2178c2['query']=_['keys'](_0x43ddbb[_0x7a25('0x51')]);_0x2178c2[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x2178c2['model'],_0x2178c2[_0x7a25('0x51')]);_0x1586a1[_0x7a25('0x55')]=_['intersection'](_0x2178c2[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x43ddbb[_0x7a25('0x51')][_0x7a25('0x57')]));_0x1586a1[_0x7a25('0x55')]=_0x1586a1[_0x7a25('0x55')][_0x7a25('0x58')]?_0x1586a1[_0x7a25('0x55')]:_0x2178c2[_0x7a25('0x56')];_0x1586a1[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x43ddbb[_0x7a25('0x51')]['sort']);_0x1586a1[_0x7a25('0x5b')]=qs['filters'](_[_0x7a25('0xc8')](_0x43ddbb[_0x7a25('0x51')],_0x2178c2[_0x7a25('0x53')]));if(_0x43ddbb[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x1586a1['where']=_['merge'](_0x1586a1[_0x7a25('0x5b')],{'$or':_['map'](_0x1586a1[_0x7a25('0x55')],function(_0x532788){var _0x2cb219={};_0x2cb219[_0x532788]={'$like':'%'+_0x43ddbb[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x2cb219;})});}_0x1586a1=_[_0x7a25('0x5c')]({},_0x1586a1,_0x43ddbb[_0x7a25('0x61')]);return _0x58ca66[_0x7a25('0xd4')](_0x1586a1);}})[_0x7a25('0x35')](function(_0x1daa45){if(_0x1daa45){_0x397b30=_0x1daa45[_0x7a25('0x58')];if(!_0x43ddbb['query']['hasOwnProperty'](_0x7a25('0xd2'))){_0x1586a1[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x43ddbb[_0x7a25('0x51')]['limit']);_0x1586a1[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x43ddbb[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x58ca66['getVoiceQueuesRt'](_0x1586a1);}})[_0x7a25('0x35')](function(_0x50b368){if(_0x50b368){return _0x50b368?{'count':_0x397b30,'rows':_0x50b368}:null;}})[_0x7a25('0x35')](respondWithResult(_0x1d6d53,null))[_0x7a25('0x2a')](handleError(_0x1d6d53,null));};exports[_0x7a25('0xd5')]=function(_0x8f7b5b,_0x136ad6,_0x22a3ad){var _0x296610={};var _0x37dcf8={};var _0x1d6671;var _0x32fba7;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x8f7b5b[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x136ad6,null))[_0x7a25('0x35')](function(_0x3e602e){if(_0x3e602e){_0x1d6671=_0x3e602e;_0x37dcf8[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xd6')][_0x7a25('0x4b')]);_0x37dcf8['query']=_[_0x7a25('0x52')](_0x8f7b5b[_0x7a25('0x51')]);_0x37dcf8['filters']=_['intersection'](_0x37dcf8[_0x7a25('0x56')],_0x37dcf8[_0x7a25('0x51')]);_0x296610[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x37dcf8['model'],qs['fields'](_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x57')]));_0x296610[_0x7a25('0x55')]=_0x296610[_0x7a25('0x55')][_0x7a25('0x58')]?_0x296610[_0x7a25('0x55')]:_0x37dcf8[_0x7a25('0x56')];_0x296610[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x296610[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x8f7b5b['query'],_0x37dcf8['filters']));if(_0x8f7b5b[_0x7a25('0x51')]['filter']){_0x296610[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x296610[_0x7a25('0x5b')],{'$or':_['map'](_0x296610['attributes'],function(_0x342493){var _0x353d9e={};_0x353d9e[_0x342493]={'$like':'%'+_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x353d9e;})});}_0x296610=_['merge']({},_0x296610,_0x8f7b5b['options']);return _0x1d6671[_0x7a25('0xd5')](_0x296610);}})[_0x7a25('0x35')](function(_0x598eee){if(_0x598eee){_0x32fba7=_0x598eee['length'];if(!_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x59')]('nolimit')){_0x296610[_0x7a25('0x30')]=qs['limit'](_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x30')]);_0x296610['offset']=qs[_0x7a25('0x2f')](_0x8f7b5b[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x1d6671[_0x7a25('0xd5')](_0x296610);}})[_0x7a25('0x35')](function(_0x34b710){if(_0x34b710){return _0x34b710?{'count':_0x32fba7,'rows':_0x34b710}:null;}})[_0x7a25('0x35')](respondWithResult(_0x136ad6,null))[_0x7a25('0x2a')](handleError(_0x136ad6,null));};exports[_0x7a25('0xd7')]=function(_0x1eab4e,_0x42a457,_0x3f5422){var _0x20459b={'raw':!![],'where':{}};var _0x56a559={};var _0x2aeaba={'count':0x0,'rows':[]};return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x1eab4e['params']['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x42a457,null))[_0x7a25('0x35')](function(_0x46155e){if(_0x46155e){_0x56a559['model']=_[_0x7a25('0x52')](db[_0x7a25('0xd8')][_0x7a25('0x4b')]);_0x56a559[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x1eab4e[_0x7a25('0x51')]);_0x56a559[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x56a559[_0x7a25('0x56')],_0x56a559[_0x7a25('0x51')]);_0x20459b[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x56a559[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x1eab4e['query'][_0x7a25('0x57')]));_0x20459b[_0x7a25('0x55')]=_0x20459b[_0x7a25('0x55')][_0x7a25('0x58')]?_0x20459b[_0x7a25('0x55')]:_0x56a559[_0x7a25('0x56')];if(!_0x1eab4e['query'][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x20459b[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x1eab4e[_0x7a25('0x51')][_0x7a25('0x30')]);_0x20459b[_0x7a25('0x2f')]=qs['offset'](_0x1eab4e[_0x7a25('0x51')][_0x7a25('0x2f')]);}_0x20459b[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x1eab4e[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x20459b['where']=qs['filters'](_['pick'](_0x1eab4e[_0x7a25('0x51')],_0x56a559[_0x7a25('0x53')]));_0x20459b[_0x7a25('0x5b')][_0x7a25('0xd9')]=_0x46155e['id'];if(_0x1eab4e[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x20459b[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x20459b['where'],{'$or':_[_0x7a25('0x40')](_0x20459b[_0x7a25('0x55')],function(_0x528eaa){var _0x6aa738={};_0x6aa738[_0x528eaa]={'$like':'%'+_0x1eab4e[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x6aa738;})});}_0x20459b=_[_0x7a25('0x5c')]({},_0x20459b,_0x1eab4e[_0x7a25('0x61')]);return db[_0x7a25('0xd8')][_0x7a25('0x2e')]({'where':_0x20459b[_0x7a25('0x5b')]})['then'](function(_0x40519b){_0x2aeaba[_0x7a25('0x2e')]=_0x40519b;if(_0x1eab4e['query'][_0x7a25('0x62')]){_0x20459b[_0x7a25('0x63')]=[{'all':!![]}];}return db['VoiceRecording'][_0x7a25('0xb5')](_0x20459b);})[_0x7a25('0x35')](function(_0x231001){_0x2aeaba[_0x7a25('0x64')]=_0x231001;return _0x2aeaba;});}})['then'](respondWithFilteredResult(_0x42a457,_0x20459b))['catch'](handleError(_0x42a457,null));};exports[_0x7a25('0xda')]=function(_0x575155,_0x53e6bc,_0x1417f1){var _0x4bc806={'raw':!![],'where':{}};var _0x380876={};var _0x599963={'count':0x0,'rows':[]};return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x575155[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x53e6bc,null))[_0x7a25('0x35')](function(_0xf41ced){if(_0xf41ced){_0x380876[_0x7a25('0x56')]=_[_0x7a25('0x52')](db['ScreenRecording']['rawAttributes']);_0x380876[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x575155[_0x7a25('0x51')]);_0x380876[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x380876['model'],_0x380876[_0x7a25('0x51')]);_0x4bc806[_0x7a25('0x55')]=_['intersection'](_0x380876[_0x7a25('0x56')],qs['fields'](_0x575155[_0x7a25('0x51')][_0x7a25('0x57')]));_0x4bc806['attributes']=_0x4bc806[_0x7a25('0x55')][_0x7a25('0x58')]?_0x4bc806[_0x7a25('0x55')]:_0x380876['model'];if(!_0x575155['query'][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x4bc806[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x575155['query'][_0x7a25('0x30')]);_0x4bc806[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x575155[_0x7a25('0x51')]['offset']);}_0x4bc806[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x575155[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x4bc806[_0x7a25('0x5b')]=qs['filters'](_[_0x7a25('0xc8')](_0x575155[_0x7a25('0x51')],_0x380876['filters']));_0x4bc806[_0x7a25('0x5b')][_0x7a25('0xd9')]=_0xf41ced['id'];if(_0x575155[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x4bc806[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x4bc806[_0x7a25('0x5b')],{'$or':_['map'](_0x4bc806[_0x7a25('0x55')],function(_0x2ed7fb){var _0x59f0ce={};_0x59f0ce[_0x2ed7fb]={'$like':'%'+_0x575155[_0x7a25('0x51')]['filter']+'%'};return _0x59f0ce;})});}_0x4bc806=_['merge']({},_0x4bc806,_0x575155[_0x7a25('0x61')]);return db[_0x7a25('0xdb')][_0x7a25('0x2e')]({'where':_0x4bc806[_0x7a25('0x5b')]})[_0x7a25('0x35')](function(_0x3d8d5f){_0x599963['count']=_0x3d8d5f;if(_0x575155[_0x7a25('0x51')][_0x7a25('0x62')]){_0x4bc806[_0x7a25('0x63')]=[{'all':!![]}];}return db[_0x7a25('0xdb')]['findAll'](_0x4bc806);})['then'](function(_0x1ad914){_0x599963[_0x7a25('0x64')]=_0x1ad914;return _0x599963;});}})['then'](respondWithFilteredResult(_0x53e6bc,_0x4bc806))[_0x7a25('0x2a')](handleError(_0x53e6bc,null));};exports[_0x7a25('0xdc')]=function(_0x2e7e48,_0x4960e6,_0x5ced00){var _0x345a74={};var _0x2fe4e7={};var _0x4eb654;var _0x2ad14c;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x2e7e48[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x4960e6,null))['then'](function(_0x59fdb7){if(_0x59fdb7){_0x4eb654=_0x59fdb7;_0x2fe4e7[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xdd')][_0x7a25('0x4b')]);_0x2fe4e7['query']=_['keys'](_0x2e7e48[_0x7a25('0x51')]);_0x2fe4e7[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x2fe4e7[_0x7a25('0x56')],_0x2fe4e7['query']);_0x345a74[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x2fe4e7[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x2e7e48['query'][_0x7a25('0x57')]));_0x345a74[_0x7a25('0x55')]=_0x345a74[_0x7a25('0x55')][_0x7a25('0x58')]?_0x345a74[_0x7a25('0x55')]:_0x2fe4e7[_0x7a25('0x56')];_0x345a74['order']=qs[_0x7a25('0x5a')](_0x2e7e48['query'][_0x7a25('0x5a')]);_0x345a74[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x2e7e48['query'],_0x2fe4e7['filters']));if(_0x2e7e48[_0x7a25('0x51')]['filter']){_0x345a74[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x345a74['where'],{'$or':_[_0x7a25('0x40')](_0x345a74['attributes'],function(_0x229dad){var _0x609313={};_0x609313[_0x229dad]={'$like':'%'+_0x2e7e48['query'][_0x7a25('0x3f')]+'%'};return _0x609313;})});}_0x345a74=_[_0x7a25('0x5c')]({},_0x345a74,_0x2e7e48[_0x7a25('0x61')]);return _0x4eb654[_0x7a25('0xdc')](_0x345a74);}})['then'](function(_0x4deb04){if(_0x4deb04){_0x2ad14c=_0x4deb04[_0x7a25('0x58')];if(!_0x2e7e48[_0x7a25('0x51')][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x345a74[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x2e7e48['query'][_0x7a25('0x30')]);_0x345a74[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x2e7e48[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x4eb654[_0x7a25('0xdc')](_0x345a74);}})['then'](function(_0x1f0b7d){if(_0x1f0b7d){return _0x1f0b7d?{'count':_0x2ad14c,'rows':_0x1f0b7d}:null;}})[_0x7a25('0x35')](respondWithResult(_0x4960e6,null))['catch'](handleError(_0x4960e6,null));};exports[_0x7a25('0xde')]=function(_0x26c5be,_0xcd634b,_0x100dd5){var _0x3121a2={};var _0x2db1b8={};var _0x4e47bd;var _0x5259df;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x26c5be['params']['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0xcd634b,null))[_0x7a25('0x35')](function(_0x341322){if(_0x341322){_0x4e47bd=_0x341322;_0x2db1b8[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xdf')][_0x7a25('0x4b')]);_0x2db1b8[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x26c5be[_0x7a25('0x51')]);_0x2db1b8[_0x7a25('0x53')]=_['intersection'](_0x2db1b8[_0x7a25('0x56')],_0x2db1b8[_0x7a25('0x51')]);_0x3121a2[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x2db1b8[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x26c5be['query']['fields']));_0x3121a2[_0x7a25('0x55')]=_0x3121a2[_0x7a25('0x55')]['length']?_0x3121a2['attributes']:_0x2db1b8[_0x7a25('0x56')];_0x3121a2['order']=qs[_0x7a25('0x5a')](_0x26c5be[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x3121a2[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_['pick'](_0x26c5be['query'],_0x2db1b8[_0x7a25('0x53')]));if(_0x26c5be['query'][_0x7a25('0x3f')]){_0x3121a2['where']=_[_0x7a25('0x5c')](_0x3121a2[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x3121a2[_0x7a25('0x55')],function(_0x286622){var _0x2dd831={};_0x2dd831[_0x286622]={'$like':'%'+_0x26c5be[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x2dd831;})});}_0x3121a2=_[_0x7a25('0x5c')]({},_0x3121a2,_0x26c5be[_0x7a25('0x61')]);return _0x4e47bd[_0x7a25('0xde')](_0x3121a2);}})[_0x7a25('0x35')](function(_0x4366df){if(_0x4366df){_0x5259df=_0x4366df[_0x7a25('0x58')];if(!_0x26c5be[_0x7a25('0x51')][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x3121a2[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x26c5be[_0x7a25('0x51')][_0x7a25('0x30')]);_0x3121a2[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x26c5be[_0x7a25('0x51')]['offset']);}return _0x4e47bd[_0x7a25('0xde')](_0x3121a2);}})['then'](function(_0x25c879){if(_0x25c879){return _0x25c879?{'count':_0x5259df,'rows':_0x25c879}:null;}})['then'](respondWithResult(_0xcd634b,null))[_0x7a25('0x2a')](handleError(_0xcd634b,null));};exports[_0x7a25('0xe0')]=function(_0xa842b8,_0x54f1c6,_0x17e275){var _0x5f217d={'raw':!![],'where':{}};var _0x391272={};var _0x2602f8={'count':0x0,'rows':[]};return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0xa842b8[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x54f1c6,null))['then'](function(_0x44ba43){if(_0x44ba43){_0x391272['model']=_['keys'](db[_0x7a25('0xe1')][_0x7a25('0x4b')]);_0x391272[_0x7a25('0x51')]=_['keys'](_0xa842b8['query']);_0x391272[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x391272[_0x7a25('0x56')],_0x391272[_0x7a25('0x51')]);_0x5f217d[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x391272[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0xa842b8[_0x7a25('0x51')][_0x7a25('0x57')]));_0x5f217d['attributes']=_0x5f217d[_0x7a25('0x55')][_0x7a25('0x58')]?_0x5f217d[_0x7a25('0x55')]:_0x391272[_0x7a25('0x56')];if(!_0xa842b8[_0x7a25('0x51')]['hasOwnProperty'](_0x7a25('0xd2'))){_0x5f217d['limit']=qs[_0x7a25('0x30')](_0xa842b8[_0x7a25('0x51')][_0x7a25('0x30')]);_0x5f217d['offset']=qs[_0x7a25('0x2f')](_0xa842b8['query']['offset']);}_0x5f217d[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0xa842b8[_0x7a25('0x51')]['sort']);_0x5f217d[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0xa842b8[_0x7a25('0x51')],_0x391272[_0x7a25('0x53')]));_0x5f217d[_0x7a25('0x5b')][_0x7a25('0xd9')]=_0x44ba43['id'];if(_0xa842b8[_0x7a25('0x51')]['filter']){_0x5f217d[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x5f217d[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x5f217d[_0x7a25('0x55')],function(_0x5fbb7b){var _0xeaf1e7={};_0xeaf1e7[_0x5fbb7b]={'$like':'%'+_0xa842b8[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0xeaf1e7;})});}_0x5f217d=_[_0x7a25('0x5c')]({},_0x5f217d,_0xa842b8[_0x7a25('0x61')]);return db['MailInteraction'][_0x7a25('0x2e')]({'where':_0x5f217d[_0x7a25('0x5b')]})[_0x7a25('0x35')](function(_0x28b8d2){_0x2602f8[_0x7a25('0x2e')]=_0x28b8d2;if(_0xa842b8[_0x7a25('0x51')][_0x7a25('0x62')]){_0x5f217d[_0x7a25('0x63')]=[{'all':!![]}];}return db['MailInteraction'][_0x7a25('0xb5')](_0x5f217d);})[_0x7a25('0x35')](function(_0x2d5e86){_0x2602f8['rows']=_0x2d5e86;return _0x2602f8;});}})[_0x7a25('0x35')](respondWithFilteredResult(_0x54f1c6,_0x5f217d))[_0x7a25('0x2a')](handleError(_0x54f1c6,null));};exports[_0x7a25('0xe2')]=function(_0x59c8c2,_0x4e225c,_0x41b82b){var _0x1bc0e3={};var _0x4c1e4a={};var _0xa52166;var _0xfae30e;return db['User']['findOne']({'where':{'id':_0x59c8c2['params']['id']}})['then'](handleEntityNotFound(_0x4e225c,null))[_0x7a25('0x35')](function(_0x1321ce){if(_0x1321ce){_0xa52166=_0x1321ce;_0x4c1e4a[_0x7a25('0x56')]=_['keys'](db[_0x7a25('0xe3')][_0x7a25('0x4b')]);_0x4c1e4a[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x59c8c2[_0x7a25('0x51')]);_0x4c1e4a['filters']=_[_0x7a25('0x54')](_0x4c1e4a[_0x7a25('0x56')],_0x4c1e4a[_0x7a25('0x51')]);_0x1bc0e3[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x4c1e4a['model'],qs[_0x7a25('0x57')](_0x59c8c2['query'][_0x7a25('0x57')]));_0x1bc0e3['attributes']=_0x1bc0e3[_0x7a25('0x55')]['length']?_0x1bc0e3[_0x7a25('0x55')]:_0x4c1e4a[_0x7a25('0x56')];_0x1bc0e3[_0x7a25('0xc7')]=qs['sort'](_0x59c8c2[_0x7a25('0x51')]['sort']);_0x1bc0e3[_0x7a25('0x5b')]=qs['filters'](_[_0x7a25('0xc8')](_0x59c8c2['query'],_0x4c1e4a['filters']));if(_0x59c8c2[_0x7a25('0x51')]['filter']){_0x1bc0e3['where']=_[_0x7a25('0x5c')](_0x1bc0e3[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x1bc0e3[_0x7a25('0x55')],function(_0x121cd4){var _0x5ada08={};_0x5ada08[_0x121cd4]={'$like':'%'+_0x59c8c2['query'][_0x7a25('0x3f')]+'%'};return _0x5ada08;})});}_0x1bc0e3=_[_0x7a25('0x5c')]({},_0x1bc0e3,_0x59c8c2[_0x7a25('0x61')]);return _0xa52166['getSmsInteractions'](_0x1bc0e3);}})['then'](function(_0x18b624){if(_0x18b624){_0xfae30e=_0x18b624[_0x7a25('0x58')];if(!_0x59c8c2['query'][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x1bc0e3['limit']=qs[_0x7a25('0x30')](_0x59c8c2[_0x7a25('0x51')]['limit']);_0x1bc0e3[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x59c8c2[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0xa52166['getSmsInteractions'](_0x1bc0e3);}})['then'](function(_0x18adec){if(_0x18adec){return _0x18adec?{'count':_0xfae30e,'rows':_0x18adec}:null;}})[_0x7a25('0x35')](respondWithResult(_0x4e225c,null))[_0x7a25('0x2a')](handleError(_0x4e225c,null));};exports[_0x7a25('0xe4')]=function(_0x55fa2b,_0x529f6e,_0x207aa2){var _0x23a185={};var _0x6dc68f={};var _0x5b88b8;var _0x2c741f;return db['User'][_0x7a25('0xa1')]({'where':{'id':_0x55fa2b[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x529f6e,null))[_0x7a25('0x35')](function(_0x3d5813){if(_0x3d5813){_0x5b88b8=_0x3d5813;_0x6dc68f[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xe5')][_0x7a25('0x4b')]);_0x6dc68f['query']=_[_0x7a25('0x52')](_0x55fa2b['query']);_0x6dc68f[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x6dc68f[_0x7a25('0x56')],_0x6dc68f['query']);_0x23a185[_0x7a25('0x55')]=_['intersection'](_0x6dc68f[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x55fa2b[_0x7a25('0x51')][_0x7a25('0x57')]));_0x23a185[_0x7a25('0x55')]=_0x23a185['attributes'][_0x7a25('0x58')]?_0x23a185[_0x7a25('0x55')]:_0x6dc68f[_0x7a25('0x56')];_0x23a185[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x55fa2b['query'][_0x7a25('0x5a')]);_0x23a185['where']=qs[_0x7a25('0x53')](_['pick'](_0x55fa2b[_0x7a25('0x51')],_0x6dc68f[_0x7a25('0x53')]));if(_0x55fa2b['query'][_0x7a25('0x3f')]){_0x23a185[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x23a185[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x23a185['attributes'],function(_0x5361b0){var _0x4f1c72={};_0x4f1c72[_0x5361b0]={'$like':'%'+_0x55fa2b[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x4f1c72;})});}_0x23a185=_[_0x7a25('0x5c')]({},_0x23a185,_0x55fa2b[_0x7a25('0x61')]);return _0x5b88b8['getFaxInteractions'](_0x23a185);}})[_0x7a25('0x35')](function(_0x47fb6f){if(_0x47fb6f){_0x2c741f=_0x47fb6f['length'];if(!_0x55fa2b[_0x7a25('0x51')][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x23a185[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x55fa2b[_0x7a25('0x51')][_0x7a25('0x30')]);_0x23a185['offset']=qs[_0x7a25('0x2f')](_0x55fa2b[_0x7a25('0x51')]['offset']);}return _0x5b88b8[_0x7a25('0xe4')](_0x23a185);}})['then'](function(_0x10426b){if(_0x10426b){return _0x10426b?{'count':_0x2c741f,'rows':_0x10426b}:null;}})['then'](respondWithResult(_0x529f6e,null))[_0x7a25('0x2a')](handleError(_0x529f6e,null));};exports[_0x7a25('0xe6')]=function(_0x52f86b,_0x4c658c,_0x43c43a){var _0x3d2a93={};var _0x2c0646={};var _0x40f4b4;var _0x33117e;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x52f86b['params']['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x4c658c,null))[_0x7a25('0x35')](function(_0x58157e){if(_0x58157e){_0x40f4b4=_0x58157e;_0x2c0646[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xe7')][_0x7a25('0x4b')]);_0x2c0646[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x52f86b['query']);_0x2c0646[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x2c0646['model'],_0x2c0646[_0x7a25('0x51')]);_0x3d2a93[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x2c0646[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x52f86b[_0x7a25('0x51')][_0x7a25('0x57')]));_0x3d2a93[_0x7a25('0x55')]=_0x3d2a93[_0x7a25('0x55')]['length']?_0x3d2a93[_0x7a25('0x55')]:_0x2c0646[_0x7a25('0x56')];_0x3d2a93[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x52f86b['query']['sort']);_0x3d2a93[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_['pick'](_0x52f86b['query'],_0x2c0646['filters']));if(_0x52f86b[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x3d2a93[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x3d2a93[_0x7a25('0x5b')],{'$or':_['map'](_0x3d2a93['attributes'],function(_0x19d071){var _0x4f8b6f={};_0x4f8b6f[_0x19d071]={'$like':'%'+_0x52f86b[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x4f8b6f;})});}_0x3d2a93=_[_0x7a25('0x5c')]({},_0x3d2a93,_0x52f86b[_0x7a25('0x61')]);return _0x40f4b4[_0x7a25('0xe6')](_0x3d2a93);}})[_0x7a25('0x35')](function(_0x26de29){if(_0x26de29){_0x33117e=_0x26de29['length'];if(!_0x52f86b['query'][_0x7a25('0x59')](_0x7a25('0xd2'))){_0x3d2a93[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x52f86b[_0x7a25('0x51')][_0x7a25('0x30')]);_0x3d2a93['offset']=qs[_0x7a25('0x2f')](_0x52f86b[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x40f4b4[_0x7a25('0xe6')](_0x3d2a93);}})['then'](function(_0x458dbe){if(_0x458dbe){return _0x458dbe?{'count':_0x33117e,'rows':_0x458dbe}:null;}})[_0x7a25('0x35')](respondWithResult(_0x4c658c,null))[_0x7a25('0x2a')](handleError(_0x4c658c,null));};exports[_0x7a25('0xe8')]=function(_0x5c9878,_0x434885,_0x446af1){var _0x543481;var _0x2c05a6;var _0xa4567a;var _0x382832=!_[_0x7a25('0x72')](_0x5c9878[_0x7a25('0x66')]['id'])?_0x5c9878[_0x7a25('0x66')]['id']:!_[_0x7a25('0x72')](_0x5c9878['user']['id'])?_0x5c9878[_0x7a25('0x3a')]['id']:null;return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0x382832,'role':{'$or':[_0x7a25('0x38'),_0x7a25('0x3a'),_0x7a25('0x3c')]}},'attributes':['id',_0x7a25('0x47'),_0x7a25('0xe9'),'mobile',_0x7a25('0x37'),_0x7a25('0x6d'),_0x7a25('0xea')]})[_0x7a25('0x35')](function(_0x2560ef){if(_0x2560ef){if(_0x2560ef[_0x7a25('0x37')]===_0x7a25('0x3c')){_0x543481=_0x2560ef;if(_0x5c9878[_0x7a25('0x67')][_0x7a25('0xaa')]){_0xa4567a=util[_0x7a25('0xeb')](_0x7a25('0xec'),_0x543481[_0x5c9878[_0x7a25('0x67')][_0x7a25('0xaa')]]);}else if(_0x5c9878[_0x7a25('0x67')][_0x7a25('0xed')]){_0xa4567a=util[_0x7a25('0xeb')](_0x7a25('0xb6'),_0x5c9878[_0x7a25('0x67')][_0x7a25('0xed')]);}else{_0xa4567a=util[_0x7a25('0xeb')](_0x7a25('0xb6'),_0x543481['name']);}socket['to'](util[_0x7a25('0xeb')](_0x7a25('0xee'),_0x543481[_0x7a25('0x47')]))['emit'](_0x7a25('0xef'),{'ip':_0x5c9878[_0x7a25('0xf0')][_0x7a25('0xf1')]||_0x5c9878[_0x7a25('0xf2')][_0x7a25('0xf3')]||_0x5c9878[_0x7a25('0xf4')][_0x7a25('0xf3')]||_0x5c9878['connection'][_0x7a25('0xf4')][_0x7a25('0xf3')]});return db[_0x7a25('0xb7')][_0x7a25('0x44')]({'where':{'membername':_0x543481[_0x7a25('0x47')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x7a25('0x9b'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x7a25('0x35')](function(){if(_0x543481){return _0x543481[_0x7a25('0xf5')]({'raw':!![]});}})[_0x7a25('0x35')](function(_0x2f8703){if(_0x543481){var _0x2a713f=[];if(_0x2f8703){_0x2c05a6=_0x2f8703;if(_0x2c05a6[_0x7a25('0x58')]){for(var _0x120efb=0x0;_0x120efb<_0x2c05a6['length'];_0x120efb++){_0x2a713f[_0x7a25('0x97')]({'membername':_0x543481['name'],'UserId':_0x543481['id'],'queue_name':_0x2c05a6[_0x120efb][_0x7a25('0x47')],'VoiceQueueId':_0x2c05a6[_0x120efb]['id'],'interface':_0xa4567a,'paused':_0x543481[_0x7a25('0xea')]||![],'penalty':_0x2c05a6[_0x120efb][_0x7a25('0xf6')]||0x0});}return BPromise[_0x7a25('0x94')](_0x2a713f,function(_0x5f4271){return db[_0x7a25('0xb7')][_0x7a25('0xb8')](_0x5f4271);});}}}})[_0x7a25('0x35')](function(){if(_0x543481){return db['MemberReport'][_0x7a25('0xb5')]({'where':{'membername':_0x543481['name'],'exitAt':null}});}})[_0x7a25('0x35')](function(_0x517c54){if(_0x543481){var _0x292dee=[];_0x517c54[_0x7a25('0xf7')](function(_0x3ebd9d){_0x292dee['push'](_0x3ebd9d[_0x7a25('0x34')]({'exitAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8'))}));});return BPromise[_0x7a25('0x93')](_0x292dee);}})[_0x7a25('0x35')](function(){if(_0x543481){var _0x5854f9=[];var _0x329ab4=[];var _0x43b16a=utils[_0x7a25('0xf9')]();var _0x4808b6={'membername':_0x543481[_0x7a25('0x47')],'interface':_0xa4567a,'enterAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8')),'role':_0x543481[_0x7a25('0x37')],'internal':_0x543481['internal']};_0x43b16a[_0x7a25('0xf7')](function(_0x16baa3){_0x5854f9[_0x7a25('0x97')](_['merge']({'channel':_0x16baa3,'type':_0x7a25('0xfa'),'data1':_0x5c9878[_0x7a25('0x67')][_0x7a25('0xfb')],'data2':_0xa4567a},_0x4808b6));if(_0x543481[_0x7a25('0xea')]){_0x329ab4['push'](_[_0x7a25('0x5c')]({'channel':_0x16baa3,'type':'PAUSE','data1':_0x7a25('0xfc')},_0x4808b6));}});return db[_0x7a25('0xfd')][_0x7a25('0x8f')](_0x5854f9[_0x7a25('0xfe')](_0x329ab4),{'individualHooks':!![]});}})[_0x7a25('0x35')](function(){if(_0x543481){return _0x543481[_0x7a25('0x34')]({'online':!![],'lastLoginAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8')),'voicePause':_0x543481['loginInPause']||![],'mailPause':_0x543481[_0x7a25('0xea')]||![],'chatPause':_0x543481['loginInPause']||![],'faxPause':_0x543481[_0x7a25('0xea')]||![],'smsPause':_0x543481[_0x7a25('0xea')]||![],'openchannelPause':_0x543481[_0x7a25('0xea')]||![],'whatsappPause':_0x543481['loginInPause']||![],'pauseType':_0x543481[_0x7a25('0xea')]?_0x7a25('0xfc'):null,'interface':_0xa4567a,'lastPauseAt':moment()[_0x7a25('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0xe1210e){if(_0x5c9878[_0x7a25('0xff')]){return _0x446af1();}else{return BPromise[_0x7a25('0x100')](_0xe1210e)[_0x7a25('0x35')](respondWithResult(_0x434885,null));}})[_0x7a25('0x2a')](handleError(_0x434885,null));};exports[_0x7a25('0x101')]=function(_0x11ca10,_0x220ce4,_0x3ee677){var _0x4cccb4;return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0x11ca10[_0x7a25('0x66')]['id'],'role':_0x7a25('0x3c')},'attributes':['id',_0x7a25('0x47'),_0x7a25('0x37')]})[_0x7a25('0x35')](handleEntityNotFound(_0x220ce4,null))['then'](function(_0x91b611){if(_0x91b611){_0x4cccb4=_0x91b611;return db[_0x7a25('0xb7')][_0x7a25('0x44')]({'where':{'membername':_0x4cccb4[_0x7a25('0x47')]},'individualHooks':!![]});}})[_0x7a25('0x35')](function(){return db[_0x7a25('0xfd')][_0x7a25('0xb5')]({'where':{'membername':_0x4cccb4[_0x7a25('0x47')],'exitAt':null}});})[_0x7a25('0x35')](function(_0x5b9f99){var _0x2be54d=[];_0x5b9f99[_0x7a25('0xf7')](function(_0x15df65){_0x2be54d[_0x7a25('0x97')](_0x15df65[_0x7a25('0x34')]({'exitAt':moment()[_0x7a25('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2be54d);})[_0x7a25('0x35')](function(){return _0x4cccb4[_0x7a25('0x34')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x220ce4,null))[_0x7a25('0x2a')](handleError(_0x220ce4,null));};exports['pause']=function(_0x317e29,_0x376d9d,_0x559ab3){var _0xa41dee;return db['UserVoiceQueueRt'][_0x7a25('0x34')]({'paused':0x1},{'where':{'UserId':_0x317e29[_0x7a25('0x66')]['id']},'individualHooks':!![]})[_0x7a25('0x35')](function(){return db['User'][_0x7a25('0x68')]({'where':{'id':_0x317e29[_0x7a25('0x66')]['id'],'role':_0x7a25('0x3c')},'attributes':['id','name','role',_0x7a25('0x6d'),'interface']});})[_0x7a25('0x35')](handleEntityNotFound(_0x376d9d,null))[_0x7a25('0x35')](function(_0x500f00){if(_0x500f00){_0xa41dee=_0x500f00;return respondWithRpcPromise(_0x7a25('0x102'),_0x7a25('0x103'),{'id':_0xa41dee['id'],'name':_0xa41dee[_0x7a25('0x47')],'pause':!![]});}})[_0x7a25('0x35')](function(){if(_0xa41dee){return db['MemberReport']['findAll']({'where':{'membername':_0xa41dee[_0x7a25('0x47')],'type':'PAUSE','exitAt':null}});}})[_0x7a25('0x35')](function(_0x35f00f){if(_0x35f00f[_0x7a25('0x58')]){var _0x1a5e3a=moment()[_0x7a25('0xeb')](_0x7a25('0xf8'));for(var _0x593585=0x0,_0xc6a33e=_0x35f00f[_0x7a25('0x58')];_0x593585<_0xc6a33e;_0x593585++){_0x35f00f[_0x593585][_0x7a25('0x104')]({'exitAt':_0x1a5e3a});}}})['then'](function(){var _0x3873ea=[];var _0x33b094=utils['getChannels']();_0x33b094[_0x7a25('0xf7')](function(_0x4b41be){_0x3873ea[_0x7a25('0x97')]({'channel':_0x4b41be,'membername':_0xa41dee[_0x7a25('0x47')],'interface':_[_0x7a25('0x72')](_0xa41dee[_0x7a25('0xaa')])?util[_0x7a25('0xeb')]('SIP/%s',_0xa41dee[_0x7a25('0x47')]):_0xa41dee[_0x7a25('0xaa')],'type':_0x7a25('0x105'),'enterAt':moment()['format'](_0x7a25('0xf8')),'data1':_0x317e29[_0x7a25('0x67')][_0x7a25('0x4c')]||_0x7a25('0x106'),'role':_0xa41dee[_0x7a25('0x37')],'internal':_0xa41dee[_0x7a25('0x6d')]});});return db[_0x7a25('0xfd')][_0x7a25('0x8f')](_0x3873ea,{'individualHooks':!![]});})[_0x7a25('0x35')](function(){return _0xa41dee[_0x7a25('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x317e29[_0x7a25('0x67')][_0x7a25('0x4c')]||_0x7a25('0x106'),'lastPauseAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8'))});})[_0x7a25('0x35')](respondWithResult(_0x376d9d,null))[_0x7a25('0x2a')](handleError(_0x376d9d,null));};exports[_0x7a25('0x107')]=function(_0x22a042,_0x1f457a,_0x49d768){var _0x1d7e7c;return db[_0x7a25('0x4a')][_0x7a25('0x68')]({'where':{'id':_0x22a042[_0x7a25('0x66')]['id']},'attributes':['id',_0x7a25('0x47'),_0x7a25('0x37'),_0x7a25('0xa9'),_0x7a25('0x108'),_0x7a25('0x109'),_0x7a25('0x10a'),_0x7a25('0x10b'),'smsPause',_0x7a25('0x10c'),'pauseType',_0x7a25('0x10d')]})[_0x7a25('0x35')](handleEntityNotFound(_0x1f457a,null))[_0x7a25('0x35')](function(_0x52f79c){if(_0x52f79c){_0x1d7e7c=_0x52f79c;if(_0x22a042[_0x7a25('0x67')]['channel']&&!utils[_0x7a25('0xab')](_0x22a042['body']['channel'])){throw new db[(_0x7a25('0x9d'))][(_0x7a25('0x9b'))](_0x7a25('0xb9'));}switch(_0x22a042[_0x7a25('0x67')][_0x7a25('0xa7')]){case'voice':return respondWithRpcPromise(_0x7a25('0x102'),'unpause',{'id':_0x1d7e7c['id'],'name':_0x1d7e7c[_0x7a25('0x47')],'pause':![]})[_0x7a25('0x35')](function(){return db['UserVoiceQueueRt'][_0x7a25('0x34')]({'paused':0x0},{'where':{'UserId':_0x1d7e7c['id']},'individualHooks':!![]});})[_0x7a25('0x35')](function(){return db[_0x7a25('0xfd')]['find']({'where':{'channel':_0x22a042[_0x7a25('0x67')][_0x7a25('0xa7')],'membername':_0x1d7e7c['name'],'type':_0x7a25('0x105'),'exitAt':null}});})[_0x7a25('0x35')](function(_0x325c25){if(_0x325c25){return _0x325c25[_0x7a25('0x34')]({'exitAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8')),'data2':_0x7a25('0x10e')},{'individualHooks':!![]});}return null;})[_0x7a25('0x35')](function(){return _0x1d7e7c[_0x7a25('0x34')]({'voicePause':![]});});case _0x7a25('0x10f'):case _0x7a25('0x110'):case _0x7a25('0x111'):case'sms':case _0x7a25('0x112'):case _0x7a25('0x113'):return db['MemberReport'][_0x7a25('0x68')]({'where':{'channel':_0x22a042[_0x7a25('0x67')][_0x7a25('0xa7')],'membername':_0x1d7e7c[_0x7a25('0x47')],'type':_0x7a25('0x105'),'exitAt':null}})['then'](function(_0x309471){if(_0x309471){return _0x309471[_0x7a25('0x34')]({'exitAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8')),'data2':_0x7a25('0x10e')},{'individualHooks':!![]});}return null;})[_0x7a25('0x35')](function(){var _0x485e35={};_[_0x7a25('0x31')](_0x485e35,util[_0x7a25('0xeb')]('%s%s',_0x22a042['body'][_0x7a25('0xa7')],_0x7a25('0x114')),![]);return _0x1d7e7c[_0x7a25('0x34')](_0x485e35);});default:return respondWithRpcPromise(_0x7a25('0x102'),_0x7a25('0x107'),{'id':_0x1d7e7c['id'],'name':_0x1d7e7c['name'],'pause':![]})[_0x7a25('0x35')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x1d7e7c['id']}});})[_0x7a25('0x35')](function(){return db['MemberReport'][_0x7a25('0xb5')]({'where':{'membername':_0x1d7e7c[_0x7a25('0x47')],'type':_0x7a25('0x105'),'exitAt':null}});})[_0x7a25('0x35')](function(_0x4cd151){var _0x3a4c72=[];_0x4cd151[_0x7a25('0xf7')](function(_0x10f255){_0x3a4c72[_0x7a25('0x97')](_0x10f255[_0x7a25('0x34')]({'exitAt':moment()[_0x7a25('0xeb')](_0x7a25('0xf8')),'data2':_0x7a25('0x10e')}));});return BPromise[_0x7a25('0x93')](_0x3a4c72);})['then'](function(){return _0x1d7e7c[_0x7a25('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x7a25('0x35')](respondWithResult(_0x1f457a,null))[_0x7a25('0x2a')](handleError(_0x1f457a,null));};exports['getTeams']=function(_0x422262,_0x1d8926,_0x26cdea){var _0x2f7afe={};var _0x1b84e2={};var _0x33dcf6;var _0xb11e12;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x422262[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x1d8926,null))[_0x7a25('0x35')](function(_0x306b40){if(_0x306b40){_0x33dcf6=_0x306b40;_0x1b84e2['model']=_[_0x7a25('0x52')](db[_0x7a25('0x115')]['rawAttributes']);_0x1b84e2['query']=_['keys'](_0x422262[_0x7a25('0x51')]);_0x1b84e2[_0x7a25('0x53')]=_['intersection'](_0x1b84e2[_0x7a25('0x56')],_0x1b84e2[_0x7a25('0x51')]);_0x2f7afe[_0x7a25('0x55')]=_[_0x7a25('0x54')](_0x1b84e2[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x422262[_0x7a25('0x51')][_0x7a25('0x57')]));_0x2f7afe['attributes']=_0x2f7afe[_0x7a25('0x55')][_0x7a25('0x58')]?_0x2f7afe[_0x7a25('0x55')]:_0x1b84e2['model'];_0x2f7afe['order']=qs[_0x7a25('0x5a')](_0x422262[_0x7a25('0x51')][_0x7a25('0x5a')]);_0x2f7afe[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x422262['query'],_0x1b84e2['filters']));if(_0x422262[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x2f7afe[_0x7a25('0x5b')]=_[_0x7a25('0x5c')](_0x2f7afe[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x2f7afe[_0x7a25('0x55')],function(_0x5bead4){var _0x38cba3={};_0x38cba3[_0x5bead4]={'$like':'%'+_0x422262[_0x7a25('0x51')][_0x7a25('0x3f')]+'%'};return _0x38cba3;})});}_0x2f7afe=_[_0x7a25('0x5c')]({},_0x2f7afe,_0x422262[_0x7a25('0x61')]);return _0x33dcf6[_0x7a25('0x116')](_0x2f7afe);}})['then'](function(_0x32fa94){if(_0x32fa94){_0xb11e12=_0x32fa94[_0x7a25('0x58')];if(!_0x422262[_0x7a25('0x51')][_0x7a25('0x59')]('nolimit')){_0x2f7afe[_0x7a25('0x30')]=qs[_0x7a25('0x30')](_0x422262[_0x7a25('0x51')][_0x7a25('0x30')]);_0x2f7afe[_0x7a25('0x2f')]=qs[_0x7a25('0x2f')](_0x422262[_0x7a25('0x51')][_0x7a25('0x2f')]);}return _0x33dcf6['getTeams'](_0x2f7afe);}})[_0x7a25('0x35')](function(_0x5c73dd){if(_0x5c73dd){return _0x5c73dd?{'count':_0xb11e12,'rows':_0x5c73dd}:null;}})[_0x7a25('0x35')](respondWithResult(_0x1d8926,null))[_0x7a25('0x2a')](handleError(_0x1d8926,null));};exports[_0x7a25('0x117')]=function(_0x58d8aa,_0x53a474){return db['User'][_0x7a25('0x68')]({'where':{'id':_0x58d8aa[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x53a474,null))[_0x7a25('0x35')](function(_0x254572){if(_0x254572){var _0x3a361e=_0x254572[_0x7a25('0x36')]({'plain':!![]});return _0x254572['addTeams'](_0x58d8aa[_0x7a25('0x67')][_0x7a25('0x6b')],_[_0x7a25('0x6c')](_0x58d8aa[_0x7a25('0x67')],[_0x7a25('0x6b'),'id'])||{})[_0x7a25('0x35')](function(){for(var _0x2182a1=0x0;_0x2182a1<_0x58d8aa['body'][_0x7a25('0x6b')][_0x7a25('0x58')];_0x2182a1++){var _0x42e249=[];db[_0x7a25('0x115')]['findOne']({'where':{'id':_0x58d8aa[_0x7a25('0x67')]['ids'][_0x2182a1]}})['then'](function(_0x5bdb45){_0x42e249[_0x7a25('0x97')](_0x5bdb45[_0x7a25('0xf5')]()['then'](function(_0xbdea8){for(var _0xa3343c=0x0;_0xa3343c<_0xbdea8[_0x7a25('0x58')];_0xa3343c++){_0xbdea8[_0xa3343c][_0x7a25('0x118')](_0x7a25('0xa7'),_0x7a25('0x119'));}return _0xbdea8;}));_0x42e249[_0x7a25('0x97')](_0x5bdb45['getChatQueues']()[_0x7a25('0x35')](function(_0x59fbd1){for(var _0xc83476=0x0;_0xc83476<_0x59fbd1['length'];_0xc83476++){_0x59fbd1[_0xc83476][_0x7a25('0x118')](_0x7a25('0xa7'),_0x7a25('0x11a'));}return _0x59fbd1;}));_0x42e249[_0x7a25('0x97')](_0x5bdb45[_0x7a25('0x11b')]()[_0x7a25('0x35')](function(_0x413149){for(var _0x291ecc=0x0;_0x291ecc<_0x413149['length'];_0x291ecc++){_0x413149[_0x291ecc]['setDataValue']('channel',_0x7a25('0x11c'));}return _0x413149;}));_0x42e249[_0x7a25('0x97')](_0x5bdb45[_0x7a25('0x11d')]()[_0x7a25('0x35')](function(_0x50ecfd){for(var _0x2794bf=0x0;_0x2794bf<_0x50ecfd[_0x7a25('0x58')];_0x2794bf++){_0x50ecfd[_0x2794bf]['setDataValue'](_0x7a25('0xa7'),_0x7a25('0x11e'));}return _0x50ecfd;}));_0x42e249[_0x7a25('0x97')](_0x5bdb45[_0x7a25('0x11f')]()[_0x7a25('0x35')](function(_0x531cdd){for(var _0x176108=0x0;_0x176108<_0x531cdd[_0x7a25('0x58')];_0x176108++){_0x531cdd[_0x176108][_0x7a25('0x118')](_0x7a25('0xa7'),_0x7a25('0x120'));}return _0x531cdd;}));_0x42e249[_0x7a25('0x97')](_0x5bdb45[_0x7a25('0x121')]()[_0x7a25('0x35')](function(_0x238880){for(var _0xdd19b=0x0;_0xdd19b<_0x238880[_0x7a25('0x58')];_0xdd19b++){_0x238880[_0xdd19b][_0x7a25('0x118')](_0x7a25('0xa7'),'Fax');}return _0x238880;}));_0x42e249['push'](_0x5bdb45[_0x7a25('0x122')]()[_0x7a25('0x35')](function(_0x13f6d9){for(var _0x50b842=0x0;_0x50b842<_0x13f6d9['length'];_0x50b842++){_0x13f6d9[_0x50b842][_0x7a25('0x118')](_0x7a25('0xa7'),'Openchannel');}return _0x13f6d9;}));return BPromise[_0x7a25('0x93')](_0x42e249);})[_0x7a25('0x35')](function(_0x2aa3ab){var _0x10677e=_['flatten'](_0x2aa3ab);_0x42e249=[];return db[_0x7a25('0x5e')][_0x7a25('0x123')](function(_0x19ed06){for(var _0x4ff51f=0x0;_0x4ff51f<_0x10677e[_0x7a25('0x58')];_0x4ff51f++){_0x42e249[_0x7a25('0x97')](_0x10677e[_0x4ff51f]['addAgent'](_0x3a361e['id']),{'transaction':_0x19ed06});}return BPromise[_0x7a25('0x93')](_0x42e249)['then'](function(){if(_0x3a361e['online']){return BPromise[_0x7a25('0x94')](_[_0x7a25('0x3f')](_0x10677e,function(_0x4ed141){return _0x4ed141[_0x7a25('0x124')]('channel')===_0x7a25('0x119');}),function(_0x3bc153){return db[_0x7a25('0xb7')][_0x7a25('0xb8')]({'membername':_0x3a361e['name'],'UserId':_0x3a361e['id'],'queue_name':_0x3bc153[_0x7a25('0x47')],'VoiceQueueId':_0x3bc153['id'],'interface':_[_0x7a25('0x72')](_0x3a361e['interface'])?util['format'](_0x7a25('0xb6'),_0x3a361e[_0x7a25('0x47')]):_0x3a361e['interface'],'paused':_0x3a361e[_0x7a25('0xa9')]||![],'penalty':_0x3a361e[_0x7a25('0xae')]},{'transaction':_0x19ed06});});}else{return;}})[_0x7a25('0x35')](function(){for(var _0x42df3a=0x0;_0x42df3a<_0x10677e[_0x7a25('0x58')];_0x42df3a++){var _0x3f94ef=_0x10677e[_0x42df3a][_0x7a25('0x124')](_0x7a25('0xa7'));var _0xcd3bcb=_0x3f94ef+_0x7a25('0xb1');socket[_0x7a25('0xb2')](_0x7a25('0x3a')+_0x3f94ef+'Queue:save',{'UserId':_0x3a361e['id'],['queueField']:_0x10677e[_0x42df3a]['id']});}});});});}});}})[_0x7a25('0x35')](respondWithStatusCode(_0x53a474,null))[_0x7a25('0x2a')](handleError(_0x53a474,null));};exports[_0x7a25('0x125')]=function(_0x12458a,_0x29ad99){return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x12458a[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x29ad99,null))[_0x7a25('0x35')](function(_0x4bc6a2){if(_0x4bc6a2){var _0x2cc305=_0x4bc6a2[_0x7a25('0x36')]({'plain':!![]});var _0x569531=_0x12458a[_0x7a25('0x51')]['ids'];return _0x4bc6a2[_0x7a25('0x125')](_0x569531)[_0x7a25('0x35')](function(){for(var _0x506d0b=0x0;_0x506d0b<_0x569531['length'];_0x506d0b++){var _0x3609ab=[];db[_0x7a25('0x115')][_0x7a25('0xa1')]({'where':{'id':_0x569531[_0x506d0b]}})[_0x7a25('0x35')](function(_0x5c4ad8){_0x3609ab['push'](_0x5c4ad8['getVoiceQueues']()[_0x7a25('0x35')](function(_0x2c37c5){for(var _0x2a7c41=0x0;_0x2a7c41<_0x2c37c5['length'];_0x2a7c41++){_0x2c37c5[_0x2a7c41][_0x7a25('0x118')]('channel',_0x7a25('0x119'));}return _0x2c37c5;}));_0x3609ab['push'](_0x5c4ad8[_0x7a25('0x126')]()[_0x7a25('0x35')](function(_0x5e8d82){for(var _0x272e45=0x0;_0x272e45<_0x5e8d82[_0x7a25('0x58')];_0x272e45++){_0x5e8d82[_0x272e45][_0x7a25('0x118')](_0x7a25('0xa7'),_0x7a25('0x11a'));}return _0x5e8d82;}));_0x3609ab[_0x7a25('0x97')](_0x5c4ad8[_0x7a25('0x11b')]()['then'](function(_0x4552a){for(var _0x34c2b3=0x0;_0x34c2b3<_0x4552a[_0x7a25('0x58')];_0x34c2b3++){_0x4552a[_0x34c2b3]['setDataValue'](_0x7a25('0xa7'),_0x7a25('0x11c'));}return _0x4552a;}));_0x3609ab['push'](_0x5c4ad8[_0x7a25('0x11d')]()[_0x7a25('0x35')](function(_0x379d0e){for(var _0x3ab81d=0x0;_0x3ab81d<_0x379d0e[_0x7a25('0x58')];_0x3ab81d++){_0x379d0e[_0x3ab81d]['setDataValue'](_0x7a25('0xa7'),_0x7a25('0x11e'));}return _0x379d0e;}));_0x3609ab[_0x7a25('0x97')](_0x5c4ad8['getWhatsappQueues']()[_0x7a25('0x35')](function(_0x459542){for(var _0x50dd4b=0x0;_0x50dd4b<_0x459542[_0x7a25('0x58')];_0x50dd4b++){_0x459542[_0x50dd4b][_0x7a25('0x118')]('channel',_0x7a25('0x120'));}return _0x459542;}));_0x3609ab[_0x7a25('0x97')](_0x5c4ad8['getFaxQueues']()[_0x7a25('0x35')](function(_0x1d0aa7){for(var _0x340e3c=0x0;_0x340e3c<_0x1d0aa7[_0x7a25('0x58')];_0x340e3c++){_0x1d0aa7[_0x340e3c]['setDataValue']('channel',_0x7a25('0x127'));}return _0x1d0aa7;}));_0x3609ab[_0x7a25('0x97')](_0x5c4ad8['getOpenchannelQueues']()[_0x7a25('0x35')](function(_0x35e732){for(var _0x3f01a8=0x0;_0x3f01a8<_0x35e732[_0x7a25('0x58')];_0x3f01a8++){_0x35e732[_0x3f01a8][_0x7a25('0x118')](_0x7a25('0xa7'),_0x7a25('0x128'));}return _0x35e732;}));return BPromise[_0x7a25('0x93')](_0x3609ab);})[_0x7a25('0x35')](function(_0xe778ff){var _0x23bc29=_['flatten'](_0xe778ff);_0x3609ab=[];return db[_0x7a25('0x5e')][_0x7a25('0x123')](function(_0x1a2512){for(var _0x311b8d=0x0;_0x311b8d<_0x23bc29[_0x7a25('0x58')];_0x311b8d++){_0x3609ab[_0x7a25('0x97')](_0x23bc29[_0x311b8d][_0x7a25('0x129')](_0x2cc305['id']),{'transaction':_0x1a2512});}return BPromise[_0x7a25('0x93')](_0x3609ab)['then'](function(){if(_0x2cc305[_0x7a25('0xa8')]){return BPromise[_0x7a25('0x94')](_[_0x7a25('0x3f')](_0x23bc29,function(_0x663685){return _0x663685['getDataValue'](_0x7a25('0xa7'))===_0x7a25('0x119');}),function(_0x5ecf3c){return db[_0x7a25('0xb7')][_0x7a25('0x44')]({'where':{'VoiceQueueId':_0x5ecf3c['id'],'UserId':_0x2cc305['id']},'transaction':_0x1a2512});});}else{return;}})['then'](function(){for(var _0x153934=0x0;_0x153934<_0x23bc29[_0x7a25('0x58')];_0x153934++){var _0x1504e1=_0x23bc29[_0x153934]['getDataValue'](_0x7a25('0xa7'));var _0xe98bf3=_0x1504e1+'QueueId';socket[_0x7a25('0xb2')](_0x7a25('0x3a')+_0x1504e1+_0x7a25('0xbb'),{'UserId':_0x2cc305['id'],['queueField']:_0x23bc29[_0x153934]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x29ad99,null))['catch'](handleError(_0x29ad99,null));};exports['getLists']=function(_0x3a9569,_0x1e5d3e,_0x1605bd){var _0x34dd32={};var _0x340fa7={};var _0x5db3e3;var _0x2671e8;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x3a9569[_0x7a25('0x66')]['id']}})['then'](handleEntityNotFound(_0x1e5d3e,null))['then'](function(_0x47558f){if(_0x47558f){_0x5db3e3=_0x47558f;_0x340fa7[_0x7a25('0x56')]=_[_0x7a25('0x52')](db[_0x7a25('0xc9')][_0x7a25('0x4b')]);_0x340fa7[_0x7a25('0x51')]=_[_0x7a25('0x52')](_0x3a9569[_0x7a25('0x51')]);_0x340fa7['filters']=_[_0x7a25('0x54')](_0x340fa7[_0x7a25('0x56')],_0x340fa7[_0x7a25('0x51')]);_0x34dd32[_0x7a25('0x55')]=_['intersection'](_0x340fa7[_0x7a25('0x56')],qs[_0x7a25('0x57')](_0x3a9569[_0x7a25('0x51')]['fields']));_0x34dd32[_0x7a25('0x55')]=_0x34dd32[_0x7a25('0x55')]['length']?_0x34dd32[_0x7a25('0x55')]:_0x340fa7[_0x7a25('0x56')];_0x34dd32['order']=qs[_0x7a25('0x5a')](_0x3a9569[_0x7a25('0x51')]['sort']);_0x34dd32['where']=qs[_0x7a25('0x53')](_[_0x7a25('0xc8')](_0x3a9569[_0x7a25('0x51')],_0x340fa7[_0x7a25('0x53')]));if(_0x3a9569[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x34dd32[_0x7a25('0x5b')]=_['merge'](_0x34dd32[_0x7a25('0x5b')],{'$or':_['map'](_0x34dd32[_0x7a25('0x55')],function(_0x3203e7){var _0x5bd368={};_0x5bd368[_0x3203e7]={'$like':'%'+_0x3a9569['query'][_0x7a25('0x3f')]+'%'};return _0x5bd368;})});}_0x34dd32=_[_0x7a25('0x5c')]({},_0x34dd32,_0x3a9569[_0x7a25('0x61')]);return _0x5db3e3[_0x7a25('0x12a')](_0x34dd32);}})[_0x7a25('0x35')](function(_0x2e36b4){if(_0x2e36b4){_0x2671e8=_0x2e36b4[_0x7a25('0x58')];if(!_0x3a9569[_0x7a25('0x51')][_0x7a25('0x59')]('nolimit')){_0x34dd32[_0x7a25('0x30')]=qs['limit'](_0x3a9569['query'][_0x7a25('0x30')]);_0x34dd32['offset']=qs[_0x7a25('0x2f')](_0x3a9569[_0x7a25('0x51')]['offset']);}return _0x5db3e3[_0x7a25('0x12a')](_0x34dd32);}})['then'](function(_0x423b6d){if(_0x423b6d){return _0x423b6d?{'count':_0x2671e8,'rows':_0x423b6d}:null;}})['then'](respondWithResult(_0x1e5d3e,null))[_0x7a25('0x2a')](handleError(_0x1e5d3e,null));};exports[_0x7a25('0x12b')]=function(_0x2f4e8d,_0x2d5a54,_0x173652){var _0x3c8a={};var _0x5933c0={};var _0x441994;var _0xf4f8d3;return db[_0x7a25('0x4a')][_0x7a25('0xa1')]({'where':{'id':_0x2f4e8d[_0x7a25('0x66')]['id']}})[_0x7a25('0x35')](handleEntityNotFound(_0x2d5a54,null))[_0x7a25('0x35')](function(_0x22f3c8){if(_0x22f3c8){_0x441994=_0x22f3c8;_0x5933c0[_0x7a25('0x56')]=_[_0x7a25('0x52')](db['User'][_0x7a25('0x4b')]);_0x5933c0[_0x7a25('0x51')]=_['keys'](_0x2f4e8d[_0x7a25('0x51')]);_0x5933c0[_0x7a25('0x53')]=_[_0x7a25('0x54')](_0x5933c0[_0x7a25('0x56')],_0x5933c0['query']);_0x3c8a['attributes']=_[_0x7a25('0x54')](_0x5933c0[_0x7a25('0x56')],qs['fields'](_0x2f4e8d[_0x7a25('0x51')][_0x7a25('0x57')]));_0x3c8a[_0x7a25('0x55')]=_0x3c8a[_0x7a25('0x55')][_0x7a25('0x58')]?_0x3c8a[_0x7a25('0x55')]:_0x5933c0[_0x7a25('0x56')];_0x3c8a[_0x7a25('0xc7')]=qs[_0x7a25('0x5a')](_0x2f4e8d[_0x7a25('0x51')]['sort']);_0x3c8a[_0x7a25('0x5b')]=qs[_0x7a25('0x53')](_['pick'](_0x2f4e8d[_0x7a25('0x51')],_0x5933c0[_0x7a25('0x53')]));if(_0x2f4e8d[_0x7a25('0x51')][_0x7a25('0x3f')]){_0x3c8a[_0x7a25('0x5b')]=_['merge'](_0x3c8a[_0x7a25('0x5b')],{'$or':_[_0x7a25('0x40')](_0x3c8a['attributes'],function(_0x24f484){var _0xc601ac={};_0xc601ac[_0x24f484]={'$like':'%'+_0x2f4e8d['query']['filter']+'%'};return _0xc601ac;})});}_0x3c8a['model']=db[_0x7a25('0x4a')];_0x3c8a['as']=_0x7a25('0x3b');_0x3c8a=_['merge']({},_0x3c8a,_0x2f4e8d[_0x7a25('0x61')]);return _0x441994[_0x7a25('0xf5')]({'include':[_0x3c8a]});}})[_0x7a25('0x35')](function(_0x50a120){if(_0x50a120){var _0x599493={},_0x2b612d=[],_0x4c74bf=0x0;for(var _0x4a16c4=0x0;_0x4a16c4<_0x50a120[_0x7a25('0x58')];_0x4a16c4+=0x1){for(var _0x22cb44=0x0,_0x3946a2;_0x22cb44<_0x50a120[_0x4a16c4][_0x7a25('0x3b')]['length'];_0x22cb44+=0x1){_0x3946a2=_0x50a120[_0x4a16c4][_0x7a25('0x3b')][_0x22cb44][_0x7a25('0x36')]({'plain':!![]});_0x599493[_0x3946a2['id']]=_0x3946a2;}}_0x599493=_['values'](_0x599493);for(var _0x53155c=qs[_0x7a25('0x2f')](_0x2f4e8d[_0x7a25('0x51')]['offset']);_0x53155c<_0x599493['length']&&_0x2b612d['length']=_0x59ad06['agents']){throw new Error(_0x4367('0x51'));}})[_0x4367('0x12')](function(){if(_0x1a1966){return db[_0x4367('0x46')]['destroy']({'where':{'membername':_0x1a1966[_0x4367('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x1a1966){return _0x1a1966[_0x4367('0x52')]({'raw':!![]});}})[_0x4367('0x12')](function(_0x5ad945){if(_0x1a1966){if(_0x5ad945){var _0x5b3a6d=[];_0x41ec9a=_0x5ad945;if(_0x41ec9a[_0x4367('0x32')]){for(var _0x28686a=0x0;_0x28686a<_0x41ec9a[_0x4367('0x32')];_0x28686a++){_0x5b3a6d['push'](db['UserVoiceQueueRt'][_0x4367('0x53')]({'membername':_0x1a1966[_0x4367('0x28')],'UserId':_0x1a1966['id'],'queue_name':_0x41ec9a[_0x28686a][_0x4367('0x28')],'VoiceQueueId':_0x41ec9a[_0x28686a]['id'],'interface':_0x193ed6,'paused':_0x1a1966['loginInPause']||![],'penalty':_0x41ec9a[_0x28686a][_0x4367('0x54')]||0x0}));}return BPromise['all'](_0x5b3a6d);}}}})[_0x4367('0x12')](function(){if(_0x1a1966){return db[_0x4367('0x2d')]['findAll']({'where':{'membername':_0x1a1966[_0x4367('0x28')],'exitAt':null}});}})[_0x4367('0x12')](function(_0x3b76cc){if(_0x1a1966){if(_0x3b76cc&&_0x3b76cc[_0x4367('0x32')]){var _0x197cc3=[];_0x3b76cc['forEach'](function(_0x902f96){_0x197cc3[_0x4367('0x35')](_0x902f96[_0x4367('0x2c')]({'exitAt':moment()[_0x4367('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x197cc3);}}})[_0x4367('0x12')](function(_0x4a6823){if(_0x1a1966){var _0x12481b=[];var _0x9c9c45=[];var _0x54e35b=utils[_0x4367('0x33')]();var _0x53ee68={'membername':_0x1a1966[_0x4367('0x28')],'interface':_0x193ed6,'enterAt':moment()[_0x4367('0x30')](_0x4367('0x31')),'role':_0x1a1966[_0x4367('0x29')],'internal':_0x1a1966[_0x4367('0x2a')]};_0x54e35b[_0x4367('0x34')](function(_0x4d7842){_0x12481b[_0x4367('0x35')](_[_0x4367('0x55')]({'channel':_0x4d7842,'type':'LOGIN','data1':_0x4367('0x56'),'data2':_0x193ed6},_0x53ee68));if(_0x1a1966[_0x4367('0x57')]){_0x9c9c45[_0x4367('0x35')](_[_0x4367('0x55')]({'channel':_0x4d7842,'type':_0x4367('0x2f'),'data1':'LOGININPAUSE'},_0x53ee68));}});return db[_0x4367('0x2d')]['bulkCreate'](_0x12481b[_0x4367('0x58')](_0x9c9c45),{'individualHooks':!![]});}})[_0x4367('0x12')](function(){if(_0x1a1966){return _0x1a1966[_0x4367('0x2c')]({'online':!![],'lastLoginAt':moment()['format'](_0x4367('0x31')),'voicePause':_0x1a1966[_0x4367('0x57')]||![],'mailPause':_0x1a1966[_0x4367('0x57')]||![],'chatPause':_0x1a1966[_0x4367('0x57')]||![],'faxPause':_0x1a1966[_0x4367('0x57')]||![],'smsPause':_0x1a1966['loginInPause']||![],'openchannelPause':_0x1a1966[_0x4367('0x57')]||![],'pauseType':_0x1a1966[_0x4367('0x57')]?_0x4367('0x59'):null,'lastPauseAt':moment()['format'](_0x4367('0x31')),'interface':_0x193ed6});}})[_0x4367('0x12')](function(_0x1b1bcb){_0x305c1f(_0x1b1bcb);})[_0x4367('0x1a')](function(_0x1ac738){_0x503947(_0x507f09['error'](0x1f4,_0x1ac738[_0x4367('0x18')]));});});}; \ No newline at end of file +var _0x2965=['length','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','format','findOne','channel','isValidChannel','Unknown\x20channel','voice','system','mail','fax','UserVoiceQueueRt','all','LogoutUser','destroy','role','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','merge','LOGININPAUSE','concat','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetUser','findAll','options','attributes','limit','include','map','model','ShowUser','User','find','raw','where','name','internal','interface','update','MemberReport','PAUSE'];(function(_0x58cf2b,_0x4b3053){var _0x57bfa9=function(_0x3ef34f){while(--_0x3ef34f){_0x58cf2b['push'](_0x58cf2b['shift']());}};_0x57bfa9(++_0x4b3053);}(_0x2965,0x1e1));var _0x5296=function(_0x1fe869,_0x1ab87b){_0x1fe869=_0x1fe869-0x0;var _0x59449e=_0x2965[_0x1fe869];return _0x59449e;};'use strict';var _=require('lodash');var util=require(_0x5296('0x0'));var moment=require(_0x5296('0x1'));var BPromise=require(_0x5296('0x2'));var rs=require(_0x5296('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5296('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5296('0x5'))(_0x5296('0x6'));var config=require(_0x5296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5296('0x8')][_0x5296('0x9')]({'port':0x232a});config['redis']=_[_0x5296('0xa')](config[_0x5296('0xb')],{'host':_0x5296('0xc'),'port':0x18eb});var socket=require(_0x5296('0xd'))(new Redis(config[_0x5296('0xb')]));require(_0x5296('0xe'))[_0x5296('0xf')](socket);function respondWithRpcPromise(_0x541a5e,_0x7e2b13,_0x31fdd1){return new BPromise(function(_0x154514,_0x500024){return client[_0x5296('0x10')](_0x541a5e,_0x31fdd1)[_0x5296('0x11')](function(_0x3dce7a){logger[_0x5296('0x12')](_0x5296('0x13'),_0x7e2b13,'request\x20sent');logger[_0x5296('0x14')](_0x5296('0x15'),_0x7e2b13,_0x5296('0x16'),JSON[_0x5296('0x17')](_0x3dce7a));if(_0x3dce7a[_0x5296('0x18')]){if(_0x3dce7a['error'][_0x5296('0x19')]===0x1f4){logger[_0x5296('0x18')](_0x5296('0x13'),_0x7e2b13,_0x3dce7a[_0x5296('0x18')][_0x5296('0x1a')]);return _0x500024(_0x3dce7a['error']['message']);}logger[_0x5296('0x18')]('User,\x20%s,\x20%s',_0x7e2b13,_0x3dce7a['error'][_0x5296('0x1a')]);return _0x154514(_0x3dce7a[_0x5296('0x18')]['message']);}else{logger[_0x5296('0x12')](_0x5296('0x13'),_0x7e2b13,_0x5296('0x16'));_0x154514(_0x3dce7a['result'][_0x5296('0x1a')]);}})[_0x5296('0x1b')](function(_0x2727d8){logger['error'](_0x5296('0x13'),_0x7e2b13,_0x2727d8);_0x500024(_0x2727d8);});});}exports[_0x5296('0x1c')]=function(_0x48a0ea){var _0x3b8f88=this;return new Promise(function(_0x4a058e,_0x476b7f){return db['User'][_0x5296('0x1d')]({'raw':_0x48a0ea[_0x5296('0x1e')]?_0x48a0ea[_0x5296('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x48a0ea[_0x5296('0x1e')]?_0x48a0ea[_0x5296('0x1e')]['where']||null:null,'attributes':_0x48a0ea[_0x5296('0x1e')]?_0x48a0ea[_0x5296('0x1e')][_0x5296('0x1f')]||null:null,'limit':_0x48a0ea[_0x5296('0x1e')]?_0x48a0ea[_0x5296('0x1e')][_0x5296('0x20')]||null:null,'include':_0x48a0ea[_0x5296('0x1e')]?_0x48a0ea[_0x5296('0x1e')][_0x5296('0x21')]?_[_0x5296('0x22')](_0x48a0ea['options'][_0x5296('0x21')],function(_0x561e70){return{'model':db[_0x561e70[_0x5296('0x23')]],'as':_0x561e70['as'],'attributes':_0x561e70['attributes'],'include':_0x561e70[_0x5296('0x21')]?_['map'](_0x561e70[_0x5296('0x21')],function(_0x4dc96d){return{'model':db[_0x4dc96d['model']],'as':_0x4dc96d['as'],'attributes':_0x4dc96d[_0x5296('0x1f')],'include':_0x4dc96d[_0x5296('0x21')]?_[_0x5296('0x22')](_0x4dc96d[_0x5296('0x21')],function(_0xdac170){return{'model':db[_0xdac170['model']],'as':_0xdac170['as'],'attributes':_0xdac170['attributes']};}):[]};}):[]};}):[]:[]})[_0x5296('0x11')](function(_0x53fb32){logger['info'](_0x5296('0x1c'),_0x48a0ea);logger['debug'](_0x5296('0x1c'),_0x48a0ea,JSON[_0x5296('0x17')](_0x53fb32));_0x4a058e(_0x53fb32);})[_0x5296('0x1b')](function(_0x4a5a89){logger[_0x5296('0x18')](_0x5296('0x1c'),_0x4a5a89[_0x5296('0x1a')],_0x48a0ea);_0x476b7f(_0x3b8f88[_0x5296('0x18')](0x1f4,_0x4a5a89[_0x5296('0x1a')]));});});};exports[_0x5296('0x24')]=function(_0x3bc316){var _0x435dbd=this;return new Promise(function(_0x7f67e,_0x2acfa3){return db[_0x5296('0x25')][_0x5296('0x26')]({'raw':_0x3bc316['options']?_0x3bc316[_0x5296('0x1e')][_0x5296('0x27')]===undefined?!![]:![]:!![],'where':_0x3bc316[_0x5296('0x1e')]?_0x3bc316[_0x5296('0x1e')][_0x5296('0x28')]||null:null,'attributes':_0x3bc316['options']?_0x3bc316[_0x5296('0x1e')]['attributes']||null:null,'include':_0x3bc316[_0x5296('0x1e')]?_0x3bc316[_0x5296('0x1e')][_0x5296('0x21')]?_[_0x5296('0x22')](_0x3bc316[_0x5296('0x1e')][_0x5296('0x21')],function(_0x4589b8){return{'model':db[_0x4589b8[_0x5296('0x23')]],'as':_0x4589b8['as'],'attributes':_0x4589b8[_0x5296('0x1f')],'include':_0x4589b8[_0x5296('0x21')]?_[_0x5296('0x22')](_0x4589b8['include'],function(_0x29186e){return{'model':db[_0x29186e[_0x5296('0x23')]],'as':_0x29186e['as'],'attributes':_0x29186e['attributes'],'include':_0x29186e['include']?_['map'](_0x29186e[_0x5296('0x21')],function(_0x2ed8d5){return{'model':db[_0x2ed8d5[_0x5296('0x23')]],'as':_0x2ed8d5['as'],'attributes':_0x2ed8d5[_0x5296('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5296('0x11')](function(_0x31715b){logger[_0x5296('0x12')]('ShowUser',_0x3bc316);logger['debug'](_0x5296('0x24'),_0x3bc316,JSON['stringify'](_0x31715b));_0x7f67e(_0x31715b);})[_0x5296('0x1b')](function(_0x48a362){logger[_0x5296('0x18')](_0x5296('0x24'),_0x48a362['message'],_0x3bc316);_0x2acfa3(_0x435dbd[_0x5296('0x18')](0x1f4,_0x48a362[_0x5296('0x1a')]));});});};exports['PauseUser']=function(_0x2e53cb){var _0x392ebc=this;return new Promise(function(_0x666690,_0x1e5acf){var _0x3bef27;return db['User'][_0x5296('0x26')]({'where':_0x2e53cb[_0x5296('0x1e')][_0x5296('0x28')]||{},'attributes':['id',_0x5296('0x29'),'role',_0x5296('0x2a'),_0x5296('0x2b')]})[_0x5296('0x11')](function(_0x4ccf23){if(_0x4ccf23){_0x3bef27=_0x4ccf23;return db['UserVoiceQueueRt'][_0x5296('0x2c')]({'paused':0x1},{'where':{'UserId':_0x3bef27['id']},'individualHooks':!![]});}})[_0x5296('0x11')](function(){if(_0x3bef27){return db[_0x5296('0x2d')][_0x5296('0x1d')]({'where':{'membername':_0x3bef27[_0x5296('0x29')],'type':_0x5296('0x2e'),'exitAt':null}});}})['then'](function(_0x4b7559){if(_0x3bef27){if(_0x4b7559&&_0x4b7559[_0x5296('0x2f')]){var _0x3e1f18=moment()['format'](_0x5296('0x30'));for(var _0x40f607=0x0,_0x410ca0=_0x4b7559[_0x5296('0x2f')];_0x40f607<_0x410ca0;_0x40f607++){_0x4b7559[_0x40f607]['updateAttributes']({'exitAt':_0x3e1f18});}}}})[_0x5296('0x11')](function(){if(_0x3bef27){var _0x652985=[];var _0x39d093=utils[_0x5296('0x31')]();_0x39d093[_0x5296('0x32')](function(_0x51d86a){_0x652985[_0x5296('0x33')]({'channel':_0x51d86a,'membername':_0x3bef27[_0x5296('0x29')],'interface':_[_0x5296('0x34')](_0x3bef27[_0x5296('0x2b')])?util['format'](_0x5296('0x35'),_0x3bef27[_0x5296('0x29')]):_0x3bef27[_0x5296('0x2b')],'type':_0x5296('0x2e'),'enterAt':moment()['format'](_0x5296('0x30')),'data1':_0x2e53cb[_0x5296('0x36')][_0x5296('0x37')]||_0x5296('0x38'),'role':_0x3bef27['role'],'internal':_0x3bef27[_0x5296('0x2a')],'uniqueid':_0x2e53cb[_0x5296('0x36')][_0x5296('0x39')]||null});});return db['MemberReport'][_0x5296('0x3a')](_0x652985,{'individualHooks':!![]});}})[_0x5296('0x11')](function(){if(_0x3bef27){return _0x3bef27['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x2e53cb[_0x5296('0x36')][_0x5296('0x37')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x5296('0x3b')](_0x5296('0x30'))});}})[_0x5296('0x11')](function(_0x3d0861){_0x666690(_0x3d0861);})[_0x5296('0x1b')](function(_0x495b59){_0x1e5acf(_0x392ebc[_0x5296('0x18')](0x1f4,_0x495b59[_0x5296('0x1a')]));});});};exports['UnpauseUser']=function(_0x56eb09){var _0x45f03b=this;return new Promise(function(_0x21ed79,_0xa9fd5f){var _0x5eaf2b;return db[_0x5296('0x25')][_0x5296('0x3c')]({'where':_0x56eb09[_0x5296('0x1e')][_0x5296('0x28')]||{},'attributes':['id',_0x5296('0x29')]})[_0x5296('0x11')](function(_0x210425){if(_0x210425){_0x5eaf2b=_0x210425;if(_0x56eb09[_0x5296('0x36')][_0x5296('0x3d')]&&!utils[_0x5296('0x3e')](_0x56eb09['body'][_0x5296('0x3d')])){throw new Error(_0x5296('0x3f'));}switch(_0x56eb09[_0x5296('0x36')]['channel']){case _0x5296('0x40'):return db['UserVoiceQueueRt'][_0x5296('0x2c')]({'paused':0x0},{'where':{'UserId':_0x5eaf2b['id']}})[_0x5296('0x11')](function(){return db['MemberReport']['find']({'where':{'channel':_0x56eb09[_0x5296('0x36')]['channel'],'membername':_0x5eaf2b['name'],'type':_0x5296('0x2e'),'exitAt':null}});})[_0x5296('0x11')](function(_0x14db9d){if(_0x14db9d){return _0x14db9d[_0x5296('0x2c')]({'exitAt':moment()['format'](_0x5296('0x30')),'data2':_0x5296('0x41')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x5eaf2b[_0x5296('0x2c')]({'voicePause':![]});});case _0x5296('0x42'):case'chat':case _0x5296('0x43'):case'sms':case'openchannel':return db['MemberReport'][_0x5296('0x26')]({'where':{'channel':_0x56eb09['body']['channel'],'membername':_0x5eaf2b[_0x5296('0x29')],'type':_0x5296('0x2e'),'exitAt':null}})[_0x5296('0x11')](function(_0xc2829b){return _0xc2829b[_0x5296('0x2c')]({'exitAt':moment()[_0x5296('0x3b')](_0x5296('0x30')),'data2':_0x5296('0x41')},{'individualHooks':!![]});})[_0x5296('0x11')](function(){var _0x3f0487={};_['set'](_0x3f0487,util[_0x5296('0x3b')]('%s%s',_0x56eb09[_0x5296('0x36')][_0x5296('0x3d')],'Pause'),![]);return _0x5eaf2b[_0x5296('0x2c')](_0x3f0487);});default:return db[_0x5296('0x44')][_0x5296('0x2c')]({'paused':0x0},{'where':{'UserId':_0x5eaf2b['id']}})['then'](function(){return db[_0x5296('0x2d')]['findAll']({'where':{'membername':_0x5eaf2b['name'],'type':_0x5296('0x2e'),'exitAt':null}});})['then'](function(_0x4ca132){var _0x59cebe=[];_0x4ca132['forEach'](function(_0x4ac88c){_0x59cebe['push'](_0x4ac88c[_0x5296('0x2c')]({'exitAt':moment()[_0x5296('0x3b')](_0x5296('0x30')),'data2':_0x5296('0x41')}));});return BPromise[_0x5296('0x45')](_0x59cebe);})[_0x5296('0x11')](function(){return _0x5eaf2b['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x5296('0x11')](function(_0x4d94a6){_0x21ed79(_0x4d94a6);})['catch'](function(_0x34c471){_0xa9fd5f(_0x45f03b[_0x5296('0x18')](0x1f4,_0x34c471[_0x5296('0x1a')]));});});};exports[_0x5296('0x46')]=function(_0x2e60db){var _0x1f93b2=this;return new Promise(function(_0x5f586b,_0xcf2187){var _0x1e37c9;return db[_0x5296('0x25')][_0x5296('0x3c')]({'where':_0x2e60db[_0x5296('0x1e')][_0x5296('0x28')]||{},'attributes':['id','name']})[_0x5296('0x11')](function(_0x3005dc){if(_0x3005dc){_0x1e37c9=_0x3005dc;return db[_0x5296('0x44')][_0x5296('0x47')]({'where':{'membername':_0x1e37c9[_0x5296('0x29')]},'individualHooks':!![]});}})[_0x5296('0x11')](function(){if(_0x1e37c9){return db[_0x5296('0x2d')][_0x5296('0x1d')]({'where':{'membername':_0x1e37c9['name'],'exitAt':null}});}})['then'](function(_0x16091b){if(_0x1e37c9){if(_0x16091b&&_0x16091b['length']){var _0x577d01=[];_0x16091b[_0x5296('0x32')](function(_0x4ee8f4){_0x577d01[_0x5296('0x33')](_0x4ee8f4[_0x5296('0x2c')]({'exitAt':moment()[_0x5296('0x3b')](_0x5296('0x30'))}));});return BPromise[_0x5296('0x45')](_0x577d01);}}})['then'](function(){if(_0x1e37c9){return _0x1e37c9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x14f537){_0x5f586b(_0x14f537);})['catch'](function(_0x464023){_0xcf2187(_0x1f93b2[_0x5296('0x18')](0x1f4,_0x464023['message']));});});};exports['LoginUser']=function(_0x5e25df){var _0x293e58=this;return new Promise(function(_0x3e6b98,_0x1f2722){var _0x2d1a44;var _0x441cc4;var _0x3fa6fb;var _0x2d4595;return db['User'][_0x5296('0x3c')]({'where':_0x5e25df['options'][_0x5296('0x28')]||{},'attributes':['id',_0x5296('0x29'),_0x5296('0x48'),_0x5296('0x49'),_0x5296('0x4a'),_0x5296('0x2a'),_0x5296('0x4b'),_0x5296('0x2b')]})[_0x5296('0x11')](function(_0x13fc55){if(_0x13fc55){_0x2d1a44=_0x13fc55;_0x2d4595=_0x5e25df[_0x5296('0x36')]['interface']?_0x5e25df[_0x5296('0x36')][_0x5296('0x2b')]:util[_0x5296('0x3b')](_0x5296('0x35'),_0x2d1a44['name']);return db[_0x5296('0x25')][_0x5296('0x4c')]({'where':{'role':_0x5296('0x4d'),'online':!![],'id':{'$ne':_0x2d1a44['id']}}});}})[_0x5296('0x11')](function(_0x2c9981){if(_0x2c9981){_0x3fa6fb=_0x2c9981;return require(_0x5296('0x4e'))[_0x5296('0x4f')]();}})['then'](function(_0x1f87bb){if(_0x1f87bb&&_0x1f87bb[_0x5296('0x50')]&&_0x3fa6fb>=_0x1f87bb[_0x5296('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5296('0x11')](function(){if(_0x2d1a44){return db[_0x5296('0x44')][_0x5296('0x47')]({'where':{'membername':_0x2d1a44['name']},'individualHooks':!![]});}})[_0x5296('0x11')](function(){if(_0x2d1a44){return _0x2d1a44[_0x5296('0x51')]({'raw':!![]});}})[_0x5296('0x11')](function(_0x537829){if(_0x2d1a44){if(_0x537829){var _0x1cb1ca=[];_0x441cc4=_0x537829;if(_0x441cc4[_0x5296('0x2f')]){for(var _0x3159bf=0x0;_0x3159bf<_0x441cc4['length'];_0x3159bf++){_0x1cb1ca[_0x5296('0x33')](db[_0x5296('0x44')][_0x5296('0x52')]({'membername':_0x2d1a44[_0x5296('0x29')],'UserId':_0x2d1a44['id'],'queue_name':_0x441cc4[_0x3159bf][_0x5296('0x29')],'VoiceQueueId':_0x441cc4[_0x3159bf]['id'],'interface':_0x2d4595,'paused':_0x2d1a44[_0x5296('0x4b')]||![],'penalty':_0x441cc4[_0x3159bf][_0x5296('0x53')]||0x0}));}return BPromise[_0x5296('0x45')](_0x1cb1ca);}}}})['then'](function(){if(_0x2d1a44){return db['MemberReport'][_0x5296('0x1d')]({'where':{'membername':_0x2d1a44[_0x5296('0x29')],'exitAt':null}});}})[_0x5296('0x11')](function(_0x366e64){if(_0x2d1a44){if(_0x366e64&&_0x366e64[_0x5296('0x2f')]){var _0x3e2d31=[];_0x366e64['forEach'](function(_0x5a4320){_0x3e2d31[_0x5296('0x33')](_0x5a4320[_0x5296('0x2c')]({'exitAt':moment()[_0x5296('0x3b')](_0x5296('0x30'))}));});return BPromise[_0x5296('0x45')](_0x3e2d31);}}})['then'](function(_0x104851){if(_0x2d1a44){var _0x593886=[];var _0x1ee06a=[];var _0x4dd62e=utils['getChannels']();var _0x163550={'membername':_0x2d1a44['name'],'interface':_0x2d4595,'enterAt':moment()[_0x5296('0x3b')](_0x5296('0x30')),'role':_0x2d1a44[_0x5296('0x48')],'internal':_0x2d1a44['internal']};_0x4dd62e[_0x5296('0x32')](function(_0x27eb17){_0x593886[_0x5296('0x33')](_['merge']({'channel':_0x27eb17,'type':_0x5296('0x54'),'data1':'callysquare','data2':_0x2d4595},_0x163550));if(_0x2d1a44[_0x5296('0x4b')]){_0x1ee06a[_0x5296('0x33')](_[_0x5296('0x55')]({'channel':_0x27eb17,'type':_0x5296('0x2e'),'data1':_0x5296('0x56')},_0x163550));}});return db['MemberReport'][_0x5296('0x3a')](_0x593886[_0x5296('0x57')](_0x1ee06a),{'individualHooks':!![]});}})[_0x5296('0x11')](function(){if(_0x2d1a44){return _0x2d1a44[_0x5296('0x2c')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2d1a44[_0x5296('0x4b')]||![],'mailPause':_0x2d1a44['loginInPause']||![],'chatPause':_0x2d1a44[_0x5296('0x4b')]||![],'faxPause':_0x2d1a44[_0x5296('0x4b')]||![],'smsPause':_0x2d1a44[_0x5296('0x4b')]||![],'openchannelPause':_0x2d1a44[_0x5296('0x4b')]||![],'pauseType':_0x2d1a44[_0x5296('0x4b')]?_0x5296('0x56'):null,'lastPauseAt':moment()[_0x5296('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2d4595});}})[_0x5296('0x11')](function(_0xe42080){_0x3e6b98(_0xe42080);})[_0x5296('0x1b')](function(_0x4c245e){_0x1f2722(_0x293e58['error'](0x1f4,_0x4c245e[_0x5296('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 217964b..f5d5c84 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 _0x14ce=['user:','./user.events','emit','removeListener','length'];(function(_0x50718e,_0x34360c){var _0x12d94a=function(_0x353e7f){while(--_0x353e7f){_0x50718e['push'](_0x50718e['shift']());}};_0x12d94a(++_0x34360c);}(_0x14ce,0xfb));var _0xe14c=function(_0x3ea089,_0x1e74e2){_0x3ea089=_0x3ea089-0x0;var _0x37b80b=_0x14ce[_0x3ea089];return _0x37b80b;};'use strict';var UserEvents=require(_0xe14c('0x0'));var events=['save','remove','update'];function createListener(_0x5b0077,_0x36f4fa){return function(_0x13818c){_0x36f4fa[_0xe14c('0x1')](_0x5b0077,_0x13818c);};}function removeListener(_0x55123e,_0x3ba4aa){return function(){UserEvents[_0xe14c('0x2')](_0x55123e,_0x3ba4aa);};}exports['register']=function(_0x1726de){for(var _0x23dc50=0x0,_0x552a4a=events[_0xe14c('0x3')];_0x23dc50<_0x552a4a;_0x23dc50++){var _0x591b7b=events[_0x23dc50];var _0x1fb703=createListener(_0xe14c('0x4')+_0x591b7b,_0x1726de);UserEvents['on'](_0x591b7b,_0x1fb703);}}; \ No newline at end of file +var _0x6f17=['length','user:','./user.events','save','remove','removeListener','register'];(function(_0x108189,_0x215861){var _0x42f9af=function(_0x328861){while(--_0x328861){_0x108189['push'](_0x108189['shift']());}};_0x42f9af(++_0x215861);}(_0x6f17,0x95));var _0x76f1=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x6f17[_0x4ae6ef];return _0x3cbb4e;};'use strict';var UserEvents=require(_0x76f1('0x0'));var events=[_0x76f1('0x1'),_0x76f1('0x2'),'update'];function createListener(_0x4a0501,_0x27f078){return function(_0x5719ae){_0x27f078['emit'](_0x4a0501,_0x5719ae);};}function removeListener(_0x2a5041,_0x4e54e2){return function(){UserEvents[_0x76f1('0x3')](_0x2a5041,_0x4e54e2);};}exports[_0x76f1('0x4')]=function(_0x2f28f2){for(var _0x1d5218=0x0,_0x251ff7=events[_0x76f1('0x5')];_0x1d5218<_0x251ff7;_0x1d5218++){var _0x1943bd=events[_0x1d5218];var _0x25f49c=createListener(_0x76f1('0x6')+_0x1943bd,_0x2f28f2);UserEvents['on'](_0x1943bd,_0x25f49c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index ea0cf6e..5492bbd 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 _0x0256=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x3e2c85,_0x35ee64){var _0x1d59c2=function(_0x50f37d){while(--_0x50f37d){_0x3e2c85['push'](_0x3e2c85['shift']());}};_0x1d59c2(++_0x35ee64);}(_0x0256,0xc5));var _0x6025=function(_0x4fed70,_0x1d629b){_0x4fed70=_0x4fed70-0x0;var _0x2da450=_0x0256[_0x4fed70];return _0x2da450;};'use strict';var multer=require(_0x6025('0x0'));var util=require('util');var path=require(_0x6025('0x1'));var timeout=require('connect-timeout');var express=require(_0x6025('0x2'));var router=express[_0x6025('0x3')]();var auth=require(_0x6025('0x4'));var interaction=require(_0x6025('0x5'));var config=require(_0x6025('0x6'));module[_0x6025('0x7')]=router; \ No newline at end of file +var _0x9f45=['../../config/environment','exports','multer','util','express','Router'];(function(_0x481eb4,_0x4cf4c6){var _0x2b1bf2=function(_0x2f192f){while(--_0x2f192f){_0x481eb4['push'](_0x481eb4['shift']());}};_0x2b1bf2(++_0x4cf4c6);}(_0x9f45,0x92));var _0x59f4=function(_0x1ba88e,_0x1ac96c){_0x1ba88e=_0x1ba88e-0x0;var _0x45fd72=_0x9f45[_0x1ba88e];return _0x45fd72;};'use strict';var multer=require(_0x59f4('0x0'));var util=require(_0x59f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x59f4('0x2'));var router=express[_0x59f4('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59f4('0x4'));module[_0x59f4('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 3e415b7..779b8c9 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 _0xb10b=['sequelize','INTEGER'];(function(_0x3ddd09,_0x143d3e){var _0x3b7048=function(_0x59d16d){while(--_0x59d16d){_0x3ddd09['push'](_0x3ddd09['shift']());}};_0x3b7048(++_0x143d3e);}(_0xb10b,0x12a));var _0xbb10=function(_0x132889,_0x2207a8){_0x132889=_0x132889-0x0;var _0xd93752=_0xb10b[_0x132889];return _0xd93752;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['sequelize','INTEGER'];(function(_0x12cfbb,_0x47dc6a){var _0x337a69=function(_0x8b5f1f){while(--_0x8b5f1f){_0x12cfbb['push'](_0x12cfbb['shift']());}};_0x337a69(++_0x47dc6a);}(_0xb10b,0x12a));var _0xbb10=function(_0x38ae35,_0x16c078){_0x38ae35=_0x38ae35-0x0;var _0x4b3e8f=_0xb10b[_0x38ae35];return _0x4b3e8f;};'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 6cde978..2b87ee7 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 _0x2764=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger'];(function(_0x23071e,_0x4df73d){var _0x397837=function(_0x3a1e44){while(--_0x3a1e44){_0x23071e['push'](_0x23071e['shift']());}};_0x397837(++_0x4df73d);}(_0x2764,0x13f));var _0x4276=function(_0x4256c3,_0xf2c096){_0x4256c3=_0x4256c3-0x0;var _0x168da9=_0x2764[_0x4256c3];return _0x168da9;};'use strict';var _=require(_0x4276('0x0'));var util=require(_0x4276('0x1'));var logger=require(_0x4276('0x2'))(_0x4276('0x3'));var moment=require(_0x4276('0x4'));var BPromise=require(_0x4276('0x5'));var rp=require(_0x4276('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4276('0x7'));var config=require(_0x4276('0x8'));var attributes=require(_0x4276('0x9'));module[_0x4276('0xa')]=function(_0x19cd50,_0x530494){return _0x19cd50[_0x4276('0xb')](_0x4276('0xc'),attributes,{'tableName':_0x4276('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60e7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue','user_has_chat_queues','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x60e7,0xef));var _0x760e=function(_0x2c29e0,_0x4debb1){_0x2c29e0=_0x2c29e0-0x0;var _0x53336d=_0x60e7[_0x2c29e0];return _0x53336d;};'use strict';var _=require('lodash');var util=require(_0x760e('0x0'));var logger=require(_0x760e('0x1'))(_0x760e('0x2'));var moment=require(_0x760e('0x3'));var BPromise=require(_0x760e('0x4'));var rp=require(_0x760e('0x5'));var fs=require('fs');var path=require(_0x760e('0x6'));var rimraf=require(_0x760e('0x7'));var config=require(_0x760e('0x8'));var attributes=require(_0x760e('0x9'));module['exports']=function(_0x273cc9,_0x10d3b3){return _0x273cc9['define'](_0x760e('0xa'),attributes,{'tableName':_0x760e('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 38812b7..72271e6 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 _0x75b8=['error','code','message','UserChatQueue,\x20%s,\x20%s','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcb52b3,_0x1dbfdd){var _0x521f58=function(_0xf2a43c){while(--_0xf2a43c){_0xcb52b3['push'](_0xcb52b3['shift']());}};_0x521f58(++_0x1dbfdd);}(_0x75b8,0x1e5));var _0x875b=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x75b8[_0x5712f8];return _0x14a364;};'use strict';var _=require('lodash');var util=require(_0x875b('0x0'));var moment=require(_0x875b('0x1'));var BPromise=require(_0x875b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x875b('0x3'));var db=require(_0x875b('0x4'))['db'];var utils=require(_0x875b('0x5'));var logger=require(_0x875b('0x6'))(_0x875b('0x7'));var config=require(_0x875b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x875b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c058d,_0x31e2d8,_0x14cfa0){return new BPromise(function(_0x4ed419,_0x4026ce){return client['request'](_0x5c058d,_0x14cfa0)[_0x875b('0xa')](function(_0x316ff6){logger[_0x875b('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x31e2d8,_0x875b('0xc'));logger['debug'](_0x875b('0xd'),_0x31e2d8,_0x875b('0xc'),JSON[_0x875b('0xe')](_0x316ff6));if(_0x316ff6[_0x875b('0xf')]){if(_0x316ff6[_0x875b('0xf')][_0x875b('0x10')]===0x1f4){logger[_0x875b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x31e2d8,_0x316ff6[_0x875b('0xf')][_0x875b('0x11')]);return _0x4026ce(_0x316ff6[_0x875b('0xf')][_0x875b('0x11')]);}logger[_0x875b('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x31e2d8,_0x316ff6[_0x875b('0xf')][_0x875b('0x11')]);return _0x4ed419(_0x316ff6[_0x875b('0xf')]['message']);}else{logger['info'](_0x875b('0x12'),_0x31e2d8,_0x875b('0xc'));_0x4ed419(_0x316ff6['result'][_0x875b('0x11')]);}})[_0x875b('0x13')](function(_0xa03e40){logger[_0x875b('0xf')](_0x875b('0x12'),_0x31e2d8,_0xa03e40);_0x4026ce(_0xa03e40);});});} \ No newline at end of file +var _0xedc1=['client','http','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedc1,0x115));var _0x1edc=function(_0x5d5979,_0x3b4921){_0x5d5979=_0x5d5979-0x0;var _0x237182=_0xedc1[_0x5d5979];return _0x237182;};'use strict';var _=require('lodash');var util=require(_0x1edc('0x0'));var moment=require(_0x1edc('0x1'));var BPromise=require(_0x1edc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1edc('0x3'))['db'];var utils=require(_0x1edc('0x4'));var logger=require(_0x1edc('0x5'))(_0x1edc('0x6'));var config=require(_0x1edc('0x7'));var jayson=require(_0x1edc('0x8'));var client=jayson[_0x1edc('0x9')][_0x1edc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5892b7,_0x531ee9,_0x1654c6){return new BPromise(function(_0xdddf03,_0x9f0f2f){return client['request'](_0x5892b7,_0x1654c6)[_0x1edc('0xb')](function(_0x44ac8d){logger[_0x1edc('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x531ee9,'request\x20sent');logger[_0x1edc('0xd')](_0x1edc('0xe'),_0x531ee9,_0x1edc('0xf'),JSON[_0x1edc('0x10')](_0x44ac8d));if(_0x44ac8d[_0x1edc('0x11')]){if(_0x44ac8d[_0x1edc('0x11')]['code']===0x1f4){logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);return _0x9f0f2f(_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);}logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);return _0xdddf03(_0x44ac8d[_0x1edc('0x11')][_0x1edc('0x13')]);}else{logger[_0x1edc('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x531ee9,'request\x20sent');_0xdddf03(_0x44ac8d[_0x1edc('0x14')][_0x1edc('0x13')]);}})[_0x1edc('0x15')](function(_0x320527){logger[_0x1edc('0x11')](_0x1edc('0x12'),_0x531ee9,_0x320527);_0x9f0f2f(_0x320527);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c27ac32..19015f3 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 _0x48ce=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0x48ce,0xb4));var _0xe48c=function(_0x5d45a6,_0x42a8a3){_0x5d45a6=_0x5d45a6-0x0;var _0xa8e02c=_0x48ce[_0x5d45a6];return _0xa8e02c;};'use strict';var multer=require(_0xe48c('0x0'));var util=require(_0xe48c('0x1'));var path=require(_0xe48c('0x2'));var timeout=require(_0xe48c('0x3'));var express=require(_0xe48c('0x4'));var router=express[_0xe48c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe48c('0x6'));var config=require(_0xe48c('0x7'));module[_0xe48c('0x8')]=router; \ No newline at end of file +var _0x0995=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x0995,0xaf));var _0x5099=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0995[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5099('0x0'));var util=require(_0x5099('0x1'));var path=require(_0x5099('0x2'));var timeout=require(_0x5099('0x3'));var express=require(_0x5099('0x4'));var router=express[_0x5099('0x5')]();var auth=require(_0x5099('0x6'));var interaction=require(_0x5099('0x7'));var config=require(_0x5099('0x8'));module[_0x5099('0x9')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 4d73e8d..6c06bce 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 _0x8f4c=['exports','INTEGER','STRING','sequelize'];(function(_0x4717,_0x4a531d){var _0x4287d4=function(_0x30ff87){while(--_0x30ff87){_0x4717['push'](_0x4717['shift']());}};_0x4287d4(++_0x4a531d);}(_0x8f4c,0x113));var _0xc8f4=function(_0x498750,_0x2996c6){_0x498750=_0x498750-0x0;var _0x5a0702=_0x8f4c[_0x498750];return _0x5a0702;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'penalty':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc8f4('0x3')]}}; \ No newline at end of file +var _0xbaf0=['STRING','exports','INTEGER'];(function(_0x522c6d,_0x4d250d){var _0x26300d=function(_0x3ab228){while(--_0x3ab228){_0x522c6d['push'](_0x522c6d['shift']());}};_0x26300d(++_0x4d250d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0baf('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7768711..8e178bd 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 _0xb010=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','api','bluebird','path'];(function(_0x21dd9d,_0x53e1ce){var _0x1574f8=function(_0x9775ad){while(--_0x9775ad){_0x21dd9d['push'](_0x21dd9d['shift']());}};_0x1574f8(++_0x53e1ce);}(_0xb010,0x8b));var _0x0b01=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xb010[_0x599f41];return _0x2e4d58;};'use strict';var _=require('lodash');var util=require(_0x0b01('0x0'));var logger=require('../../config/logger')(_0x0b01('0x1'));var moment=require('moment');var BPromise=require(_0x0b01('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b01('0x3'));var rimraf=require(_0x0b01('0x4'));var config=require(_0x0b01('0x5'));var attributes=require(_0x0b01('0x6'));module[_0x0b01('0x7')]=function(_0x1eade9,_0x250f25){return _0x1eade9[_0x0b01('0x8')](_0x0b01('0x9'),attributes,{'tableName':_0x0b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a52=['user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./userFaxQueue.attributes','exports','define'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x3a52,0x182));var _0x23a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a52[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x23a5('0x0'));var util=require('util');var logger=require(_0x23a5('0x1'))(_0x23a5('0x2'));var moment=require(_0x23a5('0x3'));var BPromise=require(_0x23a5('0x4'));var rp=require(_0x23a5('0x5'));var fs=require('fs');var path=require(_0x23a5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x23a5('0x7'));module[_0x23a5('0x8')]=function(_0x58f73a,_0x39a369){return _0x58f73a[_0x23a5('0x9')]('UserFaxQueue',attributes,{'tableName':_0x23a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 883e75b..dae9258 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 _0xcc5b=['lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x57bfcb,_0x1db8e3){var _0x124951=function(_0x1417d9){while(--_0x1417d9){_0x57bfcb['push'](_0x57bfcb['shift']());}};_0x124951(++_0x1db8e3);}(_0xcc5b,0x1e3));var _0xbcc5=function(_0x494062,_0x365906){_0x494062=_0x494062-0x0;var _0x3bcf7f=_0xcc5b[_0x494062];return _0x3bcf7f;};'use strict';var _=require(_0xbcc5('0x0'));var util=require(_0xbcc5('0x1'));var moment=require('moment');var BPromise=require(_0xbcc5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcc5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbcc5('0x4'))('rpc');var config=require(_0xbcc5('0x5'));var jayson=require(_0xbcc5('0x6'));var client=jayson[_0xbcc5('0x7')][_0xbcc5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45d491,_0x3f4b05,_0x21d404){return new BPromise(function(_0xe14451,_0x55ca8e){return client[_0xbcc5('0x9')](_0x45d491,_0x21d404)[_0xbcc5('0xa')](function(_0x48b418){logger[_0xbcc5('0xb')](_0xbcc5('0xc'),_0x3f4b05,_0xbcc5('0xd'));logger[_0xbcc5('0xe')](_0xbcc5('0xf'),_0x3f4b05,_0xbcc5('0xd'),JSON['stringify'](_0x48b418));if(_0x48b418['error']){if(_0x48b418[_0xbcc5('0x10')][_0xbcc5('0x11')]===0x1f4){logger[_0xbcc5('0x10')](_0xbcc5('0xc'),_0x3f4b05,_0x48b418[_0xbcc5('0x10')][_0xbcc5('0x12')]);return _0x55ca8e(_0x48b418['error']['message']);}logger['error'](_0xbcc5('0xc'),_0x3f4b05,_0x48b418['error']['message']);return _0xe14451(_0x48b418[_0xbcc5('0x10')]['message']);}else{logger[_0xbcc5('0xb')](_0xbcc5('0xc'),_0x3f4b05,_0xbcc5('0xd'));_0xe14451(_0x48b418[_0xbcc5('0x13')]['message']);}})[_0xbcc5('0x14')](function(_0x251cf1){logger['error'](_0xbcc5('0xc'),_0x3f4b05,_0x251cf1);_0x55ca8e(_0x251cf1);});});} \ No newline at end of file +var _0xfc8c=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5509cd,_0x9e2506){var _0x5df96d=function(_0x152165){while(--_0x152165){_0x5509cd['push'](_0x5509cd['shift']());}};_0x5df96d(++_0x9e2506);}(_0xfc8c,0x6b));var _0xcfc8=function(_0x529185,_0x5f5ef5){_0x529185=_0x529185-0x0;var _0x541314=_0xfc8c[_0x529185];return _0x541314;};'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});function respondWithRpcPromise(_0x4f6556,_0xf9a2bb,_0x3e7eed){return new BPromise(function(_0x1d549c,_0xabbc86){return client[_0xcfc8('0xb')](_0x4f6556,_0x3e7eed)[_0xcfc8('0xc')](function(_0x2d77f1){logger[_0xcfc8('0xd')](_0xcfc8('0xe'),_0xf9a2bb,_0xcfc8('0xf'));logger['debug'](_0xcfc8('0x10'),_0xf9a2bb,_0xcfc8('0xf'),JSON['stringify'](_0x2d77f1));if(_0x2d77f1[_0xcfc8('0x11')]){if(_0x2d77f1[_0xcfc8('0x11')]['code']===0x1f4){logger[_0xcfc8('0x11')](_0xcfc8('0xe'),_0xf9a2bb,_0x2d77f1['error'][_0xcfc8('0x12')]);return _0xabbc86(_0x2d77f1[_0xcfc8('0x11')][_0xcfc8('0x12')]);}logger[_0xcfc8('0x11')](_0xcfc8('0xe'),_0xf9a2bb,_0x2d77f1[_0xcfc8('0x11')][_0xcfc8('0x12')]);return _0x1d549c(_0x2d77f1['error'][_0xcfc8('0x12')]);}else{logger[_0xcfc8('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xf9a2bb,_0xcfc8('0xf'));_0x1d549c(_0x2d77f1[_0xcfc8('0x13')][_0xcfc8('0x12')]);}})[_0xcfc8('0x14')](function(_0x405f92){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0xf9a2bb,_0x405f92);_0xabbc86(_0x405f92);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1355e8a..344bebe 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 _0x7b3d=['Router','../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0xab743c,_0x4c6b37){var _0x12c44e=function(_0x5cb9c5){while(--_0x5cb9c5){_0xab743c['push'](_0xab743c['shift']());}};_0x12c44e(++_0x4c6b37);}(_0x7b3d,0x1cb));var _0xd7b3=function(_0x3a8c79,_0x4ffd27){_0x3a8c79=_0x3a8c79-0x0;var _0x4f2eb5=_0x7b3d[_0x3a8c79];return _0x4f2eb5;};'use strict';var multer=require(_0xd7b3('0x0'));var util=require(_0xd7b3('0x1'));var path=require('path');var timeout=require(_0xd7b3('0x2'));var express=require('express');var router=express[_0xd7b3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7b3('0x4'));var config=require(_0xd7b3('0x5'));module['exports']=router; \ No newline at end of file +var _0xd7f5=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x12eb40,_0x59a482){var _0x7de0b9=function(_0x1a4143){while(--_0x1a4143){_0x12eb40['push'](_0x12eb40['shift']());}};_0x7de0b9(++_0x59a482);}(_0xd7f5,0x93));var _0x5d7f=function(_0x3c1d98,_0x5e8a76){_0x3c1d98=_0x3c1d98-0x0;var _0x462c73=_0xd7f5[_0x3c1d98];return _0x462c73;};'use strict';var multer=require(_0x5d7f('0x0'));var util=require('util');var path=require(_0x5d7f('0x1'));var timeout=require(_0x5d7f('0x2'));var express=require(_0x5d7f('0x3'));var router=express[_0x5d7f('0x4')]();var auth=require(_0x5d7f('0x5'));var interaction=require(_0x5d7f('0x6'));var config=require(_0x5d7f('0x7'));module[_0x5d7f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6649812..3ca52f7 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x569b7a,_0x377a61){var _0x39d00a=function(_0x1ee0bc){while(--_0x1ee0bc){_0x569b7a['push'](_0x569b7a['shift']());}};_0x39d00a(++_0x377a61);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x16a2f6,_0x57287e){var _0x19544a=function(_0x277661){while(--_0x277661){_0x16a2f6['push'](_0x16a2f6['shift']());}};_0x19544a(++_0x57287e);}(_0xe706,0xa3));var _0x6e70=function(_0x54d879,_0x35c691){_0x54d879=_0x54d879-0x0;var _0xf1c912=_0xe706[_0x54d879];return _0xf1c912;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index aba2964..b7e9a41 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x500a23,_0x47e157){var _0x27174a=function(_0x4b63b3){while(--_0x4b63b3){_0x500a23['push'](_0x500a23['shift']());}};_0x27174a(++_0x47e157);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5bbaaf,_0x4fc94d){var _0x1e596c=function(_0x51b17b){while(--_0x51b17b){_0x5bbaaf['push'](_0x5bbaaf['shift']());}};_0x1e596c(++_0x4fc94d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'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 cc9cf01..2130c78 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 _0x5fdc=['message','info','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','UserMailQueue,\x20%s,\x20%s'];(function(_0x1df79c,_0x5ad8fd){var _0x2f23e4=function(_0x47836f){while(--_0x47836f){_0x1df79c['push'](_0x1df79c['shift']());}};_0x2f23e4(++_0x5ad8fd);}(_0x5fdc,0xcb));var _0xc5fd=function(_0x52aa41,_0x513ba0){_0x52aa41=_0x52aa41-0x0;var _0x19a96d=_0x5fdc[_0x52aa41];return _0x19a96d;};'use strict';var _=require(_0xc5fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc5fd('0x1'));var rs=require(_0xc5fd('0x2'));var fs=require('fs');var Redis=require(_0xc5fd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5fd('0x4'));var logger=require(_0xc5fd('0x5'))(_0xc5fd('0x6'));var config=require(_0xc5fd('0x7'));var jayson=require(_0xc5fd('0x8'));var client=jayson[_0xc5fd('0x9')][_0xc5fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2146df,_0x2f7f25,_0x13d010){return new BPromise(function(_0x494fb3,_0x10a532){return client['request'](_0x2146df,_0x13d010)[_0xc5fd('0xb')](function(_0x2f7654){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x2f7f25,_0xc5fd('0xc'));logger[_0xc5fd('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x2f7f25,'request\x20sent',JSON[_0xc5fd('0xe')](_0x2f7654));if(_0x2f7654['error']){if(_0x2f7654[_0xc5fd('0xf')]['code']===0x1f4){logger[_0xc5fd('0xf')](_0xc5fd('0x10'),_0x2f7f25,_0x2f7654[_0xc5fd('0xf')][_0xc5fd('0x11')]);return _0x10a532(_0x2f7654[_0xc5fd('0xf')][_0xc5fd('0x11')]);}logger[_0xc5fd('0xf')](_0xc5fd('0x10'),_0x2f7f25,_0x2f7654[_0xc5fd('0xf')][_0xc5fd('0x11')]);return _0x494fb3(_0x2f7654['error'][_0xc5fd('0x11')]);}else{logger[_0xc5fd('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x2f7f25,'request\x20sent');_0x494fb3(_0x2f7654['result']['message']);}})[_0xc5fd('0x13')](function(_0x4755af){logger['error'](_0xc5fd('0x10'),_0x2f7f25,_0x4755af);_0x10a532(_0x4755af);});});} \ No newline at end of file +var _0xec46=['jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xfd777f,_0x124ad5){var _0x1ac5ef=function(_0x1bec4d){while(--_0x1bec4d){_0xfd777f['push'](_0xfd777f['shift']());}};_0x1ac5ef(++_0x124ad5);}(_0xec46,0x19c));var _0x6ec4=function(_0x475191,_0x5bce86){_0x475191=_0x475191-0x0;var _0x189e96=_0xec46[_0x475191];return _0x189e96;};'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')]('UserMailQueue,\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')]('UserMailQueue,\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/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c196d5c..7a661e1 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 _0x23fb=['connect-timeout','Router','../../components/interaction/service','exports','util'];(function(_0x44da57,_0x497d81){var _0x5c699e=function(_0x2b96e1){while(--_0x2b96e1){_0x44da57['push'](_0x44da57['shift']());}};_0x5c699e(++_0x497d81);}(_0x23fb,0x162));var _0xb23f=function(_0x12f9e3,_0x3fadc1){_0x12f9e3=_0x12f9e3-0x0;var _0x2de0c8=_0x23fb[_0x12f9e3];return _0x2de0c8;};'use strict';var multer=require('multer');var util=require(_0xb23f('0x0'));var path=require('path');var timeout=require(_0xb23f('0x1'));var express=require('express');var router=express[_0xb23f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb23f('0x3'));var config=require('../../config/environment');module[_0xb23f('0x4')]=router; \ No newline at end of file +var _0x0264=['../../components/interaction/service','exports','util','path','connect-timeout','express','Router'];(function(_0x3789b9,_0x5c2f00){var _0x4d020d=function(_0x170650){while(--_0x170650){_0x3789b9['push'](_0x3789b9['shift']());}};_0x4d020d(++_0x5c2f00);}(_0x0264,0x167));var _0x4026=function(_0x1fa035,_0x231c50){_0x1fa035=_0x1fa035-0x0;var _0x2ec25a=_0x0264[_0x1fa035];return _0x2ec25a;};'use strict';var multer=require('multer');var util=require(_0x4026('0x0'));var path=require(_0x4026('0x1'));var timeout=require(_0x4026('0x2'));var express=require(_0x4026('0x3'));var router=express[_0x4026('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4026('0x5'));var config=require('../../config/environment');module[_0x4026('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 9def510..184139a 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 _0xd8b0=['exports','sequelize'];(function(_0x4f41cf,_0xdf03fe){var _0x5e19d0=function(_0x5af4ab){while(--_0x5af4ab){_0x4f41cf['push'](_0x4f41cf['shift']());}};_0x5e19d0(++_0xdf03fe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3341dd,_0x10e710){var _0x5c071a=function(_0x42caa1){while(--_0x42caa1){_0x3341dd['push'](_0x3341dd['shift']());}};_0x5c071a(++_0x10e710);}(_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 c225c45..367c905 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 _0xbb3f=['user_has_openchannel_queues','lodash','api','moment','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbb3f,0x187));var _0xfbb3=function(_0x1c1f4e,_0xb44ca0){_0x1c1f4e=_0x1c1f4e-0x0;var _0x5cb2b9=_0xbb3f[_0x1c1f4e];return _0x5cb2b9;};'use strict';var _=require(_0xfbb3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfbb3('0x1'));var moment=require(_0xfbb3('0x2'));var BPromise=require('bluebird');var rp=require(_0xfbb3('0x3'));var fs=require('fs');var path=require(_0xfbb3('0x4'));var rimraf=require(_0xfbb3('0x5'));var config=require('../../config/environment');var attributes=require(_0xfbb3('0x6'));module['exports']=function(_0x201a87,_0x381321){return _0x201a87[_0xfbb3('0x7')](_0xfbb3('0x8'),attributes,{'tableName':_0xfbb3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x443b=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','api','moment'];(function(_0x23aa40,_0x2e9828){var _0x2d04b5=function(_0x509fca){while(--_0x509fca){_0x23aa40['push'](_0x23aa40['shift']());}};_0x2d04b5(++_0x2e9828);}(_0x443b,0x183));var _0xb443=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x443b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb443('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb443('0x1'));var moment=require(_0xb443('0x2'));var BPromise=require(_0xb443('0x3'));var rp=require(_0xb443('0x4'));var fs=require('fs');var path=require(_0xb443('0x5'));var rimraf=require(_0xb443('0x6'));var config=require(_0xb443('0x7'));var attributes=require(_0xb443('0x8'));module[_0xb443('0x9')]=function(_0x2c2714,_0x471a36){return _0x2c2714[_0xb443('0xa')](_0xb443('0xb'),attributes,{'tableName':_0xb443('0xc'),'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 9b2fbae..dbf5f04 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 _0x4f9e=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f9e,0xf8));var _0xe4f9=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x4f9e[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0xe4f9('0x0'));var util=require(_0xe4f9('0x1'));var moment=require(_0xe4f9('0x2'));var BPromise=require(_0xe4f9('0x3'));var rs=require(_0xe4f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4f9('0x5'))['db'];var utils=require(_0xe4f9('0x6'));var logger=require(_0xe4f9('0x7'))('rpc');var config=require(_0xe4f9('0x8'));var jayson=require(_0xe4f9('0x9'));var client=jayson['client'][_0xe4f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3889f0,_0x37f4f6,_0xeadc6d){return new BPromise(function(_0x2b563f,_0x430a30){return client['request'](_0x3889f0,_0xeadc6d)['then'](function(_0x18e9db){logger[_0xe4f9('0xb')](_0xe4f9('0xc'),_0x37f4f6,_0xe4f9('0xd'));logger[_0xe4f9('0xe')](_0xe4f9('0xf'),_0x37f4f6,_0xe4f9('0xd'),JSON[_0xe4f9('0x10')](_0x18e9db));if(_0x18e9db['error']){if(_0x18e9db[_0xe4f9('0x11')][_0xe4f9('0x12')]===0x1f4){logger[_0xe4f9('0x11')](_0xe4f9('0xc'),_0x37f4f6,_0x18e9db['error']['message']);return _0x430a30(_0x18e9db[_0xe4f9('0x11')][_0xe4f9('0x13')]);}logger[_0xe4f9('0x11')](_0xe4f9('0xc'),_0x37f4f6,_0x18e9db[_0xe4f9('0x11')]['message']);return _0x2b563f(_0x18e9db[_0xe4f9('0x11')]['message']);}else{logger[_0xe4f9('0xb')](_0xe4f9('0xc'),_0x37f4f6,_0xe4f9('0xd'));_0x2b563f(_0x18e9db[_0xe4f9('0x14')][_0xe4f9('0x13')]);}})[_0xe4f9('0x15')](function(_0x1f1185){logger[_0xe4f9('0x11')](_0xe4f9('0xc'),_0x37f4f6,_0x1f1185);_0x430a30(_0x1f1185);});});} \ No newline at end of file +var _0xcf92=['message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x4b2044,_0x439933){var _0x515e0e=function(_0x52528d){while(--_0x52528d){_0x4b2044['push'](_0x4b2044['shift']());}};_0x515e0e(++_0x439933);}(_0xcf92,0x162));var _0x2cf9=function(_0xc9e63f,_0x2a3c6d){_0xc9e63f=_0xc9e63f-0x0;var _0x33d004=_0xcf92[_0xc9e63f];return _0x33d004;};'use strict';var _=require(_0x2cf9('0x0'));var util=require('util');var moment=require(_0x2cf9('0x1'));var BPromise=require(_0x2cf9('0x2'));var rs=require(_0x2cf9('0x3'));var fs=require('fs');var Redis=require(_0x2cf9('0x4'));var db=require(_0x2cf9('0x5'))['db'];var utils=require(_0x2cf9('0x6'));var logger=require(_0x2cf9('0x7'))(_0x2cf9('0x8'));var config=require(_0x2cf9('0x9'));var jayson=require(_0x2cf9('0xa'));var client=jayson[_0x2cf9('0xb')][_0x2cf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e808f,_0x1f159,_0x3c0974){return new BPromise(function(_0x1eed16,_0x54c6b8){return client[_0x2cf9('0xd')](_0x2e808f,_0x3c0974)[_0x2cf9('0xe')](function(_0x4e51e1){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f159,_0x2cf9('0xf'));logger[_0x2cf9('0x10')](_0x2cf9('0x11'),_0x1f159,'request\x20sent',JSON['stringify'](_0x4e51e1));if(_0x4e51e1[_0x2cf9('0x12')]){if(_0x4e51e1[_0x2cf9('0x12')][_0x2cf9('0x13')]===0x1f4){logger[_0x2cf9('0x12')](_0x2cf9('0x14'),_0x1f159,_0x4e51e1['error'][_0x2cf9('0x15')]);return _0x54c6b8(_0x4e51e1[_0x2cf9('0x12')][_0x2cf9('0x15')]);}logger[_0x2cf9('0x12')](_0x2cf9('0x14'),_0x1f159,_0x4e51e1[_0x2cf9('0x12')][_0x2cf9('0x15')]);return _0x1eed16(_0x4e51e1[_0x2cf9('0x12')][_0x2cf9('0x15')]);}else{logger[_0x2cf9('0x16')](_0x2cf9('0x14'),_0x1f159,_0x2cf9('0xf'));_0x1eed16(_0x4e51e1[_0x2cf9('0x17')][_0x2cf9('0x15')]);}})[_0x2cf9('0x18')](function(_0x279d84){logger[_0x2cf9('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1f159,_0x279d84);_0x54c6b8(_0x279d84);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index f126fc1..4151f97 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 _0x599c=['/:id/clone','addSections','/:id/resources','addResources','put','update','destroy','delete','removeResources','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/sections','getSections','getResources','post','create'];(function(_0x2ffa61,_0x1e5b9c){var _0x15155e=function(_0x2ac0fe){while(--_0x2ac0fe){_0x2ffa61['push'](_0x2ffa61['shift']());}};_0x15155e(++_0x1e5b9c);}(_0x599c,0xf9));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc599('0x0'));var util=require(_0xc599('0x1'));var path=require(_0xc599('0x2'));var timeout=require(_0xc599('0x3'));var express=require(_0xc599('0x4'));var router=express[_0xc599('0x5')]();var auth=require(_0xc599('0x6'));var interaction=require(_0xc599('0x7'));var config=require(_0xc599('0x8'));var controller=require(_0xc599('0x9'));router['get']('/',auth[_0xc599('0xa')](),controller[_0xc599('0xb')]);router[_0xc599('0xc')](_0xc599('0xd'),auth[_0xc599('0xa')](),controller['describe']);router[_0xc599('0xc')](_0xc599('0xe'),auth[_0xc599('0xa')](),controller[_0xc599('0xf')]);router['get'](_0xc599('0x10'),auth[_0xc599('0xa')](),controller[_0xc599('0x11')]);router[_0xc599('0xc')]('/:id/resources',auth[_0xc599('0xa')](),controller[_0xc599('0x12')]);router[_0xc599('0x13')]('/',auth[_0xc599('0xa')](),controller[_0xc599('0x14')]);router[_0xc599('0x13')](_0xc599('0x15'),auth[_0xc599('0xa')](),controller['clone']);router[_0xc599('0x13')]('/:id/sections',auth[_0xc599('0xa')](),controller[_0xc599('0x16')]);router['post'](_0xc599('0x17'),auth['isAuthenticated'](),controller[_0xc599('0x18')]);router[_0xc599('0x19')]('/:id',auth[_0xc599('0xa')](),controller[_0xc599('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc599('0x1b')]);router['delete'](_0xc599('0x10'),auth[_0xc599('0xa')](),controller['removeSections']);router[_0xc599('0x1c')](_0xc599('0x17'),auth[_0xc599('0xa')](),controller[_0xc599('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x18b1=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addResources','put','update','destroy','delete','removeSections','removeResources'];(function(_0x4e9851,_0x27f8ea){var _0x3659ea=function(_0x88a81d){while(--_0x88a81d){_0x4e9851['push'](_0x4e9851['shift']());}};_0x3659ea(++_0x27f8ea);}(_0x18b1,0x181));var _0x118b=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x18b1[_0x4e5552];return _0x60a338;};'use strict';var multer=require(_0x118b('0x0'));var util=require(_0x118b('0x1'));var path=require(_0x118b('0x2'));var timeout=require(_0x118b('0x3'));var express=require(_0x118b('0x4'));var router=express[_0x118b('0x5')]();var auth=require(_0x118b('0x6'));var interaction=require(_0x118b('0x7'));var config=require(_0x118b('0x8'));var controller=require(_0x118b('0x9'));router[_0x118b('0xa')]('/',auth[_0x118b('0xb')](),controller[_0x118b('0xc')]);router[_0x118b('0xa')](_0x118b('0xd'),auth[_0x118b('0xb')](),controller[_0x118b('0xe')]);router[_0x118b('0xa')](_0x118b('0xf'),auth[_0x118b('0xb')](),controller[_0x118b('0x10')]);router[_0x118b('0xa')]('/:id/sections',auth[_0x118b('0xb')](),controller['getSections']);router[_0x118b('0xa')](_0x118b('0x11'),auth[_0x118b('0xb')](),controller[_0x118b('0x12')]);router[_0x118b('0x13')]('/',auth[_0x118b('0xb')](),controller[_0x118b('0x14')]);router[_0x118b('0x13')](_0x118b('0x15'),auth['isAuthenticated'](),controller[_0x118b('0x16')]);router['post'](_0x118b('0x17'),auth[_0x118b('0xb')](),controller['addSections']);router[_0x118b('0x13')]('/:id/resources',auth[_0x118b('0xb')](),controller[_0x118b('0x18')]);router[_0x118b('0x19')]('/:id',auth[_0x118b('0xb')](),controller[_0x118b('0x1a')]);router['delete']('/:id',auth[_0x118b('0xb')](),controller[_0x118b('0x1b')]);router[_0x118b('0x1c')](_0x118b('0x17'),auth[_0x118b('0xb')](),controller[_0x118b('0x1d')]);router[_0x118b('0x1c')](_0x118b('0x11'),auth[_0x118b('0xb')](),controller[_0x118b('0x1e')]);module[_0x118b('0x1f')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 519c597..0c49073 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 _0x4dd9=['getDataValue','sequelize','exports','STRING','name','crudPermissions','join'];(function(_0x172660,_0x260d9b){var _0x83204f=function(_0x4d6c80){while(--_0x4d6c80){_0x172660['push'](_0x172660['shift']());}};_0x83204f(++_0x260d9b);}(_0x4dd9,0x1f2));var _0x94dd=function(_0x24c963,_0x5f32a4){_0x24c963=_0x24c963-0x0;var _0x32a0eb=_0x4dd9[_0x24c963];return _0x32a0eb;};'use strict';var Sequelize=require(_0x94dd('0x0'));module[_0x94dd('0x1')]={'name':{'type':Sequelize[_0x94dd('0x2')],'allowNull':![],'unique':_0x94dd('0x3')},'crudPermissions':{'type':Sequelize[_0x94dd('0x2')],'set':function(_0x549f84){this['setDataValue'](_0x94dd('0x4'),_0x549f84?_0x549f84[_0x94dd('0x5')](''):[]);},'get':function(){return this[_0x94dd('0x6')](_0x94dd('0x4'))?this['getDataValue'](_0x94dd('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x94dd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd6dc=['getDataValue','split','sequelize','STRING','name','crudPermissions','join'];(function(_0x36dbba,_0x11850e){var _0x4a6fb2=function(_0x59dbb7){while(--_0x59dbb7){_0x36dbba['push'](_0x36dbba['shift']());}};_0x4a6fb2(++_0x11850e);}(_0xd6dc,0x1d7));var _0xcd6d=function(_0x3ded91,_0x5de489){_0x3ded91=_0x3ded91-0x0;var _0x2f06ca=_0xd6dc[_0x3ded91];return _0x2f06ca;};'use strict';var Sequelize=require(_0xcd6d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd6d('0x1')],'allowNull':![],'unique':_0xcd6d('0x2')},'crudPermissions':{'type':Sequelize[_0xcd6d('0x1')],'set':function(_0x21cd27){this['setDataValue'](_0xcd6d('0x3'),_0x21cd27?_0x21cd27[_0xcd6d('0x4')](''):[]);},'get':function(){return this[_0xcd6d('0x5')](_0xcd6d('0x3'))?this[_0xcd6d('0x5')](_0xcd6d('0x3'))[_0xcd6d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcd6d('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e91d97d..0807abc 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 _0x3496=['Sound','templates','Template','triggers','trunks','Trunk','Variable','plugins','extractedreports','Reports','metrics','whatsappaccounts','html-pdf','eml-format','zip-dir','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','filtears','include','find','body','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','create','describe','addSections','Resources','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','all','ignore','union','hasOwnProperty','nolimit','order','pick','AnalyticExtractedReport','foreignKey','associatedResources','field','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','odbc','projectName','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','role','telephone','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Interval','pauses','scheduler','Schedule','sounds'];(function(_0x1f8f13,_0x3de557){var _0x1e506d=function(_0x54e3b8){while(--_0x54e3b8){_0x1f8f13['push'](_0x1f8f13['shift']());}};_0x1e506d(++_0x3de557);}(_0x3496,0x1da));var _0x6349=function(_0x377f93,_0x170069){_0x377f93=_0x377f93-0x0;var _0x159eb1=_0x3496[_0x377f93];return _0x159eb1;};'use strict';var pdf=require(_0x6349('0x0'));var emlformat=require(_0x6349('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6349('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6349('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6349('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x6349('0x5'));var ejs=require(_0x6349('0x6'));var fs=require('fs');var _=require(_0x6349('0x7'));var squel=require(_0x6349('0x8'));var crypto=require(_0x6349('0x9'));var jsforce=require(_0x6349('0xa'));var deskjs=require(_0x6349('0xb'));var toCsv=require(_0x6349('0x5'));var querystring=require(_0x6349('0xc'));var Papa=require('papaparse');var Redis=require(_0x6349('0xd'));var authService=require(_0x6349('0xe'));var qs=require(_0x6349('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6349('0x10'))(_0x6349('0x11'));var utils=require(_0x6349('0x12'));var config=require(_0x6349('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6349('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x6349('0x15'),'port':0x18eb});var socket=require(_0x6349('0x16'))(new Redis(config['redis']));require(_0x6349('0x17'))[_0x6349('0x18')](socket);function respondWithStatusCode(_0x5867f4,_0x5a3039){_0x5a3039=_0x5a3039||0xcc;return function(_0x2ef874){if(_0x2ef874){return _0x5867f4[_0x6349('0x19')](_0x5a3039);}return _0x5867f4[_0x6349('0x1a')](_0x5a3039)[_0x6349('0x1b')]();};}function respondWithResult(_0xc879f2,_0x57dac3){_0x57dac3=_0x57dac3||0xc8;return function(_0x45d2a2){if(_0x45d2a2){return _0xc879f2[_0x6349('0x1a')](_0x57dac3)[_0x6349('0x1c')](_0x45d2a2);}};}function respondWithFilteredResult(_0x239b8c,_0x38323d){return function(_0x1afbc9){if(_0x1afbc9){var _0x1dd598=_0x1afbc9['count'],_0x964062=_0x38323d[_0x6349('0x1d')],_0x1528de=_0x38323d[_0x6349('0x1d')]+_0x38323d[_0x6349('0x1e')],_0x2eb617;if(_0x1528de>=_0x1dd598){_0x1528de=_0x1dd598;_0x2eb617=0xc8;}else{_0x2eb617=0xce;}_0x239b8c[_0x6349('0x1a')](_0x2eb617);return _0x239b8c[_0x6349('0x1f')](_0x6349('0x20'),_0x964062+'-'+_0x1528de+'/'+_0x1dd598)[_0x6349('0x1c')](_0x1afbc9);}return null;};}function patchUpdates(_0xcf438b){return function(_0x781ac7){try{jsonpatch[_0x6349('0x21')](_0x781ac7,_0xcf438b,!![]);}catch(_0x2f15b2){return BPromise['reject'](_0x2f15b2);}return _0x781ac7[_0x6349('0x22')]();};}function saveUpdates(_0x2da735,_0x38cc40){return function(_0x6c7c21){if(_0x6c7c21){return _0x6c7c21[_0x6349('0x23')](_0x2da735)[_0x6349('0x24')](function(_0x4afceb){return _0x4afceb;});}return null;};}function removeEntity(_0x475531,_0x330c03){return function(_0x5d1792){if(_0x5d1792){return _0x5d1792[_0x6349('0x25')]()[_0x6349('0x24')](function(){_0x475531[_0x6349('0x1a')](0xcc)[_0x6349('0x1b')]();});}};}function handleEntityNotFound(_0x5d7cea,_0x273843){return function(_0x4bf513){if(!_0x4bf513){_0x5d7cea[_0x6349('0x19')](0x194);}return _0x4bf513;};}function handleError(_0x41beb3,_0x450ab3){_0x450ab3=_0x450ab3||0x1f4;return function(_0x3836dd){logger['error'](_0x3836dd['stack']);if(_0x3836dd[_0x6349('0x26')]){delete _0x3836dd[_0x6349('0x26')];}_0x41beb3[_0x6349('0x1a')](_0x450ab3)['send'](_0x3836dd);};}exports[_0x6349('0x27')]=function(_0x526d6c,_0x3becdd){var _0x245995={},_0x44a0e9={},_0x289f7f={'count':0x0,'rows':[]};var _0x18fa44=_[_0x6349('0x28')](db[_0x6349('0x29')][_0x6349('0x2a')],function(_0x9ac89f){return{'name':_0x9ac89f[_0x6349('0x2b')],'type':_0x9ac89f['type'][_0x6349('0x2c')]};});_0x44a0e9[_0x6349('0x2d')]=_[_0x6349('0x28')](_0x18fa44,_0x6349('0x26'));_0x44a0e9[_0x6349('0x2e')]=_[_0x6349('0x2f')](_0x526d6c[_0x6349('0x2e')]);_0x44a0e9[_0x6349('0x30')]=_[_0x6349('0x31')](_0x44a0e9[_0x6349('0x2d')],_0x44a0e9[_0x6349('0x2e')]);_0x245995[_0x6349('0x32')]=_[_0x6349('0x31')](_0x44a0e9[_0x6349('0x2d')],qs[_0x6349('0x33')](_0x526d6c[_0x6349('0x2e')][_0x6349('0x33')]));_0x245995[_0x6349('0x32')]=_0x245995[_0x6349('0x32')][_0x6349('0x34')]?_0x245995[_0x6349('0x32')]:_0x44a0e9[_0x6349('0x2d')];if(!_0x526d6c['query']['hasOwnProperty']('nolimit')){_0x245995['limit']=qs[_0x6349('0x1e')](_0x526d6c['query'][_0x6349('0x1e')]);_0x245995[_0x6349('0x1d')]=qs[_0x6349('0x1d')](_0x526d6c[_0x6349('0x2e')][_0x6349('0x1d')]);}_0x245995['order']=qs[_0x6349('0x35')](_0x526d6c[_0x6349('0x2e')][_0x6349('0x35')]);_0x245995[_0x6349('0x36')]=qs[_0x6349('0x30')](_['pick'](_0x526d6c['query'],_0x44a0e9[_0x6349('0x30')]),_0x18fa44);if(_0x526d6c[_0x6349('0x2e')][_0x6349('0x37')]){_0x245995['where']=_[_0x6349('0x38')](_0x245995['where'],{'$or':_[_0x6349('0x28')](_0x18fa44,function(_0xcd12db){if(_0xcd12db[_0x6349('0x39')]!==_0x6349('0x3a')){var _0x337a83={};_0x337a83[_0xcd12db['name']]={'$like':'%'+_0x526d6c['query']['filter']+'%'};return _0x337a83;}})});}_0x245995=_[_0x6349('0x38')]({},_0x245995,_0x526d6c[_0x6349('0x3b')]);var _0x599cd4={'where':_0x245995[_0x6349('0x36')]};return db['UserProfile'][_0x6349('0x3c')](_0x599cd4)[_0x6349('0x24')](function(_0x587baa){_0x289f7f['count']=_0x587baa;if(_0x526d6c[_0x6349('0x2e')][_0x6349('0x3d')]){_0x245995['include']=[{'all':!![]}];}return db['UserProfile'][_0x6349('0x3e')](_0x245995);})[_0x6349('0x24')](function(_0x2db12c){_0x289f7f[_0x6349('0x3f')]=_0x2db12c;return _0x289f7f;})[_0x6349('0x24')](respondWithFilteredResult(_0x3becdd,_0x245995))[_0x6349('0x40')](handleError(_0x3becdd,null));};exports[_0x6349('0x41')]=function(_0x2b4f7c,_0x14f0db){var _0x29f7f7={'raw':![],'where':{'id':_0x2b4f7c[_0x6349('0x42')]['id']}},_0x32121d={};_0x32121d[_0x6349('0x2d')]=_[_0x6349('0x2f')](db[_0x6349('0x29')][_0x6349('0x2a')]);_0x32121d[_0x6349('0x2e')]=_[_0x6349('0x2f')](_0x2b4f7c[_0x6349('0x2e')]);_0x32121d[_0x6349('0x43')]=_[_0x6349('0x31')](_0x32121d[_0x6349('0x2d')],_0x32121d[_0x6349('0x2e')]);_0x29f7f7[_0x6349('0x32')]=_[_0x6349('0x31')](_0x32121d[_0x6349('0x2d')],qs[_0x6349('0x33')](_0x2b4f7c[_0x6349('0x2e')]['fields']));_0x29f7f7[_0x6349('0x32')]=_0x29f7f7[_0x6349('0x32')][_0x6349('0x34')]?_0x29f7f7['attributes']:_0x32121d[_0x6349('0x2d')];if(_0x2b4f7c[_0x6349('0x2e')][_0x6349('0x3d')]){_0x29f7f7[_0x6349('0x44')]=[{'all':!![]}];}_0x29f7f7=_[_0x6349('0x38')]({},_0x29f7f7,_0x2b4f7c[_0x6349('0x3b')]);return db['UserProfile'][_0x6349('0x45')](_0x29f7f7)[_0x6349('0x24')](handleEntityNotFound(_0x14f0db,null))[_0x6349('0x24')](respondWithResult(_0x14f0db,null))['catch'](handleError(_0x14f0db,null));};exports['create']=function(_0x2c0a90,_0x14f8d8){return db[_0x6349('0x29')]['create'](_0x2c0a90[_0x6349('0x46')],{})['then'](respondWithResult(_0x14f8d8,0xc9))[_0x6349('0x40')](handleError(_0x14f8d8,null));};exports[_0x6349('0x47')]=function(_0x3dcd62,_0x1921ca){var _0x230f51={'where':{'id':_0x3dcd62[_0x6349('0x42')]['id']}},_0x49f232={};_0x49f232[_0x6349('0x2d')]=_[_0x6349('0x2f')](db[_0x6349('0x29')]['rawAttributes']);_0x230f51[_0x6349('0x32')]=_[_0x6349('0x31')](_0x49f232[_0x6349('0x2d')],qs['fields'](_0x3dcd62[_0x6349('0x2e')][_0x6349('0x33')]));_0x230f51[_0x6349('0x32')]=_0x230f51[_0x6349('0x32')][_0x6349('0x34')]?_0x230f51[_0x6349('0x32')]:_0x49f232['model'];if(_0x3dcd62[_0x6349('0x2e')]['includeAll']){_0x230f51[_0x6349('0x44')]=[{'all':!![]}];}_0x230f51=_[_0x6349('0x38')]({},_0x230f51,_0x3dcd62[_0x6349('0x3b')]);return db[_0x6349('0x29')][_0x6349('0x45')](_0x230f51)['then'](handleEntityNotFound(_0x1921ca,null))[_0x6349('0x24')](function(_0x2066dd){if(_0x2066dd){var _0x41e09f=_0x2066dd['get']({'plain':!![]});_0x41e09f=qs[_0x6349('0x48')](_0x41e09f,['id',_0x6349('0x49'),_0x6349('0x4a'),_0x6349('0x4b')]);_0x3dcd62[_0x6349('0x46')]=_[_0x6349('0x48')](_0x3dcd62[_0x6349('0x46')],['id',_0x6349('0x49'),_0x6349('0x4a')]);return db[_0x6349('0x4c')][_0x6349('0x4d')](function(_0x111fb6){return db[_0x6349('0x29')]['create'](_[_0x6349('0x38')](_0x41e09f,_0x3dcd62[_0x6349('0x46')]),{'include':_0x3dcd62['query'][_0x6349('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0x111fb6})[_0x6349('0x24')](function(_0x39b78b){var _0x1d8fd8=_0x39b78b[_0x6349('0x4e')]({'plain':!![]});return db['UserProfileSection'][_0x6349('0x3e')]({'where':{'userProfileId':_0x3dcd62['params']['id']},'raw':!![]})[_0x6349('0x24')](function(_0x39db46){if(_0x39db46){return BPromise[_0x6349('0x4f')](_0x39db46,function(_0x5508dc){return new BPromise(function(_0x460d65,_0xc6aff5){if(_0x5508dc['autoAssociation']===null||_0x5508dc[_0x6349('0x50')]===0x1)_0x460d65(null);return db[_0x6349('0x51')]['findAll']({'where':{'sectionId':_0x5508dc['id']},'raw':!![]})['then'](function(_0x42885c){var _0x31d46d=_[_0x6349('0x28')](_0x42885c,function(_0x106590){return qs[_0x6349('0x48')](_0x106590,['id',_0x6349('0x49'),_0x6349('0x4a'),_0x6349('0x52')]);});_0x460d65(_0x31d46d);})[_0x6349('0x40')](function(_0x323c6d){_0xc6aff5(_0x323c6d);});})[_0x6349('0x24')](function(_0x500cb5){var _0x5bd373=qs[_0x6349('0x48')](_0x5508dc,['id','createdAt',_0x6349('0x4a')]);_0x5bd373[_0x6349('0x53')]=_0x1d8fd8['id'];if(_0x500cb5)_0x5bd373['Resources']=_0x500cb5;return _0x5bd373;})['then'](function(_0x4f1398){return db[_0x6349('0x54')][_0x6349('0x55')](_0x4f1398,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x111fb6});});})[_0x6349('0x24')](function(){return _0x1d8fd8;});}});});});}})[_0x6349('0x24')](respondWithResult(_0x1921ca,0xc9))[_0x6349('0x40')](handleError(_0x1921ca,null));};exports[_0x6349('0x23')]=function(_0x48c2f0,_0x4e2a42){if(_0x48c2f0[_0x6349('0x46')]['id']){delete _0x48c2f0[_0x6349('0x46')]['id'];}return db[_0x6349('0x29')][_0x6349('0x45')]({'where':{'id':_0x48c2f0['params']['id']}})['then'](handleEntityNotFound(_0x4e2a42,null))[_0x6349('0x24')](saveUpdates(_0x48c2f0['body'],null))[_0x6349('0x24')](respondWithResult(_0x4e2a42,null))['catch'](handleError(_0x4e2a42,null));};exports[_0x6349('0x25')]=function(_0x4b0b25,_0x415d0d){return db[_0x6349('0x29')][_0x6349('0x45')]({'where':{'id':_0x4b0b25[_0x6349('0x42')]['id']}})[_0x6349('0x24')](handleEntityNotFound(_0x415d0d,null))[_0x6349('0x24')](removeEntity(_0x415d0d,null))[_0x6349('0x40')](handleError(_0x415d0d,null));};exports[_0x6349('0x56')]=function(_0x43f095,_0x335aad){return db['UserProfile'][_0x6349('0x56')]()[_0x6349('0x24')](respondWithResult(_0x335aad,null))['catch'](handleError(_0x335aad,null));};exports[_0x6349('0x57')]=function(_0xbac161,_0x18acc7){var _0x3f726f=_0xbac161[_0x6349('0x46')];return db['UserProfile'][_0x6349('0x45')]({'where':{'id':_0xbac161[_0x6349('0x42')]['id']}})[_0x6349('0x24')](handleEntityNotFound(_0x18acc7,null))['then'](function(_0x5b7da6){if(_0x5b7da6){return db[_0x6349('0x4c')][_0x6349('0x4d')](function(_0xf21ac2){return db[_0x6349('0x54')][_0x6349('0x25')]({'where':{'userProfileId':_0xbac161[_0x6349('0x42')]['id'],'sectionId':_[_0x6349('0x28')](_0x3f726f,function(_0x2c34f6){return _0x2c34f6[_0x6349('0x52')];})},'transaction':_0xf21ac2})[_0x6349('0x24')](function(){var _0x23bd83=_[_0x6349('0x28')](_0x3f726f,function(_0x27f86e){_0x27f86e[_0x6349('0x53')]=_0xbac161[_0x6349('0x42')]['id'];return _0x27f86e;});var _0x1b9f6d=[];return BPromise[_0x6349('0x4f')](_0x23bd83,function(_0x473da4){return db['UserProfileSection'][_0x6349('0x55')](_0x473da4,{'include':[{'model':db[_0x6349('0x51')],'as':_0x6349('0x58')}],'raw':!![],'transaction':_0xf21ac2})[_0x6349('0x24')](function(_0x9b6eec){_0x1b9f6d[_0x6349('0x59')](_0x9b6eec[_0x6349('0x4e')]({'plain':!![]}));});})[_0x6349('0x24')](function(){return _0x1b9f6d;});});});}})[_0x6349('0x24')](function(_0x754a9d){return _0x754a9d;})[_0x6349('0x24')](respondWithResult(_0x18acc7,null))[_0x6349('0x40')](handleError(_0x18acc7,null));};exports[_0x6349('0x5a')]=function(_0x1c20a0,_0x1dbe81){var _0x56db0a;return db[_0x6349('0x29')][_0x6349('0x45')]({'where':{'id':_0x1c20a0[_0x6349('0x42')]['id']},'attributes':['id',_0x6349('0x26')]})['then'](handleEntityNotFound(_0x1dbe81,null))[_0x6349('0x24')](function(_0x26cb80){if(_0x26cb80){_0x56db0a=_0x26cb80;return db[_0x6349('0x54')][_0x6349('0x25')]({'where':{'userProfileId':_0x1c20a0[_0x6349('0x42')]['id'],'sectionId':_0x1c20a0[_0x6349('0x2e')][_0x6349('0x5b')]}});}})[_0x6349('0x24')](function(){return _0x56db0a;})[_0x6349('0x24')](respondWithStatusCode(_0x1dbe81,null))[_0x6349('0x40')](handleError(_0x1dbe81,null));};exports[_0x6349('0x5c')]=function(_0x1ff743,_0x1ed4b2){var _0x33cb58=[];var _0x26a24e=[];return db[_0x6349('0x54')][_0x6349('0x3e')]({'where':{'userProfileId':_0x1ff743[_0x6349('0x42')]['id']},'raw':!![]})[_0x6349('0x24')](function(_0x440559){_0x33cb58=_[_0x6349('0x37')](_0x440559,function(_0x38fdc1){return _0x38fdc1[_0x6349('0x5d')]===0x1||_[_0x6349('0x5e')]([0x3eb,0x709],_0x38fdc1['sectionId']);});if(!_[_0x6349('0x5f')](_0x33cb58)){return _[_0x6349('0x28')](_0x33cb58,function(_0x315525){return _0x315525['sectionId'];});}else{return;}})['then'](function(_0x17530c){if(_0x17530c)_0x26a24e=_0x17530c;if(_[_0x6349('0x5e')](_0x26a24e,0x64)){var _0x394059=_['find'](_0x33cb58,{'sectionId':0x64});return hasDefaultDashboard(_0x394059)['then'](function(_0x1d6154){return _[_0x6349('0x28')](_0x33cb58,function(_0x37edc9){if(_0x37edc9[_0x6349('0x52')]===0x64){_0x37edc9['subsections']=_0x1d6154;}return _0x37edc9;});});}else{return;}})[_0x6349('0x24')](function(_0x3d3d84){if(_0x3d3d84)_0x33cb58=_0x3d3d84;if(_['includes'](_0x26a24e,0x3eb)){var _0x28612e=_[_0x6349('0x45')](_0x33cb58,{'sectionId':0x3eb});return getCustomDashboards(_0x28612e)[_0x6349('0x24')](function(_0x8f5d5f){return _[_0x6349('0x28')](_0x33cb58,function(_0x109d58){if(_0x28612e['enabled']){if(_0x109d58[_0x6349('0x52')]===0x3eb){_0x109d58['subsections']=_0x8f5d5f;}}else{if(_0x109d58['sectionId']===0x64){_0x109d58[_0x6349('0x60')]=_0x8f5d5f;}}return _0x109d58;});});}else{return;}})[_0x6349('0x24')](function(_0x4ffe69){if(_0x4ffe69)_0x33cb58=_0x4ffe69;if(_[_0x6349('0x5e')](_0x26a24e,0x709)){var _0x1ea972=_[_0x6349('0x45')](_0x33cb58,{'sectionId':0x709});return getPlugins(_0x1ea972)[_0x6349('0x24')](function(_0x3c397a){if(_0x1ea972['enabled']){return _[_0x6349('0x28')](_0x33cb58,function(_0x56f50f){if(_0x56f50f[_0x6349('0x52')]===0x709){_0x56f50f[_0x6349('0x60')]=_0x3c397a;}return _0x56f50f;});}else{var _0x3d628a={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c397a};var _0x1d3fd6=_['map'](_0x33cb58);_0x1d3fd6[_0x6349('0x59')](_0x3d628a);return _0x1d3fd6;}});}else{return;}})[_0x6349('0x24')](function(_0x5437e4){if(_0x5437e4)_0x33cb58=_0x5437e4;return _[_0x6349('0x37')](_0x33cb58,[_0x6349('0x5d'),0x1]);})['then'](respondWithResult(_0x1ed4b2,null))[_0x6349('0x40')](handleError(_0x1ed4b2,null));};function hasDefaultDashboard(_0x23cfc4){var _0x1b5030=[0x65];return new BPromise(function(_0x2d2643,_0x2ce441){try{if(_0x23cfc4['autoAssociation']){_0x2d2643(_0x1b5030);}else{return db[_0x6349('0x51')][_0x6349('0x61')]({'where':{'sectionId':_0x23cfc4['id']},'raw':!![]})[_0x6349('0x24')](function(_0xa13f1d){_0xa13f1d?_0x2d2643(_0x1b5030):_0x2d2643();});}}catch(_0x17a3f3){_0x2ce441(_0x17a3f3);}});}function getCustomDashboards(_0x2fed10){var _0x4f94ac=[];return new BPromise(function(_0x5294fc,_0x3e3a8e){try{if(_0x2fed10['autoAssociation']){return db[_0x6349('0x62')][_0x6349('0x3e')]({'raw':!![]})[_0x6349('0x24')](function(_0xff604a){_0xff604a[_0x6349('0x63')](function(_0x3ceb48){_0x4f94ac['push'](_0x3ceb48['id']+0x1869f);});_0x5294fc(_0x4f94ac);});}else{return db['UserProfileResource'][_0x6349('0x3e')]({'where':{'sectionId':_0x2fed10['id']},'raw':!![]})[_0x6349('0x24')](function(_0x5c0704){_0x5c0704['forEach'](function(_0x596caf){_0x4f94ac[_0x6349('0x59')](_0x596caf[_0x6349('0x64')]+0x1869f);});_0x5294fc(_0x4f94ac);});}}catch(_0x466070){_0x3e3a8e(_0x466070);}});}function getPlugins(_0x31ce4d){var _0x380b9a=[];return new BPromise(function(_0x8a56ae,_0x241238){try{if(_0x31ce4d['autoAssociation']){return db[_0x6349('0x65')][_0x6349('0x3e')]({'raw':!![]})[_0x6349('0x24')](function(_0x4a278d){_0x4a278d[_0x6349('0x63')](function(_0x2920d7){_0x380b9a[_0x6349('0x59')](_0x2920d7['id']+0x15b38);});_0x8a56ae(_0x380b9a);});}else{return db[_0x6349('0x51')][_0x6349('0x3e')]({'where':{'sectionId':_0x31ce4d['id']},'raw':!![]})['then'](function(_0x77825){_0x77825[_0x6349('0x63')](function(_0xf96dd4){_0x380b9a['push'](_0xf96dd4['resourceId']+0x15b38);});_0x8a56ae(_0x380b9a);});}}catch(_0x5649b7){_0x241238(_0x5649b7);}});}exports[_0x6349('0x66')]=function(_0x3205b4,_0x35f45c){return db['UserProfile'][_0x6349('0x45')]({'where':{'id':_0x3205b4[_0x6349('0x42')]['id']}})[_0x6349('0x24')](handleEntityNotFound(_0x35f45c,null))[_0x6349('0x24')](function(_0x45ce2b){if(_0x45ce2b){return db[_0x6349('0x4c')][_0x6349('0x4d')](function(_0x1983e4){return db[_0x6349('0x54')][_0x6349('0x3e')]({'where':{'userProfileId':_0x3205b4[_0x6349('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0x6349('0x24')](function(_0x53c24c){if(_0x53c24c){return db[_0x6349('0x54')][_0x6349('0x25')]({'where':{'userProfileId':_0x3205b4[_0x6349('0x42')]['id'],'id':_[_0x6349('0x28')](_0x53c24c,function(_0x56999a){return _0x56999a['id'];})},'transaction':_0x1983e4});}})[_0x6349('0x24')](function(_0x23af63){var _0x425843=_[_0x6349('0x28')](_0x3205b4[_0x6349('0x46')],function(_0x3c9757){_0x3c9757[_0x6349('0x53')]=_0x3205b4[_0x6349('0x42')]['id'];return _0x3c9757;});return db[_0x6349('0x54')]['bulkCreate'](_0x425843,{'raw':!![],'transaction':_0x1983e4});})['then'](function(_0x19b8b0){var _0x1f62b1=_['filter'](_[_0x6349('0x28')](_0x19b8b0,function(_0x3cb015){return _0x3cb015['get']({'plain':!![]});}),{'includeAll':![]});if(_0x1f62b1){return db[_0x6349('0x54')][_0x6349('0x3e')]({'where':{'userProfileId':_0x3205b4[_0x6349('0x42')]['id'],'sectionId':_[_0x6349('0x28')](_0x1f62b1,function(_0x30bf67){return _0x30bf67[_0x6349('0x52')];})},'attributes':['id',_0x6349('0x52')],'raw':!![]})[_0x6349('0x24')](function(_0x4951cb){var _0xf5bb98=_[_0x6349('0x28')](_0x3205b4[_0x6349('0x46')],function(_0x2f67cf){_0x2f67cf[_0x6349('0x53')]=_0x3205b4[_0x6349('0x42')]['id'];return _0x2f67cf;});return db[_0x6349('0x51')][_0x6349('0x67')](_0xf5bb98,{'raw':!![],'transaction':_0x1983e4});});}})[_0x6349('0x40')](handleError(_0x35f45c,null));});}})[_0x6349('0x24')](function(_0x11a8e0){var _0x2018ab=_['map'](_0x11a8e0,function(_0x3c3085){return _0x3c3085[_0x6349('0x4e')]({'plain':!![]});});})[_0x6349('0x24')](respondWithResult(_0x35f45c,null))[_0x6349('0x40')](handleError(_0x35f45c,null));};exports[_0x6349('0x68')]=function(_0x942602,_0x4b2297,_0x52a1b5){return db[_0x6349('0x29')][_0x6349('0x45')]({'where':{'id':_0x942602[_0x6349('0x42')]['id']}})[_0x6349('0x24')](handleEntityNotFound(_0x4b2297,null))[_0x6349('0x24')](function(_0x2d4157){if(_0x2d4157){return _0x2d4157[_0x6349('0x68')](_0x942602[_0x6349('0x2e')][_0x6349('0x5b')]);}})[_0x6349('0x24')](respondWithStatusCode(_0x4b2297,null))[_0x6349('0x40')](handleError(_0x4b2297,null));};exports[_0x6349('0x69')]=function(_0x3b0259,_0x4ead8e){var _0x33130e={'raw':![],'where':{}};var _0xe2fdba={};var _0x289697={'count':0x0,'rows':[]};var _0x3be07c=_0x3b0259[_0x6349('0x2e')][_0x6349('0x6a')];if(typeof _0x3be07c===_0x6349('0x6b')){throw new db[(_0x6349('0x6c'))][(_0x6349('0x6d'))](_0x6349('0x6e'));}var _0x59735f=_0x3b0259['query'][_0x6349('0x6f')]||![];var _0x43e8f0=getQueryModels(_0x3be07c,_0x59735f);if(typeof _0x43e8f0[_0x6349('0x70')]===_0x6349('0x6b')){throw new db[(_0x6349('0x6c'))][(_0x6349('0x6d'))]('Invalid\x20section\x20\x27'+_0x3be07c+'\x27');}var _0x3d80b1=[];if(!_[_0x6349('0x5f')](_0x43e8f0[_0x6349('0x71')])){_0x3d80b1=_0x43e8f0[_0x6349('0x71')];}else{_0x3d80b1=[{'name':_0x3be07c}];}return db['UserProfile'][_0x6349('0x61')]({'where':{'id':_0x3b0259[_0x6349('0x42')]['id']}})[_0x6349('0x24')](handleEntityNotFound(_0x4ead8e,null))[_0x6349('0x24')](function(_0x49b771){if(_0x49b771){var _0xa44b56=[];for(var _0x526157=0x0;_0x526157<_0x3d80b1['length'];_0x526157++){_0xa44b56[_0x6349('0x59')](db[_0x6349('0x54')][_0x6349('0x61')]({'where':{'userProfileId':_0x49b771['id'],'name':_0x3d80b1[_0x526157]['name']},'raw':!![]}));}return BPromise[_0x6349('0x72')](_0xa44b56);}})[_0x6349('0x24')](function(_0x319811){var _0xd52ed7=_[_0x6349('0x37')](_0x319811,function(_0x415fd6){return _0x415fd6?_0x415fd6:undefined;});var _0xc74d5e=_[_0x6349('0x37')](_0x3d80b1,[_0x6349('0x73'),!![]]);var _0x1f3c62=_['isEmpty'](_0xd52ed7)&&_[_0x6349('0x5f')](_0xc74d5e)?null:_[_0x6349('0x74')](_0xc74d5e,_0xd52ed7);if(_0x1f3c62){var _0x3fc05b=[];for(var _0x5d5532=0x0;_0x5d5532<_0x1f3c62[_0x6349('0x34')];_0x5d5532++){var _0x4de1ce=_[_0x6349('0x45')](_0x3d80b1,function(_0x1ff49f){return _0x1f3c62[_0x5d5532]?_0x1ff49f[_0x6349('0x26')]===_0x1f3c62[_0x5d5532][_0x6349('0x26')]:null;});if(_0x4de1ce){if(_0x1f3c62[_0x5d5532][_0x6349('0x73')]){_0x3fc05b[_0x6349('0x59')](getAllResources(_0x43e8f0[_0x6349('0x70')],_0x1f3c62[_0x5d5532]));}else{if(!_0x1f3c62[_0x5d5532][_0x6349('0x50')]){_0x3fc05b[_0x6349('0x59')](getAllowedResources(_0x4de1ce,_0x1f3c62[_0x5d5532],_0x43e8f0[_0x6349('0x70')]));}else{if(_0x4de1ce[_0x6349('0x2d')]){_0x3fc05b['push'](getAllFilteredResources(_0x4de1ce,_0x1f3c62[_0x5d5532]));}}}}}return BPromise['all'](_0x3fc05b);}else{return null;}})[_0x6349('0x24')](function(_0x596466){var _0x1b116d=_0x596466;var _0x37a99f=null;if(_0x1b116d){_0x37a99f=_0x1b116d[_0x6349('0x34')]===0x1?_0x1b116d[0x0]:null;}if(_0x37a99f||_0x1b116d){var _0x377bdb=db[_0x43e8f0[_0x6349('0x70')]][_0x6349('0x2a')];_0xe2fdba[_0x6349('0x2d')]=_['keys'](_0x377bdb);_0xe2fdba[_0x6349('0x2e')]=_['keys'](_0x3b0259[_0x6349('0x2e')]);_0xe2fdba[_0x6349('0x30')]=_[_0x6349('0x31')](_0xe2fdba[_0x6349('0x2d')],_0xe2fdba[_0x6349('0x2e')]);_0x33130e['attributes']=_[_0x6349('0x31')](_0xe2fdba[_0x6349('0x2d')],qs[_0x6349('0x33')](_0x3b0259[_0x6349('0x2e')][_0x6349('0x33')]));_0x33130e[_0x6349('0x32')]=_0x33130e['attributes']['length']?_0x33130e[_0x6349('0x32')]:_0xe2fdba[_0x6349('0x2d')];if(!_0x3b0259['query'][_0x6349('0x75')](_0x6349('0x76'))){_0x33130e[_0x6349('0x1e')]=qs[_0x6349('0x1e')](_0x3b0259[_0x6349('0x2e')][_0x6349('0x1e')]);_0x33130e[_0x6349('0x1d')]=qs['offset'](_0x3b0259['query'][_0x6349('0x1d')]);}_0x33130e[_0x6349('0x77')]=qs[_0x6349('0x35')](_0x3b0259[_0x6349('0x2e')][_0x6349('0x35')]);_0x33130e['where']=qs['filters'](_[_0x6349('0x78')](_0x3b0259[_0x6349('0x2e')],_0xe2fdba[_0x6349('0x30')]));if(_0x3b0259[_0x6349('0x2e')][_0x6349('0x37')]){_0x33130e[_0x6349('0x36')]=_['merge'](_0x33130e[_0x6349('0x36')],{'$or':_['map'](_0x377bdb,function(_0x5dca61){if(_0x5dca61[_0x6349('0x39')][_0x6349('0x2c')]!==_0x6349('0x3a')){var _0x566a9b={};_0x566a9b[_0x5dca61['field']]={'$like':'%'+_0x3b0259['query'][_0x6349('0x37')]+'%'};return _0x566a9b;}})});}var _0x3b0f52=[];if(_0x37a99f){var _0x37bb61=_[_0x6349('0x45')](_0x3d80b1,['name',_0x37a99f[_0x6349('0x26')]]);if(_0x37bb61['field']){var _0x563127={};if(_0x43e8f0[_0x6349('0x70')]===_0x6349('0x79')){_0x563127[_0x37bb61[_0x6349('0x7a')]]=_[_0x6349('0x28')](_0x37a99f[_0x6349('0x7b')],'id');}else{_0x563127[_0x37bb61[_0x6349('0x7a')]]=_0x37a99f[_0x6349('0x7b')];}_0x3b0f52[_0x6349('0x59')](_0x563127);}else{_0x33130e['where']['id']=_0x37a99f[_0x6349('0x7b')];}}else{for(var _0x56fbe9=0x0;_0x56fbe9<_0x1b116d[_0x6349('0x34')];_0x56fbe9++){var _0x37bb61=_[_0x6349('0x45')](_0x3d80b1,[_0x6349('0x26'),_0x1b116d[_0x56fbe9][_0x6349('0x26')]]);if(_0x37bb61[_0x6349('0x7c')]){var _0x563127={};_0x563127[_0x37bb61[_0x6349('0x7a')]]=_0x1b116d[_0x56fbe9][_0x6349('0x7b')];_0x3b0f52[_0x6349('0x59')](_0x563127);}else{if(!_0x33130e[_0x6349('0x36')]['id'])_0x33130e[_0x6349('0x36')]['id']=[];_0x1b116d[_0x56fbe9][_0x6349('0x7b')][_0x6349('0x63')](function(_0x28a3b6){_0x33130e[_0x6349('0x36')]['id']['push'](_0x28a3b6);});}}}if(!_[_0x6349('0x5f')](_0x3b0f52)){_0x33130e['where']=_[_0x6349('0x38')](_0x33130e[_0x6349('0x36')],{'$and':{'$or':_0x3b0f52}});}_0x33130e=_[_0x6349('0x38')]({},_0x33130e,_0x3b0259[_0x6349('0x3b')]);if(_0x37a99f&&!_0x37a99f['autoAssociation']&&_0x43e8f0[_0x6349('0x70')]===_0x6349('0x79')){if(_0x3b0259['query'][_0x6349('0x3d')]){_0x33130e[_0x6349('0x44')]=[{'all':!![]}];}return db[_0x43e8f0[_0x6349('0x70')]][_0x6349('0x3e')](_0x33130e)[_0x6349('0x24')](function(_0x20b2b6){var _0xc65471=[];_0x20b2b6[_0x6349('0x63')](function(_0x57ad0f){var _0x497cc7;switch(_0x57ad0f[_0x6349('0x7d')]){case'default':_0x497cc7=_[_0x6349('0x45')](_0x37a99f[_0x6349('0x7b')],function(_0x4291b8){return _0x4291b8['id']===_0x57ad0f[_0x6349('0x7e')]&&_0x4291b8[_0x6349('0x39')]===_0x6349('0x7f');});break;case _0x6349('0x80'):_0x497cc7=_[_0x6349('0x45')](_0x37a99f[_0x6349('0x7b')],function(_0x15d1c9){return _0x15d1c9['id']===_0x57ad0f[_0x6349('0x7e')]&&_0x15d1c9[_0x6349('0x39')]===_0x6349('0x81');});break;}if(_0x497cc7)_0xc65471['push'](_0x57ad0f);});_0x289697[_0x6349('0x3c')]=_0xc65471[_0x6349('0x34')];_0x289697[_0x6349('0x3f')]=_0xc65471;return _0x289697;});}else{return db[_0x43e8f0[_0x6349('0x70')]][_0x6349('0x3c')]({'where':_0x33130e[_0x6349('0x36')]})[_0x6349('0x24')](function(_0x30de82){_0x289697[_0x6349('0x3c')]=_0x30de82;if(_0x3b0259[_0x6349('0x2e')]['includeAll']){if(_0x43e8f0[_0x6349('0x70')]===_0x6349('0x82')){_0x33130e['include']=[{'model':db[_0x6349('0x83')],'as':'Tags','attributes':['id',_0x6349('0x26'),_0x6349('0x84')],'required':_0x3b0259[_0x6349('0x2e')][_0x6349('0x85')]?!![]:![]},{'model':db[_0x6349('0x83')],'as':_0x6349('0x86'),'attributes':['id','name',_0x6349('0x84')],'through':_0x3b0259[_0x6349('0x2e')][_0x6349('0x85')]?{'attributes':[],'where':{'TagId':_0x3b0259['query']['tag']||undefined}}:{},'required':_0x3b0259[_0x6349('0x2e')][_0x6349('0x85')]?!![]:![]}];}else{_0x33130e[_0x6349('0x44')]=[{'all':!![]}];}}return db[_0x43e8f0[_0x6349('0x70')]][_0x6349('0x3e')](_0x33130e);})[_0x6349('0x24')](function(_0x1c715c){_0x289697[_0x6349('0x3f')]=_0x1c715c;return _0x289697;});}}else{return _0x289697;}})['then'](respondWithFilteredResult(_0x4ead8e,_0x33130e))[_0x6349('0x40')](handleError(_0x4ead8e,null));};function getAllResources(_0x1f5f8f,_0x65568d){return new BPromise(function(_0x47232e,_0x58519b){if(_0x65568d){var _0x362de7=_0x65568d['filter']?{[_0x65568d[_0x6349('0x37')]['field']]:_0x65568d[_0x6349('0x37')][_0x6349('0x87')]}:undefined;return db[_0x1f5f8f]['findAll']({'where':_0x362de7,'raw':!![]})[_0x6349('0x24')](function(_0x54d224){_0x65568d[_0x6349('0x7b')]=_[_0x6349('0x28')](_0x54d224,'id');_0x47232e(_0x65568d);})[_0x6349('0x40')](function(_0x2cddd4){_0x58519b(_0x2cddd4);});}else{_0x47232e(null);}});}function getAllFilteredResources(_0xcd8b62,_0x2d18a7){return new BPromise(function(_0x26c421,_0x228111){var _0x394b50=_0xcd8b62[_0x6349('0x37')]?{[_0xcd8b62['filter'][_0x6349('0x7c')]]:_0xcd8b62['filter']['value']}:undefined;return db[_0xcd8b62[_0x6349('0x2d')]][_0x6349('0x3e')]({'where':_0x394b50,'raw':!![]})[_0x6349('0x24')](function(_0x454167){_0x2d18a7['associatedResources']=_['map'](_0x454167,function(_0x5b82bb){return _0x5b82bb[_0x6349('0x26')];});_0x26c421(_0x2d18a7);})['catch'](function(_0x47d31d){_0x228111(_0x47d31d);});});}function getAllowedResources(_0x121bf4,_0x39a772,_0x987c39){return new BPromise(function(_0x56e145,_0x1e743e){if(_0x39a772){return db[_0x6349('0x51')]['findAll']({'where':{'sectionId':_0x39a772['id']},'raw':!![]})['then'](function(_0x1a295d){if(_0x121bf4[_0x6349('0x7c')]&&_0x121bf4[_0x6349('0x7c')]!=='id'){_0x39a772['associatedResources']=_[_0x6349('0x28')](_0x1a295d,function(_0x436552){return _0x436552[_0x121bf4['field']];});}else{if(_0x987c39==='AnalyticExtractedReport'){_0x39a772[_0x6349('0x7b')]=_[_0x6349('0x28')](_0x1a295d,function(_0x4916bd){return{'id':_0x4916bd[_0x6349('0x64')],'type':_0x4916bd[_0x6349('0x39')]};});}else{_0x39a772['associatedResources']=_['map'](_0x1a295d,function(_0x4cea7a){return _0x4cea7a[_0x6349('0x64')];});}}_0x56e145(_0x39a772);})[_0x6349('0x40')](function(_0x563666){_0x1e743e(_0x563666);});}else{_0x56e145(null);}});}function getQueryModels(_0x896e31,_0x35c68a){var _0x252672=_0x896e31[_0x6349('0x88')]();var _0x4c7bd3={'childModel':undefined,'parentSections':[]};switch(_0x252672){case _0x6349('0x89'):_0x4c7bd3['childModel']='SquareProject';break;case _0x6349('0x8a'):_0x4c7bd3[_0x6349('0x70')]='SquareOdbc';break;case'squarerecordings':_0x4c7bd3[_0x6349('0x70')]='SquareRecording';_0x4c7bd3['parentSections']=[{'name':'SquareProjects','field':_0x6349('0x26'),'foreignKey':_0x6349('0x8b')}];break;case'projects':_0x4c7bd3[_0x6349('0x70')]='JscriptyProject';break;case'contacts':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x82');_0x4c7bd3[_0x6349('0x71')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x6349('0x8c'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x8d');break;case _0x6349('0x8e'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x8f');break;case _0x6349('0x90'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x91');break;case _0x6349('0x92'):_0x4c7bd3['childModel']='ChatQueue';break;case _0x6349('0x93'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x94');break;case _0x6349('0x95'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x96');break;case _0x6349('0x97'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x98');break;case _0x6349('0x99'):case _0x6349('0x9a'):case _0x6349('0x9b'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x9c');break;case _0x6349('0x9d'):_0x4c7bd3['childModel']='VoiceContext';break;case _0x6349('0x9e'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x9f');break;case _0x6349('0xa0'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xa1');_0x4c7bd3[_0x6349('0x71')]=[{'name':_0x6349('0xa2'),'field':_0x6349('0x26'),'foreignKey':'membername','model':_0x6349('0xa3'),'filter':{'field':'role','value':[_0x6349('0xa4')]}},{'name':_0x6349('0xa5'),'field':_0x6349('0x26'),'foreignKey':_0x6349('0xa6'),'model':_0x6349('0xa3'),'filter':{'field':_0x6349('0xa7'),'value':[_0x6349('0xa8')]}},{'name':'VoiceQueues','field':_0x6349('0x26'),'foreignKey':'queue','model':_0x6349('0xa9'),'filter':{'field':_0x6349('0x39'),'value':[_0x6349('0xaa')]}},{'name':_0x6349('0xab'),'field':_0x6349('0x26'),'foreignKey':_0x6349('0xac'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x6349('0xad')]}}];break;case _0x6349('0xae'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xaf');break;case'chanspies':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xb0');break;case _0x6349('0xb1'):_0x4c7bd3[_0x6349('0x70')]='VoicePrefix';break;case'ivrcampaigns':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xb2');break;case _0x6349('0xb3'):_0x4c7bd3['childModel']=_0x6349('0xb4');break;case _0x6349('0xb5'):_0x4c7bd3[_0x6349('0x70')]='MailAccount';break;case _0x6349('0xb6'):_0x4c7bd3[_0x6349('0x70')]='MailSubstatus';break;case _0x6349('0xb7'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xb8');break;case'openchannelaccounts':_0x4c7bd3[_0x6349('0x70')]='OpenchannelAccount';break;case _0x6349('0xb9'):_0x4c7bd3['childModel']=_0x6349('0xba');break;case _0x6349('0xbb'):_0x4c7bd3['childModel']='SmsAccount';break;case _0x6349('0xbc'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xbd');break;case'whatsappaccounts':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xbe');break;case'teams':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xbf');break;case _0x6349('0xc0'):case _0x6349('0xc1'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xa9');if(_0x35c68a){_0x4c7bd3[_0x6349('0x71')]=[{'name':_0x6349('0xc2')},{'name':'QueueCampaigns'}];}break;case _0x6349('0xc3'):case _0x6349('0xc4'):case _0x6349('0xc5'):_0x4c7bd3['childModel']=_0x6349('0xa3');if(_0x35c68a){_0x4c7bd3['parentSections']=[{'name':_0x6349('0xc6'),'filter':{'field':_0x6349('0xa7'),'value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x6349('0xa5')}];}break;case _0x6349('0xc7'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xc8');break;case'salesforceaccounts':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xc9');break;case _0x6349('0xca'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xcb');break;case _0x6349('0xcc'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xcd');break;case _0x6349('0xce'):_0x4c7bd3[_0x6349('0x70')]='DeskAccount';break;case _0x6349('0xcf'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xd0');break;case _0x6349('0xd1'):_0x4c7bd3['childModel']='User';break;case _0x6349('0xd2'):_0x4c7bd3[_0x6349('0x70')]='CannedAnswer';break;case _0x6349('0xd3'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xd4');break;case _0x6349('0xd5'):_0x4c7bd3[_0x6349('0x70')]='Dashboard';break;case'intervals':_0x4c7bd3['childModel']=_0x6349('0xd6');break;case _0x6349('0xd7'):_0x4c7bd3['childModel']='Pause';break;case _0x6349('0xd8'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xd9');break;case _0x6349('0xda'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xdb');break;case'tags':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x83');break;case _0x6349('0xdc'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xdd');break;case _0x6349('0xde'):_0x4c7bd3[_0x6349('0x70')]='Trigger';break;case _0x6349('0xdf'):_0x4c7bd3['childModel']=_0x6349('0xe0');break;case'variables':_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xe1');break;case _0x6349('0xe2'):_0x4c7bd3['childModel']=_0x6349('0x65');break;case _0x6349('0xe3'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0x79');_0x4c7bd3[_0x6349('0x71')]=[{'name':_0x6349('0xe4'),'field':'id','foreignKey':_0x6349('0x7e')}];break;case _0x6349('0xe5'):_0x4c7bd3[_0x6349('0x70')]='AnalyticMetric';break;case _0x6349('0xe6'):_0x4c7bd3[_0x6349('0x70')]=_0x6349('0xbe');break;default:return _0x4c7bd3;}return _0x4c7bd3;} \ No newline at end of file +var _0x5089=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','catch','clone','params','find','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','get','each','autoAssociation','UserProfileResource','sectionId','userProfileId','UserProfileSection','Resources','describe','addSections','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','mergeResources','childModel','Sequelize','Invalid\x20section\x20\x27','parentSections','all','ignore','order','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','DefaultReports','custom','CustomReports','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','users','agents','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','templates','Template','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','reportId','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/utils','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5089,0x1d1));var _0x9508=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x5089[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x9508('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9508('0x1'));var zipdir=require(_0x9508('0x2'));var jsonpatch=require(_0x9508('0x3'));var rp=require(_0x9508('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9508('0x5'));var util=require(_0x9508('0x6'));var path=require(_0x9508('0x7'));var sox=require(_0x9508('0x8'));var csv=require('to-csv');var ejs=require(_0x9508('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9508('0xa'));var crypto=require(_0x9508('0xb'));var jsforce=require(_0x9508('0xc'));var deskjs=require(_0x9508('0xd'));var toCsv=require(_0x9508('0xe'));var querystring=require(_0x9508('0xf'));var Papa=require(_0x9508('0x10'));var Redis=require(_0x9508('0x11'));var authService=require(_0x9508('0x12'));var qs=require(_0x9508('0x13'));var as=require(_0x9508('0x14'));var hardwareService=require(_0x9508('0x15'));var logger=require('../../config/logger')(_0x9508('0x16'));var utils=require(_0x9508('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9508('0x18'));var db=require(_0x9508('0x19'))['db'];config['redis']=_[_0x9508('0x1a')](config[_0x9508('0x1b')],{'host':_0x9508('0x1c'),'port':0x18eb});var socket=require(_0x9508('0x1d'))(new Redis(config['redis']));require('./userProfile.socket')[_0x9508('0x1e')](socket);function respondWithStatusCode(_0x214017,_0x1b1bba){_0x1b1bba=_0x1b1bba||0xcc;return function(_0x377839){if(_0x377839){return _0x214017['sendStatus'](_0x1b1bba);}return _0x214017[_0x9508('0x1f')](_0x1b1bba)[_0x9508('0x20')]();};}function respondWithResult(_0x59523d,_0x425d9c){_0x425d9c=_0x425d9c||0xc8;return function(_0xbb3918){if(_0xbb3918){return _0x59523d[_0x9508('0x1f')](_0x425d9c)[_0x9508('0x21')](_0xbb3918);}};}function respondWithFilteredResult(_0x121d11,_0xc29ca8){return function(_0x52e0a6){if(_0x52e0a6){var _0x378a14=_0x52e0a6[_0x9508('0x22')],_0x2c8b49=_0xc29ca8['offset'],_0x4cce7f=_0xc29ca8[_0x9508('0x23')]+_0xc29ca8[_0x9508('0x24')],_0x1bcba4;if(_0x4cce7f>=_0x378a14){_0x4cce7f=_0x378a14;_0x1bcba4=0xc8;}else{_0x1bcba4=0xce;}_0x121d11[_0x9508('0x1f')](_0x1bcba4);return _0x121d11['set'](_0x9508('0x25'),_0x2c8b49+'-'+_0x4cce7f+'/'+_0x378a14)['json'](_0x52e0a6);}return null;};}function patchUpdates(_0x4bae78){return function(_0xba3f6e){try{jsonpatch[_0x9508('0x26')](_0xba3f6e,_0x4bae78,!![]);}catch(_0x9a7843){return BPromise[_0x9508('0x27')](_0x9a7843);}return _0xba3f6e[_0x9508('0x28')]();};}function saveUpdates(_0x33692b,_0x175355){return function(_0xbed6eb){if(_0xbed6eb){return _0xbed6eb[_0x9508('0x29')](_0x33692b)['then'](function(_0x4f202d){return _0x4f202d;});}return null;};}function removeEntity(_0x2041fc,_0x355841){return function(_0x3f7bd1){if(_0x3f7bd1){return _0x3f7bd1[_0x9508('0x2a')]()[_0x9508('0x2b')](function(){_0x2041fc[_0x9508('0x1f')](0xcc)[_0x9508('0x20')]();});}};}function handleEntityNotFound(_0x4a67b4,_0x1c6dd7){return function(_0x230902){if(!_0x230902){_0x4a67b4['sendStatus'](0x194);}return _0x230902;};}function handleError(_0x1a1a98,_0x157795){_0x157795=_0x157795||0x1f4;return function(_0x4bfc48){logger[_0x9508('0x2c')](_0x4bfc48['stack']);if(_0x4bfc48[_0x9508('0x2d')]){delete _0x4bfc48[_0x9508('0x2d')];}_0x1a1a98[_0x9508('0x1f')](_0x157795)[_0x9508('0x2e')](_0x4bfc48);};}exports['index']=function(_0x10c061,_0x5bbce9){var _0x9541f8={},_0x5efc91={},_0x477cc4={'count':0x0,'rows':[]};var _0xed6734=_[_0x9508('0x2f')](db[_0x9508('0x30')][_0x9508('0x31')],function(_0x5fc81){return{'name':_0x5fc81[_0x9508('0x32')],'type':_0x5fc81[_0x9508('0x33')][_0x9508('0x34')]};});_0x5efc91[_0x9508('0x35')]=_[_0x9508('0x2f')](_0xed6734,'name');_0x5efc91[_0x9508('0x36')]=_[_0x9508('0x37')](_0x10c061['query']);_0x5efc91[_0x9508('0x38')]=_[_0x9508('0x39')](_0x5efc91['model'],_0x5efc91[_0x9508('0x36')]);_0x9541f8[_0x9508('0x3a')]=_[_0x9508('0x39')](_0x5efc91[_0x9508('0x35')],qs[_0x9508('0x3b')](_0x10c061[_0x9508('0x36')][_0x9508('0x3b')]));_0x9541f8[_0x9508('0x3a')]=_0x9541f8[_0x9508('0x3a')][_0x9508('0x3c')]?_0x9541f8[_0x9508('0x3a')]:_0x5efc91[_0x9508('0x35')];if(!_0x10c061['query'][_0x9508('0x3d')](_0x9508('0x3e'))){_0x9541f8[_0x9508('0x24')]=qs[_0x9508('0x24')](_0x10c061[_0x9508('0x36')]['limit']);_0x9541f8[_0x9508('0x23')]=qs[_0x9508('0x23')](_0x10c061[_0x9508('0x36')]['offset']);}_0x9541f8['order']=qs[_0x9508('0x3f')](_0x10c061[_0x9508('0x36')][_0x9508('0x3f')]);_0x9541f8[_0x9508('0x40')]=qs['filters'](_[_0x9508('0x41')](_0x10c061['query'],_0x5efc91[_0x9508('0x38')]),_0xed6734);if(_0x10c061[_0x9508('0x36')][_0x9508('0x42')]){_0x9541f8[_0x9508('0x40')]=_[_0x9508('0x43')](_0x9541f8[_0x9508('0x40')],{'$or':_[_0x9508('0x2f')](_0xed6734,function(_0x2949bc){if(_0x2949bc['type']!==_0x9508('0x44')){var _0x550a7e={};_0x550a7e[_0x2949bc[_0x9508('0x2d')]]={'$like':'%'+_0x10c061[_0x9508('0x36')]['filter']+'%'};return _0x550a7e;}})});}_0x9541f8=_[_0x9508('0x43')]({},_0x9541f8,_0x10c061[_0x9508('0x45')]);var _0xc3c69f={'where':_0x9541f8[_0x9508('0x40')]};return db[_0x9508('0x30')][_0x9508('0x22')](_0xc3c69f)['then'](function(_0x3ce2e1){_0x477cc4[_0x9508('0x22')]=_0x3ce2e1;if(_0x10c061[_0x9508('0x36')][_0x9508('0x46')]){_0x9541f8[_0x9508('0x47')]=[{'all':!![]}];}return db[_0x9508('0x30')][_0x9508('0x48')](_0x9541f8);})[_0x9508('0x2b')](function(_0x22103f){_0x477cc4[_0x9508('0x49')]=_0x22103f;return _0x477cc4;})[_0x9508('0x2b')](respondWithFilteredResult(_0x5bbce9,_0x9541f8))['catch'](handleError(_0x5bbce9,null));};exports[_0x9508('0x4a')]=function(_0x489889,_0x559e32){var _0x512194={'raw':![],'where':{'id':_0x489889['params']['id']}},_0x50c97b={};_0x50c97b[_0x9508('0x35')]=_[_0x9508('0x37')](db['UserProfile'][_0x9508('0x31')]);_0x50c97b['query']=_[_0x9508('0x37')](_0x489889[_0x9508('0x36')]);_0x50c97b['filtears']=_[_0x9508('0x39')](_0x50c97b[_0x9508('0x35')],_0x50c97b['query']);_0x512194[_0x9508('0x3a')]=_[_0x9508('0x39')](_0x50c97b[_0x9508('0x35')],qs[_0x9508('0x3b')](_0x489889[_0x9508('0x36')][_0x9508('0x3b')]));_0x512194[_0x9508('0x3a')]=_0x512194[_0x9508('0x3a')]['length']?_0x512194[_0x9508('0x3a')]:_0x50c97b[_0x9508('0x35')];if(_0x489889[_0x9508('0x36')][_0x9508('0x46')]){_0x512194[_0x9508('0x47')]=[{'all':!![]}];}_0x512194=_[_0x9508('0x43')]({},_0x512194,_0x489889[_0x9508('0x45')]);return db[_0x9508('0x30')]['find'](_0x512194)[_0x9508('0x2b')](handleEntityNotFound(_0x559e32,null))[_0x9508('0x2b')](respondWithResult(_0x559e32,null))['catch'](handleError(_0x559e32,null));};exports[_0x9508('0x4b')]=function(_0x32af44,_0x1328a8){return db[_0x9508('0x30')]['create'](_0x32af44['body'],{})[_0x9508('0x2b')](respondWithResult(_0x1328a8,0xc9))[_0x9508('0x4c')](handleError(_0x1328a8,null));};exports[_0x9508('0x4d')]=function(_0x1c3ede,_0x1089a7){var _0x2a6d85={'where':{'id':_0x1c3ede[_0x9508('0x4e')]['id']}},_0x2ffed2={};_0x2ffed2[_0x9508('0x35')]=_[_0x9508('0x37')](db[_0x9508('0x30')][_0x9508('0x31')]);_0x2a6d85['attributes']=_[_0x9508('0x39')](_0x2ffed2[_0x9508('0x35')],qs[_0x9508('0x3b')](_0x1c3ede[_0x9508('0x36')][_0x9508('0x3b')]));_0x2a6d85[_0x9508('0x3a')]=_0x2a6d85['attributes'][_0x9508('0x3c')]?_0x2a6d85[_0x9508('0x3a')]:_0x2ffed2['model'];if(_0x1c3ede[_0x9508('0x36')][_0x9508('0x46')]){_0x2a6d85['include']=[{'all':!![]}];}_0x2a6d85=_[_0x9508('0x43')]({},_0x2a6d85,_0x1c3ede['options']);return db[_0x9508('0x30')][_0x9508('0x4f')](_0x2a6d85)['then'](handleEntityNotFound(_0x1089a7,null))[_0x9508('0x2b')](function(_0x24b19a){if(_0x24b19a){var _0x405847=_0x24b19a['get']({'plain':!![]});_0x405847=qs[_0x9508('0x50')](_0x405847,['id',_0x9508('0x51'),_0x9508('0x52'),_0x9508('0x53')]);_0x1c3ede['body']=_[_0x9508('0x50')](_0x1c3ede[_0x9508('0x54')],['id','createdAt',_0x9508('0x52')]);return db[_0x9508('0x55')][_0x9508('0x56')](function(_0x323d76){return db[_0x9508('0x30')][_0x9508('0x4b')](_['merge'](_0x405847,_0x1c3ede[_0x9508('0x54')]),{'include':_0x1c3ede[_0x9508('0x36')][_0x9508('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x323d76})[_0x9508('0x2b')](function(_0x45231f){var _0x22300c=_0x45231f[_0x9508('0x57')]({'plain':!![]});return db['UserProfileSection'][_0x9508('0x48')]({'where':{'userProfileId':_0x1c3ede[_0x9508('0x4e')]['id']},'raw':!![]})[_0x9508('0x2b')](function(_0xfe5915){if(_0xfe5915){return BPromise[_0x9508('0x58')](_0xfe5915,function(_0x3d7d63){return new BPromise(function(_0x34b950,_0x566b11){if(_0x3d7d63[_0x9508('0x59')]===null||_0x3d7d63['autoAssociation']===0x1)_0x34b950(null);return db[_0x9508('0x5a')][_0x9508('0x48')]({'where':{'sectionId':_0x3d7d63['id']},'raw':!![]})[_0x9508('0x2b')](function(_0x1a3f8f){var _0x349305=_['map'](_0x1a3f8f,function(_0x3168ce){return qs['omit'](_0x3168ce,['id',_0x9508('0x51'),_0x9508('0x52'),_0x9508('0x5b')]);});_0x34b950(_0x349305);})[_0x9508('0x4c')](function(_0x25ef42){_0x566b11(_0x25ef42);});})[_0x9508('0x2b')](function(_0x4856e2){var _0x197059=qs['omit'](_0x3d7d63,['id',_0x9508('0x51'),'updatedAt']);_0x197059[_0x9508('0x5c')]=_0x22300c['id'];if(_0x4856e2)_0x197059['Resources']=_0x4856e2;return _0x197059;})['then'](function(_0x22fc47){return db[_0x9508('0x5d')][_0x9508('0x4b')](_0x22fc47,{'include':[{'model':db['UserProfileResource'],'as':_0x9508('0x5e')}],'raw':!![],'transaction':_0x323d76});});})[_0x9508('0x2b')](function(){return _0x22300c;});}});});});}})[_0x9508('0x2b')](respondWithResult(_0x1089a7,0xc9))[_0x9508('0x4c')](handleError(_0x1089a7,null));};exports['update']=function(_0x3d89da,_0x404bc2){if(_0x3d89da[_0x9508('0x54')]['id']){delete _0x3d89da['body']['id'];}return db[_0x9508('0x30')][_0x9508('0x4f')]({'where':{'id':_0x3d89da[_0x9508('0x4e')]['id']}})[_0x9508('0x2b')](handleEntityNotFound(_0x404bc2,null))[_0x9508('0x2b')](saveUpdates(_0x3d89da[_0x9508('0x54')],null))[_0x9508('0x2b')](respondWithResult(_0x404bc2,null))[_0x9508('0x4c')](handleError(_0x404bc2,null));};exports[_0x9508('0x2a')]=function(_0x16c1ac,_0x15025b){return db[_0x9508('0x30')][_0x9508('0x4f')]({'where':{'id':_0x16c1ac[_0x9508('0x4e')]['id']}})[_0x9508('0x2b')](handleEntityNotFound(_0x15025b,null))[_0x9508('0x2b')](removeEntity(_0x15025b,null))[_0x9508('0x4c')](handleError(_0x15025b,null));};exports[_0x9508('0x5f')]=function(_0x5cbfba,_0x24d567){return db['UserProfile'][_0x9508('0x5f')]()['then'](respondWithResult(_0x24d567,null))['catch'](handleError(_0x24d567,null));};exports[_0x9508('0x60')]=function(_0xc935d1,_0xf57a81){var _0x265056=_0xc935d1[_0x9508('0x54')];return db[_0x9508('0x30')]['find']({'where':{'id':_0xc935d1['params']['id']}})[_0x9508('0x2b')](handleEntityNotFound(_0xf57a81,null))['then'](function(_0x5e8a78){if(_0x5e8a78){return db[_0x9508('0x55')]['transaction'](function(_0x534aec){return db[_0x9508('0x5d')][_0x9508('0x2a')]({'where':{'userProfileId':_0xc935d1[_0x9508('0x4e')]['id'],'sectionId':_[_0x9508('0x2f')](_0x265056,function(_0x3ea6a7){return _0x3ea6a7['sectionId'];})},'transaction':_0x534aec})['then'](function(){var _0x10c0a5=_[_0x9508('0x2f')](_0x265056,function(_0x154c22){_0x154c22[_0x9508('0x5c')]=_0xc935d1['params']['id'];return _0x154c22;});var _0x124dc5=[];return BPromise[_0x9508('0x58')](_0x10c0a5,function(_0x22ab4d){return db['UserProfileSection']['create'](_0x22ab4d,{'include':[{'model':db[_0x9508('0x5a')],'as':_0x9508('0x5e')}],'raw':!![],'transaction':_0x534aec})[_0x9508('0x2b')](function(_0x27baef){_0x124dc5[_0x9508('0x61')](_0x27baef[_0x9508('0x57')]({'plain':!![]}));});})[_0x9508('0x2b')](function(){return _0x124dc5;});});});}})[_0x9508('0x2b')](function(_0x2e2d5c){return _0x2e2d5c;})['then'](respondWithResult(_0xf57a81,null))[_0x9508('0x4c')](handleError(_0xf57a81,null));};exports[_0x9508('0x62')]=function(_0x48f343,_0x2e2f8d){var _0x4e54e3;return db[_0x9508('0x30')]['find']({'where':{'id':_0x48f343[_0x9508('0x4e')]['id']},'attributes':['id',_0x9508('0x2d')]})[_0x9508('0x2b')](handleEntityNotFound(_0x2e2f8d,null))[_0x9508('0x2b')](function(_0xcfd821){if(_0xcfd821){_0x4e54e3=_0xcfd821;return db[_0x9508('0x5d')]['destroy']({'where':{'userProfileId':_0x48f343[_0x9508('0x4e')]['id'],'sectionId':_0x48f343[_0x9508('0x36')][_0x9508('0x63')]}});}})['then'](function(){return _0x4e54e3;})[_0x9508('0x2b')](respondWithStatusCode(_0x2e2f8d,null))['catch'](handleError(_0x2e2f8d,null));};exports[_0x9508('0x64')]=function(_0x36db9f,_0x3cd2ae){var _0xf0b911=[];var _0x220871=[];return db[_0x9508('0x5d')][_0x9508('0x48')]({'where':{'userProfileId':_0x36db9f[_0x9508('0x4e')]['id']},'raw':!![]})[_0x9508('0x2b')](function(_0x5d0cd5){_0xf0b911=_[_0x9508('0x42')](_0x5d0cd5,function(_0x4a8216){return _0x4a8216['enabled']===0x1||_[_0x9508('0x65')]([0x3eb,0x709],_0x4a8216[_0x9508('0x5b')]);});if(!_[_0x9508('0x66')](_0xf0b911)){return _[_0x9508('0x2f')](_0xf0b911,function(_0x247e45){return _0x247e45['sectionId'];});}else{return;}})[_0x9508('0x2b')](function(_0xe8f49e){if(_0xe8f49e)_0x220871=_0xe8f49e;if(_[_0x9508('0x65')](_0x220871,0x64)){var _0x51541d=_['find'](_0xf0b911,{'sectionId':0x64});return hasDefaultDashboard(_0x51541d)[_0x9508('0x2b')](function(_0x43be37){return _[_0x9508('0x2f')](_0xf0b911,function(_0x3f90b3){if(_0x3f90b3['sectionId']===0x64){_0x3f90b3[_0x9508('0x67')]=_0x43be37;}return _0x3f90b3;});});}else{return;}})[_0x9508('0x2b')](function(_0x255b0a){if(_0x255b0a)_0xf0b911=_0x255b0a;if(_['includes'](_0x220871,0x3eb)){var _0x3d3392=_[_0x9508('0x4f')](_0xf0b911,{'sectionId':0x3eb});return getCustomDashboards(_0x3d3392)[_0x9508('0x2b')](function(_0xfc331){return _[_0x9508('0x2f')](_0xf0b911,function(_0x2be7ba){if(_0x3d3392[_0x9508('0x68')]){if(_0x2be7ba['sectionId']===0x3eb){_0x2be7ba[_0x9508('0x67')]=_0xfc331;}}else{if(_0x2be7ba[_0x9508('0x5b')]===0x64){_0x2be7ba['subsections']=_0xfc331;}}return _0x2be7ba;});});}else{return;}})['then'](function(_0x59c5be){if(_0x59c5be)_0xf0b911=_0x59c5be;if(_[_0x9508('0x65')](_0x220871,0x709)){var _0x171cd3=_[_0x9508('0x4f')](_0xf0b911,{'sectionId':0x709});return getPlugins(_0x171cd3)[_0x9508('0x2b')](function(_0x74ad2){if(_0x171cd3[_0x9508('0x68')]){return _['map'](_0xf0b911,function(_0x335eb2){if(_0x335eb2['sectionId']===0x709){_0x335eb2[_0x9508('0x67')]=_0x74ad2;}return _0x335eb2;});}else{var _0x1bdb91={'sectionId':0x76c,'enabled':0x1,'subsections':_0x74ad2};var _0x226817=_[_0x9508('0x2f')](_0xf0b911);_0x226817[_0x9508('0x61')](_0x1bdb91);return _0x226817;}});}else{return;}})[_0x9508('0x2b')](function(_0x3cc1d8){if(_0x3cc1d8)_0xf0b911=_0x3cc1d8;return _[_0x9508('0x42')](_0xf0b911,[_0x9508('0x68'),0x1]);})[_0x9508('0x2b')](respondWithResult(_0x3cd2ae,null))[_0x9508('0x4c')](handleError(_0x3cd2ae,null));};function hasDefaultDashboard(_0x295978){var _0x6f6325=[0x65];return new BPromise(function(_0x350d83,_0x33a071){try{if(_0x295978[_0x9508('0x59')]){_0x350d83(_0x6f6325);}else{return db[_0x9508('0x5a')][_0x9508('0x69')]({'where':{'sectionId':_0x295978['id']},'raw':!![]})['then'](function(_0x401ed9){_0x401ed9?_0x350d83(_0x6f6325):_0x350d83();});}}catch(_0x3ecfa6){_0x33a071(_0x3ecfa6);}});}function getCustomDashboards(_0x3a62fb){var _0xdb0156=[];return new BPromise(function(_0x369b31,_0x1aa0be){try{if(_0x3a62fb[_0x9508('0x59')]){return db[_0x9508('0x6a')][_0x9508('0x48')]({'raw':!![]})[_0x9508('0x2b')](function(_0x15da85){_0x15da85[_0x9508('0x6b')](function(_0x4e61db){_0xdb0156['push'](_0x4e61db['id']+0x1869f);});_0x369b31(_0xdb0156);});}else{return db['UserProfileResource'][_0x9508('0x48')]({'where':{'sectionId':_0x3a62fb['id']},'raw':!![]})[_0x9508('0x2b')](function(_0x4137cf){_0x4137cf[_0x9508('0x6b')](function(_0xaf608d){_0xdb0156[_0x9508('0x61')](_0xaf608d[_0x9508('0x6c')]+0x1869f);});_0x369b31(_0xdb0156);});}}catch(_0x4a49d0){_0x1aa0be(_0x4a49d0);}});}function getPlugins(_0x3d39c2){var _0x4906be=[];return new BPromise(function(_0x2a80bf,_0x45669c){try{if(_0x3d39c2[_0x9508('0x59')]){return db['Plugin'][_0x9508('0x48')]({'raw':!![]})[_0x9508('0x2b')](function(_0x54e41e){_0x54e41e[_0x9508('0x6b')](function(_0x246f43){_0x4906be['push'](_0x246f43['id']+0x15b38);});_0x2a80bf(_0x4906be);});}else{return db[_0x9508('0x5a')][_0x9508('0x48')]({'where':{'sectionId':_0x3d39c2['id']},'raw':!![]})[_0x9508('0x2b')](function(_0x20501c){_0x20501c[_0x9508('0x6b')](function(_0x47382f){_0x4906be['push'](_0x47382f[_0x9508('0x6c')]+0x15b38);});_0x2a80bf(_0x4906be);});}}catch(_0x17ba2e){_0x45669c(_0x17ba2e);}});}exports[_0x9508('0x6d')]=function(_0x4cd998,_0x22eb0b){return db[_0x9508('0x30')][_0x9508('0x4f')]({'where':{'id':_0x4cd998[_0x9508('0x4e')]['id']}})['then'](handleEntityNotFound(_0x22eb0b,null))[_0x9508('0x2b')](function(_0x446454){if(_0x446454){return db[_0x9508('0x55')][_0x9508('0x56')](function(_0x33d6b8){return db['UserProfileSection'][_0x9508('0x48')]({'where':{'userProfileId':_0x4cd998[_0x9508('0x4e')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xaafdcc){if(_0xaafdcc){return db[_0x9508('0x5d')][_0x9508('0x2a')]({'where':{'userProfileId':_0x4cd998['params']['id'],'id':_[_0x9508('0x2f')](_0xaafdcc,function(_0x35a958){return _0x35a958['id'];})},'transaction':_0x33d6b8});}})[_0x9508('0x2b')](function(_0x257293){var _0x33f429=_[_0x9508('0x2f')](_0x4cd998[_0x9508('0x54')],function(_0x25ec3c){_0x25ec3c[_0x9508('0x5c')]=_0x4cd998[_0x9508('0x4e')]['id'];return _0x25ec3c;});return db['UserProfileSection'][_0x9508('0x6e')](_0x33f429,{'raw':!![],'transaction':_0x33d6b8});})[_0x9508('0x2b')](function(_0x265ba2){var _0x2c6828=_[_0x9508('0x42')](_['map'](_0x265ba2,function(_0x31ff51){return _0x31ff51['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2c6828){return db[_0x9508('0x5d')][_0x9508('0x48')]({'where':{'userProfileId':_0x4cd998['params']['id'],'sectionId':_[_0x9508('0x2f')](_0x2c6828,function(_0x376a0c){return _0x376a0c[_0x9508('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x9508('0x2b')](function(_0x3106d3){var _0x237796=_['map'](_0x4cd998['body'],function(_0x46261b){_0x46261b[_0x9508('0x5c')]=_0x4cd998[_0x9508('0x4e')]['id'];return _0x46261b;});return db[_0x9508('0x5a')][_0x9508('0x6e')](_0x237796,{'raw':!![],'transaction':_0x33d6b8});});}})[_0x9508('0x4c')](handleError(_0x22eb0b,null));});}})[_0x9508('0x2b')](function(_0x8325ad){var _0x465082=_[_0x9508('0x2f')](_0x8325ad,function(_0x58164b){return _0x58164b[_0x9508('0x57')]({'plain':!![]});});})[_0x9508('0x2b')](respondWithResult(_0x22eb0b,null))[_0x9508('0x4c')](handleError(_0x22eb0b,null));};exports['removeResources']=function(_0x2e83a0,_0x115247,_0x38158b){return db[_0x9508('0x30')]['find']({'where':{'id':_0x2e83a0[_0x9508('0x4e')]['id']}})[_0x9508('0x2b')](handleEntityNotFound(_0x115247,null))[_0x9508('0x2b')](function(_0x2e163e){if(_0x2e163e){return _0x2e163e[_0x9508('0x6f')](_0x2e83a0[_0x9508('0x36')][_0x9508('0x63')]);}})[_0x9508('0x2b')](respondWithStatusCode(_0x115247,null))[_0x9508('0x4c')](handleError(_0x115247,null));};exports[_0x9508('0x70')]=function(_0x5ed199,_0x34bf3a){var _0x42a8b5={'raw':![],'where':{}};var _0x329ef7={};var _0x31ea4c={'count':0x0,'rows':[]};var _0x369693=_0x5ed199[_0x9508('0x36')][_0x9508('0x71')];if(typeof _0x369693===_0x9508('0x72')){throw new db['Sequelize'][(_0x9508('0x73'))](_0x9508('0x74'));}var _0x207416=_0x5ed199[_0x9508('0x36')][_0x9508('0x75')]||![];var _0x170462=getQueryModels(_0x369693,_0x207416);if(typeof _0x170462[_0x9508('0x76')]===_0x9508('0x72')){throw new db[(_0x9508('0x77'))][(_0x9508('0x73'))](_0x9508('0x78')+_0x369693+'\x27');}var _0x56ef77=[];if(!_[_0x9508('0x66')](_0x170462['parentSections'])){_0x56ef77=_0x170462[_0x9508('0x79')];}else{_0x56ef77=[{'name':_0x369693}];}return db['UserProfile']['findOne']({'where':{'id':_0x5ed199[_0x9508('0x4e')]['id']}})['then'](handleEntityNotFound(_0x34bf3a,null))[_0x9508('0x2b')](function(_0xf99d93){if(_0xf99d93){var _0x437419=[];for(var _0x31f06a=0x0;_0x31f06a<_0x56ef77[_0x9508('0x3c')];_0x31f06a++){_0x437419[_0x9508('0x61')](db[_0x9508('0x5d')]['findOne']({'where':{'userProfileId':_0xf99d93['id'],'name':_0x56ef77[_0x31f06a][_0x9508('0x2d')]},'raw':!![]}));}return BPromise[_0x9508('0x7a')](_0x437419);}})['then'](function(_0x1771ee){var _0x285ae1=_[_0x9508('0x42')](_0x1771ee,function(_0x32a70e){return _0x32a70e?_0x32a70e:undefined;});var _0x551eaa=_[_0x9508('0x42')](_0x56ef77,[_0x9508('0x7b'),!![]]);var _0x43b569=_[_0x9508('0x66')](_0x285ae1)&&_[_0x9508('0x66')](_0x551eaa)?null:_['union'](_0x551eaa,_0x285ae1);if(_0x43b569){var _0x251de8=[];for(var _0x52e211=0x0;_0x52e211<_0x43b569[_0x9508('0x3c')];_0x52e211++){var _0x5d0260=_[_0x9508('0x4f')](_0x56ef77,function(_0x17171a){return _0x43b569[_0x52e211]?_0x17171a[_0x9508('0x2d')]===_0x43b569[_0x52e211]['name']:null;});if(_0x5d0260){if(_0x43b569[_0x52e211][_0x9508('0x7b')]){_0x251de8['push'](getAllResources(_0x170462[_0x9508('0x76')],_0x43b569[_0x52e211]));}else{if(!_0x43b569[_0x52e211]['autoAssociation']){_0x251de8[_0x9508('0x61')](getAllowedResources(_0x5d0260,_0x43b569[_0x52e211],_0x170462[_0x9508('0x76')]));}else{if(_0x5d0260[_0x9508('0x35')]){_0x251de8[_0x9508('0x61')](getAllFilteredResources(_0x5d0260,_0x43b569[_0x52e211]));}}}}}return BPromise[_0x9508('0x7a')](_0x251de8);}else{return null;}})[_0x9508('0x2b')](function(_0x22bc48){var _0x2d0535=_0x22bc48;var _0x395c47=null;if(_0x2d0535){_0x395c47=_0x2d0535['length']===0x1?_0x2d0535[0x0]:null;}if(_0x395c47||_0x2d0535){var _0x12f0df=db[_0x170462[_0x9508('0x76')]][_0x9508('0x31')];_0x329ef7[_0x9508('0x35')]=_['keys'](_0x12f0df);_0x329ef7['query']=_[_0x9508('0x37')](_0x5ed199['query']);_0x329ef7[_0x9508('0x38')]=_[_0x9508('0x39')](_0x329ef7[_0x9508('0x35')],_0x329ef7[_0x9508('0x36')]);_0x42a8b5[_0x9508('0x3a')]=_[_0x9508('0x39')](_0x329ef7[_0x9508('0x35')],qs['fields'](_0x5ed199[_0x9508('0x36')][_0x9508('0x3b')]));_0x42a8b5[_0x9508('0x3a')]=_0x42a8b5[_0x9508('0x3a')][_0x9508('0x3c')]?_0x42a8b5[_0x9508('0x3a')]:_0x329ef7[_0x9508('0x35')];if(!_0x5ed199[_0x9508('0x36')]['hasOwnProperty']('nolimit')){_0x42a8b5[_0x9508('0x24')]=qs[_0x9508('0x24')](_0x5ed199[_0x9508('0x36')][_0x9508('0x24')]);_0x42a8b5[_0x9508('0x23')]=qs['offset'](_0x5ed199['query'][_0x9508('0x23')]);}_0x42a8b5[_0x9508('0x7c')]=qs[_0x9508('0x3f')](_0x5ed199['query']['sort']);_0x42a8b5['where']=qs[_0x9508('0x38')](_[_0x9508('0x41')](_0x5ed199[_0x9508('0x36')],_0x329ef7[_0x9508('0x38')]));if(_0x5ed199[_0x9508('0x36')][_0x9508('0x42')]){_0x42a8b5['where']=_[_0x9508('0x43')](_0x42a8b5[_0x9508('0x40')],{'$or':_['map'](_0x12f0df,function(_0x5b2c7f){if(_0x5b2c7f[_0x9508('0x33')][_0x9508('0x34')]!=='VIRTUAL'){var _0x46603={};_0x46603[_0x5b2c7f[_0x9508('0x7d')]]={'$like':'%'+_0x5ed199[_0x9508('0x36')][_0x9508('0x42')]+'%'};return _0x46603;}})});}var _0x3a2019=[];if(_0x395c47){var _0x2c9017=_[_0x9508('0x4f')](_0x56ef77,['name',_0x395c47[_0x9508('0x2d')]]);if(_0x2c9017[_0x9508('0x7d')]){var _0x344c20={};if(_0x170462[_0x9508('0x76')]===_0x9508('0x7e')){_0x344c20[_0x2c9017['foreignKey']]=_[_0x9508('0x2f')](_0x395c47[_0x9508('0x7f')],'id');}else{_0x344c20[_0x2c9017['foreignKey']]=_0x395c47[_0x9508('0x7f')];}_0x3a2019['push'](_0x344c20);}else{_0x42a8b5[_0x9508('0x40')]['id']=_0x395c47[_0x9508('0x7f')];}}else{for(var _0x10966b=0x0;_0x10966b<_0x2d0535[_0x9508('0x3c')];_0x10966b++){var _0x2c9017=_['find'](_0x56ef77,[_0x9508('0x2d'),_0x2d0535[_0x10966b]['name']]);if(_0x2c9017[_0x9508('0x7d')]){var _0x344c20={};_0x344c20[_0x2c9017[_0x9508('0x80')]]=_0x2d0535[_0x10966b][_0x9508('0x7f')];_0x3a2019[_0x9508('0x61')](_0x344c20);}else{if(!_0x42a8b5['where']['id'])_0x42a8b5[_0x9508('0x40')]['id']=[];_0x2d0535[_0x10966b][_0x9508('0x7f')][_0x9508('0x6b')](function(_0x4a225b){_0x42a8b5[_0x9508('0x40')]['id'][_0x9508('0x61')](_0x4a225b);});}}}if(!_['isEmpty'](_0x3a2019)){_0x42a8b5[_0x9508('0x40')]=_[_0x9508('0x43')](_0x42a8b5[_0x9508('0x40')],{'$and':{'$or':_0x3a2019}});}_0x42a8b5=_['merge']({},_0x42a8b5,_0x5ed199['options']);if(_0x395c47&&!_0x395c47['autoAssociation']&&_0x170462[_0x9508('0x76')]===_0x9508('0x7e')){if(_0x5ed199[_0x9508('0x36')][_0x9508('0x46')]){_0x42a8b5[_0x9508('0x47')]=[{'all':!![]}];}return db[_0x170462['childModel']][_0x9508('0x48')](_0x42a8b5)['then'](function(_0x30ee5a){var _0xf9dacc=[];_0x30ee5a[_0x9508('0x6b')](function(_0x17cf94){var _0xd51207;switch(_0x17cf94[_0x9508('0x81')]){case'default':_0xd51207=_[_0x9508('0x4f')](_0x395c47[_0x9508('0x7f')],function(_0x3968bd){return _0x3968bd['id']===_0x17cf94['reportId']&&_0x3968bd[_0x9508('0x33')]===_0x9508('0x82');});break;case _0x9508('0x83'):_0xd51207=_[_0x9508('0x4f')](_0x395c47[_0x9508('0x7f')],function(_0x2cd478){return _0x2cd478['id']===_0x17cf94['reportId']&&_0x2cd478[_0x9508('0x33')]===_0x9508('0x84');});break;}if(_0xd51207)_0xf9dacc['push'](_0x17cf94);});_0x31ea4c[_0x9508('0x22')]=_0xf9dacc[_0x9508('0x3c')];_0x31ea4c[_0x9508('0x49')]=_0xf9dacc;return _0x31ea4c;});}else{return db[_0x170462[_0x9508('0x76')]][_0x9508('0x22')]({'where':_0x42a8b5[_0x9508('0x40')]})[_0x9508('0x2b')](function(_0x5790f4){_0x31ea4c[_0x9508('0x22')]=_0x5790f4;if(_0x5ed199[_0x9508('0x36')]['includeAll']){if(_0x170462[_0x9508('0x76')]==='CmContact'){_0x42a8b5[_0x9508('0x47')]=[{'model':db[_0x9508('0x85')],'as':_0x9508('0x86'),'attributes':['id',_0x9508('0x2d'),_0x9508('0x87')],'required':_0x5ed199['query']['tag']?!![]:![]},{'model':db[_0x9508('0x85')],'as':_0x9508('0x88'),'attributes':['id',_0x9508('0x2d'),_0x9508('0x87')],'through':_0x5ed199[_0x9508('0x36')][_0x9508('0x89')]?{'attributes':[],'where':{'TagId':_0x5ed199['query'][_0x9508('0x89')]||undefined}}:{},'required':_0x5ed199[_0x9508('0x36')][_0x9508('0x89')]?!![]:![]}];}else{_0x42a8b5[_0x9508('0x47')]=[{'all':!![]}];}}return db[_0x170462['childModel']][_0x9508('0x48')](_0x42a8b5);})[_0x9508('0x2b')](function(_0x29cacf){_0x31ea4c[_0x9508('0x49')]=_0x29cacf;return _0x31ea4c;});}}else{return _0x31ea4c;}})[_0x9508('0x2b')](respondWithFilteredResult(_0x34bf3a,_0x42a8b5))[_0x9508('0x4c')](handleError(_0x34bf3a,null));};function getAllResources(_0x56f977,_0x330291){return new BPromise(function(_0x1557e0,_0x5277ad){if(_0x330291){var _0x5189d6=_0x330291[_0x9508('0x42')]?{[_0x330291[_0x9508('0x42')]['field']]:_0x330291[_0x9508('0x42')][_0x9508('0x8a')]}:undefined;return db[_0x56f977][_0x9508('0x48')]({'where':_0x5189d6,'raw':!![]})['then'](function(_0x37d1f3){_0x330291['associatedResources']=_[_0x9508('0x2f')](_0x37d1f3,'id');_0x1557e0(_0x330291);})[_0x9508('0x4c')](function(_0x4c244f){_0x5277ad(_0x4c244f);});}else{_0x1557e0(null);}});}function getAllFilteredResources(_0x168da2,_0x33ac8d){return new BPromise(function(_0x26b62f,_0x85f810){var _0x341f35=_0x168da2[_0x9508('0x42')]?{[_0x168da2[_0x9508('0x42')][_0x9508('0x7d')]]:_0x168da2[_0x9508('0x42')][_0x9508('0x8a')]}:undefined;return db[_0x168da2[_0x9508('0x35')]][_0x9508('0x48')]({'where':_0x341f35,'raw':!![]})[_0x9508('0x2b')](function(_0x435e19){_0x33ac8d[_0x9508('0x7f')]=_[_0x9508('0x2f')](_0x435e19,function(_0x209c58){return _0x209c58[_0x9508('0x2d')];});_0x26b62f(_0x33ac8d);})['catch'](function(_0x1d1109){_0x85f810(_0x1d1109);});});}function getAllowedResources(_0x21bcab,_0x2ef37f,_0x2f870b){return new BPromise(function(_0x1d94c9,_0xe250b1){if(_0x2ef37f){return db[_0x9508('0x5a')][_0x9508('0x48')]({'where':{'sectionId':_0x2ef37f['id']},'raw':!![]})[_0x9508('0x2b')](function(_0x46f622){if(_0x21bcab[_0x9508('0x7d')]&&_0x21bcab[_0x9508('0x7d')]!=='id'){_0x2ef37f[_0x9508('0x7f')]=_[_0x9508('0x2f')](_0x46f622,function(_0x538a04){return _0x538a04[_0x21bcab[_0x9508('0x7d')]];});}else{if(_0x2f870b===_0x9508('0x7e')){_0x2ef37f[_0x9508('0x7f')]=_[_0x9508('0x2f')](_0x46f622,function(_0x42a257){return{'id':_0x42a257[_0x9508('0x6c')],'type':_0x42a257[_0x9508('0x33')]};});}else{_0x2ef37f[_0x9508('0x7f')]=_['map'](_0x46f622,function(_0x36eef0){return _0x36eef0['resourceId'];});}}_0x1d94c9(_0x2ef37f);})[_0x9508('0x4c')](function(_0x504e90){_0xe250b1(_0x504e90);});}else{_0x1d94c9(null);}});}function getQueryModels(_0x3148be,_0x12e23d){var _0x4bfb70=_0x3148be[_0x9508('0x8b')]();var _0x306a21={'childModel':undefined,'parentSections':[]};switch(_0x4bfb70){case'squareprojects':_0x306a21[_0x9508('0x76')]='SquareProject';break;case _0x9508('0x8c'):_0x306a21[_0x9508('0x76')]=_0x9508('0x8d');break;case _0x9508('0x8e'):_0x306a21[_0x9508('0x76')]=_0x9508('0x8f');_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0x90'),'field':'name','foreignKey':_0x9508('0x91')}];break;case _0x9508('0x92'):_0x306a21[_0x9508('0x76')]=_0x9508('0x93');break;case _0x9508('0x94'):_0x306a21['childModel']=_0x9508('0x95');_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0x96'),'field':'id','foreignKey':_0x9508('0x97')}];break;case _0x9508('0x98'):_0x306a21['childModel']=_0x9508('0x99');break;case _0x9508('0x9a'):_0x306a21[_0x9508('0x76')]=_0x9508('0x9b');break;case _0x9508('0x9c'):_0x306a21[_0x9508('0x76')]=_0x9508('0x9d');break;case _0x9508('0x9e'):_0x306a21[_0x9508('0x76')]=_0x9508('0x9f');break;case _0x9508('0xa0'):_0x306a21['childModel']=_0x9508('0xa1');break;case _0x9508('0xa2'):_0x306a21[_0x9508('0x76')]=_0x9508('0xa3');break;case _0x9508('0xa4'):_0x306a21[_0x9508('0x76')]=_0x9508('0xa5');break;case _0x9508('0xa6'):case _0x9508('0xa7'):case _0x9508('0xa8'):_0x306a21[_0x9508('0x76')]=_0x9508('0xa9');break;case'contexts':_0x306a21[_0x9508('0x76')]=_0x9508('0xaa');break;case _0x9508('0xab'):_0x306a21['childModel']='VoiceMail';break;case _0x9508('0xac'):_0x306a21[_0x9508('0x76')]=_0x9508('0xad');_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0xae'),'field':_0x9508('0x2d'),'foreignKey':'membername','model':_0x9508('0xaf'),'filter':{'field':_0x9508('0xb0'),'value':[_0x9508('0xb1')]}},{'name':_0x9508('0xb2'),'field':'name','foreignKey':'membername','model':_0x9508('0xaf'),'filter':{'field':_0x9508('0xb0'),'value':['telephone']}},{'name':_0x9508('0xb3'),'field':_0x9508('0x2d'),'foreignKey':_0x9508('0xb4'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x9508('0xb5')]}},{'name':_0x9508('0xb6'),'field':_0x9508('0x2d'),'foreignKey':'queue','model':_0x9508('0xb7'),'filter':{'field':_0x9508('0x33'),'value':['outbound']}}];break;case _0x9508('0xb8'):_0x306a21[_0x9508('0x76')]=_0x9508('0xb9');break;case _0x9508('0xba'):_0x306a21['childModel']=_0x9508('0xbb');break;case _0x9508('0xbc'):_0x306a21[_0x9508('0x76')]='VoicePrefix';break;case _0x9508('0xbd'):_0x306a21[_0x9508('0x76')]='Campaign';break;case'mailqueues':_0x306a21[_0x9508('0x76')]=_0x9508('0xbe');break;case _0x9508('0xbf'):_0x306a21[_0x9508('0x76')]='MailAccount';break;case _0x9508('0xc0'):_0x306a21[_0x9508('0x76')]=_0x9508('0xc1');break;case _0x9508('0xc2'):_0x306a21['childModel']=_0x9508('0xc3');break;case _0x9508('0xc4'):_0x306a21[_0x9508('0x76')]=_0x9508('0xc5');break;case _0x9508('0xc6'):_0x306a21[_0x9508('0x76')]=_0x9508('0xc7');break;case _0x9508('0xc8'):_0x306a21[_0x9508('0x76')]=_0x9508('0xc9');break;case'whatsappqueues':_0x306a21['childModel']='WhatsappQueue';break;case _0x9508('0xca'):_0x306a21['childModel']=_0x9508('0xcb');break;case _0x9508('0xcc'):_0x306a21[_0x9508('0x76')]=_0x9508('0xcd');break;case _0x9508('0xce'):case'queuecampaigns':_0x306a21['childModel']=_0x9508('0xb7');if(_0x12e23d){_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0xb3')},{'name':_0x9508('0xb6')}];}break;case _0x9508('0xcf'):case _0x9508('0xd0'):case'telephones':_0x306a21[_0x9508('0x76')]=_0x9508('0xaf');if(_0x12e23d){_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0xd1'),'filter':{'field':_0x9508('0xb0'),'value':[_0x9508('0xd2'),'user']},'ignore':!![]},{'name':_0x9508('0xae')},{'name':_0x9508('0xb2')}];}break;case _0x9508('0xd3'):_0x306a21[_0x9508('0x76')]=_0x9508('0xd4');break;case _0x9508('0xd5'):_0x306a21[_0x9508('0x76')]=_0x9508('0xd6');break;case'freshdeskaccounts':_0x306a21['childModel']='FreshdeskAccount';break;case _0x9508('0xd7'):_0x306a21[_0x9508('0x76')]=_0x9508('0xd8');break;case _0x9508('0xd9'):_0x306a21[_0x9508('0x76')]=_0x9508('0xda');break;case _0x9508('0xdb'):_0x306a21['childModel']=_0x9508('0xdc');break;case _0x9508('0xdd'):_0x306a21[_0x9508('0x76')]=_0x9508('0xaf');break;case _0x9508('0xde'):_0x306a21[_0x9508('0x76')]=_0x9508('0xdf');break;case _0x9508('0xe0'):_0x306a21[_0x9508('0x76')]=_0x9508('0xe1');break;case'customdashboards':_0x306a21[_0x9508('0x76')]=_0x9508('0x6a');break;case _0x9508('0xe2'):_0x306a21['childModel']=_0x9508('0xe3');break;case _0x9508('0xe4'):_0x306a21[_0x9508('0x76')]='Pause';break;case _0x9508('0xe5'):_0x306a21[_0x9508('0x76')]=_0x9508('0xe6');break;case _0x9508('0xe7'):_0x306a21[_0x9508('0x76')]=_0x9508('0xe8');break;case'tags':_0x306a21[_0x9508('0x76')]=_0x9508('0x85');break;case _0x9508('0xe9'):_0x306a21[_0x9508('0x76')]=_0x9508('0xea');break;case'triggers':_0x306a21['childModel']=_0x9508('0xeb');break;case _0x9508('0xec'):_0x306a21[_0x9508('0x76')]=_0x9508('0xed');break;case _0x9508('0xee'):_0x306a21['childModel']=_0x9508('0xef');break;case'plugins':_0x306a21[_0x9508('0x76')]='Plugin';break;case _0x9508('0xf0'):_0x306a21[_0x9508('0x76')]='AnalyticExtractedReport';_0x306a21[_0x9508('0x79')]=[{'name':_0x9508('0xf1'),'field':'id','foreignKey':_0x9508('0xf2')}];break;case _0x9508('0xf3'):_0x306a21[_0x9508('0x76')]=_0x9508('0xf4');break;case _0x9508('0xca'):_0x306a21[_0x9508('0x76')]=_0x9508('0xcb');break;default:return _0x306a21;}return _0x306a21;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5ef11a9..1f7acf5 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 _0x6e16=['events','../../mysqldb','UserProfile','save','remove','emit','hook','exports'];(function(_0x45044d,_0x3a9672){var _0x17a471=function(_0x30f134){while(--_0x30f134){_0x45044d['push'](_0x45044d['shift']());}};_0x17a471(++_0x3a9672);}(_0x6e16,0x1b0));var _0x66e1=function(_0x3136f8,_0x5688d5){_0x3136f8=_0x3136f8-0x0;var _0x11119a=_0x6e16[_0x3136f8];return _0x11119a;};'use strict';var EventEmitter=require(_0x66e1('0x0'));var UserProfile=require(_0x66e1('0x1'))['db'][_0x66e1('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66e1('0x3'),'afterUpdate':'update','afterDestroy':_0x66e1('0x4')};function emitEvent(_0x50b1c3){return function(_0x365700,_0x5247d9,_0x2ef666){UserProfileEvents[_0x66e1('0x5')](_0x50b1c3+':'+_0x365700['id'],_0x365700);UserProfileEvents['emit'](_0x50b1c3,_0x365700);_0x2ef666(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x66e1('0x6')](e,emitEvent(event));}}module[_0x66e1('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x0716=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0716,0x114));var _0x6071=function(_0x212579,_0xdb4d5a){_0x212579=_0x212579-0x0;var _0x55d50e=_0x0716[_0x212579];return _0x55d50e;};'use strict';var EventEmitter=require(_0x6071('0x0'));var UserProfile=require(_0x6071('0x1'))['db'][_0x6071('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6071('0x3')](0x0);var events={'afterCreate':_0x6071('0x4'),'afterUpdate':_0x6071('0x5'),'afterDestroy':_0x6071('0x6')};function emitEvent(_0x1cf266){return function(_0x49c1d4,_0x4f25e2,_0x4bddb2){UserProfileEvents[_0x6071('0x7')](_0x1cf266+':'+_0x49c1d4['id'],_0x49c1d4);UserProfileEvents[_0x6071('0x7')](_0x1cf266,_0x49c1d4);_0x4bddb2(null);};}for(var e in events){if(events[_0x6071('0x8')](e)){var event=events[e];UserProfile[_0x6071('0x9')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 82b9e51..6edffea 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 _0xf33f=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','../../config/logger','api','moment'];(function(_0x581a0b,_0x2523b4){var _0x3904b2=function(_0x356cbc){while(--_0x356cbc){_0x581a0b['push'](_0x581a0b['shift']());}};_0x3904b2(++_0x2523b4);}(_0xf33f,0x1bc));var _0xff33=function(_0xc0a199,_0x123c21){_0xc0a199=_0xc0a199-0x0;var _0x469bad=_0xf33f[_0xc0a199];return _0x469bad;};'use strict';var _=require(_0xff33('0x0'));var util=require('util');var logger=require(_0xff33('0x1'))(_0xff33('0x2'));var moment=require(_0xff33('0x3'));var BPromise=require(_0xff33('0x4'));var rp=require(_0xff33('0x5'));var fs=require('fs');var path=require(_0xff33('0x6'));var rimraf=require(_0xff33('0x7'));var config=require(_0xff33('0x8'));var attributes=require(_0xff33('0x9'));module[_0xff33('0xa')]=function(_0x45fefb,_0x3cea31){return _0x45fefb[_0xff33('0xb')](_0xff33('0xc'),attributes,{'tableName':_0xff33('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac82=['path','rimraf','exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b281a,_0x1733de){var _0x3149a7=function(_0x3a6b40){while(--_0x3a6b40){_0x4b281a['push'](_0x4b281a['shift']());}};_0x3149a7(++_0x1733de);}(_0xac82,0x165));var _0x2ac8=function(_0x4f9b15,_0x5b32cf){_0x4f9b15=_0x4f9b15-0x0;var _0x4925ae=_0xac82[_0x4f9b15];return _0x4925ae;};'use strict';var _=require(_0x2ac8('0x0'));var util=require(_0x2ac8('0x1'));var logger=require(_0x2ac8('0x2'))(_0x2ac8('0x3'));var moment=require(_0x2ac8('0x4'));var BPromise=require(_0x2ac8('0x5'));var rp=require(_0x2ac8('0x6'));var fs=require('fs');var path=require(_0x2ac8('0x7'));var rimraf=require(_0x2ac8('0x8'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0x2ac8('0x9')]=function(_0x3ec108,_0x24f652){return _0x3ec108[_0x2ac8('0xa')](_0x2ac8('0xb'),attributes,{'tableName':_0x2ac8('0xc'),'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 576748d..07b25a7 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 _0x2eb2=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0xeeaf17,_0x5820c3){var _0xf199c5=function(_0x39208d){while(--_0x39208d){_0xeeaf17['push'](_0xeeaf17['shift']());}};_0xf199c5(++_0x5820c3);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x2eb2[_0x5608a3];return _0x1ed50a;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});config[_0x22eb('0xa')]=_[_0x22eb('0xb')](config[_0x22eb('0xa')],{'host':_0x22eb('0xc'),'port':0x18eb});var socket=require(_0x22eb('0xd'))(new Redis(config[_0x22eb('0xa')]));require(_0x22eb('0xe'))[_0x22eb('0xf')](socket);function respondWithRpcPromise(_0x3008e0,_0x489260,_0x46c197){return new BPromise(function(_0x54342e,_0x4ce9fb){return client[_0x22eb('0x10')](_0x3008e0,_0x46c197)['then'](function(_0x17b668){logger[_0x22eb('0x11')]('UserProfile,\x20%s,\x20%s',_0x489260,'request\x20sent');logger[_0x22eb('0x12')](_0x22eb('0x13'),_0x489260,_0x22eb('0x14'),JSON[_0x22eb('0x15')](_0x17b668));if(_0x17b668[_0x22eb('0x16')]){if(_0x17b668['error'][_0x22eb('0x17')]===0x1f4){logger['error'](_0x22eb('0x18'),_0x489260,_0x17b668['error'][_0x22eb('0x19')]);return _0x4ce9fb(_0x17b668[_0x22eb('0x16')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x489260,_0x17b668[_0x22eb('0x16')]['message']);return _0x54342e(_0x17b668['error'][_0x22eb('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x489260,_0x22eb('0x14'));_0x54342e(_0x17b668[_0x22eb('0x1a')][_0x22eb('0x19')]);}})[_0x22eb('0x1b')](function(_0x3b0940){logger['error'](_0x22eb('0x18'),_0x489260,_0x3b0940);_0x4ce9fb(_0x3b0940);});});} \ No newline at end of file +var _0x71ab=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xd245e2,_0x3d70de){var _0x413878=function(_0x30d115){while(--_0x30d115){_0xd245e2['push'](_0xd245e2['shift']());}};_0x413878(++_0x3d70de);}(_0x71ab,0x64));var _0xb71a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x71ab[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('UserProfile,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6a7083f..a37dbe2 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 _0x3821=['update','emit','removeListener','register','./userProfile.events','save','remove'];(function(_0x4ef98a,_0x21aae1){var _0x2e8472=function(_0x22e989){while(--_0x22e989){_0x4ef98a['push'](_0x4ef98a['shift']());}};_0x2e8472(++_0x21aae1);}(_0x3821,0x107));var _0x1382=function(_0xbf46ff,_0x5b63d7){_0xbf46ff=_0xbf46ff-0x0;var _0x369b23=_0x3821[_0xbf46ff];return _0x369b23;};'use strict';var UserProfileEvents=require(_0x1382('0x0'));var events=[_0x1382('0x1'),_0x1382('0x2'),_0x1382('0x3')];function createListener(_0x5b2952,_0x5ba8e3){return function(_0x3bbcaf){_0x5ba8e3[_0x1382('0x4')](_0x5b2952,_0x3bbcaf);};}function removeListener(_0x210b6d,_0x3aff18){return function(){UserProfileEvents[_0x1382('0x5')](_0x210b6d,_0x3aff18);};}exports[_0x1382('0x6')]=function(_0x4a4e98){for(var _0x38fba9=0x0,_0x5ef357=events['length'];_0x38fba9<_0x5ef357;_0x38fba9++){var _0x5a412c=events[_0x38fba9];var _0x130391=createListener('userProfile:'+_0x5a412c,_0x4a4e98);UserProfileEvents['on'](_0x5a412c,_0x130391);}}; \ No newline at end of file +var _0xbc5e=['emit','removeListener','register','length','userProfile:','./userProfile.events'];(function(_0x47c49d,_0x2879e4){var _0x4f84bd=function(_0x13c4ef){while(--_0x13c4ef){_0x47c49d['push'](_0x47c49d['shift']());}};_0x4f84bd(++_0x2879e4);}(_0xbc5e,0x1f1));var _0xebc5=function(_0x4107f0,_0x2bcb0c){_0x4107f0=_0x4107f0-0x0;var _0x247ea7=_0xbc5e[_0x4107f0];return _0x247ea7;};'use strict';var UserProfileEvents=require(_0xebc5('0x0'));var events=['save','remove','update'];function createListener(_0x23cc44,_0x22a36a){return function(_0xfc08f8){_0x22a36a[_0xebc5('0x1')](_0x23cc44,_0xfc08f8);};}function removeListener(_0x8b92c6,_0xddd1c0){return function(){UserProfileEvents[_0xebc5('0x2')](_0x8b92c6,_0xddd1c0);};}exports[_0xebc5('0x3')]=function(_0x46377a){for(var _0x2d552f=0x0,_0x2f6765=events[_0xebc5('0x4')];_0x2d552f<_0x2f6765;_0x2d552f++){var _0x437821=events[_0x2d552f];var _0x250906=createListener(_0xebc5('0x5')+_0x437821,_0x46377a);UserProfileEvents['on'](_0x437821,_0x250906);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f9dd2f7..8fe4505 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 _0x3129=['multer','util','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','post','update','delete','exports'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x3129,0x1dc));var _0x9312=function(_0x45b4ed,_0x111378){_0x45b4ed=_0x45b4ed-0x0;var _0x202fe5=_0x3129[_0x45b4ed];return _0x202fe5;};'use strict';var multer=require(_0x9312('0x0'));var util=require(_0x9312('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9312('0x2')]();var auth=require(_0x9312('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9312('0x4'));var controller=require(_0x9312('0x5'));router[_0x9312('0x6')]('/',auth['isAuthenticated'](),controller[_0x9312('0x7')]);router[_0x9312('0x6')]('/describe',auth[_0x9312('0x8')](),controller[_0x9312('0x9')]);router[_0x9312('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9312('0xa')]('/',auth[_0x9312('0x8')](),controller['create']);router['put']('/:id',auth[_0x9312('0x8')](),controller[_0x9312('0xb')]);router[_0x9312('0xc')]('/:id',auth[_0x9312('0x8')](),controller['destroy']);module[_0x9312('0xd')]=router; \ No newline at end of file +var _0x99d4=['exports','multer','path','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy'];(function(_0x129bcc,_0x1734ff){var _0x353cc3=function(_0x3522f5){while(--_0x3522f5){_0x129bcc['push'](_0x129bcc['shift']());}};_0x353cc3(++_0x1734ff);}(_0x99d4,0x122));var _0x499d=function(_0x533f16,_0x2bf62d){_0x533f16=_0x533f16-0x0;var _0xf20b22=_0x99d4[_0x533f16];return _0xf20b22;};'use strict';var multer=require(_0x499d('0x0'));var util=require('util');var path=require(_0x499d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x499d('0x2')]();var auth=require(_0x499d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x499d('0x4')]('/',auth[_0x499d('0x5')](),controller[_0x499d('0x6')]);router['get'](_0x499d('0x7'),auth[_0x499d('0x5')](),controller[_0x499d('0x8')]);router['get']('/:id',auth[_0x499d('0x5')](),controller[_0x499d('0x9')]);router[_0x499d('0xa')]('/',auth[_0x499d('0x5')](),controller[_0x499d('0xb')]);router[_0x499d('0xc')](_0x499d('0xd'),auth[_0x499d('0x5')](),controller['update']);router[_0x499d('0xe')](_0x499d('0xd'),auth[_0x499d('0x5')](),controller[_0x499d('0xf')]);module[_0x499d('0x10')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0ebe55c..76af8f2 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 _0x0126=['sequelize','exports','STRING','INTEGER'];(function(_0x4364f1,_0x43a2f2){var _0x382072=function(_0x28b1a8){while(--_0x28b1a8){_0x4364f1['push'](_0x4364f1['shift']());}};_0x382072(++_0x43a2f2);}(_0x0126,0x188));var _0x6012=function(_0xe14677,_0x547870){_0xe14677=_0xe14677-0x0;var _0x1b1317=_0x0126[_0xe14677];return _0x1b1317;};'use strict';var Sequelize=require(_0x6012('0x0'));module[_0x6012('0x1')]={'name':{'type':Sequelize[_0x6012('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6012('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6012('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xc627=['sequelize','STRING','INTEGER'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc627,0xd5));var _0x7c62=function(_0x99920c,_0x19bf6b){_0x99920c=_0x99920c-0x0;var _0x3f5e9e=_0xc627[_0x99920c];return _0x3f5e9e;};'use strict';var Sequelize=require(_0x7c62('0x0'));module['exports']={'name':{'type':Sequelize[_0x7c62('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7c62('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index de8ff5e..6bbe3e4 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 _0xd7d7=['includeAll','include','findAll','rows','catch','show','params','filtears','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','VIRTUAL','filter'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xd7d7,0x14e));var _0x7d7d=function(_0x1c89cc,_0x512354){_0x1c89cc=_0x1c89cc-0x0;var _0x2ab06a=_0xd7d7[_0x1c89cc];return _0x2ab06a;};'use strict';var pdf=require(_0x7d7d('0x0'));var emlformat=require(_0x7d7d('0x1'));var rimraf=require(_0x7d7d('0x2'));var zipdir=require(_0x7d7d('0x3'));var jsonpatch=require(_0x7d7d('0x4'));var rp=require(_0x7d7d('0x5'));var moment=require(_0x7d7d('0x6'));var BPromise=require(_0x7d7d('0x7'));var Mustache=require(_0x7d7d('0x8'));var util=require(_0x7d7d('0x9'));var path=require(_0x7d7d('0xa'));var sox=require(_0x7d7d('0xb'));var csv=require(_0x7d7d('0xc'));var ejs=require(_0x7d7d('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7d7d('0xe'));var crypto=require('crypto');var jsforce=require(_0x7d7d('0xf'));var deskjs=require(_0x7d7d('0x10'));var toCsv=require(_0x7d7d('0xc'));var querystring=require(_0x7d7d('0x11'));var Papa=require(_0x7d7d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d7d('0x13'));var hardwareService=require(_0x7d7d('0x14'));var logger=require(_0x7d7d('0x15'))(_0x7d7d('0x16'));var utils=require(_0x7d7d('0x17'));var config=require(_0x7d7d('0x18'));var licenseUtil=require(_0x7d7d('0x19'));var db=require(_0x7d7d('0x1a'))['db'];function respondWithStatusCode(_0x4c51e8,_0x3c4eec){_0x3c4eec=_0x3c4eec||0xcc;return function(_0x182c26){if(_0x182c26){return _0x4c51e8[_0x7d7d('0x1b')](_0x3c4eec);}return _0x4c51e8['status'](_0x3c4eec)[_0x7d7d('0x1c')]();};}function respondWithResult(_0x18b7be,_0x4b4a6a){_0x4b4a6a=_0x4b4a6a||0xc8;return function(_0xe5405c){if(_0xe5405c){return _0x18b7be[_0x7d7d('0x1d')](_0x4b4a6a)[_0x7d7d('0x1e')](_0xe5405c);}};}function respondWithFilteredResult(_0x513c5e,_0x53bc5b){return function(_0x2b5068){if(_0x2b5068){var _0x1bbbc7=_0x2b5068[_0x7d7d('0x1f')],_0x3e05ea=_0x53bc5b[_0x7d7d('0x20')],_0x434ea9=_0x53bc5b[_0x7d7d('0x20')]+_0x53bc5b[_0x7d7d('0x21')],_0x5c9339;if(_0x434ea9>=_0x1bbbc7){_0x434ea9=_0x1bbbc7;_0x5c9339=0xc8;}else{_0x5c9339=0xce;}_0x513c5e[_0x7d7d('0x1d')](_0x5c9339);return _0x513c5e[_0x7d7d('0x22')](_0x7d7d('0x23'),_0x3e05ea+'-'+_0x434ea9+'/'+_0x1bbbc7)['json'](_0x2b5068);}return null;};}function patchUpdates(_0x158bec){return function(_0xb17eaf){try{jsonpatch[_0x7d7d('0x24')](_0xb17eaf,_0x158bec,!![]);}catch(_0x4dffab){return BPromise['reject'](_0x4dffab);}return _0xb17eaf[_0x7d7d('0x25')]();};}function saveUpdates(_0x4518f0,_0x467d95){return function(_0x14586a){if(_0x14586a){return _0x14586a[_0x7d7d('0x26')](_0x4518f0)['then'](function(_0x278498){return _0x278498;});}return null;};}function removeEntity(_0x21a888,_0x12e051){return function(_0xf09c89){if(_0xf09c89){return _0xf09c89['destroy']()[_0x7d7d('0x27')](function(){_0x21a888[_0x7d7d('0x1d')](0xcc)[_0x7d7d('0x1c')]();});}};}function handleEntityNotFound(_0x143e04,_0x3eab44){return function(_0x220448){if(!_0x220448){_0x143e04[_0x7d7d('0x1b')](0x194);}return _0x220448;};}function handleError(_0x548d21,_0x34fe4a){_0x34fe4a=_0x34fe4a||0x1f4;return function(_0x3594f1){logger[_0x7d7d('0x28')](_0x3594f1[_0x7d7d('0x29')]);if(_0x3594f1[_0x7d7d('0x2a')]){delete _0x3594f1[_0x7d7d('0x2a')];}_0x548d21[_0x7d7d('0x1d')](_0x34fe4a)[_0x7d7d('0x2b')](_0x3594f1);};}exports[_0x7d7d('0x2c')]=function(_0x236c2a,_0x210e62){var _0x2f7795={},_0x114633={},_0xf295eb={'count':0x0,'rows':[]};var _0x395e77=_[_0x7d7d('0x2d')](db[_0x7d7d('0x2e')][_0x7d7d('0x2f')],function(_0x9a1f0){return{'name':_0x9a1f0[_0x7d7d('0x30')],'type':_0x9a1f0[_0x7d7d('0x31')][_0x7d7d('0x32')]};});_0x114633[_0x7d7d('0x33')]=_[_0x7d7d('0x2d')](_0x395e77,_0x7d7d('0x2a'));_0x114633[_0x7d7d('0x34')]=_[_0x7d7d('0x35')](_0x236c2a[_0x7d7d('0x34')]);_0x114633[_0x7d7d('0x36')]=_[_0x7d7d('0x37')](_0x114633[_0x7d7d('0x33')],_0x114633['query']);_0x2f7795[_0x7d7d('0x38')]=_['intersection'](_0x114633[_0x7d7d('0x33')],qs[_0x7d7d('0x39')](_0x236c2a['query']['fields']));_0x2f7795['attributes']=_0x2f7795['attributes'][_0x7d7d('0x3a')]?_0x2f7795[_0x7d7d('0x38')]:_0x114633[_0x7d7d('0x33')];if(!_0x236c2a[_0x7d7d('0x34')][_0x7d7d('0x3b')](_0x7d7d('0x3c'))){_0x2f7795[_0x7d7d('0x21')]=qs[_0x7d7d('0x21')](_0x236c2a[_0x7d7d('0x34')][_0x7d7d('0x21')]);_0x2f7795['offset']=qs['offset'](_0x236c2a[_0x7d7d('0x34')][_0x7d7d('0x20')]);}_0x2f7795[_0x7d7d('0x3d')]=qs['sort'](_0x236c2a['query']['sort']);_0x2f7795['where']=qs['filters'](_[_0x7d7d('0x3e')](_0x236c2a['query'],_0x114633[_0x7d7d('0x36')]),_0x395e77);if(_0x236c2a['query']['filter']){_0x2f7795[_0x7d7d('0x3f')]=_['merge'](_0x2f7795[_0x7d7d('0x3f')],{'$or':_[_0x7d7d('0x2d')](_0x395e77,function(_0xe7988c){if(_0xe7988c['type']!==_0x7d7d('0x40')){var _0x19c202={};_0x19c202[_0xe7988c[_0x7d7d('0x2a')]]={'$like':'%'+_0x236c2a['query'][_0x7d7d('0x41')]+'%'};return _0x19c202;}})});}_0x2f7795=_['merge']({},_0x2f7795,_0x236c2a['options']);var _0x3cb8e1={'where':_0x2f7795[_0x7d7d('0x3f')]};return db[_0x7d7d('0x2e')][_0x7d7d('0x1f')](_0x3cb8e1)[_0x7d7d('0x27')](function(_0xa9a5fe){_0xf295eb[_0x7d7d('0x1f')]=_0xa9a5fe;if(_0x236c2a['query'][_0x7d7d('0x42')]){_0x2f7795[_0x7d7d('0x43')]=[{'all':!![]}];}return db['UserProfileResource'][_0x7d7d('0x44')](_0x2f7795);})[_0x7d7d('0x27')](function(_0x37f769){_0xf295eb[_0x7d7d('0x45')]=_0x37f769;return _0xf295eb;})['then'](respondWithFilteredResult(_0x210e62,_0x2f7795))[_0x7d7d('0x46')](handleError(_0x210e62,null));};exports[_0x7d7d('0x47')]=function(_0x12844a,_0x4b18a4){var _0x454fa6={'raw':![],'where':{'id':_0x12844a[_0x7d7d('0x48')]['id']}},_0x50b2eb={};_0x50b2eb['model']=_[_0x7d7d('0x35')](db['UserProfileResource'][_0x7d7d('0x2f')]);_0x50b2eb['query']=_['keys'](_0x12844a[_0x7d7d('0x34')]);_0x50b2eb[_0x7d7d('0x49')]=_[_0x7d7d('0x37')](_0x50b2eb[_0x7d7d('0x33')],_0x50b2eb[_0x7d7d('0x34')]);_0x454fa6['attributes']=_['intersection'](_0x50b2eb['model'],qs[_0x7d7d('0x39')](_0x12844a[_0x7d7d('0x34')][_0x7d7d('0x39')]));_0x454fa6[_0x7d7d('0x38')]=_0x454fa6[_0x7d7d('0x38')]['length']?_0x454fa6['attributes']:_0x50b2eb[_0x7d7d('0x33')];if(_0x12844a[_0x7d7d('0x34')]['includeAll']){_0x454fa6[_0x7d7d('0x43')]=[{'all':!![]}];}_0x454fa6=_['merge']({},_0x454fa6,_0x12844a[_0x7d7d('0x4a')]);return db[_0x7d7d('0x2e')][_0x7d7d('0x4b')](_0x454fa6)['then'](handleEntityNotFound(_0x4b18a4,null))[_0x7d7d('0x27')](respondWithResult(_0x4b18a4,null))[_0x7d7d('0x46')](handleError(_0x4b18a4,null));};exports[_0x7d7d('0x4c')]=function(_0x4879ff,_0x4d2361){return db[_0x7d7d('0x2e')]['create'](_0x4879ff[_0x7d7d('0x4d')],{})['then'](respondWithResult(_0x4d2361,0xc9))[_0x7d7d('0x46')](handleError(_0x4d2361,null));};exports[_0x7d7d('0x26')]=function(_0x3570eb,_0x111270){if(_0x3570eb[_0x7d7d('0x4d')]['id']){delete _0x3570eb[_0x7d7d('0x4d')]['id'];}return db[_0x7d7d('0x2e')][_0x7d7d('0x4b')]({'where':{'id':_0x3570eb[_0x7d7d('0x48')]['id']}})[_0x7d7d('0x27')](handleEntityNotFound(_0x111270,null))[_0x7d7d('0x27')](saveUpdates(_0x3570eb['body'],null))['then'](respondWithResult(_0x111270,null))[_0x7d7d('0x46')](handleError(_0x111270,null));};exports[_0x7d7d('0x4e')]=function(_0x46ffce,_0x2b6d67){return db[_0x7d7d('0x2e')][_0x7d7d('0x4b')]({'where':{'id':_0x46ffce[_0x7d7d('0x48')]['id']}})[_0x7d7d('0x27')](handleEntityNotFound(_0x2b6d67,null))[_0x7d7d('0x27')](removeEntity(_0x2b6d67,null))[_0x7d7d('0x46')](handleError(_0x2b6d67,null));};exports[_0x7d7d('0x4f')]=function(_0x1ba0a7,_0x33191d){return db[_0x7d7d('0x2e')][_0x7d7d('0x4f')]()[_0x7d7d('0x27')](respondWithResult(_0x33191d,null))['catch'](handleError(_0x33191d,null));}; \ No newline at end of file +var _0x2c98=['include','findAll','rawAttributes','merge','catch','create','body','find','describe','html-pdf','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','UserProfileResource','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','includeAll'];(function(_0x58b01d,_0x46e618){var _0x4d45aa=function(_0x326847){while(--_0x326847){_0x58b01d['push'](_0x58b01d['shift']());}};_0x4d45aa(++_0x46e618);}(_0x2c98,0x162));var _0x82c9=function(_0x5cd68b,_0x4c9339){_0x5cd68b=_0x5cd68b-0x0;var _0x94f68d=_0x2c98[_0x5cd68b];return _0x94f68d;};'use strict';var pdf=require(_0x82c9('0x0'));var emlformat=require(_0x82c9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x82c9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x82c9('0x3'));var util=require(_0x82c9('0x4'));var path=require(_0x82c9('0x5'));var sox=require(_0x82c9('0x6'));var csv=require(_0x82c9('0x7'));var ejs=require(_0x82c9('0x8'));var fs=require('fs');var _=require(_0x82c9('0x9'));var squel=require(_0x82c9('0xa'));var crypto=require(_0x82c9('0xb'));var jsforce=require(_0x82c9('0xc'));var deskjs=require(_0x82c9('0xd'));var toCsv=require(_0x82c9('0x7'));var querystring=require(_0x82c9('0xe'));var Papa=require(_0x82c9('0xf'));var Redis=require(_0x82c9('0x10'));var authService=require(_0x82c9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x82c9('0x12'));var hardwareService=require(_0x82c9('0x13'));var logger=require(_0x82c9('0x14'))('api');var utils=require(_0x82c9('0x15'));var config=require(_0x82c9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x82c9('0x17'))['db'];function respondWithStatusCode(_0x57823a,_0x79eae9){_0x79eae9=_0x79eae9||0xcc;return function(_0x5054f7){if(_0x5054f7){return _0x57823a[_0x82c9('0x18')](_0x79eae9);}return _0x57823a[_0x82c9('0x19')](_0x79eae9)[_0x82c9('0x1a')]();};}function respondWithResult(_0x3c32f9,_0x1c50fd){_0x1c50fd=_0x1c50fd||0xc8;return function(_0x20417a){if(_0x20417a){return _0x3c32f9[_0x82c9('0x19')](_0x1c50fd)[_0x82c9('0x1b')](_0x20417a);}};}function respondWithFilteredResult(_0x6880d8,_0x5f59c9){return function(_0xbdf351){if(_0xbdf351){var _0xc57256=_0xbdf351[_0x82c9('0x1c')],_0x20ec9b=_0x5f59c9[_0x82c9('0x1d')],_0x705c7d=_0x5f59c9[_0x82c9('0x1d')]+_0x5f59c9[_0x82c9('0x1e')],_0x122502;if(_0x705c7d>=_0xc57256){_0x705c7d=_0xc57256;_0x122502=0xc8;}else{_0x122502=0xce;}_0x6880d8['status'](_0x122502);return _0x6880d8[_0x82c9('0x1f')]('Content-Range',_0x20ec9b+'-'+_0x705c7d+'/'+_0xc57256)[_0x82c9('0x1b')](_0xbdf351);}return null;};}function patchUpdates(_0xc7a1e8){return function(_0x4beb34){try{jsonpatch[_0x82c9('0x20')](_0x4beb34,_0xc7a1e8,!![]);}catch(_0x5a2763){return BPromise[_0x82c9('0x21')](_0x5a2763);}return _0x4beb34[_0x82c9('0x22')]();};}function saveUpdates(_0x31aaf0,_0x5f0e90){return function(_0x5c84bb){if(_0x5c84bb){return _0x5c84bb[_0x82c9('0x23')](_0x31aaf0)[_0x82c9('0x24')](function(_0x3ec4a7){return _0x3ec4a7;});}return null;};}function removeEntity(_0xd5139a,_0x2aed2f){return function(_0x1425c5){if(_0x1425c5){return _0x1425c5[_0x82c9('0x25')]()['then'](function(){_0xd5139a[_0x82c9('0x19')](0xcc)[_0x82c9('0x1a')]();});}};}function handleEntityNotFound(_0x55244c,_0x4a4be8){return function(_0x3fd655){if(!_0x3fd655){_0x55244c[_0x82c9('0x18')](0x194);}return _0x3fd655;};}function handleError(_0x3542f4,_0x46c132){_0x46c132=_0x46c132||0x1f4;return function(_0x4915f8){logger[_0x82c9('0x26')](_0x4915f8[_0x82c9('0x27')]);if(_0x4915f8['name']){delete _0x4915f8[_0x82c9('0x28')];}_0x3542f4[_0x82c9('0x19')](_0x46c132)['send'](_0x4915f8);};}exports[_0x82c9('0x29')]=function(_0x55fa90,_0x5de900){var _0x550b2e={},_0x4b0685={},_0x1e9dcf={'count':0x0,'rows':[]};var _0x28d15f=_['map'](db[_0x82c9('0x2a')]['rawAttributes'],function(_0x264292){return{'name':_0x264292[_0x82c9('0x2b')],'type':_0x264292[_0x82c9('0x2c')]['key']};});_0x4b0685[_0x82c9('0x2d')]=_[_0x82c9('0x2e')](_0x28d15f,_0x82c9('0x28'));_0x4b0685[_0x82c9('0x2f')]=_['keys'](_0x55fa90[_0x82c9('0x2f')]);_0x4b0685[_0x82c9('0x30')]=_[_0x82c9('0x31')](_0x4b0685[_0x82c9('0x2d')],_0x4b0685['query']);_0x550b2e[_0x82c9('0x32')]=_[_0x82c9('0x31')](_0x4b0685[_0x82c9('0x2d')],qs[_0x82c9('0x33')](_0x55fa90['query'][_0x82c9('0x33')]));_0x550b2e['attributes']=_0x550b2e[_0x82c9('0x32')][_0x82c9('0x34')]?_0x550b2e[_0x82c9('0x32')]:_0x4b0685[_0x82c9('0x2d')];if(!_0x55fa90[_0x82c9('0x2f')]['hasOwnProperty'](_0x82c9('0x35'))){_0x550b2e[_0x82c9('0x1e')]=qs[_0x82c9('0x1e')](_0x55fa90['query']['limit']);_0x550b2e[_0x82c9('0x1d')]=qs[_0x82c9('0x1d')](_0x55fa90['query'][_0x82c9('0x1d')]);}_0x550b2e['order']=qs[_0x82c9('0x36')](_0x55fa90[_0x82c9('0x2f')]['sort']);_0x550b2e['where']=qs[_0x82c9('0x30')](_[_0x82c9('0x37')](_0x55fa90['query'],_0x4b0685[_0x82c9('0x30')]),_0x28d15f);if(_0x55fa90[_0x82c9('0x2f')][_0x82c9('0x38')]){_0x550b2e[_0x82c9('0x39')]=_['merge'](_0x550b2e[_0x82c9('0x39')],{'$or':_[_0x82c9('0x2e')](_0x28d15f,function(_0x587f8e){if(_0x587f8e[_0x82c9('0x2c')]!==_0x82c9('0x3a')){var _0x56a69d={};_0x56a69d[_0x587f8e[_0x82c9('0x28')]]={'$like':'%'+_0x55fa90['query'][_0x82c9('0x38')]+'%'};return _0x56a69d;}})});}_0x550b2e=_['merge']({},_0x550b2e,_0x55fa90['options']);var _0x4e1d4b={'where':_0x550b2e['where']};return db[_0x82c9('0x2a')]['count'](_0x4e1d4b)[_0x82c9('0x24')](function(_0x293c31){_0x1e9dcf['count']=_0x293c31;if(_0x55fa90[_0x82c9('0x2f')][_0x82c9('0x3b')]){_0x550b2e[_0x82c9('0x3c')]=[{'all':!![]}];}return db[_0x82c9('0x2a')][_0x82c9('0x3d')](_0x550b2e);})[_0x82c9('0x24')](function(_0x345d96){_0x1e9dcf['rows']=_0x345d96;return _0x1e9dcf;})[_0x82c9('0x24')](respondWithFilteredResult(_0x5de900,_0x550b2e))['catch'](handleError(_0x5de900,null));};exports['show']=function(_0x45a364,_0x130972){var _0xb032ad={'raw':![],'where':{'id':_0x45a364['params']['id']}},_0x37be75={};_0x37be75['model']=_['keys'](db[_0x82c9('0x2a')][_0x82c9('0x3e')]);_0x37be75[_0x82c9('0x2f')]=_['keys'](_0x45a364['query']);_0x37be75['filtears']=_[_0x82c9('0x31')](_0x37be75[_0x82c9('0x2d')],_0x37be75['query']);_0xb032ad[_0x82c9('0x32')]=_['intersection'](_0x37be75[_0x82c9('0x2d')],qs['fields'](_0x45a364[_0x82c9('0x2f')]['fields']));_0xb032ad['attributes']=_0xb032ad[_0x82c9('0x32')][_0x82c9('0x34')]?_0xb032ad['attributes']:_0x37be75['model'];if(_0x45a364[_0x82c9('0x2f')][_0x82c9('0x3b')]){_0xb032ad[_0x82c9('0x3c')]=[{'all':!![]}];}_0xb032ad=_[_0x82c9('0x3f')]({},_0xb032ad,_0x45a364['options']);return db[_0x82c9('0x2a')]['find'](_0xb032ad)[_0x82c9('0x24')](handleEntityNotFound(_0x130972,null))[_0x82c9('0x24')](respondWithResult(_0x130972,null))[_0x82c9('0x40')](handleError(_0x130972,null));};exports[_0x82c9('0x41')]=function(_0x142b59,_0x318e6e){return db[_0x82c9('0x2a')][_0x82c9('0x41')](_0x142b59[_0x82c9('0x42')],{})[_0x82c9('0x24')](respondWithResult(_0x318e6e,0xc9))['catch'](handleError(_0x318e6e,null));};exports['update']=function(_0xe94d97,_0x5de41b){if(_0xe94d97[_0x82c9('0x42')]['id']){delete _0xe94d97[_0x82c9('0x42')]['id'];}return db[_0x82c9('0x2a')][_0x82c9('0x43')]({'where':{'id':_0xe94d97['params']['id']}})[_0x82c9('0x24')](handleEntityNotFound(_0x5de41b,null))[_0x82c9('0x24')](saveUpdates(_0xe94d97[_0x82c9('0x42')],null))[_0x82c9('0x24')](respondWithResult(_0x5de41b,null))[_0x82c9('0x40')](handleError(_0x5de41b,null));};exports[_0x82c9('0x25')]=function(_0x2a3c04,_0x54c410){return db[_0x82c9('0x2a')]['find']({'where':{'id':_0x2a3c04['params']['id']}})[_0x82c9('0x24')](handleEntityNotFound(_0x54c410,null))[_0x82c9('0x24')](removeEntity(_0x54c410,null))['catch'](handleError(_0x54c410,null));};exports[_0x82c9('0x44')]=function(_0x47b779,_0x43b0dc){return db['UserProfileResource'][_0x82c9('0x44')]()[_0x82c9('0x24')](respondWithResult(_0x43b0dc,null))[_0x82c9('0x40')](handleError(_0x43b0dc,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 06a086a..16851a7 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 _0xa416=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x127079,_0x9e5866){var _0x1f206f=function(_0x11e7cc){while(--_0x11e7cc){_0x127079['push'](_0x127079['shift']());}};_0x1f206f(++_0x9e5866);}(_0xa416,0x7c));var _0x6a41=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa416[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6a41('0x0'));var util=require('util');var logger=require(_0x6a41('0x1'))('api');var moment=require(_0x6a41('0x2'));var BPromise=require(_0x6a41('0x3'));var rp=require(_0x6a41('0x4'));var fs=require('fs');var path=require(_0x6a41('0x5'));var rimraf=require(_0x6a41('0x6'));var config=require(_0x6a41('0x7'));var attributes=require(_0x6a41('0x8'));module[_0x6a41('0x9')]=function(_0x57dbdc,_0x27fe4b){return _0x57dbdc[_0x6a41('0xa')](_0x6a41('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6a41('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0741=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x1fcd0e,_0x1bbf1a){var _0x5a6465=function(_0x362eeb){while(--_0x362eeb){_0x1fcd0e['push'](_0x1fcd0e['shift']());}};_0x5a6465(++_0x1bbf1a);}(_0x0741,0xa1));var _0x1074=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0741[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1074('0x0'))(_0x1074('0x1'));var moment=require(_0x1074('0x2'));var BPromise=require('bluebird');var rp=require(_0x1074('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1074('0x4'));var config=require(_0x1074('0x5'));var attributes=require('./userProfileResource.attributes');module[_0x1074('0x6')]=function(_0x5886d1,_0x27bf23){return _0x5886d1[_0x1074('0x7')](_0x1074('0x8'),attributes,{'tableName':_0x1074('0x9'),'paranoid':![],'indexes':[{'name':_0x1074('0xa'),'fields':[_0x1074('0xb'),_0x1074('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bdb07ee..7873dca 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 _0x4ee7=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2a0c8f,_0x5adec9){var _0x59dacc=function(_0x479fb2){while(--_0x479fb2){_0x2a0c8f['push'](_0x2a0c8f['shift']());}};_0x59dacc(++_0x5adec9);}(_0x4ee7,0x169));var _0x74ee=function(_0x1e38f1,_0x518359){_0x1e38f1=_0x1e38f1-0x0;var _0x3fab4b=_0x4ee7[_0x1e38f1];return _0x3fab4b;};'use strict';var _=require(_0x74ee('0x0'));var util=require(_0x74ee('0x1'));var moment=require('moment');var BPromise=require(_0x74ee('0x2'));var rs=require(_0x74ee('0x3'));var fs=require('fs');var Redis=require(_0x74ee('0x4'));var db=require(_0x74ee('0x5'))['db'];var utils=require(_0x74ee('0x6'));var logger=require(_0x74ee('0x7'))(_0x74ee('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4172be,_0x483b39,_0x540fc5){return new BPromise(function(_0x5d6ad9,_0x5da187){return client['request'](_0x4172be,_0x540fc5)['then'](function(_0x44ea5c){logger[_0x74ee('0xa')](_0x74ee('0xb'),_0x483b39,'request\x20sent');logger['debug'](_0x74ee('0xc'),_0x483b39,_0x74ee('0xd'),JSON['stringify'](_0x44ea5c));if(_0x44ea5c[_0x74ee('0xe')]){if(_0x44ea5c['error'][_0x74ee('0xf')]===0x1f4){logger[_0x74ee('0xe')](_0x74ee('0xb'),_0x483b39,_0x44ea5c[_0x74ee('0xe')][_0x74ee('0x10')]);return _0x5da187(_0x44ea5c[_0x74ee('0xe')][_0x74ee('0x10')]);}logger['error'](_0x74ee('0xb'),_0x483b39,_0x44ea5c[_0x74ee('0xe')][_0x74ee('0x10')]);return _0x5d6ad9(_0x44ea5c[_0x74ee('0xe')][_0x74ee('0x10')]);}else{logger[_0x74ee('0xa')](_0x74ee('0xb'),_0x483b39,_0x74ee('0xd'));_0x5d6ad9(_0x44ea5c[_0x74ee('0x11')]['message']);}})[_0x74ee('0x12')](function(_0x723ec2){logger[_0x74ee('0xe')](_0x74ee('0xb'),_0x483b39,_0x723ec2);_0x5da187(_0x723ec2);});});} \ No newline at end of file +var _0xc9ff=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x509795,_0x38a202){var _0x1ac493=function(_0x3367bf){while(--_0x3367bf){_0x509795['push'](_0x509795['shift']());}};_0x1ac493(++_0x38a202);}(_0xc9ff,0xb2));var _0xfc9f=function(_0x3b7a41,_0x3e039a){_0x3b7a41=_0x3b7a41-0x0;var _0x18426d=_0xc9ff[_0x3b7a41];return _0x18426d;};'use strict';var _=require(_0xfc9f('0x0'));var util=require(_0xfc9f('0x1'));var moment=require(_0xfc9f('0x2'));var BPromise=require(_0xfc9f('0x3'));var rs=require(_0xfc9f('0x4'));var fs=require('fs');var Redis=require(_0xfc9f('0x5'));var db=require(_0xfc9f('0x6'))['db'];var utils=require(_0xfc9f('0x7'));var logger=require(_0xfc9f('0x8'))(_0xfc9f('0x9'));var config=require(_0xfc9f('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfc9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x255d4b,_0x19c7df,_0x1e9c63){return new BPromise(function(_0x131aa7,_0x4f1306){return client['request'](_0x255d4b,_0x1e9c63)['then'](function(_0x378a33){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x19c7df,_0xfc9f('0xc'));logger[_0xfc9f('0xd')](_0xfc9f('0xe'),_0x19c7df,_0xfc9f('0xc'),JSON[_0xfc9f('0xf')](_0x378a33));if(_0x378a33['error']){if(_0x378a33[_0xfc9f('0x10')][_0xfc9f('0x11')]===0x1f4){logger[_0xfc9f('0x10')](_0xfc9f('0x12'),_0x19c7df,_0x378a33['error'][_0xfc9f('0x13')]);return _0x4f1306(_0x378a33[_0xfc9f('0x10')][_0xfc9f('0x13')]);}logger[_0xfc9f('0x10')](_0xfc9f('0x12'),_0x19c7df,_0x378a33[_0xfc9f('0x10')]['message']);return _0x131aa7(_0x378a33['error'][_0xfc9f('0x13')]);}else{logger[_0xfc9f('0x14')](_0xfc9f('0x12'),_0x19c7df,_0xfc9f('0xc'));_0x131aa7(_0x378a33[_0xfc9f('0x15')][_0xfc9f('0x13')]);}})[_0xfc9f('0x16')](function(_0x2b2e60){logger[_0xfc9f('0x10')](_0xfc9f('0x12'),_0x19c7df,_0x2b2e60);_0x4f1306(_0x2b2e60);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7faf378..1ee58c5 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 _0x714a=['index','/describe','describe','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated'];(function(_0x50aaa5,_0x452470){var _0x23108d=function(_0x1052c5){while(--_0x1052c5){_0x50aaa5['push'](_0x50aaa5['shift']());}};_0x23108d(++_0x452470);}(_0x714a,0xd8));var _0xa714=function(_0x2b3054,_0x5164bf){_0x2b3054=_0x2b3054-0x0;var _0x35e363=_0x714a[_0x2b3054];return _0x35e363;};'use strict';var multer=require('multer');var util=require(_0xa714('0x0'));var path=require('path');var timeout=require(_0xa714('0x1'));var express=require(_0xa714('0x2'));var router=express[_0xa714('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa714('0x4'));var config=require('../../config/environment');var controller=require(_0xa714('0x5'));router[_0xa714('0x6')]('/',auth[_0xa714('0x7')](),controller[_0xa714('0x8')]);router[_0xa714('0x6')](_0xa714('0x9'),auth[_0xa714('0x7')](),controller[_0xa714('0xa')]);router[_0xa714('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa714('0xb')]);router['post']('/',auth[_0xa714('0x7')](),controller[_0xa714('0xc')]);router[_0xa714('0xd')]('/:id',auth[_0xa714('0x7')](),controller['update']);router[_0xa714('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa714('0xf')]);module['exports']=router; \ No newline at end of file +var _0x933b=['show','put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x933b,0x16e));var _0xb933=function(_0x3b1147,_0x1932e0){_0x3b1147=_0x3b1147-0x0;var _0x5421ff=_0x933b[_0x3b1147];return _0x5421ff;};'use strict';var multer=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb933('0x2'));var router=express[_0xb933('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb933('0x4'));var config=require(_0xb933('0x5'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0xb933('0x6')](),controller[_0xb933('0x7')]);router[_0xb933('0x8')](_0xb933('0x9'),auth['isAuthenticated'](),controller[_0xb933('0xa')]);router[_0xb933('0x8')](_0xb933('0xb'),auth[_0xb933('0x6')](),controller[_0xb933('0xc')]);router['post']('/',auth[_0xb933('0x6')](),controller['create']);router[_0xb933('0xd')]('/:id',auth[_0xb933('0x6')](),controller[_0xb933('0xe')]);router[_0xb933('0xf')](_0xb933('0xb'),auth[_0xb933('0x6')](),controller[_0xb933('0x10')]);module[_0xb933('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index cb2a16c..0fd9c9c 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 _0x2e3d=['BOOLEAN','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x44335a,_0x4c65ce){var _0x47187d=function(_0x56d694){while(--_0x56d694){_0x44335a['push'](_0x44335a['shift']());}};_0x47187d(++_0x4c65ce);}(_0x2e3d,0x8c));var _0xd2e3=function(_0x7c0323,_0x28d237){_0x7c0323=_0x7c0323-0x0;var _0x23ee0e=_0x2e3d[_0x7c0323];return _0x23ee0e;};'use strict';var Sequelize=require(_0xd2e3('0x0'));module[_0xd2e3('0x1')]={'name':{'type':Sequelize[_0xd2e3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xd2e3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd2e3('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd2e3('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd2e3('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd2e3('0x2')],'set':function(_0x431948){this['setDataValue'](_0xd2e3('0x5'),_0x431948?_0x431948[_0xd2e3('0x6')](''):[]);},'get':function(){return this[_0xd2e3('0x7')](_0xd2e3('0x5'))?this['getDataValue'](_0xd2e3('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x94c4=['getDataValue','crudPermissions','sequelize','exports','INTEGER','BOOLEAN','STRING'];(function(_0x6b4f52,_0x4a17d1){var _0xa387e5=function(_0x2643b8){while(--_0x2643b8){_0x6b4f52['push'](_0x6b4f52['shift']());}};_0xa387e5(++_0x4a17d1);}(_0x94c4,0x11a));var _0x494c=function(_0xf938fd,_0x1b606e){_0xf938fd=_0xf938fd-0x0;var _0x3e511c=_0x94c4[_0xf938fd];return _0x3e511c;};'use strict';var Sequelize=require(_0x494c('0x0'));module[_0x494c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x494c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x494c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x494c('0x4')],'set':function(_0x124f7d){this['setDataValue']('crudPermissions',_0x124f7d?_0x124f7d['join'](''):[]);},'get':function(){return this[_0x494c('0x5')](_0x494c('0x6'))?this['getDataValue'](_0x494c('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c3b5da2..39c61e6 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 _0x0721=['includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','UserProfileSection','count'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x0721,0x9e));var _0x1072=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x0721[_0x3de7e0];return _0x11d0b3;};'use strict';var pdf=require(_0x1072('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1072('0x1'));var zipdir=require(_0x1072('0x2'));var jsonpatch=require(_0x1072('0x3'));var rp=require(_0x1072('0x4'));var moment=require(_0x1072('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1072('0x6'));var util=require(_0x1072('0x7'));var path=require('path');var sox=require(_0x1072('0x8'));var csv=require('to-csv');var ejs=require(_0x1072('0x9'));var fs=require('fs');var _=require(_0x1072('0xa'));var squel=require(_0x1072('0xb'));var crypto=require(_0x1072('0xc'));var jsforce=require(_0x1072('0xd'));var deskjs=require(_0x1072('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1072('0xf'));var Redis=require(_0x1072('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1072('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1072('0x12'))(_0x1072('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1072('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2553fc,_0x4dfbd9){_0x4dfbd9=_0x4dfbd9||0xcc;return function(_0x496928){if(_0x496928){return _0x2553fc[_0x1072('0x15')](_0x4dfbd9);}return _0x2553fc[_0x1072('0x16')](_0x4dfbd9)[_0x1072('0x17')]();};}function respondWithResult(_0x1f88c4,_0x358029){_0x358029=_0x358029||0xc8;return function(_0x162cb4){if(_0x162cb4){return _0x1f88c4[_0x1072('0x16')](_0x358029)[_0x1072('0x18')](_0x162cb4);}};}function respondWithFilteredResult(_0xd5c4c8,_0x1674d4){return function(_0x1a6808){if(_0x1a6808){var _0x5396ad=_0x1a6808['count'],_0x23f138=_0x1674d4[_0x1072('0x19')],_0x13d9a7=_0x1674d4[_0x1072('0x19')]+_0x1674d4[_0x1072('0x1a')],_0x3e5d4a;if(_0x13d9a7>=_0x5396ad){_0x13d9a7=_0x5396ad;_0x3e5d4a=0xc8;}else{_0x3e5d4a=0xce;}_0xd5c4c8['status'](_0x3e5d4a);return _0xd5c4c8['set'](_0x1072('0x1b'),_0x23f138+'-'+_0x13d9a7+'/'+_0x5396ad)[_0x1072('0x18')](_0x1a6808);}return null;};}function patchUpdates(_0x52e26e){return function(_0x1b41dc){try{jsonpatch[_0x1072('0x1c')](_0x1b41dc,_0x52e26e,!![]);}catch(_0x3f6b11){return BPromise['reject'](_0x3f6b11);}return _0x1b41dc[_0x1072('0x1d')]();};}function saveUpdates(_0x5cb993,_0x6162a9){return function(_0x1942c5){if(_0x1942c5){return _0x1942c5[_0x1072('0x1e')](_0x5cb993)['then'](function(_0x26d924){return _0x26d924;});}return null;};}function removeEntity(_0x4f0592,_0x491690){return function(_0x1a7a6c){if(_0x1a7a6c){return _0x1a7a6c[_0x1072('0x1f')]()[_0x1072('0x20')](function(){_0x4f0592[_0x1072('0x16')](0xcc)[_0x1072('0x17')]();});}};}function handleEntityNotFound(_0x16a237,_0x2b15d9){return function(_0x5bb1ee){if(!_0x5bb1ee){_0x16a237['sendStatus'](0x194);}return _0x5bb1ee;};}function handleError(_0x3d510c,_0x410239){_0x410239=_0x410239||0x1f4;return function(_0x26abf8){logger[_0x1072('0x21')](_0x26abf8[_0x1072('0x22')]);if(_0x26abf8[_0x1072('0x23')]){delete _0x26abf8[_0x1072('0x23')];}_0x3d510c[_0x1072('0x16')](_0x410239)[_0x1072('0x24')](_0x26abf8);};}exports[_0x1072('0x25')]=function(_0x42a56e,_0x4d486d){var _0x5dc1bc={},_0x1cb93c={},_0x3495dd={'count':0x0,'rows':[]};var _0x326082=_[_0x1072('0x26')](db['UserProfileSection'][_0x1072('0x27')],function(_0x56d605){return{'name':_0x56d605[_0x1072('0x28')],'type':_0x56d605[_0x1072('0x29')][_0x1072('0x2a')]};});_0x1cb93c[_0x1072('0x2b')]=_['map'](_0x326082,_0x1072('0x23'));_0x1cb93c[_0x1072('0x2c')]=_['keys'](_0x42a56e[_0x1072('0x2c')]);_0x1cb93c[_0x1072('0x2d')]=_[_0x1072('0x2e')](_0x1cb93c[_0x1072('0x2b')],_0x1cb93c[_0x1072('0x2c')]);_0x5dc1bc[_0x1072('0x2f')]=_[_0x1072('0x2e')](_0x1cb93c['model'],qs['fields'](_0x42a56e['query'][_0x1072('0x30')]));_0x5dc1bc['attributes']=_0x5dc1bc['attributes'][_0x1072('0x31')]?_0x5dc1bc[_0x1072('0x2f')]:_0x1cb93c[_0x1072('0x2b')];if(!_0x42a56e[_0x1072('0x2c')][_0x1072('0x32')](_0x1072('0x33'))){_0x5dc1bc[_0x1072('0x1a')]=qs[_0x1072('0x1a')](_0x42a56e[_0x1072('0x2c')][_0x1072('0x1a')]);_0x5dc1bc['offset']=qs[_0x1072('0x19')](_0x42a56e['query']['offset']);}_0x5dc1bc[_0x1072('0x34')]=qs[_0x1072('0x35')](_0x42a56e['query'][_0x1072('0x35')]);_0x5dc1bc[_0x1072('0x36')]=qs['filters'](_[_0x1072('0x37')](_0x42a56e['query'],_0x1cb93c[_0x1072('0x2d')]),_0x326082);if(_0x42a56e['query']['filter']){_0x5dc1bc[_0x1072('0x36')]=_[_0x1072('0x38')](_0x5dc1bc['where'],{'$or':_[_0x1072('0x26')](_0x326082,function(_0x38b2ba){if(_0x38b2ba[_0x1072('0x29')]!==_0x1072('0x39')){var _0xaff333={};_0xaff333[_0x38b2ba['name']]={'$like':'%'+_0x42a56e[_0x1072('0x2c')][_0x1072('0x3a')]+'%'};return _0xaff333;}})});}_0x5dc1bc=_[_0x1072('0x38')]({},_0x5dc1bc,_0x42a56e['options']);var _0x3a56ec={'where':_0x5dc1bc[_0x1072('0x36')]};return db[_0x1072('0x3b')][_0x1072('0x3c')](_0x3a56ec)[_0x1072('0x20')](function(_0x2a8de8){_0x3495dd[_0x1072('0x3c')]=_0x2a8de8;if(_0x42a56e[_0x1072('0x2c')][_0x1072('0x3d')]){_0x5dc1bc[_0x1072('0x3e')]=[{'all':!![]}];}return db[_0x1072('0x3b')][_0x1072('0x3f')](_0x5dc1bc);})[_0x1072('0x20')](function(_0x224eb1){_0x3495dd[_0x1072('0x40')]=_0x224eb1;return _0x3495dd;})[_0x1072('0x20')](respondWithFilteredResult(_0x4d486d,_0x5dc1bc))[_0x1072('0x41')](handleError(_0x4d486d,null));};exports['show']=function(_0x45bccf,_0x4b75e1){var _0x15d1a9={'raw':![],'where':{'id':_0x45bccf[_0x1072('0x42')]['id']}},_0x423d7e={};_0x423d7e[_0x1072('0x2b')]=_['keys'](db[_0x1072('0x3b')][_0x1072('0x27')]);_0x423d7e['query']=_[_0x1072('0x43')](_0x45bccf[_0x1072('0x2c')]);_0x423d7e['filtears']=_['intersection'](_0x423d7e['model'],_0x423d7e[_0x1072('0x2c')]);_0x15d1a9[_0x1072('0x2f')]=_[_0x1072('0x2e')](_0x423d7e[_0x1072('0x2b')],qs[_0x1072('0x30')](_0x45bccf[_0x1072('0x2c')][_0x1072('0x30')]));_0x15d1a9[_0x1072('0x2f')]=_0x15d1a9[_0x1072('0x2f')][_0x1072('0x31')]?_0x15d1a9[_0x1072('0x2f')]:_0x423d7e[_0x1072('0x2b')];if(_0x45bccf[_0x1072('0x2c')][_0x1072('0x3d')]){_0x15d1a9['include']=[{'all':!![]}];}_0x15d1a9=_['merge']({},_0x15d1a9,_0x45bccf[_0x1072('0x44')]);return db[_0x1072('0x3b')][_0x1072('0x45')](_0x15d1a9)[_0x1072('0x20')](handleEntityNotFound(_0x4b75e1,null))[_0x1072('0x20')](respondWithResult(_0x4b75e1,null))[_0x1072('0x41')](handleError(_0x4b75e1,null));};exports[_0x1072('0x46')]=function(_0x143889,_0xfe92da){return db[_0x1072('0x3b')][_0x1072('0x46')](_0x143889[_0x1072('0x47')],{})[_0x1072('0x20')](respondWithResult(_0xfe92da,0xc9))[_0x1072('0x41')](handleError(_0xfe92da,null));};exports['update']=function(_0x842eb5,_0x31f18e){if(_0x842eb5['body']['id']){delete _0x842eb5['body']['id'];}return db[_0x1072('0x3b')][_0x1072('0x45')]({'where':{'id':_0x842eb5[_0x1072('0x42')]['id']}})['then'](handleEntityNotFound(_0x31f18e,null))[_0x1072('0x20')](saveUpdates(_0x842eb5[_0x1072('0x47')],null))[_0x1072('0x20')](respondWithResult(_0x31f18e,null))[_0x1072('0x41')](handleError(_0x31f18e,null));};exports[_0x1072('0x1f')]=function(_0x563a6a,_0x20d8be){return db[_0x1072('0x3b')][_0x1072('0x45')]({'where':{'id':_0x563a6a[_0x1072('0x42')]['id']}})[_0x1072('0x20')](handleEntityNotFound(_0x20d8be,null))[_0x1072('0x20')](removeEntity(_0x20d8be,null))[_0x1072('0x41')](handleError(_0x20d8be,null));};exports['describe']=function(_0x42ba51,_0x57b282){return db['UserProfileSection'][_0x1072('0x48')]()[_0x1072('0x20')](respondWithResult(_0x57b282,null))['catch'](handleError(_0x57b282,null));}; \ No newline at end of file +var _0xb360=['apply','reject','save','update','destroy','end','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','filter','merge','count','then','includeAll','show','params','filtears','include','options','find','create','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','limit','Content-Range','json'];(function(_0x2095cb,_0xd96b5){var _0x30f7a8=function(_0x561296){while(--_0x561296){_0x2095cb['push'](_0x2095cb['shift']());}};_0x30f7a8(++_0xd96b5);}(_0xb360,0xc1));var _0x0b36=function(_0x3cacf7,_0x31021e){_0x3cacf7=_0x3cacf7-0x0;var _0x21871a=_0xb360[_0x3cacf7];return _0x21871a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b36('0x1'));var jsonpatch=require(_0x0b36('0x2'));var rp=require(_0x0b36('0x3'));var moment=require(_0x0b36('0x4'));var BPromise=require(_0x0b36('0x5'));var Mustache=require(_0x0b36('0x6'));var util=require(_0x0b36('0x7'));var path=require(_0x0b36('0x8'));var sox=require('sox');var csv=require(_0x0b36('0x9'));var ejs=require(_0x0b36('0xa'));var fs=require('fs');var _=require(_0x0b36('0xb'));var squel=require(_0x0b36('0xc'));var crypto=require('crypto');var jsforce=require(_0x0b36('0xd'));var deskjs=require(_0x0b36('0xe'));var toCsv=require(_0x0b36('0x9'));var querystring=require(_0x0b36('0xf'));var Papa=require(_0x0b36('0x10'));var Redis=require(_0x0b36('0x11'));var authService=require(_0x0b36('0x12'));var qs=require(_0x0b36('0x13'));var as=require(_0x0b36('0x14'));var hardwareService=require(_0x0b36('0x15'));var logger=require('../../config/logger')(_0x0b36('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0b36('0x17'))['db'];function respondWithStatusCode(_0x1f07c9,_0xe73c5c){_0xe73c5c=_0xe73c5c||0xcc;return function(_0x58f327){if(_0x58f327){return _0x1f07c9[_0x0b36('0x18')](_0xe73c5c);}return _0x1f07c9[_0x0b36('0x19')](_0xe73c5c)['end']();};}function respondWithResult(_0x264240,_0x1e48e1){_0x1e48e1=_0x1e48e1||0xc8;return function(_0x2beb76){if(_0x2beb76){return _0x264240[_0x0b36('0x19')](_0x1e48e1)['json'](_0x2beb76);}};}function respondWithFilteredResult(_0x5e774c,_0x337e7f){return function(_0x1bfb0d){if(_0x1bfb0d){var _0x3bbec1=_0x1bfb0d['count'],_0x74f1b6=_0x337e7f['offset'],_0x233afe=_0x337e7f['offset']+_0x337e7f[_0x0b36('0x1a')],_0x16f18e;if(_0x233afe>=_0x3bbec1){_0x233afe=_0x3bbec1;_0x16f18e=0xc8;}else{_0x16f18e=0xce;}_0x5e774c[_0x0b36('0x19')](_0x16f18e);return _0x5e774c['set'](_0x0b36('0x1b'),_0x74f1b6+'-'+_0x233afe+'/'+_0x3bbec1)[_0x0b36('0x1c')](_0x1bfb0d);}return null;};}function patchUpdates(_0x1b5633){return function(_0xd4d42c){try{jsonpatch[_0x0b36('0x1d')](_0xd4d42c,_0x1b5633,!![]);}catch(_0x561176){return BPromise[_0x0b36('0x1e')](_0x561176);}return _0xd4d42c[_0x0b36('0x1f')]();};}function saveUpdates(_0x2cfa61,_0x50ab14){return function(_0x31067e){if(_0x31067e){return _0x31067e[_0x0b36('0x20')](_0x2cfa61)['then'](function(_0x45c896){return _0x45c896;});}return null;};}function removeEntity(_0x290e4a,_0x1ad768){return function(_0x2fb711){if(_0x2fb711){return _0x2fb711[_0x0b36('0x21')]()['then'](function(){_0x290e4a[_0x0b36('0x19')](0xcc)[_0x0b36('0x22')]();});}};}function handleEntityNotFound(_0x122497,_0x228b7b){return function(_0x29b7d1){if(!_0x29b7d1){_0x122497[_0x0b36('0x18')](0x194);}return _0x29b7d1;};}function handleError(_0x39bfd1,_0x204425){_0x204425=_0x204425||0x1f4;return function(_0x33a191){logger[_0x0b36('0x23')](_0x33a191[_0x0b36('0x24')]);if(_0x33a191['name']){delete _0x33a191[_0x0b36('0x25')];}_0x39bfd1[_0x0b36('0x19')](_0x204425)[_0x0b36('0x26')](_0x33a191);};}exports[_0x0b36('0x27')]=function(_0x2b3212,_0x280d3e){var _0x2f45ff={},_0x1c6ed7={},_0x38c4d2={'count':0x0,'rows':[]};var _0x3658c4=_[_0x0b36('0x28')](db[_0x0b36('0x29')][_0x0b36('0x2a')],function(_0x1fa8dd){return{'name':_0x1fa8dd[_0x0b36('0x2b')],'type':_0x1fa8dd[_0x0b36('0x2c')][_0x0b36('0x2d')]};});_0x1c6ed7[_0x0b36('0x2e')]=_[_0x0b36('0x28')](_0x3658c4,_0x0b36('0x25'));_0x1c6ed7[_0x0b36('0x2f')]=_[_0x0b36('0x30')](_0x2b3212['query']);_0x1c6ed7[_0x0b36('0x31')]=_[_0x0b36('0x32')](_0x1c6ed7[_0x0b36('0x2e')],_0x1c6ed7[_0x0b36('0x2f')]);_0x2f45ff['attributes']=_[_0x0b36('0x32')](_0x1c6ed7[_0x0b36('0x2e')],qs[_0x0b36('0x33')](_0x2b3212[_0x0b36('0x2f')][_0x0b36('0x33')]));_0x2f45ff[_0x0b36('0x34')]=_0x2f45ff['attributes'][_0x0b36('0x35')]?_0x2f45ff['attributes']:_0x1c6ed7[_0x0b36('0x2e')];if(!_0x2b3212['query'][_0x0b36('0x36')]('nolimit')){_0x2f45ff[_0x0b36('0x1a')]=qs[_0x0b36('0x1a')](_0x2b3212['query'][_0x0b36('0x1a')]);_0x2f45ff[_0x0b36('0x37')]=qs[_0x0b36('0x37')](_0x2b3212[_0x0b36('0x2f')][_0x0b36('0x37')]);}_0x2f45ff[_0x0b36('0x38')]=qs['sort'](_0x2b3212[_0x0b36('0x2f')][_0x0b36('0x39')]);_0x2f45ff[_0x0b36('0x3a')]=qs[_0x0b36('0x31')](_['pick'](_0x2b3212[_0x0b36('0x2f')],_0x1c6ed7['filters']),_0x3658c4);if(_0x2b3212['query'][_0x0b36('0x3b')]){_0x2f45ff['where']=_[_0x0b36('0x3c')](_0x2f45ff['where'],{'$or':_['map'](_0x3658c4,function(_0x18e6b1){if(_0x18e6b1[_0x0b36('0x2c')]!=='VIRTUAL'){var _0xa1ea41={};_0xa1ea41[_0x18e6b1[_0x0b36('0x25')]]={'$like':'%'+_0x2b3212['query'][_0x0b36('0x3b')]+'%'};return _0xa1ea41;}})});}_0x2f45ff=_[_0x0b36('0x3c')]({},_0x2f45ff,_0x2b3212['options']);var _0x4d6282={'where':_0x2f45ff[_0x0b36('0x3a')]};return db['UserProfileSection'][_0x0b36('0x3d')](_0x4d6282)[_0x0b36('0x3e')](function(_0x32928f){_0x38c4d2[_0x0b36('0x3d')]=_0x32928f;if(_0x2b3212[_0x0b36('0x2f')][_0x0b36('0x3f')]){_0x2f45ff['include']=[{'all':!![]}];}return db[_0x0b36('0x29')]['findAll'](_0x2f45ff);})[_0x0b36('0x3e')](function(_0x3bf28e){_0x38c4d2['rows']=_0x3bf28e;return _0x38c4d2;})[_0x0b36('0x3e')](respondWithFilteredResult(_0x280d3e,_0x2f45ff))['catch'](handleError(_0x280d3e,null));};exports[_0x0b36('0x40')]=function(_0x895077,_0x2f7b68){var _0x32b049={'raw':![],'where':{'id':_0x895077[_0x0b36('0x41')]['id']}},_0x11ce8c={};_0x11ce8c[_0x0b36('0x2e')]=_[_0x0b36('0x30')](db[_0x0b36('0x29')][_0x0b36('0x2a')]);_0x11ce8c[_0x0b36('0x2f')]=_[_0x0b36('0x30')](_0x895077[_0x0b36('0x2f')]);_0x11ce8c[_0x0b36('0x42')]=_[_0x0b36('0x32')](_0x11ce8c[_0x0b36('0x2e')],_0x11ce8c[_0x0b36('0x2f')]);_0x32b049[_0x0b36('0x34')]=_[_0x0b36('0x32')](_0x11ce8c[_0x0b36('0x2e')],qs[_0x0b36('0x33')](_0x895077[_0x0b36('0x2f')][_0x0b36('0x33')]));_0x32b049[_0x0b36('0x34')]=_0x32b049['attributes'][_0x0b36('0x35')]?_0x32b049[_0x0b36('0x34')]:_0x11ce8c[_0x0b36('0x2e')];if(_0x895077[_0x0b36('0x2f')]['includeAll']){_0x32b049[_0x0b36('0x43')]=[{'all':!![]}];}_0x32b049=_[_0x0b36('0x3c')]({},_0x32b049,_0x895077[_0x0b36('0x44')]);return db[_0x0b36('0x29')][_0x0b36('0x45')](_0x32b049)[_0x0b36('0x3e')](handleEntityNotFound(_0x2f7b68,null))['then'](respondWithResult(_0x2f7b68,null))['catch'](handleError(_0x2f7b68,null));};exports['create']=function(_0x4760fd,_0x2d0e49){return db['UserProfileSection'][_0x0b36('0x46')](_0x4760fd['body'],{})['then'](respondWithResult(_0x2d0e49,0xc9))[_0x0b36('0x47')](handleError(_0x2d0e49,null));};exports[_0x0b36('0x20')]=function(_0x34a670,_0x49fb19){if(_0x34a670[_0x0b36('0x48')]['id']){delete _0x34a670[_0x0b36('0x48')]['id'];}return db[_0x0b36('0x29')]['find']({'where':{'id':_0x34a670[_0x0b36('0x41')]['id']}})[_0x0b36('0x3e')](handleEntityNotFound(_0x49fb19,null))['then'](saveUpdates(_0x34a670[_0x0b36('0x48')],null))[_0x0b36('0x3e')](respondWithResult(_0x49fb19,null))[_0x0b36('0x47')](handleError(_0x49fb19,null));};exports['destroy']=function(_0x3b43be,_0x4a778b){return db[_0x0b36('0x29')]['find']({'where':{'id':_0x3b43be['params']['id']}})['then'](handleEntityNotFound(_0x4a778b,null))[_0x0b36('0x3e')](removeEntity(_0x4a778b,null))['catch'](handleError(_0x4a778b,null));};exports[_0x0b36('0x49')]=function(_0x18b97c,_0x4fb660){return db[_0x0b36('0x29')][_0x0b36('0x49')]()[_0x0b36('0x3e')](respondWithResult(_0x4fb660,null))['catch'](handleError(_0x4fb660,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 232edc3..5625ab4 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 _0xc057=['user_profile_has_sections','userProfileId','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x44a5d4,_0xc2fd96){var _0x2fb474=function(_0x42ced3){while(--_0x42ced3){_0x44a5d4['push'](_0x44a5d4['shift']());}};_0x2fb474(++_0xc2fd96);}(_0xc057,0x13a));var _0x7c05=function(_0x309741,_0xeeb14d){_0x309741=_0x309741-0x0;var _0x108a6b=_0xc057[_0x309741];return _0x108a6b;};'use strict';var _=require('lodash');var util=require(_0x7c05('0x0'));var logger=require(_0x7c05('0x1'))('api');var moment=require(_0x7c05('0x2'));var BPromise=require(_0x7c05('0x3'));var rp=require(_0x7c05('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c05('0x5'));var config=require(_0x7c05('0x6'));var attributes=require(_0x7c05('0x7'));module[_0x7c05('0x8')]=function(_0x5cdd7b,_0x303a91){return _0x5cdd7b[_0x7c05('0x9')]('UserProfileSection',attributes,{'tableName':_0x7c05('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x7c05('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1239=['compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserProfileSection','user_profile_has_sections'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1239,0xd3));var _0x9123=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1239[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9123('0x0'));var util=require(_0x9123('0x1'));var logger=require(_0x9123('0x2'))(_0x9123('0x3'));var moment=require(_0x9123('0x4'));var BPromise=require(_0x9123('0x5'));var rp=require(_0x9123('0x6'));var fs=require('fs');var path=require(_0x9123('0x7'));var rimraf=require(_0x9123('0x8'));var config=require(_0x9123('0x9'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x34fffc,_0x3ece9d){return _0x34fffc[_0x9123('0xa')](_0x9123('0xb'),attributes,{'tableName':_0x9123('0xc'),'paranoid':![],'indexes':[{'name':_0x9123('0xd'),'fields':[_0x9123('0xe'),_0x9123('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 08da252..8320fb7 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 _0xeb0b=['error','message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ac8e5,_0x287fe4){var _0x4388e1=function(_0x671446){while(--_0x671446){_0x3ac8e5['push'](_0x3ac8e5['shift']());}};_0x4388e1(++_0x287fe4);}(_0xeb0b,0x18e));var _0xbeb0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xeb0b[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require(_0xbeb0('0x0'));var moment=require('moment');var BPromise=require(_0xbeb0('0x1'));var rs=require(_0xbeb0('0x2'));var fs=require('fs');var Redis=require(_0xbeb0('0x3'));var db=require(_0xbeb0('0x4'))['db'];var utils=require(_0xbeb0('0x5'));var logger=require(_0xbeb0('0x6'))(_0xbeb0('0x7'));var config=require(_0xbeb0('0x8'));var jayson=require(_0xbeb0('0x9'));var client=jayson[_0xbeb0('0xa')][_0xbeb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x326887,_0x234f92,_0x8d4769){return new BPromise(function(_0x48a918,_0x5b3d47){return client[_0xbeb0('0xc')](_0x326887,_0x8d4769)[_0xbeb0('0xd')](function(_0x3f9376){logger[_0xbeb0('0xe')](_0xbeb0('0xf'),_0x234f92,_0xbeb0('0x10'));logger[_0xbeb0('0x11')](_0xbeb0('0x12'),_0x234f92,_0xbeb0('0x10'),JSON[_0xbeb0('0x13')](_0x3f9376));if(_0x3f9376['error']){if(_0x3f9376['error']['code']===0x1f4){logger['error'](_0xbeb0('0xf'),_0x234f92,_0x3f9376['error']['message']);return _0x5b3d47(_0x3f9376[_0xbeb0('0x14')][_0xbeb0('0x15')]);}logger[_0xbeb0('0x14')](_0xbeb0('0xf'),_0x234f92,_0x3f9376[_0xbeb0('0x14')][_0xbeb0('0x15')]);return _0x48a918(_0x3f9376[_0xbeb0('0x14')][_0xbeb0('0x15')]);}else{logger[_0xbeb0('0xe')](_0xbeb0('0xf'),_0x234f92,_0xbeb0('0x10'));_0x48a918(_0x3f9376['result']['message']);}})['catch'](function(_0x2e451e){logger[_0xbeb0('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x234f92,_0x2e451e);_0x5b3d47(_0x2e451e);});});} \ No newline at end of file +var _0xf7ab=['../../config/logger','rpc','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x38c10e,_0xb389f0){var _0x355ab4=function(_0x26d75f){while(--_0x26d75f){_0x38c10e['push'](_0x38c10e['shift']());}};_0x355ab4(++_0xb389f0);}(_0xf7ab,0x8d));var _0xbf7a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xf7ab[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0xbf7a('0x0'));var util=require(_0xbf7a('0x1'));var moment=require('moment');var BPromise=require(_0xbf7a('0x2'));var rs=require(_0xbf7a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf7a('0x4'))['db'];var utils=require(_0xbf7a('0x5'));var logger=require(_0xbf7a('0x6'))(_0xbf7a('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf7a('0x8'));var client=jayson[_0xbf7a('0x9')][_0xbf7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x429cdc,_0x36bfe4,_0x69efa1){return new BPromise(function(_0x28d2ce,_0x5470f0){return client['request'](_0x429cdc,_0x69efa1)['then'](function(_0x5294d4){logger[_0xbf7a('0xb')](_0xbf7a('0xc'),_0x36bfe4,'request\x20sent');logger[_0xbf7a('0xd')](_0xbf7a('0xe'),_0x36bfe4,_0xbf7a('0xf'),JSON[_0xbf7a('0x10')](_0x5294d4));if(_0x5294d4[_0xbf7a('0x11')]){if(_0x5294d4[_0xbf7a('0x11')][_0xbf7a('0x12')]===0x1f4){logger['error'](_0xbf7a('0xc'),_0x36bfe4,_0x5294d4[_0xbf7a('0x11')][_0xbf7a('0x13')]);return _0x5470f0(_0x5294d4[_0xbf7a('0x11')][_0xbf7a('0x13')]);}logger['error'](_0xbf7a('0xc'),_0x36bfe4,_0x5294d4[_0xbf7a('0x11')][_0xbf7a('0x13')]);return _0x28d2ce(_0x5294d4[_0xbf7a('0x11')][_0xbf7a('0x13')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x36bfe4,'request\x20sent');_0x28d2ce(_0x5294d4[_0xbf7a('0x14')][_0xbf7a('0x13')]);}})['catch'](function(_0x35122c){logger['error'](_0xbf7a('0xc'),_0x36bfe4,_0x35122c);_0x5470f0(_0x35122c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index cbef689..b7bec55 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 _0x6ed9=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x8af3fe,_0x15f8fe){var _0x3d6163=function(_0x1833c1){while(--_0x1833c1){_0x8af3fe['push'](_0x8af3fe['shift']());}};_0x3d6163(++_0x15f8fe);}(_0x6ed9,0xd6));var _0x96ed=function(_0x11443e,_0x7569d2){_0x11443e=_0x11443e-0x0;var _0x1efbde=_0x6ed9[_0x11443e];return _0x1efbde;};'use strict';var multer=require(_0x96ed('0x0'));var util=require(_0x96ed('0x1'));var path=require(_0x96ed('0x2'));var timeout=require(_0x96ed('0x3'));var express=require(_0x96ed('0x4'));var router=express['Router']();var auth=require(_0x96ed('0x5'));var interaction=require(_0x96ed('0x6'));var config=require(_0x96ed('0x7'));module[_0x96ed('0x8')]=router; \ No newline at end of file +var _0xbb5b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x88b8eb,_0x48b871){var _0x404f09=function(_0x35762b){while(--_0x35762b){_0x88b8eb['push'](_0x88b8eb['shift']());}};_0x404f09(++_0x48b871);}(_0xbb5b,0x1a0));var _0xbbb5=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xbb5b[_0x4cc492];return _0x1f36b9;};'use strict';var multer=require('multer');var util=require(_0xbbb5('0x0'));var path=require(_0xbbb5('0x1'));var timeout=require(_0xbbb5('0x2'));var express=require(_0xbbb5('0x3'));var router=express[_0xbbb5('0x4')]();var auth=require(_0xbbb5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbbb5('0x6'));module[_0xbbb5('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 31ff044..4d22597 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x587865,_0x5282d2){var _0x1aeac9=function(_0x1de1c1){while(--_0x1de1c1){_0x587865['push'](_0x587865['shift']());}};_0x1aeac9(++_0x5282d2);}(_0xe706,0xa3));var _0x6e70=function(_0x41f882,_0x360760){_0x41f882=_0x41f882-0x0;var _0x402761=_0xe706[_0x41f882];return _0x402761;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x450639,_0x7f8d6b){var _0x23fc91=function(_0x53844b){while(--_0x53844b){_0x450639['push'](_0x450639['shift']());}};_0x23fc91(++_0x7f8d6b);}(_0xe706,0xa3));var _0x6e70=function(_0x20e81e,_0x2ad41f){_0x20e81e=_0x20e81e-0x0;var _0x3e6654=_0xe706[_0x20e81e];return _0x3e6654;};'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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0f5153e..dfcfec6 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 _0x7693=['moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api'];(function(_0x58e17a,_0x178496){var _0x37fdf7=function(_0x444d8a){while(--_0x444d8a){_0x58e17a['push'](_0x58e17a['shift']());}};_0x37fdf7(++_0x178496);}(_0x7693,0xe7));var _0x3769=function(_0x1ab761,_0x499c05){_0x1ab761=_0x1ab761-0x0;var _0x1faef3=_0x7693[_0x1ab761];return _0x1faef3;};'use strict';var _=require(_0x3769('0x0'));var util=require('util');var logger=require(_0x3769('0x1'))(_0x3769('0x2'));var moment=require(_0x3769('0x3'));var BPromise=require('bluebird');var rp=require(_0x3769('0x4'));var fs=require('fs');var path=require(_0x3769('0x5'));var rimraf=require(_0x3769('0x6'));var config=require(_0x3769('0x7'));var attributes=require(_0x3769('0x8'));module[_0x3769('0x9')]=function(_0x1c241e,_0x4d24de){return _0x1c241e[_0x3769('0xa')](_0x3769('0xb'),attributes,{'tableName':_0x3769('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa653=['UserSmsQueue','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userSmsQueue.attributes','define'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa653,0x7a));var _0x3a65=function(_0x31cde0,_0x1f2011){_0x31cde0=_0x31cde0-0x0;var _0x12335a=_0xa653[_0x31cde0];return _0x12335a;};'use strict';var _=require(_0x3a65('0x0'));var util=require(_0x3a65('0x1'));var logger=require(_0x3a65('0x2'))(_0x3a65('0x3'));var moment=require(_0x3a65('0x4'));var BPromise=require('bluebird');var rp=require(_0x3a65('0x5'));var fs=require('fs');var path=require(_0x3a65('0x6'));var rimraf=require('rimraf');var config=require(_0x3a65('0x7'));var attributes=require(_0x3a65('0x8'));module['exports']=function(_0x195ce5,_0x38cb38){return _0x195ce5[_0x3a65('0x9')](_0x3a65('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index ce49a5f..063604b 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 _0xfaf9=['request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x5f25a3,_0x386723){var _0x125301=function(_0xc59934){while(--_0xc59934){_0x5f25a3['push'](_0x5f25a3['shift']());}};_0x125301(++_0x386723);}(_0xfaf9,0x7f));var _0x9faf=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xfaf9[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x9faf('0x0'));var util=require(_0x9faf('0x1'));var moment=require(_0x9faf('0x2'));var BPromise=require('bluebird');var rs=require(_0x9faf('0x3'));var fs=require('fs');var Redis=require(_0x9faf('0x4'));var db=require(_0x9faf('0x5'))['db'];var utils=require(_0x9faf('0x6'));var logger=require('../../config/logger')(_0x9faf('0x7'));var config=require(_0x9faf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9faf('0x9')][_0x9faf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2432be,_0x3b0af7,_0x2b824d){return new BPromise(function(_0x19430e,_0x32789f){return client[_0x9faf('0xb')](_0x2432be,_0x2b824d)[_0x9faf('0xc')](function(_0x429a17){logger[_0x9faf('0xd')](_0x9faf('0xe'),_0x3b0af7,_0x9faf('0xf'));logger[_0x9faf('0x10')](_0x9faf('0x11'),_0x3b0af7,_0x9faf('0xf'),JSON['stringify'](_0x429a17));if(_0x429a17[_0x9faf('0x12')]){if(_0x429a17[_0x9faf('0x12')][_0x9faf('0x13')]===0x1f4){logger[_0x9faf('0x12')](_0x9faf('0xe'),_0x3b0af7,_0x429a17['error'][_0x9faf('0x14')]);return _0x32789f(_0x429a17[_0x9faf('0x12')]['message']);}logger['error'](_0x9faf('0xe'),_0x3b0af7,_0x429a17[_0x9faf('0x12')][_0x9faf('0x14')]);return _0x19430e(_0x429a17['error'][_0x9faf('0x14')]);}else{logger[_0x9faf('0xd')](_0x9faf('0xe'),_0x3b0af7,_0x9faf('0xf'));_0x19430e(_0x429a17[_0x9faf('0x15')][_0x9faf('0x14')]);}})[_0x9faf('0x16')](function(_0x384b46){logger[_0x9faf('0x12')](_0x9faf('0xe'),_0x3b0af7,_0x384b46);_0x32789f(_0x384b46);});});} \ No newline at end of file +var _0xf3a4=['debug','request\x20sent','stringify','error','UserSmsQueue,\x20%s,\x20%s','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x30d44d,_0x1382d4){var _0x4bc0ee=function(_0x2c5bc8){while(--_0x2c5bc8){_0x30d44d['push'](_0x30d44d['shift']());}};_0x4bc0ee(++_0x1382d4);}(_0xf3a4,0x194));var _0x4f3a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf3a4[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4f3a('0x0'));var util=require(_0x4f3a('0x1'));var moment=require(_0x4f3a('0x2'));var BPromise=require(_0x4f3a('0x3'));var rs=require(_0x4f3a('0x4'));var fs=require('fs');var Redis=require(_0x4f3a('0x5'));var db=require(_0x4f3a('0x6'))['db'];var utils=require(_0x4f3a('0x7'));var logger=require(_0x4f3a('0x8'))(_0x4f3a('0x9'));var config=require(_0x4f3a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4f3a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e55e0,_0x589069,_0x128842){return new BPromise(function(_0x5ced77,_0x4e1406){return client[_0x4f3a('0xc')](_0x1e55e0,_0x128842)['then'](function(_0x3e8f6b){logger[_0x4f3a('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x589069,'request\x20sent');logger[_0x4f3a('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x589069,_0x4f3a('0xf'),JSON[_0x4f3a('0x10')](_0x3e8f6b));if(_0x3e8f6b[_0x4f3a('0x11')]){if(_0x3e8f6b[_0x4f3a('0x11')]['code']===0x1f4){logger[_0x4f3a('0x11')](_0x4f3a('0x12'),_0x589069,_0x3e8f6b[_0x4f3a('0x11')]['message']);return _0x4e1406(_0x3e8f6b['error']['message']);}logger['error'](_0x4f3a('0x12'),_0x589069,_0x3e8f6b[_0x4f3a('0x11')]['message']);return _0x5ced77(_0x3e8f6b[_0x4f3a('0x11')]['message']);}else{logger[_0x4f3a('0xd')](_0x4f3a('0x12'),_0x589069,'request\x20sent');_0x5ced77(_0x3e8f6b[_0x4f3a('0x13')][_0x4f3a('0x14')]);}})[_0x4f3a('0x15')](function(_0x3d7091){logger[_0x4f3a('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x589069,_0x3d7091);_0x4e1406(_0x3d7091);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 7537309..e3bb449 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 _0x7126=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x2cc9d8,_0x9819df){var _0x124743=function(_0x2e3854){while(--_0x2e3854){_0x2cc9d8['push'](_0x2cc9d8['shift']());}};_0x124743(++_0x9819df);}(_0x7126,0x14a));var _0x6712=function(_0x5d8f72,_0x343c57){_0x5d8f72=_0x5d8f72-0x0;var _0x7a51d6=_0x7126[_0x5d8f72];return _0x7a51d6;};'use strict';var multer=require(_0x6712('0x0'));var util=require(_0x6712('0x1'));var path=require(_0x6712('0x2'));var timeout=require(_0x6712('0x3'));var express=require(_0x6712('0x4'));var router=express[_0x6712('0x5')]();var auth=require(_0x6712('0x6'));var interaction=require(_0x6712('0x7'));var config=require(_0x6712('0x8'));module[_0x6712('0x9')]=router; \ No newline at end of file +var _0x8a78=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x34075f,_0x23082a){var _0x33a011=function(_0x2b963c){while(--_0x2b963c){_0x34075f['push'](_0x34075f['shift']());}};_0x33a011(++_0x23082a);}(_0x8a78,0x1bc));var _0x88a7=function(_0x4aa4af,_0x210cde){_0x4aa4af=_0x4aa4af-0x0;var _0x3bf44a=_0x8a78[_0x4aa4af];return _0x3bf44a;};'use strict';var multer=require(_0x88a7('0x0'));var util=require(_0x88a7('0x1'));var path=require(_0x88a7('0x2'));var timeout=require(_0x88a7('0x3'));var express=require(_0x88a7('0x4'));var router=express[_0x88a7('0x5')]();var auth=require(_0x88a7('0x6'));var interaction=require(_0x88a7('0x7'));var config=require(_0x88a7('0x8'));module[_0x88a7('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 967e135..9ae7e25 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x1bad26,_0xf6f79f){var _0x23b581=function(_0x4040c9){while(--_0x4040c9){_0x1bad26['push'](_0x1bad26['shift']());}};_0x23b581(++_0xf6f79f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x2a9bb2,_0xccdbcb){var _0x58c695=function(_0x3ef90a){while(--_0x3ef90a){_0x2a9bb2['push'](_0x2a9bb2['shift']());}};_0x58c695(++_0xccdbcb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index aa6e9e7..ecaee5a 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','lodash','util'];(function(_0x555480,_0x2dcfb0){var _0x221554=function(_0x339abc){while(--_0x339abc){_0x555480['push'](_0x555480['shift']());}};_0x221554(++_0x2dcfb0);}(_0x54ef,0x112));var _0xf54e=function(_0x281756,_0x5b0f8d){_0x281756=_0x281756-0x0;var _0xdb02a9=_0x54ef[_0x281756];return _0xdb02a9;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb903=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xb903,0x185));var _0x3b90=function(_0x1c3d4b,_0x128ebd){_0x1c3d4b=_0x1c3d4b-0x0;var _0x59b313=_0xb903[_0x1c3d4b];return _0x59b313;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('UserVoiceQueue',attributes,{'tableName':_0x3b90('0xb'),'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 038b261..65534cc 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 _0xc0c7=['request','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xc0c7,0x13a));var _0x7c0c=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xc0c7[_0x3826ad];return _0x17b900;};'use strict';var _=require(_0x7c0c('0x0'));var util=require('util');var moment=require(_0x7c0c('0x1'));var BPromise=require(_0x7c0c('0x2'));var rs=require(_0x7c0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c0c('0x4'))['db'];var utils=require(_0x7c0c('0x5'));var logger=require('../../config/logger')(_0x7c0c('0x6'));var config=require(_0x7c0c('0x7'));var jayson=require(_0x7c0c('0x8'));var client=jayson['client'][_0x7c0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56d6b1,_0x47f789,_0x4bf263){return new BPromise(function(_0x2df8da,_0xf5b03f){return client[_0x7c0c('0xa')](_0x56d6b1,_0x4bf263)['then'](function(_0x580c7c){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x47f789,'request\x20sent');logger['debug'](_0x7c0c('0xb'),_0x47f789,'request\x20sent',JSON[_0x7c0c('0xc')](_0x580c7c));if(_0x580c7c[_0x7c0c('0xd')]){if(_0x580c7c['error']['code']===0x1f4){logger['error'](_0x7c0c('0xe'),_0x47f789,_0x580c7c[_0x7c0c('0xd')]['message']);return _0xf5b03f(_0x580c7c[_0x7c0c('0xd')][_0x7c0c('0xf')]);}logger[_0x7c0c('0xd')](_0x7c0c('0xe'),_0x47f789,_0x580c7c[_0x7c0c('0xd')][_0x7c0c('0xf')]);return _0x2df8da(_0x580c7c[_0x7c0c('0xd')][_0x7c0c('0xf')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x47f789,_0x7c0c('0x10'));_0x2df8da(_0x580c7c[_0x7c0c('0x11')][_0x7c0c('0xf')]);}})['catch'](function(_0x5b537f){logger[_0x7c0c('0xd')](_0x7c0c('0xe'),_0x47f789,_0x5b537f);_0xf5b03f(_0x5b537f);});});} \ No newline at end of file +var _0xcf98=['request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info'];(function(_0x28fe71,_0x196cea){var _0x27c5ee=function(_0x3e62b2){while(--_0x3e62b2){_0x28fe71['push'](_0x28fe71['shift']());}};_0x27c5ee(++_0x196cea);}(_0xcf98,0x184));var _0x8cf9=function(_0x754229,_0x5ad19f){_0x754229=_0x754229-0x0;var _0x323e36=_0xcf98[_0x754229];return _0x323e36;};'use strict';var _=require(_0x8cf9('0x0'));var util=require(_0x8cf9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8cf9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8cf9('0x3'))['db'];var utils=require(_0x8cf9('0x4'));var logger=require(_0x8cf9('0x5'))('rpc');var config=require(_0x8cf9('0x6'));var jayson=require(_0x8cf9('0x7'));var client=jayson[_0x8cf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533eeb,_0x2f79d8,_0xa56d46){return new BPromise(function(_0x124db1,_0x26990e){return client['request'](_0x533eeb,_0xa56d46)[_0x8cf9('0x9')](function(_0x2a3a12){logger[_0x8cf9('0xa')]('UserVoiceQueue,\x20%s,\x20%s',_0x2f79d8,_0x8cf9('0xb'));logger[_0x8cf9('0xc')](_0x8cf9('0xd'),_0x2f79d8,_0x8cf9('0xb'),JSON[_0x8cf9('0xe')](_0x2a3a12));if(_0x2a3a12['error']){if(_0x2a3a12[_0x8cf9('0xf')][_0x8cf9('0x10')]===0x1f4){logger[_0x8cf9('0xf')](_0x8cf9('0x11'),_0x2f79d8,_0x2a3a12[_0x8cf9('0xf')][_0x8cf9('0x12')]);return _0x26990e(_0x2a3a12[_0x8cf9('0xf')]['message']);}logger[_0x8cf9('0xf')](_0x8cf9('0x11'),_0x2f79d8,_0x2a3a12['error'][_0x8cf9('0x12')]);return _0x124db1(_0x2a3a12[_0x8cf9('0xf')][_0x8cf9('0x12')]);}else{logger[_0x8cf9('0xa')](_0x8cf9('0x11'),_0x2f79d8,_0x8cf9('0xb'));_0x124db1(_0x2a3a12[_0x8cf9('0x13')][_0x8cf9('0x12')]);}})[_0x8cf9('0x14')](function(_0x4be04a){logger[_0x8cf9('0xf')](_0x8cf9('0x11'),_0x2f79d8,_0x4be04a);_0x26990e(_0x4be04a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index cced41c..e46ab42 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 _0x4471=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5dddf0,_0x563a3a){var _0x237800=function(_0x222fb2){while(--_0x222fb2){_0x5dddf0['push'](_0x5dddf0['shift']());}};_0x237800(++_0x563a3a);}(_0x4471,0xa2));var _0x1447=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4471[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x1447('0x0'));var util=require(_0x1447('0x1'));var path=require(_0x1447('0x2'));var timeout=require(_0x1447('0x3'));var express=require(_0x1447('0x4'));var router=express[_0x1447('0x5')]();var auth=require(_0x1447('0x6'));var interaction=require(_0x1447('0x7'));var config=require(_0x1447('0x8'));module[_0x1447('0x9')]=router; \ No newline at end of file +var _0x2a30=['../../components/auth/service','../../components/interaction/service','exports','multer','util','express'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0x2a30,0x13b));var _0x02a3=function(_0x48aa1b,_0x33bc50){_0x48aa1b=_0x48aa1b-0x0;var _0x3fcb92=_0x2a30[_0x48aa1b];return _0x3fcb92;};'use strict';var multer=require(_0x02a3('0x0'));var util=require(_0x02a3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02a3('0x2'));var router=express['Router']();var auth=require(_0x02a3('0x3'));var interaction=require(_0x02a3('0x4'));var config=require('../../config/environment');module[_0x02a3('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 13318a6..8982a0b 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 _0xe939=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x13131c,_0x2faf9b){var _0x422f03=function(_0x3b1b9d){while(--_0x3b1b9d){_0x13131c['push'](_0x13131c['shift']());}};_0x422f03(++_0x2faf9b);}(_0xe939,0xa3));var _0x9e93=function(_0x2b3ceb,_0x48ed74){_0x2b3ceb=_0x2b3ceb-0x0;var _0x138c78=_0xe939[_0x2b3ceb];return _0x138c78;};'use strict';var Sequelize=require(_0x9e93('0x0'));module[_0x9e93('0x1')]={'uniqueid':{'type':Sequelize[_0x9e93('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9e93('0x3')},'membername':{'type':Sequelize[_0x9e93('0x4')],'allowNull':![],'comment':_0x9e93('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x9e93('0x4')],'allowNull':![],'unique':_0x9e93('0x5'),'comment':_0x9e93('0x3')},'VoiceQueueId':{'type':Sequelize[_0x9e93('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x9e93('0x4')],'allowNull':![],'unique':_0x9e93('0x5'),'comment':_0x9e93('0x3')},'penalty':{'type':Sequelize[_0x9e93('0x2')](0xb),'defaultValue':0x0,'comment':_0x9e93('0x3')},'paused':{'type':Sequelize[_0x9e93('0x2')](0xb),'defaultValue':0x0,'comment':_0x9e93('0x3')}}; \ No newline at end of file +var _0x4dd3=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x4dd3,0x148));var _0x34dd=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x4dd3[_0x2ae2ad];return _0x26dbd7;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'uniqueid':{'type':Sequelize[_0x34dd('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x34dd('0x3')},'membername':{'type':Sequelize[_0x34dd('0x4')],'allowNull':![],'comment':_0x34dd('0x3')},'UserId':{'type':Sequelize[_0x34dd('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x34dd('0x5'),'comment':_0x34dd('0x3')},'VoiceQueueId':{'type':Sequelize[_0x34dd('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x34dd('0x4')],'allowNull':![],'unique':_0x34dd('0x5'),'comment':_0x34dd('0x3')},'penalty':{'type':Sequelize[_0x34dd('0x2')](0xb),'defaultValue':0x0,'comment':_0x34dd('0x3')},'paused':{'type':Sequelize[_0x34dd('0x2')](0xb),'defaultValue':0x0,'comment':_0x34dd('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f8be221..abf0c79 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 _0x5ee1=['remove','emit','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x277f5c,_0x3e9eae){var _0x3ffe93=function(_0x7e8693){while(--_0x7e8693){_0x277f5c['push'](_0x277f5c['shift']());}};_0x3ffe93(++_0x3e9eae);}(_0x5ee1,0x1d0));var _0x15ee=function(_0x690c69,_0xcb0555){_0x690c69=_0x690c69-0x0;var _0x234e59=_0x5ee1[_0x690c69];return _0x234e59;};'use strict';var EventEmitter=require(_0x15ee('0x0'));var UserVoiceQueueRt=require(_0x15ee('0x1'))['db'][_0x15ee('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x15ee('0x3')](0x0);var events={'afterCreate':_0x15ee('0x4'),'afterUpdate':_0x15ee('0x5'),'afterDestroy':_0x15ee('0x6')};function emitEvent(_0x113d42){return function(_0x3d09ec,_0x5ec258,_0x5c1a43){UserVoiceQueueRtEvents[_0x15ee('0x7')](_0x113d42+':'+_0x3d09ec['id'],_0x3d09ec);UserVoiceQueueRtEvents[_0x15ee('0x7')](_0x113d42,_0x3d09ec);_0x5c1a43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x15ee('0x8')](e,emitEvent(event));}}module[_0x15ee('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5be2=['emit','hasOwnProperty','hook','events','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5be2,0x1cb));var _0x25be=function(_0x13870e,_0x30cf74){_0x13870e=_0x13870e-0x0;var _0x5864de=_0x5be2[_0x13870e];return _0x5864de;};'use strict';var EventEmitter=require(_0x25be('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x25be('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x25be('0x2')](0x0);var events={'afterCreate':_0x25be('0x3'),'afterUpdate':_0x25be('0x4'),'afterDestroy':'remove'};function emitEvent(_0x55d7a9){return function(_0xfea263,_0x19842f,_0x44bdaf){UserVoiceQueueRtEvents[_0x25be('0x5')](_0x55d7a9+':'+_0xfea263['id'],_0xfea263);UserVoiceQueueRtEvents[_0x25be('0x5')](_0x55d7a9,_0xfea263);_0x44bdaf(null);};}for(var e in events){if(events[_0x25be('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x25be('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a18d051..9c197ad 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 _0xce09=['bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','util','../../config/logger','moment'];(function(_0x2468b5,_0x506b9e){var _0x1056e4=function(_0x26da1c){while(--_0x26da1c){_0x2468b5['push'](_0x2468b5['shift']());}};_0x1056e4(++_0x506b9e);}(_0xce09,0x18d));var _0x9ce0=function(_0x357025,_0x53285f){_0x357025=_0x357025-0x0;var _0x56d378=_0xce09[_0x357025];return _0x56d378;};'use strict';var _=require('lodash');var util=require(_0x9ce0('0x0'));var logger=require(_0x9ce0('0x1'))('api');var moment=require(_0x9ce0('0x2'));var BPromise=require(_0x9ce0('0x3'));var rp=require(_0x9ce0('0x4'));var fs=require('fs');var path=require(_0x9ce0('0x5'));var rimraf=require(_0x9ce0('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ce0('0x7'));module['exports']=function(_0x1149b6,_0x5d6ee3){return _0x1149b6[_0x9ce0('0x8')](_0x9ce0('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48a9=['exports','define','user_has_voice_queues_rt','lodash','util','../../config/logger','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x48a9,0x1d9));var _0x948a=function(_0x3712e2,_0x32d752){_0x3712e2=_0x3712e2-0x0;var _0x1faff4=_0x48a9[_0x3712e2];return _0x1faff4;};'use strict';var _=require(_0x948a('0x0'));var util=require(_0x948a('0x1'));var logger=require(_0x948a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x948a('0x3'));var rimraf=require(_0x948a('0x4'));var config=require(_0x948a('0x5'));var attributes=require(_0x948a('0x6'));module[_0x948a('0x7')]=function(_0x29a2b6,_0x5cc81a){return _0x29a2b6[_0x948a('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x948a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 4698af4..492a81c 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 _0x0765=['info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x59c6fc,_0x41e709){var _0x50d45e=function(_0x130846){while(--_0x130846){_0x59c6fc['push'](_0x59c6fc['shift']());}};_0x50d45e(++_0x41e709);}(_0x0765,0x71));var _0x5076=function(_0x56b4ea,_0x386421){_0x56b4ea=_0x56b4ea-0x0;var _0x1a8f49=_0x0765[_0x56b4ea];return _0x1a8f49;};'use strict';var _=require(_0x5076('0x0'));var util=require(_0x5076('0x1'));var moment=require('moment');var BPromise=require(_0x5076('0x2'));var rs=require(_0x5076('0x3'));var fs=require('fs');var Redis=require(_0x5076('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5076('0x5'));var logger=require(_0x5076('0x6'))(_0x5076('0x7'));var config=require(_0x5076('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5076('0x9')][_0x5076('0xa')]({'port':0x232a});config[_0x5076('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5076('0xc'))(new Redis(config[_0x5076('0xb')]));require(_0x5076('0xd'))['register'](socket);function respondWithRpcPromise(_0x211727,_0x404ac1,_0x56a1dd){return new BPromise(function(_0x488366,_0x644988){return client[_0x5076('0xe')](_0x211727,_0x56a1dd)[_0x5076('0xf')](function(_0x57eebc){logger['info'](_0x5076('0x10'),_0x404ac1,_0x5076('0x11'));logger[_0x5076('0x12')](_0x5076('0x13'),_0x404ac1,_0x5076('0x11'),JSON['stringify'](_0x57eebc));if(_0x57eebc[_0x5076('0x14')]){if(_0x57eebc[_0x5076('0x14')][_0x5076('0x15')]===0x1f4){logger[_0x5076('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x404ac1,_0x57eebc[_0x5076('0x14')][_0x5076('0x16')]);return _0x644988(_0x57eebc['error'][_0x5076('0x16')]);}logger[_0x5076('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x404ac1,_0x57eebc[_0x5076('0x14')][_0x5076('0x16')]);return _0x488366(_0x57eebc['error'][_0x5076('0x16')]);}else{logger[_0x5076('0x17')](_0x5076('0x10'),_0x404ac1,_0x5076('0x11'));_0x488366(_0x57eebc[_0x5076('0x18')][_0x5076('0x16')]);}})[_0x5076('0x19')](function(_0x52b780){logger[_0x5076('0x14')](_0x5076('0x10'),_0x404ac1,_0x52b780);_0x644988(_0x52b780);});});}exports[_0x5076('0x1a')]=function(_0x201477){var _0x2870a8=this;return new Promise(function(_0x24b101,_0x11f0d3){return db[_0x5076('0x1b')][_0x5076('0x1c')]({'raw':_0x201477[_0x5076('0x1d')]?_0x201477[_0x5076('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x201477[_0x5076('0x1d')]?_0x201477[_0x5076('0x1d')][_0x5076('0x1e')]||null:null,'attributes':[[db[_0x5076('0x1f')]['fn']('COUNT',db[_0x5076('0x1f')]['fn']('IF',db[_0x5076('0x1f')]['literal'](_0x5076('0x20')))),_0x5076('0x21')]]})[_0x5076('0xf')](function(_0x15ca98){logger[_0x5076('0x17')](_0x5076('0x1a'),_0x201477);logger[_0x5076('0x12')](_0x5076('0x1a'),_0x201477,JSON['stringify'](_0x15ca98));_0x24b101(_0x15ca98);})[_0x5076('0x19')](function(_0xbf4e97){logger['error']('GetVoiceQueueRtPauses',_0xbf4e97[_0x5076('0x16')],_0x201477);_0x11f0d3(_0x2870a8[_0x5076('0x14')](0x1f4,_0xbf4e97[_0x5076('0x16')]));});});}; \ No newline at end of file +var _0xddb9=['register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','localhost','./userVoiceQueueRt.socket'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xddb9,0x1a7));var _0x9ddb=function(_0x148727,_0x5b80a8){_0x148727=_0x148727-0x0;var _0x18827e=_0xddb9[_0x148727];return _0x18827e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9ddb('0x0'));var BPromise=require(_0x9ddb('0x1'));var rs=require(_0x9ddb('0x2'));var fs=require('fs');var Redis=require(_0x9ddb('0x3'));var db=require(_0x9ddb('0x4'))['db'];var utils=require(_0x9ddb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ddb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9ddb('0x7')]['http']({'port':0x232a});config[_0x9ddb('0x8')]=_['defaults'](config[_0x9ddb('0x8')],{'host':_0x9ddb('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9ddb('0xa'))[_0x9ddb('0xb')](socket);function respondWithRpcPromise(_0x1681ec,_0x119923,_0xb2aede){return new BPromise(function(_0x18a8c4,_0x56f66e){return client['request'](_0x1681ec,_0xb2aede)[_0x9ddb('0xc')](function(_0x18f42b){logger[_0x9ddb('0xd')](_0x9ddb('0xe'),_0x119923,_0x9ddb('0xf'));logger[_0x9ddb('0x10')](_0x9ddb('0x11'),_0x119923,_0x9ddb('0xf'),JSON[_0x9ddb('0x12')](_0x18f42b));if(_0x18f42b[_0x9ddb('0x13')]){if(_0x18f42b[_0x9ddb('0x13')]['code']===0x1f4){logger[_0x9ddb('0x13')](_0x9ddb('0xe'),_0x119923,_0x18f42b['error'][_0x9ddb('0x14')]);return _0x56f66e(_0x18f42b['error'][_0x9ddb('0x14')]);}logger[_0x9ddb('0x13')](_0x9ddb('0xe'),_0x119923,_0x18f42b[_0x9ddb('0x13')][_0x9ddb('0x14')]);return _0x18a8c4(_0x18f42b[_0x9ddb('0x13')][_0x9ddb('0x14')]);}else{logger[_0x9ddb('0xd')](_0x9ddb('0xe'),_0x119923,_0x9ddb('0xf'));_0x18a8c4(_0x18f42b['result'][_0x9ddb('0x14')]);}})[_0x9ddb('0x15')](function(_0x5914fc){logger[_0x9ddb('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x119923,_0x5914fc);_0x56f66e(_0x5914fc);});});}exports[_0x9ddb('0x16')]=function(_0xb74def){var _0x17217c=this;return new Promise(function(_0x3e3cc9,_0x2d1a7e){return db[_0x9ddb('0x17')]['findAll']({'raw':_0xb74def[_0x9ddb('0x18')]?_0xb74def[_0x9ddb('0x18')][_0x9ddb('0x19')]===undefined?!![]:![]:!![],'where':_0xb74def[_0x9ddb('0x18')]?_0xb74def[_0x9ddb('0x18')][_0x9ddb('0x1a')]||null:null,'attributes':[[db[_0x9ddb('0x1b')]['fn'](_0x9ddb('0x1c'),db[_0x9ddb('0x1b')]['fn']('IF',db[_0x9ddb('0x1b')][_0x9ddb('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0x9ddb('0x1e')]]})[_0x9ddb('0xc')](function(_0x357176){logger['info'](_0x9ddb('0x16'),_0xb74def);logger[_0x9ddb('0x10')](_0x9ddb('0x16'),_0xb74def,JSON[_0x9ddb('0x12')](_0x357176));_0x3e3cc9(_0x357176);})[_0x9ddb('0x15')](function(_0xa0d6f3){logger[_0x9ddb('0x13')](_0x9ddb('0x16'),_0xa0d6f3['message'],_0xb74def);_0x2d1a7e(_0x17217c[_0x9ddb('0x13')](0x1f4,_0xa0d6f3[_0x9ddb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index dae4ba6..ae41817 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 _0x8e82=['remove','update','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x25e572,_0x2c6406){var _0x5e027b=function(_0x5962c5){while(--_0x5962c5){_0x25e572['push'](_0x25e572['shift']());}};_0x5e027b(++_0x2c6406);}(_0x8e82,0x1e1));var _0x28e8=function(_0x17faee,_0x25e116){_0x17faee=_0x17faee-0x0;var _0xb56c9b=_0x8e82[_0x17faee];return _0xb56c9b;};'use strict';var UserVoiceQueueRtEvents=require(_0x28e8('0x0'));var events=[_0x28e8('0x1'),_0x28e8('0x2'),_0x28e8('0x3')];function createListener(_0x5270f3,_0x2d24d4){return function(_0x59caaa){_0x2d24d4['emit'](_0x5270f3,_0x59caaa);};}function removeListener(_0x11a392,_0x400388){return function(){UserVoiceQueueRtEvents[_0x28e8('0x4')](_0x11a392,_0x400388);};}exports[_0x28e8('0x5')]=function(_0x43e480){for(var _0x404cad=0x0,_0x1e84e3=events['length'];_0x404cad<_0x1e84e3;_0x404cad++){var _0x207d67=events[_0x404cad];var _0xec80af=createListener(_0x28e8('0x6')+_0x207d67,_0x43e480);UserVoiceQueueRtEvents['on'](_0x207d67,_0xec80af);}}; \ No newline at end of file +var _0xc5b3=['register','length','save','remove','update','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc5b3,0x110));var _0x3c5b=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0xc5b3[_0x1cec84];return _0x12b7d3;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3c5b('0x0'),_0x3c5b('0x1'),_0x3c5b('0x2')];function createListener(_0xcac312,_0x2da686){return function(_0x2d98bd){_0x2da686['emit'](_0xcac312,_0x2d98bd);};}function removeListener(_0x18a3cd,_0x1a0477){return function(){UserVoiceQueueRtEvents[_0x3c5b('0x3')](_0x18a3cd,_0x1a0477);};}exports[_0x3c5b('0x4')]=function(_0x288685){for(var _0xc7dfec=0x0,_0x1a490d=events[_0x3c5b('0x5')];_0xc7dfec<_0x1a490d;_0xc7dfec++){var _0xae7c4=events[_0xc7dfec];var _0x443d55=createListener('userVoiceQueueRt:'+_0xae7c4,_0x288685);UserVoiceQueueRtEvents['on'](_0xae7c4,_0x443d55);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cee7f6d..8fef544 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 _0xd56d=['connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer','util','path'];(function(_0x407877,_0x5bf1e5){var _0x1b8954=function(_0x199992){while(--_0x199992){_0x407877['push'](_0x407877['shift']());}};_0x1b8954(++_0x5bf1e5);}(_0xd56d,0xe5));var _0xdd56=function(_0x55e605,_0x162ddb){_0x55e605=_0x55e605-0x0;var _0x20c0cc=_0xd56d[_0x55e605];return _0x20c0cc;};'use strict';var multer=require(_0xdd56('0x0'));var util=require(_0xdd56('0x1'));var path=require(_0xdd56('0x2'));var timeout=require(_0xdd56('0x3'));var express=require('express');var router=express[_0xdd56('0x4')]();var auth=require(_0xdd56('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdd56('0x6'));module[_0xdd56('0x7')]=router; \ No newline at end of file +var _0xc7ca=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','util','path'];(function(_0x4aa960,_0x19b31b){var _0x23890f=function(_0x1b8158){while(--_0x1b8158){_0x4aa960['push'](_0x4aa960['shift']());}};_0x23890f(++_0x19b31b);}(_0xc7ca,0x8e));var _0xac7c=function(_0x5134ff,_0x263c8b){_0x5134ff=_0x5134ff-0x0;var _0x12d79e=_0xc7ca[_0x5134ff];return _0x12d79e;};'use strict';var multer=require('multer');var util=require(_0xac7c('0x0'));var path=require(_0xac7c('0x1'));var timeout=require(_0xac7c('0x2'));var express=require(_0xac7c('0x3'));var router=express[_0xac7c('0x4')]();var auth=require(_0xac7c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac7c('0x6'));module[_0xac7c('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 3c16c86..a372322 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(_0x149a41,_0x3cbb44){var _0x10132c=function(_0x5109e1){while(--_0x5109e1){_0x149a41['push'](_0x149a41['shift']());}};_0x10132c(++_0x3cbb44);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4e4210,_0x5dfdde){var _0x5c3593=function(_0x205736){while(--_0x205736){_0x4e4210['push'](_0x4e4210['shift']());}};_0x5c3593(++_0x5dfdde);}(_0xe706,0xa3));var _0x6e70=function(_0x687549,_0x2a09eb){_0x687549=_0x687549-0x0;var _0x44e4a0=_0xe706[_0x687549];return _0x44e4a0;};'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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d3936f0..89f9b22 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 _0x282b=['moment','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x3ad45c,_0x2a881d){var _0x234e12=function(_0x70f901){while(--_0x70f901){_0x3ad45c['push'](_0x3ad45c['shift']());}};_0x234e12(++_0x2a881d);}(_0x282b,0xec));var _0xb282=function(_0x388f47,_0x529727){_0x388f47=_0x388f47-0x0;var _0x21c4ff=_0x282b[_0x388f47];return _0x21c4ff;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97c1=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x408c89,_0x5e2119){var _0x57c05c=function(_0x33435c){while(--_0x33435c){_0x408c89['push'](_0x408c89['shift']());}};_0x57c05c(++_0x5e2119);}(_0x97c1,0xdf));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var logger=require('../../config/logger')(_0x197c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x197c('0x3'));var fs=require('fs');var path=require(_0x197c('0x4'));var rimraf=require(_0x197c('0x5'));var config=require(_0x197c('0x6'));var attributes=require(_0x197c('0x7'));module['exports']=function(_0x5cbff6,_0x1cb6e1){return _0x5cbff6[_0x197c('0x8')](_0x197c('0x9'),attributes,{'tableName':_0x197c('0xa'),'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 5beaf6b..828ea49 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(_0xc685a7,_0x38694c){var _0x2344da=function(_0x4a2efb){while(--_0x4a2efb){_0xc685a7['push'](_0xc685a7['shift']());}};_0x2344da(++_0x38694c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x17fa5d,_0x25ded2){var _0x36a597=function(_0x466912){while(--_0x466912){_0x17fa5d['push'](_0x17fa5d['shift']());}};_0x36a597(++_0x25ded2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 6d1de08..41b412b 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 _0xf8cc=['update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','put'];(function(_0x2cbeb6,_0x2b2931){var _0x3a972d=function(_0x4a034b){while(--_0x4a034b){_0x2cbeb6['push'](_0x2cbeb6['shift']());}};_0x3a972d(++_0x2b2931);}(_0xf8cc,0xf0));var _0xcf8c=function(_0xb57b19,_0x59d9c2){_0xb57b19=_0xb57b19-0x0;var _0x10f106=_0xf8cc[_0xb57b19];return _0x10f106;};'use strict';var multer=require('multer');var util=require(_0xcf8c('0x0'));var path=require(_0xcf8c('0x1'));var timeout=require(_0xcf8c('0x2'));var express=require(_0xcf8c('0x3'));var router=express[_0xcf8c('0x4')]();var auth=require(_0xcf8c('0x5'));var interaction=require(_0xcf8c('0x6'));var config=require('../../config/environment');var controller=require('./variable.controller');router[_0xcf8c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcf8c('0x8'),auth[_0xcf8c('0x9')](),controller[_0xcf8c('0xa')]);router['post']('/',auth[_0xcf8c('0x9')](),controller['create']);router[_0xcf8c('0xb')](_0xcf8c('0x8'),auth[_0xcf8c('0x9')](),controller[_0xcf8c('0xc')]);router[_0xcf8c('0xd')](_0xcf8c('0x8'),auth[_0xcf8c('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfaf3=['index','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x535f12,_0x159194){var _0xf79387=function(_0x4addea){while(--_0x4addea){_0x535f12['push'](_0x535f12['shift']());}};_0xf79387(++_0x159194);}(_0xfaf3,0x184));var _0x3faf=function(_0x321f23,_0x38f283){_0x321f23=_0x321f23-0x0;var _0x3c3a2c=_0xfaf3[_0x321f23];return _0x3c3a2c;};'use strict';var multer=require(_0x3faf('0x0'));var util=require(_0x3faf('0x1'));var path=require(_0x3faf('0x2'));var timeout=require(_0x3faf('0x3'));var express=require('express');var router=express[_0x3faf('0x4')]();var auth=require(_0x3faf('0x5'));var interaction=require(_0x3faf('0x6'));var config=require(_0x3faf('0x7'));var controller=require(_0x3faf('0x8'));router[_0x3faf('0x9')]('/',auth[_0x3faf('0xa')](),controller[_0x3faf('0xb')]);router['get']('/:id',auth[_0x3faf('0xa')](),controller['show']);router[_0x3faf('0xc')]('/',auth[_0x3faf('0xa')](),controller['create']);router[_0x3faf('0xd')](_0x3faf('0xe'),auth[_0x3faf('0xa')](),controller[_0x3faf('0xf')]);router[_0x3faf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3faf('0x11')]);module[_0x3faf('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 77d0bd6..04fcff6 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 _0xd1d9=['sequelize','exports','STRING','name'];(function(_0xa46316,_0x250f56){var _0x5e306f=function(_0x15e63d){while(--_0x15e63d){_0xa46316['push'](_0xa46316['shift']());}};_0x5e306f(++_0x250f56);}(_0xd1d9,0x104));var _0x9d1d=function(_0x46fc12,_0x4437f7){_0x46fc12=_0x46fc12-0x0;var _0x13bb9c=_0xd1d9[_0x46fc12];return _0x13bb9c;};'use strict';var Sequelize=require(_0x9d1d('0x0'));module[_0x9d1d('0x1')]={'name':{'type':Sequelize[_0x9d1d('0x2')],'unique':_0x9d1d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x83c4=['sequelize','exports','name'];(function(_0x1392fd,_0x5dc257){var _0x1eef9c=function(_0x112bca){while(--_0x112bca){_0x1392fd['push'](_0x1392fd['shift']());}};_0x1eef9c(++_0x5dc257);}(_0x83c4,0x1c8));var _0x483c=function(_0x1379c7,_0x53496f){_0x1379c7=_0x1379c7-0x0;var _0x262625=_0x83c4[_0x1379c7];return _0x262625;};'use strict';var Sequelize=require(_0x483c('0x0'));module[_0x483c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x483c('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index bb74dd7..d419665 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 _0x086e=['bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','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','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','show','params','filtears','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment'];(function(_0x2908fe,_0x4787b6){var _0x49de9f=function(_0x41891c){while(--_0x41891c){_0x2908fe['push'](_0x2908fe['shift']());}};_0x49de9f(++_0x4787b6);}(_0x086e,0xf7));var _0xe086=function(_0x410344,_0x11c039){_0x410344=_0x410344-0x0;var _0x210ff4=_0x086e[_0x410344];return _0x210ff4;};'use strict';var pdf=require(_0xe086('0x0'));var emlformat=require(_0xe086('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe086('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe086('0x3'));var moment=require(_0xe086('0x4'));var BPromise=require(_0xe086('0x5'));var Mustache=require(_0xe086('0x6'));var util=require(_0xe086('0x7'));var path=require(_0xe086('0x8'));var sox=require(_0xe086('0x9'));var csv=require(_0xe086('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe086('0xb'));var crypto=require(_0xe086('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe086('0xd'));var toCsv=require(_0xe086('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe086('0xe'));var authService=require(_0xe086('0xf'));var qs=require(_0xe086('0x10'));var as=require(_0xe086('0x11'));var hardwareService=require(_0xe086('0x12'));var logger=require('../../config/logger')(_0xe086('0x13'));var utils=require(_0xe086('0x14'));var config=require(_0xe086('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe086('0x16'))['db'];function respondWithStatusCode(_0x306016,_0x20a0c1){_0x20a0c1=_0x20a0c1||0xcc;return function(_0x3b7a14){if(_0x3b7a14){return _0x306016[_0xe086('0x17')](_0x20a0c1);}return _0x306016[_0xe086('0x18')](_0x20a0c1)[_0xe086('0x19')]();};}function respondWithResult(_0x3684df,_0x4d4d98){_0x4d4d98=_0x4d4d98||0xc8;return function(_0x478988){if(_0x478988){return _0x3684df[_0xe086('0x18')](_0x4d4d98)[_0xe086('0x1a')](_0x478988);}};}function respondWithFilteredResult(_0x143658,_0x5456bf){return function(_0x3c59aa){if(_0x3c59aa){var _0x392a40=_0x3c59aa[_0xe086('0x1b')],_0x43e66f=_0x5456bf[_0xe086('0x1c')],_0x564ee6=_0x5456bf[_0xe086('0x1c')]+_0x5456bf[_0xe086('0x1d')],_0x6c3bdf;if(_0x564ee6>=_0x392a40){_0x564ee6=_0x392a40;_0x6c3bdf=0xc8;}else{_0x6c3bdf=0xce;}_0x143658[_0xe086('0x18')](_0x6c3bdf);return _0x143658[_0xe086('0x1e')](_0xe086('0x1f'),_0x43e66f+'-'+_0x564ee6+'/'+_0x392a40)[_0xe086('0x1a')](_0x3c59aa);}return null;};}function patchUpdates(_0x163bb8){return function(_0x1d07fb){try{jsonpatch[_0xe086('0x20')](_0x1d07fb,_0x163bb8,!![]);}catch(_0x985aff){return BPromise[_0xe086('0x21')](_0x985aff);}return _0x1d07fb[_0xe086('0x22')]();};}function saveUpdates(_0x55ab07,_0x223c31){return function(_0x490fdc){if(_0x490fdc){return _0x490fdc[_0xe086('0x23')](_0x55ab07)[_0xe086('0x24')](function(_0x3b4585){return _0x3b4585;});}return null;};}function removeEntity(_0x56f692,_0x36104f){return function(_0x547811){if(_0x547811){return _0x547811[_0xe086('0x25')]()[_0xe086('0x24')](function(){var _0x1e2899=_0x547811[_0xe086('0x26')]({'plain':!![]});var _0x3f2765=_0xe086('0x27');return db[_0xe086('0x28')]['destroy']({'where':{'type':_0x3f2765,'resourceId':_0x1e2899['id']}})[_0xe086('0x24')](function(){return _0x547811;});})['then'](function(){_0x56f692[_0xe086('0x18')](0xcc)[_0xe086('0x19')]();});}};}function handleEntityNotFound(_0x52e3cb,_0x1fc44e){return function(_0xb01302){if(!_0xb01302){_0x52e3cb[_0xe086('0x17')](0x194);}return _0xb01302;};}function handleError(_0x5c0793,_0x5525c4){_0x5525c4=_0x5525c4||0x1f4;return function(_0x420baf){logger['error'](_0x420baf[_0xe086('0x29')]);if(_0x420baf[_0xe086('0x2a')]){delete _0x420baf[_0xe086('0x2a')];}_0x5c0793[_0xe086('0x18')](_0x5525c4)[_0xe086('0x2b')](_0x420baf);};}exports[_0xe086('0x2c')]=function(_0x37328f,_0x4affde){var _0x39e136={},_0x56c7e8={},_0x518f16={'count':0x0,'rows':[]};var _0x4946da=_[_0xe086('0x2d')](db[_0xe086('0x2e')][_0xe086('0x2f')],function(_0x539513){return{'name':_0x539513['fieldName'],'type':_0x539513[_0xe086('0x30')][_0xe086('0x31')]};});_0x56c7e8[_0xe086('0x32')]=_[_0xe086('0x2d')](_0x4946da,_0xe086('0x2a'));_0x56c7e8[_0xe086('0x33')]=_[_0xe086('0x34')](_0x37328f[_0xe086('0x33')]);_0x56c7e8['filters']=_[_0xe086('0x35')](_0x56c7e8[_0xe086('0x32')],_0x56c7e8[_0xe086('0x33')]);_0x39e136[_0xe086('0x36')]=_[_0xe086('0x35')](_0x56c7e8[_0xe086('0x32')],qs[_0xe086('0x37')](_0x37328f[_0xe086('0x33')][_0xe086('0x37')]));_0x39e136[_0xe086('0x36')]=_0x39e136['attributes']['length']?_0x39e136[_0xe086('0x36')]:_0x56c7e8[_0xe086('0x32')];if(!_0x37328f[_0xe086('0x33')][_0xe086('0x38')](_0xe086('0x39'))){_0x39e136[_0xe086('0x1d')]=qs[_0xe086('0x1d')](_0x37328f[_0xe086('0x33')][_0xe086('0x1d')]);_0x39e136[_0xe086('0x1c')]=qs[_0xe086('0x1c')](_0x37328f[_0xe086('0x33')][_0xe086('0x1c')]);}_0x39e136[_0xe086('0x3a')]=qs[_0xe086('0x3b')](_0x37328f['query'][_0xe086('0x3b')]);_0x39e136['where']=qs[_0xe086('0x3c')](_[_0xe086('0x3d')](_0x37328f[_0xe086('0x33')],_0x56c7e8[_0xe086('0x3c')]),_0x4946da);if(_0x37328f[_0xe086('0x33')][_0xe086('0x3e')]){_0x39e136[_0xe086('0x3f')]=_[_0xe086('0x40')](_0x39e136[_0xe086('0x3f')],{'$or':_[_0xe086('0x2d')](_0x4946da,function(_0x182e8c){if(_0x182e8c['type']!=='VIRTUAL'){var _0x40cdae={};_0x40cdae[_0x182e8c[_0xe086('0x2a')]]={'$like':'%'+_0x37328f[_0xe086('0x33')][_0xe086('0x3e')]+'%'};return _0x40cdae;}})});}_0x39e136=_['merge']({},_0x39e136,_0x37328f[_0xe086('0x41')]);var _0x506dbf={'where':_0x39e136['where']};return db[_0xe086('0x2e')][_0xe086('0x1b')](_0x506dbf)[_0xe086('0x24')](function(_0x235327){_0x518f16[_0xe086('0x1b')]=_0x235327;if(_0x37328f[_0xe086('0x33')]['includeAll']){_0x39e136[_0xe086('0x42')]=[{'all':!![]}];}return db[_0xe086('0x2e')][_0xe086('0x43')](_0x39e136);})[_0xe086('0x24')](function(_0x2d97f1){_0x518f16[_0xe086('0x44')]=_0x2d97f1;return _0x518f16;})[_0xe086('0x24')](respondWithFilteredResult(_0x4affde,_0x39e136))['catch'](handleError(_0x4affde,null));};exports[_0xe086('0x45')]=function(_0x306cf2,_0x2fbcab){var _0x1081ae={'raw':!![],'where':{'id':_0x306cf2[_0xe086('0x46')]['id']}},_0x5b8302={};_0x5b8302[_0xe086('0x32')]=_[_0xe086('0x34')](db[_0xe086('0x2e')][_0xe086('0x2f')]);_0x5b8302[_0xe086('0x33')]=_[_0xe086('0x34')](_0x306cf2['query']);_0x5b8302[_0xe086('0x47')]=_[_0xe086('0x35')](_0x5b8302[_0xe086('0x32')],_0x5b8302['query']);_0x1081ae[_0xe086('0x36')]=_[_0xe086('0x35')](_0x5b8302['model'],qs[_0xe086('0x37')](_0x306cf2['query'][_0xe086('0x37')]));_0x1081ae[_0xe086('0x36')]=_0x1081ae[_0xe086('0x36')][_0xe086('0x48')]?_0x1081ae[_0xe086('0x36')]:_0x5b8302[_0xe086('0x32')];if(_0x306cf2[_0xe086('0x33')][_0xe086('0x49')]){_0x1081ae['include']=[{'all':!![]}];}_0x1081ae=_['merge']({},_0x1081ae,_0x306cf2[_0xe086('0x41')]);return db[_0xe086('0x2e')][_0xe086('0x4a')](_0x1081ae)[_0xe086('0x24')](handleEntityNotFound(_0x2fbcab,null))[_0xe086('0x24')](respondWithResult(_0x2fbcab,null))[_0xe086('0x4b')](handleError(_0x2fbcab,null));};exports[_0xe086('0x4c')]=function(_0x34be21,_0x2883b3){return db[_0xe086('0x2e')][_0xe086('0x4c')](_0x34be21[_0xe086('0x4d')],{})[_0xe086('0x24')](function(_0x31ac47){var _0x146b41=_0x34be21['user'][_0xe086('0x26')]({'plain':!![]});if(!_0x146b41)throw new Error(_0xe086('0x4e'));if(_0x146b41['role']===_0xe086('0x4f')){var _0x112493=_0x31ac47[_0xe086('0x26')]({'plain':!![]});var _0x39b8bf=_0xe086('0x27');return db[_0xe086('0x50')][_0xe086('0x4a')]({'where':{'name':_0x39b8bf,'userProfileId':_0x146b41[_0xe086('0x51')]},'raw':!![]})[_0xe086('0x24')](function(_0x273a17){if(_0x273a17&&_0x273a17['autoAssociation']===0x0){return db['UserProfileResource'][_0xe086('0x4c')]({'name':_0x112493[_0xe086('0x2a')],'resourceId':_0x112493['id'],'type':_0x273a17[_0xe086('0x2a')],'sectionId':_0x273a17['id']},{})[_0xe086('0x24')](function(){return _0x31ac47;});}else{return _0x31ac47;}})[_0xe086('0x4b')](function(_0x490ee2){logger[_0xe086('0x52')](_0xe086('0x53'),_0x490ee2);throw _0x490ee2;});}return _0x31ac47;})[_0xe086('0x24')](respondWithResult(_0x2883b3,0xc9))[_0xe086('0x4b')](handleError(_0x2883b3,null));};exports[_0xe086('0x23')]=function(_0xc5286,_0x3e524d){if(_0xc5286[_0xe086('0x4d')]['id']){delete _0xc5286[_0xe086('0x4d')]['id'];}return db[_0xe086('0x2e')]['find']({'where':{'id':_0xc5286[_0xe086('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e524d,null))[_0xe086('0x24')](saveUpdates(_0xc5286[_0xe086('0x4d')],null))[_0xe086('0x24')](respondWithResult(_0x3e524d,null))[_0xe086('0x4b')](handleError(_0x3e524d,null));};exports['destroy']=function(_0x2481ad,_0x3967e1){return db[_0xe086('0x2e')][_0xe086('0x4a')]({'where':{'id':_0x2481ad[_0xe086('0x46')]['id']}})[_0xe086('0x24')](handleEntityNotFound(_0x3967e1,null))[_0xe086('0x24')](removeEntity(_0x3967e1,null))[_0xe086('0x4b')](handleError(_0x3967e1,null));}; \ No newline at end of file +var _0xe1f6=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','count','offset','limit','status','set','reject','save','update','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','send','map','Variable','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','filtears','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x470d22,_0x1b6a4f){var _0x3cc44d=function(_0x4a3749){while(--_0x4a3749){_0x470d22['push'](_0x470d22['shift']());}};_0x3cc44d(++_0x1b6a4f);}(_0xe1f6,0xe9));var _0x6e1f=function(_0x18a772,_0x1a4d3f){_0x18a772=_0x18a772-0x0;var _0xbaac04=_0xe1f6[_0x18a772];return _0xbaac04;};'use strict';var pdf=require(_0x6e1f('0x0'));var emlformat=require(_0x6e1f('0x1'));var rimraf=require(_0x6e1f('0x2'));var zipdir=require(_0x6e1f('0x3'));var jsonpatch=require(_0x6e1f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6e1f('0x5'));var Mustache=require(_0x6e1f('0x6'));var util=require(_0x6e1f('0x7'));var path=require(_0x6e1f('0x8'));var sox=require(_0x6e1f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e1f('0xa'));var squel=require(_0x6e1f('0xb'));var crypto=require(_0x6e1f('0xc'));var jsforce=require(_0x6e1f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6e1f('0xe'));var querystring=require(_0x6e1f('0xf'));var Papa=require(_0x6e1f('0x10'));var Redis=require(_0x6e1f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e1f('0x12'));var hardwareService=require(_0x6e1f('0x13'));var logger=require('../../config/logger')(_0x6e1f('0x14'));var utils=require(_0x6e1f('0x15'));var config=require(_0x6e1f('0x16'));var licenseUtil=require(_0x6e1f('0x17'));var db=require(_0x6e1f('0x18'))['db'];function respondWithStatusCode(_0xee9510,_0x49126b){_0x49126b=_0x49126b||0xcc;return function(_0x40b4e3){if(_0x40b4e3){return _0xee9510['sendStatus'](_0x49126b);}return _0xee9510['status'](_0x49126b)[_0x6e1f('0x19')]();};}function respondWithResult(_0x3cc014,_0x2c6e2e){_0x2c6e2e=_0x2c6e2e||0xc8;return function(_0x526bab){if(_0x526bab){return _0x3cc014['status'](_0x2c6e2e)[_0x6e1f('0x1a')](_0x526bab);}};}function respondWithFilteredResult(_0x428a20,_0xcbec2d){return function(_0x137278){if(_0x137278){var _0x7fb43a=_0x137278[_0x6e1f('0x1b')],_0x97acd6=_0xcbec2d['offset'],_0x5281ce=_0xcbec2d[_0x6e1f('0x1c')]+_0xcbec2d[_0x6e1f('0x1d')],_0x187404;if(_0x5281ce>=_0x7fb43a){_0x5281ce=_0x7fb43a;_0x187404=0xc8;}else{_0x187404=0xce;}_0x428a20[_0x6e1f('0x1e')](_0x187404);return _0x428a20[_0x6e1f('0x1f')]('Content-Range',_0x97acd6+'-'+_0x5281ce+'/'+_0x7fb43a)[_0x6e1f('0x1a')](_0x137278);}return null;};}function patchUpdates(_0x447f50){return function(_0x17f4a0){try{jsonpatch['apply'](_0x17f4a0,_0x447f50,!![]);}catch(_0x2ff63b){return BPromise[_0x6e1f('0x20')](_0x2ff63b);}return _0x17f4a0[_0x6e1f('0x21')]();};}function saveUpdates(_0x5cf9fe,_0x48cdd6){return function(_0x10b866){if(_0x10b866){return _0x10b866[_0x6e1f('0x22')](_0x5cf9fe)[_0x6e1f('0x23')](function(_0x4d2c60){return _0x4d2c60;});}return null;};}function removeEntity(_0x519e85,_0x50bd7f){return function(_0x1db05b){if(_0x1db05b){return _0x1db05b[_0x6e1f('0x24')]()[_0x6e1f('0x23')](function(){var _0x262696=_0x1db05b[_0x6e1f('0x25')]({'plain':!![]});var _0x26e53e=_0x6e1f('0x26');return db[_0x6e1f('0x27')][_0x6e1f('0x24')]({'where':{'type':_0x26e53e,'resourceId':_0x262696['id']}})['then'](function(){return _0x1db05b;});})[_0x6e1f('0x23')](function(){_0x519e85[_0x6e1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ededf,_0x2b6ccd){return function(_0x4d0a71){if(!_0x4d0a71){_0x4ededf[_0x6e1f('0x28')](0x194);}return _0x4d0a71;};}function handleError(_0x4f1415,_0x436f2c){_0x436f2c=_0x436f2c||0x1f4;return function(_0x3900e6){logger[_0x6e1f('0x29')](_0x3900e6[_0x6e1f('0x2a')]);if(_0x3900e6['name']){delete _0x3900e6['name'];}_0x4f1415[_0x6e1f('0x1e')](_0x436f2c)[_0x6e1f('0x2b')](_0x3900e6);};}exports['index']=function(_0x52b283,_0x2a433d){var _0x48af7a={},_0x2e843b={},_0x27c803={'count':0x0,'rows':[]};var _0x49cb02=_[_0x6e1f('0x2c')](db[_0x6e1f('0x2d')]['rawAttributes'],function(_0x535801){return{'name':_0x535801[_0x6e1f('0x2e')],'type':_0x535801[_0x6e1f('0x2f')][_0x6e1f('0x30')]};});_0x2e843b[_0x6e1f('0x31')]=_[_0x6e1f('0x2c')](_0x49cb02,_0x6e1f('0x32'));_0x2e843b[_0x6e1f('0x33')]=_[_0x6e1f('0x34')](_0x52b283[_0x6e1f('0x33')]);_0x2e843b[_0x6e1f('0x35')]=_['intersection'](_0x2e843b[_0x6e1f('0x31')],_0x2e843b['query']);_0x48af7a['attributes']=_[_0x6e1f('0x36')](_0x2e843b[_0x6e1f('0x31')],qs[_0x6e1f('0x37')](_0x52b283[_0x6e1f('0x33')]['fields']));_0x48af7a[_0x6e1f('0x38')]=_0x48af7a[_0x6e1f('0x38')]['length']?_0x48af7a[_0x6e1f('0x38')]:_0x2e843b[_0x6e1f('0x31')];if(!_0x52b283[_0x6e1f('0x33')][_0x6e1f('0x39')](_0x6e1f('0x3a'))){_0x48af7a[_0x6e1f('0x1d')]=qs[_0x6e1f('0x1d')](_0x52b283['query'][_0x6e1f('0x1d')]);_0x48af7a[_0x6e1f('0x1c')]=qs['offset'](_0x52b283['query'][_0x6e1f('0x1c')]);}_0x48af7a[_0x6e1f('0x3b')]=qs[_0x6e1f('0x3c')](_0x52b283[_0x6e1f('0x33')]['sort']);_0x48af7a['where']=qs[_0x6e1f('0x35')](_[_0x6e1f('0x3d')](_0x52b283['query'],_0x2e843b[_0x6e1f('0x35')]),_0x49cb02);if(_0x52b283[_0x6e1f('0x33')][_0x6e1f('0x3e')]){_0x48af7a['where']=_[_0x6e1f('0x3f')](_0x48af7a[_0x6e1f('0x40')],{'$or':_[_0x6e1f('0x2c')](_0x49cb02,function(_0x33e0e2){if(_0x33e0e2[_0x6e1f('0x2f')]!==_0x6e1f('0x41')){var _0x4bad93={};_0x4bad93[_0x33e0e2[_0x6e1f('0x32')]]={'$like':'%'+_0x52b283[_0x6e1f('0x33')][_0x6e1f('0x3e')]+'%'};return _0x4bad93;}})});}_0x48af7a=_[_0x6e1f('0x3f')]({},_0x48af7a,_0x52b283[_0x6e1f('0x42')]);var _0x1ca496={'where':_0x48af7a[_0x6e1f('0x40')]};return db[_0x6e1f('0x2d')][_0x6e1f('0x1b')](_0x1ca496)[_0x6e1f('0x23')](function(_0x4651ce){_0x27c803['count']=_0x4651ce;if(_0x52b283[_0x6e1f('0x33')][_0x6e1f('0x43')]){_0x48af7a['include']=[{'all':!![]}];}return db[_0x6e1f('0x2d')][_0x6e1f('0x44')](_0x48af7a);})[_0x6e1f('0x23')](function(_0x95d2e0){_0x27c803[_0x6e1f('0x45')]=_0x95d2e0;return _0x27c803;})[_0x6e1f('0x23')](respondWithFilteredResult(_0x2a433d,_0x48af7a))[_0x6e1f('0x46')](handleError(_0x2a433d,null));};exports['show']=function(_0x382183,_0x382e2e){var _0xe110ae={'raw':!![],'where':{'id':_0x382183[_0x6e1f('0x47')]['id']}},_0x163e24={};_0x163e24[_0x6e1f('0x31')]=_['keys'](db['Variable'][_0x6e1f('0x48')]);_0x163e24[_0x6e1f('0x33')]=_[_0x6e1f('0x34')](_0x382183['query']);_0x163e24[_0x6e1f('0x49')]=_[_0x6e1f('0x36')](_0x163e24['model'],_0x163e24[_0x6e1f('0x33')]);_0xe110ae[_0x6e1f('0x38')]=_[_0x6e1f('0x36')](_0x163e24[_0x6e1f('0x31')],qs[_0x6e1f('0x37')](_0x382183[_0x6e1f('0x33')][_0x6e1f('0x37')]));_0xe110ae[_0x6e1f('0x38')]=_0xe110ae[_0x6e1f('0x38')]['length']?_0xe110ae[_0x6e1f('0x38')]:_0x163e24['model'];if(_0x382183[_0x6e1f('0x33')]['includeAll']){_0xe110ae[_0x6e1f('0x4a')]=[{'all':!![]}];}_0xe110ae=_[_0x6e1f('0x3f')]({},_0xe110ae,_0x382183[_0x6e1f('0x42')]);return db[_0x6e1f('0x2d')][_0x6e1f('0x4b')](_0xe110ae)[_0x6e1f('0x23')](handleEntityNotFound(_0x382e2e,null))[_0x6e1f('0x23')](respondWithResult(_0x382e2e,null))[_0x6e1f('0x46')](handleError(_0x382e2e,null));};exports[_0x6e1f('0x4c')]=function(_0x4d3529,_0x15abe3){return db[_0x6e1f('0x2d')][_0x6e1f('0x4c')](_0x4d3529['body'],{})[_0x6e1f('0x23')](function(_0x20fb62){var _0x502994=_0x4d3529['user']['get']({'plain':!![]});if(!_0x502994)throw new Error(_0x6e1f('0x4d'));if(_0x502994['role']===_0x6e1f('0x4e')){var _0x3ba575=_0x20fb62['get']({'plain':!![]});var _0x114235=_0x6e1f('0x26');return db[_0x6e1f('0x4f')][_0x6e1f('0x4b')]({'where':{'name':_0x114235,'userProfileId':_0x502994[_0x6e1f('0x50')]},'raw':!![]})[_0x6e1f('0x23')](function(_0x541e80){if(_0x541e80&&_0x541e80[_0x6e1f('0x51')]===0x0){return db['UserProfileResource'][_0x6e1f('0x4c')]({'name':_0x3ba575[_0x6e1f('0x32')],'resourceId':_0x3ba575['id'],'type':_0x541e80[_0x6e1f('0x32')],'sectionId':_0x541e80['id']},{})['then'](function(){return _0x20fb62;});}else{return _0x20fb62;}})[_0x6e1f('0x46')](function(_0x3c5f76){logger[_0x6e1f('0x29')](_0x6e1f('0x52'),_0x3c5f76);throw _0x3c5f76;});}return _0x20fb62;})[_0x6e1f('0x23')](respondWithResult(_0x15abe3,0xc9))[_0x6e1f('0x46')](handleError(_0x15abe3,null));};exports[_0x6e1f('0x22')]=function(_0x28b0ca,_0x312927){if(_0x28b0ca[_0x6e1f('0x53')]['id']){delete _0x28b0ca[_0x6e1f('0x53')]['id'];}return db[_0x6e1f('0x2d')][_0x6e1f('0x4b')]({'where':{'id':_0x28b0ca[_0x6e1f('0x47')]['id']}})[_0x6e1f('0x23')](handleEntityNotFound(_0x312927,null))['then'](saveUpdates(_0x28b0ca[_0x6e1f('0x53')],null))[_0x6e1f('0x23')](respondWithResult(_0x312927,null))[_0x6e1f('0x46')](handleError(_0x312927,null));};exports['destroy']=function(_0x53c182,_0x274f01){return db[_0x6e1f('0x2d')][_0x6e1f('0x4b')]({'where':{'id':_0x53c182['params']['id']}})[_0x6e1f('0x23')](handleEntityNotFound(_0x274f01,null))[_0x6e1f('0x23')](removeEntity(_0x274f01,null))[_0x6e1f('0x46')](handleError(_0x274f01,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 56219a8..8aa554a 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 _0xd944=['path','define','Variable','util','../../config/logger','moment','bluebird'];(function(_0x33422a,_0x491ec9){var _0x31e391=function(_0x36c99e){while(--_0x36c99e){_0x33422a['push'](_0x33422a['shift']());}};_0x31e391(++_0x491ec9);}(_0xd944,0x145));var _0x4d94=function(_0xca04ff,_0xcb449f){_0xca04ff=_0xca04ff-0x0;var _0x6b547=_0xd944[_0xca04ff];return _0x6b547;};'use strict';var _=require('lodash');var util=require(_0x4d94('0x0'));var logger=require(_0x4d94('0x1'))('api');var moment=require(_0x4d94('0x2'));var BPromise=require(_0x4d94('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d94('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./variable.attributes');module['exports']=function(_0x18f8ce,_0x1e35e3){return _0x18f8ce[_0x4d94('0x5')](_0x4d94('0x6'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6597=['../../config/logger','moment','request-promise','./variable.attributes','exports','define','lodash','util'];(function(_0xc2a80d,_0x2436cb){var _0x116281=function(_0x4d0aa7){while(--_0x4d0aa7){_0xc2a80d['push'](_0xc2a80d['shift']());}};_0x116281(++_0x2436cb);}(_0x6597,0x16e));var _0x7659=function(_0x2acf9f,_0x88ba19){_0x2acf9f=_0x2acf9f-0x0;var _0x260308=_0x6597[_0x2acf9f];return _0x260308;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 144c4b5..e7f6670 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 _0x40b7=['catch','ShowVariable','Variable','find','options','raw','include','map','model','attributes','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x40b7,0x136));var _0x740b=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x40b7[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x740b('0x0'));var util=require('util');var moment=require(_0x740b('0x1'));var BPromise=require('bluebird');var rs=require(_0x740b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x740b('0x3'))['db'];var utils=require(_0x740b('0x4'));var logger=require(_0x740b('0x5'))(_0x740b('0x6'));var config=require(_0x740b('0x7'));var jayson=require(_0x740b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1c3f,_0x41ef3d,_0x2421b1){return new BPromise(function(_0x4d30b6,_0x43e0ae){return client[_0x740b('0x9')](_0x2a1c3f,_0x2421b1)[_0x740b('0xa')](function(_0x541ec4){logger[_0x740b('0xb')](_0x740b('0xc'),_0x41ef3d,_0x740b('0xd'));logger['debug'](_0x740b('0xe'),_0x41ef3d,'request\x20sent',JSON[_0x740b('0xf')](_0x541ec4));if(_0x541ec4[_0x740b('0x10')]){if(_0x541ec4[_0x740b('0x10')][_0x740b('0x11')]===0x1f4){logger[_0x740b('0x10')](_0x740b('0xc'),_0x41ef3d,_0x541ec4[_0x740b('0x10')][_0x740b('0x12')]);return _0x43e0ae(_0x541ec4[_0x740b('0x10')]['message']);}logger[_0x740b('0x10')](_0x740b('0xc'),_0x41ef3d,_0x541ec4[_0x740b('0x10')][_0x740b('0x12')]);return _0x4d30b6(_0x541ec4['error'][_0x740b('0x12')]);}else{logger[_0x740b('0xb')](_0x740b('0xc'),_0x41ef3d,_0x740b('0xd'));_0x4d30b6(_0x541ec4[_0x740b('0x13')][_0x740b('0x12')]);}})[_0x740b('0x14')](function(_0x4ff6cd){logger[_0x740b('0x10')](_0x740b('0xc'),_0x41ef3d,_0x4ff6cd);_0x43e0ae(_0x4ff6cd);});});}exports[_0x740b('0x15')]=function(_0x515983){var _0x41c8f1=this;return new Promise(function(_0x18fd7d,_0x4d1bff){return db[_0x740b('0x16')][_0x740b('0x17')]({'raw':_0x515983['options']?_0x515983[_0x740b('0x18')][_0x740b('0x19')]===undefined?!![]:![]:!![],'where':_0x515983[_0x740b('0x18')]?_0x515983[_0x740b('0x18')]['where']||null:null,'attributes':_0x515983['options']?_0x515983[_0x740b('0x18')]['attributes']||null:null,'include':_0x515983['options']?_0x515983[_0x740b('0x18')][_0x740b('0x1a')]?_[_0x740b('0x1b')](_0x515983['options'][_0x740b('0x1a')],function(_0x40db2b){return{'model':db[_0x40db2b['model']],'as':_0x40db2b['as'],'attributes':_0x40db2b['attributes'],'include':_0x40db2b[_0x740b('0x1a')]?_[_0x740b('0x1b')](_0x40db2b[_0x740b('0x1a')],function(_0x560499){return{'model':db[_0x560499[_0x740b('0x1c')]],'as':_0x560499['as'],'attributes':_0x560499[_0x740b('0x1d')],'include':_0x560499[_0x740b('0x1a')]?_[_0x740b('0x1b')](_0x560499[_0x740b('0x1a')],function(_0x14b9eb){return{'model':db[_0x14b9eb['model']],'as':_0x14b9eb['as'],'attributes':_0x14b9eb[_0x740b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x740b('0xa')](function(_0x57bc27){logger[_0x740b('0xb')](_0x740b('0x15'),_0x515983);logger['debug'](_0x740b('0x15'),_0x515983,JSON['stringify'](_0x57bc27));_0x18fd7d(_0x57bc27);})[_0x740b('0x14')](function(_0x1cfc87){logger[_0x740b('0x10')]('ShowVariable',_0x1cfc87[_0x740b('0x12')],_0x515983);_0x4d1bff(_0x41c8f1[_0x740b('0x10')](0x1f4,_0x1cfc87[_0x740b('0x12')]));});});}; \ No newline at end of file +var _0x759e=['request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowVariable','Variable','find','options','raw','where','include','map','model','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x759e,0x12f));var _0xe759=function(_0x2209ff,_0x4d5d52){_0x2209ff=_0x2209ff-0x0;var _0x4747fe=_0x759e[_0x2209ff];return _0x4747fe;};'use strict';var _=require(_0xe759('0x0'));var util=require(_0xe759('0x1'));var moment=require('moment');var BPromise=require(_0xe759('0x2'));var rs=require(_0xe759('0x3'));var fs=require('fs');var Redis=require(_0xe759('0x4'));var db=require(_0xe759('0x5'))['db'];var utils=require(_0xe759('0x6'));var logger=require(_0xe759('0x7'))(_0xe759('0x8'));var config=require(_0xe759('0x9'));var jayson=require(_0xe759('0xa'));var client=jayson[_0xe759('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12c993,_0x18390f,_0x145445){return new BPromise(function(_0x128542,_0x4889d9){return client[_0xe759('0xc')](_0x12c993,_0x145445)[_0xe759('0xd')](function(_0x471c9e){logger[_0xe759('0xe')](_0xe759('0xf'),_0x18390f,_0xe759('0x10'));logger[_0xe759('0x11')](_0xe759('0x12'),_0x18390f,_0xe759('0x10'),JSON[_0xe759('0x13')](_0x471c9e));if(_0x471c9e['error']){if(_0x471c9e['error'][_0xe759('0x14')]===0x1f4){logger[_0xe759('0x15')](_0xe759('0xf'),_0x18390f,_0x471c9e[_0xe759('0x15')][_0xe759('0x16')]);return _0x4889d9(_0x471c9e[_0xe759('0x15')][_0xe759('0x16')]);}logger[_0xe759('0x15')](_0xe759('0xf'),_0x18390f,_0x471c9e[_0xe759('0x15')][_0xe759('0x16')]);return _0x128542(_0x471c9e[_0xe759('0x15')][_0xe759('0x16')]);}else{logger['info'](_0xe759('0xf'),_0x18390f,_0xe759('0x10'));_0x128542(_0x471c9e[_0xe759('0x17')]['message']);}})[_0xe759('0x18')](function(_0x517255){logger['error'](_0xe759('0xf'),_0x18390f,_0x517255);_0x4889d9(_0x517255);});});}exports[_0xe759('0x19')]=function(_0x36497c){var _0x3f9743=this;return new Promise(function(_0x4eb1e3,_0x4d2659){return db[_0xe759('0x1a')][_0xe759('0x1b')]({'raw':_0x36497c[_0xe759('0x1c')]?_0x36497c['options'][_0xe759('0x1d')]===undefined?!![]:![]:!![],'where':_0x36497c[_0xe759('0x1c')]?_0x36497c[_0xe759('0x1c')][_0xe759('0x1e')]||null:null,'attributes':_0x36497c[_0xe759('0x1c')]?_0x36497c[_0xe759('0x1c')]['attributes']||null:null,'include':_0x36497c[_0xe759('0x1c')]?_0x36497c[_0xe759('0x1c')][_0xe759('0x1f')]?_[_0xe759('0x20')](_0x36497c[_0xe759('0x1c')][_0xe759('0x1f')],function(_0x40dd39){return{'model':db[_0x40dd39[_0xe759('0x21')]],'as':_0x40dd39['as'],'attributes':_0x40dd39[_0xe759('0x22')],'include':_0x40dd39[_0xe759('0x1f')]?_['map'](_0x40dd39[_0xe759('0x1f')],function(_0x388623){return{'model':db[_0x388623[_0xe759('0x21')]],'as':_0x388623['as'],'attributes':_0x388623[_0xe759('0x22')],'include':_0x388623['include']?_[_0xe759('0x20')](_0x388623['include'],function(_0x22dcd9){return{'model':db[_0x22dcd9['model']],'as':_0x22dcd9['as'],'attributes':_0x22dcd9['attributes']};}):[]};}):[]};}):[]:[]})[_0xe759('0xd')](function(_0x49c5cf){logger[_0xe759('0xe')](_0xe759('0x19'),_0x36497c);logger['debug'](_0xe759('0x19'),_0x36497c,JSON[_0xe759('0x13')](_0x49c5cf));_0x4eb1e3(_0x49c5cf);})[_0xe759('0x18')](function(_0x4ce71b){logger[_0xe759('0x15')](_0xe759('0x19'),_0x4ce71b[_0xe759('0x16')],_0x36497c);_0x4d2659(_0x3f9743['error'](0x1f4,_0x4ce71b[_0xe759('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index eed76fb..70c108d 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 _0x3bd0=['./version.controller','index','get','/fetch','fetch','/reset','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','migrations','exports','Router','../../components/auth/service'];(function(_0x11c06e,_0x1cb9c7){var _0x20a7dc=function(_0xd192db){while(--_0xd192db){_0x11c06e['push'](_0x11c06e['shift']());}};_0x20a7dc(++_0x1cb9c7);}(_0x3bd0,0x196));var _0x03bd=function(_0x34ef08,_0x3490fc){_0x34ef08=_0x34ef08-0x0;var _0x161a4f=_0x3bd0[_0x34ef08];return _0x161a4f;};'use strict';var express=require('express');var router=express[_0x03bd('0x0')]();var auth=require(_0x03bd('0x1'));var controller=require(_0x03bd('0x2'));router['get']('/',controller[_0x03bd('0x3')]);router[_0x03bd('0x4')](_0x03bd('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x03bd('0x6')]);router[_0x03bd('0x4')](_0x03bd('0x7'),auth[_0x03bd('0x8')](),auth[_0x03bd('0x9')](),controller[_0x03bd('0xa')]);router[_0x03bd('0x4')](_0x03bd('0xb'),auth['isAuthenticated'](),auth[_0x03bd('0x9')](),controller[_0x03bd('0xc')]);router[_0x03bd('0x4')](_0x03bd('0xd'),auth['isAuthenticated'](),controller[_0x03bd('0xe')]);router['get']('/migrations',controller[_0x03bd('0xf')]);module[_0x03bd('0x10')]=router; \ No newline at end of file +var _0x1a46=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x4dd32d,_0x4d5ebd){var _0xcd34cd=function(_0x996195){while(--_0x996195){_0x4dd32d['push'](_0x4dd32d['shift']());}};_0xcd34cd(++_0x4d5ebd);}(_0x1a46,0x11d));var _0x61a4=function(_0x4a2e49,_0x2da98d){_0x4a2e49=_0x4a2e49-0x0;var _0x356800=_0x1a46[_0x4a2e49];return _0x356800;};'use strict';var express=require(_0x61a4('0x0'));var router=express[_0x61a4('0x1')]();var auth=require(_0x61a4('0x2'));var controller=require(_0x61a4('0x3'));router[_0x61a4('0x4')]('/',controller[_0x61a4('0x5')]);router[_0x61a4('0x4')](_0x61a4('0x6'),auth[_0x61a4('0x7')](),auth[_0x61a4('0x8')](),controller[_0x61a4('0x9')]);router[_0x61a4('0x4')](_0x61a4('0xa'),auth[_0x61a4('0x7')](),auth[_0x61a4('0x8')](),controller['reset']);router[_0x61a4('0x4')]('/pull',auth[_0x61a4('0x7')](),auth[_0x61a4('0x8')](),controller[_0x61a4('0xb')]);router['get'](_0x61a4('0xc'),auth[_0x61a4('0x7')](),controller[_0x61a4('0xd')]);router['get'](_0x61a4('0xe'),controller[_0x61a4('0xf')]);module[_0x61a4('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a962e4b..c8cd6fa 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 _0x6931=['pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6931,0x1a9));var _0x1693=function(_0x45701f,_0x5f5852){_0x45701f=_0x45701f-0x0;var _0x5a5447=_0x6931[_0x45701f];return _0x5a5447;};'use strict';var Umzug=require(_0x1693('0x0'));var path=require(_0x1693('0x1'));var fs=require('fs');var _=require(_0x1693('0x2'));var pkginfo=require(_0x1693('0x3'))(module,_0x1693('0x4'));var compareVersions=require(_0x1693('0x5'));var exec=require(_0x1693('0x6'))[_0x1693('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x1693('0x8'));var pm2=require(_0x1693('0x9'));var logger=require(_0x1693('0xa'))(_0x1693('0xb'));var git=require(_0x1693('0xc'))(config['root']);exports[_0x1693('0xd')]=function(_0x2ec499,_0x18e32e){var _0x579434={'current':module[_0x1693('0xe')][_0x1693('0x4')],'phonebar':0x2};if(_0x2ec499[_0x1693('0xf')]&&_0x2ec499[_0x1693('0xf')][_0x1693('0x10')]){return git[_0x1693('0x11')]()[_0x1693('0x12')](function(_0x3807dd,_0x8f07){_0x579434[_0x1693('0x10')]=(_0x3807dd?module[_0x1693('0xe')]['version']:_0x8f07[_0x1693('0x10')])||_0x1693('0x13');return _0x18e32e[_0x1693('0x14')](0xc8)[_0x1693('0x15')](_0x579434);});}else{return _0x18e32e[_0x1693('0x14')](0xc8)[_0x1693('0x15')](_0x579434);}};exports[_0x1693('0x11')]=function(_0x5cede5,_0x31caad){return git['fetch']([_0x1693('0x16'),'master'],function(_0x6704d4){if(_0x6704d4){logger[_0x1693('0x17')](_0x6704d4);return _0x31caad['status'](0x1f4)['json'](_0x6704d4);}logger[_0x1693('0x18')]('git\x20fetch');return _0x31caad['status'](0xc8)['json']({'output':_0x1693('0x19')});});};exports['reset']=function(_0x49e7fb,_0x2a3bc2){return git[_0x1693('0x1a')]([_0x1693('0x1b'),_0x1693('0x1c')],function(_0x28edfe){if(_0x28edfe){logger[_0x1693('0x17')](_0x28edfe);return _0x2a3bc2['status'](0x1f4)['json'](_0x28edfe);}logger[_0x1693('0x18')](_0x1693('0x1d'));return _0x2a3bc2['status'](0xc8)[_0x1693('0x15')]({'output':_0x1693('0x1e')});});};exports[_0x1693('0x1f')]=function(_0xd2ff89,_0x2e0ada){exec('npm\x20install\x20--production',function(_0x1f9126,_0x433db6,_0xbe9928){logger[_0x1693('0x18')](_0x433db6);logger[_0x1693('0x18')](_0xbe9928);if(_0x1f9126){logger[_0x1693('0x17')](_0x1f9126);return _0x2e0ada['status'](0x1f4)[_0x1693('0x15')](_0x1f9126);}return _0x2e0ada['status'](0xc8)[_0x1693('0x15')]({'output':_0x433db6});});};exports[_0x1693('0x20')]=function(_0x31ef48,_0x56bc00){return pm2[_0x1693('0x20')](_0x1693('0x21'))[_0x1693('0x22')](function(_0x4142e7){logger[_0x1693('0x18')](_0x1693('0x23'),_0x4142e7);return _0x56bc00[_0x1693('0x14')](0xc8)['json']({'output':_0x1693('0x24')});})['catch'](function(_0x3e7ccf){logger['error'](_0x3e7ccf);return _0x56bc00[_0x1693('0x14')](0x1f4)[_0x1693('0x15')](_0x3e7ccf);});};exports[_0x1693('0x25')]=function(_0x148438,_0x5888d7){var _0x425361=fs[_0x1693('0x26')](path['join'](config['root'],_0x1693('0x27'),'migrations'));var _0x4ea713=[];for(var _0x5ce409=0x0;_0x5ce409<_0x425361[_0x1693('0x28')];_0x5ce409++){var _0xef56e9=_0x425361[_0x5ce409]['replace'](_0x1693('0x29'),'');if(compareVersions(module['exports'][_0x1693('0x4')],_0xef56e9)===-0x1){_0x4ea713['push'](_0xef56e9);}}if(_0x4ea713[_0x1693('0x28')]){var _0xa6ea7e=_0x4ea713[_0x1693('0x2a')](compareVersions);var _0x5b4c17=new Umzug({'storage':_0x1693('0x2b'),'storageOptions':{'model':db[_0x1693('0x2c')],'modelName':_0x1693('0x2c'),'columnName':_0x1693('0x4')},'migrations':{'params':[db[_0x1693('0x2b')][_0x1693('0x2d')](),db[_0x1693('0x2b')][_0x1693('0x2e')],function(){throw new Error(_0x1693('0x2f'));}],'path':path[_0x1693('0x30')](config[_0x1693('0x31')],_0x1693('0x27'),'migrations'),'pattern':/\.js$/}});_0x5b4c17['up']({'migrations':_[_0x1693('0x32')](_0xa6ea7e,function(_0x4e68de){return _0x4e68de+_0x1693('0x29');})})[_0x1693('0x22')](function(){return _0x5888d7[_0x1693('0x14')](0xc8)[_0x1693('0x15')]({'output':_0x1693('0x33')+module[_0x1693('0xe')][_0x1693('0x4')]+_0x1693('0x34')+_[_0x1693('0x35')](_0xa6ea7e),'migrations':_['join'](_0xa6ea7e)});})[_0x1693('0x36')](function(_0x10bfbc){if(_0x10bfbc instanceof db[_0x1693('0x2b')][_0x1693('0x37')]){return _0x5888d7[_0x1693('0x14')](0xc8)[_0x1693('0x15')]({'output':_0x1693('0x38')});}else{return _0x5888d7[_0x1693('0x14')](0x1f4)[_0x1693('0x15')](_0x10bfbc);}});}else{return _0x5888d7[_0x1693('0x14')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x81b7=['../../config/environment','../../config/pm2','../../config/logger','simple-git','root','exports','query','latest','2.0.0','json','status','fetch','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','error','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','../../mysqldb'];(function(_0x8bec98,_0x6c1a69){var _0xc9f833=function(_0x2b325f){while(--_0x2b325f){_0x8bec98['push'](_0x8bec98['shift']());}};_0xc9f833(++_0x6c1a69);}(_0x81b7,0x1f2));var _0x781b=function(_0x3cffe4,_0x5ddec6){_0x3cffe4=_0x3cffe4-0x0;var _0x242594=_0x81b7[_0x3cffe4];return _0x242594;};'use strict';var Umzug=require('umzug');var path=require(_0x781b('0x0'));var fs=require('fs');var _=require(_0x781b('0x1'));var pkginfo=require(_0x781b('0x2'))(module,_0x781b('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x781b('0x4'))['exec'];var db=require(_0x781b('0x5'))['db'];var config=require(_0x781b('0x6'));var pm2=require(_0x781b('0x7'));var logger=require(_0x781b('0x8'))('update');var git=require(_0x781b('0x9'))(config[_0x781b('0xa')]);exports['index']=function(_0x4aa451,_0x3de3cd){var _0x33c04b={'current':module[_0x781b('0xb')][_0x781b('0x3')],'phonebar':0x2};if(_0x4aa451['query']&&_0x4aa451[_0x781b('0xc')][_0x781b('0xd')]){return git['fetch']()['tags'](function(_0x1f7fca,_0x4f3356){_0x33c04b[_0x781b('0xd')]=(_0x1f7fca?module['exports'][_0x781b('0x3')]:_0x4f3356['latest'])||_0x781b('0xe');return _0x3de3cd['status'](0xc8)[_0x781b('0xf')](_0x33c04b);});}else{return _0x3de3cd[_0x781b('0x10')](0xc8)[_0x781b('0xf')](_0x33c04b);}};exports[_0x781b('0x11')]=function(_0x1dbd64,_0x52bbe4){return git[_0x781b('0x11')]([_0x781b('0x12'),_0x781b('0x13')],function(_0x2315df){if(_0x2315df){logger['error'](_0x2315df);return _0x52bbe4[_0x781b('0x10')](0x1f4)['json'](_0x2315df);}logger[_0x781b('0x14')](_0x781b('0x15'));return _0x52bbe4[_0x781b('0x10')](0xc8)['json']({'output':_0x781b('0x16')});});};exports['reset']=function(_0x544675,_0x2c62e5){return git[_0x781b('0x17')]([_0x781b('0x18'),_0x781b('0x19')],function(_0x26ed56){if(_0x26ed56){logger['error'](_0x26ed56);return _0x2c62e5['status'](0x1f4)['json'](_0x26ed56);}logger[_0x781b('0x14')](_0x781b('0x1a'));return _0x2c62e5[_0x781b('0x10')](0xc8)[_0x781b('0xf')]({'output':_0x781b('0x1b')});});};exports[_0x781b('0x1c')]=function(_0x5b659b,_0x4387bb){exec(_0x781b('0x1d'),function(_0xce8565,_0x4ab3c4,_0x13d2e4){logger[_0x781b('0x14')](_0x4ab3c4);logger[_0x781b('0x14')](_0x13d2e4);if(_0xce8565){logger[_0x781b('0x1e')](_0xce8565);return _0x4387bb['status'](0x1f4)[_0x781b('0xf')](_0xce8565);}return _0x4387bb[_0x781b('0x10')](0xc8)[_0x781b('0xf')]({'output':_0x4ab3c4});});};exports[_0x781b('0x1f')]=function(_0x3aba86,_0x4c5bfd){return pm2[_0x781b('0x1f')](_0x781b('0x20'))[_0x781b('0x21')](function(_0x22cdc0){logger[_0x781b('0x14')](_0x781b('0x22'),_0x22cdc0);return _0x4c5bfd['status'](0xc8)['json']({'output':_0x781b('0x23')});})[_0x781b('0x24')](function(_0x560449){logger[_0x781b('0x1e')](_0x560449);return _0x4c5bfd[_0x781b('0x10')](0x1f4)[_0x781b('0xf')](_0x560449);});};exports[_0x781b('0x25')]=function(_0xbde04f,_0x3d3d4c){var _0x1957c4=fs[_0x781b('0x26')](path[_0x781b('0x27')](config[_0x781b('0xa')],_0x781b('0x28'),'migrations'));var _0x27488a=[];for(var _0x286a73=0x0;_0x286a73<_0x1957c4['length'];_0x286a73++){var _0x536be8=_0x1957c4[_0x286a73][_0x781b('0x29')](_0x781b('0x2a'),'');if(compareVersions(module[_0x781b('0xb')][_0x781b('0x3')],_0x536be8)===-0x1){_0x27488a[_0x781b('0x2b')](_0x536be8);}}if(_0x27488a[_0x781b('0x2c')]){var _0x25d546=_0x27488a[_0x781b('0x2d')](compareVersions);var _0x5a7c47=new Umzug({'storage':_0x781b('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0x781b('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0x781b('0x2e')][_0x781b('0x30')](),db['sequelize'][_0x781b('0x31')],function(){throw new Error(_0x781b('0x32'));}],'path':path[_0x781b('0x27')](config[_0x781b('0xa')],_0x781b('0x28'),_0x781b('0x25')),'pattern':/\.js$/}});_0x5a7c47['up']({'migrations':_['map'](_0x25d546,function(_0x436985){return _0x436985+_0x781b('0x2a');})})[_0x781b('0x21')](function(){return _0x3d3d4c[_0x781b('0x10')](0xc8)[_0x781b('0xf')]({'output':_0x781b('0x33')+module[_0x781b('0xb')][_0x781b('0x3')]+_0x781b('0x34')+_[_0x781b('0x35')](_0x25d546),'migrations':_[_0x781b('0x27')](_0x25d546)});})[_0x781b('0x24')](function(_0x54da70){if(_0x54da70 instanceof db[_0x781b('0x2e')][_0x781b('0x36')]){return _0x3d3d4c[_0x781b('0x10')](0xc8)['json']({'output':_0x781b('0x37')});}else{return _0x3d3d4c['status'](0x1f4)['json'](_0x54da70);}});}else{return _0x3d3d4c[_0x781b('0x10')](0xc8)[_0x781b('0xf')]({'output':_0x781b('0x37')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 4a0bdab..a0ac36e 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 _0xb254=['isAuthenticated','index','/describe','show','create','put','delete','/:id','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb254,0xbe));var _0x4b25=function(_0x1442fa,_0x4bc3cc){_0x1442fa=_0x1442fa-0x0;var _0x11fa1b=_0xb254[_0x1442fa];return _0x11fa1b;};'use strict';var multer=require(_0x4b25('0x0'));var util=require(_0x4b25('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4b25('0x2'));var router=express[_0x4b25('0x3')]();var auth=require(_0x4b25('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4b25('0x5'));var controller=require(_0x4b25('0x6'));router[_0x4b25('0x7')]('/',auth[_0x4b25('0x8')](),controller[_0x4b25('0x9')]);router[_0x4b25('0x7')](_0x4b25('0xa'),auth[_0x4b25('0x8')](),controller['describe']);router['get']('/:id',auth[_0x4b25('0x8')](),controller[_0x4b25('0xb')]);router['post']('/',auth[_0x4b25('0x8')](),controller[_0x4b25('0xc')]);router[_0x4b25('0xd')]('/:id',auth[_0x4b25('0x8')](),controller['update']);router[_0x4b25('0xe')](_0x4b25('0xf'),auth[_0x4b25('0x8')](),controller[_0x4b25('0x10')]);module[_0x4b25('0x11')]=router; \ No newline at end of file +var _0x6841=['create','delete','destroy','exports','multer','util','path','connect-timeout','../../config/environment','./voiceAgentReport.controller','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x57538b,_0x1291bb){var _0x3c1525=function(_0x19c55c){while(--_0x19c55c){_0x57538b['push'](_0x57538b['shift']());}};_0x3c1525(++_0x1291bb);}(_0x6841,0x147));var _0x1684=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0x6841[_0x4e6ae6];return _0x23c108;};'use strict';var multer=require(_0x1684('0x0'));var util=require(_0x1684('0x1'));var path=require(_0x1684('0x2'));var timeout=require(_0x1684('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1684('0x4'));var controller=require(_0x1684('0x5'));router[_0x1684('0x6')]('/',auth['isAuthenticated'](),controller[_0x1684('0x7')]);router[_0x1684('0x6')]('/describe',auth[_0x1684('0x8')](),controller[_0x1684('0x9')]);router[_0x1684('0x6')](_0x1684('0xa'),auth[_0x1684('0x8')](),controller[_0x1684('0xb')]);router[_0x1684('0xc')]('/',auth[_0x1684('0x8')](),controller[_0x1684('0xd')]);router['put'](_0x1684('0xa'),auth[_0x1684('0x8')](),controller['update']);router[_0x1684('0xe')](_0x1684('0xa'),auth[_0x1684('0x8')](),controller[_0x1684('0xf')]);module[_0x1684('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 5540fc6..c62f26b 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 _0xb4c7=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x107ca5,_0x4b7f1c){var _0x47e5ae=function(_0x4e2910){while(--_0x4e2910){_0x107ca5['push'](_0x107ca5['shift']());}};_0x47e5ae(++_0x4b7f1c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x4e0386,_0x28c20c){_0x4e0386=_0x4e0386-0x0;var _0x113a34=_0xb4c7[_0x4e0386];return _0x113a34;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'type':{'type':Sequelize[_0x7b4c('0x2')]},'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b4c('0x2')]},'interface':{'type':Sequelize[_0x7b4c('0x2')]},'membername':{'type':Sequelize[_0x7b4c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7b4c('0x3')]},'holdtime':{'type':Sequelize[_0x7b4c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7b4c('0x4')]},'reason':{'type':Sequelize[_0x7b4c('0x2')]},'lastevent':{'type':Sequelize[_0x7b4c('0x2')]},'channel':{'type':Sequelize[_0x7b4c('0x2')]},'channelstate':{'type':Sequelize[_0x7b4c('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'language':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'destchannel':{'type':Sequelize[_0x7b4c('0x2')]},'destchannelstate':{'type':Sequelize[_0x7b4c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridname':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'destlanguage':{'type':Sequelize[_0x7b4c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7b4c('0x2')]},'destexten':{'type':Sequelize[_0x7b4c('0x2')]},'destpriority':{'type':Sequelize[_0x7b4c('0x2')]},'destuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7b4c('0x2')]},'transfer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b4c('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7b4c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'agententerreason':{'type':Sequelize[_0x7b4c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7fbe=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','INTEGER'];(function(_0x43611c,_0x254118){var _0x275660=function(_0x2472a1){while(--_0x2472a1){_0x43611c['push'](_0x43611c['shift']());}};_0x275660(++_0x254118);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x70a8a5,_0x35a384){_0x70a8a5=_0x70a8a5-0x0;var _0x2b563b=_0x7fbe[_0x70a8a5];return _0x2b563b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xe7fb('0x0')]},'uniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'calleridnum':{'type':Sequelize[_0xe7fb('0x0')]},'calleridname':{'type':Sequelize[_0xe7fb('0x0')]},'queue':{'type':Sequelize[_0xe7fb('0x0')]},'interface':{'type':Sequelize[_0xe7fb('0x0')]},'membername':{'type':Sequelize[_0xe7fb('0x0')]},'agentcalledAt':{'type':Sequelize[_0xe7fb('0x1')]},'agentconnectAt':{'type':Sequelize[_0xe7fb('0x1')]},'agentcompleteAt':{'type':Sequelize[_0xe7fb('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0xe7fb('0x1')]},'agentdumpAt':{'type':Sequelize[_0xe7fb('0x1')]},'holdtime':{'type':Sequelize[_0xe7fb('0x2')]},'agentcomplete':{'type':Sequelize[_0xe7fb('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe7fb('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe7fb('0x2')]},'agentacw':{'type':Sequelize[_0xe7fb('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe7fb('0x2')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe7fb('0x0')]},'channelstate':{'type':Sequelize[_0xe7fb('0x2')]},'channelstatedesc':{'type':Sequelize[_0xe7fb('0x0')]},'connectedlinenum':{'type':Sequelize[_0xe7fb('0x0')]},'connectedlinename':{'type':Sequelize[_0xe7fb('0x0')]},'language':{'type':Sequelize[_0xe7fb('0x0')]},'accountcode':{'type':Sequelize[_0xe7fb('0x0')]},'context':{'type':Sequelize[_0xe7fb('0x0')]},'exten':{'type':Sequelize[_0xe7fb('0x0')]},'priority':{'type':Sequelize[_0xe7fb('0x0')]},'destchannel':{'type':Sequelize[_0xe7fb('0x0')]},'destchannelstate':{'type':Sequelize[_0xe7fb('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe7fb('0x0')]},'destcalleridnum':{'type':Sequelize[_0xe7fb('0x0')]},'destcalleridname':{'type':Sequelize[_0xe7fb('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe7fb('0x0')]},'destlanguage':{'type':Sequelize[_0xe7fb('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe7fb('0x0')]},'destexten':{'type':Sequelize[_0xe7fb('0x0')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xe7fb('0x0')]},'transfer':{'type':Sequelize[_0xe7fb('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe7fb('0x0')],'comment':_0xe7fb('0x4')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xe7fb('0x0')]},'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 eed6166..9a4bba9 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 _0x8281=['describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','then','error','name','send','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','VoiceAgentReport','includeAll','include','findAll','rows','catch','show','filtears','options','find','create','body','update','params'];(function(_0x38a62f,_0x26b533){var _0x1f734b=function(_0x282abe){while(--_0x282abe){_0x38a62f['push'](_0x38a62f['shift']());}};_0x1f734b(++_0x26b533);}(_0x8281,0x182));var _0x1828=function(_0x235470,_0x2b1237){_0x235470=_0x235470-0x0;var _0x3050ea=_0x8281[_0x235470];return _0x3050ea;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1828('0x0'));var zipdir=require(_0x1828('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1828('0x2'));var moment=require(_0x1828('0x3'));var BPromise=require(_0x1828('0x4'));var Mustache=require(_0x1828('0x5'));var util=require(_0x1828('0x6'));var path=require(_0x1828('0x7'));var sox=require(_0x1828('0x8'));var csv=require(_0x1828('0x9'));var ejs=require(_0x1828('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1828('0xb'));var crypto=require(_0x1828('0xc'));var jsforce=require(_0x1828('0xd'));var deskjs=require(_0x1828('0xe'));var toCsv=require(_0x1828('0x9'));var querystring=require('querystring');var Papa=require(_0x1828('0xf'));var Redis=require(_0x1828('0x10'));var authService=require(_0x1828('0x11'));var qs=require(_0x1828('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1828('0x13'));var logger=require(_0x1828('0x14'))(_0x1828('0x15'));var utils=require(_0x1828('0x16'));var config=require(_0x1828('0x17'));var licenseUtil=require(_0x1828('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb5c487,_0x432a63){_0x432a63=_0x432a63||0xcc;return function(_0x2d5d09){if(_0x2d5d09){return _0xb5c487[_0x1828('0x19')](_0x432a63);}return _0xb5c487[_0x1828('0x1a')](_0x432a63)[_0x1828('0x1b')]();};}function respondWithResult(_0x54c4bd,_0x4304d4){_0x4304d4=_0x4304d4||0xc8;return function(_0xb1fb45){if(_0xb1fb45){return _0x54c4bd[_0x1828('0x1a')](_0x4304d4)[_0x1828('0x1c')](_0xb1fb45);}};}function respondWithFilteredResult(_0x136cda,_0xdd117b){return function(_0x1c346b){if(_0x1c346b){var _0x70490c=_0x1c346b[_0x1828('0x1d')],_0x17b364=_0xdd117b[_0x1828('0x1e')],_0x20bf0f=_0xdd117b[_0x1828('0x1e')]+_0xdd117b[_0x1828('0x1f')],_0x468ea1;if(_0x20bf0f>=_0x70490c){_0x20bf0f=_0x70490c;_0x468ea1=0xc8;}else{_0x468ea1=0xce;}_0x136cda['status'](_0x468ea1);return _0x136cda[_0x1828('0x20')]('Content-Range',_0x17b364+'-'+_0x20bf0f+'/'+_0x70490c)[_0x1828('0x1c')](_0x1c346b);}return null;};}function patchUpdates(_0xb7f25f){return function(_0x2530b9){try{jsonpatch[_0x1828('0x21')](_0x2530b9,_0xb7f25f,!![]);}catch(_0xcf9037){return BPromise[_0x1828('0x22')](_0xcf9037);}return _0x2530b9[_0x1828('0x23')]();};}function saveUpdates(_0x58aeed,_0x35b74e){return function(_0x155c80){if(_0x155c80){return _0x155c80['update'](_0x58aeed)['then'](function(_0x19d9ef){return _0x19d9ef;});}return null;};}function removeEntity(_0x4c8ad9,_0x417498){return function(_0x523685){if(_0x523685){return _0x523685[_0x1828('0x24')]()[_0x1828('0x25')](function(){_0x4c8ad9[_0x1828('0x1a')](0xcc)[_0x1828('0x1b')]();});}};}function handleEntityNotFound(_0x4c47a8,_0x5aa55f){return function(_0x942e5b){if(!_0x942e5b){_0x4c47a8[_0x1828('0x19')](0x194);}return _0x942e5b;};}function handleError(_0x222326,_0x5a1469){_0x5a1469=_0x5a1469||0x1f4;return function(_0x2ccd3b){logger[_0x1828('0x26')](_0x2ccd3b['stack']);if(_0x2ccd3b['name']){delete _0x2ccd3b[_0x1828('0x27')];}_0x222326[_0x1828('0x1a')](_0x5a1469)[_0x1828('0x28')](_0x2ccd3b);};}exports['index']=function(_0xb99498,_0x4b2b36){var _0x54f555={},_0x52410c={},_0x2d597f={'count':0x0,'rows':[]};var _0x28b5ce=_[_0x1828('0x29')](db['VoiceAgentReport'][_0x1828('0x2a')],function(_0x22bf7a){return{'name':_0x22bf7a['fieldName'],'type':_0x22bf7a[_0x1828('0x2b')][_0x1828('0x2c')]};});_0x52410c[_0x1828('0x2d')]=_[_0x1828('0x29')](_0x28b5ce,_0x1828('0x27'));_0x52410c[_0x1828('0x2e')]=_[_0x1828('0x2f')](_0xb99498['query']);_0x52410c['filters']=_['intersection'](_0x52410c[_0x1828('0x2d')],_0x52410c['query']);_0x54f555[_0x1828('0x30')]=_[_0x1828('0x31')](_0x52410c[_0x1828('0x2d')],qs['fields'](_0xb99498[_0x1828('0x2e')][_0x1828('0x32')]));_0x54f555['attributes']=_0x54f555[_0x1828('0x30')][_0x1828('0x33')]?_0x54f555['attributes']:_0x52410c[_0x1828('0x2d')];if(!_0xb99498[_0x1828('0x2e')][_0x1828('0x34')](_0x1828('0x35'))){_0x54f555['limit']=qs[_0x1828('0x1f')](_0xb99498[_0x1828('0x2e')]['limit']);_0x54f555[_0x1828('0x1e')]=qs[_0x1828('0x1e')](_0xb99498[_0x1828('0x2e')][_0x1828('0x1e')]);}_0x54f555[_0x1828('0x36')]=qs['sort'](_0xb99498[_0x1828('0x2e')][_0x1828('0x37')]);_0x54f555[_0x1828('0x38')]=qs[_0x1828('0x39')](_[_0x1828('0x3a')](_0xb99498[_0x1828('0x2e')],_0x52410c[_0x1828('0x39')]),_0x28b5ce);if(_0xb99498[_0x1828('0x2e')]['filter']){_0x54f555[_0x1828('0x38')]=_['merge'](_0x54f555[_0x1828('0x38')],{'$or':_['map'](_0x28b5ce,function(_0x2a3421){if(_0x2a3421['type']!==_0x1828('0x3b')){var _0x65374f={};_0x65374f[_0x2a3421[_0x1828('0x27')]]={'$like':'%'+_0xb99498[_0x1828('0x2e')][_0x1828('0x3c')]+'%'};return _0x65374f;}})});}_0x54f555=_[_0x1828('0x3d')]({},_0x54f555,_0xb99498['options']);var _0x28754c={'where':_0x54f555[_0x1828('0x38')]};return db[_0x1828('0x3e')]['count'](_0x28754c)['then'](function(_0xa75d45){_0x2d597f[_0x1828('0x1d')]=_0xa75d45;if(_0xb99498[_0x1828('0x2e')][_0x1828('0x3f')]){_0x54f555[_0x1828('0x40')]=[{'all':!![]}];}return db[_0x1828('0x3e')][_0x1828('0x41')](_0x54f555);})[_0x1828('0x25')](function(_0x1b4dd2){_0x2d597f[_0x1828('0x42')]=_0x1b4dd2;return _0x2d597f;})['then'](respondWithFilteredResult(_0x4b2b36,_0x54f555))[_0x1828('0x43')](handleError(_0x4b2b36,null));};exports[_0x1828('0x44')]=function(_0x4f8f92,_0x30bc23){var _0x2e9b7d={'raw':![],'where':{'id':_0x4f8f92['params']['id']}},_0x1b2656={};_0x1b2656[_0x1828('0x2d')]=_[_0x1828('0x2f')](db['VoiceAgentReport'][_0x1828('0x2a')]);_0x1b2656[_0x1828('0x2e')]=_[_0x1828('0x2f')](_0x4f8f92[_0x1828('0x2e')]);_0x1b2656[_0x1828('0x45')]=_['intersection'](_0x1b2656[_0x1828('0x2d')],_0x1b2656[_0x1828('0x2e')]);_0x2e9b7d[_0x1828('0x30')]=_[_0x1828('0x31')](_0x1b2656[_0x1828('0x2d')],qs[_0x1828('0x32')](_0x4f8f92[_0x1828('0x2e')]['fields']));_0x2e9b7d[_0x1828('0x30')]=_0x2e9b7d[_0x1828('0x30')][_0x1828('0x33')]?_0x2e9b7d['attributes']:_0x1b2656[_0x1828('0x2d')];if(_0x4f8f92[_0x1828('0x2e')][_0x1828('0x3f')]){_0x2e9b7d[_0x1828('0x40')]=[{'all':!![]}];}_0x2e9b7d=_[_0x1828('0x3d')]({},_0x2e9b7d,_0x4f8f92[_0x1828('0x46')]);return db[_0x1828('0x3e')][_0x1828('0x47')](_0x2e9b7d)['then'](handleEntityNotFound(_0x30bc23,null))[_0x1828('0x25')](respondWithResult(_0x30bc23,null))[_0x1828('0x43')](handleError(_0x30bc23,null));};exports['create']=function(_0x32eb25,_0x518136){return db['VoiceAgentReport'][_0x1828('0x48')](_0x32eb25[_0x1828('0x49')],{})[_0x1828('0x25')](respondWithResult(_0x518136,0xc9))['catch'](handleError(_0x518136,null));};exports[_0x1828('0x4a')]=function(_0x24f89,_0x1704c6){if(_0x24f89[_0x1828('0x49')]['id']){delete _0x24f89[_0x1828('0x49')]['id'];}return db[_0x1828('0x3e')][_0x1828('0x47')]({'where':{'id':_0x24f89[_0x1828('0x4b')]['id']}})[_0x1828('0x25')](handleEntityNotFound(_0x1704c6,null))[_0x1828('0x25')](saveUpdates(_0x24f89[_0x1828('0x49')],null))['then'](respondWithResult(_0x1704c6,null))['catch'](handleError(_0x1704c6,null));};exports[_0x1828('0x24')]=function(_0xae3e74,_0x28024d){return db['VoiceAgentReport'][_0x1828('0x47')]({'where':{'id':_0xae3e74['params']['id']}})[_0x1828('0x25')](handleEntityNotFound(_0x28024d,null))[_0x1828('0x25')](removeEntity(_0x28024d,null))['catch'](handleError(_0x28024d,null));};exports[_0x1828('0x4c')]=function(_0x5acad9,_0x50604e){return db[_0x1828('0x3e')][_0x1828('0x4c')]()[_0x1828('0x25')](respondWithResult(_0x50604e,null))[_0x1828('0x43')](handleError(_0x50604e,null));}; \ No newline at end of file +var _0x4f88=['length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','filtears','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceAgentReport','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x2fd86c,_0x120f34){var _0x71d761=function(_0x13a80c){while(--_0x13a80c){_0x2fd86c['push'](_0x2fd86c['shift']());}};_0x71d761(++_0x120f34);}(_0x4f88,0x173));var _0x84f8=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x4f88[_0x16a223];return _0x5ded66;};'use strict';var pdf=require(_0x84f8('0x0'));var emlformat=require(_0x84f8('0x1'));var rimraf=require(_0x84f8('0x2'));var zipdir=require(_0x84f8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84f8('0x4'));var moment=require(_0x84f8('0x5'));var BPromise=require(_0x84f8('0x6'));var Mustache=require(_0x84f8('0x7'));var util=require('util');var path=require(_0x84f8('0x8'));var sox=require(_0x84f8('0x9'));var csv=require(_0x84f8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x84f8('0xb'));var deskjs=require(_0x84f8('0xc'));var toCsv=require(_0x84f8('0xa'));var querystring=require('querystring');var Papa=require(_0x84f8('0xd'));var Redis=require(_0x84f8('0xe'));var authService=require(_0x84f8('0xf'));var qs=require(_0x84f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84f8('0x11'));var logger=require(_0x84f8('0x12'))(_0x84f8('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84f8('0x14'));var db=require(_0x84f8('0x15'))['db'];function respondWithStatusCode(_0x1fef11,_0x58b713){_0x58b713=_0x58b713||0xcc;return function(_0x2e073){if(_0x2e073){return _0x1fef11[_0x84f8('0x16')](_0x58b713);}return _0x1fef11[_0x84f8('0x17')](_0x58b713)[_0x84f8('0x18')]();};}function respondWithResult(_0x1c5bec,_0x2aae71){_0x2aae71=_0x2aae71||0xc8;return function(_0x1b9e3a){if(_0x1b9e3a){return _0x1c5bec[_0x84f8('0x17')](_0x2aae71)[_0x84f8('0x19')](_0x1b9e3a);}};}function respondWithFilteredResult(_0x24b4be,_0x43de27){return function(_0x27e28c){if(_0x27e28c){var _0x367459=_0x27e28c[_0x84f8('0x1a')],_0x60673b=_0x43de27[_0x84f8('0x1b')],_0x4d024b=_0x43de27['offset']+_0x43de27['limit'],_0x341533;if(_0x4d024b>=_0x367459){_0x4d024b=_0x367459;_0x341533=0xc8;}else{_0x341533=0xce;}_0x24b4be[_0x84f8('0x17')](_0x341533);return _0x24b4be[_0x84f8('0x1c')]('Content-Range',_0x60673b+'-'+_0x4d024b+'/'+_0x367459)[_0x84f8('0x19')](_0x27e28c);}return null;};}function patchUpdates(_0x341aea){return function(_0x32e8cd){try{jsonpatch[_0x84f8('0x1d')](_0x32e8cd,_0x341aea,!![]);}catch(_0x3fc193){return BPromise[_0x84f8('0x1e')](_0x3fc193);}return _0x32e8cd[_0x84f8('0x1f')]();};}function saveUpdates(_0x218a2a,_0x551fec){return function(_0xe223fa){if(_0xe223fa){return _0xe223fa[_0x84f8('0x20')](_0x218a2a)[_0x84f8('0x21')](function(_0x1ab496){return _0x1ab496;});}return null;};}function removeEntity(_0x14ad81,_0x2da89c){return function(_0x34c49e){if(_0x34c49e){return _0x34c49e[_0x84f8('0x22')]()['then'](function(){_0x14ad81[_0x84f8('0x17')](0xcc)[_0x84f8('0x18')]();});}};}function handleEntityNotFound(_0x11837c,_0x1cf8dd){return function(_0x57908c){if(!_0x57908c){_0x11837c[_0x84f8('0x16')](0x194);}return _0x57908c;};}function handleError(_0x258832,_0x315d23){_0x315d23=_0x315d23||0x1f4;return function(_0x19f6e8){logger['error'](_0x19f6e8[_0x84f8('0x23')]);if(_0x19f6e8[_0x84f8('0x24')]){delete _0x19f6e8[_0x84f8('0x24')];}_0x258832[_0x84f8('0x17')](_0x315d23)['send'](_0x19f6e8);};}exports[_0x84f8('0x25')]=function(_0x2286bc,_0x111919){var _0x239356={},_0x26f1e5={},_0x3fdb21={'count':0x0,'rows':[]};var _0x54c22b=_[_0x84f8('0x26')](db[_0x84f8('0x27')][_0x84f8('0x28')],function(_0x4addf9){return{'name':_0x4addf9['fieldName'],'type':_0x4addf9['type'][_0x84f8('0x29')]};});_0x26f1e5['model']=_[_0x84f8('0x26')](_0x54c22b,_0x84f8('0x24'));_0x26f1e5[_0x84f8('0x2a')]=_[_0x84f8('0x2b')](_0x2286bc['query']);_0x26f1e5[_0x84f8('0x2c')]=_['intersection'](_0x26f1e5[_0x84f8('0x2d')],_0x26f1e5[_0x84f8('0x2a')]);_0x239356[_0x84f8('0x2e')]=_[_0x84f8('0x2f')](_0x26f1e5[_0x84f8('0x2d')],qs[_0x84f8('0x30')](_0x2286bc[_0x84f8('0x2a')]['fields']));_0x239356[_0x84f8('0x2e')]=_0x239356['attributes'][_0x84f8('0x31')]?_0x239356[_0x84f8('0x2e')]:_0x26f1e5[_0x84f8('0x2d')];if(!_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x32')]('nolimit')){_0x239356['limit']=qs[_0x84f8('0x33')](_0x2286bc['query'][_0x84f8('0x33')]);_0x239356[_0x84f8('0x1b')]=qs['offset'](_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x1b')]);}_0x239356['order']=qs[_0x84f8('0x34')](_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x34')]);_0x239356[_0x84f8('0x35')]=qs[_0x84f8('0x2c')](_[_0x84f8('0x36')](_0x2286bc[_0x84f8('0x2a')],_0x26f1e5[_0x84f8('0x2c')]),_0x54c22b);if(_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x37')]){_0x239356['where']=_[_0x84f8('0x38')](_0x239356['where'],{'$or':_['map'](_0x54c22b,function(_0xd4903c){if(_0xd4903c[_0x84f8('0x39')]!==_0x84f8('0x3a')){var _0x57a583={};_0x57a583[_0xd4903c[_0x84f8('0x24')]]={'$like':'%'+_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x37')]+'%'};return _0x57a583;}})});}_0x239356=_[_0x84f8('0x38')]({},_0x239356,_0x2286bc[_0x84f8('0x3b')]);var _0x477b96={'where':_0x239356[_0x84f8('0x35')]};return db[_0x84f8('0x27')][_0x84f8('0x1a')](_0x477b96)[_0x84f8('0x21')](function(_0x22e1a5){_0x3fdb21[_0x84f8('0x1a')]=_0x22e1a5;if(_0x2286bc[_0x84f8('0x2a')][_0x84f8('0x3c')]){_0x239356[_0x84f8('0x3d')]=[{'all':!![]}];}return db[_0x84f8('0x27')]['findAll'](_0x239356);})[_0x84f8('0x21')](function(_0x75402c){_0x3fdb21[_0x84f8('0x3e')]=_0x75402c;return _0x3fdb21;})[_0x84f8('0x21')](respondWithFilteredResult(_0x111919,_0x239356))[_0x84f8('0x3f')](handleError(_0x111919,null));};exports['show']=function(_0x308c82,_0x3f3987){var _0x3620d4={'raw':![],'where':{'id':_0x308c82[_0x84f8('0x40')]['id']}},_0x3e5379={};_0x3e5379[_0x84f8('0x2d')]=_['keys'](db['VoiceAgentReport'][_0x84f8('0x28')]);_0x3e5379[_0x84f8('0x2a')]=_[_0x84f8('0x2b')](_0x308c82[_0x84f8('0x2a')]);_0x3e5379[_0x84f8('0x41')]=_[_0x84f8('0x2f')](_0x3e5379[_0x84f8('0x2d')],_0x3e5379['query']);_0x3620d4[_0x84f8('0x2e')]=_[_0x84f8('0x2f')](_0x3e5379[_0x84f8('0x2d')],qs[_0x84f8('0x30')](_0x308c82['query'][_0x84f8('0x30')]));_0x3620d4[_0x84f8('0x2e')]=_0x3620d4[_0x84f8('0x2e')]['length']?_0x3620d4[_0x84f8('0x2e')]:_0x3e5379[_0x84f8('0x2d')];if(_0x308c82[_0x84f8('0x2a')]['includeAll']){_0x3620d4['include']=[{'all':!![]}];}_0x3620d4=_[_0x84f8('0x38')]({},_0x3620d4,_0x308c82[_0x84f8('0x3b')]);return db[_0x84f8('0x27')][_0x84f8('0x42')](_0x3620d4)[_0x84f8('0x21')](handleEntityNotFound(_0x3f3987,null))[_0x84f8('0x21')](respondWithResult(_0x3f3987,null))[_0x84f8('0x3f')](handleError(_0x3f3987,null));};exports[_0x84f8('0x43')]=function(_0xae5e6f,_0x190021){return db[_0x84f8('0x27')]['create'](_0xae5e6f['body'],{})['then'](respondWithResult(_0x190021,0xc9))['catch'](handleError(_0x190021,null));};exports['update']=function(_0x5bb463,_0x2780f8){if(_0x5bb463[_0x84f8('0x44')]['id']){delete _0x5bb463['body']['id'];}return db[_0x84f8('0x27')]['find']({'where':{'id':_0x5bb463[_0x84f8('0x40')]['id']}})[_0x84f8('0x21')](handleEntityNotFound(_0x2780f8,null))['then'](saveUpdates(_0x5bb463['body'],null))['then'](respondWithResult(_0x2780f8,null))[_0x84f8('0x3f')](handleError(_0x2780f8,null));};exports[_0x84f8('0x22')]=function(_0x4b7e41,_0x14e59b){return db[_0x84f8('0x27')][_0x84f8('0x42')]({'where':{'id':_0x4b7e41[_0x84f8('0x40')]['id']}})[_0x84f8('0x21')](handleEntityNotFound(_0x14e59b,null))[_0x84f8('0x21')](removeEntity(_0x14e59b,null))[_0x84f8('0x3f')](handleError(_0x14e59b,null));};exports['describe']=function(_0xe6dbca,_0x1a14ff){return db[_0x84f8('0x27')][_0x84f8('0x45')]()['then'](respondWithResult(_0x1a14ff,null))[_0x84f8('0x3f')](handleError(_0x1a14ff,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e9c40d7..8b2bfcb 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 _0xe080=['bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','destuniqueid','lodash','util','../../config/logger','moment'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe080,0x141));var _0x0e08=function(_0xff06a0,_0x3b6fd1){_0xff06a0=_0xff06a0-0x0;var _0x224127=_0xe080[_0xff06a0];return _0x224127;};'use strict';var _=require(_0x0e08('0x0'));var util=require(_0x0e08('0x1'));var logger=require(_0x0e08('0x2'))('api');var moment=require(_0x0e08('0x3'));var BPromise=require(_0x0e08('0x4'));var rp=require(_0x0e08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e08('0x6'));var config=require(_0x0e08('0x7'));var attributes=require(_0x0e08('0x8'));module[_0x0e08('0x9')]=function(_0x1c7948,_0x3d506b){return _0x1c7948[_0x0e08('0xa')]('VoiceAgentReport',attributes,{'tableName':_0x0e08('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x0e08('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5983=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0xa8ed74,_0x12aa4e){var _0xc7e8e1=function(_0x207559){while(--_0x207559){_0xa8ed74['push'](_0xa8ed74['shift']());}};_0xc7e8e1(++_0x12aa4e);}(_0x5983,0x106));var _0x3598=function(_0x4b2abd,_0x5ab030){_0x4b2abd=_0x4b2abd-0x0;var _0x195493=_0x5983[_0x4b2abd];return _0x195493;};'use strict';var _=require(_0x3598('0x0'));var util=require(_0x3598('0x1'));var logger=require(_0x3598('0x2'))('api');var moment=require(_0x3598('0x3'));var BPromise=require(_0x3598('0x4'));var rp=require(_0x3598('0x5'));var fs=require('fs');var path=require(_0x3598('0x6'));var rimraf=require(_0x3598('0x7'));var config=require(_0x3598('0x8'));var attributes=require(_0x3598('0x9'));module[_0x3598('0xa')]=function(_0x3c3f27,_0xcfc1d2){return _0x3c3f27[_0x3598('0xb')](_0x3598('0xc'),attributes,{'tableName':_0x3598('0xd'),'paranoid':![],'indexes':[{'fields':[_0x3598('0xe'),_0x3598('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9bc9744..3c394d2 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 _0x4cc2=['rpc','../../config/environment','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','then','stringify','update','attributes','limit','UpdateVoiceAgentReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x3585ef,_0x137b15){var _0x5b7eb0=function(_0x37a380){while(--_0x37a380){_0x3585ef['push'](_0x3585ef['shift']());}};_0x5b7eb0(++_0x137b15);}(_0x4cc2,0x111));var _0x24cc=function(_0x293329,_0x2c8b42){_0x293329=_0x293329-0x0;var _0x43e691=_0x4cc2[_0x293329];return _0x43e691;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x24cc('0x0'));var BPromise=require(_0x24cc('0x1'));var rs=require(_0x24cc('0x2'));var fs=require('fs');var Redis=require(_0x24cc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24cc('0x4'));var logger=require(_0x24cc('0x5'))(_0x24cc('0x6'));var config=require(_0x24cc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x24cc('0x8')][_0x24cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbfeb86,_0x2d80f4,_0x13f9d8){return new BPromise(function(_0x23d21a,_0x29a254){return client[_0x24cc('0xa')](_0xbfeb86,_0x13f9d8)['then'](function(_0x1fa595){logger[_0x24cc('0xb')](_0x24cc('0xc'),_0x2d80f4,'request\x20sent');logger[_0x24cc('0xd')](_0x24cc('0xe'),_0x2d80f4,_0x24cc('0xf'),JSON['stringify'](_0x1fa595));if(_0x1fa595[_0x24cc('0x10')]){if(_0x1fa595[_0x24cc('0x10')][_0x24cc('0x11')]===0x1f4){logger[_0x24cc('0x10')](_0x24cc('0xc'),_0x2d80f4,_0x1fa595['error'][_0x24cc('0x12')]);return _0x29a254(_0x1fa595[_0x24cc('0x10')][_0x24cc('0x12')]);}logger[_0x24cc('0x10')](_0x24cc('0xc'),_0x2d80f4,_0x1fa595['error'][_0x24cc('0x12')]);return _0x23d21a(_0x1fa595[_0x24cc('0x10')][_0x24cc('0x12')]);}else{logger[_0x24cc('0xb')](_0x24cc('0xc'),_0x2d80f4,'request\x20sent');_0x23d21a(_0x1fa595['result'][_0x24cc('0x12')]);}})[_0x24cc('0x13')](function(_0x2e7290){logger[_0x24cc('0x10')](_0x24cc('0xc'),_0x2d80f4,_0x2e7290);_0x29a254(_0x2e7290);});});}exports[_0x24cc('0x14')]=function(_0x100974){var _0x572658=this;return new Promise(function(_0xac4477,_0x149f28){return db[_0x24cc('0x15')]['create'](_0x100974[_0x24cc('0x16')],{'raw':_0x100974[_0x24cc('0x17')]?_0x100974['options'][_0x24cc('0x18')]===undefined?!![]:![]:!![]})[_0x24cc('0x19')](function(_0x3a4923){logger[_0x24cc('0xb')](_0x24cc('0x14'),_0x100974);logger[_0x24cc('0xd')](_0x24cc('0x14'),_0x100974,JSON[_0x24cc('0x1a')](_0x3a4923));_0xac4477(_0x3a4923);})[_0x24cc('0x13')](function(_0x57b13f){logger[_0x24cc('0x10')](_0x24cc('0x14'),_0x57b13f[_0x24cc('0x12')],_0x100974);_0x149f28(_0x572658[_0x24cc('0x10')](0x1f4,_0x57b13f['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x3fad75){var _0x5876bc=this;return new Promise(function(_0x562579,_0x1fbf73){return db[_0x24cc('0x15')][_0x24cc('0x1b')](_0x3fad75[_0x24cc('0x16')],{'raw':_0x3fad75[_0x24cc('0x17')]?_0x3fad75[_0x24cc('0x17')][_0x24cc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fad75['options']?_0x3fad75['options']['where']||null:null,'attributes':_0x3fad75[_0x24cc('0x17')]?_0x3fad75[_0x24cc('0x17')][_0x24cc('0x1c')]||null:null,'limit':_0x3fad75['options']?_0x3fad75['options'][_0x24cc('0x1d')]||null:null})[_0x24cc('0x19')](function(_0x1869b5){logger[_0x24cc('0xb')](_0x24cc('0x1e'),_0x3fad75);logger[_0x24cc('0xd')]('UpdateVoiceAgentReport',_0x3fad75,JSON[_0x24cc('0x1a')](_0x1869b5));_0x562579(_0x1869b5);})[_0x24cc('0x13')](function(_0x17203f){logger['error'](_0x24cc('0x1e'),_0x17203f[_0x24cc('0x12')],_0x3fad75);_0x1fbf73(_0x5876bc['error'](0x1f4,_0x17203f[_0x24cc('0x12')]));});});}; \ No newline at end of file +var _0x29a7=['rpc','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','stringify','UpdateVoiceAgentReport','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils'];(function(_0x30540d,_0x2a3beb){var _0x1e83d1=function(_0x45885b){while(--_0x45885b){_0x30540d['push'](_0x30540d['shift']());}};_0x1e83d1(++_0x2a3beb);}(_0x29a7,0xea));var _0x729a=function(_0x4676b9,_0x55fcd1){_0x4676b9=_0x4676b9-0x0;var _0x3a6e12=_0x29a7[_0x4676b9];return _0x3a6e12;};'use strict';var _=require(_0x729a('0x0'));var util=require(_0x729a('0x1'));var moment=require(_0x729a('0x2'));var BPromise=require(_0x729a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x729a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x729a('0x5'));var logger=require('../../config/logger')(_0x729a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x729a('0x7')][_0x729a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdab0c4,_0x4eed99,_0x1a3269){return new BPromise(function(_0x4b9b64,_0x47f308){return client['request'](_0xdab0c4,_0x1a3269)[_0x729a('0x9')](function(_0x4221ab){logger['info'](_0x729a('0xa'),_0x4eed99,_0x729a('0xb'));logger[_0x729a('0xc')](_0x729a('0xd'),_0x4eed99,_0x729a('0xb'),JSON['stringify'](_0x4221ab));if(_0x4221ab[_0x729a('0xe')]){if(_0x4221ab[_0x729a('0xe')][_0x729a('0xf')]===0x1f4){logger[_0x729a('0xe')](_0x729a('0xa'),_0x4eed99,_0x4221ab[_0x729a('0xe')][_0x729a('0x10')]);return _0x47f308(_0x4221ab[_0x729a('0xe')][_0x729a('0x10')]);}logger[_0x729a('0xe')](_0x729a('0xa'),_0x4eed99,_0x4221ab['error'][_0x729a('0x10')]);return _0x4b9b64(_0x4221ab[_0x729a('0xe')]['message']);}else{logger[_0x729a('0x11')](_0x729a('0xa'),_0x4eed99,_0x729a('0xb'));_0x4b9b64(_0x4221ab[_0x729a('0x12')][_0x729a('0x10')]);}})[_0x729a('0x13')](function(_0x12fff3){logger[_0x729a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4eed99,_0x12fff3);_0x47f308(_0x12fff3);});});}exports[_0x729a('0x14')]=function(_0x67ed67){var _0x47b72d=this;return new Promise(function(_0x28b4b1,_0x46f7a6){return db[_0x729a('0x15')][_0x729a('0x16')](_0x67ed67[_0x729a('0x17')],{'raw':_0x67ed67[_0x729a('0x18')]?_0x67ed67[_0x729a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x729a('0x9')](function(_0x52e1d4){logger['info'](_0x729a('0x14'),_0x67ed67);logger[_0x729a('0xc')](_0x729a('0x14'),_0x67ed67,JSON[_0x729a('0x19')](_0x52e1d4));_0x28b4b1(_0x52e1d4);})[_0x729a('0x13')](function(_0x228894){logger['error']('CreateVoiceAgentReport',_0x228894[_0x729a('0x10')],_0x67ed67);_0x46f7a6(_0x47b72d['error'](0x1f4,_0x228894['message']));});});};exports[_0x729a('0x1a')]=function(_0x197fe7){var _0xcfa6f4=this;return new Promise(function(_0x14b9c5,_0x226d67){return db[_0x729a('0x15')]['update'](_0x197fe7['body'],{'raw':_0x197fe7[_0x729a('0x18')]?_0x197fe7[_0x729a('0x18')][_0x729a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197fe7['options']?_0x197fe7[_0x729a('0x18')]['where']||null:null,'attributes':_0x197fe7['options']?_0x197fe7[_0x729a('0x18')][_0x729a('0x1c')]||null:null,'limit':_0x197fe7[_0x729a('0x18')]?_0x197fe7[_0x729a('0x18')][_0x729a('0x1d')]||null:null})[_0x729a('0x9')](function(_0x5e31b0){logger[_0x729a('0x11')](_0x729a('0x1a'),_0x197fe7);logger[_0x729a('0xc')]('UpdateVoiceAgentReport',_0x197fe7,JSON[_0x729a('0x19')](_0x5e31b0));_0x14b9c5(_0x5e31b0);})['catch'](function(_0xae5406){logger['error'](_0x729a('0x1a'),_0xae5406[_0x729a('0x10')],_0x197fe7);_0x226d67(_0xcfa6f4[_0x729a('0xe')](0x1f4,_0xae5406[_0x729a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6576dcb..75cbdea 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 _0x1c16=['/:id','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe','describe','show','post','create'];(function(_0x4da096,_0x442f94){var _0xbe8398=function(_0x2a0a00){while(--_0x2a0a00){_0x4da096['push'](_0x4da096['shift']());}};_0xbe8398(++_0x442f94);}(_0x1c16,0x15a));var _0x61c1=function(_0x13e9d4,_0x25483d){_0x13e9d4=_0x13e9d4-0x0;var _0x2c62b8=_0x1c16[_0x13e9d4];return _0x2c62b8;};'use strict';var multer=require(_0x61c1('0x0'));var util=require(_0x61c1('0x1'));var path=require('path');var timeout=require(_0x61c1('0x2'));var express=require(_0x61c1('0x3'));var router=express['Router']();var auth=require(_0x61c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x61c1('0x5'));var controller=require(_0x61c1('0x6'));router[_0x61c1('0x7')]('/',auth[_0x61c1('0x8')](),controller['index']);router[_0x61c1('0x7')](_0x61c1('0x9'),auth['isAuthenticated'](),controller[_0x61c1('0xa')]);router[_0x61c1('0x7')]('/:id',auth[_0x61c1('0x8')](),controller[_0x61c1('0xb')]);router[_0x61c1('0xc')]('/',auth[_0x61c1('0x8')](),controller[_0x61c1('0xd')]);router['put'](_0x61c1('0xe'),auth[_0x61c1('0x8')](),controller[_0x61c1('0xf')]);router[_0x61c1('0x10')](_0x61c1('0xe'),auth[_0x61c1('0x8')](),controller['destroy']);module[_0x61c1('0x11')]=router; \ No newline at end of file +var _0x0012=['describe','get','/:id','show','post','put','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','/describe'];(function(_0x35731c,_0x5ab1d1){var _0x2f2957=function(_0x2d6583){while(--_0x2d6583){_0x35731c['push'](_0x35731c['shift']());}};_0x2f2957(++_0x5ab1d1);}(_0x0012,0x1ef));var _0x2001=function(_0x4e4028,_0x34e0f6){_0x4e4028=_0x4e4028-0x0;var _0x413afe=_0x0012[_0x4e4028];return _0x413afe;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2001('0x0'));var express=require('express');var router=express[_0x2001('0x1')]();var auth=require(_0x2001('0x2'));var interaction=require(_0x2001('0x3'));var config=require(_0x2001('0x4'));var controller=require(_0x2001('0x5'));router['get']('/',auth[_0x2001('0x6')](),controller[_0x2001('0x7')]);router['get'](_0x2001('0x8'),auth[_0x2001('0x6')](),controller[_0x2001('0x9')]);router[_0x2001('0xa')](_0x2001('0xb'),auth[_0x2001('0x6')](),controller[_0x2001('0xc')]);router[_0x2001('0xd')]('/',auth[_0x2001('0x6')](),controller['create']);router[_0x2001('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x2001('0xf')]);router['delete'](_0x2001('0xb'),auth[_0x2001('0x6')](),controller[_0x2001('0x10')]);module[_0x2001('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f0422dd..e161caf 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 _0x5fd1=['INTEGER','sequelize','STRING','ENUM','inbound','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x1ce71c,_0x1f2369){var _0x38c215=function(_0x2777b7){while(--_0x2777b7){_0x1ce71c['push'](_0x1ce71c['shift']());}};_0x38c215(++_0x1f2369);}(_0x5fd1,0x155));var _0x15fd=function(_0xd2c66,_0x1420c1){_0xd2c66=_0xd2c66-0x0;var _0x566dbd=_0x5fd1[_0xd2c66];return _0x566dbd;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'type':{'type':Sequelize[_0x15fd('0x2')](_0x15fd('0x3'),'internal','outbound',_0x15fd('0x4'),_0x15fd('0x5'),_0x15fd('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'source':{'type':Sequelize[_0x15fd('0x1')]},'destination':{'type':Sequelize[_0x15fd('0x1')]},'destinationcontext':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x15fd('0x1')]},'lastapplication':{'type':Sequelize[_0x15fd('0x1')]},'lastdata':{'type':Sequelize[_0x15fd('0x7')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x15fd('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x15fd('0x8')]},'duration':{'type':Sequelize[_0x15fd('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x15fd('0x1')]},'userfield':{'type':Sequelize[_0x15fd('0x1')]},'userDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x15fd('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x15fd('0x1')]},'note':{'type':Sequelize[_0x15fd('0x1')]},'prefix':{'type':Sequelize[_0x15fd('0x1')]},'routeid':{'type':Sequelize[_0x15fd('0x9')]},'sipcallid':{'type':Sequelize[_0x15fd('0x1')]}}; \ No newline at end of file +var _0xd13e=['TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','internal','inbound-fax','dialer'];(function(_0x1cb74c,_0x45a2ea){var _0x2cd56a=function(_0x55a5a6){while(--_0x55a5a6){_0x1cb74c['push'](_0x1cb74c['shift']());}};_0x2cd56a(++_0x45a2ea);}(_0xd13e,0x193));var _0xed13=function(_0x4ad72e,_0x52d54f){_0x4ad72e=_0x4ad72e-0x0;var _0x112804=_0xd13e[_0x4ad72e];return _0x112804;};'use strict';var Sequelize=require(_0xed13('0x0'));module[_0xed13('0x1')]={'uniqueid':{'type':Sequelize[_0xed13('0x2')]},'type':{'type':Sequelize[_0xed13('0x3')]('inbound',_0xed13('0x4'),'outbound',_0xed13('0x5'),'outbound-fax',_0xed13('0x6'))},'tag':{'type':Sequelize[_0xed13('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xed13('0x2')]},'callerid':{'type':Sequelize[_0xed13('0x2')]},'channel':{'type':Sequelize[_0xed13('0x2')]},'destinationchannel':{'type':Sequelize[_0xed13('0x2')]},'lastapplication':{'type':Sequelize[_0xed13('0x2')]},'lastdata':{'type':Sequelize[_0xed13('0x7')]},'starttime':{'type':Sequelize[_0xed13('0x8')]},'systemanswertime':{'type':Sequelize[_0xed13('0x8')]},'answertime':{'type':Sequelize[_0xed13('0x8')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xed13('0x9')]},'billableseconds':{'type':Sequelize[_0xed13('0x9')]},'mohtime':{'type':Sequelize[_0xed13('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xed13('0x2')]},'amaflags':{'type':Sequelize[_0xed13('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xed13('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xed13('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xed13('0x2')]},'note':{'type':Sequelize[_0xed13('0x2')]},'prefix':{'type':Sequelize[_0xed13('0x2')]},'routeid':{'type':Sequelize[_0xed13('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 393f63e..69bfb8d 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 _0xbb67=['intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','fullname','alias','keys','filtears','catch','body','find','describe','update','uniqueid','params','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','key','query','filters'];(function(_0xf529b5,_0xd64487){var _0x5aca54=function(_0x1ec329){while(--_0x1ec329){_0xf529b5['push'](_0xf529b5['shift']());}};_0x5aca54(++_0xd64487);}(_0xbb67,0x161));var _0x7bb6=function(_0x448fcd,_0x4dbbef){_0x448fcd=_0x448fcd-0x0;var _0x5a95c4=_0xbb67[_0x448fcd];return _0x5a95c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7bb6('0x0'));var rimraf=require(_0x7bb6('0x1'));var zipdir=require(_0x7bb6('0x2'));var jsonpatch=require(_0x7bb6('0x3'));var rp=require(_0x7bb6('0x4'));var moment=require('moment');var BPromise=require(_0x7bb6('0x5'));var Mustache=require(_0x7bb6('0x6'));var util=require(_0x7bb6('0x7'));var path=require(_0x7bb6('0x8'));var sox=require(_0x7bb6('0x9'));var csv=require(_0x7bb6('0xa'));var ejs=require(_0x7bb6('0xb'));var fs=require('fs');var _=require(_0x7bb6('0xc'));var squel=require('squel');var crypto=require(_0x7bb6('0xd'));var jsforce=require(_0x7bb6('0xe'));var deskjs=require(_0x7bb6('0xf'));var toCsv=require(_0x7bb6('0xa'));var querystring=require(_0x7bb6('0x10'));var Papa=require(_0x7bb6('0x11'));var Redis=require(_0x7bb6('0x12'));var authService=require(_0x7bb6('0x13'));var qs=require(_0x7bb6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb6('0x15'));var logger=require(_0x7bb6('0x16'))(_0x7bb6('0x17'));var utils=require(_0x7bb6('0x18'));var config=require(_0x7bb6('0x19'));var licenseUtil=require(_0x7bb6('0x1a'));var db=require(_0x7bb6('0x1b'))['db'];function respondWithStatusCode(_0x47630f,_0x9367c6){_0x9367c6=_0x9367c6||0xcc;return function(_0x495cf2){if(_0x495cf2){return _0x47630f['sendStatus'](_0x9367c6);}return _0x47630f[_0x7bb6('0x1c')](_0x9367c6)[_0x7bb6('0x1d')]();};}function respondWithResult(_0x4d093f,_0x3240d9){_0x3240d9=_0x3240d9||0xc8;return function(_0x415ad6){if(_0x415ad6){return _0x4d093f[_0x7bb6('0x1c')](_0x3240d9)[_0x7bb6('0x1e')](_0x415ad6);}};}function respondWithFilteredResult(_0x2bd3b4,_0x3d12cb){return function(_0x496485){if(_0x496485){var _0x377e28=_0x496485[_0x7bb6('0x1f')],_0xda67bf=_0x3d12cb[_0x7bb6('0x20')],_0x23d047=_0x3d12cb['offset']+_0x3d12cb[_0x7bb6('0x21')],_0x4095a1;if(_0x23d047>=_0x377e28){_0x23d047=_0x377e28;_0x4095a1=0xc8;}else{_0x4095a1=0xce;}_0x2bd3b4[_0x7bb6('0x1c')](_0x4095a1);return _0x2bd3b4[_0x7bb6('0x22')](_0x7bb6('0x23'),_0xda67bf+'-'+_0x23d047+'/'+_0x377e28)[_0x7bb6('0x1e')](_0x496485);}return null;};}function patchUpdates(_0x5f0d75){return function(_0x54a381){try{jsonpatch['apply'](_0x54a381,_0x5f0d75,!![]);}catch(_0x15eafb){return BPromise[_0x7bb6('0x24')](_0x15eafb);}return _0x54a381[_0x7bb6('0x25')]();};}function saveUpdates(_0x30eb86,_0x224342){return function(_0x28d73e){if(_0x28d73e){return _0x28d73e['update'](_0x30eb86)[_0x7bb6('0x26')](function(_0x18b03d){return _0x18b03d;});}return null;};}function removeEntity(_0x53601c,_0x5c1a55){return function(_0x4df0de){if(_0x4df0de){return _0x4df0de[_0x7bb6('0x27')]()[_0x7bb6('0x26')](function(){_0x53601c[_0x7bb6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a569,_0x2b989f){return function(_0x36c2dd){if(!_0x36c2dd){_0x38a569[_0x7bb6('0x28')](0x194);}return _0x36c2dd;};}function handleError(_0x199e95,_0x25473c){_0x25473c=_0x25473c||0x1f4;return function(_0x5a6a8c){logger[_0x7bb6('0x29')](_0x5a6a8c['stack']);if(_0x5a6a8c[_0x7bb6('0x2a')]){delete _0x5a6a8c[_0x7bb6('0x2a')];}_0x199e95['status'](_0x25473c)[_0x7bb6('0x2b')](_0x5a6a8c);};}exports[_0x7bb6('0x2c')]=function(_0x3896ba,_0x4a01d7){var _0xa7426f={},_0x502c46={},_0x5e0ae1={'count':0x0,'rows':[]};var _0x8ac935=_[_0x7bb6('0x2d')](db[_0x7bb6('0x2e')][_0x7bb6('0x2f')],function(_0x2b19f8){return{'name':_0x2b19f8[_0x7bb6('0x30')],'type':_0x2b19f8['type'][_0x7bb6('0x31')]};});_0x502c46['model']=_[_0x7bb6('0x2d')](_0x8ac935,_0x7bb6('0x2a'));_0x502c46[_0x7bb6('0x32')]=_['keys'](_0x3896ba[_0x7bb6('0x32')]);_0x502c46[_0x7bb6('0x33')]=_[_0x7bb6('0x34')](_0x502c46[_0x7bb6('0x35')],_0x502c46['query']);_0xa7426f[_0x7bb6('0x36')]=_[_0x7bb6('0x34')](_0x502c46[_0x7bb6('0x35')],qs[_0x7bb6('0x37')](_0x3896ba[_0x7bb6('0x32')]['fields']));_0xa7426f[_0x7bb6('0x36')]=_0xa7426f[_0x7bb6('0x36')][_0x7bb6('0x38')]?_0xa7426f['attributes']:_0x502c46[_0x7bb6('0x35')];if(!_0x3896ba['query'][_0x7bb6('0x39')]('nolimit')){_0xa7426f[_0x7bb6('0x21')]=qs[_0x7bb6('0x21')](_0x3896ba[_0x7bb6('0x32')][_0x7bb6('0x21')]);_0xa7426f['offset']=qs['offset'](_0x3896ba[_0x7bb6('0x32')]['offset']);}_0xa7426f[_0x7bb6('0x3a')]=qs[_0x7bb6('0x3b')](_0x3896ba[_0x7bb6('0x32')][_0x7bb6('0x3b')]);_0xa7426f[_0x7bb6('0x3c')]=qs[_0x7bb6('0x33')](_[_0x7bb6('0x3d')](_0x3896ba[_0x7bb6('0x32')],_0x502c46[_0x7bb6('0x33')]),_0x8ac935);if(_0x3896ba[_0x7bb6('0x32')]['filter']){_0xa7426f[_0x7bb6('0x3c')]=_[_0x7bb6('0x3e')](_0xa7426f[_0x7bb6('0x3c')],{'$or':_[_0x7bb6('0x2d')](_0x8ac935,function(_0x38f075){if(_0x38f075[_0x7bb6('0x3f')]!==_0x7bb6('0x40')){var _0x8c6aeb={};_0x8c6aeb[_0x38f075[_0x7bb6('0x2a')]]={'$like':'%'+_0x3896ba[_0x7bb6('0x32')][_0x7bb6('0x41')]+'%'};return _0x8c6aeb;}})});}_0xa7426f=_['merge']({},_0xa7426f,_0x3896ba[_0x7bb6('0x42')]);var _0x76e005={'where':_0xa7426f['where']};return db['VoiceCallReport'][_0x7bb6('0x1f')](_0x76e005)[_0x7bb6('0x26')](function(_0x2dae3f){_0x5e0ae1[_0x7bb6('0x1f')]=_0x2dae3f;if(_0x3896ba['query'][_0x7bb6('0x43')]){_0xa7426f[_0x7bb6('0x44')]=[{'attributes':['id',_0x7bb6('0x2a'),_0x7bb6('0x45'),_0x7bb6('0x46')],'model':db['User'],'as':'User'}];}return db[_0x7bb6('0x2e')]['findAll'](_0xa7426f);})[_0x7bb6('0x26')](function(_0x5a69c3){_0x5e0ae1['rows']=_0x5a69c3;return _0x5e0ae1;})[_0x7bb6('0x26')](respondWithFilteredResult(_0x4a01d7,_0xa7426f))['catch'](handleError(_0x4a01d7,null));};exports['show']=function(_0x42fac2,_0x16a363){var _0x4b42b3={'raw':!![],'where':{'id':_0x42fac2['params']['id']}},_0x3b0526={};_0x3b0526[_0x7bb6('0x35')]=_[_0x7bb6('0x47')](db[_0x7bb6('0x2e')][_0x7bb6('0x2f')]);_0x3b0526[_0x7bb6('0x32')]=_['keys'](_0x42fac2[_0x7bb6('0x32')]);_0x3b0526[_0x7bb6('0x48')]=_[_0x7bb6('0x34')](_0x3b0526[_0x7bb6('0x35')],_0x3b0526['query']);_0x4b42b3[_0x7bb6('0x36')]=_[_0x7bb6('0x34')](_0x3b0526[_0x7bb6('0x35')],qs['fields'](_0x42fac2[_0x7bb6('0x32')][_0x7bb6('0x37')]));_0x4b42b3[_0x7bb6('0x36')]=_0x4b42b3['attributes'][_0x7bb6('0x38')]?_0x4b42b3[_0x7bb6('0x36')]:_0x3b0526[_0x7bb6('0x35')];if(_0x42fac2[_0x7bb6('0x32')][_0x7bb6('0x43')]){_0x4b42b3[_0x7bb6('0x44')]=[{'all':!![]}];}_0x4b42b3=_['merge']({},_0x4b42b3,_0x42fac2['options']);return db['VoiceCallReport']['find'](_0x4b42b3)[_0x7bb6('0x26')](handleEntityNotFound(_0x16a363,null))[_0x7bb6('0x26')](respondWithResult(_0x16a363,null))[_0x7bb6('0x49')](handleError(_0x16a363,null));};exports['create']=function(_0x40fe49,_0x525bda){return db[_0x7bb6('0x2e')]['create'](_0x40fe49[_0x7bb6('0x4a')],{})['then'](respondWithResult(_0x525bda,0xc9))[_0x7bb6('0x49')](handleError(_0x525bda,null));};exports[_0x7bb6('0x27')]=function(_0x4398b9,_0x45feb4){return db['VoiceCallReport'][_0x7bb6('0x4b')]({'where':{'id':_0x4398b9['params']['id']}})['then'](handleEntityNotFound(_0x45feb4,null))[_0x7bb6('0x26')](removeEntity(_0x45feb4,null))[_0x7bb6('0x49')](handleError(_0x45feb4,null));};exports[_0x7bb6('0x4c')]=function(_0xb6ad64,_0x403241){return db['VoiceCallReport'][_0x7bb6('0x4c')]()[_0x7bb6('0x26')](respondWithResult(_0x403241,null))['catch'](handleError(_0x403241,null));};exports[_0x7bb6('0x4d')]=function(_0x1475db,_0x4bb9da){if(_0x1475db[_0x7bb6('0x4a')]['uniqueid']){delete _0x1475db[_0x7bb6('0x4a')][_0x7bb6('0x4e')];}return db[_0x7bb6('0x2e')][_0x7bb6('0x4b')]({'where':{'uniqueid':_0x1475db[_0x7bb6('0x4f')]['id'],'UserId':{'$or':[null,_0x1475db[_0x7bb6('0x50')]['id']]}}})[_0x7bb6('0x26')](handleEntityNotFound(_0x4bb9da,null))[_0x7bb6('0x26')](saveUpdates(_0x1475db[_0x7bb6('0x4a')],null))['then'](respondWithResult(_0x4bb9da,null))[_0x7bb6('0x49')](handleError(_0x4bb9da,null));}; \ No newline at end of file +var _0x1d7e=['name','send','index','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','filtears','find','create','body','destroy','describe','update','uniqueid','user','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','stack'];(function(_0x5edd1f,_0x391228){var _0x50787c=function(_0x3af074){while(--_0x3af074){_0x5edd1f['push'](_0x5edd1f['shift']());}};_0x50787c(++_0x391228);}(_0x1d7e,0x7d));var _0xe1d7=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1d7e[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe1d7('0x0'));var rimraf=require(_0xe1d7('0x1'));var zipdir=require(_0xe1d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1d7('0x3'));var moment=require('moment');var BPromise=require(_0xe1d7('0x4'));var Mustache=require(_0xe1d7('0x5'));var util=require(_0xe1d7('0x6'));var path=require(_0xe1d7('0x7'));var sox=require(_0xe1d7('0x8'));var csv=require(_0xe1d7('0x9'));var ejs=require(_0xe1d7('0xa'));var fs=require('fs');var _=require(_0xe1d7('0xb'));var squel=require(_0xe1d7('0xc'));var crypto=require(_0xe1d7('0xd'));var jsforce=require(_0xe1d7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1d7('0x9'));var querystring=require(_0xe1d7('0xf'));var Papa=require('papaparse');var Redis=require(_0xe1d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe1d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe1d7('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe1d7('0x13'));var config=require(_0xe1d7('0x14'));var licenseUtil=require(_0xe1d7('0x15'));var db=require(_0xe1d7('0x16'))['db'];function respondWithStatusCode(_0x207502,_0x455a7a){_0x455a7a=_0x455a7a||0xcc;return function(_0x445994){if(_0x445994){return _0x207502[_0xe1d7('0x17')](_0x455a7a);}return _0x207502['status'](_0x455a7a)[_0xe1d7('0x18')]();};}function respondWithResult(_0x247286,_0x156a3f){_0x156a3f=_0x156a3f||0xc8;return function(_0x3d3d8d){if(_0x3d3d8d){return _0x247286[_0xe1d7('0x19')](_0x156a3f)[_0xe1d7('0x1a')](_0x3d3d8d);}};}function respondWithFilteredResult(_0x3c1923,_0x565278){return function(_0x391f55){if(_0x391f55){var _0x328898=_0x391f55[_0xe1d7('0x1b')],_0x419cf3=_0x565278[_0xe1d7('0x1c')],_0x56e1c6=_0x565278[_0xe1d7('0x1c')]+_0x565278[_0xe1d7('0x1d')],_0x41cd11;if(_0x56e1c6>=_0x328898){_0x56e1c6=_0x328898;_0x41cd11=0xc8;}else{_0x41cd11=0xce;}_0x3c1923[_0xe1d7('0x19')](_0x41cd11);return _0x3c1923[_0xe1d7('0x1e')](_0xe1d7('0x1f'),_0x419cf3+'-'+_0x56e1c6+'/'+_0x328898)[_0xe1d7('0x1a')](_0x391f55);}return null;};}function patchUpdates(_0x3b0308){return function(_0x2035e7){try{jsonpatch[_0xe1d7('0x20')](_0x2035e7,_0x3b0308,!![]);}catch(_0x4d8c7d){return BPromise[_0xe1d7('0x21')](_0x4d8c7d);}return _0x2035e7[_0xe1d7('0x22')]();};}function saveUpdates(_0x1e9a1e,_0x3e25e8){return function(_0x2737b9){if(_0x2737b9){return _0x2737b9['update'](_0x1e9a1e)[_0xe1d7('0x23')](function(_0x2c9571){return _0x2c9571;});}return null;};}function removeEntity(_0x111e52,_0x13867a){return function(_0x33ac20){if(_0x33ac20){return _0x33ac20['destroy']()[_0xe1d7('0x23')](function(){_0x111e52[_0xe1d7('0x19')](0xcc)[_0xe1d7('0x18')]();});}};}function handleEntityNotFound(_0x3bc5c1,_0x25e3c9){return function(_0x38fc1b){if(!_0x38fc1b){_0x3bc5c1[_0xe1d7('0x17')](0x194);}return _0x38fc1b;};}function handleError(_0x3b3771,_0x1fed8c){_0x1fed8c=_0x1fed8c||0x1f4;return function(_0x2e47f7){logger['error'](_0x2e47f7[_0xe1d7('0x24')]);if(_0x2e47f7[_0xe1d7('0x25')]){delete _0x2e47f7[_0xe1d7('0x25')];}_0x3b3771['status'](_0x1fed8c)[_0xe1d7('0x26')](_0x2e47f7);};}exports[_0xe1d7('0x27')]=function(_0x19c671,_0x303523){var _0x471c82={},_0x42e74d={},_0x95f28c={'count':0x0,'rows':[]};var _0x55f7dd=_[_0xe1d7('0x28')](db['VoiceCallReport'][_0xe1d7('0x29')],function(_0x264481){return{'name':_0x264481['fieldName'],'type':_0x264481['type'][_0xe1d7('0x2a')]};});_0x42e74d[_0xe1d7('0x2b')]=_[_0xe1d7('0x28')](_0x55f7dd,_0xe1d7('0x25'));_0x42e74d[_0xe1d7('0x2c')]=_['keys'](_0x19c671[_0xe1d7('0x2c')]);_0x42e74d[_0xe1d7('0x2d')]=_[_0xe1d7('0x2e')](_0x42e74d[_0xe1d7('0x2b')],_0x42e74d[_0xe1d7('0x2c')]);_0x471c82['attributes']=_[_0xe1d7('0x2e')](_0x42e74d[_0xe1d7('0x2b')],qs[_0xe1d7('0x2f')](_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x2f')]));_0x471c82[_0xe1d7('0x30')]=_0x471c82[_0xe1d7('0x30')][_0xe1d7('0x31')]?_0x471c82['attributes']:_0x42e74d[_0xe1d7('0x2b')];if(!_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x32')]('nolimit')){_0x471c82[_0xe1d7('0x1d')]=qs[_0xe1d7('0x1d')](_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x1d')]);_0x471c82[_0xe1d7('0x1c')]=qs[_0xe1d7('0x1c')](_0x19c671['query'][_0xe1d7('0x1c')]);}_0x471c82[_0xe1d7('0x33')]=qs[_0xe1d7('0x34')](_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x34')]);_0x471c82[_0xe1d7('0x35')]=qs['filters'](_[_0xe1d7('0x36')](_0x19c671[_0xe1d7('0x2c')],_0x42e74d[_0xe1d7('0x2d')]),_0x55f7dd);if(_0x19c671['query'][_0xe1d7('0x37')]){_0x471c82[_0xe1d7('0x35')]=_[_0xe1d7('0x38')](_0x471c82['where'],{'$or':_[_0xe1d7('0x28')](_0x55f7dd,function(_0x594f4a){if(_0x594f4a[_0xe1d7('0x39')]!==_0xe1d7('0x3a')){var _0x4cd830={};_0x4cd830[_0x594f4a[_0xe1d7('0x25')]]={'$like':'%'+_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x37')]+'%'};return _0x4cd830;}})});}_0x471c82=_['merge']({},_0x471c82,_0x19c671[_0xe1d7('0x3b')]);var _0xcf5b78={'where':_0x471c82['where']};return db[_0xe1d7('0x3c')]['count'](_0xcf5b78)[_0xe1d7('0x23')](function(_0x4def25){_0x95f28c[_0xe1d7('0x1b')]=_0x4def25;if(_0x19c671[_0xe1d7('0x2c')][_0xe1d7('0x3d')]){_0x471c82[_0xe1d7('0x3e')]=[{'attributes':['id',_0xe1d7('0x25'),_0xe1d7('0x3f'),_0xe1d7('0x40')],'model':db[_0xe1d7('0x41')],'as':_0xe1d7('0x41')}];}return db['VoiceCallReport'][_0xe1d7('0x42')](_0x471c82);})['then'](function(_0x2db3e4){_0x95f28c[_0xe1d7('0x43')]=_0x2db3e4;return _0x95f28c;})[_0xe1d7('0x23')](respondWithFilteredResult(_0x303523,_0x471c82))[_0xe1d7('0x44')](handleError(_0x303523,null));};exports[_0xe1d7('0x45')]=function(_0x41c86b,_0x12eeb1){var _0x5c9bb3={'raw':!![],'where':{'id':_0x41c86b[_0xe1d7('0x46')]['id']}},_0x26d1b0={};_0x26d1b0[_0xe1d7('0x2b')]=_[_0xe1d7('0x47')](db[_0xe1d7('0x3c')][_0xe1d7('0x29')]);_0x26d1b0['query']=_[_0xe1d7('0x47')](_0x41c86b[_0xe1d7('0x2c')]);_0x26d1b0[_0xe1d7('0x48')]=_['intersection'](_0x26d1b0[_0xe1d7('0x2b')],_0x26d1b0[_0xe1d7('0x2c')]);_0x5c9bb3[_0xe1d7('0x30')]=_[_0xe1d7('0x2e')](_0x26d1b0[_0xe1d7('0x2b')],qs['fields'](_0x41c86b[_0xe1d7('0x2c')][_0xe1d7('0x2f')]));_0x5c9bb3[_0xe1d7('0x30')]=_0x5c9bb3[_0xe1d7('0x30')][_0xe1d7('0x31')]?_0x5c9bb3[_0xe1d7('0x30')]:_0x26d1b0[_0xe1d7('0x2b')];if(_0x41c86b[_0xe1d7('0x2c')][_0xe1d7('0x3d')]){_0x5c9bb3[_0xe1d7('0x3e')]=[{'all':!![]}];}_0x5c9bb3=_['merge']({},_0x5c9bb3,_0x41c86b[_0xe1d7('0x3b')]);return db[_0xe1d7('0x3c')][_0xe1d7('0x49')](_0x5c9bb3)['then'](handleEntityNotFound(_0x12eeb1,null))['then'](respondWithResult(_0x12eeb1,null))[_0xe1d7('0x44')](handleError(_0x12eeb1,null));};exports[_0xe1d7('0x4a')]=function(_0x2d88da,_0x3310fe){return db[_0xe1d7('0x3c')]['create'](_0x2d88da[_0xe1d7('0x4b')],{})['then'](respondWithResult(_0x3310fe,0xc9))[_0xe1d7('0x44')](handleError(_0x3310fe,null));};exports[_0xe1d7('0x4c')]=function(_0x38c40c,_0x32e4a3){return db[_0xe1d7('0x3c')]['find']({'where':{'id':_0x38c40c[_0xe1d7('0x46')]['id']}})[_0xe1d7('0x23')](handleEntityNotFound(_0x32e4a3,null))[_0xe1d7('0x23')](removeEntity(_0x32e4a3,null))['catch'](handleError(_0x32e4a3,null));};exports[_0xe1d7('0x4d')]=function(_0x2a46e4,_0x2a7a76){return db['VoiceCallReport'][_0xe1d7('0x4d')]()['then'](respondWithResult(_0x2a7a76,null))[_0xe1d7('0x44')](handleError(_0x2a7a76,null));};exports[_0xe1d7('0x4e')]=function(_0x43b462,_0x480e29){if(_0x43b462['body'][_0xe1d7('0x4f')]){delete _0x43b462[_0xe1d7('0x4b')][_0xe1d7('0x4f')];}return db[_0xe1d7('0x3c')]['find']({'where':{'uniqueid':_0x43b462[_0xe1d7('0x46')]['id'],'UserId':{'$or':[null,_0x43b462[_0xe1d7('0x50')]['id']]}}})[_0xe1d7('0x23')](handleEntityNotFound(_0x480e29,null))[_0xe1d7('0x23')](saveUpdates(_0x43b462['body'],null))[_0xe1d7('0x23')](respondWithResult(_0x480e29,null))[_0xe1d7('0x44')](handleError(_0x480e29,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1bff6d2..06e8758 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 _0xe2a5=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','VoiceCallReport','report_call','uniqueid'];(function(_0xc333a2,_0x5d7fd7){var _0x430962=function(_0x1a474e){while(--_0x1a474e){_0xc333a2['push'](_0xc333a2['shift']());}};_0x430962(++_0x5d7fd7);}(_0xe2a5,0x1ad));var _0x5e2a=function(_0x3067e9,_0x59291c){_0x3067e9=_0x3067e9-0x0;var _0x47c222=_0xe2a5[_0x3067e9];return _0x47c222;};'use strict';var _=require(_0x5e2a('0x0'));var util=require(_0x5e2a('0x1'));var logger=require('../../config/logger')(_0x5e2a('0x2'));var moment=require(_0x5e2a('0x3'));var BPromise=require(_0x5e2a('0x4'));var rp=require(_0x5e2a('0x5'));var fs=require('fs');var path=require(_0x5e2a('0x6'));var rimraf=require(_0x5e2a('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1c577c,_0x23a5a1){return _0x1c577c['define'](_0x5e2a('0x8'),attributes,{'tableName':_0x5e2a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x5e2a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca14=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47c53e,_0x35f7f3){var _0x306afd=function(_0x599636){while(--_0x599636){_0x47c53e['push'](_0x47c53e['shift']());}};_0x306afd(++_0x35f7f3);}(_0xca14,0x152));var _0x4ca1=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0xca14[_0x1a3e23];return _0x5ee0d8;};'use strict';var _=require(_0x4ca1('0x0'));var util=require('util');var logger=require(_0x4ca1('0x1'))(_0x4ca1('0x2'));var moment=require(_0x4ca1('0x3'));var BPromise=require(_0x4ca1('0x4'));var rp=require(_0x4ca1('0x5'));var fs=require('fs');var path=require(_0x4ca1('0x6'));var rimraf=require(_0x4ca1('0x7'));var config=require(_0x4ca1('0x8'));var attributes=require(_0x4ca1('0x9'));module[_0x4ca1('0xa')]=function(_0x1ff8e4,_0xdb01e){return _0x1ff8e4[_0x4ca1('0xb')](_0x4ca1('0xc'),attributes,{'tableName':_0x4ca1('0xd'),'paranoid':![],'indexes':[{'fields':[_0x4ca1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 4625294..c080c9c 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 _0x0dc3=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','VoiceCallReport','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment'];(function(_0x1a051e,_0x22e622){var _0x7defd2=function(_0x53336d){while(--_0x53336d){_0x1a051e['push'](_0x1a051e['shift']());}};_0x7defd2(++_0x22e622);}(_0x0dc3,0x17a));var _0x30dc=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x0dc3[_0x2181b1];return _0x530548;};'use strict';var _=require(_0x30dc('0x0'));var util=require('util');var moment=require(_0x30dc('0x1'));var BPromise=require(_0x30dc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30dc('0x3'));var db=require(_0x30dc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30dc('0x5'))('rpc');var config=require(_0x30dc('0x6'));var jayson=require(_0x30dc('0x7'));var client=jayson[_0x30dc('0x8')][_0x30dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17f42f,_0x3925fc,_0x76770e){return new BPromise(function(_0x2bd730,_0x54a75d){return client[_0x30dc('0xa')](_0x17f42f,_0x76770e)[_0x30dc('0xb')](function(_0x5aa23e){logger[_0x30dc('0xc')](_0x30dc('0xd'),_0x3925fc,'request\x20sent');logger[_0x30dc('0xe')](_0x30dc('0xf'),_0x3925fc,'request\x20sent',JSON[_0x30dc('0x10')](_0x5aa23e));if(_0x5aa23e[_0x30dc('0x11')]){if(_0x5aa23e[_0x30dc('0x11')][_0x30dc('0x12')]===0x1f4){logger[_0x30dc('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x3925fc,_0x5aa23e[_0x30dc('0x11')]['message']);return _0x54a75d(_0x5aa23e[_0x30dc('0x11')][_0x30dc('0x13')]);}logger['error'](_0x30dc('0xd'),_0x3925fc,_0x5aa23e[_0x30dc('0x11')][_0x30dc('0x13')]);return _0x2bd730(_0x5aa23e[_0x30dc('0x11')][_0x30dc('0x13')]);}else{logger['info'](_0x30dc('0xd'),_0x3925fc,_0x30dc('0x14'));_0x2bd730(_0x5aa23e[_0x30dc('0x15')][_0x30dc('0x13')]);}})[_0x30dc('0x16')](function(_0x4a0186){logger['error'](_0x30dc('0xd'),_0x3925fc,_0x4a0186);_0x54a75d(_0x4a0186);});});}exports[_0x30dc('0x17')]=function(_0x2f5fb8){var _0x126198=this;return new Promise(function(_0x53b1f5,_0x54dcfb){return db['VoiceCallReport'][_0x30dc('0x18')]({'raw':_0x2f5fb8[_0x30dc('0x19')]?_0x2f5fb8[_0x30dc('0x19')][_0x30dc('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f5fb8[_0x30dc('0x19')]?_0x2f5fb8[_0x30dc('0x19')][_0x30dc('0x1b')]||null:null,'attributes':_0x2f5fb8['options']?_0x2f5fb8[_0x30dc('0x19')][_0x30dc('0x1c')]||null:null,'limit':_0x2f5fb8[_0x30dc('0x19')]?_0x2f5fb8[_0x30dc('0x19')][_0x30dc('0x1d')]||null:null,'include':_0x2f5fb8['options']?_0x2f5fb8[_0x30dc('0x19')][_0x30dc('0x1e')]?_[_0x30dc('0x1f')](_0x2f5fb8[_0x30dc('0x19')]['include'],function(_0x33df89){return{'model':db[_0x33df89['model']],'as':_0x33df89['as'],'attributes':_0x33df89[_0x30dc('0x1c')],'include':_0x33df89[_0x30dc('0x1e')]?_[_0x30dc('0x1f')](_0x33df89[_0x30dc('0x1e')],function(_0x4d3db8){return{'model':db[_0x4d3db8[_0x30dc('0x20')]],'as':_0x4d3db8['as'],'attributes':_0x4d3db8[_0x30dc('0x1c')],'include':_0x4d3db8[_0x30dc('0x1e')]?_[_0x30dc('0x1f')](_0x4d3db8['include'],function(_0x1a087c){return{'model':db[_0x1a087c['model']],'as':_0x1a087c['as'],'attributes':_0x1a087c[_0x30dc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x30dc('0xb')](function(_0xe97064){logger[_0x30dc('0xc')](_0x30dc('0x17'),_0x2f5fb8);logger[_0x30dc('0xe')](_0x30dc('0x17'),_0x2f5fb8,JSON[_0x30dc('0x10')](_0xe97064));_0x53b1f5(_0xe97064);})[_0x30dc('0x16')](function(_0x4c2d6c){logger[_0x30dc('0x11')](_0x30dc('0x17'),_0x4c2d6c['message'],_0x2f5fb8);_0x54dcfb(_0x126198[_0x30dc('0x11')](0x1f4,_0x4c2d6c['message']));});});};exports['CreateVoiceCallReport']=function(_0x2e1be4){var _0x4eac9e=this;return new Promise(function(_0x4bb9c7,_0xded6f9){return db[_0x30dc('0x21')]['create'](_0x2e1be4[_0x30dc('0x22')],{'raw':_0x2e1be4[_0x30dc('0x19')]?_0x2e1be4['options'][_0x30dc('0x1a')]===undefined?!![]:![]:!![]})[_0x30dc('0xb')](function(_0x567901){logger['info'](_0x30dc('0x23'),_0x2e1be4);logger[_0x30dc('0xe')]('CreateVoiceCallReport',_0x2e1be4,JSON['stringify'](_0x567901));_0x4bb9c7(_0x567901);})['catch'](function(_0x4179e1){logger[_0x30dc('0x11')](_0x30dc('0x23'),_0x4179e1[_0x30dc('0x13')],_0x2e1be4);_0xded6f9(_0x4eac9e[_0x30dc('0x11')](0x1f4,_0x4179e1[_0x30dc('0x13')]));});});};exports[_0x30dc('0x24')]=function(_0x14c666){var _0x34cff9=this;return new Promise(function(_0x245bfb,_0x52454e){return db[_0x30dc('0x21')][_0x30dc('0x25')](_0x14c666['body'],{'raw':_0x14c666[_0x30dc('0x19')]?_0x14c666[_0x30dc('0x19')][_0x30dc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14c666[_0x30dc('0x19')]?_0x14c666[_0x30dc('0x19')][_0x30dc('0x1b')]||null:null,'attributes':_0x14c666[_0x30dc('0x19')]?_0x14c666[_0x30dc('0x19')][_0x30dc('0x1c')]||null:null,'limit':_0x14c666[_0x30dc('0x19')]?_0x14c666[_0x30dc('0x19')]['limit']||null:null})[_0x30dc('0xb')](function(_0x231bfa){logger[_0x30dc('0xc')](_0x30dc('0x24'),_0x14c666);logger[_0x30dc('0xe')](_0x30dc('0x24'),_0x14c666,JSON[_0x30dc('0x10')](_0x231bfa));_0x245bfb(_0x231bfa);})['catch'](function(_0x296c98){logger[_0x30dc('0x11')](_0x30dc('0x24'),_0x296c98[_0x30dc('0x13')],_0x14c666);_0x52454e(_0x34cff9['error'](0x1f4,_0x296c98[_0x30dc('0x13')]));});});}; \ No newline at end of file +var _0x3e83=['error','code','message','result','catch','GetVoiceCallReport','options','raw','limit','map','include','model','attributes','then','CreateVoiceCallReport','create','body','VoiceCallReport','update','where','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1af72d,_0x535d49){var _0x3bcfcf=function(_0x580acb){while(--_0x580acb){_0x1af72d['push'](_0x1af72d['shift']());}};_0x3bcfcf(++_0x535d49);}(_0x3e83,0x1b7));var _0x33e8=function(_0x365795,_0x1f20af){_0x365795=_0x365795-0x0;var _0x2b8407=_0x3e83[_0x365795];return _0x2b8407;};'use strict';var _=require(_0x33e8('0x0'));var util=require(_0x33e8('0x1'));var moment=require(_0x33e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x33e8('0x3'));var fs=require('fs');var Redis=require(_0x33e8('0x4'));var db=require(_0x33e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33e8('0x6'))(_0x33e8('0x7'));var config=require(_0x33e8('0x8'));var jayson=require(_0x33e8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0d58,_0xf06a30,_0x3863be){return new BPromise(function(_0x43723b,_0x4857a9){return client[_0x33e8('0xa')](_0x4f0d58,_0x3863be)['then'](function(_0x42e739){logger[_0x33e8('0xb')](_0x33e8('0xc'),_0xf06a30,_0x33e8('0xd'));logger[_0x33e8('0xe')](_0x33e8('0xf'),_0xf06a30,_0x33e8('0xd'),JSON[_0x33e8('0x10')](_0x42e739));if(_0x42e739[_0x33e8('0x11')]){if(_0x42e739['error'][_0x33e8('0x12')]===0x1f4){logger[_0x33e8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xf06a30,_0x42e739['error'][_0x33e8('0x13')]);return _0x4857a9(_0x42e739[_0x33e8('0x11')][_0x33e8('0x13')]);}logger[_0x33e8('0x11')](_0x33e8('0xc'),_0xf06a30,_0x42e739[_0x33e8('0x11')][_0x33e8('0x13')]);return _0x43723b(_0x42e739['error']['message']);}else{logger[_0x33e8('0xb')](_0x33e8('0xc'),_0xf06a30,_0x33e8('0xd'));_0x43723b(_0x42e739[_0x33e8('0x14')][_0x33e8('0x13')]);}})[_0x33e8('0x15')](function(_0x4d6372){logger[_0x33e8('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0xf06a30,_0x4d6372);_0x4857a9(_0x4d6372);});});}exports[_0x33e8('0x16')]=function(_0x249366){var _0x3fb0a7=this;return new Promise(function(_0x231f0e,_0x4976e3){return db['VoiceCallReport']['findAll']({'raw':_0x249366[_0x33e8('0x17')]?_0x249366['options'][_0x33e8('0x18')]===undefined?!![]:![]:!![],'where':_0x249366[_0x33e8('0x17')]?_0x249366[_0x33e8('0x17')]['where']||null:null,'attributes':_0x249366[_0x33e8('0x17')]?_0x249366['options']['attributes']||null:null,'limit':_0x249366[_0x33e8('0x17')]?_0x249366[_0x33e8('0x17')][_0x33e8('0x19')]||null:null,'include':_0x249366[_0x33e8('0x17')]?_0x249366['options']['include']?_[_0x33e8('0x1a')](_0x249366['options'][_0x33e8('0x1b')],function(_0xd81ccf){return{'model':db[_0xd81ccf[_0x33e8('0x1c')]],'as':_0xd81ccf['as'],'attributes':_0xd81ccf[_0x33e8('0x1d')],'include':_0xd81ccf[_0x33e8('0x1b')]?_['map'](_0xd81ccf[_0x33e8('0x1b')],function(_0x4d580c){return{'model':db[_0x4d580c[_0x33e8('0x1c')]],'as':_0x4d580c['as'],'attributes':_0x4d580c[_0x33e8('0x1d')],'include':_0x4d580c[_0x33e8('0x1b')]?_[_0x33e8('0x1a')](_0x4d580c[_0x33e8('0x1b')],function(_0x2c6878){return{'model':db[_0x2c6878[_0x33e8('0x1c')]],'as':_0x2c6878['as'],'attributes':_0x2c6878[_0x33e8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x33e8('0x1e')](function(_0xd8ceae){logger[_0x33e8('0xb')]('GetVoiceCallReport',_0x249366);logger[_0x33e8('0xe')](_0x33e8('0x16'),_0x249366,JSON[_0x33e8('0x10')](_0xd8ceae));_0x231f0e(_0xd8ceae);})[_0x33e8('0x15')](function(_0x47b0bd){logger['error'](_0x33e8('0x16'),_0x47b0bd[_0x33e8('0x13')],_0x249366);_0x4976e3(_0x3fb0a7[_0x33e8('0x11')](0x1f4,_0x47b0bd['message']));});});};exports[_0x33e8('0x1f')]=function(_0x378f9b){var _0x3a6307=this;return new Promise(function(_0x21686e,_0x26837b){return db['VoiceCallReport'][_0x33e8('0x20')](_0x378f9b[_0x33e8('0x21')],{'raw':_0x378f9b[_0x33e8('0x17')]?_0x378f9b[_0x33e8('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x135289){logger[_0x33e8('0xb')](_0x33e8('0x1f'),_0x378f9b);logger['debug'](_0x33e8('0x1f'),_0x378f9b,JSON['stringify'](_0x135289));_0x21686e(_0x135289);})[_0x33e8('0x15')](function(_0x36ccf8){logger['error'](_0x33e8('0x1f'),_0x36ccf8[_0x33e8('0x13')],_0x378f9b);_0x26837b(_0x3a6307[_0x33e8('0x11')](0x1f4,_0x36ccf8['message']));});});};exports['UpdateVoiceCallReport']=function(_0x3e2c3a){var _0x200af8=this;return new Promise(function(_0x4163a7,_0x56ea3c){return db[_0x33e8('0x22')][_0x33e8('0x23')](_0x3e2c3a[_0x33e8('0x21')],{'raw':_0x3e2c3a[_0x33e8('0x17')]?_0x3e2c3a[_0x33e8('0x17')][_0x33e8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e2c3a[_0x33e8('0x17')]?_0x3e2c3a['options'][_0x33e8('0x24')]||null:null,'attributes':_0x3e2c3a['options']?_0x3e2c3a[_0x33e8('0x17')]['attributes']||null:null,'limit':_0x3e2c3a[_0x33e8('0x17')]?_0x3e2c3a[_0x33e8('0x17')]['limit']||null:null})[_0x33e8('0x1e')](function(_0x226b25){logger[_0x33e8('0xb')](_0x33e8('0x25'),_0x3e2c3a);logger[_0x33e8('0xe')](_0x33e8('0x25'),_0x3e2c3a,JSON[_0x33e8('0x10')](_0x226b25));_0x4163a7(_0x226b25);})[_0x33e8('0x15')](function(_0x5573d6){logger[_0x33e8('0x11')](_0x33e8('0x25'),_0x5573d6[_0x33e8('0x13')],_0x3e2c3a);_0x56ea3c(_0x200af8[_0x33e8('0x11')](0x1f4,_0x5573d6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index cbab6f4..16ba387 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 _0xcd0d=['get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0x3ecbc5,_0x18da4e){var _0xf5544c=function(_0x1b12b2){while(--_0x1b12b2){_0x3ecbc5['push'](_0x3ecbc5['shift']());}};_0xf5544c(++_0x18da4e);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x392dbc,_0x4d31cf){_0x392dbc=_0x392dbc-0x0;var _0x119302=_0xcd0d[_0x392dbc];return _0x119302;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var timeout=require(_0xdcd0('0x3'));var express=require(_0xdcd0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcd0('0x5'));var controller=require('./voiceChanSpy.controller');router[_0xdcd0('0x6')]('/',auth[_0xdcd0('0x7')](),controller[_0xdcd0('0x8')]);router[_0xdcd0('0x6')](_0xdcd0('0x9'),auth[_0xdcd0('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xdcd0('0xa')]);router[_0xdcd0('0xb')](_0xdcd0('0x9'),auth['isAuthenticated'](),controller[_0xdcd0('0xc')]);router[_0xdcd0('0xd')](_0xdcd0('0x9'),auth[_0xdcd0('0x7')](),controller[_0xdcd0('0xe')]);module[_0xdcd0('0xf')]=router; \ No newline at end of file +var _0x5353=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x5353,0x12f));var _0x3535=function(_0x5ab2f1,_0x1ac795){_0x5ab2f1=_0x5ab2f1-0x0;var _0x52f5bc=_0x5353[_0x5ab2f1];return _0x52f5bc;};'use strict';var multer=require(_0x3535('0x0'));var util=require('util');var path=require(_0x3535('0x1'));var timeout=require(_0x3535('0x2'));var express=require(_0x3535('0x3'));var router=express[_0x3535('0x4')]();var auth=require(_0x3535('0x5'));var interaction=require(_0x3535('0x6'));var config=require(_0x3535('0x7'));var controller=require(_0x3535('0x8'));router[_0x3535('0x9')]('/',auth[_0x3535('0xa')](),controller['index']);router[_0x3535('0x9')]('/:id',auth[_0x3535('0xa')](),controller[_0x3535('0xb')]);router[_0x3535('0xc')]('/',auth['isAuthenticated'](),controller[_0x3535('0xd')]);router[_0x3535('0xe')](_0x3535('0xf'),auth[_0x3535('0xa')](),controller[_0x3535('0x10')]);router[_0x3535('0x11')]('/:id',auth[_0x3535('0xa')](),controller[_0x3535('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 4695379..aee1a32 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 _0x0c0b=['BOOLEAN','sequelize','STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x408f01,_0x57d035){var _0x1f7310=function(_0x45db44){while(--_0x45db44){_0x408f01['push'](_0x408f01['shift']());}};_0x1f7310(++_0x57d035);}(_0x0c0b,0x17b));var _0xb0c0=function(_0xef369b,_0x37e307){_0xef369b=_0xef369b-0x0;var _0x31aa4b=_0x0c0b[_0xef369b];return _0x31aa4b;};'use strict';var Sequelize=require(_0xb0c0('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xb0c0('0x1')],'unique':_0xb0c0('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xb0c0('0x1')],'set':function(_0x71b6b1){this[_0xb0c0('0x3')](_0xb0c0('0x4'),_0x71b6b1?_0x71b6b1[_0xb0c0('0x5')](''):[]);},'get':function(){return this[_0xb0c0('0x6')]('options')?this[_0xb0c0('0x6')](_0xb0c0('0x4'))[_0xb0c0('0x7')](''):[];}},'auth':{'type':Sequelize[_0xb0c0('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb0c0('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb0c0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc4a9=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0xc4a9,0x1d8));var _0x9c4a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xc4a9[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x9c4a('0x0'));module[_0x9c4a('0x1')]={'name':{'type':Sequelize[_0x9c4a('0x2')]},'prefix':{'type':Sequelize[_0x9c4a('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x9c4a('0x2')],'set':function(_0x1a28a9){this[_0x9c4a('0x3')](_0x9c4a('0x4'),_0x1a28a9?_0x1a28a9[_0x9c4a('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x9c4a('0x4'))?this[_0x9c4a('0x6')](_0x9c4a('0x4'))[_0x9c4a('0x7')](''):[];}},'auth':{'type':Sequelize[_0x9c4a('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x9c4a('0x2')]},'record':{'type':Sequelize[_0x9c4a('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9c4a('0x2')]},'description':{'type':Sequelize[_0x9c4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 282f363..9d2c08e 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 _0x3d3e=['error','stack','name','send','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceChanSpy','includeAll','findAll','rows','show','params','filtears','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','ChanSpies','UserProfileResource'];(function(_0x39d2ad,_0x53645b){var _0x37d85a=function(_0x8f4d46){while(--_0x8f4d46){_0x39d2ad['push'](_0x39d2ad['shift']());}};_0x37d85a(++_0x53645b);}(_0x3d3e,0xd1));var _0xe3d3=function(_0x56b32c,_0x3f180b){_0x56b32c=_0x56b32c-0x0;var _0x4e7412=_0x3d3e[_0x56b32c];return _0x4e7412;};'use strict';var pdf=require(_0xe3d3('0x0'));var emlformat=require(_0xe3d3('0x1'));var rimraf=require(_0xe3d3('0x2'));var zipdir=require(_0xe3d3('0x3'));var jsonpatch=require(_0xe3d3('0x4'));var rp=require(_0xe3d3('0x5'));var moment=require(_0xe3d3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe3d3('0x7'));var util=require(_0xe3d3('0x8'));var path=require('path');var sox=require(_0xe3d3('0x9'));var csv=require(_0xe3d3('0xa'));var ejs=require(_0xe3d3('0xb'));var fs=require('fs');var _=require(_0xe3d3('0xc'));var squel=require(_0xe3d3('0xd'));var crypto=require(_0xe3d3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe3d3('0xf'));var Papa=require('papaparse');var Redis=require(_0xe3d3('0x10'));var authService=require(_0xe3d3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe3d3('0x12'));var hardwareService=require(_0xe3d3('0x13'));var logger=require('../../config/logger')(_0xe3d3('0x14'));var utils=require(_0xe3d3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe3d3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa6fe32,_0x52118d){_0x52118d=_0x52118d||0xcc;return function(_0x4c8e1e){if(_0x4c8e1e){return _0xa6fe32[_0xe3d3('0x17')](_0x52118d);}return _0xa6fe32['status'](_0x52118d)[_0xe3d3('0x18')]();};}function respondWithResult(_0xc3752f,_0x44b5b0){_0x44b5b0=_0x44b5b0||0xc8;return function(_0x3192bc){if(_0x3192bc){return _0xc3752f['status'](_0x44b5b0)[_0xe3d3('0x19')](_0x3192bc);}};}function respondWithFilteredResult(_0x12503f,_0x659b69){return function(_0x582e16){if(_0x582e16){var _0x30f489=_0x582e16[_0xe3d3('0x1a')],_0x11fc97=_0x659b69[_0xe3d3('0x1b')],_0x55d22e=_0x659b69[_0xe3d3('0x1b')]+_0x659b69[_0xe3d3('0x1c')],_0x3336dc;if(_0x55d22e>=_0x30f489){_0x55d22e=_0x30f489;_0x3336dc=0xc8;}else{_0x3336dc=0xce;}_0x12503f[_0xe3d3('0x1d')](_0x3336dc);return _0x12503f[_0xe3d3('0x1e')](_0xe3d3('0x1f'),_0x11fc97+'-'+_0x55d22e+'/'+_0x30f489)[_0xe3d3('0x19')](_0x582e16);}return null;};}function patchUpdates(_0x3b28e0){return function(_0x93472e){try{jsonpatch[_0xe3d3('0x20')](_0x93472e,_0x3b28e0,!![]);}catch(_0x468f44){return BPromise[_0xe3d3('0x21')](_0x468f44);}return _0x93472e[_0xe3d3('0x22')]();};}function saveUpdates(_0x2d435b,_0x1d025a){return function(_0x5236c4){if(_0x5236c4){return _0x5236c4[_0xe3d3('0x23')](_0x2d435b)[_0xe3d3('0x24')](function(_0x498d5e){return _0x498d5e;});}return null;};}function removeEntity(_0xedb3a7,_0x44facd){return function(_0x18cd86){if(_0x18cd86){return _0x18cd86[_0xe3d3('0x25')]()['then'](function(){var _0x23e122=_0x18cd86['get']({'plain':!![]});var _0x2ab8df=_0xe3d3('0x26');return db[_0xe3d3('0x27')][_0xe3d3('0x25')]({'where':{'type':_0x2ab8df,'resourceId':_0x23e122['id']}})['then'](function(){return _0x18cd86;});})['then'](function(){_0xedb3a7['status'](0xcc)[_0xe3d3('0x18')]();});}};}function handleEntityNotFound(_0x19b78e,_0x16ca13){return function(_0x265098){if(!_0x265098){_0x19b78e[_0xe3d3('0x17')](0x194);}return _0x265098;};}function handleError(_0x1efae4,_0x4261f0){_0x4261f0=_0x4261f0||0x1f4;return function(_0x538f46){logger[_0xe3d3('0x28')](_0x538f46[_0xe3d3('0x29')]);if(_0x538f46[_0xe3d3('0x2a')]){delete _0x538f46[_0xe3d3('0x2a')];}_0x1efae4[_0xe3d3('0x1d')](_0x4261f0)[_0xe3d3('0x2b')](_0x538f46);};}exports['index']=function(_0x390d8a,_0x537fa3){var _0x50807b={},_0x2b0fd3={},_0x210335={'count':0x0,'rows':[]};var _0x10ea88=_['map'](db['VoiceChanSpy'][_0xe3d3('0x2c')],function(_0x376c41){return{'name':_0x376c41['fieldName'],'type':_0x376c41[_0xe3d3('0x2d')]['key']};});_0x2b0fd3['model']=_['map'](_0x10ea88,_0xe3d3('0x2a'));_0x2b0fd3[_0xe3d3('0x2e')]=_[_0xe3d3('0x2f')](_0x390d8a['query']);_0x2b0fd3[_0xe3d3('0x30')]=_[_0xe3d3('0x31')](_0x2b0fd3[_0xe3d3('0x32')],_0x2b0fd3[_0xe3d3('0x2e')]);_0x50807b[_0xe3d3('0x33')]=_[_0xe3d3('0x31')](_0x2b0fd3[_0xe3d3('0x32')],qs[_0xe3d3('0x34')](_0x390d8a['query'][_0xe3d3('0x34')]));_0x50807b[_0xe3d3('0x33')]=_0x50807b[_0xe3d3('0x33')][_0xe3d3('0x35')]?_0x50807b[_0xe3d3('0x33')]:_0x2b0fd3['model'];if(!_0x390d8a[_0xe3d3('0x2e')][_0xe3d3('0x36')](_0xe3d3('0x37'))){_0x50807b[_0xe3d3('0x1c')]=qs[_0xe3d3('0x1c')](_0x390d8a[_0xe3d3('0x2e')]['limit']);_0x50807b[_0xe3d3('0x1b')]=qs[_0xe3d3('0x1b')](_0x390d8a[_0xe3d3('0x2e')][_0xe3d3('0x1b')]);}_0x50807b[_0xe3d3('0x38')]=qs[_0xe3d3('0x39')](_0x390d8a['query'][_0xe3d3('0x39')]);_0x50807b[_0xe3d3('0x3a')]=qs[_0xe3d3('0x30')](_[_0xe3d3('0x3b')](_0x390d8a['query'],_0x2b0fd3[_0xe3d3('0x30')]),_0x10ea88);if(_0x390d8a[_0xe3d3('0x2e')][_0xe3d3('0x3c')]){_0x50807b['where']=_[_0xe3d3('0x3d')](_0x50807b['where'],{'$or':_['map'](_0x10ea88,function(_0x412def){if(_0x412def['type']!=='VIRTUAL'){var _0x404ac0={};_0x404ac0[_0x412def[_0xe3d3('0x2a')]]={'$like':'%'+_0x390d8a[_0xe3d3('0x2e')][_0xe3d3('0x3c')]+'%'};return _0x404ac0;}})});}_0x50807b=_[_0xe3d3('0x3d')]({},_0x50807b,_0x390d8a[_0xe3d3('0x3e')]);var _0x3a9e3a={'where':_0x50807b[_0xe3d3('0x3a')]};return db[_0xe3d3('0x3f')][_0xe3d3('0x1a')](_0x3a9e3a)[_0xe3d3('0x24')](function(_0x5856a8){_0x210335[_0xe3d3('0x1a')]=_0x5856a8;if(_0x390d8a['query'][_0xe3d3('0x40')]){_0x50807b['include']=[{'all':!![]}];}return db[_0xe3d3('0x3f')][_0xe3d3('0x41')](_0x50807b);})['then'](function(_0x1097a0){_0x210335[_0xe3d3('0x42')]=_0x1097a0;return _0x210335;})[_0xe3d3('0x24')](respondWithFilteredResult(_0x537fa3,_0x50807b))['catch'](handleError(_0x537fa3,null));};exports[_0xe3d3('0x43')]=function(_0x4b45f4,_0x25ef8b){var _0x50f27b={'raw':![],'where':{'id':_0x4b45f4[_0xe3d3('0x44')]['id']}},_0x40d039={};_0x40d039['model']=_[_0xe3d3('0x2f')](db[_0xe3d3('0x3f')][_0xe3d3('0x2c')]);_0x40d039[_0xe3d3('0x2e')]=_[_0xe3d3('0x2f')](_0x4b45f4['query']);_0x40d039[_0xe3d3('0x45')]=_[_0xe3d3('0x31')](_0x40d039[_0xe3d3('0x32')],_0x40d039[_0xe3d3('0x2e')]);_0x50f27b[_0xe3d3('0x33')]=_[_0xe3d3('0x31')](_0x40d039['model'],qs[_0xe3d3('0x34')](_0x4b45f4['query'][_0xe3d3('0x34')]));_0x50f27b[_0xe3d3('0x33')]=_0x50f27b[_0xe3d3('0x33')][_0xe3d3('0x35')]?_0x50f27b['attributes']:_0x40d039[_0xe3d3('0x32')];if(_0x4b45f4['query']['includeAll']){_0x50f27b[_0xe3d3('0x46')]=[{'all':!![]}];}_0x50f27b=_[_0xe3d3('0x3d')]({},_0x50f27b,_0x4b45f4[_0xe3d3('0x3e')]);return db['VoiceChanSpy'][_0xe3d3('0x47')](_0x50f27b)['then'](handleEntityNotFound(_0x25ef8b,null))['then'](respondWithResult(_0x25ef8b,null))[_0xe3d3('0x48')](handleError(_0x25ef8b,null));};exports[_0xe3d3('0x49')]=function(_0x79d788,_0x4fc024){return db[_0xe3d3('0x3f')][_0xe3d3('0x49')](_0x79d788[_0xe3d3('0x4a')],{})[_0xe3d3('0x24')](function(_0x3e9154){var _0x496486=_0x79d788['user']['get']({'plain':!![]});if(!_0x496486)throw new Error(_0xe3d3('0x4b'));if(_0x496486[_0xe3d3('0x4c')]===_0xe3d3('0x4d')){var _0x86f859=_0x3e9154[_0xe3d3('0x4e')]({'plain':!![]});var _0xc3da1d=_0xe3d3('0x26');return db[_0xe3d3('0x4f')][_0xe3d3('0x47')]({'where':{'name':_0xc3da1d,'userProfileId':_0x496486[_0xe3d3('0x50')]},'raw':!![]})[_0xe3d3('0x24')](function(_0xfaa820){if(_0xfaa820&&_0xfaa820[_0xe3d3('0x51')]===0x0){return db[_0xe3d3('0x27')]['create']({'name':_0x86f859['name'],'resourceId':_0x86f859['id'],'type':_0xfaa820[_0xe3d3('0x2a')],'sectionId':_0xfaa820['id']},{})[_0xe3d3('0x24')](function(){return _0x3e9154;});}else{return _0x3e9154;}})[_0xe3d3('0x48')](function(_0x571b1e){logger['error'](_0xe3d3('0x52'),_0x571b1e);throw _0x571b1e;});}return _0x3e9154;})[_0xe3d3('0x24')](respondWithResult(_0x4fc024,0xc9))['catch'](handleError(_0x4fc024,null));};exports[_0xe3d3('0x23')]=function(_0x16a0d8,_0x304d71){if(_0x16a0d8[_0xe3d3('0x4a')]['id']){delete _0x16a0d8[_0xe3d3('0x4a')]['id'];}return db[_0xe3d3('0x3f')][_0xe3d3('0x47')]({'where':{'id':_0x16a0d8[_0xe3d3('0x44')]['id']}})[_0xe3d3('0x24')](handleEntityNotFound(_0x304d71,null))['then'](saveUpdates(_0x16a0d8[_0xe3d3('0x4a')],null))[_0xe3d3('0x24')](respondWithResult(_0x304d71,null))[_0xe3d3('0x48')](handleError(_0x304d71,null));};exports[_0xe3d3('0x25')]=function(_0x3884bb,_0x2b5e7d){return db[_0xe3d3('0x3f')][_0xe3d3('0x47')]({'where':{'id':_0x3884bb[_0xe3d3('0x44')]['id']}})[_0xe3d3('0x24')](handleEntityNotFound(_0x2b5e7d,null))['then'](removeEntity(_0x2b5e7d,null))[_0xe3d3('0x48')](handleError(_0x2b5e7d,null));}; \ No newline at end of file +var _0x0a1a=['update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','merge','VIRTUAL','filter','VoiceChanSpy','includeAll','include','catch','show','filtears','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0a1a,0xc9));var _0xa0a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a1a[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xa0a1('0x0'));var emlformat=require(_0xa0a1('0x1'));var rimraf=require(_0xa0a1('0x2'));var zipdir=require(_0xa0a1('0x3'));var jsonpatch=require(_0xa0a1('0x4'));var rp=require(_0xa0a1('0x5'));var moment=require(_0xa0a1('0x6'));var BPromise=require(_0xa0a1('0x7'));var Mustache=require('mustache');var util=require(_0xa0a1('0x8'));var path=require(_0xa0a1('0x9'));var sox=require(_0xa0a1('0xa'));var csv=require('to-csv');var ejs=require(_0xa0a1('0xb'));var fs=require('fs');var _=require(_0xa0a1('0xc'));var squel=require(_0xa0a1('0xd'));var crypto=require('crypto');var jsforce=require(_0xa0a1('0xe'));var deskjs=require(_0xa0a1('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa0a1('0x10'));var Redis=require('ioredis');var authService=require(_0xa0a1('0x11'));var qs=require(_0xa0a1('0x12'));var as=require(_0xa0a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa0a1('0x14'));var config=require(_0xa0a1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0a1('0x16'))['db'];function respondWithStatusCode(_0x308c44,_0x1378b6){_0x1378b6=_0x1378b6||0xcc;return function(_0x18fe0b){if(_0x18fe0b){return _0x308c44[_0xa0a1('0x17')](_0x1378b6);}return _0x308c44[_0xa0a1('0x18')](_0x1378b6)['end']();};}function respondWithResult(_0x3d0908,_0x57afce){_0x57afce=_0x57afce||0xc8;return function(_0x36695e){if(_0x36695e){return _0x3d0908[_0xa0a1('0x18')](_0x57afce)[_0xa0a1('0x19')](_0x36695e);}};}function respondWithFilteredResult(_0x379635,_0x124bf0){return function(_0x8ce183){if(_0x8ce183){var _0x387ac0=_0x8ce183[_0xa0a1('0x1a')],_0x270c2c=_0x124bf0[_0xa0a1('0x1b')],_0xfba790=_0x124bf0['offset']+_0x124bf0[_0xa0a1('0x1c')],_0x422474;if(_0xfba790>=_0x387ac0){_0xfba790=_0x387ac0;_0x422474=0xc8;}else{_0x422474=0xce;}_0x379635['status'](_0x422474);return _0x379635[_0xa0a1('0x1d')](_0xa0a1('0x1e'),_0x270c2c+'-'+_0xfba790+'/'+_0x387ac0)[_0xa0a1('0x19')](_0x8ce183);}return null;};}function patchUpdates(_0x2f3d7b){return function(_0x40895f){try{jsonpatch[_0xa0a1('0x1f')](_0x40895f,_0x2f3d7b,!![]);}catch(_0x1f4f1a){return BPromise['reject'](_0x1f4f1a);}return _0x40895f[_0xa0a1('0x20')]();};}function saveUpdates(_0x623c7,_0x4cd035){return function(_0x5c6397){if(_0x5c6397){return _0x5c6397[_0xa0a1('0x21')](_0x623c7)[_0xa0a1('0x22')](function(_0x57e9f9){return _0x57e9f9;});}return null;};}function removeEntity(_0x449461,_0x230af8){return function(_0x572021){if(_0x572021){return _0x572021[_0xa0a1('0x23')]()['then'](function(){var _0x4d7904=_0x572021[_0xa0a1('0x24')]({'plain':!![]});var _0xc3307b='ChanSpies';return db[_0xa0a1('0x25')]['destroy']({'where':{'type':_0xc3307b,'resourceId':_0x4d7904['id']}})['then'](function(){return _0x572021;});})[_0xa0a1('0x22')](function(){_0x449461[_0xa0a1('0x18')](0xcc)[_0xa0a1('0x26')]();});}};}function handleEntityNotFound(_0x4d83ca,_0x4e780d){return function(_0x41a6e5){if(!_0x41a6e5){_0x4d83ca['sendStatus'](0x194);}return _0x41a6e5;};}function handleError(_0x57800b,_0x3a2f07){_0x3a2f07=_0x3a2f07||0x1f4;return function(_0x6a1cc1){logger[_0xa0a1('0x27')](_0x6a1cc1[_0xa0a1('0x28')]);if(_0x6a1cc1[_0xa0a1('0x29')]){delete _0x6a1cc1[_0xa0a1('0x29')];}_0x57800b[_0xa0a1('0x18')](_0x3a2f07)[_0xa0a1('0x2a')](_0x6a1cc1);};}exports[_0xa0a1('0x2b')]=function(_0x46195a,_0x4d6f40){var _0x7d2602={},_0x2b3a52={},_0x58c596={'count':0x0,'rows':[]};var _0x2d0c74=_[_0xa0a1('0x2c')](db['VoiceChanSpy'][_0xa0a1('0x2d')],function(_0x1d4dee){return{'name':_0x1d4dee['fieldName'],'type':_0x1d4dee[_0xa0a1('0x2e')][_0xa0a1('0x2f')]};});_0x2b3a52[_0xa0a1('0x30')]=_[_0xa0a1('0x2c')](_0x2d0c74,_0xa0a1('0x29'));_0x2b3a52[_0xa0a1('0x31')]=_[_0xa0a1('0x32')](_0x46195a[_0xa0a1('0x31')]);_0x2b3a52[_0xa0a1('0x33')]=_[_0xa0a1('0x34')](_0x2b3a52[_0xa0a1('0x30')],_0x2b3a52['query']);_0x7d2602[_0xa0a1('0x35')]=_[_0xa0a1('0x34')](_0x2b3a52[_0xa0a1('0x30')],qs[_0xa0a1('0x36')](_0x46195a[_0xa0a1('0x31')][_0xa0a1('0x36')]));_0x7d2602[_0xa0a1('0x35')]=_0x7d2602[_0xa0a1('0x35')][_0xa0a1('0x37')]?_0x7d2602[_0xa0a1('0x35')]:_0x2b3a52[_0xa0a1('0x30')];if(!_0x46195a[_0xa0a1('0x31')][_0xa0a1('0x38')]('nolimit')){_0x7d2602['limit']=qs[_0xa0a1('0x1c')](_0x46195a[_0xa0a1('0x31')]['limit']);_0x7d2602[_0xa0a1('0x1b')]=qs[_0xa0a1('0x1b')](_0x46195a[_0xa0a1('0x31')][_0xa0a1('0x1b')]);}_0x7d2602['order']=qs['sort'](_0x46195a[_0xa0a1('0x31')]['sort']);_0x7d2602[_0xa0a1('0x39')]=qs[_0xa0a1('0x33')](_[_0xa0a1('0x3a')](_0x46195a[_0xa0a1('0x31')],_0x2b3a52['filters']),_0x2d0c74);if(_0x46195a[_0xa0a1('0x31')]['filter']){_0x7d2602['where']=_[_0xa0a1('0x3b')](_0x7d2602[_0xa0a1('0x39')],{'$or':_[_0xa0a1('0x2c')](_0x2d0c74,function(_0x522a05){if(_0x522a05[_0xa0a1('0x2e')]!==_0xa0a1('0x3c')){var _0x1eb2f7={};_0x1eb2f7[_0x522a05[_0xa0a1('0x29')]]={'$like':'%'+_0x46195a['query'][_0xa0a1('0x3d')]+'%'};return _0x1eb2f7;}})});}_0x7d2602=_[_0xa0a1('0x3b')]({},_0x7d2602,_0x46195a['options']);var _0x413f6d={'where':_0x7d2602['where']};return db[_0xa0a1('0x3e')]['count'](_0x413f6d)['then'](function(_0x3e1d71){_0x58c596[_0xa0a1('0x1a')]=_0x3e1d71;if(_0x46195a[_0xa0a1('0x31')][_0xa0a1('0x3f')]){_0x7d2602[_0xa0a1('0x40')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x7d2602);})[_0xa0a1('0x22')](function(_0x13fe4c){_0x58c596['rows']=_0x13fe4c;return _0x58c596;})['then'](respondWithFilteredResult(_0x4d6f40,_0x7d2602))[_0xa0a1('0x41')](handleError(_0x4d6f40,null));};exports[_0xa0a1('0x42')]=function(_0x2053bc,_0x21a744){var _0x4ef0d4={'raw':![],'where':{'id':_0x2053bc['params']['id']}},_0x340405={};_0x340405[_0xa0a1('0x30')]=_[_0xa0a1('0x32')](db[_0xa0a1('0x3e')]['rawAttributes']);_0x340405[_0xa0a1('0x31')]=_[_0xa0a1('0x32')](_0x2053bc[_0xa0a1('0x31')]);_0x340405[_0xa0a1('0x43')]=_['intersection'](_0x340405[_0xa0a1('0x30')],_0x340405[_0xa0a1('0x31')]);_0x4ef0d4[_0xa0a1('0x35')]=_[_0xa0a1('0x34')](_0x340405[_0xa0a1('0x30')],qs[_0xa0a1('0x36')](_0x2053bc['query'][_0xa0a1('0x36')]));_0x4ef0d4[_0xa0a1('0x35')]=_0x4ef0d4[_0xa0a1('0x35')]['length']?_0x4ef0d4[_0xa0a1('0x35')]:_0x340405[_0xa0a1('0x30')];if(_0x2053bc[_0xa0a1('0x31')]['includeAll']){_0x4ef0d4[_0xa0a1('0x40')]=[{'all':!![]}];}_0x4ef0d4=_[_0xa0a1('0x3b')]({},_0x4ef0d4,_0x2053bc['options']);return db[_0xa0a1('0x3e')]['find'](_0x4ef0d4)[_0xa0a1('0x22')](handleEntityNotFound(_0x21a744,null))[_0xa0a1('0x22')](respondWithResult(_0x21a744,null))['catch'](handleError(_0x21a744,null));};exports[_0xa0a1('0x44')]=function(_0x53f990,_0x368490){return db[_0xa0a1('0x3e')][_0xa0a1('0x44')](_0x53f990['body'],{})[_0xa0a1('0x22')](function(_0x29fd36){var _0x2a2b38=_0x53f990[_0xa0a1('0x45')]['get']({'plain':!![]});if(!_0x2a2b38)throw new Error(_0xa0a1('0x46'));if(_0x2a2b38['role']===_0xa0a1('0x45')){var _0xb64d3b=_0x29fd36[_0xa0a1('0x24')]({'plain':!![]});var _0x10972e=_0xa0a1('0x47');return db[_0xa0a1('0x48')]['find']({'where':{'name':_0x10972e,'userProfileId':_0x2a2b38[_0xa0a1('0x49')]},'raw':!![]})['then'](function(_0x46847f){if(_0x46847f&&_0x46847f[_0xa0a1('0x4a')]===0x0){return db['UserProfileResource'][_0xa0a1('0x44')]({'name':_0xb64d3b['name'],'resourceId':_0xb64d3b['id'],'type':_0x46847f[_0xa0a1('0x29')],'sectionId':_0x46847f['id']},{})[_0xa0a1('0x22')](function(){return _0x29fd36;});}else{return _0x29fd36;}})[_0xa0a1('0x41')](function(_0x394c69){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x394c69);throw _0x394c69;});}return _0x29fd36;})['then'](respondWithResult(_0x368490,0xc9))[_0xa0a1('0x41')](handleError(_0x368490,null));};exports[_0xa0a1('0x21')]=function(_0x42b425,_0x2d029a){if(_0x42b425['body']['id']){delete _0x42b425[_0xa0a1('0x4b')]['id'];}return db[_0xa0a1('0x3e')][_0xa0a1('0x4c')]({'where':{'id':_0x42b425[_0xa0a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d029a,null))[_0xa0a1('0x22')](saveUpdates(_0x42b425['body'],null))[_0xa0a1('0x22')](respondWithResult(_0x2d029a,null))[_0xa0a1('0x41')](handleError(_0x2d029a,null));};exports[_0xa0a1('0x23')]=function(_0x8e1d25,_0x1172b9){return db[_0xa0a1('0x3e')][_0xa0a1('0x4c')]({'where':{'id':_0x8e1d25[_0xa0a1('0x4d')]['id']}})[_0xa0a1('0x22')](handleEntityNotFound(_0x1172b9,null))[_0xa0a1('0x22')](removeEntity(_0x1172b9,null))[_0xa0a1('0x41')](handleError(_0x1172b9,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 600bb3a..60c5bfc 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 _0x9011=['password','ChanSpy','options','join','concat','internal','name','User','findAll','then','catch','exports','models','define','voice_chanspy','length','VoiceExtension','destroy','bulkCreate','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate'];(function(_0x868611,_0x1a176e){var _0x143a08=function(_0x46b692){while(--_0x46b692){_0x868611['push'](_0x868611['shift']());}};_0x143a08(++_0x1a176e);}(_0x9011,0x1f4));var _0x1901=function(_0x4730a9,_0x249cc8){_0x4730a9=_0x4730a9-0x0;var _0x4c4b05=_0x9011[_0x4730a9];return _0x4c4b05;};'use strict';var _=require('lodash');var util=require(_0x1901('0x0'));var BPromise=require(_0x1901('0x1'));var attributes=require(_0x1901('0x2'));var getUserApplications=function(_0xfd2f29,_0x15bebe,_0x307f27){var _0x1a6379=0x1;var _0x164e28=[];var _0x4a1b08={'context':_0x15bebe[_0x1901('0x3')]||_0x1901('0x4'),'exten':util[_0x1901('0x5')](_0x1901('0x6'),_0xfd2f29['prefix'],_0x307f27),'type':_0x1901('0x7'),'isApp':![],'ChanSpyId':_0xfd2f29['id'],'UserId':_0x15bebe['id']};_0x164e28[_0x1901('0x8')](_[_0x1901('0x9')]({'app':_0x1901('0xa'),'appdata':util['format'](_0x1901('0xb'),'chanspy'),'priority':_0x1a6379++},_0x4a1b08));if(_0xfd2f29[_0x1901('0xc')]){_0x164e28[_0x1901('0x8')](_[_0x1901('0x9')]({'app':_0x1901('0xd'),'appdata':util[_0x1901('0x5')](_0x1901('0xe'),_0xfd2f29[_0x1901('0xf')]),'priority':_0x1a6379++},_0x4a1b08));}if(_0xfd2f29[_0x1901('0x10')]){_0x164e28[_0x1901('0x8')](_[_0x1901('0x9')]({'app':_0x1901('0x11'),'appdata':_0xfd2f29[_0x1901('0x12')],'priority':_0x1a6379++},_0x4a1b08));}_0x164e28[_0x1901('0x8')](_[_0x1901('0x9')]({'app':_0x1901('0x13'),'appdata':util['format']('SIP/%s,%s',_0x15bebe['name'],_0xfd2f29[_0x1901('0x14')]?_0xfd2f29[_0x1901('0x14')][_0x1901('0x15')](''):''),'priority':_0x1a6379++},_0x4a1b08));if(_0xfd2f29[_0x1901('0xc')]){_0x164e28[_0x1901('0x8')](_[_0x1901('0x9')]({'app':'StopMixMonitor','priority':_0x1a6379++},_0x4a1b08));}return _0x164e28;};var getChanSpyApplications=function(_0x12f4bf,_0x4daa59){var _0x112bb2=[];for(var _0xf5748a=0x0,_0x4167bf=0x1;_0xf5748a<_0x4daa59['length'];_0xf5748a++,_0x4167bf=0x1){_0x112bb2=_0x112bb2[_0x1901('0x16')](getUserApplications(_0x12f4bf,_0x4daa59[_0xf5748a],_0x4daa59[_0xf5748a][_0x1901('0x17')]));if(_0x4daa59[_0xf5748a][_0x1901('0x17')]!=_0x4daa59[_0xf5748a][_0x1901('0x18')]){_0x112bb2=_0x112bb2[_0x1901('0x16')](getUserApplications(_0x12f4bf,_0x4daa59[_0xf5748a],_0x4daa59[_0xf5748a][_0x1901('0x18')]));}}return _0x112bb2;};var getChanSpyPromise=function(_0x356518,_0x564ddd){return new BPromise(function(_0x2d0f9a,_0x4d2bbb){return _0x356518[_0x1901('0x19')][_0x1901('0x1a')]({'attributes':['id',_0x1901('0x18'),_0x1901('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x1901('0x1b')](function(_0x5e332c){if(_0x5e332c){return _0x2d0f9a(getChanSpyApplications(_0x564ddd,_0x5e332c));}return _0x2d0f9a([]);})[_0x1901('0x1c')](function(_0x1355f8){_0x4d2bbb(_0x1355f8);});});};module[_0x1901('0x1d')]=function(_0x4a63a5,_0x364ade){var _0x518a61=_0x4a63a5[_0x1901('0x1e')];return _0x4a63a5[_0x1901('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x1901('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b59e5,_0x27b941,_0x56c8f7){return getChanSpyPromise(_0x518a61,_0x3b59e5)[_0x1901('0x1b')](function(_0x5ae246){if(_0x5ae246&&_0x5ae246[_0x1901('0x21')]){return _0x518a61[_0x1901('0x22')]['bulkCreate'](_0x5ae246);}})[_0x1901('0x1b')](function(){_0x56c8f7();})[_0x1901('0x1c')](function(_0x38a88e){_0x56c8f7(_0x38a88e);});},'afterUpdate':function(_0x48e8d6,_0x37e999,_0x274247){return _0x518a61[_0x1901('0x22')][_0x1901('0x23')]({'where':{'ChanSpyId':_0x48e8d6['id']}})[_0x1901('0x1b')](function(){return getChanSpyPromise(_0x518a61,_0x48e8d6);})[_0x1901('0x1b')](function(_0x97d9dd){if(_0x97d9dd&&_0x97d9dd[_0x1901('0x21')]){return _0x518a61[_0x1901('0x22')][_0x1901('0x24')](_0x97d9dd);}})[_0x1901('0x1b')](function(){_0x274247();})[_0x1901('0x1c')](function(_0x32ae75){_0x274247(_0x32ae75);});},'afterDestroy':function(_0x3269f0,_0x2de12e,_0x254163){return _0x518a61['VoiceExtension'][_0x1901('0x23')]({'where':{'ChanSpyId':_0x3269f0['id']}})[_0x1901('0x1b')](function(){_0x254163();})[_0x1901('0x1c')](function(_0x247c7f){_0x254163(_0x247c7f);});}}});}; \ No newline at end of file +var _0x3e1d=['VoiceExtension','destroy','catch','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','then','VoiceChanSpy','voice_chanspy'];(function(_0x3d85ba,_0x394231){var _0x27bb71=function(_0x594634){while(--_0x594634){_0x3d85ba['push'](_0x3d85ba['shift']());}};_0x27bb71(++_0x394231);}(_0x3e1d,0xad));var _0xd3e1=function(_0x59fc7c,_0x1146f2){_0x59fc7c=_0x59fc7c-0x0;var _0x2653ff=_0x3e1d[_0x59fc7c];return _0x2653ff;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xd3e1('0x0'));var attributes=require(_0xd3e1('0x1'));var getUserApplications=function(_0x57da13,_0x32420a,_0x5d0509){var _0x4ba2f3=0x1;var _0x974ff8=[];var _0x955001={'context':_0x32420a['context']||_0xd3e1('0x2'),'exten':util[_0xd3e1('0x3')](_0xd3e1('0x4'),_0x57da13[_0xd3e1('0x5')],_0x5d0509),'type':_0xd3e1('0x6'),'isApp':![],'ChanSpyId':_0x57da13['id'],'UserId':_0x32420a['id']};_0x974ff8[_0xd3e1('0x7')](_[_0xd3e1('0x8')]({'app':_0xd3e1('0x9'),'appdata':util[_0xd3e1('0x3')](_0xd3e1('0xa'),_0xd3e1('0xb')),'priority':_0x4ba2f3++},_0x955001));if(_0x57da13[_0xd3e1('0xc')]){_0x974ff8[_0xd3e1('0x7')](_[_0xd3e1('0x8')]({'app':'MixMonitor','appdata':util['format'](_0xd3e1('0xd'),_0x57da13[_0xd3e1('0xe')]),'priority':_0x4ba2f3++},_0x955001));}if(_0x57da13[_0xd3e1('0xf')]){_0x974ff8[_0xd3e1('0x7')](_[_0xd3e1('0x8')]({'app':_0xd3e1('0x10'),'appdata':_0x57da13['password'],'priority':_0x4ba2f3++},_0x955001));}_0x974ff8['push'](_[_0xd3e1('0x8')]({'app':'ChanSpy','appdata':util[_0xd3e1('0x3')](_0xd3e1('0x11'),_0x32420a[_0xd3e1('0x12')],_0x57da13[_0xd3e1('0x13')]?_0x57da13[_0xd3e1('0x13')][_0xd3e1('0x14')](''):''),'priority':_0x4ba2f3++},_0x955001));if(_0x57da13[_0xd3e1('0xc')]){_0x974ff8[_0xd3e1('0x7')](_['merge']({'app':_0xd3e1('0x15'),'priority':_0x4ba2f3++},_0x955001));}return _0x974ff8;};var getChanSpyApplications=function(_0x298e3b,_0x553ece){var _0x280454=[];for(var _0x5c276e=0x0,_0x1f2a0c=0x1;_0x5c276e<_0x553ece[_0xd3e1('0x16')];_0x5c276e++,_0x1f2a0c=0x1){_0x280454=_0x280454[_0xd3e1('0x17')](getUserApplications(_0x298e3b,_0x553ece[_0x5c276e],_0x553ece[_0x5c276e][_0xd3e1('0x18')]));if(_0x553ece[_0x5c276e]['internal']!=_0x553ece[_0x5c276e]['name']){_0x280454=_0x280454[_0xd3e1('0x17')](getUserApplications(_0x298e3b,_0x553ece[_0x5c276e],_0x553ece[_0x5c276e][_0xd3e1('0x12')]));}}return _0x280454;};var getChanSpyPromise=function(_0x2f0aae,_0x2fe1f4){return new BPromise(function(_0x2b27c8,_0x51ef15){return _0x2f0aae[_0xd3e1('0x19')][_0xd3e1('0x1a')]({'attributes':['id',_0xd3e1('0x12'),'internal'],'where':{'role':_0xd3e1('0x1b'),'chanspy':!![]},'raw':!![]})[_0xd3e1('0x1c')](function(_0x117252){if(_0x117252){return _0x2b27c8(getChanSpyApplications(_0x2fe1f4,_0x117252));}return _0x2b27c8([]);})['catch'](function(_0x4215f7){_0x51ef15(_0x4215f7);});});};module['exports']=function(_0x48106c,_0x41161c){var _0x5ec1a6=_0x48106c['models'];return _0x48106c['define'](_0xd3e1('0x1d'),attributes,{'tableName':_0xd3e1('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17d24b,_0x467894,_0x3229b5){return getChanSpyPromise(_0x5ec1a6,_0x17d24b)[_0xd3e1('0x1c')](function(_0x28c066){if(_0x28c066&&_0x28c066[_0xd3e1('0x16')]){return _0x5ec1a6[_0xd3e1('0x1f')]['bulkCreate'](_0x28c066);}})[_0xd3e1('0x1c')](function(){_0x3229b5();})['catch'](function(_0x4ecc70){_0x3229b5(_0x4ecc70);});},'afterUpdate':function(_0x4f62c0,_0x17fbee,_0x5e11fb){return _0x5ec1a6['VoiceExtension'][_0xd3e1('0x20')]({'where':{'ChanSpyId':_0x4f62c0['id']}})[_0xd3e1('0x1c')](function(){return getChanSpyPromise(_0x5ec1a6,_0x4f62c0);})[_0xd3e1('0x1c')](function(_0x5729fc){if(_0x5729fc&&_0x5729fc[_0xd3e1('0x16')]){return _0x5ec1a6['VoiceExtension']['bulkCreate'](_0x5729fc);}})[_0xd3e1('0x1c')](function(){_0x5e11fb();})[_0xd3e1('0x21')](function(_0xf00c32){_0x5e11fb(_0xf00c32);});},'afterDestroy':function(_0x4b3c79,_0x2b057b,_0x52ab17){return _0x5ec1a6[_0xd3e1('0x1f')]['destroy']({'where':{'ChanSpyId':_0x4b3c79['id']}})['then'](function(){_0x52ab17();})[_0xd3e1('0x21')](function(_0x381a56){_0x52ab17(_0x381a56);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 5eba990..b994d96 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 _0xa773=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4937fd,_0x2b5955){var _0x1d54f5=function(_0x2193c9){while(--_0x2193c9){_0x4937fd['push'](_0x4937fd['shift']());}};_0x1d54f5(++_0x2b5955);}(_0xa773,0x86));var _0x3a77=function(_0x21312c,_0x49e73a){_0x21312c=_0x21312c-0x0;var _0x552001=_0xa773[_0x21312c];return _0x552001;};'use strict';var _=require(_0x3a77('0x0'));var util=require('util');var moment=require(_0x3a77('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a77('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a77('0x3'))['db'];var utils=require(_0x3a77('0x4'));var logger=require('../../config/logger')(_0x3a77('0x5'));var config=require(_0x3a77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3a77('0x7')][_0x3a77('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f96e9,_0x19ad82,_0x10b40c){return new BPromise(function(_0x7f02f5,_0x29bf1c){return client['request'](_0x4f96e9,_0x10b40c)[_0x3a77('0x9')](function(_0x58e065){logger['info'](_0x3a77('0xa'),_0x19ad82,_0x3a77('0xb'));logger[_0x3a77('0xc')](_0x3a77('0xd'),_0x19ad82,_0x3a77('0xb'),JSON['stringify'](_0x58e065));if(_0x58e065['error']){if(_0x58e065[_0x3a77('0xe')][_0x3a77('0xf')]===0x1f4){logger['error'](_0x3a77('0xa'),_0x19ad82,_0x58e065[_0x3a77('0xe')][_0x3a77('0x10')]);return _0x29bf1c(_0x58e065[_0x3a77('0xe')]['message']);}logger[_0x3a77('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x19ad82,_0x58e065[_0x3a77('0xe')]['message']);return _0x7f02f5(_0x58e065['error'][_0x3a77('0x10')]);}else{logger['info'](_0x3a77('0xa'),_0x19ad82,_0x3a77('0xb'));_0x7f02f5(_0x58e065[_0x3a77('0x11')][_0x3a77('0x10')]);}})[_0x3a77('0x12')](function(_0x43f2b8){logger[_0x3a77('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x19ad82,_0x43f2b8);_0x29bf1c(_0x43f2b8);});});} \ No newline at end of file +var _0x11cb=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x11cb,0x10b));var _0xb11c=function(_0xcf4f77,_0x3d4be0){_0xcf4f77=_0xcf4f77-0x0;var _0x5ac50d=_0x11cb[_0xcf4f77];return _0x5ac50d;};'use strict';var _=require(_0xb11c('0x0'));var util=require(_0xb11c('0x1'));var moment=require(_0xb11c('0x2'));var BPromise=require(_0xb11c('0x3'));var rs=require(_0xb11c('0x4'));var fs=require('fs');var Redis=require(_0xb11c('0x5'));var db=require(_0xb11c('0x6'))['db'];var utils=require(_0xb11c('0x7'));var logger=require('../../config/logger')(_0xb11c('0x8'));var config=require(_0xb11c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb11c('0xa')][_0xb11c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfc9386,_0x7220ae,_0x14ee24){return new BPromise(function(_0x1e3d52,_0x3a0eea){return client[_0xb11c('0xc')](_0xfc9386,_0x14ee24)[_0xb11c('0xd')](function(_0x1b0fd7){logger[_0xb11c('0xe')](_0xb11c('0xf'),_0x7220ae,_0xb11c('0x10'));logger[_0xb11c('0x11')](_0xb11c('0x12'),_0x7220ae,_0xb11c('0x10'),JSON[_0xb11c('0x13')](_0x1b0fd7));if(_0x1b0fd7['error']){if(_0x1b0fd7[_0xb11c('0x14')][_0xb11c('0x15')]===0x1f4){logger['error'](_0xb11c('0xf'),_0x7220ae,_0x1b0fd7[_0xb11c('0x14')][_0xb11c('0x16')]);return _0x3a0eea(_0x1b0fd7[_0xb11c('0x14')][_0xb11c('0x16')]);}logger['error'](_0xb11c('0xf'),_0x7220ae,_0x1b0fd7[_0xb11c('0x14')][_0xb11c('0x16')]);return _0x1e3d52(_0x1b0fd7['error'][_0xb11c('0x16')]);}else{logger[_0xb11c('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x7220ae,_0xb11c('0x10'));_0x1e3d52(_0x1b0fd7[_0xb11c('0x17')][_0xb11c('0x16')]);}})['catch'](function(_0x3bb057){logger[_0xb11c('0x14')](_0xb11c('0xf'),_0x7220ae,_0x3bb057);_0x3a0eea(_0x3bb057);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f21bc18..ddf42af 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 _0xc832=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x593c5d,_0x3ff534){var _0x1eccac=function(_0x140886){while(--_0x140886){_0x593c5d['push'](_0x593c5d['shift']());}};_0x1eccac(++_0x3ff534);}(_0xc832,0xfa));var _0x2c83=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc832[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require(_0x2c83('0x0'));var path=require(_0x2c83('0x1'));var timeout=require(_0x2c83('0x2'));var express=require(_0x2c83('0x3'));var router=express[_0x2c83('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2c83('0x5'));var config=require(_0x2c83('0x6'));var controller=require(_0x2c83('0x7'));router[_0x2c83('0x8')]('/',auth[_0x2c83('0x9')](),controller[_0x2c83('0xa')]);router[_0x2c83('0x8')](_0x2c83('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2c83('0xc')]('/',auth[_0x2c83('0x9')](),controller[_0x2c83('0xd')]);router[_0x2c83('0xe')](_0x2c83('0xb'),auth['isAuthenticated'](),controller[_0x2c83('0xf')]);router[_0x2c83('0x10')](_0x2c83('0xb'),auth[_0x2c83('0x9')](),controller[_0x2c83('0x11')]);module[_0x2c83('0x12')]=router; \ No newline at end of file +var _0xb913=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util'];(function(_0x57df61,_0x138155){var _0x1935b5=function(_0x494289){while(--_0x494289){_0x57df61['push'](_0x57df61['shift']());}};_0x1935b5(++_0x138155);}(_0xb913,0xbd));var _0x3b91=function(_0x1998f9,_0xe24938){_0x1998f9=_0x1998f9-0x0;var _0x51be8f=_0xb913[_0x1998f9];return _0x51be8f;};'use strict';var multer=require('multer');var util=require(_0x3b91('0x0'));var path=require(_0x3b91('0x1'));var timeout=require(_0x3b91('0x2'));var express=require(_0x3b91('0x3'));var router=express[_0x3b91('0x4')]();var auth=require(_0x3b91('0x5'));var interaction=require(_0x3b91('0x6'));var config=require(_0x3b91('0x7'));var controller=require(_0x3b91('0x8'));router[_0x3b91('0x9')]('/',auth[_0x3b91('0xa')](),controller[_0x3b91('0xb')]);router[_0x3b91('0x9')](_0x3b91('0xc'),auth['isAuthenticated'](),controller[_0x3b91('0xd')]);router[_0x3b91('0xe')]('/',auth[_0x3b91('0xa')](),controller['create']);router[_0x3b91('0xf')](_0x3b91('0xc'),auth['isAuthenticated'](),controller[_0x3b91('0x10')]);router['delete'](_0x3b91('0xc'),auth[_0x3b91('0xa')](),controller[_0x3b91('0x11')]);module[_0x3b91('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 782b943..ece4450 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 _0x9c44=['BOOLEAN','STRING','name'];(function(_0x471c7e,_0x54af59){var _0x53dc9f=function(_0x53a1e4){while(--_0x53a1e4){_0x471c7e['push'](_0x471c7e['shift']());}};_0x53dc9f(++_0x54af59);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2c469d,_0x562000){var _0x41197b=function(_0x4708e1){while(--_0x4708e1){_0x2c469d['push'](_0x2c469d['shift']());}};_0x41197b(++_0x562000);}(_0xe14b,0x93));var _0xbe14=function(_0x503051,_0x5b2e3c){_0x503051=_0x503051-0x0;var _0x99fb94=_0xe14b[_0x503051];return _0x99fb94;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'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 dd42832..537ebce 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 _0x8efe=['then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','get','Contexts','destroy','sendStatus','stack','name','send','index','VoiceContext','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','filtears','fields','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','update','server/files/templates/context.ejs','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request'];(function(_0x197ea8,_0x227ea0){var _0x18a46d=function(_0x1685f9){while(--_0x1685f9){_0x197ea8['push'](_0x197ea8['shift']());}};_0x18a46d(++_0x227ea0);}(_0x8efe,0x1e2));var _0xe8ef=function(_0x3b2fb0,_0x237ef9){_0x3b2fb0=_0x3b2fb0-0x0;var _0x50ae96=_0x8efe[_0x3b2fb0];return _0x50ae96;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe8ef('0x0'));var rimraf=require(_0xe8ef('0x1'));var zipdir=require(_0xe8ef('0x2'));var jsonpatch=require(_0xe8ef('0x3'));var rp=require(_0xe8ef('0x4'));var moment=require(_0xe8ef('0x5'));var BPromise=require(_0xe8ef('0x6'));var Mustache=require('mustache');var util=require(_0xe8ef('0x7'));var path=require('path');var sox=require(_0xe8ef('0x8'));var csv=require(_0xe8ef('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8ef('0xa'));var squel=require(_0xe8ef('0xb'));var crypto=require(_0xe8ef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8ef('0xd'));var toCsv=require(_0xe8ef('0x9'));var querystring=require('querystring');var Papa=require(_0xe8ef('0xe'));var Redis=require(_0xe8ef('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe8ef('0x10'));var as=require(_0xe8ef('0x11'));var hardwareService=require(_0xe8ef('0x12'));var logger=require(_0xe8ef('0x13'))(_0xe8ef('0x14'));var utils=require(_0xe8ef('0x15'));var config=require(_0xe8ef('0x16'));var licenseUtil=require(_0xe8ef('0x17'));var db=require(_0xe8ef('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8ef('0x19')][_0xe8ef('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x528ea9,_0x206033,_0x16fea2,_0x22c4af){return new BPromise(function(_0x4bc14f,_0x23a787){var _0xe0abe8=_0x22c4af||client;return _0xe0abe8[_0xe8ef('0x1b')](_0x528ea9,_0x16fea2)[_0xe8ef('0x1c')](function(_0x367e95){logger['info'](_0xe8ef('0x1d'),_0x206033,_0xe8ef('0x1e'));logger[_0xe8ef('0x1f')](_0xe8ef('0x20'),_0x206033,_0xe8ef('0x1e'),JSON['stringify'](_0x367e95));if(_0x367e95['error']){if(_0x367e95[_0xe8ef('0x21')]['code']===0x1f4){logger[_0xe8ef('0x21')](_0xe8ef('0x1d'),_0x206033,_0x367e95[_0xe8ef('0x21')][_0xe8ef('0x22')]);return _0x23a787(_0x367e95[_0xe8ef('0x21')][_0xe8ef('0x22')]);}logger['error'](_0xe8ef('0x1d'),_0x206033,_0x367e95['error']['message']);return _0x4bc14f(_0x367e95[_0xe8ef('0x21')][_0xe8ef('0x22')]);}else{logger[_0xe8ef('0x23')](_0xe8ef('0x1d'),_0x206033,_0xe8ef('0x1e'));_0x4bc14f(_0x367e95['result'][_0xe8ef('0x22')]);}})[_0xe8ef('0x24')](function(_0x4fc169){logger[_0xe8ef('0x21')](_0xe8ef('0x1d'),_0x206033,_0x4fc169);_0x23a787(_0x4fc169);});});}function respondWithStatusCode(_0x3f15f2,_0x269a6e){_0x269a6e=_0x269a6e||0xcc;return function(_0x573f54){if(_0x573f54){return _0x3f15f2['sendStatus'](_0x269a6e);}return _0x3f15f2[_0xe8ef('0x25')](_0x269a6e)[_0xe8ef('0x26')]();};}function respondWithResult(_0x9948e2,_0x347419){_0x347419=_0x347419||0xc8;return function(_0x7adbe0){if(_0x7adbe0){return _0x9948e2['status'](_0x347419)['json'](_0x7adbe0);}};}function respondWithFilteredResult(_0x8ba944,_0x26d209){return function(_0x28493c){if(_0x28493c){var _0x26f1a4=_0x28493c[_0xe8ef('0x27')],_0x7783a6=_0x26d209[_0xe8ef('0x28')],_0x572bc3=_0x26d209['offset']+_0x26d209[_0xe8ef('0x29')],_0x872ae0;if(_0x572bc3>=_0x26f1a4){_0x572bc3=_0x26f1a4;_0x872ae0=0xc8;}else{_0x872ae0=0xce;}_0x8ba944[_0xe8ef('0x25')](_0x872ae0);return _0x8ba944[_0xe8ef('0x2a')](_0xe8ef('0x2b'),_0x7783a6+'-'+_0x572bc3+'/'+_0x26f1a4)[_0xe8ef('0x2c')](_0x28493c);}return null;};}function patchUpdates(_0xa62c1d){return function(_0x3b0503){try{jsonpatch[_0xe8ef('0x2d')](_0x3b0503,_0xa62c1d,!![]);}catch(_0x1d29f9){return BPromise[_0xe8ef('0x2e')](_0x1d29f9);}return _0x3b0503[_0xe8ef('0x2f')]();};}function saveUpdates(_0x5a3c92,_0x397820){return function(_0x2ca089){if(_0x2ca089){return _0x2ca089['update'](_0x5a3c92)[_0xe8ef('0x1c')](function(_0x4a3ded){return _0x4a3ded;});}return null;};}function removeEntity(_0x361291,_0x1c7ef7){return function(_0x1e2c17){if(_0x1e2c17){return _0x1e2c17['destroy']()[_0xe8ef('0x1c')](function(){var _0x168505=_0x1e2c17[_0xe8ef('0x30')]({'plain':!![]});var _0x40d1fa=_0xe8ef('0x31');return db['UserProfileResource'][_0xe8ef('0x32')]({'where':{'type':_0x40d1fa,'resourceId':_0x168505['id']}})[_0xe8ef('0x1c')](function(){return _0x1e2c17;});})[_0xe8ef('0x1c')](function(){_0x361291['status'](0xcc)[_0xe8ef('0x26')]();});}};}function handleEntityNotFound(_0x30cb9c,_0x3f70e4){return function(_0x17c5c6){if(!_0x17c5c6){_0x30cb9c[_0xe8ef('0x33')](0x194);}return _0x17c5c6;};}function handleError(_0x43aeca,_0x3ab037){_0x3ab037=_0x3ab037||0x1f4;return function(_0x1abd47){logger[_0xe8ef('0x21')](_0x1abd47[_0xe8ef('0x34')]);if(_0x1abd47[_0xe8ef('0x35')]){delete _0x1abd47[_0xe8ef('0x35')];}_0x43aeca['status'](_0x3ab037)[_0xe8ef('0x36')](_0x1abd47);};}exports[_0xe8ef('0x37')]=function(_0x48ff07,_0x3b6df6){var _0xb6e5db={},_0x139d8b={},_0x34a248={'count':0x0,'rows':[]};var _0x35ca2a=_['map'](db[_0xe8ef('0x38')]['rawAttributes'],function(_0x3259fb){return{'name':_0x3259fb[_0xe8ef('0x39')],'type':_0x3259fb[_0xe8ef('0x3a')][_0xe8ef('0x3b')]};});_0x139d8b[_0xe8ef('0x3c')]=_[_0xe8ef('0x3d')](_0x35ca2a,_0xe8ef('0x35'));_0x139d8b['query']=_[_0xe8ef('0x3e')](_0x48ff07['query']);_0x139d8b[_0xe8ef('0x3f')]=_[_0xe8ef('0x40')](_0x139d8b[_0xe8ef('0x3c')],_0x139d8b[_0xe8ef('0x41')]);_0xb6e5db[_0xe8ef('0x42')]=_['intersection'](_0x139d8b[_0xe8ef('0x3c')],qs['fields'](_0x48ff07[_0xe8ef('0x41')]['fields']));_0xb6e5db['attributes']=_0xb6e5db[_0xe8ef('0x42')][_0xe8ef('0x43')]?_0xb6e5db['attributes']:_0x139d8b[_0xe8ef('0x3c')];if(!_0x48ff07[_0xe8ef('0x41')][_0xe8ef('0x44')](_0xe8ef('0x45'))){_0xb6e5db['limit']=qs['limit'](_0x48ff07[_0xe8ef('0x41')][_0xe8ef('0x29')]);_0xb6e5db[_0xe8ef('0x28')]=qs['offset'](_0x48ff07['query'][_0xe8ef('0x28')]);}_0xb6e5db[_0xe8ef('0x46')]=qs[_0xe8ef('0x47')](_0x48ff07[_0xe8ef('0x41')]['sort']);_0xb6e5db[_0xe8ef('0x48')]=qs['filters'](_['pick'](_0x48ff07[_0xe8ef('0x41')],_0x139d8b['filters']),_0x35ca2a);if(_0x48ff07[_0xe8ef('0x41')][_0xe8ef('0x49')]){_0xb6e5db['where']=_[_0xe8ef('0x4a')](_0xb6e5db[_0xe8ef('0x48')],{'$or':_[_0xe8ef('0x3d')](_0x35ca2a,function(_0x54d49b){if(_0x54d49b[_0xe8ef('0x3a')]!=='VIRTUAL'){var _0x3bd2e9={};_0x3bd2e9[_0x54d49b[_0xe8ef('0x35')]]={'$like':'%'+_0x48ff07[_0xe8ef('0x41')][_0xe8ef('0x49')]+'%'};return _0x3bd2e9;}})});}_0xb6e5db=_[_0xe8ef('0x4a')]({},_0xb6e5db,_0x48ff07[_0xe8ef('0x4b')]);var _0x51bf19={'where':_0xb6e5db['where']};return db[_0xe8ef('0x38')][_0xe8ef('0x27')](_0x51bf19)[_0xe8ef('0x1c')](function(_0x1a1eef){_0x34a248[_0xe8ef('0x27')]=_0x1a1eef;if(_0x48ff07[_0xe8ef('0x41')][_0xe8ef('0x4c')]){_0xb6e5db[_0xe8ef('0x4d')]=[{'all':!![]}];}return db[_0xe8ef('0x38')][_0xe8ef('0x4e')](_0xb6e5db);})['then'](function(_0x95fd3e){_0x34a248[_0xe8ef('0x4f')]=_0x95fd3e;return _0x34a248;})['then'](respondWithFilteredResult(_0x3b6df6,_0xb6e5db))[_0xe8ef('0x24')](handleError(_0x3b6df6,null));};exports[_0xe8ef('0x50')]=function(_0x40f91c,_0x568d73){var _0x35ea1f={'raw':![],'where':{'id':_0x40f91c[_0xe8ef('0x51')]['id']}},_0x555abd={};_0x555abd[_0xe8ef('0x3c')]=_[_0xe8ef('0x3e')](db[_0xe8ef('0x38')]['rawAttributes']);_0x555abd[_0xe8ef('0x41')]=_[_0xe8ef('0x3e')](_0x40f91c[_0xe8ef('0x41')]);_0x555abd[_0xe8ef('0x52')]=_[_0xe8ef('0x40')](_0x555abd[_0xe8ef('0x3c')],_0x555abd[_0xe8ef('0x41')]);_0x35ea1f[_0xe8ef('0x42')]=_[_0xe8ef('0x40')](_0x555abd[_0xe8ef('0x3c')],qs[_0xe8ef('0x53')](_0x40f91c[_0xe8ef('0x41')][_0xe8ef('0x53')]));_0x35ea1f[_0xe8ef('0x42')]=_0x35ea1f[_0xe8ef('0x42')][_0xe8ef('0x43')]?_0x35ea1f[_0xe8ef('0x42')]:_0x555abd[_0xe8ef('0x3c')];if(_0x40f91c[_0xe8ef('0x41')]['includeAll']){_0x35ea1f['include']=[{'all':!![]}];}_0x35ea1f=_[_0xe8ef('0x4a')]({},_0x35ea1f,_0x40f91c[_0xe8ef('0x4b')]);return db['VoiceContext']['find'](_0x35ea1f)[_0xe8ef('0x1c')](handleEntityNotFound(_0x568d73,null))['then'](respondWithResult(_0x568d73,null))['catch'](handleError(_0x568d73,null));};exports[_0xe8ef('0x54')]=function(_0x1dcabd,_0x114342,_0x24097f){var _0x5d9f63;return db[_0xe8ef('0x38')][_0xe8ef('0x54')](_0x1dcabd['body'],{'raw':!![]})[_0xe8ef('0x1c')](function(_0x1b78ff){_0x5d9f63=_0x1b78ff;return db[_0xe8ef('0x38')][_0xe8ef('0x4e')]({'raw':!![]});})['then'](function(_0x15f1d9){var _0x4108c3=fs[_0xe8ef('0x55')](path[_0xe8ef('0x56')](config[_0xe8ef('0x57')],'server/files/templates/context.ejs'),_0xe8ef('0x58'));var _0x445bb5=ejs[_0xe8ef('0x59')](_0x4108c3,{'contexts':_0x15f1d9||[]});fs[_0xe8ef('0x5a')](_0xe8ef('0x5b'),_0x445bb5);})['then'](function(){return respondWithRpcPromise('Reload',_0xe8ef('0x54'),{'module':_0xe8ef('0x5c')});})['then'](function(){var _0x43b80f=_0x1dcabd[_0xe8ef('0x5d')][_0xe8ef('0x30')]({'plain':!![]});if(!_0x43b80f)throw new Error(_0xe8ef('0x5e'));if(_0x43b80f['role']===_0xe8ef('0x5d')){var _0xbd3ae=_0x5d9f63['get']({'plain':!![]});return db[_0xe8ef('0x5f')][_0xe8ef('0x60')]({'where':{'name':_0xe8ef('0x31'),'userProfileId':_0x43b80f[_0xe8ef('0x61')]},'raw':!![]})[_0xe8ef('0x1c')](function(_0x244f92){if(_0x244f92&&_0x244f92['autoAssociation']===0x0){return db[_0xe8ef('0x62')][_0xe8ef('0x54')]({'name':_0xbd3ae[_0xe8ef('0x35')],'resourceId':_0xbd3ae['id'],'type':_0x244f92[_0xe8ef('0x35')],'sectionId':_0x244f92['id']},{})['then'](function(){return _0x5d9f63;});}else{return _0x5d9f63;}})[_0xe8ef('0x24')](function(_0x23961d){logger[_0xe8ef('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23961d);throw _0x23961d;});}return _0x5d9f63;})[_0xe8ef('0x1c')](respondWithResult(_0x114342,0xc9))[_0xe8ef('0x24')](handleError(_0x114342,null));};exports[_0xe8ef('0x63')]=function(_0x4bc9ef,_0x6db7,_0x2e445e){var _0x21714a;return db[_0xe8ef('0x38')][_0xe8ef('0x60')]({'where':{'id':_0x4bc9ef[_0xe8ef('0x51')]['id']}})['then'](handleEntityNotFound(_0x6db7,null))[_0xe8ef('0x1c')](saveUpdates(_0x4bc9ef['body'],null))[_0xe8ef('0x1c')](function(_0x40fa4c){if(_0x40fa4c){_0x21714a=_0x40fa4c;return db['VoiceContext']['findAll']({'raw':!![]});}})['then'](function(_0x27e834){var _0x4a4929=fs['readFileSync'](path['join'](config[_0xe8ef('0x57')],_0xe8ef('0x64')),_0xe8ef('0x58'));var _0x5c46e3=ejs[_0xe8ef('0x59')](_0x4a4929,{'contexts':_0x27e834||[]});fs[_0xe8ef('0x5a')](_0xe8ef('0x5b'),_0x5c46e3);})[_0xe8ef('0x1c')](function(){return respondWithRpcPromise(_0xe8ef('0x65'),'update',{'module':'chan_sip.so'});})[_0xe8ef('0x1c')](function(){return _0x21714a;})[_0xe8ef('0x1c')](respondWithResult(_0x6db7,null))['catch'](handleError(_0x6db7,null));};exports['destroy']=function(_0x1a130b,_0x52b28f,_0x89371c){var _0x5e5671;return db[_0xe8ef('0x38')]['find']({'where':{'id':_0x1a130b[_0xe8ef('0x51')]['id']}})[_0xe8ef('0x1c')](handleEntityNotFound(_0x52b28f,null))['then'](removeEntity(_0x52b28f,null))['then'](function(){return db[_0xe8ef('0x38')]['findAll']({'raw':!![]});})[_0xe8ef('0x1c')](function(_0x25d1c6){var _0x5bcf32=fs[_0xe8ef('0x55')](path[_0xe8ef('0x56')](config[_0xe8ef('0x57')],_0xe8ef('0x64')),_0xe8ef('0x58'));var _0x222a0e=ejs[_0xe8ef('0x59')](_0x5bcf32,{'contexts':_0x25d1c6});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x222a0e);return respondWithRpcPromise(_0xe8ef('0x65'),_0xe8ef('0x32'),{'module':_0xe8ef('0x5c')});})[_0xe8ef('0x24')](handleError(_0x52b28f,null));}; \ No newline at end of file +var _0xb8a0=['map','VoiceContext','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','show','params','intersection','includeAll','options','create','body','readFileSync','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Contexts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','chan_sip.so','rimraf','zip-dir','request-promise','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','../../config/license/util','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','index'];(function(_0xaa0140,_0xd6c719){var _0x11ac88=function(_0x563a95){while(--_0x563a95){_0xaa0140['push'](_0xaa0140['shift']());}};_0x11ac88(++_0xd6c719);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x211f61,_0x3cfe3d){_0x211f61=_0x211f61-0x0;var _0x3d9927=_0xb8a0[_0x211f61];return _0x3d9927;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0b8a('0x0'));var zipdir=require(_0x0b8a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b8a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0b8a('0x3'));var sox=require(_0x0b8a('0x4'));var csv=require(_0x0b8a('0x5'));var ejs=require(_0x0b8a('0x6'));var fs=require('fs');var _=require(_0x0b8a('0x7'));var squel=require(_0x0b8a('0x8'));var crypto=require(_0x0b8a('0x9'));var jsforce=require(_0x0b8a('0xa'));var deskjs=require(_0x0b8a('0xb'));var toCsv=require(_0x0b8a('0x5'));var querystring=require(_0x0b8a('0xc'));var Papa=require(_0x0b8a('0xd'));var Redis=require(_0x0b8a('0xe'));var authService=require(_0x0b8a('0xf'));var qs=require(_0x0b8a('0x10'));var as=require(_0x0b8a('0x11'));var hardwareService=require(_0x0b8a('0x12'));var logger=require(_0x0b8a('0x13'))(_0x0b8a('0x14'));var utils=require(_0x0b8a('0x15'));var config=require(_0x0b8a('0x16'));var licenseUtil=require(_0x0b8a('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0b8a('0x18'));var client=jayson[_0x0b8a('0x19')][_0x0b8a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x33f027,_0x136704,_0x207322,_0x12838b){return new BPromise(function(_0x4066ef,_0x1313d1){var _0x5c32aa=_0x12838b||client;return _0x5c32aa[_0x0b8a('0x1b')](_0x33f027,_0x207322)[_0x0b8a('0x1c')](function(_0x233a61){logger['info'](_0x0b8a('0x1d'),_0x136704,_0x0b8a('0x1e'));logger[_0x0b8a('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x136704,'request\x20sent',JSON['stringify'](_0x233a61));if(_0x233a61[_0x0b8a('0x20')]){if(_0x233a61['error'][_0x0b8a('0x21')]===0x1f4){logger[_0x0b8a('0x20')](_0x0b8a('0x1d'),_0x136704,_0x233a61[_0x0b8a('0x20')][_0x0b8a('0x22')]);return _0x1313d1(_0x233a61[_0x0b8a('0x20')][_0x0b8a('0x22')]);}logger[_0x0b8a('0x20')](_0x0b8a('0x1d'),_0x136704,_0x233a61[_0x0b8a('0x20')][_0x0b8a('0x22')]);return _0x4066ef(_0x233a61['error'][_0x0b8a('0x22')]);}else{logger[_0x0b8a('0x23')]('VoiceContext,\x20%s,\x20%s',_0x136704,_0x0b8a('0x1e'));_0x4066ef(_0x233a61[_0x0b8a('0x24')][_0x0b8a('0x22')]);}})[_0x0b8a('0x25')](function(_0x5a2f44){logger[_0x0b8a('0x20')]('VoiceContext,\x20%s,\x20%s',_0x136704,_0x5a2f44);_0x1313d1(_0x5a2f44);});});}function respondWithStatusCode(_0x35c45c,_0x29dbf3){_0x29dbf3=_0x29dbf3||0xcc;return function(_0x5afa76){if(_0x5afa76){return _0x35c45c[_0x0b8a('0x26')](_0x29dbf3);}return _0x35c45c[_0x0b8a('0x27')](_0x29dbf3)[_0x0b8a('0x28')]();};}function respondWithResult(_0x493699,_0x65f12b){_0x65f12b=_0x65f12b||0xc8;return function(_0x2d876e){if(_0x2d876e){return _0x493699[_0x0b8a('0x27')](_0x65f12b)['json'](_0x2d876e);}};}function respondWithFilteredResult(_0x37f47b,_0x499db6){return function(_0x1ed000){if(_0x1ed000){var _0x3e5e38=_0x1ed000[_0x0b8a('0x29')],_0x3d08c8=_0x499db6[_0x0b8a('0x2a')],_0x292097=_0x499db6[_0x0b8a('0x2a')]+_0x499db6[_0x0b8a('0x2b')],_0x32670f;if(_0x292097>=_0x3e5e38){_0x292097=_0x3e5e38;_0x32670f=0xc8;}else{_0x32670f=0xce;}_0x37f47b[_0x0b8a('0x27')](_0x32670f);return _0x37f47b[_0x0b8a('0x2c')](_0x0b8a('0x2d'),_0x3d08c8+'-'+_0x292097+'/'+_0x3e5e38)['json'](_0x1ed000);}return null;};}function patchUpdates(_0x28ab04){return function(_0x223fdb){try{jsonpatch[_0x0b8a('0x2e')](_0x223fdb,_0x28ab04,!![]);}catch(_0x22ef59){return BPromise[_0x0b8a('0x2f')](_0x22ef59);}return _0x223fdb['save']();};}function saveUpdates(_0x2e9d5b,_0x4690b6){return function(_0x4f98dd){if(_0x4f98dd){return _0x4f98dd[_0x0b8a('0x30')](_0x2e9d5b)[_0x0b8a('0x1c')](function(_0x151a2f){return _0x151a2f;});}return null;};}function removeEntity(_0x492e74,_0x2703e7){return function(_0x485c44){if(_0x485c44){return _0x485c44[_0x0b8a('0x31')]()[_0x0b8a('0x1c')](function(){var _0x1d08e9=_0x485c44[_0x0b8a('0x32')]({'plain':!![]});var _0x44d7a1='Contexts';return db[_0x0b8a('0x33')][_0x0b8a('0x31')]({'where':{'type':_0x44d7a1,'resourceId':_0x1d08e9['id']}})['then'](function(){return _0x485c44;});})[_0x0b8a('0x1c')](function(){_0x492e74[_0x0b8a('0x27')](0xcc)[_0x0b8a('0x28')]();});}};}function handleEntityNotFound(_0x2e0582,_0x4ccb0c){return function(_0x167b25){if(!_0x167b25){_0x2e0582[_0x0b8a('0x26')](0x194);}return _0x167b25;};}function handleError(_0x552fcd,_0x575e08){_0x575e08=_0x575e08||0x1f4;return function(_0x1d44a0){logger[_0x0b8a('0x20')](_0x1d44a0[_0x0b8a('0x34')]);if(_0x1d44a0[_0x0b8a('0x35')]){delete _0x1d44a0['name'];}_0x552fcd[_0x0b8a('0x27')](_0x575e08)[_0x0b8a('0x36')](_0x1d44a0);};}exports[_0x0b8a('0x37')]=function(_0x5b2a9a,_0x155e18){var _0x131e4a={},_0x3475cb={},_0x10b1ba={'count':0x0,'rows':[]};var _0x1124a7=_[_0x0b8a('0x38')](db[_0x0b8a('0x39')][_0x0b8a('0x3a')],function(_0x1a189a){return{'name':_0x1a189a[_0x0b8a('0x3b')],'type':_0x1a189a['type'][_0x0b8a('0x3c')]};});_0x3475cb[_0x0b8a('0x3d')]=_[_0x0b8a('0x38')](_0x1124a7,_0x0b8a('0x35'));_0x3475cb[_0x0b8a('0x3e')]=_[_0x0b8a('0x3f')](_0x5b2a9a[_0x0b8a('0x3e')]);_0x3475cb[_0x0b8a('0x40')]=_['intersection'](_0x3475cb[_0x0b8a('0x3d')],_0x3475cb['query']);_0x131e4a[_0x0b8a('0x41')]=_['intersection'](_0x3475cb[_0x0b8a('0x3d')],qs[_0x0b8a('0x42')](_0x5b2a9a['query'][_0x0b8a('0x42')]));_0x131e4a[_0x0b8a('0x41')]=_0x131e4a['attributes'][_0x0b8a('0x43')]?_0x131e4a[_0x0b8a('0x41')]:_0x3475cb['model'];if(!_0x5b2a9a[_0x0b8a('0x3e')][_0x0b8a('0x44')](_0x0b8a('0x45'))){_0x131e4a['limit']=qs[_0x0b8a('0x2b')](_0x5b2a9a[_0x0b8a('0x3e')]['limit']);_0x131e4a[_0x0b8a('0x2a')]=qs['offset'](_0x5b2a9a[_0x0b8a('0x3e')]['offset']);}_0x131e4a[_0x0b8a('0x46')]=qs[_0x0b8a('0x47')](_0x5b2a9a[_0x0b8a('0x3e')][_0x0b8a('0x47')]);_0x131e4a[_0x0b8a('0x48')]=qs[_0x0b8a('0x40')](_[_0x0b8a('0x49')](_0x5b2a9a[_0x0b8a('0x3e')],_0x3475cb[_0x0b8a('0x40')]),_0x1124a7);if(_0x5b2a9a['query'][_0x0b8a('0x4a')]){_0x131e4a['where']=_['merge'](_0x131e4a['where'],{'$or':_['map'](_0x1124a7,function(_0x4326f5){if(_0x4326f5[_0x0b8a('0x4b')]!==_0x0b8a('0x4c')){var _0x1b5347={};_0x1b5347[_0x4326f5[_0x0b8a('0x35')]]={'$like':'%'+_0x5b2a9a[_0x0b8a('0x3e')]['filter']+'%'};return _0x1b5347;}})});}_0x131e4a=_[_0x0b8a('0x4d')]({},_0x131e4a,_0x5b2a9a['options']);var _0x2ad7da={'where':_0x131e4a['where']};return db[_0x0b8a('0x39')][_0x0b8a('0x29')](_0x2ad7da)[_0x0b8a('0x1c')](function(_0x23b11b){_0x10b1ba[_0x0b8a('0x29')]=_0x23b11b;if(_0x5b2a9a[_0x0b8a('0x3e')]['includeAll']){_0x131e4a[_0x0b8a('0x4e')]=[{'all':!![]}];}return db[_0x0b8a('0x39')][_0x0b8a('0x4f')](_0x131e4a);})[_0x0b8a('0x1c')](function(_0x224b28){_0x10b1ba[_0x0b8a('0x50')]=_0x224b28;return _0x10b1ba;})[_0x0b8a('0x1c')](respondWithFilteredResult(_0x155e18,_0x131e4a))[_0x0b8a('0x25')](handleError(_0x155e18,null));};exports[_0x0b8a('0x51')]=function(_0x3f9efa,_0x965d93){var _0x463526={'raw':![],'where':{'id':_0x3f9efa[_0x0b8a('0x52')]['id']}},_0x53793e={};_0x53793e[_0x0b8a('0x3d')]=_[_0x0b8a('0x3f')](db['VoiceContext'][_0x0b8a('0x3a')]);_0x53793e[_0x0b8a('0x3e')]=_[_0x0b8a('0x3f')](_0x3f9efa['query']);_0x53793e['filtears']=_[_0x0b8a('0x53')](_0x53793e['model'],_0x53793e[_0x0b8a('0x3e')]);_0x463526[_0x0b8a('0x41')]=_[_0x0b8a('0x53')](_0x53793e[_0x0b8a('0x3d')],qs[_0x0b8a('0x42')](_0x3f9efa[_0x0b8a('0x3e')]['fields']));_0x463526['attributes']=_0x463526[_0x0b8a('0x41')][_0x0b8a('0x43')]?_0x463526[_0x0b8a('0x41')]:_0x53793e[_0x0b8a('0x3d')];if(_0x3f9efa['query'][_0x0b8a('0x54')]){_0x463526[_0x0b8a('0x4e')]=[{'all':!![]}];}_0x463526=_[_0x0b8a('0x4d')]({},_0x463526,_0x3f9efa[_0x0b8a('0x55')]);return db[_0x0b8a('0x39')]['find'](_0x463526)[_0x0b8a('0x1c')](handleEntityNotFound(_0x965d93,null))[_0x0b8a('0x1c')](respondWithResult(_0x965d93,null))[_0x0b8a('0x25')](handleError(_0x965d93,null));};exports[_0x0b8a('0x56')]=function(_0x1844a1,_0x436801,_0x16e581){var _0x2d1401;return db[_0x0b8a('0x39')][_0x0b8a('0x56')](_0x1844a1[_0x0b8a('0x57')],{'raw':!![]})[_0x0b8a('0x1c')](function(_0x5108b1){_0x2d1401=_0x5108b1;return db[_0x0b8a('0x39')][_0x0b8a('0x4f')]({'raw':!![]});})['then'](function(_0x2649c8){var _0x13a4ab=fs[_0x0b8a('0x58')](path['join'](config['root'],_0x0b8a('0x59')),_0x0b8a('0x5a'));var _0x206dfb=ejs[_0x0b8a('0x5b')](_0x13a4ab,{'contexts':_0x2649c8||[]});fs[_0x0b8a('0x5c')](_0x0b8a('0x5d'),_0x206dfb);})[_0x0b8a('0x1c')](function(){return respondWithRpcPromise(_0x0b8a('0x5e'),_0x0b8a('0x56'),{'module':'chan_sip.so'});})['then'](function(){var _0x28ce9f=_0x1844a1[_0x0b8a('0x5f')]['get']({'plain':!![]});if(!_0x28ce9f)throw new Error(_0x0b8a('0x60'));if(_0x28ce9f[_0x0b8a('0x61')]===_0x0b8a('0x5f')){var _0x3eeb7c=_0x2d1401[_0x0b8a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x0b8a('0x62')]({'where':{'name':_0x0b8a('0x63'),'userProfileId':_0x28ce9f['userProfileId']},'raw':!![]})[_0x0b8a('0x1c')](function(_0x3098df){if(_0x3098df&&_0x3098df[_0x0b8a('0x64')]===0x0){return db[_0x0b8a('0x33')]['create']({'name':_0x3eeb7c[_0x0b8a('0x35')],'resourceId':_0x3eeb7c['id'],'type':_0x3098df['name'],'sectionId':_0x3098df['id']},{})['then'](function(){return _0x2d1401;});}else{return _0x2d1401;}})[_0x0b8a('0x25')](function(_0x22061c){logger[_0x0b8a('0x20')](_0x0b8a('0x65'),_0x22061c);throw _0x22061c;});}return _0x2d1401;})['then'](respondWithResult(_0x436801,0xc9))[_0x0b8a('0x25')](handleError(_0x436801,null));};exports[_0x0b8a('0x30')]=function(_0x2e5b75,_0x4cfda8,_0x4bd3a9){var _0x366775;return db[_0x0b8a('0x39')][_0x0b8a('0x62')]({'where':{'id':_0x2e5b75['params']['id']}})[_0x0b8a('0x1c')](handleEntityNotFound(_0x4cfda8,null))[_0x0b8a('0x1c')](saveUpdates(_0x2e5b75[_0x0b8a('0x57')],null))['then'](function(_0x32c361){if(_0x32c361){_0x366775=_0x32c361;return db[_0x0b8a('0x39')][_0x0b8a('0x4f')]({'raw':!![]});}})[_0x0b8a('0x1c')](function(_0x4de566){var _0x24e68c=fs['readFileSync'](path[_0x0b8a('0x66')](config[_0x0b8a('0x67')],'server/files/templates/context.ejs'),_0x0b8a('0x5a'));var _0x237f3f=ejs[_0x0b8a('0x5b')](_0x24e68c,{'contexts':_0x4de566||[]});fs[_0x0b8a('0x5c')](_0x0b8a('0x5d'),_0x237f3f);})[_0x0b8a('0x1c')](function(){return respondWithRpcPromise(_0x0b8a('0x5e'),_0x0b8a('0x30'),{'module':_0x0b8a('0x68')});})[_0x0b8a('0x1c')](function(){return _0x366775;})[_0x0b8a('0x1c')](respondWithResult(_0x4cfda8,null))['catch'](handleError(_0x4cfda8,null));};exports[_0x0b8a('0x31')]=function(_0x37aef0,_0x2912de,_0x1b8684){var _0x5a2aeb;return db[_0x0b8a('0x39')][_0x0b8a('0x62')]({'where':{'id':_0x37aef0[_0x0b8a('0x52')]['id']}})[_0x0b8a('0x1c')](handleEntityNotFound(_0x2912de,null))['then'](removeEntity(_0x2912de,null))[_0x0b8a('0x1c')](function(){return db[_0x0b8a('0x39')][_0x0b8a('0x4f')]({'raw':!![]});})['then'](function(_0x1c9627){var _0x5e1a52=fs[_0x0b8a('0x58')](path[_0x0b8a('0x66')](config[_0x0b8a('0x67')],'server/files/templates/context.ejs'),_0x0b8a('0x5a'));var _0x16ae30=ejs['render'](_0x5e1a52,{'contexts':_0x1c9627});fs[_0x0b8a('0x5c')](_0x0b8a('0x5d'),_0x16ae30);return respondWithRpcPromise(_0x0b8a('0x5e'),_0x0b8a('0x31'),{'module':'chan_sip.so'});})[_0x0b8a('0x25')](handleError(_0x2912de,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 28cdb9d..f5d404f 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 _0xbf3a=['VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbf3a,0x106));var _0xabf3=function(_0xf61c79,_0x43c6fa){_0xf61c79=_0xf61c79-0x0;var _0x127d26=_0xbf3a[_0xf61c79];return _0x127d26;};'use strict';var _=require(_0xabf3('0x0'));var util=require('util');var logger=require(_0xabf3('0x1'))(_0xabf3('0x2'));var moment=require(_0xabf3('0x3'));var BPromise=require(_0xabf3('0x4'));var rp=require(_0xabf3('0x5'));var fs=require('fs');var path=require(_0xabf3('0x6'));var rimraf=require('rimraf');var config=require(_0xabf3('0x7'));var attributes=require(_0xabf3('0x8'));module[_0xabf3('0x9')]=function(_0x5c6480,_0x94cb47){return _0x5c6480[_0xabf3('0xa')](_0xabf3('0xb'),attributes,{'tableName':_0xabf3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1f4=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','lodash'];(function(_0x60183d,_0x3958a0){var _0x5ea493=function(_0x1d174a){while(--_0x1d174a){_0x60183d['push'](_0x60183d['shift']());}};_0x5ea493(++_0x3958a0);}(_0xa1f4,0xb3));var _0x4a1f=function(_0x2509da,_0x211e70){_0x2509da=_0x2509da-0x0;var _0x163ade=_0xa1f4[_0x2509da];return _0x163ade;};'use strict';var _=require(_0x4a1f('0x0'));var util=require(_0x4a1f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4a1f('0x2'));var BPromise=require(_0x4a1f('0x3'));var rp=require(_0x4a1f('0x4'));var fs=require('fs');var path=require(_0x4a1f('0x5'));var rimraf=require(_0x4a1f('0x6'));var config=require(_0x4a1f('0x7'));var attributes=require(_0x4a1f('0x8'));module['exports']=function(_0x3c341e,_0x53a76c){return _0x3c341e[_0x4a1f('0x9')](_0x4a1f('0xa'),attributes,{'tableName':_0x4a1f('0xb'),'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 037d230..caa771a 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 _0x85c8=['jayson/promise','client','http','request','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x20243d,_0x576688){var _0x259414=function(_0x109a68){while(--_0x109a68){_0x20243d['push'](_0x20243d['shift']());}};_0x259414(++_0x576688);}(_0x85c8,0x129));var _0x885c=function(_0xa7d066,_0x402b76){_0xa7d066=_0xa7d066-0x0;var _0x19bdad=_0x85c8[_0xa7d066];return _0x19bdad;};'use strict';var _=require(_0x885c('0x0'));var util=require('util');var moment=require(_0x885c('0x1'));var BPromise=require('bluebird');var rs=require(_0x885c('0x2'));var fs=require('fs');var Redis=require(_0x885c('0x3'));var db=require(_0x885c('0x4'))['db'];var utils=require(_0x885c('0x5'));var logger=require('../../config/logger')(_0x885c('0x6'));var config=require('../../config/environment');var jayson=require(_0x885c('0x7'));var client=jayson[_0x885c('0x8')][_0x885c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23e39,_0x26b331,_0x4b8157){return new BPromise(function(_0x2389d7,_0x3edd6e){return client[_0x885c('0xa')](_0x23e39,_0x4b8157)['then'](function(_0x539d12){logger['info'](_0x885c('0xb'),_0x26b331,_0x885c('0xc'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x26b331,'request\x20sent',JSON[_0x885c('0xd')](_0x539d12));if(_0x539d12[_0x885c('0xe')]){if(_0x539d12['error']['code']===0x1f4){logger['error'](_0x885c('0xb'),_0x26b331,_0x539d12[_0x885c('0xe')][_0x885c('0xf')]);return _0x3edd6e(_0x539d12[_0x885c('0xe')][_0x885c('0xf')]);}logger[_0x885c('0xe')](_0x885c('0xb'),_0x26b331,_0x539d12[_0x885c('0xe')][_0x885c('0xf')]);return _0x2389d7(_0x539d12[_0x885c('0xe')][_0x885c('0xf')]);}else{logger[_0x885c('0x10')](_0x885c('0xb'),_0x26b331,'request\x20sent');_0x2389d7(_0x539d12[_0x885c('0x11')][_0x885c('0xf')]);}})[_0x885c('0x12')](function(_0x444dc6){logger[_0x885c('0xe')](_0x885c('0xb'),_0x26b331,_0x444dc6);_0x3edd6e(_0x444dc6);});});} \ No newline at end of file +var _0x6423=['client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xccab02,_0x2713da){var _0x37f775=function(_0x1e68bc){while(--_0x1e68bc){_0xccab02['push'](_0xccab02['shift']());}};_0x37f775(++_0x2713da);}(_0x6423,0x15c));var _0x3642=function(_0xb34885,_0x255970){_0xb34885=_0xb34885-0x0;var _0x591afc=_0x6423[_0xb34885];return _0x591afc;};'use strict';var _=require(_0x3642('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3642('0x1'));var rs=require(_0x3642('0x2'));var fs=require('fs');var Redis=require(_0x3642('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3642('0x4'));var logger=require(_0x3642('0x5'))(_0x3642('0x6'));var config=require(_0x3642('0x7'));var jayson=require(_0x3642('0x8'));var client=jayson[_0x3642('0x9')][_0x3642('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f10f,_0x380092,_0x5b0e08){return new BPromise(function(_0x4b2530,_0x223c4e){return client[_0x3642('0xb')](_0x28f10f,_0x5b0e08)['then'](function(_0x58f815){logger[_0x3642('0xc')](_0x3642('0xd'),_0x380092,_0x3642('0xe'));logger[_0x3642('0xf')](_0x3642('0x10'),_0x380092,_0x3642('0xe'),JSON['stringify'](_0x58f815));if(_0x58f815[_0x3642('0x11')]){if(_0x58f815[_0x3642('0x11')][_0x3642('0x12')]===0x1f4){logger[_0x3642('0x11')](_0x3642('0xd'),_0x380092,_0x58f815[_0x3642('0x11')]['message']);return _0x223c4e(_0x58f815['error'][_0x3642('0x13')]);}logger[_0x3642('0x11')]('VoiceContext,\x20%s,\x20%s',_0x380092,_0x58f815[_0x3642('0x11')]['message']);return _0x4b2530(_0x58f815[_0x3642('0x11')][_0x3642('0x13')]);}else{logger[_0x3642('0xc')](_0x3642('0xd'),_0x380092,'request\x20sent');_0x4b2530(_0x58f815['result'][_0x3642('0x13')]);}})[_0x3642('0x14')](function(_0xb72917){logger['error'](_0x3642('0xd'),_0x380092,_0xb72917);_0x223c4e(_0xb72917);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 9e338dd..f26ce63 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 _0x723a=['connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','exports','multer','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x723a,0x8d));var _0xa723=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x723a[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xa723('0x0'));var util=require(_0xa723('0x1'));var path=require(_0xa723('0x2'));var timeout=require(_0xa723('0x3'));var express=require(_0xa723('0x4'));var router=express['Router']();var auth=require(_0xa723('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa723('0x6'));var controller=require('./voiceDialReport.controller');router[_0xa723('0x7')]('/',auth[_0xa723('0x8')](),controller[_0xa723('0x9')]);router[_0xa723('0x7')](_0xa723('0xa'),auth[_0xa723('0x8')](),controller[_0xa723('0xb')]);router['get']('/:id',auth[_0xa723('0x8')](),controller[_0xa723('0xc')]);router[_0xa723('0xd')]('/',auth[_0xa723('0x8')](),controller[_0xa723('0xe')]);router[_0xa723('0xf')](_0xa723('0x10'),auth[_0xa723('0x8')](),controller['update']);router['delete'](_0xa723('0x10'),auth[_0xa723('0x8')](),controller['destroy']);module[_0xa723('0x11')]=router; \ No newline at end of file +var _0x0b31=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','/:id','show','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x165875,_0x1d1ac4){var _0xcd6f20=function(_0x3197e9){while(--_0x3197e9){_0x165875['push'](_0x165875['shift']());}};_0xcd6f20(++_0x1d1ac4);}(_0x0b31,0xdd));var _0x10b3=function(_0x14d536,_0x29293c){_0x14d536=_0x14d536-0x0;var _0x163ae3=_0x0b31[_0x14d536];return _0x163ae3;};'use strict';var multer=require(_0x10b3('0x0'));var util=require(_0x10b3('0x1'));var path=require(_0x10b3('0x2'));var timeout=require(_0x10b3('0x3'));var express=require(_0x10b3('0x4'));var router=express[_0x10b3('0x5')]();var auth=require(_0x10b3('0x6'));var interaction=require(_0x10b3('0x7'));var config=require(_0x10b3('0x8'));var controller=require(_0x10b3('0x9'));router['get']('/',auth[_0x10b3('0xa')](),controller[_0x10b3('0xb')]);router[_0x10b3('0xc')](_0x10b3('0xd'),auth[_0x10b3('0xa')](),controller['describe']);router[_0x10b3('0xc')](_0x10b3('0xe'),auth[_0x10b3('0xa')](),controller[_0x10b3('0xf')]);router['post']('/',auth[_0x10b3('0xa')](),controller['create']);router[_0x10b3('0x10')](_0x10b3('0xe'),auth[_0x10b3('0xa')](),controller['update']);router[_0x10b3('0x11')]('/:id',auth[_0x10b3('0xa')](),controller[_0x10b3('0x12')]);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 d9383b5..fbc36a2 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 _0xf749=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x3413c1,_0x3bc4b1){var _0x363ec0=function(_0x5f376a){while(--_0x5f376a){_0x3413c1['push'](_0x3413c1['shift']());}};_0x363ec0(++_0x3bc4b1);}(_0xf749,0xb6));var _0x9f74=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xf749[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x9f74('0x0'));module[_0x9f74('0x1')]={'privilege':{'type':Sequelize[_0x9f74('0x2')]},'channel':{'type':Sequelize[_0x9f74('0x2')]},'channelstate':{'type':Sequelize[_0x9f74('0x3')]},'channelstatedesc':{'type':Sequelize[_0x9f74('0x2')]},'calleridnum':{'type':Sequelize[_0x9f74('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9f74('0x2')]},'language':{'type':Sequelize[_0x9f74('0x2')]},'accountcode':{'type':Sequelize[_0x9f74('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9f74('0x2')]},'priority':{'type':Sequelize[_0x9f74('0x3')]},'uniqueid':{'type':Sequelize[_0x9f74('0x2')]},'linkedid':{'type':Sequelize[_0x9f74('0x2')]},'destchannel':{'type':Sequelize[_0x9f74('0x2')]},'destchannelstate':{'type':Sequelize[_0x9f74('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x9f74('0x2')]},'destcalleridname':{'type':Sequelize[_0x9f74('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9f74('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9f74('0x2')]},'destlanguage':{'type':Sequelize[_0x9f74('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9f74('0x2')]},'destexten':{'type':Sequelize[_0x9f74('0x2')]},'destpriority':{'type':Sequelize[_0x9f74('0x3')]},'destuniqueid':{'type':Sequelize[_0x9f74('0x2')]},'destlinkedid':{'type':Sequelize[_0x9f74('0x2')]},'dialstring':{'type':Sequelize[_0x9f74('0x2')]},'dialstatus':{'type':Sequelize[_0x9f74('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x9f74('0x4')]},'endtime':{'type':Sequelize[_0x9f74('0x4')]},'lastevent':{'type':Sequelize[_0x9f74('0x2')],'comment':_0x9f74('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9f74('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x141c=['INTEGER','DATE','called,connect,complete','STRING'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x141c,0x83));var _0xc141=function(_0x51a98a,_0x882993){_0x51a98a=_0x51a98a-0x0;var _0x58d0a6=_0x141c[_0x51a98a];return _0x58d0a6;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0xc141('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc141('0x1')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc141('0x0')]},'calleridname':{'type':Sequelize[_0xc141('0x0')]},'connectedlinenum':{'type':Sequelize[_0xc141('0x0')]},'connectedlinename':{'type':Sequelize[_0xc141('0x0')]},'language':{'type':Sequelize[_0xc141('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc141('0x1')]},'uniqueid':{'type':Sequelize[_0xc141('0x0')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc141('0x0')]},'destchannelstate':{'type':Sequelize[_0xc141('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0xc141('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc141('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xc141('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xc141('0x0')]},'destlanguage':{'type':Sequelize[_0xc141('0x0')]},'destaccountcode':{'type':Sequelize[_0xc141('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xc141('0x0')]},'dialstring':{'type':Sequelize[_0xc141('0x0')]},'dialstatus':{'type':Sequelize[_0xc141('0x0')]},'starttime':{'type':Sequelize[_0xc141('0x2')]},'answertime':{'type':Sequelize[_0xc141('0x2')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xc141('0x0')],'comment':_0xc141('0x3')},'routeId':{'type':Sequelize[_0xc141('0x1')]},'duration':{'type':Sequelize[_0xc141('0x1')]},'holdtime':{'type':Sequelize[_0xc141('0x1')]},'billableseconds':{'type':Sequelize[_0xc141('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 68a2c1b..e468840 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 _0x9196=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','VoiceDialReport','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filtears','length','find','body','describe','eml-format','rimraf'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9196,0x1c0));var _0x6919=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x9196[_0x587693];return _0x510a1a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6919('0x0'));var rimraf=require(_0x6919('0x1'));var zipdir=require(_0x6919('0x2'));var jsonpatch=require(_0x6919('0x3'));var rp=require(_0x6919('0x4'));var moment=require(_0x6919('0x5'));var BPromise=require(_0x6919('0x6'));var Mustache=require('mustache');var util=require(_0x6919('0x7'));var path=require('path');var sox=require(_0x6919('0x8'));var csv=require(_0x6919('0x9'));var ejs=require(_0x6919('0xa'));var fs=require('fs');var _=require(_0x6919('0xb'));var squel=require(_0x6919('0xc'));var crypto=require(_0x6919('0xd'));var jsforce=require(_0x6919('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6919('0x9'));var querystring=require(_0x6919('0xf'));var Papa=require(_0x6919('0x10'));var Redis=require(_0x6919('0x11'));var authService=require(_0x6919('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6919('0x13'));var hardwareService=require(_0x6919('0x14'));var logger=require(_0x6919('0x15'))(_0x6919('0x16'));var utils=require(_0x6919('0x17'));var config=require(_0x6919('0x18'));var licenseUtil=require(_0x6919('0x19'));var db=require(_0x6919('0x1a'))['db'];function respondWithStatusCode(_0x42d483,_0x13b79e){_0x13b79e=_0x13b79e||0xcc;return function(_0x4e57eb){if(_0x4e57eb){return _0x42d483[_0x6919('0x1b')](_0x13b79e);}return _0x42d483['status'](_0x13b79e)[_0x6919('0x1c')]();};}function respondWithResult(_0x13d4e1,_0x806818){_0x806818=_0x806818||0xc8;return function(_0x29024e){if(_0x29024e){return _0x13d4e1[_0x6919('0x1d')](_0x806818)[_0x6919('0x1e')](_0x29024e);}};}function respondWithFilteredResult(_0x323018,_0x183397){return function(_0x51a212){if(_0x51a212){var _0x6f7161=_0x51a212[_0x6919('0x1f')],_0x37640b=_0x183397[_0x6919('0x20')],_0x5f4341=_0x183397[_0x6919('0x20')]+_0x183397[_0x6919('0x21')],_0x5db40e;if(_0x5f4341>=_0x6f7161){_0x5f4341=_0x6f7161;_0x5db40e=0xc8;}else{_0x5db40e=0xce;}_0x323018[_0x6919('0x1d')](_0x5db40e);return _0x323018['set'](_0x6919('0x22'),_0x37640b+'-'+_0x5f4341+'/'+_0x6f7161)[_0x6919('0x1e')](_0x51a212);}return null;};}function patchUpdates(_0x5a34c0){return function(_0x533cb1){try{jsonpatch[_0x6919('0x23')](_0x533cb1,_0x5a34c0,!![]);}catch(_0x2a94fb){return BPromise[_0x6919('0x24')](_0x2a94fb);}return _0x533cb1[_0x6919('0x25')]();};}function saveUpdates(_0x4db777,_0x335f06){return function(_0x456aeb){if(_0x456aeb){return _0x456aeb[_0x6919('0x26')](_0x4db777)[_0x6919('0x27')](function(_0x8689b0){return _0x8689b0;});}return null;};}function removeEntity(_0x4509a4,_0x14cf4f){return function(_0x393e7f){if(_0x393e7f){return _0x393e7f['destroy']()[_0x6919('0x27')](function(){_0x4509a4[_0x6919('0x1d')](0xcc)[_0x6919('0x1c')]();});}};}function handleEntityNotFound(_0xf4912c,_0x37c098){return function(_0x498bdb){if(!_0x498bdb){_0xf4912c['sendStatus'](0x194);}return _0x498bdb;};}function handleError(_0x92eff3,_0x58f995){_0x58f995=_0x58f995||0x1f4;return function(_0x14a669){logger[_0x6919('0x28')](_0x14a669[_0x6919('0x29')]);if(_0x14a669[_0x6919('0x2a')]){delete _0x14a669[_0x6919('0x2a')];}_0x92eff3[_0x6919('0x1d')](_0x58f995)['send'](_0x14a669);};}exports[_0x6919('0x2b')]=function(_0x41d10b,_0x5c3f1d){var _0x2b1649={},_0x4b0d21={},_0x3ec97c={'count':0x0,'rows':[]};var _0x3551de=_['map'](db[_0x6919('0x2c')][_0x6919('0x2d')],function(_0x47d5f9){return{'name':_0x47d5f9['fieldName'],'type':_0x47d5f9['type'][_0x6919('0x2e')]};});_0x4b0d21['model']=_[_0x6919('0x2f')](_0x3551de,'name');_0x4b0d21[_0x6919('0x30')]=_[_0x6919('0x31')](_0x41d10b[_0x6919('0x30')]);_0x4b0d21[_0x6919('0x32')]=_[_0x6919('0x33')](_0x4b0d21[_0x6919('0x34')],_0x4b0d21['query']);_0x2b1649[_0x6919('0x35')]=_['intersection'](_0x4b0d21[_0x6919('0x34')],qs[_0x6919('0x36')](_0x41d10b[_0x6919('0x30')]['fields']));_0x2b1649['attributes']=_0x2b1649[_0x6919('0x35')]['length']?_0x2b1649['attributes']:_0x4b0d21['model'];if(!_0x41d10b[_0x6919('0x30')][_0x6919('0x37')](_0x6919('0x38'))){_0x2b1649[_0x6919('0x21')]=qs['limit'](_0x41d10b['query'][_0x6919('0x21')]);_0x2b1649[_0x6919('0x20')]=qs[_0x6919('0x20')](_0x41d10b[_0x6919('0x30')][_0x6919('0x20')]);}_0x2b1649[_0x6919('0x39')]=qs[_0x6919('0x3a')](_0x41d10b[_0x6919('0x30')][_0x6919('0x3a')]);_0x2b1649[_0x6919('0x3b')]=qs['filters'](_['pick'](_0x41d10b['query'],_0x4b0d21['filters']),_0x3551de);if(_0x41d10b[_0x6919('0x30')][_0x6919('0x3c')]){_0x2b1649[_0x6919('0x3b')]=_[_0x6919('0x3d')](_0x2b1649['where'],{'$or':_['map'](_0x3551de,function(_0x319e08){if(_0x319e08['type']!==_0x6919('0x3e')){var _0x1b4cd4={};_0x1b4cd4[_0x319e08[_0x6919('0x2a')]]={'$like':'%'+_0x41d10b[_0x6919('0x30')][_0x6919('0x3c')]+'%'};return _0x1b4cd4;}})});}_0x2b1649=_[_0x6919('0x3d')]({},_0x2b1649,_0x41d10b[_0x6919('0x3f')]);var _0x2a69cf={'where':_0x2b1649[_0x6919('0x3b')]};return db[_0x6919('0x2c')]['count'](_0x2a69cf)[_0x6919('0x27')](function(_0x4dda3a){_0x3ec97c[_0x6919('0x1f')]=_0x4dda3a;if(_0x41d10b[_0x6919('0x30')][_0x6919('0x40')]){_0x2b1649['include']=[{'all':!![]}];}return db['VoiceDialReport'][_0x6919('0x41')](_0x2b1649);})['then'](function(_0x224b07){_0x3ec97c[_0x6919('0x42')]=_0x224b07;return _0x3ec97c;})['then'](respondWithFilteredResult(_0x5c3f1d,_0x2b1649))[_0x6919('0x43')](handleError(_0x5c3f1d,null));};exports[_0x6919('0x44')]=function(_0x2adff5,_0x2bb095){var _0x55beaa={'raw':!![],'where':{'id':_0x2adff5[_0x6919('0x45')]['id']}},_0x35346d={};_0x35346d[_0x6919('0x34')]=_[_0x6919('0x31')](db['VoiceDialReport']['rawAttributes']);_0x35346d['query']=_['keys'](_0x2adff5[_0x6919('0x30')]);_0x35346d[_0x6919('0x46')]=_['intersection'](_0x35346d[_0x6919('0x34')],_0x35346d[_0x6919('0x30')]);_0x55beaa[_0x6919('0x35')]=_['intersection'](_0x35346d[_0x6919('0x34')],qs[_0x6919('0x36')](_0x2adff5[_0x6919('0x30')][_0x6919('0x36')]));_0x55beaa[_0x6919('0x35')]=_0x55beaa[_0x6919('0x35')][_0x6919('0x47')]?_0x55beaa[_0x6919('0x35')]:_0x35346d['model'];if(_0x2adff5['query']['includeAll']){_0x55beaa['include']=[{'all':!![]}];}_0x55beaa=_[_0x6919('0x3d')]({},_0x55beaa,_0x2adff5[_0x6919('0x3f')]);return db[_0x6919('0x2c')][_0x6919('0x48')](_0x55beaa)[_0x6919('0x27')](handleEntityNotFound(_0x2bb095,null))[_0x6919('0x27')](respondWithResult(_0x2bb095,null))[_0x6919('0x43')](handleError(_0x2bb095,null));};exports['create']=function(_0xfe1ff5,_0x2f9016){return db['VoiceDialReport']['create'](_0xfe1ff5[_0x6919('0x49')],{})[_0x6919('0x27')](respondWithResult(_0x2f9016,0xc9))[_0x6919('0x43')](handleError(_0x2f9016,null));};exports[_0x6919('0x26')]=function(_0x1adc1b,_0x24214e){if(_0x1adc1b[_0x6919('0x49')]['id']){delete _0x1adc1b['body']['id'];}return db[_0x6919('0x2c')]['find']({'where':{'id':_0x1adc1b['params']['id']}})[_0x6919('0x27')](handleEntityNotFound(_0x24214e,null))['then'](saveUpdates(_0x1adc1b[_0x6919('0x49')],null))['then'](respondWithResult(_0x24214e,null))[_0x6919('0x43')](handleError(_0x24214e,null));};exports['destroy']=function(_0x19f4f0,_0x5d3ac7){return db[_0x6919('0x2c')][_0x6919('0x48')]({'where':{'id':_0x19f4f0[_0x6919('0x45')]['id']}})[_0x6919('0x27')](handleEntityNotFound(_0x5d3ac7,null))[_0x6919('0x27')](removeEntity(_0x5d3ac7,null))['catch'](handleError(_0x5d3ac7,null));};exports[_0x6919('0x4a')]=function(_0x4b9741,_0x361ac5){return db[_0x6919('0x2c')]['describe']()[_0x6919('0x27')](respondWithResult(_0x361ac5,null))['catch'](handleError(_0x361ac5,null));}; \ No newline at end of file +var _0x8eaf=['path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','merge','options','count','include','findAll','catch','show','filtears','includeAll','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache'];(function(_0x57e77c,_0x450ebd){var _0x482e02=function(_0x2645f3){while(--_0x2645f3){_0x57e77c['push'](_0x57e77c['shift']());}};_0x482e02(++_0x450ebd);}(_0x8eaf,0x1dd));var _0xf8ea=function(_0x197385,_0x26bc49){_0x197385=_0x197385-0x0;var _0x4db795=_0x8eaf[_0x197385];return _0x4db795;};'use strict';var pdf=require(_0xf8ea('0x0'));var emlformat=require(_0xf8ea('0x1'));var rimraf=require(_0xf8ea('0x2'));var zipdir=require(_0xf8ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf8ea('0x4'));var Mustache=require(_0xf8ea('0x5'));var util=require('util');var path=require(_0xf8ea('0x6'));var sox=require(_0xf8ea('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf8ea('0x8'));var squel=require(_0xf8ea('0x9'));var crypto=require(_0xf8ea('0xa'));var jsforce=require(_0xf8ea('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf8ea('0xc'));var querystring=require(_0xf8ea('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf8ea('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf8ea('0xf'));var hardwareService=require(_0xf8ea('0x10'));var logger=require('../../config/logger')(_0xf8ea('0x11'));var utils=require(_0xf8ea('0x12'));var config=require(_0xf8ea('0x13'));var licenseUtil=require(_0xf8ea('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5131,_0x4f669f){_0x4f669f=_0x4f669f||0xcc;return function(_0x4590ab){if(_0x4590ab){return _0x2a5131[_0xf8ea('0x15')](_0x4f669f);}return _0x2a5131[_0xf8ea('0x16')](_0x4f669f)[_0xf8ea('0x17')]();};}function respondWithResult(_0x48614c,_0x36bf8d){_0x36bf8d=_0x36bf8d||0xc8;return function(_0x22c9f6){if(_0x22c9f6){return _0x48614c[_0xf8ea('0x16')](_0x36bf8d)[_0xf8ea('0x18')](_0x22c9f6);}};}function respondWithFilteredResult(_0x45b789,_0x202079){return function(_0x46a00e){if(_0x46a00e){var _0x2df609=_0x46a00e['count'],_0x2e9ce7=_0x202079['offset'],_0x323547=_0x202079[_0xf8ea('0x19')]+_0x202079[_0xf8ea('0x1a')],_0x4c5bfe;if(_0x323547>=_0x2df609){_0x323547=_0x2df609;_0x4c5bfe=0xc8;}else{_0x4c5bfe=0xce;}_0x45b789['status'](_0x4c5bfe);return _0x45b789[_0xf8ea('0x1b')](_0xf8ea('0x1c'),_0x2e9ce7+'-'+_0x323547+'/'+_0x2df609)['json'](_0x46a00e);}return null;};}function patchUpdates(_0x481e12){return function(_0x58c3f5){try{jsonpatch[_0xf8ea('0x1d')](_0x58c3f5,_0x481e12,!![]);}catch(_0x3e4614){return BPromise['reject'](_0x3e4614);}return _0x58c3f5[_0xf8ea('0x1e')]();};}function saveUpdates(_0x2e8643,_0x2f4220){return function(_0x42262c){if(_0x42262c){return _0x42262c[_0xf8ea('0x1f')](_0x2e8643)[_0xf8ea('0x20')](function(_0x4487be){return _0x4487be;});}return null;};}function removeEntity(_0x3821c7,_0xf143b6){return function(_0x450b63){if(_0x450b63){return _0x450b63['destroy']()[_0xf8ea('0x20')](function(){_0x3821c7[_0xf8ea('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38b99d,_0xa74b2a){return function(_0x4f5b3d){if(!_0x4f5b3d){_0x38b99d[_0xf8ea('0x15')](0x194);}return _0x4f5b3d;};}function handleError(_0x213639,_0x5a2f1a){_0x5a2f1a=_0x5a2f1a||0x1f4;return function(_0x3f42c0){logger[_0xf8ea('0x21')](_0x3f42c0[_0xf8ea('0x22')]);if(_0x3f42c0[_0xf8ea('0x23')]){delete _0x3f42c0['name'];}_0x213639['status'](_0x5a2f1a)[_0xf8ea('0x24')](_0x3f42c0);};}exports[_0xf8ea('0x25')]=function(_0x59a5c7,_0xd1f8c2){var _0x5ed31b={},_0x511113={},_0x5e76fa={'count':0x0,'rows':[]};var _0x35711c=_[_0xf8ea('0x26')](db[_0xf8ea('0x27')][_0xf8ea('0x28')],function(_0x3b22e7){return{'name':_0x3b22e7['fieldName'],'type':_0x3b22e7[_0xf8ea('0x29')][_0xf8ea('0x2a')]};});_0x511113[_0xf8ea('0x2b')]=_[_0xf8ea('0x26')](_0x35711c,_0xf8ea('0x23'));_0x511113[_0xf8ea('0x2c')]=_[_0xf8ea('0x2d')](_0x59a5c7[_0xf8ea('0x2c')]);_0x511113[_0xf8ea('0x2e')]=_[_0xf8ea('0x2f')](_0x511113['model'],_0x511113[_0xf8ea('0x2c')]);_0x5ed31b[_0xf8ea('0x30')]=_[_0xf8ea('0x2f')](_0x511113['model'],qs[_0xf8ea('0x31')](_0x59a5c7[_0xf8ea('0x2c')]['fields']));_0x5ed31b[_0xf8ea('0x30')]=_0x5ed31b[_0xf8ea('0x30')]['length']?_0x5ed31b[_0xf8ea('0x30')]:_0x511113['model'];if(!_0x59a5c7['query']['hasOwnProperty']('nolimit')){_0x5ed31b['limit']=qs['limit'](_0x59a5c7[_0xf8ea('0x2c')][_0xf8ea('0x1a')]);_0x5ed31b[_0xf8ea('0x19')]=qs['offset'](_0x59a5c7[_0xf8ea('0x2c')][_0xf8ea('0x19')]);}_0x5ed31b['order']=qs[_0xf8ea('0x32')](_0x59a5c7[_0xf8ea('0x2c')]['sort']);_0x5ed31b[_0xf8ea('0x33')]=qs[_0xf8ea('0x2e')](_[_0xf8ea('0x34')](_0x59a5c7[_0xf8ea('0x2c')],_0x511113[_0xf8ea('0x2e')]),_0x35711c);if(_0x59a5c7[_0xf8ea('0x2c')][_0xf8ea('0x35')]){_0x5ed31b[_0xf8ea('0x33')]=_[_0xf8ea('0x36')](_0x5ed31b[_0xf8ea('0x33')],{'$or':_['map'](_0x35711c,function(_0x3b2128){if(_0x3b2128[_0xf8ea('0x29')]!=='VIRTUAL'){var _0x542244={};_0x542244[_0x3b2128[_0xf8ea('0x23')]]={'$like':'%'+_0x59a5c7['query'][_0xf8ea('0x35')]+'%'};return _0x542244;}})});}_0x5ed31b=_[_0xf8ea('0x36')]({},_0x5ed31b,_0x59a5c7[_0xf8ea('0x37')]);var _0x22853f={'where':_0x5ed31b[_0xf8ea('0x33')]};return db['VoiceDialReport']['count'](_0x22853f)[_0xf8ea('0x20')](function(_0x554c9e){_0x5e76fa[_0xf8ea('0x38')]=_0x554c9e;if(_0x59a5c7[_0xf8ea('0x2c')]['includeAll']){_0x5ed31b[_0xf8ea('0x39')]=[{'all':!![]}];}return db[_0xf8ea('0x27')][_0xf8ea('0x3a')](_0x5ed31b);})[_0xf8ea('0x20')](function(_0x56dce9){_0x5e76fa['rows']=_0x56dce9;return _0x5e76fa;})[_0xf8ea('0x20')](respondWithFilteredResult(_0xd1f8c2,_0x5ed31b))[_0xf8ea('0x3b')](handleError(_0xd1f8c2,null));};exports[_0xf8ea('0x3c')]=function(_0xc5cb84,_0x33d76a){var _0x7927ab={'raw':!![],'where':{'id':_0xc5cb84['params']['id']}},_0x5af5b2={};_0x5af5b2[_0xf8ea('0x2b')]=_[_0xf8ea('0x2d')](db[_0xf8ea('0x27')][_0xf8ea('0x28')]);_0x5af5b2[_0xf8ea('0x2c')]=_[_0xf8ea('0x2d')](_0xc5cb84[_0xf8ea('0x2c')]);_0x5af5b2[_0xf8ea('0x3d')]=_[_0xf8ea('0x2f')](_0x5af5b2[_0xf8ea('0x2b')],_0x5af5b2['query']);_0x7927ab['attributes']=_[_0xf8ea('0x2f')](_0x5af5b2['model'],qs[_0xf8ea('0x31')](_0xc5cb84[_0xf8ea('0x2c')][_0xf8ea('0x31')]));_0x7927ab[_0xf8ea('0x30')]=_0x7927ab['attributes']['length']?_0x7927ab['attributes']:_0x5af5b2[_0xf8ea('0x2b')];if(_0xc5cb84[_0xf8ea('0x2c')][_0xf8ea('0x3e')]){_0x7927ab[_0xf8ea('0x39')]=[{'all':!![]}];}_0x7927ab=_[_0xf8ea('0x36')]({},_0x7927ab,_0xc5cb84['options']);return db['VoiceDialReport']['find'](_0x7927ab)[_0xf8ea('0x20')](handleEntityNotFound(_0x33d76a,null))[_0xf8ea('0x20')](respondWithResult(_0x33d76a,null))[_0xf8ea('0x3b')](handleError(_0x33d76a,null));};exports[_0xf8ea('0x3f')]=function(_0x2c6611,_0x41d8c9){return db[_0xf8ea('0x27')][_0xf8ea('0x3f')](_0x2c6611[_0xf8ea('0x40')],{})[_0xf8ea('0x20')](respondWithResult(_0x41d8c9,0xc9))[_0xf8ea('0x3b')](handleError(_0x41d8c9,null));};exports['update']=function(_0x36c11b,_0x548c7c){if(_0x36c11b[_0xf8ea('0x40')]['id']){delete _0x36c11b[_0xf8ea('0x40')]['id'];}return db['VoiceDialReport'][_0xf8ea('0x41')]({'where':{'id':_0x36c11b[_0xf8ea('0x42')]['id']}})[_0xf8ea('0x20')](handleEntityNotFound(_0x548c7c,null))['then'](saveUpdates(_0x36c11b[_0xf8ea('0x40')],null))[_0xf8ea('0x20')](respondWithResult(_0x548c7c,null))[_0xf8ea('0x3b')](handleError(_0x548c7c,null));};exports[_0xf8ea('0x43')]=function(_0x31f523,_0x399344){return db[_0xf8ea('0x27')]['find']({'where':{'id':_0x31f523[_0xf8ea('0x42')]['id']}})['then'](handleEntityNotFound(_0x399344,null))[_0xf8ea('0x20')](removeEntity(_0x399344,null))[_0xf8ea('0x3b')](handleError(_0x399344,null));};exports['describe']=function(_0x561e7d,_0x30e3d6){return db[_0xf8ea('0x27')][_0xf8ea('0x44')]()[_0xf8ea('0x20')](respondWithResult(_0x30e3d6,null))[_0xf8ea('0x3b')](handleError(_0x30e3d6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a12ba5b..f7e72b3 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 _0x746c=['lodash','util','api','moment','bluebird','request-promise','path','exports','define','VoiceDialReport','uniqueid'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x746c,0x181));var _0xc746=function(_0x5847af,_0x20ec5a){_0x5847af=_0x5847af-0x0;var _0x388b22=_0x746c[_0x5847af];return _0x388b22;};'use strict';var _=require(_0xc746('0x0'));var util=require(_0xc746('0x1'));var logger=require('../../config/logger')(_0xc746('0x2'));var moment=require(_0xc746('0x3'));var BPromise=require(_0xc746('0x4'));var rp=require(_0xc746('0x5'));var fs=require('fs');var path=require(_0xc746('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0xc746('0x7')]=function(_0x3ec710,_0x3c1486){return _0x3ec710[_0xc746('0x8')](_0xc746('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xc746('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd18a=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x17b2e8,_0x50be46){var _0x409e24=function(_0x54ca25){while(--_0x54ca25){_0x17b2e8['push'](_0x17b2e8['shift']());}};_0x409e24(++_0x50be46);}(_0xd18a,0x14c));var _0xad18=function(_0x4ebc03,_0x16c602){_0x4ebc03=_0x4ebc03-0x0;var _0x5053f2=_0xd18a[_0x4ebc03];return _0x5053f2;};'use strict';var _=require(_0xad18('0x0'));var util=require(_0xad18('0x1'));var logger=require(_0xad18('0x2'))(_0xad18('0x3'));var moment=require(_0xad18('0x4'));var BPromise=require(_0xad18('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xad18('0x6'));var config=require(_0xad18('0x7'));var attributes=require(_0xad18('0x8'));module[_0xad18('0x9')]=function(_0x12a3fe,_0x575ed8){return _0x12a3fe['define'](_0xad18('0xa'),attributes,{'tableName':_0xad18('0xb'),'paranoid':![],'indexes':[{'fields':[_0xad18('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 4fe9133..2684da6 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 _0xef2a=['catch','CreateVoiceDialReport','create','options','raw','then','VoiceDialReport','update','body','where','limit','UpdateVoiceDialReport','util','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x5f22b9,_0x1883c7){var _0x47327d=function(_0x2be614){while(--_0x2be614){_0x5f22b9['push'](_0x5f22b9['shift']());}};_0x47327d(++_0x1883c7);}(_0xef2a,0x168));var _0xaef2=function(_0x5328bc,_0x45bfb7){_0x5328bc=_0x5328bc-0x0;var _0x43e559=_0xef2a[_0x5328bc];return _0x43e559;};'use strict';var _=require('lodash');var util=require(_0xaef2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaef2('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xaef2('0x2'));var logger=require('../../config/logger')(_0xaef2('0x3'));var config=require(_0xaef2('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xaef2('0x5')][_0xaef2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2c89d7,_0x34eebe,_0x34f3a9){return new BPromise(function(_0x22737b,_0x9e7aa0){return client[_0xaef2('0x7')](_0x2c89d7,_0x34f3a9)['then'](function(_0x40f3d1){logger['info'](_0xaef2('0x8'),_0x34eebe,_0xaef2('0x9'));logger[_0xaef2('0xa')](_0xaef2('0xb'),_0x34eebe,_0xaef2('0x9'),JSON[_0xaef2('0xc')](_0x40f3d1));if(_0x40f3d1[_0xaef2('0xd')]){if(_0x40f3d1[_0xaef2('0xd')]['code']===0x1f4){logger[_0xaef2('0xd')](_0xaef2('0x8'),_0x34eebe,_0x40f3d1['error'][_0xaef2('0xe')]);return _0x9e7aa0(_0x40f3d1[_0xaef2('0xd')]['message']);}logger[_0xaef2('0xd')](_0xaef2('0x8'),_0x34eebe,_0x40f3d1[_0xaef2('0xd')][_0xaef2('0xe')]);return _0x22737b(_0x40f3d1[_0xaef2('0xd')]['message']);}else{logger[_0xaef2('0xf')](_0xaef2('0x8'),_0x34eebe,_0xaef2('0x9'));_0x22737b(_0x40f3d1[_0xaef2('0x10')]['message']);}})[_0xaef2('0x11')](function(_0x2155ca){logger[_0xaef2('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x34eebe,_0x2155ca);_0x9e7aa0(_0x2155ca);});});}exports[_0xaef2('0x12')]=function(_0x5a00f7){var _0x42e6f6=this;return new Promise(function(_0x3b7aa6,_0x2a21e9){return db['VoiceDialReport'][_0xaef2('0x13')](_0x5a00f7['body'],{'raw':_0x5a00f7[_0xaef2('0x14')]?_0x5a00f7[_0xaef2('0x14')][_0xaef2('0x15')]===undefined?!![]:![]:!![]})[_0xaef2('0x16')](function(_0x69f194){logger[_0xaef2('0xf')](_0xaef2('0x12'),_0x5a00f7);logger[_0xaef2('0xa')](_0xaef2('0x12'),_0x5a00f7,JSON[_0xaef2('0xc')](_0x69f194));_0x3b7aa6(_0x69f194);})[_0xaef2('0x11')](function(_0x2501f7){logger[_0xaef2('0xd')](_0xaef2('0x12'),_0x2501f7[_0xaef2('0xe')],_0x5a00f7);_0x2a21e9(_0x42e6f6[_0xaef2('0xd')](0x1f4,_0x2501f7[_0xaef2('0xe')]));});});};exports['UpdateVoiceDialReport']=function(_0x48dc91){var _0x252d1d=this;return new Promise(function(_0x4b2846,_0x419d2f){return db[_0xaef2('0x17')][_0xaef2('0x18')](_0x48dc91[_0xaef2('0x19')],{'raw':_0x48dc91[_0xaef2('0x14')]?_0x48dc91[_0xaef2('0x14')][_0xaef2('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48dc91[_0xaef2('0x14')]?_0x48dc91['options'][_0xaef2('0x1a')]||null:null,'attributes':_0x48dc91['options']?_0x48dc91[_0xaef2('0x14')]['attributes']||null:null,'limit':_0x48dc91[_0xaef2('0x14')]?_0x48dc91[_0xaef2('0x14')][_0xaef2('0x1b')]||null:null})[_0xaef2('0x16')](function(_0x1f86ef){logger[_0xaef2('0xf')]('UpdateVoiceDialReport',_0x48dc91);logger[_0xaef2('0xa')]('UpdateVoiceDialReport',_0x48dc91,JSON[_0xaef2('0xc')](_0x1f86ef));_0x4b2846(_0x1f86ef);})[_0xaef2('0x11')](function(_0x50cd2a){logger[_0xaef2('0xd')](_0xaef2('0x1c'),_0x50cd2a[_0xaef2('0xe')],_0x48dc91);_0x419d2f(_0x252d1d[_0xaef2('0xd')](0x1f4,_0x50cd2a[_0xaef2('0xe')]));});});}; \ No newline at end of file +var _0x8354=['debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','options','raw','CreateVoiceDialReport','update','body','where','attributes','UpdateVoiceDialReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2d86c0,_0x2a5555){var _0x21a886=function(_0x9b8357){while(--_0x9b8357){_0x2d86c0['push'](_0x2d86c0['shift']());}};_0x21a886(++_0x2a5555);}(_0x8354,0xc1));var _0x4835=function(_0x1b2382,_0x44d9b2){_0x1b2382=_0x1b2382-0x0;var _0xe44ec4=_0x8354[_0x1b2382];return _0xe44ec4;};'use strict';var _=require(_0x4835('0x0'));var util=require(_0x4835('0x1'));var moment=require(_0x4835('0x2'));var BPromise=require('bluebird');var rs=require(_0x4835('0x3'));var fs=require('fs');var Redis=require(_0x4835('0x4'));var db=require(_0x4835('0x5'))['db'];var utils=require(_0x4835('0x6'));var logger=require(_0x4835('0x7'))(_0x4835('0x8'));var config=require(_0x4835('0x9'));var jayson=require(_0x4835('0xa'));var client=jayson['client'][_0x4835('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dd0d2,_0x153838,_0x185dcf){return new BPromise(function(_0x40974c,_0x31c9cc){return client[_0x4835('0xc')](_0x5dd0d2,_0x185dcf)[_0x4835('0xd')](function(_0x24c1bf){logger[_0x4835('0xe')](_0x4835('0xf'),_0x153838,_0x4835('0x10'));logger[_0x4835('0x11')](_0x4835('0x12'),_0x153838,'request\x20sent',JSON[_0x4835('0x13')](_0x24c1bf));if(_0x24c1bf[_0x4835('0x14')]){if(_0x24c1bf[_0x4835('0x14')][_0x4835('0x15')]===0x1f4){logger['error'](_0x4835('0xf'),_0x153838,_0x24c1bf['error'][_0x4835('0x16')]);return _0x31c9cc(_0x24c1bf['error'][_0x4835('0x16')]);}logger[_0x4835('0x14')](_0x4835('0xf'),_0x153838,_0x24c1bf['error'][_0x4835('0x16')]);return _0x40974c(_0x24c1bf[_0x4835('0x14')][_0x4835('0x16')]);}else{logger[_0x4835('0xe')](_0x4835('0xf'),_0x153838,_0x4835('0x10'));_0x40974c(_0x24c1bf[_0x4835('0x17')][_0x4835('0x16')]);}})[_0x4835('0x18')](function(_0x37e40b){logger[_0x4835('0x14')](_0x4835('0xf'),_0x153838,_0x37e40b);_0x31c9cc(_0x37e40b);});});}exports['CreateVoiceDialReport']=function(_0x3e74cb){var _0xe99fe5=this;return new Promise(function(_0x332ad7,_0x5f16c8){return db[_0x4835('0x19')][_0x4835('0x1a')](_0x3e74cb['body'],{'raw':_0x3e74cb[_0x4835('0x1b')]?_0x3e74cb['options'][_0x4835('0x1c')]===undefined?!![]:![]:!![]})[_0x4835('0xd')](function(_0x314739){logger[_0x4835('0xe')](_0x4835('0x1d'),_0x3e74cb);logger[_0x4835('0x11')]('CreateVoiceDialReport',_0x3e74cb,JSON[_0x4835('0x13')](_0x314739));_0x332ad7(_0x314739);})[_0x4835('0x18')](function(_0x19a84f){logger[_0x4835('0x14')](_0x4835('0x1d'),_0x19a84f[_0x4835('0x16')],_0x3e74cb);_0x5f16c8(_0xe99fe5[_0x4835('0x14')](0x1f4,_0x19a84f[_0x4835('0x16')]));});});};exports['UpdateVoiceDialReport']=function(_0x33de29){var _0x3f2996=this;return new Promise(function(_0x42d972,_0x1596be){return db[_0x4835('0x19')][_0x4835('0x1e')](_0x33de29[_0x4835('0x1f')],{'raw':_0x33de29[_0x4835('0x1b')]?_0x33de29[_0x4835('0x1b')][_0x4835('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33de29['options']?_0x33de29[_0x4835('0x1b')][_0x4835('0x20')]||null:null,'attributes':_0x33de29[_0x4835('0x1b')]?_0x33de29[_0x4835('0x1b')][_0x4835('0x21')]||null:null,'limit':_0x33de29[_0x4835('0x1b')]?_0x33de29[_0x4835('0x1b')]['limit']||null:null})[_0x4835('0xd')](function(_0x3cc4dd){logger[_0x4835('0xe')](_0x4835('0x22'),_0x33de29);logger[_0x4835('0x11')](_0x4835('0x22'),_0x33de29,JSON['stringify'](_0x3cc4dd));_0x42d972(_0x3cc4dd);})[_0x4835('0x18')](function(_0x2d346a){logger[_0x4835('0x14')]('UpdateVoiceDialReport',_0x2d346a[_0x4835('0x16')],_0x33de29);_0x1596be(_0x3f2996[_0x4835('0x14')](0x1f4,_0x2d346a[_0x4835('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a1dd9af..cd2f763 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 _0x11b2=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x11b2,0x1e9));var _0x211b=function(_0x541290,_0x46c472){_0x541290=_0x541290-0x0;var _0x1e67a7=_0x11b2[_0x541290];return _0x1e67a7;};'use strict';var multer=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var path=require(_0x211b('0x2'));var timeout=require('connect-timeout');var express=require(_0x211b('0x3'));var router=express['Router']();var auth=require(_0x211b('0x4'));var interaction=require(_0x211b('0x5'));var config=require(_0x211b('0x6'));var controller=require(_0x211b('0x7'));router[_0x211b('0x8')]('/',auth[_0x211b('0x9')](),controller[_0x211b('0xa')]);router[_0x211b('0x8')](_0x211b('0xb'),auth[_0x211b('0x9')](),controller['show']);router[_0x211b('0xc')]('/',auth[_0x211b('0x9')](),controller['create']);router['post'](_0x211b('0xd'),auth[_0x211b('0x9')](),controller[_0x211b('0xe')]);router['put'](_0x211b('0xb'),auth[_0x211b('0x9')](),controller[_0x211b('0xf')]);router[_0x211b('0x10')](_0x211b('0xb'),auth['isAuthenticated'](),controller[_0x211b('0x11')]);module[_0x211b('0x12')]=router; \ No newline at end of file +var _0xcacb=['show','post','create','/:id/applications','addApplications','put','update','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xbe499b,_0x3af60c){var _0x482afe=function(_0x13e254){while(--_0x13e254){_0xbe499b['push'](_0xbe499b['shift']());}};_0x482afe(++_0x3af60c);}(_0xcacb,0x118));var _0xbcac=function(_0x31c3be,_0x5e540f){_0x31c3be=_0x31c3be-0x0;var _0x48314d=_0xcacb[_0x31c3be];return _0x48314d;};'use strict';var multer=require(_0xbcac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbcac('0x1'));var express=require('express');var router=express[_0xbcac('0x2')]();var auth=require(_0xbcac('0x3'));var interaction=require(_0xbcac('0x4'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xbcac('0x5')]('/',auth[_0xbcac('0x6')](),controller[_0xbcac('0x7')]);router[_0xbcac('0x5')](_0xbcac('0x8'),auth[_0xbcac('0x6')](),controller[_0xbcac('0x9')]);router[_0xbcac('0xa')]('/',auth['isAuthenticated'](),controller[_0xbcac('0xb')]);router[_0xbcac('0xa')](_0xbcac('0xc'),auth[_0xbcac('0x6')](),controller[_0xbcac('0xd')]);router[_0xbcac('0xe')](_0xbcac('0x8'),auth[_0xbcac('0x6')](),controller[_0xbcac('0xf')]);router['delete'](_0xbcac('0x8'),auth[_0xbcac('0x6')](),controller['destroy']);module[_0xbcac('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 432bc09..87a661e 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(_0x57770b,_0x4c4731){var _0x12d28b=function(_0x318f69){while(--_0x318f69){_0x57770b['push'](_0x57770b['shift']());}};_0x12d28b(++_0x4c4731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x1a0fed,_0x52cc4c){var _0x4cc875=function(_0x4590e7){while(--_0x4590e7){_0x1a0fed['push'](_0x1a0fed['shift']());}};_0x4cc875(++_0x52cc4c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 5518e1b..8b8adc3 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 _0x7117=['status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','error','stack','name','index','VoiceExtension','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','options','includeAll','findAll','rows','show','filtears','include','find','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','description','recordingFormat','cutdigits','mandatoryDisposition','context','findOne','sequelize','bulkCreate','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7117,0x1ec));var _0x7711=function(_0x5a310a,_0x42e26d){_0x5a310a=_0x5a310a-0x0;var _0x4c8b79=_0x7117[_0x5a310a];return _0x4c8b79;};'use strict';var pdf=require(_0x7711('0x0'));var emlformat=require(_0x7711('0x1'));var rimraf=require(_0x7711('0x2'));var zipdir=require(_0x7711('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7711('0x4'));var moment=require(_0x7711('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7711('0x6'));var util=require('util');var path=require(_0x7711('0x7'));var sox=require(_0x7711('0x8'));var csv=require(_0x7711('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7711('0xa'));var deskjs=require(_0x7711('0xb'));var toCsv=require(_0x7711('0x9'));var querystring=require(_0x7711('0xc'));var Papa=require('papaparse');var Redis=require(_0x7711('0xd'));var authService=require(_0x7711('0xe'));var qs=require(_0x7711('0xf'));var as=require(_0x7711('0x10'));var hardwareService=require(_0x7711('0x11'));var logger=require('../../config/logger')(_0x7711('0x12'));var utils=require(_0x7711('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7711('0x14'));var db=require(_0x7711('0x15'))['db'];config[_0x7711('0x16')]=_[_0x7711('0x17')](config[_0x7711('0x16')],{'host':_0x7711('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7711('0x16')]));require(_0x7711('0x19'))[_0x7711('0x1a')](socket);function respondWithStatusCode(_0x223eea,_0x5939c5){_0x5939c5=_0x5939c5||0xcc;return function(_0xe508f7){if(_0xe508f7){return _0x223eea[_0x7711('0x1b')](_0x5939c5);}return _0x223eea[_0x7711('0x1c')](_0x5939c5)[_0x7711('0x1d')]();};}function respondWithResult(_0x28b28e,_0x44320f){_0x44320f=_0x44320f||0xc8;return function(_0x1f25fc){if(_0x1f25fc){return _0x28b28e[_0x7711('0x1c')](_0x44320f)[_0x7711('0x1e')](_0x1f25fc);}};}function respondWithFilteredResult(_0x3e3dcd,_0x5a0741){return function(_0x2b182f){if(_0x2b182f){var _0x59384d=_0x2b182f[_0x7711('0x1f')],_0x1bbea3=_0x5a0741[_0x7711('0x20')],_0x35b02f=_0x5a0741[_0x7711('0x20')]+_0x5a0741[_0x7711('0x21')],_0xa1f324;if(_0x35b02f>=_0x59384d){_0x35b02f=_0x59384d;_0xa1f324=0xc8;}else{_0xa1f324=0xce;}_0x3e3dcd[_0x7711('0x1c')](_0xa1f324);return _0x3e3dcd[_0x7711('0x22')](_0x7711('0x23'),_0x1bbea3+'-'+_0x35b02f+'/'+_0x59384d)[_0x7711('0x1e')](_0x2b182f);}return null;};}function patchUpdates(_0x3e661c){return function(_0x3dd245){try{jsonpatch['apply'](_0x3dd245,_0x3e661c,!![]);}catch(_0x254aaf){return BPromise['reject'](_0x254aaf);}return _0x3dd245[_0x7711('0x24')]();};}function saveUpdates(_0x217edf,_0xfb0c83){return function(_0x3d5e11){if(_0x3d5e11){return _0x3d5e11[_0x7711('0x25')](_0x217edf)[_0x7711('0x26')](function(_0x14874a){return _0x14874a;});}return null;};}function removeEntity(_0x29da2b,_0xabd84a){return function(_0x30e9ab){if(_0x30e9ab){return _0x30e9ab[_0x7711('0x27')]()[_0x7711('0x26')](function(){var _0xb2a5aa=_0x30e9ab[_0x7711('0x28')]({'plain':!![]});var _0x460330=[{'name':_0x7711('0x29'),'value':_0x7711('0x2a'),'ignore':![]},{'name':_0x7711('0x2b'),'value':_0x7711('0x2c'),'ignore':![]},{'name':_0x7711('0x2d'),'value':_0x7711('0x2e'),'ignore':![]}];var _0x20c718=_(_0x460330)[_0x7711('0x2f')](_0x7711('0x30'))[_0x7711('0x31')](_0x7711('0x32'))['value']();if(_[_0x7711('0x33')](_0x20c718,_0xb2a5aa[_0x7711('0x34')])){return;}var _0x4d4c32=_['find'](_0x460330,[_0x7711('0x32'),_0xb2a5aa[_0x7711('0x34')]])['name'];return db['UserProfileResource'][_0x7711('0x27')]({'where':{'type':_0x4d4c32,'resourceId':_0xb2a5aa['id']}})['then'](function(){return _0x30e9ab;});})[_0x7711('0x26')](function(){_0x29da2b[_0x7711('0x1c')](0xcc)[_0x7711('0x1d')]();});}};}function handleEntityNotFound(_0x40c90b,_0x26f39b){return function(_0x50bb8e){if(!_0x50bb8e){_0x40c90b['sendStatus'](0x194);}return _0x50bb8e;};}function handleError(_0x13445a,_0x55564b){_0x55564b=_0x55564b||0x1f4;return function(_0x19b9ba){logger[_0x7711('0x35')](_0x19b9ba[_0x7711('0x36')]);if(_0x19b9ba[_0x7711('0x37')]){delete _0x19b9ba['name'];}_0x13445a['status'](_0x55564b)['send'](_0x19b9ba);};}exports[_0x7711('0x38')]=function(_0x218f9e,_0x4c7b8a){var _0x4be449={},_0x25dc07={},_0x21f3f8={'count':0x0,'rows':[]};var _0x350b6d=_[_0x7711('0x31')](db[_0x7711('0x39')][_0x7711('0x3a')],function(_0x3f2ad7){return{'name':_0x3f2ad7['fieldName'],'type':_0x3f2ad7['type'][_0x7711('0x3b')]};});_0x25dc07['model']=_['map'](_0x350b6d,'name');_0x25dc07[_0x7711('0x3c')]=_[_0x7711('0x3d')](_0x218f9e[_0x7711('0x3c')]);_0x25dc07['filters']=_[_0x7711('0x3e')](_0x25dc07['model'],_0x25dc07[_0x7711('0x3c')]);_0x4be449['attributes']=_[_0x7711('0x3e')](_0x25dc07[_0x7711('0x3f')],qs[_0x7711('0x40')](_0x218f9e[_0x7711('0x3c')]['fields']));_0x4be449[_0x7711('0x41')]=_0x4be449[_0x7711('0x41')][_0x7711('0x42')]?_0x4be449[_0x7711('0x41')]:_0x25dc07['model'];if(!_0x218f9e[_0x7711('0x3c')]['hasOwnProperty'](_0x7711('0x43'))){_0x4be449[_0x7711('0x21')]=qs[_0x7711('0x21')](_0x218f9e['query'][_0x7711('0x21')]);_0x4be449['offset']=qs[_0x7711('0x20')](_0x218f9e[_0x7711('0x3c')][_0x7711('0x20')]);}_0x4be449[_0x7711('0x44')]=qs[_0x7711('0x45')](_0x218f9e[_0x7711('0x3c')]['sort']);_0x4be449[_0x7711('0x46')]=qs[_0x7711('0x47')](_[_0x7711('0x48')](_0x218f9e['query'],_0x25dc07['filters']),_0x350b6d);if(_0x218f9e[_0x7711('0x3c')]['filter']){_0x4be449[_0x7711('0x46')]=_[_0x7711('0x49')](_0x4be449['where'],{'$or':_[_0x7711('0x31')](_0x350b6d,function(_0xa80ed5){if(_0xa80ed5[_0x7711('0x34')]!=='VIRTUAL'){var _0x457951={};_0x457951[_0xa80ed5[_0x7711('0x37')]]={'$like':'%'+_0x218f9e[_0x7711('0x3c')][_0x7711('0x2f')]+'%'};return _0x457951;}})});}_0x4be449=_['merge']({},_0x4be449,_0x218f9e[_0x7711('0x4a')]);var _0x340180={'where':_0x4be449[_0x7711('0x46')]};return db[_0x7711('0x39')][_0x7711('0x1f')](_0x340180)['then'](function(_0x1d9f0e){_0x21f3f8[_0x7711('0x1f')]=_0x1d9f0e;if(_0x218f9e[_0x7711('0x3c')][_0x7711('0x4b')]){_0x4be449['include']=[{'all':!![]}];}return db[_0x7711('0x39')][_0x7711('0x4c')](_0x4be449);})['then'](function(_0x5012b){_0x21f3f8[_0x7711('0x4d')]=_0x5012b;return _0x21f3f8;})[_0x7711('0x26')](respondWithFilteredResult(_0x4c7b8a,_0x4be449))['catch'](handleError(_0x4c7b8a,null));};exports[_0x7711('0x4e')]=function(_0x141e30,_0x2da589){var _0x37e067={'raw':![],'where':{'id':_0x141e30['params']['id']}},_0x22751e={};_0x22751e[_0x7711('0x3f')]=_[_0x7711('0x3d')](db[_0x7711('0x39')][_0x7711('0x3a')]);_0x22751e['query']=_[_0x7711('0x3d')](_0x141e30['query']);_0x22751e[_0x7711('0x4f')]=_[_0x7711('0x3e')](_0x22751e[_0x7711('0x3f')],_0x22751e[_0x7711('0x3c')]);_0x37e067[_0x7711('0x41')]=_[_0x7711('0x3e')](_0x22751e[_0x7711('0x3f')],qs[_0x7711('0x40')](_0x141e30[_0x7711('0x3c')]['fields']));_0x37e067[_0x7711('0x41')]=_0x37e067['attributes'][_0x7711('0x42')]?_0x37e067[_0x7711('0x41')]:_0x22751e['model'];if(_0x141e30[_0x7711('0x3c')][_0x7711('0x4b')]){_0x37e067[_0x7711('0x50')]=[{'all':!![]}];}_0x37e067=_[_0x7711('0x49')]({},_0x37e067,_0x141e30[_0x7711('0x4a')]);return db[_0x7711('0x39')][_0x7711('0x51')](_0x37e067)[_0x7711('0x26')](handleEntityNotFound(_0x2da589,null))[_0x7711('0x26')](respondWithResult(_0x2da589,null))[_0x7711('0x52')](handleError(_0x2da589,null));};exports[_0x7711('0x27')]=function(_0x1df72f,_0x5eb49){return db[_0x7711('0x39')][_0x7711('0x51')]({'where':{'id':_0x1df72f['params']['id']}})[_0x7711('0x26')](handleEntityNotFound(_0x5eb49,null))['then'](removeEntity(_0x5eb49,null))[_0x7711('0x52')](handleError(_0x5eb49,null));};exports[_0x7711('0x53')]=function(_0x3664da,_0x3e7c4c){if(_0x3664da[_0x7711('0x54')][_0x7711('0x34')]==='outbound'&&!_[_0x7711('0x55')](_0x3664da[_0x7711('0x54')][_0x7711('0x56')],'_')){_0x3664da[_0x7711('0x54')]['exten']='_'['concat'](_0x3664da[_0x7711('0x54')][_0x7711('0x56')]);}return db[_0x7711('0x39')][_0x7711('0x53')](_0x3664da[_0x7711('0x54')],{'raw':![]})[_0x7711('0x26')](function(_0x444c47){var _0x40c424=_0x3664da['user'][_0x7711('0x28')]({'plain':!![]});if(!_0x40c424)throw new Error(_0x7711('0x57'));if(_0x40c424[_0x7711('0x58')]===_0x7711('0x59')){var _0x68717d=_0x444c47[_0x7711('0x28')]({'plain':!![]});var _0x485eb6=[{'name':_0x7711('0x29'),'value':_0x7711('0x2a')},{'name':_0x7711('0x2b'),'value':_0x7711('0x2c')},{'name':_0x7711('0x2d'),'value':'internal'}];var _0xf1d874=_['find'](_0x485eb6,[_0x7711('0x32'),_0x68717d['type']])['name'];return db[_0x7711('0x5a')]['find']({'where':{'name':_0xf1d874,'userProfileId':_0x40c424['userProfileId']},'raw':!![]})[_0x7711('0x26')](function(_0x6e7ee9){if(_0x6e7ee9&&_0x6e7ee9[_0x7711('0x5b')]===0x0){return db[_0x7711('0x5c')][_0x7711('0x53')]({'name':_0x68717d[_0x7711('0x37')],'resourceId':_0x68717d['id'],'type':_0x6e7ee9[_0x7711('0x37')],'sectionId':_0x6e7ee9['id']},{})[_0x7711('0x26')](function(){return _0x444c47;});}else{return _0x444c47;}})[_0x7711('0x52')](function(_0x1d5f4a){logger[_0x7711('0x35')](_0x7711('0x5d'),_0x1d5f4a);throw _0x1d5f4a;});}return _0x444c47;})[_0x7711('0x26')](respondWithResult(_0x3e7c4c,0xc9))[_0x7711('0x52')](handleError(_0x3e7c4c,null));};exports[_0x7711('0x25')]=function(_0x27bfbf,_0xc7f383){if(_0x27bfbf[_0x7711('0x54')]['id']){delete _0x27bfbf[_0x7711('0x54')]['id'];}return db[_0x7711('0x39')][_0x7711('0x51')]({'where':{'id':_0x27bfbf[_0x7711('0x5e')]['id']}})['then'](handleEntityNotFound(_0xc7f383,null))[_0x7711('0x26')](function(_0x40c9f7){if(_0x40c9f7){return db[_0x7711('0x39')]['update'](_[_0x7711('0x48')](_0x27bfbf[_0x7711('0x54')],[_0x7711('0x56'),'context',_0x7711('0x5f'),_0x7711('0x60'),_0x7711('0x61'),_0x7711('0x62')]),{'where':{'context':_0x40c9f7[_0x7711('0x63')],'exten':_0x40c9f7[_0x7711('0x56')]},'individualHooks':!![]})[_0x7711('0x26')](function(_0x515a77){return _0x515a77;});}return null;})['then'](respondWithStatusCode(_0xc7f383,null))[_0x7711('0x52')](handleError(_0xc7f383,null));};exports['addApplications']=function(_0x4c3033,_0xe79402,_0x4e4cca){return db[_0x7711('0x39')][_0x7711('0x64')]({'where':{'id':_0x4c3033[_0x7711('0x5e')]['id']}})[_0x7711('0x26')](handleEntityNotFound(_0xe79402,null))['then'](function(_0x1ecce1){if(_0x1ecce1){return db[_0x7711('0x65')]['transaction'](function(_0x4f3964){return db[_0x7711('0x39')][_0x7711('0x27')]({'where':{'VoiceExtensionId':_0x4c3033['params']['id']},'transaction':_0x4f3964})[_0x7711('0x26')](function(_0x9e099f){var _0x36c500=_[_0x7711('0x31')](_0x4c3033['body'],function(_0x11fb8e){_0x11fb8e['VoiceExtensionId']=_0x4c3033[_0x7711('0x5e')]['id'];return _0x11fb8e;});return db['VoiceExtension'][_0x7711('0x66')](_0x36c500,{'transaction':_0x4f3964});});})['then'](function(){return db[_0x7711('0x39')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x4c3033['params']['id']},'order':_0x7711('0x67')});});}})[_0x7711('0x26')](respondWithResult(_0xe79402,null))[_0x7711('0x52')](handleError(_0xe79402,null));}; \ No newline at end of file +var _0xfc4c=['request-promise','moment','util','path','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','value','includes','type','name','UserProfileResource','then','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','VoiceExtension','filtears','fields','length','includeAll','find','create','outbound','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','context','recordingFormat','cutdigits','findOne','sequelize','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xfc4c,0xca));var _0xcfc4=function(_0x287af3,_0x22a7d2){_0x287af3=_0x287af3-0x0;var _0x154a7c=_0xfc4c[_0x287af3];return _0x154a7c;};'use strict';var pdf=require(_0xcfc4('0x0'));var emlformat=require(_0xcfc4('0x1'));var rimraf=require(_0xcfc4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfc4('0x3'));var rp=require(_0xcfc4('0x4'));var moment=require(_0xcfc4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcfc4('0x6'));var path=require(_0xcfc4('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcfc4('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcfc4('0x9'));var crypto=require(_0xcfc4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcfc4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcfc4('0xc'));var authService=require(_0xcfc4('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcfc4('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcfc4('0xf'));var utils=require(_0xcfc4('0x10'));var config=require(_0xcfc4('0x11'));var licenseUtil=require(_0xcfc4('0x12'));var db=require(_0xcfc4('0x13'))['db'];config['redis']=_[_0xcfc4('0x14')](config['redis'],{'host':_0xcfc4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfc4('0x16')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x276b08,_0x40029f){_0x40029f=_0x40029f||0xcc;return function(_0x588dd1){if(_0x588dd1){return _0x276b08[_0xcfc4('0x17')](_0x40029f);}return _0x276b08[_0xcfc4('0x18')](_0x40029f)[_0xcfc4('0x19')]();};}function respondWithResult(_0x4bb1f3,_0x5af66f){_0x5af66f=_0x5af66f||0xc8;return function(_0xe4c5bd){if(_0xe4c5bd){return _0x4bb1f3['status'](_0x5af66f)['json'](_0xe4c5bd);}};}function respondWithFilteredResult(_0x5c78f9,_0x136693){return function(_0x52cd7b){if(_0x52cd7b){var _0x472694=_0x52cd7b[_0xcfc4('0x1a')],_0x19887b=_0x136693[_0xcfc4('0x1b')],_0x5ac260=_0x136693['offset']+_0x136693[_0xcfc4('0x1c')],_0x421dd5;if(_0x5ac260>=_0x472694){_0x5ac260=_0x472694;_0x421dd5=0xc8;}else{_0x421dd5=0xce;}_0x5c78f9[_0xcfc4('0x18')](_0x421dd5);return _0x5c78f9[_0xcfc4('0x1d')]('Content-Range',_0x19887b+'-'+_0x5ac260+'/'+_0x472694)[_0xcfc4('0x1e')](_0x52cd7b);}return null;};}function patchUpdates(_0x3c4120){return function(_0x3a102e){try{jsonpatch[_0xcfc4('0x1f')](_0x3a102e,_0x3c4120,!![]);}catch(_0x457c6a){return BPromise[_0xcfc4('0x20')](_0x457c6a);}return _0x3a102e[_0xcfc4('0x21')]();};}function saveUpdates(_0x2c6406,_0x180f2d){return function(_0x42ef35){if(_0x42ef35){return _0x42ef35[_0xcfc4('0x22')](_0x2c6406)['then'](function(_0x393d09){return _0x393d09;});}return null;};}function removeEntity(_0x1fa48d,_0x33c6d0){return function(_0x486fd4){if(_0x486fd4){return _0x486fd4[_0xcfc4('0x23')]()['then'](function(){var _0x10aa76=_0x486fd4[_0xcfc4('0x24')]({'plain':!![]});var _0x1f0217=[{'name':_0xcfc4('0x25'),'value':_0xcfc4('0x26'),'ignore':![]},{'name':_0xcfc4('0x27'),'value':'outbound','ignore':![]},{'name':_0xcfc4('0x28'),'value':_0xcfc4('0x29'),'ignore':![]}];var _0x201181=_(_0x1f0217)[_0xcfc4('0x2a')](_0xcfc4('0x2b'))['map'](_0xcfc4('0x2c'))[_0xcfc4('0x2c')]();if(_[_0xcfc4('0x2d')](_0x201181,_0x10aa76[_0xcfc4('0x2e')])){return;}var _0x59dd2d=_['find'](_0x1f0217,['value',_0x10aa76[_0xcfc4('0x2e')]])[_0xcfc4('0x2f')];return db[_0xcfc4('0x30')][_0xcfc4('0x23')]({'where':{'type':_0x59dd2d,'resourceId':_0x10aa76['id']}})[_0xcfc4('0x31')](function(){return _0x486fd4;});})[_0xcfc4('0x31')](function(){_0x1fa48d[_0xcfc4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bf579,_0x5d774){return function(_0x28a085){if(!_0x28a085){_0x3bf579[_0xcfc4('0x17')](0x194);}return _0x28a085;};}function handleError(_0x3afa32,_0x3be3b1){_0x3be3b1=_0x3be3b1||0x1f4;return function(_0x2cc8c0){logger['error'](_0x2cc8c0['stack']);if(_0x2cc8c0[_0xcfc4('0x2f')]){delete _0x2cc8c0[_0xcfc4('0x2f')];}_0x3afa32[_0xcfc4('0x18')](_0x3be3b1)['send'](_0x2cc8c0);};}exports[_0xcfc4('0x32')]=function(_0x3345ad,_0x4f2380){var _0x3e3c8a={},_0x22999d={},_0x2a49bf={'count':0x0,'rows':[]};var _0x41e6b4=_[_0xcfc4('0x33')](db['VoiceExtension'][_0xcfc4('0x34')],function(_0x56814a){return{'name':_0x56814a[_0xcfc4('0x35')],'type':_0x56814a[_0xcfc4('0x2e')][_0xcfc4('0x36')]};});_0x22999d[_0xcfc4('0x37')]=_[_0xcfc4('0x33')](_0x41e6b4,_0xcfc4('0x2f'));_0x22999d[_0xcfc4('0x38')]=_[_0xcfc4('0x39')](_0x3345ad[_0xcfc4('0x38')]);_0x22999d[_0xcfc4('0x3a')]=_['intersection'](_0x22999d[_0xcfc4('0x37')],_0x22999d[_0xcfc4('0x38')]);_0x3e3c8a[_0xcfc4('0x3b')]=_[_0xcfc4('0x3c')](_0x22999d[_0xcfc4('0x37')],qs['fields'](_0x3345ad[_0xcfc4('0x38')]['fields']));_0x3e3c8a[_0xcfc4('0x3b')]=_0x3e3c8a[_0xcfc4('0x3b')]['length']?_0x3e3c8a['attributes']:_0x22999d['model'];if(!_0x3345ad[_0xcfc4('0x38')]['hasOwnProperty'](_0xcfc4('0x3d'))){_0x3e3c8a[_0xcfc4('0x1c')]=qs['limit'](_0x3345ad[_0xcfc4('0x38')][_0xcfc4('0x1c')]);_0x3e3c8a[_0xcfc4('0x1b')]=qs['offset'](_0x3345ad[_0xcfc4('0x38')]['offset']);}_0x3e3c8a[_0xcfc4('0x3e')]=qs[_0xcfc4('0x3f')](_0x3345ad[_0xcfc4('0x38')][_0xcfc4('0x3f')]);_0x3e3c8a[_0xcfc4('0x40')]=qs[_0xcfc4('0x3a')](_[_0xcfc4('0x41')](_0x3345ad[_0xcfc4('0x38')],_0x22999d['filters']),_0x41e6b4);if(_0x3345ad['query'][_0xcfc4('0x2a')]){_0x3e3c8a[_0xcfc4('0x40')]=_['merge'](_0x3e3c8a[_0xcfc4('0x40')],{'$or':_[_0xcfc4('0x33')](_0x41e6b4,function(_0x5834eb){if(_0x5834eb[_0xcfc4('0x2e')]!==_0xcfc4('0x42')){var _0x379773={};_0x379773[_0x5834eb[_0xcfc4('0x2f')]]={'$like':'%'+_0x3345ad['query'][_0xcfc4('0x2a')]+'%'};return _0x379773;}})});}_0x3e3c8a=_[_0xcfc4('0x43')]({},_0x3e3c8a,_0x3345ad[_0xcfc4('0x44')]);var _0x3226cd={'where':_0x3e3c8a[_0xcfc4('0x40')]};return db['VoiceExtension'][_0xcfc4('0x1a')](_0x3226cd)[_0xcfc4('0x31')](function(_0x44a46b){_0x2a49bf[_0xcfc4('0x1a')]=_0x44a46b;if(_0x3345ad['query']['includeAll']){_0x3e3c8a[_0xcfc4('0x45')]=[{'all':!![]}];}return db['VoiceExtension'][_0xcfc4('0x46')](_0x3e3c8a);})[_0xcfc4('0x31')](function(_0x464dc0){_0x2a49bf[_0xcfc4('0x47')]=_0x464dc0;return _0x2a49bf;})['then'](respondWithFilteredResult(_0x4f2380,_0x3e3c8a))[_0xcfc4('0x48')](handleError(_0x4f2380,null));};exports[_0xcfc4('0x49')]=function(_0x68ea0d,_0x5018a3){var _0x1bac85={'raw':![],'where':{'id':_0x68ea0d[_0xcfc4('0x4a')]['id']}},_0x2f9727={};_0x2f9727[_0xcfc4('0x37')]=_[_0xcfc4('0x39')](db[_0xcfc4('0x4b')][_0xcfc4('0x34')]);_0x2f9727[_0xcfc4('0x38')]=_[_0xcfc4('0x39')](_0x68ea0d[_0xcfc4('0x38')]);_0x2f9727[_0xcfc4('0x4c')]=_['intersection'](_0x2f9727['model'],_0x2f9727[_0xcfc4('0x38')]);_0x1bac85['attributes']=_[_0xcfc4('0x3c')](_0x2f9727[_0xcfc4('0x37')],qs[_0xcfc4('0x4d')](_0x68ea0d[_0xcfc4('0x38')][_0xcfc4('0x4d')]));_0x1bac85[_0xcfc4('0x3b')]=_0x1bac85[_0xcfc4('0x3b')][_0xcfc4('0x4e')]?_0x1bac85['attributes']:_0x2f9727[_0xcfc4('0x37')];if(_0x68ea0d[_0xcfc4('0x38')][_0xcfc4('0x4f')]){_0x1bac85[_0xcfc4('0x45')]=[{'all':!![]}];}_0x1bac85=_['merge']({},_0x1bac85,_0x68ea0d[_0xcfc4('0x44')]);return db[_0xcfc4('0x4b')][_0xcfc4('0x50')](_0x1bac85)[_0xcfc4('0x31')](handleEntityNotFound(_0x5018a3,null))[_0xcfc4('0x31')](respondWithResult(_0x5018a3,null))[_0xcfc4('0x48')](handleError(_0x5018a3,null));};exports['destroy']=function(_0x38f250,_0x464d4e){return db['VoiceExtension']['find']({'where':{'id':_0x38f250[_0xcfc4('0x4a')]['id']}})[_0xcfc4('0x31')](handleEntityNotFound(_0x464d4e,null))[_0xcfc4('0x31')](removeEntity(_0x464d4e,null))['catch'](handleError(_0x464d4e,null));};exports[_0xcfc4('0x51')]=function(_0x44d0e5,_0x490abd){if(_0x44d0e5['body']['type']===_0xcfc4('0x52')&&!_[_0xcfc4('0x53')](_0x44d0e5[_0xcfc4('0x54')][_0xcfc4('0x55')],'_')){_0x44d0e5[_0xcfc4('0x54')]['exten']='_'[_0xcfc4('0x56')](_0x44d0e5[_0xcfc4('0x54')][_0xcfc4('0x55')]);}return db[_0xcfc4('0x4b')]['create'](_0x44d0e5[_0xcfc4('0x54')],{'raw':![]})[_0xcfc4('0x31')](function(_0x3ac079){var _0x3eebae=_0x44d0e5[_0xcfc4('0x57')]['get']({'plain':!![]});if(!_0x3eebae)throw new Error(_0xcfc4('0x58'));if(_0x3eebae[_0xcfc4('0x59')]===_0xcfc4('0x57')){var _0x25d295=_0x3ac079[_0xcfc4('0x24')]({'plain':!![]});var _0x2e0019=[{'name':'InboundRoutes','value':'inbound'},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xcfc4('0x28'),'value':'internal'}];var _0x2f01f8=_['find'](_0x2e0019,[_0xcfc4('0x2c'),_0x25d295['type']])[_0xcfc4('0x2f')];return db[_0xcfc4('0x5a')][_0xcfc4('0x50')]({'where':{'name':_0x2f01f8,'userProfileId':_0x3eebae[_0xcfc4('0x5b')]},'raw':!![]})[_0xcfc4('0x31')](function(_0x1386bc){if(_0x1386bc&&_0x1386bc[_0xcfc4('0x5c')]===0x0){return db[_0xcfc4('0x30')]['create']({'name':_0x25d295[_0xcfc4('0x2f')],'resourceId':_0x25d295['id'],'type':_0x1386bc[_0xcfc4('0x2f')],'sectionId':_0x1386bc['id']},{})[_0xcfc4('0x31')](function(){return _0x3ac079;});}else{return _0x3ac079;}})['catch'](function(_0x4edf39){logger[_0xcfc4('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4edf39);throw _0x4edf39;});}return _0x3ac079;})[_0xcfc4('0x31')](respondWithResult(_0x490abd,0xc9))['catch'](handleError(_0x490abd,null));};exports[_0xcfc4('0x22')]=function(_0x45833b,_0x4201a0){if(_0x45833b['body']['id']){delete _0x45833b['body']['id'];}return db['VoiceExtension'][_0xcfc4('0x50')]({'where':{'id':_0x45833b[_0xcfc4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4201a0,null))[_0xcfc4('0x31')](function(_0x18c87c){if(_0x18c87c){return db[_0xcfc4('0x4b')][_0xcfc4('0x22')](_[_0xcfc4('0x41')](_0x45833b[_0xcfc4('0x54')],[_0xcfc4('0x55'),_0xcfc4('0x5e'),'description',_0xcfc4('0x5f'),_0xcfc4('0x60'),'mandatoryDisposition']),{'where':{'context':_0x18c87c['context'],'exten':_0x18c87c[_0xcfc4('0x55')]},'individualHooks':!![]})[_0xcfc4('0x31')](function(_0x4795d0){return _0x4795d0;});}return null;})['then'](respondWithStatusCode(_0x4201a0,null))[_0xcfc4('0x48')](handleError(_0x4201a0,null));};exports['addApplications']=function(_0x3ba37d,_0x2ecc13,_0x42e355){return db[_0xcfc4('0x4b')][_0xcfc4('0x61')]({'where':{'id':_0x3ba37d[_0xcfc4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ecc13,null))[_0xcfc4('0x31')](function(_0x5a5c7d){if(_0x5a5c7d){return db[_0xcfc4('0x62')]['transaction'](function(_0x40d671){return db[_0xcfc4('0x4b')]['destroy']({'where':{'VoiceExtensionId':_0x3ba37d[_0xcfc4('0x4a')]['id']},'transaction':_0x40d671})['then'](function(_0x38a44f){var _0x24a42f=_[_0xcfc4('0x33')](_0x3ba37d[_0xcfc4('0x54')],function(_0xad2c77){_0xad2c77[_0xcfc4('0x63')]=_0x3ba37d[_0xcfc4('0x4a')]['id'];return _0xad2c77;});return db[_0xcfc4('0x4b')][_0xcfc4('0x64')](_0x24a42f,{'transaction':_0x40d671});});})[_0xcfc4('0x31')](function(){return db['VoiceExtension'][_0xcfc4('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3ba37d['params']['id']},'order':_0xcfc4('0x66')});});}})['then'](respondWithResult(_0x2ecc13,null))[_0xcfc4('0x48')](handleError(_0x2ecc13,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index fec959e..e2d0286 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 _0x8c7d=['exports','events','VoiceExtension','save','update','remove','emit'];(function(_0x2d9e71,_0x2bbbb3){var _0x219d96=function(_0xa7a92e){while(--_0xa7a92e){_0x2d9e71['push'](_0x2d9e71['shift']());}};_0x219d96(++_0x2bbbb3);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x13fbbb,_0x4df658){_0x13fbbb=_0x13fbbb-0x0;var _0x3b05aa=_0x8c7d[_0x13fbbb];return _0x3b05aa;};'use strict';var EventEmitter=require(_0xd8c7('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xd8c7('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd8c7('0x2'),'afterUpdate':_0xd8c7('0x3'),'afterDestroy':_0xd8c7('0x4')};function emitEvent(_0x23dd8c){return function(_0x27fc03,_0x39ca48,_0x2db587){VoiceExtensionEvents[_0xd8c7('0x5')](_0x23dd8c+':'+_0x27fc03['id'],_0x27fc03);VoiceExtensionEvents[_0xd8c7('0x5')](_0x23dd8c,_0x27fc03);_0x2db587(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xd8c7('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd757=['../../mysqldb','VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd757,0x18f));var _0x7d75=function(_0x2953a2,_0x45251e){_0x2953a2=_0x2953a2-0x0;var _0x4ac050=_0xd757[_0x2953a2];return _0x4ac050;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x7d75('0x0'))['db'][_0x7d75('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7d75('0x2')](0x0);var events={'afterCreate':_0x7d75('0x3'),'afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x3fd89b){return function(_0x7fe7b,_0x5c5be7,_0x1f78eb){VoiceExtensionEvents[_0x7d75('0x5')](_0x3fd89b+':'+_0x7fe7b['id'],_0x7fe7b);VoiceExtensionEvents['emit'](_0x3fd89b,_0x7fe7b);_0x1f78eb(null);};}for(var e in events){if(events[_0x7d75('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index bbca112..d14d5b9 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 _0x1a48=['path','rimraf','./voiceExtension.attributes','exports','define','voice_extensions','util','../../config/logger','api','moment'];(function(_0x12dfa1,_0x36ff32){var _0x5db581=function(_0x3f1237){while(--_0x3f1237){_0x12dfa1['push'](_0x12dfa1['shift']());}};_0x5db581(++_0x36ff32);}(_0x1a48,0x150));var _0x81a4=function(_0x21c197,_0x2db8df){_0x21c197=_0x21c197-0x0;var _0x31176f=_0x1a48[_0x21c197];return _0x31176f;};'use strict';var _=require('lodash');var util=require(_0x81a4('0x0'));var logger=require(_0x81a4('0x1'))(_0x81a4('0x2'));var moment=require(_0x81a4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x81a4('0x4'));var rimraf=require(_0x81a4('0x5'));var config=require('../../config/environment');var attributes=require(_0x81a4('0x6'));module[_0x81a4('0x7')]=function(_0x30a7b1,_0x567693){return _0x30a7b1[_0x81a4('0x8')]('VoiceExtension',attributes,{'tableName':_0x81a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb55a=['VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports','define'];(function(_0x2c2fc8,_0x5022a0){var _0x41fbe5=function(_0x537efd){while(--_0x537efd){_0x2c2fc8['push'](_0x2c2fc8['shift']());}};_0x41fbe5(++_0x5022a0);}(_0xb55a,0xaa));var _0xab55=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xb55a[_0x616290];return _0x453879;};'use strict';var _=require(_0xab55('0x0'));var util=require(_0xab55('0x1'));var logger=require(_0xab55('0x2'))(_0xab55('0x3'));var moment=require(_0xab55('0x4'));var BPromise=require(_0xab55('0x5'));var rp=require(_0xab55('0x6'));var fs=require('fs');var path=require(_0xab55('0x7'));var rimraf=require(_0xab55('0x8'));var config=require('../../config/environment');var attributes=require(_0xab55('0x9'));module[_0xab55('0xa')]=function(_0x5c0d78,_0x123123){return _0x5c0d78[_0xab55('0xb')](_0xab55('0xc'),attributes,{'tableName':_0xab55('0xd'),'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 c4f632b..6759d5f 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 _0x9419=['request\x20sent','stringify','error','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','GetVoiceExtension','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s'];(function(_0x30e18b,_0x18f015){var _0xf972c8=function(_0x2ba19d){while(--_0x2ba19d){_0x30e18b['push'](_0x30e18b['shift']());}};_0xf972c8(++_0x18f015);}(_0x9419,0x179));var _0x9941=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x9419[_0x255c48];return _0xaebda3;};'use strict';var _=require(_0x9941('0x0'));var util=require(_0x9941('0x1'));var moment=require(_0x9941('0x2'));var BPromise=require(_0x9941('0x3'));var rs=require(_0x9941('0x4'));var fs=require('fs');var Redis=require(_0x9941('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9941('0x6'));var logger=require(_0x9941('0x7'))(_0x9941('0x8'));var config=require(_0x9941('0x9'));var jayson=require(_0x9941('0xa'));var client=jayson[_0x9941('0xb')][_0x9941('0xc')]({'port':0x232a});config[_0x9941('0xd')]=_[_0x9941('0xe')](config[_0x9941('0xd')],{'host':_0x9941('0xf'),'port':0x18eb});var socket=require(_0x9941('0x10'))(new Redis(config[_0x9941('0xd')]));require(_0x9941('0x11'))[_0x9941('0x12')](socket);function respondWithRpcPromise(_0x4d6b4d,_0xa44fba,_0x4c6351){return new BPromise(function(_0x170c4a,_0x412ecc){return client[_0x9941('0x13')](_0x4d6b4d,_0x4c6351)[_0x9941('0x14')](function(_0x587a96){logger[_0x9941('0x15')](_0x9941('0x16'),_0xa44fba,_0x9941('0x17'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xa44fba,_0x9941('0x17'),JSON[_0x9941('0x18')](_0x587a96));if(_0x587a96['error']){if(_0x587a96[_0x9941('0x19')]['code']===0x1f4){logger['error'](_0x9941('0x16'),_0xa44fba,_0x587a96['error'][_0x9941('0x1a')]);return _0x412ecc(_0x587a96[_0x9941('0x19')][_0x9941('0x1a')]);}logger[_0x9941('0x19')]('VoiceExtension,\x20%s,\x20%s',_0xa44fba,_0x587a96[_0x9941('0x19')][_0x9941('0x1a')]);return _0x170c4a(_0x587a96[_0x9941('0x19')][_0x9941('0x1a')]);}else{logger[_0x9941('0x15')](_0x9941('0x16'),_0xa44fba,'request\x20sent');_0x170c4a(_0x587a96[_0x9941('0x1b')][_0x9941('0x1a')]);}})[_0x9941('0x1c')](function(_0x55ec91){logger['error'](_0x9941('0x16'),_0xa44fba,_0x55ec91);_0x412ecc(_0x55ec91);});});}exports['GetVoiceExtension']=function(_0x24baa8){var _0x19a197=this;return new Promise(function(_0x37009e,_0x170795){return db[_0x9941('0x1d')][_0x9941('0x1e')]({'raw':_0x24baa8[_0x9941('0x1f')]?_0x24baa8['options'][_0x9941('0x20')]===undefined?!![]:![]:!![],'where':_0x24baa8[_0x9941('0x1f')]?_0x24baa8['options'][_0x9941('0x21')]||null:null,'attributes':_0x24baa8[_0x9941('0x1f')]?_0x24baa8[_0x9941('0x1f')][_0x9941('0x22')]||null:null,'limit':_0x24baa8[_0x9941('0x1f')]?_0x24baa8[_0x9941('0x1f')]['limit']||null:null,'include':_0x24baa8[_0x9941('0x1f')]?_0x24baa8[_0x9941('0x1f')][_0x9941('0x23')]?_[_0x9941('0x24')](_0x24baa8[_0x9941('0x1f')][_0x9941('0x23')],function(_0x52eeb0){return{'model':db[_0x52eeb0[_0x9941('0x25')]],'as':_0x52eeb0['as'],'attributes':_0x52eeb0[_0x9941('0x22')],'include':_0x52eeb0[_0x9941('0x23')]?_[_0x9941('0x24')](_0x52eeb0['include'],function(_0x2ee84b){return{'model':db[_0x2ee84b[_0x9941('0x25')]],'as':_0x2ee84b['as'],'attributes':_0x2ee84b[_0x9941('0x22')],'include':_0x2ee84b[_0x9941('0x23')]?_['map'](_0x2ee84b[_0x9941('0x23')],function(_0x172f77){return{'model':db[_0x172f77[_0x9941('0x25')]],'as':_0x172f77['as'],'attributes':_0x172f77['attributes']};}):[]};}):[]};}):[]:[]})[_0x9941('0x14')](function(_0x2ea313){logger['info'](_0x9941('0x26'),_0x24baa8);logger[_0x9941('0x27')](_0x9941('0x26'),_0x24baa8,JSON['stringify'](_0x2ea313));_0x37009e(_0x2ea313);})[_0x9941('0x1c')](function(_0x53f2b4){logger[_0x9941('0x19')]('GetVoiceExtension',_0x53f2b4[_0x9941('0x1a')],_0x24baa8);_0x170795(_0x19a197[_0x9941('0x19')](0x1f4,_0x53f2b4[_0x9941('0x1a')]));});});}; \ No newline at end of file +var _0xa280=['../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','limit','map','include','model','attributes','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x39cdca,_0x232b4d){var _0x59dbf4=function(_0x174a8e){while(--_0x174a8e){_0x39cdca['push'](_0x39cdca['shift']());}};_0x59dbf4(++_0x232b4d);}(_0xa280,0xd9));var _0x0a28=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xa280[_0x3cea78];return _0x33b66b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0a28('0x0'));var BPromise=require('bluebird');var rs=require(_0x0a28('0x1'));var fs=require('fs');var Redis=require(_0x0a28('0x2'));var db=require(_0x0a28('0x3'))['db'];var utils=require(_0x0a28('0x4'));var logger=require(_0x0a28('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0a28('0x6')][_0x0a28('0x7')]({'port':0x232a});config[_0x0a28('0x8')]=_[_0x0a28('0x9')](config['redis'],{'host':_0x0a28('0xa'),'port':0x18eb});var socket=require(_0x0a28('0xb'))(new Redis(config[_0x0a28('0x8')]));require(_0x0a28('0xc'))['register'](socket);function respondWithRpcPromise(_0x51de98,_0x480db6,_0x324591){return new BPromise(function(_0x499033,_0x979ede){return client[_0x0a28('0xd')](_0x51de98,_0x324591)[_0x0a28('0xe')](function(_0x2935fd){logger[_0x0a28('0xf')](_0x0a28('0x10'),_0x480db6,'request\x20sent');logger[_0x0a28('0x11')](_0x0a28('0x12'),_0x480db6,_0x0a28('0x13'),JSON['stringify'](_0x2935fd));if(_0x2935fd[_0x0a28('0x14')]){if(_0x2935fd[_0x0a28('0x14')][_0x0a28('0x15')]===0x1f4){logger[_0x0a28('0x14')](_0x0a28('0x10'),_0x480db6,_0x2935fd[_0x0a28('0x14')][_0x0a28('0x16')]);return _0x979ede(_0x2935fd[_0x0a28('0x14')][_0x0a28('0x16')]);}logger['error'](_0x0a28('0x10'),_0x480db6,_0x2935fd['error'][_0x0a28('0x16')]);return _0x499033(_0x2935fd[_0x0a28('0x14')][_0x0a28('0x16')]);}else{logger[_0x0a28('0xf')](_0x0a28('0x10'),_0x480db6,_0x0a28('0x13'));_0x499033(_0x2935fd[_0x0a28('0x17')][_0x0a28('0x16')]);}})[_0x0a28('0x18')](function(_0x2425da){logger['error'](_0x0a28('0x10'),_0x480db6,_0x2425da);_0x979ede(_0x2425da);});});}exports[_0x0a28('0x19')]=function(_0x249652){var _0x52a73e=this;return new Promise(function(_0x5cf0e6,_0x215042){return db[_0x0a28('0x1a')][_0x0a28('0x1b')]({'raw':_0x249652[_0x0a28('0x1c')]?_0x249652['options'][_0x0a28('0x1d')]===undefined?!![]:![]:!![],'where':_0x249652['options']?_0x249652[_0x0a28('0x1c')][_0x0a28('0x1e')]||null:null,'attributes':_0x249652[_0x0a28('0x1c')]?_0x249652[_0x0a28('0x1c')]['attributes']||null:null,'limit':_0x249652[_0x0a28('0x1c')]?_0x249652[_0x0a28('0x1c')][_0x0a28('0x1f')]||null:null,'include':_0x249652[_0x0a28('0x1c')]?_0x249652['options']['include']?_[_0x0a28('0x20')](_0x249652['options'][_0x0a28('0x21')],function(_0x2562b3){return{'model':db[_0x2562b3[_0x0a28('0x22')]],'as':_0x2562b3['as'],'attributes':_0x2562b3[_0x0a28('0x23')],'include':_0x2562b3['include']?_[_0x0a28('0x20')](_0x2562b3['include'],function(_0x270e8f){return{'model':db[_0x270e8f['model']],'as':_0x270e8f['as'],'attributes':_0x270e8f[_0x0a28('0x23')],'include':_0x270e8f[_0x0a28('0x21')]?_['map'](_0x270e8f['include'],function(_0xd6f4c7){return{'model':db[_0xd6f4c7[_0x0a28('0x22')]],'as':_0xd6f4c7['as'],'attributes':_0xd6f4c7[_0x0a28('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0a28('0xe')](function(_0x471139){logger[_0x0a28('0xf')]('GetVoiceExtension',_0x249652);logger['debug'](_0x0a28('0x19'),_0x249652,JSON[_0x0a28('0x24')](_0x471139));_0x5cf0e6(_0x471139);})['catch'](function(_0x112e2e){logger[_0x0a28('0x14')]('GetVoiceExtension',_0x112e2e[_0x0a28('0x16')],_0x249652);_0x215042(_0x52a73e[_0x0a28('0x14')](0x1f4,_0x112e2e[_0x0a28('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 5b69a7a..ad17307 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 _0x2abe=['./voiceExtension.events','save','remove','removeListener','register','length','voiceExtension:'];(function(_0x1939dc,_0x4cb699){var _0x5c9e7d=function(_0x5e4b98){while(--_0x5e4b98){_0x1939dc['push'](_0x1939dc['shift']());}};_0x5c9e7d(++_0x4cb699);}(_0x2abe,0x181));var _0xe2ab=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x2abe[_0x2dea24];return _0x309d58;};'use strict';var VoiceExtensionEvents=require(_0xe2ab('0x0'));var events=[_0xe2ab('0x1'),_0xe2ab('0x2'),'update'];function createListener(_0x170c1b,_0x3d7a27){return function(_0x4bec98){_0x3d7a27['emit'](_0x170c1b,_0x4bec98);};}function removeListener(_0x5b5985,_0x36dd93){return function(){VoiceExtensionEvents[_0xe2ab('0x3')](_0x5b5985,_0x36dd93);};}exports[_0xe2ab('0x4')]=function(_0x5e142f){for(var _0x29627b=0x0,_0x4f11ea=events[_0xe2ab('0x5')];_0x29627b<_0x4f11ea;_0x29627b++){var _0x56f4cf=events[_0x29627b];var _0x2c0bea=createListener(_0xe2ab('0x6')+_0x56f4cf,_0x5e142f);VoiceExtensionEvents['on'](_0x56f4cf,_0x2c0bea);}}; \ No newline at end of file +var _0x4a9b=['removeListener','register','length','./voiceExtension.events','save','remove','emit'];(function(_0x30c224,_0x14cf55){var _0x3c92f3=function(_0x5119d4){while(--_0x5119d4){_0x30c224['push'](_0x30c224['shift']());}};_0x3c92f3(++_0x14cf55);}(_0x4a9b,0x161));var _0xb4a9=function(_0x40fdbb,_0x593eea){_0x40fdbb=_0x40fdbb-0x0;var _0x199b36=_0x4a9b[_0x40fdbb];return _0x199b36;};'use strict';var VoiceExtensionEvents=require(_0xb4a9('0x0'));var events=[_0xb4a9('0x1'),_0xb4a9('0x2'),'update'];function createListener(_0x5634b0,_0x3ebd42){return function(_0x4efec3){_0x3ebd42[_0xb4a9('0x3')](_0x5634b0,_0x4efec3);};}function removeListener(_0xc74772,_0x467de3){return function(){VoiceExtensionEvents[_0xb4a9('0x4')](_0xc74772,_0x467de3);};}exports[_0xb4a9('0x5')]=function(_0x3556d3){for(var _0x1eb53a=0x0,_0x598e28=events[_0xb4a9('0x6')];_0x1eb53a<_0x598e28;_0x1eb53a++){var _0x5287c6=events[_0x1eb53a];var _0x32ddd8=createListener('voiceExtension:'+_0x5287c6,_0x3556d3);VoiceExtensionEvents['on'](_0x5287c6,_0x32ddd8);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 1e002bb..513d028 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 _0xa721=['index','get','show','/:id/messages','getMessages','post','/:id','update','delete','destroy','multer','path','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated'];(function(_0x388a7c,_0x487efd){var _0x280014=function(_0x30d73d){while(--_0x30d73d){_0x388a7c['push'](_0x388a7c['shift']());}};_0x280014(++_0x487efd);}(_0xa721,0xc5));var _0x1a72=function(_0x2453a6,_0x2e253f){_0x2453a6=_0x2453a6-0x0;var _0x360142=_0xa721[_0x2453a6];return _0x360142;};'use strict';var multer=require(_0x1a72('0x0'));var util=require('util');var path=require(_0x1a72('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a72('0x2')]();var auth=require(_0x1a72('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1a72('0x4'));var controller=require(_0x1a72('0x5'));router['get']('/',auth[_0x1a72('0x6')](),controller[_0x1a72('0x7')]);router[_0x1a72('0x8')]('/:id',auth[_0x1a72('0x6')](),controller[_0x1a72('0x9')]);router['get'](_0x1a72('0xa'),auth[_0x1a72('0x6')](),controller[_0x1a72('0xb')]);router[_0x1a72('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1a72('0xd'),auth['isAuthenticated'](),controller[_0x1a72('0xe')]);router[_0x1a72('0xf')](_0x1a72('0xd'),auth[_0x1a72('0x6')](),controller[_0x1a72('0x10')]);module['exports']=router; \ No newline at end of file +var _0x01b4=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x3f8f4b,_0x468f9f){var _0x43135c=function(_0x66057c){while(--_0x66057c){_0x3f8f4b['push'](_0x3f8f4b['shift']());}};_0x43135c(++_0x468f9f);}(_0x01b4,0x1ef));var _0x401b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01b4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x401b('0x0'));var path=require(_0x401b('0x1'));var timeout=require('connect-timeout');var express=require(_0x401b('0x2'));var router=express[_0x401b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x401b('0x4'));var config=require(_0x401b('0x5'));var controller=require(_0x401b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x401b('0x7')]);router[_0x401b('0x8')](_0x401b('0x9'),auth[_0x401b('0xa')](),controller[_0x401b('0xb')]);router[_0x401b('0x8')]('/:id/messages',auth[_0x401b('0xa')](),controller['getMessages']);router[_0x401b('0xc')]('/',auth[_0x401b('0xa')](),controller[_0x401b('0xd')]);router[_0x401b('0xe')](_0x401b('0x9'),auth[_0x401b('0xa')](),controller[_0x401b('0xf')]);router['delete'](_0x401b('0x9'),auth[_0x401b('0xa')](),controller[_0x401b('0x10')]);module[_0x401b('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 473b398..e2f8b57 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 _0xe605=['email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe605,0x92));var _0x5e60=function(_0x2b0550,_0x77fee2){_0x2b0550=_0x2b0550-0x0;var _0x33718d=_0xe605[_0x2b0550];return _0x33718d;};'use strict';var Sequelize=require(_0x5e60('0x0'));module[_0x5e60('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':_0x5e60('0x3'),'unique':_0x5e60('0x4')},'mailbox':{'type':Sequelize[_0x5e60('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e60('0x4')},'password':{'type':Sequelize[_0x5e60('0x2')]},'fullname':{'type':Sequelize[_0x5e60('0x2')]},'email':{'type':Sequelize[_0x5e60('0x2')],'validate':{'isEmail':!![]},'set':function(_0x297ab2){this[_0x5e60('0x5')](_0x5e60('0x6'),typeof _0x297ab2===_0x5e60('0x7')&&_0x297ab2['trim']()?_0x297ab2[_0x5e60('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x5e60('0x2')]},'review':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e60('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e60('0x9')](_0x5e60('0xa'),'no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e60('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e60('0x9')]('yes','no'),'defaultValue':_0x5e60('0xa'),'allowNull':![]},'stamp':{'type':_0x5e60('0xc')},'emailsubject':{'type':Sequelize[_0x5e60('0x2')]},'emailbody':{'type':Sequelize[_0x5e60('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x5e60('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e60('0xe')],'get':function(){return this['getDataValue'](_0x5e60('0xf'))+_0x5e60('0x10')+this[_0x5e60('0x11')](_0x5e60('0x12'));}}}; \ No newline at end of file +var _0x93e9=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x3804cc,_0x5bb9f3){var _0x8cbf4a=function(_0x2214a7){while(--_0x2214a7){_0x3804cc['push'](_0x3804cc['shift']());}};_0x8cbf4a(++_0x5bb9f3);}(_0x93e9,0xcc));var _0x993e=function(_0x212189,_0x45a745){_0x212189=_0x212189-0x0;var _0x3aca6a=_0x93e9[_0x212189];return _0x3aca6a;};'use strict';var Sequelize=require(_0x993e('0x0'));module[_0x993e('0x1')]={'customer_id':{'type':Sequelize[_0x993e('0x2')]},'context':{'type':Sequelize[_0x993e('0x2')],'defaultValue':_0x993e('0x3'),'unique':_0x993e('0x4')},'mailbox':{'type':Sequelize[_0x993e('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x993e('0x2')]},'email':{'type':Sequelize[_0x993e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x15ce9b){this[_0x993e('0x5')](_0x993e('0x6'),typeof _0x15ce9b===_0x993e('0x7')&&_0x15ce9b[_0x993e('0x8')]()?_0x15ce9b[_0x993e('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x993e('0x2')],'defaultValue':_0x993e('0x9')},'attach':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':_0x993e('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x993e('0x2')]},'callback':{'type':Sequelize[_0x993e('0x2')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x993e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x993e('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x993e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x993e('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':_0x993e('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x993e('0xa')](_0x993e('0xb'),'no'),'defaultValue':_0x993e('0xb'),'allowNull':![]},'stamp':{'type':_0x993e('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x993e('0x2')]},'maxsecs':{'type':Sequelize[_0x993e('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x993e('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x993e('0xf')],'get':function(){return this[_0x993e('0x10')](_0x993e('0x11'))+'\x20-\x20'+this[_0x993e('0x10')](_0x993e('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3b63739..f17e0e3 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 _0x21cd=['merge','VIRTUAL','filter','options','count','include','findAll','catch','show','params','filtears','includeAll','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','VoiceMailMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','VoiceMail','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x4bea75,_0x490697){var _0x31eb1a=function(_0x479bfb){while(--_0x479bfb){_0x4bea75['push'](_0x4bea75['shift']());}};_0x31eb1a(++_0x490697);}(_0x21cd,0x6a));var _0xd21c=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x21cd[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xd21c('0x0'));var emlformat=require(_0xd21c('0x1'));var rimraf=require(_0xd21c('0x2'));var zipdir=require(_0xd21c('0x3'));var jsonpatch=require(_0xd21c('0x4'));var rp=require(_0xd21c('0x5'));var moment=require(_0xd21c('0x6'));var BPromise=require(_0xd21c('0x7'));var Mustache=require(_0xd21c('0x8'));var util=require('util');var path=require('path');var sox=require(_0xd21c('0x9'));var csv=require(_0xd21c('0xa'));var ejs=require(_0xd21c('0xb'));var fs=require('fs');var _=require(_0xd21c('0xc'));var squel=require(_0xd21c('0xd'));var crypto=require('crypto');var jsforce=require(_0xd21c('0xe'));var deskjs=require(_0xd21c('0xf'));var toCsv=require(_0xd21c('0xa'));var querystring=require(_0xd21c('0x10'));var Papa=require(_0xd21c('0x11'));var Redis=require('ioredis');var authService=require(_0xd21c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd21c('0x13'));var hardwareService=require(_0xd21c('0x14'));var logger=require(_0xd21c('0x15'))(_0xd21c('0x16'));var utils=require(_0xd21c('0x17'));var config=require(_0xd21c('0x18'));var licenseUtil=require(_0xd21c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357c01,_0x620b37){_0x620b37=_0x620b37||0xcc;return function(_0x2da30c){if(_0x2da30c){return _0x357c01[_0xd21c('0x1a')](_0x620b37);}return _0x357c01[_0xd21c('0x1b')](_0x620b37)[_0xd21c('0x1c')]();};}function respondWithResult(_0x14d82e,_0x2a9362){_0x2a9362=_0x2a9362||0xc8;return function(_0x206aff){if(_0x206aff){return _0x14d82e[_0xd21c('0x1b')](_0x2a9362)[_0xd21c('0x1d')](_0x206aff);}};}function respondWithFilteredResult(_0xaecd8f,_0x5dcc9e){return function(_0x9f8774){if(_0x9f8774){var _0x2066bb=_0x9f8774['count'],_0x26c0fc=_0x5dcc9e[_0xd21c('0x1e')],_0x25c4ce=_0x5dcc9e[_0xd21c('0x1e')]+_0x5dcc9e[_0xd21c('0x1f')],_0x141da1;if(_0x25c4ce>=_0x2066bb){_0x25c4ce=_0x2066bb;_0x141da1=0xc8;}else{_0x141da1=0xce;}_0xaecd8f['status'](_0x141da1);return _0xaecd8f[_0xd21c('0x20')](_0xd21c('0x21'),_0x26c0fc+'-'+_0x25c4ce+'/'+_0x2066bb)['json'](_0x9f8774);}return null;};}function patchUpdates(_0x35a362){return function(_0xa96896){try{jsonpatch['apply'](_0xa96896,_0x35a362,!![]);}catch(_0x4e352a){return BPromise['reject'](_0x4e352a);}return _0xa96896[_0xd21c('0x22')]();};}function saveUpdates(_0x21a175,_0x1f00db){return function(_0xbb74a){if(_0xbb74a){return _0xbb74a['update'](_0x21a175)[_0xd21c('0x23')](function(_0x500c65){return _0x500c65;});}return null;};}function removeEntity(_0x5cad51,_0x26e381){return function(_0x75bd03){if(_0x75bd03){return _0x75bd03[_0xd21c('0x24')]()[_0xd21c('0x23')](function(){var _0x29ee5e=_0x75bd03[_0xd21c('0x25')]({'plain':!![]});var _0xa04dd3=_0xd21c('0x26');return db[_0xd21c('0x27')][_0xd21c('0x24')]({'where':{'type':_0xa04dd3,'resourceId':_0x29ee5e['id']}})[_0xd21c('0x23')](function(){return _0x75bd03;});})[_0xd21c('0x23')](function(){_0x5cad51['status'](0xcc)[_0xd21c('0x1c')]();});}};}function handleEntityNotFound(_0x5382bf,_0xdb6c99){return function(_0x492cf7){if(!_0x492cf7){_0x5382bf[_0xd21c('0x1a')](0x194);}return _0x492cf7;};}function handleError(_0x37d2ad,_0x1c0ab0){_0x1c0ab0=_0x1c0ab0||0x1f4;return function(_0x46f344){logger[_0xd21c('0x28')](_0x46f344[_0xd21c('0x29')]);if(_0x46f344[_0xd21c('0x2a')]){delete _0x46f344[_0xd21c('0x2a')];}_0x37d2ad[_0xd21c('0x1b')](_0x1c0ab0)[_0xd21c('0x2b')](_0x46f344);};}exports['index']=function(_0x416cca,_0x2c09b3){var _0x5c0e39={},_0x9eff15={},_0x54a944={'count':0x0,'rows':[]};var _0x557f2a=_['map'](db[_0xd21c('0x2c')][_0xd21c('0x2d')],function(_0x3b7f6e){return{'name':_0x3b7f6e[_0xd21c('0x2e')],'type':_0x3b7f6e[_0xd21c('0x2f')][_0xd21c('0x30')]};});_0x9eff15['model']=_[_0xd21c('0x31')](_0x557f2a,_0xd21c('0x2a'));_0x9eff15[_0xd21c('0x32')]=_[_0xd21c('0x33')](_0x416cca[_0xd21c('0x32')]);_0x9eff15['filters']=_[_0xd21c('0x34')](_0x9eff15[_0xd21c('0x35')],_0x9eff15['query']);_0x5c0e39['attributes']=_[_0xd21c('0x34')](_0x9eff15['model'],qs[_0xd21c('0x36')](_0x416cca[_0xd21c('0x32')]['fields']));_0x5c0e39[_0xd21c('0x37')]=_0x5c0e39['attributes'][_0xd21c('0x38')]?_0x5c0e39['attributes']:_0x9eff15[_0xd21c('0x35')];if(!_0x416cca[_0xd21c('0x32')][_0xd21c('0x39')](_0xd21c('0x3a'))){_0x5c0e39[_0xd21c('0x1f')]=qs[_0xd21c('0x1f')](_0x416cca[_0xd21c('0x32')][_0xd21c('0x1f')]);_0x5c0e39[_0xd21c('0x1e')]=qs[_0xd21c('0x1e')](_0x416cca[_0xd21c('0x32')]['offset']);}_0x5c0e39[_0xd21c('0x3b')]=qs[_0xd21c('0x3c')](_0x416cca[_0xd21c('0x32')][_0xd21c('0x3c')]);_0x5c0e39[_0xd21c('0x3d')]=qs[_0xd21c('0x3e')](_[_0xd21c('0x3f')](_0x416cca[_0xd21c('0x32')],_0x9eff15[_0xd21c('0x3e')]),_0x557f2a);if(_0x416cca[_0xd21c('0x32')]['filter']){_0x5c0e39[_0xd21c('0x3d')]=_[_0xd21c('0x40')](_0x5c0e39[_0xd21c('0x3d')],{'$or':_[_0xd21c('0x31')](_0x557f2a,function(_0x2a09db){if(_0x2a09db['type']!==_0xd21c('0x41')){var _0x41bd6b={};_0x41bd6b[_0x2a09db['name']]={'$like':'%'+_0x416cca[_0xd21c('0x32')][_0xd21c('0x42')]+'%'};return _0x41bd6b;}})});}_0x5c0e39=_['merge']({},_0x5c0e39,_0x416cca[_0xd21c('0x43')]);var _0x162d0c={'where':_0x5c0e39[_0xd21c('0x3d')]};return db[_0xd21c('0x2c')][_0xd21c('0x44')](_0x162d0c)[_0xd21c('0x23')](function(_0x284830){_0x54a944['count']=_0x284830;if(_0x416cca['query']['includeAll']){_0x5c0e39[_0xd21c('0x45')]=[{'all':!![]}];}return db[_0xd21c('0x2c')][_0xd21c('0x46')](_0x5c0e39);})[_0xd21c('0x23')](function(_0x77a65d){_0x54a944['rows']=_0x77a65d;return _0x54a944;})[_0xd21c('0x23')](respondWithFilteredResult(_0x2c09b3,_0x5c0e39))[_0xd21c('0x47')](handleError(_0x2c09b3,null));};exports[_0xd21c('0x48')]=function(_0x2e7300,_0x9ca6f1){var _0x135226={'raw':!![],'where':{'id':_0x2e7300[_0xd21c('0x49')]['id']}},_0x63c9f9={};_0x63c9f9['model']=_[_0xd21c('0x33')](db[_0xd21c('0x2c')][_0xd21c('0x2d')]);_0x63c9f9['query']=_[_0xd21c('0x33')](_0x2e7300[_0xd21c('0x32')]);_0x63c9f9[_0xd21c('0x4a')]=_[_0xd21c('0x34')](_0x63c9f9['model'],_0x63c9f9[_0xd21c('0x32')]);_0x135226[_0xd21c('0x37')]=_['intersection'](_0x63c9f9[_0xd21c('0x35')],qs[_0xd21c('0x36')](_0x2e7300[_0xd21c('0x32')]['fields']));_0x135226[_0xd21c('0x37')]=_0x135226['attributes'][_0xd21c('0x38')]?_0x135226['attributes']:_0x63c9f9['model'];if(_0x2e7300[_0xd21c('0x32')][_0xd21c('0x4b')]){_0x135226[_0xd21c('0x45')]=[{'all':!![]}];}_0x135226=_[_0xd21c('0x40')]({},_0x135226,_0x2e7300[_0xd21c('0x43')]);return db[_0xd21c('0x2c')][_0xd21c('0x4c')](_0x135226)['then'](handleEntityNotFound(_0x9ca6f1,null))['then'](respondWithResult(_0x9ca6f1,null))[_0xd21c('0x47')](handleError(_0x9ca6f1,null));};exports[_0xd21c('0x4d')]=function(_0x1a075c,_0x376ec7){return db[_0xd21c('0x2c')]['create'](_0x1a075c['body'],{})[_0xd21c('0x23')](function(_0x29c774){var _0x572a75=_0x1a075c[_0xd21c('0x4e')]['get']({'plain':!![]});if(!_0x572a75)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x572a75[_0xd21c('0x4f')]==='user'){var _0x5e2821=_0x29c774[_0xd21c('0x25')]({'plain':!![]});var _0x3847d4=_0xd21c('0x26');return db[_0xd21c('0x50')]['find']({'where':{'name':_0x3847d4,'userProfileId':_0x572a75['userProfileId']},'raw':!![]})[_0xd21c('0x23')](function(_0x560a77){if(_0x560a77&&_0x560a77[_0xd21c('0x51')]===0x0){return db[_0xd21c('0x27')][_0xd21c('0x4d')]({'name':_0x5e2821['name'],'resourceId':_0x5e2821['id'],'type':_0x560a77[_0xd21c('0x2a')],'sectionId':_0x560a77['id']},{})[_0xd21c('0x23')](function(){return _0x29c774;});}else{return _0x29c774;}})[_0xd21c('0x47')](function(_0x5c765b){logger['error'](_0xd21c('0x52'),_0x5c765b);throw _0x5c765b;});}return _0x29c774;})['then'](respondWithResult(_0x376ec7,0xc9))[_0xd21c('0x47')](handleError(_0x376ec7,null));};exports['update']=function(_0x46a4c8,_0x2775a8){if(_0x46a4c8[_0xd21c('0x53')]['id']){delete _0x46a4c8[_0xd21c('0x53')]['id'];}return db['VoiceMail'][_0xd21c('0x4c')]({'where':{'id':_0x46a4c8[_0xd21c('0x49')]['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x2775a8,null))['then'](saveUpdates(_0x46a4c8[_0xd21c('0x53')],null))['then'](respondWithResult(_0x2775a8,null))[_0xd21c('0x47')](handleError(_0x2775a8,null));};exports['destroy']=function(_0x5090f7,_0x380ba4){return db[_0xd21c('0x2c')][_0xd21c('0x4c')]({'where':{'id':_0x5090f7[_0xd21c('0x49')]['id']}})[_0xd21c('0x23')](handleEntityNotFound(_0x380ba4,null))[_0xd21c('0x23')](removeEntity(_0x380ba4,null))[_0xd21c('0x47')](handleError(_0x380ba4,null));};exports['getMessages']=function(_0x54a779,_0x4f258c,_0x38c859){return db[_0xd21c('0x2c')]['findOne']({'where':{'id':_0x54a779[_0xd21c('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f258c,null))[_0xd21c('0x23')](function(_0x1b7016){var _0x25475e;var _0x496ede={},_0x45abc8={};_0x45abc8[_0xd21c('0x35')]=_[_0xd21c('0x33')](db[_0xd21c('0x54')][_0xd21c('0x2d')]);_0x45abc8[_0xd21c('0x32')]=_[_0xd21c('0x33')](_0x54a779[_0xd21c('0x32')]);_0x45abc8['filters']=_[_0xd21c('0x34')](_0x45abc8[_0xd21c('0x35')],_0x45abc8['query']);_0x496ede[_0xd21c('0x37')]=_[_0xd21c('0x34')](_0x45abc8[_0xd21c('0x35')],qs[_0xd21c('0x36')](_0x54a779[_0xd21c('0x32')][_0xd21c('0x36')]));_0x496ede[_0xd21c('0x37')]=_0x496ede[_0xd21c('0x37')]['length']?_0x496ede['attributes']:_0x45abc8[_0xd21c('0x35')];if(!_0x54a779[_0xd21c('0x32')][_0xd21c('0x39')](_0xd21c('0x3a'))){_0x496ede[_0xd21c('0x1f')]=qs[_0xd21c('0x1f')](_0x54a779[_0xd21c('0x32')]['limit']);_0x496ede[_0xd21c('0x1e')]=qs[_0xd21c('0x1e')](_0x54a779[_0xd21c('0x32')]['offset']);}_0x496ede[_0xd21c('0x3b')]=qs[_0xd21c('0x3c')](_0x54a779[_0xd21c('0x32')][_0xd21c('0x3c')]);_0x496ede[_0xd21c('0x3d')]=qs[_0xd21c('0x3e')](_[_0xd21c('0x3f')](_0x54a779[_0xd21c('0x32')],_0x45abc8[_0xd21c('0x3e')]));if(_0x54a779[_0xd21c('0x32')][_0xd21c('0x42')]){_0x496ede[_0xd21c('0x3d')]=_[_0xd21c('0x40')](_0x496ede[_0xd21c('0x3d')],{'$or':_[_0xd21c('0x31')](_0x496ede[_0xd21c('0x37')],function(_0x2603d6){var _0x1e9b6e={};_0x1e9b6e[_0x2603d6]={'$like':'%'+_0x54a779[_0xd21c('0x32')]['filter']+'%'};return _0x1e9b6e;})});}_0x496ede[_0xd21c('0x3d')]=_[_0xd21c('0x40')](_0x496ede[_0xd21c('0x3d')],{'mailboxuser':_0x1b7016['mailbox']});_0x496ede=_['merge']({},_0x496ede,_0x54a779['options']);return db[_0xd21c('0x54')]['findAndCountAll'](_0x496ede)[_0xd21c('0x23')](respondWithFilteredResult(_0x4f258c,_0x496ede));})[_0xd21c('0x47')](handleError(_0x4f258c,null));}; \ No newline at end of file +var _0x0f9f=['path','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','filtears','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','findOne','VoiceMailMessage','hasOwnProperty','filters','pick','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x47eaff,_0x502553){var _0x53103e=function(_0x4dcd87){while(--_0x4dcd87){_0x47eaff['push'](_0x47eaff['shift']());}};_0x53103e(++_0x502553);}(_0x0f9f,0xae));var _0xf0f9=function(_0x1c4f4a,_0x1b254c){_0x1c4f4a=_0x1c4f4a-0x0;var _0x1e6a1b=_0x0f9f[_0x1c4f4a];return _0x1e6a1b;};'use strict';var pdf=require(_0xf0f9('0x0'));var emlformat=require(_0xf0f9('0x1'));var rimraf=require(_0xf0f9('0x2'));var zipdir=require(_0xf0f9('0x3'));var jsonpatch=require(_0xf0f9('0x4'));var rp=require(_0xf0f9('0x5'));var moment=require(_0xf0f9('0x6'));var BPromise=require(_0xf0f9('0x7'));var Mustache=require(_0xf0f9('0x8'));var util=require(_0xf0f9('0x9'));var path=require(_0xf0f9('0xa'));var sox=require('sox');var csv=require(_0xf0f9('0xb'));var ejs=require(_0xf0f9('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf0f9('0xd'));var crypto=require(_0xf0f9('0xe'));var jsforce=require(_0xf0f9('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0xb'));var querystring=require(_0xf0f9('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0f9('0x11'));var authService=require(_0xf0f9('0x12'));var qs=require(_0xf0f9('0x13'));var as=require(_0xf0f9('0x14'));var hardwareService=require(_0xf0f9('0x15'));var logger=require(_0xf0f9('0x16'))(_0xf0f9('0x17'));var utils=require(_0xf0f9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf0f9('0x19'));var db=require(_0xf0f9('0x1a'))['db'];function respondWithStatusCode(_0xc23039,_0x458e1c){_0x458e1c=_0x458e1c||0xcc;return function(_0x5b0fa7){if(_0x5b0fa7){return _0xc23039[_0xf0f9('0x1b')](_0x458e1c);}return _0xc23039[_0xf0f9('0x1c')](_0x458e1c)['end']();};}function respondWithResult(_0x334c39,_0x519adf){_0x519adf=_0x519adf||0xc8;return function(_0x538864){if(_0x538864){return _0x334c39[_0xf0f9('0x1c')](_0x519adf)['json'](_0x538864);}};}function respondWithFilteredResult(_0x3e1587,_0x516717){return function(_0x3c23ec){if(_0x3c23ec){var _0x336483=_0x3c23ec[_0xf0f9('0x1d')],_0x1a3a82=_0x516717[_0xf0f9('0x1e')],_0xf4d805=_0x516717['offset']+_0x516717[_0xf0f9('0x1f')],_0x236cbd;if(_0xf4d805>=_0x336483){_0xf4d805=_0x336483;_0x236cbd=0xc8;}else{_0x236cbd=0xce;}_0x3e1587[_0xf0f9('0x1c')](_0x236cbd);return _0x3e1587[_0xf0f9('0x20')](_0xf0f9('0x21'),_0x1a3a82+'-'+_0xf4d805+'/'+_0x336483)[_0xf0f9('0x22')](_0x3c23ec);}return null;};}function patchUpdates(_0x2c9ec2){return function(_0x1765ad){try{jsonpatch[_0xf0f9('0x23')](_0x1765ad,_0x2c9ec2,!![]);}catch(_0x5ebbe9){return BPromise[_0xf0f9('0x24')](_0x5ebbe9);}return _0x1765ad['save']();};}function saveUpdates(_0x3664ff,_0x510119){return function(_0x3f4f97){if(_0x3f4f97){return _0x3f4f97[_0xf0f9('0x25')](_0x3664ff)[_0xf0f9('0x26')](function(_0x44f964){return _0x44f964;});}return null;};}function removeEntity(_0xaff53c,_0x1b9740){return function(_0x49bddc){if(_0x49bddc){return _0x49bddc[_0xf0f9('0x27')]()['then'](function(){var _0x2cb8f8=_0x49bddc[_0xf0f9('0x28')]({'plain':!![]});var _0x55ba89=_0xf0f9('0x29');return db[_0xf0f9('0x2a')]['destroy']({'where':{'type':_0x55ba89,'resourceId':_0x2cb8f8['id']}})[_0xf0f9('0x26')](function(){return _0x49bddc;});})[_0xf0f9('0x26')](function(){_0xaff53c[_0xf0f9('0x1c')](0xcc)[_0xf0f9('0x2b')]();});}};}function handleEntityNotFound(_0x3ce34a,_0x2c8a79){return function(_0x4c7c7c){if(!_0x4c7c7c){_0x3ce34a[_0xf0f9('0x1b')](0x194);}return _0x4c7c7c;};}function handleError(_0x4c31f2,_0x8ec941){_0x8ec941=_0x8ec941||0x1f4;return function(_0x2e3fbc){logger[_0xf0f9('0x2c')](_0x2e3fbc[_0xf0f9('0x2d')]);if(_0x2e3fbc['name']){delete _0x2e3fbc[_0xf0f9('0x2e')];}_0x4c31f2[_0xf0f9('0x1c')](_0x8ec941)[_0xf0f9('0x2f')](_0x2e3fbc);};}exports['index']=function(_0x3bcd66,_0x1cafc0){var _0x5957b1={},_0xfd5593={},_0x53d023={'count':0x0,'rows':[]};var _0x458621=_[_0xf0f9('0x30')](db[_0xf0f9('0x31')][_0xf0f9('0x32')],function(_0x1f0c1f){return{'name':_0x1f0c1f[_0xf0f9('0x33')],'type':_0x1f0c1f[_0xf0f9('0x34')][_0xf0f9('0x35')]};});_0xfd5593[_0xf0f9('0x36')]=_[_0xf0f9('0x30')](_0x458621,'name');_0xfd5593[_0xf0f9('0x37')]=_[_0xf0f9('0x38')](_0x3bcd66['query']);_0xfd5593['filters']=_[_0xf0f9('0x39')](_0xfd5593[_0xf0f9('0x36')],_0xfd5593[_0xf0f9('0x37')]);_0x5957b1[_0xf0f9('0x3a')]=_[_0xf0f9('0x39')](_0xfd5593[_0xf0f9('0x36')],qs[_0xf0f9('0x3b')](_0x3bcd66['query'][_0xf0f9('0x3b')]));_0x5957b1['attributes']=_0x5957b1[_0xf0f9('0x3a')][_0xf0f9('0x3c')]?_0x5957b1[_0xf0f9('0x3a')]:_0xfd5593['model'];if(!_0x3bcd66[_0xf0f9('0x37')]['hasOwnProperty'](_0xf0f9('0x3d'))){_0x5957b1['limit']=qs['limit'](_0x3bcd66[_0xf0f9('0x37')][_0xf0f9('0x1f')]);_0x5957b1[_0xf0f9('0x1e')]=qs[_0xf0f9('0x1e')](_0x3bcd66[_0xf0f9('0x37')][_0xf0f9('0x1e')]);}_0x5957b1['order']=qs['sort'](_0x3bcd66[_0xf0f9('0x37')][_0xf0f9('0x3e')]);_0x5957b1[_0xf0f9('0x3f')]=qs['filters'](_['pick'](_0x3bcd66[_0xf0f9('0x37')],_0xfd5593['filters']),_0x458621);if(_0x3bcd66[_0xf0f9('0x37')][_0xf0f9('0x40')]){_0x5957b1[_0xf0f9('0x3f')]=_[_0xf0f9('0x41')](_0x5957b1['where'],{'$or':_[_0xf0f9('0x30')](_0x458621,function(_0x272c33){if(_0x272c33[_0xf0f9('0x34')]!==_0xf0f9('0x42')){var _0x58e78f={};_0x58e78f[_0x272c33['name']]={'$like':'%'+_0x3bcd66['query'][_0xf0f9('0x40')]+'%'};return _0x58e78f;}})});}_0x5957b1=_[_0xf0f9('0x41')]({},_0x5957b1,_0x3bcd66[_0xf0f9('0x43')]);var _0x1afe68={'where':_0x5957b1[_0xf0f9('0x3f')]};return db[_0xf0f9('0x31')][_0xf0f9('0x1d')](_0x1afe68)['then'](function(_0x39a255){_0x53d023[_0xf0f9('0x1d')]=_0x39a255;if(_0x3bcd66[_0xf0f9('0x37')][_0xf0f9('0x44')]){_0x5957b1[_0xf0f9('0x45')]=[{'all':!![]}];}return db[_0xf0f9('0x31')]['findAll'](_0x5957b1);})[_0xf0f9('0x26')](function(_0x54788b){_0x53d023[_0xf0f9('0x46')]=_0x54788b;return _0x53d023;})[_0xf0f9('0x26')](respondWithFilteredResult(_0x1cafc0,_0x5957b1))[_0xf0f9('0x47')](handleError(_0x1cafc0,null));};exports[_0xf0f9('0x48')]=function(_0x294e57,_0x574364){var _0x242c4b={'raw':!![],'where':{'id':_0x294e57[_0xf0f9('0x49')]['id']}},_0x534491={};_0x534491[_0xf0f9('0x36')]=_[_0xf0f9('0x38')](db[_0xf0f9('0x31')][_0xf0f9('0x32')]);_0x534491[_0xf0f9('0x37')]=_['keys'](_0x294e57[_0xf0f9('0x37')]);_0x534491[_0xf0f9('0x4a')]=_[_0xf0f9('0x39')](_0x534491['model'],_0x534491[_0xf0f9('0x37')]);_0x242c4b['attributes']=_[_0xf0f9('0x39')](_0x534491['model'],qs['fields'](_0x294e57['query']['fields']));_0x242c4b[_0xf0f9('0x3a')]=_0x242c4b['attributes'][_0xf0f9('0x3c')]?_0x242c4b[_0xf0f9('0x3a')]:_0x534491['model'];if(_0x294e57[_0xf0f9('0x37')][_0xf0f9('0x44')]){_0x242c4b[_0xf0f9('0x45')]=[{'all':!![]}];}_0x242c4b=_[_0xf0f9('0x41')]({},_0x242c4b,_0x294e57[_0xf0f9('0x43')]);return db['VoiceMail'][_0xf0f9('0x4b')](_0x242c4b)[_0xf0f9('0x26')](handleEntityNotFound(_0x574364,null))[_0xf0f9('0x26')](respondWithResult(_0x574364,null))[_0xf0f9('0x47')](handleError(_0x574364,null));};exports['create']=function(_0x3c06dd,_0x633948){return db[_0xf0f9('0x31')][_0xf0f9('0x4c')](_0x3c06dd[_0xf0f9('0x4d')],{})[_0xf0f9('0x26')](function(_0x3dd389){var _0x299cec=_0x3c06dd[_0xf0f9('0x4e')][_0xf0f9('0x28')]({'plain':!![]});if(!_0x299cec)throw new Error(_0xf0f9('0x4f'));if(_0x299cec[_0xf0f9('0x50')]==='user'){var _0x7dfb7b=_0x3dd389[_0xf0f9('0x28')]({'plain':!![]});var _0xffc89f='Voicemails';return db[_0xf0f9('0x51')][_0xf0f9('0x4b')]({'where':{'name':_0xffc89f,'userProfileId':_0x299cec[_0xf0f9('0x52')]},'raw':!![]})[_0xf0f9('0x26')](function(_0x25bdcd){if(_0x25bdcd&&_0x25bdcd[_0xf0f9('0x53')]===0x0){return db[_0xf0f9('0x2a')][_0xf0f9('0x4c')]({'name':_0x7dfb7b['name'],'resourceId':_0x7dfb7b['id'],'type':_0x25bdcd[_0xf0f9('0x2e')],'sectionId':_0x25bdcd['id']},{})[_0xf0f9('0x26')](function(){return _0x3dd389;});}else{return _0x3dd389;}})['catch'](function(_0x56c5e8){logger[_0xf0f9('0x2c')](_0xf0f9('0x54'),_0x56c5e8);throw _0x56c5e8;});}return _0x3dd389;})[_0xf0f9('0x26')](respondWithResult(_0x633948,0xc9))['catch'](handleError(_0x633948,null));};exports[_0xf0f9('0x25')]=function(_0xee854d,_0x23a444){if(_0xee854d['body']['id']){delete _0xee854d[_0xf0f9('0x4d')]['id'];}return db['VoiceMail'][_0xf0f9('0x4b')]({'where':{'id':_0xee854d[_0xf0f9('0x49')]['id']}})[_0xf0f9('0x26')](handleEntityNotFound(_0x23a444,null))[_0xf0f9('0x26')](saveUpdates(_0xee854d[_0xf0f9('0x4d')],null))['then'](respondWithResult(_0x23a444,null))[_0xf0f9('0x47')](handleError(_0x23a444,null));};exports[_0xf0f9('0x27')]=function(_0x1a5904,_0x17e008){return db[_0xf0f9('0x31')][_0xf0f9('0x4b')]({'where':{'id':_0x1a5904[_0xf0f9('0x49')]['id']}})[_0xf0f9('0x26')](handleEntityNotFound(_0x17e008,null))[_0xf0f9('0x26')](removeEntity(_0x17e008,null))[_0xf0f9('0x47')](handleError(_0x17e008,null));};exports['getMessages']=function(_0x3cbc15,_0x586249,_0x10e9ad){return db[_0xf0f9('0x31')][_0xf0f9('0x55')]({'where':{'id':_0x3cbc15['params']['id']}})[_0xf0f9('0x26')](handleEntityNotFound(_0x586249,null))[_0xf0f9('0x26')](function(_0x38d728){var _0x28af1c;var _0x320b39={},_0x5d150a={};_0x5d150a[_0xf0f9('0x36')]=_[_0xf0f9('0x38')](db[_0xf0f9('0x56')][_0xf0f9('0x32')]);_0x5d150a['query']=_[_0xf0f9('0x38')](_0x3cbc15[_0xf0f9('0x37')]);_0x5d150a['filters']=_['intersection'](_0x5d150a[_0xf0f9('0x36')],_0x5d150a[_0xf0f9('0x37')]);_0x320b39[_0xf0f9('0x3a')]=_['intersection'](_0x5d150a[_0xf0f9('0x36')],qs[_0xf0f9('0x3b')](_0x3cbc15[_0xf0f9('0x37')][_0xf0f9('0x3b')]));_0x320b39[_0xf0f9('0x3a')]=_0x320b39[_0xf0f9('0x3a')][_0xf0f9('0x3c')]?_0x320b39[_0xf0f9('0x3a')]:_0x5d150a[_0xf0f9('0x36')];if(!_0x3cbc15[_0xf0f9('0x37')][_0xf0f9('0x57')](_0xf0f9('0x3d'))){_0x320b39[_0xf0f9('0x1f')]=qs[_0xf0f9('0x1f')](_0x3cbc15[_0xf0f9('0x37')][_0xf0f9('0x1f')]);_0x320b39['offset']=qs['offset'](_0x3cbc15[_0xf0f9('0x37')][_0xf0f9('0x1e')]);}_0x320b39['order']=qs['sort'](_0x3cbc15[_0xf0f9('0x37')]['sort']);_0x320b39[_0xf0f9('0x3f')]=qs[_0xf0f9('0x58')](_[_0xf0f9('0x59')](_0x3cbc15['query'],_0x5d150a[_0xf0f9('0x58')]));if(_0x3cbc15[_0xf0f9('0x37')][_0xf0f9('0x40')]){_0x320b39[_0xf0f9('0x3f')]=_[_0xf0f9('0x41')](_0x320b39[_0xf0f9('0x3f')],{'$or':_[_0xf0f9('0x30')](_0x320b39['attributes'],function(_0xa2d132){var _0x59daa4={};_0x59daa4[_0xa2d132]={'$like':'%'+_0x3cbc15['query'][_0xf0f9('0x40')]+'%'};return _0x59daa4;})});}_0x320b39[_0xf0f9('0x3f')]=_[_0xf0f9('0x41')](_0x320b39['where'],{'mailboxuser':_0x38d728[_0xf0f9('0x5a')]});_0x320b39=_['merge']({},_0x320b39,_0x3cbc15[_0xf0f9('0x43')]);return db[_0xf0f9('0x56')][_0xf0f9('0x5b')](_0x320b39)[_0xf0f9('0x26')](respondWithFilteredResult(_0x586249,_0x320b39));})['catch'](handleError(_0x586249,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a6bdf40..7549fec 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 _0x6755=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','mailbox_context','mailbox','context'];(function(_0x2e4b61,_0x2facd9){var _0x1bc009=function(_0x527082){while(--_0x527082){_0x2e4b61['push'](_0x2e4b61['shift']());}};_0x1bc009(++_0x2facd9);}(_0x6755,0x193));var _0x5675=function(_0x51a1cb,_0x184c68){_0x51a1cb=_0x51a1cb-0x0;var _0x218d7c=_0x6755[_0x51a1cb];return _0x218d7c;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var logger=require('../../config/logger')(_0x5675('0x2'));var moment=require(_0x5675('0x3'));var BPromise=require('bluebird');var rp=require(_0x5675('0x4'));var fs=require('fs');var path=require(_0x5675('0x5'));var rimraf=require(_0x5675('0x6'));var config=require(_0x5675('0x7'));var attributes=require('./voiceMail.attributes');module[_0x5675('0x8')]=function(_0x256fc6,_0x425a6c){return _0x256fc6[_0x5675('0x9')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x5675('0xa'),'fields':[_0x5675('0xb'),_0x5675('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd23=['../../config/logger','api','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash'];(function(_0x339728,_0x230c78){var _0x4b0c15=function(_0x41e49f){while(--_0x41e49f){_0x339728['push'](_0x339728['shift']());}};_0x4b0c15(++_0x230c78);}(_0xdd23,0x1a3));var _0x3dd2=function(_0x1350ae,_0x6ee22f){_0x1350ae=_0x1350ae-0x0;var _0x25d9e6=_0xdd23[_0x1350ae];return _0x25d9e6;};'use strict';var _=require(_0x3dd2('0x0'));var util=require('util');var logger=require(_0x3dd2('0x1'))(_0x3dd2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3dd2('0x3'));var fs=require('fs');var path=require(_0x3dd2('0x4'));var rimraf=require('rimraf');var config=require(_0x3dd2('0x5'));var attributes=require(_0x3dd2('0x6'));module[_0x3dd2('0x7')]=function(_0x56a54a,_0x45d4cd){return _0x56a54a[_0x3dd2('0x8')](_0x3dd2('0x9'),attributes,{'tableName':_0x3dd2('0xa'),'paranoid':![],'indexes':[{'name':_0x3dd2('0xb'),'fields':[_0x3dd2('0xc'),_0x3dd2('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 f2ee6fb..a497bef 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 _0x034b=['util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x375575,_0x7ef8c4){var _0x74f5e4=function(_0x25116f){while(--_0x25116f){_0x375575['push'](_0x375575['shift']());}};_0x74f5e4(++_0x7ef8c4);}(_0x034b,0xf6));var _0xb034=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x034b[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xb034('0x0'));var util=require(_0xb034('0x1'));var moment=require(_0xb034('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb034('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb034('0x4'));var logger=require('../../config/logger')(_0xb034('0x5'));var config=require(_0xb034('0x6'));var jayson=require(_0xb034('0x7'));var client=jayson[_0xb034('0x8')][_0xb034('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba9e5,_0x1047cd,_0x127c44){return new BPromise(function(_0x570b1e,_0x2e053f){return client['request'](_0x1ba9e5,_0x127c44)['then'](function(_0x41f6e6){logger[_0xb034('0xa')](_0xb034('0xb'),_0x1047cd,_0xb034('0xc'));logger[_0xb034('0xd')](_0xb034('0xe'),_0x1047cd,_0xb034('0xc'),JSON['stringify'](_0x41f6e6));if(_0x41f6e6[_0xb034('0xf')]){if(_0x41f6e6[_0xb034('0xf')][_0xb034('0x10')]===0x1f4){logger[_0xb034('0xf')]('VoiceMail,\x20%s,\x20%s',_0x1047cd,_0x41f6e6['error'][_0xb034('0x11')]);return _0x2e053f(_0x41f6e6[_0xb034('0xf')][_0xb034('0x11')]);}logger[_0xb034('0xf')](_0xb034('0xb'),_0x1047cd,_0x41f6e6[_0xb034('0xf')][_0xb034('0x11')]);return _0x570b1e(_0x41f6e6['error'][_0xb034('0x11')]);}else{logger[_0xb034('0xa')]('VoiceMail,\x20%s,\x20%s',_0x1047cd,_0xb034('0xc'));_0x570b1e(_0x41f6e6[_0xb034('0x12')][_0xb034('0x11')]);}})['catch'](function(_0xe29aee){logger[_0xb034('0xf')](_0xb034('0xb'),_0x1047cd,_0xe29aee);_0x2e053f(_0xe29aee);});});} \ No newline at end of file +var _0x4f95=['info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x4f67cd,_0x1d85cc){var _0xb7eafb=function(_0x215a83){while(--_0x215a83){_0x4f67cd['push'](_0x4f67cd['shift']());}};_0xb7eafb(++_0x1d85cc);}(_0x4f95,0x9c));var _0x54f9=function(_0x5ae689,_0x54b1dd){_0x5ae689=_0x5ae689-0x0;var _0xc2fc9e=_0x4f95[_0x5ae689];return _0xc2fc9e;};'use strict';var _=require(_0x54f9('0x0'));var util=require(_0x54f9('0x1'));var moment=require(_0x54f9('0x2'));var BPromise=require(_0x54f9('0x3'));var rs=require(_0x54f9('0x4'));var fs=require('fs');var Redis=require(_0x54f9('0x5'));var db=require(_0x54f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x54f9('0x7'))(_0x54f9('0x8'));var config=require(_0x54f9('0x9'));var jayson=require(_0x54f9('0xa'));var client=jayson[_0x54f9('0xb')][_0x54f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e53d3,_0xdb3b5c,_0x437cd1){return new BPromise(function(_0x4ef372,_0x2119dc){return client[_0x54f9('0xd')](_0x2e53d3,_0x437cd1)['then'](function(_0x54638d){logger['info'](_0x54f9('0xe'),_0xdb3b5c,_0x54f9('0xf'));logger[_0x54f9('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0xdb3b5c,_0x54f9('0xf'),JSON['stringify'](_0x54638d));if(_0x54638d[_0x54f9('0x11')]){if(_0x54638d[_0x54f9('0x11')][_0x54f9('0x12')]===0x1f4){logger['error'](_0x54f9('0xe'),_0xdb3b5c,_0x54638d[_0x54f9('0x11')][_0x54f9('0x13')]);return _0x2119dc(_0x54638d['error'][_0x54f9('0x13')]);}logger[_0x54f9('0x11')](_0x54f9('0xe'),_0xdb3b5c,_0x54638d[_0x54f9('0x11')][_0x54f9('0x13')]);return _0x4ef372(_0x54638d['error'][_0x54f9('0x13')]);}else{logger[_0x54f9('0x14')](_0x54f9('0xe'),_0xdb3b5c,_0x54f9('0xf'));_0x4ef372(_0x54638d[_0x54f9('0x15')][_0x54f9('0x13')]);}})['catch'](function(_0x50653b){logger[_0x54f9('0x11')](_0x54f9('0xe'),_0xdb3b5c,_0x50653b);_0x2119dc(_0x50653b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index d2c1a79..8aa1864 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 _0x326f=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4304a0,_0x31918f){var _0x2e6ae1=function(_0xf0b88){while(--_0xf0b88){_0x4304a0['push'](_0x4304a0['shift']());}};_0x2e6ae1(++_0x31918f);}(_0x326f,0xd1));var _0xf326=function(_0x3e6683,_0x38e75e){_0x3e6683=_0x3e6683-0x0;var _0x45422d=_0x326f[_0x3e6683];return _0x45422d;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf326('0xd')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file +var _0x326f=['./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a5bf0,_0x586555){var _0x33c9aa=function(_0x2873ff){while(--_0x2873ff){_0x5a5bf0['push'](_0x5a5bf0['shift']());}};_0x33c9aa(++_0x586555);}(_0x326f,0xd1));var _0xf326=function(_0x1029e2,_0x2ea7f8){_0x1029e2=_0x1029e2-0x0;var _0x2e36a9=_0x326f[_0x1029e2];return _0x2e36a9;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xf326('0xd')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);router['delete'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 1a6fd99..a1fdace 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 _0xef46=['STRING','BLOB','long','sequelize','exports','VIRTUAL','getDataValue'];(function(_0xdd1be,_0x644119){var _0x13f577=function(_0xa936b4){while(--_0xa936b4){_0xdd1be['push'](_0xdd1be['shift']());}};_0x13f577(++_0x644119);}(_0xef46,0xf1));var _0x6ef4=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xef46[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0x6ef4('0x0'));module[_0x6ef4('0x1')]={'name':{'type':Sequelize[_0x6ef4('0x2')],'get':function(_0x3cd669){return this[_0x6ef4('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x6ef4('0x5')](_0x6ef4('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x6ef4('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x2c3f=['BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x552584,_0x1aeba3){var _0x22fd95=function(_0x2774ab){while(--_0x2774ab){_0x552584['push'](_0x552584['shift']());}};_0x22fd95(++_0x1aeba3);}(_0x2c3f,0x108));var _0xf2c3=function(_0x174255,_0x553d3f){_0x174255=_0x174255-0x0;var _0x2aaee8=_0x2c3f[_0x174255];return _0x2aaee8;};'use strict';var Sequelize=require(_0xf2c3('0x0'));module[_0xf2c3('0x1')]={'name':{'type':Sequelize[_0xf2c3('0x2')],'get':function(_0x312500){return this[_0xf2c3('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xf2c3('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xf2c3('0x6')](_0xf2c3('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xf2c3('0x5')],'defaultValue':''},'stamp':{'type':_0xf2c3('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c9fed6c..2b19373 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 _0xeea3=['rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','filtears','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','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','../../config/license/util','sendStatus','status','json','offset','limit','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','index','VoiceMailMessage'];(function(_0x3449ad,_0x4acbe3){var _0x54ebc8=function(_0x49a34c){while(--_0x49a34c){_0x3449ad['push'](_0x3449ad['shift']());}};_0x54ebc8(++_0x4acbe3);}(_0xeea3,0xd7));var _0x3eea=function(_0x46e69f,_0x2380e6){_0x46e69f=_0x46e69f-0x0;var _0x23819c=_0xeea3[_0x46e69f];return _0x23819c;};'use strict';var pdf=require(_0x3eea('0x0'));var emlformat=require(_0x3eea('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3eea('0x2'));var jsonpatch=require(_0x3eea('0x3'));var rp=require(_0x3eea('0x4'));var moment=require(_0x3eea('0x5'));var BPromise=require(_0x3eea('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3eea('0x7'));var sox=require(_0x3eea('0x8'));var csv=require('to-csv');var ejs=require(_0x3eea('0x9'));var fs=require('fs');var _=require(_0x3eea('0xa'));var squel=require(_0x3eea('0xb'));var crypto=require('crypto');var jsforce=require(_0x3eea('0xc'));var deskjs=require(_0x3eea('0xd'));var toCsv=require(_0x3eea('0xe'));var querystring=require(_0x3eea('0xf'));var Papa=require(_0x3eea('0x10'));var Redis=require('ioredis');var authService=require(_0x3eea('0x11'));var qs=require(_0x3eea('0x12'));var as=require(_0x3eea('0x13'));var hardwareService=require(_0x3eea('0x14'));var logger=require(_0x3eea('0x15'))(_0x3eea('0x16'));var utils=require(_0x3eea('0x17'));var config=require(_0x3eea('0x18'));var licenseUtil=require(_0x3eea('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd4d177,_0x4de246){_0x4de246=_0x4de246||0xcc;return function(_0x18154c){if(_0x18154c){return _0xd4d177[_0x3eea('0x1a')](_0x4de246);}return _0xd4d177[_0x3eea('0x1b')](_0x4de246)['end']();};}function respondWithResult(_0x7a8157,_0xff5531){_0xff5531=_0xff5531||0xc8;return function(_0xf63f7e){if(_0xf63f7e){return _0x7a8157[_0x3eea('0x1b')](_0xff5531)[_0x3eea('0x1c')](_0xf63f7e);}};}function respondWithFilteredResult(_0x3a149d,_0x5db3f7){return function(_0x16b4a5){if(_0x16b4a5){var _0x38cbfc=_0x16b4a5['count'],_0x27e1ee=_0x5db3f7[_0x3eea('0x1d')],_0x3f1e68=_0x5db3f7['offset']+_0x5db3f7[_0x3eea('0x1e')],_0x5ee088;if(_0x3f1e68>=_0x38cbfc){_0x3f1e68=_0x38cbfc;_0x5ee088=0xc8;}else{_0x5ee088=0xce;}_0x3a149d['status'](_0x5ee088);return _0x3a149d['set'](_0x3eea('0x1f'),_0x27e1ee+'-'+_0x3f1e68+'/'+_0x38cbfc)[_0x3eea('0x1c')](_0x16b4a5);}return null;};}function patchUpdates(_0x504f9b){return function(_0x4bd67c){try{jsonpatch[_0x3eea('0x20')](_0x4bd67c,_0x504f9b,!![]);}catch(_0x300c98){return BPromise[_0x3eea('0x21')](_0x300c98);}return _0x4bd67c['save']();};}function saveUpdates(_0x28b9f2,_0x1be1c6){return function(_0x306a89){if(_0x306a89){return _0x306a89['update'](_0x28b9f2)[_0x3eea('0x22')](function(_0x7c55d6){return _0x7c55d6;});}return null;};}function removeEntity(_0xbece69,_0x4350ae){return function(_0x3bcfeb){if(_0x3bcfeb){return _0x3bcfeb[_0x3eea('0x23')]()[_0x3eea('0x22')](function(){_0xbece69[_0x3eea('0x1b')](0xcc)[_0x3eea('0x24')]();});}};}function handleEntityNotFound(_0x96755d,_0x4ae4e3){return function(_0x27950b){if(!_0x27950b){_0x96755d[_0x3eea('0x1a')](0x194);}return _0x27950b;};}function handleError(_0x5342ea,_0x36893b){_0x36893b=_0x36893b||0x1f4;return function(_0x2bad07){logger[_0x3eea('0x25')](_0x2bad07[_0x3eea('0x26')]);if(_0x2bad07[_0x3eea('0x27')]){delete _0x2bad07[_0x3eea('0x27')];}_0x5342ea[_0x3eea('0x1b')](_0x36893b)[_0x3eea('0x28')](_0x2bad07);};}exports[_0x3eea('0x29')]=function(_0x4136ce,_0x333574){var _0x221fb6={},_0x40e6f9={},_0x3e0963={'count':0x0,'rows':[]};var _0x1098ee=_['map'](db[_0x3eea('0x2a')][_0x3eea('0x2b')],function(_0x38babe){return{'name':_0x38babe[_0x3eea('0x2c')],'type':_0x38babe[_0x3eea('0x2d')][_0x3eea('0x2e')]};});_0x40e6f9[_0x3eea('0x2f')]=_[_0x3eea('0x30')](_['map'](_0x1098ee,'name'),[_0x3eea('0x27')]);_0x40e6f9['query']=_[_0x3eea('0x31')](_0x4136ce[_0x3eea('0x32')]);_0x40e6f9[_0x3eea('0x33')]=_[_0x3eea('0x34')](_0x40e6f9[_0x3eea('0x2f')],_0x40e6f9[_0x3eea('0x32')]);_0x221fb6[_0x3eea('0x35')]=_[_0x3eea('0x34')](_0x40e6f9[_0x3eea('0x2f')],qs[_0x3eea('0x36')](_0x4136ce[_0x3eea('0x32')]['fields']));_0x221fb6[_0x3eea('0x35')]=_0x221fb6[_0x3eea('0x35')][_0x3eea('0x37')]?_0x221fb6[_0x3eea('0x35')]:_0x40e6f9[_0x3eea('0x2f')];if(!_0x4136ce[_0x3eea('0x32')]['hasOwnProperty'](_0x3eea('0x38'))){_0x221fb6[_0x3eea('0x1e')]=qs[_0x3eea('0x1e')](_0x4136ce['query'][_0x3eea('0x1e')]);_0x221fb6[_0x3eea('0x1d')]=qs[_0x3eea('0x1d')](_0x4136ce[_0x3eea('0x32')][_0x3eea('0x1d')]);}_0x221fb6[_0x3eea('0x39')]=qs['sort'](_0x4136ce[_0x3eea('0x32')]['sort']);_0x221fb6[_0x3eea('0x3a')]=qs['filters'](_[_0x3eea('0x3b')](_0x4136ce[_0x3eea('0x32')],_0x40e6f9[_0x3eea('0x33')]),_0x1098ee);if(_0x4136ce[_0x3eea('0x32')][_0x3eea('0x3c')]){_0x221fb6[_0x3eea('0x3a')]=_[_0x3eea('0x3d')](_0x221fb6[_0x3eea('0x3a')],{'$or':_[_0x3eea('0x3e')](_0x1098ee,function(_0x1409eb){if(_0x1409eb['type']!==_0x3eea('0x3f')){var _0x105886={};_0x105886[_0x1409eb[_0x3eea('0x27')]]={'$like':'%'+_0x4136ce[_0x3eea('0x32')][_0x3eea('0x3c')]+'%'};return _0x105886;}})});}_0x221fb6=_[_0x3eea('0x3d')]({},_0x221fb6,_0x4136ce[_0x3eea('0x40')]);var _0xf5b227={'where':_0x221fb6[_0x3eea('0x3a')]};return db['VoiceMailMessage']['count'](_0xf5b227)['then'](function(_0x2e49f0){_0x3e0963[_0x3eea('0x41')]=_0x2e49f0;if(_0x4136ce[_0x3eea('0x32')][_0x3eea('0x42')]){_0x221fb6['include']=[{'all':!![]}];}return db[_0x3eea('0x2a')][_0x3eea('0x43')](_0x221fb6);})[_0x3eea('0x22')](function(_0x37a81f){_0x3e0963[_0x3eea('0x44')]=_0x37a81f;return _0x3e0963;})['then'](respondWithFilteredResult(_0x333574,_0x221fb6))[_0x3eea('0x45')](handleError(_0x333574,null));};exports['show']=function(_0x2928d9,_0x30ad2e){var _0x42f05e={'raw':!![],'where':{'id':_0x2928d9[_0x3eea('0x46')]['id']}},_0x2edb6a={};_0x2edb6a[_0x3eea('0x2f')]=_[_0x3eea('0x31')](db[_0x3eea('0x2a')]['rawAttributes']);_0x2edb6a['query']=_[_0x3eea('0x31')](_0x2928d9[_0x3eea('0x32')]);_0x2edb6a[_0x3eea('0x47')]=_[_0x3eea('0x34')](_0x2edb6a[_0x3eea('0x2f')],_0x2edb6a[_0x3eea('0x32')]);_0x42f05e[_0x3eea('0x35')]=_[_0x3eea('0x34')](_0x2edb6a['model'],qs['fields'](_0x2928d9[_0x3eea('0x32')][_0x3eea('0x36')]));_0x42f05e[_0x3eea('0x35')]=_0x42f05e[_0x3eea('0x35')][_0x3eea('0x37')]?_0x42f05e[_0x3eea('0x35')]:_0x2edb6a[_0x3eea('0x2f')];if(_0x2928d9[_0x3eea('0x32')][_0x3eea('0x42')]){_0x42f05e[_0x3eea('0x48')]=[{'all':!![]}];}_0x42f05e=_[_0x3eea('0x3d')]({},_0x42f05e,_0x2928d9[_0x3eea('0x40')]);return db[_0x3eea('0x2a')][_0x3eea('0x49')](_0x42f05e)['then'](handleEntityNotFound(_0x30ad2e,null))[_0x3eea('0x22')](respondWithResult(_0x30ad2e,null))[_0x3eea('0x45')](handleError(_0x30ad2e,null));};exports[_0x3eea('0x4a')]=function(_0x223852,_0x5ef161){return db[_0x3eea('0x2a')]['create'](_0x223852['body'],{})['then'](respondWithResult(_0x5ef161,0xc9))['catch'](handleError(_0x5ef161,null));};exports['update']=function(_0x5ce51a,_0x2cc3a0){if(_0x5ce51a[_0x3eea('0x4b')]['id']){delete _0x5ce51a[_0x3eea('0x4b')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x5ce51a[_0x3eea('0x46')]['id']}})[_0x3eea('0x22')](handleEntityNotFound(_0x2cc3a0,null))[_0x3eea('0x22')](saveUpdates(_0x5ce51a[_0x3eea('0x4b')],null))[_0x3eea('0x22')](respondWithResult(_0x2cc3a0,null))[_0x3eea('0x45')](handleError(_0x2cc3a0,null));};exports[_0x3eea('0x23')]=function(_0x3863a9,_0x29ec21){return db['VoiceMailMessage'][_0x3eea('0x49')]({'where':{'id':_0x3863a9[_0x3eea('0x46')]['id']}})[_0x3eea('0x22')](handleEntityNotFound(_0x29ec21,null))[_0x3eea('0x22')](removeEntity(_0x29ec21,null))[_0x3eea('0x45')](handleError(_0x29ec21,null));};exports[_0x3eea('0x4c')]=function(_0x52a1ed,_0x9cab25,_0x1bb6c3){return db['VoiceMailMessage'][_0x3eea('0x49')]({'where':{'id':_0x52a1ed[_0x3eea('0x46')]['id']},'attributes':['id',_0x3eea('0x4d'),_0x3eea('0x4e')]})[_0x3eea('0x22')](handleEntityNotFound(_0x9cab25,null))[_0x3eea('0x22')](function(_0x1fdaf6){if(_0x1fdaf6){if(!_0x1fdaf6[_0x3eea('0x4d')]){throw new db[(_0x3eea('0x4f'))][(_0x3eea('0x50'))](_0x3eea('0x51'));}var _0x508617={'Content-Type':_0x3eea('0x52'),'Content-Disposition':'attachment'};if(_0x1fdaf6[_0x3eea('0x4e')]){_0x508617[_0x3eea('0x53')]=_0x3eea('0x54')+_0x1fdaf6[_0x3eea('0x4e')]+_0x3eea('0x55');}_0x9cab25['set'](_0x508617);return _0x9cab25[_0x3eea('0x28')](new Buffer(_0x1fdaf6[_0x3eea('0x4d')]));}})['catch'](handleError(_0x9cab25,null));}; \ No newline at end of file +var _0x675e=['end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','status','send','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','includeAll','include','rows','catch','show','filtears','fields','options','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','set','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1f1b10,_0x3136fd){var _0x3d0c2b=function(_0x59b85a){while(--_0x59b85a){_0x1f1b10['push'](_0x1f1b10['shift']());}};_0x3d0c2b(++_0x3136fd);}(_0x675e,0x18a));var _0xe675=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x675e[_0x5ac0f0];return _0x4aceec;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe675('0x0'));var rimraf=require(_0xe675('0x1'));var zipdir=require(_0xe675('0x2'));var jsonpatch=require(_0xe675('0x3'));var rp=require('request-promise');var moment=require(_0xe675('0x4'));var BPromise=require(_0xe675('0x5'));var Mustache=require(_0xe675('0x6'));var util=require(_0xe675('0x7'));var path=require(_0xe675('0x8'));var sox=require('sox');var csv=require(_0xe675('0x9'));var ejs=require(_0xe675('0xa'));var fs=require('fs');var _=require(_0xe675('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe675('0xc'));var deskjs=require(_0xe675('0xd'));var toCsv=require(_0xe675('0x9'));var querystring=require(_0xe675('0xe'));var Papa=require(_0xe675('0xf'));var Redis=require(_0xe675('0x10'));var authService=require(_0xe675('0x11'));var qs=require(_0xe675('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe675('0x13'))(_0xe675('0x14'));var utils=require(_0xe675('0x15'));var config=require(_0xe675('0x16'));var licenseUtil=require(_0xe675('0x17'));var db=require(_0xe675('0x18'))['db'];function respondWithStatusCode(_0x4d9dc9,_0x357bd0){_0x357bd0=_0x357bd0||0xcc;return function(_0x21201a){if(_0x21201a){return _0x4d9dc9[_0xe675('0x19')](_0x357bd0);}return _0x4d9dc9['status'](_0x357bd0)[_0xe675('0x1a')]();};}function respondWithResult(_0xf4207d,_0x3aeedf){_0x3aeedf=_0x3aeedf||0xc8;return function(_0x3c0aa4){if(_0x3c0aa4){return _0xf4207d['status'](_0x3aeedf)[_0xe675('0x1b')](_0x3c0aa4);}};}function respondWithFilteredResult(_0x23f4be,_0xd8c192){return function(_0x1f5db9){if(_0x1f5db9){var _0x3b4383=_0x1f5db9[_0xe675('0x1c')],_0x5e0a28=_0xd8c192[_0xe675('0x1d')],_0x45d5b7=_0xd8c192[_0xe675('0x1d')]+_0xd8c192[_0xe675('0x1e')],_0x1e02eb;if(_0x45d5b7>=_0x3b4383){_0x45d5b7=_0x3b4383;_0x1e02eb=0xc8;}else{_0x1e02eb=0xce;}_0x23f4be['status'](_0x1e02eb);return _0x23f4be['set'](_0xe675('0x1f'),_0x5e0a28+'-'+_0x45d5b7+'/'+_0x3b4383)['json'](_0x1f5db9);}return null;};}function patchUpdates(_0x3e1f36){return function(_0x1ea5d5){try{jsonpatch['apply'](_0x1ea5d5,_0x3e1f36,!![]);}catch(_0x4a247b){return BPromise[_0xe675('0x20')](_0x4a247b);}return _0x1ea5d5[_0xe675('0x21')]();};}function saveUpdates(_0x4b4ca9,_0x3a2180){return function(_0x59ba8b){if(_0x59ba8b){return _0x59ba8b[_0xe675('0x22')](_0x4b4ca9)[_0xe675('0x23')](function(_0x4a0daf){return _0x4a0daf;});}return null;};}function removeEntity(_0x583655,_0x8c7a24){return function(_0x57a8ef){if(_0x57a8ef){return _0x57a8ef[_0xe675('0x24')]()['then'](function(){_0x583655['status'](0xcc)[_0xe675('0x1a')]();});}};}function handleEntityNotFound(_0x46c893,_0x2a5de3){return function(_0x2a60f3){if(!_0x2a60f3){_0x46c893[_0xe675('0x19')](0x194);}return _0x2a60f3;};}function handleError(_0x4bf846,_0x4405ae){_0x4405ae=_0x4405ae||0x1f4;return function(_0xd1ea00){logger[_0xe675('0x25')](_0xd1ea00[_0xe675('0x26')]);if(_0xd1ea00[_0xe675('0x27')]){delete _0xd1ea00[_0xe675('0x27')];}_0x4bf846[_0xe675('0x28')](_0x4405ae)[_0xe675('0x29')](_0xd1ea00);};}exports[_0xe675('0x2a')]=function(_0x4c830e,_0x4ec95c){var _0x3343c2={},_0x4ff840={},_0x563541={'count':0x0,'rows':[]};var _0x21b676=_[_0xe675('0x2b')](db[_0xe675('0x2c')][_0xe675('0x2d')],function(_0x40bf42){return{'name':_0x40bf42[_0xe675('0x2e')],'type':_0x40bf42['type'][_0xe675('0x2f')]};});_0x4ff840[_0xe675('0x30')]=_['differenceBy'](_[_0xe675('0x2b')](_0x21b676,_0xe675('0x27')),['name']);_0x4ff840[_0xe675('0x31')]=_[_0xe675('0x32')](_0x4c830e[_0xe675('0x31')]);_0x4ff840[_0xe675('0x33')]=_[_0xe675('0x34')](_0x4ff840['model'],_0x4ff840['query']);_0x3343c2['attributes']=_[_0xe675('0x34')](_0x4ff840['model'],qs['fields'](_0x4c830e[_0xe675('0x31')]['fields']));_0x3343c2[_0xe675('0x35')]=_0x3343c2[_0xe675('0x35')][_0xe675('0x36')]?_0x3343c2[_0xe675('0x35')]:_0x4ff840[_0xe675('0x30')];if(!_0x4c830e['query'][_0xe675('0x37')](_0xe675('0x38'))){_0x3343c2[_0xe675('0x1e')]=qs[_0xe675('0x1e')](_0x4c830e[_0xe675('0x31')][_0xe675('0x1e')]);_0x3343c2[_0xe675('0x1d')]=qs['offset'](_0x4c830e['query'][_0xe675('0x1d')]);}_0x3343c2[_0xe675('0x39')]=qs[_0xe675('0x3a')](_0x4c830e[_0xe675('0x31')][_0xe675('0x3a')]);_0x3343c2['where']=qs['filters'](_['pick'](_0x4c830e[_0xe675('0x31')],_0x4ff840[_0xe675('0x33')]),_0x21b676);if(_0x4c830e['query']['filter']){_0x3343c2[_0xe675('0x3b')]=_[_0xe675('0x3c')](_0x3343c2[_0xe675('0x3b')],{'$or':_[_0xe675('0x2b')](_0x21b676,function(_0x2caa15){if(_0x2caa15['type']!=='VIRTUAL'){var _0x54c17e={};_0x54c17e[_0x2caa15[_0xe675('0x27')]]={'$like':'%'+_0x4c830e[_0xe675('0x31')]['filter']+'%'};return _0x54c17e;}})});}_0x3343c2=_[_0xe675('0x3c')]({},_0x3343c2,_0x4c830e['options']);var _0x1c51ed={'where':_0x3343c2['where']};return db[_0xe675('0x2c')][_0xe675('0x1c')](_0x1c51ed)[_0xe675('0x23')](function(_0x4633d6){_0x563541['count']=_0x4633d6;if(_0x4c830e['query'][_0xe675('0x3d')]){_0x3343c2[_0xe675('0x3e')]=[{'all':!![]}];}return db[_0xe675('0x2c')]['findAll'](_0x3343c2);})['then'](function(_0x3c90f8){_0x563541[_0xe675('0x3f')]=_0x3c90f8;return _0x563541;})['then'](respondWithFilteredResult(_0x4ec95c,_0x3343c2))[_0xe675('0x40')](handleError(_0x4ec95c,null));};exports[_0xe675('0x41')]=function(_0x5232f1,_0x2b232a){var _0x39ef4e={'raw':!![],'where':{'id':_0x5232f1['params']['id']}},_0x1a5107={};_0x1a5107[_0xe675('0x30')]=_[_0xe675('0x32')](db[_0xe675('0x2c')][_0xe675('0x2d')]);_0x1a5107['query']=_['keys'](_0x5232f1[_0xe675('0x31')]);_0x1a5107[_0xe675('0x42')]=_['intersection'](_0x1a5107[_0xe675('0x30')],_0x1a5107['query']);_0x39ef4e[_0xe675('0x35')]=_[_0xe675('0x34')](_0x1a5107[_0xe675('0x30')],qs[_0xe675('0x43')](_0x5232f1['query'][_0xe675('0x43')]));_0x39ef4e[_0xe675('0x35')]=_0x39ef4e[_0xe675('0x35')][_0xe675('0x36')]?_0x39ef4e[_0xe675('0x35')]:_0x1a5107['model'];if(_0x5232f1[_0xe675('0x31')][_0xe675('0x3d')]){_0x39ef4e[_0xe675('0x3e')]=[{'all':!![]}];}_0x39ef4e=_[_0xe675('0x3c')]({},_0x39ef4e,_0x5232f1[_0xe675('0x44')]);return db[_0xe675('0x2c')]['find'](_0x39ef4e)['then'](handleEntityNotFound(_0x2b232a,null))[_0xe675('0x23')](respondWithResult(_0x2b232a,null))[_0xe675('0x40')](handleError(_0x2b232a,null));};exports[_0xe675('0x45')]=function(_0x147d6e,_0x5d5a19){return db[_0xe675('0x2c')][_0xe675('0x45')](_0x147d6e[_0xe675('0x46')],{})[_0xe675('0x23')](respondWithResult(_0x5d5a19,0xc9))[_0xe675('0x40')](handleError(_0x5d5a19,null));};exports[_0xe675('0x22')]=function(_0x6f751d,_0x439c7a){if(_0x6f751d[_0xe675('0x46')]['id']){delete _0x6f751d[_0xe675('0x46')]['id'];}return db[_0xe675('0x2c')][_0xe675('0x47')]({'where':{'id':_0x6f751d[_0xe675('0x48')]['id']}})['then'](handleEntityNotFound(_0x439c7a,null))[_0xe675('0x23')](saveUpdates(_0x6f751d[_0xe675('0x46')],null))[_0xe675('0x23')](respondWithResult(_0x439c7a,null))['catch'](handleError(_0x439c7a,null));};exports[_0xe675('0x24')]=function(_0x4418de,_0x21632f){return db[_0xe675('0x2c')]['find']({'where':{'id':_0x4418de[_0xe675('0x48')]['id']}})[_0xe675('0x23')](handleEntityNotFound(_0x21632f,null))[_0xe675('0x23')](removeEntity(_0x21632f,null))[_0xe675('0x40')](handleError(_0x21632f,null));};exports[_0xe675('0x49')]=function(_0x2bfc48,_0x2f5616,_0x2033fe){return db['VoiceMailMessage']['find']({'where':{'id':_0x2bfc48['params']['id']},'attributes':['id',_0xe675('0x4a'),_0xe675('0x4b')]})['then'](handleEntityNotFound(_0x2f5616,null))[_0xe675('0x23')](function(_0x5eb8c9){if(_0x5eb8c9){if(!_0x5eb8c9[_0xe675('0x4a')]){throw new db[(_0xe675('0x4c'))][(_0xe675('0x4d'))](_0xe675('0x4e'));}var _0x21cf22={'Content-Type':_0xe675('0x4f'),'Content-Disposition':_0xe675('0x50')};if(_0x5eb8c9[_0xe675('0x4b')]){_0x21cf22[_0xe675('0x51')]='attachment;\x20filename=\x22'+_0x5eb8c9[_0xe675('0x4b')]+_0xe675('0x52');}_0x2f5616[_0xe675('0x53')](_0x21cf22);return _0x2f5616[_0xe675('0x29')](new Buffer(_0x5eb8c9[_0xe675('0x4a')]));}})[_0xe675('0x40')](handleError(_0x2f5616,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5a18e90..3dbad34 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 _0xa395=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0xa395,0x15d));var _0x5a39=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa395[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x5a39('0x0'));var logger=require(_0x5a39('0x1'))(_0x5a39('0x2'));var moment=require(_0x5a39('0x3'));var BPromise=require(_0x5a39('0x4'));var rp=require(_0x5a39('0x5'));var fs=require('fs');var path=require(_0x5a39('0x6'));var rimraf=require(_0x5a39('0x7'));var config=require(_0x5a39('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x5a39('0x9')]=function(_0x5c0b9e,_0x10b893){return _0x5c0b9e['define'](_0x5a39('0xa'),attributes,{'tableName':_0x5a39('0xb'),'paranoid':![],'indexes':[{'name':_0x5a39('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xf1ed=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x5a5b09,_0x5716ca){var _0x1e8a13=function(_0x17701e){while(--_0x17701e){_0x5a5b09['push'](_0x5a5b09['shift']());}};_0x1e8a13(++_0x5716ca);}(_0xf1ed,0x79));var _0xdf1e=function(_0x214902,_0x25b350){_0x214902=_0x214902-0x0;var _0x15e24e=_0xf1ed[_0x214902];return _0x15e24e;};'use strict';var _=require(_0xdf1e('0x0'));var util=require(_0xdf1e('0x1'));var logger=require(_0xdf1e('0x2'))('api');var moment=require(_0xdf1e('0x3'));var BPromise=require(_0xdf1e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf1e('0x5'));var rimraf=require('rimraf');var config=require(_0xdf1e('0x6'));var attributes=require(_0xdf1e('0x7'));module[_0xdf1e('0x8')]=function(_0x216004,_0x3c9c58){return _0x216004[_0xdf1e('0x9')](_0xdf1e('0xa'),attributes,{'tableName':_0xdf1e('0xb'),'paranoid':![],'indexes':[{'name':_0xdf1e('0xc'),'fields':[_0xdf1e('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 68d2b25..e9a27fb 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 _0x7a54=['info','VoiceMailMessage,\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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x2c97e6,_0x2c1053){_0x2c97e6=_0x2c97e6-0x0;var _0x4f32f5=_0x7a54[_0x2c97e6];return _0x4f32f5;};'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')]('VoiceMailMessage,\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 +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(_0x1df2d1,_0x13592a){var _0x314b7b=function(_0x61cff1){while(--_0x61cff1){_0x1df2d1['push'](_0x1df2d1['shift']());}};_0x314b7b(++_0x13592a);}(_0x2032,0xd9));var _0x2203=function(_0x338d0b,_0x441737){_0x338d0b=_0x338d0b-0x0;var _0x5231e9=_0x2032[_0x338d0b];return _0x5231e9;};'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 4a3f1fe..8c58d69 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 _0xb6e3=['put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','create','addSound'];(function(_0x4f3bb9,_0x2547d0){var _0x5d4d67=function(_0xab2ffd){while(--_0xab2ffd){_0x4f3bb9['push'](_0x4f3bb9['shift']());}};_0x5d4d67(++_0x2547d0);}(_0xb6e3,0xbf));var _0x3b6e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xb6e3[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x3b6e('0x0'));var util=require(_0x3b6e('0x1'));var path=require(_0x3b6e('0x2'));var timeout=require(_0x3b6e('0x3'));var express=require(_0x3b6e('0x4'));var router=express[_0x3b6e('0x5')]();var auth=require(_0x3b6e('0x6'));var interaction=require(_0x3b6e('0x7'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x3b6e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3b6e('0x8')](_0x3b6e('0x9'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0xb')]);router[_0x3b6e('0x8')](_0x3b6e('0xc'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3b6e('0xe')]);router['post'](_0x3b6e('0xc'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0xf')]);router[_0x3b6e('0x10')](_0x3b6e('0x9'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0x11')]);router[_0x3b6e('0x12')](_0x3b6e('0x9'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0x13')]);router[_0x3b6e('0x12')](_0x3b6e('0x14'),auth[_0x3b6e('0xa')](),controller[_0x3b6e('0x15')]);module[_0x3b6e('0x16')]=router; \ No newline at end of file +var _0x9763=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sounds','post','addSound','update','delete','destroy','removeSound','exports','multer','util'];(function(_0x5cad41,_0x33fa69){var _0x43c206=function(_0x407e55){while(--_0x407e55){_0x5cad41['push'](_0x5cad41['shift']());}};_0x43c206(++_0x33fa69);}(_0x9763,0x1cc));var _0x3976=function(_0xc4376d,_0x2e6841){_0xc4376d=_0xc4376d-0x0;var _0x291524=_0x9763[_0xc4376d];return _0x291524;};'use strict';var multer=require(_0x3976('0x0'));var util=require(_0x3976('0x1'));var path=require(_0x3976('0x2'));var timeout=require(_0x3976('0x3'));var express=require(_0x3976('0x4'));var router=express[_0x3976('0x5')]();var auth=require(_0x3976('0x6'));var interaction=require(_0x3976('0x7'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x3976('0x8')]('/',auth[_0x3976('0x9')](),controller[_0x3976('0xa')]);router[_0x3976('0x8')](_0x3976('0xb'),auth[_0x3976('0x9')](),controller[_0x3976('0xc')]);router[_0x3976('0x8')](_0x3976('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x3976('0xe')]('/',auth[_0x3976('0x9')](),controller['create']);router[_0x3976('0xe')](_0x3976('0xd'),auth['isAuthenticated'](),controller[_0x3976('0xf')]);router['put'](_0x3976('0xb'),auth[_0x3976('0x9')](),controller[_0x3976('0x10')]);router[_0x3976('0x11')](_0x3976('0xb'),auth[_0x3976('0x9')](),controller[_0x3976('0x12')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x3976('0x13')]);module[_0x3976('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index c500760..3304c07 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 _0x83e0=['mp3','alpha','BOOLEAN','sequelize','exports','STRING','name','mp3nb','quietmp3nb','quietmp3'];(function(_0x43caa2,_0x1ffb73){var _0x51b342=function(_0x288f85){while(--_0x288f85){_0x43caa2['push'](_0x43caa2['shift']());}};_0x51b342(++_0x1ffb73);}(_0x83e0,0x8f));var _0x083e=function(_0x535d28,_0x51c6c9){_0x535d28=_0x535d28-0x0;var _0x3297f8=_0x83e0[_0x535d28];return _0x3297f8;};'use strict';var Sequelize=require(_0x083e('0x0'));module[_0x083e('0x1')]={'name':{'type':Sequelize[_0x083e('0x2')],'allowNull':![],'unique':_0x083e('0x3')},'mode':{'type':Sequelize['ENUM']('custom','files',_0x083e('0x4'),_0x083e('0x5'),_0x083e('0x6'),_0x083e('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x083e('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x083e('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x083e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x083e('0x8')},'format':{'type':Sequelize[_0x083e('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x083e('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x26f7=['sequelize','exports','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','STRING','TIMESTAMP','BOOLEAN'];(function(_0x43bac9,_0x5b7dbd){var _0x3f9181=function(_0x426004){while(--_0x426004){_0x43bac9['push'](_0x43bac9['shift']());}};_0x3f9181(++_0x5b7dbd);}(_0x26f7,0x1ba));var _0x726f=function(_0x5e52a5,_0x12cadd){_0x5e52a5=_0x5e52a5-0x0;var _0x39ea8c=_0x26f7[_0x5e52a5];return _0x39ea8c;};'use strict';var Sequelize=require(_0x726f('0x0'));module[_0x726f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x726f('0x2')},'mode':{'type':Sequelize[_0x726f('0x3')](_0x726f('0x4'),_0x726f('0x5'),_0x726f('0x6'),_0x726f('0x7'),_0x726f('0x8'),_0x726f('0x9')),'allowNull':!![],'defaultValue':_0x726f('0x5')},'directory':{'type':Sequelize[_0x726f('0xa')],'allowNull':!![]},'application':{'type':Sequelize[_0x726f('0xa')],'allowNull':!![]},'digit':{'type':Sequelize[_0x726f('0xa')],'allowNull':!![]},'sort':{'type':Sequelize[_0x726f('0xa')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x726f('0xa')],'allowNull':!![]},'stamp':{'type':_0x726f('0xb')},'defaultEntry':{'type':Sequelize[_0x726f('0xc')],'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 bd0f645..8aba42d 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 _0xdbf3=['VoiceMusicOnHold','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','filtears','body','find','create','sequelize','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','rmdirSync','ValidationError','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','%s.%s','extname','format','message','removeSound','id2','Sound','Sequelize','getSounds','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','error','stack','name','send','index','map'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xdbf3,0x19d));var _0x3dbf=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0xdbf3[_0x307d86];return _0x361745;};'use strict';var pdf=require(_0x3dbf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3dbf('0x1'));var zipdir=require(_0x3dbf('0x2'));var jsonpatch=require(_0x3dbf('0x3'));var rp=require(_0x3dbf('0x4'));var moment=require(_0x3dbf('0x5'));var BPromise=require(_0x3dbf('0x6'));var Mustache=require(_0x3dbf('0x7'));var util=require(_0x3dbf('0x8'));var path=require(_0x3dbf('0x9'));var sox=require('sox');var csv=require(_0x3dbf('0xa'));var ejs=require(_0x3dbf('0xb'));var fs=require('fs');var _=require(_0x3dbf('0xc'));var squel=require(_0x3dbf('0xd'));var crypto=require(_0x3dbf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3dbf('0xf'));var toCsv=require(_0x3dbf('0xa'));var querystring=require(_0x3dbf('0x10'));var Papa=require('papaparse');var Redis=require(_0x3dbf('0x11'));var authService=require(_0x3dbf('0x12'));var qs=require(_0x3dbf('0x13'));var as=require(_0x3dbf('0x14'));var hardwareService=require(_0x3dbf('0x15'));var logger=require(_0x3dbf('0x16'))(_0x3dbf('0x17'));var utils=require(_0x3dbf('0x18'));var config=require(_0x3dbf('0x19'));var licenseUtil=require(_0x3dbf('0x1a'));var db=require(_0x3dbf('0x1b'))['db'];function respondWithStatusCode(_0x22f3c3,_0x31e525){_0x31e525=_0x31e525||0xcc;return function(_0xde30e2){if(_0xde30e2){return _0x22f3c3[_0x3dbf('0x1c')](_0x31e525);}return _0x22f3c3['status'](_0x31e525)[_0x3dbf('0x1d')]();};}function respondWithResult(_0x3009b3,_0x219549){_0x219549=_0x219549||0xc8;return function(_0x3e3194){if(_0x3e3194){return _0x3009b3[_0x3dbf('0x1e')](_0x219549)[_0x3dbf('0x1f')](_0x3e3194);}};}function respondWithFilteredResult(_0x2c5151,_0x4a3513){return function(_0x1bd182){if(_0x1bd182){var _0xa4be93=_0x1bd182[_0x3dbf('0x20')],_0x25924d=_0x4a3513[_0x3dbf('0x21')],_0x1f1369=_0x4a3513[_0x3dbf('0x21')]+_0x4a3513[_0x3dbf('0x22')],_0x47e972;if(_0x1f1369>=_0xa4be93){_0x1f1369=_0xa4be93;_0x47e972=0xc8;}else{_0x47e972=0xce;}_0x2c5151[_0x3dbf('0x1e')](_0x47e972);return _0x2c5151[_0x3dbf('0x23')](_0x3dbf('0x24'),_0x25924d+'-'+_0x1f1369+'/'+_0xa4be93)[_0x3dbf('0x1f')](_0x1bd182);}return null;};}function patchUpdates(_0xa4ba93){return function(_0x592e8b){try{jsonpatch[_0x3dbf('0x25')](_0x592e8b,_0xa4ba93,!![]);}catch(_0x238f0c){return BPromise[_0x3dbf('0x26')](_0x238f0c);}return _0x592e8b[_0x3dbf('0x27')]();};}function saveUpdates(_0x5ca0d4,_0x1700cd){return function(_0x379510){if(_0x379510){return _0x379510[_0x3dbf('0x28')](_0x5ca0d4)[_0x3dbf('0x29')](function(_0x5bc457){return _0x5bc457;});}return null;};}function removeEntity(_0x1bac01,_0x414607){return function(_0x9a8096){if(_0x9a8096){return _0x9a8096[_0x3dbf('0x2a')]()[_0x3dbf('0x29')](function(){var _0x22bee9=_0x9a8096[_0x3dbf('0x2b')]({'plain':!![]});var _0x2db3c6=_0x3dbf('0x2c');return db['UserProfileResource'][_0x3dbf('0x2a')]({'where':{'type':_0x2db3c6,'resourceId':_0x22bee9['id']}})['then'](function(){return _0x9a8096;});})[_0x3dbf('0x29')](function(){_0x1bac01[_0x3dbf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aab67,_0x232b57){return function(_0x40f41a){if(!_0x40f41a){_0x1aab67[_0x3dbf('0x1c')](0x194);}return _0x40f41a;};}function handleError(_0x49b41d,_0x3426f6){_0x3426f6=_0x3426f6||0x1f4;return function(_0x3ba1cd){logger[_0x3dbf('0x2d')](_0x3ba1cd[_0x3dbf('0x2e')]);if(_0x3ba1cd[_0x3dbf('0x2f')]){delete _0x3ba1cd['name'];}_0x49b41d[_0x3dbf('0x1e')](_0x3426f6)[_0x3dbf('0x30')](_0x3ba1cd);};}exports[_0x3dbf('0x31')]=function(_0x4aadf5,_0x390ad0){var _0x336e37={},_0x20aad9={},_0x306321={'count':0x0,'rows':[]};var _0x51c5a8=_[_0x3dbf('0x32')](db[_0x3dbf('0x33')][_0x3dbf('0x34')],function(_0x59a962){return{'name':_0x59a962['fieldName'],'type':_0x59a962[_0x3dbf('0x35')]['key']};});_0x20aad9[_0x3dbf('0x36')]=_['map'](_0x51c5a8,_0x3dbf('0x2f'));_0x20aad9[_0x3dbf('0x37')]=_[_0x3dbf('0x38')](_0x4aadf5[_0x3dbf('0x37')]);_0x20aad9[_0x3dbf('0x39')]=_[_0x3dbf('0x3a')](_0x20aad9[_0x3dbf('0x36')],_0x20aad9['query']);_0x336e37[_0x3dbf('0x3b')]=_[_0x3dbf('0x3a')](_0x20aad9[_0x3dbf('0x36')],qs[_0x3dbf('0x3c')](_0x4aadf5[_0x3dbf('0x37')][_0x3dbf('0x3c')]));_0x336e37['attributes']=_0x336e37[_0x3dbf('0x3b')][_0x3dbf('0x3d')]?_0x336e37[_0x3dbf('0x3b')]:_0x20aad9[_0x3dbf('0x36')];if(!_0x4aadf5[_0x3dbf('0x37')][_0x3dbf('0x3e')](_0x3dbf('0x3f'))){_0x336e37['limit']=qs[_0x3dbf('0x22')](_0x4aadf5[_0x3dbf('0x37')]['limit']);_0x336e37[_0x3dbf('0x21')]=qs[_0x3dbf('0x21')](_0x4aadf5[_0x3dbf('0x37')][_0x3dbf('0x21')]);}_0x336e37['order']=qs[_0x3dbf('0x40')](_0x4aadf5[_0x3dbf('0x37')]['sort']);_0x336e37['where']=qs[_0x3dbf('0x39')](_['pick'](_0x4aadf5[_0x3dbf('0x37')],_0x20aad9[_0x3dbf('0x39')]),_0x51c5a8);if(_0x4aadf5[_0x3dbf('0x37')]['filter']){_0x336e37[_0x3dbf('0x41')]=_[_0x3dbf('0x42')](_0x336e37[_0x3dbf('0x41')],{'$or':_[_0x3dbf('0x32')](_0x51c5a8,function(_0x4f684a){if(_0x4f684a[_0x3dbf('0x35')]!==_0x3dbf('0x43')){var _0x5ab8f7={};_0x5ab8f7[_0x4f684a[_0x3dbf('0x2f')]]={'$like':'%'+_0x4aadf5[_0x3dbf('0x37')][_0x3dbf('0x44')]+'%'};return _0x5ab8f7;}})});}_0x336e37=_[_0x3dbf('0x42')]({},_0x336e37,_0x4aadf5[_0x3dbf('0x45')]);var _0x473e48={'where':_0x336e37[_0x3dbf('0x41')]};return db['VoiceMusicOnHold'][_0x3dbf('0x20')](_0x473e48)[_0x3dbf('0x29')](function(_0x229f0e){_0x306321[_0x3dbf('0x20')]=_0x229f0e;if(_0x4aadf5[_0x3dbf('0x37')][_0x3dbf('0x46')]){_0x336e37[_0x3dbf('0x47')]=[{'all':!![]}];}return db[_0x3dbf('0x33')][_0x3dbf('0x48')](_0x336e37);})[_0x3dbf('0x29')](function(_0x38de9e){_0x306321[_0x3dbf('0x49')]=_0x38de9e;return _0x306321;})[_0x3dbf('0x29')](respondWithFilteredResult(_0x390ad0,_0x336e37))[_0x3dbf('0x4a')](handleError(_0x390ad0,null));};exports[_0x3dbf('0x4b')]=function(_0x39b0ea,_0x154870){var _0x395ffc={'raw':![],'where':{'id':_0x39b0ea[_0x3dbf('0x4c')]['id']}},_0x3e44b6={};_0x3e44b6[_0x3dbf('0x36')]=_[_0x3dbf('0x38')](db['VoiceMusicOnHold'][_0x3dbf('0x34')]);_0x3e44b6[_0x3dbf('0x37')]=_[_0x3dbf('0x38')](_0x39b0ea[_0x3dbf('0x37')]);_0x3e44b6[_0x3dbf('0x4d')]=_[_0x3dbf('0x3a')](_0x3e44b6[_0x3dbf('0x36')],_0x3e44b6['query']);_0x395ffc[_0x3dbf('0x3b')]=_[_0x3dbf('0x3a')](_0x3e44b6[_0x3dbf('0x36')],qs[_0x3dbf('0x3c')](_0x39b0ea[_0x3dbf('0x37')][_0x3dbf('0x3c')]));_0x395ffc[_0x3dbf('0x3b')]=_0x395ffc[_0x3dbf('0x3b')][_0x3dbf('0x3d')]?_0x395ffc['attributes']:_0x3e44b6[_0x3dbf('0x36')];if(_0x39b0ea[_0x3dbf('0x37')][_0x3dbf('0x46')]){_0x395ffc[_0x3dbf('0x47')]=[{'all':!![]}];}_0x395ffc=_['merge']({},_0x395ffc,_0x39b0ea[_0x3dbf('0x45')]);return db['VoiceMusicOnHold']['find'](_0x395ffc)['then'](handleEntityNotFound(_0x154870,null))['then'](respondWithResult(_0x154870,null))['catch'](handleError(_0x154870,null));};exports[_0x3dbf('0x28')]=function(_0x2a2f17,_0x3527aa){if(_0x2a2f17[_0x3dbf('0x4e')]['id']){delete _0x2a2f17['body']['id'];}return db[_0x3dbf('0x33')][_0x3dbf('0x4f')]({'where':{'id':_0x2a2f17[_0x3dbf('0x4c')]['id']}})[_0x3dbf('0x29')](handleEntityNotFound(_0x3527aa,null))[_0x3dbf('0x29')](saveUpdates(_0x2a2f17[_0x3dbf('0x4e')],null))[_0x3dbf('0x29')](respondWithResult(_0x3527aa,null))[_0x3dbf('0x4a')](handleError(_0x3527aa,null));};exports[_0x3dbf('0x50')]=function(_0x153fa2,_0x46a95d,_0x192538){return db[_0x3dbf('0x51')][_0x3dbf('0x52')](function(_0x3cec10){if(_0x153fa2[_0x3dbf('0x4e')][_0x3dbf('0x53')]==='files'){_0x153fa2[_0x3dbf('0x4e')][_0x3dbf('0x54')]=path[_0x3dbf('0x55')](config[_0x3dbf('0x56')],_0x3dbf('0x57'),_0x153fa2[_0x3dbf('0x4e')]['name']);}return db['VoiceMusicOnHold']['create'](_0x153fa2[_0x3dbf('0x4e')],{'transaction':_0x3cec10})[_0x3dbf('0x29')](function(_0x342ff5){if(_0x153fa2[_0x3dbf('0x4e')][_0x3dbf('0x53')]===_0x3dbf('0x58')){fs[_0x3dbf('0x59')](_0x342ff5[_0x3dbf('0x54')],parseInt(_0x3dbf('0x5a'),0x8));}var _0x5e2d52=_0x153fa2[_0x3dbf('0x5b')][_0x3dbf('0x2b')]({'plain':!![]});if(!_0x5e2d52)throw new Error(_0x3dbf('0x5c'));if(_0x5e2d52[_0x3dbf('0x5d')]==='user'){var _0x446382=_0x342ff5[_0x3dbf('0x2b')]({'plain':!![]});return db[_0x3dbf('0x5e')][_0x3dbf('0x4f')]({'where':{'name':_0x3dbf('0x2c'),'userProfileId':_0x5e2d52[_0x3dbf('0x5f')]},'raw':!![]})[_0x3dbf('0x29')](function(_0x4e02c3){if(_0x4e02c3&&_0x4e02c3[_0x3dbf('0x60')]===0x0){return db['UserProfileResource'][_0x3dbf('0x50')]({'name':_0x446382[_0x3dbf('0x2f')],'resourceId':_0x446382['id'],'type':_0x4e02c3[_0x3dbf('0x2f')],'sectionId':_0x4e02c3['id']},{})[_0x3dbf('0x29')](function(){return _0x342ff5;});}else{return _0x342ff5;}})[_0x3dbf('0x4a')](function(_0x2dad25){logger[_0x3dbf('0x2d')](_0x3dbf('0x61'),_0x2dad25);});}return _0x342ff5;});})['then'](respondWithResult(_0x46a95d,0xc9))[_0x3dbf('0x4a')](handleError(_0x46a95d,null));};exports[_0x3dbf('0x2a')]=function(_0x5b212f,_0x1e93c8,_0x4eaac0){var _0x3e1de9;return db[_0x3dbf('0x33')][_0x3dbf('0x4f')]({'where':{'id':_0x5b212f[_0x3dbf('0x4c')]['id']}})[_0x3dbf('0x29')](function(_0x3c8947){if(_0x3c8947){return db['sequelize']['transaction'](function(_0x3247c0){return _0x3c8947[_0x3dbf('0x2a')]({'transaction':_0x3247c0,'raw':!![]})['then'](function(_0x30ff71){if(_0x30ff71[_0x3dbf('0x54')]){fs['readdirSync'](_0x30ff71[_0x3dbf('0x54')])['forEach'](function(_0x2dda06){fs[_0x3dbf('0x62')](path[_0x3dbf('0x55')](_0x30ff71[_0x3dbf('0x54')],_0x2dda06));});fs[_0x3dbf('0x63')](_0x30ff71[_0x3dbf('0x54')]);}return _0x30ff71;});})[_0x3dbf('0x4a')](function(_0x3583cb){throw new db['Sequelize'][(_0x3dbf('0x64'))](_0x3583cb['message']);});}})[_0x3dbf('0x29')](handleEntityNotFound(_0x1e93c8,null))[_0x3dbf('0x29')](removeEntity(_0x1e93c8,null))[_0x3dbf('0x4a')](handleError(_0x1e93c8,null));};exports['addSound']=function(_0x4dcdc8,_0x4de9af,_0xa1f174){return db['sequelize'][_0x3dbf('0x52')](function(_0x13ae01){var _0x100d38;return db['VoiceMusicOnHold'][_0x3dbf('0x4f')]({'where':{'id':_0x4dcdc8[_0x3dbf('0x4c')]['id']}})[_0x3dbf('0x29')](function(_0x54d685){if(_0x54d685){_0x100d38=_0x54d685;return _0x54d685[_0x3dbf('0x65')](_0x4dcdc8[_0x3dbf('0x4e')]['id'],{'transaction':_0x13ae01});}})[_0x3dbf('0x29')](function(_0x2e005b){if(_0x2e005b){return db['Sound'][_0x3dbf('0x66')]({'where':{'id':_0x4dcdc8[_0x3dbf('0x4e')]['id']},'attributes':['id',_0x3dbf('0x2f'),_0x3dbf('0x67'),_0x3dbf('0x68'),_0x3dbf('0x69')],'raw':!![]});}})[_0x3dbf('0x29')](function(_0x53f916){if(_0x53f916){var _0x4d4dd4=path[_0x3dbf('0x55')](config[_0x3dbf('0x56')],_0x3dbf('0x6a'),util['format'](_0x3dbf('0x6b'),path['basename'](_0x53f916[_0x3dbf('0x67')],path[_0x3dbf('0x6c')](_0x53f916['save_name'])),_0x53f916['converted_format']));var _0x547fdf=path[_0x3dbf('0x55')](config['root'],'server/files/moh',_0x100d38[_0x3dbf('0x2f')],util[_0x3dbf('0x6d')]('%s.%s',_0x53f916['name'],_0x53f916[_0x3dbf('0x68')]));fs['symlinkSync'](_0x4d4dd4,_0x547fdf);return _0x53f916;}})[_0x3dbf('0x4a')](function(_0x31f72f){throw new db['Sequelize'][(_0x3dbf('0x64'))](_0x31f72f[_0x3dbf('0x6e')]);});})['then'](handleEntityNotFound(_0x4de9af,null))[_0x3dbf('0x29')](respondWithResult(_0x4de9af,0xc9))['catch'](handleError(_0x4de9af,null));};exports[_0x3dbf('0x6f')]=function(_0x5a1742,_0x2da4a3,_0x5edf7c){return db[_0x3dbf('0x51')]['transaction'](function(_0x32ea47){var _0x4c14db;return db[_0x3dbf('0x33')][_0x3dbf('0x66')]({'where':{'id':_0x5a1742[_0x3dbf('0x4c')]['id']}})[_0x3dbf('0x29')](handleEntityNotFound(_0x2da4a3,null))[_0x3dbf('0x29')](function(_0x20325a){if(_0x20325a){_0x4c14db=_0x20325a;return _0x20325a['removeSound'](_0x5a1742[_0x3dbf('0x4c')][_0x3dbf('0x70')]);}})[_0x3dbf('0x29')](function(_0x22a7fa){if(_0x22a7fa){return db[_0x3dbf('0x71')][_0x3dbf('0x66')]({'where':{'id':_0x5a1742[_0x3dbf('0x4c')][_0x3dbf('0x70')]},'attributes':['id','name','save_name',_0x3dbf('0x68'),_0x3dbf('0x69')],'raw':!![]});}})[_0x3dbf('0x29')](function(_0x421564){if(_0x421564){fs[_0x3dbf('0x62')](path[_0x3dbf('0x55')](_0x4c14db['directory'],util['format']('%s.%s',_0x421564[_0x3dbf('0x2f')],_0x421564[_0x3dbf('0x68')])));return _0x421564;}})[_0x3dbf('0x4a')](function(_0xea371e){throw new db[(_0x3dbf('0x72'))][(_0x3dbf('0x64'))](_0xea371e[_0x3dbf('0x6e')]);});})['then'](handleEntityNotFound(_0x2da4a3,null))['then'](respondWithStatusCode(_0x2da4a3,0xcc))[_0x3dbf('0x4a')](handleError(_0x2da4a3,null));};exports[_0x3dbf('0x73')]=function(_0x2132bd,_0x2a0060,_0x481dfe){var _0x4ca647={};var _0x419b85={};var _0x596969;var _0x3f4bca;return db[_0x3dbf('0x33')]['findOne']({'where':{'id':_0x2132bd[_0x3dbf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2a0060,null))[_0x3dbf('0x29')](function(_0x1ce7b4){if(_0x1ce7b4){_0x596969=_0x1ce7b4;_0x419b85[_0x3dbf('0x36')]=_[_0x3dbf('0x38')](db[_0x3dbf('0x71')]['rawAttributes']);_0x419b85[_0x3dbf('0x37')]=_['keys'](_0x2132bd[_0x3dbf('0x37')]);_0x419b85[_0x3dbf('0x39')]=_['intersection'](_0x419b85[_0x3dbf('0x36')],_0x419b85[_0x3dbf('0x37')]);_0x4ca647[_0x3dbf('0x3b')]=_['intersection'](_0x419b85['model'],qs[_0x3dbf('0x3c')](_0x2132bd[_0x3dbf('0x37')][_0x3dbf('0x3c')]));_0x4ca647[_0x3dbf('0x3b')]=_0x4ca647[_0x3dbf('0x3b')][_0x3dbf('0x3d')]?_0x4ca647[_0x3dbf('0x3b')]:_0x419b85['model'];_0x4ca647['order']=qs[_0x3dbf('0x40')](_0x2132bd['query'][_0x3dbf('0x40')]);_0x4ca647['where']=qs[_0x3dbf('0x39')](_['pick'](_0x2132bd[_0x3dbf('0x37')],_0x419b85['filters']));if(_0x2132bd[_0x3dbf('0x37')][_0x3dbf('0x44')]){_0x4ca647[_0x3dbf('0x41')]=_[_0x3dbf('0x42')](_0x4ca647[_0x3dbf('0x41')],{'$or':_[_0x3dbf('0x32')](_0x4ca647[_0x3dbf('0x3b')],function(_0x2c380f){var _0x511d08={};_0x511d08[_0x2c380f]={'$like':'%'+_0x2132bd[_0x3dbf('0x37')][_0x3dbf('0x44')]+'%'};return _0x511d08;})});}_0x4ca647=_[_0x3dbf('0x42')]({},_0x4ca647,_0x2132bd[_0x3dbf('0x45')]);return _0x596969[_0x3dbf('0x73')](_0x4ca647);}})[_0x3dbf('0x29')](function(_0x12a523){if(_0x12a523){_0x3f4bca=_0x12a523[_0x3dbf('0x3d')];if(!_0x2132bd[_0x3dbf('0x37')]['hasOwnProperty'](_0x3dbf('0x3f'))){_0x4ca647[_0x3dbf('0x22')]=qs[_0x3dbf('0x22')](_0x2132bd[_0x3dbf('0x37')][_0x3dbf('0x22')]);_0x4ca647[_0x3dbf('0x21')]=qs[_0x3dbf('0x21')](_0x2132bd[_0x3dbf('0x37')][_0x3dbf('0x21')]);}return _0x596969['getSounds'](_0x4ca647);}})['then'](function(_0x1effa3){if(_0x1effa3){return _0x1effa3?{'count':_0x3f4bca,'rows':_0x1effa3}:null;}})[_0x3dbf('0x29')](respondWithResult(_0x2a0060,null))['catch'](handleError(_0x2a0060,null));}; \ No newline at end of file +var _0x537a=['reject','save','then','get','MusicOnHolds','UserProfileResource','error','name','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','filtears','find','catch','body','create','sequelize','transaction','mode','join','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','directory','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','Sequelize','removeSound','findOne','id2','Sound','createdAt','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x1d93b7,_0x40d695){var _0x15a32b=function(_0x14e6b8){while(--_0x14e6b8){_0x1d93b7['push'](_0x1d93b7['shift']());}};_0x15a32b(++_0x40d695);}(_0x537a,0x1ac));var _0xa537=function(_0x15c198,_0x12741c){_0x15c198=_0x15c198-0x0;var _0x3c0805=_0x537a[_0x15c198];return _0x3c0805;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa537('0x0'));var rimraf=require(_0xa537('0x1'));var zipdir=require(_0xa537('0x2'));var jsonpatch=require(_0xa537('0x3'));var rp=require(_0xa537('0x4'));var moment=require(_0xa537('0x5'));var BPromise=require(_0xa537('0x6'));var Mustache=require(_0xa537('0x7'));var util=require(_0xa537('0x8'));var path=require(_0xa537('0x9'));var sox=require(_0xa537('0xa'));var csv=require('to-csv');var ejs=require(_0xa537('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa537('0xc'));var crypto=require(_0xa537('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa537('0xe'));var querystring=require(_0xa537('0xf'));var Papa=require(_0xa537('0x10'));var Redis=require(_0xa537('0x11'));var authService=require(_0xa537('0x12'));var qs=require(_0xa537('0x13'));var as=require(_0xa537('0x14'));var hardwareService=require(_0xa537('0x15'));var logger=require(_0xa537('0x16'))(_0xa537('0x17'));var utils=require(_0xa537('0x18'));var config=require(_0xa537('0x19'));var licenseUtil=require(_0xa537('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c9af,_0x1d3b16){_0x1d3b16=_0x1d3b16||0xcc;return function(_0x3ace7e){if(_0x3ace7e){return _0x13c9af[_0xa537('0x1b')](_0x1d3b16);}return _0x13c9af['status'](_0x1d3b16)[_0xa537('0x1c')]();};}function respondWithResult(_0xbe11b0,_0x69145){_0x69145=_0x69145||0xc8;return function(_0x5a7593){if(_0x5a7593){return _0xbe11b0[_0xa537('0x1d')](_0x69145)[_0xa537('0x1e')](_0x5a7593);}};}function respondWithFilteredResult(_0xf649ab,_0x425c92){return function(_0x313f88){if(_0x313f88){var _0x141c7e=_0x313f88[_0xa537('0x1f')],_0xab7a62=_0x425c92[_0xa537('0x20')],_0x269fbd=_0x425c92[_0xa537('0x20')]+_0x425c92[_0xa537('0x21')],_0x1533af;if(_0x269fbd>=_0x141c7e){_0x269fbd=_0x141c7e;_0x1533af=0xc8;}else{_0x1533af=0xce;}_0xf649ab['status'](_0x1533af);return _0xf649ab[_0xa537('0x22')](_0xa537('0x23'),_0xab7a62+'-'+_0x269fbd+'/'+_0x141c7e)[_0xa537('0x1e')](_0x313f88);}return null;};}function patchUpdates(_0x147fb6){return function(_0x1cbc60){try{jsonpatch['apply'](_0x1cbc60,_0x147fb6,!![]);}catch(_0x52db2d){return BPromise[_0xa537('0x24')](_0x52db2d);}return _0x1cbc60[_0xa537('0x25')]();};}function saveUpdates(_0x19ca06,_0x1a9bd7){return function(_0x7b55ad){if(_0x7b55ad){return _0x7b55ad['update'](_0x19ca06)[_0xa537('0x26')](function(_0x434e80){return _0x434e80;});}return null;};}function removeEntity(_0x5c5d84,_0xd5124b){return function(_0x2bf38f){if(_0x2bf38f){return _0x2bf38f['destroy']()[_0xa537('0x26')](function(){var _0x566fe2=_0x2bf38f[_0xa537('0x27')]({'plain':!![]});var _0x4e7c62=_0xa537('0x28');return db[_0xa537('0x29')]['destroy']({'where':{'type':_0x4e7c62,'resourceId':_0x566fe2['id']}})['then'](function(){return _0x2bf38f;});})['then'](function(){_0x5c5d84[_0xa537('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42ea27,_0x5a8f4d){return function(_0x14f373){if(!_0x14f373){_0x42ea27[_0xa537('0x1b')](0x194);}return _0x14f373;};}function handleError(_0x95f940,_0x66049c){_0x66049c=_0x66049c||0x1f4;return function(_0xa200e0){logger[_0xa537('0x2a')](_0xa200e0['stack']);if(_0xa200e0[_0xa537('0x2b')]){delete _0xa200e0[_0xa537('0x2b')];}_0x95f940['status'](_0x66049c)['send'](_0xa200e0);};}exports[_0xa537('0x2c')]=function(_0x532989,_0x290804){var _0x2ff673={},_0x25360f={},_0x1731d7={'count':0x0,'rows':[]};var _0x19cec=_[_0xa537('0x2d')](db[_0xa537('0x2e')]['rawAttributes'],function(_0x5574fc){return{'name':_0x5574fc[_0xa537('0x2f')],'type':_0x5574fc[_0xa537('0x30')][_0xa537('0x31')]};});_0x25360f[_0xa537('0x32')]=_[_0xa537('0x2d')](_0x19cec,'name');_0x25360f['query']=_[_0xa537('0x33')](_0x532989[_0xa537('0x34')]);_0x25360f[_0xa537('0x35')]=_[_0xa537('0x36')](_0x25360f[_0xa537('0x32')],_0x25360f['query']);_0x2ff673['attributes']=_[_0xa537('0x36')](_0x25360f[_0xa537('0x32')],qs[_0xa537('0x37')](_0x532989['query'][_0xa537('0x37')]));_0x2ff673[_0xa537('0x38')]=_0x2ff673[_0xa537('0x38')][_0xa537('0x39')]?_0x2ff673['attributes']:_0x25360f[_0xa537('0x32')];if(!_0x532989[_0xa537('0x34')][_0xa537('0x3a')](_0xa537('0x3b'))){_0x2ff673['limit']=qs[_0xa537('0x21')](_0x532989['query']['limit']);_0x2ff673[_0xa537('0x20')]=qs['offset'](_0x532989[_0xa537('0x34')]['offset']);}_0x2ff673[_0xa537('0x3c')]=qs[_0xa537('0x3d')](_0x532989['query'][_0xa537('0x3d')]);_0x2ff673[_0xa537('0x3e')]=qs[_0xa537('0x35')](_[_0xa537('0x3f')](_0x532989[_0xa537('0x34')],_0x25360f[_0xa537('0x35')]),_0x19cec);if(_0x532989['query'][_0xa537('0x40')]){_0x2ff673['where']=_[_0xa537('0x41')](_0x2ff673[_0xa537('0x3e')],{'$or':_['map'](_0x19cec,function(_0x2e2eb1){if(_0x2e2eb1[_0xa537('0x30')]!=='VIRTUAL'){var _0x357ee4={};_0x357ee4[_0x2e2eb1['name']]={'$like':'%'+_0x532989[_0xa537('0x34')][_0xa537('0x40')]+'%'};return _0x357ee4;}})});}_0x2ff673=_[_0xa537('0x41')]({},_0x2ff673,_0x532989[_0xa537('0x42')]);var _0x1e87f6={'where':_0x2ff673[_0xa537('0x3e')]};return db[_0xa537('0x2e')]['count'](_0x1e87f6)[_0xa537('0x26')](function(_0x3dfce8){_0x1731d7[_0xa537('0x1f')]=_0x3dfce8;if(_0x532989['query'][_0xa537('0x43')]){_0x2ff673[_0xa537('0x44')]=[{'all':!![]}];}return db[_0xa537('0x2e')][_0xa537('0x45')](_0x2ff673);})['then'](function(_0x4ed8d4){_0x1731d7['rows']=_0x4ed8d4;return _0x1731d7;})['then'](respondWithFilteredResult(_0x290804,_0x2ff673))['catch'](handleError(_0x290804,null));};exports[_0xa537('0x46')]=function(_0x34a563,_0x3edead){var _0x476064={'raw':![],'where':{'id':_0x34a563[_0xa537('0x47')]['id']}},_0x4efa94={};_0x4efa94[_0xa537('0x32')]=_[_0xa537('0x33')](db['VoiceMusicOnHold'][_0xa537('0x48')]);_0x4efa94['query']=_[_0xa537('0x33')](_0x34a563[_0xa537('0x34')]);_0x4efa94[_0xa537('0x49')]=_[_0xa537('0x36')](_0x4efa94[_0xa537('0x32')],_0x4efa94['query']);_0x476064[_0xa537('0x38')]=_[_0xa537('0x36')](_0x4efa94[_0xa537('0x32')],qs[_0xa537('0x37')](_0x34a563[_0xa537('0x34')]['fields']));_0x476064[_0xa537('0x38')]=_0x476064['attributes'][_0xa537('0x39')]?_0x476064[_0xa537('0x38')]:_0x4efa94[_0xa537('0x32')];if(_0x34a563[_0xa537('0x34')]['includeAll']){_0x476064[_0xa537('0x44')]=[{'all':!![]}];}_0x476064=_[_0xa537('0x41')]({},_0x476064,_0x34a563['options']);return db[_0xa537('0x2e')][_0xa537('0x4a')](_0x476064)[_0xa537('0x26')](handleEntityNotFound(_0x3edead,null))[_0xa537('0x26')](respondWithResult(_0x3edead,null))[_0xa537('0x4b')](handleError(_0x3edead,null));};exports['update']=function(_0x2e0c06,_0x2505f4){if(_0x2e0c06['body']['id']){delete _0x2e0c06['body']['id'];}return db['VoiceMusicOnHold'][_0xa537('0x4a')]({'where':{'id':_0x2e0c06[_0xa537('0x47')]['id']}})[_0xa537('0x26')](handleEntityNotFound(_0x2505f4,null))[_0xa537('0x26')](saveUpdates(_0x2e0c06[_0xa537('0x4c')],null))['then'](respondWithResult(_0x2505f4,null))[_0xa537('0x4b')](handleError(_0x2505f4,null));};exports[_0xa537('0x4d')]=function(_0x452628,_0x154912,_0x3cc9b3){return db[_0xa537('0x4e')][_0xa537('0x4f')](function(_0x4bc054){if(_0x452628[_0xa537('0x4c')][_0xa537('0x50')]==='files'){_0x452628[_0xa537('0x4c')]['directory']=path[_0xa537('0x51')](config['root'],_0xa537('0x52'),_0x452628[_0xa537('0x4c')]['name']);}return db[_0xa537('0x2e')][_0xa537('0x4d')](_0x452628[_0xa537('0x4c')],{'transaction':_0x4bc054})['then'](function(_0x4c456d){if(_0x452628['body']['mode']===_0xa537('0x53')){fs[_0xa537('0x54')](_0x4c456d['directory'],parseInt(_0xa537('0x55'),0x8));}var _0x520211=_0x452628[_0xa537('0x56')][_0xa537('0x27')]({'plain':!![]});if(!_0x520211)throw new Error(_0xa537('0x57'));if(_0x520211[_0xa537('0x58')]===_0xa537('0x56')){var _0x4e2324=_0x4c456d[_0xa537('0x27')]({'plain':!![]});return db['UserProfileSection'][_0xa537('0x4a')]({'where':{'name':'MusicOnHolds','userProfileId':_0x520211[_0xa537('0x59')]},'raw':!![]})[_0xa537('0x26')](function(_0x58ab4b){if(_0x58ab4b&&_0x58ab4b['autoAssociation']===0x0){return db[_0xa537('0x29')][_0xa537('0x4d')]({'name':_0x4e2324['name'],'resourceId':_0x4e2324['id'],'type':_0x58ab4b[_0xa537('0x2b')],'sectionId':_0x58ab4b['id']},{})[_0xa537('0x26')](function(){return _0x4c456d;});}else{return _0x4c456d;}})['catch'](function(_0x27ac36){logger[_0xa537('0x2a')](_0xa537('0x5a'),_0x27ac36);});}return _0x4c456d;});})['then'](respondWithResult(_0x154912,0xc9))[_0xa537('0x4b')](handleError(_0x154912,null));};exports[_0xa537('0x5b')]=function(_0x478992,_0x1861cc,_0xd6f8b2){var _0x5ac2d2;return db[_0xa537('0x2e')]['find']({'where':{'id':_0x478992[_0xa537('0x47')]['id']}})[_0xa537('0x26')](function(_0x1986fc){if(_0x1986fc){return db[_0xa537('0x4e')][_0xa537('0x4f')](function(_0x59c21e){return _0x1986fc[_0xa537('0x5b')]({'transaction':_0x59c21e,'raw':!![]})['then'](function(_0x1fad59){if(_0x1fad59['directory']){fs[_0xa537('0x5c')](_0x1fad59[_0xa537('0x5d')])[_0xa537('0x5e')](function(_0x492ab5){fs[_0xa537('0x5f')](path[_0xa537('0x51')](_0x1fad59[_0xa537('0x5d')],_0x492ab5));});fs[_0xa537('0x60')](_0x1fad59[_0xa537('0x5d')]);}return _0x1fad59;});})[_0xa537('0x4b')](function(_0x2e37c2){throw new db['Sequelize'][(_0xa537('0x61'))](_0x2e37c2[_0xa537('0x62')]);});}})['then'](handleEntityNotFound(_0x1861cc,null))[_0xa537('0x26')](removeEntity(_0x1861cc,null))[_0xa537('0x4b')](handleError(_0x1861cc,null));};exports[_0xa537('0x63')]=function(_0x3539fa,_0x5e79f7,_0x2b2d7a){return db[_0xa537('0x4e')][_0xa537('0x4f')](function(_0x3232b5){var _0x1b1d7f;return db[_0xa537('0x2e')][_0xa537('0x4a')]({'where':{'id':_0x3539fa[_0xa537('0x47')]['id']}})[_0xa537('0x26')](function(_0x58b983){if(_0x58b983){_0x1b1d7f=_0x58b983;return _0x58b983[_0xa537('0x63')](_0x3539fa[_0xa537('0x4c')]['id'],{'transaction':_0x3232b5});}})[_0xa537('0x26')](function(_0x4c6743){if(_0x4c6743){return db['Sound']['findOne']({'where':{'id':_0x3539fa[_0xa537('0x4c')]['id']},'attributes':['id',_0xa537('0x2b'),'save_name',_0xa537('0x64'),'createdAt'],'raw':!![]});}})[_0xa537('0x26')](function(_0x1daa1d){if(_0x1daa1d){var _0x5c2a3=path[_0xa537('0x51')](config[_0xa537('0x65')],_0xa537('0x66'),util[_0xa537('0x67')](_0xa537('0x68'),path[_0xa537('0x69')](_0x1daa1d[_0xa537('0x6a')],path[_0xa537('0x6b')](_0x1daa1d[_0xa537('0x6a')])),_0x1daa1d[_0xa537('0x64')]));var _0x223818=path[_0xa537('0x51')](config['root'],_0xa537('0x52'),_0x1b1d7f['name'],util[_0xa537('0x67')](_0xa537('0x68'),_0x1daa1d[_0xa537('0x2b')],_0x1daa1d[_0xa537('0x64')]));fs[_0xa537('0x6c')](_0x5c2a3,_0x223818);return _0x1daa1d;}})['catch'](function(_0x167979){throw new db[(_0xa537('0x6d'))][(_0xa537('0x61'))](_0x167979[_0xa537('0x62')]);});})[_0xa537('0x26')](handleEntityNotFound(_0x5e79f7,null))['then'](respondWithResult(_0x5e79f7,0xc9))[_0xa537('0x4b')](handleError(_0x5e79f7,null));};exports[_0xa537('0x6e')]=function(_0x585670,_0x13468b,_0x2b6b24){return db[_0xa537('0x4e')]['transaction'](function(_0x194a4d){var _0x318410;return db[_0xa537('0x2e')][_0xa537('0x6f')]({'where':{'id':_0x585670[_0xa537('0x47')]['id']}})[_0xa537('0x26')](handleEntityNotFound(_0x13468b,null))['then'](function(_0x4a9a39){if(_0x4a9a39){_0x318410=_0x4a9a39;return _0x4a9a39['removeSound'](_0x585670[_0xa537('0x47')][_0xa537('0x70')]);}})['then'](function(_0x5f0ad5){if(_0x5f0ad5){return db[_0xa537('0x71')]['findOne']({'where':{'id':_0x585670[_0xa537('0x47')]['id2']},'attributes':['id',_0xa537('0x2b'),'save_name',_0xa537('0x64'),_0xa537('0x72')],'raw':!![]});}})[_0xa537('0x26')](function(_0x385c28){if(_0x385c28){fs['unlinkSync'](path[_0xa537('0x51')](_0x318410[_0xa537('0x5d')],util[_0xa537('0x67')](_0xa537('0x68'),_0x385c28[_0xa537('0x2b')],_0x385c28['converted_format'])));return _0x385c28;}})['catch'](function(_0x2cbdf2){throw new db['Sequelize'][(_0xa537('0x61'))](_0x2cbdf2['message']);});})[_0xa537('0x26')](handleEntityNotFound(_0x13468b,null))[_0xa537('0x26')](respondWithStatusCode(_0x13468b,0xcc))['catch'](handleError(_0x13468b,null));};exports['getSounds']=function(_0x329953,_0x2e38b4,_0x54f489){var _0x5c6046={};var _0x3b92bd={};var _0x42f5c3;var _0x5183d8;return db[_0xa537('0x2e')][_0xa537('0x6f')]({'where':{'id':_0x329953['params']['id']}})[_0xa537('0x26')](handleEntityNotFound(_0x2e38b4,null))[_0xa537('0x26')](function(_0x592056){if(_0x592056){_0x42f5c3=_0x592056;_0x3b92bd[_0xa537('0x32')]=_['keys'](db[_0xa537('0x71')]['rawAttributes']);_0x3b92bd[_0xa537('0x34')]=_[_0xa537('0x33')](_0x329953['query']);_0x3b92bd['filters']=_[_0xa537('0x36')](_0x3b92bd['model'],_0x3b92bd[_0xa537('0x34')]);_0x5c6046[_0xa537('0x38')]=_[_0xa537('0x36')](_0x3b92bd['model'],qs[_0xa537('0x37')](_0x329953[_0xa537('0x34')][_0xa537('0x37')]));_0x5c6046[_0xa537('0x38')]=_0x5c6046['attributes'][_0xa537('0x39')]?_0x5c6046[_0xa537('0x38')]:_0x3b92bd[_0xa537('0x32')];_0x5c6046[_0xa537('0x3c')]=qs['sort'](_0x329953[_0xa537('0x34')][_0xa537('0x3d')]);_0x5c6046[_0xa537('0x3e')]=qs['filters'](_[_0xa537('0x3f')](_0x329953[_0xa537('0x34')],_0x3b92bd[_0xa537('0x35')]));if(_0x329953[_0xa537('0x34')][_0xa537('0x40')]){_0x5c6046[_0xa537('0x3e')]=_[_0xa537('0x41')](_0x5c6046[_0xa537('0x3e')],{'$or':_[_0xa537('0x2d')](_0x5c6046[_0xa537('0x38')],function(_0x5a841e){var _0x129c27={};_0x129c27[_0x5a841e]={'$like':'%'+_0x329953[_0xa537('0x34')][_0xa537('0x40')]+'%'};return _0x129c27;})});}_0x5c6046=_[_0xa537('0x41')]({},_0x5c6046,_0x329953[_0xa537('0x42')]);return _0x42f5c3[_0xa537('0x73')](_0x5c6046);}})[_0xa537('0x26')](function(_0x2a9e7a){if(_0x2a9e7a){_0x5183d8=_0x2a9e7a[_0xa537('0x39')];if(!_0x329953[_0xa537('0x34')][_0xa537('0x3a')](_0xa537('0x3b'))){_0x5c6046[_0xa537('0x21')]=qs['limit'](_0x329953[_0xa537('0x34')][_0xa537('0x21')]);_0x5c6046[_0xa537('0x20')]=qs['offset'](_0x329953[_0xa537('0x34')]['offset']);}return _0x42f5c3[_0xa537('0x73')](_0x5c6046);}})['then'](function(_0x43f256){if(_0x43f256){return _0x43f256?{'count':_0x5183d8,'rows':_0x43f256}:null;}})[_0xa537('0x26')](respondWithResult(_0x2e38b4,null))[_0xa537('0x4b')](handleError(_0x2e38b4,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6ccb8d6..a0314ad 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 _0xbe4e=['voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold'];(function(_0x280b87,_0x1ea23a){var _0xf7184e=function(_0x818caf){while(--_0x818caf){_0x280b87['push'](_0x280b87['shift']());}};_0xf7184e(++_0x1ea23a);}(_0xbe4e,0x139));var _0xebe4=function(_0x5572b7,_0x244036){_0x5572b7=_0x5572b7-0x0;var _0x1bc232=_0xbe4e[_0x5572b7];return _0x1bc232;};'use strict';var _=require(_0xebe4('0x0'));var util=require(_0xebe4('0x1'));var logger=require(_0xebe4('0x2'))(_0xebe4('0x3'));var moment=require('moment');var BPromise=require(_0xebe4('0x4'));var rp=require(_0xebe4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebe4('0x6'));var config=require(_0xebe4('0x7'));var attributes=require(_0xebe4('0x8'));module['exports']=function(_0x3326af,_0x3d3704){return _0x3326af[_0xebe4('0x9')](_0xebe4('0xa'),attributes,{'tableName':_0xebe4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d02=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceMusicOnHold','lodash','util','../../config/logger'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0x9d02,0x1d6));var _0x29d0=function(_0x3d9fa8,_0x454d76){_0x3d9fa8=_0x3d9fa8-0x0;var _0x51c0f5=_0x9d02[_0x3d9fa8];return _0x51c0f5;};'use strict';var _=require(_0x29d0('0x0'));var util=require(_0x29d0('0x1'));var logger=require(_0x29d0('0x2'))(_0x29d0('0x3'));var moment=require('moment');var BPromise=require(_0x29d0('0x4'));var rp=require(_0x29d0('0x5'));var fs=require('fs');var path=require(_0x29d0('0x6'));var rimraf=require(_0x29d0('0x7'));var config=require(_0x29d0('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x29d0('0x9')]=function(_0x54e945,_0x939b51){return _0x54e945['define'](_0x29d0('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index de52218..4b35409 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 _0x1c20=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x1c20,0x79));var _0x01c2=function(_0x4ca333,_0x1218a3){_0x4ca333=_0x4ca333-0x0;var _0x13b2e1=_0x1c20[_0x4ca333];return _0x13b2e1;};'use strict';var _=require(_0x01c2('0x0'));var util=require(_0x01c2('0x1'));var moment=require(_0x01c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x01c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01c2('0x4'))['db'];var utils=require(_0x01c2('0x5'));var logger=require(_0x01c2('0x6'))(_0x01c2('0x7'));var config=require(_0x01c2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x01c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x552a4a,_0x2d7419,_0xd273aa){return new BPromise(function(_0x59e0ca,_0x50e9f6){return client[_0x01c2('0xa')](_0x552a4a,_0xd273aa)[_0x01c2('0xb')](function(_0x1628ea){logger[_0x01c2('0xc')](_0x01c2('0xd'),_0x2d7419,_0x01c2('0xe'));logger[_0x01c2('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2d7419,_0x01c2('0xe'),JSON[_0x01c2('0x10')](_0x1628ea));if(_0x1628ea[_0x01c2('0x11')]){if(_0x1628ea['error']['code']===0x1f4){logger[_0x01c2('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2d7419,_0x1628ea['error'][_0x01c2('0x12')]);return _0x50e9f6(_0x1628ea[_0x01c2('0x11')][_0x01c2('0x12')]);}logger[_0x01c2('0x11')](_0x01c2('0xd'),_0x2d7419,_0x1628ea[_0x01c2('0x11')][_0x01c2('0x12')]);return _0x59e0ca(_0x1628ea['error'][_0x01c2('0x12')]);}else{logger[_0x01c2('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2d7419,_0x01c2('0xe'));_0x59e0ca(_0x1628ea[_0x01c2('0x13')]['message']);}})[_0x01c2('0x14')](function(_0x54f0e6){logger[_0x01c2('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2d7419,_0x54f0e6);_0x50e9f6(_0x54f0e6);});});} \ No newline at end of file +var _0x0448=['request\x20sent','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s'];(function(_0x48eda2,_0x488e29){var _0x179adc=function(_0x24b21a){while(--_0x24b21a){_0x48eda2['push'](_0x48eda2['shift']());}};_0x179adc(++_0x488e29);}(_0x0448,0xb7));var _0x8044=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x0448[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0x8044('0x0'));var util=require(_0x8044('0x1'));var moment=require(_0x8044('0x2'));var BPromise=require('bluebird');var rs=require(_0x8044('0x3'));var fs=require('fs');var Redis=require(_0x8044('0x4'));var db=require(_0x8044('0x5'))['db'];var utils=require(_0x8044('0x6'));var logger=require(_0x8044('0x7'))(_0x8044('0x8'));var config=require(_0x8044('0x9'));var jayson=require(_0x8044('0xa'));var client=jayson['client'][_0x8044('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28ca3c,_0x130e34,_0x5972a9){return new BPromise(function(_0x1689ea,_0xd30195){return client[_0x8044('0xc')](_0x28ca3c,_0x5972a9)['then'](function(_0x33af77){logger[_0x8044('0xd')](_0x8044('0xe'),_0x130e34,_0x8044('0xf'));logger['debug'](_0x8044('0x10'),_0x130e34,_0x8044('0xf'),JSON[_0x8044('0x11')](_0x33af77));if(_0x33af77['error']){if(_0x33af77[_0x8044('0x12')][_0x8044('0x13')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x130e34,_0x33af77[_0x8044('0x12')]['message']);return _0xd30195(_0x33af77['error']['message']);}logger[_0x8044('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x130e34,_0x33af77[_0x8044('0x12')][_0x8044('0x14')]);return _0x1689ea(_0x33af77['error'][_0x8044('0x14')]);}else{logger[_0x8044('0xd')](_0x8044('0xe'),_0x130e34,_0x8044('0xf'));_0x1689ea(_0x33af77['result'][_0x8044('0x14')]);}})[_0x8044('0x15')](function(_0x32cd90){logger[_0x8044('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x130e34,_0x32cd90);_0xd30195(_0x32cd90);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index fbe96e1..104c681 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 _0x28ac=['/:id','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','multer','util','path','connect-timeout','Router','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x59de24,_0x465acf){var _0x402429=function(_0x1f5316){while(--_0x1f5316){_0x59de24['push'](_0x59de24['shift']());}};_0x402429(++_0x465acf);}(_0x28ac,0x1cb));var _0xc28a=function(_0x26d33a,_0x4aea52){_0x26d33a=_0x26d33a-0x0;var _0x2a3896=_0x28ac[_0x26d33a];return _0x2a3896;};'use strict';var multer=require(_0xc28a('0x0'));var util=require(_0xc28a('0x1'));var path=require(_0xc28a('0x2'));var timeout=require(_0xc28a('0x3'));var express=require('express');var router=express[_0xc28a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc28a('0x5'));var controller=require(_0xc28a('0x6'));router[_0xc28a('0x7')]('/',auth[_0xc28a('0x8')](),controller['index']);router[_0xc28a('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc28a('0x7')](_0xc28a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc28a('0x7')](_0xc28a('0xa'),auth[_0xc28a('0x8')](),controller[_0xc28a('0xb')]);router[_0xc28a('0xc')]('/',auth[_0xc28a('0x8')](),controller[_0xc28a('0xd')]);router[_0xc28a('0xc')](_0xc28a('0xa'),auth['isAuthenticated'](),controller[_0xc28a('0xe')]);router[_0xc28a('0xf')]('/:id',auth[_0xc28a('0x8')](),controller['update']);router[_0xc28a('0x10')]('/:id',auth[_0xc28a('0x8')](),controller['destroy']);router[_0xc28a('0x10')]('/:id/users',auth[_0xc28a('0x8')](),controller[_0xc28a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x37ba=['../../config/environment','get','index','isAuthenticated','describe','/:id','show','getAgents','post','create','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x422890,_0x434494){var _0x202cf0=function(_0x10e9f0){while(--_0x10e9f0){_0x422890['push'](_0x422890['shift']());}};_0x202cf0(++_0x434494);}(_0x37ba,0xda));var _0xa37b=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x37ba[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xa37b('0x0'));var util=require(_0xa37b('0x1'));var path=require(_0xa37b('0x2'));var timeout=require('connect-timeout');var express=require(_0xa37b('0x3'));var router=express[_0xa37b('0x4')]();var auth=require(_0xa37b('0x5'));var interaction=require(_0xa37b('0x6'));var config=require(_0xa37b('0x7'));var controller=require('./voicePrefix.controller');router[_0xa37b('0x8')]('/',auth['isAuthenticated'](),controller[_0xa37b('0x9')]);router['get']('/describe',auth[_0xa37b('0xa')](),controller[_0xa37b('0xb')]);router[_0xa37b('0x8')](_0xa37b('0xc'),auth[_0xa37b('0xa')](),controller[_0xa37b('0xd')]);router[_0xa37b('0x8')]('/:id/users',auth[_0xa37b('0xa')](),controller[_0xa37b('0xe')]);router[_0xa37b('0xf')]('/',auth[_0xa37b('0xa')](),controller[_0xa37b('0x10')]);router[_0xa37b('0xf')](_0xa37b('0x11'),auth[_0xa37b('0xa')](),controller[_0xa37b('0x12')]);router[_0xa37b('0x13')](_0xa37b('0xc'),auth['isAuthenticated'](),controller[_0xa37b('0x14')]);router[_0xa37b('0x15')]('/:id',auth[_0xa37b('0xa')](),controller[_0xa37b('0x16')]);router['delete']('/:id/users',auth[_0xa37b('0xa')](),controller[_0xa37b('0x17')]);module[_0xa37b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 6451639..801bdb3 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 _0x5022=['sequelize','STRING','name','VIRTUAL'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5022,0xd0));var _0x2502=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5022[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x2502('0x0'));module['exports']={'name':{'type':Sequelize[_0x2502('0x1')],'allowNull':![],'unique':_0x2502('0x2')},'prefix':{'type':Sequelize[_0x2502('0x3')],'get':function(_0x5a5943){return'system-'+this['getDataValue'](_0x2502('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2502('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4ca0=['STRING','name','VIRTUAL','system-','sequelize','exports'];(function(_0xd6ab42,_0x4a76f8){var _0x445960=function(_0x16ca59){while(--_0x16ca59){_0xd6ab42['push'](_0xd6ab42['shift']());}};_0x445960(++_0x4a76f8);}(_0x4ca0,0x178));var _0x04ca=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x4ca0[_0x575057];return _0x49dbc8;};'use strict';var Sequelize=require(_0x04ca('0x0'));module[_0x04ca('0x1')]={'name':{'type':Sequelize[_0x04ca('0x2')],'allowNull':![],'unique':_0x04ca('0x3')},'prefix':{'type':Sequelize[_0x04ca('0x4')],'get':function(_0xc464b6){return _0x04ca('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x04ca('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 217bb44..3f9b42a 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 _0x3c7e=['json','count','offset','limit','set','Content-Range','apply','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','fieldName','type','key','model','map','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','filtears','fields','find','describe','create','sequelize','transaction','body','VoiceExtension','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status'];(function(_0x328697,_0x54ca21){var _0x7b29bd=function(_0x14be80){while(--_0x14be80){_0x328697['push'](_0x328697['shift']());}};_0x7b29bd(++_0x54ca21);}(_0x3c7e,0xdb));var _0xe3c7=function(_0x1f6704,_0x106f36){_0x1f6704=_0x1f6704-0x0;var _0x4acab6=_0x3c7e[_0x1f6704];return _0x4acab6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe3c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe3c7('0x1'));var jsonpatch=require(_0xe3c7('0x2'));var rp=require(_0xe3c7('0x3'));var moment=require(_0xe3c7('0x4'));var BPromise=require(_0xe3c7('0x5'));var Mustache=require(_0xe3c7('0x6'));var util=require(_0xe3c7('0x7'));var path=require(_0xe3c7('0x8'));var sox=require(_0xe3c7('0x9'));var csv=require(_0xe3c7('0xa'));var ejs=require(_0xe3c7('0xb'));var fs=require('fs');var _=require(_0xe3c7('0xc'));var squel=require(_0xe3c7('0xd'));var crypto=require(_0xe3c7('0xe'));var jsforce=require(_0xe3c7('0xf'));var deskjs=require(_0xe3c7('0x10'));var toCsv=require(_0xe3c7('0xa'));var querystring=require(_0xe3c7('0x11'));var Papa=require(_0xe3c7('0x12'));var Redis=require(_0xe3c7('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c7('0x14'));var logger=require(_0xe3c7('0x15'))(_0xe3c7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe3c7('0x17'));var db=require(_0xe3c7('0x18'))['db'];config[_0xe3c7('0x19')]=_[_0xe3c7('0x1a')](config[_0xe3c7('0x19')],{'host':_0xe3c7('0x1b'),'port':0x18eb});var socket=require(_0xe3c7('0x1c'))(new Redis(config['redis']));require(_0xe3c7('0x1d'))['register'](socket);function respondWithStatusCode(_0x491ccd,_0xd33aeb){_0xd33aeb=_0xd33aeb||0xcc;return function(_0x31b0b0){if(_0x31b0b0){return _0x491ccd[_0xe3c7('0x1e')](_0xd33aeb);}return _0x491ccd['status'](_0xd33aeb)[_0xe3c7('0x1f')]();};}function respondWithResult(_0x4cded1,_0x269bdc){_0x269bdc=_0x269bdc||0xc8;return function(_0x1ba3cc){if(_0x1ba3cc){return _0x4cded1[_0xe3c7('0x20')](_0x269bdc)[_0xe3c7('0x21')](_0x1ba3cc);}};}function respondWithFilteredResult(_0xcb2c92,_0x2580f4){return function(_0x4f8549){if(_0x4f8549){var _0x3c8d6e=_0x4f8549[_0xe3c7('0x22')],_0x5ba74f=_0x2580f4[_0xe3c7('0x23')],_0x252857=_0x2580f4['offset']+_0x2580f4[_0xe3c7('0x24')],_0x13f5bc;if(_0x252857>=_0x3c8d6e){_0x252857=_0x3c8d6e;_0x13f5bc=0xc8;}else{_0x13f5bc=0xce;}_0xcb2c92['status'](_0x13f5bc);return _0xcb2c92[_0xe3c7('0x25')](_0xe3c7('0x26'),_0x5ba74f+'-'+_0x252857+'/'+_0x3c8d6e)[_0xe3c7('0x21')](_0x4f8549);}return null;};}function patchUpdates(_0x97d9d0){return function(_0x422a85){try{jsonpatch[_0xe3c7('0x27')](_0x422a85,_0x97d9d0,!![]);}catch(_0x57d0c8){return BPromise['reject'](_0x57d0c8);}return _0x422a85['save']();};}function saveUpdates(_0x40e5d1,_0x5165c9){return function(_0x16f625){if(_0x16f625){return _0x16f625[_0xe3c7('0x28')](_0x40e5d1)[_0xe3c7('0x29')](function(_0x1c9594){return _0x1c9594;});}return null;};}function removeEntity(_0x20cd8e,_0x39608f){return function(_0x2de719){if(_0x2de719){return _0x2de719[_0xe3c7('0x2a')]()[_0xe3c7('0x29')](function(){var _0x11652b=_0x2de719[_0xe3c7('0x2b')]({'plain':!![]});var _0x5cce33=_0xe3c7('0x2c');return db[_0xe3c7('0x2d')][_0xe3c7('0x2a')]({'where':{'type':_0x5cce33,'resourceId':_0x11652b['id']}})[_0xe3c7('0x29')](function(){return _0x2de719;});})[_0xe3c7('0x29')](function(){_0x20cd8e['status'](0xcc)[_0xe3c7('0x1f')]();});}};}function handleEntityNotFound(_0x26ef6a,_0x4acf3b){return function(_0x3473ba){if(!_0x3473ba){_0x26ef6a[_0xe3c7('0x1e')](0x194);}return _0x3473ba;};}function handleError(_0xa5eb9b,_0x4e36ae){_0x4e36ae=_0x4e36ae||0x1f4;return function(_0x5d69c4){logger[_0xe3c7('0x2e')](_0x5d69c4[_0xe3c7('0x2f')]);if(_0x5d69c4['name']){delete _0x5d69c4[_0xe3c7('0x30')];}_0xa5eb9b['status'](_0x4e36ae)[_0xe3c7('0x31')](_0x5d69c4);};}exports[_0xe3c7('0x32')]=function(_0x1dc650,_0x136ddc){var _0x299319={},_0xa2ee92={},_0x21fdaa={'count':0x0,'rows':[]};var _0x19c869=_['map'](db[_0xe3c7('0x33')]['rawAttributes'],function(_0xc4fff8){return{'name':_0xc4fff8[_0xe3c7('0x34')],'type':_0xc4fff8[_0xe3c7('0x35')][_0xe3c7('0x36')]};});_0xa2ee92[_0xe3c7('0x37')]=_[_0xe3c7('0x38')](_0x19c869,_0xe3c7('0x30'));_0xa2ee92['query']=_[_0xe3c7('0x39')](_0x1dc650[_0xe3c7('0x3a')]);_0xa2ee92['filters']=_['intersection'](_0xa2ee92['model'],_0xa2ee92[_0xe3c7('0x3a')]);_0x299319[_0xe3c7('0x3b')]=_[_0xe3c7('0x3c')](_0xa2ee92['model'],qs['fields'](_0x1dc650[_0xe3c7('0x3a')]['fields']));_0x299319[_0xe3c7('0x3b')]=_0x299319[_0xe3c7('0x3b')][_0xe3c7('0x3d')]?_0x299319[_0xe3c7('0x3b')]:_0xa2ee92[_0xe3c7('0x37')];if(!_0x1dc650['query'][_0xe3c7('0x3e')](_0xe3c7('0x3f'))){_0x299319[_0xe3c7('0x24')]=qs[_0xe3c7('0x24')](_0x1dc650['query'][_0xe3c7('0x24')]);_0x299319[_0xe3c7('0x23')]=qs[_0xe3c7('0x23')](_0x1dc650[_0xe3c7('0x3a')][_0xe3c7('0x23')]);}_0x299319[_0xe3c7('0x40')]=qs[_0xe3c7('0x41')](_0x1dc650['query']['sort']);_0x299319[_0xe3c7('0x42')]=qs[_0xe3c7('0x43')](_[_0xe3c7('0x44')](_0x1dc650[_0xe3c7('0x3a')],_0xa2ee92[_0xe3c7('0x43')]),_0x19c869);if(_0x1dc650['query'][_0xe3c7('0x45')]){_0x299319[_0xe3c7('0x42')]=_[_0xe3c7('0x46')](_0x299319['where'],{'$or':_[_0xe3c7('0x38')](_0x19c869,function(_0x525c28){if(_0x525c28['type']!==_0xe3c7('0x47')){var _0x3adca1={};_0x3adca1[_0x525c28[_0xe3c7('0x30')]]={'$like':'%'+_0x1dc650[_0xe3c7('0x3a')][_0xe3c7('0x45')]+'%'};return _0x3adca1;}})});}_0x299319=_['merge']({},_0x299319,_0x1dc650[_0xe3c7('0x48')]);var _0x464abb={'where':_0x299319[_0xe3c7('0x42')]};return db[_0xe3c7('0x33')][_0xe3c7('0x22')](_0x464abb)[_0xe3c7('0x29')](function(_0x533ac8){_0x21fdaa[_0xe3c7('0x22')]=_0x533ac8;if(_0x1dc650[_0xe3c7('0x3a')][_0xe3c7('0x49')]){_0x299319[_0xe3c7('0x4a')]=[{'all':!![]}];}return db[_0xe3c7('0x33')][_0xe3c7('0x4b')](_0x299319);})['then'](function(_0xb1c45e){_0x21fdaa['rows']=_0xb1c45e;return _0x21fdaa;})[_0xe3c7('0x29')](respondWithFilteredResult(_0x136ddc,_0x299319))[_0xe3c7('0x4c')](handleError(_0x136ddc,null));};exports[_0xe3c7('0x4d')]=function(_0xb788af,_0xe95c81){var _0x4322b3={'raw':![],'where':{'id':_0xb788af[_0xe3c7('0x4e')]['id']}},_0x561511={};_0x561511[_0xe3c7('0x37')]=_[_0xe3c7('0x39')](db['VoicePrefix'][_0xe3c7('0x4f')]);_0x561511[_0xe3c7('0x3a')]=_[_0xe3c7('0x39')](_0xb788af['query']);_0x561511[_0xe3c7('0x50')]=_['intersection'](_0x561511[_0xe3c7('0x37')],_0x561511[_0xe3c7('0x3a')]);_0x4322b3[_0xe3c7('0x3b')]=_[_0xe3c7('0x3c')](_0x561511[_0xe3c7('0x37')],qs[_0xe3c7('0x51')](_0xb788af[_0xe3c7('0x3a')]['fields']));_0x4322b3[_0xe3c7('0x3b')]=_0x4322b3[_0xe3c7('0x3b')][_0xe3c7('0x3d')]?_0x4322b3[_0xe3c7('0x3b')]:_0x561511['model'];if(_0xb788af[_0xe3c7('0x3a')][_0xe3c7('0x49')]){_0x4322b3[_0xe3c7('0x4a')]=[{'all':!![]}];}_0x4322b3=_[_0xe3c7('0x46')]({},_0x4322b3,_0xb788af['options']);return db[_0xe3c7('0x33')][_0xe3c7('0x52')](_0x4322b3)[_0xe3c7('0x29')](handleEntityNotFound(_0xe95c81,null))['then'](respondWithResult(_0xe95c81,null))[_0xe3c7('0x4c')](handleError(_0xe95c81,null));};exports[_0xe3c7('0x2a')]=function(_0x3452b5,_0x127af3){return db[_0xe3c7('0x33')]['find']({'where':{'id':_0x3452b5[_0xe3c7('0x4e')]['id']}})[_0xe3c7('0x29')](handleEntityNotFound(_0x127af3,null))['then'](removeEntity(_0x127af3,null))['catch'](handleError(_0x127af3,null));};exports[_0xe3c7('0x53')]=function(_0x486694,_0x1bb978){return db[_0xe3c7('0x33')][_0xe3c7('0x53')]()[_0xe3c7('0x29')](respondWithResult(_0x1bb978,null))['catch'](handleError(_0x1bb978,null));};exports[_0xe3c7('0x54')]=function(_0x41c5a0,_0x2e343c){var _0x448db1;return db[_0xe3c7('0x55')][_0xe3c7('0x56')](function(_0x1c8c4e){return db[_0xe3c7('0x33')][_0xe3c7('0x54')](_0x41c5a0[_0xe3c7('0x57')],{'transaction':_0x1c8c4e})[_0xe3c7('0x29')](function(_0x5e1db6){_0x448db1=_0x5e1db6['get']({'plain':!![]});return db[_0xe3c7('0x58')][_0xe3c7('0x52')]({'where':{'id':_0x448db1['VoiceExtensionId']},'raw':!![]})[_0xe3c7('0x29')](function(_0x3f98f3){return createVoicePrefixExtensions(_0x448db1,_0x3f98f3,_0x1c8c4e);});});})[_0xe3c7('0x29')](function(){var _0x4abaf4=_0x41c5a0['user'][_0xe3c7('0x2b')]({'plain':!![]});if(!_0x4abaf4)throw new Error(_0xe3c7('0x59'));if(_0x4abaf4[_0xe3c7('0x5a')]===_0xe3c7('0x5b')){var _0x377e12=_0x448db1;return db['UserProfileSection'][_0xe3c7('0x52')]({'where':{'name':_0xe3c7('0x2c'),'userProfileId':_0x4abaf4[_0xe3c7('0x5c')]},'raw':!![]})[_0xe3c7('0x29')](function(_0x5d2519){if(_0x5d2519&&_0x5d2519[_0xe3c7('0x5d')]===0x0){return db[_0xe3c7('0x2d')]['create']({'name':_0x377e12[_0xe3c7('0x30')],'resourceId':_0x377e12['id'],'type':_0x5d2519[_0xe3c7('0x30')],'sectionId':_0x5d2519['id']},{})[_0xe3c7('0x29')](function(){return _0x448db1;});}else{return _0x448db1;}})['catch'](function(_0x4db779){logger[_0xe3c7('0x2e')](_0xe3c7('0x5e'),_0x4db779);throw _0x4db779;});}return _0x448db1;})['then'](respondWithResult(_0x2e343c,null))[_0xe3c7('0x4c')](handleError(_0x2e343c,null));};function Extension(_0x378512,_0x59931e,_0x3a7cd7,_0x40fba5){this[_0xe3c7('0x5f')]='from-sip';this[_0xe3c7('0x60')]=_0x378512;this[_0xe3c7('0x61')]=_0x3a7cd7;this['type']=_0xe3c7('0x62');this[_0xe3c7('0x63')]=_0xe3c7('0x64');this['priority']=_0x59931e;this[_0xe3c7('0x65')]=_0x40fba5;}function createVoicePrefixExtensions(_0x4280bb,_0x485e00,_0x5f1e9b){return new BPromise(function(_0x477c5b,_0x172dac){var _0xef48a=new Extension(formatPrefixName(_0x4280bb[_0xe3c7('0x66')]),0x1,_0xe3c7('0x67'),_0xe3c7('0x68'));_0xef48a[_0xe3c7('0x69')]=_0x4280bb['id'];return db[_0xe3c7('0x58')][_0xe3c7('0x54')](_0xef48a,{'transaction':_0x5f1e9b})[_0xe3c7('0x29')](function(_0x478c57){var _0x3039c1=_0x478c57[_0xe3c7('0x2b')]({'plain':!![]});var _0x14b84e=_[_0xe3c7('0x38')](addVoicePrefixExtensions(_0x4280bb,_0x485e00),function(_0x42efd9){_0x42efd9[_0xe3c7('0x6a')]=_0x3039c1['id'];_0x42efd9['VoicePrefixId']=_0x4280bb['id'];return _0x42efd9;});return db[_0xe3c7('0x58')][_0xe3c7('0x6b')](_0x14b84e,{'transaction':_0x5f1e9b})[_0xe3c7('0x29')](function(_0x1b6e44){if(!_0x1b6e44){return _0x172dac(_0xe3c7('0x6c'));}else{return _0x477c5b(_0x1b6e44);}})[_0xe3c7('0x4c')](function(_0x19c406){return _0x172dac(_0x19c406);});});;});};function addVoicePrefixExtensions(_0x2484d8,_0x2b680d){var _0x35e78b=[];var _0x18541d=formatPrefixName(_0x2484d8[_0xe3c7('0x66')]);_0x35e78b[_0xe3c7('0x6d')](new Extension(_0x18541d,0x2,_0xe3c7('0x6e'),_0xe3c7('0x6f')+_0x2484d8[_0xe3c7('0x30')]));if(_0x2484d8['callerIdAll']){_0x35e78b[_0xe3c7('0x6d')](new Extension(_0x18541d,0x3,_0xe3c7('0x6e'),'PREFIX-CALLERIDALL='+_0x2484d8['callerIdAll']));}else{_0x35e78b[_0xe3c7('0x6d')](new Extension(_0x18541d,0x3,_0xe3c7('0x67'),_0xe3c7('0x70')));}_0x35e78b[_0xe3c7('0x6d')](new Extension(_0x18541d,0x4,_0xe3c7('0x71'),_0x2b680d['context']+','+_0xe3c7('0x72')+(0x8+_0x2484d8[_0xe3c7('0x30')][_0xe3c7('0x3d')])+'}'+','+0x1));return _0x35e78b;}function formatPrefixName(_0x2704b5){var _0x54128b='_';for(var _0x5deee7=0x0;_0x5deee7<_0x2704b5[_0xe3c7('0x3d')];_0x5deee7++){if(_0x2704b5[_0xe3c7('0x73')](_0x5deee7)=='-'){_0x54128b+=_0x2704b5[_0xe3c7('0x73')](_0x5deee7);}else{_0x54128b+='['+_0x2704b5['charAt'](_0x5deee7)+']';}}_0x54128b+='.';return _0x54128b;}exports[_0xe3c7('0x28')]=function(_0x286a47,_0x4adfa4,_0x1d7db6){var _0x3dce67=_0x286a47['body'];_0x3dce67[_0xe3c7('0x66')]=_0xe3c7('0x74')+_0x3dce67[_0xe3c7('0x30')]+'-';return db[_0xe3c7('0x55')][_0xe3c7('0x56')](function(_0x5087dd){return db[_0xe3c7('0x33')][_0xe3c7('0x28')](_0x3dce67,{'where':{'id':_0x3dce67['id']},'transaction':_0x5087dd})[_0xe3c7('0x29')](function(){return db[_0xe3c7('0x58')]['destroy']({'where':{'VoicePrefixId':_0x3dce67['id']},'transaction':_0x5087dd})[_0xe3c7('0x29')](function(){return db[_0xe3c7('0x58')][_0xe3c7('0x52')]({'where':{'id':_0x3dce67[_0xe3c7('0x6a')]},'raw':!![]})[_0xe3c7('0x29')](function(_0x126b4a){return createVoicePrefixExtensions(_0x3dce67,_0x126b4a,_0x5087dd);});});});})[_0xe3c7('0x29')](function(){return db[_0xe3c7('0x33')]['findById'](_0x3dce67['id']);})[_0xe3c7('0x29')](respondWithResult(_0x4adfa4,null))['catch'](handleError(_0x4adfa4,null));};exports[_0xe3c7('0x75')]=function(_0x21fa79,_0x2ec29a,_0x1fd5f0){return db['VoicePrefix'][_0xe3c7('0x52')]({'where':{'id':_0x21fa79[_0xe3c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2ec29a,null))[_0xe3c7('0x29')](function(_0x2203ad){if(_0x2203ad){return _0x2203ad[_0xe3c7('0x75')](_0x21fa79['body'][_0xe3c7('0x76')],_[_0xe3c7('0x77')](_0x21fa79[_0xe3c7('0x57')],[_0xe3c7('0x76'),'id'])||{})['spread'](function(_0x5db328){for(var _0x2b225d=0x0;_0x2b225d<_0x21fa79[_0xe3c7('0x57')][_0xe3c7('0x76')][_0xe3c7('0x3d')];_0x2b225d+=0x1){socket[_0xe3c7('0x78')](_0xe3c7('0x79'),{'UserId':_0x21fa79['body']['ids'][_0x2b225d],'VoicePrefixId':_0x21fa79[_0xe3c7('0x4e')]['id']});}return _0x5db328;});}})[_0xe3c7('0x29')](respondWithResult(_0x2ec29a,null))[_0xe3c7('0x4c')](handleError(_0x2ec29a,null));};exports[_0xe3c7('0x7a')]=function(_0x5078d6,_0x175b92,_0x2e09af){return db[_0xe3c7('0x33')][_0xe3c7('0x52')]({'where':{'id':_0x5078d6[_0xe3c7('0x4e')]['id']}})[_0xe3c7('0x29')](handleEntityNotFound(_0x175b92,null))[_0xe3c7('0x29')](function(_0x45588c){if(_0x45588c){return _0x45588c[_0xe3c7('0x7a')](_0x5078d6[_0xe3c7('0x3a')]['ids'])[_0xe3c7('0x29')](function(){if(_[_0xe3c7('0x7b')](_0x5078d6[_0xe3c7('0x3a')]['ids'])){for(var _0x17bb9a=0x0;_0x17bb9a<_0x5078d6[_0xe3c7('0x3a')]['ids'][_0xe3c7('0x3d')];_0x17bb9a+=0x1){socket[_0xe3c7('0x78')](_0xe3c7('0x7c'),{'UserId':Number(_0x5078d6[_0xe3c7('0x3a')][_0xe3c7('0x76')][_0x17bb9a]),'VoicePrefixId':Number(_0x5078d6['params']['id'])});}}else{socket['emit'](_0xe3c7('0x7c'),{'UserId':Number(_0x5078d6[_0xe3c7('0x3a')]['ids']),'VoicePrefixId':Number(_0x5078d6[_0xe3c7('0x4e')]['id'])});}});}})[_0xe3c7('0x29')](respondWithStatusCode(_0x175b92,null))[_0xe3c7('0x4c')](handleError(_0x175b92,null));};exports[_0xe3c7('0x7d')]=function(_0x30478e,_0x2b3e8a,_0x538d58){var _0x8e4c70={};var _0x16b999={};var _0x3a27c9;var _0x450264;return db[_0xe3c7('0x33')]['findOne']({'where':{'id':_0x30478e[_0xe3c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2b3e8a,null))['then'](function(_0x41aad6){if(_0x41aad6){_0x3a27c9=_0x41aad6;_0x16b999['model']=_[_0xe3c7('0x39')](db['User'][_0xe3c7('0x4f')]);_0x16b999[_0xe3c7('0x3a')]=_[_0xe3c7('0x39')](_0x30478e['query']);_0x16b999['filters']=_[_0xe3c7('0x3c')](_0x16b999[_0xe3c7('0x37')],_0x16b999['query']);_0x8e4c70['attributes']=_['intersection'](_0x16b999[_0xe3c7('0x37')],qs[_0xe3c7('0x51')](_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x51')]));_0x8e4c70[_0xe3c7('0x3b')]=_0x8e4c70[_0xe3c7('0x3b')][_0xe3c7('0x3d')]?_0x8e4c70[_0xe3c7('0x3b')]:_0x16b999[_0xe3c7('0x37')];_0x8e4c70[_0xe3c7('0x40')]=qs[_0xe3c7('0x41')](_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x41')]);_0x8e4c70[_0xe3c7('0x42')]=qs[_0xe3c7('0x43')](_['pick'](_0x30478e[_0xe3c7('0x3a')],_0x16b999[_0xe3c7('0x43')]));if(_0x30478e['query'][_0xe3c7('0x45')]){_0x8e4c70[_0xe3c7('0x42')]=_[_0xe3c7('0x46')](_0x8e4c70[_0xe3c7('0x42')],{'$or':_['map'](_0x8e4c70['attributes'],function(_0x58b5c0){var _0x4497c2={};_0x4497c2[_0x58b5c0]={'$like':'%'+_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x45')]+'%'};return _0x4497c2;})});}_0x8e4c70=_[_0xe3c7('0x46')]({},_0x8e4c70,_0x30478e[_0xe3c7('0x48')]);return _0x3a27c9['getAgents'](_0x8e4c70);}})[_0xe3c7('0x29')](function(_0x55fbcc){if(_0x55fbcc){_0x450264=_0x55fbcc[_0xe3c7('0x3d')];if(!_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x3e')](_0xe3c7('0x3f'))){_0x8e4c70['limit']=qs['limit'](_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x24')]);_0x8e4c70[_0xe3c7('0x23')]=qs[_0xe3c7('0x23')](_0x30478e[_0xe3c7('0x3a')][_0xe3c7('0x23')]);}return _0x3a27c9[_0xe3c7('0x7d')](_0x8e4c70);}})[_0xe3c7('0x29')](function(_0x32b1b4){if(_0x32b1b4){return _0x32b1b4?{'count':_0x450264,'rows':_0x32b1b4}:null;}})[_0xe3c7('0x29')](respondWithResult(_0x2b3e8a,null))[_0xe3c7('0x4c')](handleError(_0x2b3e8a,null));}; \ No newline at end of file +var _0x1b4e=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','show','params','keys','filtears','find','catch','describe','create','transaction','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','NoOp','Voice\x20Prefix','VoiceExtension','VoiceExtensionId','prefix','push','Set','CDR(prefix)=','callerIdAll','${EXTEN:','charAt','sequelize','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1ec3fe,_0x2bbc3d){var _0x23d25b=function(_0x32c1cf){while(--_0x32c1cf){_0x1ec3fe['push'](_0x1ec3fe['shift']());}};_0x23d25b(++_0x2bbc3d);}(_0x1b4e,0x158));var _0xe1b4=function(_0x38d818,_0x257e09){_0x38d818=_0x38d818-0x0;var _0x4194e5=_0x1b4e[_0x38d818];return _0x4194e5;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe1b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1b4('0x1'));var rp=require(_0xe1b4('0x2'));var moment=require(_0xe1b4('0x3'));var BPromise=require(_0xe1b4('0x4'));var Mustache=require(_0xe1b4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xe1b4('0x6'));var csv=require(_0xe1b4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe1b4('0x8'));var squel=require(_0xe1b4('0x9'));var crypto=require(_0xe1b4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe1b4('0xb'));var toCsv=require(_0xe1b4('0x7'));var querystring=require(_0xe1b4('0xc'));var Papa=require('papaparse');var Redis=require(_0xe1b4('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe1b4('0xe'));var hardwareService=require(_0xe1b4('0xf'));var logger=require(_0xe1b4('0x10'))(_0xe1b4('0x11'));var utils=require(_0xe1b4('0x12'));var config=require(_0xe1b4('0x13'));var licenseUtil=require(_0xe1b4('0x14'));var db=require(_0xe1b4('0x15'))['db'];config[_0xe1b4('0x16')]=_[_0xe1b4('0x17')](config['redis'],{'host':_0xe1b4('0x18'),'port':0x18eb});var socket=require(_0xe1b4('0x19'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xe1b4('0x1a')](socket);function respondWithStatusCode(_0x43c9ab,_0x1dffda){_0x1dffda=_0x1dffda||0xcc;return function(_0x22aaeb){if(_0x22aaeb){return _0x43c9ab[_0xe1b4('0x1b')](_0x1dffda);}return _0x43c9ab['status'](_0x1dffda)[_0xe1b4('0x1c')]();};}function respondWithResult(_0x55e4d0,_0x4f41d3){_0x4f41d3=_0x4f41d3||0xc8;return function(_0x2a9f52){if(_0x2a9f52){return _0x55e4d0[_0xe1b4('0x1d')](_0x4f41d3)[_0xe1b4('0x1e')](_0x2a9f52);}};}function respondWithFilteredResult(_0x2c72b2,_0x1fc795){return function(_0xce0724){if(_0xce0724){var _0x4b2b74=_0xce0724[_0xe1b4('0x1f')],_0x282b33=_0x1fc795['offset'],_0xa3866a=_0x1fc795[_0xe1b4('0x20')]+_0x1fc795[_0xe1b4('0x21')],_0xa68491;if(_0xa3866a>=_0x4b2b74){_0xa3866a=_0x4b2b74;_0xa68491=0xc8;}else{_0xa68491=0xce;}_0x2c72b2['status'](_0xa68491);return _0x2c72b2['set'](_0xe1b4('0x22'),_0x282b33+'-'+_0xa3866a+'/'+_0x4b2b74)[_0xe1b4('0x1e')](_0xce0724);}return null;};}function patchUpdates(_0x777859){return function(_0x4ada5f){try{jsonpatch[_0xe1b4('0x23')](_0x4ada5f,_0x777859,!![]);}catch(_0x50ae84){return BPromise[_0xe1b4('0x24')](_0x50ae84);}return _0x4ada5f[_0xe1b4('0x25')]();};}function saveUpdates(_0x552c4c,_0x17e81c){return function(_0x2b36fa){if(_0x2b36fa){return _0x2b36fa[_0xe1b4('0x26')](_0x552c4c)[_0xe1b4('0x27')](function(_0x54c7ec){return _0x54c7ec;});}return null;};}function removeEntity(_0x5d0ae7,_0x20407b){return function(_0xf4d55a){if(_0xf4d55a){return _0xf4d55a[_0xe1b4('0x28')]()[_0xe1b4('0x27')](function(){var _0x42c9f0=_0xf4d55a[_0xe1b4('0x29')]({'plain':!![]});var _0x4ab3b8=_0xe1b4('0x2a');return db['UserProfileResource'][_0xe1b4('0x28')]({'where':{'type':_0x4ab3b8,'resourceId':_0x42c9f0['id']}})['then'](function(){return _0xf4d55a;});})[_0xe1b4('0x27')](function(){_0x5d0ae7[_0xe1b4('0x1d')](0xcc)[_0xe1b4('0x1c')]();});}};}function handleEntityNotFound(_0x20440c,_0x556483){return function(_0x13359b){if(!_0x13359b){_0x20440c[_0xe1b4('0x1b')](0x194);}return _0x13359b;};}function handleError(_0x16a849,_0x2b138d){_0x2b138d=_0x2b138d||0x1f4;return function(_0x20f61b){logger[_0xe1b4('0x2b')](_0x20f61b[_0xe1b4('0x2c')]);if(_0x20f61b[_0xe1b4('0x2d')]){delete _0x20f61b[_0xe1b4('0x2d')];}_0x16a849['status'](_0x2b138d)[_0xe1b4('0x2e')](_0x20f61b);};}exports[_0xe1b4('0x2f')]=function(_0x5dd2cd,_0x733729){var _0x60e161={},_0xc4c603={},_0x253589={'count':0x0,'rows':[]};var _0xca84a9=_[_0xe1b4('0x30')](db[_0xe1b4('0x31')][_0xe1b4('0x32')],function(_0x4ea5c4){return{'name':_0x4ea5c4[_0xe1b4('0x33')],'type':_0x4ea5c4[_0xe1b4('0x34')][_0xe1b4('0x35')]};});_0xc4c603[_0xe1b4('0x36')]=_['map'](_0xca84a9,_0xe1b4('0x2d'));_0xc4c603[_0xe1b4('0x37')]=_['keys'](_0x5dd2cd[_0xe1b4('0x37')]);_0xc4c603[_0xe1b4('0x38')]=_[_0xe1b4('0x39')](_0xc4c603[_0xe1b4('0x36')],_0xc4c603[_0xe1b4('0x37')]);_0x60e161[_0xe1b4('0x3a')]=_[_0xe1b4('0x39')](_0xc4c603[_0xe1b4('0x36')],qs[_0xe1b4('0x3b')](_0x5dd2cd[_0xe1b4('0x37')][_0xe1b4('0x3b')]));_0x60e161[_0xe1b4('0x3a')]=_0x60e161['attributes'][_0xe1b4('0x3c')]?_0x60e161[_0xe1b4('0x3a')]:_0xc4c603[_0xe1b4('0x36')];if(!_0x5dd2cd[_0xe1b4('0x37')][_0xe1b4('0x3d')](_0xe1b4('0x3e'))){_0x60e161[_0xe1b4('0x21')]=qs[_0xe1b4('0x21')](_0x5dd2cd[_0xe1b4('0x37')]['limit']);_0x60e161[_0xe1b4('0x20')]=qs[_0xe1b4('0x20')](_0x5dd2cd['query'][_0xe1b4('0x20')]);}_0x60e161[_0xe1b4('0x3f')]=qs[_0xe1b4('0x40')](_0x5dd2cd['query'][_0xe1b4('0x40')]);_0x60e161['where']=qs[_0xe1b4('0x38')](_[_0xe1b4('0x41')](_0x5dd2cd[_0xe1b4('0x37')],_0xc4c603['filters']),_0xca84a9);if(_0x5dd2cd[_0xe1b4('0x37')][_0xe1b4('0x42')]){_0x60e161['where']=_[_0xe1b4('0x43')](_0x60e161[_0xe1b4('0x44')],{'$or':_[_0xe1b4('0x30')](_0xca84a9,function(_0x47358a){if(_0x47358a[_0xe1b4('0x34')]!==_0xe1b4('0x45')){var _0x28ecd5={};_0x28ecd5[_0x47358a[_0xe1b4('0x2d')]]={'$like':'%'+_0x5dd2cd[_0xe1b4('0x37')][_0xe1b4('0x42')]+'%'};return _0x28ecd5;}})});}_0x60e161=_['merge']({},_0x60e161,_0x5dd2cd[_0xe1b4('0x46')]);var _0x14b057={'where':_0x60e161[_0xe1b4('0x44')]};return db[_0xe1b4('0x31')][_0xe1b4('0x1f')](_0x14b057)[_0xe1b4('0x27')](function(_0x410297){_0x253589[_0xe1b4('0x1f')]=_0x410297;if(_0x5dd2cd[_0xe1b4('0x37')][_0xe1b4('0x47')]){_0x60e161[_0xe1b4('0x48')]=[{'all':!![]}];}return db[_0xe1b4('0x31')][_0xe1b4('0x49')](_0x60e161);})['then'](function(_0x20e587){_0x253589['rows']=_0x20e587;return _0x253589;})['then'](respondWithFilteredResult(_0x733729,_0x60e161))['catch'](handleError(_0x733729,null));};exports[_0xe1b4('0x4a')]=function(_0x4b82c3,_0x3bf1c9){var _0x4ac065={'raw':![],'where':{'id':_0x4b82c3[_0xe1b4('0x4b')]['id']}},_0x5e28c5={};_0x5e28c5[_0xe1b4('0x36')]=_[_0xe1b4('0x4c')](db[_0xe1b4('0x31')][_0xe1b4('0x32')]);_0x5e28c5[_0xe1b4('0x37')]=_['keys'](_0x4b82c3[_0xe1b4('0x37')]);_0x5e28c5[_0xe1b4('0x4d')]=_[_0xe1b4('0x39')](_0x5e28c5['model'],_0x5e28c5['query']);_0x4ac065['attributes']=_[_0xe1b4('0x39')](_0x5e28c5[_0xe1b4('0x36')],qs['fields'](_0x4b82c3[_0xe1b4('0x37')][_0xe1b4('0x3b')]));_0x4ac065[_0xe1b4('0x3a')]=_0x4ac065[_0xe1b4('0x3a')][_0xe1b4('0x3c')]?_0x4ac065[_0xe1b4('0x3a')]:_0x5e28c5['model'];if(_0x4b82c3[_0xe1b4('0x37')][_0xe1b4('0x47')]){_0x4ac065[_0xe1b4('0x48')]=[{'all':!![]}];}_0x4ac065=_[_0xe1b4('0x43')]({},_0x4ac065,_0x4b82c3[_0xe1b4('0x46')]);return db[_0xe1b4('0x31')][_0xe1b4('0x4e')](_0x4ac065)[_0xe1b4('0x27')](handleEntityNotFound(_0x3bf1c9,null))[_0xe1b4('0x27')](respondWithResult(_0x3bf1c9,null))[_0xe1b4('0x4f')](handleError(_0x3bf1c9,null));};exports[_0xe1b4('0x28')]=function(_0x3cf6f9,_0x297727){return db[_0xe1b4('0x31')][_0xe1b4('0x4e')]({'where':{'id':_0x3cf6f9[_0xe1b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x297727,null))[_0xe1b4('0x27')](removeEntity(_0x297727,null))[_0xe1b4('0x4f')](handleError(_0x297727,null));};exports[_0xe1b4('0x50')]=function(_0x33cae9,_0x2bfafc){return db[_0xe1b4('0x31')]['describe']()['then'](respondWithResult(_0x2bfafc,null))[_0xe1b4('0x4f')](handleError(_0x2bfafc,null));};exports[_0xe1b4('0x51')]=function(_0x452af3,_0x515c0f){var _0xd4a91d;return db['sequelize'][_0xe1b4('0x52')](function(_0x73cf6f){return db[_0xe1b4('0x31')][_0xe1b4('0x51')](_0x452af3[_0xe1b4('0x53')],{'transaction':_0x73cf6f})[_0xe1b4('0x27')](function(_0x52247a){_0xd4a91d=_0x52247a[_0xe1b4('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xe1b4('0x4e')]({'where':{'id':_0xd4a91d['VoiceExtensionId']},'raw':!![]})['then'](function(_0x1ca0b7){return createVoicePrefixExtensions(_0xd4a91d,_0x1ca0b7,_0x73cf6f);});});})['then'](function(){var _0x2507ea=_0x452af3[_0xe1b4('0x54')]['get']({'plain':!![]});if(!_0x2507ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2507ea[_0xe1b4('0x55')]==='user'){var _0x3e0c99=_0xd4a91d;return db[_0xe1b4('0x56')][_0xe1b4('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x2507ea['userProfileId']},'raw':!![]})[_0xe1b4('0x27')](function(_0x2313bd){if(_0x2313bd&&_0x2313bd[_0xe1b4('0x57')]===0x0){return db[_0xe1b4('0x58')][_0xe1b4('0x51')]({'name':_0x3e0c99[_0xe1b4('0x2d')],'resourceId':_0x3e0c99['id'],'type':_0x2313bd[_0xe1b4('0x2d')],'sectionId':_0x2313bd['id']},{})['then'](function(){return _0xd4a91d;});}else{return _0xd4a91d;}})['catch'](function(_0x12c959){logger['error'](_0xe1b4('0x59'),_0x12c959);throw _0x12c959;});}return _0xd4a91d;})['then'](respondWithResult(_0x515c0f,null))[_0xe1b4('0x4f')](handleError(_0x515c0f,null));};function Extension(_0x465016,_0x4b4671,_0x3bdd2a,_0x245ccb){this[_0xe1b4('0x5a')]=_0xe1b4('0x5b');this[_0xe1b4('0x5c')]=_0x465016;this[_0xe1b4('0x5d')]=_0x3bdd2a;this['type']=_0xe1b4('0x5e');this[_0xe1b4('0x5f')]=_0xe1b4('0x60');this[_0xe1b4('0x61')]=_0x4b4671;this['appdata']=_0x245ccb;}function createVoicePrefixExtensions(_0x2a109b,_0x231556,_0x3bf75e){return new BPromise(function(_0x3b8f49,_0x1797ba){var _0x30a4aa=new Extension(formatPrefixName(_0x2a109b['prefix']),0x1,_0xe1b4('0x62'),_0xe1b4('0x63'));_0x30a4aa['VoicePrefixId']=_0x2a109b['id'];return db[_0xe1b4('0x64')][_0xe1b4('0x51')](_0x30a4aa,{'transaction':_0x3bf75e})[_0xe1b4('0x27')](function(_0x33e6d5){var _0x549747=_0x33e6d5[_0xe1b4('0x29')]({'plain':!![]});var _0x1e3c9f=_[_0xe1b4('0x30')](addVoicePrefixExtensions(_0x2a109b,_0x231556),function(_0x32ea1d){_0x32ea1d[_0xe1b4('0x65')]=_0x549747['id'];_0x32ea1d['VoicePrefixId']=_0x2a109b['id'];return _0x32ea1d;});return db[_0xe1b4('0x64')]['bulkCreate'](_0x1e3c9f,{'transaction':_0x3bf75e})[_0xe1b4('0x27')](function(_0x35d0df){if(!_0x35d0df){return _0x1797ba('Extensions\x20creation\x20failed');}else{return _0x3b8f49(_0x35d0df);}})[_0xe1b4('0x4f')](function(_0x395937){return _0x1797ba(_0x395937);});});;});};function addVoicePrefixExtensions(_0x371323,_0x241fa7){var _0x2e66ad=[];var _0xd12ce3=formatPrefixName(_0x371323[_0xe1b4('0x66')]);_0x2e66ad[_0xe1b4('0x67')](new Extension(_0xd12ce3,0x2,_0xe1b4('0x68'),_0xe1b4('0x69')+_0x371323[_0xe1b4('0x2d')]));if(_0x371323[_0xe1b4('0x6a')]){_0x2e66ad['push'](new Extension(_0xd12ce3,0x3,_0xe1b4('0x68'),'PREFIX-CALLERIDALL='+_0x371323[_0xe1b4('0x6a')]));}else{_0x2e66ad['push'](new Extension(_0xd12ce3,0x3,_0xe1b4('0x62'),'No\x20callerid\x20available'));}_0x2e66ad[_0xe1b4('0x67')](new Extension(_0xd12ce3,0x4,'goto',_0x241fa7['context']+','+_0xe1b4('0x6b')+(0x8+_0x371323[_0xe1b4('0x2d')][_0xe1b4('0x3c')])+'}'+','+0x1));return _0x2e66ad;}function formatPrefixName(_0x375966){var _0x58d0ef='_';for(var _0x117178=0x0;_0x117178<_0x375966[_0xe1b4('0x3c')];_0x117178++){if(_0x375966[_0xe1b4('0x6c')](_0x117178)=='-'){_0x58d0ef+=_0x375966['charAt'](_0x117178);}else{_0x58d0ef+='['+_0x375966[_0xe1b4('0x6c')](_0x117178)+']';}}_0x58d0ef+='.';return _0x58d0ef;}exports[_0xe1b4('0x26')]=function(_0x19a8fd,_0x3fca54,_0x4af51d){var _0x373564=_0x19a8fd[_0xe1b4('0x53')];_0x373564[_0xe1b4('0x66')]='system-'+_0x373564[_0xe1b4('0x2d')]+'-';return db[_0xe1b4('0x6d')][_0xe1b4('0x52')](function(_0xdea5b2){return db[_0xe1b4('0x31')][_0xe1b4('0x26')](_0x373564,{'where':{'id':_0x373564['id']},'transaction':_0xdea5b2})[_0xe1b4('0x27')](function(){return db[_0xe1b4('0x64')][_0xe1b4('0x28')]({'where':{'VoicePrefixId':_0x373564['id']},'transaction':_0xdea5b2})[_0xe1b4('0x27')](function(){return db[_0xe1b4('0x64')][_0xe1b4('0x4e')]({'where':{'id':_0x373564[_0xe1b4('0x65')]},'raw':!![]})[_0xe1b4('0x27')](function(_0x49bd76){return createVoicePrefixExtensions(_0x373564,_0x49bd76,_0xdea5b2);});});});})[_0xe1b4('0x27')](function(){return db[_0xe1b4('0x31')]['findById'](_0x373564['id']);})[_0xe1b4('0x27')](respondWithResult(_0x3fca54,null))[_0xe1b4('0x4f')](handleError(_0x3fca54,null));};exports['addAgents']=function(_0x531067,_0x507544,_0xade865){return db['VoicePrefix'][_0xe1b4('0x4e')]({'where':{'id':_0x531067['params']['id']}})[_0xe1b4('0x27')](handleEntityNotFound(_0x507544,null))[_0xe1b4('0x27')](function(_0x51d318){if(_0x51d318){return _0x51d318['addAgents'](_0x531067['body'][_0xe1b4('0x6e')],_[_0xe1b4('0x6f')](_0x531067[_0xe1b4('0x53')],['ids','id'])||{})[_0xe1b4('0x70')](function(_0x1b1471){for(var _0x3cdfd2=0x0;_0x3cdfd2<_0x531067['body'][_0xe1b4('0x6e')][_0xe1b4('0x3c')];_0x3cdfd2+=0x1){socket[_0xe1b4('0x71')]('userVoicePrefix:save',{'UserId':_0x531067[_0xe1b4('0x53')]['ids'][_0x3cdfd2],'VoicePrefixId':_0x531067[_0xe1b4('0x4b')]['id']});}return _0x1b1471;});}})['then'](respondWithResult(_0x507544,null))['catch'](handleError(_0x507544,null));};exports['removeAgents']=function(_0x4e4f40,_0x2be068,_0x30645c){return db[_0xe1b4('0x31')]['find']({'where':{'id':_0x4e4f40[_0xe1b4('0x4b')]['id']}})[_0xe1b4('0x27')](handleEntityNotFound(_0x2be068,null))['then'](function(_0x32f3e7){if(_0x32f3e7){return _0x32f3e7[_0xe1b4('0x72')](_0x4e4f40[_0xe1b4('0x37')][_0xe1b4('0x6e')])[_0xe1b4('0x27')](function(){if(_[_0xe1b4('0x73')](_0x4e4f40['query'][_0xe1b4('0x6e')])){for(var _0x4d8624=0x0;_0x4d8624<_0x4e4f40[_0xe1b4('0x37')][_0xe1b4('0x6e')][_0xe1b4('0x3c')];_0x4d8624+=0x1){socket[_0xe1b4('0x71')](_0xe1b4('0x74'),{'UserId':Number(_0x4e4f40[_0xe1b4('0x37')]['ids'][_0x4d8624]),'VoicePrefixId':Number(_0x4e4f40[_0xe1b4('0x4b')]['id'])});}}else{socket[_0xe1b4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x4e4f40['query'][_0xe1b4('0x6e')]),'VoicePrefixId':Number(_0x4e4f40[_0xe1b4('0x4b')]['id'])});}});}})[_0xe1b4('0x27')](respondWithStatusCode(_0x2be068,null))[_0xe1b4('0x4f')](handleError(_0x2be068,null));};exports[_0xe1b4('0x75')]=function(_0x3c89a7,_0x47f404,_0x11b5d4){var _0x2063e0={};var _0x2e89bb={};var _0x4b2d99;var _0x2c5caf;return db[_0xe1b4('0x31')][_0xe1b4('0x76')]({'where':{'id':_0x3c89a7[_0xe1b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47f404,null))['then'](function(_0x166034){if(_0x166034){_0x4b2d99=_0x166034;_0x2e89bb[_0xe1b4('0x36')]=_[_0xe1b4('0x4c')](db[_0xe1b4('0x77')][_0xe1b4('0x32')]);_0x2e89bb[_0xe1b4('0x37')]=_['keys'](_0x3c89a7[_0xe1b4('0x37')]);_0x2e89bb['filters']=_['intersection'](_0x2e89bb['model'],_0x2e89bb[_0xe1b4('0x37')]);_0x2063e0[_0xe1b4('0x3a')]=_['intersection'](_0x2e89bb['model'],qs[_0xe1b4('0x3b')](_0x3c89a7[_0xe1b4('0x37')][_0xe1b4('0x3b')]));_0x2063e0['attributes']=_0x2063e0[_0xe1b4('0x3a')][_0xe1b4('0x3c')]?_0x2063e0[_0xe1b4('0x3a')]:_0x2e89bb[_0xe1b4('0x36')];_0x2063e0['order']=qs['sort'](_0x3c89a7[_0xe1b4('0x37')][_0xe1b4('0x40')]);_0x2063e0[_0xe1b4('0x44')]=qs['filters'](_['pick'](_0x3c89a7[_0xe1b4('0x37')],_0x2e89bb['filters']));if(_0x3c89a7['query'][_0xe1b4('0x42')]){_0x2063e0[_0xe1b4('0x44')]=_[_0xe1b4('0x43')](_0x2063e0['where'],{'$or':_['map'](_0x2063e0[_0xe1b4('0x3a')],function(_0x50e9ff){var _0x206329={};_0x206329[_0x50e9ff]={'$like':'%'+_0x3c89a7['query']['filter']+'%'};return _0x206329;})});}_0x2063e0=_[_0xe1b4('0x43')]({},_0x2063e0,_0x3c89a7[_0xe1b4('0x46')]);return _0x4b2d99[_0xe1b4('0x75')](_0x2063e0);}})[_0xe1b4('0x27')](function(_0x1a33f0){if(_0x1a33f0){_0x2c5caf=_0x1a33f0[_0xe1b4('0x3c')];if(!_0x3c89a7[_0xe1b4('0x37')]['hasOwnProperty']('nolimit')){_0x2063e0['limit']=qs[_0xe1b4('0x21')](_0x3c89a7[_0xe1b4('0x37')][_0xe1b4('0x21')]);_0x2063e0[_0xe1b4('0x20')]=qs['offset'](_0x3c89a7['query'][_0xe1b4('0x20')]);}return _0x4b2d99[_0xe1b4('0x75')](_0x2063e0);}})[_0xe1b4('0x27')](function(_0x599637){if(_0x599637){return _0x599637?{'count':_0x2c5caf,'rows':_0x599637}:null;}})[_0xe1b4('0x27')](respondWithResult(_0x47f404,null))[_0xe1b4('0x4f')](handleError(_0x47f404,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a081b90..820e0a1 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(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x34e8,0x12c));var _0x834e=function(_0x14e439,_0x11b5a8){_0x14e439=_0x14e439-0x0;var _0x3191db=_0x34e8[_0x14e439];return _0x3191db;};'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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x5ec8e4,_0x1f76a1){var _0x5552ca=function(_0xa00d5a){while(--_0xa00d5a){_0x5ec8e4['push'](_0x5ec8e4['shift']());}};_0x5552ca(++_0x1f76a1);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 48aafc4..1186cef 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 _0x03e7=['moment','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','util','../../config/logger'];(function(_0x45dbd4,_0x1fc6e8){var _0x7912fb=function(_0x2083a2){while(--_0x2083a2){_0x45dbd4['push'](_0x45dbd4['shift']());}};_0x7912fb(++_0x1fc6e8);}(_0x03e7,0xda));var _0x703e=function(_0x17842d,_0x3f0bc8){_0x17842d=_0x17842d-0x0;var _0x3c309e=_0x03e7[_0x17842d];return _0x3c309e;};'use strict';var _=require('lodash');var util=require(_0x703e('0x0'));var logger=require(_0x703e('0x1'))('api');var moment=require(_0x703e('0x2'));var BPromise=require('bluebird');var rp=require(_0x703e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x703e('0x4'));var config=require(_0x703e('0x5'));var attributes=require(_0x703e('0x6'));module[_0x703e('0x7')]=function(_0x190e49,_0x5687ed){return _0x190e49[_0x703e('0x8')]('VoicePrefix',attributes,{'tableName':_0x703e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x761d=['./voicePrefix.attributes','exports','define','voice_prefixes','util','../../config/logger','path','rimraf','../../config/environment'];(function(_0x321242,_0x15d7da){var _0x1b972b=function(_0x2d34c4){while(--_0x2d34c4){_0x321242['push'](_0x321242['shift']());}};_0x1b972b(++_0x15d7da);}(_0x761d,0x100));var _0xd761=function(_0x4f8c73,_0x226905){_0x4f8c73=_0x4f8c73-0x0;var _0xc3ae2f=_0x761d[_0x4f8c73];return _0xc3ae2f;};'use strict';var _=require('lodash');var util=require(_0xd761('0x0'));var logger=require(_0xd761('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd761('0x2'));var rimraf=require(_0xd761('0x3'));var config=require(_0xd761('0x4'));var attributes=require(_0xd761('0x5'));module[_0xd761('0x6')]=function(_0x3b7b26,_0x2ee547){return _0x3b7b26[_0xd761('0x7')]('VoicePrefix',attributes,{'tableName':_0xd761('0x8'),'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 b0487cd..d54e453 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 _0xa137=['VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info'];(function(_0x23d9dd,_0x44a574){var _0x47c400=function(_0x3e0503){while(--_0x3e0503){_0x23d9dd['push'](_0x23d9dd['shift']());}};_0x47c400(++_0x44a574);}(_0xa137,0x82));var _0x7a13=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xa137[_0x368fb9];return _0x4892fb;};'use strict';var _=require('lodash');var util=require(_0x7a13('0x0'));var moment=require(_0x7a13('0x1'));var BPromise=require(_0x7a13('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a13('0x3'));var db=require(_0x7a13('0x4'))['db'];var utils=require(_0x7a13('0x5'));var logger=require(_0x7a13('0x6'))(_0x7a13('0x7'));var config=require('../../config/environment');var jayson=require(_0x7a13('0x8'));var client=jayson[_0x7a13('0x9')][_0x7a13('0xa')]({'port':0x232a});config[_0x7a13('0xb')]=_[_0x7a13('0xc')](config[_0x7a13('0xb')],{'host':_0x7a13('0xd'),'port':0x18eb});var socket=require(_0x7a13('0xe'))(new Redis(config['redis']));require(_0x7a13('0xf'))[_0x7a13('0x10')](socket);function respondWithRpcPromise(_0x325514,_0x305c1b,_0x2be789){return new BPromise(function(_0x27f08f,_0x52f90e){return client[_0x7a13('0x11')](_0x325514,_0x2be789)[_0x7a13('0x12')](function(_0x3d7a04){logger[_0x7a13('0x13')](_0x7a13('0x14'),_0x305c1b,_0x7a13('0x15'));logger[_0x7a13('0x16')](_0x7a13('0x17'),_0x305c1b,_0x7a13('0x15'),JSON[_0x7a13('0x18')](_0x3d7a04));if(_0x3d7a04['error']){if(_0x3d7a04[_0x7a13('0x19')][_0x7a13('0x1a')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x305c1b,_0x3d7a04[_0x7a13('0x19')][_0x7a13('0x1b')]);return _0x52f90e(_0x3d7a04[_0x7a13('0x19')][_0x7a13('0x1b')]);}logger['error'](_0x7a13('0x14'),_0x305c1b,_0x3d7a04[_0x7a13('0x19')][_0x7a13('0x1b')]);return _0x27f08f(_0x3d7a04[_0x7a13('0x19')][_0x7a13('0x1b')]);}else{logger[_0x7a13('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x305c1b,'request\x20sent');_0x27f08f(_0x3d7a04[_0x7a13('0x1c')][_0x7a13('0x1b')]);}})[_0x7a13('0x1d')](function(_0xc6901d){logger[_0x7a13('0x19')](_0x7a13('0x14'),_0x305c1b,_0xc6901d);_0x52f90e(_0xc6901d);});});} \ No newline at end of file +var _0x423c=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x444cbb,_0x2d6a39){var _0x232ef9=function(_0x20c97e){while(--_0x20c97e){_0x444cbb['push'](_0x444cbb['shift']());}};_0x232ef9(++_0x2d6a39);}(_0x423c,0xba));var _0xc423=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x423c[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xc423('0x0'));var util=require(_0xc423('0x1'));var moment=require('moment');var BPromise=require(_0xc423('0x2'));var rs=require(_0xc423('0x3'));var fs=require('fs');var Redis=require(_0xc423('0x4'));var db=require(_0xc423('0x5'))['db'];var utils=require(_0xc423('0x6'));var logger=require(_0xc423('0x7'))(_0xc423('0x8'));var config=require(_0xc423('0x9'));var jayson=require(_0xc423('0xa'));var client=jayson[_0xc423('0xb')]['http']({'port':0x232a});config[_0xc423('0xc')]=_[_0xc423('0xd')](config[_0xc423('0xc')],{'host':_0xc423('0xe'),'port':0x18eb});var socket=require(_0xc423('0xf'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xc423('0x10')](socket);function respondWithRpcPromise(_0x165b74,_0x50d9e0,_0x5a3c90){return new BPromise(function(_0x18d802,_0x514ae5){return client['request'](_0x165b74,_0x5a3c90)[_0xc423('0x11')](function(_0x4cd551){logger[_0xc423('0x12')](_0xc423('0x13'),_0x50d9e0,_0xc423('0x14'));logger[_0xc423('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x50d9e0,_0xc423('0x14'),JSON[_0xc423('0x16')](_0x4cd551));if(_0x4cd551['error']){if(_0x4cd551['error'][_0xc423('0x17')]===0x1f4){logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x4cd551[_0xc423('0x18')]['message']);return _0x514ae5(_0x4cd551['error'][_0xc423('0x19')]);}logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x4cd551[_0xc423('0x18')][_0xc423('0x19')]);return _0x18d802(_0x4cd551['error'][_0xc423('0x19')]);}else{logger[_0xc423('0x12')](_0xc423('0x13'),_0x50d9e0,_0xc423('0x14'));_0x18d802(_0x4cd551[_0xc423('0x1a')][_0xc423('0x19')]);}})[_0xc423('0x1b')](function(_0x1962c9){logger[_0xc423('0x18')](_0xc423('0x13'),_0x50d9e0,_0x1962c9);_0x514ae5(_0x1962c9);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9c06317..b297faa 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 _0x64c8=['remove','emit','removeListener','register','length','voicePrefix:'];(function(_0x3fa07c,_0x278d5f){var _0x596037=function(_0x4f4560){while(--_0x4f4560){_0x3fa07c['push'](_0x3fa07c['shift']());}};_0x596037(++_0x278d5f);}(_0x64c8,0x8a));var _0x864c=function(_0x329ddc,_0x43731c){_0x329ddc=_0x329ddc-0x0;var _0x5da533=_0x64c8[_0x329ddc];return _0x5da533;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x864c('0x0'),'update'];function createListener(_0x19edb3,_0x54f998){return function(_0x1d2eac){_0x54f998[_0x864c('0x1')](_0x19edb3,_0x1d2eac);};}function removeListener(_0x25a3f7,_0x162499){return function(){VoicePrefixEvents[_0x864c('0x2')](_0x25a3f7,_0x162499);};}exports[_0x864c('0x3')]=function(_0x1054cf){for(var _0x197a78=0x0,_0x5b7a84=events[_0x864c('0x4')];_0x197a78<_0x5b7a84;_0x197a78++){var _0x6a0a71=events[_0x197a78];var _0x13cc11=createListener(_0x864c('0x5')+_0x6a0a71,_0x1054cf);VoicePrefixEvents['on'](_0x6a0a71,_0x13cc11);}}; \ No newline at end of file +var _0xa984=['removeListener','register','length','./voicePrefix.events','save','update','emit'];(function(_0x3b2bea,_0x4dbba8){var _0x134621=function(_0x1de4a5){while(--_0x1de4a5){_0x3b2bea['push'](_0x3b2bea['shift']());}};_0x134621(++_0x4dbba8);}(_0xa984,0x1f4));var _0x4a98=function(_0x13c315,_0x71739b){_0x13c315=_0x13c315-0x0;var _0x4a3246=_0xa984[_0x13c315];return _0x4a3246;};'use strict';var VoicePrefixEvents=require(_0x4a98('0x0'));var events=[_0x4a98('0x1'),'remove',_0x4a98('0x2')];function createListener(_0x8518db,_0x9b9f0c){return function(_0x4bf38f){_0x9b9f0c[_0x4a98('0x3')](_0x8518db,_0x4bf38f);};}function removeListener(_0x43d963,_0x4f96a5){return function(){VoicePrefixEvents[_0x4a98('0x4')](_0x43d963,_0x4f96a5);};}exports[_0x4a98('0x5')]=function(_0x108d11){for(var _0x195c3=0x0,_0x1027ea=events[_0x4a98('0x6')];_0x195c3<_0x1027ea;_0x195c3++){var _0x19dd66=events[_0x195c3];var _0x15dcfe=createListener('voicePrefix:'+_0x19dd66,_0x108d11);VoicePrefixEvents['on'](_0x19dd66,_0x15dcfe);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index ee85620..618a893 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 _0x964a=['/:id/clone','clone','addLists','addBlackLists','put','destroy','delete','removeTeams','removeAgents','/:id/lists','/:id/blacklists','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','post'];(function(_0x44930f,_0x538d78){var _0x554648=function(_0x32f93f){while(--_0x32f93f){_0x44930f['push'](_0x44930f['shift']());}};_0x554648(++_0x538d78);}(_0x964a,0x72));var _0xa964=function(_0x102469,_0x3af853){_0x102469=_0x102469-0x0;var _0x57cd31=_0x964a[_0x102469];return _0x57cd31;};'use strict';var multer=require(_0xa964('0x0'));var util=require('util');var path=require(_0xa964('0x1'));var timeout=require(_0xa964('0x2'));var express=require(_0xa964('0x3'));var router=express['Router']();var auth=require(_0xa964('0x4'));var interaction=require(_0xa964('0x5'));var config=require(_0xa964('0x6'));var controller=require('./voiceQueue.controller');router[_0xa964('0x7')]('/',auth[_0xa964('0x8')](),controller['index']);router['get'](_0xa964('0x9'),auth['isAuthenticated'](),controller[_0xa964('0xa')]);router[_0xa964('0x7')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0xa964('0xb')]);router[_0xa964('0x7')](_0xa964('0xc'),auth[_0xa964('0x8')](),controller[_0xa964('0xd')]);router[_0xa964('0x7')](_0xa964('0xe'),auth[_0xa964('0x8')](),controller[_0xa964('0xf')]);router['get']('/:id/hopper_black',auth[_0xa964('0x8')](),controller['getHopperBlacks']);router['get'](_0xa964('0x10'),auth[_0xa964('0x8')](),controller[_0xa964('0x11')]);router[_0xa964('0x7')](_0xa964('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa964('0x7')](_0xa964('0x13'),auth[_0xa964('0x8')](),controller[_0xa964('0x14')]);router[_0xa964('0x7')]('/:id/lists',auth[_0xa964('0x8')](),controller['getLists']);router[_0xa964('0x7')]('/:id/blacklists',auth[_0xa964('0x8')](),controller['getBlackLists']);router[_0xa964('0x15')]('/',auth[_0xa964('0x8')](),controller['create']);router[_0xa964('0x15')](_0xa964('0x16'),auth[_0xa964('0x8')](),controller[_0xa964('0x17')]);router[_0xa964('0x15')](_0xa964('0x10'),auth[_0xa964('0x8')](),controller['addTeams']);router[_0xa964('0x15')](_0xa964('0x12'),auth[_0xa964('0x8')](),controller['addAgents']);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0xa964('0x18')]);router[_0xa964('0x15')]('/:id/blacklists',auth[_0xa964('0x8')](),controller[_0xa964('0x19')]);router[_0xa964('0x1a')](_0xa964('0x9'),auth[_0xa964('0x8')](),controller['update']);router['delete']('/:id',auth[_0xa964('0x8')](),controller[_0xa964('0x1b')]);router[_0xa964('0x1c')]('/:id/teams',auth[_0xa964('0x8')](),controller[_0xa964('0x1d')]);router[_0xa964('0x1c')]('/:id/users',auth[_0xa964('0x8')](),controller[_0xa964('0x1e')]);router[_0xa964('0x1c')](_0xa964('0x1f'),auth[_0xa964('0x8')](),controller['removeLists']);router[_0xa964('0x1c')](_0xa964('0x20'),auth[_0xa964('0x8')](),controller['removeBlackLists']);module[_0xa964('0x21')]=router; \ No newline at end of file +var _0x140d=['/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','/:id/users','/:id/members','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','update','delete','removeTeams'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x140d,0x134));var _0xd140=function(_0x5e9cac,_0x6a4bc){_0x5e9cac=_0x5e9cac-0x0;var _0x5e5019=_0x140d[_0x5e9cac];return _0x5e5019;};'use strict';var multer=require(_0xd140('0x0'));var util=require(_0xd140('0x1'));var path=require(_0xd140('0x2'));var timeout=require('connect-timeout');var express=require(_0xd140('0x3'));var router=express[_0xd140('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd140('0x5'));var config=require(_0xd140('0x6'));var controller=require(_0xd140('0x7'));router[_0xd140('0x8')]('/',auth['isAuthenticated'](),controller[_0xd140('0x9')]);router[_0xd140('0x8')](_0xd140('0xa'),auth['isAuthenticated'](),controller[_0xd140('0xb')]);router[_0xd140('0x8')](_0xd140('0xc'),auth[_0xd140('0xd')](),controller[_0xd140('0xe')]);router['get'](_0xd140('0xf'),auth[_0xd140('0xd')](),controller[_0xd140('0x10')]);router[_0xd140('0x8')]('/:id/hopper_finals',auth[_0xd140('0xd')](),controller[_0xd140('0x11')]);router[_0xd140('0x8')](_0xd140('0x12'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xd140('0x8')](_0xd140('0x13'),auth['isAuthenticated'](),controller[_0xd140('0x14')]);router['get'](_0xd140('0x15'),auth[_0xd140('0xd')](),controller['getAgents']);router[_0xd140('0x8')](_0xd140('0x16'),auth[_0xd140('0xd')](),controller['getMembers']);router[_0xd140('0x8')]('/:id/lists',auth[_0xd140('0xd')](),controller['getLists']);router[_0xd140('0x8')](_0xd140('0x17'),auth[_0xd140('0xd')](),controller[_0xd140('0x18')]);router['post']('/',auth[_0xd140('0xd')](),controller[_0xd140('0x19')]);router[_0xd140('0x1a')](_0xd140('0x1b'),auth['isAuthenticated'](),controller[_0xd140('0x1c')]);router[_0xd140('0x1a')](_0xd140('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd140('0x1a')](_0xd140('0x15'),auth[_0xd140('0xd')](),controller['addAgents']);router[_0xd140('0x1a')]('/:id/lists',auth[_0xd140('0xd')](),controller[_0xd140('0x1d')]);router[_0xd140('0x1a')](_0xd140('0x17'),auth['isAuthenticated'](),controller[_0xd140('0x1e')]);router['put'](_0xd140('0xa'),auth[_0xd140('0xd')](),controller[_0xd140('0x1f')]);router[_0xd140('0x20')](_0xd140('0xa'),auth[_0xd140('0xd')](),controller['destroy']);router[_0xd140('0x20')]('/:id/teams',auth[_0xd140('0xd')](),controller[_0xd140('0x21')]);router[_0xd140('0x20')](_0xd140('0x15'),auth[_0xd140('0xd')](),controller['removeAgents']);router[_0xd140('0x20')](_0xd140('0x22'),auth[_0xd140('0xd')](),controller[_0xd140('0x23')]);router[_0xd140('0x20')]('/:id/blacklists',auth[_0xd140('0xd')](),controller[_0xd140('0x24')]);module[_0xd140('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 255b260..bc2c440 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(_0x2c4ca7,_0x5abe87){var _0xc82d75=function(_0x27780f){while(--_0x27780f){_0x2c4ca7['push'](_0x2c4ca7['shift']());}};_0xc82d75(++_0x5abe87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_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 1a3395a..b25feb9 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 _0x1b20=['findAll','rows','catch','show','params','keys','filtears','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','CmHopper','rawAttributes','pick','VoiceQueueId','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','Agents','online','voicePause','flatMap','forEach','sequelize','transaction','each','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','SIP/%s','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','QueryTypes','SELECT','TeamId','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','upsert','penalty','all','isArray','emit','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','VoiceQueueId\x20=\x20?','onlyIfOpen','into','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','CmList','addBlackLists','from','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','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','../../config/utils','../../config/license/util','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','find','name','UserProfileResource','error','stack','index','VoiceQueue','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x1f166b,_0x51a201){var _0x3cc857=function(_0x2ed0ca){while(--_0x2ed0ca){_0x1f166b['push'](_0x1f166b['shift']());}};_0x3cc857(++_0x51a201);}(_0x1b20,0x66));var _0x01b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b20[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x01b2('0x0'));var rimraf=require(_0x01b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01b2('0x2'));var moment=require(_0x01b2('0x3'));var BPromise=require(_0x01b2('0x4'));var Mustache=require(_0x01b2('0x5'));var util=require(_0x01b2('0x6'));var path=require(_0x01b2('0x7'));var sox=require(_0x01b2('0x8'));var csv=require(_0x01b2('0x9'));var ejs=require(_0x01b2('0xa'));var fs=require('fs');var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];config[_0x01b2('0x19')]=_[_0x01b2('0x1a')](config[_0x01b2('0x19')],{'host':_0x01b2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b2('0x19')]));require(_0x01b2('0x1c'))[_0x01b2('0x1d')](socket);function respondWithStatusCode(_0x1626ba,_0x3bb071){_0x3bb071=_0x3bb071||0xcc;return function(_0x5a36de){if(_0x5a36de){return _0x1626ba[_0x01b2('0x1e')](_0x3bb071);}return _0x1626ba[_0x01b2('0x1f')](_0x3bb071)[_0x01b2('0x20')]();};}function respondWithResult(_0x3f68a8,_0x50eb39){_0x50eb39=_0x50eb39||0xc8;return function(_0x523b80){if(_0x523b80){return _0x3f68a8[_0x01b2('0x1f')](_0x50eb39)[_0x01b2('0x21')](_0x523b80);}};}function respondWithFilteredResult(_0x588dbe,_0x1eafc4){return function(_0x444236){if(_0x444236){var _0x27a0bc=_0x444236[_0x01b2('0x22')],_0x5986f5=_0x1eafc4[_0x01b2('0x23')],_0x25c55f=_0x1eafc4[_0x01b2('0x23')]+_0x1eafc4['limit'],_0x9f182b;if(_0x25c55f>=_0x27a0bc){_0x25c55f=_0x27a0bc;_0x9f182b=0xc8;}else{_0x9f182b=0xce;}_0x588dbe[_0x01b2('0x1f')](_0x9f182b);return _0x588dbe['set'](_0x01b2('0x24'),_0x5986f5+'-'+_0x25c55f+'/'+_0x27a0bc)['json'](_0x444236);}return null;};}function patchUpdates(_0x400f80){return function(_0x266264){try{jsonpatch[_0x01b2('0x25')](_0x266264,_0x400f80,!![]);}catch(_0x533e43){return BPromise[_0x01b2('0x26')](_0x533e43);}return _0x266264[_0x01b2('0x27')]();};}function saveUpdates(_0xc3027,_0x1d6f5e){return function(_0x4ce810){if(_0x4ce810){return _0x4ce810['update'](_0xc3027)[_0x01b2('0x28')](function(_0x539db1){return _0x539db1;});}return null;};}function removeEntity(_0x54e866,_0x343171){return function(_0x19a3c8){if(_0x19a3c8){return _0x19a3c8[_0x01b2('0x29')]()[_0x01b2('0x28')](function(){var _0x2e32c1=_0x19a3c8[_0x01b2('0x2a')]({'plain':!![]});var _0x4920f7=[{'name':_0x01b2('0x2b'),'value':_0x01b2('0x2c'),'ignore':![]},{'name':_0x01b2('0x2d'),'value':_0x01b2('0x2e'),'ignore':![]}];var _0x54543b=_(_0x4920f7)[_0x01b2('0x2f')]('ignore')[_0x01b2('0x30')](_0x01b2('0x31'))['value']();if(_[_0x01b2('0x32')](_0x54543b,_0x2e32c1['type'])){return;}var _0x487c49=_[_0x01b2('0x33')](_0x4920f7,[_0x01b2('0x31'),_0x2e32c1['type']])[_0x01b2('0x34')];return db[_0x01b2('0x35')][_0x01b2('0x29')]({'where':{'type':_0x487c49,'resourceId':_0x2e32c1['id']}})[_0x01b2('0x28')](function(){return _0x19a3c8;});})[_0x01b2('0x28')](function(){_0x54e866[_0x01b2('0x1f')](0xcc)[_0x01b2('0x20')]();});}};}function handleEntityNotFound(_0x3169f5,_0x27eeb3){return function(_0x11d8e5){if(!_0x11d8e5){_0x3169f5[_0x01b2('0x1e')](0x194);}return _0x11d8e5;};}function handleError(_0x5e6981,_0x17d804){_0x17d804=_0x17d804||0x1f4;return function(_0x56e30b){logger[_0x01b2('0x36')](_0x56e30b[_0x01b2('0x37')]);if(_0x56e30b[_0x01b2('0x34')]){delete _0x56e30b[_0x01b2('0x34')];}_0x5e6981['status'](_0x17d804)['send'](_0x56e30b);};}exports[_0x01b2('0x38')]=function(_0x589c73,_0x50ec09){var _0x2c2d51={},_0x176849={},_0x21405c={'count':0x0,'rows':[]};var _0x3b1307=_['map'](db[_0x01b2('0x39')]['rawAttributes'],function(_0xcd6801){return{'name':_0xcd6801['fieldName'],'type':_0xcd6801['type']['key']};});_0x176849[_0x01b2('0x3a')]=_[_0x01b2('0x30')](_0x3b1307,_0x01b2('0x34'));_0x176849[_0x01b2('0x3b')]=_['keys'](_0x589c73[_0x01b2('0x3b')]);_0x176849[_0x01b2('0x3c')]=_['intersection'](_0x176849[_0x01b2('0x3a')],_0x176849[_0x01b2('0x3b')]);_0x2c2d51[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x176849[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x589c73['query'][_0x01b2('0x3f')]));_0x2c2d51[_0x01b2('0x3d')]=_0x2c2d51['attributes']['length']?_0x2c2d51[_0x01b2('0x3d')]:_0x176849[_0x01b2('0x3a')];if(!_0x589c73[_0x01b2('0x3b')][_0x01b2('0x40')](_0x01b2('0x41'))){_0x2c2d51[_0x01b2('0x42')]=qs['limit'](_0x589c73['query'][_0x01b2('0x42')]);_0x2c2d51['offset']=qs[_0x01b2('0x23')](_0x589c73[_0x01b2('0x3b')][_0x01b2('0x23')]);}_0x2c2d51[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x589c73['query'][_0x01b2('0x44')]);_0x2c2d51[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_['pick'](_0x589c73[_0x01b2('0x3b')],_0x176849[_0x01b2('0x3c')]),_0x3b1307);if(_0x589c73[_0x01b2('0x3b')]['filter']){_0x2c2d51[_0x01b2('0x45')]=_['merge'](_0x2c2d51[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x3b1307,function(_0x574f35){if(_0x574f35[_0x01b2('0x46')]!==_0x01b2('0x47')){var _0x4da4aa={};_0x4da4aa[_0x574f35[_0x01b2('0x34')]]={'$like':'%'+_0x589c73[_0x01b2('0x3b')][_0x01b2('0x2f')]+'%'};return _0x4da4aa;}})});}_0x2c2d51=_[_0x01b2('0x48')]({},_0x2c2d51,_0x589c73[_0x01b2('0x49')]);var _0x4aa898={'where':_0x2c2d51[_0x01b2('0x45')]};return db[_0x01b2('0x39')][_0x01b2('0x22')](_0x4aa898)['then'](function(_0x2a422a){_0x21405c[_0x01b2('0x22')]=_0x2a422a;if(_0x589c73[_0x01b2('0x3b')][_0x01b2('0x4a')]){_0x2c2d51[_0x01b2('0x4b')]=[{'all':!![]}];}return db[_0x01b2('0x39')][_0x01b2('0x4c')](_0x2c2d51);})[_0x01b2('0x28')](function(_0x57ae9b){_0x21405c[_0x01b2('0x4d')]=_0x57ae9b;return _0x21405c;})[_0x01b2('0x28')](respondWithFilteredResult(_0x50ec09,_0x2c2d51))[_0x01b2('0x4e')](handleError(_0x50ec09,null));};exports[_0x01b2('0x4f')]=function(_0xf36d42,_0x3469b3){var _0xa33bd0={'raw':![],'where':{'id':_0xf36d42[_0x01b2('0x50')]['id']}},_0x5f3d5b={};_0x5f3d5b[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0x39')]['rawAttributes']);_0x5f3d5b['query']=_[_0x01b2('0x51')](_0xf36d42[_0x01b2('0x3b')]);_0x5f3d5b[_0x01b2('0x52')]=_['intersection'](_0x5f3d5b[_0x01b2('0x3a')],_0x5f3d5b[_0x01b2('0x3b')]);_0xa33bd0[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x5f3d5b[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0xf36d42['query'][_0x01b2('0x3f')]));_0xa33bd0['attributes']=_0xa33bd0[_0x01b2('0x3d')]['length']?_0xa33bd0['attributes']:_0x5f3d5b[_0x01b2('0x3a')];if(_0xf36d42[_0x01b2('0x3b')][_0x01b2('0x4a')]){_0xa33bd0[_0x01b2('0x4b')]=[{'all':!![]}];}_0xa33bd0=_[_0x01b2('0x48')]({},_0xa33bd0,_0xf36d42['options']);return db['VoiceQueue'][_0x01b2('0x33')](_0xa33bd0)[_0x01b2('0x28')](handleEntityNotFound(_0x3469b3,null))[_0x01b2('0x28')](respondWithResult(_0x3469b3,null))[_0x01b2('0x4e')](handleError(_0x3469b3,null));};exports[_0x01b2('0x53')]=function(_0x87ddcd,_0x503784){return db[_0x01b2('0x39')][_0x01b2('0x53')](_0x87ddcd[_0x01b2('0x54')],{})[_0x01b2('0x28')](function(_0x24405e){var _0x446c76=_0x87ddcd[_0x01b2('0x55')]['get']({'plain':!![]});if(!_0x446c76)throw new Error(_0x01b2('0x56'));if(_0x446c76[_0x01b2('0x57')]===_0x01b2('0x55')){var _0x5f7a12=_0x24405e[_0x01b2('0x2a')]({'plain':!![]});var _0x1881e8=[{'name':'VoiceQueues','value':_0x01b2('0x2c')},{'name':_0x01b2('0x2d'),'value':_0x01b2('0x2e')}];var _0x38e410=_[_0x01b2('0x33')](_0x1881e8,[_0x01b2('0x31'),_0x5f7a12[_0x01b2('0x46')]])[_0x01b2('0x34')];return db[_0x01b2('0x58')][_0x01b2('0x33')]({'where':{'name':_0x38e410,'userProfileId':_0x446c76[_0x01b2('0x59')]},'raw':!![]})[_0x01b2('0x28')](function(_0x11a8a0){if(_0x11a8a0&&_0x11a8a0[_0x01b2('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x5f7a12['name'],'resourceId':_0x5f7a12['id'],'type':_0x11a8a0['name'],'sectionId':_0x11a8a0['id']},{})[_0x01b2('0x28')](function(){return _0x24405e;});}else{return _0x24405e;}})[_0x01b2('0x4e')](function(_0x9daac7){logger['error'](_0x01b2('0x5b'),_0x9daac7);throw _0x9daac7;});}return _0x24405e;})['then'](respondWithResult(_0x503784,0xc9))[_0x01b2('0x4e')](handleError(_0x503784,null));};exports[_0x01b2('0x5c')]=function(_0x1f4de8,_0x3eb974){var _0x1dc49e={'where':{'id':_0x1f4de8[_0x01b2('0x50')]['id']}},_0x5e9f8e={};_0x5e9f8e['model']=_[_0x01b2('0x51')](db[_0x01b2('0x39')]['rawAttributes']);_0x1dc49e[_0x01b2('0x3d')]=_['intersection'](_0x5e9f8e[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x1f4de8[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x1dc49e[_0x01b2('0x3d')]=_0x1dc49e[_0x01b2('0x3d')][_0x01b2('0x5d')]?_0x1dc49e[_0x01b2('0x3d')]:_0x5e9f8e[_0x01b2('0x3a')];if(_0x1f4de8[_0x01b2('0x3b')]['includeAll']){_0x1dc49e[_0x01b2('0x4b')]=[{'all':!![]}];}_0x1dc49e=_['merge']({},_0x1dc49e,_0x1f4de8[_0x01b2('0x49')]);return db[_0x01b2('0x39')][_0x01b2('0x33')](_0x1dc49e)['then'](handleEntityNotFound(_0x3eb974,null))[_0x01b2('0x28')](function(_0x5dd737){if(_0x5dd737){var _0x4a0f3d=_0x5dd737[_0x01b2('0x2a')]({'plain':!![]});_0x4a0f3d=qs[_0x01b2('0x5e')](_0x4a0f3d,['id',_0x01b2('0x5f'),'updatedAt']);_0x1f4de8[_0x01b2('0x54')]=_[_0x01b2('0x5e')](_0x1f4de8[_0x01b2('0x54')],['id','createdAt',_0x01b2('0x60')]);return db[_0x01b2('0x39')][_0x01b2('0x53')](_[_0x01b2('0x48')](_0x4a0f3d,_0x1f4de8[_0x01b2('0x54')]),{'include':_0x1f4de8[_0x01b2('0x3b')][_0x01b2('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x59ef38){var _0x2f293a=_0x1f4de8['user']['get']({'plain':!![]});if(!_0x2f293a)throw new Error(_0x01b2('0x56'));if(_0x2f293a['role']===_0x01b2('0x55')){var _0x548a3d=_0x59ef38[_0x01b2('0x2a')]({'plain':!![]});var _0x1046e2=[{'name':_0x01b2('0x2b'),'value':_0x01b2('0x2c')},{'name':'QueueCampaigns','value':_0x01b2('0x2e')}];var _0x5aa15c=_[_0x01b2('0x33')](_0x1046e2,['value',_0x548a3d[_0x01b2('0x46')]])['name'];return db[_0x01b2('0x58')][_0x01b2('0x33')]({'where':{'name':_0x5aa15c,'userProfileId':_0x2f293a['userProfileId']},'raw':!![]})[_0x01b2('0x28')](function(_0x25bf83){if(_0x25bf83&&_0x25bf83[_0x01b2('0x5a')]===0x0){return db[_0x01b2('0x35')][_0x01b2('0x53')]({'name':_0x548a3d[_0x01b2('0x34')],'resourceId':_0x548a3d['id'],'type':_0x25bf83[_0x01b2('0x34')],'sectionId':_0x25bf83['id']},{})[_0x01b2('0x28')](function(){return _0x59ef38;});}else{return _0x59ef38;}})[_0x01b2('0x4e')](function(_0x477f88){logger[_0x01b2('0x36')](_0x01b2('0x5b'),_0x477f88);throw _0x477f88;});}return _0x59ef38;});}})[_0x01b2('0x28')](respondWithResult(_0x3eb974,0xc9))['catch'](handleError(_0x3eb974,null));};exports['update']=function(_0x392066,_0xc56bbd){if(_0x392066[_0x01b2('0x54')]['id']){delete _0x392066[_0x01b2('0x54')]['id'];}return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0x392066[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0xc56bbd,null))['then'](saveUpdates(_0x392066[_0x01b2('0x54')],null))[_0x01b2('0x28')](respondWithResult(_0xc56bbd,null))[_0x01b2('0x4e')](handleError(_0xc56bbd,null));};exports[_0x01b2('0x29')]=function(_0x390e18,_0x32f099){return db[_0x01b2('0x39')]['find']({'where':{'id':_0x390e18['params']['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x32f099,null))[_0x01b2('0x28')](removeEntity(_0x32f099,null))[_0x01b2('0x4e')](handleError(_0x32f099,null));};exports['getHoppers']=function(_0x3d3248,_0x2f6d16,_0x240558){var _0x55bb27={'raw':![],'where':{}};var _0x262651={};var _0xdf1d4c={'count':0x0,'rows':[]};return db[_0x01b2('0x39')]['findOne']({'where':{'id':_0x3d3248['params']['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x2f6d16,null))['then'](function(_0x1e1155){if(_0x1e1155){_0x262651[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0x61')][_0x01b2('0x62')]);_0x262651[_0x01b2('0x3b')]=_['keys'](_0x3d3248[_0x01b2('0x3b')]);_0x262651[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0x262651[_0x01b2('0x3a')],_0x262651[_0x01b2('0x3b')]);_0x55bb27[_0x01b2('0x3d')]=_['intersection'](_0x262651[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x3d3248[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x55bb27[_0x01b2('0x3d')]=_0x55bb27[_0x01b2('0x3d')]['length']?_0x55bb27[_0x01b2('0x3d')]:_0x262651['model'];if(!_0x3d3248[_0x01b2('0x3b')]['hasOwnProperty']('nolimit')){_0x55bb27[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x3d3248['query'][_0x01b2('0x42')]);_0x55bb27[_0x01b2('0x23')]=qs[_0x01b2('0x23')](_0x3d3248[_0x01b2('0x3b')]['offset']);}_0x55bb27[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x3d3248[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x55bb27[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_[_0x01b2('0x63')](_0x3d3248[_0x01b2('0x3b')],_0x262651[_0x01b2('0x3c')]));_0x55bb27[_0x01b2('0x45')][_0x01b2('0x64')]=_0x1e1155['id'];if(_0x3d3248['query'][_0x01b2('0x2f')]){_0x55bb27[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x55bb27[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x55bb27[_0x01b2('0x3d')],function(_0x2316f8){var _0x1c7f70={};_0x1c7f70[_0x2316f8]={'$like':'%'+_0x3d3248['query']['filter']+'%'};return _0x1c7f70;})});}_0x55bb27=_[_0x01b2('0x48')]({},_0x55bb27,_0x3d3248[_0x01b2('0x49')]);return db[_0x01b2('0x61')][_0x01b2('0x22')]({'where':_0x55bb27[_0x01b2('0x45')]})[_0x01b2('0x28')](function(_0x6615a0){_0xdf1d4c[_0x01b2('0x22')]=_0x6615a0;if(_0x3d3248['query'][_0x01b2('0x4a')]){_0x55bb27[_0x01b2('0x4b')]=[{'all':!![]}];}return db[_0x01b2('0x61')]['findAll'](_0x55bb27);})[_0x01b2('0x28')](function(_0x2dec32){_0xdf1d4c[_0x01b2('0x4d')]=_0x2dec32;return _0xdf1d4c;});}})[_0x01b2('0x28')](respondWithFilteredResult(_0x2f6d16,_0x55bb27))['catch'](handleError(_0x2f6d16,null));};exports['getHopperHistories']=function(_0x53cbff,_0x2cee2e,_0x511fdc){var _0x4727a7={'raw':!![],'where':{}};var _0xcae132={};var _0x21209d={'count':0x0,'rows':[]};return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x53cbff[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x2cee2e,null))[_0x01b2('0x28')](function(_0x3fb15f){if(_0x3fb15f){_0xcae132[_0x01b2('0x3a')]=_['keys'](db[_0x01b2('0x66')][_0x01b2('0x62')]);_0xcae132[_0x01b2('0x3b')]=_[_0x01b2('0x51')](_0x53cbff[_0x01b2('0x3b')]);_0xcae132[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0xcae132[_0x01b2('0x3a')],_0xcae132[_0x01b2('0x3b')]);_0x4727a7['attributes']=_['intersection'](_0xcae132[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x53cbff[_0x01b2('0x3b')]['fields']));_0x4727a7[_0x01b2('0x3d')]=_0x4727a7[_0x01b2('0x3d')][_0x01b2('0x5d')]?_0x4727a7[_0x01b2('0x3d')]:_0xcae132[_0x01b2('0x3a')];if(!_0x53cbff[_0x01b2('0x3b')][_0x01b2('0x40')](_0x01b2('0x41'))){_0x4727a7[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x53cbff[_0x01b2('0x3b')]['limit']);_0x4727a7[_0x01b2('0x23')]=qs[_0x01b2('0x23')](_0x53cbff[_0x01b2('0x3b')][_0x01b2('0x23')]);}_0x4727a7[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x53cbff[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x4727a7[_0x01b2('0x45')]=qs['filters'](_[_0x01b2('0x63')](_0x53cbff[_0x01b2('0x3b')],_0xcae132[_0x01b2('0x3c')]));_0x4727a7[_0x01b2('0x45')][_0x01b2('0x64')]=_0x3fb15f['id'];if(_0x53cbff[_0x01b2('0x3b')][_0x01b2('0x2f')]){_0x4727a7[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x4727a7[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x4727a7['attributes'],function(_0x24f6cc){var _0x4ad1e9={};_0x4ad1e9[_0x24f6cc]={'$like':'%'+_0x53cbff[_0x01b2('0x3b')][_0x01b2('0x2f')]+'%'};return _0x4ad1e9;})});}_0x4727a7=_[_0x01b2('0x48')]({},_0x4727a7,_0x53cbff[_0x01b2('0x49')]);return db['CmHopperHistory'][_0x01b2('0x22')]({'where':_0x4727a7[_0x01b2('0x45')]})[_0x01b2('0x28')](function(_0x451c6b){_0x21209d['count']=_0x451c6b;if(_0x53cbff[_0x01b2('0x3b')]['includeAll']){_0x4727a7[_0x01b2('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x01b2('0x4c')](_0x4727a7);})['then'](function(_0x38651d){_0x21209d['rows']=_0x38651d;return _0x21209d;});}})['then'](respondWithFilteredResult(_0x2cee2e,_0x4727a7))[_0x01b2('0x4e')](handleError(_0x2cee2e,null));};exports[_0x01b2('0x67')]=function(_0x35ab14,_0x29330f,_0x479a27){var _0x2e02fa={'raw':!![],'where':{}};var _0x112c44={};var _0x1800da={'count':0x0,'rows':[]};return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x35ab14[_0x01b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x29330f,null))[_0x01b2('0x28')](function(_0xd4fb76){if(_0xd4fb76){_0x112c44[_0x01b2('0x3a')]=_['keys'](db[_0x01b2('0x68')][_0x01b2('0x62')]);_0x112c44[_0x01b2('0x3b')]=_[_0x01b2('0x51')](_0x35ab14[_0x01b2('0x3b')]);_0x112c44['filters']=_['intersection'](_0x112c44[_0x01b2('0x3a')],_0x112c44[_0x01b2('0x3b')]);_0x2e02fa[_0x01b2('0x3d')]=_['intersection'](_0x112c44['model'],qs[_0x01b2('0x3f')](_0x35ab14['query'][_0x01b2('0x3f')]));_0x2e02fa[_0x01b2('0x3d')]=_0x2e02fa['attributes'][_0x01b2('0x5d')]?_0x2e02fa[_0x01b2('0x3d')]:_0x112c44[_0x01b2('0x3a')];if(!_0x35ab14['query'][_0x01b2('0x40')]('nolimit')){_0x2e02fa[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x35ab14[_0x01b2('0x3b')][_0x01b2('0x42')]);_0x2e02fa[_0x01b2('0x23')]=qs['offset'](_0x35ab14[_0x01b2('0x3b')][_0x01b2('0x23')]);}_0x2e02fa[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x35ab14[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x2e02fa[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_[_0x01b2('0x63')](_0x35ab14[_0x01b2('0x3b')],_0x112c44[_0x01b2('0x3c')]));_0x2e02fa[_0x01b2('0x45')][_0x01b2('0x64')]=_0xd4fb76['id'];if(_0x35ab14[_0x01b2('0x3b')][_0x01b2('0x2f')]){_0x2e02fa[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x2e02fa[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x2e02fa[_0x01b2('0x3d')],function(_0x174ea5){var _0x503962={};_0x503962[_0x174ea5]={'$like':'%'+_0x35ab14[_0x01b2('0x3b')]['filter']+'%'};return _0x503962;})});}_0x2e02fa=_[_0x01b2('0x48')]({},_0x2e02fa,_0x35ab14[_0x01b2('0x49')]);return db[_0x01b2('0x68')][_0x01b2('0x22')]({'where':_0x2e02fa[_0x01b2('0x45')]})[_0x01b2('0x28')](function(_0x2718b5){_0x1800da[_0x01b2('0x22')]=_0x2718b5;if(_0x35ab14[_0x01b2('0x3b')][_0x01b2('0x4a')]){_0x2e02fa['include']=[{'all':!![]}];}return db[_0x01b2('0x68')][_0x01b2('0x4c')](_0x2e02fa);})[_0x01b2('0x28')](function(_0x4daae0){_0x1800da['rows']=_0x4daae0;return _0x1800da;});}})[_0x01b2('0x28')](respondWithFilteredResult(_0x29330f,_0x2e02fa))[_0x01b2('0x4e')](handleError(_0x29330f,null));};exports[_0x01b2('0x69')]=function(_0x5e73c3,_0x178626,_0x398686){var _0x24b81c={'raw':!![],'where':{}};var _0x50e804={};var _0x19dcae={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5e73c3[_0x01b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x178626,null))['then'](function(_0x402aa9){if(_0x402aa9){_0x50e804[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0x6a')][_0x01b2('0x62')]);_0x50e804[_0x01b2('0x3b')]=_[_0x01b2('0x51')](_0x5e73c3[_0x01b2('0x3b')]);_0x50e804[_0x01b2('0x3c')]=_['intersection'](_0x50e804['model'],_0x50e804[_0x01b2('0x3b')]);_0x24b81c[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x50e804[_0x01b2('0x3a')],qs['fields'](_0x5e73c3[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x24b81c[_0x01b2('0x3d')]=_0x24b81c[_0x01b2('0x3d')][_0x01b2('0x5d')]?_0x24b81c[_0x01b2('0x3d')]:_0x50e804[_0x01b2('0x3a')];if(!_0x5e73c3['query'][_0x01b2('0x40')](_0x01b2('0x41'))){_0x24b81c[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x5e73c3[_0x01b2('0x3b')]['limit']);_0x24b81c['offset']=qs[_0x01b2('0x23')](_0x5e73c3['query']['offset']);}_0x24b81c['order']=qs[_0x01b2('0x44')](_0x5e73c3['query'][_0x01b2('0x44')]);_0x24b81c[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_[_0x01b2('0x63')](_0x5e73c3[_0x01b2('0x3b')],_0x50e804['filters']));_0x24b81c[_0x01b2('0x45')]['VoiceQueueId']=_0x402aa9['id'];if(_0x5e73c3[_0x01b2('0x3b')]['filter']){_0x24b81c[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x24b81c[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x24b81c[_0x01b2('0x3d')],function(_0x5c670f){var _0x3cc936={};_0x3cc936[_0x5c670f]={'$like':'%'+_0x5e73c3[_0x01b2('0x3b')]['filter']+'%'};return _0x3cc936;})});}_0x24b81c=_[_0x01b2('0x48')]({},_0x24b81c,_0x5e73c3[_0x01b2('0x49')]);return db['CmHopperBlack'][_0x01b2('0x22')]({'where':_0x24b81c[_0x01b2('0x45')]})['then'](function(_0x162604){_0x19dcae[_0x01b2('0x22')]=_0x162604;if(_0x5e73c3[_0x01b2('0x3b')][_0x01b2('0x4a')]){_0x24b81c[_0x01b2('0x4b')]=[{'all':!![]}];}return db[_0x01b2('0x6a')]['findAll'](_0x24b81c);})[_0x01b2('0x28')](function(_0x264760){_0x19dcae['rows']=_0x264760;return _0x19dcae;});}})[_0x01b2('0x28')](respondWithFilteredResult(_0x178626,_0x24b81c))['catch'](handleError(_0x178626,null));};exports[_0x01b2('0x6b')]=function(_0x7ac4d,_0x4a0eb6,_0x2d585f){var _0x24c24a={};var _0x58fa6d={};var _0x1c08b4;var _0x565d02;return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x7ac4d[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x4a0eb6,null))['then'](function(_0x1b5263){if(_0x1b5263){_0x1c08b4=_0x1b5263;_0x58fa6d[_0x01b2('0x3a')]=_['keys'](db['Team'][_0x01b2('0x62')]);_0x58fa6d['query']=_[_0x01b2('0x51')](_0x7ac4d['query']);_0x58fa6d[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0x58fa6d['model'],_0x58fa6d[_0x01b2('0x3b')]);_0x24c24a[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x58fa6d[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x7ac4d[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x24c24a[_0x01b2('0x3d')]=_0x24c24a['attributes']['length']?_0x24c24a['attributes']:_0x58fa6d['model'];_0x24c24a['order']=qs[_0x01b2('0x44')](_0x7ac4d[_0x01b2('0x3b')]['sort']);_0x24c24a[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_[_0x01b2('0x63')](_0x7ac4d['query'],_0x58fa6d[_0x01b2('0x3c')]));if(_0x7ac4d[_0x01b2('0x3b')]['filter']){_0x24c24a[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x24c24a[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x24c24a[_0x01b2('0x3d')],function(_0x3165cc){var _0x2ea92c={};_0x2ea92c[_0x3165cc]={'$like':'%'+_0x7ac4d[_0x01b2('0x3b')][_0x01b2('0x2f')]+'%'};return _0x2ea92c;})});}_0x24c24a=_[_0x01b2('0x48')]({},_0x24c24a,_0x7ac4d[_0x01b2('0x49')]);return _0x1c08b4['getTeams'](_0x24c24a);}})[_0x01b2('0x28')](function(_0x23b28b){if(_0x23b28b){_0x565d02=_0x23b28b[_0x01b2('0x5d')];if(!_0x7ac4d[_0x01b2('0x3b')][_0x01b2('0x40')](_0x01b2('0x41'))){_0x24c24a[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x7ac4d[_0x01b2('0x3b')]['limit']);_0x24c24a[_0x01b2('0x23')]=qs[_0x01b2('0x23')](_0x7ac4d['query'][_0x01b2('0x23')]);}return _0x1c08b4[_0x01b2('0x6b')](_0x24c24a);}})[_0x01b2('0x28')](function(_0x1860f5){if(_0x1860f5){return _0x1860f5?{'count':_0x565d02,'rows':_0x1860f5}:null;}})[_0x01b2('0x28')](respondWithResult(_0x4a0eb6,null))[_0x01b2('0x4e')](handleError(_0x4a0eb6,null));};exports[_0x01b2('0x6c')]=function(_0x4a910c,_0xed7a00,_0x190faa){var _0x116b1e=_0x4a910c[_0x01b2('0x54')]['teams'];var _0x4824cd=_['map'](_0x116b1e,'id');return db['Team'][_0x01b2('0x4c')]({'where':{'id':_0x4824cd},'attributes':['id'],'include':[{'model':db[_0x01b2('0x6d')],'as':_0x01b2('0x6e'),'attributes':['id',_0x01b2('0x34'),_0x01b2('0x6f'),_0x01b2('0x70'),'interface'],'raw':!![]}]})[_0x01b2('0x28')](function(_0x19eb73){if(_0x19eb73){var _0x42767b=_[_0x01b2('0x71')](_0x19eb73,function(_0x55f0e5){var _0x576a0c=_0x55f0e5[_0x01b2('0x2a')]({'plain':!![]});_0x576a0c['Agents'][_0x01b2('0x72')](function(_0x160c8c){_0x160c8c['penalty']=_['find'](_0x116b1e,{'id':_0x576a0c['id']})['penalty'];});return _0x576a0c[_0x01b2('0x6e')];});return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0x4a910c[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](function(_0x32dc87){return db[_0x01b2('0x73')][_0x01b2('0x74')](function(_0xe68376){return _0x32dc87[_0x01b2('0x6c')](_0x4824cd,{'transaction':_0xe68376})[_0x01b2('0x28')](function(){return BPromise[_0x01b2('0x75')](_0x42767b,function(_0x187e05){return db[_0x01b2('0x76')]['findOrCreate']({'where':{'UserId':_0x187e05['id'],'VoiceQueueId':_0x4a910c[_0x01b2('0x50')]['id']},'defaults':{'penalty':_0x187e05['penalty']},'transaction':_0xe68376});});})['then'](function(){return BPromise['each'](_[_0x01b2('0x2f')](_0x42767b,{'online':!![]}),function(_0x3e2cf7){return db[_0x01b2('0x77')]['upsert']({'membername':_0x3e2cf7[_0x01b2('0x34')],'UserId':_0x3e2cf7['id'],'queue_name':_0x32dc87[_0x01b2('0x34')],'VoiceQueueId':_0x32dc87['id'],'interface':_[_0x01b2('0x78')](_0x3e2cf7[_0x01b2('0x79')])?util[_0x01b2('0x7a')](_0x01b2('0x7b'),_0x3e2cf7[_0x01b2('0x34')]):_0x3e2cf7['interface'],'paused':_0x3e2cf7[_0x01b2('0x70')]||![],'penalty':_0x3e2cf7['penalty']},{'transaction':_0xe68376});});})[_0x01b2('0x28')](function(){_0x42767b[_0x01b2('0x72')](function(_0xa3c271){socket['emit'](_0x01b2('0x7c'),{'UserId':_0xa3c271['id'],'VoiceQueueId':_0x32dc87['id']});});});});});}})[_0x01b2('0x28')](respondWithStatusCode(_0xed7a00,null))['catch'](handleError(_0xed7a00,null));};exports['removeTeams']=function(_0x4931f5,_0x1da990,_0x561325){return db['Team'][_0x01b2('0x4c')]({'where':{'id':_0x4931f5[_0x01b2('0x3b')][_0x01b2('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x01b2('0x6d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x01b2('0x28')](handleEntityNotFound(_0x1da990,null))[_0x01b2('0x28')](function(_0x27decb){var _0x1818b9=_[_0x01b2('0x30')](_0x27decb,'id');var _0xb2440c=[];var _0x334993=[];var _0x360fae=squel[_0x01b2('0x7e')]();_0x360fae[_0x01b2('0x7f')](_0x01b2('0x80'))['from'](_0x01b2('0x81'),'tq')['join'](_0x01b2('0x82'),'ut',_0x01b2('0x83'))[_0x01b2('0x45')]('VoiceQueueId\x20=\x20?',_0x4931f5['params']['id']);for(var _0x2255a7=0x0;_0x2255a7<_0x27decb['length'];_0x2255a7+=0x1){let _0x463960=_0x27decb[_0x2255a7];for(var _0x26e2b8=0x0;_0x26e2b8<_0x463960[_0x01b2('0x6e')][_0x01b2('0x5d')];_0x26e2b8+=0x1){let _0x264c28=_0x463960['Agents'][_0x26e2b8];var _0x206ea6=_0x360fae[_0x01b2('0x5c')]();_0x206ea6[_0x01b2('0x45')]('ut.UserId\x20=\x20?',_0x264c28['id']);_0x334993[_0x01b2('0x84')](db['sequelize'][_0x01b2('0x3b')](_0x206ea6[_0x01b2('0x85')](),{'type':db[_0x01b2('0x73')][_0x01b2('0x86')][_0x01b2('0x87')]})[_0x01b2('0x28')](function(_0x648e6e){if(_0x648e6e[_0x01b2('0x5d')]===0x1){return _0x264c28['id'];}else{var _0x54e714=_['every'](_[_0x01b2('0x30')](_0x648e6e,_0x01b2('0x88')),function(_0xf0a07d){return _[_0x01b2('0x32')](_0x1818b9,_0xf0a07d);});if(_0x54e714){return _0x264c28['id'];}}}));}}return BPromise['all'](_0x334993)['then'](function(_0x430f06){_0xb2440c=_(_0xb2440c)['union'](_0x430f06)[_0x01b2('0x89')]()[_0x01b2('0x31')]();return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0x4931f5[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](function(_0x408db6){return db[_0x01b2('0x73')][_0x01b2('0x74')](function(_0x163227){return _0x408db6['removeTeams'](_0x4931f5['query']['ids'],{'transaction':_0x163227})[_0x01b2('0x28')](function(){if(!_['isEmpty'](_0xb2440c)){return _0x408db6[_0x01b2('0x8a')](_0xb2440c,{'transaction':_0x163227})[_0x01b2('0x28')](function(){return db[_0x01b2('0x77')][_0x01b2('0x29')]({'where':{'VoiceQueueId':_0x4931f5[_0x01b2('0x50')]['id'],'UserId':_0xb2440c},'transaction':_0x163227});});}})[_0x01b2('0x28')](function(){_0xb2440c[_0x01b2('0x72')](function(_0x4d77e6){socket['emit'](_0x01b2('0x8b'),{'UserId':_0x4d77e6,'VoiceQueueId':_0x408db6['id']});});});});});});})[_0x01b2('0x28')](respondWithStatusCode(_0x1da990,null))['catch'](handleError(_0x1da990,null));};exports[_0x01b2('0x8c')]=function(_0x490e67,_0x22742c,_0x51cc88){var _0xac6db0,_0x45dd3c;return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0x490e67[_0x01b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x22742c,null))[_0x01b2('0x28')](function(_0x11f32f){if(_0x11f32f){_0x45dd3c=_0x11f32f;return _0x11f32f['addAgents'](_0x490e67[_0x01b2('0x54')][_0x01b2('0x7d')],_[_0x01b2('0x5e')](_0x490e67[_0x01b2('0x54')],[_0x01b2('0x7d'),'id'])||{})[_0x01b2('0x8d')](function(_0x61f51f){for(var _0x29510e=0x0;_0x29510e<_0x490e67['body'][_0x01b2('0x7d')][_0x01b2('0x5d')];_0x29510e+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x490e67[_0x01b2('0x54')][_0x01b2('0x7d')][_0x29510e],'VoiceQueueId':_0x490e67['params']['id']});}return _0x61f51f;});}})['then'](function(_0x44f31b){_0xac6db0=_0x44f31b||[];if(_0x45dd3c){return db[_0x01b2('0x6d')][_0x01b2('0x4c')]({'where':{'id':_0x490e67[_0x01b2('0x54')][_0x01b2('0x7d')]},'attributes':['id',_0x01b2('0x34'),_0x01b2('0x6f'),_0x01b2('0x70'),_0x01b2('0x79')],'raw':!![]});}})['then'](function(_0x436b03){if(!_['isEmpty'](_0x436b03)){var _0x16dd14=[];for(var _0x59b41e=0x0;_0x59b41e<_0x436b03[_0x01b2('0x5d')];_0x59b41e++){if(_0x436b03[_0x59b41e][_0x01b2('0x6f')]){_0x16dd14[_0x01b2('0x84')](db['UserVoiceQueueRt'][_0x01b2('0x8e')]({'membername':_0x436b03[_0x59b41e][_0x01b2('0x34')],'UserId':_0x436b03[_0x59b41e]['id'],'queue_name':_0x45dd3c[_0x01b2('0x34')],'VoiceQueueId':_0x45dd3c['id'],'interface':_['isNil'](_0x436b03[_0x59b41e][_0x01b2('0x79')])?util[_0x01b2('0x7a')]('SIP/%s',_0x436b03[_0x59b41e][_0x01b2('0x34')]):_0x436b03[_0x59b41e][_0x01b2('0x79')],'paused':_0x436b03[_0x59b41e][_0x01b2('0x70')]||![],'penalty':_0x490e67[_0x01b2('0x54')][_0x01b2('0x8f')]||0x0}));}}return BPromise[_0x01b2('0x90')](_0x16dd14);}})['then'](function(){return _0xac6db0;})['then'](respondWithResult(_0x22742c,null))['catch'](handleError(_0x22742c,null));};exports[_0x01b2('0x8a')]=function(_0x3124b0,_0x2103c6,_0x4b3a21){return db[_0x01b2('0x39')]['find']({'where':{'id':_0x3124b0[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x2103c6,null))[_0x01b2('0x28')](function(_0x4c2709){if(_0x4c2709){return _0x4c2709[_0x01b2('0x8a')](_0x3124b0[_0x01b2('0x3b')][_0x01b2('0x7d')])['then'](function(){if(_[_0x01b2('0x91')](_0x3124b0[_0x01b2('0x3b')]['ids'])){for(var _0x5ccc2c=0x0;_0x5ccc2c<_0x3124b0[_0x01b2('0x3b')][_0x01b2('0x7d')][_0x01b2('0x5d')];_0x5ccc2c+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3124b0[_0x01b2('0x3b')][_0x01b2('0x7d')][_0x5ccc2c]),'VoiceQueueId':Number(_0x3124b0[_0x01b2('0x50')]['id'])});}}else{socket[_0x01b2('0x92')](_0x01b2('0x8b'),{'UserId':Number(_0x3124b0[_0x01b2('0x3b')]['ids']),'VoiceQueueId':Number(_0x3124b0[_0x01b2('0x50')]['id'])});}});}})['then'](function(_0x3a6f2d){return db[_0x01b2('0x77')][_0x01b2('0x29')]({'where':{'VoiceQueueId':_0x3124b0['params']['id'],'UserId':_0x3124b0[_0x01b2('0x3b')][_0x01b2('0x7d')]}})['then'](function(){return _0x3a6f2d;});})[_0x01b2('0x28')](respondWithStatusCode(_0x2103c6,null))[_0x01b2('0x4e')](handleError(_0x2103c6,null));};exports['getAgents']=function(_0x3fcd7f,_0x34f434,_0x19e168){var _0x23818a={};var _0x801d9e={};var _0x5ad53c;var _0x4dd09b;return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x3fcd7f['params']['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x34f434,null))['then'](function(_0x1ddd57){if(_0x1ddd57){_0x5ad53c=_0x1ddd57;_0x801d9e[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0x6d')][_0x01b2('0x62')]);_0x801d9e[_0x01b2('0x3b')]=_['keys'](_0x3fcd7f[_0x01b2('0x3b')]);_0x801d9e['filters']=_[_0x01b2('0x3e')](_0x801d9e[_0x01b2('0x3a')],_0x801d9e[_0x01b2('0x3b')]);_0x23818a[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x801d9e['model'],qs[_0x01b2('0x3f')](_0x3fcd7f[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x23818a[_0x01b2('0x3d')]=_0x23818a[_0x01b2('0x3d')][_0x01b2('0x5d')]?_0x23818a[_0x01b2('0x3d')]:_0x801d9e['model'];_0x23818a['order']=qs[_0x01b2('0x44')](_0x3fcd7f[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x23818a[_0x01b2('0x45')]=qs[_0x01b2('0x3c')](_['pick'](_0x3fcd7f[_0x01b2('0x3b')],_0x801d9e[_0x01b2('0x3c')]));if(_0x3fcd7f[_0x01b2('0x3b')][_0x01b2('0x2f')]){_0x23818a[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x23818a[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x23818a['attributes'],function(_0x3d4c65){var _0x31b3fd={};_0x31b3fd[_0x3d4c65]={'$like':'%'+_0x3fcd7f['query'][_0x01b2('0x2f')]+'%'};return _0x31b3fd;})});}_0x23818a=_[_0x01b2('0x48')]({},_0x23818a,_0x3fcd7f[_0x01b2('0x49')]);return _0x5ad53c[_0x01b2('0x93')](_0x23818a);}})[_0x01b2('0x28')](function(_0x2d7efd){if(_0x2d7efd){_0x4dd09b=_0x2d7efd[_0x01b2('0x5d')];if(!_0x3fcd7f[_0x01b2('0x3b')][_0x01b2('0x40')](_0x01b2('0x41'))){_0x23818a['limit']=qs['limit'](_0x3fcd7f[_0x01b2('0x3b')]['limit']);_0x23818a[_0x01b2('0x23')]=qs[_0x01b2('0x23')](_0x3fcd7f['query'][_0x01b2('0x23')]);}return _0x5ad53c[_0x01b2('0x93')](_0x23818a);}})[_0x01b2('0x28')](function(_0x573290){if(_0x573290){return _0x573290?{'count':_0x4dd09b,'rows':_0x573290}:null;}})[_0x01b2('0x28')](respondWithResult(_0x34f434,null))['catch'](handleError(_0x34f434,null));};exports[_0x01b2('0x94')]=function(_0x59a931,_0x432895,_0x3ac031){var _0x27e702={};var _0x18567c={};var _0x10c946;var _0xb56209;return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x59a931[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x432895,null))[_0x01b2('0x28')](function(_0x3c7a86){if(_0x3c7a86){_0x10c946=_0x3c7a86;_0x18567c[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0x77')]['rawAttributes']);_0x18567c[_0x01b2('0x3b')]=_[_0x01b2('0x51')](_0x59a931[_0x01b2('0x3b')]);_0x18567c[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0x18567c['model'],_0x18567c[_0x01b2('0x3b')]);_0x27e702[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x18567c[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x59a931[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x27e702[_0x01b2('0x3d')]=_0x27e702['attributes'][_0x01b2('0x5d')]?_0x27e702[_0x01b2('0x3d')]:_0x18567c['model'];_0x27e702[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x59a931[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x27e702['where']=qs[_0x01b2('0x3c')](_['pick'](_0x59a931[_0x01b2('0x3b')],_0x18567c[_0x01b2('0x3c')]));if(_0x59a931['query'][_0x01b2('0x2f')]){_0x27e702[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x27e702[_0x01b2('0x45')],{'$or':_['map'](_0x27e702[_0x01b2('0x3d')],function(_0x724b3e){var _0x482366={};_0x482366[_0x724b3e]={'$like':'%'+_0x59a931[_0x01b2('0x3b')][_0x01b2('0x2f')]+'%'};return _0x482366;})});}_0x27e702=_[_0x01b2('0x48')]({},_0x27e702,_0x59a931[_0x01b2('0x49')]);return _0x10c946[_0x01b2('0x94')](_0x27e702);}})[_0x01b2('0x28')](function(_0x4d3b6c){if(_0x4d3b6c){_0xb56209=_0x4d3b6c['length'];if(!_0x59a931['query'][_0x01b2('0x40')](_0x01b2('0x41'))){_0x27e702[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x59a931[_0x01b2('0x3b')][_0x01b2('0x42')]);_0x27e702[_0x01b2('0x23')]=qs['offset'](_0x59a931[_0x01b2('0x3b')]['offset']);}return _0x10c946[_0x01b2('0x94')](_0x27e702);}})[_0x01b2('0x28')](function(_0x49d570){return _0x49d570?{'count':_0xb56209,'rows':_0x49d570}:null;})[_0x01b2('0x28')](respondWithResult(_0x432895,null))['catch'](handleError(_0x432895,null));};exports[_0x01b2('0x95')]=function(_0x23d5bd,_0x1d8fa4,_0x4216bf){var _0x553fbc={};var _0x5ad722={};var _0x5c7db3;var _0x4af7c9;return db['VoiceQueue']['findOne']({'where':{'id':_0x23d5bd[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x1d8fa4,null))[_0x01b2('0x28')](function(_0x4390b3){if(_0x4390b3){_0x5c7db3=_0x4390b3;_0x5ad722[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db['CmList'][_0x01b2('0x62')]);_0x5ad722['query']=_[_0x01b2('0x51')](_0x23d5bd[_0x01b2('0x3b')]);_0x5ad722[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0x5ad722['model'],_0x5ad722[_0x01b2('0x3b')]);_0x553fbc[_0x01b2('0x3d')]=_['intersection'](_0x5ad722['model'],qs['fields'](_0x23d5bd[_0x01b2('0x3b')]['fields']));_0x553fbc['attributes']=_0x553fbc['attributes'][_0x01b2('0x5d')]?_0x553fbc[_0x01b2('0x3d')]:_0x5ad722[_0x01b2('0x3a')];_0x553fbc[_0x01b2('0x43')]=qs[_0x01b2('0x44')](_0x23d5bd[_0x01b2('0x3b')][_0x01b2('0x44')]);_0x553fbc[_0x01b2('0x45')]=qs['filters'](_['pick'](_0x23d5bd[_0x01b2('0x3b')],_0x5ad722[_0x01b2('0x3c')]));if(_0x23d5bd['query'][_0x01b2('0x2f')]){_0x553fbc['where']=_[_0x01b2('0x48')](_0x553fbc['where'],{'$or':_[_0x01b2('0x30')](_0x553fbc[_0x01b2('0x3d')],function(_0x2f6783){var _0x4b1d62={};_0x4b1d62[_0x2f6783]={'$like':'%'+_0x23d5bd[_0x01b2('0x3b')]['filter']+'%'};return _0x4b1d62;})});}_0x553fbc=_[_0x01b2('0x48')]({},_0x553fbc,_0x23d5bd[_0x01b2('0x49')]);return _0x5c7db3[_0x01b2('0x95')](_0x553fbc);}})['then'](function(_0x17a17a){if(_0x17a17a){_0x4af7c9=_0x17a17a['length'];if(!_0x23d5bd[_0x01b2('0x3b')][_0x01b2('0x40')](_0x01b2('0x41'))){_0x553fbc[_0x01b2('0x42')]=qs[_0x01b2('0x42')](_0x23d5bd['query'][_0x01b2('0x42')]);_0x553fbc[_0x01b2('0x23')]=qs['offset'](_0x23d5bd[_0x01b2('0x3b')][_0x01b2('0x23')]);}return _0x5c7db3[_0x01b2('0x95')](_0x553fbc);}})[_0x01b2('0x28')](function(_0x521d1f){if(_0x521d1f){return _0x521d1f?{'count':_0x4af7c9,'rows':_0x521d1f}:null;}})[_0x01b2('0x28')](respondWithResult(_0x1d8fa4,null))[_0x01b2('0x4e')](handleError(_0x1d8fa4,null));};exports[_0x01b2('0x96')]=function(_0x10a30e,_0x3855de,_0x6316ca){var _0xd23fc2,_0x4b92aa;return db[_0x01b2('0x39')]['find']({'where':{'id':_0x10a30e[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x3855de,null))['then'](function(_0x54def){if(_0x54def){_0x4b92aa=_0x54def;return _0x54def[_0x01b2('0x96')](_0x10a30e[_0x01b2('0x54')][_0x01b2('0x7d')],_[_0x01b2('0x5e')](_0x10a30e[_0x01b2('0x54')],[_0x01b2('0x7d'),'id'])||{});}return null;})[_0x01b2('0x8d')](function(_0xbaaa32){var _0x30d6ce;_0xd23fc2=_0xbaaa32||[];var _0x56e822=[];if(_0xbaaa32){for(var _0x2e33ec=0x0;_0x2e33ec<_0xbaaa32[_0x01b2('0x5d')];_0x2e33ec+=0x1){var _0xf43943=_0xbaaa32[_0x2e33ec][_0x01b2('0x2a')]({'plain':!![]});_0x4b92aa[_0x01b2('0x97')]=_0x10a30e['body']['dialCheckDuplicateType']?_0x10a30e[_0x01b2('0x54')][_0x01b2('0x97')]:_0x4b92aa['dialCheckDuplicateType'];switch(_0x4b92aa[_0x01b2('0x97')]){case _0x01b2('0x98'):_0x30d6ce=squel[_0x01b2('0x99')]()['into']('cm_hopper')[_0x01b2('0x9a')]([_0x01b2('0x9b'),_0x01b2('0x9c'),_0x01b2('0x9d'),_0x01b2('0x9e'),_0x01b2('0x64'),_0x01b2('0x5f'),'updatedAt'],squel[_0x01b2('0x7e')]()['field']('phone',_0x01b2('0x9b'))[_0x01b2('0x7f')]('NOW()',_0x01b2('0x9c'))['field']('id',_0x01b2('0x9d'))[_0x01b2('0x7f')](_0xf43943['CmListId'][_0x01b2('0x85')](),_0x01b2('0x9e'))[_0x01b2('0x7f')](_0x10a30e[_0x01b2('0x50')]['id'][_0x01b2('0x85')](),_0x01b2('0x64'))[_0x01b2('0x7f')](_0x01b2('0x9f'),'createdAt')['field'](_0x01b2('0x9f'),_0x01b2('0x60'))['from'](_0x01b2('0xa0'))[_0x01b2('0x45')](_0x01b2('0xa1'))[_0x01b2('0x45')]('ListId\x20=\x20?',_0xf43943[_0x01b2('0xa2')]['toString']())[_0x01b2('0x45')](_0x01b2('0xa3'))[_0x01b2('0x45')](_0x01b2('0xa4'),squel['select']()[_0x01b2('0x7f')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x01b2('0xa5'))[_0x01b2('0x45')]('VoiceQueueId\x20=\x20?',_0x10a30e[_0x01b2('0x50')]['id'][_0x01b2('0x85')]()))['where'](_0x01b2('0xa4'),squel[_0x01b2('0x7e')]()[_0x01b2('0x7f')]('COALESCE(phone,\x27\x27)')['from'](_0x01b2('0xa6'))[_0x01b2('0x45')](_0x01b2('0xa7'),_0x10a30e[_0x01b2('0x50')]['id'][_0x01b2('0x85')]())))[_0x01b2('0x85')]();break;case _0x01b2('0xa8'):_0x30d6ce=squel[_0x01b2('0x99')]()[_0x01b2('0xa9')](_0x01b2('0xa6'))[_0x01b2('0x9a')]([_0x01b2('0x9b'),_0x01b2('0x9c'),_0x01b2('0x9d'),_0x01b2('0x9e'),_0x01b2('0x64'),_0x01b2('0x5f'),_0x01b2('0x60')],squel['select']()[_0x01b2('0x7f')](_0x01b2('0x9b'),_0x01b2('0x9b'))['field'](_0x01b2('0x9f'),_0x01b2('0x9c'))[_0x01b2('0x7f')]('id',_0x01b2('0x9d'))[_0x01b2('0x7f')](_0xf43943[_0x01b2('0xa2')][_0x01b2('0x85')](),_0x01b2('0x9e'))['field'](_0x10a30e['params']['id']['toString'](),'VoiceQueueId')[_0x01b2('0x7f')]('NOW()','createdAt')[_0x01b2('0x7f')](_0x01b2('0x9f'),_0x01b2('0x60'))['from'](_0x01b2('0xa0'))[_0x01b2('0x45')]('deletedAt\x20IS\x20NULL')[_0x01b2('0x45')](_0x01b2('0xaa'),_0xf43943[_0x01b2('0xa2')]['toString']())['where'](_0x01b2('0xa3'))['where'](_0x01b2('0xa4'),squel[_0x01b2('0x7e')]()[_0x01b2('0x7f')](_0x01b2('0xab'))['from'](_0x01b2('0xa6'))[_0x01b2('0x45')]('VoiceQueueId\x20=\x20?',_0x10a30e[_0x01b2('0x50')]['id'][_0x01b2('0x85')]())))[_0x01b2('0x85')]();break;default:_0x30d6ce=squel[_0x01b2('0x99')]()[_0x01b2('0xa9')]('cm_hopper')[_0x01b2('0x9a')]([_0x01b2('0x9b'),_0x01b2('0x9c'),'ContactId','ListId','VoiceQueueId',_0x01b2('0x5f'),_0x01b2('0x60')],squel[_0x01b2('0x7e')]()[_0x01b2('0x7f')](_0x01b2('0x9b'),'phone')['field'](_0x01b2('0x9f'),'scheduledAt')['field']('id',_0x01b2('0x9d'))[_0x01b2('0x7f')](_0xf43943[_0x01b2('0xa2')]['toString'](),_0x01b2('0x9e'))[_0x01b2('0x7f')](_0x10a30e['params']['id'][_0x01b2('0x85')](),_0x01b2('0x64'))[_0x01b2('0x7f')](_0x01b2('0x9f'),'createdAt')[_0x01b2('0x7f')]('NOW()','updatedAt')['from'](_0x01b2('0xa0'))['where'](_0x01b2('0xa1'))[_0x01b2('0x45')](_0x01b2('0xaa'),_0xf43943[_0x01b2('0xa2')][_0x01b2('0x85')]())[_0x01b2('0x45')](_0x01b2('0xa3')))[_0x01b2('0x85')]();}_0x56e822[_0x01b2('0x84')](db[_0x01b2('0x73')]['query'](_0x30d6ce));}return BPromise[_0x01b2('0x90')](_0x56e822);}})['then'](function(){return _0xd23fc2;})[_0x01b2('0x28')](respondWithResult(_0x3855de,null))['catch'](handleError(_0x3855de,null));};exports[_0x01b2('0xac')]=function(_0x31c7ed,_0x16b1e9,_0x38c6d9){return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0x31c7ed[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x16b1e9,null))['then'](function(_0x40156c){if(_0x40156c){return _0x40156c[_0x01b2('0xac')](_0x31c7ed['query'][_0x01b2('0x7d')]);}})[_0x01b2('0x28')](function(_0x53e50d){if(_0x53e50d){return db[_0x01b2('0x61')][_0x01b2('0x29')]({'where':{'ListId':_0x31c7ed[_0x01b2('0x3b')][_0x01b2('0x7d')],'VoiceQueueId':_0x31c7ed[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](function(){return _0x53e50d;});}})['then'](respondWithStatusCode(_0x16b1e9,null))[_0x01b2('0x4e')](handleError(_0x16b1e9,null));};exports[_0x01b2('0xad')]=function(_0x2026e0,_0x4a8c85,_0x339195){var _0x35db6a={};var _0x10aca1={};var _0x4bbe37;var _0x4e23ef;return db[_0x01b2('0x39')][_0x01b2('0x65')]({'where':{'id':_0x2026e0[_0x01b2('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a8c85,null))[_0x01b2('0x28')](function(_0x2772a0){if(_0x2772a0){_0x4bbe37=_0x2772a0;_0x10aca1[_0x01b2('0x3a')]=_[_0x01b2('0x51')](db[_0x01b2('0xae')][_0x01b2('0x62')]);_0x10aca1[_0x01b2('0x3b')]=_[_0x01b2('0x51')](_0x2026e0[_0x01b2('0x3b')]);_0x10aca1[_0x01b2('0x3c')]=_[_0x01b2('0x3e')](_0x10aca1[_0x01b2('0x3a')],_0x10aca1[_0x01b2('0x3b')]);_0x35db6a[_0x01b2('0x3d')]=_[_0x01b2('0x3e')](_0x10aca1[_0x01b2('0x3a')],qs[_0x01b2('0x3f')](_0x2026e0[_0x01b2('0x3b')][_0x01b2('0x3f')]));_0x35db6a[_0x01b2('0x3d')]=_0x35db6a[_0x01b2('0x3d')]['length']?_0x35db6a[_0x01b2('0x3d')]:_0x10aca1[_0x01b2('0x3a')];_0x35db6a[_0x01b2('0x43')]=qs['sort'](_0x2026e0['query']['sort']);_0x35db6a['where']=qs[_0x01b2('0x3c')](_[_0x01b2('0x63')](_0x2026e0[_0x01b2('0x3b')],_0x10aca1[_0x01b2('0x3c')]));if(_0x2026e0['query'][_0x01b2('0x2f')]){_0x35db6a[_0x01b2('0x45')]=_[_0x01b2('0x48')](_0x35db6a[_0x01b2('0x45')],{'$or':_[_0x01b2('0x30')](_0x35db6a[_0x01b2('0x3d')],function(_0x4fddd3){var _0x4cfd78={};_0x4cfd78[_0x4fddd3]={'$like':'%'+_0x2026e0[_0x01b2('0x3b')][_0x01b2('0x2f')]+'%'};return _0x4cfd78;})});}_0x35db6a=_[_0x01b2('0x48')]({},_0x35db6a,_0x2026e0[_0x01b2('0x49')]);return _0x4bbe37[_0x01b2('0xad')](_0x35db6a);}})[_0x01b2('0x28')](function(_0x17202e){if(_0x17202e){_0x4e23ef=_0x17202e[_0x01b2('0x5d')];if(!_0x2026e0['query'][_0x01b2('0x40')](_0x01b2('0x41'))){_0x35db6a[_0x01b2('0x42')]=qs['limit'](_0x2026e0['query'][_0x01b2('0x42')]);_0x35db6a[_0x01b2('0x23')]=qs['offset'](_0x2026e0[_0x01b2('0x3b')][_0x01b2('0x23')]);}return _0x4bbe37[_0x01b2('0xad')](_0x35db6a);}})[_0x01b2('0x28')](function(_0xf89439){if(_0xf89439){return _0xf89439?{'count':_0x4e23ef,'rows':_0xf89439}:null;}})[_0x01b2('0x28')](respondWithResult(_0x4a8c85,null))[_0x01b2('0x4e')](handleError(_0x4a8c85,null));};exports[_0x01b2('0xaf')]=function(_0xa0dec9,_0x56e8fe,_0x73ff26){var _0x15cfce,_0x1e1e7f;return db[_0x01b2('0x39')][_0x01b2('0x33')]({'where':{'id':_0xa0dec9[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x56e8fe,null))[_0x01b2('0x28')](function(_0x37800e){if(_0x37800e){_0x1e1e7f=_0x37800e;return _0x37800e[_0x01b2('0xaf')](_0xa0dec9[_0x01b2('0x54')][_0x01b2('0x7d')],_[_0x01b2('0x5e')](_0xa0dec9['body'],[_0x01b2('0x7d'),'id'])||{});}return null;})['spread'](function(_0x3bfa18){var _0x57f2d9;_0x15cfce=_0x3bfa18||[];var _0x47986b=[];if(_0x3bfa18){for(var _0x4eed15=0x0;_0x4eed15<_0x3bfa18[_0x01b2('0x5d')];_0x4eed15+=0x1){var _0xe1c98f=_0x3bfa18[_0x4eed15][_0x01b2('0x2a')]({'plain':!![]});_0x57f2d9=squel[_0x01b2('0x99')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0x01b2('0x9d'),_0x01b2('0x9e'),_0x01b2('0x64'),_0x01b2('0x5f'),_0x01b2('0x60')],squel['select']()[_0x01b2('0x7f')](_0x01b2('0x9b'),_0x01b2('0x9b'))[_0x01b2('0x7f')]('id',_0x01b2('0x9d'))[_0x01b2('0x7f')](_0xe1c98f[_0x01b2('0xa2')][_0x01b2('0x85')](),_0x01b2('0x9e'))['field'](_0xa0dec9['params']['id'][_0x01b2('0x85')](),_0x01b2('0x64'))[_0x01b2('0x7f')](_0x01b2('0x9f'),'createdAt')[_0x01b2('0x7f')](_0x01b2('0x9f'),_0x01b2('0x60'))[_0x01b2('0xb0')](_0x01b2('0xa0'))[_0x01b2('0x45')]('deletedAt\x20IS\x20NULL')[_0x01b2('0x45')](_0x01b2('0xaa'),_0xe1c98f[_0x01b2('0xa2')][_0x01b2('0x85')]())[_0x01b2('0x45')](_0x01b2('0xa3')))[_0x01b2('0x85')]();_0x47986b[_0x01b2('0x84')](db[_0x01b2('0x73')][_0x01b2('0x3b')](_0x57f2d9));}return BPromise[_0x01b2('0x90')](_0x47986b);}})['then'](function(){return _0x15cfce;})['then'](respondWithResult(_0x56e8fe,null))['catch'](handleError(_0x56e8fe,null));};exports[_0x01b2('0xb1')]=function(_0x33488f,_0x11d3e0,_0x2468d7){return db['VoiceQueue'][_0x01b2('0x33')]({'where':{'id':_0x33488f[_0x01b2('0x50')]['id']}})[_0x01b2('0x28')](handleEntityNotFound(_0x11d3e0,null))[_0x01b2('0x28')](function(_0x48c7b7){if(_0x48c7b7){return _0x48c7b7['removeBlackLists'](_0x33488f['query'][_0x01b2('0x7d')]);}})[_0x01b2('0x28')](function(_0x3644f5){if(_0x3644f5){return db[_0x01b2('0x6a')][_0x01b2('0x29')]({'where':{'ListId':_0x33488f[_0x01b2('0x3b')][_0x01b2('0x7d')],'VoiceQueueId':_0x33488f['params']['id']}})[_0x01b2('0x28')](function(){return _0x3644f5;});}})[_0x01b2('0x28')](respondWithStatusCode(_0x11d3e0,null))[_0x01b2('0x4e')](handleError(_0x11d3e0,null));}; \ No newline at end of file +var _0x032e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','findOne','rawAttributes','CmHopper','rows','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','VoiceQueueId','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','SIP/%s','interface','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','every','TeamId','includes','all','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','find','type','error','stack','name','send','VoiceQueue','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','VIRTUAL','options','where','count','includeAll','include','findAll','show','params','filtears','catch','create','user'];(function(_0x472e17,_0x3c8d2c){var _0x58bddc=function(_0x379dbb){while(--_0x379dbb){_0x472e17['push'](_0x472e17['shift']());}};_0x58bddc(++_0x3c8d2c);}(_0x032e,0x124));var _0xe032=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x032e[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0xe032('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe032('0x1'));var zipdir=require(_0xe032('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe032('0x3'));var BPromise=require(_0xe032('0x4'));var Mustache=require(_0xe032('0x5'));var util=require(_0xe032('0x6'));var path=require(_0xe032('0x7'));var sox=require(_0xe032('0x8'));var csv=require(_0xe032('0x9'));var ejs=require(_0xe032('0xa'));var fs=require('fs');var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x9'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe032('0x1b')]=_[_0xe032('0x1c')](config[_0xe032('0x1b')],{'host':_0xe032('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe032('0x1b')]));require(_0xe032('0x1e'))[_0xe032('0x1f')](socket);function respondWithStatusCode(_0x422e96,_0x17b3aa){_0x17b3aa=_0x17b3aa||0xcc;return function(_0x3d92cb){if(_0x3d92cb){return _0x422e96[_0xe032('0x20')](_0x17b3aa);}return _0x422e96['status'](_0x17b3aa)[_0xe032('0x21')]();};}function respondWithResult(_0x749018,_0x36fb7c){_0x36fb7c=_0x36fb7c||0xc8;return function(_0x3b57d3){if(_0x3b57d3){return _0x749018[_0xe032('0x22')](_0x36fb7c)[_0xe032('0x23')](_0x3b57d3);}};}function respondWithFilteredResult(_0x4cdab3,_0x155f72){return function(_0x25cedb){if(_0x25cedb){var _0x1f9298=_0x25cedb['count'],_0x41d2a5=_0x155f72['offset'],_0x208c47=_0x155f72[_0xe032('0x24')]+_0x155f72['limit'],_0x5721ce;if(_0x208c47>=_0x1f9298){_0x208c47=_0x1f9298;_0x5721ce=0xc8;}else{_0x5721ce=0xce;}_0x4cdab3[_0xe032('0x22')](_0x5721ce);return _0x4cdab3[_0xe032('0x25')](_0xe032('0x26'),_0x41d2a5+'-'+_0x208c47+'/'+_0x1f9298)[_0xe032('0x23')](_0x25cedb);}return null;};}function patchUpdates(_0x288d91){return function(_0x256f71){try{jsonpatch[_0xe032('0x27')](_0x256f71,_0x288d91,!![]);}catch(_0x5a7b53){return BPromise[_0xe032('0x28')](_0x5a7b53);}return _0x256f71[_0xe032('0x29')]();};}function saveUpdates(_0x232e8f,_0x2be433){return function(_0x2ca592){if(_0x2ca592){return _0x2ca592[_0xe032('0x2a')](_0x232e8f)[_0xe032('0x2b')](function(_0xe89aa7){return _0xe89aa7;});}return null;};}function removeEntity(_0x499da5,_0x4f1aa3){return function(_0x4d8ded){if(_0x4d8ded){return _0x4d8ded[_0xe032('0x2c')]()[_0xe032('0x2b')](function(){var _0x302559=_0x4d8ded[_0xe032('0x2d')]({'plain':!![]});var _0x2bfe8f=[{'name':_0xe032('0x2e'),'value':_0xe032('0x2f'),'ignore':![]},{'name':_0xe032('0x30'),'value':_0xe032('0x31'),'ignore':![]}];var _0x1ac20b=_(_0x2bfe8f)['filter'](_0xe032('0x32'))[_0xe032('0x33')](_0xe032('0x34'))[_0xe032('0x34')]();if(_['includes'](_0x1ac20b,_0x302559['type'])){return;}var _0x3e2575=_[_0xe032('0x35')](_0x2bfe8f,[_0xe032('0x34'),_0x302559[_0xe032('0x36')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x3e2575,'resourceId':_0x302559['id']}})[_0xe032('0x2b')](function(){return _0x4d8ded;});})[_0xe032('0x2b')](function(){_0x499da5[_0xe032('0x22')](0xcc)[_0xe032('0x21')]();});}};}function handleEntityNotFound(_0x50db2d,_0x3b93e3){return function(_0x236da9){if(!_0x236da9){_0x50db2d[_0xe032('0x20')](0x194);}return _0x236da9;};}function handleError(_0x4348f8,_0x25810a){_0x25810a=_0x25810a||0x1f4;return function(_0x4a0198){logger[_0xe032('0x37')](_0x4a0198[_0xe032('0x38')]);if(_0x4a0198[_0xe032('0x39')]){delete _0x4a0198[_0xe032('0x39')];}_0x4348f8['status'](_0x25810a)[_0xe032('0x3a')](_0x4a0198);};}exports['index']=function(_0x2f3e59,_0x53df28){var _0x9d3199={},_0x4b0b21={},_0x2c1ec0={'count':0x0,'rows':[]};var _0x517df6=_[_0xe032('0x33')](db[_0xe032('0x3b')]['rawAttributes'],function(_0x3e3598){return{'name':_0x3e3598[_0xe032('0x3c')],'type':_0x3e3598[_0xe032('0x36')][_0xe032('0x3d')]};});_0x4b0b21['model']=_[_0xe032('0x33')](_0x517df6,'name');_0x4b0b21[_0xe032('0x3e')]=_[_0xe032('0x3f')](_0x2f3e59['query']);_0x4b0b21[_0xe032('0x40')]=_[_0xe032('0x41')](_0x4b0b21['model'],_0x4b0b21[_0xe032('0x3e')]);_0x9d3199[_0xe032('0x42')]=_[_0xe032('0x41')](_0x4b0b21[_0xe032('0x43')],qs[_0xe032('0x44')](_0x2f3e59[_0xe032('0x3e')][_0xe032('0x44')]));_0x9d3199[_0xe032('0x42')]=_0x9d3199[_0xe032('0x42')][_0xe032('0x45')]?_0x9d3199[_0xe032('0x42')]:_0x4b0b21[_0xe032('0x43')];if(!_0x2f3e59[_0xe032('0x3e')][_0xe032('0x46')](_0xe032('0x47'))){_0x9d3199[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x2f3e59['query'][_0xe032('0x48')]);_0x9d3199['offset']=qs[_0xe032('0x24')](_0x2f3e59[_0xe032('0x3e')][_0xe032('0x24')]);}_0x9d3199[_0xe032('0x49')]=qs[_0xe032('0x4a')](_0x2f3e59['query'][_0xe032('0x4a')]);_0x9d3199['where']=qs[_0xe032('0x40')](_['pick'](_0x2f3e59[_0xe032('0x3e')],_0x4b0b21[_0xe032('0x40')]),_0x517df6);if(_0x2f3e59[_0xe032('0x3e')][_0xe032('0x4b')]){_0x9d3199['where']=_[_0xe032('0x4c')](_0x9d3199['where'],{'$or':_[_0xe032('0x33')](_0x517df6,function(_0x21f586){if(_0x21f586[_0xe032('0x36')]!==_0xe032('0x4d')){var _0x4b58eb={};_0x4b58eb[_0x21f586['name']]={'$like':'%'+_0x2f3e59[_0xe032('0x3e')][_0xe032('0x4b')]+'%'};return _0x4b58eb;}})});}_0x9d3199=_['merge']({},_0x9d3199,_0x2f3e59[_0xe032('0x4e')]);var _0x3525af={'where':_0x9d3199[_0xe032('0x4f')]};return db[_0xe032('0x3b')][_0xe032('0x50')](_0x3525af)['then'](function(_0x3f7966){_0x2c1ec0[_0xe032('0x50')]=_0x3f7966;if(_0x2f3e59[_0xe032('0x3e')][_0xe032('0x51')]){_0x9d3199[_0xe032('0x52')]=[{'all':!![]}];}return db[_0xe032('0x3b')][_0xe032('0x53')](_0x9d3199);})[_0xe032('0x2b')](function(_0x5d21e6){_0x2c1ec0['rows']=_0x5d21e6;return _0x2c1ec0;})[_0xe032('0x2b')](respondWithFilteredResult(_0x53df28,_0x9d3199))['catch'](handleError(_0x53df28,null));};exports[_0xe032('0x54')]=function(_0x277207,_0x1873a6){var _0x13bc7e={'raw':![],'where':{'id':_0x277207[_0xe032('0x55')]['id']}},_0xe99b6b={};_0xe99b6b[_0xe032('0x43')]=_[_0xe032('0x3f')](db[_0xe032('0x3b')]['rawAttributes']);_0xe99b6b[_0xe032('0x3e')]=_['keys'](_0x277207['query']);_0xe99b6b[_0xe032('0x56')]=_[_0xe032('0x41')](_0xe99b6b[_0xe032('0x43')],_0xe99b6b[_0xe032('0x3e')]);_0x13bc7e['attributes']=_[_0xe032('0x41')](_0xe99b6b[_0xe032('0x43')],qs[_0xe032('0x44')](_0x277207[_0xe032('0x3e')][_0xe032('0x44')]));_0x13bc7e[_0xe032('0x42')]=_0x13bc7e[_0xe032('0x42')]['length']?_0x13bc7e[_0xe032('0x42')]:_0xe99b6b[_0xe032('0x43')];if(_0x277207['query'][_0xe032('0x51')]){_0x13bc7e[_0xe032('0x52')]=[{'all':!![]}];}_0x13bc7e=_[_0xe032('0x4c')]({},_0x13bc7e,_0x277207[_0xe032('0x4e')]);return db[_0xe032('0x3b')][_0xe032('0x35')](_0x13bc7e)[_0xe032('0x2b')](handleEntityNotFound(_0x1873a6,null))[_0xe032('0x2b')](respondWithResult(_0x1873a6,null))[_0xe032('0x57')](handleError(_0x1873a6,null));};exports[_0xe032('0x58')]=function(_0x3a0253,_0x2c1753){return db[_0xe032('0x3b')][_0xe032('0x58')](_0x3a0253['body'],{})[_0xe032('0x2b')](function(_0x53c8b2){var _0x1ad8cc=_0x3a0253[_0xe032('0x59')][_0xe032('0x2d')]({'plain':!![]});if(!_0x1ad8cc)throw new Error(_0xe032('0x5a'));if(_0x1ad8cc[_0xe032('0x5b')]===_0xe032('0x59')){var _0x2e29d3=_0x53c8b2[_0xe032('0x2d')]({'plain':!![]});var _0x16c91e=[{'name':_0xe032('0x2e'),'value':_0xe032('0x2f')},{'name':'QueueCampaigns','value':_0xe032('0x31')}];var _0x2683fe=_['find'](_0x16c91e,[_0xe032('0x34'),_0x2e29d3['type']])[_0xe032('0x39')];return db[_0xe032('0x5c')][_0xe032('0x35')]({'where':{'name':_0x2683fe,'userProfileId':_0x1ad8cc[_0xe032('0x5d')]},'raw':!![]})[_0xe032('0x2b')](function(_0x5f11f9){if(_0x5f11f9&&_0x5f11f9[_0xe032('0x5e')]===0x0){return db[_0xe032('0x5f')][_0xe032('0x58')]({'name':_0x2e29d3[_0xe032('0x39')],'resourceId':_0x2e29d3['id'],'type':_0x5f11f9[_0xe032('0x39')],'sectionId':_0x5f11f9['id']},{})[_0xe032('0x2b')](function(){return _0x53c8b2;});}else{return _0x53c8b2;}})[_0xe032('0x57')](function(_0x5c0423){logger[_0xe032('0x37')](_0xe032('0x60'),_0x5c0423);throw _0x5c0423;});}return _0x53c8b2;})[_0xe032('0x2b')](respondWithResult(_0x2c1753,0xc9))[_0xe032('0x57')](handleError(_0x2c1753,null));};exports[_0xe032('0x61')]=function(_0x42c0d7,_0x2c07e4){var _0x3a8adb={'where':{'id':_0x42c0d7['params']['id']}},_0x80d181={};_0x80d181[_0xe032('0x43')]=_[_0xe032('0x3f')](db[_0xe032('0x3b')]['rawAttributes']);_0x3a8adb[_0xe032('0x42')]=_[_0xe032('0x41')](_0x80d181['model'],qs[_0xe032('0x44')](_0x42c0d7[_0xe032('0x3e')][_0xe032('0x44')]));_0x3a8adb[_0xe032('0x42')]=_0x3a8adb[_0xe032('0x42')][_0xe032('0x45')]?_0x3a8adb[_0xe032('0x42')]:_0x80d181[_0xe032('0x43')];if(_0x42c0d7[_0xe032('0x3e')][_0xe032('0x51')]){_0x3a8adb[_0xe032('0x52')]=[{'all':!![]}];}_0x3a8adb=_['merge']({},_0x3a8adb,_0x42c0d7[_0xe032('0x4e')]);return db[_0xe032('0x3b')][_0xe032('0x35')](_0x3a8adb)[_0xe032('0x2b')](handleEntityNotFound(_0x2c07e4,null))[_0xe032('0x2b')](function(_0x4d305b){if(_0x4d305b){var _0x2b6ef8=_0x4d305b['get']({'plain':!![]});_0x2b6ef8=qs[_0xe032('0x62')](_0x2b6ef8,['id',_0xe032('0x63'),_0xe032('0x64')]);_0x42c0d7[_0xe032('0x65')]=_[_0xe032('0x62')](_0x42c0d7[_0xe032('0x65')],['id',_0xe032('0x63'),_0xe032('0x64')]);return db[_0xe032('0x3b')]['create'](_['merge'](_0x2b6ef8,_0x42c0d7['body']),{'include':_0x42c0d7[_0xe032('0x3e')][_0xe032('0x51')]?[{'all':!![]}]:undefined})[_0xe032('0x2b')](function(_0x3ed512){var _0x9567b=_0x42c0d7[_0xe032('0x59')]['get']({'plain':!![]});if(!_0x9567b)throw new Error(_0xe032('0x5a'));if(_0x9567b[_0xe032('0x5b')]===_0xe032('0x59')){var _0x5a1074=_0x3ed512[_0xe032('0x2d')]({'plain':!![]});var _0x522713=[{'name':_0xe032('0x2e'),'value':_0xe032('0x2f')},{'name':'QueueCampaigns','value':'outbound'}];var _0x542fcd=_[_0xe032('0x35')](_0x522713,['value',_0x5a1074['type']])[_0xe032('0x39')];return db[_0xe032('0x5c')][_0xe032('0x35')]({'where':{'name':_0x542fcd,'userProfileId':_0x9567b['userProfileId']},'raw':!![]})[_0xe032('0x2b')](function(_0x4b5f92){if(_0x4b5f92&&_0x4b5f92[_0xe032('0x5e')]===0x0){return db[_0xe032('0x5f')][_0xe032('0x58')]({'name':_0x5a1074[_0xe032('0x39')],'resourceId':_0x5a1074['id'],'type':_0x4b5f92[_0xe032('0x39')],'sectionId':_0x4b5f92['id']},{})[_0xe032('0x2b')](function(){return _0x3ed512;});}else{return _0x3ed512;}})[_0xe032('0x57')](function(_0x2bd7f9){logger[_0xe032('0x37')](_0xe032('0x60'),_0x2bd7f9);throw _0x2bd7f9;});}return _0x3ed512;});}})[_0xe032('0x2b')](respondWithResult(_0x2c07e4,0xc9))['catch'](handleError(_0x2c07e4,null));};exports[_0xe032('0x2a')]=function(_0x338ef2,_0x5aa7a6){if(_0x338ef2['body']['id']){delete _0x338ef2[_0xe032('0x65')]['id'];}return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x338ef2[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x5aa7a6,null))[_0xe032('0x2b')](saveUpdates(_0x338ef2['body'],null))[_0xe032('0x2b')](respondWithResult(_0x5aa7a6,null))[_0xe032('0x57')](handleError(_0x5aa7a6,null));};exports['destroy']=function(_0x97e141,_0x2ea4a5){return db[_0xe032('0x3b')]['find']({'where':{'id':_0x97e141[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x2ea4a5,null))[_0xe032('0x2b')](removeEntity(_0x2ea4a5,null))['catch'](handleError(_0x2ea4a5,null));};exports['getHoppers']=function(_0xdd691c,_0x529c5f,_0x2d1ea2){var _0x19facb={'raw':![],'where':{}};var _0x138459={};var _0x168dae={'count':0x0,'rows':[]};return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0xdd691c['params']['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x529c5f,null))[_0xe032('0x2b')](function(_0x33e7c3){if(_0x33e7c3){_0x138459['model']=_[_0xe032('0x3f')](db['CmHopper'][_0xe032('0x67')]);_0x138459['query']=_[_0xe032('0x3f')](_0xdd691c[_0xe032('0x3e')]);_0x138459[_0xe032('0x40')]=_['intersection'](_0x138459[_0xe032('0x43')],_0x138459[_0xe032('0x3e')]);_0x19facb[_0xe032('0x42')]=_[_0xe032('0x41')](_0x138459[_0xe032('0x43')],qs[_0xe032('0x44')](_0xdd691c['query'][_0xe032('0x44')]));_0x19facb[_0xe032('0x42')]=_0x19facb['attributes']['length']?_0x19facb[_0xe032('0x42')]:_0x138459[_0xe032('0x43')];if(!_0xdd691c[_0xe032('0x3e')][_0xe032('0x46')](_0xe032('0x47'))){_0x19facb['limit']=qs[_0xe032('0x48')](_0xdd691c['query'][_0xe032('0x48')]);_0x19facb['offset']=qs[_0xe032('0x24')](_0xdd691c[_0xe032('0x3e')][_0xe032('0x24')]);}_0x19facb[_0xe032('0x49')]=qs[_0xe032('0x4a')](_0xdd691c[_0xe032('0x3e')]['sort']);_0x19facb[_0xe032('0x4f')]=qs['filters'](_['pick'](_0xdd691c['query'],_0x138459[_0xe032('0x40')]));_0x19facb[_0xe032('0x4f')]['VoiceQueueId']=_0x33e7c3['id'];if(_0xdd691c[_0xe032('0x3e')]['filter']){_0x19facb['where']=_[_0xe032('0x4c')](_0x19facb[_0xe032('0x4f')],{'$or':_['map'](_0x19facb['attributes'],function(_0x45e28d){var _0x476120={};_0x476120[_0x45e28d]={'$like':'%'+_0xdd691c['query'][_0xe032('0x4b')]+'%'};return _0x476120;})});}_0x19facb=_[_0xe032('0x4c')]({},_0x19facb,_0xdd691c[_0xe032('0x4e')]);return db[_0xe032('0x68')]['count']({'where':_0x19facb[_0xe032('0x4f')]})['then'](function(_0x1caebf){_0x168dae[_0xe032('0x50')]=_0x1caebf;if(_0xdd691c[_0xe032('0x3e')]['includeAll']){_0x19facb[_0xe032('0x52')]=[{'all':!![]}];}return db[_0xe032('0x68')]['findAll'](_0x19facb);})[_0xe032('0x2b')](function(_0x1c5653){_0x168dae[_0xe032('0x69')]=_0x1c5653;return _0x168dae;});}})[_0xe032('0x2b')](respondWithFilteredResult(_0x529c5f,_0x19facb))[_0xe032('0x57')](handleError(_0x529c5f,null));};exports[_0xe032('0x6a')]=function(_0x540e03,_0x2f9512,_0x2d86e8){var _0x27eb0c={'raw':!![],'where':{}};var _0x83561f={};var _0x8b8998={'count':0x0,'rows':[]};return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0x540e03[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x2f9512,null))[_0xe032('0x2b')](function(_0x2d1c23){if(_0x2d1c23){_0x83561f['model']=_[_0xe032('0x3f')](db['CmHopperHistory'][_0xe032('0x67')]);_0x83561f['query']=_[_0xe032('0x3f')](_0x540e03[_0xe032('0x3e')]);_0x83561f['filters']=_[_0xe032('0x41')](_0x83561f['model'],_0x83561f['query']);_0x27eb0c['attributes']=_[_0xe032('0x41')](_0x83561f[_0xe032('0x43')],qs[_0xe032('0x44')](_0x540e03['query'][_0xe032('0x44')]));_0x27eb0c[_0xe032('0x42')]=_0x27eb0c[_0xe032('0x42')]['length']?_0x27eb0c[_0xe032('0x42')]:_0x83561f['model'];if(!_0x540e03[_0xe032('0x3e')][_0xe032('0x46')](_0xe032('0x47'))){_0x27eb0c[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x540e03[_0xe032('0x3e')][_0xe032('0x48')]);_0x27eb0c[_0xe032('0x24')]=qs[_0xe032('0x24')](_0x540e03[_0xe032('0x3e')]['offset']);}_0x27eb0c['order']=qs[_0xe032('0x4a')](_0x540e03[_0xe032('0x3e')][_0xe032('0x4a')]);_0x27eb0c[_0xe032('0x4f')]=qs['filters'](_[_0xe032('0x6b')](_0x540e03[_0xe032('0x3e')],_0x83561f[_0xe032('0x40')]));_0x27eb0c[_0xe032('0x4f')]['VoiceQueueId']=_0x2d1c23['id'];if(_0x540e03[_0xe032('0x3e')][_0xe032('0x4b')]){_0x27eb0c[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x27eb0c[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x27eb0c[_0xe032('0x42')],function(_0x573de4){var _0x59c18e={};_0x59c18e[_0x573de4]={'$like':'%'+_0x540e03['query']['filter']+'%'};return _0x59c18e;})});}_0x27eb0c=_['merge']({},_0x27eb0c,_0x540e03[_0xe032('0x4e')]);return db[_0xe032('0x6c')][_0xe032('0x50')]({'where':_0x27eb0c[_0xe032('0x4f')]})[_0xe032('0x2b')](function(_0x558af8){_0x8b8998[_0xe032('0x50')]=_0x558af8;if(_0x540e03[_0xe032('0x3e')][_0xe032('0x51')]){_0x27eb0c[_0xe032('0x52')]=[{'all':!![]}];}return db[_0xe032('0x6c')][_0xe032('0x53')](_0x27eb0c);})[_0xe032('0x2b')](function(_0x177937){_0x8b8998[_0xe032('0x69')]=_0x177937;return _0x8b8998;});}})['then'](respondWithFilteredResult(_0x2f9512,_0x27eb0c))['catch'](handleError(_0x2f9512,null));};exports['getHopperFinals']=function(_0x42ed1a,_0x48878d,_0x204cd3){var _0x459a75={'raw':!![],'where':{}};var _0x44b02a={};var _0x57a408={'count':0x0,'rows':[]};return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0x42ed1a[_0xe032('0x55')]['id']}})['then'](handleEntityNotFound(_0x48878d,null))['then'](function(_0x40ce2b){if(_0x40ce2b){_0x44b02a['model']=_[_0xe032('0x3f')](db[_0xe032('0x6d')][_0xe032('0x67')]);_0x44b02a[_0xe032('0x3e')]=_[_0xe032('0x3f')](_0x42ed1a[_0xe032('0x3e')]);_0x44b02a[_0xe032('0x40')]=_[_0xe032('0x41')](_0x44b02a[_0xe032('0x43')],_0x44b02a[_0xe032('0x3e')]);_0x459a75[_0xe032('0x42')]=_[_0xe032('0x41')](_0x44b02a[_0xe032('0x43')],qs[_0xe032('0x44')](_0x42ed1a['query'][_0xe032('0x44')]));_0x459a75['attributes']=_0x459a75[_0xe032('0x42')][_0xe032('0x45')]?_0x459a75[_0xe032('0x42')]:_0x44b02a['model'];if(!_0x42ed1a[_0xe032('0x3e')]['hasOwnProperty']('nolimit')){_0x459a75[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x42ed1a[_0xe032('0x3e')]['limit']);_0x459a75['offset']=qs[_0xe032('0x24')](_0x42ed1a['query'][_0xe032('0x24')]);}_0x459a75[_0xe032('0x49')]=qs[_0xe032('0x4a')](_0x42ed1a['query'][_0xe032('0x4a')]);_0x459a75[_0xe032('0x4f')]=qs[_0xe032('0x40')](_[_0xe032('0x6b')](_0x42ed1a[_0xe032('0x3e')],_0x44b02a[_0xe032('0x40')]));_0x459a75[_0xe032('0x4f')][_0xe032('0x6e')]=_0x40ce2b['id'];if(_0x42ed1a[_0xe032('0x3e')][_0xe032('0x4b')]){_0x459a75[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x459a75['where'],{'$or':_[_0xe032('0x33')](_0x459a75[_0xe032('0x42')],function(_0x3051eb){var _0xc54a7f={};_0xc54a7f[_0x3051eb]={'$like':'%'+_0x42ed1a['query'][_0xe032('0x4b')]+'%'};return _0xc54a7f;})});}_0x459a75=_[_0xe032('0x4c')]({},_0x459a75,_0x42ed1a[_0xe032('0x4e')]);return db['CmHopperFinal'][_0xe032('0x50')]({'where':_0x459a75[_0xe032('0x4f')]})[_0xe032('0x2b')](function(_0x16a745){_0x57a408[_0xe032('0x50')]=_0x16a745;if(_0x42ed1a[_0xe032('0x3e')]['includeAll']){_0x459a75['include']=[{'all':!![]}];}return db[_0xe032('0x6d')][_0xe032('0x53')](_0x459a75);})[_0xe032('0x2b')](function(_0x26802d){_0x57a408[_0xe032('0x69')]=_0x26802d;return _0x57a408;});}})['then'](respondWithFilteredResult(_0x48878d,_0x459a75))['catch'](handleError(_0x48878d,null));};exports[_0xe032('0x6f')]=function(_0x32a028,_0x145993,_0x2c7729){var _0x1f1cc8={'raw':!![],'where':{}};var _0x10af0c={};var _0x249999={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe032('0x66')]({'where':{'id':_0x32a028[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x145993,null))[_0xe032('0x2b')](function(_0x917a37){if(_0x917a37){_0x10af0c[_0xe032('0x43')]=_[_0xe032('0x3f')](db['CmHopperBlack'][_0xe032('0x67')]);_0x10af0c[_0xe032('0x3e')]=_['keys'](_0x32a028[_0xe032('0x3e')]);_0x10af0c[_0xe032('0x40')]=_[_0xe032('0x41')](_0x10af0c[_0xe032('0x43')],_0x10af0c['query']);_0x1f1cc8[_0xe032('0x42')]=_[_0xe032('0x41')](_0x10af0c[_0xe032('0x43')],qs['fields'](_0x32a028[_0xe032('0x3e')][_0xe032('0x44')]));_0x1f1cc8[_0xe032('0x42')]=_0x1f1cc8[_0xe032('0x42')][_0xe032('0x45')]?_0x1f1cc8[_0xe032('0x42')]:_0x10af0c[_0xe032('0x43')];if(!_0x32a028[_0xe032('0x3e')][_0xe032('0x46')]('nolimit')){_0x1f1cc8[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x32a028['query'][_0xe032('0x48')]);_0x1f1cc8[_0xe032('0x24')]=qs[_0xe032('0x24')](_0x32a028[_0xe032('0x3e')][_0xe032('0x24')]);}_0x1f1cc8['order']=qs[_0xe032('0x4a')](_0x32a028['query'][_0xe032('0x4a')]);_0x1f1cc8[_0xe032('0x4f')]=qs[_0xe032('0x40')](_['pick'](_0x32a028[_0xe032('0x3e')],_0x10af0c[_0xe032('0x40')]));_0x1f1cc8[_0xe032('0x4f')][_0xe032('0x6e')]=_0x917a37['id'];if(_0x32a028[_0xe032('0x3e')][_0xe032('0x4b')]){_0x1f1cc8[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x1f1cc8[_0xe032('0x4f')],{'$or':_['map'](_0x1f1cc8[_0xe032('0x42')],function(_0x12053f){var _0x34b884={};_0x34b884[_0x12053f]={'$like':'%'+_0x32a028[_0xe032('0x3e')][_0xe032('0x4b')]+'%'};return _0x34b884;})});}_0x1f1cc8=_[_0xe032('0x4c')]({},_0x1f1cc8,_0x32a028[_0xe032('0x4e')]);return db[_0xe032('0x70')][_0xe032('0x50')]({'where':_0x1f1cc8[_0xe032('0x4f')]})[_0xe032('0x2b')](function(_0xe64543){_0x249999[_0xe032('0x50')]=_0xe64543;if(_0x32a028['query']['includeAll']){_0x1f1cc8['include']=[{'all':!![]}];}return db[_0xe032('0x70')][_0xe032('0x53')](_0x1f1cc8);})[_0xe032('0x2b')](function(_0xf15fc3){_0x249999[_0xe032('0x69')]=_0xf15fc3;return _0x249999;});}})[_0xe032('0x2b')](respondWithFilteredResult(_0x145993,_0x1f1cc8))['catch'](handleError(_0x145993,null));};exports[_0xe032('0x71')]=function(_0x534c2f,_0x595335,_0xd6e712){var _0x17bc69={};var _0x2d68a2={};var _0xa8a51e;var _0x3ef62b;return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0x534c2f[_0xe032('0x55')]['id']}})['then'](handleEntityNotFound(_0x595335,null))['then'](function(_0x3d906e){if(_0x3d906e){_0xa8a51e=_0x3d906e;_0x2d68a2[_0xe032('0x43')]=_[_0xe032('0x3f')](db['Team'][_0xe032('0x67')]);_0x2d68a2[_0xe032('0x3e')]=_[_0xe032('0x3f')](_0x534c2f[_0xe032('0x3e')]);_0x2d68a2[_0xe032('0x40')]=_[_0xe032('0x41')](_0x2d68a2[_0xe032('0x43')],_0x2d68a2[_0xe032('0x3e')]);_0x17bc69[_0xe032('0x42')]=_[_0xe032('0x41')](_0x2d68a2['model'],qs[_0xe032('0x44')](_0x534c2f[_0xe032('0x3e')]['fields']));_0x17bc69[_0xe032('0x42')]=_0x17bc69['attributes']['length']?_0x17bc69[_0xe032('0x42')]:_0x2d68a2[_0xe032('0x43')];_0x17bc69[_0xe032('0x49')]=qs[_0xe032('0x4a')](_0x534c2f[_0xe032('0x3e')][_0xe032('0x4a')]);_0x17bc69['where']=qs['filters'](_[_0xe032('0x6b')](_0x534c2f[_0xe032('0x3e')],_0x2d68a2[_0xe032('0x40')]));if(_0x534c2f[_0xe032('0x3e')]['filter']){_0x17bc69[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x17bc69[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x17bc69[_0xe032('0x42')],function(_0x4c14de){var _0x10fe8d={};_0x10fe8d[_0x4c14de]={'$like':'%'+_0x534c2f['query'][_0xe032('0x4b')]+'%'};return _0x10fe8d;})});}_0x17bc69=_[_0xe032('0x4c')]({},_0x17bc69,_0x534c2f[_0xe032('0x4e')]);return _0xa8a51e[_0xe032('0x71')](_0x17bc69);}})[_0xe032('0x2b')](function(_0x21acfe){if(_0x21acfe){_0x3ef62b=_0x21acfe['length'];if(!_0x534c2f['query'][_0xe032('0x46')](_0xe032('0x47'))){_0x17bc69[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x534c2f[_0xe032('0x3e')][_0xe032('0x48')]);_0x17bc69[_0xe032('0x24')]=qs['offset'](_0x534c2f['query'][_0xe032('0x24')]);}return _0xa8a51e[_0xe032('0x71')](_0x17bc69);}})[_0xe032('0x2b')](function(_0x2f54f6){if(_0x2f54f6){return _0x2f54f6?{'count':_0x3ef62b,'rows':_0x2f54f6}:null;}})[_0xe032('0x2b')](respondWithResult(_0x595335,null))[_0xe032('0x57')](handleError(_0x595335,null));};exports[_0xe032('0x72')]=function(_0x1853cf,_0x3b872a,_0x27c70c){var _0x4bb105=_0x1853cf['body'][_0xe032('0x73')];var _0x415591=_[_0xe032('0x33')](_0x4bb105,'id');return db[_0xe032('0x74')]['findAll']({'where':{'id':_0x415591},'attributes':['id'],'include':[{'model':db[_0xe032('0x75')],'as':_0xe032('0x76'),'attributes':['id',_0xe032('0x39'),'online',_0xe032('0x77'),'interface'],'raw':!![]}]})[_0xe032('0x2b')](function(_0x44b7da){if(_0x44b7da){var _0x331663=_[_0xe032('0x78')](_0x44b7da,function(_0x3fa032){var _0xae173f=_0x3fa032[_0xe032('0x2d')]({'plain':!![]});_0xae173f[_0xe032('0x76')][_0xe032('0x79')](function(_0x37d3af){_0x37d3af[_0xe032('0x7a')]=_[_0xe032('0x35')](_0x4bb105,{'id':_0xae173f['id']})[_0xe032('0x7a')];});return _0xae173f[_0xe032('0x76')];});return db['VoiceQueue']['find']({'where':{'id':_0x1853cf[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](function(_0x4a7654){return db['sequelize'][_0xe032('0x7b')](function(_0x44acd4){return _0x4a7654['addTeams'](_0x415591,{'transaction':_0x44acd4})[_0xe032('0x2b')](function(){return BPromise[_0xe032('0x7c')](_0x331663,function(_0x454521){return db[_0xe032('0x7d')][_0xe032('0x7e')]({'where':{'UserId':_0x454521['id'],'VoiceQueueId':_0x1853cf[_0xe032('0x55')]['id']},'defaults':{'penalty':_0x454521[_0xe032('0x7a')]},'transaction':_0x44acd4});});})[_0xe032('0x2b')](function(){return BPromise[_0xe032('0x7c')](_[_0xe032('0x4b')](_0x331663,{'online':!![]}),function(_0x1f4477){return db[_0xe032('0x7f')][_0xe032('0x80')]({'membername':_0x1f4477['name'],'UserId':_0x1f4477['id'],'queue_name':_0x4a7654[_0xe032('0x39')],'VoiceQueueId':_0x4a7654['id'],'interface':_['isNil'](_0x1f4477['interface'])?util['format'](_0xe032('0x81'),_0x1f4477[_0xe032('0x39')]):_0x1f4477[_0xe032('0x82')],'paused':_0x1f4477[_0xe032('0x77')]||![],'penalty':_0x1f4477[_0xe032('0x7a')]},{'transaction':_0x44acd4});});})[_0xe032('0x2b')](function(){_0x331663[_0xe032('0x79')](function(_0x13015d){socket[_0xe032('0x83')](_0xe032('0x84'),{'UserId':_0x13015d['id'],'VoiceQueueId':_0x4a7654['id']});});});});});}})[_0xe032('0x2b')](respondWithStatusCode(_0x3b872a,null))[_0xe032('0x57')](handleError(_0x3b872a,null));};exports[_0xe032('0x85')]=function(_0x25e71a,_0x44baa9,_0x553c02){return db[_0xe032('0x74')]['findAll']({'where':{'id':_0x25e71a[_0xe032('0x3e')][_0xe032('0x86')]},'attributes':['id'],'include':[{'model':db[_0xe032('0x75')],'as':_0xe032('0x76'),'attributes':['id'],'raw':!![]}]})[_0xe032('0x2b')](handleEntityNotFound(_0x44baa9,null))['then'](function(_0x5d4e05){var _0x2fdc54=_['map'](_0x5d4e05,'id');var _0x322cf7=[];var _0x13de42=[];var _0x3d3cb7=squel[_0xe032('0x87')]();_0x3d3cb7['field'](_0xe032('0x88'))[_0xe032('0x89')](_0xe032('0x8a'),'tq')['join'](_0xe032('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe032('0x4f')](_0xe032('0x8c'),_0x25e71a[_0xe032('0x55')]['id']);for(var _0xc3dbc5=0x0;_0xc3dbc5<_0x5d4e05[_0xe032('0x45')];_0xc3dbc5+=0x1){let _0x36e640=_0x5d4e05[_0xc3dbc5];for(var _0xde0e37=0x0;_0xde0e37<_0x36e640[_0xe032('0x76')][_0xe032('0x45')];_0xde0e37+=0x1){let _0x337519=_0x36e640['Agents'][_0xde0e37];var _0x16a3e8=_0x3d3cb7[_0xe032('0x61')]();_0x16a3e8['where'](_0xe032('0x8d'),_0x337519['id']);_0x13de42['push'](db[_0xe032('0x8e')][_0xe032('0x3e')](_0x16a3e8['toString'](),{'type':db[_0xe032('0x8e')][_0xe032('0x8f')]['SELECT']})[_0xe032('0x2b')](function(_0x2ea03e){if(_0x2ea03e[_0xe032('0x45')]===0x1){return _0x337519['id'];}else{var _0x3f2ba5=_[_0xe032('0x90')](_['map'](_0x2ea03e,_0xe032('0x91')),function(_0x36bad3){return _[_0xe032('0x92')](_0x2fdc54,_0x36bad3);});if(_0x3f2ba5){return _0x337519['id'];}}}));}}return BPromise[_0xe032('0x93')](_0x13de42)[_0xe032('0x2b')](function(_0x1ce92f){_0x322cf7=_(_0x322cf7)[_0xe032('0x94')](_0x1ce92f)['compact']()[_0xe032('0x34')]();return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x25e71a['params']['id']}})[_0xe032('0x2b')](function(_0x6e8401){return db[_0xe032('0x8e')]['transaction'](function(_0x2b9c7d){return _0x6e8401[_0xe032('0x85')](_0x25e71a[_0xe032('0x3e')][_0xe032('0x86')],{'transaction':_0x2b9c7d})['then'](function(){if(!_[_0xe032('0x95')](_0x322cf7)){return _0x6e8401[_0xe032('0x96')](_0x322cf7,{'transaction':_0x2b9c7d})[_0xe032('0x2b')](function(){return db[_0xe032('0x7f')][_0xe032('0x2c')]({'where':{'VoiceQueueId':_0x25e71a['params']['id'],'UserId':_0x322cf7},'transaction':_0x2b9c7d});});}})[_0xe032('0x2b')](function(){_0x322cf7['forEach'](function(_0x19ad95){socket[_0xe032('0x83')](_0xe032('0x97'),{'UserId':_0x19ad95,'VoiceQueueId':_0x6e8401['id']});});});});});});})['then'](respondWithStatusCode(_0x44baa9,null))[_0xe032('0x57')](handleError(_0x44baa9,null));};exports[_0xe032('0x98')]=function(_0x854296,_0x6ab42b,_0x2f22b1){var _0x24714f,_0x4a5050;return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x854296[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x6ab42b,null))[_0xe032('0x2b')](function(_0x2e68a7){if(_0x2e68a7){_0x4a5050=_0x2e68a7;return _0x2e68a7[_0xe032('0x98')](_0x854296[_0xe032('0x65')][_0xe032('0x86')],_[_0xe032('0x62')](_0x854296[_0xe032('0x65')],[_0xe032('0x86'),'id'])||{})[_0xe032('0x99')](function(_0x347b23){for(var _0x2481f1=0x0;_0x2481f1<_0x854296[_0xe032('0x65')][_0xe032('0x86')][_0xe032('0x45')];_0x2481f1+=0x1){socket['emit'](_0xe032('0x84'),{'UserId':_0x854296['body'][_0xe032('0x86')][_0x2481f1],'VoiceQueueId':_0x854296[_0xe032('0x55')]['id']});}return _0x347b23;});}})[_0xe032('0x2b')](function(_0xf53f97){_0x24714f=_0xf53f97||[];if(_0x4a5050){return db['User'][_0xe032('0x53')]({'where':{'id':_0x854296[_0xe032('0x65')][_0xe032('0x86')]},'attributes':['id','name',_0xe032('0x9a'),_0xe032('0x77'),'interface'],'raw':!![]});}})[_0xe032('0x2b')](function(_0x374b01){if(!_[_0xe032('0x95')](_0x374b01)){var _0x3e52fd=[];for(var _0x2b2524=0x0;_0x2b2524<_0x374b01[_0xe032('0x45')];_0x2b2524++){if(_0x374b01[_0x2b2524]['online']){_0x3e52fd['push'](db[_0xe032('0x7f')][_0xe032('0x80')]({'membername':_0x374b01[_0x2b2524][_0xe032('0x39')],'UserId':_0x374b01[_0x2b2524]['id'],'queue_name':_0x4a5050[_0xe032('0x39')],'VoiceQueueId':_0x4a5050['id'],'interface':_[_0xe032('0x9b')](_0x374b01[_0x2b2524][_0xe032('0x82')])?util[_0xe032('0x9c')](_0xe032('0x81'),_0x374b01[_0x2b2524][_0xe032('0x39')]):_0x374b01[_0x2b2524][_0xe032('0x82')],'paused':_0x374b01[_0x2b2524][_0xe032('0x77')]||![],'penalty':_0x854296[_0xe032('0x65')][_0xe032('0x7a')]||0x0}));}}return BPromise[_0xe032('0x93')](_0x3e52fd);}})[_0xe032('0x2b')](function(){return _0x24714f;})[_0xe032('0x2b')](respondWithResult(_0x6ab42b,null))[_0xe032('0x57')](handleError(_0x6ab42b,null));};exports[_0xe032('0x96')]=function(_0x580c99,_0x587357,_0x5b5a91){return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x580c99[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x587357,null))[_0xe032('0x2b')](function(_0xe8e235){if(_0xe8e235){return _0xe8e235[_0xe032('0x96')](_0x580c99[_0xe032('0x3e')]['ids'])['then'](function(){if(_[_0xe032('0x9d')](_0x580c99[_0xe032('0x3e')][_0xe032('0x86')])){for(var _0x479828=0x0;_0x479828<_0x580c99[_0xe032('0x3e')][_0xe032('0x86')][_0xe032('0x45')];_0x479828+=0x1){socket[_0xe032('0x83')](_0xe032('0x97'),{'UserId':Number(_0x580c99['query']['ids'][_0x479828]),'VoiceQueueId':Number(_0x580c99[_0xe032('0x55')]['id'])});}}else{socket['emit'](_0xe032('0x97'),{'UserId':Number(_0x580c99[_0xe032('0x3e')][_0xe032('0x86')]),'VoiceQueueId':Number(_0x580c99[_0xe032('0x55')]['id'])});}});}})[_0xe032('0x2b')](function(_0x114138){return db[_0xe032('0x7f')][_0xe032('0x2c')]({'where':{'VoiceQueueId':_0x580c99[_0xe032('0x55')]['id'],'UserId':_0x580c99[_0xe032('0x3e')]['ids']}})['then'](function(){return _0x114138;});})[_0xe032('0x2b')](respondWithStatusCode(_0x587357,null))[_0xe032('0x57')](handleError(_0x587357,null));};exports['getAgents']=function(_0x4ce3e5,_0x55ac06,_0x2bbbf0){var _0x2816b6={};var _0x557932={};var _0x576934;var _0x47d9ff;return db['VoiceQueue'][_0xe032('0x66')]({'where':{'id':_0x4ce3e5[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x55ac06,null))[_0xe032('0x2b')](function(_0x4c3c03){if(_0x4c3c03){_0x576934=_0x4c3c03;_0x557932[_0xe032('0x43')]=_[_0xe032('0x3f')](db['User'][_0xe032('0x67')]);_0x557932[_0xe032('0x3e')]=_[_0xe032('0x3f')](_0x4ce3e5[_0xe032('0x3e')]);_0x557932[_0xe032('0x40')]=_[_0xe032('0x41')](_0x557932[_0xe032('0x43')],_0x557932['query']);_0x2816b6['attributes']=_[_0xe032('0x41')](_0x557932['model'],qs['fields'](_0x4ce3e5['query'][_0xe032('0x44')]));_0x2816b6[_0xe032('0x42')]=_0x2816b6[_0xe032('0x42')][_0xe032('0x45')]?_0x2816b6[_0xe032('0x42')]:_0x557932[_0xe032('0x43')];_0x2816b6['order']=qs[_0xe032('0x4a')](_0x4ce3e5['query'][_0xe032('0x4a')]);_0x2816b6[_0xe032('0x4f')]=qs[_0xe032('0x40')](_[_0xe032('0x6b')](_0x4ce3e5['query'],_0x557932[_0xe032('0x40')]));if(_0x4ce3e5['query'][_0xe032('0x4b')]){_0x2816b6['where']=_['merge'](_0x2816b6[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x2816b6[_0xe032('0x42')],function(_0x41608d){var _0x37db15={};_0x37db15[_0x41608d]={'$like':'%'+_0x4ce3e5[_0xe032('0x3e')][_0xe032('0x4b')]+'%'};return _0x37db15;})});}_0x2816b6=_[_0xe032('0x4c')]({},_0x2816b6,_0x4ce3e5[_0xe032('0x4e')]);return _0x576934[_0xe032('0x9e')](_0x2816b6);}})[_0xe032('0x2b')](function(_0x443d93){if(_0x443d93){_0x47d9ff=_0x443d93['length'];if(!_0x4ce3e5['query'][_0xe032('0x46')](_0xe032('0x47'))){_0x2816b6[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x4ce3e5['query'][_0xe032('0x48')]);_0x2816b6[_0xe032('0x24')]=qs[_0xe032('0x24')](_0x4ce3e5['query']['offset']);}return _0x576934[_0xe032('0x9e')](_0x2816b6);}})[_0xe032('0x2b')](function(_0x5e0603){if(_0x5e0603){return _0x5e0603?{'count':_0x47d9ff,'rows':_0x5e0603}:null;}})[_0xe032('0x2b')](respondWithResult(_0x55ac06,null))[_0xe032('0x57')](handleError(_0x55ac06,null));};exports[_0xe032('0x9f')]=function(_0x19d6e7,_0x2ea236,_0x15f173){var _0x3d69fe={};var _0x4f48a3={};var _0x148d1a;var _0x5155f2;return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0x19d6e7['params']['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x2ea236,null))[_0xe032('0x2b')](function(_0x53438f){if(_0x53438f){_0x148d1a=_0x53438f;_0x4f48a3[_0xe032('0x43')]=_['keys'](db[_0xe032('0x7f')][_0xe032('0x67')]);_0x4f48a3[_0xe032('0x3e')]=_[_0xe032('0x3f')](_0x19d6e7[_0xe032('0x3e')]);_0x4f48a3[_0xe032('0x40')]=_['intersection'](_0x4f48a3[_0xe032('0x43')],_0x4f48a3[_0xe032('0x3e')]);_0x3d69fe[_0xe032('0x42')]=_[_0xe032('0x41')](_0x4f48a3[_0xe032('0x43')],qs[_0xe032('0x44')](_0x19d6e7[_0xe032('0x3e')][_0xe032('0x44')]));_0x3d69fe[_0xe032('0x42')]=_0x3d69fe[_0xe032('0x42')][_0xe032('0x45')]?_0x3d69fe['attributes']:_0x4f48a3[_0xe032('0x43')];_0x3d69fe['order']=qs[_0xe032('0x4a')](_0x19d6e7['query'][_0xe032('0x4a')]);_0x3d69fe[_0xe032('0x4f')]=qs[_0xe032('0x40')](_['pick'](_0x19d6e7[_0xe032('0x3e')],_0x4f48a3['filters']));if(_0x19d6e7['query'][_0xe032('0x4b')]){_0x3d69fe[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x3d69fe[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x3d69fe[_0xe032('0x42')],function(_0x558ab0){var _0x386075={};_0x386075[_0x558ab0]={'$like':'%'+_0x19d6e7[_0xe032('0x3e')][_0xe032('0x4b')]+'%'};return _0x386075;})});}_0x3d69fe=_[_0xe032('0x4c')]({},_0x3d69fe,_0x19d6e7[_0xe032('0x4e')]);return _0x148d1a[_0xe032('0x9f')](_0x3d69fe);}})['then'](function(_0x177b53){if(_0x177b53){_0x5155f2=_0x177b53['length'];if(!_0x19d6e7[_0xe032('0x3e')][_0xe032('0x46')]('nolimit')){_0x3d69fe[_0xe032('0x48')]=qs['limit'](_0x19d6e7[_0xe032('0x3e')][_0xe032('0x48')]);_0x3d69fe[_0xe032('0x24')]=qs[_0xe032('0x24')](_0x19d6e7[_0xe032('0x3e')][_0xe032('0x24')]);}return _0x148d1a['getMembers'](_0x3d69fe);}})[_0xe032('0x2b')](function(_0x453974){return _0x453974?{'count':_0x5155f2,'rows':_0x453974}:null;})['then'](respondWithResult(_0x2ea236,null))['catch'](handleError(_0x2ea236,null));};exports[_0xe032('0xa0')]=function(_0x3caaf6,_0x5071b6,_0x57ac72){var _0x50f3c8={};var _0x543b07={};var _0x239ebe;var _0x3037e4;return db[_0xe032('0x3b')]['findOne']({'where':{'id':_0x3caaf6[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x5071b6,null))['then'](function(_0x203ce2){if(_0x203ce2){_0x239ebe=_0x203ce2;_0x543b07[_0xe032('0x43')]=_[_0xe032('0x3f')](db[_0xe032('0xa1')]['rawAttributes']);_0x543b07['query']=_[_0xe032('0x3f')](_0x3caaf6[_0xe032('0x3e')]);_0x543b07[_0xe032('0x40')]=_[_0xe032('0x41')](_0x543b07['model'],_0x543b07[_0xe032('0x3e')]);_0x50f3c8['attributes']=_[_0xe032('0x41')](_0x543b07[_0xe032('0x43')],qs[_0xe032('0x44')](_0x3caaf6['query']['fields']));_0x50f3c8[_0xe032('0x42')]=_0x50f3c8[_0xe032('0x42')][_0xe032('0x45')]?_0x50f3c8[_0xe032('0x42')]:_0x543b07['model'];_0x50f3c8['order']=qs[_0xe032('0x4a')](_0x3caaf6['query'][_0xe032('0x4a')]);_0x50f3c8[_0xe032('0x4f')]=qs[_0xe032('0x40')](_['pick'](_0x3caaf6[_0xe032('0x3e')],_0x543b07['filters']));if(_0x3caaf6['query']['filter']){_0x50f3c8[_0xe032('0x4f')]=_[_0xe032('0x4c')](_0x50f3c8[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x50f3c8[_0xe032('0x42')],function(_0x11d7c1){var _0x46abda={};_0x46abda[_0x11d7c1]={'$like':'%'+_0x3caaf6[_0xe032('0x3e')]['filter']+'%'};return _0x46abda;})});}_0x50f3c8=_[_0xe032('0x4c')]({},_0x50f3c8,_0x3caaf6[_0xe032('0x4e')]);return _0x239ebe[_0xe032('0xa0')](_0x50f3c8);}})['then'](function(_0x4a183b){if(_0x4a183b){_0x3037e4=_0x4a183b[_0xe032('0x45')];if(!_0x3caaf6[_0xe032('0x3e')][_0xe032('0x46')](_0xe032('0x47'))){_0x50f3c8[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x3caaf6['query'][_0xe032('0x48')]);_0x50f3c8[_0xe032('0x24')]=qs['offset'](_0x3caaf6['query'][_0xe032('0x24')]);}return _0x239ebe[_0xe032('0xa0')](_0x50f3c8);}})['then'](function(_0xe71d23){if(_0xe71d23){return _0xe71d23?{'count':_0x3037e4,'rows':_0xe71d23}:null;}})[_0xe032('0x2b')](respondWithResult(_0x5071b6,null))[_0xe032('0x57')](handleError(_0x5071b6,null));};exports[_0xe032('0xa2')]=function(_0x3829d8,_0x1f3c12,_0x12ead6){var _0xdb9299,_0x961d7e;return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x3829d8[_0xe032('0x55')]['id']}})['then'](handleEntityNotFound(_0x1f3c12,null))[_0xe032('0x2b')](function(_0x56b849){if(_0x56b849){_0x961d7e=_0x56b849;return _0x56b849['addLists'](_0x3829d8[_0xe032('0x65')][_0xe032('0x86')],_['omit'](_0x3829d8[_0xe032('0x65')],[_0xe032('0x86'),'id'])||{});}return null;})['spread'](function(_0x113ae1){var _0x82f448;_0xdb9299=_0x113ae1||[];var _0x161b88=[];if(_0x113ae1){for(var _0x1ecb90=0x0;_0x1ecb90<_0x113ae1['length'];_0x1ecb90+=0x1){var _0x35a5a7=_0x113ae1[_0x1ecb90]['get']({'plain':!![]});_0x961d7e[_0xe032('0xa3')]=_0x3829d8['body'][_0xe032('0xa3')]?_0x3829d8[_0xe032('0x65')][_0xe032('0xa3')]:_0x961d7e['dialCheckDuplicateType'];switch(_0x961d7e[_0xe032('0xa3')]){case'always':_0x82f448=squel[_0xe032('0xa4')]()[_0xe032('0xa5')](_0xe032('0xa6'))['fromQuery']([_0xe032('0xa7'),_0xe032('0xa8'),_0xe032('0xa9'),_0xe032('0xaa'),'VoiceQueueId',_0xe032('0x63'),'updatedAt'],squel['select']()[_0xe032('0xab')](_0xe032('0xa7'),_0xe032('0xa7'))['field'](_0xe032('0xac'),_0xe032('0xa8'))[_0xe032('0xab')]('id','ContactId')[_0xe032('0xab')](_0x35a5a7[_0xe032('0xad')]['toString'](),_0xe032('0xaa'))[_0xe032('0xab')](_0x3829d8[_0xe032('0x55')]['id']['toString'](),_0xe032('0x6e'))[_0xe032('0xab')]('NOW()',_0xe032('0x63'))[_0xe032('0xab')](_0xe032('0xac'),_0xe032('0x64'))[_0xe032('0x89')](_0xe032('0xae'))[_0xe032('0x4f')](_0xe032('0xaf'))[_0xe032('0x4f')](_0xe032('0xb0'),_0x35a5a7[_0xe032('0xad')][_0xe032('0xb1')]())[_0xe032('0x4f')]('phone\x20IS\x20NOT\x20NULL')[_0xe032('0x4f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe032('0x87')]()[_0xe032('0xab')](_0xe032('0xb2'))['from'](_0xe032('0xb3'))[_0xe032('0x4f')](_0xe032('0x8c'),_0x3829d8[_0xe032('0x55')]['id']['toString']()))[_0xe032('0x4f')](_0xe032('0xb4'),squel[_0xe032('0x87')]()[_0xe032('0xab')](_0xe032('0xb5'))[_0xe032('0x89')]('cm_hopper')['where'](_0xe032('0x8c'),_0x3829d8[_0xe032('0x55')]['id'][_0xe032('0xb1')]())))['toString']();break;case _0xe032('0xb6'):_0x82f448=squel[_0xe032('0xa4')]()[_0xe032('0xa5')](_0xe032('0xa6'))[_0xe032('0xb7')]([_0xe032('0xa7'),'scheduledAt',_0xe032('0xa9'),_0xe032('0xaa'),_0xe032('0x6e'),_0xe032('0x63'),_0xe032('0x64')],squel[_0xe032('0x87')]()['field'](_0xe032('0xa7'),_0xe032('0xa7'))['field'](_0xe032('0xac'),'scheduledAt')['field']('id',_0xe032('0xa9'))[_0xe032('0xab')](_0x35a5a7[_0xe032('0xad')]['toString'](),_0xe032('0xaa'))[_0xe032('0xab')](_0x3829d8[_0xe032('0x55')]['id']['toString'](),_0xe032('0x6e'))['field'](_0xe032('0xac'),_0xe032('0x63'))['field'](_0xe032('0xac'),_0xe032('0x64'))[_0xe032('0x89')](_0xe032('0xae'))[_0xe032('0x4f')](_0xe032('0xaf'))['where'](_0xe032('0xb0'),_0x35a5a7[_0xe032('0xad')]['toString']())[_0xe032('0x4f')](_0xe032('0xb8'))[_0xe032('0x4f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe032('0x87')]()[_0xe032('0xab')]('COALESCE(phone,\x27\x27)')[_0xe032('0x89')](_0xe032('0xa6'))[_0xe032('0x4f')]('VoiceQueueId\x20=\x20?',_0x3829d8[_0xe032('0x55')]['id'][_0xe032('0xb1')]())))[_0xe032('0xb1')]();break;default:_0x82f448=squel[_0xe032('0xa4')]()['into'](_0xe032('0xa6'))[_0xe032('0xb7')]([_0xe032('0xa7'),_0xe032('0xa8'),'ContactId','ListId',_0xe032('0x6e'),_0xe032('0x63'),_0xe032('0x64')],squel['select']()[_0xe032('0xab')](_0xe032('0xa7'),_0xe032('0xa7'))[_0xe032('0xab')](_0xe032('0xac'),_0xe032('0xa8'))[_0xe032('0xab')]('id',_0xe032('0xa9'))['field'](_0x35a5a7['CmListId'][_0xe032('0xb1')](),_0xe032('0xaa'))[_0xe032('0xab')](_0x3829d8['params']['id'][_0xe032('0xb1')](),_0xe032('0x6e'))[_0xe032('0xab')]('NOW()',_0xe032('0x63'))[_0xe032('0xab')](_0xe032('0xac'),'updatedAt')[_0xe032('0x89')](_0xe032('0xae'))[_0xe032('0x4f')](_0xe032('0xaf'))[_0xe032('0x4f')](_0xe032('0xb0'),_0x35a5a7['CmListId'][_0xe032('0xb1')]())[_0xe032('0x4f')](_0xe032('0xb8')))[_0xe032('0xb1')]();}_0x161b88['push'](db[_0xe032('0x8e')][_0xe032('0x3e')](_0x82f448));}return BPromise[_0xe032('0x93')](_0x161b88);}})[_0xe032('0x2b')](function(){return _0xdb9299;})[_0xe032('0x2b')](respondWithResult(_0x1f3c12,null))['catch'](handleError(_0x1f3c12,null));};exports['removeLists']=function(_0x487222,_0x1cde80,_0xbb87ef){return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x487222['params']['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x1cde80,null))[_0xe032('0x2b')](function(_0x4da658){if(_0x4da658){return _0x4da658[_0xe032('0xb9')](_0x487222['query'][_0xe032('0x86')]);}})[_0xe032('0x2b')](function(_0x21d935){if(_0x21d935){return db[_0xe032('0x68')][_0xe032('0x2c')]({'where':{'ListId':_0x487222[_0xe032('0x3e')][_0xe032('0x86')],'VoiceQueueId':_0x487222['params']['id']}})['then'](function(){return _0x21d935;});}})[_0xe032('0x2b')](respondWithStatusCode(_0x1cde80,null))[_0xe032('0x57')](handleError(_0x1cde80,null));};exports['getBlackLists']=function(_0x233748,_0x1573b7,_0x55c750){var _0x38929f={};var _0x235534={};var _0x3291b0;var _0x334d9a;return db[_0xe032('0x3b')][_0xe032('0x66')]({'where':{'id':_0x233748[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x1573b7,null))[_0xe032('0x2b')](function(_0x2c6046){if(_0x2c6046){_0x3291b0=_0x2c6046;_0x235534[_0xe032('0x43')]=_[_0xe032('0x3f')](db['CmList'][_0xe032('0x67')]);_0x235534[_0xe032('0x3e')]=_['keys'](_0x233748[_0xe032('0x3e')]);_0x235534[_0xe032('0x40')]=_['intersection'](_0x235534[_0xe032('0x43')],_0x235534['query']);_0x38929f[_0xe032('0x42')]=_[_0xe032('0x41')](_0x235534[_0xe032('0x43')],qs[_0xe032('0x44')](_0x233748[_0xe032('0x3e')][_0xe032('0x44')]));_0x38929f[_0xe032('0x42')]=_0x38929f[_0xe032('0x42')]['length']?_0x38929f[_0xe032('0x42')]:_0x235534['model'];_0x38929f[_0xe032('0x49')]=qs[_0xe032('0x4a')](_0x233748[_0xe032('0x3e')][_0xe032('0x4a')]);_0x38929f['where']=qs[_0xe032('0x40')](_['pick'](_0x233748[_0xe032('0x3e')],_0x235534[_0xe032('0x40')]));if(_0x233748[_0xe032('0x3e')][_0xe032('0x4b')]){_0x38929f['where']=_[_0xe032('0x4c')](_0x38929f[_0xe032('0x4f')],{'$or':_[_0xe032('0x33')](_0x38929f[_0xe032('0x42')],function(_0x4d4d94){var _0xfe69ae={};_0xfe69ae[_0x4d4d94]={'$like':'%'+_0x233748[_0xe032('0x3e')][_0xe032('0x4b')]+'%'};return _0xfe69ae;})});}_0x38929f=_[_0xe032('0x4c')]({},_0x38929f,_0x233748['options']);return _0x3291b0[_0xe032('0xba')](_0x38929f);}})[_0xe032('0x2b')](function(_0x41cca0){if(_0x41cca0){_0x334d9a=_0x41cca0[_0xe032('0x45')];if(!_0x233748[_0xe032('0x3e')][_0xe032('0x46')]('nolimit')){_0x38929f[_0xe032('0x48')]=qs[_0xe032('0x48')](_0x233748[_0xe032('0x3e')][_0xe032('0x48')]);_0x38929f['offset']=qs['offset'](_0x233748[_0xe032('0x3e')][_0xe032('0x24')]);}return _0x3291b0[_0xe032('0xba')](_0x38929f);}})[_0xe032('0x2b')](function(_0x19e749){if(_0x19e749){return _0x19e749?{'count':_0x334d9a,'rows':_0x19e749}:null;}})['then'](respondWithResult(_0x1573b7,null))[_0xe032('0x57')](handleError(_0x1573b7,null));};exports[_0xe032('0xbb')]=function(_0x32a6d7,_0x294dc2,_0x56bdf1){var _0x15e76e,_0x46b1f3;return db['VoiceQueue'][_0xe032('0x35')]({'where':{'id':_0x32a6d7['params']['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x294dc2,null))[_0xe032('0x2b')](function(_0x18ef9f){if(_0x18ef9f){_0x46b1f3=_0x18ef9f;return _0x18ef9f[_0xe032('0xbb')](_0x32a6d7[_0xe032('0x65')]['ids'],_['omit'](_0x32a6d7['body'],[_0xe032('0x86'),'id'])||{});}return null;})[_0xe032('0x99')](function(_0x2cfbc6){var _0x19ad44;_0x15e76e=_0x2cfbc6||[];var _0x1a493e=[];if(_0x2cfbc6){for(var _0xcbf2b3=0x0;_0xcbf2b3<_0x2cfbc6[_0xe032('0x45')];_0xcbf2b3+=0x1){var _0xcde7e=_0x2cfbc6[_0xcbf2b3]['get']({'plain':!![]});_0x19ad44=squel[_0xe032('0xa4')]()['into'](_0xe032('0xbc'))[_0xe032('0xb7')](['phone',_0xe032('0xa9'),_0xe032('0xaa'),'VoiceQueueId','createdAt',_0xe032('0x64')],squel[_0xe032('0x87')]()[_0xe032('0xab')]('phone','phone')['field']('id',_0xe032('0xa9'))[_0xe032('0xab')](_0xcde7e[_0xe032('0xad')][_0xe032('0xb1')](),_0xe032('0xaa'))[_0xe032('0xab')](_0x32a6d7[_0xe032('0x55')]['id'][_0xe032('0xb1')](),_0xe032('0x6e'))[_0xe032('0xab')](_0xe032('0xac'),_0xe032('0x63'))[_0xe032('0xab')](_0xe032('0xac'),'updatedAt')[_0xe032('0x89')](_0xe032('0xae'))['where'](_0xe032('0xaf'))[_0xe032('0x4f')](_0xe032('0xb0'),_0xcde7e[_0xe032('0xad')][_0xe032('0xb1')]())['where'](_0xe032('0xb8')))[_0xe032('0xb1')]();_0x1a493e[_0xe032('0xbd')](db[_0xe032('0x8e')][_0xe032('0x3e')](_0x19ad44));}return BPromise[_0xe032('0x93')](_0x1a493e);}})[_0xe032('0x2b')](function(){return _0x15e76e;})[_0xe032('0x2b')](respondWithResult(_0x294dc2,null))[_0xe032('0x57')](handleError(_0x294dc2,null));};exports[_0xe032('0xbe')]=function(_0x5d35b0,_0x39fb62,_0x1aca4d){return db[_0xe032('0x3b')][_0xe032('0x35')]({'where':{'id':_0x5d35b0[_0xe032('0x55')]['id']}})[_0xe032('0x2b')](handleEntityNotFound(_0x39fb62,null))[_0xe032('0x2b')](function(_0x2c098d){if(_0x2c098d){return _0x2c098d['removeBlackLists'](_0x5d35b0[_0xe032('0x3e')]['ids']);}})[_0xe032('0x2b')](function(_0x26d88d){if(_0x26d88d){return db[_0xe032('0x70')]['destroy']({'where':{'ListId':_0x5d35b0[_0xe032('0x3e')][_0xe032('0x86')],'VoiceQueueId':_0x5d35b0['params']['id']}})['then'](function(){return _0x26d88d;});}})[_0xe032('0x2b')](respondWithStatusCode(_0x39fb62,null))[_0xe032('0x57')](handleError(_0x39fb62,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index bebdee2..fca4185 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 _0x2f2d=['hook','exports','events','../../mysqldb','VoiceQueue','update','remove','emit','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2f2d,0x173));var _0xd2f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f2d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd2f2('0x0'));var VoiceQueue=require(_0xd2f2('0x1'))['db'][_0xd2f2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd2f2('0x3'),'afterDestroy':_0xd2f2('0x4')};function emitEvent(_0x16dcc1){return function(_0x6bffe5,_0x4d28f7,_0x2366d9){VoiceQueueEvents[_0xd2f2('0x5')](_0x16dcc1+':'+_0x6bffe5['id'],_0x6bffe5);VoiceQueueEvents[_0xd2f2('0x5')](_0x16dcc1,_0x6bffe5);_0x2366d9(null);};}for(var e in events){if(events[_0xd2f2('0x6')](e)){var event=events[e];VoiceQueue[_0xd2f2('0x7')](e,emitEvent(event));}}module[_0xd2f2('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3bf9=['save','update','remove','emit','hook','exports','events','VoiceQueue','setMaxListeners'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x3bf9,0x102));var _0x93bf=function(_0x25678f,_0x5958d5){_0x25678f=_0x25678f-0x0;var _0x1961b5=_0x3bf9[_0x25678f];return _0x1961b5;};'use strict';var EventEmitter=require(_0x93bf('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x93bf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x93bf('0x2')](0x0);var events={'afterCreate':_0x93bf('0x3'),'afterUpdate':_0x93bf('0x4'),'afterDestroy':_0x93bf('0x5')};function emitEvent(_0x4f69b6){return function(_0x4b4393,_0x2cbd52,_0x15b0fd){VoiceQueueEvents[_0x93bf('0x6')](_0x4f69b6+':'+_0x4b4393['id'],_0x4b4393);VoiceQueueEvents[_0x93bf('0x6')](_0x4f69b6,_0x4b4393);_0x15b0fd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x93bf('0x7')](e,emitEvent(event));}}module[_0x93bf('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2a2ac88..d8d5657 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 _0xfaf4=['exports','VoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xfaf4,0x1ee));var _0x4faf=function(_0xc4536a,_0xdf3c89){_0xc4536a=_0xc4536a-0x0;var _0x3b8c96=_0xfaf4[_0xc4536a];return _0x3b8c96;};'use strict';var _=require(_0x4faf('0x0'));var util=require(_0x4faf('0x1'));var logger=require(_0x4faf('0x2'))(_0x4faf('0x3'));var moment=require(_0x4faf('0x4'));var BPromise=require(_0x4faf('0x5'));var rp=require(_0x4faf('0x6'));var fs=require('fs');var path=require(_0x4faf('0x7'));var rimraf=require(_0x4faf('0x8'));var config=require('../../config/environment');var attributes=require(_0x4faf('0x9'));module[_0x4faf('0xa')]=function(_0x247ea2,_0x3c4e50){return _0x247ea2['define'](_0x4faf('0xb'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d8d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','voice_queues'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9d8d,0x78));var _0xd9d8=function(_0x821ca6,_0xaa0361){_0x821ca6=_0x821ca6-0x0;var _0x7ca1bc=_0x9d8d[_0x821ca6];return _0x7ca1bc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd9d8('0x0'))(_0xd9d8('0x1'));var moment=require(_0xd9d8('0x2'));var BPromise=require(_0xd9d8('0x3'));var rp=require(_0xd9d8('0x4'));var fs=require('fs');var path=require(_0xd9d8('0x5'));var rimraf=require(_0xd9d8('0x6'));var config=require(_0xd9d8('0x7'));var attributes=require(_0xd9d8('0x8'));module[_0xd9d8('0x9')]=function(_0xeb4460,_0x194adf){return _0xeb4460['define'](_0xd9d8('0xa'),attributes,{'tableName':_0xd9d8('0xb'),'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 908edca..b1c2294 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 _0xbc7e=['message','result','catch','VoiceQueue','findAll','raw','options','where','limit','include','map','model','attributes','GetVoiceQueue','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','debug','request\x20sent','stringify','error','VoiceQueue,\x20%s,\x20%s'];(function(_0x41734a,_0x310561){var _0x34b23f=function(_0x4b888a){while(--_0x4b888a){_0x41734a['push'](_0x41734a['shift']());}};_0x34b23f(++_0x310561);}(_0xbc7e,0xff));var _0xebc7=function(_0x276167,_0x21086e){_0x276167=_0x276167-0x0;var _0x27a866=_0xbc7e[_0x276167];return _0x27a866;};'use strict';var _=require(_0xebc7('0x0'));var util=require(_0xebc7('0x1'));var moment=require(_0xebc7('0x2'));var BPromise=require(_0xebc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebc7('0x4'));var db=require(_0xebc7('0x5'))['db'];var utils=require(_0xebc7('0x6'));var logger=require('../../config/logger')(_0xebc7('0x7'));var config=require(_0xebc7('0x8'));var jayson=require(_0xebc7('0x9'));var client=jayson[_0xebc7('0xa')][_0xebc7('0xb')]({'port':0x232a});config[_0xebc7('0xc')]=_[_0xebc7('0xd')](config[_0xebc7('0xc')],{'host':_0xebc7('0xe'),'port':0x18eb});var socket=require(_0xebc7('0xf'))(new Redis(config[_0xebc7('0xc')]));require(_0xebc7('0x10'))[_0xebc7('0x11')](socket);function respondWithRpcPromise(_0x93e090,_0x3bc545,_0x4e2688){return new BPromise(function(_0x4fc81b,_0x7f14af){return client['request'](_0x93e090,_0x4e2688)[_0xebc7('0x12')](function(_0x327439){logger[_0xebc7('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3bc545,'request\x20sent');logger[_0xebc7('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3bc545,_0xebc7('0x15'),JSON[_0xebc7('0x16')](_0x327439));if(_0x327439[_0xebc7('0x17')]){if(_0x327439[_0xebc7('0x17')]['code']===0x1f4){logger['error'](_0xebc7('0x18'),_0x3bc545,_0x327439[_0xebc7('0x17')][_0xebc7('0x19')]);return _0x7f14af(_0x327439[_0xebc7('0x17')][_0xebc7('0x19')]);}logger[_0xebc7('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x3bc545,_0x327439[_0xebc7('0x17')][_0xebc7('0x19')]);return _0x4fc81b(_0x327439['error'][_0xebc7('0x19')]);}else{logger[_0xebc7('0x13')](_0xebc7('0x18'),_0x3bc545,_0xebc7('0x15'));_0x4fc81b(_0x327439[_0xebc7('0x1a')][_0xebc7('0x19')]);}})[_0xebc7('0x1b')](function(_0x3e00e1){logger[_0xebc7('0x17')](_0xebc7('0x18'),_0x3bc545,_0x3e00e1);_0x7f14af(_0x3e00e1);});});}exports['GetVoiceQueue']=function(_0x40fdb7){var _0x571f4c=this;return new Promise(function(_0x2efb27,_0x13ecba){return db[_0xebc7('0x1c')][_0xebc7('0x1d')]({'raw':_0x40fdb7['options']?_0x40fdb7['options'][_0xebc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x40fdb7[_0xebc7('0x1f')]?_0x40fdb7[_0xebc7('0x1f')][_0xebc7('0x20')]||null:null,'attributes':_0x40fdb7[_0xebc7('0x1f')]?_0x40fdb7[_0xebc7('0x1f')]['attributes']||null:null,'limit':_0x40fdb7[_0xebc7('0x1f')]?_0x40fdb7[_0xebc7('0x1f')][_0xebc7('0x21')]||null:null,'include':_0x40fdb7[_0xebc7('0x1f')]?_0x40fdb7['options'][_0xebc7('0x22')]?_[_0xebc7('0x23')](_0x40fdb7[_0xebc7('0x1f')][_0xebc7('0x22')],function(_0xe678c6){return{'model':db[_0xe678c6[_0xebc7('0x24')]],'as':_0xe678c6['as'],'attributes':_0xe678c6[_0xebc7('0x25')],'include':_0xe678c6[_0xebc7('0x22')]?_[_0xebc7('0x23')](_0xe678c6[_0xebc7('0x22')],function(_0x4238fd){return{'model':db[_0x4238fd[_0xebc7('0x24')]],'as':_0x4238fd['as'],'attributes':_0x4238fd[_0xebc7('0x25')],'include':_0x4238fd['include']?_[_0xebc7('0x23')](_0x4238fd['include'],function(_0x46bd46){return{'model':db[_0x46bd46[_0xebc7('0x24')]],'as':_0x46bd46['as'],'attributes':_0x46bd46[_0xebc7('0x25')]};}):[]};}):[]};}):[]:[]})[_0xebc7('0x12')](function(_0x2368d2){logger[_0xebc7('0x13')](_0xebc7('0x26'),_0x40fdb7);logger[_0xebc7('0x14')](_0xebc7('0x26'),_0x40fdb7,JSON[_0xebc7('0x16')](_0x2368d2));_0x2efb27(_0x2368d2);})['catch'](function(_0x2b18ce){logger['error'](_0xebc7('0x26'),_0x2b18ce['message'],_0x40fdb7);_0x13ecba(_0x571f4c[_0xebc7('0x17')](0x1f4,_0x2b18ce['message']));});});};exports[_0xebc7('0x27')]=function(_0x70b9af){var _0x4b3240=this;return new Promise(function(_0x2bbe02,_0x2958a7){return db[_0xebc7('0x1c')]['find']({'raw':_0x70b9af['options']?_0x70b9af[_0xebc7('0x1f')][_0xebc7('0x1e')]===undefined?!![]:![]:!![],'where':_0x70b9af[_0xebc7('0x1f')]?_0x70b9af[_0xebc7('0x1f')][_0xebc7('0x20')]||null:null,'attributes':_0x70b9af['options']?_0x70b9af[_0xebc7('0x1f')][_0xebc7('0x25')]||null:null,'include':_0x70b9af['options']?_0x70b9af[_0xebc7('0x1f')][_0xebc7('0x22')]?_[_0xebc7('0x23')](_0x70b9af[_0xebc7('0x1f')]['include'],function(_0x2e5c70){return{'model':db[_0x2e5c70['model']],'as':_0x2e5c70['as'],'attributes':_0x2e5c70['attributes'],'include':_0x2e5c70['include']?_['map'](_0x2e5c70[_0xebc7('0x22')],function(_0x199833){return{'model':db[_0x199833[_0xebc7('0x24')]],'as':_0x199833['as'],'attributes':_0x199833['attributes'],'include':_0x199833[_0xebc7('0x22')]?_[_0xebc7('0x23')](_0x199833[_0xebc7('0x22')],function(_0x51a620){return{'model':db[_0x51a620[_0xebc7('0x24')]],'as':_0x51a620['as'],'attributes':_0x51a620[_0xebc7('0x25')]};}):[]};}):[]};}):[]:[]})[_0xebc7('0x12')](function(_0x16bf9d){logger[_0xebc7('0x13')](_0xebc7('0x27'),_0x70b9af);logger['debug'](_0xebc7('0x27'),_0x70b9af,JSON['stringify'](_0x16bf9d));_0x2bbe02(_0x16bf9d);})['catch'](function(_0x3b2754){logger[_0xebc7('0x17')](_0xebc7('0x27'),_0x3b2754[_0xebc7('0x19')],_0x70b9af);_0x2958a7(_0x4b3240[_0xebc7('0x17')](0x1f4,_0x3b2754['message']));});});}; \ No newline at end of file +var _0x8da3=['findAll','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','VoiceQueue'];(function(_0x104ad9,_0x5403d7){var _0x34fa7d=function(_0x29e906){while(--_0x29e906){_0x104ad9['push'](_0x104ad9['shift']());}};_0x34fa7d(++_0x5403d7);}(_0x8da3,0x15d));var _0x38da=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x8da3[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x38da('0x0'));var util=require(_0x38da('0x1'));var moment=require('moment');var BPromise=require(_0x38da('0x2'));var rs=require(_0x38da('0x3'));var fs=require('fs');var Redis=require(_0x38da('0x4'));var db=require(_0x38da('0x5'))['db'];var utils=require(_0x38da('0x6'));var logger=require(_0x38da('0x7'))(_0x38da('0x8'));var config=require(_0x38da('0x9'));var jayson=require(_0x38da('0xa'));var client=jayson[_0x38da('0xb')][_0x38da('0xc')]({'port':0x232a});config[_0x38da('0xd')]=_[_0x38da('0xe')](config[_0x38da('0xd')],{'host':_0x38da('0xf'),'port':0x18eb});var socket=require(_0x38da('0x10'))(new Redis(config[_0x38da('0xd')]));require(_0x38da('0x11'))[_0x38da('0x12')](socket);function respondWithRpcPromise(_0x36bd60,_0x3f1260,_0x539c96){return new BPromise(function(_0x1d378f,_0x302d9f){return client[_0x38da('0x13')](_0x36bd60,_0x539c96)['then'](function(_0x151ebd){logger[_0x38da('0x14')](_0x38da('0x15'),_0x3f1260,_0x38da('0x16'));logger[_0x38da('0x17')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3f1260,'request\x20sent',JSON[_0x38da('0x18')](_0x151ebd));if(_0x151ebd['error']){if(_0x151ebd[_0x38da('0x19')]['code']===0x1f4){logger[_0x38da('0x19')](_0x38da('0x15'),_0x3f1260,_0x151ebd['error'][_0x38da('0x1a')]);return _0x302d9f(_0x151ebd[_0x38da('0x19')][_0x38da('0x1a')]);}logger['error'](_0x38da('0x15'),_0x3f1260,_0x151ebd[_0x38da('0x19')]['message']);return _0x1d378f(_0x151ebd[_0x38da('0x19')][_0x38da('0x1a')]);}else{logger[_0x38da('0x14')](_0x38da('0x15'),_0x3f1260,'request\x20sent');_0x1d378f(_0x151ebd['result'][_0x38da('0x1a')]);}})[_0x38da('0x1b')](function(_0x277b7f){logger[_0x38da('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x3f1260,_0x277b7f);_0x302d9f(_0x277b7f);});});}exports['GetVoiceQueue']=function(_0x3eaaac){var _0x54b020=this;return new Promise(function(_0x2bcc2c,_0xca3d80){return db[_0x38da('0x1c')][_0x38da('0x1d')]({'raw':_0x3eaaac[_0x38da('0x1e')]?_0x3eaaac['options'][_0x38da('0x1f')]===undefined?!![]:![]:!![],'where':_0x3eaaac[_0x38da('0x1e')]?_0x3eaaac['options'][_0x38da('0x20')]||null:null,'attributes':_0x3eaaac[_0x38da('0x1e')]?_0x3eaaac[_0x38da('0x1e')][_0x38da('0x21')]||null:null,'limit':_0x3eaaac[_0x38da('0x1e')]?_0x3eaaac[_0x38da('0x1e')][_0x38da('0x22')]||null:null,'include':_0x3eaaac['options']?_0x3eaaac[_0x38da('0x1e')][_0x38da('0x23')]?_[_0x38da('0x24')](_0x3eaaac['options'][_0x38da('0x23')],function(_0xccf08c){return{'model':db[_0xccf08c[_0x38da('0x25')]],'as':_0xccf08c['as'],'attributes':_0xccf08c[_0x38da('0x21')],'include':_0xccf08c['include']?_[_0x38da('0x24')](_0xccf08c['include'],function(_0x47d80a){return{'model':db[_0x47d80a[_0x38da('0x25')]],'as':_0x47d80a['as'],'attributes':_0x47d80a[_0x38da('0x21')],'include':_0x47d80a[_0x38da('0x23')]?_[_0x38da('0x24')](_0x47d80a[_0x38da('0x23')],function(_0xad37dc){return{'model':db[_0xad37dc['model']],'as':_0xad37dc['as'],'attributes':_0xad37dc[_0x38da('0x21')]};}):[]};}):[]};}):[]:[]})[_0x38da('0x26')](function(_0x1fae00){logger['info']('GetVoiceQueue',_0x3eaaac);logger[_0x38da('0x17')](_0x38da('0x27'),_0x3eaaac,JSON['stringify'](_0x1fae00));_0x2bcc2c(_0x1fae00);})[_0x38da('0x1b')](function(_0x3e7fe5){logger[_0x38da('0x19')]('GetVoiceQueue',_0x3e7fe5['message'],_0x3eaaac);_0xca3d80(_0x54b020[_0x38da('0x19')](0x1f4,_0x3e7fe5[_0x38da('0x1a')]));});});};exports[_0x38da('0x28')]=function(_0x29f68c){var _0x38a2b5=this;return new Promise(function(_0x3209f9,_0x46113e){return db['VoiceQueue'][_0x38da('0x29')]({'raw':_0x29f68c[_0x38da('0x1e')]?_0x29f68c[_0x38da('0x1e')][_0x38da('0x1f')]===undefined?!![]:![]:!![],'where':_0x29f68c[_0x38da('0x1e')]?_0x29f68c['options'][_0x38da('0x20')]||null:null,'attributes':_0x29f68c[_0x38da('0x1e')]?_0x29f68c['options'][_0x38da('0x21')]||null:null,'include':_0x29f68c[_0x38da('0x1e')]?_0x29f68c['options'][_0x38da('0x23')]?_[_0x38da('0x24')](_0x29f68c[_0x38da('0x1e')]['include'],function(_0x535105){return{'model':db[_0x535105['model']],'as':_0x535105['as'],'attributes':_0x535105[_0x38da('0x21')],'include':_0x535105['include']?_[_0x38da('0x24')](_0x535105[_0x38da('0x23')],function(_0x360616){return{'model':db[_0x360616[_0x38da('0x25')]],'as':_0x360616['as'],'attributes':_0x360616[_0x38da('0x21')],'include':_0x360616['include']?_[_0x38da('0x24')](_0x360616['include'],function(_0x5b0d7b){return{'model':db[_0x5b0d7b[_0x38da('0x25')]],'as':_0x5b0d7b['as'],'attributes':_0x5b0d7b[_0x38da('0x21')]};}):[]};}):[]};}):[]:[]})[_0x38da('0x26')](function(_0x486f3f){logger['info']('ShowVoiceQueue',_0x29f68c);logger[_0x38da('0x17')](_0x38da('0x28'),_0x29f68c,JSON['stringify'](_0x486f3f));_0x3209f9(_0x486f3f);})[_0x38da('0x1b')](function(_0x54b87e){logger[_0x38da('0x19')](_0x38da('0x28'),_0x54b87e[_0x38da('0x1a')],_0x29f68c);_0x46113e(_0x38a2b5[_0x38da('0x19')](0x1f4,_0x54b87e[_0x38da('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4ddf979..beeb246 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 _0x97ca=['register','length','./voiceQueue.events','save','remove','emit'];(function(_0x2340e2,_0x1627f9){var _0x5ced10=function(_0x3c5250){while(--_0x3c5250){_0x2340e2['push'](_0x2340e2['shift']());}};_0x5ced10(++_0x1627f9);}(_0x97ca,0x18e));var _0xa97c=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0x97ca[_0x3d9e94];return _0x45f76e;};'use strict';var VoiceQueueEvents=require(_0xa97c('0x0'));var events=[_0xa97c('0x1'),_0xa97c('0x2'),'update'];function createListener(_0x3cda24,_0x678de9){return function(_0x41e8ca){_0x678de9[_0xa97c('0x3')](_0x3cda24,_0x41e8ca);};}function removeListener(_0x3fb66a,_0x2d3b55){return function(){VoiceQueueEvents['removeListener'](_0x3fb66a,_0x2d3b55);};}exports[_0xa97c('0x4')]=function(_0x1d5380){for(var _0x5b2204=0x0,_0x4b3840=events[_0xa97c('0x5')];_0x5b2204<_0x4b3840;_0x5b2204++){var _0x9b3060=events[_0x5b2204];var _0x49d1f5=createListener('voiceQueue:'+_0x9b3060,_0x1d5380);VoiceQueueEvents['on'](_0x9b3060,_0x49d1f5);}}; \ No newline at end of file +var _0x5baf=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x1b28bb,_0x8e18b3){var _0x2b8287=function(_0xfa7ef7){while(--_0xfa7ef7){_0x1b28bb['push'](_0x1b28bb['shift']());}};_0x2b8287(++_0x8e18b3);}(_0x5baf,0xae));var _0xf5ba=function(_0x4ae955,_0x529101){_0x4ae955=_0x4ae955-0x0;var _0x44618c=_0x5baf[_0x4ae955];return _0x44618c;};'use strict';var VoiceQueueEvents=require(_0xf5ba('0x0'));var events=['save','remove',_0xf5ba('0x1')];function createListener(_0xd84b8b,_0x496c4c){return function(_0x166af4){_0x496c4c[_0xf5ba('0x2')](_0xd84b8b,_0x166af4);};}function removeListener(_0x4314fc,_0x58ba64){return function(){VoiceQueueEvents[_0xf5ba('0x3')](_0x4314fc,_0x58ba64);};}exports[_0xf5ba('0x4')]=function(_0x41327d){for(var _0x5ef84e=0x0,_0x1a4db8=events[_0xf5ba('0x5')];_0x5ef84e<_0x1a4db8;_0x5ef84e++){var _0x5deae9=events[_0x5ef84e];var _0x21f0c6=createListener(_0xf5ba('0x6')+_0x5deae9,_0x41327d);VoiceQueueEvents['on'](_0x5deae9,_0x21f0c6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 6ec6d08..28ae539 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 _0xd117=['/index','/:id','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x526299,_0x539962){var _0x56055c=function(_0x153b8b){while(--_0x153b8b){_0x526299['push'](_0x526299['shift']());}};_0x56055c(++_0x539962);}(_0xd117,0x182));var _0x7d11=function(_0x5756c6,_0x58290a){_0x5756c6=_0x5756c6-0x0;var _0x4b5806=_0xd117[_0x5756c6];return _0x4b5806;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var auth=require(_0x7d11('0x6'));var interaction=require(_0x7d11('0x7'));var config=require(_0x7d11('0x8'));var controller=require(_0x7d11('0x9'));router[_0x7d11('0xa')]('/',auth[_0x7d11('0xb')](),controller[_0x7d11('0xc')]);router[_0x7d11('0xa')](_0x7d11('0xd'),auth[_0x7d11('0xb')](),controller['describe']);router[_0x7d11('0xa')](_0x7d11('0xe'),auth[_0x7d11('0xb')](),controller['getVoiceQueuesReport']);router[_0x7d11('0xa')](_0x7d11('0xf'),auth[_0x7d11('0xb')](),controller['show']);router[_0x7d11('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7d11('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x12')]);router['delete'](_0x7d11('0xf'),auth[_0x7d11('0xb')](),controller['destroy']);module[_0x7d11('0x13')]=router; \ No newline at end of file +var _0x39e6=['/:id','show','post','put','update','delete','multer','path','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport'];(function(_0x206b5f,_0x33ea40){var _0xcff5a9=function(_0x19abc4){while(--_0x19abc4){_0x206b5f['push'](_0x206b5f['shift']());}};_0xcff5a9(++_0x33ea40);}(_0x39e6,0x9e));var _0x639e=function(_0x1aeabc,_0x9fde44){_0x1aeabc=_0x1aeabc-0x0;var _0x2773c8=_0x39e6[_0x1aeabc];return _0x2773c8;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var auth=require(_0x639e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x639e('0x4'));var controller=require(_0x639e('0x5'));router[_0x639e('0x6')]('/',auth[_0x639e('0x7')](),controller[_0x639e('0x8')]);router[_0x639e('0x6')](_0x639e('0x9'),auth[_0x639e('0x7')](),controller[_0x639e('0xa')]);router[_0x639e('0x6')](_0x639e('0xb'),auth[_0x639e('0x7')](),controller[_0x639e('0xc')]);router[_0x639e('0x6')](_0x639e('0xd'),auth[_0x639e('0x7')](),controller[_0x639e('0xe')]);router[_0x639e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x639e('0x10')](_0x639e('0xd'),auth[_0x639e('0x7')](),controller[_0x639e('0x11')]);router[_0x639e('0x12')](_0x639e('0xd'),auth[_0x639e('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 7937fed..af59c83 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 _0xa9e0=['queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff'];(function(_0x1920d4,_0x148a71){var _0x578571=function(_0x169823){while(--_0x169823){_0x1920d4['push'](_0x1920d4['shift']());}};_0x578571(++_0x148a71);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0a9e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0a9e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x0a9e('0x4')],'set':function(_0x991246){var _0x981158=moment(_0x991246);var _0x57b080=moment(this[_0x0a9e('0x5')](_0x0a9e('0x6')))[_0x0a9e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x503809=_0x981158[_0x0a9e('0x8')](_0x57b080,'seconds');this['setDataValue'](_0x0a9e('0x9'),_0x991246);this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x503809||null);}},'position':{'type':Sequelize[_0x0a9e('0xc')]},'count':{'type':Sequelize[_0x0a9e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x0a9e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0a9e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x0a9e('0x3')],'comment':_0x0a9e('0xe')},'originalposition':{'type':Sequelize[_0x0a9e('0xc')]},'channel':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a9e('0x3')]},'context':{'type':Sequelize[_0x0a9e('0x3')]},'exten':{'type':Sequelize[_0x0a9e('0x3')]},'priority':{'type':Sequelize[_0x0a9e('0x3')]},'holdtime':{'type':Sequelize[_0x0a9e('0xc')]},'mohtime':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0a9e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0a9e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0a9e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x0a9e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0a9e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x580d0e,_0x1e5f43){var _0xb51111=function(_0x4718e7){while(--_0x4718e7){_0x580d0e['push'](_0x580d0e['shift']());}};_0xb51111(++_0x1e5f43);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('0xb')],'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 edcbc00..328c668 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 _0xf29d=['key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','filtears','includeAll','create','body','catch','find','params','nolimit','findAll','getVoiceQueuesReport','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type'];(function(_0xd03cd5,_0xe6db87){var _0xa40f94=function(_0x1199d6){while(--_0x1199d6){_0xd03cd5['push'](_0xd03cd5['shift']());}};_0xa40f94(++_0xe6db87);}(_0xf29d,0xc4));var _0xdf29=function(_0x504629,_0xfa9ae6){_0x504629=_0x504629-0x0;var _0x48f63a=_0xf29d[_0x504629];return _0x48f63a;};'use strict';var pdf=require(_0xdf29('0x0'));var emlformat=require(_0xdf29('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf29('0x2'));var jsonpatch=require(_0xdf29('0x3'));var rp=require(_0xdf29('0x4'));var moment=require(_0xdf29('0x5'));var BPromise=require(_0xdf29('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdf29('0x7'));var csv=require(_0xdf29('0x8'));var ejs=require(_0xdf29('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf29('0xa'));var crypto=require(_0xdf29('0xb'));var jsforce=require(_0xdf29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdf29('0x8'));var querystring=require(_0xdf29('0xd'));var Papa=require(_0xdf29('0xe'));var Redis=require(_0xdf29('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf29('0x10'));var hardwareService=require(_0xdf29('0x11'));var logger=require('../../config/logger')(_0xdf29('0x12'));var utils=require(_0xdf29('0x13'));var config=require(_0xdf29('0x14'));var licenseUtil=require(_0xdf29('0x15'));var db=require(_0xdf29('0x16'))['db'];config['redis']=_[_0xdf29('0x17')](config['redis'],{'host':_0xdf29('0x18'),'port':0x18eb});var socket=require(_0xdf29('0x19'))(new Redis(config[_0xdf29('0x1a')]));require('./voiceQueueReport.socket')[_0xdf29('0x1b')](socket);function respondWithStatusCode(_0xacbef1,_0x5478df){_0x5478df=_0x5478df||0xcc;return function(_0xcf93bd){if(_0xcf93bd){return _0xacbef1[_0xdf29('0x1c')](_0x5478df);}return _0xacbef1[_0xdf29('0x1d')](_0x5478df)['end']();};}function respondWithResult(_0x45ea43,_0x57df07){_0x57df07=_0x57df07||0xc8;return function(_0x4ef166){if(_0x4ef166){return _0x45ea43[_0xdf29('0x1d')](_0x57df07)[_0xdf29('0x1e')](_0x4ef166);}};}function respondWithFilteredResult(_0x59c74d,_0x5ecbf4){return function(_0x11dc19){if(_0x11dc19){var _0x28a99b=_0x11dc19[_0xdf29('0x1f')],_0x4debb5=_0x5ecbf4[_0xdf29('0x20')],_0x207daa=_0x5ecbf4[_0xdf29('0x20')]+_0x5ecbf4[_0xdf29('0x21')],_0xf56cfa;if(_0x207daa>=_0x28a99b){_0x207daa=_0x28a99b;_0xf56cfa=0xc8;}else{_0xf56cfa=0xce;}_0x59c74d[_0xdf29('0x1d')](_0xf56cfa);return _0x59c74d[_0xdf29('0x22')](_0xdf29('0x23'),_0x4debb5+'-'+_0x207daa+'/'+_0x28a99b)[_0xdf29('0x1e')](_0x11dc19);}return null;};}function patchUpdates(_0x2746fc){return function(_0x2767a7){try{jsonpatch[_0xdf29('0x24')](_0x2767a7,_0x2746fc,!![]);}catch(_0x38bf87){return BPromise[_0xdf29('0x25')](_0x38bf87);}return _0x2767a7[_0xdf29('0x26')]();};}function saveUpdates(_0x4b8f9c,_0x554655){return function(_0xe57c47){if(_0xe57c47){return _0xe57c47[_0xdf29('0x27')](_0x4b8f9c)[_0xdf29('0x28')](function(_0xfc7760){return _0xfc7760;});}return null;};}function removeEntity(_0x1e311b,_0x47a1af){return function(_0x7a2fcd){if(_0x7a2fcd){return _0x7a2fcd[_0xdf29('0x29')]()[_0xdf29('0x28')](function(){_0x1e311b[_0xdf29('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29d3a1,_0x503cd4){return function(_0x493d01){if(!_0x493d01){_0x29d3a1['sendStatus'](0x194);}return _0x493d01;};}function handleError(_0x484989,_0x4f70e8){_0x4f70e8=_0x4f70e8||0x1f4;return function(_0x3ba001){logger['error'](_0x3ba001[_0xdf29('0x2a')]);if(_0x3ba001['name']){delete _0x3ba001['name'];}_0x484989['status'](_0x4f70e8)[_0xdf29('0x2b')](_0x3ba001);};}exports[_0xdf29('0x2c')]=function(_0x4fd7c9,_0x333965){var _0x37ca23={},_0xd2b43c={},_0x48faf6={'count':0x0,'rows':[]};var _0x5d3fdc=_[_0xdf29('0x2d')](db[_0xdf29('0x2e')][_0xdf29('0x2f')],function(_0x240777){return{'name':_0x240777[_0xdf29('0x30')],'type':_0x240777[_0xdf29('0x31')][_0xdf29('0x32')]};});_0xd2b43c[_0xdf29('0x33')]=_[_0xdf29('0x2d')](_0x5d3fdc,_0xdf29('0x34'));_0xd2b43c[_0xdf29('0x35')]=_[_0xdf29('0x36')](_0x4fd7c9[_0xdf29('0x35')]);_0xd2b43c[_0xdf29('0x37')]=_[_0xdf29('0x38')](_0xd2b43c['model'],_0xd2b43c[_0xdf29('0x35')]);_0x37ca23[_0xdf29('0x39')]=_['intersection'](_0xd2b43c[_0xdf29('0x33')],qs[_0xdf29('0x3a')](_0x4fd7c9[_0xdf29('0x35')]['fields']));_0x37ca23[_0xdf29('0x39')]=_0x37ca23[_0xdf29('0x39')][_0xdf29('0x3b')]?_0x37ca23[_0xdf29('0x39')]:_0xd2b43c['model'];if(!_0x4fd7c9[_0xdf29('0x35')][_0xdf29('0x3c')]('nolimit')){_0x37ca23[_0xdf29('0x21')]=qs['limit'](_0x4fd7c9[_0xdf29('0x35')][_0xdf29('0x21')]);_0x37ca23[_0xdf29('0x20')]=qs[_0xdf29('0x20')](_0x4fd7c9[_0xdf29('0x35')][_0xdf29('0x20')]);}_0x37ca23[_0xdf29('0x3d')]=qs[_0xdf29('0x3e')](_0x4fd7c9[_0xdf29('0x35')]['sort']);_0x37ca23[_0xdf29('0x3f')]=qs[_0xdf29('0x37')](_[_0xdf29('0x40')](_0x4fd7c9[_0xdf29('0x35')],_0xd2b43c[_0xdf29('0x37')]),_0x5d3fdc);if(_0x4fd7c9[_0xdf29('0x35')][_0xdf29('0x41')]){_0x37ca23[_0xdf29('0x3f')]=_['merge'](_0x37ca23['where'],{'$or':_[_0xdf29('0x2d')](_0x5d3fdc,function(_0x53e82b){if(_0x53e82b[_0xdf29('0x31')]!==_0xdf29('0x42')){var _0xf4135a={};_0xf4135a[_0x53e82b[_0xdf29('0x34')]]={'$like':'%'+_0x4fd7c9[_0xdf29('0x35')]['filter']+'%'};return _0xf4135a;}})});}_0x37ca23=_[_0xdf29('0x43')]({},_0x37ca23,_0x4fd7c9[_0xdf29('0x44')]);var _0x49b950={'where':_0x37ca23[_0xdf29('0x3f')]};return db[_0xdf29('0x2e')][_0xdf29('0x1f')](_0x49b950)['then'](function(_0x2dbdab){_0x48faf6[_0xdf29('0x1f')]=_0x2dbdab;if(_0x4fd7c9[_0xdf29('0x35')]['includeAll']){_0x37ca23[_0xdf29('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x37ca23);})[_0xdf29('0x28')](function(_0xcaaca0){_0x48faf6[_0xdf29('0x46')]=_0xcaaca0;return _0x48faf6;})[_0xdf29('0x28')](respondWithFilteredResult(_0x333965,_0x37ca23))['catch'](handleError(_0x333965,null));};exports[_0xdf29('0x47')]=function(_0x1c2fc0,_0x28a198){var _0x209739={'raw':![],'where':{'id':_0x1c2fc0['params']['id']}},_0x4330c5={};_0x4330c5[_0xdf29('0x33')]=_[_0xdf29('0x36')](db[_0xdf29('0x2e')]['rawAttributes']);_0x4330c5[_0xdf29('0x35')]=_[_0xdf29('0x36')](_0x1c2fc0['query']);_0x4330c5[_0xdf29('0x48')]=_[_0xdf29('0x38')](_0x4330c5[_0xdf29('0x33')],_0x4330c5[_0xdf29('0x35')]);_0x209739['attributes']=_[_0xdf29('0x38')](_0x4330c5['model'],qs[_0xdf29('0x3a')](_0x1c2fc0[_0xdf29('0x35')][_0xdf29('0x3a')]));_0x209739[_0xdf29('0x39')]=_0x209739[_0xdf29('0x39')][_0xdf29('0x3b')]?_0x209739[_0xdf29('0x39')]:_0x4330c5[_0xdf29('0x33')];if(_0x1c2fc0[_0xdf29('0x35')][_0xdf29('0x49')]){_0x209739[_0xdf29('0x45')]=[{'all':!![]}];}_0x209739=_[_0xdf29('0x43')]({},_0x209739,_0x1c2fc0[_0xdf29('0x44')]);return db['VoiceQueueReport']['find'](_0x209739)[_0xdf29('0x28')](handleEntityNotFound(_0x28a198,null))[_0xdf29('0x28')](respondWithResult(_0x28a198,null))['catch'](handleError(_0x28a198,null));};exports['create']=function(_0x3bdfd6,_0x491ea4){return db[_0xdf29('0x2e')][_0xdf29('0x4a')](_0x3bdfd6[_0xdf29('0x4b')],{})['then'](respondWithResult(_0x491ea4,0xc9))[_0xdf29('0x4c')](handleError(_0x491ea4,null));};exports[_0xdf29('0x27')]=function(_0x330295,_0x156c22){if(_0x330295[_0xdf29('0x4b')]['id']){delete _0x330295[_0xdf29('0x4b')]['id'];}return db['VoiceQueueReport'][_0xdf29('0x4d')]({'where':{'id':_0x330295[_0xdf29('0x4e')]['id']}})[_0xdf29('0x28')](handleEntityNotFound(_0x156c22,null))[_0xdf29('0x28')](saveUpdates(_0x330295[_0xdf29('0x4b')],null))['then'](respondWithResult(_0x156c22,null))[_0xdf29('0x4c')](handleError(_0x156c22,null));};exports[_0xdf29('0x29')]=function(_0x4e71fc,_0x25296b){return db[_0xdf29('0x2e')]['find']({'where':{'id':_0x4e71fc['params']['id']}})['then'](handleEntityNotFound(_0x25296b,null))[_0xdf29('0x28')](removeEntity(_0x25296b,null))[_0xdf29('0x4c')](handleError(_0x25296b,null));};exports['describe']=function(_0x3c9c7d,_0x5446a2){return db['VoiceQueueReport']['describe']()[_0xdf29('0x28')](respondWithResult(_0x5446a2,null))['catch'](handleError(_0x5446a2,null));};exports['getVoiceQueuesReport']=function(_0x339a06,_0x38a693){var _0x2a2900={},_0x381541={},_0x9ab9a6={'count':0x0,'rows':[]};_0x381541[_0xdf29('0x33')]=_[_0xdf29('0x36')](db[_0xdf29('0x2e')][_0xdf29('0x2f')]);_0x381541['query']=_['keys'](_0x339a06[_0xdf29('0x35')]);_0x381541[_0xdf29('0x37')]=_[_0xdf29('0x38')](_0x381541[_0xdf29('0x33')],_0x381541[_0xdf29('0x35')]);_0x2a2900[_0xdf29('0x39')]=_['intersection'](_0x381541[_0xdf29('0x33')],qs[_0xdf29('0x3a')](_0x339a06[_0xdf29('0x35')][_0xdf29('0x3a')]));_0x2a2900[_0xdf29('0x39')]=_0x2a2900[_0xdf29('0x39')][_0xdf29('0x3b')]?_0x2a2900[_0xdf29('0x39')]:_0x381541[_0xdf29('0x33')];if(!_0x339a06[_0xdf29('0x35')][_0xdf29('0x3c')](_0xdf29('0x4f'))){_0x2a2900[_0xdf29('0x21')]=qs[_0xdf29('0x21')](_0x339a06[_0xdf29('0x35')][_0xdf29('0x21')]);_0x2a2900[_0xdf29('0x20')]=qs[_0xdf29('0x20')](_0x339a06[_0xdf29('0x35')][_0xdf29('0x20')]);}_0x2a2900['order']=qs['sort'](_0x339a06[_0xdf29('0x35')][_0xdf29('0x3e')]);_0x2a2900[_0xdf29('0x3f')]=qs[_0xdf29('0x37')](_['pick'](_0x339a06[_0xdf29('0x35')],_0x381541[_0xdf29('0x37')]));if(_0x339a06[_0xdf29('0x35')][_0xdf29('0x41')]){_0x2a2900[_0xdf29('0x3f')]=_[_0xdf29('0x43')](_0x2a2900[_0xdf29('0x3f')],{'$or':_[_0xdf29('0x2d')](_0x2a2900[_0xdf29('0x39')],function(_0x3f080b){var _0x6be96a={};_0x6be96a[_0x3f080b]={'$like':'%'+_0x339a06['query']['filter']+'%'};return _0x6be96a;})});}_0x2a2900=_['merge']({},_0x2a2900,_0x339a06[_0xdf29('0x44')]);var _0x960979={'where':_0x2a2900[_0xdf29('0x3f')]};return db[_0xdf29('0x2e')]['count'](_0x960979)[_0xdf29('0x28')](function(_0x571a5d){_0x9ab9a6['count']=_0x571a5d;if(_0x339a06['query']['includeAll']){_0x2a2900[_0xdf29('0x45')]=[{'all':!![]}];}return db[_0xdf29('0x2e')][_0xdf29('0x50')](_0x2a2900);})[_0xdf29('0x28')](function(_0x230b3b){_0x9ab9a6[_0xdf29('0x46')]=_0x230b3b;return _0x9ab9a6;})[_0xdf29('0x28')](respondWithFilteredResult(_0x38a693,_0x2a2900,_0xdf29('0x51')))[_0xdf29('0x4c')](handleError(_0x38a693,null,_0xdf29('0x51')));}; \ No newline at end of file +var _0x55c1=['attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','include','rows','catch','params','filtears','includeAll','find','body','describe','getVoiceQueuesReport','options','findAll','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','map','VoiceQueueReport','rawAttributes','key','model','query','keys','filters','intersection','fields'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0x55c1,0x1e5));var _0x155c=function(_0x58a1ef,_0x4938cd){_0x58a1ef=_0x58a1ef-0x0;var _0x384e65=_0x55c1[_0x58a1ef];return _0x384e65;};'use strict';var pdf=require(_0x155c('0x0'));var emlformat=require(_0x155c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x155c('0x2'));var moment=require(_0x155c('0x3'));var BPromise=require(_0x155c('0x4'));var Mustache=require(_0x155c('0x5'));var util=require(_0x155c('0x6'));var path=require('path');var sox=require(_0x155c('0x7'));var csv=require(_0x155c('0x8'));var ejs=require(_0x155c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x155c('0xa'));var crypto=require(_0x155c('0xb'));var jsforce=require(_0x155c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x155c('0xd'));var Redis=require(_0x155c('0xe'));var authService=require(_0x155c('0xf'));var qs=require(_0x155c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x155c('0x11'));var logger=require(_0x155c('0x12'))('api');var utils=require(_0x155c('0x13'));var config=require(_0x155c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x155c('0x15'))['db'];config[_0x155c('0x16')]=_['defaults'](config[_0x155c('0x16')],{'host':_0x155c('0x17'),'port':0x18eb});var socket=require(_0x155c('0x18'))(new Redis(config['redis']));require(_0x155c('0x19'))[_0x155c('0x1a')](socket);function respondWithStatusCode(_0xfe906a,_0x3da280){_0x3da280=_0x3da280||0xcc;return function(_0x40e5a3){if(_0x40e5a3){return _0xfe906a['sendStatus'](_0x3da280);}return _0xfe906a[_0x155c('0x1b')](_0x3da280)[_0x155c('0x1c')]();};}function respondWithResult(_0x48fe51,_0x27681c){_0x27681c=_0x27681c||0xc8;return function(_0x5c4ffb){if(_0x5c4ffb){return _0x48fe51[_0x155c('0x1b')](_0x27681c)[_0x155c('0x1d')](_0x5c4ffb);}};}function respondWithFilteredResult(_0x9e024e,_0x5b1dac){return function(_0xe800de){if(_0xe800de){var _0x13667b=_0xe800de[_0x155c('0x1e')],_0x224a3d=_0x5b1dac[_0x155c('0x1f')],_0x2f0099=_0x5b1dac[_0x155c('0x1f')]+_0x5b1dac[_0x155c('0x20')],_0x43f537;if(_0x2f0099>=_0x13667b){_0x2f0099=_0x13667b;_0x43f537=0xc8;}else{_0x43f537=0xce;}_0x9e024e[_0x155c('0x1b')](_0x43f537);return _0x9e024e[_0x155c('0x21')](_0x155c('0x22'),_0x224a3d+'-'+_0x2f0099+'/'+_0x13667b)[_0x155c('0x1d')](_0xe800de);}return null;};}function patchUpdates(_0x3938d8){return function(_0x43b032){try{jsonpatch[_0x155c('0x23')](_0x43b032,_0x3938d8,!![]);}catch(_0x21de4b){return BPromise['reject'](_0x21de4b);}return _0x43b032[_0x155c('0x24')]();};}function saveUpdates(_0x3cc458,_0x38becc){return function(_0x305ffc){if(_0x305ffc){return _0x305ffc[_0x155c('0x25')](_0x3cc458)[_0x155c('0x26')](function(_0x4b6d0d){return _0x4b6d0d;});}return null;};}function removeEntity(_0x4f242c,_0xdeb25c){return function(_0x1fde44){if(_0x1fde44){return _0x1fde44[_0x155c('0x27')]()[_0x155c('0x26')](function(){_0x4f242c[_0x155c('0x1b')](0xcc)[_0x155c('0x1c')]();});}};}function handleEntityNotFound(_0x452175,_0x3a9546){return function(_0x241b38){if(!_0x241b38){_0x452175[_0x155c('0x28')](0x194);}return _0x241b38;};}function handleError(_0x36be3d,_0x1a2e2e){_0x1a2e2e=_0x1a2e2e||0x1f4;return function(_0xf4e683){logger[_0x155c('0x29')](_0xf4e683[_0x155c('0x2a')]);if(_0xf4e683[_0x155c('0x2b')]){delete _0xf4e683['name'];}_0x36be3d[_0x155c('0x1b')](_0x1a2e2e)['send'](_0xf4e683);};}exports['index']=function(_0x5bb056,_0x47c89d){var _0x43608a={},_0x3593a0={},_0xa547df={'count':0x0,'rows':[]};var _0x529c9c=_[_0x155c('0x2c')](db[_0x155c('0x2d')][_0x155c('0x2e')],function(_0x595d47){return{'name':_0x595d47['fieldName'],'type':_0x595d47['type'][_0x155c('0x2f')]};});_0x3593a0[_0x155c('0x30')]=_['map'](_0x529c9c,_0x155c('0x2b'));_0x3593a0[_0x155c('0x31')]=_[_0x155c('0x32')](_0x5bb056['query']);_0x3593a0[_0x155c('0x33')]=_['intersection'](_0x3593a0[_0x155c('0x30')],_0x3593a0[_0x155c('0x31')]);_0x43608a['attributes']=_[_0x155c('0x34')](_0x3593a0[_0x155c('0x30')],qs['fields'](_0x5bb056[_0x155c('0x31')][_0x155c('0x35')]));_0x43608a['attributes']=_0x43608a[_0x155c('0x36')][_0x155c('0x37')]?_0x43608a[_0x155c('0x36')]:_0x3593a0[_0x155c('0x30')];if(!_0x5bb056[_0x155c('0x31')][_0x155c('0x38')](_0x155c('0x39'))){_0x43608a[_0x155c('0x20')]=qs[_0x155c('0x20')](_0x5bb056[_0x155c('0x31')][_0x155c('0x20')]);_0x43608a['offset']=qs[_0x155c('0x1f')](_0x5bb056[_0x155c('0x31')][_0x155c('0x1f')]);}_0x43608a['order']=qs[_0x155c('0x3a')](_0x5bb056[_0x155c('0x31')]['sort']);_0x43608a['where']=qs[_0x155c('0x33')](_[_0x155c('0x3b')](_0x5bb056[_0x155c('0x31')],_0x3593a0['filters']),_0x529c9c);if(_0x5bb056[_0x155c('0x31')][_0x155c('0x3c')]){_0x43608a[_0x155c('0x3d')]=_['merge'](_0x43608a[_0x155c('0x3d')],{'$or':_['map'](_0x529c9c,function(_0x3453a7){if(_0x3453a7[_0x155c('0x3e')]!==_0x155c('0x3f')){var _0x5cb53a={};_0x5cb53a[_0x3453a7['name']]={'$like':'%'+_0x5bb056[_0x155c('0x31')][_0x155c('0x3c')]+'%'};return _0x5cb53a;}})});}_0x43608a=_[_0x155c('0x40')]({},_0x43608a,_0x5bb056['options']);var _0x3c463f={'where':_0x43608a[_0x155c('0x3d')]};return db[_0x155c('0x2d')][_0x155c('0x1e')](_0x3c463f)[_0x155c('0x26')](function(_0x564fbf){_0xa547df['count']=_0x564fbf;if(_0x5bb056[_0x155c('0x31')]['includeAll']){_0x43608a[_0x155c('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x43608a);})[_0x155c('0x26')](function(_0x3f1bd7){_0xa547df[_0x155c('0x42')]=_0x3f1bd7;return _0xa547df;})[_0x155c('0x26')](respondWithFilteredResult(_0x47c89d,_0x43608a))[_0x155c('0x43')](handleError(_0x47c89d,null));};exports['show']=function(_0x350147,_0x34b588){var _0x2649be={'raw':![],'where':{'id':_0x350147[_0x155c('0x44')]['id']}},_0x3a7725={};_0x3a7725[_0x155c('0x30')]=_[_0x155c('0x32')](db[_0x155c('0x2d')][_0x155c('0x2e')]);_0x3a7725[_0x155c('0x31')]=_[_0x155c('0x32')](_0x350147['query']);_0x3a7725[_0x155c('0x45')]=_[_0x155c('0x34')](_0x3a7725['model'],_0x3a7725[_0x155c('0x31')]);_0x2649be[_0x155c('0x36')]=_[_0x155c('0x34')](_0x3a7725[_0x155c('0x30')],qs[_0x155c('0x35')](_0x350147[_0x155c('0x31')][_0x155c('0x35')]));_0x2649be[_0x155c('0x36')]=_0x2649be[_0x155c('0x36')][_0x155c('0x37')]?_0x2649be[_0x155c('0x36')]:_0x3a7725[_0x155c('0x30')];if(_0x350147[_0x155c('0x31')][_0x155c('0x46')]){_0x2649be['include']=[{'all':!![]}];}_0x2649be=_['merge']({},_0x2649be,_0x350147['options']);return db['VoiceQueueReport']['find'](_0x2649be)[_0x155c('0x26')](handleEntityNotFound(_0x34b588,null))[_0x155c('0x26')](respondWithResult(_0x34b588,null))[_0x155c('0x43')](handleError(_0x34b588,null));};exports['create']=function(_0x599b38,_0x2981f2){return db[_0x155c('0x2d')]['create'](_0x599b38['body'],{})[_0x155c('0x26')](respondWithResult(_0x2981f2,0xc9))['catch'](handleError(_0x2981f2,null));};exports[_0x155c('0x25')]=function(_0x496b4b,_0x46264d){if(_0x496b4b['body']['id']){delete _0x496b4b['body']['id'];}return db[_0x155c('0x2d')][_0x155c('0x47')]({'where':{'id':_0x496b4b[_0x155c('0x44')]['id']}})['then'](handleEntityNotFound(_0x46264d,null))[_0x155c('0x26')](saveUpdates(_0x496b4b[_0x155c('0x48')],null))[_0x155c('0x26')](respondWithResult(_0x46264d,null))[_0x155c('0x43')](handleError(_0x46264d,null));};exports[_0x155c('0x27')]=function(_0x3a64c3,_0x2cce6b){return db[_0x155c('0x2d')][_0x155c('0x47')]({'where':{'id':_0x3a64c3['params']['id']}})[_0x155c('0x26')](handleEntityNotFound(_0x2cce6b,null))[_0x155c('0x26')](removeEntity(_0x2cce6b,null))[_0x155c('0x43')](handleError(_0x2cce6b,null));};exports[_0x155c('0x49')]=function(_0x373a69,_0x4cb157){return db[_0x155c('0x2d')][_0x155c('0x49')]()[_0x155c('0x26')](respondWithResult(_0x4cb157,null))[_0x155c('0x43')](handleError(_0x4cb157,null));};exports[_0x155c('0x4a')]=function(_0x4971c6,_0x5b46bc){var _0x2f1d96={},_0x344234={},_0x4c150e={'count':0x0,'rows':[]};_0x344234[_0x155c('0x30')]=_[_0x155c('0x32')](db['VoiceQueueReport'][_0x155c('0x2e')]);_0x344234[_0x155c('0x31')]=_[_0x155c('0x32')](_0x4971c6[_0x155c('0x31')]);_0x344234['filters']=_[_0x155c('0x34')](_0x344234[_0x155c('0x30')],_0x344234[_0x155c('0x31')]);_0x2f1d96[_0x155c('0x36')]=_[_0x155c('0x34')](_0x344234[_0x155c('0x30')],qs['fields'](_0x4971c6['query'][_0x155c('0x35')]));_0x2f1d96[_0x155c('0x36')]=_0x2f1d96[_0x155c('0x36')][_0x155c('0x37')]?_0x2f1d96['attributes']:_0x344234[_0x155c('0x30')];if(!_0x4971c6[_0x155c('0x31')][_0x155c('0x38')](_0x155c('0x39'))){_0x2f1d96[_0x155c('0x20')]=qs[_0x155c('0x20')](_0x4971c6['query'][_0x155c('0x20')]);_0x2f1d96[_0x155c('0x1f')]=qs['offset'](_0x4971c6['query'][_0x155c('0x1f')]);}_0x2f1d96['order']=qs[_0x155c('0x3a')](_0x4971c6[_0x155c('0x31')]['sort']);_0x2f1d96['where']=qs[_0x155c('0x33')](_[_0x155c('0x3b')](_0x4971c6[_0x155c('0x31')],_0x344234['filters']));if(_0x4971c6[_0x155c('0x31')][_0x155c('0x3c')]){_0x2f1d96[_0x155c('0x3d')]=_[_0x155c('0x40')](_0x2f1d96[_0x155c('0x3d')],{'$or':_[_0x155c('0x2c')](_0x2f1d96['attributes'],function(_0x582220){var _0x365567={};_0x365567[_0x582220]={'$like':'%'+_0x4971c6[_0x155c('0x31')][_0x155c('0x3c')]+'%'};return _0x365567;})});}_0x2f1d96=_['merge']({},_0x2f1d96,_0x4971c6[_0x155c('0x4b')]);var _0x412cbd={'where':_0x2f1d96[_0x155c('0x3d')]};return db[_0x155c('0x2d')][_0x155c('0x1e')](_0x412cbd)['then'](function(_0x4b5459){_0x4c150e[_0x155c('0x1e')]=_0x4b5459;if(_0x4971c6[_0x155c('0x31')][_0x155c('0x46')]){_0x2f1d96[_0x155c('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x155c('0x4c')](_0x2f1d96);})[_0x155c('0x26')](function(_0x2450ec){_0x4c150e['rows']=_0x2450ec;return _0x4c150e;})[_0x155c('0x26')](respondWithFilteredResult(_0x5b46bc,_0x2f1d96,'getVoiceQueuesReport'))[_0x155c('0x43')](handleError(_0x5b46bc,null,_0x155c('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e8f215e..d74bff7 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 _0xdac7=['../../mysqldb','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdac7,0x180));var _0x7dac=function(_0x1bebb6,_0x48a78a){_0x1bebb6=_0x1bebb6-0x0;var _0x94b92a=_0xdac7[_0x1bebb6];return _0x94b92a;};'use strict';var EventEmitter=require(_0x7dac('0x0'));var VoiceQueueReport=require(_0x7dac('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7dac('0x2'),'afterDestroy':_0x7dac('0x3')};function emitEvent(_0x10eadc){return function(_0x3c4806,_0x56d2ac,_0x4f55eb){VoiceQueueReportEvents['emit'](_0x10eadc+':'+_0x3c4806['id'],_0x3c4806);VoiceQueueReportEvents[_0x7dac('0x4')](_0x10eadc,_0x3c4806);_0x4f55eb(null);};}for(var e in events){if(events[_0x7dac('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7dac('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6192=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1ca0a8,_0x1487c4){var _0x5333f2=function(_0x415522){while(--_0x415522){_0x1ca0a8['push'](_0x1ca0a8['shift']());}};_0x5333f2(++_0x1487c4);}(_0x6192,0x19e));var _0x2619=function(_0x5ddb42,_0x563169){_0x5ddb42=_0x5ddb42-0x0;var _0x36deb6=_0x6192[_0x5ddb42];return _0x36deb6;};'use strict';var EventEmitter=require(_0x2619('0x0'));var VoiceQueueReport=require(_0x2619('0x1'))['db'][_0x2619('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2619('0x3')](0x0);var events={'afterCreate':_0x2619('0x4'),'afterUpdate':_0x2619('0x5'),'afterDestroy':_0x2619('0x6')};function emitEvent(_0x2a89a6){return function(_0x306281,_0x5d25fb,_0x41537b){VoiceQueueReportEvents[_0x2619('0x7')](_0x2a89a6+':'+_0x306281['id'],_0x306281);VoiceQueueReportEvents[_0x2619('0x7')](_0x2a89a6,_0x306281);_0x41537b(null);};}for(var e in events){if(events[_0x2619('0x8')](e)){var event=events[e];VoiceQueueReport[_0x2619('0x9')](e,emitEvent(event));}}module[_0x2619('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ff841c2..fb739a6 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x4bd4b4,_0x3a8c4c){var _0x31c025=function(_0x1cbea5){while(--_0x1cbea5){_0x4bd4b4['push'](_0x4bd4b4['shift']());}};_0x31c025(++_0x3a8c4c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x309e0c,_0x319529){var _0x792161=function(_0x3a2ae7){while(--_0x3a2ae7){_0x309e0c['push'](_0x309e0c['shift']());}};_0x792161(++_0x319529);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c0a3cd4..bb70dac 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 _0xb3c5=['VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','limit','include','map','model','attributes','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','then'];(function(_0x707029,_0x5461ef){var _0x1bb107=function(_0x30e3de){while(--_0x30e3de){_0x707029['push'](_0x707029['shift']());}};_0x1bb107(++_0x5461ef);}(_0xb3c5,0x192));var _0x5b3c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb3c5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x5b3c('0x0'));var util=require(_0x5b3c('0x1'));var moment=require(_0x5b3c('0x2'));var BPromise=require(_0x5b3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b3c('0x4'));var db=require(_0x5b3c('0x5'))['db'];var utils=require(_0x5b3c('0x6'));var logger=require(_0x5b3c('0x7'))(_0x5b3c('0x8'));var config=require('../../config/environment');var jayson=require(_0x5b3c('0x9'));var client=jayson[_0x5b3c('0xa')][_0x5b3c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x5b3c('0xc'),'port':0x18eb});var socket=require(_0x5b3c('0xd'))(new Redis(config[_0x5b3c('0xe')]));require(_0x5b3c('0xf'))[_0x5b3c('0x10')](socket);function respondWithRpcPromise(_0x43440f,_0x5b6270,_0x1cc774){return new BPromise(function(_0xca0f3,_0x550667){return client['request'](_0x43440f,_0x1cc774)[_0x5b3c('0x11')](function(_0x325e28){logger['info'](_0x5b3c('0x12'),_0x5b6270,'request\x20sent');logger[_0x5b3c('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5b6270,_0x5b3c('0x14'),JSON[_0x5b3c('0x15')](_0x325e28));if(_0x325e28[_0x5b3c('0x16')]){if(_0x325e28[_0x5b3c('0x16')][_0x5b3c('0x17')]===0x1f4){logger[_0x5b3c('0x16')](_0x5b3c('0x12'),_0x5b6270,_0x325e28[_0x5b3c('0x16')][_0x5b3c('0x18')]);return _0x550667(_0x325e28[_0x5b3c('0x16')][_0x5b3c('0x18')]);}logger[_0x5b3c('0x16')](_0x5b3c('0x12'),_0x5b6270,_0x325e28['error'][_0x5b3c('0x18')]);return _0xca0f3(_0x325e28[_0x5b3c('0x16')]['message']);}else{logger[_0x5b3c('0x19')](_0x5b3c('0x12'),_0x5b6270,_0x5b3c('0x14'));_0xca0f3(_0x325e28[_0x5b3c('0x1a')]['message']);}})[_0x5b3c('0x1b')](function(_0x5f40b3){logger['error'](_0x5b3c('0x12'),_0x5b6270,_0x5f40b3);_0x550667(_0x5f40b3);});});}exports[_0x5b3c('0x1c')]=function(_0x3cd08b){var _0x307586=this;return new Promise(function(_0x25631b,_0xa8883c){return db[_0x5b3c('0x1d')]['findAll']({'raw':_0x3cd08b[_0x5b3c('0x1e')]?_0x3cd08b[_0x5b3c('0x1e')][_0x5b3c('0x1f')]===undefined?!![]:![]:!![],'where':_0x3cd08b[_0x5b3c('0x1e')]?_0x3cd08b['options']['where']||null:null,'attributes':_0x3cd08b[_0x5b3c('0x1e')]?_0x3cd08b[_0x5b3c('0x1e')]['attributes']||null:null,'limit':_0x3cd08b[_0x5b3c('0x1e')]?_0x3cd08b[_0x5b3c('0x1e')][_0x5b3c('0x20')]||null:null,'include':_0x3cd08b[_0x5b3c('0x1e')]?_0x3cd08b[_0x5b3c('0x1e')][_0x5b3c('0x21')]?_[_0x5b3c('0x22')](_0x3cd08b[_0x5b3c('0x1e')]['include'],function(_0x2e9ab3){return{'model':db[_0x2e9ab3[_0x5b3c('0x23')]],'as':_0x2e9ab3['as'],'attributes':_0x2e9ab3[_0x5b3c('0x24')],'include':_0x2e9ab3[_0x5b3c('0x21')]?_[_0x5b3c('0x22')](_0x2e9ab3[_0x5b3c('0x21')],function(_0x4f5197){return{'model':db[_0x4f5197['model']],'as':_0x4f5197['as'],'attributes':_0x4f5197[_0x5b3c('0x24')],'include':_0x4f5197[_0x5b3c('0x21')]?_[_0x5b3c('0x22')](_0x4f5197[_0x5b3c('0x21')],function(_0x221860){return{'model':db[_0x221860[_0x5b3c('0x23')]],'as':_0x221860['as'],'attributes':_0x221860[_0x5b3c('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5b3c('0x11')](function(_0x57b030){logger[_0x5b3c('0x19')](_0x5b3c('0x1c'),_0x3cd08b);logger[_0x5b3c('0x13')]('GetVoiceQueueReport',_0x3cd08b,JSON['stringify'](_0x57b030));_0x25631b(_0x57b030);})['catch'](function(_0x38e10f){logger['error']('GetVoiceQueueReport',_0x38e10f[_0x5b3c('0x18')],_0x3cd08b);_0xa8883c(_0x307586['error'](0x1f4,_0x38e10f[_0x5b3c('0x18')]));});});};exports[_0x5b3c('0x25')]=function(_0x4836c5){var _0x2b9e26=this;return new Promise(function(_0x5bfe5a,_0x13b13f){return db[_0x5b3c('0x1d')][_0x5b3c('0x26')](_0x4836c5[_0x5b3c('0x27')],{'raw':_0x4836c5[_0x5b3c('0x1e')]?_0x4836c5['options'][_0x5b3c('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x3e7cde){logger[_0x5b3c('0x19')](_0x5b3c('0x25'),_0x4836c5);logger[_0x5b3c('0x13')](_0x5b3c('0x25'),_0x4836c5,JSON[_0x5b3c('0x15')](_0x3e7cde));_0x5bfe5a(_0x3e7cde);})[_0x5b3c('0x1b')](function(_0x41d2c9){logger[_0x5b3c('0x16')](_0x5b3c('0x25'),_0x41d2c9[_0x5b3c('0x18')],_0x4836c5);_0x13b13f(_0x2b9e26[_0x5b3c('0x16')](0x1f4,_0x41d2c9[_0x5b3c('0x18')]));});});};exports[_0x5b3c('0x28')]=function(_0x42cd9d){var _0x3b4949=this;return new Promise(function(_0x231f44,_0x299ada){return db[_0x5b3c('0x1d')]['update'](_0x42cd9d[_0x5b3c('0x27')],{'raw':_0x42cd9d['options']?_0x42cd9d['options'][_0x5b3c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42cd9d[_0x5b3c('0x1e')]?_0x42cd9d[_0x5b3c('0x1e')][_0x5b3c('0x29')]||null:null,'attributes':_0x42cd9d['options']?_0x42cd9d[_0x5b3c('0x1e')][_0x5b3c('0x24')]||null:null,'limit':_0x42cd9d[_0x5b3c('0x1e')]?_0x42cd9d['options']['limit']||null:null})[_0x5b3c('0x11')](function(_0xe24874){logger[_0x5b3c('0x19')]('UpdateVoiceQueueReport',_0x42cd9d);logger[_0x5b3c('0x13')](_0x5b3c('0x28'),_0x42cd9d,JSON[_0x5b3c('0x15')](_0xe24874));_0x231f44(_0xe24874);})[_0x5b3c('0x1b')](function(_0x6b05af){logger[_0x5b3c('0x16')]('UpdateVoiceQueueReport',_0x6b05af[_0x5b3c('0x18')],_0x42cd9d);_0x299ada(_0x3b4949[_0x5b3c('0x16')](0x1f4,_0x6b05af[_0x5b3c('0x18')]));});});}; \ No newline at end of file +var _0xcb55=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueReport','options','raw','where','attributes','limit','include','model','map','debug','VoiceQueueReport','create','body','CreateVoiceQueueReport','stringify','update','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcb55,0x1c9));var _0x5cb5=function(_0x24896b,_0x145d9f){_0x24896b=_0x24896b-0x0;var _0x2421b1=_0xcb55[_0x24896b];return _0x2421b1;};'use strict';var _=require(_0x5cb5('0x0'));var util=require(_0x5cb5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5cb5('0x2'));var fs=require('fs');var Redis=require(_0x5cb5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cb5('0x4'));var logger=require(_0x5cb5('0x5'))(_0x5cb5('0x6'));var config=require(_0x5cb5('0x7'));var jayson=require(_0x5cb5('0x8'));var client=jayson['client'][_0x5cb5('0x9')]({'port':0x232a});config[_0x5cb5('0xa')]=_['defaults'](config[_0x5cb5('0xa')],{'host':_0x5cb5('0xb'),'port':0x18eb});var socket=require(_0x5cb5('0xc'))(new Redis(config['redis']));require(_0x5cb5('0xd'))[_0x5cb5('0xe')](socket);function respondWithRpcPromise(_0x2ffbf2,_0x22d660,_0x1c928e){return new BPromise(function(_0x22b25c,_0x58c747){return client[_0x5cb5('0xf')](_0x2ffbf2,_0x1c928e)[_0x5cb5('0x10')](function(_0x3aa866){logger[_0x5cb5('0x11')](_0x5cb5('0x12'),_0x22d660,_0x5cb5('0x13'));logger['debug'](_0x5cb5('0x14'),_0x22d660,_0x5cb5('0x13'),JSON['stringify'](_0x3aa866));if(_0x3aa866['error']){if(_0x3aa866[_0x5cb5('0x15')]['code']===0x1f4){logger[_0x5cb5('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x22d660,_0x3aa866[_0x5cb5('0x15')][_0x5cb5('0x16')]);return _0x58c747(_0x3aa866[_0x5cb5('0x15')][_0x5cb5('0x16')]);}logger['error'](_0x5cb5('0x12'),_0x22d660,_0x3aa866[_0x5cb5('0x15')][_0x5cb5('0x16')]);return _0x22b25c(_0x3aa866[_0x5cb5('0x15')]['message']);}else{logger[_0x5cb5('0x11')](_0x5cb5('0x12'),_0x22d660,_0x5cb5('0x13'));_0x22b25c(_0x3aa866[_0x5cb5('0x17')]['message']);}})[_0x5cb5('0x18')](function(_0x3d2e82){logger[_0x5cb5('0x15')](_0x5cb5('0x12'),_0x22d660,_0x3d2e82);_0x58c747(_0x3d2e82);});});}exports[_0x5cb5('0x19')]=function(_0x1afd43){var _0x18d618=this;return new Promise(function(_0x440f75,_0x3bb13b){return db['VoiceQueueReport']['findAll']({'raw':_0x1afd43[_0x5cb5('0x1a')]?_0x1afd43[_0x5cb5('0x1a')][_0x5cb5('0x1b')]===undefined?!![]:![]:!![],'where':_0x1afd43[_0x5cb5('0x1a')]?_0x1afd43[_0x5cb5('0x1a')][_0x5cb5('0x1c')]||null:null,'attributes':_0x1afd43['options']?_0x1afd43[_0x5cb5('0x1a')][_0x5cb5('0x1d')]||null:null,'limit':_0x1afd43[_0x5cb5('0x1a')]?_0x1afd43[_0x5cb5('0x1a')][_0x5cb5('0x1e')]||null:null,'include':_0x1afd43['options']?_0x1afd43['options'][_0x5cb5('0x1f')]?_['map'](_0x1afd43[_0x5cb5('0x1a')][_0x5cb5('0x1f')],function(_0x17c74c){return{'model':db[_0x17c74c[_0x5cb5('0x20')]],'as':_0x17c74c['as'],'attributes':_0x17c74c['attributes'],'include':_0x17c74c[_0x5cb5('0x1f')]?_['map'](_0x17c74c[_0x5cb5('0x1f')],function(_0x7fe808){return{'model':db[_0x7fe808['model']],'as':_0x7fe808['as'],'attributes':_0x7fe808[_0x5cb5('0x1d')],'include':_0x7fe808[_0x5cb5('0x1f')]?_[_0x5cb5('0x21')](_0x7fe808[_0x5cb5('0x1f')],function(_0x12656c){return{'model':db[_0x12656c['model']],'as':_0x12656c['as'],'attributes':_0x12656c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5cb5('0x10')](function(_0x1fb6f8){logger[_0x5cb5('0x11')](_0x5cb5('0x19'),_0x1afd43);logger[_0x5cb5('0x22')](_0x5cb5('0x19'),_0x1afd43,JSON['stringify'](_0x1fb6f8));_0x440f75(_0x1fb6f8);})[_0x5cb5('0x18')](function(_0x45b180){logger['error'](_0x5cb5('0x19'),_0x45b180[_0x5cb5('0x16')],_0x1afd43);_0x3bb13b(_0x18d618[_0x5cb5('0x15')](0x1f4,_0x45b180['message']));});});};exports['CreateVoiceQueueReport']=function(_0xcfec17){var _0x359ecc=this;return new Promise(function(_0x857397,_0x2422d9){return db[_0x5cb5('0x23')][_0x5cb5('0x24')](_0xcfec17[_0x5cb5('0x25')],{'raw':_0xcfec17['options']?_0xcfec17[_0x5cb5('0x1a')][_0x5cb5('0x1b')]===undefined?!![]:![]:!![]})[_0x5cb5('0x10')](function(_0x2c41d0){logger[_0x5cb5('0x11')]('CreateVoiceQueueReport',_0xcfec17);logger[_0x5cb5('0x22')](_0x5cb5('0x26'),_0xcfec17,JSON[_0x5cb5('0x27')](_0x2c41d0));_0x857397(_0x2c41d0);})['catch'](function(_0x5af4ff){logger[_0x5cb5('0x15')](_0x5cb5('0x26'),_0x5af4ff['message'],_0xcfec17);_0x2422d9(_0x359ecc[_0x5cb5('0x15')](0x1f4,_0x5af4ff[_0x5cb5('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3d65ea){var _0x4aea82=this;return new Promise(function(_0x3aeca2,_0x1da081){return db[_0x5cb5('0x23')][_0x5cb5('0x28')](_0x3d65ea[_0x5cb5('0x25')],{'raw':_0x3d65ea[_0x5cb5('0x1a')]?_0x3d65ea[_0x5cb5('0x1a')][_0x5cb5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d65ea[_0x5cb5('0x1a')]?_0x3d65ea['options'][_0x5cb5('0x1c')]||null:null,'attributes':_0x3d65ea['options']?_0x3d65ea[_0x5cb5('0x1a')][_0x5cb5('0x1d')]||null:null,'limit':_0x3d65ea[_0x5cb5('0x1a')]?_0x3d65ea[_0x5cb5('0x1a')][_0x5cb5('0x1e')]||null:null})[_0x5cb5('0x10')](function(_0x476519){logger[_0x5cb5('0x11')](_0x5cb5('0x29'),_0x3d65ea);logger[_0x5cb5('0x22')](_0x5cb5('0x29'),_0x3d65ea,JSON[_0x5cb5('0x27')](_0x476519));_0x3aeca2(_0x476519);})['catch'](function(_0x2658c6){logger[_0x5cb5('0x15')](_0x5cb5('0x29'),_0x2658c6[_0x5cb5('0x16')],_0x3d65ea);_0x1da081(_0x4aea82[_0x5cb5('0x15')](0x1f4,_0x2658c6[_0x5cb5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 3a06e65..138e405 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 _0x722b=['update','emit','removeListener','register','length','./voiceQueueReport.events','save','remove'];(function(_0x4bbc9f,_0x3bc3c0){var _0x575b0c=function(_0x3b9371){while(--_0x3b9371){_0x4bbc9f['push'](_0x4bbc9f['shift']());}};_0x575b0c(++_0x3bc3c0);}(_0x722b,0xed));var _0xb722=function(_0x4e2d9a,_0x46cc34){_0x4e2d9a=_0x4e2d9a-0x0;var _0x11540c=_0x722b[_0x4e2d9a];return _0x11540c;};'use strict';var VoiceQueueReportEvents=require(_0xb722('0x0'));var events=[_0xb722('0x1'),_0xb722('0x2'),_0xb722('0x3')];function createListener(_0x3db013,_0xc6f870){return function(_0xb5a9){_0xc6f870[_0xb722('0x4')](_0x3db013,_0xb5a9);};}function removeListener(_0x1b4f79,_0x341ed3){return function(){VoiceQueueReportEvents[_0xb722('0x5')](_0x1b4f79,_0x341ed3);};}exports[_0xb722('0x6')]=function(_0x4a0080){for(var _0x2d2f54=0x0,_0x51c2ee=events[_0xb722('0x7')];_0x2d2f54<_0x51c2ee;_0x2d2f54++){var _0x581cc1=events[_0x2d2f54];var _0x275394=createListener('voiceQueueReport:'+_0x581cc1,_0x4a0080);VoiceQueueReportEvents['on'](_0x581cc1,_0x275394);}}; \ No newline at end of file +var _0x0216=['save','update','removeListener','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x0216,0x149));var _0x6021=function(_0x56e378,_0x418e12){_0x56e378=_0x56e378-0x0;var _0x1c8ac0=_0x0216[_0x56e378];return _0x1c8ac0;};'use strict';var VoiceQueueReportEvents=require(_0x6021('0x0'));var events=[_0x6021('0x1'),'remove',_0x6021('0x2')];function createListener(_0x3bdf7b,_0x262d25){return function(_0x4036d0){_0x262d25['emit'](_0x3bdf7b,_0x4036d0);};}function removeListener(_0xf988c7,_0xbfc14a){return function(){VoiceQueueReportEvents[_0x6021('0x3')](_0xf988c7,_0xbfc14a);};}exports['register']=function(_0xd9c39){for(var _0x159a2e=0x0,_0x5d6160=events[_0x6021('0x4')];_0x159a2e<_0x5d6160;_0x159a2e++){var _0x5710cd=events[_0x159a2e];var _0x189cc2=createListener(_0x6021('0x5')+_0x5710cd,_0xd9c39);VoiceQueueReportEvents['on'](_0x5710cd,_0x189cc2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ddb04e3..64c0a99 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 _0x0488=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','/:id'];(function(_0x28cbe4,_0x38e398){var _0x4f7670=function(_0x120b46){while(--_0x120b46){_0x28cbe4['push'](_0x28cbe4['shift']());}};_0x4f7670(++_0x38e398);}(_0x0488,0x17d));var _0x8048=function(_0x14d03,_0xfb5270){_0x14d03=_0x14d03-0x0;var _0x393cf8=_0x0488[_0x14d03];return _0x393cf8;};'use strict';var multer=require(_0x8048('0x0'));var util=require(_0x8048('0x1'));var path=require(_0x8048('0x2'));var timeout=require(_0x8048('0x3'));var express=require(_0x8048('0x4'));var router=express[_0x8048('0x5')]();var auth=require(_0x8048('0x6'));var interaction=require(_0x8048('0x7'));var config=require(_0x8048('0x8'));var controller=require(_0x8048('0x9'));router[_0x8048('0xa')]('/',auth['isAuthenticated'](),controller[_0x8048('0xb')]);router[_0x8048('0xa')]('/:id',auth[_0x8048('0xc')](),controller[_0x8048('0xd')]);router['post']('/',auth[_0x8048('0xc')](),controller['create']);router['put'](_0x8048('0xe'),auth['isAuthenticated'](),controller[_0x8048('0xf')]);router['delete'](_0x8048('0xe'),auth[_0x8048('0xc')](),controller[_0x8048('0x10')]);module[_0x8048('0x11')]=router; \ No newline at end of file +var _0xd679=['/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x4a6d74,_0x473c7b){var _0x2f0559=function(_0x64e425){while(--_0x64e425){_0x4a6d74['push'](_0x4a6d74['shift']());}};_0x2f0559(++_0x473c7b);}(_0xd679,0x14d));var _0x9d67=function(_0xd9b077,_0x23f97f){_0xd9b077=_0xd9b077-0x0;var _0x293ac3=_0xd679[_0xd9b077];return _0x293ac3;};'use strict';var multer=require(_0x9d67('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9d67('0x1'));var express=require(_0x9d67('0x2'));var router=express[_0x9d67('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d67('0x4'));var config=require(_0x9d67('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x9d67('0x6')]('/',auth[_0x9d67('0x7')](),controller[_0x9d67('0x8')]);router[_0x9d67('0x6')](_0x9d67('0x9'),auth['isAuthenticated'](),controller[_0x9d67('0xa')]);router[_0x9d67('0xb')]('/',auth[_0x9d67('0x7')](),controller[_0x9d67('0xc')]);router[_0x9d67('0xd')](_0x9d67('0x9'),auth[_0x9d67('0x7')](),controller[_0x9d67('0xe')]);router[_0x9d67('0xf')](_0x9d67('0x9'),auth['isAuthenticated'](),controller[_0x9d67('0x10')]);module[_0x9d67('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 40a69d9..6c3dae3 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 _0xbe49=['sequelize','moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e8eca,_0x745354){var _0x5a4e15=function(_0x1348ce){while(--_0x1348ce){_0x3e8eca['push'](_0x3e8eca['shift']());}};_0x5a4e15(++_0x745354);}(_0xbe49,0x19e));var _0x9be4=function(_0x1c78c7,_0x78601d){_0x1c78c7=_0x1c78c7-0x0;var _0x48eb3b=_0xbe49[_0x1c78c7];return _0x48eb3b;};'use strict';var Sequelize=require(_0x9be4('0x0'));var moment=require(_0x9be4('0x1'));module[_0x9be4('0x2')]={'time':{'type':Sequelize[_0x9be4('0x3')]},'callid':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x9be4('0x4')](_0x9be4('0x5'))}}; \ No newline at end of file +var _0xaa9a=['sequelize','exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x173040,_0xcff306){var _0x39fb40=function(_0x1aaf2b){while(--_0x1aaf2b){_0x173040['push'](_0x173040['shift']());}};_0x39fb40(++_0xcff306);}(_0xaa9a,0x150));var _0xaaa9=function(_0x20d507,_0x4c1891){_0x20d507=_0x20d507-0x0;var _0xb526b7=_0xaa9a[_0x20d507];return _0xb526b7;};'use strict';var Sequelize=require(_0xaaa9('0x0'));var moment=require('moment');module[_0xaaa9('0x1')]={'time':{'type':Sequelize[_0xaaa9('0x2')]},'callid':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xaaa9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xaaa9('0x3')],'allowNull':![],'defaultValue':moment()[_0xaaa9('0x4')](_0xaaa9('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index df4f56f..9733905 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 _0x9ffd=['query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','includeAll','include','catch','show','params','keys','filtears','fields','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model'];(function(_0x201b94,_0x5cada6){var _0x49da82=function(_0x503bea){while(--_0x503bea){_0x201b94['push'](_0x201b94['shift']());}};_0x49da82(++_0x5cada6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x33b46b,_0x52483e){_0x33b46b=_0x33b46b-0x0;var _0x364edc=_0x9ffd[_0x33b46b];return _0x364edc;};'use strict';var pdf=require(_0xd9ff('0x0'));var emlformat=require(_0xd9ff('0x1'));var rimraf=require(_0xd9ff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ff('0x3'));var rp=require(_0xd9ff('0x4'));var moment=require(_0xd9ff('0x5'));var BPromise=require(_0xd9ff('0x6'));var Mustache=require('mustache');var util=require(_0xd9ff('0x7'));var path=require(_0xd9ff('0x8'));var sox=require('sox');var csv=require(_0xd9ff('0x9'));var ejs=require(_0xd9ff('0xa'));var fs=require('fs');var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x9'));var querystring=require(_0xd9ff('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x11'));var hardwareService=require(_0xd9ff('0x12'));var logger=require(_0xd9ff('0x13'))(_0xd9ff('0x14'));var utils=require(_0xd9ff('0x15'));var config=require(_0xd9ff('0x16'));var licenseUtil=require(_0xd9ff('0x17'));var db=require(_0xd9ff('0x18'))['db'];function respondWithStatusCode(_0x47d842,_0x47b0d7){_0x47b0d7=_0x47b0d7||0xcc;return function(_0xaaf7af){if(_0xaaf7af){return _0x47d842[_0xd9ff('0x19')](_0x47b0d7);}return _0x47d842[_0xd9ff('0x1a')](_0x47b0d7)[_0xd9ff('0x1b')]();};}function respondWithResult(_0x12c39a,_0x556aa4){_0x556aa4=_0x556aa4||0xc8;return function(_0x2f78c1){if(_0x2f78c1){return _0x12c39a[_0xd9ff('0x1a')](_0x556aa4)['json'](_0x2f78c1);}};}function respondWithFilteredResult(_0xf14c9f,_0x5db010){return function(_0x4ffe54){if(_0x4ffe54){var _0x547e28=_0x4ffe54[_0xd9ff('0x1c')],_0x4c5718=_0x5db010[_0xd9ff('0x1d')],_0x271287=_0x5db010[_0xd9ff('0x1d')]+_0x5db010[_0xd9ff('0x1e')],_0x4f9d6d;if(_0x271287>=_0x547e28){_0x271287=_0x547e28;_0x4f9d6d=0xc8;}else{_0x4f9d6d=0xce;}_0xf14c9f[_0xd9ff('0x1a')](_0x4f9d6d);return _0xf14c9f[_0xd9ff('0x1f')](_0xd9ff('0x20'),_0x4c5718+'-'+_0x271287+'/'+_0x547e28)[_0xd9ff('0x21')](_0x4ffe54);}return null;};}function patchUpdates(_0x182775){return function(_0x1f028f){try{jsonpatch[_0xd9ff('0x22')](_0x1f028f,_0x182775,!![]);}catch(_0x39ef37){return BPromise[_0xd9ff('0x23')](_0x39ef37);}return _0x1f028f['save']();};}function saveUpdates(_0x4cf8ec,_0x264a3d){return function(_0x3eed13){if(_0x3eed13){return _0x3eed13['update'](_0x4cf8ec)['then'](function(_0x5ab7b6){return _0x5ab7b6;});}return null;};}function removeEntity(_0x4b1477,_0x1f4d9e){return function(_0x58eb5f){if(_0x58eb5f){return _0x58eb5f[_0xd9ff('0x24')]()[_0xd9ff('0x25')](function(){_0x4b1477[_0xd9ff('0x1a')](0xcc)[_0xd9ff('0x1b')]();});}};}function handleEntityNotFound(_0x278b66,_0x42a828){return function(_0x4b058a){if(!_0x4b058a){_0x278b66['sendStatus'](0x194);}return _0x4b058a;};}function handleError(_0x1136e9,_0x599fec){_0x599fec=_0x599fec||0x1f4;return function(_0x3ca906){logger['error'](_0x3ca906[_0xd9ff('0x26')]);if(_0x3ca906['name']){delete _0x3ca906[_0xd9ff('0x27')];}_0x1136e9[_0xd9ff('0x1a')](_0x599fec)[_0xd9ff('0x28')](_0x3ca906);};}exports[_0xd9ff('0x29')]=function(_0x5d685e,_0x11a17b){var _0xe11f88={},_0x1c78c4={},_0x4390f7={'count':0x0,'rows':[]};var _0x5c1c1f=_[_0xd9ff('0x2a')](db[_0xd9ff('0x2b')][_0xd9ff('0x2c')],function(_0x45fb63){return{'name':_0x45fb63[_0xd9ff('0x2d')],'type':_0x45fb63[_0xd9ff('0x2e')][_0xd9ff('0x2f')]};});_0x1c78c4[_0xd9ff('0x30')]=_[_0xd9ff('0x2a')](_0x5c1c1f,'name');_0x1c78c4[_0xd9ff('0x31')]=_['keys'](_0x5d685e[_0xd9ff('0x31')]);_0x1c78c4[_0xd9ff('0x32')]=_[_0xd9ff('0x33')](_0x1c78c4['model'],_0x1c78c4[_0xd9ff('0x31')]);_0xe11f88[_0xd9ff('0x34')]=_[_0xd9ff('0x33')](_0x1c78c4[_0xd9ff('0x30')],qs['fields'](_0x5d685e[_0xd9ff('0x31')]['fields']));_0xe11f88[_0xd9ff('0x34')]=_0xe11f88[_0xd9ff('0x34')][_0xd9ff('0x35')]?_0xe11f88[_0xd9ff('0x34')]:_0x1c78c4[_0xd9ff('0x30')];if(!_0x5d685e[_0xd9ff('0x31')][_0xd9ff('0x36')](_0xd9ff('0x37'))){_0xe11f88[_0xd9ff('0x1e')]=qs[_0xd9ff('0x1e')](_0x5d685e[_0xd9ff('0x31')][_0xd9ff('0x1e')]);_0xe11f88[_0xd9ff('0x1d')]=qs[_0xd9ff('0x1d')](_0x5d685e['query'][_0xd9ff('0x1d')]);}_0xe11f88[_0xd9ff('0x38')]=qs[_0xd9ff('0x39')](_0x5d685e['query'][_0xd9ff('0x39')]);_0xe11f88['where']=qs[_0xd9ff('0x32')](_['pick'](_0x5d685e[_0xd9ff('0x31')],_0x1c78c4['filters']),_0x5c1c1f);if(_0x5d685e[_0xd9ff('0x31')][_0xd9ff('0x3a')]){_0xe11f88[_0xd9ff('0x3b')]=_['merge'](_0xe11f88['where'],{'$or':_['map'](_0x5c1c1f,function(_0x7ac3d1){if(_0x7ac3d1[_0xd9ff('0x2e')]!==_0xd9ff('0x3c')){var _0x107a9f={};_0x107a9f[_0x7ac3d1[_0xd9ff('0x27')]]={'$like':'%'+_0x5d685e[_0xd9ff('0x31')]['filter']+'%'};return _0x107a9f;}})});}_0xe11f88=_['merge']({},_0xe11f88,_0x5d685e['options']);var _0x316d93={'where':_0xe11f88[_0xd9ff('0x3b')]};return db[_0xd9ff('0x2b')][_0xd9ff('0x1c')](_0x316d93)['then'](function(_0x2692c0){_0x4390f7['count']=_0x2692c0;if(_0x5d685e[_0xd9ff('0x31')][_0xd9ff('0x3d')]){_0xe11f88[_0xd9ff('0x3e')]=[{'all':!![]}];}return db[_0xd9ff('0x2b')]['findAll'](_0xe11f88);})[_0xd9ff('0x25')](function(_0x2d4d97){_0x4390f7['rows']=_0x2d4d97;return _0x4390f7;})[_0xd9ff('0x25')](respondWithFilteredResult(_0x11a17b,_0xe11f88))[_0xd9ff('0x3f')](handleError(_0x11a17b,null));};exports[_0xd9ff('0x40')]=function(_0x3ba5ff,_0x1fe44d){var _0x1cc848={'raw':!![],'where':{'id':_0x3ba5ff[_0xd9ff('0x41')]['id']}},_0x57c496={};_0x57c496[_0xd9ff('0x30')]=_[_0xd9ff('0x42')](db[_0xd9ff('0x2b')][_0xd9ff('0x2c')]);_0x57c496['query']=_[_0xd9ff('0x42')](_0x3ba5ff[_0xd9ff('0x31')]);_0x57c496[_0xd9ff('0x43')]=_['intersection'](_0x57c496['model'],_0x57c496[_0xd9ff('0x31')]);_0x1cc848[_0xd9ff('0x34')]=_[_0xd9ff('0x33')](_0x57c496[_0xd9ff('0x30')],qs[_0xd9ff('0x44')](_0x3ba5ff[_0xd9ff('0x31')]['fields']));_0x1cc848[_0xd9ff('0x34')]=_0x1cc848[_0xd9ff('0x34')]['length']?_0x1cc848[_0xd9ff('0x34')]:_0x57c496[_0xd9ff('0x30')];if(_0x3ba5ff[_0xd9ff('0x31')][_0xd9ff('0x3d')]){_0x1cc848[_0xd9ff('0x3e')]=[{'all':!![]}];}_0x1cc848=_['merge']({},_0x1cc848,_0x3ba5ff['options']);return db['VoiceQueuesLog'][_0xd9ff('0x45')](_0x1cc848)['then'](handleEntityNotFound(_0x1fe44d,null))[_0xd9ff('0x25')](respondWithResult(_0x1fe44d,null))[_0xd9ff('0x3f')](handleError(_0x1fe44d,null));};exports[_0xd9ff('0x46')]=function(_0x4cfba7,_0x396736){return db[_0xd9ff('0x2b')]['create'](_0x4cfba7[_0xd9ff('0x47')],{})[_0xd9ff('0x25')](respondWithResult(_0x396736,0xc9))[_0xd9ff('0x3f')](handleError(_0x396736,null));};exports[_0xd9ff('0x48')]=function(_0x559101,_0x38b5b6){if(_0x559101['body']['id']){delete _0x559101[_0xd9ff('0x47')]['id'];}return db['VoiceQueuesLog'][_0xd9ff('0x45')]({'where':{'id':_0x559101[_0xd9ff('0x41')]['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0x38b5b6,null))[_0xd9ff('0x25')](saveUpdates(_0x559101[_0xd9ff('0x47')],null))['then'](respondWithResult(_0x38b5b6,null))[_0xd9ff('0x3f')](handleError(_0x38b5b6,null));};exports[_0xd9ff('0x24')]=function(_0x2fbe53,_0xa3f86d){return db['VoiceQueuesLog']['find']({'where':{'id':_0x2fbe53['params']['id']}})[_0xd9ff('0x25')](handleEntityNotFound(_0xa3f86d,null))[_0xd9ff('0x25')](removeEntity(_0xa3f86d,null))[_0xd9ff('0x3f')](handleError(_0xa3f86d,null));}; \ No newline at end of file +var _0x0abf=['options','find','create','body','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','count','includeAll','include','findAll','catch','show','params','keys','filtears','fields'];(function(_0x1ccf46,_0x1c6bd8){var _0x480a65=function(_0x296984){while(--_0x296984){_0x1ccf46['push'](_0x1ccf46['shift']());}};_0x480a65(++_0x1c6bd8);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var licenseUtil=require(_0xf0ab('0x15'));var db=require(_0xf0ab('0x16'))['db'];function respondWithStatusCode(_0x38ca67,_0x34ccdc){_0x34ccdc=_0x34ccdc||0xcc;return function(_0x4fdd5f){if(_0x4fdd5f){return _0x38ca67[_0xf0ab('0x17')](_0x34ccdc);}return _0x38ca67[_0xf0ab('0x18')](_0x34ccdc)[_0xf0ab('0x19')]();};}function respondWithResult(_0x35c75f,_0x1824ef){_0x1824ef=_0x1824ef||0xc8;return function(_0x36cabe){if(_0x36cabe){return _0x35c75f[_0xf0ab('0x18')](_0x1824ef)[_0xf0ab('0x1a')](_0x36cabe);}};}function respondWithFilteredResult(_0x180d0b,_0x3c5bfd){return function(_0x20f453){if(_0x20f453){var _0x221bac=_0x20f453['count'],_0x200cf5=_0x3c5bfd[_0xf0ab('0x1b')],_0x2f4618=_0x3c5bfd[_0xf0ab('0x1b')]+_0x3c5bfd[_0xf0ab('0x1c')],_0x230f40;if(_0x2f4618>=_0x221bac){_0x2f4618=_0x221bac;_0x230f40=0xc8;}else{_0x230f40=0xce;}_0x180d0b[_0xf0ab('0x18')](_0x230f40);return _0x180d0b[_0xf0ab('0x1d')](_0xf0ab('0x1e'),_0x200cf5+'-'+_0x2f4618+'/'+_0x221bac)[_0xf0ab('0x1a')](_0x20f453);}return null;};}function patchUpdates(_0x263e2b){return function(_0x1713d6){try{jsonpatch[_0xf0ab('0x1f')](_0x1713d6,_0x263e2b,!![]);}catch(_0x715579){return BPromise[_0xf0ab('0x20')](_0x715579);}return _0x1713d6[_0xf0ab('0x21')]();};}function saveUpdates(_0x22a205,_0x2cd961){return function(_0x45c1c9){if(_0x45c1c9){return _0x45c1c9['update'](_0x22a205)[_0xf0ab('0x22')](function(_0x6fa888){return _0x6fa888;});}return null;};}function removeEntity(_0x1e1483,_0x11ab3a){return function(_0x3bf6a1){if(_0x3bf6a1){return _0x3bf6a1[_0xf0ab('0x23')]()[_0xf0ab('0x22')](function(){_0x1e1483[_0xf0ab('0x18')](0xcc)[_0xf0ab('0x19')]();});}};}function handleEntityNotFound(_0x18bb37,_0x43119f){return function(_0x5645b2){if(!_0x5645b2){_0x18bb37['sendStatus'](0x194);}return _0x5645b2;};}function handleError(_0x4eee21,_0x33aaa0){_0x33aaa0=_0x33aaa0||0x1f4;return function(_0x4f0caf){logger[_0xf0ab('0x24')](_0x4f0caf[_0xf0ab('0x25')]);if(_0x4f0caf['name']){delete _0x4f0caf[_0xf0ab('0x26')];}_0x4eee21[_0xf0ab('0x18')](_0x33aaa0)[_0xf0ab('0x27')](_0x4f0caf);};}exports[_0xf0ab('0x28')]=function(_0x7d4ff9,_0x502921){var _0x2d0da7={},_0x574ce7={},_0x55d799={'count':0x0,'rows':[]};var _0x1dcd2e=_[_0xf0ab('0x29')](db[_0xf0ab('0x2a')][_0xf0ab('0x2b')],function(_0x43476c){return{'name':_0x43476c[_0xf0ab('0x2c')],'type':_0x43476c[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x574ce7[_0xf0ab('0x2f')]=_[_0xf0ab('0x29')](_0x1dcd2e,_0xf0ab('0x26'));_0x574ce7[_0xf0ab('0x30')]=_['keys'](_0x7d4ff9[_0xf0ab('0x30')]);_0x574ce7[_0xf0ab('0x31')]=_['intersection'](_0x574ce7['model'],_0x574ce7[_0xf0ab('0x30')]);_0x2d0da7[_0xf0ab('0x32')]=_[_0xf0ab('0x33')](_0x574ce7['model'],qs['fields'](_0x7d4ff9[_0xf0ab('0x30')]['fields']));_0x2d0da7[_0xf0ab('0x32')]=_0x2d0da7['attributes'][_0xf0ab('0x34')]?_0x2d0da7[_0xf0ab('0x32')]:_0x574ce7['model'];if(!_0x7d4ff9['query'][_0xf0ab('0x35')](_0xf0ab('0x36'))){_0x2d0da7[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x1c')]);_0x2d0da7[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x1b')]);}_0x2d0da7[_0xf0ab('0x37')]=qs[_0xf0ab('0x38')](_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x38')]);_0x2d0da7['where']=qs[_0xf0ab('0x31')](_[_0xf0ab('0x39')](_0x7d4ff9[_0xf0ab('0x30')],_0x574ce7['filters']),_0x1dcd2e);if(_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x3a')]){_0x2d0da7[_0xf0ab('0x3b')]=_['merge'](_0x2d0da7[_0xf0ab('0x3b')],{'$or':_['map'](_0x1dcd2e,function(_0xda3971){if(_0xda3971['type']!==_0xf0ab('0x3c')){var _0x3ee6af={};_0x3ee6af[_0xda3971[_0xf0ab('0x26')]]={'$like':'%'+_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x3a')]+'%'};return _0x3ee6af;}})});}_0x2d0da7=_[_0xf0ab('0x3d')]({},_0x2d0da7,_0x7d4ff9['options']);var _0x1adead={'where':_0x2d0da7[_0xf0ab('0x3b')]};return db['VoiceQueuesLog'][_0xf0ab('0x3e')](_0x1adead)[_0xf0ab('0x22')](function(_0x1d4eec){_0x55d799[_0xf0ab('0x3e')]=_0x1d4eec;if(_0x7d4ff9[_0xf0ab('0x30')][_0xf0ab('0x3f')]){_0x2d0da7[_0xf0ab('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xf0ab('0x41')](_0x2d0da7);})[_0xf0ab('0x22')](function(_0x7c4629){_0x55d799['rows']=_0x7c4629;return _0x55d799;})[_0xf0ab('0x22')](respondWithFilteredResult(_0x502921,_0x2d0da7))[_0xf0ab('0x42')](handleError(_0x502921,null));};exports[_0xf0ab('0x43')]=function(_0x32b237,_0x2b7ed5){var _0x553d07={'raw':!![],'where':{'id':_0x32b237[_0xf0ab('0x44')]['id']}},_0x1b7974={};_0x1b7974[_0xf0ab('0x2f')]=_[_0xf0ab('0x45')](db[_0xf0ab('0x2a')][_0xf0ab('0x2b')]);_0x1b7974[_0xf0ab('0x30')]=_[_0xf0ab('0x45')](_0x32b237[_0xf0ab('0x30')]);_0x1b7974[_0xf0ab('0x46')]=_[_0xf0ab('0x33')](_0x1b7974[_0xf0ab('0x2f')],_0x1b7974[_0xf0ab('0x30')]);_0x553d07['attributes']=_['intersection'](_0x1b7974[_0xf0ab('0x2f')],qs['fields'](_0x32b237[_0xf0ab('0x30')][_0xf0ab('0x47')]));_0x553d07['attributes']=_0x553d07[_0xf0ab('0x32')][_0xf0ab('0x34')]?_0x553d07['attributes']:_0x1b7974[_0xf0ab('0x2f')];if(_0x32b237[_0xf0ab('0x30')][_0xf0ab('0x3f')]){_0x553d07[_0xf0ab('0x40')]=[{'all':!![]}];}_0x553d07=_[_0xf0ab('0x3d')]({},_0x553d07,_0x32b237[_0xf0ab('0x48')]);return db[_0xf0ab('0x2a')][_0xf0ab('0x49')](_0x553d07)[_0xf0ab('0x22')](handleEntityNotFound(_0x2b7ed5,null))[_0xf0ab('0x22')](respondWithResult(_0x2b7ed5,null))[_0xf0ab('0x42')](handleError(_0x2b7ed5,null));};exports[_0xf0ab('0x4a')]=function(_0x13b477,_0x99ce7){return db['VoiceQueuesLog']['create'](_0x13b477[_0xf0ab('0x4b')],{})['then'](respondWithResult(_0x99ce7,0xc9))['catch'](handleError(_0x99ce7,null));};exports['update']=function(_0xc3b68d,_0x45b32c){if(_0xc3b68d[_0xf0ab('0x4b')]['id']){delete _0xc3b68d[_0xf0ab('0x4b')]['id'];}return db[_0xf0ab('0x2a')][_0xf0ab('0x49')]({'where':{'id':_0xc3b68d[_0xf0ab('0x44')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x45b32c,null))[_0xf0ab('0x22')](saveUpdates(_0xc3b68d[_0xf0ab('0x4b')],null))[_0xf0ab('0x22')](respondWithResult(_0x45b32c,null))[_0xf0ab('0x42')](handleError(_0x45b32c,null));};exports['destroy']=function(_0x393c9a,_0x41065c){return db[_0xf0ab('0x2a')][_0xf0ab('0x49')]({'where':{'id':_0x393c9a[_0xf0ab('0x44')]['id']}})[_0xf0ab('0x22')](handleEntityNotFound(_0x41065c,null))[_0xf0ab('0x22')](removeEntity(_0x41065c,null))[_0xf0ab('0x42')](handleError(_0x41065c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8723f84..c08d714 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 _0x88de=['voice_queues_log','dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a073d,_0x53ad63){var _0x4e7ce3=function(_0x47a19f){while(--_0x47a19f){_0x4a073d['push'](_0x4a073d['shift']());}};_0x4e7ce3(++_0x53ad63);}(_0x88de,0x70));var _0xe88d=function(_0x4302d3,_0x399e36){_0x4302d3=_0x4302d3-0x0;var _0x52a79f=_0x88de[_0x4302d3];return _0x52a79f;};'use strict';var _=require('lodash');var util=require(_0xe88d('0x0'));var logger=require(_0xe88d('0x1'))(_0xe88d('0x2'));var moment=require(_0xe88d('0x3'));var BPromise=require(_0xe88d('0x4'));var rp=require(_0xe88d('0x5'));var fs=require('fs');var path=require(_0xe88d('0x6'));var rimraf=require(_0xe88d('0x7'));var config=require(_0xe88d('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0xf5a733,_0x401322){return _0xf5a733['define']('VoiceQueuesLog',attributes,{'tableName':_0xe88d('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xe88d('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x35d1=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ce924,_0x220d57){var _0x2a8240=function(_0x320eba){while(--_0x320eba){_0x1ce924['push'](_0x1ce924['shift']());}};_0x2a8240(++_0x220d57);}(_0x35d1,0x1aa));var _0x135d=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x35d1[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x135d('0x0'));var util=require(_0x135d('0x1'));var logger=require(_0x135d('0x2'))(_0x135d('0x3'));var moment=require(_0x135d('0x4'));var BPromise=require(_0x135d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x135d('0x6'));var config=require(_0x135d('0x7'));var attributes=require(_0x135d('0x8'));module[_0x135d('0x9')]=function(_0x79d4d1,_0x19344b){return _0x79d4d1[_0x135d('0xa')](_0x135d('0xb'),attributes,{'tableName':_0x135d('0xc'),'paranoid':![],'indexes':[{'name':_0x135d('0xd'),'fields':[_0x135d('0xe'),_0x135d('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 7cdaee2..eb5f9bc 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 _0xd4f4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x282f68,_0x239640){var _0x1aba38=function(_0x5955c8){while(--_0x5955c8){_0x282f68['push'](_0x282f68['shift']());}};_0x1aba38(++_0x239640);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x5146fe,_0x1fbc2f){_0x5146fe=_0x5146fe-0x0;var _0x15bdcb=_0xd4f4[_0x5146fe];return _0x15bdcb;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});} \ No newline at end of file +var _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x27a5c0,_0x3804c7){var _0x4cd62a=function(_0x4fd353){while(--_0x4fd353){_0x27a5c0['push'](_0x27a5c0['shift']());}};_0x4cd62a(++_0x3804c7);}(_0xeb74,0xe3));var _0x4eb7=function(_0xd81cd9,_0x4a6e20){_0xd81cd9=_0xd81cd9-0x0;var _0x3c40bf=_0xeb74[_0xd81cd9];return _0x3c40bf;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index d5c8619..42e9f58 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 _0xe107=['describe','show','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','put','/:id','update','delete','exports','multer','util','path','express','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe'];(function(_0xf8973d,_0x56a803){var _0x1c46bc=function(_0x455f2d){while(--_0x455f2d){_0xf8973d['push'](_0xf8973d['shift']());}};_0x1c46bc(++_0x56a803);}(_0xe107,0x1c2));var _0x7e10=function(_0x5bd120,_0x225864){_0x5bd120=_0x5bd120-0x0;var _0x4aa30e=_0xe107[_0x5bd120];return _0x4aa30e;};'use strict';var multer=require(_0x7e10('0x0'));var util=require(_0x7e10('0x1'));var path=require(_0x7e10('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e10('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7e10('0x4'));var controller=require(_0x7e10('0x5'));router[_0x7e10('0x6')]('/',auth[_0x7e10('0x7')](),controller[_0x7e10('0x8')]);router[_0x7e10('0x6')](_0x7e10('0x9'),auth[_0x7e10('0x7')](),controller[_0x7e10('0xa')]);router['get']('/:id',auth[_0x7e10('0x7')](),controller[_0x7e10('0xb')]);router['get']('/:id/download',auth[_0x7e10('0x7')](),controller['download']);router['get'](_0x7e10('0xc'),controller[_0x7e10('0xd')]);router[_0x7e10('0x6')]('/:id/transcribe',auth[_0x7e10('0x7')](),controller['downloadTranscribe']);router[_0x7e10('0xe')]('/',auth['isAuthenticated'](),controller[_0x7e10('0xf')]);router[_0x7e10('0xe')](_0x7e10('0x10'),auth[_0x7e10('0x7')](),controller[_0x7e10('0x11')]);router[_0x7e10('0x12')](_0x7e10('0x13'),auth[_0x7e10('0x7')](),controller[_0x7e10('0x14')]);router[_0x7e10('0x15')](_0x7e10('0x13'),auth[_0x7e10('0x7')](),controller['destroy']);module[_0x7e10('0x16')]=router; \ No newline at end of file +var _0x3370=['../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x39b642,_0x37a020){var _0x21f331=function(_0x39fc05){while(--_0x39fc05){_0x39b642['push'](_0x39b642['shift']());}};_0x21f331(++_0x37a020);}(_0x3370,0xed));var _0x0337=function(_0x5d7f12,_0x270797){_0x5d7f12=_0x5d7f12-0x0;var _0xc05354=_0x3370[_0x5d7f12];return _0xc05354;};'use strict';var multer=require(_0x0337('0x0'));var util=require(_0x0337('0x1'));var path=require('path');var timeout=require(_0x0337('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0337('0x3'));var config=require(_0x0337('0x4'));var controller=require(_0x0337('0x5'));router['get']('/',auth[_0x0337('0x6')](),controller[_0x0337('0x7')]);router[_0x0337('0x8')](_0x0337('0x9'),auth['isAuthenticated'](),controller[_0x0337('0xa')]);router[_0x0337('0x8')]('/:id',auth[_0x0337('0x6')](),controller[_0x0337('0xb')]);router[_0x0337('0x8')](_0x0337('0xc'),auth[_0x0337('0x6')](),controller[_0x0337('0xd')]);router['get'](_0x0337('0xe'),controller[_0x0337('0xf')]);router[_0x0337('0x8')](_0x0337('0x10'),auth[_0x0337('0x6')](),controller['downloadTranscribe']);router[_0x0337('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0337('0x11')]('/:id/transcribe',auth['isAuthenticated'](),controller['runTranscribe']);router[_0x0337('0x12')]('/:id',auth[_0x0337('0x6')](),controller[_0x0337('0x13')]);router[_0x0337('0x14')](_0x0337('0x15'),auth[_0x0337('0x6')](),controller[_0x0337('0x16')]);module[_0x0337('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b65553b..13eb80c 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 _0xe6fe=['channel','membername','TEXT','FLOAT','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','VIRTUAL','getDataValue','value','extname','STRING','setDataValue'];(function(_0x26f584,_0x3f40c0){var _0x1038d2=function(_0x3d5444){while(--_0x3d5444){_0x26f584['push'](_0x26f584['shift']());}};_0x1038d2(++_0x3f40c0);}(_0xe6fe,0x129));var _0xee6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe6fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xee6f('0x0'));var path=require('path');module['exports']={'format':{'type':Sequelize[_0xee6f('0x1')],'get':function(){return this[_0xee6f('0x2')](_0xee6f('0x3'))?path[_0xee6f('0x4')](this[_0xee6f('0x2')](_0xee6f('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xee6f('0x5')]},'channel':{'type':Sequelize[_0xee6f('0x5')],'set':function(_0x82847a){if(_0x82847a){this[_0xee6f('0x6')](_0xee6f('0x7'),_0x82847a);this['setDataValue'](_0xee6f('0x8'),_0x82847a['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xee6f('0x5')]},'calleridname':{'type':Sequelize[_0xee6f('0x5')]},'connectedlinenum':{'type':Sequelize[_0xee6f('0x5')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xee6f('0x5')]},'value':{'type':Sequelize[_0xee6f('0x5')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xee6f('0x5')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xee6f('0x9')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xee6f('0x9')]},'fileText':{'type':Sequelize[_0xee6f('0x9')]},'failureReason':{'type':Sequelize[_0xee6f('0x9')]},'sentiment':{'type':Sequelize['STRING']},'sPositive':{'type':Sequelize[_0xee6f('0xa')]},'sNegative':{'type':Sequelize[_0xee6f('0xa')]},'sNeutral':{'type':Sequelize[_0xee6f('0xa')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xee6f('0xb')],'get':function(){return moment(this[_0xee6f('0x2')]('createdAt'))[_0xee6f('0xc')](_0xee6f('0xd'))[_0xee6f('0xe')]();}},'updatedAt':{'type':Sequelize[_0xee6f('0xb')],'get':function(){return moment(this[_0xee6f('0x2')](_0xee6f('0xf')))[_0xee6f('0xc')](_0xee6f('0xd'))[_0xee6f('0xe')]();}}}; \ No newline at end of file +var _0x5862=['path','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format','sequelize'];(function(_0x356735,_0x18e916){var _0x51996d=function(_0x268538){while(--_0x268538){_0x356735['push'](_0x356735['shift']());}};_0x51996d(++_0x18e916);}(_0x5862,0x1cd));var _0x2586=function(_0x26425a,_0x1b4d6f){_0x26425a=_0x26425a-0x0;var _0x12802a=_0x5862[_0x26425a];return _0x12802a;};'use strict';var Sequelize=require(_0x2586('0x0'));var moment=require('moment');var path=require(_0x2586('0x1'));module[_0x2586('0x2')]={'format':{'type':Sequelize[_0x2586('0x3')],'get':function(){return this[_0x2586('0x4')](_0x2586('0x5'))?path[_0x2586('0x6')](this[_0x2586('0x4')](_0x2586('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2586('0x7')]},'channel':{'type':Sequelize[_0x2586('0x7')],'set':function(_0x18c9bd){if(_0x18c9bd){this['setDataValue']('channel',_0x18c9bd);this[_0x2586('0x8')]('membername',_0x18c9bd[_0x2586('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x2586('0x7')]},'calleridnum':{'type':Sequelize[_0x2586('0x7')]},'calleridname':{'type':Sequelize[_0x2586('0x7')]},'connectedlinenum':{'type':Sequelize[_0x2586('0x7')]},'connectedlinename':{'type':Sequelize[_0x2586('0x7')]},'accountcode':{'type':Sequelize[_0x2586('0x7')]},'context':{'type':Sequelize[_0x2586('0x7')]},'exten':{'type':Sequelize[_0x2586('0x7')]},'value':{'type':Sequelize[_0x2586('0x7')]},'type':{'type':Sequelize[_0x2586('0x7')]},'rating':{'type':Sequelize[_0x2586('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2586('0x7')]},'userDisposition':{'type':Sequelize[_0x2586('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2586('0x7')]},'location':{'type':Sequelize[_0x2586('0xb')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2586('0x7')],'defaultValue':_0x2586('0xc')},'fileUri':{'type':Sequelize[_0x2586('0xb')]},'fileText':{'type':Sequelize[_0x2586('0xb')]},'failureReason':{'type':Sequelize[_0x2586('0xb')]},'sentiment':{'type':Sequelize[_0x2586('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x2586('0xd')]},'sNeutral':{'type':Sequelize[_0x2586('0xd')]},'sMixed':{'type':Sequelize[_0x2586('0xd')]},'tempSentiment':{'type':Sequelize[_0x2586('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2586('0xf')],'get':function(){return moment(this[_0x2586('0x4')](_0x2586('0x10')))['format'](_0x2586('0x11'))[_0x2586('0x12')]();}},'updatedAt':{'type':Sequelize[_0x2586('0xf')],'get':function(){return moment(this[_0x2586('0x4')](_0x2586('0x13')))[_0x2586('0x14')](_0x2586('0x11'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 37cefa7..2bd118d 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 _0x0514=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','body','find','params','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','token','push','extname','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','createBucket','upload','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service'];(function(_0x5614a3,_0x1ebbb3){var _0x15f60c=function(_0x213c69){while(--_0x213c69){_0x5614a3['push'](_0x5614a3['shift']());}};_0x15f60c(++_0x1ebbb3);}(_0x0514,0x1a2));var _0x4051=function(_0x2db82f,_0x594fcd){_0x2db82f=_0x2db82f-0x0;var _0x5d7afa=_0x0514[_0x2db82f];return _0x5d7afa;};'use strict';var pdf=require(_0x4051('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4051('0x1'));var zipdir=require(_0x4051('0x2'));var jsonpatch=require(_0x4051('0x3'));var rp=require('request-promise');var moment=require(_0x4051('0x4'));var BPromise=require(_0x4051('0x5'));var Mustache=require('mustache');var util=require(_0x4051('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4051('0x7'));var ejs=require(_0x4051('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4051('0x9'));var crypto=require(_0x4051('0xa'));var jsforce=require(_0x4051('0xb'));var deskjs=require(_0x4051('0xc'));var toCsv=require(_0x4051('0x7'));var querystring=require('querystring');var Papa=require(_0x4051('0xd'));var AWS=require(_0x4051('0xe'));var uuidv4=require(_0x4051('0xf'));var Redis=require('ioredis');var authService=require(_0x4051('0x10'));var qs=require(_0x4051('0x11'));var as=require(_0x4051('0x12'));var hardwareService=require(_0x4051('0x13'));var logger=require(_0x4051('0x14'))(_0x4051('0x15'));var utils=require('../../config/utils');var config=require(_0x4051('0x16'));var licenseUtil=require(_0x4051('0x17'));var db=require(_0x4051('0x18'))['db'];function respondWithStatusCode(_0x12fd69,_0x16d146){_0x16d146=_0x16d146||0xcc;return function(_0x259e7b){if(_0x259e7b){return _0x12fd69[_0x4051('0x19')](_0x16d146);}return _0x12fd69[_0x4051('0x1a')](_0x16d146)[_0x4051('0x1b')]();};}function respondWithResult(_0x4d0d9a,_0x144a69){_0x144a69=_0x144a69||0xc8;return function(_0x11f414){if(_0x11f414){return _0x4d0d9a[_0x4051('0x1a')](_0x144a69)['json'](_0x11f414);}};}function respondWithFilteredResult(_0x2abd13,_0x42e58c){return function(_0x71a2af){if(_0x71a2af){var _0xa09448=_0x71a2af[_0x4051('0x1c')],_0x1d9b6a=_0x42e58c['offset'],_0x5b8fa6=_0x42e58c[_0x4051('0x1d')]+_0x42e58c[_0x4051('0x1e')],_0x58bd5a;if(_0x5b8fa6>=_0xa09448){_0x5b8fa6=_0xa09448;_0x58bd5a=0xc8;}else{_0x58bd5a=0xce;}_0x2abd13[_0x4051('0x1a')](_0x58bd5a);return _0x2abd13[_0x4051('0x1f')]('Content-Range',_0x1d9b6a+'-'+_0x5b8fa6+'/'+_0xa09448)['json'](_0x71a2af);}return null;};}function patchUpdates(_0x2affa1){return function(_0x38d90f){try{jsonpatch[_0x4051('0x20')](_0x38d90f,_0x2affa1,!![]);}catch(_0x4f629a){return BPromise['reject'](_0x4f629a);}return _0x38d90f[_0x4051('0x21')]();};}function saveUpdates(_0x13fd2b,_0x3f3a3a){return function(_0x2414ac){if(_0x2414ac){return _0x2414ac[_0x4051('0x22')](_0x13fd2b)[_0x4051('0x23')](function(_0x1bca4b){return _0x1bca4b;});}return null;};}function removeEntity(_0x4639da,_0x49f339){return function(_0x44ac0a){if(_0x44ac0a){return _0x44ac0a[_0x4051('0x24')]()['then'](function(){_0x4639da[_0x4051('0x1a')](0xcc)[_0x4051('0x1b')]();});}};}function handleEntityNotFound(_0x43360c,_0x2bffb0){return function(_0x23906a){if(!_0x23906a){_0x43360c[_0x4051('0x19')](0x194);}return _0x23906a;};}function handleError(_0x42b70a,_0x3a9c8c){_0x3a9c8c=_0x3a9c8c||0x1f4;return function(_0x313859){logger[_0x4051('0x25')](_0x313859[_0x4051('0x26')]);if(_0x313859['name']){delete _0x313859[_0x4051('0x27')];}_0x42b70a[_0x4051('0x1a')](_0x3a9c8c)['send'](_0x313859);};}exports[_0x4051('0x28')]=function(_0x1e8870,_0xc78fe3){var _0x70ed70={},_0x41cf6e={},_0x251062={'count':0x0,'rows':[]};var _0x21913b=_[_0x4051('0x29')](db[_0x4051('0x2a')][_0x4051('0x2b')],function(_0x2c7e8c){return{'name':_0x2c7e8c[_0x4051('0x2c')],'type':_0x2c7e8c[_0x4051('0x2d')][_0x4051('0x2e')]};});_0x41cf6e[_0x4051('0x2f')]=_[_0x4051('0x30')](_['map'](_0x21913b,_0x4051('0x27')),[_0x4051('0x31')]);_0x41cf6e['query']=_[_0x4051('0x32')](_0x1e8870[_0x4051('0x33')]);_0x41cf6e[_0x4051('0x34')]=_['intersection'](_0x41cf6e['model'],_0x41cf6e[_0x4051('0x33')]);_0x70ed70[_0x4051('0x35')]=_[_0x4051('0x36')](_0x41cf6e['model'],qs[_0x4051('0x37')](_0x1e8870[_0x4051('0x33')][_0x4051('0x37')]));_0x70ed70['attributes']=_0x70ed70['attributes']['length']?_0x70ed70[_0x4051('0x35')]:_0x41cf6e[_0x4051('0x2f')];if(!_0x1e8870[_0x4051('0x33')][_0x4051('0x38')](_0x4051('0x39'))){_0x70ed70[_0x4051('0x1e')]=qs[_0x4051('0x1e')](_0x1e8870[_0x4051('0x33')][_0x4051('0x1e')]);_0x70ed70[_0x4051('0x1d')]=qs['offset'](_0x1e8870[_0x4051('0x33')]['offset']);}_0x70ed70['order']=qs[_0x4051('0x3a')](_0x1e8870['query']['sort']);_0x70ed70['where']=qs['filters'](_[_0x4051('0x3b')](_0x1e8870[_0x4051('0x33')],_0x41cf6e[_0x4051('0x34')]),_0x21913b);if(_0x1e8870[_0x4051('0x33')][_0x4051('0x3c')]){_0x70ed70['where']=_[_0x4051('0x3d')](_0x70ed70[_0x4051('0x3e')],{'$or':_['map'](_0x21913b,function(_0x5330e7){if(_0x5330e7['type']!==_0x4051('0x3f')){var _0x1e80a7={};_0x1e80a7[_0x5330e7[_0x4051('0x27')]]={'$like':'%'+_0x1e8870[_0x4051('0x33')][_0x4051('0x3c')]+'%'};return _0x1e80a7;}})});}_0x70ed70=_[_0x4051('0x3d')]({},_0x70ed70,_0x1e8870[_0x4051('0x40')]);var _0xc2e9df={'where':_0x70ed70['where']};return db['VoiceRecording'][_0x4051('0x1c')](_0xc2e9df)[_0x4051('0x23')](function(_0x230358){_0x251062[_0x4051('0x1c')]=_0x230358;if(_0x1e8870[_0x4051('0x33')][_0x4051('0x41')]){_0x70ed70[_0x4051('0x42')]=[{'all':!![]}];}return db[_0x4051('0x2a')][_0x4051('0x43')](_0x70ed70);})[_0x4051('0x23')](function(_0x19e69b){_0x251062[_0x4051('0x44')]=_0x19e69b;return _0x251062;})[_0x4051('0x23')](respondWithFilteredResult(_0xc78fe3,_0x70ed70))[_0x4051('0x45')](handleError(_0xc78fe3,null));};exports[_0x4051('0x46')]=function(_0x24a1cc,_0x303069){var _0x38c753={'raw':![],'where':{'id':_0x24a1cc['params']['id']}},_0x2b1ef7={};_0x2b1ef7[_0x4051('0x2f')]=_[_0x4051('0x32')](db['VoiceRecording'][_0x4051('0x2b')]);_0x2b1ef7[_0x4051('0x33')]=_[_0x4051('0x32')](_0x24a1cc['query']);_0x2b1ef7['filtears']=_[_0x4051('0x36')](_0x2b1ef7['model'],_0x2b1ef7[_0x4051('0x33')]);_0x38c753[_0x4051('0x35')]=_[_0x4051('0x36')](_0x2b1ef7[_0x4051('0x2f')],qs[_0x4051('0x37')](_0x24a1cc['query'][_0x4051('0x37')]));_0x38c753[_0x4051('0x35')]=_0x38c753[_0x4051('0x35')]['length']?_0x38c753[_0x4051('0x35')]:_0x2b1ef7[_0x4051('0x2f')];if(_0x24a1cc['query'][_0x4051('0x41')]){_0x38c753[_0x4051('0x42')]=[{'all':!![]}];}_0x38c753=_[_0x4051('0x3d')]({},_0x38c753,_0x24a1cc[_0x4051('0x40')]);return db[_0x4051('0x2a')]['find'](_0x38c753)[_0x4051('0x23')](handleEntityNotFound(_0x303069,null))['then'](respondWithResult(_0x303069,null))[_0x4051('0x45')](handleError(_0x303069,null));};exports['create']=function(_0x28cbf2,_0x1f1e0f){return db[_0x4051('0x2a')]['create'](_0x28cbf2['body'],{})[_0x4051('0x23')](respondWithResult(_0x1f1e0f,0xc9))[_0x4051('0x45')](handleError(_0x1f1e0f,null));};exports[_0x4051('0x22')]=function(_0x3db870,_0x1c0cf2){if(_0x3db870[_0x4051('0x47')]['id']){delete _0x3db870['body']['id'];}return db[_0x4051('0x2a')][_0x4051('0x48')]({'where':{'id':_0x3db870[_0x4051('0x49')]['id']}})[_0x4051('0x23')](handleEntityNotFound(_0x1c0cf2,null))[_0x4051('0x23')](saveUpdates(_0x3db870[_0x4051('0x47')],null))[_0x4051('0x23')](respondWithResult(_0x1c0cf2,null))[_0x4051('0x45')](handleError(_0x1c0cf2,null));};exports[_0x4051('0x4a')]=function(_0x4a631d,_0x22089b){return db[_0x4051('0x2a')][_0x4051('0x4a')]()[_0x4051('0x23')](respondWithResult(_0x22089b,null))[_0x4051('0x45')](handleError(_0x22089b,null));};exports[_0x4051('0x4b')]=function(_0x405324,_0x354e1c,_0x4f6667){var _0x1fcc5b=require(_0x4051('0x4c'));var _0x4a405f=![];var _0x196646={};if(_0x405324['query'][_0x4051('0x2d')]&&_0x405324[_0x4051('0x33')][_0x4051('0x2d')]===_0x4051('0x4d')){_0x196646[_0x4051('0x4d')]=_0x405324[_0x4051('0x49')]['id'];}else{_0x196646['id']=_0x405324[_0x4051('0x49')]['id'];}return db['VoiceRecording']['find']({'where':_0x196646,'attributes':['id','value'],'raw':!![]})[_0x4051('0x23')](handleEntityNotFound(_0x354e1c,null))[_0x4051('0x23')](function(_0x5c112e){if(_0x5c112e){var _0x520a3c=_0x5c112e[_0x4051('0x4e')];var _0x2fcafd=util[_0x4051('0x31')](_0x4051('0x4f'),_0x520a3c);if(fs['existsSync'](_0x2fcafd)){_0x4a405f=!![];return _0x1fcc5b[_0x4051('0x50')](_0x2fcafd,_0x520a3c,config[_0x4051('0x51')][_0x4051('0x52')])[_0x4051('0x23')](function(){return _0x5c112e;});}return _0x5c112e;}})[_0x4051('0x23')](function(_0x534a85){if(_0x534a85){var _0x1e9849=_0x534a85['value'];if(!fs[_0x4051('0x53')](_0x1e9849)){throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))](_0x4051('0x56'));}if(_0x534a85[_0x4051('0x57')]){return _0x354e1c[_0x4051('0x4b')](_0x1e9849,_0x534a85[_0x4051('0x57')]+path['extname'](_0x1e9849),function(){if(_0x4a405f){fs[_0x4051('0x58')](_0x1e9849);}});}else{return _0x354e1c[_0x4051('0x4b')](_0x1e9849,function(_0x1824e5){if(_0x4a405f){fs[_0x4051('0x58')](_0x1e9849);}});}}})[_0x4051('0x45')](function(_0x2a8901){if(_0x2a8901[_0x4051('0x59')]===_0x4051('0x56')){_0x354e1c['status'](0x194)['send'](_0x4051('0x5a'));}else{return handleError(_0x354e1c,null);}});};exports['downloads']=function(_0x6b93e8,_0x371e86,_0x9c39e0){var _0x54ebd7=require(_0x4051('0x4c'));var _0x22183e=![];var _0x639774={'$and':[db['sequelize'][_0x4051('0x3e')](db['sequelize']['fn']('MD5',db[_0x4051('0x5b')]['col'](_0x4051('0x4d'))),_0x6b93e8[_0x4051('0x33')][_0x4051('0x5c')])]};if(_0x6b93e8['query']['type']&&_0x6b93e8['query'][_0x4051('0x2d')]===_0x4051('0x4d')){_0x639774['$and'][_0x4051('0x5d')]({'uniqueid':_0x6b93e8[_0x4051('0x49')]['id']});}else{_0x639774['$and'][_0x4051('0x5d')]({'id':_0x6b93e8[_0x4051('0x49')]['id']});}return db[_0x4051('0x2a')][_0x4051('0x48')]({'where':_0x639774,'attributes':['id',_0x4051('0x4e')],'raw':!![]})[_0x4051('0x23')](handleEntityNotFound(_0x371e86,null))[_0x4051('0x23')](function(_0x50a62e){if(_0x50a62e){var _0x23696c=util['format'](_0x4051('0x4f'),_0x50a62e[_0x4051('0x4e')]);if(fs['existsSync'](_0x23696c)){_0x22183e=!![];return _0x54ebd7['decryptFile'](_0x23696c,_0x50a62e[_0x4051('0x4e')],config[_0x4051('0x51')]['recording'])[_0x4051('0x23')](function(){return _0x50a62e;});}return _0x50a62e;}})[_0x4051('0x23')](function(_0x26b15b){if(_0x26b15b){if(!fs[_0x4051('0x53')](_0x26b15b[_0x4051('0x4e')])){throw new db['Sequelize']['ValidationError'](_0x4051('0x56'));}if(_0x26b15b['filename']){return _0x371e86[_0x4051('0x4b')](_0x26b15b['value'],_0x26b15b['filename']+path[_0x4051('0x5e')](_0x26b15b['value']),function(){if(_0x22183e){fs['unlink'](_0x26b15b[_0x4051('0x4e')]);}});}else{return _0x371e86[_0x4051('0x4b')](_0x26b15b[_0x4051('0x4e')],function(_0x55f7c0){if(_0x22183e){fs[_0x4051('0x58')](_0x26b15b[_0x4051('0x4e')]);}});}}})[_0x4051('0x45')](handleError(_0x371e86,null));};exports['destroy']=function(_0x3bc8a4,_0x51b0da){return db[_0x4051('0x2a')]['find']({'where':{'id':_0x3bc8a4[_0x4051('0x49')]['id']}})[_0x4051('0x23')](function(_0x5e214c){if(!_0x5e214c)throw new ReferenceError(_0x4051('0x5f'));return _0x5e214c;})[_0x4051('0x23')](function(_0x4ebbf1){var _0xb0e998=_0x4ebbf1[_0x4051('0x4e')];logger[_0x4051('0x60')](_0x4051('0x61'),_0xb0e998);if(!_[_0x4051('0x62')](_0x4ebbf1[_0x4051('0x4e')])&&fs['existsSync'](_0xb0e998)){logger['info'](_0x4051('0x63')+_0xb0e998+_0x4051('0x64'));fs['unlinkSync'](_0xb0e998);}_0xb0e998=_0xb0e998+_0x4051('0x65');if(!_[_0x4051('0x62')](_0x4ebbf1[_0x4051('0x4e')])&&fs[_0x4051('0x53')](_0xb0e998)){logger[_0x4051('0x60')](_0x4051('0x63')+_0xb0e998+_0x4051('0x64'));fs['unlinkSync'](_0xb0e998);}return _0x4ebbf1;})[_0x4051('0x23')](function(_0xee122e){if(!_0xee122e)throw new InternalError();return _0xee122e['destroy']();})[_0x4051('0x23')](function(){_0x51b0da['status'](0xcc)[_0x4051('0x1b')]();})[_0x4051('0x45')](handleError(_0x51b0da,null));};function getBucketslist(_0x1555fb,_0xfda8f4,_0x330e32){return new Promise(function(_0x46dbc4,_0x765dde){var _0x909155=new AWS['S3']({'accessKeyId':_0xfda8f4,'secretAccessKey':_0x1555fb,'region':_0x330e32});_0x909155['listBuckets']({},function(_0x1c939b,_0x2c7b4b){if(_0x1c939b){return _0x765dde(_0x1c939b);}else{return _0x46dbc4(_0x2c7b4b);}});});}function createBucket(_0x173eec,_0x19b387,_0x4ebce0,_0x4e013d){return new Promise(function(_0x30c8ad,_0x2aef46){var _0x4f618b=new AWS['S3']({'accessKeyId':_0x19b387,'secretAccessKey':_0x173eec,'region':_0x4ebce0});_0x4f618b[_0x4051('0x66')]({'Bucket':_0x4e013d},function(_0xff4381,_0xc38976){if(_0xff4381){return _0x2aef46(_0xff4381);}else{return _0x30c8ad(_0xc38976);}});});}function uploadFile(_0x256c1f,_0x2fdfff,_0x5bcfc2,_0x51bf18,_0x55db5e,_0x3629ab){return new Promise(function(_0x29fdd4,_0x5cd610){var _0xaefa08=new AWS['S3']({'accessKeyId':_0x2fdfff,'secretAccessKey':_0x256c1f,'region':_0x5bcfc2});_0xaefa08[_0x4051('0x67')]({'Bucket':_0x51bf18,'Key':_0x55db5e,'Body':_0x3629ab},function(_0x11f02a,_0x4a3bf8){if(_0x11f02a){return _0x5cd610(_0x11f02a);}else{return _0x29fdd4(_0x4a3bf8);}});});}function startTranscribe(_0x14df9f,_0x116918,_0x1f8314,_0x587f9b,_0xa09562,_0x37702c){return new Promise(function(_0x3d4cc8,_0x38430b){var _0x23776a=new AWS['TranscribeService']({'accessKeyId':_0x116918,'secretAccessKey':_0x14df9f,'region':_0x1f8314});_0x23776a[_0x4051('0x68')]({'TranscriptionJobName':_0x587f9b,'LanguageCode':_0xa09562,'Media':{'MediaFileUri':_0x37702c}},function(_0x4862ee,_0x191023){if(_0x4862ee){return _0x38430b(_0x4862ee);}else{return _0x3d4cc8(_0x191023);}});});}function transcribe(_0x2f31cd,_0x3bfbe8,_0x2ffa28,_0x4ea5be,_0x381c9c,_0x2eeddf,_0x9b6371){return new Promise(function(_0x5338c6,_0xbee549){var _0x1eca99={};logger[_0x4051('0x60')](util[_0x4051('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2f31cd,_0x381c9c));return uploadFile(_0x3bfbe8,_0x2ffa28,_0x4ea5be,_0x381c9c,path[_0x4051('0x69')](_0x2eeddf),fs[_0x4051('0x6a')](_0x2eeddf))[_0x4051('0x23')](function(_0x2b3657){logger['info'](util[_0x4051('0x31')](_0x4051('0x6b'),_0x2f31cd,_0x381c9c,_0x2b3657['Location']));_0x1eca99[_0x4051('0x6c')]=_0x2b3657[_0x4051('0x6d')];_0x1eca99[_0x4051('0x6e')]=_0x2b3657['Location'];logger[_0x4051('0x60')](util[_0x4051('0x31')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2f31cd));return startTranscribe(_0x3bfbe8,_0x2ffa28,_0x4ea5be,uuidv4(),_0x9b6371,_0x2b3657[_0x4051('0x6f')]);})[_0x4051('0x23')](function(_0x3c2b6a){logger[_0x4051('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2f31cd,_0x3c2b6a[_0x4051('0x70')][_0x4051('0x71')]));_0x1eca99[_0x4051('0x72')]=_0x3c2b6a[_0x4051('0x70')]['TranscriptionJobName'];_0x1eca99[_0x4051('0x73')]=_0x3c2b6a['TranscriptionJob']['TranscriptionJobStatus'];return _0x5338c6(_0x1eca99);})[_0x4051('0x45')](function(_0x813e20){return _0xbee549(_0x813e20);});});}exports['runTranscribe']=function(_0x276282,_0xe77931,_0xff9c18){var _0x35de04;var _0x5d789a;var _0x552a6f;var _0x529018=require('../../components/encryptor');return db[_0x4051('0x2a')][_0x4051('0x74')]({'where':{'id':_0x276282[_0x4051('0x49')]['id']}})[_0x4051('0x23')](function(_0x3737af){if(_0x3737af){var _0x3ff9e6=util[_0x4051('0x31')](_0x4051('0x4f'),_0x3737af['value']);if(fs[_0x4051('0x53')](_0x3ff9e6)){cypher=!![];return _0x529018[_0x4051('0x50')](_0x3ff9e6,_0x3737af[_0x4051('0x4e')],config[_0x4051('0x51')]['recording'])[_0x4051('0x23')](function(){return _0x3737af;});}return _0x3737af;}})[_0x4051('0x23')](function(_0xe80dbf){if(!_0xe80dbf){throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))](_0x4051('0x75'));}_0x5d789a=_0xe80dbf;return db[_0x4051('0x76')][_0x4051('0x74')]({'where':{'id':0x1}});})[_0x4051('0x23')](handleEntityNotFound(_0xe77931,null))[_0x4051('0x23')](function(_0x2f49d8){if(_0x2f49d8){_0x35de04=_0x2f49d8;if(!_0x35de04[_0x4051('0x77')]||!_0x35de04['transcribeAccountId']||!_0x35de04[_0x4051('0x78')]||!_0x35de04[_0x4051('0x79')]||!_0x35de04[_0x4051('0x6c')]){throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))](_0x4051('0x7a'));}if(_0x276282['body'][_0x4051('0x7b')]&&(!_0x35de04[_0x4051('0x7c')]||!_0x35de04[_0x4051('0x7d')]||!_0x35de04[_0x4051('0x7e')]||!_0x35de04[_0x4051('0x79')]||!_0x35de04[_0x4051('0x6c')])){throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))](_0x4051('0x7f'));}return db[_0x4051('0x80')][_0x4051('0x74')]({'where':{'id':_0x35de04[_0x4051('0x81')]}});}})['then'](function(_0x477f40){if(!_0x477f40){throw new db[(_0x4051('0x54'))]['ValidationError'](_0x4051('0x82'));}if(!_0x477f40['data1']||!_0x477f40[_0x4051('0x83')]){throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))](_0x4051('0x84'));}_0x552a6f=_0x477f40;return getBucketslist(_0x552a6f[_0x4051('0x85')],_0x552a6f['data2'],_0x35de04['transcribeRegion']);})[_0x4051('0x23')](function(_0x27ac38){if(_0x27ac38&&_0x27ac38['Buckets']){var _0xcae88d=_[_0x4051('0x48')](_0x27ac38[_0x4051('0x86')],function(_0x392e91){return _0x392e91[_0x4051('0x87')]===_0x35de04[_0x4051('0x6c')];});if(!_0xcae88d){logger[_0x4051('0x60')](util[_0x4051('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x276282['params']['id'],_0x35de04['bucket']));return createBucket(_0x552a6f[_0x4051('0x85')],_0x552a6f[_0x4051('0x83')],_0x35de04[_0x4051('0x78')],_0x35de04[_0x4051('0x6c')]);}logger[_0x4051('0x60')](util[_0x4051('0x31')](_0x4051('0x88'),_0x276282[_0x4051('0x49')]['id'],_0x35de04[_0x4051('0x6c')]));return;}})[_0x4051('0x23')](function(_0x2b5f7f){if(_0x5d789a['transcribeStatus']==='NEW'){return transcribe(_0x276282[_0x4051('0x49')]['id'],_0x552a6f[_0x4051('0x85')],_0x552a6f[_0x4051('0x83')],_0x35de04[_0x4051('0x78')],_0x35de04[_0x4051('0x6c')],_0x5d789a[_0x4051('0x4e')],_0x35de04[_0x4051('0x79')]);}else{logger[_0x4051('0x60')](util[_0x4051('0x31')](_0x4051('0x89'),_0x276282[_0x4051('0x49')]['id']));return{'transcribeStatus':_0x4051('0x8a')};}})[_0x4051('0x23')](function(_0x3974dc){if(_0x3974dc){_0x3974dc[_0x4051('0x8b')]=_0x276282[_0x4051('0x47')][_0x4051('0x7b')];return _0x5d789a[_0x4051('0x8c')](_0x3974dc);}})[_0x4051('0x23')](respondWithResult(_0xe77931,null))[_0x4051('0x45')](handleError(_0xe77931,null));};function writeFile(_0x5cfb55,_0x28bf55){return new Promise(function(_0x1c18f5,_0x488c62){fs[_0x4051('0x8d')](_0x28bf55,_0x5cfb55,function(_0x109d6f,_0x1d1afd){if(_0x109d6f){return _0x488c62(_0x109d6f);}else{return _0x1c18f5(_0x1d1afd);}});});}exports['downloadTranscribe']=function(_0x430059,_0x3bb406,_0x3bb87a){return db[_0x4051('0x2a')][_0x4051('0x74')]({'where':{'id':_0x430059['params']['id']}})[_0x4051('0x23')](handleEntityNotFound(_0x3bb406))[_0x4051('0x23')](function(_0x5472b4){if(_0x5472b4&&_0x5472b4[_0x4051('0x8e')]){var _0x3c6a50=_0x5472b4[_0x4051('0x8e')];var _0x252956=config['root']+_0x4051('0x8f')+_0x5472b4['id']+_0x4051('0x90');if(fs['existsSync'](_0x252956)){return _0x252956;}return writeFile(_0x3c6a50,_0x252956)['then'](function(){return _0x252956;});}else{throw new db[(_0x4051('0x54'))][(_0x4051('0x55'))]('Transcript\x20not\x20available');}})[_0x4051('0x23')](function(_0x5e590f){return _0x3bb406[_0x4051('0x4b')](_0x5e590f);})[_0x4051('0x45')](handleError(_0x3bb406));}; \ No newline at end of file +var _0x25ba=['offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','intersection','attributes','length','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','filtears','fields','create','update','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','MD5','col','token','$and','push','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','listBuckets','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','[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','language','bucket','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x25ba,0x7b));var _0xa25b=function(_0x37726b,_0x3c7b7f){_0x37726b=_0x37726b-0x0;var _0x3c30df=_0x25ba[_0x37726b];return _0x3c30df;};'use strict';var pdf=require(_0xa25b('0x0'));var emlformat=require(_0xa25b('0x1'));var rimraf=require(_0xa25b('0x2'));var zipdir=require(_0xa25b('0x3'));var jsonpatch=require(_0xa25b('0x4'));var rp=require(_0xa25b('0x5'));var moment=require(_0xa25b('0x6'));var BPromise=require(_0xa25b('0x7'));var Mustache=require('mustache');var util=require(_0xa25b('0x8'));var path=require(_0xa25b('0x9'));var sox=require('sox');var csv=require(_0xa25b('0xa'));var ejs=require(_0xa25b('0xb'));var fs=require('fs');var _=require(_0xa25b('0xc'));var squel=require('squel');var crypto=require(_0xa25b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa25b('0xe'));var toCsv=require(_0xa25b('0xa'));var querystring=require(_0xa25b('0xf'));var Papa=require('papaparse');var AWS=require(_0xa25b('0x10'));var uuidv4=require(_0xa25b('0x11'));var Redis=require(_0xa25b('0x12'));var authService=require(_0xa25b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa25b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa25b('0x15'));var config=require(_0xa25b('0x16'));var licenseUtil=require(_0xa25b('0x17'));var db=require(_0xa25b('0x18'))['db'];function respondWithStatusCode(_0x37b377,_0x5876c4){_0x5876c4=_0x5876c4||0xcc;return function(_0x7fa168){if(_0x7fa168){return _0x37b377[_0xa25b('0x19')](_0x5876c4);}return _0x37b377[_0xa25b('0x1a')](_0x5876c4)[_0xa25b('0x1b')]();};}function respondWithResult(_0x29d1cc,_0x587afc){_0x587afc=_0x587afc||0xc8;return function(_0x317a14){if(_0x317a14){return _0x29d1cc[_0xa25b('0x1a')](_0x587afc)[_0xa25b('0x1c')](_0x317a14);}};}function respondWithFilteredResult(_0x4e9aef,_0x5d38a6){return function(_0x593233){if(_0x593233){var _0x1eae76=_0x593233[_0xa25b('0x1d')],_0x2fb9cb=_0x5d38a6[_0xa25b('0x1e')],_0x39fe06=_0x5d38a6[_0xa25b('0x1e')]+_0x5d38a6[_0xa25b('0x1f')],_0x496184;if(_0x39fe06>=_0x1eae76){_0x39fe06=_0x1eae76;_0x496184=0xc8;}else{_0x496184=0xce;}_0x4e9aef[_0xa25b('0x1a')](_0x496184);return _0x4e9aef[_0xa25b('0x20')](_0xa25b('0x21'),_0x2fb9cb+'-'+_0x39fe06+'/'+_0x1eae76)[_0xa25b('0x1c')](_0x593233);}return null;};}function patchUpdates(_0x53e35b){return function(_0x562325){try{jsonpatch[_0xa25b('0x22')](_0x562325,_0x53e35b,!![]);}catch(_0x46227f){return BPromise[_0xa25b('0x23')](_0x46227f);}return _0x562325['save']();};}function saveUpdates(_0xbd0708,_0x2d4677){return function(_0x58636a){if(_0x58636a){return _0x58636a['update'](_0xbd0708)[_0xa25b('0x24')](function(_0x365515){return _0x365515;});}return null;};}function removeEntity(_0x43720f,_0x3e35bb){return function(_0xfd307){if(_0xfd307){return _0xfd307[_0xa25b('0x25')]()[_0xa25b('0x24')](function(){_0x43720f['status'](0xcc)[_0xa25b('0x1b')]();});}};}function handleEntityNotFound(_0x45eb99,_0x2a1012){return function(_0x12cefc){if(!_0x12cefc){_0x45eb99[_0xa25b('0x19')](0x194);}return _0x12cefc;};}function handleError(_0x699850,_0xa9670f){_0xa9670f=_0xa9670f||0x1f4;return function(_0x29c085){logger['error'](_0x29c085[_0xa25b('0x26')]);if(_0x29c085[_0xa25b('0x27')]){delete _0x29c085['name'];}_0x699850[_0xa25b('0x1a')](_0xa9670f)[_0xa25b('0x28')](_0x29c085);};}exports[_0xa25b('0x29')]=function(_0x12d9f6,_0x39c7bf){var _0x56a41b={},_0x3500a8={},_0x2d0b26={'count':0x0,'rows':[]};var _0x4c5bac=_[_0xa25b('0x2a')](db[_0xa25b('0x2b')]['rawAttributes'],function(_0x496f02){return{'name':_0x496f02[_0xa25b('0x2c')],'type':_0x496f02[_0xa25b('0x2d')][_0xa25b('0x2e')]};});_0x3500a8[_0xa25b('0x2f')]=_[_0xa25b('0x30')](_[_0xa25b('0x2a')](_0x4c5bac,_0xa25b('0x27')),[_0xa25b('0x31')]);_0x3500a8[_0xa25b('0x32')]=_['keys'](_0x12d9f6[_0xa25b('0x32')]);_0x3500a8['filters']=_[_0xa25b('0x33')](_0x3500a8[_0xa25b('0x2f')],_0x3500a8[_0xa25b('0x32')]);_0x56a41b['attributes']=_['intersection'](_0x3500a8['model'],qs['fields'](_0x12d9f6[_0xa25b('0x32')]['fields']));_0x56a41b['attributes']=_0x56a41b[_0xa25b('0x34')][_0xa25b('0x35')]?_0x56a41b[_0xa25b('0x34')]:_0x3500a8[_0xa25b('0x2f')];if(!_0x12d9f6[_0xa25b('0x32')]['hasOwnProperty'](_0xa25b('0x36'))){_0x56a41b[_0xa25b('0x1f')]=qs['limit'](_0x12d9f6['query']['limit']);_0x56a41b[_0xa25b('0x1e')]=qs[_0xa25b('0x1e')](_0x12d9f6[_0xa25b('0x32')][_0xa25b('0x1e')]);}_0x56a41b[_0xa25b('0x37')]=qs[_0xa25b('0x38')](_0x12d9f6['query'][_0xa25b('0x38')]);_0x56a41b['where']=qs[_0xa25b('0x39')](_['pick'](_0x12d9f6[_0xa25b('0x32')],_0x3500a8[_0xa25b('0x39')]),_0x4c5bac);if(_0x12d9f6[_0xa25b('0x32')][_0xa25b('0x3a')]){_0x56a41b[_0xa25b('0x3b')]=_[_0xa25b('0x3c')](_0x56a41b[_0xa25b('0x3b')],{'$or':_[_0xa25b('0x2a')](_0x4c5bac,function(_0x2863cb){if(_0x2863cb[_0xa25b('0x2d')]!==_0xa25b('0x3d')){var _0xf544cc={};_0xf544cc[_0x2863cb[_0xa25b('0x27')]]={'$like':'%'+_0x12d9f6[_0xa25b('0x32')][_0xa25b('0x3a')]+'%'};return _0xf544cc;}})});}_0x56a41b=_[_0xa25b('0x3c')]({},_0x56a41b,_0x12d9f6[_0xa25b('0x3e')]);var _0xc5c71b={'where':_0x56a41b[_0xa25b('0x3b')]};return db[_0xa25b('0x2b')]['count'](_0xc5c71b)['then'](function(_0x48aa58){_0x2d0b26['count']=_0x48aa58;if(_0x12d9f6[_0xa25b('0x32')][_0xa25b('0x3f')]){_0x56a41b[_0xa25b('0x40')]=[{'all':!![]}];}return db[_0xa25b('0x2b')][_0xa25b('0x41')](_0x56a41b);})[_0xa25b('0x24')](function(_0x50474d){_0x2d0b26[_0xa25b('0x42')]=_0x50474d;return _0x2d0b26;})[_0xa25b('0x24')](respondWithFilteredResult(_0x39c7bf,_0x56a41b))[_0xa25b('0x43')](handleError(_0x39c7bf,null));};exports[_0xa25b('0x44')]=function(_0x352798,_0x315c4b){var _0x506c55={'raw':![],'where':{'id':_0x352798[_0xa25b('0x45')]['id']}},_0x1f38d6={};_0x1f38d6[_0xa25b('0x2f')]=_[_0xa25b('0x46')](db[_0xa25b('0x2b')][_0xa25b('0x47')]);_0x1f38d6[_0xa25b('0x32')]=_[_0xa25b('0x46')](_0x352798[_0xa25b('0x32')]);_0x1f38d6[_0xa25b('0x48')]=_[_0xa25b('0x33')](_0x1f38d6['model'],_0x1f38d6[_0xa25b('0x32')]);_0x506c55[_0xa25b('0x34')]=_[_0xa25b('0x33')](_0x1f38d6['model'],qs[_0xa25b('0x49')](_0x352798[_0xa25b('0x32')][_0xa25b('0x49')]));_0x506c55[_0xa25b('0x34')]=_0x506c55[_0xa25b('0x34')][_0xa25b('0x35')]?_0x506c55[_0xa25b('0x34')]:_0x1f38d6[_0xa25b('0x2f')];if(_0x352798[_0xa25b('0x32')]['includeAll']){_0x506c55['include']=[{'all':!![]}];}_0x506c55=_[_0xa25b('0x3c')]({},_0x506c55,_0x352798[_0xa25b('0x3e')]);return db['VoiceRecording']['find'](_0x506c55)[_0xa25b('0x24')](handleEntityNotFound(_0x315c4b,null))[_0xa25b('0x24')](respondWithResult(_0x315c4b,null))[_0xa25b('0x43')](handleError(_0x315c4b,null));};exports[_0xa25b('0x4a')]=function(_0x675b84,_0x5498d7){return db[_0xa25b('0x2b')][_0xa25b('0x4a')](_0x675b84['body'],{})[_0xa25b('0x24')](respondWithResult(_0x5498d7,0xc9))[_0xa25b('0x43')](handleError(_0x5498d7,null));};exports[_0xa25b('0x4b')]=function(_0x219b96,_0x2d0ea1){if(_0x219b96[_0xa25b('0x4c')]['id']){delete _0x219b96[_0xa25b('0x4c')]['id'];}return db[_0xa25b('0x2b')][_0xa25b('0x4d')]({'where':{'id':_0x219b96[_0xa25b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d0ea1,null))[_0xa25b('0x24')](saveUpdates(_0x219b96[_0xa25b('0x4c')],null))['then'](respondWithResult(_0x2d0ea1,null))['catch'](handleError(_0x2d0ea1,null));};exports[_0xa25b('0x4e')]=function(_0x58e9bc,_0x1591c3){return db[_0xa25b('0x2b')][_0xa25b('0x4e')]()[_0xa25b('0x24')](respondWithResult(_0x1591c3,null))[_0xa25b('0x43')](handleError(_0x1591c3,null));};exports[_0xa25b('0x4f')]=function(_0x2d0d2e,_0x364985,_0x5b73a8){var _0x2496dd=require(_0xa25b('0x50'));var _0x42c172=![];var _0x1a9f58={};if(_0x2d0d2e[_0xa25b('0x32')][_0xa25b('0x2d')]&&_0x2d0d2e[_0xa25b('0x32')]['type']===_0xa25b('0x51')){_0x1a9f58[_0xa25b('0x51')]=_0x2d0d2e[_0xa25b('0x45')]['id'];}else{_0x1a9f58['id']=_0x2d0d2e[_0xa25b('0x45')]['id'];}return db[_0xa25b('0x2b')][_0xa25b('0x4d')]({'where':_0x1a9f58,'attributes':['id',_0xa25b('0x52')],'raw':!![]})[_0xa25b('0x24')](handleEntityNotFound(_0x364985,null))[_0xa25b('0x24')](function(_0x2fb973){if(_0x2fb973){var _0x5a0db1=_0x2fb973[_0xa25b('0x52')];var _0x48820a=util[_0xa25b('0x31')](_0xa25b('0x53'),_0x5a0db1);if(fs[_0xa25b('0x54')](_0x48820a)){_0x42c172=!![];return _0x2496dd[_0xa25b('0x55')](_0x48820a,_0x5a0db1,config[_0xa25b('0x56')][_0xa25b('0x57')])[_0xa25b('0x24')](function(){return _0x2fb973;});}return _0x2fb973;}})['then'](function(_0x3aab42){if(_0x3aab42){var _0x1a6345=_0x3aab42[_0xa25b('0x52')];if(!fs['existsSync'](_0x1a6345)){throw new db[(_0xa25b('0x58'))][(_0xa25b('0x59'))](_0xa25b('0x5a'));}if(_0x3aab42['filename']){return _0x364985['download'](_0x1a6345,_0x3aab42[_0xa25b('0x5b')]+path[_0xa25b('0x5c')](_0x1a6345),function(){if(_0x42c172){fs[_0xa25b('0x5d')](_0x1a6345);}});}else{return _0x364985[_0xa25b('0x4f')](_0x1a6345,function(_0x4c1bad){if(_0x42c172){fs[_0xa25b('0x5d')](_0x1a6345);}});}}})[_0xa25b('0x43')](function(_0x12e146){if(_0x12e146[_0xa25b('0x5e')]==='VoiceRecording\x20not\x20found'){_0x364985[_0xa25b('0x1a')](0x194)[_0xa25b('0x28')]('Not\x20found');}else{return handleError(_0x364985,null);}});};exports['downloads']=function(_0x43c578,_0x1f2933,_0x49d39d){var _0xe28d23=require('../../components/encryptor');var _0x3f08c3=![];var _0x1a3cc0={'$and':[db[_0xa25b('0x5f')][_0xa25b('0x3b')](db[_0xa25b('0x5f')]['fn'](_0xa25b('0x60'),db[_0xa25b('0x5f')][_0xa25b('0x61')](_0xa25b('0x51'))),_0x43c578[_0xa25b('0x32')][_0xa25b('0x62')])]};if(_0x43c578['query'][_0xa25b('0x2d')]&&_0x43c578[_0xa25b('0x32')][_0xa25b('0x2d')]===_0xa25b('0x51')){_0x1a3cc0[_0xa25b('0x63')][_0xa25b('0x64')]({'uniqueid':_0x43c578[_0xa25b('0x45')]['id']});}else{_0x1a3cc0[_0xa25b('0x63')][_0xa25b('0x64')]({'id':_0x43c578[_0xa25b('0x45')]['id']});}return db[_0xa25b('0x2b')][_0xa25b('0x4d')]({'where':_0x1a3cc0,'attributes':['id','value'],'raw':!![]})[_0xa25b('0x24')](handleEntityNotFound(_0x1f2933,null))[_0xa25b('0x24')](function(_0x1e8388){if(_0x1e8388){var _0x1a8f51=util[_0xa25b('0x31')](_0xa25b('0x53'),_0x1e8388['value']);if(fs['existsSync'](_0x1a8f51)){_0x3f08c3=!![];return _0xe28d23[_0xa25b('0x55')](_0x1a8f51,_0x1e8388[_0xa25b('0x52')],config[_0xa25b('0x56')]['recording'])[_0xa25b('0x24')](function(){return _0x1e8388;});}return _0x1e8388;}})[_0xa25b('0x24')](function(_0x1f4577){if(_0x1f4577){if(!fs[_0xa25b('0x54')](_0x1f4577[_0xa25b('0x52')])){throw new db[(_0xa25b('0x58'))]['ValidationError'](_0xa25b('0x5a'));}if(_0x1f4577['filename']){return _0x1f2933[_0xa25b('0x4f')](_0x1f4577[_0xa25b('0x52')],_0x1f4577[_0xa25b('0x5b')]+path['extname'](_0x1f4577[_0xa25b('0x52')]),function(){if(_0x3f08c3){fs[_0xa25b('0x5d')](_0x1f4577[_0xa25b('0x52')]);}});}else{return _0x1f2933['download'](_0x1f4577[_0xa25b('0x52')],function(_0x52cb3f){if(_0x3f08c3){fs[_0xa25b('0x5d')](_0x1f4577['value']);}});}}})[_0xa25b('0x43')](handleError(_0x1f2933,null));};exports[_0xa25b('0x25')]=function(_0x250214,_0x36b4a4){return db[_0xa25b('0x2b')][_0xa25b('0x4d')]({'where':{'id':_0x250214[_0xa25b('0x45')]['id']}})[_0xa25b('0x24')](function(_0xaf8412){if(!_0xaf8412)throw new ReferenceError(_0xa25b('0x65'));return _0xaf8412;})['then'](function(_0x3b39dc){var _0x1bb5f5=_0x3b39dc['value'];logger[_0xa25b('0x66')](_0xa25b('0x67'),_0x1bb5f5);if(!_['isNil'](_0x3b39dc[_0xa25b('0x52')])&&fs['existsSync'](_0x1bb5f5)){logger['info'](_0xa25b('0x68')+_0x1bb5f5+_0xa25b('0x69'));fs[_0xa25b('0x6a')](_0x1bb5f5);}_0x1bb5f5=_0x1bb5f5+'.cypher';if(!_[_0xa25b('0x6b')](_0x3b39dc[_0xa25b('0x52')])&&fs[_0xa25b('0x54')](_0x1bb5f5)){logger[_0xa25b('0x66')]('File:\x20\x22'+_0x1bb5f5+_0xa25b('0x69'));fs[_0xa25b('0x6a')](_0x1bb5f5);}return _0x3b39dc;})[_0xa25b('0x24')](function(_0x58c84e){if(!_0x58c84e)throw new InternalError();return _0x58c84e[_0xa25b('0x25')]();})[_0xa25b('0x24')](function(){_0x36b4a4[_0xa25b('0x1a')](0xcc)[_0xa25b('0x1b')]();})[_0xa25b('0x43')](handleError(_0x36b4a4,null));};function getBucketslist(_0x1a1620,_0x37f274,_0x52436c){return new Promise(function(_0x4eef3b,_0x186e59){var _0x5caf3c=new AWS['S3']({'accessKeyId':_0x37f274,'secretAccessKey':_0x1a1620,'region':_0x52436c});_0x5caf3c[_0xa25b('0x6c')]({},function(_0x47b1f5,_0x397563){if(_0x47b1f5){return _0x186e59(_0x47b1f5);}else{return _0x4eef3b(_0x397563);}});});}function createBucket(_0x523328,_0x15f140,_0x4188c2,_0x538743){return new Promise(function(_0x141ca2,_0x1fdef6){var _0xd3d286=new AWS['S3']({'accessKeyId':_0x15f140,'secretAccessKey':_0x523328,'region':_0x4188c2});_0xd3d286['createBucket']({'Bucket':_0x538743},function(_0x7d1c9e,_0x5ea8a4){if(_0x7d1c9e){return _0x1fdef6(_0x7d1c9e);}else{return _0x141ca2(_0x5ea8a4);}});});}function uploadFile(_0xa2b1ad,_0x1578f5,_0x29aac6,_0x436703,_0x4eba6c,_0x5e379b){return new Promise(function(_0x6aa4d3,_0x40e1d9){var _0x38819a=new AWS['S3']({'accessKeyId':_0x1578f5,'secretAccessKey':_0xa2b1ad,'region':_0x29aac6});_0x38819a[_0xa25b('0x6d')]({'Bucket':_0x436703,'Key':_0x4eba6c,'Body':_0x5e379b},function(_0xb96d40,_0x317b9f){if(_0xb96d40){return _0x40e1d9(_0xb96d40);}else{return _0x6aa4d3(_0x317b9f);}});});}function startTranscribe(_0x1a9e4a,_0x1c5788,_0x11b7e8,_0x19b90c,_0x3bb5c9,_0x9ab401){return new Promise(function(_0x3672cc,_0x4e6454){var _0x526866=new AWS[(_0xa25b('0x6e'))]({'accessKeyId':_0x1c5788,'secretAccessKey':_0x1a9e4a,'region':_0x11b7e8});_0x526866['startTranscriptionJob']({'TranscriptionJobName':_0x19b90c,'LanguageCode':_0x3bb5c9,'Media':{'MediaFileUri':_0x9ab401}},function(_0x4dbd82,_0x12130a){if(_0x4dbd82){return _0x4e6454(_0x4dbd82);}else{return _0x3672cc(_0x12130a);}});});}function transcribe(_0x3770c5,_0x4a532b,_0x293c3d,_0x475386,_0xf65175,_0x376e18,_0x5a8df1){return new Promise(function(_0x35d243,_0x467301){var _0x3fd10e={};logger[_0xa25b('0x66')](util['format'](_0xa25b('0x6f'),_0x3770c5,_0xf65175));return uploadFile(_0x4a532b,_0x293c3d,_0x475386,_0xf65175,path[_0xa25b('0x70')](_0x376e18),fs['readFileSync'](_0x376e18))[_0xa25b('0x24')](function(_0x5de770){logger[_0xa25b('0x66')](util[_0xa25b('0x31')](_0xa25b('0x71'),_0x3770c5,_0xf65175,_0x5de770[_0xa25b('0x72')]));_0x3fd10e['bucket']=_0x5de770[_0xa25b('0x73')];_0x3fd10e['location']=_0x5de770[_0xa25b('0x72')];logger[_0xa25b('0x66')](util[_0xa25b('0x31')](_0xa25b('0x74'),_0x3770c5));return startTranscribe(_0x4a532b,_0x293c3d,_0x475386,uuidv4(),_0x5a8df1,_0x5de770[_0xa25b('0x72')]);})['then'](function(_0x1008a7){logger[_0xa25b('0x66')](util[_0xa25b('0x31')](_0xa25b('0x75'),_0x3770c5,_0x1008a7[_0xa25b('0x76')][_0xa25b('0x77')]));_0x3fd10e[_0xa25b('0x78')]=_0x1008a7[_0xa25b('0x76')][_0xa25b('0x77')];_0x3fd10e[_0xa25b('0x79')]=_0x1008a7['TranscriptionJob'][_0xa25b('0x7a')];return _0x35d243(_0x3fd10e);})[_0xa25b('0x43')](function(_0x4e8048){return _0x467301(_0x4e8048);});});}exports[_0xa25b('0x7b')]=function(_0x5b1833,_0x52639d,_0x3dea3b){var _0x824eec;var _0x4a2dd0;var _0x14eb21;var _0x37936a=require(_0xa25b('0x50'));return db[_0xa25b('0x2b')][_0xa25b('0x7c')]({'where':{'id':_0x5b1833[_0xa25b('0x45')]['id']}})[_0xa25b('0x24')](function(_0x193c44){if(_0x193c44){var _0x29715d=util[_0xa25b('0x31')](_0xa25b('0x53'),_0x193c44[_0xa25b('0x52')]);if(fs[_0xa25b('0x54')](_0x29715d)){cypher=!![];return _0x37936a[_0xa25b('0x55')](_0x29715d,_0x193c44[_0xa25b('0x52')],config[_0xa25b('0x56')][_0xa25b('0x57')])[_0xa25b('0x24')](function(){return _0x193c44;});}return _0x193c44;}})[_0xa25b('0x24')](function(_0x33b63d){if(!_0x33b63d){throw new db[(_0xa25b('0x58'))][(_0xa25b('0x59'))](_0xa25b('0x7d'));}_0x4a2dd0=_0x33b63d;return db[_0xa25b('0x7e')]['findOne']({'where':{'id':0x1}});})[_0xa25b('0x24')](handleEntityNotFound(_0x52639d,null))['then'](function(_0x1aeed0){if(_0x1aeed0){_0x824eec=_0x1aeed0;if(!_0x824eec[_0xa25b('0x7f')]||!_0x824eec['transcribeAccountId']||!_0x824eec['transcribeRegion']||!_0x824eec[_0xa25b('0x80')]||!_0x824eec[_0xa25b('0x81')]){throw new db[(_0xa25b('0x58'))][(_0xa25b('0x59'))]('Transcribe\x20not\x20configured');}if(_0x5b1833[_0xa25b('0x4c')][_0xa25b('0x82')]&&(!_0x824eec[_0xa25b('0x83')]||!_0x824eec[_0xa25b('0x84')]||!_0x824eec[_0xa25b('0x85')]||!_0x824eec['language']||!_0x824eec[_0xa25b('0x81')])){throw new db[(_0xa25b('0x58'))][(_0xa25b('0x59'))](_0xa25b('0x86'));}return db[_0xa25b('0x87')][_0xa25b('0x7c')]({'where':{'id':_0x824eec['transcribeAccountId']}});}})['then'](function(_0x4898e3){if(!_0x4898e3){throw new db['Sequelize'][(_0xa25b('0x59'))](_0xa25b('0x88'));}if(!_0x4898e3[_0xa25b('0x89')]||!_0x4898e3['data2']){throw new db[(_0xa25b('0x58'))][(_0xa25b('0x59'))](_0xa25b('0x8a'));}_0x14eb21=_0x4898e3;return getBucketslist(_0x14eb21[_0xa25b('0x89')],_0x14eb21[_0xa25b('0x8b')],_0x824eec[_0xa25b('0x8c')]);})[_0xa25b('0x24')](function(_0x49e79f){if(_0x49e79f&&_0x49e79f['Buckets']){var _0x5cc6e5=_[_0xa25b('0x4d')](_0x49e79f['Buckets'],function(_0x15f152){return _0x15f152[_0xa25b('0x8d')]===_0x824eec['bucket'];});if(!_0x5cc6e5){logger[_0xa25b('0x66')](util[_0xa25b('0x31')](_0xa25b('0x8e'),_0x5b1833[_0xa25b('0x45')]['id'],_0x824eec[_0xa25b('0x81')]));return createBucket(_0x14eb21[_0xa25b('0x89')],_0x14eb21[_0xa25b('0x8b')],_0x824eec[_0xa25b('0x8c')],_0x824eec[_0xa25b('0x81')]);}logger['info'](util['format'](_0xa25b('0x8f'),_0x5b1833[_0xa25b('0x45')]['id'],_0x824eec[_0xa25b('0x81')]));return;}})[_0xa25b('0x24')](function(_0x3de153){if(_0x4a2dd0['transcribeStatus']===_0xa25b('0x90')){return transcribe(_0x5b1833[_0xa25b('0x45')]['id'],_0x14eb21['data1'],_0x14eb21[_0xa25b('0x8b')],_0x824eec['transcribeRegion'],_0x824eec['bucket'],_0x4a2dd0['value'],_0x824eec['language']);}else{logger[_0xa25b('0x66')](util[_0xa25b('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x5b1833[_0xa25b('0x45')]['id']));return{'transcribeStatus':_0xa25b('0x91')};}})['then'](function(_0xfa59bf){if(_0xfa59bf){_0xfa59bf[_0xa25b('0x92')]=_0x5b1833[_0xa25b('0x4c')][_0xa25b('0x82')];return _0x4a2dd0['updateAttributes'](_0xfa59bf);}})[_0xa25b('0x24')](respondWithResult(_0x52639d,null))[_0xa25b('0x43')](handleError(_0x52639d,null));};function writeFile(_0x2a88c1,_0x10f715){return new Promise(function(_0x4db6a4,_0x413dda){fs[_0xa25b('0x93')](_0x10f715,_0x2a88c1,function(_0x768923,_0x3dda17){if(_0x768923){return _0x413dda(_0x768923);}else{return _0x4db6a4(_0x3dda17);}});});}exports[_0xa25b('0x94')]=function(_0x52058c,_0x5506e3,_0x301375){return db[_0xa25b('0x2b')][_0xa25b('0x7c')]({'where':{'id':_0x52058c[_0xa25b('0x45')]['id']}})[_0xa25b('0x24')](handleEntityNotFound(_0x5506e3))[_0xa25b('0x24')](function(_0x198642){if(_0x198642&&_0x198642['fileText']){var _0x2446dd=_0x198642[_0xa25b('0x95')];var _0x4ef5a8=config[_0xa25b('0x96')]+'/server/files/transcribes/transcribe_'+_0x198642['id']+_0xa25b('0x97');if(fs[_0xa25b('0x54')](_0x4ef5a8)){return _0x4ef5a8;}return writeFile(_0x2446dd,_0x4ef5a8)[_0xa25b('0x24')](function(){return _0x4ef5a8;});}else{throw new db[(_0xa25b('0x58'))]['ValidationError'](_0xa25b('0x98'));}})[_0xa25b('0x24')](function(_0x1d1e4b){return _0x5506e3[_0xa25b('0x4f')](_0x1d1e4b);})[_0xa25b('0x43')](handleError(_0x5506e3));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 37b0911..d7457be 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 _0xd2d9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceRecording','uniqueid','lodash','util','../../config/logger'];(function(_0x4c217f,_0x82a1ae){var _0x4033b2=function(_0x4752cb){while(--_0x4752cb){_0x4c217f['push'](_0x4c217f['shift']());}};_0x4033b2(++_0x82a1ae);}(_0xd2d9,0xcd));var _0x9d2d=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0xd2d9[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0x9d2d('0x0'));var util=require(_0x9d2d('0x1'));var logger=require(_0x9d2d('0x2'))(_0x9d2d('0x3'));var moment=require(_0x9d2d('0x4'));var BPromise=require(_0x9d2d('0x5'));var rp=require(_0x9d2d('0x6'));var fs=require('fs');var path=require(_0x9d2d('0x7'));var rimraf=require(_0x9d2d('0x8'));var config=require(_0x9d2d('0x9'));var attributes=require('./voiceRecording.attributes');module[_0x9d2d('0xa')]=function(_0x3dafaf,_0x26fd40){return _0x3dafaf['define'](_0x9d2d('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9d2d('0xc'),'fields':[_0x9d2d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd185=['bluebird','request-promise','../../config/environment','./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api'];(function(_0x11a44a,_0x38c203){var _0x1f3a32=function(_0x560f1d){while(--_0x560f1d){_0x11a44a['push'](_0x11a44a['shift']());}};_0x1f3a32(++_0x38c203);}(_0xd185,0x194));var _0x5d18=function(_0x1189ab,_0x346410){_0x1189ab=_0x1189ab-0x0;var _0x36db69=_0xd185[_0x1189ab];return _0x36db69;};'use strict';var _=require('lodash');var util=require(_0x5d18('0x0'));var logger=require(_0x5d18('0x1'))(_0x5d18('0x2'));var moment=require('moment');var BPromise=require(_0x5d18('0x3'));var rp=require(_0x5d18('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5d18('0x5'));var attributes=require(_0x5d18('0x6'));module[_0x5d18('0x7')]=function(_0x10f988,_0x8410d6){return _0x10f988['define'](_0x5d18('0x8'),attributes,{'tableName':_0x5d18('0x9'),'paranoid':![],'indexes':[{'name':_0x5d18('0xa'),'fields':[_0x5d18('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a48a0ce..f22a388 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(_0x482431,_0x22caff){var _0x484ade=function(_0x47f973){while(--_0x47f973){_0x482431['push'](_0x482431['shift']());}};_0x484ade(++_0x22caff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x25806f,_0x16dbdd){var _0x163f12=function(_0x3d1990){while(--_0x3d1990){_0x25806f['push'](_0x25806f['shift']());}};_0x163f12(++_0x16dbdd);}(_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);});});}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 b391447..efad611 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 _0x1883=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports'];(function(_0x2f32c5,_0x16d262){var _0x376c10=function(_0x41fb22){while(--_0x41fb22){_0x2f32c5['push'](_0x2f32c5['shift']());}};_0x376c10(++_0x16d262);}(_0x1883,0xab));var _0x3188=function(_0x3a4078,_0x56ceac){_0x3a4078=_0x3a4078-0x0;var _0x59f16d=_0x1883[_0x3a4078];return _0x59f16d;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var auth=require(_0x3188('0x6'));var interaction=require(_0x3188('0x7'));var config=require(_0x3188('0x8'));var controller=require(_0x3188('0x9'));router[_0x3188('0xa')]('/',auth[_0x3188('0xb')](),controller[_0x3188('0xc')]);router[_0x3188('0xa')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller[_0x3188('0xe')]);router['post']('/',auth[_0x3188('0xb')](),controller[_0x3188('0xf')]);router['put'](_0x3188('0xd'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router[_0x3188('0x11')](_0x3188('0xd'),auth[_0x3188('0xb')](),controller['destroy']);module[_0x3188('0x12')]=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x130b30,_0x3d45b6){var _0x1b9f34=function(_0xf5b5ff){while(--_0xf5b5ff){_0x130b30['push'](_0x130b30['shift']());}};_0x1b9f34(++_0x3d45b6);}(_0x2542,0x169));var _0x2254=function(_0x5ce397,_0x2998aa){_0x5ce397=_0x5ce397-0x0;var _0x219b46=_0x2542[_0x5ce397];return _0x219b46;};'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/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index fdc3f29..a4ee04b 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 _0x0c03=['exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0c03,0x1a3));var _0x30c0=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0x0c03[_0x1c470d];return _0x12141b;};'use strict';var Sequelize=require(_0x30c0('0x0'));var moment=require('moment');module[_0x30c0('0x1')]={'type':{'type':Sequelize[_0x30c0('0x2')](_0x30c0('0x3'),_0x30c0('0x4'))},'result':{'type':Sequelize[_0x30c0('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x30c0('0x5')]},'transferercalleridname':{'type':Sequelize[_0x30c0('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x30c0('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x30c0('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x30c0('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x30c0('0x5')]},'transfereechannel':{'type':Sequelize[_0x30c0('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x30c0('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x30c0('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x30c0('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x30c0('0x5')]},'transfereecontext':{'type':Sequelize[_0x30c0('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x30c0('0x2')](_0x30c0('0x6'),'No')},'context':{'type':Sequelize[_0x30c0('0x5')]},'extension':{'type':Sequelize[_0x30c0('0x5')]}}; \ No newline at end of file +var _0xfae0=['exports','blind','STRING','ENUM','Yes','sequelize','moment'];(function(_0x3af5b4,_0x2320f8){var _0x4a31d8=function(_0x5ed149){while(--_0x5ed149){_0x3af5b4['push'](_0x3af5b4['shift']());}};_0x4a31d8(++_0x2320f8);}(_0xfae0,0x8a));var _0x0fae=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0xfae0[_0x33e4a7];return _0x598620;};'use strict';var Sequelize=require(_0x0fae('0x0'));var moment=require(_0x0fae('0x1'));module[_0x0fae('0x2')]={'type':{'type':Sequelize['ENUM'](_0x0fae('0x3'),'attended')},'result':{'type':Sequelize[_0x0fae('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x0fae('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0fae('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0fae('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x0fae('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x0fae('0x4')]},'transfererexten':{'type':Sequelize[_0x0fae('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x0fae('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0fae('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0fae('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x0fae('0x4')]},'isexternal':{'type':Sequelize[_0x0fae('0x5')](_0x0fae('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0fae('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0001af9..18ec848 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 _0x85de=['rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','VoiceTransferReport','findAll','rows','catch','params','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map'];(function(_0x3e4282,_0x3c68d6){var _0x30596b=function(_0xc4f4fd){while(--_0xc4f4fd){_0x3e4282['push'](_0x3e4282['shift']());}};_0x30596b(++_0x3c68d6);}(_0x85de,0x1f0));var _0xe85d=function(_0x35b1f5,_0x5205cb){_0x35b1f5=_0x35b1f5-0x0;var _0xaa3672=_0x85de[_0x35b1f5];return _0xaa3672;};'use strict';var pdf=require(_0xe85d('0x0'));var emlformat=require(_0xe85d('0x1'));var rimraf=require(_0xe85d('0x2'));var zipdir=require(_0xe85d('0x3'));var jsonpatch=require(_0xe85d('0x4'));var rp=require('request-promise');var moment=require(_0xe85d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe85d('0x6'));var path=require(_0xe85d('0x7'));var sox=require('sox');var csv=require(_0xe85d('0x8'));var ejs=require(_0xe85d('0x9'));var fs=require('fs');var _=require(_0xe85d('0xa'));var squel=require(_0xe85d('0xb'));var crypto=require(_0xe85d('0xc'));var jsforce=require(_0xe85d('0xd'));var deskjs=require(_0xe85d('0xe'));var toCsv=require(_0xe85d('0x8'));var querystring=require('querystring');var Papa=require(_0xe85d('0xf'));var Redis=require(_0xe85d('0x10'));var authService=require(_0xe85d('0x11'));var qs=require(_0xe85d('0x12'));var as=require(_0xe85d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe85d('0x14'))('api');var utils=require(_0xe85d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe85d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec59a,_0x1fc972){_0x1fc972=_0x1fc972||0xcc;return function(_0x10dd73){if(_0x10dd73){return _0x3ec59a[_0xe85d('0x17')](_0x1fc972);}return _0x3ec59a[_0xe85d('0x18')](_0x1fc972)[_0xe85d('0x19')]();};}function respondWithResult(_0xe3d1ca,_0x59382f){_0x59382f=_0x59382f||0xc8;return function(_0xe78813){if(_0xe78813){return _0xe3d1ca[_0xe85d('0x18')](_0x59382f)['json'](_0xe78813);}};}function respondWithFilteredResult(_0x2750e8,_0x11aa3d){return function(_0x174d06){if(_0x174d06){var _0x1e56c5=_0x174d06[_0xe85d('0x1a')],_0x110997=_0x11aa3d[_0xe85d('0x1b')],_0x325f2b=_0x11aa3d['offset']+_0x11aa3d[_0xe85d('0x1c')],_0x136fe6;if(_0x325f2b>=_0x1e56c5){_0x325f2b=_0x1e56c5;_0x136fe6=0xc8;}else{_0x136fe6=0xce;}_0x2750e8['status'](_0x136fe6);return _0x2750e8[_0xe85d('0x1d')]('Content-Range',_0x110997+'-'+_0x325f2b+'/'+_0x1e56c5)['json'](_0x174d06);}return null;};}function patchUpdates(_0x5f1a34){return function(_0xed29b9){try{jsonpatch[_0xe85d('0x1e')](_0xed29b9,_0x5f1a34,!![]);}catch(_0x6156d){return BPromise['reject'](_0x6156d);}return _0xed29b9[_0xe85d('0x1f')]();};}function saveUpdates(_0x1cf621,_0x44bab0){return function(_0x2c1e6a){if(_0x2c1e6a){return _0x2c1e6a[_0xe85d('0x20')](_0x1cf621)[_0xe85d('0x21')](function(_0x42511a){return _0x42511a;});}return null;};}function removeEntity(_0x2f77d8,_0x4d9970){return function(_0x296f02){if(_0x296f02){return _0x296f02[_0xe85d('0x22')]()[_0xe85d('0x21')](function(){_0x2f77d8[_0xe85d('0x18')](0xcc)[_0xe85d('0x19')]();});}};}function handleEntityNotFound(_0x58c73f,_0x2672a3){return function(_0x217730){if(!_0x217730){_0x58c73f['sendStatus'](0x194);}return _0x217730;};}function handleError(_0x44a48c,_0x243a5){_0x243a5=_0x243a5||0x1f4;return function(_0x393902){logger[_0xe85d('0x23')](_0x393902[_0xe85d('0x24')]);if(_0x393902[_0xe85d('0x25')]){delete _0x393902[_0xe85d('0x25')];}_0x44a48c[_0xe85d('0x18')](_0x243a5)['send'](_0x393902);};}exports[_0xe85d('0x26')]=function(_0x1ce626,_0x3c459c){var _0x591f7c={},_0x19f095={},_0x29b4d5={'count':0x0,'rows':[]};var _0xa88e5b=_[_0xe85d('0x27')](db['VoiceTransferReport'][_0xe85d('0x28')],function(_0x1664b3){return{'name':_0x1664b3[_0xe85d('0x29')],'type':_0x1664b3[_0xe85d('0x2a')]['key']};});_0x19f095[_0xe85d('0x2b')]=_[_0xe85d('0x27')](_0xa88e5b,_0xe85d('0x25'));_0x19f095[_0xe85d('0x2c')]=_[_0xe85d('0x2d')](_0x1ce626[_0xe85d('0x2c')]);_0x19f095[_0xe85d('0x2e')]=_['intersection'](_0x19f095['model'],_0x19f095[_0xe85d('0x2c')]);_0x591f7c[_0xe85d('0x2f')]=_[_0xe85d('0x30')](_0x19f095[_0xe85d('0x2b')],qs[_0xe85d('0x31')](_0x1ce626['query'][_0xe85d('0x31')]));_0x591f7c[_0xe85d('0x2f')]=_0x591f7c[_0xe85d('0x2f')][_0xe85d('0x32')]?_0x591f7c['attributes']:_0x19f095[_0xe85d('0x2b')];if(!_0x1ce626[_0xe85d('0x2c')][_0xe85d('0x33')]('nolimit')){_0x591f7c[_0xe85d('0x1c')]=qs['limit'](_0x1ce626[_0xe85d('0x2c')][_0xe85d('0x1c')]);_0x591f7c[_0xe85d('0x1b')]=qs[_0xe85d('0x1b')](_0x1ce626[_0xe85d('0x2c')][_0xe85d('0x1b')]);}_0x591f7c['order']=qs[_0xe85d('0x34')](_0x1ce626['query'][_0xe85d('0x34')]);_0x591f7c[_0xe85d('0x35')]=qs[_0xe85d('0x2e')](_['pick'](_0x1ce626[_0xe85d('0x2c')],_0x19f095[_0xe85d('0x2e')]),_0xa88e5b);if(_0x1ce626['query'][_0xe85d('0x36')]){_0x591f7c[_0xe85d('0x35')]=_[_0xe85d('0x37')](_0x591f7c[_0xe85d('0x35')],{'$or':_[_0xe85d('0x27')](_0xa88e5b,function(_0x2caab4){if(_0x2caab4['type']!=='VIRTUAL'){var _0x1f7ce6={};_0x1f7ce6[_0x2caab4[_0xe85d('0x25')]]={'$like':'%'+_0x1ce626[_0xe85d('0x2c')][_0xe85d('0x36')]+'%'};return _0x1f7ce6;}})});}_0x591f7c=_[_0xe85d('0x37')]({},_0x591f7c,_0x1ce626['options']);var _0x27353c={'where':_0x591f7c['where']};return db['VoiceTransferReport']['count'](_0x27353c)[_0xe85d('0x21')](function(_0x5fb38a){_0x29b4d5['count']=_0x5fb38a;if(_0x1ce626[_0xe85d('0x2c')][_0xe85d('0x38')]){_0x591f7c[_0xe85d('0x39')]=[{'all':!![]}];}return db[_0xe85d('0x3a')][_0xe85d('0x3b')](_0x591f7c);})[_0xe85d('0x21')](function(_0xf26564){_0x29b4d5[_0xe85d('0x3c')]=_0xf26564;return _0x29b4d5;})[_0xe85d('0x21')](respondWithFilteredResult(_0x3c459c,_0x591f7c))[_0xe85d('0x3d')](handleError(_0x3c459c,null));};exports['show']=function(_0x23add8,_0x2c0c99){var _0x51961b={'raw':!![],'where':{'id':_0x23add8[_0xe85d('0x3e')]['id']}},_0x2dc613={};_0x2dc613[_0xe85d('0x2b')]=_['keys'](db[_0xe85d('0x3a')]['rawAttributes']);_0x2dc613[_0xe85d('0x2c')]=_[_0xe85d('0x2d')](_0x23add8[_0xe85d('0x2c')]);_0x2dc613['filtears']=_[_0xe85d('0x30')](_0x2dc613[_0xe85d('0x2b')],_0x2dc613[_0xe85d('0x2c')]);_0x51961b['attributes']=_[_0xe85d('0x30')](_0x2dc613[_0xe85d('0x2b')],qs[_0xe85d('0x31')](_0x23add8[_0xe85d('0x2c')]['fields']));_0x51961b[_0xe85d('0x2f')]=_0x51961b[_0xe85d('0x2f')]['length']?_0x51961b[_0xe85d('0x2f')]:_0x2dc613['model'];if(_0x23add8[_0xe85d('0x2c')][_0xe85d('0x38')]){_0x51961b[_0xe85d('0x39')]=[{'all':!![]}];}_0x51961b=_[_0xe85d('0x37')]({},_0x51961b,_0x23add8[_0xe85d('0x3f')]);return db[_0xe85d('0x3a')]['find'](_0x51961b)[_0xe85d('0x21')](handleEntityNotFound(_0x2c0c99,null))[_0xe85d('0x21')](respondWithResult(_0x2c0c99,null))['catch'](handleError(_0x2c0c99,null));};exports[_0xe85d('0x40')]=function(_0x5d1125,_0xa29e33){return db[_0xe85d('0x3a')][_0xe85d('0x40')](_0x5d1125[_0xe85d('0x41')],{})['then'](respondWithResult(_0xa29e33,0xc9))[_0xe85d('0x3d')](handleError(_0xa29e33,null));};exports[_0xe85d('0x20')]=function(_0x506d61,_0x2cfe7b){if(_0x506d61[_0xe85d('0x41')]['id']){delete _0x506d61[_0xe85d('0x41')]['id'];}return db['VoiceTransferReport'][_0xe85d('0x42')]({'where':{'id':_0x506d61['params']['id']}})[_0xe85d('0x21')](handleEntityNotFound(_0x2cfe7b,null))[_0xe85d('0x21')](saveUpdates(_0x506d61['body'],null))[_0xe85d('0x21')](respondWithResult(_0x2cfe7b,null))[_0xe85d('0x3d')](handleError(_0x2cfe7b,null));};exports['destroy']=function(_0x2bf4c1,_0x113d61){return db['VoiceTransferReport'][_0xe85d('0x42')]({'where':{'id':_0x2bf4c1[_0xe85d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x113d61,null))[_0xe85d('0x21')](removeEntity(_0x113d61,null))[_0xe85d('0x3d')](handleError(_0x113d61,null));}; \ No newline at end of file +var _0x5825=['Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set'];(function(_0x129abf,_0xd2d4c8){var _0x3bb0ae=function(_0x4d6c53){while(--_0x4d6c53){_0x129abf['push'](_0x129abf['shift']());}};_0x3bb0ae(++_0xd2d4c8);}(_0x5825,0x78));var _0x5582=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5825[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x5582('0x0'));var emlformat=require(_0x5582('0x1'));var rimraf=require(_0x5582('0x2'));var zipdir=require(_0x5582('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5582('0x4'));var moment=require('moment');var BPromise=require(_0x5582('0x5'));var Mustache=require(_0x5582('0x6'));var util=require(_0x5582('0x7'));var path=require(_0x5582('0x8'));var sox=require(_0x5582('0x9'));var csv=require(_0x5582('0xa'));var ejs=require(_0x5582('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5582('0xc'));var crypto=require(_0x5582('0xd'));var jsforce=require(_0x5582('0xe'));var deskjs=require(_0x5582('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5582('0x10'));var Papa=require(_0x5582('0x11'));var Redis=require(_0x5582('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5582('0x13'));var as=require(_0x5582('0x14'));var hardwareService=require(_0x5582('0x15'));var logger=require('../../config/logger')(_0x5582('0x16'));var utils=require(_0x5582('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5582('0x18'));var db=require(_0x5582('0x19'))['db'];function respondWithStatusCode(_0x4798d6,_0x5a9a4e){_0x5a9a4e=_0x5a9a4e||0xcc;return function(_0x132be7){if(_0x132be7){return _0x4798d6['sendStatus'](_0x5a9a4e);}return _0x4798d6['status'](_0x5a9a4e)[_0x5582('0x1a')]();};}function respondWithResult(_0x2dcae9,_0x4c83c3){_0x4c83c3=_0x4c83c3||0xc8;return function(_0x245cd7){if(_0x245cd7){return _0x2dcae9[_0x5582('0x1b')](_0x4c83c3)['json'](_0x245cd7);}};}function respondWithFilteredResult(_0x821ad0,_0x439628){return function(_0x4835de){if(_0x4835de){var _0x511268=_0x4835de[_0x5582('0x1c')],_0xf38ed6=_0x439628[_0x5582('0x1d')],_0x5bb7a4=_0x439628[_0x5582('0x1d')]+_0x439628[_0x5582('0x1e')],_0x378fa8;if(_0x5bb7a4>=_0x511268){_0x5bb7a4=_0x511268;_0x378fa8=0xc8;}else{_0x378fa8=0xce;}_0x821ad0[_0x5582('0x1b')](_0x378fa8);return _0x821ad0[_0x5582('0x1f')](_0x5582('0x20'),_0xf38ed6+'-'+_0x5bb7a4+'/'+_0x511268)['json'](_0x4835de);}return null;};}function patchUpdates(_0x907cab){return function(_0x4305eb){try{jsonpatch[_0x5582('0x21')](_0x4305eb,_0x907cab,!![]);}catch(_0x44fc81){return BPromise['reject'](_0x44fc81);}return _0x4305eb[_0x5582('0x22')]();};}function saveUpdates(_0x408f4c,_0x140b60){return function(_0x123ab7){if(_0x123ab7){return _0x123ab7[_0x5582('0x23')](_0x408f4c)[_0x5582('0x24')](function(_0x744903){return _0x744903;});}return null;};}function removeEntity(_0x3efcfb,_0x239553){return function(_0x4d815a){if(_0x4d815a){return _0x4d815a[_0x5582('0x25')]()['then'](function(){_0x3efcfb[_0x5582('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1184d3,_0x4b775f){return function(_0x47eb4d){if(!_0x47eb4d){_0x1184d3[_0x5582('0x26')](0x194);}return _0x47eb4d;};}function handleError(_0xbd8cb4,_0x345c1f){_0x345c1f=_0x345c1f||0x1f4;return function(_0x4b178f){logger[_0x5582('0x27')](_0x4b178f[_0x5582('0x28')]);if(_0x4b178f['name']){delete _0x4b178f[_0x5582('0x29')];}_0xbd8cb4['status'](_0x345c1f)[_0x5582('0x2a')](_0x4b178f);};}exports[_0x5582('0x2b')]=function(_0x4ff497,_0x259f5f){var _0x5de26b={},_0xe67b02={},_0x151939={'count':0x0,'rows':[]};var _0x2a5838=_[_0x5582('0x2c')](db[_0x5582('0x2d')][_0x5582('0x2e')],function(_0x134d00){return{'name':_0x134d00[_0x5582('0x2f')],'type':_0x134d00[_0x5582('0x30')]['key']};});_0xe67b02[_0x5582('0x31')]=_[_0x5582('0x2c')](_0x2a5838,_0x5582('0x29'));_0xe67b02[_0x5582('0x32')]=_[_0x5582('0x33')](_0x4ff497[_0x5582('0x32')]);_0xe67b02[_0x5582('0x34')]=_[_0x5582('0x35')](_0xe67b02['model'],_0xe67b02[_0x5582('0x32')]);_0x5de26b[_0x5582('0x36')]=_[_0x5582('0x35')](_0xe67b02[_0x5582('0x31')],qs['fields'](_0x4ff497[_0x5582('0x32')][_0x5582('0x37')]));_0x5de26b['attributes']=_0x5de26b[_0x5582('0x36')]['length']?_0x5de26b[_0x5582('0x36')]:_0xe67b02[_0x5582('0x31')];if(!_0x4ff497['query'][_0x5582('0x38')](_0x5582('0x39'))){_0x5de26b[_0x5582('0x1e')]=qs[_0x5582('0x1e')](_0x4ff497[_0x5582('0x32')][_0x5582('0x1e')]);_0x5de26b[_0x5582('0x1d')]=qs['offset'](_0x4ff497['query'][_0x5582('0x1d')]);}_0x5de26b[_0x5582('0x3a')]=qs[_0x5582('0x3b')](_0x4ff497['query']['sort']);_0x5de26b['where']=qs['filters'](_[_0x5582('0x3c')](_0x4ff497[_0x5582('0x32')],_0xe67b02[_0x5582('0x34')]),_0x2a5838);if(_0x4ff497[_0x5582('0x32')][_0x5582('0x3d')]){_0x5de26b[_0x5582('0x3e')]=_['merge'](_0x5de26b['where'],{'$or':_[_0x5582('0x2c')](_0x2a5838,function(_0x38853c){if(_0x38853c[_0x5582('0x30')]!==_0x5582('0x3f')){var _0x2f0724={};_0x2f0724[_0x38853c[_0x5582('0x29')]]={'$like':'%'+_0x4ff497[_0x5582('0x32')][_0x5582('0x3d')]+'%'};return _0x2f0724;}})});}_0x5de26b=_[_0x5582('0x40')]({},_0x5de26b,_0x4ff497[_0x5582('0x41')]);var _0xa91b3d={'where':_0x5de26b[_0x5582('0x3e')]};return db['VoiceTransferReport'][_0x5582('0x1c')](_0xa91b3d)['then'](function(_0x552522){_0x151939[_0x5582('0x1c')]=_0x552522;if(_0x4ff497['query'][_0x5582('0x42')]){_0x5de26b[_0x5582('0x43')]=[{'all':!![]}];}return db[_0x5582('0x2d')][_0x5582('0x44')](_0x5de26b);})[_0x5582('0x24')](function(_0x4fb1fb){_0x151939[_0x5582('0x45')]=_0x4fb1fb;return _0x151939;})[_0x5582('0x24')](respondWithFilteredResult(_0x259f5f,_0x5de26b))['catch'](handleError(_0x259f5f,null));};exports[_0x5582('0x46')]=function(_0x28fc22,_0x16bc1c){var _0x5b45ad={'raw':!![],'where':{'id':_0x28fc22[_0x5582('0x47')]['id']}},_0x2dae3f={};_0x2dae3f[_0x5582('0x31')]=_[_0x5582('0x33')](db[_0x5582('0x2d')][_0x5582('0x2e')]);_0x2dae3f[_0x5582('0x32')]=_[_0x5582('0x33')](_0x28fc22[_0x5582('0x32')]);_0x2dae3f['filtears']=_['intersection'](_0x2dae3f['model'],_0x2dae3f[_0x5582('0x32')]);_0x5b45ad['attributes']=_['intersection'](_0x2dae3f['model'],qs[_0x5582('0x37')](_0x28fc22[_0x5582('0x32')][_0x5582('0x37')]));_0x5b45ad[_0x5582('0x36')]=_0x5b45ad[_0x5582('0x36')]['length']?_0x5b45ad[_0x5582('0x36')]:_0x2dae3f[_0x5582('0x31')];if(_0x28fc22[_0x5582('0x32')][_0x5582('0x42')]){_0x5b45ad[_0x5582('0x43')]=[{'all':!![]}];}_0x5b45ad=_[_0x5582('0x40')]({},_0x5b45ad,_0x28fc22['options']);return db[_0x5582('0x2d')][_0x5582('0x48')](_0x5b45ad)[_0x5582('0x24')](handleEntityNotFound(_0x16bc1c,null))[_0x5582('0x24')](respondWithResult(_0x16bc1c,null))[_0x5582('0x49')](handleError(_0x16bc1c,null));};exports[_0x5582('0x4a')]=function(_0x1d850e,_0x3133aa){return db[_0x5582('0x2d')][_0x5582('0x4a')](_0x1d850e[_0x5582('0x4b')],{})[_0x5582('0x24')](respondWithResult(_0x3133aa,0xc9))['catch'](handleError(_0x3133aa,null));};exports[_0x5582('0x23')]=function(_0x14a27b,_0x24c053){if(_0x14a27b[_0x5582('0x4b')]['id']){delete _0x14a27b[_0x5582('0x4b')]['id'];}return db[_0x5582('0x2d')][_0x5582('0x48')]({'where':{'id':_0x14a27b['params']['id']}})['then'](handleEntityNotFound(_0x24c053,null))[_0x5582('0x24')](saveUpdates(_0x14a27b['body'],null))[_0x5582('0x24')](respondWithResult(_0x24c053,null))[_0x5582('0x49')](handleError(_0x24c053,null));};exports[_0x5582('0x25')]=function(_0x4a8f31,_0x2899bd){return db['VoiceTransferReport'][_0x5582('0x48')]({'where':{'id':_0x4a8f31['params']['id']}})[_0x5582('0x24')](handleEntityNotFound(_0x2899bd,null))[_0x5582('0x24')](removeEntity(_0x2899bd,null))[_0x5582('0x49')](handleError(_0x2899bd,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index aa57f69..1c446aa 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 _0xc2a2=['./voiceTransferReport.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x4e9861,_0x25fe5f){var _0x49802f=function(_0x76932){while(--_0x76932){_0x4e9861['push'](_0x4e9861['shift']());}};_0x49802f(++_0x25fe5f);}(_0xc2a2,0x84));var _0x2c2a=function(_0x325712,_0x2c665e){_0x325712=_0x325712-0x0;var _0x25f1fd=_0xc2a2[_0x325712];return _0x25f1fd;};'use strict';var _=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var logger=require(_0x2c2a('0x2'))(_0x2c2a('0x3'));var moment=require('moment');var BPromise=require(_0x2c2a('0x4'));var rp=require(_0x2c2a('0x5'));var fs=require('fs');var path=require(_0x2c2a('0x6'));var rimraf=require('rimraf');var config=require(_0x2c2a('0x7'));var attributes=require(_0x2c2a('0x8'));module[_0x2c2a('0x9')]=function(_0x17db27,_0x51c919){return _0x17db27['define']('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe59f=['VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','./voiceTransferReport.attributes','exports','define'];(function(_0xbcab1f,_0x16ccef){var _0x280272=function(_0x2908d2){while(--_0x2908d2){_0xbcab1f['push'](_0xbcab1f['shift']());}};_0x280272(++_0x16ccef);}(_0xe59f,0x1c5));var _0xfe59=function(_0x7ec790,_0x45113d){_0x7ec790=_0x7ec790-0x0;var _0x50e134=_0xe59f[_0x7ec790];return _0x50e134;};'use strict';var _=require(_0xfe59('0x0'));var util=require(_0xfe59('0x1'));var logger=require(_0xfe59('0x2'))(_0xfe59('0x3'));var moment=require('moment');var BPromise=require(_0xfe59('0x4'));var rp=require(_0xfe59('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe59('0x6'));module[_0xfe59('0x7')]=function(_0x238289,_0x2212f6){return _0x238289[_0xfe59('0x8')](_0xfe59('0x9'),attributes,{'tableName':_0xfe59('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 31661c5..13d6028 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 _0x70e2=['VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x5918e7,_0xe7ea50){var _0x167b79=function(_0x5a5bb5){while(--_0x5a5bb5){_0x5918e7['push'](_0x5918e7['shift']());}};_0x167b79(++_0xe7ea50);}(_0x70e2,0xc3));var _0x270e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x70e2[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var moment=require(_0x270e('0x2'));var BPromise=require(_0x270e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x270e('0x4'));var db=require(_0x270e('0x5'))['db'];var utils=require(_0x270e('0x6'));var logger=require(_0x270e('0x7'))(_0x270e('0x8'));var config=require(_0x270e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x270e('0xa')][_0x270e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x384b50,_0x54bace,_0x5c6f97){return new BPromise(function(_0xcf2827,_0x568844){return client[_0x270e('0xc')](_0x384b50,_0x5c6f97)[_0x270e('0xd')](function(_0xf66978){logger[_0x270e('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x54bace,'request\x20sent');logger[_0x270e('0xf')](_0x270e('0x10'),_0x54bace,_0x270e('0x11'),JSON[_0x270e('0x12')](_0xf66978));if(_0xf66978[_0x270e('0x13')]){if(_0xf66978[_0x270e('0x13')][_0x270e('0x14')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x54bace,_0xf66978[_0x270e('0x13')][_0x270e('0x15')]);return _0x568844(_0xf66978[_0x270e('0x13')][_0x270e('0x15')]);}logger['error'](_0x270e('0x16'),_0x54bace,_0xf66978[_0x270e('0x13')][_0x270e('0x15')]);return _0xcf2827(_0xf66978[_0x270e('0x13')][_0x270e('0x15')]);}else{logger['info'](_0x270e('0x16'),_0x54bace,_0x270e('0x11'));_0xcf2827(_0xf66978[_0x270e('0x17')][_0x270e('0x15')]);}})[_0x270e('0x18')](function(_0x232976){logger[_0x270e('0x13')](_0x270e('0x16'),_0x54bace,_0x232976);_0x568844(_0x232976);});});}exports[_0x270e('0x19')]=function(_0x5394e4){var _0x158a61=this;return new Promise(function(_0x3df77a,_0x3f931f){return db[_0x270e('0x1a')][_0x270e('0x1b')](_0x5394e4[_0x270e('0x1c')],{'raw':_0x5394e4['options']?_0x5394e4[_0x270e('0x1d')][_0x270e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x480ed6){logger['info'](_0x270e('0x19'),_0x5394e4);logger['debug'](_0x270e('0x19'),_0x5394e4,JSON[_0x270e('0x12')](_0x480ed6));_0x3df77a(_0x480ed6);})[_0x270e('0x18')](function(_0x4f3714){logger[_0x270e('0x13')](_0x270e('0x19'),_0x4f3714['message'],_0x5394e4);_0x3f931f(_0x158a61[_0x270e('0x13')](0x1f4,_0x4f3714['message']));});});}; \ No newline at end of file +var _0xa553=['../../config/logger','rpc','../../config/environment','jayson/promise','client','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x97aef3,_0x56a422){var _0x36e7f7=function(_0x36ecd4){while(--_0x36ecd4){_0x97aef3['push'](_0x97aef3['shift']());}};_0x36e7f7(++_0x56a422);}(_0xa553,0x158));var _0x3a55=function(_0x527cca,_0x4ef3e3){_0x527cca=_0x527cca-0x0;var _0x28c1cc=_0xa553[_0x527cca];return _0x28c1cc;};'use strict';var _=require(_0x3a55('0x0'));var util=require(_0x3a55('0x1'));var moment=require(_0x3a55('0x2'));var BPromise=require(_0x3a55('0x3'));var rs=require(_0x3a55('0x4'));var fs=require('fs');var Redis=require(_0x3a55('0x5'));var db=require(_0x3a55('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a55('0x7'))(_0x3a55('0x8'));var config=require(_0x3a55('0x9'));var jayson=require(_0x3a55('0xa'));var client=jayson[_0x3a55('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fd97a,_0x657a8c,_0x17a451){return new BPromise(function(_0x218ccb,_0xc52f53){return client['request'](_0x4fd97a,_0x17a451)['then'](function(_0x335ea5){logger[_0x3a55('0xc')](_0x3a55('0xd'),_0x657a8c,'request\x20sent');logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x657a8c,_0x3a55('0xe'),JSON[_0x3a55('0xf')](_0x335ea5));if(_0x335ea5[_0x3a55('0x10')]){if(_0x335ea5[_0x3a55('0x10')][_0x3a55('0x11')]===0x1f4){logger[_0x3a55('0x10')](_0x3a55('0xd'),_0x657a8c,_0x335ea5[_0x3a55('0x10')][_0x3a55('0x12')]);return _0xc52f53(_0x335ea5[_0x3a55('0x10')][_0x3a55('0x12')]);}logger[_0x3a55('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x657a8c,_0x335ea5['error'][_0x3a55('0x12')]);return _0x218ccb(_0x335ea5[_0x3a55('0x10')][_0x3a55('0x12')]);}else{logger[_0x3a55('0xc')](_0x3a55('0xd'),_0x657a8c,_0x3a55('0xe'));_0x218ccb(_0x335ea5[_0x3a55('0x13')][_0x3a55('0x12')]);}})[_0x3a55('0x14')](function(_0xc0e0c0){logger[_0x3a55('0x10')](_0x3a55('0xd'),_0x657a8c,_0xc0e0c0);_0xc52f53(_0xc0e0c0);});});}exports[_0x3a55('0x15')]=function(_0x335747){var _0x3914cf=this;return new Promise(function(_0x510702,_0x5a7f29){return db[_0x3a55('0x16')][_0x3a55('0x17')](_0x335747['body'],{'raw':_0x335747[_0x3a55('0x18')]?_0x335747[_0x3a55('0x18')][_0x3a55('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5d14c9){logger[_0x3a55('0xc')](_0x3a55('0x15'),_0x335747);logger[_0x3a55('0x1a')](_0x3a55('0x15'),_0x335747,JSON[_0x3a55('0xf')](_0x5d14c9));_0x510702(_0x5d14c9);})[_0x3a55('0x14')](function(_0x3110fc){logger[_0x3a55('0x10')](_0x3a55('0x15'),_0x3110fc['message'],_0x335747);_0x5a7f29(_0x3914cf[_0x3a55('0x10')](0x1f4,_0x3110fc[_0x3a55('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e84a9d7..7ed2f77 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 _0x7b05=['exports','express','Router','../../components/auth/service','./webbar.controller','/originate','canUpdate','originate','post','/hangup','isAuthenticated','hangup','/answer','unhold','/calls','calls','/transfer','transfer'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x7b05,0x91));var _0x57b0=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0x7b05[_0x279368];return _0x40b6d0;};'use strict';var express=require(_0x57b0('0x0'));var router=express[_0x57b0('0x1')]();var auth=require(_0x57b0('0x2'));var controller=require(_0x57b0('0x3'));router['post'](_0x57b0('0x4'),auth['isAuthenticated'](),auth[_0x57b0('0x5')](),controller[_0x57b0('0x6')]);router[_0x57b0('0x7')](_0x57b0('0x8'),auth[_0x57b0('0x9')](),auth['canUpdate'](),controller[_0x57b0('0xa')]);router['post'](_0x57b0('0xb'),auth[_0x57b0('0x9')](),auth['canUpdate'](),controller['answer']);router['post']('/hold',auth[_0x57b0('0x9')](),auth[_0x57b0('0x5')](),controller['hold']);router['post']('/unhold',auth[_0x57b0('0x9')](),auth[_0x57b0('0x5')](),controller[_0x57b0('0xc')]);router[_0x57b0('0x7')](_0x57b0('0xd'),auth[_0x57b0('0x9')](),auth['canUpdate'](),controller[_0x57b0('0xe')]);router[_0x57b0('0x7')](_0x57b0('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x57b0('0x10')]);module[_0x57b0('0x11')]=router; \ No newline at end of file +var _0x385b=['unhold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold'];(function(_0x38db30,_0x287f7d){var _0x423776=function(_0x3e6d3e){while(--_0x3e6d3e){_0x38db30['push'](_0x38db30['shift']());}};_0x423776(++_0x287f7d);}(_0x385b,0x1a7));var _0xb385=function(_0x1e8ac9,_0x1bd0fe){_0x1e8ac9=_0x1e8ac9-0x0;var _0x4c895c=_0x385b[_0x1e8ac9];return _0x4c895c;};'use strict';var express=require('express');var router=express[_0xb385('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xb385('0x1'));router[_0xb385('0x2')](_0xb385('0x3'),auth[_0xb385('0x4')](),auth['canUpdate'](),controller[_0xb385('0x5')]);router[_0xb385('0x2')](_0xb385('0x6'),auth[_0xb385('0x4')](),auth[_0xb385('0x7')](),controller[_0xb385('0x8')]);router[_0xb385('0x2')](_0xb385('0x9'),auth['isAuthenticated'](),auth[_0xb385('0x7')](),controller[_0xb385('0xa')]);router[_0xb385('0x2')](_0xb385('0xb'),auth['isAuthenticated'](),auth[_0xb385('0x7')](),controller[_0xb385('0xc')]);router['post'](_0xb385('0xd'),auth[_0xb385('0x4')](),auth[_0xb385('0x7')](),controller[_0xb385('0xe')]);router[_0xb385('0x2')](_0xb385('0xf'),auth['isAuthenticated'](),auth[_0xb385('0x7')](),controller['calls']);router['post'](_0xb385('0x10'),auth['isAuthenticated'](),auth[_0xb385('0x7')](),controller[_0xb385('0x11')]);module[_0xb385('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index fb4822c..6ca2bd3 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 _0xe148=['catch','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold\x20fired:','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','webbar:conference','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','client','http','../../config/logger','webbarapi','redis','localhost','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','stringify','handleError:','error','stack','name','status','send','request','code','message'];(function(_0x4cda63,_0x16ad47){var _0x3e4fd3=function(_0x193096){while(--_0x193096){_0x4cda63['push'](_0x4cda63['shift']());}};_0x3e4fd3(++_0x16ad47);}(_0xe148,0x109));var _0x8e14=function(_0x47888a,_0x7d2f3a){_0x47888a=_0x47888a-0x0;var _0x2b15a4=_0xe148[_0x47888a];return _0x2b15a4;};'use strict';var path=require(_0x8e14('0x0'));var fs=require('fs');var _=require(_0x8e14('0x1'));var db=require(_0x8e14('0x2'))['db'];var config=require(_0x8e14('0x3'));var util=require(_0x8e14('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x8e14('0x5')][_0x8e14('0x6')]({'port':0x232a});var logger=require(_0x8e14('0x7'))(_0x8e14('0x8'));var Redis=require('ioredis');config['redis']=_['defaults'](config[_0x8e14('0x9')],{'host':_0x8e14('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x8e14('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8e14('0xc')]},'callNumber':{'type':_0x8e14('0xd'),'required':[!![],_0x8e14('0xe')]},'callerId':{'type':_0x8e14('0xd')},'callbackUrl':{'type':_0x8e14('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x8e14('0xf'),'required':[!![],_0x8e14('0xc')]},'sessionId':{'type':_0x8e14('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8e14('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8e14('0xf'),'required':[!![],_0x8e14('0xc')]},'sessionId':{'type':_0x8e14('0xd'),'required':[!![],_0x8e14('0x10')]},'transferNumber':{'type':_0x8e14('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8e14('0xf'),'required':[!![],_0x8e14('0xc')]},'sessionId':{'type':_0x8e14('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8e14('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8e14('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8e14('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8e14('0xf'),'required':[!![],_0x8e14('0xc')]}});function emit(_0x358f5c,_0x23fb01,_0x4d2b32){logger['info'](_0x358f5c,_0x23fb01,JSON[_0x8e14('0x11')](_0x4d2b32));io['to'](_0x358f5c)['emit'](_0x23fb01,_0x4d2b32);}function handleError(_0x30b04d){return function(_0x55b9ed){console['log'](_0x8e14('0x12'),_0x55b9ed,_0x55b9ed instanceof RangeError);logger[_0x8e14('0x13')](_0x55b9ed[_0x8e14('0x14')]);if(_0x55b9ed instanceof RangeError){if(_0x55b9ed[_0x8e14('0x15')]){delete _0x55b9ed['name'];}_0x30b04d[_0x8e14('0x16')](0x194)[_0x8e14('0x17')](_0x55b9ed);}else{if(_0x55b9ed[_0x8e14('0x15')]){delete _0x55b9ed['name'];}_0x30b04d['status'](0x1f4)['send'](_0x55b9ed);}};}function checkError(){return function(_0x6fb2db){if(!_0x6fb2db){throw new RangeError('NotFound');}return _0x6fb2db;};}function respondWithRpcPromise(_0x5c1a8c,_0xa8ff17){return new BPromise(function(_0x20a98f,_0x463a3c){var _0x21727d=amiClient;return _0x21727d[_0x8e14('0x18')](_0x5c1a8c,_0xa8ff17)['then'](function(_0x57180a){if(_0x57180a[_0x8e14('0x13')]){if(_0x57180a[_0x8e14('0x13')][_0x8e14('0x19')]===0x1f4){return _0x463a3c(_0x57180a[_0x8e14('0x13')][_0x8e14('0x1a')]);}return _0x20a98f(_0x57180a[_0x8e14('0x13')][_0x8e14('0x1a')]);}else{_0x20a98f(_0x57180a['result']);}})[_0x8e14('0x1b')](function(_0xff90ed){_0x463a3c(_0xff90ed);});});}function getAgent(_0x33d570){return db['User'][_0x8e14('0x1c')]({'where':{'id':_0x33d570,'role':_0x8e14('0x1d')}})[_0x8e14('0x1e')](checkError());}function getAgentCheckSession(_0x2aacb6,_0x96c66d){return new BPromise(function(_0x5e7fd8,_0x59ac09){var _0x2ad642=respondWithRpcPromise(_0x8e14('0x1f'));var _0x543d6a=getAgent(_0x2aacb6);Promise[_0x8e14('0x20')]([_0x2ad642,_0x543d6a])[_0x8e14('0x1e')](function(_0x5e0217){var _0x563249=_0x5e0217[0x0];var _0x27a14e=_0x5e0217[0x1];var _0x54ead0=_[_0x8e14('0x21')](_0x563249[_0x8e14('0x22')],function(_0x312f42){return _0x312f42[_0x8e14('0x23')]==_0x27a14e['id']&&_0x312f42[_0x8e14('0x24')]==_0x96c66d;});if(_0x54ead0[_0x8e14('0x25')]==0x1){_0x5e7fd8(_0x27a14e);}else{_0x59ac09(new RangeError(_0x8e14('0x26')+_0x96c66d+_0x8e14('0x27')));}});});}exports[_0x8e14('0x28')]=function(_0x41f3ab,_0x1f046e){logger[_0x8e14('0x29')](_0x8e14('0x2a'),_0x41f3ab[_0x8e14('0x2b')]);var _0x1462b8=originateValidation[_0x8e14('0xb')](_0x41f3ab['body']);if(_0x1462b8[_0x8e14('0x25')]>0x0){return _0x1f046e[_0x8e14('0x16')](0x190)['json'](_0x1462b8);}var _0x40d235=_0x41f3ab[_0x8e14('0x2b')][_0x8e14('0x2c')];var _0x35cca5=_0x41f3ab[_0x8e14('0x2b')][_0x8e14('0x2d')];var _0x1503d8=_0x41f3ab['body'][_0x8e14('0x2e')];var _0x196762=_0x41f3ab['body'][_0x8e14('0x2f')];return getAgent(_0x40d235)['then'](function(_0x196714){logger['info'](_0x8e14('0x30'),_0x196714[_0x8e14('0x15')]);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0x196714[_0x8e14('0x15')]),_0x8e14('0x33'),{'callNumber':_0x35cca5,'callerId':_0x1503d8,'callbackUrl':_0x196762});return _0x1f046e[_0x8e14('0x16')](0xc8)[_0x8e14('0x34')]({'error':![],'message':_0x8e14('0x35')});})[_0x8e14('0x1b')](handleError(_0x1f046e));};exports['hangup']=function(_0x3aae16,_0x49dfd4){logger[_0x8e14('0x29')](_0x8e14('0x36'),_0x3aae16[_0x8e14('0x2b')]);var _0x23d577=hangupValidation[_0x8e14('0xb')](_0x3aae16[_0x8e14('0x2b')]);if(_0x23d577[_0x8e14('0x25')]>0x0){return _0x49dfd4[_0x8e14('0x16')](0x190)['json'](_0x23d577);}var _0x82c255=_0x3aae16[_0x8e14('0x2b')][_0x8e14('0x2c')];var _0x59182b=_0x3aae16[_0x8e14('0x2b')][_0x8e14('0x24')];return getAgent(_0x82c255)[_0x8e14('0x1e')](function(_0x48d55a){logger['info'](_0x8e14('0x30'),_0x48d55a[_0x8e14('0x15')]);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0x48d55a[_0x8e14('0x15')]),_0x8e14('0x37'),{'sessionId':_0x59182b});return _0x49dfd4['status'](0xc8)[_0x8e14('0x34')]({'error':![],'message':_0x8e14('0x38')});})[_0x8e14('0x1b')](handleError(_0x49dfd4));};exports[_0x8e14('0x39')]=function(_0x5141fa,_0x19ae93){logger[_0x8e14('0x29')]('answer\x20fired:',_0x5141fa[_0x8e14('0x2b')]);var _0x57522d=answerValidation[_0x8e14('0xb')](_0x5141fa[_0x8e14('0x2b')]);if(_0x57522d[_0x8e14('0x25')]>0x0){return _0x19ae93['status'](0x190)[_0x8e14('0x34')](_0x57522d);}var _0x2c286b=_0x5141fa['body'][_0x8e14('0x2c')];var _0x499376=_0x5141fa['body']['sessionId'];return getAgent(_0x2c286b)[_0x8e14('0x1e')](function(_0x52687c){logger[_0x8e14('0x29')](_0x8e14('0x30'),_0x52687c[_0x8e14('0x15')]);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0x52687c[_0x8e14('0x15')]),_0x8e14('0x3a'),{'sessionId':_0x499376});return _0x19ae93[_0x8e14('0x16')](0xc8)[_0x8e14('0x34')]({'error':![],'message':_0x8e14('0x3b')});})[_0x8e14('0x1b')](handleError(_0x19ae93));};exports['hold']=function(_0x27ef66,_0x527ac4){logger[_0x8e14('0x29')](_0x8e14('0x3c'),_0x27ef66[_0x8e14('0x2b')]);var _0x5de787=holdValidation['validate'](_0x27ef66[_0x8e14('0x2b')]);if(_0x5de787[_0x8e14('0x25')]>0x0){return _0x527ac4[_0x8e14('0x16')](0x190)['json'](_0x5de787);}var _0x1bd45c=_0x27ef66['body'][_0x8e14('0x2c')];var _0x1c7de0=_0x27ef66[_0x8e14('0x2b')]['sessionId'];return getAgent(_0x1bd45c)[_0x8e14('0x1e')](function(_0xd7b5f4){logger[_0x8e14('0x29')]('entityFound:',_0xd7b5f4[_0x8e14('0x15')]);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0xd7b5f4['name']),'webbar:hold',{'sessionId':_0x1c7de0});return _0x527ac4['status'](0xc8)[_0x8e14('0x34')]({'error':![],'message':'hold\x20executed!'});})[_0x8e14('0x1b')](handleError(_0x527ac4));};exports[_0x8e14('0x3d')]=function(_0x732bb9,_0x59610f){logger['info'](_0x8e14('0x3e'),_0x732bb9[_0x8e14('0x2b')]);var _0x522080=unholdValidation[_0x8e14('0xb')](_0x732bb9[_0x8e14('0x2b')]);if(_0x522080[_0x8e14('0x25')]>0x0){return _0x59610f[_0x8e14('0x16')](0x190)[_0x8e14('0x34')](_0x522080);}var _0x43b989=_0x732bb9['body'][_0x8e14('0x2c')];var _0x146828=_0x732bb9[_0x8e14('0x2b')][_0x8e14('0x24')];return getAgent(_0x43b989)[_0x8e14('0x1e')](function(_0xcd37b4){logger[_0x8e14('0x29')](_0x8e14('0x30'),_0xcd37b4[_0x8e14('0x15')]);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0xcd37b4[_0x8e14('0x15')]),_0x8e14('0x3f'),{'sessionId':_0x146828});return _0x59610f[_0x8e14('0x16')](0xc8)[_0x8e14('0x34')]({'error':![],'message':_0x8e14('0x40')});})['catch'](handleError(_0x59610f));};exports[_0x8e14('0x41')]=function(_0x45f6d8,_0x5b0065){logger['info'](_0x8e14('0x42'),_0x5b0065[_0x8e14('0x2b')]);var _0x4fb4a3=callsValidation['validate'](_0x45f6d8['body']);if(_0x4fb4a3[_0x8e14('0x25')]>0x0){return _0x5b0065['status'](0x190)['json'](_0x4fb4a3);}var _0xf2937d=_0x45f6d8[_0x8e14('0x2b')]['userId'];var _0x5ab25f=respondWithRpcPromise(_0x8e14('0x1f'));var _0x5d8c2f=getAgent(_0xf2937d);return Promise['all']([_0x5ab25f,_0x5d8c2f])[_0x8e14('0x1e')](function(_0xade0c5){var _0x14dabd=_0xade0c5[0x0];var _0x55b2aa=_0xade0c5[0x1];var _0x2cc142=_[_0x8e14('0x21')](_0x14dabd[_0x8e14('0x22')],function(_0x2d7146){return _0x2d7146['UserId']==_0x55b2aa['id'];});return _0x5b0065[_0x8e14('0x16')](0xc8)[_0x8e14('0x34')]({'count':_0x2cc142[_0x8e14('0x25')],'rows':_0x2cc142});})[_0x8e14('0x1b')](handleError(_0x5b0065));};exports[_0x8e14('0x43')]=function(_0x4eaaf4,_0x424589){logger[_0x8e14('0x29')]('conference\x20fired:',_0x4eaaf4[_0x8e14('0x2b')]);var _0x2c6274=conferenceValidation[_0x8e14('0xb')](_0x4eaaf4[_0x8e14('0x2b')]);if(_0x2c6274[_0x8e14('0x25')]>0x0){return _0x424589['status'](0x190)[_0x8e14('0x34')](_0x2c6274);}var _0x2d4118=_0x4eaaf4[_0x8e14('0x2b')][_0x8e14('0x2c')];return getAgent(_0x2d4118)[_0x8e14('0x1e')](function(_0x1fc479){logger[_0x8e14('0x29')](_0x8e14('0x30'),_0x1fc479['name']);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0x1fc479[_0x8e14('0x15')]),_0x8e14('0x44'));return _0x424589[_0x8e14('0x16')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x8e14('0x1b')](handleError(_0x424589));};exports[_0x8e14('0x45')]=function(_0x1a3a08,_0x1227bf){logger[_0x8e14('0x29')](_0x8e14('0x46'),_0x1a3a08[_0x8e14('0x2b')]);var _0x2903c2=transferValidation[_0x8e14('0xb')](_0x1a3a08['body']);if(_0x2903c2['length']>0x0){return _0x1227bf[_0x8e14('0x16')](0x190)['json'](_0x2903c2);}var _0x4b551d=_0x1a3a08[_0x8e14('0x2b')][_0x8e14('0x2c')];var _0x26f5f8=_0x1a3a08[_0x8e14('0x2b')][_0x8e14('0x24')];var _0x5e6191=_0x1a3a08[_0x8e14('0x2b')]['transferNumber'];return getAgent(_0x4b551d)[_0x8e14('0x1e')](function(_0x3595a6){logger[_0x8e14('0x29')](_0x8e14('0x30'),_0x3595a6['name']);emit(util[_0x8e14('0x31')](_0x8e14('0x32'),_0x3595a6[_0x8e14('0x15')]),_0x8e14('0x47'),{'sessionId':_0x26f5f8,'transferNumber':_0x5e6191});return _0x1227bf[_0x8e14('0x16')](0xc8)[_0x8e14('0x34')]({'error':![],'message':_0x8e14('0x48')});})[_0x8e14('0x1b')](handleError(_0x1227bf));}; \ No newline at end of file +var _0xe027=['code','message','result','catch','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','originate','info','originate\x20fired:','body','callNumber','callbackUrl','entityFound:','format','user:%s','status','json','hangup','hangup\x20fired:','hangup\x20executed!','answer\x20fired:','length','userId','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','webbar:unhold','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','redis','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','stringify','handleError:','error','stack','name','send','NotFound','then'];(function(_0x49d78d,_0x4fa52a){var _0x2ecbc3=function(_0x53f0e7){while(--_0x53f0e7){_0x49d78d['push'](_0x49d78d['shift']());}};_0x2ecbc3(++_0x4fa52a);}(_0xe027,0xf9));var _0x7e02=function(_0x2a4b52,_0x13904a){_0x2a4b52=_0x2a4b52-0x0;var _0x3e27d4=_0xe027[_0x2a4b52];return _0x3e27d4;};'use strict';var path=require(_0x7e02('0x0'));var fs=require('fs');var _=require(_0x7e02('0x1'));var db=require(_0x7e02('0x2'))['db'];var config=require(_0x7e02('0x3'));var util=require('util');var BPromise=require(_0x7e02('0x4'));var jayson=require(_0x7e02('0x5'));var amiClient=jayson['client'][_0x7e02('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x7e02('0x7')]=_['defaults'](config[_0x7e02('0x7')],{'host':_0x7e02('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7e02('0x7')]));var Schema=require(_0x7e02('0x9'));var originateValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],_0x7e02('0xb')]},'callNumber':{'type':_0x7e02('0xc'),'required':[!![],_0x7e02('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7e02('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x7e02('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],_0x7e02('0xb')]},'sessionId':{'type':_0x7e02('0xc'),'required':[!![],_0x7e02('0xe')]},'transferNumber':{'type':_0x7e02('0xc'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],_0x7e02('0xb')]},'sessionId':{'type':_0x7e02('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7e02('0xb')]},'sessionId':{'type':_0x7e02('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],_0x7e02('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7e02('0xa'),'required':[!![],_0x7e02('0xb')]}});function emit(_0x237b4d,_0xe1bea6,_0x4f268f){logger['info'](_0x237b4d,_0xe1bea6,JSON[_0x7e02('0xf')](_0x4f268f));io['to'](_0x237b4d)['emit'](_0xe1bea6,_0x4f268f);}function handleError(_0x1e0660){return function(_0x478233){console['log'](_0x7e02('0x10'),_0x478233,_0x478233 instanceof RangeError);logger[_0x7e02('0x11')](_0x478233[_0x7e02('0x12')]);if(_0x478233 instanceof RangeError){if(_0x478233[_0x7e02('0x13')]){delete _0x478233[_0x7e02('0x13')];}_0x1e0660['status'](0x194)[_0x7e02('0x14')](_0x478233);}else{if(_0x478233[_0x7e02('0x13')]){delete _0x478233[_0x7e02('0x13')];}_0x1e0660['status'](0x1f4)[_0x7e02('0x14')](_0x478233);}};}function checkError(){return function(_0x47c0da){if(!_0x47c0da){throw new RangeError(_0x7e02('0x15'));}return _0x47c0da;};}function respondWithRpcPromise(_0x35b446,_0x56b77b){return new BPromise(function(_0x900567,_0x177b81){var _0x494695=amiClient;return _0x494695['request'](_0x35b446,_0x56b77b)[_0x7e02('0x16')](function(_0x4d1cfe){if(_0x4d1cfe[_0x7e02('0x11')]){if(_0x4d1cfe[_0x7e02('0x11')][_0x7e02('0x17')]===0x1f4){return _0x177b81(_0x4d1cfe[_0x7e02('0x11')][_0x7e02('0x18')]);}return _0x900567(_0x4d1cfe[_0x7e02('0x11')][_0x7e02('0x18')]);}else{_0x900567(_0x4d1cfe[_0x7e02('0x19')]);}})[_0x7e02('0x1a')](function(_0x2d16d3){_0x177b81(_0x2d16d3);});});}function getAgent(_0x116679){return db['User']['findOne']({'where':{'id':_0x116679,'role':'agent'}})[_0x7e02('0x16')](checkError());}function getAgentCheckSession(_0x4cd689,_0x21c83c){return new BPromise(function(_0x42b0f1,_0x455f96){var _0x5858e8=respondWithRpcPromise(_0x7e02('0x1b'));var _0x3bb8a1=getAgent(_0x4cd689);Promise[_0x7e02('0x1c')]([_0x5858e8,_0x3bb8a1])[_0x7e02('0x16')](function(_0x1f07a3){var _0x198ad2=_0x1f07a3[0x0];var _0xef3bd=_0x1f07a3[0x1];var _0x5f5c0f=_[_0x7e02('0x1d')](_0x198ad2[_0x7e02('0x1e')],function(_0x221c1b){return _0x221c1b[_0x7e02('0x1f')]==_0xef3bd['id']&&_0x221c1b[_0x7e02('0x20')]==_0x21c83c;});if(_0x5f5c0f['length']==0x1){_0x42b0f1(_0xef3bd);}else{_0x455f96(new RangeError(_0x7e02('0x21')+_0x21c83c+'\x20not\x20found!'));}});});}exports[_0x7e02('0x22')]=function(_0x15398e,_0x536a68){logger[_0x7e02('0x23')](_0x7e02('0x24'),_0x15398e[_0x7e02('0x25')]);var _0x456296=originateValidation[_0x7e02('0x9')](_0x15398e[_0x7e02('0x25')]);if(_0x456296['length']>0x0){return _0x536a68['status'](0x190)['json'](_0x456296);}var _0xc37473=_0x15398e[_0x7e02('0x25')]['userId'];var _0x239c20=_0x15398e[_0x7e02('0x25')][_0x7e02('0x26')];var _0x4376bb=_0x15398e[_0x7e02('0x25')]['callerId'];var _0x22c6a0=_0x15398e[_0x7e02('0x25')][_0x7e02('0x27')];return getAgent(_0xc37473)[_0x7e02('0x16')](function(_0x29faec){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0x29faec['name']);emit(util[_0x7e02('0x29')](_0x7e02('0x2a'),_0x29faec[_0x7e02('0x13')]),'webbar:originate',{'callNumber':_0x239c20,'callerId':_0x4376bb,'callbackUrl':_0x22c6a0});return _0x536a68[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'error':![],'message':'originate\x20executed!'});})[_0x7e02('0x1a')](handleError(_0x536a68));};exports[_0x7e02('0x2d')]=function(_0x598fad,_0x3d42e6){logger['info'](_0x7e02('0x2e'),_0x598fad[_0x7e02('0x25')]);var _0x244355=hangupValidation[_0x7e02('0x9')](_0x598fad[_0x7e02('0x25')]);if(_0x244355['length']>0x0){return _0x3d42e6['status'](0x190)[_0x7e02('0x2c')](_0x244355);}var _0x42dbf1=_0x598fad[_0x7e02('0x25')]['userId'];var _0x776bd1=_0x598fad['body'][_0x7e02('0x20')];return getAgent(_0x42dbf1)[_0x7e02('0x16')](function(_0x5eb4b7){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0x5eb4b7[_0x7e02('0x13')]);emit(util['format'](_0x7e02('0x2a'),_0x5eb4b7[_0x7e02('0x13')]),'webbar:hangup',{'sessionId':_0x776bd1});return _0x3d42e6[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'error':![],'message':_0x7e02('0x2f')});})[_0x7e02('0x1a')](handleError(_0x3d42e6));};exports['answer']=function(_0x3897f4,_0x3a5358){logger[_0x7e02('0x23')](_0x7e02('0x30'),_0x3897f4[_0x7e02('0x25')]);var _0x13b197=answerValidation[_0x7e02('0x9')](_0x3897f4[_0x7e02('0x25')]);if(_0x13b197[_0x7e02('0x31')]>0x0){return _0x3a5358[_0x7e02('0x2b')](0x190)[_0x7e02('0x2c')](_0x13b197);}var _0x40204e=_0x3897f4[_0x7e02('0x25')][_0x7e02('0x32')];var _0x3b3936=_0x3897f4[_0x7e02('0x25')][_0x7e02('0x20')];return getAgent(_0x40204e)[_0x7e02('0x16')](function(_0x4304b5){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0x4304b5[_0x7e02('0x13')]);emit(util[_0x7e02('0x29')](_0x7e02('0x2a'),_0x4304b5[_0x7e02('0x13')]),_0x7e02('0x33'),{'sessionId':_0x3b3936});return _0x3a5358[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'error':![],'message':_0x7e02('0x34')});})[_0x7e02('0x1a')](handleError(_0x3a5358));};exports[_0x7e02('0x35')]=function(_0xfd7403,_0x27a440){logger['info'](_0x7e02('0x36'),_0xfd7403['body']);var _0x27e1d0=holdValidation[_0x7e02('0x9')](_0xfd7403[_0x7e02('0x25')]);if(_0x27e1d0['length']>0x0){return _0x27a440[_0x7e02('0x2b')](0x190)[_0x7e02('0x2c')](_0x27e1d0);}var _0xfda7ac=_0xfd7403[_0x7e02('0x25')][_0x7e02('0x32')];var _0x575a46=_0xfd7403[_0x7e02('0x25')]['sessionId'];return getAgent(_0xfda7ac)[_0x7e02('0x16')](function(_0x59556a){logger['info']('entityFound:',_0x59556a[_0x7e02('0x13')]);emit(util[_0x7e02('0x29')](_0x7e02('0x2a'),_0x59556a[_0x7e02('0x13')]),_0x7e02('0x37'),{'sessionId':_0x575a46});return _0x27a440[_0x7e02('0x2b')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x7e02('0x1a')](handleError(_0x27a440));};exports[_0x7e02('0x38')]=function(_0x5efb60,_0x2e4607){logger[_0x7e02('0x23')]('unhold\x20fired:',_0x5efb60[_0x7e02('0x25')]);var _0x3f1f26=unholdValidation['validate'](_0x5efb60[_0x7e02('0x25')]);if(_0x3f1f26[_0x7e02('0x31')]>0x0){return _0x2e4607[_0x7e02('0x2b')](0x190)['json'](_0x3f1f26);}var _0xf49ad0=_0x5efb60[_0x7e02('0x25')][_0x7e02('0x32')];var _0xf57b74=_0x5efb60['body'][_0x7e02('0x20')];return getAgent(_0xf49ad0)[_0x7e02('0x16')](function(_0x361b75){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0x361b75[_0x7e02('0x13')]);emit(util[_0x7e02('0x29')]('user:%s',_0x361b75['name']),_0x7e02('0x39'),{'sessionId':_0xf57b74});return _0x2e4607[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'error':![],'message':'unhold\x20executed!'});})[_0x7e02('0x1a')](handleError(_0x2e4607));};exports[_0x7e02('0x3a')]=function(_0x1f6b1e,_0xb543c5){logger[_0x7e02('0x23')]('calls\x20fired:',_0xb543c5['body']);var _0x2b67f5=callsValidation[_0x7e02('0x9')](_0x1f6b1e[_0x7e02('0x25')]);if(_0x2b67f5[_0x7e02('0x31')]>0x0){return _0xb543c5[_0x7e02('0x2b')](0x190)[_0x7e02('0x2c')](_0x2b67f5);}var _0x959862=_0x1f6b1e[_0x7e02('0x25')][_0x7e02('0x32')];var _0x2e68a0=respondWithRpcPromise(_0x7e02('0x1b'));var _0x48b2dd=getAgent(_0x959862);return Promise['all']([_0x2e68a0,_0x48b2dd])[_0x7e02('0x16')](function(_0x247991){var _0x41e902=_0x247991[0x0];var _0x144d0c=_0x247991[0x1];var _0x23e5e7=_[_0x7e02('0x1d')](_0x41e902[_0x7e02('0x1e')],function(_0x221caf){return _0x221caf['UserId']==_0x144d0c['id'];});return _0xb543c5[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'count':_0x23e5e7[_0x7e02('0x31')],'rows':_0x23e5e7});})[_0x7e02('0x1a')](handleError(_0xb543c5));};exports[_0x7e02('0x3b')]=function(_0x2bb448,_0x266732){logger[_0x7e02('0x23')](_0x7e02('0x3c'),_0x2bb448['body']);var _0x40c2ea=conferenceValidation[_0x7e02('0x9')](_0x2bb448[_0x7e02('0x25')]);if(_0x40c2ea[_0x7e02('0x31')]>0x0){return _0x266732[_0x7e02('0x2b')](0x190)[_0x7e02('0x2c')](_0x40c2ea);}var _0x55a880=_0x2bb448[_0x7e02('0x25')]['userId'];return getAgent(_0x55a880)['then'](function(_0xceaf1e){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0xceaf1e[_0x7e02('0x13')]);emit(util[_0x7e02('0x29')](_0x7e02('0x2a'),_0xceaf1e['name']),_0x7e02('0x3d'));return _0x266732['status'](0xc8)[_0x7e02('0x2c')]({'error':![],'message':_0x7e02('0x3e')});})[_0x7e02('0x1a')](handleError(_0x266732));};exports[_0x7e02('0x3f')]=function(_0x4dffe1,_0x27538c){logger[_0x7e02('0x23')](_0x7e02('0x40'),_0x4dffe1['body']);var _0x34bf60=transferValidation[_0x7e02('0x9')](_0x4dffe1[_0x7e02('0x25')]);if(_0x34bf60[_0x7e02('0x31')]>0x0){return _0x27538c[_0x7e02('0x2b')](0x190)[_0x7e02('0x2c')](_0x34bf60);}var _0x4474d2=_0x4dffe1[_0x7e02('0x25')][_0x7e02('0x32')];var _0x40d7b4=_0x4dffe1[_0x7e02('0x25')]['sessionId'];var _0x1d4d79=_0x4dffe1[_0x7e02('0x25')][_0x7e02('0x41')];return getAgent(_0x4474d2)[_0x7e02('0x16')](function(_0x52e6c3){logger[_0x7e02('0x23')](_0x7e02('0x28'),_0x52e6c3['name']);emit(util[_0x7e02('0x29')](_0x7e02('0x2a'),_0x52e6c3[_0x7e02('0x13')]),_0x7e02('0x42'),{'sessionId':_0x40d7b4,'transferNumber':_0x1d4d79});return _0x27538c[_0x7e02('0x2b')](0xc8)[_0x7e02('0x2c')]({'error':![],'message':_0x7e02('0x43')});})[_0x7e02('0x1a')](handleError(_0x27538c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7a12bfb..12bacda 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 _0x958a=['isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','getApplications','post','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','send','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller'];(function(_0x4474f6,_0x1535db){var _0x5225a7=function(_0x4917d5){while(--_0x4917d5){_0x4474f6['push'](_0x4474f6['shift']());}};_0x5225a7(++_0x1535db);}(_0x958a,0x128));var _0xa958=function(_0x534ee0,_0x3431ab){_0x534ee0=_0x534ee0-0x0;var _0x5f44a6=_0x958a[_0x534ee0];return _0x5f44a6;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var auth=require(_0xa958('0x5'));var interaction=require(_0xa958('0x6'));var config=require('../../config/environment');var controller=require(_0xa958('0x7'));router['get']('/',auth[_0xa958('0x8')](),controller[_0xa958('0x9')]);router[_0xa958('0xa')](_0xa958('0xb'),auth[_0xa958('0x8')](),controller[_0xa958('0xc')]);router[_0xa958('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa958('0xd')]);router[_0xa958('0xa')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller[_0xa958('0xf')]);router[_0xa958('0xa')](_0xa958('0x10'),auth[_0xa958('0x8')](),controller[_0xa958('0x11')]);router[_0xa958('0xa')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x13')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xa958('0x14')]);router[_0xa958('0x15')]('/',auth[_0xa958('0x8')](),controller['create']);router[_0xa958('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xa958('0x15')](_0xa958('0x10'),auth[_0xa958('0x8')](),controller[_0xa958('0x16')]);router[_0xa958('0x15')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x17')]);router['post'](_0xa958('0x18'),auth['isAuthenticated'](),controller[_0xa958('0x19')]);router[_0xa958('0x15')]('/:id/notify',controller[_0xa958('0x1a')]);router[_0xa958('0x15')](_0xa958('0x1b'),auth[_0xa958('0x8')](),controller[_0xa958('0x1c')]);router[_0xa958('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xa958('0x1e')]);router[_0xa958('0x1f')](_0xa958('0x20'),auth['isAuthenticated'](),controller[_0xa958('0x21')]);router[_0xa958('0x1f')]('/:id/dispositions',auth[_0xa958('0x8')](),controller[_0xa958('0x22')]);router['delete']('/:id/canned_answers',auth[_0xa958('0x8')](),controller[_0xa958('0x23')]);router['delete'](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x24')]);module[_0xa958('0x25')]=router; \ No newline at end of file +var _0x4fc2=['addDisposition','/:id/users','addAgents','addApplications','/:id/notify','/:id/send','put','update','destroy','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','/:id/applications','getApplications','post','create'];(function(_0x2e50a2,_0x27f31e){var _0x47e5de=function(_0x4e1f70){while(--_0x4e1f70){_0x2e50a2['push'](_0x2e50a2['shift']());}};_0x47e5de(++_0x27f31e);}(_0x4fc2,0x111));var _0x24fc=function(_0x1374be,_0x4f45b6){_0x1374be=_0x1374be-0x0;var _0x32ff99=_0x4fc2[_0x1374be];return _0x32ff99;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x8')](_0x24fc('0x10'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x8')]('/:id/users',auth[_0x24fc('0xa')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x16')]);router['post'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);router[_0x24fc('0x15')]('/:id/canned_answers',auth[_0x24fc('0xa')](),controller['addAnswer']);router[_0x24fc('0x15')](_0x24fc('0x18'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x19')]);router[_0x24fc('0x15')]('/:id/applications',auth[_0x24fc('0xa')](),controller[_0x24fc('0x1a')]);router[_0x24fc('0x15')](_0x24fc('0x1b'),controller['notify']);router[_0x24fc('0x15')](_0x24fc('0x1c'),auth[_0x24fc('0xa')](),controller['send']);router[_0x24fc('0x1d')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x1e')]);router['delete'](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x1f')]);router['delete'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x10'),auth['isAuthenticated'](),controller[_0x24fc('0x21')]);router[_0x24fc('0x22')](_0x24fc('0x18'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x23')]);module[_0x24fc('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d2fcfc1..43c915a 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 _0x0944=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','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'];(function(_0x1e920c,_0x2e73de){var _0x347799=function(_0x2a9db6){while(--_0x2a9db6){_0x1e920c['push'](_0x1e920c['shift']());}};_0x347799(++_0x2e73de);}(_0x0944,0x1b7));var _0x4094=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x0944[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0x4094('0x0'));var rs=require('randomstring');module[_0x4094('0x1')]={'name':{'type':Sequelize[_0x4094('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4094('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x4094('0x2')],'defaultValue':function(){return rs[_0x4094('0x3')]();}},'phone':{'type':Sequelize[_0x4094('0x2')]},'type':{'type':Sequelize[_0x4094('0x4')](_0x4094('0x5'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x4094('0x2')]},'notificationTemplate':{'type':Sequelize[_0x4094('0x6')],'defaultValue':function(){return _0x4094('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x4094('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4094('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4094('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4094('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x4094('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4094('0xb'),'set':function(_0x228801){if(!_0x228801){this[_0x4094('0xc')](_0x4094('0xd'),null);}this[_0x4094('0xc')](_0x4094('0xe'),_0x228801);}},'description':{'type':Sequelize[_0x4094('0x2')]}}; \ No newline at end of file +var _0xd54c=['twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','randomstring','exports','STRING','name','generate','ENUM'];(function(_0x553145,_0x4f9ab8){var _0x11cfbd=function(_0x2e7702){while(--_0x2e7702){_0x553145['push'](_0x553145['shift']());}};_0x11cfbd(++_0x4f9ab8);}(_0xd54c,0x1c2));var _0xcd54=function(_0x343c8c,_0xad2cbd){_0x343c8c=_0x343c8c-0x0;var _0x4d0bf5=_0xd54c[_0x343c8c];return _0x4d0bf5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcd54('0x0'));module[_0xcd54('0x1')]={'name':{'type':Sequelize[_0xcd54('0x2')],'unique':_0xcd54('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xcd54('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xcd54('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xcd54('0x2')],'defaultValue':function(){return rs[_0xcd54('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xcd54('0x5')](_0xcd54('0x6'))},'accountSid':{'type':Sequelize[_0xcd54('0x2')]},'authToken':{'type':Sequelize[_0xcd54('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcd54('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcd54('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcd54('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcd54('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcd54('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcd54('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcd54('0x8')],'comment':_0xcd54('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xcd54('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2297cf){if(!_0x2297cf){this[_0xcd54('0xb')]('mandatoryDispositionPauseId',null);}this[_0xcd54('0xb')]('mandatoryDisposition',_0x2297cf);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index a995b8b..73a91a0 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 _0x743a=['push','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','send','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','count','offset','limit','set','Content-Range','reject','then','destroy','WhatsappAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','merge','WhatsappAccount','includeAll','include','findAll','rows','show','keys','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','find','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','account','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','WhatsappInteraction','spread','interaction','autoclose','applications'];(function(_0x311185,_0x2f990b){var _0x27cad3=function(_0xe0119e){while(--_0xe0119e){_0x311185['push'](_0x311185['shift']());}};_0x27cad3(++_0x2f990b);}(_0x743a,0xd2));var _0xa743=function(_0x10788b,_0x292525){_0x10788b=_0x10788b-0x0;var _0x217af2=_0x743a[_0x10788b];return _0x217af2;};'use strict';var pdf=require(_0xa743('0x0'));var emlformat=require(_0xa743('0x1'));var rimraf=require(_0xa743('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa743('0x3'));var moment=require(_0xa743('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa743('0x5'));var util=require('util');var path=require(_0xa743('0x6'));var sox=require(_0xa743('0x7'));var csv=require(_0xa743('0x8'));var ejs=require(_0xa743('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa743('0xa'));var crypto=require(_0xa743('0xb'));var jsforce=require(_0xa743('0xc'));var deskjs=require(_0xa743('0xd'));var toCsv=require(_0xa743('0x8'));var querystring=require(_0xa743('0xe'));var Papa=require(_0xa743('0xf'));var Redis=require(_0xa743('0x10'));var authService=require(_0xa743('0x11'));var qs=require(_0xa743('0x12'));var as=require(_0xa743('0x13'));var hardwareService=require(_0xa743('0x14'));var logger=require('../../config/logger')(_0xa743('0x15'));var utils=require(_0xa743('0x16'));var config=require(_0xa743('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa743('0x18'))['db'];config[_0xa743('0x19')]=_[_0xa743('0x1a')](config[_0xa743('0x19')],{'host':_0xa743('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa743('0x19')]));require(_0xa743('0x1c'))[_0xa743('0x1d')](socket);var jayson=require(_0xa743('0x1e'));var client=jayson[_0xa743('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x1e2ce7,_0x8f7ae,_0x52a2d1,_0x32f009){return new BPromise(function(_0x36e744,_0x3a0b27){var _0x3a8430=_0x32f009||client;return _0x3a8430[_0xa743('0x20')](_0x1e2ce7,_0x52a2d1)['then'](function(_0x1f94a8){logger['info'](_0xa743('0x21'),_0x8f7ae,_0xa743('0x22'));logger[_0xa743('0x23')](_0xa743('0x24'),_0x8f7ae,'request\x20sent',JSON[_0xa743('0x25')](_0x1f94a8));if(_0x1f94a8['error']){if(_0x1f94a8[_0xa743('0x26')][_0xa743('0x27')]===0x1f4){logger[_0xa743('0x26')](_0xa743('0x21'),_0x8f7ae,_0x1f94a8[_0xa743('0x26')][_0xa743('0x28')]);return _0x3a0b27(_0x1f94a8[_0xa743('0x26')][_0xa743('0x28')]);}logger['error'](_0xa743('0x21'),_0x8f7ae,_0x1f94a8[_0xa743('0x26')]['message']);return _0x36e744(_0x1f94a8[_0xa743('0x26')]['message']);}else{logger[_0xa743('0x29')]('WhatsappAccount,\x20%s,\x20%s',_0x8f7ae,_0xa743('0x22'));_0x36e744(_0x1f94a8[_0xa743('0x2a')]['message']);}})[_0xa743('0x2b')](function(_0x158237){logger['error'](_0xa743('0x21'),_0x8f7ae,_0x158237);_0x3a0b27(_0x158237);});});}function respondWithStatusCode(_0x1e3586,_0x160beb){_0x160beb=_0x160beb||0xcc;return function(_0x2d3364){if(_0x2d3364){return _0x1e3586['sendStatus'](_0x160beb);}return _0x1e3586[_0xa743('0x2c')](_0x160beb)[_0xa743('0x2d')]();};}function respondWithResult(_0x37d01e,_0x3a886e){_0x3a886e=_0x3a886e||0xc8;return function(_0x4cdf44){if(_0x4cdf44){return _0x37d01e[_0xa743('0x2c')](_0x3a886e)['json'](_0x4cdf44);}};}function respondWithFilteredResult(_0x4bc883,_0x4825fa){return function(_0x3e21f8){if(_0x3e21f8){var _0x1e49f6=_0x3e21f8[_0xa743('0x2e')],_0x3f82c4=_0x4825fa[_0xa743('0x2f')],_0x22bff4=_0x4825fa[_0xa743('0x2f')]+_0x4825fa[_0xa743('0x30')],_0x13adde;if(_0x22bff4>=_0x1e49f6){_0x22bff4=_0x1e49f6;_0x13adde=0xc8;}else{_0x13adde=0xce;}_0x4bc883[_0xa743('0x2c')](_0x13adde);return _0x4bc883[_0xa743('0x31')](_0xa743('0x32'),_0x3f82c4+'-'+_0x22bff4+'/'+_0x1e49f6)['json'](_0x3e21f8);}return null;};}function patchUpdates(_0x2696e0){return function(_0x4885d8){try{jsonpatch['apply'](_0x4885d8,_0x2696e0,!![]);}catch(_0x18843a){return BPromise[_0xa743('0x33')](_0x18843a);}return _0x4885d8['save']();};}function saveUpdates(_0x22b3fd,_0xfa9efd){return function(_0x25a5ce){if(_0x25a5ce){return _0x25a5ce['update'](_0x22b3fd)[_0xa743('0x34')](function(_0x4c2189){return _0x4c2189;});}return null;};}function removeEntity(_0x2cc50c,_0x2171e8){return function(_0x556641){if(_0x556641){return _0x556641[_0xa743('0x35')]()[_0xa743('0x34')](function(){var _0x4f888a=_0x556641['get']({'plain':!![]});var _0x208a18=_0xa743('0x36');return db[_0xa743('0x37')][_0xa743('0x35')]({'where':{'type':_0x208a18,'resourceId':_0x4f888a['id']}})[_0xa743('0x34')](function(){return _0x556641;});})[_0xa743('0x34')](function(){_0x2cc50c[_0xa743('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31b083,_0x411efb){return function(_0x3ebbe2){if(!_0x3ebbe2){_0x31b083['sendStatus'](0x194);}return _0x3ebbe2;};}function handleError(_0xd4f4a7,_0x54da83){_0x54da83=_0x54da83||0x1f4;return function(_0x449f75){logger[_0xa743('0x26')](_0x449f75['stack']);if(_0x449f75[_0xa743('0x38')]){delete _0x449f75[_0xa743('0x38')];}_0xd4f4a7[_0xa743('0x2c')](_0x54da83)['send'](_0x449f75);};}exports[_0xa743('0x39')]=function(_0x4b2cd7,_0xcc9834){var _0x4ae3ef={'include':[{'model':db[_0xa743('0x3a')],'as':_0xa743('0x3b')}]},_0x24b831={},_0x3af32c={'count':0x0,'rows':[]};var _0x6b4d94=_['map'](db['WhatsappAccount'][_0xa743('0x3c')],function(_0x46eab1){return{'name':_0x46eab1['fieldName'],'type':_0x46eab1[_0xa743('0x3d')][_0xa743('0x3e')]};});_0x24b831[_0xa743('0x3f')]=_[_0xa743('0x40')](_0x6b4d94,_0xa743('0x38'));_0x24b831['query']=_['keys'](_0x4b2cd7[_0xa743('0x41')]);_0x24b831[_0xa743('0x42')]=_[_0xa743('0x43')](_0x24b831[_0xa743('0x3f')],_0x24b831['query']);_0x4ae3ef[_0xa743('0x44')]=_[_0xa743('0x43')](_0x24b831[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x4b2cd7['query'][_0xa743('0x45')]));_0x4ae3ef[_0xa743('0x44')]=_0x4ae3ef[_0xa743('0x44')][_0xa743('0x46')]?_0x4ae3ef[_0xa743('0x44')]:_0x24b831[_0xa743('0x3f')];if(!_0x4b2cd7['query'][_0xa743('0x47')]('nolimit')){_0x4ae3ef[_0xa743('0x30')]=qs[_0xa743('0x30')](_0x4b2cd7['query']['limit']);_0x4ae3ef[_0xa743('0x2f')]=qs[_0xa743('0x2f')](_0x4b2cd7[_0xa743('0x41')][_0xa743('0x2f')]);}_0x4ae3ef[_0xa743('0x48')]=qs[_0xa743('0x49')](_0x4b2cd7[_0xa743('0x41')][_0xa743('0x49')]);_0x4ae3ef['where']=qs['filters'](_[_0xa743('0x4a')](_0x4b2cd7[_0xa743('0x41')],_0x24b831[_0xa743('0x42')]),_0x6b4d94);if(_0x4b2cd7[_0xa743('0x41')]['filter']){_0x4ae3ef['where']=_['merge'](_0x4ae3ef[_0xa743('0x4b')],{'$or':_[_0xa743('0x40')](_0x6b4d94,function(_0x56ce1a){if(_0x56ce1a[_0xa743('0x3d')]!==_0xa743('0x4c')){var _0x970e77={};_0x970e77[_0x56ce1a[_0xa743('0x38')]]={'$like':'%'+_0x4b2cd7[_0xa743('0x41')][_0xa743('0x4d')]+'%'};return _0x970e77;}})});}_0x4ae3ef=_[_0xa743('0x4e')]({},_0x4ae3ef,_0x4b2cd7['options']);var _0x2074ea={'where':_0x4ae3ef['where']};return db[_0xa743('0x4f')][_0xa743('0x2e')](_0x2074ea)['then'](function(_0x363685){_0x3af32c[_0xa743('0x2e')]=_0x363685;if(_0x4b2cd7[_0xa743('0x41')][_0xa743('0x50')]){_0x4ae3ef[_0xa743('0x51')]=[{'all':!![]}];}return db[_0xa743('0x4f')][_0xa743('0x52')](_0x4ae3ef);})[_0xa743('0x34')](function(_0x4c2ac2){_0x3af32c[_0xa743('0x53')]=_0x4c2ac2;return _0x3af32c;})[_0xa743('0x34')](respondWithFilteredResult(_0xcc9834,_0x4ae3ef))[_0xa743('0x2b')](handleError(_0xcc9834,null));};exports[_0xa743('0x54')]=function(_0x80f101,_0x27ac7d){var _0xae1e66={'raw':![],'where':{'id':_0x80f101['params']['id']},'include':[{'model':db[_0xa743('0x3a')],'as':'mandatoryDispositionPause'}]},_0x6b893e={};_0x6b893e['model']=_['keys'](db[_0xa743('0x4f')][_0xa743('0x3c')]);_0x6b893e['query']=_[_0xa743('0x55')](_0x80f101[_0xa743('0x41')]);_0x6b893e['filtears']=_[_0xa743('0x43')](_0x6b893e[_0xa743('0x3f')],_0x6b893e['query']);_0xae1e66['attributes']=_[_0xa743('0x43')](_0x6b893e[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x80f101[_0xa743('0x41')][_0xa743('0x45')]));_0xae1e66[_0xa743('0x44')]=_0xae1e66[_0xa743('0x44')]['length']?_0xae1e66['attributes']:_0x6b893e[_0xa743('0x3f')];if(_0x80f101[_0xa743('0x41')][_0xa743('0x50')]){_0xae1e66[_0xa743('0x51')]=[{'all':!![]}];}_0xae1e66=_[_0xa743('0x4e')]({},_0xae1e66,_0x80f101[_0xa743('0x56')]);return db[_0xa743('0x4f')]['find'](_0xae1e66)[_0xa743('0x34')](handleEntityNotFound(_0x27ac7d,null))['then'](respondWithResult(_0x27ac7d,null))[_0xa743('0x2b')](handleError(_0x27ac7d,null));};exports['create']=function(_0x22859c,_0x4e25d4){return db[_0xa743('0x4f')][_0xa743('0x57')](_0x22859c[_0xa743('0x58')],{})['then'](function(_0x35e8cb){var _0x3a6585=_0x22859c[_0xa743('0x59')][_0xa743('0x5a')]({'plain':!![]});if(!_0x3a6585)throw new Error(_0xa743('0x5b'));if(_0x3a6585[_0xa743('0x5c')]===_0xa743('0x59')){var _0x148f36=_0x35e8cb['get']({'plain':!![]});var _0x211943=_0xa743('0x36');return db[_0xa743('0x5d')]['find']({'where':{'name':_0x211943,'userProfileId':_0x3a6585['userProfileId']},'raw':!![]})[_0xa743('0x34')](function(_0x1bb5f5){if(_0x1bb5f5&&_0x1bb5f5[_0xa743('0x5e')]===0x0){return db[_0xa743('0x37')]['create']({'name':_0x148f36[_0xa743('0x38')],'resourceId':_0x148f36['id'],'type':_0x1bb5f5[_0xa743('0x38')],'sectionId':_0x1bb5f5['id']},{})['then'](function(){return _0x35e8cb;});}else{return _0x35e8cb;}})[_0xa743('0x2b')](function(_0x5021f1){logger[_0xa743('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5021f1);throw _0x5021f1;});}return _0x35e8cb;})[_0xa743('0x34')](respondWithResult(_0x4e25d4,0xc9))[_0xa743('0x2b')](handleError(_0x4e25d4,null));};exports[_0xa743('0x5f')]=function(_0x14aec8,_0x46bf3c){if(_0x14aec8[_0xa743('0x58')]['id']){delete _0x14aec8[_0xa743('0x58')]['id'];}return db[_0xa743('0x4f')][_0xa743('0x60')]({'where':{'id':_0x14aec8[_0xa743('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0xa743('0x3b')}]})[_0xa743('0x34')](handleEntityNotFound(_0x46bf3c,null))[_0xa743('0x34')](saveUpdates(_0x14aec8[_0xa743('0x58')],null))['then'](respondWithResult(_0x46bf3c,null))['catch'](handleError(_0x46bf3c,null));};exports[_0xa743('0x35')]=function(_0x40ac0e,_0x216fbf){return db['WhatsappAccount'][_0xa743('0x60')]({'where':{'id':_0x40ac0e[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x216fbf,null))[_0xa743('0x34')](removeEntity(_0x216fbf,null))[_0xa743('0x2b')](handleError(_0x216fbf,null));};exports['describe']=function(_0x11e370,_0x5da678){return db[_0xa743('0x4f')][_0xa743('0x62')]()[_0xa743('0x34')](respondWithResult(_0x5da678,null))[_0xa743('0x2b')](handleError(_0x5da678,null));};exports[_0xa743('0x63')]=function(_0x3dcec6,_0x4de9c1,_0x502f03){if(_0x3dcec6[_0xa743('0x58')]['id']){delete _0x3dcec6[_0xa743('0x58')]['id'];}return db[_0xa743('0x4f')]['find']({'where':{'id':_0x3dcec6[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x4de9c1,null))[_0xa743('0x34')](function(_0x40789f){if(_0x40789f){_0x3dcec6[_0xa743('0x58')][_0xa743('0x64')]=_0x40789f['id'];return db[_0xa743('0x65')][_0xa743('0x57')](_0x3dcec6['body']);}})[_0xa743('0x34')](respondWithResult(_0x4de9c1,null))['catch'](handleError(_0x4de9c1,null));};exports[_0xa743('0x66')]=function(_0x5b1f07,_0x3b6eb0,_0x4cada1){var _0x3aa977={'raw':![],'where':{}};var _0x568325={};var _0x37c0ef={'count':0x0,'rows':[]};return db[_0xa743('0x4f')][_0xa743('0x67')]({'where':{'id':_0x5b1f07[_0xa743('0x61')]['id']}})['then'](handleEntityNotFound(_0x3b6eb0,null))[_0xa743('0x34')](function(_0x36b062){if(_0x36b062){_0x568325[_0xa743('0x3f')]=_[_0xa743('0x55')](db[_0xa743('0x65')][_0xa743('0x3c')]);_0x568325['query']=_[_0xa743('0x55')](_0x5b1f07[_0xa743('0x41')]);_0x568325[_0xa743('0x42')]=_[_0xa743('0x43')](_0x568325[_0xa743('0x3f')],_0x568325['query']);_0x3aa977[_0xa743('0x44')]=_[_0xa743('0x43')](_0x568325[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x5b1f07['query'][_0xa743('0x45')]));_0x3aa977[_0xa743('0x44')]=_0x3aa977[_0xa743('0x44')]['length']?_0x3aa977[_0xa743('0x44')]:_0x568325[_0xa743('0x3f')];if(!_0x5b1f07[_0xa743('0x41')]['hasOwnProperty'](_0xa743('0x68'))){_0x3aa977[_0xa743('0x30')]=qs['limit'](_0x5b1f07[_0xa743('0x41')][_0xa743('0x30')]);_0x3aa977[_0xa743('0x2f')]=qs[_0xa743('0x2f')](_0x5b1f07['query']['offset']);}_0x3aa977[_0xa743('0x48')]=qs['sort'](_0x5b1f07['query']['sort']);_0x3aa977[_0xa743('0x4b')]=qs[_0xa743('0x42')](_['pick'](_0x5b1f07['query'],_0x568325[_0xa743('0x42')]));_0x3aa977[_0xa743('0x4b')][_0xa743('0x64')]=_0x36b062['id'];if(_0x5b1f07[_0xa743('0x41')][_0xa743('0x4d')]){_0x3aa977[_0xa743('0x4b')]=_['merge'](_0x3aa977['where'],{'$or':_[_0xa743('0x40')](_0x3aa977[_0xa743('0x44')],function(_0x40edb0){var _0x1bf183={};_0x1bf183[_0x40edb0]={'$like':'%'+_0x5b1f07['query'][_0xa743('0x4d')]+'%'};return _0x1bf183;})});}_0x3aa977=_[_0xa743('0x4e')]({},_0x3aa977,_0x5b1f07[_0xa743('0x56')]);return db[_0xa743('0x65')]['count']({'where':_0x3aa977[_0xa743('0x4b')]})[_0xa743('0x34')](function(_0x5bfca2){_0x37c0ef[_0xa743('0x2e')]=_0x5bfca2;if(_0x5b1f07[_0xa743('0x41')][_0xa743('0x50')]){_0x3aa977[_0xa743('0x51')]=[{'all':!![]}];}return db[_0xa743('0x65')][_0xa743('0x52')](_0x3aa977);})[_0xa743('0x34')](function(_0x2e14e7){_0x37c0ef[_0xa743('0x53')]=_0x2e14e7;return _0x37c0ef;});}})[_0xa743('0x34')](respondWithFilteredResult(_0x3b6eb0,_0x3aa977))['catch'](handleError(_0x3b6eb0,null));};exports[_0xa743('0x69')]=function(_0x202ea1,_0x1b8e30,_0x4d8e97){return db[_0xa743('0x4f')]['find']({'where':{'id':_0x202ea1['params']['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x1b8e30,null))[_0xa743('0x34')](function(_0x4e250a){if(_0x4e250a){return _0x4e250a[_0xa743('0x69')](_0x202ea1[_0xa743('0x41')][_0xa743('0x6a')]);}})[_0xa743('0x34')](respondWithStatusCode(_0x1b8e30,null))[_0xa743('0x2b')](handleError(_0x1b8e30,null));};exports[_0xa743('0x6b')]=function(_0x417d87,_0x23899f,_0x1cd60f){if(_0x417d87['body']['id']){delete _0x417d87[_0xa743('0x58')]['id'];}return db[_0xa743('0x4f')][_0xa743('0x60')]({'where':{'id':_0x417d87[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x23899f,null))[_0xa743('0x34')](function(_0x140bbb){if(_0x140bbb){_0x417d87['body'][_0xa743('0x64')]=_0x140bbb['id'];return db['CannedAnswer'][_0xa743('0x57')](_0x417d87[_0xa743('0x58')]);}})[_0xa743('0x34')](respondWithResult(_0x23899f,null))[_0xa743('0x2b')](handleError(_0x23899f,null));};exports[_0xa743('0x6c')]=function(_0x1e1935,_0x539520,_0x1ce967){var _0x3c12db={'raw':![],'where':{}};var _0x206714={};var _0x4fd393={'count':0x0,'rows':[]};return db[_0xa743('0x4f')]['findOne']({'where':{'id':_0x1e1935[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x539520,null))['then'](function(_0x26e7d5){if(_0x26e7d5){_0x206714[_0xa743('0x3f')]=_['keys'](db[_0xa743('0x6d')][_0xa743('0x3c')]);_0x206714[_0xa743('0x41')]=_[_0xa743('0x55')](_0x1e1935['query']);_0x206714[_0xa743('0x42')]=_[_0xa743('0x43')](_0x206714[_0xa743('0x3f')],_0x206714[_0xa743('0x41')]);_0x3c12db[_0xa743('0x44')]=_[_0xa743('0x43')](_0x206714[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x1e1935[_0xa743('0x41')][_0xa743('0x45')]));_0x3c12db['attributes']=_0x3c12db[_0xa743('0x44')]['length']?_0x3c12db[_0xa743('0x44')]:_0x206714[_0xa743('0x3f')];if(!_0x1e1935[_0xa743('0x41')][_0xa743('0x47')](_0xa743('0x68'))){_0x3c12db['limit']=qs[_0xa743('0x30')](_0x1e1935[_0xa743('0x41')][_0xa743('0x30')]);_0x3c12db[_0xa743('0x2f')]=qs[_0xa743('0x2f')](_0x1e1935['query'][_0xa743('0x2f')]);}_0x3c12db[_0xa743('0x48')]=qs['sort'](_0x1e1935['query'][_0xa743('0x49')]);_0x3c12db[_0xa743('0x4b')]=qs[_0xa743('0x42')](_[_0xa743('0x4a')](_0x1e1935[_0xa743('0x41')],_0x206714[_0xa743('0x42')]));_0x3c12db['where'][_0xa743('0x64')]=_0x26e7d5['id'];if(_0x1e1935[_0xa743('0x41')][_0xa743('0x4d')]){_0x3c12db[_0xa743('0x4b')]=_[_0xa743('0x4e')](_0x3c12db['where'],{'$or':_[_0xa743('0x40')](_0x3c12db['attributes'],function(_0x3be0d9){var _0xaecb66={};_0xaecb66[_0x3be0d9]={'$like':'%'+_0x1e1935[_0xa743('0x41')][_0xa743('0x4d')]+'%'};return _0xaecb66;})});}_0x3c12db=_[_0xa743('0x4e')]({},_0x3c12db,_0x1e1935['options']);return db[_0xa743('0x6d')][_0xa743('0x2e')]({'where':_0x3c12db['where']})[_0xa743('0x34')](function(_0x25f801){_0x4fd393['count']=_0x25f801;if(_0x1e1935['query'][_0xa743('0x50')]){_0x3c12db[_0xa743('0x51')]=[{'all':!![]}];}return db[_0xa743('0x6d')][_0xa743('0x52')](_0x3c12db);})['then'](function(_0x9d0c31){_0x4fd393['rows']=_0x9d0c31;return _0x4fd393;});}})[_0xa743('0x34')](respondWithFilteredResult(_0x539520,_0x3c12db))[_0xa743('0x2b')](handleError(_0x539520,null));};exports[_0xa743('0x6e')]=function(_0x4494e1,_0x5a296f,_0xd3df67){return db[_0xa743('0x4f')]['find']({'where':{'id':_0x4494e1[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x5a296f,null))['then'](function(_0x46c814){if(_0x46c814){return _0x46c814[_0xa743('0x6e')](_0x4494e1['query']['ids']);}})[_0xa743('0x34')](respondWithStatusCode(_0x5a296f,null))[_0xa743('0x2b')](handleError(_0x5a296f,null));};exports[_0xa743('0x6f')]=function(_0x425278,_0x1eaf8c,_0x5392cf){return db[_0xa743('0x4f')][_0xa743('0x60')]({'where':{'id':_0x425278[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x1eaf8c,null))[_0xa743('0x34')](function(_0x585287){if(_0x585287){return _0x585287[_0xa743('0x6f')](_0x425278[_0xa743('0x58')][_0xa743('0x6a')],_[_0xa743('0x70')](_0x425278['body'],[_0xa743('0x6a'),'id'])||{})['spread'](function(_0xd87936){for(var _0x16f7b0=0x0;_0x16f7b0<_0x425278[_0xa743('0x58')]['ids']['length'];_0x16f7b0+=0x1){socket[_0xa743('0x71')](_0xa743('0x72'),{'UserId':_0x425278['body'][_0xa743('0x6a')][_0x16f7b0],'WhatsappAccountId':_0x425278[_0xa743('0x61')]['id']});}return _0xd87936;});}})[_0xa743('0x34')](respondWithResult(_0x1eaf8c,null))[_0xa743('0x2b')](handleError(_0x1eaf8c,null));};exports[_0xa743('0x73')]=function(_0x3ce6be,_0x9a9ffe,_0x10d896){return db[_0xa743('0x4f')][_0xa743('0x60')]({'where':{'id':_0x3ce6be[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x9a9ffe,null))['then'](function(_0xe666f3){if(_0xe666f3){return _0xe666f3['removeAgents'](_0x3ce6be[_0xa743('0x41')][_0xa743('0x6a')])['then'](function(){if(_[_0xa743('0x74')](_0x3ce6be['query']['ids'])){for(var _0xf66659=0x0;_0xf66659<_0x3ce6be[_0xa743('0x41')][_0xa743('0x6a')]['length'];_0xf66659+=0x1){socket['emit'](_0xa743('0x75'),{'UserId':Number(_0x3ce6be['query'][_0xa743('0x6a')][_0xf66659]),'WhatsappAccountId':Number(_0x3ce6be[_0xa743('0x61')]['id'])});}}else{socket[_0xa743('0x71')](_0xa743('0x75'),{'UserId':Number(_0x3ce6be[_0xa743('0x41')][_0xa743('0x6a')]),'WhatsappAccountId':Number(_0x3ce6be[_0xa743('0x61')]['id'])});}});}})[_0xa743('0x34')](respondWithStatusCode(_0x9a9ffe,null))[_0xa743('0x2b')](handleError(_0x9a9ffe,null));};exports[_0xa743('0x76')]=function(_0x30d282,_0x465d6b,_0x17c341){var _0x30a94a={};var _0x793696={};var _0x5eda2a;var _0x14c313;return db[_0xa743('0x4f')][_0xa743('0x67')]({'where':{'id':_0x30d282[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x465d6b,null))[_0xa743('0x34')](function(_0x1b8eaf){if(_0x1b8eaf){_0x5eda2a=_0x1b8eaf;_0x793696['model']=_[_0xa743('0x55')](db[_0xa743('0x77')][_0xa743('0x3c')]);_0x793696[_0xa743('0x41')]=_[_0xa743('0x55')](_0x30d282[_0xa743('0x41')]);_0x793696[_0xa743('0x42')]=_['intersection'](_0x793696[_0xa743('0x3f')],_0x793696[_0xa743('0x41')]);_0x30a94a[_0xa743('0x44')]=_[_0xa743('0x43')](_0x793696[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x30d282[_0xa743('0x41')]['fields']));_0x30a94a[_0xa743('0x44')]=_0x30a94a[_0xa743('0x44')][_0xa743('0x46')]?_0x30a94a['attributes']:_0x793696['model'];_0x30a94a[_0xa743('0x48')]=qs['sort'](_0x30d282[_0xa743('0x41')][_0xa743('0x49')]);_0x30a94a['where']=qs['filters'](_['pick'](_0x30d282[_0xa743('0x41')],_0x793696[_0xa743('0x42')]));if(_0x30d282[_0xa743('0x41')][_0xa743('0x4d')]){_0x30a94a[_0xa743('0x4b')]=_[_0xa743('0x4e')](_0x30a94a['where'],{'$or':_[_0xa743('0x40')](_0x30a94a[_0xa743('0x44')],function(_0x2468fe){var _0x58ae1e={};_0x58ae1e[_0x2468fe]={'$like':'%'+_0x30d282[_0xa743('0x41')][_0xa743('0x4d')]+'%'};return _0x58ae1e;})});}_0x30a94a=_[_0xa743('0x4e')]({},_0x30a94a,_0x30d282[_0xa743('0x56')]);return _0x5eda2a['getAgents'](_0x30a94a);}})[_0xa743('0x34')](function(_0x56e892){if(_0x56e892){_0x14c313=_0x56e892[_0xa743('0x46')];if(!_0x30d282['query'][_0xa743('0x47')](_0xa743('0x68'))){_0x30a94a[_0xa743('0x30')]=qs[_0xa743('0x30')](_0x30d282['query'][_0xa743('0x30')]);_0x30a94a[_0xa743('0x2f')]=qs[_0xa743('0x2f')](_0x30d282['query'][_0xa743('0x2f')]);}return _0x5eda2a[_0xa743('0x76')](_0x30a94a);}})[_0xa743('0x34')](function(_0x51c4cc){if(_0x51c4cc){return _0x51c4cc?{'count':_0x14c313,'rows':_0x51c4cc}:null;}})[_0xa743('0x34')](respondWithResult(_0x465d6b,null))[_0xa743('0x2b')](handleError(_0x465d6b,null));};exports[_0xa743('0x78')]=function(_0x47c818,_0x4d32c7,_0xb33b90){return db[_0xa743('0x4f')][_0xa743('0x67')]({'where':{'id':_0x47c818[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x4d32c7,null))[_0xa743('0x34')](function(_0x2722e0){if(_0x2722e0){return db[_0xa743('0x79')][_0xa743('0x7a')](function(_0xa928d7){return db[_0xa743('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x47c818[_0xa743('0x61')]['id']},'transaction':_0xa928d7})[_0xa743('0x34')](function(_0x142fbc){var _0x502d26=_[_0xa743('0x40')](_0x47c818[_0xa743('0x58')],function(_0x31cd43){_0x31cd43[_0xa743('0x64')]=_0x47c818[_0xa743('0x61')]['id'];return _0x31cd43;});return db[_0xa743('0x7b')][_0xa743('0x7c')](_0x502d26,{'transaction':_0xa928d7});});})['then'](function(){return db[_0xa743('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x47c818['params']['id']},'order':_0xa743('0x7d')});});}})[_0xa743('0x34')](respondWithResult(_0x4d32c7,null))[_0xa743('0x2b')](handleError(_0x4d32c7,null));};exports['getApplications']=function(_0x2299aa,_0x20e9dc,_0x269225){var _0x22994f={};var _0xd1f897={};var _0x15b868;var _0x48ad90;return db[_0xa743('0x4f')][_0xa743('0x67')]({'where':{'id':_0x2299aa[_0xa743('0x61')]['id']}})[_0xa743('0x34')](handleEntityNotFound(_0x20e9dc,null))[_0xa743('0x34')](function(_0x2cef18){if(_0x2cef18){_0x15b868=_0x2cef18;_0xd1f897[_0xa743('0x3f')]=_[_0xa743('0x55')](db[_0xa743('0x7b')]['rawAttributes']);_0xd1f897['query']=_[_0xa743('0x55')](_0x2299aa[_0xa743('0x41')]);_0xd1f897[_0xa743('0x42')]=_[_0xa743('0x43')](_0xd1f897[_0xa743('0x3f')],_0xd1f897[_0xa743('0x41')]);_0x22994f['attributes']=_[_0xa743('0x43')](_0xd1f897[_0xa743('0x3f')],qs[_0xa743('0x45')](_0x2299aa['query'][_0xa743('0x45')]));_0x22994f['attributes']=_0x22994f[_0xa743('0x44')][_0xa743('0x46')]?_0x22994f[_0xa743('0x44')]:_0xd1f897[_0xa743('0x3f')];_0x22994f[_0xa743('0x48')]=qs[_0xa743('0x49')](_0x2299aa[_0xa743('0x41')]['sort']);_0x22994f[_0xa743('0x4b')]=qs[_0xa743('0x42')](_[_0xa743('0x4a')](_0x2299aa[_0xa743('0x41')],_0xd1f897[_0xa743('0x42')]));if(_0x2299aa[_0xa743('0x41')][_0xa743('0x4d')]){_0x22994f[_0xa743('0x4b')]=_[_0xa743('0x4e')](_0x22994f[_0xa743('0x4b')],{'$or':_['map'](_0x22994f[_0xa743('0x44')],function(_0x27f212){var _0xe284cb={};_0xe284cb[_0x27f212]={'$like':'%'+_0x2299aa[_0xa743('0x41')][_0xa743('0x4d')]+'%'};return _0xe284cb;})});}_0x22994f=_['merge']({},_0x22994f,_0x2299aa['options']);return _0x15b868[_0xa743('0x7e')](_0x22994f);}})[_0xa743('0x34')](function(_0x1cec84){if(_0x1cec84){_0x48ad90=_0x1cec84[_0xa743('0x46')];if(!_0x2299aa[_0xa743('0x41')][_0xa743('0x47')](_0xa743('0x68'))){_0x22994f['limit']=qs['limit'](_0x2299aa[_0xa743('0x41')][_0xa743('0x30')]);_0x22994f[_0xa743('0x2f')]=qs[_0xa743('0x2f')](_0x2299aa[_0xa743('0x41')][_0xa743('0x2f')]);}return _0x15b868[_0xa743('0x7e')](_0x22994f);}})[_0xa743('0x34')](function(_0x477b2e){if(_0x477b2e){return _0x477b2e?{'count':_0x48ad90,'rows':_0x477b2e}:null;}})[_0xa743('0x34')](respondWithResult(_0x20e9dc,null))['catch'](handleError(_0x20e9dc,null));};exports[_0xa743('0x7f')]=function(_0x1c9c3,_0x352692,_0x447030){var _0x4b2e86={'channel':_0xa743('0x80')};var _0x1a31cd=[];var _0x4ed361=[];var _0x9f3763={};return db['WhatsappAccount'][_0xa743('0x60')]({'where':{'id':_0x1c9c3['params']['id']},'include':[{'model':db[_0xa743('0x7b')],'as':_0xa743('0x81')}]})[_0xa743('0x34')](handleEntityNotFound(_0x352692,null))[_0xa743('0x34')](function(_0x3e839d){_0x4b2e86[_0xa743('0x82')]=_0x3e839d;_0x4b2e86['applications']=_[_0xa743('0x83')](_0x3e839d[_0xa743('0x81')],[_0xa743('0x7d')],[_0xa743('0x84')]);if(_0x4b2e86[_0xa743('0x82')][_0xa743('0x81')]){delete _0x4b2e86['account'][_0xa743('0x81')];}return db[_0xa743('0x85')][_0xa743('0x62')]();})[_0xa743('0x34')](function(_0x4f696a){if(!_0x4f696a){throw new db[(_0xa743('0x86'))][(_0xa743('0x87'))]('no\x20available\x20attributes');}_0x1a31cd=_[_0xa743('0x88')](_['keys'](_0x4f696a),[_0xa743('0x89'),_0xa743('0x8a')]);_0x4ed361=_[_0xa743('0x88')](_[_0xa743('0x55')](_0x4f696a),[_0xa743('0x89'),_0xa743('0x8a'),_0xa743('0x8b'),_0xa743('0x8c')]);_0x4b2e86[_0xa743('0x58')]={'mapKey':_0xa743('0x8d')};if(_0x4b2e86['account'][_0xa743('0x3d')]&&_0x4b2e86[_0xa743('0x82')]['type']===_0xa743('0x8e')){_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')]=_0x1c9c3[_0xa743('0x58')]['From'][_0xa743('0x90')](_0xa743('0x91'),'');_0x4b2e86[_0xa743('0x58')][_0xa743('0x58')]=_0x1c9c3[_0xa743('0x58')][_0xa743('0x92')];_0x4b2e86[_0xa743('0x58')][_0xa743('0x93')]=_0x1c9c3[_0xa743('0x58')][_0xa743('0x94')];}if(_0x4b2e86[_0xa743('0x58')]['id']){delete _0x4b2e86[_0xa743('0x58')]['id'];}if(_[_0xa743('0x95')](_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')])){throw new db[(_0xa743('0x86'))][(_0xa743('0x87'))](_0xa743('0x96'));}if(_[_0xa743('0x95')](_0x4b2e86[_0xa743('0x58')][_0xa743('0x58')])||_0x4b2e86[_0xa743('0x58')][_0xa743('0x58')]===''){throw new db[(_0xa743('0x86'))][(_0xa743('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa743('0x95')](_0x4b2e86[_0xa743('0x58')][_0xa743('0x97')])){throw new db['Sequelize']['ValidationError'](_0xa743('0x98')+_0x4ed361);}if(!_[_0xa743('0x99')](_0x4ed361,_0x4b2e86[_0xa743('0x58')]['mapKey'])){throw new db['Sequelize'][(_0xa743('0x87'))](_0xa743('0x9a')+_0x4ed361);}_0x9f3763[_0x4b2e86[_0xa743('0x58')]['mapKey']]=_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')];return db[_0xa743('0x9b')]['find']({'where':{'id':_0x4b2e86[_0xa743('0x82')][_0xa743('0x8c')]},'include':[{'model':db[_0xa743('0x85')],'as':_0xa743('0x9c'),'where':_0x9f3763,'limit':0x1,'order':[[_0xa743('0x8a'),'DESC']]}]});})[_0xa743('0x34')](handleEntityNotFound(_0x352692,null))[_0xa743('0x34')](function(_0x1a30a2){if(_0x1a30a2){_0x4b2e86[_0xa743('0x9d')]=_[_0xa743('0x70')](_0x1a30a2,[_0xa743('0x9c')]);if(_0x1a30a2[_0xa743('0x9c')][_0xa743('0x46')]){return _0x1a30a2[_0xa743('0x9c')][0x0];}var _0x5e7e6c=_[_0xa743('0x1a')](_0x4b2e86[_0xa743('0x58')],{'firstName':_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')],'ListId':_0x1a30a2['id']});_0x5e7e6c[_0x4b2e86['body'][_0xa743('0x97')]]=_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')];return db[_0xa743('0x85')]['create'](_0x5e7e6c,{'fields':_0x1a31cd,'raw':!![]});}})[_0xa743('0x34')](handleEntityNotFound(_0x352692,null))[_0xa743('0x34')](function(_0x16c86a){if(_0x16c86a){_0x4b2e86[_0xa743('0x9e')]=_0x16c86a;var _0x23758e={'ContactId':_0x16c86a['id'],'phone':_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')],'WhatsappAccountId':_0x1c9c3['params']['id']};var _0x39adb3={'ContactId':_0x16c86a['id'],'WhatsappAccountId':_0x1c9c3[_0xa743('0x61')]['id'],'closed':![]};return db[_0xa743('0x9f')]['find']({'where':_0x39adb3})[_0xa743('0x34')](function(_0x14eff5){if(_0x14eff5){return[_0x14eff5,![]];}return db[_0xa743('0x9f')][_0xa743('0x57')](_0x23758e)['then'](function(_0x2ccf7d){return[_0x2ccf7d,!![]];});});}})[_0xa743('0xa0')](function(_0x59b31e,_0x228f4){_0x4b2e86['interaction']=_0x59b31e[_0xa743('0x5a')]({'plain':!![]});_0x4b2e86[_0xa743('0xa1')]['created']=![];if(_0x228f4){if(_0x4b2e86['account'][_0xa743('0xa2')]){_0x4b2e86[_0xa743('0xa3')][_0xa743('0xa4')]({'id':0x0,'priority':_0x4b2e86[_0xa743('0xa3')]['length']+0x1,'app':'close','appdata':_0xa743('0xa5'),'interval':_0xa743('0xa6')});}_0x4b2e86[_0xa743('0xa1')][_0xa743('0xa7')]=!![];}return db[_0xa743('0xa8')]['create']({'phone':_0x4b2e86[_0xa743('0x58')][_0xa743('0x8f')],'messageId':_0x4b2e86[_0xa743('0x58')]['messageId'],'body':_0x4b2e86[_0xa743('0x58')][_0xa743('0x58')],'WhatsappAccountId':_0x1c9c3['params']['id'],'WhatsappInteractionId':_0x59b31e['id'],'direction':'in','ContactId':_0x59b31e[_0xa743('0xa9')],'AttachmentId':_0x4b2e86[_0xa743('0x58')][_0xa743('0xaa')]});})['then'](function(_0x53c110){_0x4b2e86[_0xa743('0x28')]=_0x53c110;if(_0x4b2e86[_0xa743('0xa1')][_0xa743('0xab')]){return db[_0xa743('0x77')][_0xa743('0x60')]({'attributes':['id',_0xa743('0x38')],'where':{'id':_0x4b2e86[_0xa743('0xa1')]['UserId']}})[_0xa743('0x34')](function(_0xa194d3){if(_0xa194d3){_0x4b2e86[_0xa743('0xa3')][_0xa743('0xac')]({'id':0x0,'priority':0x0,'app':_0xa743('0xad'),'appdata':_0xa194d3['name']+','+(_0x4b2e86[_0xa743('0x82')]['waitForTheAssignedAgent']||0xa),'interval':_0xa743('0xa6')});}return respondWithRpcPromise(_0xa743('0xae'),_0xa743('0xaf'),_0x4b2e86);});}return respondWithRpcPromise('Start',_0xa743('0xaf'),_0x4b2e86);})[_0xa743('0x34')](function(_0x4ee479){if(_0x4ee479){var _0x8cf900=0xc8;var _0x2050d7='receiveMessage';logger[_0xa743('0x29')](_0xa743('0x24'),_0x2050d7,_0x8cf900,'entity\x20found');logger[_0xa743('0x23')](_0xa743('0xb0'),_0x2050d7,_0x8cf900,_0xa743('0xb1'),JSON['stringify'](_0x4ee479));if(_0x4b2e86[_0xa743('0x82')]['type']==='twilio'){return _0x352692[_0xa743('0x2c')](_0x8cf900)['set'](_0xa743('0xb2'),'text/xml')[_0xa743('0xb3')](_0xa743('0xb4'));}else{return _0x352692[_0xa743('0x2c')](_0x8cf900)['json'](_0x4ee479);}}})[_0xa743('0x2b')](handleError(_0x352692,null));};exports[_0xa743('0xb3')]=function(_0x4a9be0,_0x42cf9b,_0x511266){var _0x3d916a,_0x3b0f7d,_0x5ee9bb;if(_[_0xa743('0x95')](_0x4a9be0[_0xa743('0x58')][_0xa743('0x58')])||_0x4a9be0[_0xa743('0x58')][_0xa743('0x58')]===''){throw new db[(_0xa743('0x86'))][(_0xa743('0x87'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4a9be0[_0xa743('0x58')]['to'])){throw new db[(_0xa743('0x86'))][(_0xa743('0x87'))](_0xa743('0xb5'));}_0x3d916a=_0x4a9be0['body']['to'];return db[_0xa743('0x4f')]['find']({'where':{'id':_0x4a9be0[_0xa743('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0xa743('0xb6'),'include':[{'model':db[_0xa743('0x85')],'as':_0xa743('0x9c'),'where':{'mobile':_0x3d916a},'limit':0x1,'order':[[_0xa743('0x8a'),_0xa743('0xb7')]]}]}]})['then'](handleEntityNotFound(_0x42cf9b,null))[_0xa743('0x34')](function(_0xfa7db5){if(_0xfa7db5&&_0xfa7db5[_0xa743('0xb6')]){_0x3b0f7d=_0xfa7db5[_0xa743('0x5a')]({'plain':!![]});if(_0x3b0f7d[_0xa743('0xb6')]&&_0x3b0f7d[_0xa743('0xb6')][_0xa743('0x9c')][_0xa743('0x46')]){return _0x3b0f7d[_0xa743('0xb6')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xa743('0x1a')](_0x4a9be0[_0xa743('0x58')],{'firstName':_0x3d916a,'mobile':_0x3d916a,'phone':_0x3d916a,'ListId':_0x3b0f7d[_0xa743('0x8c')]}));}})[_0xa743('0x34')](handleEntityNotFound(_0x42cf9b,null))[_0xa743('0x34')](function(_0x272c4c){if(_0x272c4c){_0x5ee9bb=_0x272c4c;return db[_0xa743('0x9f')][_0xa743('0x60')]({'where':{'ContactId':_0x5ee9bb['id'],'closed':![],'WhatsappAccountId':_0x3b0f7d['id']}})[_0xa743('0x34')](function(_0x2eb4d1){if(_0x2eb4d1){return[_0x2eb4d1,![]];}return db[_0xa743('0x9f')][_0xa743('0x57')]({'UserId':_0x4a9be0['user']['id'],'ContactId':_0x5ee9bb['id'],'WhatsappAccountId':_0x3b0f7d['id'],'phone':_0x3d916a,'firstMsgDirection':_0xa743('0xb8'),'Messages':[_[_0xa743('0x4e')](_0x4a9be0[_0xa743('0x58')],{'read':![],'body':_0x4a9be0[_0xa743('0x58')][_0xa743('0x58')],'phone':_0x3d916a,'WhatsappAccountId':_0x3b0f7d['id'],'UserId':_0x4a9be0[_0xa743('0x59')]['id'],'ContactId':_0x5ee9bb['id']})]},{'include':[{'model':db[_0xa743('0xa8')],'as':_0xa743('0xb9')}]})[_0xa743('0x34')](function(_0x1eb94a){return[_0x1eb94a,!![]];});});}})[_0xa743('0xa0')](function(_0x349fd9,_0x5d198c){if(_0x5d198c){return _0x349fd9;}return db['WhatsappMessage'][_0xa743('0x57')](_[_0xa743('0x4e')](_0x4a9be0['body'],{'read':![],'body':_0x4a9be0['body'][_0xa743('0x58')],'phone':_0x3d916a,'WhatsappAccountId':_0x3b0f7d['id'],'WhatsappInteractionId':_0x349fd9['id'],'UserId':_0x4a9be0['user']['id'],'ContactId':_0x5ee9bb['id']}))[_0xa743('0x34')](function(_0x434a06){_0x349fd9[_0xa743('0xba')][_0xa743('0xb9')]=[];_0x349fd9['dataValues']['Messages'][_0xa743('0xa4')](_0x434a06[_0xa743('0xba')]);return _0x349fd9;});})[_0xa743('0x34')](respondWithResult(_0x42cf9b,null))[_0xa743('0x2b')](handleError(_0x42cf9b,null));}; \ No newline at end of file +var _0x752f=['length','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','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','WhatsappAccountId','rows','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','account','applications','orderBy','asc','Applications','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','From','replace','MessageSid','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','CmContact','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','messageId','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','jayson/promise','client','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','status','count','offset','limit','Content-Range','json','reject','save','update','get','UserProfileResource','destroy','end','sendStatus','stack','name','index','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','show','params','Pause','filtears'];(function(_0x569d59,_0x4ad4ff){var _0x2ae44a=function(_0x1b1887){while(--_0x1b1887){_0x569d59['push'](_0x569d59['shift']());}};_0x2ae44a(++_0x4ad4ff);}(_0x752f,0x6a));var _0xf752=function(_0x2c7c69,_0x1855c3){_0x2c7c69=_0x2c7c69-0x0;var _0x33c921=_0x752f[_0x2c7c69];return _0x33c921;};'use strict';var pdf=require(_0xf752('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf752('0x1'));var jsonpatch=require(_0xf752('0x2'));var rp=require(_0xf752('0x3'));var moment=require(_0xf752('0x4'));var BPromise=require(_0xf752('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf752('0x6'));var sox=require('sox');var csv=require(_0xf752('0x7'));var ejs=require(_0xf752('0x8'));var fs=require('fs');var _=require(_0xf752('0x9'));var squel=require(_0xf752('0xa'));var crypto=require(_0xf752('0xb'));var jsforce=require(_0xf752('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf752('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf752('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf752('0xf'));var logger=require('../../config/logger')(_0xf752('0x10'));var utils=require(_0xf752('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf752('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xf752('0x13')],{'host':_0xf752('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf752('0x13')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0xf752('0x15'));var client=jayson[_0xf752('0x16')]['http']({'port':0x232c});function respondWithRpcPromise(_0x22ba53,_0x27df27,_0x27b236,_0x8420de){return new BPromise(function(_0x81a9e4,_0x556e4b){var _0x5b3487=_0x8420de||client;return _0x5b3487['request'](_0x22ba53,_0x27b236)[_0xf752('0x17')](function(_0x39ea2e){logger[_0xf752('0x18')](_0xf752('0x19'),_0x27df27,_0xf752('0x1a'));logger[_0xf752('0x1b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x27df27,'request\x20sent',JSON['stringify'](_0x39ea2e));if(_0x39ea2e['error']){if(_0x39ea2e[_0xf752('0x1c')]['code']===0x1f4){logger[_0xf752('0x1c')](_0xf752('0x19'),_0x27df27,_0x39ea2e['error'][_0xf752('0x1d')]);return _0x556e4b(_0x39ea2e[_0xf752('0x1c')]['message']);}logger[_0xf752('0x1c')](_0xf752('0x19'),_0x27df27,_0x39ea2e[_0xf752('0x1c')][_0xf752('0x1d')]);return _0x81a9e4(_0x39ea2e['error'][_0xf752('0x1d')]);}else{logger['info'](_0xf752('0x19'),_0x27df27,_0xf752('0x1a'));_0x81a9e4(_0x39ea2e[_0xf752('0x1e')]['message']);}})[_0xf752('0x1f')](function(_0x8e5ac0){logger[_0xf752('0x1c')](_0xf752('0x19'),_0x27df27,_0x8e5ac0);_0x556e4b(_0x8e5ac0);});});}function respondWithStatusCode(_0x18f600,_0x3349f3){_0x3349f3=_0x3349f3||0xcc;return function(_0x2e859b){if(_0x2e859b){return _0x18f600['sendStatus'](_0x3349f3);}return _0x18f600['status'](_0x3349f3)['end']();};}function respondWithResult(_0x1db324,_0xc0f468){_0xc0f468=_0xc0f468||0xc8;return function(_0x4dd8ef){if(_0x4dd8ef){return _0x1db324[_0xf752('0x20')](_0xc0f468)['json'](_0x4dd8ef);}};}function respondWithFilteredResult(_0x39e640,_0x1cecea){return function(_0x45085c){if(_0x45085c){var _0x501e61=_0x45085c[_0xf752('0x21')],_0x1fbd02=_0x1cecea['offset'],_0x4a3550=_0x1cecea[_0xf752('0x22')]+_0x1cecea[_0xf752('0x23')],_0x1f5992;if(_0x4a3550>=_0x501e61){_0x4a3550=_0x501e61;_0x1f5992=0xc8;}else{_0x1f5992=0xce;}_0x39e640[_0xf752('0x20')](_0x1f5992);return _0x39e640['set'](_0xf752('0x24'),_0x1fbd02+'-'+_0x4a3550+'/'+_0x501e61)[_0xf752('0x25')](_0x45085c);}return null;};}function patchUpdates(_0x3ee2e8){return function(_0x3cd3ed){try{jsonpatch['apply'](_0x3cd3ed,_0x3ee2e8,!![]);}catch(_0x2dc82b){return BPromise[_0xf752('0x26')](_0x2dc82b);}return _0x3cd3ed[_0xf752('0x27')]();};}function saveUpdates(_0x171e73,_0x33da0c){return function(_0x270cae){if(_0x270cae){return _0x270cae[_0xf752('0x28')](_0x171e73)[_0xf752('0x17')](function(_0x527326){return _0x527326;});}return null;};}function removeEntity(_0x538728,_0xdeb404){return function(_0x39d2b4){if(_0x39d2b4){return _0x39d2b4['destroy']()[_0xf752('0x17')](function(){var _0x3fbc34=_0x39d2b4[_0xf752('0x29')]({'plain':!![]});var _0x30205b='WhatsappAccounts';return db[_0xf752('0x2a')][_0xf752('0x2b')]({'where':{'type':_0x30205b,'resourceId':_0x3fbc34['id']}})[_0xf752('0x17')](function(){return _0x39d2b4;});})[_0xf752('0x17')](function(){_0x538728[_0xf752('0x20')](0xcc)[_0xf752('0x2c')]();});}};}function handleEntityNotFound(_0x1e90f6,_0xbd35a0){return function(_0x4cf01e){if(!_0x4cf01e){_0x1e90f6[_0xf752('0x2d')](0x194);}return _0x4cf01e;};}function handleError(_0x3c4ed1,_0x21cf1f){_0x21cf1f=_0x21cf1f||0x1f4;return function(_0x5bf0c6){logger['error'](_0x5bf0c6[_0xf752('0x2e')]);if(_0x5bf0c6[_0xf752('0x2f')]){delete _0x5bf0c6[_0xf752('0x2f')];}_0x3c4ed1[_0xf752('0x20')](_0x21cf1f)['send'](_0x5bf0c6);};}exports[_0xf752('0x30')]=function(_0x5af207,_0x4f94eb){var _0x1fec9a={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2eb5d7={},_0x45e7de={'count':0x0,'rows':[]};var _0xb3f4f4=_[_0xf752('0x31')](db[_0xf752('0x32')][_0xf752('0x33')],function(_0x350a11){return{'name':_0x350a11[_0xf752('0x34')],'type':_0x350a11['type'][_0xf752('0x35')]};});_0x2eb5d7[_0xf752('0x36')]=_['map'](_0xb3f4f4,_0xf752('0x2f'));_0x2eb5d7[_0xf752('0x37')]=_[_0xf752('0x38')](_0x5af207['query']);_0x2eb5d7[_0xf752('0x39')]=_[_0xf752('0x3a')](_0x2eb5d7[_0xf752('0x36')],_0x2eb5d7[_0xf752('0x37')]);_0x1fec9a[_0xf752('0x3b')]=_[_0xf752('0x3a')](_0x2eb5d7[_0xf752('0x36')],qs[_0xf752('0x3c')](_0x5af207[_0xf752('0x37')][_0xf752('0x3c')]));_0x1fec9a['attributes']=_0x1fec9a['attributes']['length']?_0x1fec9a[_0xf752('0x3b')]:_0x2eb5d7[_0xf752('0x36')];if(!_0x5af207[_0xf752('0x37')][_0xf752('0x3d')]('nolimit')){_0x1fec9a['limit']=qs['limit'](_0x5af207['query']['limit']);_0x1fec9a[_0xf752('0x22')]=qs['offset'](_0x5af207['query'][_0xf752('0x22')]);}_0x1fec9a[_0xf752('0x3e')]=qs[_0xf752('0x3f')](_0x5af207[_0xf752('0x37')][_0xf752('0x3f')]);_0x1fec9a[_0xf752('0x40')]=qs[_0xf752('0x39')](_[_0xf752('0x41')](_0x5af207['query'],_0x2eb5d7[_0xf752('0x39')]),_0xb3f4f4);if(_0x5af207[_0xf752('0x37')][_0xf752('0x42')]){_0x1fec9a[_0xf752('0x40')]=_[_0xf752('0x43')](_0x1fec9a[_0xf752('0x40')],{'$or':_[_0xf752('0x31')](_0xb3f4f4,function(_0x19a9d6){if(_0x19a9d6[_0xf752('0x44')]!=='VIRTUAL'){var _0x5a56c4={};_0x5a56c4[_0x19a9d6['name']]={'$like':'%'+_0x5af207[_0xf752('0x37')][_0xf752('0x42')]+'%'};return _0x5a56c4;}})});}_0x1fec9a=_[_0xf752('0x43')]({},_0x1fec9a,_0x5af207['options']);var _0x5cd54a={'where':_0x1fec9a['where']};return db[_0xf752('0x32')][_0xf752('0x21')](_0x5cd54a)[_0xf752('0x17')](function(_0x566754){_0x45e7de[_0xf752('0x21')]=_0x566754;if(_0x5af207['query'][_0xf752('0x45')]){_0x1fec9a[_0xf752('0x46')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xf752('0x47')](_0x1fec9a);})['then'](function(_0x4b8cea){_0x45e7de['rows']=_0x4b8cea;return _0x45e7de;})[_0xf752('0x17')](respondWithFilteredResult(_0x4f94eb,_0x1fec9a))['catch'](handleError(_0x4f94eb,null));};exports[_0xf752('0x48')]=function(_0x5772f3,_0x2da745){var _0x7c91be={'raw':![],'where':{'id':_0x5772f3[_0xf752('0x49')]['id']},'include':[{'model':db[_0xf752('0x4a')],'as':'mandatoryDispositionPause'}]},_0x21a272={};_0x21a272[_0xf752('0x36')]=_[_0xf752('0x38')](db['WhatsappAccount']['rawAttributes']);_0x21a272[_0xf752('0x37')]=_[_0xf752('0x38')](_0x5772f3[_0xf752('0x37')]);_0x21a272[_0xf752('0x4b')]=_[_0xf752('0x3a')](_0x21a272[_0xf752('0x36')],_0x21a272[_0xf752('0x37')]);_0x7c91be[_0xf752('0x3b')]=_[_0xf752('0x3a')](_0x21a272[_0xf752('0x36')],qs[_0xf752('0x3c')](_0x5772f3['query'][_0xf752('0x3c')]));_0x7c91be[_0xf752('0x3b')]=_0x7c91be['attributes'][_0xf752('0x4c')]?_0x7c91be[_0xf752('0x3b')]:_0x21a272['model'];if(_0x5772f3['query']['includeAll']){_0x7c91be[_0xf752('0x46')]=[{'all':!![]}];}_0x7c91be=_[_0xf752('0x43')]({},_0x7c91be,_0x5772f3[_0xf752('0x4d')]);return db['WhatsappAccount'][_0xf752('0x4e')](_0x7c91be)['then'](handleEntityNotFound(_0x2da745,null))['then'](respondWithResult(_0x2da745,null))['catch'](handleError(_0x2da745,null));};exports[_0xf752('0x4f')]=function(_0x51cb77,_0x11aa99){return db[_0xf752('0x32')]['create'](_0x51cb77[_0xf752('0x50')],{})[_0xf752('0x17')](function(_0xfbb842){var _0x2d1437=_0x51cb77[_0xf752('0x51')]['get']({'plain':!![]});if(!_0x2d1437)throw new Error(_0xf752('0x52'));if(_0x2d1437[_0xf752('0x53')]==='user'){var _0x259504=_0xfbb842[_0xf752('0x29')]({'plain':!![]});var _0x488409='WhatsappAccounts';return db[_0xf752('0x54')]['find']({'where':{'name':_0x488409,'userProfileId':_0x2d1437[_0xf752('0x55')]},'raw':!![]})[_0xf752('0x17')](function(_0x714e1d){if(_0x714e1d&&_0x714e1d[_0xf752('0x56')]===0x0){return db[_0xf752('0x2a')][_0xf752('0x4f')]({'name':_0x259504[_0xf752('0x2f')],'resourceId':_0x259504['id'],'type':_0x714e1d[_0xf752('0x2f')],'sectionId':_0x714e1d['id']},{})['then'](function(){return _0xfbb842;});}else{return _0xfbb842;}})[_0xf752('0x1f')](function(_0x1f6e29){logger['error'](_0xf752('0x57'),_0x1f6e29);throw _0x1f6e29;});}return _0xfbb842;})[_0xf752('0x17')](respondWithResult(_0x11aa99,0xc9))[_0xf752('0x1f')](handleError(_0x11aa99,null));};exports[_0xf752('0x28')]=function(_0x364bf2,_0x597d69){if(_0x364bf2['body']['id']){delete _0x364bf2[_0xf752('0x50')]['id'];}return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x364bf2[_0xf752('0x49')]['id']},'include':[{'model':db['Pause'],'as':_0xf752('0x58')}]})['then'](handleEntityNotFound(_0x597d69,null))['then'](saveUpdates(_0x364bf2[_0xf752('0x50')],null))[_0xf752('0x17')](respondWithResult(_0x597d69,null))[_0xf752('0x1f')](handleError(_0x597d69,null));};exports[_0xf752('0x2b')]=function(_0x2d35d2,_0x123d1a){return db[_0xf752('0x32')]['find']({'where':{'id':_0x2d35d2['params']['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x123d1a,null))[_0xf752('0x17')](removeEntity(_0x123d1a,null))[_0xf752('0x1f')](handleError(_0x123d1a,null));};exports[_0xf752('0x59')]=function(_0x22a78a,_0x1fc4f8){return db[_0xf752('0x32')][_0xf752('0x59')]()[_0xf752('0x17')](respondWithResult(_0x1fc4f8,null))[_0xf752('0x1f')](handleError(_0x1fc4f8,null));};exports[_0xf752('0x5a')]=function(_0x123d23,_0x532552,_0x3fe82f){if(_0x123d23['body']['id']){delete _0x123d23[_0xf752('0x50')]['id'];}return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x123d23[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x532552,null))[_0xf752('0x17')](function(_0x5e2287){if(_0x5e2287){_0x123d23['body']['WhatsappAccountId']=_0x5e2287['id'];return db[_0xf752('0x5b')][_0xf752('0x4f')](_0x123d23[_0xf752('0x50')]);}})['then'](respondWithResult(_0x532552,null))['catch'](handleError(_0x532552,null));};exports[_0xf752('0x5c')]=function(_0x3f6e24,_0x3949bc,_0x3f43c9){var _0x3ac5ae={'raw':![],'where':{}};var _0x423e0c={};var _0x4818da={'count':0x0,'rows':[]};return db[_0xf752('0x32')][_0xf752('0x5d')]({'where':{'id':_0x3f6e24[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x3949bc,null))[_0xf752('0x17')](function(_0x4ef33f){if(_0x4ef33f){_0x423e0c[_0xf752('0x36')]=_[_0xf752('0x38')](db[_0xf752('0x5b')][_0xf752('0x33')]);_0x423e0c['query']=_['keys'](_0x3f6e24[_0xf752('0x37')]);_0x423e0c[_0xf752('0x39')]=_[_0xf752('0x3a')](_0x423e0c[_0xf752('0x36')],_0x423e0c[_0xf752('0x37')]);_0x3ac5ae[_0xf752('0x3b')]=_[_0xf752('0x3a')](_0x423e0c['model'],qs[_0xf752('0x3c')](_0x3f6e24[_0xf752('0x37')][_0xf752('0x3c')]));_0x3ac5ae['attributes']=_0x3ac5ae[_0xf752('0x3b')][_0xf752('0x4c')]?_0x3ac5ae[_0xf752('0x3b')]:_0x423e0c[_0xf752('0x36')];if(!_0x3f6e24[_0xf752('0x37')]['hasOwnProperty'](_0xf752('0x5e'))){_0x3ac5ae[_0xf752('0x23')]=qs[_0xf752('0x23')](_0x3f6e24[_0xf752('0x37')][_0xf752('0x23')]);_0x3ac5ae[_0xf752('0x22')]=qs[_0xf752('0x22')](_0x3f6e24['query'][_0xf752('0x22')]);}_0x3ac5ae[_0xf752('0x3e')]=qs[_0xf752('0x3f')](_0x3f6e24[_0xf752('0x37')][_0xf752('0x3f')]);_0x3ac5ae['where']=qs['filters'](_[_0xf752('0x41')](_0x3f6e24[_0xf752('0x37')],_0x423e0c[_0xf752('0x39')]));_0x3ac5ae[_0xf752('0x40')][_0xf752('0x5f')]=_0x4ef33f['id'];if(_0x3f6e24[_0xf752('0x37')][_0xf752('0x42')]){_0x3ac5ae[_0xf752('0x40')]=_[_0xf752('0x43')](_0x3ac5ae[_0xf752('0x40')],{'$or':_[_0xf752('0x31')](_0x3ac5ae[_0xf752('0x3b')],function(_0x39c17b){var _0x5f0e02={};_0x5f0e02[_0x39c17b]={'$like':'%'+_0x3f6e24['query'][_0xf752('0x42')]+'%'};return _0x5f0e02;})});}_0x3ac5ae=_[_0xf752('0x43')]({},_0x3ac5ae,_0x3f6e24[_0xf752('0x4d')]);return db[_0xf752('0x5b')]['count']({'where':_0x3ac5ae[_0xf752('0x40')]})[_0xf752('0x17')](function(_0x133e7b){_0x4818da[_0xf752('0x21')]=_0x133e7b;if(_0x3f6e24[_0xf752('0x37')][_0xf752('0x45')]){_0x3ac5ae['include']=[{'all':!![]}];}return db[_0xf752('0x5b')][_0xf752('0x47')](_0x3ac5ae);})[_0xf752('0x17')](function(_0x31ef42){_0x4818da[_0xf752('0x60')]=_0x31ef42;return _0x4818da;});}})[_0xf752('0x17')](respondWithFilteredResult(_0x3949bc,_0x3ac5ae))[_0xf752('0x1f')](handleError(_0x3949bc,null));};exports['removeDispositions']=function(_0x494789,_0x1a41c4,_0x380fd8){return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x494789[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x1a41c4,null))[_0xf752('0x17')](function(_0x1675fb){if(_0x1675fb){return _0x1675fb['removeDispositions'](_0x494789[_0xf752('0x37')]['ids']);}})[_0xf752('0x17')](respondWithStatusCode(_0x1a41c4,null))[_0xf752('0x1f')](handleError(_0x1a41c4,null));};exports[_0xf752('0x61')]=function(_0x13ca6b,_0x4c1a38,_0x883295){if(_0x13ca6b[_0xf752('0x50')]['id']){delete _0x13ca6b[_0xf752('0x50')]['id'];}return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x13ca6b[_0xf752('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c1a38,null))[_0xf752('0x17')](function(_0x3483dc){if(_0x3483dc){_0x13ca6b[_0xf752('0x50')][_0xf752('0x5f')]=_0x3483dc['id'];return db['CannedAnswer']['create'](_0x13ca6b[_0xf752('0x50')]);}})[_0xf752('0x17')](respondWithResult(_0x4c1a38,null))['catch'](handleError(_0x4c1a38,null));};exports[_0xf752('0x62')]=function(_0x5c371a,_0x87bcad,_0x4d1144){var _0x3dd4a8={'raw':![],'where':{}};var _0x5e5280={};var _0x234e22={'count':0x0,'rows':[]};return db[_0xf752('0x32')][_0xf752('0x5d')]({'where':{'id':_0x5c371a[_0xf752('0x49')]['id']}})['then'](handleEntityNotFound(_0x87bcad,null))[_0xf752('0x17')](function(_0x21be66){if(_0x21be66){_0x5e5280['model']=_[_0xf752('0x38')](db[_0xf752('0x63')]['rawAttributes']);_0x5e5280[_0xf752('0x37')]=_[_0xf752('0x38')](_0x5c371a[_0xf752('0x37')]);_0x5e5280[_0xf752('0x39')]=_['intersection'](_0x5e5280[_0xf752('0x36')],_0x5e5280['query']);_0x3dd4a8[_0xf752('0x3b')]=_[_0xf752('0x3a')](_0x5e5280[_0xf752('0x36')],qs[_0xf752('0x3c')](_0x5c371a[_0xf752('0x37')][_0xf752('0x3c')]));_0x3dd4a8[_0xf752('0x3b')]=_0x3dd4a8['attributes'][_0xf752('0x4c')]?_0x3dd4a8[_0xf752('0x3b')]:_0x5e5280['model'];if(!_0x5c371a[_0xf752('0x37')]['hasOwnProperty'](_0xf752('0x5e'))){_0x3dd4a8[_0xf752('0x23')]=qs[_0xf752('0x23')](_0x5c371a[_0xf752('0x37')][_0xf752('0x23')]);_0x3dd4a8[_0xf752('0x22')]=qs['offset'](_0x5c371a[_0xf752('0x37')]['offset']);}_0x3dd4a8['order']=qs[_0xf752('0x3f')](_0x5c371a['query'][_0xf752('0x3f')]);_0x3dd4a8[_0xf752('0x40')]=qs['filters'](_['pick'](_0x5c371a[_0xf752('0x37')],_0x5e5280['filters']));_0x3dd4a8[_0xf752('0x40')][_0xf752('0x5f')]=_0x21be66['id'];if(_0x5c371a[_0xf752('0x37')][_0xf752('0x42')]){_0x3dd4a8['where']=_['merge'](_0x3dd4a8[_0xf752('0x40')],{'$or':_[_0xf752('0x31')](_0x3dd4a8[_0xf752('0x3b')],function(_0x44095a){var _0x4f8653={};_0x4f8653[_0x44095a]={'$like':'%'+_0x5c371a[_0xf752('0x37')][_0xf752('0x42')]+'%'};return _0x4f8653;})});}_0x3dd4a8=_['merge']({},_0x3dd4a8,_0x5c371a[_0xf752('0x4d')]);return db['CannedAnswer'][_0xf752('0x21')]({'where':_0x3dd4a8[_0xf752('0x40')]})['then'](function(_0x4faad2){_0x234e22[_0xf752('0x21')]=_0x4faad2;if(_0x5c371a[_0xf752('0x37')]['includeAll']){_0x3dd4a8[_0xf752('0x46')]=[{'all':!![]}];}return db[_0xf752('0x63')][_0xf752('0x47')](_0x3dd4a8);})[_0xf752('0x17')](function(_0x5621e5){_0x234e22[_0xf752('0x60')]=_0x5621e5;return _0x234e22;});}})[_0xf752('0x17')](respondWithFilteredResult(_0x87bcad,_0x3dd4a8))[_0xf752('0x1f')](handleError(_0x87bcad,null));};exports['removeAnswers']=function(_0x37b0d7,_0x44ff17,_0x45f45c){return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x37b0d7[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x44ff17,null))[_0xf752('0x17')](function(_0x5e5afb){if(_0x5e5afb){return _0x5e5afb[_0xf752('0x64')](_0x37b0d7[_0xf752('0x37')][_0xf752('0x65')]);}})[_0xf752('0x17')](respondWithStatusCode(_0x44ff17,null))[_0xf752('0x1f')](handleError(_0x44ff17,null));};exports[_0xf752('0x66')]=function(_0x4c2b85,_0x592483,_0x3110aa){return db[_0xf752('0x32')]['find']({'where':{'id':_0x4c2b85['params']['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x592483,null))[_0xf752('0x17')](function(_0x2956a4){if(_0x2956a4){return _0x2956a4[_0xf752('0x66')](_0x4c2b85[_0xf752('0x50')]['ids'],_['omit'](_0x4c2b85[_0xf752('0x50')],[_0xf752('0x65'),'id'])||{})[_0xf752('0x67')](function(_0x223959){for(var _0x14293d=0x0;_0x14293d<_0x4c2b85[_0xf752('0x50')][_0xf752('0x65')][_0xf752('0x4c')];_0x14293d+=0x1){socket[_0xf752('0x68')](_0xf752('0x69'),{'UserId':_0x4c2b85['body'][_0xf752('0x65')][_0x14293d],'WhatsappAccountId':_0x4c2b85[_0xf752('0x49')]['id']});}return _0x223959;});}})['then'](respondWithResult(_0x592483,null))[_0xf752('0x1f')](handleError(_0x592483,null));};exports[_0xf752('0x6a')]=function(_0x4685ec,_0x37eb77,_0x6e002f){return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x4685ec[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x37eb77,null))[_0xf752('0x17')](function(_0x1d121a){if(_0x1d121a){return _0x1d121a[_0xf752('0x6a')](_0x4685ec[_0xf752('0x37')][_0xf752('0x65')])[_0xf752('0x17')](function(){if(_[_0xf752('0x6b')](_0x4685ec[_0xf752('0x37')][_0xf752('0x65')])){for(var _0x193501=0x0;_0x193501<_0x4685ec['query'][_0xf752('0x65')]['length'];_0x193501+=0x1){socket[_0xf752('0x68')](_0xf752('0x6c'),{'UserId':Number(_0x4685ec['query'][_0xf752('0x65')][_0x193501]),'WhatsappAccountId':Number(_0x4685ec[_0xf752('0x49')]['id'])});}}else{socket[_0xf752('0x68')](_0xf752('0x6c'),{'UserId':Number(_0x4685ec[_0xf752('0x37')][_0xf752('0x65')]),'WhatsappAccountId':Number(_0x4685ec[_0xf752('0x49')]['id'])});}});}})[_0xf752('0x17')](respondWithStatusCode(_0x37eb77,null))[_0xf752('0x1f')](handleError(_0x37eb77,null));};exports[_0xf752('0x6d')]=function(_0x25489b,_0x29d490,_0x10fafa){var _0x2f5ce7={};var _0x96ee05={};var _0x1fb207;var _0x4c39e2;return db[_0xf752('0x32')][_0xf752('0x5d')]({'where':{'id':_0x25489b[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x29d490,null))[_0xf752('0x17')](function(_0x2fa5e0){if(_0x2fa5e0){_0x1fb207=_0x2fa5e0;_0x96ee05[_0xf752('0x36')]=_['keys'](db[_0xf752('0x6e')][_0xf752('0x33')]);_0x96ee05[_0xf752('0x37')]=_['keys'](_0x25489b[_0xf752('0x37')]);_0x96ee05[_0xf752('0x39')]=_[_0xf752('0x3a')](_0x96ee05['model'],_0x96ee05[_0xf752('0x37')]);_0x2f5ce7[_0xf752('0x3b')]=_['intersection'](_0x96ee05[_0xf752('0x36')],qs['fields'](_0x25489b['query'][_0xf752('0x3c')]));_0x2f5ce7[_0xf752('0x3b')]=_0x2f5ce7[_0xf752('0x3b')]['length']?_0x2f5ce7[_0xf752('0x3b')]:_0x96ee05['model'];_0x2f5ce7['order']=qs[_0xf752('0x3f')](_0x25489b['query'][_0xf752('0x3f')]);_0x2f5ce7[_0xf752('0x40')]=qs['filters'](_['pick'](_0x25489b[_0xf752('0x37')],_0x96ee05[_0xf752('0x39')]));if(_0x25489b['query'][_0xf752('0x42')]){_0x2f5ce7[_0xf752('0x40')]=_['merge'](_0x2f5ce7[_0xf752('0x40')],{'$or':_[_0xf752('0x31')](_0x2f5ce7[_0xf752('0x3b')],function(_0x515986){var _0x53d378={};_0x53d378[_0x515986]={'$like':'%'+_0x25489b[_0xf752('0x37')][_0xf752('0x42')]+'%'};return _0x53d378;})});}_0x2f5ce7=_[_0xf752('0x43')]({},_0x2f5ce7,_0x25489b['options']);return _0x1fb207[_0xf752('0x6d')](_0x2f5ce7);}})[_0xf752('0x17')](function(_0xa5b024){if(_0xa5b024){_0x4c39e2=_0xa5b024[_0xf752('0x4c')];if(!_0x25489b[_0xf752('0x37')][_0xf752('0x3d')]('nolimit')){_0x2f5ce7[_0xf752('0x23')]=qs[_0xf752('0x23')](_0x25489b[_0xf752('0x37')][_0xf752('0x23')]);_0x2f5ce7[_0xf752('0x22')]=qs[_0xf752('0x22')](_0x25489b[_0xf752('0x37')][_0xf752('0x22')]);}return _0x1fb207[_0xf752('0x6d')](_0x2f5ce7);}})[_0xf752('0x17')](function(_0x4cdd5f){if(_0x4cdd5f){return _0x4cdd5f?{'count':_0x4c39e2,'rows':_0x4cdd5f}:null;}})[_0xf752('0x17')](respondWithResult(_0x29d490,null))[_0xf752('0x1f')](handleError(_0x29d490,null));};exports[_0xf752('0x6f')]=function(_0x1a4a27,_0x369e84,_0x5c2a9e){return db[_0xf752('0x32')][_0xf752('0x5d')]({'where':{'id':_0x1a4a27[_0xf752('0x49')]['id']}})[_0xf752('0x17')](handleEntityNotFound(_0x369e84,null))[_0xf752('0x17')](function(_0x421542){if(_0x421542){return db['sequelize'][_0xf752('0x70')](function(_0x3acdb9){return db[_0xf752('0x71')][_0xf752('0x2b')]({'where':{'WhatsappAccountId':_0x1a4a27[_0xf752('0x49')]['id']},'transaction':_0x3acdb9})[_0xf752('0x17')](function(_0x31ff75){var _0x44e6af=_[_0xf752('0x31')](_0x1a4a27['body'],function(_0x26eb0e){_0x26eb0e[_0xf752('0x5f')]=_0x1a4a27[_0xf752('0x49')]['id'];return _0x26eb0e;});return db[_0xf752('0x71')][_0xf752('0x72')](_0x44e6af,{'transaction':_0x3acdb9});});})[_0xf752('0x17')](function(){return db[_0xf752('0x71')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x1a4a27[_0xf752('0x49')]['id']},'order':_0xf752('0x73')});});}})[_0xf752('0x17')](respondWithResult(_0x369e84,null))[_0xf752('0x1f')](handleError(_0x369e84,null));};exports['getApplications']=function(_0x4d4255,_0x180fd4,_0x3d7864){var _0x5e88dd={};var _0x1f8f90={};var _0xfbdfa4;var _0x5cedca;return db[_0xf752('0x32')]['findOne']({'where':{'id':_0x4d4255[_0xf752('0x49')]['id']}})['then'](handleEntityNotFound(_0x180fd4,null))[_0xf752('0x17')](function(_0x52e4df){if(_0x52e4df){_0xfbdfa4=_0x52e4df;_0x1f8f90['model']=_[_0xf752('0x38')](db[_0xf752('0x71')][_0xf752('0x33')]);_0x1f8f90[_0xf752('0x37')]=_['keys'](_0x4d4255[_0xf752('0x37')]);_0x1f8f90['filters']=_[_0xf752('0x3a')](_0x1f8f90[_0xf752('0x36')],_0x1f8f90[_0xf752('0x37')]);_0x5e88dd[_0xf752('0x3b')]=_[_0xf752('0x3a')](_0x1f8f90[_0xf752('0x36')],qs['fields'](_0x4d4255['query'][_0xf752('0x3c')]));_0x5e88dd['attributes']=_0x5e88dd[_0xf752('0x3b')]['length']?_0x5e88dd['attributes']:_0x1f8f90[_0xf752('0x36')];_0x5e88dd['order']=qs[_0xf752('0x3f')](_0x4d4255[_0xf752('0x37')]['sort']);_0x5e88dd[_0xf752('0x40')]=qs[_0xf752('0x39')](_['pick'](_0x4d4255['query'],_0x1f8f90[_0xf752('0x39')]));if(_0x4d4255[_0xf752('0x37')][_0xf752('0x42')]){_0x5e88dd[_0xf752('0x40')]=_['merge'](_0x5e88dd[_0xf752('0x40')],{'$or':_[_0xf752('0x31')](_0x5e88dd[_0xf752('0x3b')],function(_0x2cb100){var _0x1789cf={};_0x1789cf[_0x2cb100]={'$like':'%'+_0x4d4255[_0xf752('0x37')][_0xf752('0x42')]+'%'};return _0x1789cf;})});}_0x5e88dd=_['merge']({},_0x5e88dd,_0x4d4255[_0xf752('0x4d')]);return _0xfbdfa4[_0xf752('0x74')](_0x5e88dd);}})['then'](function(_0x440c53){if(_0x440c53){_0x5cedca=_0x440c53[_0xf752('0x4c')];if(!_0x4d4255['query'][_0xf752('0x3d')](_0xf752('0x5e'))){_0x5e88dd[_0xf752('0x23')]=qs[_0xf752('0x23')](_0x4d4255[_0xf752('0x37')][_0xf752('0x23')]);_0x5e88dd['offset']=qs[_0xf752('0x22')](_0x4d4255[_0xf752('0x37')][_0xf752('0x22')]);}return _0xfbdfa4['getApplications'](_0x5e88dd);}})[_0xf752('0x17')](function(_0x3d040b){if(_0x3d040b){return _0x3d040b?{'count':_0x5cedca,'rows':_0x3d040b}:null;}})[_0xf752('0x17')](respondWithResult(_0x180fd4,null))['catch'](handleError(_0x180fd4,null));};exports[_0xf752('0x75')]=function(_0x26386f,_0x57af63,_0x55eddc){var _0x5d80b5={'channel':_0xf752('0x76')};var _0x243a11=[];var _0x43f4ae=[];var _0x947c84={};return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x26386f[_0xf752('0x49')]['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x57af63,null))[_0xf752('0x17')](function(_0x18f757){_0x5d80b5[_0xf752('0x77')]=_0x18f757;_0x5d80b5[_0xf752('0x78')]=_[_0xf752('0x79')](_0x18f757['Applications'],[_0xf752('0x73')],[_0xf752('0x7a')]);if(_0x5d80b5[_0xf752('0x77')][_0xf752('0x7b')]){delete _0x5d80b5['account']['Applications'];}return db['CmContact'][_0xf752('0x59')]();})[_0xf752('0x17')](function(_0x4c0403){if(!_0x4c0403){throw new db[(_0xf752('0x7c'))][(_0xf752('0x7d'))](_0xf752('0x7e'));}_0x243a11=_['difference'](_['keys'](_0x4c0403),[_0xf752('0x7f'),_0xf752('0x80')]);_0x43f4ae=_[_0xf752('0x81')](_['keys'](_0x4c0403),['createdAt',_0xf752('0x80'),_0xf752('0x82'),_0xf752('0x83')]);_0x5d80b5[_0xf752('0x50')]={'mapKey':_0xf752('0x84')};if(_0x5d80b5['account'][_0xf752('0x44')]&&_0x5d80b5[_0xf752('0x77')][_0xf752('0x44')]===_0xf752('0x85')){_0x5d80b5[_0xf752('0x50')]['from']=_0x26386f[_0xf752('0x50')][_0xf752('0x86')][_0xf752('0x87')]('whatsapp:','');_0x5d80b5[_0xf752('0x50')][_0xf752('0x50')]=_0x26386f[_0xf752('0x50')]['Body'];_0x5d80b5[_0xf752('0x50')]['messageId']=_0x26386f['body'][_0xf752('0x88')];}if(_0x5d80b5['body']['id']){delete _0x5d80b5['body']['id'];}if(_[_0xf752('0x89')](_0x5d80b5[_0xf752('0x50')][_0xf752('0x8a')])){throw new db[(_0xf752('0x7c'))][(_0xf752('0x7d'))]('from\x20is\x20mandatory');}if(_[_0xf752('0x89')](_0x5d80b5[_0xf752('0x50')]['body'])||_0x5d80b5[_0xf752('0x50')][_0xf752('0x50')]===''){throw new db[(_0xf752('0x7c'))][(_0xf752('0x7d'))](_0xf752('0x8b'));}if(_[_0xf752('0x89')](_0x5d80b5[_0xf752('0x50')]['mapKey'])){throw new db[(_0xf752('0x7c'))][(_0xf752('0x7d'))](_0xf752('0x8c')+_0x43f4ae);}if(!_[_0xf752('0x8d')](_0x43f4ae,_0x5d80b5[_0xf752('0x50')][_0xf752('0x8e')])){throw new db[(_0xf752('0x7c'))]['ValidationError'](_0xf752('0x8f')+_0x43f4ae);}_0x947c84[_0x5d80b5[_0xf752('0x50')]['mapKey']]=_0x5d80b5['body'][_0xf752('0x8a')];return db[_0xf752('0x90')][_0xf752('0x4e')]({'where':{'id':_0x5d80b5[_0xf752('0x77')][_0xf752('0x83')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x947c84,'limit':0x1,'order':[[_0xf752('0x80'),_0xf752('0x91')]]}]});})[_0xf752('0x17')](handleEntityNotFound(_0x57af63,null))['then'](function(_0x3994a2){if(_0x3994a2){_0x5d80b5[_0xf752('0x92')]=_[_0xf752('0x93')](_0x3994a2,['Contacts']);if(_0x3994a2[_0xf752('0x94')][_0xf752('0x4c')]){return _0x3994a2[_0xf752('0x94')][0x0];}var _0x25e871=_[_0xf752('0x95')](_0x5d80b5[_0xf752('0x50')],{'firstName':_0x5d80b5[_0xf752('0x50')][_0xf752('0x8a')],'ListId':_0x3994a2['id']});_0x25e871[_0x5d80b5[_0xf752('0x50')][_0xf752('0x8e')]]=_0x5d80b5[_0xf752('0x50')]['from'];return db[_0xf752('0x96')][_0xf752('0x4f')](_0x25e871,{'fields':_0x243a11,'raw':!![]});}})['then'](handleEntityNotFound(_0x57af63,null))[_0xf752('0x17')](function(_0x5d333f){if(_0x5d333f){_0x5d80b5[_0xf752('0x97')]=_0x5d333f;var _0x5d46ef={'ContactId':_0x5d333f['id'],'phone':_0x5d80b5[_0xf752('0x50')][_0xf752('0x8a')],'WhatsappAccountId':_0x26386f['params']['id']};var _0x11bccc={'ContactId':_0x5d333f['id'],'WhatsappAccountId':_0x26386f[_0xf752('0x49')]['id'],'closed':![]};return db[_0xf752('0x98')][_0xf752('0x4e')]({'where':_0x11bccc})[_0xf752('0x17')](function(_0x5b47a0){if(_0x5b47a0){return[_0x5b47a0,![]];}return db[_0xf752('0x98')][_0xf752('0x4f')](_0x5d46ef)[_0xf752('0x17')](function(_0x480edb){return[_0x480edb,!![]];});});}})[_0xf752('0x67')](function(_0x4b5ade,_0x253275){_0x5d80b5[_0xf752('0x99')]=_0x4b5ade['get']({'plain':!![]});_0x5d80b5['interaction'][_0xf752('0x9a')]=![];if(_0x253275){if(_0x5d80b5[_0xf752('0x77')][_0xf752('0x9b')]){_0x5d80b5[_0xf752('0x78')]['push']({'id':0x0,'priority':_0x5d80b5[_0xf752('0x78')][_0xf752('0x4c')]+0x1,'app':_0xf752('0x9c'),'appdata':_0xf752('0x9d'),'interval':_0xf752('0x9e')});}_0x5d80b5[_0xf752('0x99')][_0xf752('0x9a')]=!![];}return db['WhatsappMessage'][_0xf752('0x4f')]({'phone':_0x5d80b5[_0xf752('0x50')][_0xf752('0x8a')],'messageId':_0x5d80b5[_0xf752('0x50')][_0xf752('0x9f')],'body':_0x5d80b5['body'][_0xf752('0x50')],'WhatsappAccountId':_0x26386f['params']['id'],'WhatsappInteractionId':_0x4b5ade['id'],'direction':'in','ContactId':_0x4b5ade[_0xf752('0xa0')],'AttachmentId':_0x5d80b5[_0xf752('0x50')]['AttachmentId']});})['then'](function(_0x4f00df){_0x5d80b5['message']=_0x4f00df;if(_0x5d80b5[_0xf752('0x99')][_0xf752('0xa1')]){return db['User'][_0xf752('0x4e')]({'attributes':['id',_0xf752('0x2f')],'where':{'id':_0x5d80b5[_0xf752('0x99')][_0xf752('0xa1')]}})[_0xf752('0x17')](function(_0x5b5e2a){if(_0x5b5e2a){_0x5d80b5[_0xf752('0x78')][_0xf752('0xa2')]({'id':0x0,'priority':0x0,'app':_0xf752('0xa3'),'appdata':_0x5b5e2a['name']+','+(_0x5d80b5[_0xf752('0x77')][_0xf752('0xa4')]||0xa),'interval':_0xf752('0x9e')});}return respondWithRpcPromise(_0xf752('0xa5'),_0xf752('0xa6'),_0x5d80b5);});}return respondWithRpcPromise('Start',_0xf752('0xa6'),_0x5d80b5);})[_0xf752('0x17')](function(_0xae042d){if(_0xae042d){var _0x13e2b4=0xc8;var _0x2d4cee=_0xf752('0xa7');logger[_0xf752('0x18')](_0xf752('0xa8'),_0x2d4cee,_0x13e2b4,_0xf752('0xa9'));logger['debug'](_0xf752('0xaa'),_0x2d4cee,_0x13e2b4,_0xf752('0xa9'),JSON['stringify'](_0xae042d));if(_0x5d80b5[_0xf752('0x77')][_0xf752('0x44')]===_0xf752('0x85')){return _0x57af63['status'](_0x13e2b4)[_0xf752('0xab')](_0xf752('0xac'),_0xf752('0xad'))[_0xf752('0xae')](_0xf752('0xaf'));}else{return _0x57af63[_0xf752('0x20')](_0x13e2b4)[_0xf752('0x25')](_0xae042d);}}})[_0xf752('0x1f')](handleError(_0x57af63,null));};exports['send']=function(_0x429d10,_0x5d13c7,_0x255762){var _0x1a2727,_0x4a9c29,_0x3407c8;if(_[_0xf752('0x89')](_0x429d10['body'][_0xf752('0x50')])||_0x429d10[_0xf752('0x50')][_0xf752('0x50')]===''){throw new db[(_0xf752('0x7c'))][(_0xf752('0x7d'))](_0xf752('0x8b'));}if(_[_0xf752('0x89')](_0x429d10['body']['to'])){throw new db['Sequelize'][(_0xf752('0x7d'))](_0xf752('0xb0'));}_0x1a2727=_0x429d10['body']['to'];return db[_0xf752('0x32')][_0xf752('0x4e')]({'where':{'id':_0x429d10[_0xf752('0x49')]['id']},'include':[{'model':db[_0xf752('0x90')],'as':_0xf752('0xb1'),'include':[{'model':db[_0xf752('0x96')],'as':'Contacts','where':{'mobile':_0x1a2727},'limit':0x1,'order':[[_0xf752('0x80'),_0xf752('0x91')]]}]}]})[_0xf752('0x17')](handleEntityNotFound(_0x5d13c7,null))[_0xf752('0x17')](function(_0xd786ea){if(_0xd786ea&&_0xd786ea[_0xf752('0xb1')]){_0x4a9c29=_0xd786ea[_0xf752('0x29')]({'plain':!![]});if(_0x4a9c29['List']&&_0x4a9c29['List'][_0xf752('0x94')][_0xf752('0x4c')]){return _0x4a9c29[_0xf752('0xb1')][_0xf752('0x94')][0x0];}return db[_0xf752('0x96')][_0xf752('0x4f')](_[_0xf752('0x95')](_0x429d10[_0xf752('0x50')],{'firstName':_0x1a2727,'mobile':_0x1a2727,'phone':_0x1a2727,'ListId':_0x4a9c29['ListId']}));}})['then'](handleEntityNotFound(_0x5d13c7,null))['then'](function(_0x41e0f6){if(_0x41e0f6){_0x3407c8=_0x41e0f6;return db[_0xf752('0x98')]['find']({'where':{'ContactId':_0x3407c8['id'],'closed':![],'WhatsappAccountId':_0x4a9c29['id']}})[_0xf752('0x17')](function(_0x23f8a){if(_0x23f8a){return[_0x23f8a,![]];}return db[_0xf752('0x98')][_0xf752('0x4f')]({'UserId':_0x429d10['user']['id'],'ContactId':_0x3407c8['id'],'WhatsappAccountId':_0x4a9c29['id'],'phone':_0x1a2727,'firstMsgDirection':_0xf752('0xb2'),'Messages':[_[_0xf752('0x43')](_0x429d10[_0xf752('0x50')],{'read':![],'body':_0x429d10[_0xf752('0x50')][_0xf752('0x50')],'phone':_0x1a2727,'WhatsappAccountId':_0x4a9c29['id'],'UserId':_0x429d10[_0xf752('0x51')]['id'],'ContactId':_0x3407c8['id']})]},{'include':[{'model':db[_0xf752('0xb3')],'as':_0xf752('0xb4')}]})[_0xf752('0x17')](function(_0x2edda1){return[_0x2edda1,!![]];});});}})['spread'](function(_0x57894b,_0x5c705e){if(_0x5c705e){return _0x57894b;}return db[_0xf752('0xb3')][_0xf752('0x4f')](_[_0xf752('0x43')](_0x429d10[_0xf752('0x50')],{'read':![],'body':_0x429d10[_0xf752('0x50')]['body'],'phone':_0x1a2727,'WhatsappAccountId':_0x4a9c29['id'],'WhatsappInteractionId':_0x57894b['id'],'UserId':_0x429d10[_0xf752('0x51')]['id'],'ContactId':_0x3407c8['id']}))[_0xf752('0x17')](function(_0x597864){_0x57894b[_0xf752('0xb5')][_0xf752('0xb4')]=[];_0x57894b['dataValues'][_0xf752('0xb4')]['push'](_0x597864['dataValues']);return _0x57894b;});})[_0xf752('0x17')](respondWithResult(_0x5d13c7,null))[_0xf752('0x1f')](handleError(_0x5d13c7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 34a01f9..1b6b798 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 _0xe5af=['emit','exports','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0xa26271,_0x56d0a7){var _0x41ec8d=function(_0x1fb1b1){while(--_0x1fb1b1){_0xa26271['push'](_0xa26271['shift']());}};_0x41ec8d(++_0x56d0a7);}(_0xe5af,0x9c));var _0xfe5a=function(_0x131e8c,_0x177e2c){_0x131e8c=_0x131e8c-0x0;var _0x4f2fd7=_0xe5af[_0x131e8c];return _0x4f2fd7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){WhatsappAccountEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);WhatsappAccountEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0x7c09=['WhatsappAccount','save','update','remove','hook','exports','../../mysqldb'];(function(_0xfa25c7,_0x5e6348){var _0x59ef0a=function(_0x57bf6a){while(--_0x57bf6a){_0xfa25c7['push'](_0xfa25c7['shift']());}};_0x59ef0a(++_0x5e6348);}(_0x7c09,0x102));var _0x97c0=function(_0xebf30,_0x721c57){_0xebf30=_0xebf30-0x0;var _0x2a2200=_0x7c09[_0xebf30];return _0x2a2200;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x97c0('0x0'))['db'][_0x97c0('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x97c0('0x2'),'afterUpdate':_0x97c0('0x3'),'afterDestroy':_0x97c0('0x4')};function emitEvent(_0x214897){return function(_0x12eb6d,_0x99bf54,_0x15c67b){WhatsappAccountEvents['emit'](_0x214897+':'+_0x12eb6d['id'],_0x12eb6d);WhatsappAccountEvents['emit'](_0x214897,_0x12eb6d);_0x15c67b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x97c0('0x5')](e,emitEvent(event));}}module[_0x97c0('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index ac42af3..f47225f 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 _0xb803=['WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./whatsappAccount.attributes','define'];(function(_0x59b075,_0x14dd26){var _0x263c60=function(_0x4324c1){while(--_0x4324c1){_0x59b075['push'](_0x59b075['shift']());}};_0x263c60(++_0x14dd26);}(_0xb803,0x9c));var _0x3b80=function(_0x38c22e,_0x1b6cef){_0x38c22e=_0x38c22e-0x0;var _0x48e7ab=_0xb803[_0x38c22e];return _0x48e7ab;};'use strict';var _=require(_0x3b80('0x0'));var util=require(_0x3b80('0x1'));var logger=require(_0x3b80('0x2'))('api');var moment=require(_0x3b80('0x3'));var BPromise=require(_0x3b80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b80('0x5'));var rimraf=require(_0x3b80('0x6'));var config=require('../../config/environment');var attributes=require(_0x3b80('0x7'));module['exports']=function(_0xea98e4,_0x5781fe){return _0xea98e4[_0x3b80('0x8')](_0x3b80('0x9'),attributes,{'tableName':_0x3b80('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf26e=['util','../../config/logger','api','bluebird','path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x877627,_0x4cc958){var _0x436b93=function(_0x2b31fe){while(--_0x2b31fe){_0x877627['push'](_0x877627['shift']());}};_0x436b93(++_0x4cc958);}(_0xf26e,0xbb));var _0xef26=function(_0x56efbd,_0x3db0c2){_0x56efbd=_0x56efbd-0x0;var _0x2ba3c9=_0xf26e[_0x56efbd];return _0x2ba3c9;};'use strict';var _=require('lodash');var util=require(_0xef26('0x0'));var logger=require(_0xef26('0x1'))(_0xef26('0x2'));var moment=require('moment');var BPromise=require(_0xef26('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef26('0x4'));var rimraf=require('rimraf');var config=require(_0xef26('0x5'));var attributes=require(_0xef26('0x6'));module[_0xef26('0x7')]=function(_0x5c5548,_0x5c90a3){return _0x5c5548[_0xef26('0x8')](_0xef26('0x9'),attributes,{'tableName':_0xef26('0xa'),'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 2d5d454..64c23d3 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 _0xafd0=['http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','find','options','raw','where','attributes','include','model','map','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0xafd0,0xb3));var _0x0afd=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xafd0[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var moment=require(_0x0afd('0x2'));var BPromise=require(_0x0afd('0x3'));var rs=require(_0x0afd('0x4'));var fs=require('fs');var Redis=require(_0x0afd('0x5'));var db=require(_0x0afd('0x6'))['db'];var utils=require(_0x0afd('0x7'));var logger=require(_0x0afd('0x8'))(_0x0afd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0afd('0xa')][_0x0afd('0xb')]({'port':0x232a});config[_0x0afd('0xc')]=_[_0x0afd('0xd')](config[_0x0afd('0xc')],{'host':_0x0afd('0xe'),'port':0x18eb});var socket=require(_0x0afd('0xf'))(new Redis(config['redis']));require(_0x0afd('0x10'))['register'](socket);function respondWithRpcPromise(_0x348dab,_0x344e5a,_0x412c81){return new BPromise(function(_0xa72d76,_0x4659cf){return client['request'](_0x348dab,_0x412c81)[_0x0afd('0x11')](function(_0x194e8b){logger['info'](_0x0afd('0x12'),_0x344e5a,_0x0afd('0x13'));logger[_0x0afd('0x14')](_0x0afd('0x15'),_0x344e5a,_0x0afd('0x13'),JSON[_0x0afd('0x16')](_0x194e8b));if(_0x194e8b['error']){if(_0x194e8b[_0x0afd('0x17')][_0x0afd('0x18')]===0x1f4){logger[_0x0afd('0x17')](_0x0afd('0x12'),_0x344e5a,_0x194e8b['error']['message']);return _0x4659cf(_0x194e8b['error']['message']);}logger['error'](_0x0afd('0x12'),_0x344e5a,_0x194e8b['error']['message']);return _0xa72d76(_0x194e8b[_0x0afd('0x17')][_0x0afd('0x19')]);}else{logger[_0x0afd('0x1a')](_0x0afd('0x12'),_0x344e5a,_0x0afd('0x13'));_0xa72d76(_0x194e8b[_0x0afd('0x1b')][_0x0afd('0x19')]);}})[_0x0afd('0x1c')](function(_0x27d33e){logger[_0x0afd('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x344e5a,_0x27d33e);_0x4659cf(_0x27d33e);});});}exports['ShowWhatsappAccount']=function(_0x2969dd){var _0x159262=this;return new Promise(function(_0xaec80b,_0x169066){return db['WhatsappAccount'][_0x0afd('0x1d')]({'raw':_0x2969dd[_0x0afd('0x1e')]?_0x2969dd[_0x0afd('0x1e')][_0x0afd('0x1f')]===undefined?!![]:![]:!![],'where':_0x2969dd[_0x0afd('0x1e')]?_0x2969dd[_0x0afd('0x1e')][_0x0afd('0x20')]||null:null,'attributes':_0x2969dd[_0x0afd('0x1e')]?_0x2969dd[_0x0afd('0x1e')][_0x0afd('0x21')]||null:null,'include':_0x2969dd[_0x0afd('0x1e')]?_0x2969dd[_0x0afd('0x1e')]['include']?_['map'](_0x2969dd[_0x0afd('0x1e')][_0x0afd('0x22')],function(_0x38a8d2){return{'model':db[_0x38a8d2[_0x0afd('0x23')]],'as':_0x38a8d2['as'],'attributes':_0x38a8d2['attributes'],'include':_0x38a8d2[_0x0afd('0x22')]?_[_0x0afd('0x24')](_0x38a8d2['include'],function(_0x32af48){return{'model':db[_0x32af48[_0x0afd('0x23')]],'as':_0x32af48['as'],'attributes':_0x32af48['attributes'],'include':_0x32af48[_0x0afd('0x22')]?_['map'](_0x32af48[_0x0afd('0x22')],function(_0x563b7a){return{'model':db[_0x563b7a[_0x0afd('0x23')]],'as':_0x563b7a['as'],'attributes':_0x563b7a[_0x0afd('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16bd5e){logger[_0x0afd('0x1a')]('ShowWhatsappAccount',_0x2969dd);logger[_0x0afd('0x14')](_0x0afd('0x25'),_0x2969dd,JSON[_0x0afd('0x16')](_0x16bd5e));_0xaec80b(_0x16bd5e);})[_0x0afd('0x1c')](function(_0xd80be6){logger[_0x0afd('0x17')]('ShowWhatsappAccount',_0xd80be6[_0x0afd('0x19')],_0x2969dd);_0x169066(_0x159262['error'](0x1f4,_0xd80be6[_0x0afd('0x19')]));});});}; \ No newline at end of file +var _0xfd96=['map','model','include','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes'];(function(_0x41f7f1,_0x3852ef){var _0x1e64fa=function(_0x13ec49){while(--_0x13ec49){_0x41f7f1['push'](_0x41f7f1['shift']());}};_0x1e64fa(++_0x3852ef);}(_0xfd96,0xe7));var _0x6fd9=function(_0x595635,_0x4acb1e){_0x595635=_0x595635-0x0;var _0x56e214=_0xfd96[_0x595635];return _0x56e214;};'use strict';var _=require(_0x6fd9('0x0'));var util=require('util');var moment=require(_0x6fd9('0x1'));var BPromise=require(_0x6fd9('0x2'));var rs=require(_0x6fd9('0x3'));var fs=require('fs');var Redis=require(_0x6fd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fd9('0x5'));var logger=require(_0x6fd9('0x6'))(_0x6fd9('0x7'));var config=require(_0x6fd9('0x8'));var jayson=require(_0x6fd9('0x9'));var client=jayson[_0x6fd9('0xa')][_0x6fd9('0xb')]({'port':0x232a});config[_0x6fd9('0xc')]=_['defaults'](config[_0x6fd9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6fd9('0xd'))(new Redis(config[_0x6fd9('0xc')]));require(_0x6fd9('0xe'))[_0x6fd9('0xf')](socket);function respondWithRpcPromise(_0x2f0533,_0x1a683b,_0x24384f){return new BPromise(function(_0x2e33f6,_0x4aa93d){return client[_0x6fd9('0x10')](_0x2f0533,_0x24384f)[_0x6fd9('0x11')](function(_0x2ac3f7){logger['info'](_0x6fd9('0x12'),_0x1a683b,'request\x20sent');logger[_0x6fd9('0x13')](_0x6fd9('0x14'),_0x1a683b,_0x6fd9('0x15'),JSON[_0x6fd9('0x16')](_0x2ac3f7));if(_0x2ac3f7[_0x6fd9('0x17')]){if(_0x2ac3f7[_0x6fd9('0x17')][_0x6fd9('0x18')]===0x1f4){logger[_0x6fd9('0x17')](_0x6fd9('0x12'),_0x1a683b,_0x2ac3f7[_0x6fd9('0x17')][_0x6fd9('0x19')]);return _0x4aa93d(_0x2ac3f7['error'][_0x6fd9('0x19')]);}logger[_0x6fd9('0x17')](_0x6fd9('0x12'),_0x1a683b,_0x2ac3f7['error'][_0x6fd9('0x19')]);return _0x2e33f6(_0x2ac3f7[_0x6fd9('0x17')][_0x6fd9('0x19')]);}else{logger[_0x6fd9('0x1a')](_0x6fd9('0x12'),_0x1a683b,_0x6fd9('0x15'));_0x2e33f6(_0x2ac3f7[_0x6fd9('0x1b')][_0x6fd9('0x19')]);}})[_0x6fd9('0x1c')](function(_0x1f02ab){logger[_0x6fd9('0x17')](_0x6fd9('0x12'),_0x1a683b,_0x1f02ab);_0x4aa93d(_0x1f02ab);});});}exports[_0x6fd9('0x1d')]=function(_0x2a112d){var _0x3ce73f=this;return new Promise(function(_0x1b536a,_0x2d8bb8){return db[_0x6fd9('0x1e')][_0x6fd9('0x1f')]({'raw':_0x2a112d[_0x6fd9('0x20')]?_0x2a112d[_0x6fd9('0x20')][_0x6fd9('0x21')]===undefined?!![]:![]:!![],'where':_0x2a112d[_0x6fd9('0x20')]?_0x2a112d[_0x6fd9('0x20')]['where']||null:null,'attributes':_0x2a112d['options']?_0x2a112d[_0x6fd9('0x20')][_0x6fd9('0x22')]||null:null,'include':_0x2a112d['options']?_0x2a112d[_0x6fd9('0x20')]['include']?_[_0x6fd9('0x23')](_0x2a112d['options']['include'],function(_0x406e5c){return{'model':db[_0x406e5c[_0x6fd9('0x24')]],'as':_0x406e5c['as'],'attributes':_0x406e5c[_0x6fd9('0x22')],'include':_0x406e5c['include']?_[_0x6fd9('0x23')](_0x406e5c['include'],function(_0x2b5658){return{'model':db[_0x2b5658[_0x6fd9('0x24')]],'as':_0x2b5658['as'],'attributes':_0x2b5658[_0x6fd9('0x22')],'include':_0x2b5658[_0x6fd9('0x25')]?_[_0x6fd9('0x23')](_0x2b5658['include'],function(_0x434e6c){return{'model':db[_0x434e6c[_0x6fd9('0x24')]],'as':_0x434e6c['as'],'attributes':_0x434e6c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6fd9('0x11')](function(_0x1d83f5){logger[_0x6fd9('0x1a')](_0x6fd9('0x1d'),_0x2a112d);logger['debug']('ShowWhatsappAccount',_0x2a112d,JSON[_0x6fd9('0x16')](_0x1d83f5));_0x1b536a(_0x1d83f5);})[_0x6fd9('0x1c')](function(_0x963be1){logger[_0x6fd9('0x17')]('ShowWhatsappAccount',_0x963be1[_0x6fd9('0x19')],_0x2a112d);_0x2d8bb8(_0x3ce73f[_0x6fd9('0x17')](0x1f4,_0x963be1[_0x6fd9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 4f9240f..83c5b92 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 _0xcc4e=['removeListener','register','./whatsappAccount.events','update','emit'];(function(_0x2b1a5a,_0x4a8de8){var _0x4a3790=function(_0x19371c){while(--_0x19371c){_0x2b1a5a['push'](_0x2b1a5a['shift']());}};_0x4a3790(++_0x4a8de8);}(_0xcc4e,0x7a));var _0xecc4=function(_0xf4f343,_0x41fe4a){_0xf4f343=_0xf4f343-0x0;var _0x4cda68=_0xcc4e[_0xf4f343];return _0x4cda68;};'use strict';var WhatsappAccountEvents=require(_0xecc4('0x0'));var events=['save','remove',_0xecc4('0x1')];function createListener(_0x1bdff9,_0x55285e){return function(_0x3a6456){_0x55285e[_0xecc4('0x2')](_0x1bdff9,_0x3a6456);};}function removeListener(_0x34c288,_0x567d1f){return function(){WhatsappAccountEvents[_0xecc4('0x3')](_0x34c288,_0x567d1f);};}exports[_0xecc4('0x4')]=function(_0x29080e){for(var _0x13396f=0x0,_0xff6cdb=events['length'];_0x13396f<_0xff6cdb;_0x13396f++){var _0x4d0f7c=events[_0x13396f];var _0x4ecb20=createListener('whatsappAccount:'+_0x4d0f7c,_0x29080e);WhatsappAccountEvents['on'](_0x4d0f7c,_0x4ecb20);}}; \ No newline at end of file +var _0x38de=['update','emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','remove'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x38de,0x146));var _0xe38d=function(_0x275be7,_0x28e1f2){_0x275be7=_0x275be7-0x0;var _0x2940c5=_0x38de[_0x275be7];return _0x2940c5;};'use strict';var WhatsappAccountEvents=require(_0xe38d('0x0'));var events=['save',_0xe38d('0x1'),_0xe38d('0x2')];function createListener(_0x50abf6,_0x52749a){return function(_0x46c715){_0x52749a[_0xe38d('0x3')](_0x50abf6,_0x46c715);};}function removeListener(_0x30fb76,_0x11756e){return function(){WhatsappAccountEvents[_0xe38d('0x4')](_0x30fb76,_0x11756e);};}exports[_0xe38d('0x5')]=function(_0x1d49b4){for(var _0x273239=0x0,_0xc003bc=events[_0xe38d('0x6')];_0x273239<_0xc003bc;_0x273239++){var _0x4baedc=events[_0x273239];var _0x1ee95d=createListener(_0xe38d('0x7')+_0x4baedc,_0x1d49b4);WhatsappAccountEvents['on'](_0x4baedc,_0x1ee95d);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6ff877b..6ef5a7a 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 _0xab32=['../../config/environment','./whatsappApplication.controller','index','get','show','post','create','update','delete','isAuthenticated','multer','util','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xab32,0x136));var _0x2ab3=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xab32[_0x1ee351];return _0x245aaf;};'use strict';var multer=require(_0x2ab3('0x0'));var util=require(_0x2ab3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ab3('0x2')]();var auth=require(_0x2ab3('0x3'));var interaction=require(_0x2ab3('0x4'));var config=require(_0x2ab3('0x5'));var controller=require(_0x2ab3('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ab3('0x7')]);router[_0x2ab3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2ab3('0x9')]);router[_0x2ab3('0xa')]('/',auth['isAuthenticated'](),controller[_0x2ab3('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2ab3('0xc')]);router[_0x2ab3('0xd')]('/:id',auth[_0x2ab3('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x362b=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','util'];(function(_0x51792c,_0x28cc64){var _0x46f732=function(_0x51456a){while(--_0x51456a){_0x51792c['push'](_0x51792c['shift']());}};_0x46f732(++_0x28cc64);}(_0x362b,0xb3));var _0xb362=function(_0x5bd213,_0x40dd64){_0x5bd213=_0x5bd213-0x0;var _0x49bcd5=_0x362b[_0x5bd213];return _0x49bcd5;};'use strict';var multer=require('multer');var util=require(_0xb362('0x0'));var path=require(_0xb362('0x1'));var timeout=require('connect-timeout');var express=require(_0xb362('0x2'));var router=express[_0xb362('0x3')]();var auth=require(_0xb362('0x4'));var interaction=require(_0xb362('0x5'));var config=require(_0xb362('0x6'));var controller=require(_0xb362('0x7'));router[_0xb362('0x8')]('/',auth[_0xb362('0x9')](),controller[_0xb362('0xa')]);router[_0xb362('0x8')](_0xb362('0xb'),auth[_0xb362('0x9')](),controller[_0xb362('0xc')]);router[_0xb362('0xd')]('/',auth[_0xb362('0x9')](),controller[_0xb362('0xe')]);router[_0xb362('0xf')](_0xb362('0xb'),auth[_0xb362('0x9')](),controller[_0xb362('0x10')]);router['delete'](_0xb362('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb362('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 9078a68..40b1413 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 _0x15a1=['noop','TEXT','STRING','*,*,*,*','INTEGER'];(function(_0x182bea,_0x151120){var _0xca50fe=function(_0x40e1bf){while(--_0x40e1bf){_0x182bea['push'](_0x182bea['shift']());}};_0xca50fe(++_0x151120);}(_0x15a1,0x130));var _0x115a=function(_0x575605,_0x5c0a54){_0x575605=_0x575605-0x0;var _0x10fe12=_0x15a1[_0x575605];return _0x10fe12;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x115a('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x115a('0x1')},'appdata':{'type':Sequelize[_0x115a('0x2')]()},'description':{'type':Sequelize[_0x115a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x115a('0x4')}}; \ No newline at end of file +var _0x96a8=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0x96a8,0x170));var _0x896a=function(_0x51d00b,_0x340167){_0x51d00b=_0x51d00b-0x0;var _0x39be08=_0x96a8[_0x51d00b];return _0x39be08;};'use strict';var Sequelize=require(_0x896a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x896a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x896a('0x2')],'allowNull':![],'defaultValue':_0x896a('0x3')},'appdata':{'type':Sequelize[_0x896a('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x896a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e3696dd..c72403e 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 _0x58e6=['apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappApplication','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','count','include','findAll','rows','show','filtears','includeAll','find','create','body','catch','params','eml-format','fast-json-patch','request-promise','moment','bluebird','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json'];(function(_0x2209db,_0x1af007){var _0x6a7bb1=function(_0x3d62ae){while(--_0x3d62ae){_0x2209db['push'](_0x2209db['shift']());}};_0x6a7bb1(++_0x1af007);}(_0x58e6,0x18d));var _0x658e=function(_0x583fdf,_0x447666){_0x583fdf=_0x583fdf-0x0;var _0x16f7eb=_0x58e6[_0x583fdf];return _0x16f7eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x658e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x658e('0x1'));var rp=require(_0x658e('0x2'));var moment=require(_0x658e('0x3'));var BPromise=require(_0x658e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x658e('0x5'));var csv=require('to-csv');var ejs=require(_0x658e('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x658e('0x7'));var crypto=require(_0x658e('0x8'));var jsforce=require(_0x658e('0x9'));var deskjs=require(_0x658e('0xa'));var toCsv=require(_0x658e('0xb'));var querystring=require(_0x658e('0xc'));var Papa=require(_0x658e('0xd'));var Redis=require(_0x658e('0xe'));var authService=require(_0x658e('0xf'));var qs=require(_0x658e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x658e('0x11'));var logger=require(_0x658e('0x12'))('api');var utils=require(_0x658e('0x13'));var config=require(_0x658e('0x14'));var licenseUtil=require(_0x658e('0x15'));var db=require(_0x658e('0x16'))['db'];function respondWithStatusCode(_0x5cd82b,_0xbbc057){_0xbbc057=_0xbbc057||0xcc;return function(_0x56a3b0){if(_0x56a3b0){return _0x5cd82b[_0x658e('0x17')](_0xbbc057);}return _0x5cd82b[_0x658e('0x18')](_0xbbc057)['end']();};}function respondWithResult(_0x1ff846,_0x43e1eb){_0x43e1eb=_0x43e1eb||0xc8;return function(_0x41d96e){if(_0x41d96e){return _0x1ff846[_0x658e('0x18')](_0x43e1eb)['json'](_0x41d96e);}};}function respondWithFilteredResult(_0x404a10,_0x4930c0){return function(_0x5edc19){if(_0x5edc19){var _0x5eaa64=_0x5edc19['count'],_0x20125f=_0x4930c0['offset'],_0x2c379f=_0x4930c0[_0x658e('0x19')]+_0x4930c0[_0x658e('0x1a')],_0x58cb85;if(_0x2c379f>=_0x5eaa64){_0x2c379f=_0x5eaa64;_0x58cb85=0xc8;}else{_0x58cb85=0xce;}_0x404a10[_0x658e('0x18')](_0x58cb85);return _0x404a10[_0x658e('0x1b')]('Content-Range',_0x20125f+'-'+_0x2c379f+'/'+_0x5eaa64)[_0x658e('0x1c')](_0x5edc19);}return null;};}function patchUpdates(_0x5ef3b6){return function(_0x44ee7a){try{jsonpatch[_0x658e('0x1d')](_0x44ee7a,_0x5ef3b6,!![]);}catch(_0x2fb1be){return BPromise[_0x658e('0x1e')](_0x2fb1be);}return _0x44ee7a[_0x658e('0x1f')]();};}function saveUpdates(_0xbb693f,_0xc1ad10){return function(_0x4f4e91){if(_0x4f4e91){return _0x4f4e91[_0x658e('0x20')](_0xbb693f)[_0x658e('0x21')](function(_0x3e46c6){return _0x3e46c6;});}return null;};}function removeEntity(_0x199340,_0x2a4680){return function(_0x42d6dc){if(_0x42d6dc){return _0x42d6dc[_0x658e('0x22')]()['then'](function(){_0x199340[_0x658e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x297eca,_0x223d31){return function(_0x263983){if(!_0x263983){_0x297eca[_0x658e('0x17')](0x194);}return _0x263983;};}function handleError(_0x40fbc9,_0x18bd28){_0x18bd28=_0x18bd28||0x1f4;return function(_0x4aba78){logger[_0x658e('0x23')](_0x4aba78[_0x658e('0x24')]);if(_0x4aba78[_0x658e('0x25')]){delete _0x4aba78[_0x658e('0x25')];}_0x40fbc9[_0x658e('0x18')](_0x18bd28)[_0x658e('0x26')](_0x4aba78);};}exports['index']=function(_0x5b605b,_0x11e9b6){var _0x439004={},_0x48298e={},_0x198c50={'count':0x0,'rows':[]};var _0x54aab9=_[_0x658e('0x27')](db[_0x658e('0x28')]['rawAttributes'],function(_0xc5bf94){return{'name':_0xc5bf94[_0x658e('0x29')],'type':_0xc5bf94[_0x658e('0x2a')][_0x658e('0x2b')]};});_0x48298e[_0x658e('0x2c')]=_[_0x658e('0x27')](_0x54aab9,'name');_0x48298e['query']=_[_0x658e('0x2d')](_0x5b605b['query']);_0x48298e['filters']=_['intersection'](_0x48298e['model'],_0x48298e[_0x658e('0x2e')]);_0x439004[_0x658e('0x2f')]=_[_0x658e('0x30')](_0x48298e[_0x658e('0x2c')],qs[_0x658e('0x31')](_0x5b605b[_0x658e('0x2e')][_0x658e('0x31')]));_0x439004['attributes']=_0x439004[_0x658e('0x2f')][_0x658e('0x32')]?_0x439004[_0x658e('0x2f')]:_0x48298e[_0x658e('0x2c')];if(!_0x5b605b[_0x658e('0x2e')][_0x658e('0x33')]('nolimit')){_0x439004[_0x658e('0x1a')]=qs[_0x658e('0x1a')](_0x5b605b[_0x658e('0x2e')]['limit']);_0x439004[_0x658e('0x19')]=qs[_0x658e('0x19')](_0x5b605b['query']['offset']);}_0x439004['order']=qs[_0x658e('0x34')](_0x5b605b[_0x658e('0x2e')][_0x658e('0x34')]);_0x439004[_0x658e('0x35')]=qs[_0x658e('0x36')](_[_0x658e('0x37')](_0x5b605b[_0x658e('0x2e')],_0x48298e[_0x658e('0x36')]),_0x54aab9);if(_0x5b605b[_0x658e('0x2e')][_0x658e('0x38')]){_0x439004['where']=_[_0x658e('0x39')](_0x439004[_0x658e('0x35')],{'$or':_[_0x658e('0x27')](_0x54aab9,function(_0x463857){if(_0x463857[_0x658e('0x2a')]!=='VIRTUAL'){var _0x5ed317={};_0x5ed317[_0x463857[_0x658e('0x25')]]={'$like':'%'+_0x5b605b[_0x658e('0x2e')][_0x658e('0x38')]+'%'};return _0x5ed317;}})});}_0x439004=_[_0x658e('0x39')]({},_0x439004,_0x5b605b[_0x658e('0x3a')]);var _0x26070a={'where':_0x439004[_0x658e('0x35')]};return db[_0x658e('0x28')][_0x658e('0x3b')](_0x26070a)[_0x658e('0x21')](function(_0x5ee58f){_0x198c50[_0x658e('0x3b')]=_0x5ee58f;if(_0x5b605b[_0x658e('0x2e')]['includeAll']){_0x439004[_0x658e('0x3c')]=[{'all':!![]}];}return db[_0x658e('0x28')][_0x658e('0x3d')](_0x439004);})[_0x658e('0x21')](function(_0x10cfda){_0x198c50[_0x658e('0x3e')]=_0x10cfda;return _0x198c50;})[_0x658e('0x21')](respondWithFilteredResult(_0x11e9b6,_0x439004))['catch'](handleError(_0x11e9b6,null));};exports[_0x658e('0x3f')]=function(_0x3512eb,_0x379e36){var _0x1c7c05={'raw':!![],'where':{'id':_0x3512eb['params']['id']}},_0x2cb0e5={};_0x2cb0e5['model']=_[_0x658e('0x2d')](db[_0x658e('0x28')]['rawAttributes']);_0x2cb0e5[_0x658e('0x2e')]=_['keys'](_0x3512eb[_0x658e('0x2e')]);_0x2cb0e5[_0x658e('0x40')]=_['intersection'](_0x2cb0e5[_0x658e('0x2c')],_0x2cb0e5[_0x658e('0x2e')]);_0x1c7c05['attributes']=_[_0x658e('0x30')](_0x2cb0e5[_0x658e('0x2c')],qs['fields'](_0x3512eb[_0x658e('0x2e')][_0x658e('0x31')]));_0x1c7c05[_0x658e('0x2f')]=_0x1c7c05[_0x658e('0x2f')]['length']?_0x1c7c05[_0x658e('0x2f')]:_0x2cb0e5[_0x658e('0x2c')];if(_0x3512eb['query'][_0x658e('0x41')]){_0x1c7c05[_0x658e('0x3c')]=[{'all':!![]}];}_0x1c7c05=_[_0x658e('0x39')]({},_0x1c7c05,_0x3512eb[_0x658e('0x3a')]);return db[_0x658e('0x28')][_0x658e('0x42')](_0x1c7c05)[_0x658e('0x21')](handleEntityNotFound(_0x379e36,null))[_0x658e('0x21')](respondWithResult(_0x379e36,null))['catch'](handleError(_0x379e36,null));};exports[_0x658e('0x43')]=function(_0x479a41,_0x23bd1e){return db[_0x658e('0x28')]['create'](_0x479a41[_0x658e('0x44')],{})[_0x658e('0x21')](respondWithResult(_0x23bd1e,0xc9))[_0x658e('0x45')](handleError(_0x23bd1e,null));};exports[_0x658e('0x20')]=function(_0x428f7e,_0x433a0e){if(_0x428f7e[_0x658e('0x44')]['id']){delete _0x428f7e['body']['id'];}return db[_0x658e('0x28')][_0x658e('0x42')]({'where':{'id':_0x428f7e['params']['id']}})[_0x658e('0x21')](handleEntityNotFound(_0x433a0e,null))[_0x658e('0x21')](saveUpdates(_0x428f7e[_0x658e('0x44')],null))[_0x658e('0x21')](respondWithResult(_0x433a0e,null))[_0x658e('0x45')](handleError(_0x433a0e,null));};exports[_0x658e('0x22')]=function(_0xf4ed52,_0xad2f21){return db[_0x658e('0x28')][_0x658e('0x42')]({'where':{'id':_0xf4ed52[_0x658e('0x46')]['id']}})[_0x658e('0x21')](handleEntityNotFound(_0xad2f21,null))[_0x658e('0x21')](removeEntity(_0xad2f21,null))[_0x658e('0x45')](handleError(_0xad2f21,null));}; \ No newline at end of file +var _0x7ed7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','filtears','includeAll','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x5363ae,_0x2e2369){var _0x415424=function(_0x33ff2e){while(--_0x33ff2e){_0x5363ae['push'](_0x5363ae['shift']());}};_0x415424(++_0x2e2369);}(_0x7ed7,0x1a8));var _0x77ed=function(_0x7b8b47,_0x274711){_0x7b8b47=_0x7b8b47-0x0;var _0x5b3c2a=_0x7ed7[_0x7b8b47];return _0x5b3c2a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x77ed('0x0'));var rimraf=require(_0x77ed('0x1'));var zipdir=require(_0x77ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77ed('0x3'));var moment=require(_0x77ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x77ed('0x5'));var util=require(_0x77ed('0x6'));var path=require(_0x77ed('0x7'));var sox=require('sox');var csv=require(_0x77ed('0x8'));var ejs=require(_0x77ed('0x9'));var fs=require('fs');var _=require(_0x77ed('0xa'));var squel=require(_0x77ed('0xb'));var crypto=require(_0x77ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x77ed('0xd'));var toCsv=require(_0x77ed('0x8'));var querystring=require('querystring');var Papa=require(_0x77ed('0xe'));var Redis=require('ioredis');var authService=require(_0x77ed('0xf'));var qs=require(_0x77ed('0x10'));var as=require(_0x77ed('0x11'));var hardwareService=require(_0x77ed('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x77ed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x77ed('0x14'));var db=require(_0x77ed('0x15'))['db'];function respondWithStatusCode(_0x3f94da,_0x510f99){_0x510f99=_0x510f99||0xcc;return function(_0x45437b){if(_0x45437b){return _0x3f94da[_0x77ed('0x16')](_0x510f99);}return _0x3f94da[_0x77ed('0x17')](_0x510f99)[_0x77ed('0x18')]();};}function respondWithResult(_0x5e646a,_0x43a684){_0x43a684=_0x43a684||0xc8;return function(_0x2bf98a){if(_0x2bf98a){return _0x5e646a[_0x77ed('0x17')](_0x43a684)[_0x77ed('0x19')](_0x2bf98a);}};}function respondWithFilteredResult(_0x7f9cb8,_0x3def9c){return function(_0x3718c9){if(_0x3718c9){var _0x2150ad=_0x3718c9[_0x77ed('0x1a')],_0x3847e8=_0x3def9c[_0x77ed('0x1b')],_0x134703=_0x3def9c['offset']+_0x3def9c['limit'],_0x895a87;if(_0x134703>=_0x2150ad){_0x134703=_0x2150ad;_0x895a87=0xc8;}else{_0x895a87=0xce;}_0x7f9cb8['status'](_0x895a87);return _0x7f9cb8[_0x77ed('0x1c')](_0x77ed('0x1d'),_0x3847e8+'-'+_0x134703+'/'+_0x2150ad)[_0x77ed('0x19')](_0x3718c9);}return null;};}function patchUpdates(_0x2e225e){return function(_0x35c635){try{jsonpatch[_0x77ed('0x1e')](_0x35c635,_0x2e225e,!![]);}catch(_0x47163c){return BPromise[_0x77ed('0x1f')](_0x47163c);}return _0x35c635[_0x77ed('0x20')]();};}function saveUpdates(_0x268af1,_0x247fb9){return function(_0x34b0a0){if(_0x34b0a0){return _0x34b0a0['update'](_0x268af1)['then'](function(_0x487820){return _0x487820;});}return null;};}function removeEntity(_0x4f9bfd,_0x576814){return function(_0x5aa4dc){if(_0x5aa4dc){return _0x5aa4dc[_0x77ed('0x21')]()[_0x77ed('0x22')](function(){_0x4f9bfd[_0x77ed('0x17')](0xcc)[_0x77ed('0x18')]();});}};}function handleEntityNotFound(_0x5d09d0,_0x565406){return function(_0x155890){if(!_0x155890){_0x5d09d0[_0x77ed('0x16')](0x194);}return _0x155890;};}function handleError(_0x40e40a,_0x29d798){_0x29d798=_0x29d798||0x1f4;return function(_0x3b6310){logger[_0x77ed('0x23')](_0x3b6310[_0x77ed('0x24')]);if(_0x3b6310[_0x77ed('0x25')]){delete _0x3b6310[_0x77ed('0x25')];}_0x40e40a[_0x77ed('0x17')](_0x29d798)[_0x77ed('0x26')](_0x3b6310);};}exports['index']=function(_0x35eaf9,_0x2ed0c7){var _0x587639={},_0x51c23a={},_0xd7a9f0={'count':0x0,'rows':[]};var _0x383411=_[_0x77ed('0x27')](db[_0x77ed('0x28')][_0x77ed('0x29')],function(_0x43b446){return{'name':_0x43b446[_0x77ed('0x2a')],'type':_0x43b446['type'][_0x77ed('0x2b')]};});_0x51c23a[_0x77ed('0x2c')]=_['map'](_0x383411,'name');_0x51c23a[_0x77ed('0x2d')]=_[_0x77ed('0x2e')](_0x35eaf9[_0x77ed('0x2d')]);_0x51c23a['filters']=_['intersection'](_0x51c23a[_0x77ed('0x2c')],_0x51c23a[_0x77ed('0x2d')]);_0x587639[_0x77ed('0x2f')]=_[_0x77ed('0x30')](_0x51c23a[_0x77ed('0x2c')],qs[_0x77ed('0x31')](_0x35eaf9[_0x77ed('0x2d')][_0x77ed('0x31')]));_0x587639[_0x77ed('0x2f')]=_0x587639[_0x77ed('0x2f')][_0x77ed('0x32')]?_0x587639[_0x77ed('0x2f')]:_0x51c23a['model'];if(!_0x35eaf9[_0x77ed('0x2d')][_0x77ed('0x33')](_0x77ed('0x34'))){_0x587639[_0x77ed('0x35')]=qs[_0x77ed('0x35')](_0x35eaf9[_0x77ed('0x2d')][_0x77ed('0x35')]);_0x587639[_0x77ed('0x1b')]=qs[_0x77ed('0x1b')](_0x35eaf9[_0x77ed('0x2d')]['offset']);}_0x587639['order']=qs['sort'](_0x35eaf9[_0x77ed('0x2d')][_0x77ed('0x36')]);_0x587639['where']=qs['filters'](_[_0x77ed('0x37')](_0x35eaf9[_0x77ed('0x2d')],_0x51c23a[_0x77ed('0x38')]),_0x383411);if(_0x35eaf9[_0x77ed('0x2d')]['filter']){_0x587639[_0x77ed('0x39')]=_[_0x77ed('0x3a')](_0x587639[_0x77ed('0x39')],{'$or':_[_0x77ed('0x27')](_0x383411,function(_0x10fd76){if(_0x10fd76['type']!==_0x77ed('0x3b')){var _0x58e0eb={};_0x58e0eb[_0x10fd76[_0x77ed('0x25')]]={'$like':'%'+_0x35eaf9[_0x77ed('0x2d')][_0x77ed('0x3c')]+'%'};return _0x58e0eb;}})});}_0x587639=_[_0x77ed('0x3a')]({},_0x587639,_0x35eaf9[_0x77ed('0x3d')]);var _0x4bd231={'where':_0x587639[_0x77ed('0x39')]};return db[_0x77ed('0x28')][_0x77ed('0x1a')](_0x4bd231)['then'](function(_0x162914){_0xd7a9f0[_0x77ed('0x1a')]=_0x162914;if(_0x35eaf9[_0x77ed('0x2d')]['includeAll']){_0x587639['include']=[{'all':!![]}];}return db[_0x77ed('0x28')][_0x77ed('0x3e')](_0x587639);})[_0x77ed('0x22')](function(_0x138359){_0xd7a9f0[_0x77ed('0x3f')]=_0x138359;return _0xd7a9f0;})['then'](respondWithFilteredResult(_0x2ed0c7,_0x587639))[_0x77ed('0x40')](handleError(_0x2ed0c7,null));};exports[_0x77ed('0x41')]=function(_0x52bf34,_0x7fc666){var _0x1c36de={'raw':!![],'where':{'id':_0x52bf34[_0x77ed('0x42')]['id']}},_0x59ffd8={};_0x59ffd8[_0x77ed('0x2c')]=_[_0x77ed('0x2e')](db[_0x77ed('0x28')][_0x77ed('0x29')]);_0x59ffd8[_0x77ed('0x2d')]=_[_0x77ed('0x2e')](_0x52bf34[_0x77ed('0x2d')]);_0x59ffd8[_0x77ed('0x43')]=_[_0x77ed('0x30')](_0x59ffd8[_0x77ed('0x2c')],_0x59ffd8[_0x77ed('0x2d')]);_0x1c36de[_0x77ed('0x2f')]=_['intersection'](_0x59ffd8[_0x77ed('0x2c')],qs[_0x77ed('0x31')](_0x52bf34[_0x77ed('0x2d')][_0x77ed('0x31')]));_0x1c36de[_0x77ed('0x2f')]=_0x1c36de[_0x77ed('0x2f')]['length']?_0x1c36de[_0x77ed('0x2f')]:_0x59ffd8[_0x77ed('0x2c')];if(_0x52bf34[_0x77ed('0x2d')][_0x77ed('0x44')]){_0x1c36de['include']=[{'all':!![]}];}_0x1c36de=_[_0x77ed('0x3a')]({},_0x1c36de,_0x52bf34['options']);return db[_0x77ed('0x28')][_0x77ed('0x45')](_0x1c36de)[_0x77ed('0x22')](handleEntityNotFound(_0x7fc666,null))[_0x77ed('0x22')](respondWithResult(_0x7fc666,null))['catch'](handleError(_0x7fc666,null));};exports['create']=function(_0x5c8f77,_0x56490e){return db[_0x77ed('0x28')][_0x77ed('0x46')](_0x5c8f77[_0x77ed('0x47')],{})[_0x77ed('0x22')](respondWithResult(_0x56490e,0xc9))[_0x77ed('0x40')](handleError(_0x56490e,null));};exports[_0x77ed('0x48')]=function(_0x867bfe,_0x3c2319){if(_0x867bfe['body']['id']){delete _0x867bfe['body']['id'];}return db[_0x77ed('0x28')][_0x77ed('0x45')]({'where':{'id':_0x867bfe[_0x77ed('0x42')]['id']}})[_0x77ed('0x22')](handleEntityNotFound(_0x3c2319,null))['then'](saveUpdates(_0x867bfe[_0x77ed('0x47')],null))['then'](respondWithResult(_0x3c2319,null))['catch'](handleError(_0x3c2319,null));};exports[_0x77ed('0x21')]=function(_0x799f98,_0x2e6c78){return db[_0x77ed('0x28')]['find']({'where':{'id':_0x799f98[_0x77ed('0x42')]['id']}})[_0x77ed('0x22')](handleEntityNotFound(_0x2e6c78,null))[_0x77ed('0x22')](removeEntity(_0x2e6c78,null))[_0x77ed('0x40')](handleError(_0x2e6c78,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 965ff99..10327b9 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 _0x956b=['moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','whatsapp_applications','lodash','util'];(function(_0x4f611d,_0x5edcff){var _0x5b489f=function(_0x2610a7){while(--_0x2610a7){_0x4f611d['push'](_0x4f611d['shift']());}};_0x5b489f(++_0x5edcff);}(_0x956b,0x106));var _0xb956=function(_0x42897c,_0x4d282f){_0x42897c=_0x42897c-0x0;var _0x1120a3=_0x956b[_0x42897c];return _0x1120a3;};'use strict';var _=require(_0xb956('0x0'));var util=require(_0xb956('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb956('0x2'));var BPromise=require(_0xb956('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb956('0x4'));var rimraf=require(_0xb956('0x5'));var config=require(_0xb956('0x6'));var attributes=require(_0xb956('0x7'));module[_0xb956('0x8')]=function(_0x176ada,_0x1ecf9e){return _0x176ada['define'](_0xb956('0x9'),attributes,{'tableName':_0xb956('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x046d=['define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x101be8,_0x1ea713){var _0x32fb9c=function(_0x375ad3){while(--_0x375ad3){_0x101be8['push'](_0x101be8['shift']());}};_0x32fb9c(++_0x1ea713);}(_0x046d,0x1f2));var _0xd046=function(_0x57f4de,_0x57c7ae){_0x57f4de=_0x57f4de-0x0;var _0x1edd7b=_0x046d[_0x57f4de];return _0x1edd7b;};'use strict';var _=require(_0xd046('0x0'));var util=require(_0xd046('0x1'));var logger=require('../../config/logger')(_0xd046('0x2'));var moment=require('moment');var BPromise=require(_0xd046('0x3'));var rp=require(_0xd046('0x4'));var fs=require('fs');var path=require(_0xd046('0x5'));var rimraf=require(_0xd046('0x6'));var config=require(_0xd046('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xd046('0x8')]=function(_0x5bc909,_0xbf1683){return _0x5bc909[_0xd046('0x9')](_0xd046('0xa'),attributes,{'tableName':_0xd046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd046('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 47df9c9..e4edebd 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 _0xa74a=['code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x22d72d,_0x2b4222){var _0x5e1ba3=function(_0x528f24){while(--_0x528f24){_0x22d72d['push'](_0x22d72d['shift']());}};_0x5e1ba3(++_0x2b4222);}(_0xa74a,0x66));var _0xaa74=function(_0x41e9d5,_0x2fd4d1){_0x41e9d5=_0x41e9d5-0x0;var _0x3ce139=_0xa74a[_0x41e9d5];return _0x3ce139;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var moment=require(_0xaa74('0x2'));var BPromise=require(_0xaa74('0x3'));var rs=require(_0xaa74('0x4'));var fs=require('fs');var Redis=require(_0xaa74('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa74('0x6'));var logger=require(_0xaa74('0x7'))(_0xaa74('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa74('0x9')][_0xaa74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44002b,_0x3aca05,_0x10e7ce){return new BPromise(function(_0x5a3684,_0x197336){return client['request'](_0x44002b,_0x10e7ce)[_0xaa74('0xb')](function(_0x502005){logger[_0xaa74('0xc')](_0xaa74('0xd'),_0x3aca05,'request\x20sent');logger[_0xaa74('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x3aca05,_0xaa74('0xf'),JSON[_0xaa74('0x10')](_0x502005));if(_0x502005['error']){if(_0x502005[_0xaa74('0x11')][_0xaa74('0x12')]===0x1f4){logger[_0xaa74('0x11')](_0xaa74('0xd'),_0x3aca05,_0x502005[_0xaa74('0x11')][_0xaa74('0x13')]);return _0x197336(_0x502005[_0xaa74('0x11')][_0xaa74('0x13')]);}logger[_0xaa74('0x11')](_0xaa74('0xd'),_0x3aca05,_0x502005[_0xaa74('0x11')]['message']);return _0x5a3684(_0x502005[_0xaa74('0x11')][_0xaa74('0x13')]);}else{logger['info'](_0xaa74('0xd'),_0x3aca05,'request\x20sent');_0x5a3684(_0x502005['result']['message']);}})['catch'](function(_0xbe83ac){logger[_0xaa74('0x11')](_0xaa74('0xd'),_0x3aca05,_0xbe83ac);_0x197336(_0xbe83ac);});});} \ No newline at end of file +var _0xb091=['WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1ebc5e,_0x5b4678){var _0x397579=function(_0x47364a){while(--_0x47364a){_0x1ebc5e['push'](_0x1ebc5e['shift']());}};_0x397579(++_0x5b4678);}(_0xb091,0x16e));var _0x1b09=function(_0xc39aff,_0xbf109a){_0xc39aff=_0xc39aff-0x0;var _0x266d06=_0xb091[_0xc39aff];return _0x266d06;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var moment=require(_0x1b09('0x1'));var BPromise=require(_0x1b09('0x2'));var rs=require(_0x1b09('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b09('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b09('0x5'));var config=require(_0x1b09('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1b09('0x7')][_0x1b09('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2bf4f6,_0x5ce726,_0x142c33){return new BPromise(function(_0x8c26a5,_0x2f359f){return client[_0x1b09('0x9')](_0x2bf4f6,_0x142c33)[_0x1b09('0xa')](function(_0x3362e4){logger[_0x1b09('0xb')](_0x1b09('0xc'),_0x5ce726,_0x1b09('0xd'));logger[_0x1b09('0xe')](_0x1b09('0xf'),_0x5ce726,'request\x20sent',JSON[_0x1b09('0x10')](_0x3362e4));if(_0x3362e4[_0x1b09('0x11')]){if(_0x3362e4['error']['code']===0x1f4){logger[_0x1b09('0x11')](_0x1b09('0xc'),_0x5ce726,_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);return _0x2f359f(_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);}logger[_0x1b09('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x5ce726,_0x3362e4[_0x1b09('0x11')]['message']);return _0x8c26a5(_0x3362e4[_0x1b09('0x11')][_0x1b09('0x12')]);}else{logger[_0x1b09('0xb')](_0x1b09('0xc'),_0x5ce726,_0x1b09('0xd'));_0x8c26a5(_0x3362e4[_0x1b09('0x13')][_0x1b09('0x12')]);}})[_0x1b09('0x14')](function(_0x1196b2){logger[_0x1b09('0x11')](_0x1b09('0xc'),_0x5ce726,_0x1196b2);_0x2f359f(_0x1196b2);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e92b2cf..fd6f143 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 _0x6210=['express','Router','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','describe','/:id','/:id/messages','/:id/download','isAuthenticated','download','post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout'];(function(_0x51b177,_0x545b8e){var _0x18e416=function(_0x46827d){while(--_0x46827d){_0x51b177['push'](_0x51b177['shift']());}};_0x18e416(++_0x545b8e);}(_0x6210,0xe4));var _0x0621=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x6210[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x0621('0x0'));var util=require(_0x0621('0x1'));var path=require(_0x0621('0x2'));var timeout=require(_0x0621('0x3'));var express=require(_0x0621('0x4'));var router=express[_0x0621('0x5')]();var auth=require(_0x0621('0x6'));var interaction=require(_0x0621('0x7'));var config=require('../../config/environment');var controller=require(_0x0621('0x8'));router[_0x0621('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0621('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0621('0xa')]);router[_0x0621('0x9')](_0x0621('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0621('0x9')](_0x0621('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x0621('0xd'),auth[_0x0621('0xe')](),controller[_0x0621('0xf')]);router[_0x0621('0x10')]('/',auth[_0x0621('0xe')](),controller[_0x0621('0x11')]);router[_0x0621('0x10')](_0x0621('0xc'),auth[_0x0621('0xe')](),controller['addMessage']);router['post'](_0x0621('0x12'),auth[_0x0621('0xe')](),interaction[_0x0621('0x13')](_0x0621('0x14'),_0x0621('0x15')),controller[_0x0621('0x16')]);router[_0x0621('0x17')](_0x0621('0xb'),auth[_0x0621('0xe')](),interaction[_0x0621('0x13')](_0x0621('0x14'),'whatsappinteraction:update'),controller[_0x0621('0x18')]);router[_0x0621('0x19')](_0x0621('0xb'),auth[_0x0621('0xe')](),interaction[_0x0621('0x13')](_0x0621('0x14'),'whatsappinteraction:destroy'),controller[_0x0621('0x1a')]);router[_0x0621('0x19')](_0x0621('0x12'),auth[_0x0621('0xe')](),controller[_0x0621('0x1b')]);module[_0x0621('0x1c')]=router; \ No newline at end of file +var _0xcc2c=['create','post','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','update','delete','/:id','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x42f27f,_0x23dffb){var _0x59d1a4=function(_0x3d3d5f){while(--_0x3d3d5f){_0x42f27f['push'](_0x42f27f['shift']());}};_0x59d1a4(++_0x23dffb);}(_0xcc2c,0xa5));var _0xccc2=function(_0x2418e9,_0x532c5c){_0x2418e9=_0x2418e9-0x0;var _0x520693=_0xcc2c[_0x2418e9];return _0x520693;};'use strict';var multer=require('multer');var util=require(_0xccc2('0x0'));var path=require(_0xccc2('0x1'));var timeout=require(_0xccc2('0x2'));var express=require(_0xccc2('0x3'));var router=express[_0xccc2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xccc2('0x5'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xccc2('0x6')]('/',auth['isAuthenticated'](),controller[_0xccc2('0x7')]);router[_0xccc2('0x6')]('/describe',auth[_0xccc2('0x8')](),controller[_0xccc2('0x9')]);router[_0xccc2('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xccc2('0xa')]);router['get'](_0xccc2('0xb'),auth[_0xccc2('0x8')](),controller[_0xccc2('0xc')]);router[_0xccc2('0x6')](_0xccc2('0xd'),auth[_0xccc2('0x8')](),controller[_0xccc2('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xccc2('0xf')]);router[_0xccc2('0x10')](_0xccc2('0xb'),auth['isAuthenticated'](),controller[_0xccc2('0x11')]);router[_0xccc2('0x10')]('/:id/tags',auth[_0xccc2('0x8')](),interaction[_0xccc2('0x12')](_0xccc2('0x13'),_0xccc2('0x14')),controller[_0xccc2('0x15')]);router['put']('/:id',auth[_0xccc2('0x8')](),interaction[_0xccc2('0x12')](_0xccc2('0x13'),'whatsappinteraction:update'),controller[_0xccc2('0x16')]);router[_0xccc2('0x17')](_0xccc2('0x18'),auth['isAuthenticated'](),interaction[_0xccc2('0x12')](_0xccc2('0x13'),_0xccc2('0x19')),controller[_0xccc2('0x1a')]);router[_0xccc2('0x17')](_0xccc2('0x1b'),auth['isAuthenticated'](),controller[_0xccc2('0x1c')]);module[_0xccc2('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 6bd7fa0..e9452d0 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 _0xdaa7=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x519b55,_0x1597a7){var _0x5baf3d=function(_0x5d3901){while(--_0x5d3901){_0x519b55['push'](_0x519b55['shift']());}};_0x5baf3d(++_0x1597a7);}(_0xdaa7,0x154));var _0x7daa=function(_0x45c981,_0x2ad2d4){_0x45c981=_0x45c981-0x0;var _0x4f62c8=_0xdaa7[_0x45c981];return _0x4f62c8;};'use strict';var Sequelize=require(_0x7daa('0x0'));var moment=require(_0x7daa('0x1'));module[_0x7daa('0x2')]={'closed':{'type':Sequelize[_0x7daa('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7daa('0x4')]},'disposition':{'type':Sequelize[_0x7daa('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7daa('0x5')]},'note':{'type':Sequelize[_0x7daa('0x5')]},'phone':{'type':Sequelize[_0x7daa('0x5')]},'read1stAt':{'type':Sequelize[_0x7daa('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7daa('0x6')]('in',_0x7daa('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x7daa('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9d26=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x476705,_0x34fe4c){var _0x520734=function(_0x178f06){while(--_0x178f06){_0x476705['push'](_0x476705['shift']());}};_0x520734(++_0x34fe4c);}(_0x9d26,0x17d));var _0x69d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d26[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x69d2('0x0'));var moment=require('moment');module[_0x69d2('0x1')]={'closed':{'type':Sequelize[_0x69d2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x69d2('0x3')]},'disposition':{'type':Sequelize[_0x69d2('0x4')]},'secondDisposition':{'type':Sequelize[_0x69d2('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x69d2('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x69d2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x69d2('0x5')]('in',_0x69d2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x69d2('0x5')]('in',_0x69d2('0x6')),'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 e6961ca..dac775e 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 _0x0588=['keys','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','count','merge','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','filtears','includeAll','include','options','create','describe','addMessage','ids','findOne','WhatsappMessage','rawAttributes','nolimit','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','server','files','tmp','root','attachments','join','format','CmContact','firstName','lastName','Attachment','direction','secret','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\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','Whatsapp','YYYY-MM-DD','Owner','N.A.','closedAt','disposition','Messages','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','err','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','fullname','TagIds','Tags','forEach','push','catch','index','map','type','key','model','query','filters','attributes','intersection','fields','length','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','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','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$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','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x0588,0x16f));var _0x8058=function(_0x333c95,_0x51c818){_0x333c95=_0x333c95-0x0;var _0x1376e5=_0x0588[_0x333c95];return _0x1376e5;};'use strict';var pdf=require(_0x8058('0x0'));var emlformat=require(_0x8058('0x1'));var rimraf=require(_0x8058('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8058('0x3'));var rp=require(_0x8058('0x4'));var moment=require(_0x8058('0x5'));var BPromise=require(_0x8058('0x6'));var Mustache=require(_0x8058('0x7'));var util=require(_0x8058('0x8'));var path=require(_0x8058('0x9'));var sox=require(_0x8058('0xa'));var csv=require(_0x8058('0xb'));var ejs=require(_0x8058('0xc'));var fs=require('fs');var _=require(_0x8058('0xd'));var squel=require(_0x8058('0xe'));var crypto=require(_0x8058('0xf'));var jsforce=require(_0x8058('0x10'));var deskjs=require(_0x8058('0x11'));var toCsv=require(_0x8058('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8058('0x12'));var authService=require(_0x8058('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8058('0x14'));var hardwareService=require(_0x8058('0x15'));var logger=require(_0x8058('0x16'))('api');var utils=require(_0x8058('0x17'));var config=require(_0x8058('0x18'));var licenseUtil=require(_0x8058('0x19'));var db=require(_0x8058('0x1a'))['db'];config['redis']=_[_0x8058('0x1b')](config[_0x8058('0x1c')],{'host':_0x8058('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8058('0x1c')]));require('./whatsappInteraction.socket')[_0x8058('0x1e')](socket);function respondWithStatusCode(_0x35ed6c,_0x3ce875){_0x3ce875=_0x3ce875||0xcc;return function(_0x3b2058){if(_0x3b2058){return _0x35ed6c[_0x8058('0x1f')](_0x3ce875);}return _0x35ed6c[_0x8058('0x20')](_0x3ce875)[_0x8058('0x21')]();};}function respondWithResult(_0x5caf50,_0x437a1f){_0x437a1f=_0x437a1f||0xc8;return function(_0x4f28e8){if(_0x4f28e8){return _0x5caf50[_0x8058('0x20')](_0x437a1f)['json'](_0x4f28e8);}};}function respondWithFilteredResult(_0x2d1020,_0x188b23){return function(_0x2b35c3){if(_0x2b35c3){var _0x44271a=_0x2b35c3['count'],_0x4c7327=_0x188b23['offset'],_0x44d4ef=_0x188b23[_0x8058('0x22')]+_0x188b23[_0x8058('0x23')],_0x4f73a4;if(_0x44d4ef>=_0x44271a){_0x44d4ef=_0x44271a;_0x4f73a4=0xc8;}else{_0x4f73a4=0xce;}_0x2d1020[_0x8058('0x20')](_0x4f73a4);return _0x2d1020[_0x8058('0x24')](_0x8058('0x25'),_0x4c7327+'-'+_0x44d4ef+'/'+_0x44271a)['json'](_0x2b35c3);}return null;};}function patchUpdates(_0x12af98){return function(_0x521fc3){try{jsonpatch[_0x8058('0x26')](_0x521fc3,_0x12af98,!![]);}catch(_0x326af4){return BPromise['reject'](_0x326af4);}return _0x521fc3[_0x8058('0x27')]();};}function saveUpdates(_0x3b043a,_0x5da645){return function(_0x3bb44b){if(_0x3bb44b){return _0x3bb44b[_0x8058('0x28')](_0x3b043a)[_0x8058('0x29')](function(_0x36ea48){return _0x36ea48;});}return null;};}function removeEntity(_0x5209ad,_0xc6c5cc){return function(_0x13f19c){if(_0x13f19c){return _0x13f19c[_0x8058('0x2a')]()[_0x8058('0x29')](function(){_0x5209ad['status'](0xcc)[_0x8058('0x21')]();});}};}function handleEntityNotFound(_0x15f5fd,_0x3d1d77){return function(_0x33a8fe){if(!_0x33a8fe){_0x15f5fd[_0x8058('0x1f')](0x194);}return _0x33a8fe;};}function handleError(_0x29951c,_0x5398ac){_0x5398ac=_0x5398ac||0x1f4;return function(_0x32ba9c){logger[_0x8058('0x2b')](_0x32ba9c['stack']);if(_0x32ba9c[_0x8058('0x2c')]){delete _0x32ba9c['name'];}_0x29951c[_0x8058('0x20')](_0x5398ac)['send'](_0x32ba9c);};}function getInteractionUsers(_0xbb276c,_0x54cb87){return new BPromise(function(_0x13a83c,_0x9dc0c8){try{if(_0x54cb87[_0xbb276c['id']]){_0xbb276c['Users']=_['map'](_0x54cb87[_0xbb276c['id']],function(_0x1b8d31){return{'id':_0x1b8d31['id'],'fullname':_0x1b8d31[_0x8058('0x2d')]};});}}catch(_0x9a996b){_0x9dc0c8(_0x9a996b);}_0x13a83c(_0xbb276c);});}function getInteractionTags(_0x55db4c,_0x2e84cd){return new BPromise(function(_0x50fc6f,_0x4d0009){try{if(_0x55db4c[_0x8058('0x2e')]){_0x55db4c[_0x8058('0x2f')]=[];_0x55db4c[_0x8058('0x2e')]['split'](',')[_0x8058('0x30')](function(_0x23bbec){_0x55db4c['Tags'][_0x8058('0x31')](_0x2e84cd[_0x23bbec]);});}delete _0x55db4c['TagIds'];}catch(_0x2ceb80){_0x4d0009(_0x2ceb80);}_0x50fc6f(_0x55db4c);});}function updateWhatsappInteraction(_0x167159,_0xb201ee,_0xa32ff1){return new BPromise(function(_0x1acb54,_0xb65dd6){return getInteractionUsers(_0x167159,_0xa32ff1)[_0x8058('0x29')](function(_0x5e65ef){return getInteractionTags(_0x5e65ef,_0xb201ee);})['then'](function(_0x590935){_0x1acb54(_0x590935);})[_0x8058('0x32')](function(_0xc6ddbd){_0xb65dd6(_0xc6ddbd);});});}exports[_0x8058('0x33')]=function(_0xbe84c1,_0x1a5572){var _0x54d08a={},_0x1e8f34={},_0x3c9824={'count':0x0,'rows':[]};var _0x3445dc=_[_0x8058('0x34')](db['WhatsappInteraction']['rawAttributes'],function(_0x4342d5){return{'name':_0x4342d5['fieldName'],'type':_0x4342d5[_0x8058('0x35')][_0x8058('0x36')]};});_0x1e8f34[_0x8058('0x37')]=_['map'](_0x3445dc,_0x8058('0x2c'));_0x1e8f34[_0x8058('0x38')]=_['keys'](_0xbe84c1[_0x8058('0x38')]);_0x1e8f34[_0x8058('0x39')]=_['intersection'](_0x1e8f34['model'],_0x1e8f34['query']);_0x54d08a[_0x8058('0x3a')]=_[_0x8058('0x3b')](_0x1e8f34[_0x8058('0x37')],qs[_0x8058('0x3c')](_0xbe84c1[_0x8058('0x38')][_0x8058('0x3c')]));_0x54d08a[_0x8058('0x3a')]=_0x54d08a['attributes'][_0x8058('0x3d')]?_0x54d08a[_0x8058('0x3a')]:_0x1e8f34['model'];if(!_0xbe84c1[_0x8058('0x38')]['hasOwnProperty']('nolimit')){_0x54d08a[_0x8058('0x23')]=qs[_0x8058('0x23')](_0xbe84c1[_0x8058('0x38')][_0x8058('0x23')]);_0x54d08a[_0x8058('0x22')]=qs[_0x8058('0x22')](_0xbe84c1['query'][_0x8058('0x22')]);}_0x54d08a['order']=qs[_0x8058('0x3e')](_0xbe84c1['query'][_0x8058('0x3e')]);_0x54d08a[_0x8058('0x3f')]=qs['filters'](_[_0x8058('0x40')](_0xbe84c1['query'],_0x1e8f34[_0x8058('0x39')]),_0x3445dc);var _0x23bbbd=[];var _0x3fc64=squel[_0x8058('0x41')]()['field']('id')[_0x8058('0x42')](_0x8058('0x2c'))['field'](_0x8058('0x43'))[_0x8058('0x44')](_0x8058('0x45'));var _0x2ecb60=squel['select']()[_0x8058('0x42')](_0x8058('0x46'))['field'](_0x8058('0x47'))[_0x8058('0x42')](_0x8058('0x48'))[_0x8058('0x44')]('user_has_whatsapp_interactions','ui')[_0x8058('0x49')](_0x8058('0x4a'),'u',_0x8058('0x4b'));var _0x95f066=squel[_0x8058('0x41')]()[_0x8058('0x44')]('whatsapp_interactions','i')[_0x8058('0x49')](_0x8058('0x4c'),'c',_0x8058('0x4d'))['left_join'](_0x8058('0x4a'),'o',_0x8058('0x4e'))['left_join'](_0x8058('0x4f'),'a',_0x8058('0x50'))[_0x8058('0x49')](_0x8058('0x51'),'me',_0x8058('0x52'))[_0x8058('0x49')](_0x8058('0x53'),'it',_0x8058('0x54'))['left_join'](_0x8058('0x45'),'t','t.id\x20=\x20it.TagId');var _0x2f8390=squel['expr']();var _0x406fc8=[];var _0x53a88f=squel[_0x8058('0x55')]();var _0x3c3b25;if(_0xbe84c1[_0x8058('0x38')][_0x8058('0x56')]){_0x3c3b25=as['parseSearch'](_0xbe84c1[_0x8058('0x38')]['search']);var _0x5567ff=_0x3c3b25[_0x8058('0x57')];for(var _0x5563af=0x0;_0x5563af<_0x3c3b25[_0x8058('0x58')]['length'];_0x5563af++){var _0x1767ce=_0x3c3b25[_0x8058('0x58')][_0x5563af];var _0x145fa8='i';var _0x32291c=_[_0x8058('0x59')](_0x3445dc,[_0x8058('0x2c'),_0x1767ce['field']]);if(!_0x32291c){switch(_0x1767ce[_0x8058('0x42')]){case _0x8058('0x5a'):if(_0x1767ce[_0x8058('0x5b')]==0x1){_0x95f066[_0x8058('0x5c')]('`'+_0x1767ce[_0x8058('0x42')]+'`\x20=\x200');}else{_0x95f066['having']('`'+_0x1767ce[_0x8058('0x42')]+_0x8058('0x5d'));}break;case _0x8058('0x5e'):if(_0x1767ce['operator']===_0x8058('0x5f')){if(_0x1767ce['value'][_0x8058('0x60')]('\x20')[_0x8058('0x3d')]>0x1){_0x2f8390[_0x5567ff](_0x8058('0x61'),qs[_0x8058('0x62')](_0x1767ce[_0x8058('0x5b')]),null);}else{var _0x1843c5='%'+_0x1767ce[_0x8058('0x5b')]+'%';_0x2f8390[_0x5567ff](_0x8058('0x63'),_0x1843c5,_0x1843c5,_0x1843c5);}}else{_0x32291c=_['find'](_0x3445dc,[_0x8058('0x2c'),_0x8058('0x64')]);_0x1767ce[_0x8058('0x42')]=_0x8058('0x64');_0x3f8f09=as[_0x8058('0x65')](_0x145fa8,_0x32291c[_0x8058('0x35')],_0x1767ce);_0x2f8390[_0x5567ff](_0x3f8f09[_0x8058('0x66')],_0x3f8f09[_0x8058('0x5b')]['start'],_0x3f8f09[_0x8058('0x5b')]['end']);}break;case _0x8058('0x67'):var _0x363918=_0x1767ce[_0x8058('0x5b')][_0x8058('0x60')](',')[_0x8058('0x34')](function(_0x5599ec){return Number(_0x5599ec);});_0x363918['forEach'](function(_0x59a1e9){_0x53a88f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x59a1e9+',%');});_0x406fc8=_[_0x8058('0x68')](_0x406fc8,_0x363918);break;case _0x8058('0x69'):if(_0x1767ce[_0x8058('0x6a')]===_0x8058('0x5f')){_0x2f8390[_0x5567ff](_0x8058('0x6b'),'%'+_0x1767ce[_0x8058('0x5b')]+'%',null);}else{_0x32291c=_[_0x8058('0x59')](_0x3445dc,[_0x8058('0x2c'),_0x8058('0x6c')]);_0x1767ce[_0x8058('0x42')]=_0x8058('0x6c');_0x3f8f09=as[_0x8058('0x65')](_0x145fa8,_0x32291c[_0x8058('0x35')],_0x1767ce);_0x2f8390[_0x5567ff](_0x3f8f09[_0x8058('0x66')],_0x3f8f09[_0x8058('0x5b')][_0x8058('0x6d')],_0x3f8f09[_0x8058('0x5b')][_0x8058('0x21')]);}break;case _0x8058('0x6e'):_0x3f8f09=as[_0x8058('0x65')]('me',null,_0x1767ce);_0x2f8390[_0x5567ff](_0x3f8f09['text'],_0x3f8f09[_0x8058('0x5b')][_0x8058('0x6d')],_0x3f8f09[_0x8058('0x5b')][_0x8058('0x21')]);break;}}else{var _0x3f8f09=as[_0x8058('0x65')](_0x145fa8,_0x32291c[_0x8058('0x35')],_0x1767ce);_0x2f8390[_0x5567ff](_0x3f8f09[_0x8058('0x66')],_0x3f8f09[_0x8058('0x5b')][_0x8058('0x6d')],_0x3f8f09['value'][_0x8058('0x21')]);}}}else{var _0x40d897=_(_0xbe84c1['query'])[_0x8058('0x6f')]()[_0x8058('0x34')](function(_0x56014b){return _[_0x8058('0x70')](_0x3445dc,[_0x8058('0x2c'),_0x56014b])?_0x56014b:undefined;})[_0x8058('0x71')]()[_0x8058('0x5b')]();if(!_[_0x8058('0x72')](_0x40d897)){_0x40d897[_0x8058('0x30')](function(_0x1f8ab3){if(_0x1f8ab3===_0x8058('0x73')){_0x95f066[_0x8058('0x3f')]('i.WhatsappAccountId\x20IN\x20?',[][_0x8058('0x74')](_0xbe84c1['query'][_0x1f8ab3]));}else if(_0x1f8ab3===_0x8058('0x75')){var _0x14adee=JSON['parse'](_0xbe84c1[_0x8058('0x38')][_0x1f8ab3])[_0x8058('0x76')];var _0x1161ef=JSON[_0x8058('0x77')](_0xbe84c1[_0x8058('0x38')][_0x1f8ab3])[_0x8058('0x78')];_0x95f066[_0x8058('0x3f')](_0x8058('0x79'),_0x14adee,_0x1161ef);}else{if(_0xbe84c1['query'][_0x1f8ab3]===_0x8058('0x7a')){_0x95f066[_0x8058('0x3f')]('i.'+_0x1f8ab3+_0x8058('0x7b'));}else{_0x95f066[_0x8058('0x3f')]('i.'+_0x1f8ab3+_0x8058('0x7c'),_0xbe84c1['query'][_0x1f8ab3]);}}});}if(_0xbe84c1[_0x8058('0x38')][_0x8058('0x7d')]){if(_0xbe84c1[_0x8058('0x38')]['read']==0x1){_0x95f066['having'](_0x8058('0x7e'));}else{_0x95f066[_0x8058('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0xbe84c1[_0x8058('0x38')][_0x8058('0x7f')]){_0x406fc8=_[_0x8058('0x80')](_0xbe84c1[_0x8058('0x38')][_0x8058('0x7f')])?_0xbe84c1['query'][_0x8058('0x7f')]:new Array(_0xbe84c1[_0x8058('0x38')][_0x8058('0x7f')]);_0x406fc8[_0x8058('0x30')](function(_0x4f3bde){_0x53a88f['or'](_0x8058('0x81'),'%,'+_0x4f3bde+',%');});}if(_0xbe84c1[_0x8058('0x38')][_0x8058('0x82')]){var _0x4a2cec=_0xbe84c1[_0x8058('0x38')][_0x8058('0x82')][_0x8058('0x83')]('\x5c','\x5c\x5c')[_0x8058('0x83')]('\x27\x27',_0x8058('0x84'));if(qs[_0x8058('0x85')](_0x4a2cec)){_0x2f8390['or']('i.id\x20LIKE\x20?',_0x4a2cec+'%')['or'](_0x8058('0x86'),_0x4a2cec+'%');}else{_0x2f8390['or'](_0x8058('0x87'),qs[_0x8058('0x62')](_0x4a2cec))['or'](_0x8058('0x88'),_0x4a2cec+'%');}}}_0x95f066['where'](_0x2f8390);_0x95f066['group']('i.id');var _0x36ba93={'type':db[_0x8058('0x89')][_0x8058('0x8a')]['SELECT'],'raw':!![]};var _0x4a6140=_0x95f066[_0x8058('0x8b')]();_0x4a6140[_0x8058('0x42')]('i.id');_0x4a6140[_0x8058('0x42')](_0x8058('0x8c'),_0x8058('0x5a'));if(_0x54d08a[_0x8058('0x8d')]){_0x54d08a[_0x8058('0x8d')][_0x8058('0x30')](function(_0x5ad157){_0x95f066['order']('i.'+_0x5ad157[0x0],_0x5ad157[0x1]===_0x8058('0x8e')?![]:!![]);});}if(!_[_0x8058('0x72')](_0x406fc8)){_0x95f066['having'](_0x53a88f);_0x4a6140[_0x8058('0x3f')](_0x8058('0x8f'),_0x406fc8);}BPromise[_0x8058('0x90')]()['then'](function(){if(!_0x3c3b25){if(_0xbe84c1['query'][_0x8058('0x73')]||_0xbe84c1['query'][_0x8058('0x91')])return;_0x4a6140[_0x8058('0x3f')](_0x8058('0x92'));_0x95f066[_0x8058('0x3f')](_0x8058('0x92'));return;}return _0xbe84c1['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x8058('0x29')](function(_0x9acec4){if(_[_0x8058('0x72')](_0x9acec4)){_0x4a6140[_0x8058('0x3f')](_0x8058('0x93'));_0x95f066[_0x8058('0x3f')](_0x8058('0x93'));}else{_0x4a6140['where'](_0x8058('0x94'),_[_0x8058('0x34')](_0x9acec4,'id'));_0x95f066[_0x8058('0x3f')]('i.WhatsappAccountId\x20IN\x20?',_[_0x8058('0x34')](_0x9acec4,'id'));}});})['then'](function(){db[_0x8058('0x95')][_0x8058('0x38')](_0x4a6140[_0x8058('0x96')](),_0x36ba93)['then'](function(_0x1e53a1){_0x3c9824[_0x8058('0x97')]=_0x1e53a1[_0x8058('0x3d')];if(_0x3c9824[_0x8058('0x97')]===0x0)return[];return db[_0x8058('0x95')][_0x8058('0x38')](_0x3fc64[_0x8058('0x96')](),_0x36ba93)[_0x8058('0x29')](function(_0xf1b7de){_0x23bbbd=_['keyBy'](_0xf1b7de,'id');_0x36ba93=_[_0x8058('0x98')](_0x36ba93,{'model':db[_0x8058('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xbe84c1['query'][_0x8058('0x3c')]){_0x54d08a['attributes']['forEach'](function(_0x498b98){_0x95f066[_0x8058('0x42')]('i.'+_0x498b98);});}else{_0x95f066[_0x8058('0x42')](_0x8058('0x8c'),'unreadMessages');_0x95f066[_0x8058('0x42')](_0x8058('0x9a'),_0x8058('0x9b'));_0x95f066[_0x8058('0x42')](_0x8058('0x9c'),'Account.mandatoryDisposition');_0x95f066['field'](_0x8058('0x9d'));_0x95f066['field'](_0x8058('0x9e'),_0x8058('0x9f'));_0x95f066['field'](_0x8058('0xa0'),_0x8058('0xa1'));_0x95f066[_0x8058('0x42')](_0x8058('0xa2'),_0x8058('0xa3'));_0x95f066[_0x8058('0x42')](_0x8058('0xa4'),_0x8058('0xa5'));_0x95f066['field'](_0x8058('0xa6'),_0x8058('0xa7'));_0x95f066[_0x8058('0x42')](_0x8058('0xa8'),_0x8058('0xa9'));_0x95f066['field'](_0x8058('0xaa'),_0x8058('0xab'));_0x95f066['field'](_0x8058('0xac'),'Owner.internal');_0x95f066['field'](_0x8058('0xad'),_0x8058('0x2e'));}if(_0x54d08a[_0x8058('0x23')])_0x95f066[_0x8058('0x23')](_0x54d08a[_0x8058('0x23')]);if(_0x54d08a['offset'])_0x95f066[_0x8058('0x22')](_0x54d08a['offset']);return db[_0x8058('0x95')][_0x8058('0x38')](_0x95f066[_0x8058('0x96')](),_0x36ba93);})[_0x8058('0x29')](function(_0x18c658){_0x2ecb60[_0x8058('0x3f')](_0x8058('0xae'),_[_0x8058('0x34')](_0x18c658,'id'));return db[_0x8058('0x95')]['query'](_0x2ecb60[_0x8058('0x96')](),_0x36ba93)['then'](function(_0x2bcc71){var _0x2bd3f6=_[_0x8058('0xaf')](_0x2bcc71,_0x8058('0xb0'));var _0x1e7eb5=[];_0x18c658['forEach'](function(_0x232639){_0x1e7eb5['push'](updateWhatsappInteraction(_0x232639,_0x23bbbd,_0x2bd3f6));});return BPromise[_0x8058('0xb1')](_0x1e7eb5);});});})[_0x8058('0x29')](function(_0x4558f3){_0x3c9824[_0x8058('0xb2')]=_0x4558f3;return _0x3c9824;})[_0x8058('0x29')](respondWithFilteredResult(_0x1a5572,_0x54d08a));})['catch'](handleError(_0x1a5572,null));};exports[_0x8058('0xb3')]=function(_0x1bb043,_0x44d74a){var _0x137708={'raw':![],'where':{'id':_0x1bb043[_0x8058('0xb4')]['id']}},_0x58415d={};_0x58415d[_0x8058('0x37')]=_['keys'](db[_0x8058('0x99')]['rawAttributes']);_0x58415d[_0x8058('0x38')]=_[_0x8058('0x6f')](_0x1bb043[_0x8058('0x38')]);_0x58415d[_0x8058('0xb5')]=_[_0x8058('0x3b')](_0x58415d[_0x8058('0x37')],_0x58415d[_0x8058('0x38')]);_0x137708[_0x8058('0x3a')]=_['intersection'](_0x58415d[_0x8058('0x37')],qs[_0x8058('0x3c')](_0x1bb043['query'][_0x8058('0x3c')]));_0x137708['attributes']=_0x137708[_0x8058('0x3a')][_0x8058('0x3d')]?_0x137708['attributes']:_0x58415d[_0x8058('0x37')];if(_0x1bb043[_0x8058('0x38')][_0x8058('0xb6')]){_0x137708[_0x8058('0xb7')]=[{'all':!![]}];}_0x137708=_[_0x8058('0x98')]({},_0x137708,_0x1bb043[_0x8058('0xb8')]);return db[_0x8058('0x99')]['find'](_0x137708)['then'](handleEntityNotFound(_0x44d74a,null))[_0x8058('0x29')](respondWithResult(_0x44d74a,null))['catch'](handleError(_0x44d74a,null));};exports[_0x8058('0xb9')]=function(_0xe15006,_0x4c608d){return db[_0x8058('0x99')][_0x8058('0xb9')](_0xe15006[_0x8058('0x6e')],{})[_0x8058('0x29')](respondWithResult(_0x4c608d,0xc9))[_0x8058('0x32')](handleError(_0x4c608d,null));};exports['update']=function(_0x567132,_0x43ce70){if(_0x567132[_0x8058('0x6e')]['id']){delete _0x567132[_0x8058('0x6e')]['id'];}return db[_0x8058('0x99')]['find']({'where':{'id':_0x567132['params']['id']}})[_0x8058('0x29')](handleEntityNotFound(_0x43ce70,null))['then'](saveUpdates(_0x567132[_0x8058('0x6e')],null))[_0x8058('0x29')](respondWithResult(_0x43ce70,null))['catch'](handleError(_0x43ce70,null));};exports[_0x8058('0x2a')]=function(_0x17aa4c,_0x3bb70f){return db[_0x8058('0x99')][_0x8058('0x59')]({'where':{'id':_0x17aa4c[_0x8058('0xb4')]['id']}})[_0x8058('0x29')](handleEntityNotFound(_0x3bb70f,null))[_0x8058('0x29')](removeEntity(_0x3bb70f,null))['catch'](handleError(_0x3bb70f,null));};exports[_0x8058('0xba')]=function(_0x212347,_0x376df7){return db[_0x8058('0x99')][_0x8058('0xba')]()[_0x8058('0x29')](respondWithResult(_0x376df7,null))['catch'](handleError(_0x376df7,null));};exports['addMessage']=function(_0x326eae,_0x465eca,_0x12da2d){return db['WhatsappMessage'][_0x8058('0x59')]({'where':{'id':_0x326eae['params']['id']}})[_0x8058('0x29')](handleEntityNotFound(_0x465eca,null))[_0x8058('0x29')](function(_0x47cdef){if(_0x47cdef){return _0x47cdef[_0x8058('0xbb')](_0x326eae[_0x8058('0x6e')][_0x8058('0xbc')],_['omit'](_0x326eae['body'],['ids','id'])||{});}})[_0x8058('0x29')](respondWithResult(_0x465eca,null))['catch'](handleError(_0x465eca,null));};exports['getMessages']=function(_0x103696,_0x2f82ec,_0x461dae){var _0x5f4174={'raw':![],'where':{}};var _0x52cc48={};var _0x5b3ba4={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x8058('0xbd')]({'where':{'id':_0x103696[_0x8058('0xb4')]['id']}})[_0x8058('0x29')](handleEntityNotFound(_0x2f82ec,null))[_0x8058('0x29')](function(_0x5b9677){if(_0x5b9677){_0x52cc48['model']=_[_0x8058('0x6f')](db[_0x8058('0xbe')][_0x8058('0xbf')]);_0x52cc48[_0x8058('0x38')]=_[_0x8058('0x6f')](_0x103696[_0x8058('0x38')]);_0x52cc48[_0x8058('0x39')]=_[_0x8058('0x3b')](_0x52cc48['model'],_0x52cc48[_0x8058('0x38')]);_0x5f4174[_0x8058('0x3a')]=_[_0x8058('0x3b')](_0x52cc48[_0x8058('0x37')],qs[_0x8058('0x3c')](_0x103696[_0x8058('0x38')][_0x8058('0x3c')]));_0x5f4174[_0x8058('0x3a')]=_0x5f4174[_0x8058('0x3a')][_0x8058('0x3d')]?_0x5f4174['attributes']:_0x52cc48['model'];if(!_0x103696[_0x8058('0x38')]['hasOwnProperty'](_0x8058('0xc0'))){_0x5f4174[_0x8058('0x23')]=qs['limit'](_0x103696[_0x8058('0x38')]['limit']);_0x5f4174[_0x8058('0x22')]=qs[_0x8058('0x22')](_0x103696[_0x8058('0x38')][_0x8058('0x22')]);}_0x5f4174[_0x8058('0x8d')]=qs['sort'](_0x103696[_0x8058('0x38')][_0x8058('0x3e')]);_0x5f4174[_0x8058('0x3f')]=qs[_0x8058('0x39')](_['pick'](_0x103696['query'],_0x52cc48[_0x8058('0x39')]));_0x5f4174[_0x8058('0x3f')][_0x8058('0xb0')]=_0x5b9677['id'];if(_0x103696[_0x8058('0x38')][_0x8058('0x82')]){_0x5f4174[_0x8058('0x3f')]=_[_0x8058('0x98')](_0x5f4174[_0x8058('0x3f')],{'$or':_[_0x8058('0x34')](_0x5f4174['attributes'],function(_0x367458){var _0x1c8562={};_0x1c8562[_0x367458]={'$like':'%'+_0x103696[_0x8058('0x38')]['filter']+'%'};return _0x1c8562;})});}if(_0x103696[_0x8058('0x38')][_0x8058('0x76')]){var _0x476cf4=_0x103696[_0x8058('0x38')][_0x8058('0x76')][_0x8058('0x60')](',');var _0x503fa9={};_0x503fa9[_0x476cf4[0x0]]={'$gte':moment(_0x476cf4[0x1])['format'](_0x8058('0xc1'))};_0x5f4174['where']=_[_0x8058('0x98')](_0x5f4174[_0x8058('0x3f')],_0x503fa9);}_0x5f4174=_[_0x8058('0x98')]({},_0x5f4174,_0x103696['options']);return db[_0x8058('0xbe')][_0x8058('0x97')]({'where':_0x5f4174['where']})[_0x8058('0x29')](function(_0x59c624){_0x5b3ba4['count']=_0x59c624;if(_0x103696['query'][_0x8058('0xb6')]){_0x5f4174[_0x8058('0xb7')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x8058('0xc2')](_0x5f4174);})[_0x8058('0x29')](function(_0x515b2b){_0x5b3ba4['rows']=_0x515b2b;return _0x5b3ba4;});}})[_0x8058('0x29')](respondWithFilteredResult(_0x2f82ec,_0x5f4174))[_0x8058('0x32')](handleError(_0x2f82ec,null));};exports[_0x8058('0xc3')]=function(_0x19cc06,_0xb99988,_0x46eeed){return db[_0x8058('0x99')][_0x8058('0x59')]({'where':{'id':_0x19cc06[_0x8058('0xb4')]['id']}})[_0x8058('0x29')](handleEntityNotFound(_0xb99988,null))[_0x8058('0x29')](function(_0x24302e){if(_0x24302e){return _0x24302e['setTags'](_0x19cc06[_0x8058('0x6e')]['ids'],_['omit'](_0x19cc06[_0x8058('0x6e')],[_0x8058('0xbc'),'id'])||{})[_0x8058('0xc4')](function(){return db[_0x8058('0x67')][_0x8058('0xc2')]({'attributes':['id',_0x8058('0x2c'),_0x8058('0x43')],'where':{'id':_0x19cc06[_0x8058('0x6e')][_0x8058('0xbc')]}});})[_0x8058('0x29')](function(_0x72dd4c){socket[_0x8058('0xc5')](_0x8058('0xc6'),{'id':Number(_0x19cc06[_0x8058('0xb4')]['id']),'tags':_0x72dd4c||[]});return{'id':Number(_0x19cc06[_0x8058('0xb4')]['id']),'tags':_0x72dd4c||[]};});}})[_0x8058('0x29')](respondWithResult(_0xb99988,null))[_0x8058('0x32')](handleError(_0xb99988,null));};exports[_0x8058('0xc7')]=function(_0x2eef5c,_0x37284e,_0x16de69){return db[_0x8058('0x99')]['find']({'where':{'id':_0x2eef5c[_0x8058('0xb4')]['id']}})[_0x8058('0x29')](handleEntityNotFound(_0x37284e,null))[_0x8058('0x29')](function(_0x5514e8){if(_0x5514e8){return _0x5514e8['removeTags'](_0x2eef5c[_0x8058('0x38')][_0x8058('0xbc')]);}})['then'](respondWithStatusCode(_0x37284e,null))[_0x8058('0x32')](handleError(_0x37284e,null));};exports[_0x8058('0xc8')]=function(_0x18603f,_0x3a38bc){var _0x412738=moment()['unix']()[_0x8058('0x96')]();var _0x528520=path['join'](config['root'],_0x8058('0xc9'),_0x8058('0xca'),_0x8058('0xcb'));var _0x57521e=path['join'](config[_0x8058('0xcc')],_0x8058('0xc9'),_0x8058('0xca'),_0x8058('0xcd'));var _0x24cc67=path[_0x8058('0xce')](_0x528520,_0x412738);var _0x3c04e7=util[_0x8058('0xcf')]('transcript-%d-%s.zip',_0x18603f[_0x8058('0xb4')]['id'],_0x412738);var _0x110907=path[_0x8058('0xce')](_0x528520,_0x3c04e7);var _0x4f5096=[];_0x4f5096[_0x8058('0x31')]({'model':db[_0x8058('0x69')],'as':_0x8058('0x69'),'attributes':['id',_0x8058('0x2d')],'raw':!![]});_0x4f5096[_0x8058('0x31')]({'model':db[_0x8058('0xd0')],'as':_0x8058('0x5e'),'attributes':['id',_0x8058('0xd1'),_0x8058('0xd2')],'raw':!![]});if(_0x18603f[_0x8058('0x38')][_0x8058('0xcd')]){_0x4f5096[_0x8058('0x31')]({'model':db[_0x8058('0xd3')],'as':_0x8058('0xd3'),'raw':!![]});}var _0x110137=[{'model':db[_0x8058('0xbe')],'as':'Messages','attributes':['id',_0x8058('0x6e'),_0x8058('0x75'),_0x8058('0xd4'),_0x8058('0xd5'),_0x8058('0x7d')],'include':_0x4f5096}];_0x110137[_0x8058('0x31')]({'model':db['WhatsappAccount'],'as':_0x8058('0xd6'),'attributes':['id','name']});_0x110137['push']({'model':db[_0x8058('0x69')],'as':'Owner','attributes':['id',_0x8058('0x2d')]});return db[_0x8058('0x99')][_0x8058('0x59')]({'where':{'id':_0x18603f[_0x8058('0xb4')]['id']},'include':_0x110137})[_0x8058('0x29')](handleEntityNotFound(_0x3a38bc,null))[_0x8058('0x29')](function(_0x43be46){if(_0x43be46){var _0x4e603c=_0x43be46[_0x8058('0xd7')]({'plain':!![]});fs[_0x8058('0xd8')](_0x24cc67);var _0xf3908d={'format':'A4','border':_0x8058('0xd9'),'header':{'height':_0x8058('0xda'),'contents':{'first':_0x8058('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0x8058('0xcf')](_0x8058('0xdc'),util[_0x8058('0xcf')]('%s\x20#%d',_0x8058('0xdd'),_0x4e603c['id']),moment()[_0x8058('0xcf')](_0x8058('0xde'))[_0x8058('0x96')]())}}};var _0x3c7c6a={'channel':_0x8058('0xdd'),'account':_0x4e603c['Account'][_0x8058('0x2c')],'agent':_0x4e603c['Owner']?_0x4e603c[_0x8058('0xdf')]['fullname']:_0x8058('0xe0'),'createdAt':moment(_0x4e603c[_0x8058('0x75')])[_0x8058('0xcf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4e603c['closed']?moment(_0x4e603c[_0x8058('0xe1')])['format'](_0x8058('0xc1'))[_0x8058('0x96')]():'','disposition':_0x4e603c[_0x8058('0xe2')],'messages':_(_0x4e603c[_0x8058('0xe3')])[_0x8058('0x82')]({'secret':![]})[_0x8058('0x34')](function(_0x447fd4){if(_0x447fd4['Attachment']){var _0x3008a1=path['join'](_0x57521e,_0x447fd4[_0x8058('0xd3')]['basename']);if(fs['existsSync'](_0x3008a1)){fs[_0x8058('0xe4')](_0x3008a1)[_0x8058('0xe5')](fs[_0x8058('0xe6')](path['join'](_0x24cc67,_0x447fd4[_0x8058('0xd3')]['basename'])));}}return{'date':moment(_0x447fd4[_0x8058('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x447fd4[_0x8058('0xd4')]===_0x8058('0xe7')?_0x447fd4[_0x8058('0x69')]?_0x447fd4['User'][_0x8058('0x2d')]:'System':_0x447fd4[_0x8058('0x5e')][_0x8058('0xd1')]+(_0x447fd4[_0x8058('0x5e')][_0x8058('0xd2')]?'\x20'+_0x447fd4[_0x8058('0x5e')]['lastName']:''),'body':_0x447fd4[_0x8058('0xd3')]?_0x447fd4[_0x8058('0xd3')]['basename']:_0x447fd4[_0x8058('0x6e')],'direction':_0x447fd4['direction']===_0x8058('0xe7')?'A':'C','secret':_0x447fd4['secret'],'read':_0x447fd4['read'],'attachment':_0x447fd4['Attachment']};})[_0x8058('0x5b')]()};return ejs[_0x8058('0xe8')](path[_0x8058('0xce')](config[_0x8058('0xcc')],'server',_0x8058('0xe9'),_0x8058('0xea')),{'interaction':_0x3c7c6a})[_0x8058('0x29')](function(_0x1e457b){return new BPromise(function(_0xc059a5,_0x4b7c99){pdf['create'](_0x1e457b,_0xf3908d)['toFile'](path[_0x8058('0xce')](_0x24cc67,_0x8058('0xeb')+_0x4e603c['id']+'-'+_0x412738+_0x8058('0xec')),function(_0x4d8b46,_0x4ba739){if(_0x4d8b46)return _0x4b7c99(_0x4d8b46);_0xc059a5(_0x4ba739);});});})['then'](function(){return new BPromise(function(_0x20f79d,_0x17ae2e){zipdir(_0x24cc67,{'saveTo':_0x110907},function(_0x306a7d,_0x7c17e9){if(_0x306a7d)return _0x17ae2e(_0x306a7d);return _0x20f79d(_0x7c17e9);});})[_0x8058('0x29')](function(){return new BPromise(function(_0xa7d058,_0x20c159){rimraf(_0x24cc67,function(_0x2a4cf6){if(_0x2a4cf6)_0x20c159(_0x2a4cf6);return _0xa7d058();});});})[_0x8058('0x29')](function(){return _0x3a38bc['download'](_0x110907,_0x3c04e7,function(_0x186707){if(_0x186707){console[_0x8058('0xed')](_0x8058('0xee'),_0x186707);}else{fs['unlinkSync'](_0x110907);}});});});}else{return _0x3a38bc[_0x8058('0x1f')](0xc8);}})['catch'](handleError(_0x3a38bc,null));}; \ No newline at end of file +var _0x257e=['text','start','Tag','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','buildExpression','body','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','catch','params','includeAll','include','create','update','destroy','describe','addMessage','WhatsappMessage','ids','getMessages','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','color','emit','whatsappInteractionTags:save','removeTags','download','files','tmp','join','root','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','10px','30px','Whatsapp','YYYY-MM-DD','N.A.','createdAt','closed','closedAt','basename','out','System','renderFile','downloadInteraction.html','transcript-','.pdf','log','err','rimraf','zip-dir','fast-json-patch','bluebird','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','then','stack','name','send','map','TagIds','split','forEach','push','index','WhatsappInteraction','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','users','u.id\x20=\x20ui.UserId','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','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','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'];(function(_0x4a9c97,_0x52be6d){var _0x4d8df4=function(_0x502216){while(--_0x502216){_0x4a9c97['push'](_0x4a9c97['shift']());}};_0x4d8df4(++_0x52be6d);}(_0x257e,0x15e));var _0xe257=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x257e[_0x4ec520];return _0xed49d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe257('0x0'));var zipdir=require(_0xe257('0x1'));var jsonpatch=require(_0xe257('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe257('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe257('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe257('0x5'));var squel=require(_0xe257('0x6'));var crypto=require(_0xe257('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xe257('0x8'));var toCsv=require(_0xe257('0x4'));var querystring=require(_0xe257('0x9'));var Papa=require(_0xe257('0xa'));var Redis=require(_0xe257('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xe257('0xc'));var as=require(_0xe257('0xd'));var hardwareService=require(_0xe257('0xe'));var logger=require(_0xe257('0xf'))('api');var utils=require(_0xe257('0x10'));var config=require(_0xe257('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe257('0x12'))['db'];config[_0xe257('0x13')]=_[_0xe257('0x14')](config[_0xe257('0x13')],{'host':_0xe257('0x15'),'port':0x18eb});var socket=require(_0xe257('0x16'))(new Redis(config[_0xe257('0x13')]));require(_0xe257('0x17'))[_0xe257('0x18')](socket);function respondWithStatusCode(_0x5c9aab,_0x4ab969){_0x4ab969=_0x4ab969||0xcc;return function(_0x5f3d15){if(_0x5f3d15){return _0x5c9aab[_0xe257('0x19')](_0x4ab969);}return _0x5c9aab[_0xe257('0x1a')](_0x4ab969)[_0xe257('0x1b')]();};}function respondWithResult(_0x55bc7e,_0x4fdd35){_0x4fdd35=_0x4fdd35||0xc8;return function(_0x415f8d){if(_0x415f8d){return _0x55bc7e[_0xe257('0x1a')](_0x4fdd35)[_0xe257('0x1c')](_0x415f8d);}};}function respondWithFilteredResult(_0x499a99,_0x1c5853){return function(_0x1da28b){if(_0x1da28b){var _0x1e5a1d=_0x1da28b[_0xe257('0x1d')],_0x3b38d9=_0x1c5853[_0xe257('0x1e')],_0x27e328=_0x1c5853[_0xe257('0x1e')]+_0x1c5853['limit'],_0x4dcfcd;if(_0x27e328>=_0x1e5a1d){_0x27e328=_0x1e5a1d;_0x4dcfcd=0xc8;}else{_0x4dcfcd=0xce;}_0x499a99[_0xe257('0x1a')](_0x4dcfcd);return _0x499a99['set'](_0xe257('0x1f'),_0x3b38d9+'-'+_0x27e328+'/'+_0x1e5a1d)['json'](_0x1da28b);}return null;};}function patchUpdates(_0x101b7c){return function(_0x1d0fd7){try{jsonpatch[_0xe257('0x20')](_0x1d0fd7,_0x101b7c,!![]);}catch(_0x3296fd){return BPromise['reject'](_0x3296fd);}return _0x1d0fd7['save']();};}function saveUpdates(_0x46d501,_0x49e745){return function(_0x493e46){if(_0x493e46){return _0x493e46['update'](_0x46d501)['then'](function(_0x17b7c3){return _0x17b7c3;});}return null;};}function removeEntity(_0x4a61dd,_0x1e6a69){return function(_0x36689a){if(_0x36689a){return _0x36689a['destroy']()[_0xe257('0x21')](function(){_0x4a61dd[_0xe257('0x1a')](0xcc)[_0xe257('0x1b')]();});}};}function handleEntityNotFound(_0x10d647,_0x172c7c){return function(_0x44b18d){if(!_0x44b18d){_0x10d647[_0xe257('0x19')](0x194);}return _0x44b18d;};}function handleError(_0x430213,_0x245f5c){_0x245f5c=_0x245f5c||0x1f4;return function(_0x48fdbd){logger['error'](_0x48fdbd[_0xe257('0x22')]);if(_0x48fdbd[_0xe257('0x23')]){delete _0x48fdbd[_0xe257('0x23')];}_0x430213['status'](_0x245f5c)[_0xe257('0x24')](_0x48fdbd);};}function getInteractionUsers(_0x3a1bb7,_0x228106){return new BPromise(function(_0x4e7e94,_0xf87147){try{if(_0x228106[_0x3a1bb7['id']]){_0x3a1bb7['Users']=_[_0xe257('0x25')](_0x228106[_0x3a1bb7['id']],function(_0x41d5a1){return{'id':_0x41d5a1['id'],'fullname':_0x41d5a1['fullname']};});}}catch(_0x4c9873){_0xf87147(_0x4c9873);}_0x4e7e94(_0x3a1bb7);});}function getInteractionTags(_0x3ae361,_0x378ab8){return new BPromise(function(_0x3dea2e,_0x5873e4){try{if(_0x3ae361['TagIds']){_0x3ae361['Tags']=[];_0x3ae361[_0xe257('0x26')][_0xe257('0x27')](',')[_0xe257('0x28')](function(_0x44c1be){_0x3ae361['Tags'][_0xe257('0x29')](_0x378ab8[_0x44c1be]);});}delete _0x3ae361[_0xe257('0x26')];}catch(_0x3369a2){_0x5873e4(_0x3369a2);}_0x3dea2e(_0x3ae361);});}function updateWhatsappInteraction(_0x409538,_0x1f741f,_0x36040f){return new BPromise(function(_0x181785,_0x30d9e6){return getInteractionUsers(_0x409538,_0x36040f)[_0xe257('0x21')](function(_0x492867){return getInteractionTags(_0x492867,_0x1f741f);})[_0xe257('0x21')](function(_0x1571f7){_0x181785(_0x1571f7);})['catch'](function(_0x4d61df){_0x30d9e6(_0x4d61df);});});}exports[_0xe257('0x2a')]=function(_0x38d8fe,_0x161a27){var _0x177b64={},_0x49eb69={},_0x466168={'count':0x0,'rows':[]};var _0xec253a=_['map'](db[_0xe257('0x2b')][_0xe257('0x2c')],function(_0x5636df){return{'name':_0x5636df[_0xe257('0x2d')],'type':_0x5636df[_0xe257('0x2e')][_0xe257('0x2f')]};});_0x49eb69['model']=_[_0xe257('0x25')](_0xec253a,_0xe257('0x23'));_0x49eb69[_0xe257('0x30')]=_[_0xe257('0x31')](_0x38d8fe['query']);_0x49eb69['filters']=_['intersection'](_0x49eb69['model'],_0x49eb69[_0xe257('0x30')]);_0x177b64[_0xe257('0x32')]=_[_0xe257('0x33')](_0x49eb69[_0xe257('0x34')],qs[_0xe257('0x35')](_0x38d8fe[_0xe257('0x30')][_0xe257('0x35')]));_0x177b64['attributes']=_0x177b64[_0xe257('0x32')]['length']?_0x177b64['attributes']:_0x49eb69[_0xe257('0x34')];if(!_0x38d8fe[_0xe257('0x30')][_0xe257('0x36')](_0xe257('0x37'))){_0x177b64['limit']=qs[_0xe257('0x38')](_0x38d8fe[_0xe257('0x30')][_0xe257('0x38')]);_0x177b64['offset']=qs[_0xe257('0x1e')](_0x38d8fe['query'][_0xe257('0x1e')]);}_0x177b64[_0xe257('0x39')]=qs['sort'](_0x38d8fe[_0xe257('0x30')][_0xe257('0x3a')]);_0x177b64['where']=qs[_0xe257('0x3b')](_[_0xe257('0x3c')](_0x38d8fe[_0xe257('0x30')],_0x49eb69[_0xe257('0x3b')]),_0xec253a);var _0x32086c=[];var _0x3d381e=squel[_0xe257('0x3d')]()[_0xe257('0x3e')]('id')[_0xe257('0x3e')]('name')[_0xe257('0x3e')]('color')[_0xe257('0x3f')](_0xe257('0x40'));var _0x4d8974=squel[_0xe257('0x3d')]()[_0xe257('0x3e')](_0xe257('0x41'))[_0xe257('0x3e')](_0xe257('0x42'))[_0xe257('0x3e')](_0xe257('0x43'))[_0xe257('0x3f')]('user_has_whatsapp_interactions','ui')[_0xe257('0x44')](_0xe257('0x45'),'u',_0xe257('0x46'));var _0x3f2426=squel[_0xe257('0x3d')]()['from'](_0xe257('0x47'),'i')[_0xe257('0x44')]('cm_contacts','c',_0xe257('0x48'))['left_join'](_0xe257('0x45'),'o',_0xe257('0x49'))[_0xe257('0x44')](_0xe257('0x4a'),'a',_0xe257('0x4b'))[_0xe257('0x44')](_0xe257('0x4c'),'me',_0xe257('0x4d'))[_0xe257('0x44')](_0xe257('0x4e'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe257('0x44')](_0xe257('0x40'),'t','t.id\x20=\x20it.TagId');var _0xe9af3e=squel[_0xe257('0x4f')]();var _0x13fda8=[];var _0x234208=squel['expr']();var _0x453297;if(_0x38d8fe[_0xe257('0x30')][_0xe257('0x50')]){_0x453297=as[_0xe257('0x51')](_0x38d8fe[_0xe257('0x30')][_0xe257('0x50')]);var _0x54a0e=_0x453297[_0xe257('0x52')];for(var _0x2314b9=0x0;_0x2314b9<_0x453297[_0xe257('0x53')][_0xe257('0x54')];_0x2314b9++){var _0x42b7a2=_0x453297['conditions'][_0x2314b9];var _0x3dcc59='i';var _0x3c8168=_[_0xe257('0x55')](_0xec253a,[_0xe257('0x23'),_0x42b7a2['field']]);if(!_0x3c8168){switch(_0x42b7a2['field']){case _0xe257('0x56'):if(_0x42b7a2['value']==0x1){_0x3f2426[_0xe257('0x57')]('`'+_0x42b7a2[_0xe257('0x3e')]+_0xe257('0x58'));}else{_0x3f2426[_0xe257('0x57')]('`'+_0x42b7a2[_0xe257('0x3e')]+_0xe257('0x59'));}break;case _0xe257('0x5a'):if(_0x42b7a2['operator']===_0xe257('0x5b')){if(_0x42b7a2[_0xe257('0x5c')]['split']('\x20')['length']>0x1){_0xe9af3e[_0x54a0e](_0xe257('0x5d'),qs['getFullTextValue'](_0x42b7a2[_0xe257('0x5c')]),null);}else{var _0x1230df='%'+_0x42b7a2['value']+'%';_0xe9af3e[_0x54a0e](_0xe257('0x5e'),_0x1230df,_0x1230df,_0x1230df);}}else{_0x3c8168=_[_0xe257('0x55')](_0xec253a,[_0xe257('0x23'),_0xe257('0x5f')]);_0x42b7a2[_0xe257('0x3e')]=_0xe257('0x5f');_0x27ca72=as['buildExpression'](_0x3dcc59,_0x3c8168[_0xe257('0x2e')],_0x42b7a2);_0xe9af3e[_0x54a0e](_0x27ca72[_0xe257('0x60')],_0x27ca72['value'][_0xe257('0x61')],_0x27ca72['value'][_0xe257('0x1b')]);}break;case _0xe257('0x62'):var _0x251dcc=_0x42b7a2['value'][_0xe257('0x27')](',')[_0xe257('0x25')](function(_0x1c8434){return Number(_0x1c8434);});_0x251dcc[_0xe257('0x28')](function(_0x3fd3b3){_0x234208['or'](_0xe257('0x63'),'%,'+_0x3fd3b3+',%');});_0x13fda8=_[_0xe257('0x64')](_0x13fda8,_0x251dcc);break;case _0xe257('0x65'):if(_0x42b7a2[_0xe257('0x66')]===_0xe257('0x5b')){_0xe9af3e[_0x54a0e](_0xe257('0x67'),'%'+_0x42b7a2[_0xe257('0x5c')]+'%',null);}else{_0x3c8168=_['find'](_0xec253a,['name',_0xe257('0x68')]);_0x42b7a2[_0xe257('0x3e')]=_0xe257('0x68');_0x27ca72=as[_0xe257('0x69')](_0x3dcc59,_0x3c8168['type'],_0x42b7a2);_0xe9af3e[_0x54a0e](_0x27ca72['text'],_0x27ca72[_0xe257('0x5c')][_0xe257('0x61')],_0x27ca72['value']['end']);}break;case _0xe257('0x6a'):_0x27ca72=as[_0xe257('0x69')]('me',null,_0x42b7a2);_0xe9af3e[_0x54a0e](_0x27ca72[_0xe257('0x60')],_0x27ca72[_0xe257('0x5c')][_0xe257('0x61')],_0x27ca72[_0xe257('0x5c')][_0xe257('0x1b')]);break;}}else{var _0x27ca72=as[_0xe257('0x69')](_0x3dcc59,_0x3c8168[_0xe257('0x2e')],_0x42b7a2);_0xe9af3e[_0x54a0e](_0x27ca72[_0xe257('0x60')],_0x27ca72[_0xe257('0x5c')]['start'],_0x27ca72['value'][_0xe257('0x1b')]);}}}else{var _0x221da2=_(_0x38d8fe['query'])[_0xe257('0x31')]()['map'](function(_0xd0e379){return _[_0xe257('0x6b')](_0xec253a,[_0xe257('0x23'),_0xd0e379])?_0xd0e379:undefined;})['compact']()['value']();if(!_[_0xe257('0x6c')](_0x221da2)){_0x221da2[_0xe257('0x28')](function(_0x3d5ece){if(_0x3d5ece===_0xe257('0x6d')){_0x3f2426['where'](_0xe257('0x6e'),[][_0xe257('0x6f')](_0x38d8fe[_0xe257('0x30')][_0x3d5ece]));}else if(_0x3d5ece==='createdAt'){var _0x4d2413=JSON[_0xe257('0x70')](_0x38d8fe[_0xe257('0x30')][_0x3d5ece])[_0xe257('0x71')];var _0x1129dd=JSON[_0xe257('0x70')](_0x38d8fe[_0xe257('0x30')][_0x3d5ece])[_0xe257('0x72')];_0x3f2426[_0xe257('0x73')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4d2413,_0x1129dd);}else{if(_0x38d8fe[_0xe257('0x30')][_0x3d5ece]==='null'){_0x3f2426[_0xe257('0x73')]('i.'+_0x3d5ece+'\x20IS\x20NULL');}else{_0x3f2426[_0xe257('0x73')]('i.'+_0x3d5ece+'\x20=\x20?',_0x38d8fe[_0xe257('0x30')][_0x3d5ece]);}}});}if(_0x38d8fe['query'][_0xe257('0x74')]){if(_0x38d8fe[_0xe257('0x30')]['read']==0x1){_0x3f2426[_0xe257('0x57')](_0xe257('0x75'));}else{_0x3f2426[_0xe257('0x57')](_0xe257('0x76'));}}if(_0x38d8fe[_0xe257('0x30')][_0xe257('0x77')]){_0x13fda8=_[_0xe257('0x78')](_0x38d8fe['query'][_0xe257('0x77')])?_0x38d8fe[_0xe257('0x30')][_0xe257('0x77')]:new Array(_0x38d8fe['query'][_0xe257('0x77')]);_0x13fda8[_0xe257('0x28')](function(_0x32fb5c){_0x234208['or'](_0xe257('0x63'),'%,'+_0x32fb5c+',%');});}if(_0x38d8fe[_0xe257('0x30')][_0xe257('0x79')]){var _0x5161cc=_0x38d8fe[_0xe257('0x30')][_0xe257('0x79')][_0xe257('0x7a')]('\x5c','\x5c\x5c')[_0xe257('0x7a')]('\x27\x27','\x27\x27\x27\x27');if(qs['isNumeric'](_0x5161cc)){_0xe9af3e['or'](_0xe257('0x7b'),_0x5161cc+'%')['or'](_0xe257('0x7c'),_0x5161cc+'%');}else{_0xe9af3e['or'](_0xe257('0x7d'),qs[_0xe257('0x7e')](_0x5161cc))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5161cc+'%');}}}_0x3f2426[_0xe257('0x73')](_0xe9af3e);_0x3f2426['group'](_0xe257('0x7f'));var _0x4fa3f0={'type':db['Sequelize'][_0xe257('0x80')][_0xe257('0x81')],'raw':!![]};var _0x5d973b=_0x3f2426['clone']();_0x5d973b[_0xe257('0x3e')](_0xe257('0x7f'));_0x5d973b[_0xe257('0x3e')](_0xe257('0x82'),_0xe257('0x56'));if(_0x177b64['order']){_0x177b64[_0xe257('0x39')][_0xe257('0x28')](function(_0x3716cf){_0x3f2426['order']('i.'+_0x3716cf[0x0],_0x3716cf[0x1]===_0xe257('0x83')?![]:!![]);});}if(!_[_0xe257('0x6c')](_0x13fda8)){_0x3f2426['having'](_0x234208);_0x5d973b['where'](_0xe257('0x84'),_0x13fda8);}BPromise['resolve']()[_0xe257('0x21')](function(){if(!_0x453297){if(_0x38d8fe[_0xe257('0x30')]['WhatsappAccountId']||_0x38d8fe[_0xe257('0x30')]['journey'])return;_0x5d973b['where'](_0xe257('0x85'));_0x3f2426['where'](_0xe257('0x85'));return;}return _0x38d8fe[_0xe257('0x86')][_0xe257('0x87')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4597a7){if(_[_0xe257('0x6c')](_0x4597a7)){_0x5d973b[_0xe257('0x73')](_0xe257('0x88'));_0x3f2426[_0xe257('0x73')](_0xe257('0x88'));}else{_0x5d973b[_0xe257('0x73')]('i.WhatsappAccountId\x20IN\x20?',_[_0xe257('0x25')](_0x4597a7,'id'));_0x3f2426['where'](_0xe257('0x6e'),_[_0xe257('0x25')](_0x4597a7,'id'));}});})[_0xe257('0x21')](function(){db[_0xe257('0x89')][_0xe257('0x30')](_0x5d973b[_0xe257('0x8a')](),_0x4fa3f0)[_0xe257('0x21')](function(_0xa2a116){_0x466168['count']=_0xa2a116['length'];if(_0x466168[_0xe257('0x1d')]===0x0)return[];return db[_0xe257('0x89')][_0xe257('0x30')](_0x3d381e['toString'](),_0x4fa3f0)[_0xe257('0x21')](function(_0x55388f){_0x32086c=_[_0xe257('0x8b')](_0x55388f,'id');_0x4fa3f0=_['merge'](_0x4fa3f0,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x38d8fe[_0xe257('0x30')][_0xe257('0x35')]){_0x177b64[_0xe257('0x32')][_0xe257('0x28')](function(_0x4b4def){_0x3f2426[_0xe257('0x3e')]('i.'+_0x4b4def);});}else{_0x3f2426[_0xe257('0x3e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe257('0x56'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x8c'),_0xe257('0x8d'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x8e'),_0xe257('0x8f'));_0x3f2426[_0xe257('0x3e')]('i.*');_0x3f2426['field'](_0xe257('0x90'),'Contact.firstName');_0x3f2426[_0xe257('0x3e')](_0xe257('0x91'),_0xe257('0x92'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x93'),_0xe257('0x94'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x95'),_0xe257('0x96'));_0x3f2426[_0xe257('0x3e')]('c.mobile',_0xe257('0x97'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x98'),_0xe257('0x99'));_0x3f2426['field']('o.fullname',_0xe257('0x9a'));_0x3f2426[_0xe257('0x3e')](_0xe257('0x9b'),_0xe257('0x9c'));_0x3f2426['field'](_0xe257('0x9d'),_0xe257('0x26'));}if(_0x177b64[_0xe257('0x38')])_0x3f2426[_0xe257('0x38')](_0x177b64[_0xe257('0x38')]);if(_0x177b64[_0xe257('0x1e')])_0x3f2426['offset'](_0x177b64[_0xe257('0x1e')]);return db[_0xe257('0x89')][_0xe257('0x30')](_0x3f2426[_0xe257('0x8a')](),_0x4fa3f0);})['then'](function(_0x29b4ed){_0x4d8974[_0xe257('0x73')](_0xe257('0x9e'),_[_0xe257('0x25')](_0x29b4ed,'id'));return db[_0xe257('0x89')]['query'](_0x4d8974[_0xe257('0x8a')](),_0x4fa3f0)[_0xe257('0x21')](function(_0x50b548){var _0x155a64=_[_0xe257('0x9f')](_0x50b548,_0xe257('0xa0'));var _0x3f2a09=[];_0x29b4ed[_0xe257('0x28')](function(_0xc9c810){_0x3f2a09[_0xe257('0x29')](updateWhatsappInteraction(_0xc9c810,_0x32086c,_0x155a64));});return BPromise['all'](_0x3f2a09);});});})[_0xe257('0x21')](function(_0x1430e2){_0x466168[_0xe257('0xa1')]=_0x1430e2;return _0x466168;})[_0xe257('0x21')](respondWithFilteredResult(_0x161a27,_0x177b64));})[_0xe257('0xa2')](handleError(_0x161a27,null));};exports['show']=function(_0x3d8a02,_0x10d04d){var _0x3bd9c3={'raw':![],'where':{'id':_0x3d8a02[_0xe257('0xa3')]['id']}},_0x2bf126={};_0x2bf126[_0xe257('0x34')]=_[_0xe257('0x31')](db[_0xe257('0x2b')]['rawAttributes']);_0x2bf126[_0xe257('0x30')]=_[_0xe257('0x31')](_0x3d8a02[_0xe257('0x30')]);_0x2bf126['filtears']=_[_0xe257('0x33')](_0x2bf126[_0xe257('0x34')],_0x2bf126[_0xe257('0x30')]);_0x3bd9c3['attributes']=_[_0xe257('0x33')](_0x2bf126['model'],qs['fields'](_0x3d8a02[_0xe257('0x30')][_0xe257('0x35')]));_0x3bd9c3['attributes']=_0x3bd9c3[_0xe257('0x32')][_0xe257('0x54')]?_0x3bd9c3[_0xe257('0x32')]:_0x2bf126[_0xe257('0x34')];if(_0x3d8a02['query'][_0xe257('0xa4')]){_0x3bd9c3[_0xe257('0xa5')]=[{'all':!![]}];}_0x3bd9c3=_['merge']({},_0x3bd9c3,_0x3d8a02['options']);return db[_0xe257('0x2b')][_0xe257('0x55')](_0x3bd9c3)[_0xe257('0x21')](handleEntityNotFound(_0x10d04d,null))[_0xe257('0x21')](respondWithResult(_0x10d04d,null))[_0xe257('0xa2')](handleError(_0x10d04d,null));};exports[_0xe257('0xa6')]=function(_0x4210fe,_0x2a0b55){return db['WhatsappInteraction'][_0xe257('0xa6')](_0x4210fe[_0xe257('0x6a')],{})['then'](respondWithResult(_0x2a0b55,0xc9))[_0xe257('0xa2')](handleError(_0x2a0b55,null));};exports[_0xe257('0xa7')]=function(_0x3db5a4,_0x4b7702){if(_0x3db5a4[_0xe257('0x6a')]['id']){delete _0x3db5a4[_0xe257('0x6a')]['id'];}return db[_0xe257('0x2b')][_0xe257('0x55')]({'where':{'id':_0x3db5a4[_0xe257('0xa3')]['id']}})[_0xe257('0x21')](handleEntityNotFound(_0x4b7702,null))['then'](saveUpdates(_0x3db5a4['body'],null))[_0xe257('0x21')](respondWithResult(_0x4b7702,null))['catch'](handleError(_0x4b7702,null));};exports[_0xe257('0xa8')]=function(_0x4b0544,_0x277eef){return db[_0xe257('0x2b')][_0xe257('0x55')]({'where':{'id':_0x4b0544['params']['id']}})[_0xe257('0x21')](handleEntityNotFound(_0x277eef,null))[_0xe257('0x21')](removeEntity(_0x277eef,null))[_0xe257('0xa2')](handleError(_0x277eef,null));};exports[_0xe257('0xa9')]=function(_0x517c0b,_0x57d10c){return db[_0xe257('0x2b')][_0xe257('0xa9')]()[_0xe257('0x21')](respondWithResult(_0x57d10c,null))[_0xe257('0xa2')](handleError(_0x57d10c,null));};exports[_0xe257('0xaa')]=function(_0x6b089b,_0x261615,_0x1b512a){return db[_0xe257('0xab')][_0xe257('0x55')]({'where':{'id':_0x6b089b[_0xe257('0xa3')]['id']}})[_0xe257('0x21')](handleEntityNotFound(_0x261615,null))[_0xe257('0x21')](function(_0x1a2848){if(_0x1a2848){return _0x1a2848[_0xe257('0xaa')](_0x6b089b['body'][_0xe257('0xac')],_['omit'](_0x6b089b[_0xe257('0x6a')],[_0xe257('0xac'),'id'])||{});}})['then'](respondWithResult(_0x261615,null))['catch'](handleError(_0x261615,null));};exports[_0xe257('0xad')]=function(_0x4e6848,_0x14a6ba,_0x1fb85a){var _0x5ca29b={'raw':![],'where':{}};var _0x5075e5={};var _0x5c3854={'count':0x0,'rows':[]};return db[_0xe257('0x2b')]['findOne']({'where':{'id':_0x4e6848[_0xe257('0xa3')]['id']}})['then'](handleEntityNotFound(_0x14a6ba,null))['then'](function(_0x2cfa47){if(_0x2cfa47){_0x5075e5['model']=_['keys'](db[_0xe257('0xab')][_0xe257('0x2c')]);_0x5075e5[_0xe257('0x30')]=_[_0xe257('0x31')](_0x4e6848[_0xe257('0x30')]);_0x5075e5[_0xe257('0x3b')]=_[_0xe257('0x33')](_0x5075e5[_0xe257('0x34')],_0x5075e5[_0xe257('0x30')]);_0x5ca29b[_0xe257('0x32')]=_[_0xe257('0x33')](_0x5075e5[_0xe257('0x34')],qs[_0xe257('0x35')](_0x4e6848['query'][_0xe257('0x35')]));_0x5ca29b[_0xe257('0x32')]=_0x5ca29b[_0xe257('0x32')][_0xe257('0x54')]?_0x5ca29b[_0xe257('0x32')]:_0x5075e5['model'];if(!_0x4e6848[_0xe257('0x30')][_0xe257('0x36')]('nolimit')){_0x5ca29b['limit']=qs[_0xe257('0x38')](_0x4e6848[_0xe257('0x30')][_0xe257('0x38')]);_0x5ca29b[_0xe257('0x1e')]=qs[_0xe257('0x1e')](_0x4e6848[_0xe257('0x30')][_0xe257('0x1e')]);}_0x5ca29b[_0xe257('0x39')]=qs['sort'](_0x4e6848[_0xe257('0x30')][_0xe257('0x3a')]);_0x5ca29b[_0xe257('0x73')]=qs['filters'](_[_0xe257('0x3c')](_0x4e6848[_0xe257('0x30')],_0x5075e5['filters']));_0x5ca29b['where'][_0xe257('0xa0')]=_0x2cfa47['id'];if(_0x4e6848['query'][_0xe257('0x79')]){_0x5ca29b[_0xe257('0x73')]=_[_0xe257('0xae')](_0x5ca29b['where'],{'$or':_[_0xe257('0x25')](_0x5ca29b[_0xe257('0x32')],function(_0x238d32){var _0x16f981={};_0x16f981[_0x238d32]={'$like':'%'+_0x4e6848[_0xe257('0x30')]['filter']+'%'};return _0x16f981;})});}if(_0x4e6848[_0xe257('0x30')][_0xe257('0x71')]){var _0x1b82b6=_0x4e6848['query']['$gte'][_0xe257('0x27')](',');var _0x35753e={};_0x35753e[_0x1b82b6[0x0]]={'$gte':moment(_0x1b82b6[0x1])[_0xe257('0xaf')](_0xe257('0xb0'))};_0x5ca29b[_0xe257('0x73')]=_[_0xe257('0xae')](_0x5ca29b[_0xe257('0x73')],_0x35753e);}_0x5ca29b=_[_0xe257('0xae')]({},_0x5ca29b,_0x4e6848['options']);return db['WhatsappMessage'][_0xe257('0x1d')]({'where':_0x5ca29b['where']})['then'](function(_0x1a49d8){_0x5c3854[_0xe257('0x1d')]=_0x1a49d8;if(_0x4e6848[_0xe257('0x30')][_0xe257('0xa4')]){_0x5ca29b[_0xe257('0xa5')]=[{'all':!![]}];}return db[_0xe257('0xab')][_0xe257('0xb1')](_0x5ca29b);})[_0xe257('0x21')](function(_0x7fa34a){_0x5c3854[_0xe257('0xa1')]=_0x7fa34a;return _0x5c3854;});}})['then'](respondWithFilteredResult(_0x14a6ba,_0x5ca29b))[_0xe257('0xa2')](handleError(_0x14a6ba,null));};exports[_0xe257('0xb2')]=function(_0x2f40e9,_0x93bbee,_0x309712){return db[_0xe257('0x2b')][_0xe257('0x55')]({'where':{'id':_0x2f40e9[_0xe257('0xa3')]['id']}})[_0xe257('0x21')](handleEntityNotFound(_0x93bbee,null))[_0xe257('0x21')](function(_0x46b039){if(_0x46b039){return _0x46b039[_0xe257('0xb3')](_0x2f40e9[_0xe257('0x6a')][_0xe257('0xac')],_[_0xe257('0xb4')](_0x2f40e9[_0xe257('0x6a')],[_0xe257('0xac'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xe257('0x23'),_0xe257('0xb5')],'where':{'id':_0x2f40e9[_0xe257('0x6a')]['ids']}});})[_0xe257('0x21')](function(_0x296f7a){socket[_0xe257('0xb6')](_0xe257('0xb7'),{'id':Number(_0x2f40e9['params']['id']),'tags':_0x296f7a||[]});return{'id':Number(_0x2f40e9[_0xe257('0xa3')]['id']),'tags':_0x296f7a||[]};});}})[_0xe257('0x21')](respondWithResult(_0x93bbee,null))[_0xe257('0xa2')](handleError(_0x93bbee,null));};exports[_0xe257('0xb8')]=function(_0x1ec661,_0x442d37,_0x50b232){return db[_0xe257('0x2b')]['find']({'where':{'id':_0x1ec661['params']['id']}})[_0xe257('0x21')](handleEntityNotFound(_0x442d37,null))[_0xe257('0x21')](function(_0x15db78){if(_0x15db78){return _0x15db78[_0xe257('0xb8')](_0x1ec661[_0xe257('0x30')][_0xe257('0xac')]);}})[_0xe257('0x21')](respondWithStatusCode(_0x442d37,null))[_0xe257('0xa2')](handleError(_0x442d37,null));};exports[_0xe257('0xb9')]=function(_0x5c8391,_0x54165a){var _0xdc1a84=moment()['unix']()[_0xe257('0x8a')]();var _0xb82295=path['join'](config['root'],'server',_0xe257('0xba'),_0xe257('0xbb'));var _0x19c179=path[_0xe257('0xbc')](config[_0xe257('0xbd')],_0xe257('0xbe'),_0xe257('0xba'),_0xe257('0xbf'));var _0x10b8ff=path[_0xe257('0xbc')](_0xb82295,_0xdc1a84);var _0x26fcc2=util[_0xe257('0xaf')](_0xe257('0xc0'),_0x5c8391[_0xe257('0xa3')]['id'],_0xdc1a84);var _0x32df5d=path['join'](_0xb82295,_0x26fcc2);var _0x1895e2=[];_0x1895e2[_0xe257('0x29')]({'model':db[_0xe257('0x65')],'as':'User','attributes':['id',_0xe257('0xc1')],'raw':!![]});_0x1895e2[_0xe257('0x29')]({'model':db[_0xe257('0xc2')],'as':_0xe257('0x5a'),'attributes':['id',_0xe257('0xc3'),_0xe257('0xc4')],'raw':!![]});if(_0x5c8391['query'][_0xe257('0xbf')]){_0x1895e2[_0xe257('0x29')]({'model':db[_0xe257('0xc5')],'as':_0xe257('0xc5'),'raw':!![]});}var _0x123fd7=[{'model':db[_0xe257('0xab')],'as':_0xe257('0xc6'),'attributes':['id',_0xe257('0x6a'),'createdAt',_0xe257('0xc7'),_0xe257('0xc8'),'read'],'include':_0x1895e2}];_0x123fd7[_0xe257('0x29')]({'model':db[_0xe257('0xc9')],'as':_0xe257('0xca'),'attributes':['id','name']});_0x123fd7[_0xe257('0x29')]({'model':db['User'],'as':_0xe257('0xcb'),'attributes':['id','fullname']});return db[_0xe257('0x2b')][_0xe257('0x55')]({'where':{'id':_0x5c8391[_0xe257('0xa3')]['id']},'include':_0x123fd7})[_0xe257('0x21')](handleEntityNotFound(_0x54165a,null))[_0xe257('0x21')](function(_0x323d55){if(_0x323d55){var _0x1341bb=_0x323d55[_0xe257('0xcc')]({'plain':!![]});fs[_0xe257('0xcd')](_0x10b8ff);var _0x2d174e={'format':'A4','border':_0xe257('0xce'),'header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0xe257('0xcf'),'contents':{'default':util[_0xe257('0xaf')]('\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[_0xe257('0xaf')]('%s\x20#%d',_0xe257('0xd0'),_0x1341bb['id']),moment()['format'](_0xe257('0xd1'))[_0xe257('0x8a')]())}}};var _0x107ca2={'channel':_0xe257('0xd0'),'account':_0x1341bb[_0xe257('0xca')][_0xe257('0x23')],'agent':_0x1341bb[_0xe257('0xcb')]?_0x1341bb[_0xe257('0xcb')][_0xe257('0xc1')]:_0xe257('0xd2'),'createdAt':moment(_0x1341bb[_0xe257('0xd3')])[_0xe257('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1341bb[_0xe257('0xd4')]?moment(_0x1341bb[_0xe257('0xd5')])[_0xe257('0xaf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe257('0x8a')]():'','disposition':_0x1341bb['disposition'],'messages':_(_0x1341bb['Messages'])[_0xe257('0x79')]({'secret':![]})[_0xe257('0x25')](function(_0x4ee9c8){if(_0x4ee9c8[_0xe257('0xc5')]){var _0x589497=path[_0xe257('0xbc')](_0x19c179,_0x4ee9c8[_0xe257('0xc5')][_0xe257('0xd6')]);if(fs['existsSync'](_0x589497)){fs['createReadStream'](_0x589497)['pipe'](fs['createWriteStream'](path['join'](_0x10b8ff,_0x4ee9c8[_0xe257('0xc5')][_0xe257('0xd6')])));}}return{'date':moment(_0x4ee9c8[_0xe257('0xd3')])[_0xe257('0xaf')](_0xe257('0xb0'))['toString'](),'sender':_0x4ee9c8[_0xe257('0xc7')]===_0xe257('0xd7')?_0x4ee9c8[_0xe257('0x65')]?_0x4ee9c8[_0xe257('0x65')]['fullname']:_0xe257('0xd8'):_0x4ee9c8[_0xe257('0x5a')][_0xe257('0xc3')]+(_0x4ee9c8[_0xe257('0x5a')][_0xe257('0xc4')]?'\x20'+_0x4ee9c8['Contact'][_0xe257('0xc4')]:''),'body':_0x4ee9c8[_0xe257('0xc5')]?_0x4ee9c8['Attachment'][_0xe257('0xd6')]:_0x4ee9c8[_0xe257('0x6a')],'direction':_0x4ee9c8['direction']===_0xe257('0xd7')?'A':'C','secret':_0x4ee9c8[_0xe257('0xc8')],'read':_0x4ee9c8['read'],'attachment':_0x4ee9c8[_0xe257('0xc5')]};})[_0xe257('0x5c')]()};return ejs[_0xe257('0xd9')](path[_0xe257('0xbc')](config[_0xe257('0xbd')],_0xe257('0xbe'),'views',_0xe257('0xda')),{'interaction':_0x107ca2})['then'](function(_0x5b4627){return new BPromise(function(_0x5b5cff,_0xa55ff2){pdf['create'](_0x5b4627,_0x2d174e)['toFile'](path['join'](_0x10b8ff,_0xe257('0xdb')+_0x1341bb['id']+'-'+_0xdc1a84+_0xe257('0xdc')),function(_0x1630c1,_0x1fe7fe){if(_0x1630c1)return _0xa55ff2(_0x1630c1);_0x5b5cff(_0x1fe7fe);});});})[_0xe257('0x21')](function(){return new BPromise(function(_0xa9504b,_0x1dbe3a){zipdir(_0x10b8ff,{'saveTo':_0x32df5d},function(_0x3867c5,_0x5aeacc){if(_0x3867c5)return _0x1dbe3a(_0x3867c5);return _0xa9504b(_0x5aeacc);});})[_0xe257('0x21')](function(){return new BPromise(function(_0x4c3ac2,_0x5105f7){rimraf(_0x10b8ff,function(_0x1b70a2){if(_0x1b70a2)_0x5105f7(_0x1b70a2);return _0x4c3ac2();});});})[_0xe257('0x21')](function(){return _0x54165a['download'](_0x32df5d,_0x26fcc2,function(_0x2415be){if(_0x2415be){console[_0xe257('0xdd')](_0xe257('0xde'),_0x2415be);}else{fs['unlinkSync'](_0x32df5d);}});});});}else{return _0x54165a['sendStatus'](0xc8);}})[_0xe257('0xa2')](handleError(_0x54165a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b8056c9..9ecb663 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 _0xc48a=['remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','update'];(function(_0x25355e,_0x3d2d0a){var _0x2c02f0=function(_0x2dfe61){while(--_0x2dfe61){_0x25355e['push'](_0x25355e['shift']());}};_0x2c02f0(++_0x3d2d0a);}(_0xc48a,0x74));var _0xac48=function(_0x1f10ff,_0x20520a){_0x1f10ff=_0x1f10ff-0x0;var _0x575973=_0xc48a[_0x1f10ff];return _0x575973;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xac48('0x0'))['db'][_0xac48('0x1')];var WhatsappMessage=require(_0xac48('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xac48('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac48('0x3'),'afterDestroy':_0xac48('0x4')};function emitEvent(_0x250bfa){return function(_0x21087a,_0x504ff1,_0x3fce73){_0x21087a[_0xac48('0x5')]({'attributes':['id'],'raw':!![]})[_0xac48('0x6')](function(_0x1f25ec){_0x21087a[_0xac48('0x7')](_0xac48('0x8'),_0x1f25ec[_0xac48('0x9')](function(_0x212370){return{'id':_0x212370['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x21087a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac48('0x6')](function(_0x21766e){_0x21087a[_0xac48('0x7')](_0xac48('0xa'),_0x21766e[_0xac48('0xb')]);WhatsappInteractionEvents[_0xac48('0xc')](_0x250bfa+':'+_0x21087a['id'],_0x21087a);WhatsappInteractionEvents[_0xac48('0xc')](_0x250bfa,_0x21087a);_0x3fce73(null);})[_0xac48('0xd')](_0x3fce73(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xac48('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2b87=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x545f6d,_0x16c27e){var _0x594012=function(_0x259089){while(--_0x259089){_0x545f6d['push'](_0x545f6d['shift']());}};_0x594012(++_0x16c27e);}(_0x2b87,0x1e3));var _0x72b8=function(_0x29e3f2,_0x2e2f46){_0x29e3f2=_0x29e3f2-0x0;var _0x888b60=_0x2b87[_0x29e3f2];return _0x888b60;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x72b8('0x0'))['db'][_0x72b8('0x1')];var WhatsappMessage=require(_0x72b8('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x72b8('0x2')](0x0);var events={'afterCreate':_0x72b8('0x3'),'afterUpdate':_0x72b8('0x4'),'afterDestroy':_0x72b8('0x5')};function emitEvent(_0x1ad4c3){return function(_0x285229,_0x4690f0,_0x11acd0){_0x285229[_0x72b8('0x6')]({'attributes':['id'],'raw':!![]})[_0x72b8('0x7')](function(_0x2bb240){_0x285229['setDataValue'](_0x72b8('0x8'),_0x2bb240['map'](function(_0x35e941){return{'id':_0x35e941['id']};}));return WhatsappMessage[_0x72b8('0x9')]({'where':{'WhatsappInteractionId':_0x285229['id'],'direction':'in','read':![]},'raw':!![]});})[_0x72b8('0x7')](function(_0x80d701){_0x285229[_0x72b8('0xa')](_0x72b8('0xb'),_0x80d701[_0x72b8('0xc')]);WhatsappInteractionEvents[_0x72b8('0xd')](_0x1ad4c3+':'+_0x285229['id'],_0x285229);WhatsappInteractionEvents[_0x72b8('0xd')](_0x1ad4c3,_0x285229);_0x11acd0(null);})[_0x72b8('0xe')](_0x11acd0(null));};}for(var e in events){if(events[_0x72b8('0xf')](e)){var event=events[e];WhatsappInteraction[_0x72b8('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 48702e1..11be586 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 _0x26f9=['rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','request-promise','path'];(function(_0x45f0b1,_0x23824e){var _0x340703=function(_0x3368f6){while(--_0x3368f6){_0x45f0b1['push'](_0x45f0b1['shift']());}};_0x340703(++_0x23824e);}(_0x26f9,0xbe));var _0x926f=function(_0x39fdad,_0x1b8980){_0x39fdad=_0x39fdad-0x0;var _0x2089a1=_0x26f9[_0x39fdad];return _0x2089a1;};'use strict';var _=require('lodash');var util=require(_0x926f('0x0'));var logger=require(_0x926f('0x1'))(_0x926f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x926f('0x3'));var fs=require('fs');var path=require(_0x926f('0x4'));var rimraf=require(_0x926f('0x5'));var config=require(_0x926f('0x6'));var attributes=require(_0x926f('0x7'));module['exports']=function(_0x5c601d,_0x15084e){return _0x5c601d[_0x926f('0x8')](_0x926f('0x9'),attributes,{'tableName':_0x926f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x393bb4,_0x34a6f3,_0x4fa81e){if(_0x393bb4[_0x926f('0xb')]('closed')){_0x393bb4[_0x926f('0xc')]=moment()[_0x926f('0xd')](_0x926f('0xe'));}_0x4fa81e(null,_0x393bb4);}}});}; \ No newline at end of file +var _0x1660=['../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4fdb9b,_0x3b99b3){var _0x1b922e=function(_0x170e1f){while(--_0x170e1f){_0x4fdb9b['push'](_0x4fdb9b['shift']());}};_0x1b922e(++_0x3b99b3);}(_0x1660,0x1ac));var _0x0166=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x1660[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0x0166('0x0'));var util=require(_0x0166('0x1'));var logger=require(_0x0166('0x2'))(_0x0166('0x3'));var moment=require(_0x0166('0x4'));var BPromise=require(_0x0166('0x5'));var rp=require(_0x0166('0x6'));var fs=require('fs');var path=require(_0x0166('0x7'));var rimraf=require(_0x0166('0x8'));var config=require(_0x0166('0x9'));var attributes=require(_0x0166('0xa'));module['exports']=function(_0x5c366d,_0xde68e2){return _0x5c366d[_0x0166('0xb')](_0x0166('0xc'),attributes,{'tableName':_0x0166('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43fcf7,_0x34ceed,_0x441fae){if(_0x43fcf7[_0x0166('0xe')](_0x0166('0xf'))){_0x43fcf7[_0x0166('0x10')]=moment()[_0x0166('0x11')](_0x0166('0x12'));}_0x441fae(null,_0x43fcf7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 8b8e3b0..19acdd6 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 _0x2156=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5885c8,_0x20f2e8){var _0x52f2e4=function(_0x52efd9){while(--_0x52efd9){_0x5885c8['push'](_0x5885c8['shift']());}};_0x52f2e4(++_0x20f2e8);}(_0x2156,0x1ee));var _0x6215=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2156[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x6215('0x0'));var util=require(_0x6215('0x1'));var moment=require(_0x6215('0x2'));var BPromise=require(_0x6215('0x3'));var rs=require(_0x6215('0x4'));var fs=require('fs');var Redis=require(_0x6215('0x5'));var db=require(_0x6215('0x6'))['db'];var utils=require(_0x6215('0x7'));var logger=require(_0x6215('0x8'))(_0x6215('0x9'));var config=require(_0x6215('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6215('0xb')][_0x6215('0xc')]({'port':0x232a});config['redis']=_[_0x6215('0xd')](config[_0x6215('0xe')],{'host':_0x6215('0xf'),'port':0x18eb});var socket=require(_0x6215('0x10'))(new Redis(config[_0x6215('0xe')]));require(_0x6215('0x11'))[_0x6215('0x12')](socket);function respondWithRpcPromise(_0x207896,_0x48e816,_0x195615){return new BPromise(function(_0x2dbbd8,_0x12e343){return client[_0x6215('0x13')](_0x207896,_0x195615)[_0x6215('0x14')](function(_0x1d401a){logger[_0x6215('0x15')](_0x6215('0x16'),_0x48e816,_0x6215('0x17'));logger[_0x6215('0x18')](_0x6215('0x19'),_0x48e816,'request\x20sent',JSON[_0x6215('0x1a')](_0x1d401a));if(_0x1d401a[_0x6215('0x1b')]){if(_0x1d401a[_0x6215('0x1b')]['code']===0x1f4){logger[_0x6215('0x1b')](_0x6215('0x16'),_0x48e816,_0x1d401a[_0x6215('0x1b')][_0x6215('0x1c')]);return _0x12e343(_0x1d401a[_0x6215('0x1b')][_0x6215('0x1c')]);}logger[_0x6215('0x1b')](_0x6215('0x16'),_0x48e816,_0x1d401a['error'][_0x6215('0x1c')]);return _0x2dbbd8(_0x1d401a[_0x6215('0x1b')][_0x6215('0x1c')]);}else{logger[_0x6215('0x15')](_0x6215('0x16'),_0x48e816,_0x6215('0x17'));_0x2dbbd8(_0x1d401a['result'][_0x6215('0x1c')]);}})[_0x6215('0x1d')](function(_0x3d38c3){logger[_0x6215('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x48e816,_0x3d38c3);_0x12e343(_0x3d38c3);});});}exports['UpdateWhatsappInteraction']=function(_0x2d268f){var _0x433c4c=this;return new Promise(function(_0x15d733,_0x59e182){return db['WhatsappInteraction'][_0x6215('0x1e')](_0x2d268f[_0x6215('0x1f')],{'raw':_0x2d268f[_0x6215('0x20')]?_0x2d268f[_0x6215('0x20')][_0x6215('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d268f[_0x6215('0x20')]?_0x2d268f[_0x6215('0x20')][_0x6215('0x22')]||null:null,'attributes':_0x2d268f['options']?_0x2d268f[_0x6215('0x20')][_0x6215('0x23')]||null:null,'limit':_0x2d268f[_0x6215('0x20')]?_0x2d268f['options'][_0x6215('0x24')]||null:null})[_0x6215('0x14')](function(_0x1ae1a7){logger[_0x6215('0x15')](_0x6215('0x25'),_0x2d268f);logger[_0x6215('0x18')]('UpdateWhatsappInteraction',_0x2d268f,JSON['stringify'](_0x1ae1a7));_0x15d733(_0x1ae1a7);})[_0x6215('0x1d')](function(_0x15d936){logger[_0x6215('0x1b')]('UpdateWhatsappInteraction',_0x15d936[_0x6215('0x1c')],_0x2d268f);_0x59e182(_0x433c4c[_0x6215('0x1b')](0x1f4,_0x15d936[_0x6215('0x1c')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4d22c4){return new Promise(function(_0x3e2610,_0x259bac){return db['WhatsappInteraction'][_0x6215('0x26')]({'where':_0x4d22c4[_0x6215('0x20')]?_0x4d22c4[_0x6215('0x20')][_0x6215('0x22')]||null:null})[_0x6215('0x14')](function(_0x776bd8){if(_0x776bd8){return _0x776bd8['addTags'](_0x4d22c4[_0x6215('0x1f')][_0x6215('0x27')],_[_0x6215('0x28')](_0x4d22c4[_0x6215('0x1f')],['ids','id'])||{});}})['spread'](function(_0x3b5010){logger['info']('AddTags',_0x4d22c4);logger[_0x6215('0x18')]('AddTags',_0x4d22c4,JSON[_0x6215('0x1a')](_0x3b5010));_0x3e2610(_0x3b5010);})['catch'](function(_0x212e59){logger[_0x6215('0x1b')](_0x6215('0x29'),_0x212e59[_0x6215('0x1c')],_0x4d22c4);_0x259bac(_this[_0x6215('0x1b')](0x1f4,_0x212e59['message']));});});}; \ No newline at end of file +var _0x8fd7=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','options','raw','where','limit','AddTagsToWhatsappInteraction','find','addTags','body','spread','AddTags'];(function(_0x56e8fe,_0x473851){var _0x3eb9d6=function(_0xc77ad6){while(--_0xc77ad6){_0x56e8fe['push'](_0x56e8fe['shift']());}};_0x3eb9d6(++_0x473851);}(_0x8fd7,0xb9));var _0x78fd=function(_0x3489d3,_0x1947a7){_0x3489d3=_0x3489d3-0x0;var _0xddd9c9=_0x8fd7[_0x3489d3];return _0xddd9c9;};'use strict';var _=require(_0x78fd('0x0'));var util=require(_0x78fd('0x1'));var moment=require(_0x78fd('0x2'));var BPromise=require('bluebird');var rs=require(_0x78fd('0x3'));var fs=require('fs');var Redis=require(_0x78fd('0x4'));var db=require(_0x78fd('0x5'))['db'];var utils=require(_0x78fd('0x6'));var logger=require(_0x78fd('0x7'))('rpc');var config=require(_0x78fd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x78fd('0x9')]({'port':0x232a});config[_0x78fd('0xa')]=_[_0x78fd('0xb')](config[_0x78fd('0xa')],{'host':_0x78fd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x78fd('0xa')]));require('./whatsappInteraction.socket')[_0x78fd('0xd')](socket);function respondWithRpcPromise(_0x5eae7b,_0x4fc3ac,_0x5a1c6a){return new BPromise(function(_0x3a3d5c,_0x427279){return client[_0x78fd('0xe')](_0x5eae7b,_0x5a1c6a)[_0x78fd('0xf')](function(_0x3b2939){logger[_0x78fd('0x10')](_0x78fd('0x11'),_0x4fc3ac,_0x78fd('0x12'));logger[_0x78fd('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4fc3ac,_0x78fd('0x12'),JSON[_0x78fd('0x14')](_0x3b2939));if(_0x3b2939[_0x78fd('0x15')]){if(_0x3b2939[_0x78fd('0x15')][_0x78fd('0x16')]===0x1f4){logger[_0x78fd('0x15')](_0x78fd('0x11'),_0x4fc3ac,_0x3b2939['error'][_0x78fd('0x17')]);return _0x427279(_0x3b2939[_0x78fd('0x15')][_0x78fd('0x17')]);}logger[_0x78fd('0x15')](_0x78fd('0x11'),_0x4fc3ac,_0x3b2939[_0x78fd('0x15')][_0x78fd('0x17')]);return _0x3a3d5c(_0x3b2939[_0x78fd('0x15')]['message']);}else{logger[_0x78fd('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4fc3ac,'request\x20sent');_0x3a3d5c(_0x3b2939[_0x78fd('0x18')]['message']);}})[_0x78fd('0x19')](function(_0x1e366c){logger[_0x78fd('0x15')](_0x78fd('0x11'),_0x4fc3ac,_0x1e366c);_0x427279(_0x1e366c);});});}exports[_0x78fd('0x1a')]=function(_0x4f94b9){var _0x1d6607=this;return new Promise(function(_0x1820ca,_0x460e66){return db['WhatsappInteraction']['update'](_0x4f94b9['body'],{'raw':_0x4f94b9[_0x78fd('0x1b')]?_0x4f94b9[_0x78fd('0x1b')][_0x78fd('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f94b9[_0x78fd('0x1b')]?_0x4f94b9['options'][_0x78fd('0x1d')]||null:null,'attributes':_0x4f94b9[_0x78fd('0x1b')]?_0x4f94b9[_0x78fd('0x1b')]['attributes']||null:null,'limit':_0x4f94b9[_0x78fd('0x1b')]?_0x4f94b9[_0x78fd('0x1b')][_0x78fd('0x1e')]||null:null})[_0x78fd('0xf')](function(_0x3c0f14){logger[_0x78fd('0x10')](_0x78fd('0x1a'),_0x4f94b9);logger[_0x78fd('0x13')]('UpdateWhatsappInteraction',_0x4f94b9,JSON[_0x78fd('0x14')](_0x3c0f14));_0x1820ca(_0x3c0f14);})[_0x78fd('0x19')](function(_0x2dac16){logger['error'](_0x78fd('0x1a'),_0x2dac16[_0x78fd('0x17')],_0x4f94b9);_0x460e66(_0x1d6607[_0x78fd('0x15')](0x1f4,_0x2dac16['message']));});});};exports[_0x78fd('0x1f')]=function(_0x2a25df){return new Promise(function(_0x14ac44,_0x299db9){return db['WhatsappInteraction'][_0x78fd('0x20')]({'where':_0x2a25df[_0x78fd('0x1b')]?_0x2a25df[_0x78fd('0x1b')][_0x78fd('0x1d')]||null:null})[_0x78fd('0xf')](function(_0x2c741c){if(_0x2c741c){return _0x2c741c[_0x78fd('0x21')](_0x2a25df[_0x78fd('0x22')]['ids'],_['omit'](_0x2a25df['body'],['ids','id'])||{});}})[_0x78fd('0x23')](function(_0x45022b){logger[_0x78fd('0x10')](_0x78fd('0x24'),_0x2a25df);logger[_0x78fd('0x13')](_0x78fd('0x24'),_0x2a25df,JSON[_0x78fd('0x14')](_0x45022b));_0x14ac44(_0x45022b);})['catch'](function(_0x57326d){logger[_0x78fd('0x15')](_0x78fd('0x24'),_0x57326d[_0x78fd('0x17')],_0x2a25df);_0x299db9(_this['error'](0x1f4,_0x57326d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5d7c42b..dabd4b9 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 _0xadff=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x5a9666,_0x30bc94){var _0x28601f=function(_0x52e447){while(--_0x52e447){_0x5a9666['push'](_0x5a9666['shift']());}};_0x28601f(++_0x30bc94);}(_0xadff,0x7f));var _0xfadf=function(_0x2cac42,_0x362036){_0x2cac42=_0x2cac42-0x0;var _0xe14c06=_0xadff[_0x2cac42];return _0xe14c06;};'use strict';var WhatsappInteractionEvents=require(_0xfadf('0x0'));var events=[_0xfadf('0x1'),_0xfadf('0x2'),_0xfadf('0x3')];function createListener(_0x1d4e93,_0x37ab4d){return function(_0x55af47){_0x37ab4d[_0xfadf('0x4')](_0x1d4e93,_0x55af47);};}function removeListener(_0x2511d2,_0x32301b){return function(){WhatsappInteractionEvents[_0xfadf('0x5')](_0x2511d2,_0x32301b);};}exports[_0xfadf('0x6')]=function(_0x1bee10){for(var _0x5f21fc=0x0,_0x2c98ea=events[_0xfadf('0x7')];_0x5f21fc<_0x2c98ea;_0x5f21fc++){var _0x1df888=events[_0x5f21fc];var _0x4181f7=createListener(_0xfadf('0x8')+_0x1df888,_0x1bee10);WhatsappInteractionEvents['on'](_0x1df888,_0x4181f7);}}; \ No newline at end of file +var _0x2613=['update','emit','removeListener','length','./whatsappInteraction.events','save','remove'];(function(_0x4edc9f,_0x48cf5c){var _0x2e9b37=function(_0x49bcc0){while(--_0x49bcc0){_0x4edc9f['push'](_0x4edc9f['shift']());}};_0x2e9b37(++_0x48cf5c);}(_0x2613,0xa5));var _0x3261=function(_0x4ca764,_0x572b2a){_0x4ca764=_0x4ca764-0x0;var _0x39292d=_0x2613[_0x4ca764];return _0x39292d;};'use strict';var WhatsappInteractionEvents=require(_0x3261('0x0'));var events=[_0x3261('0x1'),_0x3261('0x2'),_0x3261('0x3')];function createListener(_0x53321b,_0x4a2f3d){return function(_0x4cd761){_0x4a2f3d[_0x3261('0x4')](_0x53321b,_0x4cd761);};}function removeListener(_0x2ce86d,_0x2ffc7c){return function(){WhatsappInteractionEvents[_0x3261('0x5')](_0x2ce86d,_0x2ffc7c);};}exports['register']=function(_0xe0e9f9){for(var _0x1e1fe3=0x0,_0xccb99b=events[_0x3261('0x6')];_0x1e1fe3<_0xccb99b;_0x1e1fe3++){var _0x143de1=events[_0x1e1fe3];var _0x1fa2d1=createListener('whatsappInteraction:'+_0x143de1,_0xe0e9f9);WhatsappInteractionEvents['on'](_0x143de1,_0x1fa2d1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0a10c89..24677b1 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 _0x671d=['index','/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x176c4d,_0x428fe7){var _0x3ef765=function(_0x24d0ab){while(--_0x24d0ab){_0x176c4d['push'](_0x176c4d['shift']());}};_0x3ef765(++_0x428fe7);}(_0x671d,0xb4));var _0xd671=function(_0x13b442,_0x448c33){_0x13b442=_0x13b442-0x0;var _0x49d09c=_0x671d[_0x13b442];return _0x49d09c;};'use strict';var multer=require(_0xd671('0x0'));var util=require(_0xd671('0x1'));var path=require('path');var timeout=require(_0xd671('0x2'));var express=require(_0xd671('0x3'));var router=express['Router']();var auth=require(_0xd671('0x4'));var interaction=require(_0xd671('0x5'));var config=require('../../config/environment');var controller=require(_0xd671('0x6'));router[_0xd671('0x7')]('/',auth[_0xd671('0x8')](),controller[_0xd671('0x9')]);router[_0xd671('0x7')](_0xd671('0xa'),auth[_0xd671('0x8')](),controller[_0xd671('0xb')]);router[_0xd671('0x7')](_0xd671('0xc'),auth[_0xd671('0x8')](),controller[_0xd671('0xd')]);router[_0xd671('0xe')]('/',auth['isAuthenticated'](),interaction[_0xd671('0xf')](_0xd671('0x10'),'whatsappmessage:create'),controller[_0xd671('0x11')]);router['post'](_0xd671('0x12'),controller[_0xd671('0x13')]);router[_0xd671('0x14')](_0xd671('0xc'),auth[_0xd671('0x8')](),controller[_0xd671('0x15')]);router['put'](_0xd671('0x16'),auth[_0xd671('0x8')](),controller[_0xd671('0x17')]);router[_0xd671('0x14')](_0xd671('0x18'),auth[_0xd671('0x8')](),controller[_0xd671('0x19')]);router[_0xd671('0x1a')](_0xd671('0xc'),auth[_0xd671('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x57bc=['../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','whatsapp','whatsappmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout'];(function(_0x1a62e4,_0x4f2cd0){var _0xb311d3=function(_0x2aa27b){while(--_0x2aa27b){_0x1a62e4['push'](_0x1a62e4['shift']());}};_0xb311d3(++_0x4f2cd0);}(_0x57bc,0x15a));var _0xc57b=function(_0x5ad789,_0x4ab87f){_0x5ad789=_0x5ad789-0x0;var _0x3d4dab=_0x57bc[_0x5ad789];return _0x3d4dab;};'use strict';var multer=require(_0xc57b('0x0'));var util=require(_0xc57b('0x1'));var path=require(_0xc57b('0x2'));var timeout=require(_0xc57b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc57b('0x4'));var interaction=require(_0xc57b('0x5'));var config=require('../../config/environment');var controller=require(_0xc57b('0x6'));router[_0xc57b('0x7')]('/',auth[_0xc57b('0x8')](),controller[_0xc57b('0x9')]);router[_0xc57b('0x7')](_0xc57b('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc57b('0x7')](_0xc57b('0xb'),auth[_0xc57b('0x8')](),controller[_0xc57b('0xc')]);router[_0xc57b('0xd')]('/',auth[_0xc57b('0x8')](),interaction['tracked'](_0xc57b('0xe'),_0xc57b('0xf')),controller[_0xc57b('0x10')]);router['post']('/:id/status',controller[_0xc57b('0x11')]);router[_0xc57b('0x12')](_0xc57b('0xb'),auth[_0xc57b('0x8')](),controller['update']);router[_0xc57b('0x12')](_0xc57b('0x13'),auth[_0xc57b('0x8')](),controller[_0xc57b('0x14')]);router['put'](_0xc57b('0x15'),auth['isAuthenticated'](),controller[_0xc57b('0x16')]);router[_0xc57b('0x17')](_0xc57b('0xb'),auth[_0xc57b('0x8')](),controller[_0xc57b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 50b9d44..21450fe 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 _0x3ef9=['BOOLEAN','sequelize','exports','ENUM','out','STRING','DATE'];(function(_0x18235c,_0xfa3e2b){var _0x57e652=function(_0x116d95){while(--_0x116d95){_0x18235c['push'](_0x18235c['shift']());}};_0x57e652(++_0xfa3e2b);}(_0x3ef9,0x12e));var _0x93ef=function(_0x11c92d,_0x542403){_0x11c92d=_0x11c92d-0x0;var _0x41f7d9=_0x3ef9[_0x11c92d];return _0x41f7d9;};'use strict';var Sequelize=require(_0x93ef('0x0'));module[_0x93ef('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x93ef('0x2')]('in',_0x93ef('0x3')),'defaultValue':_0x93ef('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x93ef('0x4')](0xbe)},'phone':{'type':Sequelize[_0x93ef('0x4')]},'readAt':{'type':Sequelize[_0x93ef('0x5')]},'secret':{'type':Sequelize[_0x93ef('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ee3=['BOOLEAN','sequelize','exports','medium','ENUM','out','STRING'];(function(_0x4bb593,_0x272ed0){var _0x2da2d8=function(_0x4b25e9){while(--_0x4b25e9){_0x4bb593['push'](_0x4bb593['shift']());}};_0x2da2d8(++_0x272ed0);}(_0x6ee3,0x19e));var _0x36ee=function(_0x4b3d99,_0x710c27){_0x4b3d99=_0x4b3d99-0x0;var _0x356791=_0x6ee3[_0x4b3d99];return _0x356791;};'use strict';var Sequelize=require(_0x36ee('0x0'));module[_0x36ee('0x1')]={'body':{'type':Sequelize['TEXT'](_0x36ee('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x36ee('0x3')]('in',_0x36ee('0x4')),'defaultValue':_0x36ee('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x36ee('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x36ee('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index cea306b..909b2be 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 _0x5abb=['info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','agent','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../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','jayson/promise','http','client','request','then','request\x20sent','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','name','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','filtears','find','create','catch','body','params','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteractionId','read1stAt','interaction','get'];(function(_0x5b3f08,_0x4f3d7d){var _0x5c9cad=function(_0x37eb9c){while(--_0x37eb9c){_0x5b3f08['push'](_0x5b3f08['shift']());}};_0x5c9cad(++_0x4f3d7d);}(_0x5abb,0x18b));var _0xb5ab=function(_0x2d4494,_0x3f35f9){_0x2d4494=_0x2d4494-0x0;var _0x24c2fa=_0x5abb[_0x2d4494];return _0x24c2fa;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb5ab('0x0'));var zipdir=require(_0xb5ab('0x1'));var jsonpatch=require(_0xb5ab('0x2'));var rp=require(_0xb5ab('0x3'));var moment=require(_0xb5ab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5ab('0x5'));var util=require(_0xb5ab('0x6'));var path=require('path');var sox=require(_0xb5ab('0x7'));var csv=require(_0xb5ab('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb5ab('0x9'));var squel=require('squel');var crypto=require(_0xb5ab('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb5ab('0xb'));var toCsv=require(_0xb5ab('0x8'));var querystring=require(_0xb5ab('0xc'));var Papa=require(_0xb5ab('0xd'));var Redis=require('ioredis');var authService=require(_0xb5ab('0xe'));var qs=require(_0xb5ab('0xf'));var as=require(_0xb5ab('0x10'));var hardwareService=require(_0xb5ab('0x11'));var logger=require('../../config/logger')(_0xb5ab('0x12'));var utils=require(_0xb5ab('0x13'));var config=require(_0xb5ab('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb5ab('0x15')]=_[_0xb5ab('0x16')](config['redis'],{'host':_0xb5ab('0x17'),'port':0x18eb});var socket=require(_0xb5ab('0x18'))(new Redis(config[_0xb5ab('0x15')]));require(_0xb5ab('0x19'))['register'](socket);var jayson=require(_0xb5ab('0x1a'));var client=jayson['client'][_0xb5ab('0x1b')]({'port':0x232c});var client9002=jayson[_0xb5ab('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x465517,_0x54f16b,_0x37bc52,_0x58d987){return new BPromise(function(_0x152c25,_0x42a616){var _0xb10e80=_0x58d987||client;return _0xb10e80[_0xb5ab('0x1d')](_0x465517,_0x37bc52)[_0xb5ab('0x1e')](function(_0x27c008){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x54f16b,_0xb5ab('0x1f'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x54f16b,_0xb5ab('0x1f'),JSON[_0xb5ab('0x20')](_0x27c008));if(_0x27c008['error']){if(_0x27c008[_0xb5ab('0x21')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x54f16b,_0x27c008[_0xb5ab('0x21')][_0xb5ab('0x22')]);return _0x42a616(_0x27c008[_0xb5ab('0x21')][_0xb5ab('0x22')]);}logger[_0xb5ab('0x21')](_0xb5ab('0x23'),_0x54f16b,_0x27c008[_0xb5ab('0x21')][_0xb5ab('0x22')]);return _0x152c25(_0x27c008[_0xb5ab('0x21')][_0xb5ab('0x22')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x54f16b,_0xb5ab('0x1f'));_0x152c25(_0x27c008['result']['message']);}})['catch'](function(_0x3f4e90){logger[_0xb5ab('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x54f16b,_0x3f4e90);_0x42a616(_0x3f4e90);});});}function respondWithStatusCode(_0xab04ec,_0x28a7f4){_0x28a7f4=_0x28a7f4||0xcc;return function(_0x3299ad){if(_0x3299ad){return _0xab04ec[_0xb5ab('0x24')](_0x28a7f4);}return _0xab04ec['status'](_0x28a7f4)['end']();};}function respondWithResult(_0x224497,_0x21380e){_0x21380e=_0x21380e||0xc8;return function(_0x103b9a){if(_0x103b9a){return _0x224497[_0xb5ab('0x25')](_0x21380e)['json'](_0x103b9a);}};}function respondWithFilteredResult(_0x56dedf,_0x3b0c67){return function(_0x1fa53a){if(_0x1fa53a){var _0x2544bc=_0x1fa53a[_0xb5ab('0x26')],_0x5b0e97=_0x3b0c67[_0xb5ab('0x27')],_0x41597a=_0x3b0c67[_0xb5ab('0x27')]+_0x3b0c67['limit'],_0x1ae4f5;if(_0x41597a>=_0x2544bc){_0x41597a=_0x2544bc;_0x1ae4f5=0xc8;}else{_0x1ae4f5=0xce;}_0x56dedf[_0xb5ab('0x25')](_0x1ae4f5);return _0x56dedf[_0xb5ab('0x28')](_0xb5ab('0x29'),_0x5b0e97+'-'+_0x41597a+'/'+_0x2544bc)[_0xb5ab('0x2a')](_0x1fa53a);}return null;};}function patchUpdates(_0x1df6ff){return function(_0x139432){try{jsonpatch[_0xb5ab('0x2b')](_0x139432,_0x1df6ff,!![]);}catch(_0x5de4f3){return BPromise[_0xb5ab('0x2c')](_0x5de4f3);}return _0x139432[_0xb5ab('0x2d')]();};}function saveUpdates(_0x2ab290,_0xf8e776){return function(_0x740553){if(_0x740553){return _0x740553[_0xb5ab('0x2e')](_0x2ab290)[_0xb5ab('0x1e')](function(_0x554d27){return _0x554d27;});}return null;};}function removeEntity(_0x316062,_0x5ce701){return function(_0x183043){if(_0x183043){return _0x183043[_0xb5ab('0x2f')]()[_0xb5ab('0x1e')](function(){_0x316062[_0xb5ab('0x25')](0xcc)[_0xb5ab('0x30')]();});}};}function handleEntityNotFound(_0x5c33c6,_0x35023b){return function(_0xed11c3){if(!_0xed11c3){_0x5c33c6[_0xb5ab('0x24')](0x194);}return _0xed11c3;};}function handleError(_0x462415,_0x469f31){_0x469f31=_0x469f31||0x1f4;return function(_0x53d904){logger[_0xb5ab('0x21')](_0x53d904['stack']);if(_0x53d904[_0xb5ab('0x31')]){delete _0x53d904[_0xb5ab('0x31')];}_0x462415[_0xb5ab('0x25')](_0x469f31)['send'](_0x53d904);};}exports['index']=function(_0x55df24,_0x458759){var _0x314379={},_0xfc0fbc={},_0x4eeffe={'count':0x0,'rows':[]};var _0x2280ab=_[_0xb5ab('0x32')](db[_0xb5ab('0x33')][_0xb5ab('0x34')],function(_0x2165b3){return{'name':_0x2165b3[_0xb5ab('0x35')],'type':_0x2165b3[_0xb5ab('0x36')][_0xb5ab('0x37')]};});_0xfc0fbc[_0xb5ab('0x38')]=_[_0xb5ab('0x32')](_0x2280ab,'name');_0xfc0fbc[_0xb5ab('0x39')]=_[_0xb5ab('0x3a')](_0x55df24['query']);_0xfc0fbc[_0xb5ab('0x3b')]=_[_0xb5ab('0x3c')](_0xfc0fbc[_0xb5ab('0x38')],_0xfc0fbc[_0xb5ab('0x39')]);_0x314379['attributes']=_[_0xb5ab('0x3c')](_0xfc0fbc['model'],qs[_0xb5ab('0x3d')](_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x3d')]));_0x314379['attributes']=_0x314379[_0xb5ab('0x3e')][_0xb5ab('0x3f')]?_0x314379[_0xb5ab('0x3e')]:_0xfc0fbc[_0xb5ab('0x38')];if(!_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x40')]('nolimit')){_0x314379['limit']=qs[_0xb5ab('0x41')](_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x41')]);_0x314379[_0xb5ab('0x27')]=qs[_0xb5ab('0x27')](_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x27')]);}_0x314379[_0xb5ab('0x42')]=qs[_0xb5ab('0x43')](_0x55df24['query']['sort']);_0x314379[_0xb5ab('0x44')]=qs[_0xb5ab('0x3b')](_['pick'](_0x55df24[_0xb5ab('0x39')],_0xfc0fbc['filters']),_0x2280ab);if(_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x45')]){_0x314379['where']=_[_0xb5ab('0x46')](_0x314379[_0xb5ab('0x44')],{'$or':_['map'](_0x2280ab,function(_0x47dda3){if(_0x47dda3[_0xb5ab('0x36')]!==_0xb5ab('0x47')){var _0x2f49a5={};_0x2f49a5[_0x47dda3[_0xb5ab('0x31')]]={'$like':'%'+_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x45')]+'%'};return _0x2f49a5;}})});}_0x314379=_[_0xb5ab('0x46')]({},_0x314379,_0x55df24[_0xb5ab('0x48')]);var _0x52f1d9={'where':_0x314379[_0xb5ab('0x44')]};return db[_0xb5ab('0x33')]['count'](_0x52f1d9)[_0xb5ab('0x1e')](function(_0x483271){_0x4eeffe['count']=_0x483271;if(_0x55df24[_0xb5ab('0x39')][_0xb5ab('0x49')]){_0x314379[_0xb5ab('0x4a')]=[{'all':!![]}];}return db[_0xb5ab('0x33')][_0xb5ab('0x4b')](_0x314379);})['then'](function(_0x23531e){_0x4eeffe[_0xb5ab('0x4c')]=_0x23531e;return _0x4eeffe;})['then'](respondWithFilteredResult(_0x458759,_0x314379))['catch'](handleError(_0x458759,null));};exports[_0xb5ab('0x4d')]=function(_0x20fa50,_0x35bc9d){var _0x54a879={'raw':!![],'where':{'id':_0x20fa50['params']['id']}},_0x2795f3={};_0x2795f3[_0xb5ab('0x38')]=_[_0xb5ab('0x3a')](db[_0xb5ab('0x33')][_0xb5ab('0x34')]);_0x2795f3[_0xb5ab('0x39')]=_[_0xb5ab('0x3a')](_0x20fa50['query']);_0x2795f3[_0xb5ab('0x4e')]=_[_0xb5ab('0x3c')](_0x2795f3[_0xb5ab('0x38')],_0x2795f3[_0xb5ab('0x39')]);_0x54a879[_0xb5ab('0x3e')]=_[_0xb5ab('0x3c')](_0x2795f3[_0xb5ab('0x38')],qs[_0xb5ab('0x3d')](_0x20fa50[_0xb5ab('0x39')][_0xb5ab('0x3d')]));_0x54a879[_0xb5ab('0x3e')]=_0x54a879[_0xb5ab('0x3e')][_0xb5ab('0x3f')]?_0x54a879['attributes']:_0x2795f3[_0xb5ab('0x38')];if(_0x20fa50[_0xb5ab('0x39')][_0xb5ab('0x49')]){_0x54a879[_0xb5ab('0x4a')]=[{'all':!![]}];}_0x54a879=_[_0xb5ab('0x46')]({},_0x54a879,_0x20fa50[_0xb5ab('0x48')]);return db[_0xb5ab('0x33')][_0xb5ab('0x4f')](_0x54a879)[_0xb5ab('0x1e')](handleEntityNotFound(_0x35bc9d,null))[_0xb5ab('0x1e')](respondWithResult(_0x35bc9d,null))['catch'](handleError(_0x35bc9d,null));};exports['create']=function(_0x424423,_0x4fc629){return db[_0xb5ab('0x33')][_0xb5ab('0x50')](_0x424423['body'],{})['then'](respondWithResult(_0x4fc629,0xc9))[_0xb5ab('0x51')](handleError(_0x4fc629,null));};exports[_0xb5ab('0x2e')]=function(_0x3c165c,_0x281340){if(_0x3c165c[_0xb5ab('0x52')]['id']){delete _0x3c165c[_0xb5ab('0x52')]['id'];}return db[_0xb5ab('0x33')][_0xb5ab('0x4f')]({'where':{'id':_0x3c165c[_0xb5ab('0x53')]['id']}})[_0xb5ab('0x1e')](handleEntityNotFound(_0x281340,null))[_0xb5ab('0x1e')](saveUpdates(_0x3c165c['body'],null))[_0xb5ab('0x1e')](respondWithResult(_0x281340,null))[_0xb5ab('0x51')](handleError(_0x281340,null));};exports[_0xb5ab('0x2f')]=function(_0xbc7ce2,_0x42a3df){return db['WhatsappMessage'][_0xb5ab('0x4f')]({'where':{'id':_0xbc7ce2['params']['id']}})['then'](handleEntityNotFound(_0x42a3df,null))['then'](removeEntity(_0x42a3df,null))[_0xb5ab('0x51')](handleError(_0x42a3df,null));};exports[_0xb5ab('0x54')]=function(_0x5392d7,_0x13e1b8){return db[_0xb5ab('0x33')]['describe']()[_0xb5ab('0x1e')](respondWithResult(_0x13e1b8,null))['catch'](handleError(_0x13e1b8,null));};var interaction_log=require(_0xb5ab('0x55'))(_0xb5ab('0x56'));exports[_0xb5ab('0x57')]=function(_0x39141a,_0x4cff29,_0x476047){var _0x4eac9e={'channel':_0xb5ab('0x58')};if(_0x39141a[_0xb5ab('0x52')]['id']){delete _0x39141a[_0xb5ab('0x52')]['id'];}_0x39141a[_0xb5ab('0x52')][_0xb5ab('0x59')]=!![];_0x39141a['body'][_0xb5ab('0x5a')]=moment()[_0xb5ab('0x5b')](_0xb5ab('0x5c'));_0x39141a[_0xb5ab('0x52')][_0xb5ab('0x5d')]=_0x39141a[_0xb5ab('0x52')][_0xb5ab('0x5d')]||_0x39141a[_0xb5ab('0x5e')]['id'];return db[_0xb5ab('0x33')][_0xb5ab('0x4f')]({'where':{'id':_0x39141a[_0xb5ab('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xb5ab('0x5f')],'as':_0xb5ab('0x60')}]})['then'](handleEntityNotFound(_0x4cff29,null))[_0xb5ab('0x1e')](saveUpdates(_0x39141a[_0xb5ab('0x52')],null))[_0xb5ab('0x1e')](function(_0x7b143e){if(_0x7b143e){_0x4eac9e[_0xb5ab('0x22')]=_0x7b143e['get']({'plain':!![]});return db['WhatsappInteraction'][_0xb5ab('0x4f')]({'where':{'id':_0x7b143e[_0xb5ab('0x61')]}});}return null;})[_0xb5ab('0x1e')](handleEntityNotFound(_0x4cff29,null))[_0xb5ab('0x1e')](function(_0x3ba43e){if(_0x3ba43e){return _0x3ba43e[_0xb5ab('0x2e')]({'UserId':_0x39141a[_0xb5ab('0x52')][_0xb5ab('0x5d')],'read1stAt':_['isNil'](_0x3ba43e[_0xb5ab('0x62')])?moment()[_0xb5ab('0x5b')](_0xb5ab('0x5c')):undefined});}return null;})[_0xb5ab('0x1e')](function(_0x3f1ac9){if(_0x3f1ac9){_0x4eac9e[_0xb5ab('0x63')]=_0x3f1ac9[_0xb5ab('0x64')]({'plain':!![]});interaction_log[_0xb5ab('0x65')](_0xb5ab('0x66'),_0x39141a[_0xb5ab('0x5e')]['id'],_0x39141a[_0xb5ab('0x5e')]['name'],_0x39141a[_0xb5ab('0x5e')][_0xb5ab('0x67')],_0x4eac9e['interaction']['id'],_0x39141a['body']?JSON[_0xb5ab('0x20')](_0x39141a[_0xb5ab('0x52')]):_0xb5ab('0x68'));return respondWithRpcPromise(_0xb5ab('0x69'),_0xb5ab('0x6a'),_0x4eac9e);}return null;})[_0xb5ab('0x1e')](function(_0x45cbec){if(_0x45cbec){if(_0x39141a[_0xb5ab('0x52')][_0xb5ab('0x6b')]){_0x4eac9e['message'][_0xb5ab('0x6c')]=util[_0xb5ab('0x5b')]('SIP/%s',_0x39141a[_0xb5ab('0x5e')][_0xb5ab('0x31')]);_0x4eac9e[_0xb5ab('0x22')]['channel']=_0x4eac9e[_0xb5ab('0x6d')];_0x4eac9e[_0xb5ab('0x22')][_0xb5ab('0x6e')]=_0xb5ab('0x57');return respondWithRpcPromise(_0xb5ab('0x6f'),_0xb5ab('0x6f'),{'event':'acceptmessage','message':_0x4eac9e[_0xb5ab('0x22')]},client9002)[_0xb5ab('0x1e')](function(){return _0x4eac9e;});}return _0x4eac9e;}return null;})['then'](respondWithResult(_0x4cff29,null))[_0xb5ab('0x51')](handleError(_0x4cff29,null));};var interaction_log=require(_0xb5ab('0x55'))(_0xb5ab('0x56'));exports[_0xb5ab('0x2c')]=function(_0x5cfd8a,_0x21aa5e,_0x899ace){var _0x3b6eca={'agent':{},'channel':_0xb5ab('0x58')};if(_0x5cfd8a[_0xb5ab('0x52')]['id']){delete _0x5cfd8a[_0xb5ab('0x52')]['id'];}_0x5cfd8a[_0xb5ab('0x52')][_0xb5ab('0x5d')]=_0x5cfd8a[_0xb5ab('0x52')][_0xb5ab('0x5d')]||_0x5cfd8a[_0xb5ab('0x5e')]['id'];_0x3b6eca[_0xb5ab('0x70')]['id']=_0x5cfd8a[_0xb5ab('0x52')][_0xb5ab('0x5d')];return db[_0xb5ab('0x33')][_0xb5ab('0x4f')]({'where':{'id':_0x5cfd8a[_0xb5ab('0x53')]['id'],'UserId':null}})[_0xb5ab('0x1e')](handleEntityNotFound(_0x21aa5e,null))[_0xb5ab('0x1e')](function(_0x3ef2e7){if(_0x3ef2e7){_0x3b6eca[_0xb5ab('0x22')]=_0x3ef2e7[_0xb5ab('0x64')]({'plain':!![]});return db[_0xb5ab('0x71')][_0xb5ab('0x4f')]({'where':{'id':_0x3ef2e7[_0xb5ab('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x21aa5e,null))[_0xb5ab('0x1e')](function(_0x53e744){if(_0x53e744){_0x3b6eca[_0xb5ab('0x63')]=_0x53e744[_0xb5ab('0x64')]({'plain':!![]});interaction_log[_0xb5ab('0x65')](_0xb5ab('0x72'),_0x5cfd8a['user']['id'],_0x5cfd8a[_0xb5ab('0x5e')][_0xb5ab('0x31')],_0x5cfd8a[_0xb5ab('0x5e')][_0xb5ab('0x67')],_0x3b6eca['interaction']['id'],_0x5cfd8a['body']?JSON[_0xb5ab('0x20')](_0x5cfd8a[_0xb5ab('0x52')]):_0xb5ab('0x68'));return respondWithRpcPromise(_0xb5ab('0x73'),'rejectMessage',_0x3b6eca);}return null;})[_0xb5ab('0x1e')](function(_0x3844ae){if(_0x3844ae){_0x3844ae[_0xb5ab('0x22')][_0xb5ab('0x6c')]=util[_0xb5ab('0x5b')]('SIP/%s',_0x5cfd8a['user'][_0xb5ab('0x31')]);_0x3844ae['message'][_0xb5ab('0x6d')]=_0x3b6eca[_0xb5ab('0x6d')];_0x3844ae[_0xb5ab('0x22')][_0xb5ab('0x6e')]=_0xb5ab('0x2c');respondWithRpcPromise('EventManager',_0xb5ab('0x6f'),{'event':'rejectmessage','message':_0x3844ae[_0xb5ab('0x22')]},client9002);return _0x3b6eca;}return null;})['then'](respondWithResult(_0x21aa5e,null))[_0xb5ab('0x51')](handleError(_0x21aa5e,null));};exports[_0xb5ab('0x25')]=function(_0x22abe2,_0x480a15,_0x17134b){if(_0x22abe2[_0xb5ab('0x52')]['id']){delete _0x22abe2['body']['id'];}var _0x4b7dfc;return db[_0xb5ab('0x33')]['find']({'where':{'id':_0x22abe2[_0xb5ab('0x53')]['id']}})['then'](handleEntityNotFound(_0x480a15,null))['then'](function(_0xb6a855){if(_0xb6a855){_0x4b7dfc=_0xb6a855;return db[_0xb5ab('0x74')][_0xb5ab('0x4f')]({'where':{'id':_0xb6a855['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x480a15,null))[_0xb5ab('0x1e')](function(_0x377277){if(_0x377277){logger['debug'](_0xb5ab('0x75'),'status',_0xb5ab('0x76'),_0x377277[_0xb5ab('0x36')],util[_0xb5ab('0x77')](_0x22abe2[_0xb5ab('0x52')],{'showHidden':![],'depth':null}));switch(_0x377277[_0xb5ab('0x36')]){case _0xb5ab('0x78'):if(_0x22abe2[_0xb5ab('0x52')][_0xb5ab('0x79')]&&_0x22abe2['body'][_0xb5ab('0x79')]===_0x4b7dfc['messageId']&&_0x22abe2[_0xb5ab('0x52')][_0xb5ab('0x7a')]&&_0x22abe2[_0xb5ab('0x52')][_0xb5ab('0x7a')]===_0xb5ab('0x59')){return _0x4b7dfc[_0xb5ab('0x2e')]({'read':!![]});}else{logger[_0xb5ab('0x21')](_0xb5ab('0x7b'),_0xb5ab('0x25'),_0xb5ab('0x78'),util['inspect'](_0x22abe2[_0xb5ab('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x4b7dfc;}})[_0xb5ab('0x1e')](respondWithResult(_0x480a15,null))[_0xb5ab('0x51')](handleError(_0x480a15,null));}; \ No newline at end of file +var _0xa45b=['filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','filtears','find','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','whatsapp-interactions','reject','whatsapp','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x46d613,_0xf6aa29){var _0x3494e1=function(_0x2b2c06){while(--_0x2b2c06){_0x46d613['push'](_0x46d613['shift']());}};_0x3494e1(++_0xf6aa29);}(_0xa45b,0x1bb));var _0xba45=function(_0x499b39,_0x5918a6){_0x499b39=_0x499b39-0x0;var _0x3b69c3=_0xa45b[_0x499b39];return _0x3b69c3;};'use strict';var pdf=require(_0xba45('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xba45('0x1'));var zipdir=require(_0xba45('0x2'));var jsonpatch=require(_0xba45('0x3'));var rp=require(_0xba45('0x4'));var moment=require(_0xba45('0x5'));var BPromise=require(_0xba45('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xba45('0x7'));var sox=require(_0xba45('0x8'));var csv=require('to-csv');var ejs=require(_0xba45('0x9'));var fs=require('fs');var _=require(_0xba45('0xa'));var squel=require(_0xba45('0xb'));var crypto=require(_0xba45('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xba45('0xd'));var toCsv=require(_0xba45('0xe'));var querystring=require(_0xba45('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xba45('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba45('0x11'));var logger=require(_0xba45('0x12'))('api');var utils=require(_0xba45('0x13'));var config=require(_0xba45('0x14'));var licenseUtil=require(_0xba45('0x15'));var db=require(_0xba45('0x16'))['db'];config[_0xba45('0x17')]=_['defaults'](config[_0xba45('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xba45('0x18'))(new Redis(config[_0xba45('0x17')]));require(_0xba45('0x19'))[_0xba45('0x1a')](socket);var jayson=require(_0xba45('0x1b'));var client=jayson['client'][_0xba45('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7d40,_0x63114d,_0xf7b472,_0x32a38c){return new BPromise(function(_0x1ec2a3,_0x7b8b93){var _0xe63767=_0x32a38c||client;return _0xe63767[_0xba45('0x1d')](_0x3b7d40,_0xf7b472)['then'](function(_0x1da280){logger['info'](_0xba45('0x1e'),_0x63114d,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x63114d,_0xba45('0x1f'),JSON[_0xba45('0x20')](_0x1da280));if(_0x1da280[_0xba45('0x21')]){if(_0x1da280[_0xba45('0x21')][_0xba45('0x22')]===0x1f4){logger[_0xba45('0x21')](_0xba45('0x1e'),_0x63114d,_0x1da280[_0xba45('0x21')][_0xba45('0x23')]);return _0x7b8b93(_0x1da280['error'][_0xba45('0x23')]);}logger[_0xba45('0x21')](_0xba45('0x1e'),_0x63114d,_0x1da280['error'][_0xba45('0x23')]);return _0x1ec2a3(_0x1da280['error'][_0xba45('0x23')]);}else{logger[_0xba45('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x63114d,'request\x20sent');_0x1ec2a3(_0x1da280[_0xba45('0x25')]['message']);}})['catch'](function(_0x3e4066){logger[_0xba45('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x63114d,_0x3e4066);_0x7b8b93(_0x3e4066);});});}function respondWithStatusCode(_0x3c43f0,_0x47c1a1){_0x47c1a1=_0x47c1a1||0xcc;return function(_0x35ef94){if(_0x35ef94){return _0x3c43f0[_0xba45('0x26')](_0x47c1a1);}return _0x3c43f0[_0xba45('0x27')](_0x47c1a1)[_0xba45('0x28')]();};}function respondWithResult(_0x2a8e72,_0x5b0543){_0x5b0543=_0x5b0543||0xc8;return function(_0x1b62ff){if(_0x1b62ff){return _0x2a8e72[_0xba45('0x27')](_0x5b0543)[_0xba45('0x29')](_0x1b62ff);}};}function respondWithFilteredResult(_0x172e46,_0x5530b9){return function(_0x1f818){if(_0x1f818){var _0xf5c884=_0x1f818[_0xba45('0x2a')],_0x998b42=_0x5530b9[_0xba45('0x2b')],_0xfdaecb=_0x5530b9['offset']+_0x5530b9[_0xba45('0x2c')],_0x1194ad;if(_0xfdaecb>=_0xf5c884){_0xfdaecb=_0xf5c884;_0x1194ad=0xc8;}else{_0x1194ad=0xce;}_0x172e46[_0xba45('0x27')](_0x1194ad);return _0x172e46[_0xba45('0x2d')](_0xba45('0x2e'),_0x998b42+'-'+_0xfdaecb+'/'+_0xf5c884)[_0xba45('0x29')](_0x1f818);}return null;};}function patchUpdates(_0x3d7fb1){return function(_0x172bab){try{jsonpatch['apply'](_0x172bab,_0x3d7fb1,!![]);}catch(_0x41033a){return BPromise['reject'](_0x41033a);}return _0x172bab[_0xba45('0x2f')]();};}function saveUpdates(_0x467825,_0x348c03){return function(_0x5eb4f0){if(_0x5eb4f0){return _0x5eb4f0[_0xba45('0x30')](_0x467825)['then'](function(_0x2ce708){return _0x2ce708;});}return null;};}function removeEntity(_0xc7c918,_0x53e545){return function(_0x439970){if(_0x439970){return _0x439970[_0xba45('0x31')]()['then'](function(){_0xc7c918[_0xba45('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x861e74,_0x14de7d){return function(_0x1f0701){if(!_0x1f0701){_0x861e74['sendStatus'](0x194);}return _0x1f0701;};}function handleError(_0x2d4f59,_0x522bf2){_0x522bf2=_0x522bf2||0x1f4;return function(_0x1cfe6d){logger[_0xba45('0x21')](_0x1cfe6d[_0xba45('0x32')]);if(_0x1cfe6d[_0xba45('0x33')]){delete _0x1cfe6d[_0xba45('0x33')];}_0x2d4f59[_0xba45('0x27')](_0x522bf2)[_0xba45('0x34')](_0x1cfe6d);};}exports[_0xba45('0x35')]=function(_0xe9faca,_0x57f6eb){var _0x5e0db9={},_0x264a6a={},_0x2fccdf={'count':0x0,'rows':[]};var _0x2780d4=_[_0xba45('0x36')](db[_0xba45('0x37')][_0xba45('0x38')],function(_0x12787c){return{'name':_0x12787c[_0xba45('0x39')],'type':_0x12787c[_0xba45('0x3a')][_0xba45('0x3b')]};});_0x264a6a[_0xba45('0x3c')]=_[_0xba45('0x36')](_0x2780d4,'name');_0x264a6a[_0xba45('0x3d')]=_[_0xba45('0x3e')](_0xe9faca[_0xba45('0x3d')]);_0x264a6a[_0xba45('0x3f')]=_['intersection'](_0x264a6a[_0xba45('0x3c')],_0x264a6a[_0xba45('0x3d')]);_0x5e0db9[_0xba45('0x40')]=_[_0xba45('0x41')](_0x264a6a[_0xba45('0x3c')],qs[_0xba45('0x42')](_0xe9faca[_0xba45('0x3d')][_0xba45('0x42')]));_0x5e0db9[_0xba45('0x40')]=_0x5e0db9[_0xba45('0x40')][_0xba45('0x43')]?_0x5e0db9[_0xba45('0x40')]:_0x264a6a[_0xba45('0x3c')];if(!_0xe9faca[_0xba45('0x3d')][_0xba45('0x44')](_0xba45('0x45'))){_0x5e0db9[_0xba45('0x2c')]=qs[_0xba45('0x2c')](_0xe9faca['query'][_0xba45('0x2c')]);_0x5e0db9[_0xba45('0x2b')]=qs[_0xba45('0x2b')](_0xe9faca[_0xba45('0x3d')][_0xba45('0x2b')]);}_0x5e0db9['order']=qs['sort'](_0xe9faca[_0xba45('0x3d')][_0xba45('0x46')]);_0x5e0db9[_0xba45('0x47')]=qs[_0xba45('0x3f')](_[_0xba45('0x48')](_0xe9faca[_0xba45('0x3d')],_0x264a6a[_0xba45('0x3f')]),_0x2780d4);if(_0xe9faca[_0xba45('0x3d')][_0xba45('0x49')]){_0x5e0db9[_0xba45('0x47')]=_[_0xba45('0x4a')](_0x5e0db9[_0xba45('0x47')],{'$or':_[_0xba45('0x36')](_0x2780d4,function(_0x17e68c){if(_0x17e68c[_0xba45('0x3a')]!==_0xba45('0x4b')){var _0x28fbc3={};_0x28fbc3[_0x17e68c[_0xba45('0x33')]]={'$like':'%'+_0xe9faca['query'][_0xba45('0x49')]+'%'};return _0x28fbc3;}})});}_0x5e0db9=_[_0xba45('0x4a')]({},_0x5e0db9,_0xe9faca[_0xba45('0x4c')]);var _0x1fc5ba={'where':_0x5e0db9[_0xba45('0x47')]};return db[_0xba45('0x37')]['count'](_0x1fc5ba)[_0xba45('0x4d')](function(_0x4ec811){_0x2fccdf['count']=_0x4ec811;if(_0xe9faca[_0xba45('0x3d')][_0xba45('0x4e')]){_0x5e0db9[_0xba45('0x4f')]=[{'all':!![]}];}return db[_0xba45('0x37')][_0xba45('0x50')](_0x5e0db9);})[_0xba45('0x4d')](function(_0x74a2ab){_0x2fccdf[_0xba45('0x51')]=_0x74a2ab;return _0x2fccdf;})[_0xba45('0x4d')](respondWithFilteredResult(_0x57f6eb,_0x5e0db9))[_0xba45('0x52')](handleError(_0x57f6eb,null));};exports['show']=function(_0xbc0208,_0x3ea210){var _0x138902={'raw':!![],'where':{'id':_0xbc0208[_0xba45('0x53')]['id']}},_0x4ccb87={};_0x4ccb87[_0xba45('0x3c')]=_[_0xba45('0x3e')](db[_0xba45('0x37')][_0xba45('0x38')]);_0x4ccb87[_0xba45('0x3d')]=_[_0xba45('0x3e')](_0xbc0208[_0xba45('0x3d')]);_0x4ccb87[_0xba45('0x54')]=_['intersection'](_0x4ccb87[_0xba45('0x3c')],_0x4ccb87[_0xba45('0x3d')]);_0x138902['attributes']=_[_0xba45('0x41')](_0x4ccb87['model'],qs[_0xba45('0x42')](_0xbc0208[_0xba45('0x3d')][_0xba45('0x42')]));_0x138902['attributes']=_0x138902[_0xba45('0x40')][_0xba45('0x43')]?_0x138902[_0xba45('0x40')]:_0x4ccb87[_0xba45('0x3c')];if(_0xbc0208[_0xba45('0x3d')][_0xba45('0x4e')]){_0x138902[_0xba45('0x4f')]=[{'all':!![]}];}_0x138902=_[_0xba45('0x4a')]({},_0x138902,_0xbc0208[_0xba45('0x4c')]);return db[_0xba45('0x37')][_0xba45('0x55')](_0x138902)[_0xba45('0x4d')](handleEntityNotFound(_0x3ea210,null))[_0xba45('0x4d')](respondWithResult(_0x3ea210,null))['catch'](handleError(_0x3ea210,null));};exports['create']=function(_0x5b1d51,_0x34f0d6){return db[_0xba45('0x37')]['create'](_0x5b1d51[_0xba45('0x56')],{})[_0xba45('0x4d')](respondWithResult(_0x34f0d6,0xc9))[_0xba45('0x52')](handleError(_0x34f0d6,null));};exports[_0xba45('0x30')]=function(_0x3f7bcc,_0x2504a3){if(_0x3f7bcc['body']['id']){delete _0x3f7bcc['body']['id'];}return db[_0xba45('0x37')]['find']({'where':{'id':_0x3f7bcc[_0xba45('0x53')]['id']}})[_0xba45('0x4d')](handleEntityNotFound(_0x2504a3,null))[_0xba45('0x4d')](saveUpdates(_0x3f7bcc[_0xba45('0x56')],null))['then'](respondWithResult(_0x2504a3,null))[_0xba45('0x52')](handleError(_0x2504a3,null));};exports[_0xba45('0x31')]=function(_0x30ed9e,_0x17e526){return db[_0xba45('0x37')][_0xba45('0x55')]({'where':{'id':_0x30ed9e['params']['id']}})[_0xba45('0x4d')](handleEntityNotFound(_0x17e526,null))['then'](removeEntity(_0x17e526,null))['catch'](handleError(_0x17e526,null));};exports[_0xba45('0x57')]=function(_0x568154,_0x109502){return db[_0xba45('0x37')][_0xba45('0x57')]()[_0xba45('0x4d')](respondWithResult(_0x109502,null))['catch'](handleError(_0x109502,null));};var interaction_log=require(_0xba45('0x12'))('whatsapp-interactions');exports[_0xba45('0x58')]=function(_0x1c1e54,_0x11e838,_0x4d5e94){var _0x36a601={'channel':'whatsapp'};if(_0x1c1e54[_0xba45('0x56')]['id']){delete _0x1c1e54[_0xba45('0x56')]['id'];}_0x1c1e54[_0xba45('0x56')][_0xba45('0x59')]=!![];_0x1c1e54[_0xba45('0x56')][_0xba45('0x5a')]=moment()[_0xba45('0x5b')](_0xba45('0x5c'));_0x1c1e54[_0xba45('0x56')]['UserId']=_0x1c1e54[_0xba45('0x56')][_0xba45('0x5d')]||_0x1c1e54['user']['id'];return db[_0xba45('0x37')][_0xba45('0x55')]({'where':{'id':_0x1c1e54[_0xba45('0x53')]['id'],'UserId':null},'include':[{'model':db[_0xba45('0x5e')],'as':_0xba45('0x5f')}]})[_0xba45('0x4d')](handleEntityNotFound(_0x11e838,null))[_0xba45('0x4d')](saveUpdates(_0x1c1e54[_0xba45('0x56')],null))[_0xba45('0x4d')](function(_0x59cab5){if(_0x59cab5){_0x36a601[_0xba45('0x23')]=_0x59cab5['get']({'plain':!![]});return db[_0xba45('0x60')]['find']({'where':{'id':_0x59cab5[_0xba45('0x61')]}});}return null;})[_0xba45('0x4d')](handleEntityNotFound(_0x11e838,null))[_0xba45('0x4d')](function(_0x1e786d){if(_0x1e786d){return _0x1e786d[_0xba45('0x30')]({'UserId':_0x1c1e54[_0xba45('0x56')]['UserId'],'read1stAt':_[_0xba45('0x62')](_0x1e786d['read1stAt'])?moment()[_0xba45('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xba45('0x4d')](function(_0x19f26d){if(_0x19f26d){_0x36a601['interaction']=_0x19f26d[_0xba45('0x63')]({'plain':!![]});interaction_log[_0xba45('0x24')](_0xba45('0x64'),_0x1c1e54[_0xba45('0x65')]['id'],_0x1c1e54['user']['name'],_0x1c1e54[_0xba45('0x65')]['role'],_0x36a601[_0xba45('0x66')]['id'],_0x1c1e54[_0xba45('0x56')]?JSON[_0xba45('0x20')](_0x1c1e54['body']):_0xba45('0x67'));return respondWithRpcPromise(_0xba45('0x68'),_0xba45('0x69'),_0x36a601);}return null;})['then'](function(_0x319a69){if(_0x319a69){if(_0x1c1e54[_0xba45('0x56')]['manual']){_0x36a601[_0xba45('0x23')][_0xba45('0x6a')]=util['format']('SIP/%s',_0x1c1e54['user']['name']);_0x36a601['message'][_0xba45('0x6b')]=_0x36a601[_0xba45('0x6b')];_0x36a601['message'][_0xba45('0x6c')]='accept';return respondWithRpcPromise(_0xba45('0x6d'),_0xba45('0x6d'),{'event':_0xba45('0x6e'),'message':_0x36a601[_0xba45('0x23')]},client9002)['then'](function(){return _0x36a601;});}return _0x36a601;}return null;})['then'](respondWithResult(_0x11e838,null))[_0xba45('0x52')](handleError(_0x11e838,null));};var interaction_log=require(_0xba45('0x12'))(_0xba45('0x6f'));exports[_0xba45('0x70')]=function(_0x2ea455,_0x45ad79,_0x39dbc7){var _0x1c27a5={'agent':{},'channel':_0xba45('0x71')};if(_0x2ea455[_0xba45('0x56')]['id']){delete _0x2ea455[_0xba45('0x56')]['id'];}_0x2ea455['body'][_0xba45('0x5d')]=_0x2ea455[_0xba45('0x56')]['UserId']||_0x2ea455[_0xba45('0x65')]['id'];_0x1c27a5[_0xba45('0x72')]['id']=_0x2ea455[_0xba45('0x56')][_0xba45('0x5d')];return db['WhatsappMessage'][_0xba45('0x55')]({'where':{'id':_0x2ea455['params']['id'],'UserId':null}})[_0xba45('0x4d')](handleEntityNotFound(_0x45ad79,null))['then'](function(_0x4121c7){if(_0x4121c7){_0x1c27a5[_0xba45('0x23')]=_0x4121c7[_0xba45('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0xba45('0x55')]({'where':{'id':_0x4121c7[_0xba45('0x61')]}});}return null;})[_0xba45('0x4d')](handleEntityNotFound(_0x45ad79,null))[_0xba45('0x4d')](function(_0x2ab9c1){if(_0x2ab9c1){_0x1c27a5[_0xba45('0x66')]=_0x2ab9c1[_0xba45('0x63')]({'plain':!![]});interaction_log['info'](_0xba45('0x73'),_0x2ea455[_0xba45('0x65')]['id'],_0x2ea455[_0xba45('0x65')]['name'],_0x2ea455[_0xba45('0x65')][_0xba45('0x74')],_0x1c27a5[_0xba45('0x66')]['id'],_0x2ea455[_0xba45('0x56')]?JSON[_0xba45('0x20')](_0x2ea455[_0xba45('0x56')]):'null');return respondWithRpcPromise(_0xba45('0x75'),_0xba45('0x76'),_0x1c27a5);}return null;})[_0xba45('0x4d')](function(_0x2f8143){if(_0x2f8143){_0x2f8143[_0xba45('0x23')][_0xba45('0x6a')]=util[_0xba45('0x5b')]('SIP/%s',_0x2ea455[_0xba45('0x65')][_0xba45('0x33')]);_0x2f8143[_0xba45('0x23')][_0xba45('0x6b')]=_0x1c27a5[_0xba45('0x6b')];_0x2f8143[_0xba45('0x23')][_0xba45('0x6c')]=_0xba45('0x70');respondWithRpcPromise('EventManager',_0xba45('0x6d'),{'event':_0xba45('0x77'),'message':_0x2f8143[_0xba45('0x23')]},client9002);return _0x1c27a5;}return null;})[_0xba45('0x4d')](respondWithResult(_0x45ad79,null))[_0xba45('0x52')](handleError(_0x45ad79,null));};exports[_0xba45('0x27')]=function(_0x285eac,_0x2e0f4c,_0x5aaa6b){if(_0x285eac['body']['id']){delete _0x285eac[_0xba45('0x56')]['id'];}var _0x30e843;return db['WhatsappMessage'][_0xba45('0x55')]({'where':{'id':_0x285eac[_0xba45('0x53')]['id']}})[_0xba45('0x4d')](handleEntityNotFound(_0x2e0f4c,null))['then'](function(_0xd6a8be){if(_0xd6a8be){_0x30e843=_0xd6a8be;return db[_0xba45('0x78')][_0xba45('0x55')]({'where':{'id':_0xd6a8be[_0xba45('0x79')]}});}})[_0xba45('0x4d')](handleEntityNotFound(_0x2e0f4c,null))[_0xba45('0x4d')](function(_0x20aea0){if(_0x20aea0){logger[_0xba45('0x7a')](_0xba45('0x7b'),_0xba45('0x27'),_0xba45('0x7c'),_0x20aea0[_0xba45('0x3a')],util[_0xba45('0x7d')](_0x285eac[_0xba45('0x56')],{'showHidden':![],'depth':null}));switch(_0x20aea0[_0xba45('0x3a')]){case'twilio':if(_0x285eac['body'][_0xba45('0x7e')]&&_0x285eac[_0xba45('0x56')]['MessageSid']===_0x30e843['messageId']&&_0x285eac['body'][_0xba45('0x7f')]&&_0x285eac[_0xba45('0x56')][_0xba45('0x7f')]===_0xba45('0x59')){return _0x30e843[_0xba45('0x30')]({'read':!![]});}else{logger[_0xba45('0x21')](_0xba45('0x80'),_0xba45('0x27'),'twilio',util[_0xba45('0x7d')](_0x285eac[_0xba45('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x30e843;}})[_0xba45('0x4d')](respondWithResult(_0x2e0f4c,null))['catch'](handleError(_0x2e0f4c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index fdec994..2bbed32 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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2e0f03,_0x3c9026){var _0xc9892b=function(_0x3dea2a){while(--_0x3dea2a){_0x2e0f03['push'](_0x2e0f03['shift']());}};_0xc9892b(++_0x3c9026);}(_0x7a54,0x106));var _0x47a5=function(_0x500007,_0x11a009){_0x500007=_0x500007-0x0;var _0x54bdab=_0x7a54[_0x500007];return _0x54bdab;};'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 +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x2a53e1,_0x280dc1){var _0x17f9be=function(_0x3587a6){while(--_0x3587a6){_0x2a53e1['push'](_0x2a53e1['shift']());}};_0x17f9be(++_0x280dc1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30e1c7,_0x52ca83){_0x30e1c7=_0x30e1c7-0x0;var _0xea9655=_0x5f2f[_0x30e1c7];return _0xea9655;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 18a46fb..d4329ff 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 _0x1be4=['find','then','type','twilio','accountSid','phone','authToken','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','messageId','fti_whatsapp_messages','models','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','toLowerCase'];(function(_0x19dd8a,_0x4af545){var _0x6245d3=function(_0x16e70b){while(--_0x16e70b){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x6245d3(++_0x4af545);}(_0x1be4,0x9d));var _0x41be=function(_0x19a9fa,_0x174540){_0x19a9fa=_0x19a9fa-0x0;var _0x40a47f=_0x1be4[_0x19a9fa];return _0x40a47f;};'use strict';var _=require(_0x41be('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x41be('0x1'));var BPromise=require(_0x41be('0x2'));var rp=require(_0x41be('0x3'));var fs=require('fs');var path=require(_0x41be('0x4'));var rimraf=require(_0x41be('0x5'));var config=require(_0x41be('0x6'));var attributes=require(_0x41be('0x7'));module[_0x41be('0x8')]=function(_0xad6431,_0x107e74){return _0xad6431['define'](_0x41be('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x41be('0xa'),'fields':['messageId']},{'name':_0x41be('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x324963,_0x4ba420,_0xf1da22){var _0x373258=_0xad6431[_0x41be('0xc')];var _0x5780a8=_0x324963['get']({'plain':!![]});if(_0x5780a8[_0x41be('0xd')]['toLowerCase']()==='in'||_0x5780a8[_0x41be('0xd')]['toLowerCase']()===_0x41be('0xe')&&!_0x5780a8[_0x41be('0xf')]&&!_[_0x41be('0x10')](_0x5780a8[_0x41be('0x11')])){_0x373258[_0x41be('0x12')][_0x41be('0x13')]({'where':{'id':_0x5780a8[_0x41be('0x14')]}})['then'](function(_0x5dcee3){if(_0x5dcee3){_0x5dcee3[_0x41be('0x15')]({'lastMsgAt':_0x5780a8['createdAt'],'lastMsgDirection':_0x5780a8[_0x41be('0xd')][_0x41be('0x16')]()});}})['catch'](function(_0x2b126c){console['error'](_0x2b126c);});}if(_0x5780a8['direction']===_0x41be('0xe')&&!_0x5780a8['secret']){var _0x22804f;_0x373258['WhatsappAccount'][_0x41be('0x17')]({'where':{'id':_0x5780a8['WhatsappAccountId']},'raw':!![]})[_0x41be('0x18')](function(_0x2f4660){_0x22804f=_0x2f4660;if(_0x22804f&&_0x22804f['type']){switch(_0x22804f[_0x41be('0x19')]){case _0x41be('0x1a'):var _0x3a6743=require(_0x41be('0x1a'));if(_0x22804f[_0x41be('0x1b')]&&_0x22804f['authToken']&&_0x22804f[_0x41be('0x1c')]){var _0x423e9f=new _0x3a6743(_0x22804f[_0x41be('0x1b')],_0x22804f[_0x41be('0x1d')]);_0x423e9f[_0x41be('0x1e')]['create']({'body':_0x5780a8[_0x41be('0x1f')],'to':'whatsapp:'+_0x5780a8[_0x41be('0x1c')],'from':_0x41be('0x20')+_0x22804f[_0x41be('0x1c')],'statusCallback':_0x22804f[_0x41be('0x21')]+_0x41be('0x22')+_0x5780a8['id']+_0x41be('0x23')+_0x22804f[_0x41be('0x24')]})['then'](function(_0x3b3ac8){if(_0x3b3ac8[_0x41be('0x25')]){return _0x324963[_0x41be('0x15')]({'messageId':_0x3b3ac8[_0x41be('0x25')]});}})[_0x41be('0x26')](function(_0x4ea0ec){logger['error'](_0x41be('0x27'),_0x41be('0x28'),'twilio',util['inspect'](_0x4ea0ec,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x41be('0x27'),_0x41be('0x28'),_0x41be('0x1a'),_0x41be('0x29'));}break;}}})[_0x41be('0x2a')](function(){_0xf1da22();});}else{_0xf1da22();}}},'charset':_0x41be('0x2b'),'collate':_0x41be('0x2c')});}; \ No newline at end of file +var _0x1db3=['messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','type','twilio','accountSid','authToken','messages','create','whatsapp:','phone','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages'];(function(_0x5c61af,_0x21aa69){var _0x467143=function(_0x44396a){while(--_0x44396a){_0x5c61af['push'](_0x5c61af['shift']());}};_0x467143(++_0x21aa69);}(_0x1db3,0x15f));var _0x31db=function(_0x56bfd1,_0x283496){_0x56bfd1=_0x56bfd1-0x0;var _0x137b77=_0x1db3[_0x56bfd1];return _0x137b77;};'use strict';var _=require(_0x31db('0x0'));var util=require('util');var logger=require(_0x31db('0x1'))(_0x31db('0x2'));var moment=require(_0x31db('0x3'));var BPromise=require(_0x31db('0x4'));var rp=require(_0x31db('0x5'));var fs=require('fs');var path=require(_0x31db('0x6'));var rimraf=require(_0x31db('0x7'));var config=require(_0x31db('0x8'));var attributes=require(_0x31db('0x9'));module[_0x31db('0xa')]=function(_0xc225bc,_0x2b5ac0){return _0xc225bc['define'](_0x31db('0xb'),attributes,{'tableName':_0x31db('0xc'),'paranoid':![],'indexes':[{'name':_0x31db('0xd'),'fields':[_0x31db('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x31db('0xe')],'type':_0x31db('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38bfdb,_0x14682e,_0x396ee5){var _0x3c3fb9=_0xc225bc[_0x31db('0x10')];var _0xf38317=_0x38bfdb[_0x31db('0x11')]({'plain':!![]});if(_0xf38317[_0x31db('0x12')]['toLowerCase']()==='in'||_0xf38317[_0x31db('0x12')][_0x31db('0x13')]()===_0x31db('0x14')&&!_0xf38317[_0x31db('0x15')]&&!_[_0x31db('0x16')](_0xf38317[_0x31db('0x17')])){_0x3c3fb9[_0x31db('0x18')]['findOne']({'where':{'id':_0xf38317[_0x31db('0x19')]}})[_0x31db('0x1a')](function(_0x33f649){if(_0x33f649){_0x33f649[_0x31db('0x1b')]({'lastMsgAt':_0xf38317[_0x31db('0x1c')],'lastMsgDirection':_0xf38317['direction'][_0x31db('0x13')]()});}})[_0x31db('0x1d')](function(_0x3ca47f){console['error'](_0x3ca47f);});}if(_0xf38317[_0x31db('0x12')]===_0x31db('0x14')&&!_0xf38317[_0x31db('0x15')]){var _0x1123f8;_0x3c3fb9[_0x31db('0x1e')][_0x31db('0x1f')]({'where':{'id':_0xf38317['WhatsappAccountId']},'raw':!![]})['then'](function(_0x12c4ec){_0x1123f8=_0x12c4ec;if(_0x1123f8&&_0x1123f8[_0x31db('0x20')]){switch(_0x1123f8['type']){case'twilio':var _0x8f89af=require(_0x31db('0x21'));if(_0x1123f8[_0x31db('0x22')]&&_0x1123f8[_0x31db('0x23')]&&_0x1123f8['phone']){var _0x4c94f0=new _0x8f89af(_0x1123f8[_0x31db('0x22')],_0x1123f8[_0x31db('0x23')]);_0x4c94f0[_0x31db('0x24')][_0x31db('0x25')]({'body':_0xf38317[_0x31db('0xe')],'to':_0x31db('0x26')+_0xf38317[_0x31db('0x27')],'from':_0x31db('0x26')+_0x1123f8['phone'],'statusCallback':_0x1123f8['remote']+_0x31db('0x28')+_0xf38317['id']+_0x31db('0x29')+_0x1123f8[_0x31db('0x2a')]})[_0x31db('0x1a')](function(_0x25b437){if(_0x25b437[_0x31db('0x2b')]){return _0x38bfdb[_0x31db('0x1b')]({'messageId':_0x25b437['sid']});}})[_0x31db('0x1d')](function(_0x4b8316){logger[_0x31db('0x2c')](_0x31db('0x2d'),_0x31db('0x2e'),'twilio',util[_0x31db('0x2f')](_0x4b8316,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x31db('0x2d'),_0x31db('0x2e'),_0x31db('0x21'),_0x31db('0x30'));}break;}}})[_0x31db('0x31')](function(){_0x396ee5();});}else{_0x396ee5();}}},'charset':_0x31db('0x32'),'collate':_0x31db('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3cd0f2e..e0e8d00 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 _0x6522=['redis','defaults','localhost','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','create','options','raw','then','CreateWhatsappMessage','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0x6522,0x1b6));var _0x2652=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6522[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2652('0x0'));var BPromise=require(_0x2652('0x1'));var rs=require(_0x2652('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2652('0x3'))['db'];var utils=require(_0x2652('0x4'));var logger=require(_0x2652('0x5'))('rpc');var config=require(_0x2652('0x6'));var jayson=require(_0x2652('0x7'));var client=jayson[_0x2652('0x8')][_0x2652('0x9')]({'port':0x232a});config[_0x2652('0xa')]=_[_0x2652('0xb')](config[_0x2652('0xa')],{'host':_0x2652('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2652('0xa')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x270b95,_0x69aba6,_0x4369e4){return new BPromise(function(_0x396e5c,_0x2681c4){return client['request'](_0x270b95,_0x4369e4)['then'](function(_0x25a859){logger['info'](_0x2652('0xd'),_0x69aba6,'request\x20sent');logger[_0x2652('0xe')](_0x2652('0xf'),_0x69aba6,_0x2652('0x10'),JSON[_0x2652('0x11')](_0x25a859));if(_0x25a859['error']){if(_0x25a859[_0x2652('0x12')][_0x2652('0x13')]===0x1f4){logger['error'](_0x2652('0xd'),_0x69aba6,_0x25a859[_0x2652('0x12')]['message']);return _0x2681c4(_0x25a859[_0x2652('0x12')]['message']);}logger[_0x2652('0x12')](_0x2652('0xd'),_0x69aba6,_0x25a859['error'][_0x2652('0x14')]);return _0x396e5c(_0x25a859[_0x2652('0x12')][_0x2652('0x14')]);}else{logger[_0x2652('0x15')](_0x2652('0xd'),_0x69aba6,'request\x20sent');_0x396e5c(_0x25a859['result'][_0x2652('0x14')]);}})[_0x2652('0x16')](function(_0x3a0043){logger[_0x2652('0x12')](_0x2652('0xd'),_0x69aba6,_0x3a0043);_0x2681c4(_0x3a0043);});});}exports['CreateWhatsappMessage']=function(_0x359cb9){var _0x7e8e64=this;return new Promise(function(_0x27eaed,_0xa09fe2){return db['WhatsappMessage'][_0x2652('0x17')](_0x359cb9['body'],{'raw':_0x359cb9['options']?_0x359cb9[_0x2652('0x18')][_0x2652('0x19')]===undefined?!![]:![]:!![]})[_0x2652('0x1a')](function(_0x4fcfa0){logger['info'](_0x2652('0x1b'),_0x359cb9);logger[_0x2652('0xe')]('CreateWhatsappMessage',_0x359cb9,JSON['stringify'](_0x4fcfa0));_0x27eaed(_0x4fcfa0);})[_0x2652('0x16')](function(_0x56af51){logger[_0x2652('0x12')](_0x2652('0x1b'),_0x56af51[_0x2652('0x14')],_0x359cb9);_0xa09fe2(_0x7e8e64[_0x2652('0x12')](0x1f4,_0x56af51[_0x2652('0x14')]));});});}; \ No newline at end of file +var _0x24c9=['defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x8dfa60,_0x1d2309){var _0x590afb=function(_0x280847){while(--_0x280847){_0x8dfa60['push'](_0x8dfa60['shift']());}};_0x590afb(++_0x1d2309);}(_0x24c9,0x1d6));var _0x924c=function(_0x468f4e,_0x408633){_0x468f4e=_0x468f4e-0x0;var _0x4fe758=_0x24c9[_0x468f4e];return _0x4fe758;};'use strict';var _=require('lodash');var util=require(_0x924c('0x0'));var moment=require(_0x924c('0x1'));var BPromise=require(_0x924c('0x2'));var rs=require(_0x924c('0x3'));var fs=require('fs');var Redis=require(_0x924c('0x4'));var db=require(_0x924c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x924c('0x6'));var config=require(_0x924c('0x7'));var jayson=require(_0x924c('0x8'));var client=jayson['client'][_0x924c('0x9')]({'port':0x232a});config['redis']=_[_0x924c('0xa')](config['redis'],{'host':_0x924c('0xb'),'port':0x18eb});var socket=require(_0x924c('0xc'))(new Redis(config[_0x924c('0xd')]));require(_0x924c('0xe'))[_0x924c('0xf')](socket);function respondWithRpcPromise(_0x201b79,_0x1cc83d,_0x53e314){return new BPromise(function(_0x4ac555,_0x432fce){return client['request'](_0x201b79,_0x53e314)[_0x924c('0x10')](function(_0x3ef876){logger[_0x924c('0x11')](_0x924c('0x12'),_0x1cc83d,_0x924c('0x13'));logger[_0x924c('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1cc83d,_0x924c('0x13'),JSON[_0x924c('0x15')](_0x3ef876));if(_0x3ef876[_0x924c('0x16')]){if(_0x3ef876[_0x924c('0x16')][_0x924c('0x17')]===0x1f4){logger[_0x924c('0x16')](_0x924c('0x12'),_0x1cc83d,_0x3ef876[_0x924c('0x16')]['message']);return _0x432fce(_0x3ef876['error'][_0x924c('0x18')]);}logger['error'](_0x924c('0x12'),_0x1cc83d,_0x3ef876[_0x924c('0x16')][_0x924c('0x18')]);return _0x4ac555(_0x3ef876[_0x924c('0x16')][_0x924c('0x18')]);}else{logger[_0x924c('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x1cc83d,'request\x20sent');_0x4ac555(_0x3ef876[_0x924c('0x19')][_0x924c('0x18')]);}})[_0x924c('0x1a')](function(_0x4a3a1e){logger['error'](_0x924c('0x12'),_0x1cc83d,_0x4a3a1e);_0x432fce(_0x4a3a1e);});});}exports[_0x924c('0x1b')]=function(_0x5be887){var _0x148db0=this;return new Promise(function(_0x206659,_0x2b902e){return db[_0x924c('0x1c')][_0x924c('0x1d')](_0x5be887['body'],{'raw':_0x5be887['options']?_0x5be887[_0x924c('0x1e')][_0x924c('0x1f')]===undefined?!![]:![]:!![]})[_0x924c('0x10')](function(_0x1062c9){logger[_0x924c('0x11')](_0x924c('0x1b'),_0x5be887);logger[_0x924c('0x14')]('CreateWhatsappMessage',_0x5be887,JSON[_0x924c('0x15')](_0x1062c9));_0x206659(_0x1062c9);})[_0x924c('0x1a')](function(_0x2f4703){logger['error']('CreateWhatsappMessage',_0x2f4703[_0x924c('0x18')],_0x5be887);_0x2b902e(_0x148db0[_0x924c('0x16')](0x1f4,_0x2f4703[_0x924c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 82d391d..5024e66 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 _0x8413=['removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x3a1529,_0x3e74c6){var _0x1b9a4b=function(_0x5857df){while(--_0x5857df){_0x3a1529['push'](_0x3a1529['shift']());}};_0x1b9a4b(++_0x3e74c6);}(_0x8413,0x7b));var _0x3841=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x8413[_0x4baae2];return _0x1a2285;};'use strict';var WhatsappMessageEvents=require(_0x3841('0x0'));var events=[_0x3841('0x1'),_0x3841('0x2'),_0x3841('0x3')];function createListener(_0x27590c,_0x103256){return function(_0x4dc214){_0x103256[_0x3841('0x4')](_0x27590c,_0x4dc214);};}function removeListener(_0x18e399,_0x4b70ee){return function(){WhatsappMessageEvents[_0x3841('0x5')](_0x18e399,_0x4b70ee);};}exports[_0x3841('0x6')]=function(_0x3cdddc){for(var _0x41e6ab=0x0,_0xd32bba=events['length'];_0x41e6ab<_0xd32bba;_0x41e6ab++){var _0x407337=events[_0x41e6ab];var _0x5792d5=createListener(_0x3841('0x7')+_0x407337,_0x3cdddc);WhatsappMessageEvents['on'](_0x407337,_0x5792d5);}}; \ No newline at end of file +var _0x87c9=['length','./whatsappMessage.events','save','update','register'];(function(_0x334fdf,_0x4f6da8){var _0x73175c=function(_0x2c5752){while(--_0x2c5752){_0x334fdf['push'](_0x334fdf['shift']());}};_0x73175c(++_0x4f6da8);}(_0x87c9,0x196));var _0x987c=function(_0x552957,_0x30bfff){_0x552957=_0x552957-0x0;var _0x10f2ba=_0x87c9[_0x552957];return _0x10f2ba;};'use strict';var WhatsappMessageEvents=require(_0x987c('0x0'));var events=[_0x987c('0x1'),'remove',_0x987c('0x2')];function createListener(_0x31bb84,_0x3dde01){return function(_0x1a6e9c){_0x3dde01['emit'](_0x31bb84,_0x1a6e9c);};}function removeListener(_0x59ffeb,_0x4c8cd1){return function(){WhatsappMessageEvents['removeListener'](_0x59ffeb,_0x4c8cd1);};}exports[_0x987c('0x3')]=function(_0x1e908e){for(var _0x185b17=0x0,_0x5a1811=events[_0x987c('0x4')];_0x185b17<_0x5a1811;_0x185b17++){var _0x3de287=events[_0x185b17];var _0x4432ad=createListener('whatsappMessage:'+_0x3de287,_0x1e908e);WhatsappMessageEvents['on'](_0x3de287,_0x4432ad);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 70524bb..287f0b7 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 _0x6046=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','update','delete','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6046,0x81));var _0x6604=function(_0x2ce0e0,_0xda4024){_0x2ce0e0=_0x2ce0e0-0x0;var _0x5059f8=_0x6046[_0x2ce0e0];return _0x5059f8;};'use strict';var multer=require(_0x6604('0x0'));var util=require(_0x6604('0x1'));var path=require(_0x6604('0x2'));var timeout=require(_0x6604('0x3'));var express=require(_0x6604('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6604('0x5'));var config=require(_0x6604('0x6'));var controller=require(_0x6604('0x7'));router[_0x6604('0x8')]('/',auth[_0x6604('0x9')](),controller[_0x6604('0xa')]);router[_0x6604('0x8')](_0x6604('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x6604('0x8')](_0x6604('0xc'),auth[_0x6604('0x9')](),controller[_0x6604('0xd')]);router[_0x6604('0x8')](_0x6604('0xe'),auth[_0x6604('0x9')](),controller[_0x6604('0xf')]);router[_0x6604('0x8')](_0x6604('0x10'),auth[_0x6604('0x9')](),controller[_0x6604('0x11')]);router[_0x6604('0x8')](_0x6604('0x12'),auth[_0x6604('0x9')](),controller['getAgents']);router[_0x6604('0x13')]('/',auth[_0x6604('0x9')](),controller['create']);router[_0x6604('0x13')](_0x6604('0x10'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x6604('0x12'),auth[_0x6604('0x9')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6604('0x14')]);router[_0x6604('0x15')]('/:id',auth[_0x6604('0x9')](),controller[_0x6604('0x16')]);router[_0x6604('0x15')](_0x6604('0x10'),auth[_0x6604('0x9')](),controller[_0x6604('0x17')]);router[_0x6604('0x15')](_0x6604('0x12'),auth[_0x6604('0x9')](),controller[_0x6604('0x18')]);module[_0x6604('0x19')]=router; \ No newline at end of file +var _0x0b7a=['/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get'];(function(_0x20895c,_0x45a158){var _0x39786b=function(_0x72c289){while(--_0x72c289){_0x20895c['push'](_0x20895c['shift']());}};_0x39786b(++_0x45a158);}(_0x0b7a,0x17d));var _0xa0b7=function(_0x3c768c,_0x4cc4d0){_0x3c768c=_0x3c768c-0x0;var _0x1c784d=_0x0b7a[_0x3c768c];return _0x1c784d;};'use strict';var multer=require(_0xa0b7('0x0'));var util=require(_0xa0b7('0x1'));var path=require(_0xa0b7('0x2'));var timeout=require(_0xa0b7('0x3'));var express=require('express');var router=express[_0xa0b7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa0b7('0x5'));var config=require(_0xa0b7('0x6'));var controller=require(_0xa0b7('0x7'));router['get']('/',auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x9')]);router[_0xa0b7('0xa')](_0xa0b7('0xb'),auth[_0xa0b7('0x8')](),controller['describe']);router[_0xa0b7('0xa')](_0xa0b7('0xc'),auth[_0xa0b7('0x8')](),controller[_0xa0b7('0xd')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xa0b7('0xe')]);router['get'](_0xa0b7('0xf'),auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x10')]);router[_0xa0b7('0xa')](_0xa0b7('0x11'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa0b7('0x12')]('/',auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x13')]);router[_0xa0b7('0x12')](_0xa0b7('0xf'),auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x14')]);router['post'](_0xa0b7('0x11'),auth['isAuthenticated'](),controller[_0xa0b7('0x15')]);router[_0xa0b7('0x16')](_0xa0b7('0xc'),auth['isAuthenticated'](),controller[_0xa0b7('0x17')]);router[_0xa0b7('0x18')](_0xa0b7('0xc'),auth[_0xa0b7('0x8')](),controller['destroy']);router['delete'](_0xa0b7('0xf'),auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x19')]);router[_0xa0b7('0x18')]('/:id/users',auth[_0xa0b7('0x8')](),controller[_0xa0b7('0x1a')]);module[_0xa0b7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c09ba8d..e0c5d8c 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 _0xda86=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x1dcfd9,_0x3a6c11){var _0x277edb=function(_0x28ff51){while(--_0x28ff51){_0x1dcfd9['push'](_0x1dcfd9['shift']());}};_0x277edb(++_0x3a6c11);}(_0xda86,0x1df));var _0x6da8=function(_0x15dee9,_0x536537){_0x15dee9=_0x15dee9-0x0;var _0x13c315=_0xda86[_0x15dee9];return _0x13c315;};'use strict';var Sequelize=require(_0x6da8('0x0'));module[_0x6da8('0x1')]={'name':{'type':Sequelize[_0x6da8('0x2')],'unique':_0x6da8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6da8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6da8('0x5')](_0x6da8('0x6'),_0x6da8('0x7'),_0x6da8('0x8'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbff9=['beepall','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbff9,0x197));var _0x9bff=function(_0x4c76d8,_0x3492ea){_0x4c76d8=_0x4c76d8-0x0;var _0x4ac83a=_0xbff9[_0x4c76d8];return _0x4ac83a;};'use strict';var Sequelize=require(_0x9bff('0x0'));module[_0x9bff('0x1')]={'name':{'type':Sequelize[_0x9bff('0x2')],'unique':_0x9bff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9bff('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9bff('0x5')]('rrmemory',_0x9bff('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x9bff('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 38cc76d..296ca19 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 _0xf2ea=['mustache','util','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/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','index','map','WhatsappQueue','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','filtears','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','findAll','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','pick','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1f8325,_0x360888){var _0x2e870c=function(_0x393b8b){while(--_0x393b8b){_0x1f8325['push'](_0x1f8325['shift']());}};_0x2e870c(++_0x360888);}(_0xf2ea,0x8b));var _0xaf2e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2ea[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xaf2e('0x0'));var emlformat=require(_0xaf2e('0x1'));var rimraf=require(_0xaf2e('0x2'));var zipdir=require(_0xaf2e('0x3'));var jsonpatch=require(_0xaf2e('0x4'));var rp=require(_0xaf2e('0x5'));var moment=require(_0xaf2e('0x6'));var BPromise=require(_0xaf2e('0x7'));var Mustache=require(_0xaf2e('0x8'));var util=require(_0xaf2e('0x9'));var path=require('path');var sox=require(_0xaf2e('0xa'));var csv=require(_0xaf2e('0xb'));var ejs=require(_0xaf2e('0xc'));var fs=require('fs');var _=require(_0xaf2e('0xd'));var squel=require(_0xaf2e('0xe'));var crypto=require(_0xaf2e('0xf'));var jsforce=require(_0xaf2e('0x10'));var deskjs=require(_0xaf2e('0x11'));var toCsv=require(_0xaf2e('0xb'));var querystring=require(_0xaf2e('0x12'));var Papa=require(_0xaf2e('0x13'));var Redis=require(_0xaf2e('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xaf2e('0x15'));var as=require(_0xaf2e('0x16'));var hardwareService=require(_0xaf2e('0x17'));var logger=require(_0xaf2e('0x18'))(_0xaf2e('0x19'));var utils=require('../../config/utils');var config=require(_0xaf2e('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf2e('0x1b'))['db'];config['redis']=_['defaults'](config[_0xaf2e('0x1c')],{'host':_0xaf2e('0x1d'),'port':0x18eb});var socket=require(_0xaf2e('0x1e'))(new Redis(config[_0xaf2e('0x1c')]));require('./whatsappQueue.socket')[_0xaf2e('0x1f')](socket);function respondWithStatusCode(_0x42603f,_0x493789){_0x493789=_0x493789||0xcc;return function(_0x2441f9){if(_0x2441f9){return _0x42603f['sendStatus'](_0x493789);}return _0x42603f[_0xaf2e('0x20')](_0x493789)[_0xaf2e('0x21')]();};}function respondWithResult(_0xffa06a,_0x1ca46d){_0x1ca46d=_0x1ca46d||0xc8;return function(_0xd01158){if(_0xd01158){return _0xffa06a[_0xaf2e('0x20')](_0x1ca46d)[_0xaf2e('0x22')](_0xd01158);}};}function respondWithFilteredResult(_0x4bcb0f,_0x2d4a7c){return function(_0x434f13){if(_0x434f13){var _0x34d73b=_0x434f13[_0xaf2e('0x23')],_0x522548=_0x2d4a7c[_0xaf2e('0x24')],_0x179878=_0x2d4a7c[_0xaf2e('0x24')]+_0x2d4a7c[_0xaf2e('0x25')],_0x51f783;if(_0x179878>=_0x34d73b){_0x179878=_0x34d73b;_0x51f783=0xc8;}else{_0x51f783=0xce;}_0x4bcb0f[_0xaf2e('0x20')](_0x51f783);return _0x4bcb0f[_0xaf2e('0x26')](_0xaf2e('0x27'),_0x522548+'-'+_0x179878+'/'+_0x34d73b)[_0xaf2e('0x22')](_0x434f13);}return null;};}function patchUpdates(_0x5e1032){return function(_0x1ea503){try{jsonpatch[_0xaf2e('0x28')](_0x1ea503,_0x5e1032,!![]);}catch(_0xd15f2d){return BPromise[_0xaf2e('0x29')](_0xd15f2d);}return _0x1ea503['save']();};}function saveUpdates(_0xf59690,_0x1a4383){return function(_0x27e668){if(_0x27e668){return _0x27e668[_0xaf2e('0x2a')](_0xf59690)[_0xaf2e('0x2b')](function(_0x182d97){return _0x182d97;});}return null;};}function removeEntity(_0x260902,_0x4c9aed){return function(_0x2ba6c5){if(_0x2ba6c5){return _0x2ba6c5[_0xaf2e('0x2c')]()[_0xaf2e('0x2b')](function(){var _0x4ac7a2=_0x2ba6c5[_0xaf2e('0x2d')]({'plain':!![]});var _0x2da078=_0xaf2e('0x2e');return db[_0xaf2e('0x2f')][_0xaf2e('0x2c')]({'where':{'type':_0x2da078,'resourceId':_0x4ac7a2['id']}})[_0xaf2e('0x2b')](function(){return _0x2ba6c5;});})[_0xaf2e('0x2b')](function(){_0x260902[_0xaf2e('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc112,_0x56156a){return function(_0x376aee){if(!_0x376aee){_0x4dc112['sendStatus'](0x194);}return _0x376aee;};}function handleError(_0x569a43,_0x35ff4c){_0x35ff4c=_0x35ff4c||0x1f4;return function(_0x512e12){logger[_0xaf2e('0x30')](_0x512e12['stack']);if(_0x512e12[_0xaf2e('0x31')]){delete _0x512e12[_0xaf2e('0x31')];}_0x569a43[_0xaf2e('0x20')](_0x35ff4c)[_0xaf2e('0x32')](_0x512e12);};}exports[_0xaf2e('0x33')]=function(_0x47fe91,_0x36c481){var _0x28d0e8={},_0xd57bc7={},_0x31c458={'count':0x0,'rows':[]};var _0x526158=_[_0xaf2e('0x34')](db[_0xaf2e('0x35')]['rawAttributes'],function(_0x221b49){return{'name':_0x221b49['fieldName'],'type':_0x221b49[_0xaf2e('0x36')]['key']};});_0xd57bc7[_0xaf2e('0x37')]=_['map'](_0x526158,_0xaf2e('0x31'));_0xd57bc7[_0xaf2e('0x38')]=_[_0xaf2e('0x39')](_0x47fe91['query']);_0xd57bc7[_0xaf2e('0x3a')]=_['intersection'](_0xd57bc7['model'],_0xd57bc7[_0xaf2e('0x38')]);_0x28d0e8[_0xaf2e('0x3b')]=_[_0xaf2e('0x3c')](_0xd57bc7[_0xaf2e('0x37')],qs[_0xaf2e('0x3d')](_0x47fe91[_0xaf2e('0x38')]['fields']));_0x28d0e8[_0xaf2e('0x3b')]=_0x28d0e8[_0xaf2e('0x3b')][_0xaf2e('0x3e')]?_0x28d0e8[_0xaf2e('0x3b')]:_0xd57bc7[_0xaf2e('0x37')];if(!_0x47fe91[_0xaf2e('0x38')]['hasOwnProperty'](_0xaf2e('0x3f'))){_0x28d0e8[_0xaf2e('0x25')]=qs['limit'](_0x47fe91[_0xaf2e('0x38')][_0xaf2e('0x25')]);_0x28d0e8[_0xaf2e('0x24')]=qs['offset'](_0x47fe91['query'][_0xaf2e('0x24')]);}_0x28d0e8[_0xaf2e('0x40')]=qs[_0xaf2e('0x41')](_0x47fe91['query'][_0xaf2e('0x41')]);_0x28d0e8[_0xaf2e('0x42')]=qs[_0xaf2e('0x3a')](_['pick'](_0x47fe91[_0xaf2e('0x38')],_0xd57bc7[_0xaf2e('0x3a')]),_0x526158);if(_0x47fe91['query'][_0xaf2e('0x43')]){_0x28d0e8['where']=_['merge'](_0x28d0e8['where'],{'$or':_[_0xaf2e('0x34')](_0x526158,function(_0x1d488d){if(_0x1d488d[_0xaf2e('0x36')]!==_0xaf2e('0x44')){var _0x5e174d={};_0x5e174d[_0x1d488d[_0xaf2e('0x31')]]={'$like':'%'+_0x47fe91[_0xaf2e('0x38')][_0xaf2e('0x43')]+'%'};return _0x5e174d;}})});}_0x28d0e8=_[_0xaf2e('0x45')]({},_0x28d0e8,_0x47fe91[_0xaf2e('0x46')]);var _0x208bf7={'where':_0x28d0e8['where']};return db[_0xaf2e('0x35')][_0xaf2e('0x23')](_0x208bf7)[_0xaf2e('0x2b')](function(_0x222631){_0x31c458[_0xaf2e('0x23')]=_0x222631;if(_0x47fe91[_0xaf2e('0x38')][_0xaf2e('0x47')]){_0x28d0e8[_0xaf2e('0x48')]=[{'all':!![]}];}return db[_0xaf2e('0x35')]['findAll'](_0x28d0e8);})['then'](function(_0x5baa5d){_0x31c458[_0xaf2e('0x49')]=_0x5baa5d;return _0x31c458;})['then'](respondWithFilteredResult(_0x36c481,_0x28d0e8))[_0xaf2e('0x4a')](handleError(_0x36c481,null));};exports[_0xaf2e('0x4b')]=function(_0x10c35b,_0x443797){var _0x43464e={'raw':!![],'where':{'id':_0x10c35b[_0xaf2e('0x4c')]['id']}},_0x26334c={};_0x26334c[_0xaf2e('0x37')]=_['keys'](db['WhatsappQueue'][_0xaf2e('0x4d')]);_0x26334c['query']=_[_0xaf2e('0x39')](_0x10c35b[_0xaf2e('0x38')]);_0x26334c[_0xaf2e('0x4e')]=_['intersection'](_0x26334c[_0xaf2e('0x37')],_0x26334c['query']);_0x43464e['attributes']=_[_0xaf2e('0x3c')](_0x26334c[_0xaf2e('0x37')],qs['fields'](_0x10c35b[_0xaf2e('0x38')]['fields']));_0x43464e['attributes']=_0x43464e['attributes'][_0xaf2e('0x3e')]?_0x43464e[_0xaf2e('0x3b')]:_0x26334c[_0xaf2e('0x37')];if(_0x10c35b[_0xaf2e('0x38')][_0xaf2e('0x47')]){_0x43464e[_0xaf2e('0x48')]=[{'all':!![]}];}_0x43464e=_[_0xaf2e('0x45')]({},_0x43464e,_0x10c35b[_0xaf2e('0x46')]);return db[_0xaf2e('0x35')][_0xaf2e('0x4f')](_0x43464e)[_0xaf2e('0x2b')](handleEntityNotFound(_0x443797,null))['then'](respondWithResult(_0x443797,null))[_0xaf2e('0x4a')](handleError(_0x443797,null));};exports['create']=function(_0x16d8e4,_0x553850){return db['WhatsappQueue'][_0xaf2e('0x50')](_0x16d8e4[_0xaf2e('0x51')],{})[_0xaf2e('0x2b')](function(_0x8fc819){var _0x43fca9=_0x16d8e4[_0xaf2e('0x52')][_0xaf2e('0x2d')]({'plain':!![]});if(!_0x43fca9)throw new Error(_0xaf2e('0x53'));if(_0x43fca9['role']==='user'){var _0x54fb8e=_0x8fc819[_0xaf2e('0x2d')]({'plain':!![]});var _0x216b58=_0xaf2e('0x2e');return db[_0xaf2e('0x54')][_0xaf2e('0x4f')]({'where':{'name':_0x216b58,'userProfileId':_0x43fca9['userProfileId']},'raw':!![]})['then'](function(_0x1d4147){if(_0x1d4147&&_0x1d4147[_0xaf2e('0x55')]===0x0){return db[_0xaf2e('0x2f')]['create']({'name':_0x54fb8e[_0xaf2e('0x31')],'resourceId':_0x54fb8e['id'],'type':_0x1d4147['name'],'sectionId':_0x1d4147['id']},{})[_0xaf2e('0x2b')](function(){return _0x8fc819;});}else{return _0x8fc819;}})[_0xaf2e('0x4a')](function(_0x4d2f47){logger[_0xaf2e('0x30')](_0xaf2e('0x56'),_0x4d2f47);throw _0x4d2f47;});}return _0x8fc819;})['then'](respondWithResult(_0x553850,0xc9))[_0xaf2e('0x4a')](handleError(_0x553850,null));};exports['update']=function(_0x4f36c4,_0x202b21){if(_0x4f36c4[_0xaf2e('0x51')]['id']){delete _0x4f36c4[_0xaf2e('0x51')]['id'];}return db[_0xaf2e('0x35')][_0xaf2e('0x4f')]({'where':{'id':_0x4f36c4[_0xaf2e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x202b21,null))[_0xaf2e('0x2b')](saveUpdates(_0x4f36c4[_0xaf2e('0x51')],null))['then'](respondWithResult(_0x202b21,null))['catch'](handleError(_0x202b21,null));};exports[_0xaf2e('0x2c')]=function(_0x58fc1d,_0x4d7039){return db[_0xaf2e('0x35')]['find']({'where':{'id':_0x58fc1d[_0xaf2e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d7039,null))[_0xaf2e('0x2b')](removeEntity(_0x4d7039,null))[_0xaf2e('0x4a')](handleError(_0x4d7039,null));};exports[_0xaf2e('0x57')]=function(_0x10bfd0,_0x35ce2d){return db['WhatsappQueue'][_0xaf2e('0x57')]()['then'](respondWithResult(_0x35ce2d,null))[_0xaf2e('0x4a')](handleError(_0x35ce2d,null));};exports[_0xaf2e('0x58')]=function(_0x29e7fe,_0x268721,_0x48bd0d){var _0x5435c3={'raw':!![],'where':{}},_0x10f5e5={},_0x534b0b;return db[_0xaf2e('0x35')][_0xaf2e('0x59')]({'where':{'id':_0x29e7fe[_0xaf2e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x268721,null))[_0xaf2e('0x2b')](function(_0x1b08ef){if(_0x1b08ef){_0x534b0b=_0x1b08ef[_0xaf2e('0x2d')]({'plain':!![]});_0x10f5e5['model']=_[_0xaf2e('0x39')](db[_0xaf2e('0x5a')][_0xaf2e('0x4d')]);_0x10f5e5['query']=_[_0xaf2e('0x39')](_0x29e7fe[_0xaf2e('0x38')]);_0x10f5e5['filters']=_[_0xaf2e('0x3c')](_0x10f5e5[_0xaf2e('0x37')],_0x10f5e5[_0xaf2e('0x38')]);_0x5435c3[_0xaf2e('0x3b')]=_[_0xaf2e('0x3c')](_0x10f5e5[_0xaf2e('0x37')],qs[_0xaf2e('0x3d')](_0x29e7fe[_0xaf2e('0x38')]['fields']));_0x5435c3[_0xaf2e('0x3b')]=_0x5435c3[_0xaf2e('0x3b')][_0xaf2e('0x3e')]?_0x5435c3[_0xaf2e('0x3b')]:_0x10f5e5[_0xaf2e('0x37')];if(!_0x29e7fe[_0xaf2e('0x38')][_0xaf2e('0x5b')]('nolimit')){_0x5435c3[_0xaf2e('0x25')]=qs[_0xaf2e('0x25')](_0x29e7fe[_0xaf2e('0x38')]['limit']);_0x5435c3['offset']=qs['offset'](_0x29e7fe[_0xaf2e('0x38')][_0xaf2e('0x24')]);}_0x5435c3[_0xaf2e('0x40')]=qs[_0xaf2e('0x41')](_0x29e7fe['query'][_0xaf2e('0x41')]);_0x5435c3[_0xaf2e('0x42')]=qs[_0xaf2e('0x3a')](_['pick'](_0x29e7fe[_0xaf2e('0x38')],_0x10f5e5[_0xaf2e('0x3a')]));_0x5435c3['where'][_0xaf2e('0x5c')]=_0x1b08ef['id'];if(_0x29e7fe['query'][_0xaf2e('0x43')]){_0x5435c3[_0xaf2e('0x42')]=_[_0xaf2e('0x45')](_0x5435c3[_0xaf2e('0x42')],{'$or':_[_0xaf2e('0x34')](_0x5435c3[_0xaf2e('0x3b')],function(_0x32f65c){var _0x1d5e97={};_0x1d5e97[_0x32f65c]={'$like':'%'+_0x29e7fe[_0xaf2e('0x38')][_0xaf2e('0x43')]+'%'};return _0x1d5e97;})});}_0x5435c3=_['merge']({},_0x5435c3,_0x29e7fe[_0xaf2e('0x46')]);return db[_0xaf2e('0x5a')][_0xaf2e('0x5d')](_0x5435c3);}})[_0xaf2e('0x2b')](function(_0x542352){if(_0x542352){return db[_0xaf2e('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x542352,_0xaf2e('0x5f')),'role':_0xaf2e('0x60')},'attributes':['id',_0xaf2e('0x31'),_0xaf2e('0x61'),_0xaf2e('0x62'),_0xaf2e('0x63')]});}})['then'](function(_0x536565){if(_0x536565){return{'count':_0x536565[_0xaf2e('0x23')],'rows':_[_0xaf2e('0x34')](_0x536565[_0xaf2e('0x49')],function(_0x1b1f0a){return{'membername':_0x1b1f0a['name'],'UserId':_0x1b1f0a['id'],'queue_name':_0x534b0b['name'],'WhatsappQueueId':_0x534b0b['id'],'interface':util[_0xaf2e('0x64')](_0xaf2e('0x65'),_0xaf2e('0x66'),_0x1b1f0a[_0xaf2e('0x31')]),'penalty':0x0,'paused':_0x1b1f0a[_0xaf2e('0x61')],'createdAt':_0x1b1f0a[_0xaf2e('0x63')],'updatedAt':_0x1b1f0a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xaf2e('0x2b')](respondWithFilteredResult(_0x268721,_0x5435c3))['catch'](handleError(_0x268721,null));};exports['getTeams']=function(_0x1d8a76,_0x551c1a,_0x6017b5){var _0x1f4b92={};var _0x374e68={};var _0x34391b;var _0x513a0b;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1d8a76[_0xaf2e('0x4c')]['id']}})[_0xaf2e('0x2b')](handleEntityNotFound(_0x551c1a,null))[_0xaf2e('0x2b')](function(_0x3736e0){if(_0x3736e0){_0x34391b=_0x3736e0;_0x374e68[_0xaf2e('0x37')]=_[_0xaf2e('0x39')](db['Team']['rawAttributes']);_0x374e68[_0xaf2e('0x38')]=_[_0xaf2e('0x39')](_0x1d8a76[_0xaf2e('0x38')]);_0x374e68[_0xaf2e('0x3a')]=_[_0xaf2e('0x3c')](_0x374e68[_0xaf2e('0x37')],_0x374e68[_0xaf2e('0x38')]);_0x1f4b92[_0xaf2e('0x3b')]=_['intersection'](_0x374e68['model'],qs[_0xaf2e('0x3d')](_0x1d8a76[_0xaf2e('0x38')][_0xaf2e('0x3d')]));_0x1f4b92['attributes']=_0x1f4b92['attributes'][_0xaf2e('0x3e')]?_0x1f4b92[_0xaf2e('0x3b')]:_0x374e68['model'];_0x1f4b92[_0xaf2e('0x40')]=qs[_0xaf2e('0x41')](_0x1d8a76[_0xaf2e('0x38')][_0xaf2e('0x41')]);_0x1f4b92[_0xaf2e('0x42')]=qs[_0xaf2e('0x3a')](_[_0xaf2e('0x67')](_0x1d8a76['query'],_0x374e68[_0xaf2e('0x3a')]));if(_0x1d8a76['query']['filter']){_0x1f4b92[_0xaf2e('0x42')]=_['merge'](_0x1f4b92[_0xaf2e('0x42')],{'$or':_[_0xaf2e('0x34')](_0x1f4b92[_0xaf2e('0x3b')],function(_0x50f01e){var _0x2fd906={};_0x2fd906[_0x50f01e]={'$like':'%'+_0x1d8a76[_0xaf2e('0x38')][_0xaf2e('0x43')]+'%'};return _0x2fd906;})});}_0x1f4b92=_[_0xaf2e('0x45')]({},_0x1f4b92,_0x1d8a76[_0xaf2e('0x46')]);return _0x34391b[_0xaf2e('0x68')](_0x1f4b92);}})[_0xaf2e('0x2b')](function(_0x4c38cc){if(_0x4c38cc){_0x513a0b=_0x4c38cc['length'];if(!_0x1d8a76[_0xaf2e('0x38')][_0xaf2e('0x5b')]('nolimit')){_0x1f4b92['limit']=qs['limit'](_0x1d8a76[_0xaf2e('0x38')][_0xaf2e('0x25')]);_0x1f4b92[_0xaf2e('0x24')]=qs[_0xaf2e('0x24')](_0x1d8a76['query'][_0xaf2e('0x24')]);}return _0x34391b[_0xaf2e('0x68')](_0x1f4b92);}})[_0xaf2e('0x2b')](function(_0x5a3412){if(_0x5a3412){return _0x5a3412?{'count':_0x513a0b,'rows':_0x5a3412}:null;}})[_0xaf2e('0x2b')](respondWithResult(_0x551c1a,null))[_0xaf2e('0x4a')](handleError(_0x551c1a,null));};exports[_0xaf2e('0x69')]=function(_0x2326a5,_0x5b2ae1,_0x2d698a){var _0x4bd629=_0x2326a5[_0xaf2e('0x51')][_0xaf2e('0x6a')];return db[_0xaf2e('0x6b')][_0xaf2e('0x5d')]({'where':{'id':_0x4bd629},'attributes':['id'],'include':[{'model':db[_0xaf2e('0x5e')],'as':'Agents','attributes':['id',_0xaf2e('0x31'),_0xaf2e('0x6c'),_0xaf2e('0x6d'),_0xaf2e('0x6e')],'raw':!![]}]})[_0xaf2e('0x2b')](function(_0x393aca){if(_0x393aca){var _0x39e4ca=_[_0xaf2e('0x6f')](_0x393aca,function(_0x1b2bc7){var _0x2c0d21=_0x1b2bc7[_0xaf2e('0x2d')]({'plain':!![]});return _0x2c0d21[_0xaf2e('0x70')];});return db['WhatsappQueue'][_0xaf2e('0x4f')]({'where':{'id':_0x2326a5[_0xaf2e('0x4c')]['id']}})[_0xaf2e('0x2b')](function(_0x38c8b3){return db[_0xaf2e('0x71')][_0xaf2e('0x72')](function(_0x1a566c){return _0x38c8b3['addTeams'](_0x4bd629,{'transaction':_0x1a566c})['then'](function(){return BPromise[_0xaf2e('0x73')](_0x39e4ca,function(_0x156073){return db['UserWhatsappQueue'][_0xaf2e('0x74')]({'where':{'UserId':_0x156073['id'],'WhatsappQueueId':_0x2326a5[_0xaf2e('0x4c')]['id']},'transaction':_0x1a566c});});})[_0xaf2e('0x2b')](function(){_0x39e4ca[_0xaf2e('0x75')](function(_0x1d5841){socket[_0xaf2e('0x76')]('userWhatsappQueue:save',{'UserId':_0x1d5841['id'],'WhatsappQueueId':_0x38c8b3['id']});});});});});}})['then'](respondWithStatusCode(_0x5b2ae1,null))[_0xaf2e('0x4a')](handleError(_0x5b2ae1,null));};exports[_0xaf2e('0x77')]=function(_0x4e10e0,_0x106e62,_0x66c7b2){return db[_0xaf2e('0x6b')][_0xaf2e('0x5d')]({'where':{'id':_0x4e10e0['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xaf2e('0x5e')],'as':_0xaf2e('0x70'),'attributes':['id'],'raw':!![]}]})[_0xaf2e('0x2b')](handleEntityNotFound(_0x106e62,null))[_0xaf2e('0x2b')](function(_0x3f62df){var _0x48a20a=_[_0xaf2e('0x34')](_0x3f62df,'id');var _0xfa1fca=[];var _0x22a33d=[];var _0x332d0e=squel[_0xaf2e('0x78')]();_0x332d0e[_0xaf2e('0x79')](_0xaf2e('0x7a'))[_0xaf2e('0x7b')](_0xaf2e('0x7c'),'tq')[_0xaf2e('0x7d')](_0xaf2e('0x7e'),'ut',_0xaf2e('0x7f'))[_0xaf2e('0x42')](_0xaf2e('0x80'),_0x4e10e0[_0xaf2e('0x4c')]['id']);for(var _0x452205=0x0;_0x452205<_0x3f62df[_0xaf2e('0x3e')];_0x452205+=0x1){let _0x3c819c=_0x3f62df[_0x452205];for(var _0x1f566d=0x0;_0x1f566d<_0x3c819c[_0xaf2e('0x70')][_0xaf2e('0x3e')];_0x1f566d+=0x1){let _0x33abd8=_0x3c819c[_0xaf2e('0x70')][_0x1f566d];var _0x5a97e0=_0x332d0e['clone']();_0x5a97e0[_0xaf2e('0x42')](_0xaf2e('0x81'),_0x33abd8['id']);_0x22a33d[_0xaf2e('0x82')](db[_0xaf2e('0x71')][_0xaf2e('0x38')](_0x5a97e0[_0xaf2e('0x83')](),{'type':db[_0xaf2e('0x71')][_0xaf2e('0x84')][_0xaf2e('0x85')]})[_0xaf2e('0x2b')](function(_0x5dde87){if(_0x5dde87[_0xaf2e('0x3e')]===0x1){return _0x33abd8['id'];}else{var _0x2de18b=_[_0xaf2e('0x86')](_['map'](_0x5dde87,_0xaf2e('0x87')),function(_0x1dfa9a){return _[_0xaf2e('0x88')](_0x48a20a,_0x1dfa9a);});if(_0x2de18b){return _0x33abd8['id'];}}}));}}return BPromise['all'](_0x22a33d)[_0xaf2e('0x2b')](function(_0x256f92){_0xfa1fca=_(_0xfa1fca)[_0xaf2e('0x89')](_0x256f92)[_0xaf2e('0x8a')]()['value']();return db['WhatsappQueue'][_0xaf2e('0x4f')]({'where':{'id':_0x4e10e0[_0xaf2e('0x4c')]['id']}})[_0xaf2e('0x2b')](function(_0x556143){return db[_0xaf2e('0x71')][_0xaf2e('0x72')](function(_0x408fb3){return _0x556143['removeTeams'](_0x4e10e0['query'][_0xaf2e('0x6a')],{'transaction':_0x408fb3})['then'](function(){if(!_[_0xaf2e('0x8b')](_0xfa1fca)){return _0x556143[_0xaf2e('0x8c')](_0xfa1fca,{'transaction':_0x408fb3});}})[_0xaf2e('0x2b')](function(){_0xfa1fca[_0xaf2e('0x75')](function(_0x218a83){socket['emit'](_0xaf2e('0x8d'),{'UserId':_0x218a83,'WhatsappQueueId':_0x556143['id']});});});});});});})['then'](respondWithStatusCode(_0x106e62,null))[_0xaf2e('0x4a')](handleError(_0x106e62,null));};exports[_0xaf2e('0x8e')]=function(_0x4c9368,_0x4e6476,_0x2c1428){return db[_0xaf2e('0x35')]['find']({'where':{'id':_0x4c9368[_0xaf2e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e6476,null))[_0xaf2e('0x2b')](function(_0x45fe91){if(_0x45fe91){return _0x45fe91[_0xaf2e('0x8e')](_0x4c9368[_0xaf2e('0x51')][_0xaf2e('0x6a')],_[_0xaf2e('0x8f')](_0x4c9368[_0xaf2e('0x51')],[_0xaf2e('0x6a'),'id'])||{})[_0xaf2e('0x90')](function(_0x5b86e2){for(var _0x1d4e95=0x0;_0x1d4e95<_0x4c9368[_0xaf2e('0x51')][_0xaf2e('0x6a')]['length'];_0x1d4e95+=0x1){socket[_0xaf2e('0x76')]('userWhatsappQueue:save',{'UserId':_0x4c9368['body']['ids'][_0x1d4e95],'WhatsappQueueId':_0x4c9368[_0xaf2e('0x4c')]['id']});}return _0x5b86e2;});}})['then'](respondWithResult(_0x4e6476,null))['catch'](handleError(_0x4e6476,null));};exports['removeAgents']=function(_0x29b6e4,_0x1750d6,_0x35bd12){return db[_0xaf2e('0x35')][_0xaf2e('0x4f')]({'where':{'id':_0x29b6e4[_0xaf2e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1750d6,null))[_0xaf2e('0x2b')](function(_0x544ad6){if(_0x544ad6){return _0x544ad6[_0xaf2e('0x8c')](_0x29b6e4['query'][_0xaf2e('0x6a')])[_0xaf2e('0x2b')](function(){if(_[_0xaf2e('0x91')](_0x29b6e4[_0xaf2e('0x38')][_0xaf2e('0x6a')])){for(var _0x5e1f53=0x0;_0x5e1f53<_0x29b6e4[_0xaf2e('0x38')]['ids']['length'];_0x5e1f53+=0x1){socket[_0xaf2e('0x76')](_0xaf2e('0x8d'),{'UserId':Number(_0x29b6e4[_0xaf2e('0x38')]['ids'][_0x5e1f53]),'WhatsappQueueId':Number(_0x29b6e4[_0xaf2e('0x4c')]['id'])});}}else{socket[_0xaf2e('0x76')]('userWhatsappQueue:remove',{'UserId':Number(_0x29b6e4[_0xaf2e('0x38')][_0xaf2e('0x6a')]),'WhatsappQueueId':Number(_0x29b6e4['params']['id'])});}});}})[_0xaf2e('0x2b')](respondWithStatusCode(_0x1750d6,null))['catch'](handleError(_0x1750d6,null));};exports[_0xaf2e('0x92')]=function(_0x11e939,_0x42be86,_0x51bbb6){var _0x1e7cd4={};var _0x1df07c={};var _0xa49175;var _0x41587a;return db[_0xaf2e('0x35')][_0xaf2e('0x59')]({'where':{'id':_0x11e939[_0xaf2e('0x4c')]['id']}})[_0xaf2e('0x2b')](handleEntityNotFound(_0x42be86,null))[_0xaf2e('0x2b')](function(_0x45fbd0){if(_0x45fbd0){_0xa49175=_0x45fbd0;_0x1df07c['model']=_[_0xaf2e('0x39')](db[_0xaf2e('0x5e')]['rawAttributes']);_0x1df07c['query']=_[_0xaf2e('0x39')](_0x11e939[_0xaf2e('0x38')]);_0x1df07c[_0xaf2e('0x3a')]=_[_0xaf2e('0x3c')](_0x1df07c[_0xaf2e('0x37')],_0x1df07c[_0xaf2e('0x38')]);_0x1e7cd4[_0xaf2e('0x3b')]=_[_0xaf2e('0x3c')](_0x1df07c['model'],qs[_0xaf2e('0x3d')](_0x11e939[_0xaf2e('0x38')]['fields']));_0x1e7cd4[_0xaf2e('0x3b')]=_0x1e7cd4[_0xaf2e('0x3b')][_0xaf2e('0x3e')]?_0x1e7cd4[_0xaf2e('0x3b')]:_0x1df07c[_0xaf2e('0x37')];_0x1e7cd4[_0xaf2e('0x40')]=qs[_0xaf2e('0x41')](_0x11e939[_0xaf2e('0x38')][_0xaf2e('0x41')]);_0x1e7cd4[_0xaf2e('0x42')]=qs[_0xaf2e('0x3a')](_[_0xaf2e('0x67')](_0x11e939[_0xaf2e('0x38')],_0x1df07c[_0xaf2e('0x3a')]));if(_0x11e939[_0xaf2e('0x38')][_0xaf2e('0x43')]){_0x1e7cd4[_0xaf2e('0x42')]=_[_0xaf2e('0x45')](_0x1e7cd4[_0xaf2e('0x42')],{'$or':_[_0xaf2e('0x34')](_0x1e7cd4['attributes'],function(_0x2a4934){var _0x4b6bed={};_0x4b6bed[_0x2a4934]={'$like':'%'+_0x11e939[_0xaf2e('0x38')][_0xaf2e('0x43')]+'%'};return _0x4b6bed;})});}_0x1e7cd4=_[_0xaf2e('0x45')]({},_0x1e7cd4,_0x11e939[_0xaf2e('0x46')]);return _0xa49175['getAgents'](_0x1e7cd4);}})['then'](function(_0x46c049){if(_0x46c049){_0x41587a=_0x46c049['length'];if(!_0x11e939['query']['hasOwnProperty']('nolimit')){_0x1e7cd4[_0xaf2e('0x25')]=qs[_0xaf2e('0x25')](_0x11e939[_0xaf2e('0x38')]['limit']);_0x1e7cd4[_0xaf2e('0x24')]=qs[_0xaf2e('0x24')](_0x11e939['query'][_0xaf2e('0x24')]);}return _0xa49175[_0xaf2e('0x92')](_0x1e7cd4);}})[_0xaf2e('0x2b')](function(_0x146885){if(_0x146885){return _0x146885?{'count':_0x41587a,'rows':_0x146885}:null;}})[_0xaf2e('0x2b')](respondWithResult(_0x42be86,null))[_0xaf2e('0x4a')](handleError(_0x42be86,null));}; \ No newline at end of file +var _0x395e=['SELECT','every','includes','all','union','compact','transaction','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','fast-json-patch','moment','bluebird','mustache','util','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','WhatsappQueue','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','findOne','hasOwnProperty','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','Team','Agents','voicePause','interface','flatMap','sequelize','each','UserWhatsappQueue','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x395e,0x9c));var _0xe395=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x395e[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xe395('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe395('0x1'));var rp=require('request-promise');var moment=require(_0xe395('0x2'));var BPromise=require(_0xe395('0x3'));var Mustache=require(_0xe395('0x4'));var util=require(_0xe395('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe395('0x6'));var ejs=require(_0xe395('0x7'));var fs=require('fs');var _=require(_0xe395('0x8'));var squel=require(_0xe395('0x9'));var crypto=require(_0xe395('0xa'));var jsforce=require(_0xe395('0xb'));var deskjs=require(_0xe395('0xc'));var toCsv=require(_0xe395('0x6'));var querystring=require(_0xe395('0xd'));var Papa=require(_0xe395('0xe'));var Redis=require(_0xe395('0xf'));var authService=require(_0xe395('0x10'));var qs=require(_0xe395('0x11'));var as=require(_0xe395('0x12'));var hardwareService=require(_0xe395('0x13'));var logger=require(_0xe395('0x14'))(_0xe395('0x15'));var utils=require(_0xe395('0x16'));var config=require(_0xe395('0x17'));var licenseUtil=require(_0xe395('0x18'));var db=require(_0xe395('0x19'))['db'];config[_0xe395('0x1a')]=_[_0xe395('0x1b')](config[_0xe395('0x1a')],{'host':_0xe395('0x1c'),'port':0x18eb});var socket=require(_0xe395('0x1d'))(new Redis(config[_0xe395('0x1a')]));require(_0xe395('0x1e'))[_0xe395('0x1f')](socket);function respondWithStatusCode(_0x10256d,_0xb9de0a){_0xb9de0a=_0xb9de0a||0xcc;return function(_0x2afc2c){if(_0x2afc2c){return _0x10256d['sendStatus'](_0xb9de0a);}return _0x10256d[_0xe395('0x20')](_0xb9de0a)[_0xe395('0x21')]();};}function respondWithResult(_0x3eb357,_0x496a4c){_0x496a4c=_0x496a4c||0xc8;return function(_0x39e0f8){if(_0x39e0f8){return _0x3eb357[_0xe395('0x20')](_0x496a4c)[_0xe395('0x22')](_0x39e0f8);}};}function respondWithFilteredResult(_0x2bc092,_0x308bbb){return function(_0xaad654){if(_0xaad654){var _0x2cfa49=_0xaad654[_0xe395('0x23')],_0x523330=_0x308bbb[_0xe395('0x24')],_0x59ac48=_0x308bbb[_0xe395('0x24')]+_0x308bbb[_0xe395('0x25')],_0x195eaf;if(_0x59ac48>=_0x2cfa49){_0x59ac48=_0x2cfa49;_0x195eaf=0xc8;}else{_0x195eaf=0xce;}_0x2bc092['status'](_0x195eaf);return _0x2bc092[_0xe395('0x26')](_0xe395('0x27'),_0x523330+'-'+_0x59ac48+'/'+_0x2cfa49)['json'](_0xaad654);}return null;};}function patchUpdates(_0x41eb76){return function(_0x2d1e10){try{jsonpatch[_0xe395('0x28')](_0x2d1e10,_0x41eb76,!![]);}catch(_0x1a60ad){return BPromise['reject'](_0x1a60ad);}return _0x2d1e10[_0xe395('0x29')]();};}function saveUpdates(_0x1718e3,_0x5801c4){return function(_0x3b0382){if(_0x3b0382){return _0x3b0382[_0xe395('0x2a')](_0x1718e3)[_0xe395('0x2b')](function(_0x5ba670){return _0x5ba670;});}return null;};}function removeEntity(_0x3a9aec,_0x10030b){return function(_0x499754){if(_0x499754){return _0x499754[_0xe395('0x2c')]()['then'](function(){var _0x233d92=_0x499754[_0xe395('0x2d')]({'plain':!![]});var _0x3fbeba='WhatsappQueues';return db[_0xe395('0x2e')][_0xe395('0x2c')]({'where':{'type':_0x3fbeba,'resourceId':_0x233d92['id']}})['then'](function(){return _0x499754;});})[_0xe395('0x2b')](function(){_0x3a9aec[_0xe395('0x20')](0xcc)[_0xe395('0x21')]();});}};}function handleEntityNotFound(_0x18f108,_0x3f2eac){return function(_0x16c945){if(!_0x16c945){_0x18f108['sendStatus'](0x194);}return _0x16c945;};}function handleError(_0x482831,_0x153ef9){_0x153ef9=_0x153ef9||0x1f4;return function(_0x1a133b){logger['error'](_0x1a133b[_0xe395('0x2f')]);if(_0x1a133b['name']){delete _0x1a133b[_0xe395('0x30')];}_0x482831[_0xe395('0x20')](_0x153ef9)['send'](_0x1a133b);};}exports[_0xe395('0x31')]=function(_0x12f619,_0x53840e){var _0x4b8481={},_0xfc1360={},_0x175fd9={'count':0x0,'rows':[]};var _0x462582=_[_0xe395('0x32')](db[_0xe395('0x33')]['rawAttributes'],function(_0x676b3d){return{'name':_0x676b3d['fieldName'],'type':_0x676b3d['type']['key']};});_0xfc1360['model']=_[_0xe395('0x32')](_0x462582,'name');_0xfc1360[_0xe395('0x34')]=_[_0xe395('0x35')](_0x12f619[_0xe395('0x34')]);_0xfc1360['filters']=_[_0xe395('0x36')](_0xfc1360[_0xe395('0x37')],_0xfc1360['query']);_0x4b8481['attributes']=_[_0xe395('0x36')](_0xfc1360['model'],qs['fields'](_0x12f619[_0xe395('0x34')][_0xe395('0x38')]));_0x4b8481['attributes']=_0x4b8481[_0xe395('0x39')][_0xe395('0x3a')]?_0x4b8481[_0xe395('0x39')]:_0xfc1360[_0xe395('0x37')];if(!_0x12f619[_0xe395('0x34')]['hasOwnProperty'](_0xe395('0x3b'))){_0x4b8481[_0xe395('0x25')]=qs[_0xe395('0x25')](_0x12f619['query'][_0xe395('0x25')]);_0x4b8481[_0xe395('0x24')]=qs['offset'](_0x12f619[_0xe395('0x34')][_0xe395('0x24')]);}_0x4b8481[_0xe395('0x3c')]=qs[_0xe395('0x3d')](_0x12f619[_0xe395('0x34')][_0xe395('0x3d')]);_0x4b8481[_0xe395('0x3e')]=qs[_0xe395('0x3f')](_['pick'](_0x12f619[_0xe395('0x34')],_0xfc1360['filters']),_0x462582);if(_0x12f619[_0xe395('0x34')][_0xe395('0x40')]){_0x4b8481[_0xe395('0x3e')]=_[_0xe395('0x41')](_0x4b8481['where'],{'$or':_[_0xe395('0x32')](_0x462582,function(_0x49fa3f){if(_0x49fa3f[_0xe395('0x42')]!==_0xe395('0x43')){var _0x41f695={};_0x41f695[_0x49fa3f[_0xe395('0x30')]]={'$like':'%'+_0x12f619[_0xe395('0x34')][_0xe395('0x40')]+'%'};return _0x41f695;}})});}_0x4b8481=_[_0xe395('0x41')]({},_0x4b8481,_0x12f619['options']);var _0x2bfbad={'where':_0x4b8481[_0xe395('0x3e')]};return db['WhatsappQueue'][_0xe395('0x23')](_0x2bfbad)[_0xe395('0x2b')](function(_0x4766e9){_0x175fd9['count']=_0x4766e9;if(_0x12f619[_0xe395('0x34')][_0xe395('0x44')]){_0x4b8481[_0xe395('0x45')]=[{'all':!![]}];}return db[_0xe395('0x33')][_0xe395('0x46')](_0x4b8481);})[_0xe395('0x2b')](function(_0x7da7eb){_0x175fd9[_0xe395('0x47')]=_0x7da7eb;return _0x175fd9;})[_0xe395('0x2b')](respondWithFilteredResult(_0x53840e,_0x4b8481))['catch'](handleError(_0x53840e,null));};exports[_0xe395('0x48')]=function(_0x41198c,_0x3eddb4){var _0x38e4bd={'raw':!![],'where':{'id':_0x41198c[_0xe395('0x49')]['id']}},_0xa91884={};_0xa91884[_0xe395('0x37')]=_[_0xe395('0x35')](db['WhatsappQueue'][_0xe395('0x4a')]);_0xa91884['query']=_['keys'](_0x41198c['query']);_0xa91884['filtears']=_['intersection'](_0xa91884[_0xe395('0x37')],_0xa91884[_0xe395('0x34')]);_0x38e4bd[_0xe395('0x39')]=_[_0xe395('0x36')](_0xa91884['model'],qs[_0xe395('0x38')](_0x41198c[_0xe395('0x34')][_0xe395('0x38')]));_0x38e4bd['attributes']=_0x38e4bd[_0xe395('0x39')]['length']?_0x38e4bd[_0xe395('0x39')]:_0xa91884['model'];if(_0x41198c[_0xe395('0x34')]['includeAll']){_0x38e4bd[_0xe395('0x45')]=[{'all':!![]}];}_0x38e4bd=_[_0xe395('0x41')]({},_0x38e4bd,_0x41198c[_0xe395('0x4b')]);return db[_0xe395('0x33')]['find'](_0x38e4bd)[_0xe395('0x2b')](handleEntityNotFound(_0x3eddb4,null))['then'](respondWithResult(_0x3eddb4,null))[_0xe395('0x4c')](handleError(_0x3eddb4,null));};exports[_0xe395('0x4d')]=function(_0x81f495,_0x122dd2){return db['WhatsappQueue'][_0xe395('0x4d')](_0x81f495['body'],{})['then'](function(_0xd99f96){var _0x1eb7e3=_0x81f495[_0xe395('0x4e')][_0xe395('0x2d')]({'plain':!![]});if(!_0x1eb7e3)throw new Error(_0xe395('0x4f'));if(_0x1eb7e3[_0xe395('0x50')]===_0xe395('0x4e')){var _0x470fb7=_0xd99f96[_0xe395('0x2d')]({'plain':!![]});var _0x4c57d9=_0xe395('0x51');return db[_0xe395('0x52')]['find']({'where':{'name':_0x4c57d9,'userProfileId':_0x1eb7e3[_0xe395('0x53')]},'raw':!![]})['then'](function(_0x157cc1){if(_0x157cc1&&_0x157cc1[_0xe395('0x54')]===0x0){return db[_0xe395('0x2e')][_0xe395('0x4d')]({'name':_0x470fb7[_0xe395('0x30')],'resourceId':_0x470fb7['id'],'type':_0x157cc1[_0xe395('0x30')],'sectionId':_0x157cc1['id']},{})['then'](function(){return _0xd99f96;});}else{return _0xd99f96;}})[_0xe395('0x4c')](function(_0x534990){logger[_0xe395('0x55')](_0xe395('0x56'),_0x534990);throw _0x534990;});}return _0xd99f96;})['then'](respondWithResult(_0x122dd2,0xc9))[_0xe395('0x4c')](handleError(_0x122dd2,null));};exports['update']=function(_0x14993f,_0x56ce78){if(_0x14993f[_0xe395('0x57')]['id']){delete _0x14993f[_0xe395('0x57')]['id'];}return db['WhatsappQueue'][_0xe395('0x58')]({'where':{'id':_0x14993f[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x56ce78,null))['then'](saveUpdates(_0x14993f[_0xe395('0x57')],null))[_0xe395('0x2b')](respondWithResult(_0x56ce78,null))['catch'](handleError(_0x56ce78,null));};exports[_0xe395('0x2c')]=function(_0x3a30fa,_0x377861){return db[_0xe395('0x33')][_0xe395('0x58')]({'where':{'id':_0x3a30fa['params']['id']}})['then'](handleEntityNotFound(_0x377861,null))['then'](removeEntity(_0x377861,null))[_0xe395('0x4c')](handleError(_0x377861,null));};exports[_0xe395('0x59')]=function(_0x19aa34,_0x39b32d){return db[_0xe395('0x33')][_0xe395('0x59')]()[_0xe395('0x2b')](respondWithResult(_0x39b32d,null))['catch'](handleError(_0x39b32d,null));};exports['getMembers']=function(_0x1d9146,_0x31bbff,_0x313bbb){var _0x12ffc2={'raw':!![],'where':{}},_0x3311e0={},_0x446c05;return db['WhatsappQueue'][_0xe395('0x5a')]({'where':{'id':_0x1d9146[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x31bbff,null))[_0xe395('0x2b')](function(_0x337bcc){if(_0x337bcc){_0x446c05=_0x337bcc[_0xe395('0x2d')]({'plain':!![]});_0x3311e0[_0xe395('0x37')]=_[_0xe395('0x35')](db['UserWhatsappQueue'][_0xe395('0x4a')]);_0x3311e0[_0xe395('0x34')]=_[_0xe395('0x35')](_0x1d9146[_0xe395('0x34')]);_0x3311e0['filters']=_[_0xe395('0x36')](_0x3311e0['model'],_0x3311e0[_0xe395('0x34')]);_0x12ffc2[_0xe395('0x39')]=_['intersection'](_0x3311e0[_0xe395('0x37')],qs[_0xe395('0x38')](_0x1d9146[_0xe395('0x34')]['fields']));_0x12ffc2[_0xe395('0x39')]=_0x12ffc2['attributes'][_0xe395('0x3a')]?_0x12ffc2[_0xe395('0x39')]:_0x3311e0['model'];if(!_0x1d9146[_0xe395('0x34')][_0xe395('0x5b')](_0xe395('0x3b'))){_0x12ffc2['limit']=qs[_0xe395('0x25')](_0x1d9146[_0xe395('0x34')][_0xe395('0x25')]);_0x12ffc2[_0xe395('0x24')]=qs[_0xe395('0x24')](_0x1d9146['query'][_0xe395('0x24')]);}_0x12ffc2[_0xe395('0x3c')]=qs[_0xe395('0x3d')](_0x1d9146[_0xe395('0x34')]['sort']);_0x12ffc2['where']=qs[_0xe395('0x3f')](_[_0xe395('0x5c')](_0x1d9146['query'],_0x3311e0[_0xe395('0x3f')]));_0x12ffc2[_0xe395('0x3e')][_0xe395('0x5d')]=_0x337bcc['id'];if(_0x1d9146['query'][_0xe395('0x40')]){_0x12ffc2[_0xe395('0x3e')]=_[_0xe395('0x41')](_0x12ffc2[_0xe395('0x3e')],{'$or':_['map'](_0x12ffc2[_0xe395('0x39')],function(_0x31b779){var _0x4ec83b={};_0x4ec83b[_0x31b779]={'$like':'%'+_0x1d9146['query'][_0xe395('0x40')]+'%'};return _0x4ec83b;})});}_0x12ffc2=_[_0xe395('0x41')]({},_0x12ffc2,_0x1d9146['options']);return db['UserWhatsappQueue']['findAll'](_0x12ffc2);}})[_0xe395('0x2b')](function(_0x5dde8d){if(_0x5dde8d){return db[_0xe395('0x5e')][_0xe395('0x5f')]({'where':{'id':_['map'](_0x5dde8d,_0xe395('0x60')),'role':_0xe395('0x61')},'attributes':['id',_0xe395('0x30'),'whatsappPause',_0xe395('0x62'),_0xe395('0x63')]});}})[_0xe395('0x2b')](function(_0x486289){if(_0x486289){return{'count':_0x486289[_0xe395('0x23')],'rows':_[_0xe395('0x32')](_0x486289[_0xe395('0x47')],function(_0x5974f0){return{'membername':_0x5974f0['name'],'UserId':_0x5974f0['id'],'queue_name':_0x446c05[_0xe395('0x30')],'WhatsappQueueId':_0x446c05['id'],'interface':util['format'](_0xe395('0x64'),_0xe395('0x65'),_0x5974f0[_0xe395('0x30')]),'penalty':0x0,'paused':_0x5974f0['whatsappPause'],'createdAt':_0x5974f0[_0xe395('0x63')],'updatedAt':_0x5974f0[_0xe395('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe395('0x2b')](respondWithFilteredResult(_0x31bbff,_0x12ffc2))[_0xe395('0x4c')](handleError(_0x31bbff,null));};exports[_0xe395('0x66')]=function(_0x118e48,_0x4b06ec,_0x45bdc3){var _0x4a19d5={};var _0x45b89d={};var _0x1e134e;var _0x136ba9;return db[_0xe395('0x33')]['findOne']({'where':{'id':_0x118e48[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x4b06ec,null))[_0xe395('0x2b')](function(_0x2d88c3){if(_0x2d88c3){_0x1e134e=_0x2d88c3;_0x45b89d[_0xe395('0x37')]=_['keys'](db['Team'][_0xe395('0x4a')]);_0x45b89d['query']=_[_0xe395('0x35')](_0x118e48[_0xe395('0x34')]);_0x45b89d[_0xe395('0x3f')]=_[_0xe395('0x36')](_0x45b89d[_0xe395('0x37')],_0x45b89d[_0xe395('0x34')]);_0x4a19d5[_0xe395('0x39')]=_[_0xe395('0x36')](_0x45b89d[_0xe395('0x37')],qs[_0xe395('0x38')](_0x118e48[_0xe395('0x34')]['fields']));_0x4a19d5[_0xe395('0x39')]=_0x4a19d5[_0xe395('0x39')][_0xe395('0x3a')]?_0x4a19d5[_0xe395('0x39')]:_0x45b89d['model'];_0x4a19d5[_0xe395('0x3c')]=qs['sort'](_0x118e48[_0xe395('0x34')][_0xe395('0x3d')]);_0x4a19d5['where']=qs[_0xe395('0x3f')](_[_0xe395('0x5c')](_0x118e48[_0xe395('0x34')],_0x45b89d['filters']));if(_0x118e48[_0xe395('0x34')][_0xe395('0x40')]){_0x4a19d5[_0xe395('0x3e')]=_['merge'](_0x4a19d5[_0xe395('0x3e')],{'$or':_['map'](_0x4a19d5[_0xe395('0x39')],function(_0x3c68f2){var _0x500b01={};_0x500b01[_0x3c68f2]={'$like':'%'+_0x118e48[_0xe395('0x34')][_0xe395('0x40')]+'%'};return _0x500b01;})});}_0x4a19d5=_[_0xe395('0x41')]({},_0x4a19d5,_0x118e48['options']);return _0x1e134e['getTeams'](_0x4a19d5);}})[_0xe395('0x2b')](function(_0x38fd1d){if(_0x38fd1d){_0x136ba9=_0x38fd1d['length'];if(!_0x118e48[_0xe395('0x34')][_0xe395('0x5b')](_0xe395('0x3b'))){_0x4a19d5[_0xe395('0x25')]=qs[_0xe395('0x25')](_0x118e48[_0xe395('0x34')]['limit']);_0x4a19d5[_0xe395('0x24')]=qs[_0xe395('0x24')](_0x118e48['query']['offset']);}return _0x1e134e['getTeams'](_0x4a19d5);}})[_0xe395('0x2b')](function(_0x3bad70){if(_0x3bad70){return _0x3bad70?{'count':_0x136ba9,'rows':_0x3bad70}:null;}})[_0xe395('0x2b')](respondWithResult(_0x4b06ec,null))['catch'](handleError(_0x4b06ec,null));};exports[_0xe395('0x67')]=function(_0x40b868,_0x3a28ef,_0x18ab11){var _0x45ca89=_0x40b868[_0xe395('0x57')]['ids'];return db[_0xe395('0x68')]['findAll']({'where':{'id':_0x45ca89},'attributes':['id'],'include':[{'model':db[_0xe395('0x5e')],'as':_0xe395('0x69'),'attributes':['id','name','online',_0xe395('0x6a'),_0xe395('0x6b')],'raw':!![]}]})[_0xe395('0x2b')](function(_0x4a1e8a){if(_0x4a1e8a){var _0x262da7=_[_0xe395('0x6c')](_0x4a1e8a,function(_0x36e029){var _0x35fb72=_0x36e029[_0xe395('0x2d')]({'plain':!![]});return _0x35fb72['Agents'];});return db[_0xe395('0x33')]['find']({'where':{'id':_0x40b868[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](function(_0x3e5d48){return db[_0xe395('0x6d')]['transaction'](function(_0x523959){return _0x3e5d48[_0xe395('0x67')](_0x45ca89,{'transaction':_0x523959})['then'](function(){return BPromise[_0xe395('0x6e')](_0x262da7,function(_0x291fbd){return db[_0xe395('0x6f')][_0xe395('0x70')]({'where':{'UserId':_0x291fbd['id'],'WhatsappQueueId':_0x40b868[_0xe395('0x49')]['id']},'transaction':_0x523959});});})['then'](function(){_0x262da7[_0xe395('0x71')](function(_0xe21ab){socket[_0xe395('0x72')](_0xe395('0x73'),{'UserId':_0xe21ab['id'],'WhatsappQueueId':_0x3e5d48['id']});});});});});}})[_0xe395('0x2b')](respondWithStatusCode(_0x3a28ef,null))[_0xe395('0x4c')](handleError(_0x3a28ef,null));};exports[_0xe395('0x74')]=function(_0x8bb2c8,_0x2559c5,_0x381155){return db[_0xe395('0x68')][_0xe395('0x46')]({'where':{'id':_0x8bb2c8[_0xe395('0x34')][_0xe395('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe395('0x5e')],'as':_0xe395('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2559c5,null))[_0xe395('0x2b')](function(_0x288beb){var _0x151ec1=_['map'](_0x288beb,'id');var _0x5c0e8e=[];var _0x16f696=[];var _0x312d99=squel[_0xe395('0x76')]();_0x312d99[_0xe395('0x77')](_0xe395('0x78'))['from'](_0xe395('0x79'),'tq')[_0xe395('0x7a')](_0xe395('0x7b'),'ut',_0xe395('0x7c'))[_0xe395('0x3e')]('WhatsappQueueId\x20=\x20?',_0x8bb2c8[_0xe395('0x49')]['id']);for(var _0x49dad3=0x0;_0x49dad3<_0x288beb[_0xe395('0x3a')];_0x49dad3+=0x1){let _0x13c58b=_0x288beb[_0x49dad3];for(var _0x213c39=0x0;_0x213c39<_0x13c58b[_0xe395('0x69')][_0xe395('0x3a')];_0x213c39+=0x1){let _0x11b337=_0x13c58b[_0xe395('0x69')][_0x213c39];var _0x384712=_0x312d99[_0xe395('0x7d')]();_0x384712[_0xe395('0x3e')](_0xe395('0x7e'),_0x11b337['id']);_0x16f696['push'](db['sequelize']['query'](_0x384712['toString'](),{'type':db['sequelize'][_0xe395('0x7f')][_0xe395('0x80')]})[_0xe395('0x2b')](function(_0x5aa7b3){if(_0x5aa7b3[_0xe395('0x3a')]===0x1){return _0x11b337['id'];}else{var _0x173c0c=_[_0xe395('0x81')](_[_0xe395('0x32')](_0x5aa7b3,'TeamId'),function(_0x2138d3){return _[_0xe395('0x82')](_0x151ec1,_0x2138d3);});if(_0x173c0c){return _0x11b337['id'];}}}));}}return BPromise[_0xe395('0x83')](_0x16f696)[_0xe395('0x2b')](function(_0x294305){_0x5c0e8e=_(_0x5c0e8e)[_0xe395('0x84')](_0x294305)[_0xe395('0x85')]()['value']();return db[_0xe395('0x33')][_0xe395('0x58')]({'where':{'id':_0x8bb2c8['params']['id']}})[_0xe395('0x2b')](function(_0x1f7261){return db[_0xe395('0x6d')][_0xe395('0x86')](function(_0x5c1e8f){return _0x1f7261[_0xe395('0x74')](_0x8bb2c8[_0xe395('0x34')]['ids'],{'transaction':_0x5c1e8f})['then'](function(){if(!_['isEmpty'](_0x5c0e8e)){return _0x1f7261[_0xe395('0x87')](_0x5c0e8e,{'transaction':_0x5c1e8f});}})[_0xe395('0x2b')](function(){_0x5c0e8e[_0xe395('0x71')](function(_0x20e450){socket[_0xe395('0x72')](_0xe395('0x88'),{'UserId':_0x20e450,'WhatsappQueueId':_0x1f7261['id']});});});});});});})[_0xe395('0x2b')](respondWithStatusCode(_0x2559c5,null))[_0xe395('0x4c')](handleError(_0x2559c5,null));};exports[_0xe395('0x89')]=function(_0x109cc5,_0x28beb1,_0x2c592f){return db[_0xe395('0x33')][_0xe395('0x58')]({'where':{'id':_0x109cc5[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x28beb1,null))[_0xe395('0x2b')](function(_0x40510a){if(_0x40510a){return _0x40510a[_0xe395('0x89')](_0x109cc5[_0xe395('0x57')]['ids'],_[_0xe395('0x8a')](_0x109cc5[_0xe395('0x57')],[_0xe395('0x75'),'id'])||{})[_0xe395('0x8b')](function(_0x39c844){for(var _0x4a43db=0x0;_0x4a43db<_0x109cc5[_0xe395('0x57')][_0xe395('0x75')][_0xe395('0x3a')];_0x4a43db+=0x1){socket[_0xe395('0x72')](_0xe395('0x73'),{'UserId':_0x109cc5[_0xe395('0x57')][_0xe395('0x75')][_0x4a43db],'WhatsappQueueId':_0x109cc5[_0xe395('0x49')]['id']});}return _0x39c844;});}})[_0xe395('0x2b')](respondWithResult(_0x28beb1,null))['catch'](handleError(_0x28beb1,null));};exports[_0xe395('0x87')]=function(_0x3633fd,_0x23a056,_0x91778){return db[_0xe395('0x33')][_0xe395('0x58')]({'where':{'id':_0x3633fd[_0xe395('0x49')]['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x23a056,null))[_0xe395('0x2b')](function(_0x184043){if(_0x184043){return _0x184043[_0xe395('0x87')](_0x3633fd[_0xe395('0x34')][_0xe395('0x75')])[_0xe395('0x2b')](function(){if(_[_0xe395('0x8c')](_0x3633fd[_0xe395('0x34')]['ids'])){for(var _0x5ec514=0x0;_0x5ec514<_0x3633fd[_0xe395('0x34')][_0xe395('0x75')]['length'];_0x5ec514+=0x1){socket[_0xe395('0x72')](_0xe395('0x88'),{'UserId':Number(_0x3633fd[_0xe395('0x34')][_0xe395('0x75')][_0x5ec514]),'WhatsappQueueId':Number(_0x3633fd[_0xe395('0x49')]['id'])});}}else{socket[_0xe395('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x3633fd[_0xe395('0x34')][_0xe395('0x75')]),'WhatsappQueueId':Number(_0x3633fd['params']['id'])});}});}})[_0xe395('0x2b')](respondWithStatusCode(_0x23a056,null))[_0xe395('0x4c')](handleError(_0x23a056,null));};exports[_0xe395('0x8d')]=function(_0x53e83e,_0x376c0a,_0x5be420){var _0x2141de={};var _0x1e7c38={};var _0x1260d0;var _0x42915c;return db[_0xe395('0x33')][_0xe395('0x5a')]({'where':{'id':_0x53e83e['params']['id']}})[_0xe395('0x2b')](handleEntityNotFound(_0x376c0a,null))[_0xe395('0x2b')](function(_0x3bf4b0){if(_0x3bf4b0){_0x1260d0=_0x3bf4b0;_0x1e7c38[_0xe395('0x37')]=_[_0xe395('0x35')](db[_0xe395('0x5e')][_0xe395('0x4a')]);_0x1e7c38[_0xe395('0x34')]=_[_0xe395('0x35')](_0x53e83e[_0xe395('0x34')]);_0x1e7c38['filters']=_['intersection'](_0x1e7c38['model'],_0x1e7c38[_0xe395('0x34')]);_0x2141de[_0xe395('0x39')]=_[_0xe395('0x36')](_0x1e7c38[_0xe395('0x37')],qs[_0xe395('0x38')](_0x53e83e[_0xe395('0x34')][_0xe395('0x38')]));_0x2141de[_0xe395('0x39')]=_0x2141de[_0xe395('0x39')][_0xe395('0x3a')]?_0x2141de[_0xe395('0x39')]:_0x1e7c38[_0xe395('0x37')];_0x2141de[_0xe395('0x3c')]=qs[_0xe395('0x3d')](_0x53e83e[_0xe395('0x34')][_0xe395('0x3d')]);_0x2141de[_0xe395('0x3e')]=qs[_0xe395('0x3f')](_['pick'](_0x53e83e['query'],_0x1e7c38['filters']));if(_0x53e83e['query'][_0xe395('0x40')]){_0x2141de[_0xe395('0x3e')]=_[_0xe395('0x41')](_0x2141de['where'],{'$or':_['map'](_0x2141de[_0xe395('0x39')],function(_0x49f85a){var _0x783532={};_0x783532[_0x49f85a]={'$like':'%'+_0x53e83e[_0xe395('0x34')]['filter']+'%'};return _0x783532;})});}_0x2141de=_[_0xe395('0x41')]({},_0x2141de,_0x53e83e[_0xe395('0x4b')]);return _0x1260d0['getAgents'](_0x2141de);}})[_0xe395('0x2b')](function(_0x37a197){if(_0x37a197){_0x42915c=_0x37a197[_0xe395('0x3a')];if(!_0x53e83e[_0xe395('0x34')][_0xe395('0x5b')](_0xe395('0x3b'))){_0x2141de[_0xe395('0x25')]=qs['limit'](_0x53e83e[_0xe395('0x34')][_0xe395('0x25')]);_0x2141de[_0xe395('0x24')]=qs[_0xe395('0x24')](_0x53e83e[_0xe395('0x34')]['offset']);}return _0x1260d0[_0xe395('0x8d')](_0x2141de);}})['then'](function(_0x28d878){if(_0x28d878){return _0x28d878?{'count':_0x42915c,'rows':_0x28d878}:null;}})['then'](respondWithResult(_0x376c0a,null))[_0xe395('0x4c')](handleError(_0x376c0a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d8e276c..2e81052 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 _0xd7c7=['WhatsappQueue','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x37900c,_0x1a8a9a){var _0x4e5da1=function(_0x55ae81){while(--_0x55ae81){_0x37900c['push'](_0x37900c['shift']());}};_0x4e5da1(++_0x1a8a9a);}(_0xd7c7,0x73));var _0x7d7c=function(_0x54e7ef,_0x5c58a4){_0x54e7ef=_0x54e7ef-0x0;var _0xd859a9=_0xd7c7[_0x54e7ef];return _0xd859a9;};'use strict';var EventEmitter=require(_0x7d7c('0x0'));var WhatsappQueue=require(_0x7d7c('0x1'))['db'][_0x7d7c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7d7c('0x3'),'afterUpdate':_0x7d7c('0x4'),'afterDestroy':_0x7d7c('0x5')};function emitEvent(_0x21e3cc){return function(_0x353e2f,_0x2038d1,_0x4b1699){WhatsappQueueEvents[_0x7d7c('0x6')](_0x21e3cc+':'+_0x353e2f['id'],_0x353e2f);WhatsappQueueEvents['emit'](_0x21e3cc,_0x353e2f);_0x4b1699(null);};}for(var e in events){if(events[_0x7d7c('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x7d7c('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xfa85=['WhatsappQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20229e,_0xa59f8a){var _0x317377=function(_0x290697){while(--_0x290697){_0x20229e['push'](_0x20229e['shift']());}};_0x317377(++_0xa59f8a);}(_0xfa85,0x8f));var _0x5fa8=function(_0x368fb3,_0x35e32f){_0x368fb3=_0x368fb3-0x0;var _0x23deda=_0xfa85[_0x368fb3];return _0x23deda;};'use strict';var EventEmitter=require(_0x5fa8('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5fa8('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fa8('0x2'),'afterUpdate':_0x5fa8('0x3'),'afterDestroy':_0x5fa8('0x4')};function emitEvent(_0x105bc7){return function(_0x1439c4,_0x1d28a9,_0x1efc98){WhatsappQueueEvents['emit'](_0x105bc7+':'+_0x1439c4['id'],_0x1439c4);WhatsappQueueEvents[_0x5fa8('0x5')](_0x105bc7,_0x1439c4);_0x1efc98(null);};}for(var e in events){if(events[_0x5fa8('0x6')](e)){var event=events[e];WhatsappQueue[_0x5fa8('0x7')](e,emitEvent(event));}}module[_0x5fa8('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 c3109d6..fe5bc61 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 _0x265b=['request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueue','lodash','moment','bluebird'];(function(_0x514eb2,_0x158b2d){var _0x188ed2=function(_0x55aba5){while(--_0x55aba5){_0x514eb2['push'](_0x514eb2['shift']());}};_0x188ed2(++_0x158b2d);}(_0x265b,0x93));var _0xb265=function(_0xe8693f,_0x4256e8){_0xe8693f=_0xe8693f-0x0;var _0x4b8e29=_0x265b[_0xe8693f];return _0x4b8e29;};'use strict';var _=require(_0xb265('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb265('0x1'));var BPromise=require(_0xb265('0x2'));var rp=require(_0xb265('0x3'));var fs=require('fs');var path=require(_0xb265('0x4'));var rimraf=require(_0xb265('0x5'));var config=require(_0xb265('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xb265('0x7')]=function(_0x4f124e,_0x2d1d82){return _0x4f124e[_0xb265('0x8')](_0xb265('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea95=['api','moment','bluebird','path','../../config/environment','define','WhatsappQueue','whatsapp_queues','util','../../config/logger'];(function(_0x47ba2d,_0x22f032){var _0xb4221c=function(_0x4eba76){while(--_0x4eba76){_0x47ba2d['push'](_0x47ba2d['shift']());}};_0xb4221c(++_0x22f032);}(_0xea95,0x1f2));var _0x5ea9=function(_0x543221,_0x4fada6){_0x543221=_0x543221-0x0;var _0x4f54e5=_0xea95[_0x543221];return _0x4f54e5;};'use strict';var _=require('lodash');var util=require(_0x5ea9('0x0'));var logger=require(_0x5ea9('0x1'))(_0x5ea9('0x2'));var moment=require(_0x5ea9('0x3'));var BPromise=require(_0x5ea9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ea9('0x5'));var rimraf=require('rimraf');var config=require(_0x5ea9('0x6'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x4a2e50,_0x1e7770){return _0x4a2e50[_0x5ea9('0x7')](_0x5ea9('0x8'),attributes,{'tableName':_0x5ea9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 59ef41b..e11fb34 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 _0x7433=['ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetWhatsappQueue','options','raw','where','attributes','limit','include','map','model','info','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','randomstring'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7433,0xe0));var _0x3743=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x7433[_0x595bd1];return _0xd0344f;};'use strict';var _=require(_0x3743('0x0'));var util=require('util');var moment=require(_0x3743('0x1'));var BPromise=require(_0x3743('0x2'));var rs=require(_0x3743('0x3'));var fs=require('fs');var Redis=require(_0x3743('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3743('0x5'));var logger=require(_0x3743('0x6'))(_0x3743('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3743('0x8')][_0x3743('0x9')]({'port':0x232a});config[_0x3743('0xa')]=_[_0x3743('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3743('0xc'))(new Redis(config[_0x3743('0xa')]));require(_0x3743('0xd'))['register'](socket);function respondWithRpcPromise(_0x5a33d2,_0x46f8ce,_0x3bfce7){return new BPromise(function(_0x5846b8,_0x4f61be){return client[_0x3743('0xe')](_0x5a33d2,_0x3bfce7)[_0x3743('0xf')](function(_0x13004e){logger['info'](_0x3743('0x10'),_0x46f8ce,_0x3743('0x11'));logger[_0x3743('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x46f8ce,_0x3743('0x11'),JSON[_0x3743('0x13')](_0x13004e));if(_0x13004e[_0x3743('0x14')]){if(_0x13004e[_0x3743('0x14')][_0x3743('0x15')]===0x1f4){logger[_0x3743('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x46f8ce,_0x13004e[_0x3743('0x14')]['message']);return _0x4f61be(_0x13004e[_0x3743('0x14')]['message']);}logger[_0x3743('0x14')](_0x3743('0x10'),_0x46f8ce,_0x13004e[_0x3743('0x14')][_0x3743('0x16')]);return _0x5846b8(_0x13004e[_0x3743('0x14')][_0x3743('0x16')]);}else{logger['info'](_0x3743('0x10'),_0x46f8ce,_0x3743('0x11'));_0x5846b8(_0x13004e[_0x3743('0x17')]['message']);}})[_0x3743('0x18')](function(_0x39f8d0){logger[_0x3743('0x14')](_0x3743('0x10'),_0x46f8ce,_0x39f8d0);_0x4f61be(_0x39f8d0);});});}exports[_0x3743('0x19')]=function(_0x9c938d){var _0xb45992=this;return new Promise(function(_0x21ff42,_0x5020d0){return db['WhatsappQueue']['findAll']({'raw':_0x9c938d['options']?_0x9c938d[_0x3743('0x1a')][_0x3743('0x1b')]===undefined?!![]:![]:!![],'where':_0x9c938d['options']?_0x9c938d[_0x3743('0x1a')][_0x3743('0x1c')]||null:null,'attributes':_0x9c938d[_0x3743('0x1a')]?_0x9c938d['options'][_0x3743('0x1d')]||null:null,'limit':_0x9c938d[_0x3743('0x1a')]?_0x9c938d[_0x3743('0x1a')][_0x3743('0x1e')]||null:null,'include':_0x9c938d[_0x3743('0x1a')]?_0x9c938d[_0x3743('0x1a')][_0x3743('0x1f')]?_[_0x3743('0x20')](_0x9c938d[_0x3743('0x1a')]['include'],function(_0x532005){return{'model':db[_0x532005[_0x3743('0x21')]],'as':_0x532005['as'],'attributes':_0x532005[_0x3743('0x1d')],'include':_0x532005['include']?_[_0x3743('0x20')](_0x532005[_0x3743('0x1f')],function(_0x342477){return{'model':db[_0x342477[_0x3743('0x21')]],'as':_0x342477['as'],'attributes':_0x342477[_0x3743('0x1d')],'include':_0x342477[_0x3743('0x1f')]?_['map'](_0x342477[_0x3743('0x1f')],function(_0x3efcb0){return{'model':db[_0x3efcb0['model']],'as':_0x3efcb0['as'],'attributes':_0x3efcb0[_0x3743('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2924d3){logger[_0x3743('0x22')](_0x3743('0x19'),_0x9c938d);logger[_0x3743('0x12')](_0x3743('0x19'),_0x9c938d,JSON['stringify'](_0x2924d3));_0x21ff42(_0x2924d3);})['catch'](function(_0x4fc41e){logger['error'](_0x3743('0x19'),_0x4fc41e[_0x3743('0x16')],_0x9c938d);_0x5020d0(_0xb45992[_0x3743('0x14')](0x1f4,_0x4fc41e[_0x3743('0x16')]));});});};exports[_0x3743('0x23')]=function(_0x37dd58){var _0x58e1b3=this;return new Promise(function(_0x4c1c2f,_0x2775e1){return db[_0x3743('0x24')][_0x3743('0x25')]({'raw':_0x37dd58[_0x3743('0x1a')]?_0x37dd58[_0x3743('0x1a')][_0x3743('0x1b')]===undefined?!![]:![]:!![],'where':_0x37dd58[_0x3743('0x1a')]?_0x37dd58[_0x3743('0x1a')][_0x3743('0x1c')]||null:null,'attributes':_0x37dd58['options']?_0x37dd58[_0x3743('0x1a')][_0x3743('0x1d')]||null:null,'include':_0x37dd58['options']?_0x37dd58[_0x3743('0x1a')][_0x3743('0x1f')]?_[_0x3743('0x20')](_0x37dd58[_0x3743('0x1a')][_0x3743('0x1f')],function(_0x317a1e){return{'model':db[_0x317a1e[_0x3743('0x21')]],'as':_0x317a1e['as'],'attributes':_0x317a1e[_0x3743('0x1d')],'include':_0x317a1e[_0x3743('0x1f')]?_['map'](_0x317a1e[_0x3743('0x1f')],function(_0x580a2c){return{'model':db[_0x580a2c[_0x3743('0x21')]],'as':_0x580a2c['as'],'attributes':_0x580a2c['attributes'],'include':_0x580a2c[_0x3743('0x1f')]?_[_0x3743('0x20')](_0x580a2c[_0x3743('0x1f')],function(_0x4ce367){return{'model':db[_0x4ce367[_0x3743('0x21')]],'as':_0x4ce367['as'],'attributes':_0x4ce367[_0x3743('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3743('0xf')](function(_0x2c0711){logger[_0x3743('0x22')](_0x3743('0x23'),_0x37dd58);logger['debug'](_0x3743('0x23'),_0x37dd58,JSON[_0x3743('0x13')](_0x2c0711));_0x4c1c2f(_0x2c0711);})[_0x3743('0x18')](function(_0x4d1f54){logger[_0x3743('0x14')](_0x3743('0x23'),_0x4d1f54['message'],_0x37dd58);_0x2775e1(_0x58e1b3[_0x3743('0x14')](0x1f4,_0x4d1f54[_0x3743('0x16')]));});});}; \ No newline at end of file +var _0xcda5=['error','code','message','info','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','attributes','model','then','catch','ShowWhatsappQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x41d552,_0x1e59db){var _0x45d056=function(_0x2813de){while(--_0x2813de){_0x41d552['push'](_0x41d552['shift']());}};_0x45d056(++_0x1e59db);}(_0xcda5,0x124));var _0x5cda=function(_0x2b422d,_0x537807){_0x2b422d=_0x2b422d-0x0;var _0x2a6785=_0xcda5[_0x2b422d];return _0x2a6785;};'use strict';var _=require(_0x5cda('0x0'));var util=require(_0x5cda('0x1'));var moment=require(_0x5cda('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cda('0x4'))['db'];var utils=require(_0x5cda('0x5'));var logger=require('../../config/logger')(_0x5cda('0x6'));var config=require('../../config/environment');var jayson=require(_0x5cda('0x7'));var client=jayson['client'][_0x5cda('0x8')]({'port':0x232a});config[_0x5cda('0x9')]=_[_0x5cda('0xa')](config[_0x5cda('0x9')],{'host':_0x5cda('0xb'),'port':0x18eb});var socket=require(_0x5cda('0xc'))(new Redis(config[_0x5cda('0x9')]));require(_0x5cda('0xd'))[_0x5cda('0xe')](socket);function respondWithRpcPromise(_0x21b761,_0x21b973,_0x43aacb){return new BPromise(function(_0x2f7859,_0x3392){return client[_0x5cda('0xf')](_0x21b761,_0x43aacb)['then'](function(_0x1eaae0){logger['info'](_0x5cda('0x10'),_0x21b973,_0x5cda('0x11'));logger[_0x5cda('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x21b973,_0x5cda('0x11'),JSON[_0x5cda('0x13')](_0x1eaae0));if(_0x1eaae0[_0x5cda('0x14')]){if(_0x1eaae0[_0x5cda('0x14')][_0x5cda('0x15')]===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x21b973,_0x1eaae0[_0x5cda('0x14')]['message']);return _0x3392(_0x1eaae0[_0x5cda('0x14')][_0x5cda('0x16')]);}logger[_0x5cda('0x14')](_0x5cda('0x10'),_0x21b973,_0x1eaae0[_0x5cda('0x14')][_0x5cda('0x16')]);return _0x2f7859(_0x1eaae0[_0x5cda('0x14')][_0x5cda('0x16')]);}else{logger[_0x5cda('0x17')](_0x5cda('0x10'),_0x21b973,_0x5cda('0x11'));_0x2f7859(_0x1eaae0[_0x5cda('0x18')][_0x5cda('0x16')]);}})['catch'](function(_0x234f4a){logger[_0x5cda('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x21b973,_0x234f4a);_0x3392(_0x234f4a);});});}exports[_0x5cda('0x19')]=function(_0x2aa4d1){var _0x49580d=this;return new Promise(function(_0x2e01a0,_0x285d30){return db[_0x5cda('0x1a')]['findAll']({'raw':_0x2aa4d1[_0x5cda('0x1b')]?_0x2aa4d1[_0x5cda('0x1b')][_0x5cda('0x1c')]===undefined?!![]:![]:!![],'where':_0x2aa4d1[_0x5cda('0x1b')]?_0x2aa4d1['options'][_0x5cda('0x1d')]||null:null,'attributes':_0x2aa4d1[_0x5cda('0x1b')]?_0x2aa4d1[_0x5cda('0x1b')]['attributes']||null:null,'limit':_0x2aa4d1[_0x5cda('0x1b')]?_0x2aa4d1[_0x5cda('0x1b')][_0x5cda('0x1e')]||null:null,'include':_0x2aa4d1[_0x5cda('0x1b')]?_0x2aa4d1[_0x5cda('0x1b')][_0x5cda('0x1f')]?_[_0x5cda('0x20')](_0x2aa4d1[_0x5cda('0x1b')][_0x5cda('0x1f')],function(_0x4b64a6){return{'model':db[_0x4b64a6['model']],'as':_0x4b64a6['as'],'attributes':_0x4b64a6[_0x5cda('0x21')],'include':_0x4b64a6['include']?_['map'](_0x4b64a6[_0x5cda('0x1f')],function(_0x504477){return{'model':db[_0x504477[_0x5cda('0x22')]],'as':_0x504477['as'],'attributes':_0x504477['attributes'],'include':_0x504477[_0x5cda('0x1f')]?_[_0x5cda('0x20')](_0x504477[_0x5cda('0x1f')],function(_0x34fea7){return{'model':db[_0x34fea7[_0x5cda('0x22')]],'as':_0x34fea7['as'],'attributes':_0x34fea7[_0x5cda('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5cda('0x23')](function(_0x15ad68){logger[_0x5cda('0x17')](_0x5cda('0x19'),_0x2aa4d1);logger['debug']('GetWhatsappQueue',_0x2aa4d1,JSON[_0x5cda('0x13')](_0x15ad68));_0x2e01a0(_0x15ad68);})[_0x5cda('0x24')](function(_0x310a2e){logger['error'](_0x5cda('0x19'),_0x310a2e[_0x5cda('0x16')],_0x2aa4d1);_0x285d30(_0x49580d[_0x5cda('0x14')](0x1f4,_0x310a2e[_0x5cda('0x16')]));});});};exports[_0x5cda('0x25')]=function(_0x5a2c1f){var _0x4eb973=this;return new Promise(function(_0x4596b5,_0x54c199){return db[_0x5cda('0x1a')][_0x5cda('0x26')]({'raw':_0x5a2c1f[_0x5cda('0x1b')]?_0x5a2c1f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a2c1f[_0x5cda('0x1b')]?_0x5a2c1f['options']['where']||null:null,'attributes':_0x5a2c1f['options']?_0x5a2c1f['options'][_0x5cda('0x21')]||null:null,'include':_0x5a2c1f[_0x5cda('0x1b')]?_0x5a2c1f[_0x5cda('0x1b')][_0x5cda('0x1f')]?_[_0x5cda('0x20')](_0x5a2c1f['options'][_0x5cda('0x1f')],function(_0x14c38f){return{'model':db[_0x14c38f[_0x5cda('0x22')]],'as':_0x14c38f['as'],'attributes':_0x14c38f['attributes'],'include':_0x14c38f[_0x5cda('0x1f')]?_[_0x5cda('0x20')](_0x14c38f[_0x5cda('0x1f')],function(_0x166310){return{'model':db[_0x166310['model']],'as':_0x166310['as'],'attributes':_0x166310[_0x5cda('0x21')],'include':_0x166310['include']?_[_0x5cda('0x20')](_0x166310['include'],function(_0x33d49d){return{'model':db[_0x33d49d[_0x5cda('0x22')]],'as':_0x33d49d['as'],'attributes':_0x33d49d[_0x5cda('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5cda('0x23')](function(_0x5977d7){logger['info'](_0x5cda('0x25'),_0x5a2c1f);logger[_0x5cda('0x12')](_0x5cda('0x25'),_0x5a2c1f,JSON[_0x5cda('0x13')](_0x5977d7));_0x4596b5(_0x5977d7);})[_0x5cda('0x24')](function(_0x398693){logger['error']('ShowWhatsappQueue',_0x398693[_0x5cda('0x16')],_0x5a2c1f);_0x54c199(_0x4eb973[_0x5cda('0x14')](0x1f4,_0x398693[_0x5cda('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 0af12e1..4e21c97 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 _0x7a2c=['whatsappQueue:','./whatsappQueue.events','remove','update','emit','register'];(function(_0x42cfa7,_0xdbfb84){var _0x3909d0=function(_0x4956a7){while(--_0x4956a7){_0x42cfa7['push'](_0x42cfa7['shift']());}};_0x3909d0(++_0xdbfb84);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x51b9da,_0x58b2a7){_0x51b9da=_0x51b9da-0x0;var _0x3259f7=_0x7a2c[_0x51b9da];return _0x3259f7;};'use strict';var WhatsappQueueEvents=require(_0xc7a2('0x0'));var events=['save',_0xc7a2('0x1'),_0xc7a2('0x2')];function createListener(_0x409ec5,_0x26fb61){return function(_0x44d702){_0x26fb61[_0xc7a2('0x3')](_0x409ec5,_0x44d702);};}function removeListener(_0x3f2b0d,_0x34cd60){return function(){WhatsappQueueEvents['removeListener'](_0x3f2b0d,_0x34cd60);};}exports[_0xc7a2('0x4')]=function(_0x1ddbae){for(var _0x5f334e=0x0,_0x481430=events['length'];_0x5f334e<_0x481430;_0x5f334e++){var _0x1dd150=events[_0x5f334e];var _0x3de428=createListener(_0xc7a2('0x5')+_0x1dd150,_0x1ddbae);WhatsappQueueEvents['on'](_0x1dd150,_0x3de428);}}; \ No newline at end of file +var _0xda2f=['update','emit','removeListener','register','./whatsappQueue.events','remove'];(function(_0x160d65,_0x42ca7c){var _0x54110c=function(_0x4d9c5b){while(--_0x4d9c5b){_0x160d65['push'](_0x160d65['shift']());}};_0x54110c(++_0x42ca7c);}(_0xda2f,0xdc));var _0xfda2=function(_0x205a2d,_0x1e9c1b){_0x205a2d=_0x205a2d-0x0;var _0x486464=_0xda2f[_0x205a2d];return _0x486464;};'use strict';var WhatsappQueueEvents=require(_0xfda2('0x0'));var events=['save',_0xfda2('0x1'),_0xfda2('0x2')];function createListener(_0x25fb23,_0x455f19){return function(_0x1577ed){_0x455f19[_0xfda2('0x3')](_0x25fb23,_0x1577ed);};}function removeListener(_0x4cb744,_0x535cef){return function(){WhatsappQueueEvents[_0xfda2('0x4')](_0x4cb744,_0x535cef);};}exports[_0xfda2('0x5')]=function(_0x1a09e1){for(var _0x5ea99a=0x0,_0x3125bf=events['length'];_0x5ea99a<_0x3125bf;_0x5ea99a++){var _0x5d78e4=events[_0x5ea99a];var _0xd0dd30=createListener('whatsappQueue:'+_0x5d78e4,_0x1a09e1);WhatsappQueueEvents['on'](_0x5d78e4,_0xd0dd30);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 47d4775..db46ea2 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 _0x4330=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update'];(function(_0x3274d1,_0x2e0162){var _0x59ded5=function(_0x40acdb){while(--_0x40acdb){_0x3274d1['push'](_0x3274d1['shift']());}};_0x59ded5(++_0x2e0162);}(_0x4330,0x13d));var _0x0433=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x4330[_0x2dea24];return _0x309d58;};'use strict';var multer=require(_0x0433('0x0'));var util=require(_0x0433('0x1'));var path=require(_0x0433('0x2'));var timeout=require(_0x0433('0x3'));var express=require(_0x0433('0x4'));var router=express[_0x0433('0x5')]();var auth=require(_0x0433('0x6'));var interaction=require(_0x0433('0x7'));var config=require(_0x0433('0x8'));var controller=require(_0x0433('0x9'));router[_0x0433('0xa')]('/',auth[_0x0433('0xb')](),controller[_0x0433('0xc')]);router[_0x0433('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x0433('0xd')]);router[_0x0433('0xa')](_0x0433('0xe'),auth[_0x0433('0xb')](),controller[_0x0433('0xf')]);router['post']('/',auth[_0x0433('0xb')](),controller[_0x0433('0x10')]);router[_0x0433('0x11')](_0x0433('0xe'),auth[_0x0433('0xb')](),controller[_0x0433('0x12')]);router['delete'](_0x0433('0xe'),auth[_0x0433('0xb')](),controller[_0x0433('0x13')]);module[_0x0433('0x14')]=router; \ No newline at end of file +var _0x17bb=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update'];(function(_0xe7902a,_0x49d79f){var _0x14db37=function(_0x28c85e){while(--_0x28c85e){_0xe7902a['push'](_0xe7902a['shift']());}};_0x14db37(++_0x49d79f);}(_0x17bb,0x80));var _0xb17b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x17bb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb17b('0x0'));var util=require(_0xb17b('0x1'));var path=require('path');var timeout=require(_0xb17b('0x2'));var express=require(_0xb17b('0x3'));var router=express[_0xb17b('0x4')]();var auth=require(_0xb17b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb17b('0x6'));router[_0xb17b('0x7')]('/',auth[_0xb17b('0x8')](),controller[_0xb17b('0x9')]);router[_0xb17b('0x7')](_0xb17b('0xa'),auth[_0xb17b('0x8')](),controller['describe']);router['get'](_0xb17b('0xb'),auth['isAuthenticated'](),controller[_0xb17b('0xc')]);router[_0xb17b('0xd')]('/',auth[_0xb17b('0x8')](),controller[_0xb17b('0xe')]);router['put'](_0xb17b('0xb'),auth[_0xb17b('0x8')](),controller[_0xb17b('0xf')]);router['delete'](_0xb17b('0xb'),auth[_0xb17b('0x8')](),controller[_0xb17b('0x10')]);module[_0xb17b('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0060e70..188aaf0 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 _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x2327ce,_0xe929b4){var _0x5d2811=function(_0x23d269){while(--_0x23d269){_0x2327ce['push'](_0x2327ce['shift']());}};_0x5d2811(++_0xe929b4);}(_0x8ef6,0xf2));var _0x68ef=function(_0x373210,_0x3588bc){_0x373210=_0x373210-0x0;var _0x297cfe=_0x8ef6[_0x373210];return _0x297cfe;};'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 +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x36041d,_0x20e283){var _0x1fb740=function(_0x1be7b1){while(--_0x1be7b1){_0x36041d['push'](_0x36041d['shift']());}};_0x1fb740(++_0x20e283);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 906bdc7..ba2ebde 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 _0x5af0=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','filtears','find','create','body'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x5af0,0x1eb));var _0x05af=function(_0x13b24e,_0x1c4cb8){_0x13b24e=_0x13b24e-0x0;var _0x374b8e=_0x5af0[_0x13b24e];return _0x374b8e;};'use strict';var pdf=require(_0x05af('0x0'));var emlformat=require(_0x05af('0x1'));var rimraf=require(_0x05af('0x2'));var zipdir=require(_0x05af('0x3'));var jsonpatch=require(_0x05af('0x4'));var rp=require(_0x05af('0x5'));var moment=require(_0x05af('0x6'));var BPromise=require(_0x05af('0x7'));var Mustache=require('mustache');var util=require(_0x05af('0x8'));var path=require('path');var sox=require(_0x05af('0x9'));var csv=require(_0x05af('0xa'));var ejs=require(_0x05af('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x05af('0xc'));var crypto=require('crypto');var jsforce=require(_0x05af('0xd'));var deskjs=require(_0x05af('0xe'));var toCsv=require(_0x05af('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x05af('0xf'));var as=require(_0x05af('0x10'));var hardwareService=require(_0x05af('0x11'));var logger=require('../../config/logger')(_0x05af('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x05af('0x13'));var db=require(_0x05af('0x14'))['db'];function respondWithStatusCode(_0x37f219,_0x288576){_0x288576=_0x288576||0xcc;return function(_0x2531d1){if(_0x2531d1){return _0x37f219[_0x05af('0x15')](_0x288576);}return _0x37f219[_0x05af('0x16')](_0x288576)[_0x05af('0x17')]();};}function respondWithResult(_0x1d2509,_0x168637){_0x168637=_0x168637||0xc8;return function(_0xbc1b06){if(_0xbc1b06){return _0x1d2509[_0x05af('0x16')](_0x168637)[_0x05af('0x18')](_0xbc1b06);}};}function respondWithFilteredResult(_0x922bc1,_0x614bc){return function(_0xf1a044){if(_0xf1a044){var _0x101035=_0xf1a044[_0x05af('0x19')],_0x5c94af=_0x614bc[_0x05af('0x1a')],_0x4de4ed=_0x614bc['offset']+_0x614bc[_0x05af('0x1b')],_0x1fc2d3;if(_0x4de4ed>=_0x101035){_0x4de4ed=_0x101035;_0x1fc2d3=0xc8;}else{_0x1fc2d3=0xce;}_0x922bc1[_0x05af('0x16')](_0x1fc2d3);return _0x922bc1[_0x05af('0x1c')](_0x05af('0x1d'),_0x5c94af+'-'+_0x4de4ed+'/'+_0x101035)[_0x05af('0x18')](_0xf1a044);}return null;};}function patchUpdates(_0x289863){return function(_0x2ea845){try{jsonpatch[_0x05af('0x1e')](_0x2ea845,_0x289863,!![]);}catch(_0x374bfe){return BPromise['reject'](_0x374bfe);}return _0x2ea845[_0x05af('0x1f')]();};}function saveUpdates(_0x5464f1,_0x1c282e){return function(_0x444af7){if(_0x444af7){return _0x444af7[_0x05af('0x20')](_0x5464f1)[_0x05af('0x21')](function(_0xb885dd){return _0xb885dd;});}return null;};}function removeEntity(_0x4d06a6,_0x2ec7c6){return function(_0x3c2b98){if(_0x3c2b98){return _0x3c2b98[_0x05af('0x22')]()[_0x05af('0x21')](function(){_0x4d06a6[_0x05af('0x16')](0xcc)[_0x05af('0x17')]();});}};}function handleEntityNotFound(_0x3c3f61,_0x41b94b){return function(_0x1b5940){if(!_0x1b5940){_0x3c3f61['sendStatus'](0x194);}return _0x1b5940;};}function handleError(_0x5e8a15,_0x5575e9){_0x5575e9=_0x5575e9||0x1f4;return function(_0x4842b2){logger[_0x05af('0x23')](_0x4842b2[_0x05af('0x24')]);if(_0x4842b2[_0x05af('0x25')]){delete _0x4842b2['name'];}_0x5e8a15['status'](_0x5575e9)[_0x05af('0x26')](_0x4842b2);};}exports['index']=function(_0x46948a,_0x6d79a){var _0x3250da={},_0xa57972={},_0x180c06={'count':0x0,'rows':[]};var _0x5dca13=_[_0x05af('0x27')](db[_0x05af('0x28')]['rawAttributes'],function(_0x26108f){return{'name':_0x26108f['fieldName'],'type':_0x26108f[_0x05af('0x29')]['key']};});_0xa57972[_0x05af('0x2a')]=_[_0x05af('0x27')](_0x5dca13,_0x05af('0x25'));_0xa57972['query']=_[_0x05af('0x2b')](_0x46948a[_0x05af('0x2c')]);_0xa57972[_0x05af('0x2d')]=_[_0x05af('0x2e')](_0xa57972[_0x05af('0x2a')],_0xa57972[_0x05af('0x2c')]);_0x3250da[_0x05af('0x2f')]=_['intersection'](_0xa57972[_0x05af('0x2a')],qs[_0x05af('0x30')](_0x46948a['query']['fields']));_0x3250da[_0x05af('0x2f')]=_0x3250da[_0x05af('0x2f')][_0x05af('0x31')]?_0x3250da[_0x05af('0x2f')]:_0xa57972[_0x05af('0x2a')];if(!_0x46948a[_0x05af('0x2c')]['hasOwnProperty'](_0x05af('0x32'))){_0x3250da['limit']=qs[_0x05af('0x1b')](_0x46948a[_0x05af('0x2c')][_0x05af('0x1b')]);_0x3250da['offset']=qs['offset'](_0x46948a['query'][_0x05af('0x1a')]);}_0x3250da[_0x05af('0x33')]=qs[_0x05af('0x34')](_0x46948a['query'][_0x05af('0x34')]);_0x3250da[_0x05af('0x35')]=qs[_0x05af('0x2d')](_['pick'](_0x46948a[_0x05af('0x2c')],_0xa57972[_0x05af('0x2d')]),_0x5dca13);if(_0x46948a[_0x05af('0x2c')][_0x05af('0x36')]){_0x3250da['where']=_[_0x05af('0x37')](_0x3250da[_0x05af('0x35')],{'$or':_[_0x05af('0x27')](_0x5dca13,function(_0x23a6ba){if(_0x23a6ba['type']!==_0x05af('0x38')){var _0x342310={};_0x342310[_0x23a6ba['name']]={'$like':'%'+_0x46948a[_0x05af('0x2c')][_0x05af('0x36')]+'%'};return _0x342310;}})});}_0x3250da=_[_0x05af('0x37')]({},_0x3250da,_0x46948a[_0x05af('0x39')]);var _0x32f65f={'where':_0x3250da[_0x05af('0x35')]};return db[_0x05af('0x28')][_0x05af('0x19')](_0x32f65f)[_0x05af('0x21')](function(_0x21141c){_0x180c06[_0x05af('0x19')]=_0x21141c;if(_0x46948a[_0x05af('0x2c')][_0x05af('0x3a')]){_0x3250da[_0x05af('0x3b')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x05af('0x3c')](_0x3250da);})[_0x05af('0x21')](function(_0x36a0df){_0x180c06['rows']=_0x36a0df;return _0x180c06;})[_0x05af('0x21')](respondWithFilteredResult(_0x6d79a,_0x3250da))[_0x05af('0x3d')](handleError(_0x6d79a,null));};exports[_0x05af('0x3e')]=function(_0x17dda1,_0x4133cc){var _0x2dd192={'raw':!![],'where':{'id':_0x17dda1[_0x05af('0x3f')]['id']}},_0x2df7ad={};_0x2df7ad[_0x05af('0x2a')]=_[_0x05af('0x2b')](db[_0x05af('0x28')][_0x05af('0x40')]);_0x2df7ad['query']=_['keys'](_0x17dda1[_0x05af('0x2c')]);_0x2df7ad[_0x05af('0x41')]=_[_0x05af('0x2e')](_0x2df7ad[_0x05af('0x2a')],_0x2df7ad['query']);_0x2dd192[_0x05af('0x2f')]=_[_0x05af('0x2e')](_0x2df7ad[_0x05af('0x2a')],qs['fields'](_0x17dda1['query'][_0x05af('0x30')]));_0x2dd192[_0x05af('0x2f')]=_0x2dd192['attributes'][_0x05af('0x31')]?_0x2dd192[_0x05af('0x2f')]:_0x2df7ad[_0x05af('0x2a')];if(_0x17dda1[_0x05af('0x2c')]['includeAll']){_0x2dd192['include']=[{'all':!![]}];}_0x2dd192=_['merge']({},_0x2dd192,_0x17dda1[_0x05af('0x39')]);return db[_0x05af('0x28')][_0x05af('0x42')](_0x2dd192)[_0x05af('0x21')](handleEntityNotFound(_0x4133cc,null))[_0x05af('0x21')](respondWithResult(_0x4133cc,null))[_0x05af('0x3d')](handleError(_0x4133cc,null));};exports['create']=function(_0x1087df,_0x361581){return db[_0x05af('0x28')][_0x05af('0x43')](_0x1087df[_0x05af('0x44')],{})[_0x05af('0x21')](respondWithResult(_0x361581,0xc9))[_0x05af('0x3d')](handleError(_0x361581,null));};exports[_0x05af('0x20')]=function(_0x4e3250,_0x363775){if(_0x4e3250[_0x05af('0x44')]['id']){delete _0x4e3250[_0x05af('0x44')]['id'];}return db[_0x05af('0x28')]['find']({'where':{'id':_0x4e3250[_0x05af('0x3f')]['id']}})[_0x05af('0x21')](handleEntityNotFound(_0x363775,null))[_0x05af('0x21')](saveUpdates(_0x4e3250[_0x05af('0x44')],null))[_0x05af('0x21')](respondWithResult(_0x363775,null))[_0x05af('0x3d')](handleError(_0x363775,null));};exports[_0x05af('0x22')]=function(_0x51edc7,_0x6c15a2){return db[_0x05af('0x28')][_0x05af('0x42')]({'where':{'id':_0x51edc7['params']['id']}})[_0x05af('0x21')](handleEntityNotFound(_0x6c15a2,null))[_0x05af('0x21')](removeEntity(_0x6c15a2,null))[_0x05af('0x3d')](handleError(_0x6c15a2,null));};exports[_0x05af('0x45')]=function(_0x15d461,_0x281f3a){return db['WhatsappQueueReport'][_0x05af('0x45')]()[_0x05af('0x21')](respondWithResult(_0x281f3a,null))[_0x05af('0x3d')](handleError(_0x281f3a,null));}; \ No newline at end of file +var _0x6bff=['merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','filtears','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','error','stack','name','index','WhatsappQueueReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','filter'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0x6bff,0xa6));var _0xf6bf=function(_0xc2d9f0,_0xac7d7d){_0xc2d9f0=_0xc2d9f0-0x0;var _0x58d624=_0x6bff[_0xc2d9f0];return _0x58d624;};'use strict';var pdf=require(_0xf6bf('0x0'));var emlformat=require(_0xf6bf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf6bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6bf('0x3'));var moment=require(_0xf6bf('0x4'));var BPromise=require(_0xf6bf('0x5'));var Mustache=require(_0xf6bf('0x6'));var util=require('util');var path=require(_0xf6bf('0x7'));var sox=require(_0xf6bf('0x8'));var csv=require(_0xf6bf('0x9'));var ejs=require(_0xf6bf('0xa'));var fs=require('fs');var _=require(_0xf6bf('0xb'));var squel=require(_0xf6bf('0xc'));var crypto=require(_0xf6bf('0xd'));var jsforce=require(_0xf6bf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf6bf('0xf'));var Redis=require(_0xf6bf('0x10'));var authService=require(_0xf6bf('0x11'));var qs=require(_0xf6bf('0x12'));var as=require(_0xf6bf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6bf('0x14'))(_0xf6bf('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6bf('0x16'));var db=require(_0xf6bf('0x17'))['db'];function respondWithStatusCode(_0x4cc0bb,_0xd70950){_0xd70950=_0xd70950||0xcc;return function(_0x5912c1){if(_0x5912c1){return _0x4cc0bb[_0xf6bf('0x18')](_0xd70950);}return _0x4cc0bb['status'](_0xd70950)[_0xf6bf('0x19')]();};}function respondWithResult(_0xe60979,_0x4aad38){_0x4aad38=_0x4aad38||0xc8;return function(_0x48c90b){if(_0x48c90b){return _0xe60979[_0xf6bf('0x1a')](_0x4aad38)['json'](_0x48c90b);}};}function respondWithFilteredResult(_0xe55dd5,_0x18c11c){return function(_0xdc115f){if(_0xdc115f){var _0x436341=_0xdc115f[_0xf6bf('0x1b')],_0x1e501e=_0x18c11c[_0xf6bf('0x1c')],_0x47573f=_0x18c11c[_0xf6bf('0x1c')]+_0x18c11c[_0xf6bf('0x1d')],_0x5caf5f;if(_0x47573f>=_0x436341){_0x47573f=_0x436341;_0x5caf5f=0xc8;}else{_0x5caf5f=0xce;}_0xe55dd5['status'](_0x5caf5f);return _0xe55dd5[_0xf6bf('0x1e')](_0xf6bf('0x1f'),_0x1e501e+'-'+_0x47573f+'/'+_0x436341)[_0xf6bf('0x20')](_0xdc115f);}return null;};}function patchUpdates(_0x2e5f6b){return function(_0x2595a7){try{jsonpatch['apply'](_0x2595a7,_0x2e5f6b,!![]);}catch(_0xf32bb){return BPromise[_0xf6bf('0x21')](_0xf32bb);}return _0x2595a7[_0xf6bf('0x22')]();};}function saveUpdates(_0xf7da6a,_0x2b41b1){return function(_0x4c2d5){if(_0x4c2d5){return _0x4c2d5[_0xf6bf('0x23')](_0xf7da6a)[_0xf6bf('0x24')](function(_0x1f8166){return _0x1f8166;});}return null;};}function removeEntity(_0x2c8041,_0x34fbf4){return function(_0x1fa630){if(_0x1fa630){return _0x1fa630['destroy']()['then'](function(){_0x2c8041[_0xf6bf('0x1a')](0xcc)[_0xf6bf('0x19')]();});}};}function handleEntityNotFound(_0x5c35bf,_0x29efc5){return function(_0x3dd719){if(!_0x3dd719){_0x5c35bf[_0xf6bf('0x18')](0x194);}return _0x3dd719;};}function handleError(_0x5ed736,_0x2523a8){_0x2523a8=_0x2523a8||0x1f4;return function(_0x1272f3){logger[_0xf6bf('0x25')](_0x1272f3[_0xf6bf('0x26')]);if(_0x1272f3[_0xf6bf('0x27')]){delete _0x1272f3[_0xf6bf('0x27')];}_0x5ed736[_0xf6bf('0x1a')](_0x2523a8)['send'](_0x1272f3);};}exports[_0xf6bf('0x28')]=function(_0x498b59,_0x33eda8){var _0x25ee7c={},_0x154ba8={},_0x44bf3d={'count':0x0,'rows':[]};var _0x3a1e69=_['map'](db[_0xf6bf('0x29')][_0xf6bf('0x2a')],function(_0x2b3600){return{'name':_0x2b3600['fieldName'],'type':_0x2b3600['type'][_0xf6bf('0x2b')]};});_0x154ba8[_0xf6bf('0x2c')]=_[_0xf6bf('0x2d')](_0x3a1e69,_0xf6bf('0x27'));_0x154ba8[_0xf6bf('0x2e')]=_[_0xf6bf('0x2f')](_0x498b59[_0xf6bf('0x2e')]);_0x154ba8[_0xf6bf('0x30')]=_[_0xf6bf('0x31')](_0x154ba8[_0xf6bf('0x2c')],_0x154ba8[_0xf6bf('0x2e')]);_0x25ee7c[_0xf6bf('0x32')]=_[_0xf6bf('0x31')](_0x154ba8[_0xf6bf('0x2c')],qs[_0xf6bf('0x33')](_0x498b59[_0xf6bf('0x2e')]['fields']));_0x25ee7c[_0xf6bf('0x32')]=_0x25ee7c[_0xf6bf('0x32')]['length']?_0x25ee7c['attributes']:_0x154ba8[_0xf6bf('0x2c')];if(!_0x498b59[_0xf6bf('0x2e')]['hasOwnProperty'](_0xf6bf('0x34'))){_0x25ee7c[_0xf6bf('0x1d')]=qs[_0xf6bf('0x1d')](_0x498b59[_0xf6bf('0x2e')][_0xf6bf('0x1d')]);_0x25ee7c[_0xf6bf('0x1c')]=qs[_0xf6bf('0x1c')](_0x498b59[_0xf6bf('0x2e')][_0xf6bf('0x1c')]);}_0x25ee7c[_0xf6bf('0x35')]=qs[_0xf6bf('0x36')](_0x498b59[_0xf6bf('0x2e')]['sort']);_0x25ee7c['where']=qs['filters'](_['pick'](_0x498b59['query'],_0x154ba8[_0xf6bf('0x30')]),_0x3a1e69);if(_0x498b59[_0xf6bf('0x2e')][_0xf6bf('0x37')]){_0x25ee7c['where']=_[_0xf6bf('0x38')](_0x25ee7c[_0xf6bf('0x39')],{'$or':_[_0xf6bf('0x2d')](_0x3a1e69,function(_0x519415){if(_0x519415[_0xf6bf('0x3a')]!==_0xf6bf('0x3b')){var _0x44ec0c={};_0x44ec0c[_0x519415[_0xf6bf('0x27')]]={'$like':'%'+_0x498b59[_0xf6bf('0x2e')]['filter']+'%'};return _0x44ec0c;}})});}_0x25ee7c=_[_0xf6bf('0x38')]({},_0x25ee7c,_0x498b59[_0xf6bf('0x3c')]);var _0x4cb005={'where':_0x25ee7c[_0xf6bf('0x39')]};return db[_0xf6bf('0x29')][_0xf6bf('0x1b')](_0x4cb005)[_0xf6bf('0x24')](function(_0x5d46b4){_0x44bf3d[_0xf6bf('0x1b')]=_0x5d46b4;if(_0x498b59[_0xf6bf('0x2e')][_0xf6bf('0x3d')]){_0x25ee7c[_0xf6bf('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xf6bf('0x3f')](_0x25ee7c);})[_0xf6bf('0x24')](function(_0x497114){_0x44bf3d[_0xf6bf('0x40')]=_0x497114;return _0x44bf3d;})[_0xf6bf('0x24')](respondWithFilteredResult(_0x33eda8,_0x25ee7c))[_0xf6bf('0x41')](handleError(_0x33eda8,null));};exports[_0xf6bf('0x42')]=function(_0x27d267,_0x2571c9){var _0xad426c={'raw':!![],'where':{'id':_0x27d267[_0xf6bf('0x43')]['id']}},_0x939e1f={};_0x939e1f['model']=_['keys'](db[_0xf6bf('0x29')][_0xf6bf('0x2a')]);_0x939e1f[_0xf6bf('0x2e')]=_['keys'](_0x27d267[_0xf6bf('0x2e')]);_0x939e1f[_0xf6bf('0x44')]=_[_0xf6bf('0x31')](_0x939e1f[_0xf6bf('0x2c')],_0x939e1f[_0xf6bf('0x2e')]);_0xad426c[_0xf6bf('0x32')]=_[_0xf6bf('0x31')](_0x939e1f[_0xf6bf('0x2c')],qs[_0xf6bf('0x33')](_0x27d267[_0xf6bf('0x2e')][_0xf6bf('0x33')]));_0xad426c[_0xf6bf('0x32')]=_0xad426c[_0xf6bf('0x32')]['length']?_0xad426c[_0xf6bf('0x32')]:_0x939e1f[_0xf6bf('0x2c')];if(_0x27d267[_0xf6bf('0x2e')]['includeAll']){_0xad426c[_0xf6bf('0x3e')]=[{'all':!![]}];}_0xad426c=_[_0xf6bf('0x38')]({},_0xad426c,_0x27d267[_0xf6bf('0x3c')]);return db[_0xf6bf('0x29')][_0xf6bf('0x45')](_0xad426c)[_0xf6bf('0x24')](handleEntityNotFound(_0x2571c9,null))['then'](respondWithResult(_0x2571c9,null))[_0xf6bf('0x41')](handleError(_0x2571c9,null));};exports['create']=function(_0x4de462,_0x37f164){return db[_0xf6bf('0x29')][_0xf6bf('0x46')](_0x4de462[_0xf6bf('0x47')],{})['then'](respondWithResult(_0x37f164,0xc9))[_0xf6bf('0x41')](handleError(_0x37f164,null));};exports['update']=function(_0x59cd4d,_0x28cb0e){if(_0x59cd4d[_0xf6bf('0x47')]['id']){delete _0x59cd4d[_0xf6bf('0x47')]['id'];}return db['WhatsappQueueReport'][_0xf6bf('0x45')]({'where':{'id':_0x59cd4d['params']['id']}})[_0xf6bf('0x24')](handleEntityNotFound(_0x28cb0e,null))['then'](saveUpdates(_0x59cd4d['body'],null))[_0xf6bf('0x24')](respondWithResult(_0x28cb0e,null))[_0xf6bf('0x41')](handleError(_0x28cb0e,null));};exports[_0xf6bf('0x48')]=function(_0x342bd7,_0x4e3d6b){return db[_0xf6bf('0x29')][_0xf6bf('0x45')]({'where':{'id':_0x342bd7[_0xf6bf('0x43')]['id']}})[_0xf6bf('0x24')](handleEntityNotFound(_0x4e3d6b,null))['then'](removeEntity(_0x4e3d6b,null))[_0xf6bf('0x41')](handleError(_0x4e3d6b,null));};exports[_0xf6bf('0x49')]=function(_0x44dbee,_0x4b40f6){return db[_0xf6bf('0x29')][_0xf6bf('0x49')]()['then'](respondWithResult(_0x4b40f6,null))['catch'](handleError(_0x4b40f6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 9001985..1f0388f 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 _0x84ac=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid'];(function(_0x1e93b2,_0x2fef2b){var _0x3e5d00=function(_0x87184b){while(--_0x87184b){_0x1e93b2['push'](_0x1e93b2['shift']());}};_0x3e5d00(++_0x2fef2b);}(_0x84ac,0xea));var _0xc84a=function(_0x205d4f,_0x1551d7){_0x205d4f=_0x205d4f-0x0;var _0x2a740b=_0x84ac[_0x205d4f];return _0x2a740b;};'use strict';var _=require('lodash');var util=require(_0xc84a('0x0'));var logger=require(_0xc84a('0x1'))(_0xc84a('0x2'));var moment=require(_0xc84a('0x3'));var BPromise=require(_0xc84a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc84a('0x5'));var rimraf=require(_0xc84a('0x6'));var config=require(_0xc84a('0x7'));var attributes=require(_0xc84a('0x8'));module[_0xc84a('0x9')]=function(_0x2c355e,_0x57c67f){return _0x2c355e[_0xc84a('0xa')]('WhatsappQueueReport',attributes,{'tableName':_0xc84a('0xb'),'paranoid':![],'indexes':[{'name':_0xc84a('0xc'),'fields':[_0xc84a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9547=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x34d047,_0x53ef93){var _0x16c548=function(_0x249948){while(--_0x249948){_0x34d047['push'](_0x34d047['shift']());}};_0x16c548(++_0x53ef93);}(_0x9547,0x146));var _0x7954=function(_0x43175d,_0x5dfd80){_0x43175d=_0x43175d-0x0;var _0x4fe27f=_0x9547[_0x43175d];return _0x4fe27f;};'use strict';var _=require(_0x7954('0x0'));var util=require('util');var logger=require(_0x7954('0x1'))(_0x7954('0x2'));var moment=require(_0x7954('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7954('0x4'));var rimraf=require('rimraf');var config=require(_0x7954('0x5'));var attributes=require(_0x7954('0x6'));module[_0x7954('0x7')]=function(_0x11d7fa,_0x1bcdd1){return _0x11d7fa[_0x7954('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x7954('0x9'),'paranoid':![],'indexes':[{'name':_0x7954('0xa'),'fields':[_0x7954('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 5e368e8..edda260 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 _0x980d=['WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','then','UpdateWhatsappQueueReport','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x2d41e7,_0x543ff5){var _0x1f00c6=function(_0x345465){while(--_0x345465){_0x2d41e7['push'](_0x2d41e7['shift']());}};_0x1f00c6(++_0x543ff5);}(_0x980d,0xbf));var _0xd980=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x980d[_0x296809];return _0x18c0d3;};'use strict';var _=require(_0xd980('0x0'));var util=require(_0xd980('0x1'));var moment=require(_0xd980('0x2'));var BPromise=require(_0xd980('0x3'));var rs=require(_0xd980('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd980('0x5'))['db'];var utils=require(_0xd980('0x6'));var logger=require(_0xd980('0x7'))(_0xd980('0x8'));var config=require(_0xd980('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd980('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4987da,_0x3cde8b,_0x2f80bd){return new BPromise(function(_0x18ef67,_0x5d6025){return client[_0xd980('0xb')](_0x4987da,_0x2f80bd)['then'](function(_0x34fe26){logger[_0xd980('0xc')](_0xd980('0xd'),_0x3cde8b,'request\x20sent');logger[_0xd980('0xe')](_0xd980('0xf'),_0x3cde8b,_0xd980('0x10'),JSON[_0xd980('0x11')](_0x34fe26));if(_0x34fe26['error']){if(_0x34fe26['error'][_0xd980('0x12')]===0x1f4){logger[_0xd980('0x13')](_0xd980('0xd'),_0x3cde8b,_0x34fe26[_0xd980('0x13')][_0xd980('0x14')]);return _0x5d6025(_0x34fe26[_0xd980('0x13')][_0xd980('0x14')]);}logger[_0xd980('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3cde8b,_0x34fe26[_0xd980('0x13')]['message']);return _0x18ef67(_0x34fe26[_0xd980('0x13')][_0xd980('0x14')]);}else{logger[_0xd980('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3cde8b,_0xd980('0x10'));_0x18ef67(_0x34fe26[_0xd980('0x15')][_0xd980('0x14')]);}})[_0xd980('0x16')](function(_0xbbcd6a){logger[_0xd980('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3cde8b,_0xbbcd6a);_0x5d6025(_0xbbcd6a);});});}exports[_0xd980('0x17')]=function(_0x52ef25){var _0x3e26ca=this;return new Promise(function(_0x214493,_0x503846){return db[_0xd980('0x18')][_0xd980('0x19')](_0x52ef25[_0xd980('0x1a')],{'raw':_0x52ef25['options']?_0x52ef25['options'][_0xd980('0x1b')]===undefined?!![]:![]:!![]})[_0xd980('0x1c')](function(_0x4e3b90){logger[_0xd980('0xc')](_0xd980('0x17'),_0x52ef25);logger[_0xd980('0xe')](_0xd980('0x17'),_0x52ef25,JSON[_0xd980('0x11')](_0x4e3b90));_0x214493(_0x4e3b90);})[_0xd980('0x16')](function(_0x545eb2){logger[_0xd980('0x13')](_0xd980('0x17'),_0x545eb2['message'],_0x52ef25);_0x503846(_0x3e26ca[_0xd980('0x13')](0x1f4,_0x545eb2[_0xd980('0x14')]));});});};exports[_0xd980('0x1d')]=function(_0x3b06c4){var _0x451172=this;return new Promise(function(_0x2889b1,_0x19f436){return db[_0xd980('0x18')][_0xd980('0x1e')](_0x3b06c4['body'],{'raw':_0x3b06c4[_0xd980('0x1f')]?_0x3b06c4[_0xd980('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b06c4[_0xd980('0x1f')]?_0x3b06c4[_0xd980('0x1f')][_0xd980('0x20')]||null:null,'attributes':_0x3b06c4[_0xd980('0x1f')]?_0x3b06c4[_0xd980('0x1f')][_0xd980('0x21')]||null:null,'limit':_0x3b06c4[_0xd980('0x1f')]?_0x3b06c4[_0xd980('0x1f')]['limit']||null:null})[_0xd980('0x1c')](function(_0x5b2fd0){logger['info'](_0xd980('0x1d'),_0x3b06c4);logger[_0xd980('0xe')](_0xd980('0x1d'),_0x3b06c4,JSON['stringify'](_0x5b2fd0));_0x2889b1(_0x5b2fd0);})[_0xd980('0x16')](function(_0x16a6b7){logger['error'](_0xd980('0x1d'),_0x16a6b7[_0xd980('0x14')],_0x3b06c4);_0x19f436(_0x451172[_0xd980('0x13')](0x1f4,_0x16a6b7[_0xd980('0x14')]));});});}; \ No newline at end of file +var _0x2f14=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x5802db,_0x1634a2){var _0x67ece2=function(_0xed14ab){while(--_0xed14ab){_0x5802db['push'](_0x5802db['shift']());}};_0x67ece2(++_0x1634a2);}(_0x2f14,0x103));var _0x42f1=function(_0x307037,_0x4ac342){_0x307037=_0x307037-0x0;var _0x46a705=_0x2f14[_0x307037];return _0x46a705;};'use strict';var _=require(_0x42f1('0x0'));var util=require('util');var moment=require(_0x42f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x42f1('0x2'));var fs=require('fs');var Redis=require(_0x42f1('0x3'));var db=require(_0x42f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42f1('0x5'));var config=require(_0x42f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x42f1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8c471d,_0x276df4,_0x5cceaf){return new BPromise(function(_0x428ae7,_0x5580dc){return client[_0x42f1('0x8')](_0x8c471d,_0x5cceaf)[_0x42f1('0x9')](function(_0x49f500){logger['info'](_0x42f1('0xa'),_0x276df4,'request\x20sent');logger[_0x42f1('0xb')](_0x42f1('0xc'),_0x276df4,_0x42f1('0xd'),JSON[_0x42f1('0xe')](_0x49f500));if(_0x49f500[_0x42f1('0xf')]){if(_0x49f500['error'][_0x42f1('0x10')]===0x1f4){logger[_0x42f1('0xf')](_0x42f1('0xa'),_0x276df4,_0x49f500[_0x42f1('0xf')][_0x42f1('0x11')]);return _0x5580dc(_0x49f500[_0x42f1('0xf')][_0x42f1('0x11')]);}logger[_0x42f1('0xf')](_0x42f1('0xa'),_0x276df4,_0x49f500[_0x42f1('0xf')]['message']);return _0x428ae7(_0x49f500['error']['message']);}else{logger[_0x42f1('0x12')](_0x42f1('0xa'),_0x276df4,_0x42f1('0xd'));_0x428ae7(_0x49f500['result']['message']);}})[_0x42f1('0x13')](function(_0x57249d){logger[_0x42f1('0xf')](_0x42f1('0xa'),_0x276df4,_0x57249d);_0x5580dc(_0x57249d);});});}exports[_0x42f1('0x14')]=function(_0xe672ba){var _0x35a6f8=this;return new Promise(function(_0x109408,_0x96ca8c){return db[_0x42f1('0x15')][_0x42f1('0x16')](_0xe672ba[_0x42f1('0x17')],{'raw':_0xe672ba[_0x42f1('0x18')]?_0xe672ba['options'][_0x42f1('0x19')]===undefined?!![]:![]:!![]})[_0x42f1('0x9')](function(_0x56d272){logger[_0x42f1('0x12')](_0x42f1('0x14'),_0xe672ba);logger['debug']('CreateWhatsappQueueReport',_0xe672ba,JSON['stringify'](_0x56d272));_0x109408(_0x56d272);})['catch'](function(_0x40bf2c){logger[_0x42f1('0xf')](_0x42f1('0x14'),_0x40bf2c['message'],_0xe672ba);_0x96ca8c(_0x35a6f8[_0x42f1('0xf')](0x1f4,_0x40bf2c['message']));});});};exports[_0x42f1('0x1a')]=function(_0x144428){var _0x77455f=this;return new Promise(function(_0x466c9d,_0xda2211){return db[_0x42f1('0x15')][_0x42f1('0x1b')](_0x144428[_0x42f1('0x17')],{'raw':_0x144428[_0x42f1('0x18')]?_0x144428['options'][_0x42f1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144428[_0x42f1('0x18')]?_0x144428['options']['where']||null:null,'attributes':_0x144428[_0x42f1('0x18')]?_0x144428[_0x42f1('0x18')][_0x42f1('0x1c')]||null:null,'limit':_0x144428['options']?_0x144428[_0x42f1('0x18')][_0x42f1('0x1d')]||null:null})[_0x42f1('0x9')](function(_0x5bdbf0){logger['info'](_0x42f1('0x1a'),_0x144428);logger[_0x42f1('0xb')](_0x42f1('0x1a'),_0x144428,JSON[_0x42f1('0xe')](_0x5bdbf0));_0x466c9d(_0x5bdbf0);})[_0x42f1('0x13')](function(_0x5b1a45){logger[_0x42f1('0xf')]('UpdateWhatsappQueueReport',_0x5b1a45[_0x42f1('0x11')],_0x144428);_0xda2211(_0x77455f[_0x42f1('0xf')](0x1f4,_0x5b1a45['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8b8b446..828abea 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 _0xc6a2=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x47b5cb,_0x3d6e41){var _0x58e587=function(_0x388750){while(--_0x388750){_0x47b5cb['push'](_0x47b5cb['shift']());}};_0x58e587(++_0x3d6e41);}(_0xc6a2,0x69));var _0x2c6a=function(_0x1a3cc3,_0x169e55){_0x1a3cc3=_0x1a3cc3-0x0;var _0x3ef2c9=_0xc6a2[_0x1a3cc3];return _0x3ef2c9;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var auth=require(_0x2c6a('0x5'));var interaction=require(_0x2c6a('0x6'));var config=require(_0x2c6a('0x7'));var controller=require(_0x2c6a('0x8'));router[_0x2c6a('0x9')]('/',auth[_0x2c6a('0xa')](),controller[_0x2c6a('0xb')]);router[_0x2c6a('0x9')](_0x2c6a('0xc'),auth[_0x2c6a('0xa')](),controller[_0x2c6a('0xd')]);router['get'](_0x2c6a('0xe'),auth[_0x2c6a('0xa')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0x10')]('/',auth[_0x2c6a('0xa')](),controller[_0x2c6a('0x11')]);router[_0x2c6a('0x12')](_0x2c6a('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2c6a('0x13')](_0x2c6a('0xe'),auth[_0x2c6a('0xa')](),controller[_0x2c6a('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbd36=['/:id','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x44f630,_0xcdd7f8){var _0x3633ef=function(_0x19d9d4){while(--_0x19d9d4){_0x44f630['push'](_0x44f630['shift']());}};_0x3633ef(++_0xcdd7f8);}(_0xbd36,0x65));var _0x6bd3=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xbd36[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var path=require(_0x6bd3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bd3('0x3')]();var auth=require(_0x6bd3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6bd3('0x5'));var controller=require(_0x6bd3('0x6'));router[_0x6bd3('0x7')]('/',auth[_0x6bd3('0x8')](),controller['index']);router[_0x6bd3('0x7')](_0x6bd3('0x9'),auth[_0x6bd3('0x8')](),controller[_0x6bd3('0xa')]);router[_0x6bd3('0x7')](_0x6bd3('0xb'),auth[_0x6bd3('0x8')](),controller['show']);router['post']('/',auth[_0x6bd3('0x8')](),controller['create']);router[_0x6bd3('0xc')](_0x6bd3('0xb'),auth[_0x6bd3('0x8')](),controller[_0x6bd3('0xd')]);router[_0x6bd3('0xe')]('/:id',auth[_0x6bd3('0x8')](),controller[_0x6bd3('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index ac2e895..87d7fc6 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a2ea6d0..d1aae92 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 _0x729c=['find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','map','VIRTUAL','merge','options','WhatsappTransferReport','then','findAll','rows','catch','params','rawAttributes','filtears','includeAll','include'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x729c,0xa2));var _0xc729=function(_0x3c1cf2,_0x1357fc){_0x3c1cf2=_0x3c1cf2-0x0;var _0x2027a8=_0x729c[_0x3c1cf2];return _0x2027a8;};'use strict';var pdf=require(_0xc729('0x0'));var emlformat=require(_0xc729('0x1'));var rimraf=require(_0xc729('0x2'));var zipdir=require(_0xc729('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc729('0x4'));var moment=require(_0xc729('0x5'));var BPromise=require(_0xc729('0x6'));var Mustache=require(_0xc729('0x7'));var util=require(_0xc729('0x8'));var path=require(_0xc729('0x9'));var sox=require(_0xc729('0xa'));var csv=require(_0xc729('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc729('0xc'));var crypto=require(_0xc729('0xd'));var jsforce=require(_0xc729('0xe'));var deskjs=require(_0xc729('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc729('0x10'));var Papa=require(_0xc729('0x11'));var Redis=require(_0xc729('0x12'));var authService=require(_0xc729('0x13'));var qs=require(_0xc729('0x14'));var as=require(_0xc729('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc729('0x16'));var utils=require(_0xc729('0x17'));var config=require(_0xc729('0x18'));var licenseUtil=require(_0xc729('0x19'));var db=require(_0xc729('0x1a'))['db'];function respondWithStatusCode(_0x571cb0,_0x2c4531){_0x2c4531=_0x2c4531||0xcc;return function(_0x5f1294){if(_0x5f1294){return _0x571cb0[_0xc729('0x1b')](_0x2c4531);}return _0x571cb0['status'](_0x2c4531)[_0xc729('0x1c')]();};}function respondWithResult(_0x2cf43f,_0x1d15ec){_0x1d15ec=_0x1d15ec||0xc8;return function(_0x1ab1b2){if(_0x1ab1b2){return _0x2cf43f[_0xc729('0x1d')](_0x1d15ec)['json'](_0x1ab1b2);}};}function respondWithFilteredResult(_0x2e6ba7,_0x16d83b){return function(_0x585a02){if(_0x585a02){var _0x35fa0e=_0x585a02[_0xc729('0x1e')],_0x258e7a=_0x16d83b[_0xc729('0x1f')],_0x3dd7ea=_0x16d83b[_0xc729('0x1f')]+_0x16d83b[_0xc729('0x20')],_0x445677;if(_0x3dd7ea>=_0x35fa0e){_0x3dd7ea=_0x35fa0e;_0x445677=0xc8;}else{_0x445677=0xce;}_0x2e6ba7[_0xc729('0x1d')](_0x445677);return _0x2e6ba7[_0xc729('0x21')](_0xc729('0x22'),_0x258e7a+'-'+_0x3dd7ea+'/'+_0x35fa0e)['json'](_0x585a02);}return null;};}function patchUpdates(_0x452176){return function(_0x1a23fc){try{jsonpatch['apply'](_0x1a23fc,_0x452176,!![]);}catch(_0x50c4ad){return BPromise[_0xc729('0x23')](_0x50c4ad);}return _0x1a23fc[_0xc729('0x24')]();};}function saveUpdates(_0x4fdcbd,_0x13ff6d){return function(_0x56f1b5){if(_0x56f1b5){return _0x56f1b5[_0xc729('0x25')](_0x4fdcbd)['then'](function(_0x1d19ef){return _0x1d19ef;});}return null;};}function removeEntity(_0x5ab08d,_0x53b46){return function(_0x1460d0){if(_0x1460d0){return _0x1460d0[_0xc729('0x26')]()['then'](function(){_0x5ab08d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x362dda,_0x196aa3){return function(_0xfedde9){if(!_0xfedde9){_0x362dda[_0xc729('0x1b')](0x194);}return _0xfedde9;};}function handleError(_0x412fbd,_0x2c70d7){_0x2c70d7=_0x2c70d7||0x1f4;return function(_0x2578d){logger[_0xc729('0x27')](_0x2578d[_0xc729('0x28')]);if(_0x2578d[_0xc729('0x29')]){delete _0x2578d[_0xc729('0x29')];}_0x412fbd[_0xc729('0x1d')](_0x2c70d7)[_0xc729('0x2a')](_0x2578d);};}exports[_0xc729('0x2b')]=function(_0x59369b,_0x5a1cef){var _0x823704={},_0xad4de4={},_0x557313={'count':0x0,'rows':[]};var _0x209718=_['map'](db['WhatsappTransferReport']['rawAttributes'],function(_0x255e29){return{'name':_0x255e29[_0xc729('0x2c')],'type':_0x255e29[_0xc729('0x2d')][_0xc729('0x2e')]};});_0xad4de4[_0xc729('0x2f')]=_['map'](_0x209718,_0xc729('0x29'));_0xad4de4['query']=_[_0xc729('0x30')](_0x59369b['query']);_0xad4de4['filters']=_['intersection'](_0xad4de4[_0xc729('0x2f')],_0xad4de4[_0xc729('0x31')]);_0x823704[_0xc729('0x32')]=_[_0xc729('0x33')](_0xad4de4['model'],qs[_0xc729('0x34')](_0x59369b[_0xc729('0x31')][_0xc729('0x34')]));_0x823704[_0xc729('0x32')]=_0x823704['attributes'][_0xc729('0x35')]?_0x823704['attributes']:_0xad4de4['model'];if(!_0x59369b[_0xc729('0x31')]['hasOwnProperty'](_0xc729('0x36'))){_0x823704[_0xc729('0x20')]=qs[_0xc729('0x20')](_0x59369b[_0xc729('0x31')][_0xc729('0x20')]);_0x823704[_0xc729('0x1f')]=qs[_0xc729('0x1f')](_0x59369b['query'][_0xc729('0x1f')]);}_0x823704[_0xc729('0x37')]=qs[_0xc729('0x38')](_0x59369b[_0xc729('0x31')][_0xc729('0x38')]);_0x823704[_0xc729('0x39')]=qs[_0xc729('0x3a')](_[_0xc729('0x3b')](_0x59369b[_0xc729('0x31')],_0xad4de4[_0xc729('0x3a')]),_0x209718);if(_0x59369b['query'][_0xc729('0x3c')]){_0x823704[_0xc729('0x39')]=_['merge'](_0x823704[_0xc729('0x39')],{'$or':_[_0xc729('0x3d')](_0x209718,function(_0x3fbb4f){if(_0x3fbb4f[_0xc729('0x2d')]!==_0xc729('0x3e')){var _0x5aa301={};_0x5aa301[_0x3fbb4f[_0xc729('0x29')]]={'$like':'%'+_0x59369b[_0xc729('0x31')][_0xc729('0x3c')]+'%'};return _0x5aa301;}})});}_0x823704=_[_0xc729('0x3f')]({},_0x823704,_0x59369b[_0xc729('0x40')]);var _0xf266f8={'where':_0x823704[_0xc729('0x39')]};return db[_0xc729('0x41')][_0xc729('0x1e')](_0xf266f8)[_0xc729('0x42')](function(_0x407ed6){_0x557313[_0xc729('0x1e')]=_0x407ed6;if(_0x59369b[_0xc729('0x31')]['includeAll']){_0x823704['include']=[{'all':!![]}];}return db[_0xc729('0x41')][_0xc729('0x43')](_0x823704);})[_0xc729('0x42')](function(_0x369e8b){_0x557313[_0xc729('0x44')]=_0x369e8b;return _0x557313;})[_0xc729('0x42')](respondWithFilteredResult(_0x5a1cef,_0x823704))[_0xc729('0x45')](handleError(_0x5a1cef,null));};exports['show']=function(_0x5b4d3a,_0x1b607c){var _0xe56ef3={'raw':!![],'where':{'id':_0x5b4d3a[_0xc729('0x46')]['id']}},_0xb3dbd4={};_0xb3dbd4['model']=_[_0xc729('0x30')](db[_0xc729('0x41')][_0xc729('0x47')]);_0xb3dbd4[_0xc729('0x31')]=_[_0xc729('0x30')](_0x5b4d3a[_0xc729('0x31')]);_0xb3dbd4[_0xc729('0x48')]=_['intersection'](_0xb3dbd4['model'],_0xb3dbd4['query']);_0xe56ef3[_0xc729('0x32')]=_[_0xc729('0x33')](_0xb3dbd4[_0xc729('0x2f')],qs['fields'](_0x5b4d3a[_0xc729('0x31')][_0xc729('0x34')]));_0xe56ef3[_0xc729('0x32')]=_0xe56ef3[_0xc729('0x32')][_0xc729('0x35')]?_0xe56ef3[_0xc729('0x32')]:_0xb3dbd4[_0xc729('0x2f')];if(_0x5b4d3a['query'][_0xc729('0x49')]){_0xe56ef3[_0xc729('0x4a')]=[{'all':!![]}];}_0xe56ef3=_[_0xc729('0x3f')]({},_0xe56ef3,_0x5b4d3a['options']);return db[_0xc729('0x41')][_0xc729('0x4b')](_0xe56ef3)[_0xc729('0x42')](handleEntityNotFound(_0x1b607c,null))['then'](respondWithResult(_0x1b607c,null))['catch'](handleError(_0x1b607c,null));};exports[_0xc729('0x4c')]=function(_0x215414,_0x5b25eb){return db[_0xc729('0x41')][_0xc729('0x4c')](_0x215414[_0xc729('0x4d')],{})[_0xc729('0x42')](respondWithResult(_0x5b25eb,0xc9))[_0xc729('0x45')](handleError(_0x5b25eb,null));};exports['update']=function(_0x3039a3,_0x9fd425){if(_0x3039a3[_0xc729('0x4d')]['id']){delete _0x3039a3['body']['id'];}return db['WhatsappTransferReport'][_0xc729('0x4b')]({'where':{'id':_0x3039a3[_0xc729('0x46')]['id']}})[_0xc729('0x42')](handleEntityNotFound(_0x9fd425,null))[_0xc729('0x42')](saveUpdates(_0x3039a3[_0xc729('0x4d')],null))[_0xc729('0x42')](respondWithResult(_0x9fd425,null))[_0xc729('0x45')](handleError(_0x9fd425,null));};exports['destroy']=function(_0x3a9cad,_0x1535e9){return db[_0xc729('0x41')]['find']({'where':{'id':_0x3a9cad[_0xc729('0x46')]['id']}})[_0xc729('0x42')](handleEntityNotFound(_0x1535e9,null))['then'](removeEntity(_0x1535e9,null))[_0xc729('0x45')](handleError(_0x1535e9,null));};exports[_0xc729('0x4e')]=function(_0x19c41a,_0x5282db){return db[_0xc729('0x41')][_0xc729('0x4e')]()[_0xc729('0x42')](respondWithResult(_0x5282db,null))[_0xc729('0x45')](handleError(_0x5282db,null));}; \ No newline at end of file +var _0x01a5=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappTransferReport','count','includeAll','include','findAll','rows','show','params','filtears','intersection','find','catch','create','update','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters'];(function(_0x2b1f2b,_0x6221b0){var _0x594e8c=function(_0x179cf9){while(--_0x179cf9){_0x2b1f2b['push'](_0x2b1f2b['shift']());}};_0x594e8c(++_0x6221b0);}(_0x01a5,0x106));var _0x501a=function(_0x31090c,_0x1659b4){_0x31090c=_0x31090c-0x0;var _0x3656de=_0x01a5[_0x31090c];return _0x3656de;};'use strict';var pdf=require(_0x501a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x501a('0x1'));var zipdir=require(_0x501a('0x2'));var jsonpatch=require(_0x501a('0x3'));var rp=require(_0x501a('0x4'));var moment=require(_0x501a('0x5'));var BPromise=require(_0x501a('0x6'));var Mustache=require(_0x501a('0x7'));var util=require(_0x501a('0x8'));var path=require(_0x501a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x501a('0xa'));var fs=require('fs');var _=require(_0x501a('0xb'));var squel=require(_0x501a('0xc'));var crypto=require(_0x501a('0xd'));var jsforce=require(_0x501a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x501a('0xf'));var Papa=require(_0x501a('0x10'));var Redis=require(_0x501a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x501a('0x12'));var as=require(_0x501a('0x13'));var hardwareService=require(_0x501a('0x14'));var logger=require(_0x501a('0x15'))(_0x501a('0x16'));var utils=require(_0x501a('0x17'));var config=require(_0x501a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4199,_0x473f62){_0x473f62=_0x473f62||0xcc;return function(_0x1d0b49){if(_0x1d0b49){return _0x5e4199[_0x501a('0x19')](_0x473f62);}return _0x5e4199[_0x501a('0x1a')](_0x473f62)[_0x501a('0x1b')]();};}function respondWithResult(_0x69df89,_0x6a1183){_0x6a1183=_0x6a1183||0xc8;return function(_0x1bd3f3){if(_0x1bd3f3){return _0x69df89[_0x501a('0x1a')](_0x6a1183)[_0x501a('0x1c')](_0x1bd3f3);}};}function respondWithFilteredResult(_0x262655,_0x38c799){return function(_0x3aa68b){if(_0x3aa68b){var _0x1a2036=_0x3aa68b['count'],_0x305803=_0x38c799[_0x501a('0x1d')],_0x1c958f=_0x38c799[_0x501a('0x1d')]+_0x38c799[_0x501a('0x1e')],_0x3df0a7;if(_0x1c958f>=_0x1a2036){_0x1c958f=_0x1a2036;_0x3df0a7=0xc8;}else{_0x3df0a7=0xce;}_0x262655[_0x501a('0x1a')](_0x3df0a7);return _0x262655[_0x501a('0x1f')](_0x501a('0x20'),_0x305803+'-'+_0x1c958f+'/'+_0x1a2036)['json'](_0x3aa68b);}return null;};}function patchUpdates(_0x4575af){return function(_0x1ca0c7){try{jsonpatch[_0x501a('0x21')](_0x1ca0c7,_0x4575af,!![]);}catch(_0x24df51){return BPromise[_0x501a('0x22')](_0x24df51);}return _0x1ca0c7[_0x501a('0x23')]();};}function saveUpdates(_0x463a16,_0x3680b6){return function(_0x4bd009){if(_0x4bd009){return _0x4bd009['update'](_0x463a16)[_0x501a('0x24')](function(_0x39219b){return _0x39219b;});}return null;};}function removeEntity(_0xd73b7f,_0x1eaa10){return function(_0x298097){if(_0x298097){return _0x298097[_0x501a('0x25')]()['then'](function(){_0xd73b7f[_0x501a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3c1a,_0x285187){return function(_0x2d8d62){if(!_0x2d8d62){_0x5c3c1a[_0x501a('0x19')](0x194);}return _0x2d8d62;};}function handleError(_0x39a5eb,_0x4a088c){_0x4a088c=_0x4a088c||0x1f4;return function(_0x220c16){logger[_0x501a('0x26')](_0x220c16['stack']);if(_0x220c16[_0x501a('0x27')]){delete _0x220c16[_0x501a('0x27')];}_0x39a5eb[_0x501a('0x1a')](_0x4a088c)[_0x501a('0x28')](_0x220c16);};}exports[_0x501a('0x29')]=function(_0x26f165,_0x23edcd){var _0xf494d9={},_0x21d190={},_0x837673={'count':0x0,'rows':[]};var _0x4353ff=_[_0x501a('0x2a')](db['WhatsappTransferReport'][_0x501a('0x2b')],function(_0x32df66){return{'name':_0x32df66['fieldName'],'type':_0x32df66[_0x501a('0x2c')][_0x501a('0x2d')]};});_0x21d190[_0x501a('0x2e')]=_[_0x501a('0x2a')](_0x4353ff,_0x501a('0x27'));_0x21d190[_0x501a('0x2f')]=_[_0x501a('0x30')](_0x26f165[_0x501a('0x2f')]);_0x21d190[_0x501a('0x31')]=_['intersection'](_0x21d190[_0x501a('0x2e')],_0x21d190[_0x501a('0x2f')]);_0xf494d9[_0x501a('0x32')]=_['intersection'](_0x21d190[_0x501a('0x2e')],qs[_0x501a('0x33')](_0x26f165[_0x501a('0x2f')][_0x501a('0x33')]));_0xf494d9[_0x501a('0x32')]=_0xf494d9[_0x501a('0x32')][_0x501a('0x34')]?_0xf494d9['attributes']:_0x21d190[_0x501a('0x2e')];if(!_0x26f165[_0x501a('0x2f')][_0x501a('0x35')](_0x501a('0x36'))){_0xf494d9[_0x501a('0x1e')]=qs['limit'](_0x26f165[_0x501a('0x2f')][_0x501a('0x1e')]);_0xf494d9[_0x501a('0x1d')]=qs[_0x501a('0x1d')](_0x26f165[_0x501a('0x2f')][_0x501a('0x1d')]);}_0xf494d9['order']=qs[_0x501a('0x37')](_0x26f165[_0x501a('0x2f')]['sort']);_0xf494d9[_0x501a('0x38')]=qs[_0x501a('0x31')](_[_0x501a('0x39')](_0x26f165[_0x501a('0x2f')],_0x21d190[_0x501a('0x31')]),_0x4353ff);if(_0x26f165['query'][_0x501a('0x3a')]){_0xf494d9[_0x501a('0x38')]=_['merge'](_0xf494d9['where'],{'$or':_[_0x501a('0x2a')](_0x4353ff,function(_0x16c1aa){if(_0x16c1aa[_0x501a('0x2c')]!==_0x501a('0x3b')){var _0x1f6be2={};_0x1f6be2[_0x16c1aa[_0x501a('0x27')]]={'$like':'%'+_0x26f165[_0x501a('0x2f')][_0x501a('0x3a')]+'%'};return _0x1f6be2;}})});}_0xf494d9=_[_0x501a('0x3c')]({},_0xf494d9,_0x26f165[_0x501a('0x3d')]);var _0x257f01={'where':_0xf494d9[_0x501a('0x38')]};return db[_0x501a('0x3e')][_0x501a('0x3f')](_0x257f01)[_0x501a('0x24')](function(_0x75e49c){_0x837673['count']=_0x75e49c;if(_0x26f165['query'][_0x501a('0x40')]){_0xf494d9[_0x501a('0x41')]=[{'all':!![]}];}return db[_0x501a('0x3e')][_0x501a('0x42')](_0xf494d9);})['then'](function(_0x5b81a3){_0x837673[_0x501a('0x43')]=_0x5b81a3;return _0x837673;})[_0x501a('0x24')](respondWithFilteredResult(_0x23edcd,_0xf494d9))['catch'](handleError(_0x23edcd,null));};exports[_0x501a('0x44')]=function(_0x271d2d,_0x13fc21){var _0x30019e={'raw':!![],'where':{'id':_0x271d2d[_0x501a('0x45')]['id']}},_0x531cd6={};_0x531cd6[_0x501a('0x2e')]=_[_0x501a('0x30')](db[_0x501a('0x3e')][_0x501a('0x2b')]);_0x531cd6['query']=_[_0x501a('0x30')](_0x271d2d[_0x501a('0x2f')]);_0x531cd6[_0x501a('0x46')]=_[_0x501a('0x47')](_0x531cd6[_0x501a('0x2e')],_0x531cd6['query']);_0x30019e[_0x501a('0x32')]=_['intersection'](_0x531cd6['model'],qs[_0x501a('0x33')](_0x271d2d[_0x501a('0x2f')]['fields']));_0x30019e[_0x501a('0x32')]=_0x30019e[_0x501a('0x32')][_0x501a('0x34')]?_0x30019e['attributes']:_0x531cd6['model'];if(_0x271d2d[_0x501a('0x2f')][_0x501a('0x40')]){_0x30019e[_0x501a('0x41')]=[{'all':!![]}];}_0x30019e=_['merge']({},_0x30019e,_0x271d2d[_0x501a('0x3d')]);return db[_0x501a('0x3e')][_0x501a('0x48')](_0x30019e)[_0x501a('0x24')](handleEntityNotFound(_0x13fc21,null))[_0x501a('0x24')](respondWithResult(_0x13fc21,null))[_0x501a('0x49')](handleError(_0x13fc21,null));};exports[_0x501a('0x4a')]=function(_0x660ff2,_0x2c602c){return db[_0x501a('0x3e')]['create'](_0x660ff2['body'],{})[_0x501a('0x24')](respondWithResult(_0x2c602c,0xc9))[_0x501a('0x49')](handleError(_0x2c602c,null));};exports[_0x501a('0x4b')]=function(_0x482508,_0x5c125b){if(_0x482508[_0x501a('0x4c')]['id']){delete _0x482508[_0x501a('0x4c')]['id'];}return db[_0x501a('0x3e')][_0x501a('0x48')]({'where':{'id':_0x482508[_0x501a('0x45')]['id']}})[_0x501a('0x24')](handleEntityNotFound(_0x5c125b,null))['then'](saveUpdates(_0x482508[_0x501a('0x4c')],null))['then'](respondWithResult(_0x5c125b,null))['catch'](handleError(_0x5c125b,null));};exports[_0x501a('0x25')]=function(_0x573765,_0x2b635f){return db[_0x501a('0x3e')]['find']({'where':{'id':_0x573765[_0x501a('0x45')]['id']}})[_0x501a('0x24')](handleEntityNotFound(_0x2b635f,null))[_0x501a('0x24')](removeEntity(_0x2b635f,null))[_0x501a('0x49')](handleError(_0x2b635f,null));};exports[_0x501a('0x4d')]=function(_0xce08a0,_0x553014){return db[_0x501a('0x3e')]['describe']()[_0x501a('0x24')](respondWithResult(_0x553014,null))[_0x501a('0x49')](handleError(_0x553014,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 0fe529d..b24151f 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 _0xca91=['moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','api'];(function(_0x4c55e0,_0x55f135){var _0x2a4a0b=function(_0x1b7961){while(--_0x1b7961){_0x4c55e0['push'](_0x4c55e0['shift']());}};_0x2a4a0b(++_0x55f135);}(_0xca91,0x11c));var _0x1ca9=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0xca91[_0x5c7a85];return _0x35290f;};'use strict';var _=require(_0x1ca9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1ca9('0x1'));var moment=require(_0x1ca9('0x2'));var BPromise=require(_0x1ca9('0x3'));var rp=require(_0x1ca9('0x4'));var fs=require('fs');var path=require(_0x1ca9('0x5'));var rimraf=require('rimraf');var config=require(_0x1ca9('0x6'));var attributes=require(_0x1ca9('0x7'));module[_0x1ca9('0x8')]=function(_0x32a6d7,_0x182bae){return _0x32a6d7[_0x1ca9('0x9')](_0x1ca9('0xa'),attributes,{'tableName':_0x1ca9('0xb'),'paranoid':![],'indexes':[{'name':_0x1ca9('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a1=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x72d276,_0x5c0a71){var _0x295b10=function(_0x2b43f5){while(--_0x2b43f5){_0x72d276['push'](_0x72d276['shift']());}};_0x295b10(++_0x5c0a71);}(_0xc9a1,0x16c));var _0x1c9a=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xc9a1[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x1c9a('0x0'));var util=require(_0x1c9a('0x1'));var logger=require(_0x1c9a('0x2'))(_0x1c9a('0x3'));var moment=require(_0x1c9a('0x4'));var BPromise=require('bluebird');var rp=require(_0x1c9a('0x5'));var fs=require('fs');var path=require(_0x1c9a('0x6'));var rimraf=require(_0x1c9a('0x7'));var config=require(_0x1c9a('0x8'));var attributes=require(_0x1c9a('0x9'));module['exports']=function(_0x603131,_0x319ca2){return _0x603131[_0x1c9a('0xa')](_0x1c9a('0xb'),attributes,{'tableName':_0x1c9a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1c9a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e12eceb..dc68fa7 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(_0x18f494,_0x327686){var _0x3556d9=function(_0x5f0306){while(--_0x5f0306){_0x18f494['push'](_0x18f494['shift']());}};_0x3556d9(++_0x327686);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x48534b,_0x50b667){var _0xec9865=function(_0x407395){while(--_0x407395){_0x48534b['push'](_0x48534b['shift']());}};_0xec9865(++_0x50b667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f848a6d..0fea78f 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad2f=['filter','online','name','join','status','None','./config/seedDB','default','./config/license','catch','error','exit','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','start','info','map'];(function(_0x57ce19,_0x5e3efd){var _0x52b5a7=function(_0x1ed1a2){while(--_0x1ed1a2){_0x57ce19['push'](_0x57ce19['shift']());}};_0x52b5a7(++_0x5e3efd);}(_0xad2f,0x1f2));var _0xfad2=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xad2f[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var mysqldb=require(_0xfad2('0x0'));var rpc=require('./rpc');var config=require(_0xfad2('0x1'));var logger=require(_0xfad2('0x2'))(_0xfad2('0x3'));var pm2=require(_0xfad2('0x4'));var pm2Config=require(_0xfad2('0x5'));var schedule=require(_0xfad2('0x6'));var chat=require(_0xfad2('0x7'));var transcribe=require(_0xfad2('0x8'));function main(){return mysqldb['db']['sequelize'][_0xfad2('0x9')]()[_0xfad2('0xa')](function(){return rpc[_0xfad2('0xb')]();})['then'](function(_0x34e5d4){logger['info'](_0x34e5d4);return chat[_0xfad2('0xc')]();})[_0xfad2('0xa')](function(){return schedule[_0xfad2('0xc')]();})[_0xfad2('0xa')](function(){return transcribe[_0xfad2('0xc')]();})[_0xfad2('0xa')](function(_0x2c5544){logger[_0xfad2('0xd')](_0x2c5544);return pm2[_0xfad2('0xc')](pm2Config);})['then'](function(_0x5119b4){logger['info']('Online\x20apps:',_[_0xfad2('0xe')](_[_0xfad2('0xf')](_0x5119b4,{'status':_0xfad2('0x10')}),_0xfad2('0x11'))[_0xfad2('0x12')]());logger[_0xfad2('0xd')]('Offline\x20apps:',_[_0xfad2('0xe')](_[_0xfad2('0xf')](_0x5119b4,function(_0x22b987){return _0x22b987[_0xfad2('0x13')]!==_0xfad2('0x10');}),_0xfad2('0x11'))[_0xfad2('0x12')]()||_0xfad2('0x14'));config['seedDB']&&require(_0xfad2('0x15'))[_0xfad2('0x16')]();require(_0xfad2('0x17'))['default']();})[_0xfad2('0x18')](function(_0x428e91){logger[_0xfad2('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x428e91);process[_0xfad2('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x793e=['None','./config/seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/chat','sequelize','listen','info','start','then','Online\x20apps:','filter','name','map','status','online','join'];(function(_0x59af3b,_0x116878){var _0x59b03f=function(_0x350f14){while(--_0x350f14){_0x59af3b['push'](_0x59af3b['shift']());}};_0x59b03f(++_0x116878);}(_0x793e,0x83));var _0xe793=function(_0x1605b7,_0x13302a){_0x1605b7=_0x1605b7-0x0;var _0x3c6527=_0x793e[_0x1605b7];return _0x3c6527;};'use strict';var _=require('lodash');var mysqldb=require(_0xe793('0x0'));var rpc=require(_0xe793('0x1'));var config=require(_0xe793('0x2'));var logger=require(_0xe793('0x3'))(_0xe793('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0xe793('0x5'));var schedule=require('./config/schedule');var chat=require(_0xe793('0x6'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xe793('0x7')]['sync']()['then'](function(){return rpc[_0xe793('0x8')]();})['then'](function(_0x4f05e1){logger[_0xe793('0x9')](_0x4f05e1);return chat[_0xe793('0xa')]();})['then'](function(){return schedule[_0xe793('0xa')]();})[_0xe793('0xb')](function(){return transcribe[_0xe793('0xa')]();})[_0xe793('0xb')](function(_0x3db4ef){logger[_0xe793('0x9')](_0x3db4ef);return pm2[_0xe793('0xa')](pm2Config);})['then'](function(_0x51a7e1){logger[_0xe793('0x9')](_0xe793('0xc'),_['map'](_[_0xe793('0xd')](_0x51a7e1,{'status':'online'}),_0xe793('0xe'))['join']());logger[_0xe793('0x9')]('Offline\x20apps:',_[_0xe793('0xf')](_[_0xe793('0xd')](_0x51a7e1,function(_0x2a2fba){return _0x2a2fba[_0xe793('0x10')]!==_0xe793('0x11');}),_0xe793('0xe'))[_0xe793('0x12')]()||_0xe793('0x13'));config['seedDB']&&require(_0xe793('0x14'))[_0xe793('0x15')]();require('./config/license')[_0xe793('0x15')]();})[_0xe793('0x16')](function(_0x3d7aff){logger['error'](_0xe793('0x17'),_0x3d7aff);process[_0xe793('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index a731e94..d977ca9 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 _0x2f9a=['phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','then','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','startsWith','authorization','Basic','find','authenticate','pass','json','Bearer','query','apikey','getUuid','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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~!@#$%^&-_=+[{]}.','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','decryptString','split','length','splice','unshift','sign','secret','payload','options','promisify','verify','toString','floor','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','util','secrets','session','role','fullname','name','internal','email','userpic','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f9a,0x13a));var _0xa2f9=function(_0x1486ce,_0x233c7f){_0x1486ce=_0x1486ce-0x0;var _0x10a7b2=_0x2f9a[_0x1486ce];return _0x10a7b2;};'use strict';var db=require(_0xa2f9('0x0'))['db'];var config=require(_0xa2f9('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xa2f9('0x2'));var encryptor=require(_0xa2f9('0x3'));var _=require('lodash');var jwt=require(_0xa2f9('0x4'));var expressJwt=require(_0xa2f9('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0xa2f9('0x6'));var crypto=require(_0xa2f9('0x7'));var BPromise=require('bluebird');var util=require(_0xa2f9('0x8'));var validateJwt=expressJwt({'secret':config[_0xa2f9('0x9')][_0xa2f9('0xa')]});var userAttributes=['id',_0xa2f9('0xb'),_0xa2f9('0xc'),_0xa2f9('0xd'),_0xa2f9('0xe'),_0xa2f9('0xf'),_0xa2f9('0x10'),'permissions',_0xa2f9('0x11'),_0xa2f9('0x12'),_0xa2f9('0x13'),'mailPause',_0xa2f9('0x14'),_0xa2f9('0x15'),_0xa2f9('0x16'),'pauseType','showWebBar',_0xa2f9('0x17'),_0xa2f9('0x18'),_0xa2f9('0x19'),_0xa2f9('0x1a'),_0xa2f9('0x1b'),_0xa2f9('0x1c'),_0xa2f9('0x1d'),_0xa2f9('0x1e'),_0xa2f9('0x1f'),'phoneBarEnableRecording',_0xa2f9('0x20'),_0xa2f9('0x21'),_0xa2f9('0x22'),_0xa2f9('0x23'),'phoneBarRemoteControl',_0xa2f9('0x24'),_0xa2f9('0x25'),_0xa2f9('0x26'),_0xa2f9('0x27'),_0xa2f9('0x28')];exports[_0xa2f9('0x29')]=function(){return this[_0xa2f9('0x2a')](!![])[_0xa2f9('0x2b')](function(_0xe3f59f,_0x53db9f,_0x4214f3){if(_0xe3f59f[_0xa2f9('0x2c')]){_0x4214f3();}else{return db[_0xa2f9('0x2d')][_0xa2f9('0x2e')]({'where':{'id':_0xe3f59f[_0xa2f9('0x2f')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0xa2f9('0x30')](function(_0x5982e9){if(_0x5982e9&&_0x5982e9['closed']){return _0x53db9f[_0xa2f9('0x31')](_0x5982e9[_0xa2f9('0x32')]===_0xa2f9('0x33')?0x195:0x193)['json']({'message':_0x5982e9[_0xa2f9('0x32')]===_0xa2f9('0x33')?_0xa2f9('0x34'):_0xa2f9('0x35')});}else{_0x4214f3();}})[_0xa2f9('0x36')](function(_0x8eac03){_0x4214f3(_0x8eac03);});}});};exports['isAuthenticated']=function isAuthenticated(_0x593bd7){return compose()[_0xa2f9('0x2b')](function(_0x4d64d4,_0x1dfe64,_0x4961ff){if(_0x4d64d4[_0xa2f9('0x37')]['authorization']){if(_[_0xa2f9('0x38')](_0x4d64d4[_0xa2f9('0x37')][_0xa2f9('0x39')],_0xa2f9('0x3a'))){var _0x434a93=basicAuth(_0x4d64d4);db['User'][_0xa2f9('0x3b')]({'where':{'name':_0x434a93['name']}})['then'](function(_0x4cfa67){if(!_0x4cfa67||!_0x4cfa67[_0xa2f9('0x3c')](_0x434a93[_0xa2f9('0x3d')])){return _0x1dfe64[_0xa2f9('0x31')](0x191)[_0xa2f9('0x3e')]({'message':'Wrong\x20credentials.'});}_0x4d64d4[_0xa2f9('0x2c')]={'id':_0x4cfa67['id']};_0x4961ff();})['catch'](function(_0x2d6712){_0x4961ff(_0x2d6712);});}else if(_[_0xa2f9('0x38')](_0x4d64d4[_0xa2f9('0x37')][_0xa2f9('0x39')],_0xa2f9('0x3f'))){validateJwt(_0x4d64d4,_0x1dfe64,_0x4961ff);}else{if(_0x593bd7){_0x4961ff();}else{return _0x1dfe64['status'](0x193)[_0xa2f9('0x3e')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4d64d4[_0xa2f9('0x40')][_0xa2f9('0x41')]){try{var _0x5aef87={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa2f9('0x42')]()};verifyJwt(_0x4d64d4['query'][_0xa2f9('0x41')],_0x5aef87)[_0xa2f9('0x30')](function(_0x10385d){return db['User'][_0xa2f9('0x3b')]({'where':{'id':_0x10385d[_0xa2f9('0x43')]}})[_0xa2f9('0x30')](function(_0x127c7a){if(!_0x127c7a||!_[_0xa2f9('0x44')](_0x127c7a[_0xa2f9('0x45')],_0x10385d[_0xa2f9('0x46')])){return _0x1dfe64[_0xa2f9('0x31')](0x191)['json']({'message':_0xa2f9('0x47')});}_0x4d64d4['user']={'id':_0x127c7a['id']};_0x4961ff();});})[_0xa2f9('0x36')](function(){return _0x1dfe64['status'](0x191)['json']({'message':_0xa2f9('0x48')});});}catch(_0x1a5b44){_0x4961ff(_0x1a5b44);}}else if(_0x593bd7){_0x4961ff();}else{return _0x1dfe64[_0xa2f9('0x31')](0x193)[_0xa2f9('0x3e')]({'message':_0xa2f9('0x49')});}})['use'](function(_0x386301,_0x5e9f91,_0x1e05b9){if(_0x386301[_0xa2f9('0x2c')]){db[_0xa2f9('0x4a')][_0xa2f9('0x3b')]({'where':{'id':_0x386301[_0xa2f9('0x2c')]['id']},'attributes':userAttributes})[_0xa2f9('0x30')](function(_0x2bb6b5){if(!_0x2bb6b5){return _0x5e9f91['status'](0x194)[_0xa2f9('0x3e')]({'message':_0xa2f9('0x4b')});}_0x386301[_0xa2f9('0x2c')]=_0x2bb6b5;_0x1e05b9();})[_0xa2f9('0x36')](function(_0x48a842){_0x1e05b9(_0x48a842);});}else if(_0x593bd7){_0x1e05b9();}else{return _0x5e9f91[_0xa2f9('0x31')](0x194)[_0xa2f9('0x3e')]({'message':_0xa2f9('0x4c')});}});};exports[_0xa2f9('0x4d')]=function canUpdate(){return compose()['use'](function(_0x201ddf,_0x35c681,_0x3fe597){return licenseUtil[_0xa2f9('0x4e')]()[_0xa2f9('0x30')](function(_0x35164b){if(_0x35164b[_0xa2f9('0x4f')]){_0x3fe597();}else{return _0x35c681[_0xa2f9('0x31')](0x193)[_0xa2f9('0x3e')]({'message':_0xa2f9('0x50')});}})['catch'](function(_0x3daf06){_0x3fe597(_0x3daf06);});});};exports['isMiddleware']=function(_0x362dc0,_0x3128eb,_0x4edc69){_0x362dc0[_0xa2f9('0x51')]=!![];return _0x4edc69();};exports[_0xa2f9('0x52')]=function signToken(_0x607933){return signJwt(_0x607933);};exports[_0xa2f9('0x53')]=function(_0x21663a,_0xcb05a3){if(!_0x21663a[_0xa2f9('0x2c')]){return _0xcb05a3[_0xa2f9('0x31')](0x194)[_0xa2f9('0x3e')]({'message':_0xa2f9('0x54')});}var _0x17b50d={'payload':{'id':_0x21663a[_0xa2f9('0x2c')]['id'],'role':_0x21663a[_0xa2f9('0x2c')][_0xa2f9('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x17b50d)['then'](function(_0x59a62a){_0xcb05a3[_0xa2f9('0x55')](_0xa2f9('0x56'),_0x59a62a);_0xcb05a3[_0xa2f9('0x57')](_0xa2f9('0x58'));})['catch'](function(_0x4bca57){return _0xcb05a3['status'](0x1f4)[_0xa2f9('0x59')](_0x4bca57);});};exports[_0xa2f9('0x5a')]=function(_0x18d67d){if(_[_0xa2f9('0x5b')](_0x18d67d[_0xa2f9('0x45')])||_['isNil'](_0x18d67d['apiKeyIat'])){return null;}else{return createJwt(_0x18d67d);}};exports['generateApiKey']=function(_0x3e4042){_0x3e4042[_0xa2f9('0x45')]=generateNonce();_0x3e4042[_0xa2f9('0x5c')]=generateIssuedAt();return createJwt(_0x3e4042);};exports[_0xa2f9('0x5d')]=function(_0x2a57b2,_0x1469e6){var _0x51ae43=_0x2a57b2[_0xa2f9('0x40')]['apikey'];if(_0x51ae43){var _0x9cd91b={'nonce':_0x1469e6[_0xa2f9('0x45')],'iat':_0x1469e6[_0xa2f9('0x5c')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa2f9('0x42')]()};return verifyJwt(_0x51ae43,_0x9cd91b)[_0xa2f9('0x30')](function(){return generateApiKey(_0x1469e6);});}else{throw{'message':_0xa2f9('0x5e')};}};exports[_0xa2f9('0x5f')]=function(_0x49add5){var _0x39da23=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x39da23['test'](_0x49add5))throw new db[(_0xa2f9('0x60'))][(_0xa2f9('0x61'))](_0xa2f9('0x62'));return;};exports['validatePasswordHistory']=function(_0x5df831,_0x347419,_0x548cf1){var _0x25e8c1=encryptor['decryptString'](_0x347419)['split'](',');for(var _0x43eebb=0x0;_0x43eebb<_0x548cf1;_0x43eebb++){if(!_0x25e8c1[_0x43eebb])break;if(_0x5df831['toLowerCase']()===_0x25e8c1[_0x43eebb][_0xa2f9('0x63')]()){var _0x18a43f=util[_0xa2f9('0x64')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x548cf1);if(_0x548cf1===0x1){_0x18a43f=_0xa2f9('0x65');}throw new db['Sequelize'][(_0xa2f9('0x61'))](_0x18a43f);}}return;};exports['updatePasswordsHistory']=function(_0x43454d,_0x535b1b){var _0x452a4e=_0x535b1b?encryptor[_0xa2f9('0x66')](_0x535b1b)[_0xa2f9('0x67')](','):[];if(_0x452a4e[_0xa2f9('0x68')]===0x5){_0x452a4e[_0xa2f9('0x69')](-0x1,0x1);}_0x452a4e[_0xa2f9('0x6a')](_0x43454d);return encryptor['encryptString'](_0x452a4e['join'](','));};function signJwt(_0x17fb93){var _0x29dcf1=BPromise['promisify'](jwt[_0xa2f9('0x6b')],{'context':jwt});var _0x12e181=_0x17fb93[_0xa2f9('0x6c')]||config['secrets'][_0xa2f9('0xa')];return new BPromise(function(_0x149369,_0x233b96){_0x29dcf1(_0x17fb93[_0xa2f9('0x6d')],_0x12e181,_0x17fb93[_0xa2f9('0x6e')])['then'](function(_0x8d985){_0x149369(_0x8d985);})[_0xa2f9('0x36')](function(_0x6b90e){_0x233b96(_0x6b90e);});});}function verifyJwt(_0x72fa2,_0x54a008,_0x1fca08){var _0x5b9557=BPromise[_0xa2f9('0x6f')](jwt[_0xa2f9('0x70')],{'context':jwt});var _0x263ca3=_0x1fca08||config[_0xa2f9('0x9')][_0xa2f9('0xa')];return new BPromise(function(_0x59164d,_0x37e1b6){_0x5b9557(_0x72fa2,_0x263ca3,_0x54a008)[_0xa2f9('0x30')](function(_0x6434fa){_0x59164d(_0x6434fa);})[_0xa2f9('0x36')](function(_0x2d5cae){_0x37e1b6(_0x2d5cae);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xa2f9('0x71')]('hex');}function generateIssuedAt(){return Math[_0xa2f9('0x72')](Date['now']()/0x3e8)[_0xa2f9('0x71')]();}function createJwt(_0x4f893e){var _0x27341c={'payload':{'iat':_0x4f893e[_0xa2f9('0x5c')],'nonce':_0x4f893e[_0xa2f9('0x45')]},'options':{'algorithm':'HS512','subject':_0x4f893e['id'][_0xa2f9('0x71')](),'issuer':hardwareConf[_0xa2f9('0x42')](),'audience':hardwareConf[_0xa2f9('0x42')]()}};return signJwt(_0x27341c)[_0xa2f9('0x30')](function(_0x4e2079){return{'iat':_0x4f893e['apiKeyIat'],'nonce':_0x4f893e[_0xa2f9('0x45')],'token':_0x4e2079};});} \ No newline at end of file +var _0xbb60=['Forbidden.','catch','headers','Basic','User','then','authenticate','pass','status','Wrong\x20credentials.','startsWith','query','apikey','getUuid','find','sub','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','secret','payload','verify','randomBytes','hex','now','HS512','toString','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','userpic','permissions','md5secret','chatPause','faxPause','smsPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Unmanaged.'];(function(_0x13b798,_0x5ad253){var _0x24f295=function(_0x17a492){while(--_0x17a492){_0x13b798['push'](_0x13b798['shift']());}};_0x24f295(++_0x5ad253);}(_0xbb60,0xb0));var _0x0bb6=function(_0x17dfbf,_0x32a41d){_0x17dfbf=_0x17dfbf-0x0;var _0x2b90cb=_0xbb60[_0x17dfbf];return _0x2b90cb;};'use strict';var db=require(_0x0bb6('0x0'))['db'];var config=require(_0x0bb6('0x1'));var hardwareConf=require(_0x0bb6('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x0bb6('0x3'));var _=require(_0x0bb6('0x4'));var jwt=require(_0x0bb6('0x5'));var expressJwt=require(_0x0bb6('0x6'));var compose=require(_0x0bb6('0x7'));var basicAuth=require(_0x0bb6('0x8'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x0bb6('0x9'));var validateJwt=expressJwt({'secret':config[_0x0bb6('0xa')][_0x0bb6('0xb')]});var userAttributes=['id',_0x0bb6('0xc'),'fullname',_0x0bb6('0xd'),_0x0bb6('0xe'),_0x0bb6('0xf'),_0x0bb6('0x10'),_0x0bb6('0x11'),_0x0bb6('0x12'),'voicePause',_0x0bb6('0x13'),'mailPause',_0x0bb6('0x14'),_0x0bb6('0x15'),'openchannelPause','pauseType',_0x0bb6('0x16'),_0x0bb6('0x17'),'lastPauseAt',_0x0bb6('0x18'),_0x0bb6('0x19'),_0x0bb6('0x1a'),_0x0bb6('0x1b'),_0x0bb6('0x1c'),'phoneBarAutoAnswerDelay',_0x0bb6('0x1d'),_0x0bb6('0x1e'),_0x0bb6('0x1f'),_0x0bb6('0x20'),_0x0bb6('0x21'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x0bb6('0x22'),_0x0bb6('0x23'),_0x0bb6('0x24'),'userProfileId',_0x0bb6('0x25')];exports[_0x0bb6('0x26')]=function(){return this[_0x0bb6('0x27')](!![])[_0x0bb6('0x28')](function(_0xc365da,_0x1a7eca,_0x1dc7c1){if(_0xc365da[_0x0bb6('0x29')]){_0x1dc7c1();}else{return db[_0x0bb6('0x2a')][_0x0bb6('0x2b')]({'where':{'id':_0xc365da[_0x0bb6('0x2c')]['id']},'attributes':['id',_0x0bb6('0x2d'),_0x0bb6('0x2e')],'raw':!![]})['then'](function(_0x343be6){if(_0x343be6&&_0x343be6[_0x0bb6('0x2d')]){return _0x1a7eca['status'](_0x343be6['disposition']===_0x0bb6('0x2f')?0x195:0x193)[_0x0bb6('0x30')]({'message':_0x343be6[_0x0bb6('0x2e')]===_0x0bb6('0x2f')?_0x0bb6('0x31'):_0x0bb6('0x32')});}else{_0x1dc7c1();}})[_0x0bb6('0x33')](function(_0xcb3dd){_0x1dc7c1(_0xcb3dd);});}});};exports[_0x0bb6('0x27')]=function isAuthenticated(_0xffd1b4){return compose()['use'](function(_0x39af1f,_0x5daf15,_0x4e7a1e){if(_0x39af1f[_0x0bb6('0x34')]['authorization']){if(_['startsWith'](_0x39af1f[_0x0bb6('0x34')]['authorization'],_0x0bb6('0x35'))){var _0x3d9fe6=basicAuth(_0x39af1f);db[_0x0bb6('0x36')]['find']({'where':{'name':_0x3d9fe6['name']}})[_0x0bb6('0x37')](function(_0x5143b6){if(!_0x5143b6||!_0x5143b6[_0x0bb6('0x38')](_0x3d9fe6[_0x0bb6('0x39')])){return _0x5daf15[_0x0bb6('0x3a')](0x191)[_0x0bb6('0x30')]({'message':_0x0bb6('0x3b')});}_0x39af1f[_0x0bb6('0x29')]={'id':_0x5143b6['id']};_0x4e7a1e();})[_0x0bb6('0x33')](function(_0x411103){_0x4e7a1e(_0x411103);});}else if(_[_0x0bb6('0x3c')](_0x39af1f[_0x0bb6('0x34')]['authorization'],'Bearer')){validateJwt(_0x39af1f,_0x5daf15,_0x4e7a1e);}else{if(_0xffd1b4){_0x4e7a1e();}else{return _0x5daf15[_0x0bb6('0x3a')](0x193)[_0x0bb6('0x30')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x39af1f[_0x0bb6('0x3d')][_0x0bb6('0x3e')]){try{var _0x32333b={'audience':hardwareConf[_0x0bb6('0x3f')](),'issuer':hardwareConf[_0x0bb6('0x3f')]()};verifyJwt(_0x39af1f[_0x0bb6('0x3d')][_0x0bb6('0x3e')],_0x32333b)[_0x0bb6('0x37')](function(_0x1f49d8){return db[_0x0bb6('0x36')][_0x0bb6('0x40')]({'where':{'id':_0x1f49d8[_0x0bb6('0x41')]}})[_0x0bb6('0x37')](function(_0x8155c0){if(!_0x8155c0||!_[_0x0bb6('0x42')](_0x8155c0[_0x0bb6('0x43')],_0x1f49d8[_0x0bb6('0x44')])){return _0x5daf15[_0x0bb6('0x3a')](0x191)[_0x0bb6('0x30')]({'message':_0x0bb6('0x45')});}_0x39af1f[_0x0bb6('0x29')]={'id':_0x8155c0['id']};_0x4e7a1e();});})[_0x0bb6('0x33')](function(){return _0x5daf15['status'](0x191)[_0x0bb6('0x30')]({'message':_0x0bb6('0x46')});});}catch(_0x50a4ec){_0x4e7a1e(_0x50a4ec);}}else if(_0xffd1b4){_0x4e7a1e();}else{return _0x5daf15['status'](0x193)[_0x0bb6('0x30')]({'message':_0x0bb6('0x47')});}})[_0x0bb6('0x28')](function(_0x3eafcd,_0x36b4e2,_0x58063f){if(_0x3eafcd[_0x0bb6('0x29')]){db[_0x0bb6('0x36')][_0x0bb6('0x40')]({'where':{'id':_0x3eafcd[_0x0bb6('0x29')]['id']},'attributes':userAttributes})[_0x0bb6('0x37')](function(_0x41cbe3){if(!_0x41cbe3){return _0x36b4e2[_0x0bb6('0x3a')](0x194)[_0x0bb6('0x30')]({'message':_0x0bb6('0x48')});}_0x3eafcd[_0x0bb6('0x29')]=_0x41cbe3;_0x58063f();})[_0x0bb6('0x33')](function(_0x33ea80){_0x58063f(_0x33ea80);});}else if(_0xffd1b4){_0x58063f();}else{return _0x36b4e2[_0x0bb6('0x3a')](0x194)[_0x0bb6('0x30')]({'message':_0x0bb6('0x49')});}});};exports[_0x0bb6('0x4a')]=function canUpdate(){return compose()['use'](function(_0x4a40b7,_0x4f4080,_0xe1b177){return licenseUtil[_0x0bb6('0x4b')]()[_0x0bb6('0x37')](function(_0x46784b){if(_0x46784b[_0x0bb6('0x4c')]){_0xe1b177();}else{return _0x4f4080['status'](0x193)['json']({'message':_0x0bb6('0x4d')});}})[_0x0bb6('0x33')](function(_0x4abfe0){_0xe1b177(_0x4abfe0);});});};exports[_0x0bb6('0x4e')]=function(_0x4bed30,_0x16f8a2,_0xd01a0b){_0x4bed30[_0x0bb6('0x4e')]=!![];return _0xd01a0b();};exports[_0x0bb6('0x4f')]=function signToken(_0x3d25ac){return signJwt(_0x3d25ac);};exports[_0x0bb6('0x50')]=function(_0x3463e2,_0x3a7d26){if(!_0x3463e2[_0x0bb6('0x29')]){return _0x3a7d26['status'](0x194)[_0x0bb6('0x30')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x52b49e={'payload':{'id':_0x3463e2[_0x0bb6('0x29')]['id'],'role':_0x3463e2[_0x0bb6('0x29')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x52b49e)[_0x0bb6('0x37')](function(_0x13c602){_0x3a7d26[_0x0bb6('0x51')](_0x0bb6('0x52'),_0x13c602);_0x3a7d26[_0x0bb6('0x53')](_0x0bb6('0x54'));})[_0x0bb6('0x33')](function(_0x16b933){return _0x3a7d26[_0x0bb6('0x3a')](0x1f4)[_0x0bb6('0x55')](_0x16b933);});};exports[_0x0bb6('0x56')]=function(_0x550dff){if(_['isNil'](_0x550dff[_0x0bb6('0x43')])||_[_0x0bb6('0x57')](_0x550dff['apiKeyIat'])){return null;}else{return createJwt(_0x550dff);}};exports['generateApiKey']=function(_0x374fd3){_0x374fd3['apiKeyNonce']=generateNonce();_0x374fd3['apiKeyIat']=generateIssuedAt();return createJwt(_0x374fd3);};exports['regenerateApiKey']=function(_0x3ad921,_0x522006){var _0x446c71=_0x3ad921[_0x0bb6('0x3d')][_0x0bb6('0x3e')];if(_0x446c71){var _0x526d31={'nonce':_0x522006[_0x0bb6('0x43')],'iat':_0x522006[_0x0bb6('0x58')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x0bb6('0x3f')]()};return verifyJwt(_0x446c71,_0x526d31)[_0x0bb6('0x37')](function(){return generateApiKey(_0x522006);});}else{throw{'message':_0x0bb6('0x59')};}};exports[_0x0bb6('0x5a')]=function(_0xb3d428){var _0x4d347f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4d347f[_0x0bb6('0x5b')](_0xb3d428))throw new db[(_0x0bb6('0x5c'))][(_0x0bb6('0x5d'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x0bb6('0x5e')]=function(_0x6e6a1e,_0x3b10d3,_0x9afa0a){var _0xec3bc3=encryptor[_0x0bb6('0x5f')](_0x3b10d3)[_0x0bb6('0x60')](',');for(var _0x1383f1=0x0;_0x1383f1<_0x9afa0a;_0x1383f1++){if(!_0xec3bc3[_0x1383f1])break;if(_0x6e6a1e[_0x0bb6('0x61')]()===_0xec3bc3[_0x1383f1][_0x0bb6('0x61')]()){var _0x5d05fa=util[_0x0bb6('0x62')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x9afa0a);if(_0x9afa0a===0x1){_0x5d05fa=_0x0bb6('0x63');}throw new db[(_0x0bb6('0x5c'))]['ValidationError'](_0x5d05fa);}}return;};exports['updatePasswordsHistory']=function(_0x1ed0c5,_0x28e49c){var _0x254907=_0x28e49c?encryptor['decryptString'](_0x28e49c)[_0x0bb6('0x60')](','):[];if(_0x254907[_0x0bb6('0x64')]===0x5){_0x254907[_0x0bb6('0x65')](-0x1,0x1);}_0x254907[_0x0bb6('0x66')](_0x1ed0c5);return encryptor[_0x0bb6('0x67')](_0x254907[_0x0bb6('0x68')](','));};function signJwt(_0x2f16f5){var _0x4ef5e1=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0xe28518=_0x2f16f5[_0x0bb6('0x69')]||config[_0x0bb6('0xa')][_0x0bb6('0xb')];return new BPromise(function(_0x5676a1,_0x4f3522){_0x4ef5e1(_0x2f16f5[_0x0bb6('0x6a')],_0xe28518,_0x2f16f5['options'])['then'](function(_0x170cbf){_0x5676a1(_0x170cbf);})['catch'](function(_0x466c56){_0x4f3522(_0x466c56);});});}function verifyJwt(_0x2b636a,_0x4ae3b5,_0x5ac83b){var _0x388bce=BPromise['promisify'](jwt[_0x0bb6('0x6b')],{'context':jwt});var _0x2c39fa=_0x5ac83b||config[_0x0bb6('0xa')][_0x0bb6('0xb')];return new BPromise(function(_0xa7a0a3,_0x1b9fd3){_0x388bce(_0x2b636a,_0x2c39fa,_0x4ae3b5)[_0x0bb6('0x37')](function(_0x449a8c){_0xa7a0a3(_0x449a8c);})[_0x0bb6('0x33')](function(_0xbc9a70){_0x1b9fd3(_0xbc9a70);});});}function generateNonce(){return crypto[_0x0bb6('0x6c')](0x10)['toString'](_0x0bb6('0x6d'));}function generateIssuedAt(){return Math['floor'](Date[_0x0bb6('0x6e')]()/0x3e8)['toString']();}function createJwt(_0x1f0f05){var _0xf0969f={'payload':{'iat':_0x1f0f05[_0x0bb6('0x58')],'nonce':_0x1f0f05[_0x0bb6('0x43')]},'options':{'algorithm':_0x0bb6('0x6f'),'subject':_0x1f0f05['id'][_0x0bb6('0x70')](),'issuer':hardwareConf[_0x0bb6('0x3f')](),'audience':hardwareConf[_0x0bb6('0x3f')]()}};return signJwt(_0xf0969f)[_0x0bb6('0x37')](function(_0x3fb563){return{'iat':_0x1f0f05[_0x0bb6('0x58')],'nonce':_0x1f0f05[_0x0bb6('0x43')],'token':_0x3fb563};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 73f140d..3275110 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 _0xcd59=['unlink','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','hasOwnProperty','encryptFile','createReadStream','createWriteStream','algorithm','data','write','end','final','binary','close','createDecipher','update'];(function(_0x1fba61,_0x93accf){var _0x1b9f98=function(_0x2e1816){while(--_0x2e1816){_0x1fba61['push'](_0x1fba61['shift']());}};_0x1b9f98(++_0x93accf);}(_0xcd59,0x14b));var _0x9cd5=function(_0x88249c,_0x24124e){_0x88249c=_0x88249c-0x0;var _0x951993=_0xcd59[_0x88249c];return _0x951993;};'use strict';var crypto=require(_0x9cd5('0x0'));var fs=require('fs');var BPromise=require(_0x9cd5('0x1'));var config=require(_0x9cd5('0x2'));const stringOptions={'secret':config[_0x9cd5('0x3')][_0x9cd5('0x4')],'algorithm':_0x9cd5('0x5')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x2d392c){var _0x191236={};for(var _0xf96efa in fileOptions){if(fileOptions[_0x9cd5('0x6')](_0xf96efa)){_0x191236[_0xf96efa]=fileOptions[_0xf96efa];}}if(_0x2d392c){for(var _0x6acbef in _0x2d392c){if(_0x2d392c[_0x9cd5('0x6')](_0x6acbef)){_0x191236[_0x6acbef]=_0x2d392c[_0x6acbef];}}}return _0x191236;}exports[_0x9cd5('0x7')]=function(_0x2cd19a,_0x214256,_0x3f888f,_0x545407){return new BPromise(function(_0x10162d,_0x15e76c){_0x545407=combineOptions(_0x545407);var _0x37b97f=new Buffer(_0x3f888f);var _0x23e524=fs[_0x9cd5('0x8')](_0x2cd19a);var _0x4099d0=fs[_0x9cd5('0x9')](_0x214256);var _0x18d9bb=crypto['createCipher'](_0x545407[_0x9cd5('0xa')],_0x37b97f);_0x23e524['on'](_0x9cd5('0xb'),function(_0x3fefe6){var _0x38e0ee=new Buffer(_0x18d9bb['update'](_0x3fefe6),'binary');_0x4099d0[_0x9cd5('0xc')](_0x38e0ee);});_0x23e524['on'](_0x9cd5('0xd'),function(){try{var _0x44518d=new Buffer(_0x18d9bb[_0x9cd5('0xe')](_0x9cd5('0xf')),_0x9cd5('0xf'));_0x4099d0['write'](_0x44518d);_0x4099d0[_0x9cd5('0xd')]();_0x4099d0['on'](_0x9cd5('0x10'),function(){return _0x10162d(_0x214256);});}catch(_0x21d768){fs['unlink'](_0x214256);return _0x15e76c(_0x21d768);}});});};exports['decryptFile']=function(_0x5c4f3d,_0x258305,_0x1ea3f7,_0x565db7){return new BPromise(function(_0x24c233,_0x11a7d2){_0x565db7=combineOptions(_0x565db7);var _0xcfaaa0=new Buffer(_0x1ea3f7);var _0x57b986=fs[_0x9cd5('0x8')](_0x5c4f3d);var _0x2d1863=fs[_0x9cd5('0x9')](_0x258305);var _0x3a6f01=crypto[_0x9cd5('0x11')](_0x565db7[_0x9cd5('0xa')],_0xcfaaa0);_0x57b986['on']('data',function(_0x37ea13){var _0x18346f=new Buffer(_0x3a6f01[_0x9cd5('0x12')](_0x37ea13),_0x9cd5('0xf'));_0x2d1863[_0x9cd5('0xc')](_0x18346f);});_0x57b986['on']('end',function(){try{var _0x16c4e9=new Buffer(_0x3a6f01[_0x9cd5('0xe')](_0x9cd5('0xf')),_0x9cd5('0xf'));_0x2d1863[_0x9cd5('0xc')](_0x16c4e9);_0x2d1863[_0x9cd5('0xd')]();_0x2d1863['on'](_0x9cd5('0x10'),function(){return _0x24c233(_0x258305);});}catch(_0x2238ec){fs[_0x9cd5('0x13')](_0x258305);return _0x11a7d2(_0x2238ec);}});});};exports['encryptString']=function(_0x297f0e,_0xba8ee9,_0x1a88e3){var _0x43f47d=_0x1a88e3||stringOptions['algorithm'];var _0x24ae67=_0xba8ee9||stringOptions[_0x9cd5('0x14')];var _0x211576=crypto[_0x9cd5('0x15')](_0x43f47d,_0x24ae67);var _0x297776=_0x211576[_0x9cd5('0x12')](_0x297f0e,_0x9cd5('0x16'),'base64');_0x297776+=_0x211576[_0x9cd5('0xe')](_0x9cd5('0x17'));return _0x297776;};exports[_0x9cd5('0x18')]=function(_0x4af6c8,_0x5c33e9,_0x2e45a3){var _0x502257=_0x2e45a3||stringOptions['algorithm'];var _0x1ab8d6=_0x5c33e9||stringOptions[_0x9cd5('0x14')];var _0x13e0d3=crypto['createDecipher'](_0x502257,_0x1ab8d6);var _0x40461a=_0x13e0d3[_0x9cd5('0x12')](_0x4af6c8,_0x9cd5('0x17'),_0x9cd5('0x16'));_0x40461a+=_0x13e0d3[_0x9cd5('0xe')](_0x9cd5('0x16'));return _0x40461a;}; \ No newline at end of file +var _0x44e8=['data','update','write','end','final','binary','close','unlink','decryptFile','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm'];(function(_0x214a3c,_0x48bd33){var _0x3743dc=function(_0x559994){while(--_0x559994){_0x214a3c['push'](_0x214a3c['shift']());}};_0x3743dc(++_0x48bd33);}(_0x44e8,0xd7));var _0x844e=function(_0x55bdf1,_0x1f2601){_0x55bdf1=_0x55bdf1-0x0;var _0x2f2528=_0x44e8[_0x55bdf1];return _0x2f2528;};'use strict';var crypto=require(_0x844e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0x844e('0x1')][_0x844e('0x2')],'algorithm':_0x844e('0x3')};const fileOptions={'algorithm':_0x844e('0x4')};function combineOptions(_0x49ce1b){var _0x3a8b3c={};for(var _0x167368 in fileOptions){if(fileOptions[_0x844e('0x5')](_0x167368)){_0x3a8b3c[_0x167368]=fileOptions[_0x167368];}}if(_0x49ce1b){for(var _0x446f47 in _0x49ce1b){if(_0x49ce1b['hasOwnProperty'](_0x446f47)){_0x3a8b3c[_0x446f47]=_0x49ce1b[_0x446f47];}}}return _0x3a8b3c;}exports[_0x844e('0x6')]=function(_0x238796,_0x1706b3,_0x11cbd6,_0x571b91){return new BPromise(function(_0x31ab50,_0x7dff16){_0x571b91=combineOptions(_0x571b91);var _0x336881=new Buffer(_0x11cbd6);var _0x134672=fs[_0x844e('0x7')](_0x238796);var _0x1f9921=fs['createWriteStream'](_0x1706b3);var _0x39ef28=crypto[_0x844e('0x8')](_0x571b91[_0x844e('0x9')],_0x336881);_0x134672['on'](_0x844e('0xa'),function(_0x14909f){var _0x37b2a3=new Buffer(_0x39ef28[_0x844e('0xb')](_0x14909f),'binary');_0x1f9921[_0x844e('0xc')](_0x37b2a3);});_0x134672['on'](_0x844e('0xd'),function(){try{var _0x52ac76=new Buffer(_0x39ef28[_0x844e('0xe')](_0x844e('0xf')),'binary');_0x1f9921[_0x844e('0xc')](_0x52ac76);_0x1f9921[_0x844e('0xd')]();_0x1f9921['on'](_0x844e('0x10'),function(){return _0x31ab50(_0x1706b3);});}catch(_0x4ed3a4){fs[_0x844e('0x11')](_0x1706b3);return _0x7dff16(_0x4ed3a4);}});});};exports[_0x844e('0x12')]=function(_0x380eb4,_0x935134,_0x2588a3,_0x353be9){return new BPromise(function(_0x2227c6,_0x5506ef){_0x353be9=combineOptions(_0x353be9);var _0x4f14e9=new Buffer(_0x2588a3);var _0x36286c=fs['createReadStream'](_0x380eb4);var _0x3c307f=fs['createWriteStream'](_0x935134);var _0x315c50=crypto['createDecipher'](_0x353be9[_0x844e('0x9')],_0x4f14e9);_0x36286c['on'](_0x844e('0xa'),function(_0x2d6ba8){var _0x410325=new Buffer(_0x315c50[_0x844e('0xb')](_0x2d6ba8),_0x844e('0xf'));_0x3c307f[_0x844e('0xc')](_0x410325);});_0x36286c['on'](_0x844e('0xd'),function(){try{var _0x4ffb86=new Buffer(_0x315c50[_0x844e('0xe')]('binary'),'binary');_0x3c307f[_0x844e('0xc')](_0x4ffb86);_0x3c307f[_0x844e('0xd')]();_0x3c307f['on'](_0x844e('0x10'),function(){return _0x2227c6(_0x935134);});}catch(_0x286fdd){fs['unlink'](_0x935134);return _0x5506ef(_0x286fdd);}});});};exports[_0x844e('0x13')]=function(_0x3dde07,_0x571498,_0x2520f8){var _0x13489b=_0x2520f8||stringOptions[_0x844e('0x9')];var _0xdba48d=_0x571498||stringOptions[_0x844e('0x14')];var _0x3a65fc=crypto['createCipher'](_0x13489b,_0xdba48d);var _0x399a81=_0x3a65fc[_0x844e('0xb')](_0x3dde07,_0x844e('0x15'),_0x844e('0x16'));_0x399a81+=_0x3a65fc[_0x844e('0xe')]('base64');return _0x399a81;};exports[_0x844e('0x17')]=function(_0x5080c1,_0x57b2ef,_0x431a9c){var _0x130d87=_0x431a9c||stringOptions[_0x844e('0x9')];var _0x587613=_0x57b2ef||stringOptions[_0x844e('0x14')];var _0x2d4acd=crypto[_0x844e('0x18')](_0x130d87,_0x587613);var _0x54fd73=_0x2d4acd[_0x844e('0xb')](_0x5080c1,_0x844e('0x16'),_0x844e('0x15'));_0x54fd73+=_0x2d4acd[_0x844e('0xe')](_0x844e('0x15'));return _0x54fd73;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index be370e5..978611b 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 _0xf109=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','num','length','SELECT','push','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync'];(function(_0x5bf6f8,_0x55d5fb){var _0x45274e=function(_0x31d7f9){while(--_0x31d7f9){_0x5bf6f8['push'](_0x5bf6f8['shift']());}};_0x45274e(++_0x55d5fb);}(_0xf109,0xce));var _0x9f10=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xf109[_0x5c2e3e];return _0x53f64a;};'use strict';var util=require(_0x9f10('0x0'));var path=require(_0x9f10('0x1'));var _=require(_0x9f10('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9f10('0x3'));var db=require(_0x9f10('0x4'))['db'];var dbH=require(_0x9f10('0x4'))[_0x9f10('0x5')];var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9f10('0x8')][0x2]);var QUERY=process[_0x9f10('0x8')][0x3];var PATH=process[_0x9f10('0x8')][0x4];function analyticExtractedReport(_0x2a877e,_0x3fd82f){var _0x5c8719={'status':_0x2a877e};var _0x42a8cd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3fd82f){_0x5c8719[_0x9f10('0x9')]=_0x3fd82f;}return db[_0x9f10('0xa')][_0x9f10('0xb')](_0x5c8719,_0x42a8cd);}function main(){var _0x325f22=0x1388;var _0x5d5f53;logger[_0x9f10('0xc')](util[_0x9f10('0xd')](_0x9f10('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x9f10('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9f10('0x10'),_0x9f10('0x11')]})['then'](function(_0x289164){if(_0x289164){_0x5d5f53=_0x289164;_0x325f22=_0x5d5f53[_0x9f10('0x11')]||0x1388;}})[_0x9f10('0x12')](function(){return dbH['sequelize'][_0x9f10('0x13')](util[_0x9f10('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9f10('0x14')][_0x9f10('0x15')]['SELECT']});})['then'](function(_0x2b6c4c){if(!_0x2b6c4c[0x0][_0x9f10('0x16')]){return analyticExtractedReport('Empty');}var _0x11154b=[];var _0x5ae255=0x0;var _0x14d3fe=!![];if(_0x2b6c4c&&_0x2b6c4c[_0x9f10('0x17')]){var _0x4b1b8f=_0x2b6c4c[0x0][_0x9f10('0x16')]%(_0x5ae255+_0x325f22);if(_0x5d5f53[_0x9f10('0x10')]){for(;_0x14d3fe;_0x5ae255+=_0x325f22,_0x4b1b8f=_0x2b6c4c[0x0]['num']%(_0x5ae255+_0x325f22)){if(_0x4b1b8f==0x0||_0x4b1b8f==_0x2b6c4c[0x0][_0x9f10('0x16')]){_0x14d3fe=![];}_0x11154b['push'](dbH[_0x9f10('0x14')]['query'](util[_0x9f10('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x325f22,_0x5ae255),{'type':dbH['sequelize'][_0x9f10('0x15')][_0x9f10('0x18')]}));}}else{_0x11154b[_0x9f10('0x19')](dbH[_0x9f10('0x14')][_0x9f10('0x13')](QUERY,{'type':dbH[_0x9f10('0x14')][_0x9f10('0x15')]['SELECT']}));}}var _0x366044=path['dirname'](PATH);var _0x293990=path[_0x9f10('0x1a')](PATH,_0x9f10('0x1b'));var _0x4adbda=_0x5d5f53[_0x9f10('0x10')]&&_0x11154b[_0x9f10('0x17')]>0x1;var _0x213567=[];if(!fs['existsSync'](path[_0x9f10('0x1c')](_0x366044,_0x293990))&&_0x4adbda){fs[_0x9f10('0x1d')](path[_0x9f10('0x1c')](_0x366044,_0x293990));}return BPromise['each'](_0x11154b,function(_0x2ec07d){_0x213567[_0x9f10('0x19')](_0x2ec07d);})[_0x9f10('0x12')](function(){for(var _0x1647c0=0x0;_0x1647c0<_0x213567['length'];_0x1647c0+=0x1){var _0x57539b;var _0x5c1800=_0x213567[_0x1647c0];if(_0x4adbda){_0x57539b=path[_0x9f10('0x1c')](_0x366044,_0x293990,util['format'](_0x9f10('0x1e'),_0x293990,_0x1647c0,_0x9f10('0x1f')));}else{_0x57539b=path[_0x9f10('0x1c')](_0x366044,util[_0x9f10('0xd')](_0x9f10('0x20'),_0x293990,'csv'));}fs[_0x9f10('0x21')](_0x57539b,csv(_0x5c1800));}})[_0x9f10('0x12')](function(){if(_0x4adbda){zipdir(path[_0x9f10('0x1c')](_0x366044,_0x293990),{'saveTo':path[_0x9f10('0x1c')](_0x366044,util[_0x9f10('0xd')](_0x9f10('0x20'),_0x293990,'zip'))},function(_0x358d3f,_0x501ee){});rimraf(path[_0x9f10('0x1c')](_0x366044,_0x293990),function(){});}})[_0x9f10('0x12')](function(){logger['info'](util[_0x9f10('0xd')](_0x9f10('0x22'),EXTRACTED_REPORT_ID,_0x9f10('0x23')));return analyticExtractedReport('Completed',_0x4adbda?util[_0x9f10('0xd')]('%s.%s',_0x293990,_0x4adbda?_0x9f10('0x24'):_0x9f10('0x1f')):null);});})[_0x9f10('0x25')](function(_0x5944e5){logger[_0x9f10('0xc')](util[_0x9f10('0xd')](_0x9f10('0x26'),EXTRACTED_REPORT_ID,_0x9f10('0x23')),util[_0x9f10('0x27')](_0x5944e5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0x4c4e=['find','split','splitSizeCsv','then','query','sequelize','QueryTypes','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.csv','mkdirSync','each','csv','%s.%s','join','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','util','lodash','to-csv','bluebird','rimraf','../../mysqldb','../../config/logger','argv','savename','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV'];(function(_0x1a7bfa,_0x25cf3f){var _0x5efca1=function(_0x3304c2){while(--_0x3304c2){_0x1a7bfa['push'](_0x1a7bfa['shift']());}};_0x5efca1(++_0x25cf3f);}(_0x4c4e,0x152));var _0xe4c4=function(_0x1a0435,_0x1a72b9){_0x1a0435=_0x1a0435-0x0;var _0x2ced3a=_0x4c4e[_0x1a0435];return _0x2ced3a;};'use strict';var util=require(_0xe4c4('0x0'));var path=require('path');var _=require(_0xe4c4('0x1'));var csv=require(_0xe4c4('0x2'));var fs=require('fs');var BPromise=require(_0xe4c4('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xe4c4('0x4'));var db=require(_0xe4c4('0x5'))['db'];var dbH=require(_0xe4c4('0x5'))['dbH'];var logger=require(_0xe4c4('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xe4c4('0x7')][0x2]);var QUERY=process[_0xe4c4('0x7')][0x3];var PATH=process[_0xe4c4('0x7')][0x4];function analyticExtractedReport(_0xad105,_0x22085a){var _0x329d29={'status':_0xad105};var _0x28a42e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22085a){_0x329d29[_0xe4c4('0x8')]=_0x22085a;}return db['AnalyticExtractedReport']['update'](_0x329d29,_0x28a42e);}function main(){var _0x31f879=0x1388;var _0x6f2545;logger[_0xe4c4('0x9')](util[_0xe4c4('0xa')](_0xe4c4('0xb'),EXTRACTED_REPORT_ID,_0xe4c4('0xc')));return db['Setting'][_0xe4c4('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe4c4('0xe'),_0xe4c4('0xf')]})[_0xe4c4('0x10')](function(_0x50bfab){if(_0x50bfab){_0x6f2545=_0x50bfab;_0x31f879=_0x6f2545[_0xe4c4('0xf')]||0x1388;}})[_0xe4c4('0x10')](function(){return dbH['sequelize'][_0xe4c4('0x11')](util[_0xe4c4('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xe4c4('0x12')][_0xe4c4('0x13')]['SELECT']});})[_0xe4c4('0x10')](function(_0x465c9b){if(!_0x465c9b[0x0][_0xe4c4('0x14')]){return analyticExtractedReport(_0xe4c4('0x15'));}var _0x19e59b=[];var _0x882be2=0x0;var _0x1f637e=!![];if(_0x465c9b&&_0x465c9b[_0xe4c4('0x16')]){var _0x34ecbe=_0x465c9b[0x0][_0xe4c4('0x14')]%(_0x882be2+_0x31f879);if(_0x6f2545[_0xe4c4('0xe')]){for(;_0x1f637e;_0x882be2+=_0x31f879,_0x34ecbe=_0x465c9b[0x0][_0xe4c4('0x14')]%(_0x882be2+_0x31f879)){if(_0x34ecbe==0x0||_0x34ecbe==_0x465c9b[0x0][_0xe4c4('0x14')]){_0x1f637e=![];}_0x19e59b[_0xe4c4('0x17')](dbH[_0xe4c4('0x12')]['query'](util[_0xe4c4('0xa')](_0xe4c4('0x18'),QUERY,_0x31f879,_0x882be2),{'type':dbH[_0xe4c4('0x12')][_0xe4c4('0x13')]['SELECT']}));}}else{_0x19e59b[_0xe4c4('0x17')](dbH[_0xe4c4('0x12')][_0xe4c4('0x11')](QUERY,{'type':dbH[_0xe4c4('0x12')][_0xe4c4('0x13')][_0xe4c4('0x19')]}));}}var _0x1d4597=path[_0xe4c4('0x1a')](PATH);var _0x21bbb1=path[_0xe4c4('0x1b')](PATH,_0xe4c4('0x1c'));var _0x3a6d39=_0x6f2545[_0xe4c4('0xe')]&&_0x19e59b[_0xe4c4('0x16')]>0x1;var _0x15873e=[];if(!fs['existsSync'](path['join'](_0x1d4597,_0x21bbb1))&&_0x3a6d39){fs[_0xe4c4('0x1d')](path['join'](_0x1d4597,_0x21bbb1));}return BPromise[_0xe4c4('0x1e')](_0x19e59b,function(_0x5374fd){_0x15873e[_0xe4c4('0x17')](_0x5374fd);})['then'](function(){for(var _0x34d667=0x0;_0x34d667<_0x15873e['length'];_0x34d667+=0x1){var _0xba53ef;var _0x4a0199=_0x15873e[_0x34d667];if(_0x3a6d39){_0xba53ef=path['join'](_0x1d4597,_0x21bbb1,util['format']('%s%d.%s',_0x21bbb1,_0x34d667,_0xe4c4('0x1f')));}else{_0xba53ef=path['join'](_0x1d4597,util['format'](_0xe4c4('0x20'),_0x21bbb1,_0xe4c4('0x1f')));}fs['writeFileSync'](_0xba53ef,csv(_0x4a0199));}})['then'](function(){if(_0x3a6d39){zipdir(path[_0xe4c4('0x21')](_0x1d4597,_0x21bbb1),{'saveTo':path[_0xe4c4('0x21')](_0x1d4597,util['format'](_0xe4c4('0x20'),_0x21bbb1,_0xe4c4('0x22')))},function(_0x3f60fc,_0x48060e){});rimraf(path['join'](_0x1d4597,_0x21bbb1),function(){});}})[_0xe4c4('0x10')](function(){logger[_0xe4c4('0x9')](util[_0xe4c4('0xa')](_0xe4c4('0x23'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x3a6d39?util[_0xe4c4('0xa')](_0xe4c4('0x20'),_0x21bbb1,_0x3a6d39?'zip':_0xe4c4('0x1f')):null);});})[_0xe4c4('0x24')](function(_0x835e8c){logger['info'](util[_0xe4c4('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe4c4('0xc')),util[_0xe4c4('0x25')](_0x835e8c,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe4c4('0x26'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1c19391..221e2f4 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 _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x4d3d9f,_0x5b897e){var _0x2a7922=function(_0x3271b8){while(--_0x3271b8){_0x4d3d9f['push'](_0x4d3d9f['shift']());}};_0x2a7922(++_0x5b897e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x766a7d,_0x3e4016){_0x766a7d=_0x766a7d-0x0;var _0x912891=_0x5f2f[_0x766a7d];return _0x912891;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}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(_0x378eb5,_0x4cf2d2){var _0x7937ba=function(_0x41e8d2){while(--_0x41e8d2){_0x378eb5['push'](_0x378eb5['shift']());}};_0x7937ba(++_0x4cf2d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x22e173,_0x5af528){_0x22e173=_0x22e173-0x0;var _0x3a3912=_0xb10b[_0x22e173];return _0x3a3912;};'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 c442b5e..d5507a6 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 _0xbd44=['num','length','push','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT'];(function(_0xca07e6,_0x5d8560){var _0x2bd4e8=function(_0x4173e0){while(--_0x4173e0){_0xca07e6['push'](_0xca07e6['shift']());}};_0x2bd4e8(++_0x5d8560);}(_0xbd44,0x151));var _0x4bd4=function(_0x2836a0,_0x1795cf){_0x2836a0=_0x2836a0-0x0;var _0xa3ae6b=_0xbd44[_0x2836a0];return _0xa3ae6b;};'use strict';var util=require(_0x4bd4('0x0'));var path=require(_0x4bd4('0x1'));var _=require(_0x4bd4('0x2'));var fs=require('fs');var json2xls=require(_0x4bd4('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x4bd4('0x4'));var rimraf=require('rimraf');var db=require(_0x4bd4('0x5'))['db'];var dbH=require('../../mysqldb')[_0x4bd4('0x6')];var logger=require(_0x4bd4('0x7'))(_0x4bd4('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4bd4('0x9')][0x3];var PATH=process[_0x4bd4('0x9')][0x4];function analyticExtractedReport(_0x1f548a,_0x558da8){var _0x17dd38={'status':_0x1f548a};var _0x4d2da2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x558da8){_0x17dd38['savename']=_0x558da8;}return db[_0x4bd4('0xa')]['update'](_0x17dd38,_0x4d2da2);}function main(){var _0x324675=0x1388;var _0x1a225b;logger[_0x4bd4('0xb')](util[_0x4bd4('0xc')](_0x4bd4('0xd'),EXTRACTED_REPORT_ID,_0x4bd4('0xe')));return db['Setting'][_0x4bd4('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4bd4('0x10'),_0x4bd4('0x11')]})[_0x4bd4('0x12')](function(_0x3aeb31){if(_0x3aeb31){_0x1a225b=_0x3aeb31;_0x324675=_0x1a225b[_0x4bd4('0x11')]||0x1388;}})[_0x4bd4('0x12')](function(){return dbH[_0x4bd4('0x13')][_0x4bd4('0x14')](util[_0x4bd4('0xc')](_0x4bd4('0x15'),QUERY),{'type':dbH[_0x4bd4('0x13')]['QueryTypes'][_0x4bd4('0x16')]});})[_0x4bd4('0x12')](function(_0x5e165b){if(!_0x5e165b[0x0][_0x4bd4('0x17')]){return analyticExtractedReport('Empty');}var _0x53de6e=[];var _0x4de917=0x0;var _0x18b20a=!![];if(_0x1a225b[_0x4bd4('0x10')]){if(_0x5e165b&&_0x5e165b[_0x4bd4('0x18')]){var _0x2b9e59=_0x5e165b[0x0][_0x4bd4('0x17')]%(_0x4de917+_0x324675);for(;_0x18b20a;_0x4de917+=_0x324675,_0x2b9e59=_0x5e165b[0x0]['num']%(_0x4de917+_0x324675)){if(_0x2b9e59==0x0||_0x2b9e59==_0x5e165b[0x0][_0x4bd4('0x17')]){_0x18b20a=![];}_0x53de6e[_0x4bd4('0x19')](dbH['sequelize'][_0x4bd4('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x324675,_0x4de917),{'type':dbH[_0x4bd4('0x13')][_0x4bd4('0x1a')]['SELECT']}));}}}else{_0x53de6e['push'](dbH[_0x4bd4('0x13')]['query'](QUERY,{'type':dbH[_0x4bd4('0x13')][_0x4bd4('0x1a')][_0x4bd4('0x16')]}));}var _0x24acb8=path[_0x4bd4('0x1b')](PATH);var _0x20849d=path[_0x4bd4('0x1c')](PATH,_0x4bd4('0x1d'));var _0x2e7f60=_0x1a225b[_0x4bd4('0x10')]&&_0x53de6e[_0x4bd4('0x18')]>0x1;var _0x1f9584=[];if(!fs[_0x4bd4('0x1e')](path[_0x4bd4('0x1f')](_0x24acb8,_0x20849d))&&_0x2e7f60){fs[_0x4bd4('0x20')](path[_0x4bd4('0x1f')](_0x24acb8,_0x20849d));}return BPromise[_0x4bd4('0x21')](_0x53de6e,function(_0x318a11){_0x1f9584[_0x4bd4('0x19')](_0x318a11);})[_0x4bd4('0x12')](function(){for(var _0x5c36b2=0x0;_0x5c36b2<_0x1f9584[_0x4bd4('0x18')];_0x5c36b2+=0x1){var _0x5b45a3;var _0x5053d7=_0x1f9584[_0x5c36b2];if(_0x2e7f60){_0x5b45a3=path[_0x4bd4('0x1f')](_0x24acb8,_0x20849d,util[_0x4bd4('0xc')](_0x4bd4('0x22'),_0x20849d,_0x5c36b2,_0x4bd4('0x23')));}else{_0x5b45a3=path[_0x4bd4('0x1f')](_0x24acb8,util[_0x4bd4('0xc')](_0x4bd4('0x24'),_0x20849d,_0x4bd4('0x23')));}fs[_0x4bd4('0x25')](_0x5b45a3,json2xls(_0x5053d7),_0x4bd4('0x26'));}})['then'](function(){if(_0x2e7f60){zipdir(path['join'](_0x24acb8,_0x20849d),{'saveTo':path[_0x4bd4('0x1f')](_0x24acb8,util[_0x4bd4('0xc')](_0x4bd4('0x24'),_0x20849d,_0x4bd4('0x27')))},function(_0x11acd3,_0x14ffcf){});rimraf(path[_0x4bd4('0x1f')](_0x24acb8,_0x20849d),function(){});}})['then'](function(){logger[_0x4bd4('0xb')](util[_0x4bd4('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x4bd4('0xe')));return analyticExtractedReport(_0x4bd4('0x28'),_0x2e7f60?util[_0x4bd4('0xc')](_0x4bd4('0x24'),_0x20849d,_0x2e7f60?_0x4bd4('0x27'):'xlsx'):null);});})[_0x4bd4('0x29')](function(_0x161d3b){logger[_0x4bd4('0xb')](util[_0x4bd4('0xc')](_0x4bd4('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x4bd4('0x2b')](_0x161d3b,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x4bd4('0x2c'));});}main(); \ No newline at end of file +var _0x38ed=['xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','num','length','push','query','QueryTypes','SELECT','dirname','basename','.xlsx','existsSync','mkdirSync','join','each'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x38ed,0xbd));var _0xd38e=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x38ed[_0x3ab51d];return _0x29a04e;};'use strict';var util=require(_0xd38e('0x0'));var path=require('path');var _=require(_0xd38e('0x1'));var fs=require('fs');var json2xls=require(_0xd38e('0x2'));var BPromise=require(_0xd38e('0x3'));var zipdir=require(_0xd38e('0x4'));var rimraf=require('rimraf');var db=require(_0xd38e('0x5'))['db'];var dbH=require(_0xd38e('0x5'))[_0xd38e('0x6')];var logger=require(_0xd38e('0x7'))(_0xd38e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd38e('0x9')][0x2]);var QUERY=process[_0xd38e('0x9')][0x3];var PATH=process[_0xd38e('0x9')][0x4];function analyticExtractedReport(_0x2dcadc,_0x24ce1c){var _0x1e517d={'status':_0x2dcadc};var _0x27fc07={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x24ce1c){_0x1e517d[_0xd38e('0xa')]=_0x24ce1c;}return db[_0xd38e('0xb')][_0xd38e('0xc')](_0x1e517d,_0x27fc07);}function main(){var _0x348b05=0x1388;var _0x452ef0;logger[_0xd38e('0xd')](util[_0xd38e('0xe')](_0xd38e('0xf'),EXTRACTED_REPORT_ID,_0xd38e('0x10')));return db['Setting'][_0xd38e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd38e('0x12'),_0xd38e('0x13')]})['then'](function(_0xfdf66f){if(_0xfdf66f){_0x452ef0=_0xfdf66f;_0x348b05=_0x452ef0[_0xd38e('0x13')]||0x1388;}})[_0xd38e('0x14')](function(){return dbH['sequelize']['query'](util['format'](_0xd38e('0x15'),QUERY),{'type':dbH[_0xd38e('0x16')]['QueryTypes']['SELECT']});})[_0xd38e('0x14')](function(_0x2f0b0e){if(!_0x2f0b0e[0x0][_0xd38e('0x17')]){return analyticExtractedReport('Empty');}var _0x4d7c8f=[];var _0x49470c=0x0;var _0xb4e6ba=!![];if(_0x452ef0[_0xd38e('0x12')]){if(_0x2f0b0e&&_0x2f0b0e[_0xd38e('0x18')]){var _0x59a52a=_0x2f0b0e[0x0][_0xd38e('0x17')]%(_0x49470c+_0x348b05);for(;_0xb4e6ba;_0x49470c+=_0x348b05,_0x59a52a=_0x2f0b0e[0x0][_0xd38e('0x17')]%(_0x49470c+_0x348b05)){if(_0x59a52a==0x0||_0x59a52a==_0x2f0b0e[0x0][_0xd38e('0x17')]){_0xb4e6ba=![];}_0x4d7c8f[_0xd38e('0x19')](dbH[_0xd38e('0x16')][_0xd38e('0x1a')](util[_0xd38e('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x348b05,_0x49470c),{'type':dbH['sequelize'][_0xd38e('0x1b')][_0xd38e('0x1c')]}));}}}else{_0x4d7c8f['push'](dbH[_0xd38e('0x16')][_0xd38e('0x1a')](QUERY,{'type':dbH[_0xd38e('0x16')][_0xd38e('0x1b')][_0xd38e('0x1c')]}));}var _0x1813fb=path[_0xd38e('0x1d')](PATH);var _0x40abde=path[_0xd38e('0x1e')](PATH,_0xd38e('0x1f'));var _0x3384c5=_0x452ef0[_0xd38e('0x12')]&&_0x4d7c8f[_0xd38e('0x18')]>0x1;var _0x1d09df=[];if(!fs[_0xd38e('0x20')](path['join'](_0x1813fb,_0x40abde))&&_0x3384c5){fs[_0xd38e('0x21')](path[_0xd38e('0x22')](_0x1813fb,_0x40abde));}return BPromise[_0xd38e('0x23')](_0x4d7c8f,function(_0x39422a){_0x1d09df['push'](_0x39422a);})[_0xd38e('0x14')](function(){for(var _0x18c985=0x0;_0x18c985<_0x1d09df['length'];_0x18c985+=0x1){var _0x3bcf7f;var _0x91b8b2=_0x1d09df[_0x18c985];if(_0x3384c5){_0x3bcf7f=path[_0xd38e('0x22')](_0x1813fb,_0x40abde,util[_0xd38e('0xe')]('%s%d.%s',_0x40abde,_0x18c985,_0xd38e('0x24')));}else{_0x3bcf7f=path[_0xd38e('0x22')](_0x1813fb,util[_0xd38e('0xe')](_0xd38e('0x25'),_0x40abde,_0xd38e('0x24')));}fs[_0xd38e('0x26')](_0x3bcf7f,json2xls(_0x91b8b2),_0xd38e('0x27'));}})['then'](function(){if(_0x3384c5){zipdir(path[_0xd38e('0x22')](_0x1813fb,_0x40abde),{'saveTo':path[_0xd38e('0x22')](_0x1813fb,util[_0xd38e('0xe')]('%s.%s',_0x40abde,_0xd38e('0x28')))},function(_0x1056b8,_0x34a7e8){});rimraf(path[_0xd38e('0x22')](_0x1813fb,_0x40abde),function(){});}})[_0xd38e('0x14')](function(){logger['info'](util[_0xd38e('0xe')](_0xd38e('0x29'),EXTRACTED_REPORT_ID,_0xd38e('0x10')));return analyticExtractedReport(_0xd38e('0x2a'),_0x3384c5?util['format'](_0xd38e('0x25'),_0x40abde,_0x3384c5?_0xd38e('0x28'):'xlsx'):null);});})['catch'](function(_0x4959b0){logger[_0xd38e('0xd')](util[_0xd38e('0xe')](_0xd38e('0x2b'),EXTRACTED_REPORT_ID,_0xd38e('0x10')),util[_0xd38e('0x2c')](_0x4959b0,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4a0c23d..0692c8e 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 _0x4e61=['lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','createdAt','interval','*,*,*,*','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','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite'];(function(_0x38924e,_0x30de60){var _0x5e1893=function(_0x5999a7){while(--_0x5999a7){_0x38924e['push'](_0x38924e['shift']());}};_0x5e1893(++_0x30de60);}(_0x4e61,0x8c));var _0x14e6=function(_0x44784c,_0x4498c1){_0x44784c=_0x44784c-0x0;var _0x4bbfb1=_0x4e61[_0x44784c];return _0x4bbfb1;};'use strict';var _=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));function rewrite(_0x67f4ce,_0x5725b0){var _0x53cf7e=this;return _0x67f4ce[_0x14e6('0x2')][_0x14e6('0x3')][_0x14e6('0x4')]({'raw':!![]})[_0x14e6('0x5')](function(_0x1cef29){_0x53cf7e[_0x14e6('0x6')]=_0x1cef29;return _0x67f4ce[_0x14e6('0x2')][_0x14e6('0x7')][_0x14e6('0x4')]({'where':{'IntervalId':_0x5725b0[_0x14e6('0x8')]},'raw':!![]});})[_0x14e6('0x5')](function(_0x91ca48){return _0x67f4ce[_0x14e6('0x2')][_0x14e6('0x7')][_0x14e6('0x4')]({'where':{'exten':{'$in':_[_0x14e6('0x9')](_[_0x14e6('0xa')](_0x91ca48,_0x14e6('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x14e6('0x5')](function(_0x473ed2){var _0x1ae9be=_[_0x14e6('0xc')](_0x473ed2,{'priority':'1'});var _0x536468=_['filter'](_0x473ed2,{'isApp':0x1});var _0x53ab5d=_['groupBy'](_0x536468,_0x14e6('0xb'));var _0x5de0ea=['queue',_0x14e6('0xd')];var _0x2eea38=[];var _0x3834c2=[];for(var _0x47950b in _0x53ab5d){if(_0x53ab5d[_0x14e6('0xe')](_0x47950b)){_0x53cf7e[_0x14e6('0xf')]=0x2;_0x53cf7e[_0x14e6('0x10')]=[];_0x53cf7e[_0x14e6('0x11')]=_[_0x14e6('0x12')](_0x1ae9be,{'exten':_0x53ab5d[_0x47950b][0x0]['exten']});_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':util[_0x14e6('0x16')]('CDR(type)=%s',_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')]),'context':_0x53ab5d[_0x47950b][0x0]['context'],'exten':_0x53ab5d[_0x47950b][0x0]['exten'],'priority':_0x53cf7e['priority']++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});if(_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')]===_0x14e6('0x18')){if(_0x53cf7e[_0x14e6('0x11')]){_0x53cf7e['extensions']['push']({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x19')+(_0x53cf7e[_0x14e6('0x11')][_0x14e6('0x1a')]?_0x14e6('0x1b')+_0x53cf7e[_0x14e6('0x11')][_0x14e6('0x1a')]+'}':_0x14e6('0x1c')),'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});}_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x1e')+_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')],'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e['priority']++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});var _0x2a3807=_0x53cf7e[_0x14e6('0xf')]++;_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2a3807+0x2)+_0x14e6('0x20')+(_0x2a3807+0x1)+')','context':_0x53ab5d[_0x47950b][0x0]['context'],'exten':_0x53ab5d[_0x47950b][0x0]['exten'],'priority':_0x2a3807,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0]['VoiceExtensionId']});if(_0x53cf7e[_0x14e6('0x11')]){_0x53cf7e['extensions'][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x53cf7e['extension'][_0x14e6('0x1a')]?_0x14e6('0x21')+_0x53cf7e[_0x14e6('0x11')]['cutdigits']+'}':_0x14e6('0x22'),'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0]['VoiceExtensionId']});}_0x53cf7e[_0x14e6('0x10')]['push']({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':'outboundrouteid='+_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')],'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0]['VoiceExtensionId']});if(_0x53cf7e[_0x14e6('0x11')]&&_0x53cf7e[_0x14e6('0x11')][_0x14e6('0xe')](_0x14e6('0x23'))&&_0x53cf7e[_0x14e6('0x11')][_0x14e6('0x23')]!==_0x14e6('0x24')){_0x53cf7e['extensions'][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x25'),'context':_0x53ab5d[_0x47950b][0x0]['context'],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x26')+_0x53cf7e[_0x14e6('0x11')][_0x14e6('0x23')]||_0x14e6('0x27'),'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0]['exten'],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});}}_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x28'),'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x29'),'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0]['exten'],'priority':_0x53cf7e[_0x14e6('0xf')]++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0]['VoiceExtensionId']});_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'priority':_0x53cf7e['priority']++,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});for(var _0xd5cec0=0x0,_0x36e0aa=0x0;_0xd5cec0<_0x53ab5d[_0x47950b][_0x14e6('0x2a')];_0xd5cec0+=0x1,_0x36e0aa=0x0){var _0x441a52=_0x53ab5d[_0x47950b][_0xd5cec0];if(_0x441a52['type']){_0x441a52[_0x14e6('0x14')]=_0x441a52[_0x14e6('0x14')]['toLowerCase']();}var _0x4a7155=[];var _0x409520=[];delete _0x441a52['id'];delete _0x441a52[_0x14e6('0x2b')];delete _0x441a52['updatedAt'];var _0x4ec8cb=_0x441a52[_0x14e6('0x2c')]!==_0x14e6('0x2d')?[_0x441a52[_0x14e6('0x2c')]]:_0x441a52[_0x14e6('0x8')]?_[_0x14e6('0xa')](_['filter'](_0x53cf7e['intervals'],{'IntervalId':_0x441a52['IntervalId']}),_0x14e6('0x2c')):[];if(_0x441a52[_0x14e6('0xe')](_0x14e6('0x2e'))){if(_0x441a52[_0x14e6('0x2e')]&&_0x441a52[_0x14e6('0x2e')]!=='--'){_0x4a7155[_0x14e6('0x13')]({'type':_0x441a52[_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x2f')+_0x441a52[_0x14e6('0x2e')],'context':_0x441a52['context'],'exten':_0x441a52[_0x14e6('0xb')],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e['priority']+_0x36e0aa++,'VoiceExtensionId':_0x441a52[_0x14e6('0x17')]});}}if(_0x441a52[_0x14e6('0x14')]==='outbound'&&_0x441a52[_0x14e6('0xe')](_0x14e6('0x30'))){if(_0x441a52[_0x14e6('0x30')]){_0x4a7155['push']({'type':_0x441a52['type'],'app':_0x14e6('0x1f'),'appdata':_0x14e6('0x31')+_0x441a52[_0x14e6('0x30')]+')','context':_0x441a52[_0x14e6('0x1d')],'exten':_0x441a52['exten'],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e[_0x14e6('0xf')]+_0x36e0aa++,'VoiceExtensionId':_0x441a52[_0x14e6('0x17')]});}else{_0x4a7155['push']({'type':_0x441a52[_0x14e6('0x14')],'app':_0x14e6('0x1f'),'appdata':_0x14e6('0x32'),'context':_0x441a52[_0x14e6('0x1d')],'exten':_0x441a52['exten'],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e['priority']+_0x36e0aa++,'VoiceExtensionId':_0x441a52['VoiceExtensionId']});}}if(_0x441a52[_0x14e6('0xe')](_0x14e6('0x33'))){if(_0x5de0ea[_0x14e6('0x34')](_0x441a52[_0x14e6('0x35')][_0x14e6('0x36')]())>=0x0&&_0x441a52[_0x14e6('0x37')]!==_0x14e6('0x38')){if(_0x441a52[_0x14e6('0x33')]){_0x4a7155[_0x14e6('0x13')]({'type':_0x441a52[_0x14e6('0x14')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x441a52['context'],'exten':_0x441a52[_0x14e6('0xb')],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e['priority']+_0x36e0aa++,'VoiceExtensionId':_0x441a52['VoiceExtensionId']});_0x4a7155[_0x14e6('0x13')]({'type':_0x441a52[_0x14e6('0x14')],'app':_0x14e6('0x15'),'appdata':_0x14e6('0x39'),'context':_0x441a52[_0x14e6('0x1d')],'exten':_0x441a52['exten'],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e[_0x14e6('0xf')]+_0x36e0aa++,'VoiceExtensionId':_0x441a52[_0x14e6('0x17')]});}else{_0x4a7155[_0x14e6('0x13')]({'type':_0x441a52['type'],'app':'ExecIf','appdata':_0x14e6('0x3a'),'context':_0x441a52[_0x14e6('0x1d')],'exten':_0x441a52['exten'],'priority':_0x4ec8cb[_0x14e6('0x2a')]+_0x53cf7e['priority']+_0x36e0aa++,'VoiceExtensionId':_0x441a52[_0x14e6('0x17')]});_0x4a7155[_0x14e6('0x13')]({'type':_0x441a52['type'],'app':_0x14e6('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x441a52[_0x14e6('0x1d')],'exten':_0x441a52['exten'],'priority':_0x4ec8cb['length']+_0x53cf7e[_0x14e6('0xf')]+_0x36e0aa++,'VoiceExtensionId':_0x441a52[_0x14e6('0x17')]});}}}for(var _0x4317b1=0x0;_0x4317b1<_0x4ec8cb['length'];_0x4317b1+=0x1){var _0x17ced9=_0x53cf7e[_0x14e6('0xf')]+_0x4ec8cb['length'];var _0x5d6751=_0x4317b1===_0x4ec8cb[_0x14e6('0x2a')]-0x1?_0x53cf7e['priority']+_0x4a7155[_0x14e6('0x2a')]+_0x409520[_0x14e6('0x2a')]+0x2:_0x53cf7e[_0x14e6('0xf')]+_0x4317b1+0x1;_0x4a7155[_0x14e6('0x3b')](_0x4317b1,0x0,{'type':_0x441a52[_0x14e6('0x14')],'app':_0x14e6('0x3c'),'appdata':_0x4ec8cb[_0x4317b1]+'?'+_0x441a52['context']+_0x14e6('0x3d')+_0x17ced9+':'+_0x441a52[_0x14e6('0x1d')]+',${EXTEN},'+_0x5d6751,'exten':_0x441a52[_0x14e6('0xb')],'context':_0x441a52[_0x14e6('0x1d')],'priority':_0x53cf7e[_0x14e6('0xf')]+_0x4317b1,'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});}_0x441a52[_0x14e6('0xf')]=_0x4a7155[_0x14e6('0x2a')]?_['last'](_0x4a7155)[_0x14e6('0xf')]+0x1:_0x53cf7e[_0x14e6('0xf')];_0x53cf7e[_0x14e6('0xf')]=(_0x409520['length']?_[_0x14e6('0x3e')](_0x409520)[_0x14e6('0xf')]:_0x441a52[_0x14e6('0xf')])+0x1;_0x53cf7e[_0x14e6('0x10')]=_[_0x14e6('0x3f')](_0x53cf7e[_0x14e6('0x10')],_0x4a7155,[_0x441a52],_0x409520);}_0x53cf7e[_0x14e6('0x10')][_0x14e6('0x13')]({'type':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x14')],'app':'Hangup','exten':_0x53ab5d[_0x47950b][0x0][_0x14e6('0xb')],'context':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x1d')],'priority':_0x53cf7e[_0x14e6('0xf')],'VoiceExtensionId':_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]});_0x2eea38['push'](_0x53ab5d[_0x47950b][0x0][_0x14e6('0x17')]);_0x3834c2=_[_0x14e6('0x3f')](_0x3834c2,_0x53cf7e[_0x14e6('0x10')]);}}return _0x67f4ce[_0x14e6('0x40')](function(_0x10b4de){return _0x67f4ce[_0x14e6('0x2')]['VoiceExtension'][_0x14e6('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x2eea38}},'transaction':_0x10b4de})[_0x14e6('0x5')](function(_0x56d3a0){return _0x67f4ce[_0x14e6('0x2')]['VoiceExtension']['bulkCreate'](_[_0x14e6('0x42')](_0x3834c2,_0x14e6('0xf')),{'transaction':_0x10b4de});});});})[_0x14e6('0x43')](function(_0x2daf92){console[_0x14e6('0x44')](_0x2daf92);});}exports[_0x14e6('0x45')]=rewrite; \ No newline at end of file +var _0xcaef=['CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','filter','tag','length','callerID','ExecIf','$[${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','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','error','rewrite','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','Set','format','type','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','context','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:'];(function(_0x4207a0,_0x131aab){var _0x3a05af=function(_0x41461f){while(--_0x41461f){_0x4207a0['push'](_0x4207a0['shift']());}};_0x3a05af(++_0x131aab);}(_0xcaef,0x141));var _0xfcae=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xcaef[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require('lodash');var util=require(_0xfcae('0x0'));function rewrite(_0xf83e1a,_0x8998e4){var _0x14007b=this;return _0xf83e1a['models'][_0xfcae('0x1')][_0xfcae('0x2')]({'raw':!![]})[_0xfcae('0x3')](function(_0x2792ed){_0x14007b[_0xfcae('0x4')]=_0x2792ed;return _0xf83e1a[_0xfcae('0x5')]['VoiceExtension'][_0xfcae('0x2')]({'where':{'IntervalId':_0x8998e4[_0xfcae('0x6')]},'raw':!![]});})['then'](function(_0x2b1473){return _0xf83e1a['models'][_0xfcae('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xfcae('0x8')](_[_0xfcae('0x9')](_0x2b1473,_0xfcae('0xa')))}},'order':[{'raw':_0xfcae('0xb')}],'raw':!![]});})['then'](function(_0x4fb583){var _0x3c8922=_['filter'](_0x4fb583,{'priority':'1'});var _0x2ebcbf=_['filter'](_0x4fb583,{'isApp':0x1});var _0x550275=_[_0xfcae('0xc')](_0x2ebcbf,_0xfcae('0xa'));var _0x164903=[_0xfcae('0xd'),_0xfcae('0xe')];var _0xeb97db=[];var _0x4071ee=[];for(var _0x576e57 in _0x550275){if(_0x550275[_0xfcae('0xf')](_0x576e57)){_0x14007b[_0xfcae('0x10')]=0x2;_0x14007b[_0xfcae('0x11')]=[];_0x14007b[_0xfcae('0x12')]=_[_0xfcae('0x13')](_0x3c8922,{'exten':_0x550275[_0x576e57][0x0]['exten']});_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0]['type'],'app':_0xfcae('0x15'),'appdata':util[_0xfcae('0x16')]('CDR(type)=%s',_0x550275[_0x576e57][0x0][_0xfcae('0x17')]),'context':_0x550275[_0x576e57][0x0]['context'],'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});if(_0x550275[_0x576e57][0x0][_0xfcae('0x17')]===_0xfcae('0x19')){if(_0x14007b[_0xfcae('0x12')]){_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':'CDR(destination)='+(_0x14007b[_0xfcae('0x12')][_0xfcae('0x1a')]?_0xfcae('0x1b')+_0x14007b[_0xfcae('0x12')]['cutdigits']+'}':_0xfcae('0x1c')),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});}_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x1e')+_0x550275[_0x576e57][0x0][_0xfcae('0x18')],'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b['priority']++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});var _0x30add0=_0x14007b['priority']++;_0x14007b['extensions'][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':'ExecIf','appdata':_0xfcae('0x1f')+(_0x30add0+0x2)+_0xfcae('0x20')+(_0x30add0+0x1)+')','context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'priority':_0x30add0,'VoiceExtensionId':_0x550275[_0x576e57][0x0]['VoiceExtensionId']});if(_0x14007b[_0xfcae('0x12')]){_0x14007b['extensions'][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0x14007b[_0xfcae('0x12')][_0xfcae('0x1a')]?_0xfcae('0x21')+_0x14007b[_0xfcae('0x12')]['cutdigits']+'}':_0xfcae('0x22'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});}_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':'outboundrouteid='+_0x550275[_0x576e57][0x0][_0xfcae('0x18')],'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});if(_0x14007b[_0xfcae('0x12')]&&_0x14007b['extension'][_0xfcae('0xf')](_0xfcae('0x23'))&&_0x14007b[_0xfcae('0x12')][_0xfcae('0x23')]!==_0xfcae('0x24')){_0x14007b['extensions']['push']({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x25'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0]['VoiceExtensionId']});_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0]['type'],'app':_0xfcae('0x15'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x14007b[_0xfcae('0x12')][_0xfcae('0x23')]||_0xfcae('0x26'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});}}_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0]['type'],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x27'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'priority':_0x14007b['priority']++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x28'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});_0x14007b[_0xfcae('0x11')][_0xfcae('0x14')]({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':'Set','appdata':_0xfcae('0x29'),'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'exten':_0x550275[_0x576e57][0x0]['exten'],'priority':_0x14007b[_0xfcae('0x10')]++,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});for(var _0x4d657a=0x0,_0x57e147=0x0;_0x4d657a<_0x550275[_0x576e57]['length'];_0x4d657a+=0x1,_0x57e147=0x0){var _0x519ea7=_0x550275[_0x576e57][_0x4d657a];if(_0x519ea7[_0xfcae('0x17')]){_0x519ea7[_0xfcae('0x17')]=_0x519ea7[_0xfcae('0x17')][_0xfcae('0x2a')]();}var _0x16316b=[];var _0x5dab30=[];delete _0x519ea7['id'];delete _0x519ea7[_0xfcae('0x2b')];delete _0x519ea7[_0xfcae('0x2c')];var _0x15559d=_0x519ea7['interval']!=='*,*,*,*'?[_0x519ea7[_0xfcae('0x2d')]]:_0x519ea7[_0xfcae('0x6')]?_[_0xfcae('0x9')](_[_0xfcae('0x2e')](_0x14007b[_0xfcae('0x4')],{'IntervalId':_0x519ea7[_0xfcae('0x6')]}),_0xfcae('0x2d')):[];if(_0x519ea7['hasOwnProperty'](_0xfcae('0x2f'))){if(_0x519ea7[_0xfcae('0x2f')]&&_0x519ea7[_0xfcae('0x2f')]!=='--'){_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':'CDR(tag)='+_0x519ea7[_0xfcae('0x2f')],'context':_0x519ea7[_0xfcae('0x1d')],'exten':_0x519ea7[_0xfcae('0xa')],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});}}if(_0x519ea7[_0xfcae('0x17')]===_0xfcae('0x19')&&_0x519ea7[_0xfcae('0xf')](_0xfcae('0x31'))){if(_0x519ea7[_0xfcae('0x31')]){_0x16316b['push']({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x32'),'appdata':_0xfcae('0x33')+_0x519ea7['callerID']+')','context':_0x519ea7['context'],'exten':_0x519ea7['exten'],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});}else{_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x32'),'appdata':_0xfcae('0x34'),'context':_0x519ea7[_0xfcae('0x1d')],'exten':_0x519ea7['exten'],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});}}if(_0x519ea7[_0xfcae('0xf')](_0xfcae('0x35'))){if(_0x164903[_0xfcae('0x36')](_0x519ea7[_0xfcae('0x37')]['toLowerCase']())>=0x0&&_0x519ea7[_0xfcae('0x38')]!=='custom'){if(_0x519ea7['answer']){_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7['type'],'app':_0xfcae('0x32'),'appdata':_0xfcae('0x39'),'context':_0x519ea7[_0xfcae('0x1d')],'exten':_0x519ea7['exten'],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b['priority']+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x3a'),'context':_0x519ea7[_0xfcae('0x1d')],'exten':_0x519ea7[_0xfcae('0xa')],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});}else{_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x32'),'appdata':_0xfcae('0x3b'),'context':_0x519ea7[_0xfcae('0x1d')],'exten':_0x519ea7[_0xfcae('0xa')],'priority':_0x15559d[_0xfcae('0x30')]+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});_0x16316b[_0xfcae('0x14')]({'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x15'),'appdata':_0xfcae('0x3c'),'context':_0x519ea7['context'],'exten':_0x519ea7['exten'],'priority':_0x15559d['length']+_0x14007b[_0xfcae('0x10')]+_0x57e147++,'VoiceExtensionId':_0x519ea7[_0xfcae('0x18')]});}}}for(var _0x312067=0x0;_0x312067<_0x15559d['length'];_0x312067+=0x1){var _0x4e08ad=_0x14007b[_0xfcae('0x10')]+_0x15559d[_0xfcae('0x30')];var _0x2a4c7e=_0x312067===_0x15559d[_0xfcae('0x30')]-0x1?_0x14007b[_0xfcae('0x10')]+_0x16316b[_0xfcae('0x30')]+_0x5dab30[_0xfcae('0x30')]+0x2:_0x14007b[_0xfcae('0x10')]+_0x312067+0x1;_0x16316b[_0xfcae('0x3d')](_0x312067,0x0,{'type':_0x519ea7[_0xfcae('0x17')],'app':_0xfcae('0x3e'),'appdata':_0x15559d[_0x312067]+'?'+_0x519ea7[_0xfcae('0x1d')]+_0xfcae('0x3f')+_0x4e08ad+':'+_0x519ea7[_0xfcae('0x1d')]+',${EXTEN},'+_0x2a4c7e,'exten':_0x519ea7[_0xfcae('0xa')],'context':_0x519ea7[_0xfcae('0x1d')],'priority':_0x14007b[_0xfcae('0x10')]+_0x312067,'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});}_0x519ea7[_0xfcae('0x10')]=_0x16316b[_0xfcae('0x30')]?_[_0xfcae('0x40')](_0x16316b)[_0xfcae('0x10')]+0x1:_0x14007b[_0xfcae('0x10')];_0x14007b['priority']=(_0x5dab30[_0xfcae('0x30')]?_[_0xfcae('0x40')](_0x5dab30)[_0xfcae('0x10')]:_0x519ea7[_0xfcae('0x10')])+0x1;_0x14007b[_0xfcae('0x11')]=_['concat'](_0x14007b[_0xfcae('0x11')],_0x16316b,[_0x519ea7],_0x5dab30);}_0x14007b[_0xfcae('0x11')]['push']({'type':_0x550275[_0x576e57][0x0][_0xfcae('0x17')],'app':_0xfcae('0x41'),'exten':_0x550275[_0x576e57][0x0][_0xfcae('0xa')],'context':_0x550275[_0x576e57][0x0][_0xfcae('0x1d')],'priority':_0x14007b[_0xfcae('0x10')],'VoiceExtensionId':_0x550275[_0x576e57][0x0][_0xfcae('0x18')]});_0xeb97db[_0xfcae('0x14')](_0x550275[_0x576e57][0x0][_0xfcae('0x18')]);_0x4071ee=_[_0xfcae('0x42')](_0x4071ee,_0x14007b[_0xfcae('0x11')]);}}return _0xf83e1a[_0xfcae('0x43')](function(_0x3a549a){return _0xf83e1a[_0xfcae('0x5')][_0xfcae('0x7')][_0xfcae('0x44')]({'where':{'VoiceExtensionId':{'$in':_0xeb97db}},'transaction':_0x3a549a})[_0xfcae('0x3')](function(_0x538e3d){return _0xf83e1a[_0xfcae('0x5')][_0xfcae('0x7')]['bulkCreate'](_['sortBy'](_0x4071ee,_0xfcae('0x10')),{'transaction':_0x3a549a});});});})['catch'](function(_0x207c56){console[_0xfcae('0x45')](_0x207c56);});}exports[_0xfcae('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 05b675c..fabd25e 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x6e5214,_0xe807fe){var _0x4babe7=function(_0xd11ea1){while(--_0xd11ea1){_0x6e5214['push'](_0x6e5214['shift']());}};_0x4babe7(++_0xe807fe);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0xcb91[_0x305486];return _0xa04940;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index bade4c9..aad55d5 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 _0xa19e=['phone','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.id','cm_hopper_black','fromQuery','ContactId','select','\x20=\x20?','toString','keys','CompanyId','insert',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','info','Received\x20SIGINT','exit','errors','push','code','sequelize','query','spread','error','message','main','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','then','finish','affectedRows','unlink','catch','complete','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','bluebird','moment','ioredis','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field'];(function(_0x34e821,_0x2cebeb){var _0x83fe5d=function(_0x159703){while(--_0x159703){_0x34e821['push'](_0x34e821['shift']());}};_0x83fe5d(++_0x2cebeb);}(_0xa19e,0x1f1));var _0xea19=function(_0x2d4fee,_0xc38b94){_0x2d4fee=_0x2d4fee-0x0;var _0x265b33=_0xa19e[_0x2d4fee];return _0x265b33;};'use strict';var fs=require('fs');var path=require(_0xea19('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xea19('0x1'));var moment=require(_0xea19('0x2'));var squel=require('squel');var Redis=require(_0xea19('0x3'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0xea19('0x4')]=_['defaults'](config['redis'],{'host':_0xea19('0x5'),'port':0x18eb});var socket=require(_0xea19('0x6'))(new Redis(config[_0xea19('0x4')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xea19('0x7')](_0xea19('0x8'));function isEmail(_0x1278e2){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))*$/[_0xea19('0x9')](_0x1278e2);}function selectNotIn(_0x209007,_0x4505dc,_0x5d2976,_0x525d08,_0x553aaa){return squel['select']()[_0xea19('0xa')](_0xea19('0xb'))[_0xea19('0xc')](_0x525d08)[_0xea19('0xd')](_0x4505dc,null,_0x4505dc+'.id\x20=\x20'+_0x525d08+'.'+_0x5d2976)[_0xea19('0xe')](_0x525d08+'.'+_0x5d2976+'\x20=\x20'+_0x209007+'.'+_0x5d2976)[_0xea19('0xe')](_0x4505dc+_0xea19('0xf')+_0x553aaa['join']()+')');}function insertCmHopper(_0x4d2a0d,_0x451fe8,_0x4c1462,_0x30a06e,_0x57b66f){var _0x285e94=[_0xea19('0x10'),_0xea19('0x11'),'cm_contacts.id',_0xea19('0x12'),_0x451fe8+'.'+_0x30a06e,_0xea19('0x13'),_0xea19('0x14'),'cm_contacts.priority',_0xea19('0x15'),'\x22'+_0x57b66f+'\x22'];return squel['insert']()[_0xea19('0x16')](_0xea19('0x17'))['fromQuery']([_0xea19('0xb'),_0xea19('0x18'),'ContactId',_0xea19('0x19'),_0x30a06e,_0xea19('0x1a'),_0xea19('0x1b'),_0xea19('0x1c'),_0xea19('0x1d'),_0xea19('0x1e')],squel['select']()[_0xea19('0x1f')](_0x285e94)[_0xea19('0xc')](_0x451fe8)[_0xea19('0xd')](_0xea19('0x20'),null,'cm_contacts.ListId\x20=\x20'+_0x451fe8+_0xea19('0x21'))[_0xea19('0xd')](_0x4c1462,null,_0x4c1462+_0xea19('0x22')+_0x451fe8+'.'+_0x30a06e)[_0xea19('0xe')](_0x451fe8+_0xea19('0x23'),_0x4d2a0d)[_0xea19('0xe')](_0xea19('0x24'),NOW)[_0xea19('0xe')](_0xea19('0x25'),selectNotIn(_0x451fe8,_0x4c1462,_0x30a06e,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0xea19('0xe')](_0xea19('0x25'),selectNotIn(_0x451fe8,_0x4c1462,_0x30a06e,_0xea19('0x17'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x478eda,_0xc178e0,_0x17af25,_0x566f07){var _0xa70704=['cm_contacts.phone',_0xea19('0x26'),_0xea19('0x12'),_0xc178e0+'.'+_0x566f07,_0xea19('0x13'),'cm_contacts.updatedAt'];return squel['insert']()[_0xea19('0x16')](_0xea19('0x27'))[_0xea19('0x28')]([_0xea19('0xb'),_0xea19('0x29'),_0xea19('0x19'),_0x566f07,_0xea19('0x1a'),_0xea19('0x1b')],squel[_0xea19('0x2a')]()[_0xea19('0x1f')](_0xa70704)['from'](_0xc178e0)[_0xea19('0xd')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xc178e0+_0xea19('0x21'))[_0xea19('0xd')](_0x17af25,null,_0x17af25+'.id\x20=\x20'+_0xc178e0+'.'+_0x566f07)[_0xea19('0xe')](_0xc178e0+_0xea19('0x23'),_0x478eda)[_0xea19('0xe')](_0xea19('0x24'),NOW)[_0xea19('0xe')](_0xea19('0x25'),squel[_0xea19('0x2a')]()[_0xea19('0xa')](_0xea19('0xb'))['from'](_0xea19('0x27'))[_0xea19('0xe')]('ListId\x20=\x20?',_0x478eda)[_0xea19('0xe')](_0x566f07+_0xea19('0x2b'),_0xc178e0+'.'+_0x566f07)))[_0xea19('0x2c')]();}function insertCmContact(_0x223db0,_0x326fd9,_0x2c8750,_0x2f8db3){var _0x3ec935=_['concat'](_[_0xea19('0x2d')](_0x2f8db3),[_0xea19('0x19'),_0xea19('0x2e'),_0xea19('0x1a'),_0xea19('0x1b')]);return squel[_0xea19('0x2f')]()[_0xea19('0x16')](_0xea19('0x20'))['fromQuery'](_0x3ec935,squel[_0xea19('0x2a')]()['fields'](_0x3ec935)[_0xea19('0xc')](_0x326fd9)[_0xea19('0xe')]('('+_0x2c8750['join'](',')+_0xea19('0x30'),squel[_0xea19('0x2a')]()[_0xea19('0x1f')](_0x2c8750)[_0xea19('0xc')]('cm_contacts')[_0xea19('0xe')](_0xea19('0x31'),_0x223db0)['where'](_0xea19('0x32')))[_0xea19('0xe')](_0xea19('0x33'),squel[_0xea19('0x2a')]()[_0xea19('0xa')]('MIN(id)','min_id')[_0xea19('0xc')](_0x326fd9)['group'](_0x2c8750['join'](','))))[_0xea19('0x2c')]();}function handleStop(){logger[_0xea19('0x34')](_0xea19('0x35'));stopped=!![];}function handleUncaughtException(_0x2b1045){logger['error'](_0x2b1045['message']);process[_0xea19('0x36')](0x1);}function handleError(_0x1038ba,_0x2133ea){stats[_0xea19('0x37')][_0xea19('0x38')]({'name':_0x2133ea[_0xea19('0x39')],'message':_0x2133ea['message'],'row':_0x1038ba});}function handleQuery(_0x150eeb){logger['info'](_0x150eeb);return db[_0xea19('0x3a')][_0xea19('0x3b')](_0x150eeb)[_0xea19('0x3c')](function(_0x97d8ac){results[_0xea19('0x38')](_0x97d8ac);})['catch'](function(_0x391dbc){logger[_0xea19('0x3d')](_0x391dbc[_0xea19('0x3e')]);});}function main(_0x2b453a,_0x2513e6,_0x25f3f8,_0x536a11){logger[_0xea19('0x34')](_0xea19('0x3f'),_0x2b453a,JSON['stringify'](_0x2513e6));process[_0xea19('0x40')](_0xea19('0x41'));var _0xba5174=_0x2513e6[_0xea19('0x42')];var _0x4e3cb6=_0x2513e6['socket_timestamp'];var _0x11c45c=path['join'](config[_0xea19('0x43')],_0xea19('0x44'),_0x4e3cb6+_0xea19('0x45'));var _0x2ed1da=_['keys'](_0xba5174)[_0xea19('0xd')]();logger['info'](_0xea19('0x46'),_0x2ed1da);fs[_0xea19('0x47')](_0x11c45c,_0x2ed1da+'\x0a');Papa[_0xea19('0x48')](fs[_0xea19('0x49')](_0x2b453a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x487e4a,_0x362d18){try{for(var _0x29c3ab=0x0,_0x34cab8=[];_0x29c3ab<_0x487e4a[_0xea19('0x4a')][_0xea19('0x4b')];_0x29c3ab++){stats[_0xea19('0x4c')]+=0x1;if(_0x487e4a[_0xea19('0x37')][_0x29c3ab]){handleError(_0x487e4a[_0xea19('0x4a')][_0x29c3ab],_0x487e4a[_0xea19('0x37')][_0x29c3ab]);}else{var _0x25eb60=[];for(var _0x105fcf in _0xba5174){if(_0xba5174[_0xea19('0x4d')](_0x105fcf)){if(_0x487e4a[_0xea19('0x4a')][_0x29c3ab][_0xba5174[_0x105fcf]]){var _0x3e6d20=_[_0xea19('0x4e')](_0x487e4a[_0xea19('0x4a')][_0x29c3ab][_0xba5174[_0x105fcf]][_0xea19('0x4f')](/"/g,'\x27'));switch(_0x105fcf){case'scheduledat':var _0x2dcdd0=moment(_0x3e6d20,_0xea19('0x8'),!![]);if(_0x2dcdd0[_0xea19('0x50')]()){_0x34cab8[_0xea19('0x38')]('\x22'+_0x3e6d20+'\x22');}else{_0x25eb60['push'](_0xea19('0x51'));}break;case _0xea19('0x1c'):var _0x12cf27=parseInt(_0x3e6d20);_0x3e6d20=_['isNaN'](_0x12cf27)||_0x12cf27<0x0||_0x12cf27>0x4?_0x536a11?0x3:0x2:_0x12cf27;_0x34cab8[_0xea19('0x38')]('\x22'+_0x3e6d20+'\x22');break;case _0xea19('0x1d'):var _0x23679f=parseInt(_0x3e6d20);if(_[_0xea19('0x52')](_0x23679f)&&_[_0xea19('0x53')](_0x25f3f8,_0x23679f)){_0x34cab8[_0xea19('0x38')]('\x22'+_0x23679f+'\x22');}else{_0x25eb60['push'](_0xea19('0x54'));}break;case _0xea19('0x55'):if(isEmail(_0x3e6d20)){_0x34cab8[_0xea19('0x38')]('\x22'+_0x3e6d20+'\x22');}else{_0x25eb60[_0xea19('0x38')](_0xea19('0x56'));}break;case _0xea19('0x57'):var _0x4f6e1b=moment(_0x3e6d20,_0xea19('0x58'),!![]);if(_0x4f6e1b[_0xea19('0x50')]()){_0x34cab8[_0xea19('0x38')]('\x22'+_0x3e6d20+'\x22');}else{_0x25eb60[_0xea19('0x38')](_0xea19('0x59'));}break;default:_0x34cab8[_0xea19('0x38')]('\x22'+_0x3e6d20+'\x22');}}else{switch(_0x105fcf){case _0xea19('0x5a'):case _0xea19('0xb'):_0x25eb60[_0xea19('0x38')](_0x105fcf+_0xea19('0x5b'));break;default:_0x34cab8[_0xea19('0x38')]('\x22\x22');}}}}if(_0x25eb60[_0xea19('0x4b')]){handleError(_0x487e4a[_0xea19('0x4a')][_0x29c3ab],{'code':'SystemRow','message':_0x25eb60[_0xea19('0xd')]()});}else{fs[_0xea19('0x5c')](_0x11c45c,_0x34cab8[_0xea19('0xd')]()+'\x0a');}_0x34cab8=[];}if(!(stats[_0xea19('0x4c')]%0xc8)){socket[_0xea19('0x5d')](_0xea19('0x5e')+_0x4e3cb6,stats);stats[_0xea19('0x37')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x362d18[_0xea19('0x5f')]();}}catch(_0x33a501){handleError(_0x487e4a[_0xea19('0x4a')][_0x29c3ab],{'code':_0xea19('0x60'),'message':_0x33a501[_0xea19('0x3e')]});logger[_0xea19('0x3d')](_0xea19('0x61'),_0x33a501['message']);}},'complete':function(){try{var _0x438bfa=[];var _0xf14a8e='cm_contacts';if(_0x2513e6[_0xea19('0x62')]&&_0x2513e6[_0xea19('0x62')][_0xea19('0x4b')]){_0xf14a8e=_0xea19('0x63')+_0x4e3cb6;_0x438bfa[_0xea19('0x38')](_0xea19('0x64')+_0xf14a8e+_0xea19('0x65'));}var _0x3c3969=util['format'](_0xea19('0x66'),_0x11c45c,_0xf14a8e,_0x2ed1da,_0x2513e6[_0xea19('0x19')],_0x2513e6['CompanyId']||null,NOW,NOW);if(_[_0xea19('0x67')](_0xba5174['scheduledat'])){_0x3c3969+=_0xea19('0x68');}_0x438bfa[_0xea19('0x38')](_0x3c3969);if(_0x2513e6[_0xea19('0x62')]&&_0x2513e6[_0xea19('0x62')][_0xea19('0x4b')]){_0x438bfa[_0xea19('0x38')](insertCmContact(_0x2513e6[_0xea19('0x19')],_0xf14a8e,_0x2513e6[_0xea19('0x62')],_0xba5174));_0x438bfa[_0xea19('0x38')](_0xea19('0x69')+_0xf14a8e+';');}_0x438bfa['push'](insertCmHopper(_0x2513e6[_0xea19('0x19')],_0xea19('0x6a'),_0xea19('0x6b'),'VoiceQueueId',_0x536a11));_0x438bfa[_0xea19('0x38')](insertCmHopperBlack(_0x2513e6[_0xea19('0x19')],'voice_queues_has_cm_blacklists',_0xea19('0x6b'),_0xea19('0x6c')));_0x438bfa['push'](insertCmHopper(_0x2513e6['ListId'],_0xea19('0x6d'),_0xea19('0x6e'),'CampaignId',_0x536a11));_0x438bfa[_0xea19('0x38')](insertCmHopperBlack(_0x2513e6[_0xea19('0x19')],'campaigns_has_cm_blacklists','campaigns',_0xea19('0x6f')));BPromise['each'](_0x438bfa,handleQuery)[_0xea19('0x70')](function(_0x4e23d0){stats[_0xea19('0x71')]=!![];stats[_0xea19('0x72')]=_0x2513e6[_0xea19('0x62')]&&_0x2513e6[_0xea19('0x62')]['length']?results[0x2][_0xea19('0x72')]:results[0x0][_0xea19('0x72')];socket[_0xea19('0x5d')](_0xea19('0x5e')+_0x4e3cb6,stats);fs[_0xea19('0x73')](_0x2b453a);fs[_0xea19('0x73')](_0x11c45c);process[_0xea19('0x36')](0x0);})[_0xea19('0x74')](function(_0x2e3dc1){logger['error'](_0x2e3dc1[_0xea19('0x3e')]);process[_0xea19('0x36')](0x1);});}catch(_0x2df72c){logger[_0xea19('0x3d')](_0xea19('0x75'),_0x2df72c[_0xea19('0x3e')]);process[_0xea19('0x36')](0x1);}},'error':function(_0x369399,_0xf09563,_0x2b571a,_0x80ece1){throw new Error(_0x80ece1);}});}function validate(){if(process['argv']&&process['argv'][_0xea19('0x4b')]<0x4){throw new Error(_0xea19('0x76'));}var _0x2308ee=path[_0xea19('0xd')](config[_0xea19('0x43')],_0xea19('0x44'),process['argv'][0x2]);if(!fs[_0xea19('0x77')](_0x2308ee)){throw new Error(_0xea19('0x78'));}var _0x3b03b0={};try{_0x3b03b0=JSON[_0xea19('0x48')](process['argv'][0x3]);if(!_0x3b03b0[_0xea19('0x42')]){throw new Error(_0xea19('0x79'));}if(!_0x3b03b0[_0xea19('0x42')][_0xea19('0xb')]){throw new Error(_0xea19('0x7a'));}if(!_0x3b03b0[_0xea19('0x42')][_0xea19('0x5a')]){throw new Error(_0xea19('0x7b'));}var _0x325edd=0x0;if(_0x3b03b0[_0xea19('0x42')][_0xea19('0x1d')]){_0x325edd=0x1;}if(!_0x3b03b0[_0xea19('0x19')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x9270ba){throw new Error('body\x20id\x20mandatory');}var _0x1482ce=[];try{_0x1482ce=_[_0xea19('0x7c')](JSON[_0xea19('0x48')](process['argv'][0x4]),'id');}catch(_0x1ed3e9){logger[_0xea19('0x34')](_0xea19('0x7d'));}main(_0x2308ee,_0x3b03b0,_0x1482ce,_0x325edd);}validate();process['on'](_0xea19('0x7e'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xa304=['rows','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','firstName','\x20not\x20specified','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','recallme','fields','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','fromQuery','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','keys','ListId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','error','message','exit','errors','push','sequelize','query','catch','main','stringify','send','start','binding','socket_timestamp','server/files/tmp','parse','createReadStream','data','length'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xa304,0x1bf));var _0x4a30=function(_0x1e48d3,_0x5d8c43){_0x1e48d3=_0x1e48d3-0x0;var _0x2852b1=_0xa304[_0x1e48d3];return _0x2852b1;};'use strict';var fs=require('fs');var path=require(_0x4a30('0x0'));var _=require(_0x4a30('0x1'));var Papa=require(_0x4a30('0x2'));var util=require('util');var BPromise=require(_0x4a30('0x3'));var moment=require(_0x4a30('0x4'));var squel=require(_0x4a30('0x5'));var Redis=require(_0x4a30('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x4a30('0x7'));var logger=require(_0x4a30('0x8'))(_0x4a30('0x9'));config[_0x4a30('0xa')]=_[_0x4a30('0xb')](config[_0x4a30('0xa')],{'host':_0x4a30('0xc'),'port':0x18eb});var socket=require(_0x4a30('0xd'))(new Redis(config[_0x4a30('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4a30('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5b2529){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))*$/[_0x4a30('0xf')](_0x5b2529);}function selectNotIn(_0x6f7d7,_0x452551,_0x1b45c9,_0x374769,_0x3779fb){return squel[_0x4a30('0x10')]()['field'](_0x4a30('0x11'))['from'](_0x374769)[_0x4a30('0x12')](_0x452551,null,_0x452551+_0x4a30('0x13')+_0x374769+'.'+_0x1b45c9)[_0x4a30('0x14')](_0x374769+'.'+_0x1b45c9+_0x4a30('0x15')+_0x6f7d7+'.'+_0x1b45c9)[_0x4a30('0x14')](_0x452551+_0x4a30('0x16')+_0x3779fb[_0x4a30('0x12')]()+')');}function insertCmHopper(_0x242d95,_0x529fd7,_0x375ebc,_0x41ca2c,_0x319995){var _0x3cc116=[_0x4a30('0x17'),_0x4a30('0x18'),'cm_contacts.id','cm_contacts.ListId',_0x529fd7+'.'+_0x41ca2c,_0x4a30('0x19'),_0x4a30('0x1a'),_0x4a30('0x1b'),_0x4a30('0x1c'),'\x22'+_0x319995+'\x22'];return squel[_0x4a30('0x1d')]()[_0x4a30('0x1e')](_0x4a30('0x1f'))['fromQuery']([_0x4a30('0x11'),_0x4a30('0x20'),_0x4a30('0x21'),'ListId',_0x41ca2c,_0x4a30('0x22'),_0x4a30('0x23'),_0x4a30('0x24'),_0x4a30('0x25'),_0x4a30('0x26')],squel[_0x4a30('0x10')]()[_0x4a30('0x27')](_0x3cc116)[_0x4a30('0x28')](_0x529fd7)[_0x4a30('0x12')](_0x4a30('0x29'),null,'cm_contacts.ListId\x20=\x20'+_0x529fd7+_0x4a30('0x2a'))[_0x4a30('0x12')](_0x375ebc,null,_0x375ebc+_0x4a30('0x13')+_0x529fd7+'.'+_0x41ca2c)[_0x4a30('0x14')](_0x529fd7+_0x4a30('0x2b'),_0x242d95)[_0x4a30('0x14')](_0x4a30('0x2c'),NOW)['where'](_0x4a30('0x2d'),selectNotIn(_0x529fd7,_0x375ebc,_0x41ca2c,'cm_hopper',[_0x4a30('0x2e'),'\x22onlyIfOpen\x22']))['where'](_0x4a30('0x2d'),selectNotIn(_0x529fd7,_0x375ebc,_0x41ca2c,_0x4a30('0x1f'),['\x22always\x22'])))[_0x4a30('0x2f')]();}function insertCmHopperBlack(_0x7121b3,_0x7f624b,_0x210513,_0x3d186f){var _0x37dfa8=['cm_contacts.phone','cm_contacts.id',_0x4a30('0x30'),_0x7f624b+'.'+_0x3d186f,'cm_contacts.createdAt',_0x4a30('0x1a')];return squel[_0x4a30('0x1d')]()[_0x4a30('0x1e')](_0x4a30('0x31'))[_0x4a30('0x32')]([_0x4a30('0x11'),'ContactId','ListId',_0x3d186f,_0x4a30('0x22'),'updatedAt'],squel[_0x4a30('0x10')]()[_0x4a30('0x27')](_0x37dfa8)['from'](_0x7f624b)[_0x4a30('0x12')](_0x4a30('0x29'),null,_0x4a30('0x33')+_0x7f624b+'.CmListId')['join'](_0x210513,null,_0x210513+_0x4a30('0x13')+_0x7f624b+'.'+_0x3d186f)[_0x4a30('0x14')](_0x7f624b+_0x4a30('0x2b'),_0x7121b3)['where'](_0x4a30('0x2c'),NOW)[_0x4a30('0x14')](_0x4a30('0x2d'),squel['select']()[_0x4a30('0x34')](_0x4a30('0x11'))['from'](_0x4a30('0x31'))[_0x4a30('0x14')](_0x4a30('0x35'),_0x7121b3)[_0x4a30('0x14')](_0x3d186f+'\x20=\x20?',_0x7f624b+'.'+_0x3d186f)))['toString']();}function insertCmContact(_0x4f623a,_0x2d8f60,_0x1d5a98,_0x1ef622){var _0x36931e=_['concat'](_[_0x4a30('0x36')](_0x1ef622),[_0x4a30('0x37'),'CompanyId',_0x4a30('0x22'),_0x4a30('0x23')]);return squel['insert']()[_0x4a30('0x1e')](_0x4a30('0x29'))[_0x4a30('0x32')](_0x36931e,squel[_0x4a30('0x10')]()[_0x4a30('0x27')](_0x36931e)[_0x4a30('0x28')](_0x2d8f60)[_0x4a30('0x14')]('('+_0x1d5a98['join'](',')+_0x4a30('0x38'),squel[_0x4a30('0x10')]()[_0x4a30('0x27')](_0x1d5a98)[_0x4a30('0x28')](_0x4a30('0x29'))[_0x4a30('0x14')]('ListId\x20=\x20?',_0x4f623a)['where'](_0x4a30('0x39')))['where']('id\x20IN\x20?',squel['select']()[_0x4a30('0x34')](_0x4a30('0x3a'),'min_id')[_0x4a30('0x28')](_0x2d8f60)[_0x4a30('0x3b')](_0x1d5a98[_0x4a30('0x12')](','))))[_0x4a30('0x2f')]();}function handleStop(){logger[_0x4a30('0x3c')](_0x4a30('0x3d'));stopped=!![];}function handleUncaughtException(_0x3c4357){logger[_0x4a30('0x3e')](_0x3c4357[_0x4a30('0x3f')]);process[_0x4a30('0x40')](0x1);}function handleError(_0xf7eb53,_0x12f1fe){stats[_0x4a30('0x41')][_0x4a30('0x42')]({'name':_0x12f1fe['code'],'message':_0x12f1fe['message'],'row':_0xf7eb53});}function handleQuery(_0x2ea366){logger['info'](_0x2ea366);return db[_0x4a30('0x43')][_0x4a30('0x44')](_0x2ea366)['spread'](function(_0x4ad627){results[_0x4a30('0x42')](_0x4ad627);})[_0x4a30('0x45')](function(_0x232ce6){logger[_0x4a30('0x3e')](_0x232ce6['message']);});}function main(_0x3e0014,_0x5da95c,_0xc18b99,_0x68c2f9){logger[_0x4a30('0x3c')](_0x4a30('0x46'),_0x3e0014,JSON[_0x4a30('0x47')](_0x5da95c));process[_0x4a30('0x48')](_0x4a30('0x49'));var _0x7c38c9=_0x5da95c[_0x4a30('0x4a')];var _0x8ddb4a=_0x5da95c[_0x4a30('0x4b')];var _0x31e27d=path[_0x4a30('0x12')](config['root'],_0x4a30('0x4c'),_0x8ddb4a+'.csv');var _0xc02d9c=_['keys'](_0x7c38c9)[_0x4a30('0x12')]();logger[_0x4a30('0x3c')]('header',_0xc02d9c);fs['writeFileSync'](_0x31e27d,_0xc02d9c+'\x0a');Papa[_0x4a30('0x4d')](fs[_0x4a30('0x4e')](_0x3e0014),{'header':!![],'skipEmptyLines':!![],'step':function(_0xa193,_0xc02a6b){try{for(var _0x36bfb9=0x0,_0x4ae50b=[];_0x36bfb9<_0xa193[_0x4a30('0x4f')][_0x4a30('0x50')];_0x36bfb9++){stats[_0x4a30('0x51')]+=0x1;if(_0xa193[_0x4a30('0x41')][_0x36bfb9]){handleError(_0xa193[_0x4a30('0x4f')][_0x36bfb9],_0xa193[_0x4a30('0x41')][_0x36bfb9]);}else{var _0x57a3c2=[];for(var _0x56e3fc in _0x7c38c9){if(_0x7c38c9[_0x4a30('0x52')](_0x56e3fc)){if(_0xa193[_0x4a30('0x4f')][_0x36bfb9][_0x7c38c9[_0x56e3fc]]){var _0x41f5dc=_[_0x4a30('0x53')](_0xa193[_0x4a30('0x4f')][_0x36bfb9][_0x7c38c9[_0x56e3fc]][_0x4a30('0x54')](/"/g,'\x27'));switch(_0x56e3fc){case _0x4a30('0x20'):var _0x5767c0=moment(_0x41f5dc,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x5767c0['isValid']()){_0x4ae50b[_0x4a30('0x42')]('\x22'+_0x41f5dc+'\x22');}else{_0x57a3c2[_0x4a30('0x42')](_0x4a30('0x55'));}break;case _0x4a30('0x24'):var _0x4477c1=parseInt(_0x41f5dc);_0x41f5dc=_['isNaN'](_0x4477c1)||_0x4477c1<0x0||_0x4477c1>0x4?_0x68c2f9?0x3:0x2:_0x4477c1;_0x4ae50b['push']('\x22'+_0x41f5dc+'\x22');break;case _0x4a30('0x25'):var _0x122152=parseInt(_0x41f5dc);if(_['isNumber'](_0x122152)&&_[_0x4a30('0x56')](_0xc18b99,_0x122152)){_0x4ae50b['push']('\x22'+_0x122152+'\x22');}else{_0x57a3c2[_0x4a30('0x42')](_0x4a30('0x57'));}break;case _0x4a30('0x58'):if(isEmail(_0x41f5dc)){_0x4ae50b['push']('\x22'+_0x41f5dc+'\x22');}else{_0x57a3c2['push'](_0x4a30('0x59'));}break;case _0x4a30('0x5a'):var _0x1a4d8e=moment(_0x41f5dc,_0x4a30('0x5b'),!![]);if(_0x1a4d8e[_0x4a30('0x5c')]()){_0x4ae50b[_0x4a30('0x42')]('\x22'+_0x41f5dc+'\x22');}else{_0x57a3c2[_0x4a30('0x42')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x4ae50b[_0x4a30('0x42')]('\x22'+_0x41f5dc+'\x22');}}else{switch(_0x56e3fc){case _0x4a30('0x5d'):case _0x4a30('0x11'):_0x57a3c2[_0x4a30('0x42')](_0x56e3fc+_0x4a30('0x5e'));break;default:_0x4ae50b[_0x4a30('0x42')]('\x22\x22');}}}}if(_0x57a3c2['length']){handleError(_0xa193['data'][_0x36bfb9],{'code':_0x4a30('0x5f'),'message':_0x57a3c2[_0x4a30('0x12')]()});}else{fs[_0x4a30('0x60')](_0x31e27d,_0x4ae50b[_0x4a30('0x12')]()+'\x0a');}_0x4ae50b=[];}if(!(stats[_0x4a30('0x51')]%0xc8)){socket['emit'](_0x4a30('0x61')+_0x8ddb4a,stats);stats[_0x4a30('0x41')]=[];}}if(stopped){logger[_0x4a30('0x3c')](_0x4a30('0x62'));_0xc02a6b[_0x4a30('0x63')]();}}catch(_0x774178){handleError(_0xa193[_0x4a30('0x4f')][_0x36bfb9],{'code':_0x4a30('0x64'),'message':_0x774178[_0x4a30('0x3f')]});logger[_0x4a30('0x3e')](_0x4a30('0x65'),_0x774178[_0x4a30('0x3f')]);}},'complete':function(){try{var _0x33fe71=[];var _0x24cf33=_0x4a30('0x29');if(_0x5da95c[_0x4a30('0x66')]&&_0x5da95c[_0x4a30('0x66')]['length']){_0x24cf33=_0x4a30('0x67')+_0x8ddb4a;_0x33fe71[_0x4a30('0x42')]('CREATE\x20TABLE\x20'+_0x24cf33+'\x20LIKE\x20cm_contacts;');}var _0x45fc7f=util[_0x4a30('0xe')](_0x4a30('0x68'),_0x31e27d,_0x24cf33,_0xc02d9c,_0x5da95c[_0x4a30('0x37')],_0x5da95c[_0x4a30('0x69')]||null,NOW,NOW);if(_['isNil'](_0x7c38c9[_0x4a30('0x20')])){_0x45fc7f+=_0x4a30('0x6a');}_0x33fe71[_0x4a30('0x42')](_0x45fc7f);if(_0x5da95c['duplicates']&&_0x5da95c[_0x4a30('0x66')][_0x4a30('0x50')]){_0x33fe71['push'](insertCmContact(_0x5da95c[_0x4a30('0x37')],_0x24cf33,_0x5da95c[_0x4a30('0x66')],_0x7c38c9));_0x33fe71[_0x4a30('0x42')](_0x4a30('0x6b')+_0x24cf33+';');}_0x33fe71['push'](insertCmHopper(_0x5da95c[_0x4a30('0x37')],_0x4a30('0x6c'),'voice_queues',_0x4a30('0x6d'),_0x68c2f9));_0x33fe71[_0x4a30('0x42')](insertCmHopperBlack(_0x5da95c['ListId'],'voice_queues_has_cm_blacklists',_0x4a30('0x6e'),_0x4a30('0x6d')));_0x33fe71[_0x4a30('0x42')](insertCmHopper(_0x5da95c[_0x4a30('0x37')],_0x4a30('0x6f'),_0x4a30('0x70'),_0x4a30('0x71'),_0x68c2f9));_0x33fe71[_0x4a30('0x42')](insertCmHopperBlack(_0x5da95c['ListId'],_0x4a30('0x72'),_0x4a30('0x70'),_0x4a30('0x71')));BPromise[_0x4a30('0x73')](_0x33fe71,handleQuery)['then'](function(_0x56fc7f){stats[_0x4a30('0x74')]=!![];stats[_0x4a30('0x75')]=_0x5da95c[_0x4a30('0x66')]&&_0x5da95c[_0x4a30('0x66')][_0x4a30('0x50')]?results[0x2][_0x4a30('0x75')]:results[0x0][_0x4a30('0x75')];socket[_0x4a30('0x76')](_0x4a30('0x61')+_0x8ddb4a,stats);fs[_0x4a30('0x77')](_0x3e0014);fs['unlink'](_0x31e27d);process[_0x4a30('0x40')](0x0);})[_0x4a30('0x45')](function(_0x453812){logger['error'](_0x453812[_0x4a30('0x3f')]);process[_0x4a30('0x40')](0x1);});}catch(_0x548370){logger[_0x4a30('0x3e')](_0x4a30('0x78'),_0x548370[_0x4a30('0x3f')]);process[_0x4a30('0x40')](0x1);}},'error':function(_0x42018c,_0xffac3b,_0x1c21e2,_0x4b9dda){throw new Error(_0x4b9dda);}});}function validate(){if(process[_0x4a30('0x79')]&&process[_0x4a30('0x79')][_0x4a30('0x50')]<0x4){throw new Error(_0x4a30('0x7a'));}var _0x5f3d23=path[_0x4a30('0x12')](config[_0x4a30('0x7b')],'server/files/tmp',process[_0x4a30('0x79')][0x2]);if(!fs[_0x4a30('0x7c')](_0x5f3d23)){throw new Error(_0x4a30('0x7d'));}var _0x55a016={};try{_0x55a016=JSON[_0x4a30('0x4d')](process[_0x4a30('0x79')][0x3]);if(!_0x55a016[_0x4a30('0x4a')]){throw new Error(_0x4a30('0x7e'));}if(!_0x55a016[_0x4a30('0x4a')]['phone']){throw new Error(_0x4a30('0x7f'));}if(!_0x55a016[_0x4a30('0x4a')][_0x4a30('0x5d')]){throw new Error(_0x4a30('0x80'));}var _0xec5be2=0x0;if(_0x55a016[_0x4a30('0x4a')][_0x4a30('0x25')]){_0xec5be2=0x1;}if(!_0x55a016[_0x4a30('0x37')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x7508ac){throw new Error(_0x4a30('0x81'));}var _0x1af23d=[];try{_0x1af23d=_[_0x4a30('0x82')](JSON[_0x4a30('0x4d')](process[_0x4a30('0x79')][0x4]),'id');}catch(_0x5b3039){logger[_0x4a30('0x3c')](_0x4a30('0x83'));}main(_0x5f3d23,_0x55a016,_0x1af23d,_0xec5be2);}validate();process['on']('SIGINT',handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 69ed66a..e19e9d2 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8caf=['destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Called\x20Number','membername','starttime','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','voice','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number'];(function(_0x5a05b5,_0x3c1071){var _0x4f22bd=function(_0x370437){while(--_0x370437){_0x5a05b5['push'](_0x5a05b5['shift']());}};_0x4f22bd(++_0x3c1071);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x5a5dce,_0x1d8cdf){_0x5a5dce=_0x5a5dce-0x0;var _0xb98def=_0x8caf[_0x5a5dce];return _0xb98def;};'use strict';exports['getSubjects']=function(_0x1a4f5b,_0x215811){var _0x437aaa=[{'type':_0xf8ca('0x0'),'content':_0xf8ca('0x1'),'variableName':null}];switch(_0x1a4f5b[_0xf8ca('0x2')]()){case'voice':switch(_0x215811[_0xf8ca('0x2')]()){case _0xf8ca('0x3'):_0x437aaa[_0xf8ca('0x4')]({'type':_0xf8ca('0x5'),'content':'','variableName':_0xf8ca('0x6')});_0x437aaa[_0xf8ca('0x4')]({'type':'variable','content':'','variableName':_0xf8ca('0x7')});break;case _0xf8ca('0x8'):_0x437aaa[_0xf8ca('0x4')]({'type':_0xf8ca('0x0'),'content':'Outbound\x20Call','variableName':null});_0x437aaa['push']({'type':_0xf8ca('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x437aaa;};exports[_0xf8ca('0x9')]=function(_0x2e86a6,_0x2daa43){var _0x2be477=[];switch(_0x2e86a6['toLowerCase']()){case _0xf8ca('0xa'):switch(_0x2daa43[_0xf8ca('0x2')]()){case _0xf8ca('0x3'):_0x2be477=[{'type':_0xf8ca('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0xc'),'keyType':'variable','variableName':_0xf8ca('0x7')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0xd'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0xe')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0xf'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x10')},{'type':_0xf8ca('0xb'),'content':'','key':'Queue','keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x6')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x11'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x12')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x13'),'keyType':'variable','variableName':_0xf8ca('0x14')},{'type':_0xf8ca('0x0'),'content':_0xf8ca('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xf8ca('0xb'),'content':'','key':'Agent\x20Name','keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x16')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x17'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x18')},{'type':'string','content':_0xf8ca('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf8ca('0x1a'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x14')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x1b'),'keyType':_0xf8ca('0x5'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xf8ca('0x1c'),'keyType':_0xf8ca('0x5'),'variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0xf8ca('0x1d'),'keyType':_0xf8ca('0x5'),'variableName':_0xf8ca('0x1e')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x1f'),'keyType':_0xf8ca('0x5'),'variableName':'talktime'}];break;case _0xf8ca('0x8'):_0x2be477=[{'type':_0xf8ca('0x0'),'content':_0xf8ca('0x20'),'variableName':null},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x21'),'keyType':_0xf8ca('0x5'),'keyContent':'','variableName':_0xf8ca('0x18')},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xf8ca('0x5'),'keyContent':'','variableName':_0xf8ca('0x22')},{'type':_0xf8ca('0xb'),'content':'','key':'UniqueId','keyType':_0xf8ca('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xf8ca('0x13'),'keyType':_0xf8ca('0x5'),'keyContent':'','variableName':_0xf8ca('0x23')},{'type':'string','content':_0xf8ca('0x19')},{'type':_0xf8ca('0xb'),'content':'','key':'Answer\x20Time','keyType':_0xf8ca('0x5'),'keyContent':'','variableName':'answertime'},{'type':_0xf8ca('0xb'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xf8ca('0x24')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x25'),'keyType':_0xf8ca('0x5'),'keyContent':'','variableName':_0xf8ca('0x26')},{'type':_0xf8ca('0xb'),'content':'','key':_0xf8ca('0x27'),'keyType':'variable','keyContent':'','variableName':_0xf8ca('0x28')}];break;}}return _0x2be477;}; \ No newline at end of file +var _0x63a5=['Duration','billableseconds','getSubjects','string','toLowerCase','voice','inbound','queue','variable','calleridnum','Outbound\x20Call','push','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','uniqueid','agentcalledAt','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x63a5,0x18e));var _0x563a=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x63a5[_0xda464c];return _0x19e222;};'use strict';exports[_0x563a('0x0')]=function(_0x138acc,_0x91178){var _0x58625e=[{'type':_0x563a('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x138acc[_0x563a('0x2')]()){case _0x563a('0x3'):switch(_0x91178[_0x563a('0x2')]()){case _0x563a('0x4'):_0x58625e['push']({'type':'variable','content':'','variableName':_0x563a('0x5')});_0x58625e['push']({'type':_0x563a('0x6'),'content':'','variableName':_0x563a('0x7')});break;case'outbound':_0x58625e['push']({'type':_0x563a('0x1'),'content':_0x563a('0x8'),'variableName':null});_0x58625e[_0x563a('0x9')]({'type':_0x563a('0x6'),'content':'','variableName':_0x563a('0xa')});break;}}return _0x58625e;};exports[_0x563a('0xb')]=function(_0xd1b480,_0x381fab){var _0x3e97a8=[];switch(_0xd1b480[_0x563a('0x2')]()){case _0x563a('0x3'):switch(_0x381fab[_0x563a('0x2')]()){case _0x563a('0x4'):_0x3e97a8=[{'type':_0x563a('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0xd'),'keyType':_0x563a('0x6'),'variableName':_0x563a('0x7')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0xe'),'keyType':'variable','variableName':_0x563a('0xf')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x10'),'keyType':_0x563a('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x563a('0x11'),'keyType':_0x563a('0x6'),'variableName':'queue'},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x12'),'keyType':_0x563a('0x6'),'variableName':_0x563a('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0x563a('0x6'),'variableName':_0x563a('0x14')},{'type':_0x563a('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x563a('0x15')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x16'),'keyType':_0x563a('0x6'),'variableName':'destcalleridnum'},{'type':'string','content':_0x563a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x18'),'keyType':_0x563a('0x6'),'variableName':_0x563a('0x14')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x19'),'keyType':_0x563a('0x6'),'variableName':'agentconnectAt'},{'type':_0x563a('0xc'),'content':'','key':'Agent\x20Complete','keyType':_0x563a('0x6'),'variableName':_0x563a('0x1a')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x1b'),'keyType':_0x563a('0x6'),'variableName':_0x563a('0x1c')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x1d'),'keyType':'variable','variableName':_0x563a('0x1e')}];break;case _0x563a('0x1f'):_0x3e97a8=[{'type':_0x563a('0x1'),'content':_0x563a('0x20'),'variableName':null},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x21'),'keyType':_0x563a('0x6'),'keyContent':'','variableName':_0x563a('0xa')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x22'),'keyType':_0x563a('0x6'),'keyContent':'','variableName':_0x563a('0x23')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x12'),'keyType':'variable','keyContent':'','variableName':_0x563a('0x13')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x24'),'keyType':'variable','keyContent':'','variableName':_0x563a('0x25')},{'type':_0x563a('0x1'),'content':_0x563a('0x17')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x26'),'keyType':_0x563a('0x6'),'keyContent':'','variableName':_0x563a('0x27')},{'type':'keyValue','content':'','key':_0x563a('0x28'),'keyType':_0x563a('0x6'),'keyContent':'','variableName':_0x563a('0x29')},{'type':_0x563a('0xc'),'content':'','key':_0x563a('0x2a'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x563a('0x6'),'keyContent':'','variableName':_0x563a('0x2b')}];break;}}return _0x3e97a8;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index bd33e4d..200abc7 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d3e=['body','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','Interaction','findOne','then','tracked','query','clone'];(function(_0x2a339d,_0x4d3afc){var _0x58a3c9=function(_0x20c72e){while(--_0x20c72e){_0x2a339d['push'](_0x2a339d['shift']());}};_0x58a3c9(++_0x4d3afc);}(_0x3d3e,0x155));var _0xe3d3=function(_0x52486f,_0x187e3a){_0x52486f=_0x52486f-0x0;var _0xe178e8=_0x3d3e[_0x52486f];return _0xe178e8;};'use strict';var _=require(_0xe3d3('0x0'));var db=require(_0xe3d3('0x1'))['db'];var loggers={'openchannel':require(_0xe3d3('0x2'))('openchannel-interactions'),'mail':require(_0xe3d3('0x2'))(_0xe3d3('0x3')),'fax':require(_0xe3d3('0x2'))(_0xe3d3('0x4')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xe3d3('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0xe3d3('0x5'))};function getInteractionId(_0x14aab0,_0x3b5db7,_0x3488ba){if(_0x14aab0&&_0x14aab0[_[_0xe3d3('0x6')](_0x3488ba)+_0xe3d3('0x7')]){return _0x14aab0[_[_0xe3d3('0x6')](_0x3488ba)+_0xe3d3('0x7')];}else if(_0x14aab0&&_0x14aab0['id']){return _0x14aab0['id'];}else if(_0x3b5db7&&_0x3b5db7['id']){return _0x3b5db7['id'];}else{return _0xe3d3('0x8');}}function log(_0x4d0e77,_0x13488b,_0x29fd30,_0x48643d,_0x481e77,_0x3e2363){loggers[_0x481e77[_0xe3d3('0x9')]()][_0x4d0e77](_0xe3d3('0xa'),_0x3e2363['toUpperCase'](),_0x13488b?_0x13488b['id']:null,_0x13488b?_0x13488b[_0xe3d3('0xb')]:null,_0x13488b?_0x13488b[_0xe3d3('0xc')]:null,getInteractionId(_0x29fd30,_0x48643d,_0x481e77),_0x29fd30?JSON['stringify'](_0x29fd30):'null');}function updateUser(_0x1343ec,_0x45d985,_0x434d11,_0x384906,_0x3b2425){db[_['upperFirst'](_0x384906)+_0xe3d3('0xd')][_0xe3d3('0xe')]({'where':{'id':getInteractionId(_0x45d985,_0x434d11,_0x384906)}})[_0xe3d3('0xf')](function(_0x5ea506){if(_0x5ea506){return _0x5ea506['update']({'UserId':_0x1343ec?_0x1343ec['id']:null});}})[_0xe3d3('0xf')](function(_0xbe5a3b){if(_0xbe5a3b){log('info',_0x1343ec,_0x45d985,_0x434d11,_0x384906,_0x3b2425);}})['catch'](function(){log('error',_0x1343ec,_0x45d985,_0x434d11,_0x384906,_0x3b2425);});}exports[_0xe3d3('0x10')]=function(_0x25734e,_0x16ed4b){return function(_0x4b9463,_0x5b92d6,_0x107aa1){var _0x18c46a=_0x4b9463['user'];var _0x3abab3={};var _0x553667=_0x4b9463[_0xe3d3('0x11')];if(_0x3abab3){_0x3abab3=_[_0xe3d3('0x12')](_0x4b9463[_0xe3d3('0x13')]);_0x3abab3=_['omit'](_0x3abab3,[_0xe3d3('0x13'),_0xe3d3('0x14'),_0xe3d3('0x15'),_0xe3d3('0x16'),_0xe3d3('0x17')]);}updateUser(_0x18c46a,_0x3abab3,_0x553667,_0x25734e,_0x16ed4b);_0x107aa1(null);};}; \ No newline at end of file +var _0x8eac=['chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','query','body','omit','html','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x44517e,_0x506747){var _0x4f79d1=function(_0x47b7cf){while(--_0x47b7cf){_0x44517e['push'](_0x44517e['shift']());}};_0x4f79d1(++_0x506747);}(_0x8eac,0x11c));var _0xc8ea=function(_0x2ac992,_0x37c877){_0x2ac992=_0x2ac992-0x0;var _0x223c9d=_0x8eac[_0x2ac992];return _0x223c9d;};'use strict';var _=require(_0xc8ea('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xc8ea('0x1'))(_0xc8ea('0x2')),'mail':require(_0xc8ea('0x1'))(_0xc8ea('0x3')),'fax':require(_0xc8ea('0x1'))(_0xc8ea('0x4')),'sms':require(_0xc8ea('0x1'))(_0xc8ea('0x5')),'chat':require(_0xc8ea('0x1'))(_0xc8ea('0x6')),'whatsapp':require(_0xc8ea('0x1'))('whatsapp-interactions')};function getInteractionId(_0xc016a2,_0x1596bb,_0x21af31){if(_0xc016a2&&_0xc016a2[_[_0xc8ea('0x7')](_0x21af31)+_0xc8ea('0x8')]){return _0xc016a2[_[_0xc8ea('0x7')](_0x21af31)+_0xc8ea('0x8')];}else if(_0xc016a2&&_0xc016a2['id']){return _0xc016a2['id'];}else if(_0x1596bb&&_0x1596bb['id']){return _0x1596bb['id'];}else{return _0xc8ea('0x9');}}function log(_0x539521,_0x1ee43c,_0x5c5ee3,_0x4bfdd2,_0x542824,_0x5b66ea){loggers[_0x542824[_0xc8ea('0xa')]()][_0x539521]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b66ea[_0xc8ea('0xb')](),_0x1ee43c?_0x1ee43c['id']:null,_0x1ee43c?_0x1ee43c['name']:null,_0x1ee43c?_0x1ee43c[_0xc8ea('0xc')]:null,getInteractionId(_0x5c5ee3,_0x4bfdd2,_0x542824),_0x5c5ee3?JSON[_0xc8ea('0xd')](_0x5c5ee3):_0xc8ea('0xe'));}function updateUser(_0x241e77,_0x4e52dd,_0x3e7ebc,_0x574b59,_0x5284be){db[_[_0xc8ea('0x7')](_0x574b59)+_0xc8ea('0xf')][_0xc8ea('0x10')]({'where':{'id':getInteractionId(_0x4e52dd,_0x3e7ebc,_0x574b59)}})[_0xc8ea('0x11')](function(_0x5bcafc){if(_0x5bcafc){return _0x5bcafc[_0xc8ea('0x12')]({'UserId':_0x241e77?_0x241e77['id']:null});}})[_0xc8ea('0x11')](function(_0x489807){if(_0x489807){log(_0xc8ea('0x13'),_0x241e77,_0x4e52dd,_0x3e7ebc,_0x574b59,_0x5284be);}})[_0xc8ea('0x14')](function(){log(_0xc8ea('0x15'),_0x241e77,_0x4e52dd,_0x3e7ebc,_0x574b59,_0x5284be);});}exports[_0xc8ea('0x16')]=function(_0x65f14d,_0x354084){return function(_0x18f96d,_0x681ccf,_0x567a74){var _0x4294aa=_0x18f96d['user'];var _0x165e40={};var _0x5ccb09=_0x18f96d[_0xc8ea('0x17')];if(_0x165e40){_0x165e40=_['clone'](_0x18f96d[_0xc8ea('0x18')]);_0x165e40=_[_0xc8ea('0x19')](_0x165e40,[_0xc8ea('0x18'),_0xc8ea('0x1a'),'phone',_0xc8ea('0x1b'),_0xc8ea('0x1c')]);}updateUser(_0x4294aa,_0x165e40,_0x5ccb09,_0x65f14d,_0x354084);_0x567a74(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 2e47f27..ae81811 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x79b7=['License','findOne','then','status','json','catch','users','User','admin','util','composable-middleware','../../mysqldb','../../config/environment','license','createDecipher','aes-256-ctr','%s:%s:%s','update','final','hasOwnProperty','use'];(function(_0x475e1e,_0x2dd597){var _0x333026=function(_0x4027d7){while(--_0x4027d7){_0x475e1e['push'](_0x475e1e['shift']());}};_0x333026(++_0x2dd597);}(_0x79b7,0x16e));var _0x779b=function(_0x128e20,_0x2a6ef6){_0x128e20=_0x128e20-0x0;var _0x2707e1=_0x79b7[_0x128e20];return _0x2707e1;};'use strict';var crypto=require('crypto');var util=require(_0x779b('0x0'));var compose=require(_0x779b('0x1'));var db=require(_0x779b('0x2'))['db'];var config=require(_0x779b('0x3'));function getValueFromLicense(_0x5653df,_0x29f9a7){if(_0x5653df&&_0x29f9a7){if(_0x29f9a7['data1']&&_0x29f9a7[_0x779b('0x4')]){var _0xfbd306=_0x29f9a7['data1'];var _0xfdd1e8=_0x29f9a7['license'];var _0x46882e=_0xfbd306['split']('-')[0x4];var _0x19294a=_0xfbd306['split']('-')[0x0];var _0x232331=crypto[_0x779b('0x5')](_0x779b('0x6'),util['format'](_0x779b('0x7'),_0x46882e,_0xfbd306,_0x19294a));var _0x2e9f7e=_0x232331[_0x779b('0x8')](_0xfdd1e8,'base64','utf8');_0x2e9f7e+=_0x232331[_0x779b('0x9')]('utf8');var _0xfa57f2=JSON['parse'](_0x2e9f7e);return _0xfa57f2[_0x779b('0xa')](_0x5653df)?_0xfa57f2[_0x5653df]:null;}}return null;}function isLimit(_0x394cf3,_0x137849,_0x54d230,_0x13ec69){var _0x7fdda4=_0x137849;return compose()[_0x779b('0xb')](function(_0x1ba2ee,_0x553e29,_0x589d13){return db[_0x779b('0xc')][_0x779b('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x779b('0xe')](function(_0x318edd){var _0x1a9d58=getValueFromLicense(_0x394cf3,_0x318edd);return _0x1a9d58?_0x1a9d58:_0x7fdda4;})['then'](function(_0x3afe6f){_0x7fdda4=_0x3afe6f;return _0x54d230['count'](_0x13ec69);})[_0x779b('0xe')](function(_0x383894){if(_0x383894>=_0x7fdda4){return _0x553e29[_0x779b('0xf')](0x193)[_0x779b('0x10')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x394cf3)});}_0x589d13();})[_0x779b('0x11')](function(_0x1c2e12){_0x589d13(_0x1c2e12);});});}function isUserLimit(){return isLimit(_0x779b('0x12'),0x1,db[_0x779b('0x13')],{'where':{'$or':[{'role':_0x779b('0x14')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xf787=['admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','then','status','catch','users','User'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xf787,0x16f));var _0x7f78=function(_0x118d6f,_0x2c898f){_0x118d6f=_0x118d6f-0x0;var _0x4a2093=_0xf787[_0x118d6f];return _0x4a2093;};'use strict';var crypto=require(_0x7f78('0x0'));var util=require(_0x7f78('0x1'));var compose=require('composable-middleware');var db=require(_0x7f78('0x2'))['db'];var config=require(_0x7f78('0x3'));function getValueFromLicense(_0xe61515,_0xaa720b){if(_0xe61515&&_0xaa720b){if(_0xaa720b[_0x7f78('0x4')]&&_0xaa720b[_0x7f78('0x5')]){var _0x19bbbb=_0xaa720b[_0x7f78('0x4')];var _0x340202=_0xaa720b[_0x7f78('0x5')];var _0x52ad49=_0x19bbbb[_0x7f78('0x6')]('-')[0x4];var _0x50f387=_0x19bbbb['split']('-')[0x0];var _0xe566e2=crypto[_0x7f78('0x7')](_0x7f78('0x8'),util[_0x7f78('0x9')](_0x7f78('0xa'),_0x52ad49,_0x19bbbb,_0x50f387));var _0x27ff6b=_0xe566e2[_0x7f78('0xb')](_0x340202,_0x7f78('0xc'),_0x7f78('0xd'));_0x27ff6b+=_0xe566e2[_0x7f78('0xe')](_0x7f78('0xd'));var _0x16619c=JSON[_0x7f78('0xf')](_0x27ff6b);return _0x16619c['hasOwnProperty'](_0xe61515)?_0x16619c[_0xe61515]:null;}}return null;}function isLimit(_0x216ff1,_0x5265f0,_0x1572df,_0x24c31b){var _0x499a3a=_0x5265f0;return compose()['use'](function(_0x27fe3d,_0x226242,_0x43c749){return db[_0x7f78('0x10')][_0x7f78('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1e892b){var _0x5b0f9a=getValueFromLicense(_0x216ff1,_0x1e892b);return _0x5b0f9a?_0x5b0f9a:_0x499a3a;})[_0x7f78('0x12')](function(_0x7cc134){_0x499a3a=_0x7cc134;return _0x1572df['count'](_0x24c31b);})[_0x7f78('0x12')](function(_0x3f559f){if(_0x3f559f>=_0x499a3a){return _0x226242[_0x7f78('0x13')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x216ff1)});}_0x43c749();})[_0x7f78('0x14')](function(_0x7643f5){_0x43c749(_0x7643f5);});});}function isUserLimit(){return isLimit(_0x7f78('0x15'),0x1,db[_0x7f78('0x16')],{'where':{'$or':[{'role':_0x7f78('0x17')},{'role':_0x7f78('0x18')}]}});}exports[_0x7f78('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2e7a0a3..a8ab84d 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 _0x66b6=['$between','value','$lte','add','days','castTo','text','CAST(','\x20AS\x20','field','includes','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$substring','start','pop','DATE','format','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','split','slice','forEach','match','filter','indexOf','map','conditions','buildExpression','operator'];(function(_0x1e8f28,_0x5d8fc6){var _0x4706a7=function(_0x94d1da){while(--_0x94d1da){_0x1e8f28['push'](_0x1e8f28['shift']());}};_0x4706a7(++_0x5d8fc6);}(_0x66b6,0x162));var _0x666b=function(_0x2298f0,_0x3bbf4f){_0x2298f0=_0x2298f0-0x0;var _0x39b136=_0x66b6[_0x2298f0];return _0x39b136;};'use strict';var _=require(_0x666b('0x0'));var moment=require('moment');exports[_0x666b('0x1')]=function(_0x5d1a55){var _0x3041a6={'conditions':[]};_0x3041a6[_0x666b('0x2')]=_[_0x666b('0x3')](_0x5d1a55,_0x666b('0x4'))?'or':_0x666b('0x5');var _0x4d754f=_0x5d1a55['replace'](_0x666b('0x6'),'')['replace'](_0x666b('0x4'),'')[_0x666b('0x7')]('||');for(var _0x29f3e4=0x0;_0x29f3e4<_0x4d754f['length'];_0x29f3e4++){var _0x58fd34=_0x4d754f[_0x29f3e4]['split'](':=');var _0x91c821=_0x58fd34[0x0];var _0x25c027=_0x58fd34[_0x666b('0x8')](0x1);_0x25c027[_0x666b('0x9')](function(_0x588de2){var _0x117df8=_0x588de2[_0x666b('0x7')]('[')['shift']();var _0x3a5897=_0x588de2[_0x666b('0xa')](/\[(.*?)\]/g);_0x3a5897[_0x666b('0x9')](function(_0xd7efd5){var _0x49790c=_0xd7efd5['split']('[')[_0x666b('0xb')](function(_0x1a15bd){return _0x1a15bd[_0x666b('0xc')](']')>-0x1;})[_0x666b('0xd')](function(_0x1f1177){return _0x1f1177[_0x666b('0x7')](']')[0x0];})[0x0];_0x3041a6[_0x666b('0xe')]['push']({'field':_0x91c821,'operator':_0x117df8,'value':_0x49790c});});});}return _0x3041a6;};exports[_0x666b('0xf')]=function(_0x55b585,_0x3b5798,_0x44825f){var _0x5132ad={};if(_0x3b5798==='DATE'){if(_0x44825f['operator']==='$eq'){_0x44825f[_0x666b('0x10')]=_0x666b('0x11');_0x44825f[_0x666b('0x12')]+=','+_0x44825f['value'];}else if(_['includes'](['$gt',_0x666b('0x13')],_0x44825f[_0x666b('0x10')])){_0x44825f[_0x666b('0x12')]=moment(_0x44825f['value'])[_0x666b('0x14')](0x1,_0x666b('0x15'))['format']('YYYY-MM-DD');}}if(_0x44825f[_0x666b('0x16')]){_0x3b5798=_0x44825f[_0x666b('0x16')];_0x5132ad[_0x666b('0x17')]=_0x666b('0x18')+_0x55b585+'.'+_0x44825f['field']+_0x666b('0x19')+_0x44825f[_0x666b('0x16')]+')\x20'+parseOperator(_0x44825f['operator']);}else{_0x5132ad[_0x666b('0x17')]=_0x55b585+'.'+_0x44825f[_0x666b('0x1a')]+'\x20'+parseOperator(_0x44825f[_0x666b('0x10')]);}if(_[_0x666b('0x1b')](['$ne','$notIn'],_0x44825f[_0x666b('0x10')]))_0x5132ad[_0x666b('0x17')]='('+_0x5132ad[_0x666b('0x17')]+_0x666b('0x1c')+_0x55b585+'.'+_0x44825f['field']+_0x666b('0x1d');_0x5132ad['value']=parseValue(_0x3b5798,_0x44825f['operator'],_0x44825f[_0x666b('0x12')]);return _0x5132ad;};function parseOperator(_0x493842){var _0x578a9d;switch(_0x493842){case _0x666b('0x1e'):_0x578a9d=_0x666b('0x1f');break;case _0x666b('0x20'):_0x578a9d=_0x666b('0x21');break;case'$eq':_0x578a9d=_0x666b('0x22');break;case _0x666b('0x23'):_0x578a9d=_0x666b('0x24');break;case'$substring':case _0x666b('0x25'):case _0x666b('0x26'):_0x578a9d='LIKE\x20?';break;case'$lt':_0x578a9d=_0x666b('0x27');break;case _0x666b('0x28'):_0x578a9d=_0x666b('0x29');break;case _0x666b('0x13'):_0x578a9d=_0x666b('0x2a');break;case _0x666b('0x2b'):_0x578a9d=_0x666b('0x2c');break;case _0x666b('0x11'):_0x578a9d='BETWEEN\x20?\x20AND\x20?';break;}return _0x578a9d;}function parseValue(_0x15561a,_0x3bd93c,_0x2fed4a){var _0x5911be={'start':undefined,'end':undefined};switch(_0x3bd93c){case _0x666b('0x1e'):case'$notIn':_0x5911be['start']=_0x2fed4a[_0x666b('0x7')](',');break;case _0x666b('0x2d'):_0x5911be['start']='%'+_0x2fed4a+'%';break;case'$startsWith':_0x5911be['start']=_0x2fed4a+'%';break;case _0x666b('0x26'):_0x5911be[_0x666b('0x2e')]='%'+_0x2fed4a;break;case _0x666b('0x11'):var _0x2e332b=_0x2fed4a['split'](',');var _0x2fed4a=_0x2e332b['shift']();var _0x6eb668=_0x2e332b[_0x666b('0x2f')]();if(_0x15561a===_0x666b('0x30')){_0x2fed4a=moment(_0x2fed4a)['utcOffset'](0x0,!![])[_0x666b('0x31')]();_0x6eb668=moment(_0x6eb668)['utcOffset'](0x0,!![])[_0x666b('0x14')](0x17,_0x666b('0x32'))[_0x666b('0x14')](0x3b,_0x666b('0x33'))['add'](0x3b,_0x666b('0x34'))['format']();}_0x5911be={'start':_0x2fed4a,'end':_0x6eb668};break;default:_0x5911be['start']=_0x2fed4a;break;}return _0x5911be;} \ No newline at end of file +var _0x6a51=['includes','$ne','$notIn','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','utcOffset','add','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','replace','[$and]','[$or]','split','length','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6a51,0xba));var _0x16a5=function(_0x1f9f5f,_0x509fb7){_0x1f9f5f=_0x1f9f5f-0x0;var _0x51d649=_0x6a51[_0x1f9f5f];return _0x51d649;};'use strict';var _=require(_0x16a5('0x0'));var moment=require(_0x16a5('0x1'));exports[_0x16a5('0x2')]=function(_0x2225f9){var _0x288f3a={'conditions':[]};_0x288f3a[_0x16a5('0x3')]=_[_0x16a5('0x4')](_0x2225f9,'[$or]')?'or':'and';var _0x13b847=_0x2225f9[_0x16a5('0x5')](_0x16a5('0x6'),'')[_0x16a5('0x5')](_0x16a5('0x7'),'')[_0x16a5('0x8')]('||');for(var _0xf6903a=0x0;_0xf6903a<_0x13b847[_0x16a5('0x9')];_0xf6903a++){var _0x570dce=_0x13b847[_0xf6903a][_0x16a5('0x8')](':=');var _0x449f5d=_0x570dce[0x0];var _0x6e367f=_0x570dce['slice'](0x1);_0x6e367f['forEach'](function(_0x2e88da){var _0x447620=_0x2e88da[_0x16a5('0x8')]('[')[_0x16a5('0xa')]();var _0x4daf66=_0x2e88da[_0x16a5('0xb')](/\[(.*?)\]/g);_0x4daf66[_0x16a5('0xc')](function(_0x1a2940){var _0x3ff019=_0x1a2940[_0x16a5('0x8')]('[')[_0x16a5('0xd')](function(_0x379bc9){return _0x379bc9[_0x16a5('0xe')](']')>-0x1;})[_0x16a5('0xf')](function(_0x1ed07b){return _0x1ed07b[_0x16a5('0x8')](']')[0x0];})[0x0];_0x288f3a[_0x16a5('0x10')][_0x16a5('0x11')]({'field':_0x449f5d,'operator':_0x447620,'value':_0x3ff019});});});}return _0x288f3a;};exports[_0x16a5('0x12')]=function(_0x15e1ac,_0x2088f0,_0xd070db){var _0x3dcbb5={};if(_0x2088f0===_0x16a5('0x13')){if(_0xd070db[_0x16a5('0x14')]===_0x16a5('0x15')){_0xd070db[_0x16a5('0x14')]=_0x16a5('0x16');_0xd070db[_0x16a5('0x17')]+=','+_0xd070db[_0x16a5('0x17')];}else if(_['includes']([_0x16a5('0x18'),_0x16a5('0x19')],_0xd070db['operator'])){_0xd070db[_0x16a5('0x17')]=moment(_0xd070db[_0x16a5('0x17')])['add'](0x1,_0x16a5('0x1a'))[_0x16a5('0x1b')](_0x16a5('0x1c'));}}if(_0xd070db[_0x16a5('0x1d')]){_0x2088f0=_0xd070db[_0x16a5('0x1d')];_0x3dcbb5[_0x16a5('0x1e')]=_0x16a5('0x1f')+_0x15e1ac+'.'+_0xd070db[_0x16a5('0x20')]+_0x16a5('0x21')+_0xd070db[_0x16a5('0x1d')]+')\x20'+parseOperator(_0xd070db[_0x16a5('0x14')]);}else{_0x3dcbb5[_0x16a5('0x1e')]=_0x15e1ac+'.'+_0xd070db['field']+'\x20'+parseOperator(_0xd070db[_0x16a5('0x14')]);}if(_[_0x16a5('0x22')]([_0x16a5('0x23'),_0x16a5('0x24')],_0xd070db[_0x16a5('0x14')]))_0x3dcbb5[_0x16a5('0x1e')]='('+_0x3dcbb5[_0x16a5('0x1e')]+'\x20OR\x20'+_0x15e1ac+'.'+_0xd070db[_0x16a5('0x20')]+'\x20IS\x20NULL)';_0x3dcbb5['value']=parseValue(_0x2088f0,_0xd070db[_0x16a5('0x14')],_0xd070db[_0x16a5('0x17')]);return _0x3dcbb5;};function parseOperator(_0x2efbc9){var _0x54b617;switch(_0x2efbc9){case _0x16a5('0x25'):_0x54b617=_0x16a5('0x26');break;case _0x16a5('0x24'):_0x54b617=_0x16a5('0x27');break;case _0x16a5('0x15'):_0x54b617=_0x16a5('0x28');break;case _0x16a5('0x23'):_0x54b617=_0x16a5('0x29');break;case _0x16a5('0x2a'):case _0x16a5('0x2b'):case'$endsWith':_0x54b617='LIKE\x20?';break;case'$lt':_0x54b617=_0x16a5('0x2c');break;case'$gt':_0x54b617=_0x16a5('0x2d');break;case'$lte':_0x54b617='<=\x20?';break;case _0x16a5('0x2e'):_0x54b617=_0x16a5('0x2f');break;case _0x16a5('0x16'):_0x54b617=_0x16a5('0x30');break;}return _0x54b617;}function parseValue(_0x1c5001,_0x4d65db,_0x2f4767){var _0x23835d={'start':undefined,'end':undefined};switch(_0x4d65db){case'$in':case _0x16a5('0x24'):_0x23835d[_0x16a5('0x31')]=_0x2f4767[_0x16a5('0x8')](',');break;case _0x16a5('0x2a'):_0x23835d[_0x16a5('0x31')]='%'+_0x2f4767+'%';break;case _0x16a5('0x2b'):_0x23835d[_0x16a5('0x31')]=_0x2f4767+'%';break;case _0x16a5('0x32'):_0x23835d[_0x16a5('0x31')]='%'+_0x2f4767;break;case _0x16a5('0x16'):var _0x450ce7=_0x2f4767[_0x16a5('0x8')](',');var _0x2f4767=_0x450ce7[_0x16a5('0xa')]();var _0x3b9258=_0x450ce7['pop']();if(_0x1c5001==='DATE'){_0x2f4767=moment(_0x2f4767)[_0x16a5('0x33')](0x0,!![])[_0x16a5('0x1b')]();_0x3b9258=moment(_0x3b9258)['utcOffset'](0x0,!![])[_0x16a5('0x34')](0x17,_0x16a5('0x35'))[_0x16a5('0x34')](0x3b,'minutes')[_0x16a5('0x34')](0x3b,_0x16a5('0x36'))[_0x16a5('0x1b')]();}_0x23835d={'start':_0x2f4767,'end':_0x3b9258};break;default:_0x23835d[_0x16a5('0x31')]=_0x2f4767;break;}return _0x23835d;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index cb2922c..64f6ad4 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 _0xdafa=['unsigned','substr','DESC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','push','toString','join','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','utc','$lte','YYYY-MM-DD','subtract','isArray','limit','offset','sort','indexOf','priority','cast','col'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0xdafa,0x113));var _0xadaf=function(_0x41e8c1,_0x4f913e){_0x41e8c1=_0x41e8c1-0x0;var _0x4a7050=_0xdafa[_0x41e8c1];return _0x4a7050;};'use strict';var _=require('lodash');var sequelize=require(_0xadaf('0x0'));var moment=require(_0xadaf('0x1'));var LIMIT_VALUE=0xfa;exports[_0xadaf('0x2')]=function(_0x4c325c){var _0xf860e5=null;if(_0x4c325c){_0xf860e5=_0x4c325c[_0xadaf('0x3')](',');}return _0xf860e5;};exports[_0xadaf('0x4')]=function(_0x1c4f48,_0xd745b1){var _0x417b2f={};if(!_[_0xadaf('0x5')](_0x1c4f48)){_[_0xadaf('0x6')](_0x1c4f48,function(_0x481c10,_0x283994){try{if(_0xd745b1){var _0x1bd19b=_[_0xadaf('0x7')](_0xd745b1,{'name':_0x283994})||{};if(_0x1bd19b[_0xadaf('0x8')]===_0xadaf('0x9')&&_[_0xadaf('0xa')](_0x481c10)){var _0x4bbea3=JSON[_0xadaf('0xb')](_0x481c10);var _0x3e5b5={'$gte':moment(moment(_0x4bbea3[_0xadaf('0xc')])[_0xadaf('0xd')]('YYYY-MM-DD'))[_0xadaf('0xe')]()['format'](),'$lte':moment(moment(_0x4bbea3[_0xadaf('0xf')])[_0xadaf('0xd')](_0xadaf('0x10')))['utc']()[_0xadaf('0x11')](0x1,'s')[_0xadaf('0xd')]()};_0x417b2f[_0x283994]=_0x3e5b5;}else{_0x417b2f[_0x283994]=_[_0xadaf('0x12')](_0x481c10)?_0x481c10:JSON[_0xadaf('0xb')](_0x481c10);}}else{_0x417b2f[_0x283994]=_[_0xadaf('0x12')](_0x481c10)?_0x481c10:JSON[_0xadaf('0xb')](_0x481c10);}}catch(_0x4c7bf2){_0x417b2f[_0x283994]=_0x481c10[_0xadaf('0x3')](',');}});}return _0x417b2f;};exports[_0xadaf('0x13')]=function(_0x5d6069){_0x5d6069=parseInt(_0x5d6069,0xa);if(!_0x5d6069||_0x5d6069<0x0){_0x5d6069=LIMIT_VALUE;}return _0x5d6069;};exports[_0xadaf('0x14')]=function(_0x2e3477){_0x2e3477=parseInt(_0x2e3477,0xa);if(!_0x2e3477||_0x2e3477<0x0){_0x2e3477=0x0;}return _0x2e3477;};exports[_0xadaf('0x15')]=function(_0x519550){var _0x3dbcdc,_0xf7112d=null;if(_0x519550){_0x3dbcdc=_0x519550['split'](',');_0xf7112d=_['map'](_0x3dbcdc,function(_0x6c857b){if(_0x6c857b[_0xadaf('0x16')]('-')===0x0){return[_0x6c857b===_0xadaf('0x17')?sequelize[_0xadaf('0x18')](sequelize[_0xadaf('0x19')](_0xadaf('0x17')),_0xadaf('0x1a')):_0x6c857b[_0xadaf('0x1b')](0x1),_0xadaf('0x1c')];}else{return[_0x6c857b===_0xadaf('0x17')?sequelize[_0xadaf('0x18')](sequelize[_0xadaf('0x19')]('priority'),_0xadaf('0x1a')):_0x6c857b,'ASC'];}});}return _0xf7112d;};exports[_0xadaf('0x1d')]=function(_0x2111d3,_0x53f17f){if(_[_0xadaf('0x5')](_0x2111d3)){return _0x2111d3;}if(_[_0xadaf('0x12')](_0x2111d3)){for(var _0x44afbb=0x0;_0x44afbb<_0x2111d3[_0xadaf('0x1e')];_0x44afbb+=0x1){_0x2111d3[_0x44afbb]=this[_0xadaf('0x1d')](_0x2111d3[_0x44afbb],_0x53f17f);}return _0x2111d3;}if(!_[_0xadaf('0x1f')](_0x2111d3)){return _0x2111d3;}if(_[_0xadaf('0x20')](_0x53f17f)){_0x53f17f=[_0x53f17f];}if(!_[_0xadaf('0x12')](_0x53f17f)){return _0x2111d3;}for(var _0xe50285=0x0;_0xe50285<_0x53f17f[_0xadaf('0x1e')];_0xe50285+=0x1){_[_0xadaf('0x21')](_0x2111d3,_0x53f17f[_0xe50285]);}for(var _0x1d34a0 in _0x2111d3){if(_0x2111d3[_0xadaf('0x22')](_0x1d34a0)){_0x2111d3[_0x1d34a0]=this[_0xadaf('0x1d')](_0x2111d3[_0x1d34a0],_0x53f17f);}}return _0x2111d3;};exports[_0xadaf('0x23')]=function(_0x2e5cf9){return _0x2e5cf9[_0xadaf('0x24')](RegExp(_0xadaf('0x25')))?!![]:![];};exports[_0xadaf('0x26')]=function(_0x45fde5){return _0x45fde5['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xadaf('0x27')]=function(_0x2e011b){var _0x1af757=[];_0x2e011b[_0xadaf('0x3')]('\x20')['forEach'](function(_0x19948){_0x1af757[_0xadaf('0x28')]('+'+_0x19948[_0xadaf('0x29')]()+'*');});return _0x1af757[_0xadaf('0x2a')]('\x20');}; \ No newline at end of file +var _0x7633=['offset','sort','priority','cast','col','unsigned','substr','DESC','isEmpty','length','isObject','isString','unset','hasOwnProperty','omit','isNumeric','isEmail','match','getFullTextValue','forEach','push','toString','join','lodash','sequelize','moment','fields','split','filters','find','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','limit'];(function(_0x4bf9ad,_0x34d3e2){var _0xd1c01f=function(_0x305f8a){while(--_0x305f8a){_0x4bf9ad['push'](_0x4bf9ad['shift']());}};_0xd1c01f(++_0x34d3e2);}(_0x7633,0x1c4));var _0x3763=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7633[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x3763('0x0'));var sequelize=require(_0x3763('0x1'));var moment=require(_0x3763('0x2'));var LIMIT_VALUE=0xfa;exports[_0x3763('0x3')]=function(_0xd1b764){var _0x5db18c=null;if(_0xd1b764){_0x5db18c=_0xd1b764[_0x3763('0x4')](',');}return _0x5db18c;};exports[_0x3763('0x5')]=function(_0x56a283,_0x5f4eb8){var _0xa0f328={};if(!_['isEmpty'](_0x56a283)){_['forOwn'](_0x56a283,function(_0x396634,_0x8a2d3e){try{if(_0x5f4eb8){var _0x28f9b0=_[_0x3763('0x6')](_0x5f4eb8,{'name':_0x8a2d3e})||{};if(_0x28f9b0['type']==='DATE'&&_[_0x3763('0x7')](_0x396634)){var _0x277d34=JSON['parse'](_0x396634);var _0x5c872d={'$gte':moment(moment(_0x277d34[_0x3763('0x8')])[_0x3763('0x9')](_0x3763('0xa')))[_0x3763('0xb')]()[_0x3763('0x9')](),'$lte':moment(moment(_0x277d34[_0x3763('0xc')])[_0x3763('0x9')]('YYYY-MM-DD'))[_0x3763('0xb')]()[_0x3763('0xd')](0x1,'s')[_0x3763('0x9')]()};_0xa0f328[_0x8a2d3e]=_0x5c872d;}else{_0xa0f328[_0x8a2d3e]=_['isArray'](_0x396634)?_0x396634:JSON['parse'](_0x396634);}}else{_0xa0f328[_0x8a2d3e]=_[_0x3763('0xe')](_0x396634)?_0x396634:JSON['parse'](_0x396634);}}catch(_0x12f0ea){_0xa0f328[_0x8a2d3e]=_0x396634[_0x3763('0x4')](',');}});}return _0xa0f328;};exports[_0x3763('0xf')]=function(_0x3d91da){_0x3d91da=parseInt(_0x3d91da,0xa);if(!_0x3d91da||_0x3d91da<0x0){_0x3d91da=LIMIT_VALUE;}return _0x3d91da;};exports[_0x3763('0x10')]=function(_0x1d1a10){_0x1d1a10=parseInt(_0x1d1a10,0xa);if(!_0x1d1a10||_0x1d1a10<0x0){_0x1d1a10=0x0;}return _0x1d1a10;};exports[_0x3763('0x11')]=function(_0x4c877a){var _0xa95c5b,_0x368434=null;if(_0x4c877a){_0xa95c5b=_0x4c877a[_0x3763('0x4')](',');_0x368434=_['map'](_0xa95c5b,function(_0x4dde36){if(_0x4dde36['indexOf']('-')===0x0){return[_0x4dde36===_0x3763('0x12')?sequelize[_0x3763('0x13')](sequelize[_0x3763('0x14')](_0x3763('0x12')),_0x3763('0x15')):_0x4dde36[_0x3763('0x16')](0x1),_0x3763('0x17')];}else{return[_0x4dde36==='priority'?sequelize[_0x3763('0x13')](sequelize[_0x3763('0x14')](_0x3763('0x12')),_0x3763('0x15')):_0x4dde36,'ASC'];}});}return _0x368434;};exports['omit']=function(_0x2cb398,_0x322d32){if(_[_0x3763('0x18')](_0x2cb398)){return _0x2cb398;}if(_[_0x3763('0xe')](_0x2cb398)){for(var _0x5e4f9e=0x0;_0x5e4f9e<_0x2cb398[_0x3763('0x19')];_0x5e4f9e+=0x1){_0x2cb398[_0x5e4f9e]=this['omit'](_0x2cb398[_0x5e4f9e],_0x322d32);}return _0x2cb398;}if(!_[_0x3763('0x1a')](_0x2cb398)){return _0x2cb398;}if(_[_0x3763('0x1b')](_0x322d32)){_0x322d32=[_0x322d32];}if(!_['isArray'](_0x322d32)){return _0x2cb398;}for(var _0x3083e=0x0;_0x3083e<_0x322d32[_0x3763('0x19')];_0x3083e+=0x1){_[_0x3763('0x1c')](_0x2cb398,_0x322d32[_0x3083e]);}for(var _0xd6086f in _0x2cb398){if(_0x2cb398[_0x3763('0x1d')](_0xd6086f)){_0x2cb398[_0xd6086f]=this[_0x3763('0x1e')](_0x2cb398[_0xd6086f],_0x322d32);}}return _0x2cb398;};exports[_0x3763('0x1f')]=function(_0x4a01c3){return _0x4a01c3['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x3763('0x20')]=function(_0x21d101){return _0x21d101[_0x3763('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x3763('0x22')]=function(_0x3f6644){var _0x1ccd28=[];_0x3f6644[_0x3763('0x4')]('\x20')[_0x3763('0x23')](function(_0x3525d1){_0x1ccd28[_0x3763('0x24')]('+'+_0x3525d1[_0x3763('0x25')]()+'*');});return _0x1ccd28[_0x3763('0x26')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 847af88..d6de0b6 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdbb9=['views','engine','html','ejs','urlencoded','50mb','json','use','serve-favicon','body-parser','method-override','path','passport','cors','moment','./environment','../mysqldb','default','env','production','set','public','development','appPath','join','root','json\x20replacer','toISOString','split','static','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb9,0xc2));var _0x9dbb=function(_0x1c9bc3,_0x44102c){_0x1c9bc3=_0x1c9bc3-0x0;var _0x446f08=_0xdbb9[_0x1c9bc3];return _0x446f08;};'use strict';var express=require('express');var favicon=require(_0x9dbb('0x0'));var bodyParser=require(_0x9dbb('0x1'));var methodOverride=require(_0x9dbb('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x9dbb('0x3'));var passport=require(_0x9dbb('0x4'));var cors=require(_0x9dbb('0x5'));var moment=require(_0x9dbb('0x6'));var config=require(_0x9dbb('0x7'));var db=require(_0x9dbb('0x8'))['db'];exports[_0x9dbb('0x9')]=function(_0x12c298){var _0x168a38=_0x12c298['get'](_0x9dbb('0xa'));if(_0x168a38===_0x9dbb('0xb')){_0x12c298[_0x9dbb('0xc')]('appPath',path['join'](config['root'],_0x9dbb('0xd')));}if(_0x168a38===_0x9dbb('0xe')||_0x168a38==='test'){_0x12c298['set'](_0x9dbb('0xf'),path[_0x9dbb('0x10')](config[_0x9dbb('0x11')],'client'));_0x12c298['use'](errorHandler());}_0x12c298[_0x9dbb('0xc')](_0x9dbb('0x12'),function(_0x1013da,_0x55ea91){if(this[_0x1013da]instanceof Date){_0x55ea91=this[_0x1013da][_0x9dbb('0x13')]()[_0x9dbb('0x14')]('.')[0x0]+'Z';}return _0x55ea91;});_0x12c298['use'](express[_0x9dbb('0x15')](_0x12c298[_0x9dbb('0x16')](_0x9dbb('0xf'))));_0x12c298[_0x9dbb('0xc')](_0x9dbb('0x17'),config['root']+'/server/views');_0x12c298[_0x9dbb('0x18')](_0x9dbb('0x19'),require(_0x9dbb('0x1a'))['renderFile']);_0x12c298[_0x9dbb('0xc')]('view\x20engine',_0x9dbb('0x19'));_0x12c298['use'](bodyParser[_0x9dbb('0x1b')]({'limit':_0x9dbb('0x1c'),'extended':!![]}));_0x12c298['use'](bodyParser[_0x9dbb('0x1d')]({'limit':'50mb'}));_0x12c298[_0x9dbb('0x1e')](cors());_0x12c298[_0x9dbb('0x1e')](methodOverride());_0x12c298[_0x9dbb('0x1e')](cookieParser());_0x12c298['use'](passport['initialize']());}; \ No newline at end of file +var _0x799e=['engine','html','ejs','renderFile','view\x20engine','50mb','initialize','express','serve-favicon','body-parser','method-override','errorhandler','passport','cors','../mysqldb','default','get','production','set','appPath','join','root','public','development','client','json\x20replacer','toISOString','use','views'];(function(_0x3702b0,_0x47a411){var _0x4c0bf1=function(_0x1962fb){while(--_0x1962fb){_0x3702b0['push'](_0x3702b0['shift']());}};_0x4c0bf1(++_0x47a411);}(_0x799e,0x1d7));var _0xe799=function(_0x5209f7,_0x417258){_0x5209f7=_0x5209f7-0x0;var _0x5c1e6f=_0x799e[_0x5209f7];return _0x5c1e6f;};'use strict';var express=require(_0xe799('0x0'));var favicon=require(_0xe799('0x1'));var bodyParser=require(_0xe799('0x2'));var methodOverride=require(_0xe799('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xe799('0x4'));var path=require('path');var passport=require(_0xe799('0x5'));var cors=require(_0xe799('0x6'));var moment=require('moment');var config=require('./environment');var db=require(_0xe799('0x7'))['db'];exports[_0xe799('0x8')]=function(_0x12bada){var _0x29cde8=_0x12bada[_0xe799('0x9')]('env');if(_0x29cde8===_0xe799('0xa')){_0x12bada[_0xe799('0xb')](_0xe799('0xc'),path[_0xe799('0xd')](config[_0xe799('0xe')],_0xe799('0xf')));}if(_0x29cde8===_0xe799('0x10')||_0x29cde8==='test'){_0x12bada[_0xe799('0xb')](_0xe799('0xc'),path['join'](config[_0xe799('0xe')],_0xe799('0x11')));_0x12bada['use'](errorHandler());}_0x12bada[_0xe799('0xb')](_0xe799('0x12'),function(_0x6d9145,_0x530eb8){if(this[_0x6d9145]instanceof Date){_0x530eb8=this[_0x6d9145][_0xe799('0x13')]()['split']('.')[0x0]+'Z';}return _0x530eb8;});_0x12bada[_0xe799('0x14')](express['static'](_0x12bada[_0xe799('0x9')](_0xe799('0xc'))));_0x12bada[_0xe799('0xb')](_0xe799('0x15'),config[_0xe799('0xe')]+'/server/views');_0x12bada[_0xe799('0x16')](_0xe799('0x17'),require(_0xe799('0x18'))[_0xe799('0x19')]);_0x12bada[_0xe799('0xb')](_0xe799('0x1a'),_0xe799('0x17'));_0x12bada[_0xe799('0x14')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x12bada[_0xe799('0x14')](bodyParser['json']({'limit':_0xe799('0x1b')}));_0x12bada[_0xe799('0x14')](cors());_0x12bada[_0xe799('0x14')](methodOverride());_0x12bada[_0xe799('0x14')](cookieParser());_0x12bada[_0xe799('0x14')](passport[_0xe799('0x1c')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d28bc3c..2437bc9 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 _0xba18=['networkInterfaces','orderBy','keys','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','update','digest','hex','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync'];(function(_0xc1ae3c,_0x45b8e4){var _0x55147a=function(_0x1a2bec){while(--_0x1a2bec){_0xc1ae3c['push'](_0xc1ae3c['shift']());}};_0x55147a(++_0x45b8e4);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var os=require('os');var crypto=require(_0x8ba1('0x1'));var machine=require(_0x8ba1('0x2'));var exec=require(_0x8ba1('0x3'))[_0x8ba1('0x4')];function getInterfaces(){var _0x46f8c7=[];var _0x25144d=os[_0x8ba1('0x5')]();var _0x59c54c=_[_0x8ba1('0x6')](_[_0x8ba1('0x7')](_0x25144d));for(var _0x2db11a=0x0;_0x2db11a<_0x59c54c[_0x8ba1('0x8')];_0x2db11a++){var _0x3b107c=_0x25144d[_0x59c54c[_0x2db11a]][_0x8ba1('0x9')](function(_0x51a988){return _0x51a988[_0x8ba1('0xa')]===_0x8ba1('0xb')&&_0x51a988['internal']===![];});_0x46f8c7=_0x46f8c7['concat'](_0x3b107c);}return _0x46f8c7;}function getFirstInterface(){var _0x4aa3e3=_[_0x8ba1('0xc')](getInterfaces());return{'macAddress':_0x4aa3e3&&_0x4aa3e3[_0x8ba1('0xd')]?_0x4aa3e3['mac']:_0x8ba1('0xe'),'ipAddress':_0x4aa3e3&&_0x4aa3e3[_0x8ba1('0xf')]?_0x4aa3e3[_0x8ba1('0xf')]:_0x8ba1('0x10')};}exports[_0x8ba1('0x11')]=getFirstInterface;function getCPUhash(){var _0x4c270f=_[_0x8ba1('0x6')](os[_0x8ba1('0x12')]()[_0x8ba1('0x13')](function(_0x1fcfd7){return _0x1fcfd7[_0x8ba1('0x14')];}))[_0x8ba1('0x15')](':');return crypto['createHash'](_0x8ba1('0x16'))[_0x8ba1('0x17')](_0x4c270f)[_0x8ba1('0x18')](_0x8ba1('0x19'));}exports['getUuid']=function(){switch(os['platform']()){case'win32':return exec(_0x8ba1('0x1a'),{'encoding':_0x8ba1('0x1b')})[_0x8ba1('0x1c')]('\x0d\x0a','');default:var _0x1b885b=getFirstInterface();var _0xc72b8d=getCPUhash();var _0x3880aa=_0xc72b8d+'|'+os[_0x8ba1('0x1d')]()+'|'+_0x1b885b[_0x8ba1('0x1e')]+'|'+_0x1b885b[_0x8ba1('0x1f')];var _0x245929=crypto['createHash']('md5')[_0x8ba1('0x17')](_0x3880aa)[_0x8ba1('0x18')]('hex');return _0x245929[_0x8ba1('0x20')](0x0,0x8)+'-'+_0x245929[_0x8ba1('0x20')](0x8,0xc)+'-'+_0x245929[_0x8ba1('0x20')](0xc,0x10)+'-'+_0x245929[_0x8ba1('0x20')](0x10,0x14)+'-'+_0x245929[_0x8ba1('0x20')](0x14);}}; \ No newline at end of file +var _0x6596=['hostname','md5','substring','lodash','crypto','child_process','execSync','networkInterfaces','length','filter','internal','concat','head','mac','address','getFirstInterface','orderBy','cpus','map','join','createHash','update','digest','hex','getUuid','platform','win32','utf8','replace'];(function(_0x441f67,_0x2abdcd){var _0x527a3b=function(_0x5ec4e4){while(--_0x5ec4e4){_0x441f67['push'](_0x441f67['shift']());}};_0x527a3b(++_0x2abdcd);}(_0x6596,0x1d3));var _0x6659=function(_0x3c0b4b,_0x39f089){_0x3c0b4b=_0x3c0b4b-0x0;var _0x98f42=_0x6596[_0x3c0b4b];return _0x98f42;};'use strict';var _=require(_0x6659('0x0'));var os=require('os');var crypto=require(_0x6659('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0x6659('0x2'))[_0x6659('0x3')];function getInterfaces(){var _0x3b1b74=[];var _0x2c58e1=os[_0x6659('0x4')]();var _0x67ac1d=_['orderBy'](_['keys'](_0x2c58e1));for(var _0x7edf11=0x0;_0x7edf11<_0x67ac1d[_0x6659('0x5')];_0x7edf11++){var _0xd6bf59=_0x2c58e1[_0x67ac1d[_0x7edf11]][_0x6659('0x6')](function(_0x29292b){return _0x29292b['family']==='IPv4'&&_0x29292b[_0x6659('0x7')]===![];});_0x3b1b74=_0x3b1b74[_0x6659('0x8')](_0xd6bf59);}return _0x3b1b74;}function getFirstInterface(){var _0x64b1cf=_[_0x6659('0x9')](getInterfaces());return{'macAddress':_0x64b1cf&&_0x64b1cf[_0x6659('0xa')]?_0x64b1cf[_0x6659('0xa')]:'00:00:00:00:00:00','ipAddress':_0x64b1cf&&_0x64b1cf[_0x6659('0xb')]?_0x64b1cf['address']:'127.0.0.1'};}exports[_0x6659('0xc')]=getFirstInterface;function getCPUhash(){var _0x482f1c=_[_0x6659('0xd')](os[_0x6659('0xe')]()[_0x6659('0xf')](function(_0x438f95){return _0x438f95['model'];}))[_0x6659('0x10')](':');return crypto[_0x6659('0x11')]('md5')[_0x6659('0x12')](_0x482f1c)[_0x6659('0x13')](_0x6659('0x14'));}exports[_0x6659('0x15')]=function(){switch(os[_0x6659('0x16')]()){case _0x6659('0x17'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x6659('0x18')})[_0x6659('0x19')]('\x0d\x0a','');default:var _0x1ddce3=getFirstInterface();var _0xad4fbb=getCPUhash();var _0x324fbc=_0xad4fbb+'|'+os[_0x6659('0x1a')]()+'|'+_0x1ddce3['macAddress']+'|'+_0x1ddce3['ipAddress'];var _0x441d6d=crypto['createHash'](_0x6659('0x1b'))[_0x6659('0x12')](_0x324fbc)['digest'](_0x6659('0x14'));return _0x441d6d['substring'](0x0,0x8)+'-'+_0x441d6d[_0x6659('0x1c')](0x8,0xc)+'-'+_0x441d6d[_0x6659('0x1c')](0xc,0x10)+'-'+_0x441d6d['substring'](0x10,0x14)+'-'+_0x441d6d[_0x6659('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 39bf687..c5f8953 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 _0xe9f4=['moment','request-promise','bluebird','version','../../components/encryptor','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','Motion\x20License\x20Alert','Alert','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','diff','decryptString','days','YYYY-MM-DD\x20HH:mm','update','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe9f4,0xab));var _0x4e9f=function(_0x1ab480,_0x4a60f2){_0x1ab480=_0x1ab480-0x0;var _0x506cc4=_0xe9f4[_0x1ab480];return _0x506cc4;};'use strict';var util=require('util');var moment=require(_0x4e9f('0x0'));var rp=require(_0x4e9f('0x1'));var BPromise=require(_0x4e9f('0x2'));var pkginfo=require('pkginfo')(module,_0x4e9f('0x3'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x4e9f('0x4'));var hardware=require('./hardware');var logger=require(_0x4e9f('0x5'))(_0x4e9f('0x6'));var jira=require(_0x4e9f('0x7'));const {config}=require(_0x4e9f('0x8'));var HOST=_0x4e9f('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x44c143){return new BPromise(function(_0x5cabe6,_0x1caabd){var _0x3c002b=util['format'](_0x4e9f('0xa'),HOST,_0x44c143,module[_0x4e9f('0xb')][_0x4e9f('0x3')]);if(oldToken){_0x3c002b=util[_0x4e9f('0xc')](_0x4e9f('0xd'),HOST,_0x44c143,module[_0x4e9f('0xb')][_0x4e9f('0x3')],oldToken);}var _0x525561={'uri':_0x3c002b,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x525561)[_0x4e9f('0xe')](function(_0x1a247a){_0x5cabe6(_0x1a247a);})[_0x4e9f('0xf')](function(_0x3e9956){_0x1caabd(_0x3e9956);});});}function sendJiraAlert(_0x4c6d22,_0x4a11d0,_0x2d07c1){var _0x5e662e=_0x4e9f('0x10');return db[_0x4e9f('0x11')][_0x4e9f('0x12')]({'where':{'role':_0x4e9f('0x13')},'attributes':[_0x4e9f('0x14'),_0x4e9f('0x15')],'raw':!![]})['then'](function(_0x3c7ab8){ADMIN=_0x3c7ab8;_0x5e662e+=_0x4e9f('0x16')+_0x2d07c1+'|\x0a';_0x5e662e+=_0x4e9f('0x17')+_0x4c6d22+'|\x0a';_0x5e662e+=_0x4e9f('0x18')+_0x4a11d0+'|\x0a';_0x5e662e+=_0x4e9f('0x19')+ADMIN[_0x4e9f('0x14')]+'|\x0a';_0x5e662e+=_0x4e9f('0x1a')+ADMIN[_0x4e9f('0x15')]+'|\x0a';return _0x5e662e;})[_0x4e9f('0xe')](function(_0x33439b){var _0x1c6438=hardware[_0x4e9f('0x1b')]()[_0x4e9f('0x1c')];return jira[_0x4e9f('0x1d')]({'key':'MOTLICENSE','summary':_0x4e9f('0x1e'),'description':_0x33439b,'issuetype':_0x4e9f('0x1f'),'oldToken':_0x4c6d22,'newToken':_0x4a11d0,'email':ADMIN['email'],'name':ADMIN[_0x4e9f('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x1c6438});});}function manageLicense(_0x8d40bb,_0x1a0b37){var _0x34a563=_0x1a0b37['get']({'plain':!![]});httpRequest(_0x8d40bb)[_0x4e9f('0xe')](function(_0x422fbc){if(oldToken){oldToken=undefined;}if(_0x422fbc[_0x4e9f('0x20')]){if(!_0x34a563[_0x4e9f('0x6')]&&_0x34a563['license']!=_0x422fbc[_0x4e9f('0x6')]||_0x34a563[_0x4e9f('0x6')]&&_0x34a563[_0x4e9f('0x21')]){logger[_0x4e9f('0x22')](_0x4e9f('0x23'));}if(_0x34a563[_0x4e9f('0x6')]&&!_0x34a563[_0x4e9f('0x21')]&&_0x34a563[_0x4e9f('0x6')]!=_0x422fbc['license']){logger['info'](_0x4e9f('0x24'));}if(_0x34a563['license']&&!_0x34a563[_0x4e9f('0x21')]&&_0x34a563[_0x4e9f('0x6')]==_0x422fbc['license']){return _0x1a0b37;}return _0x1a0b37['update']({'data1':_0x8d40bb,'data2':null,'license':_0x422fbc[_0x4e9f('0x6')]});}else{if(_0x422fbc['license']||_0x34a563[_0x4e9f('0x6')]){if(!_0x34a563['data2']){if(_0x34a563[_0x4e9f('0x25')]==_0x8d40bb){GRAY_PERIOD_REASON=_0x4e9f('0x26');logger['info'](_0x4e9f('0x27'));}else{GRAY_PERIOD_REASON=_0x4e9f('0x28');oldToken=_0x34a563[_0x4e9f('0x25')];logger[_0x4e9f('0x22')](_0x4e9f('0x29'),_0x34a563['data1'],_0x8d40bb);}sendJiraAlert(_0x34a563['data1'],_0x422fbc[_0x4e9f('0x2a')],GRAY_PERIOD_REASON);logger[_0x4e9f('0x22')](_0x4e9f('0x2b'),GRAY_PERIOD_REASON[_0x4e9f('0x2c')](),moment()[_0x4e9f('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x1a0b37['update']({'data2':encryptor['encryptString'](moment()[_0x4e9f('0xc')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x4e9f('0x2d')](encryptor[_0x4e9f('0x2e')](_0x34a563['data2']),_0x4e9f('0x2f'))>DAYS){logger[_0x4e9f('0x22')]('DEMO\x20START\x20AT\x20%s',moment()[_0x4e9f('0xc')](_0x4e9f('0x30')));return _0x1a0b37[_0x4e9f('0x31')]({'data1':_0x8d40bb,'data2':null,'license':null});}}}else{if(_0x34a563[_0x4e9f('0x25')]!=_0x8d40bb){logger[_0x4e9f('0x22')](_0x4e9f('0x29'),_0x34a563[_0x4e9f('0x25')],_0x8d40bb);return _0x1a0b37[_0x4e9f('0x31')]({'data1':_0x8d40bb,'data2':null,'license':null});}}}return _0x1a0b37;})[_0x4e9f('0xe')](function(_0x1215a9){_0x1a0b37=_0x1215a9;})[_0x4e9f('0xf')](function(_0x118d26){logger['error'](_0x118d26['message']);})[_0x4e9f('0x32')](function(){setTimeout(function(){manageLicense(hardware[_0x4e9f('0x33')](),_0x1a0b37);},TIME);});}function defaultLicense(){var _0x205846=hardware[_0x4e9f('0x33')]();if(_0x205846){return db['License'][_0x4e9f('0x34')]({'where':{'id':0x1},'defaults':{'data1':_0x205846}})['spread'](function(_0x34db3d,_0x31653a){logger[_0x4e9f('0x22')](_0x4e9f('0x35'),_0x205846);manageLicense(_0x205846,_0x34db3d);})[_0x4e9f('0xf')](function(_0x1bb34f){logger[_0x4e9f('0x36')](_0x1bb34f[_0x4e9f('0x37')]);});}}exports[_0x4e9f('0x38')]=defaultLicense; \ No newline at end of file +var _0x6a0b=['|machineUuid|','fullname','|email|','getFirstInterface','ipAddress','Alert','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','Disabled','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','update','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','pkginfo','version','./hardware','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','email','|uuid|'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0x6a0b,0x7b));var _0xb6a0=function(_0x309515,_0x55f470){_0x309515=_0x309515-0x0;var _0x51f8bd=_0x6a0b[_0x309515];return _0x51f8bd;};'use strict';var util=require(_0xb6a0('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xb6a0('0x1'))(module,_0xb6a0('0x2'));var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb6a0('0x3'));var logger=require('../logger')('license');var jira=require(_0xb6a0('0x4'));const {config}=require(_0xb6a0('0x5'));var HOST=_0xb6a0('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x43903e){return new BPromise(function(_0x2f3620,_0x5f00d4){var _0x5eb00f=util[_0xb6a0('0x7')](_0xb6a0('0x8'),HOST,_0x43903e,module['exports'][_0xb6a0('0x2')]);if(oldToken){_0x5eb00f=util['format'](_0xb6a0('0x9'),HOST,_0x43903e,module['exports'][_0xb6a0('0x2')],oldToken);}var _0x414e04={'uri':_0x5eb00f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x414e04)[_0xb6a0('0xa')](function(_0x329dd5){_0x2f3620(_0x329dd5);})[_0xb6a0('0xb')](function(_0x3a3532){_0x5f00d4(_0x3a3532);});});}function sendJiraAlert(_0x5969a8,_0x5bce2b,_0x44ca0f){var _0x345c83=_0xb6a0('0xc');return db[_0xb6a0('0xd')][_0xb6a0('0xe')]({'where':{'role':_0xb6a0('0xf')},'attributes':['fullname',_0xb6a0('0x10')],'raw':!![]})[_0xb6a0('0xa')](function(_0x36a5e6){ADMIN=_0x36a5e6;_0x345c83+='|reason|'+_0x44ca0f+'|\x0a';_0x345c83+=_0xb6a0('0x11')+_0x5969a8+'|\x0a';_0x345c83+=_0xb6a0('0x12')+_0x5bce2b+'|\x0a';_0x345c83+='|name|'+ADMIN[_0xb6a0('0x13')]+'|\x0a';_0x345c83+=_0xb6a0('0x14')+ADMIN['email']+'|\x0a';return _0x345c83;})['then'](function(_0x16724a){var _0x5cefc5=hardware[_0xb6a0('0x15')]()[_0xb6a0('0x16')];return jira['openIssue']({'key':'MOTLICENSE','summary':'Motion\x20License\x20Alert','description':_0x16724a,'issuetype':_0xb6a0('0x17'),'oldToken':_0x5969a8,'newToken':_0x5bce2b,'email':ADMIN[_0xb6a0('0x10')],'name':ADMIN[_0xb6a0('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x5cefc5});});}function manageLicense(_0x3093dc,_0x7fed07){var _0x2a9b29=_0x7fed07['get']({'plain':!![]});httpRequest(_0x3093dc)[_0xb6a0('0xa')](function(_0x1ba029){if(oldToken){oldToken=undefined;}if(_0x1ba029['active']){if(!_0x2a9b29[_0xb6a0('0x18')]&&_0x2a9b29[_0xb6a0('0x18')]!=_0x1ba029[_0xb6a0('0x18')]||_0x2a9b29[_0xb6a0('0x18')]&&_0x2a9b29[_0xb6a0('0x19')]){logger[_0xb6a0('0x1a')](_0xb6a0('0x1b'));}if(_0x2a9b29[_0xb6a0('0x18')]&&!_0x2a9b29[_0xb6a0('0x19')]&&_0x2a9b29[_0xb6a0('0x18')]!=_0x1ba029[_0xb6a0('0x18')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2a9b29[_0xb6a0('0x18')]&&!_0x2a9b29[_0xb6a0('0x19')]&&_0x2a9b29[_0xb6a0('0x18')]==_0x1ba029[_0xb6a0('0x18')]){return _0x7fed07;}return _0x7fed07['update']({'data1':_0x3093dc,'data2':null,'license':_0x1ba029[_0xb6a0('0x18')]});}else{if(_0x1ba029[_0xb6a0('0x18')]||_0x2a9b29[_0xb6a0('0x18')]){if(!_0x2a9b29[_0xb6a0('0x19')]){if(_0x2a9b29['data1']==_0x3093dc){GRAY_PERIOD_REASON=_0xb6a0('0x1c');logger[_0xb6a0('0x1a')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xb6a0('0x1d');oldToken=_0x2a9b29[_0xb6a0('0x1e')];logger[_0xb6a0('0x1a')](_0xb6a0('0x1f'),_0x2a9b29['data1'],_0x3093dc);}sendJiraAlert(_0x2a9b29[_0xb6a0('0x1e')],_0x1ba029['uuid'],GRAY_PERIOD_REASON);logger[_0xb6a0('0x1a')](_0xb6a0('0x20'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xb6a0('0x7')](_0xb6a0('0x21')));return _0x7fed07['update']({'data2':encryptor[_0xb6a0('0x22')](moment()[_0xb6a0('0x7')](_0xb6a0('0x21')))});}else{if(moment()[_0xb6a0('0x23')](encryptor['decryptString'](_0x2a9b29[_0xb6a0('0x19')]),_0xb6a0('0x24'))>DAYS){logger[_0xb6a0('0x1a')]('DEMO\x20START\x20AT\x20%s',moment()[_0xb6a0('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x7fed07[_0xb6a0('0x25')]({'data1':_0x3093dc,'data2':null,'license':null});}}}else{if(_0x2a9b29[_0xb6a0('0x1e')]!=_0x3093dc){logger[_0xb6a0('0x1a')](_0xb6a0('0x1f'),_0x2a9b29['data1'],_0x3093dc);return _0x7fed07['update']({'data1':_0x3093dc,'data2':null,'license':null});}}}return _0x7fed07;})[_0xb6a0('0xa')](function(_0x3cf1f3){_0x7fed07=_0x3cf1f3;})[_0xb6a0('0xb')](function(_0x42bc68){logger['error'](_0x42bc68[_0xb6a0('0x26')]);})[_0xb6a0('0x27')](function(){setTimeout(function(){manageLicense(hardware[_0xb6a0('0x28')](),_0x7fed07);},TIME);});}function defaultLicense(){var _0x5df500=hardware[_0xb6a0('0x28')]();if(_0x5df500){return db[_0xb6a0('0x29')][_0xb6a0('0x2a')]({'where':{'id':0x1},'defaults':{'data1':_0x5df500}})[_0xb6a0('0x2b')](function(_0x468ab4,_0x3c340e){logger['info'](_0xb6a0('0x2c'),_0x5df500);manageLicense(_0x5df500,_0x468ab4);})['catch'](function(_0x1a747c){logger[_0xb6a0('0x2d')](_0x1a747c[_0xb6a0('0x26')]);});}}exports[_0xb6a0('0x2e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 60efdde..8902ca4 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 _0x3410=['User','findAll','role','sequelize','COUNT','col','admin','user','users','count','catch','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','days','changed','message'];(function(_0x2cf683,_0x3213de){var _0x5cddff=function(_0x454eed){while(--_0x454eed){_0x2cf683['push'](_0x2cf683['shift']());}};_0x5cddff(++_0x3213de);}(_0x3410,0x64));var _0x0341=function(_0xcfc8b,_0x34170d){_0xcfc8b=_0xcfc8b-0x0;var _0x4fc583=_0x3410[_0xcfc8b];return _0x4fc583;};'use strict';var util=require(_0x0341('0x0'));var _=require(_0x0341('0x1'));var moment=require('moment');var BPromise=require(_0x0341('0x2'));var hardware=require(_0x0341('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x0341('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0341('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0341('0x6'),'machineUuid':hardware[_0x0341('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0341('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0341('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x31de79){return new BPromise(function(_0x463c93,_0x171bd5){return db[_0x0341('0x9')][_0x0341('0xa')](_[_0x0341('0xb')](_0x31de79,{'raw':!![],'where':{'id':0x1}}))[_0x0341('0xc')](function(_0x103ea0){return checkLicense(_0x103ea0,null);})[_0x0341('0xc')](function(_0x546108){_0x463c93(_0x546108);return;})['catch'](function(_0x53c424){_0x171bd5(_0x53c424);});});}function checkLicense(_0x151352,_0x4ff33b){if(!_0x151352){demoLicense[_0x0341('0xd')]=_0x151352[_0x0341('0xe')];return demoLicense;}try{var _0x53d246=_0x4ff33b||_0x151352['license'];if(_[_0x0341('0xf')](_0x53d246)){throw new Error(_0x0341('0x10'));}var _0x2c40f5=_0x151352['data1'];var _0x3e7e29=_0x151352['data2'];var _0x393da7=_0x2c40f5['split']('-')[0x4];var _0x4148c4=_0x2c40f5[_0x0341('0x11')]('-')[0x0];var _0x11bfad=encryptor['decryptString'](_0x53d246,util[_0x0341('0x12')](_0x0341('0x13'),_0x393da7,_0x2c40f5,_0x4148c4));var _0x301f21=JSON[_0x0341('0x14')](_0x11bfad);_0x301f21[_0x0341('0x15')]=![];_0x301f21['uuid']=_0x2c40f5;_0x301f21[_0x0341('0x16')]=hardware['getUuid']();if(_0x3e7e29){var _0x329acf=encryptor[_0x0341('0x17')](_0x3e7e29);_0x301f21[_0x0341('0x18')]=_0x329acf;_0x301f21[_0x0341('0x19')]=moment(_0x329acf)['add'](0x7,_0x0341('0x1a'))['format']();_0x301f21['grayReason']=_0x301f21[_0x0341('0xd')]!=_0x301f21[_0x0341('0x16')]?_0x0341('0x1b'):'disabled';}return _0x301f21;}catch(_0x731107){breakingLicense['uuid']=_0x151352[_0x0341('0xe')];breakingLicense[_0x0341('0x1c')]=_0x731107['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x44bce3,_0x4fe121){getLicense()[_0x0341('0xc')](function(_0x14eb0c){return db[_0x0341('0x1d')][_0x0341('0x1e')]({'attributes':[_0x0341('0x1f'),[db[_0x0341('0x20')]['fn'](_0x0341('0x21'),db[_0x0341('0x20')][_0x0341('0x22')](_0x0341('0x1f'))),'count']],'group':_0x0341('0x1f'),'where':{'role':{'$or':[_0x0341('0x23'),_0x0341('0x24'),'telephone']}},'raw':!![]})[_0x0341('0xc')](function(_0x1b583d){var _0x5e6d5c={'user':_0x14eb0c[_0x0341('0x25')]||0x0,'telephone':_0x14eb0c['telephones']||0x0};_0x1b583d['forEach'](function(_0x3a8687){var _0x554ad0=_0x3a8687[_0x0341('0x1f')]===_0x0341('0x23')?_0x0341('0x24'):_0x3a8687[_0x0341('0x1f')];_0x5e6d5c[_0x554ad0]-=_0x3a8687[_0x0341('0x26')];if(_0x5e6d5c[_0x554ad0]<0x0)_0x5e6d5c[_0x554ad0]=0x0;});_0x44bce3(_0x5e6d5c);return;});})[_0x0341('0x27')](function(_0x2c6043){_0x4fe121(_0x2c6043);});});}function checkUserLimits(_0x21bfe2){return new BPromise(function(_0x5be2ae,_0x5556f0){getLimits()[_0x0341('0xc')](function(_0x3a542e){var _0x277327=_['pick'](_['countBy'](_0x21bfe2,_0x0341('0x1f')),[_0x0341('0x23'),_0x0341('0x24'),_0x0341('0x28')]);var _0x496dce=(_0x277327[_0x0341('0x23')]||0x0)+(_0x277327['user']||0x0);var _0x549acc=_0x277327[_0x0341('0x28')]||0x0;if(_0x496dce>_0x3a542e[_0x0341('0x24')])return _0x5556f0(_0x0341('0x29'));if(_0x549acc>_0x3a542e[_0x0341('0x28')])return _0x5556f0(_0x0341('0x2a'));return _0x5be2ae();})[_0x0341('0x27')](function(_0x56dacc){_0x5556f0(_0x56dacc);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8533=['telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','decryptString','format','%s:%s:%s','parse','machineUuid','deadline','add','days','changed','disabled','message','User','sequelize','col','role','user','telephone','users'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8533,0x8e));var _0x3853=function(_0x9c2967,_0x397a14){_0x9c2967=_0x9c2967-0x0;var _0x341cbd=_0x8533[_0x9c2967];return _0x341cbd;};'use strict';var util=require(_0x3853('0x0'));var _=require(_0x3853('0x1'));var moment=require(_0x3853('0x2'));var BPromise=require(_0x3853('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x3853('0x4'))['db'];const demoLicense={'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':_0x3853('0x5'),'machineUuid':hardware[_0x3853('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3853('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3853('0x8'),'machineUuid':hardware[_0x3853('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x56e7d4){return new BPromise(function(_0x3d4da6,_0x188b2a){return db[_0x3853('0x9')][_0x3853('0xa')](_[_0x3853('0xb')](_0x56e7d4,{'raw':!![],'where':{'id':0x1}}))[_0x3853('0xc')](function(_0x3128a3){return checkLicense(_0x3128a3,null);})[_0x3853('0xc')](function(_0x322284){_0x3d4da6(_0x322284);return;})[_0x3853('0xd')](function(_0xcee7af){_0x188b2a(_0xcee7af);});});}function checkLicense(_0x43286b,_0x1dd068){if(!_0x43286b){demoLicense[_0x3853('0xe')]=_0x43286b[_0x3853('0xf')];return demoLicense;}try{var _0x515f94=_0x1dd068||_0x43286b[_0x3853('0x10')];if(_[_0x3853('0x11')](_0x515f94)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1b43ea=_0x43286b[_0x3853('0xf')];var _0x3e67d6=_0x43286b[_0x3853('0x12')];var _0x3a5576=_0x1b43ea['split']('-')[0x4];var _0x1a85f0=_0x1b43ea[_0x3853('0x13')]('-')[0x0];var _0x526f81=encryptor[_0x3853('0x14')](_0x515f94,util[_0x3853('0x15')](_0x3853('0x16'),_0x3a5576,_0x1b43ea,_0x1a85f0));var _0x2febb8=JSON[_0x3853('0x17')](_0x526f81);_0x2febb8['demo']=![];_0x2febb8[_0x3853('0xe')]=_0x1b43ea;_0x2febb8[_0x3853('0x18')]=hardware[_0x3853('0x6')]();if(_0x3e67d6){var _0x11c1bc=encryptor[_0x3853('0x14')](_0x3e67d6);_0x2febb8['gray']=_0x11c1bc;_0x2febb8[_0x3853('0x19')]=moment(_0x11c1bc)[_0x3853('0x1a')](0x7,_0x3853('0x1b'))[_0x3853('0x15')]();_0x2febb8['grayReason']=_0x2febb8[_0x3853('0xe')]!=_0x2febb8[_0x3853('0x18')]?_0x3853('0x1c'):_0x3853('0x1d');}return _0x2febb8;}catch(_0xf14de8){breakingLicense['uuid']=_0x43286b[_0x3853('0xf')];breakingLicense[_0x3853('0x1e')]=_0xf14de8[_0x3853('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1dae8f,_0x2837b2){getLicense()['then'](function(_0x19a990){return db[_0x3853('0x1f')]['findAll']({'attributes':['role',[db[_0x3853('0x20')]['fn']('COUNT',db[_0x3853('0x20')][_0x3853('0x21')](_0x3853('0x22'))),'count']],'group':_0x3853('0x22'),'where':{'role':{'$or':['admin',_0x3853('0x23'),_0x3853('0x24')]}},'raw':!![]})[_0x3853('0xc')](function(_0x533449){var _0x143b59={'user':_0x19a990[_0x3853('0x25')]||0x0,'telephone':_0x19a990[_0x3853('0x26')]||0x0};_0x533449[_0x3853('0x27')](function(_0x33f036){var _0x3571d3=_0x33f036[_0x3853('0x22')]===_0x3853('0x28')?'user':_0x33f036[_0x3853('0x22')];_0x143b59[_0x3571d3]-=_0x33f036['count'];if(_0x143b59[_0x3571d3]<0x0)_0x143b59[_0x3571d3]=0x0;});_0x1dae8f(_0x143b59);return;});})['catch'](function(_0x4ce652){_0x2837b2(_0x4ce652);});});}function checkUserLimits(_0x3198e8){return new BPromise(function(_0xb3454c,_0x4f5754){getLimits()[_0x3853('0xc')](function(_0x5a18ce){var _0x4d9eb1=_[_0x3853('0x29')](_[_0x3853('0x2a')](_0x3198e8,_0x3853('0x22')),[_0x3853('0x28'),_0x3853('0x23'),_0x3853('0x24')]);var _0x1d8ed1=(_0x4d9eb1[_0x3853('0x28')]||0x0)+(_0x4d9eb1[_0x3853('0x23')]||0x0);var _0x5216e4=_0x4d9eb1['telephone']||0x0;if(_0x1d8ed1>_0x5a18ce[_0x3853('0x23')])return _0x4f5754(_0x3853('0x2b'));if(_0x5216e4>_0x5a18ce[_0x3853('0x24')])return _0x4f5754('License\x20limit\x20reached\x20for\x20telephones');return _0xb3454c();})[_0x3853('0xd')](function(_0x29f11f){_0x4f5754(_0x29f11f);});});}module[_0x3853('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 8a851bf..a794285 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 _0x09be=['exports','http://localhost:9000','app-id'];(function(_0x3e68d0,_0x1587e6){var _0x1418fe=function(_0xd60b3a){while(--_0xd60b3a){_0x3e68d0['push'](_0x3e68d0['shift']());}};_0x1418fe(++_0x1587e6);}(_0x09be,0xc0));var _0xe09b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09be[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xe09b('0x0')]={'DOMAIN':_0xe09b('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xe09b('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x0bea=['myappanuglar-secret','exports','http://localhost:9000'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x0bea,0xee));var _0xa0be=function(_0x76b00b,_0x26e939){_0x76b00b=_0x76b00b-0x0;var _0xc8e4a=_0x0bea[_0x76b00b];return _0xc8e4a;};'use strict';module[_0xa0be('0x0')]={'DOMAIN':_0xa0be('0x1'),'SESSION_SECRET':_0xa0be('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 325340c..58cc866 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11db=['error','transports','info','env','debugLevel','moment','winston','util','INFO','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','File','%s-%s'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x11db,0xf7));var _0xb11d=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x11db[_0x5a3cf0];return _0x5a64ee;};'use strict';var moment=require(_0xb11d('0x0'));var winston=require(_0xb11d('0x1'));var util=require(_0xb11d('0x2'));var path=require('path');var debugLevel=_0xb11d('0x3');function filename(_0x3cd495,_0xe8795b){return path['join'](_0xb11d('0x4'),_0xb11d('0x5'),_0xb11d('0x6'),util[_0xb11d('0x7')](_0xb11d('0x8'),_0x3cd495,_0xe8795b));}function formatter(_0x10ca8e,_0xe6e906){return util[_0xb11d('0x7')](_0xb11d('0x9'),moment()[_0xb11d('0x7')](_0xb11d('0xa')),_0xe6e906['level'][_0xb11d('0xb')](),_0x10ca8e,_0xe6e906[_0xb11d('0xc')]);}module[_0xb11d('0xd')]=function(_0x33fd65){return new winston[(_0xb11d('0xe'))]({'transports':[new winston['transports'][(_0xb11d('0xf'))]({'name':util[_0xb11d('0x7')](_0xb11d('0x10'),_0x33fd65,_0xb11d('0x11')),'filename':filename(_0x33fd65,'error'),'level':_0xb11d('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x10fe0e){return formatter(_0x33fd65,_0x10fe0e);}}),new winston[(_0xb11d('0x12'))][(_0xb11d('0xf'))]({'name':util[_0xb11d('0x7')](_0xb11d('0x10'),_0x33fd65,_0xb11d('0x13')),'filename':filename(_0x33fd65,_0xb11d('0x13')),'level':_0xb11d('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f9ea7){return formatter(_0x33fd65,_0x2f9ea7);}}),new winston['transports']['Console']({'level':process[_0xb11d('0x14')][_0xb11d('0x15')]||debugLevel,'json':![],'formatter':function(_0x895340){return formatter(_0x33fd65,_0x895340);}})]});}; \ No newline at end of file +var _0x0977=['File','%s-%s','error','info','Console','debugLevel','util','path','INFO','join','/var','log','xcally','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0977,0x10e));var _0x7097=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0977[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x7097('0x0'));var path=require(_0x7097('0x1'));var debugLevel=_0x7097('0x2');function filename(_0x56d28e,_0x4ce003){return path[_0x7097('0x3')](_0x7097('0x4'),_0x7097('0x5'),_0x7097('0x6'),util['format'](_0x7097('0x7'),_0x56d28e,_0x4ce003));}function formatter(_0x2b555d,_0x4637f2){return util[_0x7097('0x8')](_0x7097('0x9'),moment()[_0x7097('0x8')](_0x7097('0xa')),_0x4637f2[_0x7097('0xb')][_0x7097('0xc')](),_0x2b555d,_0x4637f2['message']);}module[_0x7097('0xd')]=function(_0x11c4a6){return new winston[(_0x7097('0xe'))]({'transports':[new winston[(_0x7097('0xf'))][(_0x7097('0x10'))]({'name':util[_0x7097('0x8')](_0x7097('0x11'),_0x11c4a6,_0x7097('0x12')),'filename':filename(_0x11c4a6,_0x7097('0x12')),'level':_0x7097('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x23b273){return formatter(_0x11c4a6,_0x23b273);}}),new winston['transports'][(_0x7097('0x10'))]({'name':util[_0x7097('0x8')](_0x7097('0x11'),_0x11c4a6,_0x7097('0x13')),'filename':filename(_0x11c4a6,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2b42bf){return formatter(_0x11c4a6,_0x2b42bf);}}),new winston[(_0x7097('0xf'))][(_0x7097('0x14'))]({'level':process['env'][_0x7097('0x15')]||debugLevel,'json':![],'formatter':function(_0x4def1d){return formatter(_0x11c4a6,_0x4def1d);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index c1a54ac..036004f 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 _0xc7e9=['path','express','../../services/express/index.js','ami','join','agi','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x2b57bd,_0xfb1ceb){var _0x44eb9a=function(_0x49741f){while(--_0x49741f){_0x2b57bd['push'](_0x2b57bd['shift']());}};_0x44eb9a(++_0xfb1ceb);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc7e9[_0x17406a];return _0x1501ff;};'use strict';var path=require(_0x9c7e('0x0'));var os=require('os');var config={'apps':[{'name':_0x9c7e('0x1'),'script':path['join'](__dirname,_0x9c7e('0x2'))},{'name':_0x9c7e('0x3'),'script':path[_0x9c7e('0x4')](__dirname,'../../services/ami/index.js')},{'name':_0x9c7e('0x5'),'script':path[_0x9c7e('0x4')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0x9c7e('0x4')](__dirname,'../../services/email/index.js')},{'name':_0x9c7e('0x6'),'script':path[_0x9c7e('0x4')](__dirname,_0x9c7e('0x7'))},{'name':_0x9c7e('0x8'),'script':path['join'](__dirname,_0x9c7e('0x9'))}]};module[_0x9c7e('0xa')]=config; \ No newline at end of file +var _0x2642=['../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express','join','../../services/express/index.js'];(function(_0x5d001a,_0x2721f9){var _0x39059f=function(_0x5c8b03){while(--_0x5c8b03){_0x5d001a['push'](_0x5d001a['shift']());}};_0x39059f(++_0x2721f9);}(_0x2642,0x11c));var _0x2264=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2642[_0x2f5ac5];return _0x37c9a8;};'use strict';var path=require(_0x2264('0x0'));var os=require('os');var config={'apps':[{'name':_0x2264('0x1'),'script':path[_0x2264('0x2')](__dirname,_0x2264('0x3'))},{'name':'ami','script':path[_0x2264('0x2')](__dirname,_0x2264('0x4'))},{'name':_0x2264('0x5'),'script':path[_0x2264('0x2')](__dirname,_0x2264('0x6'))},{'name':_0x2264('0x7'),'script':path[_0x2264('0x2')](__dirname,'../../services/email/index.js')},{'name':_0x2264('0x8'),'script':path[_0x2264('0x2')](__dirname,_0x2264('0x9'))},{'name':_0x2264('0xa'),'script':path[_0x2264('0x2')](__dirname,_0x2264('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 8e6f5eb..3730ee0 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 _0x446c=['connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x595be8,_0x17e686){var _0x396229=function(_0x5e4bdc){while(--_0x5e4bdc){_0x595be8['push'](_0x595be8['shift']());}};_0x396229(++_0x17e686);}(_0x446c,0x156));var _0xc446=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x446c[_0x2ec461];return _0x28603d;};'use strict';var pm2=require(_0xc446('0x0'));var BPromise=require(_0xc446('0x1'));var config=require(_0xc446('0x2'));function connect(){return new BPromise(function(_0x45c553,_0x48222e){return pm2[_0xc446('0x3')](function(_0x2136f6){if(_0x2136f6){return _0x48222e(_0x2136f6);}return _0x45c553(_0xc446('0x4'));});});};exports['start']=function(_0x10047a){return connect()['then'](function(){return new BPromise(function(_0x4a1bce,_0x115a9e){return pm2[_0xc446('0x5')](_0x10047a,function(_0x578895,_0x549fac){if(_0x578895){return _0x115a9e(_0x578895);}pm2[_0xc446('0x6')]();return _0x4a1bce(_0x549fac);});});});};exports[_0xc446('0x7')]=function(_0x1ddeaf){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x155b5c,_0x4a2a80){return pm2[_0xc446('0x7')](_0x1ddeaf,function(_0x5f2136,_0xbbd769){if(_0x5f2136){return _0x4a2a80(_0x5f2136);}pm2[_0xc446('0x6')]();return _0x155b5c(_0xbbd769);});});});};exports['restart']=function(_0x242a0d){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x42857a,_0x195ca1){return pm2[_0xc446('0x9')](_0x242a0d,function(_0x6a5c0f,_0x1a2099){if(_0x6a5c0f){return _0x195ca1(_0x6a5c0f);}pm2[_0xc446('0x6')]();return _0x42857a(_0x1a2099);});});});};exports[_0xc446('0xa')]=function(){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x89a7,_0x306814){return pm2[_0xc446('0xa')](function(_0x72faac,_0x21d8e4){if(_0x72faac){return _0x306814(_0x72faac);}pm2[_0xc446('0x6')]();return _0x89a7(_0x21d8e4);});});});};exports[_0xc446('0xb')]=function(_0x20e51b){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x5d2701,_0x3ba115){return pm2[_0xc446('0xb')](_0x20e51b,function(_0x412678,_0x4690c5){if(_0x412678){return _0x3ba115(_0x412678);}pm2[_0xc446('0x6')]();return _0x5d2701(_0x4690c5);});});});};exports[_0xc446('0xc')]=function(_0x146be5){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x16f337,_0x606af1){return pm2['delete'](_0x146be5,function(_0x19c4d8,_0x278b21){if(_0x19c4d8){return _0x606af1(_0x19c4d8);}pm2['disconnect']();return _0x16f337(_0x278b21);});});});};exports[_0xc446('0xd')]=function(){return connect()[_0xc446('0x8')](function(){return new BPromise(function(_0x42a338,_0x434c94){return pm2[_0xc446('0xd')](function(_0x37108c){if(_0x37108c){return _0x434c94(_0x37108c);}return _0x42a338(_0xc446('0xe'));});});});}; \ No newline at end of file +var _0xc4aa=['connect','then','start','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x2ae86e,_0x110e55){var _0x3f425c=function(_0x4a2135){while(--_0x4a2135){_0x2ae86e['push'](_0x2ae86e['shift']());}};_0x3f425c(++_0x110e55);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var pm2=require(_0xac4a('0x0'));var BPromise=require(_0xac4a('0x1'));var config=require(_0xac4a('0x2'));function connect(){return new BPromise(function(_0x351dd5,_0x275161){return pm2[_0xac4a('0x3')](function(_0x58634e){if(_0x58634e){return _0x275161(_0x58634e);}return _0x351dd5('connected');});});};exports['start']=function(_0x2f48ed){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x730a38,_0x215f39){return pm2[_0xac4a('0x5')](_0x2f48ed,function(_0x15cd34,_0x3ef77c){if(_0x15cd34){return _0x215f39(_0x15cd34);}pm2[_0xac4a('0x6')]();return _0x730a38(_0x3ef77c);});});});};exports['stop']=function(_0x5b8339){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x2a4d53,_0x26ec84){return pm2['stop'](_0x5b8339,function(_0x1d182e,_0x3a82de){if(_0x1d182e){return _0x26ec84(_0x1d182e);}pm2[_0xac4a('0x6')]();return _0x2a4d53(_0x3a82de);});});});};exports['restart']=function(_0x30135d){return connect()['then'](function(){return new BPromise(function(_0x2f062c,_0x4855b6){return pm2[_0xac4a('0x7')](_0x30135d,function(_0x2a0776,_0x24291d){if(_0x2a0776){return _0x4855b6(_0x2a0776);}pm2['disconnect']();return _0x2f062c(_0x24291d);});});});};exports[_0xac4a('0x8')]=function(){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x247b78,_0x6e00d4){return pm2[_0xac4a('0x8')](function(_0x3b71c0,_0x34bc01){if(_0x3b71c0){return _0x6e00d4(_0x3b71c0);}pm2[_0xac4a('0x6')]();return _0x247b78(_0x34bc01);});});});};exports[_0xac4a('0x9')]=function(_0x42c7fc){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x26dbb8,_0x4a2119){return pm2[_0xac4a('0x9')](_0x42c7fc,function(_0x34d797,_0x23eb66){if(_0x34d797){return _0x4a2119(_0x34d797);}pm2[_0xac4a('0x6')]();return _0x26dbb8(_0x23eb66);});});});};exports[_0xac4a('0xa')]=function(_0x387a54){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x44ec59,_0x546c5d){return pm2['delete'](_0x387a54,function(_0x21a729,_0x13c8eb){if(_0x21a729){return _0x546c5d(_0x21a729);}pm2[_0xac4a('0x6')]();return _0x44ec59(_0x13c8eb);});});});};exports['dump']=function(){return connect()[_0xac4a('0x4')](function(){return new BPromise(function(_0x15c223,_0x3752e4){return pm2[_0xac4a('0xb')](function(_0x123694){if(_0x123694){return _0x3752e4(_0x123694);}return _0x15c223(_0xac4a('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index bba091a..76a8c48 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 _0x22ed=['chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','update','system','timeout','format','map','emit','chatInteraction:update','catch','error','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','Setting','find'];(function(_0x246b25,_0x210f2f){var _0x506cdc=function(_0x5a5eca){while(--_0x5a5eca){_0x246b25['push'](_0x246b25['shift']());}};_0x506cdc(++_0x210f2f);}(_0x22ed,0xff));var _0xd22e=function(_0x173027,_0x212ba5){_0x173027=_0x173027-0x0;var _0xe346cb=_0x22ed[_0x173027];return _0xe346cb;};'use strict';var _=require(_0xd22e('0x0'));var moment=require(_0xd22e('0x1'));var Redis=require(_0xd22e('0x2'));var db=require(_0xd22e('0x3'))['db'];var config=require(_0xd22e('0x4'));config[_0xd22e('0x5')]=_['defaults'](config[_0xd22e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xd22e('0x6'))(new Redis(config[_0xd22e('0x5')]));function closeInteractions(){var _0x1f0e83=0x0;var _0x314e22=[];return db[_0xd22e('0x7')][_0xd22e('0x8')]({'raw':!![],'attributes':['id',_0xd22e('0x9')],'where':{'id':0x1}})[_0xd22e('0xa')](function(_0x26a8cb){_0x1f0e83=_0x26a8cb['chatTimeout'];if(_0x1f0e83){return db[_0xd22e('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xd22e('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd22e('0xd')](_0x26a8cb['chatTimeout'],_0xd22e('0xe'))}}});}else{return[];}})['then'](function(_0x3d291a){_0x314e22=_0x3d291a;if(_0x1f0e83){return db[_0xd22e('0xb')][_0xd22e('0xf')]({'closeReason':_0xd22e('0x10'),'disposition':_0xd22e('0x11'),'closed':!![],'closedAt':moment()[_0xd22e('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0xd22e('0x13')](_0x314e22||[],'id')}});}})[_0xd22e('0xa')](function(_0x40fc08){for(var _0x5de931=0x0;_0x5de931<_0x314e22['length'];_0x5de931++){io[_0xd22e('0x14')](_0xd22e('0x15'),{'id':_0x314e22[_0x5de931]['id'],'closed':!![]});}})[_0xd22e('0x16')](function(_0xb7961d){console[_0xd22e('0x17')](_0xb7961d);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb567=['ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','update','system','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','start','lodash','../../mysqldb','../../config/environment','defaults','redis','localhost','Setting','find','chatTimeout'];(function(_0x320896,_0x52c114){var _0x55a38d=function(_0x242609){while(--_0x242609){_0x320896['push'](_0x320896['shift']());}};_0x55a38d(++_0x52c114);}(_0xb567,0xdd));var _0x7b56=function(_0x287d33,_0x2aa176){_0x287d33=_0x287d33-0x0;var _0x505887=_0xb567[_0x287d33];return _0x505887;};'use strict';var _=require(_0x7b56('0x0'));var moment=require('moment');var Redis=require('ioredis');var db=require(_0x7b56('0x1'))['db'];var config=require(_0x7b56('0x2'));config['redis']=_[_0x7b56('0x3')](config[_0x7b56('0x4')],{'host':_0x7b56('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x125358=0x0;var _0x34adc2=[];return db[_0x7b56('0x6')][_0x7b56('0x7')]({'raw':!![],'attributes':['id',_0x7b56('0x8')],'where':{'id':0x1}})['then'](function(_0x48e218){_0x125358=_0x48e218[_0x7b56('0x8')];if(_0x125358){return db[_0x7b56('0x9')][_0x7b56('0xa')]({'raw':!![],'attributes':['id',_0x7b56('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x7b56('0xc')](_0x48e218['chatTimeout'],_0x7b56('0xd'))}}});}else{return[];}})[_0x7b56('0xe')](function(_0x28695e){_0x34adc2=_0x28695e;if(_0x125358){return db['ChatInteraction'][_0x7b56('0xf')]({'closeReason':_0x7b56('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x7b56('0x11'))},{'where':{'id':_['map'](_0x34adc2||[],'id')}});}})[_0x7b56('0xe')](function(_0x3b1093){for(var _0x55ce9b=0x0;_0x55ce9b<_0x34adc2['length'];_0x55ce9b++){io[_0x7b56('0x12')](_0x7b56('0x13'),{'id':_0x34adc2[_0x55ce9b]['id'],'closed':!![]});}})[_0x7b56('0x14')](function(_0x4ee641){console[_0x7b56('0x15')](_0x4ee641);});}exports[_0x7b56('0x16')]=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 c493e0b..c07e6ea 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 _0x107e=['Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','host','MailAccount','port','secure','authentication','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','text','stringify','sendIfEmpty','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','startAt','add','start','add\x20cron','endAt','update','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info'];(function(_0x3d13de,_0x45ec3a){var _0x5385da=function(_0x4355e7){while(--_0x4355e7){_0x3d13de['push'](_0x3d13de['shift']());}};_0x5385da(++_0x45ec3a);}(_0x107e,0xfb));var _0xe107=function(_0x582d6a,_0x501f14){_0x582d6a=_0x582d6a-0x0;var _0x1837eb=_0x107e[_0x582d6a];return _0x1837eb;};'use strict';var fs=require('fs');var util=require(_0xe107('0x0'));var path=require(_0xe107('0x1'));var _=require(_0xe107('0x2'));var moment=require(_0xe107('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe107('0x4'));var BPromise=require(_0xe107('0x5'));var logger=require(_0xe107('0x6'))(_0xe107('0x7'));var db=require(_0xe107('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xe107('0x9'));var client=jayson[_0xe107('0xa')][_0xe107('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x444e32,_0x16a1f8){return function(){logger[_0xe107('0xc')](_0xe107('0xd'),_0x444e32[_0xe107('0xe')]);var _0x56157f=!![];var _0x3703e1={'tls':{'rejectUnauthorized':![]}};if(_0x444e32['MailAccount'][_0xe107('0xf')][_0xe107('0x10')]){_0x3703e1[_0xe107('0x10')]=_0x444e32['MailAccount']['Smtp'][_0xe107('0x10')];}else{_0x3703e1[_0xe107('0x11')]=_0x444e32[_0xe107('0x12')][_0xe107('0xf')][_0xe107('0x11')];_0x3703e1[_0xe107('0x13')]=_0x444e32['MailAccount'][_0xe107('0xf')][_0xe107('0x13')];_0x3703e1['secure']=_0x444e32[_0xe107('0x12')][_0xe107('0xf')][_0xe107('0x14')];}if(_0x444e32[_0xe107('0x12')][_0xe107('0xf')][_0xe107('0x15')]){_0x3703e1['auth']={'user':_0x444e32[_0xe107('0x12')][_0xe107('0xf')][_0xe107('0x16')],'pass':_0x444e32[_0xe107('0x12')]['Smtp'][_0xe107('0x17')]};}var _0x1b82e7={'account':_0x3703e1,'message':{'from':util[_0xe107('0x18')](_0xe107('0x19'),_0x444e32['MailAccount'][_0xe107('0x1a')],_0x444e32[_0xe107('0x12')][_0xe107('0xe')]||_0x444e32['MailAccount'][_0xe107('0xf')][_0xe107('0x16')]),'to':_0x444e32[_0xe107('0xe')],'cc':_0x444e32['cc'],'bcc':_0x444e32[_0xe107('0x1b')],'subject':util[_0xe107('0x18')](_0xe107('0x1c'),_0x16a1f8['name'],_0x444e32[_0xe107('0x1d')],_0x444e32[_0xe107('0x1e')])}};var _0x5ce7e8=path[_0xe107('0x1f')](__dirname,'../../files/reports');var _0x4cd2d0=_0x16a1f8[_0xe107('0x20')];var _0x20c885=util['format'](_0xe107('0x21'),path[_0xe107('0x22')](_0x16a1f8[_0xe107('0x20')],path[_0xe107('0x23')](_0x16a1f8[_0xe107('0x20')])),_0xe107('0x24'));var _0x417cec=path[_0xe107('0x1f')](_0x5ce7e8,_0x4cd2d0);var _0x4261c2=path[_0xe107('0x1f')](_0x5ce7e8,_0x20c885);if(fs[_0xe107('0x25')](_0x417cec)){_0x16a1f8['status']=_0xe107('0x26');_0x1b82e7[_0xe107('0x27')]['attachments']=[{'filename':_0x4cd2d0,'path':_0x417cec}];_0x1b82e7['message'][_0xe107('0x28')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xe107('0x29')](_0x16a1f8,null,0x2));}else if(fs[_0xe107('0x25')](_0x4261c2)){_0x16a1f8['status']=_0xe107('0x26');_0x1b82e7[_0xe107('0x27')]['attachments']=[{'filename':_0x20c885,'path':_0x4261c2}];}else{_0x1b82e7['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x444e32[_0xe107('0x2a')]){_0x56157f=![];logger[_0xe107('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x56157f){return client[_0xe107('0x2b')]('SendMail',_0x1b82e7)[_0xe107('0x2c')](function(_0x5525ab){if(_0x5525ab[_0xe107('0x2d')]){return logger['error'](_0xe107('0x2e'),JSON[_0xe107('0x29')](_0x5525ab));}return logger['info'](_0xe107('0x2f'));})[_0xe107('0x30')](function(_0x5845f1){return logger[_0xe107('0x2d')]('error\x20mail',JSON[_0xe107('0x29')](_0x5845f1));});}};}function handleError(){return function(_0x25a68f){return logger[_0xe107('0x2d')](JSON[_0xe107('0x29')](_0x25a68f));};}function handleResult(_0x5f4d46){return function(_0x528a50){logger[_0xe107('0xc')](_0xe107('0x31'),JSON[_0xe107('0x29')](_0x528a50));if(_0x5f4d46[_0xe107('0x12')]&&_0x5f4d46['MailAccount'][_0xe107('0xf')]&&!_[_0xe107('0x32')](_0x5f4d46[_0xe107('0xe')])){setTimeout(handleSendEmail(_0x5f4d46,_0x528a50),0x3c*0x3e8);}};}function handleJob(_0x47e1ad){return function(){try{if(_['isNil'](_0x47e1ad[_0xe107('0x1d')])){return logger[_0xe107('0xc')](_0xe107('0x33'));}if(_['isNil'](_0x47e1ad['subtractUnit'])){return logger['info'](_0xe107('0x34'));}var _0x4e6afb={'startDate':moment()[_0xe107('0x35')](_0x47e1ad['subtractNumber'],_0x47e1ad[_0xe107('0x1e')])[_0xe107('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xe107('0x18')](_0xe107('0x36')),'type':_0xe107('0x37'),'output':_0x47e1ad[_0xe107('0x38')],'name':_0x47e1ad[_0xe107('0x1a')]};if(!_[_0xe107('0x32')](_0x47e1ad[_0xe107('0x39')])){logger[_0xe107('0xc')](_0xe107('0x3a'),_0x47e1ad[_0xe107('0x39')]);return analyticDefaultReportController[_0xe107('0x3b')]({'id':_0x47e1ad[_0xe107('0x39')]},_0x4e6afb)[_0xe107('0x2c')](handleResult(_0x47e1ad))[_0xe107('0x30')](handleError());}if(!_['isNil'](_0x47e1ad[_0xe107('0x3c')])){logger[_0xe107('0xc')](_0xe107('0x3d'),_0x47e1ad[_0xe107('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x47e1ad['CustomReportId']},_0x4e6afb)['then'](handleResult(_0x47e1ad))[_0xe107('0x30')](handleError());}}catch(_0x4e562f){logger[_0xe107('0x2d')](JSON['stringify'](_0x4e562f));}return logger[_0xe107('0xc')]('no\x20report\x20id');};}function getJobs(_0xb69ea){var _0x41fca3={};if(_0xb69ea){_0x41fca3['id']=_0xb69ea;}return db[_0xe107('0x3e')]['findAll']({'where':_0x41fca3,'include':[{'model':db['MailAccount'],'attributes':['id',_0xe107('0x1a'),_0xe107('0xe')],'include':[{'model':db[_0xe107('0x3f')],'as':_0xe107('0xf')}]}]})[_0xe107('0x2c')](function(_0x121b69){var _0x486056=_[_0xe107('0x40')](manager['jobs']);var _0x31a9ab=_[_0xe107('0x41')](_0x121b69,function(_0xb15b31){return _0xb15b31['id'][_0xe107('0x42')]();});var _0x4c5943=_[_0xe107('0x43')](_0x121b69,function(_0x3e832b){return _0x3e832b['id'][_0xe107('0x42')]();});var _0x16777e=_0xb69ea?_0x31a9ab:_[_0xe107('0x44')](_0x31a9ab,_0x486056);var _0x353b62=_[_0xe107('0x45')](_0x31a9ab,_0x486056);var _0x5c9f03=_[_0xe107('0x44')](_0x486056,_0x31a9ab);var _0x277b9c;var _0x3df9ca;for(_0x277b9c=0x0;_0x277b9c<_0x5c9f03[_0xe107('0x46')]&&!_0xb69ea;_0x277b9c+=0x1){_0x3df9ca=_0x5c9f03[_0x277b9c][_0xe107('0x42')]();if(manager[_0xe107('0x47')](_0x3df9ca)){manager[_0xe107('0x48')](_0x3df9ca);manager[_0xe107('0x49')](_0x3df9ca);logger[_0xe107('0xc')](_0xe107('0x4a'),_0x3df9ca);}}logger[_0xe107('0xc')](_0xe107('0x4b'),JSON[_0xe107('0x29')](_0x16777e));for(_0x277b9c=0x0;_0x277b9c<_0x16777e[_0xe107('0x46')];_0x277b9c+=0x1){_0x3df9ca=_0x16777e[_0x277b9c]['toString']();logger['info'](_0xe107('0x4c'),_0x3df9ca);if(_0xb69ea){logger[_0xe107('0xc')](_0xe107('0x4d'),_0xb69ea);logger[_0xe107('0xc')](JSON[_0xe107('0x29')](_0x4c5943[_0x3df9ca]));BPromise[_0xe107('0x4e')]()[_0xe107('0x2c')](handleJob(_0x4c5943[_0x3df9ca]));logger['info'](_0xe107('0x4f'),_0x4c5943[_0x3df9ca]['name'],_0x4c5943[_0x3df9ca][_0xe107('0x50')]);}else if(_0x4c5943[_0x3df9ca]['cron']&&_0x4c5943[_0x3df9ca][_0xe107('0x51')]&&moment()['isBetween'](_0x4c5943[_0x3df9ca][_0xe107('0x52')],_0x4c5943[_0x3df9ca]['endAt'])){manager[_0xe107('0x53')](_0x3df9ca,_0x4c5943[_0x3df9ca][_0xe107('0x50')],handleJob(_0x4c5943[_0x3df9ca]));manager[_0xe107('0x54')](_0x3df9ca);logger[_0xe107('0xc')](_0xe107('0x55'),_0x4c5943[_0x3df9ca]['name'],_0x4c5943[_0x3df9ca]['cron']);}else if(manager[_0xe107('0x47')](_0x3df9ca)){manager[_0xe107('0x48')](_0x3df9ca);manager['deleteJob'](_0x3df9ca);logger[_0xe107('0xc')]('stop\x20cron',_0x4c5943[_0x3df9ca][_0xe107('0x1a')],_0x4c5943[_0x3df9ca][_0xe107('0x50')]);}}for(_0x277b9c=0x0,_0x3df9ca;_0x277b9c<_0x353b62[_0xe107('0x46')]&&!_0xb69ea;_0x277b9c+=0x1){_0x3df9ca=_0x353b62[_0x277b9c][_0xe107('0x42')]();if(manager[_0xe107('0x47')](_0x3df9ca)){if(_0x4c5943[_0x3df9ca][_0xe107('0x50')]&&_0x4c5943[_0x3df9ca][_0xe107('0x51')]&&moment()['isBetween'](_0x4c5943[_0x3df9ca][_0xe107('0x52')],_0x4c5943[_0x3df9ca][_0xe107('0x56')])){manager[_0xe107('0x57')](_0x3df9ca,_0x4c5943[_0x3df9ca][_0xe107('0x50')],handleJob(_0x4c5943[_0x3df9ca]));logger['info']('update\x20cron',_0x4c5943[_0x3df9ca][_0xe107('0x1a')],_0x4c5943[_0x3df9ca][_0xe107('0x50')]);}else{manager['stop'](_0x3df9ca);manager['deleteJob'](_0x3df9ca);logger[_0xe107('0xc')]('stop\x20cron',_0x4c5943[_0x3df9ca][_0xe107('0x1a')],_0x4c5943[_0x3df9ca][_0xe107('0x50')]);}}}})[_0xe107('0x30')](function(_0x50d5f2){logger[_0xe107('0x2d')](JSON['stringify'](_0x50d5f2));});}exports['run']=function(_0x1b0061){return getJobs(_0x1b0061);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf9ca=['Try\x20to\x20send\x20a\x20mail\x20to','service','host','MailAccount','Smtp','secure','authentication','user','format','\x22%s\x22\x20<%s>','email','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','join','%s.%s','savename','extname','zip','existsSync','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','info','SendMail','then','error','catch','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','active','update','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http'];(function(_0x31d28e,_0x48ff50){var _0x55d212=function(_0x256f1f){while(--_0x256f1f){_0x31d28e['push'](_0x31d28e['shift']());}};_0x55d212(++_0x48ff50);}(_0xf9ca,0x19c));var _0xaf9c=function(_0x4cbed8,_0x3d0137){_0x4cbed8=_0x4cbed8-0x0;var _0x42d210=_0xf9ca[_0x4cbed8];return _0x42d210;};'use strict';var fs=require('fs');var util=require(_0xaf9c('0x0'));var path=require(_0xaf9c('0x1'));var _=require(_0xaf9c('0x2'));var moment=require(_0xaf9c('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaf9c('0x4'));var BPromise=require(_0xaf9c('0x5'));var logger=require(_0xaf9c('0x6'))(_0xaf9c('0x7'));var db=require(_0xaf9c('0x8'))['db'];var analyticCustomReportController=require(_0xaf9c('0x9'));var analyticDefaultReportController=require(_0xaf9c('0xa'));var client=jayson[_0xaf9c('0xb')][_0xaf9c('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2b24ac,_0x3ecd41){return function(){logger['info'](_0xaf9c('0xd'),_0x2b24ac['email']);var _0x427e97=!![];var _0xb7324d={'tls':{'rejectUnauthorized':![]}};if(_0x2b24ac['MailAccount']['Smtp'][_0xaf9c('0xe')]){_0xb7324d[_0xaf9c('0xe')]=_0x2b24ac['MailAccount']['Smtp']['service'];}else{_0xb7324d[_0xaf9c('0xf')]=_0x2b24ac[_0xaf9c('0x10')][_0xaf9c('0x11')][_0xaf9c('0xf')];_0xb7324d['port']=_0x2b24ac['MailAccount'][_0xaf9c('0x11')]['port'];_0xb7324d['secure']=_0x2b24ac['MailAccount'][_0xaf9c('0x11')][_0xaf9c('0x12')];}if(_0x2b24ac[_0xaf9c('0x10')]['Smtp'][_0xaf9c('0x13')]){_0xb7324d['auth']={'user':_0x2b24ac[_0xaf9c('0x10')][_0xaf9c('0x11')][_0xaf9c('0x14')],'pass':_0x2b24ac['MailAccount'][_0xaf9c('0x11')]['pass']};}var _0x3e2049={'account':_0xb7324d,'message':{'from':util[_0xaf9c('0x15')](_0xaf9c('0x16'),_0x2b24ac[_0xaf9c('0x10')]['name'],_0x2b24ac['MailAccount'][_0xaf9c('0x17')]||_0x2b24ac[_0xaf9c('0x10')]['Smtp']['user']),'to':_0x2b24ac['email'],'cc':_0x2b24ac['cc'],'bcc':_0x2b24ac[_0xaf9c('0x18')],'subject':util[_0xaf9c('0x15')](_0xaf9c('0x19'),_0x3ecd41[_0xaf9c('0x1a')],_0x2b24ac[_0xaf9c('0x1b')],_0x2b24ac['subtractUnit'])}};var _0x395095=path[_0xaf9c('0x1c')](__dirname,'../../files/reports');var _0x2a5c64=_0x3ecd41['savename'];var _0x49326d=util[_0xaf9c('0x15')](_0xaf9c('0x1d'),path['basename'](_0x3ecd41[_0xaf9c('0x1e')],path[_0xaf9c('0x1f')](_0x3ecd41['savename'])),_0xaf9c('0x20'));var _0x98f129=path[_0xaf9c('0x1c')](_0x395095,_0x2a5c64);var _0x31985d=path[_0xaf9c('0x1c')](_0x395095,_0x49326d);if(fs[_0xaf9c('0x21')](_0x98f129)){_0x3ecd41['status']='Sent';_0x3e2049[_0xaf9c('0x22')][_0xaf9c('0x23')]=[{'filename':_0x2a5c64,'path':_0x98f129}];_0x3e2049[_0xaf9c('0x22')]['text']=util[_0xaf9c('0x15')](_0xaf9c('0x24'),JSON[_0xaf9c('0x25')](_0x3ecd41,null,0x2));}else if(fs[_0xaf9c('0x21')](_0x31985d)){_0x3ecd41['status']='Sent';_0x3e2049[_0xaf9c('0x22')][_0xaf9c('0x23')]=[{'filename':_0x49326d,'path':_0x31985d}];}else{_0x3e2049[_0xaf9c('0x22')]['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2b24ac['sendIfEmpty']){_0x427e97=![];logger[_0xaf9c('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x427e97){return client['request'](_0xaf9c('0x27'),_0x3e2049)[_0xaf9c('0x28')](function(_0x3bebbc){if(_0x3bebbc['error']){return logger[_0xaf9c('0x29')]('error\x20mail',JSON[_0xaf9c('0x25')](_0x3bebbc));}return logger[_0xaf9c('0x26')]('email\x20sent');})[_0xaf9c('0x2a')](function(_0x27b0fa){return logger[_0xaf9c('0x29')](_0xaf9c('0x2b'),JSON['stringify'](_0x27b0fa));});}};}function handleError(){return function(_0x33d542){return logger['error'](JSON['stringify'](_0x33d542));};}function handleResult(_0x134796){return function(_0x5643c0){logger[_0xaf9c('0x26')]('data',JSON[_0xaf9c('0x25')](_0x5643c0));if(_0x134796[_0xaf9c('0x10')]&&_0x134796[_0xaf9c('0x10')][_0xaf9c('0x11')]&&!_[_0xaf9c('0x2c')](_0x134796[_0xaf9c('0x17')])){setTimeout(handleSendEmail(_0x134796,_0x5643c0),0x3c*0x3e8);}};}function handleJob(_0x231d36){return function(){try{if(_[_0xaf9c('0x2c')](_0x231d36[_0xaf9c('0x1b')])){return logger['info'](_0xaf9c('0x2d'));}if(_[_0xaf9c('0x2c')](_0x231d36['subtractUnit'])){return logger['info'](_0xaf9c('0x2e'));}var _0x3b9ed5={'startDate':moment()[_0xaf9c('0x2f')](_0x231d36[_0xaf9c('0x1b')],_0x231d36[_0xaf9c('0x30')])[_0xaf9c('0x15')](_0xaf9c('0x31')),'endDate':moment()[_0xaf9c('0x15')](_0xaf9c('0x31')),'type':_0xaf9c('0x32'),'output':_0x231d36[_0xaf9c('0x33')],'name':_0x231d36[_0xaf9c('0x1a')]};if(!_['isNil'](_0x231d36[_0xaf9c('0x34')])){logger[_0xaf9c('0x26')]('exec\x20defaul\x20report\x20id:%s',_0x231d36[_0xaf9c('0x34')]);return analyticDefaultReportController[_0xaf9c('0x35')]({'id':_0x231d36[_0xaf9c('0x34')]},_0x3b9ed5)[_0xaf9c('0x28')](handleResult(_0x231d36))[_0xaf9c('0x2a')](handleError());}if(!_[_0xaf9c('0x2c')](_0x231d36[_0xaf9c('0x36')])){logger[_0xaf9c('0x26')](_0xaf9c('0x37'),_0x231d36['CustomReportId']);return analyticCustomReportController[_0xaf9c('0x35')]({'id':_0x231d36[_0xaf9c('0x36')]},_0x3b9ed5)['then'](handleResult(_0x231d36))['catch'](handleError());}}catch(_0x3b3360){logger[_0xaf9c('0x29')](JSON[_0xaf9c('0x25')](_0x3b3360));}return logger[_0xaf9c('0x26')](_0xaf9c('0x38'));};}function getJobs(_0x36ab1b){var _0x12110e={};if(_0x36ab1b){_0x12110e['id']=_0x36ab1b;}return db['Schedule'][_0xaf9c('0x39')]({'where':_0x12110e,'include':[{'model':db[_0xaf9c('0x10')],'attributes':['id','name',_0xaf9c('0x17')],'include':[{'model':db[_0xaf9c('0x3a')],'as':_0xaf9c('0x11')}]}]})['then'](function(_0x278121){var _0x2dfddc=_[_0xaf9c('0x3b')](manager[_0xaf9c('0x3c')]);var _0x356bef=_[_0xaf9c('0x3d')](_0x278121,function(_0x159937){return _0x159937['id'][_0xaf9c('0x3e')]();});var _0x137d5f=_[_0xaf9c('0x3f')](_0x278121,function(_0x8180ad){return _0x8180ad['id']['toString']();});var _0xbc45bb=_0x36ab1b?_0x356bef:_[_0xaf9c('0x40')](_0x356bef,_0x2dfddc);var _0x1dc1a1=_[_0xaf9c('0x41')](_0x356bef,_0x2dfddc);var _0x4e10c1=_['difference'](_0x2dfddc,_0x356bef);var _0x38c68d;var _0x372e1a;for(_0x38c68d=0x0;_0x38c68d<_0x4e10c1[_0xaf9c('0x42')]&&!_0x36ab1b;_0x38c68d+=0x1){_0x372e1a=_0x4e10c1[_0x38c68d]['toString']();if(manager[_0xaf9c('0x43')](_0x372e1a)){manager[_0xaf9c('0x44')](_0x372e1a);manager[_0xaf9c('0x45')](_0x372e1a);logger[_0xaf9c('0x26')](_0xaf9c('0x46'),_0x372e1a);}}logger[_0xaf9c('0x26')](_0xaf9c('0x47'),JSON[_0xaf9c('0x25')](_0xbc45bb));for(_0x38c68d=0x0;_0x38c68d<_0xbc45bb[_0xaf9c('0x42')];_0x38c68d+=0x1){_0x372e1a=_0xbc45bb[_0x38c68d]['toString']();logger[_0xaf9c('0x26')]('index',_0x372e1a);if(_0x36ab1b){logger['info'](_0xaf9c('0x48'),_0x36ab1b);logger['info'](JSON[_0xaf9c('0x25')](_0x137d5f[_0x372e1a]));BPromise[_0xaf9c('0x49')]()[_0xaf9c('0x28')](handleJob(_0x137d5f[_0x372e1a]));logger[_0xaf9c('0x26')](_0xaf9c('0x4a'),_0x137d5f[_0x372e1a]['name'],_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]);}else if(_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]&&_0x137d5f[_0x372e1a]['active']&&moment()[_0xaf9c('0x4c')](_0x137d5f[_0x372e1a][_0xaf9c('0x4d')],_0x137d5f[_0x372e1a][_0xaf9c('0x4e')])){manager['add'](_0x372e1a,_0x137d5f[_0x372e1a][_0xaf9c('0x4b')],handleJob(_0x137d5f[_0x372e1a]));manager[_0xaf9c('0x4f')](_0x372e1a);logger[_0xaf9c('0x26')](_0xaf9c('0x50'),_0x137d5f[_0x372e1a][_0xaf9c('0x1a')],_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]);}else if(manager['exists'](_0x372e1a)){manager[_0xaf9c('0x44')](_0x372e1a);manager[_0xaf9c('0x45')](_0x372e1a);logger['info'](_0xaf9c('0x51'),_0x137d5f[_0x372e1a]['name'],_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]);}}for(_0x38c68d=0x0,_0x372e1a;_0x38c68d<_0x1dc1a1['length']&&!_0x36ab1b;_0x38c68d+=0x1){_0x372e1a=_0x1dc1a1[_0x38c68d][_0xaf9c('0x3e')]();if(manager[_0xaf9c('0x43')](_0x372e1a)){if(_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]&&_0x137d5f[_0x372e1a][_0xaf9c('0x52')]&&moment()[_0xaf9c('0x4c')](_0x137d5f[_0x372e1a]['startAt'],_0x137d5f[_0x372e1a]['endAt'])){manager[_0xaf9c('0x53')](_0x372e1a,_0x137d5f[_0x372e1a][_0xaf9c('0x4b')],handleJob(_0x137d5f[_0x372e1a]));logger[_0xaf9c('0x26')]('update\x20cron',_0x137d5f[_0x372e1a][_0xaf9c('0x1a')],_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]);}else{manager[_0xaf9c('0x44')](_0x372e1a);manager[_0xaf9c('0x45')](_0x372e1a);logger['info'](_0xaf9c('0x51'),_0x137d5f[_0x372e1a][_0xaf9c('0x1a')],_0x137d5f[_0x372e1a][_0xaf9c('0x4b')]);}}}})['catch'](function(_0x394dd2){logger[_0xaf9c('0x29')](JSON['stringify'](_0x394dd2));});}exports[_0xaf9c('0x54')]=function(_0x5e0d55){return getJobs(_0x5e0d55);};exports[_0xaf9c('0x4f')]=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 fcba59a..3204ce1 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 _0xa8b1=['info','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','sentimentRegion','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','tempSentiment','sentiment','bucket','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','findOne','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','start','lodash','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment'];(function(_0xcd4d8e,_0x1fc2fd){var _0x1c3c61=function(_0x293f3c){while(--_0x293f3c){_0xcd4d8e['push'](_0xcd4d8e['shift']());}};_0x1c3c61(++_0x1fc2fd);}(_0xa8b1,0x19a));var _0x1a8b=function(_0x3e61b7,_0x583754){_0x3e61b7=_0x3e61b7-0x0;var _0x2481f0=_0xa8b1[_0x3e61b7];return _0x2481f0;};var _=require(_0x1a8b('0x0'));var AWS=require(_0x1a8b('0x1'));var rp=require(_0x1a8b('0x2'));var util=require(_0x1a8b('0x3'));var BPromise=require(_0x1a8b('0x4'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1a8b('0x5'));function getTranscriptionJob(_0x1671b8,_0x26755f,_0x512836,_0x2ef38d){return new Promise(function(_0x28cd8c,_0x111404){var _0xb1b8ff=new AWS[(_0x1a8b('0x6'))]({'accessKeyId':_0x26755f,'secretAccessKey':_0x1671b8,'region':_0x512836});_0xb1b8ff[_0x1a8b('0x7')]({'TranscriptionJobName':_0x2ef38d},function(_0x25ba6e,_0x217559){if(_0x25ba6e){return _0x111404(_0x25ba6e);}else{return _0x28cd8c(_0x217559);}});});}function sentiment(_0x3350fe,_0x25016f,_0x16a701,_0x512dd6,_0x1ae673){return new Promise(function(_0x284945,_0x2b7f29){var _0x44c6d2=new AWS[(_0x1a8b('0x8'))]({'accessKeyId':_0x25016f,'secretAccessKey':_0x3350fe,'region':_0x16a701});_0x44c6d2[_0x1a8b('0x9')]({'Text':_0x512dd6,'LanguageCode':_0x1ae673['substring'](0x0,0x2)},function(_0x53df3d,_0x35b7db){if(_0x53df3d){return _0x2b7f29(_0x53df3d);}else{return _0x284945(_0x35b7db);}});});}function checkTranscribeJob(_0x500a5f,_0x9e844f,_0x44b418){var _0x3ff114;return new BPromise(function(_0x19b9c9,_0x383dba){logger[_0x1a8b('0xa')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x500a5f['id'],_0x500a5f[_0x1a8b('0xb')]));return getTranscriptionJob(_0x44b418['data1'],_0x44b418[_0x1a8b('0xc')],_0x9e844f['transcribeRegion'],_0x500a5f['transcribeName'])[_0x1a8b('0xd')](function(_0x3c0da9){logger['info'](util['format'](_0x1a8b('0xe'),_0x500a5f['id'],_0x500a5f[_0x1a8b('0xb')],_0x3c0da9[_0x1a8b('0xf')]['TranscriptionJobStatus']));if(!_0x500a5f['fileText']){switch(_0x3c0da9[_0x1a8b('0xf')][_0x1a8b('0x10')]){case _0x1a8b('0x11'):var _0x1ba8b9={'transcribeStatus':_0x3c0da9['TranscriptionJob'][_0x1a8b('0x10')],'fileUri':_0x3c0da9[_0x1a8b('0xf')][_0x1a8b('0x12')][_0x1a8b('0x13')]};logger['info'](util[_0x1a8b('0x14')](_0x1a8b('0x15'),_0x500a5f['id']));return rp({'uri':_0x3c0da9[_0x1a8b('0xf')][_0x1a8b('0x12')][_0x1a8b('0x13')],'json':!![]})[_0x1a8b('0xd')](function(_0x38efb0){logger[_0x1a8b('0xa')](util[_0x1a8b('0x14')](_0x1a8b('0x16'),_0x500a5f['id']));if(_0x38efb0&&_0x38efb0[_0x1a8b('0x17')]&&_0x38efb0[_0x1a8b('0x17')]['transcripts']&&_0x38efb0['results'][_0x1a8b('0x18')][_0x1a8b('0x19')]){_0x1ba8b9[_0x1a8b('0x1a')]='';for(var _0x2d7927=0x0;_0x2d7927<_0x38efb0[_0x1a8b('0x17')][_0x1a8b('0x18')][_0x1a8b('0x19')];_0x2d7927++){_0x1ba8b9[_0x1a8b('0x1a')]+=_0x38efb0[_0x1a8b('0x17')][_0x1a8b('0x18')][_0x2d7927][_0x1a8b('0x1b')]+'';}}return _0x500a5f[_0x1a8b('0x1c')](_0x1ba8b9);})[_0x1a8b('0xd')](function(){logger[_0x1a8b('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500a5f['id']));if(!_0x500a5f['tempSentiment']){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x1f'));}if(!_0x9e844f['sentiment']||!_0x9e844f[_0x1a8b('0x20')]||!_0x9e844f['sentimentRegion']||!_0x9e844f[_0x1a8b('0x21')]||!_0x9e844f['bucket']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x1ba8b9[_0x1a8b('0x1a')]){throw new Error(_0x1a8b('0x22'));}if(_0x9e844f['sentimentAccountId']===_0x44b418['id']){return _0x44b418;}else{return db[_0x1a8b('0x23')]['findOne']({'where':{'id':_settings[_0x1a8b('0x20')]}});}})['then'](function(_0x2ca8f2){if(!_0x2ca8f2){throw new db[(_0x1a8b('0x1d'))]['ValidationError'](_0x1a8b('0x24'));}if(!_0x2ca8f2[_0x1a8b('0x25')]||!_0x2ca8f2[_0x1a8b('0xc')]){throw new db['Sequelize']['ValidationError'](_0x1a8b('0x26'));}_0x3ff114=_0x2ca8f2;logger[_0x1a8b('0xa')](util[_0x1a8b('0x14')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x500a5f['id']));return sentiment(_0x3ff114[_0x1a8b('0x25')],_0x3ff114['data2'],_0x9e844f[_0x1a8b('0x27')],_0x1ba8b9[_0x1a8b('0x1a')],_0x9e844f[_0x1a8b('0x21')]);})[_0x1a8b('0xd')](function(_0x4d48cc){logger[_0x1a8b('0xa')](util[_0x1a8b('0x14')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x500a5f['id']));return _0x500a5f[_0x1a8b('0x1c')]({'sentiment':_0x4d48cc[_0x1a8b('0x28')],'sPositive':_0x4d48cc[_0x1a8b('0x29')][_0x1a8b('0x2a')],'sNegative':_0x4d48cc[_0x1a8b('0x29')][_0x1a8b('0x2b')],'sMixed':_0x4d48cc[_0x1a8b('0x29')][_0x1a8b('0x2c')],'sNeutral':_0x4d48cc[_0x1a8b('0x29')][_0x1a8b('0x2d')]});})[_0x1a8b('0xd')](function(){logger[_0x1a8b('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500a5f['id']));_0x19b9c9();});case'FAILED':return _0x500a5f[_0x1a8b('0x1c')]({'transcribeStatus':_0x1a8b('0x2e'),'failureReason':_0x3c0da9[_0x1a8b('0xf')]['FailureReason']})[_0x1a8b('0xd')](function(){logger[_0x1a8b('0xa')](util[_0x1a8b('0x14')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500a5f['id']));_0x19b9c9();});default:logger[_0x1a8b('0xa')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x500a5f['id']));break;}}else{return BPromise['resolve']()[_0x1a8b('0xd')](function(){if(!_0x500a5f[_0x1a8b('0x2f')]){throw new db['Sequelize'][(_0x1a8b('0x1e'))](_0x1a8b('0x1f'));}if(!_0x9e844f[_0x1a8b('0x30')]||!_0x9e844f[_0x1a8b('0x20')]||!_0x9e844f[_0x1a8b('0x27')]||!_0x9e844f[_0x1a8b('0x21')]||!_0x9e844f[_0x1a8b('0x31')]){throw new db[(_0x1a8b('0x1d'))]['ValidationError'](_0x1a8b('0x32'));}if(!_0x500a5f['fileText']){throw new Error(_0x1a8b('0x22'));}if(_0x9e844f[_0x1a8b('0x20')]===_0x44b418['id']){return _0x44b418;}else{return db[_0x1a8b('0x23')]['findOne']({'where':{'id':_settings[_0x1a8b('0x20')]}});}})[_0x1a8b('0xd')](function(_0x25760f){if(!_0x25760f){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x25760f[_0x1a8b('0x25')]||!_0x25760f[_0x1a8b('0xc')]){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x26'));}_0x3ff114=_0x25760f;logger[_0x1a8b('0xa')](util['format'](_0x1a8b('0x33'),_0x500a5f['id']));return sentiment(_0x3ff114['data1'],_0x3ff114['data2'],_0x9e844f[_0x1a8b('0x27')],_0x500a5f[_0x1a8b('0x1a')],_0x9e844f['language']);})[_0x1a8b('0xd')](function(_0x12ac7b){logger[_0x1a8b('0xa')](util[_0x1a8b('0x14')](_0x1a8b('0x34'),_0x500a5f['id']));return _0x500a5f[_0x1a8b('0x1c')]({'sentiment':_0x12ac7b[_0x1a8b('0x28')],'sPositive':_0x12ac7b[_0x1a8b('0x29')][_0x1a8b('0x2a')],'sNegative':_0x12ac7b[_0x1a8b('0x29')]['Negative'],'sMixed':_0x12ac7b[_0x1a8b('0x29')][_0x1a8b('0x2c')],'sNeutral':_0x12ac7b[_0x1a8b('0x29')][_0x1a8b('0x2d')],'transcribeStatus':_0x1a8b('0x11')});})[_0x1a8b('0xd')](function(){logger[_0x1a8b('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x500a5f['id']));_0x19b9c9();});}})[_0x1a8b('0x35')](function(_0x3a89bb){if(_0x3a89bb){if(!_0x3a89bb[_0x1a8b('0x36')]||_0x3a89bb[_0x1a8b('0x36')]!==_0x1a8b('0x37')){logger[_0x1a8b('0x38')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x500a5f['id']),util[_0x1a8b('0x39')](_0x3a89bb,{'showHidden':![],'depth':null}));}}_0x19b9c9();});});}function checkTranscribe(){var _0x1b8052;var _0x2d843b;var _0x52cfa7;return db[_0x1a8b('0x3a')][_0x1a8b('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x1a8b('0xd')](function(_0x106222){if(!_0x106222||!_0x106222['length']){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x3c'));}_0x1b8052=_0x106222;return db[_0x1a8b('0x3d')][_0x1a8b('0x3e')]({'where':{'id':0x1}});})[_0x1a8b('0xd')](function(_0x1766ed){if(!_0x1766ed){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x3f'));}_0x2d843b=_0x1766ed;if(!_0x2d843b[_0x1a8b('0x5')]||!_0x2d843b[_0x1a8b('0x40')]||!_0x2d843b[_0x1a8b('0x41')]||!_0x2d843b[_0x1a8b('0x21')]||!_0x2d843b[_0x1a8b('0x31')]){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x42'));}return db[_0x1a8b('0x23')][_0x1a8b('0x3e')]({'where':{'id':_0x2d843b[_0x1a8b('0x40')]}});})['then'](function(_0x3fa479){if(!_0x3fa479){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x24'));}if(!_0x3fa479[_0x1a8b('0x25')]||!_0x3fa479['data2']){throw new db[(_0x1a8b('0x1d'))][(_0x1a8b('0x1e'))](_0x1a8b('0x26'));}_0x52cfa7=_0x3fa479;var _0xe85f0b=[];_0x1b8052['forEach'](function(_0x4fd9b4){_0xe85f0b[_0x1a8b('0x43')](checkTranscribeJob(_0x4fd9b4,_0x2d843b,_0x52cfa7));});return BPromise[_0x1a8b('0x44')](_0xe85f0b);})[_0x1a8b('0x35')](function(_0x5d8713){if(_0x5d8713){if(!_0x5d8713['name']||_0x5d8713[_0x1a8b('0x36')]!==_0x1a8b('0x37')){logger[_0x1a8b('0x38')](util[_0x1a8b('0x39')](_0x5d8713,{'showHidden':![],'depth':null}));}}});}exports[_0x1a8b('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7f30=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','transcribeName','then','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript'];(function(_0x1e38d0,_0x34cba4){var _0x16e5ea=function(_0x3f56c1){while(--_0x3f56c1){_0x1e38d0['push'](_0x1e38d0['shift']());}};_0x16e5ea(++_0x34cba4);}(_0x7f30,0x78));var _0x07f3=function(_0x442d86,_0x54b329){_0x442d86=_0x442d86-0x0;var _0x573f8d=_0x7f30[_0x442d86];return _0x573f8d;};var _=require(_0x07f3('0x0'));var AWS=require(_0x07f3('0x1'));var rp=require(_0x07f3('0x2'));var util=require(_0x07f3('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x07f3('0x4'))(_0x07f3('0x5'));function getTranscriptionJob(_0x59bd78,_0x496c78,_0x4b12b6,_0x5e8a49){return new Promise(function(_0x58e7ea,_0x4b6aed){var _0x57a22d=new AWS[(_0x07f3('0x6'))]({'accessKeyId':_0x496c78,'secretAccessKey':_0x59bd78,'region':_0x4b12b6});_0x57a22d[_0x07f3('0x7')]({'TranscriptionJobName':_0x5e8a49},function(_0x5e5e14,_0x210f85){if(_0x5e5e14){return _0x4b6aed(_0x5e5e14);}else{return _0x58e7ea(_0x210f85);}});});}function sentiment(_0x5c12cc,_0x15bb95,_0x2bdef5,_0x51c7fc,_0xa1c26a){return new Promise(function(_0x44e006,_0xc79e80){var _0x276ef7=new AWS[(_0x07f3('0x8'))]({'accessKeyId':_0x15bb95,'secretAccessKey':_0x5c12cc,'region':_0x2bdef5});_0x276ef7[_0x07f3('0x9')]({'Text':_0x51c7fc,'LanguageCode':_0xa1c26a[_0x07f3('0xa')](0x0,0x2)},function(_0x315b75,_0x2d8d31){if(_0x315b75){return _0xc79e80(_0x315b75);}else{return _0x44e006(_0x2d8d31);}});});}function checkTranscribeJob(_0x831302,_0x24b5d3,_0x146285){var _0x1d8cfc;return new BPromise(function(_0x2b1481,_0x379c09){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0xd'),_0x831302['id'],_0x831302['transcribeName']));return getTranscriptionJob(_0x146285['data1'],_0x146285[_0x07f3('0xe')],_0x24b5d3[_0x07f3('0xf')],_0x831302[_0x07f3('0x10')])[_0x07f3('0x11')](function(_0x134802){logger[_0x07f3('0xb')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x831302['id'],_0x831302['transcribeName'],_0x134802[_0x07f3('0x12')]['TranscriptionJobStatus']));if(!_0x831302[_0x07f3('0x13')]){switch(_0x134802['TranscriptionJob'][_0x07f3('0x14')]){case _0x07f3('0x15'):var _0x1b34ec={'transcribeStatus':_0x134802[_0x07f3('0x12')][_0x07f3('0x14')],'fileUri':_0x134802['TranscriptionJob'][_0x07f3('0x16')][_0x07f3('0x17')]};logger['info'](util[_0x07f3('0xc')](_0x07f3('0x18'),_0x831302['id']));return rp({'uri':_0x134802[_0x07f3('0x12')][_0x07f3('0x16')][_0x07f3('0x17')],'json':!![]})[_0x07f3('0x11')](function(_0x3fca84){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x19'),_0x831302['id']));if(_0x3fca84&&_0x3fca84[_0x07f3('0x1a')]&&_0x3fca84[_0x07f3('0x1a')][_0x07f3('0x1b')]&&_0x3fca84[_0x07f3('0x1a')][_0x07f3('0x1b')][_0x07f3('0x1c')]){_0x1b34ec['fileText']='';for(var _0x3c1713=0x0;_0x3c1713<_0x3fca84[_0x07f3('0x1a')]['transcripts'][_0x07f3('0x1c')];_0x3c1713++){_0x1b34ec[_0x07f3('0x13')]+=_0x3fca84[_0x07f3('0x1a')][_0x07f3('0x1b')][_0x3c1713][_0x07f3('0x1d')]+'';}}return _0x831302[_0x07f3('0x1e')](_0x1b34ec);})[_0x07f3('0x11')](function(){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x1f'),_0x831302['id']));if(!_0x831302[_0x07f3('0x20')]){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x23'));}if(!_0x24b5d3[_0x07f3('0x24')]||!_0x24b5d3['sentimentAccountId']||!_0x24b5d3[_0x07f3('0x25')]||!_0x24b5d3[_0x07f3('0x26')]||!_0x24b5d3['bucket']){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x27'));}if(!_0x1b34ec[_0x07f3('0x13')]){throw new Error(_0x07f3('0x28'));}if(_0x24b5d3[_0x07f3('0x29')]===_0x146285['id']){return _0x146285;}else{return db['CloudProvider'][_0x07f3('0x2a')]({'where':{'id':_settings[_0x07f3('0x29')]}});}})[_0x07f3('0x11')](function(_0x45dd27){if(!_0x45dd27){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x2b'));}if(!_0x45dd27[_0x07f3('0x2c')]||!_0x45dd27['data2']){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x2d'));}_0x1d8cfc=_0x45dd27;logger['info'](util[_0x07f3('0xc')](_0x07f3('0x2e'),_0x831302['id']));return sentiment(_0x1d8cfc[_0x07f3('0x2c')],_0x1d8cfc[_0x07f3('0xe')],_0x24b5d3[_0x07f3('0x25')],_0x1b34ec[_0x07f3('0x13')],_0x24b5d3['language']);})['then'](function(_0x7b9cc6){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x2f'),_0x831302['id']));return _0x831302[_0x07f3('0x1e')]({'sentiment':_0x7b9cc6[_0x07f3('0x30')],'sPositive':_0x7b9cc6[_0x07f3('0x31')]['Positive'],'sNegative':_0x7b9cc6[_0x07f3('0x31')][_0x07f3('0x32')],'sMixed':_0x7b9cc6['SentimentScore'][_0x07f3('0x33')],'sNeutral':_0x7b9cc6['SentimentScore']['Neutral']});})['then'](function(){logger[_0x07f3('0xb')](util['format'](_0x07f3('0x1f'),_0x831302['id']));_0x2b1481();});case _0x07f3('0x34'):return _0x831302[_0x07f3('0x1e')]({'transcribeStatus':_0x07f3('0x34'),'failureReason':_0x134802[_0x07f3('0x12')][_0x07f3('0x35')]})[_0x07f3('0x11')](function(){logger['info'](util[_0x07f3('0xc')](_0x07f3('0x1f'),_0x831302['id']));_0x2b1481();});default:logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x36'),_0x831302['id']));break;}}else{return BPromise[_0x07f3('0x37')]()[_0x07f3('0x11')](function(){if(!_0x831302[_0x07f3('0x20')]){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x23'));}if(!_0x24b5d3[_0x07f3('0x24')]||!_0x24b5d3[_0x07f3('0x29')]||!_0x24b5d3[_0x07f3('0x25')]||!_0x24b5d3[_0x07f3('0x26')]||!_0x24b5d3['bucket']){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x27'));}if(!_0x831302[_0x07f3('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x24b5d3[_0x07f3('0x29')]===_0x146285['id']){return _0x146285;}else{return db[_0x07f3('0x38')]['findOne']({'where':{'id':_settings[_0x07f3('0x29')]}});}})[_0x07f3('0x11')](function(_0x19c5a2){if(!_0x19c5a2){throw new db['Sequelize']['ValidationError'](_0x07f3('0x2b'));}if(!_0x19c5a2[_0x07f3('0x2c')]||!_0x19c5a2[_0x07f3('0xe')]){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x2d'));}_0x1d8cfc=_0x19c5a2;logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x2e'),_0x831302['id']));return sentiment(_0x1d8cfc[_0x07f3('0x2c')],_0x1d8cfc[_0x07f3('0xe')],_0x24b5d3[_0x07f3('0x25')],_0x831302['fileText'],_0x24b5d3['language']);})[_0x07f3('0x11')](function(_0x2abec1){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x2f'),_0x831302['id']));return _0x831302['update']({'sentiment':_0x2abec1[_0x07f3('0x30')],'sPositive':_0x2abec1[_0x07f3('0x31')]['Positive'],'sNegative':_0x2abec1[_0x07f3('0x31')][_0x07f3('0x32')],'sMixed':_0x2abec1[_0x07f3('0x31')][_0x07f3('0x33')],'sNeutral':_0x2abec1[_0x07f3('0x31')]['Neutral'],'transcribeStatus':_0x07f3('0x15')});})[_0x07f3('0x11')](function(){logger[_0x07f3('0xb')](util[_0x07f3('0xc')](_0x07f3('0x1f'),_0x831302['id']));_0x2b1481();});}})[_0x07f3('0x39')](function(_0x418283){if(_0x418283){if(!_0x418283[_0x07f3('0x3a')]||_0x418283[_0x07f3('0x3a')]!==_0x07f3('0x3b')){logger[_0x07f3('0x3c')](util['format'](_0x07f3('0x3d'),_0x831302['id']),util[_0x07f3('0x3e')](_0x418283,{'showHidden':![],'depth':null}));}}_0x2b1481();});});}function checkTranscribe(){var _0x10b144;var _0x14084c;var _0x4b3378;return db[_0x07f3('0x3f')]['findAll']({'where':{'transcribeStatus':_0x07f3('0x40')}})[_0x07f3('0x11')](function(_0x3da390){if(!_0x3da390||!_0x3da390['length']){throw new db['Sequelize'][(_0x07f3('0x22'))](_0x07f3('0x41'));}_0x10b144=_0x3da390;return db[_0x07f3('0x42')][_0x07f3('0x2a')]({'where':{'id':0x1}});})[_0x07f3('0x11')](function(_0x3516ae){if(!_0x3516ae){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x43'));}_0x14084c=_0x3516ae;if(!_0x14084c['transcribe']||!_0x14084c[_0x07f3('0x44')]||!_0x14084c[_0x07f3('0xf')]||!_0x14084c['language']||!_0x14084c[_0x07f3('0x45')]){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x46'));}return db['CloudProvider'][_0x07f3('0x2a')]({'where':{'id':_0x14084c[_0x07f3('0x44')]}});})['then'](function(_0x5e5d10){if(!_0x5e5d10){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))](_0x07f3('0x2b'));}if(!_0x5e5d10[_0x07f3('0x2c')]||!_0x5e5d10[_0x07f3('0xe')]){throw new db[(_0x07f3('0x21'))][(_0x07f3('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x4b3378=_0x5e5d10;var _0x3c4504=[];_0x10b144[_0x07f3('0x47')](function(_0x2fb0df){_0x3c4504[_0x07f3('0x48')](checkTranscribeJob(_0x2fb0df,_0x14084c,_0x4b3378));});return BPromise[_0x07f3('0x49')](_0x3c4504);})[_0x07f3('0x39')](function(_0x573ce5){if(_0x573ce5){if(!_0x573ce5[_0x07f3('0x3a')]||_0x573ce5[_0x07f3('0x3a')]!==_0x07f3('0x3b')){logger[_0x07f3('0x3c')](util[_0x07f3('0x3e')](_0x573ce5,{'showHidden':![],'depth':null}));}}});}exports[_0x07f3('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 ee80f39..93f7df0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe0b7=['finished\x20populating','hopper1','contacts2','hopper2','catch','util','push','Innocenzo','Biondo','@xcally.com','now','CmContact','bulkCreate','then','log','contacts1','CmHopper','destroy'];(function(_0xb07954,_0x240991){var _0x342045=function(_0x20a75a){while(--_0x20a75a){_0xb07954['push'](_0xb07954['shift']());}};_0x342045(++_0x240991);}(_0xe0b7,0x1a3));var _0x7e0b=function(_0x12bfb3,_0x4eeed6){_0x12bfb3=_0x12bfb3-0x0;var _0x562c46=_0xe0b7[_0x12bfb3];return _0x562c46;};'use strict';var util=require(_0x7e0b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7e0b('0x1')]({'id':i,'firstName':_0x7e0b('0x2')+i,'lastName':_0x7e0b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7e0b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x7e0b('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7e0b('0x5')](),'updatedAt':Date[_0x7e0b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x7e0b('0x1')]({'id':i,'firstName':_0x7e0b('0x2')+i,'lastName':_0x7e0b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x7e0b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7e0b('0x1')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7e0b('0x5')](),'updatedAt':Date[_0x7e0b('0x5')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0x7e0b('0x6')][_0x7e0b('0x7')](contacts);})[_0x7e0b('0x8')](function(){console[_0x7e0b('0x9')]('finished\x20populating',_0x7e0b('0xa'));return db[_0x7e0b('0xb')][_0x7e0b('0xc')]({'where':{}});})[_0x7e0b('0x8')](function(){return db[_0x7e0b('0xb')][_0x7e0b('0x7')](hopper);})[_0x7e0b('0x8')](function(){console['log'](_0x7e0b('0xd'),_0x7e0b('0xe'));return db[_0x7e0b('0x6')]['bulkCreate'](contacts2);})[_0x7e0b('0x8')](function(){console[_0x7e0b('0x9')](_0x7e0b('0xd'),_0x7e0b('0xf'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x7e0b('0x8')](function(){console[_0x7e0b('0x9')]('finished\x20populating',_0x7e0b('0x10'));})[_0x7e0b('0x11')](function(_0x4429b5){console[_0x7e0b('0x9')](_0x4429b5);}); \ No newline at end of file +var _0x57f4=['CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','catch','Innocenzo','@xcally.com','push','now','Biondo'];(function(_0x55ead2,_0x3c4ab5){var _0x3e413a=function(_0x40f9e7){while(--_0x40f9e7){_0x55ead2['push'](_0x55ead2['shift']());}};_0x3e413a(++_0x3c4ab5);}(_0x57f4,0x1db));var _0x457f=function(_0x1a007d,_0x3257a9){_0x1a007d=_0x1a007d-0x0;var _0x19b9cc=_0x57f4[_0x1a007d];return _0x19b9cc;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x457f('0x0')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x457f('0x1')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x457f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x457f('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x457f('0x3')](),'updatedAt':Date[_0x457f('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x457f('0x2')]({'id':i,'firstName':_0x457f('0x0')+i,'lastName':_0x457f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x457f('0x1')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x457f('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x457f('0x3')]()});}db[_0x457f('0x5')][_0x457f('0x6')]({'where':{}})[_0x457f('0x7')](function(){return db[_0x457f('0x5')][_0x457f('0x8')](contacts);})[_0x457f('0x7')](function(){console[_0x457f('0x9')](_0x457f('0xa'),_0x457f('0xb'));return db[_0x457f('0xc')]['destroy']({'where':{}});})[_0x457f('0x7')](function(){return db[_0x457f('0xc')][_0x457f('0x8')](hopper);})[_0x457f('0x7')](function(){console[_0x457f('0x9')](_0x457f('0xa'),_0x457f('0xd'));return db[_0x457f('0x5')][_0x457f('0x8')](contacts2);})[_0x457f('0x7')](function(){console['log'](_0x457f('0xa'),'contacts2');return db[_0x457f('0xc')]['bulkCreate'](hopper2);})[_0x457f('0x7')](function(){console[_0x457f('0x9')](_0x457f('0xa'),'hopper2');})[_0x457f('0xe')](function(_0x423c56){console[_0x457f('0x9')](_0x423c56);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 957f183..85b7612 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x990b=['log','catch','util','../mysqldb','push','format','%s%s','agent','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then'];(function(_0x30e78d,_0x24dd48){var _0x9f29d8=function(_0x13337f){while(--_0x13337f){_0x30e78d['push'](_0x30e78d['shift']());}};_0x9f29d8(++_0x24dd48);}(_0x990b,0x191));var _0xb990=function(_0x252847,_0x221f97){_0x252847=_0x252847-0x0;var _0x47abba=_0x990b[_0x252847];return _0x47abba;};'use strict';var util=require(_0xb990('0x0'));var db=require(_0xb990('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb990('0x2')]({'name':util[_0xb990('0x3')](_0xb990('0x4'),_0xb990('0x5'),i),'fullname':util[_0xb990('0x3')](_0xb990('0x4'),_0xb990('0x5'),i),'email':util[_0xb990('0x3')]('%s%s@xcally.com','agent',i),'role':_0xb990('0x5'),'password':_0xb990('0x6'),'internal':0xfa0+i,'type':_0xb990('0x7'),'transport':['udp','ws',_0xb990('0x8')],'disallow':[_0xb990('0x9')],'allow':[_0xb990('0xa')],'defaultuser':util[_0xb990('0x3')]('%s%s',_0xb990('0x5'),i),'encryption':_0xb990('0xb'),'avpf':'yes','force_avp':_0xb990('0xb'),'icesupport':_0xb990('0xb'),'dtlsenable':_0xb990('0xb'),'dtlsverify':'no','dtlscertfile':_0xb990('0xc'),'dtlsprivatekey':_0xb990('0xd'),'dtlssetup':_0xb990('0xe'),'callerid':util[_0xb990('0x3')]('\x22%s\x22\x20<%s>',util[_0xb990('0x3')](_0xb990('0x4'),_0xb990('0x5'),i),0xfa0+i)});}db['User'][_0xb990('0xf')](users)[_0xb990('0x10')](function(){console[_0xb990('0x11')]('add\x20user');})[_0xb990('0x12')](function(_0x7162c){console['log'](_0x7162c);}); \ No newline at end of file +var _0xb0ae=['agent','%s%s@xcally.com','password','friend','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','push','format','%s%s'];(function(_0x257551,_0x1ac436){var _0xfc2ee2=function(_0x4427a8){while(--_0x4427a8){_0x257551['push'](_0x257551['shift']());}};_0xfc2ee2(++_0x1ac436);}(_0xb0ae,0x73));var _0xeb0a=function(_0x47274f,_0x5ac950){_0x47274f=_0x47274f-0x0;var _0x4c093d=_0xb0ae[_0x47274f];return _0x4c093d;};'use strict';var util=require(_0xeb0a('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xeb0a('0x1')]({'name':util[_0xeb0a('0x2')](_0xeb0a('0x3'),'agent',i),'fullname':util[_0xeb0a('0x2')](_0xeb0a('0x3'),_0xeb0a('0x4'),i),'email':util[_0xeb0a('0x2')](_0xeb0a('0x5'),_0xeb0a('0x4'),i),'role':_0xeb0a('0x4'),'password':_0xeb0a('0x6'),'internal':0xfa0+i,'type':_0xeb0a('0x7'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':[_0xeb0a('0x8')],'defaultuser':util[_0xeb0a('0x2')]('%s%s','agent',i),'encryption':_0xeb0a('0x9'),'avpf':_0xeb0a('0x9'),'force_avp':_0xeb0a('0x9'),'icesupport':_0xeb0a('0x9'),'dtlsenable':_0xeb0a('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xeb0a('0xa'),'dtlssetup':'actpass','callerid':util[_0xeb0a('0x2')](_0xeb0a('0xb'),util[_0xeb0a('0x2')](_0xeb0a('0x3'),_0xeb0a('0x4'),i),0xfa0+i)});}db['User'][_0xeb0a('0xc')](users)[_0xeb0a('0xd')](function(){console[_0xeb0a('0xe')](_0xeb0a('0xf'));})[_0xeb0a('0x10')](function(_0xa89f0c){console[_0xeb0a('0xe')](_0xa89f0c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4d43a70..042a338 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2ac=['push','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueue','ChatQueue','SmsQueues','Telephones','IvrCampaigns','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','format','user:%s','handshake','query','User','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0xe2ac,0x1ab));var _0xce2a=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0xe2ac[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0xce2a('0x0'));var util=require('util');var BPromise=require(_0xce2a('0x1'));var db=require(_0xce2a('0x2'))['db'];var config=require(_0xce2a('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xce2a('0x4'),'model':db['User'],'attributes':['id',_0xce2a('0x5'),_0xce2a('0x6')],'raw':!![],'where':{'role':_0xce2a('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xce2a('0x5')],'where':{'role':_0xce2a('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xce2a('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0xce2a('0x5')],'where':{'role':_0xce2a('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xce2a('0x9')],'where':{'type':_0xce2a('0xa')}};function getAssociatedResources(_0x9a32df,_0x5e0525,_0x48b97e){return db[_0xce2a('0xb')][_0xce2a('0xc')]({'where':{'name':_0x9a32df,'userProfileId':_0x5e0525},'raw':!![]})[_0xce2a('0xd')](function(_0x169c6e){if(_0x169c6e){if(_0x169c6e['autoAssociation']){switch(_0x9a32df){case'VoiceQueues':case _0xce2a('0xe'):case _0xce2a('0xf'):case'SmsQueues':case _0xce2a('0x10'):case _0xce2a('0x11'):case _0xce2a('0x12'):return db[_0x48b97e][_0xce2a('0x13')](queryQueues);case'Telephones':return db[_0x48b97e][_0xce2a('0x13')](queryTelephones);case'Trunks':return db[_0x48b97e][_0xce2a('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x48b97e][_0xce2a('0x13')](queryCampaigns);}}else{return db[_0xce2a('0x14')][_0xce2a('0x13')]({'attributes':[_0xce2a('0x15')],'where':{'sectionId':_0x169c6e['id']},'raw':!![]})[_0xce2a('0xd')](function(_0x317106){if(_0x317106){var _0x360259={'where':{'id':_[_0xce2a('0x16')](_0x317106,_0xce2a('0x15'))},'raw':!![]};switch(_0x48b97e){case'User':_0x360259[_0xce2a('0x17')]['role']=_0xce2a('0x8');break;case _0xce2a('0x18'):_0x360259[_0xce2a('0x17')][_0xce2a('0x9')]='ivr';break;}return db[_0x48b97e]['findAll'](_0x360259);}else{return[];}});}}else{return[];}})[_0xce2a('0xd')](function(_0x467e38){return _0x467e38;});}function joinOrLeaveQueues(_0x5013fd,_0x3e556f,_0x366a7e,_0x50849b){_0x5013fd[_0x3e556f](util['format'](_0xce2a('0x19'),_0x366a7e,_0x50849b['name']));if(_0x50849b[_0xce2a('0x4')]){for(var _0x4b9062=0x0;_0x4b9062<_0x50849b[_0xce2a('0x4')][_0xce2a('0x1a')];_0x4b9062+=0x1){_0x5013fd[_0x3e556f](util[_0xce2a('0x1b')](_0xce2a('0x1c'),_0x50849b['Agents'][_0x4b9062][_0xce2a('0x5')]));}}}function joinOrLeave(_0x353991,_0x481640,_0xe59ef9){var _0x3d8ab1;if(_0x353991[_0xce2a('0x1d')][_0xce2a('0x1e')]['id']){db[_0xce2a('0x1f')][_0xce2a('0x20')]({'attributes':['id',_0xce2a('0x5'),'role',_0xce2a('0x21')],'where':{'id':_0x353991[_0xce2a('0x1d')]['query']['id']},'include':[{'model':db[_0xce2a('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xce2a('0x23')],'as':_0xce2a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xce2a('0x25')],'as':_0xce2a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xce2a('0x27')],'as':_0xce2a('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xce2a('0x29')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xce2a('0x2a')],'as':_0xce2a('0x2b'),'attributes':['id'],'raw':!![]}]})[_0xce2a('0xd')](function(_0x5ec66c){if(_0x5ec66c){_0x3d8ab1=_0x5ec66c;_0x353991[_0x481640](util[_0xce2a('0x1b')](_0xce2a('0x1c'),_0x5ec66c[_0xce2a('0x5')]));var _0x76e423=[];switch(_0x5ec66c['role']){case _0xce2a('0x2c'):_0x353991[_0x481640](_0xce2a('0x2d'));_0x353991[_0x481640](_0xce2a('0x2e'));if(queryQueues['hasOwnProperty'](_0xce2a('0x2f'))){delete queryQueues[_0xce2a('0x2f')];}_0x76e423['push'](db['VoiceQueue'][_0xce2a('0x13')](queryQueues));_0x76e423[_0xce2a('0x30')](db['ChatQueue'][_0xce2a('0x13')](queryQueues));_0x76e423[_0xce2a('0x30')](db['FaxQueue'][_0xce2a('0x13')](queryQueues));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x31')][_0xce2a('0x13')](queryQueues));_0x76e423['push'](db[_0xce2a('0x32')]['findAll'](queryQueues));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x33')][_0xce2a('0x13')](queryQueues));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x34')][_0xce2a('0x13')](queryQueues));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x1f')][_0xce2a('0x13')](queryTelephones));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x35')][_0xce2a('0x13')](queryTrunks));_0x76e423['push'](db[_0xce2a('0x18')][_0xce2a('0x13')](queryCampaigns));_0x76e423[_0xce2a('0x30')](db['User'][_0xce2a('0x13')](queryAgents));break;case _0xce2a('0x36'):_0x353991[_0x481640](_0xce2a('0x2d'));_0x353991[_0x481640](_0xce2a('0x2e'));_0x76e423[_0xce2a('0x30')](getAssociatedResources('VoiceQueues',_0x5ec66c[_0xce2a('0x21')],_0xce2a('0x37')));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0xe'),_0x5ec66c[_0xce2a('0x21')],_0xce2a('0x38')));_0x76e423['push'](getAssociatedResources(_0xce2a('0xf'),_0x5ec66c[_0xce2a('0x21')],'FaxQueue'));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x39'),_0x5ec66c[_0xce2a('0x21')],'SmsQueue'));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x10'),_0x5ec66c[_0xce2a('0x21')],'MailQueue'));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x11'),_0x5ec66c[_0xce2a('0x21')],_0xce2a('0x33')));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x12'),_0x5ec66c['userProfileId'],_0xce2a('0x34')));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x3a'),_0x5ec66c[_0xce2a('0x21')],_0xce2a('0x1f')));_0x76e423[_0xce2a('0x30')](getAssociatedResources('Trunks',_0x5ec66c[_0xce2a('0x21')],_0xce2a('0x35')));_0x76e423[_0xce2a('0x30')](getAssociatedResources(_0xce2a('0x3b'),_0x5ec66c['userProfileId'],_0xce2a('0x18')));_0x76e423[_0xce2a('0x30')](db[_0xce2a('0x1f')]['findAll'](queryAgents));break;case _0xce2a('0x7'):_0x353991[_0x481640](_0xce2a('0x2d'));_0x353991[_0x481640]('voice:outbound');_0x76e423[_0xce2a('0x30')](_0x5ec66c['getVoiceQueues']({'attributes':['id',_0xce2a('0x5')]}));_0x76e423[_0xce2a('0x30')](_0x5ec66c[_0xce2a('0x3c')]({'attributes':['id',_0xce2a('0x5')]}));_0x76e423['push'](_0x5ec66c['getFaxQueues']({'attributes':['id',_0xce2a('0x5')]}));_0x76e423['push'](_0x5ec66c[_0xce2a('0x3d')]({'attributes':['id',_0xce2a('0x5')]}));_0x76e423[_0xce2a('0x30')](_0x5ec66c['getMailQueues']({'attributes':['id','name']}));_0x76e423[_0xce2a('0x30')](_0x5ec66c[_0xce2a('0x3e')]({'attributes':['id',_0xce2a('0x5')]}));_0x76e423[_0xce2a('0x30')](_0x5ec66c[_0xce2a('0x3f')]({'attributes':['id',_0xce2a('0x5')]}));break;}return BPromise[_0xce2a('0x40')](_0x76e423);}})[_0xce2a('0xd')](function(_0x1bf5a4){if(_0x1bf5a4&&_0x1bf5a4[_0xce2a('0x1a')]){for(var _0x9c5698=0x0;_0x9c5698<_0x1bf5a4[_0xce2a('0x1a')];_0x9c5698+=0x1){for(var _0x24541f=0x0;_0x24541f<_0x1bf5a4[_0x9c5698][_0xce2a('0x1a')];_0x24541f+=0x1){switch(_0x9c5698){case 0x0:joinOrLeaveQueues(_0x353991,_0x481640,_0xce2a('0x41'),_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x1:joinOrLeaveQueues(_0x353991,_0x481640,'chat',_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x2:joinOrLeaveQueues(_0x353991,_0x481640,'fax',_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x3:joinOrLeaveQueues(_0x353991,_0x481640,_0xce2a('0x42'),_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x4:joinOrLeaveQueues(_0x353991,_0x481640,'mail',_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x5:joinOrLeaveQueues(_0x353991,_0x481640,_0xce2a('0x43'),_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x6:joinOrLeaveQueues(_0x353991,_0x481640,_0xce2a('0x44'),_0x1bf5a4[_0x9c5698][_0x24541f]);break;case 0x7:_0x353991[_0x481640](util[_0xce2a('0x1b')](_0xce2a('0x45'),_0x1bf5a4[_0x9c5698][_0x24541f][_0xce2a('0x5')]));break;case 0x8:_0x353991[_0x481640](util['format'](_0xce2a('0x46'),_0x1bf5a4[_0x9c5698][_0x24541f][_0xce2a('0x5')]));break;case 0x9:_0x353991[_0x481640](util['format']('campaign:%s:%s',_0x1bf5a4[_0x9c5698][_0x24541f][_0xce2a('0x9')],_0x1bf5a4[_0x9c5698][_0x24541f][_0xce2a('0x5')]));break;case 0xa:_0x353991[_0x481640](util[_0xce2a('0x1b')](_0xce2a('0x1c'),_0x1bf5a4[_0x9c5698][_0x24541f]['name']));break;}}}}})[_0xce2a('0xd')](function(){if(_0x481640===_0xce2a('0x47')){var _0x198f73=_[_0xce2a('0x16')](_0x3d8ab1[_0xce2a('0x48')],'id');return _0x3d8ab1[_0xce2a('0x49')](_0x198f73)['then'](function(){for(var _0x16d98f=0x0;_0x16d98f<_0x198f73[_0xce2a('0x1a')];_0x16d98f+=0x1){_0xe59ef9['emit'](_0xce2a('0x4a'),{'ChatInteractionId':Number(_0x198f73[_0x16d98f]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0xd')](function(){if(_0x481640===_0xce2a('0x47')){var _0x5c1020=_[_0xce2a('0x16')](_0x3d8ab1['MailInteractions'],'id');return _0x3d8ab1[_0xce2a('0x4b')](_0x5c1020)[_0xce2a('0xd')](function(){for(var _0x1382f9=0x0;_0x1382f9<_0x5c1020['length'];_0x1382f9+=0x1){_0xe59ef9[_0xce2a('0x4c')](_0xce2a('0x4d'),{'MailInteractionId':Number(_0x5c1020[_0x1382f9]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0xd')](function(){if(_0x481640===_0xce2a('0x47')){var _0x4f0011=_[_0xce2a('0x16')](_0x3d8ab1[_0xce2a('0x26')],'id');return _0x3d8ab1['removeFaxInteractions'](_0x4f0011)[_0xce2a('0xd')](function(){for(var _0xfe5b86=0x0;_0xfe5b86<_0x4f0011[_0xce2a('0x1a')];_0xfe5b86+=0x1){_0xe59ef9[_0xce2a('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4f0011[_0xfe5b86]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0xd')](function(){if(_0x481640==='leave'){var _0x286918=_[_0xce2a('0x16')](_0x3d8ab1['SmsInteractions'],'id');return _0x3d8ab1['removeSmsInteractions'](_0x286918)[_0xce2a('0xd')](function(){for(var _0x17a87f=0x0;_0x17a87f<_0x286918['length'];_0x17a87f+=0x1){_0xe59ef9['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x286918[_0x17a87f]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0xd')](function(){if(_0x481640===_0xce2a('0x47')){var _0x42ff92=_[_0xce2a('0x16')](_0x3d8ab1[_0xce2a('0x4e')],'id');return _0x3d8ab1[_0xce2a('0x4f')](_0x42ff92)[_0xce2a('0xd')](function(){for(var _0x3f166a=0x0;_0x3f166a<_0x42ff92[_0xce2a('0x1a')];_0x3f166a+=0x1){_0xe59ef9[_0xce2a('0x4c')](_0xce2a('0x50'),{'OpenchannelInteractionId':Number(_0x42ff92[_0x3f166a]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0xd')](function(){if(_0x481640==='leave'){var _0x1ebc2a=_[_0xce2a('0x16')](_0x3d8ab1[_0xce2a('0x2b')],'id');return _0x3d8ab1[_0xce2a('0x51')](_0x1ebc2a)[_0xce2a('0xd')](function(){for(var _0x467cb1=0x0;_0x467cb1<_0x1ebc2a[_0xce2a('0x1a')];_0x467cb1+=0x1){_0xe59ef9[_0xce2a('0x4c')](_0xce2a('0x52'),{'WhatsappInteractionId':Number(_0x1ebc2a[_0x467cb1]),'UserId':Number(_0x3d8ab1['id'])});}});}})[_0xce2a('0x53')](function(_0x472c6b){_0x353991[_0xce2a('0x54')](_0x472c6b);});}}function onDisconnect(_0xa118c2,_0x1f906e){joinOrLeave(_0xa118c2,'leave',_0x1f906e);}function onConnect(_0xfffc6e){joinOrLeave(_0xfffc6e,'join');}exports[_0xce2a('0x55')]=function(_0x54f708){_0x54f708['on'](_0xce2a('0x56'),function(_0x453f5a){_0x453f5a[_0xce2a('0x57')](0x0);_0x453f5a[_0xce2a('0x58')]=_0x453f5a['request'][_0xce2a('0x56')]['remoteAddress']+':'+_0x453f5a[_0xce2a('0x59')][_0xce2a('0x56')][_0xce2a('0x5a')];_0x453f5a[_0xce2a('0x5b')]=new Date();_0x453f5a['log']=function(_0x1387f7){console[_0xce2a('0x54')]('SocketIO\x20'+_0x453f5a[_0xce2a('0x5c')][_0xce2a('0x5')]+'['+_0x453f5a[_0xce2a('0x58')]+']',_0x1387f7);};_0x453f5a['on'](_0xce2a('0x5d'),function(){onDisconnect(_0x453f5a,_0x54f708);_0x453f5a[_0xce2a('0x54')]('DISCONNECTED');});onConnect(_0x453f5a);_0x453f5a['log'](_0xce2a('0x5e'));});}; \ No newline at end of file +var _0xe5e8=['default','connection','setMaxListeners','request','remoteAddress','remotePort','connectedAt','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','User','role','agent','name','type','ivr','UserProfileSection','findOne','then','autoAssociation','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','where','Campaign','format','%s:queue:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','VoiceQueues','ChatQueues','FaxQueue','Telephones','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','log','join'];(function(_0x2dd0fb,_0x53cc9f){var _0x1500b5=function(_0x51f036){while(--_0x51f036){_0x2dd0fb['push'](_0x2dd0fb['shift']());}};_0x1500b5(++_0x53cc9f);}(_0xe5e8,0x13b));var _0x8e5e=function(_0x166e9e,_0x4d93ea){_0x166e9e=_0x166e9e-0x0;var _0x2c1663=_0xe5e8[_0x166e9e];return _0x2c1663;};'use strict';var _=require(_0x8e5e('0x0'));var util=require('util');var BPromise=require(_0x8e5e('0x1'));var db=require(_0x8e5e('0x2'))['db'];var config=require(_0x8e5e('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x8e5e('0x4'),'model':db[_0x8e5e('0x5')],'attributes':['id','name',_0x8e5e('0x6')],'raw':!![],'where':{'role':_0x8e5e('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8e5e('0x8')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x8e5e('0x8')]};var queryAgents={'raw':!![],'attributes':['id',_0x8e5e('0x8')],'where':{'role':_0x8e5e('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8e5e('0x8'),_0x8e5e('0x9')],'where':{'type':_0x8e5e('0xa')}};function getAssociatedResources(_0x72bcbf,_0x2a4bd5,_0x16be90){return db[_0x8e5e('0xb')][_0x8e5e('0xc')]({'where':{'name':_0x72bcbf,'userProfileId':_0x2a4bd5},'raw':!![]})[_0x8e5e('0xd')](function(_0x5e0d26){if(_0x5e0d26){if(_0x5e0d26[_0x8e5e('0xe')]){switch(_0x72bcbf){case'VoiceQueues':case'ChatQueues':case _0x8e5e('0xf'):case _0x8e5e('0x10'):case'MailQueues':case _0x8e5e('0x11'):case _0x8e5e('0x12'):return db[_0x16be90][_0x8e5e('0x13')](queryQueues);case'Telephones':return db[_0x16be90][_0x8e5e('0x13')](queryTelephones);case _0x8e5e('0x14'):return db[_0x16be90][_0x8e5e('0x13')](queryTrunks);case _0x8e5e('0x15'):return db[_0x16be90][_0x8e5e('0x13')](queryCampaigns);}}else{return db[_0x8e5e('0x16')][_0x8e5e('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x5e0d26['id']},'raw':!![]})[_0x8e5e('0xd')](function(_0x60d25){if(_0x60d25){var _0x217c75={'where':{'id':_[_0x8e5e('0x17')](_0x60d25,_0x8e5e('0x18'))},'raw':!![]};switch(_0x16be90){case _0x8e5e('0x5'):_0x217c75[_0x8e5e('0x19')][_0x8e5e('0x6')]='telephone';break;case _0x8e5e('0x1a'):_0x217c75[_0x8e5e('0x19')]['type']='ivr';break;}return db[_0x16be90][_0x8e5e('0x13')](_0x217c75);}else{return[];}});}}else{return[];}})[_0x8e5e('0xd')](function(_0x2b1022){return _0x2b1022;});}function joinOrLeaveQueues(_0x5609b8,_0xe06fb5,_0xe41f40,_0x54dcb3){_0x5609b8[_0xe06fb5](util[_0x8e5e('0x1b')](_0x8e5e('0x1c'),_0xe41f40,_0x54dcb3['name']));if(_0x54dcb3[_0x8e5e('0x4')]){for(var _0x88cee2=0x0;_0x88cee2<_0x54dcb3[_0x8e5e('0x4')]['length'];_0x88cee2+=0x1){_0x5609b8[_0xe06fb5](util[_0x8e5e('0x1b')]('user:%s',_0x54dcb3[_0x8e5e('0x4')][_0x88cee2][_0x8e5e('0x8')]));}}}function joinOrLeave(_0x3005fd,_0x11afc9,_0x1093d8){var _0x66058a;if(_0x3005fd[_0x8e5e('0x1d')][_0x8e5e('0x1e')]['id']){db[_0x8e5e('0x5')][_0x8e5e('0x1f')]({'attributes':['id',_0x8e5e('0x8'),_0x8e5e('0x6'),_0x8e5e('0x20')],'where':{'id':_0x3005fd[_0x8e5e('0x1d')]['query']['id']},'include':[{'model':db[_0x8e5e('0x21')],'as':_0x8e5e('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e5e('0x23')],'as':_0x8e5e('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e5e('0x25')],'as':_0x8e5e('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e5e('0x27')],'as':_0x8e5e('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e5e('0x29')],'as':_0x8e5e('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x577d41){if(_0x577d41){_0x66058a=_0x577d41;_0x3005fd[_0x11afc9](util[_0x8e5e('0x1b')](_0x8e5e('0x2b'),_0x577d41[_0x8e5e('0x8')]));var _0x17c790=[];switch(_0x577d41[_0x8e5e('0x6')]){case _0x8e5e('0x2c'):_0x3005fd[_0x11afc9](_0x8e5e('0x2d'));_0x3005fd[_0x11afc9](_0x8e5e('0x2e'));if(queryQueues[_0x8e5e('0x2f')](_0x8e5e('0x30'))){delete queryQueues[_0x8e5e('0x30')];}_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x32')][_0x8e5e('0x13')](queryQueues));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x33')][_0x8e5e('0x13')](queryQueues));_0x17c790[_0x8e5e('0x31')](db['FaxQueue'][_0x8e5e('0x13')](queryQueues));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x34')][_0x8e5e('0x13')](queryQueues));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x35')][_0x8e5e('0x13')](queryQueues));_0x17c790['push'](db[_0x8e5e('0x36')][_0x8e5e('0x13')](queryQueues));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x37')]['findAll'](queryQueues));_0x17c790[_0x8e5e('0x31')](db['User'][_0x8e5e('0x13')](queryTelephones));_0x17c790[_0x8e5e('0x31')](db['Trunk'][_0x8e5e('0x13')](queryTrunks));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x1a')][_0x8e5e('0x13')](queryCampaigns));_0x17c790['push'](db[_0x8e5e('0x5')]['findAll'](queryAgents));break;case'user':_0x3005fd[_0x11afc9]('voice:inbound');_0x3005fd[_0x11afc9]('voice:outbound');_0x17c790[_0x8e5e('0x31')](getAssociatedResources(_0x8e5e('0x38'),_0x577d41[_0x8e5e('0x20')],'VoiceQueue'));_0x17c790[_0x8e5e('0x31')](getAssociatedResources(_0x8e5e('0x39'),_0x577d41[_0x8e5e('0x20')],_0x8e5e('0x33')));_0x17c790[_0x8e5e('0x31')](getAssociatedResources(_0x8e5e('0xf'),_0x577d41['userProfileId'],_0x8e5e('0x3a')));_0x17c790['push'](getAssociatedResources('SmsQueues',_0x577d41[_0x8e5e('0x20')],_0x8e5e('0x34')));_0x17c790[_0x8e5e('0x31')](getAssociatedResources('MailQueues',_0x577d41['userProfileId'],_0x8e5e('0x35')));_0x17c790['push'](getAssociatedResources(_0x8e5e('0x11'),_0x577d41[_0x8e5e('0x20')],_0x8e5e('0x36')));_0x17c790[_0x8e5e('0x31')](getAssociatedResources('WhatsappQueues',_0x577d41[_0x8e5e('0x20')],'WhatsappQueue'));_0x17c790[_0x8e5e('0x31')](getAssociatedResources(_0x8e5e('0x3b'),_0x577d41[_0x8e5e('0x20')],_0x8e5e('0x5')));_0x17c790[_0x8e5e('0x31')](getAssociatedResources(_0x8e5e('0x14'),_0x577d41['userProfileId'],_0x8e5e('0x3c')));_0x17c790[_0x8e5e('0x31')](getAssociatedResources('IvrCampaigns',_0x577d41[_0x8e5e('0x20')],_0x8e5e('0x1a')));_0x17c790[_0x8e5e('0x31')](db[_0x8e5e('0x5')][_0x8e5e('0x13')](queryAgents));break;case'agent':_0x3005fd[_0x11afc9](_0x8e5e('0x2d'));_0x3005fd[_0x11afc9]('voice:outbound');_0x17c790[_0x8e5e('0x31')](_0x577d41[_0x8e5e('0x3d')]({'attributes':['id',_0x8e5e('0x8')]}));_0x17c790[_0x8e5e('0x31')](_0x577d41[_0x8e5e('0x3e')]({'attributes':['id','name']}));_0x17c790['push'](_0x577d41[_0x8e5e('0x3f')]({'attributes':['id',_0x8e5e('0x8')]}));_0x17c790[_0x8e5e('0x31')](_0x577d41['getSmsQueues']({'attributes':['id',_0x8e5e('0x8')]}));_0x17c790[_0x8e5e('0x31')](_0x577d41[_0x8e5e('0x40')]({'attributes':['id',_0x8e5e('0x8')]}));_0x17c790[_0x8e5e('0x31')](_0x577d41[_0x8e5e('0x41')]({'attributes':['id',_0x8e5e('0x8')]}));_0x17c790[_0x8e5e('0x31')](_0x577d41['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x8e5e('0x42')](_0x17c790);}})['then'](function(_0x309a1f){if(_0x309a1f&&_0x309a1f['length']){for(var _0x394038=0x0;_0x394038<_0x309a1f['length'];_0x394038+=0x1){for(var _0x11b9d6=0x0;_0x11b9d6<_0x309a1f[_0x394038][_0x8e5e('0x43')];_0x11b9d6+=0x1){switch(_0x394038){case 0x0:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x44'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x1:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x45'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x2:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x46'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x3:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x47'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x4:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x48'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x5:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x49'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x6:joinOrLeaveQueues(_0x3005fd,_0x11afc9,_0x8e5e('0x4a'),_0x309a1f[_0x394038][_0x11b9d6]);break;case 0x7:_0x3005fd[_0x11afc9](util['format'](_0x8e5e('0x4b'),_0x309a1f[_0x394038][_0x11b9d6][_0x8e5e('0x8')]));break;case 0x8:_0x3005fd[_0x11afc9](util[_0x8e5e('0x1b')](_0x8e5e('0x4c'),_0x309a1f[_0x394038][_0x11b9d6][_0x8e5e('0x8')]));break;case 0x9:_0x3005fd[_0x11afc9](util['format'](_0x8e5e('0x4d'),_0x309a1f[_0x394038][_0x11b9d6][_0x8e5e('0x9')],_0x309a1f[_0x394038][_0x11b9d6][_0x8e5e('0x8')]));break;case 0xa:_0x3005fd[_0x11afc9](util[_0x8e5e('0x1b')]('user:%s',_0x309a1f[_0x394038][_0x11b9d6][_0x8e5e('0x8')]));break;}}}}})[_0x8e5e('0xd')](function(){if(_0x11afc9===_0x8e5e('0x4e')){var _0x32e928=_[_0x8e5e('0x17')](_0x66058a[_0x8e5e('0x22')],'id');return _0x66058a['removeChatInteractions'](_0x32e928)[_0x8e5e('0xd')](function(){for(var _0x41dff5=0x0;_0x41dff5<_0x32e928[_0x8e5e('0x43')];_0x41dff5+=0x1){_0x1093d8['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x32e928[_0x41dff5]),'UserId':Number(_0x66058a['id'])});}});}})[_0x8e5e('0xd')](function(){if(_0x11afc9===_0x8e5e('0x4e')){var _0x1f5e7b=_[_0x8e5e('0x17')](_0x66058a[_0x8e5e('0x24')],'id');return _0x66058a['removeMailInteractions'](_0x1f5e7b)[_0x8e5e('0xd')](function(){for(var _0x5d9876=0x0;_0x5d9876<_0x1f5e7b['length'];_0x5d9876+=0x1){_0x1093d8[_0x8e5e('0x4f')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1f5e7b[_0x5d9876]),'UserId':Number(_0x66058a['id'])});}});}})[_0x8e5e('0xd')](function(){if(_0x11afc9==='leave'){var _0x386823=_[_0x8e5e('0x17')](_0x66058a[_0x8e5e('0x26')],'id');return _0x66058a[_0x8e5e('0x50')](_0x386823)[_0x8e5e('0xd')](function(){for(var _0x1610b6=0x0;_0x1610b6<_0x386823['length'];_0x1610b6+=0x1){_0x1093d8[_0x8e5e('0x4f')](_0x8e5e('0x51'),{'FaxInteractionId':Number(_0x386823[_0x1610b6]),'UserId':Number(_0x66058a['id'])});}});}})[_0x8e5e('0xd')](function(){if(_0x11afc9==='leave'){var _0x18cc18=_[_0x8e5e('0x17')](_0x66058a['SmsInteractions'],'id');return _0x66058a['removeSmsInteractions'](_0x18cc18)[_0x8e5e('0xd')](function(){for(var _0x5b15ce=0x0;_0x5b15ce<_0x18cc18[_0x8e5e('0x43')];_0x5b15ce+=0x1){_0x1093d8['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x18cc18[_0x5b15ce]),'UserId':Number(_0x66058a['id'])});}});}})['then'](function(){if(_0x11afc9===_0x8e5e('0x4e')){var _0x2d185b=_[_0x8e5e('0x17')](_0x66058a[_0x8e5e('0x2a')],'id');return _0x66058a[_0x8e5e('0x52')](_0x2d185b)['then'](function(){for(var _0x5dcc60=0x0;_0x5dcc60<_0x2d185b['length'];_0x5dcc60+=0x1){_0x1093d8['emit'](_0x8e5e('0x53'),{'OpenchannelInteractionId':Number(_0x2d185b[_0x5dcc60]),'UserId':Number(_0x66058a['id'])});}});}})['then'](function(){if(_0x11afc9===_0x8e5e('0x4e')){var _0x42bd69=_[_0x8e5e('0x17')](_0x66058a[_0x8e5e('0x54')],'id');return _0x66058a[_0x8e5e('0x55')](_0x42bd69)['then'](function(){for(var _0x22b897=0x0;_0x22b897<_0x42bd69[_0x8e5e('0x43')];_0x22b897+=0x1){_0x1093d8[_0x8e5e('0x4f')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x42bd69[_0x22b897]),'UserId':Number(_0x66058a['id'])});}});}})[_0x8e5e('0x56')](function(_0x5e0964){_0x3005fd[_0x8e5e('0x57')](_0x5e0964);});}}function onDisconnect(_0x1cf804,_0x151704){joinOrLeave(_0x1cf804,_0x8e5e('0x4e'),_0x151704);}function onConnect(_0x23bca3){joinOrLeave(_0x23bca3,_0x8e5e('0x58'));}exports[_0x8e5e('0x59')]=function(_0x2a5ede){_0x2a5ede['on'](_0x8e5e('0x5a'),function(_0x47a0af){_0x47a0af[_0x8e5e('0x5b')](0x0);_0x47a0af['address']=_0x47a0af[_0x8e5e('0x5c')][_0x8e5e('0x5a')][_0x8e5e('0x5d')]+':'+_0x47a0af[_0x8e5e('0x5c')][_0x8e5e('0x5a')][_0x8e5e('0x5e')];_0x47a0af[_0x8e5e('0x5f')]=new Date();_0x47a0af[_0x8e5e('0x57')]=function(_0x1fadcc){console[_0x8e5e('0x57')]('SocketIO\x20'+_0x47a0af[_0x8e5e('0x60')][_0x8e5e('0x8')]+'['+_0x47a0af[_0x8e5e('0x61')]+']',_0x1fadcc);};_0x47a0af['on'](_0x8e5e('0x62'),function(){onDisconnect(_0x47a0af,_0x2a5ede);_0x47a0af[_0x8e5e('0x57')](_0x8e5e('0x63'));});onConnect(_0x47a0af);_0x47a0af[_0x8e5e('0x57')](_0x8e5e('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index c825ff6..8962a16 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 _0x3645=['default','length','hasOwnProperty','model','hook','callback','condition','util','jayson/promise','triggers','client','http','Chat','afterCreate','newinteraction','ChatInteraction','afterUpdate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','channel','direction','User','find','UserId','interface','format','SIP/%s','name','incomingmessage','catch','outgoingmessage','get','event','opened','changed','closed'];(function(_0x41b900,_0x5437f7){var _0x5d248c=function(_0x3e0dbf){while(--_0x3e0dbf){_0x41b900['push'](_0x41b900['shift']());}};_0x5d248c(++_0x5437f7);}(_0x3645,0x157));var _0x5364=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x3645[_0x2f6233];return _0x1c9c36;};'use strict';var util=require(_0x5364('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5364('0x1'));var logger=require('../logger')(_0x5364('0x2'));var client=jayson[_0x5364('0x3')][_0x5364('0x4')]({'port':0x232a});var triggers=[{'channel':_0x5364('0x5'),'model':'ChatInteraction','event':_0x5364('0x6'),'condition':_0x5364('0x7'),'callback':afterCreate},{'channel':_0x5364('0x5'),'model':_0x5364('0x8'),'event':_0x5364('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5364('0x5'),'model':'ChatMessage','event':'afterCreate','condition':_0x5364('0xa'),'callback':afterCreateMessage},{'channel':_0x5364('0xb'),'model':_0x5364('0xc'),'event':_0x5364('0x6'),'condition':_0x5364('0x7'),'callback':afterCreate},{'channel':_0x5364('0xb'),'model':_0x5364('0xc'),'event':'afterUpdate','condition':_0x5364('0xd'),'callback':afterUpdate},{'channel':_0x5364('0xb'),'model':_0x5364('0xe'),'event':_0x5364('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5364('0xf'),'model':_0x5364('0x10'),'event':_0x5364('0x6'),'condition':_0x5364('0x7'),'callback':afterCreate},{'channel':_0x5364('0xf'),'model':'WhatsappInteraction','event':'afterUpdate','condition':_0x5364('0xd'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x5364('0x11'),'event':_0x5364('0x6'),'condition':_0x5364('0xa'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':'afterCreate','condition':_0x5364('0x7'),'callback':afterCreate},{'channel':_0x5364('0x12'),'model':_0x5364('0x13'),'event':_0x5364('0x9'),'condition':_0x5364('0xd'),'callback':afterUpdate},{'channel':_0x5364('0x12'),'model':'FaxMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x5364('0x14'),'model':'MailInteraction','event':_0x5364('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x5364('0x14'),'model':_0x5364('0x15'),'event':_0x5364('0x9'),'condition':_0x5364('0xd'),'callback':afterUpdate},{'channel':_0x5364('0x14'),'model':_0x5364('0x16'),'event':_0x5364('0x6'),'condition':_0x5364('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x5364('0x17'),'event':_0x5364('0x6'),'condition':_0x5364('0x7'),'callback':afterCreate},{'channel':_0x5364('0x18'),'model':'OpenchannelInteraction','event':_0x5364('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x5364('0x18'),'model':_0x5364('0x19'),'event':_0x5364('0x6'),'condition':_0x5364('0xa'),'callback':afterCreateMessage}];function request(_0x261a26){return client[_0x5364('0x1a')](_0x5364('0x1b'),_0x261a26)[_0x5364('0x1c')](function(_0x28b89d){logger['info'](_0x5364('0x1d'),_0x5364('0x1b'),_0x28b89d);if(_0x28b89d[_0x5364('0x1e')]){if(_0x28b89d['error'][_0x5364('0x1f')]===0x1f4){logger[_0x5364('0x1e')](_0x5364('0x1d'),_0x5364('0x1b'),_0x28b89d[_0x5364('0x1e')]);}}})['catch'](function(_0x55bb6e){logger[_0x5364('0x1e')](_0x5364('0x1d'),_0x5364('0x1b'),_0x55bb6e);});}function afterCreateMessage(_0x484ebd,_0x242184){return function(_0x3d0d8a,_0x4210a0){_0x3d0d8a=_0x3d0d8a['get']({'plain':!![]});_0x3d0d8a[_0x5364('0x20')]=_0x484ebd;_0x3d0d8a['event']=_0x3d0d8a[_0x5364('0x21')];if(_0x3d0d8a['UserId']){return db[_0x5364('0x22')][_0x5364('0x23')]({'where':{'id':_0x3d0d8a[_0x5364('0x24')]},'attributes':['id','name'],'raw':!![]})['then'](function(_0x247a8e){_0x3d0d8a[_0x5364('0x25')]=util[_0x5364('0x26')](_0x5364('0x27'),_0x247a8e[_0x5364('0x28')]);_0x3d0d8a[_0x5364('0x20')]=_0x484ebd;return request({'event':_0x5364('0x29'),'message':_0x3d0d8a});})[_0x5364('0x2a')](function(_0x4d5210){console[_0x5364('0x1e')](_0x4d5210);});}else{return request({'event':_0x5364('0x2b'),'message':_0x3d0d8a});}};}function afterCreate(_0x2edfaf,_0x10b3cc){return function(_0x44d485,_0x3ebb24){_0x44d485=_0x44d485[_0x5364('0x2c')]({'plain':!![]});_0x44d485['channel']=_0x2edfaf;_0x44d485[_0x5364('0x2d')]=_0x5364('0x2e');return request({'event':_0x10b3cc,'message':_0x44d485});};}function afterUpdate(_0x458b85,_0x4fbe12){return function(_0x123136,_0x57adb3){if(_0x123136[_0x5364('0x2f')](_0x5364('0x30'))&&_0x123136[_0x5364('0x30')]){_0x123136=_0x123136[_0x5364('0x2c')]({'plain':!![]});_0x123136['channel']=_0x458b85;_0x123136[_0x5364('0x2d')]=_0x5364('0x30');if(_0x123136[_0x5364('0x24')]){return db['User'][_0x5364('0x23')]({'where':{'id':_0x123136[_0x5364('0x24')]},'attributes':['id',_0x5364('0x28')],'raw':!![]})[_0x5364('0x1c')](function(_0x44fc4e){_0x123136[_0x5364('0x25')]=util[_0x5364('0x26')]('SIP/%s',_0x44fc4e[_0x5364('0x28')]);return request({'event':_0x4fbe12,'message':_0x123136});})['catch'](function(_0x2aeb40){console[_0x5364('0x1e')](_0x2aeb40);});}else{return request({'event':_0x4fbe12,'message':_0x123136});}}};}exports[_0x5364('0x31')]=function(){for(var _0x5bd067=0x0;_0x5bd067=_0x4dbfd6['agents']){throw Error(_0x16d7('0x12'));}_0x476983(_0x2eee63);})[_0x16d7('0x13')](function(_0x34dac0){_0x536312(_0x34dac0);});});}; \ No newline at end of file +var _0x7791=['updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird','../mysqldb','./license/util','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt'];(function(_0x18e728,_0x466172){var _0x1243cb=function(_0x221756){while(--_0x221756){_0x18e728['push'](_0x18e728['shift']());}};_0x1243cb(++_0x466172);}(_0x7791,0x82));var _0x1779=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x7791[_0x2d486b];return _0x4291d1;};'use strict';var _=require('lodash');var BPromise=require(_0x1779('0x0'));var db=require(_0x1779('0x1'))['db'];var util=require(_0x1779('0x2'));var channels=['voice',_0x1779('0x3'),_0x1779('0x4'),_0x1779('0x5'),_0x1779('0x6'),'whatsapp',_0x1779('0x7')];exports[_0x1779('0x8')]=function(){return channels;};exports[_0x1779('0x9')]=function(_0x2d3ad4){_0x2d3ad4=_0x2d3ad4[_0x1779('0xa')]();return _[_0x1779('0xb')](channels,_0x2d3ad4);};exports['clearBlockUser']=function(_0x1ac78c,_0x4c9ba6,_0x3353ea,_0x5f30d7){var _0x33aece={'loginAttempts':_0x4c9ba6,'blocked':_0x3353ea};if(!_[_0x1779('0xc')](_0x5f30d7)){_0x33aece[_0x1779('0xd')]=_0x5f30d7;}return _0x1ac78c[_0x1779('0xe')](_0x33aece);};exports[_0x1779('0xf')]=function(_0x5a57a2){return new BPromise(function(_0x16f63c,_0x5eda42){var _0x395ff0=0x0;if(_0x5a57a2[_0x1779('0x10')]!==_0x1779('0x11')){_0x16f63c(_0x5a57a2);}db[_0x1779('0x12')][_0x1779('0x13')]({'where':{'role':_0x1779('0x11'),'online':!![],'id':{'$ne':_0x5a57a2['id']}}})[_0x1779('0x14')](function(_0x74c418){_0x395ff0=_0x74c418;return util['getLicense']();})[_0x1779('0x14')](function(_0xcbe3bc){if(_0xcbe3bc&&_0xcbe3bc[_0x1779('0x15')]&&_0x395ff0>=_0xcbe3bc['agents']){throw Error(_0x1779('0x16'));}_0x16f63c(_0x5a57a2);})[_0x1779('0x17')](function(_0x588b66){_0x5eda42(_0x588b66);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 08ce68f..1e7711c 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7331=['render','json','send','exports','404','status'];(function(_0x4cae4d,_0x186f72){var _0x32c9f4=function(_0x1edc5c){while(--_0x1edc5c){_0x4cae4d['push'](_0x4cae4d['shift']());}};_0x32c9f4(++_0x186f72);}(_0x7331,0xa5));var _0x1733=function(_0xe89530,_0x245ce8){_0xe89530=_0xe89530-0x0;var _0x45bfc8=_0x7331[_0xe89530];return _0x45bfc8;};'use strict';module[_0x1733('0x0')][0x194]=function pageNotFound(_0x3dc9c5,_0x240c54){var _0x2e75e2=_0x1733('0x1');var _0x3aa704=0x194;var _0x3f31e1={'status':_0x3aa704};_0x240c54['status'](_0x3f31e1[_0x1733('0x2')]);_0x240c54[_0x1733('0x3')](_0x2e75e2,{},function(_0xd1e21c,_0x322729){if(_0xd1e21c){return _0x240c54[_0x1733('0x2')](_0x3f31e1[_0x1733('0x2')])[_0x1733('0x4')](_0x3f31e1);}_0x240c54[_0x1733('0x5')](_0x322729);});}; \ No newline at end of file +var _0xfce1=['404','status','render','json','send','exports'];(function(_0x33d7c3,_0x30734f){var _0x3c98db=function(_0x58c548){while(--_0x58c548){_0x33d7c3['push'](_0x33d7c3['shift']());}};_0x3c98db(++_0x30734f);}(_0xfce1,0xd1));var _0x1fce=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xfce1[_0x1f9f37];return _0x21c080;};'use strict';module[_0x1fce('0x0')][0x194]=function pageNotFound(_0x335766,_0x3238b8){var _0x1f964d=_0x1fce('0x1');var _0x2437b4=0x194;var _0x37373c={'status':_0x2437b4};_0x3238b8[_0x1fce('0x2')](_0x37373c['status']);_0x3238b8[_0x1fce('0x3')](_0x1f964d,{},function(_0x270605,_0x99aa0f){if(_0x270605){return _0x3238b8[_0x1fce('0x2')](_0x37373c['status'])[_0x1fce('0x4')](_0x37373c);}_0x3238b8[_0x1fce('0x5')](_0x99aa0f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index e3fc34c..c580c21 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe095=['../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','User','hasOne','VoiceMail','UserId','hasMany','cascade','CmHopperFinal','HopperHistory','ReportAgentPreview','OpenchannelInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','chat_group_has_users','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','SmsInteractions','user_has_sms_interactions','OpenchannelInteraction','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Smtp','Answers','List','ListId','TemplateId','team_has_mail_queues','Messages','Account','Contact','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict','Tag','TagId','Dashboard','Items','Dispositions','FaxAccountId','Interactions','FaxQueue','FaxInteractionId','fax_interaction_has_tags','Tags','user_has_fax_interactions','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','ChatWebsiteId','ProactiveActions','ChatApplication','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','AttachmentId','team_has_chat_queues','Members','CompanyId','HopperFinals','ChatInteractions','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Subjects','Description','Field','VariableId','int_desk_configuration_has_tags','ZendeskAccount','FreshdeskAccount','FreshdeskConfiguration','ServicenowConfiguration','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesField','FromId','ToId','SessionId','ProjectId','team_has_fax_queues','team_has_openchannel_queues','team_has_whatsapp_queues','Hoppers','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','FromFaxAccountId','FromAgent','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','userProfileId','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','name','username','password','options','database','import','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.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/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','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','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xe095,0x15a));var _0x5e09=function(_0x1ffa4f,_0x2f6011){_0x1ffa4f=_0x1ffa4f-0x0;var _0x29e7=_0xe095[_0x1ffa4f];return _0x29e7;};'use strict';var path=require(_0x5e09('0x0'));var config=require(_0x5e09('0x1'));var Sequelize=require('sequelize');var _=require(_0x5e09('0x2'));var jstz=require(_0x5e09('0x3'));var timezone=jstz[_0x5e09('0x4')]();config[_0x5e09('0x5')]=_[_0x5e09('0x6')](config[_0x5e09('0x5')],{'database':_0x5e09('0x7'),'username':'xcall','password':_0x5e09('0x8'),'options':{'host':_0x5e09('0x9'),'port':0xcea,'dialect':_0x5e09('0xa'),'dialectOptions':{'charset':_0x5e09('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x5e09('0xc'),'collate':_0x5e09('0xd')}}});config[_0x5e09('0xe')]=_['defaultsDeep'](config[_0x5e09('0xe')],{'database':_0x5e09('0x7'),'username':_0x5e09('0xf'),'password':'xC@LL1234','options':{'host':_0x5e09('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x5e09('0xb')},'logging':![],'timezone':timezone[_0x5e09('0x10')](),'define':{'charset':'utf8','collate':_0x5e09('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e09('0x5')]['database'],config['sequelize'][_0x5e09('0x11')],config[_0x5e09('0x5')][_0x5e09('0x12')],config[_0x5e09('0x5')][_0x5e09('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5e09('0xe')][_0x5e09('0x14')],config[_0x5e09('0xe')]['username'],config[_0x5e09('0xe')][_0x5e09('0x12')],config[_0x5e09('0xe')][_0x5e09('0x13')])};db['User']=db['sequelize'][_0x5e09('0x15')]('../api/user/user.model');db[_0x5e09('0x16')]=db['sequelize']['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x5e09('0x17')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/voiceContext/voiceContext.model');db[_0x5e09('0x18')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x19'));db[_0x5e09('0x1a')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x1b'));db[_0x5e09('0x1c')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x1d'));db[_0x5e09('0x1e')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x1f'));db['ScreenRecording']=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db['sequelize']['import'](_0x5e09('0x20'));db[_0x5e09('0x21')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x22'));db[_0x5e09('0x23')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x24'));db[_0x5e09('0x25')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x26'));db['VoiceAgentReport']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x27'));db[_0x5e09('0x28')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x29'));db[_0x5e09('0x2a')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x2b'));db[_0x5e09('0x2c')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x2d'));db[_0x5e09('0x2e')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x2f'));db[_0x5e09('0x30')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x31'));db[_0x5e09('0x32')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x33'));db[_0x5e09('0x34')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x35'));db['UserFaxQueue']=db[_0x5e09('0x5')]['import'](_0x5e09('0x36'));db[_0x5e09('0x37')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x38'));db['UserOpenchannelQueue']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x39'));db[_0x5e09('0x3a')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x5e09('0x3b')]=db[_0x5e09('0x5')]['import']('../api/mailServerIn/mailServerIn.model');db[_0x5e09('0x3c')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x3d'));db[_0x5e09('0x3e')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x3f'));db[_0x5e09('0x40')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x41'));db[_0x5e09('0x42')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x43'));db[_0x5e09('0x44')]=db['sequelize']['import'](_0x5e09('0x45'));db[_0x5e09('0x46')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/mailMessage/mailMessage.model');db[_0x5e09('0x47')]=db['sequelize']['import'](_0x5e09('0x48'));db[_0x5e09('0x49')]=db['sequelize'][_0x5e09('0x15')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x5e09('0x5')]['import'](_0x5e09('0x4a'));db[_0x5e09('0x4b')]=db[_0x5e09('0x5')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x5e09('0x4c')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/faxAccount/faxAccount.model');db[_0x5e09('0x4d')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/faxApplication/faxApplication.model');db[_0x5e09('0x4e')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x4f'));db[_0x5e09('0x50')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x51'));db['FaxQueue']=db['sequelize']['import'](_0x5e09('0x52'));db['FaxQueueReport']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x53'));db[_0x5e09('0x54')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x55'));db['SmsApplication']=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/smsApplication/smsApplication.model');db[_0x5e09('0x56')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x57'));db[_0x5e09('0x58')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x59'));db['SmsQueue']=db[_0x5e09('0x5')]['import']('../api/smsQueue/smsQueue.model');db[_0x5e09('0x5a')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x5b'));db[_0x5e09('0x5c')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5e09('0x5d')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x5e09('0x5e')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x5f'));db[_0x5e09('0x60')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x61'));db['OpenchannelQueueReport']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x62'));db['ChatApplication']=db[_0x5e09('0x5')]['import'](_0x5e09('0x63'));db[_0x5e09('0x64')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/chatInteraction/chatInteraction.model');db[_0x5e09('0x65')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x66'));db[_0x5e09('0x67')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x68'));db[_0x5e09('0x69')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x6a'));db[_0x5e09('0x6b')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x6c'));db[_0x5e09('0x6d')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x6e'));db[_0x5e09('0x6f')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x70'));db[_0x5e09('0x71')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x72'));db[_0x5e09('0x73')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x74'));db[_0x5e09('0x75')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x76'));db['CmHopperFinal']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x77'));db[_0x5e09('0x78')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x79'));db['ReportAgentPreview']=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x5e09('0x7a')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x7b'));db['Action']=db[_0x5e09('0x5')]['import']('../api/action/action.model');db[_0x5e09('0x7c')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x7d'));db[_0x5e09('0x7e')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x7f'));db[_0x5e09('0x80')]=db[_0x5e09('0x5')]['import']('../api/disposition/disposition.model');db[_0x5e09('0x81')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x82'));db[_0x5e09('0x83')]=db[_0x5e09('0x5')]['import']('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x84'));db[_0x5e09('0x85')]=db['sequelize']['import']('../api/cdr/cdr.model');db[_0x5e09('0x86')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x87'));db[_0x5e09('0x88')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x89'));db[_0x5e09('0x8a')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x8b'));db['Tag']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x8c'));db[_0x5e09('0x8d')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x8e'));db[_0x5e09('0x8f')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x90'));db[_0x5e09('0x91')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x92'));db[_0x5e09('0x93')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x94'));db[_0x5e09('0x95')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x96'));db[_0x5e09('0x97')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x98'));db[_0x5e09('0x99')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x9a'));db[_0x5e09('0x9b')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/analyticMetric/analyticMetric.model');db[_0x5e09('0x9c')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x9d'));db[_0x5e09('0x9e')]=db[_0x5e09('0x5')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x5e09('0x9f')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xa0'));db[_0x5e09('0xa1')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x5e09('0x5')]['import'](_0x5e09('0xa2'));db[_0x5e09('0xa3')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x5e09('0xa4')]=db[_0x5e09('0x5')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x5e09('0xa5')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xa6'));db[_0x5e09('0xa7')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xa8'));db[_0x5e09('0xa9')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xaa'));db[_0x5e09('0xab')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xac'));db[_0x5e09('0xad')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xae'));db[_0x5e09('0xaf')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x5e09('0xb0')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xb1'));db['ZendeskAccount']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xb2'));db[_0x5e09('0xb3')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xb4'));db[_0x5e09('0xb5')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xb6'));db['FreshdeskAccount']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xb7'));db['FreshdeskConfiguration']=db[_0x5e09('0x5')]['import'](_0x5e09('0xb8'));db[_0x5e09('0xb9')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x5e09('0xba')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xbb'));db[_0x5e09('0xbc')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xbd'));db[_0x5e09('0xbe')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/intVtigerField/intVtigerField.model');db[_0x5e09('0xbf')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xc0'));db['ServicenowConfiguration']=db['sequelize'][_0x5e09('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc1'));db[_0x5e09('0xc2')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc3'));db['Dynamics365Configuration']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc4'));db['Dynamics365Field']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc5'));db[_0x5e09('0xc6')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x5e09('0xc7')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc8'));db['FreshsalesField']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xc9'));db['Integration']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x94'));db[_0x5e09('0xca')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/network/network.model');db[_0x5e09('0xcb')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xcc'));db[_0x5e09('0xcd')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xce'));db[_0x5e09('0xcf')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xd0'));db[_0x5e09('0xd1')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xd2'));db[_0x5e09('0xd3')]=db[_0x5e09('0x5')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x5e09('0xd4')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xd5'));db[_0x5e09('0xd6')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xd7'));db[_0x5e09('0xd8')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0x5e09('0xd9')]=db['sequelize'][_0x5e09('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0x5e09('0xda')]=db['sequelize'][_0x5e09('0x15')]('../api/setting/setting.model');db['SquareOdbc']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xdb'));db[_0x5e09('0xdc')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xdd'));db['SquareRecording']=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xde'));db[_0x5e09('0xdf')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/squareMessage/squareMessage.model');db[_0x5e09('0xe0')]=db['sequelize']['import'](_0x5e09('0xe1'));db[_0x5e09('0xe2')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xe3'));db[_0x5e09('0xe4')]=db['sequelize'][_0x5e09('0x15')]('../api/campaign/campaign.model');db[_0x5e09('0xe5')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xe6'));db[_0x5e09('0xe7')]=db['sequelize'][_0x5e09('0x15')]('../api/attachment/attachment.model');db['Plugin']=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xe8'));db[_0x5e09('0xe9')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0x5e09('0xea')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xeb'));db[_0x5e09('0xec')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xed'));db[_0x5e09('0xee')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xef'));db[_0x5e09('0xf0')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xf1'));db[_0x5e09('0xf2')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/cmList/cmList.model');db[_0x5e09('0xf3')]=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/voicePrefix/voicePrefix.model');db[_0x5e09('0xf4')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xf5'));db[_0x5e09('0xf6')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xf7'));db['UserProfileResource']=db['sequelize'][_0x5e09('0x15')](_0x5e09('0xf8'));db[_0x5e09('0xf9')]=db[_0x5e09('0x5')]['import'](_0x5e09('0xfa'));db['WhatsappAccount']=db[_0x5e09('0x5')]['import'](_0x5e09('0xfb'));db['WhatsappApplication']=db[_0x5e09('0x5')][_0x5e09('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0x5e09('0xfc')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0xfd'));db['WhatsappMessage']=db[_0x5e09('0x5')]['import'](_0x5e09('0xfe'));db[_0x5e09('0xff')]=db[_0x5e09('0x5')]['import'](_0x5e09('0x100'));db[_0x5e09('0x101')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x102'));db[_0x5e09('0x103')]=db[_0x5e09('0x5')][_0x5e09('0x15')](_0x5e09('0x104'));db[_0x5e09('0x105')]=db['sequelize'][_0x5e09('0x15')](_0x5e09('0x106'));db[_0x5e09('0x107')][_0x5e09('0x108')](db[_0x5e09('0x109')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db[_0x5e09('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db[_0x5e09('0x107')][_0x5e09('0x10b')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db[_0x5e09('0x18')],{'as':'Extensions','onDelete':_0x5e09('0x10c'),'hooks':!![]});db[_0x5e09('0x107')]['hasMany'](db[_0x5e09('0x10d')],{'as':'HopperFinals','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db[_0x5e09('0x78')],{'as':_0x5e09('0x10e'),'foreignKey':'UserId'});db[_0x5e09('0x107')][_0x5e09('0x10b')](db['ReportAgentPreview'],{'as':_0x5e09('0x10f'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db['OpenchannelInteraction'],{'as':_0x5e09('0x110'),'foreignKey':_0x5e09('0x10a')});db['User'][_0x5e09('0x10b')](db[_0x5e09('0x64')],{'as':'ChatInteractions','foreignKey':_0x5e09('0x10a')});db['User'][_0x5e09('0x10b')](db[_0x5e09('0x56')],{'as':'SmsInteractions','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db['FaxInteraction'],{'as':_0x5e09('0x111'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')]['hasMany'](db[_0x5e09('0x44')],{'as':_0x5e09('0x112'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x107')][_0x5e09('0x10b')](db[_0x5e09('0xfc')],{'as':_0x5e09('0x113'),'foreignKey':'UserId'});db[_0x5e09('0x107')][_0x5e09('0x10b')](db['Notification'],{'as':_0x5e09('0x114'),'foreignKey':_0x5e09('0x115')});db[_0x5e09('0x107')][_0x5e09('0x116')](db[_0x5e09('0xf4')],{'as':_0x5e09('0xf4'),'foreignKey':'userProfileId'});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x6b')],{'as':'Groups','through':_0x5e09('0x117')});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x71')],{'as':_0x5e09('0x119'),'through':_0x5e09('0x11a')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0xf2')],{'as':_0x5e09('0x11b'),'through':_0x5e09('0x11c')});db['User'][_0x5e09('0x118')](db['Team'],{'through':_0x5e09('0x11d')});db[_0x5e09('0x107')][_0x5e09('0x118')](db['MailInteraction'],{'as':_0x5e09('0x112'),'through':_0x5e09('0x11e')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x64')],{'as':'ChatInteractions','through':_0x5e09('0x11f')});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x4e')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x5e09('0x118')](db[_0x5e09('0x56')],{'as':_0x5e09('0x120'),'through':_0x5e09('0x121')});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x122')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0xfc')],{'as':_0x5e09('0x113'),'through':_0x5e09('0x123')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x1c')],{'as':_0x5e09('0x124'),'through':_0x5e09('0x125'),'required':![]});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x40')],{'as':_0x5e09('0x126'),'through':'UserMailQueue','required':![]});db['User'][_0x5e09('0x118')](db[_0x5e09('0x69')],{'as':_0x5e09('0x127'),'through':_0x5e09('0x32'),'required':![],'hooks':!![]});db[_0x5e09('0x107')][_0x5e09('0x118')](db['FaxQueue'],{'as':_0x5e09('0x128'),'through':'UserFaxQueue','required':![]});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x129')],{'as':_0x5e09('0x12a'),'through':_0x5e09('0x37'),'required':![]});db[_0x5e09('0x107')][_0x5e09('0x118')](db['OpenchannelQueue'],{'as':_0x5e09('0x12b'),'through':_0x5e09('0x12c'),'required':![]});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x103')],{'as':_0x5e09('0x12d'),'through':_0x5e09('0x3a'),'required':![]});db[_0x5e09('0x107')][_0x5e09('0x118')](db['CmList'],{'through':_0x5e09('0x11c')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0xf3')],{'as':_0x5e09('0x12e'),'through':_0x5e09('0x12f'),'required':![]});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x60')],{'as':'ChatWebsites','through':_0x5e09('0x130')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x4c')],{'as':_0x5e09('0x131'),'through':_0x5e09('0x132')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0x3e')],{'as':_0x5e09('0x133'),'through':_0x5e09('0x134')});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x5a')],{'as':'OpenchannelAccounts','through':_0x5e09('0x135')});db[_0x5e09('0x107')]['belongsToMany'](db['SmsAccount'],{'as':_0x5e09('0x136'),'through':_0x5e09('0x137')});db[_0x5e09('0x107')][_0x5e09('0x118')](db[_0x5e09('0x138')],{'as':'WhatsappAccounts','through':_0x5e09('0x139')});db[_0x5e09('0x107')]['belongsToMany'](db[_0x5e09('0xdc')],{'as':_0x5e09('0x13a'),'through':_0x5e09('0x13b')});db[_0x5e09('0x16')][_0x5e09('0x10b')](db[_0x5e09('0x18')],{'as':_0x5e09('0x13c'),'onDelete':'cascade','foreignKey':_0x5e09('0x13d')});db[_0x5e09('0x17')][_0x5e09('0x10b')](db[_0x5e09('0x18')],{'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x18')][_0x5e09('0x10b')](db[_0x5e09('0x18')],{'as':_0x5e09('0x13e'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x1a')][_0x5e09('0x118')](db[_0x5e09('0x8a')],{'as':_0x5e09('0x13f'),'through':_0x5e09('0x140')});db[_0x5e09('0x1c')][_0x5e09('0x10b')](db[_0x5e09('0x30')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x5e09('0x1c')][_0x5e09('0x10b')](db[_0x5e09('0x73')],{'as':'Hoppers','foreignKey':_0x5e09('0x141')});db[_0x5e09('0x1c')][_0x5e09('0x10b')](db[_0x5e09('0x10d')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x5e09('0x1c')][_0x5e09('0x10b')](db[_0x5e09('0x78')],{'as':_0x5e09('0x142'),'foreignKey':_0x5e09('0x141')});db[_0x5e09('0x1c')]['hasMany'](db[_0x5e09('0x10f')],{'as':'ReportAgentPreview','foreignKey':_0x5e09('0x141')});db[_0x5e09('0x1c')]['hasMany'](db['CmHopperBlack'],{'as':_0x5e09('0x143'),'foreignKey':_0x5e09('0x141')});db[_0x5e09('0x1c')]['hasMany'](db[_0x5e09('0xd3')],{'as':_0x5e09('0x144'),'foreignKey':_0x5e09('0x141')});db[_0x5e09('0x1c')][_0x5e09('0x116')](db[_0x5e09('0x2c')],{'as':'Trunk','foreignKey':_0x5e09('0x145')});db['VoiceQueue'][_0x5e09('0x116')](db[_0x5e09('0x2c')],{'as':'TrunkBackup','foreignKey':_0x5e09('0x146')});db[_0x5e09('0x1c')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'as':'Interval','foreignKey':_0x5e09('0x147')});db[_0x5e09('0x1c')]['belongsTo'](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':_0x5e09('0x14a')});db[_0x5e09('0x1c')][_0x5e09('0x118')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x11b'),'through':_0x5e09('0x14b')});db[_0x5e09('0x1c')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x125')});db[_0x5e09('0x1c')][_0x5e09('0x118')](db[_0x5e09('0xe0')],{'as':_0x5e09('0x14d'),'through':_0x5e09('0x14e')});db[_0x5e09('0x1c')][_0x5e09('0x118')](db['CmList'],{'as':_0x5e09('0x14f'),'through':_0x5e09('0x150')});db[_0x5e09('0x1e')][_0x5e09('0x116')](db['User'],{'as':'User','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x151')]['belongsTo'](db[_0x5e09('0x107')],{'as':_0x5e09('0x107'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x109')]['hasMany'](db[_0x5e09('0x21')],{'as':'Messages','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x152'),'sourceKey':_0x5e09('0x153')});db[_0x5e09('0x21')][_0x5e09('0x116')](db[_0x5e09('0x109')],{'foreignKey':_0x5e09('0x152'),'targetKey':_0x5e09('0x153')});db[_0x5e09('0x23')][_0x5e09('0x10b')](db['VoiceQueueReport'],{'as':_0x5e09('0x154'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x5e09('0x10b')](db[_0x5e09('0x155')],{'as':_0x5e09('0x156'),'foreignKey':_0x5e09('0x157'),'constraints':![]});db[_0x5e09('0x23')][_0x5e09('0x116')](db['User'],{'as':'User','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x23')]['belongsTo'](db[_0x5e09('0x71')],{'as':'Contact','foreignKey':_0x5e09('0x158')});db['MailServerIn'][_0x5e09('0x116')](db[_0x5e09('0x3e')],{'as':_0x5e09('0x3e'),'foreignKey':_0x5e09('0x159')});db['MailServerOut']['belongsTo'](db[_0x5e09('0x3e')],{'as':_0x5e09('0x3e'),'foreignKey':'MailAccountId'});db[_0x5e09('0x3e')][_0x5e09('0x108')](db[_0x5e09('0x3b')],{'as':_0x5e09('0x15a'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x3e')][_0x5e09('0x108')](db[_0x5e09('0x3c')],{'as':_0x5e09('0x15b'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x3e')][_0x5e09('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x5e09('0x159')});db[_0x5e09('0x3e')][_0x5e09('0x10b')](db[_0x5e09('0x7e')],{'as':_0x5e09('0x15c'),'foreignKey':_0x5e09('0x159')});db[_0x5e09('0x3e')][_0x5e09('0x10b')](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x5e09('0x44')],{'as':'Interactions'});db[_0x5e09('0x3e')][_0x5e09('0x10b')](db[_0x5e09('0x47')],{'as':'Applications'});db['MailAccount'][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db['MailAccount']['belongsTo'](db[_0x5e09('0x8d')],{'as':_0x5e09('0x8d'),'foreignKey':_0x5e09('0x15f')});db[_0x5e09('0x3e')][_0x5e09('0x116')](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':_0x5e09('0x14a')});db['MailAccount'][_0x5e09('0x118')](db['User'],{'as':'Agents','through':_0x5e09('0x134')});db[_0x5e09('0x40')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x34')});db['MailQueue'][_0x5e09('0x118')](db['Team'],{'through':_0x5e09('0x160'),'as':_0x5e09('0x14d')});db[_0x5e09('0x44')]['hasMany'](db[_0x5e09('0x46')],{'as':_0x5e09('0x161'),'onDelete':_0x5e09('0x10c'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x5e09('0x116')](db[_0x5e09('0x3e')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x159')});db[_0x5e09('0x44')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x44')][_0x5e09('0x116')](db['User'],{'as':_0x5e09('0x164'),'foreignKey':_0x5e09('0x10a')});db['MailInteraction'][_0x5e09('0x118')](db['Tag'],{'through':_0x5e09('0x165'),'as':'Tags'});db[_0x5e09('0x44')][_0x5e09('0x118')](db['Tag'],{'through':_0x5e09('0x165'),'as':_0x5e09('0x166')});db[_0x5e09('0x44')]['belongsToMany'](db[_0x5e09('0x107')],{'as':_0x5e09('0x167'),'through':_0x5e09('0x11e'),'foreignKey':_0x5e09('0x168')});db[_0x5e09('0x46')][_0x5e09('0x10b')](db[_0x5e09('0xe7')],{'as':_0x5e09('0x169'),'onDelete':'cascade'});db['MailMessage'][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':_0x5e09('0x107')});db['MailMessage'][_0x5e09('0x116')](db[_0x5e09('0x71')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x163')});db[_0x5e09('0x46')][_0x5e09('0x116')](db[_0x5e09('0x44')],{'as':_0x5e09('0x16a'),'foreignKey':_0x5e09('0x168')});db[_0x5e09('0x46')]['belongsTo'](db[_0x5e09('0x3e')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x159')});db[_0x5e09('0x47')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x5e09('0x40')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x47')][_0x5e09('0x116')](db[_0x5e09('0x3e')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x47')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x147')});db['MailApplication'][_0x5e09('0x116')](db[_0x5e09('0x16c')],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x16d')});db[_0x5e09('0x49')]['belongsTo'](db[_0x5e09('0x3e')],{});db['MailQueueReport'][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db['MailQueueReport'][_0x5e09('0x116')](db['CmContact'],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x49')][_0x5e09('0x116')](db[_0x5e09('0x44')],{});db[_0x5e09('0x49')][_0x5e09('0x116')](db[_0x5e09('0x46')],{});db[_0x5e09('0x49')][_0x5e09('0x116')](db[_0x5e09('0x107')],{});db[_0x5e09('0x49')]['belongsTo'](db['MailQueue'],{});db[_0x5e09('0x16e')][_0x5e09('0x10b')](db[_0x5e09('0x4b')],{'as':_0x5e09('0x16f'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x4c')][_0x5e09('0x10b')](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':_0x5e09('0x171')});db[_0x5e09('0x4c')][_0x5e09('0x10b')](db[_0x5e09('0x7e')],{'as':_0x5e09('0x15c'),'foreignKey':_0x5e09('0x171')});db[_0x5e09('0x4c')]['hasMany'](db[_0x5e09('0x4e')],{'as':_0x5e09('0x172')});db[_0x5e09('0x4c')][_0x5e09('0x10b')](db[_0x5e09('0x4d')],{'as':_0x5e09('0x13e')});db['FaxAccount']['hasMany'](db[_0x5e09('0x18')],{'as':'Exntensions','onDelete':_0x5e09('0x10c')});db[_0x5e09('0x4c')][_0x5e09('0x10b')](db[_0x5e09('0x50')],{'as':_0x5e09('0x161')});db[_0x5e09('0x4c')][_0x5e09('0x116')](db[_0x5e09('0x2c')],{'as':_0x5e09('0x2c')});db['FaxAccount'][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':'ListId'});db[_0x5e09('0x4c')][_0x5e09('0x116')](db[_0x5e09('0x148')],{'as':'mandatoryDispositionPause','foreignKey':_0x5e09('0x14a')});db[_0x5e09('0x4c')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x5e09('0x116')](db['User'],{'onDelete':_0x5e09('0x16b')});db['FaxApplication'][_0x5e09('0x116')](db[_0x5e09('0x173')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x4d')]['belongsTo'](db[_0x5e09('0x4c')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x4d')]['belongsTo'](db[_0x5e09('0x16c')],{'onDelete':'restrict','foreignKey':_0x5e09('0x16d')});db[_0x5e09('0x4e')][_0x5e09('0x10b')](db['FaxMessage'],{'as':'Messages','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x174')});db[_0x5e09('0x4e')][_0x5e09('0x116')](db[_0x5e09('0x4c')],{'as':'Account','foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':'ContactId'});db[_0x5e09('0x4e')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':'Owner','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x4e')]['belongsToMany'](db['Tag'],{'through':_0x5e09('0x175'),'as':_0x5e09('0x176')});db[_0x5e09('0x4e')][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':_0x5e09('0x175'),'as':_0x5e09('0x166')});db[_0x5e09('0x4e')][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x167'),'through':_0x5e09('0x177'),'foreignKey':_0x5e09('0x174')});db['FaxMessage'][_0x5e09('0x116')](db[_0x5e09('0x107')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x107')});db[_0x5e09('0x50')][_0x5e09('0x116')](db['FaxInteraction'],{'as':_0x5e09('0x16a'),'foreignKey':_0x5e09('0x174')});db[_0x5e09('0x50')]['belongsTo'](db[_0x5e09('0x71')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x163')});db[_0x5e09('0x50')][_0x5e09('0x116')](db['Attachment'],{'as':_0x5e09('0xe7'),'foreignKey':'AttachmentId'});db[_0x5e09('0x50')][_0x5e09('0x116')](db[_0x5e09('0x4c')],{'as':_0x5e09('0x162'),'foreignKey':'FaxAccountId'});db[_0x5e09('0x173')]['belongsToMany'](db['User'],{'as':_0x5e09('0x14c'),'through':'UserFaxQueue'});db[_0x5e09('0x173')][_0x5e09('0x118')](db[_0x5e09('0xe0')],{'through':'team_has_fax_queues','as':_0x5e09('0x14d')});db[_0x5e09('0x178')]['belongsTo'](db['FaxAccount'],{});db[_0x5e09('0x178')][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0x178')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x178')][_0x5e09('0x116')](db[_0x5e09('0x4e')],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport']['belongsTo'](db[_0x5e09('0x107')],{});db[_0x5e09('0x178')][_0x5e09('0x116')](db['FaxQueue'],{});db[_0x5e09('0x54')]['hasMany'](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':_0x5e09('0x179')});db[_0x5e09('0x54')][_0x5e09('0x10b')](db[_0x5e09('0x7e')],{'as':_0x5e09('0x15c'),'foreignKey':'SmsAccountId'});db[_0x5e09('0x54')][_0x5e09('0x10b')](db[_0x5e09('0x58')],{'as':_0x5e09('0x161'),'foreignKey':_0x5e09('0x179')});db['SmsAccount'][_0x5e09('0x10b')](db[_0x5e09('0x56')],{'as':_0x5e09('0x172')});db[_0x5e09('0x54')]['hasMany'](db['SmsApplication'],{'as':_0x5e09('0x13e')});db['SmsAccount'][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0x54')][_0x5e09('0x116')](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':_0x5e09('0x14a')});db[_0x5e09('0x54')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':'Agents','through':_0x5e09('0x137')});db[_0x5e09('0x17a')]['belongsTo'](db[_0x5e09('0x107')],{'onDelete':_0x5e09('0x16b')});db['SmsApplication']['belongsTo'](db[_0x5e09('0x129')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x17a')]['belongsTo'](db[_0x5e09('0x54')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x17a')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x5e09('0x17a')][_0x5e09('0x116')](db[_0x5e09('0x16c')],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x16d')});db[_0x5e09('0x56')][_0x5e09('0x10b')](db[_0x5e09('0x58')],{'as':_0x5e09('0x161'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x17b')});db['SmsInteraction'][_0x5e09('0x116')](db[_0x5e09('0x54')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x179')});db[_0x5e09('0x56')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x56')][_0x5e09('0x116')](db['User'],{'as':'Owner','foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x56')]['belongsToMany'](db[_0x5e09('0x16c')],{'through':_0x5e09('0x17c'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0x5e09('0x16c')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x5e09('0x167'),'through':_0x5e09('0x121'),'foreignKey':'SmsInteractionId'});db[_0x5e09('0x58')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':_0x5e09('0x107')});db[_0x5e09('0x58')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'onDelete':'cascade','as':_0x5e09('0x163')});db[_0x5e09('0x58')][_0x5e09('0x116')](db[_0x5e09('0x56')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x16a'),'foreignKey':_0x5e09('0x17b')});db[_0x5e09('0x58')][_0x5e09('0x116')](db[_0x5e09('0x54')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x179')});db[_0x5e09('0x129')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x37'),'foreignKey':_0x5e09('0x17d')});db['SmsQueue'][_0x5e09('0x118')](db[_0x5e09('0xe0')],{'through':_0x5e09('0x17e'),'as':_0x5e09('0x14d')});db[_0x5e09('0x5a')][_0x5e09('0x10b')](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0x5e09('0x7e')],{'as':'Answers','foreignKey':_0x5e09('0x17f')});db[_0x5e09('0x5a')][_0x5e09('0x10b')](db[_0x5e09('0x122')],{'as':_0x5e09('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x5e09('0x5a')][_0x5e09('0x10b')](db[_0x5e09('0x5d')],{'as':_0x5e09('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0x5e09('0x5a')][_0x5e09('0x10b')](db[_0x5e09('0x5c')],{'as':_0x5e09('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0x5e09('0x5a')]['belongsTo'](db['CmList'],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0x5a')]['belongsTo'](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':_0x5e09('0x14a')});db[_0x5e09('0x5a')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x135')});db[_0x5e09('0x5c')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x5c')][_0x5e09('0x116')](db[_0x5e09('0x5e')],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x180')});db[_0x5e09('0x5c')][_0x5e09('0x116')](db['OpenchannelAccount'],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x17f')});db[_0x5e09('0x5c')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x147')});db[_0x5e09('0x5c')][_0x5e09('0x116')](db[_0x5e09('0x16c')],{'onDelete':'restrict','foreignKey':_0x5e09('0x16d')});db[_0x5e09('0x122')]['hasMany'](db[_0x5e09('0x5d')],{'as':'Messages','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x181')});db[_0x5e09('0x122')][_0x5e09('0x116')](db[_0x5e09('0x5a')],{'as':'Account','foreignKey':_0x5e09('0x17f')});db[_0x5e09('0x122')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x122')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':'Owner','foreignKey':_0x5e09('0x10a')});db['OpenchannelInteraction'][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':_0x5e09('0x182'),'as':_0x5e09('0x176')});db[_0x5e09('0x122')][_0x5e09('0x118')](db['Tag'],{'through':_0x5e09('0x182'),'as':_0x5e09('0x166')});db['OpenchannelInteraction'][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x167'),'through':_0x5e09('0x183'),'foreignKey':_0x5e09('0x181')});db[_0x5e09('0x5d')][_0x5e09('0x116')](db['User'],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x107')});db['OpenchannelMessage'][_0x5e09('0x116')](db['CmContact'],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x163')});db[_0x5e09('0x5d')][_0x5e09('0x116')](db[_0x5e09('0x122')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x16a'),'foreignKey':'OpenchannelInteractionId'});db[_0x5e09('0x5d')][_0x5e09('0x116')](db['Attachment'],{'as':_0x5e09('0xe7'),'foreignKey':'AttachmentId'});db[_0x5e09('0x5d')]['belongsTo'](db[_0x5e09('0x5a')],{'as':_0x5e09('0x162'),'foreignKey':'OpenchannelAccountId'});db[_0x5e09('0x5e')]['belongsToMany'](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x12c'),'foreignKey':_0x5e09('0x180')});db[_0x5e09('0x5e')][_0x5e09('0x118')](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x5e09('0x60')][_0x5e09('0x10b')](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':_0x5e09('0x184')});db[_0x5e09('0x60')][_0x5e09('0x10b')](db[_0x5e09('0x7e')],{'as':_0x5e09('0x15c'),'foreignKey':'ChatWebsiteId'});db[_0x5e09('0x60')]['hasMany'](db['ChatProactiveAction'],{'as':_0x5e09('0x185')});db[_0x5e09('0x60')][_0x5e09('0x10b')](db[_0x5e09('0x64')],{'as':'Interactions'});db[_0x5e09('0x60')][_0x5e09('0x10b')](db[_0x5e09('0x186')],{'as':'Applications'});db[_0x5e09('0x60')][_0x5e09('0x10b')](db[_0x5e09('0x65')],{'as':_0x5e09('0x161')});db[_0x5e09('0x60')][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0x60')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'as':'Interval','foreignKey':_0x5e09('0x147')});db[_0x5e09('0x60')]['belongsTo'](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5e09('0x60')][_0x5e09('0x118')](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db[_0x5e09('0x187')][_0x5e09('0x116')](db[_0x5e09('0x5a')],{});db[_0x5e09('0x187')][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':'List','foreignKey':_0x5e09('0x15e')});db[_0x5e09('0x187')]['belongsTo'](db[_0x5e09('0x71')],{'as':'Contact','foreignKey':_0x5e09('0x158')});db[_0x5e09('0x187')][_0x5e09('0x116')](db[_0x5e09('0x122')],{});db[_0x5e09('0x187')][_0x5e09('0x116')](db[_0x5e09('0x5d')],{});db[_0x5e09('0x187')][_0x5e09('0x116')](db[_0x5e09('0x107')],{});db[_0x5e09('0x187')]['belongsTo'](db[_0x5e09('0x5e')],{});db[_0x5e09('0x186')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':_0x5e09('0x188'),'foreignKey':_0x5e09('0x10a'),'onDelete':'restrict'});db[_0x5e09('0x186')][_0x5e09('0x116')](db[_0x5e09('0x69')],{'as':_0x5e09('0x189'),'foreignKey':_0x5e09('0x18a'),'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x186')][_0x5e09('0x116')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x5e09('0x16b')});db[_0x5e09('0x186')][_0x5e09('0x116')](db['Tag'],{'onDelete':_0x5e09('0x16b'),'foreignKey':_0x5e09('0x16d')});db['ChatInteraction'][_0x5e09('0x10b')](db[_0x5e09('0x65')],{'as':_0x5e09('0x161'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x18b')});db['ChatInteraction'][_0x5e09('0x116')](db[_0x5e09('0x60')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x184')});db['ChatInteraction'][_0x5e09('0x116')](db['CmContact'],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x64')]['belongsTo'](db['User'],{'as':_0x5e09('0x164'),'foreignKey':'UserId'});db['ChatInteraction'][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':'chat_interaction_has_tags','as':'Tags'});db[_0x5e09('0x64')][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':_0x5e09('0x18c'),'as':'ThroughTags'});db['ChatInteraction']['belongsToMany'](db[_0x5e09('0x107')],{'as':_0x5e09('0x167'),'through':_0x5e09('0x11f'),'foreignKey':_0x5e09('0x18b')});db['ChatMessage'][_0x5e09('0x116')](db[_0x5e09('0x107')],{'onDelete':_0x5e09('0x10c'),'as':'User'});db['ChatMessage'][_0x5e09('0x116')](db['CmContact'],{'onDelete':_0x5e09('0x10c'),'as':'Contact','foreignKey':_0x5e09('0x158')});db[_0x5e09('0x65')][_0x5e09('0x116')](db[_0x5e09('0x64')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x16a'),'foreignKey':'ChatInteractionId'});db[_0x5e09('0x65')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x5e09('0x18d')});db[_0x5e09('0x65')]['belongsTo'](db['ChatWebsite'],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x184')});db[_0x5e09('0x67')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db['ChatOfflineMessage']['belongsTo'](db[_0x5e09('0x60')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x184')});db['ChatQueue'][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x32'),'hooks':!![]});db[_0x5e09('0x69')][_0x5e09('0x118')](db[_0x5e09('0xe0')],{'through':_0x5e09('0x18e'),'as':_0x5e09('0x14d')});db[_0x5e09('0x6b')][_0x5e09('0x10b')](db[_0x5e09('0xcd')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0x5e09('0x10c')});db[_0x5e09('0x6b')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x18f'),'through':_0x5e09('0x117')});db[_0x5e09('0x6d')][_0x5e09('0x116')](db[_0x5e09('0x60')],{'as':'Website','foreignKey':_0x5e09('0x184')});db[_0x5e09('0x6f')]['hasMany'](db['CmContact'],{'as':_0x5e09('0x119'),'foreignKey':_0x5e09('0x190')});db[_0x5e09('0x71')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x5e09('0x158')});db['CmContact'][_0x5e09('0x10b')](db[_0x5e09('0x10d')],{'as':_0x5e09('0x191'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x71')]['hasMany'](db['CmHopperHistory'],{'as':_0x5e09('0x142'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0x71')][_0x5e09('0x10b')](db[_0x5e09('0x10f')],{'as':'ReportAgentPreview','foreignKey':_0x5e09('0x158')});db[_0x5e09('0x71')][_0x5e09('0x10b')](db[_0x5e09('0xd3')],{'as':'JscriptySessions','foreignKey':_0x5e09('0x158')});db[_0x5e09('0x71')][_0x5e09('0x10b')](db[_0x5e09('0x122')],{'as':_0x5e09('0x110'),'foreignKey':_0x5e09('0x158'),'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x71')][_0x5e09('0x10b')](db[_0x5e09('0x64')],{'as':_0x5e09('0x192'),'foreignKey':_0x5e09('0x158'),'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x71')][_0x5e09('0x10b')](db[_0x5e09('0x56')],{'as':_0x5e09('0x120'),'foreignKey':_0x5e09('0x158'),'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x71')]['hasMany'](db[_0x5e09('0x4e')],{'as':_0x5e09('0x111'),'foreignKey':_0x5e09('0x158'),'onDelete':'restrict'});db[_0x5e09('0x71')][_0x5e09('0x10b')](db['MailInteraction'],{'as':_0x5e09('0x112'),'foreignKey':_0x5e09('0x158'),'onDelete':'restrict'});db[_0x5e09('0x71')][_0x5e09('0x116')](db[_0x5e09('0x6f')],{'as':'Company','foreignKey':_0x5e09('0x190')});db[_0x5e09('0x71')][_0x5e09('0x116')](db['CmList'],{'as':'List','foreignKey':_0x5e09('0x15e'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x71')][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x167'),'through':_0x5e09('0x11a')});db[_0x5e09('0x71')]['belongsToMany'](db[_0x5e09('0x16c')],{'as':_0x5e09('0x176'),'through':'cm_contact_has_tags'});db['CmContact'][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':_0x5e09('0x193'),'as':'ThroughTags'});db[_0x5e09('0x73')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x73')][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x73')]['belongsTo'](db[_0x5e09('0x107')],{'as':_0x5e09('0x188'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0x73')][_0x5e09('0x116')](db[_0x5e09('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x5e09('0x10c')});db['CmHopper'][_0x5e09('0x116')](db[_0x5e09('0xe4')],{'as':_0x5e09('0xe4'),'foreignKey':_0x5e09('0x194'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x73')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':_0x5e09('0x164'),'foreignKey':'OwnerId'});db[_0x5e09('0x75')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':'Contact','foreignKey':_0x5e09('0x158'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x75')]['belongsTo'](db[_0x5e09('0xf2')],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e'),'onDelete':'cascade'});db['CmHopperBlack'][_0x5e09('0x116')](db[_0x5e09('0x1c')],{'as':_0x5e09('0x189'),'foreignKey':_0x5e09('0x141'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x75')]['belongsTo'](db[_0x5e09('0xe4')],{'as':_0x5e09('0xe4'),'foreignKey':_0x5e09('0x194'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x7c')][_0x5e09('0x10b')](db[_0x5e09('0x81')],{'as':{'plural':_0x5e09('0x195'),'singular':_0x5e09('0x196')},'foreignKey':_0x5e09('0x197'),'onDelete':'cascade','hooks':!![]});db[_0x5e09('0x7c')]['hasMany'](db[_0x5e09('0x81')],{'as':{'plural':_0x5e09('0x198'),'singular':_0x5e09('0x199')},'foreignKey':_0x5e09('0x19a'),'onDelete':_0x5e09('0x10c'),'hooks':!![]});db['Automation'][_0x5e09('0x10b')](db[_0x5e09('0x19b')],{'as':_0x5e09('0x19c'),'foreignKey':_0x5e09('0x19d'),'onDelete':_0x5e09('0x10c'),'hooks':!![]});db[_0x5e09('0x80')][_0x5e09('0x10b')](db[_0x5e09('0x80')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0x5e09('0x10c')});db[_0x5e09('0x83')][_0x5e09('0x10b')](db[_0x5e09('0x83')],{'as':_0x5e09('0x19e'),'foreignKey':_0x5e09('0x147'),'onDelete':_0x5e09('0x10c'),'hooks':!![],'required':![]});db['Interval'][_0x5e09('0x10b')](db[_0x5e09('0x18')],{'as':'Extensions','foreignKey':_0x5e09('0x147'),'onDelete':'restrict'});db[_0x5e09('0x83')][_0x5e09('0x10b')](db['MailApplication'],{'as':_0x5e09('0x19f'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0x5e09('0x1a0'),'foreignKey':_0x5e09('0x147')});db[_0x5e09('0x83')][_0x5e09('0x10b')](db[_0x5e09('0x4d')],{'as':_0x5e09('0x1a1'),'foreignKey':'IntervalId'});db['Interval'][_0x5e09('0x10b')](db[_0x5e09('0x17a')],{'as':_0x5e09('0x1a2'),'foreignKey':_0x5e09('0x147')});db[_0x5e09('0x88')][_0x5e09('0x116')](db[_0x5e09('0x3e')],{});db[_0x5e09('0x88')][_0x5e09('0x116')](db[_0x5e09('0x97')],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x5e09('0x116')](db[_0x5e09('0x1a3')],{'foreignKey':_0x5e09('0x1a4')});db[_0x5e09('0x8a')][_0x5e09('0x118')](db[_0x5e09('0x1a')],{'as':'Mohs','through':_0x5e09('0x140'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db[_0x5e09('0x71')],{'through':_0x5e09('0x193')});db[_0x5e09('0x16c')][_0x5e09('0x118')](db[_0x5e09('0x64')],{'through':_0x5e09('0x18c')});db['Tag'][_0x5e09('0x118')](db['MailInteraction'],{'through':_0x5e09('0x165')});db[_0x5e09('0x16c')][_0x5e09('0x118')](db[_0x5e09('0x56')],{'through':_0x5e09('0x17c')});db[_0x5e09('0x16c')]['belongsToMany'](db[_0x5e09('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x5e09('0x16c')][_0x5e09('0x118')](db[_0x5e09('0x122')],{'through':_0x5e09('0x182')});db[_0x5e09('0x16c')][_0x5e09('0x118')](db[_0x5e09('0xfc')],{'through':_0x5e09('0x1a5')});db[_0x5e09('0x8f')][_0x5e09('0x10b')](db[_0x5e09('0x81')],{'as':{'plural':_0x5e09('0x1a6'),'singular':'AllCondition'},'foreignKey':_0x5e09('0x1a7'),'onDelete':_0x5e09('0x10c'),'hooks':!![]});db['Trigger'][_0x5e09('0x10b')](db[_0x5e09('0x81')],{'as':{'plural':_0x5e09('0x1a8'),'singular':_0x5e09('0x1a9')},'foreignKey':'TriggerAnyId','onDelete':_0x5e09('0x10c'),'hooks':!![]});db[_0x5e09('0x8f')]['hasMany'](db[_0x5e09('0x19b')],{'as':_0x5e09('0x19c'),'foreignKey':_0x5e09('0x1aa'),'onDelete':_0x5e09('0x10c'),'hooks':!![]});db[_0x5e09('0x1a3')][_0x5e09('0x10b')](db[_0x5e09('0x9c')],{'as':_0x5e09('0x1ab'),'onDelete':'cascade','foreignKey':_0x5e09('0x1a4'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x5e09('0x9c')],{'as':_0x5e09('0x1ab'),'onDelete':'cascade','foreignKey':_0x5e09('0x1ac')});db[_0x5e09('0x9b')][_0x5e09('0x10b')](db[_0x5e09('0x9c')],{'as':_0x5e09('0x1ab'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1ad')});db[_0x5e09('0x9c')][_0x5e09('0x116')](db[_0x5e09('0x9b')],{'foreignKey':_0x5e09('0x1ad')});db['SalesforceAccount'][_0x5e09('0x10b')](db[_0x5e09('0xa1')],{'as':_0x5e09('0x1ae'),'onDelete':'cascade','foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xa1')]['hasMany'](db[_0x5e09('0x1b0')],{'as':'Subjects','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xa1')][_0x5e09('0x10b')](db[_0x5e09('0x1b0')],{'as':_0x5e09('0x1b2'),'onDelete':'cascade','foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0xa1')]['hasMany'](db[_0x5e09('0x1b0')],{'as':_0x5e09('0x1ab'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xa1')]['belongsTo'](db['SalesforceAccount'],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0x1b0')][_0x5e09('0x10b')](db[_0x5e09('0x1b0')],{'as':_0x5e09('0x1b5'),'foreignKey':'SubjectId'});db[_0x5e09('0x1b0')][_0x5e09('0x10b')](db[_0x5e09('0x1b0')],{'as':'Description','foreignKey':'DescriptionId'});db['SalesforceField'][_0x5e09('0x10b')](db[_0x5e09('0x1b0')],{'as':'Field','foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0x1b0')][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':'VariableId'});db[_0x5e09('0xa3')][_0x5e09('0x10b')](db[_0x5e09('0xa4')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db['SugarcrmConfiguration']['hasMany'](db[_0x5e09('0xa5')],{'as':_0x5e09('0x1b6'),'onDelete':'cascade','foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xa4')]['hasMany'](db['SugarcrmField'],{'as':_0x5e09('0x1b2'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0xa4')][_0x5e09('0x10b')](db[_0x5e09('0xa5')],{'as':_0x5e09('0x1ab'),'onDelete':_0x5e09('0x10c'),'foreignKey':'FieldId'});db[_0x5e09('0xa4')][_0x5e09('0x116')](db[_0x5e09('0xa3')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xa5')][_0x5e09('0x10b')](db[_0x5e09('0xa5')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xa5')]['hasMany'](db[_0x5e09('0xa5')],{'as':_0x5e09('0x1b7'),'foreignKey':_0x5e09('0x1b3')});db['SugarcrmField'][_0x5e09('0x10b')](db[_0x5e09('0xa5')],{'as':_0x5e09('0x1b8'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xa5')][_0x5e09('0x116')](db['Variable'],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0xa7')][_0x5e09('0x10b')](db[_0x5e09('0xa9')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xa9')][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':_0x5e09('0x1b6'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b1')});db['DeskConfiguration'][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':'Descriptions','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b3')});db['DeskConfiguration'][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':_0x5e09('0x1ab'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x5e09('0xa9')][_0x5e09('0x116')](db[_0x5e09('0xa7')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xa9')]['belongsToMany'](db[_0x5e09('0x16c')],{'through':_0x5e09('0x1ba')});db['DeskField'][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xab')][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':_0x5e09('0x1b7'),'foreignKey':'DescriptionId'});db[_0x5e09('0xab')][_0x5e09('0x10b')](db[_0x5e09('0xab')],{'as':'Field','foreignKey':_0x5e09('0x1b4')});db['DeskField']['belongsTo'](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0xad')][_0x5e09('0x10b')](db['ZohoConfiguration'],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xaf')][_0x5e09('0x10b')](db[_0x5e09('0xb0')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x5e09('0xaf')][_0x5e09('0x10b')](db['ZohoField'],{'as':_0x5e09('0x1b2'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b3')});db['ZohoConfiguration'][_0x5e09('0x10b')](db[_0x5e09('0xb0')],{'as':_0x5e09('0x1ab'),'onDelete':'cascade','foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xaf')][_0x5e09('0x116')](db[_0x5e09('0xad')],{'as':'Account','foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0x5e09('0xb0')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xb0')][_0x5e09('0x10b')](db[_0x5e09('0xb0')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5e09('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x5e09('0x1b8'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xb0')][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0x1bb')]['hasMany'](db[_0x5e09('0xb3')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xb3')][_0x5e09('0x10b')](db['ZendeskField'],{'as':_0x5e09('0x1b6'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xb3')][_0x5e09('0x10b')](db[_0x5e09('0xb5')],{'as':_0x5e09('0x1b2'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0xb3')][_0x5e09('0x10b')](db['ZendeskField'],{'as':_0x5e09('0x1ab'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xb3')][_0x5e09('0x116')](db[_0x5e09('0x1bb')],{'as':'Account','foreignKey':_0x5e09('0x1af')});db['ZendeskConfiguration'][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x5e09('0x10b')](db['ZendeskField'],{'as':_0x5e09('0x1b5'),'foreignKey':'SubjectId'});db[_0x5e09('0xb5')]['hasMany'](db[_0x5e09('0xb5')],{'as':_0x5e09('0x1b7'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0xb5')][_0x5e09('0x10b')](db['ZendeskField'],{'as':_0x5e09('0x1b8'),'foreignKey':'FieldId'});db[_0x5e09('0xb5')][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0x1bc')][_0x5e09('0x10b')](db['FreshdeskConfiguration'],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0x1bd')][_0x5e09('0x10b')](db[_0x5e09('0xb9')],{'as':'Subjects','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0x1bd')][_0x5e09('0x10b')](db['FreshdeskField'],{'as':_0x5e09('0x1b2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x5e09('0x1bd')][_0x5e09('0x10b')](db[_0x5e09('0xb9')],{'as':'Fields','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b4')});db['FreshdeskConfiguration']['belongsTo'](db[_0x5e09('0x1bc')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db['FreshdeskConfiguration'][_0x5e09('0x118')](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0x5e09('0xb9')][_0x5e09('0x10b')](db[_0x5e09('0xb9')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xb9')][_0x5e09('0x10b')](db['FreshdeskField'],{'as':_0x5e09('0x1b7'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0x5e09('0x10b')](db['FreshdeskField'],{'as':'Field','foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xb9')][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0xba')][_0x5e09('0x10b')](db[_0x5e09('0xbc')],{'as':_0x5e09('0x1ae'),'onDelete':'cascade','foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xbc')][_0x5e09('0x10b')](db[_0x5e09('0xbe')],{'as':_0x5e09('0x1b6'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xbc')][_0x5e09('0x10b')](db[_0x5e09('0xbe')],{'as':_0x5e09('0x1b2'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0xbc')][_0x5e09('0x10b')](db['VtigerField'],{'as':'Fields','foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xbc')][_0x5e09('0x116')](db[_0x5e09('0xba')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0xbe')][_0x5e09('0x10b')](db[_0x5e09('0xbe')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xbe')][_0x5e09('0x10b')](db[_0x5e09('0xbe')],{'as':'Description','foreignKey':_0x5e09('0x1b3')});db['VtigerField'][_0x5e09('0x10b')](db[_0x5e09('0xbe')],{'as':_0x5e09('0x1b8'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0xbe')]['belongsTo'](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db['ServicenowAccount'][_0x5e09('0x10b')](db[_0x5e09('0x1be')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':'AccountId'});db[_0x5e09('0x1be')][_0x5e09('0x10b')](db[_0x5e09('0x1bf')],{'as':_0x5e09('0x1b6'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0x1be')][_0x5e09('0x10b')](db[_0x5e09('0x1bf')],{'as':_0x5e09('0x1b2'),'foreignKey':'DescriptionId'});db[_0x5e09('0x1be')]['hasMany'](db['ServicenowField'],{'as':_0x5e09('0x1ab'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0x1be')][_0x5e09('0x116')](db[_0x5e09('0xbf')],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0x1bf')][_0x5e09('0x10b')](db[_0x5e09('0x1bf')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0x1bf')][_0x5e09('0x10b')](db[_0x5e09('0x1bf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5e09('0x1bf')][_0x5e09('0x10b')](db[_0x5e09('0x1bf')],{'as':_0x5e09('0x1b8'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0x1bf')][_0x5e09('0x116')](db['Variable'],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0xc2')][_0x5e09('0x10b')](db[_0x5e09('0x1c0')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0x1c0')][_0x5e09('0x10b')](db[_0x5e09('0x1c1')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x5e09('0x1c0')][_0x5e09('0x10b')](db[_0x5e09('0x1c1')],{'as':_0x5e09('0x1b2'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db[_0x5e09('0x1c1')],{'as':'Fields','onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1b4')});db[_0x5e09('0x1c0')]['belongsTo'](db[_0x5e09('0xc2')],{'as':'Account','foreignKey':'AccountId'});db[_0x5e09('0x1c1')][_0x5e09('0x10b')](db[_0x5e09('0x1c1')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0x1c1')]['hasMany'](db[_0x5e09('0x1c1')],{'as':_0x5e09('0x1b7'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0x1c1')]['hasMany'](db[_0x5e09('0x1c1')],{'as':_0x5e09('0x1b8'),'foreignKey':_0x5e09('0x1b4')});db['Dynamics365Field'][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':_0x5e09('0x1b9')});db[_0x5e09('0xc6')][_0x5e09('0x10b')](db[_0x5e09('0xc7')],{'as':_0x5e09('0x1ae'),'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1af')});db['FreshsalesConfiguration'][_0x5e09('0x10b')](db[_0x5e09('0x1c2')],{'as':_0x5e09('0x1b6'),'foreignKey':_0x5e09('0x1b1')});db[_0x5e09('0xc7')][_0x5e09('0x10b')](db[_0x5e09('0x1c2')],{'as':_0x5e09('0x1b2'),'foreignKey':_0x5e09('0x1b3')});db['FreshsalesConfiguration'][_0x5e09('0x10b')](db['FreshsalesField'],{'as':_0x5e09('0x1ab'),'foreignKey':_0x5e09('0x1b4')});db['FreshsalesConfiguration'][_0x5e09('0x116')](db['FreshsalesAccount'],{'as':_0x5e09('0x162'),'foreignKey':_0x5e09('0x1af')});db[_0x5e09('0x1c2')][_0x5e09('0x10b')](db[_0x5e09('0x1c2')],{'as':_0x5e09('0x1b5'),'foreignKey':_0x5e09('0x1b1')});db['FreshsalesField']['hasMany'](db[_0x5e09('0x1c2')],{'as':_0x5e09('0x1b7'),'foreignKey':_0x5e09('0x1b3')});db[_0x5e09('0x1c2')][_0x5e09('0x10b')](db[_0x5e09('0x1c2')],{'as':'Field','foreignKey':_0x5e09('0x1b4')});db['FreshsalesField'][_0x5e09('0x116')](db[_0x5e09('0x91')],{'as':_0x5e09('0x91'),'foreignKey':'VariableId'});db[_0x5e09('0xcb')][_0x5e09('0x116')](db[_0x5e09('0x60')],{});db[_0x5e09('0xcb')][_0x5e09('0x116')](db['CmList'],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xcb')]['belongsTo'](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0xcb')][_0x5e09('0x116')](db['ChatInteraction'],{});db[_0x5e09('0xcb')][_0x5e09('0x116')](db['ChatMessage'],{});db[_0x5e09('0xcb')][_0x5e09('0x116')](db['User'],{});db[_0x5e09('0xcb')][_0x5e09('0x116')](db['ChatQueue'],{});db['ChatInternalMessage']['belongsTo'](db[_0x5e09('0x107')],{'onDelete':_0x5e09('0x10c'),'foreignKey':_0x5e09('0x1c3')});db[_0x5e09('0xcd')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'onDelete':'cascade','foreignKey':_0x5e09('0x1c4')});db[_0x5e09('0xd3')][_0x5e09('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':_0x5e09('0x1c5'),'onDelete':'cascade'});db[_0x5e09('0xd3')][_0x5e09('0x10b')](db[_0x5e09('0xcf')],{'foreignKey':'SessionId','onDelete':_0x5e09('0x10c')});db[_0x5e09('0xd4')][_0x5e09('0x116')](db['SmsAccount'],{});db[_0x5e09('0xd4')][_0x5e09('0x116')](db['CmList'],{'as':'List','foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xd4')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0xd4')]['belongsTo'](db[_0x5e09('0x56')],{});db[_0x5e09('0xd4')][_0x5e09('0x116')](db[_0x5e09('0x58')],{});db[_0x5e09('0xd4')][_0x5e09('0x116')](db[_0x5e09('0x107')],{});db[_0x5e09('0xd4')]['belongsTo'](db['SmsQueue'],{});db[_0x5e09('0xd9')]['hasMany'](db[_0x5e09('0xd3')],{'foreignKey':_0x5e09('0x1c6')});db[_0x5e09('0xd9')][_0x5e09('0x10b')](db[_0x5e09('0xd1')],{'foreignKey':_0x5e09('0x1c6')});db[_0x5e09('0xd9')][_0x5e09('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x5e09('0xdc')][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x167'),'through':'user_has_square_projects'});db[_0x5e09('0xe0')][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x11d')});db[_0x5e09('0xe0')][_0x5e09('0x118')](db['VoiceQueue'],{'through':_0x5e09('0x14e'),'as':_0x5e09('0x124')});db[_0x5e09('0xe0')][_0x5e09('0x118')](db[_0x5e09('0x40')],{'through':_0x5e09('0x160'),'as':_0x5e09('0x126')});db[_0x5e09('0xe0')]['belongsToMany'](db['ChatQueue'],{'through':_0x5e09('0x18e'),'as':_0x5e09('0x127')});db[_0x5e09('0xe0')]['belongsToMany'](db[_0x5e09('0x173')],{'through':_0x5e09('0x1c7'),'as':_0x5e09('0x128')});db['Team'][_0x5e09('0x118')](db[_0x5e09('0x129')],{'through':_0x5e09('0x17e'),'as':'SmsQueues'});db[_0x5e09('0xe0')][_0x5e09('0x118')](db[_0x5e09('0x5e')],{'through':_0x5e09('0x1c8'),'as':_0x5e09('0x12b')});db[_0x5e09('0xe0')][_0x5e09('0x118')](db[_0x5e09('0x103')],{'through':_0x5e09('0x1c9'),'as':'WhatsappQueues'});db['Campaign'][_0x5e09('0x10b')](db['CmHopper'],{'as':_0x5e09('0x1ca'),'foreignKey':'CampaignId'});db['Campaign'][_0x5e09('0x10b')](db[_0x5e09('0x10d')],{'as':_0x5e09('0x191'),'foreignKey':_0x5e09('0x194')});db[_0x5e09('0xe4')]['hasMany'](db[_0x5e09('0x78')],{'as':'HopperHistories','foreignKey':_0x5e09('0x194')});db[_0x5e09('0xe4')][_0x5e09('0x10b')](db[_0x5e09('0x75')],{'as':_0x5e09('0x143'),'foreignKey':_0x5e09('0x194')});db[_0x5e09('0xe4')][_0x5e09('0x116')](db['Trunk'],{'as':_0x5e09('0x2c'),'foreignKey':_0x5e09('0x145')});db[_0x5e09('0xe4')][_0x5e09('0x116')](db[_0x5e09('0x2c')],{'as':_0x5e09('0x1cb'),'foreignKey':_0x5e09('0x146')});db[_0x5e09('0xe4')][_0x5e09('0x116')](db[_0x5e09('0x83')],{'as':_0x5e09('0x83'),'foreignKey':_0x5e09('0x147')});db['Campaign']['belongsTo'](db['SquareProject'],{'as':_0x5e09('0xdc'),'foreignKey':_0x5e09('0x1cc')});db[_0x5e09('0xe4')][_0x5e09('0x118')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x11b'),'through':_0x5e09('0x1cd')});db[_0x5e09('0xe4')][_0x5e09('0x118')](db[_0x5e09('0xf2')],{'as':_0x5e09('0x14f'),'through':'campaigns_has_cm_blacklists'});db[_0x5e09('0xe9')][_0x5e09('0x116')](db[_0x5e09('0x46')],{});db[_0x5e09('0xe9')][_0x5e09('0x116')](db[_0x5e09('0x44')],{});db['MailTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x3e')],{'foreignKey':_0x5e09('0x1ce'),'as':_0x5e09('0x1cf')});db['MailTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d0'),'as':'FromAgent'});db[_0x5e09('0xe9')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d1'),'as':_0x5e09('0x1d2')});db[_0x5e09('0xe9')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x5e09('0x1d3')});db['MailTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x3e')],{'foreignKey':_0x5e09('0x1d4'),'as':_0x5e09('0x1d5')});db[_0x5e09('0xea')][_0x5e09('0x116')](db[_0x5e09('0x65')],{});db[_0x5e09('0xea')][_0x5e09('0x116')](db['ChatInteraction'],{});db[_0x5e09('0xea')][_0x5e09('0x116')](db[_0x5e09('0x60')],{'foreignKey':_0x5e09('0x1d6'),'as':_0x5e09('0x1cf')});db['ChatTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d0'),'as':'FromAgent'});db[_0x5e09('0xea')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d1'),'as':_0x5e09('0x1d2')});db[_0x5e09('0xea')][_0x5e09('0x116')](db[_0x5e09('0x69')],{'foreignKey':_0x5e09('0x1d7'),'as':'ToQueue'});db[_0x5e09('0xea')][_0x5e09('0x116')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x5e09('0x1d5')});db['FaxTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x50')],{});db[_0x5e09('0xec')]['belongsTo'](db[_0x5e09('0x4e')],{});db[_0x5e09('0xec')][_0x5e09('0x116')](db[_0x5e09('0x4c')],{'foreignKey':_0x5e09('0x1d8'),'as':_0x5e09('0x1cf')});db[_0x5e09('0xec')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d0'),'as':_0x5e09('0x1d9')});db['FaxTransferReport']['belongsTo'](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d1'),'as':_0x5e09('0x1d2')});db[_0x5e09('0xec')][_0x5e09('0x116')](db['FaxQueue'],{'foreignKey':_0x5e09('0x1da'),'as':_0x5e09('0x1d3')});db[_0x5e09('0xec')][_0x5e09('0x116')](db[_0x5e09('0x4c')],{'foreignKey':_0x5e09('0x1db'),'as':'ToAccount'});db[_0x5e09('0xee')][_0x5e09('0x116')](db['OpenchannelMessage'],{});db[_0x5e09('0xee')][_0x5e09('0x116')](db[_0x5e09('0x122')],{});db[_0x5e09('0xee')][_0x5e09('0x116')](db[_0x5e09('0x5a')],{'foreignKey':_0x5e09('0x1dc'),'as':_0x5e09('0x1cf')});db[_0x5e09('0xee')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d0'),'as':_0x5e09('0x1d9')});db[_0x5e09('0xee')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d1'),'as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x5e09('0x1dd'),'as':_0x5e09('0x1d3')});db[_0x5e09('0xee')]['belongsTo'](db[_0x5e09('0x5a')],{'foreignKey':_0x5e09('0x1de'),'as':_0x5e09('0x1d5')});db[_0x5e09('0xf0')]['belongsTo'](db['SmsMessage'],{});db[_0x5e09('0xf0')][_0x5e09('0x116')](db['SmsInteraction'],{});db[_0x5e09('0xf0')][_0x5e09('0x116')](db['SmsAccount'],{'foreignKey':_0x5e09('0x1df'),'as':'FromAccount'});db[_0x5e09('0xf0')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d0'),'as':'FromAgent'});db[_0x5e09('0xf0')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'foreignKey':_0x5e09('0x1d1'),'as':_0x5e09('0x1d2')});db[_0x5e09('0xf0')]['belongsTo'](db['SmsQueue'],{'foreignKey':_0x5e09('0x1e0'),'as':'ToQueue'});db[_0x5e09('0xf0')][_0x5e09('0x116')](db[_0x5e09('0x54')],{'foreignKey':_0x5e09('0x1e1'),'as':_0x5e09('0x1d5')});db['CmList']['hasMany'](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xf2')]['hasMany'](db[_0x5e09('0x7a')],{'as':'CustomFields','foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xf2')][_0x5e09('0x10b')](db[_0x5e09('0x71')],{'as':_0x5e09('0x119'),'onDelete':_0x5e09('0x10c'),'foreignKey':'ListId'});db[_0x5e09('0xf2')][_0x5e09('0x10b')](db['CmHopperFinal'],{'as':_0x5e09('0x191'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xf2')][_0x5e09('0x10b')](db[_0x5e09('0x78')],{'as':_0x5e09('0x10e'),'foreignKey':'ListId'});db[_0x5e09('0xf2')][_0x5e09('0x10b')](db['ReportAgentPreview'],{'as':_0x5e09('0x10f'),'foreignKey':'ListId'});db[_0x5e09('0xf2')][_0x5e09('0x118')](db['VoiceQueue'],{'as':_0x5e09('0x1e2'),'through':_0x5e09('0x14b')});db[_0x5e09('0xf2')]['belongsToMany'](db['User'],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x11c')});db[_0x5e09('0xf3')]['hasMany'](db[_0x5e09('0x18')],{'as':'Extensions','onDelete':_0x5e09('0x10c')});db[_0x5e09('0xf3')]['belongsToMany'](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x12f')});db[_0x5e09('0xf4')][_0x5e09('0x10b')](db['User'],{'as':_0x5e09('0x167'),'foreignKey':_0x5e09('0x1e3')});db[_0x5e09('0xf4')]['hasMany'](db[_0x5e09('0xf6')],{'as':_0x5e09('0x1e4'),'foreignKey':_0x5e09('0x1e3'),'onDelete':_0x5e09('0x10c')});db['UserProfileSection'][_0x5e09('0x10b')](db[_0x5e09('0x1e5')],{'as':_0x5e09('0x1e6'),'foreignKey':_0x5e09('0x1e7'),'onDelete':_0x5e09('0x10c')});db[_0x5e09('0x138')][_0x5e09('0x10b')](db[_0x5e09('0x80')],{'as':_0x5e09('0x170'),'foreignKey':_0x5e09('0x1e8')});db[_0x5e09('0x138')][_0x5e09('0x10b')](db[_0x5e09('0x7e')],{'as':_0x5e09('0x15c'),'foreignKey':'WhatsappAccountId'});db[_0x5e09('0x138')][_0x5e09('0x10b')](db[_0x5e09('0x1e9')],{'as':_0x5e09('0x161'),'foreignKey':_0x5e09('0x1e8')});db[_0x5e09('0x138')]['hasMany'](db[_0x5e09('0xfc')],{'as':_0x5e09('0x172')});db['WhatsappAccount'][_0x5e09('0x10b')](db[_0x5e09('0x1ea')],{'as':'Applications'});db[_0x5e09('0x138')][_0x5e09('0x116')](db[_0x5e09('0xf2')],{'as':'List','foreignKey':'ListId'});db[_0x5e09('0x138')]['belongsTo'](db[_0x5e09('0x148')],{'as':_0x5e09('0x149'),'foreignKey':_0x5e09('0x14a')});db[_0x5e09('0x138')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x139')});db['WhatsappApplication'][_0x5e09('0x116')](db['User'],{'onDelete':_0x5e09('0x16b')});db[_0x5e09('0x1ea')][_0x5e09('0x116')](db[_0x5e09('0x103')],{'onDelete':_0x5e09('0x16b')});db['WhatsappApplication'][_0x5e09('0x116')](db[_0x5e09('0x138')],{'onDelete':_0x5e09('0x16b')});db['WhatsappApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db['WhatsappApplication'][_0x5e09('0x116')](db[_0x5e09('0x16c')],{'onDelete':'restrict','foreignKey':_0x5e09('0x16d')});db[_0x5e09('0xfc')]['hasMany'](db[_0x5e09('0x1e9')],{'as':_0x5e09('0x161'),'onDelete':'cascade','foreignKey':_0x5e09('0x1eb')});db[_0x5e09('0xfc')][_0x5e09('0x116')](db[_0x5e09('0x138')],{'as':'Account','foreignKey':_0x5e09('0x1e8')});db[_0x5e09('0xfc')][_0x5e09('0x116')](db['CmContact'],{'as':_0x5e09('0x163'),'foreignKey':_0x5e09('0x158')});db[_0x5e09('0xfc')][_0x5e09('0x116')](db[_0x5e09('0x107')],{'as':_0x5e09('0x164'),'foreignKey':_0x5e09('0x10a')});db[_0x5e09('0xfc')][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':'whatsapp_interaction_has_tags','as':_0x5e09('0x176')});db[_0x5e09('0xfc')][_0x5e09('0x118')](db[_0x5e09('0x16c')],{'through':_0x5e09('0x1a5'),'as':_0x5e09('0x166')});db[_0x5e09('0xfc')][_0x5e09('0x118')](db['User'],{'as':_0x5e09('0x167'),'through':_0x5e09('0x123'),'foreignKey':_0x5e09('0x1eb')});db['WhatsappMessage']['belongsTo'](db[_0x5e09('0x107')],{'as':'User'});db[_0x5e09('0x1e9')][_0x5e09('0x116')](db['CmContact'],{'onDelete':_0x5e09('0x10c'),'as':_0x5e09('0x163')});db[_0x5e09('0x1e9')][_0x5e09('0x116')](db[_0x5e09('0xfc')],{'onDelete':'cascade','as':_0x5e09('0x16a'),'foreignKey':'WhatsappInteractionId'});db[_0x5e09('0x1e9')]['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x5e09('0xff')][_0x5e09('0x116')](db[_0x5e09('0x138')],{});db[_0x5e09('0xff')][_0x5e09('0x116')](db['CmList'],{'as':_0x5e09('0x15d'),'foreignKey':_0x5e09('0x15e')});db[_0x5e09('0xff')][_0x5e09('0x116')](db[_0x5e09('0x71')],{'as':_0x5e09('0x163'),'foreignKey':'ContactId'});db[_0x5e09('0xff')][_0x5e09('0x116')](db[_0x5e09('0xfc')],{});db[_0x5e09('0xff')][_0x5e09('0x116')](db[_0x5e09('0x103')],{});db[_0x5e09('0xff')][_0x5e09('0x116')](db[_0x5e09('0x1e9')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x5e09('0x107')],{});db[_0x5e09('0x101')][_0x5e09('0x116')](db[_0x5e09('0x1e9')],{});db[_0x5e09('0x101')][_0x5e09('0x116')](db[_0x5e09('0xfc')],{});db[_0x5e09('0x101')][_0x5e09('0x116')](db[_0x5e09('0x138')],{'foreignKey':_0x5e09('0x1ec'),'as':'FromAccount'});db[_0x5e09('0x101')][_0x5e09('0x116')](db['WhatsappAccount'],{'foreignKey':_0x5e09('0x1ed'),'as':_0x5e09('0x1d5')});db['WhatsappTransferReport'][_0x5e09('0x116')](db[_0x5e09('0x103')],{'foreignKey':'ToQueueId','as':_0x5e09('0x1d3')});db['WhatsappTransferReport']['belongsTo'](db[_0x5e09('0x107')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x5e09('0x101')][_0x5e09('0x116')](db['User'],{'foreignKey':_0x5e09('0x1d1'),'as':_0x5e09('0x1d2')});db[_0x5e09('0x103')][_0x5e09('0x118')](db[_0x5e09('0x107')],{'as':_0x5e09('0x14c'),'through':_0x5e09('0x3a'),'foreignKey':_0x5e09('0x1ee')});db[_0x5e09('0x103')][_0x5e09('0x118')](db[_0x5e09('0xe0')],{'through':_0x5e09('0x1c9'),'as':_0x5e09('0x14d')});module[_0x5e09('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xd7a6=['../api/mailServerOut/mailServerOut.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.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','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','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','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','cascade','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','WhatsappInteractions','Notification','Notifications','belongsTo','Groups','belongsToMany','CmContact','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteractions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','UserVoiceQueue','MailQueues','SmsQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','Applications','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','team_has_voice_queues','BlackLists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceCallReport','Contact','ContactId','MailAccount','MailAccountId','Imap','Smtp','Dispositions','Answers','List','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Account','restrict','IntervalId','TagId','FaxAccountId','Interactions','Exntensions','FaxInteractionId','Interaction','Attachment','AttachmentId','SmsAccount','SmsAccountId','SmsApplication','SmsMessage','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','chat_group_has_users','ChatProactiveAction','CmCompany','CompanyId','FaxInteractions','cm_contact_has_tags','Campaign','CampaignId','OwnerId','AutomationAllId','Any','OneAny','Actions','Intervals','MailApplications','ChatApplications','Schedule','AnalyticDefaultReport','DefaultReportId','sms_interaction_has_tags','fax_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','CustomReportId','AnalyticMetric','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','Description','Configurations','DeskField','Subject','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','ServicenowConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','ChatQueues','FaxQueues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','mysql','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd7a6,0x1b3));var _0x6d7a=function(_0x4651f7,_0x58fc78){_0x4651f7=_0x4651f7-0x0;var _0x3a0ad5=_0xd7a6[_0x4651f7];return _0x3a0ad5;};'use strict';var path=require('path');var config=require(_0x6d7a('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0x6d7a('0x1'));var timezone=jstz[_0x6d7a('0x2')]();config[_0x6d7a('0x3')]=_[_0x6d7a('0x4')](config[_0x6d7a('0x3')],{'database':_0x6d7a('0x5'),'username':_0x6d7a('0x6'),'password':_0x6d7a('0x7'),'options':{'host':_0x6d7a('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x6d7a('0x9')},'logging':![],'timezone':timezone[_0x6d7a('0xa')](),'define':{'charset':_0x6d7a('0xb'),'collate':_0x6d7a('0xc')}}});config[_0x6d7a('0xd')]=_[_0x6d7a('0x4')](config['sequelizeHistory'],{'database':_0x6d7a('0x5'),'username':_0x6d7a('0x6'),'password':'xC@LL1234','options':{'host':_0x6d7a('0x8'),'port':0xcea,'dialect':_0x6d7a('0xe'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x6d7a('0xb'),'collate':_0x6d7a('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6d7a('0x3')][_0x6d7a('0xf')],config[_0x6d7a('0x3')]['username'],config[_0x6d7a('0x3')][_0x6d7a('0x10')],config[_0x6d7a('0x3')][_0x6d7a('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x6d7a('0xf')],config[_0x6d7a('0xd')]['username'],config[_0x6d7a('0xd')]['password'],config[_0x6d7a('0xd')][_0x6d7a('0x11')])};db[_0x6d7a('0x12')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x14'));db[_0x6d7a('0x15')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x16'));db[_0x6d7a('0x17')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x18'));db[_0x6d7a('0x19')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x6d7a('0x1a')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x6d7a('0x1b')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x1c'));db[_0x6d7a('0x1d')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x1e'));db[_0x6d7a('0x1f')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x20'));db[_0x6d7a('0x21')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x22'));db[_0x6d7a('0x23')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize']['import'](_0x6d7a('0x24'));db[_0x6d7a('0x25')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x26'));db[_0x6d7a('0x27')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x28'));db['VoiceQueueReport']=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x6d7a('0x29')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x2a'));db[_0x6d7a('0x2b')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x2c'));db[_0x6d7a('0x2d')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x2e'));db[_0x6d7a('0x2f')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x30'));db['UserVoiceQueue']=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x6d7a('0x31')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x32'));db[_0x6d7a('0x33')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x34'));db[_0x6d7a('0x35')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0x6d7a('0x36')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x37'));db[_0x6d7a('0x38')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x39'));db[_0x6d7a('0x3a')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x6d7a('0x3b')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x3c'));db[_0x6d7a('0x3d')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x3e'));db['MailAccount']=db[_0x6d7a('0x3')]['import']('../api/mailAccount/mailAccount.model');db[_0x6d7a('0x3f')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x40'));db[_0x6d7a('0x41')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x42'));db[_0x6d7a('0x43')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x44'));db[_0x6d7a('0x45')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/mailMessage/mailMessage.model');db[_0x6d7a('0x46')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/mailApplication/mailApplication.model');db[_0x6d7a('0x47')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x48'));db[_0x6d7a('0x49')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/dashboard/dashboard.model');db[_0x6d7a('0x4a')]=db['sequelize'][_0x6d7a('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x6d7a('0x4b')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x4c'));db[_0x6d7a('0x4d')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x4e'));db['FaxInteraction']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x4f'));db[_0x6d7a('0x50')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x51'));db[_0x6d7a('0x52')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x53'));db[_0x6d7a('0x54')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x55'));db['SmsAccount']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x56'));db['SmsApplication']=db['sequelize']['import'](_0x6d7a('0x57'));db[_0x6d7a('0x58')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x59'));db['SmsMessage']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x5a'));db[_0x6d7a('0x5b')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/smsQueue/smsQueue.model');db[_0x6d7a('0x5c')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/openchannelAccount/openchannelAccount.model');db[_0x6d7a('0x5d')]=db['sequelize']['import'](_0x6d7a('0x5e'));db[_0x6d7a('0x5f')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x60'));db[_0x6d7a('0x61')]=db['sequelize'][_0x6d7a('0x13')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x62'));db[_0x6d7a('0x63')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x64'));db[_0x6d7a('0x65')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x66'));db['ChatInteraction']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x67'));db[_0x6d7a('0x68')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x69'));db['ChatOfflineMessage']=db['sequelize']['import'](_0x6d7a('0x6a'));db[_0x6d7a('0x6b')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x6c'));db[_0x6d7a('0x6d')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x6e'));db['ChatProactiveAction']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x6f'));db['CmCompany']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x70'));db['CmContact']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x71'));db[_0x6d7a('0x72')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/cmHopper/cmHopper.model');db[_0x6d7a('0x73')]=db['sequelize'][_0x6d7a('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x74'));db[_0x6d7a('0x75')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x76'));db[_0x6d7a('0x77')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x78'));db[_0x6d7a('0x79')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x7a'));db[_0x6d7a('0x7b')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x7c'));db[_0x6d7a('0x7d')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x7e'));db[_0x6d7a('0x7f')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x80'));db[_0x6d7a('0x81')]=db[_0x6d7a('0x3')]['import']('../api/disposition/disposition.model');db[_0x6d7a('0x82')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x83'));db[_0x6d7a('0x84')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x85'));db[_0x6d7a('0x86')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x87'));db[_0x6d7a('0x88')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x89'));db['VoiceQueuesLog']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x8a'));db['Schedule']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x8b'));db[_0x6d7a('0x8c')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x8d'));db[_0x6d7a('0x8e')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x8f'));db[_0x6d7a('0x90')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/template/template.model');db[_0x6d7a('0x91')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x92'));db[_0x6d7a('0x93')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x94'));db[_0x6d7a('0x95')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x96'));db['IntegrationReport']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x97'));db[_0x6d7a('0x98')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x99'));db['AnalyticDefaultReport']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x9a'));db[_0x6d7a('0x9b')]=db['sequelize'][_0x6d7a('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x9c'));db[_0x6d7a('0x9d')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x9e'));db[_0x6d7a('0x9f')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6d7a('0xa0')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xa1'));db[_0x6d7a('0xa2')]=db[_0x6d7a('0x3')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x6d7a('0xa3')]=db['sequelize']['import'](_0x6d7a('0xa4'));db[_0x6d7a('0xa5')]=db['sequelize']['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x6d7a('0xa6')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xa7'));db[_0x6d7a('0xa8')]=db['sequelize']['import'](_0x6d7a('0xa9'));db[_0x6d7a('0xaa')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xab'));db[_0x6d7a('0xac')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xad'));db['DeskField']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xae'));db[_0x6d7a('0xaf')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xb0'));db[_0x6d7a('0xb1')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x6d7a('0xb2')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xb3'));db[_0x6d7a('0xb4')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xb5'));db[_0x6d7a('0xb6')]=db[_0x6d7a('0x3')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x6d7a('0xb7')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xb8'));db[_0x6d7a('0xb9')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xba'));db[_0x6d7a('0xbb')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xbc'));db[_0x6d7a('0xbd')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xbe'));db[_0x6d7a('0xbf')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x6d7a('0xc0')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xc1'));db['ServicenowAccount']=db['sequelize']['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xc2'));db[_0x6d7a('0xc3')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xc4'));db[_0x6d7a('0xc5')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xc6'));db[_0x6d7a('0xc7')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x6d7a('0xc8')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xc9'));db[_0x6d7a('0xca')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xcb'));db[_0x6d7a('0xcc')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xcd'));db[_0x6d7a('0xce')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xcf'));db[_0x6d7a('0x95')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x96'));db[_0x6d7a('0xd0')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xd1'));db[_0x6d7a('0xd2')]=db['sequelize'][_0x6d7a('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6d7a('0xd3')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xd4'));db[_0x6d7a('0xd5')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xd6'));db[_0x6d7a('0xd7')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xd8'));db[_0x6d7a('0xd9')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xda'));db[_0x6d7a('0xdb')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xdc'));db[_0x6d7a('0xdd')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/squareReport/squareReport.model');db[_0x6d7a('0xde')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xdf'));db['JscriptyProject']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xe0'));db[_0x6d7a('0xe1')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xe2'));db['SquareOdbc']=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xe3'));db['SquareProject']=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/squareProject/squareProject.model');db[_0x6d7a('0xe4')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xe5'));db[_0x6d7a('0xe6')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/squareMessage/squareMessage.model');db[_0x6d7a('0xe7')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xe8'));db[_0x6d7a('0xe9')]=db['sequelize']['import'](_0x6d7a('0xea'));db['Campaign']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xeb'));db[_0x6d7a('0xec')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xed'));db['Attachment']=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/attachment/attachment.model');db[_0x6d7a('0xee')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xef'));db[_0x6d7a('0xf0')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xf1'));db['ChatTransferReport']=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xf2'));db[_0x6d7a('0xf3')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xf4'));db['OpenchannelTransferReport']=db[_0x6d7a('0x3')]['import'](_0x6d7a('0xf5'));db[_0x6d7a('0xf6')]=db['sequelize']['import'](_0x6d7a('0xf7'));db['CmList']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xf8'));db[_0x6d7a('0xf9')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0x6d7a('0xfa')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xfb'));db[_0x6d7a('0xfc')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0xfd'));db['UserProfileResource']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xfe'));db['Notification']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0xff'));db[_0x6d7a('0x100')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x101'));db[_0x6d7a('0x102')]=db[_0x6d7a('0x3')][_0x6d7a('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x6d7a('0x103')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x104'));db[_0x6d7a('0x105')]=db[_0x6d7a('0x3')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x6d7a('0x106')]=db['sequelize'][_0x6d7a('0x13')](_0x6d7a('0x107'));db[_0x6d7a('0x108')]=db['sequelize']['import'](_0x6d7a('0x109'));db[_0x6d7a('0x10a')]=db[_0x6d7a('0x3')]['import'](_0x6d7a('0x10b'));db['CloudProvider']=db[_0x6d7a('0x3')][_0x6d7a('0x13')](_0x6d7a('0x10c'));db[_0x6d7a('0x12')][_0x6d7a('0x10d')](db[_0x6d7a('0x21')],{'as':_0x6d7a('0x21'),'onDelete':'cascade','foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db['VoiceRecording'],{'as':_0x6d7a('0x110'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')]['hasMany'](db[_0x6d7a('0x2f')],{'as':_0x6d7a('0x111'),'foreignKey':_0x6d7a('0x10e')});db['User'][_0x6d7a('0x10f')](db[_0x6d7a('0x19')],{'as':_0x6d7a('0x112'),'onDelete':_0x6d7a('0x113'),'hooks':!![]});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x114')],{'as':_0x6d7a('0x115'),'foreignKey':_0x6d7a('0x10e')});db['User'][_0x6d7a('0x10f')](db[_0x6d7a('0x75')],{'as':_0x6d7a('0x116'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x77')],{'as':_0x6d7a('0x77'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x5f')],{'as':_0x6d7a('0x117'),'foreignKey':'UserId'});db['User'][_0x6d7a('0x10f')](db['ChatInteraction'],{'as':_0x6d7a('0x118'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x58')],{'as':_0x6d7a('0x119'),'foreignKey':_0x6d7a('0x10e')});db['User'][_0x6d7a('0x10f')](db[_0x6d7a('0x11a')],{'as':'FaxInteractions','foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x43')],{'as':'MailInteractions','foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x12')][_0x6d7a('0x10f')](db[_0x6d7a('0x103')],{'as':_0x6d7a('0x11b'),'foreignKey':'UserId'});db[_0x6d7a('0x12')]['hasMany'](db[_0x6d7a('0x11c')],{'as':_0x6d7a('0x11d'),'foreignKey':'SenderId'});db['User'][_0x6d7a('0x11e')](db[_0x6d7a('0xfa')],{'as':_0x6d7a('0xfa'),'foreignKey':'userProfileId'});db[_0x6d7a('0x12')]['belongsToMany'](db[_0x6d7a('0x6d')],{'as':_0x6d7a('0x11f'),'through':'chat_group_has_users'});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x122'),'through':_0x6d7a('0x123')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x125'),'through':_0x6d7a('0x126')});db['User'][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'through':_0x6d7a('0x127')});db['User']['belongsToMany'](db['MailInteraction'],{'as':_0x6d7a('0x128'),'through':'user_has_mail_interactions'});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x129')],{'as':_0x6d7a('0x118'),'through':_0x6d7a('0x12a')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x11a')],{'as':'FaxInteractions','through':_0x6d7a('0x12b')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x6d7a('0x12c')});db['User'][_0x6d7a('0x120')](db['OpenchannelInteraction'],{'as':_0x6d7a('0x117'),'through':_0x6d7a('0x12d')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x103')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x1b')],{'as':_0x6d7a('0x12e'),'through':_0x6d7a('0x12f'),'required':![]});db['User'][_0x6d7a('0x120')](db[_0x6d7a('0x3f')],{'as':_0x6d7a('0x130'),'through':_0x6d7a('0x33'),'required':![]});db[_0x6d7a('0x12')]['belongsToMany'](db[_0x6d7a('0x6b')],{'as':'ChatQueues','through':_0x6d7a('0x31'),'required':![],'hooks':!![]});db[_0x6d7a('0x12')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0x6d7a('0x12')]['belongsToMany'](db[_0x6d7a('0x5b')],{'as':_0x6d7a('0x131'),'through':_0x6d7a('0x36'),'required':![]});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x6d7a('0x38'),'required':![]});db[_0x6d7a('0x12')]['belongsToMany'](db[_0x6d7a('0x10a')],{'as':_0x6d7a('0x132'),'through':_0x6d7a('0x3a'),'required':![]});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x124')],{'through':_0x6d7a('0x126')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0xf9')],{'as':_0x6d7a('0x133'),'through':_0x6d7a('0x134'),'required':![]});db[_0x6d7a('0x12')]['belongsToMany'](db[_0x6d7a('0x135')],{'as':_0x6d7a('0x136'),'through':_0x6d7a('0x137')});db['User'][_0x6d7a('0x120')](db['FaxAccount'],{'as':_0x6d7a('0x138'),'through':_0x6d7a('0x139')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db['MailAccount'],{'as':_0x6d7a('0x13a'),'through':_0x6d7a('0x13b')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db['OpenchannelAccount'],{'as':_0x6d7a('0x13c'),'through':_0x6d7a('0x13d')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db['SmsAccount'],{'as':_0x6d7a('0x13e'),'through':_0x6d7a('0x13f')});db[_0x6d7a('0x12')][_0x6d7a('0x120')](db[_0x6d7a('0x100')],{'as':_0x6d7a('0x140'),'through':_0x6d7a('0x141')});db['User'][_0x6d7a('0x120')](db[_0x6d7a('0x142')],{'as':_0x6d7a('0x143'),'through':_0x6d7a('0x144')});db[_0x6d7a('0x15')][_0x6d7a('0x10f')](db[_0x6d7a('0x19')],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x6d7a('0x17')][_0x6d7a('0x10f')](db['VoiceExtension'],{'onDelete':_0x6d7a('0x113')});db['VoiceExtension'][_0x6d7a('0x10f')](db[_0x6d7a('0x19')],{'as':_0x6d7a('0x145'),'onDelete':'cascade'});db[_0x6d7a('0x1a')][_0x6d7a('0x120')](db[_0x6d7a('0x8c')],{'as':_0x6d7a('0x146'),'through':_0x6d7a('0x147')});db[_0x6d7a('0x1b')][_0x6d7a('0x10f')](db[_0x6d7a('0x2f')],{'as':'Members','foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')][_0x6d7a('0x10f')](db[_0x6d7a('0x72')],{'as':_0x6d7a('0x149'),'foreignKey':_0x6d7a('0x148')});db['VoiceQueue'][_0x6d7a('0x10f')](db['CmHopperFinal'],{'as':_0x6d7a('0x115'),'foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')][_0x6d7a('0x10f')](db['CmHopperHistory'],{'as':_0x6d7a('0x14a'),'foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')]['hasMany'](db[_0x6d7a('0x77')],{'as':_0x6d7a('0x77'),'foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')][_0x6d7a('0x10f')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')]['hasMany'](db[_0x6d7a('0xd9')],{'as':_0x6d7a('0x14b'),'foreignKey':_0x6d7a('0x148')});db[_0x6d7a('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x6d7a('0x2b'),'foreignKey':_0x6d7a('0x14c')});db[_0x6d7a('0x1b')][_0x6d7a('0x11e')](db[_0x6d7a('0x2b')],{'as':_0x6d7a('0x14d'),'foreignKey':_0x6d7a('0x14e')});db['VoiceQueue'][_0x6d7a('0x11e')](db[_0x6d7a('0x84')],{'as':'Interval','foreignKey':'IntervalId'});db['VoiceQueue'][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':_0x6d7a('0x14f'),'foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x1b')][_0x6d7a('0x120')](db[_0x6d7a('0x124')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x6d7a('0x1b')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x12f')});db[_0x6d7a('0x1b')][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'as':_0x6d7a('0x152'),'through':_0x6d7a('0x153')});db[_0x6d7a('0x1b')][_0x6d7a('0x120')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x154'),'through':'voice_queues_has_cm_blacklists'});db[_0x6d7a('0x1d')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x12'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x1f')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x12'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x21')][_0x6d7a('0x10f')](db[_0x6d7a('0x23')],{'as':_0x6d7a('0x155'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x156'),'sourceKey':_0x6d7a('0x157')});db[_0x6d7a('0x23')]['belongsTo'](db['VoiceMail'],{'foreignKey':_0x6d7a('0x156'),'targetKey':_0x6d7a('0x157')});db['VoiceCallReport'][_0x6d7a('0x10f')](db['VoiceQueueReport'],{'as':_0x6d7a('0x158'),'foreignKey':_0x6d7a('0x159'),'constraints':![]});db[_0x6d7a('0x15a')][_0x6d7a('0x10f')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x6d7a('0x15a')]['belongsTo'](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x12'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x15a')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x3b')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{'as':_0x6d7a('0x15d'),'foreignKey':_0x6d7a('0x15e')});db[_0x6d7a('0x3d')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{'as':'MailAccount','foreignKey':_0x6d7a('0x15e')});db[_0x6d7a('0x15d')][_0x6d7a('0x10d')](db[_0x6d7a('0x3b')],{'as':_0x6d7a('0x15f'),'onDelete':_0x6d7a('0x113')});db['MailAccount'][_0x6d7a('0x10d')](db[_0x6d7a('0x3d')],{'as':_0x6d7a('0x160'),'onDelete':'cascade'});db['MailAccount'][_0x6d7a('0x10f')](db[_0x6d7a('0x81')],{'as':_0x6d7a('0x161'),'foreignKey':_0x6d7a('0x15e')});db['MailAccount'][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':_0x6d7a('0x162'),'foreignKey':_0x6d7a('0x15e')});db[_0x6d7a('0x15d')]['hasMany'](db['MailMessage'],{'as':'Messages','foreignKey':_0x6d7a('0x15e')});db[_0x6d7a('0x15d')][_0x6d7a('0x10f')](db[_0x6d7a('0x43')],{'as':'Interactions'});db['MailAccount'][_0x6d7a('0x10f')](db['MailApplication'],{'as':_0x6d7a('0x145')});db[_0x6d7a('0x15d')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x15d')][_0x6d7a('0x11e')](db[_0x6d7a('0x90')],{'as':_0x6d7a('0x90'),'foreignKey':_0x6d7a('0x165')});db[_0x6d7a('0x15d')][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':_0x6d7a('0x14f'),'foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x15d')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Agents','through':_0x6d7a('0x13b')});db['MailQueue'][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x33')});db[_0x6d7a('0x3f')][_0x6d7a('0x120')](db['Team'],{'through':_0x6d7a('0x166'),'as':_0x6d7a('0x152')});db[_0x6d7a('0x43')][_0x6d7a('0x10f')](db['MailMessage'],{'as':_0x6d7a('0x155'),'onDelete':'cascade','foreignKey':_0x6d7a('0x167')});db[_0x6d7a('0x43')][_0x6d7a('0x11e')](db['MailAccount'],{'as':'Account','foreignKey':_0x6d7a('0x15e')});db['MailInteraction'][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x43')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x168'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x43')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x169'),'as':_0x6d7a('0x16a')});db[_0x6d7a('0x43')]['belongsToMany'](db[_0x6d7a('0x8e')],{'through':'mail_interaction_has_tags','as':_0x6d7a('0x16b')});db[_0x6d7a('0x43')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x16c'),'through':_0x6d7a('0x16d'),'foreignKey':_0x6d7a('0x167')});db[_0x6d7a('0x45')][_0x6d7a('0x10f')](db['Attachment'],{'as':_0x6d7a('0x16e'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x45')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x12')});db[_0x6d7a('0x45')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'onDelete':_0x6d7a('0x113'),'as':_0x6d7a('0x15b')});db['MailMessage'][_0x6d7a('0x11e')](db[_0x6d7a('0x43')],{'as':'Interaction','foreignKey':'MailInteractionId'});db['MailMessage'][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x15e')});db[_0x6d7a('0x46')]['belongsTo'](db['User'],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x46')][_0x6d7a('0x11e')](db[_0x6d7a('0x3f')],{'onDelete':'restrict'});db[_0x6d7a('0x46')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x46')][_0x6d7a('0x11e')](db[_0x6d7a('0x84')],{'onDelete':'restrict','foreignKey':_0x6d7a('0x171')});db['MailApplication']['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6d7a('0x172')});db[_0x6d7a('0x47')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{});db[_0x6d7a('0x47')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x47')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x47')]['belongsTo'](db[_0x6d7a('0x43')],{});db['MailQueueReport'][_0x6d7a('0x11e')](db['MailMessage'],{});db[_0x6d7a('0x47')][_0x6d7a('0x11e')](db['User'],{});db[_0x6d7a('0x47')][_0x6d7a('0x11e')](db[_0x6d7a('0x3f')],{});db[_0x6d7a('0x49')][_0x6d7a('0x10f')](db[_0x6d7a('0x4a')],{'as':'Items','onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x4b')][_0x6d7a('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':'FaxAccountId'});db[_0x6d7a('0x4b')][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':_0x6d7a('0x162'),'foreignKey':_0x6d7a('0x173')});db[_0x6d7a('0x4b')][_0x6d7a('0x10f')](db['FaxInteraction'],{'as':_0x6d7a('0x174')});db['FaxAccount']['hasMany'](db[_0x6d7a('0x4d')],{'as':'Applications'});db[_0x6d7a('0x4b')][_0x6d7a('0x10f')](db['VoiceExtension'],{'as':_0x6d7a('0x175'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x4b')]['hasMany'](db['FaxMessage'],{'as':_0x6d7a('0x155')});db[_0x6d7a('0x4b')][_0x6d7a('0x11e')](db['Trunk'],{'as':_0x6d7a('0x2b')});db[_0x6d7a('0x4b')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':'ListId'});db['FaxAccount'][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':_0x6d7a('0x14f'),'foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x4b')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Agents','through':_0x6d7a('0x139')});db[_0x6d7a('0x4d')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x4d')][_0x6d7a('0x11e')](db[_0x6d7a('0x52')],{'onDelete':'restrict'});db[_0x6d7a('0x4d')][_0x6d7a('0x11e')](db[_0x6d7a('0x4b')],{'onDelete':'restrict'});db[_0x6d7a('0x4d')][_0x6d7a('0x11e')](db[_0x6d7a('0x8e')],{'onDelete':_0x6d7a('0x170'),'foreignKey':'TagId'});db[_0x6d7a('0x11a')][_0x6d7a('0x10f')](db[_0x6d7a('0x50')],{'as':_0x6d7a('0x155'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x176')});db[_0x6d7a('0x11a')][_0x6d7a('0x11e')](db[_0x6d7a('0x4b')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x173')});db[_0x6d7a('0x11a')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':'Contact','foreignKey':'ContactId'});db[_0x6d7a('0x11a')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x168'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x11a')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':'fax_interaction_has_tags','as':_0x6d7a('0x16a')});db[_0x6d7a('0x11a')]['belongsToMany'](db[_0x6d7a('0x8e')],{'through':'fax_interaction_has_tags','as':_0x6d7a('0x16b')});db[_0x6d7a('0x11a')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x16c'),'through':_0x6d7a('0x12b'),'foreignKey':_0x6d7a('0x176')});db[_0x6d7a('0x50')]['belongsTo'](db[_0x6d7a('0x12')],{'onDelete':'cascade','as':_0x6d7a('0x12')});db['FaxMessage']['belongsTo'](db[_0x6d7a('0x11a')],{'as':_0x6d7a('0x177'),'foreignKey':_0x6d7a('0x176')});db[_0x6d7a('0x50')][_0x6d7a('0x11e')](db['CmContact'],{'onDelete':_0x6d7a('0x113'),'as':_0x6d7a('0x15b')});db[_0x6d7a('0x50')][_0x6d7a('0x11e')](db[_0x6d7a('0x178')],{'as':_0x6d7a('0x178'),'foreignKey':_0x6d7a('0x179')});db[_0x6d7a('0x50')][_0x6d7a('0x11e')](db[_0x6d7a('0x4b')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x173')});db[_0x6d7a('0x52')]['belongsToMany'](db['User'],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x35')});db[_0x6d7a('0x52')][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'through':'team_has_fax_queues','as':_0x6d7a('0x152')});db[_0x6d7a('0x54')][_0x6d7a('0x11e')](db['FaxAccount'],{});db[_0x6d7a('0x54')][_0x6d7a('0x11e')](db['CmList'],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x54')][_0x6d7a('0x11e')](db['CmContact'],{'as':_0x6d7a('0x15b'),'foreignKey':'ContactId'});db[_0x6d7a('0x54')]['belongsTo'](db[_0x6d7a('0x11a')],{});db[_0x6d7a('0x54')][_0x6d7a('0x11e')](db['FaxMessage'],{});db[_0x6d7a('0x54')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{});db['FaxQueueReport'][_0x6d7a('0x11e')](db['FaxQueue'],{});db[_0x6d7a('0x17a')][_0x6d7a('0x10f')](db[_0x6d7a('0x81')],{'as':_0x6d7a('0x161'),'foreignKey':_0x6d7a('0x17b')});db[_0x6d7a('0x17a')][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':_0x6d7a('0x162'),'foreignKey':_0x6d7a('0x17b')});db[_0x6d7a('0x17a')][_0x6d7a('0x10f')](db['SmsMessage'],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0x6d7a('0x17a')]['hasMany'](db[_0x6d7a('0x58')],{'as':_0x6d7a('0x174')});db[_0x6d7a('0x17a')][_0x6d7a('0x10f')](db[_0x6d7a('0x17c')],{'as':'Applications'});db[_0x6d7a('0x17a')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x17a')][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':_0x6d7a('0x14f'),'foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x17a')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x6d7a('0x13f')});db[_0x6d7a('0x17c')][_0x6d7a('0x11e')](db['User'],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x17c')][_0x6d7a('0x11e')](db['SmsQueue'],{'onDelete':_0x6d7a('0x170')});db['SmsApplication'][_0x6d7a('0x11e')](db[_0x6d7a('0x17a')],{'onDelete':'restrict'});db[_0x6d7a('0x17c')][_0x6d7a('0x11e')](db[_0x6d7a('0x84')],{'onDelete':_0x6d7a('0x170'),'foreignKey':_0x6d7a('0x171')});db['SmsApplication'][_0x6d7a('0x11e')](db[_0x6d7a('0x8e')],{'onDelete':'restrict','foreignKey':_0x6d7a('0x172')});db[_0x6d7a('0x58')][_0x6d7a('0x10f')](db[_0x6d7a('0x17d')],{'as':'Messages','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x17e')});db[_0x6d7a('0x58')][_0x6d7a('0x11e')](db[_0x6d7a('0x17a')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x17b')});db[_0x6d7a('0x58')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db['SmsInteraction'][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x168'),'foreignKey':'UserId'});db[_0x6d7a('0x58')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':'sms_interaction_has_tags','as':_0x6d7a('0x16a')});db[_0x6d7a('0x58')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':'sms_interaction_has_tags','as':_0x6d7a('0x16b')});db[_0x6d7a('0x58')][_0x6d7a('0x120')](db['User'],{'as':'Users','through':_0x6d7a('0x12c'),'foreignKey':_0x6d7a('0x17e')});db['SmsMessage'][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x12')});db[_0x6d7a('0x17d')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0x6d7a('0x15b')});db[_0x6d7a('0x17d')][_0x6d7a('0x11e')](db['SmsInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x6d7a('0x17e')});db[_0x6d7a('0x17d')][_0x6d7a('0x11e')](db[_0x6d7a('0x17a')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x17b')});db[_0x6d7a('0x5b')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x36'),'foreignKey':_0x6d7a('0x17f')});db[_0x6d7a('0x5b')][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'through':'team_has_sms_queues','as':_0x6d7a('0x152')});db[_0x6d7a('0x5c')][_0x6d7a('0x10f')](db['Disposition'],{'as':_0x6d7a('0x161'),'foreignKey':_0x6d7a('0x180')});db[_0x6d7a('0x5c')][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':'Answers','foreignKey':_0x6d7a('0x180')});db[_0x6d7a('0x5c')][_0x6d7a('0x10f')](db['OpenchannelInteraction'],{'as':_0x6d7a('0x174'),'foreignKey':_0x6d7a('0x180')});db['OpenchannelAccount'][_0x6d7a('0x10f')](db[_0x6d7a('0x181')],{'as':_0x6d7a('0x155'),'foreignKey':_0x6d7a('0x180')});db[_0x6d7a('0x5c')][_0x6d7a('0x10f')](db[_0x6d7a('0x5d')],{'as':_0x6d7a('0x145'),'foreignKey':'OpenchannelAccountId'});db[_0x6d7a('0x5c')]['belongsTo'](db['CmList'],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x5c')][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':_0x6d7a('0x14f'),'foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x5c')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Agents','through':_0x6d7a('0x13d')});db['OpenchannelApplication']['belongsTo'](db[_0x6d7a('0x12')],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x5d')][_0x6d7a('0x11e')](db['OpenchannelQueue'],{'onDelete':_0x6d7a('0x170'),'foreignKey':_0x6d7a('0x182')});db[_0x6d7a('0x5d')]['belongsTo'](db[_0x6d7a('0x5c')],{'onDelete':'restrict','foreignKey':_0x6d7a('0x180')});db[_0x6d7a('0x5d')][_0x6d7a('0x11e')](db['Interval'],{'onDelete':_0x6d7a('0x170'),'foreignKey':_0x6d7a('0x171')});db['OpenchannelApplication'][_0x6d7a('0x11e')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x6d7a('0x172')});db['OpenchannelInteraction'][_0x6d7a('0x10f')](db[_0x6d7a('0x181')],{'as':_0x6d7a('0x155'),'onDelete':_0x6d7a('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x6d7a('0x5f')][_0x6d7a('0x11e')](db[_0x6d7a('0x5c')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x180')});db[_0x6d7a('0x5f')][_0x6d7a('0x11e')](db['CmContact'],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db['OpenchannelInteraction'][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x168'),'foreignKey':'UserId'});db[_0x6d7a('0x5f')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x183'),'as':_0x6d7a('0x16a')});db[_0x6d7a('0x5f')][_0x6d7a('0x120')](db['Tag'],{'through':_0x6d7a('0x183'),'as':'ThroughTags'});db[_0x6d7a('0x5f')][_0x6d7a('0x120')](db['User'],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x6d7a('0x181')]['belongsTo'](db['User'],{'onDelete':'cascade','as':_0x6d7a('0x12')});db[_0x6d7a('0x181')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'onDelete':'cascade','as':_0x6d7a('0x15b')});db[_0x6d7a('0x181')]['belongsTo'](db[_0x6d7a('0x5f')],{'onDelete':_0x6d7a('0x113'),'as':_0x6d7a('0x177'),'foreignKey':_0x6d7a('0x184')});db[_0x6d7a('0x181')][_0x6d7a('0x11e')](db[_0x6d7a('0x178')],{'as':'Attachment','foreignKey':_0x6d7a('0x179')});db[_0x6d7a('0x181')][_0x6d7a('0x11e')](db['OpenchannelAccount'],{'as':_0x6d7a('0x16f'),'foreignKey':'OpenchannelAccountId'});db[_0x6d7a('0x61')][_0x6d7a('0x120')](db['User'],{'as':'Agents','through':_0x6d7a('0x38'),'foreignKey':_0x6d7a('0x182')});db[_0x6d7a('0x61')][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'through':_0x6d7a('0x185'),'as':_0x6d7a('0x152')});db[_0x6d7a('0x135')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6d7a('0x186')});db[_0x6d7a('0x135')][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':'Answers','foreignKey':_0x6d7a('0x186')});db['ChatWebsite'][_0x6d7a('0x10f')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x6d7a('0x135')][_0x6d7a('0x10f')](db['ChatInteraction'],{'as':_0x6d7a('0x174')});db['ChatWebsite'][_0x6d7a('0x10f')](db[_0x6d7a('0x65')],{'as':_0x6d7a('0x145')});db[_0x6d7a('0x135')][_0x6d7a('0x10f')](db[_0x6d7a('0x68')],{'as':'Messages'});db['ChatWebsite'][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':'ListId'});db[_0x6d7a('0x135')][_0x6d7a('0x11e')](db[_0x6d7a('0x84')],{'as':'Interval','foreignKey':_0x6d7a('0x171')});db[_0x6d7a('0x135')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x135')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':'user_has_chat_websites'});db[_0x6d7a('0x63')]['belongsTo'](db[_0x6d7a('0x5c')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x63')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x63')][_0x6d7a('0x11e')](db[_0x6d7a('0x5f')],{});db[_0x6d7a('0x63')][_0x6d7a('0x11e')](db[_0x6d7a('0x181')],{});db[_0x6d7a('0x63')][_0x6d7a('0x11e')](db['User'],{});db[_0x6d7a('0x63')][_0x6d7a('0x11e')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x6d7a('0x11e')](db['User'],{'as':_0x6d7a('0x187'),'foreignKey':'UserId','onDelete':'restrict'});db[_0x6d7a('0x65')][_0x6d7a('0x11e')](db['ChatQueue'],{'as':_0x6d7a('0x188'),'foreignKey':_0x6d7a('0x189'),'onDelete':_0x6d7a('0x170')});db['ChatApplication'][_0x6d7a('0x11e')](db[_0x6d7a('0x135')],{'as':_0x6d7a('0x18a'),'foreignKey':_0x6d7a('0x186'),'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x65')][_0x6d7a('0x11e')](db[_0x6d7a('0x8e')],{'onDelete':_0x6d7a('0x170'),'foreignKey':_0x6d7a('0x172')});db['ChatInteraction']['hasMany'](db['ChatMessage'],{'as':_0x6d7a('0x155'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x18b')});db[_0x6d7a('0x129')][_0x6d7a('0x11e')](db[_0x6d7a('0x135')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x186')});db[_0x6d7a('0x129')]['belongsTo'](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':'ContactId'});db[_0x6d7a('0x129')][_0x6d7a('0x11e')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x6d7a('0x129')]['belongsToMany'](db['Tag'],{'through':_0x6d7a('0x18c'),'as':'Tags'});db['ChatInteraction']['belongsToMany'](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x18c'),'as':_0x6d7a('0x16b')});db[_0x6d7a('0x129')]['belongsToMany'](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x16c'),'through':_0x6d7a('0x12a'),'foreignKey':_0x6d7a('0x18b')});db['ChatMessage']['belongsTo'](db[_0x6d7a('0x12')],{'onDelete':'cascade','as':_0x6d7a('0x12')});db[_0x6d7a('0x68')]['belongsTo'](db['CmContact'],{'onDelete':_0x6d7a('0x113'),'as':_0x6d7a('0x15b'),'foreignKey':'ContactId'});db[_0x6d7a('0x68')][_0x6d7a('0x11e')](db[_0x6d7a('0x129')],{'onDelete':_0x6d7a('0x113'),'as':_0x6d7a('0x177'),'foreignKey':_0x6d7a('0x18b')});db['ChatMessage']['belongsTo'](db[_0x6d7a('0x178')],{'as':_0x6d7a('0x178'),'foreignKey':_0x6d7a('0x179')});db[_0x6d7a('0x68')][_0x6d7a('0x11e')](db[_0x6d7a('0x135')],{'as':'Account','foreignKey':_0x6d7a('0x186')});db[_0x6d7a('0x18d')]['belongsTo'](db[_0x6d7a('0x121')],{'onDelete':'cascade','as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x18d')][_0x6d7a('0x11e')](db['ChatWebsite'],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x186')});db[_0x6d7a('0x6b')]['belongsToMany'](db['User'],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x31'),'hooks':!![]});db[_0x6d7a('0x6b')]['belongsToMany'](db[_0x6d7a('0xe7')],{'through':_0x6d7a('0x18e'),'as':_0x6d7a('0x152')});db[_0x6d7a('0x6d')]['hasMany'](db['ChatInternalMessage'],{'as':_0x6d7a('0x155'),'foreignKey':_0x6d7a('0x18f'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x6d')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Members','through':_0x6d7a('0x190')});db[_0x6d7a('0x191')]['belongsTo'](db[_0x6d7a('0x135')],{'as':_0x6d7a('0x18a'),'foreignKey':_0x6d7a('0x186')});db[_0x6d7a('0x192')][_0x6d7a('0x10f')](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x122'),'foreignKey':_0x6d7a('0x193')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db[_0x6d7a('0x72')],{'as':'Hoppers','foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db[_0x6d7a('0x114')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db['CmHopperHistory'],{'as':_0x6d7a('0x14a'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db[_0x6d7a('0x77')],{'as':_0x6d7a('0x77'),'foreignKey':'ContactId'});db[_0x6d7a('0x121')]['hasMany'](db[_0x6d7a('0xd9')],{'as':_0x6d7a('0x14b'),'foreignKey':_0x6d7a('0x15c')});db['CmContact'][_0x6d7a('0x10f')](db[_0x6d7a('0x5f')],{'as':_0x6d7a('0x117'),'foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db['ChatInteraction'],{'as':_0x6d7a('0x118'),'foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db[_0x6d7a('0x58')],{'as':'SmsInteractions','foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x170')});db['CmContact'][_0x6d7a('0x10f')](db['FaxInteraction'],{'as':_0x6d7a('0x194'),'foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x121')][_0x6d7a('0x10f')](db[_0x6d7a('0x43')],{'as':_0x6d7a('0x128'),'foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x121')][_0x6d7a('0x11e')](db['CmCompany'],{'as':'Company','foreignKey':_0x6d7a('0x193')});db[_0x6d7a('0x121')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':'ListId','onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x121')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x6d7a('0x8e')],{'as':'Tags','through':_0x6d7a('0x195')});db[_0x6d7a('0x121')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x195'),'as':_0x6d7a('0x16b')});db[_0x6d7a('0x72')]['belongsTo'](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x72')]['belongsTo'](db[_0x6d7a('0x124')],{'as':'List','foreignKey':_0x6d7a('0x164'),'onDelete':'cascade'});db[_0x6d7a('0x72')]['belongsTo'](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x187'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x72')][_0x6d7a('0x11e')](db[_0x6d7a('0x1b')],{'as':_0x6d7a('0x188'),'foreignKey':_0x6d7a('0x148'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x72')][_0x6d7a('0x11e')](db[_0x6d7a('0x196')],{'as':_0x6d7a('0x196'),'foreignKey':_0x6d7a('0x197'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x72')][_0x6d7a('0x11e')](db['User'],{'as':_0x6d7a('0x168'),'foreignKey':_0x6d7a('0x198')});db[_0x6d7a('0x73')][_0x6d7a('0x11e')](db[_0x6d7a('0x121')],{'as':'Contact','foreignKey':_0x6d7a('0x15c'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x73')][_0x6d7a('0x11e')](db['CmList'],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x73')][_0x6d7a('0x11e')](db[_0x6d7a('0x1b')],{'as':_0x6d7a('0x188'),'foreignKey':_0x6d7a('0x148'),'onDelete':'cascade'});db[_0x6d7a('0x73')][_0x6d7a('0x11e')](db[_0x6d7a('0x196')],{'as':'Campaign','foreignKey':_0x6d7a('0x197'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x7d')][_0x6d7a('0x10f')](db[_0x6d7a('0x82')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x6d7a('0x199'),'onDelete':_0x6d7a('0x113'),'hooks':!![]});db[_0x6d7a('0x7d')][_0x6d7a('0x10f')](db[_0x6d7a('0x82')],{'as':{'plural':_0x6d7a('0x19a'),'singular':_0x6d7a('0x19b')},'foreignKey':'AutomationAnyId','onDelete':_0x6d7a('0x113'),'hooks':!![]});db['Automation'][_0x6d7a('0x10f')](db[_0x6d7a('0x7b')],{'as':_0x6d7a('0x19c'),'foreignKey':'AutomationId','onDelete':_0x6d7a('0x113'),'hooks':!![]});db[_0x6d7a('0x81')][_0x6d7a('0x10f')](db['Disposition'],{'as':_0x6d7a('0x161'),'foreignKey':'ParentId','onDelete':_0x6d7a('0x113')});db['Interval'][_0x6d7a('0x10f')](db[_0x6d7a('0x84')],{'as':_0x6d7a('0x19d'),'foreignKey':'IntervalId','onDelete':_0x6d7a('0x113'),'hooks':!![],'required':![]});db[_0x6d7a('0x84')]['hasMany'](db[_0x6d7a('0x19')],{'as':_0x6d7a('0x112'),'foreignKey':'IntervalId','onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x84')][_0x6d7a('0x10f')](db[_0x6d7a('0x46')],{'as':_0x6d7a('0x19e'),'foreignKey':_0x6d7a('0x171')});db[_0x6d7a('0x84')][_0x6d7a('0x10f')](db[_0x6d7a('0x65')],{'as':_0x6d7a('0x19f'),'foreignKey':_0x6d7a('0x171')});db[_0x6d7a('0x84')][_0x6d7a('0x10f')](db[_0x6d7a('0x4d')],{'as':'FaxApplications','foreignKey':_0x6d7a('0x171')});db['Interval']['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x6d7a('0x171')});db[_0x6d7a('0x1a0')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{});db[_0x6d7a('0x1a0')][_0x6d7a('0x11e')](db[_0x6d7a('0x1a1')],{'foreignKey':_0x6d7a('0x1a2')});db['Schedule'][_0x6d7a('0x11e')](db[_0x6d7a('0x98')],{'foreignKey':'CustomReportId'});db[_0x6d7a('0x8c')]['belongsToMany'](db[_0x6d7a('0x1a')],{'as':'Mohs','through':_0x6d7a('0x147'),'onDelete':_0x6d7a('0x170')});db['Tag'][_0x6d7a('0x120')](db[_0x6d7a('0x121')],{'through':'cm_contact_has_tags'});db[_0x6d7a('0x8e')]['belongsToMany'](db[_0x6d7a('0x129')],{'through':_0x6d7a('0x18c')});db[_0x6d7a('0x8e')][_0x6d7a('0x120')](db[_0x6d7a('0x43')],{'through':_0x6d7a('0x169')});db['Tag']['belongsToMany'](db[_0x6d7a('0x58')],{'through':_0x6d7a('0x1a3')});db['Tag'][_0x6d7a('0x120')](db['FaxInteraction'],{'through':_0x6d7a('0x1a4')});db[_0x6d7a('0x8e')][_0x6d7a('0x120')](db[_0x6d7a('0x5f')],{'through':_0x6d7a('0x183')});db['Tag'][_0x6d7a('0x120')](db[_0x6d7a('0x103')],{'through':_0x6d7a('0x1a5')});db[_0x6d7a('0x91')][_0x6d7a('0x10f')](db[_0x6d7a('0x82')],{'as':{'plural':_0x6d7a('0x1a6'),'singular':'AllCondition'},'foreignKey':_0x6d7a('0x1a7'),'onDelete':_0x6d7a('0x113'),'hooks':!![]});db[_0x6d7a('0x91')][_0x6d7a('0x10f')](db[_0x6d7a('0x82')],{'as':{'plural':_0x6d7a('0x1a8'),'singular':'AnyCondition'},'foreignKey':_0x6d7a('0x1a9'),'onDelete':_0x6d7a('0x113'),'hooks':!![]});db[_0x6d7a('0x91')][_0x6d7a('0x10f')](db[_0x6d7a('0x7b')],{'as':'Actions','foreignKey':_0x6d7a('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0x6d7a('0x98')]['hasMany'](db[_0x6d7a('0x9d')],{'as':_0x6d7a('0x1ab'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1ac'),'hooks':!![]});db[_0x6d7a('0x1a1')][_0x6d7a('0x10f')](db[_0x6d7a('0x9d')],{'as':_0x6d7a('0x1ab'),'onDelete':'cascade','foreignKey':_0x6d7a('0x1a2')});db[_0x6d7a('0x1ad')][_0x6d7a('0x10f')](db[_0x6d7a('0x9d')],{'as':_0x6d7a('0x1ab'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1ae')});db[_0x6d7a('0x9d')]['belongsTo'](db[_0x6d7a('0x1ad')],{'foreignKey':_0x6d7a('0x1ae')});db[_0x6d7a('0xa0')]['hasMany'](db[_0x6d7a('0xa2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xa2')][_0x6d7a('0x10f')](db[_0x6d7a('0xa3')],{'as':_0x6d7a('0x1b0'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xa2')][_0x6d7a('0x10f')](db[_0x6d7a('0xa3')],{'as':_0x6d7a('0x1b2'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xa2')]['hasMany'](db[_0x6d7a('0xa3')],{'as':_0x6d7a('0x1ab'),'onDelete':'cascade','foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xa2')][_0x6d7a('0x11e')](db[_0x6d7a('0xa0')],{'as':_0x6d7a('0x16f'),'foreignKey':'AccountId'});db[_0x6d7a('0xa3')][_0x6d7a('0x10f')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xa3')][_0x6d7a('0x10f')](db[_0x6d7a('0xa3')],{'as':'Description','foreignKey':_0x6d7a('0x1b3')});db['SalesforceField'][_0x6d7a('0x10f')](db['SalesforceField'],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xa3')][_0x6d7a('0x11e')](db['Variable'],{'as':'Variable','foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xa5')][_0x6d7a('0x10f')](db[_0x6d7a('0xa6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xa6')][_0x6d7a('0x10f')](db[_0x6d7a('0xa8')],{'as':'Subjects','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xa6')][_0x6d7a('0x10f')](db[_0x6d7a('0xa8')],{'as':_0x6d7a('0x1b2'),'onDelete':'cascade','foreignKey':_0x6d7a('0x1b3')});db['SugarcrmConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0xa8')],{'as':_0x6d7a('0x1ab'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xa6')][_0x6d7a('0x11e')](db[_0x6d7a('0xa5')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xa8')][_0x6d7a('0x10f')](db['SugarcrmField'],{'as':'Subject','foreignKey':_0x6d7a('0x1b1')});db['SugarcrmField'][_0x6d7a('0x10f')](db['SugarcrmField'],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xa8')][_0x6d7a('0x10f')](db[_0x6d7a('0xa8')],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xa8')]['belongsTo'](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':'VariableId'});db[_0x6d7a('0xaa')][_0x6d7a('0x10f')](db[_0x6d7a('0xac')],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xac')][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':_0x6d7a('0x1b0'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b1')});db['DeskConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':_0x6d7a('0x1b2'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xac')][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':_0x6d7a('0x1ab'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xac')][_0x6d7a('0x11e')](db[_0x6d7a('0xaa')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xac')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0x1b9')][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0x1b9')][_0x6d7a('0x10f')](db[_0x6d7a('0x1b9')],{'as':'Field','foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0x1b9')][_0x6d7a('0x11e')](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xaf')][_0x6d7a('0x10f')](db['ZohoConfiguration'],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':'AccountId'});db[_0x6d7a('0xb1')][_0x6d7a('0x10f')](db['ZohoField'],{'as':_0x6d7a('0x1b0'),'onDelete':_0x6d7a('0x113'),'foreignKey':'SubjectId'});db[_0x6d7a('0xb1')]['hasMany'](db[_0x6d7a('0xb2')],{'as':'Descriptions','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xb1')][_0x6d7a('0x10f')](db[_0x6d7a('0xb2')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xb1')][_0x6d7a('0x11e')](db['ZohoAccount'],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xb2')][_0x6d7a('0x10f')](db[_0x6d7a('0xb2')],{'as':_0x6d7a('0x1ba'),'foreignKey':'SubjectId'});db['ZohoField']['hasMany'](db[_0x6d7a('0xb2')],{'as':'Description','foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xb2')][_0x6d7a('0x10f')](db[_0x6d7a('0xb2')],{'as':'Field','foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xb2')][_0x6d7a('0x11e')](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':'VariableId'});db['ZendeskAccount']['hasMany'](db[_0x6d7a('0xb6')],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xb6')]['hasMany'](db['ZendeskField'],{'as':_0x6d7a('0x1b0'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xb6')][_0x6d7a('0x10f')](db[_0x6d7a('0xb7')],{'as':_0x6d7a('0x1b2'),'foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x6d7a('0x10f')](db['ZendeskField'],{'as':_0x6d7a('0x1ab'),'foreignKey':'FieldId'});db[_0x6d7a('0xb6')][_0x6d7a('0x11e')](db[_0x6d7a('0xb4')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db['ZendeskConfiguration']['belongsToMany'](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x1bb')});db[_0x6d7a('0xb7')][_0x6d7a('0x10f')](db[_0x6d7a('0xb7')],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xb7')][_0x6d7a('0x10f')](db['ZendeskField'],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xb7')][_0x6d7a('0x10f')](db[_0x6d7a('0xb7')],{'as':'Field','foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xb7')][_0x6d7a('0x11e')](db['Variable'],{'as':_0x6d7a('0x93'),'foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xb9')]['hasMany'](db[_0x6d7a('0xbb')],{'as':'Configurations','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xbb')][_0x6d7a('0x10f')](db[_0x6d7a('0xbd')],{'as':'Subjects','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xbb')][_0x6d7a('0x10f')](db[_0x6d7a('0xbd')],{'as':_0x6d7a('0x1b2'),'onDelete':_0x6d7a('0x113'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0xbd')],{'as':_0x6d7a('0x1ab'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xbb')][_0x6d7a('0x11e')](db[_0x6d7a('0xb9')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xbb')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x1bc')});db['FreshdeskField'][_0x6d7a('0x10f')](db[_0x6d7a('0xbd')],{'as':'Subject','foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xbd')]['hasMany'](db[_0x6d7a('0xbd')],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db['FreshdeskField'][_0x6d7a('0x10f')](db[_0x6d7a('0xbd')],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xbd')]['belongsTo'](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xbf')][_0x6d7a('0x10f')](db[_0x6d7a('0xc0')],{'as':_0x6d7a('0x1b8'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x6d7a('0xc0')][_0x6d7a('0x10f')](db[_0x6d7a('0x1bd')],{'as':_0x6d7a('0x1b0'),'foreignKey':_0x6d7a('0x1b1')});db['VtigerConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0x1bd')],{'as':_0x6d7a('0x1b2'),'foreignKey':_0x6d7a('0x1b3')});db['VtigerConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0x1bd')],{'as':_0x6d7a('0x1ab'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xc0')][_0x6d7a('0x11e')](db[_0x6d7a('0xbf')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0x1bd')][_0x6d7a('0x10f')](db[_0x6d7a('0x1bd')],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db['VtigerField']['hasMany'](db[_0x6d7a('0x1bd')],{'as':'Description','foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0x1bd')][_0x6d7a('0x10f')](db['VtigerField'],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0x1bd')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x6d7a('0x1be')][_0x6d7a('0x10f')](db[_0x6d7a('0x1bf')],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0x1bf')]['hasMany'](db[_0x6d7a('0xc3')],{'as':_0x6d7a('0x1b0'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x6d7a('0x10f')](db['ServicenowField'],{'as':_0x6d7a('0x1b2'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0x1bf')][_0x6d7a('0x10f')](db[_0x6d7a('0xc3')],{'as':_0x6d7a('0x1ab'),'foreignKey':'FieldId'});db[_0x6d7a('0x1bf')][_0x6d7a('0x11e')](db[_0x6d7a('0x1be')],{'as':_0x6d7a('0x16f'),'foreignKey':'AccountId'});db[_0x6d7a('0xc3')][_0x6d7a('0x10f')](db['ServicenowField'],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db['ServicenowField'][_0x6d7a('0x10f')](db[_0x6d7a('0xc3')],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db['ServicenowField'][_0x6d7a('0x10f')](db['ServicenowField'],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xc3')][_0x6d7a('0x11e')](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xc5')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xc7')][_0x6d7a('0x10f')](db['Dynamics365Field'],{'as':_0x6d7a('0x1b0'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xc7')][_0x6d7a('0x10f')](db[_0x6d7a('0xc8')],{'as':_0x6d7a('0x1b2'),'onDelete':'cascade','foreignKey':_0x6d7a('0x1b3')});db['Dynamics365Configuration'][_0x6d7a('0x10f')](db[_0x6d7a('0xc8')],{'as':'Fields','onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xc7')][_0x6d7a('0x11e')](db[_0x6d7a('0xc5')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xc8')][_0x6d7a('0x10f')](db['Dynamics365Field'],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xc8')]['hasMany'](db[_0x6d7a('0xc8')],{'as':_0x6d7a('0x1b7'),'foreignKey':_0x6d7a('0x1b3')});db['Dynamics365Field'][_0x6d7a('0x10f')](db[_0x6d7a('0xc8')],{'as':'Field','foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0x6d7a('0x93'),'foreignKey':'VariableId'});db[_0x6d7a('0xca')]['hasMany'](db[_0x6d7a('0xcc')],{'as':_0x6d7a('0x1b8'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1af')});db['FreshsalesConfiguration'][_0x6d7a('0x10f')](db['FreshsalesField'],{'as':_0x6d7a('0x1b0'),'foreignKey':_0x6d7a('0x1b1')});db['FreshsalesConfiguration'][_0x6d7a('0x10f')](db[_0x6d7a('0xce')],{'as':_0x6d7a('0x1b2'),'foreignKey':_0x6d7a('0x1b3')});db[_0x6d7a('0xcc')][_0x6d7a('0x10f')](db[_0x6d7a('0xce')],{'as':_0x6d7a('0x1ab'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xcc')][_0x6d7a('0x11e')](db['FreshsalesAccount'],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1af')});db[_0x6d7a('0xce')][_0x6d7a('0x10f')](db[_0x6d7a('0xce')],{'as':_0x6d7a('0x1ba'),'foreignKey':_0x6d7a('0x1b1')});db[_0x6d7a('0xce')][_0x6d7a('0x10f')](db['FreshsalesField'],{'as':_0x6d7a('0x1b7'),'foreignKey':'DescriptionId'});db[_0x6d7a('0xce')][_0x6d7a('0x10f')](db[_0x6d7a('0xce')],{'as':_0x6d7a('0x1b5'),'foreignKey':_0x6d7a('0x1b4')});db[_0x6d7a('0xce')]['belongsTo'](db[_0x6d7a('0x93')],{'as':_0x6d7a('0x93'),'foreignKey':_0x6d7a('0x1b6')});db[_0x6d7a('0xd2')][_0x6d7a('0x11e')](db[_0x6d7a('0x135')],{});db['ChatQueueReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0xd2')]['belongsTo'](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0xd2')][_0x6d7a('0x11e')](db['ChatInteraction'],{});db[_0x6d7a('0xd2')]['belongsTo'](db[_0x6d7a('0x68')],{});db['ChatQueueReport'][_0x6d7a('0x11e')](db['User'],{});db['ChatQueueReport'][_0x6d7a('0x11e')](db['ChatQueue'],{});db[_0x6d7a('0xd3')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1c0')});db[_0x6d7a('0xd3')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1c1')});db[_0x6d7a('0xd9')][_0x6d7a('0x10f')](db[_0x6d7a('0xd7')],{'foreignKey':_0x6d7a('0x1c2'),'onDelete':_0x6d7a('0x113')});db['JscriptySessionReport'][_0x6d7a('0x10f')](db[_0x6d7a('0xd5')],{'foreignKey':'SessionId','onDelete':_0x6d7a('0x113')});db[_0x6d7a('0xdb')][_0x6d7a('0x11e')](db['SmsAccount'],{});db[_0x6d7a('0xdb')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0xdb')][_0x6d7a('0x11e')](db['CmContact'],{'as':_0x6d7a('0x15b'),'foreignKey':'ContactId'});db[_0x6d7a('0xdb')]['belongsTo'](db[_0x6d7a('0x58')],{});db[_0x6d7a('0xdb')]['belongsTo'](db[_0x6d7a('0x17d')],{});db[_0x6d7a('0xdb')][_0x6d7a('0x11e')](db['User'],{});db[_0x6d7a('0xdb')][_0x6d7a('0x11e')](db[_0x6d7a('0x5b')],{});db[_0x6d7a('0x1c3')][_0x6d7a('0x10f')](db['JscriptySessionReport'],{'foreignKey':_0x6d7a('0x1c4')});db[_0x6d7a('0x1c3')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x6d7a('0x1c4')});db[_0x6d7a('0x1c3')]['hasMany'](db[_0x6d7a('0xd5')],{'foreignKey':_0x6d7a('0x1c4')});db[_0x6d7a('0x142')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x16c'),'through':_0x6d7a('0x144')});db[_0x6d7a('0xe7')][_0x6d7a('0x120')](db['User'],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x127')});db[_0x6d7a('0xe7')][_0x6d7a('0x120')](db[_0x6d7a('0x1b')],{'through':_0x6d7a('0x153'),'as':'VoiceQueues'});db[_0x6d7a('0xe7')][_0x6d7a('0x120')](db[_0x6d7a('0x3f')],{'through':_0x6d7a('0x166'),'as':'MailQueues'});db[_0x6d7a('0xe7')][_0x6d7a('0x120')](db[_0x6d7a('0x6b')],{'through':'team_has_chat_queues','as':_0x6d7a('0x1c5')});db['Team'][_0x6d7a('0x120')](db[_0x6d7a('0x52')],{'through':'team_has_fax_queues','as':_0x6d7a('0x1c6')});db['Team'][_0x6d7a('0x120')](db[_0x6d7a('0x5b')],{'through':_0x6d7a('0x1c7'),'as':_0x6d7a('0x131')});db[_0x6d7a('0xe7')][_0x6d7a('0x120')](db[_0x6d7a('0x61')],{'through':_0x6d7a('0x185'),'as':_0x6d7a('0x1c8')});db[_0x6d7a('0xe7')]['belongsToMany'](db[_0x6d7a('0x10a')],{'through':_0x6d7a('0x1c9'),'as':_0x6d7a('0x132')});db['Campaign'][_0x6d7a('0x10f')](db[_0x6d7a('0x72')],{'as':'Hoppers','foreignKey':_0x6d7a('0x197')});db[_0x6d7a('0x196')][_0x6d7a('0x10f')](db[_0x6d7a('0x114')],{'as':_0x6d7a('0x115'),'foreignKey':_0x6d7a('0x197')});db[_0x6d7a('0x196')]['hasMany'](db[_0x6d7a('0x75')],{'as':'HopperHistories','foreignKey':_0x6d7a('0x197')});db[_0x6d7a('0x196')][_0x6d7a('0x10f')](db[_0x6d7a('0x73')],{'as':_0x6d7a('0x1ca'),'foreignKey':'CampaignId'});db['Campaign'][_0x6d7a('0x11e')](db['Trunk'],{'as':_0x6d7a('0x2b'),'foreignKey':_0x6d7a('0x14c')});db[_0x6d7a('0x196')][_0x6d7a('0x11e')](db[_0x6d7a('0x2b')],{'as':_0x6d7a('0x14d'),'foreignKey':_0x6d7a('0x14e')});db[_0x6d7a('0x196')][_0x6d7a('0x11e')](db[_0x6d7a('0x84')],{'as':'Interval','foreignKey':_0x6d7a('0x171')});db['Campaign'][_0x6d7a('0x11e')](db[_0x6d7a('0x142')],{'as':'SquareProject','foreignKey':_0x6d7a('0x1cb')});db[_0x6d7a('0x196')]['belongsToMany'](db['CmList'],{'as':_0x6d7a('0x125'),'through':'campaigns_has_cm_lists'});db[_0x6d7a('0x196')][_0x6d7a('0x120')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x154'),'through':_0x6d7a('0x1cc')});db[_0x6d7a('0xf0')][_0x6d7a('0x11e')](db[_0x6d7a('0x45')],{});db['MailTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x43')],{});db[_0x6d7a('0xf0')]['belongsTo'](db[_0x6d7a('0x15d')],{'foreignKey':'FromMailAccountId','as':_0x6d7a('0x1cd')});db[_0x6d7a('0xf0')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1ce'),'as':'FromAgent'});db['MailTransferReport']['belongsTo'](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1cf'),'as':_0x6d7a('0x1d0')});db[_0x6d7a('0xf0')][_0x6d7a('0x11e')](db[_0x6d7a('0x3f')],{'foreignKey':_0x6d7a('0x1d1'),'as':_0x6d7a('0x1d2')});db[_0x6d7a('0xf0')][_0x6d7a('0x11e')](db[_0x6d7a('0x15d')],{'foreignKey':_0x6d7a('0x1d3'),'as':_0x6d7a('0x1d4')});db[_0x6d7a('0x1d5')][_0x6d7a('0x11e')](db[_0x6d7a('0x68')],{});db[_0x6d7a('0x1d5')][_0x6d7a('0x11e')](db[_0x6d7a('0x129')],{});db['ChatTransferReport'][_0x6d7a('0x11e')](db['ChatWebsite'],{'foreignKey':_0x6d7a('0x1d6'),'as':_0x6d7a('0x1cd')});db[_0x6d7a('0x1d5')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1ce'),'as':_0x6d7a('0x1d7')});db[_0x6d7a('0x1d5')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1cf'),'as':'ToAgent'});db['ChatTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x6b')],{'foreignKey':_0x6d7a('0x1d8'),'as':'ToQueue'});db[_0x6d7a('0x1d5')][_0x6d7a('0x11e')](db[_0x6d7a('0x135')],{'foreignKey':_0x6d7a('0x1d9'),'as':_0x6d7a('0x1d4')});db[_0x6d7a('0xf3')][_0x6d7a('0x11e')](db['FaxMessage'],{});db['FaxTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x11a')],{});db[_0x6d7a('0xf3')][_0x6d7a('0x11e')](db['FaxAccount'],{'foreignKey':_0x6d7a('0x1da'),'as':'FromAccount'});db[_0x6d7a('0xf3')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':'FromUserId','as':_0x6d7a('0x1d7')});db[_0x6d7a('0xf3')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1cf'),'as':_0x6d7a('0x1d0')});db[_0x6d7a('0xf3')][_0x6d7a('0x11e')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x6d7a('0x1d2')});db['FaxTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x4b')],{'foreignKey':_0x6d7a('0x1db'),'as':_0x6d7a('0x1d4')});db['OpenchannelTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x181')],{});db['OpenchannelTransferReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x5f')],{});db[_0x6d7a('0x1dc')]['belongsTo'](db[_0x6d7a('0x5c')],{'foreignKey':_0x6d7a('0x1dd'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1ce'),'as':_0x6d7a('0x1d7')});db[_0x6d7a('0x1dc')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1cf'),'as':_0x6d7a('0x1d0')});db[_0x6d7a('0x1dc')][_0x6d7a('0x11e')](db[_0x6d7a('0x61')],{'foreignKey':_0x6d7a('0x1de'),'as':'ToQueue'});db[_0x6d7a('0x1dc')][_0x6d7a('0x11e')](db[_0x6d7a('0x5c')],{'foreignKey':_0x6d7a('0x1df'),'as':_0x6d7a('0x1d4')});db[_0x6d7a('0xf6')][_0x6d7a('0x11e')](db[_0x6d7a('0x17d')],{});db[_0x6d7a('0xf6')][_0x6d7a('0x11e')](db[_0x6d7a('0x58')],{});db['SmsTransferReport']['belongsTo'](db[_0x6d7a('0x17a')],{'foreignKey':_0x6d7a('0x1e0'),'as':'FromAccount'});db[_0x6d7a('0xf6')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1ce'),'as':_0x6d7a('0x1d7')});db[_0x6d7a('0xf6')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':'ToUserId','as':_0x6d7a('0x1d0')});db[_0x6d7a('0xf6')]['belongsTo'](db[_0x6d7a('0x5b')],{'foreignKey':_0x6d7a('0x1e1'),'as':_0x6d7a('0x1d2')});db[_0x6d7a('0xf6')][_0x6d7a('0x11e')](db[_0x6d7a('0x17a')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList'][_0x6d7a('0x10f')](db[_0x6d7a('0x81')],{'as':_0x6d7a('0x161'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x124')][_0x6d7a('0x10f')](db[_0x6d7a('0x79')],{'as':_0x6d7a('0x1e2'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x124')]['hasMany'](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x122'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x124')][_0x6d7a('0x10f')](db[_0x6d7a('0x114')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0x6d7a('0x10f')](db['CmHopperHistory'],{'as':_0x6d7a('0x116'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x124')]['hasMany'](db[_0x6d7a('0x77')],{'as':_0x6d7a('0x77'),'foreignKey':_0x6d7a('0x164')});db['CmList'][_0x6d7a('0x120')](db['VoiceQueue'],{'as':_0x6d7a('0x1e3'),'through':_0x6d7a('0x1e4')});db[_0x6d7a('0x124')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x126')});db[_0x6d7a('0xf9')]['hasMany'](db[_0x6d7a('0x19')],{'as':_0x6d7a('0x112'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0xf9')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':'Agents','through':_0x6d7a('0x134')});db[_0x6d7a('0xfa')]['hasMany'](db['User'],{'as':'Users','foreignKey':_0x6d7a('0x1e5')});db[_0x6d7a('0xfa')][_0x6d7a('0x10f')](db[_0x6d7a('0xfc')],{'as':_0x6d7a('0x1e6'),'foreignKey':_0x6d7a('0x1e5'),'onDelete':'cascade'});db[_0x6d7a('0xfc')][_0x6d7a('0x10f')](db[_0x6d7a('0x1e7')],{'as':_0x6d7a('0x1e8'),'foreignKey':_0x6d7a('0x1e9'),'onDelete':_0x6d7a('0x113')});db[_0x6d7a('0x100')][_0x6d7a('0x10f')](db[_0x6d7a('0x81')],{'as':'Dispositions','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x6d7a('0x10f')](db[_0x6d7a('0x7f')],{'as':'Answers','foreignKey':_0x6d7a('0x1ea')});db[_0x6d7a('0x100')][_0x6d7a('0x10f')](db[_0x6d7a('0x105')],{'as':_0x6d7a('0x155'),'foreignKey':_0x6d7a('0x1ea')});db[_0x6d7a('0x100')][_0x6d7a('0x10f')](db[_0x6d7a('0x103')],{'as':_0x6d7a('0x174')});db[_0x6d7a('0x100')][_0x6d7a('0x10f')](db[_0x6d7a('0x102')],{'as':'Applications'});db[_0x6d7a('0x100')][_0x6d7a('0x11e')](db[_0x6d7a('0x124')],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x100')][_0x6d7a('0x11e')](db[_0x6d7a('0x86')],{'as':'mandatoryDispositionPause','foreignKey':_0x6d7a('0x150')});db[_0x6d7a('0x100')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':'user_has_whatsapp_accounts'});db[_0x6d7a('0x102')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'onDelete':'restrict'});db[_0x6d7a('0x102')][_0x6d7a('0x11e')](db[_0x6d7a('0x10a')],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x102')][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{'onDelete':_0x6d7a('0x170')});db[_0x6d7a('0x102')][_0x6d7a('0x11e')](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6d7a('0x171')});db[_0x6d7a('0x102')][_0x6d7a('0x11e')](db[_0x6d7a('0x8e')],{'onDelete':_0x6d7a('0x170'),'foreignKey':_0x6d7a('0x172')});db[_0x6d7a('0x103')]['hasMany'](db[_0x6d7a('0x105')],{'as':_0x6d7a('0x155'),'onDelete':_0x6d7a('0x113'),'foreignKey':_0x6d7a('0x1eb')});db[_0x6d7a('0x103')][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x6d7a('0x103')][_0x6d7a('0x11e')](db['CmContact'],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db['WhatsappInteraction'][_0x6d7a('0x11e')](db['User'],{'as':_0x6d7a('0x168'),'foreignKey':_0x6d7a('0x10e')});db[_0x6d7a('0x103')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x1a5'),'as':_0x6d7a('0x16a')});db[_0x6d7a('0x103')][_0x6d7a('0x120')](db[_0x6d7a('0x8e')],{'through':_0x6d7a('0x1a5'),'as':_0x6d7a('0x16b')});db[_0x6d7a('0x103')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x16c'),'through':_0x6d7a('0x1ec'),'foreignKey':'WhatsappInteractionId'});db[_0x6d7a('0x105')][_0x6d7a('0x11e')](db['User'],{'as':_0x6d7a('0x12')});db[_0x6d7a('0x105')][_0x6d7a('0x11e')](db['CmContact'],{'onDelete':'cascade','as':_0x6d7a('0x15b')});db[_0x6d7a('0x105')][_0x6d7a('0x11e')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x6d7a('0x177'),'foreignKey':'WhatsappInteractionId'});db[_0x6d7a('0x105')][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{'as':_0x6d7a('0x16f'),'foreignKey':_0x6d7a('0x1ea')});db['WhatsappQueueReport'][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{});db['WhatsappQueueReport'][_0x6d7a('0x11e')](db['CmList'],{'as':_0x6d7a('0x163'),'foreignKey':_0x6d7a('0x164')});db[_0x6d7a('0x106')]['belongsTo'](db[_0x6d7a('0x121')],{'as':_0x6d7a('0x15b'),'foreignKey':_0x6d7a('0x15c')});db[_0x6d7a('0x106')][_0x6d7a('0x11e')](db[_0x6d7a('0x103')],{});db[_0x6d7a('0x106')]['belongsTo'](db['WhatsappQueue'],{});db[_0x6d7a('0x106')][_0x6d7a('0x11e')](db[_0x6d7a('0x105')],{});db[_0x6d7a('0x106')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{});db[_0x6d7a('0x108')][_0x6d7a('0x11e')](db[_0x6d7a('0x105')],{});db[_0x6d7a('0x108')][_0x6d7a('0x11e')](db[_0x6d7a('0x103')],{});db[_0x6d7a('0x108')][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{'foreignKey':_0x6d7a('0x1ed'),'as':_0x6d7a('0x1cd')});db[_0x6d7a('0x108')][_0x6d7a('0x11e')](db[_0x6d7a('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0x6d7a('0x1d4')});db[_0x6d7a('0x108')]['belongsTo'](db[_0x6d7a('0x10a')],{'foreignKey':_0x6d7a('0x1ee'),'as':'ToQueue'});db['WhatsappTransferReport'][_0x6d7a('0x11e')](db['User'],{'foreignKey':_0x6d7a('0x1ce'),'as':_0x6d7a('0x1d7')});db[_0x6d7a('0x108')][_0x6d7a('0x11e')](db[_0x6d7a('0x12')],{'foreignKey':_0x6d7a('0x1cf'),'as':_0x6d7a('0x1d0')});db[_0x6d7a('0x10a')][_0x6d7a('0x120')](db[_0x6d7a('0x12')],{'as':_0x6d7a('0x151'),'through':_0x6d7a('0x3a'),'foreignKey':_0x6d7a('0x1ef')});db['WhatsappQueue'][_0x6d7a('0x120')](db[_0x6d7a('0xe7')],{'through':_0x6d7a('0x1c9'),'as':_0x6d7a('0x152')});module[_0x6d7a('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f3d8dc3..a789a36 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9361=['/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/authLocal','/api/auth/google','/api/jira','/api/rpc','./api/version','/api/pm2','/api/webbar','/apidoc','/www','static','/demo','root','/snippet','join','snippet','1.0.16','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','express-winston','util','api','./config/logger','use','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','logger','body','device','agent_id','other','agent_name','test','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport'];(function(_0x4bc3f3,_0x51f74d){var _0x569697=function(_0x1106b7){while(--_0x1106b7){_0x4bc3f3['push'](_0x4bc3f3['shift']());}};_0x569697(++_0x51f74d);}(_0x9361,0x1a5));var _0x1936=function(_0x412190,_0x3a428f){_0x412190=_0x412190-0x0;var _0x483bb3=_0x9361[_0x412190];return _0x483bb3;};'use strict';var path=require(_0x1936('0x0'));var express=require('express');var ewinston=require(_0x1936('0x1'));var util=require(_0x1936('0x2'));var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')(_0x1936('0x3'));var authLogger=require(_0x1936('0x4'))('auth');exports['default']=function(_0x41a2c5){_0x41a2c5[_0x1936('0x5')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2beefa,_0x5eabd8){return util[_0x1936('0x6')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x2beefa[_0x1936('0x7')],_0x2beefa[_0x1936('0x8')][_0x1936('0x9')]?_0x2beefa[_0x1936('0x8')][_0x1936('0x9')]:_0x2beefa[_0x1936('0xa')][_0x1936('0xb')]||_0x2beefa['ip'],_0x2beefa[_0x1936('0xc')],_0x5eabd8[_0x1936('0xd')],_0x5eabd8[_0x1936('0xe')],_0x2beefa[_0x1936('0xf')]?_0x2beefa[_0x1936('0xf')]['id']:null,_0x2beefa[_0x1936('0xf')]?_0x2beefa[_0x1936('0xf')][_0x1936('0x10')]:null,_0x2beefa[_0x1936('0xf')]?_0x2beefa[_0x1936('0xf')]['role']:null);}}));_0x41a2c5[_0x1936('0x5')](ewinston[_0x1936('0x11')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x147144,_0x30a3cd){var _0x449b82='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x147144[_0x1936('0x12')]&&_0x147144[_0x1936('0x12')][_0x1936('0x13')]&&_0x147144['body'][_0x1936('0x14')]){_0x449b82='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x1936('0x6')](_0x449b82,_0x147144['method'],_0x147144['headers'][_0x1936('0x9')]?_0x147144[_0x1936('0x8')][_0x1936('0x9')]:_0x147144[_0x1936('0xa')][_0x1936('0xb')]||_0x147144['ip'],_0x147144['url'],_0x30a3cd['statusCode'],_0x30a3cd['responseTime'],_0x147144[_0x1936('0xf')]?_0x147144[_0x1936('0xf')]['id']:null,_0x147144[_0x1936('0xf')]?_0x147144['user']['name']:null,_0x147144[_0x1936('0xf')]?_0x147144[_0x1936('0xf')]['role']:null,_0x147144[_0x1936('0x12')]&&_0x147144[_0x1936('0x12')][_0x1936('0x13')]?_0x147144['body'][_0x1936('0x13')]:_0x1936('0x15'),_0x147144['body']&&_0x147144[_0x1936('0x12')][_0x1936('0x14')]?_0x147144[_0x1936('0x12')][_0x1936('0x14')]:'',_0x147144[_0x1936('0x12')]&&_0x147144[_0x1936('0x12')]['agent_name']?_0x147144[_0x1936('0x12')][_0x1936('0x16')]:'');},'ignoreRoute':function(_0x46ee3b){var _0x2abc18=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2abc18[_0x1936('0x17')](_0x46ee3b[_0x1936('0xc')]);}}));_0x41a2c5[_0x1936('0x5')]('/api/users',require(_0x1936('0x18')));_0x41a2c5['use']('/api/voice/chanspy',require(_0x1936('0x19')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x1a'),require(_0x1936('0x1b')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x1c'),require('./api/voiceExtension'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x1d'),require('./api/voiceMusicOnHold'));_0x41a2c5['use'](_0x1936('0x1e'),require(_0x1936('0x1f')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x20'),require(_0x1936('0x21')));_0x41a2c5['use'](_0x1936('0x22'),require(_0x1936('0x23')));_0x41a2c5['use']('/api/voice/mails',require(_0x1936('0x24')));_0x41a2c5['use'](_0x1936('0x25'),require(_0x1936('0x26')));_0x41a2c5['use'](_0x1936('0x27'),require('./api/voiceCallReport'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x28'),require(_0x1936('0x29')));_0x41a2c5['use'](_0x1936('0x2a'),require(_0x1936('0x2b')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x2c'),require('./api/voiceQueueReport'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x2d'),require('./api/memberReport'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x2e'),require(_0x1936('0x2f')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x30'),require('./api/voiceTransferReport'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x31'),require('./api/mailServerOut'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x32'),require(_0x1936('0x33')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x34'),require(_0x1936('0x35')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x36'),require('./api/mailSubstatus'));_0x41a2c5['use'](_0x1936('0x37'),require('./api/mailInteraction'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x38'),require(_0x1936('0x39')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x3a'),require(_0x1936('0x3b')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x3c'),require(_0x1936('0x3d')));_0x41a2c5['use']('/api/dashboards',require(_0x1936('0x3e')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x3f'),require('./api/dashboardItem'));_0x41a2c5['use']('/api/fax/accounts',require(_0x1936('0x40')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x41'),require(_0x1936('0x42')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x43'),require('./api/faxInteraction'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x44'),require(_0x1936('0x45')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x46'),require(_0x1936('0x47')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x48'),require(_0x1936('0x49')));_0x41a2c5['use']('/api/sms/accounts',require(_0x1936('0x4a')));_0x41a2c5['use'](_0x1936('0x4b'),require(_0x1936('0x4c')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x4d'),require(_0x1936('0x4e')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x4f'),require(_0x1936('0x50')));_0x41a2c5['use'](_0x1936('0x51'),require(_0x1936('0x52')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x53'),require(_0x1936('0x54')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x55'),require(_0x1936('0x56')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x57'),require('./api/openchannelInteraction'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x58'),require('./api/openchannelMessage'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x59'),require(_0x1936('0x5a')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x5b'),require(_0x1936('0x5c')));_0x41a2c5[_0x1936('0x5')]('/api/openchannel/reports/queue',require(_0x1936('0x5d')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x5e'),require(_0x1936('0x5f')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x60'),require(_0x1936('0x61')));_0x41a2c5['use']('/api/chat/messages',require(_0x1936('0x62')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x63'),require(_0x1936('0x64')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x65'),require('./api/chatQueue'));_0x41a2c5[_0x1936('0x5')]('/api/chat/groups',require(_0x1936('0x66')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x67'),require('./api/chatProactiveAction'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x68'),require('./api/cmCompany'));_0x41a2c5[_0x1936('0x5')]('/api/cm/contacts',require(_0x1936('0x69')));_0x41a2c5['use'](_0x1936('0x6a'),require(_0x1936('0x6b')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x6c'),require(_0x1936('0x6d')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x6e'),require('./api/cmHopperFinal'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x6f'),require(_0x1936('0x70')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x71'),require('./api/cmCustomField'));_0x41a2c5['use'](_0x1936('0x72'),require('./api/action'));_0x41a2c5['use'](_0x1936('0x73'),require('./api/automation'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x74'),require('./api/cannedAnswer'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x75'),require(_0x1936('0x76')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x77'),require(_0x1936('0x78')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x79'),require(_0x1936('0x7a')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x7b'),require(_0x1936('0x7c')));_0x41a2c5[_0x1936('0x5')]('/api/cdr',require(_0x1936('0x7d')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x7e'),require(_0x1936('0x7f')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x80'),require(_0x1936('0x81')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x82'),require(_0x1936('0x83')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x84'),require(_0x1936('0x85')));_0x41a2c5[_0x1936('0x5')]('/api/templates',require(_0x1936('0x86')));_0x41a2c5['use']('/api/triggers',require(_0x1936('0x87')));_0x41a2c5[_0x1936('0x5')]('/api/variables',require(_0x1936('0x88')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x89'),require(_0x1936('0x8a')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x8b'),require(_0x1936('0x8c')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x8d'),require(_0x1936('0x8e')));_0x41a2c5['use'](_0x1936('0x8f'),require(_0x1936('0x90')));_0x41a2c5['use'](_0x1936('0x91'),require(_0x1936('0x92')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x93'),require(_0x1936('0x94')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x95'),require(_0x1936('0x96')));_0x41a2c5[_0x1936('0x5')]('/api/analytics/tree_reports',require(_0x1936('0x97')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x98'),require(_0x1936('0x99')));_0x41a2c5['use'](_0x1936('0x9a'),require(_0x1936('0x9b')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x9c'),require(_0x1936('0x9d')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x9e'),require(_0x1936('0x9f')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/sugarcrm/configurations',require(_0x1936('0xa0')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xa1'),require(_0x1936('0xa2')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xa3'),require(_0x1936('0xa4')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/desk/fields',require(_0x1936('0xa5')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xa6'),require(_0x1936('0xa7')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/zoho/configurations',require(_0x1936('0xa8')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xa9'),require(_0x1936('0xaa')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xab'),require(_0x1936('0xac')));_0x41a2c5['use'](_0x1936('0xad'),require('./api/intZendeskField'));_0x41a2c5['use']('/api/integrations/freshdesk/accounts',require(_0x1936('0xae')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xaf'),require(_0x1936('0xb0')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xb1'),require(_0x1936('0xb2')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x41a2c5[_0x1936('0x5')]('/api/integrations/vtiger/configurations',require(_0x1936('0xb3')));_0x41a2c5['use'](_0x1936('0xb4'),require('./api/intVtigerField'));_0x41a2c5['use'](_0x1936('0xb5'),require(_0x1936('0xb6')));_0x41a2c5['use'](_0x1936('0xb7'),require(_0x1936('0xb8')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x41a2c5[_0x1936('0x5')]('/api/integrations/dynamics365/accounts',require(_0x1936('0xb9')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xba'),require(_0x1936('0xbb')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xbc'),require(_0x1936('0xbd')));_0x41a2c5['use'](_0x1936('0xbe'),require('./api/intFreshsalesAccount'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xbf'),require(_0x1936('0xc0')));_0x41a2c5[_0x1936('0x5')]('/api/integrations/freshsales/fields',require(_0x1936('0xc1')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xc2'),require(_0x1936('0xc3')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xc4'),require(_0x1936('0xc5')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xc6'),require(_0x1936('0xc7')));_0x41a2c5['use'](_0x1936('0xc8'),require('./api/jscriptyAnswerReport'));_0x41a2c5[_0x1936('0x5')]('/api/jscripty/questions/reports',require(_0x1936('0xc9')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xca'),require('./api/jscriptySessionReport'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xcb'),require('./api/smsQueueReport'));_0x41a2c5['use']('/api/square/reports',require(_0x1936('0xcc')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xcd'),require(_0x1936('0xce')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xcf'),require('./api/jscriptyProject'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xd0'),require(_0x1936('0xd1')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xd2'),require(_0x1936('0xd3')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xd4'),require(_0x1936('0xd5')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xd6'),require(_0x1936('0xd7')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xd8'),require(_0x1936('0xd9')));_0x41a2c5[_0x1936('0x5')]('/api/teams',require('./api/team'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xda'),require(_0x1936('0xdb')));_0x41a2c5['use'](_0x1936('0xdc'),require(_0x1936('0xdd')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xde'),require(_0x1936('0xdf')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xe0'),require('./api/attachment'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xe1'),require(_0x1936('0xe2')));_0x41a2c5[_0x1936('0x5')]('/api/mail/reports/transfer',require(_0x1936('0xe3')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xe4'),require(_0x1936('0xe5')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xe6'),require(_0x1936('0xe7')));_0x41a2c5[_0x1936('0x5')]('/api/openchannel/reports/transfer',require(_0x1936('0xe8')));_0x41a2c5[_0x1936('0x5')]('/api/sms/reports/transfer',require(_0x1936('0xe9')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xea'),require(_0x1936('0xeb')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xec'),require('./api/voicePrefix'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xed'),require('./api/userProfile'));_0x41a2c5[_0x1936('0x5')](_0x1936('0xee'),require(_0x1936('0xef')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xf0'),require(_0x1936('0xf1')));_0x41a2c5['use'](_0x1936('0xf2'),require(_0x1936('0xf3')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xf4'),require(_0x1936('0xf5')));_0x41a2c5['use'](_0x1936('0xf6'),require(_0x1936('0xf7')));_0x41a2c5[_0x1936('0x5')]('/api/whatsapp/interactions',require(_0x1936('0xf8')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xf9'),require(_0x1936('0xfa')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xfb'),require(_0x1936('0xfc')));_0x41a2c5[_0x1936('0x5')](_0x1936('0xfd'),require(_0x1936('0xfe')));_0x41a2c5['use'](_0x1936('0xff'),require(_0x1936('0x100')));_0x41a2c5[_0x1936('0x5')]('/api/cloudProviders',require(_0x1936('0x101')));_0x41a2c5[_0x1936('0x5')]('/api/auth/local',require(_0x1936('0x102')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x103'),require('./api/authGoogle'));_0x41a2c5['use'](_0x1936('0x104'),require('./api/jira'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x105'),require('./api/rpc'));_0x41a2c5[_0x1936('0x5')]('/api/version',require(_0x1936('0x106')));_0x41a2c5[_0x1936('0x5')]('/api/system',require('./api/system'));_0x41a2c5['use'](_0x1936('0x107'),require('./api/pm2'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x108'),require('./api/webbar'));_0x41a2c5[_0x1936('0x5')](_0x1936('0x109'),express['static'](path['join'](config['root'],_0x1936('0x109'))));_0x41a2c5[_0x1936('0x5')](_0x1936('0x10a'),express[_0x1936('0x10b')](path['join'](config['root'],'/www')));_0x41a2c5[_0x1936('0x5')](_0x1936('0x10c'),express['static'](path['join'](config[_0x1936('0x10d')],_0x1936('0x10c'))));_0x41a2c5[_0x1936('0x5')](_0x1936('0x10e'),express['static'](path[_0x1936('0x10f')](config[_0x1936('0x10d')],_0x1936('0x110'),_0x1936('0x111'))));_0x41a2c5[_0x1936('0x5')](_0x1936('0x112'),express[_0x1936('0x10b')](path['join'](config['root'],_0x1936('0x113'))));_0x41a2c5[_0x1936('0x114')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x41a2c5[_0x1936('0x114')]('/*')[_0x1936('0x115')](function(_0x584a92,_0x261df1){_0x261df1[_0x1936('0x116')](path[_0x1936('0x117')](_0x41a2c5[_0x1936('0x115')](_0x1936('0x118'))+_0x1936('0x119')));});}; \ No newline at end of file +var _0x5ccd=['/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./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/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','static','join','root','/www','/demo','/snippet','1.0.16','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','/api/templates','./api/template','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields'];(function(_0x2720d4,_0x4d10c3){var _0x1b0f29=function(_0x540a94){while(--_0x540a94){_0x2720d4['push'](_0x2720d4['shift']());}};_0x1b0f29(++_0x4d10c3);}(_0x5ccd,0x7f));var _0xd5cc=function(_0x98459f,_0x4dfb55){_0x98459f=_0x98459f-0x0;var _0x128f94=_0x5ccd[_0x98459f];return _0x128f94;};'use strict';var path=require(_0xd5cc('0x0'));var express=require(_0xd5cc('0x1'));var ewinston=require(_0xd5cc('0x2'));var util=require(_0xd5cc('0x3'));var errors=require(_0xd5cc('0x4'));var config=require('./config/environment');var logger=require(_0xd5cc('0x5'))(_0xd5cc('0x6'));var authLogger=require(_0xd5cc('0x5'))(_0xd5cc('0x7'));exports[_0xd5cc('0x8')]=function(_0x230d7e){_0x230d7e[_0xd5cc('0x9')](ewinston[_0xd5cc('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4c8e08,_0x20796f){return util[_0xd5cc('0xb')](_0xd5cc('0xc'),_0x4c8e08[_0xd5cc('0xd')],_0x4c8e08[_0xd5cc('0xe')][_0xd5cc('0xf')]?_0x4c8e08[_0xd5cc('0xe')][_0xd5cc('0xf')]:_0x4c8e08[_0xd5cc('0x10')][_0xd5cc('0x11')]||_0x4c8e08['ip'],_0x4c8e08[_0xd5cc('0x12')],_0x20796f[_0xd5cc('0x13')],_0x20796f[_0xd5cc('0x14')],_0x4c8e08[_0xd5cc('0x15')]?_0x4c8e08[_0xd5cc('0x15')]['id']:null,_0x4c8e08[_0xd5cc('0x15')]?_0x4c8e08[_0xd5cc('0x15')]['name']:null,_0x4c8e08['user']?_0x4c8e08[_0xd5cc('0x15')][_0xd5cc('0x16')]:null);}}));_0x230d7e[_0xd5cc('0x9')](ewinston[_0xd5cc('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5466d7,_0x4255af){var _0x58cc0c=_0xd5cc('0x17');if(_0x5466d7[_0xd5cc('0x18')]&&_0x5466d7['body'][_0xd5cc('0x19')]&&_0x5466d7[_0xd5cc('0x18')]['agent_id']){_0x58cc0c=_0xd5cc('0x1a');}return util['format'](_0x58cc0c,_0x5466d7[_0xd5cc('0xd')],_0x5466d7[_0xd5cc('0xe')][_0xd5cc('0xf')]?_0x5466d7[_0xd5cc('0xe')][_0xd5cc('0xf')]:_0x5466d7[_0xd5cc('0x10')][_0xd5cc('0x11')]||_0x5466d7['ip'],_0x5466d7[_0xd5cc('0x12')],_0x4255af[_0xd5cc('0x13')],_0x4255af[_0xd5cc('0x14')],_0x5466d7['user']?_0x5466d7[_0xd5cc('0x15')]['id']:null,_0x5466d7['user']?_0x5466d7['user'][_0xd5cc('0x1b')]:null,_0x5466d7['user']?_0x5466d7[_0xd5cc('0x15')][_0xd5cc('0x16')]:null,_0x5466d7[_0xd5cc('0x18')]&&_0x5466d7[_0xd5cc('0x18')][_0xd5cc('0x19')]?_0x5466d7[_0xd5cc('0x18')][_0xd5cc('0x19')]:_0xd5cc('0x1c'),_0x5466d7[_0xd5cc('0x18')]&&_0x5466d7[_0xd5cc('0x18')]['agent_id']?_0x5466d7[_0xd5cc('0x18')]['agent_id']:'',_0x5466d7['body']&&_0x5466d7[_0xd5cc('0x18')][_0xd5cc('0x1d')]?_0x5466d7[_0xd5cc('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x56fcf4){var _0x4ba7ce=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4ba7ce[_0xd5cc('0x1e')](_0x56fcf4[_0xd5cc('0x12')]);}}));_0x230d7e['use']('/api/users',require(_0xd5cc('0x1f')));_0x230d7e['use'](_0xd5cc('0x20'),require(_0xd5cc('0x21')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x22'),require(_0xd5cc('0x23')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x24'),require(_0xd5cc('0x25')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x26'),require(_0xd5cc('0x27')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x28'),require(_0xd5cc('0x29')));_0x230d7e[_0xd5cc('0x9')]('/api/voice/recordings',require(_0xd5cc('0x2a')));_0x230d7e[_0xd5cc('0x9')]('/api/screen/recordings',require('./api/screenRecording'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x2b'),require(_0xd5cc('0x2c')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x2d'),require(_0xd5cc('0x2e')));_0x230d7e['use'](_0xd5cc('0x2f'),require('./api/voiceCallReport'));_0x230d7e[_0xd5cc('0x9')]('/api/voice/dials/reports',require(_0xd5cc('0x30')));_0x230d7e['use'](_0xd5cc('0x31'),require(_0xd5cc('0x32')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x33'),require(_0xd5cc('0x34')));_0x230d7e[_0xd5cc('0x9')]('/api/members/reports',require(_0xd5cc('0x35')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x36'),require(_0xd5cc('0x37')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x38'),require(_0xd5cc('0x39')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x3a'),require(_0xd5cc('0x3b')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x3c'),require(_0xd5cc('0x3d')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x3e'),require(_0xd5cc('0x3f')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x40'),require('./api/mailSubstatus'));_0x230d7e['use'](_0xd5cc('0x41'),require(_0xd5cc('0x42')));_0x230d7e[_0xd5cc('0x9')]('/api/mail/messages',require(_0xd5cc('0x43')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x44'),require('./api/mailApplication'));_0x230d7e[_0xd5cc('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x230d7e[_0xd5cc('0x9')]('/api/dashboards',require(_0xd5cc('0x45')));_0x230d7e[_0xd5cc('0x9')]('/api/dashboards/items',require(_0xd5cc('0x46')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x47'),require(_0xd5cc('0x48')));_0x230d7e[_0xd5cc('0x9')]('/api/fax/applications',require(_0xd5cc('0x49')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x4a'),require('./api/faxInteraction'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x4b'),require(_0xd5cc('0x4c')));_0x230d7e['use'](_0xd5cc('0x4d'),require(_0xd5cc('0x4e')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x4f'),require(_0xd5cc('0x50')));_0x230d7e['use'](_0xd5cc('0x51'),require(_0xd5cc('0x52')));_0x230d7e['use'](_0xd5cc('0x53'),require(_0xd5cc('0x54')));_0x230d7e[_0xd5cc('0x9')]('/api/sms/interactions',require(_0xd5cc('0x55')));_0x230d7e['use'](_0xd5cc('0x56'),require(_0xd5cc('0x57')));_0x230d7e['use'](_0xd5cc('0x58'),require(_0xd5cc('0x59')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x5a'),require(_0xd5cc('0x5b')));_0x230d7e[_0xd5cc('0x9')]('/api/openchannel/applications',require(_0xd5cc('0x5c')));_0x230d7e['use'](_0xd5cc('0x5d'),require(_0xd5cc('0x5e')));_0x230d7e['use'](_0xd5cc('0x5f'),require(_0xd5cc('0x60')));_0x230d7e['use'](_0xd5cc('0x61'),require('./api/openchannelQueue'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x62'),require(_0xd5cc('0x63')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x64'),require(_0xd5cc('0x65')));_0x230d7e['use']('/api/chat/applications',require(_0xd5cc('0x66')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x67'),require(_0xd5cc('0x68')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x69'),require(_0xd5cc('0x6a')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x6b'),require('./api/chatOfflineMessage'));_0x230d7e['use'](_0xd5cc('0x6c'),require(_0xd5cc('0x6d')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x6e'),require('./api/chatGroup'));_0x230d7e[_0xd5cc('0x9')]('/api/chat/proactive_actions',require(_0xd5cc('0x6f')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x70'),require(_0xd5cc('0x71')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x72'),require(_0xd5cc('0x73')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x74'),require(_0xd5cc('0x75')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x76'),require(_0xd5cc('0x77')));_0x230d7e['use']('/api/cm/hopper_final',require(_0xd5cc('0x78')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x79'),require('./api/cmHopperHistory'));_0x230d7e[_0xd5cc('0x9')]('/api/cm/custom_fields',require(_0xd5cc('0x7a')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x7b'),require(_0xd5cc('0x7c')));_0x230d7e[_0xd5cc('0x9')]('/api/automations',require('./api/automation'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x7d'),require('./api/cannedAnswer'));_0x230d7e['use'](_0xd5cc('0x7e'),require(_0xd5cc('0x7f')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x80'),require(_0xd5cc('0x81')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x82'),require(_0xd5cc('0x83')));_0x230d7e['use'](_0xd5cc('0x84'),require('./api/pause'));_0x230d7e['use']('/api/cdr',require(_0xd5cc('0x85')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x86'),require('./api/voiceQueuesLog'));_0x230d7e[_0xd5cc('0x9')]('/api/schedules',require(_0xd5cc('0x87')));_0x230d7e[_0xd5cc('0x9')]('/api/sounds',require(_0xd5cc('0x88')));_0x230d7e['use'](_0xd5cc('0x89'),require('./api/tag'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x8a'),require(_0xd5cc('0x8b')));_0x230d7e[_0xd5cc('0x9')]('/api/triggers',require('./api/trigger'));_0x230d7e['use'](_0xd5cc('0x8c'),require('./api/variable'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x8d'),require(_0xd5cc('0x8e')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x8f'),require(_0xd5cc('0x90')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x91'),require(_0xd5cc('0x92')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x93'),require('./api/analyticDefaultReport'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x94'),require('./api/analyticExtractedReport'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x95'),require(_0xd5cc('0x96')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x97'),require(_0xd5cc('0x98')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x99'),require('./api/analyticTreeReport'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x9a'),require('./api/intSalesforceAccount'));_0x230d7e['use'](_0xd5cc('0x9b'),require('./api/intSalesforceConfiguration'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x9c'),require('./api/intSalesforceField'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x9d'),require('./api/intSugarcrmAccount'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x9e'),require(_0xd5cc('0x9f')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa0'),require(_0xd5cc('0xa1')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa2'),require(_0xd5cc('0xa3')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa4'),require('./api/intDeskConfiguration'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa5'),require(_0xd5cc('0xa6')));_0x230d7e[_0xd5cc('0x9')]('/api/integrations/zoho/accounts',require(_0xd5cc('0xa7')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa8'),require('./api/intZohoConfiguration'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xa9'),require(_0xd5cc('0xaa')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xab'),require(_0xd5cc('0xac')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xad'),require(_0xd5cc('0xae')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xaf'),require(_0xd5cc('0xb0')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xb1'),require(_0xd5cc('0xb2')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xb3'),require(_0xd5cc('0xb4')));_0x230d7e['use'](_0xd5cc('0xb5'),require(_0xd5cc('0xb6')));_0x230d7e['use']('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x230d7e['use']('/api/integrations/vtiger/configurations',require(_0xd5cc('0xb7')));_0x230d7e[_0xd5cc('0x9')]('/api/integrations/vtiger/fields',require(_0xd5cc('0xb8')));_0x230d7e[_0xd5cc('0x9')]('/api/integrations/servicenow/accounts',require(_0xd5cc('0xb9')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xba'),require(_0xd5cc('0xbb')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xbc'),require('./api/intServicenowField'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xbd'),require('./api/intDynamics365Account'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xbe'),require(_0xd5cc('0xbf')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xc0'),require('./api/intDynamics365Field'));_0x230d7e[_0xd5cc('0x9')]('/api/integrations/freshsales/accounts',require(_0xd5cc('0xc1')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xc2'),require(_0xd5cc('0xc3')));_0x230d7e['use'](_0xd5cc('0xc4'),require(_0xd5cc('0xc5')));_0x230d7e[_0xd5cc('0x9')]('/api/networks',require(_0xd5cc('0xc6')));_0x230d7e['use']('/api/chat/reports/queue',require(_0xd5cc('0xc7')));_0x230d7e['use']('/api/chat/internal/messages',require(_0xd5cc('0xc8')));_0x230d7e[_0xd5cc('0x9')]('/api/jscripty/answers/reports',require(_0xd5cc('0xc9')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xca'),require(_0xd5cc('0xcb')));_0x230d7e[_0xd5cc('0x9')]('/api/jscripty/sessions/reports',require(_0xd5cc('0xcc')));_0x230d7e['use']('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xcd'),require(_0xd5cc('0xce')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xcf'),require('./api/squareReportDetail'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd0'),require(_0xd5cc('0xd1')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd2'),require(_0xd5cc('0xd3')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd4'),require(_0xd5cc('0xd5')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd6'),require('./api/squareProject'));_0x230d7e[_0xd5cc('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd7'),require(_0xd5cc('0xd8')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xd9'),require(_0xd5cc('0xda')));_0x230d7e[_0xd5cc('0x9')]('/api/license',require(_0xd5cc('0xdb')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xdc'),require(_0xd5cc('0xdd')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xde'),require(_0xd5cc('0xdf')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xe0'),require(_0xd5cc('0xe1')));_0x230d7e[_0xd5cc('0x9')]('/api/plugins',require('./api/plugin'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xe2'),require(_0xd5cc('0xe3')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xe4'),require(_0xd5cc('0xe5')));_0x230d7e['use'](_0xd5cc('0xe6'),require(_0xd5cc('0xe7')));_0x230d7e['use'](_0xd5cc('0xe8'),require(_0xd5cc('0xe9')));_0x230d7e['use']('/api/sms/reports/transfer',require(_0xd5cc('0xea')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xeb'),require(_0xd5cc('0xec')));_0x230d7e[_0xd5cc('0x9')]('/api/voice/prefixes',require(_0xd5cc('0xed')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xee'),require('./api/userProfile'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xef'),require('./api/userProfileSection'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xf0'),require(_0xd5cc('0xf1')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xf2'),require('./api/notification'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xf3'),require(_0xd5cc('0xf4')));_0x230d7e['use']('/api/whatsapp/applications',require(_0xd5cc('0xf5')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xf6'),require(_0xd5cc('0xf7')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xf8'),require(_0xd5cc('0xf9')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xfa'),require(_0xd5cc('0xfb')));_0x230d7e[_0xd5cc('0x9')]('/api/whatsapp/reports/transfer',require(_0xd5cc('0xfc')));_0x230d7e['use'](_0xd5cc('0xfd'),require(_0xd5cc('0xfe')));_0x230d7e[_0xd5cc('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0xff'),require(_0xd5cc('0x100')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x101'),require('./api/authGoogle'));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x102'),require(_0xd5cc('0x103')));_0x230d7e['use']('/api/rpc',require(_0xd5cc('0x104')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x105'),require(_0xd5cc('0x106')));_0x230d7e['use'](_0xd5cc('0x107'),require(_0xd5cc('0x108')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x109'),require(_0xd5cc('0x10a')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x10b'),require('./api/webbar'));_0x230d7e['use']('/apidoc',express[_0xd5cc('0x10c')](path[_0xd5cc('0x10d')](config[_0xd5cc('0x10e')],'/apidoc')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x10f'),express[_0xd5cc('0x10c')](path[_0xd5cc('0x10d')](config[_0xd5cc('0x10e')],'/www')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x110'),express[_0xd5cc('0x10c')](path['join'](config['root'],'/demo')));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x111'),express['static'](path[_0xd5cc('0x10d')](config[_0xd5cc('0x10e')],'snippet',_0xd5cc('0x112'))));_0x230d7e[_0xd5cc('0x9')](_0xd5cc('0x113'),express[_0xd5cc('0x10c')](path['join'](config[_0xd5cc('0x10e')],_0xd5cc('0x114'))));_0x230d7e['route'](_0xd5cc('0x115'))[_0xd5cc('0x116')](errors[0x194]);_0x230d7e[_0xd5cc('0x117')]('/*')[_0xd5cc('0x116')](function(_0x1d7f24,_0x1f0131){_0x1f0131[_0xd5cc('0x118')](path[_0xd5cc('0x119')](_0x230d7e[_0xd5cc('0x116')](_0xd5cc('0x11a'))+_0xd5cc('0x11b')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e0b781a..e648874 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4923=['merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen'];(function(_0x108ea2,_0x195726){var _0x7294c0=function(_0x170f47){while(--_0x170f47){_0x108ea2['push'](_0x108ea2['shift']());}};_0x7294c0(++_0x195726);}(_0x4923,0x1be));var _0x3492=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4923[_0x57b54c];return _0x59cc19;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3492('0x0'));var _=require(_0x3492('0x1'));var config=require(_0x3492('0x2'));exports[_0x3492('0x3')]=function(){return new BPromise(function(_0x90507a,_0x33bf8f){var _0x250e12={};_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x5')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x6')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x7')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/voiceRecording/voiceRecording.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x8')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x9')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0xa')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0xb')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0xc')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0xd')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0xe')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0xf')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x10')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/mailAccount/mailAccount.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x11')));_0x250e12=_['merge'](_0x250e12,require('../api/mailInteraction/mailInteraction.rpc'));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x12')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x13')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x14')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/faxApplication/faxApplication.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x15')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x16')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/faxQueue/faxQueue.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x17')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x18')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x19')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/smsMessage/smsMessage.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x1a')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x1b')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x1c')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x1d')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x1e')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x1f')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x20')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/chatMessage/chatMessage.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x21')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x22')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x23')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x24')));_0x250e12=_['merge'](_0x250e12,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x25')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x26')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x27')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x28')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x29')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/template/template.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x2a')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x2b')));_0x250e12=_['merge'](_0x250e12,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x2c')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x2d')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x2e')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x2f')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x30')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x31')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x32')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x33')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x34')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x35')));_0x250e12=_['merge'](_0x250e12,require('../api/squareReport/squareReport.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x36')));_0x250e12=_['merge'](_0x250e12,require('../api/squareProject/squareProject.rpc'));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x37')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x38')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x39')));_0x250e12=_['merge'](_0x250e12,require(_0x3492('0x3a')));_0x250e12=_['merge'](_0x250e12,require('../api/plugin/plugin.rpc'));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x3b')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x3c')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x3d')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x3e')));_0x250e12=_[_0x3492('0x4')](_0x250e12,require(_0x3492('0x3f')));var _0x263bf4=jayson[_0x3492('0x40')](_0x250e12)[_0x3492('0x41')]();var _0x4387d8=config[_0x3492('0x42')][_0x3492('0x43')]||config[_0x3492('0x43')]+0x1;var _0x4607b0=config[_0x3492('0x42')]['ip']||_0x3492('0x44');_0x263bf4['on'](_0x3492('0x45'),function(_0xb7254){return _0x33bf8f(_0xb7254);});_0x263bf4['listen'](_0x4387d8,_0x4607b0,function(){console[_0x3492('0x46')](_0x3492('0x47'),_0x4607b0,_0x4387d8);require(_0x3492('0x48'))[_0x3492('0x49')]();return _0x90507a(_0x3492('0x4a')+_0x4607b0+':'+_0x4387d8);});});}; \ No newline at end of file +var _0xdd60=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.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/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0x3f54b1,_0xa91ec3){var _0xceae0b=function(_0x1f1100){while(--_0x1f1100){_0x3f54b1['push'](_0x3f54b1['shift']());}};_0xceae0b(++_0xa91ec3);}(_0xdd60,0xf4));var _0x0dd6=function(_0x59e4d4,_0x541977){_0x59e4d4=_0x59e4d4-0x0;var _0x6b75f7=_0xdd60[_0x59e4d4];return _0x6b75f7;};'use strict';var jayson=require(_0x0dd6('0x0'));var BPromise=require(_0x0dd6('0x1'));var _=require(_0x0dd6('0x2'));var config=require(_0x0dd6('0x3'));exports['listen']=function(){return new BPromise(function(_0x521820,_0x14039e){var _0x274b95={};_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x5')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x6')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x7')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x8')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x9')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0xa')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0xb')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0xc')));_0x274b95=_['merge'](_0x274b95,require('../api/memberReport/memberReport.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0xd')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0xe')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0xf')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x10')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x11')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x12')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/mailMessage/mailMessage.rpc'));_0x274b95=_['merge'](_0x274b95,require('../api/mailApplication/mailApplication.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x13')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x14')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x15')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x16')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/faxMessage/faxMessage.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x17')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x18')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x19')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1a')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/smsMessage/smsMessage.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1b')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1c')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1d')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1e')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x1f')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x20')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x21')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x22')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x23')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x24')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x25')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x26')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/interval/interval.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x27')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x28')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x29')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/trigger/trigger.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x2a')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x2b')));_0x274b95=_['merge'](_0x274b95,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x2c')));_0x274b95=_['merge'](_0x274b95,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x2d')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x2e')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x2f')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x30')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x31')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x32')));_0x274b95=_['merge'](_0x274b95,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x33')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x274b95=_['merge'](_0x274b95,require('../api/squareOdbc/squareOdbc.rpc'));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x34')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x35')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x36')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x37')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x38')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x39')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x3a')));_0x274b95=_['merge'](_0x274b95,require(_0x0dd6('0x3b')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x3c')));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x274b95=_[_0x0dd6('0x4')](_0x274b95,require(_0x0dd6('0x3d')));var _0x19ab02=jayson[_0x0dd6('0x3e')](_0x274b95)['http']();var _0x53a28b=config[_0x0dd6('0x3f')][_0x0dd6('0x40')]||config[_0x0dd6('0x40')]+0x1;var _0x16e23a=config[_0x0dd6('0x3f')]['ip']||_0x0dd6('0x41');_0x19ab02['on'](_0x0dd6('0x42'),function(_0x59db4e){return _0x14039e(_0x59db4e);});_0x19ab02[_0x0dd6('0x43')](_0x53a28b,_0x16e23a,function(){console[_0x0dd6('0x44')](_0x0dd6('0x45'),_0x16e23a,_0x53a28b);require(_0x0dd6('0x46'))[_0x0dd6('0x47')]();return _0x521820(_0x0dd6('0x48')+_0x16e23a+':'+_0x53a28b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 78b25b5..2c0874b 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 _0x0713=['noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x1ec1a2,_0x3f6ca6){var _0x831fad=function(_0x298ea7){while(--_0x298ea7){_0x1ec1a2['push'](_0x1ec1a2['shift']());}};_0x831fad(++_0x3f6ca6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3071('0x0'))[_0x3071('0x1')];var AGIReply=require(_0x3071('0x2'));var AGIError=require(_0x3071('0x3'));function AGIChannel(_0x864539){var _0x52b5fb=this,_0x2c547f=new AGIReply(),_0x7b18a4=![],_0x33a70c={};EventEmitter[_0x3071('0x4')](_0x52b5fb);_0x864539[_0x3071('0x5')](_0x3071('0x6'));_0x864539[_0x3071('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c547f[_0x3071('0x5')](_0x3071('0x6'));_0x2c547f['on'](_0x3071('0x8'),function(_0x3e9a5e){for(var _0x2fce7a in _0x3e9a5e){_0x52b5fb[_0x2fce7a]=_0x3e9a5e[_0x2fce7a];}_0x52b5fb[_0x3071('0x9')]('ready');});_0x2c547f['on'](_0x3071('0xa'),function(_0x2610b4){if(_0x2610b4[_0x3071('0xb')]()==_0x3071('0xc')){_0x52b5fb[_0x3071('0x9')]('hangup');return;}if(_0x2610b4[_0x3071('0xd')](0x0,0xb)==_0x3071('0xe')){_0x7b18a4=!![];}if(_0x7b18a4){_0x33a70c['rx']+=_0x2610b4+'\x0a';if(_0x2610b4[_0x3071('0xf')](_0x3071('0x10'))!=-0x1){_0x7b18a4=![];}}else{_0x33a70c['rx']=_0x2610b4;}if(_0x7b18a4){return;}if(typeof _0x33a70c['cb']==_0x3071('0x11')){var _0x4a8cc7=_0x33a70c['rx']['substring'](0x0,0x3),_0x5330a8=null,_0x1826ca=null;_0x4a8cc7=parseInt(_0x4a8cc7);if(isNaN(_0x4a8cc7)){_0x33a70c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3071('0x12')});return;}if(_0x4a8cc7!=0xc8){_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':-0x1,'extra':'KO'});return;}_0x5330a8=_0x33a70c['rx'][_0x3071('0xd')](0x4)['replace'](_0x3071('0x13'),'');if(_0x5330a8['indexOf']('\x20')!=-0x1){_0x5330a8=_0x5330a8[_0x3071('0x14')](0x0,_0x5330a8[_0x3071('0x15')]('\x20'));}if(_[_0x3071('0x16')](_0x5330a8,'-1')){_0x5330a8=parseInt(_0x5330a8);}_0x1826ca=_0x33a70c['rx'][_0x3071('0x17')]('\x20');if(_0x1826ca[_0x3071('0x18')]==0x3){_0x1826ca=_0x1826ca[0x2][_0x3071('0xd')](0x1,_0x1826ca[0x2][_0x3071('0x18')]-0x1);}else if(_0x1826ca[_0x3071('0x18')]>0x3){var _0x21aad3=/\((.+)\)/;var _0x344ea6=_0x33a70c['rx']['match'](_0x21aad3);if(_0x344ea6){_0x1826ca=_0x344ea6[0x1];}else{_0x1826ca=null;}}else{_0x1826ca=null;}_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':_0x5330a8,'extra':_0x1826ca});}});_0x864539['on'](_0x3071('0x19'),function(_0x17dbda){_0x52b5fb[_0x3071('0x9')](_0x3071('0x19'),new AGIError(_0x3071('0x1a'),_0x17dbda[_0x3071('0x1b')]));});_0x864539['on'](_0x3071('0x1c'),function(){_0x52b5fb[_0x3071('0x9')]('close',new AGIError(_0x3071('0x1d')));});_0x864539['on'](_0x3071('0x1e'),function(){_0x52b5fb[_0x3071('0x9')]('timeout',new AGIError(_0x3071('0x1f')));_0x864539['destroy']();});_0x864539[_0x3071('0x20')](_0x2c547f);this[_0x3071('0x21')]=function(_0x3762d8,_0x457b57){var _0x3762d8=_0x3762d8||'',_0x457b57=typeof _0x457b57==_0x3071('0x11')?_0x457b57:new Function();_0x33a70c={'tx':_0x3762d8,'rx':'','cb':_0x457b57};_0x864539[_0x3071('0x22')](_0x3762d8+'\x0a');},this['close']=function(){_0x864539['destroy']();};}util[_0x3071('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3071('0x24')][_0x3071('0x25')]=function(_0x13df9f){return this[_0x3071('0x21')][_0x3071('0x26')](this,_0x13df9f);};AGIChannel[_0x3071('0x24')][_0x3071('0x27')]=function(){return this[_0x3071('0x25')]('ANSWER');};AGIChannel[_0x3071('0x24')][_0x3071('0x28')]=function(_0x177138,_0x4d5c4b,_0x4fb1ca){_0x177138=_0x177138===undefined?_0x3071('0x29'):_0x177138;_0x4d5c4b=_0x4d5c4b===undefined?'5':_0x4d5c4b;_0x4fb1ca=_0x4fb1ca===undefined?'1':_0x4fb1ca;return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x2b'),_0x177138,_0x4d5c4b*0x3e8,_0x4fb1ca));};AGIChannel[_0x3071('0x24')][_0x3071('0x2c')]=function(_0x3921a1){_0x3921a1=_0x3921a1||_0x3071('0x2d');return this[_0x3071('0x25')](util[_0x3071('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3921a1));};AGIChannel['prototype'][_0x3071('0x2e')]=function(_0x149e0d,_0x6ddf96){if(_[_0x3071('0x2f')](_0x6ddf96)){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x30'),_0x149e0d,_0x6ddf96[_0x3071('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x149e0d,_0x6ddf96));};AGIChannel[_0x3071('0x24')][_0x3071('0x32')]=function(_0x5b5bf1){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x33'),_0x5b5bf1));};AGIChannel[_0x3071('0x24')]['setExtension']=function(_0x218a82){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x34'),_0x218a82));};AGIChannel[_0x3071('0x24')][_0x3071('0x35')]=function(_0x3c55c){return this[_0x3071('0x25')](util['format'](_0x3071('0x36'),_0x3c55c));};AGIChannel['prototype']['hangup']=function(){return this[_0x3071('0x25')](_0x3071('0x37'));};AGIChannel['prototype'][_0x3071('0x38')]=function(_0x46e94e,_0x265d76){var _0x14ac42=_[_0x3071('0x39')](_0x265d76)||_[_0x3071('0x3a')](_0x265d76)?_0x265d76['toString']():_0x265d76;return this[_0x3071('0x25')](util[_0x3071('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46e94e,_0x14ac42?_0x14ac42[_0x3071('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3071('0x24')][_0x3071('0x3c')]=function(_0x5733e9,_0x593c99){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x3d'),_0x5733e9,_0x593c99));};AGIChannel['prototype'][_0x3071('0x3e')]=function(_0x534a77,_0x1ac90a){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x3f'),_0x534a77,_0x1ac90a));};AGIChannel[_0x3071('0x24')][_0x3071('0x40')]=function(_0x30ab68,_0x593c9c){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x41'),_0x30ab68,_0x593c9c));};AGIChannel[_0x3071('0x24')][_0x3071('0x42')]=function(_0x525389,_0x3cfc05,_0x60549a){_0x3cfc05=_0x3cfc05||this[_0x3071('0x43')];_0x60549a=_0x60549a||0x1;this[_0x3071('0x32')](_0x525389);this[_0x3071('0x44')](_0x3cfc05);this[_0x3071('0x35')](_0x60549a);return this['noop'](util[_0x3071('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x525389,_0x3cfc05,_0x60549a));};AGIChannel['prototype']['getVariable']=function(_0x47ceaf){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x45'),_0x47ceaf));};AGIChannel[_0x3071('0x24')][_0x3071('0x46')]=function(_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1e8222,_0x1641d9){_0xa711b5=_0xa711b5||_0x3071('0x47');_0x2e6c70=_0x2e6c70||'';_0x56589e=_0x56589e===undefined?-0x1:_0x56589e==='-1'?-0x1:_0x56589e*0x3e8;_0x1e8222=_0x1e8222===undefined?'':'s='+_0x1e8222;_0x1641d9=_0x1641d9?_0x3071('0x48'):'';return this[_0x3071('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1641d9,_0x1e8222));};AGIChannel[_0x3071('0x24')][_0x3071('0x49')]=function(_0x1fe5e0,_0x5c5865){_0x5c5865=_0x5c5865||'';return this[_0x3071('0x25')](util['format'](_0x3071('0x4a'),_0x1fe5e0,_0x5c5865));};AGIChannel['prototype'][_0x3071('0x4b')]=function(_0x509178){return this['exec'](_0x3071('0x4c'),_0x509178);};AGIChannel['prototype'][_0x3071('0x4d')]=function(_0x5a0a69){return this[_0x3071('0x2e')](_0x3071('0x4e'),_0x5a0a69);};AGIChannel[_0x3071('0x24')][_0x3071('0x19')]=function(_0x554047,_0x2d70bf){this['noop'](util[_0x3071('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x554047['id'],_0x554047[_0x3071('0x4f')],_0x2d70bf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3071('0x50')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ca40a5d..9e88d0c 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 _0xc7a4=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x46947c,_0x3f664b){var _0x7bf837=function(_0x1d3b0b){while(--_0x1d3b0b){_0x46947c['push'](_0x46947c['shift']());}};_0x7bf837(++_0x3f664b);}(_0xc7a4,0x8b));var _0x4c7a=function(_0x9a5701,_0x9cab87){_0x9a5701=_0x9a5701-0x0;var _0x148965=_0xc7a4[_0x9a5701];return _0x148965;};'use strict';var util=require(_0x4c7a('0x0'));var error={'E_AGI_UNDEFINED':_0x4c7a('0x1'),'E_AGI_ARGUMENT_PORT':_0x4c7a('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x4c7a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x4c7a('0x4'),'E_AGI_SOCKET_ERROR':_0x4c7a('0x5'),'E_AGI_SOCKET_CLOSE':_0x4c7a('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x4c7a('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x4c7a('0x8'),'E_AGI_IVR_ENTRY':_0x4c7a('0x9')};function AGIError(_0x351507){var _0x351507=_0x351507||null,_0x30ac05=_0x30ac05||[],_0x5b246a=0x1,_0x2ac39b='';if(!error[_0x351507]){_0x351507='E_AGI_UNDEFINED';}_0x30ac05[_0x4c7a('0xa')](error[_0x351507]);while(arguments[_0x5b246a]){_0x30ac05['push'](arguments[_0x5b246a]);_0x5b246a++;}_0x2ac39b=util[_0x4c7a('0xb')][_0x4c7a('0xc')](util,_0x30ac05);this[_0x4c7a('0xd')]=_0x2ac39b;this[_0x4c7a('0xe')]=_0x351507;}module[_0x4c7a('0xf')]=AGIError; \ No newline at end of file +var _0x06cb=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','format','apply','message','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x501c8b,_0x8ab27b){var _0x5d08d8=function(_0xd84881){while(--_0xd84881){_0x501c8b['push'](_0x501c8b['shift']());}};_0x5d08d8(++_0x8ab27b);}(_0x06cb,0x1c6));var _0xb06c=function(_0x4c02a6,_0x405fb4){_0x4c02a6=_0x4c02a6-0x0;var _0x1ae345=_0x06cb[_0x4c02a6];return _0x1ae345;};'use strict';var util=require(_0xb06c('0x0'));var error={'E_AGI_UNDEFINED':_0xb06c('0x1'),'E_AGI_ARGUMENT_PORT':_0xb06c('0x2'),'E_AGI_SERVER_ERROR':_0xb06c('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xb06c('0x4'),'E_AGI_SOCKET_ERROR':_0xb06c('0x5'),'E_AGI_SOCKET_CLOSE':_0xb06c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xb06c('0x7'),'E_AGI_COMMAND_EMPTY':_0xb06c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xb06c('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2e480f){var _0x2e480f=_0x2e480f||null,_0x323616=_0x323616||[],_0x33510e=0x1,_0x61724='';if(!error[_0x2e480f]){_0x2e480f=_0xb06c('0xa');}_0x323616['push'](error[_0x2e480f]);while(arguments[_0x33510e]){_0x323616['push'](arguments[_0x33510e]);_0x33510e++;}_0x61724=util[_0xb06c('0xb')][_0xb06c('0xc')](util,_0x323616);this[_0xb06c('0xd')]=_0x61724;this['name']=_0x2e480f;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2c76058..6520d5b 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 _0x1339=['agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','default','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports'];(function(_0x5a1333,_0x5ac266){var _0x179855=function(_0x3ea9b7){while(--_0x3ea9b7){_0x5a1333['push'](_0x5a1333['shift']());}};_0x179855(++_0x5ac266);}(_0x1339,0x1ed));var _0x9133=function(_0xada3d6,_0x2cc5a2){_0xada3d6=_0xada3d6-0x0;var _0x3f7250=_0x1339[_0xada3d6];return _0x3f7250;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0x9133('0x0'));var verticesWithRetry=[_0x9133('0x1'),_0x9133('0x2'),_0x9133('0x3')];var Graph=function(){this[_0x9133('0x4')]={};this[_0x9133('0x5')]={};this[_0x9133('0x6')]=0x0;};Graph[_0x9133('0x7')]['addVertex']=function(_0x578643){this[_0x9133('0x4')][_0x578643['id']]=_0x578643;this[_0x9133('0x5')][_0x578643['id']]=[];};Graph['prototype'][_0x9133('0x8')]=function(_0x334dcd,_0x3059c4,_0x431a55){this[_0x9133('0x5')][_0x334dcd][_0x9133('0x9')]({'target':_0x3059c4,'condition':_0x431a55});this[_0x9133('0x6')]+=0x1;};Graph[_0x9133('0x7')][_0x9133('0xa')]=function(){return _[_0x9133('0xa')](this['vertices']);};Graph[_0x9133('0x7')][_0x9133('0xb')]=function(){return this[_0x9133('0x6')];};Graph[_0x9133('0x7')][_0x9133('0xc')]=function(_0x244ced){return this['vertices'][_0x244ced];};Graph[_0x9133('0x7')][_0x9133('0xd')]=function(_0x4bbfdc,_0x5283a3){if(!this[_0x9133('0x4')][_0x4bbfdc]){return logger['info'](_0x9133('0xe'));}var _0x439e1a=_0x5283a3(this[_0x9133('0x4')][_0x4bbfdc]);if(!_0x439e1a){return logger[_0x9133('0xf')](_0x9133('0x10'));}if(this[_0x9133('0x5')][_0x4bbfdc]['length']===0x0){return logger[_0x9133('0xf')](_0x9133('0x11'));}for(var _0x4f4f14=0x0,_0x28ffcb=[],_0xa46eb1=![];_0x4f4f14\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','close','timeout','evtHangup','hangup','sync','production','start','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','Project\x20%s\x20not\x20published','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','lodash','syncho','util','moment','../../config/environment','agi','./rpc','./mailRpc','./graph','127.0.0.1','nextTick','error','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','stack','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','isArray','length','source','target','addEdge','then','createSquareReport','indexOf','agi_','substring','inspect','debug'];(function(_0x4a6fd0,_0x29621a){var _0x318b5a=function(_0x595e5a){while(--_0x595e5a){_0x4a6fd0['push'](_0x4a6fd0['shift']());}};_0x318b5a(++_0x29621a);}(_0x6f7f,0x177));var _0xf6f7=function(_0x4fa003,_0x42d436){_0x4fa003=_0x4fa003-0x0;var _0xfb4211=_0x6f7f[_0x4fa003];return _0xfb4211;};'use strict';var parser=require('xml2json');var _=require(_0xf6f7('0x0'));var syncho=require(_0xf6f7('0x1'));var util=require(_0xf6f7('0x2'));var moment=require(_0xf6f7('0x3'));var config=require(_0xf6f7('0x4'));var logger=require('../../config/logger')(_0xf6f7('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xf6f7('0x6'));var mailRpc=require(_0xf6f7('0x7'));var Graph=require(_0xf6f7('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf6f7('0x5')]=_['defaults'](config[_0xf6f7('0x5')],{'ip':_0xf6f7('0x9'),'port':0x11dd});function connectionHandler(_0xe86f3a){process[_0xf6f7('0xa')](function(){syncho(function(){try{setChannelVariables(_0xe86f3a);agiHandler(_0xe86f3a);}catch(_0x2bf166){logger[_0xf6f7('0xb')](_0x2bf166['stack']);}});});}function listeningHandler(){console[_0xf6f7('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')](_0xf6f7('0xf'),config[_0xf6f7('0x5')]['ip'],config[_0xf6f7('0x5')][_0xf6f7('0x10')]));}function errorHandler(_0x4def48){if(_0x4def48&&_0x4def48['name']&&_0x4def48[_0xf6f7('0x11')]){logger[_0xf6f7('0xb')](util[_0xf6f7('0xe')](_0xf6f7('0x12'),_0x4def48['name'],_0x4def48['message']));}else{logger[_0xf6f7('0xb')](util['format'](_0xf6f7('0x13'),_0x4def48['stack']));}}function closeHandler(){logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')](_0xf6f7('0x14'),this[_0xf6f7('0x15')],this[_0xf6f7('0x16')],this['callerid'],this[_0xf6f7('0x17')],this[_0xf6f7('0x18')]));try{createSquareReport(this);}catch(_0x566589){logger[_0xf6f7('0xb')](_0x566589[_0xf6f7('0x19')]);}}function timeoutHandler(){logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf6f7('0x15')],this[_0xf6f7('0x16')],this['callerid'],this[_0xf6f7('0x17')],this[_0xf6f7('0x18')]));}function hangupHandler(){logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')](_0xf6f7('0x1a'),this[_0xf6f7('0x15')],this[_0xf6f7('0x16')],this['callerid'],this[_0xf6f7('0x17')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x66e5e4){return parser['toJson'](_0x66e5e4,{'object':!![]})[_0xf6f7('0x1b')][_0xf6f7('0x1c')];}function addVertex(_0x50b550,_0x3ce38d,_0x5ec44f){_0x3ce38d['agicommand']=_0x5ec44f;if(_0x3ce38d[_0xf6f7('0x1d')](_0xf6f7('0x1e'))){_0x3ce38d[_0xf6f7('0x1f')]=parseInt(_0x3ce38d[_0xf6f7('0x1e')],0xa);}_0x50b550[_0xf6f7('0x20')](_['omit'](_0x3ce38d,'mxCell'));}function initGraph(_0x3fecc1,_0x2620a4){var _0x277023=new Graph();for(var _0x1de269 in _0x3fecc1){if(_0x3fecc1[_0xf6f7('0x1d')](_0x1de269)){if(_[_0xf6f7('0x21')](_0x3fecc1[_0x1de269])){for(var _0x4b6e82=0x0;_0x4b6e82<_0x3fecc1[_0x1de269][_0xf6f7('0x22')];_0x4b6e82+=0x1){addVertex(_0x277023,_0x3fecc1[_0x1de269][_0x4b6e82],_0x1de269);}}else{addVertex(_0x277023,_0x3fecc1[_0x1de269],_0x1de269);}}}for(var _0x2c545c=0x0;_0x2c545c<_0x2620a4[_0xf6f7('0x22')];_0x2c545c+=0x1){if(_0x2620a4[_0x2c545c][_0xf6f7('0x23')]&&_0x2620a4[_0x2c545c][_0xf6f7('0x24')]){_0x277023[_0xf6f7('0x25')](_0x2620a4[_0x2c545c][_0xf6f7('0x23')],_0x2620a4[_0x2c545c]['target'],_0x2620a4[_0x2c545c]['value']);}}return _0x277023;}function getSquareProject(_0x4bd86c,_0x3bd11b){rpc['getSquareProject'](_0x4bd86c)[_0xf6f7('0x26')](function(_0x35b586){_0x3bd11b(null,_0x35b586);})['catch'](function(_0x50ef5b){_0x3bd11b(null,_0x50ef5b);});}function createSquareReport(_0x3b85db,_0x26610f){rpc[_0xf6f7('0x27')](_0x3b85db)['then'](function(_0x2fcb7c){if(_0x26610f){_0x26610f(null,_0x2fcb7c);}})['catch'](function(_0x34b223){if(_0x26610f){_0x26610f(null,_0x34b223);}});}function setChannelVariables(_0x2b0faf){for(var _0x958646 in _0x2b0faf){if(_0x2b0faf[_0xf6f7('0x1d')](_0x958646)){if(_0x958646[_0xf6f7('0x28')](_0xf6f7('0x29'))===0x0){_0x2b0faf[_0x958646[_0xf6f7('0x2a')](0x4)]=_0x2b0faf[_0x958646];delete _0x2b0faf[_0x958646];}}}}function getLogFromObject(_0x257af4){return util[_0xf6f7('0x2b')](_0x257af4,{'showHidden':![],'depth':null});}function agiHandler(_0x174730){var _0xd755e6,_0x4589c4,_0x5883e3,_0x3fbdb6,_0x55e336;logger[_0xf6f7('0x2c')](_0xf6f7('0x2d'),JSON[_0xf6f7('0x2e')](_0x174730,null,0x2));logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')](_0xf6f7('0x2f'),_0x174730[_0xf6f7('0x15')],_0x174730[_0xf6f7('0x16')],_0x174730[_0xf6f7('0x30')],_0x174730['dnid'],_0x174730['uniqueid']));_0x174730['on'](_0xf6f7('0xb'),errorHandler);_0x174730['on'](_0xf6f7('0x31'),closeHandler);_0x174730['on'](_0xf6f7('0x32'),timeoutHandler);_0x174730[_0xf6f7('0x33')]=![];_0x174730['on'](_0xf6f7('0x34'),hangupHandler);var _0x41975f=getSquareProject[_0xf6f7('0x35')](null,_0x174730[_0xf6f7('0x15')]);if(_0x41975f){if(_0x41975f[_0xf6f7('0x36')]){_0xd755e6=getRoot(_0x41975f[_0xf6f7('0x36')]);if(_0xd755e6&&_0xd755e6[_0xf6f7('0x37')]){logger[_0xf6f7('0x2c')](_0xf6f7('0x1c'),JSON[_0xf6f7('0x2e')](_0xd755e6,null,0x2));_0x174730[_0xf6f7('0x38')]=moment()[_0xf6f7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x4589c4=initGraph(_['omit'](_0xd755e6,_0xf6f7('0x39')),_0xd755e6[_0xf6f7('0x39')]);_0x5883e3=new Vertices(_0x174730,rpc,mailRpc);logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')](_0xf6f7('0x3a'),_0x174730[_0xf6f7('0x15')],_0x174730['calleridname'],_0x174730[_0xf6f7('0x30')],_0x174730[_0xf6f7('0x17')],_0x174730[_0xf6f7('0x18')]));_0x4589c4[_0xf6f7('0x3b')](_0xd755e6['start']['id'],function(_0x489c39){try{_0x489c39=_0x5883e3[_0xf6f7('0x3c')](_0x489c39);logger['debug']('vertex',JSON[_0xf6f7('0x2e')](_0x489c39,null,0x2));if(_0x489c39[_0xf6f7('0x3d')]===_0xf6f7('0x3e')){logger['info'](_0xf6f7('0x3f'));_0x174730[_0xf6f7('0x40')]=_0x489c39[_0xf6f7('0x40')]||_0x174730[_0xf6f7('0x40')];_0x174730['extension']=_0x489c39[_0xf6f7('0x41')];_0x174730[_0xf6f7('0x42')]=_0x489c39['priority']?_0x489c39['priority']-0x1:0x1;return null;}else if(_0x489c39&&_0x5883e3[_0x489c39[_0xf6f7('0x3d')]]){_0x55e336=_0x5883e3[_0x489c39['agicommand']](_0x489c39);logger[_0xf6f7('0xd')]('response',JSON['stringify'](_0x55e336,null,0x2));if(_0x55e336&&_0x55e336['code']===AGI_CODE_SUCCESS&&_0x55e336[_0xf6f7('0x43')]!==AGI_RESULT_ERROR&&!_0x174730[_0xf6f7('0x33')]){logger[_0xf6f7('0x2c')](_0xf6f7('0x44'),getLogFromObject(_0x55e336));return _['isUndefined'](_0x55e336[_0xf6f7('0x43')])?null:_0x55e336['result'][_0xf6f7('0x45')]();}else{logger['error']('response',getLogFromObject(_0x55e336));return null;}}else{logger[_0xf6f7('0xb')](_0xf6f7('0x46'));return null;}}catch(_0xff8a0f){logger['error'](_0xff8a0f[_0xf6f7('0x19')]);return null;}});if(_0xd755e6[_0xf6f7('0x47')]){logger['info'](util['format'](_0xf6f7('0x48'),_0x174730['arg_1'],_0x174730[_0xf6f7('0x16')],_0x174730['callerid'],_0x174730['dnid'],_0x174730[_0xf6f7('0x18')]));_0x4589c4['traverseBFS'](_0xd755e6[_0xf6f7('0x47')]['id'],function(_0x59b0fd){try{_0x59b0fd=_0x5883e3[_0xf6f7('0x3c')](_0x59b0fd);logger['debug']('vertex',JSON[_0xf6f7('0x2e')](_0x59b0fd,null,0x2));if(_0x59b0fd&&_0x5883e3[_0x59b0fd[_0xf6f7('0x3d')]]){_0x55e336=_0x5883e3[_0x59b0fd[_0xf6f7('0x3d')]](_0x59b0fd);if(_0x55e336){logger[_0xf6f7('0x2c')](_0xf6f7('0x44'),getLogFromObject(_0x55e336));return _[_0xf6f7('0x49')](_0x55e336[_0xf6f7('0x43')])?null:_0x55e336[_0xf6f7('0x43')][_0xf6f7('0x45')]();}else{logger[_0xf6f7('0xb')](_0xf6f7('0x44'),getLogFromObject(_0x55e336));return null;}}else{logger[_0xf6f7('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x4003b7){logger['error'](_0x4003b7[_0xf6f7('0x19')]);return null;}});}logger[_0xf6f7('0xd')](util[_0xf6f7('0xe')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x174730[_0xf6f7('0x15')],_0x174730[_0xf6f7('0x16')],_0x174730[_0xf6f7('0x30')],_0x174730[_0xf6f7('0x17')],_0x174730[_0xf6f7('0x18')]));logger['info'](util[_0xf6f7('0xe')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x174730[_0xf6f7('0x40')],_0x174730[_0xf6f7('0x41')],parseInt(_0x174730[_0xf6f7('0x42')],0xa)+0x1));_0x174730['continueAt'](_0x174730['context'],_0x174730[_0xf6f7('0x41')],parseInt(_0x174730[_0xf6f7('0x42')],0xa)+0x1);_0x174730[_0xf6f7('0x31')]();}}else{logger['error'](util[_0xf6f7('0xe')](_0xf6f7('0x4a'),_0x174730[_0xf6f7('0x15')]));_0x174730[_0xf6f7('0x4b')](_0x174730[_0xf6f7('0x40')],_0x174730[_0xf6f7('0x41')],parseInt(_0x174730['priority'],0xa)+0x1);_0x174730[_0xf6f7('0x31')]();}}else{logger[_0xf6f7('0xb')](util['format']('Project\x20%s\x20not\x20found',_0x174730[_0xf6f7('0x15')]));_0x174730[_0xf6f7('0x4b')](_0x174730['context'],_0x174730[_0xf6f7('0x41')],parseInt(_0x174730['priority'],0xa)+0x1);_0x174730[_0xf6f7('0x31')]();}}function main(){var _0x41f083;return utilLicense[_0xf6f7('0x4c')]()[_0xf6f7('0x26')](function(_0x12ed5a){if(_0x12ed5a){if(_0x12ed5a[_0xf6f7('0x4d')]){if(_0x12ed5a[_0xf6f7('0x4e')]&&_0x12ed5a[_0xf6f7('0x4e')]>0x0){logger['info'](util['format']('[LICENSE]\x20CHANNELS:\x20%s',_0x12ed5a[_0xf6f7('0x4e')]));_0x41f083=_0x12ed5a[_0xf6f7('0x4e')];}else{logger[_0xf6f7('0xd')](_0xf6f7('0x4f'));}}else{logger['info'](_0xf6f7('0x50'));_0x41f083=-0x1;}}})['catch'](function(_0x117ec1){logger[_0xf6f7('0xb')](_0xf6f7('0x51'),_0x117ec1[_0xf6f7('0x19')]);})['finally'](function(){var _0x1e43c4=require(_0xf6f7('0x52'))(config[_0xf6f7('0x5')][_0xf6f7('0x10')],config[_0xf6f7('0x5')]['ip'],_0x41f083);_0x1e43c4['on'](_0xf6f7('0xb'),errorHandler);_0x1e43c4['on'](_0xf6f7('0x53'),listeningHandler);_0x1e43c4['on']('connection',connectionHandler);_0x1e43c4['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x5ad3=['vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','connection','xml2json','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','port','name','message','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','uniqueid','stack','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','then','indexOf','substring','inspect','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear'];(function(_0x4d348c,_0x46445e){var _0x3a9837=function(_0x2cce6b){while(--_0x2cce6b){_0x4d348c['push'](_0x4d348c['shift']());}};_0x3a9837(++_0x46445e);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x5257bf,_0xf39844){_0x5257bf=_0x5257bf-0x0;var _0x30f32b=_0x5ad3[_0x5257bf];return _0x30f32b;};'use strict';var parser=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var syncho=require(_0x35ad('0x2'));var util=require(_0x35ad('0x3'));var moment=require('moment');var config=require(_0x35ad('0x4'));var logger=require(_0x35ad('0x5'))(_0x35ad('0x6'));var utilLicense=require(_0x35ad('0x7'));var rpc=require(_0x35ad('0x8'));var mailRpc=require(_0x35ad('0x9'));var Graph=require(_0x35ad('0xa'));var Vertices=require(_0x35ad('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x35ad('0x6')]=_[_0x35ad('0xc')](config['agi'],{'ip':_0x35ad('0xd'),'port':0x11dd});function connectionHandler(_0x3cec3e){process[_0x35ad('0xe')](function(){syncho(function(){try{setChannelVariables(_0x3cec3e);agiHandler(_0x3cec3e);}catch(_0x5400f3){logger[_0x35ad('0xf')](_0x5400f3['stack']);}});});}function listeningHandler(){console['log'](_0x35ad('0x10'),config[_0x35ad('0x6')]['port']);logger[_0x35ad('0x11')](util[_0x35ad('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x35ad('0x6')][_0x35ad('0x13')]));}function errorHandler(_0x4cf6bd){if(_0x4cf6bd&&_0x4cf6bd[_0x35ad('0x14')]&&_0x4cf6bd[_0x35ad('0x15')]){logger['error'](util['format'](_0x35ad('0x16'),_0x4cf6bd[_0x35ad('0x14')],_0x4cf6bd[_0x35ad('0x15')]));}else{logger['error'](util[_0x35ad('0x12')](_0x35ad('0x17'),_0x4cf6bd['stack']));}}function closeHandler(){logger[_0x35ad('0x11')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x35ad('0x18')],this[_0x35ad('0x19')],this[_0x35ad('0x1a')],this['dnid'],this[_0x35ad('0x1b')]));try{createSquareReport(this);}catch(_0x2f3f27){logger[_0x35ad('0xf')](_0x2f3f27[_0x35ad('0x1c')]);}}function timeoutHandler(){logger[_0x35ad('0x11')](util[_0x35ad('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x35ad('0x18')],this[_0x35ad('0x19')],this['callerid'],this['dnid'],this[_0x35ad('0x1b')]));}function hangupHandler(){logger[_0x35ad('0x11')](util['format'](_0x35ad('0x1d'),this[_0x35ad('0x18')],this['calleridname'],this[_0x35ad('0x1a')],this[_0x35ad('0x1e')],this[_0x35ad('0x1b')]));this[_0x35ad('0x1f')]=!![];}function getRoot(_0x1be6d2){return parser[_0x35ad('0x20')](_0x1be6d2,{'object':!![]})[_0x35ad('0x21')][_0x35ad('0x22')];}function addVertex(_0x2fb296,_0xebc6c5,_0x4c5740){_0xebc6c5[_0x35ad('0x23')]=_0x4c5740;if(_0xebc6c5[_0x35ad('0x24')]('retry')){_0xebc6c5[_0x35ad('0x25')]=parseInt(_0xebc6c5[_0x35ad('0x26')],0xa);}_0x2fb296[_0x35ad('0x27')](_[_0x35ad('0x28')](_0xebc6c5,_0x35ad('0x29')));}function initGraph(_0x561cae,_0x37e9bd){var _0x226167=new Graph();for(var _0x3dc3c4 in _0x561cae){if(_0x561cae[_0x35ad('0x24')](_0x3dc3c4)){if(_[_0x35ad('0x2a')](_0x561cae[_0x3dc3c4])){for(var _0x20a682=0x0;_0x20a682<_0x561cae[_0x3dc3c4][_0x35ad('0x2b')];_0x20a682+=0x1){addVertex(_0x226167,_0x561cae[_0x3dc3c4][_0x20a682],_0x3dc3c4);}}else{addVertex(_0x226167,_0x561cae[_0x3dc3c4],_0x3dc3c4);}}}for(var _0xaf7237=0x0;_0xaf7237<_0x37e9bd['length'];_0xaf7237+=0x1){if(_0x37e9bd[_0xaf7237][_0x35ad('0x2c')]&&_0x37e9bd[_0xaf7237][_0x35ad('0x2d')]){_0x226167[_0x35ad('0x2e')](_0x37e9bd[_0xaf7237][_0x35ad('0x2c')],_0x37e9bd[_0xaf7237][_0x35ad('0x2d')],_0x37e9bd[_0xaf7237]['value']);}}return _0x226167;}function getSquareProject(_0x571ad6,_0x131d65){rpc['getSquareProject'](_0x571ad6)[_0x35ad('0x2f')](function(_0x4ccaea){_0x131d65(null,_0x4ccaea);})['catch'](function(_0x589e4a){_0x131d65(null,_0x589e4a);});}function createSquareReport(_0x5380e5,_0x55906e){rpc['createSquareReport'](_0x5380e5)['then'](function(_0x183037){if(_0x55906e){_0x55906e(null,_0x183037);}})['catch'](function(_0x3d5670){if(_0x55906e){_0x55906e(null,_0x3d5670);}});}function setChannelVariables(_0x51cf37){for(var _0x4005ad in _0x51cf37){if(_0x51cf37['hasOwnProperty'](_0x4005ad)){if(_0x4005ad[_0x35ad('0x30')]('agi_')===0x0){_0x51cf37[_0x4005ad[_0x35ad('0x31')](0x4)]=_0x51cf37[_0x4005ad];delete _0x51cf37[_0x4005ad];}}}}function getLogFromObject(_0x2766dd){return util[_0x35ad('0x32')](_0x2766dd,{'showHidden':![],'depth':null});}function agiHandler(_0x4b6ec2){var _0x2852e2,_0x2e5fcb,_0x129710,_0x31b591,_0x3cb239;logger['debug']('variables',JSON[_0x35ad('0x33')](_0x4b6ec2,null,0x2));logger[_0x35ad('0x11')](util[_0x35ad('0x12')](_0x35ad('0x34'),_0x4b6ec2['arg_1'],_0x4b6ec2[_0x35ad('0x19')],_0x4b6ec2[_0x35ad('0x1a')],_0x4b6ec2[_0x35ad('0x1e')],_0x4b6ec2[_0x35ad('0x1b')]));_0x4b6ec2['on'](_0x35ad('0xf'),errorHandler);_0x4b6ec2['on'](_0x35ad('0x35'),closeHandler);_0x4b6ec2['on']('timeout',timeoutHandler);_0x4b6ec2['evtHangup']=![];_0x4b6ec2['on'](_0x35ad('0x36'),hangupHandler);var _0x2800e7=getSquareProject[_0x35ad('0x37')](null,_0x4b6ec2[_0x35ad('0x18')]);if(_0x2800e7){if(_0x2800e7[_0x35ad('0x38')]){_0x2852e2=getRoot(_0x2800e7[_0x35ad('0x38')]);if(_0x2852e2&&_0x2852e2[_0x35ad('0x39')]){logger[_0x35ad('0x3a')](_0x35ad('0x22'),JSON['stringify'](_0x2852e2,null,0x2));_0x4b6ec2[_0x35ad('0x3b')]=moment()['format'](_0x35ad('0x3c'));_0x2e5fcb=initGraph(_[_0x35ad('0x28')](_0x2852e2,_0x35ad('0x29')),_0x2852e2[_0x35ad('0x29')]);_0x129710=new Vertices(_0x4b6ec2,rpc,mailRpc);logger[_0x35ad('0x11')](util[_0x35ad('0x12')](_0x35ad('0x3d'),_0x4b6ec2[_0x35ad('0x18')],_0x4b6ec2[_0x35ad('0x19')],_0x4b6ec2['callerid'],_0x4b6ec2[_0x35ad('0x1e')],_0x4b6ec2[_0x35ad('0x1b')]));_0x2e5fcb[_0x35ad('0x3e')](_0x2852e2['start']['id'],function(_0x19d82d){try{_0x19d82d=_0x129710[_0x35ad('0x3f')](_0x19d82d);logger[_0x35ad('0x3a')](_0x35ad('0x40'),JSON[_0x35ad('0x33')](_0x19d82d,null,0x2));if(_0x19d82d[_0x35ad('0x23')]===_0x35ad('0x41')){logger[_0x35ad('0x11')](_0x35ad('0x42'));_0x4b6ec2[_0x35ad('0x43')]=_0x19d82d[_0x35ad('0x43')]||_0x4b6ec2['context'];_0x4b6ec2[_0x35ad('0x44')]=_0x19d82d['extension'];_0x4b6ec2[_0x35ad('0x45')]=_0x19d82d[_0x35ad('0x45')]?_0x19d82d[_0x35ad('0x45')]-0x1:0x1;return null;}else if(_0x19d82d&&_0x129710[_0x19d82d[_0x35ad('0x23')]]){_0x3cb239=_0x129710[_0x19d82d[_0x35ad('0x23')]](_0x19d82d);logger[_0x35ad('0x11')](_0x35ad('0x46'),JSON[_0x35ad('0x33')](_0x3cb239,null,0x2));if(_0x3cb239&&_0x3cb239[_0x35ad('0x47')]===AGI_CODE_SUCCESS&&_0x3cb239['result']!==AGI_RESULT_ERROR&&!_0x4b6ec2[_0x35ad('0x1f')]){logger[_0x35ad('0x3a')](_0x35ad('0x46'),getLogFromObject(_0x3cb239));return _[_0x35ad('0x48')](_0x3cb239[_0x35ad('0x49')])?null:_0x3cb239['result'][_0x35ad('0x4a')]();}else{logger[_0x35ad('0xf')]('response',getLogFromObject(_0x3cb239));return null;}}else{logger['error'](_0x35ad('0x4b'));return null;}}catch(_0x228498){logger[_0x35ad('0xf')](_0x228498[_0x35ad('0x1c')]);return null;}});if(_0x2852e2['finally']){logger[_0x35ad('0x11')](util[_0x35ad('0x12')](_0x35ad('0x4c'),_0x4b6ec2[_0x35ad('0x18')],_0x4b6ec2[_0x35ad('0x19')],_0x4b6ec2[_0x35ad('0x1a')],_0x4b6ec2[_0x35ad('0x1e')],_0x4b6ec2['uniqueid']));_0x2e5fcb[_0x35ad('0x3e')](_0x2852e2[_0x35ad('0x4d')]['id'],function(_0x63ce47){try{_0x63ce47=_0x129710['clear'](_0x63ce47);logger['debug']('vertex',JSON[_0x35ad('0x33')](_0x63ce47,null,0x2));if(_0x63ce47&&_0x129710[_0x63ce47[_0x35ad('0x23')]]){_0x3cb239=_0x129710[_0x63ce47[_0x35ad('0x23')]](_0x63ce47);if(_0x3cb239){logger[_0x35ad('0x3a')]('response',getLogFromObject(_0x3cb239));return _[_0x35ad('0x48')](_0x3cb239[_0x35ad('0x49')])?null:_0x3cb239[_0x35ad('0x49')][_0x35ad('0x4a')]();}else{logger[_0x35ad('0xf')](_0x35ad('0x46'),getLogFromObject(_0x3cb239));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x34a9a3){logger[_0x35ad('0xf')](_0x34a9a3['stack']);return null;}});}logger['info'](util[_0x35ad('0x12')](_0x35ad('0x4e'),_0x4b6ec2[_0x35ad('0x18')],_0x4b6ec2['calleridname'],_0x4b6ec2['callerid'],_0x4b6ec2[_0x35ad('0x1e')],_0x4b6ec2[_0x35ad('0x1b')]));logger[_0x35ad('0x11')](util['format'](_0x35ad('0x4f'),_0x4b6ec2[_0x35ad('0x43')],_0x4b6ec2[_0x35ad('0x44')],parseInt(_0x4b6ec2[_0x35ad('0x45')],0xa)+0x1));_0x4b6ec2[_0x35ad('0x50')](_0x4b6ec2[_0x35ad('0x43')],_0x4b6ec2['extension'],parseInt(_0x4b6ec2[_0x35ad('0x45')],0xa)+0x1);_0x4b6ec2[_0x35ad('0x35')]();}}else{logger[_0x35ad('0xf')](util['format'](_0x35ad('0x51'),_0x4b6ec2[_0x35ad('0x18')]));_0x4b6ec2[_0x35ad('0x50')](_0x4b6ec2[_0x35ad('0x43')],_0x4b6ec2['extension'],parseInt(_0x4b6ec2['priority'],0xa)+0x1);_0x4b6ec2[_0x35ad('0x35')]();}}else{logger[_0x35ad('0xf')](util[_0x35ad('0x12')](_0x35ad('0x52'),_0x4b6ec2[_0x35ad('0x18')]));_0x4b6ec2['continueAt'](_0x4b6ec2[_0x35ad('0x43')],_0x4b6ec2[_0x35ad('0x44')],parseInt(_0x4b6ec2[_0x35ad('0x45')],0xa)+0x1);_0x4b6ec2[_0x35ad('0x35')]();}}function main(){var _0x3b8004;return utilLicense[_0x35ad('0x53')]()['then'](function(_0x579090){if(_0x579090){if(_0x579090[_0x35ad('0x54')]){if(_0x579090[_0x35ad('0x55')]&&_0x579090[_0x35ad('0x55')]>0x0){logger[_0x35ad('0x11')](util[_0x35ad('0x12')](_0x35ad('0x56'),_0x579090[_0x35ad('0x55')]));_0x3b8004=_0x579090['callysquare'];}else{logger[_0x35ad('0x11')](_0x35ad('0x57'));}}else{logger[_0x35ad('0x11')](_0x35ad('0x58'));_0x3b8004=-0x1;}}})['catch'](function(_0x12735e){logger[_0x35ad('0xf')]('[LICENSE]',_0x12735e[_0x35ad('0x1c')]);})[_0x35ad('0x4d')](function(){var _0x1da9ca=require(_0x35ad('0x59'))(config[_0x35ad('0x6')][_0x35ad('0x13')],config[_0x35ad('0x6')]['ip'],_0x3b8004);_0x1da9ca['on'](_0x35ad('0xf'),errorHandler);_0x1da9ca['on']('listening',listeningHandler);_0x1da9ca['on'](_0x35ad('0x5a'),connectionHandler);_0x1da9ca['on'](_0x35ad('0x35'),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 a53d274..937113d 100644 --- a/server/services/agi/mailRpc/index.js +++ b/server/services/agi/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x5d93a5,_0x25f4cb){var _0xedfe6d=function(_0xa88ca){while(--_0xa88ca){_0x5d93a5['push'](_0x5d93a5['shift']());}};_0xedfe6d(++_0x25f4cb);}(_0x814b,0x1a2));var _0xb814=function(_0x761b6d,_0x7c7fa8){_0x761b6d=_0x761b6d-0x0;var _0x3a1639=_0x814b[_0x761b6d];return _0x3a1639;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x3c63db,_0x2bfebc){var _0x498cb3=function(_0x512cec){while(--_0x512cec){_0x3c63db['push'](_0x3c63db['shift']());}};_0x498cb3(++_0x2bfebc);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 38c57f1..aead3ba 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(_0x4b53d3,_0x19db52){var _0x15b95d=function(_0x379926){while(--_0x379926){_0x4b53d3['push'](_0x4b53d3['shift']());}};_0x15b95d(++_0x19db52);}(_0x5f2f,0x73));var _0xf5f2=function(_0x179163,_0x516295){_0x179163=_0x179163-0x0;var _0x5a2cb2=_0x5f2f[_0x179163];return _0x5a2cb2;};'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(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xb10b,0x12a));var _0xbb10=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xb10b[_0x213518];return _0x1baf75;};'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 1bb52ff..f8e658d 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 _0x4c7a=['ShowInterval','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','then','CreateCmContact','getPauseById','agentLogin','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','ShowTrunk','getSoundById','save_name'];(function(_0x2d7e21,_0x259497){var _0x205584=function(_0x2ebbd1){while(--_0x2ebbd1){_0x2d7e21['push'](_0x2d7e21['shift']());}};_0x205584(++_0x259497);}(_0x4c7a,0x125));var _0xa4c7=function(_0x5344e4,_0x5a39c0){_0x5344e4=_0x5344e4-0x0;var _0x4d2b41=_0x4c7a[_0x5344e4];return _0x4d2b41;};'use strict';var BPromise=require(_0xa4c7('0x0'));var moment=require(_0xa4c7('0x1'));var _=require(_0xa4c7('0x2'));var util=require(_0xa4c7('0x3'));var jayson=require(_0xa4c7('0x4'));var client=jayson[_0xa4c7('0x5')][_0xa4c7('0x6')]({'port':0x2329});function request(_0x18761f,_0x4e4a11){return new BPromise(function(_0x35b6f5,_0x3c6825){return client[_0xa4c7('0x7')](_0x18761f,_0x4e4a11)['then'](function(_0x450e60){if(_0x450e60[_0xa4c7('0x8')]){return _0x3c6825(_0x450e60[_0xa4c7('0x8')][_0xa4c7('0x9')]);}else{return _0x35b6f5(_0x450e60[_0xa4c7('0xa')]);}})['catch'](function(_0x35db6e){return _0x3c6825(_0x35db6e);});});}exports[_0xa4c7('0xb')]=function(_0x20cc5d){return request(_0xa4c7('0xc'),{'options':{'raw':![],'where':{'name':_0x20cc5d},'attributes':[_0xa4c7('0xd')]}});};exports[_0xa4c7('0xe')]=function(_0x112fbc){return request(_0xa4c7('0xf'),{'options':{'raw':![],'where':{'id':_0x112fbc},'include':[{'model':_0xa4c7('0x10'),'as':'Smtp'}],'attributes':['id',_0xa4c7('0x11'),_0xa4c7('0x12')]}});};exports[_0xa4c7('0x13')]=function(_0x2fb9ed){return request(_0xa4c7('0xc'),{'options':{'where':{'id':_0x2fb9ed},'attributes':[_0xa4c7('0x11')]}});};exports[_0xa4c7('0x14')]=function(_0xc22791){return request(_0xa4c7('0x15'),{'options':{'where':{'id':_0xc22791},'attributes':[_0xa4c7('0x11')]}});};exports['getVariableById']=function(_0x51834f){return request(_0xa4c7('0x16'),{'options':{'where':{'id':_0x51834f},'attributes':[_0xa4c7('0x11')]}});};exports[_0xa4c7('0x17')]=function(_0x3523e8){return request(_0xa4c7('0x18'),{'options':{'where':{'id':_0x3523e8},'attributes':[_0xa4c7('0x19')]}});};exports[_0xa4c7('0x1a')]=function(_0x52ec3b){return request(_0xa4c7('0x1b'),{'options':{'where':{'id':_0x52ec3b},'attributes':[_0xa4c7('0x11')]}});};exports['getTrunkById']=function(_0x31c1c3){return request(_0xa4c7('0x1c'),{'options':{'where':{'id':_0x31c1c3},'attributes':[_0xa4c7('0x11')]}});};exports[_0xa4c7('0x1d')]=function(_0x1c4d4a){return request('ShowSound',{'options':{'where':{'id':_0x1c4d4a},'attributes':[_0xa4c7('0x1e')]}});};exports['getIntervalById']=function(_0x47608f){return request(_0xa4c7('0x1f'),{'options':{'raw':![],'where':{'id':_0x47608f},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xa4c7('0x20')]=function(_0x2c020c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2c020c},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x2a3ccb){return request(_0xa4c7('0x21'),{'body':_0x2a3ccb});};exports[_0xa4c7('0x22')]=function(_0x3e133b){return request(_0xa4c7('0x23'),{'body':_0x3e133b});};exports[_0xa4c7('0x24')]=function(_0x6386ca){return request(_0xa4c7('0x25'),{'body':_[_0xa4c7('0x26')](_0x6386ca,{'project_name':_0x6386ca[_0xa4c7('0x27')],'prev_project_name':_0x6386ca['arg_2']||'','is_subproject':_0x6386ca[_0xa4c7('0x28')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x29bd41){return request(_0xa4c7('0x29'),{'body':_0x29bd41});};exports[_0xa4c7('0x2a')]=function(_0x41c1d1){return request(_0xa4c7('0x2b'),{'body':_0x41c1d1});};exports[_0xa4c7('0x2c')]=function(_0x232362){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x232362['phone'],'ListId':_0x232362[_0xa4c7('0x2d')]}}})[_0xa4c7('0x2e')](function(_0x64468d){if(_0x64468d){return _0x64468d;}return request(_0xa4c7('0x2f'),{'body':_0x232362});});};exports[_0xa4c7('0x30')]=function(_0x56ad81){return request('ShowPause',{'options':{'where':{'id':_0x56ad81},'attributes':[_0xa4c7('0x11')]}});};exports[_0xa4c7('0x31')]=function(_0x782118,_0x4889f8){return request('LoginUser',{'body':{'interface':_0x4889f8},'options':{'where':_0x782118}});};exports['agentPause']=function(_0x343934,_0x5bc48f,_0x4572be){return request(_0xa4c7('0x32'),{'body':{'type':_0x5bc48f,'uniqueid':_0x4572be},'options':{'where':_0x343934}});};exports[_0xa4c7('0x33')]=function(_0x559add){return request('UnpauseUser',{'body':{},'options':{'where':_0x559add}});};exports[_0xa4c7('0x34')]=function(_0x1bf12a){return request(_0xa4c7('0x35'),{'body':{},'options':{'where':_0x1bf12a}});}; \ No newline at end of file +var _0x23b8=['getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','request','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0x23b8,0xb9));var _0x823b=function(_0x299eb8,_0x2a3c76){_0x299eb8=_0x299eb8-0x0;var _0x59ee49=_0x23b8[_0x299eb8];return _0x59ee49;};'use strict';var BPromise=require(_0x823b('0x0'));var moment=require(_0x823b('0x1'));var _=require(_0x823b('0x2'));var util=require(_0x823b('0x3'));var jayson=require(_0x823b('0x4'));var client=jayson[_0x823b('0x5')][_0x823b('0x6')]({'port':0x2329});function request(_0x12cf6a,_0x163b66){return new BPromise(function(_0x2ca20f,_0x3c6f7d){return client[_0x823b('0x7')](_0x12cf6a,_0x163b66)['then'](function(_0x591ecd){if(_0x591ecd[_0x823b('0x8')]){return _0x3c6f7d(_0x591ecd[_0x823b('0x8')][_0x823b('0x9')]);}else{return _0x2ca20f(_0x591ecd[_0x823b('0xa')]);}})['catch'](function(_0xe45e70){return _0x3c6f7d(_0xe45e70);});});}exports[_0x823b('0xb')]=function(_0x25d018){return request(_0x823b('0xc'),{'options':{'raw':![],'where':{'name':_0x25d018},'attributes':[_0x823b('0xd')]}});};exports[_0x823b('0xe')]=function(_0x21a414){return request(_0x823b('0xf'),{'options':{'raw':![],'where':{'id':_0x21a414},'include':[{'model':'MailServerOut','as':_0x823b('0x10')}],'attributes':['id',_0x823b('0x11'),'email']}});};exports['getSquareProjectById']=function(_0x5b513d){return request(_0x823b('0xc'),{'options':{'where':{'id':_0x5b513d},'attributes':[_0x823b('0x11')]}});};exports[_0x823b('0x12')]=function(_0x38c7b8){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x38c7b8},'attributes':['name']}});};exports['getVariableById']=function(_0x4fbea2){return request(_0x823b('0x13'),{'options':{'where':{'id':_0x4fbea2},'attributes':[_0x823b('0x11')]}});};exports[_0x823b('0x14')]=function(_0x2bfaca){return request(_0x823b('0x15'),{'options':{'where':{'id':_0x2bfaca},'attributes':[_0x823b('0x16')]}});};exports[_0x823b('0x17')]=function(_0x176b8b){return request('ShowUser',{'options':{'where':{'id':_0x176b8b},'attributes':[_0x823b('0x11')]}});};exports['getTrunkById']=function(_0x420d36){return request(_0x823b('0x18'),{'options':{'where':{'id':_0x420d36},'attributes':['name']}});};exports[_0x823b('0x19')]=function(_0x292adc){return request(_0x823b('0x1a'),{'options':{'where':{'id':_0x292adc},'attributes':['save_name']}});};exports[_0x823b('0x1b')]=function(_0x2ec078){return request(_0x823b('0x1c'),{'options':{'raw':![],'where':{'id':_0x2ec078},'include':[{'model':_0x823b('0x1d'),'as':_0x823b('0x1e')}]}});};exports[_0x823b('0x1f')]=function(_0x935cf2){return request(_0x823b('0x20'),{'options':{'where':{'id':_0x935cf2},'attributes':['id','name']}});};exports[_0x823b('0x21')]=function(_0x30fded){return request(_0x823b('0x22'),{'body':_0x30fded});};exports[_0x823b('0x23')]=function(_0x4da390){return request('CreateSquareDetailsReport',{'body':_0x4da390});};exports[_0x823b('0x24')]=function(_0x5e5dc3){return request(_0x823b('0x25'),{'body':_[_0x823b('0x26')](_0x5e5dc3,{'project_name':_0x5e5dc3[_0x823b('0x27')],'prev_project_name':_0x5e5dc3[_0x823b('0x28')]||'','is_subproject':_0x5e5dc3['arg_2']?!![]:![],'leaveAt':moment()[_0x823b('0x29')](_0x823b('0x2a'))})});};exports['createSquareRecording']=function(_0x4495df){return request(_0x823b('0x2b'),{'body':_0x4495df});};exports[_0x823b('0x2c')]=function(_0x1cda74){return request(_0x823b('0x2d'),{'body':_0x1cda74});};exports[_0x823b('0x2e')]=function(_0x14784d){return request(_0x823b('0x2f'),{'options':{'raw':![],'where':{'phone':_0x14784d[_0x823b('0x30')],'ListId':_0x14784d[_0x823b('0x31')]}}})['then'](function(_0x2717b7){if(_0x2717b7){return _0x2717b7;}return request(_0x823b('0x32'),{'body':_0x14784d});});};exports[_0x823b('0x33')]=function(_0x5c5c57){return request(_0x823b('0x34'),{'options':{'where':{'id':_0x5c5c57},'attributes':[_0x823b('0x11')]}});};exports[_0x823b('0x35')]=function(_0x165f25,_0x13d63d){return request(_0x823b('0x36'),{'body':{'interface':_0x13d63d},'options':{'where':_0x165f25}});};exports['agentPause']=function(_0x26a85a,_0x4b3643,_0x1fed33){return request(_0x823b('0x37'),{'body':{'type':_0x4b3643,'uniqueid':_0x1fed33},'options':{'where':_0x26a85a}});};exports[_0x823b('0x38')]=function(_0x46d61d){return request(_0x823b('0x39'),{'body':{},'options':{'where':_0x46d61d}});};exports[_0x823b('0x3a')]=function(_0x5b754b){return request('LogoutUser',{'body':{},'options':{'where':_0x5b754b}});}; \ 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 13a2d57..3d257cd 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 _0xe14d=['./lex','exports','./polly'];(function(_0x66d601,_0xa7a6cf){var _0x3b713d=function(_0x4c32cc){while(--_0x4c32cc){_0x66d601['push'](_0x66d601['shift']());}};_0x3b713d(++_0xa7a6cf);}(_0xe14d,0x1ee));var _0xde14=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe14d[_0x266618];return _0x54dbf5;};var polly=require(_0xde14('0x0'));var lex=require(_0xde14('0x1'));module[_0xde14('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xadb8=['exports'];(function(_0xeaba4b,_0x1eab4b){var _0x32f4fd=function(_0x43ec5b){while(--_0x43ec5b){_0xeaba4b['push'](_0xeaba4b['shift']());}};_0x32f4fd(++_0x1eab4b);}(_0xadb8,0x1d0));var _0x8adb=function(_0x11bf1b,_0x50581b){_0x11bf1b=_0x11bf1b-0x0;var _0x387d1c=_0xadb8[_0x11bf1b];return _0x387d1c;};var polly=require('./polly');var lex=require('./lex');module[_0x8adb('0x0')]={'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 b4a7c83..d271546 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 _0x89f7=['exports','./lib/api'];(function(_0x30b25a,_0x196714){var _0x14fafa=function(_0x4e6e1f){while(--_0x4e6e1f){_0x30b25a['push'](_0x30b25a['shift']());}};_0x14fafa(++_0x196714);}(_0x89f7,0x105));var _0x789f=function(_0x235f49,_0x2992b4){_0x235f49=_0x235f49-0x0;var _0x551139=_0x89f7[_0x235f49];return _0x551139;};'use strict';var lex=require(_0x789f('0x0'));module[_0x789f('0x1')]=function(_0x29c2db,_0x4b81a3,_0x2e09ac,_0x564d48,_0x1c55ac,_0x48fa02){return lex(_0x29c2db,_0x4b81a3,_0x2e09ac,_0x564d48,_0x1c55ac,_0x48fa02);}; \ No newline at end of file +var _0xa1fd=['exports','./lib/api'];(function(_0x41ec92,_0x5301a8){var _0x332644=function(_0x111eaf){while(--_0x111eaf){_0x41ec92['push'](_0x41ec92['shift']());}};_0x332644(++_0x5301a8);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x18ac3f,_0x386630){_0x18ac3f=_0x18ac3f-0x0;var _0x4c6563=_0xa1fd[_0x18ac3f];return _0x4c6563;};'use strict';var lex=require(_0xda1f('0x0'));module[_0xda1f('0x1')]=function(_0x37530d,_0x3feff6,_0x595195,_0x221036,_0xafa72c,_0x2ce9f4){return lex(_0x37530d,_0x3feff6,_0x595195,_0x221036,_0xafa72c,_0x2ce9f4);}; \ 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 ac743d9..d7d14fe 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 _0x0cab=['slots','hasOwnProperty','slot_','exports','$LATEST','bluebird','aws-sdk','postText'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x0cab,0x1cd));var _0xb0ca=function(_0x40a01b,_0x52459c){_0x40a01b=_0x40a01b-0x0;var _0x15d41d=_0x0cab[_0x40a01b];return _0x15d41d;};'use strict';var BPromise=require(_0xb0ca('0x0'));var AWS=require(_0xb0ca('0x1'));function lexResult(_0x8bbebc,_0x51713b){return new BPromise(function(_0x15ce78,_0x2cfa01){_0x8bbebc[_0xb0ca('0x2')](_0x51713b,function(_0x5bd733,_0x3095a4){if(_0x5bd733){_0x2cfa01(_0x5bd733);}if(_0x3095a4['slots']){for(const _0x17bd8f in _0x3095a4[_0xb0ca('0x3')]){if(_0x3095a4[_0xb0ca('0x3')][_0xb0ca('0x4')](_0x17bd8f)){var _0x781f=_0x3095a4[_0xb0ca('0x3')][_0x17bd8f];_0x3095a4[_0xb0ca('0x5')+_0x17bd8f]=_0x781f;}}}_0x15ce78(_0x3095a4);});});}module[_0xb0ca('0x6')]=function(_0x3837e3,_0x33f3ab,_0x4607d6,_0x50db71,_0x2c4480,_0x11461c){var _0xcd7d31=new AWS['LexRuntime']({'accessKeyId':_0x33f3ab,'secretAccessKey':_0x4607d6,'region':_0x50db71});var _0x464b67={'botAlias':_0xb0ca('0x7'),'botName':_0x11461c,'inputText':_0x2c4480,'userId':_0x3837e3};return lexResult(_0xcd7d31,_0x464b67);}; \ No newline at end of file +var _0x6d13=['LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','exports'];(function(_0x3fc1e4,_0x171853){var _0x3b3f14=function(_0x27ab64){while(--_0x27ab64){_0x3fc1e4['push'](_0x3fc1e4['shift']());}};_0x3b3f14(++_0x171853);}(_0x6d13,0x1a9));var _0x36d1=function(_0x24f9d9,_0x6b4d81){_0x24f9d9=_0x24f9d9-0x0;var _0x392b6c=_0x6d13[_0x24f9d9];return _0x392b6c;};'use strict';var BPromise=require(_0x36d1('0x0'));var AWS=require(_0x36d1('0x1'));function lexResult(_0x2d6bd7,_0x2ef829){return new BPromise(function(_0x41a4e8,_0x43629a){_0x2d6bd7[_0x36d1('0x2')](_0x2ef829,function(_0x5eed46,_0x342a94){if(_0x5eed46){_0x43629a(_0x5eed46);}if(_0x342a94[_0x36d1('0x3')]){for(const _0x1e03ac in _0x342a94['slots']){if(_0x342a94[_0x36d1('0x3')][_0x36d1('0x4')](_0x1e03ac)){var _0x3ddb26=_0x342a94['slots'][_0x1e03ac];_0x342a94[_0x36d1('0x5')+_0x1e03ac]=_0x3ddb26;}}}_0x41a4e8(_0x342a94);});});}module[_0x36d1('0x6')]=function(_0x5a8662,_0xaf6563,_0x5ab3f3,_0x315ec1,_0x56698c,_0xc78ef){var _0x23aad4=new AWS[(_0x36d1('0x7'))]({'accessKeyId':_0xaf6563,'secretAccessKey':_0x5ab3f3,'region':_0x315ec1});var _0x3cf3b9={'botAlias':_0x36d1('0x8'),'botName':_0xc78ef,'inputText':_0x56698c,'userId':_0x5a8662};return lexResult(_0x23aad4,_0x3cf3b9);}; \ 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 14d23cf..df9eaea 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 _0x0e67=['exports','./lib/api'];(function(_0xaedd1f,_0x2fe932){var _0x51c048=function(_0x3841a6){while(--_0x3841a6){_0xaedd1f['push'](_0xaedd1f['shift']());}};_0x51c048(++_0x2fe932);}(_0x0e67,0x125));var _0x70e6=function(_0x7780f8,_0x58b171){_0x7780f8=_0x7780f8-0x0;var _0x52e13b=_0x0e67[_0x7780f8];return _0x52e13b;};'use strict';var polly=require(_0x70e6('0x0'));module[_0x70e6('0x1')]=function(_0x370d8d,_0x5b5236,_0x2b7ec1,_0x57db04,_0x25716a,_0x4f2f52,_0x942e7f){return polly(_0x370d8d,_0x5b5236,_0x2b7ec1,_0x57db04,_0x25716a,_0x4f2f52,_0x942e7f);}; \ No newline at end of file +var _0xcea7=['exports','./lib/api'];(function(_0x34fbe7,_0x22e07a){var _0x24b3d9=function(_0x32b6f1){while(--_0x32b6f1){_0x34fbe7['push'](_0x34fbe7['shift']());}};_0x24b3d9(++_0x22e07a);}(_0xcea7,0xd1));var _0x7cea=function(_0x4eac40,_0x51c8b3){_0x4eac40=_0x4eac40-0x0;var _0x2d468e=_0xcea7[_0x4eac40];return _0x2d468e;};'use strict';var polly=require(_0x7cea('0x0'));module[_0x7cea('0x1')]=function(_0x4682f7,_0x543972,_0x4286e6,_0x449ff5,_0x1b8edc,_0x25f1b7,_0x5d94cf){return polly(_0x4682f7,_0x543972,_0x4286e6,_0x449ff5,_0x1b8edc,_0x25f1b7,_0x5d94cf);}; \ 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 cbc0b0a..fa3f644 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 _0xe550=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','aws-sdk','writeFile'];(function(_0x29059e,_0x462378){var _0x307197=function(_0x2f8ca8){while(--_0x2f8ca8){_0x29059e['push'](_0x29059e['shift']());}};_0x307197(++_0x462378);}(_0xe550,0xc2));var _0x0e55=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe550[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x0e55('0x0'));var BPromise=require(_0x0e55('0x1'));var rs=require('randomstring');var AWS=require(_0x0e55('0x2'));function pollyResult(_0x18664f,_0x41c8c9,_0x2198f9){return new BPromise(function(_0x545988,_0x1c964e){_0x18664f['synthesizeSpeech'](_0x41c8c9,function(_0x14cb68,_0x578c5b){if(_0x14cb68){_0x1c964e(_0x14cb68);}else if(_0x578c5b){if(_0x578c5b['AudioStream']instanceof Buffer){fs[_0x0e55('0x3')](_0x2198f9,_0x578c5b[_0x0e55('0x4')],function(_0x2a042e){if(_0x2a042e){_0x1c964e(_0x2a042e);}else{_0x545988();}});}else{_0x1c964e(new Error(_0x0e55('0x5')));}}else{_0x1c964e(new Error(_0x0e55('0x6')));}});});}module[_0x0e55('0x7')]=function(_0x434ce8,_0x1c82c9,_0x3e5502,_0x88eee4,_0x4fd1b2,_0x52a3e3,_0x58b00e){var _0x5452b1=new AWS[(_0x0e55('0x8'))]({'accessKeyId':_0x434ce8,'secretAccessKey':_0x1c82c9,'region':_0x3e5502});var _0x9b513a={'Text':_0x4fd1b2,'TextType':_0x52a3e3||_0x0e55('0x9'),'OutputFormat':_0x0e55('0xa'),'VoiceId':_0x88eee4};return pollyResult(_0x5452b1,_0x9b513a,_0x58b00e);}; \ No newline at end of file +var _0xffe9=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1e696c,_0xe6472d){var _0x2bd0e0=function(_0x3aa9c6){while(--_0x3aa9c6){_0x1e696c['push'](_0x1e696c['shift']());}};_0x2bd0e0(++_0xe6472d);}(_0xffe9,0x88));var _0x9ffe=function(_0x45aa72,_0x8af642){_0x45aa72=_0x45aa72-0x0;var _0x75adaa=_0xffe9[_0x45aa72];return _0x75adaa;};'use strict';var fs=require('fs');var path=require(_0x9ffe('0x0'));var BPromise=require(_0x9ffe('0x1'));var rs=require(_0x9ffe('0x2'));var AWS=require(_0x9ffe('0x3'));function pollyResult(_0x383bb4,_0x4f7e22,_0x25474e){return new BPromise(function(_0x75f0f2,_0x2144d2){_0x383bb4[_0x9ffe('0x4')](_0x4f7e22,function(_0x610b51,_0x176e46){if(_0x610b51){_0x2144d2(_0x610b51);}else if(_0x176e46){if(_0x176e46[_0x9ffe('0x5')]instanceof Buffer){fs[_0x9ffe('0x6')](_0x25474e,_0x176e46[_0x9ffe('0x5')],function(_0x169aeb){if(_0x169aeb){_0x2144d2(_0x169aeb);}else{_0x75f0f2();}});}else{_0x2144d2(new Error(_0x9ffe('0x7')));}}else{_0x2144d2(new Error(_0x9ffe('0x8')));}});});}module['exports']=function(_0x34b6f0,_0x22bc87,_0x220eba,_0x154cae,_0xf17695,_0xf9474b,_0x57af54){var _0xef0497=new AWS[(_0x9ffe('0x9'))]({'accessKeyId':_0x34b6f0,'secretAccessKey':_0x22bc87,'region':_0x220eba});var _0x531e55={'Text':_0xf17695,'TextType':_0xf9474b||_0x9ffe('0xa'),'OutputFormat':_0x9ffe('0xb'),'VoiceId':_0x154cae};return pollyResult(_0xef0497,_0x531e55,_0x57af54);}; \ 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 6093a49..9ea4d88 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 _0x995f=['exports'];(function(_0x460ab2,_0x5d39ed){var _0x32d5e5=function(_0x16883e){while(--_0x16883e){_0x460ab2['push'](_0x460ab2['shift']());}};_0x32d5e5(++_0x5d39ed);}(_0x995f,0xed));var _0xf995=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0x995f[_0x2cc711];return _0x31a52e;};'use strict';var asr=require('./lib/api');module[_0xf995('0x0')]=function(_0x15d670,_0x149361,_0x2bbc2b,_0x5dc6b1){return asr(_0x15d670,_0x149361,_0x2bbc2b);}; \ No newline at end of file +var _0x8c35=['exports','./lib/api'];(function(_0xa92024,_0x1f2046){var _0x53d38a=function(_0x1c4d29){while(--_0x1c4d29){_0xa92024['push'](_0xa92024['shift']());}};_0x53d38a(++_0x1f2046);}(_0x8c35,0xbf));var _0x58c3=function(_0x24190b,_0xc9d7bc){_0x24190b=_0x24190b-0x0;var _0x3ffb24=_0x8c35[_0x24190b];return _0x3ffb24;};'use strict';var asr=require(_0x58c3('0x0'));module[_0x58c3('0x1')]=function(_0x1eb80e,_0x12bcd5,_0x2b3b5b,_0x31564f){return asr(_0x1eb80e,_0x12bcd5,_0x2b3b5b);}; \ 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 443e963..510cad3 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 _0x82a8=['readFileSync','toString','base64','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x4f3d00,_0x188abc){var _0x484889=function(_0x13eb9c){while(--_0x13eb9c){_0x4f3d00['push'](_0x4f3d00['shift']());}};_0x484889(++_0x188abc);}(_0x82a8,0x1f1));var _0x882a=function(_0x430796,_0x4b91e7){_0x430796=_0x430796-0x0;var _0x1b9547=_0x82a8[_0x430796];return _0x1b9547;};'use strict';var url=require(_0x882a('0x0'));var BPromise=require(_0x882a('0x1'));var fs=require('fs');var host=_0x882a('0x2');module[_0x882a('0x3')]=function(_0x4369d2,_0x5b1235,_0x2a8f5b){return new BPromise(function(_0x322053,_0x51c010){var _0x2f47cc;if(typeof _0x4369d2!==_0x882a('0x4')||_0x4369d2[_0x882a('0x5')]===0x0){return _0x51c010(_0x882a('0x6'));}if(typeof _0x5b1235!==_0x882a('0x4')||_0x5b1235['length']===0x0){return _0x51c010('key\x20should\x20be\x20a\x20string');}if(typeof _0x2a8f5b!=='undefined'&&(typeof _0x2a8f5b!==_0x882a('0x4')||_0x2a8f5b[_0x882a('0x5')]===0x0)){return _0x51c010('lang\x20should\x20be\x20a\x20string');}try{_0x2f47cc=fs[_0x882a('0x7')](_0x4369d2)[_0x882a('0x8')](_0x882a('0x9'));}catch(_0x22b308){return _0x51c010(_0x22b308);}return _0x322053({'method':'POST','uri':host+_0x882a('0xa')+_0x5b1235,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x882a('0xb'),'languageCode':_0x2a8f5b},'audio':{'content':_0x2f47cc}},'json':!![]});});}; \ No newline at end of file +var _0x5916=['https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','bluebird'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5916,0x187));var _0x6591=function(_0x523a52,_0x56799d){_0x523a52=_0x523a52-0x0;var _0x1580af=_0x5916[_0x523a52];return _0x1580af;};'use strict';var url=require('url');var BPromise=require(_0x6591('0x0'));var fs=require('fs');var host=_0x6591('0x1');module[_0x6591('0x2')]=function(_0x515f81,_0x59bd66,_0x4bb5ce){return new BPromise(function(_0x5d790f,_0x215529){var _0x160a55;if(typeof _0x515f81!==_0x6591('0x3')||_0x515f81[_0x6591('0x4')]===0x0){return _0x215529(_0x6591('0x5'));}if(typeof _0x59bd66!==_0x6591('0x3')||_0x59bd66[_0x6591('0x4')]===0x0){return _0x215529('key\x20should\x20be\x20a\x20string');}if(typeof _0x4bb5ce!==_0x6591('0x6')&&(typeof _0x4bb5ce!=='string'||_0x4bb5ce['length']===0x0)){return _0x215529(_0x6591('0x7'));}try{_0x160a55=fs[_0x6591('0x8')](_0x515f81)[_0x6591('0x9')](_0x6591('0xa'));}catch(_0x194467){return _0x215529(_0x194467);}return _0x5d790f({'method':_0x6591('0xb'),'uri':host+_0x6591('0xc')+_0x59bd66,'body':{'config':{'encoding':_0x6591('0xd'),'sampleRateHertz':'8000','languageCode':_0x4bb5ce},'audio':{'content':_0x160a55}},'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 ddc2223..56d38bd 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 _0x5217=['./asr'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x5217,0xbb));var _0x7521=function(_0x306c31,_0x1fa617){_0x306c31=_0x306c31-0x0;var _0x4be0bc=_0x5217[_0x306c31];return _0x4be0bc;};var asr=require(_0x7521('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xd763=['./asr'];(function(_0x2383bc,_0x2d5ec9){var _0x283573=function(_0x157171){while(--_0x157171){_0x2383bc['push'](_0x2383bc['shift']());}};_0x283573(++_0x2d5ec9);}(_0xd763,0xda));var _0x3d76=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xd763[_0xa148b7];return _0x51efd3;};var asr=require(_0x3d76('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 75953e6..50de86a 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 _0x9421=['readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','.mp3','from','audioContent','.wav','googleCloudTTS\x20path','googleTTS','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','googleDialogflow','textRequest','stringify','result','source','action','actionIncomplete','speech','score','endConversation','metadata','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','https','url','bluebird','randomstring','sox','util','querystring','google-tts-api','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','path','get','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','pipe','error','protocol','WHAT_EVER','data','end','transcode','wav','info','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split'];(function(_0x5a0185,_0x5801cb){var _0x434f6c=function(_0x34b36c){while(--_0x34b36c){_0x5a0185['push'](_0x5a0185['shift']());}};_0x434f6c(++_0x5801cb);}(_0x9421,0x17f));var _0x1942=function(_0xad410c,_0x235e93){_0xad410c=_0xad410c-0x0;var _0x4dbd9d=_0x9421[_0xad410c];return _0x4dbd9d;};'use strict';var fs=require('fs');var path=require('path');var http=require('http');var https=require(_0x1942('0x0'));var urlParse=require(_0x1942('0x1'))['parse'];var BPromise=require(_0x1942('0x2'));var rs=require(_0x1942('0x3'));var sox=require(_0x1942('0x4'));var rp=require('request-promise');var util=require(_0x1942('0x5'));var querystring=require(_0x1942('0x6'));var tts=require(_0x1942('0x7'));var apiai=require('apiai-promise');var md5=require(_0x1942('0x8'));var google=require(_0x1942('0x9'));var aws=require(_0x1942('0xa'));var tilde=require(_0x1942('0xb'));var sestek=require(_0x1942('0xc'));var logger=require(_0x1942('0xd'))(_0x1942('0xe'));var ISPEECH_API=_0x1942('0xf');function downloadFile(_0x2a958d,_0x45f847){return new BPromise(function(_0x118614,_0x5a5037){var _0x31c903=urlParse(_0x2a958d);var _0x109465=_0x31c903['protocol']===_0x1942('0x10')?https:http;var _0x4da3ab={'host':_0x31c903[_0x1942('0x11')],'path':_0x31c903[_0x1942('0x12')],'headers':{'user-agent':'WHAT_EVER'}};_0x109465[_0x1942('0x13')](_0x4da3ab,function(_0x590c78){if(_0x590c78[_0x1942('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x2a958d+_0x1942('0x15')+_0x590c78[_0x1942('0x14')]+'\x20('+_0x590c78[_0x1942('0x16')]+')');_0x5a5037(new Error(_0x1942('0x17')+_0x2a958d+'\x20failed,\x20status\x20code\x20=\x20'+_0x590c78[_0x1942('0x14')]+'\x20('+_0x590c78[_0x1942('0x16')]+')'));return;}var _0x4c6887=fs[_0x1942('0x18')](_0x45f847);_0x4c6887['on'](_0x1942('0x19'),function(){logger['info'](_0x1942('0x1a'));_0x4c6887[_0x1942('0x1b')](_0x118614);});_0x4c6887['on']('error',function(_0x5ae0a7){fs[_0x1942('0x1c')](_0x45f847);logger['error']('download\x20error',_0x5ae0a7);_0x5a5037(_0x5ae0a7);});_0x590c78[_0x1942('0x1d')](_0x4c6887);})['on'](_0x1942('0x1e'),function(_0x2ef91e){logger['error'](_0x2ef91e);_0x5a5037(_0x2ef91e);})['end']();});}function uploadFile(_0x5200fb){return new BPromise(function(_0x352b7c,_0x44184e){var _0xc15827=urlParse(_0x5200fb);var _0x55e437=_0xc15827[_0x1942('0x1f')]===_0x1942('0x10')?https:http;var _0x5570f7={'host':_0xc15827[_0x1942('0x11')],'path':_0xc15827['path'],'headers':{'user-agent':_0x1942('0x20')}};_0x55e437[_0x1942('0x13')](_0x5570f7,function(_0x59663f){if(_0x59663f[_0x1942('0x14')]!==0xc8){_0x44184e(new Error(_0x1942('0x17')+_0x5200fb+_0x1942('0x15')+_0x59663f[_0x1942('0x14')]+'\x20('+_0x59663f['statusMessage']+')'));return;}var _0x258552='';_0x59663f['on'](_0x1942('0x21'),function(_0x4b52f8){_0x258552+=_0x4b52f8;});_0x59663f['on'](_0x1942('0x22'),function(){_0x352b7c(_0x258552);});})['on'](_0x1942('0x1e'),function(_0x4bf081){_0x44184e(_0x4bf081);})[_0x1942('0x22')]();});}function convertFile(_0x471c3b,_0x5091a4){return new BPromise(function(_0x5535cf,_0x2feb0f){var _0x5c0651=sox[_0x1942('0x23')](_0x471c3b,_0x5091a4,{'sampleRate':0x1f40,'format':_0x1942('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5c0651['on'](_0x1942('0x1e'),function(_0x3d2358){logger[_0x1942('0x1e')]('error\x20convert',_0x3d2358);_0x2feb0f(_0x3d2358);});_0x5c0651['on'](_0x1942('0x22'),function(){logger[_0x1942('0x25')](_0x1942('0x26'));_0x5535cf();});_0x5c0651[_0x1942('0x27')]();});}function base64Decode(_0x3a2b18,_0x120a77){var _0x137694=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs[_0x1942('0x2a')](0x4)+'.wav');fs[_0x1942('0x2b')](_0x137694,_0x3a2b18,_0x1942('0x2c'));return convertFile(_0x137694,_0x120a77)[_0x1942('0x2d')](function(){try{fs[_0x1942('0x1c')](_0x137694);fs[_0x1942('0x2e')](_0x120a77,_0x1942('0x2f'));}catch(_0xd7b4c1){logger[_0x1942('0x1e')](_0xd7b4c1);}return _0x120a77[_0x1942('0x30')]('.')[0x0];});}function base64Encode(_0x169e84){var _0x52d4b6=fs[_0x1942('0x31')](_0x169e84);return new Buffer(_0x52d4b6)[_0x1942('0x32')](_0x1942('0x2c'));}exports[_0x1942('0x33')]=function(_0x536c4d,_0x2c7541,_0x428da1,_0x5e24f6,_0x352585,_0x4ee8e4){var _0x1e05e0,_0x464655;var _0x11b9a4=_0x1942('0x34');var _0x1dc6aa='?key='+_0x536c4d;var _0x3d382c={};if(_0x2c7541===_0x1942('0x35')){_0x3d382c[_0x1942('0x36')]={'ssml':_0x428da1};}else{_0x3d382c[_0x1942('0x36')]={'text':_0x428da1};};_0x3d382c['voice']={'languageCode':_0x5e24f6,'ssmlGender':_0x352585};_0x3d382c[_0x1942('0x37')]={'audioEncoding':_0x1942('0x38'),'sampleRateHertz':0x1f40};var _0x564ef8={'url':_0x11b9a4+_0x1942('0x39')+_0x1dc6aa,'method':'POST','json':!![],'body':_0x3d382c};return rp(_0x564ef8)[_0x1942('0x2d')](function(_0xea791d){return new BPromise(function(_0x3262cc,_0x5c8be8){_0x1e05e0=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs[_0x1942('0x2a')](0x4)+_0x1942('0x3a'));var _0x4177e3=Buffer[_0x1942('0x3b')](_0xea791d[_0x1942('0x3c')],_0x1942('0x2c'));return fs['writeFile'](_0x1e05e0,_0x4177e3,function(_0x2cd159){_0x5c8be8(_0x2cd159);},function(_0x486d3d){fs[_0x1942('0x2e')](_0x1e05e0,'777');_0x3262cc(_0x486d3d);});});})['then'](function(_0x1a98ae){_0x464655=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs['generate'](0x4)+_0x1942('0x3d'));return convertFile(_0x1e05e0,_0x464655);})['then'](function(){try{fs['unlink'](_0x1e05e0);fs['chmodSync'](_0x464655,_0x1942('0x2f'));}catch(_0x5c0e25){logger[_0x1942('0x1e')](_0x5c0e25);}logger[_0x1942('0x25')](_0x1942('0x3e'),_0x464655[_0x1942('0x30')]('.')[0x0]);return _0x464655[_0x1942('0x30')]('.')[0x0];});};exports[_0x1942('0x3f')]=function(_0x48de66,_0x3dc46b){var _0x3afe7c,_0x263963;return tts(_0x48de66,_0x3dc46b||'en',0x1)[_0x1942('0x2d')](function(_0x66cd0b){logger[_0x1942('0x25')](_0x66cd0b);_0x3afe7c=path[_0x1942('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x1942('0x3a'));return downloadFile(_0x66cd0b,_0x3afe7c);})[_0x1942('0x2d')](function(){_0x263963=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs[_0x1942('0x2a')](0x4)+_0x1942('0x3d'));return convertFile(_0x3afe7c,_0x263963);})[_0x1942('0x2d')](function(){try{fs[_0x1942('0x1c')](_0x3afe7c);fs[_0x1942('0x2e')](_0x263963,_0x1942('0x2f'));}catch(_0x4550fb){logger[_0x1942('0x1e')](_0x4550fb);}logger[_0x1942('0x25')]('goggleTTS\x20path',_0x263963['split']('.')[0x0]);return _0x263963['split']('.')[0x0];});};exports[_0x1942('0x40')]=function(_0x97854,_0x3799e0,_0x573fec){return google[_0x1942('0x41')](_0x97854,_0x3799e0,_0x573fec)[_0x1942('0x2d')](function(_0x239675){logger[_0x1942('0x25')](_0x239675['uri']);return rp(_0x239675);})[_0x1942('0x2d')](function(_0x2f7cb9){var _0x16e0c0='';var _0x15ad4a=0x0;try{fs[_0x1942('0x1c')](_0x97854);}catch(_0x30e284){logger['error'](_0x30e284);}if(_0x2f7cb9&&_0x2f7cb9[_0x1942('0x42')]){_0x16e0c0=_0x2f7cb9[_0x1942('0x42')][_0x1942('0x43')](function(_0x3c27f4){return _0x3c27f4&&_0x3c27f4[_0x1942('0x44')][0x0]&&_0x3c27f4[_0x1942('0x44')][0x0][_0x1942('0x45')]?_0x3c27f4[_0x1942('0x44')][0x0]['transcript']:'';})[_0x1942('0x46')]('\x0a');_0x15ad4a=_0x2f7cb9['results'][_0x1942('0x43')](function(_0x3ea411){return _0x3ea411&&_0x3ea411[_0x1942('0x44')][0x0]&&_0x3ea411[_0x1942('0x44')][0x0][_0x1942('0x47')]?_0x3ea411[_0x1942('0x44')][0x0][_0x1942('0x47')]:0x0;})[_0x1942('0x46')]('\x0a');}logger[_0x1942('0x25')](_0x1942('0x48'),_0x16e0c0);logger[_0x1942('0x25')]('googleASR\x20confidence',_0x15ad4a);return{'transcript':_0x16e0c0,'confidence':_0x15ad4a};})['catch'](function(_0x17a9e1){logger[_0x1942('0x1e')](_0x1942('0x49'),_0x17a9e1['statusCode'],_0x17a9e1[_0x1942('0x4a')],_0x17a9e1['message']);});};exports[_0x1942('0x4b')]=function(_0x16d5da,_0x47f730,_0x2b0588,_0x51a6ae){var _0x474ac7=apiai(_0x47f730,{'language':_0x51a6ae||'en'});return _0x474ac7[_0x1942('0x4c')](_0x2b0588,{'sessionId':md5(_0x16d5da)})[_0x1942('0x2d')](function(_0x516a9b){logger['info'](JSON[_0x1942('0x4d')](_0x516a9b));return{'source':_0x516a9b[_0x1942('0x4e')][_0x1942('0x4f')],'resolvedQuery':_0x516a9b[_0x1942('0x4e')]['resolvedQuery'],'action':_0x516a9b['result'][_0x1942('0x50')],'actionIncomplete':_0x516a9b[_0x1942('0x4e')][_0x1942('0x51')],'speech':_0x516a9b['result']['fulfillment'][_0x1942('0x52')],'score':_0x516a9b[_0x1942('0x4e')][_0x1942('0x53')],'statusCode':_0x516a9b['status']['code'],'endConversation':_0x516a9b[_0x1942('0x4e')]['metadata'][_0x1942('0x54')]||![],'isFallbackIntent':_0x516a9b[_0x1942('0x4e')][_0x1942('0x55')][_0x1942('0x56')]};});};exports['tildeASR']=function(_0x338151,_0x2d0e52,_0x5b9e75,_0x4bf45a){return tilde[_0x1942('0x41')](_0x338151,_0x2d0e52,_0x5b9e75,_0x4bf45a)[_0x1942('0x2d')](function(_0x5b8426){try{fs['unlink'](_0x338151);}catch(_0x32ede3){logger['error'](_0x32ede3);}logger[_0x1942('0x25')](_0x1942('0x57'),_0x5b8426[_0x1942('0x45')]);logger[_0x1942('0x25')](_0x1942('0x58'),_0x5b8426[_0x1942('0x47')]);return _0x5b8426;});};exports[_0x1942('0x59')]=function(_0x721e5,_0x330849,_0x59ced5,_0x36addf,_0x3b07f7,_0x46bdb9){var _0x59d81f=path[_0x1942('0x28')](__dirname,'tmp',rs[_0x1942('0x2a')](0x4)+_0x1942('0x3a'));var _0x478cf4;return aws[_0x1942('0x5a')](_0x721e5,_0x330849,_0x59ced5,_0x36addf,_0x3b07f7,_0x46bdb9,_0x59d81f)['then'](function(){_0x478cf4=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs[_0x1942('0x2a')](0x4)+_0x1942('0x3d'));return convertFile(_0x59d81f,_0x478cf4);})[_0x1942('0x2d')](function(){try{fs[_0x1942('0x1c')](_0x59d81f);fs['chmodSync'](_0x478cf4,_0x1942('0x2f'));}catch(_0x57b268){logger['error'](_0x57b268);}return _0x478cf4['split']('.')[0x0];});};exports[_0x1942('0x5b')]=function(_0x316466,_0x7d4097,_0x1343db,_0x48b412,_0x40664f,_0x3e3933){return aws[_0x1942('0x5c')](_0x316466,_0x7d4097,_0x1343db,_0x48b412,_0x40664f,_0x3e3933)[_0x1942('0x2d')](function(_0x5cc6db){logger[_0x1942('0x25')](JSON['stringify'](_0x5cc6db));return _0x5cc6db;});};exports[_0x1942('0x5d')]=function(_0x29b669,_0x4e25ea,_0x402c2f,_0x24a7fa){var _0x2aadf4=util['format'](_0x1942('0x5e'),ISPEECH_API,_0x29b669,encodeURIComponent(_0x4e25ea),_0x402c2f,_0x24a7fa);var _0x4f2346=path[_0x1942('0x28')](__dirname,'tmp',rs[_0x1942('0x2a')](0x4)+_0x1942('0x3a'));var _0x1cbc2e;return downloadFile(_0x2aadf4,_0x4f2346)['then'](function(){_0x1cbc2e=path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs[_0x1942('0x2a')](0x4)+_0x1942('0x3d'));return convertFile(_0x4f2346,_0x1cbc2e);})['then'](function(){try{fs[_0x1942('0x1c')](_0x4f2346);fs['chmodSync'](_0x1cbc2e,_0x1942('0x2f'));}catch(_0x17b098){logger[_0x1942('0x1e')](_0x17b098);}return _0x1cbc2e[_0x1942('0x30')]('.')[0x0];});};exports[_0x1942('0x5f')]=function(_0x1d9b2e,_0x229da8,_0x3e352f,_0x541241){var _0x53c542=util[_0x1942('0x60')](_0x1942('0x61'),ISPEECH_API,_0x229da8,_0x3e352f,base64Encode(_0x1d9b2e),_0x541241?util[_0x1942('0x60')]('model=%s',encodeURIComponent(_0x541241)):_0x1942('0x62'));return uploadFile(_0x53c542)['then'](function(_0x409662){return querystring[_0x1942('0x63')](_0x409662);});};exports['sestekNDA']=function(_0x186c3b,_0x5a877b){return sestek[_0x1942('0x64')](_0x186c3b,_0x5a877b)[_0x1942('0x2d')](function(_0x12b9c5){logger[_0x1942('0x25')](JSON[_0x1942('0x4d')](_0x12b9c5));var _0x54cf9a={'speech':_0x12b9c5[_0x1942('0x65')],'action':_0x12b9c5[_0x1942('0x66')]?_0x12b9c5[_0x1942('0x66')]['CustomAction']:undefined,'actiondata':_0x12b9c5[_0x1942('0x66')]?_0x12b9c5['channelData'][_0x1942('0x67')]:undefined};if(_0x12b9c5['channelData']&&_0x12b9c5[_0x1942('0x66')][_0x1942('0x68')]){return base64Decode(_0x12b9c5[_0x1942('0x66')]['AudioFromTts'][_0x1942('0x69')],path[_0x1942('0x28')](__dirname,_0x1942('0x29'),rs['generate'](0x4)+_0x1942('0x3d')))['then'](function(_0x4856c2){_0x54cf9a[_0x1942('0x6a')]=_0x4856c2;return _0x54cf9a;});}return _0x54cf9a;});};exports[_0x1942('0x6b')]=function(){return __dirname;}; \ No newline at end of file +var _0x80b9=['[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','model=%s','sestekNDA','nda','text','channelData','AudioFromTts','Data','dirName','path','http','https','url','bluebird','randomstring','sox','request-promise','querystring','google-tts-api','apiai-promise','md5','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','pipe','end','protocol','host','data','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','MP3','text:synthesize','POST','.mp3','from','writeFile','777','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x80b9,0x8e));var _0x980b=function(_0x1e52bc,_0x31976c){_0x1e52bc=_0x1e52bc-0x0;var _0x5a6043=_0x80b9[_0x1e52bc];return _0x5a6043;};'use strict';var fs=require('fs');var path=require(_0x980b('0x0'));var http=require(_0x980b('0x1'));var https=require(_0x980b('0x2'));var urlParse=require(_0x980b('0x3'))['parse'];var BPromise=require(_0x980b('0x4'));var rs=require(_0x980b('0x5'));var sox=require(_0x980b('0x6'));var rp=require(_0x980b('0x7'));var util=require('util');var querystring=require(_0x980b('0x8'));var tts=require(_0x980b('0x9'));var apiai=require(_0x980b('0xa'));var md5=require(_0x980b('0xb'));var google=require('./google');var aws=require('./aws');var tilde=require(_0x980b('0xc'));var sestek=require(_0x980b('0xd'));var logger=require(_0x980b('0xe'))(_0x980b('0xf'));var ISPEECH_API=_0x980b('0x10');function downloadFile(_0x10cef6,_0x5a8420){return new BPromise(function(_0x47ed83,_0x1070e6){var _0xdc01b3=urlParse(_0x10cef6);var _0x1057d0=_0xdc01b3['protocol']===_0x980b('0x11')?https:http;var _0x172e64={'host':_0xdc01b3['host'],'path':_0xdc01b3['path'],'headers':{'user-agent':_0x980b('0x12')}};_0x1057d0[_0x980b('0x13')](_0x172e64,function(_0x4c0d6c){if(_0x4c0d6c[_0x980b('0x14')]!==0xc8){logger[_0x980b('0x15')](_0x980b('0x16')+_0x10cef6+'\x20failed,\x20status\x20code\x20=\x20'+_0x4c0d6c[_0x980b('0x14')]+'\x20('+_0x4c0d6c[_0x980b('0x17')]+')');_0x1070e6(new Error('request\x20to\x20'+_0x10cef6+_0x980b('0x18')+_0x4c0d6c[_0x980b('0x14')]+'\x20('+_0x4c0d6c[_0x980b('0x17')]+')'));return;}var _0x5e5da3=fs[_0x980b('0x19')](_0x5a8420);_0x5e5da3['on']('finish',function(){logger[_0x980b('0x1a')](_0x980b('0x1b'));_0x5e5da3['close'](_0x47ed83);});_0x5e5da3['on']('error',function(_0x45c4f8){fs['unlink'](_0x5a8420);logger['error']('download\x20error',_0x45c4f8);_0x1070e6(_0x45c4f8);});_0x4c0d6c[_0x980b('0x1c')](_0x5e5da3);})['on']('error',function(_0x1385eb){logger['error'](_0x1385eb);_0x1070e6(_0x1385eb);})[_0x980b('0x1d')]();});}function uploadFile(_0x2c94f0){return new BPromise(function(_0xd0ab83,_0x4a0071){var _0x266108=urlParse(_0x2c94f0);var _0x391e02=_0x266108[_0x980b('0x1e')]==='https:'?https:http;var _0x299af3={'host':_0x266108[_0x980b('0x1f')],'path':_0x266108[_0x980b('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x391e02[_0x980b('0x13')](_0x299af3,function(_0x42d97b){if(_0x42d97b[_0x980b('0x14')]!==0xc8){_0x4a0071(new Error('request\x20to\x20'+_0x2c94f0+_0x980b('0x18')+_0x42d97b['statusCode']+'\x20('+_0x42d97b[_0x980b('0x17')]+')'));return;}var _0x5ea15c='';_0x42d97b['on'](_0x980b('0x20'),function(_0x541bd9){_0x5ea15c+=_0x541bd9;});_0x42d97b['on'](_0x980b('0x1d'),function(){_0xd0ab83(_0x5ea15c);});})['on']('error',function(_0x56f52e){_0x4a0071(_0x56f52e);})[_0x980b('0x1d')]();});}function convertFile(_0x578f5a,_0x5ed68c){return new BPromise(function(_0x2357d9,_0x3bb44){var _0x520f97=sox[_0x980b('0x21')](_0x578f5a,_0x5ed68c,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x520f97['on'](_0x980b('0x15'),function(_0x236e06){logger[_0x980b('0x15')](_0x980b('0x22'),_0x236e06);_0x3bb44(_0x236e06);});_0x520f97['on'](_0x980b('0x1d'),function(){logger[_0x980b('0x1a')](_0x980b('0x23'));_0x2357d9();});_0x520f97['start']();});}function base64Decode(_0x199f57,_0x281259){var _0x142f34=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x27'));fs[_0x980b('0x28')](_0x142f34,_0x199f57,_0x980b('0x29'));return convertFile(_0x142f34,_0x281259)[_0x980b('0x2a')](function(){try{fs[_0x980b('0x2b')](_0x142f34);fs[_0x980b('0x2c')](_0x281259,'777');}catch(_0xbf3ec7){logger[_0x980b('0x15')](_0xbf3ec7);}return _0x281259[_0x980b('0x2d')]('.')[0x0];});}function base64Encode(_0x50a6e8){var _0x556193=fs[_0x980b('0x2e')](_0x50a6e8);return new Buffer(_0x556193)[_0x980b('0x2f')](_0x980b('0x29'));}exports['googleCloudTTS']=function(_0xc4e1ef,_0x4d3371,_0x1e8119,_0x145768,_0x184d4f,_0x1c6aa9){var _0x3ecb3f,_0x1e48d4;var _0xf11c1e=_0x980b('0x30');var _0x25cbdc=_0x980b('0x31')+_0xc4e1ef;var _0x333152={};if(_0x4d3371===_0x980b('0x32')){_0x333152[_0x980b('0x33')]={'ssml':_0x1e8119};}else{_0x333152[_0x980b('0x33')]={'text':_0x1e8119};};_0x333152['voice']={'languageCode':_0x145768,'ssmlGender':_0x184d4f};_0x333152['audioConfig']={'audioEncoding':_0x980b('0x34'),'sampleRateHertz':0x1f40};var _0x3fd97a={'url':_0xf11c1e+_0x980b('0x35')+_0x25cbdc,'method':_0x980b('0x36'),'json':!![],'body':_0x333152};return rp(_0x3fd97a)['then'](function(_0x50bac2){return new BPromise(function(_0x475199,_0xbb4607){_0x3ecb3f=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x37'));var _0x15d339=Buffer[_0x980b('0x38')](_0x50bac2['audioContent'],_0x980b('0x29'));return fs[_0x980b('0x39')](_0x3ecb3f,_0x15d339,function(_0x11a033){_0xbb4607(_0x11a033);},function(_0x6c21af){fs['chmodSync'](_0x3ecb3f,_0x980b('0x3a'));_0x475199(_0x6c21af);});});})[_0x980b('0x2a')](function(_0x1586d3){_0x1e48d4=path[_0x980b('0x24')](__dirname,'tmp',rs[_0x980b('0x26')](0x4)+_0x980b('0x27'));return convertFile(_0x3ecb3f,_0x1e48d4);})[_0x980b('0x2a')](function(){try{fs['unlink'](_0x3ecb3f);fs[_0x980b('0x2c')](_0x1e48d4,'777');}catch(_0x3fcd79){logger[_0x980b('0x15')](_0x3fcd79);}logger[_0x980b('0x1a')](_0x980b('0x3b'),_0x1e48d4[_0x980b('0x2d')]('.')[0x0]);return _0x1e48d4[_0x980b('0x2d')]('.')[0x0];});};exports[_0x980b('0x3c')]=function(_0x382de4,_0x8e91a4){var _0x27a678,_0x22854d;return tts(_0x382de4,_0x8e91a4||'en',0x1)[_0x980b('0x2a')](function(_0x4d9236){logger['info'](_0x4d9236);_0x27a678=path['resolve'](__dirname,_0x980b('0x25'),rs['generate'](0x4)+_0x980b('0x37'));return downloadFile(_0x4d9236,_0x27a678);})[_0x980b('0x2a')](function(){_0x22854d=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x27'));return convertFile(_0x27a678,_0x22854d);})[_0x980b('0x2a')](function(){try{fs['unlink'](_0x27a678);fs['chmodSync'](_0x22854d,'777');}catch(_0x36cdf0){logger[_0x980b('0x15')](_0x36cdf0);}logger[_0x980b('0x1a')](_0x980b('0x3d'),_0x22854d[_0x980b('0x2d')]('.')[0x0]);return _0x22854d[_0x980b('0x2d')]('.')[0x0];});};exports[_0x980b('0x3e')]=function(_0x42140a,_0x116d3e,_0x8be566){return google[_0x980b('0x3f')](_0x42140a,_0x116d3e,_0x8be566)[_0x980b('0x2a')](function(_0x178428){logger[_0x980b('0x1a')](_0x178428[_0x980b('0x40')]);return rp(_0x178428);})['then'](function(_0x3ceb46){var _0x2a5641='';var _0x3b916b=0x0;try{fs['unlink'](_0x42140a);}catch(_0x578bd5){logger['error'](_0x578bd5);}if(_0x3ceb46&&_0x3ceb46[_0x980b('0x41')]){_0x2a5641=_0x3ceb46[_0x980b('0x41')][_0x980b('0x42')](function(_0x2e9af6){return _0x2e9af6&&_0x2e9af6[_0x980b('0x43')][0x0]&&_0x2e9af6[_0x980b('0x43')][0x0][_0x980b('0x44')]?_0x2e9af6[_0x980b('0x43')][0x0]['transcript']:'';})[_0x980b('0x45')]('\x0a');_0x3b916b=_0x3ceb46[_0x980b('0x41')][_0x980b('0x42')](function(_0x4330a8){return _0x4330a8&&_0x4330a8['alternatives'][0x0]&&_0x4330a8[_0x980b('0x43')][0x0][_0x980b('0x46')]?_0x4330a8[_0x980b('0x43')][0x0][_0x980b('0x46')]:0x0;})[_0x980b('0x45')]('\x0a');}logger[_0x980b('0x1a')](_0x980b('0x47'),_0x2a5641);logger[_0x980b('0x1a')](_0x980b('0x48'),_0x3b916b);return{'transcript':_0x2a5641,'confidence':_0x3b916b};})[_0x980b('0x49')](function(_0x3d278c){logger[_0x980b('0x15')](_0x980b('0x4a'),_0x3d278c[_0x980b('0x14')],_0x3d278c[_0x980b('0x4b')],_0x3d278c[_0x980b('0x4c')]);});};exports[_0x980b('0x4d')]=function(_0x22a4fe,_0x14506a,_0x3c532f,_0x174d44){var _0x189ebf=apiai(_0x14506a,{'language':_0x174d44||'en'});return _0x189ebf[_0x980b('0x4e')](_0x3c532f,{'sessionId':md5(_0x22a4fe)})[_0x980b('0x2a')](function(_0x3cebfe){logger['info'](JSON[_0x980b('0x4f')](_0x3cebfe));return{'source':_0x3cebfe[_0x980b('0x50')][_0x980b('0x51')],'resolvedQuery':_0x3cebfe[_0x980b('0x50')][_0x980b('0x52')],'action':_0x3cebfe['result'][_0x980b('0x53')],'actionIncomplete':_0x3cebfe[_0x980b('0x50')][_0x980b('0x54')],'speech':_0x3cebfe[_0x980b('0x50')][_0x980b('0x55')][_0x980b('0x56')],'score':_0x3cebfe['result'][_0x980b('0x57')],'statusCode':_0x3cebfe['status'][_0x980b('0x58')],'endConversation':_0x3cebfe[_0x980b('0x50')][_0x980b('0x59')][_0x980b('0x5a')]||![],'isFallbackIntent':_0x3cebfe[_0x980b('0x50')][_0x980b('0x59')][_0x980b('0x5b')]};});};exports[_0x980b('0x5c')]=function(_0x5742d7,_0x35f80a,_0x317df7,_0x29a8ac){return tilde[_0x980b('0x3f')](_0x5742d7,_0x35f80a,_0x317df7,_0x29a8ac)[_0x980b('0x2a')](function(_0x37d96c){try{fs[_0x980b('0x2b')](_0x5742d7);}catch(_0x714580){logger[_0x980b('0x15')](_0x714580);}logger[_0x980b('0x1a')](_0x980b('0x5d'),_0x37d96c['transcript']);logger[_0x980b('0x1a')](_0x980b('0x5e'),_0x37d96c[_0x980b('0x46')]);return _0x37d96c;});};exports[_0x980b('0x5f')]=function(_0x15bacf,_0x4155dc,_0x1b4288,_0x31171f,_0x127e4d,_0x46f4d7){var _0x538f2f=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x37'));var _0xb6bdec;return aws[_0x980b('0x60')](_0x15bacf,_0x4155dc,_0x1b4288,_0x31171f,_0x127e4d,_0x46f4d7,_0x538f2f)[_0x980b('0x2a')](function(){_0xb6bdec=path['resolve'](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x27'));return convertFile(_0x538f2f,_0xb6bdec);})['then'](function(){try{fs[_0x980b('0x2b')](_0x538f2f);fs[_0x980b('0x2c')](_0xb6bdec,_0x980b('0x3a'));}catch(_0x826ce0){logger[_0x980b('0x15')](_0x826ce0);}return _0xb6bdec[_0x980b('0x2d')]('.')[0x0];});};exports[_0x980b('0x61')]=function(_0xe53c76,_0x234002,_0x49b2c8,_0x5706ed,_0x422911,_0x3e10b2){return aws[_0x980b('0x62')](_0xe53c76,_0x234002,_0x49b2c8,_0x5706ed,_0x422911,_0x3e10b2)[_0x980b('0x2a')](function(_0x530428){logger[_0x980b('0x1a')](JSON[_0x980b('0x4f')](_0x530428));return _0x530428;});};exports['ispeechTTS']=function(_0x320066,_0x412251,_0xbf28f4,_0x507cb8){var _0x43c435=util[_0x980b('0x63')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x320066,encodeURIComponent(_0x412251),_0xbf28f4,_0x507cb8);var _0x13bc4d=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs[_0x980b('0x26')](0x4)+_0x980b('0x37'));var _0x4a2ec3;return downloadFile(_0x43c435,_0x13bc4d)[_0x980b('0x2a')](function(){_0x4a2ec3=path[_0x980b('0x24')](__dirname,_0x980b('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x13bc4d,_0x4a2ec3);})[_0x980b('0x2a')](function(){try{fs[_0x980b('0x2b')](_0x13bc4d);fs[_0x980b('0x2c')](_0x4a2ec3,_0x980b('0x3a'));}catch(_0x537c80){logger['error'](_0x537c80);}return _0x4a2ec3['split']('.')[0x0];});};exports['ispeechASR']=function(_0x2b7438,_0x428f61,_0xaa06db,_0x5171f3){var _0x19c90d=util[_0x980b('0x63')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x428f61,_0xaa06db,base64Encode(_0x2b7438),_0x5171f3?util[_0x980b('0x63')](_0x980b('0x64'),encodeURIComponent(_0x5171f3)):'freeform=3');return uploadFile(_0x19c90d)[_0x980b('0x2a')](function(_0xcf0d7c){return querystring['parse'](_0xcf0d7c);});};exports[_0x980b('0x65')]=function(_0x14f2f4,_0x557ba3){return sestek[_0x980b('0x66')](_0x14f2f4,_0x557ba3)[_0x980b('0x2a')](function(_0x72774c){logger['info'](JSON[_0x980b('0x4f')](_0x72774c));var _0x363c15={'speech':_0x72774c[_0x980b('0x67')],'action':_0x72774c['channelData']?_0x72774c['channelData']['CustomAction']:undefined,'actiondata':_0x72774c[_0x980b('0x68')]?_0x72774c[_0x980b('0x68')]['CustomActionData']:undefined};if(_0x72774c[_0x980b('0x68')]&&_0x72774c['channelData'][_0x980b('0x69')]){return base64Decode(_0x72774c[_0x980b('0x68')][_0x980b('0x69')][_0x980b('0x6a')],path['resolve'](__dirname,'tmp',rs[_0x980b('0x26')](0x4)+'.wav'))[_0x980b('0x2a')](function(_0x14794f){_0x363c15['audiofile']=_0x14794f;return _0x363c15;});}return _0x363c15;});};exports[_0x980b('0x6b')]=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 15a6a00..99dd6bc 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 _0x09c5=['./nda'];(function(_0x2e21ba,_0x12f669){var _0x2290f3=function(_0xdf3a27){while(--_0xdf3a27){_0x2e21ba['push'](_0x2e21ba['shift']());}};_0x2290f3(++_0x12f669);}(_0x09c5,0x1a6));var _0x509c=function(_0x560e64,_0x3b0905){_0x560e64=_0x560e64-0x0;var _0x5a9701=_0x09c5[_0x560e64];return _0x5a9701;};var nda=require(_0x509c('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xf4b2=['exports','./nda'];(function(_0x54ddd6,_0x51e29c){var _0x4f82bc=function(_0x19c631){while(--_0x19c631){_0x54ddd6['push'](_0x54ddd6['shift']());}};_0x4f82bc(++_0x51e29c);}(_0xf4b2,0x85));var _0x2f4b=function(_0x1d73b,_0x7f7a2c){_0x1d73b=_0x1d73b-0x0;var _0x3d3ce1=_0xf4b2[_0x1d73b];return _0x3d3ce1;};var nda=require(_0x2f4b('0x0'));module[_0x2f4b('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index e9094eb..3a8e30a 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 _0x83e6=['username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','Bearer\x20','access_token','body','channelData','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','POST','resolve','/token','password'];(function(_0x3ad28e,_0x31af37){var _0x52603b=function(_0x346fc9){while(--_0x346fc9){_0x3ad28e['push'](_0x3ad28e['shift']());}};_0x52603b(++_0x31af37);}(_0x83e6,0x165));var _0x683e=function(_0x14ccbf,_0x8f1672){_0x14ccbf=_0x14ccbf-0x0;var _0x3f7c7c=_0x83e6[_0x14ccbf];return _0x3f7c7c;};'use strict';var rp=require(_0x683e('0x0'));var url=require(_0x683e('0x1'));var logger=require(_0x683e('0x2'))('agi');module['exports']=function(_0x19329e,_0x45d24f){var _0x7239c0={'method':_0x683e('0x3'),'uri':url[_0x683e('0x4')](_0x45d24f['ndauth_url'],_0x683e('0x5')),'form':{'grant_type':_0x683e('0x6'),'username':_0x45d24f[_0x683e('0x7')],'password':_0x45d24f[_0x683e('0x6')]},'json':!![]};return rp(_0x7239c0)['then'](function(_0x10c7b2){var _0x293295={'method':_0x683e('0x3'),'uri':url['resolve'](_0x45d24f[_0x683e('0x8')],_0x683e('0x9')),'body':{'type':_0x45d24f[_0x683e('0xa')]||'message','channelId':'Nda','conversation':{'id':_0x19329e['uniqueid']},'from':{'id':_0x19329e[_0x683e('0xb')],'name':_0x19329e[_0x683e('0xc')]},'recipient':{'id':_0x19329e[_0x683e('0xd')],'name':_0x19329e['extension']},'text':_0x45d24f['text'],'channelData':{}},'headers':{'Authorization':_0x683e('0xe')+_0x10c7b2[_0x683e('0xf')]},'json':!![]};if(_0x45d24f['project']){_0x293295[_0x683e('0x10')][_0x683e('0x11')]['ProjectName']=_0x45d24f['project'];}if(_0x45d24f[_0x683e('0x12')]=='1'){_0x293295['body']['channelData'][_0x683e('0x13')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x45d24f[_0x683e('0x14')]){_0x293295[_0x683e('0x10')][_0x683e('0x11')][_0x683e('0x15')]=_0x45d24f[_0x683e('0x14')];if(_0x45d24f['custom_action_data']){_0x293295[_0x683e('0x10')][_0x683e('0x11')][_0x683e('0x16')]=_0x45d24f[_0x683e('0x17')];}}logger[_0x683e('0x18')](JSON[_0x683e('0x19')](_0x293295));return rp(_0x293295);});}; \ No newline at end of file +var _0x2419=['audio/wav','custom_action','custom_action_data','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','ndaactivity_type','message','uniqueid','callerid','calleridname','Bearer\x20','access_token','body','channelData','project','ndagenerate_audio'];(function(_0x38f6bc,_0x10832a){var _0x209b27=function(_0xa85571){while(--_0xa85571){_0x38f6bc['push'](_0x38f6bc['shift']());}};_0x209b27(++_0x10832a);}(_0x2419,0xed));var _0x9241=function(_0x279624,_0x555b65){_0x279624=_0x279624-0x0;var _0x533513=_0x2419[_0x279624];return _0x533513;};'use strict';var rp=require(_0x9241('0x0'));var url=require(_0x9241('0x1'));var logger=require(_0x9241('0x2'))(_0x9241('0x3'));module[_0x9241('0x4')]=function(_0x51f021,_0x1441e2){var _0xd12308={'method':_0x9241('0x5'),'uri':url[_0x9241('0x6')](_0x1441e2[_0x9241('0x7')],_0x9241('0x8')),'form':{'grant_type':_0x9241('0x9'),'username':_0x1441e2['username'],'password':_0x1441e2['password']},'json':!![]};return rp(_0xd12308)[_0x9241('0xa')](function(_0x197d02){var _0x230690={'method':_0x9241('0x5'),'uri':url['resolve'](_0x1441e2[_0x9241('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1441e2[_0x9241('0xc')]||_0x9241('0xd'),'channelId':'Nda','conversation':{'id':_0x51f021[_0x9241('0xe')]},'from':{'id':_0x51f021[_0x9241('0xf')],'name':_0x51f021[_0x9241('0x10')]},'recipient':{'id':_0x51f021['dnid'],'name':_0x51f021['extension']},'text':_0x1441e2['text'],'channelData':{}},'headers':{'Authorization':_0x9241('0x11')+_0x197d02[_0x9241('0x12')]},'json':!![]};if(_0x1441e2['project']){_0x230690[_0x9241('0x13')][_0x9241('0x14')]['ProjectName']=_0x1441e2[_0x9241('0x15')];}if(_0x1441e2[_0x9241('0x16')]=='1'){_0x230690['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x9241('0x17')};}if(_0x1441e2[_0x9241('0x18')]){_0x230690[_0x9241('0x13')]['channelData']['CustomAction']=_0x1441e2[_0x9241('0x18')];if(_0x1441e2[_0x9241('0x19')]){_0x230690['body'][_0x9241('0x14')]['CustomActionData']=_0x1441e2[_0x9241('0x19')];}}logger['info'](JSON['stringify'](_0x230690));return rp(_0x230690);});}; \ 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 4957434..ef8813d 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x5a1bdc,_0x28ed22,_0x391269,_0x32355b){return asr(_0x5a1bdc,_0x28ed22,_0x391269,_0x32355b);}; \ No newline at end of file +var _0x7024=['./lib/api'];(function(_0x2f3d46,_0x44f01e){var _0x40f71d=function(_0x4af04e){while(--_0x4af04e){_0x2f3d46['push'](_0x2f3d46['shift']());}};_0x40f71d(++_0x44f01e);}(_0x7024,0xa1));var _0x4702=function(_0x39e8e9,_0x5a7a14){_0x39e8e9=_0x39e8e9-0x0;var _0x27a7ca=_0x7024[_0x39e8e9];return _0x27a7ca;};'use strict';var asr=require(_0x4702('0x0'));module['exports']=function(_0x1e1651,_0x3aa679,_0x4467b1,_0x5c8334){return asr(_0x1e1651,_0x3aa679,_0x4467b1,_0x5c8334);}; \ 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 29a6889..d25eab9 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 _0xab49=['Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','EOS'];(function(_0x29ff23,_0xd7475c){var _0x266a9d=function(_0x1345ba){while(--_0x1345ba){_0x29ff23['push'](_0x29ff23['shift']());}};_0x266a9d(++_0xd7475c);}(_0xab49,0xdd));var _0x9ab4=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0xab49[_0x5b077b];return _0x16faf7;};'use strict';var BPromise=require(_0x9ab4('0x0'));var _=require(_0x9ab4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x9ab4('0x2'));var logger=require(_0x9ab4('0x3'))(_0x9ab4('0x4'));module[_0x9ab4('0x5')]=function(_0x51121f,_0x448c0d,_0x48d11f,_0x4ca0cd){return new BPromise(function(_0x27b504,_0x3ad13b){logger[_0x9ab4('0x6')](_0x9ab4('0x7'),_0x4ca0cd||_0x9ab4('0x8'));var _0x43b7c8=new WebSocket(_0x4ca0cd||_0x9ab4('0x8'),{'perMessageDeflate':![]});var _0x1f769c='';var _0x14730b='0';var _0xb755e6='1';var _0x4694cc=_0x9ab4('0x9');function _0x4e3c92(_0x4f6ea5){var _0x198d5d=crypto[_0x9ab4('0xa')]('sha1');_0x198d5d['update'](_0x4f6ea5);return _0x198d5d[_0x9ab4('0xb')]('hex');}function _0x9cba0f(){try{logger[_0x9ab4('0x6')](_0x9ab4('0xc'));var _0x169e12=moment()[_0x9ab4('0xd')]();var _0x5e3865=_0x4e3c92(_0x169e12+_0x448c0d+_0x48d11f);_0x43b7c8[_0x9ab4('0xe')](JSON[_0x9ab4('0xf')]({'appID':_0x448c0d,'timestamp':_0x169e12,'appKey':_0x5e3865}));var _0x428eb5=fs[_0x9ab4('0x10')](_0x51121f);_0x428eb5['on'](_0x9ab4('0x11'),function(_0x1b4e81){_0x43b7c8[_0x9ab4('0xe')](_0x1b4e81);});_0x428eb5['on']('close',function(){_0x43b7c8[_0x9ab4('0xe')](_0x9ab4('0x12'));});}catch(_0x23897b){logger['error'](_0x9ab4('0x13'),JSON['stringify'](_0x23897b));_0x43b7c8[_0x9ab4('0x14')]();}}function _0x43fd36(_0x465b30){try{if(_0x465b30){var _0xe513c9=JSON[_0x9ab4('0x15')](_0x465b30);switch(_0xe513c9[_0x9ab4('0x16')]){case 0x0:if(_0xe513c9[_0x9ab4('0x17')]){if(_0xe513c9[_0x9ab4('0x17')]['final']){logger['info'](_0x9ab4('0x18'),JSON[_0x9ab4('0xf')](_0xe513c9[_0x9ab4('0x17')][_0x9ab4('0x19')]));_0x1f769c=_0xe513c9[_0x9ab4('0x17')][_0x9ab4('0x19')][0x0]['transcript'];_0x14730b=_0xe513c9[_0x9ab4('0x17')][_0x9ab4('0x19')][0x0][_0x9ab4('0x1a')];_0xb755e6='0';_0x4694cc=_0x9ab4('0x1b');_0x43b7c8[_0x9ab4('0x14')]();}}break;case 0x1:logger[_0x9ab4('0x6')](_0x9ab4('0x9'));_0xb755e6='1';_0x4694cc=_0x9ab4('0x9');break;case 0x2:logger[_0x9ab4('0x6')](_0x9ab4('0x1c'));_0xb755e6='2';_0x4694cc=_0x9ab4('0x1c');break;case 0x9:logger['info'](_0x9ab4('0x1d'));_0xb755e6='9';_0x4694cc=_0x9ab4('0x1d');break;case 0xa:logger[_0x9ab4('0x6')](_0x9ab4('0x1e'));_0xb755e6='10';_0x4694cc=_0x9ab4('0x1e');break;case 0xb:logger[_0x9ab4('0x6')](_0x9ab4('0x1f'));_0xb755e6='11';_0x4694cc='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2803b1){logger[_0x9ab4('0x20')](_0x9ab4('0x21'),JSON['stringify'](_0x2803b1));_0x43b7c8['terminate']();}}function _0x467bd5(){logger[_0x9ab4('0x6')](_0x9ab4('0x22'));_0x27b504({'transcript':_0x1f769c,'confidence':_0x14730b,'status':_0xb755e6,'status_message':_0x4694cc});}function _0x36ce41(_0xdf8a58){logger[_0x9ab4('0x20')](_0x9ab4('0x23'));if(!_[_0x9ab4('0x24')](_0xdf8a58)){logger[_0x9ab4('0x20')](_[_0x9ab4('0x25')](_0xdf8a58)?JSON[_0x9ab4('0xf')](_0xdf8a58):_0xdf8a58);}}_0x43b7c8['on'](_0x9ab4('0x26'),_0x9cba0f);_0x43b7c8['on'](_0x9ab4('0x27'),_0x43fd36);_0x43b7c8['on']('close',_0x467bd5);_0x43b7c8['on'](_0x9ab4('0x20'),_0x36ce41);});}; \ No newline at end of file +var _0xdbba=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error'];(function(_0x534ae9,_0x5735c1){var _0x2dc1e7=function(_0x58048a){while(--_0x58048a){_0x534ae9['push'](_0x534ae9['shift']());}};_0x2dc1e7(++_0x5735c1);}(_0xdbba,0xce));var _0xadbb=function(_0x68a64c,_0x4fa1e1){_0x68a64c=_0x68a64c-0x0;var _0x3acf1f=_0xdbba[_0x68a64c];return _0x3acf1f;};'use strict';var BPromise=require(_0xadbb('0x0'));var _=require(_0xadbb('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xadbb('0x2'));var logger=require(_0xadbb('0x3'))(_0xadbb('0x4'));module[_0xadbb('0x5')]=function(_0x6ec1e2,_0x3f36c2,_0x199a29,_0x1683b5){return new BPromise(function(_0x1e846e,_0x126aed){logger[_0xadbb('0x6')](_0xadbb('0x7'),_0x1683b5||_0xadbb('0x8'));var _0x566212=new WebSocket(_0x1683b5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x162bb3='';var _0x2fd0e3='0';var _0x239a0f='1';var _0x28b7ed='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x598ced(_0x45825b){var _0x319481=crypto['createHash'](_0xadbb('0x9'));_0x319481[_0xadbb('0xa')](_0x45825b);return _0x319481[_0xadbb('0xb')](_0xadbb('0xc'));}function _0x182034(){try{logger[_0xadbb('0x6')](_0xadbb('0xd'));var _0x6a951e=moment()['unix']();var _0x95ce9f=_0x598ced(_0x6a951e+_0x3f36c2+_0x199a29);_0x566212[_0xadbb('0xe')](JSON[_0xadbb('0xf')]({'appID':_0x3f36c2,'timestamp':_0x6a951e,'appKey':_0x95ce9f}));var _0xadec09=fs['createReadStream'](_0x6ec1e2);_0xadec09['on'](_0xadbb('0x10'),function(_0x52b888){_0x566212[_0xadbb('0xe')](_0x52b888);});_0xadec09['on'](_0xadbb('0x11'),function(){_0x566212[_0xadbb('0xe')](_0xadbb('0x12'));});}catch(_0x1fbf02){logger[_0xadbb('0x13')](_0xadbb('0x14'),JSON[_0xadbb('0xf')](_0x1fbf02));_0x566212['terminate']();}}function _0x41f6bc(_0x6eb4ed){try{if(_0x6eb4ed){var _0x501960=JSON[_0xadbb('0x15')](_0x6eb4ed);switch(_0x501960['status']){case 0x0:if(_0x501960[_0xadbb('0x16')]){if(_0x501960['result'][_0xadbb('0x17')]){logger[_0xadbb('0x6')](_0xadbb('0x18'),JSON[_0xadbb('0xf')](_0x501960[_0xadbb('0x16')][_0xadbb('0x19')]));_0x162bb3=_0x501960[_0xadbb('0x16')]['hypotheses'][0x0]['transcript'];_0x2fd0e3=_0x501960['result'][_0xadbb('0x19')][0x0]['likelihood'];_0x239a0f='0';_0x28b7ed=_0xadbb('0x1a');_0x566212[_0xadbb('0x1b')]();}}break;case 0x1:logger[_0xadbb('0x6')](_0xadbb('0x1c'));_0x239a0f='1';_0x28b7ed=_0xadbb('0x1c');break;case 0x2:logger['info'](_0xadbb('0x1d'));_0x239a0f='2';_0x28b7ed='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0xadbb('0x1e'));_0x239a0f='9';_0x28b7ed=_0xadbb('0x1e');break;case 0xa:logger[_0xadbb('0x6')](_0xadbb('0x1f'));_0x239a0f='10';_0x28b7ed=_0xadbb('0x1f');break;case 0xb:logger[_0xadbb('0x6')](_0xadbb('0x20'));_0x239a0f='11';_0x28b7ed=_0xadbb('0x20');}}}catch(_0x3e6cfc){logger[_0xadbb('0x13')](_0xadbb('0x21'),JSON['stringify'](_0x3e6cfc));_0x566212[_0xadbb('0x1b')]();}}function _0x332645(){logger[_0xadbb('0x6')](_0xadbb('0x22'));_0x1e846e({'transcript':_0x162bb3,'confidence':_0x2fd0e3,'status':_0x239a0f,'status_message':_0x28b7ed});}function _0x4c012c(_0x5df4ad){logger[_0xadbb('0x13')](_0xadbb('0x23'));if(!_[_0xadbb('0x24')](_0x5df4ad)){logger[_0xadbb('0x13')](_[_0xadbb('0x25')](_0x5df4ad)?JSON['stringify'](_0x5df4ad):_0x5df4ad);}}_0x566212['on'](_0xadbb('0x26'),_0x182034);_0x566212['on'](_0xadbb('0x27'),_0x41f6bc);_0x566212['on'](_0xadbb('0x11'),_0x332645);_0x566212['on']('error',_0x4c012c);});}; \ 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 1260216..a9b2e81 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 _0x9822=['exports','./asr'];(function(_0x4bcfc7,_0x3cb415){var _0x500d74=function(_0x15e90d){while(--_0x15e90d){_0x4bcfc7['push'](_0x4bcfc7['shift']());}};_0x500d74(++_0x3cb415);}(_0x9822,0x93));var _0x2982=function(_0x71f294,_0x172d3f){_0x71f294=_0x71f294-0x0;var _0x3a9132=_0x9822[_0x71f294];return _0x3a9132;};var asr=require(_0x2982('0x0'));module[_0x2982('0x1')]={'asr':asr}; \ No newline at end of file +var _0x78e7=['exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x78e7,0x17d));var _0x778e=function(_0x30752a,_0x3f2a0b){_0x30752a=_0x30752a-0x0;var _0x4236af=_0x78e7[_0x30752a];return _0x4236af;};var asr=require('./asr');module[_0x778e('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 30b7053..87eb0e1 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 _0xc577=['inherits','exports','util','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listen','listening','emit','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','ready','connection','code','close','nextTick'];(function(_0xf5524b,_0x3bcd3e){var _0x39a21f=function(_0x181846){while(--_0x181846){_0xf5524b['push'](_0xf5524b['shift']());}};_0x39a21f(++_0x3bcd3e);}(_0xc577,0x172));var _0x7c57=function(_0x336adb,_0x1c3608){_0x336adb=_0x336adb-0x0;var _0x5be7f5=_0xc577[_0x336adb];return _0x5be7f5;};'use strict';var util=require(_0x7c57('0x0'));var net=require('net');var EventEmitter=require('events')[_0x7c57('0x1')];var AGIError=require(_0x7c57('0x2'));var AGIChannel=require(_0x7c57('0x3'));var AGIServer=function(_0x2a2415,_0x3abdb2,_0x304922){var _0x2ea08b=this,_0x2a2415=_0x2a2415||0x11dd,_0x3abdb2=_0x3abdb2||_0x7c57('0x4'),_0x1339b3=null,_0xf50a9f=0x0;EventEmitter[_0x7c57('0x5')](_0x2ea08b);function _0x4bb81b(){if(!_0x2a2415){_0x2ea08b['emit']('error',new AGIError(_0x7c57('0x6')));return![];}_0x1339b3=net['createServer']();_0x1339b3[_0x7c57('0x7')](_0x2a2415,_0x3abdb2);_0x1339b3['on'](_0x7c57('0x8'),function(){_0x2ea08b[_0x7c57('0x9')](_0x7c57('0x8'));});_0x1339b3['on']('connection',function(_0x1e4a96){_0x1339b3[_0x7c57('0xa')](function(_0x4b5b56,_0x20aae1){if(_0x4b5b56){_0x2ea08b[_0x7c57('0x9')](_0x7c57('0xb'),new AGIError(_0x7c57('0xc'),_0x4b5b56));}else if(_0x304922&&_0x304922<0x0){_0x2ea08b[_0x7c57('0x9')](_0x7c57('0xb'),new AGIError(_0x7c57('0xd')));_0x1e4a96['destroy']();}else if(_0x304922&&_0x304922>0x0&&_0x304922<_0x20aae1){_0xf50a9f+=0x1;_0x2ea08b['emit']('error',new AGIError(_0x7c57('0xe'),_0xf50a9f));_0x1e4a96[_0x7c57('0xf')]();}else{var _0x4c5af2=new AGIChannel(_0x1e4a96);_0x4c5af2['on'](_0x7c57('0x10'),function(){_0x2ea08b[_0x7c57('0x9')](_0x7c57('0x11'),_0x4c5af2);});}});});_0x1339b3['on'](_0x7c57('0xb'),function(_0x14ce67){_0x2ea08b['emit']('error',new AGIError(_0x7c57('0xc'),_0x14ce67[_0x7c57('0x12')]));});_0x1339b3['on'](_0x7c57('0x13'),function(){_0x2ea08b[_0x7c57('0x9')](_0x7c57('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x7c57('0x14')](function(){_0x4bb81b();});};util[_0x7c57('0x15')](AGIServer,EventEmitter);module[_0x7c57('0x16')]=function(_0x87617b,_0x44f272,_0x3e2dc0){return new AGIServer(_0x87617b,_0x44f272,_0x3e2dc0);}; \ No newline at end of file +var _0xe58a=['destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','./error','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x41ceb2,_0x5e06b4){var _0x492be7=function(_0x59ebf6){while(--_0x59ebf6){_0x41ceb2['push'](_0x41ceb2['shift']());}};_0x492be7(++_0x5e06b4);}(_0xe58a,0x9f));var _0xae58=function(_0x342f10,_0x54119c){_0x342f10=_0x342f10-0x0;var _0x510661=_0xe58a[_0x342f10];return _0x510661;};'use strict';var util=require(_0xae58('0x0'));var net=require(_0xae58('0x1'));var EventEmitter=require(_0xae58('0x2'))['EventEmitter'];var AGIError=require(_0xae58('0x3'));var AGIChannel=require('./channel');var AGIServer=function(_0x5e74b5,_0x32a020,_0x4a8df4){var _0x4df1a3=this,_0x5e74b5=_0x5e74b5||0x11dd,_0x32a020=_0x32a020||_0xae58('0x4'),_0x198e0c=null,_0x29749a=0x0;EventEmitter[_0xae58('0x5')](_0x4df1a3);function _0x703a03(){if(!_0x5e74b5){_0x4df1a3[_0xae58('0x6')](_0xae58('0x7'),new AGIError(_0xae58('0x8')));return![];}_0x198e0c=net[_0xae58('0x9')]();_0x198e0c[_0xae58('0xa')](_0x5e74b5,_0x32a020);_0x198e0c['on']('listening',function(){_0x4df1a3[_0xae58('0x6')](_0xae58('0xb'));});_0x198e0c['on'](_0xae58('0xc'),function(_0x36179b){_0x198e0c[_0xae58('0xd')](function(_0x501eea,_0x264659){if(_0x501eea){_0x4df1a3[_0xae58('0x6')]('error',new AGIError(_0xae58('0xe'),_0x501eea));}else if(_0x4a8df4&&_0x4a8df4<0x0){_0x4df1a3['emit'](_0xae58('0x7'),new AGIError(_0xae58('0xf')));_0x36179b[_0xae58('0x10')]();}else if(_0x4a8df4&&_0x4a8df4>0x0&&_0x4a8df4<_0x264659){_0x29749a+=0x1;_0x4df1a3[_0xae58('0x6')]('error',new AGIError(_0xae58('0x11'),_0x29749a));_0x36179b['destroy']();}else{var _0x54f59c=new AGIChannel(_0x36179b);_0x54f59c['on'](_0xae58('0x12'),function(){_0x4df1a3[_0xae58('0x6')](_0xae58('0xc'),_0x54f59c);});}});});_0x198e0c['on'](_0xae58('0x7'),function(_0x4c57b9){_0x4df1a3[_0xae58('0x6')](_0xae58('0x7'),new AGIError(_0xae58('0xe'),_0x4c57b9[_0xae58('0x13')]));});_0x198e0c['on']('close',function(){_0x4df1a3['emit'](_0xae58('0x14'),new AGIError(_0xae58('0x15')));});}process[_0xae58('0x16')](function(){_0x703a03();});};util[_0xae58('0x17')](AGIServer,EventEmitter);module[_0xae58('0x18')]=function(_0x50a424,_0x16a9a2,_0x3802cc){return new AGIServer(_0x50a424,_0x16a9a2,_0x3802cc);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 27d0702..d9b4f6d 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 _0x01dd=['getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','save_name','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','callback_','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','POST','PUT','body','parse','computedVariables','sync','uri','render','headers','stringify','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','en-US','isConfigured','model','awsPolly','aws_access_key_id','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','isArray','saveRestApiResult','%s.%s','setVariable','split','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','url','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','out','speech','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','bot','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','recordFile','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','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','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','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','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','subject','service','host','port','secure','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','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','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','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','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\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','rpc','mailRpc','prototype','getVariable','getVariableById','then','getVoiceQueue','getVoiceQueueById','name','catch'];(function(_0x20f08b,_0x646ea0){var _0x675062=function(_0x266c20){while(--_0x266c20){_0x20f08b['push'](_0x20f08b['shift']());}};_0x675062(++_0x646ea0);}(_0x01dd,0x1b0));var _0xd01d=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0x01dd[_0x30cc1a];return _0xb3f18f;};'use strict';var fs=require('fs');var path=require(_0xd01d('0x0'));var util=require(_0xd01d('0x1'));var _=require(_0xd01d('0x2'));var sh=require(_0xd01d('0x3'));var odbc=require(_0xd01d('0x4'))();var rs=require(_0xd01d('0x5'));var moment=require(_0xd01d('0x6'));var Mustache=require(_0xd01d('0x7'));var rp=require('request-promise');var logger=require(_0xd01d('0x8'))(_0xd01d('0x9'));var config=require(_0xd01d('0xa'));var scripts=require(_0xd01d('0xb'));var FILES_PATH=_0xd01d('0xc');var recursiveMapAttributes=[_0xd01d('0xd'),_0xd01d('0xe')];var verticesWithRetry=[_0xd01d('0xf'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x1bba1c,_0x22dca1,_0x51e489){this['channel']=_0x1bba1c;this[_0xd01d('0x10')]=_0x22dca1;this[_0xd01d('0x11')]=_0x51e489;};AGIVertices[_0xd01d('0x12')][_0xd01d('0x13')]=function(_0x2e8df9,_0x525b54){this[_0xd01d('0x10')][_0xd01d('0x14')](_0x2e8df9)[_0xd01d('0x15')](function(_0x235d6f){_0x525b54(null,_0x235d6f?_0x235d6f['name']:![]);})['catch'](function(_0x4fb3c2){_0x525b54(_0x4fb3c2);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x16')]=function(_0x4575b3,_0x3490d2){this[_0xd01d('0x10')][_0xd01d('0x17')](_0x4575b3)[_0xd01d('0x15')](function(_0x18027d){_0x3490d2(null,_0x18027d?_0x18027d[_0xd01d('0x18')]:![]);})[_0xd01d('0x19')](function(_0x34c642){_0x3490d2(_0x34c642);});};AGIVertices[_0xd01d('0x12')]['getSquareProject']=function(_0x444a95,_0x5bf805){this[_0xd01d('0x10')][_0xd01d('0x1a')](_0x444a95)[_0xd01d('0x15')](function(_0x16fcdc){_0x5bf805(null,_0x16fcdc?_0x16fcdc[_0xd01d('0x18')]:![]);})['catch'](function(_0x5af1f9){_0x5bf805(_0x5af1f9);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x34511a,_0x3ce2c5){this['rpc'][_0xd01d('0x1b')](_0x34511a)[_0xd01d('0x15')](function(_0x1c99ed){_0x3ce2c5(null,_0x1c99ed?_0x1c99ed[_0xd01d('0x1c')]:![]);})[_0xd01d('0x19')](function(_0x51a02d){_0x3ce2c5(_0x51a02d);});};AGIVertices[_0xd01d('0x12')]['getUser']=function(_0x542439,_0x408c73){this['rpc'][_0xd01d('0x1d')](_0x542439)[_0xd01d('0x15')](function(_0x32793b){_0x408c73(null,_0x32793b?_0x32793b['name']:![]);})[_0xd01d('0x19')](function(_0x6a915f){_0x408c73(_0x6a915f);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1e')]=function(_0x53d1d1,_0x43b2c6){this[_0xd01d('0x10')][_0xd01d('0x1f')](_0x53d1d1)[_0xd01d('0x15')](function(_0x1652de){_0x43b2c6(null,_0x1652de?_0x1652de[_0xd01d('0x18')]:![]);})[_0xd01d('0x19')](function(_0x3e3393){_0x43b2c6(_0x3e3393);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x20')]=function(_0x3393ac,_0x529011){var _0x61d854=this;this[_0xd01d('0x10')]['getSoundById'](_0x3393ac)[_0xd01d('0x15')](function(_0x12fbb3){_0x529011(null,_0x12fbb3?_0x61d854['getSoundPath'](_0x12fbb3[_0xd01d('0x21')]):![]);})[_0xd01d('0x19')](function(_0x393c5c){_0x529011(_0x393c5c);});};AGIVertices['prototype'][_0xd01d('0x22')]=function(_0x5c4e4a,_0x5632b1){this[_0xd01d('0x10')]['getMailAccountById'](_0x5c4e4a)[_0xd01d('0x15')](function(_0x128d0d){_0x5632b1(null,_0x128d0d?_0x128d0d:![]);})[_0xd01d('0x19')](function(_0x51f5a4){_0x5632b1(_0x51f5a4);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x23')]=function(_0x46bbaa,_0x20c425,_0x35b354){this[_0xd01d('0x11')][_0xd01d('0x23')](_0x46bbaa,_0x20c425)[_0xd01d('0x15')](function(){_0x35b354(null);})[_0xd01d('0x19')](function(_0x4e733f){_0x35b354(_0x4e733f);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x24')]=function(_0x468466,_0x3fdf22){this[_0xd01d('0x10')]['getIntervalById'](_0x468466)[_0xd01d('0x15')](function(_0x4c71e3){if(_0x4c71e3){if(_0x4c71e3[_0xd01d('0x25')]){_0x3fdf22(null,[_0x4c71e3[_0xd01d('0x26')]]);}else{_0x3fdf22(null,_[_0xd01d('0x27')](_0x4c71e3[_0xd01d('0x28')],_0xd01d('0x26')));}}else{_0x3fdf22(null,![]);}})[_0xd01d('0x19')](function(_0x5403e9){_0x3fdf22(_0x5403e9);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x29')]=function(_0x2cf5fd){return util[_0xd01d('0x2a')](_0xd01d('0x2b'),FILES_PATH,_0x2cf5fd);};AGIVertices['prototype'][_0xd01d('0x2c')]=function(_0x31478e,_0x1e5791,_0x1ff627){odbc[_0xd01d('0x2d')](_0x31478e,function(_0x338031){if(_0x338031){logger[_0xd01d('0x2e')](_0xd01d('0x2f'),_0x338031);_0x1ff627(_0x338031);}else{logger[_0xd01d('0x30')]('ODBC\x20connection\x20successfully');odbc[_0xd01d('0x31')](_0x1e5791,function(_0x26c603,_0x22f720){if(_0x26c603){logger[_0xd01d('0x30')](_0xd01d('0x32'),_0x1e5791);_0x1ff627(_0x26c603);}else{logger[_0xd01d('0x30')](_0xd01d('0x33'),_0x1e5791);odbc['close'](function(_0x33933b){if(_0x33933b){logger[_0xd01d('0x2e')](_0xd01d('0x34'),_0x33933b);}_0x1ff627(null,_0x22f720);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x4fd427,_0x2b7a9f){this[_0xd01d('0x10')][_0xd01d('0x35')](_0x4fd427)['then'](function(_0x551762){_0x2b7a9f(null,_0x551762?_0x551762:![]);})['catch'](function(_0x28a42a){_0x2b7a9f(_0x28a42a);});};AGIVertices[_0xd01d('0x12')]['createSmsMessage']=function(_0x35860e,_0x1f6c3f){this['rpc']['createSmsMessage'](_0x35860e)[_0xd01d('0x15')](function(_0x170f01){_0x1f6c3f(null,_0x170f01);})[_0xd01d('0x19')](function(_0x52ef28){_0x1f6c3f(_0x52ef28);});};AGIVertices['prototype'][_0xd01d('0x36')]=function(_0x4a92e9,_0x50ca11,_0x44e3e7){this['rpc'][_0xd01d('0x36')]({'uniqueid':this[_0xd01d('0x37')][_0xd01d('0x38')],'node':_0x4a92e9['label'],'application':_0x4a92e9[_0xd01d('0x39')],'data':_0x50ca11||null,'project_name':this[_0xd01d('0x37')]['arg_1'],'callerid':this[_0xd01d('0x37')][_0xd01d('0x3a')]})[_0xd01d('0x15')](function(_0x572668){if(_0x44e3e7){_0x44e3e7(null,_0x572668);}})[_0xd01d('0x19')](function(_0x594740){if(_0x44e3e7){_0x44e3e7(_0x594740);}});};AGIVertices[_0xd01d('0x12')]['createSquareRecording']=function(_0x5c8d78,_0x52dc10,_0x20a912,_0x20d009){this['rpc'][_0xd01d('0x3b')]({'uniqueid':this['channel'][_0xd01d('0x38')],'callerid':this[_0xd01d('0x37')][_0xd01d('0x3a')],'calleridname':this[_0xd01d('0x37')][_0xd01d('0x3c')],'context':this['channel'][_0xd01d('0x3d')],'extension':this['channel'][_0xd01d('0x3e')],'priority':this['channel'][_0xd01d('0x3f')],'accountcode':this[_0xd01d('0x37')][_0xd01d('0x40')],'dnid':this[_0xd01d('0x37')][_0xd01d('0x41')],'projectName':this[_0xd01d('0x37')][_0xd01d('0x42')],'saveName':_0x52dc10,'filename':_0x5c8d78[_0xd01d('0x43')]||_0x52dc10,'savePath':_0x20a912})['then'](function(_0x2d1bfd){_0x20d009(null,_0x2d1bfd);})[_0xd01d('0x19')](function(_0x533ed9){_0x20d009(_0x533ed9);});};AGIVertices[_0xd01d('0x12')]['createSquareMessage']=function(_0x305039,_0x50a64a,_0x322a12){this[_0xd01d('0x10')][_0xd01d('0x44')]({'uniqueid':this[_0xd01d('0x37')][_0xd01d('0x38')],'body':_0x305039,'direction':_0x50a64a})[_0xd01d('0x15')](function(_0x4afda5){if(_0x322a12){_0x322a12(null,_0x4afda5);}})[_0xd01d('0x19')](function(_0x51e10e){if(_0x322a12){_0x322a12(_0x51e10e);}});};AGIVertices['prototype'][_0xd01d('0x45')]=function(_0x2ecdc4,_0x362542){this[_0xd01d('0x10')][_0xd01d('0x45')]({'firstName':_['isEmpty'](_0x2ecdc4[_0xd01d('0x18')])||_['isNil'](_0x2ecdc4[_0xd01d('0x18')])?_0xd01d('0x46')+Math['random']():_0x2ecdc4[_0xd01d('0x18')],'lastName':_[_0xd01d('0x47')](_0x2ecdc4[_0xd01d('0x48')])||_[_0xd01d('0x49')](_0x2ecdc4['lastName'])?null:_0x2ecdc4[_0xd01d('0x48')],'phone':_0x2ecdc4[_0xd01d('0x4a')],'ListId':_0x2ecdc4[_0xd01d('0x4b')],'scheduledat':_0x2ecdc4[_0xd01d('0x4c')],'callbackUniqueid':this[_0xd01d('0x37')][_0xd01d('0x38')],'tags':_0xd01d('0x4d'),'description':_0xd01d('0x4e')+_0x2ecdc4[_0xd01d('0x4c')][_0xd01d('0x4f')](),'priority':_0x2ecdc4['callback_priority']})[_0xd01d('0x15')](function(_0x54642d){_0x362542(null,_0x54642d);})[_0xd01d('0x19')](function(_0x29c471){_0x362542(_0x29c471);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x50')]=function(_0x105df8,_0x1974ea){this['rpc'][_0xd01d('0x51')](_0x105df8)['then'](function(_0x11f2dd){_0x1974ea(null,_0x11f2dd?_0x11f2dd[_0xd01d('0x18')]:![]);})[_0xd01d('0x19')](function(_0x311146){_0x1974ea(_0x311146);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x52')]=function(_0x1211d1,_0x576994,_0x2929c5){var _0x40b91a={'role':_0xd01d('0x53')};_0x40b91a[_0x1211d1]=this[_0xd01d('0x37')][_0xd01d('0x3a')];this[_0xd01d('0x10')][_0xd01d('0x52')](_0x40b91a,_0x576994,this[_0xd01d('0x37')]['uniqueid'])[_0xd01d('0x15')](function(_0x3b907e){_0x2929c5(null,_[_0xd01d('0x49')](_0x3b907e)?![]:!![]);})['catch'](function(_0x145c65){logger[_0xd01d('0x2e')](_0x145c65);_0x2929c5(null,![]);});};AGIVertices[_0xd01d('0x12')]['agentUnpause']=function(_0x354688,_0x56ec9d){var _0x53dcc9={'role':'agent'};_0x53dcc9[_0x354688]=this[_0xd01d('0x37')][_0xd01d('0x3a')];this['rpc'][_0xd01d('0x54')](_0x53dcc9)[_0xd01d('0x15')](function(_0x46702d){_0x56ec9d(null,_[_0xd01d('0x49')](_0x46702d)?![]:!![]);})[_0xd01d('0x19')](function(_0x5bb398){logger[_0xd01d('0x2e')](_0x5bb398);_0x56ec9d(null,![]);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x55')]=function(_0x58aa17,_0x44e746){var _0x23bb73={'role':_0xd01d('0x53')};_0x23bb73[_0x58aa17]=this[_0xd01d('0x37')]['callerid'];this[_0xd01d('0x10')]['agentLogout'](_0x23bb73)['then'](function(_0x139144){_0x44e746(null,_[_0xd01d('0x49')](_0x139144)?![]:!![]);})[_0xd01d('0x19')](function(_0x14b258){logger[_0xd01d('0x2e')](_0x14b258);_0x44e746(null,![]);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x56')]=function(_0x253648,_0x13bb5a){var _0x2012fc={'role':_0xd01d('0x53')};_0x2012fc[_0x253648]=this[_0xd01d('0x37')]['callerid'];var _0x1be627=_0x253648!=_0xd01d('0x57')?util[_0xd01d('0x2a')](_0xd01d('0x58'),_0xd01d('0x59'),this[_0xd01d('0x37')][_0xd01d('0x3a')]):undefined;this['rpc']['agentLogin'](_0x2012fc,_0x1be627)[_0xd01d('0x15')](function(_0x4c7f13){_0x13bb5a(null,_['isNil'](_0x4c7f13)?![]:!![]);})[_0xd01d('0x19')](function(_0x126cf2){logger[_0xd01d('0x2e')](_0x126cf2);_0x13bb5a(null,![]);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x5a')]=function(_0x52899e,_0x2a0074){sh[_0xd01d('0x5b')](_['trim'](_0x52899e),function(_0x12dd0c,_0x1acef0){var _0xe33552=_0x1acef0[_0xd01d('0x5c')](/(\r\n|\n|\r)/gm,'');_0x2a0074(null,_0xe33552);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x5d')]=function(_0x3ccbe3,_0x555846){scripts[_0xd01d('0x5d')](_0x3ccbe3[_0xd01d('0x5e')],_0x3ccbe3[_0xd01d('0x5f')]||'text',_0x3ccbe3[_0xd01d('0x60')],_0x3ccbe3[_0xd01d('0x61')]||'en-US',_0x3ccbe3[_0xd01d('0x62')]||_0xd01d('0x63'),_0x3ccbe3[_0xd01d('0x64')]||'MP3')['then'](function(_0x2ae725){_0x555846(null,_0x2ae725);})[_0xd01d('0x19')](function(_0x46a11d){_0x555846(_0x46a11d);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x65')]=function(_0x33eaec,_0x5a2649){scripts[_0xd01d('0x65')](_0x33eaec[_0xd01d('0x60')],_0x33eaec[_0xd01d('0x66')]||'en',0x1)[_0xd01d('0x15')](function(_0x494da2){_0x5a2649(null,_0x494da2);})['catch'](function(_0x5a1625){_0x5a2649(_0x5a1625);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x67')]=function(_0x466ed1,_0x58191){var _0x4fc0a9={'uri':_0x466ed1['url'],'method':_0x466ed1[_0xd01d('0x68')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x466ed1[_0xd01d('0x69')])===_0xd01d('0x6a')&&parseInt(_0x466ed1[_0xd01d('0x69')])>=0x1?parseInt(_0x466ed1[_0xd01d('0x69')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd01d('0x6b'),_0xd01d('0x6c')],_0x4fc0a9[_0xd01d('0x68')]['toUpperCase']())){try{_0x4fc0a9[_0xd01d('0x6d')]=_0x466ed1['rawBody']?JSON[_0xd01d('0x6e')](_0x466ed1[_0xd01d('0xe')]):{};}catch(_0x59b8e9){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x59b8e9);}}try{_0x4fc0a9['headers']=_0x466ed1[_0xd01d('0xd')]?JSON[_0xd01d('0x6e')](_0x466ed1['rawHeaders']):{};}catch(_0x19d7da){logger[_0xd01d('0x2e')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x19d7da);}if(_0x466ed1[_0xd01d('0x6f')]){try{var _0x3fbbad=require(_0x466ed1['computedVariables'])[_0xd01d('0x70')](this,_0x4fc0a9);_0x4fc0a9[_0xd01d('0x71')]=Mustache[_0xd01d('0x72')](_0x466ed1['url'],_0x3fbbad,{},['$$','$$']);if(_0x4fc0a9[_0xd01d('0x73')]){_0x4fc0a9[_0xd01d('0x73')]=JSON[_0xd01d('0x6e')](Mustache[_0xd01d('0x72')](JSON[_0xd01d('0x74')](_0x4fc0a9[_0xd01d('0x73')]),_0x3fbbad,{},['$$','$$']));}if(_0x4fc0a9[_0xd01d('0x6d')]){_0x4fc0a9[_0xd01d('0x6d')]=JSON[_0xd01d('0x6e')](Mustache[_0xd01d('0x72')](JSON[_0xd01d('0x74')](_0x4fc0a9['body']),_0x3fbbad,{},['$$','$$']));}}catch(_0x5b6118){logger[_0xd01d('0x2e')](_0xd01d('0x75'),_0x5b6118);}}rp(_0x4fc0a9)[_0xd01d('0x15')](function(_0x3d0114){var _0x1835a4={'statusCode':_0x3d0114[_0xd01d('0x76')]||0xc8,'statusMessage':_0x3d0114['statusMessage']||'OK','headers':_0x3d0114[_0xd01d('0x73')]||{},'body':_0x3d0114['body']||{}};_0x58191(null,_0x1835a4);})[_0xd01d('0x19')](function(_0x5e4631){var _0x3f7118={'statusCode':_0x5e4631[_0xd01d('0x76')]||0x1f4,'statusMessage':_0x5e4631[_0xd01d('0x77')]||_0xd01d('0x78'),'headers':_0x5e4631[_0xd01d('0x79')][_0xd01d('0x73')]||{},'body':_0x5e4631[_0xd01d('0x79')]['body']||{}};_0x58191(null,_0x3f7118);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x7a')]=function(_0x51412e,_0x3096c8){scripts[_0xd01d('0x7a')](this[_0xd01d('0x37')][_0xd01d('0x38')],_0x51412e[_0xd01d('0x7b')],_0x51412e['text'],_0x51412e[_0xd01d('0x7c')]||'en')[_0xd01d('0x15')](function(_0x3ec402){_0x3096c8(null,_0x3ec402);})['catch'](function(_0x5873f5){_0x3096c8(_0x5873f5);});};AGIVertices['prototype'][_0xd01d('0x7d')]=function(_0x5daa11,_0x4a7a6e){scripts[_0xd01d('0x7d')](this[_0xd01d('0x37')],_0x5daa11)['then'](function(_0x4fae95){_0x4a7a6e(null,_0x4fae95);})[_0xd01d('0x19')](function(_0x5a8687){_0x4a7a6e(_0x5a8687);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x7e')]=function(_0x556714,_0x4ceb84){scripts[_0xd01d('0x7e')](_0x556714[_0xd01d('0x7b')],_0x556714[_0xd01d('0x60')],_0x556714[_0xd01d('0x7f')]||'en-US',_0x556714[_0xd01d('0x80')])[_0xd01d('0x15')](function(_0x2b8a85){_0x4ceb84(null,_0x2b8a85);})[_0xd01d('0x19')](function(_0xae591d){_0x4ceb84(_0xae591d);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x81')]=function(_0x23a0cf,_0x2cdbe8,_0x12c910){scripts[_0xd01d('0x81')](_0x2cdbe8,_0x23a0cf[_0xd01d('0x7b')],_0x23a0cf[_0xd01d('0x82')]||_0xd01d('0x83'),this[_0xd01d('0x84')](_0x23a0cf[_0xd01d('0x85')])?_0x23a0cf[_0xd01d('0x85')]:undefined)['then'](function(_0xb81540){_0x12c910(null,_0xb81540);})[_0xd01d('0x19')](function(_0x53bc17){_0x12c910(_0x53bc17);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x86')]=function(_0x36339d,_0x429824){scripts['awsPolly'](_0x36339d[_0xd01d('0x87')],_0x36339d['aws_secret_access_key'],_0x36339d['aws_polly_region'],_0x36339d['aws_polly_voice']||_0xd01d('0x88'),_0x36339d[_0xd01d('0x60')],_0x36339d[_0xd01d('0x89')]||_0xd01d('0x60'))['then'](function(_0x289e5a){_0x429824(null,_0x289e5a);})[_0xd01d('0x19')](function(_0x204fa1){_0x429824(_0x204fa1);});};AGIVertices['prototype'][_0xd01d('0x8a')]=function(_0x5b82d0,_0x23ad8d){scripts[_0xd01d('0x8a')](this[_0xd01d('0x37')][_0xd01d('0x38')],_0x5b82d0[_0xd01d('0x87')],_0x5b82d0['aws_secret_access_key'],_0x5b82d0['aws_lex_region'],_0x5b82d0['text'],_0x5b82d0[_0xd01d('0x8b')])[_0xd01d('0x15')](function(_0x115a8a){_0x23ad8d(null,_0x115a8a);})[_0xd01d('0x19')](function(_0x2ed2b2){_0x23ad8d(_0x2ed2b2);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x8c')]=function(_0x2e1fd4,_0x4b90eb,_0x2a07da){scripts['googleASR'](_0x4b90eb,_0x2e1fd4[_0xd01d('0x7b')],_0x2e1fd4[_0xd01d('0x8d')]||_0xd01d('0x83'))[_0xd01d('0x15')](function(_0x2af7a8){_0x2a07da(null,_0x2af7a8);})[_0xd01d('0x19')](function(_0x8862f9){_0x2a07da(_0x8862f9);});};AGIVertices[_0xd01d('0x12')][_0xd01d('0x8e')]=function(_0x500bf9,_0x581799,_0x2d997f){scripts[_0xd01d('0x8e')](_0x581799,_0x500bf9[_0xd01d('0x8f')],_0x500bf9['appsecret'],_0x500bf9[_0xd01d('0x71')])[_0xd01d('0x15')](function(_0x5df227){_0x2d997f(null,_0x5df227);})[_0xd01d('0x19')](function(_0x558ae5){_0x2d997f(_0x558ae5);});};AGIVertices['prototype'][_0xd01d('0x90')]=function(_0xe19840){var _0x38869d=_[_0xd01d('0x91')](verticesWithRetry,_0xe19840[_0xd01d('0x39')])?_0xe19840:_[_0xd01d('0x92')](_0xe19840);for(var _0xe92732 in _0x38869d){if(_0x38869d[_0xd01d('0x93')](_0xe92732)){if(_0x38869d[_0xe92732]&&_[_0xd01d('0x94')](_0x38869d[_0xe92732])){if(_[_0xd01d('0x91')](recursiveMapAttributes,_0xe92732)){_0x38869d[_0xe92732]=this[_0xd01d('0x95')](_0x38869d[_0xe92732]);}else{_0x38869d[_0xe92732]=this[_0xd01d('0x96')](_0x38869d[_0xe92732]);}}}}return _0x38869d;};AGIVertices[_0xd01d('0x12')][_0xd01d('0x97')]=function(_0x27ddc0){for(var _0x2de511 in _0x27ddc0){if(_0x27ddc0[_0xd01d('0x93')](_0x2de511)){if(_[_0xd01d('0x98')](_0x27ddc0[_0x2de511])){this[_0xd01d('0x97')](_0x27ddc0[_0x2de511]);}else if(_['isArray'](_0x27ddc0[_0x2de511])){for(var _0x163959=0x0;_0x163959<_0x27ddc0[_0x2de511][_0xd01d('0x99')];_0x163959++){this[_0xd01d('0x97')](_0x27ddc0[_0x2de511][_0x163959]);}}else if(_[_0xd01d('0x94')](_0x27ddc0[_0x2de511])){_0x27ddc0[_0x2de511]=this[_0xd01d('0x96')](_0x27ddc0[_0x2de511]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x12094f,_0x3d3a6a){for(var _0x2a5301 in _0x12094f){if(_0x12094f['hasOwnProperty'](_0x2a5301)){if(_[_0xd01d('0x98')](_0x12094f[_0x2a5301])){if(!_[_0xd01d('0x47')](_0x12094f[_0x2a5301])){this['saveRestApiResult'](_0x12094f[_0x2a5301],util[_0xd01d('0x2a')]('%s.%s',_0x3d3a6a,_0x2a5301));}}else if(_[_0xd01d('0x9a')](_0x12094f[_0x2a5301])){for(var _0x17dc9b=0x0;_0x17dc9b<_0x12094f[_0x2a5301][_0xd01d('0x99')];_0x17dc9b++){this[_0xd01d('0x9b')](_0x12094f[_0x2a5301][_0x17dc9b],util[_0xd01d('0x2a')](_0xd01d('0x9c'),_0x3d3a6a,_0x2a5301+'['+_0x17dc9b+']'));}}else{if(!_[_0xd01d('0x49')](_0x12094f[_0x2a5301])){this['channel'][_0xd01d('0x9d')](util[_0xd01d('0x2a')]('%s.%s',_0x3d3a6a,_0x2a5301),_0x12094f[_0x2a5301]);}}}}};AGIVertices['prototype'][_0xd01d('0x95')]=function(_0x2d6f7a){try{var _0x2f9b8d=JSON[_0xd01d('0x6e')](_0x2d6f7a);this[_0xd01d('0x97')](_0x2f9b8d);return JSON['stringify'](_0x2f9b8d);}catch(_0x15018a){return this[_0xd01d('0x96')](_0x2d6f7a);}};AGIVertices[_0xd01d('0x12')][_0xd01d('0x96')]=function(_0x2cc409){var _0x544110=_0x2cc409[_0xd01d('0x9e')]('{');for(var _0x5f14d6=0x1;_0x5f14d6<_0x544110[_0xd01d('0x99')];_0x5f14d6+=0x1){var _0x2caa7f=_0x544110[_0x5f14d6][_0xd01d('0x9e')]('}');if(_0x2caa7f['length']>0x1){_0x2cc409=_0x2cc409['replaceAll']('{'+_0x2caa7f[0x0]+'}',this[_0xd01d('0x37')][_0xd01d('0x13')](_0x2caa7f[0x0])[_0xd01d('0x9f')]||_0x2caa7f[0x0]);}}if(_0x544110[_0xd01d('0x99')]===0x1){return _0x2cc409['toString']();}return this[_0xd01d('0x96')](_0x2cc409);};AGIVertices[_0xd01d('0x12')]['getAndSetVariable']=function(_0x19aa9c,_0x3d2964){var _0x3ed355=this['channel'][_0xd01d('0x13')](_0x19aa9c);if(_0x3ed355[_0xd01d('0xa0')]===-0x1){return _0x3ed355;}logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xa1'),_0x3d2964,_0x3ed355[_0xd01d('0x9f')]));return this[_0xd01d('0x37')][_0xd01d('0x9d')](_0x3d2964,_0x3ed355[_0xd01d('0x9f')]);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x84')]=function(_0x24f973){return _0x24f973&&_0x24f973!=='0'&&_0x24f973!=='-1'&&_0x24f973!=='';};AGIVertices[_0xd01d('0x12')][_0xd01d('0xa2')]=function(_0x363905){this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x363905,'-');_0x363905[_0xd01d('0xa3')]=_0x363905[_0xd01d('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd01d('0x12')][_0xd01d('0xa4')]=function(_0x2351e7){logger[_0xd01d('0x30')](util['format'](_0xd01d('0xa5'),_0x2351e7[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x2351e7['text'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xa8'));}var _0x4e876b='\x22'+_0x2351e7[_0xd01d('0x60')]+'\x22';if(this[_0xd01d('0x84')](_0x2351e7[_0xd01d('0x79')])){_0x4e876b+=','+_0x2351e7[_0xd01d('0x79')];}var _0x21a0c3=this[_0xd01d('0x37')][_0xd01d('0x5b')]('MRCPSynth',_0x4e876b);if(_0x21a0c3['result']===-0x1){return _0x21a0c3;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xa9'),_0x4e876b));};AGIVertices['prototype'][_0xd01d('0xaa')]=function(_0x2f91ed){logger['info'](util[_0xd01d('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2f91ed['label']));if(!this[_0xd01d('0x84')](_0x2f91ed[_0xd01d('0xab')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xac'));}var _0x32723b=_0x2f91ed['grammar'];if(this[_0xd01d('0x84')](_0x2f91ed[_0xd01d('0x79')])){_0x32723b+=','+_0x2f91ed[_0xd01d('0x79')];}var _0x59c2f8=this['channel'][_0xd01d('0x5b')](_0xd01d('0xad'),_0x32723b);if(_0x59c2f8[_0xd01d('0xa0')]===-0x1){return _0x59c2f8;}var _0x1a6dcd=this[_0xd01d('0xae')](_0xd01d('0xaf'),_0xd01d('0xb0'));if(_0x1a6dcd['result']===-0x1){return _0x1a6dcd;}var _0x5e5499=this[_0xd01d('0xae')](_0xd01d('0xb1'),_0xd01d('0xb2'));if(_0x5e5499['result']===-0x1){return _0x5e5499;}var _0xdde0ee=this['getAndSetVariable'](_0xd01d('0xb3'),'MRCP_RECOG_INSTANCE');if(_0xdde0ee['result']===-0x1){return _0xdde0ee;}return this[_0xd01d('0x37')]['noop'](util['format'](_0xd01d('0xb4'),_0x32723b));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x9')]=function(_0xda8d7e){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xb5'),_0xda8d7e[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0x9')]([_0xda8d7e[_0xd01d('0xb6')],_0xda8d7e['args']]);};AGIVertices[_0xd01d('0x12')]['answer']=function(_0x13cec7){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x13cec7['label']));if(this[_0xd01d('0x84')](_0x13cec7[_0xd01d('0x69')])){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0xb7'),_0x13cec7[_0xd01d('0x69')]));var _0x4ac26=this[_0xd01d('0x37')][_0xd01d('0xb8')](_0x13cec7['timeout']);if(_0x4ac26[_0xd01d('0xa0')]===-0x1){return _0x4ac26;}}return this[_0xd01d('0x37')][_0xd01d('0xb9')]();};AGIVertices['prototype'][_0xd01d('0x4d')]=function(_0x516bab){logger[_0xd01d('0x30')](util['format']('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x516bab[_0xd01d('0xa6')]));if(!this['isConfigured'](_0x516bab[_0xd01d('0x4b')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x516bab,_0xd01d('0xba'));}_0x516bab['scheduledAt']=moment();if(this[_0xd01d('0x84')](_0x516bab[_0xd01d('0xbb')])){_0x516bab[_0xd01d('0x4c')]=moment()[_0xd01d('0xbc')](_0x516bab[_0xd01d('0xbb')],_0xd01d('0xbd'));}if(!this['isConfigured'](_0x516bab[_0xd01d('0xbe')])){_0x516bab['callback_priority']=0x2;}this[_0xd01d('0x45')][_0xd01d('0x70')](this,_0x516bab);return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xbf'),_0x516bab['phone'],_0x516bab[_0xd01d('0x4b')],_0x516bab[_0xd01d('0x4c')]));};AGIVertices[_0xd01d('0x12')][_0xd01d('0xc0')]=function(_0x97caf8){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xc1'),_0x97caf8[_0xd01d('0xa6')]));var _0x3921b6=this[_0xd01d('0x37')][_0xd01d('0x5b')](_0x97caf8['application'],_0x97caf8[_0xd01d('0x79')]);if(_0x3921b6['result']===-0x1){return _0x3921b6;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xc2'),_0x97caf8[_0xd01d('0xc3')],_0x97caf8['options']));};AGIVertices['prototype'][_0xd01d('0xc4')]=function(_0x20796e){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xc5'),_0x20796e[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x20796e['text'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xa8'));}var _0x4d15bf='\x22'+_0x20796e['text']+'\x22';if(this['isConfigured'](_0x20796e[_0xd01d('0x79')])){_0x4d15bf+=','+_0x20796e['options'];}var _0xc1f143=this['channel'][_0xd01d('0x5b')](_0xd01d('0xc6'),_0x4d15bf);if(_0xc1f143['result']===-0x1){return _0xc1f143;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util['format'](_0xd01d('0xa9'),_0x4d15bf));};AGIVertices[_0xd01d('0x12')][_0xd01d('0xc7')]=function(_0x16ec3f){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xc8'),_0x16ec3f[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x16ec3f['text'])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0xa8'));}var _0x5d244e='\x22'+_0x16ec3f[_0xd01d('0x60')]+'\x22';if(this[_0xd01d('0x84')](_0x16ec3f[_0xd01d('0x79')])){_0x5d244e+=','+_0x16ec3f['options'];}var _0x573139=this['channel']['exec'](_0xd01d('0xc6'),_0x5d244e);if(_0x573139[_0xd01d('0xa0')]===-0x1){return _0x573139;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5d244e));};AGIVertices['prototype']['lumenvoxasr']=function(_0x59a8fc){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x59a8fc['label']));if(!this['isConfigured'](_0x59a8fc[_0xd01d('0xab')])){return this[_0xd01d('0x37')]['noop']('no\x20grammar\x20configured');}var _0x5e6976=_0x59a8fc[_0xd01d('0xab')];if(this['isConfigured'](_0x59a8fc[_0xd01d('0x79')])){_0x5e6976+=','+_0x59a8fc[_0xd01d('0x79')];}var _0x301454=this['channel'][_0xd01d('0x5b')]('MRCPRecog',_0x5e6976);if(_0x301454[_0xd01d('0xa0')]===-0x1){return _0x301454;}var _0x4cec2e=this[_0xd01d('0xae')](_0xd01d('0xaf'),_0xd01d('0xc9'));if(_0x4cec2e[_0xd01d('0xa0')]===-0x1){return _0x4cec2e;}var _0x8ec026=this[_0xd01d('0xae')]('RECOG_INPUT()',_0xd01d('0xca'));if(_0x8ec026['result']===-0x1){return _0x8ec026;}var _0x25c852=this[_0xd01d('0xae')]('RECOG_INSTANCE()',_0xd01d('0xcb'));if(_0x25c852['result']===-0x1){return _0x25c852;}return this[_0xd01d('0x37')]['noop'](util[_0xd01d('0x2a')](_0xd01d('0xb4'),_0x5e6976));};AGIVertices[_0xd01d('0x12')][_0xd01d('0xcc')]=function(_0x96dce1){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xcd'),_0x96dce1[_0xd01d('0xa6')]));if(!this['isConfigured'](_0x96dce1[_0xd01d('0xab')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xac'));}var _0x506004=_0x96dce1[_0xd01d('0xab')];if(this[_0xd01d('0x84')](_0x96dce1[_0xd01d('0x79')])){_0x506004+=','+_0x96dce1['options'];}var _0x92d75b=this['channel']['exec']('MRCPRecog',_0x506004);if(_0x92d75b[_0xd01d('0xa0')]===-0x1){return _0x92d75b;}var _0x53485c=this[_0xd01d('0xae')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x53485c[_0xd01d('0xa0')]===-0x1){return _0x53485c;}var _0x2fc7b7=this[_0xd01d('0xae')](_0xd01d('0xb1'),'SESTEK_ASR_TRANSCRIPT');if(_0x2fc7b7[_0xd01d('0xa0')]===-0x1){return _0x2fc7b7;}var _0x4f048c=this[_0xd01d('0xae')](_0xd01d('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x4f048c[_0xd01d('0xa0')]===-0x1){return _0x4f048c;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x506004));};AGIVertices['prototype'][_0xd01d('0xce')]=function(_0x75afb5){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xcf'),_0x75afb5[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x75afb5[_0xd01d('0xd0')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x75afb5,_0xd01d('0xd1'));}var _0x444f8d=this['getSquareOdbc'][_0xd01d('0x70')](this,_0x75afb5[_0xd01d('0xd0')]);if(!_0x444f8d){return this[_0xd01d('0x37')]['error'](_0x75afb5,_0xd01d('0xd2'));}if(!this[_0xd01d('0x84')](_0x75afb5[_0xd01d('0x31')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x75afb5,_0xd01d('0xd3'));}var _0x58613a=_0x75afb5[_0xd01d('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xd4'),_0x58613a));var _0x4c7b95=this[_0xd01d('0x2c')][_0xd01d('0x70')](this,_0x444f8d,_0x58613a);this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x75afb5,_0x58613a);if(!this[_0xd01d('0x84')](_0x75afb5[_0xd01d('0xd5')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xd6'));}var _0x3b4785=this[_0xd01d('0x13')][_0xd01d('0x70')](this,_0x75afb5[_0xd01d('0xd5')]);if(!_0x3b4785){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x75afb5,_0xd01d('0xd7'));}var _0x150f31=this;_0x4c7b95[_0xd01d('0xd8')](function(_0x3bab6f,_0x5b5a2f){Object[_0xd01d('0xd9')](_0x3bab6f)[_0xd01d('0xd8')](function(_0x18a4b5){_0x150f31[_0xd01d('0x37')]['setVariable'](util['format'](_0xd01d('0xda'),_0x3b4785,_0x5b5a2f,_0x18a4b5),_0x3bab6f[_0x18a4b5]);});});this['channel'][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0xdb'),_0x3b4785),_0x4c7b95['length']);return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xdc'),_0x3b4785));};AGIVertices['prototype']['dial']=function(_0x175b15){logger[_0xd01d('0xdd')](util[_0xd01d('0x2a')](_0xd01d('0xde'),_0x175b15[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x175b15[_0xd01d('0xdf')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x175b15,_0xd01d('0xe0'));}var _0x1349a4=this[_0xd01d('0xe1')][_0xd01d('0x70')](this,_0x175b15[_0xd01d('0xdf')]);if(!_0x1349a4){return this['channel'][_0xd01d('0x2e')](_0x175b15,_0xd01d('0xe2'));}var _0x560bc0=this[_0xd01d('0x37')][_0xd01d('0x5b')](_0xd01d('0xe3'),[util[_0xd01d('0x2a')](_0xd01d('0xe4'),_0x1349a4),_0x175b15[_0xd01d('0x69')],_0x175b15[_0xd01d('0xe5')],_0x175b15[_0xd01d('0xe6')]]);if(_0x560bc0[_0xd01d('0xa0')]===-0x1){return _0x560bc0;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util['format']('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xd01d('0xe7')]=function(_0xed3dcd){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xed3dcd[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0xed3dcd['key'])){return this['channel']['noop'](_0xd01d('0xe8'));}if(!this[_0xd01d('0x84')](_0xed3dcd['text'])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0xa8'));}this[_0xd01d('0x37')]['bot']=!![];this[_0xd01d('0x36')](_0xed3dcd);this[_0xd01d('0x44')](_0xed3dcd['text'],'in');this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xe9'),_0xed3dcd['text']));var _0x2abbb0=this[_0xd01d('0x7a')][_0xd01d('0x70')](this,_0xed3dcd);if(_0x2abbb0){for(var _0x423a00 in _0x2abbb0){if(_0x2abbb0[_0xd01d('0x93')](_0x423a00)){this[_0xd01d('0x37')][_0xd01d('0x9d')](util['format'](_0xd01d('0xea'),_0x423a00[_0xd01d('0xeb')]()),_0x2abbb0[_0x423a00]);}}this[_0xd01d('0x44')](_0x2abbb0['speech'],_0xd01d('0xec'));return this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('Dialogflow\x20Result\x20%s',_0x2abbb0[_0xd01d('0xed')]));}return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0xed3dcd,_0xd01d('0xee'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0xef')]=function(_0x2c2960){logger['info'](util['format'](_0xd01d('0xf0'),_0x2c2960[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x2c2960[_0xd01d('0xf1')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xd01d('0x84')](_0x2c2960['username'])){return this['channel'][_0xd01d('0xa7')](_0xd01d('0xf2'));}if(!this[_0xd01d('0x84')](_0x2c2960[_0xd01d('0xf3')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xf4'));}if(!this[_0xd01d('0x84')](_0x2c2960['ndassistant_url'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xa8'));}this[_0xd01d('0x37')][_0xd01d('0xf5')]=!![];this[_0xd01d('0x36')](_0x2c2960);this[_0xd01d('0x44')](_0x2c2960[_0xd01d('0x60')],'in');this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('Trying\x20SestekNDA:\x20%s',_0x2c2960[_0xd01d('0x60')]));var _0x5aeba9=this[_0xd01d('0x7d')]['sync'](this,_0x2c2960);if(_0x5aeba9){for(var _0x18dc40 in _0x5aeba9){if(_0x5aeba9['hasOwnProperty'](_0x18dc40)){this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0xf6'),_0x18dc40['toUpperCase']()),_0x5aeba9[_0x18dc40]);}}this[_0xd01d('0x44')](_0x5aeba9[_0xd01d('0xed')],_0xd01d('0xec'));if(_0x5aeba9[_0xd01d('0xf7')]){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xf8'),_0x5aeba9[_0xd01d('0xf7')]));var _0x4fc1b4=this[_0xd01d('0x37')][_0xd01d('0xf9')](_0x5aeba9[_0xd01d('0xf7')]);try{fs[_0xd01d('0xfa')](_0x5aeba9['audiofile']+_0xd01d('0xfb'));}catch(_0x4ce5eb){logger[_0xd01d('0x2e')](_0x4ce5eb);}return _0x4fc1b4;}else{return this[_0xd01d('0x37')]['noop'](util[_0xd01d('0x2a')](_0xd01d('0xfc'),_0x5aeba9[_0xd01d('0xed')]));}}return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x2c2960,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0xd01d('0xfd')]=function(_0x50b8e3){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xfe'),_0x50b8e3[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0xfd'));};AGIVertices[_0xd01d('0x12')]['ext_dial']=function(_0x38945d){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0xff'),_0x38945d[_0xd01d('0xa6')]));var _0x469736='';if(_0x38945d[_0xd01d('0x100')]){if(!this[_0xd01d('0x84')](_0x38945d[_0xd01d('0x100')])){return this[_0xd01d('0x37')]['error'](_0x38945d,'no\x20trunk\x20selected');}else{var _0x309afc=parseInt(_0x38945d[_0xd01d('0x100')],0xa);if(isNaN(_0x309afc)){_0x469736=_0x38945d['trunk_id'];}else{_0x469736=this[_0xd01d('0x1e')][_0xd01d('0x70')](this,_0x38945d[_0xd01d('0x100')]);if(!_0x469736){return this['channel'][_0xd01d('0x2e')](_0x38945d,_0xd01d('0x101'));}}}}else if(_0x38945d[_0xd01d('0x102')]){_0x469736=_0x38945d[_0xd01d('0x102')];}else{return this[_0xd01d('0x37')]['error'](_0x38945d,'no\x20trunk\x20selected');}var _0x78060a=this[_0xd01d('0x37')]['exec'](_0xd01d('0xe3'),[util[_0xd01d('0x2a')](_0xd01d('0x103'),_0x469736,_0x38945d[_0xd01d('0x4a')]),_0x38945d['timeout'],_0x38945d[_0xd01d('0xe5')],_0x38945d['url']]);if(_0x78060a['result']===-0x1){return _0x78060a;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x104'),_0xd01d('0xe3')));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x105')]=function(_0x182986){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x106'),_0x182986[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x105'));};AGIVertices['prototype'][_0xd01d('0x107')]=function(_0x41a870){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x108'),_0x41a870[_0xd01d('0xa6')]));if(_0x41a870['retry']===0x0){return this['maxRetry'](_0x41a870);}_0x41a870[_0xd01d('0xa3')]-=0x1;if(!this[_0xd01d('0x84')](_0x41a870[_0xd01d('0x109')])){return this['channel'][_0xd01d('0x2e')](_0x41a870,'no\x20file\x20audio\x20selected');}var _0x448cd6=this[_0xd01d('0x20')][_0xd01d('0x70')](this,_0x41a870[_0xd01d('0x109')]);if(!_0x448cd6){return this[_0xd01d('0x37')]['error'](_0x41a870,_0xd01d('0x10a'));}if(!this[_0xd01d('0x84')](_0x41a870[_0xd01d('0xd5')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2a682a=this[_0xd01d('0x37')][_0xd01d('0x10b')](_0x448cd6,_0x41a870[_0xd01d('0x10c')],_0x41a870[_0xd01d('0x10d')]);var _0x45cd2c=_0x2a682a[_0xd01d('0xa0')]?_0x2a682a[_0xd01d('0xa0')][_0xd01d('0x4f')]():'';logger[_0xd01d('0x30')](_0xd01d('0x10e'),JSON[_0xd01d('0x74')](_0x2a682a));if(_0x2a682a['result']===-0x1){this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x41a870,_0x45cd2c);return _0x2a682a;}else if(_0x2a682a['extra']===_0xd01d('0x69')){_0x2a682a[_0xd01d('0xa0')]=_0x45cd2c['length']>=parseInt(_0x41a870[_0xd01d('0x10f')])?'x':'i';}else{_0x2a682a[_0xd01d('0xa0')]=_0x45cd2c[_0xd01d('0x99')]>=parseInt(_0x41a870['mindigit'])&&_0x45cd2c[_0xd01d('0x99')]<=parseInt(_0x41a870[_0xd01d('0x10d')])?'x':'i';}var _0x5ef5ab=this[_0xd01d('0x13')][_0xd01d('0x70')](this,_0x41a870['variable_id']);if(!_0x5ef5ab){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x41a870,_0xd01d('0xd7'));}this['channel'][_0xd01d('0x9d')](_0x5ef5ab,_0x45cd2c);if(this[_0xd01d('0x84')](_0x41a870[_0xd01d('0x110')])){var _0x17da0c=parseInt(_0x41a870[_0xd01d('0x110')],0xa);var _0x2919ae=rs[_0xd01d('0x111')]({'charset':'*','length':_0x17da0c});var _0xa2c06d=_0x45cd2c[_0xd01d('0x99')];if(_0xa2c06d>0x0){if(_0xa2c06d>_0x17da0c){this['createSquareDetailsReport']['sync'](this,_0x41a870,_0x41a870['hiddendigitspos']==='first'?_0x2919ae+_0x45cd2c[_0xd01d('0x112')](_0x17da0c):_0x45cd2c['substr'](0x0,_0xa2c06d-_0x17da0c)+_0x2919ae);}else{this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x41a870,rs['generate']({'charset':'*','length':_0xa2c06d}));}}else{this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x41a870,'');}}else{this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x41a870,_0x45cd2c);}return _0x2a682a;};AGIVertices[_0xd01d('0x12')][_0xd01d('0x113')]=function(_0x13853e){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x13853e[_0xd01d('0xa6')]));return this['getdigits'](_0x13853e);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x114')]=function(_0x17eafc){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x115'),_0x17eafc['label']));this['createSquareDetailsReport']['sync'](this,_0x17eafc,_0x17eafc[_0xd01d('0x116')]);return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x117'),_0x17eafc[_0xd01d('0x116')]));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x118')]=function(_0x365dba){logger['info'](util[_0xd01d('0x2a')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x365dba[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x365dba[_0xd01d('0x87')])||!this[_0xd01d('0x84')](_0x365dba['aws_secret_access_key'])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0x119'));}if(!this[_0xd01d('0x84')](_0x365dba['text'])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0xa8'));}this[_0xd01d('0x37')]['noop'](util[_0xd01d('0x2a')](_0xd01d('0x11a'),_0x365dba[_0xd01d('0x60')]));var _0x4ed6f4=this[_0xd01d('0x86')][_0xd01d('0x70')](this,_0x365dba);if(_0x4ed6f4){this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x11b'),_0x4ed6f4));var _0x7b5482=this[_0xd01d('0x37')][_0xd01d('0xf9')](_0x4ed6f4);try{fs['unlink'](_0x4ed6f4+_0xd01d('0xfb'));}catch(_0x293317){logger[_0xd01d('0x2e')](_0x293317);}return _0x7b5482;}return this['channel'][_0xd01d('0x2e')](_0x365dba,_0xd01d('0x11c'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x11d')]=function(_0x4ca33d){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x11e'),_0x4ca33d[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x4ca33d['aws_access_key_id'])||!this[_0xd01d('0x84')](_0x4ca33d['aws_secret_access_key'])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0x119'));}if(!this['isConfigured'](_0x4ca33d[_0xd01d('0x8b')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x11f'));}if(!this[_0xd01d('0x84')](_0x4ca33d['text'])){return this[_0xd01d('0x37')]['noop']('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xd01d('0x36')](_0x4ca33d);this[_0xd01d('0x44')](_0x4ca33d[_0xd01d('0x60')],'in');this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x120'),_0x4ca33d[_0xd01d('0x60')]));var _0x275574=this[_0xd01d('0x8a')][_0xd01d('0x70')](this,_0x4ca33d);if(_0x275574){for(var _0x1fc8d6 in _0x275574){if(_0x275574[_0xd01d('0x93')](_0x1fc8d6)&&_[_0xd01d('0x94')](_0x275574[_0x1fc8d6])){this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0x121'),_0x1fc8d6[_0xd01d('0xeb')]()),_0x275574[_0x1fc8d6]);}}if(_[_0xd01d('0x49')](_0x275574['message'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x122'));}else{this['createSquareMessage'](_0x275574[_0xd01d('0x77')],_0xd01d('0xec'));return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x123'),_0x275574[_0xd01d('0x77')]));}}return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x4ca33d,_0xd01d('0x124'));};AGIVertices['prototype'][_0xd01d('0x125')]=function(_0xbd0850){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x126'),_0xbd0850[_0xd01d('0xa6')],_0xbd0850[_0xd01d('0x69')]));if(!this[_0xd01d('0x84')](_0xbd0850['key'])){return this['channel']['noop'](_0xd01d('0xe8'));}var _0x50c1d0=_0xd01d('0x127');var _0x3a432d=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd01d('0x111')](0x4));var _0x501696=util[_0xd01d('0x2a')]('%s.%s',_0x3a432d,_0x50c1d0);var _0x3ff6df=!![];if(_0xbd0850[_0xd01d('0x128')]==='NOBEEP'){_0x3ff6df=![];}var _0x211391=this[_0xd01d('0x37')][_0xd01d('0x129')](_0x3a432d,_0x50c1d0,_0xbd0850['intKey'],_0xbd0850[_0xd01d('0x69')],undefined,_0x3ff6df);if(_0x211391['result']!==-0x1){this[_0xd01d('0x37')]['noop'](util['format']('google\x20%s\x20file\x20created',_0x501696));var _0x18a5c4=this[_0xd01d('0x8c')][_0xd01d('0x70')](this,_0xbd0850,_0x501696);if(_0x18a5c4){for(var _0x161d3a in _0x18a5c4){if(_0x18a5c4[_0xd01d('0x93')](_0x161d3a)){this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')]('GOOGLE_ASR_%s',_0x161d3a[_0xd01d('0xeb')]()),_0x18a5c4[_0x161d3a]);}}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x12a'),JSON['stringify'](_0x18a5c4)));}}return _0x211391;};AGIVertices['prototype'][_0xd01d('0x12b')]=function(_0x2bfede){logger['info'](util[_0xd01d('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2bfede[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x2bfede['appid'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x12c'));}if(!this['isConfigured'](_0x2bfede[_0xd01d('0x12d')])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0x12e'));}var _0x38567c='wav';var _0x191b57=util['format'](_0xd01d('0x12f'),FILES_PATH,rs[_0xd01d('0x111')](0x4));var _0x1f2636=util[_0xd01d('0x2a')](_0xd01d('0x9c'),_0x191b57,_0x38567c);var _0xcd9230=!![];if(_0x2bfede['beep']==='NOBEEP'){_0xcd9230=![];}var _0x344340=this[_0xd01d('0x37')][_0xd01d('0x129')](_0x191b57,_0x38567c,_0x2bfede[_0xd01d('0x130')],_0x2bfede['timeout'],undefined,_0xcd9230);if(_0x344340[_0xd01d('0xa0')]!==-0x1){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x131'),_0x1f2636));var _0x14935b=this['tildeASR']['sync'](this,_0x2bfede,_0x1f2636);if(_0x14935b){for(var _0x47d674 in _0x14935b){if(_0x14935b[_0xd01d('0x93')](_0x47d674)){this[_0xd01d('0x37')]['setVariable'](util[_0xd01d('0x2a')](_0xd01d('0x132'),_0x47d674[_0xd01d('0xeb')]()),_0x14935b[_0x47d674]);}}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x133'),JSON[_0xd01d('0x74')](_0x14935b)));}}return _0x344340;};AGIVertices[_0xd01d('0x12')][_0xd01d('0x134')]=function(_0x27e326){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x135'),_0x27e326[_0xd01d('0xa6')]));return this['channel']['continueAt'](_0x27e326[_0xd01d('0x3d')],_0x27e326[_0xd01d('0x3e')],_0x27e326[_0xd01d('0x3f')]);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x136')]=function(_0x42369f){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x137'),_0x42369f[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x42369f[_0xd01d('0x138')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x42369f,_0xd01d('0x139'));}try{var _0x126e05=eval(_0x42369f['condition'])?_0xd01d('0x13a'):_0xd01d('0x13b');this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x13c'),_0x42369f[_0xd01d('0x138')],_0x126e05));return{'code':0xc8,'result':_0x126e05};}catch(_0x2eb508){return{'code':0xc8,'result':_0xd01d('0x13b')};}};AGIVertices[_0xd01d('0x12')][_0xd01d('0x13d')]=function(_0xe4a18d){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x13e'),_0xe4a18d[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0xe4a18d[_0xd01d('0x13f')])){return this[_0xd01d('0x37')]['error'](_0xe4a18d,_0xd01d('0x140'));}var _0x32a534=this[_0xd01d('0x24')][_0xd01d('0x70')](this,_0xe4a18d[_0xd01d('0x13f')]);if(!_0x32a534){return this['channel'][_0xd01d('0x2e')](_0xe4a18d,_0xd01d('0x141'));}for(var _0x53578a=0x0;_0x53578a<_0x32a534['length'];_0x53578a+=0x1){var _0x5ca950=this[_0xd01d('0x37')][_0xd01d('0x13')](util[_0xd01d('0x2a')](_0xd01d('0x142'),_0x32a534[_0x53578a]));if(_0x5ca950['result']===-0x1){return _0x5ca950;}logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x143'),_0x32a534[_0x53578a],_0x5ca950['extra']));if(_0x5ca950[_0xd01d('0x9f')]===_0xd01d('0x13a')){logger[_0xd01d('0x30')](util['format']('IFTIME\x20%s\x20%s',_0x32a534[_0x53578a],_0xd01d('0x13a')));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x143'),_0x32a534[_0x53578a],_0xd01d('0x13a')));return{'code':0xc8,'result':'true'};}else{logger[_0xd01d('0x30')](util['format'](_0xd01d('0x143'),_0x32a534[_0x53578a],_0xd01d('0x13b')));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x143'),_0x32a534[_0x53578a],_0xd01d('0x13b')));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0xd01d('0x144')]=function(_0x3df6ac){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3df6ac[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0x144')]();};AGIVertices[_0xd01d('0x12')]['ispeechasr']=function(_0x560c32){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x145'),_0x560c32[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x560c32['key'])){return this[_0xd01d('0x37')][_0xd01d('0xa7')]('no\x20key\x20configured');}var _0x4e424f=_0xd01d('0x127');var _0x1ea69f=util[_0xd01d('0x2a')](_0xd01d('0x12f'),FILES_PATH,rs[_0xd01d('0x111')](0x4));var _0x1a3324=util[_0xd01d('0x2a')](_0xd01d('0x9c'),_0x1ea69f,_0x4e424f);var _0x512eaf=!![];if(_0x560c32[_0xd01d('0x128')]===_0xd01d('0x146')){_0x512eaf=![];}var _0x2eca31=this[_0xd01d('0x37')][_0xd01d('0x129')](_0x1ea69f,_0x4e424f,_0x560c32[_0xd01d('0x130')],_0x560c32[_0xd01d('0x69')],undefined,_0x512eaf);if(_0x2eca31['result']!==-0x1){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('ispeech\x20%s\x20file\x20created',_0x1a3324));var _0x3bb072=this[_0xd01d('0x81')]['sync'](this,_0x560c32,_0x1a3324);if(_0x3bb072){for(var _0x34cd5e in _0x3bb072){if(_0x3bb072['hasOwnProperty'](_0x34cd5e)){this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0x147'),_0x34cd5e['toUpperCase']()),_0x3bb072[_0x34cd5e]);}}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x148'),JSON[_0xd01d('0x74')](_0x3bb072)));}}return _0x2eca31;};AGIVertices['prototype']['ispeechtts']=function(_0x17a403){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x149'),_0x17a403[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x17a403['key'])){return this['channel'][_0xd01d('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x17a403[_0xd01d('0x60')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xd01d('0x37')]['noop'](util[_0xd01d('0x2a')](_0xd01d('0x14a'),_0x17a403['text']));var _0x3adab5=this[_0xd01d('0x7e')][_0xd01d('0x70')](this,_0x17a403);if(_0x3adab5){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('ispeech\x20%s\x20file\x20created',_0x3adab5));var _0x3bf002=this[_0xd01d('0x37')][_0xd01d('0xf9')](_0x3adab5,_0x17a403[_0xd01d('0x130')]);try{fs[_0xd01d('0xfa')](_0x3adab5+_0xd01d('0xfb'));}catch(_0x34f087){logger[_0xd01d('0x2e')](_0x34f087);}return _0x3bf002;}return this['channel']['error'](_0x17a403,_0xd01d('0x14b'));};AGIVertices['prototype'][_0xd01d('0x14c')]=function(_0x2682b9){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x14d'),_0x2682b9[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x2682b9[_0xd01d('0x14e')])){return this['channel'][_0xd01d('0x2e')](_0x2682b9,_0xd01d('0x14f'));}logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x150'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x2682b9[_0xd01d('0x14e')]));var _0x282c39=this['agentLogin'][_0xd01d('0x70')](this,_0x2682b9[_0xd01d('0x14e')]);if(_0x282c39){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x151'),this['channel']['callerid'],_0x2682b9[_0xd01d('0x14e')]));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x2682b9[_0xd01d('0x14e')]));return{'code':0xc8,'result':_0xd01d('0x152')};}else{logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x153'),this['channel'][_0xd01d('0x3a')],_0x2682b9[_0xd01d('0x14e')]));this['channel'][_0xd01d('0xa7')](util['format'](_0xd01d('0x153'),this[_0xd01d('0x37')]['callerid'],_0x2682b9[_0xd01d('0x14e')]));return{'code':0xc8,'result':_0xd01d('0x154')};}};AGIVertices[_0xd01d('0x12')][_0xd01d('0x155')]=function(_0x1bc3fe){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x156'),_0x1bc3fe[_0xd01d('0xa6')]));if(!this['isConfigured'](_0x1bc3fe['findBy'])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x1bc3fe,_0xd01d('0x14f'));}logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x150'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x1bc3fe[_0xd01d('0x14e')]));var _0x59bf7f=this['agentLogout'][_0xd01d('0x70')](this,_0x1bc3fe[_0xd01d('0x14e')]);if(_0x59bf7f){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x151'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x1bc3fe[_0xd01d('0x14e')]));this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x151'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x1bc3fe[_0xd01d('0x14e')]));return{'code':0xc8,'result':_0xd01d('0x152')};}else{logger[_0xd01d('0x30')](util['format'](_0xd01d('0x153'),this[_0xd01d('0x37')]['callerid'],_0x1bc3fe[_0xd01d('0x14e')]));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x153'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x1bc3fe[_0xd01d('0x14e')]));return{'code':0xc8,'result':_0xd01d('0x154')};}};AGIVertices[_0xd01d('0x12')]['math']=function(_0x7dfbb6){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x157'),_0x7dfbb6[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x7dfbb6[_0xd01d('0x158')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x7dfbb6,'no\x20operation\x20configured');}this['channel']['noop'](util['format'](_0xd01d('0x159'),_0x7dfbb6[_0xd01d('0x158')]));var _0x209d04=eval(_0x7dfbb6['operation']);if(!this[_0xd01d('0x84')](_0x7dfbb6[_0xd01d('0xd5')])){return this[_0xd01d('0x37')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3bf298=this[_0xd01d('0x13')]['sync'](this,_0x7dfbb6[_0xd01d('0xd5')]);if(!_0x3bf298){return this['channel'][_0xd01d('0x2e')](_0x7dfbb6,_0xd01d('0xd7'));}if(_['isArray'](_0x209d04)){var _0x4f4150=this;_0x209d04['forEach'](function(_0x302dc7,_0x2c5c37){_0x4f4150['channel'][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0x15a'),_0x3bf298,_0x2c5c37),_0x302dc7);});return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x15b'),_0x3bf298));}else{return this[_0xd01d('0x37')]['setVariable'](_0x3bf298,_0x209d04);}};AGIVertices[_0xd01d('0x12')][_0xd01d('0xf')]=function(_0x5d83b6){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5d83b6[_0xd01d('0xa6')]));if(_0x5d83b6[_0xd01d('0xa3')]===0x0){return this['maxRetry'](_0x5d83b6);}_0x5d83b6[_0xd01d('0xa3')]-=0x1;if(!this['isConfigured'](_0x5d83b6[_0xd01d('0x109')])){return this[_0xd01d('0x37')]['error'](_0x5d83b6,_0xd01d('0x15c'));}var _0x162255=this[_0xd01d('0x20')][_0xd01d('0x70')](this,_0x5d83b6[_0xd01d('0x109')]);if(!_0x162255){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x5d83b6,_0xd01d('0x10a'));}var _0x51e9c7=this[_0xd01d('0x37')][_0xd01d('0x10b')](_0x162255,_0x5d83b6['response'],_0x5d83b6[_0xd01d('0x15d')]);var _0x4fb6f0=_0x51e9c7[_0xd01d('0xa0')];if(_0x51e9c7[_0xd01d('0xa0')]===-0x1){this['createSquareDetailsReport'][_0xd01d('0x70')](this,_0x5d83b6,'-1');return _0x51e9c7;}else if(_0x51e9c7[_0xd01d('0x9f')]===_0xd01d('0x69')){_0x51e9c7[_0xd01d('0xa0')]=_0x51e9c7[_0xd01d('0xa0')]['length']>0x0?_0x51e9c7[_0xd01d('0xa0')]:'t';}else if(_[_0xd01d('0x47')](_0x51e9c7[_0xd01d('0xa0')])){_0x51e9c7[_0xd01d('0xa0')]='#';_0x4fb6f0='#';}if(!this['isConfigured'](_0x5d83b6['variable_id'])){this['channel'][_0xd01d('0xa7')](_0xd01d('0xd6'));}else{var _0x5421bf=this['getVariable'][_0xd01d('0x70')](this,_0x5d83b6[_0xd01d('0xd5')]);if(!_0x5421bf){return this['channel'][_0xd01d('0x2e')](_0x5d83b6,_0xd01d('0xd7'));}this[_0xd01d('0x37')]['setVariable'](_0x5421bf,_0x4fb6f0);}this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x5d83b6,_0x4fb6f0);return _0x51e9c7;};AGIVertices[_0xd01d('0x12')]['noop']=function(_0x25f826){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x15e'),_0x25f826[_0xd01d('0xa6')]));return this['channel'][_0xd01d('0xa7')](_0x25f826[_0xd01d('0x15f')]||_0x25f826[_0xd01d('0xa6')]);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x160')]=function(_0x5a5890){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x161'),_0x5a5890['label']));if(!this['isConfigured'](_0x5a5890['findBy'])){return this['channel'][_0xd01d('0x2e')](_0x5a5890,_0xd01d('0x14f'));}logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x150'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x5a5890[_0xd01d('0x14e')]));var _0x27efe6=this[_0xd01d('0x50')]['sync'](this,_0x5a5890['pause_id']);var _0x4f5c58=this[_0xd01d('0x52')][_0xd01d('0x70')](this,_0x5a5890['findBy'],_0x27efe6);if(_0x4f5c58){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x151'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x5a5890[_0xd01d('0x14e')]));this[_0xd01d('0x37')][_0xd01d('0xa7')](util['format'](_0xd01d('0x151'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x5a5890[_0xd01d('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd01d('0x30')](util['format'](_0xd01d('0x153'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x5a5890['findBy']));this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x5a5890[_0xd01d('0x14e')]));return{'code':0xc8,'result':_0xd01d('0x154')};}};AGIVertices[_0xd01d('0x12')][_0xd01d('0x162')]=function(_0x5bd327){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x163'),_0x5bd327[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x5bd327[_0xd01d('0x109')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x5bd327,_0xd01d('0x15c'));}var _0x14f7ff=this['getSound']['sync'](this,_0x5bd327[_0xd01d('0x109')]);if(!_0x14f7ff){return this[_0xd01d('0x37')]['error'](_0x5bd327,'no\x20file\x20audio\x20found');}var _0xc0a2e0=this[_0xd01d('0x37')][_0xd01d('0x5b')](_0xd01d('0x164'),[_0x14f7ff,_0x5bd327[_0xd01d('0xe5')]]);if(_0xc0a2e0['result']===-0x1){return _0xc0a2e0;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xc2'),_0xd01d('0x164'),_0x14f7ff));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x165')]=function(_0x40cc29){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x166'),_0x40cc29[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x40cc29[_0xd01d('0x167')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x40cc29,'no\x20queue\x20selected');}var _0x721fdb='';var _0x51c3a3=parseInt(_0x40cc29[_0xd01d('0x167')],0xa);if(isNaN(_0x51c3a3)){_0x721fdb=_0x40cc29[_0xd01d('0x167')];}else{_0x721fdb=this[_0xd01d('0x16')][_0xd01d('0x70')](this,_0x40cc29[_0xd01d('0x167')]);if(!_0x721fdb){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x40cc29,'no\x20queue\x20found');}}var _0x5863c2='';if(this[_0xd01d('0x84')](_0x40cc29[_0xd01d('0x109')])){var _0x232924=this['getSound'][_0xd01d('0x70')](this,_0x40cc29[_0xd01d('0x109')]);if(_0x232924){_0x5863c2=_0x232924;}}this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x40cc29,_0x721fdb);if(_0x40cc29['opts'][_0xd01d('0x168')]('x')<0x0){_0x40cc29[_0xd01d('0xe5')]+='x';}if(_0x40cc29[_0xd01d('0xe5')]['indexOf']('X')<0x0){_0x40cc29['opts']+='X';}this[_0xd01d('0x37')]['setVariable'](_0xd01d('0x169'),_0x721fdb?_0x721fdb[_0xd01d('0x16a')]():'');var _0x3dd60b=this[_0xd01d('0x37')][_0xd01d('0x5b')](_0xd01d('0x16b'),[_0x721fdb,_0x40cc29[_0xd01d('0xe5')],_0x40cc29[_0xd01d('0xe6')],_0x5863c2,_0x40cc29[_0xd01d('0x69')],_0x40cc29[_0xd01d('0x9')],_0x40cc29[_0xd01d('0x16c')],_0x40cc29[_0xd01d('0x16d')],'',_0x40cc29[_0xd01d('0x16e')]]);if(_0x3dd60b['result']===-0x1){return _0x3dd60b;}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x721fdb));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x16f')]=function(_0x2d9bd2){logger[_0xd01d('0x30')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2d9bd2['label']));var _0x211af6=_0x2d9bd2[_0xd01d('0x170')]||_0xd01d('0x127');var _0x24516a=util['format'](_0xd01d('0x171'),this[_0xd01d('0x37')][_0xd01d('0x38')],rs[_0xd01d('0x111')](0x5));var _0xa50271=util['format'](_0xd01d('0x172'),FILES_PATH,_0x24516a,_0x211af6);var _0x1f5b27=util[_0xd01d('0x2a')](_0xd01d('0x12f'),FILES_PATH,_0x24516a);this[_0xd01d('0x3b')][_0xd01d('0x70')](this,_0x2d9bd2,_0x24516a,_0xa50271);this[_0xd01d('0x37')][_0xd01d('0x9d')](_0xd01d('0x173'),_0x24516a);logger[_0xd01d('0x30')](_0xd01d('0x174'),_0x1f5b27,_0x211af6,_0x2d9bd2['escape_digits'],_0x2d9bd2['timeout']);return this[_0xd01d('0x37')][_0xd01d('0x129')](_0x1f5b27,_0x211af6,_0x2d9bd2[_0xd01d('0x175')],_0x2d9bd2[_0xd01d('0x69')],undefined,!![]);};AGIVertices['prototype'][_0xd01d('0x176')]=function(_0x18894f){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x177'),_0x18894f[_0xd01d('0xa6')]));if(!this['isConfigured'](_0x18894f[_0xd01d('0xe6')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x178'));}var _0x25bbd2=this['restAPI'][_0xd01d('0x70')](this,_0x18894f);logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x179'),util[_0xd01d('0x17a')](_0x25bbd2,{'showHidden':![],'depth':null})));if(!this[_0xd01d('0x84')](_0x18894f[_0xd01d('0xd5')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x17b'));}var _0x19a829=this['getVariable'][_0xd01d('0x70')](this,_0x18894f[_0xd01d('0xd5')]);if(!_0x19a829){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x18894f,_0xd01d('0xd7'));}this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')]('%s_STATUS_CODE',_0x19a829),_0x25bbd2[_0xd01d('0x76')]?_0x25bbd2[_0xd01d('0x76')]:_0xd01d('0x17c'));this[_0xd01d('0x37')][_0xd01d('0x9d')](util[_0xd01d('0x2a')](_0xd01d('0x17d'),_0x19a829),_0x25bbd2[_0xd01d('0x17e')]?_0x25bbd2['statusMessage']:'OK');if(_0x25bbd2['body']){try{this[_0xd01d('0x9b')](_0x25bbd2[_0xd01d('0x6d')],_0x19a829);}catch(_0x160368){logger[_0xd01d('0x2e')](util[_0xd01d('0x2a')](_0xd01d('0x17f'),_0x19a829));}}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xdc'),_0x19a829));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x180')]=function(_0x1f9fb0){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x181'),_0x1f9fb0[_0xd01d('0xa6')]));return this[_0xd01d('0x37')]['sayDigits'](_0x1f9fb0['digits'][_0xd01d('0x5c')](/\s+/g,''),_0x1f9fb0[_0xd01d('0x175')]);};AGIVertices[_0xd01d('0x12')]['saynumber']=function(_0x3c7e14){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x182'),_0x3c7e14[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0x183')](_0x3c7e14['number']['replace'](/\s+/g,''),_0x3c7e14[_0xd01d('0x175')]);};AGIVertices['prototype'][_0xd01d('0x184')]=function(_0x340f13){logger['info'](util['format']('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x340f13[_0xd01d('0xa6')]));return this[_0xd01d('0x37')][_0xd01d('0x185')](_0x340f13['text'],_0x340f13['escape_digits']);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x186')]=function(_0x255105){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x187'),_0x255105[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x255105[_0xd01d('0x188')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x189'));}var _0x29d4c1=this[_0xd01d('0x22')]['sync'](this,_0x255105[_0xd01d('0x188')]);if(!_0x29d4c1||!_0x29d4c1[_0xd01d('0x18a')]){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x255105,_0xd01d('0x18b'));}var _0x3ad270={'from':util[_0xd01d('0x2a')](_0xd01d('0x18c'),_0x29d4c1[_0xd01d('0x18')],_0x29d4c1[_0xd01d('0x18d')]||_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x18e')]),'to':_0x255105['to']||'','cc':_0x255105['cc']||'','bcc':_0x255105['bcc']||'','subject':_0x255105[_0xd01d('0x18f')],'html':_0x255105['text'],'text':_0x255105[_0xd01d('0x60')]};var _0x4c2889={'tls':{'rejectUnauthorized':![]}};if(_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x190')]){_0x4c2889[_0xd01d('0x190')]=_0x29d4c1[_0xd01d('0x18a')]['service'];}else{_0x4c2889[_0xd01d('0x191')]=_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x191')];_0x4c2889[_0xd01d('0x192')]=_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x192')];_0x4c2889[_0xd01d('0x193')]=_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x193')];}if(_0x29d4c1['Smtp']['authentication']){_0x4c2889[_0xd01d('0x194')]={'user':_0x29d4c1['Smtp'][_0xd01d('0x18e')],'pass':_0x29d4c1[_0xd01d('0x18a')][_0xd01d('0x195')]};}if(this[_0xd01d('0x84')](_0x255105[_0xd01d('0x196')])){}logger[_0xd01d('0xdd')](_0xd01d('0x197'),JSON[_0xd01d('0x74')](_0x3ad270));this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x255105,_0x255105[_0xd01d('0x188')]);this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x198'),_0x29d4c1[_0xd01d('0x18')]));this[_0xd01d('0x23')][_0xd01d('0x70')](this,_0x4c2889,_0x3ad270);return this[_0xd01d('0x37')]['noop'](_0xd01d('0x199'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x19a')]=function(_0x14d68e){logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x19b'),_0x14d68e[_0xd01d('0xa6')]));return this['channel'][_0xd01d('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xd01d('0x19c')]=function(_0x3eafeb){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x19d'),_0x3eafeb[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x3eafeb[_0xd01d('0x19e')])){return this[_0xd01d('0x37')][_0xd01d('0xa7')](_0xd01d('0x19f'));}var _0x4ce819=this[_0xd01d('0x1a0')]['sync'](this,_0x3eafeb[_0xd01d('0x19e')]);if(!_0x4ce819){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x3eafeb,'no\x20sms\x20account\x20found');}var _0x58a98a={'body':_0x3eafeb[_0xd01d('0x1a1')],'phone':_0x3eafeb['to']||'','SmsAccountId':_0x4ce819['id']};logger[_0xd01d('0xdd')]('sendSMS\x20message',JSON[_0xd01d('0x74')](_0x58a98a));this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x3eafeb,_0x3eafeb[_0xd01d('0x19e')]);this['channel'][_0xd01d('0xa7')](util['format'](_0xd01d('0x1a2'),_0x4ce819['name']));this[_0xd01d('0x1a3')]['sync'](this,_0x58a98a);return this['channel']['noop'](_0xd01d('0x1a4'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1a5')]=function(_0x1f340d){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x1a6'),_0x1f340d[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x1f340d[_0xd01d('0xd5')])){return this['channel'][_0xd01d('0x2e')](_0x1f340d,'no\x20variable\x20selected');}var _0x41675a=this[_0xd01d('0x13')][_0xd01d('0x70')](this,_0x1f340d[_0xd01d('0xd5')]);if(!_0x41675a){return this[_0xd01d('0x37')]['error'](_0x1f340d,_0xd01d('0xd7'));}return this[_0xd01d('0x37')][_0xd01d('0x9d')](_0x41675a,_0x1f340d[_0xd01d('0x1a7')]);};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1a8')]=function(_0x48752c){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x1a9'),_0x48752c[_0xd01d('0xa6')]));this['channel'][_0xd01d('0xa7')](_0xd01d('0x1aa'));if(_0x48752c[_0xd01d('0xb9')]===_0xd01d('0x1ab')){this['channel'][_0xd01d('0xa7')]('Answer');return this[_0xd01d('0x37')]['answer']();}return this[_0xd01d('0x37')]['noop'](_0xd01d('0x1ac'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1ad')]=function(_0x4b0912){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4b0912[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x4b0912[_0xd01d('0x1ae')])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x4b0912,_0xd01d('0x1af'));}var _0x218c6c=this['getSquareProject'][_0xd01d('0x70')](this,_0x4b0912[_0xd01d('0x1ae')]);if(!this[_0xd01d('0x84')](_0x218c6c)){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x4b0912,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4b0912[_0xd01d('0x1ae')]));}if(_0x218c6c===this[_0xd01d('0x37')][_0xd01d('0x42')]){return this['channel'][_0xd01d('0x2e')](_0x4b0912,_0xd01d('0x1b0'));}this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x4b0912,_0x218c6c);var _0x26b718=this[_0xd01d('0x37')][_0xd01d('0x5b')]('AGI',util['format'](_0xd01d('0x1b1'),config[_0xd01d('0x9')]['host']||_0xd01d('0x1b2'),_0x218c6c,this[_0xd01d('0x37')][_0xd01d('0x42')]));if(_0x26b718[_0xd01d('0xa0')]===-0x1){return _0x26b718;}return this['channel'][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0xc2'),_0xd01d('0x1b3'),_0x218c6c));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1b4')]=function(_0x237f99){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x1b5'),_0x237f99[_0xd01d('0xa6')]));var _0x5c1763=this['shellCommand'][_0xd01d('0x70')](this,_0x237f99[_0xd01d('0xb6')]);this[_0xd01d('0x36')][_0xd01d('0x70')](this,_0x237f99,_0x237f99[_0xd01d('0xb6')]);if(this[_0xd01d('0x84')](_0x237f99[_0xd01d('0xd5')])){var _0x1d5941=this['getVariable'][_0xd01d('0x70')](this,_0x237f99['variable_id']);if(_0x1d5941){this[_0xd01d('0x37')]['setVariable'](_0x1d5941,_0x5c1763);return this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x1b6'),_0x237f99[_0xd01d('0xb6')],_0x1d5941));}}return this[_0xd01d('0x37')][_0xd01d('0xa7')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x237f99[_0xd01d('0xb6')]));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1b7')]=function(_0x11c2c0){logger['info'](util[_0xd01d('0x2a')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x11c2c0[_0xd01d('0xa6')]));_0x11c2c0[_0xd01d('0x60')]=_0x11c2c0[_0xd01d('0x60')][_0xd01d('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd01d('0x84')](_0x11c2c0[_0xd01d('0x5e')])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0x1b8'));}if(!this[_0xd01d('0x84')](_0x11c2c0[_0xd01d('0x60')])){return this['channel'][_0xd01d('0xa7')](_0xd01d('0xa8'));}this['channel'][_0xd01d('0xa7')](util['format'](_0xd01d('0x1b9'),_0x11c2c0[_0xd01d('0x60')]));var _0x4387fb=this['googleCloudTTS'][_0xd01d('0x70')](this,_0x11c2c0);if(_0x4387fb){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x1ba'),_0x4387fb));var _0x2f905e=this[_0xd01d('0x37')]['streamFile'](_0x4387fb);try{fs[_0xd01d('0xfa')](_0x4387fb+_0xd01d('0xfb'));}catch(_0x198d1d){logger['error'](_0x198d1d);}return _0x2f905e;}return this['channel'][_0xd01d('0x2e')](_0x11c2c0,_0xd01d('0x1bb'));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1bc')]=function(_0x115ce0){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x1bd'),_0x115ce0[_0xd01d('0xa6')]));_0x115ce0[_0xd01d('0x60')]=_0x115ce0[_0xd01d('0x60')][_0xd01d('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x115ce0[_0xd01d('0x60')])){return this[_0xd01d('0x37')]['noop'](_0xd01d('0xa8'));}this['channel'][_0xd01d('0xa7')](util['format'](_0xd01d('0x1be'),_0x115ce0['text']));var _0x3d8585=this[_0xd01d('0x65')][_0xd01d('0x70')](this,_0x115ce0);if(_0x3d8585){this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x1bf'),_0x3d8585));var _0x3096ee=this[_0xd01d('0x37')][_0xd01d('0xf9')](_0x3d8585);try{fs[_0xd01d('0xfa')](_0x3d8585+_0xd01d('0xfb'));}catch(_0x20ded6){logger['error'](_0x20ded6);}return _0x3096ee;}return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x115ce0,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1c0')]=function(_0x7756b){logger[_0xd01d('0x30')](util[_0xd01d('0x2a')](_0xd01d('0x1c1'),_0x7756b[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x7756b['findBy'])){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x7756b,_0xd01d('0x14f'));}logger['info'](util[_0xd01d('0x2a')](_0xd01d('0x150'),this['channel'][_0xd01d('0x3a')],_0x7756b[_0xd01d('0x14e')]));var _0x210bd5=this[_0xd01d('0x54')][_0xd01d('0x70')](this,_0x7756b[_0xd01d('0x14e')]);if(_0x210bd5){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x151'),this['channel']['callerid'],_0x7756b['findBy']));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x151'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x7756b[_0xd01d('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd01d('0x30')](util['format'](_0xd01d('0x153'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x7756b['findBy']));this[_0xd01d('0x37')][_0xd01d('0xa7')](util[_0xd01d('0x2a')](_0xd01d('0x153'),this[_0xd01d('0x37')][_0xd01d('0x3a')],_0x7756b['findBy']));return{'code':0xc8,'result':_0xd01d('0x154')};}};AGIVertices[_0xd01d('0x12')]['voicemail']=function(_0x5c1477){logger['info'](util[_0xd01d('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x5c1477['label']));var _0x320b14=this[_0xd01d('0x37')][_0xd01d('0x5b')](_0xd01d('0x1c2'),[_0x5c1477[_0xd01d('0x1c3')],_0x5c1477['options']]);if(_0x320b14[_0xd01d('0xa0')]===-0x1){return _0x320b14;}return this[_0xd01d('0x37')]['noop'](util[_0xd01d('0x2a')](_0xd01d('0xc2'),_0xd01d('0x1c2'),_0x5c1477['mailbox']));};AGIVertices[_0xd01d('0x12')][_0xd01d('0x1c4')]=function(_0x496d49){logger[_0xd01d('0x30')](util['format'](_0xd01d('0x1c5'),_0x496d49[_0xd01d('0xa6')]));if(!this[_0xd01d('0x84')](_0x496d49[_0xd01d('0xd5')])){return this['channel'][_0xd01d('0x2e')](_0x496d49,_0xd01d('0x1c6'));}var _0xb627b7=this[_0xd01d('0x13')]['sync'](this,_0x496d49[_0xd01d('0xd5')]);if(!_0xb627b7){return this[_0xd01d('0x37')][_0xd01d('0x2e')](_0x496d49,_0xd01d('0xd7'));}var _0x4a938d=this[_0xd01d('0x37')]['getVariable'](_0xb627b7);return{'code':0xc8,'result':_0x4a938d[_0xd01d('0x9f')]?_0x4a938d['extra']:'-'};};String[_0xd01d('0x12')][_0xd01d('0x1c7')]=function(_0x475f3f,_0x26c2fa){return this[_0xd01d('0x9e')](_0x475f3f)[_0xd01d('0x1c8')](_0x26c2fa);};module[_0xd01d('0x1c9')]=AGIVertices; \ No newline at end of file +var _0xfc6d=['Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','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','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','moment','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','getMailAccount','sendMailMessage','getIntervals','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','Amy','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','googleASR','tildeASR','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','extra','result','maxRetry','retry','mrcpsynth','no\x20text\x20configured','options','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','opts','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','sesteknda','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','out','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','googleasr','wav','%s/recordings/%s','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','recordFile','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','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\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','getSound','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','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'];(function(_0x3ff32e,_0x298304){var _0x5d3024=function(_0x2d00ea){while(--_0x2d00ea){_0x3ff32e['push'](_0x3ff32e['shift']());}};_0x5d3024(++_0x298304);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x2edb14,_0x53fba5){_0x2edb14=_0x2edb14-0x0;var _0x11d430=_0xfc6d[_0x2edb14];return _0x11d430;};'use strict';var fs=require('fs');var path=require(_0xdfc6('0x0'));var util=require(_0xdfc6('0x1'));var _=require(_0xdfc6('0x2'));var sh=require(_0xdfc6('0x3'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0xdfc6('0x4'));var Mustache=require('mustache');var rp=require(_0xdfc6('0x5'));var logger=require(_0xdfc6('0x6'))('agi');var config=require(_0xdfc6('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xdfc6('0x8');var recursiveMapAttributes=[_0xdfc6('0x9'),_0xdfc6('0xa')];var verticesWithRetry=[_0xdfc6('0xb'),_0xdfc6('0xc'),_0xdfc6('0xd')];var AGIVertices=function(_0x192bc4,_0x1bfa47,_0x46c3bf){this[_0xdfc6('0xe')]=_0x192bc4;this[_0xdfc6('0xf')]=_0x1bfa47;this[_0xdfc6('0x10')]=_0x46c3bf;};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x12')]=function(_0x2151c8,_0x4c7a55){this[_0xdfc6('0xf')][_0xdfc6('0x13')](_0x2151c8)[_0xdfc6('0x14')](function(_0xc14171){_0x4c7a55(null,_0xc14171?_0xc14171['name']:![]);})[_0xdfc6('0x15')](function(_0x1d6533){_0x4c7a55(_0x1d6533);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x16')]=function(_0x2ca7a0,_0x213496){this[_0xdfc6('0xf')][_0xdfc6('0x17')](_0x2ca7a0)[_0xdfc6('0x14')](function(_0x1966a7){_0x213496(null,_0x1966a7?_0x1966a7[_0xdfc6('0x18')]:![]);})[_0xdfc6('0x15')](function(_0x5b9873){_0x213496(_0x5b9873);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x19')]=function(_0x36c72d,_0x7f2477){this[_0xdfc6('0xf')][_0xdfc6('0x1a')](_0x36c72d)[_0xdfc6('0x14')](function(_0x1762b5){_0x7f2477(null,_0x1762b5?_0x1762b5[_0xdfc6('0x18')]:![]);})[_0xdfc6('0x15')](function(_0x594cf0){_0x7f2477(_0x594cf0);});};AGIVertices[_0xdfc6('0x11')]['getSquareOdbc']=function(_0x111852,_0x171054){this[_0xdfc6('0xf')]['getSquareOdbcById'](_0x111852)[_0xdfc6('0x14')](function(_0x2a283d){_0x171054(null,_0x2a283d?_0x2a283d['dsn']:![]);})[_0xdfc6('0x15')](function(_0x21faba){_0x171054(_0x21faba);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1b')]=function(_0x443992,_0x389bb6){this['rpc'][_0xdfc6('0x1c')](_0x443992)['then'](function(_0x233cc5){_0x389bb6(null,_0x233cc5?_0x233cc5[_0xdfc6('0x18')]:![]);})[_0xdfc6('0x15')](function(_0x231e6f){_0x389bb6(_0x231e6f);});};AGIVertices[_0xdfc6('0x11')]['getTrunk']=function(_0xb421c8,_0x38a877){this[_0xdfc6('0xf')][_0xdfc6('0x1d')](_0xb421c8)[_0xdfc6('0x14')](function(_0x4e1d8f){_0x38a877(null,_0x4e1d8f?_0x4e1d8f[_0xdfc6('0x18')]:![]);})['catch'](function(_0x5c1307){_0x38a877(_0x5c1307);});};AGIVertices[_0xdfc6('0x11')]['getSound']=function(_0x53ce6c,_0x7bc143){var _0x16372f=this;this['rpc'][_0xdfc6('0x1e')](_0x53ce6c)['then'](function(_0x1840ec){_0x7bc143(null,_0x1840ec?_0x16372f[_0xdfc6('0x1f')](_0x1840ec['save_name']):![]);})[_0xdfc6('0x15')](function(_0x48149e){_0x7bc143(_0x48149e);});};AGIVertices['prototype'][_0xdfc6('0x20')]=function(_0x4b3777,_0x26ced3){this[_0xdfc6('0xf')]['getMailAccountById'](_0x4b3777)[_0xdfc6('0x14')](function(_0x55badc){_0x26ced3(null,_0x55badc?_0x55badc:![]);})[_0xdfc6('0x15')](function(_0x47e63a){_0x26ced3(_0x47e63a);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x21')]=function(_0x2629b2,_0x18b674,_0x490fa1){this[_0xdfc6('0x10')][_0xdfc6('0x21')](_0x2629b2,_0x18b674)[_0xdfc6('0x14')](function(){_0x490fa1(null);})[_0xdfc6('0x15')](function(_0x10f50d){_0x490fa1(_0x10f50d);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x22')]=function(_0x2946ca,_0xa948ff){this['rpc']['getIntervalById'](_0x2946ca)[_0xdfc6('0x14')](function(_0x5dccca){if(_0x5dccca){if(_0x5dccca[_0xdfc6('0x23')]){_0xa948ff(null,[_0x5dccca[_0xdfc6('0x24')]]);}else{_0xa948ff(null,_[_0xdfc6('0x25')](_0x5dccca[_0xdfc6('0x26')],_0xdfc6('0x24')));}}else{_0xa948ff(null,![]);}})[_0xdfc6('0x15')](function(_0x14c30c){_0xa948ff(_0x14c30c);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1f')]=function(_0x2f0de5){return util[_0xdfc6('0x27')](_0xdfc6('0x28'),FILES_PATH,_0x2f0de5);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x29')]=function(_0x5f040c,_0x4f1ffa,_0x6c3e61){odbc[_0xdfc6('0x2a')](_0x5f040c,function(_0x26e0f){if(_0x26e0f){logger[_0xdfc6('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x26e0f);_0x6c3e61(_0x26e0f);}else{logger[_0xdfc6('0x2c')](_0xdfc6('0x2d'));odbc[_0xdfc6('0x2e')](_0x4f1ffa,function(_0x27bde3,_0x531ebb){if(_0x27bde3){logger[_0xdfc6('0x2c')]('Error\x20executing\x20query\x20%s',_0x4f1ffa);_0x6c3e61(_0x27bde3);}else{logger[_0xdfc6('0x2c')](_0xdfc6('0x2f'),_0x4f1ffa);odbc['close'](function(_0x4d37d3){if(_0x4d37d3){logger[_0xdfc6('0x2b')](_0xdfc6('0x30'),_0x4d37d3);}_0x6c3e61(null,_0x531ebb);});}});}});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x31')]=function(_0x246fe9,_0x54a790){this[_0xdfc6('0xf')]['getSmsAccountById'](_0x246fe9)[_0xdfc6('0x14')](function(_0x2dd3c8){_0x54a790(null,_0x2dd3c8?_0x2dd3c8:![]);})[_0xdfc6('0x15')](function(_0x5587ad){_0x54a790(_0x5587ad);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x32')]=function(_0x3fcce2,_0xf8d55b){this[_0xdfc6('0xf')][_0xdfc6('0x32')](_0x3fcce2)[_0xdfc6('0x14')](function(_0x27ea9e){_0xf8d55b(null,_0x27ea9e);})['catch'](function(_0x3d1c49){_0xf8d55b(_0x3d1c49);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x33')]=function(_0x25aa69,_0x5c749d,_0x23d2c5){this[_0xdfc6('0xf')][_0xdfc6('0x33')]({'uniqueid':this[_0xdfc6('0xe')][_0xdfc6('0x34')],'node':_0x25aa69[_0xdfc6('0x35')],'application':_0x25aa69[_0xdfc6('0x36')],'data':_0x5c749d||null,'project_name':this[_0xdfc6('0xe')]['arg_1'],'callerid':this[_0xdfc6('0xe')]['callerid']})['then'](function(_0xaafe14){if(_0x23d2c5){_0x23d2c5(null,_0xaafe14);}})[_0xdfc6('0x15')](function(_0x55cec1){if(_0x23d2c5){_0x23d2c5(_0x55cec1);}});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x37')]=function(_0x30498b,_0x1aa1e4,_0x14841f,_0x52afba){this[_0xdfc6('0xf')]['createSquareRecording']({'uniqueid':this[_0xdfc6('0xe')][_0xdfc6('0x34')],'callerid':this['channel'][_0xdfc6('0x38')],'calleridname':this[_0xdfc6('0xe')][_0xdfc6('0x39')],'context':this[_0xdfc6('0xe')]['context'],'extension':this[_0xdfc6('0xe')][_0xdfc6('0x3a')],'priority':this[_0xdfc6('0xe')][_0xdfc6('0x3b')],'accountcode':this[_0xdfc6('0xe')][_0xdfc6('0x3c')],'dnid':this[_0xdfc6('0xe')]['dnid'],'projectName':this['channel'][_0xdfc6('0x3d')],'saveName':_0x1aa1e4,'filename':_0x30498b[_0xdfc6('0x3e')]||_0x1aa1e4,'savePath':_0x14841f})[_0xdfc6('0x14')](function(_0x5dc9a1){_0x52afba(null,_0x5dc9a1);})[_0xdfc6('0x15')](function(_0x20071d){_0x52afba(_0x20071d);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x3f')]=function(_0x3850d3,_0x37e021,_0x23fa6e){this['rpc'][_0xdfc6('0x3f')]({'uniqueid':this[_0xdfc6('0xe')][_0xdfc6('0x34')],'body':_0x3850d3,'direction':_0x37e021})[_0xdfc6('0x14')](function(_0x10132f){if(_0x23fa6e){_0x23fa6e(null,_0x10132f);}})[_0xdfc6('0x15')](function(_0x3d7e3a){if(_0x23fa6e){_0x23fa6e(_0x3d7e3a);}});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x40')]=function(_0x5490ed,_0x34b25a){this[_0xdfc6('0xf')][_0xdfc6('0x40')]({'firstName':_[_0xdfc6('0x41')](_0x5490ed[_0xdfc6('0x18')])||_[_0xdfc6('0x42')](_0x5490ed[_0xdfc6('0x18')])?_0xdfc6('0x43')+Math[_0xdfc6('0x44')]():_0x5490ed[_0xdfc6('0x18')],'lastName':_[_0xdfc6('0x41')](_0x5490ed[_0xdfc6('0x45')])||_[_0xdfc6('0x42')](_0x5490ed[_0xdfc6('0x45')])?null:_0x5490ed[_0xdfc6('0x45')],'phone':_0x5490ed[_0xdfc6('0x46')],'ListId':_0x5490ed[_0xdfc6('0x47')],'scheduledat':_0x5490ed[_0xdfc6('0x48')],'callbackUniqueid':this[_0xdfc6('0xe')][_0xdfc6('0x34')],'tags':'callback','description':_0xdfc6('0x49')+_0x5490ed[_0xdfc6('0x48')][_0xdfc6('0x4a')](),'priority':_0x5490ed[_0xdfc6('0x4b')]})[_0xdfc6('0x14')](function(_0xe13066){_0x34b25a(null,_0xe13066);})[_0xdfc6('0x15')](function(_0x2b1d61){_0x34b25a(_0x2b1d61);});};AGIVertices[_0xdfc6('0x11')]['getPause']=function(_0x57477b,_0x32c789){this[_0xdfc6('0xf')]['getPauseById'](_0x57477b)[_0xdfc6('0x14')](function(_0x35ceca){_0x32c789(null,_0x35ceca?_0x35ceca['name']:![]);})['catch'](function(_0x5988bf){_0x32c789(_0x5988bf);});};AGIVertices['prototype'][_0xdfc6('0x4c')]=function(_0x1bf083,_0x2f6e90,_0x1db45c){var _0x1dbf8c={'role':_0xdfc6('0x4d')};_0x1dbf8c[_0x1bf083]=this[_0xdfc6('0xe')][_0xdfc6('0x38')];this[_0xdfc6('0xf')][_0xdfc6('0x4c')](_0x1dbf8c,_0x2f6e90,this[_0xdfc6('0xe')]['uniqueid'])['then'](function(_0x3d6e59){_0x1db45c(null,_['isNil'](_0x3d6e59)?![]:!![]);})['catch'](function(_0x206cea){logger['error'](_0x206cea);_0x1db45c(null,![]);});};AGIVertices[_0xdfc6('0x11')]['agentUnpause']=function(_0x5040e2,_0x3489bb){var _0x42c367={'role':_0xdfc6('0x4d')};_0x42c367[_0x5040e2]=this[_0xdfc6('0xe')][_0xdfc6('0x38')];this[_0xdfc6('0xf')][_0xdfc6('0x4e')](_0x42c367)[_0xdfc6('0x14')](function(_0x2b54ff){_0x3489bb(null,_[_0xdfc6('0x42')](_0x2b54ff)?![]:!![]);})[_0xdfc6('0x15')](function(_0x37e01a){logger[_0xdfc6('0x2b')](_0x37e01a);_0x3489bb(null,![]);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x4f')]=function(_0x3fbed2,_0x1a9507){var _0x130518={'role':_0xdfc6('0x4d')};_0x130518[_0x3fbed2]=this['channel'][_0xdfc6('0x38')];this[_0xdfc6('0xf')]['agentLogout'](_0x130518)[_0xdfc6('0x14')](function(_0x34f290){_0x1a9507(null,_['isNil'](_0x34f290)?![]:!![]);})[_0xdfc6('0x15')](function(_0x34cbd9){logger[_0xdfc6('0x2b')](_0x34cbd9);_0x1a9507(null,![]);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x50')]=function(_0x4c5e7e,_0x353b25){var _0x25b7f4={'role':_0xdfc6('0x4d')};_0x25b7f4[_0x4c5e7e]=this[_0xdfc6('0xe')]['callerid'];var _0x1d062c=_0x4c5e7e!=_0xdfc6('0x51')?util['format'](_0xdfc6('0x52'),_0xdfc6('0x53'),this[_0xdfc6('0xe')][_0xdfc6('0x38')]):undefined;this[_0xdfc6('0xf')][_0xdfc6('0x50')](_0x25b7f4,_0x1d062c)[_0xdfc6('0x14')](function(_0x1c1414){_0x353b25(null,_['isNil'](_0x1c1414)?![]:!![]);})[_0xdfc6('0x15')](function(_0x229a39){logger[_0xdfc6('0x2b')](_0x229a39);_0x353b25(null,![]);});};AGIVertices[_0xdfc6('0x11')]['shellCommand']=function(_0xa0b24c,_0xd63c3d){sh[_0xdfc6('0x54')](_[_0xdfc6('0x55')](_0xa0b24c),function(_0x47bdcb,_0x1dd509){var _0x1d0d57=_0x1dd509[_0xdfc6('0x56')](/(\r\n|\n|\r)/gm,'');_0xd63c3d(null,_0x1d0d57);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x6e31f6,_0x5a090d){scripts[_0xdfc6('0x57')](_0x6e31f6['apiKey'],_0x6e31f6[_0xdfc6('0x58')]||_0xdfc6('0x59'),_0x6e31f6[_0xdfc6('0x59')],_0x6e31f6['languageCode']||'en-US',_0x6e31f6[_0xdfc6('0x5a')]||_0xdfc6('0x5b'),_0x6e31f6[_0xdfc6('0x5c')]||_0xdfc6('0x5d'))['then'](function(_0x314ac1){_0x5a090d(null,_0x314ac1);})['catch'](function(_0x139621){_0x5a090d(_0x139621);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x5e')]=function(_0x43c2b7,_0x188fa2){scripts['googleTTS'](_0x43c2b7['text'],_0x43c2b7['google_tts_language']||'en',0x1)[_0xdfc6('0x14')](function(_0x3fa95e){_0x188fa2(null,_0x3fa95e);})['catch'](function(_0x2d1906){_0x188fa2(_0x2d1906);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x5f')]=function(_0x6e61d0,_0x280815){var _0x393b7f={'uri':_0x6e61d0[_0xdfc6('0x60')],'method':_0x6e61d0[_0xdfc6('0x61')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x6e61d0[_0xdfc6('0x62')])===_0xdfc6('0x63')&&parseInt(_0x6e61d0[_0xdfc6('0x62')])>=0x1?parseInt(_0x6e61d0[_0xdfc6('0x62')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xdfc6('0x64'),_0xdfc6('0x65')],_0x393b7f[_0xdfc6('0x61')]['toUpperCase']())){try{_0x393b7f['body']=_0x6e61d0['rawBody']?JSON[_0xdfc6('0x66')](_0x6e61d0['rawBody']):{};}catch(_0x209792){logger['error'](_0xdfc6('0x67'),_0x209792);}}try{_0x393b7f['headers']=_0x6e61d0[_0xdfc6('0x9')]?JSON['parse'](_0x6e61d0[_0xdfc6('0x9')]):{};}catch(_0x58f7a3){logger[_0xdfc6('0x2b')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x58f7a3);}if(_0x6e61d0[_0xdfc6('0x68')]){try{var _0x5708bb=require(_0x6e61d0[_0xdfc6('0x68')])[_0xdfc6('0x69')](this,_0x393b7f);_0x393b7f[_0xdfc6('0x6a')]=Mustache[_0xdfc6('0x6b')](_0x6e61d0['url'],_0x5708bb,{},['$$','$$']);if(_0x393b7f[_0xdfc6('0x6c')]){_0x393b7f['headers']=JSON[_0xdfc6('0x66')](Mustache[_0xdfc6('0x6b')](JSON[_0xdfc6('0x6d')](_0x393b7f[_0xdfc6('0x6c')]),_0x5708bb,{},['$$','$$']));}if(_0x393b7f[_0xdfc6('0x6e')]){_0x393b7f[_0xdfc6('0x6e')]=JSON[_0xdfc6('0x66')](Mustache[_0xdfc6('0x6b')](JSON[_0xdfc6('0x6d')](_0x393b7f['body']),_0x5708bb,{},['$$','$$']));}}catch(_0x4e244d){logger[_0xdfc6('0x2b')](_0xdfc6('0x6f'),_0x4e244d);}}rp(_0x393b7f)[_0xdfc6('0x14')](function(_0x28141f){var _0x47d9d5={'statusCode':_0x28141f[_0xdfc6('0x70')]||0xc8,'statusMessage':_0x28141f[_0xdfc6('0x71')]||'OK','headers':_0x28141f[_0xdfc6('0x6c')]||{},'body':_0x28141f[_0xdfc6('0x6e')]||{}};_0x280815(null,_0x47d9d5);})[_0xdfc6('0x15')](function(_0x430a93){var _0x15c6fa={'statusCode':_0x430a93[_0xdfc6('0x70')]||0x1f4,'statusMessage':_0x430a93[_0xdfc6('0x72')]||_0xdfc6('0x73'),'headers':_0x430a93['options'][_0xdfc6('0x6c')]||{},'body':_0x430a93['options']['body']||{}};_0x280815(null,_0x15c6fa);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x74')]=function(_0x3989cc,_0x1da19e){scripts[_0xdfc6('0x74')](this[_0xdfc6('0xe')][_0xdfc6('0x34')],_0x3989cc[_0xdfc6('0x75')],_0x3989cc[_0xdfc6('0x59')],_0x3989cc[_0xdfc6('0x76')]||'en')['then'](function(_0x47d4fa){_0x1da19e(null,_0x47d4fa);})[_0xdfc6('0x15')](function(_0x335404){_0x1da19e(_0x335404);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x77')]=function(_0x30bfe7,_0x3a016f){scripts[_0xdfc6('0x77')](this[_0xdfc6('0xe')],_0x30bfe7)[_0xdfc6('0x14')](function(_0x582619){_0x3a016f(null,_0x582619);})[_0xdfc6('0x15')](function(_0x1bf380){_0x3a016f(_0x1bf380);});};AGIVertices['prototype'][_0xdfc6('0x78')]=function(_0x56c974,_0x587c21){scripts[_0xdfc6('0x78')](_0x56c974['key'],_0x56c974[_0xdfc6('0x59')],_0x56c974[_0xdfc6('0x79')]||_0xdfc6('0x7a'),_0x56c974[_0xdfc6('0x7b')])[_0xdfc6('0x14')](function(_0x43d9f1){_0x587c21(null,_0x43d9f1);})['catch'](function(_0x1ffbfb){_0x587c21(_0x1ffbfb);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x7c')]=function(_0x558185,_0x38d0a9,_0x23ee39){scripts[_0xdfc6('0x7c')](_0x38d0a9,_0x558185[_0xdfc6('0x75')],_0x558185['ispeech_asr_language']||_0xdfc6('0x7a'),this[_0xdfc6('0x7d')](_0x558185[_0xdfc6('0x7e')])?_0x558185[_0xdfc6('0x7e')]:undefined)['then'](function(_0x5118c3){_0x23ee39(null,_0x5118c3);})[_0xdfc6('0x15')](function(_0x5c2aa8){_0x23ee39(_0x5c2aa8);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x7f')]=function(_0x527a27,_0x450bd4){scripts[_0xdfc6('0x7f')](_0x527a27['aws_access_key_id'],_0x527a27['aws_secret_access_key'],_0x527a27['aws_polly_region'],_0x527a27['aws_polly_voice']||_0xdfc6('0x80'),_0x527a27[_0xdfc6('0x59')],_0x527a27[_0xdfc6('0x81')]||'text')[_0xdfc6('0x14')](function(_0x4838b8){_0x450bd4(null,_0x4838b8);})[_0xdfc6('0x15')](function(_0x4ef938){_0x450bd4(_0x4ef938);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x82')]=function(_0x40352d,_0x2b8c7c){scripts[_0xdfc6('0x82')](this[_0xdfc6('0xe')][_0xdfc6('0x34')],_0x40352d[_0xdfc6('0x83')],_0x40352d[_0xdfc6('0x84')],_0x40352d['aws_lex_region'],_0x40352d[_0xdfc6('0x59')],_0x40352d['aws_bot_name'])['then'](function(_0x8550d6){_0x2b8c7c(null,_0x8550d6);})[_0xdfc6('0x15')](function(_0x33ddde){_0x2b8c7c(_0x33ddde);});};AGIVertices['prototype'][_0xdfc6('0x85')]=function(_0x3a8405,_0x2a6a04,_0x455ad1){scripts['googleASR'](_0x2a6a04,_0x3a8405['key'],_0x3a8405['google_asr_language']||_0xdfc6('0x7a'))[_0xdfc6('0x14')](function(_0x37ae3d){_0x455ad1(null,_0x37ae3d);})[_0xdfc6('0x15')](function(_0x4c46be){_0x455ad1(_0x4c46be);});};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x86')]=function(_0x59566d,_0x2061e7,_0x1cd865){scripts[_0xdfc6('0x86')](_0x2061e7,_0x59566d['appid'],_0x59566d['appsecret'],_0x59566d[_0xdfc6('0x6a')])['then'](function(_0x4be796){_0x1cd865(null,_0x4be796);})['catch'](function(_0x57ae71){_0x1cd865(_0x57ae71);});};AGIVertices['prototype']['clear']=function(_0x5c6997){var _0x1870bf=_[_0xdfc6('0x87')](verticesWithRetry,_0x5c6997[_0xdfc6('0x36')])?_0x5c6997:_[_0xdfc6('0x88')](_0x5c6997);for(var _0x386994 in _0x1870bf){if(_0x1870bf[_0xdfc6('0x89')](_0x386994)){if(_0x1870bf[_0x386994]&&_[_0xdfc6('0x8a')](_0x1870bf[_0x386994])){if(_[_0xdfc6('0x87')](recursiveMapAttributes,_0x386994)){_0x1870bf[_0x386994]=this['replaceObjectAllVariables'](_0x1870bf[_0x386994]);}else{_0x1870bf[_0x386994]=this[_0xdfc6('0x8b')](_0x1870bf[_0x386994]);}}}}return _0x1870bf;};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x8c')]=function(_0x4677ca){for(var _0x3dacc4 in _0x4677ca){if(_0x4677ca['hasOwnProperty'](_0x3dacc4)){if(_[_0xdfc6('0x8d')](_0x4677ca[_0x3dacc4])){this[_0xdfc6('0x8c')](_0x4677ca[_0x3dacc4]);}else if(_[_0xdfc6('0x8e')](_0x4677ca[_0x3dacc4])){for(var _0x1bb1fe=0x0;_0x1bb1fe<_0x4677ca[_0x3dacc4][_0xdfc6('0x8f')];_0x1bb1fe++){this[_0xdfc6('0x8c')](_0x4677ca[_0x3dacc4][_0x1bb1fe]);}}else if(_[_0xdfc6('0x8a')](_0x4677ca[_0x3dacc4])){_0x4677ca[_0x3dacc4]=this[_0xdfc6('0x8b')](_0x4677ca[_0x3dacc4]);}}}};AGIVertices[_0xdfc6('0x11')]['saveRestApiResult']=function(_0x3701f3,_0xd1819f){for(var _0x5560a8 in _0x3701f3){if(_0x3701f3[_0xdfc6('0x89')](_0x5560a8)){if(_[_0xdfc6('0x8d')](_0x3701f3[_0x5560a8])){if(!_[_0xdfc6('0x41')](_0x3701f3[_0x5560a8])){this[_0xdfc6('0x90')](_0x3701f3[_0x5560a8],util[_0xdfc6('0x27')](_0xdfc6('0x91'),_0xd1819f,_0x5560a8));}}else if(_[_0xdfc6('0x8e')](_0x3701f3[_0x5560a8])){for(var _0xe1dc4f=0x0;_0xe1dc4f<_0x3701f3[_0x5560a8][_0xdfc6('0x8f')];_0xe1dc4f++){this['saveRestApiResult'](_0x3701f3[_0x5560a8][_0xe1dc4f],util[_0xdfc6('0x27')](_0xdfc6('0x91'),_0xd1819f,_0x5560a8+'['+_0xe1dc4f+']'));}}else{if(!_['isNil'](_0x3701f3[_0x5560a8])){this[_0xdfc6('0xe')][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0x91'),_0xd1819f,_0x5560a8),_0x3701f3[_0x5560a8]);}}}}};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x93')]=function(_0x11f1dc){try{var _0x45d47d=JSON[_0xdfc6('0x66')](_0x11f1dc);this[_0xdfc6('0x8c')](_0x45d47d);return JSON[_0xdfc6('0x6d')](_0x45d47d);}catch(_0x753123){return this[_0xdfc6('0x8b')](_0x11f1dc);}};AGIVertices['prototype'][_0xdfc6('0x8b')]=function(_0x1e7112){var _0x199905=_0x1e7112[_0xdfc6('0x94')]('{');for(var _0x203e16=0x1;_0x203e16<_0x199905['length'];_0x203e16+=0x1){var _0x2f8f9c=_0x199905[_0x203e16][_0xdfc6('0x94')]('}');if(_0x2f8f9c[_0xdfc6('0x8f')]>0x1){_0x1e7112=_0x1e7112['replaceAll']('{'+_0x2f8f9c[0x0]+'}',this[_0xdfc6('0xe')][_0xdfc6('0x12')](_0x2f8f9c[0x0])[_0xdfc6('0x95')]||_0x2f8f9c[0x0]);}}if(_0x199905[_0xdfc6('0x8f')]===0x1){return _0x1e7112[_0xdfc6('0x4a')]();}return this['replaceAllVariables'](_0x1e7112);};AGIVertices[_0xdfc6('0x11')]['getAndSetVariable']=function(_0x2e891f,_0x36dd01){var _0x2d1475=this[_0xdfc6('0xe')][_0xdfc6('0x12')](_0x2e891f);if(_0x2d1475[_0xdfc6('0x96')]===-0x1){return _0x2d1475;}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x36dd01,_0x2d1475[_0xdfc6('0x95')]));return this[_0xdfc6('0xe')][_0xdfc6('0x92')](_0x36dd01,_0x2d1475[_0xdfc6('0x95')]);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x7d')]=function(_0x4b6a83){return _0x4b6a83&&_0x4b6a83!=='0'&&_0x4b6a83!=='-1'&&_0x4b6a83!=='';};AGIVertices['prototype'][_0xdfc6('0x97')]=function(_0x36bd32){this[_0xdfc6('0x33')]['sync'](this,_0x36bd32,'-');_0x36bd32[_0xdfc6('0x98')]=_0x36bd32[_0xdfc6('0x97')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x99')]=function(_0x115dc3){logger['info'](util[_0xdfc6('0x27')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x115dc3['label']));if(!this[_0xdfc6('0x7d')](_0x115dc3['text'])){return this['channel']['noop'](_0xdfc6('0x9a'));}var _0xd6085e='\x22'+_0x115dc3[_0xdfc6('0x59')]+'\x22';if(this[_0xdfc6('0x7d')](_0x115dc3[_0xdfc6('0x9b')])){_0xd6085e+=','+_0x115dc3[_0xdfc6('0x9b')];}var _0x3ee1d0=this[_0xdfc6('0xe')][_0xdfc6('0x54')](_0xdfc6('0x9c'),_0xd6085e);if(_0x3ee1d0[_0xdfc6('0x96')]===-0x1){return _0x3ee1d0;}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x9e'),_0xd6085e));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x9f')]=function(_0xdc5089){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xa0'),_0xdc5089['label']));if(!this[_0xdfc6('0x7d')](_0xdc5089[_0xdfc6('0xa1')])){return this['channel'][_0xdfc6('0x9d')]('no\x20grammar\x20configured');}var _0x40d36d=_0xdc5089[_0xdfc6('0xa1')];if(this['isConfigured'](_0xdc5089[_0xdfc6('0x9b')])){_0x40d36d+=','+_0xdc5089[_0xdfc6('0x9b')];}var _0x340c09=this['channel'][_0xdfc6('0x54')](_0xdfc6('0xa2'),_0x40d36d);if(_0x340c09['result']===-0x1){return _0x340c09;}var _0x1adc31=this['getAndSetVariable'](_0xdfc6('0xa3'),_0xdfc6('0xa4'));if(_0x1adc31[_0xdfc6('0x96')]===-0x1){return _0x1adc31;}var _0x52399f=this[_0xdfc6('0xa5')](_0xdfc6('0xa6'),'MRCP_RECOG_TRANSCRIPT');if(_0x52399f[_0xdfc6('0x96')]===-0x1){return _0x52399f;}var _0x30c072=this[_0xdfc6('0xa5')](_0xdfc6('0xa7'),'MRCP_RECOG_INSTANCE');if(_0x30c072[_0xdfc6('0x96')]===-0x1){return _0x30c072;}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xa8'),_0x40d36d));};AGIVertices[_0xdfc6('0x11')]['agi']=function(_0x3bae9c){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xa9'),_0x3bae9c['label']));return this[_0xdfc6('0xe')][_0xdfc6('0xaa')]([_0x3bae9c[_0xdfc6('0xab')],_0x3bae9c[_0xdfc6('0xac')]]);};AGIVertices['prototype'][_0xdfc6('0xad')]=function(_0x368cad){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xae'),_0x368cad['label']));if(this['isConfigured'](_0x368cad[_0xdfc6('0x62')])){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xaf'),_0x368cad[_0xdfc6('0x62')]));var _0xdcd3fb=this[_0xdfc6('0xe')][_0xdfc6('0xb0')](_0x368cad[_0xdfc6('0x62')]);if(_0xdcd3fb[_0xdfc6('0x96')]===-0x1){return _0xdcd3fb;}}return this[_0xdfc6('0xe')]['answer']();};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xb1')]=function(_0x5f45ee){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0xb2'),_0x5f45ee[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x5f45ee[_0xdfc6('0x47')])){return this[_0xdfc6('0xe')]['error'](_0x5f45ee,_0xdfc6('0xb3'));}_0x5f45ee[_0xdfc6('0x48')]=moment();if(this['isConfigured'](_0x5f45ee['delay'])){_0x5f45ee[_0xdfc6('0x48')]=moment()[_0xdfc6('0xb4')](_0x5f45ee['delay'],_0xdfc6('0xb5'));}if(!this[_0xdfc6('0x7d')](_0x5f45ee['callback_priority'])){_0x5f45ee[_0xdfc6('0x4b')]=0x2;}this[_0xdfc6('0x40')][_0xdfc6('0x69')](this,_0x5f45ee);return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xb6'),_0x5f45ee[_0xdfc6('0x46')],_0x5f45ee['list_id'],_0x5f45ee['scheduledAt']));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xb7')]=function(_0x5ae9e7){logger['info'](util[_0xdfc6('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5ae9e7[_0xdfc6('0x35')]));var _0x248acc=this[_0xdfc6('0xe')][_0xdfc6('0x54')](_0x5ae9e7['application'],_0x5ae9e7[_0xdfc6('0x9b')]);if(_0x248acc[_0xdfc6('0x96')]===-0x1){return _0x248acc;}return this['channel']['noop'](util['format'](_0xdfc6('0xb8'),_0x5ae9e7[_0xdfc6('0xb9')],_0x5ae9e7[_0xdfc6('0x9b')]));};AGIVertices[_0xdfc6('0x11')]['lumenvoxtts']=function(_0x2e7040){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xba'),_0x2e7040[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x2e7040['text'])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}var _0x24fe1d='\x22'+_0x2e7040[_0xdfc6('0x59')]+'\x22';if(this[_0xdfc6('0x7d')](_0x2e7040[_0xdfc6('0x9b')])){_0x24fe1d+=','+_0x2e7040[_0xdfc6('0x9b')];}var _0x1a09b0=this[_0xdfc6('0xe')]['exec'](_0xdfc6('0x9c'),_0x24fe1d);if(_0x1a09b0[_0xdfc6('0x96')]===-0x1){return _0x1a09b0;}return this['channel']['noop'](util[_0xdfc6('0x27')](_0xdfc6('0x9e'),_0x24fe1d));};AGIVertices[_0xdfc6('0x11')]['sestektts']=function(_0x677d49){logger['info'](util[_0xdfc6('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x677d49[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x677d49[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')]['noop'](_0xdfc6('0x9a'));}var _0x53a708='\x22'+_0x677d49['text']+'\x22';if(this[_0xdfc6('0x7d')](_0x677d49['options'])){_0x53a708+=','+_0x677d49[_0xdfc6('0x9b')];}var _0x511e72=this[_0xdfc6('0xe')][_0xdfc6('0x54')]('MRCPSynth',_0x53a708);if(_0x511e72[_0xdfc6('0x96')]===-0x1){return _0x511e72;}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0x9e'),_0x53a708));};AGIVertices['prototype']['lumenvoxasr']=function(_0x383abc){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0xbb'),_0x383abc[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x383abc['grammar'])){return this[_0xdfc6('0xe')]['noop']('no\x20grammar\x20configured');}var _0x56e708=_0x383abc[_0xdfc6('0xa1')];if(this['isConfigured'](_0x383abc[_0xdfc6('0x9b')])){_0x56e708+=','+_0x383abc['options'];}var _0x15df08=this[_0xdfc6('0xe')][_0xdfc6('0x54')]('MRCPRecog',_0x56e708);if(_0x15df08[_0xdfc6('0x96')]===-0x1){return _0x15df08;}var _0x7b69d9=this[_0xdfc6('0xa5')](_0xdfc6('0xa3'),_0xdfc6('0xbc'));if(_0x7b69d9['result']===-0x1){return _0x7b69d9;}var _0x1080b2=this[_0xdfc6('0xa5')](_0xdfc6('0xa6'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1080b2['result']===-0x1){return _0x1080b2;}var _0x437dfe=this['getAndSetVariable'](_0xdfc6('0xa7'),_0xdfc6('0xbd'));if(_0x437dfe[_0xdfc6('0x96')]===-0x1){return _0x437dfe;}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0xa8'),_0x56e708));};AGIVertices['prototype']['sestekasr']=function(_0x26f168){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0xbe'),_0x26f168[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x26f168[_0xdfc6('0xa1')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0xbf'));}var _0x59eb55=_0x26f168[_0xdfc6('0xa1')];if(this[_0xdfc6('0x7d')](_0x26f168[_0xdfc6('0x9b')])){_0x59eb55+=','+_0x26f168[_0xdfc6('0x9b')];}var _0x28281a=this[_0xdfc6('0xe')][_0xdfc6('0x54')](_0xdfc6('0xa2'),_0x59eb55);if(_0x28281a[_0xdfc6('0x96')]===-0x1){return _0x28281a;}var _0x2e9cde=this[_0xdfc6('0xa5')](_0xdfc6('0xa3'),_0xdfc6('0xc0'));if(_0x2e9cde[_0xdfc6('0x96')]===-0x1){return _0x2e9cde;}var _0x448a9b=this[_0xdfc6('0xa5')](_0xdfc6('0xa6'),'SESTEK_ASR_TRANSCRIPT');if(_0x448a9b[_0xdfc6('0x96')]===-0x1){return _0x448a9b;}var _0x3ce9ad=this[_0xdfc6('0xa5')](_0xdfc6('0xa7'),_0xdfc6('0xc1'));if(_0x3ce9ad['result']===-0x1){return _0x3ce9ad;}return this[_0xdfc6('0xe')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x59eb55));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xc2')]=function(_0x3c4620){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xc3'),_0x3c4620[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x3c4620[_0xdfc6('0xc4')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3c4620,_0xdfc6('0xc5'));}var _0x102c28=this['getSquareOdbc'][_0xdfc6('0x69')](this,_0x3c4620['odbc_id']);if(!_0x102c28){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3c4620,_0xdfc6('0xc6'));}if(!this[_0xdfc6('0x7d')](_0x3c4620[_0xdfc6('0x2e')])){return this[_0xdfc6('0xe')]['error'](_0x3c4620,_0xdfc6('0xc7'));}var _0x4c8f55=_0x3c4620[_0xdfc6('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format']('query:\x20%s',_0x4c8f55));var _0x42a965=this[_0xdfc6('0x29')]['sync'](this,_0x102c28,_0x4c8f55);this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x3c4620,_0x4c8f55);if(!this['isConfigured'](_0x3c4620['variable_id'])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x59b59a=this[_0xdfc6('0x12')][_0xdfc6('0x69')](this,_0x3c4620[_0xdfc6('0xc8')]);if(!_0x59b59a){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3c4620,_0xdfc6('0xc9'));}var _0x23b7bc=this;_0x42a965[_0xdfc6('0xca')](function(_0x13af38,_0x1318b9){Object[_0xdfc6('0xcb')](_0x13af38)['forEach'](function(_0x4ea7ff){_0x23b7bc['channel'][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0xcc'),_0x59b59a,_0x1318b9,_0x4ea7ff),_0x13af38[_0x4ea7ff]);});});this[_0xdfc6('0xe')][_0xdfc6('0x92')](util[_0xdfc6('0x27')]('%s_ROWS_COUNT',_0x59b59a),_0x42a965[_0xdfc6('0x8f')]);return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xcd'),_0x59b59a));};AGIVertices['prototype'][_0xdfc6('0xce')]=function(_0x11ee8d){logger[_0xdfc6('0xcf')](util[_0xdfc6('0x27')](_0xdfc6('0xd0'),_0x11ee8d['label']));if(!this[_0xdfc6('0x7d')](_0x11ee8d[_0xdfc6('0xd1')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x11ee8d,_0xdfc6('0xd2'));}var _0x7afb52=this[_0xdfc6('0x1b')][_0xdfc6('0x69')](this,_0x11ee8d[_0xdfc6('0xd1')]);if(!_0x7afb52){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x11ee8d,'no\x20user\x20found');}var _0x2f0a33=this[_0xdfc6('0xe')]['exec']('DIAL',[util[_0xdfc6('0x27')]('SIP/%s',_0x7afb52),_0x11ee8d[_0xdfc6('0x62')],_0x11ee8d[_0xdfc6('0xd3')],_0x11ee8d['url']]);if(_0x2f0a33[_0xdfc6('0x96')]===-0x1){return _0x2f0a33;}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format']('Executed\x20command\x20%s',_0xdfc6('0xd4')));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xd5')]=function(_0x3933a9){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xd6'),_0x3933a9['label']));if(!this['isConfigured'](_0x3933a9[_0xdfc6('0x75')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0xd7'));}if(!this[_0xdfc6('0x7d')](_0x3933a9[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this[_0xdfc6('0xe')][_0xdfc6('0xd8')]=!![];this[_0xdfc6('0x33')](_0x3933a9);this[_0xdfc6('0x3f')](_0x3933a9[_0xdfc6('0x59')],'in');this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xd9'),_0x3933a9[_0xdfc6('0x59')]));var _0x515848=this['googleDialogflow'][_0xdfc6('0x69')](this,_0x3933a9);if(_0x515848){for(var _0x75bb4b in _0x515848){if(_0x515848[_0xdfc6('0x89')](_0x75bb4b)){this[_0xdfc6('0xe')][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0xda'),_0x75bb4b[_0xdfc6('0xdb')]()),_0x515848[_0x75bb4b]);}}this[_0xdfc6('0x3f')](_0x515848[_0xdfc6('0xdc')],'out');return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xdd'),_0x515848[_0xdfc6('0xdc')]));}return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3933a9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xde')]=function(_0x1b090d){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x1b090d[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x1b090d[_0xdfc6('0xdf')])){return this['channel'][_0xdfc6('0x9d')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xdfc6('0x7d')](_0x1b090d[_0xdfc6('0xe0')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0xe1'));}if(!this[_0xdfc6('0x7d')](_0x1b090d[_0xdfc6('0xe2')])){return this['channel'][_0xdfc6('0x9d')](_0xdfc6('0xe3'));}if(!this['isConfigured'](_0x1b090d[_0xdfc6('0xe4')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')]('no\x20text\x20configured');}this['channel'][_0xdfc6('0xd8')]=!![];this[_0xdfc6('0x33')](_0x1b090d);this[_0xdfc6('0x3f')](_0x1b090d[_0xdfc6('0x59')],'in');this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1b090d[_0xdfc6('0x59')]));var _0xf81b0a=this[_0xdfc6('0x77')][_0xdfc6('0x69')](this,_0x1b090d);if(_0xf81b0a){for(var _0x302ef7 in _0xf81b0a){if(_0xf81b0a[_0xdfc6('0x89')](_0x302ef7)){this[_0xdfc6('0xe')][_0xdfc6('0x92')](util['format']('SESTEK_NDA_%s',_0x302ef7['toUpperCase']()),_0xf81b0a[_0x302ef7]);}}this[_0xdfc6('0x3f')](_0xf81b0a[_0xdfc6('0xdc')],_0xdfc6('0xe5'));if(_0xf81b0a[_0xdfc6('0xe6')]){this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0xf81b0a[_0xdfc6('0xe6')]));var _0x4c48c0=this[_0xdfc6('0xe')][_0xdfc6('0xe7')](_0xf81b0a[_0xdfc6('0xe6')]);try{fs['unlink'](_0xf81b0a['audiofile']+_0xdfc6('0xe8'));}catch(_0xa049bf){logger[_0xdfc6('0x2b')](_0xa049bf);}return _0x4c48c0;}else{return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('SestekNDA\x20Result\x20%s',_0xf81b0a['speech']));}}return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x1b090d,_0xdfc6('0xe9'));};AGIVertices[_0xdfc6('0x11')]['end']=function(_0x3c6b06){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0xea'),_0x3c6b06['label']));return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0xeb'));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xec')]=function(_0x38f139){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0xed'),_0x38f139[_0xdfc6('0x35')]));var _0x3eccce='';if(_0x38f139[_0xdfc6('0xee')]){if(!this['isConfigured'](_0x38f139[_0xdfc6('0xee')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x38f139,'no\x20trunk\x20selected');}else{var _0x49f2b2=parseInt(_0x38f139['trunk_id'],0xa);if(isNaN(_0x49f2b2)){_0x3eccce=_0x38f139['trunk_id'];}else{_0x3eccce=this[_0xdfc6('0xef')][_0xdfc6('0x69')](this,_0x38f139[_0xdfc6('0xee')]);if(!_0x3eccce){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x38f139,'no\x20trunk\x20found');}}}}else if(_0x38f139[_0xdfc6('0xf0')]){_0x3eccce=_0x38f139[_0xdfc6('0xf0')];}else{return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x38f139,_0xdfc6('0xf1'));}var _0x5b2eaa=this[_0xdfc6('0xe')]['exec']('DIAL',[util[_0xdfc6('0x27')](_0xdfc6('0xf2'),_0x3eccce,_0x38f139[_0xdfc6('0x46')]),_0x38f139[_0xdfc6('0x62')],_0x38f139[_0xdfc6('0xd3')],_0x38f139[_0xdfc6('0x60')]]);if(_0x5b2eaa[_0xdfc6('0x96')]===-0x1){return _0x5b2eaa;}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0xf3'),_0xdfc6('0xd4')));};AGIVertices['prototype'][_0xdfc6('0xf4')]=function(_0x48ec27){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0xf5'),_0x48ec27[_0xdfc6('0x35')]));return this['channel'][_0xdfc6('0x9d')]('finally');};AGIVertices['prototype'][_0xdfc6('0xc')]=function(_0x13072b){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0xf6'),_0x13072b[_0xdfc6('0x35')]));if(_0x13072b[_0xdfc6('0x98')]===0x0){return this['maxRetry'](_0x13072b);}_0x13072b['retry']-=0x1;if(!this[_0xdfc6('0x7d')](_0x13072b[_0xdfc6('0xf7')])){return this[_0xdfc6('0xe')]['error'](_0x13072b,_0xdfc6('0xf8'));}var _0x34dc56=this['getSound'][_0xdfc6('0x69')](this,_0x13072b[_0xdfc6('0xf7')]);if(!_0x34dc56){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x13072b,'no\x20file\x20audio\x20found');}if(!this[_0xdfc6('0x7d')](_0x13072b[_0xdfc6('0xc8')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x24c658=this[_0xdfc6('0xe')]['getData'](_0x34dc56,_0x13072b['response'],_0x13072b[_0xdfc6('0xf9')]);var _0x3e0cc2=_0x24c658[_0xdfc6('0x96')]?_0x24c658['result'][_0xdfc6('0x4a')]():'';logger['info'](_0xdfc6('0xfa'),JSON[_0xdfc6('0x6d')](_0x24c658));if(_0x24c658[_0xdfc6('0x96')]===-0x1){this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x13072b,_0x3e0cc2);return _0x24c658;}else if(_0x24c658['extra']===_0xdfc6('0x62')){_0x24c658[_0xdfc6('0x96')]=_0x3e0cc2['length']>=parseInt(_0x13072b['mindigit'])?'x':'i';}else{_0x24c658[_0xdfc6('0x96')]=_0x3e0cc2['length']>=parseInt(_0x13072b[_0xdfc6('0xfb')])&&_0x3e0cc2[_0xdfc6('0x8f')]<=parseInt(_0x13072b[_0xdfc6('0xf9')])?'x':'i';}var _0x3cac25=this[_0xdfc6('0x12')]['sync'](this,_0x13072b[_0xdfc6('0xc8')]);if(!_0x3cac25){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x13072b,_0xdfc6('0xc9'));}this[_0xdfc6('0xe')][_0xdfc6('0x92')](_0x3cac25,_0x3e0cc2);if(this[_0xdfc6('0x7d')](_0x13072b[_0xdfc6('0xfc')])){var _0x28fd07=parseInt(_0x13072b[_0xdfc6('0xfc')],0xa);var _0x305406=rs[_0xdfc6('0xfd')]({'charset':'*','length':_0x28fd07});var _0x43679f=_0x3e0cc2['length'];if(_0x43679f>0x0){if(_0x43679f>_0x28fd07){this['createSquareDetailsReport'][_0xdfc6('0x69')](this,_0x13072b,_0x13072b[_0xdfc6('0xfe')]===_0xdfc6('0xff')?_0x305406+_0x3e0cc2[_0xdfc6('0x100')](_0x28fd07):_0x3e0cc2['substr'](0x0,_0x43679f-_0x28fd07)+_0x305406);}else{this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x13072b,rs[_0xdfc6('0xfd')]({'charset':'*','length':_0x43679f}));}}else{this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x13072b,'');}}else{this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x13072b,_0x3e0cc2);}return _0x24c658;};AGIVertices[_0xdfc6('0x11')]['getsecretdigits']=function(_0x1f85c4){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x101'),_0x1f85c4[_0xdfc6('0x35')]));return this[_0xdfc6('0xc')](_0x1f85c4);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x102')]=function(_0x38b712){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x103'),_0x38b712[_0xdfc6('0x35')]));this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x38b712,_0x38b712['goalname']);return this['channel'][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('GOAL\x20%s',_0x38b712[_0xdfc6('0x104')]));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x105')]=function(_0x5815f7){logger['info'](util[_0xdfc6('0x27')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5815f7[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x5815f7[_0xdfc6('0x83')])||!this[_0xdfc6('0x7d')](_0x5815f7['aws_secret_access_key'])){return this[_0xdfc6('0xe')]['noop'](_0xdfc6('0x106'));}if(!this[_0xdfc6('0x7d')](_0x5815f7[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x107'),_0x5815f7['text']));var _0x5b3f27=this['awsPolly'][_0xdfc6('0x69')](this,_0x5815f7);if(_0x5b3f27){this['channel'][_0xdfc6('0x9d')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x5b3f27));var _0x163711=this['channel'][_0xdfc6('0xe7')](_0x5b3f27);try{fs['unlink'](_0x5b3f27+_0xdfc6('0xe8'));}catch(_0x4f51a9){logger[_0xdfc6('0x2b')](_0x4f51a9);}return _0x163711;}return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x5815f7,_0xdfc6('0x108'));};AGIVertices['prototype'][_0xdfc6('0x109')]=function(_0x5b721c){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x10a'),_0x5b721c[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x5b721c['aws_access_key_id'])||!this[_0xdfc6('0x7d')](_0x5b721c[_0xdfc6('0x84')])){return this[_0xdfc6('0xe')]['noop'](_0xdfc6('0x106'));}if(!this[_0xdfc6('0x7d')](_0x5b721c[_0xdfc6('0x10b')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x5b721c[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this[_0xdfc6('0xe')][_0xdfc6('0xd8')]=!![];this[_0xdfc6('0x33')](_0x5b721c);this[_0xdfc6('0x3f')](_0x5b721c['text'],'in');this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0x10c'),_0x5b721c[_0xdfc6('0x59')]));var _0x368d86=this[_0xdfc6('0x82')]['sync'](this,_0x5b721c);if(_0x368d86){for(var _0x1e6c1c in _0x368d86){if(_0x368d86['hasOwnProperty'](_0x1e6c1c)&&_['isString'](_0x368d86[_0x1e6c1c])){this['channel'][_0xdfc6('0x92')](util['format'](_0xdfc6('0x10d'),_0x1e6c1c[_0xdfc6('0xdb')]()),_0x368d86[_0x1e6c1c]);}}if(_[_0xdfc6('0x42')](_0x368d86['message'])){return this[_0xdfc6('0xe')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xdfc6('0x3f')](_0x368d86[_0xdfc6('0x72')],_0xdfc6('0xe5'));return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('Amazon\x20Lex\x20Result\x20%s',_0x368d86['message']));}}return this['channel'][_0xdfc6('0x2b')](_0x5b721c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x10e')]=function(_0x47d316){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x47d316[_0xdfc6('0x35')],_0x47d316['timeout']));if(!this[_0xdfc6('0x7d')](_0x47d316[_0xdfc6('0x75')])){return this[_0xdfc6('0xe')]['noop'](_0xdfc6('0xd7'));}var _0x4ee86a=_0xdfc6('0x10f');var _0x505ab3=util['format'](_0xdfc6('0x110'),FILES_PATH,rs['generate'](0x4));var _0x195b3e=util['format'](_0xdfc6('0x91'),_0x505ab3,_0x4ee86a);var _0x301b5e=!![];if(_0x47d316[_0xdfc6('0x111')]===_0xdfc6('0x112')){_0x301b5e=![];}var _0x56713d=this[_0xdfc6('0xe')]['recordFile'](_0x505ab3,_0x4ee86a,_0x47d316['intKey'],_0x47d316[_0xdfc6('0x62')],undefined,_0x301b5e);if(_0x56713d[_0xdfc6('0x96')]!==-0x1){this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0x113'),_0x195b3e));var _0x254889=this[_0xdfc6('0x85')]['sync'](this,_0x47d316,_0x195b3e);if(_0x254889){for(var _0x32764d in _0x254889){if(_0x254889['hasOwnProperty'](_0x32764d)){this['channel'][_0xdfc6('0x92')](util['format'](_0xdfc6('0x114'),_0x32764d['toUpperCase']()),_0x254889[_0x32764d]);}}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x115'),JSON[_0xdfc6('0x6d')](_0x254889)));}}return _0x56713d;};AGIVertices['prototype']['tildeasr']=function(_0x3edfdd){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x116'),_0x3edfdd[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x3edfdd[_0xdfc6('0x117')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x118'));}if(!this[_0xdfc6('0x7d')](_0x3edfdd[_0xdfc6('0x119')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x11a'));}var _0x2b07df='wav';var _0x5e8af8=util[_0xdfc6('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0xdfc6('0xfd')](0x4));var _0x234b7b=util[_0xdfc6('0x27')](_0xdfc6('0x91'),_0x5e8af8,_0x2b07df);var _0x31876e=!![];if(_0x3edfdd['beep']===_0xdfc6('0x112')){_0x31876e=![];}var _0x403719=this['channel'][_0xdfc6('0x11b')](_0x5e8af8,_0x2b07df,_0x3edfdd[_0xdfc6('0x11c')],_0x3edfdd['timeout'],undefined,_0x31876e);if(_0x403719[_0xdfc6('0x96')]!==-0x1){this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('tilde\x20%s\x20file\x20created',_0x234b7b));var _0x4baa59=this[_0xdfc6('0x86')]['sync'](this,_0x3edfdd,_0x234b7b);if(_0x4baa59){for(var _0x3d7616 in _0x4baa59){if(_0x4baa59['hasOwnProperty'](_0x3d7616)){this[_0xdfc6('0xe')]['setVariable'](util[_0xdfc6('0x27')](_0xdfc6('0x11d'),_0x3d7616[_0xdfc6('0xdb')]()),_0x4baa59[_0x3d7616]);}}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x11e'),JSON[_0xdfc6('0x6d')](_0x4baa59)));}}return _0x403719;};AGIVertices[_0xdfc6('0x11')]['gotoc']=function(_0x155cd4){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x11f'),_0x155cd4[_0xdfc6('0x35')]));return this[_0xdfc6('0xe')]['continueAt'](_0x155cd4[_0xdfc6('0x120')],_0x155cd4['extension'],_0x155cd4[_0xdfc6('0x3b')]);};AGIVertices[_0xdfc6('0x11')]['gotoif']=function(_0x23eed3){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x23eed3[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x23eed3[_0xdfc6('0x121')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x23eed3,_0xdfc6('0x122'));}try{var _0x2cfd2d=eval(_0x23eed3['condition'])?_0xdfc6('0x123'):_0xdfc6('0x124');this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x125'),_0x23eed3[_0xdfc6('0x121')],_0x2cfd2d));return{'code':0xc8,'result':_0x2cfd2d};}catch(_0x5da17e){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x126')]=function(_0x1104c7){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x127'),_0x1104c7[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x1104c7[_0xdfc6('0x128')])){return this[_0xdfc6('0xe')]['error'](_0x1104c7,_0xdfc6('0x129'));}var _0x4ad8af=this[_0xdfc6('0x22')][_0xdfc6('0x69')](this,_0x1104c7[_0xdfc6('0x128')]);if(!_0x4ad8af){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x1104c7,_0xdfc6('0x12a'));}for(var _0x1d5b6a=0x0;_0x1d5b6a<_0x4ad8af[_0xdfc6('0x8f')];_0x1d5b6a+=0x1){var _0x221a4b=this[_0xdfc6('0xe')][_0xdfc6('0x12')](util[_0xdfc6('0x27')](_0xdfc6('0x12b'),_0x4ad8af[_0x1d5b6a]));if(_0x221a4b[_0xdfc6('0x96')]===-0x1){return _0x221a4b;}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x12c'),_0x4ad8af[_0x1d5b6a],_0x221a4b['extra']));if(_0x221a4b[_0xdfc6('0x95')]===_0xdfc6('0x123')){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x12c'),_0x4ad8af[_0x1d5b6a],_0xdfc6('0x123')));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('IFTIME\x20%s\x20%s',_0x4ad8af[_0x1d5b6a],_0xdfc6('0x123')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x12c'),_0x4ad8af[_0x1d5b6a],_0xdfc6('0x124')));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x12c'),_0x4ad8af[_0x1d5b6a],'false'));}}return{'code':0xc8,'result':_0xdfc6('0x124')};};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x12d')]=function(_0x5eca70){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x12e'),_0x5eca70[_0xdfc6('0x35')]));return this[_0xdfc6('0xe')][_0xdfc6('0x12d')]();};AGIVertices['prototype'][_0xdfc6('0x12f')]=function(_0x5c6ecd){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x130'),_0x5c6ecd[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x5c6ecd[_0xdfc6('0x75')])){return this['channel']['noop'](_0xdfc6('0xd7'));}var _0x22edc6=_0xdfc6('0x10f');var _0x120c9f=util['format'](_0xdfc6('0x110'),FILES_PATH,rs[_0xdfc6('0xfd')](0x4));var _0x45ec61=util[_0xdfc6('0x27')](_0xdfc6('0x91'),_0x120c9f,_0x22edc6);var _0x5dd9f0=!![];if(_0x5c6ecd[_0xdfc6('0x111')]===_0xdfc6('0x112')){_0x5dd9f0=![];}var _0x55468f=this[_0xdfc6('0xe')][_0xdfc6('0x11b')](_0x120c9f,_0x22edc6,_0x5c6ecd[_0xdfc6('0x11c')],_0x5c6ecd[_0xdfc6('0x62')],undefined,_0x5dd9f0);if(_0x55468f[_0xdfc6('0x96')]!==-0x1){this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x131'),_0x45ec61));var _0x802ff6=this[_0xdfc6('0x7c')][_0xdfc6('0x69')](this,_0x5c6ecd,_0x45ec61);if(_0x802ff6){for(var _0x436a44 in _0x802ff6){if(_0x802ff6['hasOwnProperty'](_0x436a44)){this[_0xdfc6('0xe')][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0x132'),_0x436a44[_0xdfc6('0xdb')]()),_0x802ff6[_0x436a44]);}}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x133'),JSON[_0xdfc6('0x6d')](_0x802ff6)));}}return _0x55468f;};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x134')]=function(_0x3ec44d){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3ec44d['label']));if(!this['isConfigured'](_0x3ec44d[_0xdfc6('0x75')])){return this['channel'][_0xdfc6('0x9d')](_0xdfc6('0xd7'));}if(!this[_0xdfc6('0x7d')](_0x3ec44d[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('Trying\x20ispeech\x20TTS\x20%s',_0x3ec44d[_0xdfc6('0x59')]));var _0x4bf767=this['ispeechTTS']['sync'](this,_0x3ec44d);if(_0x4bf767){this[_0xdfc6('0xe')]['noop'](util['format'](_0xdfc6('0x131'),_0x4bf767));var _0x5c2676=this[_0xdfc6('0xe')][_0xdfc6('0xe7')](_0x4bf767,_0x3ec44d[_0xdfc6('0x11c')]);try{fs['unlink'](_0x4bf767+_0xdfc6('0xe8'));}catch(_0x44783a){logger[_0xdfc6('0x2b')](_0x44783a);}return _0x5c2676;}return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3ec44d,_0xdfc6('0x135'));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x136')]=function(_0xfda5e4){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x137'),_0xfda5e4[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0xfda5e4[_0xdfc6('0x138')])){return this['channel'][_0xdfc6('0x2b')](_0xfda5e4,_0xdfc6('0x139'));}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13a'),this[_0xdfc6('0xe')]['callerid'],_0xfda5e4[_0xdfc6('0x138')]));var _0x6b62d5=this[_0xdfc6('0x50')][_0xdfc6('0x69')](this,_0xfda5e4['findBy']);if(_0x6b62d5){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this['channel'][_0xdfc6('0x38')],_0xfda5e4[_0xdfc6('0x138')]));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0xfda5e4[_0xdfc6('0x138')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdfc6('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdfc6('0xe')]['callerid'],_0xfda5e4['findBy']));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13c'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0xfda5e4[_0xdfc6('0x138')]));return{'code':0xc8,'result':_0xdfc6('0x13d')};}};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x13e')]=function(_0x3731b6){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13f'),_0x3731b6[_0xdfc6('0x35')]));if(!this['isConfigured'](_0x3731b6[_0xdfc6('0x138')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x3731b6,_0xdfc6('0x139'));}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdfc6('0xe')]['callerid'],_0x3731b6[_0xdfc6('0x138')]));var _0x22a7bf=this[_0xdfc6('0x4f')][_0xdfc6('0x69')](this,_0x3731b6[_0xdfc6('0x138')]);if(_0x22a7bf){logger[_0xdfc6('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xdfc6('0x38')],_0x3731b6['findBy']));this[_0xdfc6('0xe')]['noop'](util['format'](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x3731b6[_0xdfc6('0x138')]));return{'code':0xc8,'result':'success'};}else{logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13c'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x3731b6[_0xdfc6('0x138')]));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13c'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x3731b6[_0xdfc6('0x138')]));return{'code':0xc8,'result':_0xdfc6('0x13d')};}};AGIVertices['prototype'][_0xdfc6('0x140')]=function(_0x29963e){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x141'),_0x29963e[_0xdfc6('0x35')]));if(!this['isConfigured'](_0x29963e[_0xdfc6('0x142')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x29963e,'no\x20operation\x20configured');}this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x143'),_0x29963e[_0xdfc6('0x142')]));var _0x1562fc=eval(_0x29963e['operation']);if(!this[_0xdfc6('0x7d')](_0x29963e[_0xdfc6('0xc8')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x144'));}var _0x1135a6=this[_0xdfc6('0x12')]['sync'](this,_0x29963e[_0xdfc6('0xc8')]);if(!_0x1135a6){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x29963e,_0xdfc6('0xc9'));}if(_['isArray'](_0x1562fc)){var _0x48b940=this;_0x1562fc[_0xdfc6('0xca')](function(_0x4b68a6,_0x1e6081){_0x48b940[_0xdfc6('0xe')][_0xdfc6('0x92')](util['format'](_0xdfc6('0x145'),_0x1135a6,_0x1e6081),_0x4b68a6);});return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x146'),_0x1135a6));}else{return this[_0xdfc6('0xe')][_0xdfc6('0x92')](_0x1135a6,_0x1562fc);}};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0xb')]=function(_0x10ea1a){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x147'),_0x10ea1a[_0xdfc6('0x35')]));if(_0x10ea1a[_0xdfc6('0x98')]===0x0){return this[_0xdfc6('0x97')](_0x10ea1a);}_0x10ea1a[_0xdfc6('0x98')]-=0x1;if(!this['isConfigured'](_0x10ea1a[_0xdfc6('0xf7')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x10ea1a,_0xdfc6('0xf8'));}var _0x120787=this['getSound']['sync'](this,_0x10ea1a['file_id']);if(!_0x120787){return this['channel'][_0xdfc6('0x2b')](_0x10ea1a,'no\x20file\x20audio\x20found');}var _0x145302=this['channel'][_0xdfc6('0x148')](_0x120787,_0x10ea1a['response'],_0x10ea1a[_0xdfc6('0x149')]);var _0x28ead3=_0x145302['result'];if(_0x145302[_0xdfc6('0x96')]===-0x1){this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x10ea1a,'-1');return _0x145302;}else if(_0x145302[_0xdfc6('0x95')]===_0xdfc6('0x62')){_0x145302[_0xdfc6('0x96')]=_0x145302[_0xdfc6('0x96')][_0xdfc6('0x8f')]>0x0?_0x145302[_0xdfc6('0x96')]:'t';}else if(_[_0xdfc6('0x41')](_0x145302[_0xdfc6('0x96')])){_0x145302[_0xdfc6('0x96')]='#';_0x28ead3='#';}if(!this[_0xdfc6('0x7d')](_0x10ea1a['variable_id'])){this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x144'));}else{var _0x38f606=this[_0xdfc6('0x12')][_0xdfc6('0x69')](this,_0x10ea1a['variable_id']);if(!_0x38f606){return this[_0xdfc6('0xe')]['error'](_0x10ea1a,_0xdfc6('0xc9'));}this[_0xdfc6('0xe')][_0xdfc6('0x92')](_0x38f606,_0x28ead3);}this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x10ea1a,_0x28ead3);return _0x145302;};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x9d')]=function(_0x5427bf){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x14a'),_0x5427bf[_0xdfc6('0x35')]));return this['channel'][_0xdfc6('0x9d')](_0x5427bf[_0xdfc6('0x14b')]||_0x5427bf[_0xdfc6('0x35')]);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x14c')]=function(_0x750436){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x14d'),_0x750436['label']));if(!this[_0xdfc6('0x7d')](_0x750436[_0xdfc6('0x138')])){return this['channel'][_0xdfc6('0x2b')](_0x750436,_0xdfc6('0x139'));}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xdfc6('0xe')]['callerid'],_0x750436[_0xdfc6('0x138')]));var _0x54015f=this[_0xdfc6('0x14e')][_0xdfc6('0x69')](this,_0x750436['pause_id']);var _0x4cd50a=this[_0xdfc6('0x4c')][_0xdfc6('0x69')](this,_0x750436[_0xdfc6('0x138')],_0x54015f);if(_0x4cd50a){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x750436[_0xdfc6('0x138')]));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x750436[_0xdfc6('0x138')]));return{'code':0xc8,'result':_0xdfc6('0x14f')};}else{logger[_0xdfc6('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x750436[_0xdfc6('0x138')]));this['channel'][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x750436[_0xdfc6('0x138')]));return{'code':0xc8,'result':_0xdfc6('0x13d')};}};AGIVertices['prototype'][_0xdfc6('0x150')]=function(_0x114c1c){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x151'),_0x114c1c[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x114c1c[_0xdfc6('0xf7')])){return this[_0xdfc6('0xe')]['error'](_0x114c1c,_0xdfc6('0xf8'));}var _0x202eb7=this[_0xdfc6('0x152')][_0xdfc6('0x69')](this,_0x114c1c[_0xdfc6('0xf7')]);if(!_0x202eb7){return this['channel'][_0xdfc6('0x2b')](_0x114c1c,'no\x20file\x20audio\x20found');}var _0x15893d=this[_0xdfc6('0xe')][_0xdfc6('0x54')]('PLAYBACK',[_0x202eb7,_0x114c1c[_0xdfc6('0xd3')]]);if(_0x15893d[_0xdfc6('0x96')]===-0x1){return _0x15893d;}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0xb8'),_0xdfc6('0x153'),_0x202eb7));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x154')]=function(_0x292611){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x155'),_0x292611[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x292611[_0xdfc6('0x156')])){return this['channel'][_0xdfc6('0x2b')](_0x292611,'no\x20queue\x20selected');}var _0x222f85='';var _0x2502b9=parseInt(_0x292611[_0xdfc6('0x156')],0xa);if(isNaN(_0x2502b9)){_0x222f85=_0x292611[_0xdfc6('0x156')];}else{_0x222f85=this[_0xdfc6('0x16')][_0xdfc6('0x69')](this,_0x292611['queue_id']);if(!_0x222f85){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x292611,_0xdfc6('0x157'));}}var _0x779975='';if(this[_0xdfc6('0x7d')](_0x292611[_0xdfc6('0xf7')])){var _0x5499b2=this[_0xdfc6('0x152')]['sync'](this,_0x292611[_0xdfc6('0xf7')]);if(_0x5499b2){_0x779975=_0x5499b2;}}this[_0xdfc6('0x33')]['sync'](this,_0x292611,_0x222f85);if(_0x292611[_0xdfc6('0xd3')]['indexOf']('x')<0x0){_0x292611[_0xdfc6('0xd3')]+='x';}if(_0x292611[_0xdfc6('0xd3')]['indexOf']('X')<0x0){_0x292611['opts']+='X';}this['channel'][_0xdfc6('0x92')](_0xdfc6('0x158'),_0x222f85?_0x222f85[_0xdfc6('0x159')]():'');var _0x38ddb0=this[_0xdfc6('0xe')]['exec']('QUEUE',[_0x222f85,_0x292611[_0xdfc6('0xd3')],_0x292611[_0xdfc6('0x60')],_0x779975,_0x292611['timeout'],_0x292611['agi'],_0x292611[_0xdfc6('0x15a')],_0x292611[_0xdfc6('0x15b')],'',_0x292611['position']]);if(_0x38ddb0['result']===-0x1){return _0x38ddb0;}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('Executed\x20command\x20%s\x20%s',_0xdfc6('0x15c'),_0x222f85));};AGIVertices['prototype'][_0xdfc6('0x15d')]=function(_0x6e99f0){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x15e'),_0x6e99f0[_0xdfc6('0x35')]));var _0x1c5f07=_0x6e99f0[_0xdfc6('0x15f')]||_0xdfc6('0x10f');var _0x50bcde=util['format'](_0xdfc6('0x160'),this['channel'][_0xdfc6('0x34')],rs[_0xdfc6('0xfd')](0x5));var _0x3ebc42=util[_0xdfc6('0x27')](_0xdfc6('0x161'),FILES_PATH,_0x50bcde,_0x1c5f07);var _0x3dc9db=util[_0xdfc6('0x27')](_0xdfc6('0x110'),FILES_PATH,_0x50bcde);this[_0xdfc6('0x37')][_0xdfc6('0x69')](this,_0x6e99f0,_0x50bcde,_0x3ebc42);this[_0xdfc6('0xe')][_0xdfc6('0x92')]('RECORDING_SAVENAME',_0x50bcde);logger['info'](_0xdfc6('0x162'),_0x3dc9db,_0x1c5f07,_0x6e99f0[_0xdfc6('0x163')],_0x6e99f0['timeout']);return this[_0xdfc6('0xe')]['recordFile'](_0x3dc9db,_0x1c5f07,_0x6e99f0[_0xdfc6('0x163')],_0x6e99f0['timeout'],undefined,!![]);};AGIVertices[_0xdfc6('0x11')]['restapi']=function(_0x494fbb){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x164'),_0x494fbb[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x494fbb['url'])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')]('no\x20url\x20configured');}var _0x1e3a0a=this[_0xdfc6('0x5f')][_0xdfc6('0x69')](this,_0x494fbb);logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x165'),util['inspect'](_0x1e3a0a,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x494fbb['variable_id'])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x166'));}var _0x3bcd3b=this['getVariable'][_0xdfc6('0x69')](this,_0x494fbb[_0xdfc6('0xc8')]);if(!_0x3bcd3b){return this['channel'][_0xdfc6('0x2b')](_0x494fbb,_0xdfc6('0xc9'));}this['channel'][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0x167'),_0x3bcd3b),_0x1e3a0a[_0xdfc6('0x70')]?_0x1e3a0a[_0xdfc6('0x70')]:_0xdfc6('0x168'));this[_0xdfc6('0xe')][_0xdfc6('0x92')](util[_0xdfc6('0x27')](_0xdfc6('0x169'),_0x3bcd3b),_0x1e3a0a['statusMessage']?_0x1e3a0a[_0xdfc6('0x71')]:'OK');if(_0x1e3a0a[_0xdfc6('0x6e')]){try{this[_0xdfc6('0x90')](_0x1e3a0a[_0xdfc6('0x6e')],_0x3bcd3b);}catch(_0x29121c){logger[_0xdfc6('0x2b')](util[_0xdfc6('0x27')](_0xdfc6('0x16a'),_0x3bcd3b));}}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0xcd'),_0x3bcd3b));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x16b')]=function(_0x1db14b){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x16c'),_0x1db14b['label']));return this[_0xdfc6('0xe')][_0xdfc6('0x16d')](_0x1db14b[_0xdfc6('0x16e')][_0xdfc6('0x56')](/\s+/g,''),_0x1db14b[_0xdfc6('0x163')]);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x16f')]=function(_0x188e05){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x170'),_0x188e05[_0xdfc6('0x35')]));return this[_0xdfc6('0xe')][_0xdfc6('0x171')](_0x188e05[_0xdfc6('0x63')][_0xdfc6('0x56')](/\s+/g,''),_0x188e05['escape_digits']);};AGIVertices['prototype'][_0xdfc6('0x172')]=function(_0x1c0e20){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x173'),_0x1c0e20[_0xdfc6('0x35')]));return this['channel'][_0xdfc6('0x174')](_0x1c0e20[_0xdfc6('0x59')],_0x1c0e20[_0xdfc6('0x163')]);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x175')]=function(_0x50f561){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x176'),_0x50f561[_0xdfc6('0x35')]));if(!this['isConfigured'](_0x50f561[_0xdfc6('0x177')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x178'));}var _0x41a876=this[_0xdfc6('0x20')]['sync'](this,_0x50f561['account_id']);if(!_0x41a876||!_0x41a876[_0xdfc6('0x179')]){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x50f561,'no\x20mail\x20account\x20found');}var _0x2a35ab={'from':util[_0xdfc6('0x27')](_0xdfc6('0x17a'),_0x41a876['name'],_0x41a876[_0xdfc6('0x17b')]||_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x17c')]),'to':_0x50f561['to']||'','cc':_0x50f561['cc']||'','bcc':_0x50f561['bcc']||'','subject':_0x50f561[_0xdfc6('0x17d')],'html':_0x50f561[_0xdfc6('0x59')],'text':_0x50f561['text']};var _0x346a72={'tls':{'rejectUnauthorized':![]}};if(_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x17e')]){_0x346a72[_0xdfc6('0x17e')]=_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x17e')];}else{_0x346a72[_0xdfc6('0x17f')]=_0x41a876[_0xdfc6('0x179')]['host'];_0x346a72['port']=_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x180')];_0x346a72[_0xdfc6('0x181')]=_0x41a876[_0xdfc6('0x179')]['secure'];}if(_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x182')]){_0x346a72[_0xdfc6('0x183')]={'user':_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x17c')],'pass':_0x41a876[_0xdfc6('0x179')][_0xdfc6('0x184')]};}if(this['isConfigured'](_0x50f561[_0xdfc6('0x185')])){}logger[_0xdfc6('0xcf')](_0xdfc6('0x186'),JSON['stringify'](_0x2a35ab));this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x50f561,_0x50f561['account_id']);this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0x187'),_0x41a876[_0xdfc6('0x18')]));this[_0xdfc6('0x21')][_0xdfc6('0x69')](this,_0x346a72,_0x2a35ab);return this['channel'][_0xdfc6('0x9d')](_0xdfc6('0x188'));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x189')]=function(_0x11494b){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x18a'),_0x11494b['label']));return this[_0xdfc6('0xe')]['noop'](_0xdfc6('0x18b'));};AGIVertices['prototype']['sendSMS']=function(_0x2b8ae4){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x18c'),_0x2b8ae4[_0xdfc6('0x35')]));if(!this['isConfigured'](_0x2b8ae4[_0xdfc6('0x18d')])){return this['channel'][_0xdfc6('0x9d')](_0xdfc6('0x18e'));}var _0x637b5f=this['getSmsAccount'][_0xdfc6('0x69')](this,_0x2b8ae4['sms_account_id']);if(!_0x637b5f){return this[_0xdfc6('0xe')]['error'](_0x2b8ae4,'no\x20sms\x20account\x20found');}var _0x5b0ffd={'body':_0x2b8ae4[_0xdfc6('0x18f')],'phone':_0x2b8ae4['to']||'','SmsAccountId':_0x637b5f['id']};logger[_0xdfc6('0xcf')](_0xdfc6('0x190'),JSON[_0xdfc6('0x6d')](_0x5b0ffd));this['createSquareDetailsReport'][_0xdfc6('0x69')](this,_0x2b8ae4,_0x2b8ae4['sms_account_id']);this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x191'),_0x637b5f['name']));this['createSmsMessage'][_0xdfc6('0x69')](this,_0x5b0ffd);return this['channel'][_0xdfc6('0x9d')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x192')]=function(_0x212f33){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x193'),_0x212f33[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x212f33[_0xdfc6('0xc8')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x212f33,_0xdfc6('0x194'));}var _0x5d315b=this['getVariable'][_0xdfc6('0x69')](this,_0x212f33[_0xdfc6('0xc8')]);if(!_0x5d315b){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x212f33,'no\x20variable\x20found');}return this['channel'][_0xdfc6('0x92')](_0x5d315b,_0x212f33[_0xdfc6('0x195')]);};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x196')]=function(_0x2868ea){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x197'),_0x2868ea['label']));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x198'));if(_0x2868ea['answer']===_0xdfc6('0x199')){this[_0xdfc6('0xe')][_0xdfc6('0x9d')]('Answer');return this[_0xdfc6('0xe')][_0xdfc6('0xad')]();}return this['channel'][_0xdfc6('0x9d')](_0xdfc6('0x19a'));};AGIVertices[_0xdfc6('0x11')]['subproject']=function(_0x1b87c1){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1b87c1[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x1b87c1[_0xdfc6('0x19b')])){return this['channel'][_0xdfc6('0x2b')](_0x1b87c1,_0xdfc6('0x19c'));}var _0x3e25eb=this[_0xdfc6('0x19')][_0xdfc6('0x69')](this,_0x1b87c1[_0xdfc6('0x19b')]);if(!this[_0xdfc6('0x7d')](_0x3e25eb)){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x1b87c1,util['format'](_0xdfc6('0x19d'),_0x1b87c1[_0xdfc6('0x19b')]));}if(_0x3e25eb===this[_0xdfc6('0xe')][_0xdfc6('0x3d')]){return this[_0xdfc6('0xe')]['error'](_0x1b87c1,_0xdfc6('0x19e'));}this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x1b87c1,_0x3e25eb);var _0x13340d=this[_0xdfc6('0xe')][_0xdfc6('0x54')](_0xdfc6('0x19f'),util[_0xdfc6('0x27')](_0xdfc6('0x1a0'),config[_0xdfc6('0xaa')][_0xdfc6('0x17f')]||_0xdfc6('0x1a1'),_0x3e25eb,this[_0xdfc6('0xe')][_0xdfc6('0x3d')]));if(_0x13340d[_0xdfc6('0x96')]===-0x1){return _0x13340d;}return this[_0xdfc6('0xe')]['noop'](util[_0xdfc6('0x27')](_0xdfc6('0xb8'),_0xdfc6('0x19f'),_0x3e25eb));};AGIVertices['prototype'][_0xdfc6('0x1a2')]=function(_0x17806f){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x1a3'),_0x17806f[_0xdfc6('0x35')]));var _0x316520=this['shellCommand'][_0xdfc6('0x69')](this,_0x17806f[_0xdfc6('0xab')]);this[_0xdfc6('0x33')][_0xdfc6('0x69')](this,_0x17806f,_0x17806f[_0xdfc6('0xab')]);if(this[_0xdfc6('0x7d')](_0x17806f['variable_id'])){var _0x2f4251=this[_0xdfc6('0x12')][_0xdfc6('0x69')](this,_0x17806f[_0xdfc6('0xc8')]);if(_0x2f4251){this[_0xdfc6('0xe')][_0xdfc6('0x92')](_0x2f4251,_0x316520);return this['channel'][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x1a4'),_0x17806f[_0xdfc6('0xab')],_0x2f4251));}}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x1a5'),_0x17806f['command']));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1a6')]=function(_0x4a3cdc){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x1a7'),_0x4a3cdc[_0xdfc6('0x35')]));_0x4a3cdc[_0xdfc6('0x59')]=_0x4a3cdc['text'][_0xdfc6('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdfc6('0x7d')](_0x4a3cdc['apiKey'])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x1a8'));}if(!this[_0xdfc6('0x7d')](_0x4a3cdc[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this['channel'][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x1a9'),_0x4a3cdc['text']));var _0x5f27fa=this[_0xdfc6('0x57')][_0xdfc6('0x69')](this,_0x4a3cdc);if(_0x5f27fa){this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5f27fa));var _0x2c8c0a=this[_0xdfc6('0xe')][_0xdfc6('0xe7')](_0x5f27fa);try{fs[_0xdfc6('0x1aa')](_0x5f27fa+_0xdfc6('0xe8'));}catch(_0x156851){logger[_0xdfc6('0x2b')](_0x156851);}return _0x2c8c0a;}return this['channel'][_0xdfc6('0x2b')](_0x4a3cdc,_0xdfc6('0x1ab'));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1ac')]=function(_0x57f5c5){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x57f5c5[_0xdfc6('0x35')]));_0x57f5c5['text']=_0x57f5c5[_0xdfc6('0x59')][_0xdfc6('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xdfc6('0x7d')](_0x57f5c5[_0xdfc6('0x59')])){return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](_0xdfc6('0x9a'));}this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x1ad'),_0x57f5c5[_0xdfc6('0x59')]));var _0x3dd640=this[_0xdfc6('0x5e')][_0xdfc6('0x69')](this,_0x57f5c5);if(_0x3dd640){this['channel'][_0xdfc6('0x9d')](util['format'](_0xdfc6('0x1ae'),_0x3dd640));var _0x385e03=this['channel']['streamFile'](_0x3dd640);try{fs[_0xdfc6('0x1aa')](_0x3dd640+'.wav');}catch(_0x30d712){logger['error'](_0x30d712);}return _0x385e03;}return this['channel'][_0xdfc6('0x2b')](_0x57f5c5,_0xdfc6('0x1af'));};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1b0')]=function(_0x243af6){logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x1b1'),_0x243af6[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0x243af6[_0xdfc6('0x138')])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0x243af6,_0xdfc6('0x139'));}logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13a'),this['channel'][_0xdfc6('0x38')],_0x243af6[_0xdfc6('0x138')]));var _0x37562c=this[_0xdfc6('0x4e')][_0xdfc6('0x69')](this,_0x243af6[_0xdfc6('0x138')]);if(_0x37562c){logger['info'](util['format'](_0xdfc6('0x13b'),this['channel'][_0xdfc6('0x38')],_0x243af6[_0xdfc6('0x138')]));this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13b'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x243af6[_0xdfc6('0x138')]));return{'code':0xc8,'result':_0xdfc6('0x14f')};}else{logger[_0xdfc6('0x2c')](util[_0xdfc6('0x27')](_0xdfc6('0x13c'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x243af6[_0xdfc6('0x138')]));this['channel'][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0x13c'),this[_0xdfc6('0xe')][_0xdfc6('0x38')],_0x243af6['findBy']));return{'code':0xc8,'result':_0xdfc6('0x13d')};}};AGIVertices[_0xdfc6('0x11')][_0xdfc6('0x1b2')]=function(_0x2cdc2c){logger['info'](util[_0xdfc6('0x27')](_0xdfc6('0x1b3'),_0x2cdc2c['label']));var _0x22a098=this[_0xdfc6('0xe')][_0xdfc6('0x54')](_0xdfc6('0x1b4'),[_0x2cdc2c[_0xdfc6('0x1b5')],_0x2cdc2c['options']]);if(_0x22a098['result']===-0x1){return _0x22a098;}return this[_0xdfc6('0xe')][_0xdfc6('0x9d')](util[_0xdfc6('0x27')](_0xdfc6('0xb8'),_0xdfc6('0x1b4'),_0x2cdc2c['mailbox']));};AGIVertices[_0xdfc6('0x11')]['vswitch']=function(_0xe951a8){logger[_0xdfc6('0x2c')](util['format'](_0xdfc6('0x1b6'),_0xe951a8[_0xdfc6('0x35')]));if(!this[_0xdfc6('0x7d')](_0xe951a8['variable_id'])){return this[_0xdfc6('0xe')][_0xdfc6('0x2b')](_0xe951a8,_0xdfc6('0x194'));}var _0x1c9d3e=this[_0xdfc6('0x12')][_0xdfc6('0x69')](this,_0xe951a8[_0xdfc6('0xc8')]);if(!_0x1c9d3e){return this['channel'][_0xdfc6('0x2b')](_0xe951a8,'no\x20variable\x20found');}var _0x47d794=this[_0xdfc6('0xe')][_0xdfc6('0x12')](_0x1c9d3e);return{'code':0xc8,'result':_0x47d794[_0xdfc6('0x95')]?_0x47d794[_0xdfc6('0x95')]:'-'};};String[_0xdfc6('0x11')]['replaceAll']=function(_0x1ec8f4,_0x2063e2){return this[_0xdfc6('0x94')](_0x1ec8f4)['join'](_0x2063e2);};module[_0xdfc6('0x1b7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 84cb546..c3b64ff 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 _0x7217=['then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','stopAcw','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause'];(function(_0x478f36,_0x4e0e92){var _0x5e0a83=function(_0x60cd3b){while(--_0x60cd3b){_0x478f36['push'](_0x478f36['shift']());}};_0x5e0a83(++_0x4e0e92);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var util=require(_0x7721('0x0'));var _=require('lodash');var moment=require(_0x7721('0x1'));var ami=require(_0x7721('0x2'));var logger=require(_0x7721('0x3'))(_0x7721('0x4'));var RpcUser=require(_0x7721('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x5bf160){this[_0x7721('0x6')]=_0x5bf160[_0x7721('0x6')];this[_0x7721('0x7')]=_0x5bf160[_0x7721('0x7')];this[_0x7721('0x8')]=_0x5bf160[_0x7721('0x8')];this[_0x7721('0x9')]={};ami['on'](_0x7721('0xa'),this[_0x7721('0xb')][_0x7721('0xc')](this));ami['on'](_0x7721('0xd'),this[_0x7721('0xe')][_0x7721('0xc')](this));ami['on'](_0x7721('0xf'),this[_0x7721('0x10')]['bind'](this));ami['on'](_0x7721('0x11'),this[_0x7721('0x12')][_0x7721('0xc')](this));ami['on'](_0x7721('0x13'),this[_0x7721('0x14')][_0x7721('0xc')](this));ami['on'](_0x7721('0x15'),this[_0x7721('0x16')]['bind'](this));ami['on'](_0x7721('0x17'),this[_0x7721('0x18')]['bind'](this));}function getDiff(_0x109900){var _0x30da54=moment()[_0x7721('0x19')](0x0);var _0x2e9752=moment(_0x109900)['milliseconds'](0x0);return _0x30da54[_0x7721('0x1a')](_0x2e9752,_0x7721('0x1b'));}Acw['prototype']['startAcw']=function(_0x4b183e){try{var _0x5ed54=this;var _0x25a628=this[_0x7721('0x9')][_0x4b183e][_0x7721('0x1c')];var _0x5ed94b=this[_0x7721('0x9')][_0x4b183e]['queue'];var _0x3fc09e=this['voiceQueues'][_0x5ed94b];var _0xfec626=![];var _0x4e96fb=_0x7721('0x1d');if(_0x3fc09e[_0x7721('0x1e')]){if(_0x3fc09e[_0x7721('0x1f')][_0x7721('0x20')]){_0xfec626=!![];_0x4e96fb=_0x3fc09e[_0x7721('0x1f')][_0x7721('0x20')];}}ami[_0x7721('0x21')]({'action':_0x7721('0x22'),'interface':_0x25a628,'paused':!![],'reason':_0x4e96fb})['then'](function(_0x288f7e){if(_0x5ed54[_0x7721('0x7')][_0x25a628]){return RpcUser[_0x7721('0x23')](_0x5ed54[_0x7721('0x7')][_0x25a628]['id'])['then'](function(_0x28f5a6){if(_0x28f5a6&&!_0x28f5a6['voicePause']){logger[_0x7721('0x24')](_0x7721('0x25'),_0x4b183e,_0x25a628,_0x5ed94b);var _0x3e8a4e=_0x5ed54[_0x7721('0x9')][_0x4b183e][_0x7721('0x26')]&&_0x5ed54[_0x7721('0x9')][_0x4b183e][_0x7721('0x27')]?_0x5ed54['channels'][_0x4b183e][_0x7721('0x27')]:_0x4b183e;return RpcUser[_0x7721('0x28')](_0x5ed54[_0x7721('0x7')][_0x25a628],_0x4e96fb,_0x3e8a4e)[_0x7721('0x29')](function(_0x40d550){if(!_0xfec626){_0x5ed54[_0x7721('0x8')][_0x25a628]={};logger[_0x7721('0x24')](_0x7721('0x2a'),_0x4b183e,_0x5ed54[_0x7721('0x6')][_0x5ed94b]['acwTimeout'],_0x25a628,_0x5ed94b);_0x5ed54[_0x7721('0x8')][_0x25a628]['timer']=setTimeout(_0x5ed54['stopAcw'][_0x7721('0xc')](_0x5ed54,_0x25a628),_0x5ed54[_0x7721('0x6')][_0x5ed94b][_0x7721('0x2b')]*0x3e8);_0x5ed54[_0x7721('0x8')][_0x25a628][_0x7721('0x2c')]=moment()[_0x7721('0x2d')](_0x7721('0x2e'));_0x5ed54[_0x7721('0x8')][_0x25a628]['uniqueid']=_0x4b183e;_0x5ed54[_0x7721('0x8')][_0x25a628][_0x7721('0x2f')]=_0x5ed94b;_0x5ed54['timers'][_0x25a628]['updateAcw']=function(){var _0xfde9ec=getDiff(_0x5ed54[_0x7721('0x8')][_0x25a628]['lastPauseAt']);clearTimeout(_0x5ed54[_0x7721('0x8')][_0x25a628][_0x7721('0x30')]);_0x5ed54[_0x7721('0x8')][_0x25a628]['timer']=![];RpcVoiceAgentReport[_0x7721('0x31')]({'acwtime':_0xfde9ec},_0x5ed54[_0x7721('0x8')][_0x25a628][_0x7721('0x32')],_0x25a628)[_0x7721('0x29')](function(_0xc0f3c4){logger['info'](_0x7721('0x33'),_0x4b183e,_0xfde9ec,_0xc0f3c4);})[_0x7721('0x34')](function(_0xb2386d){logger['error'](_0x7721('0x35'),_0x4b183e,_0xb2386d);});delete _0x5ed54[_0x7721('0x8')][_0x25a628];};}});}else{logger['info'](_0x7721('0x36'),_0x4b183e,_0x25a628,_0x5ed94b);}});}})['catch'](function(_0x2d6ba0){logger[_0x7721('0x37')](_0x7721('0x2a'),_0x4b183e,_0x5ed54[_0x7721('0x6')][_0x5ed94b][_0x7721('0x2b')],_0x25a628,_0x5ed94b);})[_0x7721('0x38')](function(){delete _0x5ed54[_0x7721('0x9')][_0x4b183e];});}catch(_0x15545a){logger[_0x7721('0x37')](_0x7721('0x39'),_0x15545a[_0x7721('0x3a')]);}};Acw['prototype'][_0x7721('0x3b')]=function(_0x5e6663){try{var _0x212384=this;if(_0x212384[_0x7721('0x8')][_0x5e6663]){_0x212384[_0x7721('0x8')][_0x5e6663][_0x7721('0x30')]=![];var _0x3968f3=_0x212384[_0x7721('0x8')][_0x5e6663]['uniqueid'];var _0x557c34=_0x212384['timers'][_0x5e6663]['queue'];var _0x18001c=_0x212384[_0x7721('0x6')][_0x557c34][_0x7721('0x2b')];logger[_0x7721('0x24')]('[TIMER][STOP][AGENT:%s]',_0x5e6663);RpcUser[_0x7721('0x3c')](this['agents'][_0x5e6663]);RpcVoiceAgentReport[_0x7721('0x31')]({'acwtime':_0x18001c,'agentacw':!![]},_0x3968f3,_0x5e6663)[_0x7721('0x29')](function(_0x5a278e){logger[_0x7721('0x24')](_0x7721('0x33'),_0x3968f3,_0x18001c,_0x5a278e);})['catch'](function(_0x4d0111){logger[_0x7721('0x37')](_0x7721('0x35'),_0x3968f3,_0x4d0111);});}else{logger[_0x7721('0x37')](_0x7721('0x3d'),_0x5e6663);if(_0x212384['timers']){logger[_0x7721('0x24')](_0x7721('0x3e'),JSON[_0x7721('0x3f')](_0x212384[_0x7721('0x8')]));}}}catch(_0x196051){logger['error'](_0x7721('0x40'),_0x196051['message']);}};Acw[_0x7721('0x41')]['syncAgentConnect']=function(_0x2333b8){try{if(this[_0x7721('0x6')][_0x2333b8[_0x7721('0x2f')]]&&(this['voiceQueues'][_0x2333b8[_0x7721('0x2f')]][_0x7721('0x4')]||this[_0x7721('0x6')][_0x2333b8['queue']][_0x7721('0x1e')])){if(this[_0x7721('0x7')][_0x2333b8[_0x7721('0x1c')]]){this[_0x7721('0x9')][_0x2333b8[_0x7721('0x32')]]={'queue':_0x2333b8[_0x7721('0x2f')],'interface':_0x2333b8[_0x7721('0x1c')],'destlinkedid':_0x2333b8['destlinkedid']};}}}catch(_0x479698){logger[_0x7721('0x37')](_0x7721('0x42'),_0x479698[_0x7721('0x3a')]);}};Acw[_0x7721('0x41')][_0x7721('0x18')]=function(_0x15181b){try{if(this[_0x7721('0x6')][_0x15181b[_0x7721('0x2f')]]&&(this[_0x7721('0x6')][_0x15181b[_0x7721('0x2f')]]['acw']||this['voiceQueues'][_0x15181b[_0x7721('0x2f')]][_0x7721('0x1e')])){if(this[_0x7721('0x7')][_0x15181b[_0x7721('0x1c')]]){this['channels'][_0x15181b[_0x7721('0x32')]]={'queue':_0x15181b[_0x7721('0x2f')],'interface':_0x15181b['interface']};}}}catch(_0x330fac){logger['error'](_0x7721('0x43'),_0x330fac['message']);}};Acw[_0x7721('0x41')][_0x7721('0xe')]=function(_0xf17c40){try{if(this['channels'][_0xf17c40[_0x7721('0x32')]]&&_[_0x7721('0x44')](this['channels'][_0xf17c40[_0x7721('0x32')]][_0x7721('0x26')])){logger[_0x7721('0x24')]('[%s][HANGUP:UNIQUEID]',_0xf17c40[_0x7721('0x32')]);this['startAcw'](_0xf17c40[_0x7721('0x32')]);}else if(this[_0x7721('0x9')][_0xf17c40[_0x7721('0x45')]]&&_[_0x7721('0x44')](this[_0x7721('0x9')][_0xf17c40[_0x7721('0x45')]][_0x7721('0x26')])){logger[_0x7721('0x24')](_0x7721('0x46'),_0xf17c40[_0x7721('0x45')]);this[_0x7721('0x47')](_0xf17c40[_0x7721('0x45')]);}}catch(_0x24b17d){logger[_0x7721('0x37')](_0x7721('0x48'),_0x24b17d['message']);}};Acw[_0x7721('0x41')][_0x7721('0x10')]=function(_0x8e1214){try{if(this[_0x7721('0x9')][_0x8e1214[_0x7721('0x32')]]&&this[_0x7721('0x9')][_0x8e1214[_0x7721('0x32')]]['attended']){logger[_0x7721('0x24')](_0x7721('0x49'),_0x8e1214[_0x7721('0x32')]);this[_0x7721('0x47')](_0x8e1214[_0x7721('0x32')]);}else if(this[_0x7721('0x9')][_0x8e1214[_0x7721('0x45')]]&&this[_0x7721('0x9')][_0x8e1214[_0x7721('0x45')]][_0x7721('0x26')]){logger[_0x7721('0x24')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x8e1214[_0x7721('0x45')]);this[_0x7721('0x47')](_0x8e1214[_0x7721('0x45')]);}}catch(_0x2ee3c0){logger[_0x7721('0x37')](_0x7721('0x4a'),_0x2ee3c0[_0x7721('0x3a')]);}};Acw[_0x7721('0x41')][_0x7721('0x14')]=function(_0x287452){try{if(!_[_0x7721('0x4b')](this[_0x7721('0x9')][_0x287452[_0x7721('0x4c')]])){this[_0x7721('0x47')](_0x287452[_0x7721('0x4c')]);if(this['channels'][_0x287452['secondtransfereruniqueid']]){this['channels'][_0x287452[_0x7721('0x4d')]]['attended']=!![];this['channels'][_0x287452['transfertargetuniqueid']]=this['channels'][_0x287452[_0x7721('0x4d')]];delete this[_0x7721('0x9')][_0x287452[_0x7721('0x4d')]];}}else if(!_['isNil'](this[_0x7721('0x9')][_0x287452['transfertargetuniqueid']])){this['startAcw'](_0x287452['transfertargetuniqueid']);if(this[_0x7721('0x9')][_0x287452['origtransfereruniqueid']]){this['channels'][_0x287452['origtransfereruniqueid']][_0x7721('0x26')]=!![];this[_0x7721('0x9')][_0x287452[_0x7721('0x4c')]]=this['channels'][_0x287452[_0x7721('0x4e')]];delete this[_0x7721('0x9')][_0x287452[_0x7721('0x4e')]];}}}catch(_0x168343){logger[_0x7721('0x37')](_0x7721('0x4f'),_0x168343[_0x7721('0x3a')]);}};Acw[_0x7721('0x41')][_0x7721('0x16')]=function(_0x197b73){try{if(this[_0x7721('0x9')][_0x197b73[_0x7721('0x50')]]){logger[_0x7721('0x24')](_0x7721('0x51'),JSON[_0x7721('0x3f')](_0x197b73['transfereruniqueid']));this[_0x7721('0x47')](_0x197b73[_0x7721('0x50')]);}else if(this[_0x7721('0x9')][_0x197b73[_0x7721('0x52')]]){logger['info'](_0x7721('0x53'),JSON[_0x7721('0x3f')](_0x197b73['transfererlinkedid']));this[_0x7721('0x47')](_0x197b73['transfererlinkedid']);}}catch(_0x1f508d){logger[_0x7721('0x37')](_0x7721('0x54'),_0x1f508d[_0x7721('0x3a')]);}};Acw[_0x7721('0x41')][_0x7721('0x12')]=function(_0x3121e0){try{if(this[_0x7721('0x6')][_0x3121e0[_0x7721('0x2f')]]&&this['voiceQueues'][_0x3121e0[_0x7721('0x2f')]][_0x7721('0x55')]===_0x7721('0x56')){if(this[_0x7721('0x7')][_0x3121e0[_0x7721('0x1c')]]){logger[_0x7721('0x24')](_0x7721('0x57'),_0x3121e0['uniqueid'],_0x3121e0[_0x7721('0x1c')],_0x3121e0[_0x7721('0x2f')]);return RpcUser['savePause'](this[_0x7721('0x7')][_0x3121e0['interface']],_0x7721('0x58'),_0x3121e0[_0x7721('0x32')]);}}}catch(_0x4282ba){logger[_0x7721('0x37')](_0x7721('0x59'),_0x4282ba[_0x7721('0x3a')]);}};module[_0x7721('0x5a')]=Acw; \ No newline at end of file +var _0xeec6=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','interface','attended','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncAgentRingNoAnswer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid'];(function(_0xcea800,_0x5861bd){var _0xe8de46=function(_0x5f1591){while(--_0x5f1591){_0xcea800['push'](_0xcea800['shift']());}};_0xe8de46(++_0x5861bd);}(_0xeec6,0x1c2));var _0x6eec=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0xeec6[_0x540160];return _0x476120;};'use strict';var util=require(_0x6eec('0x0'));var _=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var ami=require(_0x6eec('0x3'));var logger=require('../../../config/logger')(_0x6eec('0x4'));var RpcUser=require(_0x6eec('0x5'));var RpcVoiceAgentReport=require(_0x6eec('0x6'));function Acw(_0x2d7a15){this[_0x6eec('0x7')]=_0x2d7a15[_0x6eec('0x7')];this['agents']=_0x2d7a15[_0x6eec('0x8')];this[_0x6eec('0x9')]=_0x2d7a15['timers'];this[_0x6eec('0xa')]={};ami['on'](_0x6eec('0xb'),this[_0x6eec('0xc')][_0x6eec('0xd')](this));ami['on']('hanguprequest',this[_0x6eec('0xe')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0xf'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x6eec('0x10')][_0x6eec('0xd')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6eec('0xd')](this));ami['on']('blindtransfer',this[_0x6eec('0x11')][_0x6eec('0xd')](this));ami['on'](_0x6eec('0x12'),this[_0x6eec('0x13')][_0x6eec('0xd')](this));}function getDiff(_0x49fccb){var _0x25e2a5=moment()[_0x6eec('0x14')](0x0);var _0x462dbb=moment(_0x49fccb)[_0x6eec('0x14')](0x0);return _0x25e2a5[_0x6eec('0x15')](_0x462dbb,_0x6eec('0x16'));}Acw[_0x6eec('0x17')][_0x6eec('0x18')]=function(_0x34a7fc){try{var _0x2ac797=this;var _0x5e2a9b=this[_0x6eec('0xa')][_0x34a7fc]['interface'];var _0x38c9a4=this[_0x6eec('0xa')][_0x34a7fc]['queue'];var _0x3ee353=this[_0x6eec('0x7')][_0x38c9a4];var _0xb1eab7=![];var _0x56c78b=_0x6eec('0x19');if(_0x3ee353[_0x6eec('0x1a')]){if(_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')]){_0xb1eab7=!![];_0x56c78b=_0x3ee353[_0x6eec('0x1b')][_0x6eec('0x1c')];}}ami['Action']({'action':_0x6eec('0x1d'),'interface':_0x5e2a9b,'paused':!![],'reason':_0x56c78b})[_0x6eec('0x1e')](function(_0x132652){if(_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]){return RpcUser[_0x6eec('0x1f')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b]['id'])['then'](function(_0x6e40b3){if(_0x6e40b3&&!_0x6e40b3[_0x6eec('0x20')]){logger[_0x6eec('0x21')](_0x6eec('0x22'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);var _0x409b26=_0x2ac797[_0x6eec('0xa')][_0x34a7fc]['attended']&&_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]?_0x2ac797[_0x6eec('0xa')][_0x34a7fc][_0x6eec('0x23')]:_0x34a7fc;return RpcUser[_0x6eec('0x24')](_0x2ac797[_0x6eec('0x8')][_0x5e2a9b],_0x56c78b,_0x409b26)[_0x6eec('0x1e')](function(_0x20bed3){if(!_0xb1eab7){_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]={};logger['info'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']=setTimeout(_0x2ac797[_0x6eec('0x27')][_0x6eec('0xd')](_0x2ac797,_0x5e2a9b),_0x2ac797['voiceQueues'][_0x38c9a4]['acwTimeout']*0x3e8);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']=moment()[_0x6eec('0x28')](_0x6eec('0x29'));_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2a')]=_0x34a7fc;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2b')]=_0x38c9a4;_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2c')]=function(){var _0x1abd19=getDiff(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['lastPauseAt']);clearTimeout(_0x2ac797[_0x6eec('0x9')][_0x5e2a9b]['timer']);_0x2ac797[_0x6eec('0x9')][_0x5e2a9b][_0x6eec('0x2d')]=![];RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x1abd19},_0x2ac797['timers'][_0x5e2a9b]['uniqueid'],_0x5e2a9b)['then'](function(_0x183ce3){logger[_0x6eec('0x21')](_0x6eec('0x2f'),_0x34a7fc,_0x1abd19,_0x183ce3);})[_0x6eec('0x30')](function(_0x20c794){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x34a7fc,_0x20c794);});delete _0x2ac797[_0x6eec('0x9')][_0x5e2a9b];};}});}else{logger[_0x6eec('0x21')](_0x6eec('0x33'),_0x34a7fc,_0x5e2a9b,_0x38c9a4);}});}})[_0x6eec('0x30')](function(_0x4382df){logger['error'](_0x6eec('0x25'),_0x34a7fc,_0x2ac797[_0x6eec('0x7')][_0x38c9a4][_0x6eec('0x26')],_0x5e2a9b,_0x38c9a4);})['finally'](function(){delete _0x2ac797[_0x6eec('0xa')][_0x34a7fc];});}catch(_0x193732){logger[_0x6eec('0x31')](_0x6eec('0x34'),_0x193732[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')]['stopAcw']=function(_0x45cfb6){try{var _0x1f10ff=this;if(_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]){_0x1f10ff['timers'][_0x45cfb6]['timer']=![];var _0x28e5fa=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6][_0x6eec('0x2a')];var _0x3f79d1=_0x1f10ff[_0x6eec('0x9')][_0x45cfb6]['queue'];var _0x223dfa=_0x1f10ff[_0x6eec('0x7')][_0x3f79d1][_0x6eec('0x26')];logger[_0x6eec('0x21')](_0x6eec('0x36'),_0x45cfb6);RpcUser[_0x6eec('0x37')](this[_0x6eec('0x8')][_0x45cfb6]);RpcVoiceAgentReport[_0x6eec('0x2e')]({'acwtime':_0x223dfa,'agentacw':!![]},_0x28e5fa,_0x45cfb6)['then'](function(_0x2f7a75){logger[_0x6eec('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x28e5fa,_0x223dfa,_0x2f7a75);})['catch'](function(_0x160fc0){logger[_0x6eec('0x31')](_0x6eec('0x32'),_0x28e5fa,_0x160fc0);});}else{logger[_0x6eec('0x31')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x45cfb6);if(_0x1f10ff['timers']){logger[_0x6eec('0x21')]('[ACW][TIMERS]',JSON['stringify'](_0x1f10ff[_0x6eec('0x9')]));}}}catch(_0xe523b9){logger[_0x6eec('0x31')](_0x6eec('0x38'),_0xe523b9[_0x6eec('0x35')]);}};Acw['prototype'][_0x6eec('0xc')]=function(_0x3a4d25){try{if(this['voiceQueues'][_0x3a4d25[_0x6eec('0x2b')]]&&(this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x4')]||this[_0x6eec('0x7')][_0x3a4d25['queue']][_0x6eec('0x1a')])){if(this[_0x6eec('0x8')][_0x3a4d25[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3a4d25['uniqueid']]={'queue':_0x3a4d25[_0x6eec('0x2b')],'interface':_0x3a4d25[_0x6eec('0x39')],'destlinkedid':_0x3a4d25[_0x6eec('0x23')]};}}}catch(_0x165498){logger[_0x6eec('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x165498['message']);}};Acw[_0x6eec('0x17')][_0x6eec('0x13')]=function(_0x3703b5){try{if(this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]]&&(this['voiceQueues'][_0x3703b5[_0x6eec('0x2b')]]['acw']||this[_0x6eec('0x7')][_0x3703b5[_0x6eec('0x2b')]][_0x6eec('0x1a')])){if(this['agents'][_0x3703b5[_0x6eec('0x39')]]){this[_0x6eec('0xa')][_0x3703b5[_0x6eec('0x2a')]]={'queue':_0x3703b5[_0x6eec('0x2b')],'interface':_0x3703b5[_0x6eec('0x39')]};}}}catch(_0x4be225){logger[_0x6eec('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4be225['message']);}};Acw[_0x6eec('0x17')]['syncHangupRequest']=function(_0x245a1b){try{if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x2a')]]&&_['isUndefined'](this['channels'][_0x245a1b[_0x6eec('0x2a')]][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3b'),_0x245a1b[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x245a1b[_0x6eec('0x3c')]]&&_[_0x6eec('0x3d')](this['channels'][_0x245a1b['linkedid']][_0x6eec('0x3a')])){logger[_0x6eec('0x21')](_0x6eec('0x3e'),_0x245a1b['linkedid']);this[_0x6eec('0x18')](_0x245a1b[_0x6eec('0x3c')]);}}catch(_0x16c0da){logger[_0x6eec('0x31')](_0x6eec('0x3f'),_0x16c0da[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x40')]=function(_0x5a6e05){try{if(this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]&&this[_0x6eec('0xa')][_0x5a6e05[_0x6eec('0x2a')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x5a6e05[_0x6eec('0x2a')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x2a')]);}else if(this[_0x6eec('0xa')][_0x5a6e05['linkedid']]&&this['channels'][_0x5a6e05[_0x6eec('0x3c')]][_0x6eec('0x3a')]){logger[_0x6eec('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5a6e05[_0x6eec('0x3c')]);this[_0x6eec('0x18')](_0x5a6e05[_0x6eec('0x3c')]);}}catch(_0xf957c1){logger[_0x6eec('0x31')](_0x6eec('0x41'),_0xf957c1[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x42')]=function(_0x4e921a){try{if(!_[_0x6eec('0x43')](this['channels'][_0x4e921a[_0x6eec('0x44')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x44')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]){this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a['transfertargetuniqueid']]=this[_0x6eec('0xa')][_0x4e921a['secondtransfereruniqueid']];delete this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x45')]];}}else if(!_[_0x6eec('0x43')](this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x46')]])){this[_0x6eec('0x18')](_0x4e921a[_0x6eec('0x46')]);if(this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]]){this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']]['attended']=!![];this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x44')]]=this[_0x6eec('0xa')][_0x4e921a[_0x6eec('0x47')]];delete this[_0x6eec('0xa')][_0x4e921a['origtransfereruniqueid']];}}}catch(_0x1d8fb1){logger[_0x6eec('0x31')]('[ACW][syncAttendedTransfer]\x20%s',_0x1d8fb1['message']);}};Acw['prototype'][_0x6eec('0x11')]=function(_0x3dfd47){try{if(this['channels'][_0x3dfd47[_0x6eec('0x48')]]){logger[_0x6eec('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x48')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x48')]);}else if(this['channels'][_0x3dfd47['transfererlinkedid']]){logger[_0x6eec('0x21')](_0x6eec('0x4a'),JSON[_0x6eec('0x49')](_0x3dfd47[_0x6eec('0x4b')]));this[_0x6eec('0x18')](_0x3dfd47[_0x6eec('0x4b')]);}}catch(_0x169607){logger[_0x6eec('0x31')](_0x6eec('0x4c'),_0x169607[_0x6eec('0x35')]);}};Acw[_0x6eec('0x17')][_0x6eec('0x10')]=function(_0x2799ca){try{if(this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]&&this[_0x6eec('0x7')][_0x2799ca[_0x6eec('0x2b')]]['autopause']===_0x6eec('0x4d')){if(this[_0x6eec('0x8')][_0x2799ca['interface']]){logger[_0x6eec('0x21')](_0x6eec('0x4e'),_0x2799ca['uniqueid'],_0x2799ca[_0x6eec('0x39')],_0x2799ca[_0x6eec('0x2b')]);return RpcUser[_0x6eec('0x24')](this[_0x6eec('0x8')][_0x2799ca['interface']],_0x6eec('0x4f'),_0x2799ca[_0x6eec('0x2a')]);}}}catch(_0x3a9a5b){logger[_0x6eec('0x31')](_0x6eec('0x50'),_0x3a9a5b[_0x6eec('0x35')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 279daec..a678d31 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 _0x8372=['format','port','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionSipShowRegistry','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','Action','action','error'];(function(_0x43316e,_0x318677){var _0x5b2881=function(_0x2612bb){while(--_0x2612bb){_0x43316e['push'](_0x43316e['shift']());}};_0x5b2881(++_0x318677);}(_0x8372,0xf6));var _0x2837=function(_0x435db7,_0xe6e650){_0x435db7=_0x435db7-0x0;var _0x27c8e3=_0x8372[_0x435db7];return _0x27c8e3;};'use strict';var Manager=require(_0x2837('0x0'));var BPromise=require(_0x2837('0x1'));var moment=require(_0x2837('0x2'));var util=require('util');var _=require(_0x2837('0x3'));var logger=require(_0x2837('0x4'))(_0x2837('0x5'));var config=require(_0x2837('0x6'));var ami=new Manager(config[_0x2837('0x7')]['port'],config[_0x2837('0x7')]['ip'],config['asterisk'][_0x2837('0x8')],config[_0x2837('0x7')][_0x2837('0x9')],!![]);ami['keepConnected']();ami[_0x2837('0xa')]=BPromise['promisify'](ami[_0x2837('0xb')]);function error(_0x515f47){logger[_0x2837('0xc')](util[_0x2837('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2837('0x7')][_0x2837('0x8')],config[_0x2837('0x7')]['ip'],config[_0x2837('0x7')][_0x2837('0xe')],util['inspect'](_0x515f47,![],null)));}function close(){logger[_0x2837('0xc')](util[_0x2837('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x2837('0x7')][_0x2837('0x8')],config[_0x2837('0x7')]['ip'],config[_0x2837('0x7')][_0x2837('0xe')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2837('0xa')]({'action':_0x2837('0xf')});};};ami[_0x2837('0x10')]=function(){return function(){return ami[_0x2837('0xa')]({'action':_0x2837('0x11')});};};ami[_0x2837('0x12')]=function(){return function(){return ami[_0x2837('0xa')]({'action':_0x2837('0x13')});};};ami[_0x2837('0x14')]=function(){return function(){return ami[_0x2837('0xa')]({'action':_0x2837('0x15')});};};ami[_0x2837('0x16')]=function(){return function(){return ami[_0x2837('0xa')]({'action':_0x2837('0x17')});};};function connect(_0x2516d4){logger[_0x2837('0x18')](util['format'](_0x2837('0x19'),config['asterisk']['username'],config[_0x2837('0x7')]['ip'],config['asterisk'][_0x2837('0xe')]));ami[_0x2837('0x1a')](_0x2837('0xc'),error);ami['once'](_0x2837('0x1b'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x356b01){logger['info'](util[_0x2837('0xd')](_0x2837('0x1c'),config[_0x2837('0x7')][_0x2837('0x8')],config[_0x2837('0x7')]['ip'],config[_0x2837('0x7')][_0x2837('0xe')],util[_0x2837('0x1d')](_0x356b01,![],null)));});ami['on'](_0x2837('0x1e'),function(_0xcee795){logger[_0x2837('0x18')](util['format'](_0x2837('0x1f'),config[_0x2837('0x7')]['username'],config[_0x2837('0x7')]['ip'],config[_0x2837('0x7')][_0x2837('0xe')]));return BPromise['resolve']()[_0x2837('0x20')](ami[_0x2837('0x21')]())['then'](ami[_0x2837('0x10')]())['then'](ami[_0x2837('0x12')]())[_0x2837('0x20')](ami['actionQueueSummary']())[_0x2837('0x20')](ami['actionCoreShowChannels']())[_0x2837('0x22')](function(_0x3d5d69){console[_0x2837('0x23')](_0x3d5d69);});});ami[_0x2837('0x1a')]('error',error);ami[_0x2837('0x1a')](_0x2837('0x1b'),close);module[_0x2837('0x24')]=ami; \ No newline at end of file +var _0x37b6=['actionQueueSummary','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','fullybooted','resolve','then','catch','exports','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x37b6,0x120));var _0x637b=function(_0x33e2bb,_0x5835f7){_0x33e2bb=_0x33e2bb-0x0;var _0x238df9=_0x37b6[_0x33e2bb];return _0x238df9;};'use strict';var Manager=require(_0x637b('0x0'));var BPromise=require(_0x637b('0x1'));var moment=require(_0x637b('0x2'));var util=require(_0x637b('0x3'));var _=require('lodash');var logger=require(_0x637b('0x4'))(_0x637b('0x5'));var config=require(_0x637b('0x6'));var ami=new Manager(config[_0x637b('0x7')][_0x637b('0x8')],config['asterisk']['ip'],config[_0x637b('0x7')][_0x637b('0x9')],config[_0x637b('0x7')][_0x637b('0xa')],!![]);ami[_0x637b('0xb')]();ami['Action']=BPromise['promisify'](ami[_0x637b('0xc')]);function error(_0x2089f2){logger[_0x637b('0xd')](util['format'](_0x637b('0xe'),config[_0x637b('0x7')][_0x637b('0x9')],config[_0x637b('0x7')]['ip'],config['asterisk']['port'],util[_0x637b('0xf')](_0x2089f2,![],null)));}function close(){logger[_0x637b('0xd')](util[_0x637b('0x10')](_0x637b('0x11'),config[_0x637b('0x7')][_0x637b('0x9')],config[_0x637b('0x7')]['ip'],config[_0x637b('0x7')]['port']));}ami[_0x637b('0x12')]=function(){return function(){return ami[_0x637b('0x13')]({'action':_0x637b('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x637b('0x13')]({'action':_0x637b('0x15')});};};ami[_0x637b('0x16')]=function(){return function(){return ami[_0x637b('0x13')]({'action':_0x637b('0x17')});};};ami[_0x637b('0x18')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x637b('0x19')]=function(){return function(){return ami[_0x637b('0x13')]({'action':_0x637b('0x1a')});};};function connect(_0x4a066f){logger[_0x637b('0x1b')](util[_0x637b('0x10')](_0x637b('0x1c'),config[_0x637b('0x7')][_0x637b('0x9')],config['asterisk']['ip'],config['asterisk']['port']));ami[_0x637b('0x1d')](_0x637b('0xd'),error);ami[_0x637b('0x1d')](_0x637b('0x1e'),close);}ami['on'](_0x637b('0x1f'),connect);ami['on'](_0x637b('0x20'),function(_0x10777a){logger[_0x637b('0x1b')](util[_0x637b('0x10')](_0x637b('0x21'),config['asterisk']['username'],config[_0x637b('0x7')]['ip'],config[_0x637b('0x7')]['port'],util[_0x637b('0xf')](_0x10777a,![],null)));});ami['on'](_0x637b('0x22'),function(_0x243f02){logger['info'](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x637b('0x7')][_0x637b('0x9')],config[_0x637b('0x7')]['ip'],config[_0x637b('0x7')][_0x637b('0x8')]));return BPromise[_0x637b('0x23')]()[_0x637b('0x24')](ami[_0x637b('0x12')]())['then'](ami['actionDeviceStateList']())[_0x637b('0x24')](ami['actionSipPeerStatus']())[_0x637b('0x24')](ami['actionQueueSummary']())[_0x637b('0x24')](ami[_0x637b('0x19')]())[_0x637b('0x25')](function(_0x2d6b8f){console['log'](_0x2d6b8f);});});ami[_0x637b('0x1d')](_0x637b('0xd'),error);ami['once'](_0x637b('0x1e'),close);module[_0x637b('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 8145c5d..ddb2094 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 _0x8dda=['bluebird','ami','client','http','Request','request','debug','rpc','memberReport','error','message','result','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8dda,0x8e));var _0xa8dd=function(_0x3fc42f,_0x16130e){_0x3fc42f=_0x3fc42f-0x0;var _0x140221=_0x8dda[_0x3fc42f];return _0x140221;};'use strict';var jayson=require(_0xa8dd('0x0'));var BPromise=require(_0xa8dd('0x1'));var logger=require('../../config/logger')(_0xa8dd('0x2'));var client=jayson[_0xa8dd('0x3')][_0xa8dd('0x4')]({'port':0x2329});client[_0xa8dd('0x5')]=function(_0x497b56,_0x16915b){return new BPromise(function(_0x4760f0,_0x9ac498){return client[_0xa8dd('0x6')](_0x497b56,_0x16915b)['then'](function(_0x46d09a){logger[_0xa8dd('0x7')](_0xa8dd('0x8'),_0xa8dd('0x9'),_0x497b56,_0x16915b,_0x46d09a);if(_0x46d09a[_0xa8dd('0xa')]){logger[_0xa8dd('0xa')]('rpc','memberReport',_0x497b56,_0x46d09a[_0xa8dd('0xa')][_0xa8dd('0xb')],_0x16915b);return _0x9ac498(_0x46d09a[_0xa8dd('0xa')][_0xa8dd('0xb')]);}else{return _0x4760f0(_0x46d09a[_0xa8dd('0xc')]);}})['catch'](function(_0x32c5a1){logger[_0xa8dd('0xa')](_0xa8dd('0x8'),_0xa8dd('0x9'),_0x497b56,_0x32c5a1,_0x16915b);return _0x9ac498(_0x32c5a1);});});};module['exports']=client; \ No newline at end of file +var _0x7071=['Request','request','then','rpc','memberReport','error','message','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x5bd502,_0x3ffa94){var _0x284285=function(_0x23bff8){while(--_0x23bff8){_0x5bd502['push'](_0x5bd502['shift']());}};_0x284285(++_0x3ffa94);}(_0x7071,0x175));var _0x1707=function(_0x622ce0,_0x223808){_0x622ce0=_0x622ce0-0x0;var _0x45ca7c=_0x7071[_0x622ce0];return _0x45ca7c;};'use strict';var jayson=require(_0x1707('0x0'));var BPromise=require(_0x1707('0x1'));var logger=require(_0x1707('0x2'))(_0x1707('0x3'));var client=jayson[_0x1707('0x4')]['http']({'port':0x2329});client[_0x1707('0x5')]=function(_0x4087d5,_0x10d8f2){return new BPromise(function(_0x570893,_0x327523){return client[_0x1707('0x6')](_0x4087d5,_0x10d8f2)[_0x1707('0x7')](function(_0x2c1dcc){logger['debug'](_0x1707('0x8'),_0x1707('0x9'),_0x4087d5,_0x10d8f2,_0x2c1dcc);if(_0x2c1dcc[_0x1707('0xa')]){logger[_0x1707('0xa')](_0x1707('0x8'),_0x1707('0x9'),_0x4087d5,_0x2c1dcc[_0x1707('0xa')][_0x1707('0xb')],_0x10d8f2);return _0x327523(_0x2c1dcc[_0x1707('0xa')]['message']);}else{return _0x570893(_0x2c1dcc['result']);}})[_0x1707('0xc')](function(_0x15912f){logger[_0x1707('0xa')](_0x1707('0x8'),_0x1707('0x9'),_0x4087d5,_0x15912f,_0x10d8f2);return _0x327523(_0x15912f);});});};module[_0x1707('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 313d9ab..278b7b0 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 _0xdb2b=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','voiceQueue','util','moment','isNil','string','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','VoiceQueueId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46445b,_0x3e21ca){var _0x135d13=function(_0x22f3a3){while(--_0x22f3a3){_0x46445b['push'](_0x46445b['shift']());}};_0x135d13(++_0x3e21ca);}(_0xdb2b,0xa2));var _0xbdb2=function(_0x2cb3eb,_0x4d83aa){_0x2cb3eb=_0x2cb3eb-0x0;var _0x2759ee=_0xdb2b[_0x2cb3eb];return _0x2759ee;};'use strict';var util=require(_0xbdb2('0x0'));var _=require('lodash');var moment=require(_0xbdb2('0x1'));function checkNameSurname(_0x828eeb,_0x2df0d0,_0x20026f){var _0x1d47c6='';if(!_[_0xbdb2('0x2')](_0x2df0d0)&&_0xbdb2('0x3')===typeof _0x2df0d0){_0x1d47c6+=_0x2df0d0;}if(!_[_0xbdb2('0x2')](_0x20026f)&&_0xbdb2('0x3')===typeof _0x20026f){_0x1d47c6+='\x20'+_0x20026f;}if(_0x1d47c6!==''){return _0x1d47c6;}return _0x828eeb;}function Action(_0x28fa31,_0x267ef3,_0xdabd3c){this['voiceQueue']=_0x28fa31;this['uniqueid']=_0xdabd3c||undefined;this[_0xbdb2('0x4')]=checkNameSurname(_0x267ef3[_0xbdb2('0x5')][_0xbdb2('0x6')],_0x267ef3[_0xbdb2('0x5')][_0xbdb2('0x7')],_0x267ef3[_0xbdb2('0x5')]['lastName']);this[_0xbdb2('0x8')]=_0x267ef3[_0xbdb2('0x5')]['phone'];this[_0xbdb2('0x9')]=_0x28fa31[_0xbdb2('0x4')];this['active']=_0x267ef3[_0xbdb2('0xa')]||![];this[_0xbdb2('0xb')]=_0x28fa31[_0xbdb2('0xb')];this['dialQueueTimeout']=_0x28fa31[_0xbdb2('0xc')]||0x3;this[_0xbdb2('0xd')]=_0x267ef3[_0xbdb2('0xd')];this[_0xbdb2('0xe')]=_0x267ef3['countbusyretry'];this[_0xbdb2('0xf')]=_0x267ef3[_0xbdb2('0xf')];this['countnoanswerretry']=_0x267ef3['countnoanswerretry'];this[_0xbdb2('0x10')]=_0x267ef3[_0xbdb2('0x10')];this[_0xbdb2('0x11')]=_0x267ef3[_0xbdb2('0x11')];this[_0xbdb2('0x12')]=_0x267ef3[_0xbdb2('0x12')];this[_0xbdb2('0x13')]=_0x267ef3[_0xbdb2('0x13')];this['countagentrejectretry']=_0x267ef3[_0xbdb2('0x14')];this['ContactId']=_0x267ef3[_0xbdb2('0x15')];this[_0xbdb2('0x16')]=_0x267ef3[_0xbdb2('0x16')];this['UserId']=_0x267ef3['UserId'];this[_0xbdb2('0x17')]=_0x267ef3[_0xbdb2('0x17')];this['CampaignId']=_0x267ef3['CampaignId'];this['idHopper']=_0x267ef3['id'];this[_0xbdb2('0x18')]=_0x267ef3[_0xbdb2('0x5')][_0xbdb2('0x7')]||'';this[_0xbdb2('0x19')]=moment()[_0xbdb2('0x1a')](_0xbdb2('0x1b'));this['callback']=_0x267ef3[_0xbdb2('0x1c')];this['callbackuniqueid']=_0x267ef3[_0xbdb2('0x1d')];this['callbackat']=_0x267ef3[_0xbdb2('0x1e')];this[_0xbdb2('0x1f')]=_0x267ef3['recallme'];this[_0xbdb2('0x20')]='';this[_0xbdb2('0x21')]='';}Action['prototype'][_0xbdb2('0x22')]=function(){return util[_0xbdb2('0x1a')](_0xbdb2('0x23'),this['name'],this['voiceQueue'][_0xbdb2('0x24')]>0x0?this[_0xbdb2('0x8')]['substring'](this[_0xbdb2('0x25')][_0xbdb2('0x24')]):this['number']);};Action['prototype']['getQueue']=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0xa9f0=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','voiceQueue','getQueue','exports','util','moment','isNil','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9f0,0x153));var _0x0a9f=function(_0x3ce21f,_0xeed7d9){_0x3ce21f=_0x3ce21f-0x0;var _0x48b1e3=_0xa9f0[_0x3ce21f];return _0x48b1e3;};'use strict';var util=require(_0x0a9f('0x0'));var _=require('lodash');var moment=require(_0x0a9f('0x1'));function checkNameSurname(_0x3bf639,_0x3968f4,_0x2c544b){var _0x170ee8='';if(!_[_0x0a9f('0x2')](_0x3968f4)&&_0x0a9f('0x3')===typeof _0x3968f4){_0x170ee8+=_0x3968f4;}if(!_[_0x0a9f('0x2')](_0x2c544b)&&'string'===typeof _0x2c544b){_0x170ee8+='\x20'+_0x2c544b;}if(_0x170ee8!==''){return _0x170ee8;}return _0x3bf639;}function Action(_0x881644,_0x54579c,_0x19b209){this['voiceQueue']=_0x881644;this[_0x0a9f('0x4')]=_0x19b209||undefined;this[_0x0a9f('0x5')]=checkNameSurname(_0x54579c[_0x0a9f('0x6')][_0x0a9f('0x7')],_0x54579c['Contact'][_0x0a9f('0x8')],_0x54579c[_0x0a9f('0x6')][_0x0a9f('0x9')]);this[_0x0a9f('0xa')]=_0x54579c['Contact']['phone'];this[_0x0a9f('0xb')]=_0x881644[_0x0a9f('0x5')];this[_0x0a9f('0xc')]=_0x54579c[_0x0a9f('0xc')]||![];this[_0x0a9f('0xd')]=_0x881644[_0x0a9f('0xd')];this[_0x0a9f('0xe')]=_0x881644[_0x0a9f('0xe')]||0x3;this[_0x0a9f('0xf')]=_0x54579c[_0x0a9f('0xf')];this[_0x0a9f('0x10')]=_0x54579c[_0x0a9f('0x10')];this[_0x0a9f('0x11')]=_0x54579c['countcongestionretry'];this[_0x0a9f('0x12')]=_0x54579c[_0x0a9f('0x12')];this[_0x0a9f('0x13')]=_0x54579c[_0x0a9f('0x13')];this[_0x0a9f('0x14')]=_0x54579c[_0x0a9f('0x14')];this['countabandonedretry']=_0x54579c['countabandonedretry'];this['countmachineretry']=_0x54579c['countmachineretry'];this[_0x0a9f('0x15')]=_0x54579c[_0x0a9f('0x15')];this['ContactId']=_0x54579c[_0x0a9f('0x16')];this[_0x0a9f('0x17')]=_0x54579c[_0x0a9f('0x17')];this['UserId']=_0x54579c[_0x0a9f('0x18')];this[_0x0a9f('0x19')]=_0x54579c[_0x0a9f('0x19')];this['CampaignId']=_0x54579c[_0x0a9f('0x1a')];this['idHopper']=_0x54579c['id'];this[_0x0a9f('0x1b')]=_0x54579c[_0x0a9f('0x6')][_0x0a9f('0x8')]||'';this[_0x0a9f('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9f('0x1d')]=_0x54579c[_0x0a9f('0x1d')];this[_0x0a9f('0x1e')]=_0x54579c[_0x0a9f('0x1e')];this[_0x0a9f('0x1f')]=_0x54579c[_0x0a9f('0x1f')];this[_0x0a9f('0x20')]=_0x54579c[_0x0a9f('0x20')];this[_0x0a9f('0x21')]='';this['originatecalleridname']='';}Action['prototype'][_0x0a9f('0x22')]=function(){return util['format'](_0x0a9f('0x23'),this[_0x0a9f('0x5')],this[_0x0a9f('0x24')]['dialCutDigit']>0x0?this[_0x0a9f('0xa')]['substring'](this[_0x0a9f('0x24')]['dialCutDigit']):this['number']);};Action['prototype'][_0x0a9f('0x25')]=function(){return this[_0x0a9f('0xb')];};module[_0x0a9f('0x26')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 45e6550..2044105 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 _0xed5a=['diff','seconds','state','statedesc','Answer','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xed5a,0x106));var _0xaed5=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xed5a[_0xf34109];return _0x570bfc;};'use strict';var util=require('util');var _=require(_0xaed5('0x0'));var moment=require('moment');function getSeconds(_0x4da675,_0x148939){var _0x26f1d1=moment(_0x4da675)[_0xaed5('0x1')](0x0);var _0x2cfa07=moment(_0x148939)['milliseconds'](0x0);return _0x26f1d1[_0xaed5('0x2')](_0x2cfa07,_0xaed5('0x3'));}function AgentComplete(_0x35184f,_0x4d1d63){this[_0xaed5('0x4')]=0x4;this[_0xaed5('0x5')]=_0xaed5('0x6');this[_0xaed5('0x7')]=_0x35184f['scheduledat'];this[_0xaed5('0x8')]=_0x35184f[_0xaed5('0x8')];this['campaigntype']=_0x35184f[_0xaed5('0x8')]==='outbound'?'queue':_0x35184f[_0xaed5('0x8')];this[_0xaed5('0x9')]=_0x35184f['countbusyretry'];this[_0xaed5('0xa')]=_0x35184f[_0xaed5('0xa')];this[_0xaed5('0xb')]=_0x35184f[_0xaed5('0xb')];this[_0xaed5('0xc')]=_0x35184f[_0xaed5('0x9')]+_0x35184f[_0xaed5('0xa')]+_0x35184f[_0xaed5('0xb')]+_0x35184f[_0xaed5('0xd')]+_0x35184f['countdropretry']+_0x35184f[_0xaed5('0xe')]+_0x35184f['countmachineretry']+_0x35184f[_0xaed5('0xf')];this[_0xaed5('0xd')]=_0x35184f[_0xaed5('0xd')];this[_0xaed5('0x10')]=_0x35184f[_0xaed5('0x10')];this[_0xaed5('0xe')]=_0x35184f[_0xaed5('0xe')];this[_0xaed5('0x11')]=_0x35184f[_0xaed5('0x11')];this['countagentrejectretry']=_0x35184f[_0xaed5('0xf')];this['uniqueid']=_0x4d1d63[_0xaed5('0x12')];this[_0xaed5('0x13')]=_0x35184f[_0xaed5('0x14')];this['calleridnum']=_0x35184f[_0xaed5('0x15')];this[_0xaed5('0x16')]=_0x35184f[_0xaed5('0x16')];this[_0xaed5('0x17')]=_0x35184f['responsetime'];this[_0xaed5('0x18')]=_0x35184f[_0xaed5('0x18')];this[_0xaed5('0x19')]=moment()['format'](_0xaed5('0x1a'));this[_0xaed5('0x1b')]=getSeconds(_0x35184f[_0xaed5('0x17')],_0x35184f[_0xaed5('0x16')]);this[_0xaed5('0x1c')]=getSeconds(_0x35184f[_0xaed5('0x18')],_0x35184f[_0xaed5('0x17')]);this['talktime']=getSeconds(this[_0xaed5('0x19')],_0x35184f['answertime']);this['queue']=_0x4d1d63[_0xaed5('0x1d')];this['membername']=_0x4d1d63[_0xaed5('0x1e')];this['reason']=_0x4d1d63[_0xaed5('0x1f')];this[_0xaed5('0x20')]=_0x35184f[_0xaed5('0x20')];this[_0xaed5('0x21')]=_0x35184f[_0xaed5('0x21')];this[_0xaed5('0x22')]=_0x35184f[_0xaed5('0x22')];this['recallme']=_0x35184f[_0xaed5('0x23')];this[_0xaed5('0x24')]=_0x35184f[_0xaed5('0x24')];this[_0xaed5('0x25')]=_0x35184f[_0xaed5('0x25')];this[_0xaed5('0x26')]=_0x35184f[_0xaed5('0x26')];this[_0xaed5('0x27')]=_0x35184f[_0xaed5('0x27')];this[_0xaed5('0x28')]=_0x35184f['CampaignId'];this[_0xaed5('0x29')]=_0x35184f['originatecalleridnum']||'';this[_0xaed5('0x2a')]=_0x35184f[_0xaed5('0x2a')]||'';}module[_0xaed5('0x2b')]=AgentComplete; \ No newline at end of file +var _0xa731=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x18aea8,_0x406626){var _0x44ce78=function(_0x4acfc0){while(--_0x4acfc0){_0x18aea8['push'](_0x18aea8['shift']());}};_0x44ce78(++_0x406626);}(_0xa731,0xce));var _0x1a73=function(_0x460147,_0x4a81c9){_0x460147=_0x460147-0x0;var _0x4ffec7=_0xa731[_0x460147];return _0x4ffec7;};'use strict';var util=require('util');var _=require(_0x1a73('0x0'));var moment=require(_0x1a73('0x1'));function getSeconds(_0x674772,_0xf23695){var _0x3c9889=moment(_0x674772)[_0x1a73('0x2')](0x0);var _0x98fc3c=moment(_0xf23695)[_0x1a73('0x2')](0x0);return _0x3c9889[_0x1a73('0x3')](_0x98fc3c,_0x1a73('0x4'));}function AgentComplete(_0x2b91fa,_0x27f3c0){this['state']=0x4;this[_0x1a73('0x5')]='Answer';this['scheduledat']=_0x2b91fa[_0x1a73('0x6')];this[_0x1a73('0x7')]=_0x2b91fa[_0x1a73('0x7')];this[_0x1a73('0x8')]=_0x2b91fa[_0x1a73('0x7')]==='outbound'?'queue':_0x2b91fa[_0x1a73('0x7')];this[_0x1a73('0x9')]=_0x2b91fa[_0x1a73('0x9')];this['countcongestionretry']=_0x2b91fa[_0x1a73('0xa')];this[_0x1a73('0xb')]=_0x2b91fa[_0x1a73('0xb')];this[_0x1a73('0xc')]=_0x2b91fa['countbusyretry']+_0x2b91fa[_0x1a73('0xa')]+_0x2b91fa[_0x1a73('0xb')]+_0x2b91fa[_0x1a73('0xd')]+_0x2b91fa[_0x1a73('0xe')]+_0x2b91fa[_0x1a73('0xf')]+_0x2b91fa[_0x1a73('0x10')]+_0x2b91fa[_0x1a73('0x11')];this[_0x1a73('0xd')]=_0x2b91fa['countnosuchnumberretry'];this[_0x1a73('0xe')]=_0x2b91fa[_0x1a73('0xe')];this[_0x1a73('0xf')]=_0x2b91fa[_0x1a73('0xf')];this[_0x1a73('0x10')]=_0x2b91fa[_0x1a73('0x10')];this[_0x1a73('0x11')]=_0x2b91fa[_0x1a73('0x11')];this[_0x1a73('0x12')]=_0x27f3c0[_0x1a73('0x12')];this[_0x1a73('0x13')]=_0x2b91fa[_0x1a73('0x14')];this[_0x1a73('0x15')]=_0x2b91fa[_0x1a73('0x16')];this['starttime']=_0x2b91fa[_0x1a73('0x17')];this['responsetime']=_0x2b91fa[_0x1a73('0x18')];this[_0x1a73('0x19')]=_0x2b91fa[_0x1a73('0x19')];this[_0x1a73('0x1a')]=moment()['format'](_0x1a73('0x1b'));this[_0x1a73('0x1c')]=getSeconds(_0x2b91fa['responsetime'],_0x2b91fa[_0x1a73('0x17')]);this['holdtime']=getSeconds(_0x2b91fa[_0x1a73('0x19')],_0x2b91fa['responsetime']);this[_0x1a73('0x1d')]=getSeconds(this['endtime'],_0x2b91fa[_0x1a73('0x19')]);this[_0x1a73('0x1e')]=_0x27f3c0[_0x1a73('0x1e')];this[_0x1a73('0x1f')]=_0x27f3c0[_0x1a73('0x1f')];this[_0x1a73('0x20')]=_0x27f3c0['reason'];this[_0x1a73('0x21')]=_0x2b91fa[_0x1a73('0x21')];this[_0x1a73('0x22')]=_0x2b91fa[_0x1a73('0x22')];this[_0x1a73('0x23')]=_0x2b91fa[_0x1a73('0x23')];this[_0x1a73('0x24')]=_0x2b91fa['recallme'];this['ContactId']=_0x2b91fa[_0x1a73('0x25')];this[_0x1a73('0x26')]=_0x2b91fa[_0x1a73('0x26')];this[_0x1a73('0x27')]=_0x2b91fa[_0x1a73('0x27')];this['VoiceQueueId']=_0x2b91fa[_0x1a73('0x28')];this[_0x1a73('0x29')]=_0x2b91fa[_0x1a73('0x29')];this[_0x1a73('0x2a')]=_0x2b91fa['originatecalleridnum']||'';this[_0x1a73('0x2b')]=_0x2b91fa[_0x1a73('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 096551a..588fea8 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 _0x63a1=['starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','queue','calleridname','calleridnum'];(function(_0x5179a9,_0x113275){var _0x2a6a02=function(_0x2fc1a9){while(--_0x2fc1a9){_0x5179a9['push'](_0x5179a9['shift']());}};_0x2a6a02(++_0x113275);}(_0x63a1,0x1f2));var _0x163a=function(_0x3dae8e,_0x3abe4f){_0x3dae8e=_0x3dae8e-0x0;var _0x191336=_0x63a1[_0x3dae8e];return _0x191336;};'use strict';var util=require(_0x163a('0x0'));var _=require('lodash');var moment=require(_0x163a('0x1'));function getSeconds(_0x28ae6b,_0x1d1001){var _0x15f712=moment(_0x28ae6b)[_0x163a('0x2')](0x0);var _0x348941=moment(_0x1d1001)[_0x163a('0x2')](0x0);return _0x15f712['diff'](_0x348941,_0x163a('0x3'));}function Final(_0x4bf2d8){this[_0x163a('0x4')]=_0x4bf2d8[_0x163a('0x4')];this[_0x163a('0x5')]=_0x4bf2d8[_0x163a('0x5')];this['type']=_0x4bf2d8[_0x163a('0x6')];this[_0x163a('0x7')]=_0x4bf2d8[_0x163a('0x6')]===_0x163a('0x8')?'queue':_0x4bf2d8[_0x163a('0x6')];this['countbusyretry']=_0x4bf2d8[_0x163a('0x9')];this[_0x163a('0xa')]=_0x4bf2d8[_0x163a('0xa')];this[_0x163a('0xb')]=_0x4bf2d8[_0x163a('0xb')];this['countglobal']=_0x4bf2d8[_0x163a('0x9')]+_0x4bf2d8[_0x163a('0xa')]+_0x4bf2d8['countnoanswerretry']+_0x4bf2d8['countnosuchnumberretry']+_0x4bf2d8[_0x163a('0xc')]+_0x4bf2d8[_0x163a('0xd')]+_0x4bf2d8[_0x163a('0xe')]+_0x4bf2d8[_0x163a('0xf')];this[_0x163a('0x10')]=_0x4bf2d8[_0x163a('0x10')];this[_0x163a('0xc')]=_0x4bf2d8['countdropretry'];this[_0x163a('0xd')]=_0x4bf2d8[_0x163a('0xd')];this[_0x163a('0xe')]=_0x4bf2d8[_0x163a('0xe')];this[_0x163a('0xf')]=_0x4bf2d8[_0x163a('0xf')];this[_0x163a('0x11')]=_0x4bf2d8['queue'];this[_0x163a('0x12')]=_0x4bf2d8[_0x163a('0x12')];this[_0x163a('0x13')]=_0x4bf2d8['calleridnum'];this[_0x163a('0x14')]=_0x4bf2d8[_0x163a('0x14')];this[_0x163a('0x15')]=_0x4bf2d8['responsetime'];this[_0x163a('0x16')]=_0x4bf2d8[_0x163a('0x15')];this[_0x163a('0x17')]=_0x4bf2d8['ringtime']||0x0;this[_0x163a('0x18')]=_0x4bf2d8[_0x163a('0x18')]||0x0;this[_0x163a('0x19')]=_0x4bf2d8['talktime']||0x0;this[_0x163a('0x1a')]=_0x4bf2d8[_0x163a('0x1a')];this[_0x163a('0x1b')]=_0x4bf2d8[_0x163a('0x1b')];this[_0x163a('0x1c')]=_0x4bf2d8['callbackat'];this['recallme']=_0x4bf2d8[_0x163a('0x1d')];this[_0x163a('0x1e')]=_0x4bf2d8['ContactId'];this[_0x163a('0x1f')]=_0x4bf2d8[_0x163a('0x1f')];this['UserId']=_0x4bf2d8['UserId'];this[_0x163a('0x20')]=_0x4bf2d8['VoiceQueueId'];this[_0x163a('0x21')]=_0x4bf2d8[_0x163a('0x21')];this[_0x163a('0x22')]=_0x4bf2d8[_0x163a('0x22')]||'';this[_0x163a('0x23')]=_0x4bf2d8[_0x163a('0x23')]||'';}module[_0x163a('0x24')]=Final; \ No newline at end of file +var _0xbc61=['countdropretry','countmachineretry','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry'];(function(_0x1f562d,_0x1f3f0e){var _0x30adc2=function(_0x51a335){while(--_0x51a335){_0x1f562d['push'](_0x1f562d['shift']());}};_0x30adc2(++_0x1f3f0e);}(_0xbc61,0x158));var _0x1bc6=function(_0x45e501,_0x563a21){_0x45e501=_0x45e501-0x0;var _0x27b3c6=_0xbc61[_0x45e501];return _0x27b3c6;};'use strict';var util=require(_0x1bc6('0x0'));var _=require(_0x1bc6('0x1'));var moment=require(_0x1bc6('0x2'));function getSeconds(_0x5044b4,_0x21714b){var _0x105d11=moment(_0x5044b4)[_0x1bc6('0x3')](0x0);var _0x22c64a=moment(_0x21714b)[_0x1bc6('0x3')](0x0);return _0x105d11[_0x1bc6('0x4')](_0x22c64a,_0x1bc6('0x5'));}function Final(_0x1299d5){this['uniqueid']=_0x1299d5['uniqueid'];this['scheduledat']=_0x1299d5['scheduledat'];this['type']=_0x1299d5[_0x1bc6('0x6')];this['campaigntype']=_0x1299d5['type']===_0x1bc6('0x7')?_0x1bc6('0x8'):_0x1299d5[_0x1bc6('0x6')];this[_0x1bc6('0x9')]=_0x1299d5[_0x1bc6('0x9')];this[_0x1bc6('0xa')]=_0x1299d5[_0x1bc6('0xa')];this[_0x1bc6('0xb')]=_0x1299d5['countnoanswerretry'];this[_0x1bc6('0xc')]=_0x1299d5[_0x1bc6('0x9')]+_0x1299d5[_0x1bc6('0xa')]+_0x1299d5[_0x1bc6('0xb')]+_0x1299d5[_0x1bc6('0xd')]+_0x1299d5['countdropretry']+_0x1299d5[_0x1bc6('0xe')]+_0x1299d5['countmachineretry']+_0x1299d5[_0x1bc6('0xf')];this[_0x1bc6('0xd')]=_0x1299d5['countnosuchnumberretry'];this[_0x1bc6('0x10')]=_0x1299d5[_0x1bc6('0x10')];this[_0x1bc6('0xe')]=_0x1299d5[_0x1bc6('0xe')];this[_0x1bc6('0x11')]=_0x1299d5[_0x1bc6('0x11')];this['countagentrejectretry']=_0x1299d5['countagentrejectretry'];this[_0x1bc6('0x8')]=_0x1299d5[_0x1bc6('0x8')];this[_0x1bc6('0x12')]=_0x1299d5[_0x1bc6('0x12')];this['calleridnum']=_0x1299d5['calleridnum'];this['starttime']=_0x1299d5[_0x1bc6('0x13')];this[_0x1bc6('0x14')]=_0x1299d5['responsetime'];this['endtime']=_0x1299d5[_0x1bc6('0x14')];this[_0x1bc6('0x15')]=_0x1299d5[_0x1bc6('0x15')]||0x0;this[_0x1bc6('0x16')]=_0x1299d5['holdtime']||0x0;this[_0x1bc6('0x17')]=_0x1299d5[_0x1bc6('0x17')]||0x0;this[_0x1bc6('0x18')]=_0x1299d5[_0x1bc6('0x18')];this[_0x1bc6('0x19')]=_0x1299d5[_0x1bc6('0x19')];this[_0x1bc6('0x1a')]=_0x1299d5[_0x1bc6('0x1a')];this[_0x1bc6('0x1b')]=_0x1299d5['recallme'];this[_0x1bc6('0x1c')]=_0x1299d5[_0x1bc6('0x1c')];this[_0x1bc6('0x1d')]=_0x1299d5['ListId'];this[_0x1bc6('0x1e')]=_0x1299d5[_0x1bc6('0x1e')];this[_0x1bc6('0x1f')]=_0x1299d5[_0x1bc6('0x1f')];this[_0x1bc6('0x20')]=_0x1299d5[_0x1bc6('0x20')];this[_0x1bc6('0x21')]=_0x1299d5[_0x1bc6('0x21')]||'';this[_0x1bc6('0x22')]=_0x1299d5[_0x1bc6('0x22')]||'';}module[_0x1bc6('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 47da666..471cfa3 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 _0x6ca0=['diff','seconds','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x240e3d,_0x28cba3){var _0x499ade=function(_0x3d109a){while(--_0x3d109a){_0x240e3d['push'](_0x240e3d['shift']());}};_0x499ade(++_0x28cba3);}(_0x6ca0,0x7a));var _0x06ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ca0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x06ca('0x0'));var _=require(_0x06ca('0x1'));var moment=require(_0x06ca('0x2'));function getSeconds(_0x1c043f,_0x59feec){var _0x522422=moment(_0x1c043f)[_0x06ca('0x3')](0x0);var _0x132633=moment(_0x59feec)[_0x06ca('0x3')](0x0);return _0x522422[_0x06ca('0x4')](_0x132633,_0x06ca('0x5'));}function Hangup(_0x1a74ca,_0x4c091b){this[_0x06ca('0x6')]=0x4;this[_0x06ca('0x7')]='Answer';this[_0x06ca('0x8')]=_0x1a74ca[_0x06ca('0x8')];this[_0x06ca('0x9')]=_0x1a74ca[_0x06ca('0x9')];this['campaigntype']=_0x1a74ca['type']===_0x06ca('0xa')?'queue':_0x1a74ca[_0x06ca('0x9')];this[_0x06ca('0xb')]=_0x1a74ca['countbusyretry'];this['countcongestionretry']=_0x1a74ca[_0x06ca('0xc')];this['countnoanswerretry']=_0x1a74ca[_0x06ca('0xd')];this['countglobal']=_0x1a74ca[_0x06ca('0xb')]+_0x1a74ca[_0x06ca('0xc')]+_0x1a74ca[_0x06ca('0xd')]+_0x1a74ca[_0x06ca('0xe')]+_0x1a74ca[_0x06ca('0xf')]+_0x1a74ca[_0x06ca('0x10')]+_0x1a74ca[_0x06ca('0x11')]+_0x1a74ca[_0x06ca('0x12')];this['countnosuchnumberretry']=_0x1a74ca[_0x06ca('0xe')];this['countdropretry']=_0x1a74ca[_0x06ca('0xf')];this[_0x06ca('0x10')]=_0x1a74ca['countabandonedretry'];this[_0x06ca('0x11')]=_0x1a74ca[_0x06ca('0x11')];this[_0x06ca('0x12')]=_0x1a74ca[_0x06ca('0x12')];this[_0x06ca('0x13')]=_0x4c091b[_0x06ca('0x13')];this['calleridname']=_0x1a74ca[_0x06ca('0x14')];this[_0x06ca('0x15')]=_0x1a74ca['number'];this[_0x06ca('0x16')]=_0x1a74ca[_0x06ca('0x16')];this[_0x06ca('0x17')]=_0x1a74ca[_0x06ca('0x17')];this[_0x06ca('0x18')]=moment()[_0x06ca('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x06ca('0x1a')]=getSeconds(_0x1a74ca[_0x06ca('0x17')],_0x1a74ca[_0x06ca('0x16')]);this[_0x06ca('0x1b')]=0x0;this[_0x06ca('0x1c')]=getSeconds(this['endtime'],_0x1a74ca['responsetime']);this[_0x06ca('0x1d')]=_0x1a74ca['queue'];this['membername']=_0x06ca('0x1e');this[_0x06ca('0x1f')]=_0x4c091b[_0x06ca('0x20')];this[_0x06ca('0x21')]=_0x1a74ca['callback'];this[_0x06ca('0x22')]=_0x1a74ca[_0x06ca('0x22')];this[_0x06ca('0x23')]=_0x1a74ca['callbackat'];this[_0x06ca('0x24')]=_0x1a74ca[_0x06ca('0x24')];this[_0x06ca('0x25')]=_0x1a74ca[_0x06ca('0x25')];this[_0x06ca('0x26')]=_0x1a74ca[_0x06ca('0x26')];this['UserId']=_0x1a74ca[_0x06ca('0x27')];this['VoiceQueueId']=_0x1a74ca['VoiceQueueId'];this[_0x06ca('0x28')]=_0x1a74ca[_0x06ca('0x28')];}module[_0x06ca('0x29')]=Hangup; \ No newline at end of file +var _0x922d=['callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','seconds','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback'];(function(_0x1ff0b1,_0x3503b5){var _0x422ac7=function(_0x309d77){while(--_0x309d77){_0x1ff0b1['push'](_0x1ff0b1['shift']());}};_0x422ac7(++_0x3503b5);}(_0x922d,0x1f4));var _0xd922=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x922d[_0x3e25c1];return _0x52e7f2;};'use strict';var util=require('util');var _=require(_0xd922('0x0'));var moment=require(_0xd922('0x1'));function getSeconds(_0x575710,_0x46235b){var _0x216a8b=moment(_0x575710)[_0xd922('0x2')](0x0);var _0x143741=moment(_0x46235b)[_0xd922('0x2')](0x0);return _0x216a8b['diff'](_0x143741,_0xd922('0x3'));}function Hangup(_0x2d4df4,_0x43d56f){this['state']=0x4;this['statedesc']=_0xd922('0x4');this['scheduledat']=_0x2d4df4['scheduledat'];this[_0xd922('0x5')]=_0x2d4df4[_0xd922('0x5')];this[_0xd922('0x6')]=_0x2d4df4[_0xd922('0x5')]===_0xd922('0x7')?_0xd922('0x8'):_0x2d4df4[_0xd922('0x5')];this[_0xd922('0x9')]=_0x2d4df4[_0xd922('0x9')];this[_0xd922('0xa')]=_0x2d4df4[_0xd922('0xa')];this[_0xd922('0xb')]=_0x2d4df4[_0xd922('0xb')];this[_0xd922('0xc')]=_0x2d4df4[_0xd922('0x9')]+_0x2d4df4[_0xd922('0xa')]+_0x2d4df4[_0xd922('0xb')]+_0x2d4df4['countnosuchnumberretry']+_0x2d4df4[_0xd922('0xd')]+_0x2d4df4['countabandonedretry']+_0x2d4df4[_0xd922('0xe')]+_0x2d4df4['countagentrejectretry'];this[_0xd922('0xf')]=_0x2d4df4[_0xd922('0xf')];this[_0xd922('0xd')]=_0x2d4df4[_0xd922('0xd')];this[_0xd922('0x10')]=_0x2d4df4['countabandonedretry'];this[_0xd922('0xe')]=_0x2d4df4[_0xd922('0xe')];this[_0xd922('0x11')]=_0x2d4df4[_0xd922('0x11')];this[_0xd922('0x12')]=_0x43d56f['uniqueid'];this['calleridname']=_0x2d4df4[_0xd922('0x13')];this[_0xd922('0x14')]=_0x2d4df4['number'];this[_0xd922('0x15')]=_0x2d4df4['starttime'];this['responsetime']=_0x2d4df4[_0xd922('0x16')];this[_0xd922('0x17')]=moment()[_0xd922('0x18')](_0xd922('0x19'));this[_0xd922('0x1a')]=getSeconds(_0x2d4df4['responsetime'],_0x2d4df4[_0xd922('0x15')]);this[_0xd922('0x1b')]=0x0;this[_0xd922('0x1c')]=getSeconds(this[_0xd922('0x17')],_0x2d4df4['responsetime']);this[_0xd922('0x8')]=_0x2d4df4[_0xd922('0x8')];this[_0xd922('0x1d')]=_0xd922('0x1e');this['reason']=_0x43d56f[_0xd922('0x1f')];this[_0xd922('0x20')]=_0x2d4df4[_0xd922('0x20')];this[_0xd922('0x21')]=_0x2d4df4[_0xd922('0x21')];this[_0xd922('0x22')]=_0x2d4df4[_0xd922('0x22')];this[_0xd922('0x23')]=_0x2d4df4['recallme'];this[_0xd922('0x24')]=_0x2d4df4[_0xd922('0x24')];this['ListId']=_0x2d4df4['ListId'];this[_0xd922('0x25')]=_0x2d4df4[_0xd922('0x25')];this[_0xd922('0x26')]=_0x2d4df4[_0xd922('0x26')];this[_0xd922('0x27')]=_0x2d4df4[_0xd922('0x27')];}module[_0xd922('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index f13b36b..50c16ea 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 _0x2305=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid'];(function(_0x53c2a9,_0x591554){var _0x3030a3=function(_0x120763){while(--_0x120763){_0x53c2a9['push'](_0x53c2a9['shift']());}};_0x3030a3(++_0x591554);}(_0x2305,0x122));var _0x5230=function(_0x4c5c97,_0x4f85bf){_0x4c5c97=_0x4c5c97-0x0;var _0xd5d2cb=_0x2305[_0x4c5c97];return _0xd5d2cb;};'use strict';var util=require(_0x5230('0x0'));var _=require(_0x5230('0x1'));var moment=require(_0x5230('0x2'));function getSeconds(_0x43497e,_0x470fc8){var _0x372d74=moment(_0x43497e)[_0x5230('0x3')](0x0);var _0x1176eb=moment(_0x470fc8)['milliseconds'](0x0);return _0x372d74[_0x5230('0x4')](_0x1176eb,'seconds');}function History(_0x5b455a){this[_0x5230('0x5')]=_0x5b455a[_0x5230('0x5')];this[_0x5230('0x6')]=_0x5b455a['scheduledat']||undefined;this[_0x5230('0x7')]=_0x5b455a['type'];this[_0x5230('0x8')]=_0x5b455a[_0x5230('0x7')]==='outbound'?_0x5230('0x9'):_0x5b455a[_0x5230('0x7')];this[_0x5230('0xa')]=_0x5b455a[_0x5230('0xa')];this[_0x5230('0xb')]=_0x5b455a[_0x5230('0xb')];this['countnoanswerretry']=_0x5b455a['countnoanswerretry'];this[_0x5230('0xc')]=_0x5b455a[_0x5230('0xa')]+_0x5b455a[_0x5230('0xb')]+_0x5b455a[_0x5230('0xd')]+_0x5b455a['countnosuchnumberretry']+_0x5b455a[_0x5230('0xe')]+_0x5b455a['countabandonedretry']+_0x5b455a[_0x5230('0xf')]+_0x5b455a[_0x5230('0x10')];this[_0x5230('0x11')]=_0x5b455a['countnosuchnumberretry'];this[_0x5230('0xe')]=_0x5b455a[_0x5230('0xe')];this['countabandonedretry']=_0x5b455a['countabandonedretry'];this[_0x5230('0xf')]=_0x5b455a['countmachineretry'];this[_0x5230('0x10')]=_0x5b455a[_0x5230('0x10')];this[_0x5230('0x9')]=_0x5b455a['queue'];this[_0x5230('0x12')]=_0x5b455a[_0x5230('0x13')];this[_0x5230('0x14')]=_0x5b455a[_0x5230('0x15')];this['starttime']=_0x5b455a[_0x5230('0x16')];this['responsetime']=_0x5b455a[_0x5230('0x17')];this[_0x5230('0x18')]=_0x5b455a[_0x5230('0x17')];this['ringtime']=getSeconds(_0x5b455a[_0x5230('0x17')],_0x5b455a['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this[_0x5230('0x19')]=_0x5b455a[_0x5230('0x19')];this[_0x5230('0x1a')]=_0x5b455a[_0x5230('0x1a')];this[_0x5230('0x1b')]=_0x5b455a[_0x5230('0x1b')];this['recallme']=_0x5b455a[_0x5230('0x1c')];this[_0x5230('0x1d')]=_0x5b455a[_0x5230('0x1d')];this[_0x5230('0x1e')]=_0x5b455a[_0x5230('0x1e')];this[_0x5230('0x1f')]=_0x5b455a['UserId'];this[_0x5230('0x20')]=_0x5b455a['VoiceQueueId'];this[_0x5230('0x21')]=_0x5b455a['CampaignId'];this['originatecalleridnum']=_0x5b455a[_0x5230('0x22')]||'';this['originatecalleridname']=_0x5b455a[_0x5230('0x23')]||'';}module[_0x5230('0x24')]=History; \ No newline at end of file +var _0x6d05=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x112e2a,_0x364486){var _0x4f8af9=function(_0xa11c0d){while(--_0xa11c0d){_0x112e2a['push'](_0x112e2a['shift']());}};_0x4f8af9(++_0x364486);}(_0x6d05,0x115));var _0x56d0=function(_0x4e2563,_0x273c9d){_0x4e2563=_0x4e2563-0x0;var _0x172553=_0x6d05[_0x4e2563];return _0x172553;};'use strict';var util=require('util');var _=require(_0x56d0('0x0'));var moment=require(_0x56d0('0x1'));function getSeconds(_0x9fdf56,_0x3a4add){var _0x192b4f=moment(_0x9fdf56)[_0x56d0('0x2')](0x0);var _0xf0f04b=moment(_0x3a4add)[_0x56d0('0x2')](0x0);return _0x192b4f[_0x56d0('0x3')](_0xf0f04b,_0x56d0('0x4'));}function History(_0xa1d898){this['uniqueid']=_0xa1d898['uniqueid'];this[_0x56d0('0x5')]=_0xa1d898[_0x56d0('0x5')]||undefined;this[_0x56d0('0x6')]=_0xa1d898['type'];this[_0x56d0('0x7')]=_0xa1d898[_0x56d0('0x6')]===_0x56d0('0x8')?'queue':_0xa1d898['type'];this[_0x56d0('0x9')]=_0xa1d898[_0x56d0('0x9')];this[_0x56d0('0xa')]=_0xa1d898['countcongestionretry'];this[_0x56d0('0xb')]=_0xa1d898[_0x56d0('0xb')];this[_0x56d0('0xc')]=_0xa1d898[_0x56d0('0x9')]+_0xa1d898[_0x56d0('0xa')]+_0xa1d898[_0x56d0('0xb')]+_0xa1d898[_0x56d0('0xd')]+_0xa1d898[_0x56d0('0xe')]+_0xa1d898[_0x56d0('0xf')]+_0xa1d898[_0x56d0('0x10')]+_0xa1d898[_0x56d0('0x11')];this['countnosuchnumberretry']=_0xa1d898[_0x56d0('0xd')];this[_0x56d0('0xe')]=_0xa1d898[_0x56d0('0xe')];this[_0x56d0('0xf')]=_0xa1d898[_0x56d0('0xf')];this[_0x56d0('0x10')]=_0xa1d898[_0x56d0('0x10')];this[_0x56d0('0x11')]=_0xa1d898[_0x56d0('0x11')];this[_0x56d0('0x12')]=_0xa1d898[_0x56d0('0x12')];this[_0x56d0('0x13')]=_0xa1d898[_0x56d0('0x14')];this[_0x56d0('0x15')]=_0xa1d898[_0x56d0('0x16')];this[_0x56d0('0x17')]=_0xa1d898['starttime'];this[_0x56d0('0x18')]=_0xa1d898[_0x56d0('0x18')];this['endtime']=_0xa1d898[_0x56d0('0x18')];this[_0x56d0('0x19')]=getSeconds(_0xa1d898['responsetime'],_0xa1d898[_0x56d0('0x17')]);this[_0x56d0('0x1a')]=0x0;this[_0x56d0('0x1b')]=0x0;this[_0x56d0('0x1c')]=_0xa1d898[_0x56d0('0x1c')];this[_0x56d0('0x1d')]=_0xa1d898[_0x56d0('0x1d')];this[_0x56d0('0x1e')]=_0xa1d898['callbackat'];this[_0x56d0('0x1f')]=_0xa1d898['recallme'];this['ContactId']=_0xa1d898[_0x56d0('0x20')];this['ListId']=_0xa1d898[_0x56d0('0x21')];this[_0x56d0('0x22')]=_0xa1d898[_0x56d0('0x22')];this[_0x56d0('0x23')]=_0xa1d898['VoiceQueueId'];this[_0x56d0('0x24')]=_0xa1d898[_0x56d0('0x24')];this[_0x56d0('0x25')]=_0xa1d898[_0x56d0('0x25')]||'';this[_0x56d0('0x26')]=_0xa1d898[_0x56d0('0x26')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 83d2a7b..50228b1 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 _0x9d80=['type','outbound','strategy','answered','pTalking','sumBillable','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\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','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[actions]','Action','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','then','countReScheduled','[countReScheduled]\x20','resolve','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','ListId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','trunks','SIP/%s','status','reachable','unmonitored','moveContactManagedDialer','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','uniqueid','outboundAnswerCallsDay','state','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countglobal','countbusyretry','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','stateGlobal','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','dialQueueProject','Unknow','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','timezones','content','indexOf','true','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','launchHandleIvr','loggedIn','dialGlobalInterval','dialTimezone','checkDialMethod','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','substring','dialCutDigit','trim','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','buildObj','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','log','Contact\x20updated','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[actionOriginate]\x20','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','md5','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./final','./agentComplete','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9d80,0x1d1));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x09d8('0x0'));var _=require(_0x09d8('0x1'));var BPromise=require('bluebird');var uuid=require(_0x09d8('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x09d8('0x3'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0x09d8('0x4'));var logger=require(_0x09d8('0x5'))('dialer');var loggerBooked=require(_0x09d8('0x5'))('booked');var loggerPredictive=require('../../../config/logger')(_0x09d8('0x6'));var loggerPredictiveCalls=require(_0x09d8('0x5'))(_0x09d8('0x7'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x09d8('0x8'));config[_0x09d8('0x9')]=_['defaults'](config[_0x09d8('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x09d8('0xa'))(new Redis(config[_0x09d8('0x9')]));var cmHopper=require(_0x09d8('0xb'));var cmHopperFinal=require(_0x09d8('0xc'));var cmHopperHistory=require(_0x09d8('0xd'));var cmHopperBlack=require(_0x09d8('0xe'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x09d8('0xf'));var History=require('./history');var Final=require(_0x09d8('0x10'));var AgentComplete=require(_0x09d8('0x11'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x09d8('0x12')][_0x09d8('0x13')]||'127.0.0.1';var strategy={'rrmemory':_0x09d8('0x14'),'roundrobin':_0x09d8('0x15')};var Sequence=function(){};Sequence[_0x09d8('0x16')][_0x09d8('0x17')]=function(_0x36823e){this['tail']=this[_0x09d8('0x18')]?this[_0x09d8('0x18')][_0x09d8('0x19')](_0x36823e):_0x36823e();};function Dialer(_0x46b53c,_0xff904f){this[_0x09d8('0x1a')]=new Sequence();this[_0x09d8('0x1b')]=_0xff904f;this[_0x09d8('0x1c')]=_0x46b53c[_0x09d8('0x1c')];this[_0x09d8('0x1d')]=_0x46b53c[_0x09d8('0x1d')];this[_0x09d8('0x1e')]=_0x46b53c['agents'];this['trunks']=_0x46b53c['trunks'];this[_0x09d8('0x1f')]=config[_0x09d8('0x1f')]||0x2;this[_0x09d8('0x20')]={};this[_0x09d8('0x21')]={};this[_0x09d8('0x22')]={};this[_0x09d8('0x23')]={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this[_0x09d8('0x24')]={};this[_0x09d8('0x25')]={};this[_0x09d8('0x26')]={};ami['on'](_0x09d8('0x27'),this[_0x09d8('0x28')][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x2a'),this[_0x09d8('0x2b')]['bind'](this));ami['on'](_0x09d8('0x2c'),this['syncOriginateResponse'][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x2d'),this[_0x09d8('0x2e')][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x2f'),this[_0x09d8('0x30')][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x31'),this['syncHangup']['bind'](this));ami['on'](_0x09d8('0x32'),this[_0x09d8('0x33')][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x34'),this[_0x09d8('0x35')]['bind'](this));ami['on'](_0x09d8('0x36'),this[_0x09d8('0x37')][_0x09d8('0x29')](this));ami['on'](_0x09d8('0x38'),this['syncQueueStatusComplete']['bind'](this));this['loopCampaigns']();this[_0x09d8('0x39')]();}function isNotNull(_0x377482){return _0x377482!==null&&!_[_0x09d8('0x3a')](_0x377482);}function checkIsLoggedIn(_0x580ca2,_0x59c7ad){return function(){if(_0x59c7ad<=0x0){_0x580ca2[_0x09d8('0x3b')]=_0x09d8('0x3c');throw _0x580ca2['name']+_0x09d8('0x3d');}};}function isActive(_0x16048c){return _0x16048c;}function checkIsActive(_0x122f9c,_0x364b45){return function(){if(!isActive(_0x364b45)){_0x122f9c['message']=_0x09d8('0x3e');throw _0x122f9c[_0x09d8('0x3f')]+_0x09d8('0x40');}};}function checkInterval(_0x3d8298){return function(){if(!isNotNull(_0x3d8298[_0x09d8('0x41')])){_0x3d8298[_0x09d8('0x3b')]=_0x09d8('0x42');throw _0x3d8298['name']+_0x09d8('0x43');}if(!isNotNull(_0x3d8298['Interval'][_0x09d8('0x44')])){_0x3d8298[_0x09d8('0x3b')]=_0x09d8('0x42');throw _0x3d8298[_0x09d8('0x3f')]+_0x09d8('0x43');}if(!isNotNull(_[_0x09d8('0x45')](_0x3d8298['Interval']['Intervals']))){_0x3d8298[_0x09d8('0x3b')]=_0x09d8('0x42');throw _0x3d8298[_0x09d8('0x3f')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x50416,_0x58667c,_0x2af59d){return{'action':_0x50416,'response':_0x58667c,'message':_0x2af59d,'stack':_0x2af59d};}function myreject(_0x2bd0bd){return function(_0x7eb86c){return _0x2bd0bd(msgResponse(_0x09d8('0x46'),_0x09d8('0x47'),JSON['stringify'](_0x7eb86c)));};}function getSeconds(_0x3ac166,_0x13f01f){var _0x1285f1=moment(_0x3ac166)[_0x09d8('0x48')](0x0);var _0xec870a=moment(_0x13f01f)[_0x09d8('0x48')](0x0);return _0x1285f1[_0x09d8('0x49')](_0xec870a,_0x09d8('0x4a'));}function emit(_0x38f070,_0x611096,_0x544b66){io['to'](_0x38f070)[_0x09d8('0x4b')](_0x611096,_0x544b66);}function emitVoiceQueueSummary(_0x1084f0){if(_0x1084f0[_0x09d8('0x4c')]===_0x09d8('0x4d')){var _0x611659={'id':_0x1084f0['id'],'name':_0x1084f0[_0x09d8('0x3f')],'strategy':_0x1084f0[_0x09d8('0x4e')],'answered':_0x1084f0[_0x09d8('0x4f')],'available':_0x1084f0['available'],'loggedIn':_0x1084f0['loggedIn'],'pTalking':_0x1084f0[_0x09d8('0x50')],'sumBillable':_0x1084f0[_0x09d8('0x51')],'sumDuration':_0x1084f0['sumDuration'],'sumHoldTime':_0x1084f0['sumHoldTime']||0x0,'talking':_0x1084f0[_0x09d8('0x52')],'total':_0x1084f0[_0x09d8('0x53')],'type':_0x1084f0[_0x09d8('0x4c')],'unmanaged':_0x1084f0[_0x09d8('0x54')],'abandoned':_0x1084f0['abandoned'],'waiting':_0x1084f0[_0x09d8('0x55')],'loggedInDb':_0x1084f0[_0x09d8('0x56')],'dialActive':_0x1084f0[_0x09d8('0x57')],'dialMethod':_0x1084f0[_0x09d8('0x58')],'dialOriginateCallerIdName':_0x1084f0[_0x09d8('0x59')],'dialOriginateCallerIdNumber':_0x1084f0[_0x09d8('0x5a')],'dialOriginateTimeout':_0x1084f0[_0x09d8('0x5b')],'dialPrefix':_0x1084f0[_0x09d8('0x5c')],'outboundAnswerAgiCallsDay':_0x1084f0[_0x09d8('0x5d')],'outboundAnswerCallsDay':_0x1084f0['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1084f0[_0x09d8('0x5e')],'outboundBusyCallsDay':_0x1084f0[_0x09d8('0x5f')],'outboundCongestionCallsDay':_0x1084f0['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x1084f0['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1084f0[_0x09d8('0x60')],'outboundDropCallsDayTimeout':_0x1084f0[_0x09d8('0x61')],'outboundNoAnswerCallsDay':_0x1084f0[_0x09d8('0x62')],'outboundNoSuchCallsDay':_0x1084f0['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1084f0[_0x09d8('0x63')],'outboundReCallsDay':_0x1084f0[_0x09d8('0x64')],'outboundRejectCallsDay':_0x1084f0['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1084f0[_0x09d8('0x65')],'predictiveIntervalAnsweredCalls':_0x1084f0[_0x09d8('0x66')],'predictiveIntervalAvgHoldtime':_0x1084f0[_0x09d8('0x67')],'predictiveIntervalAvgTalktime':_0x1084f0[_0x09d8('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x1084f0[_0x09d8('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x1084f0[_0x09d8('0x6a')],'predictiveIntervalErlangCalls':_0x1084f0[_0x09d8('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x1084f0['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x1084f0[_0x09d8('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x1084f0[_0x09d8('0x6d')],'predictiveIntervalPauses':_0x1084f0[_0x09d8('0x6e')],'predictiveIntervalAvailable':_0x1084f0[_0x09d8('0x6f')],'predictiveIntervalTotalCalls':_0x1084f0[_0x09d8('0x70')],'message':_0x1084f0[_0x09d8('0x3b')],'originated':_0x1084f0[_0x09d8('0x71')],'erlangCalls':_0x1084f0[_0x09d8('0x72')],'erlangCallToSecond':_0x1084f0[_0x09d8('0x73')],'erlangAbandonmentRate':_0x1084f0['erlangAbandonmentRate'],'erlangBusyFactor':_0x1084f0[_0x09d8('0x74')],'startPredictive':_0x1084f0['startPredictive'],'startProgressive':_0x1084f0[_0x09d8('0x75')]};if(_0x1084f0[_0x09d8('0x76')]){_0x611659['Trunk']={'id':_0x1084f0['Trunk']['id'],'name':_0x1084f0['Trunk'][_0x09d8('0x3f')],'active':_0x1084f0['Trunk'][_0x09d8('0x77')],'callerid':_0x1084f0[_0x09d8('0x76')][_0x09d8('0x78')]};}if(_0x1084f0[_0x09d8('0x41')]){_0x611659[_0x09d8('0x41')]={'id':_0x1084f0['Interval']['id'],'name':_0x1084f0[_0x09d8('0x41')][_0x09d8('0x3f')]};}var _0x400b46=md5(JSON[_0x09d8('0x79')](_0x611659));if(_0x1084f0[_0x09d8('0x3')]!==_0x400b46){_0x1084f0[_0x09d8('0x3')]=_0x400b46;emit(util['format'](_0x09d8('0x7a'),_0x611659[_0x09d8('0x3f')]),_0x09d8('0x7b'),_0x611659);}}}function emitCampaignSummary(_0x32c9fd){if(_0x32c9fd[_0x09d8('0x4c')]===_0x09d8('0x7c')){emit(util['format'](_0x09d8('0x7d'),_0x32c9fd[_0x09d8('0x3f')]),_0x09d8('0x7e'),_0x32c9fd);}}function checkGetDataPredictive(_0x5cbf3f){if(isNotNull(_0x5cbf3f)){if(!_['isEmpty'](_0x5cbf3f)){loggerPredictive[_0x09d8('0x7f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x80'),_0x5cbf3f[_0x09d8('0x70')]);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x81'),_0x5cbf3f['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x82'),_0x5cbf3f[_0x09d8('0x6a')]);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x83'),_0x5cbf3f[_0x09d8('0x69')]);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x84'),_0x5cbf3f['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x09d8('0x7f')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5cbf3f['predictiveIntervalAvgTalktime']);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x85'));if(_0x5cbf3f[_0x09d8('0x70')]>0x0){if(!_[_0x09d8('0x3a')](_0x5cbf3f[_0x09d8('0x68')])&&_0x5cbf3f[_0x09d8('0x68')]>0x0){return!![];}else{loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x86'));}if(!_['isUndefined'](_0x5cbf3f[_0x09d8('0x67')])&&_0x5cbf3f[_0x09d8('0x67')]>0x0){return!![];}else{loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x87'));}}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x88'));}}else{loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x88'));}return![];}function mergeDataErlangB(_0x387701){return function(_0x1fb338){loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x89'));loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x8a'),_0x1fb338[_0x09d8('0x72')]);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x8b'),_0x1fb338[_0x09d8('0x73')]);loggerPredictive['info'](_0x09d8('0x8c'),_0x1fb338['erlangAbandonmentRate']);loggerPredictive['info'](_0x09d8('0x8d'),_0x1fb338['erlangBusyFactor']);loggerPredictive['info'](_0x09d8('0x8c'),_0x1fb338[_0x09d8('0x8e')]);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x85'));_[_0x09d8('0x8f')](_0x387701,_0x1fb338);};}function getDiff(_0x47cd0d){var _0x135075=moment()[_0x09d8('0x48')](0x0);var _0x83397e=moment(_0x47cd0d)[_0x09d8('0x48')](0x0);return _0x135075[_0x09d8('0x49')](_0x83397e,'seconds');}function ifInterval(_0x2ca7ee,_0x34add8){if(_[_0x09d8('0x3a')](_0x34add8)){return![];}if(getDiff(_0x34add8)<_0x2ca7ee*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x26afe0){if(isNotNull(_0x26afe0)){if(!_[_0x09d8('0x3a')](_0x26afe0['startProgressive'])){_0x26afe0[_0x09d8('0x75')]=undefined;loggerPredictive[_0x09d8('0x7f')](_0x26afe0['name'],_0x09d8('0x90'));}if(!_['isUndefined'](_0x26afe0[_0x09d8('0x91')])){_0x26afe0[_0x09d8('0x91')]=undefined;loggerPredictive[_0x09d8('0x7f')](_0x26afe0[_0x09d8('0x3f')],_0x09d8('0x92'));}if(!_['isUndefined'](_0x26afe0['handlePredictive'])){clearInterval(_0x26afe0[_0x09d8('0x93')]);_0x26afe0[_0x09d8('0x93')]=undefined;loggerPredictive[_0x09d8('0x7f')](_0x26afe0['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0xe7621f,_0x12656b){if(_0x12656b===0x0){return 0x0;}var _0x126fa2=0x1;for(var _0x2a4e8c=0x1;_0x2a4e8c<=_0x12656b;_0x2a4e8c+=0x1){_0x126fa2=0x1+_0x126fa2*_0x2a4e8c/_0xe7621f;}return 0x1/_0x126fa2;}function isVoiceQueueOutbound(_0x463f50){return _0x463f50==='outbound';}function isNotPreview(_0x58c865){return _0x58c865!=='preview';}function isCampaignIvr(_0x49aed7){return _0x49aed7===_0x09d8('0x7c');}function getCallerId(_0x5b13eb,_0x479e27,_0x5ec30a){if(!_[_0x09d8('0x3a')](_0x5ec30a)&&_0x09d8('0x94')===typeof _0x5ec30a&&!_[_0x09d8('0x45')](_0x5ec30a)){if(!_[_0x09d8('0x3a')](_0x479e27)&&'string'===typeof _0x479e27&&!_[_0x09d8('0x45')](_0x479e27)){return util[_0x09d8('0x95')](_0x09d8('0x96'),_0x479e27,_0x5ec30a);}return util['format'](_0x09d8('0x96'),_0x5ec30a,_0x5ec30a);}if(!_['isUndefined'](_0x5b13eb)&&'string'===typeof _0x5b13eb&&!_[_0x09d8('0x45')](_0x5b13eb)){return _0x5b13eb;}return _0x09d8('0x97');}function loggerCatchQueueSummary(_0x1f1411,_0x26f459){return function(_0x19241d){freeVariablesPredictive(_0x26f459);emitVoiceQueueSummary(_0x26f459);emitCampaignSummary(_0x26f459);loggerSyncQueueSummary[_0x09d8('0x98')](_0x1f1411,util['inspect'](_0x19241d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x40522f,_0x1d4b41){return function(_0x4a6b5d){loggerPredictive[_0x09d8('0x98')](_0x1d4b41[_0x09d8('0x3f')],_0x40522f);loggerPredictive[_0x09d8('0x98')](_0x4a6b5d[_0x09d8('0x99')]);freeVariablesPredictive(_0x1d4b41);};}function loggerCatch(_0xc8113f){return function(_0xd7d285){logger[_0x09d8('0x98')](_0xc8113f,util[_0x09d8('0x9a')](_0xd7d285,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4c0a75){return _0x4c0a75&&!_[_0x09d8('0x3a')](_0x4c0a75)&&_0x4c0a75['length']>0x0;}function decremetOriginate(_0x108c4c){if(!_['isUndefined'](_0x108c4c)&&_0x108c4c!==null){if(_0x108c4c[_0x09d8('0x9b')]('originated')){if(_0x108c4c[_0x09d8('0x71')]>0x0){_0x108c4c['originated']-=0x1;}else{logger[_0x09d8('0x98')](_0x09d8('0x9c'));}}}else{logger['error'](_0x09d8('0x9d'));}}function checkContactLowerLimitOriginate(_0x24e7d9,_0x10a9e7,_0x2e7ea0){if(_0x10a9e7>_0x2e7ea0){for(var _0x182081=0x0;_0x182081<_0x10a9e7-_0x2e7ea0;_0x182081+=0x1){decremetOriginate(_0x24e7d9);}}}function loggerGetContactDialer(_0x39ae94,_0x3f3e4c,_0x25b3f8){return function(_0x41dbf4){checkContactLowerLimitOriginate(_0x3f3e4c,_0x25b3f8,0x0);logger[_0x09d8('0x98')](_0x39ae94,util[_0x09d8('0x9a')](_0x41dbf4,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4afdfc){return function(_0x6a1d39){if(isNotNull(_0x6a1d39)&&isNotNull(_0x6a1d39[0x0])){if(_0x6a1d39[0x0][_0x09d8('0x9e')]>0x0){_0x4afdfc['message']=_0x09d8('0x9f');logger['info'](_0x09d8('0xa0')+_0x4afdfc[_0x09d8('0x3f')],_0x6a1d39[0x0][_0x09d8('0x9e')],_0x09d8('0xa1'));}else{_0x4afdfc[_0x09d8('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x09d8('0x7f')]('[getContactDialer2][Empty]'+_0x4afdfc[_0x09d8('0x3f')]);}}};}function notSendMessagesQueue(_0x5a38e1){if(_0x5a38e1[_0x09d8('0xa2')]){freeVariablesPredictive(_0x5a38e1);if(_0x5a38e1[_0x09d8('0x71')]===0x0&&_0x5a38e1['talking']===0x0&&_0x5a38e1[_0x09d8('0x55')]===0x0&&(_0x5a38e1[_0x09d8('0x50')]||0x0)===0x0){_0x5a38e1[_0x09d8('0xa2')]=![];_0x5a38e1[_0x09d8('0xa3')]=0x0;_0x5a38e1[_0x09d8('0x3b')]=_0x09d8('0x3e');loggerSyncQueueSummary['error'](_0x09d8('0xa4'),_0x5a38e1[_0x09d8('0x3f')],_0x09d8('0xa5'));}else{_0x5a38e1[_0x09d8('0x3b')]=_0x09d8('0xa6');loggerSyncQueueSummary[_0x09d8('0x98')](_0x09d8('0xa4'),_0x5a38e1[_0x09d8('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a38e1);}}function notSendMessagesCampaign(_0x35b0dc){if(_0x35b0dc[_0x09d8('0xa2')]){if(_0x35b0dc[_0x09d8('0x71')]===0x0){_0x35b0dc[_0x09d8('0xa2')]=![];_0x35b0dc[_0x09d8('0x3b')]=_0x09d8('0x3e');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x35b0dc[_0x09d8('0x3f')],'is\x20not\x20active');}else{_0x35b0dc['message']=_0x09d8('0xa6');loggerSyncQueueSummary[_0x09d8('0x98')](_0x09d8('0xa7'),_0x35b0dc[_0x09d8('0x3f')],'is\x20disactive');}emitCampaignSummary(_0x35b0dc);}}function createObjHistory(_0x5d6b6c,_0x378921,_0x45173f,_0x5517b9,_0x49fdb9){_0x5d6b6c[_0x09d8('0x3b')]=_0x45173f;var _0x3ac40d=new Action(_0x5d6b6c,_0x378921);var _0x3e063e=new History(_0x3ac40d);_0x3e063e['state']=_0x5517b9;_0x3e063e[_0x09d8('0xa8')]=_0x49fdb9;_0x3e063e[_0x09d8('0xa9')]=_0x3ac40d[_0x09d8('0xaa')];return _0x3e063e;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x2cdd8b=this;setInterval(function(){_0x2cdd8b[_0x09d8('0xab')](_0x2cdd8b['uniqueId'],'[uniqueid]');_0x2cdd8b['clearZombieChannels'](_0x2cdd8b['actions'],_0x09d8('0xac'));},0x32c8);};Dialer[_0x09d8('0x16')][_0x09d8('0xab')]=function(_0xb9f03,_0x47463e){var _0x4e6908=this;for(var _0x3c7da6 in _0xb9f03){if(_0xb9f03[_0x09d8('0x9b')](_0x3c7da6)){this[_0x09d8('0x1a')][_0x09d8('0x17')](function(){if(!_['isNil'](_0xb9f03[_0x3c7da6])){return ami[_0x09d8('0xad')]({'action':'status','channel':_0xb9f03[_0x3c7da6][_0x09d8('0xae')]})[_0x09d8('0xaf')](function(_0x3c3740){if(_0x3c3740[_0x09d8('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xb9f03[_0x3c7da6]&&_0xb9f03[_0x3c7da6]['type']!==_0x09d8('0x7c')){_0x4e6908[_0x09d8('0xb0')](_0x4e6908[_0x09d8('0x1c')][_0xb9f03[_0x3c7da6][_0x09d8('0xb1')]]);logger[_0x09d8('0x98')](_0x09d8('0xb2'),_0x47463e,_0x3c7da6,_0xb9f03[_0x3c7da6]['queue']);delete _0xb9f03[_0x3c7da6];}if(_0xb9f03[_0x3c7da6]&&_0xb9f03[_0x3c7da6]['type']===_0x09d8('0x7c')){_0x4e6908['updateOriginated'](_0x4e6908[_0x09d8('0x1d')][_0xb9f03[_0x3c7da6][_0x09d8('0xb1')]]);logger['error'](_0x09d8('0xb3'),_0x47463e,_0x3c7da6,_0xb9f03[_0x3c7da6][_0x09d8('0xb1')]);delete _0xb9f03[_0x3c7da6];}},0x2328);}});}});}}};Dialer[_0x09d8('0x16')]['countReScheduled']=function(_0x41adf1){return BPromise['resolve']()[_0x09d8('0xb4')](cmHopper[_0x09d8('0xb5')](_0x41adf1))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xb6')));};Dialer[_0x09d8('0x16')]['checkIsBlackList']=function(_0x4179d5){return BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](cmHopperBlack[_0x09d8('0xb8')](_0x4179d5))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xb9')));};Dialer[_0x09d8('0x16')][_0x09d8('0xba')]=function(_0x4a046f){return BPromise['resolve']()[_0x09d8('0xb4')](cmHopperBlack[_0x09d8('0xba')](_0x4a046f))[_0x09d8('0xaf')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x09d8('0x16')]['averageHandleTime']=function(_0x52b4f5){return BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](cmHopperHistory[_0x09d8('0xbb')](_0x52b4f5))[_0x09d8('0xaf')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x09d8('0x16')][_0x09d8('0xbc')]=function(_0x37eee9){return BPromise['resolve']()[_0x09d8('0xb4')](cmHopper['rescheduleContact'](_0x37eee9))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x09d8('0x16')][_0x09d8('0xbd')]=function(_0x4d3517,_0x2c099c,_0x2fb7bb){return BPromise[_0x09d8('0xb7')]()['then'](cmHopper[_0x09d8('0xbd')](_0x4d3517,_0x2c099c,_0x2fb7bb))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xbe')));};Dialer['prototype'][_0x09d8('0xbf')]=function(_0x3f8ee3,_0x1aac72,_0x233d14,_0x577bf9){return BPromise['resolve']()[_0x09d8('0xb4')](cmHopper[_0x09d8('0xbf')](_0x3f8ee3,_0x1aac72,_0x233d14,_0x577bf9))['catch'](loggerCatch(_0x09d8('0xc0')));};Dialer['prototype']['getContactDialerIvr']=function(_0x5824fd,_0x3eaa2a,_0x443529){return BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](cmHopper[_0x09d8('0xc1')](_0x5824fd,_0x3eaa2a,_0x443529))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xc0')));};Dialer[_0x09d8('0x16')][_0x09d8('0xc2')]=function(_0x4518ee){return BPromise[_0x09d8('0xb7')]()['then'](voiceQueueRt[_0x09d8('0xc2')](_0x4518ee))[_0x09d8('0xaf')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x09d8('0x16')]['moveContactManagedDialer']=function(_0x5eb3be){return BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](cmHopper['moveContactManagedDialer'](_0x5eb3be))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xc3')));};Dialer[_0x09d8('0x16')][_0x09d8('0xc4')]=function(_0x4536a9){return BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](cmHopperHistory[_0x09d8('0xc4')](_0x4536a9))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xc5')));};Dialer['prototype']['updateOriginated']=function(_0x21028c){if(!_['isUndefined'](_0x21028c)&&_0x21028c!==null){if(_0x21028c[_0x09d8('0x9b')](_0x09d8('0x71'))){if(_0x21028c[_0x09d8('0x71')]>0x0){_0x21028c[_0x09d8('0x71')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x09d8('0xc6'));}};Dialer[_0x09d8('0x16')][_0x09d8('0xc7')]=function(_0x50141d,_0x223cfb){var _0x51e2b0=this;return function(_0x24ab67){_0x51e2b0[_0x09d8('0xb0')](_0x223cfb);logger[_0x09d8('0x98')](_0x50141d,util[_0x09d8('0x9a')](_0x24ab67,{'showHidden':![],'depth':null}));};};Dialer[_0x09d8('0x16')][_0x09d8('0xc8')]=function(_0x581b5e,_0x34427a,_0x21339c){var _0x2b7371={'state':0x19,'statedesc':_0x09d8('0xc9')};this[_0x09d8('0xb0')](_0x34427a);this[_0x09d8('0xca')](_[_0x09d8('0x8f')](_0x2b7371,_['pick'](_0x21339c,['ContactId',_0x09d8('0xcb'),_0x09d8('0xcc'),'VoiceQueueId',_0x09d8('0xcd')])),_0x09d8('0xce'),_0x09d8('0xcf'));logger[_0x09d8('0x98')](_0x581b5e);};Dialer[_0x09d8('0x16')][_0x09d8('0xd0')]=function(_0x1969de){return _0x1969de===_0x09d8('0xd1');};Dialer[_0x09d8('0x16')]['isTrunkReachable']=function(_0x3e6a47){return!_[_0x09d8('0x3a')](_0x3e6a47)&&_0x3e6a47&&!_[_0x09d8('0x3a')](_0x3e6a47[_0x09d8('0x3f')])&&!_[_0x09d8('0x3a')](_0x3e6a47[_0x09d8('0x77')])&&_0x3e6a47['active']&&(this[_0x09d8('0xd2')][util[_0x09d8('0x95')](_0x09d8('0xd3'),_0x3e6a47[_0x09d8('0x3f')])][_0x09d8('0xd4')]===_0x09d8('0xd5')||this['trunks'][util[_0x09d8('0x95')](_0x09d8('0xd3'),_0x3e6a47[_0x09d8('0x3f')])][_0x09d8('0xd4')]===_0x09d8('0xd6'));};Dialer[_0x09d8('0x16')]['saveInDb']=function(_0x8d1140,_0x1f6e5d,_0x4c5584){this[_0x09d8('0xc4')](_0x8d1140)[_0x09d8('0xaf')](loggerCatch(_0x1f6e5d));this[_0x09d8('0xd7')](_0x8d1140)['catch'](loggerCatch(_0x4c5584));};Dialer[_0x09d8('0x16')]['syncVarSet']=function(_0x27ccd0){var _0x239d7d=this[_0x09d8('0x23')][_0x27ccd0['uniqueid']];var _0x3028fd;if(!_[_0x09d8('0xd8')](_0x27ccd0)&&!_[_0x09d8('0xd8')](_0x27ccd0[_0x09d8('0xd9')])&&!_[_0x09d8('0xd8')](_0x27ccd0[_0x09d8('0xd9')][_0x09d8('0xda')])&&_0x27ccd0[_0x09d8('0xdb')]===_0x09d8('0xdc')&&_0x239d7d){if(_0x239d7d[_0x09d8('0x4c')]!=='ivr'&&this[_0x09d8('0x1c')][_0x239d7d[_0x09d8('0xb1')]]['dialAMDActive']&&_0x27ccd0[_0x09d8('0xdd')]===_0x09d8('0xde')){delete this[_0x09d8('0x23')][_0x27ccd0[_0x09d8('0xdf')]];this[_0x09d8('0xb0')](this['voiceQueues'][_0x239d7d[_0x09d8('0xb1')]]);this[_0x09d8('0x1c')][_0x239d7d['queue']][_0x09d8('0xe0')]+=0x1;this[_0x09d8('0x1c')][_0x239d7d[_0x09d8('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x3028fd=new Hangup(_0x239d7d,_0x27ccd0);_0x3028fd[_0x09d8('0xe1')]=0x12;_0x3028fd[_0x09d8('0xa8')]='HangupInAMD';_0x3028fd[_0x09d8('0xe2')]=_0x09d8('0xe3');this['saveInDb'](_0x3028fd,_0x09d8('0xe4'),_0x09d8('0xe5'));}if(_0x239d7d[_0x09d8('0x4c')]!==_0x09d8('0x7c')&&this['voiceQueues'][_0x239d7d['queue']][_0x09d8('0xe6')]&&_0x27ccd0[_0x09d8('0xdd')]===_0x09d8('0xe7')){var _0x586816=this;return new BPromise(function(_0x2a05dd,_0x2b26b5){delete _0x586816[_0x09d8('0x23')][_0x27ccd0[_0x09d8('0xdf')]];_0x586816['updateOriginated'](_0x586816[_0x09d8('0x1c')][_0x239d7d[_0x09d8('0xb1')]]);_0x586816[_0x09d8('0x1c')][_0x239d7d[_0x09d8('0xb1')]]['outboundAnswerCallsDay']+=0x1;_0x586816[_0x09d8('0x1c')][_0x239d7d[_0x09d8('0xb1')]][_0x09d8('0x5d')]+=0x1;var _0x11139a=_0x586816[_0x09d8('0x1c')][_0x239d7d['queue']];var _0x5ebb65=new Hangup(_0x239d7d,_0x27ccd0);_0x5ebb65[_0x09d8('0xe1')]=0x13;_0x5ebb65['statedesc']=_0x09d8('0xe8');_0x5ebb65[_0x09d8('0xe2')]='AMD';_0x5ebb65['countmachineretry']+=0x1;_0x5ebb65[_0x09d8('0xe9')]+=0x1;_0x5ebb65['amd']=!![];_0x586816[_0x09d8('0xc4')](_0x5ebb65)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x5ebb65[_0x09d8('0xea')]+_0x5ebb65[_0x09d8('0xeb')]+_0x5ebb65['countnoanswerretry']+_0x5ebb65['countnosuchnumberretry']+_0x5ebb65[_0x09d8('0xec')]+_0x5ebb65['countabandonedretry']+_0x5ebb65[_0x09d8('0xed')]+_0x5ebb65[_0x09d8('0xee')]>=_0x11139a[_0x09d8('0xef')]){_0x586816['stateGlobal'](_0x5ebb65,_0x2a05dd,_0x2b26b5,_0x09d8('0xf0'));}else{if(_0x5ebb65[_0x09d8('0xed')]>=_0x11139a['dialMachineMaxRetry']){_0x586816[_0x09d8('0xf1')](_0x5ebb65,_0x2a05dd,_0x2b26b5,_0x09d8('0xf2'));}else{_0x586816[_0x09d8('0xbc')]({'active':![],'countmachineretry':_0x5ebb65[_0x09d8('0xed')],'scheduledat':moment()[_0x09d8('0xf3')](_0x11139a[_0x09d8('0xf4')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x5ebb65[_0x09d8('0xf7')],'ListId':_0x5ebb65[_0x09d8('0xcb')],'VoiceQueueId':_0x5ebb65[_0x09d8('0xf8')]||undefined,'CampaignId':_0x5ebb65[_0x09d8('0xcd')]||undefined})['catch'](loggerCatch(_0x09d8('0xf9')));_0x2a05dd({'reschedule':0x1});}}});}if(_0x239d7d[_0x09d8('0x4c')]===_0x09d8('0x7c')&&this[_0x09d8('0x1d')][_0x239d7d['queue']]['dialAMDActive']&&_0x27ccd0[_0x09d8('0xdd')]==='HANGUP'){delete this['uniqueId'][_0x27ccd0[_0x09d8('0xdf')]];this[_0x09d8('0xb0')](this['campaigns'][_0x239d7d[_0x09d8('0xb1')]]);_0x3028fd=new Hangup(_0x239d7d,_0x27ccd0);_0x3028fd[_0x09d8('0xe1')]=0x12;_0x3028fd[_0x09d8('0xa8')]=_0x09d8('0xfa');_0x3028fd['membername']='AMD';this[_0x09d8('0xca')](_0x3028fd,_0x09d8('0xfb'),_0x09d8('0xfc'));}if(_0x239d7d[_0x09d8('0x4c')]===_0x09d8('0x7c')&&this[_0x09d8('0x1d')][_0x239d7d[_0x09d8('0xb1')]][_0x09d8('0xe6')]&&_0x27ccd0[_0x09d8('0xdd')]===_0x09d8('0xe7')){var _0x586816=this;return new BPromise(function(_0x5a9027,_0x11223d){delete _0x586816[_0x09d8('0x23')][_0x27ccd0[_0x09d8('0xdf')]];_0x586816[_0x09d8('0xb0')](_0x586816[_0x09d8('0x1d')][_0x239d7d[_0x09d8('0xb1')]]);_0x586816[_0x09d8('0x1d')][_0x239d7d[_0x09d8('0xb1')]][_0x09d8('0xe0')]+=0x1;_0x586816[_0x09d8('0x1d')][_0x239d7d[_0x09d8('0xb1')]][_0x09d8('0x5d')]+=0x1;var _0x3f2d60=_0x586816['campaigns'][_0x239d7d[_0x09d8('0xb1')]];var _0x4be43a=new Hangup(_0x239d7d,_0x27ccd0);_0x4be43a[_0x09d8('0xe1')]=0x13;_0x4be43a[_0x09d8('0xa8')]='Machine';_0x4be43a[_0x09d8('0xe2')]=_0x09d8('0xe3');_0x4be43a[_0x09d8('0xed')]+=0x1;_0x4be43a[_0x09d8('0xe9')]+=0x1;_0x4be43a[_0x09d8('0xfd')]=!![];_0x586816['createHistory'](_0x4be43a)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xfe')));if(_0x4be43a[_0x09d8('0xea')]+_0x4be43a[_0x09d8('0xeb')]+_0x4be43a[_0x09d8('0xff')]+_0x4be43a[_0x09d8('0x100')]+_0x4be43a[_0x09d8('0xec')]+_0x4be43a['countabandonedretry']+_0x4be43a[_0x09d8('0xed')]+_0x4be43a[_0x09d8('0xee')]>=_0x3f2d60['dialGlobalMaxRetry']){_0x586816[_0x09d8('0x101')](_0x4be43a,_0x5a9027,_0x11223d,_0x09d8('0xf0'));}else{if(_0x4be43a['countmachineretry']>=_0x3f2d60['dialMachineMaxRetry']){_0x586816['createStateFinal'](_0x4be43a,_0x5a9027,_0x11223d,_0x09d8('0xf2'));}else{_0x586816[_0x09d8('0xbc')]({'active':![],'countmachineretry':_0x4be43a['countmachineretry'],'scheduledat':moment()[_0x09d8('0xf3')](_0x3f2d60[_0x09d8('0xf4')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x4be43a['ContactId'],'ListId':_0x4be43a[_0x09d8('0xcb')],'VoiceQueueId':_0x4be43a[_0x09d8('0xf8')]||undefined,'CampaignId':_0x4be43a[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xf9')));_0x5a9027({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x09d8('0x102')]=function(_0xf4b0ab){var _0x3d0ee0=this[_0x09d8('0x23')][_0xf4b0ab[_0x09d8('0xdf')]];var _0x1857ac=this;var _0x3fdf1b;if(_0x3d0ee0&&_0x3d0ee0['type']===_0x09d8('0x7c')){delete this['uniqueId'][_0xf4b0ab['uniqueid']];this['updateOriginated'](this[_0x09d8('0x1d')][_0x3d0ee0[_0x09d8('0xb1')]]);this[_0x09d8('0x1d')][_0x3d0ee0[_0x09d8('0xb1')]][_0x09d8('0x103')]+=0x1;_0x3fdf1b=new Hangup(_0x3d0ee0,_0xf4b0ab);this['createHistory'](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x104')));this[_0x09d8('0xd7')](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x105')));}if(_0x3d0ee0&&_0x3d0ee0[_0x09d8('0x4c')]!==_0x09d8('0x7c')&&isNotNull(this[_0x09d8('0x1c')][_0x3d0ee0['queue']]['dialQueueProject'])){delete this[_0x09d8('0x23')][_0xf4b0ab[_0x09d8('0xdf')]];this['updateOriginated'](this['voiceQueues'][_0x3d0ee0['queue']]);this[_0x09d8('0x1c')][_0x3d0ee0['queue']][_0x09d8('0xe0')]+=0x1;this[_0x09d8('0x1c')][_0x3d0ee0[_0x09d8('0xb1')]][_0x09d8('0x5d')]+=0x1;_0x3fdf1b=new Hangup(_0x3d0ee0,_0xf4b0ab);_0x3fdf1b['state']=0x10;_0x3fdf1b[_0x09d8('0xa8')]='AnswerAGI';_0x3fdf1b[_0x09d8('0xe2')]=_0x09d8('0x106');this['createHistory'](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x104')));this[_0x09d8('0xd7')](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x105')));}if(_0x3d0ee0&&_0x3d0ee0[_0x09d8('0x4c')]!==_0x09d8('0x7c')&&!isNotNull(this[_0x09d8('0x1c')][_0x3d0ee0[_0x09d8('0xb1')]][_0x09d8('0x107')])){delete this[_0x09d8('0x23')][_0xf4b0ab[_0x09d8('0xdf')]];this['updateOriginated'](this[_0x09d8('0x1c')][_0x3d0ee0[_0x09d8('0xb1')]]);this[_0x09d8('0x1c')][_0x3d0ee0[_0x09d8('0xb1')]][_0x09d8('0x65')]+=0x1;_0x3fdf1b=new Hangup(_0x3d0ee0,_0xf4b0ab);_0x3fdf1b[_0x09d8('0xe1')]=0xc;_0x3fdf1b[_0x09d8('0xa8')]=_0xf4b0ab['cause-txt'];_0x3fdf1b[_0x09d8('0xe2')]=_0x09d8('0x108');this[_0x09d8('0xc4')](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x104')));this['moveContactManagedDialer'](_0x3fdf1b)[_0x09d8('0xaf')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x09d8('0x16')]['syncAgentComplete']=function(_0xa5a2f9){var _0x1ee52c=this[_0x09d8('0x23')][_0xa5a2f9['uniqueid']];var _0x1fcfce=this;if(this[_0x09d8('0x1c')][_0xa5a2f9['queue']]){if(_0x1ee52c&&_0x1ee52c[_0x09d8('0x4c')]!==_0x09d8('0x7c')){delete this[_0x09d8('0x23')][_0xa5a2f9[_0x09d8('0xdf')]];this[_0x09d8('0x1c')][_0xa5a2f9[_0x09d8('0xb1')]][_0x09d8('0xe0')]+=0x1;var _0x303e48=new AgentComplete(_0x1ee52c,_0xa5a2f9);if(_0xa5a2f9['reason']===_0x09d8('0x109')){_0x303e48['agiafterat']=this[_0x09d8('0x1c')][_0xa5a2f9['queue']][_0x09d8('0x10a')]&&this[_0x09d8('0x1c')][_0xa5a2f9[_0x09d8('0xb1')]][_0x09d8('0x10b')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x09d8('0xc4')](_0x303e48)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x10c')));this[_0x09d8('0xd7')](_0x303e48)[_0x09d8('0xaf')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x09d8('0x16')][_0x09d8('0x28')]=function(_0x8505fc){if(this[_0x09d8('0x1c')][_0x8505fc[_0x09d8('0xb1')]]){if(this['uniqueId'][_0x8505fc[_0x09d8('0xdf')]]&&this[_0x09d8('0x23')][_0x8505fc[_0x09d8('0xdf')]][_0x09d8('0x4c')]!==_0x09d8('0x7c')){this['updateOriginated'](this[_0x09d8('0x1c')][_0x8505fc['queue']]);this[_0x09d8('0x23')][_0x8505fc[_0x09d8('0xdf')]]['answertime']=moment()[_0x09d8('0x95')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x09d8('0x16')][_0x09d8('0x10d')]=function(_0x5177ea){this['createHistory'](_0x5177ea)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x10c')));this[_0x09d8('0xd7')](_0x5177ea)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x10e')));};Dialer[_0x09d8('0x16')][_0x09d8('0x2b')]=function(_0x1b495f){var _0x4a9866=this['uniqueId'][_0x1b495f[_0x09d8('0xdf')]];var _0x28c16a=this;if(this[_0x09d8('0x1c')][_0x1b495f[_0x09d8('0xb1')]]){if(_0x4a9866&&_0x4a9866[_0x09d8('0x4c')]!==_0x09d8('0x7c')){delete this[_0x09d8('0x23')][_0x1b495f[_0x09d8('0xdf')]];this['updateOriginated'](this[_0x09d8('0x1c')][_0x1b495f['queue']]);_0x4a9866[_0x09d8('0x10f')]=moment()[_0x09d8('0x95')](_0x09d8('0xf6'));var _0x5688f8=new QueueCallerAbandon(_0x4a9866,_0x1b495f);if(getSeconds(_0x4a9866[_0x09d8('0x10f')],_0x4a9866[_0x09d8('0x110')])>=_0x4a9866[_0x09d8('0x111')]){this[_0x09d8('0x1c')][_0x1b495f[_0x09d8('0xb1')]][_0x09d8('0x6a')]+=0x1;this[_0x09d8('0x1c')][_0x1b495f[_0x09d8('0xb1')]][_0x09d8('0x61')]+=0x1;this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x112')]+=0x1;_0x5688f8[_0x09d8('0xe1')]=0xa;_0x5688f8['statedesc']=_0x09d8('0x113');_0x5688f8[_0x09d8('0x114')]=_0x09d8('0x115');_0x5688f8[_0x09d8('0x116')]=this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x10a')]?moment()['format'](_0x09d8('0xf6')):undefined;_0x5688f8[_0x09d8('0xec')]+=0x1;_0x5688f8['countglobal']+=0x1;if(_0x5688f8[_0x09d8('0xec')]>=this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x117')]){this['queueCallerAbandonCreateState'](_0x5688f8);}else{this[_0x09d8('0xbc')]({'active':![],'countdropretry':_0x5688f8[_0x09d8('0xec')],'scheduledat':moment()[_0x09d8('0xf3')](this[_0x09d8('0x1c')][_0x1b495f[_0x09d8('0xb1')]]['dialDropRetryFrequency'],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a9866['ContactId'],'ListId':_0x4a9866[_0x09d8('0xcb')],'VoiceQueueId':_0x4a9866[_0x09d8('0xf8')]||undefined,'CampaignId':_0x4a9866[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch('[rescheduleContact][Drop]'));var _0x1d769a=new History(_0x5688f8);_0x1d769a['state']=0xa;_0x1d769a[_0x09d8('0xa8')]=_0x09d8('0x113');_0x1d769a[_0x09d8('0xaa')]=moment()['format'](_0x09d8('0xf6'));_0x1d769a[_0x09d8('0xa9')]=_0x1d769a[_0x09d8('0xaa')];_0x1d769a[_0x09d8('0x118')]=_0x5688f8[_0x09d8('0x118')];_0x1d769a[_0x09d8('0x119')]=_0x5688f8[_0x09d8('0x119')];this[_0x09d8('0xc4')](_0x1d769a)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x11a')));}}else{this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x69')]+=0x1;this[_0x09d8('0x1c')][_0x1b495f[_0x09d8('0xb1')]][_0x09d8('0x60')]+=0x1;_0x5688f8['state']=0xb;_0x5688f8['statedesc']='Abandoned';_0x5688f8[_0x09d8('0x114')]='CALLEREXIT';_0x5688f8[_0x09d8('0x11b')]+=0x1;_0x5688f8[_0x09d8('0xe9')]+=0x1;if(_0x5688f8[_0x09d8('0x11b')]>=this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x11c')]){this[_0x09d8('0x10d')](_0x5688f8);}else{this[_0x09d8('0xbc')]({'active':![],'countabandonedretry':_0x5688f8['countabandonedretry'],'scheduledat':moment()[_0x09d8('0xf3')](this[_0x09d8('0x1c')][_0x1b495f['queue']][_0x09d8('0x11d')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x4a9866['ContactId'],'ListId':_0x4a9866[_0x09d8('0xcb')],'VoiceQueueId':_0x4a9866['VoiceQueueId']||undefined,'CampaignId':_0x4a9866[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x11e')));var _0x1d769a=new History(_0x5688f8);_0x1d769a[_0x09d8('0xe1')]=0xb;_0x1d769a[_0x09d8('0xa8')]='Abandoned';_0x1d769a[_0x09d8('0xaa')]=moment()[_0x09d8('0x95')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d769a[_0x09d8('0xa9')]=_0x1d769a[_0x09d8('0xaa')];_0x1d769a[_0x09d8('0x118')]=_0x5688f8[_0x09d8('0x118')];_0x1d769a[_0x09d8('0x119')]=_0x5688f8['calleridnum'];this[_0x09d8('0xc4')](_0x1d769a)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x11f')));}}}}};Dialer[_0x09d8('0x16')][_0x09d8('0x33')]=function(_0x443db8){if(this['actions'][_0x443db8[_0x09d8('0xdf')]]){this[_0x09d8('0x21')][_0x443db8[_0x09d8('0xdf')]][_0x09d8('0xae')]=_0x443db8['channel'];}if(this[_0x09d8('0x23')][_0x443db8[_0x09d8('0xdf')]]){this[_0x09d8('0x23')][_0x443db8['uniqueid']][_0x09d8('0xae')]=_0x443db8['channel'];}};Dialer[_0x09d8('0x16')][_0x09d8('0x37')]=function(_0x558f5a){if(strategy[this['voiceQueues'][this[_0x09d8('0x21')][_0x558f5a[_0x09d8('0x120')]][_0x09d8('0xb1')]][_0x09d8('0x4e')]]==='roundrobin'){if(this['actions'][_0x558f5a[_0x09d8('0x120')]]&&_['isNil'](this['actions'][_0x558f5a[_0x09d8('0x120')]]['locked'])&&_0x558f5a['status']==='1'&&_0x558f5a[_0x09d8('0x121')]==='0'){if(this[_0x09d8('0x1e')][_0x558f5a[_0x09d8('0x122')]]){if(!this[_0x09d8('0x1e')][_0x558f5a[_0x09d8('0x122')]][_0x09d8('0x123')]){this['agents'][_0x558f5a[_0x09d8('0x122')]][_0x09d8('0x123')]=!![];this[_0x09d8('0x21')][_0x558f5a[_0x09d8('0x120')]][_0x09d8('0x123')]=!![];this['actions'][_0x558f5a[_0x09d8('0x120')]][_0x09d8('0x122')]=_0x558f5a['stateinterface'];}}}}else if((strategy[this[_0x09d8('0x1c')][this['actions'][_0x558f5a[_0x09d8('0x120')]]['queue']][_0x09d8('0x4e')]]||_0x09d8('0x14'))===_0x09d8('0x14')){if(this[_0x09d8('0x21')][_0x558f5a[_0x09d8('0x120')]]){if(this[_0x09d8('0x1e')][_0x558f5a[_0x09d8('0x122')]]){this[_0x09d8('0x21')][_0x558f5a[_0x09d8('0x120')]][_0x09d8('0x122')]=_0x558f5a['stateinterface'];if(_[_0x09d8('0xd8')](this[_0x09d8('0x25')][this[_0x09d8('0x21')][_0x558f5a[_0x09d8('0x120')]][_0x09d8('0xb1')]])){this[_0x09d8('0x25')][this[_0x09d8('0x21')][_0x558f5a['actionid']]['queue']]=[];}this[_0x09d8('0x25')][this['actions'][_0x558f5a['actionid']][_0x09d8('0xb1')]][_0x09d8('0x124')](_['merge'](_[_0x09d8('0x125')](this[_0x09d8('0x21')][_0x558f5a['actionid']],[_0x09d8('0x126'),_0x09d8('0x122')]),{'status':_0x558f5a['status'],'paused':_0x558f5a['paused']}));}}}};function unlockQueueStatus(_0x2240b2,_0x4340e5){setTimeout(function(){if(_[_0x09d8('0x3a')](_0x2240b2[_0x09d8('0x127')])){loggerBooked[_0x09d8('0x98')](_0x09d8('0x128'),_0x4340e5);}_0x2240b2[_0x09d8('0x127')]=!![];loggerBooked[_0x09d8('0x7f')](_0x09d8('0x129'),_0x4340e5,JSON[_0x09d8('0x79')](_[_0x09d8('0x125')](_0x2240b2,['name',_0x09d8('0x127')])));},0x1f3);}Dialer[_0x09d8('0x16')]['syncQueueStatusComplete']=function(_0x339856){var _0x1d752f=this;var _0x2ca1b2=_0x1d752f[_0x09d8('0x1c')][_0x1d752f[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]];if(strategy[this[_0x09d8('0x1c')][this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]]['queue']][_0x09d8('0x4e')]]==='roundrobin'){if(this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]]&&this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0x122')]){this[_0x09d8('0x1b')]['run'](this['actions'][_0x339856['actionid']][_0x09d8('0x126')],this['actions'][_0x339856[_0x09d8('0x120')]]['stateinterface'])[_0x09d8('0xaf')](function(_0x1d2523){logger[_0x09d8('0x98')](_0x09d8('0x12a'),util[_0x09d8('0x9a')](_0x1d2523,{'showHidden':![],'depth':null}));})[_0x09d8('0x19')](function(){_0x1d752f[_0x09d8('0xb0')](_0x1d752f[_0x09d8('0x1c')][_0x1d752f[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]]);_0x1d752f[_0x09d8('0x1e')][_0x1d752f[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0x122')]][_0x09d8('0x123')]=![];delete _0x1d752f['actions'][_0x339856['actionid']];unlockQueueStatus(_0x2ca1b2);});}else{this[_0x09d8('0xb0')](this[_0x09d8('0x1c')][this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xf7')],'ListId':this['actions'][_0x339856[_0x09d8('0x120')]]['ListId'],'VoiceQueueId':this[_0x09d8('0x21')][_0x339856['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x12b')));delete this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]];unlockQueueStatus(_0x2ca1b2);}}else if((strategy[this[_0x09d8('0x1c')][this['actions'][_0x339856['actionid']]['queue']][_0x09d8('0x4e')]]||_0x09d8('0x14'))===_0x09d8('0x14')){var _0x24b144;if(this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]]&&!_[_0x09d8('0x45')](this[_0x09d8('0x25')][this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]])){if(this['queueBookedRR'][_0x1d752f[_0x09d8('0x21')][_0x339856['actionid']][_0x09d8('0xb1')]]){this['queueBookedRR'][_0x1d752f[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]]['queue']]=this[_0x09d8('0x26')][this[_0x09d8('0x21')][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]]?this['queueBookedRR'][this[_0x09d8('0x21')][_0x339856['actionid']][_0x09d8('0xb1')]]:this[_0x09d8('0x25')][this[_0x09d8('0x21')][_0x339856['actionid']][_0x09d8('0xb1')]]?this[_0x09d8('0x25')][this['actions'][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]][_0x09d8('0x12c')]||0x0:0x0;}this[_0x09d8('0x25')][this['actions'][_0x339856[_0x09d8('0x120')]][_0x09d8('0xb1')]][_0x09d8('0x12c')]=this[_0x09d8('0x26')][this[_0x09d8('0x21')][_0x339856['actionid']][_0x09d8('0xb1')]];for(var _0x2cfe79=0x0;_0x2cfe79=0x0?!![]:![];})[_0x09d8('0xaf')](myreject(_0x4130b1)));}}else{_0x220bf1[_0x09d8('0x124')](ami[_0x09d8('0xad')]({'action':_0x09d8('0x147'),'command':util[_0x09d8('0x95')](_0x09d8('0x148'),_0x13fd6b,!_[_0x09d8('0x3a')](config[_0x09d8('0x149')][_0x12fc54])?_0x12fc54:'')})[_0x09d8('0xb4')](function(_0x166f55){return _0x166f55[_0x09d8('0x14a')]['indexOf'](_0x09d8('0x14c'))>=0x0?!![]:![];})[_0x09d8('0xaf')](myreject(_0x4130b1)));}BPromise['all'](_0x220bf1)['then'](function(_0x10be83){var _0x5cf510=_['some'](_0x10be83);if(_0x5cf510){return _0x170490(_0x5cf510);}else{_0x2583d2[_0x09d8('0x3b')]=_0x107f87?_0x09d8('0x14d'):_0x09d8('0x14e');return _0x4130b1(msgResponse(_0x09d8('0x14f'),_0x09d8('0x140'),'Global:\x20'+_0x107f87+'\x20'+_0x342708+_0x09d8('0x150')+util[_0x09d8('0x9a')](_0x13fd6b,{'showHidden':![],'depth':null})+_0x09d8('0x151')+_0x12fc54));}})[_0x09d8('0xaf')](function(_0x5824cf){return _0x4130b1(msgResponse(_0x09d8('0x13f'),'Failure',JSON[_0x09d8('0x79')](_0x5824cf)));});});};Dialer['prototype']['checkDialMethod']=function(_0x31047f){var _0x16a414=this;return function(){switch(_0x31047f[_0x09d8('0x58')]){case'progressive':freeVariablesPredictive(_0x31047f);_0x16a414[_0x09d8('0x152')](_0x31047f,0x1);break;case'power':freeVariablesPredictive(_0x31047f);_0x16a414[_0x09d8('0x152')](_0x31047f,_0x31047f[_0x09d8('0x153')]);break;case _0x09d8('0x6'):_0x16a414['predictive'](_0x31047f);break;case _0x09d8('0x154'):freeVariablesPredictive(_0x31047f);_0x16a414[_0x09d8('0x152')](_0x31047f,0x1);break;default:freeVariablesPredictive(_0x31047f);logger[_0x09d8('0x98')](_0x09d8('0x155'),_0x31047f[_0x09d8('0x3f')],_0x09d8('0x156'));}};};Dialer[_0x09d8('0x16')][_0x09d8('0x157')]=function(_0x112d39){var _0x3a2259=this;return function(){_0x3a2259['handleIvr'](_0x112d39);};};Dialer[_0x09d8('0x16')][_0x09d8('0x30')]=function(_0x25be65){var _0x133ca7=this;if(isNotPreview(_0x25be65[_0x09d8('0x58')])){if(isVoiceQueueOutbound(_0x25be65[_0x09d8('0x4c')])&&isActive(_0x25be65[_0x09d8('0x57')])){_0x25be65[_0x09d8('0xa2')]=!![];BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](checkIsLoggedIn(_0x25be65,_0x25be65[_0x09d8('0x158')]))[_0x09d8('0xb4')](checkIsActive(_0x25be65,_0x25be65[_0x09d8('0x57')]))[_0x09d8('0xb4')](checkInterval(_0x25be65))[_0x09d8('0xb4')](_0x133ca7[_0x09d8('0x138')](_0x25be65))[_0x09d8('0xb4')](_0x133ca7[_0x09d8('0x13d')](_0x25be65[_0x09d8('0x159')],_0x25be65[_0x09d8('0x15a')],_0x25be65[_0x09d8('0x3f')],_0x25be65))[_0x09d8('0xb4')](_0x133ca7[_0x09d8('0x13e')](_0x25be65[_0x09d8('0x41')],_0x25be65[_0x09d8('0x15a')],_0x25be65[_0x09d8('0x3f')],_0x25be65))['then'](_0x133ca7[_0x09d8('0x15b')](_0x25be65))[_0x09d8('0xaf')](loggerCatchQueueSummary(_0x09d8('0x15c'),_0x25be65));}else{notSendMessagesQueue(_0x25be65);}}else{freeVariablesPredictive(_0x25be65);}};Dialer[_0x09d8('0x16')]['syncCampaigns']=function(){var _0x51a314=this;var _0x4876bc;for(var _0x1fefec in this['campaigns']){if(this['campaigns'][_0x09d8('0x9b')](_0x1fefec)){_0x4876bc=this[_0x09d8('0x1d')][_0x1fefec];if(isCampaignIvr(_0x4876bc[_0x09d8('0x4c')])&&isActive(_0x4876bc[_0x09d8('0x77')])){_0x4876bc['sendMessageOneNotActive']=!![];BPromise[_0x09d8('0xb7')]()[_0x09d8('0xb4')](checkIsActive(_0x4876bc,_0x4876bc[_0x09d8('0x77')]))[_0x09d8('0xb4')](checkInterval(_0x4876bc))['then'](_0x51a314[_0x09d8('0x138')](_0x4876bc))['then'](_0x51a314[_0x09d8('0x13d')](_0x4876bc[_0x09d8('0x159')],_0x4876bc['dialTimezone'],_0x4876bc[_0x09d8('0x3f')],_0x4876bc))[_0x09d8('0xb4')](_0x51a314['checkIfTimeIntervals'](_0x4876bc[_0x09d8('0x41')],_0x4876bc[_0x09d8('0x15a')],_0x4876bc[_0x09d8('0x3f')],_0x4876bc))[_0x09d8('0xb4')](_0x51a314['launchHandleIvr'](_0x4876bc))[_0x09d8('0xaf')](loggerCatchQueueSummary(_0x09d8('0x15d'),_0x4876bc));}else{notSendMessagesCampaign(_0x4876bc);}}}};function getCallerIdRandom(_0x213654,_0x3f07b8){var _0x163991,_0x3f2caf,_0x37519a;if(_0x3f07b8<=0x0){_0x3f07b8=0x1;}_0x163991=new RegExp(_0x09d8('0x15e')+_0x3f07b8+'}$');_0x3f2caf=Math[_0x09d8('0x15f')](0xa,_0x3f07b8-0x1);_0x37519a=Math[_0x09d8('0x15f')](0xa,_0x3f07b8)-0x1;return util[_0x09d8('0x95')]('%s',_[_0x09d8('0x160')](_0x213654,_0x163991,_[_0x09d8('0x161')](_0x3f2caf,_0x37519a)));}function extractCalleridName(_0x2d90e3){var _0x26b2ef=_0x2d90e3[_0x09d8('0x162')](/"(.*?)"/);return _0x26b2ef?_0x26b2ef[0x1]:_0x2d90e3;}function extractCalleridNumber(_0x77a271){var _0x39a075=_0x77a271[_0x09d8('0x162')](/<(.*?)>/);return _0x39a075?_0x39a075[0x1]:_0x77a271;}Dialer[_0x09d8('0x16')][_0x09d8('0x163')]=function(_0x3ea8cf,_0x3dafc3){var _0x2c1aaf=this;var _0x4b0960=uuid['v4']();this[_0x09d8('0x21')][_0x4b0960]=new Action(_0x3ea8cf,_0x3dafc3,_0x4b0960);return new BPromise(function(_0xb50f3,_0x22169b){if(_[_0x09d8('0x3a')](_0x3ea8cf)&&'object'!==typeof _0x3ea8cf){return _0x22169b(msgResponse(_0x09d8('0x164'),_0x09d8('0x140'),_0x09d8('0x165')));}if(_[_0x09d8('0x3a')](_0x3dafc3['Contact'][_0x09d8('0x166')])||_0x3dafc3[_0x09d8('0x167')]['phone']===null){return _0x22169b(msgResponse(_0x09d8('0x164'),_0x09d8('0x140'),_0x09d8('0x168')));}var _0x1940c6={'XMD-CALLERID':_0x2c1aaf[_0x09d8('0x21')][_0x4b0960][_0x09d8('0x169')](),'XMD-AGI':_0x3ea8cf['dialQueueProject']?util[_0x09d8('0x95')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3ea8cf[_0x09d8('0x107')]):_0x09d8('0x16a'),'XMD-AGIAFTER':_0x3ea8cf['dialQueueProject2']?util[_0x09d8('0x95')](_0x09d8('0x16b'),ipAgi,_0x3ea8cf[_0x09d8('0x10a')]):'NONE','XMD-QUEUE':_0x3ea8cf[_0x09d8('0x4c')]==='outbound'?util[_0x09d8('0x95')](_0x09d8('0x16c'),_0x3ea8cf[_0x09d8('0x3f')],_0x3ea8cf[_0x09d8('0x16d')]||'',_0x3ea8cf[_0x09d8('0x10b')]?'c':'',_0x3ea8cf[_0x09d8('0x111')]||0x3):_0x09d8('0x16a'),'XMD-CONTACTID':_0x3dafc3[_0x09d8('0xf7')],'XMD-CDRTYPE':_0x09d8('0x16e'),'CALLERID(all)':_0x2c1aaf[_0x09d8('0x21')][_0x4b0960][_0x09d8('0x169')](),'XMD-AMD':_0x3ea8cf[_0x09d8('0xe6')]?_0x09d8('0x16f'):_0x09d8('0x16a'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3ea8cf[_0x09d8('0xe6')]){_0x1940c6[_0x09d8('0x170')]=_0x3ea8cf[_0x09d8('0x171')]||0x9c4;_0x1940c6[_0x09d8('0x172')]=_0x3ea8cf[_0x09d8('0x173')]||0x5dc;_0x1940c6[_0x09d8('0x174')]=_0x3ea8cf[_0x09d8('0x175')]||0x320;_0x1940c6[_0x09d8('0x176')]=_0x3ea8cf[_0x09d8('0x177')]||0x1388;_0x1940c6[_0x09d8('0x178')]=_0x3ea8cf['dialAMDMinWordLength']||0x64;_0x1940c6[_0x09d8('0x179')]=_0x3ea8cf['dialAMDBetweenWordsSilence']||0x32;_0x1940c6['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3ea8cf[_0x09d8('0x17a')]||0x3;_0x1940c6['XMD-AMDSILENCETHRESHOLD']=_0x3ea8cf[_0x09d8('0x17b')]||0x100;_0x1940c6[_0x09d8('0x17c')]=_0x3ea8cf[_0x09d8('0x17d')]||0x1388;}if(_0x3ea8cf['type']===_0x09d8('0x4d')){_0x1940c6[_0x09d8('0x17e')]=_0x3dafc3['VoiceQueueId'];}else{_0x1940c6[_0x09d8('0x17f')]=_0x3dafc3[_0x09d8('0xcd')];}for(var _0x49489a in _0x3dafc3[_0x09d8('0x167')]){if(_0x3dafc3[_0x09d8('0x167')][_0x09d8('0x9b')](_0x49489a)){if(isNotNull(_0x3dafc3[_0x09d8('0x167')][_0x49489a])&&_0x49489a!=='id'&&_0x49489a!==_0x09d8('0x180')&&_0x49489a!==_0x09d8('0x181')&&_0x49489a!=='updatedAt'){_0x1940c6[util[_0x09d8('0x95')](_0x09d8('0x182'),'XMD-',_[_0x09d8('0x183')](_0x49489a))]=_0x3dafc3[_0x09d8('0x167')][_0x49489a];}}}var _0x5269ee=_0x2c1aaf[_0x09d8('0x139')](_0x3ea8cf[_0x09d8('0x76')])?getCallerId(_0x3ea8cf[_0x09d8('0x76')]['callerid'],_0x3ea8cf[_0x09d8('0x59')],_0x3ea8cf[_0x09d8('0x184')]>0x0?getCallerIdRandom(_0x3ea8cf['dialOriginateCallerIdNumber'],_0x3ea8cf[_0x09d8('0x184')]):_0x3ea8cf[_0x09d8('0x5a')]):getCallerId(_[_0x09d8('0xd8')](_0x3ea8cf[_0x09d8('0x13a')])?_0x3ea8cf[_0x09d8('0x76')][_0x09d8('0x78')]:_0x3ea8cf[_0x09d8('0x13a')][_0x09d8('0x78')],_0x3ea8cf[_0x09d8('0x59')],_0x3ea8cf[_0x09d8('0x184')]>0x0?getCallerIdRandom(_0x3ea8cf[_0x09d8('0x5a')],_0x3ea8cf[_0x09d8('0x184')]):_0x3ea8cf[_0x09d8('0x5a')]);if(_0x5269ee){_0x1940c6[_0x09d8('0x185')]=_0x2c1aaf[_0x09d8('0x21')][_0x4b0960][_0x09d8('0x186')]=extractCalleridName(_0x5269ee);_0x1940c6[_0x09d8('0x187')]=_0x2c1aaf['actions'][_0x4b0960]['originatecalleridnum']=extractCalleridNumber(_0x5269ee);}return ami[_0x09d8('0xad')]({'actionid':_0x4b0960,'action':'originate','channel':_0x2c1aaf[_0x09d8('0x139')](_0x3ea8cf[_0x09d8('0x76')])?util[_0x09d8('0x95')](_0x09d8('0x188'),_0x3ea8cf[_0x09d8('0x76')][_0x09d8('0x3f')],isNotNull(_0x3ea8cf[_0x09d8('0x5c')])?_0x3ea8cf[_0x09d8('0x5c')]['trim']()||'':'',_0x3ea8cf['dialCutDigit']>0x0?_0x3dafc3['Contact'][_0x09d8('0x166')][_0x09d8('0x189')](_0x3ea8cf[_0x09d8('0x18a')]):_0x3dafc3[_0x09d8('0x167')][_0x09d8('0x166')]):util['format'](_0x09d8('0x188'),_[_0x09d8('0xd8')](_0x3ea8cf[_0x09d8('0x13a')])?_0x3ea8cf['Trunk'][_0x09d8('0x3f')]:_0x3ea8cf[_0x09d8('0x13a')]['name'],isNotNull(_0x3ea8cf[_0x09d8('0x5c')])?_0x3ea8cf[_0x09d8('0x5c')][_0x09d8('0x18b')]()||'':'',_0x3ea8cf[_0x09d8('0x18a')]>0x0?_0x3dafc3['Contact']['phone'][_0x09d8('0x189')](_0x3ea8cf[_0x09d8('0x18a')]):_0x3dafc3[_0x09d8('0x167')][_0x09d8('0x166')]),'callerid':_0x5269ee,'Exten':'xcally-motion-dialer','Context':_0x09d8('0x18c'),'Priority':'1','variable':_0x1940c6,'timeout':(_0x3ea8cf[_0x09d8('0x5b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4b0960})[_0x09d8('0xb4')](function(_0x21dc17){return _0xb50f3(_0x21dc17);})['catch'](function(_0x533f6e){_0x3ea8cf['outboundOriginateFailureCallsDay']+=0x1;var _0x549ff5=new History(_0x2c1aaf['actions'][_0x4b0960]);logger['error'](util['format'](_0x09d8('0x18d'),JSON[_0x09d8('0x79')](_0x533f6e)));_0x549ff5[_0x09d8('0xe1')]=0xe;_0x549ff5[_0x09d8('0xa8')]='OriginateError';_0x549ff5[_0x09d8('0xaa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x549ff5['endtime']=_0x549ff5[_0x09d8('0xaa')];_0x2c1aaf['createHistory'](_0x549ff5)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x18e')));_0x2c1aaf[_0x09d8('0xd7')](_0x549ff5)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x18e')))[_0x09d8('0x19')](function(){delete _0x2c1aaf[_0x09d8('0x21')][_0x4b0960];return _0x22169b(msgResponse('originate',_0x09d8('0x47'),_0x09d8('0x18f')));});});});};Dialer[_0x09d8('0x16')][_0x09d8('0x190')]=function(_0x320772){var _0x46b9ab=this['actions'][_0x320772[_0x09d8('0x120')]];var _0xa7c003=this;if(_0x46b9ab){delete this[_0x09d8('0x21')][_0x320772[_0x09d8('0x120')]];_0x46b9ab[_0x09d8('0x110')]=moment()[_0x09d8('0x95')](_0x09d8('0xf6'));var _0x548394=_0x46b9ab[_0x09d8('0x4c')]===_0x09d8('0x7c')?this[_0x09d8('0x1d')][_0x46b9ab[_0x09d8('0xb1')]]:this['voiceQueues'][_0x46b9ab[_0x09d8('0x191')]()];if(!this[_0x09d8('0xd0')](_0x320772[_0x09d8('0x192')])){this[_0x09d8('0xb0')](_0x548394);return this[_0x09d8('0x193')](_0x46b9ab,_0x548394,_0x320772)[_0x09d8('0xb4')](function(_0x164d6f){})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x194')));}else{this['uniqueId'][_0x320772[_0x09d8('0xdf')]]=_0x46b9ab;}}};Dialer[_0x09d8('0x16')][_0x09d8('0x195')]=function(_0x4bc51b,_0x14413a,_0x3cf450){var _0x3f62d5=new History(_0x14413a);if(_0x3f62d5[_0x09d8('0xea')]+_0x3f62d5['countcongestionretry']+_0x3f62d5[_0x09d8('0xff')]+_0x3f62d5[_0x09d8('0x100')]+_0x3f62d5['countdropretry']+_0x3f62d5[_0x09d8('0x11b')]+_0x3f62d5[_0x09d8('0xed')]+_0x3f62d5['countagentrejectretry']>=_0x3cf450[_0x09d8('0xef')]-0x1){return!![];}switch(_0x4bc51b){case 0x3:if(_0x3f62d5[_0x09d8('0xff')]>=_0x3cf450['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countnoanswerretry':_0x3f62d5[_0x09d8('0xff')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x196')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5['VoiceQueueId']||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x3f62d5[_0x09d8('0xea')]>=_0x3cf450[_0x09d8('0x197')]-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countbusyretry':_0x3f62d5[_0x09d8('0xea')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x198')],_0x09d8('0xf5'))[_0x09d8('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x199')));}break;case 0x8:if(_0x3f62d5[_0x09d8('0xeb')]>=_0x3cf450['dialCongestionMaxRetry']-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countcongestionretry':_0x3f62d5[_0x09d8('0xeb')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x19a')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x19b')));}break;case 0x0:if(_0x3f62d5[_0x09d8('0x100')]>=_0x3cf450[_0x09d8('0x19c')]-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countnosuchnumberretry':_0x3f62d5[_0x09d8('0x100')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450['dialNoSuchNumberRetryFrequency'],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x3f62d5['ContactId'],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5['CampaignId']||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x19d')));}break;case 0xa:if(_0x3f62d5['countdropretry']>=_0x3cf450[_0x09d8('0x117')]-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countdropretry':_0x3f62d5[_0x09d8('0xec')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x19e')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x3f62d5[_0x09d8('0x11b')]>=_0x3cf450[_0x09d8('0x11c')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x3f62d5['countabandonedretry']+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x11d')],_0x09d8('0xf5'))[_0x09d8('0x95')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5[_0x09d8('0xcb')],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x11e')));}break;case 0x13:if(_0x3f62d5[_0x09d8('0xed')]>=_0x3cf450[_0x09d8('0x19f')]-0x1){return!![];}else{this[_0x09d8('0xbc')]({'active':![],'countmachineretry':_0x3f62d5[_0x09d8('0xed')]+=0x1,'scheduledat':moment()['add'](_0x3cf450[_0x09d8('0xf4')],_0x09d8('0xf5'))[_0x09d8('0x95')](_0x09d8('0xf6')),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5['ListId'],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xf9')));}break;case 0x14:if(_0x3f62d5['countagentrejectretry']>=_0x3cf450[_0x09d8('0x1a0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3f62d5[_0x09d8('0xee')]+=0x1,'scheduledat':moment()[_0x09d8('0xf3')](_0x3cf450[_0x09d8('0x1a1')],_0x09d8('0xf5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f62d5[_0x09d8('0xf7')],'ListId':_0x3f62d5['ListId'],'VoiceQueueId':_0x3f62d5[_0x09d8('0xf8')]||undefined,'CampaignId':_0x3f62d5[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x1a2')));}break;default:return!![];}};Dialer['prototype'][_0x09d8('0x193')]=function(_0x4fe35f,_0x505f7a,_0x478287){var _0x5ab79e=this;var _0x2b2363=new History(_0x4fe35f);return new BPromise(function(_0x112125,_0x3dc960){if(_[_0x09d8('0x3a')](_0x505f7a)&&_0x09d8('0x1a3')!==typeof _0x505f7a){return _0x3dc960(msgResponse('[callProgressDetecting]',_0x09d8('0x140'),'entity\x20is\x20undefine'));}if(_[_0x09d8('0x3a')](_0x478287)&&_0x09d8('0x1a3')!==typeof _0x478287){return _0x3dc960(msgResponse(_0x09d8('0x1a4'),_0x09d8('0x140'),_0x09d8('0x1a5')));}switch(_0x478287[_0x09d8('0x1a6')]){case'0':_0x505f7a[_0x09d8('0x1a7')]+=0x1;_0x2b2363[_0x09d8('0xe1')]=0x0;_0x2b2363[_0x09d8('0xa8')]=_0x09d8('0x1a8');_0x2b2363[_0x09d8('0x100')]+=0x1;_0x2b2363[_0x09d8('0xe9')]+=0x1;ami['emit'](_0x09d8('0x1a9'),ut['buildObj'](_0x4fe35f,_0x09d8('0x1aa')));_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0xfe')));if(_0x5ab79e[_0x09d8('0x195')](0x0,_0x4fe35f,_0x505f7a)){if(_0x2b2363['countnosuchnumberretry']>=_0x505f7a[_0x09d8('0x19c')]){_0x5ab79e[_0x09d8('0xf1')](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1ab'));}else{_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x505f7a[_0x09d8('0x62')]+=0x1;_0x2b2363[_0x09d8('0xe1')]=0x3;_0x2b2363[_0x09d8('0xa8')]=_0x09d8('0x1ac');_0x2b2363[_0x09d8('0xff')]+=0x1;_0x2b2363[_0x09d8('0xe9')]+=0x1;ami['emit'](_0x09d8('0x1ad'),ut['buildObj'](_0x4fe35f,_0x09d8('0x1ae')));_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x1af')));if(_0x5ab79e[_0x09d8('0x195')](0x3,_0x4fe35f,_0x505f7a)){if(_0x2b2363['countnoanswerretry']>=_0x505f7a[_0x09d8('0x1b0')]){_0x5ab79e[_0x09d8('0xf1')](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1b1'));}else{_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1b1'));}}break;case'5':_0x505f7a[_0x09d8('0x5f')]+=0x1;_0x2b2363['state']=0x5;_0x2b2363['statedesc']='Busy';_0x2b2363[_0x09d8('0xea')]+=0x1;_0x2b2363['countglobal']+=0x1;ami[_0x09d8('0x4b')](_0x09d8('0x1b2'),ut[_0x09d8('0x1b3')](_0x4fe35f,_0x09d8('0x1b4')));_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5ab79e[_0x09d8('0x195')](0x5,_0x4fe35f,_0x505f7a)){if(_0x2b2363[_0x09d8('0xea')]>=_0x505f7a['dialBusyMaxRetry']){_0x5ab79e['createStateFinal'](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1b5'));}else{_0x5ab79e['stateGlobal'](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1b5'));}}break;case'8':_0x505f7a['outboundCongestionCallsDay']+=0x1;_0x2b2363[_0x09d8('0xe1')]=0x8;_0x2b2363[_0x09d8('0xa8')]=_0x09d8('0x1b6');_0x2b2363[_0x09d8('0xeb')]+=0x1;_0x2b2363[_0x09d8('0xe9')]+=0x1;ami[_0x09d8('0x4b')](_0x09d8('0x1b7'),ut[_0x09d8('0x1b3')](_0x4fe35f,_0x09d8('0x1b8')));_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5ab79e['checkRetriveMax'](0x8,_0x4fe35f,_0x505f7a)){if(_0x2b2363[_0x09d8('0xeb')]>=_0x505f7a[_0x09d8('0x1b9')]){_0x5ab79e[_0x09d8('0xf1')](_0x2b2363,_0x112125,_0x3dc960,'reason\x208\x20congestion');}else{_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1ba'));}}break;case'11':_0x505f7a[_0x09d8('0x1bb')]+=0x1;_0x2b2363['state']=0xb;_0x2b2363[_0x09d8('0xa8')]=_0x09d8('0x1bc');_0x2b2363['countabandonedretry']+=0x1;_0x2b2363[_0x09d8('0xe9')]+=0x1;_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x11f')));if(_0x5ab79e[_0x09d8('0x195')](0xb,_0x4fe35f,_0x505f7a)){if(_0x2b2363[_0x09d8('0x11b')]>=_0x505f7a['dialAbandonedMaxRetry']){_0x5ab79e[_0x09d8('0xf1')](_0x2b2363,_0x112125,_0x3dc960,'reason\x2011\x20abandoned');}else{_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,_0x09d8('0x1bd'));}}break;case'20':_0x505f7a[_0x09d8('0x1be')]+=0x1;_0x2b2363['state']=0x14;_0x2b2363['statedesc']='AgentReject';_0x2b2363[_0x09d8('0xee')]+=0x1;_0x2b2363['countglobal']+=0x1;ami[_0x09d8('0x4b')](_0x09d8('0x1bf'),ut['buildObj'](_0x4fe35f,_0x09d8('0x1c0')));_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x5ab79e[_0x09d8('0x195')](0x14,_0x4fe35f,_0x505f7a)){if(_0x2b2363['countagentrejectretry']>=_0x505f7a[_0x09d8('0x1a0')]){_0x5ab79e['createStateFinal'](_0x2b2363,_0x112125,_0x3dc960,'reason\x2020\x20agentreject');}else{_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,'reason\x2020\x20agentreject');}}break;default:_0x505f7a['outboundUnknownCallsDay']+=0x1;_0x2b2363[_0x09d8('0xe1')]=0xc;_0x2b2363[_0x09d8('0xa8')]=_0x478287[_0x09d8('0x1a6')];_0x5ab79e[_0x09d8('0xc4')](_0x2b2363)[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x1c1')));if(_0x5ab79e[_0x09d8('0x195')](_0x478287[_0x09d8('0x1a6')],_0x4fe35f,_0x505f7a)){if(_0x2b2363[_0x09d8('0xea')]+_0x2b2363[_0x09d8('0xeb')]+_0x2b2363[_0x09d8('0xff')]+_0x2b2363[_0x09d8('0x100')]+_0x2b2363[_0x09d8('0xec')]+_0x2b2363[_0x09d8('0x11b')]+_0x2b2363[_0x09d8('0xed')]+_0x2b2363[_0x09d8('0xee')]>=_0x505f7a[_0x09d8('0xef')]){_0x5ab79e[_0x09d8('0x101')](_0x2b2363,_0x112125,_0x3dc960,_0x478287[_0x09d8('0x1a6')]);}else{_0x5ab79e['createStateFinal'](_0x2b2363,_0x112125,_0x3dc960,_0x478287[_0x09d8('0x1a6')]);}}}});};Dialer[_0x09d8('0x16')][_0x09d8('0x101')]=function(_0x4c7f7e,_0xd1b08b,_0x440011,_0x4c5e42){var _0x5b211e=new Final(_0x4c7f7e);_0x5b211e[_0x09d8('0xe1')]=0xf;_0x5b211e['statedesc']=_0x09d8('0x1c2');this[_0x09d8('0xf1')](_0x5b211e,_0xd1b08b,_0x440011,_0x4c5e42);};Dialer[_0x09d8('0x16')][_0x09d8('0xf1')]=function(_0xcd75c2,_0x50cb65,_0x31ec68,_0x18d806){this[_0x09d8('0xd7')](_0xcd75c2)[_0x09d8('0xb4')](function(_0x24fa98){return _0x50cb65(msgResponse(_0x09d8('0x1a4'),_0x09d8('0xd1'),_0x18d806));})['catch'](function(_0x2473cd){return _0x31ec68(msgResponse(_0x09d8('0x1c3'),_0x09d8('0x140'),_0x09d8('0x1c4')));});};Dialer['prototype'][_0x09d8('0x6')]=function(_0x11c955){var _0x29aef3=this;var _0x7c6ae8=_0x11c955[_0x09d8('0x1c5')]/0x64;var _0x1324c4=_0x11c955[_0x09d8('0x61')]/(_0x11c955[_0x09d8('0x61')]+_0x11c955[_0x09d8('0xe0')]);var _0x28d33f=Math[_0x09d8('0x1c6')](_0x11c955[_0x09d8('0x6f')]*(_0x11c955['predictiveIntervalMaxThreshold']/0x64));var _0x2e4b92=Math[_0x09d8('0x1c6')](_0x11c955[_0x09d8('0x6f')]*(_0x11c955[_0x09d8('0x1c7')]/0x64));var _0x5d1feb=_0x11c955['available']+_0x11c955[_0x09d8('0x52')];var _0x2a160f=Math[_0x09d8('0x1c8')](_0x11c955[_0x09d8('0x72')]*_0x11c955['erlangAbandonmentRate']*_0x11c955[_0x09d8('0x6c')]*_0x11c955[_0x09d8('0x6d')]);if(_[_0x09d8('0x3a')](_0x11c955[_0x09d8('0x75')])){if(!_[_0x09d8('0x3a')](_0x11c955['startPredictive'])){_0x11c955[_0x09d8('0x91')]=undefined;loggerPredictive['error'](_0x09d8('0x1c9'),_0x09d8('0x1ca'));}if(!_[_0x09d8('0x3a')](_0x11c955[_0x09d8('0x93')])){loggerPredictive[_0x09d8('0x98')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x11c955['handlePredictive']);_0x11c955[_0x09d8('0x93')]=undefined;}_0x11c955[_0x09d8('0x75')]=moment()[_0x09d8('0x95')](_0x09d8('0xf6'));loggerPredictive[_0x09d8('0x7f')](_0x11c955[_0x09d8('0x3f')],_0x09d8('0x1cb'),_0x11c955[_0x09d8('0x75')]);this[_0x09d8('0x152')](_0x11c955,0x1);}else if(ifInterval(_0x11c955[_0x09d8('0x1cc')],_0x11c955[_0x09d8('0x75')])){this[_0x09d8('0x152')](_0x11c955,0x1);loggerPredictiveCalls['info']('[startMethodPredictive][StartProgressive][Loop]',_0x11c955[_0x09d8('0x75')],_0x11c955['name']);_0x11c955['erlangCalls']=0x0;_0x11c955['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x7c6ae8<_0x1324c4&&_0x11c955[_0x09d8('0x1cd')]==='dropRate'){freeVariablesPredictive(_0x11c955);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x1ce'),_0x09d8('0x1cf'),_0x1324c4,'startProgressive',_0x11c955['name']);}else if(_0x2a160f<_0x11c955['predictiveIntervalErlangCallsDroppedCalls']&&_0x11c955['dialPredictiveOptimization']===_0x09d8('0x1d0')){freeVariablesPredictive(_0x11c955);loggerPredictive['info'](_0x09d8('0x1d1'),_0x09d8('0x1d2'),_0x2a160f,_0x09d8('0x1d3'),_0x11c955['predictiveIntervalErlangCallsDroppedCalls'],_0x09d8('0x75'),_0x11c955['name']);}else if(!ifInterval(_0x11c955[_0x09d8('0x1cc')],_0x11c955['startProgressive'])&&_[_0x09d8('0x3a')](_0x11c955[_0x09d8('0x91')])&&!_[_0x09d8('0x3a')](_0x11c955[_0x09d8('0x75')])){_0x11c955[_0x09d8('0x91')]=moment()['format'](_0x09d8('0xf6'));loggerPredictive['info'](_0x11c955[_0x09d8('0x3f')],_0x09d8('0x1d4'),_0x11c955[_0x09d8('0x91')]);this[_0x09d8('0x1d5')](_0x11c955[_0x09d8('0x1cc')])[_0x09d8('0xb4')](this[_0x09d8('0x1d6')](_0x11c955))[_0x09d8('0xb4')](mergeDataErlangB(_0x11c955))[_0x09d8('0xb4')](this[_0x09d8('0x1d7')](_0x11c955))[_0x09d8('0xaf')](loggerCatchPredictive(_0x09d8('0x1d8'),_0x11c955));}else if(!ifInterval(_0x11c955['dialPredictiveInterval'],_0x11c955[_0x09d8('0x91')])){_0x11c955[_0x09d8('0x112')]=0x0;_0x11c955[_0x09d8('0x91')]=moment()[_0x09d8('0x95')](_0x09d8('0xf6'));loggerPredictive['info'](_0x11c955[_0x09d8('0x3f')],_0x09d8('0x1d9'),_0x11c955['startPredictive']);clearInterval(_0x11c955[_0x09d8('0x93')]);_0x11c955[_0x09d8('0x93')]=undefined;this[_0x09d8('0x1d5')](_0x11c955[_0x09d8('0x1cc')])[_0x09d8('0xb4')](this['getDataPredictive'](_0x11c955))[_0x09d8('0xb4')](mergeDataErlangB(_0x11c955))['then'](this[_0x09d8('0x1d7')](_0x11c955))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x11c955));}else if(_0x11c955[_0x09d8('0x6f')]&&_0x5d1feb<_0x11c955[_0x09d8('0x6f')]-_0x2e4b92){freeVariablesPredictive(_0x11c955);loggerPredictive[_0x09d8('0x7f')](_0x11c955[_0x09d8('0x3f')],_0x09d8('0x1da'),_0x5d1feb,_0x09d8('0x1db'),_0x11c955[_0x09d8('0x6f')],'-',_0x2e4b92,'=',_0x11c955['predictiveIntervalAvailable']-_0x2e4b92,')');}else if(_0x11c955['predictiveIntervalAvailable']&&_0x5d1feb>_0x11c955['predictiveIntervalAvailable']+_0x28d33f){freeVariablesPredictive(_0x11c955);loggerPredictive['info'](_0x11c955[_0x09d8('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5d1feb,_0x09d8('0x1dc'),_0x11c955[_0x09d8('0x6f')],'+',_0x28d33f,'=',_0x11c955['predictiveIntervalAvailable']+_0x28d33f,')');}};Dialer[_0x09d8('0x16')]['getDataPredictive']=function(_0x2a1877){var _0x42e434=this;return function(_0x383578){return new BPromise(function(_0x5a09dc,_0x14f12e){_[_0x09d8('0x8f')](_0x2a1877,_0x383578[0x0]);if(checkGetDataPredictive(_0x383578[0x0])){var _0x54fe3f=_0x2a1877['predictiveIntervalAvailable']=_0x2a1877[_0x09d8('0x52')]+_0x2a1877[_0x09d8('0xa3')];var _0x58d8e4=_0x2a1877[_0x09d8('0x1cc')]*0x3c;var _0x54d9ea=_0x383578[0x0][_0x09d8('0x68')]+_0x383578[0x0]['predictiveIntervalAvgHoldtime'];var _0x561882=(_0x383578[0x0][_0x09d8('0x66')]+_0x383578[0x0][_0x09d8('0x6a')]+_0x383578[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x383578[0x0]['predictiveIntervalTotalCalls'];_0x2a1877[_0x09d8('0x6c')]=_0x561882>0x0?_0x561882:0x1;switch(_0x2a1877[_0x09d8('0x1cd')]){case _0x09d8('0x1d0'):var _0x24c4c5=_0x2a1877['dialPredictiveOptimizationPercentage']/0x64;return _0x42e434[_0x09d8('0x1dd')](_0x54fe3f,_0x58d8e4,_0x54d9ea,_0x561882,_0x24c4c5)['then'](function(_0x2073ed){return _0x5a09dc(_0x2073ed);});case _0x09d8('0x1de'):var _0x340add=_0x2a1877[_0x09d8('0x1c5')]/0x64;return _0x42e434[_0x09d8('0x1df')](_0x54fe3f,_0x58d8e4,_0x54d9ea,_0x561882,_0x340add)[_0x09d8('0xb4')](function(_0x24e5c1){return _0x5a09dc(_0x24e5c1);});default:return _0x14f12e(msgResponse(_0x09d8('0x1e0'),'Failure',_0x09d8('0x1e1')));}}else{return _0x14f12e(msgResponse(_0x09d8('0x1e0'),'Failure','check\x20failure'));}});};};Dialer[_0x09d8('0x16')]['getDataPredictiveOld']=function(_0x1589d4){var _0x57ac8f=this;return function(_0x1afacc){return new BPromise(function(_0x585a2f,_0x500490){_[_0x09d8('0x8f')](_0x1589d4,_0x1afacc[0x0]);if(checkGetDataPredictive(_0x1afacc[0x0])){loggerPredictive['info'](JSON[_0x09d8('0x79')](_0x1afacc[0x0]));if(_0x1589d4[_0x09d8('0x1cd')]===_0x09d8('0x1d0')){return _0x57ac8f[_0x09d8('0xc2')](_0x1589d4['id'])[_0x09d8('0xb4')](function(_0x33aa42){var _0x2e56c2=_0x1589d4[_0x09d8('0x158')]-_0x33aa42[0x0][_0x09d8('0x1e2')];var _0xb093f1=_0x1589d4[_0x09d8('0x1cc')]*0x3c;var _0x104b98=_0x1afacc[0x0][_0x09d8('0x68')]+_0x1afacc[0x0]['predictiveIntervalAvgHoldtime'];var _0x4476d4=(_0x1afacc[0x0][_0x09d8('0x66')]+_0x1afacc[0x0][_0x09d8('0x6a')]+_0x1afacc[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1afacc[0x0][_0x09d8('0x70')];var _0x1b31e5=_0x1589d4[_0x09d8('0x1c5')]/0x64;_0x1589d4['predictiveIntervalPauses']=_0x33aa42[0x0]['outboundQueuePauses']||0x0;_0x1589d4['predictiveIntervalHitRate']=_0x4476d4>0x0?_0x4476d4:0x1;return _0x57ac8f[_0x09d8('0x1dd')](_0x2e56c2,_0xb093f1,_0x104b98,_0x4476d4,_0x1b31e5);})[_0x09d8('0xb4')](function(_0x2fa2bc){return _0x585a2f(_0x2fa2bc);})[_0x09d8('0xaf')](function(_0x4a5d6b){return _0x500490(msgResponse(_0x09d8('0x1e3'),_0x09d8('0x140'),JSON[_0x09d8('0x79')](_0x4a5d6b)));});}if(_0x1589d4['dialPredictiveOptimization']===_0x09d8('0x1de')){return _0x57ac8f[_0x09d8('0xc2')](_0x1589d4['id'])[_0x09d8('0xb4')](function(_0x3ad2a0){var _0x2ed3a4=_0x1589d4[_0x09d8('0x158')]-_0x3ad2a0[0x0][_0x09d8('0x1e2')];var _0x189afe=_0x1589d4[_0x09d8('0x1cc')]*0x3c;var _0x2e4b62=_0x1afacc[0x0][_0x09d8('0x68')]+_0x1afacc[0x0][_0x09d8('0x67')];var _0x56d749=(_0x1afacc[0x0][_0x09d8('0x66')]+_0x1afacc[0x0][_0x09d8('0x6a')]+_0x1afacc[0x0][_0x09d8('0x69')])/_0x1afacc[0x0][_0x09d8('0x70')];var _0x54d9d1=_0x1589d4[_0x09d8('0x1c5')]/0x64;_0x1589d4[_0x09d8('0x6e')]=_0x3ad2a0[0x0][_0x09d8('0x1e2')]||0x0;_0x1589d4[_0x09d8('0x6c')]=_0x56d749>0x0?_0x56d749:0x1;return _0x57ac8f[_0x09d8('0x1df')](_0x2ed3a4,_0x189afe,_0x2e4b62,_0x56d749,_0x54d9d1);})[_0x09d8('0xb4')](function(_0x2c4c06){return _0x585a2f(_0x2c4c06);})[_0x09d8('0xaf')](function(_0x1f8894){return _0x500490(msgResponse(_0x09d8('0x1e3'),_0x09d8('0x140'),JSON[_0x09d8('0x79')](_0x1f8894)));});}}else{return _0x500490(msgResponse(_0x09d8('0x1e0'),_0x09d8('0x140'),_0x09d8('0x1e4')));}});};};Dialer['prototype'][_0x09d8('0x1d7')]=function(_0x5d08b3){var _0x6fa913=this;return function(){var _0x87cd5e=0x0;var _0x31f1f8=Math[_0x09d8('0x1c8')](_0x5d08b3[_0x09d8('0x73')]*0x3e8);if(_0x31f1f8>0x0){_0x31f1f8=_0x31f1f8<0x64?0x64:_0x31f1f8;loggerPredictive[_0x09d8('0x7f')](_0x5d08b3[_0x09d8('0x3f')],_0x09d8('0x1e5'),_0x31f1f8,_0x09d8('0x48'));_0x5d08b3[_0x09d8('0x93')]=setInterval(function(){_0x6fa913[_0x09d8('0x93')](_0x5d08b3);loggerPredictiveCalls[_0x09d8('0x7f')](_0x09d8('0x1e6'),_0x87cd5e+=0x1);},_0x31f1f8);}else{loggerPredictive[_0x09d8('0x7f')](_0x5d08b3[_0x09d8('0x3f')],_0x09d8('0x1e7'));}};};Dialer[_0x09d8('0x16')][_0x09d8('0x1e8')]=function(_0x4dc01a,_0x3ba60c){var _0x4fa3d0=this;return function(_0x4cf39b){if(_['isEmpty'](_0x4cf39b)){if(_[_0x09d8('0xd8')](_0x3ba60c[_0x09d8('0xcc')])||!_0x3ba60c[_0x09d8('0x1e9')]){if(_0x4dc01a['dialMethod']==='booked'){_0x4dc01a[_0x09d8('0x127')]=_['isUndefined'](_0x4dc01a[_0x09d8('0x127')])?!![]:_0x4dc01a[_0x09d8('0x127')];var _0xa823f3=uuid['v4']();_0x4fa3d0[_0x09d8('0x21')][_0xa823f3]=new Action(_0x4dc01a,_0x3ba60c,_0xa823f3);loggerBooked[_0x09d8('0x7f')]('[booked][checkContactBlack]',_0xa823f3,_0x09d8('0x1ea'),JSON[_0x09d8('0x79')](_0x4dc01a[_0x09d8('0x127')]),_0x09d8('0x1eb'),_0x4dc01a['name']);if(_0x4dc01a[_0x09d8('0x127')]){_0x4dc01a[_0x09d8('0x127')]=![];_0x4fa3d0[_0x09d8('0x25')][_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xb1')]]=[];ami[_0x09d8('0xad')]({'actionid':_0xa823f3,'action':_0x09d8('0x1ec'),'queue':_0x4dc01a[_0x09d8('0x3f')]})[_0x09d8('0xaf')](function(_0x2cb310){_0x4fa3d0[_0x09d8('0xb0')](_0x4dc01a);_0x4fa3d0[_0x09d8('0xbc')]({'active':![],'ContactId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xf7')],'ListId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3]['ListId'],'VoiceQueueId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xf8')]||undefined,'CampaignId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x1ed')));delete _0x4fa3d0[_0x09d8('0x21')][_0xa823f3];});}else{loggerBooked[_0x09d8('0x7f')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x4dc01a[_0x09d8('0x127')]),_0x09d8('0x1eb'),_0x4dc01a['name']);_0x4fa3d0[_0x09d8('0xb0')](_0x4dc01a);_0x4fa3d0[_0x09d8('0xbc')]({'active':![],'ContactId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xf7')],'ListId':_0x4fa3d0['actions'][_0xa823f3][_0x09d8('0xcb')],'VoiceQueueId':_0x4fa3d0['actions'][_0xa823f3][_0x09d8('0xf8')]||undefined,'CampaignId':_0x4fa3d0[_0x09d8('0x21')][_0xa823f3][_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4fa3d0['actions'][_0xa823f3];}}else{return _0x4fa3d0[_0x09d8('0x163')](_0x4dc01a,_0x3ba60c);}}else{if(getDiff(_0x3ba60c['scheduledat'])<_0x4dc01a[_0x09d8('0x1ee')]*0x3c){if(_0x3ba60c[_0x09d8('0x1ef')]&&!_0x3ba60c[_0x09d8('0x1ef')]['voicePause']){_0x4fa3d0[_0x09d8('0x1b')]['run'](_0x3ba60c['id'])['finally'](function(){_0x4fa3d0[_0x09d8('0xb0')](_0x4dc01a);});}else{_0x4fa3d0[_0x09d8('0xbd')]({'active':![]},_0x3ba60c['id'],0x1)['finally'](function(){console[_0x09d8('0x1f0')](_0x09d8('0x1f1'));_0x4fa3d0[_0x09d8('0xb0')](_0x4dc01a);});}}else{_0x4dc01a[_0x09d8('0x64')]+=0x1;_0x4fa3d0[_0x09d8('0xb0')](_0x4dc01a);if(_0x4dc01a[_0x09d8('0x1f2')]){_0x4fa3d0[_0x09d8('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ba60c[_0x09d8('0xf7')],'ListId':_0x3ba60c['ListId'],'VoiceQueueId':_0x3ba60c['VoiceQueueId']||undefined,'CampaignId':_0x3ba60c[_0x09d8('0xcd')]||undefined})[_0x09d8('0xaf')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x4fa3d0[_0x09d8('0xc4')](createObjHistory(_0x4dc01a,_0x3ba60c,_0x09d8('0x1f3'),0x17,_0x09d8('0x1f4')))[_0x09d8('0xaf')](loggerCatch(_0x09d8('0x1f5')));}else{_0x4fa3d0[_0x09d8('0xca')](createObjHistory(_0x4dc01a,_0x3ba60c,_0x09d8('0x1f6'),0x16,_0x09d8('0x1f7')),_0x09d8('0x1f8'),_0x09d8('0x1f9'));}}}}else{_0x4dc01a['outboundBlacklistCallsDay']+=0x1;_0x4fa3d0['saveInDb'](createObjHistory(_0x4dc01a,_0x3ba60c,_0x09d8('0x1fa'),0xd,'Blacklist'),_0x09d8('0x1fb'),'[Originate][MoveBlacklist]');throw _0x09d8('0x1fc');}};};Dialer[_0x09d8('0x16')][_0x09d8('0x1fd')]=function(_0x174bab){var _0x533bcc=this;var _0x318bd4=[];var _0x155fd9=_0x174bab[_0x09d8('0x1fe')]-_0x174bab[_0x09d8('0x71')]-_0x174bab[_0x09d8('0x1ff')];emitCampaignSummary(_0x174bab);if(_0x155fd9>0x0){if(_0x155fd9>this[_0x09d8('0x1f')]){_0x155fd9=this[_0x09d8('0x1f')];}_0x174bab[_0x09d8('0x1ff')]+=_0x155fd9;this[_0x09d8('0xc1')](_0x174bab['id'],_0x155fd9,_0x174bab[_0x09d8('0x200')])['then'](function(_0x16744b){_0x174bab[_0x09d8('0x1ff')]-=_0x155fd9;_0x174bab[_0x09d8('0x1ff')]=_0x174bab[_0x09d8('0x1ff')]>0x0?_0x174bab[_0x09d8('0x1ff')]:0x0;if(!checkContactEmpty(_0x16744b)){_0x174bab[_0x09d8('0x3b')]=_0x09d8('0x201');logger[_0x09d8('0x7f')](_0x09d8('0x202')+_0x174bab['name']);}else{_0x174bab[_0x09d8('0x71')]+=_0x16744b[_0x09d8('0x12d')];_0x174bab[_0x09d8('0x3b')]=_0x09d8('0x203');for(var _0x469cdb=0x0;_0x469cdb<_0x16744b[_0x09d8('0x12d')];_0x469cdb+=0x1){_0x174bab['ivrTotalCallsDays']+=0x1;if(_[_0x09d8('0xd8')](_0x16744b[_0x469cdb])||_[_0x09d8('0xd8')](_0x16744b[_0x469cdb]['Contact'])||_['isNil'](_0x16744b[_0x469cdb]['Contact']['phone'])){_0x533bcc[_0x09d8('0xc8')]('[actionOriginate]\x20',_0x174bab,_0x16744b[_0x469cdb]);}else{_0x533bcc[_0x09d8('0xba')](_[_0x09d8('0x125')](_0x16744b[_0x469cdb],[_0x09d8('0xcd'),'Contact.phone']))[_0x09d8('0xb4')](_0x533bcc[_0x09d8('0x1e8')](_0x174bab,_0x16744b[_0x469cdb]))[_0x09d8('0xaf')](_0x533bcc[_0x09d8('0xc7')](_0x09d8('0x204'),_0x174bab));}}}})['catch'](loggerGetContactDialer('[getContactCampaign2]',_0x174bab,_0x155fd9));}};Dialer['prototype'][_0x09d8('0x152')]=function(_0x52eeb6,_0x5a82fd){var _0x4b0de8=this;var _0x3a58a6=[];var _0x4eedc1=_0x5a82fd>=0x1?_0x5a82fd:0x1;var _0x5272fb=[];if(_0x52eeb6[_0x09d8('0x58')]===_0x09d8('0x154')){_0x4eedc1=0x1;}var _0x6154e6=Math[_0x09d8('0x1c8')](_0x52eeb6['available']*_0x4eedc1)-_0x52eeb6[_0x09d8('0x71')]-_0x52eeb6[_0x09d8('0x1ff')];emitVoiceQueueSummary(_0x52eeb6);if(_0x52eeb6['dialLimitQueue']>0x0){var _0x265691=_0x52eeb6[_0x09d8('0x205')]-_0x52eeb6[_0x09d8('0x71')]-_0x52eeb6[_0x09d8('0x52')]-_0x52eeb6['temp']-_0x52eeb6['pTalking'];if(_0x6154e6>_0x265691){_0x6154e6=_0x265691;}}if(_0x6154e6>0x0){if(_0x52eeb6[_0x09d8('0x58')]===_0x09d8('0x154')){_0x6154e6=0x1;}if(_0x6154e6>this[_0x09d8('0x1f')]){_0x6154e6=this[_0x09d8('0x1f')];}_0x52eeb6[_0x09d8('0x1ff')]+=_0x6154e6;for(var _0x5b301a in this['agents']){if(this[_0x09d8('0x1e')]['hasOwnProperty'](_0x5b301a)){if(this[_0x09d8('0x1e')][_0x5b301a][_0x09d8('0xe1')]===_0x09d8('0x206')&&this[_0x09d8('0x1e')][_0x5b301a][_0x09d8('0xd4')]==='reachable'){_0x3a58a6[_0x09d8('0x124')](this[_0x09d8('0x1e')][_0x5b301a]['id']);}}}this[_0x09d8('0xbf')](_0x52eeb6['id'],_0x3a58a6,_0x6154e6,_0x52eeb6[_0x09d8('0x200')])[_0x09d8('0xb4')](function(_0x28c301){_0x52eeb6[_0x09d8('0x1ff')]-=_0x6154e6;_0x52eeb6[_0x09d8('0x1ff')]=_0x52eeb6[_0x09d8('0x1ff')]>0x0?_0x52eeb6[_0x09d8('0x1ff')]:0x0;if(!checkContactEmpty(_0x28c301)){_0x4b0de8['countReScheduled'](_0x52eeb6)[_0x09d8('0xb4')](sendMessageReschedule(_0x52eeb6))[_0x09d8('0xaf')](loggerCatch('[countReScheduled]\x20'));}else{_0x52eeb6[_0x09d8('0x71')]+=_0x28c301[_0x09d8('0x12d')];_0x52eeb6[_0x09d8('0x3b')]=_0x52eeb6[_0x09d8('0x58')]===_0x09d8('0x154')?_0x09d8('0x16f'):_0x09d8('0x203');for(var _0x477676=0x0;_0x477676<_0x28c301[_0x09d8('0x12d')];_0x477676+=0x1){if(_[_0x09d8('0xd8')](_0x28c301[_0x477676])||_[_0x09d8('0xd8')](_0x28c301[_0x477676][_0x09d8('0x167')])||_['isNil'](_0x28c301[_0x477676][_0x09d8('0x167')][_0x09d8('0x166')])){_0x4b0de8['emptyContact'](_0x09d8('0x207'),_0x52eeb6,_0x28c301[_0x477676]);}else{_0x4b0de8['checkIsBlackList'](_['pick'](_0x28c301[_0x477676],[_0x09d8('0xf8'),_0x09d8('0x208')]))[_0x09d8('0xb4')](_0x4b0de8[_0x09d8('0x1e8')](_0x52eeb6,_0x28c301[_0x477676]))[_0x09d8('0xaf')](_0x4b0de8[_0x09d8('0xc7')](_0x09d8('0x207'),_0x52eeb6));}}}})['catch'](loggerGetContactDialer(_0x09d8('0x209'),_0x52eeb6,_0x6154e6));}};Dialer[_0x09d8('0x16')][_0x09d8('0x93')]=function(_0x3f155e){var _0x24f6a5=this;if(_0x3f155e[_0x09d8('0x205')]>0x0){var _0x1dd6de=_0x3f155e[_0x09d8('0x205')]-_0x3f155e['originated']-_0x3f155e['talking'];if(_0x1dd6de>0x0){this['tryOriginatePredictive'](_0x3f155e);}else{loggerPredictiveCalls['info'](_0x09d8('0x20a'));}}else{this[_0x09d8('0x20b')](_0x3f155e);}};Dialer[_0x09d8('0x16')][_0x09d8('0x20b')]=function(_0x565ab5){var _0x5c3433=this;var _0x4361a4=[];_0x565ab5['originated']+=0x1;for(var _0x4e6d35 in this['agents']){if(this['agents']['hasOwnProperty'](_0x4e6d35)){if(this[_0x09d8('0x1e')][_0x4e6d35]['state']===_0x09d8('0x206')&&this[_0x09d8('0x1e')][_0x4e6d35][_0x09d8('0xd4')]==='reachable'){_0x4361a4[_0x09d8('0x124')](this['agents'][_0x4e6d35]['id']);}}}this[_0x09d8('0xbf')](_0x565ab5['id'],_0x4361a4,0x1,_0x565ab5[_0x09d8('0x200')])['then'](function(_0x5efe2d){if(!checkContactEmpty(_0x5efe2d)){checkContactLowerLimitOriginate(_0x565ab5,0x1,0x0);_0x5c3433[_0x09d8('0xb5')](_0x565ab5)[_0x09d8('0xb4')](sendMessageReschedule(_0x565ab5))[_0x09d8('0xaf')](loggerCatch('[countReScheduled]\x20'));}else{_0x565ab5[_0x09d8('0x3b')]='RUNNING';if(_['isNil'](_0x5efe2d[0x0])||_['isNil'](_0x5efe2d[0x0][_0x09d8('0x167')])||_[_0x09d8('0xd8')](_0x5efe2d[0x0][_0x09d8('0x167')][_0x09d8('0x166')])){_0x5c3433[_0x09d8('0xc8')]('[actionOriginate]\x20',_0x565ab5,_0x5efe2d[0x0]);}else{_0x5c3433[_0x09d8('0xb8')](_[_0x09d8('0x125')](_0x5efe2d[0x0],[_0x09d8('0xf8'),_0x09d8('0x208')]))[_0x09d8('0xb4')](_0x5c3433[_0x09d8('0x1e8')](_0x565ab5,_0x5efe2d[0x0]))[_0x09d8('0xaf')](_0x5c3433[_0x09d8('0xc7')](_0x09d8('0x20c'),_0x565ab5));}}})[_0x09d8('0xaf')](loggerGetContactDialer('[getContactDialerPredictive]',_0x565ab5,0x1));emitVoiceQueueSummary(_0x565ab5);};Dialer['prototype'][_0x09d8('0x1dd')]=function(_0xf12a79,_0x4a94e8,_0x47b475,_0xd1b7b1,_0x42c0df,_0x53c8cb){loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x20d'));loggerPredictive[_0x09d8('0x7f')]('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',_0xf12a79);loggerPredictive[_0x09d8('0x7f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a94e8);loggerPredictive[_0x09d8('0x7f')]('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',_0x47b475);loggerPredictive['info']('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',_0xd1b7b1);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x20e'),_0x42c0df);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x85'));return new BPromise(function(_0x57b37e,_0x1d5e28){if(_0xf12a79<=0x0||isNaN(_0xf12a79)){return _0x1d5e28(msgResponse(_0x09d8('0x20f'),_0x09d8('0x47'),'m\x20=\x20'+_0xf12a79));}if(_0x47b475<=0x0||isNaN(_0x47b475)){return _0x1d5e28(msgResponse('[abandonmentRate]','Error',_0x09d8('0x210')+_0x47b475));}if(_0xd1b7b1<=0x0||isNaN(_0xd1b7b1)){return _0x1d5e28(msgResponse('[abandonmentRate]',_0x09d8('0x47'),'p\x20=\x20'+_0xd1b7b1));}if(_0x4a94e8<=0x0||isNaN(_0x4a94e8)){return _0x1d5e28(msgResponse(_0x09d8('0x20f'),_0x09d8('0x47'),_0x09d8('0x211')+_0x4a94e8));}if(_0x42c0df<=0x0||isNaN(_0x42c0df)){return _0x1d5e28(msgResponse(_0x09d8('0x20f'),_0x09d8('0x47'),_0x09d8('0x212')+_0x42c0df));}_0x53c8cb=_0x53c8cb||0x0;var _0x6eabe5=0x1/_0x47b475;var _0x19a950=0x0;var _0x5f4f88=0x0;var _0x167f08=0x0;var _0x32ae08=0x0;for(var _0x38b7ff=0x0;_0x167f08<_0x42c0df;_0x38b7ff+=0x1){_0x5f4f88=_0x38b7ff/_0x4a94e8;_0x19a950=(_0xd1b7b1*_0x5f4f88+_0x53c8cb)/_0x6eabe5;_0x167f08=erlangb(_0x19a950,_0xf12a79);_0x32ae08=_0x19a950/_0xf12a79*(0x1-erlangb(_0x19a950,_0xf12a79));}return _0x57b37e({'erlangCalls':_0x38b7ff,'erlangCallToSecond':_0x4a94e8/_0x38b7ff,'erlangAbandonmentRate':_0x167f08,'erlangBusyFactor':_0x32ae08});});};Dialer[_0x09d8('0x16')][_0x09d8('0x1df')]=function(_0x10cb10,_0x55131a,_0x2273d8,_0x46937a,_0x32013e,_0x3111d9){loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x213'));loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x214'),_0x10cb10);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x215'),_0x55131a);loggerPredictive[_0x09d8('0x7f')]('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',_0x2273d8);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x216'),_0x46937a);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x217'),_0x32013e);loggerPredictive[_0x09d8('0x7f')](_0x09d8('0x85'));return new BPromise(function(_0x15dfae,_0x29252d){if(_0x10cb10<=0x0||isNaN(_0x10cb10)){return _0x29252d(msgResponse(_0x09d8('0x218'),_0x09d8('0x47'),_0x09d8('0x219')+_0x10cb10));}if(_0x2273d8<=0x0||isNaN(_0x2273d8)){return _0x29252d(msgResponse('[busyFactor]',_0x09d8('0x47'),'Ts\x20=\x20'+_0x2273d8));}if(_0x46937a<=0x0||isNaN(_0x46937a)){return _0x29252d(msgResponse(_0x09d8('0x218'),_0x09d8('0x47'),_0x09d8('0x21a')+_0x46937a));}if(_0x55131a<=0x0||isNaN(_0x55131a)){return _0x29252d(msgResponse('[busyFactor]','Error',_0x09d8('0x211')+_0x55131a));}if(_0x32013e<=0x0||isNaN(_0x32013e)){return _0x29252d(msgResponse(_0x09d8('0x218'),_0x09d8('0x47'),_0x09d8('0x21b')+_0x32013e));}_0x3111d9=_0x3111d9||0x0;var _0x1e556c=0x1/_0x2273d8;var _0x2d1fd7=0x0;var _0x296f60=0x0;var _0x5da07f=0x0;var _0x3ec8c1=0x0;for(var _0x3f5d2a=0x0;_0x3ec8c1<_0x32013e;_0x3f5d2a+=0x1){_0x296f60=_0x3f5d2a/_0x55131a;_0x2d1fd7=(_0x46937a*_0x296f60+_0x3111d9)/_0x1e556c;_0x5da07f=erlangb(_0x2d1fd7,_0x10cb10);_0x3ec8c1=_0x2d1fd7/_0x10cb10*(0x1-erlangb(_0x2d1fd7,_0x10cb10));}return _0x15dfae({'erlangCalls':_0x3f5d2a,'erlangCallToSecond':_0x55131a/_0x3f5d2a,'erlangAbandonmentRate':_0x5da07f,'erlangBusyFactor':_0x3ec8c1});});};module[_0x09d8('0x21c')]=Dialer; \ No newline at end of file +var _0xd92c=['random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','OriginateError','originate\x20action\x20Error','getQueue','response','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','buildObj','noanswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','dialPredictiveInterval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','reachable','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\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','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','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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]','m\x20=\x20','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','milliseconds','diff','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','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','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','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','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','hasOwnProperty','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','then','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','emptyContact','notFound','pick','ContactId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','unmonitored','saveInDb','uniqueId','variable','dialAMDActive','value','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','uniqueid','outboundAnswerAgiCallsDay','countmachineretry','countglobal','amd','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','minutes','ListId','CampaignId','[rescheduleContact][Machine]','HANGUP','HangupInAMD','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','[syncHangupIvr][createHistory]','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','agents','stateinterface','rrmemory','queueBooked','queueStatusComplete','[unlockQueueStatus][undefined]','syncQueueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','[booked][RR]','stringify','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock3]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','command','interval','indexOf','true','iftime\x20%s,%s','content','all','some','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','handlePower','power','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkDialMethod','[syncCampaigns]','\x5cw{0,','pow','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd92c,0xbb));var _0xcd92=function(_0x45eb29,_0x309e77){_0x45eb29=_0x45eb29-0x0;var _0x2339af=_0xd92c[_0x45eb29];return _0x2339af;};'use strict';var util=require('util');var _=require(_0xcd92('0x0'));var BPromise=require(_0xcd92('0x1'));var uuid=require('uuid');var moment=require(_0xcd92('0x2'));var rr=require('rr');var md5=require(_0xcd92('0x3'));var Redis=require(_0xcd92('0x4'));var ut=require(_0xcd92('0x5'));var config=require(_0xcd92('0x6'));var logger=require(_0xcd92('0x7'))(_0xcd92('0x8'));var loggerBooked=require(_0xcd92('0x7'))(_0xcd92('0x9'));var loggerPredictive=require('../../../config/logger')(_0xcd92('0xa'));var loggerPredictiveCalls=require(_0xcd92('0x7'))(_0xcd92('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xcd92('0xc'));var ami=require(_0xcd92('0xd'));config[_0xcd92('0xe')]=_[_0xcd92('0xf')](config['redis'],{'host':_0xcd92('0x10'),'port':0x18eb});var io=require(_0xcd92('0x11'))(new Redis(config[_0xcd92('0xe')]));var cmHopper=require(_0xcd92('0x12'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xcd92('0x13'));var cmHopperBlack=require(_0xcd92('0x14'));var voiceQueueRt=require(_0xcd92('0x15'));var Action=require(_0xcd92('0x16'));var History=require(_0xcd92('0x17'));var Final=require(_0xcd92('0x18'));var AgentComplete=require(_0xcd92('0x19'));var QueueCallerAbandon=require(_0xcd92('0x1a'));var Hangup=require(_0xcd92('0x1b'));var ipAgi=process[_0xcd92('0x1c')][_0xcd92('0x1d')]||_0xcd92('0x1e');var strategy={'rrmemory':'rrmemory','roundrobin':_0xcd92('0x1f')};var Sequence=function(){};Sequence[_0xcd92('0x20')][_0xcd92('0x21')]=function(_0x3d8821){this[_0xcd92('0x22')]=this[_0xcd92('0x22')]?this[_0xcd92('0x22')][_0xcd92('0x23')](_0x3d8821):_0x3d8821();};function Dialer(_0x1c9585,_0x197b72){this[_0xcd92('0x24')]=new Sequence();this[_0xcd92('0x25')]=_0x197b72;this[_0xcd92('0x26')]=_0x1c9585[_0xcd92('0x26')];this[_0xcd92('0x27')]=_0x1c9585[_0xcd92('0x27')];this['agents']=_0x1c9585['agents'];this[_0xcd92('0x28')]=_0x1c9585['trunks'];this[_0xcd92('0x29')]=config[_0xcd92('0x29')]||0x2;this['channels']={};this[_0xcd92('0x2a')]={};this[_0xcd92('0x2b')]={};this['uniqueId']={};this['optionPredictive']={};this[_0xcd92('0x2c')]={};this[_0xcd92('0x2d')]={};this[_0xcd92('0x2e')]={};this['queueBooked']={};this[_0xcd92('0x2f')]={};ami['on'](_0xcd92('0x30'),this[_0xcd92('0x31')]['bind'](this));ami['on'](_0xcd92('0x32'),this[_0xcd92('0x33')][_0xcd92('0x34')](this));ami['on'](_0xcd92('0x35'),this[_0xcd92('0x36')]['bind'](this));ami['on'](_0xcd92('0x37'),this[_0xcd92('0x38')]['bind'](this));ami['on'](_0xcd92('0x39'),this[_0xcd92('0xc')][_0xcd92('0x34')](this));ami['on']('hangup',this[_0xcd92('0x3a')]['bind'](this));ami['on'](_0xcd92('0x3b'),this[_0xcd92('0x3c')]['bind'](this));ami['on'](_0xcd92('0x3d'),this[_0xcd92('0x3e')][_0xcd92('0x34')](this));ami['on'](_0xcd92('0x3f'),this[_0xcd92('0x40')][_0xcd92('0x34')](this));ami['on'](_0xcd92('0x41'),this['syncQueueStatusComplete'][_0xcd92('0x34')](this));this[_0xcd92('0x42')]();this[_0xcd92('0x43')]();}function isNotNull(_0x4e9870){return _0x4e9870!==null&&!_[_0xcd92('0x44')](_0x4e9870);}function checkIsLoggedIn(_0x4f934a,_0x4dfb74){return function(){if(_0x4dfb74<=0x0){_0x4f934a[_0xcd92('0x45')]=_0xcd92('0x46');throw _0x4f934a[_0xcd92('0x47')]+_0xcd92('0x48');}};}function isActive(_0x36439e){return _0x36439e;}function checkIsActive(_0x55fcba,_0x454e8e){return function(){if(!isActive(_0x454e8e)){_0x55fcba[_0xcd92('0x45')]=_0xcd92('0x49');throw _0x55fcba[_0xcd92('0x47')]+_0xcd92('0x4a');}};}function checkInterval(_0x10a9cb){return function(){if(!isNotNull(_0x10a9cb['Interval'])){_0x10a9cb[_0xcd92('0x45')]=_0xcd92('0x4b');throw _0x10a9cb[_0xcd92('0x47')]+_0xcd92('0x4c');}if(!isNotNull(_0x10a9cb[_0xcd92('0x4d')][_0xcd92('0x4e')])){_0x10a9cb[_0xcd92('0x45')]=_0xcd92('0x4b');throw _0x10a9cb[_0xcd92('0x47')]+_0xcd92('0x4c');}if(!isNotNull(_[_0xcd92('0x4f')](_0x10a9cb[_0xcd92('0x4d')][_0xcd92('0x4e')]))){_0x10a9cb[_0xcd92('0x45')]=_0xcd92('0x4b');throw _0x10a9cb[_0xcd92('0x47')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x21138b,_0x5f16cd,_0x834ee0){return{'action':_0x21138b,'response':_0x5f16cd,'message':_0x834ee0,'stack':_0x834ee0};}function myreject(_0x1e430f){return function(_0x1ccb37){return _0x1e430f(msgResponse('[ifTime][Action]',_0xcd92('0x50'),JSON['stringify'](_0x1ccb37)));};}function getSeconds(_0x1a2b0c,_0x4f55da){var _0x4738f2=moment(_0x1a2b0c)[_0xcd92('0x51')](0x0);var _0x400e2b=moment(_0x4f55da)[_0xcd92('0x51')](0x0);return _0x4738f2[_0xcd92('0x52')](_0x400e2b,'seconds');}function emit(_0x1e4993,_0x49c6e8,_0x45c18c){io['to'](_0x1e4993)['emit'](_0x49c6e8,_0x45c18c);}function emitVoiceQueueSummary(_0x28c258){if(_0x28c258['type']===_0xcd92('0x53')){var _0x2a687b={'id':_0x28c258['id'],'name':_0x28c258[_0xcd92('0x47')],'strategy':_0x28c258['strategy'],'answered':_0x28c258[_0xcd92('0x54')],'available':_0x28c258[_0xcd92('0x55')],'loggedIn':_0x28c258[_0xcd92('0x56')],'pTalking':_0x28c258['pTalking'],'sumBillable':_0x28c258[_0xcd92('0x57')],'sumDuration':_0x28c258[_0xcd92('0x58')],'sumHoldTime':_0x28c258[_0xcd92('0x59')]||0x0,'talking':_0x28c258['talking'],'total':_0x28c258[_0xcd92('0x5a')],'type':_0x28c258[_0xcd92('0x5b')],'unmanaged':_0x28c258['unmanaged'],'abandoned':_0x28c258[_0xcd92('0x5c')],'waiting':_0x28c258[_0xcd92('0x5d')],'loggedInDb':_0x28c258[_0xcd92('0x5e')],'dialActive':_0x28c258[_0xcd92('0x5f')],'dialMethod':_0x28c258[_0xcd92('0x60')],'dialOriginateCallerIdName':_0x28c258['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x28c258['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x28c258[_0xcd92('0x61')],'dialPrefix':_0x28c258[_0xcd92('0x62')],'outboundAnswerAgiCallsDay':_0x28c258['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x28c258[_0xcd92('0x63')],'outboundBlacklistCallsDay':_0x28c258[_0xcd92('0x64')],'outboundBusyCallsDay':_0x28c258[_0xcd92('0x65')],'outboundCongestionCallsDay':_0x28c258[_0xcd92('0x66')],'outboundDropCallsDayACS':_0x28c258['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x28c258[_0xcd92('0x67')],'outboundDropCallsDayTimeout':_0x28c258[_0xcd92('0x68')],'outboundNoAnswerCallsDay':_0x28c258[_0xcd92('0x69')],'outboundNoSuchCallsDay':_0x28c258[_0xcd92('0x6a')],'outboundOriginateFailureCallsDay':_0x28c258[_0xcd92('0x6b')],'outboundReCallsDay':_0x28c258[_0xcd92('0x6c')],'outboundRejectCallsDay':_0x28c258['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x28c258[_0xcd92('0x6d')],'predictiveIntervalAnsweredCalls':_0x28c258[_0xcd92('0x6e')],'predictiveIntervalAvgHoldtime':_0x28c258[_0xcd92('0x6f')],'predictiveIntervalAvgTalktime':_0x28c258['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x28c258[_0xcd92('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x28c258[_0xcd92('0x71')],'predictiveIntervalErlangCalls':_0x28c258['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x28c258['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x28c258[_0xcd92('0x72')],'predictiveIntervalMultiplicativeFactor':_0x28c258[_0xcd92('0x73')],'predictiveIntervalPauses':_0x28c258[_0xcd92('0x74')],'predictiveIntervalAvailable':_0x28c258[_0xcd92('0x75')],'predictiveIntervalTotalCalls':_0x28c258[_0xcd92('0x76')],'message':_0x28c258[_0xcd92('0x45')],'originated':_0x28c258[_0xcd92('0x77')],'erlangCalls':_0x28c258['erlangCalls'],'erlangCallToSecond':_0x28c258[_0xcd92('0x78')],'erlangAbandonmentRate':_0x28c258[_0xcd92('0x79')],'erlangBusyFactor':_0x28c258[_0xcd92('0x7a')],'startPredictive':_0x28c258['startPredictive'],'startProgressive':_0x28c258[_0xcd92('0x2d')]};if(_0x28c258[_0xcd92('0x7b')]){_0x2a687b['Trunk']={'id':_0x28c258[_0xcd92('0x7b')]['id'],'name':_0x28c258[_0xcd92('0x7b')]['name'],'active':_0x28c258[_0xcd92('0x7b')][_0xcd92('0x7c')],'callerid':_0x28c258[_0xcd92('0x7b')]['callerid']};}if(_0x28c258[_0xcd92('0x4d')]){_0x2a687b['Interval']={'id':_0x28c258['Interval']['id'],'name':_0x28c258[_0xcd92('0x4d')][_0xcd92('0x47')]};}var _0x5afd82=md5(JSON['stringify'](_0x2a687b));if(_0x28c258[_0xcd92('0x3')]!==_0x5afd82){_0x28c258[_0xcd92('0x3')]=_0x5afd82;emit(util[_0xcd92('0x7d')](_0xcd92('0x7e'),_0x2a687b[_0xcd92('0x47')]),_0xcd92('0x7f'),_0x2a687b);}}}function emitCampaignSummary(_0x4fd515){if(_0x4fd515[_0xcd92('0x5b')]===_0xcd92('0x80')){emit(util[_0xcd92('0x7d')](_0xcd92('0x81'),_0x4fd515['name']),_0xcd92('0x82'),_0x4fd515);}}function checkGetDataPredictive(_0x349c65){if(isNotNull(_0x349c65)){if(!_['isEmpty'](_0x349c65)){loggerPredictive[_0xcd92('0x83')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xcd92('0x83')](_0xcd92('0x84'),_0x349c65['predictiveIntervalTotalCalls']);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x85'),_0x349c65[_0xcd92('0x6e')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x86'),_0x349c65['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xcd92('0x87'),_0x349c65[_0xcd92('0x70')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x88'),_0x349c65[_0xcd92('0x6f')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x349c65['predictiveIntervalAvgTalktime']);loggerPredictive[_0xcd92('0x83')]('---------------------------');if(_0x349c65[_0xcd92('0x76')]>0x0){if(!_[_0xcd92('0x44')](_0x349c65['predictiveIntervalAvgTalktime'])&&_0x349c65[_0xcd92('0x89')]>0x0){return!![];}else{loggerPredictive[_0xcd92('0x83')](_0xcd92('0x8a'));}if(!_[_0xcd92('0x44')](_0x349c65[_0xcd92('0x6f')])&&_0x349c65[_0xcd92('0x6f')]>0x0){return!![];}else{loggerPredictive['info'](_0xcd92('0x8b'));}}else{loggerPredictive['info'](_0xcd92('0x8c'));}}else{loggerPredictive[_0xcd92('0x83')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0xcd92('0x83')](_0xcd92('0x8d'));}return![];}function mergeDataErlangB(_0x215837){return function(_0x33606b){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0xcd92('0x8e'),_0x33606b[_0xcd92('0x8f')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x90'),_0x33606b[_0xcd92('0x78')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x91'),_0x33606b[_0xcd92('0x79')]);loggerPredictive['info'](_0xcd92('0x92'),_0x33606b[_0xcd92('0x7a')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x91'),_0x33606b[_0xcd92('0x79')]);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x93'));_[_0xcd92('0x94')](_0x215837,_0x33606b);};}function getDiff(_0x237de0){var _0xe2c61a=moment()[_0xcd92('0x51')](0x0);var _0x3fe3aa=moment(_0x237de0)['milliseconds'](0x0);return _0xe2c61a['diff'](_0x3fe3aa,'seconds');}function ifInterval(_0x5b484b,_0xab9d5e){if(_[_0xcd92('0x44')](_0xab9d5e)){return![];}if(getDiff(_0xab9d5e)<_0x5b484b*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x5bfd72){if(isNotNull(_0x5bfd72)){if(!_[_0xcd92('0x44')](_0x5bfd72[_0xcd92('0x2d')])){_0x5bfd72['startProgressive']=undefined;loggerPredictive[_0xcd92('0x83')](_0x5bfd72['name'],_0xcd92('0x95'));}if(!_[_0xcd92('0x44')](_0x5bfd72[_0xcd92('0x2c')])){_0x5bfd72[_0xcd92('0x2c')]=undefined;loggerPredictive[_0xcd92('0x83')](_0x5bfd72[_0xcd92('0x47')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xcd92('0x44')](_0x5bfd72[_0xcd92('0x96')])){clearInterval(_0x5bfd72[_0xcd92('0x96')]);_0x5bfd72[_0xcd92('0x96')]=undefined;loggerPredictive['info'](_0x5bfd72[_0xcd92('0x47')],_0xcd92('0x97'));}}}function erlangb(_0x3967be,_0x56045f){if(_0x56045f===0x0){return 0x0;}var _0x23b349=0x1;for(var _0x236fe5=0x1;_0x236fe5<=_0x56045f;_0x236fe5+=0x1){_0x23b349=0x1+_0x23b349*_0x236fe5/_0x3967be;}return 0x1/_0x23b349;}function isVoiceQueueOutbound(_0x29984c){return _0x29984c===_0xcd92('0x53');}function isNotPreview(_0x3accc1){return _0x3accc1!=='preview';}function isCampaignIvr(_0x4ef4e7){return _0x4ef4e7===_0xcd92('0x80');}function getCallerId(_0x12c1c8,_0x3d5e89,_0x487ef1){if(!_[_0xcd92('0x44')](_0x487ef1)&&_0xcd92('0x98')===typeof _0x487ef1&&!_[_0xcd92('0x4f')](_0x487ef1)){if(!_[_0xcd92('0x44')](_0x3d5e89)&&'string'===typeof _0x3d5e89&&!_['isEmpty'](_0x3d5e89)){return util[_0xcd92('0x7d')](_0xcd92('0x99'),_0x3d5e89,_0x487ef1);}return util['format']('\x22%s\x22\x20<%s>',_0x487ef1,_0x487ef1);}if(!_[_0xcd92('0x44')](_0x12c1c8)&&'string'===typeof _0x12c1c8&&!_[_0xcd92('0x4f')](_0x12c1c8)){return _0x12c1c8;}return _0xcd92('0x9a');}function loggerCatchQueueSummary(_0xb6d3e4,_0x4bb35e){return function(_0x2852f0){freeVariablesPredictive(_0x4bb35e);emitVoiceQueueSummary(_0x4bb35e);emitCampaignSummary(_0x4bb35e);loggerSyncQueueSummary['error'](_0xb6d3e4,util['inspect'](_0x2852f0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x3f442a,_0x3466dc){return function(_0x212734){loggerPredictive['error'](_0x3466dc['name'],_0x3f442a);loggerPredictive[_0xcd92('0x9b')](_0x212734[_0xcd92('0x9c')]);freeVariablesPredictive(_0x3466dc);};}function loggerCatch(_0x46578c){return function(_0x195ecd){logger[_0xcd92('0x9b')](_0x46578c,util[_0xcd92('0x9d')](_0x195ecd,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x24ed5b){return _0x24ed5b&&!_['isUndefined'](_0x24ed5b)&&_0x24ed5b[_0xcd92('0x9e')]>0x0;}function decremetOriginate(_0xb5be6f){if(!_[_0xcd92('0x44')](_0xb5be6f)&&_0xb5be6f!==null){if(_0xb5be6f['hasOwnProperty'](_0xcd92('0x77'))){if(_0xb5be6f[_0xcd92('0x77')]>0x0){_0xb5be6f['originated']-=0x1;}else{logger[_0xcd92('0x9b')](_0xcd92('0x9f'));}}}else{logger[_0xcd92('0x9b')](_0xcd92('0xa0'));}}function checkContactLowerLimitOriginate(_0x27779f,_0x177236,_0xcb4845){if(_0x177236>_0xcb4845){for(var _0x4a7e02=0x0;_0x4a7e02<_0x177236-_0xcb4845;_0x4a7e02+=0x1){decremetOriginate(_0x27779f);}}}function loggerGetContactDialer(_0x39dd23,_0x231b0e,_0x3bae06){return function(_0x4fdf1e){checkContactLowerLimitOriginate(_0x231b0e,_0x3bae06,0x0);logger[_0xcd92('0x9b')](_0x39dd23,util['inspect'](_0x4fdf1e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2aa481){return function(_0x333c6e){if(isNotNull(_0x333c6e)&&isNotNull(_0x333c6e[0x0])){if(_0x333c6e[0x0][_0xcd92('0xa1')]>0x0){_0x2aa481[_0xcd92('0x45')]='RESCHEDULED_CONTACTS';logger[_0xcd92('0x83')]('[getContactDialer2][ReScheduled]'+_0x2aa481[_0xcd92('0x47')],_0x333c6e[0x0][_0xcd92('0xa1')],_0xcd92('0xa2'));}else{_0x2aa481['message']=_0xcd92('0xa3');logger['info'](_0xcd92('0xa4')+_0x2aa481['name']);}}};}function notSendMessagesQueue(_0x3f5597){if(_0x3f5597[_0xcd92('0xa5')]){freeVariablesPredictive(_0x3f5597);if(_0x3f5597[_0xcd92('0x77')]===0x0&&_0x3f5597[_0xcd92('0xa6')]===0x0&&_0x3f5597[_0xcd92('0x5d')]===0x0&&(_0x3f5597[_0xcd92('0xa7')]||0x0)===0x0){_0x3f5597[_0xcd92('0xa5')]=![];_0x3f5597['available']=0x0;_0x3f5597[_0xcd92('0x45')]=_0xcd92('0x49');loggerSyncQueueSummary['error'](_0xcd92('0xa8'),_0x3f5597[_0xcd92('0x47')],_0xcd92('0xa9'));}else{_0x3f5597[_0xcd92('0x45')]=_0xcd92('0xaa');loggerSyncQueueSummary[_0xcd92('0x9b')](_0xcd92('0xa8'),_0x3f5597['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x3f5597);}}function notSendMessagesCampaign(_0x3d9c50){if(_0x3d9c50['sendMessageOneNotActive']){if(_0x3d9c50[_0xcd92('0x77')]===0x0){_0x3d9c50[_0xcd92('0xa5')]=![];_0x3d9c50[_0xcd92('0x45')]=_0xcd92('0x49');loggerSyncQueueSummary[_0xcd92('0x9b')](_0xcd92('0xab'),_0x3d9c50['name'],'is\x20not\x20active');}else{_0x3d9c50[_0xcd92('0x45')]=_0xcd92('0xaa');loggerSyncQueueSummary[_0xcd92('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3d9c50[_0xcd92('0x47')],'is\x20disactive');}emitCampaignSummary(_0x3d9c50);}}function createObjHistory(_0x119cee,_0x50347b,_0x6a27b,_0xefb874,_0x485426){_0x119cee['message']=_0x6a27b;var _0x36994c=new Action(_0x119cee,_0x50347b);var _0x1c9755=new History(_0x36994c);_0x1c9755[_0xcd92('0xac')]=_0xefb874;_0x1c9755[_0xcd92('0xad')]=_0x485426;_0x1c9755[_0xcd92('0xae')]=_0x36994c['starttime'];return _0x1c9755;}Dialer['prototype'][_0xcd92('0x43')]=function(){var _0x1a32c6=this;setInterval(function(){_0x1a32c6[_0xcd92('0xaf')](_0x1a32c6['uniqueId'],_0xcd92('0xb0'));_0x1a32c6['clearZombieChannels'](_0x1a32c6[_0xcd92('0x2a')],'[actions]');},0x32c8);};Dialer[_0xcd92('0x20')]['clearZombieChannels']=function(_0x1ec340,_0x22dfa9){var _0x5308f2=this;for(var _0xc2edd0 in _0x1ec340){if(_0x1ec340[_0xcd92('0xb1')](_0xc2edd0)){this[_0xcd92('0x24')][_0xcd92('0x21')](function(){if(!_[_0xcd92('0xb2')](_0x1ec340[_0xc2edd0])){return ami[_0xcd92('0xb3')]({'action':_0xcd92('0xb4'),'channel':_0x1ec340[_0xc2edd0][_0xcd92('0xb5')]})[_0xcd92('0xb6')](function(_0x1f84f2){if(_0x1f84f2[_0xcd92('0x45')]===_0xcd92('0xb7')){setTimeout(function(){if(_0x1ec340[_0xc2edd0]&&_0x1ec340[_0xc2edd0]['type']!==_0xcd92('0x80')){_0x5308f2[_0xcd92('0xb8')](_0x5308f2[_0xcd92('0x26')][_0x1ec340[_0xc2edd0][_0xcd92('0xb9')]]);logger[_0xcd92('0x9b')](_0xcd92('0xba'),_0x22dfa9,_0xc2edd0,_0x1ec340[_0xc2edd0][_0xcd92('0xb9')]);delete _0x1ec340[_0xc2edd0];}if(_0x1ec340[_0xc2edd0]&&_0x1ec340[_0xc2edd0][_0xcd92('0x5b')]==='ivr'){_0x5308f2['updateOriginated'](_0x5308f2[_0xcd92('0x27')][_0x1ec340[_0xc2edd0][_0xcd92('0xb9')]]);logger[_0xcd92('0x9b')]('[Dialer][checkChannel][ivr]',_0x22dfa9,_0xc2edd0,_0x1ec340[_0xc2edd0]['queue']);delete _0x1ec340[_0xc2edd0];}},0x2328);}});}});}}};Dialer[_0xcd92('0x20')]['countReScheduled']=function(_0x49434f){return BPromise[_0xcd92('0xbb')]()['then'](cmHopper[_0xcd92('0xbc')](_0x49434f))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xbd')));};Dialer['prototype'][_0xcd92('0xbe')]=function(_0x242d3a){return BPromise[_0xcd92('0xbb')]()['then'](cmHopperBlack[_0xcd92('0xbe')](_0x242d3a))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xbf')));};Dialer[_0xcd92('0x20')]['checkIsBlackListIvr']=function(_0x55ff8f){return BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](cmHopperBlack[_0xcd92('0xc1')](_0x55ff8f))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xc2')));};Dialer[_0xcd92('0x20')][_0xcd92('0xc3')]=function(_0x4a8193){return BPromise[_0xcd92('0xbb')]()['then'](cmHopperHistory['avgHandleTime'](_0x4a8193))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xc4')));};Dialer[_0xcd92('0x20')][_0xcd92('0xc5')]=function(_0x51d6c9){return BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](cmHopper[_0xcd92('0xc5')](_0x51d6c9))[_0xcd92('0xb6')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xcd92('0x20')][_0xcd92('0xc6')]=function(_0x2c601c,_0x1c0127,_0x3b72db){return BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](cmHopper[_0xcd92('0xc6')](_0x2c601c,_0x1c0127,_0x3b72db))[_0xcd92('0xb6')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xcd92('0x20')][_0xcd92('0xc7')]=function(_0x4ace08,_0xaab942,_0x4621d3,_0x4ca59f){return BPromise[_0xcd92('0xbb')]()['then'](cmHopper[_0xcd92('0xc7')](_0x4ace08,_0xaab942,_0x4621d3,_0x4ca59f))['catch'](loggerCatch(_0xcd92('0xc8')));};Dialer[_0xcd92('0x20')][_0xcd92('0xc9')]=function(_0x508bf8,_0x59a94f,_0x440094){return BPromise['resolve']()[_0xcd92('0xc0')](cmHopper[_0xcd92('0xc9')](_0x508bf8,_0x59a94f,_0x440094))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xc8')));};Dialer['prototype'][_0xcd92('0xca')]=function(_0x172b24){return BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](voiceQueueRt['getVoiceQueueRtPauses'](_0x172b24))['catch'](loggerCatch(_0xcd92('0xcb')));};Dialer[_0xcd92('0x20')][_0xcd92('0xcc')]=function(_0x3a473e){return BPromise[_0xcd92('0xbb')]()['then'](cmHopper['moveContactManagedDialer'](_0x3a473e))['catch'](loggerCatch(_0xcd92('0xcd')));};Dialer[_0xcd92('0x20')][_0xcd92('0xce')]=function(_0x4ab16e){return BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](cmHopperHistory[_0xcd92('0xce')](_0x4ab16e))[_0xcd92('0xb6')](loggerCatch('[createHistory]\x20'));};Dialer[_0xcd92('0x20')][_0xcd92('0xb8')]=function(_0x3f9809){if(!_['isUndefined'](_0x3f9809)&&_0x3f9809!==null){if(_0x3f9809[_0xcd92('0xb1')](_0xcd92('0x77'))){if(_0x3f9809[_0xcd92('0x77')]>0x0){_0x3f9809[_0xcd92('0x77')]-=0x1;}else{logger[_0xcd92('0x9b')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x5bee4f,_0x3a2619){var _0x14cc4c=this;return function(_0x3866d2){_0x14cc4c['updateOriginated'](_0x3a2619);logger['error'](_0x5bee4f,util[_0xcd92('0x9d')](_0x3866d2,{'showHidden':![],'depth':null}));};};Dialer[_0xcd92('0x20')][_0xcd92('0xcf')]=function(_0x10d873,_0x59bd97,_0x1a93f3){var _0x253c97={'state':0x19,'statedesc':_0xcd92('0xd0')};this[_0xcd92('0xb8')](_0x59bd97);this['saveInDb'](_[_0xcd92('0x94')](_0x253c97,_[_0xcd92('0xd1')](_0x1a93f3,[_0xcd92('0xd2'),'ListId','UserId',_0xcd92('0xd3'),'CampaignId'])),_0xcd92('0xd4'),_0xcd92('0xd5'));logger[_0xcd92('0x9b')](_0x10d873);};Dialer[_0xcd92('0x20')]['isSuccess']=function(_0xa04f6){return _0xa04f6===_0xcd92('0xd6');};Dialer[_0xcd92('0x20')][_0xcd92('0xd7')]=function(_0x4caae4){return!_['isUndefined'](_0x4caae4)&&_0x4caae4&&!_['isUndefined'](_0x4caae4[_0xcd92('0x47')])&&!_[_0xcd92('0x44')](_0x4caae4[_0xcd92('0x7c')])&&_0x4caae4['active']&&(this[_0xcd92('0x28')][util[_0xcd92('0x7d')](_0xcd92('0xd8'),_0x4caae4[_0xcd92('0x47')])]['status']==='reachable'||this[_0xcd92('0x28')][util['format'](_0xcd92('0xd8'),_0x4caae4[_0xcd92('0x47')])][_0xcd92('0xb4')]===_0xcd92('0xd9'));};Dialer[_0xcd92('0x20')][_0xcd92('0xda')]=function(_0x2153b9,_0x4d0e47,_0x45130c){this[_0xcd92('0xce')](_0x2153b9)[_0xcd92('0xb6')](loggerCatch(_0x4d0e47));this[_0xcd92('0xcc')](_0x2153b9)[_0xcd92('0xb6')](loggerCatch(_0x45130c));};Dialer['prototype'][_0xcd92('0x3e')]=function(_0x13cd22){var _0x3dfb1d=this[_0xcd92('0xdb')][_0x13cd22['uniqueid']];var _0xa2a37a;if(!_[_0xcd92('0xb2')](_0x13cd22)&&!_[_0xcd92('0xb2')](_0x13cd22[_0xcd92('0xdc')])&&!_['isNil'](_0x13cd22[_0xcd92('0xdc')]['amdstatus'])&&_0x13cd22['exten']==='xcally-motion-dialer'&&_0x3dfb1d){if(_0x3dfb1d[_0xcd92('0x5b')]!==_0xcd92('0x80')&&this[_0xcd92('0x26')][_0x3dfb1d['queue']][_0xcd92('0xdd')]&&_0x13cd22[_0xcd92('0xde')]==='HANGUP'){delete this[_0xcd92('0xdb')][_0x13cd22['uniqueid']];this[_0xcd92('0xb8')](this[_0xcd92('0x26')][_0x3dfb1d[_0xcd92('0xb9')]]);this['voiceQueues'][_0x3dfb1d[_0xcd92('0xb9')]][_0xcd92('0x63')]+=0x1;this[_0xcd92('0x26')][_0x3dfb1d['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0xa2a37a=new Hangup(_0x3dfb1d,_0x13cd22);_0xa2a37a[_0xcd92('0xac')]=0x12;_0xa2a37a[_0xcd92('0xad')]='HangupInAMD';_0xa2a37a[_0xcd92('0xdf')]=_0xcd92('0xe0');this[_0xcd92('0xda')](_0xa2a37a,_0xcd92('0xe1'),_0xcd92('0xe2'));}if(_0x3dfb1d[_0xcd92('0x5b')]!==_0xcd92('0x80')&&this[_0xcd92('0x26')][_0x3dfb1d['queue']][_0xcd92('0xdd')]&&_0x13cd22[_0xcd92('0xde')]===_0xcd92('0xe3')){var _0x475f31=this;return new BPromise(function(_0x17f1da,_0x24d937){delete _0x475f31['uniqueId'][_0x13cd22[_0xcd92('0xe4')]];_0x475f31[_0xcd92('0xb8')](_0x475f31['voiceQueues'][_0x3dfb1d[_0xcd92('0xb9')]]);_0x475f31[_0xcd92('0x26')][_0x3dfb1d['queue']][_0xcd92('0x63')]+=0x1;_0x475f31['voiceQueues'][_0x3dfb1d['queue']][_0xcd92('0xe5')]+=0x1;var _0x418366=_0x475f31[_0xcd92('0x26')][_0x3dfb1d[_0xcd92('0xb9')]];var _0x2724e0=new Hangup(_0x3dfb1d,_0x13cd22);_0x2724e0['state']=0x13;_0x2724e0['statedesc']='Machine';_0x2724e0['membername']='AMD';_0x2724e0[_0xcd92('0xe6')]+=0x1;_0x2724e0[_0xcd92('0xe7')]+=0x1;_0x2724e0[_0xcd92('0xe8')]=!![];_0x475f31[_0xcd92('0xce')](_0x2724e0)[_0xcd92('0xb6')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2724e0[_0xcd92('0xe9')]+_0x2724e0['countcongestionretry']+_0x2724e0[_0xcd92('0xea')]+_0x2724e0['countnosuchnumberretry']+_0x2724e0[_0xcd92('0xeb')]+_0x2724e0[_0xcd92('0xec')]+_0x2724e0['countmachineretry']+_0x2724e0[_0xcd92('0xed')]>=_0x418366[_0xcd92('0xee')]){_0x475f31[_0xcd92('0xef')](_0x2724e0,_0x17f1da,_0x24d937,_0xcd92('0xf0'));}else{if(_0x2724e0[_0xcd92('0xe6')]>=_0x418366[_0xcd92('0xf1')]){_0x475f31[_0xcd92('0xf2')](_0x2724e0,_0x17f1da,_0x24d937,_0xcd92('0xf3'));}else{_0x475f31[_0xcd92('0xc5')]({'active':![],'countmachineretry':_0x2724e0[_0xcd92('0xe6')],'scheduledat':moment()['add'](_0x418366['dialMachineRetryFrequency'],_0xcd92('0xf4'))[_0xcd92('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2724e0[_0xcd92('0xd2')],'ListId':_0x2724e0[_0xcd92('0xf5')],'VoiceQueueId':_0x2724e0[_0xcd92('0xd3')]||undefined,'CampaignId':_0x2724e0[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xf7')));_0x17f1da({'reschedule':0x1});}}});}if(_0x3dfb1d[_0xcd92('0x5b')]===_0xcd92('0x80')&&this[_0xcd92('0x27')][_0x3dfb1d['queue']][_0xcd92('0xdd')]&&_0x13cd22['value']===_0xcd92('0xf8')){delete this[_0xcd92('0xdb')][_0x13cd22[_0xcd92('0xe4')]];this['updateOriginated'](this[_0xcd92('0x27')][_0x3dfb1d['queue']]);_0xa2a37a=new Hangup(_0x3dfb1d,_0x13cd22);_0xa2a37a[_0xcd92('0xac')]=0x12;_0xa2a37a['statedesc']=_0xcd92('0xf9');_0xa2a37a[_0xcd92('0xdf')]=_0xcd92('0xe0');this[_0xcd92('0xda')](_0xa2a37a,'[syncHangupInAMDIvr][createHistory]',_0xcd92('0xfa'));}if(_0x3dfb1d[_0xcd92('0x5b')]===_0xcd92('0x80')&&this['campaigns'][_0x3dfb1d[_0xcd92('0xb9')]][_0xcd92('0xdd')]&&_0x13cd22['value']===_0xcd92('0xe3')){var _0x475f31=this;return new BPromise(function(_0x52740e,_0x23396b){delete _0x475f31['uniqueId'][_0x13cd22['uniqueid']];_0x475f31[_0xcd92('0xb8')](_0x475f31[_0xcd92('0x27')][_0x3dfb1d['queue']]);_0x475f31['campaigns'][_0x3dfb1d['queue']][_0xcd92('0x63')]+=0x1;_0x475f31['campaigns'][_0x3dfb1d[_0xcd92('0xb9')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x578b97=_0x475f31[_0xcd92('0x27')][_0x3dfb1d['queue']];var _0x1c36fd=new Hangup(_0x3dfb1d,_0x13cd22);_0x1c36fd[_0xcd92('0xac')]=0x13;_0x1c36fd[_0xcd92('0xad')]='Machine';_0x1c36fd[_0xcd92('0xdf')]='AMD';_0x1c36fd['countmachineretry']+=0x1;_0x1c36fd[_0xcd92('0xe7')]+=0x1;_0x1c36fd['amd']=!![];_0x475f31[_0xcd92('0xce')](_0x1c36fd)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xfb')));if(_0x1c36fd[_0xcd92('0xe9')]+_0x1c36fd[_0xcd92('0xfc')]+_0x1c36fd[_0xcd92('0xea')]+_0x1c36fd[_0xcd92('0xfd')]+_0x1c36fd['countdropretry']+_0x1c36fd[_0xcd92('0xec')]+_0x1c36fd[_0xcd92('0xe6')]+_0x1c36fd[_0xcd92('0xed')]>=_0x578b97[_0xcd92('0xee')]){_0x475f31[_0xcd92('0xef')](_0x1c36fd,_0x52740e,_0x23396b,_0xcd92('0xf0'));}else{if(_0x1c36fd[_0xcd92('0xe6')]>=_0x578b97[_0xcd92('0xf1')]){_0x475f31[_0xcd92('0xf2')](_0x1c36fd,_0x52740e,_0x23396b,_0xcd92('0xf3'));}else{_0x475f31[_0xcd92('0xc5')]({'active':![],'countmachineretry':_0x1c36fd['countmachineretry'],'scheduledat':moment()[_0xcd92('0xfe')](_0x578b97[_0xcd92('0xff')],_0xcd92('0xf4'))['format'](_0xcd92('0x100')),'ContactId':_0x1c36fd[_0xcd92('0xd2')],'ListId':_0x1c36fd[_0xcd92('0xf5')],'VoiceQueueId':_0x1c36fd['VoiceQueueId']||undefined,'CampaignId':_0x1c36fd[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xf7')));_0x52740e({'reschedule':0x1});}}});}}};Dialer[_0xcd92('0x20')]['syncHangup']=function(_0x395aa7){var _0x254a1c=this['uniqueId'][_0x395aa7[_0xcd92('0xe4')]];var _0x5e328d=this;var _0x3cb18b;if(_0x254a1c&&_0x254a1c['type']==='ivr'){delete this[_0xcd92('0xdb')][_0x395aa7[_0xcd92('0xe4')]];this[_0xcd92('0xb8')](this[_0xcd92('0x27')][_0x254a1c[_0xcd92('0xb9')]]);this[_0xcd92('0x27')][_0x254a1c[_0xcd92('0xb9')]][_0xcd92('0x101')]+=0x1;_0x3cb18b=new Hangup(_0x254a1c,_0x395aa7);this[_0xcd92('0xce')](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xcd92('0xcc')](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x102')));}if(_0x254a1c&&_0x254a1c[_0xcd92('0x5b')]!==_0xcd92('0x80')&&isNotNull(this[_0xcd92('0x26')][_0x254a1c[_0xcd92('0xb9')]][_0xcd92('0x103')])){delete this[_0xcd92('0xdb')][_0x395aa7['uniqueid']];this['updateOriginated'](this[_0xcd92('0x26')][_0x254a1c[_0xcd92('0xb9')]]);this['voiceQueues'][_0x254a1c['queue']][_0xcd92('0x63')]+=0x1;this[_0xcd92('0x26')][_0x254a1c[_0xcd92('0xb9')]][_0xcd92('0xe5')]+=0x1;_0x3cb18b=new Hangup(_0x254a1c,_0x395aa7);_0x3cb18b[_0xcd92('0xac')]=0x10;_0x3cb18b[_0xcd92('0xad')]='AnswerAGI';_0x3cb18b[_0xcd92('0xdf')]='AGI';this['createHistory'](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x104')));this[_0xcd92('0xcc')](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x102')));}if(_0x254a1c&&_0x254a1c['type']!=='ivr'&&!isNotNull(this[_0xcd92('0x26')][_0x254a1c[_0xcd92('0xb9')]]['dialQueueProject'])){delete this['uniqueId'][_0x395aa7['uniqueid']];this[_0xcd92('0xb8')](this[_0xcd92('0x26')][_0x254a1c['queue']]);this['voiceQueues'][_0x254a1c[_0xcd92('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x3cb18b=new Hangup(_0x254a1c,_0x395aa7);_0x3cb18b['state']=0xc;_0x3cb18b['statedesc']=_0x395aa7['cause-txt'];_0x3cb18b[_0xcd92('0xdf')]=_0xcd92('0x105');this['createHistory'](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xcd92('0xcc')](_0x3cb18b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x102')));}};Dialer[_0xcd92('0x20')][_0xcd92('0x38')]=function(_0x4e6799){var _0x4c56a3=this[_0xcd92('0xdb')][_0x4e6799[_0xcd92('0xe4')]];var _0x1fd041=this;if(this[_0xcd92('0x26')][_0x4e6799[_0xcd92('0xb9')]]){if(_0x4c56a3&&_0x4c56a3['type']!==_0xcd92('0x80')){delete this[_0xcd92('0xdb')][_0x4e6799[_0xcd92('0xe4')]];this[_0xcd92('0x26')][_0x4e6799[_0xcd92('0xb9')]]['outboundAnswerCallsDay']+=0x1;var _0x869918=new AgentComplete(_0x4c56a3,_0x4e6799);if(_0x4e6799[_0xcd92('0x106')]===_0xcd92('0x107')){_0x869918[_0xcd92('0x108')]=this[_0xcd92('0x26')][_0x4e6799[_0xcd92('0xb9')]][_0xcd92('0x109')]&&this[_0xcd92('0x26')][_0x4e6799[_0xcd92('0xb9')]]['dialAgiAfterHangupAgent']?moment()[_0xcd92('0x7d')](_0xcd92('0x100')):undefined;}this[_0xcd92('0xce')](_0x869918)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x10a')));this['moveContactManagedDialer'](_0x869918)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x10b')));}}};Dialer['prototype'][_0xcd92('0x31')]=function(_0x3d99bb){if(this[_0xcd92('0x26')][_0x3d99bb['queue']]){if(this[_0xcd92('0xdb')][_0x3d99bb[_0xcd92('0xe4')]]&&this[_0xcd92('0xdb')][_0x3d99bb[_0xcd92('0xe4')]][_0xcd92('0x5b')]!=='ivr'){this[_0xcd92('0xb8')](this[_0xcd92('0x26')][_0x3d99bb[_0xcd92('0xb9')]]);this[_0xcd92('0xdb')][_0x3d99bb['uniqueid']]['answertime']=moment()['format'](_0xcd92('0x100'));}}};Dialer[_0xcd92('0x20')]['queueCallerAbandonCreateState']=function(_0x181c94){this['createHistory'](_0x181c94)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x10a')));this[_0xcd92('0xcc')](_0x181c94)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x10c')));};Dialer[_0xcd92('0x20')]['syncQueueCallerAbandon']=function(_0x46102b){var _0x2a1948=this['uniqueId'][_0x46102b[_0xcd92('0xe4')]];var _0x335804=this;if(this[_0xcd92('0x26')][_0x46102b['queue']]){if(_0x2a1948&&_0x2a1948[_0xcd92('0x5b')]!=='ivr'){delete this[_0xcd92('0xdb')][_0x46102b[_0xcd92('0xe4')]];this['updateOriginated'](this[_0xcd92('0x26')][_0x46102b['queue']]);_0x2a1948['droptime']=moment()[_0xcd92('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1fbcd4=new QueueCallerAbandon(_0x2a1948,_0x46102b);if(getSeconds(_0x2a1948['droptime'],_0x2a1948[_0xcd92('0x10d')])>=_0x2a1948[_0xcd92('0x10e')]){this['voiceQueues'][_0x46102b[_0xcd92('0xb9')]][_0xcd92('0x71')]+=0x1;this[_0xcd92('0x26')][_0x46102b[_0xcd92('0xb9')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xcd92('0x26')][_0x46102b[_0xcd92('0xb9')]][_0xcd92('0x10f')]+=0x1;_0x1fbcd4[_0xcd92('0xac')]=0xa;_0x1fbcd4[_0xcd92('0xad')]=_0xcd92('0x110');_0x1fbcd4[_0xcd92('0x111')]=_0xcd92('0x112');_0x1fbcd4[_0xcd92('0x108')]=this['voiceQueues'][_0x46102b[_0xcd92('0xb9')]]['dialQueueProject2']?moment()[_0xcd92('0x7d')](_0xcd92('0x100')):undefined;_0x1fbcd4[_0xcd92('0xeb')]+=0x1;_0x1fbcd4[_0xcd92('0xe7')]+=0x1;if(_0x1fbcd4[_0xcd92('0xeb')]>=this[_0xcd92('0x26')][_0x46102b[_0xcd92('0xb9')]][_0xcd92('0x113')]){this[_0xcd92('0x114')](_0x1fbcd4);}else{this[_0xcd92('0xc5')]({'active':![],'countdropretry':_0x1fbcd4['countdropretry'],'scheduledat':moment()[_0xcd92('0xfe')](this['voiceQueues'][_0x46102b['queue']][_0xcd92('0x115')],'minutes')['format'](_0xcd92('0x100')),'ContactId':_0x2a1948['ContactId'],'ListId':_0x2a1948['ListId'],'VoiceQueueId':_0x2a1948[_0xcd92('0xd3')]||undefined,'CampaignId':_0x2a1948[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x116')));var _0x255017=new History(_0x1fbcd4);_0x255017[_0xcd92('0xac')]=0xa;_0x255017[_0xcd92('0xad')]='Drop';_0x255017[_0xcd92('0x117')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x255017['endtime']=_0x255017[_0xcd92('0x117')];_0x255017[_0xcd92('0x118')]=_0x1fbcd4[_0xcd92('0x118')];_0x255017[_0xcd92('0x119')]=_0x1fbcd4[_0xcd92('0x119')];this[_0xcd92('0xce')](_0x255017)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x11a')));}}else{this[_0xcd92('0x26')][_0x46102b['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xcd92('0x26')][_0x46102b['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x1fbcd4[_0xcd92('0xac')]=0xb;_0x1fbcd4[_0xcd92('0xad')]=_0xcd92('0x11b');_0x1fbcd4[_0xcd92('0x111')]=_0xcd92('0x11c');_0x1fbcd4[_0xcd92('0xec')]+=0x1;_0x1fbcd4[_0xcd92('0xe7')]+=0x1;if(_0x1fbcd4[_0xcd92('0xec')]>=this[_0xcd92('0x26')][_0x46102b['queue']][_0xcd92('0x11d')]){this[_0xcd92('0x114')](_0x1fbcd4);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x1fbcd4['countabandonedretry'],'scheduledat':moment()[_0xcd92('0xfe')](this[_0xcd92('0x26')][_0x46102b[_0xcd92('0xb9')]][_0xcd92('0x11e')],_0xcd92('0xf4'))['format'](_0xcd92('0x100')),'ContactId':_0x2a1948[_0xcd92('0xd2')],'ListId':_0x2a1948[_0xcd92('0xf5')],'VoiceQueueId':_0x2a1948[_0xcd92('0xd3')]||undefined,'CampaignId':_0x2a1948[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x11f')));var _0x255017=new History(_0x1fbcd4);_0x255017[_0xcd92('0xac')]=0xb;_0x255017[_0xcd92('0xad')]='Abandoned';_0x255017[_0xcd92('0x117')]=moment()['format'](_0xcd92('0x100'));_0x255017['endtime']=_0x255017[_0xcd92('0x117')];_0x255017['calleridname']=_0x1fbcd4[_0xcd92('0x118')];_0x255017[_0xcd92('0x119')]=_0x1fbcd4[_0xcd92('0x119')];this[_0xcd92('0xce')](_0x255017)['catch'](loggerCatch(_0xcd92('0x120')));}}}}};Dialer['prototype'][_0xcd92('0x3c')]=function(_0x534fef){if(this[_0xcd92('0x2a')][_0x534fef[_0xcd92('0xe4')]]){this[_0xcd92('0x2a')][_0x534fef[_0xcd92('0xe4')]][_0xcd92('0xb5')]=_0x534fef[_0xcd92('0xb5')];}if(this[_0xcd92('0xdb')][_0x534fef[_0xcd92('0xe4')]]){this['uniqueId'][_0x534fef['uniqueid']]['channel']=_0x534fef['channel'];}};Dialer[_0xcd92('0x20')][_0xcd92('0x40')]=function(_0x2f89b2){if(strategy[this[_0xcd92('0x26')][this['actions'][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0xb9')]][_0xcd92('0x122')]]==='roundrobin'){if(this[_0xcd92('0x2a')][_0x2f89b2['actionid']]&&_[_0xcd92('0xb2')](this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0x123')])&&_0x2f89b2[_0xcd92('0xb4')]==='1'&&_0x2f89b2[_0xcd92('0x124')]==='0'){if(this[_0xcd92('0x125')][_0x2f89b2[_0xcd92('0x126')]]){if(!this[_0xcd92('0x125')][_0x2f89b2[_0xcd92('0x126')]]['locked']){this[_0xcd92('0x125')][_0x2f89b2['stateinterface']][_0xcd92('0x123')]=!![];this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0x123')]=!![];this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0x126')]=_0x2f89b2[_0xcd92('0x126')];}}}}else if((strategy[this[_0xcd92('0x26')][this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0xb9')]]['strategy']]||_0xcd92('0x127'))===_0xcd92('0x127')){if(this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]]){if(this[_0xcd92('0x125')][_0x2f89b2[_0xcd92('0x126')]]){this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0x126')]=_0x2f89b2['stateinterface'];if(_[_0xcd92('0xb2')](this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0xb9')]])){this[_0xcd92('0x128')][this['actions'][_0x2f89b2[_0xcd92('0x121')]][_0xcd92('0xb9')]]=[];}this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]]['queue']]['push'](_[_0xcd92('0x94')](_['pick'](this[_0xcd92('0x2a')][_0x2f89b2[_0xcd92('0x121')]],['idHopper',_0xcd92('0x126')]),{'status':_0x2f89b2['status'],'paused':_0x2f89b2[_0xcd92('0x124')]}));}}}};function unlockQueueStatus(_0x2a0134,_0x2f2fe6){setTimeout(function(){if(_['isUndefined'](_0x2a0134[_0xcd92('0x129')])){loggerBooked['error'](_0xcd92('0x12a'),_0x2f2fe6);}_0x2a0134[_0xcd92('0x129')]=!![];loggerBooked[_0xcd92('0x83')]('[booked][unlockQueueStatus]',_0x2f2fe6,JSON['stringify'](_[_0xcd92('0xd1')](_0x2a0134,[_0xcd92('0x47'),_0xcd92('0x129')])));},0x1f3);}Dialer[_0xcd92('0x20')][_0xcd92('0x12b')]=function(_0x13bb9e){var _0x6d4b23=this;var _0x204745=_0x6d4b23[_0xcd92('0x26')][_0x6d4b23[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]];if(strategy[this[_0xcd92('0x26')][this[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]]['strategy']]===_0xcd92('0x1f')){if(this['actions'][_0x13bb9e[_0xcd92('0x121')]]&&this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0x126')]){this['preview'][_0xcd92('0x12c')](this['actions'][_0x13bb9e['actionid']][_0xcd92('0x12d')],this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]]['stateinterface'])[_0xcd92('0xb6')](function(_0x1feb7d){logger[_0xcd92('0x9b')](_0xcd92('0x12e'),util[_0xcd92('0x9d')](_0x1feb7d,{'showHidden':![],'depth':null}));})['finally'](function(){_0x6d4b23['updateOriginated'](_0x6d4b23[_0xcd92('0x26')][_0x6d4b23[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]]);_0x6d4b23[_0xcd92('0x125')][_0x6d4b23[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0x126')]][_0xcd92('0x123')]=![];delete _0x6d4b23[_0xcd92('0x2a')][_0x13bb9e['actionid']];unlockQueueStatus(_0x204745);});}else{this['updateOriginated'](this[_0xcd92('0x26')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]]);this[_0xcd92('0xc5')]({'active':![],'ContactId':this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xd2')],'ListId':this['actions'][_0x13bb9e['actionid']][_0xcd92('0xf5')],'VoiceQueueId':this[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xd3')]||undefined,'CampaignId':this[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xf6')]||undefined})['catch'](loggerCatch(_0xcd92('0x12f')));delete this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]];unlockQueueStatus(_0x204745);}}else if((strategy[this['voiceQueues'][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]]['strategy']]||_0xcd92('0x127'))==='rrmemory'){var _0x689d05;if(this[_0xcd92('0x2a')][_0x13bb9e['actionid']]&&!_[_0xcd92('0x4f')](this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]]['queue']])){if(this[_0xcd92('0x2f')][_0x6d4b23[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]]){this[_0xcd92('0x2f')][_0x6d4b23[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]]['queue']]=this[_0xcd92('0x2f')][this[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]]?this[_0xcd92('0x2f')][this[_0xcd92('0x2a')][_0x13bb9e['actionid']][_0xcd92('0xb9')]]:this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]]?this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]][_0xcd92('0x130')]||0x0:0x0;}this[_0xcd92('0x128')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]][_0xcd92('0x130')]=this[_0xcd92('0x2f')][this[_0xcd92('0x2a')][_0x13bb9e[_0xcd92('0x121')]][_0xcd92('0xb9')]];for(var _0xbc75c0=0x0;_0xbc75c0=0x0?!![]:![];})[_0xcd92('0xb6')](myreject(_0x678f0e)));}}else{_0x153546[_0xcd92('0x146')](ami[_0xcd92('0xb3')]({'action':_0xcd92('0x147'),'command':util[_0xcd92('0x7d')](_0xcd92('0x14b'),_0x218faa,!_[_0xcd92('0x44')](config[_0xcd92('0x142')][_0xe838f9])?_0xe838f9:'')})[_0xcd92('0xc0')](function(_0xe0d526){return _0xe0d526[_0xcd92('0x14c')][_0xcd92('0x149')](_0xcd92('0x14a'))>=0x0?!![]:![];})[_0xcd92('0xb6')](myreject(_0x678f0e)));}BPromise[_0xcd92('0x14d')](_0x153546)[_0xcd92('0xc0')](function(_0x58c6df){var _0x2645e4=_[_0xcd92('0x14e')](_0x58c6df);if(_0x2645e4){return _0x4f0842(_0x2645e4);}else{_0x586327[_0xcd92('0x45')]=_0x43b74d?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x678f0e(msgResponse(_0xcd92('0x14f'),_0xcd92('0x140'),_0xcd92('0x150')+_0x43b74d+'\x20'+_0x2886b0+_0xcd92('0x151')+util[_0xcd92('0x9d')](_0x218faa,{'showHidden':![],'depth':null})+_0xcd92('0x152')+_0xe838f9));}})[_0xcd92('0xb6')](function(_0x235d22){return _0x678f0e(msgResponse(_0xcd92('0x13c'),_0xcd92('0x140'),JSON[_0xcd92('0x132')](_0x235d22)));});});};Dialer[_0xcd92('0x20')]['checkDialMethod']=function(_0x1873dc){var _0xd59b30=this;return function(){switch(_0x1873dc[_0xcd92('0x60')]){case'progressive':freeVariablesPredictive(_0x1873dc);_0xd59b30[_0xcd92('0x153')](_0x1873dc,0x1);break;case _0xcd92('0x154'):freeVariablesPredictive(_0x1873dc);_0xd59b30[_0xcd92('0x153')](_0x1873dc,_0x1873dc['dialPowerLevel']);break;case _0xcd92('0xa'):_0xd59b30['predictive'](_0x1873dc);break;case _0xcd92('0x9'):freeVariablesPredictive(_0x1873dc);_0xd59b30[_0xcd92('0x153')](_0x1873dc,0x1);break;default:freeVariablesPredictive(_0x1873dc);logger['error']('Queue',_0x1873dc[_0xcd92('0x47')],_0xcd92('0x155'));}};};Dialer['prototype'][_0xcd92('0x156')]=function(_0x41d0b8){var _0x3e9ab0=this;return function(){_0x3e9ab0[_0xcd92('0x157')](_0x41d0b8);};};Dialer[_0xcd92('0x20')][_0xcd92('0xc')]=function(_0x3ea581){var _0x1647a8=this;if(isNotPreview(_0x3ea581[_0xcd92('0x60')])){if(isVoiceQueueOutbound(_0x3ea581[_0xcd92('0x5b')])&&isActive(_0x3ea581[_0xcd92('0x5f')])){_0x3ea581[_0xcd92('0xa5')]=!![];BPromise[_0xcd92('0xbb')]()[_0xcd92('0xc0')](checkIsLoggedIn(_0x3ea581,_0x3ea581[_0xcd92('0x56')]))[_0xcd92('0xc0')](checkIsActive(_0x3ea581,_0x3ea581['dialActive']))[_0xcd92('0xc0')](checkInterval(_0x3ea581))[_0xcd92('0xc0')](_0x1647a8['checkIsTrunkReachable'](_0x3ea581))[_0xcd92('0xc0')](_0x1647a8[_0xcd92('0x13b')](_0x3ea581[_0xcd92('0x158')],_0x3ea581[_0xcd92('0x159')],_0x3ea581[_0xcd92('0x47')],_0x3ea581))[_0xcd92('0xc0')](_0x1647a8[_0xcd92('0x13d')](_0x3ea581[_0xcd92('0x4d')],_0x3ea581['dialTimezone'],_0x3ea581[_0xcd92('0x47')],_0x3ea581))[_0xcd92('0xc0')](_0x1647a8[_0xcd92('0x15a')](_0x3ea581))[_0xcd92('0xb6')](loggerCatchQueueSummary('[syncQueueSummary]',_0x3ea581));}else{notSendMessagesQueue(_0x3ea581);}}else{freeVariablesPredictive(_0x3ea581);}};Dialer[_0xcd92('0x20')]['syncCampaigns']=function(){var _0x4e2893=this;var _0x804460;for(var _0x57dad4 in this[_0xcd92('0x27')]){if(this[_0xcd92('0x27')][_0xcd92('0xb1')](_0x57dad4)){_0x804460=this[_0xcd92('0x27')][_0x57dad4];if(isCampaignIvr(_0x804460[_0xcd92('0x5b')])&&isActive(_0x804460['active'])){_0x804460[_0xcd92('0xa5')]=!![];BPromise['resolve']()['then'](checkIsActive(_0x804460,_0x804460[_0xcd92('0x7c')]))[_0xcd92('0xc0')](checkInterval(_0x804460))[_0xcd92('0xc0')](_0x4e2893[_0xcd92('0x138')](_0x804460))['then'](_0x4e2893[_0xcd92('0x13b')](_0x804460[_0xcd92('0x158')],_0x804460[_0xcd92('0x159')],_0x804460['name'],_0x804460))[_0xcd92('0xc0')](_0x4e2893['checkIfTimeIntervals'](_0x804460[_0xcd92('0x4d')],_0x804460[_0xcd92('0x159')],_0x804460['name'],_0x804460))[_0xcd92('0xc0')](_0x4e2893[_0xcd92('0x156')](_0x804460))[_0xcd92('0xb6')](loggerCatchQueueSummary(_0xcd92('0x15b'),_0x804460));}else{notSendMessagesCampaign(_0x804460);}}}};function getCallerIdRandom(_0x400d52,_0x3e7895){var _0x4e16e7,_0x59bed8,_0x50cf33;if(_0x3e7895<=0x0){_0x3e7895=0x1;}_0x4e16e7=new RegExp(_0xcd92('0x15c')+_0x3e7895+'}$');_0x59bed8=Math[_0xcd92('0x15d')](0xa,_0x3e7895-0x1);_0x50cf33=Math[_0xcd92('0x15d')](0xa,_0x3e7895)-0x1;return util[_0xcd92('0x7d')]('%s',_[_0xcd92('0x15e')](_0x400d52,_0x4e16e7,_[_0xcd92('0x15f')](_0x59bed8,_0x50cf33)));}function extractCalleridName(_0x315220){var _0x1cb266=_0x315220['match'](/"(.*?)"/);return _0x1cb266?_0x1cb266[0x1]:_0x315220;}function extractCalleridNumber(_0x385438){var _0x1cb052=_0x385438[_0xcd92('0x160')](/<(.*?)>/);return _0x1cb052?_0x1cb052[0x1]:_0x385438;}Dialer[_0xcd92('0x20')][_0xcd92('0x161')]=function(_0x540201,_0x737661){var _0x1241ef=this;var _0x39800c=uuid['v4']();this[_0xcd92('0x2a')][_0x39800c]=new Action(_0x540201,_0x737661,_0x39800c);return new BPromise(function(_0x1284a8,_0x18a44a){if(_['isUndefined'](_0x540201)&&_0xcd92('0x162')!==typeof _0x540201){return _0x18a44a(msgResponse('originate','Failure',_0xcd92('0x163')));}if(_[_0xcd92('0x44')](_0x737661[_0xcd92('0x164')][_0xcd92('0x165')])||_0x737661['Contact'][_0xcd92('0x165')]===null){return _0x18a44a(msgResponse(_0xcd92('0x166'),_0xcd92('0x140'),_0xcd92('0x167')));}var _0x3b4a6e={'XMD-CALLERID':_0x1241ef[_0xcd92('0x2a')][_0x39800c][_0xcd92('0x168')](),'XMD-AGI':_0x540201[_0xcd92('0x103')]?util['format'](_0xcd92('0x169'),ipAgi,_0x540201[_0xcd92('0x103')]):_0xcd92('0x16a'),'XMD-AGIAFTER':_0x540201[_0xcd92('0x109')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x540201[_0xcd92('0x109')]):'NONE','XMD-QUEUE':_0x540201[_0xcd92('0x5b')]===_0xcd92('0x53')?util['format'](_0xcd92('0x16b'),_0x540201['name'],_0x540201['dialQueueOptions']||'',_0x540201[_0xcd92('0x16c')]?'c':'',_0x540201[_0xcd92('0x10e')]||0x3):_0xcd92('0x16a'),'XMD-CONTACTID':_0x737661['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1241ef[_0xcd92('0x2a')][_0x39800c][_0xcd92('0x168')](),'XMD-AMD':_0x540201[_0xcd92('0xdd')]?_0xcd92('0x16d'):_0xcd92('0x16a'),'XMD-DESTINATION':_0xcd92('0x16e')};if(_0x540201[_0xcd92('0xdd')]){_0x3b4a6e['XMD-AMDINITIALSILENCE']=_0x540201[_0xcd92('0x16f')]||0x9c4;_0x3b4a6e['XMD-AMDGREETING']=_0x540201['dialAMDGreeting']||0x5dc;_0x3b4a6e[_0xcd92('0x170')]=_0x540201[_0xcd92('0x171')]||0x320;_0x3b4a6e[_0xcd92('0x172')]=_0x540201[_0xcd92('0x173')]||0x1388;_0x3b4a6e[_0xcd92('0x174')]=_0x540201[_0xcd92('0x175')]||0x64;_0x3b4a6e[_0xcd92('0x176')]=_0x540201[_0xcd92('0x177')]||0x32;_0x3b4a6e['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x540201[_0xcd92('0x178')]||0x3;_0x3b4a6e[_0xcd92('0x179')]=_0x540201[_0xcd92('0x17a')]||0x100;_0x3b4a6e[_0xcd92('0x17b')]=_0x540201[_0xcd92('0x17c')]||0x1388;}if(_0x540201['type']==='outbound'){_0x3b4a6e[_0xcd92('0x17d')]=_0x737661[_0xcd92('0xd3')];}else{_0x3b4a6e[_0xcd92('0x17e')]=_0x737661['CampaignId'];}for(var _0x460f8a in _0x737661[_0xcd92('0x164')]){if(_0x737661[_0xcd92('0x164')][_0xcd92('0xb1')](_0x460f8a)){if(isNotNull(_0x737661[_0xcd92('0x164')][_0x460f8a])&&_0x460f8a!=='id'&&_0x460f8a!==_0xcd92('0x17f')&&_0x460f8a!==_0xcd92('0x180')&&_0x460f8a!==_0xcd92('0x181')){_0x3b4a6e[util[_0xcd92('0x7d')](_0xcd92('0x182'),'XMD-',_[_0xcd92('0x183')](_0x460f8a))]=_0x737661['Contact'][_0x460f8a];}}}var _0x252aa6=_0x1241ef[_0xcd92('0xd7')](_0x540201[_0xcd92('0x7b')])?getCallerId(_0x540201[_0xcd92('0x7b')][_0xcd92('0x184')],_0x540201[_0xcd92('0x185')],_0x540201[_0xcd92('0x186')]>0x0?getCallerIdRandom(_0x540201[_0xcd92('0x187')],_0x540201[_0xcd92('0x186')]):_0x540201[_0xcd92('0x187')]):getCallerId(_[_0xcd92('0xb2')](_0x540201[_0xcd92('0x188')])?_0x540201[_0xcd92('0x7b')][_0xcd92('0x184')]:_0x540201[_0xcd92('0x188')][_0xcd92('0x184')],_0x540201[_0xcd92('0x185')],_0x540201[_0xcd92('0x186')]>0x0?getCallerIdRandom(_0x540201[_0xcd92('0x187')],_0x540201[_0xcd92('0x186')]):_0x540201['dialOriginateCallerIdNumber']);if(_0x252aa6){_0x3b4a6e[_0xcd92('0x189')]=_0x1241ef[_0xcd92('0x2a')][_0x39800c]['originatecalleridname']=extractCalleridName(_0x252aa6);_0x3b4a6e[_0xcd92('0x18a')]=_0x1241ef['actions'][_0x39800c]['originatecalleridnum']=extractCalleridNumber(_0x252aa6);}return ami[_0xcd92('0xb3')]({'actionid':_0x39800c,'action':'originate','channel':_0x1241ef['isTrunkReachable'](_0x540201[_0xcd92('0x7b')])?util[_0xcd92('0x7d')]('SIP/%s/%s%s',_0x540201[_0xcd92('0x7b')][_0xcd92('0x47')],isNotNull(_0x540201[_0xcd92('0x62')])?_0x540201[_0xcd92('0x62')][_0xcd92('0x18b')]()||'':'',_0x540201[_0xcd92('0x18c')]>0x0?_0x737661[_0xcd92('0x164')]['phone'][_0xcd92('0x18d')](_0x540201[_0xcd92('0x18c')]):_0x737661[_0xcd92('0x164')][_0xcd92('0x165')]):util[_0xcd92('0x7d')](_0xcd92('0x18e'),_['isNil'](_0x540201[_0xcd92('0x188')])?_0x540201[_0xcd92('0x7b')][_0xcd92('0x47')]:_0x540201[_0xcd92('0x188')][_0xcd92('0x47')],isNotNull(_0x540201[_0xcd92('0x62')])?_0x540201[_0xcd92('0x62')][_0xcd92('0x18b')]()||'':'',_0x540201[_0xcd92('0x18c')]>0x0?_0x737661[_0xcd92('0x164')][_0xcd92('0x165')][_0xcd92('0x18d')](_0x540201['dialCutDigit']):_0x737661[_0xcd92('0x164')][_0xcd92('0x165')]),'callerid':_0x252aa6,'Exten':_0xcd92('0x16e'),'Context':_0xcd92('0x18f'),'Priority':'1','variable':_0x3b4a6e,'timeout':(_0x540201[_0xcd92('0x61')]||0x1e)*0x3e8,'async':!![],'channelid':_0x39800c})[_0xcd92('0xc0')](function(_0x1b8276){return _0x1284a8(_0x1b8276);})['catch'](function(_0x4f6600){_0x540201[_0xcd92('0x6b')]+=0x1;var _0xfc954d=new History(_0x1241ef[_0xcd92('0x2a')][_0x39800c]);logger[_0xcd92('0x9b')](util[_0xcd92('0x7d')]('[originateError]:\x20%s',JSON[_0xcd92('0x132')](_0x4f6600)));_0xfc954d[_0xcd92('0xac')]=0xe;_0xfc954d[_0xcd92('0xad')]=_0xcd92('0x190');_0xfc954d[_0xcd92('0x117')]=moment()['format'](_0xcd92('0x100'));_0xfc954d[_0xcd92('0xae')]=_0xfc954d['starttime'];_0x1241ef[_0xcd92('0xce')](_0xfc954d)[_0xcd92('0xb6')](loggerCatch('[originate][error]'));_0x1241ef['moveContactManagedDialer'](_0xfc954d)[_0xcd92('0xb6')](loggerCatch('[originate][error]'))[_0xcd92('0x23')](function(){delete _0x1241ef[_0xcd92('0x2a')][_0x39800c];return _0x18a44a(msgResponse(_0xcd92('0x166'),'Error',_0xcd92('0x191')));});});});};Dialer['prototype'][_0xcd92('0x36')]=function(_0x569e86){var _0x263a1d=this['actions'][_0x569e86[_0xcd92('0x121')]];var _0x486be2=this;if(_0x263a1d){delete this[_0xcd92('0x2a')][_0x569e86[_0xcd92('0x121')]];_0x263a1d[_0xcd92('0x10d')]=moment()[_0xcd92('0x7d')](_0xcd92('0x100'));var _0x3fa35f=_0x263a1d[_0xcd92('0x5b')]===_0xcd92('0x80')?this[_0xcd92('0x27')][_0x263a1d[_0xcd92('0xb9')]]:this['voiceQueues'][_0x263a1d[_0xcd92('0x192')]()];if(!this['isSuccess'](_0x569e86[_0xcd92('0x193')])){this['updateOriginated'](_0x3fa35f);return this['callProgressDetecting'](_0x263a1d,_0x3fa35f,_0x569e86)[_0xcd92('0xc0')](function(_0x222fce){})['catch'](loggerCatch(_0xcd92('0x194')));}else{this[_0xcd92('0xdb')][_0x569e86[_0xcd92('0xe4')]]=_0x263a1d;}}};Dialer[_0xcd92('0x20')]['checkRetriveMax']=function(_0x1d6aed,_0x5d8a8a,_0x306718){var _0x3321ff=new History(_0x5d8a8a);if(_0x3321ff['countbusyretry']+_0x3321ff[_0xcd92('0xfc')]+_0x3321ff[_0xcd92('0xea')]+_0x3321ff[_0xcd92('0xfd')]+_0x3321ff[_0xcd92('0xeb')]+_0x3321ff[_0xcd92('0xec')]+_0x3321ff[_0xcd92('0xe6')]+_0x3321ff[_0xcd92('0xed')]>=_0x306718[_0xcd92('0xee')]-0x1){return!![];}switch(_0x1d6aed){case 0x3:if(_0x3321ff[_0xcd92('0xea')]>=_0x306718[_0xcd92('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3321ff['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718[_0xcd92('0x196')],_0xcd92('0xf4'))['format'](_0xcd92('0x100')),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff['ListId'],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x3321ff['countbusyretry']>=_0x306718['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countbusyretry':_0x3321ff['countbusyretry']+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718['dialBusyRetryFrequency'],_0xcd92('0xf4'))['format'](_0xcd92('0x100')),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff['ListId'],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x197')));}break;case 0x8:if(_0x3321ff[_0xcd92('0xfc')]>=_0x306718[_0xcd92('0x198')]-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countcongestionretry':_0x3321ff['countcongestionretry']+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718[_0xcd92('0x199')],'minutes')[_0xcd92('0x7d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff[_0xcd92('0xf5')],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff['CampaignId']||undefined})['catch'](loggerCatch(_0xcd92('0x19a')));}break;case 0x0:if(_0x3321ff[_0xcd92('0xfd')]>=_0x306718[_0xcd92('0x19b')]-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countnosuchnumberretry':_0x3321ff[_0xcd92('0xfd')]+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718['dialNoSuchNumberRetryFrequency'],_0xcd92('0xf4'))[_0xcd92('0x7d')](_0xcd92('0x100')),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff['ListId'],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff['CampaignId']||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x19c')));}break;case 0xa:if(_0x3321ff[_0xcd92('0xeb')]>=_0x306718[_0xcd92('0x113')]-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countdropretry':_0x3321ff[_0xcd92('0xeb')]+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718['dialDropRetryFrequency'],'minutes')[_0xcd92('0x7d')](_0xcd92('0x100')),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff[_0xcd92('0xf5')],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x116')));}break;case 0xb:if(_0x3321ff[_0xcd92('0xec')]>=_0x306718['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countabandonedretry':_0x3321ff[_0xcd92('0xec')]+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718[_0xcd92('0x11e')],_0xcd92('0xf4'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3321ff['ContactId'],'ListId':_0x3321ff[_0xcd92('0xf5')],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff[_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x11f')));}break;case 0x13:if(_0x3321ff['countmachineretry']>=_0x306718[_0xcd92('0xf1')]-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countmachineretry':_0x3321ff[_0xcd92('0xe6')]+=0x1,'scheduledat':moment()['add'](_0x306718[_0xcd92('0xff')],'minutes')[_0xcd92('0x7d')](_0xcd92('0x100')),'ContactId':_0x3321ff['ContactId'],'ListId':_0x3321ff[_0xcd92('0xf5')],'VoiceQueueId':_0x3321ff[_0xcd92('0xd3')]||undefined,'CampaignId':_0x3321ff['CampaignId']||undefined})[_0xcd92('0xb6')](loggerCatch(_0xcd92('0xf7')));}break;case 0x14:if(_0x3321ff[_0xcd92('0xed')]>=_0x306718[_0xcd92('0x19d')]-0x1){return!![];}else{this[_0xcd92('0xc5')]({'active':![],'countagentrejectretry':_0x3321ff[_0xcd92('0xed')]+=0x1,'scheduledat':moment()[_0xcd92('0xfe')](_0x306718[_0xcd92('0x19e')],_0xcd92('0xf4'))[_0xcd92('0x7d')](_0xcd92('0x100')),'ContactId':_0x3321ff[_0xcd92('0xd2')],'ListId':_0x3321ff[_0xcd92('0xf5')],'VoiceQueueId':_0x3321ff['VoiceQueueId']||undefined,'CampaignId':_0x3321ff['CampaignId']||undefined})[_0xcd92('0xb6')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0xcd92('0x20')]['callProgressDetecting']=function(_0x1987a6,_0x3b9206,_0x4ea3cd){var _0x376fee=this;var _0x143c1b=new History(_0x1987a6);return new BPromise(function(_0x39c01e,_0x3a0e5b){if(_['isUndefined'](_0x3b9206)&&_0xcd92('0x162')!==typeof _0x3b9206){return _0x3a0e5b(msgResponse('[callProgressDetecting]','Failure',_0xcd92('0x19f')));}if(_[_0xcd92('0x44')](_0x4ea3cd)&&_0xcd92('0x162')!==typeof _0x4ea3cd){return _0x3a0e5b(msgResponse(_0xcd92('0x1a0'),'Failure',_0xcd92('0x1a1')));}switch(_0x4ea3cd['reason']){case'0':_0x3b9206[_0xcd92('0x6a')]+=0x1;_0x143c1b[_0xcd92('0xac')]=0x0;_0x143c1b[_0xcd92('0xad')]=_0xcd92('0x1a2');_0x143c1b[_0xcd92('0xfd')]+=0x1;_0x143c1b[_0xcd92('0xe7')]+=0x1;ami[_0xcd92('0x1a3')](_0xcd92('0x1a4'),ut['buildObj'](_0x1987a6,_0xcd92('0x1a5')));_0x376fee[_0xcd92('0xce')](_0x143c1b)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x376fee['checkRetriveMax'](0x0,_0x1987a6,_0x3b9206)){if(_0x143c1b[_0xcd92('0xfd')]>=_0x3b9206['dialNoSuchNumberMaxRetry']){_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1a6'));}else{_0x376fee['stateGlobal'](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1a6'));}}break;case'3':_0x3b9206[_0xcd92('0x69')]+=0x1;_0x143c1b['state']=0x3;_0x143c1b[_0xcd92('0xad')]=_0xcd92('0x1a7');_0x143c1b['countnoanswerretry']+=0x1;_0x143c1b['countglobal']+=0x1;ami[_0xcd92('0x1a3')](_0xcd92('0x1a8'),ut[_0xcd92('0x1a9')](_0x1987a6,_0xcd92('0x1aa')));_0x376fee['createHistory'](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1ab')));if(_0x376fee[_0xcd92('0x1ac')](0x3,_0x1987a6,_0x3b9206)){if(_0x143c1b[_0xcd92('0xea')]>=_0x3b9206[_0xcd92('0x195')]){_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1ad'));}else{_0x376fee[_0xcd92('0xef')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1ad'));}}break;case'5':_0x3b9206['outboundBusyCallsDay']+=0x1;_0x143c1b[_0xcd92('0xac')]=0x5;_0x143c1b[_0xcd92('0xad')]=_0xcd92('0x1ae');_0x143c1b[_0xcd92('0xe9')]+=0x1;_0x143c1b[_0xcd92('0xe7')]+=0x1;ami[_0xcd92('0x1a3')](_0xcd92('0x1af'),ut['buildObj'](_0x1987a6,_0xcd92('0x1b0')));_0x376fee[_0xcd92('0xce')](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1b1')));if(_0x376fee[_0xcd92('0x1ac')](0x5,_0x1987a6,_0x3b9206)){if(_0x143c1b['countbusyretry']>=_0x3b9206['dialBusyMaxRetry']){_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1b2'));}else{_0x376fee[_0xcd92('0xef')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1b2'));}}break;case'8':_0x3b9206[_0xcd92('0x66')]+=0x1;_0x143c1b['state']=0x8;_0x143c1b[_0xcd92('0xad')]=_0xcd92('0x1b3');_0x143c1b[_0xcd92('0xfc')]+=0x1;_0x143c1b[_0xcd92('0xe7')]+=0x1;ami[_0xcd92('0x1a3')](_0xcd92('0x1b4'),ut[_0xcd92('0x1a9')](_0x1987a6,_0xcd92('0x1b5')));_0x376fee[_0xcd92('0xce')](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1b6')));if(_0x376fee[_0xcd92('0x1ac')](0x8,_0x1987a6,_0x3b9206)){if(_0x143c1b[_0xcd92('0xfc')]>=_0x3b9206[_0xcd92('0x198')]){_0x376fee['createStateFinal'](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1b7'));}else{_0x376fee['stateGlobal'](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1b7'));}}break;case'11':_0x3b9206[_0xcd92('0x1b8')]+=0x1;_0x143c1b['state']=0xb;_0x143c1b[_0xcd92('0xad')]='Abandoned';_0x143c1b['countabandonedretry']+=0x1;_0x143c1b[_0xcd92('0xe7')]+=0x1;_0x376fee[_0xcd92('0xce')](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x120')));if(_0x376fee[_0xcd92('0x1ac')](0xb,_0x1987a6,_0x3b9206)){if(_0x143c1b['countabandonedretry']>=_0x3b9206[_0xcd92('0x11d')]){_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,'reason\x2011\x20abandoned');}else{_0x376fee['stateGlobal'](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1b9'));}}break;case'20':_0x3b9206['outboundRejectCallsDay']+=0x1;_0x143c1b['state']=0x14;_0x143c1b['statedesc']=_0xcd92('0x1ba');_0x143c1b[_0xcd92('0xed')]+=0x1;_0x143c1b[_0xcd92('0xe7')]+=0x1;ami[_0xcd92('0x1a3')](_0xcd92('0x1bb'),ut[_0xcd92('0x1a9')](_0x1987a6,_0xcd92('0x1bc')));_0x376fee[_0xcd92('0xce')](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1bd')));if(_0x376fee[_0xcd92('0x1ac')](0x14,_0x1987a6,_0x3b9206)){if(_0x143c1b[_0xcd92('0xed')]>=_0x3b9206[_0xcd92('0x19d')]){_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1be'));}else{_0x376fee[_0xcd92('0xef')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0xcd92('0x1be'));}}break;default:_0x3b9206[_0xcd92('0x6d')]+=0x1;_0x143c1b[_0xcd92('0xac')]=0xc;_0x143c1b[_0xcd92('0xad')]=_0x4ea3cd[_0xcd92('0x106')];_0x376fee['createHistory'](_0x143c1b)[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1bf')));if(_0x376fee[_0xcd92('0x1ac')](_0x4ea3cd['reason'],_0x1987a6,_0x3b9206)){if(_0x143c1b[_0xcd92('0xe9')]+_0x143c1b[_0xcd92('0xfc')]+_0x143c1b[_0xcd92('0xea')]+_0x143c1b['countnosuchnumberretry']+_0x143c1b['countdropretry']+_0x143c1b[_0xcd92('0xec')]+_0x143c1b['countmachineretry']+_0x143c1b['countagentrejectretry']>=_0x3b9206[_0xcd92('0xee')]){_0x376fee[_0xcd92('0xef')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0x4ea3cd[_0xcd92('0x106')]);}else{_0x376fee[_0xcd92('0xf2')](_0x143c1b,_0x39c01e,_0x3a0e5b,_0x4ea3cd['reason']);}}}});};Dialer[_0xcd92('0x20')][_0xcd92('0xef')]=function(_0x3361c9,_0x28ef09,_0x47f30b,_0x488577){var _0x3fc6d1=new Final(_0x3361c9);_0x3fc6d1[_0xcd92('0xac')]=0xf;_0x3fc6d1[_0xcd92('0xad')]=_0xcd92('0x1c0');this[_0xcd92('0xf2')](_0x3fc6d1,_0x28ef09,_0x47f30b,_0x488577);};Dialer[_0xcd92('0x20')][_0xcd92('0xf2')]=function(_0x225127,_0x3b72df,_0x540dc1,_0x2412da){this['moveContactManagedDialer'](_0x225127)['then'](function(_0x1b9e4c){return _0x3b72df(msgResponse('[callProgressDetecting]',_0xcd92('0xd6'),_0x2412da));})[_0xcd92('0xb6')](function(_0x41b214){return _0x540dc1(msgResponse(_0xcd92('0x1c1'),_0xcd92('0x140'),'contact\x20not\x20moved'));});};Dialer[_0xcd92('0x20')][_0xcd92('0xa')]=function(_0x3b1fb1){var _0x1e1f0f=this;var _0x5905b7=_0x3b1fb1[_0xcd92('0x1c2')]/0x64;var _0x62017a=_0x3b1fb1['outboundDropCallsDayTimeout']/(_0x3b1fb1['outboundDropCallsDayTimeout']+_0x3b1fb1[_0xcd92('0x63')]);var _0x1460d2=Math[_0xcd92('0x1c3')](_0x3b1fb1['predictiveIntervalAvailable']*(_0x3b1fb1[_0xcd92('0x1c4')]/0x64));var _0x3dc24d=Math[_0xcd92('0x1c3')](_0x3b1fb1[_0xcd92('0x75')]*(_0x3b1fb1[_0xcd92('0x1c5')]/0x64));var _0x910932=_0x3b1fb1[_0xcd92('0x55')]+_0x3b1fb1['talking'];var _0x558998=Math[_0xcd92('0x1c6')](_0x3b1fb1[_0xcd92('0x8f')]*_0x3b1fb1['erlangAbandonmentRate']*_0x3b1fb1['predictiveIntervalHitRate']*_0x3b1fb1[_0xcd92('0x73')]);if(_[_0xcd92('0x44')](_0x3b1fb1[_0xcd92('0x2d')])){if(!_['isUndefined'](_0x3b1fb1[_0xcd92('0x2c')])){_0x3b1fb1[_0xcd92('0x2c')]=undefined;loggerPredictive['error'](_0xcd92('0x1c7'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xcd92('0x44')](_0x3b1fb1['handlePredictive'])){loggerPredictive[_0xcd92('0x9b')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3b1fb1[_0xcd92('0x96')]);_0x3b1fb1['handlePredictive']=undefined;}_0x3b1fb1[_0xcd92('0x2d')]=moment()[_0xcd92('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xcd92('0x83')](_0x3b1fb1['name'],_0xcd92('0x1c8'),_0x3b1fb1[_0xcd92('0x2d')]);this['handlePower'](_0x3b1fb1,0x1);}else if(ifInterval(_0x3b1fb1['dialPredictiveInterval'],_0x3b1fb1[_0xcd92('0x2d')])){this['handlePower'](_0x3b1fb1,0x1);loggerPredictiveCalls[_0xcd92('0x83')](_0xcd92('0x1c9'),_0x3b1fb1[_0xcd92('0x2d')],_0x3b1fb1[_0xcd92('0x47')]);_0x3b1fb1[_0xcd92('0x8f')]=0x0;_0x3b1fb1[_0xcd92('0x10f')]=0x0;}else if(_0x5905b7<_0x62017a&&_0x3b1fb1[_0xcd92('0x1ca')]===_0xcd92('0x1cb')){freeVariablesPredictive(_0x3b1fb1);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x1cc'),_0xcd92('0x1cd'),_0x62017a,_0xcd92('0x2d'),_0x3b1fb1[_0xcd92('0x47')]);}else if(_0x558998<_0x3b1fb1[_0xcd92('0x10f')]&&_0x3b1fb1['dialPredictiveOptimization']===_0xcd92('0x1cb')){freeVariablesPredictive(_0x3b1fb1);loggerPredictive['info'](_0xcd92('0x1ce'),_0xcd92('0x1cf'),_0x558998,_0xcd92('0x1d0'),_0x3b1fb1[_0xcd92('0x10f')],_0xcd92('0x2d'),_0x3b1fb1['name']);}else if(!ifInterval(_0x3b1fb1['dialPredictiveInterval'],_0x3b1fb1[_0xcd92('0x2d')])&&_[_0xcd92('0x44')](_0x3b1fb1[_0xcd92('0x2c')])&&!_[_0xcd92('0x44')](_0x3b1fb1['startProgressive'])){_0x3b1fb1['startPredictive']=moment()[_0xcd92('0x7d')](_0xcd92('0x100'));loggerPredictive['info'](_0x3b1fb1['name'],_0xcd92('0x1d1'),_0x3b1fb1['startPredictive']);this[_0xcd92('0xc3')](_0x3b1fb1['dialPredictiveInterval'])['then'](this[_0xcd92('0x1d2')](_0x3b1fb1))['then'](mergeDataErlangB(_0x3b1fb1))[_0xcd92('0xc0')](this[_0xcd92('0x1d3')](_0x3b1fb1))[_0xcd92('0xb6')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x3b1fb1));}else if(!ifInterval(_0x3b1fb1[_0xcd92('0x1d4')],_0x3b1fb1[_0xcd92('0x2c')])){_0x3b1fb1[_0xcd92('0x10f')]=0x0;_0x3b1fb1[_0xcd92('0x2c')]=moment()[_0xcd92('0x7d')](_0xcd92('0x100'));loggerPredictive[_0xcd92('0x83')](_0x3b1fb1[_0xcd92('0x47')],_0xcd92('0x1d5'),_0x3b1fb1[_0xcd92('0x2c')]);clearInterval(_0x3b1fb1['handlePredictive']);_0x3b1fb1[_0xcd92('0x96')]=undefined;this['averageHandleTime'](_0x3b1fb1[_0xcd92('0x1d4')])[_0xcd92('0xc0')](this['getDataPredictive'](_0x3b1fb1))[_0xcd92('0xc0')](mergeDataErlangB(_0x3b1fb1))['then'](this['startMethodPredictive'](_0x3b1fb1))[_0xcd92('0xb6')](loggerCatchPredictive(_0xcd92('0x1d6'),_0x3b1fb1));}else if(_0x3b1fb1[_0xcd92('0x75')]&&_0x910932<_0x3b1fb1[_0xcd92('0x75')]-_0x3dc24d){freeVariablesPredictive(_0x3b1fb1);loggerPredictive[_0xcd92('0x83')](_0x3b1fb1[_0xcd92('0x47')],_0xcd92('0x1d7'),_0x910932,_0xcd92('0x1d8'),_0x3b1fb1[_0xcd92('0x75')],'-',_0x3dc24d,'=',_0x3b1fb1[_0xcd92('0x75')]-_0x3dc24d,')');}else if(_0x3b1fb1[_0xcd92('0x75')]&&_0x910932>_0x3b1fb1[_0xcd92('0x75')]+_0x1460d2){freeVariablesPredictive(_0x3b1fb1);loggerPredictive[_0xcd92('0x83')](_0x3b1fb1[_0xcd92('0x47')],_0xcd92('0x1d7'),_0x910932,')\x20are\x20more\x20than\x20threshold\x20(',_0x3b1fb1[_0xcd92('0x75')],'+',_0x1460d2,'=',_0x3b1fb1[_0xcd92('0x75')]+_0x1460d2,')');}};Dialer[_0xcd92('0x20')][_0xcd92('0x1d2')]=function(_0x1cc51d){var _0x34fb79=this;return function(_0x165492){return new BPromise(function(_0x164fe9,_0x42e647){_[_0xcd92('0x94')](_0x1cc51d,_0x165492[0x0]);if(checkGetDataPredictive(_0x165492[0x0])){var _0x655c7e=_0x1cc51d[_0xcd92('0x75')]=_0x1cc51d[_0xcd92('0xa6')]+_0x1cc51d['available'];var _0x527a7c=_0x1cc51d[_0xcd92('0x1d4')]*0x3c;var _0x2f5c83=_0x165492[0x0]['predictiveIntervalAvgTalktime']+_0x165492[0x0][_0xcd92('0x6f')];var _0x5c2ebd=(_0x165492[0x0][_0xcd92('0x6e')]+_0x165492[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x165492[0x0][_0xcd92('0x70')])/_0x165492[0x0][_0xcd92('0x76')];_0x1cc51d['predictiveIntervalHitRate']=_0x5c2ebd>0x0?_0x5c2ebd:0x1;switch(_0x1cc51d[_0xcd92('0x1ca')]){case _0xcd92('0x1cb'):var _0x336cac=_0x1cc51d['dialPredictiveOptimizationPercentage']/0x64;return _0x34fb79['abandonmentRate'](_0x655c7e,_0x527a7c,_0x2f5c83,_0x5c2ebd,_0x336cac)['then'](function(_0x5895a8){return _0x164fe9(_0x5895a8);});case'agentBusyFactor':var _0x266c42=_0x1cc51d[_0xcd92('0x1c2')]/0x64;return _0x34fb79[_0xcd92('0x1d9')](_0x655c7e,_0x527a7c,_0x2f5c83,_0x5c2ebd,_0x266c42)[_0xcd92('0xc0')](function(_0x3c0fe2){return _0x164fe9(_0x3c0fe2);});default:return _0x42e647(msgResponse(_0xcd92('0x1da'),_0xcd92('0x140'),'Unknown\x20Predictive'));}}else{return _0x42e647(msgResponse(_0xcd92('0x1da'),_0xcd92('0x140'),_0xcd92('0x1db')));}});};};Dialer['prototype'][_0xcd92('0x1dc')]=function(_0x5d2733){var _0x2e73aa=this;return function(_0xfeddb7){return new BPromise(function(_0x555759,_0x5676bf){_[_0xcd92('0x94')](_0x5d2733,_0xfeddb7[0x0]);if(checkGetDataPredictive(_0xfeddb7[0x0])){loggerPredictive[_0xcd92('0x83')](JSON[_0xcd92('0x132')](_0xfeddb7[0x0]));if(_0x5d2733['dialPredictiveOptimization']===_0xcd92('0x1cb')){return _0x2e73aa[_0xcd92('0xca')](_0x5d2733['id'])[_0xcd92('0xc0')](function(_0x173053){var _0x36400a=_0x5d2733[_0xcd92('0x56')]-_0x173053[0x0][_0xcd92('0x1dd')];var _0x564375=_0x5d2733['dialPredictiveInterval']*0x3c;var _0x3688a2=_0xfeddb7[0x0][_0xcd92('0x89')]+_0xfeddb7[0x0][_0xcd92('0x6f')];var _0x47089e=(_0xfeddb7[0x0][_0xcd92('0x6e')]+_0xfeddb7[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xfeddb7[0x0][_0xcd92('0x70')])/_0xfeddb7[0x0][_0xcd92('0x76')];var _0x28cb3e=_0x5d2733['dialPredictiveOptimizationPercentage']/0x64;_0x5d2733[_0xcd92('0x74')]=_0x173053[0x0][_0xcd92('0x1dd')]||0x0;_0x5d2733[_0xcd92('0x72')]=_0x47089e>0x0?_0x47089e:0x1;return _0x2e73aa['abandonmentRate'](_0x36400a,_0x564375,_0x3688a2,_0x47089e,_0x28cb3e);})[_0xcd92('0xc0')](function(_0x17d56c){return _0x555759(_0x17d56c);})[_0xcd92('0xb6')](function(_0xaaac1){return _0x5676bf(msgResponse(_0xcd92('0x1de'),_0xcd92('0x140'),JSON['stringify'](_0xaaac1)));});}if(_0x5d2733[_0xcd92('0x1ca')]===_0xcd92('0x1df')){return _0x2e73aa[_0xcd92('0xca')](_0x5d2733['id'])[_0xcd92('0xc0')](function(_0x272b2a){var _0x4097ef=_0x5d2733[_0xcd92('0x56')]-_0x272b2a[0x0][_0xcd92('0x1dd')];var _0x88805b=_0x5d2733[_0xcd92('0x1d4')]*0x3c;var _0x5a8d32=_0xfeddb7[0x0][_0xcd92('0x89')]+_0xfeddb7[0x0]['predictiveIntervalAvgHoldtime'];var _0x57afe9=(_0xfeddb7[0x0][_0xcd92('0x6e')]+_0xfeddb7[0x0][_0xcd92('0x71')]+_0xfeddb7[0x0][_0xcd92('0x70')])/_0xfeddb7[0x0][_0xcd92('0x76')];var _0x141e77=_0x5d2733[_0xcd92('0x1c2')]/0x64;_0x5d2733[_0xcd92('0x74')]=_0x272b2a[0x0][_0xcd92('0x1dd')]||0x0;_0x5d2733[_0xcd92('0x72')]=_0x57afe9>0x0?_0x57afe9:0x1;return _0x2e73aa[_0xcd92('0x1d9')](_0x4097ef,_0x88805b,_0x5a8d32,_0x57afe9,_0x141e77);})[_0xcd92('0xc0')](function(_0x294d66){return _0x555759(_0x294d66);})[_0xcd92('0xb6')](function(_0x31e5aa){return _0x5676bf(msgResponse(_0xcd92('0x1de'),_0xcd92('0x140'),JSON[_0xcd92('0x132')](_0x31e5aa)));});}}else{return _0x5676bf(msgResponse(_0xcd92('0x1da'),_0xcd92('0x140'),_0xcd92('0x1db')));}});};};Dialer[_0xcd92('0x20')][_0xcd92('0x1d3')]=function(_0x3c3127){var _0x5ce1ee=this;return function(){var _0x4935f9=0x0;var _0x5e2723=Math[_0xcd92('0x1c6')](_0x3c3127['erlangCallToSecond']*0x3e8);if(_0x5e2723>0x0){_0x5e2723=_0x5e2723<0x64?0x64:_0x5e2723;loggerPredictive[_0xcd92('0x83')](_0x3c3127[_0xcd92('0x47')],_0xcd92('0x1e0'),_0x5e2723,'milliseconds');_0x3c3127[_0xcd92('0x96')]=setInterval(function(){_0x5ce1ee[_0xcd92('0x96')](_0x3c3127);loggerPredictiveCalls[_0xcd92('0x83')]('[handlePredictive]',_0x4935f9+=0x1);},_0x5e2723);}else{loggerPredictive[_0xcd92('0x83')](_0x3c3127[_0xcd92('0x47')],_0xcd92('0x1e1'));}};};Dialer[_0xcd92('0x20')][_0xcd92('0x1e2')]=function(_0x41251a,_0x4b09f8){var _0x4f5b2a=this;return function(_0x48f718){if(_[_0xcd92('0x4f')](_0x48f718)){if(_[_0xcd92('0xb2')](_0x4b09f8[_0xcd92('0x1e3')])||!_0x4b09f8['recallme']){if(_0x41251a['dialMethod']===_0xcd92('0x9')){_0x41251a[_0xcd92('0x129')]=_['isUndefined'](_0x41251a['queueStatusComplete'])?!![]:_0x41251a[_0xcd92('0x129')];var _0x11bd41=uuid['v4']();_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41]=new Action(_0x41251a,_0x4b09f8,_0x11bd41);loggerBooked[_0xcd92('0x83')](_0xcd92('0x1e4'),_0x11bd41,'queueStatusComplete:\x20',JSON[_0xcd92('0x132')](_0x41251a[_0xcd92('0x129')]),_0xcd92('0x1e5'),_0x41251a[_0xcd92('0x47')]);if(_0x41251a['queueStatusComplete']){_0x41251a['queueStatusComplete']=![];_0x4f5b2a['queueBooked'][_0x4f5b2a['actions'][_0x11bd41][_0xcd92('0xb9')]]=[];ami[_0xcd92('0xb3')]({'actionid':_0x11bd41,'action':_0xcd92('0x1e6'),'queue':_0x41251a[_0xcd92('0x47')]})[_0xcd92('0xb6')](function(_0x23915b){_0x4f5b2a['updateOriginated'](_0x41251a);_0x4f5b2a[_0xcd92('0xc5')]({'active':![],'ContactId':_0x4f5b2a['actions'][_0x11bd41]['ContactId'],'ListId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xf5')],'VoiceQueueId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xd3')]||undefined,'CampaignId':_0x4f5b2a['actions'][_0x11bd41]['CampaignId']||undefined})[_0xcd92('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4f5b2a[_0xcd92('0x2a')][_0x11bd41];});}else{loggerBooked[_0xcd92('0x83')](_0xcd92('0x1e7'),JSON[_0xcd92('0x132')](_0x41251a['queueStatusComplete']),_0xcd92('0x1e5'),_0x41251a[_0xcd92('0x47')]);_0x4f5b2a['updateOriginated'](_0x41251a);_0x4f5b2a[_0xcd92('0xc5')]({'active':![],'ContactId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xd2')],'ListId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xf5')],'VoiceQueueId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xd3')]||undefined,'CampaignId':_0x4f5b2a[_0xcd92('0x2a')][_0x11bd41][_0xcd92('0xf6')]||undefined})[_0xcd92('0xb6')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4f5b2a[_0xcd92('0x2a')][_0x11bd41];}}else{return _0x4f5b2a['actionOriginate'](_0x41251a,_0x4b09f8);}}else{if(getDiff(_0x4b09f8['scheduledat'])<_0x41251a[_0xcd92('0x1e8')]*0x3c){if(_0x4b09f8[_0xcd92('0x1e9')]&&!_0x4b09f8[_0xcd92('0x1e9')][_0xcd92('0x1ea')]){_0x4f5b2a[_0xcd92('0x25')][_0xcd92('0x12c')](_0x4b09f8['id'])[_0xcd92('0x23')](function(){_0x4f5b2a[_0xcd92('0xb8')](_0x41251a);});}else{_0x4f5b2a[_0xcd92('0xc6')]({'active':![]},_0x4b09f8['id'],0x1)[_0xcd92('0x23')](function(){console['log'](_0xcd92('0x1eb'));_0x4f5b2a[_0xcd92('0xb8')](_0x41251a);});}}else{_0x41251a['outboundReCallsDay']+=0x1;_0x4f5b2a[_0xcd92('0xb8')](_0x41251a);if(_0x41251a[_0xcd92('0x1ec')]){_0x4f5b2a[_0xcd92('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b09f8[_0xcd92('0xd2')],'ListId':_0x4b09f8[_0xcd92('0xf5')],'VoiceQueueId':_0x4b09f8['VoiceQueueId']||undefined,'CampaignId':_0x4b09f8[_0xcd92('0xf6')]||undefined})['catch'](loggerCatch(_0xcd92('0x1ed')));_0x4f5b2a[_0xcd92('0xce')](createObjHistory(_0x41251a,_0x4b09f8,_0xcd92('0x1ee'),0x17,_0xcd92('0x1ef')))[_0xcd92('0xb6')](loggerCatch(_0xcd92('0x1f0')));}else{_0x4f5b2a[_0xcd92('0xda')](createObjHistory(_0x41251a,_0x4b09f8,'RECALLFAILEDTIMEOUT',0x16,_0xcd92('0x1f1')),_0xcd92('0x1f2'),_0xcd92('0x1f3'));}}}}else{_0x41251a[_0xcd92('0x64')]+=0x1;_0x4f5b2a['saveInDb'](createObjHistory(_0x41251a,_0x4b09f8,_0xcd92('0x1f4'),0xd,'Blacklist'),_0xcd92('0x1f5'),'[Originate][MoveBlacklist]');throw _0xcd92('0x1f6');}};};Dialer['prototype'][_0xcd92('0x157')]=function(_0x1d2a68){var _0x14d306=this;var _0x2c2c8e=[];var _0x4535d3=_0x1d2a68[_0xcd92('0x1f7')]-_0x1d2a68[_0xcd92('0x77')]-_0x1d2a68[_0xcd92('0x1f8')];emitCampaignSummary(_0x1d2a68);if(_0x4535d3>0x0){if(_0x4535d3>this[_0xcd92('0x29')]){_0x4535d3=this[_0xcd92('0x29')];}_0x1d2a68['temp']+=_0x4535d3;this[_0xcd92('0xc9')](_0x1d2a68['id'],_0x4535d3,_0x1d2a68[_0xcd92('0x1f9')])['then'](function(_0x1e68e1){_0x1d2a68['temp']-=_0x4535d3;_0x1d2a68['temp']=_0x1d2a68['temp']>0x0?_0x1d2a68[_0xcd92('0x1f8')]:0x0;if(!checkContactEmpty(_0x1e68e1)){_0x1d2a68[_0xcd92('0x45')]=_0xcd92('0xa3');logger['info'](_0xcd92('0x1fa')+_0x1d2a68[_0xcd92('0x47')]);}else{_0x1d2a68[_0xcd92('0x77')]+=_0x1e68e1[_0xcd92('0x9e')];_0x1d2a68['message']=_0xcd92('0x1fb');for(var _0x481307=0x0;_0x481307<_0x1e68e1[_0xcd92('0x9e')];_0x481307+=0x1){_0x1d2a68[_0xcd92('0x1fc')]+=0x1;if(_[_0xcd92('0xb2')](_0x1e68e1[_0x481307])||_[_0xcd92('0xb2')](_0x1e68e1[_0x481307][_0xcd92('0x164')])||_['isNil'](_0x1e68e1[_0x481307][_0xcd92('0x164')]['phone'])){_0x14d306[_0xcd92('0xcf')](_0xcd92('0x1fd'),_0x1d2a68,_0x1e68e1[_0x481307]);}else{_0x14d306['checkIsBlackListIvr'](_['pick'](_0x1e68e1[_0x481307],[_0xcd92('0xf6'),'Contact.phone']))['then'](_0x14d306[_0xcd92('0x1e2')](_0x1d2a68,_0x1e68e1[_0x481307]))[_0xcd92('0xb6')](_0x14d306[_0xcd92('0x1fe')](_0xcd92('0x1ff'),_0x1d2a68));}}}})[_0xcd92('0xb6')](loggerGetContactDialer(_0xcd92('0x200'),_0x1d2a68,_0x4535d3));}};Dialer[_0xcd92('0x20')]['handlePower']=function(_0x33cbf6,_0x3c57bb){var _0x5280d5=this;var _0x4cd047=[];var _0x1c1c9d=_0x3c57bb>=0x1?_0x3c57bb:0x1;var _0x217883=[];if(_0x33cbf6[_0xcd92('0x60')]===_0xcd92('0x9')){_0x1c1c9d=0x1;}var _0x132f19=Math[_0xcd92('0x1c6')](_0x33cbf6[_0xcd92('0x55')]*_0x1c1c9d)-_0x33cbf6['originated']-_0x33cbf6[_0xcd92('0x1f8')];emitVoiceQueueSummary(_0x33cbf6);if(_0x33cbf6[_0xcd92('0x201')]>0x0){var _0x376000=_0x33cbf6[_0xcd92('0x201')]-_0x33cbf6[_0xcd92('0x77')]-_0x33cbf6[_0xcd92('0xa6')]-_0x33cbf6[_0xcd92('0x1f8')]-_0x33cbf6[_0xcd92('0xa7')];if(_0x132f19>_0x376000){_0x132f19=_0x376000;}}if(_0x132f19>0x0){if(_0x33cbf6['dialMethod']==='booked'){_0x132f19=0x1;}if(_0x132f19>this[_0xcd92('0x29')]){_0x132f19=this['maxNumberOriginate'];}_0x33cbf6[_0xcd92('0x1f8')]+=_0x132f19;for(var _0x3d4efc in this[_0xcd92('0x125')]){if(this['agents'][_0xcd92('0xb1')](_0x3d4efc)){if(this['agents'][_0x3d4efc][_0xcd92('0xac')]==='not_inuse'&&this[_0xcd92('0x125')][_0x3d4efc][_0xcd92('0xb4')]===_0xcd92('0x202')){_0x4cd047[_0xcd92('0x146')](this['agents'][_0x3d4efc]['id']);}}}this['getContactDialer'](_0x33cbf6['id'],_0x4cd047,_0x132f19,_0x33cbf6[_0xcd92('0x1f9')])[_0xcd92('0xc0')](function(_0xe576ee){_0x33cbf6[_0xcd92('0x1f8')]-=_0x132f19;_0x33cbf6[_0xcd92('0x1f8')]=_0x33cbf6[_0xcd92('0x1f8')]>0x0?_0x33cbf6[_0xcd92('0x1f8')]:0x0;if(!checkContactEmpty(_0xe576ee)){_0x5280d5[_0xcd92('0xbc')](_0x33cbf6)['then'](sendMessageReschedule(_0x33cbf6))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x33cbf6[_0xcd92('0x77')]+=_0xe576ee[_0xcd92('0x9e')];_0x33cbf6[_0xcd92('0x45')]=_0x33cbf6[_0xcd92('0x60')]===_0xcd92('0x9')?_0xcd92('0x16d'):'RUNNING';for(var _0x1c9a24=0x0;_0x1c9a24<_0xe576ee[_0xcd92('0x9e')];_0x1c9a24+=0x1){if(_[_0xcd92('0xb2')](_0xe576ee[_0x1c9a24])||_[_0xcd92('0xb2')](_0xe576ee[_0x1c9a24][_0xcd92('0x164')])||_['isNil'](_0xe576ee[_0x1c9a24][_0xcd92('0x164')][_0xcd92('0x165')])){_0x5280d5[_0xcd92('0xcf')]('[actionOriginate]\x20',_0x33cbf6,_0xe576ee[_0x1c9a24]);}else{_0x5280d5['checkIsBlackList'](_[_0xcd92('0xd1')](_0xe576ee[_0x1c9a24],['VoiceQueueId','Contact.phone']))[_0xcd92('0xc0')](_0x5280d5[_0xcd92('0x1e2')](_0x33cbf6,_0xe576ee[_0x1c9a24]))[_0xcd92('0xb6')](_0x5280d5['loggerHandler'](_0xcd92('0x1fd'),_0x33cbf6));}}}})['catch'](loggerGetContactDialer(_0xcd92('0x203'),_0x33cbf6,_0x132f19));}};Dialer[_0xcd92('0x20')][_0xcd92('0x96')]=function(_0x177f17){var _0x373868=this;if(_0x177f17[_0xcd92('0x201')]>0x0){var _0x18fa14=_0x177f17['dialLimitQueue']-_0x177f17['originated']-_0x177f17[_0xcd92('0xa6')];if(_0x18fa14>0x0){this['tryOriginatePredictive'](_0x177f17);}else{loggerPredictiveCalls['info'](_0xcd92('0x204'));}}else{this[_0xcd92('0x205')](_0x177f17);}};Dialer[_0xcd92('0x20')]['tryOriginatePredictive']=function(_0x54187f){var _0x48babc=this;var _0x45c032=[];_0x54187f[_0xcd92('0x77')]+=0x1;for(var _0x3618a3 in this['agents']){if(this[_0xcd92('0x125')][_0xcd92('0xb1')](_0x3618a3)){if(this[_0xcd92('0x125')][_0x3618a3][_0xcd92('0xac')]===_0xcd92('0x206')&&this[_0xcd92('0x125')][_0x3618a3]['status']==='reachable'){_0x45c032[_0xcd92('0x146')](this['agents'][_0x3618a3]['id']);}}}this[_0xcd92('0xc7')](_0x54187f['id'],_0x45c032,0x1,_0x54187f['dialOrderByScheduledAt'])[_0xcd92('0xc0')](function(_0x207e2c){if(!checkContactEmpty(_0x207e2c)){checkContactLowerLimitOriginate(_0x54187f,0x1,0x0);_0x48babc[_0xcd92('0xbc')](_0x54187f)['then'](sendMessageReschedule(_0x54187f))[_0xcd92('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x54187f[_0xcd92('0x45')]=_0xcd92('0x1fb');if(_[_0xcd92('0xb2')](_0x207e2c[0x0])||_['isNil'](_0x207e2c[0x0][_0xcd92('0x164')])||_[_0xcd92('0xb2')](_0x207e2c[0x0][_0xcd92('0x164')][_0xcd92('0x165')])){_0x48babc[_0xcd92('0xcf')]('[actionOriginate]\x20',_0x54187f,_0x207e2c[0x0]);}else{_0x48babc[_0xcd92('0xbe')](_[_0xcd92('0xd1')](_0x207e2c[0x0],[_0xcd92('0xd3'),'Contact.phone']))[_0xcd92('0xc0')](_0x48babc[_0xcd92('0x1e2')](_0x54187f,_0x207e2c[0x0]))[_0xcd92('0xb6')](_0x48babc[_0xcd92('0x1fe')](_0xcd92('0x207'),_0x54187f));}}})[_0xcd92('0xb6')](loggerGetContactDialer(_0xcd92('0x208'),_0x54187f,0x1));emitVoiceQueueSummary(_0x54187f);};Dialer[_0xcd92('0x20')][_0xcd92('0x209')]=function(_0x1540ee,_0x8466c2,_0x1e25cd,_0x59ce1f,_0x8eeef0,_0x288ace){loggerPredictive['info'](_0xcd92('0x20a'));loggerPredictive['info'](_0xcd92('0x20b'),_0x1540ee);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x20c'),_0x8466c2);loggerPredictive['info'](_0xcd92('0x20d'),_0x1e25cd);loggerPredictive['info'](_0xcd92('0x20e'),_0x59ce1f);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x20f'),_0x8eeef0);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x93'));return new BPromise(function(_0x302603,_0x2cf8a9){if(_0x1540ee<=0x0||isNaN(_0x1540ee)){return _0x2cf8a9(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x1540ee));}if(_0x1e25cd<=0x0||isNaN(_0x1e25cd)){return _0x2cf8a9(msgResponse(_0xcd92('0x210'),_0xcd92('0x50'),'Ts\x20=\x20'+_0x1e25cd));}if(_0x59ce1f<=0x0||isNaN(_0x59ce1f)){return _0x2cf8a9(msgResponse(_0xcd92('0x210'),'Error',_0xcd92('0x211')+_0x59ce1f));}if(_0x8466c2<=0x0||isNaN(_0x8466c2)){return _0x2cf8a9(msgResponse(_0xcd92('0x210'),'Error',_0xcd92('0x212')+_0x8466c2));}if(_0x8eeef0<=0x0||isNaN(_0x8eeef0)){return _0x2cf8a9(msgResponse(_0xcd92('0x210'),_0xcd92('0x50'),'Amax\x20=\x20'+_0x8eeef0));}_0x288ace=_0x288ace||0x0;var _0x5a54a2=0x1/_0x1e25cd;var _0x47e3b4=0x0;var _0xa7a72c=0x0;var _0x221355=0x0;var _0x3758a8=0x0;for(var _0xf1826d=0x0;_0x221355<_0x8eeef0;_0xf1826d+=0x1){_0xa7a72c=_0xf1826d/_0x8466c2;_0x47e3b4=(_0x59ce1f*_0xa7a72c+_0x288ace)/_0x5a54a2;_0x221355=erlangb(_0x47e3b4,_0x1540ee);_0x3758a8=_0x47e3b4/_0x1540ee*(0x1-erlangb(_0x47e3b4,_0x1540ee));}return _0x302603({'erlangCalls':_0xf1826d,'erlangCallToSecond':_0x8466c2/_0xf1826d,'erlangAbandonmentRate':_0x221355,'erlangBusyFactor':_0x3758a8});});};Dialer[_0xcd92('0x20')][_0xcd92('0x1d9')]=function(_0x221f17,_0x429f45,_0x138735,_0x1a0068,_0x1ce98d,_0x40aefe){loggerPredictive['info'](_0xcd92('0x213'));loggerPredictive[_0xcd92('0x83')](_0xcd92('0x20b'),_0x221f17);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x20c'),_0x429f45);loggerPredictive[_0xcd92('0x83')]('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',_0x138735);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x20e'),_0x1a0068);loggerPredictive[_0xcd92('0x83')](_0xcd92('0x214'),_0x1ce98d);loggerPredictive[_0xcd92('0x83')]('---------------------------');return new BPromise(function(_0x2f6af2,_0x3d3f9a){if(_0x221f17<=0x0||isNaN(_0x221f17)){return _0x3d3f9a(msgResponse(_0xcd92('0x215'),_0xcd92('0x50'),_0xcd92('0x216')+_0x221f17));}if(_0x138735<=0x0||isNaN(_0x138735)){return _0x3d3f9a(msgResponse(_0xcd92('0x215'),_0xcd92('0x50'),_0xcd92('0x217')+_0x138735));}if(_0x1a0068<=0x0||isNaN(_0x1a0068)){return _0x3d3f9a(msgResponse(_0xcd92('0x215'),_0xcd92('0x50'),_0xcd92('0x211')+_0x1a0068));}if(_0x429f45<=0x0||isNaN(_0x429f45)){return _0x3d3f9a(msgResponse(_0xcd92('0x215'),_0xcd92('0x50'),_0xcd92('0x212')+_0x429f45));}if(_0x1ce98d<=0x0||isNaN(_0x1ce98d)){return _0x3d3f9a(msgResponse(_0xcd92('0x215'),_0xcd92('0x50'),_0xcd92('0x218')+_0x1ce98d));}_0x40aefe=_0x40aefe||0x0;var _0x25e8ab=0x1/_0x138735;var _0xae5e58=0x0;var _0x59361c=0x0;var _0x2c91b2=0x0;var _0x142bd7=0x0;for(var _0x37f013=0x0;_0x142bd7<_0x1ce98d;_0x37f013+=0x1){_0x59361c=_0x37f013/_0x429f45;_0xae5e58=(_0x1a0068*_0x59361c+_0x40aefe)/_0x25e8ab;_0x2c91b2=erlangb(_0xae5e58,_0x221f17);_0x142bd7=_0xae5e58/_0x221f17*(0x1-erlangb(_0xae5e58,_0x221f17));}return _0x2f6af2({'erlangCalls':_0x37f013,'erlangCallToSecond':_0x429f45/_0x37f013,'erlangAbandonmentRate':_0x2c91b2,'erlangBusyFactor':_0x142bd7});});};module[_0xcd92('0x219')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 00592ce..4ae1998 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 _0xdaa1=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x2bb30a,_0x13c669){var _0x1d0ae8=function(_0x3083b5){while(--_0x3083b5){_0x2bb30a['push'](_0x2bb30a['shift']());}};_0x1d0ae8(++_0x13c669);}(_0xdaa1,0xe4));var _0x1daa=function(_0x56dc73,_0x2dde03){_0x56dc73=_0x56dc73-0x0;var _0x20c431=_0xdaa1[_0x56dc73];return _0x20c431;};'use strict';var util=require(_0x1daa('0x0'));var _=require(_0x1daa('0x1'));var moment=require(_0x1daa('0x2'));function getSeconds(_0x355959,_0x5053fa){var _0x18f6a9=moment(_0x355959)[_0x1daa('0x3')](0x0);var _0x1ba7e3=moment(_0x5053fa)[_0x1daa('0x3')](0x0);return _0x18f6a9['diff'](_0x1ba7e3,_0x1daa('0x4'));}function QueueCallerAbandon(_0x57bca4,_0x41211c){this['scheduledat']=_0x57bca4['scheduledat'];this[_0x1daa('0x5')]=_0x57bca4[_0x1daa('0x5')];this[_0x1daa('0x6')]=_0x57bca4[_0x1daa('0x5')]==='outbound'?_0x1daa('0x7'):_0x57bca4['type'];this[_0x1daa('0x8')]=_0x57bca4[_0x1daa('0x8')];this[_0x1daa('0x9')]=_0x57bca4[_0x1daa('0x9')];this[_0x1daa('0xa')]=_0x57bca4['countnoanswerretry'];this['countglobal']=_0x57bca4[_0x1daa('0x8')]+_0x57bca4[_0x1daa('0x9')]+_0x57bca4[_0x1daa('0xa')]+_0x57bca4[_0x1daa('0xb')]+_0x57bca4[_0x1daa('0xc')]+_0x57bca4[_0x1daa('0xd')]+_0x57bca4[_0x1daa('0xe')]+_0x57bca4[_0x1daa('0xf')];this[_0x1daa('0xb')]=_0x57bca4[_0x1daa('0xb')];this[_0x1daa('0xc')]=_0x57bca4[_0x1daa('0xc')];this[_0x1daa('0xd')]=_0x57bca4[_0x1daa('0xd')];this[_0x1daa('0xe')]=_0x57bca4[_0x1daa('0xe')];this[_0x1daa('0xf')]=_0x57bca4[_0x1daa('0xf')];this[_0x1daa('0x10')]=_0x41211c[_0x1daa('0x10')];this[_0x1daa('0x11')]=_0x57bca4['name'];this[_0x1daa('0x12')]=_0x57bca4['number'];this[_0x1daa('0x13')]=_0x57bca4[_0x1daa('0x13')];this['responsetime']=_0x57bca4[_0x1daa('0x14')];this[_0x1daa('0x15')]=_0x57bca4['droptime'];this['endtime']=this['droptime'];this[_0x1daa('0x16')]=getSeconds(_0x57bca4[_0x1daa('0x14')],_0x57bca4[_0x1daa('0x13')]);this[_0x1daa('0x17')]=getSeconds(this[_0x1daa('0x15')],_0x57bca4[_0x1daa('0x14')]);this[_0x1daa('0x18')]=0x0;this[_0x1daa('0x7')]=_0x41211c[_0x1daa('0x7')];this[_0x1daa('0x19')]=_0x41211c[_0x1daa('0x1a')];this[_0x1daa('0x1b')]=_0x41211c[_0x1daa('0x1b')];this[_0x1daa('0x1c')]=_0x57bca4['callback'];this[_0x1daa('0x1d')]=_0x57bca4[_0x1daa('0x1d')];this[_0x1daa('0x1e')]=_0x57bca4['callbackat'];this[_0x1daa('0x1f')]=_0x57bca4[_0x1daa('0x1f')];this[_0x1daa('0x20')]=_0x57bca4[_0x1daa('0x20')];this[_0x1daa('0x21')]=_0x57bca4[_0x1daa('0x21')];this[_0x1daa('0x22')]=_0x57bca4[_0x1daa('0x22')];this[_0x1daa('0x23')]=_0x57bca4[_0x1daa('0x23')];this[_0x1daa('0x24')]=_0x57bca4[_0x1daa('0x24')];this[_0x1daa('0x25')]=_0x57bca4[_0x1daa('0x25')]||'';this[_0x1daa('0x26')]=_0x57bca4[_0x1daa('0x26')]||'';}module[_0x1daa('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x17f8=['originatecalleridname','exports','util','moment','milliseconds','diff','scheduledat','campaigntype','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0xf56197,_0x3da8f3){var _0x3dd377=function(_0x3fca02){while(--_0x3fca02){_0xf56197['push'](_0xf56197['shift']());}};_0x3dd377(++_0x3da8f3);}(_0x17f8,0xca));var _0x817f=function(_0x3bf36d,_0x271147){_0x3bf36d=_0x3bf36d-0x0;var _0x1dd0f3=_0x17f8[_0x3bf36d];return _0x1dd0f3;};'use strict';var util=require(_0x817f('0x0'));var _=require('lodash');var moment=require(_0x817f('0x1'));function getSeconds(_0x37a5f5,_0x2fca4f){var _0x10c71b=moment(_0x37a5f5)[_0x817f('0x2')](0x0);var _0x22912d=moment(_0x2fca4f)[_0x817f('0x2')](0x0);return _0x10c71b[_0x817f('0x3')](_0x22912d,'seconds');}function QueueCallerAbandon(_0x39dd08,_0x398227){this['scheduledat']=_0x39dd08[_0x817f('0x4')];this['type']=_0x39dd08['type'];this[_0x817f('0x5')]=_0x39dd08[_0x817f('0x6')]===_0x817f('0x7')?'queue':_0x39dd08[_0x817f('0x6')];this['countbusyretry']=_0x39dd08[_0x817f('0x8')];this[_0x817f('0x9')]=_0x39dd08[_0x817f('0x9')];this[_0x817f('0xa')]=_0x39dd08[_0x817f('0xa')];this[_0x817f('0xb')]=_0x39dd08[_0x817f('0x8')]+_0x39dd08[_0x817f('0x9')]+_0x39dd08[_0x817f('0xa')]+_0x39dd08['countnosuchnumberretry']+_0x39dd08['countdropretry']+_0x39dd08[_0x817f('0xc')]+_0x39dd08[_0x817f('0xd')]+_0x39dd08['countagentrejectretry'];this[_0x817f('0xe')]=_0x39dd08['countnosuchnumberretry'];this['countdropretry']=_0x39dd08[_0x817f('0xf')];this[_0x817f('0xc')]=_0x39dd08['countabandonedretry'];this[_0x817f('0xd')]=_0x39dd08[_0x817f('0xd')];this[_0x817f('0x10')]=_0x39dd08[_0x817f('0x10')];this[_0x817f('0x11')]=_0x398227[_0x817f('0x11')];this[_0x817f('0x12')]=_0x39dd08[_0x817f('0x13')];this[_0x817f('0x14')]=_0x39dd08[_0x817f('0x15')];this[_0x817f('0x16')]=_0x39dd08[_0x817f('0x16')];this[_0x817f('0x17')]=_0x39dd08['responsetime'];this[_0x817f('0x18')]=_0x39dd08[_0x817f('0x18')];this['endtime']=this[_0x817f('0x18')];this['ringtime']=getSeconds(_0x39dd08['responsetime'],_0x39dd08[_0x817f('0x16')]);this[_0x817f('0x19')]=getSeconds(this['droptime'],_0x39dd08[_0x817f('0x17')]);this[_0x817f('0x1a')]=0x0;this['queue']=_0x398227['queue'];this[_0x817f('0x1b')]=_0x398227[_0x817f('0x1c')];this['reason']=_0x398227[_0x817f('0x1d')];this['callback']=_0x39dd08['callback'];this[_0x817f('0x1e')]=_0x39dd08[_0x817f('0x1e')];this[_0x817f('0x1f')]=_0x39dd08[_0x817f('0x1f')];this[_0x817f('0x20')]=_0x39dd08['recallme'];this['ContactId']=_0x39dd08['ContactId'];this['ListId']=_0x39dd08[_0x817f('0x21')];this[_0x817f('0x22')]=_0x39dd08[_0x817f('0x22')];this[_0x817f('0x23')]=_0x39dd08['VoiceQueueId'];this[_0x817f('0x24')]=_0x39dd08['CampaignId'];this[_0x817f('0x25')]=_0x39dd08[_0x817f('0x25')]||'';this[_0x817f('0x26')]=_0x39dd08[_0x817f('0x26')]||'';}module[_0x817f('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 98e3c12..41288bd 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 _0x2806=['util','lodash','uniqueid','format','%s/%s/%s','Trunk','fax','localstationid','path','AttachmentId','exports'];(function(_0x3ef00,_0x2ebe19){var _0x44cbc2=function(_0xb8a4c2){while(--_0xb8a4c2){_0x3ef00['push'](_0x3ef00['shift']());}};_0x44cbc2(++_0x2ebe19);}(_0x2806,0x9a));var _0x6280=function(_0x583774,_0x20c5c9){_0x583774=_0x583774-0x0;var _0x4f4e39=_0x2806[_0x583774];return _0x4f4e39;};'use strict';var util=require(_0x6280('0x0'));var _=require(_0x6280('0x1'));var moment=require('moment');function Action(_0x576b0c,_0x1cc7eb,_0x13265b){this[_0x6280('0x2')]=_0x576b0c||undefined;this['channel']=util[_0x6280('0x3')](_0x6280('0x4'),_0x1cc7eb['tech'],_0x1cc7eb[_0x6280('0x5')]['name'],_0x13265b[_0x6280('0x6')]);this['localstationid']=_0x1cc7eb[_0x6280('0x7')];this['headerinfo']=_0x1cc7eb['headerinfo'];this[_0x6280('0x8')]=_0x13265b['path'];this[_0x6280('0x9')]=_0x13265b['AttachmentId'];}module[_0x6280('0xa')]=Action; \ No newline at end of file +var _0xbe31=['lodash','moment','uniqueid','format','tech','Trunk','name','fax','localstationid','headerinfo','path','exports','util'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xbe31,0x1e0));var _0x1be3=function(_0x2c6fab,_0x3ca8a6){_0x2c6fab=_0x2c6fab-0x0;var _0xde8d7f=_0xbe31[_0x2c6fab];return _0xde8d7f;};'use strict';var util=require(_0x1be3('0x0'));var _=require(_0x1be3('0x1'));var moment=require(_0x1be3('0x2'));function Action(_0x3bbdf0,_0x4a660d,_0x16fd43){this[_0x1be3('0x3')]=_0x3bbdf0||undefined;this['channel']=util[_0x1be3('0x4')]('%s/%s/%s',_0x4a660d[_0x1be3('0x5')],_0x4a660d[_0x1be3('0x6')][_0x1be3('0x7')],_0x16fd43[_0x1be3('0x8')]);this[_0x1be3('0x9')]=_0x4a660d[_0x1be3('0x9')];this[_0x1be3('0xa')]=_0x4a660d[_0x1be3('0xa')];this[_0x1be3('0xb')]=_0x16fd43[_0x1be3('0xb')];this['AttachmentId']=_0x16fd43['AttachmentId'];}module[_0x1be3('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 7e6456f..7793fee 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 _0x06e3=['Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','value','syncNewState','channelstatedesc','variable','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','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','format','%s/%s.tif','dir'];(function(_0x223f38,_0x4ece37){var _0x4f18b7=function(_0x502d2c){while(--_0x502d2c){_0x223f38['push'](_0x223f38['shift']());}};_0x4f18b7(++_0x4ece37);}(_0x06e3,0x16c));var _0x306e=function(_0x148f22,_0x555aaa){_0x148f22=_0x148f22-0x0;var _0x1076d6=_0x06e3[_0x148f22];return _0x1076d6;};'use strict';var util=require('util');var _=require(_0x306e('0x0'));var BPromise=require(_0x306e('0x1'));var uuid=require(_0x306e('0x2'));var moment=require(_0x306e('0x3'));var path=require(_0x306e('0x4'));var tiff2pdf=require(_0x306e('0x5'));var gs=require(_0x306e('0x6'));var logger=require(_0x306e('0x7'))(_0x306e('0x8'));var ami=require(_0x306e('0x9'));var rpcDb=require(_0x306e('0xa'));var Channel=require(_0x306e('0xb'));var ut=require(_0x306e('0xc'));var Action=require(_0x306e('0xd'));var faxAccount=require(_0x306e('0xe'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x306e('0xf'));function Fax(_0x321912){this[_0x306e('0x10')]={};this[_0x306e('0x11')]=_0x321912['faxAccounts'];this[_0x306e('0x12')]=_0x321912[_0x306e('0x12')];this[_0x306e('0x13')]={};ami['on'](_0x306e('0x14'),this[_0x306e('0x15')][_0x306e('0x16')](this));ami['on'](_0x306e('0x17'),this[_0x306e('0x18')]['bind'](this));ami['on'](_0x306e('0x19'),this['syncNewState'][_0x306e('0x16')](this));ami['on'](_0x306e('0x1a'),this[_0x306e('0x1b')][_0x306e('0x16')](this));ami['on'](_0x306e('0x1c'),this[_0x306e('0x1d')]['bind'](this));ami['on'](_0x306e('0x1e'),this[_0x306e('0x1f')][_0x306e('0x16')](this));ami['on'](_0x306e('0x20'),this['syncHangup'][_0x306e('0x16')](this));ami['on'](_0x306e('0x21'),this[_0x306e('0x22')]['bind'](this));}Fax['prototype'][_0x306e('0x15')]=function(_0x1d5594){if(_0x1d5594[_0x306e('0x23')]===_0x306e('0x24')){for(var _0x5e6308 in this[_0x306e('0x11')]){if(this[_0x306e('0x11')][_0x306e('0x25')](_0x5e6308)){if(_0x1d5594['exten']===this[_0x306e('0x11')][_0x5e6308][_0x306e('0x26')]){this[_0x306e('0x10')][_0x1d5594[_0x306e('0x27')]]={};this['channels'][_0x1d5594[_0x306e('0x27')]][_0x306e('0x28')]=_0x1d5594['channel'];this[_0x306e('0x10')][_0x1d5594[_0x306e('0x27')]]['id']=this[_0x306e('0x11')][_0x5e6308]['id'];this[_0x306e('0x10')][_0x1d5594[_0x306e('0x27')]][_0x306e('0x29')]=this[_0x306e('0x11')][_0x5e6308][_0x306e('0x29')];logger[_0x306e('0x2a')](_0x1d5594[_0x306e('0x27')],_0x306e('0x2b'));}}}}if(this[_0x306e('0x13')][_0x1d5594['uniqueid']]){this['channels'][_0x1d5594[_0x306e('0x27')]]={};this[_0x306e('0x10')][_0x1d5594[_0x306e('0x27')]]['channel']=_0x1d5594[_0x306e('0x28')];logger['info'](_0x1d5594[_0x306e('0x27')],_0x306e('0x2b'));}};Fax[_0x306e('0x2c')]['syncVarSet']=function(_0x4bad99){if(this[_0x306e('0x10')][_0x4bad99[_0x306e('0x27')]]){for(var _0x2ed23a in _0x4bad99['variable']){if(_0x4bad99['variable'][_0x306e('0x25')](_0x2ed23a)){this['channels'][_0x4bad99[_0x306e('0x27')]][_0x2ed23a]=_0x4bad99[_0x306e('0x2d')];}}}};Fax[_0x306e('0x2c')][_0x306e('0x2e')]=function(_0x58eedc){if(this[_0x306e('0x10')][_0x58eedc['uniqueid']]){this[_0x306e('0x10')][_0x58eedc[_0x306e('0x27')]]['channelstate']=_0x58eedc['channelstate'];this[_0x306e('0x10')][_0x58eedc[_0x306e('0x27')]]['channelstatedesc']=_0x58eedc[_0x306e('0x2f')];}};Fax[_0x306e('0x2c')][_0x306e('0x1b')]=function(_0x4dfc8c){if(this[_0x306e('0x10')][_0x4dfc8c['uniqueid']]){for(var _0x2a7295 in _0x4dfc8c[_0x306e('0x30')]){if(_0x4dfc8c[_0x306e('0x30')]['hasOwnProperty'](_0x2a7295)){this['channels'][_0x4dfc8c[_0x306e('0x27')]][_0x2a7295]=_0x4dfc8c[_0x306e('0x2d')];}}}};Fax[_0x306e('0x2c')][_0x306e('0x1d')]=function(_0x1de9e2){if(this[_0x306e('0x10')][_0x1de9e2[_0x306e('0x27')]]){this[_0x306e('0x10')][_0x1de9e2[_0x306e('0x27')]]['operation']=_0x1de9e2[_0x306e('0x31')];this[_0x306e('0x10')][_0x1de9e2[_0x306e('0x27')]][_0x306e('0x32')]=_0x1de9e2[_0x306e('0x32')];this[_0x306e('0x10')][_0x1de9e2[_0x306e('0x27')]][_0x306e('0x26')]=_0x1de9e2[_0x306e('0x26')];this['channels'][_0x1de9e2['uniqueid']][_0x306e('0x33')]=_0x1de9e2[_0x306e('0x33')];logger[_0x306e('0x2a')](_0x1de9e2[_0x306e('0x27')],'\x20syncFaxStatus\x20');}};Fax[_0x306e('0x2c')][_0x306e('0x1f')]=function(_0x288f6f){var _0x532e14=this;if(this[_0x306e('0x10')][_0x288f6f['uniqueid']]){var _0x139a03=this['channels'][_0x288f6f[_0x306e('0x27')]]['id'];this[_0x306e('0x10')][_0x288f6f[_0x306e('0x27')]][_0x306e('0x34')]=_0x288f6f[_0x306e('0x34')];this[_0x306e('0x10')][_0x288f6f['uniqueid']][_0x306e('0x35')]=_0x288f6f[_0x306e('0x35')];this[_0x306e('0x10')][_0x288f6f[_0x306e('0x27')]]['localstationid']=_0x288f6f['localstationid'];this['channels'][_0x288f6f[_0x306e('0x27')]]['resolution']=_0x288f6f[_0x306e('0x36')];this['channels'][_0x288f6f[_0x306e('0x27')]][_0x306e('0x37')]=_0x288f6f[_0x306e('0x37')];this[_0x306e('0x10')][_0x288f6f[_0x306e('0x27')]][_0x306e('0x33')]=_0x288f6f[_0x306e('0x33')];this[_0x306e('0x10')][_0x288f6f[_0x306e('0x27')]][_0x306e('0x38')]=_0x288f6f[_0x306e('0x38')];if(this['channels'][_0x288f6f[_0x306e('0x27')]]['pagestransferred']>0x0){tiff2pdf(_0x288f6f[_0x306e('0x33')],'/var/opt/motion2/server/files/attachments/',function(_0x23b0a5){logger['info'](_0x288f6f[_0x306e('0x27')],_0x306e('0x39'),_0x23b0a5[_0x306e('0x3a')]);attachment['create']({'name':path['parse'](_0x288f6f[_0x306e('0x33')])[_0x306e('0x29')],'basename':path[_0x306e('0x3b')](_0x288f6f[_0x306e('0x33')])[_0x306e('0x29')]+_0x306e('0x3c'),'type':_0x306e('0x3d')})[_0x306e('0x3e')](function(_0x3a810e){faxAccount[_0x306e('0x3f')](_0x139a03,{'from':_0x288f6f['calleridnum'],'mapKey':_0x306e('0x8'),'body':path[_0x306e('0x3b')](_0x288f6f[_0x306e('0x33')])[_0x306e('0x29')]+_0x306e('0x3c'),'AttachmentId':_0x3a810e['id']})[_0x306e('0x40')](function(_0x2f3803){logger[_0x306e('0x41')](_0x288f6f['uniqueid'],_0x306e('0x42'),JSON[_0x306e('0x43')](_0x2f3803));});})[_0x306e('0x40')](function(_0x699397){logger['error'](_0x288f6f['uniqueid'],_0x306e('0x44'),JSON['stringify'](_0x699397));});});}logger[_0x306e('0x2a')](_0x288f6f[_0x306e('0x27')],'\x20receiveFax\x20');}};Fax[_0x306e('0x2c')][_0x306e('0x22')]=function(_0x3aadd5){if(this[_0x306e('0x13')][_0x3aadd5['uniqueid']]){_[_0x306e('0x45')](this['channels'][_0x3aadd5[_0x306e('0x27')]],_[_0x306e('0x46')](_0x3aadd5,[_0x306e('0x47'),_0x306e('0x48')]));}};function updateStatus(_0x1ac225){if(_0x1ac225[_0x306e('0x49')]){faxMessage[_0x306e('0x4a')](_0x1ac225['AttachmentId'],{'failMessage':_0x306e('0x4b')})['then'](function(_0x13d93b){ut[_0x306e('0x4c')](_0x306e('0x4d'),_0x13d93b);})[_0x306e('0x40')](function(_0x1ce7e1){ut['logger'](_0x306e('0x4e'),_0x1ce7e1);});}else{ut['logger'](_0x306e('0x4f'));}}Fax[_0x306e('0x2c')]['updateStatus']=function(_0x59e1a5,_0x3d3150,_0x26d561){var _0x17f93c=this;var _0x20268b={};if(_0x3d3150){_0x20268b={'read':_0x3d3150};}else{_0x20268b={'failMessage':_0x26d561};}if(this[_0x306e('0x13')][_0x59e1a5][_0x306e('0x49')]){faxMessage[_0x306e('0x4a')](this[_0x306e('0x13')][_0x59e1a5][_0x306e('0x49')],_0x20268b)[_0x306e('0x3e')](function(_0x24facb){ut['logger'](_0x306e('0x50'),_0x24facb);})[_0x306e('0x40')](function(_0x5675df){ut[_0x306e('0x4c')]('[Fax][Message][NoUpdate1]',_0x5675df);})[_0x306e('0x51')](function(){delete _0x17f93c[_0x306e('0x10')][_0x59e1a5];delete _0x17f93c[_0x306e('0x13')][_0x59e1a5];});}else{ut[_0x306e('0x4c')](_0x306e('0x52'));delete this[_0x306e('0x10')][_0x59e1a5];delete this['actions'][_0x59e1a5];}};Fax[_0x306e('0x2c')][_0x306e('0x53')]=function(_0x5b64ab){var _0x1b26b1=this;if(this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]]){if(this[_0x306e('0x13')][_0x5b64ab['uniqueid']]){this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]]['id']=this[_0x306e('0x13')][_0x5b64ab[_0x306e('0x27')]]['id'];this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x29')]=this[_0x306e('0x13')][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x29')];}logger[_0x306e('0x2a')](_0x5b64ab[_0x306e('0x27')],this[_0x306e('0x13')][_0x5b64ab[_0x306e('0x27')]]?_0x306e('0x54'):'\x20hangup\x20faxRiceive\x20',JSON[_0x306e('0x43')](this[_0x306e('0x10')][_0x5b64ab['uniqueid']]));if(this[_0x306e('0x13')][_0x5b64ab[_0x306e('0x27')]]){if(this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x55')]>0x0&&this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x1c')]==='SUCCESS'){this[_0x306e('0x56')](_0x5b64ab[_0x306e('0x27')],!![]);}else{this[_0x306e('0x56')](_0x5b64ab['uniqueid'],![],this[_0x306e('0x10')][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x57')]?_0x306e('0x58')+this['channels'][_0x5b64ab[_0x306e('0x27')]][_0x306e('0x57')]:_0x306e('0x59'));}}}};Fax['prototype'][_0x306e('0x5a')]=function(_0x49e01a){var _0x45b2f3=this;return new BPromise(function(_0x2a4a5e,_0x1678d7){_0x45b2f3[_0x306e('0x5b')](_0x49e01a,_0x45b2f3['faxAccounts'][_0x49e01a[_0x306e('0x5c')]])[_0x306e('0x3e')](function(_0x5951f5){ut[_0x306e('0x4c')](_0x306e('0x5d'),_0x5951f5);_0x2a4a5e(ut[_0x306e('0x3a')](_0x306e('0x5e')));})[_0x306e('0x40')](function(_0x25c0e1){ut[_0x306e('0x4c')](_0x306e('0x5f'),_0x25c0e1);updateStatus(_0x49e01a);_0x1678d7(ut['message'](_0x306e('0x60')));});});};Fax[_0x306e('0x2c')]['checkAfterSend']=function(_0x5b49f7){var _0x2cddb7=this;return new BPromise(function(_0x208759,_0x1e71ae){var _0x3bc06f=_0x2cddb7[_0x306e('0x61')](_0x2cddb7['faxAccounts'][_0x5b49f7[_0x306e('0x5c')]]['Trunk'],_0x5b49f7);if(_0x3bc06f[_0x306e('0x62')]){_0x208759(ut[_0x306e('0x3a')](_0x306e('0x63')));}else{_0x1e71ae(ut[_0x306e('0x3a')](_0x3bc06f['message']));}});};function originate(_0x4fe9c9,_0x1b750a,_0x14e1ad){return new BPromise(function(_0x39999b,_0x429c34){if(_0x14e1ad){var _0x2d1e13=util['format'](_0x306e('0x64'),path[_0x306e('0x3b')](_0x4fe9c9[_0x306e('0x4')])[_0x306e('0x29')],_0x4fe9c9[_0x306e('0x4')]);gs['execute'](_0x2d1e13)[_0x306e('0x3e')](function(){_0x4fe9c9[_0x306e('0x4')]=util[_0x306e('0x65')](_0x306e('0x66'),path['parse'](_0x4fe9c9[_0x306e('0x4')])[_0x306e('0x67')],path[_0x306e('0x3b')](_0x4fe9c9[_0x306e('0x4')])[_0x306e('0x29')]);_0x1b750a['XMF-PATH']=_0x4fe9c9[_0x306e('0x4')];ut['logger'](_0x306e('0x68'),'');ami[_0x306e('0x69')](ut[_0x306e('0x6a')](_0x4fe9c9,_0x1b750a))[_0x306e('0x3e')](function(_0x49630f){_0x39999b(_0x49630f);})[_0x306e('0x40')](function(_0x4240d8){_0x429c34(_0x4240d8);});})[_0x306e('0x40')](function(_0x3283e6){_0x429c34(_0x3283e6);});}else{ami[_0x306e('0x69')](ut['variablesAction'](_0x4fe9c9,_0x1b750a))[_0x306e('0x3e')](function(_0x2c30cb){_0x39999b(_0x2c30cb);})[_0x306e('0x40')](function(_0x5355a6){_0x429c34(_0x5355a6);});}});}Fax[_0x306e('0x2c')]['execOriginate']=function(_0x3e7fce,_0x1ccebb){var _0x3614d7=this;return new BPromise(function(_0x31d2ac,_0x5d70e4){var _0x3782a8=uuid['v4']();var _0x1521f5=ut[_0x306e('0x6b')](_0x3e7fce,_0x1ccebb);_0x3614d7[_0x306e('0x13')][_0x3782a8]=new Action(_0x3782a8,_0x1ccebb,_0x3e7fce);var _0x26059d=_0x3614d7[_0x306e('0x13')][_0x3782a8];if(path[_0x306e('0x3b')](_0x3e7fce[_0x306e('0x4')])['ext']===_0x306e('0x3c')){originate(_0x26059d,_0x1521f5,!![])['then'](function(_0xda1e6a){_0x31d2ac(_0xda1e6a);})[_0x306e('0x40')](function(_0x1d99da){_0x5d70e4(_0x1d99da);});}else{originate(_0x26059d,_0x1521f5,![])[_0x306e('0x3e')](function(_0x430df9){_0x31d2ac(_0x430df9);})['catch'](function(_0x4cf554){_0x5d70e4(_0x4cf554);});}});};Fax[_0x306e('0x2c')][_0x306e('0x6c')]=function(_0x720558){return!_[_0x306e('0x6d')](_0x720558)&&!_['isNil'](_0x720558[_0x306e('0x29')])&&!_[_0x306e('0x6d')](_0x720558['active'])&&_0x720558['active']&&!_['isNil'](this[_0x306e('0x12')][util[_0x306e('0x65')](_0x306e('0x6e'),_0x720558[_0x306e('0x29')])])&&!_[_0x306e('0x6d')](this[_0x306e('0x12')][util['format']('SIP/%s',_0x720558[_0x306e('0x29')])][_0x306e('0x32')])&&(this[_0x306e('0x12')][util[_0x306e('0x65')](_0x306e('0x6e'),_0x720558['name'])]['status']==='reachable'||this[_0x306e('0x12')][util[_0x306e('0x65')](_0x306e('0x6e'),_0x720558['name'])]['status']==='unmonitored');};Fax[_0x306e('0x2c')][_0x306e('0x61')]=function(_0x2eff21,_0x31daed){if(!this['isTrunkReachable'](_0x2eff21)){ut['logger'](_0x306e('0x6f'),_[_0x306e('0x6d')](_0x2eff21)?'':_0x2eff21[_0x306e('0x29')]+_0x306e('0x70'));return{'isValid':![],'message':_0x306e('0x71')};}if(_['isNil'](_0x31daed['fax'])){ut[_0x306e('0x4c')](_0x306e('0x72'),JSON[_0x306e('0x43')](_0x31daed));return{'isValid':![],'message':_0x306e('0x73')};}if(_[_0x306e('0x6d')](_0x31daed[_0x306e('0x4')])){ut[_0x306e('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x306e('0x43')](_0x31daed));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x306e('0x74')]=Fax; \ No newline at end of file +var _0x656d=['update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','XMF-PATH','addVariables','isNil','active','SIP/%s','reachable','isTrunkReachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x656d,0x94));var _0xd656=function(_0xbcc480,_0x2c5c17){_0xbcc480=_0xbcc480-0x0;var _0x1c641e=_0x656d[_0xbcc480];return _0x1c641e;};'use strict';var util=require(_0xd656('0x0'));var _=require(_0xd656('0x1'));var BPromise=require(_0xd656('0x2'));var uuid=require(_0xd656('0x3'));var moment=require(_0xd656('0x4'));var path=require(_0xd656('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xd656('0x6'))(_0xd656('0x7'));var ami=require(_0xd656('0x8'));var rpcDb=require(_0xd656('0x9'));var Channel=require('./channel');var ut=require(_0xd656('0xa'));var Action=require(_0xd656('0xb'));var faxAccount=require(_0xd656('0xc'));var attachment=require(_0xd656('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2ecf62){this['channels']={};this[_0xd656('0xe')]=_0x2ecf62[_0xd656('0xe')];this[_0xd656('0xf')]=_0x2ecf62[_0xd656('0xf')];this[_0xd656('0x10')]={};ami['on'](_0xd656('0x11'),this[_0xd656('0x12')][_0xd656('0x13')](this));ami['on'](_0xd656('0x14'),this[_0xd656('0x15')][_0xd656('0x13')](this));ami['on'](_0xd656('0x16'),this[_0xd656('0x17')]['bind'](this));ami['on'](_0xd656('0x18'),this[_0xd656('0x19')][_0xd656('0x13')](this));ami['on'](_0xd656('0x1a'),this['syncFaxStatus']['bind'](this));ami['on'](_0xd656('0x1b'),this[_0xd656('0x1c')][_0xd656('0x13')](this));ami['on'](_0xd656('0x1d'),this[_0xd656('0x1e')]['bind'](this));ami['on'](_0xd656('0x1f'),this['syncOriginateResponse'][_0xd656('0x13')](this));}Fax[_0xd656('0x20')][_0xd656('0x12')]=function(_0x1122ff){if(_0x1122ff['context']===_0xd656('0x21')){for(var _0x4b738f in this[_0xd656('0xe')]){if(this[_0xd656('0xe')][_0xd656('0x22')](_0x4b738f)){if(_0x1122ff[_0xd656('0x23')]===this[_0xd656('0xe')][_0x4b738f][_0xd656('0x24')]){this[_0xd656('0x25')][_0x1122ff[_0xd656('0x26')]]={};this[_0xd656('0x25')][_0x1122ff[_0xd656('0x26')]][_0xd656('0x27')]=_0x1122ff[_0xd656('0x27')];this[_0xd656('0x25')][_0x1122ff[_0xd656('0x26')]]['id']=this[_0xd656('0xe')][_0x4b738f]['id'];this[_0xd656('0x25')][_0x1122ff[_0xd656('0x26')]]['name']=this[_0xd656('0xe')][_0x4b738f][_0xd656('0x28')];logger[_0xd656('0x29')](_0x1122ff[_0xd656('0x26')],_0xd656('0x2a'));}}}}if(this[_0xd656('0x10')][_0x1122ff['uniqueid']]){this[_0xd656('0x25')][_0x1122ff['uniqueid']]={};this[_0xd656('0x25')][_0x1122ff['uniqueid']][_0xd656('0x27')]=_0x1122ff[_0xd656('0x27')];logger[_0xd656('0x29')](_0x1122ff[_0xd656('0x26')],_0xd656('0x2a'));}};Fax['prototype'][_0xd656('0x15')]=function(_0x57ce41){if(this['channels'][_0x57ce41[_0xd656('0x26')]]){for(var _0x5800f9 in _0x57ce41[_0xd656('0x2b')]){if(_0x57ce41[_0xd656('0x2b')][_0xd656('0x22')](_0x5800f9)){this[_0xd656('0x25')][_0x57ce41[_0xd656('0x26')]][_0x5800f9]=_0x57ce41[_0xd656('0x2c')];}}}};Fax[_0xd656('0x20')][_0xd656('0x17')]=function(_0x24cd41){if(this[_0xd656('0x25')][_0x24cd41[_0xd656('0x26')]]){this[_0xd656('0x25')][_0x24cd41[_0xd656('0x26')]][_0xd656('0x2d')]=_0x24cd41['channelstate'];this['channels'][_0x24cd41[_0xd656('0x26')]][_0xd656('0x2e')]=_0x24cd41['channelstatedesc'];}};Fax[_0xd656('0x20')][_0xd656('0x19')]=function(_0xd74477){if(this[_0xd656('0x25')][_0xd74477['uniqueid']]){for(var _0x38c4f3 in _0xd74477[_0xd656('0x2b')]){if(_0xd74477[_0xd656('0x2b')]['hasOwnProperty'](_0x38c4f3)){this[_0xd656('0x25')][_0xd74477[_0xd656('0x26')]][_0x38c4f3]=_0xd74477['value'];}}}};Fax[_0xd656('0x20')][_0xd656('0x2f')]=function(_0x46e26f){if(this[_0xd656('0x25')][_0x46e26f[_0xd656('0x26')]]){this[_0xd656('0x25')][_0x46e26f[_0xd656('0x26')]][_0xd656('0x30')]=_0x46e26f[_0xd656('0x30')];this[_0xd656('0x25')][_0x46e26f[_0xd656('0x26')]][_0xd656('0x31')]=_0x46e26f[_0xd656('0x31')];this['channels'][_0x46e26f[_0xd656('0x26')]][_0xd656('0x24')]=_0x46e26f['localstationid'];this[_0xd656('0x25')][_0x46e26f[_0xd656('0x26')]][_0xd656('0x32')]=_0x46e26f[_0xd656('0x32')];logger[_0xd656('0x29')](_0x46e26f['uniqueid'],_0xd656('0x33'));}};Fax[_0xd656('0x20')][_0xd656('0x1c')]=function(_0x8bedfa){var _0x519bc1=this;if(this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]]){var _0x2e601f=this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]]['id'];this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]][_0xd656('0x34')]=_0x8bedfa[_0xd656('0x34')];this[_0xd656('0x25')][_0x8bedfa['uniqueid']][_0xd656('0x35')]=_0x8bedfa[_0xd656('0x35')];this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]][_0xd656('0x24')]=_0x8bedfa[_0xd656('0x24')];this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]][_0xd656('0x36')]=_0x8bedfa['resolution'];this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]][_0xd656('0x37')]=_0x8bedfa[_0xd656('0x37')];this[_0xd656('0x25')][_0x8bedfa[_0xd656('0x26')]]['filename']=_0x8bedfa[_0xd656('0x32')];this[_0xd656('0x25')][_0x8bedfa['uniqueid']]['calleridnum']=_0x8bedfa[_0xd656('0x38')];if(this[_0xd656('0x25')][_0x8bedfa['uniqueid']][_0xd656('0x35')]>0x0){tiff2pdf(_0x8bedfa[_0xd656('0x32')],_0xd656('0x39'),function(_0x340143){logger['info'](_0x8bedfa['uniqueid'],_0xd656('0x3a'),_0x340143['message']);attachment[_0xd656('0x3b')]({'name':path[_0xd656('0x3c')](_0x8bedfa[_0xd656('0x32')])[_0xd656('0x28')],'basename':path[_0xd656('0x3c')](_0x8bedfa[_0xd656('0x32')])[_0xd656('0x28')]+_0xd656('0x3d'),'type':_0xd656('0x3e')})[_0xd656('0x3f')](function(_0x47676c){faxAccount[_0xd656('0x40')](_0x2e601f,{'from':_0x8bedfa[_0xd656('0x38')],'mapKey':_0xd656('0x7'),'body':path[_0xd656('0x3c')](_0x8bedfa['filename'])[_0xd656('0x28')]+'.pdf','AttachmentId':_0x47676c['id']})[_0xd656('0x41')](function(_0x507eb6){logger[_0xd656('0x42')](_0x8bedfa['uniqueid'],'\x20notify\x20',JSON[_0xd656('0x43')](_0x507eb6));});})[_0xd656('0x41')](function(_0x34750e){logger['error'](_0x8bedfa[_0xd656('0x26')],_0xd656('0x44'),JSON['stringify'](_0x34750e));});});}logger[_0xd656('0x29')](_0x8bedfa['uniqueid'],_0xd656('0x44'));}};Fax[_0xd656('0x20')]['syncOriginateResponse']=function(_0xc7b39d){if(this['actions'][_0xc7b39d['uniqueid']]){_[_0xd656('0x45')](this['channels'][_0xc7b39d[_0xd656('0x26')]],_[_0xd656('0x46')](_0xc7b39d,['response',_0xd656('0x47')]));}};function updateStatus(_0x3209a6){if(_0x3209a6[_0xd656('0x48')]){faxMessage['update'](_0x3209a6[_0xd656('0x48')],{'failMessage':_0xd656('0x49')})[_0xd656('0x3f')](function(_0x49d956){ut[_0xd656('0x4a')](_0xd656('0x4b'),_0x49d956);})['catch'](function(_0x500947){ut[_0xd656('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0x500947);});}else{ut[_0xd656('0x4a')](_0xd656('0x4c'));}}Fax[_0xd656('0x20')][_0xd656('0x4d')]=function(_0x20fb92,_0x553e07,_0x3e054a){var _0x1a937e=this;var _0x15fedc={};if(_0x553e07){_0x15fedc={'read':_0x553e07};}else{_0x15fedc={'failMessage':_0x3e054a};}if(this[_0xd656('0x10')][_0x20fb92][_0xd656('0x48')]){faxMessage[_0xd656('0x4e')](this[_0xd656('0x10')][_0x20fb92][_0xd656('0x48')],_0x15fedc)[_0xd656('0x3f')](function(_0x5457f3){ut['logger'](_0xd656('0x4f'),_0x5457f3);})[_0xd656('0x41')](function(_0x8eb6cb){ut[_0xd656('0x4a')]('[Fax][Message][NoUpdate1]',_0x8eb6cb);})[_0xd656('0x50')](function(){delete _0x1a937e[_0xd656('0x25')][_0x20fb92];delete _0x1a937e[_0xd656('0x10')][_0x20fb92];});}else{ut[_0xd656('0x4a')](_0xd656('0x51'));delete this[_0xd656('0x25')][_0x20fb92];delete this['actions'][_0x20fb92];}};Fax[_0xd656('0x20')][_0xd656('0x1e')]=function(_0x406786){var _0x3d6c3c=this;if(this[_0xd656('0x25')][_0x406786['uniqueid']]){if(this[_0xd656('0x10')][_0x406786[_0xd656('0x26')]]){this[_0xd656('0x25')][_0x406786[_0xd656('0x26')]]['id']=this[_0xd656('0x10')][_0x406786[_0xd656('0x26')]]['id'];this[_0xd656('0x25')][_0x406786[_0xd656('0x26')]][_0xd656('0x28')]=this['actions'][_0x406786[_0xd656('0x26')]][_0xd656('0x28')];}logger[_0xd656('0x29')](_0x406786[_0xd656('0x26')],this[_0xd656('0x10')][_0x406786[_0xd656('0x26')]]?_0xd656('0x52'):_0xd656('0x53'),JSON[_0xd656('0x43')](this[_0xd656('0x25')][_0x406786[_0xd656('0x26')]]));if(this[_0xd656('0x10')][_0x406786[_0xd656('0x26')]]){if(this['channels'][_0x406786[_0xd656('0x26')]][_0xd656('0x54')]>0x0&&this[_0xd656('0x25')][_0x406786[_0xd656('0x26')]][_0xd656('0x1a')]==='SUCCESS'){this['updateStatus'](_0x406786[_0xd656('0x26')],!![]);}else{this[_0xd656('0x4d')](_0x406786[_0xd656('0x26')],![],this[_0xd656('0x25')][_0x406786['uniqueid']][_0xd656('0x55')]?'SENDING\x20FAILED:\x20'+this[_0xd656('0x25')][_0x406786[_0xd656('0x26')]][_0xd656('0x55')]:'SENDING\x20FAILED');}}}};Fax[_0xd656('0x20')][_0xd656('0x56')]=function(_0x51d481){var _0x575874=this;return new BPromise(function(_0x24b84a,_0x5e5a04){_0x575874[_0xd656('0x57')](_0x51d481,_0x575874[_0xd656('0xe')][_0x51d481[_0xd656('0x58')]])[_0xd656('0x3f')](function(_0x143317){ut[_0xd656('0x4a')](_0xd656('0x59'),_0x143317);_0x24b84a(ut[_0xd656('0x5a')](_0xd656('0x5b')));})[_0xd656('0x41')](function(_0x4aef55){ut[_0xd656('0x4a')](_0xd656('0x5c'),_0x4aef55);updateStatus(_0x51d481);_0x5e5a04(ut[_0xd656('0x5a')]('Fax\x20failed'));});});};Fax['prototype'][_0xd656('0x5d')]=function(_0xbff19e){var _0x5cfb48=this;return new BPromise(function(_0xcdd11a,_0x3c84eb){var _0x3da76b=_0x5cfb48[_0xd656('0x5e')](_0x5cfb48[_0xd656('0xe')][_0xbff19e[_0xd656('0x58')]][_0xd656('0x5f')],_0xbff19e);if(_0x3da76b[_0xd656('0x60')]){_0xcdd11a(ut['message']('Trunk\x20Reachable'));}else{_0x3c84eb(ut['message'](_0x3da76b[_0xd656('0x5a')]));}});};function originate(_0x34e373,_0x55b5f8,_0x41e567){return new BPromise(function(_0xb708cf,_0x2621b1){if(_0x41e567){var _0x1197a3=util[_0xd656('0x61')](_0xd656('0x62'),path[_0xd656('0x3c')](_0x34e373[_0xd656('0x5')])[_0xd656('0x28')],_0x34e373[_0xd656('0x5')]);gs['execute'](_0x1197a3)['then'](function(){_0x34e373[_0xd656('0x5')]=util[_0xd656('0x61')]('%s/%s.tif',path[_0xd656('0x3c')](_0x34e373[_0xd656('0x5')])['dir'],path[_0xd656('0x3c')](_0x34e373[_0xd656('0x5')])[_0xd656('0x28')]);_0x55b5f8[_0xd656('0x63')]=_0x34e373[_0xd656('0x5')];ut[_0xd656('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x34e373,_0x55b5f8))[_0xd656('0x3f')](function(_0x2761f2){_0xb708cf(_0x2761f2);})[_0xd656('0x41')](function(_0x53a006){_0x2621b1(_0x53a006);});})[_0xd656('0x41')](function(_0xdfe066){_0x2621b1(_0xdfe066);});}else{ami['Action'](ut['variablesAction'](_0x34e373,_0x55b5f8))['then'](function(_0x57dbb8){_0xb708cf(_0x57dbb8);})[_0xd656('0x41')](function(_0x8f0f30){_0x2621b1(_0x8f0f30);});}});}Fax[_0xd656('0x20')]['execOriginate']=function(_0x39d50e,_0x1baadf){var _0x3bae03=this;return new BPromise(function(_0x364b53,_0x51e775){var _0x4cece4=uuid['v4']();var _0x3d4b08=ut[_0xd656('0x64')](_0x39d50e,_0x1baadf);_0x3bae03['actions'][_0x4cece4]=new Action(_0x4cece4,_0x1baadf,_0x39d50e);var _0x33a645=_0x3bae03[_0xd656('0x10')][_0x4cece4];if(path[_0xd656('0x3c')](_0x39d50e[_0xd656('0x5')])['ext']===_0xd656('0x3d')){originate(_0x33a645,_0x3d4b08,!![])[_0xd656('0x3f')](function(_0xc16724){_0x364b53(_0xc16724);})['catch'](function(_0x5a4ebf){_0x51e775(_0x5a4ebf);});}else{originate(_0x33a645,_0x3d4b08,![])[_0xd656('0x3f')](function(_0x2a6c32){_0x364b53(_0x2a6c32);})[_0xd656('0x41')](function(_0x661b29){_0x51e775(_0x661b29);});}});};Fax[_0xd656('0x20')]['isTrunkReachable']=function(_0x131029){return!_['isNil'](_0x131029)&&!_['isNil'](_0x131029[_0xd656('0x28')])&&!_[_0xd656('0x65')](_0x131029[_0xd656('0x66')])&&_0x131029[_0xd656('0x66')]&&!_[_0xd656('0x65')](this[_0xd656('0xf')][util['format'](_0xd656('0x67'),_0x131029['name'])])&&!_['isNil'](this[_0xd656('0xf')][util[_0xd656('0x61')](_0xd656('0x67'),_0x131029[_0xd656('0x28')])]['status'])&&(this[_0xd656('0xf')][util[_0xd656('0x61')](_0xd656('0x67'),_0x131029['name'])]['status']===_0xd656('0x68')||this['trunks'][util[_0xd656('0x61')](_0xd656('0x67'),_0x131029[_0xd656('0x28')])][_0xd656('0x31')]==='unmonitored');};Fax[_0xd656('0x20')][_0xd656('0x5e')]=function(_0x4c2454,_0x165525){if(!this[_0xd656('0x69')](_0x4c2454)){ut[_0xd656('0x4a')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xd656('0x65')](_0x4c2454)?'':_0x4c2454['name']+_0xd656('0x6a'));return{'isValid':![],'message':_0xd656('0x6b')};}if(_[_0xd656('0x65')](_0x165525[_0xd656('0x7')])){ut['logger'](_0xd656('0x6c'),JSON[_0xd656('0x43')](_0x165525));return{'isValid':![],'message':_0xd656('0x6d')};}if(_[_0xd656('0x65')](_0x165525[_0xd656('0x5')])){ut[_0xd656('0x4a')](_0xd656('0x6e'),JSON['stringify'](_0x165525));return{'isValid':![],'message':_0xd656('0x6f')};}return{'isValid':!![],'message':_0xd656('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 83a5a9b..38d6f03 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 _0x033b=['then','catch','[Notify]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x558990,_0x295dd8){var _0xeca7f6=function(_0x12f74e){while(--_0x12f74e){_0x558990['push'](_0x558990['shift']());}};_0xeca7f6(++_0x295dd8);}(_0x033b,0x7b));var _0xb033=function(_0x22f4bd,_0x2b7153){_0x22f4bd=_0x22f4bd-0x0;var _0x2c4a49=_0x033b[_0x22f4bd];return _0x2c4a49;};'use strict';var util=require('util');var BPromise=require(_0xb033('0x0'));var logger=require(_0xb033('0x1'))(_0xb033('0x2'));var _=require(_0xb033('0x3'));var faxAccount=require(_0xb033('0x4'));function loggerCatch(_0x4447c8){return function(_0x281e28){logger[_0xb033('0x5')](_0x4447c8,util[_0xb033('0x6')](_0x281e28,{'showHidden':![],'depth':null}));};}exports[_0xb033('0x7')]=function(_0x56976f,_0x2fe88e){return BPromise[_0xb033('0x8')]()[_0xb033('0x9')](faxAccount['notify'](_0x56976f,_0x2fe88e))[_0xb033('0xa')](loggerCatch(_0xb033('0xb')));}; \ No newline at end of file +var _0xb6c5=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify'];(function(_0x11d578,_0x2a5e11){var _0x5011df=function(_0x109fee){while(--_0x109fee){_0x11d578['push'](_0x11d578['shift']());}};_0x5011df(++_0x2a5e11);}(_0xb6c5,0x14d));var _0x5b6c=function(_0x4fcdb7,_0x39f7fa){_0x4fcdb7=_0x4fcdb7-0x0;var _0x3264cb=_0xb6c5[_0x4fcdb7];return _0x3264cb;};'use strict';var util=require(_0x5b6c('0x0'));var BPromise=require(_0x5b6c('0x1'));var logger=require(_0x5b6c('0x2'))(_0x5b6c('0x3'));var _=require(_0x5b6c('0x4'));var faxAccount=require(_0x5b6c('0x5'));function loggerCatch(_0x5d775c){return function(_0x521426){logger[_0x5b6c('0x6')](_0x5d775c,util['inspect'](_0x521426,{'showHidden':![],'depth':null}));};}exports[_0x5b6c('0x7')]=function(_0x4525d9,_0x374c2c){return BPromise['resolve']()[_0x5b6c('0x8')](faxAccount[_0x5b6c('0x7')](_0x4525d9,_0x374c2c))[_0x5b6c('0x9')](loggerCatch(_0x5b6c('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9466711..b5c263a 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 _0xf386=['\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process','exec','Exec\x20gs'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xf386,0x1ea));var _0x6f38=function(_0x58e709,_0x1d4e42){_0x58e709=_0x58e709-0x0;var _0x2052f8=_0xf386[_0x58e709];return _0x2052f8;};'use strict';var util=require('util');var logger=require(_0x6f38('0x0'))(_0x6f38('0x1'));var BPromise=require(_0x6f38('0x2'));var exec=require(_0x6f38('0x3'))[_0x6f38('0x4')];exports['execute']=function(_0x154ac8){return new BPromise(function(_0x153671,_0x2e90e1){exec(_0x154ac8,function(_0x116d6c,_0x52fad2,_0x4eb435){logger['info'](_0x6f38('0x5'),_0x52fad2);if(_0x116d6c){logger['info'](_0x6f38('0x5'),_0x6f38('0x6'),util[_0x6f38('0x7')](_0x116d6c,{'showHidden':![],'depth':null}),_0x52fad2,_0x4eb435);_0x2e90e1(_0x116d6c);}_0x153671(_0x52fad2);});});}; \ No newline at end of file +var _0x1bbc=['fax','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x5d3e23,_0x40095f){var _0x299357=function(_0x18602d){while(--_0x18602d){_0x5d3e23['push'](_0x5d3e23['shift']());}};_0x299357(++_0x40095f);}(_0x1bbc,0x1ae));var _0xc1bb=function(_0xc106ce,_0x2c20cc){_0xc106ce=_0xc106ce-0x0;var _0x55260c=_0x1bbc[_0xc106ce];return _0x55260c;};'use strict';var util=require(_0xc1bb('0x0'));var logger=require(_0xc1bb('0x1'))(_0xc1bb('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0xc1bb('0x3')];exports[_0xc1bb('0x4')]=function(_0xa96fe0){return new BPromise(function(_0x5e7c43,_0x1063c8){exec(_0xa96fe0,function(_0x18dbd5,_0x2816f6,_0x48e8af){logger[_0xc1bb('0x5')]('Exec\x20gs',_0x2816f6);if(_0x18dbd5){logger['info'](_0xc1bb('0x6'),_0xc1bb('0x7'),util[_0xc1bb('0x8')](_0x18dbd5,{'showHidden':![],'depth':null}),_0x2816f6,_0x48e8af);_0x1063c8(_0x18dbd5);}_0x5e7c43(_0x2816f6);});});}; \ 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 2e42dd5..ac47e93 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 _0x668b=['../../../../config/logger','fax','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash'];(function(_0xa4602b,_0x2dd435){var _0x5514eb=function(_0x3f987a){while(--_0x3f987a){_0xa4602b['push'](_0xa4602b['shift']());}};_0x5514eb(++_0x2dd435);}(_0x668b,0x140));var _0xb668=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x668b[_0x1deee5];return _0x1d6c3a;};'use strict';var util=require(_0xb668('0x0'));var _=require(_0xb668('0x1'));var moment=require('moment');var logger=require(_0xb668('0x2'))(_0xb668('0x3'));exports['message']=function(_0x336ba4){return{'message':_0x336ba4};};exports['logger']=function(_0x2fab11,_0x4092a6){logger[_0xb668('0x4')](_0x2fab11,util['inspect'](_0x4092a6,{'showHidden':![],'depth':null}));};exports[_0xb668('0x5')]=function(_0x296fa9,_0x3be92e){var _0x2778e9={'XMF-ECM':_0x3be92e[_0xb668('0x6')],'XMF-HEADERINFO':_0x3be92e[_0xb668('0x7')],'XMF-MINRATE':_0x3be92e['minrate'],'XMF-MAXRATE':_0x3be92e[_0xb668('0x8')],'XMF-MODEM':util[_0xb668('0x9')](_0xb668('0xa'),_0x3be92e[_0xb668('0xb')]),'XMF-GATEWAY':_0x3be92e[_0xb668('0xc')],'XMF-FAXDETECT':_0x3be92e[_0xb668('0xd')],'XMF-T38TIMEOUT':_0x3be92e[_0xb668('0xe')],'XMF-LOCALSTATIONID':_0x3be92e[_0xb668('0xf')],'XMF-PATH':_0x296fa9['path']};return _0x2778e9;};exports[_0xb668('0x10')]=function(_0x27dbf7,_0x27de15){return{'actionid':_0x27dbf7[_0xb668('0x11')],'action':_0xb668('0x12'),'channel':_0x27dbf7[_0xb668('0x13')],'Exten':_0xb668('0x14'),'Context':_0xb668('0x15'),'Priority':'1','callerid':util[_0xb668('0x9')](_0xb668('0x16'),_0x27dbf7[_0xb668('0x7')]?_0x27dbf7[_0xb668('0x7')]:'',_0x27dbf7[_0xb668('0xf')]),'variable':_0x27de15,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x27dbf7[_0xb668('0x11')]};}; \ No newline at end of file +var _0xe205=['inspect','addVariables','ecm','maxrate','format','modem','gateway','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','info'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0xe205,0xa7));var _0x5e20=function(_0x2e1966,_0x51a6c2){_0x2e1966=_0x2e1966-0x0;var _0x1bb514=_0xe205[_0x2e1966];return _0x1bb514;};'use strict';var util=require(_0x5e20('0x0'));var _=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var logger=require(_0x5e20('0x3'))(_0x5e20('0x4'));exports[_0x5e20('0x5')]=function(_0x13bace){return{'message':_0x13bace};};exports[_0x5e20('0x6')]=function(_0x37c5e9,_0x4ac934){logger[_0x5e20('0x7')](_0x37c5e9,util[_0x5e20('0x8')](_0x4ac934,{'showHidden':![],'depth':null}));};exports[_0x5e20('0x9')]=function(_0x3c4203,_0x5eca5c){var _0x4cc88d={'XMF-ECM':_0x5eca5c[_0x5e20('0xa')],'XMF-HEADERINFO':_0x5eca5c['headerinfo'],'XMF-MINRATE':_0x5eca5c['minrate'],'XMF-MAXRATE':_0x5eca5c[_0x5e20('0xb')],'XMF-MODEM':util[_0x5e20('0xc')]('\x22%s\x22',_0x5eca5c[_0x5e20('0xd')]),'XMF-GATEWAY':_0x5eca5c[_0x5e20('0xe')],'XMF-FAXDETECT':_0x5eca5c[_0x5e20('0xf')],'XMF-T38TIMEOUT':_0x5eca5c[_0x5e20('0x10')],'XMF-LOCALSTATIONID':_0x5eca5c['localstationid'],'XMF-PATH':_0x3c4203[_0x5e20('0x11')]};return _0x4cc88d;};exports[_0x5e20('0x12')]=function(_0x270689,_0x27f1f9){return{'actionid':_0x270689[_0x5e20('0x13')],'action':_0x5e20('0x14'),'channel':_0x270689['channel'],'Exten':_0x5e20('0x15'),'Context':_0x5e20('0x16'),'Priority':'1','callerid':util[_0x5e20('0xc')]('\x22%s\x22\x20<%s>',_0x270689[_0x5e20('0x17')]?_0x270689['headerinfo']:'',_0x270689[_0x5e20('0x18')]),'variable':_0x27f1f9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x270689['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 08a5795..28312fe 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 _0xf1fc=['initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','log','listen','sync','catch','util','moment','./server','./realtime','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','getTrunks'];(function(_0x2b012b,_0x463e28){var _0x32c4cf=function(_0x5871f2){while(--_0x5871f2){_0x2b012b['push'](_0x2b012b['shift']());}};_0x32c4cf(++_0x463e28);}(_0xf1fc,0xb3));var _0xcf1f=function(_0x7dc5c4,_0x3a9652){_0x7dc5c4=_0x7dc5c4-0x0;var _0x2dbab5=_0xf1fc[_0x7dc5c4];return _0x2dbab5;};'use strict';var BPromise=require('bluebird');var util=require(_0xcf1f('0x0'));var moment=require(_0xcf1f('0x1'));var server=require(_0xcf1f('0x2'));var Realtime=require(_0xcf1f('0x3'));var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0xcf1f('0x4'));var Dialer=require(_0xcf1f('0x5'));var Preview=require('./preview');var Fax=require(_0xcf1f('0x6'));var user=require(_0xcf1f('0x7'));var voiceQueue=require(_0xcf1f('0x8'));var voiceQueueReport=require(_0xcf1f('0x9'));var voiceCallReport=require(_0xcf1f('0xa'));var trunk=require(_0xcf1f('0xb'));var trigger=require(_0xcf1f('0xc'));var template=require(_0xcf1f('0xd'));var cmHopperHistory=require(_0xcf1f('0xe'));var campaign=require(_0xcf1f('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xcf1f('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xcf1f('0x11'));var sugarcrm=require(_0xcf1f('0x12'));var freshdesk=require(_0xcf1f('0x13'));var desk=require(_0xcf1f('0x14'));var zoho=require(_0xcf1f('0x15'));var vtiger=require(_0xcf1f('0x16'));var freshsales=require(_0xcf1f('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xcf1f('0x18'));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()[_0xcf1f('0x19')](_0xcf1f('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcf1f('0x19')](_0xcf1f('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcf1f('0x1b')]()['then'](user[_0xcf1f('0x1c')]())[_0xcf1f('0x1d')](realtime['initAgents']())[_0xcf1f('0x1d')](user['getTelephones']())[_0xcf1f('0x1d')](realtime['initTelephones']())[_0xcf1f('0x1d')](trunk[_0xcf1f('0x1e')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x1f')]())[_0xcf1f('0x1d')](voiceQueue[_0xcf1f('0x20')]())['then'](realtime[_0xcf1f('0x21')]())[_0xcf1f('0x1d')](trigger[_0xcf1f('0x22')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x23')]())[_0xcf1f('0x1d')](template[_0xcf1f('0x24')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x25')]())[_0xcf1f('0x1d')](zendesk[_0xcf1f('0x26')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x27')]())['then'](salesforce['getSalesforceAccounts']())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x28')]())[_0xcf1f('0x1d')](sugarcrm[_0xcf1f('0x29')]())['then'](realtime[_0xcf1f('0x2a')]())[_0xcf1f('0x1d')](freshdesk['getFreshdeskAccounts']())[_0xcf1f('0x1d')](realtime['initFreshdeskAccounts']())[_0xcf1f('0x1d')](desk[_0xcf1f('0x2b')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x2c')]())['then'](zoho[_0xcf1f('0x2d')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x2e')]())['then'](vtiger[_0xcf1f('0x2f')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x30')]())['then'](freshsales[_0xcf1f('0x31')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x32')]())['then'](servicenow[_0xcf1f('0x33')]())['then'](realtime[_0xcf1f('0x34')]())['then'](dynamics365[_0xcf1f('0x35')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x36')]())[_0xcf1f('0x1d')](campaign[_0xcf1f('0x37')]())['then'](realtime['initCampaigns']())['then'](voiceExtension[_0xcf1f('0x38')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x39')]())[_0xcf1f('0x1d')](faxAccount['getFaxAccounts']())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xcf1f('0x1b')]()[_0xcf1f('0x1d')](voiceQueueReport[_0xcf1f('0x3b')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x3c')]())[_0xcf1f('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime[_0xcf1f('0x3d')]())[_0xcf1f('0x1d')](cmHopperHistory[_0xcf1f('0x3e')]())[_0xcf1f('0x1d')](realtime[_0xcf1f('0x3f')]())[_0xcf1f('0x1d')](voiceCallReport[_0xcf1f('0x40')]())['then'](realtime[_0xcf1f('0x41')]())[_0xcf1f('0x1d')](function(_0x3f7e9d){})['catch'](function(_0x57c518){console[_0xcf1f('0x42')](_0x57c518);});}function main(){return server[_0xcf1f('0x43')](realtime,preview,fax)[_0xcf1f('0x1d')](function(_0x4929e8){return initRealtime();})[_0xcf1f('0x1d')](function(){return initParams();})[_0xcf1f('0x1d')](function(){report[_0xcf1f('0x44')]();setInterval(initRealtime,0x1388);})[_0xcf1f('0x45')](function(_0x250ff0){console['log'](_0x250ff0);});}main(); \ No newline at end of file +var _0xb2fb=['initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/trunk','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x2fb68a,_0x2598dc){var _0x2cac25=function(_0x154f87){while(--_0x154f87){_0x2fb68a['push'](_0x2fb68a['shift']());}};_0x2cac25(++_0x2598dc);}(_0xb2fb,0x112));var _0xbb2f=function(_0x1bea0f,_0x4e2edb){_0x1bea0f=_0x1bea0f-0x0;var _0xd24123=_0xb2fb[_0x1bea0f];return _0xd24123;};'use strict';var BPromise=require(_0xbb2f('0x0'));var util=require(_0xbb2f('0x1'));var moment=require(_0xbb2f('0x2'));var server=require(_0xbb2f('0x3'));var Realtime=require(_0xbb2f('0x4'));var Report=require(_0xbb2f('0x5'));var Acw=require('./acw');var Trigger=require(_0xbb2f('0x6'));var Dialer=require(_0xbb2f('0x7'));var Preview=require(_0xbb2f('0x8'));var Fax=require('./fax');var user=require(_0xbb2f('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xbb2f('0xa'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xbb2f('0xb'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xbb2f('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xbb2f('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xbb2f('0xe'));var desk=require(_0xbb2f('0xf'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xbb2f('0x10'));var freshsales=require(_0xbb2f('0x11'));var servicenow=require(_0xbb2f('0x12'));var dynamics365=require('./rpc/integrations/dynamics365');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()[_0xbb2f('0x13')](_0xbb2f('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbb2f('0x13')](_0xbb2f('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xbb2f('0x15')]()[_0xbb2f('0x16')](user['getAgents']())[_0xbb2f('0x16')](realtime[_0xbb2f('0x17')]())['then'](user[_0xbb2f('0x18')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x19')]())[_0xbb2f('0x16')](trunk[_0xbb2f('0x1a')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x1b')]())[_0xbb2f('0x16')](voiceQueue[_0xbb2f('0x1c')]())[_0xbb2f('0x16')](realtime['initVoiceQueues']())[_0xbb2f('0x16')](trigger[_0xbb2f('0x1d')]())['then'](realtime[_0xbb2f('0x1e')]())['then'](template[_0xbb2f('0x1f')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x20')]())[_0xbb2f('0x16')](zendesk[_0xbb2f('0x21')]())[_0xbb2f('0x16')](realtime['initZendeskAccounts']())[_0xbb2f('0x16')](salesforce[_0xbb2f('0x22')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x23')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0xbb2f('0x16')](realtime[_0xbb2f('0x24')]())[_0xbb2f('0x16')](freshdesk['getFreshdeskAccounts']())['then'](realtime[_0xbb2f('0x25')]())[_0xbb2f('0x16')](desk[_0xbb2f('0x26')]())['then'](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0xbb2f('0x16')](realtime[_0xbb2f('0x27')]())[_0xbb2f('0x16')](vtiger[_0xbb2f('0x28')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x29')]())['then'](freshsales[_0xbb2f('0x2a')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x2b')]())[_0xbb2f('0x16')](servicenow[_0xbb2f('0x2c')]())['then'](realtime['initServicenowAccounts']())['then'](dynamics365[_0xbb2f('0x2d')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x2e')]())[_0xbb2f('0x16')](campaign[_0xbb2f('0x2f')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x30')]())[_0xbb2f('0x16')](voiceExtension[_0xbb2f('0x31')]())[_0xbb2f('0x16')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xbb2f('0x32')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x33')]())[_0xbb2f('0x16')](function(){return realtime;});}function initParams(){return BPromise[_0xbb2f('0x15')]()['then'](voiceQueueReport[_0xbb2f('0x34')]())[_0xbb2f('0x16')](realtime[_0xbb2f('0x35')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xbb2f('0x16')](realtime[_0xbb2f('0x36')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xbb2f('0x16')](realtime[_0xbb2f('0x37')]())[_0xbb2f('0x16')](voiceCallReport[_0xbb2f('0x38')]())['then'](realtime[_0xbb2f('0x39')]())[_0xbb2f('0x16')](function(_0x820b3a){})[_0xbb2f('0x3a')](function(_0x5af8b3){console[_0xbb2f('0x3b')](_0x5af8b3);});}function main(){return server[_0xbb2f('0x3c')](realtime,preview,fax)[_0xbb2f('0x16')](function(_0xd8035a){return initRealtime();})[_0xbb2f('0x16')](function(){return initParams();})[_0xbb2f('0x16')](function(){report[_0xbb2f('0x3d')]();setInterval(initRealtime,0x1388);})[_0xbb2f('0x3a')](function(_0x398b37){console[_0xbb2f('0x3b')](_0x398b37);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 8d697c4..98cf282 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 _0xd4e7=['toNumber','format','voiceStatusTime','interface','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','online','voiceStatus','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','state','idle','statePause'];(function(_0x3b9adc,_0x4e2225){var _0x2fd980=function(_0x4c9d6a){while(--_0x4c9d6a){_0x3b9adc['push'](_0x3b9adc['shift']());}};_0x2fd980(++_0x4e2225);}(_0xd4e7,0x195));var _0x7d4e=function(_0x38df77,_0x4cc343){_0x38df77=_0x38df77-0x0;var _0x510806=_0xd4e7[_0x38df77];return _0x510806;};'use strict';var _=require(_0x7d4e('0x0'));var util=require(_0x7d4e('0x1'));var moment=require(_0x7d4e('0x2'));var md5=require(_0x7d4e('0x3'));var Redis=require(_0x7d4e('0x4'));var config=require('../../../config/environment');config[_0x7d4e('0x5')]=_['defaults'](config[_0x7d4e('0x5')],{'host':_0x7d4e('0x6'),'port':0x18eb});var io=require(_0x7d4e('0x7'))(new Redis(config[_0x7d4e('0x5')]));function Agent(_0x1c3e72){this['id']=_0x1c3e72['id']||0x0;this[_0x7d4e('0x8')]=_0x1c3e72[_0x7d4e('0x8')]||'';this[_0x7d4e('0x9')]=_0x1c3e72[_0x7d4e('0x9')]||'';this[_0x7d4e('0xa')]=_0x1c3e72[_0x7d4e('0xa')]||'';this[_0x7d4e('0xb')]=_0x1c3e72['fullname']||'';this['state']='unknown';this[_0x7d4e('0xc')]=0x0;this[_0x7d4e('0xd')]=_0x7d4e('0xe');this[_0x7d4e('0xf')]='';this[_0x7d4e('0x10')]='';this[_0x7d4e('0x11')]='';this['interface']='';this[_0x7d4e('0x12')]=_0x1c3e72[_0x7d4e('0x12')]||![];this[_0x7d4e('0x13')]=_0x7d4e('0xe');this['voiceStatusTime']=0x0;this[_0x7d4e('0x14')]='';this[_0x7d4e('0x15')]='';this[_0x7d4e('0x16')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x7d4e('0x17')]=function(_0x364869){var _0x18ab8b;if(_0x364869&&_0x364869[_0x7d4e('0x18')]){_0x18ab8b=_0x364869[_0x7d4e('0x18')]['toLowerCase']();switch(_0x18ab8b){case'not_inuse':_0x18ab8b=_0x7d4e('0x19');break;case'inuse':_0x18ab8b='talking';break;}}if(_0x18ab8b&&this[_0x7d4e('0x13')]!==_0x18ab8b||_0x364869[_0x7d4e('0x1a')]){this['voiceStatusTime']=_[_0x7d4e('0x1b')](moment()[_0x7d4e('0x1c')]('x'));}if(_0x18ab8b){this['voiceStatus']=_0x18ab8b;}var _0x3469e1={'id':this['id'],'name':this[_0x7d4e('0x8')],'email':this[_0x7d4e('0x9')],'accountcode':this[_0x7d4e('0xa')],'fullname':this[_0x7d4e('0xb')],'state':this['state'],'stateTime':this[_0x7d4e('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x7d4e('0x12')],'voiceStatus':this[_0x7d4e('0x13')],'voiceStatusTime':this[_0x7d4e('0x1d')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x7d4e('0x15')],'interface':this[_0x7d4e('0x1e')],'onhold':this[_0x7d4e('0x16')]};var _0x1013a0=md5(JSON[_0x7d4e('0x1f')](_0x3469e1));if(this[_0x7d4e('0x3')]!==_0x1013a0){this[_0x7d4e('0x3')]=_0x1013a0;io['to'](util[_0x7d4e('0x1c')](_0x7d4e('0x20'),_0x3469e1[_0x7d4e('0x8')]))[_0x7d4e('0x21')](_0x7d4e('0x22'),_0x3469e1);}};module[_0x7d4e('0x23')]=Agent; \ No newline at end of file +var _0xe0c3=['format','emit','user:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','status','address','mobile','interface','online','voiceStatusQueue','prototype','toLowerCase','not_inuse','idle','inuse','voiceStatus','toNumber','onhold'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0xe0c3,0x7f));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x3e0c('0x1'));var Redis=require(_0x3e0c('0x2'));var config=require(_0x3e0c('0x3'));config[_0x3e0c('0x4')]=_[_0x3e0c('0x5')](config[_0x3e0c('0x4')],{'host':_0x3e0c('0x6'),'port':0x18eb});var io=require(_0x3e0c('0x7'))(new Redis(config[_0x3e0c('0x4')]));function Agent(_0x51f154){this['id']=_0x51f154['id']||0x0;this[_0x3e0c('0x8')]=_0x51f154['name']||'';this[_0x3e0c('0x9')]=_0x51f154[_0x3e0c('0x9')]||'';this[_0x3e0c('0xa')]=_0x51f154[_0x3e0c('0xa')]||'';this[_0x3e0c('0xb')]=_0x51f154['fullname']||'';this[_0x3e0c('0xc')]=_0x3e0c('0xd');this['stateTime']=0x0;this[_0x3e0c('0xe')]='unknown';this[_0x3e0c('0xf')]='';this['phone']='';this[_0x3e0c('0x10')]='';this[_0x3e0c('0x11')]='';this[_0x3e0c('0x12')]=_0x51f154[_0x3e0c('0x12')]||![];this['voiceStatus']=_0x3e0c('0xd');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x3e0c('0x13')]='';this['onhold']=![];this['local']=![];this[_0x3e0c('0x1')]='';}Agent[_0x3e0c('0x14')]['updateStatusRealtime']=function(_0xcfdc03){var _0xe9a68e;if(_0xcfdc03&&_0xcfdc03['state']){_0xe9a68e=_0xcfdc03[_0x3e0c('0xc')][_0x3e0c('0x15')]();switch(_0xe9a68e){case _0x3e0c('0x16'):_0xe9a68e=_0x3e0c('0x17');break;case _0x3e0c('0x18'):_0xe9a68e='talking';break;}}if(_0xe9a68e&&this[_0x3e0c('0x19')]!==_0xe9a68e||_0xcfdc03['statePause']){this['voiceStatusTime']=_[_0x3e0c('0x1a')](moment()['format']('x'));}if(_0xe9a68e){this[_0x3e0c('0x19')]=_0xe9a68e;}var _0x9dd7f={'id':this['id'],'name':this[_0x3e0c('0x8')],'email':this[_0x3e0c('0x9')],'accountcode':this[_0x3e0c('0xa')],'fullname':this[_0x3e0c('0xb')],'state':this[_0x3e0c('0xc')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x3e0c('0xf')],'online':this[_0x3e0c('0x12')],'voiceStatus':this[_0x3e0c('0x19')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x3e0c('0x13')],'interface':this[_0x3e0c('0x11')],'onhold':this[_0x3e0c('0x1b')]};var _0x5db437=md5(JSON['stringify'](_0x9dd7f));if(this[_0x3e0c('0x1')]!==_0x5db437){this[_0x3e0c('0x1')]=_0x5db437;io['to'](util[_0x3e0c('0x1c')]('user:%s',_0x9dd7f[_0x3e0c('0x8')]))[_0x3e0c('0x1d')](_0x3e0c('0x1e'),_0x9dd7f);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index e82c4de..035dabc 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 _0x7660=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7660,0x153));var _0x0766=function(_0x205328,_0x12c15a){_0x205328=_0x205328-0x0;var _0x4a30eb=_0x7660[_0x205328];return _0x4a30eb;};'use strict';function Campaign(_0x1366be){this['id']=_0x1366be['id']||0x0;this['name']=_0x1366be[_0x0766('0x0')]||'';this[_0x0766('0x1')]=_0x1366be[_0x0766('0x1')]||_0x0766('0x2');this[_0x0766('0x3')]=0x0;this[_0x0766('0x4')]=0x0;this[_0x0766('0x5')]=0x0;this[_0x0766('0x6')]=0x0;this[_0x0766('0x7')]='';this[_0x0766('0x8')]=!![];this['active']=_0x1366be[_0x0766('0x9')];this[_0x0766('0xa')]=_0x1366be[_0x0766('0xa')];this[_0x0766('0xb')]=_0x1366be[_0x0766('0xb')]||null;this[_0x0766('0xc')]=_0x1366be['dialGlobalInterval']?_0x1366be[_0x0766('0xc')]:null;this['dialOriginateCallerIdName']=_0x1366be[_0x0766('0xd')];this[_0x0766('0xe')]=_0x1366be[_0x0766('0xe')];this['dialOriginateTimeout']=_0x1366be['dialOriginateTimeout']||0x1e;this[_0x0766('0xf')]=_0x1366be[_0x0766('0xf')];this[_0x0766('0x10')]=_0x1366be[_0x0766('0x10')];this[_0x0766('0x11')]=_0x1366be['dialBusyMaxRetry'];this[_0x0766('0x12')]=_0x1366be[_0x0766('0x12')];this[_0x0766('0x13')]=_0x1366be[_0x0766('0x13')];this[_0x0766('0x14')]=_0x1366be[_0x0766('0x14')];this['dialGlobalMaxRetry']=_0x1366be[_0x0766('0x15')];this['dialNoSuchNumberMaxRetry']=_0x1366be[_0x0766('0x16')]||0x3;this[_0x0766('0x17')]=_0x1366be[_0x0766('0x17')]||0x96;this['dialDropMaxRetry']=_0x1366be[_0x0766('0x18')]||0x3;this[_0x0766('0x19')]=_0x1366be[_0x0766('0x19')]||0x96;this['dialAbandonedMaxRetry']=_0x1366be[_0x0766('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0x1366be['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1366be['dialMachineMaxRetry']||0x3;this[_0x0766('0x1b')]=_0x1366be[_0x0766('0x1b')]||0x96;this[_0x0766('0x1c')]=_0x1366be[_0x0766('0x1c')]||0x3;this[_0x0766('0x1d')]=_0x1366be['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x1366be[_0x0766('0x1e')]||_0x0766('0x1f');this['dialPrefix']=_0x1366be[_0x0766('0x20')]||undefined;this[_0x0766('0x21')]=_0x1366be[_0x0766('0x21')]||undefined;this[_0x0766('0x22')]=_0x1366be[_0x0766('0x22')]||undefined;this[_0x0766('0x23')]=_0x1366be[_0x0766('0x23')]?_0x1366be[_0x0766('0x23')]:undefined;this[_0x0766('0x24')]=_0x1366be[_0x0766('0x24')]?_0x1366be['Trunk']:undefined;this[_0x0766('0x25')]=_0x1366be[_0x0766('0x25')]?_0x1366be[_0x0766('0x25')]:undefined;this[_0x0766('0x26')]=_0x1366be[_0x0766('0x26')]?_0x1366be['SquareProject']:undefined;this[_0x0766('0x27')]=_0x1366be['SquareProject']?_0x1366be['SquareProject']['name']:undefined;this[_0x0766('0x28')]=_0x1366be[_0x0766('0x28')]||![];this['dialAMDInitialSilence']=_0x1366be[_0x0766('0x29')];this[_0x0766('0x2a')]=_0x1366be[_0x0766('0x2a')];this['dialAMDAfterGreetingSilence']=_0x1366be[_0x0766('0x2b')];this['dialAMDTotalAnalysisTime']=_0x1366be[_0x0766('0x2c')];this[_0x0766('0x2d')]=_0x1366be['dialAMDMinWordLength'];this[_0x0766('0x2e')]=_0x1366be[_0x0766('0x2e')];this[_0x0766('0x2f')]=_0x1366be[_0x0766('0x2f')];this[_0x0766('0x30')]=_0x1366be[_0x0766('0x30')];this['dialAMDMaximumWordLength']=_0x1366be[_0x0766('0x31')];}module[_0x0766('0x32')]=Campaign; \ No newline at end of file +var _0x1b83=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1b83,0x194));var _0x31b8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1b83[_0x138adb];return _0x1b27f2;};'use strict';function Campaign(_0x4ba9f5){this['id']=_0x4ba9f5['id']||0x0;this[_0x31b8('0x0')]=_0x4ba9f5[_0x31b8('0x0')]||'';this['type']=_0x4ba9f5['type']||_0x31b8('0x1');this[_0x31b8('0x2')]=0x0;this[_0x31b8('0x3')]=0x0;this[_0x31b8('0x4')]=0x0;this[_0x31b8('0x5')]=0x0;this[_0x31b8('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x31b8('0x7')]=_0x4ba9f5['active'];this[_0x31b8('0x8')]=_0x4ba9f5[_0x31b8('0x8')];this[_0x31b8('0x9')]=_0x4ba9f5[_0x31b8('0x9')]||null;this[_0x31b8('0xa')]=_0x4ba9f5[_0x31b8('0xa')]?_0x4ba9f5[_0x31b8('0xa')]:null;this[_0x31b8('0xb')]=_0x4ba9f5['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x4ba9f5['dialOriginateCallerIdNumber'];this[_0x31b8('0xc')]=_0x4ba9f5[_0x31b8('0xc')]||0x1e;this[_0x31b8('0xd')]=_0x4ba9f5['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4ba9f5['dialCongestionRetryFrequency'];this[_0x31b8('0xe')]=_0x4ba9f5[_0x31b8('0xe')];this['dialBusyRetryFrequency']=_0x4ba9f5[_0x31b8('0xf')];this[_0x31b8('0x10')]=_0x4ba9f5[_0x31b8('0x10')];this['dialNoAnswerRetryFrequency']=_0x4ba9f5[_0x31b8('0x11')];this['dialGlobalMaxRetry']=_0x4ba9f5['dialGlobalMaxRetry'];this[_0x31b8('0x12')]=_0x4ba9f5[_0x31b8('0x12')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4ba9f5[_0x31b8('0x13')]||0x96;this[_0x31b8('0x14')]=_0x4ba9f5[_0x31b8('0x14')]||0x3;this[_0x31b8('0x15')]=_0x4ba9f5['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x4ba9f5[_0x31b8('0x16')]||0x3;this[_0x31b8('0x17')]=_0x4ba9f5[_0x31b8('0x17')]||0x96;this['dialMachineMaxRetry']=_0x4ba9f5[_0x31b8('0x18')]||0x3;this['dialMachineRetryFrequency']=_0x4ba9f5['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4ba9f5[_0x31b8('0x19')]||0x3;this[_0x31b8('0x1a')]=_0x4ba9f5['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x4ba9f5[_0x31b8('0x1b')]||_0x31b8('0x1c');this['dialPrefix']=_0x4ba9f5[_0x31b8('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4ba9f5[_0x31b8('0x1e')]||undefined;this['dialCutDigit']=_0x4ba9f5['dialCutDigit']||undefined;this[_0x31b8('0x1f')]=_0x4ba9f5[_0x31b8('0x1f')]?_0x4ba9f5['TrunkBackup']:undefined;this['Trunk']=_0x4ba9f5['Trunk']?_0x4ba9f5[_0x31b8('0x20')]:undefined;this['Interval']=_0x4ba9f5['Interval']?_0x4ba9f5[_0x31b8('0x21')]:undefined;this[_0x31b8('0x22')]=_0x4ba9f5['SquareProject']?_0x4ba9f5['SquareProject']:undefined;this[_0x31b8('0x23')]=_0x4ba9f5[_0x31b8('0x22')]?_0x4ba9f5[_0x31b8('0x22')][_0x31b8('0x0')]:undefined;this[_0x31b8('0x24')]=_0x4ba9f5[_0x31b8('0x24')]||![];this['dialAMDInitialSilence']=_0x4ba9f5[_0x31b8('0x25')];this['dialAMDGreeting']=_0x4ba9f5[_0x31b8('0x26')];this[_0x31b8('0x27')]=_0x4ba9f5[_0x31b8('0x27')];this[_0x31b8('0x28')]=_0x4ba9f5[_0x31b8('0x28')];this['dialAMDMinWordLength']=_0x4ba9f5[_0x31b8('0x29')];this[_0x31b8('0x2a')]=_0x4ba9f5[_0x31b8('0x2a')];this[_0x31b8('0x2b')]=_0x4ba9f5[_0x31b8('0x2b')];this[_0x31b8('0x2c')]=_0x4ba9f5['dialAMDSilenceThreshold'];this[_0x31b8('0x2d')]=_0x4ba9f5[_0x31b8('0x2d')];}module[_0x31b8('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 35549ae..d8e0b8b 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 _0xd0bb=['uniqueid','exten','answertime','endtime','abandoned','lastapplication','duration','billableseconds','type','tag','disposition','monitor','monitorFilename','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context'];(function(_0x5a9141,_0x2ccd7f){var _0x1a18a8=function(_0x3c3815){while(--_0x3c3815){_0x5a9141['push'](_0x5a9141['shift']());}};_0x1a18a8(++_0x2ccd7f);}(_0xd0bb,0x1a8));var _0xbd0b=function(_0x3f9f9d,_0x923a36){_0x3f9f9d=_0x3f9f9d-0x0;var _0x3f9fc9=_0xd0bb[_0x3f9f9d];return _0x3f9fc9;};'use strict';function Channel(){this[_0xbd0b('0x0')]=null;this[_0xbd0b('0x1')]='';this[_0xbd0b('0x2')]='';this[_0xbd0b('0x3')]=0x0;this[_0xbd0b('0x4')]='';this[_0xbd0b('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xbd0b('0x6')]=0x0;this[_0xbd0b('0x7')]='';this[_0xbd0b('0x8')]=0x0;this['linkedid']=0x0;this[_0xbd0b('0x9')]=0x0;this['answered']=![];this[_0xbd0b('0xa')]=null;this[_0xbd0b('0xb')]=null;this['unmanaged']=![];this[_0xbd0b('0xc')]=![];this[_0xbd0b('0xd')]='';this['lastdata']='';this[_0xbd0b('0xe')]=0x0;this[_0xbd0b('0xf')]=0x0;this['holdtime']=0x0;this[_0xbd0b('0x10')]=null;this[_0xbd0b('0x11')]=null;this[_0xbd0b('0x12')]=null;this[_0xbd0b('0x13')]=![];this[_0xbd0b('0x14')]=null;this['queue']=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xbd0b('0x15')]=undefined;this[_0xbd0b('0x16')]=0x0;}module[_0xbd0b('0x17')]=Channel; \ No newline at end of file +var _0xb0c3=['transfercalleridnum','mohtime','starttime','channel','connectedlinenum','accountcode','context','linkedid','exten','answertime','unmanaged','duration','billableseconds','holdtime','type','monitor','monitorFilename','queue','monitors'];(function(_0x436136,_0x1c027a){var _0x245bf9=function(_0x3ae747){while(--_0x3ae747){_0x436136['push'](_0x436136['shift']());}};_0x245bf9(++_0x1c027a);}(_0xb0c3,0x9a));var _0x3b0c=function(_0x421e73,_0x2d3fdc){_0x421e73=_0x421e73-0x0;var _0x2f71ec=_0xb0c3[_0x421e73];return _0x2f71ec;};'use strict';function Channel(){this[_0x3b0c('0x0')]=null;this[_0x3b0c('0x1')]='';this['destinationchannel']='';this['calleridnum']=0x0;this['calleridname']='';this[_0x3b0c('0x2')]=undefined;this['connectedlinename']=undefined;this[_0x3b0c('0x3')]=0x0;this[_0x3b0c('0x4')]='';this['uniqueid']=0x0;this[_0x3b0c('0x5')]=0x0;this[_0x3b0c('0x6')]=0x0;this['answered']=![];this[_0x3b0c('0x7')]=null;this['endtime']=null;this[_0x3b0c('0x8')]=![];this['abandoned']=![];this['lastapplication']='';this['lastdata']='';this[_0x3b0c('0x9')]=0x0;this[_0x3b0c('0xa')]=0x0;this[_0x3b0c('0xb')]=0x0;this[_0x3b0c('0xc')]=null;this['tag']=null;this['disposition']=null;this[_0x3b0c('0xd')]=![];this[_0x3b0c('0xe')]=null;this[_0x3b0c('0xf')]=null;this[_0x3b0c('0x10')]=[];this[_0x3b0c('0x11')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x3b0c('0x12')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 59eea26..50c53de 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 _0xa2c8=['username','remoteUri','authType','consumerKey','consumerSecret','token','tokenSecret','serverUrl','Configurations','exports','name'];(function(_0x6c3b8f,_0x344abf){var _0x3ac978=function(_0x58d17b){while(--_0x58d17b){_0x6c3b8f['push'](_0x6c3b8f['shift']());}};_0x3ac978(++_0x344abf);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';function DeskAccount(_0x27af83){this['id']=_0x27af83['id']||0x0;this[_0x8a2c('0x0')]=_0x27af83[_0x8a2c('0x0')]||'';this[_0x8a2c('0x1')]=_0x27af83[_0x8a2c('0x1')]||'';this[_0x8a2c('0x2')]=_0x27af83['remoteUri']||'';this[_0x8a2c('0x3')]=_0x27af83['authType']||'';this['password']=_0x27af83['password']||'';this[_0x8a2c('0x4')]=_0x27af83[_0x8a2c('0x4')]||'';this[_0x8a2c('0x5')]=_0x27af83[_0x8a2c('0x5')]||'';this['token']=_0x27af83[_0x8a2c('0x6')]||'';this[_0x8a2c('0x7')]=_0x27af83[_0x8a2c('0x7')]||'';this['type']=_0x27af83['type']||'';this['serverUrl']=_0x27af83[_0x8a2c('0x8')]||'';this[_0x8a2c('0x9')]=_0x27af83['Configurations']||{};}module[_0x8a2c('0xa')]=DeskAccount; \ No newline at end of file +var _0x24ce=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x24ce,0x1de));var _0xe24c=function(_0x57162b,_0x12ebff){_0x57162b=_0x57162b-0x0;var _0xb38f91=_0x24ce[_0x57162b];return _0xb38f91;};'use strict';function DeskAccount(_0x1ba72f){this['id']=_0x1ba72f['id']||0x0;this[_0xe24c('0x0')]=_0x1ba72f[_0xe24c('0x0')]||'';this[_0xe24c('0x1')]=_0x1ba72f[_0xe24c('0x1')]||'';this['remoteUri']=_0x1ba72f['remoteUri']||'';this[_0xe24c('0x2')]=_0x1ba72f['authType']||'';this['password']=_0x1ba72f[_0xe24c('0x3')]||'';this[_0xe24c('0x4')]=_0x1ba72f[_0xe24c('0x4')]||'';this[_0xe24c('0x5')]=_0x1ba72f[_0xe24c('0x5')]||'';this['token']=_0x1ba72f[_0xe24c('0x6')]||'';this[_0xe24c('0x7')]=_0x1ba72f[_0xe24c('0x7')]||'';this[_0xe24c('0x8')]=_0x1ba72f[_0xe24c('0x8')]||'';this[_0xe24c('0x9')]=_0x1ba72f[_0xe24c('0x9')]||'';this[_0xe24c('0xa')]=_0x1ba72f[_0xe24c('0xa')]||{};}module[_0xe24c('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 40da5bf..f5741b3 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 _0x3d1e=['clientSecret','serverUrl','Configurations','name','username','password','remoteUri','tenantId','clientId'];(function(_0x1521f0,_0x1a9915){var _0x2760c4=function(_0x21e683){while(--_0x21e683){_0x1521f0['push'](_0x1521f0['shift']());}};_0x2760c4(++_0x1a9915);}(_0x3d1e,0x1ce));var _0xe3d1=function(_0x5ea37c,_0x38ca69){_0x5ea37c=_0x5ea37c-0x0;var _0x5b804b=_0x3d1e[_0x5ea37c];return _0x5b804b;};'use strict';function Dynamics365Account(_0x3de033){this['id']=_0x3de033['id']||0x0;this[_0xe3d1('0x0')]=_0x3de033[_0xe3d1('0x0')]||'';this[_0xe3d1('0x1')]=_0x3de033[_0xe3d1('0x1')]||'';this[_0xe3d1('0x2')]=_0x3de033[_0xe3d1('0x2')]||'';this[_0xe3d1('0x3')]=_0x3de033[_0xe3d1('0x3')]||'';this[_0xe3d1('0x4')]=_0x3de033[_0xe3d1('0x4')]||'';this[_0xe3d1('0x5')]=_0x3de033['clientId']||'';this[_0xe3d1('0x6')]=_0x3de033[_0xe3d1('0x6')]||{};this['serverUrl']=_0x3de033[_0xe3d1('0x7')]||'';this[_0xe3d1('0x8')]=_0x3de033[_0xe3d1('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0xdcdd=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x3eca5a,_0x20d490){var _0x15470e=function(_0x219cc6){while(--_0x219cc6){_0x3eca5a['push'](_0x3eca5a['shift']());}};_0x15470e(++_0x20d490);}(_0xdcdd,0xd0));var _0xddcd=function(_0x344e34,_0x2e3482){_0x344e34=_0x344e34-0x0;var _0x471f4f=_0xdcdd[_0x344e34];return _0x471f4f;};'use strict';function Dynamics365Account(_0x256989){this['id']=_0x256989['id']||0x0;this[_0xddcd('0x0')]=_0x256989[_0xddcd('0x0')]||'';this[_0xddcd('0x1')]=_0x256989[_0xddcd('0x1')]||'';this[_0xddcd('0x2')]=_0x256989[_0xddcd('0x2')]||'';this[_0xddcd('0x3')]=_0x256989['remoteUri']||'';this[_0xddcd('0x4')]=_0x256989[_0xddcd('0x4')]||'';this['clientId']=_0x256989[_0xddcd('0x5')]||'';this[_0xddcd('0x6')]=_0x256989['clientSecret']||{};this['serverUrl']=_0x256989[_0xddcd('0x7')]||'';this[_0xddcd('0x8')]=_0x256989['Configurations']||{};}module[_0xddcd('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 6e81ecc..01aa138 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 _0xa925=['gateway','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x1a3670,_0x215eda){var _0x54ce4c=function(_0x5089f4){while(--_0x5089f4){_0x1a3670['push'](_0x1a3670['shift']());}};_0x54ce4c(++_0x215eda);}(_0xa925,0x90));var _0x5a92=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa925[_0x2f3848];return _0x102668;};'use strict';function FaxAccount(_0x47c818){this['id']=_0x47c818['id']||0x0;this[_0x5a92('0x0')]=_0x47c818[_0x5a92('0x0')]||'';this[_0x5a92('0x1')]=_0x47c818[_0x5a92('0x1')];this['ecm']=_0x47c818[_0x5a92('0x2')];this[_0x5a92('0x3')]=_0x47c818['headerinfo'];this['localstationid']=_0x47c818[_0x5a92('0x4')];this[_0x5a92('0x5')]=_0x47c818[_0x5a92('0x5')]||0x960;this[_0x5a92('0x6')]=_0x47c818[_0x5a92('0x6')]||0x3840;this[_0x5a92('0x7')]=_0x47c818[_0x5a92('0x7')]||_0x5a92('0x8');this[_0x5a92('0x9')]=_0x47c818[_0x5a92('0x9')]||'no';this['faxdetect']=_0x47c818['faxdetect']||'no';this[_0x5a92('0xa')]=_0x47c818[_0x5a92('0xa')]||0x1388;this['tech']=_0x47c818[_0x5a92('0xb')]||_0x5a92('0xc');this[_0x5a92('0xd')]=_0x47c818[_0x5a92('0xd')]?_0x47c818['Trunk']:undefined;this[_0x5a92('0xe')]=_0x47c818[_0x5a92('0xe')];this['key']=_0x47c818[_0x5a92('0xf')];}module[_0x5a92('0x10')]=FaxAccount; \ No newline at end of file +var _0x3a40=['v17,v27,v29','gateway','faxdetect','t38timeout','tech','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3a40,0x1ab));var _0x03a4=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x3a40[_0x243b2f];return _0xcb3c2d;};'use strict';function FaxAccount(_0x2bd0cf){this['id']=_0x2bd0cf['id']||0x0;this[_0x03a4('0x0')]=_0x2bd0cf[_0x03a4('0x0')]||'';this[_0x03a4('0x1')]=_0x2bd0cf[_0x03a4('0x1')];this[_0x03a4('0x2')]=_0x2bd0cf[_0x03a4('0x2')];this[_0x03a4('0x3')]=_0x2bd0cf[_0x03a4('0x3')];this[_0x03a4('0x4')]=_0x2bd0cf[_0x03a4('0x4')];this[_0x03a4('0x5')]=_0x2bd0cf[_0x03a4('0x5')]||0x960;this[_0x03a4('0x6')]=_0x2bd0cf[_0x03a4('0x6')]||0x3840;this[_0x03a4('0x7')]=_0x2bd0cf[_0x03a4('0x7')]||_0x03a4('0x8');this[_0x03a4('0x9')]=_0x2bd0cf['gateway']||'no';this[_0x03a4('0xa')]=_0x2bd0cf[_0x03a4('0xa')]||'no';this[_0x03a4('0xb')]=_0x2bd0cf[_0x03a4('0xb')]||0x1388;this[_0x03a4('0xc')]=_0x2bd0cf[_0x03a4('0xc')]||'SIP';this['Trunk']=_0x2bd0cf['Trunk']?_0x2bd0cf['Trunk']:undefined;this[_0x03a4('0xd')]=_0x2bd0cf[_0x03a4('0xd')];this[_0x03a4('0xe')]=_0x2bd0cf[_0x03a4('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7f00771..00a4c25 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 _0xada0=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xada0,0x171));var _0x0ada=function(_0x32645c,_0x503e91){_0x32645c=_0x32645c-0x0;var _0xf0dcdc=_0xada0[_0x32645c];return _0xf0dcdc;};'use strict';function FreshdeskAccount(_0x30db42){this['id']=_0x30db42['id']||0x0;this[_0x0ada('0x0')]=_0x30db42[_0x0ada('0x0')]||'';this['username']=_0x30db42[_0x0ada('0x1')]||'';this[_0x0ada('0x2')]=_0x30db42[_0x0ada('0x3')]||'';this[_0x0ada('0x4')]=_0x30db42[_0x0ada('0x4')]||'';this[_0x0ada('0x5')]=_0x30db42['serverUrl']||'';this[_0x0ada('0x6')]=_0x30db42[_0x0ada('0x6')]||{};}module[_0x0ada('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x4e7e=['name','username','token','remoteUri','serverUrl','exports'];(function(_0x4441a4,_0x51aec3){var _0x1c1d1c=function(_0x451c2b){while(--_0x451c2b){_0x4441a4['push'](_0x4441a4['shift']());}};_0x1c1d1c(++_0x51aec3);}(_0x4e7e,0x18c));var _0xe4e7=function(_0x1c3ef9,_0xccf45e){_0x1c3ef9=_0x1c3ef9-0x0;var _0x43db1d=_0x4e7e[_0x1c3ef9];return _0x43db1d;};'use strict';function FreshdeskAccount(_0x31a7d0){this['id']=_0x31a7d0['id']||0x0;this[_0xe4e7('0x0')]=_0x31a7d0[_0xe4e7('0x0')]||'';this[_0xe4e7('0x1')]=_0x31a7d0[_0xe4e7('0x1')]||'';this['apiKey']=_0x31a7d0[_0xe4e7('0x2')]||'';this['remoteUri']=_0x31a7d0[_0xe4e7('0x3')]||'';this[_0xe4e7('0x4')]=_0x31a7d0[_0xe4e7('0x4')]||'';this['Configurations']=_0x31a7d0['Configurations']||{};}module[_0xe4e7('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 83ed463..bb357b9 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 _0x4028=['token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x2aef01,_0x17cb51){var _0x5ee379=function(_0x1f843c){while(--_0x1f843c){_0x2aef01['push'](_0x2aef01['shift']());}};_0x5ee379(++_0x17cb51);}(_0x4028,0x15a));var _0x8402=function(_0x5294b3,_0xdfab4e){_0x5294b3=_0x5294b3-0x0;var _0x300df9=_0x4028[_0x5294b3];return _0x300df9;};'use strict';function FreshsalesAccount(_0x199c60){this['id']=_0x199c60['id']||0x0;this[_0x8402('0x0')]=_0x199c60[_0x8402('0x0')]||'';this[_0x8402('0x1')]=_0x199c60[_0x8402('0x1')]||'';this['apiKey']=_0x199c60[_0x8402('0x2')]||'';this[_0x8402('0x3')]=_0x199c60[_0x8402('0x3')]||'';this[_0x8402('0x4')]=_0x199c60[_0x8402('0x4')]||'';this[_0x8402('0x5')]=_0x199c60[_0x8402('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xb742=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x2c00b3,_0x29b200){var _0x595512=function(_0x33401e){while(--_0x33401e){_0x2c00b3['push'](_0x2c00b3['shift']());}};_0x595512(++_0x29b200);}(_0xb742,0xe5));var _0x2b74=function(_0x204191,_0x55d566){_0x204191=_0x204191-0x0;var _0x526ccf=_0xb742[_0x204191];return _0x526ccf;};'use strict';function FreshsalesAccount(_0x5078cf){this['id']=_0x5078cf['id']||0x0;this[_0x2b74('0x0')]=_0x5078cf[_0x2b74('0x0')]||'';this['username']=_0x5078cf[_0x2b74('0x1')]||'';this[_0x2b74('0x2')]=_0x5078cf[_0x2b74('0x3')]||'';this[_0x2b74('0x4')]=_0x5078cf[_0x2b74('0x4')]||'';this['serverUrl']=_0x5078cf[_0x2b74('0x5')]||'';this[_0x2b74('0x6')]=_0x5078cf[_0x2b74('0x6')]||{};}module[_0x2b74('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 98b95c7..22d693c 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 _0xcc11=['type','uniqueid','calleridnum','calleridname','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime','variables','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcc11,0x1c8));var _0x1cc1=function(_0x133838,_0x5f19a7){_0x133838=_0x133838-0x0;var _0x3a5239=_0xcc11[_0x133838];return _0x3a5239;};'use strict';function QueueReport(){this[_0x1cc1('0x0')]='inbound';this[_0x1cc1('0x1')]='';this[_0x1cc1('0x2')]='';this[_0x1cc1('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x1cc1('0x4')]=0x1;this[_0x1cc1('0x5')]=0x1;this['queuecallerabandon']=![];this[_0x1cc1('0x6')]=null;this[_0x1cc1('0x7')]=![];this[_0x1cc1('0x8')]=null;this[_0x1cc1('0x9')]=![];this[_0x1cc1('0xa')]=null;this['originalposition']=0x1;this['channel']='';this[_0x1cc1('0xb')]='';this[_0x1cc1('0xc')]='';this[_0x1cc1('0xd')]='';this[_0x1cc1('0xe')]='';this['exten']='';this[_0x1cc1('0xf')]='';this[_0x1cc1('0x10')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0x1cc1('0x11')]={};}module[_0x1cc1('0x12')]=QueueReport; \ No newline at end of file +var _0xb5e7=['mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb5e7,0x9f));var _0x7b5e=function(_0x87a154,_0x9c91d0){_0x87a154=_0x87a154-0x0;var _0x3a4fe1=_0xb5e7[_0x87a154];return _0x3a4fe1;};'use strict';function QueueReport(){this[_0x7b5e('0x0')]=_0x7b5e('0x1');this[_0x7b5e('0x2')]='';this[_0x7b5e('0x3')]='';this[_0x7b5e('0x4')]='';this['queue']='';this[_0x7b5e('0x5')]=null;this[_0x7b5e('0x6')]=null;this[_0x7b5e('0x7')]=0x1;this[_0x7b5e('0x8')]=0x1;this[_0x7b5e('0x9')]=![];this[_0x7b5e('0xa')]=null;this['queuecallercomplete']=![];this[_0x7b5e('0xb')]=null;this[_0x7b5e('0xc')]=![];this['queuecallerexitAt']=null;this[_0x7b5e('0xd')]=0x1;this[_0x7b5e('0xe')]='';this[_0x7b5e('0xf')]='';this[_0x7b5e('0x10')]='';this[_0x7b5e('0x11')]='';this[_0x7b5e('0x12')]='';this[_0x7b5e('0x13')]='';this[_0x7b5e('0x14')]='';this[_0x7b5e('0x15')]=0x0;this[_0x7b5e('0x16')]=![];this['lastAssignedTo']='';this[_0x7b5e('0x17')]=0x0;this[_0x7b5e('0x18')]={};}module[_0x7b5e('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index cf23a72..6d468ef 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 _0xb470=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x31d5a5,_0x5dca2e){var _0x23b49e=function(_0x20c380){while(--_0x20c380){_0x31d5a5['push'](_0x31d5a5['shift']());}};_0x23b49e(++_0x5dca2e);}(_0xb470,0x117));var _0x0b47=function(_0x3338ec,_0x2927fe){_0x3338ec=_0x3338ec-0x0;var _0x2060c1=_0xb470[_0x3338ec];return _0x2060c1;};'use strict';function SalesforceAccount(_0x5da288){this['id']=_0x5da288['id']||0x0;this[_0x0b47('0x0')]=_0x5da288[_0x0b47('0x0')]||'';this[_0x0b47('0x1')]=_0x5da288[_0x0b47('0x1')]||'';this[_0x0b47('0x2')]=_0x5da288['remoteUri']||'';this[_0x0b47('0x3')]=_0x5da288[_0x0b47('0x3')]||'';this[_0x0b47('0x4')]=_0x5da288[_0x0b47('0x4')]||'';this[_0x0b47('0x5')]=_0x5da288[_0x0b47('0x5')]||'';this[_0x0b47('0x6')]=_0x5da288['securityToken']||'';this[_0x0b47('0x7')]=_0x5da288['type']||'integrationTab';this[_0x0b47('0x8')]=_0x5da288[_0x0b47('0x8')]||'';this[_0x0b47('0x9')]=_0x5da288['Configurations']||{};}module[_0x0b47('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x237e=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x237e,0xcf));var _0xe237=function(_0x4e2b28,_0x7f2da4){_0x4e2b28=_0x4e2b28-0x0;var _0x328135=_0x237e[_0x4e2b28];return _0x328135;};'use strict';function SalesforceAccount(_0x31b0d0){this['id']=_0x31b0d0['id']||0x0;this['name']=_0x31b0d0[_0xe237('0x0')]||'';this['username']=_0x31b0d0[_0xe237('0x1')]||'';this[_0xe237('0x2')]=_0x31b0d0[_0xe237('0x2')]||'';this[_0xe237('0x3')]=_0x31b0d0['password']||'';this[_0xe237('0x4')]=_0x31b0d0[_0xe237('0x4')]||'';this[_0xe237('0x5')]=_0x31b0d0[_0xe237('0x5')]||'';this[_0xe237('0x6')]=_0x31b0d0[_0xe237('0x6')]||'';this[_0xe237('0x7')]=_0x31b0d0[_0xe237('0x7')]||_0xe237('0x8');this[_0xe237('0x9')]=_0x31b0d0[_0xe237('0x9')]||'';this[_0xe237('0xa')]=_0x31b0d0[_0xe237('0xa')]||{};}module[_0xe237('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 342b10d..4fcf7df 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 _0x6848=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x446c15,_0x1b3820){var _0x59dcd9=function(_0x44c462){while(--_0x44c462){_0x446c15['push'](_0x446c15['shift']());}};_0x59dcd9(++_0x1b3820);}(_0x6848,0xe3));var _0x8684=function(_0x1d51e3,_0x479c05){_0x1d51e3=_0x1d51e3-0x0;var _0x34539a=_0x6848[_0x1d51e3];return _0x34539a;};'use strict';function ServicenowAccount(_0x6bd4b9){this['id']=_0x6bd4b9['id']||0x0;this[_0x8684('0x0')]=_0x6bd4b9[_0x8684('0x0')]||'';this[_0x8684('0x1')]=_0x6bd4b9[_0x8684('0x1')]||'';this[_0x8684('0x2')]=_0x6bd4b9[_0x8684('0x2')]||'';this[_0x8684('0x3')]=_0x6bd4b9[_0x8684('0x3')]||'';this['serverUrl']=_0x6bd4b9[_0x8684('0x4')]||'';this[_0x8684('0x5')]=_0x6bd4b9['Configurations']||{};}module[_0x8684('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x09fa=['remoteUri','serverUrl','exports','name','username','password'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x09fa,0x14d));var _0xa09f=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x09fa[_0x263a74];return _0x2aa86c;};'use strict';function ServicenowAccount(_0x1e723e){this['id']=_0x1e723e['id']||0x0;this[_0xa09f('0x0')]=_0x1e723e['name']||'';this['username']=_0x1e723e[_0xa09f('0x1')]||'';this[_0xa09f('0x2')]=_0x1e723e[_0xa09f('0x2')]||'';this[_0xa09f('0x3')]=_0x1e723e[_0xa09f('0x3')]||'';this['serverUrl']=_0x1e723e[_0xa09f('0x4')]||'';this['Configurations']=_0x1e723e['Configurations']||{};}module[_0xa09f('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 507eccb..6255917 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 _0xffed=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x10cb39,_0x4f2f75){var _0x8699a5=function(_0x4f5bb3){while(--_0x4f5bb3){_0x10cb39['push'](_0x10cb39['shift']());}};_0x8699a5(++_0x4f2f75);}(_0xffed,0x1f3));var _0xdffe=function(_0x2b7693,_0x44a0c8){_0x2b7693=_0x2b7693-0x0;var _0x24d052=_0xffed[_0x2b7693];return _0x24d052;};'use strict';function SugarcrmAccount(_0x4943c0){this['id']=_0x4943c0['id']||0x0;this['name']=_0x4943c0[_0xdffe('0x0')]||'';this[_0xdffe('0x1')]=_0x4943c0[_0xdffe('0x1')]||'';this[_0xdffe('0x2')]=_0x4943c0['password']||'';this['remoteUri']=_0x4943c0[_0xdffe('0x3')]||'';this[_0xdffe('0x4')]=_0x4943c0[_0xdffe('0x4')]||'';this[_0xdffe('0x5')]=_0x4943c0[_0xdffe('0x5')]||{};}module[_0xdffe('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x3ce2=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x3ce2,0x1ee));var _0x23ce=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3ce2[_0x59ee6f];return _0x4c0979;};'use strict';function SugarcrmAccount(_0x1afb89){this['id']=_0x1afb89['id']||0x0;this['name']=_0x1afb89[_0x23ce('0x0')]||'';this[_0x23ce('0x1')]=_0x1afb89[_0x23ce('0x1')]||'';this['password']=_0x1afb89[_0x23ce('0x2')]||'';this['remoteUri']=_0x1afb89[_0x23ce('0x3')]||'';this[_0x23ce('0x4')]=_0x1afb89[_0x23ce('0x4')]||'';this[_0x23ce('0x5')]=_0x1afb89[_0x23ce('0x5')]||{};}module[_0x23ce('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 d47bf65..1bb6fe4 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 _0x90ac=['status','address','name','accountcode','unknown','stateTime'];(function(_0x8671e1,_0x1e2df0){var _0x29a03b=function(_0x527756){while(--_0x527756){_0x8671e1['push'](_0x8671e1['shift']());}};_0x29a03b(++_0x1e2df0);}(_0x90ac,0x1d6));var _0xc90a=function(_0x2b76e6,_0x28f4d8){_0x2b76e6=_0x2b76e6-0x0;var _0x3271b6=_0x90ac[_0x2b76e6];return _0x3271b6;};'use strict';function Telephone(_0x49712a){this['id']=_0x49712a['id']||0x0;this[_0xc90a('0x0')]=_0x49712a[_0xc90a('0x0')]||'';this[_0xc90a('0x1')]=_0x49712a[_0xc90a('0x1')]||'';this['state']=_0xc90a('0x2');this[_0xc90a('0x3')]=0x0;this[_0xc90a('0x4')]='unknown';this[_0xc90a('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xeeaa=['name','state','stateTime','status','unknown','exports'];(function(_0x1c8995,_0x2ffff7){var _0x58b0d3=function(_0x225c70){while(--_0x225c70){_0x1c8995['push'](_0x1c8995['shift']());}};_0x58b0d3(++_0x2ffff7);}(_0xeeaa,0x156));var _0xaeea=function(_0x2de35a,_0x1af1a6){_0x2de35a=_0x2de35a-0x0;var _0x38c6ff=_0xeeaa[_0x2de35a];return _0x38c6ff;};'use strict';function Telephone(_0x163d36){this['id']=_0x163d36['id']||0x0;this['name']=_0x163d36[_0xaeea('0x0')]||'';this['accountcode']=_0x163d36['accountcode']||'';this[_0xaeea('0x1')]='unknown';this[_0xaeea('0x2')]=0x0;this[_0xaeea('0x3')]=_0xaeea('0x4');this['address']='';}module[_0xaeea('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 76e5ccb..d619cd0 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 _0xd756=['html','name'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd756,0xa3));var _0x6d75=function(_0x4a821c,_0x31fef4){_0x4a821c=_0x4a821c-0x0;var _0xe70425=_0xd756[_0x4a821c];return _0xe70425;};'use strict';function template(_0x5a3a8f){this['id']=_0x5a3a8f['id']||0x0;this['name']=_0x5a3a8f[_0x6d75('0x0')]||'';this[_0x6d75('0x1')]=_0x5a3a8f[_0x6d75('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0x102c=['html','name'];(function(_0xa8e121,_0x4895e4){var _0x225371=function(_0xd31849){while(--_0xd31849){_0xa8e121['push'](_0xa8e121['shift']());}};_0x225371(++_0x4895e4);}(_0x102c,0xf9));var _0xc102=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x102c[_0x2e4aa2];return _0x5e6092;};'use strict';function template(_0x4fccd9){this['id']=_0x4fccd9['id']||0x0;this[_0xc102('0x0')]=_0x4fccd9[_0xc102('0x0')]||'';this['html']=_0x4fccd9[_0xc102('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 8f78a21..0d64c5d 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 _0x4b84=['name','channel','status','AllConditions','Actions'];(function(_0x36cabe,_0x12e282){var _0x24e6f6=function(_0x4ad851){while(--_0x4ad851){_0x36cabe['push'](_0x36cabe['shift']());}};_0x24e6f6(++_0x12e282);}(_0x4b84,0x1cc));var _0x44b8=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0x4b84[_0x45096e];return _0xba1fa3;};'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 +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x205c06,_0x4b574a){var _0x4af9a7=function(_0x54bd4b){while(--_0x54bd4b){_0x205c06['push'](_0x205c06['shift']());}};_0x4af9a7(++_0x4b574a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x503968,_0xb58751){_0x503968=_0x503968-0x0;var _0x366548=_0x8ef6[_0x503968];return _0x366548;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 895fa4c..87517ca 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 _0x652b=['registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','unknown','status'];(function(_0x6caffe,_0x2b1d40){var _0x1a6c30=function(_0x657a55){while(--_0x657a55){_0x6caffe['push'](_0x6caffe['shift']());}};_0x1a6c30(++_0x2b1d40);}(_0x652b,0xd8));var _0xb652=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x652b[_0x4715d2];return _0x141811;};'use strict';function Trunk(_0x4088bb){this['id']=_0x4088bb['id']||0x0;this['active']=_0x4088bb[_0xb652('0x0')]||![];this[_0xb652('0x1')]=_0x4088bb[_0xb652('0x1')]||'';this[_0xb652('0x2')]=_0xb652('0x3');this['stateTime']=0x0;this[_0xb652('0x4')]='unknown';this['registry']=_0x4088bb['registry']&&_0x4088bb[_0xb652('0x5')][_0xb652('0x6')](':')?_0x4088bb['registry'][_0xb652('0x7')](':')[0x0]:'';this[_0xb652('0x8')]='';this[_0xb652('0x9')]='';this[_0xb652('0xa')]='';this[_0xb652('0xb')]='';this[_0xb652('0xc')]='';this[_0xb652('0xd')]=_0xb652('0x3');this[_0xb652('0xe')]='';this[_0xb652('0xf')]='';}module[_0xb652('0x10')]=Trunk; \ No newline at end of file +var _0x074f=['exports','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport','stateRegistry','address'];(function(_0x5ccdd5,_0x137596){var _0x2bb303=function(_0x5e6c66){while(--_0x5e6c66){_0x5ccdd5['push'](_0x5ccdd5['shift']());}};_0x2bb303(++_0x137596);}(_0x074f,0x97));var _0xf074=function(_0x157200,_0x1e09a0){_0x157200=_0x157200-0x0;var _0x57498=_0x074f[_0x157200];return _0x57498;};'use strict';function Trunk(_0x226c6d){this['id']=_0x226c6d['id']||0x0;this[_0xf074('0x0')]=_0x226c6d[_0xf074('0x0')]||![];this[_0xf074('0x1')]=_0x226c6d['name']||'';this[_0xf074('0x2')]=_0xf074('0x3');this[_0xf074('0x4')]=0x0;this['status']=_0xf074('0x3');this[_0xf074('0x5')]=_0x226c6d[_0xf074('0x5')]&&_0x226c6d[_0xf074('0x5')][_0xf074('0x6')](':')?_0x226c6d[_0xf074('0x5')][_0xf074('0x7')](':')[0x0]:'';this[_0xf074('0x8')]='';this[_0xf074('0x9')]='';this[_0xf074('0xa')]='';this[_0xf074('0xb')]='';this['refresh']='';this[_0xf074('0xc')]=_0xf074('0x3');this['registrationtime']='';this[_0xf074('0xd')]='';}module[_0xf074('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 76a8199..54fedec 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 _0x73a4=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x315718,_0x43912d){var _0x377b53=function(_0x5d319c){while(--_0x5d319c){_0x315718['push'](_0x315718['shift']());}};_0x377b53(++_0x43912d);}(_0x73a4,0x168));var _0x473a=function(_0x47eac1,_0x36a0ea){_0x47eac1=_0x47eac1-0x0;var _0x326349=_0x73a4[_0x47eac1];return _0x326349;};'use strict';function voiceExtension(_0x3020a2){this['id']=_0x3020a2['id']||0x0;this[_0x473a('0x0')]=_0x3020a2[_0x473a('0x0')]||'';this['recordingFormat']=_0x3020a2[_0x473a('0x1')]||'none';this[_0x473a('0x2')]=_0x3020a2[_0x473a('0x2')]||![];}module[_0x473a('0x3')]=voiceExtension; \ No newline at end of file +var _0x09c7=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x3d7253,_0x1af441){var _0x94a846=function(_0x2ed6cc){while(--_0x2ed6cc){_0x3d7253['push'](_0x3d7253['shift']());}};_0x94a846(++_0x1af441);}(_0x09c7,0x18f));var _0x709c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x09c7[_0x501510];return _0x1e6ee5;};'use strict';function voiceExtension(_0x2cc830){this['id']=_0x2cc830['id']||0x0;this[_0x709c('0x0')]=_0x2cc830['exten']||'';this['recordingFormat']=_0x2cc830[_0x709c('0x1')]||_0x709c('0x2');this[_0x709c('0x3')]=_0x2cc830[_0x709c('0x3')]||![];}module[_0x709c('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 6af4873..d0595ed 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 _0x9e1c=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x396af9,_0x1bb734){var _0x3c4158=function(_0x34ac37){while(--_0x34ac37){_0x396af9['push'](_0x396af9['shift']());}};_0x3c4158(++_0x1bb734);}(_0x9e1c,0x198));var _0xc9e1=function(_0x23a0c8,_0x1f55d6){_0x23a0c8=_0x23a0c8-0x0;var _0x2da2be=_0x9e1c[_0x23a0c8];return _0x2da2be;};'use strict';var statusDesc=[_0xc9e1('0x0'),_0xc9e1('0x1'),_0xc9e1('0x2'),_0xc9e1('0x3'),'invalid','unavailable',_0xc9e1('0x4'),_0xc9e1('0x5'),_0xc9e1('0x6')];var monitorFormat={'wav':_0xc9e1('0x7'),'wav49':_0xc9e1('0x8'),'gsm':_0xc9e1('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xc9e1('0xa')};function VoiceQueue(_0x3f12a0){this['id']=_0x3f12a0['id']||0x0;this[_0xc9e1('0xb')]=_0x3f12a0[_0xc9e1('0xb')]||'';this[_0xc9e1('0xc')]=_0x3f12a0[_0xc9e1('0xc')]||'';this[_0xc9e1('0xd')]=_0x3f12a0[_0xc9e1('0xd')]||_0xc9e1('0xe');this[_0xc9e1('0xf')]=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0xc9e1('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xc9e1('0x11')]=0x0;this[_0xc9e1('0x12')]=0x0;this[_0xc9e1('0x13')]=0x0;this[_0xc9e1('0x14')]=0x0;this[_0xc9e1('0x15')]=0x0;this[_0xc9e1('0x16')]=_0x3f12a0[_0xc9e1('0x16')]||![];this[_0xc9e1('0x17')]=_0x3f12a0['acwTimeout']||0xa;this[_0xc9e1('0x18')]=_0x3f12a0['autopause']||'no';this[_0xc9e1('0x19')]=!![];this[_0xc9e1('0x1a')]='';this[_0xc9e1('0x1b')]=0x0;this[_0xc9e1('0x1c')]=0x0;this['dialTimezone']=_0x3f12a0['dialTimezone']||null;this[_0xc9e1('0x1d')]=_0x3f12a0[_0xc9e1('0x1d')]?_0x3f12a0[_0xc9e1('0x1d')]:null;this[_0xc9e1('0x1e')]=_0x3f12a0['dialActive'];this[_0xc9e1('0x1f')]=_0x3f12a0[_0xc9e1('0x1f')]||_0xc9e1('0x20');this[_0xc9e1('0x21')]=_0x3f12a0[_0xc9e1('0x21')]||0x0;this['dialLimitQueue']=_0x3f12a0[_0xc9e1('0x22')]||0x0;this[_0xc9e1('0x23')]=_0x3f12a0[_0xc9e1('0x23')]||0x1;this['dialPredictiveOptimization']=_0x3f12a0[_0xc9e1('0x24')]||_0xc9e1('0x25');this['dialPredictiveOptimizationPercentage']=_0x3f12a0['dialPredictiveOptimizationPercentage']||0.03;this[_0xc9e1('0x26')]=_0x3f12a0[_0xc9e1('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x3f12a0[_0xc9e1('0x27')]||'anonymous';this[_0xc9e1('0x28')]=_0x3f12a0[_0xc9e1('0x28')]||_0xc9e1('0x29');this[_0xc9e1('0x2a')]=_0x3f12a0[_0xc9e1('0x2a')]||0x1e;this[_0xc9e1('0x2b')]=_0x3f12a0[_0xc9e1('0x2b')]||_0xc9e1('0x2c');this[_0xc9e1('0x2d')]=_0x3f12a0[_0xc9e1('0x2d')]||0x3;this[_0xc9e1('0x2e')]=_0x3f12a0['dialQueueProject']||undefined;this[_0xc9e1('0x2f')]=_0x3f12a0[_0xc9e1('0x2f')]||0x3;this[_0xc9e1('0x30')]=_0x3f12a0[_0xc9e1('0x30')]||0x96;this['dialBusyMaxRetry']=_0x3f12a0[_0xc9e1('0x31')]||0x3;this[_0xc9e1('0x32')]=_0x3f12a0['dialBusyRetryFrequency']||0x96;this[_0xc9e1('0x33')]=_0x3f12a0['dialNoAnswerMaxRetry']||0x3;this[_0xc9e1('0x34')]=_0x3f12a0[_0xc9e1('0x34')]||0x96;this[_0xc9e1('0x35')]=_0x3f12a0[_0xc9e1('0x35')]||0x3;this[_0xc9e1('0x36')]=_0x3f12a0[_0xc9e1('0x36')]||0x96;this[_0xc9e1('0x37')]=_0x3f12a0[_0xc9e1('0x37')]||0x3;this[_0xc9e1('0x38')]=_0x3f12a0[_0xc9e1('0x38')]||0x96;this[_0xc9e1('0x39')]=_0x3f12a0['dialAbandonedMaxRetry']||0x3;this[_0xc9e1('0x3a')]=_0x3f12a0[_0xc9e1('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x3f12a0['dialMachineMaxRetry']||0x3;this[_0xc9e1('0x3b')]=_0x3f12a0[_0xc9e1('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x3f12a0[_0xc9e1('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3f12a0['dialAgentRejectRetryFrequency']||0x96;this[_0xc9e1('0x3d')]=_0x3f12a0['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x3f12a0[_0xc9e1('0x3e')]?_0x3f12a0[_0xc9e1('0x3e')]:undefined;this['TrunkBackup']=_0x3f12a0[_0xc9e1('0x3f')]?_0x3f12a0[_0xc9e1('0x3f')]:undefined;this['dialPrefix']=_0x3f12a0[_0xc9e1('0x40')]||undefined;this[_0xc9e1('0x41')]=_0x3f12a0[_0xc9e1('0x41')]?_0x3f12a0[_0xc9e1('0x41')]:undefined;this[_0xc9e1('0x42')]=_0x3f12a0['dialOrderByScheduledAt']||_0xc9e1('0x43');this[_0xc9e1('0x44')]=_0x3f12a0[_0xc9e1('0x44')]||undefined;this[_0xc9e1('0x45')]=_0x3f12a0[_0xc9e1('0x45')]||undefined;this[_0xc9e1('0x46')]=strategy[_0x3f12a0[_0xc9e1('0x46')]]||_0xc9e1('0x47');this[_0xc9e1('0x48')]=!![];this['dialAMDActive']=_0x3f12a0[_0xc9e1('0x49')]||![];this[_0xc9e1('0x4a')]=_0x3f12a0[_0xc9e1('0x4a')];this[_0xc9e1('0x4b')]=_0x3f12a0[_0xc9e1('0x4b')];this[_0xc9e1('0x4c')]=_0x3f12a0[_0xc9e1('0x4c')];this[_0xc9e1('0x4d')]=_0x3f12a0[_0xc9e1('0x4d')];this[_0xc9e1('0x4e')]=_0x3f12a0[_0xc9e1('0x4e')];this[_0xc9e1('0x4f')]=_0x3f12a0[_0xc9e1('0x4f')];this[_0xc9e1('0x50')]=_0x3f12a0[_0xc9e1('0x50')];this['dialAMDSilenceThreshold']=_0x3f12a0['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x3f12a0[_0xc9e1('0x51')];this[_0xc9e1('0x52')]=0x0;this[_0xc9e1('0x53')]=0x0;this[_0xc9e1('0x54')]=_0x3f12a0[_0xc9e1('0x54')];this[_0xc9e1('0x55')]=0x0;this[_0xc9e1('0x56')]=0x0;this[_0xc9e1('0x57')]=0x0;this[_0xc9e1('0x58')]=0x0;this[_0xc9e1('0x59')]=0x0;this[_0xc9e1('0x5a')]=0x0;this[_0xc9e1('0x5b')]=0x0;this[_0xc9e1('0x5c')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xc9e1('0x5d')]=0x0;this[_0xc9e1('0x5e')]=0x0;this[_0xc9e1('0x5f')]=0x0;this[_0xc9e1('0x60')]=undefined;this[_0xc9e1('0x61')]=undefined;this[_0xc9e1('0x62')]=undefined;this[_0xc9e1('0x63')]=1.05;this[_0xc9e1('0x64')]=0x0;this[_0xc9e1('0x65')]=0x0;this[_0xc9e1('0x66')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xc9e1('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xc9e1('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this['predictiveIntervalMaxThreshold']=_0x3f12a0[_0xc9e1('0x69')]||0x14;this['predictiveIntervalMinThreshold']=_0x3f12a0['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xc9e1('0x6a')]=0x0;this[_0xc9e1('0x6b')]=0x0;this[_0xc9e1('0x6c')]=0x1;this[_0xc9e1('0x6d')]=0x0;this[_0xc9e1('0x6e')]=0x0;this[_0xc9e1('0x6f')]=0x0;this[_0xc9e1('0x70')]=0x0;this[_0xc9e1('0x71')]=_0x3f12a0['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x3f12a0[_0xc9e1('0x72')]||![];this['dialQueueProject2']=_0x3f12a0[_0xc9e1('0x73')]||undefined;this['dialAgiAfterHangupClient']=_0x3f12a0[_0xc9e1('0x74')]||![];this[_0xc9e1('0x75')]=_0x3f12a0[_0xc9e1('0x75')]||![];this[_0xc9e1('0xc')]=monitorFormat[_0x3f12a0[_0xc9e1('0xc')]]?monitorFormat[_0x3f12a0[_0xc9e1('0xc')]]:undefined;this[_0xc9e1('0x76')]=_0x3f12a0[_0xc9e1('0x76')]||![];this[_0xc9e1('0x77')]=_0x3f12a0[_0xc9e1('0x77')]?_0x3f12a0[_0xc9e1('0x77')]:undefined;}module[_0xc9e1('0x78')]=VoiceQueue; \ No newline at end of file +var _0xd7d2=['dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','onhold','rrmemory','roundrobin','name','monitor_format','inbound','waiting','talking','sumDuration','sumHoldTime','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout'];(function(_0x408568,_0x50f87a){var _0x4a1f7e=function(_0x30e991){while(--_0x30e991){_0x408568['push'](_0x408568['shift']());}};_0x4a1f7e(++_0x50f87a);}(_0xd7d2,0x1a0));var _0x2d7d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd7d2[_0x21a9d9];return _0x46adce;};'use strict';var statusDesc=[_0x2d7d('0x0'),'not_inuse',_0x2d7d('0x1'),_0x2d7d('0x2'),_0x2d7d('0x3'),_0x2d7d('0x4'),_0x2d7d('0x5'),'ringinuse',_0x2d7d('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0x2d7d('0x7'),'roundrobin':_0x2d7d('0x8')};function VoiceQueue(_0x37fc46){this['id']=_0x37fc46['id']||0x0;this[_0x2d7d('0x9')]=_0x37fc46[_0x2d7d('0x9')]||'';this[_0x2d7d('0xa')]=_0x37fc46[_0x2d7d('0xa')]||'';this['type']=_0x37fc46['type']||_0x2d7d('0xb');this[_0x2d7d('0xc')]=0x0;this[_0x2d7d('0xd')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x2d7d('0xe')]=0x0;this[_0x2d7d('0xf')]=0x0;this[_0x2d7d('0x10')]=0x0;this['unmanaged']=0x0;this[_0x2d7d('0x11')]=0x0;this['loggedIn']=0x0;this[_0x2d7d('0x12')]=0x0;this[_0x2d7d('0x13')]=_0x37fc46[_0x2d7d('0x13')]||![];this['acwTimeout']=_0x37fc46[_0x2d7d('0x14')]||0xa;this[_0x2d7d('0x15')]=_0x37fc46[_0x2d7d('0x15')]||'no';this[_0x2d7d('0x16')]=!![];this['message']='';this[_0x2d7d('0x17')]=0x0;this[_0x2d7d('0x18')]=0x0;this['dialTimezone']=_0x37fc46[_0x2d7d('0x19')]||null;this[_0x2d7d('0x1a')]=_0x37fc46[_0x2d7d('0x1a')]?_0x37fc46['dialGlobalInterval']:null;this[_0x2d7d('0x1b')]=_0x37fc46['dialActive'];this[_0x2d7d('0x1c')]=_0x37fc46['dialMethod']||_0x2d7d('0x1d');this['dialLimitChannel']=_0x37fc46[_0x2d7d('0x1e')]||0x0;this[_0x2d7d('0x1f')]=_0x37fc46['dialLimitQueue']||0x0;this[_0x2d7d('0x20')]=_0x37fc46[_0x2d7d('0x20')]||0x1;this[_0x2d7d('0x21')]=_0x37fc46[_0x2d7d('0x21')]||_0x2d7d('0x22');this[_0x2d7d('0x23')]=_0x37fc46['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x37fc46[_0x2d7d('0x24')]||0x258;this[_0x2d7d('0x25')]=_0x37fc46['dialOriginateCallerIdName']||_0x2d7d('0x26');this[_0x2d7d('0x27')]=_0x37fc46[_0x2d7d('0x27')]||_0x2d7d('0x26');this[_0x2d7d('0x28')]=_0x37fc46['dialOriginateTimeout']||0x1e;this[_0x2d7d('0x29')]=_0x37fc46[_0x2d7d('0x29')]||_0x2d7d('0x2a');this[_0x2d7d('0x2b')]=_0x37fc46['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x37fc46[_0x2d7d('0x2c')]||undefined;this[_0x2d7d('0x2d')]=_0x37fc46[_0x2d7d('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x37fc46[_0x2d7d('0x2e')]||0x96;this[_0x2d7d('0x2f')]=_0x37fc46[_0x2d7d('0x2f')]||0x3;this[_0x2d7d('0x30')]=_0x37fc46[_0x2d7d('0x30')]||0x96;this[_0x2d7d('0x31')]=_0x37fc46['dialNoAnswerMaxRetry']||0x3;this[_0x2d7d('0x32')]=_0x37fc46['dialNoAnswerRetryFrequency']||0x96;this[_0x2d7d('0x33')]=_0x37fc46[_0x2d7d('0x33')]||0x3;this[_0x2d7d('0x34')]=_0x37fc46[_0x2d7d('0x34')]||0x96;this[_0x2d7d('0x35')]=_0x37fc46[_0x2d7d('0x35')]||0x3;this[_0x2d7d('0x36')]=_0x37fc46[_0x2d7d('0x36')]||0x96;this[_0x2d7d('0x37')]=_0x37fc46[_0x2d7d('0x37')]||0x3;this[_0x2d7d('0x38')]=_0x37fc46[_0x2d7d('0x38')]||0x96;this[_0x2d7d('0x39')]=_0x37fc46['dialMachineMaxRetry']||0x3;this[_0x2d7d('0x3a')]=_0x37fc46[_0x2d7d('0x3a')]||0x96;this[_0x2d7d('0x3b')]=_0x37fc46[_0x2d7d('0x3b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x37fc46['dialAgentRejectRetryFrequency']||0x96;this[_0x2d7d('0x3c')]=_0x37fc46['dialGlobalMaxRetry']||0x4;this[_0x2d7d('0x3d')]=_0x37fc46[_0x2d7d('0x3d')]?_0x37fc46['Trunk']:undefined;this[_0x2d7d('0x3e')]=_0x37fc46[_0x2d7d('0x3e')]?_0x37fc46['TrunkBackup']:undefined;this[_0x2d7d('0x3f')]=_0x37fc46[_0x2d7d('0x3f')]||undefined;this[_0x2d7d('0x40')]=_0x37fc46['Interval']?_0x37fc46[_0x2d7d('0x40')]:undefined;this[_0x2d7d('0x41')]=_0x37fc46[_0x2d7d('0x41')]||_0x2d7d('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x37fc46[_0x2d7d('0x43')]||undefined;this['dialCutDigit']=_0x37fc46[_0x2d7d('0x44')]||undefined;this[_0x2d7d('0x45')]=strategy[_0x37fc46[_0x2d7d('0x45')]]||_0x2d7d('0x7');this[_0x2d7d('0x46')]=!![];this[_0x2d7d('0x47')]=_0x37fc46[_0x2d7d('0x47')]||![];this[_0x2d7d('0x48')]=_0x37fc46['dialAMDInitialSilence'];this[_0x2d7d('0x49')]=_0x37fc46[_0x2d7d('0x49')];this[_0x2d7d('0x4a')]=_0x37fc46[_0x2d7d('0x4a')];this[_0x2d7d('0x4b')]=_0x37fc46[_0x2d7d('0x4b')];this[_0x2d7d('0x4c')]=_0x37fc46[_0x2d7d('0x4c')];this['dialAMDBetweenWordsSilence']=_0x37fc46[_0x2d7d('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x37fc46[_0x2d7d('0x4e')];this['dialAMDSilenceThreshold']=_0x37fc46['dialAMDSilenceThreshold'];this[_0x2d7d('0x4f')]=_0x37fc46[_0x2d7d('0x4f')];this[_0x2d7d('0x50')]=0x0;this[_0x2d7d('0x51')]=0x0;this['timeout']=_0x37fc46['timeout'];this[_0x2d7d('0x52')]=0x0;this[_0x2d7d('0x53')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2d7d('0x54')]=0x0;this[_0x2d7d('0x55')]=0x0;this[_0x2d7d('0x56')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x2d7d('0x57')]=0x0;this[_0x2d7d('0x58')]=0x0;this[_0x2d7d('0x59')]=0x0;this[_0x2d7d('0x5a')]=0x0;this[_0x2d7d('0x5b')]=0x0;this['startProgressive']=undefined;this[_0x2d7d('0x5c')]=undefined;this['handlePredictive']=undefined;this[_0x2d7d('0x5d')]=1.05;this[_0x2d7d('0x5e')]=0x0;this[_0x2d7d('0x5f')]=0x0;this[_0x2d7d('0x60')]=0x0;this[_0x2d7d('0x61')]=0x0;this[_0x2d7d('0x62')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x2d7d('0x63')]=0x0;this[_0x2d7d('0x64')]=0x0;this['predictiveIntervalMaxThreshold']=_0x37fc46['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x2d7d('0x65')]=_0x37fc46[_0x2d7d('0x66')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x2d7d('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x2d7d('0x68')]=0x0;this[_0x2d7d('0x69')]=0x0;this[_0x2d7d('0x6a')]=0x0;this['erlangBusyFactor']=0x0;this[_0x2d7d('0x6b')]=_0x37fc46[_0x2d7d('0x6b')]||0x1e;this[_0x2d7d('0x6c')]=_0x37fc46[_0x2d7d('0x6c')]||![];this[_0x2d7d('0x6d')]=_0x37fc46[_0x2d7d('0x6d')]||undefined;this[_0x2d7d('0x6e')]=_0x37fc46[_0x2d7d('0x6e')]||![];this[_0x2d7d('0x6f')]=_0x37fc46[_0x2d7d('0x6f')]||![];this[_0x2d7d('0xa')]=monitorFormat[_0x37fc46[_0x2d7d('0xa')]]?monitorFormat[_0x37fc46[_0x2d7d('0xa')]]:undefined;this[_0x2d7d('0x70')]=_0x37fc46[_0x2d7d('0x70')]||![];this[_0x2d7d('0x71')]=_0x37fc46[_0x2d7d('0x71')]?_0x37fc46[_0x2d7d('0x71')]:undefined;}module[_0x2d7d('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 834e81e..c3e7654 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 _0x0ef1=['name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x33bbaa,_0x1f5395){var _0x579de3=function(_0x113047){while(--_0x113047){_0x33bbaa['push'](_0x33bbaa['shift']());}};_0x579de3(++_0x1f5395);}(_0x0ef1,0xcc));var _0x10ef=function(_0x320c0c,_0x3f03bd){_0x320c0c=_0x320c0c-0x0;var _0x5a49bc=_0x0ef1[_0x320c0c];return _0x5a49bc;};'use strict';function VtigerAccount(_0x4cb2b3){this['id']=_0x4cb2b3['id']||0x0;this[_0x10ef('0x0')]=_0x4cb2b3[_0x10ef('0x0')]||'';this[_0x10ef('0x1')]=_0x4cb2b3[_0x10ef('0x1')]||'';this[_0x10ef('0x2')]=_0x4cb2b3[_0x10ef('0x2')]||'';this[_0x10ef('0x3')]=_0x4cb2b3['remoteUri']||'';this[_0x10ef('0x4')]=_0x4cb2b3[_0x10ef('0x4')]||'';this[_0x10ef('0x5')]=_0x4cb2b3[_0x10ef('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xd0a1=['accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd0a1,0x1d0));var _0x1d0a=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0xd0a1[_0x587dd0];return _0x56f153;};'use strict';function VtigerAccount(_0x48d6d2){this['id']=_0x48d6d2['id']||0x0;this[_0x1d0a('0x0')]=_0x48d6d2['name']||'';this['username']=_0x48d6d2['username']||'';this['accessKey']=_0x48d6d2[_0x1d0a('0x1')]||'';this[_0x1d0a('0x2')]=_0x48d6d2[_0x1d0a('0x2')]||'';this[_0x1d0a('0x3')]=_0x48d6d2[_0x1d0a('0x3')]||'';this[_0x1d0a('0x4')]=_0x48d6d2['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 632b7e7..5151ed1 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 _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x3956bc,_0x1aab53){var _0x13c8c8=function(_0x4316d6){while(--_0x4316d6){_0x3956bc['push'](_0x3956bc['shift']());}};_0x13c8c8(++_0x1aab53);}(_0x2032,0xd9));var _0x2203=function(_0x390056,_0x218f36){_0x390056=_0x390056-0x0;var _0x1bac6d=_0x2032[_0x390056];return _0x1bac6d;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x401402,_0x4d03d5){var _0x288636=function(_0x1a5ff5){while(--_0x1a5ff5){_0x401402['push'](_0x401402['shift']());}};_0x288636(++_0x4d03d5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('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 a17507a..691b88c 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 _0x9147=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x376881,_0x4f6764){var _0x3c13e3=function(_0x18aefe){while(--_0x18aefe){_0x376881['push'](_0x376881['shift']());}};_0x3c13e3(++_0x4f6764);}(_0x9147,0x7b));var _0x7914=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x9147[_0x13ea00];return _0x1f7347;};'use strict';function ZohoAccount(_0x202c42){this['id']=_0x202c42['id']||0x0;this[_0x7914('0x0')]=_0x202c42['name']||'';this[_0x7914('0x1')]=_0x202c42['description']||'';this[_0x7914('0x2')]=_0x202c42[_0x7914('0x2')]||'';this['zone']=_0x202c42[_0x7914('0x3')]||'';this[_0x7914('0x4')]=_0x202c42[_0x7914('0x4')]||'';this['clientSecret']=_0x202c42[_0x7914('0x5')]||'';this['serverUrl']=_0x202c42[_0x7914('0x6')]||'';this['code']=_0x202c42[_0x7914('0x7')]||'';this[_0x7914('0x8')]=_0x202c42[_0x7914('0x8')]||'';this[_0x7914('0x9')]=_0x202c42[_0x7914('0x9')]||{};}module[_0x7914('0xa')]=ZohoAccount; \ No newline at end of file +var _0x98d8=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId'];(function(_0x3356f1,_0x53eb78){var _0x4ff289=function(_0x3bb3c8){while(--_0x3bb3c8){_0x3356f1['push'](_0x3356f1['shift']());}};_0x4ff289(++_0x53eb78);}(_0x98d8,0xce));var _0x898d=function(_0x44d2a8,_0x337c45){_0x44d2a8=_0x44d2a8-0x0;var _0x53b4bf=_0x98d8[_0x44d2a8];return _0x53b4bf;};'use strict';function ZohoAccount(_0x8893d5){this['id']=_0x8893d5['id']||0x0;this[_0x898d('0x0')]=_0x8893d5[_0x898d('0x0')]||'';this[_0x898d('0x1')]=_0x8893d5[_0x898d('0x1')]||'';this[_0x898d('0x2')]=_0x8893d5[_0x898d('0x2')]||'';this['zone']=_0x8893d5['zone']||'';this[_0x898d('0x3')]=_0x8893d5['clientId']||'';this['clientSecret']=_0x8893d5[_0x898d('0x4')]||'';this['serverUrl']=_0x8893d5[_0x898d('0x5')]||'';this['code']=_0x8893d5[_0x898d('0x6')]||'';this['refreshToken']=_0x8893d5[_0x898d('0x7')]||'';this[_0x898d('0x8')]=_0x8893d5[_0x898d('0x8')]||{};}module[_0x898d('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 d28975d..8002748 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 _0x8bf0=['firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countdropretry','countabandonedretry','countagentrejectretry','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact'];(function(_0x494c6f,_0x54dbe7){var _0x4c9c08=function(_0x22fe1b){while(--_0x22fe1b){_0x494c6f['push'](_0x494c6f['shift']());}};_0x4c9c08(++_0x54dbe7);}(_0x8bf0,0x1dd));var _0x08bf=function(_0x4bd0b3,_0x7b8c07){_0x4bd0b3=_0x4bd0b3-0x0;var _0x205576=_0x8bf0[_0x4bd0b3];return _0x205576;};'use strict';var util=require(_0x08bf('0x0'));var _=require(_0x08bf('0x1'));var moment=require('moment');function checkNameSurname(_0x550c8e,_0x2fbade,_0x4b167d){var _0x5e43af='';if(!_[_0x08bf('0x2')](_0x2fbade)&&_0x08bf('0x3')===typeof _0x2fbade){_0x5e43af+=_0x2fbade;}if(!_['isNil'](_0x4b167d)&&_0x08bf('0x3')===typeof _0x4b167d){_0x5e43af+='\x20'+_0x4b167d;}if(_0x5e43af!==''){return _0x5e43af;}return _0x550c8e;}function Action(_0x3e6ef2,_0x214cb1,_0x55bb6d,_0x2f37fd,_0x46c838){this['uniqueid']=_0x55bb6d||undefined;this['idContact']=_0x3e6ef2['id'];this[_0x08bf('0x4')]=_0x214cb1[_0x08bf('0x5')];this['type']=_0x214cb1[_0x08bf('0x6')];this[_0x08bf('0x7')]=_0x08bf('0x4');this[_0x08bf('0x8')]=![];this[_0x08bf('0x9')]=_[_0x08bf('0x2')](_0x3e6ef2[_0x08bf('0xa')])?undefined:_0x3e6ef2[_0x08bf('0xa')][_0x08bf('0x5')];this[_0x08bf('0xb')]=this['membername']?util[_0x08bf('0xc')]('SIP/%s',this[_0x08bf('0x9')]):_0x2f37fd||undefined;this[_0x08bf('0xd')]=checkNameSurname(_0x3e6ef2[_0x08bf('0xe')]['phone'],_0x3e6ef2[_0x08bf('0xe')][_0x08bf('0xf')],_0x3e6ef2[_0x08bf('0xe')]['lastName']);this['active']=_0x3e6ef2[_0x08bf('0x10')]||![];this[_0x08bf('0x11')]=_0x3e6ef2[_0x08bf('0xe')]['phone'];this[_0x08bf('0x12')]=_0x3e6ef2[_0x08bf('0x12')];this['countbusyretry']=_0x3e6ef2[_0x08bf('0x13')]||0x0;this[_0x08bf('0x14')]=_0x3e6ef2[_0x08bf('0x14')]||0x0;this[_0x08bf('0x15')]=_0x3e6ef2[_0x08bf('0x15')]||0x0;this['countglobal']=(_0x3e6ef2[_0x08bf('0x13')]||0x0)+(_0x3e6ef2['countcongestionretry']||0x0)+(_0x3e6ef2['countnoanswerretry']||0x0)+(_0x3e6ef2[_0x08bf('0x16')]||0x0)+(_0x3e6ef2['countdropretry']||0x0)+(_0x3e6ef2['countabandonedretry']||0x0)+(_0x3e6ef2[_0x08bf('0x17')]||0x0)+(_0x3e6ef2['countagentrejectretry']||0x0);this[_0x08bf('0x16')]=_0x3e6ef2[_0x08bf('0x16')]||0x0;this['countdropretry']=_0x3e6ef2[_0x08bf('0x18')]||0x0;this[_0x08bf('0x19')]=_0x3e6ef2[_0x08bf('0x19')]||0x0;this['countmachineretry']=_0x3e6ef2[_0x08bf('0x17')]||0x0;this[_0x08bf('0x1a')]=_0x3e6ef2['countagentrejectretry']||0x0;this['callback']=_0x3e6ef2[_0x08bf('0x1b')];this['callbackuniqueid']=_0x3e6ef2['callbackuniqueid'];this[_0x08bf('0x1c')]=_0x3e6ef2[_0x08bf('0x1c')];this['recallme']=_0x3e6ef2[_0x08bf('0x1d')];this['ContactId']=_0x3e6ef2[_0x08bf('0x1e')];this['ListId']=_0x3e6ef2[_0x08bf('0x1f')];this[_0x08bf('0x20')]=_[_0x08bf('0x2')](_0x3e6ef2[_0x08bf('0xa')])?_0x3e6ef2[_0x08bf('0x20')]:_0x3e6ef2[_0x08bf('0xa')]['id'];this['VoiceQueueId']=_0x3e6ef2[_0x08bf('0x21')];this[_0x08bf('0x22')]='';this[_0x08bf('0x23')]='';}Action[_0x08bf('0x24')][_0x08bf('0x25')]=function(){return util[_0x08bf('0xc')](_0x08bf('0x26'),this['calleridname'],this[_0x08bf('0x27')]);};module[_0x08bf('0x28')]=Action; \ No newline at end of file +var _0x6355=['countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','\x22%s\x22\x20<%s>','calleridname','number','exports','util','string','isNil','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5c7281,_0x1e9124){var _0x53eb77=function(_0x22bb42){while(--_0x22bb42){_0x5c7281['push'](_0x5c7281['shift']());}};_0x53eb77(++_0x1e9124);}(_0x6355,0x69));var _0x5635=function(_0x5011b7,_0x1b3ff7){_0x5011b7=_0x5011b7-0x0;var _0x4dc161=_0x6355[_0x5011b7];return _0x4dc161;};'use strict';var util=require(_0x5635('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x45e0d2,_0x50e7f9,_0x132f07){var _0xfc8d0e='';if(!_['isNil'](_0x50e7f9)&&_0x5635('0x1')===typeof _0x50e7f9){_0xfc8d0e+=_0x50e7f9;}if(!_[_0x5635('0x2')](_0x132f07)&&'string'===typeof _0x132f07){_0xfc8d0e+='\x20'+_0x132f07;}if(_0xfc8d0e!==''){return _0xfc8d0e;}return _0x45e0d2;}function Action(_0x3ab106,_0x2fe6e6,_0x168856,_0xa0df08,_0x16e290){this[_0x5635('0x3')]=_0x168856||undefined;this[_0x5635('0x4')]=_0x3ab106['id'];this[_0x5635('0x5')]=_0x2fe6e6[_0x5635('0x6')];this[_0x5635('0x7')]=_0x2fe6e6[_0x5635('0x7')];this[_0x5635('0x8')]=_0x5635('0x5');this[_0x5635('0x9')]=![];this[_0x5635('0xa')]=_[_0x5635('0x2')](_0x3ab106[_0x5635('0xb')])?undefined:_0x3ab106['Agent'][_0x5635('0x6')];this[_0x5635('0xc')]=this[_0x5635('0xa')]?util[_0x5635('0xd')]('SIP/%s',this[_0x5635('0xa')]):_0xa0df08||undefined;this['calleridname']=checkNameSurname(_0x3ab106[_0x5635('0xe')]['phone'],_0x3ab106[_0x5635('0xe')][_0x5635('0xf')],_0x3ab106[_0x5635('0xe')][_0x5635('0x10')]);this[_0x5635('0x11')]=_0x3ab106[_0x5635('0x11')]||![];this[_0x5635('0x12')]=_0x3ab106[_0x5635('0xe')][_0x5635('0x13')];this[_0x5635('0x14')]=_0x3ab106[_0x5635('0x14')];this['countbusyretry']=_0x3ab106[_0x5635('0x15')]||0x0;this[_0x5635('0x16')]=_0x3ab106[_0x5635('0x16')]||0x0;this[_0x5635('0x17')]=_0x3ab106['countnoanswerretry']||0x0;this[_0x5635('0x18')]=(_0x3ab106['countbusyretry']||0x0)+(_0x3ab106['countcongestionretry']||0x0)+(_0x3ab106[_0x5635('0x17')]||0x0)+(_0x3ab106[_0x5635('0x19')]||0x0)+(_0x3ab106[_0x5635('0x1a')]||0x0)+(_0x3ab106[_0x5635('0x1b')]||0x0)+(_0x3ab106[_0x5635('0x1c')]||0x0)+(_0x3ab106[_0x5635('0x1d')]||0x0);this[_0x5635('0x19')]=_0x3ab106[_0x5635('0x19')]||0x0;this[_0x5635('0x1a')]=_0x3ab106[_0x5635('0x1a')]||0x0;this[_0x5635('0x1b')]=_0x3ab106[_0x5635('0x1b')]||0x0;this[_0x5635('0x1c')]=_0x3ab106[_0x5635('0x1c')]||0x0;this[_0x5635('0x1d')]=_0x3ab106[_0x5635('0x1d')]||0x0;this[_0x5635('0x1e')]=_0x3ab106[_0x5635('0x1e')];this['callbackuniqueid']=_0x3ab106[_0x5635('0x1f')];this[_0x5635('0x20')]=_0x3ab106[_0x5635('0x20')];this[_0x5635('0x21')]=_0x3ab106['recallme'];this[_0x5635('0x22')]=_0x3ab106[_0x5635('0x22')];this['ListId']=_0x3ab106['ListId'];this[_0x5635('0x23')]=_[_0x5635('0x2')](_0x3ab106[_0x5635('0xb')])?_0x3ab106['UserId']:_0x3ab106[_0x5635('0xb')]['id'];this[_0x5635('0x24')]=_0x3ab106['VoiceQueueId'];this['originatecalleridnum']='';this[_0x5635('0x25')]='';}Action[_0x5635('0x26')]['getCaller']=function(){return util['format'](_0x5635('0x27'),this[_0x5635('0x28')],this[_0x5635('0x29')]);};module[_0x5635('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 7e703aa..9b754e9 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 _0xa2ac=['starttime','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','isFailure','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','destuniqueid','dialstatus','addVariable','variables','filterKey','variable','keys','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','preview','../ami','./rpcDb','./util/util','redis','localhost','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncNewExten','varset','syncVarSet','attendedtransfer','syncBlindTransfer','emit','type','outbound','strategy','answered','available','pTalking','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_channel:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','UserId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','createCustomerFinal','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','dialBusyMaxRetry','scheduledAt','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','dialBusyRetryFrequency','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','dialAnswer','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','execRun','unlock','recallme','isValid','checkIsBlackList','then','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','[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','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables'];(function(_0x29caf3,_0x88a317){var _0x3dc931=function(_0x228469){while(--_0x228469){_0x29caf3['push'](_0x29caf3['shift']());}};_0x3dc931(++_0x88a317);}(_0xa2ac,0x176));var _0xca2a=function(_0x99fe07,_0x4be434){_0x99fe07=_0x99fe07-0x0;var _0x58315c=_0xa2ac[_0x99fe07];return _0x58315c;};'use strict';var util=require(_0xca2a('0x0'));var _=require(_0xca2a('0x1'));var BPromise=require(_0xca2a('0x2'));var uuid=require(_0xca2a('0x3'));var moment=require(_0xca2a('0x4'));var md5=require(_0xca2a('0x5'));var Redis=require(_0xca2a('0x6'));var config=require('../../../config/environment');var logger=require(_0xca2a('0x7'))(_0xca2a('0x8'));var loggerAction=require(_0xca2a('0x7'))('actionPreview');var ami=require(_0xca2a('0x9'));var rpcDb=require(_0xca2a('0xa'));var Action=require('./action');var ut=require(_0xca2a('0xb'));config[_0xca2a('0xc')]=_['defaults'](config[_0xca2a('0xc')],{'host':_0xca2a('0xd'),'port':0x18eb});var io=require(_0xca2a('0xe'))(new Redis(config[_0xca2a('0xc')]));var Sequence=function(){};Sequence[_0xca2a('0xf')]['enqueue']=function(_0x2464e5){this[_0xca2a('0x10')]=this[_0xca2a('0x10')]?this[_0xca2a('0x10')]['finally'](_0x2464e5):_0x2464e5();};function Preview(_0x5e337f){this[_0xca2a('0x11')]=new Sequence();this[_0xca2a('0x12')]=_0x5e337f[_0xca2a('0x13')];this[_0xca2a('0x14')]=_0x5e337f[_0xca2a('0x14')];this[_0xca2a('0x15')]={};this['agents']=_0x5e337f[_0xca2a('0x16')];this[_0xca2a('0x17')]=0x0;ami['on'](_0xca2a('0x18'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xca2a('0x19'),this[_0xca2a('0x1a')][_0xca2a('0x1b')](this));ami['on'](_0xca2a('0x1c'),this[_0xca2a('0x1d')][_0xca2a('0x1b')](this));ami['on'](_0xca2a('0x1e'),this['syncDialEnd'][_0xca2a('0x1b')](this));ami['on']('newexten',this[_0xca2a('0x1f')][_0xca2a('0x1b')](this));ami['on'](_0xca2a('0x20'),this[_0xca2a('0x21')][_0xca2a('0x1b')](this));ami['on'](_0xca2a('0x22'),this['syncAttendedTransfer'][_0xca2a('0x1b')](this));ami['on']('blindtransfer',this[_0xca2a('0x23')]['bind'](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0xbb223a,_0xe7d80a,_0x4f5c03){io['to'](_0xbb223a)[_0xca2a('0x24')](_0xe7d80a,_0x4f5c03);}function emitCampaignPreview(_0x311802){if(_0x311802[_0xca2a('0x25')]===_0xca2a('0x26')){var _0x4e2d13={'id':_0x311802['id'],'name':_0x311802['name'],'strategy':_0x311802[_0xca2a('0x27')],'answered':_0x311802[_0xca2a('0x28')],'available':_0x311802[_0xca2a('0x29')],'loggedIn':_0x311802['loggedIn'],'pTalking':_0x311802[_0xca2a('0x2a')],'sumBillable':_0x311802['sumBillable'],'sumDuration':_0x311802['sumDuration'],'sumHoldTime':_0x311802[_0xca2a('0x2b')]||0x0,'talking':_0x311802['talking'],'total':_0x311802[_0xca2a('0x2c')],'type':_0x311802[_0xca2a('0x25')],'unmanaged':_0x311802[_0xca2a('0x2d')],'abandoned':_0x311802[_0xca2a('0x2e')],'waiting':_0x311802[_0xca2a('0x2f')],'loggedInDb':_0x311802[_0xca2a('0x30')],'dialActive':_0x311802[_0xca2a('0x31')],'dialMethod':_0x311802[_0xca2a('0x32')],'dialOriginateCallerIdName':_0x311802[_0xca2a('0x33')],'dialOriginateCallerIdNumber':_0x311802[_0xca2a('0x34')],'dialOriginateTimeout':_0x311802['dialOriginateTimeout'],'dialPrefix':_0x311802[_0xca2a('0x35')],'outboundAnswerAgiCallsDay':_0x311802['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x311802[_0xca2a('0x36')],'outboundBlacklistCallsDay':_0x311802[_0xca2a('0x37')],'outboundBusyCallsDay':_0x311802[_0xca2a('0x38')],'outboundCongestionCallsDay':_0x311802[_0xca2a('0x39')],'outboundDropCallsDayACS':_0x311802[_0xca2a('0x3a')],'outboundDropCallsDayCallersExit':_0x311802['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x311802['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x311802[_0xca2a('0x3b')],'outboundNoSuchCallsDay':_0x311802[_0xca2a('0x3c')],'outboundOriginateFailureCallsDay':_0x311802[_0xca2a('0x3d')],'outboundReCallsDay':_0x311802[_0xca2a('0x3e')],'outboundRejectCallsDay':_0x311802[_0xca2a('0x3f')],'outboundUnknownCallsDay':_0x311802[_0xca2a('0x40')],'outboundAbandonedCallsDay':_0x311802['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x311802['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x311802[_0xca2a('0x41')],'predictiveIntervalAvgTalktime':_0x311802['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x311802[_0xca2a('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x311802['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x311802[_0xca2a('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x311802[_0xca2a('0x44')],'predictiveIntervalHitRate':_0x311802[_0xca2a('0x45')],'predictiveIntervalMultiplicativeFactor':_0x311802[_0xca2a('0x46')],'predictiveIntervalPauses':_0x311802[_0xca2a('0x47')],'predictiveIntervalAvailable':_0x311802[_0xca2a('0x48')],'predictiveIntervalTotalCalls':_0x311802['predictiveIntervalTotalCalls'],'message':_0x311802[_0xca2a('0x49')],'originated':_0x311802[_0xca2a('0x4a')],'erlangCalls':_0x311802[_0xca2a('0x4b')],'erlangCallToSecond':_0x311802['erlangCallToSecond'],'erlangAbandonmentRate':_0x311802[_0xca2a('0x4c')],'erlangBusyFactor':_0x311802[_0xca2a('0x4d')],'startPredictive':_0x311802['startPredictive'],'startProgressive':_0x311802[_0xca2a('0x4e')]};if(_0x311802[_0xca2a('0x4f')]){_0x4e2d13['Trunk']={'id':_0x311802['Trunk']['id'],'name':_0x311802[_0xca2a('0x4f')][_0xca2a('0x50')],'active':_0x311802[_0xca2a('0x4f')][_0xca2a('0x51')],'callerid':_0x311802[_0xca2a('0x4f')]['callerid']};}if(_0x311802[_0xca2a('0x52')]){_0x4e2d13['Interval']={'id':_0x311802['Interval']['id'],'name':_0x311802[_0xca2a('0x52')][_0xca2a('0x50')]};}var _0x3a7428=md5(JSON[_0xca2a('0x53')](_0x4e2d13));if(_0x311802[_0xca2a('0x5')]!==_0x3a7428){_0x311802[_0xca2a('0x5')]=_0x3a7428;emit(util[_0xca2a('0x54')](_0xca2a('0x55'),_0x4e2d13[_0xca2a('0x50')]),_0xca2a('0x56'),_0x4e2d13);}}}function emitVoiceQueueChannelRemove(_0x115cf4){logger[_0xca2a('0x57')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xca2a('0x53')](_0x115cf4));emit(util[_0xca2a('0x54')](_0xca2a('0x55'),_0x115cf4['name']),_0xca2a('0x58'),_0x115cf4);}function notSendMessagesQueue(_0x7f59c){if(_0x7f59c['sendMessageOneNotActive']){if(_0x7f59c[_0xca2a('0x4a')]===0x0&&_0x7f59c[_0xca2a('0x2a')]===0x0){_0x7f59c[_0xca2a('0x59')]=![];_0x7f59c[_0xca2a('0x29')]=0x0;_0x7f59c[_0xca2a('0x5a')]=0x0;_0x7f59c['message']='NOT_ACTIVE';ut[_0xca2a('0x5b')](_0xca2a('0x5c'),_0x7f59c[_0xca2a('0x50')]+_0xca2a('0x5d'));}else{_0x7f59c['message']=_0xca2a('0x5e');ut[_0xca2a('0x5b')](_0xca2a('0x5c'),_0x7f59c['name']+_0xca2a('0x5f'));}emitCampaignPreview(_0x7f59c);}}Preview[_0xca2a('0xf')][_0xca2a('0x60')]=function(){var _0x2fd0e3=this;setInterval(function(){_0x2fd0e3[_0xca2a('0x61')]();},0x7cf);};Preview[_0xca2a('0xf')][_0xca2a('0x61')]=function(){var _0x2e086a=this[_0xca2a('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x354ae4 in _0x2e086a){if(_0x2e086a[_0xca2a('0x62')](_0x354ae4)&&(_0x2e086a[_0x354ae4][_0xca2a('0x32')]===_0xca2a('0x8')||_0x2e086a[_0x354ae4][_0xca2a('0x32')]===_0xca2a('0x63'))&&_0x2e086a[_0x354ae4][_0xca2a('0x25')]===_0xca2a('0x26')){if(this[_0xca2a('0x17')]>0x7){this[_0xca2a('0x17')]=0x0;this[_0xca2a('0x64')]();}}if(_0x2e086a[_0xca2a('0x62')](_0x354ae4)&&_0x2e086a[_0x354ae4][_0xca2a('0x32')]===_0xca2a('0x8')&&_0x2e086a[_0x354ae4]['type']==='outbound'){if(_0x2e086a[_0x354ae4]['dialActive']){this['setMessage'](_0x2e086a[_0x354ae4]);this['recallMe'](_0x2e086a[_0x354ae4]);}else{notSendMessagesQueue(_0x2e086a[_0x354ae4]);}}}};Preview[_0xca2a('0xf')][_0xca2a('0x65')]=function(_0x4d2cbd){var _0x34ab16=this;this[_0xca2a('0x11')]['enqueue'](function(){if(!_[_0xca2a('0x66')](_0x34ab16[_0xca2a('0x15')][_0x4d2cbd])){loggerAction[_0xca2a('0x57')](_0xca2a('0x67'),_0x4d2cbd,_0xca2a('0x68'),_0x34ab16['actions'][_0x4d2cbd]['queue'],_0xca2a('0x69'),JSON[_0xca2a('0x53')](_0x34ab16[_0xca2a('0x12')][_0x34ab16[_0xca2a('0x15')][_0x4d2cbd][_0xca2a('0x6a')]][_0xca2a('0x4a')]),_0xca2a('0x6b'),JSON[_0xca2a('0x53')](_0x34ab16[_0xca2a('0x12')][_0x34ab16['actions'][_0x4d2cbd][_0xca2a('0x6a')]][_0xca2a('0x2a')]),JSON[_0xca2a('0x53')](_0x34ab16[_0xca2a('0x15')][_0x4d2cbd]['dialAnswer']),JSON[_0xca2a('0x53')](_[_0xca2a('0x6c')](_0x34ab16[_0xca2a('0x15')][_0x4d2cbd],[_0xca2a('0x6d'),_0xca2a('0x6e'),'VoiceQueueId',_0xca2a('0x6f')])));return ami['Action']({'action':_0xca2a('0x70'),'channel':_0x34ab16[_0xca2a('0x15')][_0x4d2cbd][_0xca2a('0x71')]})[_0xca2a('0x72')](function(_0x1e02fe){if(_0x1e02fe['message']===_0xca2a('0x73')){setTimeout(function(){if(_0x34ab16[_0xca2a('0x15')][_0x4d2cbd]){ut[_0xca2a('0x74')](_0x34ab16['campaignsPreview'][_0x34ab16[_0xca2a('0x15')][_0x4d2cbd][_0xca2a('0x6a')]],_0xca2a('0x75'));if(_0x34ab16[_0xca2a('0x15')][_0x4d2cbd]['dialAnswer']===!![]){ut['decrementTalkink'](_0x34ab16[_0xca2a('0x12')][_0x34ab16['actions'][_0x4d2cbd]['queue']],_0xca2a('0x75'));ut[_0xca2a('0x76')](_0xca2a('0x77')+_0x4d2cbd,_0x34ab16['actions'][_0x4d2cbd][_0xca2a('0x6a')]);}ut[_0xca2a('0x76')]('[Dialer][checkChannel][Preview]'+_0x4d2cbd,_0x34ab16[_0xca2a('0x15')][_0x4d2cbd][_0xca2a('0x6a')]);delete _0x34ab16['actions'][_0x4d2cbd];}},0x2328);}});}});};Preview['prototype'][_0xca2a('0x64')]=function(){var _0x393356=this;loggerAction[_0xca2a('0x57')](_0xca2a('0x78'),_['size'](this['actions']));for(var _0x26276a in this[_0xca2a('0x15')]){if(_0x393356['actions']['hasOwnProperty'](_0x26276a)){_0x393356[_0xca2a('0x65')](_0x26276a);}}};Preview[_0xca2a('0xf')][_0xca2a('0x79')]=function(_0x5cda62){var _0x152452=this;rpcDb[_0xca2a('0x7a')](_0x5cda62['id'],ut[_0xca2a('0x7b')](this[_0xca2a('0x16')]))['then'](function(_0x542c20){if(!_['isNil'](_0x542c20)){for(var _0x41d40c=0x0;_0x41d40c<_0x542c20[_0xca2a('0x7c')];_0x41d40c+=0x1){if(ut[_0xca2a('0x7d')](_0x542c20[_0x41d40c][_0xca2a('0x7e')])<_0x5cda62[_0xca2a('0x7f')]*0x3c){if(_0x542c20[_0x41d40c][_0xca2a('0x80')]&&!_0x542c20[_0x41d40c][_0xca2a('0x80')][_0xca2a('0x81')]){_0x152452[_0xca2a('0x82')](_0x542c20[_0x41d40c]['id'])['then'](ut['logger2'](_0xca2a('0x83')))['catch'](ut[_0xca2a('0x84')](_0xca2a('0x83')));}else{rpcDb[_0xca2a('0x85')](_0x542c20[_0x41d40c]['id']);}}else{var _0xb5ced9=new Action(_0x542c20[_0x41d40c],_0x5cda62);_0xb5ced9['starttime']=moment()[_0xca2a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x5cda62[_0xca2a('0x3e')]+=0x1;ut[_0xca2a('0x86')](_0xb5ced9,0x17,_0xca2a('0x87'));if(_0x5cda62[_0xca2a('0x88')]){rpcDb[_0xca2a('0x89')](ut[_0xca2a('0x8a')](_0x542c20[_0x41d40c]));rpcDb[_0xca2a('0x8b')](_0xb5ced9,_0xca2a('0x8c'));}else{ut['logCustomer'](_0xb5ced9,0x16,_0xca2a('0x8d'));rpcDb[_0xca2a('0x8b')](_0xb5ced9,_0xca2a('0x8e'));rpcDb['createCustomerFinal'](_0xb5ced9,_0xca2a('0x8e'));}}}}})[_0xca2a('0x72')](ut[_0xca2a('0x84')](_0xca2a('0x8f')));};Preview[_0xca2a('0xf')][_0xca2a('0x90')]=function(_0x2abcb5){_0x2abcb5[_0xca2a('0x59')]=!![];if(ut[_0xca2a('0x91')](_0x2abcb5['loggedIn'])){_0x2abcb5[_0xca2a('0x49')]=_0xca2a('0x92');}else if(!ut[_0xca2a('0x93')](_0x2abcb5[_0xca2a('0x31')])){_0x2abcb5[_0xca2a('0x49')]=_0xca2a('0x94');}else if(!this[_0xca2a('0x95')](_0x2abcb5[_0xca2a('0x4f')])){if(!this[_0xca2a('0x95')](_0x2abcb5[_0xca2a('0x96')])){_0x2abcb5['message']=_0xca2a('0x97');}else{_0x2abcb5['message']='ACTIVE';}}else{_0x2abcb5['message']=_0xca2a('0x98');}emitCampaignPreview(_0x2abcb5);};Preview[_0xca2a('0xf')]['callProgressDetectingCustomer']=function(_0xbad48a,_0x4bc76a,_0x147a32){var _0x1b106e=this;var _0x4315e7=this['actions'][_0x4bc76a];var _0x2f1f3f=this[_0xca2a('0x12')][_0x4315e7[_0xca2a('0x6a')]];var _0xe0db35;if(_0x2f1f3f){switch(_0x147a32){case'1':_0x2f1f3f[_0xca2a('0x3c')]+=0x1;_0x4315e7[_0xca2a('0x99')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0x0,'NoSuchNumber');ami['emit'](_0xca2a('0x9c'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0x9e')));rpcDb[_0xca2a('0x8b')](_0x4315e7,_0xca2a('0x9f'));if(ut['totalGlobal'](_0x4315e7)>=_0x2f1f3f['dialGlobalMaxRetry']){_0xe0db35=ut[_0xca2a('0xa0')](_0x4315e7,0xf,_0xca2a('0xa1'));rpcDb['createCustomerFinal'](_0xe0db35,_0xca2a('0xa2'));}else{if(_0x4315e7[_0xca2a('0x99')]>=_0x2f1f3f[_0xca2a('0xa3')]){rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xa2'));}else{rpcDb[_0xca2a('0xa5')](ut['scheduledAt'](_0x4315e7,_0xca2a('0x99'),_0x2f1f3f[_0xca2a('0xa6')]),_0x4315e7[_0xca2a('0xa7')],_0x4315e7[_0xca2a('0xa8')]);}}delete this[_0xca2a('0x15')][_0xbad48a[_0xca2a('0xa9')]];break;case'ANSWER':var _0x135b1b=moment()['format'](_0xca2a('0xaa'));_0x4315e7['responsetime']=_0x135b1b;_0x4315e7[_0xca2a('0xab')]=_0x135b1b;_0x4315e7['dialAnswer']=!![];_0x2f1f3f[_0xca2a('0x2a')]+=0x1;logger[_0xca2a('0x57')](_0xca2a('0xac'),_0x4315e7[_0xca2a('0xad')],_0xca2a('0xae'),_0x2f1f3f[_0xca2a('0x50')],'pTalking:\x20',_0x2f1f3f['pTalking']);ami[_0xca2a('0x24')](_0xca2a('0xaf'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xb0')));if(_0x2f1f3f[_0xca2a('0xb1')]){ami[_0xca2a('0x24')]('custom:agentConnectPreview',ut['buildAcw'](_0x4315e7));}break;case'16':ami[_0xca2a('0x24')](_0xca2a('0xb2'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xb3')));emitVoiceQueueChannelRemove(ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xb3')));_0x2f1f3f[_0xca2a('0x36')]+=0x1;_0x2f1f3f[_0xca2a('0x2c')]+=0x1;_0x2f1f3f[_0xca2a('0x28')]+=0x1;ut[_0xca2a('0xb4')](_0x2f1f3f,_0xca2a('0xb5'));_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut['logCustomer'](_0x4315e7,0x4,'Answer');rpcDb[_0xca2a('0x8b')](_0x4315e7,_0xca2a('0xb6'));rpcDb[_0xca2a('0xa4')](_0x4315e7,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4315e7);_0x2f1f3f[_0xca2a('0xb7')]+=_0x4315e7[_0xca2a('0xb8')];_0x2f1f3f[_0xca2a('0xb9')]+=_0x4315e7['talktime'];logger[_0xca2a('0x57')](_0xca2a('0xba'),_0x4315e7[_0xca2a('0xad')],_0xca2a('0xae'),_0x2f1f3f['name'],_0xca2a('0x6b'),_0x2f1f3f['pTalking']);delete this[_0xca2a('0x15')][_0xbad48a[_0xca2a('0xa9')]];break;case _0xca2a('0xbb'):_0x2f1f3f[_0xca2a('0x38')]+=0x1;_0x4315e7[_0xca2a('0xbc')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0x5,'Busy');ami[_0xca2a('0x24')](_0xca2a('0xbd'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xbe')));rpcDb[_0xca2a('0x8b')](_0x4315e7,_0xca2a('0xbf'));if(ut[_0xca2a('0x9b')](_0x4315e7)>=_0x2f1f3f[_0xca2a('0xc0')]){_0xe0db35=ut[_0xca2a('0xa0')](_0x4315e7,0xf,_0xca2a('0xa1'));rpcDb[_0xca2a('0xa4')](_0xe0db35,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4315e7['countbusyretry']>=_0x2f1f3f[_0xca2a('0xc1')]){rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xbf'));}else{rpcDb[_0xca2a('0xa5')](ut[_0xca2a('0xc2')](_0x4315e7,_0xca2a('0xbc'),_0x2f1f3f['dialBusyRetryFrequency']),_0x4315e7[_0xca2a('0xa7')],_0x4315e7['activeContact']);}}break;case _0xca2a('0xc3'):_0x2f1f3f[_0xca2a('0x3b')]+=0x1;_0x4315e7['countnoanswerretry']+=0x1;_0x4315e7['countglobal']=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0x3,_0xca2a('0xc4'));ami[_0xca2a('0x24')](_0xca2a('0xc5'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xc6')));rpcDb[_0xca2a('0x8b')](_0x4315e7,_0xca2a('0xc7'));if(ut[_0xca2a('0x9b')](_0x4315e7)>=_0x2f1f3f['dialGlobalMaxRetry']){_0xe0db35=ut[_0xca2a('0xa0')](_0x4315e7,0xf,_0xca2a('0xa1'));rpcDb['createCustomerFinal'](_0xe0db35,_0xca2a('0xc8'));}else{if(_0x4315e7[_0xca2a('0xc9')]>=_0x2f1f3f[_0xca2a('0xca')]){rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xc7'));}else{rpcDb[_0xca2a('0xa5')](ut[_0xca2a('0xc2')](_0x4315e7,'countnoanswerretry',_0x2f1f3f['dialNoAnswerRetryFrequency']),_0x4315e7[_0xca2a('0xa7')],_0x4315e7[_0xca2a('0xa8')]);}}break;case _0xca2a('0xcb'):_0x2f1f3f[_0xca2a('0x39')]+=0x1;_0x4315e7[_0xca2a('0xcc')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0x8,_0xca2a('0xcd'));ami[_0xca2a('0x24')](_0xca2a('0xce'),ut[_0xca2a('0x9d')](_0x4315e7,_0xca2a('0xcf')));rpcDb['createCustomerHistory'](_0x4315e7,_0xca2a('0xd0'));if(ut[_0xca2a('0x9b')](_0x4315e7)>=_0x2f1f3f[_0xca2a('0xc0')]){_0xe0db35=ut['cloneAction'](_0x4315e7,0xf,'Global');rpcDb[_0xca2a('0xa4')](_0xe0db35,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x4315e7['countcongestionretry']>=_0x2f1f3f[_0xca2a('0xd1')]){rpcDb['createCustomerFinal'](_0x4315e7,_0xca2a('0xd0'));}else{rpcDb[_0xca2a('0xa5')](ut[_0xca2a('0xc2')](_0x4315e7,'countcongestionretry',_0x2f1f3f[_0xca2a('0xd2')]),_0x4315e7[_0xca2a('0xa7')],_0x4315e7['activeContact']);}}break;case'CANCEL':_0x2f1f3f[_0xca2a('0x3f')]+=0x1;_0x4315e7[_0xca2a('0xd3')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0x14,_0xca2a('0xd4'));ami[_0xca2a('0x24')](_0xca2a('0xd5'),ut['buildObj'](_0x4315e7,_0xca2a('0xd6')));rpcDb[_0xca2a('0x8b')](_0x4315e7,_0xca2a('0xd7'));if(ut['totalGlobal'](_0x4315e7)>=_0x2f1f3f[_0xca2a('0xc0')]){_0xe0db35=ut['cloneAction'](_0x4315e7,0x14,_0xca2a('0xd4'));rpcDb[_0xca2a('0xa4')](_0xe0db35,_0xca2a('0xd8'));}else{if(_0x4315e7[_0xca2a('0xd3')]>=_0x2f1f3f[_0xca2a('0xd9')]){rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xd8'));}else{rpcDb[_0xca2a('0xa5')](ut['scheduledAt'](_0x4315e7,_0xca2a('0xd3'),_0x2f1f3f[_0xca2a('0xda')]),_0x4315e7[_0xca2a('0xa7')],_0x4315e7[_0xca2a('0xa8')]);}}break;case _0xca2a('0xdb'):_0x2f1f3f[_0xca2a('0xdc')]+=0x1;_0x4315e7[_0xca2a('0xdd')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut['logCustomer'](_0x4315e7,0xb,_0xca2a('0xde'));rpcDb['createCustomerHistory'](_0x4315e7,_0xca2a('0xdf'));if(ut[_0xca2a('0x9b')](_0x4315e7)>=_0x2f1f3f[_0xca2a('0xc0')]){_0xe0db35=ut[_0xca2a('0xa0')](_0x4315e7,0xf,_0xca2a('0xa1'));rpcDb['createCustomerFinal'](_0xe0db35,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4315e7[_0xca2a('0xe0')]>=_0x2f1f3f[_0xca2a('0xe1')]){rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xdf'));}else{rpcDb[_0xca2a('0xa5')](ut[_0xca2a('0xc2')](_0x4315e7,_0xca2a('0xdd'),_0x2f1f3f['dialAbandonedRetryFrequency']),_0x4315e7['unlockAgent'],_0x4315e7['activeContact']);}}break;default:if(_0x4315e7['dialAnswer']){ut['decrementTalkink'](_0x2f1f3f,'[default]');ut['loggerError'](_0xca2a('0xe2')+_0x2f1f3f[_0xca2a('0x50')],_0xbad48a);}_0x2f1f3f[_0xca2a('0x40')]+=0x1;_0x4315e7[_0xca2a('0x9a')]=ut[_0xca2a('0x9b')](_0x4315e7);ut[_0xca2a('0x86')](_0x4315e7,0xc,_0xbad48a['cause-txt']||_0xbad48a['dialstatus']);rpcDb[_0xca2a('0x8b')](_0x4315e7,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xca2a('0x9b')](_0x4315e7)>=_0x2f1f3f[_0xca2a('0xc0')]){_0xe0db35=ut[_0xca2a('0xa0')](_0x4315e7,0xf,'Global');rpcDb[_0xca2a('0xa4')](_0xe0db35,_0xca2a('0xe3'));}else{rpcDb[_0xca2a('0xa4')](_0x4315e7,_0xca2a('0xe3'));}delete this[_0xca2a('0x15')][_0xbad48a[_0xca2a('0xa9')]];}if(!(_0x4315e7[_0xca2a('0xe4')]&&_0x147a32==='16')){ut['updateOriginated'](_0x2f1f3f,_0xca2a('0xe5'));logger[_0xca2a('0x57')](_0xca2a('0xe6'),_0x4315e7[_0xca2a('0xad')],_0xca2a('0xae'),_0x2f1f3f[_0xca2a('0x50')],'originated:\x20',_0x2f1f3f[_0xca2a('0x4a')]);}if(_0x147a32!=='ANSWER'){delete this[_0xca2a('0x15')][_0xbad48a[_0xca2a('0xa9')]];delete this['actions'][_0xbad48a['destlinkedid']];}}};Preview['prototype'][_0xca2a('0xe7')]=function(_0x5b27ac,_0x4f063b,_0x1477e2){if(_['isUndefined'](_0x4f063b)&&'object'!==typeof _0x4f063b){return;}if(_[_0xca2a('0xe8')](_0x1477e2)&&'object'!==typeof _0x1477e2){return;}switch(_0x1477e2['reason']){case'0':ut['logAgent'](_0x5b27ac,0x0,_0xca2a('0xe9'));rpcDb[_0xca2a('0xea')](_0x5b27ac,_0xca2a('0xeb'));break;case'3':ut[_0xca2a('0xec')](_0x5b27ac,0x3,_0xca2a('0xc4'));rpcDb[_0xca2a('0xea')](_0x5b27ac,_0xca2a('0xed'));break;case'5':ut['logAgent'](_0x5b27ac,0x5,_0xca2a('0xee'));rpcDb[_0xca2a('0xea')](_0x5b27ac,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xca2a('0xec')](_0x5b27ac,0x8,_0xca2a('0xcd'));rpcDb[_0xca2a('0xea')](_0x5b27ac,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xca2a('0xec')](_0x5b27ac,0x16,_0xca2a('0xef'));rpcDb[_0xca2a('0xea')](_0x5b27ac,_0xca2a('0xf0'));break;default:ut[_0xca2a('0xec')](_0x5b27ac,0xc,_0x1477e2[_0xca2a('0xf1')]);rpcDb['createAgentHistory'](_0x5b27ac,_0xca2a('0xf2'));}ut[_0xca2a('0x74')](_0x4f063b,_0xca2a('0xf3'));logger[_0xca2a('0x57')](_0xca2a('0xf4'),_0x5b27ac[_0xca2a('0xad')],_0xca2a('0xae'),_0x4f063b[_0xca2a('0x50')],_0xca2a('0x69'),_0x4f063b[_0xca2a('0x4a')]);delete this['actions'][_0x5b27ac[_0xca2a('0xad')]];};Preview['prototype']['checkInBlack']=function(_0x4b39e1,_0x55e2d2,_0x4ffdd7,_0x1f026d,_0x5d74ea){var _0x34bcc4=this;return new BPromise(function(_0x39fcb4,_0x22ee8b){if(_['isNil'](_0x55e2d2)||_['isNil'](_0x55e2d2[_0xca2a('0xf5')])||_[_0xca2a('0x66')](_0x55e2d2[_0xca2a('0xf5')][_0xca2a('0xf6')])||_[_0xca2a('0x66')](_0x55e2d2[_0xca2a('0xf7')])){_0x22ee8b(ut['message'](_0xca2a('0xf8'),_0x1f026d,_0x5d74ea));return;}var _0x1c1880=uuid['v4']();var _0x3031f9=_0x34bcc4[_0xca2a('0x12')][_0x55e2d2['Queue'][_0xca2a('0x50')]];var _0x2a57af=_0x4ffdd7?_0x34bcc4[_0xca2a('0x16')][_0x4ffdd7]['id']:undefined;_0x34bcc4['actions'][_0x1c1880]=new Action(_0x55e2d2,_0x3031f9,_0x1c1880,_0x4ffdd7,_0x2a57af);var _0x350025=_0x34bcc4[_0xca2a('0x15')][_0x1c1880];_0x350025[_0xca2a('0xa7')]=_0x1f026d;_0x350025[_0xca2a('0xa8')]=_0x5d74ea;_0x350025[_0xca2a('0xf9')]=_0x4ffdd7;if(_['isEmpty'](_0x4b39e1)){_0x34bcc4[_0xca2a('0xfa')](_0x350025,_0x3031f9,_0x55e2d2,_0x4ffdd7)['then'](function(_0xf8116c){logger[_0xca2a('0x57')](_0xca2a('0xfb'),'Queue:\x20'+_0x350025[_0xca2a('0x6a')]+'\x20IdHopper:\x20'+_0x350025[_0xca2a('0xfc')],JSON[_0xca2a('0x53')](_0xf8116c));ami[_0xca2a('0x24')](_0xca2a('0xfd'),ut[_0xca2a('0x9d')](_0x350025,_0xca2a('0xfe')));_0x39fcb4(ut[_0xca2a('0x49')](_0xca2a('0xff')));})[_0xca2a('0x72')](function(_0x3aadf2){ut['logger'](_0xca2a('0x100'),_0x3aadf2);_0x22ee8b(ut[_0xca2a('0x49')](_0xca2a('0x101'),_0x1f026d,_0x5d74ea));});}else{_0x3031f9[_0xca2a('0x37')]+=0x1;ut[_0xca2a('0x102')](_0x350025);rpcDb[_0xca2a('0x103')](_0x350025,'[Blacklist][error]');delete _0x34bcc4[_0xca2a('0x15')][_0x1c1880];_0x22ee8b(ut[_0xca2a('0x49')]('Contact\x20in\x20black\x20List',_0x1f026d,_0x5d74ea));}});};Preview['prototype']['isTrunkReachable']=function(_0x468e79){return!_['isNil'](_0x468e79)&&!_[_0xca2a('0x66')](_0x468e79['name'])&&!_[_0xca2a('0x66')](_0x468e79['active'])&&_0x468e79[_0xca2a('0x51')]&&!_[_0xca2a('0x66')](this['trunks'][util[_0xca2a('0x54')](_0xca2a('0x104'),_0x468e79[_0xca2a('0x50')])])&&!_['isNil'](this[_0xca2a('0x14')][util['format'](_0xca2a('0x104'),_0x468e79['name'])][_0xca2a('0x70')])&&(this[_0xca2a('0x14')][util[_0xca2a('0x54')](_0xca2a('0x104'),_0x468e79[_0xca2a('0x50')])][_0xca2a('0x70')]===_0xca2a('0x105')||this[_0xca2a('0x14')][util[_0xca2a('0x54')](_0xca2a('0x104'),_0x468e79[_0xca2a('0x50')])]['status']==='unmonitored');};Preview[_0xca2a('0xf')][_0xca2a('0x82')]=function(_0x14fb52,_0xeb87b2){var _0x559cac=this;return new BPromise(function(_0x1447be,_0x17c90c){_0x559cac[_0xca2a('0x106')](_0x14fb52,_0xeb87b2)['then'](function(_0x3db074){_0x1447be(_[_0xca2a('0x6c')](_0x3db074,[_0xca2a('0x49')]));})[_0xca2a('0x72')](function(_0x5353ca){if(_0x5353ca[_0xca2a('0x107')]){rpcDb['unlockContact'](_0x14fb52);}if(_0x5353ca[_0xca2a('0x51')]){rpcDb[_0xca2a('0x85')](_0x14fb52);}_0x17c90c(_['pick'](_0x5353ca,[_0xca2a('0x49')]));});});};Preview[_0xca2a('0xf')][_0xca2a('0x106')]=function(_0x1862ca,_0x235a7c){var _0x15b943=this;return new BPromise(function(_0xaa42b4,_0x38af67){var _0x57edb8,_0x504a33;rpcDb['getContactPreview'](_0x1862ca)['then'](function(_0x1584fb){if(!_[_0xca2a('0x66')](_0x1584fb[0x0])){_0x504a33=_0x1584fb[0x0][_0xca2a('0x108')]?![]:!![];_0x57edb8=_0x1584fb[0x0][_0xca2a('0x108')]?!![]:![];_0x57edb8=_0x235a7c?!![]:_0x57edb8;}var _0x2a87fa=_0x15b943['validateContact'](_0x1584fb);if(_0x2a87fa[_0xca2a('0x109')]){rpcDb[_0xca2a('0x10a')](_['pick'](_0x1584fb[0x0],['VoiceQueueId','Contact.phone']))[_0xca2a('0x10b')](function(_0x2db6ac){_0x15b943[_0xca2a('0x10c')](_0x2db6ac,_0x1584fb[0x0],_0x235a7c,_0x504a33,_0x57edb8)[_0xca2a('0x10b')](function(_0x547d91){_0xaa42b4(_0x547d91);})[_0xca2a('0x72')](function(_0x1a7841){_0x38af67(_0x1a7841);});})[_0xca2a('0x72')](function(_0x45c6ad){ut[_0xca2a('0x5b')](_0xca2a('0x10d'),_0x45c6ad);_0x38af67(ut[_0xca2a('0x49')]('Call\x20unsuccessful',_0x504a33,_0x57edb8));});}else{_0x38af67(ut[_0xca2a('0x49')](_0x2a87fa[_0xca2a('0x49')],_0x504a33,_0x57edb8));}})['catch'](function(_0xfc1f5a){ut[_0xca2a('0x5b')]('[Preview][getContactPreview]',_0xfc1f5a);_0x38af67(ut[_0xca2a('0x49')](_0xca2a('0x10e'),![],!![]));});});};Preview[_0xca2a('0xf')][_0xca2a('0x10f')]=function(_0x144101){if(_[_0xca2a('0x66')](_0x144101)||_['isEmpty'](_0x144101)||!_['isNil'](_0x144101[0x0][_0xca2a('0x80')])&&_[_0xca2a('0x66')](_0x144101[0x0][_0xca2a('0x80')]['name'])){ut[_0xca2a('0x5b')](_0xca2a('0x110'),_0x144101);return{'isValid':![],'message':_0xca2a('0x111')};}var _0x11e985=this['campaignsPreview'][_0x144101[0x0]['Queue'][_0xca2a('0x50')]];_0x11e985[_0xca2a('0x49')]='ACTIVE';if(_['isNil'](_0x11e985)){ut['logger'](_0xca2a('0x112'),_0x11e985);return{'isValid':![],'message':_0xca2a('0x113')};}if(!this[_0xca2a('0x95')](_0x11e985[_0xca2a('0x4f')])){ut[_0xca2a('0x5b')](_0xca2a('0x114'),_0xca2a('0x115')+_0x11e985[_0xca2a('0x50')]+_0xca2a('0x116'));if(!this[_0xca2a('0x95')](_0x11e985[_0xca2a('0x96')])){ut[_0xca2a('0x5b')](_0xca2a('0x114'),_0x11e985[_0xca2a('0x50')]+_0xca2a('0x117'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xca2a('0x93')](_0x11e985[_0xca2a('0x31')])){ut[_0xca2a('0x5b')](_0xca2a('0x118'),_0x11e985[_0xca2a('0x50')]+_0xca2a('0x119'));return{'isValid':![],'message':_0xca2a('0x115')+_0x11e985['name']+_0xca2a('0x119')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xca2a('0xf')]['execCall']=function(_0x20c503,_0x269ca0,_0x3c374b,_0x966d95){var _0x3a1455=this;return new BPromise(function(_0x1dd403,_0x2394b0){var _0x28c6c9=_0x20c503['uniqueid'];var _0x3b11f1=_0x3a1455[_0xca2a('0x95')](_0x269ca0[_0xca2a('0x4f')])?util[_0xca2a('0x54')](_0xca2a('0x11a'),_0x269ca0[_0xca2a('0x4f')][_0xca2a('0x50')],_[_0xca2a('0x66')](_0x269ca0[_0xca2a('0x35')])?'':_0x269ca0['dialPrefix'][_0xca2a('0x11b')]()||'',_0x269ca0[_0xca2a('0x11c')]>0x0?_0x3c374b['Contact']['phone'][_0xca2a('0x11d')](_0x269ca0[_0xca2a('0x11c')]):_0x3c374b[_0xca2a('0xf5')][_0xca2a('0xf6')]):util[_0xca2a('0x54')](_0xca2a('0x11a'),_[_0xca2a('0x66')](_0x269ca0['TrunkBackup'])?_0x269ca0[_0xca2a('0x4f')][_0xca2a('0x50')]:_0x269ca0[_0xca2a('0x96')][_0xca2a('0x50')],_[_0xca2a('0x66')](_0x269ca0[_0xca2a('0x35')])?'':_0x269ca0[_0xca2a('0x35')]['trim']()||'',_0x269ca0[_0xca2a('0x11c')]>0x0?_0x3c374b[_0xca2a('0xf5')]['phone']['substring'](_0x269ca0['dialCutDigit']):_0x3c374b[_0xca2a('0xf5')][_0xca2a('0xf6')]);var _0x9e37cd=_0x3a1455[_0xca2a('0x95')](_0x269ca0[_0xca2a('0x4f')])?ut[_0xca2a('0x11e')](_0x269ca0[_0xca2a('0x4f')][_0xca2a('0x11f')],_0x269ca0[_0xca2a('0x33')],_0x269ca0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xca2a('0x120')](_0x269ca0[_0xca2a('0x34')],_0x269ca0[_0xca2a('0x121')]):_0x269ca0[_0xca2a('0x34')]):ut[_0xca2a('0x11e')](_[_0xca2a('0x66')](_0x269ca0['TrunkBackup'])?_0x269ca0['Trunk'][_0xca2a('0x11f')]:_0x269ca0[_0xca2a('0x96')][_0xca2a('0x11f')],_0x269ca0[_0xca2a('0x33')],_0x269ca0[_0xca2a('0x121')]>0x0?ut[_0xca2a('0x120')](_0x269ca0[_0xca2a('0x34')],_0x269ca0['dialRandomLastDigitCallerIdNumber']):_0x269ca0[_0xca2a('0x34')]);if(_0x9e37cd){_0x20c503[_0xca2a('0x122')]=ut[_0xca2a('0x123')](_0x9e37cd);_0x20c503['originatecalleridnum']=ut[_0xca2a('0x124')](_0x9e37cd);}var _0x467b58=ut[_0xca2a('0x125')](_0x269ca0,_0x3c374b,_0x3b11f1,_0x9e37cd,_0x28c6c9,_0x20c503);_[_0xca2a('0x126')](_0x20c503,ut[_0xca2a('0x127')](_0x467b58));_0x20c503[_0xca2a('0x128')]=moment()[_0xca2a('0x54')](_0xca2a('0xaa'));ami[_0xca2a('0x129')](ut[_0xca2a('0x12a')](_0x20c503,_0x269ca0,_0x467b58,_0x20c503[_0xca2a('0xa8')],_0x966d95))['then'](function(_0x273102){_0x269ca0[_0xca2a('0x4a')]+=0x1;logger[_0xca2a('0x57')](_0xca2a('0x12b'),_0x28c6c9,_0xca2a('0xae'),_0x269ca0[_0xca2a('0x50')],_0xca2a('0x69'),_0x269ca0[_0xca2a('0x4a')]);_0x1dd403(_0x273102);})[_0xca2a('0x72')](function(_0x3f25f3){ut[_0xca2a('0xec')](_0x20c503,0xe,_0xca2a('0x12c'));rpcDb['createAgentHistory'](_0x20c503,_0xca2a('0x12d'));_0x2394b0(_0x3f25f3);});});};Preview[_0xca2a('0xf')][_0xca2a('0x1f')]=function(_0x3b8604){if(this[_0xca2a('0x15')][_0x3b8604[_0xca2a('0xa9')]]){this[_0xca2a('0x15')][_0x3b8604[_0xca2a('0xa9')]][_0xca2a('0x71')]=_0x3b8604['channel'];}};Preview[_0xca2a('0xf')][_0xca2a('0x12e')]=function(_0x4fe8ca){var _0x1d800e=this;var _0x4d0f9b=this['actions'][_0x4fe8ca[_0xca2a('0x12f')]];if(_0x4d0f9b){if(_0x4d0f9b['lookAgent']&&this[_0xca2a('0x16')][_0x4d0f9b['lookAgent']]){ut[_0xca2a('0x130')](_0x4d0f9b,this[_0xca2a('0x16')][_0x4d0f9b['lookAgent']][_0xca2a('0x50')],this['agents'][_0x4d0f9b['lookAgent']]['id']);}var _0x315e06=_[_0xca2a('0x131')](_0x4d0f9b);_0x315e06[_0xca2a('0x132')]=moment()[_0xca2a('0x54')](_0xca2a('0xaa'));var _0x49861d=_0x1d800e[_0xca2a('0x12')][_0x4d0f9b[_0xca2a('0x6a')]];if(ut[_0xca2a('0x133')](_0x4fe8ca[_0xca2a('0x134')])){if(_0x4d0f9b[_0xca2a('0xa7')]){rpcDb['unlockContact'](_0x4d0f9b[_0xca2a('0xfc')]);}if(_0x4d0f9b['activeContact']){rpcDb[_0xca2a('0x85')](_0x4d0f9b[_0xca2a('0xfc')]);}ami[_0xca2a('0x24')]('custom:agentringnoanswer',ut[_0xca2a('0x9d')](_0x4d0f9b,_0xca2a('0x135')));this[_0xca2a('0xe7')](_0x315e06,_0x49861d,_0x4fe8ca);}else{_0x4d0f9b[_0xca2a('0x128')]=moment()[_0xca2a('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0xca2a('0xec')](_0x315e06,0x4,_0xca2a('0x136'));rpcDb[_0xca2a('0xea')](_0x315e06,_0xca2a('0x137'));}}};Preview[_0xca2a('0xf')][_0xca2a('0x1a')]=function(_0x3c8429){var _0x184408=this;var _0x2b182a=this['actions'][_0x3c8429['linkedid']];var _0x469a0e;if(_0x2b182a){_0x469a0e=this['campaignsPreview'][_0x2b182a[_0xca2a('0x6a')]];logger[_0xca2a('0x57')]('[syncHangup][talking]',_0x3c8429[_0xca2a('0xa9')],_0xca2a('0xae'),_0x469a0e[_0xca2a('0x50')],_0xca2a('0x6b'),_0x469a0e[_0xca2a('0x2a')]);}if(this[_0xca2a('0x15')][_0x3c8429[_0xca2a('0xa9')]]&&_0x3c8429[_0xca2a('0xa9')]!==_0x3c8429[_0xca2a('0xad')]){if(_0x3c8429[_0xca2a('0x138')]==='16'&&this[_0xca2a('0x15')][_0x3c8429['linkedid']][_0xca2a('0xe4')]){this[_0xca2a('0x139')](_0x3c8429,_0x3c8429[_0xca2a('0xa9')],_0x3c8429['cause']);}else if(this[_0xca2a('0x15')][_0x3c8429[_0xca2a('0xa9')]][_0xca2a('0xe4')]){logger['info'](_0xca2a('0x13a'),_0x3c8429[_0xca2a('0xa9')],_0x3c8429[_0xca2a('0x138')],_0xca2a('0xae'),_0x469a0e[_0xca2a('0x50')],_0xca2a('0x6b'),_0x469a0e[_0xca2a('0x2a')]);this[_0xca2a('0x139')](_0x3c8429,_0x3c8429[_0xca2a('0xa9')],_0x3c8429[_0xca2a('0x138')]);}}else if(_0x2b182a&&_[_0xca2a('0x66')](_0x2b182a['statedesc'])&&_0x469a0e[_0xca2a('0x13b')]&&_0x3c8429[_0xca2a('0xa9')]===_0x3c8429['uniqueid']&&_[_0xca2a('0x66')](_0x3c8429[_0xca2a('0xf1')])&&_0x3c8429[_0xca2a('0x138')]==='16'&&_0x3c8429[_0xca2a('0x13c')]==='6'&&_[_0xca2a('0xe8')](_0x2b182a[_0xca2a('0x13d')])){if(_0x2b182a['unlockAgent']){rpcDb['unlockContact'](_0x2b182a['idContact']);}if(_0x2b182a[_0xca2a('0xa8')]){rpcDb[_0xca2a('0x85')](_0x2b182a[_0xca2a('0xfc')]);}_0x3c8429[_0xca2a('0xf1')]='22';this[_0xca2a('0xe7')](_0x2b182a,_0x469a0e,_0x3c8429);}else if(_0x2b182a&&_0x2b182a[_0xca2a('0x13d')]){if(_0x3c8429[_0xca2a('0x138')]==='16'&&this['actions'][_0x3c8429['linkedid']][_0xca2a('0xe4')]){logger[_0xca2a('0x57')](_0xca2a('0x13e'),_0x3c8429[_0xca2a('0xa9')],_0x3c8429[_0xca2a('0x138')],_0xca2a('0xae'),_0x469a0e[_0xca2a('0x50')],_0xca2a('0x6b'),_0x469a0e[_0xca2a('0x2a')]);this[_0xca2a('0x139')](_0x3c8429,_0x3c8429[_0xca2a('0xa9')],_0x3c8429[_0xca2a('0x138')]);}else if(this[_0xca2a('0x15')][_0x3c8429[_0xca2a('0xa9')]][_0xca2a('0xe4')]){logger[_0xca2a('0x57')](_0xca2a('0x13a'),_0x3c8429[_0xca2a('0xa9')],_0x3c8429['cause'],_0xca2a('0xae'),_0x469a0e[_0xca2a('0x50')],_0xca2a('0x6b'),_0x469a0e['pTalking']);this[_0xca2a('0x139')](_0x3c8429,_0x3c8429['linkedid'],_0x3c8429['cause']);}}};Preview['prototype'][_0xca2a('0x13f')]=function(_0x226297){if(this[_0xca2a('0x15')][_0x226297['destlinkedid']]&&_0x226297[_0xca2a('0x140')]!==_0x226297[_0xca2a('0x141')]){this[_0xca2a('0x139')](_0x226297,_0x226297['destlinkedid'],_0x226297[_0xca2a('0x142')]);}};Preview['prototype'][_0xca2a('0x1d')]=function(_0x4f94f0){if(this[_0xca2a('0x15')][_0x4f94f0[_0xca2a('0xa9')]]&&_0x4f94f0['linkedid']!==_0x4f94f0[_0xca2a('0xad')]&&!this['actions'][_0x4f94f0[_0xca2a('0xa9')]][_0xca2a('0xe4')]){if(_0x4f94f0[_0xca2a('0x138')]==='1'){this['callProgressDetectingCustomer'](_0x4f94f0,_0x4f94f0[_0xca2a('0xa9')],_0x4f94f0[_0xca2a('0x138')]);}}};Preview[_0xca2a('0xf')][_0xca2a('0x143')]=function(_0x51bea7,_0x599860,_0x4bf4dc){if(this[_0xca2a('0x15')][_0x51bea7]){if(_['isNil'](this['actions'][_0x51bea7][_0xca2a('0x144')])){this[_0xca2a('0x15')][_0x51bea7]['variables']={};}this[_0xca2a('0x15')][_0x51bea7][_0xca2a('0x144')][_0x599860]=_0x4bf4dc;}};Preview[_0xca2a('0xf')]['syncVarSet']=function(_0x5d6e2b){try{if(!_[_0xca2a('0x66')](_0x5d6e2b)){if(ut[_0xca2a('0x145')](_['keys'](_0x5d6e2b[_0xca2a('0x146')])[0x0])){this[_0xca2a('0x143')](_0x5d6e2b['uniqueid'],_[_0xca2a('0x147')](_0x5d6e2b[_0xca2a('0x146')])[0x0],_0x5d6e2b[_0xca2a('0x148')]);}}}catch(_0x426be5){logger[_0xca2a('0x149')](_0xca2a('0x14a'),util['inspect'](_0x426be5,{'showHidden':![],'depth':null}));}};Preview[_0xca2a('0xf')][_0xca2a('0x14b')]=function(_0x23df57){if(_0x23df57){if(this[_0xca2a('0x15')][_0x23df57[_0xca2a('0x14c')]]){this['actions'][_0x23df57[_0xca2a('0x14c')]][_0xca2a('0x13d')]=!![];}}};Preview['prototype'][_0xca2a('0x23')]=function(_0x7ee452){if(_0x7ee452){if(this[_0xca2a('0x15')][_0x7ee452[_0xca2a('0x14d')]]){this['actions'][_0x7ee452[_0xca2a('0x14d')]]['transfer']=!![];}}};module[_0xca2a('0x14e')]=Preview; \ No newline at end of file +var _0xb76b=['scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','rescheduleContact','NOANSWER','countnoanswerretry','countglobal','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','Contact\x20is\x20undefined','isEmpty','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Blacklist][error]','SIP/%s','execRun','unlockContact','disableContact','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','execCall','dialPrefix','trim','phone','dialCutDigit','substring','callerid','getCallerIdRandom','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','syncHangup','cause','[syncHangup][talking][cause]','statedesc','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./action','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','outbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','format','voice:queue:%s','name','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','setMessage','clearZombieChannel','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','pTalking:\x20','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','dialAnswer','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb76b,0x1f2));var _0xbb76=function(_0x3173ef,_0xccc575){_0x3173ef=_0x3173ef-0x0;var _0xe07fc7=_0xb76b[_0x3173ef];return _0xe07fc7;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xbb76('0x0'));var uuid=require(_0xbb76('0x1'));var moment=require(_0xbb76('0x2'));var md5=require(_0xbb76('0x3'));var Redis=require(_0xbb76('0x4'));var config=require(_0xbb76('0x5'));var logger=require(_0xbb76('0x6'))(_0xbb76('0x7'));var loggerAction=require(_0xbb76('0x6'))(_0xbb76('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Action=require(_0xbb76('0x9'));var ut=require(_0xbb76('0xa'));config[_0xbb76('0xb')]=_['defaults'](config[_0xbb76('0xb')],{'host':_0xbb76('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xbb76('0xd')][_0xbb76('0xe')]=function(_0x59177f){this[_0xbb76('0xf')]=this[_0xbb76('0xf')]?this[_0xbb76('0xf')][_0xbb76('0x10')](_0x59177f):_0x59177f();};function Preview(_0x33d5d6){this[_0xbb76('0x11')]=new Sequence();this['campaignsPreview']=_0x33d5d6[_0xbb76('0x12')];this[_0xbb76('0x13')]=_0x33d5d6[_0xbb76('0x13')];this['actions']={};this[_0xbb76('0x14')]=_0x33d5d6['agents'];this[_0xbb76('0x15')]=0x0;ami['on'](_0xbb76('0x16'),this[_0xbb76('0x17')][_0xbb76('0x18')](this));ami['on'](_0xbb76('0x19'),this['syncHangup'][_0xbb76('0x18')](this));ami['on'](_0xbb76('0x1a'),this['syncHangupRequest']['bind'](this));ami['on'](_0xbb76('0x1b'),this[_0xbb76('0x1c')][_0xbb76('0x18')](this));ami['on'](_0xbb76('0x1d'),this[_0xbb76('0x1e')][_0xbb76('0x18')](this));ami['on'](_0xbb76('0x1f'),this[_0xbb76('0x20')][_0xbb76('0x18')](this));ami['on'](_0xbb76('0x21'),this[_0xbb76('0x22')]['bind'](this));ami['on'](_0xbb76('0x23'),this['syncBlindTransfer']['bind'](this));this[_0xbb76('0x24')](this['campaignsPreview']);}function emit(_0xa92bce,_0x5dd9e3,_0x382740){io['to'](_0xa92bce)[_0xbb76('0x25')](_0x5dd9e3,_0x382740);}function emitCampaignPreview(_0xb80efd){if(_0xb80efd[_0xbb76('0x26')]===_0xbb76('0x27')){var _0x29491c={'id':_0xb80efd['id'],'name':_0xb80efd['name'],'strategy':_0xb80efd['strategy'],'answered':_0xb80efd[_0xbb76('0x28')],'available':_0xb80efd[_0xbb76('0x29')],'loggedIn':_0xb80efd[_0xbb76('0x2a')],'pTalking':_0xb80efd['pTalking'],'sumBillable':_0xb80efd[_0xbb76('0x2b')],'sumDuration':_0xb80efd[_0xbb76('0x2c')],'sumHoldTime':_0xb80efd[_0xbb76('0x2d')]||0x0,'talking':_0xb80efd[_0xbb76('0x2e')],'total':_0xb80efd['total'],'type':_0xb80efd[_0xbb76('0x26')],'unmanaged':_0xb80efd[_0xbb76('0x2f')],'abandoned':_0xb80efd['abandoned'],'waiting':_0xb80efd[_0xbb76('0x30')],'loggedInDb':_0xb80efd['loggedInDb'],'dialActive':_0xb80efd[_0xbb76('0x31')],'dialMethod':_0xb80efd['dialMethod'],'dialOriginateCallerIdName':_0xb80efd[_0xbb76('0x32')],'dialOriginateCallerIdNumber':_0xb80efd[_0xbb76('0x33')],'dialOriginateTimeout':_0xb80efd[_0xbb76('0x34')],'dialPrefix':_0xb80efd['dialPrefix'],'outboundAnswerAgiCallsDay':_0xb80efd[_0xbb76('0x35')],'outboundAnswerCallsDay':_0xb80efd['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xb80efd['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xb80efd[_0xbb76('0x36')],'outboundCongestionCallsDay':_0xb80efd[_0xbb76('0x37')],'outboundDropCallsDayACS':_0xb80efd['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xb80efd['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xb80efd[_0xbb76('0x38')],'outboundNoAnswerCallsDay':_0xb80efd[_0xbb76('0x39')],'outboundNoSuchCallsDay':_0xb80efd[_0xbb76('0x3a')],'outboundOriginateFailureCallsDay':_0xb80efd['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xb80efd[_0xbb76('0x3b')],'outboundRejectCallsDay':_0xb80efd['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xb80efd[_0xbb76('0x3c')],'outboundAbandonedCallsDay':_0xb80efd[_0xbb76('0x3d')],'predictiveIntervalAnsweredCalls':_0xb80efd[_0xbb76('0x3e')],'predictiveIntervalAvgHoldtime':_0xb80efd[_0xbb76('0x3f')],'predictiveIntervalAvgTalktime':_0xb80efd[_0xbb76('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0xb80efd[_0xbb76('0x41')],'predictiveIntervalDroppedCallsTimeout':_0xb80efd[_0xbb76('0x42')],'predictiveIntervalErlangCalls':_0xb80efd[_0xbb76('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0xb80efd[_0xbb76('0x44')],'predictiveIntervalHitRate':_0xb80efd[_0xbb76('0x45')],'predictiveIntervalMultiplicativeFactor':_0xb80efd[_0xbb76('0x46')],'predictiveIntervalPauses':_0xb80efd[_0xbb76('0x47')],'predictiveIntervalAvailable':_0xb80efd[_0xbb76('0x48')],'predictiveIntervalTotalCalls':_0xb80efd[_0xbb76('0x49')],'message':_0xb80efd[_0xbb76('0x4a')],'originated':_0xb80efd[_0xbb76('0x4b')],'erlangCalls':_0xb80efd[_0xbb76('0x4c')],'erlangCallToSecond':_0xb80efd[_0xbb76('0x4d')],'erlangAbandonmentRate':_0xb80efd[_0xbb76('0x4e')],'erlangBusyFactor':_0xb80efd[_0xbb76('0x4f')],'startPredictive':_0xb80efd[_0xbb76('0x50')],'startProgressive':_0xb80efd[_0xbb76('0x51')]};if(_0xb80efd[_0xbb76('0x52')]){_0x29491c[_0xbb76('0x52')]={'id':_0xb80efd[_0xbb76('0x52')]['id'],'name':_0xb80efd[_0xbb76('0x52')]['name'],'active':_0xb80efd[_0xbb76('0x52')][_0xbb76('0x53')],'callerid':_0xb80efd['Trunk']['callerid']};}if(_0xb80efd[_0xbb76('0x54')]){_0x29491c[_0xbb76('0x54')]={'id':_0xb80efd['Interval']['id'],'name':_0xb80efd[_0xbb76('0x54')]['name']};}var _0xe21967=md5(JSON['stringify'](_0x29491c));if(_0xb80efd[_0xbb76('0x3')]!==_0xe21967){_0xb80efd[_0xbb76('0x3')]=_0xe21967;emit(util[_0xbb76('0x55')](_0xbb76('0x56'),_0x29491c[_0xbb76('0x57')]),_0xbb76('0x58'),_0x29491c);}}}function emitVoiceQueueChannelRemove(_0xf2485e){logger[_0xbb76('0x59')](_0xbb76('0x5a'),JSON[_0xbb76('0x5b')](_0xf2485e));emit(util['format'](_0xbb76('0x56'),_0xf2485e[_0xbb76('0x57')]),_0xbb76('0x5c'),_0xf2485e);}function notSendMessagesQueue(_0x3d27fe){if(_0x3d27fe[_0xbb76('0x5d')]){if(_0x3d27fe[_0xbb76('0x4b')]===0x0&&_0x3d27fe[_0xbb76('0x5e')]===0x0){_0x3d27fe[_0xbb76('0x5d')]=![];_0x3d27fe['available']=0x0;_0x3d27fe['paused']=0x0;_0x3d27fe[_0xbb76('0x4a')]=_0xbb76('0x5f');ut[_0xbb76('0x60')](_0xbb76('0x61'),_0x3d27fe[_0xbb76('0x57')]+_0xbb76('0x62'));}else{_0x3d27fe['message']=_0xbb76('0x63');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3d27fe[_0xbb76('0x57')]+_0xbb76('0x64'));}emitCampaignPreview(_0x3d27fe);}}Preview[_0xbb76('0xd')][_0xbb76('0x24')]=function(){var _0x593f67=this;setInterval(function(){_0x593f67[_0xbb76('0x65')]();},0x7cf);};Preview['prototype'][_0xbb76('0x65')]=function(){var _0x3597f6=this[_0xbb76('0x66')];this['clockClearZombieChannels']+=0x1;for(var _0x5e0c07 in _0x3597f6){if(_0x3597f6[_0xbb76('0x67')](_0x5e0c07)&&(_0x3597f6[_0x5e0c07][_0xbb76('0x68')]===_0xbb76('0x7')||_0x3597f6[_0x5e0c07][_0xbb76('0x68')]==='booked')&&_0x3597f6[_0x5e0c07]['type']===_0xbb76('0x27')){if(this['clockClearZombieChannels']>0x7){this[_0xbb76('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x3597f6[_0xbb76('0x67')](_0x5e0c07)&&_0x3597f6[_0x5e0c07][_0xbb76('0x68')]==='preview'&&_0x3597f6[_0x5e0c07][_0xbb76('0x26')]===_0xbb76('0x27')){if(_0x3597f6[_0x5e0c07][_0xbb76('0x31')]){this[_0xbb76('0x69')](_0x3597f6[_0x5e0c07]);this['recallMe'](_0x3597f6[_0x5e0c07]);}else{notSendMessagesQueue(_0x3597f6[_0x5e0c07]);}}}};Preview['prototype'][_0xbb76('0x6a')]=function(_0x483453){var _0x539448=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x539448['actions'][_0x483453])){loggerAction['info'](_0xbb76('0x6b'),_0x483453,_0xbb76('0x6c'),_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x6e')],_0xbb76('0x6f'),JSON[_0xbb76('0x5b')](_0x539448[_0xbb76('0x66')][_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x6e')]][_0xbb76('0x4b')]),_0xbb76('0x70'),JSON[_0xbb76('0x5b')](_0x539448[_0xbb76('0x66')][_0x539448['actions'][_0x483453][_0xbb76('0x6e')]][_0xbb76('0x5e')]),JSON[_0xbb76('0x5b')](_0x539448[_0xbb76('0x6d')][_0x483453]['dialAnswer']),JSON[_0xbb76('0x5b')](_['pick'](_0x539448['actions'][_0x483453],[_0xbb76('0x71'),_0xbb76('0x72'),_0xbb76('0x73'),_0xbb76('0x74')])));return ami['Action']({'action':_0xbb76('0x75'),'channel':_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x76')]})[_0xbb76('0x77')](function(_0x1c2a9d){if(_0x1c2a9d[_0xbb76('0x4a')]===_0xbb76('0x78')){setTimeout(function(){if(_0x539448[_0xbb76('0x6d')][_0x483453]){ut['updateOriginated'](_0x539448['campaignsPreview'][_0x539448['actions'][_0x483453][_0xbb76('0x6e')]],_0xbb76('0x79'));if(_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x7a')]===!![]){ut[_0xbb76('0x7b')](_0x539448[_0xbb76('0x66')][_0x539448['actions'][_0x483453]['queue']],'[clearZombieChannel]');ut['loggerError'](_0xbb76('0x7c')+_0x483453,_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x6e')]);}ut[_0xbb76('0x7d')](_0xbb76('0x7e')+_0x483453,_0x539448[_0xbb76('0x6d')][_0x483453][_0xbb76('0x6e')]);delete _0x539448['actions'][_0x483453];}},0x2328);}});}});};Preview[_0xbb76('0xd')]['clearZombieChannels']=function(){var _0x41c608=this;loggerAction[_0xbb76('0x59')](_0xbb76('0x7f'),_[_0xbb76('0x80')](this[_0xbb76('0x6d')]));for(var _0x53d189 in this[_0xbb76('0x6d')]){if(_0x41c608['actions'][_0xbb76('0x67')](_0x53d189)){_0x41c608[_0xbb76('0x6a')](_0x53d189);}}};Preview[_0xbb76('0xd')][_0xbb76('0x81')]=function(_0x55ce0d){var _0x53cefa=this;rpcDb[_0xbb76('0x82')](_0x55ce0d['id'],ut['agentReadyId'](this['agents']))[_0xbb76('0x83')](function(_0x59850b){if(!_[_0xbb76('0x84')](_0x59850b)){for(var _0x456163=0x0;_0x456163<_0x59850b[_0xbb76('0x85')];_0x456163+=0x1){if(ut[_0xbb76('0x86')](_0x59850b[_0x456163][_0xbb76('0x87')])<_0x55ce0d[_0xbb76('0x88')]*0x3c){if(_0x59850b[_0x456163][_0xbb76('0x89')]&&!_0x59850b[_0x456163][_0xbb76('0x89')][_0xbb76('0x8a')]){_0x53cefa[_0xbb76('0x8b')](_0x59850b[_0x456163]['id'])[_0xbb76('0x83')](ut[_0xbb76('0x8c')](_0xbb76('0x8d')))[_0xbb76('0x77')](ut[_0xbb76('0x8c')](_0xbb76('0x8d')));}else{rpcDb['disableContact'](_0x59850b[_0x456163]['id']);}}else{var _0x3049ea=new Action(_0x59850b[_0x456163],_0x55ce0d);_0x3049ea[_0xbb76('0x8e')]=moment()[_0xbb76('0x55')](_0xbb76('0x8f'));_0x55ce0d[_0xbb76('0x3b')]+=0x1;ut[_0xbb76('0x90')](_0x3049ea,0x17,'RecallInQueue');if(_0x55ce0d[_0xbb76('0x91')]){rpcDb['rescheduleContactInQueue'](ut[_0xbb76('0x92')](_0x59850b[_0x456163]));rpcDb['createCustomerHistory'](_0x3049ea,_0xbb76('0x93'));}else{ut[_0xbb76('0x90')](_0x3049ea,0x16,_0xbb76('0x94'));rpcDb['createCustomerHistory'](_0x3049ea,'[HistoryRecallClose]');rpcDb[_0xbb76('0x95')](_0x3049ea,'[HistoryRecallClose]');}}}}})[_0xbb76('0x77')](ut[_0xbb76('0x8c')](_0xbb76('0x96')));};Preview[_0xbb76('0xd')][_0xbb76('0x69')]=function(_0x2ac330){_0x2ac330[_0xbb76('0x5d')]=!![];if(ut['IsNotLoggedIn'](_0x2ac330[_0xbb76('0x2a')])){_0x2ac330[_0xbb76('0x4a')]=_0xbb76('0x97');}else if(!ut[_0xbb76('0x98')](_0x2ac330['dialActive'])){_0x2ac330['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x2ac330[_0xbb76('0x52')])){if(!this[_0xbb76('0x99')](_0x2ac330[_0xbb76('0x9a')])){_0x2ac330['message']=_0xbb76('0x9b');}else{_0x2ac330[_0xbb76('0x4a')]='ACTIVE';}}else{_0x2ac330[_0xbb76('0x4a')]='ACTIVE';}emitCampaignPreview(_0x2ac330);};Preview[_0xbb76('0xd')][_0xbb76('0x9c')]=function(_0x132b8b,_0x495613,_0x5a72ca){var _0x1c9945=this;var _0x5bbe78=this['actions'][_0x495613];var _0x5550c0=this[_0xbb76('0x66')][_0x5bbe78[_0xbb76('0x6e')]];var _0x5ac250;if(_0x5550c0){switch(_0x5a72ca){case'1':_0x5550c0[_0xbb76('0x3a')]+=0x1;_0x5bbe78[_0xbb76('0x9d')]+=0x1;_0x5bbe78['countglobal']=ut[_0xbb76('0x9e')](_0x5bbe78);ut['logCustomer'](_0x5bbe78,0x0,'NoSuchNumber');ami[_0xbb76('0x25')](_0xbb76('0x9f'),ut[_0xbb76('0xa0')](_0x5bbe78,_0xbb76('0xa1')));rpcDb[_0xbb76('0xa2')](_0x5bbe78,_0xbb76('0xa3'));if(ut[_0xbb76('0x9e')](_0x5bbe78)>=_0x5550c0[_0xbb76('0xa4')]){_0x5ac250=ut[_0xbb76('0xa5')](_0x5bbe78,0xf,'Global');rpcDb[_0xbb76('0x95')](_0x5ac250,_0xbb76('0xa6'));}else{if(_0x5bbe78[_0xbb76('0x9d')]>=_0x5550c0[_0xbb76('0xa7')]){rpcDb[_0xbb76('0x95')](_0x5bbe78,_0xbb76('0xa6'));}else{rpcDb['rescheduleContact'](ut[_0xbb76('0xa8')](_0x5bbe78,_0xbb76('0x9d'),_0x5550c0[_0xbb76('0xa9')]),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}delete this['actions'][_0x132b8b['linkedid']];break;case _0xbb76('0xac'):var _0x99b6dc=moment()[_0xbb76('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bbe78[_0xbb76('0xad')]=_0x99b6dc;_0x5bbe78[_0xbb76('0xae')]=_0x99b6dc;_0x5bbe78['dialAnswer']=!![];_0x5550c0['pTalking']+=0x1;logger[_0xbb76('0x59')](_0xbb76('0xaf'),_0x5bbe78[_0xbb76('0xb0')],_0xbb76('0xb1'),_0x5550c0[_0xbb76('0x57')],'pTalking:\x20',_0x5550c0['pTalking']);ami[_0xbb76('0x25')]('custom:agentconnect',ut[_0xbb76('0xa0')](_0x5bbe78,'connect'));if(_0x5550c0[_0xbb76('0xb2')]){ami[_0xbb76('0x25')](_0xbb76('0xb3'),ut[_0xbb76('0xb4')](_0x5bbe78));}break;case'16':ami['emit'](_0xbb76('0xb5'),ut[_0xbb76('0xa0')](_0x5bbe78,'complete'));emitVoiceQueueChannelRemove(ut[_0xbb76('0xa0')](_0x5bbe78,_0xbb76('0xb6')));_0x5550c0[_0xbb76('0xb7')]+=0x1;_0x5550c0['total']+=0x1;_0x5550c0['answered']+=0x1;ut[_0xbb76('0x7b')](_0x5550c0,_0xbb76('0xb8'));_0x5bbe78['countglobal']=ut['totalGlobal'](_0x5bbe78);ut[_0xbb76('0x90')](_0x5bbe78,0x4,_0xbb76('0xb9'));rpcDb[_0xbb76('0xa2')](_0x5bbe78,_0xbb76('0xba'));rpcDb[_0xbb76('0x95')](_0x5bbe78,_0xbb76('0xbb'));rpcDb[_0xbb76('0xbc')](_0x5bbe78);_0x5550c0[_0xbb76('0x2c')]+=_0x5bbe78[_0xbb76('0xbd')];_0x5550c0['sumBillable']+=_0x5bbe78[_0xbb76('0xbd')];logger['info'](_0xbb76('0xbe'),_0x5bbe78['uniqueid'],_0xbb76('0xb1'),_0x5550c0[_0xbb76('0x57')],'pTalking:\x20',_0x5550c0[_0xbb76('0x5e')]);delete this[_0xbb76('0x6d')][_0x132b8b[_0xbb76('0xbf')]];break;case _0xbb76('0xc0'):_0x5550c0[_0xbb76('0x36')]+=0x1;_0x5bbe78['countbusyretry']+=0x1;_0x5bbe78['countglobal']=ut['totalGlobal'](_0x5bbe78);ut[_0xbb76('0x90')](_0x5bbe78,0x5,_0xbb76('0xc1'));ami[_0xbb76('0x25')](_0xbb76('0xc2'),ut['buildObj'](_0x5bbe78,_0xbb76('0xc3')));rpcDb['createCustomerHistory'](_0x5bbe78,_0xbb76('0xc4'));if(ut[_0xbb76('0x9e')](_0x5bbe78)>=_0x5550c0['dialGlobalMaxRetry']){_0x5ac250=ut[_0xbb76('0xa5')](_0x5bbe78,0xf,_0xbb76('0xc5'));rpcDb[_0xbb76('0x95')](_0x5ac250,_0xbb76('0xc6'));}else{if(_0x5bbe78[_0xbb76('0xc7')]>=_0x5550c0['dialBusyMaxRetry']){rpcDb[_0xbb76('0x95')](_0x5bbe78,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xbb76('0xc8')](ut[_0xbb76('0xa8')](_0x5bbe78,'countbusyretry',_0x5550c0['dialBusyRetryFrequency']),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}break;case _0xbb76('0xc9'):_0x5550c0['outboundNoAnswerCallsDay']+=0x1;_0x5bbe78[_0xbb76('0xca')]+=0x1;_0x5bbe78[_0xbb76('0xcb')]=ut[_0xbb76('0x9e')](_0x5bbe78);ut['logCustomer'](_0x5bbe78,0x3,_0xbb76('0xcc'));ami['emit']('custom:agentnoanswer',ut[_0xbb76('0xa0')](_0x5bbe78,_0xbb76('0xcd')));rpcDb[_0xbb76('0xa2')](_0x5bbe78,_0xbb76('0xce'));if(ut[_0xbb76('0x9e')](_0x5bbe78)>=_0x5550c0['dialGlobalMaxRetry']){_0x5ac250=ut[_0xbb76('0xa5')](_0x5bbe78,0xf,_0xbb76('0xc5'));rpcDb['createCustomerFinal'](_0x5ac250,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5bbe78[_0xbb76('0xca')]>=_0x5550c0[_0xbb76('0xcf')]){rpcDb[_0xbb76('0x95')](_0x5bbe78,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5bbe78,_0xbb76('0xca'),_0x5550c0[_0xbb76('0xd0')]),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}break;case _0xbb76('0xd1'):_0x5550c0[_0xbb76('0x37')]+=0x1;_0x5bbe78[_0xbb76('0xd2')]+=0x1;_0x5bbe78[_0xbb76('0xcb')]=ut[_0xbb76('0x9e')](_0x5bbe78);ut['logCustomer'](_0x5bbe78,0x8,_0xbb76('0xd3'));ami[_0xbb76('0x25')](_0xbb76('0xd4'),ut['buildObj'](_0x5bbe78,_0xbb76('0xd5')));rpcDb[_0xbb76('0xa2')](_0x5bbe78,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xbb76('0x9e')](_0x5bbe78)>=_0x5550c0[_0xbb76('0xa4')]){_0x5ac250=ut[_0xbb76('0xa5')](_0x5bbe78,0xf,'Global');rpcDb['createCustomerFinal'](_0x5ac250,_0xbb76('0xd6'));}else{if(_0x5bbe78['countcongestionretry']>=_0x5550c0[_0xbb76('0xd7')]){rpcDb['createCustomerFinal'](_0x5bbe78,_0xbb76('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0xbb76('0xa8')](_0x5bbe78,_0xbb76('0xd2'),_0x5550c0['dialBusyRetryFrequency']),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}break;case _0xbb76('0xd9'):_0x5550c0[_0xbb76('0xda')]+=0x1;_0x5bbe78['countagentrejectretry']+=0x1;_0x5bbe78[_0xbb76('0xcb')]=ut[_0xbb76('0x9e')](_0x5bbe78);ut['logCustomer'](_0x5bbe78,0x14,'AgentReject');ami[_0xbb76('0x25')](_0xbb76('0xdb'),ut[_0xbb76('0xa0')](_0x5bbe78,_0xbb76('0xdc')));rpcDb[_0xbb76('0xa2')](_0x5bbe78,_0xbb76('0xdd'));if(ut[_0xbb76('0x9e')](_0x5bbe78)>=_0x5550c0[_0xbb76('0xa4')]){_0x5ac250=ut['cloneAction'](_0x5bbe78,0x14,_0xbb76('0xde'));rpcDb['createCustomerFinal'](_0x5ac250,_0xbb76('0xdf'));}else{if(_0x5bbe78[_0xbb76('0xe0')]>=_0x5550c0['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x5bbe78,_0xbb76('0xdf'));}else{rpcDb['rescheduleContact'](ut[_0xbb76('0xa8')](_0x5bbe78,_0xbb76('0xe0'),_0x5550c0['dialAgentRejectRetryFrequency']),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}break;case'ABANDONED':_0x5550c0[_0xbb76('0x3d')]+=0x1;_0x5bbe78['countabandonedretry']+=0x1;_0x5bbe78['countglobal']=ut['totalGlobal'](_0x5bbe78);ut[_0xbb76('0x90')](_0x5bbe78,0xb,_0xbb76('0xe1'));rpcDb[_0xbb76('0xa2')](_0x5bbe78,_0xbb76('0xe2'));if(ut['totalGlobal'](_0x5bbe78)>=_0x5550c0[_0xbb76('0xa4')]){_0x5ac250=ut['cloneAction'](_0x5bbe78,0xf,_0xbb76('0xc5'));rpcDb['createCustomerFinal'](_0x5ac250,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5bbe78[_0xbb76('0xe3')]>=_0x5550c0[_0xbb76('0xe4')]){rpcDb[_0xbb76('0x95')](_0x5bbe78,_0xbb76('0xe2'));}else{rpcDb[_0xbb76('0xc8')](ut[_0xbb76('0xa8')](_0x5bbe78,_0xbb76('0xe5'),_0x5550c0['dialAbandonedRetryFrequency']),_0x5bbe78[_0xbb76('0xaa')],_0x5bbe78[_0xbb76('0xab')]);}}break;default:if(_0x5bbe78['dialAnswer']){ut['decrementTalkink'](_0x5550c0,'[default]');ut[_0xbb76('0x7d')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5550c0[_0xbb76('0x57')],_0x132b8b);}_0x5550c0['outboundUnknownCallsDay']+=0x1;_0x5bbe78[_0xbb76('0xcb')]=ut[_0xbb76('0x9e')](_0x5bbe78);ut[_0xbb76('0x90')](_0x5bbe78,0xc,_0x132b8b[_0xbb76('0xe6')]||_0x132b8b[_0xbb76('0xe7')]);rpcDb['createCustomerHistory'](_0x5bbe78,_0xbb76('0xe8'));if(ut['totalGlobal'](_0x5bbe78)>=_0x5550c0[_0xbb76('0xa4')]){_0x5ac250=ut[_0xbb76('0xa5')](_0x5bbe78,0xf,_0xbb76('0xc5'));rpcDb[_0xbb76('0x95')](_0x5ac250,_0xbb76('0xe9'));}else{rpcDb[_0xbb76('0x95')](_0x5bbe78,_0xbb76('0xe9'));}delete this[_0xbb76('0x6d')][_0x132b8b[_0xbb76('0xbf')]];}if(!(_0x5bbe78['dialAnswer']&&_0x5a72ca==='16')){ut[_0xbb76('0xea')](_0x5550c0,_0xbb76('0xeb'));logger[_0xbb76('0x59')](_0xbb76('0xec'),_0x5bbe78['uniqueid'],_0xbb76('0xb1'),_0x5550c0['name'],_0xbb76('0x6f'),_0x5550c0[_0xbb76('0x4b')]);}if(_0x5a72ca!==_0xbb76('0xac')){delete this[_0xbb76('0x6d')][_0x132b8b[_0xbb76('0xbf')]];delete this[_0xbb76('0x6d')][_0x132b8b[_0xbb76('0xed')]];}}};Preview['prototype'][_0xbb76('0xee')]=function(_0x193329,_0x191e4f,_0x6c7bf0){if(_[_0xbb76('0xef')](_0x191e4f)&&_0xbb76('0xf0')!==typeof _0x191e4f){return;}if(_[_0xbb76('0xef')](_0x6c7bf0)&&_0xbb76('0xf0')!==typeof _0x6c7bf0){return;}switch(_0x6c7bf0[_0xbb76('0xf1')]){case'0':ut[_0xbb76('0xf2')](_0x193329,0x0,_0xbb76('0xf3'));rpcDb[_0xbb76('0xf4')](_0x193329,_0xbb76('0xf5'));break;case'3':ut['logAgent'](_0x193329,0x3,_0xbb76('0xcc'));rpcDb[_0xbb76('0xf4')](_0x193329,_0xbb76('0xf6'));break;case'5':ut[_0xbb76('0xf2')](_0x193329,0x5,_0xbb76('0xc1'));rpcDb[_0xbb76('0xf4')](_0x193329,_0xbb76('0xf7'));break;case'8':ut[_0xbb76('0xf2')](_0x193329,0x8,_0xbb76('0xd3'));rpcDb['createAgentHistory'](_0x193329,_0xbb76('0xf8'));break;case'22':ut[_0xbb76('0xf2')](_0x193329,0x16,_0xbb76('0xf9'));rpcDb[_0xbb76('0xf4')](_0x193329,_0xbb76('0xfa'));break;default:ut[_0xbb76('0xf2')](_0x193329,0xc,_0x6c7bf0[_0xbb76('0xf1')]);rpcDb[_0xbb76('0xf4')](_0x193329,_0xbb76('0xf8'));}ut['updateOriginated'](_0x191e4f,_0xbb76('0xfb'));logger[_0xbb76('0x59')](_0xbb76('0xfc'),_0x193329[_0xbb76('0xb0')],_0xbb76('0xb1'),_0x191e4f['name'],_0xbb76('0x6f'),_0x191e4f['originated']);delete this['actions'][_0x193329[_0xbb76('0xb0')]];};Preview[_0xbb76('0xd')]['checkInBlack']=function(_0x9d2442,_0x39c483,_0xf7bc97,_0x4a2ca1,_0x40dff1){var _0x2591f6=this;return new BPromise(function(_0x37d548,_0x3ccda0){if(_[_0xbb76('0x84')](_0x39c483)||_[_0xbb76('0x84')](_0x39c483[_0xbb76('0xfd')])||_['isNil'](_0x39c483[_0xbb76('0xfd')]['phone'])||_[_0xbb76('0x84')](_0x39c483[_0xbb76('0x73')])){_0x3ccda0(ut['message'](_0xbb76('0xfe'),_0x4a2ca1,_0x40dff1));return;}var _0x485b89=uuid['v4']();var _0x4f3b3a=_0x2591f6[_0xbb76('0x66')][_0x39c483[_0xbb76('0x6c')][_0xbb76('0x57')]];var _0x158979=_0xf7bc97?_0x2591f6[_0xbb76('0x14')][_0xf7bc97]['id']:undefined;_0x2591f6[_0xbb76('0x6d')][_0x485b89]=new Action(_0x39c483,_0x4f3b3a,_0x485b89,_0xf7bc97,_0x158979);var _0x2afe29=_0x2591f6[_0xbb76('0x6d')][_0x485b89];_0x2afe29[_0xbb76('0xaa')]=_0x4a2ca1;_0x2afe29[_0xbb76('0xab')]=_0x40dff1;_0x2afe29['lookAgent']=_0xf7bc97;if(_[_0xbb76('0xff')](_0x9d2442)){_0x2591f6['execCall'](_0x2afe29,_0x4f3b3a,_0x39c483,_0xf7bc97)[_0xbb76('0x83')](function(_0x47ad3a){logger[_0xbb76('0x59')]('[Preview][execCall][success]',_0xbb76('0x100')+_0x2afe29[_0xbb76('0x6e')]+_0xbb76('0x101')+_0x2afe29[_0xbb76('0x102')],JSON[_0xbb76('0x5b')](_0x47ad3a));ami[_0xbb76('0x25')]('custom:agentcalled',ut['buildObj'](_0x2afe29,_0xbb76('0x103')));_0x37d548(ut[_0xbb76('0x4a')](_0xbb76('0x104')));})[_0xbb76('0x77')](function(_0x2a8a83){ut[_0xbb76('0x60')]('[Preview][execCall][failure]',_0x2a8a83);_0x3ccda0(ut['message']('Call\x20failed',_0x4a2ca1,_0x40dff1));});}else{_0x4f3b3a['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x2afe29);rpcDb['createHistory'](_0x2afe29,_0xbb76('0x105'));delete _0x2591f6[_0xbb76('0x6d')][_0x485b89];_0x3ccda0(ut[_0xbb76('0x4a')]('Contact\x20in\x20black\x20List',_0x4a2ca1,_0x40dff1));}});};Preview['prototype'][_0xbb76('0x99')]=function(_0x32bd6d){return!_['isNil'](_0x32bd6d)&&!_['isNil'](_0x32bd6d['name'])&&!_['isNil'](_0x32bd6d['active'])&&_0x32bd6d[_0xbb76('0x53')]&&!_[_0xbb76('0x84')](this[_0xbb76('0x13')][util['format'](_0xbb76('0x106'),_0x32bd6d[_0xbb76('0x57')])])&&!_['isNil'](this[_0xbb76('0x13')][util[_0xbb76('0x55')](_0xbb76('0x106'),_0x32bd6d[_0xbb76('0x57')])][_0xbb76('0x75')])&&(this[_0xbb76('0x13')][util['format'](_0xbb76('0x106'),_0x32bd6d[_0xbb76('0x57')])][_0xbb76('0x75')]==='reachable'||this[_0xbb76('0x13')][util[_0xbb76('0x55')](_0xbb76('0x106'),_0x32bd6d[_0xbb76('0x57')])][_0xbb76('0x75')]==='unmonitored');};Preview[_0xbb76('0xd')]['run']=function(_0x34ed48,_0x580f24){var _0x1cef6e=this;return new BPromise(function(_0x1410d4,_0x37e01d){_0x1cef6e[_0xbb76('0x107')](_0x34ed48,_0x580f24)[_0xbb76('0x83')](function(_0x4c9fbd){_0x1410d4(_['pick'](_0x4c9fbd,['message']));})[_0xbb76('0x77')](function(_0x234e37){if(_0x234e37['unlock']){rpcDb[_0xbb76('0x108')](_0x34ed48);}if(_0x234e37[_0xbb76('0x53')]){rpcDb[_0xbb76('0x109')](_0x34ed48);}_0x37e01d(_[_0xbb76('0x10a')](_0x234e37,[_0xbb76('0x4a')]));});});};Preview[_0xbb76('0xd')][_0xbb76('0x107')]=function(_0x36ac1c,_0xe05f46){var _0x34243c=this;return new BPromise(function(_0x12b1a4,_0x1355b4){var _0x4e26d4,_0x2ef459;rpcDb[_0xbb76('0x10b')](_0x36ac1c)['then'](function(_0x31c1bf){if(!_['isNil'](_0x31c1bf[0x0])){_0x2ef459=_0x31c1bf[0x0]['recallme']?![]:!![];_0x4e26d4=_0x31c1bf[0x0][_0xbb76('0x10c')]?!![]:![];_0x4e26d4=_0xe05f46?!![]:_0x4e26d4;}var _0x33379e=_0x34243c[_0xbb76('0x10d')](_0x31c1bf);if(_0x33379e[_0xbb76('0x10e')]){rpcDb[_0xbb76('0x10f')](_['pick'](_0x31c1bf[0x0],[_0xbb76('0x73'),_0xbb76('0x110')]))[_0xbb76('0x83')](function(_0x5e4c85){_0x34243c[_0xbb76('0x111')](_0x5e4c85,_0x31c1bf[0x0],_0xe05f46,_0x2ef459,_0x4e26d4)[_0xbb76('0x83')](function(_0x1f8bd6){_0x12b1a4(_0x1f8bd6);})[_0xbb76('0x77')](function(_0x3abf88){_0x1355b4(_0x3abf88);});})[_0xbb76('0x77')](function(_0x2faba8){ut['logger']('[Preview][checkIsBlackList]',_0x2faba8);_0x1355b4(ut[_0xbb76('0x4a')](_0xbb76('0x112'),_0x2ef459,_0x4e26d4));});}else{_0x1355b4(ut[_0xbb76('0x4a')](_0x33379e[_0xbb76('0x4a')],_0x2ef459,_0x4e26d4));}})['catch'](function(_0x33fde7){ut[_0xbb76('0x60')](_0xbb76('0x113'),_0x33fde7);_0x1355b4(ut[_0xbb76('0x4a')](_0xbb76('0x112'),![],!![]));});});};Preview['prototype'][_0xbb76('0x10d')]=function(_0x27cfc1){if(_[_0xbb76('0x84')](_0x27cfc1)||_[_0xbb76('0xff')](_0x27cfc1)||!_['isNil'](_0x27cfc1[0x0][_0xbb76('0x89')])&&_['isNil'](_0x27cfc1[0x0]['Agent'][_0xbb76('0x57')])){ut[_0xbb76('0x60')](_0xbb76('0x114'),_0x27cfc1);return{'isValid':![],'message':_0xbb76('0x115')};}var _0x33dfc2=this[_0xbb76('0x66')][_0x27cfc1[0x0][_0xbb76('0x6c')][_0xbb76('0x57')]];_0x33dfc2[_0xbb76('0x4a')]=_0xbb76('0x116');if(_[_0xbb76('0x84')](_0x33dfc2)){ut[_0xbb76('0x60')](_0xbb76('0x117'),_0x33dfc2);return{'isValid':![],'message':_0xbb76('0x118')};}if(!this[_0xbb76('0x99')](_0x33dfc2[_0xbb76('0x52')])){ut[_0xbb76('0x60')](_0xbb76('0x119'),_0xbb76('0x11a')+_0x33dfc2[_0xbb76('0x57')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x33dfc2[_0xbb76('0x9a')])){ut[_0xbb76('0x60')](_0xbb76('0x119'),_0x33dfc2[_0xbb76('0x57')]+_0xbb76('0x11b'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0xbb76('0x98')](_0x33dfc2[_0xbb76('0x31')])){ut[_0xbb76('0x60')](_0xbb76('0x11c'),_0x33dfc2[_0xbb76('0x57')]+_0xbb76('0x11d'));return{'isValid':![],'message':_0xbb76('0x11a')+_0x33dfc2[_0xbb76('0x57')]+_0xbb76('0x11d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xbb76('0xd')][_0xbb76('0x11e')]=function(_0xdde0f0,_0x15a922,_0x2d854b,_0x1f473b){var _0x310cdb=this;return new BPromise(function(_0x4e78bf,_0x542a63){var _0x46136c=_0xdde0f0[_0xbb76('0xb0')];var _0x1f3138=_0x310cdb[_0xbb76('0x99')](_0x15a922[_0xbb76('0x52')])?util[_0xbb76('0x55')]('SIP/%s/%s%s',_0x15a922[_0xbb76('0x52')]['name'],_[_0xbb76('0x84')](_0x15a922['dialPrefix'])?'':_0x15a922[_0xbb76('0x11f')][_0xbb76('0x120')]()||'',_0x15a922['dialCutDigit']>0x0?_0x2d854b['Contact'][_0xbb76('0x121')]['substring'](_0x15a922[_0xbb76('0x122')]):_0x2d854b[_0xbb76('0xfd')][_0xbb76('0x121')]):util[_0xbb76('0x55')]('SIP/%s/%s%s',_['isNil'](_0x15a922[_0xbb76('0x9a')])?_0x15a922[_0xbb76('0x52')][_0xbb76('0x57')]:_0x15a922[_0xbb76('0x9a')][_0xbb76('0x57')],_[_0xbb76('0x84')](_0x15a922[_0xbb76('0x11f')])?'':_0x15a922['dialPrefix'][_0xbb76('0x120')]()||'',_0x15a922['dialCutDigit']>0x0?_0x2d854b['Contact']['phone'][_0xbb76('0x123')](_0x15a922['dialCutDigit']):_0x2d854b[_0xbb76('0xfd')][_0xbb76('0x121')]);var _0x2f3353=_0x310cdb['isTrunkReachable'](_0x15a922[_0xbb76('0x52')])?ut['getCallerId'](_0x15a922[_0xbb76('0x52')][_0xbb76('0x124')],_0x15a922['dialOriginateCallerIdName'],_0x15a922['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xbb76('0x125')](_0x15a922[_0xbb76('0x33')],_0x15a922['dialRandomLastDigitCallerIdNumber']):_0x15a922[_0xbb76('0x33')]):ut[_0xbb76('0x126')](_[_0xbb76('0x84')](_0x15a922['TrunkBackup'])?_0x15a922[_0xbb76('0x52')][_0xbb76('0x124')]:_0x15a922['TrunkBackup'][_0xbb76('0x124')],_0x15a922['dialOriginateCallerIdName'],_0x15a922[_0xbb76('0x127')]>0x0?ut['getCallerIdRandom'](_0x15a922[_0xbb76('0x33')],_0x15a922[_0xbb76('0x127')]):_0x15a922[_0xbb76('0x33')]);if(_0x2f3353){_0xdde0f0[_0xbb76('0x128')]=ut[_0xbb76('0x129')](_0x2f3353);_0xdde0f0['originatecalleridnum']=ut[_0xbb76('0x12a')](_0x2f3353);}var _0x12568c=ut['addVariables'](_0x15a922,_0x2d854b,_0x1f3138,_0x2f3353,_0x46136c,_0xdde0f0);_[_0xbb76('0x12b')](_0xdde0f0,ut[_0xbb76('0x12c')](_0x12568c));_0xdde0f0[_0xbb76('0x8e')]=moment()[_0xbb76('0x55')](_0xbb76('0x8f'));ami['Action'](ut[_0xbb76('0x12d')](_0xdde0f0,_0x15a922,_0x12568c,_0xdde0f0['activeContact'],_0x1f473b))[_0xbb76('0x83')](function(_0x4284f7){_0x15a922['originated']+=0x1;logger[_0xbb76('0x59')](_0xbb76('0x12e'),_0x46136c,_0xbb76('0xb1'),_0x15a922[_0xbb76('0x57')],_0xbb76('0x6f'),_0x15a922['originated']);_0x4e78bf(_0x4284f7);})[_0xbb76('0x77')](function(_0xdc91af){ut[_0xbb76('0xf2')](_0xdde0f0,0xe,_0xbb76('0x12f'));rpcDb['createAgentHistory'](_0xdde0f0,_0xbb76('0x130'));_0x542a63(_0xdc91af);});});};Preview[_0xbb76('0xd')][_0xbb76('0x1e')]=function(_0x4eeef9){if(this['actions'][_0x4eeef9['linkedid']]){this[_0xbb76('0x6d')][_0x4eeef9[_0xbb76('0xbf')]][_0xbb76('0x76')]=_0x4eeef9[_0xbb76('0x76')];}};Preview[_0xbb76('0xd')][_0xbb76('0x17')]=function(_0x2ed60a){var _0x10dbbe=this;var _0x111331=this['actions'][_0x2ed60a[_0xbb76('0x131')]];if(_0x111331){if(_0x111331[_0xbb76('0x132')]&&this['agents'][_0x111331[_0xbb76('0x132')]]){ut[_0xbb76('0x133')](_0x111331,this[_0xbb76('0x14')][_0x111331[_0xbb76('0x132')]]['name'],this[_0xbb76('0x14')][_0x111331[_0xbb76('0x132')]]['id']);}var _0x484474=_[_0xbb76('0x134')](_0x111331);_0x484474['responsetime']=moment()[_0xbb76('0x55')](_0xbb76('0x8f'));var _0x4b579b=_0x10dbbe[_0xbb76('0x66')][_0x111331['queue']];if(ut[_0xbb76('0x135')](_0x2ed60a[_0xbb76('0x136')])){if(_0x111331['unlockAgent']){rpcDb[_0xbb76('0x108')](_0x111331[_0xbb76('0x102')]);}if(_0x111331['activeContact']){rpcDb['disableContact'](_0x111331[_0xbb76('0x102')]);}ami[_0xbb76('0x25')](_0xbb76('0x137'),ut[_0xbb76('0xa0')](_0x111331,_0xbb76('0x138')));this['callProgressDetectingAgent'](_0x484474,_0x4b579b,_0x2ed60a);}else{_0x111331[_0xbb76('0x8e')]=moment()[_0xbb76('0x55')](_0xbb76('0x8f'));ut[_0xbb76('0xf2')](_0x484474,0x4,'Answer');rpcDb[_0xbb76('0xf4')](_0x484474,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xbb76('0xd')][_0xbb76('0x139')]=function(_0x23417d){var _0x28d58b=this;var _0x6a69b7=this['actions'][_0x23417d[_0xbb76('0xbf')]];var _0x26a308;if(_0x6a69b7){_0x26a308=this['campaignsPreview'][_0x6a69b7[_0xbb76('0x6e')]];logger['info']('[syncHangup][talking]',_0x23417d[_0xbb76('0xbf')],'\x20Queue',_0x26a308[_0xbb76('0x57')],'pTalking:\x20',_0x26a308[_0xbb76('0x5e')]);}if(this[_0xbb76('0x6d')][_0x23417d[_0xbb76('0xbf')]]&&_0x23417d[_0xbb76('0xbf')]!==_0x23417d[_0xbb76('0xb0')]){if(_0x23417d[_0xbb76('0x13a')]==='16'&&this[_0xbb76('0x6d')][_0x23417d[_0xbb76('0xbf')]]['dialAnswer']){this[_0xbb76('0x9c')](_0x23417d,_0x23417d[_0xbb76('0xbf')],_0x23417d[_0xbb76('0x13a')]);}else if(this[_0xbb76('0x6d')][_0x23417d[_0xbb76('0xbf')]][_0xbb76('0x7a')]){logger['info'](_0xbb76('0x13b'),_0x23417d[_0xbb76('0xbf')],_0x23417d[_0xbb76('0x13a')],_0xbb76('0xb1'),_0x26a308[_0xbb76('0x57')],_0xbb76('0x70'),_0x26a308[_0xbb76('0x5e')]);this[_0xbb76('0x9c')](_0x23417d,_0x23417d[_0xbb76('0xbf')],_0x23417d[_0xbb76('0x13a')]);}}else if(_0x6a69b7&&_[_0xbb76('0x84')](_0x6a69b7[_0xbb76('0x13c')])&&_0x26a308['dialQueueProject']&&_0x23417d[_0xbb76('0xbf')]===_0x23417d['uniqueid']&&_[_0xbb76('0x84')](_0x23417d[_0xbb76('0xf1')])&&_0x23417d[_0xbb76('0x13a')]==='16'&&_0x23417d['channelstate']==='6'&&_[_0xbb76('0xef')](_0x6a69b7[_0xbb76('0x13d')])){if(_0x6a69b7[_0xbb76('0xaa')]){rpcDb['unlockContact'](_0x6a69b7[_0xbb76('0x102')]);}if(_0x6a69b7[_0xbb76('0xab')]){rpcDb[_0xbb76('0x109')](_0x6a69b7[_0xbb76('0x102')]);}_0x23417d[_0xbb76('0xf1')]='22';this['callProgressDetectingAgent'](_0x6a69b7,_0x26a308,_0x23417d);}else if(_0x6a69b7&&_0x6a69b7[_0xbb76('0x13d')]){if(_0x23417d[_0xbb76('0x13a')]==='16'&&this[_0xbb76('0x6d')][_0x23417d[_0xbb76('0xbf')]]['dialAnswer']){logger[_0xbb76('0x59')](_0xbb76('0x13e'),_0x23417d[_0xbb76('0xbf')],_0x23417d['cause'],_0xbb76('0xb1'),_0x26a308[_0xbb76('0x57')],_0xbb76('0x70'),_0x26a308[_0xbb76('0x5e')]);this[_0xbb76('0x9c')](_0x23417d,_0x23417d[_0xbb76('0xbf')],_0x23417d['cause']);}else if(this['actions'][_0x23417d[_0xbb76('0xbf')]][_0xbb76('0x7a')]){logger['info'](_0xbb76('0x13b'),_0x23417d['linkedid'],_0x23417d[_0xbb76('0x13a')],_0xbb76('0xb1'),_0x26a308[_0xbb76('0x57')],_0xbb76('0x70'),_0x26a308[_0xbb76('0x5e')]);this[_0xbb76('0x9c')](_0x23417d,_0x23417d[_0xbb76('0xbf')],_0x23417d[_0xbb76('0x13a')]);}}};Preview[_0xbb76('0xd')]['syncDialEnd']=function(_0x30711f){if(this[_0xbb76('0x6d')][_0x30711f['destlinkedid']]&&_0x30711f[_0xbb76('0xed')]!==_0x30711f[_0xbb76('0x13f')]){this[_0xbb76('0x9c')](_0x30711f,_0x30711f[_0xbb76('0xed')],_0x30711f['dialstatus']);}};Preview[_0xbb76('0xd')][_0xbb76('0x140')]=function(_0xccdd19){if(this[_0xbb76('0x6d')][_0xccdd19[_0xbb76('0xbf')]]&&_0xccdd19[_0xbb76('0xbf')]!==_0xccdd19[_0xbb76('0xb0')]&&!this[_0xbb76('0x6d')][_0xccdd19[_0xbb76('0xbf')]]['dialAnswer']){if(_0xccdd19[_0xbb76('0x13a')]==='1'){this[_0xbb76('0x9c')](_0xccdd19,_0xccdd19['linkedid'],_0xccdd19[_0xbb76('0x13a')]);}}};Preview['prototype'][_0xbb76('0x141')]=function(_0x155c7d,_0x472e48,_0x38e2de){if(this[_0xbb76('0x6d')][_0x155c7d]){if(_[_0xbb76('0x84')](this[_0xbb76('0x6d')][_0x155c7d][_0xbb76('0x142')])){this['actions'][_0x155c7d][_0xbb76('0x142')]={};}this['actions'][_0x155c7d][_0xbb76('0x142')][_0x472e48]=_0x38e2de;}};Preview[_0xbb76('0xd')]['syncVarSet']=function(_0x51ae08){try{if(!_[_0xbb76('0x84')](_0x51ae08)){if(ut[_0xbb76('0x143')](_[_0xbb76('0x144')](_0x51ae08[_0xbb76('0x145')])[0x0])){this[_0xbb76('0x141')](_0x51ae08[_0xbb76('0xb0')],_[_0xbb76('0x144')](_0x51ae08[_0xbb76('0x145')])[0x0],_0x51ae08[_0xbb76('0x146')]);}}}catch(_0x2cd73b){logger[_0xbb76('0x147')](_0xbb76('0x148'),util['inspect'](_0x2cd73b,{'showHidden':![],'depth':null}));}};Preview[_0xbb76('0xd')]['syncAttendedTransfer']=function(_0x2d0006){if(_0x2d0006){if(this['actions'][_0x2d0006['transfertargetlinkedid']]){this[_0xbb76('0x6d')][_0x2d0006[_0xbb76('0x149')]][_0xbb76('0x13d')]=!![];}}};Preview['prototype'][_0xbb76('0x14a')]=function(_0x291cdb){if(_0x291cdb){if(this[_0xbb76('0x6d')][_0x291cdb[_0xbb76('0x14b')]]){this[_0xbb76('0x6d')][_0x291cdb[_0xbb76('0x14b')]][_0xbb76('0x13d')]=!![];}}};module[_0xbb76('0x14c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 14fe5a4..185126a 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 _0xae24=['resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','[createHistory]\x20','createHistory','catch'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xae24,0x182));var _0x4ae2=function(_0x2e0e83,_0x4f2be0){_0x2e0e83=_0x2e0e83-0x0;var _0x15ec41=_0xae24[_0x2e0e83];return _0x15ec41;};'use strict';var util=require(_0x4ae2('0x0'));var BPromise=require('bluebird');var logger=require(_0x4ae2('0x1'))('preview');var _=require(_0x4ae2('0x2'));var cmHopper=require(_0x4ae2('0x3'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x4ae2('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x4ae2('0x5'));var voiceQueueReport=require(_0x4ae2('0x6'));function loggerCatch(_0x20c85c){return function(_0x3e6055){logger[_0x4ae2('0x7')](_0x20c85c,util[_0x4ae2('0x8')](_0x3e6055,{'showHidden':![],'depth':null}));};}function create(_0x4f2e84){return BPromise['resolve']()[_0x4ae2('0x9')](cmHopperHistory['createHistory'](_0x4f2e84))['catch'](loggerCatch(_0x4ae2('0xa')));}function createAgent(_0xb01e8e){return BPromise['resolve']()[_0x4ae2('0x9')](agentReportPreview[_0x4ae2('0xb')](_0xb01e8e))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0xa')));}function moveContact(_0x52458f){return BPromise[_0x4ae2('0xd')]()[_0x4ae2('0x9')](cmHopper[_0x4ae2('0xe')](_0x52458f,!![]))['catch'](loggerCatch(_0x4ae2('0xf')));}exports[_0x4ae2('0x10')]=function(_0x30d6c4){return BPromise[_0x4ae2('0xd')]()[_0x4ae2('0x9')](cmHopperBlack[_0x4ae2('0x10')](_0x30d6c4))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x11')));};exports[_0x4ae2('0x12')]=function(_0x5e2bfd){return BPromise['resolve']()['then'](cmHopper[_0x4ae2('0x12')](_0x5e2bfd))[_0x4ae2('0xc')](loggerCatch('[getContactPreview]\x20'));};exports[_0x4ae2('0xb')]=function(_0x9fb8db,_0x1fde63){create(_0x9fb8db)[_0x4ae2('0xc')](loggerCatch(_0x1fde63));moveContact(_0x9fb8db)[_0x4ae2('0xc')](loggerCatch(_0x1fde63));};exports[_0x4ae2('0x13')]=function(_0x3d4259,_0xdc8798){createAgent(_0x3d4259)[_0x4ae2('0xc')](loggerCatch(_0xdc8798));};exports[_0x4ae2('0x14')]=function(_0x4d5071,_0x4a97af){create(_0x4d5071)[_0x4ae2('0xc')](loggerCatch(_0x4a97af));};exports[_0x4ae2('0x15')]=function(_0x51e20c,_0x45c1bf){moveContact(_0x51e20c)[_0x4ae2('0xc')](loggerCatch(_0x45c1bf));};exports[_0x4ae2('0x16')]=function(_0x2ad222,_0x8732bb,_0x497218){if(_0x8732bb){_0x2ad222[_0x4ae2('0x17')]=null;}if(_0x497218){_0x2ad222['active']=![];}return BPromise['resolve']()[_0x4ae2('0x9')](cmHopper[_0x4ae2('0x16')](_0x2ad222))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x18')));};exports[_0x4ae2('0x19')]=function(_0x526768){return BPromise[_0x4ae2('0xd')]()['then'](cmHopper[_0x4ae2('0x19')](_0x526768))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x1a')));};exports['unlockContact']=function(_0x43f112){return BPromise[_0x4ae2('0xd')]()[_0x4ae2('0x9')](cmHopper[_0x4ae2('0x1b')]({'UserId':null},_0x43f112,0x1))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x1c')));};exports['disableContact']=function(_0x5962b0){return BPromise[_0x4ae2('0xd')]()[_0x4ae2('0x9')](cmHopper[_0x4ae2('0x1b')]({'active':![]},_0x5962b0,0x1))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x1d')));};exports[_0x4ae2('0x1e')]=function(_0x57a377){var _0x5ec1fd={};_0x5ec1fd[_0x4ae2('0x1f')]=_0x57a377['type'];_0x5ec1fd['uniqueid']=_0x57a377['uniqueid'];_0x5ec1fd[_0x4ae2('0x20')]=_0x57a377[_0x4ae2('0x20')];_0x5ec1fd['calleridname']=_0x57a377[_0x4ae2('0x21')];_0x5ec1fd[_0x4ae2('0x22')]=_0x57a377[_0x4ae2('0x22')];_0x5ec1fd[_0x4ae2('0x23')]=_0x57a377[_0x4ae2('0x24')];_0x5ec1fd[_0x4ae2('0x25')]=_0x57a377[_0x4ae2('0x24')];_0x5ec1fd[_0x4ae2('0x26')]=0x1;_0x5ec1fd[_0x4ae2('0x27')]=_0x57a377[_0x4ae2('0x28')];_0x5ec1fd[_0x4ae2('0x29')]=_0x57a377[_0x4ae2('0x2a')];_0x5ec1fd[_0x4ae2('0x2b')]=_0x4ae2('0x2c');_0x5ec1fd[_0x4ae2('0x2d')]=_0x4ae2('0x2e');_0x5ec1fd[_0x4ae2('0x2f')]=0x0;_0x5ec1fd['assigned']=0x1;_0x5ec1fd[_0x4ae2('0x30')]=_0x57a377['membername'];_0x5ec1fd[_0x4ae2('0x31')]=_0x4ae2('0x32');return BPromise['resolve']()[_0x4ae2('0x9')](voiceQueueReport[_0x4ae2('0x33')](_0x5ec1fd))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x34')));};exports['getContactRecallMe']=function(_0x349c84,_0x269a91){return BPromise[_0x4ae2('0xd')]()[_0x4ae2('0x9')](cmHopper[_0x4ae2('0x35')](_0x349c84,_0x269a91))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x36')));};exports[_0x4ae2('0x37')]=function(_0xe99f9d){return BPromise['resolve']()[_0x4ae2('0x9')](cmHopper['rescheduleContact'](_0xe99f9d,!![],!![]))[_0x4ae2('0xc')](loggerCatch(_0x4ae2('0x38')));}; \ No newline at end of file +var _0xb4c7=['createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory'];(function(_0x7dbd65,_0x18da49){var _0x33d551=function(_0x7ce789){while(--_0x7ce789){_0x7dbd65['push'](_0x7dbd65['shift']());}};_0x33d551(++_0x18da49);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xbc4f30,_0x5678bd){_0xbc4f30=_0xbc4f30-0x0;var _0x393ab0=_0xb4c7[_0xbc4f30];return _0x393ab0;};'use strict';var util=require(_0x7b4c('0x0'));var BPromise=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var _=require(_0x7b4c('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x7b4c('0x5'));var cmHopperHistory=require(_0x7b4c('0x6'));var cmHopperBlack=require(_0x7b4c('0x7'));var voiceQueueRt=require(_0x7b4c('0x8'));var agentReportPreview=require(_0x7b4c('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x1b0f57){return function(_0x10e197){logger[_0x7b4c('0xa')](_0x1b0f57,util['inspect'](_0x10e197,{'showHidden':![],'depth':null}));};}function create(_0x2d7b7e){return BPromise[_0x7b4c('0xb')]()['then'](cmHopperHistory[_0x7b4c('0xc')](_0x2d7b7e))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function createAgent(_0x237e28){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](agentReportPreview[_0x7b4c('0xc')](_0x237e28))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0xe')));}function moveContact(_0x2adb51){return BPromise['resolve']()['then'](cmHopper[_0x7b4c('0x10')](_0x2adb51,!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x11')));}exports[_0x7b4c('0x12')]=function(_0x3e1558){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopperBlack[_0x7b4c('0x12')](_0x3e1558))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x13')));};exports['getContactPreview']=function(_0x2edb77){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x14')](_0x2edb77))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x15')));};exports[_0x7b4c('0xc')]=function(_0x22c409,_0x4d3f5e){create(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));moveContact(_0x22c409)[_0x7b4c('0xd')](loggerCatch(_0x4d3f5e));};exports[_0x7b4c('0x16')]=function(_0x36c02a,_0x59ae96){createAgent(_0x36c02a)[_0x7b4c('0xd')](loggerCatch(_0x59ae96));};exports[_0x7b4c('0x17')]=function(_0x32110e,_0x380b79){create(_0x32110e)[_0x7b4c('0xd')](loggerCatch(_0x380b79));};exports[_0x7b4c('0x18')]=function(_0x237110,_0x445281){moveContact(_0x237110)[_0x7b4c('0xd')](loggerCatch(_0x445281));};exports['rescheduleContact']=function(_0x1f06ec,_0x331e24,_0x11996d){if(_0x331e24){_0x1f06ec[_0x7b4c('0x19')]=null;}if(_0x11996d){_0x1f06ec[_0x7b4c('0x1a')]=![];}return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1b')](_0x1f06ec))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1c')));};exports['countReScheduled']=function(_0x45438c){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1d')](_0x45438c))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x1e')));};exports[_0x7b4c('0x1f')]=function(_0x459eb4){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'UserId':null},_0x459eb4,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x20')));};exports['disableContact']=function(_0x27f361){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper[_0x7b4c('0x1f')]({'active':![]},_0x27f361,0x1))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x21')));};exports[_0x7b4c('0x22')]=function(_0x2552f9){var _0x3e4a46={};_0x3e4a46[_0x7b4c('0x23')]=_0x2552f9[_0x7b4c('0x23')];_0x3e4a46[_0x7b4c('0x24')]=_0x2552f9[_0x7b4c('0x24')];_0x3e4a46[_0x7b4c('0x25')]=_0x2552f9[_0x7b4c('0x25')];_0x3e4a46[_0x7b4c('0x26')]=_0x2552f9[_0x7b4c('0x26')];_0x3e4a46[_0x7b4c('0x27')]=_0x2552f9[_0x7b4c('0x27')];_0x3e4a46['queuecallerjoinAt']=_0x2552f9['answertime'];_0x3e4a46['queuecallerleaveAt']=_0x2552f9[_0x7b4c('0x28')];_0x3e4a46[_0x7b4c('0x29')]=0x1;_0x3e4a46[_0x7b4c('0x2a')]=_0x2552f9[_0x7b4c('0x2b')];_0x3e4a46['connectedlinename']=_0x2552f9[_0x7b4c('0x2c')];_0x3e4a46[_0x7b4c('0x2d')]='from-sip';_0x3e4a46[_0x7b4c('0x2e')]='xcally-motion-preview';_0x3e4a46[_0x7b4c('0x2f')]=0x0;_0x3e4a46[_0x7b4c('0x30')]=0x1;_0x3e4a46[_0x7b4c('0x31')]=_0x2552f9['membername'];_0x3e4a46[_0x7b4c('0x32')]=_0x7b4c('0x33');return BPromise['resolve']()[_0x7b4c('0xf')](voiceQueueReport[_0x7b4c('0x34')](_0x3e4a46))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x35')));};exports['getContactRecallMe']=function(_0x4d0355,_0x1325c1){return BPromise[_0x7b4c('0xb')]()['then'](cmHopper[_0x7b4c('0x36')](_0x4d0355,_0x1325c1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x7b4c('0x37')]=function(_0x16ae89){return BPromise[_0x7b4c('0xb')]()[_0x7b4c('0xf')](cmHopper['rescheduleContact'](_0x16ae89,!![],!![]))[_0x7b4c('0xd')](loggerCatch(_0x7b4c('0x38')));}; \ 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 90029ee..1f576a4 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 _0xb91a=['Contact','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','xcally-motion-preview','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','name','queue','interface','channelAgent','buildAcw','agentReadyId','status','reachable','getDiff','createBody','CampaignId','filterKey','campaigntype','dialAnswer','membername','countnoanswerretry','countglobal','callback','recallme','sipcallid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','info','inspect','loggerError','logger2','message','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','VoiceQueueId','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID'];(function(_0x450e95,_0x5b33d2){var _0x5c07a3=function(_0x17f311){while(--_0x17f311){_0x450e95['push'](_0x450e95['shift']());}};_0x5c07a3(++_0x5b33d2);}(_0xb91a,0xe5));var _0xab91=function(_0x3e9012,_0x136678){_0x3e9012=_0x3e9012-0x0;var _0x38f4d4=_0xb91a[_0x3e9012];return _0x38f4d4;};'use strict';var util=require('util');var _=require(_0xab91('0x0'));var moment=require(_0xab91('0x1'));var logger=require(_0xab91('0x2'))(_0xab91('0x3'));var ipAgi=process['env'][_0xab91('0x4')]||_0xab91('0x5');function getSeconds(_0x53c757,_0x2b8873){var _0x4ec84d=moment(_0x53c757)['milliseconds'](0x0);var _0x1f99d4=moment(_0x2b8873)[_0xab91('0x6')](0x0);return _0x4ec84d['diff'](_0x1f99d4,_0xab91('0x7'));}exports[_0xab91('0x8')]=function(_0x55a554){return function(_0x1748f2){logger[_0xab91('0x9')](_0x55a554,util['inspect'](_0x1748f2,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x507264,_0x2da0bb){logger[_0xab91('0xa')](_0x507264,util[_0xab91('0xb')](_0x2da0bb,{'showHidden':![],'depth':null}));};exports[_0xab91('0xc')]=function(_0x53f6b9,_0x213e50){logger[_0xab91('0x9')](_0x53f6b9,util['inspect'](_0x213e50,{'showHidden':![],'depth':null}));};exports[_0xab91('0xd')]=function(_0x4e5ef7){return function(_0x381007){logger['info'](_0x4e5ef7,util['inspect'](_0x381007,{'showHidden':![],'depth':null}));};};exports[_0xab91('0xe')]=function(_0x4967bb,_0x1dd6fa,_0x3d7004){return{'message':_0x4967bb,'unlock':_0x1dd6fa,'active':_0x3d7004};};exports[_0xab91('0xf')]=function(_0x29fadc,_0x293193,_0x441121){if(!_['isUndefined'](_0x441121)&&_0xab91('0x10')===typeof _0x441121&&!_['isEmpty'](_0x441121)){if(!_[_0xab91('0x11')](_0x293193)&&_0xab91('0x10')===typeof _0x293193&&!_[_0xab91('0x12')](_0x293193)){return util[_0xab91('0x13')]('\x22%s\x22\x20<%s>',_0x293193,_0x441121);}return util[_0xab91('0x13')](_0xab91('0x14'),_0x441121,_0x441121);}if(!_[_0xab91('0x11')](_0x29fadc)&&'string'===typeof _0x29fadc&&!_['isEmpty'](_0x29fadc)){return _0x29fadc;}return _0xab91('0x15');};exports[_0xab91('0x16')]=function(_0x2f9bc4){if(_[_0xab91('0x17')](_0x2f9bc4)){return![];}return _0x2f9bc4;};exports[_0xab91('0x18')]=function(_0x62aa5f,_0x65a718,_0x26627c,_0x3ed266,_0x32f85e,_0x53c3ea){var _0x25f2d3={'XMD-QUEUE':_0x65a718[_0xab91('0x19')]?_0x65a718[_0xab91('0x19')]['name']:'','XMD-CALLERID':_0x3ed266,'XMD-CALLERID-PREVIEW':_0x53c3ea?util['format'](_0xab91('0x14'),_0x53c3ea[_0xab91('0x1a')],_0x53c3ea[_0xab91('0x1b')]):_0x3ed266,'XMD-DIALID':_0x32f85e,'XMD-CONTACTID':_0x65a718['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3ed266,'XMD-VOICEQUEUEID':_0x65a718[_0xab91('0x1c')],'XMD-DIALCHANNEL':_0x26627c,'XMD-DIALTIMEOUT':_0x62aa5f['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xab91('0x13')]('\x22rtTxX%s%s\x22',_0x62aa5f['dialQueueProject2']?'g':'',_[_0xab91('0x12')](_0x62aa5f[_0xab91('0x1d')])?'':_0xab91('0x1e')),'XMD-DIALURL':_0x62aa5f[_0xab91('0x1f')]||'','XMD-AGI':_0x62aa5f[_0xab91('0x20')]?util[_0xab91('0x13')](_0xab91('0x21'),ipAgi,_0x62aa5f[_0xab91('0x20')]):'NONE','XMD-AGIAFTER':_0x62aa5f[_0xab91('0x22')]?util[_0xab91('0x13')](_0xab91('0x21'),ipAgi,_0x62aa5f[_0xab91('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x53c3ea?_0x53c3ea[_0xab91('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x53c3ea?_0x53c3ea[_0xab91('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x62aa5f[_0xab91('0x1d')])){_0x25f2d3[util[_0xab91('0x13')]('%s',_0xab91('0x25'))]=_0x62aa5f[_0xab91('0x1d')];_0x25f2d3[util[_0xab91('0x13')]('%s',_0xab91('0x26'))]=_0x32f85e;}if(_0x65a718&&_0x65a718[_0xab91('0x27')]){for(var _0x2e022d in _0x65a718[_0xab91('0x27')]){if(_0x65a718[_0xab91('0x27')][_0xab91('0x28')](_0x2e022d)){if(!_['isNil'](_0x65a718[_0xab91('0x27')][_0x2e022d])&&_0x2e022d!=='id'&&_0x2e022d!==_0xab91('0x29')&&_0x2e022d!=='createdAt'&&_0x2e022d!==_0xab91('0x2a')){_0x25f2d3[util[_0xab91('0x13')](_0xab91('0x2b'),'XMD-',_[_0xab91('0x2c')](_0x2e022d))]=_0x65a718['Contact'][_0x2e022d];}}}}return _0x25f2d3;};exports[_0xab91('0x2d')]=function(_0x349fd7){var _0x4a254a={};for(var _0x189983 in _0x349fd7){if(_0x349fd7[_0xab91('0x28')](_0x189983)){_0x4a254a[util['format']('%s',_[_0xab91('0x2e')](_0x189983))]=_0x349fd7[_0x189983];}}return{'variables':_0x4a254a};};exports[_0xab91('0x2f')]=function(_0x396308,_0x55f76f){if(!_[_0xab91('0x17')](_0x396308)){if(_0x396308[_0xab91('0x28')]('originated')){if(_0x396308[_0xab91('0x30')]>0x0){_0x396308[_0xab91('0x30')]-=0x1;}else{logger[_0xab91('0x9')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x55f76f);}}}else{logger['error'](_0xab91('0x31'),_0x55f76f);}};exports['logBlacklist']=function(_0x52b63b){var _0x45cf62=moment()[_0xab91('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x52b63b[_0xab91('0x32')]=0xd;_0x52b63b[_0xab91('0x33')]=_0xab91('0x34');_0x52b63b[_0xab91('0x35')]=_0x45cf62;_0x52b63b[_0xab91('0x36')]=_0x45cf62;_0x52b63b[_0xab91('0x37')]=_0x45cf62;};exports['logAgent']=function(_0x299f10,_0x219ffa,_0x3d1618){var _0x238cfd=moment()[_0xab91('0x13')](_0xab91('0x38'));_0x299f10[_0xab91('0x32')]=_0x219ffa;_0x299f10['statedesc']=_0x3d1618;_0x299f10['responsetime']=_0x238cfd;_0x299f10[_0xab91('0x39')]=getSeconds(_0x299f10[_0xab91('0x36')],_0x299f10['starttime']);};exports['logLookAgent']=function(_0x1d6dba,_0x4e32cf,_0x21fb65){_0x1d6dba['membername']=_0x4e32cf;_0x1d6dba[_0xab91('0x3a')]=_0x21fb65;};exports[_0xab91('0x3b')]=function(_0x591192,_0x55eff4,_0xc555f0){var _0x43793e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x591192['state']=_0x55eff4;_0x591192[_0xab91('0x33')]=_0xc555f0;_0x591192[_0xab91('0x36')]=_0x591192[_0xab91('0x36')]?_0x591192['responsetime']:_0x43793e;_0x591192[_0xab91('0x37')]=_0x591192[_0xab91('0x37')]?_0x591192[_0xab91('0x37')]:_0x43793e;_0x591192[_0xab91('0x39')]=getSeconds(_0x591192[_0xab91('0x36')]||0x0,_0x591192[_0xab91('0x35')]||0x0);_0x591192[_0xab91('0x3c')]=_0x591192[_0xab91('0x3d')]?getSeconds(_0x591192[_0xab91('0x37')],_0x591192[_0xab91('0x3d')]):0x0;};exports[_0xab91('0x3e')]=function(_0x4f255d){return _0x4f255d===_0xab91('0x3f');};exports[_0xab91('0x40')]=function(_0x1131f0,_0x2cac2c,_0x412191,_0xde2c8e,_0x39cc28){var _0x2d9149=_0xde2c8e?_0xab91('0x41'):_0x1131f0[_0xab91('0x1a')];_0x2d9149=_0x39cc28?_0xab91('0x42'):_0x2d9149;return{'actionid':_0x1131f0[_0xab91('0x43')],'action':_0xab91('0x44'),'channel':_0x1131f0['channelAgent'],'callerid':util[_0xab91('0x13')]('\x22%s\x22\x20<%s>',_0x2d9149,_0x1131f0['calleridnum']),'Exten':_0xab91('0x45'),'Context':'from-sip','Priority':'1','variable':_0x412191,'timeout':(_0x2cac2c[_0xab91('0x46')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1131f0[_0xab91('0x43')]};};exports[_0xab91('0x47')]=function(_0x375d18){return _0x375d18[_0xab91('0x48')]+_0x375d18[_0xab91('0x49')]+_0x375d18['countnoanswerretry']+_0x375d18[_0xab91('0x4a')]+_0x375d18[_0xab91('0x4b')];};exports['cloneAction']=function(_0x3bb98e){var _0x160db6=_[_0xab91('0x4c')](_0x3bb98e);_0x160db6[_0xab91('0x32')]=0xf;_0x160db6[_0xab91('0x33')]=_0xab91('0x4d');return _0x160db6;};exports['scheduledAt']=function(_0x5648ad,_0xb02842,_0x2f0619){var _0x540a72={};_0x540a72[_0xb02842]=_0x5648ad[_0xb02842];_0x540a72[_0xab91('0x4e')]=![];_0x540a72['scheduledat']=moment()[_0xab91('0x4f')](_0x2f0619,'minutes')[_0xab91('0x13')](_0xab91('0x38'));_0x540a72[_0xab91('0x50')]=_0x5648ad[_0xab91('0x50')];_0x540a72[_0xab91('0x51')]=_0x5648ad[_0xab91('0x51')];_0x540a72[_0xab91('0x1c')]=_0x5648ad[_0xab91('0x1c')]||undefined;return _0x540a72;};exports['decrementTalkink']=function(_0x4368f5,_0x3cf058){if(!_[_0xab91('0x17')](_0x4368f5)){if(_0x4368f5['pTalking']>0x0){_0x4368f5[_0xab91('0x52')]-=0x1;}else{logger[_0xab91('0x9')](_0x3cf058,_0xab91('0x53'));}}else{logger[_0xab91('0x9')](_0x3cf058,_0xab91('0x54'));}};exports['IsNotLoggedIn']=function(_0x5cc715){if(_0x5cc715<=0x0){return!![];}return![];};exports[_0xab91('0x55')]=function(_0x22e0b1,_0x513ac3){_0x22e0b1[_0xab91('0x56')]=_0x513ac3;_0x22e0b1[_0xab91('0x57')]=_0x22e0b1[_0xab91('0x58')];_0x22e0b1[_0xab91('0x59')]=_0x22e0b1[_0xab91('0x5a')];return _0x22e0b1;};exports[_0xab91('0x5b')]=function(_0x5e3cd3){var _0x128934={};_0x128934[_0xab91('0x58')]=_0x5e3cd3[_0xab91('0x58')];_0x128934[_0xab91('0x59')]=_0x5e3cd3[_0xab91('0x5a')];_0x128934[_0xab91('0x43')]=_0x5e3cd3[_0xab91('0x43')];return _0x128934;};exports[_0xab91('0x5c')]=function(_0x14eb86){var _0x1d4661=[];for(var _0x52e3c9 in _0x14eb86){if(_0x14eb86['hasOwnProperty'](_0x52e3c9)){if(!_[_0xab91('0x17')](_0x14eb86[_0x52e3c9])&&_0x14eb86[_0x52e3c9][_0xab91('0x32')]==='not_inuse'&&_0x14eb86[_0x52e3c9][_0xab91('0x5d')]===_0xab91('0x5e')){_0x1d4661['push'](_0x14eb86[_0x52e3c9]['id']);}}}return _0x1d4661;};exports[_0xab91('0x5f')]=function(_0x58ca2f){var _0x5591f0=moment()[_0xab91('0x6')](0x0);var _0x3fb19c=moment(_0x58ca2f)['milliseconds'](0x0);return _0x5591f0['diff'](_0x3fb19c,_0xab91('0x7'));};exports[_0xab91('0x60')]=function(_0x159daf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x159daf['ContactId'],'ListId':_0x159daf[_0xab91('0x51')],'VoiceQueueId':_0x159daf[_0xab91('0x1c')]||undefined,'CampaignId':_0x159daf[_0xab91('0x61')]||undefined};};exports[_0xab91('0x62')]=function(_0x3b0276){if(_0x3b0276===_0xab91('0x43')||_0x3b0276==='idContact'||_0x3b0276===_0xab91('0x58')||_0x3b0276==='type'||_0x3b0276===_0xab91('0x63')||_0x3b0276===_0xab91('0x64')||_0x3b0276===_0xab91('0x65')||_0x3b0276===_0xab91('0x5a')||_0x3b0276===_0xab91('0x1a')||_0x3b0276===_0xab91('0x4e')||_0x3b0276===_0xab91('0x1b')||_0x3b0276==='scheduledat'||_0x3b0276===_0xab91('0x48')||_0x3b0276==='countcongestionretry'||_0x3b0276===_0xab91('0x66')||_0x3b0276===_0xab91('0x67')||_0x3b0276===_0xab91('0x68')||_0x3b0276==='callbackuniqueid'||_0x3b0276==='callbackat'||_0x3b0276===_0xab91('0x69')||_0x3b0276===_0xab91('0x50')||_0x3b0276===_0xab91('0x51')||_0x3b0276===_0xab91('0x3a')||_0x3b0276==='VoiceQueueId'||_0x3b0276===_0xab91('0x6a')||_0x3b0276==='xmd-voicequeueid'||_0x3b0276===_0xab91('0x6b')||_0x3b0276===_0xab91('0x6c')||_0x3b0276==='xmd-listid'||_0x3b0276===_0xab91('0x6d')||_0x3b0276===_0xab91('0x6e')||_0x3b0276===_0xab91('0x6f')||_0x3b0276===_0xab91('0x70')||_0x3b0276===_0xab91('0x71')||_0x3b0276===_0xab91('0x72')||_0x3b0276===_0xab91('0x73')||_0x3b0276===_0xab91('0x74')||_0x3b0276===_0xab91('0x75')||_0x3b0276===_0xab91('0x76')||_0x3b0276===_0xab91('0x77')||_0x3b0276==='rtpaudioqosbridged'||_0x3b0276===_0xab91('0x78')||_0x3b0276===_0xab91('0x79')||_0x3b0276===_0xab91('0x7a')||_0x3b0276===_0xab91('0x7b')||_0x3b0276===_0xab91('0x7c')||_0x3b0276===_0xab91('0x7d')||_0x3b0276===_0xab91('0x77')||_0x3b0276==='rtpaudioqosbridged'||_0x3b0276===_0xab91('0x78')||_0x3b0276===_0xab91('0x79')||_0x3b0276===_0xab91('0x7a')||_0x3b0276==='rtpaudioqoslossbridged'||_0x3b0276===_0xab91('0x7c')||_0x3b0276===_0xab91('0x7d')||_0x3b0276===_0xab91('0x7e')||_0x3b0276===_0xab91('0x7f')||_0x3b0276===_0xab91('0x32')||_0x3b0276===_0xab91('0x33')){return![];}return!![];};exports[_0xab91('0x80')]=function(_0x4c4c9e,_0x164bdd){var _0x4ed860,_0x12c23e,_0x489e99;if(_0x164bdd<=0x0){_0x164bdd=0x1;}_0x4ed860=new RegExp(_0xab91('0x81')+_0x164bdd+'}$');_0x12c23e=Math['pow'](0xa,_0x164bdd-0x1);_0x489e99=Math[_0xab91('0x82')](0xa,_0x164bdd)-0x1;return util[_0xab91('0x13')]('%s',_[_0xab91('0x83')](_0x4c4c9e,_0x4ed860,_['random'](_0x12c23e,_0x489e99)));};exports['extractCalleridName']=function(_0x295aaa){var _0x29c565=_0x295aaa[_0xab91('0x84')](/"(.*?)"/);return _0x29c565?_0x29c565[0x1]:_0x295aaa;};exports[_0xab91('0x85')]=function(_0x3464e2){var _0x102698=_0x3464e2['match'](/<(.*?)>/);return _0x102698?_0x102698[0x1]:_0x3464e2;}; \ No newline at end of file +var _0x14a0=['getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger2','info','message','getCallerId','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','interface','buildAcw','queue','status','reachable','push','getDiff','diff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','calleridnum','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid'];(function(_0x31dfde,_0x43e522){var _0x338792=function(_0x2f726b){while(--_0x2f726b){_0x31dfde['push'](_0x31dfde['shift']());}};_0x338792(++_0x43e522);}(_0x14a0,0x8e));var _0x014a=function(_0x1ca169,_0x49b9f7){_0x1ca169=_0x1ca169-0x0;var _0x2794dc=_0x14a0[_0x1ca169];return _0x2794dc;};'use strict';var util=require('util');var _=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var logger=require(_0x014a('0x2'))(_0x014a('0x3'));var ipAgi=process[_0x014a('0x4')][_0x014a('0x5')]||_0x014a('0x6');function getSeconds(_0x521a59,_0x57a522){var _0x1730a5=moment(_0x521a59)[_0x014a('0x7')](0x0);var _0x38a22c=moment(_0x57a522)['milliseconds'](0x0);return _0x1730a5['diff'](_0x38a22c,_0x014a('0x8'));}exports[_0x014a('0x9')]=function(_0x22f17c){return function(_0x4d943b){logger['error'](_0x22f17c,util[_0x014a('0xa')](_0x4d943b,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x490ea2,_0x5aa52f){logger['info'](_0x490ea2,util[_0x014a('0xa')](_0x5aa52f,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x431be8,_0x168c70){logger['error'](_0x431be8,util[_0x014a('0xa')](_0x168c70,{'showHidden':![],'depth':null}));};exports[_0x014a('0xb')]=function(_0x2c84ad){return function(_0x43bfeb){logger[_0x014a('0xc')](_0x2c84ad,util[_0x014a('0xa')](_0x43bfeb,{'showHidden':![],'depth':null}));};};exports[_0x014a('0xd')]=function(_0x23c917,_0x1e5366,_0x71535d){return{'message':_0x23c917,'unlock':_0x1e5366,'active':_0x71535d};};exports[_0x014a('0xe')]=function(_0x3c54c8,_0x4fe87c,_0x130d13){if(!_[_0x014a('0xf')](_0x130d13)&&'string'===typeof _0x130d13&&!_[_0x014a('0x10')](_0x130d13)){if(!_[_0x014a('0xf')](_0x4fe87c)&&'string'===typeof _0x4fe87c&&!_[_0x014a('0x10')](_0x4fe87c)){return util[_0x014a('0x11')](_0x014a('0x12'),_0x4fe87c,_0x130d13);}return util[_0x014a('0x11')](_0x014a('0x12'),_0x130d13,_0x130d13);}if(!_[_0x014a('0xf')](_0x3c54c8)&&_0x014a('0x13')===typeof _0x3c54c8&&!_[_0x014a('0x10')](_0x3c54c8)){return _0x3c54c8;}return _0x014a('0x14');};exports[_0x014a('0x15')]=function(_0x281224){if(_[_0x014a('0x16')](_0x281224)){return![];}return _0x281224;};exports[_0x014a('0x17')]=function(_0x34e5c3,_0x5c69c5,_0x359903,_0x109a9c,_0x11065f,_0x1897c7){var _0xc9a563={'XMD-QUEUE':_0x5c69c5[_0x014a('0x18')]?_0x5c69c5[_0x014a('0x18')][_0x014a('0x19')]:'','XMD-CALLERID':_0x109a9c,'XMD-CALLERID-PREVIEW':_0x1897c7?util[_0x014a('0x11')]('\x22%s\x22\x20<%s>',_0x1897c7[_0x014a('0x1a')],_0x1897c7['calleridnum']):_0x109a9c,'XMD-DIALID':_0x11065f,'XMD-CONTACTID':_0x5c69c5[_0x014a('0x1b')],'XMD-CDRTYPE':_0x014a('0x1c'),'CALLERID(all)':_0x109a9c,'XMD-VOICEQUEUEID':_0x5c69c5[_0x014a('0x1d')],'XMD-DIALCHANNEL':_0x359903,'XMD-DIALTIMEOUT':_0x34e5c3[_0x014a('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x014a('0x11')](_0x014a('0x1f'),_0x34e5c3[_0x014a('0x20')]?'g':'',_[_0x014a('0x10')](_0x34e5c3[_0x014a('0x21')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x34e5c3[_0x014a('0x22')]||'','XMD-AGI':_0x34e5c3['dialQueueProject']?util[_0x014a('0x11')](_0x014a('0x23'),ipAgi,_0x34e5c3['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x34e5c3[_0x014a('0x20')]?util[_0x014a('0x11')](_0x014a('0x23'),ipAgi,_0x34e5c3['dialQueueProject2']):_0x014a('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x1897c7?_0x1897c7[_0x014a('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x1897c7?_0x1897c7['originatecalleridname']:'','XMD-DESTINATION':_0x014a('0x26')};if(!_[_0x014a('0x10')](_0x34e5c3['monitor_format'])){_0xc9a563[util['format']('%s',_0x014a('0x27'))]=_0x34e5c3[_0x014a('0x21')];_0xc9a563[util[_0x014a('0x11')]('%s',_0x014a('0x28'))]=_0x11065f;}if(_0x5c69c5&&_0x5c69c5['Contact']){for(var _0x434038 in _0x5c69c5[_0x014a('0x29')]){if(_0x5c69c5[_0x014a('0x29')][_0x014a('0x2a')](_0x434038)){if(!_[_0x014a('0x16')](_0x5c69c5[_0x014a('0x29')][_0x434038])&&_0x434038!=='id'&&_0x434038!==_0x014a('0x2b')&&_0x434038!==_0x014a('0x2c')&&_0x434038!==_0x014a('0x2d')){_0xc9a563[util[_0x014a('0x11')](_0x014a('0x2e'),'XMD-',_[_0x014a('0x2f')](_0x434038))]=_0x5c69c5[_0x014a('0x29')][_0x434038];}}}}return _0xc9a563;};exports[_0x014a('0x30')]=function(_0x457883){var _0x5f1022={};for(var _0x39b3b8 in _0x457883){if(_0x457883[_0x014a('0x2a')](_0x39b3b8)){_0x5f1022[util['format']('%s',_[_0x014a('0x31')](_0x39b3b8))]=_0x457883[_0x39b3b8];}}return{'variables':_0x5f1022};};exports[_0x014a('0x32')]=function(_0x5610cb,_0x415f83){if(!_[_0x014a('0x16')](_0x5610cb)){if(_0x5610cb[_0x014a('0x2a')](_0x014a('0x33'))){if(_0x5610cb[_0x014a('0x33')]>0x0){_0x5610cb[_0x014a('0x33')]-=0x1;}else{logger[_0x014a('0x34')](_0x014a('0x35'),_0x415f83);}}}else{logger['error'](_0x014a('0x36'),_0x415f83);}};exports[_0x014a('0x37')]=function(_0x29f600){var _0x1f31c8=moment()['format'](_0x014a('0x38'));_0x29f600[_0x014a('0x39')]=0xd;_0x29f600[_0x014a('0x3a')]=_0x014a('0x3b');_0x29f600[_0x014a('0x3c')]=_0x1f31c8;_0x29f600[_0x014a('0x3d')]=_0x1f31c8;_0x29f600[_0x014a('0x3e')]=_0x1f31c8;};exports[_0x014a('0x3f')]=function(_0x1ec350,_0x5f2f66,_0x1b34f8){var _0x585962=moment()[_0x014a('0x11')](_0x014a('0x38'));_0x1ec350[_0x014a('0x39')]=_0x5f2f66;_0x1ec350[_0x014a('0x3a')]=_0x1b34f8;_0x1ec350[_0x014a('0x3d')]=_0x585962;_0x1ec350['ringtime']=getSeconds(_0x1ec350[_0x014a('0x3d')],_0x1ec350[_0x014a('0x3c')]);};exports['logLookAgent']=function(_0x9227b8,_0x2990df,_0x3e5ecf){_0x9227b8[_0x014a('0x40')]=_0x2990df;_0x9227b8[_0x014a('0x41')]=_0x3e5ecf;};exports[_0x014a('0x42')]=function(_0x17b1b6,_0x764fbe,_0x2beddc){var _0x537bde=moment()[_0x014a('0x11')](_0x014a('0x38'));_0x17b1b6[_0x014a('0x39')]=_0x764fbe;_0x17b1b6[_0x014a('0x3a')]=_0x2beddc;_0x17b1b6['responsetime']=_0x17b1b6[_0x014a('0x3d')]?_0x17b1b6[_0x014a('0x3d')]:_0x537bde;_0x17b1b6[_0x014a('0x3e')]=_0x17b1b6[_0x014a('0x3e')]?_0x17b1b6[_0x014a('0x3e')]:_0x537bde;_0x17b1b6[_0x014a('0x43')]=getSeconds(_0x17b1b6['responsetime']||0x0,_0x17b1b6[_0x014a('0x3c')]||0x0);_0x17b1b6[_0x014a('0x44')]=_0x17b1b6['answertime']?getSeconds(_0x17b1b6[_0x014a('0x3e')],_0x17b1b6[_0x014a('0x45')]):0x0;};exports[_0x014a('0x46')]=function(_0x5dc092){return _0x5dc092===_0x014a('0x47');};exports['variablesAction']=function(_0x5ab5e8,_0x67b30f,_0x29c9ca,_0x5aa496,_0x1557ad){var _0x11c0d5=_0x5aa496?_0x014a('0x48'):_0x5ab5e8[_0x014a('0x1a')];_0x11c0d5=_0x1557ad?_0x014a('0x49'):_0x11c0d5;return{'actionid':_0x5ab5e8[_0x014a('0x4a')],'action':'originate','channel':_0x5ab5e8[_0x014a('0x4b')],'callerid':util[_0x014a('0x11')](_0x014a('0x12'),_0x11c0d5,_0x5ab5e8['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x014a('0x4c'),'Priority':'1','variable':_0x29c9ca,'timeout':(_0x67b30f['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5ab5e8['uniqueid']};};exports[_0x014a('0x4d')]=function(_0x47aaac){return _0x47aaac[_0x014a('0x4e')]+_0x47aaac[_0x014a('0x4f')]+_0x47aaac[_0x014a('0x50')]+_0x47aaac['countagentrejectretry']+_0x47aaac[_0x014a('0x51')];};exports[_0x014a('0x52')]=function(_0x12cd9b){var _0x42d91d=_[_0x014a('0x53')](_0x12cd9b);_0x42d91d[_0x014a('0x39')]=0xf;_0x42d91d['statedesc']=_0x014a('0x54');return _0x42d91d;};exports[_0x014a('0x55')]=function(_0x5a861c,_0x1a4df9,_0x29345b){var _0x20bb0c={};_0x20bb0c[_0x1a4df9]=_0x5a861c[_0x1a4df9];_0x20bb0c[_0x014a('0x56')]=![];_0x20bb0c[_0x014a('0x57')]=moment()[_0x014a('0x58')](_0x29345b,_0x014a('0x59'))[_0x014a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x20bb0c[_0x014a('0x1b')]=_0x5a861c[_0x014a('0x1b')];_0x20bb0c[_0x014a('0x5a')]=_0x5a861c[_0x014a('0x5a')];_0x20bb0c[_0x014a('0x1d')]=_0x5a861c['VoiceQueueId']||undefined;return _0x20bb0c;};exports[_0x014a('0x5b')]=function(_0x5bee56,_0x2da804){if(!_[_0x014a('0x16')](_0x5bee56)){if(_0x5bee56[_0x014a('0x5c')]>0x0){_0x5bee56[_0x014a('0x5c')]-=0x1;}else{logger[_0x014a('0x34')](_0x2da804,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x2da804,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1c11d0){if(_0x1c11d0<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1fe253,_0x5b5318){_0x1fe253['lastevent']=_0x5b5318;_0x1fe253[_0x014a('0x19')]=_0x1fe253['queue'];_0x1fe253[_0x014a('0x5d')]=_0x1fe253[_0x014a('0x4b')];return _0x1fe253;};exports[_0x014a('0x5e')]=function(_0x3c7e06){var _0x21b16c={};_0x21b16c[_0x014a('0x5f')]=_0x3c7e06[_0x014a('0x5f')];_0x21b16c[_0x014a('0x5d')]=_0x3c7e06[_0x014a('0x4b')];_0x21b16c[_0x014a('0x4a')]=_0x3c7e06['uniqueid'];return _0x21b16c;};exports['agentReadyId']=function(_0x1c9f8c){var _0x46d92e=[];for(var _0x237345 in _0x1c9f8c){if(_0x1c9f8c['hasOwnProperty'](_0x237345)){if(!_['isNil'](_0x1c9f8c[_0x237345])&&_0x1c9f8c[_0x237345][_0x014a('0x39')]==='not_inuse'&&_0x1c9f8c[_0x237345][_0x014a('0x60')]===_0x014a('0x61')){_0x46d92e[_0x014a('0x62')](_0x1c9f8c[_0x237345]['id']);}}}return _0x46d92e;};exports[_0x014a('0x63')]=function(_0x53e631){var _0x861fb5=moment()[_0x014a('0x7')](0x0);var _0x3d1c9d=moment(_0x53e631)['milliseconds'](0x0);return _0x861fb5[_0x014a('0x64')](_0x3d1c9d,'seconds');};exports[_0x014a('0x65')]=function(_0x47074f){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x47074f[_0x014a('0x1b')],'ListId':_0x47074f[_0x014a('0x5a')],'VoiceQueueId':_0x47074f[_0x014a('0x1d')]||undefined,'CampaignId':_0x47074f[_0x014a('0x66')]||undefined};};exports['filterKey']=function(_0x889080){if(_0x889080===_0x014a('0x4a')||_0x889080===_0x014a('0x67')||_0x889080==='queue'||_0x889080===_0x014a('0x68')||_0x889080===_0x014a('0x69')||_0x889080===_0x014a('0x6a')||_0x889080===_0x014a('0x40')||_0x889080===_0x014a('0x4b')||_0x889080==='calleridname'||_0x889080===_0x014a('0x56')||_0x889080===_0x014a('0x6b')||_0x889080===_0x014a('0x57')||_0x889080===_0x014a('0x4e')||_0x889080===_0x014a('0x4f')||_0x889080===_0x014a('0x50')||_0x889080===_0x014a('0x6c')||_0x889080===_0x014a('0x6d')||_0x889080===_0x014a('0x6e')||_0x889080===_0x014a('0x6f')||_0x889080===_0x014a('0x70')||_0x889080===_0x014a('0x1b')||_0x889080==='ListId'||_0x889080===_0x014a('0x41')||_0x889080==='VoiceQueueId'||_0x889080==='sipcallid'||_0x889080==='xmd-voicequeueid'||_0x889080==='xmd-queue'||_0x889080==='xmd-phone'||_0x889080===_0x014a('0x71')||_0x889080===_0x014a('0x72')||_0x889080===_0x014a('0x73')||_0x889080==='xmd-dialoptions'||_0x889080===_0x014a('0x74')||_0x889080===_0x014a('0x75')||_0x889080===_0x014a('0x76')||_0x889080===_0x014a('0x77')||_0x889080==='xmd-callerid'||_0x889080==='xmd-agiafter'||_0x889080===_0x014a('0x78')||_0x889080===_0x014a('0x79')||_0x889080===_0x014a('0x7a')||_0x889080===_0x014a('0x7b')||_0x889080===_0x014a('0x7c')||_0x889080===_0x014a('0x7d')||_0x889080===_0x014a('0x7e')||_0x889080===_0x014a('0x7f')||_0x889080===_0x014a('0x80')||_0x889080===_0x014a('0x79')||_0x889080===_0x014a('0x7a')||_0x889080==='rtpaudioqosjitter'||_0x889080===_0x014a('0x7c')||_0x889080===_0x014a('0x7d')||_0x889080==='rtpaudioqoslossbridged'||_0x889080===_0x014a('0x7f')||_0x889080===_0x014a('0x80')||_0x889080==='bridgepeer'||_0x889080===_0x014a('0x81')||_0x889080==='state'||_0x889080===_0x014a('0x3a')){return![];}return!![];};exports[_0x014a('0x82')]=function(_0xcdcbbb,_0x456d69){var _0x37b8f,_0x5e0f22,_0x2cd82e;if(_0x456d69<=0x0){_0x456d69=0x1;}_0x37b8f=new RegExp(_0x014a('0x83')+_0x456d69+'}$');_0x5e0f22=Math[_0x014a('0x84')](0xa,_0x456d69-0x1);_0x2cd82e=Math[_0x014a('0x84')](0xa,_0x456d69)-0x1;return util[_0x014a('0x11')]('%s',_['replace'](_0xcdcbbb,_0x37b8f,_[_0x014a('0x85')](_0x5e0f22,_0x2cd82e)));};exports[_0x014a('0x86')]=function(_0x3c796f){var _0x5f3224=_0x3c796f[_0x014a('0x87')](/"(.*?)"/);return _0x5f3224?_0x5f3224[0x1]:_0x3c796f;};exports['extractCalleridNumber']=function(_0x39e06e){var _0x1caefa=_0x39e06e[_0x014a('0x87')](/<(.*?)>/);return _0x1caefa?_0x1caefa[0x1]:_0x39e06e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 727a5a4..e82b153 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(_0xd3c726,_0x47157b){var _0x1fa1cf=function(_0x4117cd){while(--_0x4117cd){_0xd3c726['push'](_0xd3c726['shift']());}};_0x1fa1cf(++_0x47157b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x173aa1,_0x5082b4){_0x173aa1=_0x173aa1-0x0;var _0x38a254=_0x5f2f[_0x173aa1];return _0x38a254;};'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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x1d6f08,_0x412d3b){var _0x4db54f=function(_0x5241b4){while(--_0x5241b4){_0x1d6f08['push'](_0x1d6f08['shift']());}};_0x4db54f(++_0x412d3b);}(_0x7a54,0x106));var _0x47a5=function(_0x5d3198,_0x25992d){_0x5d3198=_0x5d3198-0x0;var _0x20d6a1=_0x7a54[_0x5d3198];return _0x20d6a1;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('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 6e99785..9b6eeba 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 _0x5d6f=['initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','disposition','ANSWERED','duration','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumHoldTime','sumDuration','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','agents','length','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initFreshsalesAccounts'];(function(_0x84ada4,_0x4b6de9){var _0x136066=function(_0x2656ce){while(--_0x2656ce){_0x84ada4['push'](_0x84ada4['shift']());}};_0x136066(++_0x4b6de9);}(_0x5d6f,0x1c4));var _0xf5d6=function(_0x4fabd8,_0x3be1df){_0x4fabd8=_0x4fabd8-0x0;var _0x245b41=_0x5d6f[_0x4fabd8];return _0x245b41;};'use strict';var BPromise=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var _=require(_0xf5d6('0x2'));var moment=require(_0xf5d6('0x3'));var Agent=require(_0xf5d6('0x4'));var Telephone=require(_0xf5d6('0x5'));var Trunk=require(_0xf5d6('0x6'));var VoiceQueue=require(_0xf5d6('0x7'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0xf5d6('0x8'));var VoiceExtension=require(_0xf5d6('0x9'));var ZendeskAccount=require(_0xf5d6('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xf5d6('0xb'));var SugarcrmAccount=require(_0xf5d6('0xc'));var ZohoAccount=require(_0xf5d6('0xd'));var DeskAccount=require(_0xf5d6('0xe'));var VtigerAccount=require(_0xf5d6('0xf'));var ServicenowAccount=require(_0xf5d6('0x10'));var Dynamics365Account=require(_0xf5d6('0x11'));var FreshsalesAccount=require(_0xf5d6('0x12'));var FaxAccount=require(_0xf5d6('0x13'));var Realtime=function(){this['agents']={};this[_0xf5d6('0x14')]={};this[_0xf5d6('0x15')]={};this[_0xf5d6('0x16')]={};this['triggers']={};this[_0xf5d6('0x17')]={};this[_0xf5d6('0x18')]={};this[_0xf5d6('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xf5d6('0x1a')]={};this[_0xf5d6('0x1b')]={};this[_0xf5d6('0x1c')]={};this[_0xf5d6('0x1d')]={};this[_0xf5d6('0x1e')]={};this[_0xf5d6('0x1f')]={};this['salesforceAccounts']={};this[_0xf5d6('0x20')]={};this[_0xf5d6('0x21')]={};this['zohoAccounts']={};this[_0xf5d6('0x22')]={};this['vtigerAccounts']={};this[_0xf5d6('0x23')]={};this[_0xf5d6('0x24')]={};this[_0xf5d6('0x25')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2d670d,_0x434f0a,_0x111f79){var _0x309ca9=_[_0xf5d6('0x26')](_0x2d670d,function(_0x49f3eb,_0x27f40a){return _0x49f3eb[_0x111f79];});for(var _0x22f6c0 in _0x434f0a){if(_0x434f0a[_0xf5d6('0x27')](_0x22f6c0)){if(!_0x309ca9[_0x22f6c0]){delete _0x434f0a[_0x22f6c0];}}}}function freeIsNotKeySip(_0x755664,_0xa69206){var _0x4fd1ac=_[_0xf5d6('0x26')](_0x755664,function(_0x517105,_0x13dc3e){return util['format'](_0xf5d6('0x28'),_0x517105[_0xf5d6('0x29')]);});for(var _0x13ffe1 in _0xa69206){if(_0xa69206[_0xf5d6('0x27')](_0x13ffe1)){if(!_0x4fd1ac[_0x13ffe1]){delete _0xa69206[_0x13ffe1];}}}}function freeIsNotKeyAgent(_0x1f9da3,_0x40e6df){var _0x2a4656=_[_0xf5d6('0x26')](_0x1f9da3,function(_0x5da7ee,_0x7f660d){var _0x43e7fd=_[_0xf5d6('0x2a')](_0x5da7ee[_0xf5d6('0x2b')])?util[_0xf5d6('0x2c')]('SIP/%s',_0x5da7ee[_0xf5d6('0x29')]):_0x5da7ee[_0xf5d6('0x2b')];return _0x43e7fd;});for(var _0x3624e1 in _0x40e6df){if(_0x40e6df[_0xf5d6('0x27')](_0x3624e1)){if(!_0x2a4656[_0x3624e1]){delete _0x40e6df[_0x3624e1];}}}}function clearVoiceCallReports(_0x5bba9f){_0x5bba9f[_0xf5d6('0x2d')]=0x0;_0x5bba9f[_0xf5d6('0x2e')]=0x0;_0x5bba9f['sumHoldTime']=0x0;_0x5bba9f['sumDuration']=0x0;_0x5bba9f['sumBillable']=0x0;}function clearCampaigns(_0xd81818){if(!_[_0xf5d6('0x2f')](_0xd81818)){for(var _0x4b597d in _0xd81818){if(_0xd81818['hasOwnProperty'](_0x4b597d)){_0xd81818[_0x4b597d]['ivrTotalCallsDays']=0x0;_0xd81818[_0x4b597d][_0xf5d6('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1b0641){if(!_[_0xf5d6('0x2f')](_0x1b0641)){for(var _0x5e9902 in _0x1b0641){if(_0x1b0641[_0xf5d6('0x27')](_0x5e9902)){_0x1b0641[_0x5e9902][_0xf5d6('0x2d')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x2e')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x31')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x32')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x33')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x34')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x35')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x36')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x37')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x38')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x39')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3a')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3b')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3c')]=0x0;_0x1b0641[_0x5e9902]['outboundDropCallsDayCallersExit']=0x0;_0x1b0641[_0x5e9902]['outboundBlacklistCallsDay']=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3d')]=0x0;_0x1b0641[_0x5e9902]['outboundRejectCallsDay']=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3e')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x36')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x3f')]=0x0;_0x1b0641[_0x5e9902][_0xf5d6('0x40')]=!![];}}}}Realtime[_0xf5d6('0x41')][_0xf5d6('0x42')]=function(_0x4bb3d5,_0x5b049c){for(var _0x4bc73d in _0x5b049c){if(_0x4bb3d5[_0xf5d6('0x27')](_0x4bc73d)){_0x4bb3d5[_0x4bc73d]=_0x5b049c[_0x4bc73d];}}};Realtime[_0xf5d6('0x41')]['initAgents']=function(){var _0x3aad1f=this;return function(_0x36b465){if(_0x36b465){freeIsNotKeyAgent(_0x36b465,_0x3aad1f[_0xf5d6('0x43')]);for(var _0x4d422b=0x0,_0x304123={},_0x38403a={};_0x4d422b<_0x36b465[_0xf5d6('0x44')];_0x4d422b+=0x1){_0x304123=_0x36b465[_0x4d422b];var _0x185a3e=_['isNil'](_0x304123[_0xf5d6('0x2b')])?util[_0xf5d6('0x2c')](_0xf5d6('0x28'),_0x304123['name']):_0x304123[_0xf5d6('0x2b')];if(_[_0xf5d6('0x45')](_0x3aad1f['agents'][_0x185a3e])){_0x3aad1f[_0xf5d6('0x43')][_0x185a3e]=new Agent(_0x304123);}else{_0x3aad1f['mergeFromDatabase'](_0x3aad1f[_0xf5d6('0x43')][_0x185a3e],_0x304123);}}}return _0x3aad1f[_0xf5d6('0x43')];};};Realtime[_0xf5d6('0x41')]['initTelephones']=function(){var _0x2c0754=this;return function(_0x46623d){if(_0x46623d){freeIsNotKeySip(_0x46623d,_0x2c0754[_0xf5d6('0x14')]);for(var _0x3c37a4=0x0,_0x41aed6={},_0x12e433={};_0x3c37a4<_0x46623d[_0xf5d6('0x44')];_0x3c37a4+=0x1){_0x41aed6=_0x46623d[_0x3c37a4];if(_[_0xf5d6('0x45')](_0x2c0754[_0xf5d6('0x14')][util[_0xf5d6('0x2c')](_0xf5d6('0x28'),_0x41aed6[_0xf5d6('0x29')])])){_0x2c0754[_0xf5d6('0x14')][util[_0xf5d6('0x2c')]('SIP/%s',_0x41aed6[_0xf5d6('0x29')])]=new Telephone(_0x41aed6);}else{_0x2c0754[_0xf5d6('0x42')](_0x2c0754[_0xf5d6('0x14')][util[_0xf5d6('0x2c')](_0xf5d6('0x28'),_0x41aed6[_0xf5d6('0x29')])],_0x41aed6);}}}return _0x2c0754[_0xf5d6('0x14')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x46')]=function(){var _0x4013c6=this;return function(_0x583873){if(_0x583873){freeIsNotKeySip(_0x583873,_0x4013c6[_0xf5d6('0x15')]);for(var _0x333b14=0x0,_0x34f198={},_0x2dbf88={};_0x333b14<_0x583873[_0xf5d6('0x44')];_0x333b14+=0x1){_0x34f198=_0x583873[_0x333b14];if(_['isUndefined'](_0x4013c6[_0xf5d6('0x15')][util['format'](_0xf5d6('0x28'),_0x34f198[_0xf5d6('0x29')])])){_0x4013c6[_0xf5d6('0x15')][util[_0xf5d6('0x2c')]('SIP/%s',_0x34f198['name'])]=new Trunk(_0x34f198);}else{_0x4013c6[_0xf5d6('0x42')](_0x4013c6['trunks'][util[_0xf5d6('0x2c')](_0xf5d6('0x28'),_0x34f198[_0xf5d6('0x29')])],_0x34f198);}}}return _0x4013c6[_0xf5d6('0x15')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x47')]=function(){var _0x39d9b8=this;return function(_0x3bc49c){if(_0x3bc49c){freeIsNotKey(_0x3bc49c,_0x39d9b8['voiceQueues'],_0xf5d6('0x29'));for(var _0x304dba=0x0,_0x1c9e6d={},_0x4299ae={};_0x304dba<_0x3bc49c[_0xf5d6('0x44')];_0x304dba+=0x1){_0x1c9e6d=_0x3bc49c[_0x304dba];if(_[_0xf5d6('0x45')](_0x39d9b8[_0xf5d6('0x16')][_0x1c9e6d[_0xf5d6('0x29')]])){_0x39d9b8['voiceQueues'][_0x1c9e6d['name']]=new VoiceQueue(_0x1c9e6d);}else{_0x39d9b8['mergeFromDatabase'](_0x39d9b8[_0xf5d6('0x16')][_0x1c9e6d['name']],_0x1c9e6d);}}}return _0x39d9b8['voiceQueues'];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x48')]=function(){var _0x5cefe8=this;return function(_0x1c3d49){if(_0x1c3d49){freeIsNotKey(_0x1c3d49,_0x5cefe8['triggers'],'id');for(var _0x563e20=0x0,_0x326ae2={},_0x581ef7={};_0x563e20<_0x1c3d49[_0xf5d6('0x44')];_0x563e20+=0x1){_0x326ae2=_0x1c3d49[_0x563e20];if(_[_0xf5d6('0x45')](_0x5cefe8[_0xf5d6('0x49')][_0x326ae2['id']])){_0x5cefe8['triggers'][_0x326ae2['id']]=new Trigger(_0x326ae2);}else{_0x5cefe8['mergeFromDatabase'](_0x5cefe8[_0xf5d6('0x49')][_0x326ae2['id']],_0x326ae2);}}}return _0x5cefe8[_0xf5d6('0x49')];};};Realtime[_0xf5d6('0x41')]['initTemplates']=function(){var _0x2d2054=this;return function(_0x12f81c){if(_0x12f81c){freeIsNotKey(_0x12f81c,_0x2d2054[_0xf5d6('0x18')],'id');for(var _0x35765c=0x0,_0x1b9339={},_0x5168d9={};_0x35765c<_0x12f81c['length'];_0x35765c+=0x1){_0x1b9339=_0x12f81c[_0x35765c];if(_[_0xf5d6('0x45')](_0x2d2054[_0xf5d6('0x18')][_0x1b9339['id']])){_0x2d2054[_0xf5d6('0x18')][_0x1b9339['id']]=new Template(_0x1b9339);}else{_0x2d2054[_0xf5d6('0x42')](_0x2d2054[_0xf5d6('0x18')][_0x1b9339['id']],_0x1b9339);}}}return _0x2d2054[_0xf5d6('0x18')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x123fc8=this;return function(_0x693fdf){if(_0x693fdf){freeIsNotKey(_0x693fdf,_0x123fc8['zendeskAccounts'],'id');for(var _0x1cc4af=0x0,_0x48f303={},_0x1d080c={};_0x1cc4af<_0x693fdf[_0xf5d6('0x44')];_0x1cc4af+=0x1){_0x48f303=_0x693fdf[_0x1cc4af];if(_['isUndefined'](_0x123fc8[_0xf5d6('0x1f')][_0x48f303['id']])){_0x123fc8[_0xf5d6('0x1f')][_0x48f303['id']]=new ZendeskAccount(_0x48f303);}else{_0x123fc8['mergeFromDatabase'](_0x123fc8['zendeskAccounts'][_0x48f303['id']],_0x48f303);}}}return _0x123fc8[_0xf5d6('0x1f')];};};Realtime[_0xf5d6('0x41')]['initSalesforceAccounts']=function(){var _0x41bb8b=this;return function(_0x46dcee){if(_0x46dcee){freeIsNotKey(_0x46dcee,_0x41bb8b[_0xf5d6('0x4a')],'id');for(var _0x1fdea2=0x0,_0x559519={},_0x19e228={};_0x1fdea2<_0x46dcee[_0xf5d6('0x44')];_0x1fdea2+=0x1){_0x559519=_0x46dcee[_0x1fdea2];if(_[_0xf5d6('0x45')](_0x41bb8b['salesforceAccounts'][_0x559519['id']])){_0x41bb8b[_0xf5d6('0x4a')][_0x559519['id']]=new SalesforceAccount(_0x559519);}else{_0x41bb8b[_0xf5d6('0x42')](_0x41bb8b[_0xf5d6('0x4a')][_0x559519['id']],_0x559519);}}}return _0x41bb8b[_0xf5d6('0x4a')];};};Realtime['prototype'][_0xf5d6('0x4b')]=function(){var _0x2c5de6=this;return function(_0x2dad13){if(_0x2dad13){freeIsNotKey(_0x2dad13,_0x2c5de6[_0xf5d6('0x21')],'id');for(var _0x2f4278=0x0,_0x3e4f50={},_0x140264={};_0x2f4278<_0x2dad13[_0xf5d6('0x44')];_0x2f4278+=0x1){_0x3e4f50=_0x2dad13[_0x2f4278];if(_[_0xf5d6('0x45')](_0x2c5de6[_0xf5d6('0x21')][_0x3e4f50['id']])){_0x2c5de6[_0xf5d6('0x21')][_0x3e4f50['id']]=new FreshdeskAccount(_0x3e4f50);}else{_0x2c5de6['mergeFromDatabase'](_0x2c5de6[_0xf5d6('0x21')][_0x3e4f50['id']],_0x3e4f50);}}}return _0x2c5de6[_0xf5d6('0x21')];};};Realtime['prototype'][_0xf5d6('0x4c')]=function(){var _0x1412fc=this;return function(_0x176114){if(_0x176114){freeIsNotKey(_0x176114,_0x1412fc['zohoAccounts'],'id');for(var _0x31a21b=0x0,_0x136099={},_0x38338b={};_0x31a21b<_0x176114[_0xf5d6('0x44')];_0x31a21b+=0x1){_0x136099=_0x176114[_0x31a21b];if(_[_0xf5d6('0x45')](_0x1412fc[_0xf5d6('0x4d')][_0x136099['id']])){_0x1412fc[_0xf5d6('0x4d')][_0x136099['id']]=new ZohoAccount(_0x136099);}else{_0x1412fc[_0xf5d6('0x42')](_0x1412fc['zohoAccounts'][_0x136099['id']],_0x136099);}}}return _0x1412fc['zohoAccounts'];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x4e')]=function(){var _0x1401c1=this;return function(_0x2ffb00){if(_0x2ffb00){freeIsNotKey(_0x2ffb00,_0x1401c1[_0xf5d6('0x22')],'id');for(var _0x3c51db=0x0,_0x5c4989={},_0x23d0c9={};_0x3c51db<_0x2ffb00[_0xf5d6('0x44')];_0x3c51db+=0x1){_0x5c4989=_0x2ffb00[_0x3c51db];if(_[_0xf5d6('0x45')](_0x1401c1[_0xf5d6('0x22')][_0x5c4989['id']])){_0x1401c1[_0xf5d6('0x22')][_0x5c4989['id']]=new DeskAccount(_0x5c4989);}else{_0x1401c1[_0xf5d6('0x42')](_0x1401c1[_0xf5d6('0x22')][_0x5c4989['id']],_0x5c4989);}}}return _0x1401c1[_0xf5d6('0x22')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x4f')]=function(){var _0x47d0e2=this;return function(_0x5621ce){if(_0x5621ce){freeIsNotKey(_0x5621ce,_0x47d0e2[_0xf5d6('0x20')],'id');for(var _0x7268d7=0x0,_0xed75dc={},_0x48607a={};_0x7268d7<_0x5621ce[_0xf5d6('0x44')];_0x7268d7+=0x1){_0xed75dc=_0x5621ce[_0x7268d7];if(_[_0xf5d6('0x45')](_0x47d0e2[_0xf5d6('0x20')][_0xed75dc['id']])){_0x47d0e2[_0xf5d6('0x20')][_0xed75dc['id']]=new SugarcrmAccount(_0xed75dc);}else{_0x47d0e2[_0xf5d6('0x42')](_0x47d0e2[_0xf5d6('0x20')][_0xed75dc['id']],_0xed75dc);}}}return _0x47d0e2[_0xf5d6('0x20')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x50')]=function(){var _0x24df6f=this;return function(_0x4f8237){if(_0x4f8237){freeIsNotKey(_0x4f8237,_0x24df6f[_0xf5d6('0x51')],'id');for(var _0x5a0616=0x0,_0x26e382={},_0x2299b5={};_0x5a0616<_0x4f8237[_0xf5d6('0x44')];_0x5a0616+=0x1){_0x26e382=_0x4f8237[_0x5a0616];if(_['isUndefined'](_0x24df6f['vtigerAccounts'][_0x26e382['id']])){_0x24df6f[_0xf5d6('0x51')][_0x26e382['id']]=new VtigerAccount(_0x26e382);}else{_0x24df6f[_0xf5d6('0x42')](_0x24df6f[_0xf5d6('0x51')][_0x26e382['id']],_0x26e382);}}}return _0x24df6f[_0xf5d6('0x51')];};};Realtime[_0xf5d6('0x41')]['initServicenowAccounts']=function(){var _0x2b749e=this;return function(_0x5a66c8){if(_0x5a66c8){freeIsNotKey(_0x5a66c8,_0x2b749e[_0xf5d6('0x23')],'id');for(var _0x4fad4a=0x0,_0x49b7c1={},_0x3ed373={};_0x4fad4a<_0x5a66c8[_0xf5d6('0x44')];_0x4fad4a+=0x1){_0x49b7c1=_0x5a66c8[_0x4fad4a];if(_['isUndefined'](_0x2b749e[_0xf5d6('0x23')][_0x49b7c1['id']])){_0x2b749e['servicenowAccounts'][_0x49b7c1['id']]=new ServicenowAccount(_0x49b7c1);}else{_0x2b749e[_0xf5d6('0x42')](_0x2b749e['servicenowAccounts'][_0x49b7c1['id']],_0x49b7c1);}}}return _0x2b749e[_0xf5d6('0x23')];};};Realtime[_0xf5d6('0x41')]['initDynamics365Accounts']=function(){var _0x1b2888=this;return function(_0x42190b){if(_0x42190b){freeIsNotKey(_0x42190b,_0x1b2888['dynamics365Accounts'],'id');for(var _0x4e0539=0x0,_0x17cc53={},_0x73a40a={};_0x4e0539<_0x42190b['length'];_0x4e0539+=0x1){_0x17cc53=_0x42190b[_0x4e0539];if(_[_0xf5d6('0x45')](_0x1b2888[_0xf5d6('0x24')][_0x17cc53['id']])){_0x1b2888[_0xf5d6('0x24')][_0x17cc53['id']]=new Dynamics365Account(_0x17cc53);}else{_0x1b2888[_0xf5d6('0x42')](_0x1b2888['dynamics365Accounts'][_0x17cc53['id']],_0x17cc53);}}}return _0x1b2888[_0xf5d6('0x24')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x52')]=function(){var _0x393b9=this;return function(_0x294bd3){if(_0x294bd3){freeIsNotKey(_0x294bd3,_0x393b9[_0xf5d6('0x25')],'id');for(var _0x71d0ca=0x0,_0x27d186={},_0x5b2f14={};_0x71d0ca<_0x294bd3[_0xf5d6('0x44')];_0x71d0ca+=0x1){_0x27d186=_0x294bd3[_0x71d0ca];if(_['isUndefined'](_0x393b9[_0xf5d6('0x25')][_0x27d186['id']])){_0x393b9[_0xf5d6('0x25')][_0x27d186['id']]=new FreshsalesAccount(_0x27d186);}else{_0x393b9[_0xf5d6('0x42')](_0x393b9[_0xf5d6('0x25')][_0x27d186['id']],_0x27d186);}}}return _0x393b9[_0xf5d6('0x25')];};};Realtime['prototype'][_0xf5d6('0x53')]=function(){var _0x582f61=this;return function(_0x531d9f){for(var _0x1fc169=0x0;_0x1fc169<_0x531d9f[_0xf5d6('0x44')];_0x1fc169+=0x1){_[_0xf5d6('0x54')](_0x582f61[_0xf5d6('0x16')][_0x531d9f[_0x1fc169]['name']],_0x531d9f[_0x1fc169]);}return _0x582f61[_0xf5d6('0x16')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x55')]=function(){var _0xd4aa2=this;return function(_0x15f710){clearVoiceQueues(_0xd4aa2[_0xf5d6('0x16')]);if(_0x15f710){_0x15f710=_[_0xf5d6('0x56')](_0x15f710,'uniqueid');for(var _0x26f784 in _0x15f710){if(_0x15f710[_0xf5d6('0x27')](_0x26f784)){var _0x1a2536={};for(var _0x12c489=0x0;_0x12c489<_0x15f710[_0x26f784][_0xf5d6('0x44')];_0x12c489+=0x1){var _0xcef4e1=_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x57')];if(_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1]){if(_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x58')]){_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x31')]+=0x1;}if(_0x15f710[_0x26f784][_0x12c489]['queuecallerabandon']){_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x32')]+=0x1;}_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x33')]+=moment(_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x59')])['diff'](moment(_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x5a')]),_0xf5d6('0x5b'))||0x0;if(_0x12c489===_0x15f710[_0x26f784]['length']-0x1){_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x34')]+=moment(_0x15f710[_0x26f784][_0x12c489]['queuecallercompleteAt']||_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x5c')]||_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x5d')])[_0xf5d6('0x5e')](moment(_0x15f710[_0x26f784][_0x12c489]['queuecallerjoinAt']),_0xf5d6('0x5b'))||0x0;_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x2d')]+=0x1;if(_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x5f')]){_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1]['answered']+=0x1;_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x35')]+=moment(_0x15f710[_0x26f784][_0x12c489]['queuecallercompleteAt'])[_0xf5d6('0x5e')](moment(_0x15f710[_0x26f784][_0x12c489][_0xf5d6('0x59')]),_0xf5d6('0x5b'))||0x0;}}else{_0xd4aa2['voiceQueues'][_0xcef4e1][_0xf5d6('0x34')]+=_0xd4aa2[_0xf5d6('0x16')][_0xcef4e1][_0xf5d6('0x33')]||0x0;}}}}}}return _0xd4aa2[_0xf5d6('0x16')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x60')]=function(){var _0x99ed0b=this;return function(_0x1ad1b0){clearVoiceCallReports(_0x99ed0b[_0xf5d6('0x19')]);if(_0x1ad1b0){for(var _0x4ca191=0x0;_0x4ca191<_0x1ad1b0[_0xf5d6('0x44')];_0x4ca191+=0x1){_0x99ed0b[_0xf5d6('0x19')][_0xf5d6('0x2d')]+=0x1;_0x99ed0b[_0xf5d6('0x19')][_0xf5d6('0x34')]+=_0x1ad1b0[_0x4ca191]['duration'];if(_0x1ad1b0[_0x4ca191][_0xf5d6('0x61')]===_0xf5d6('0x62')){_0x99ed0b[_0xf5d6('0x19')][_0xf5d6('0x2e')]+=0x1;_0x99ed0b[_0xf5d6('0x19')][_0xf5d6('0x33')]+=_0x1ad1b0[_0x4ca191][_0xf5d6('0x63')]-_0x1ad1b0[_0x4ca191][_0xf5d6('0x64')]||0x0;_0x99ed0b[_0xf5d6('0x19')][_0xf5d6('0x35')]+=_0x1ad1b0[_0x4ca191][_0xf5d6('0x64')];}}}return _0x99ed0b[_0xf5d6('0x19')];};};Realtime['prototype']['initCampaigns']=function(){var _0x2683a2=this;return function(_0x549a0f){if(_0x549a0f){freeIsNotKey(_0x549a0f,_0x2683a2[_0xf5d6('0x17')],_0xf5d6('0x29'));for(var _0x574b24=0x0,_0x3de268={};_0x574b24<_0x549a0f[_0xf5d6('0x44')];_0x574b24+=0x1){_0x3de268=_0x549a0f[_0x574b24];if(_['isUndefined'](_0x2683a2[_0xf5d6('0x17')][_0x3de268[_0xf5d6('0x29')]])){_0x2683a2[_0xf5d6('0x17')][_0x3de268[_0xf5d6('0x29')]]=new Campaign(_0x3de268);}else{_0x2683a2[_0xf5d6('0x42')](_0x2683a2[_0xf5d6('0x17')][_0x3de268['name']],_0x3de268);_0x2683a2[_0xf5d6('0x17')][_0x3de268['name']][_0xf5d6('0x65')]=_0x3de268[_0xf5d6('0x66')]?_0x3de268[_0xf5d6('0x66')][_0xf5d6('0x29')]:undefined;}}}return _0x2683a2[_0xf5d6('0x17')];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x67')]=function(){var _0x1ee2a5=this;return function(_0x1976ae){if(_0x1976ae){freeIsNotKey(_0x1976ae,_0x1ee2a5[_0xf5d6('0x1a')],'id');for(var _0xae303d=0x0,_0x207297={};_0xae303d<_0x1976ae['length'];_0xae303d+=0x1){_0x207297=_0x1976ae[_0xae303d];if(_[_0xf5d6('0x45')](_0x1ee2a5[_0xf5d6('0x1a')][_0x207297['id']])){_0x1ee2a5[_0xf5d6('0x1a')][_0x207297['id']]=new VoiceExtension(_0x207297);}else{_0x1ee2a5[_0xf5d6('0x42')](_0x1ee2a5[_0xf5d6('0x1a')][_0x207297['id']],_0x207297);}}}return _0x1ee2a5[_0xf5d6('0x1a')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x1708ad=this;return function(_0x1d2445){clearCampaigns(_0x1708ad[_0xf5d6('0x17')]);for(var _0x591083=0x0;_0x591083<_0x1d2445[_0xf5d6('0x44')];_0x591083+=0x1){_[_0xf5d6('0x54')](_0x1708ad[_0xf5d6('0x17')][_0x1d2445[_0x591083]['name']],_0x1d2445[_0x591083]);}return _0x1708ad['campaigns'];};};Realtime[_0xf5d6('0x41')][_0xf5d6('0x68')]=function(){var _0xd3ac91=this;return function(_0x36edd5){if(_0x36edd5){freeIsNotKey(_0x36edd5,_0xd3ac91[_0xf5d6('0x69')],'id');for(var _0x14c297=0x0,_0x50f6a1={},_0x2a7d5b={};_0x14c297<_0x36edd5[_0xf5d6('0x44')];_0x14c297+=0x1){_0x50f6a1=_0x36edd5[_0x14c297];if(_[_0xf5d6('0x45')](_0xd3ac91[_0xf5d6('0x69')][_0x50f6a1['id']])){_0xd3ac91[_0xf5d6('0x69')][_0x50f6a1['id']]=new FaxAccount(_0x50f6a1);}else{_0xd3ac91[_0xf5d6('0x42')](_0xd3ac91[_0xf5d6('0x69')][_0x50f6a1['id']],_0x50f6a1);}}}return _0xd3ac91[_0xf5d6('0x69')];};};module[_0xf5d6('0x6a')]=Realtime; \ No newline at end of file +var _0xb9cd=['initVoiceQueues','initTriggers','initTemplates','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','duration','disposition','billableseconds','dialQueueProject','SquareProject','merge','initFaxAccounts','exports','bluebird','util','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','total','answered','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','interface','isUndefined','initTelephones'];(function(_0x2c55b6,_0x43485){var _0xd2e2a9=function(_0x5cabce){while(--_0x5cabce){_0x2c55b6['push'](_0x2c55b6['shift']());}};_0xd2e2a9(++_0x43485);}(_0xb9cd,0x158));var _0xdb9c=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0xb9cd[_0x3ee1fe];return _0x1ae57a;};'use strict';var BPromise=require(_0xdb9c('0x0'));var util=require(_0xdb9c('0x1'));var _=require('lodash');var moment=require(_0xdb9c('0x2'));var Agent=require(_0xdb9c('0x3'));var Telephone=require(_0xdb9c('0x4'));var Trunk=require(_0xdb9c('0x5'));var VoiceQueue=require(_0xdb9c('0x6'));var Trigger=require(_0xdb9c('0x7'));var Template=require('../model/template');var Campaign=require(_0xdb9c('0x8'));var VoiceExtension=require(_0xdb9c('0x9'));var ZendeskAccount=require(_0xdb9c('0xa'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xdb9c('0xb'));var SugarcrmAccount=require(_0xdb9c('0xc'));var ZohoAccount=require(_0xdb9c('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xdb9c('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xdb9c('0xf'));var FaxAccount=require(_0xdb9c('0x10'));var Realtime=function(){this[_0xdb9c('0x11')]={};this[_0xdb9c('0x12')]={};this[_0xdb9c('0x13')]={};this[_0xdb9c('0x14')]={};this[_0xdb9c('0x15')]={};this[_0xdb9c('0x16')]={};this[_0xdb9c('0x17')]={};this[_0xdb9c('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xdb9c('0x19')]={};this['channels']={};this['queueChannels']={};this[_0xdb9c('0x1a')]={};this[_0xdb9c('0x1b')]={};this[_0xdb9c('0x1c')]={};this[_0xdb9c('0x1d')]={};this['sugarcrmAccounts']={};this[_0xdb9c('0x1e')]={};this[_0xdb9c('0x1f')]={};this[_0xdb9c('0x20')]={};this[_0xdb9c('0x21')]={};this[_0xdb9c('0x22')]={};this[_0xdb9c('0x23')]={};this[_0xdb9c('0x24')]={};this[_0xdb9c('0x25')]={};};function freeIsNotKey(_0x3e952d,_0x1c45d2,_0x3b151e){var _0x20b801=_[_0xdb9c('0x26')](_0x3e952d,function(_0x2697d1,_0x4d5562){return _0x2697d1[_0x3b151e];});for(var _0x261d6e in _0x1c45d2){if(_0x1c45d2[_0xdb9c('0x27')](_0x261d6e)){if(!_0x20b801[_0x261d6e]){delete _0x1c45d2[_0x261d6e];}}}}function freeIsNotKeySip(_0x1b7f80,_0x3a2369){var _0x5a93d8=_['mapKeys'](_0x1b7f80,function(_0xff8926,_0x5a0165){return util[_0xdb9c('0x28')](_0xdb9c('0x29'),_0xff8926[_0xdb9c('0x2a')]);});for(var _0x28ecfe in _0x3a2369){if(_0x3a2369[_0xdb9c('0x27')](_0x28ecfe)){if(!_0x5a93d8[_0x28ecfe]){delete _0x3a2369[_0x28ecfe];}}}}function freeIsNotKeyAgent(_0x25b0e2,_0x3bad2e){var _0x746ee6=_['mapKeys'](_0x25b0e2,function(_0x287e3c,_0x278f32){var _0x4e7065=_[_0xdb9c('0x2b')](_0x287e3c['interface'])?util[_0xdb9c('0x28')](_0xdb9c('0x29'),_0x287e3c[_0xdb9c('0x2a')]):_0x287e3c['interface'];return _0x4e7065;});for(var _0x33ce8c in _0x3bad2e){if(_0x3bad2e[_0xdb9c('0x27')](_0x33ce8c)){if(!_0x746ee6[_0x33ce8c]){delete _0x3bad2e[_0x33ce8c];}}}}function clearVoiceCallReports(_0x4c04af){_0x4c04af[_0xdb9c('0x2c')]=0x0;_0x4c04af[_0xdb9c('0x2d')]=0x0;_0x4c04af['sumHoldTime']=0x0;_0x4c04af['sumDuration']=0x0;_0x4c04af[_0xdb9c('0x2e')]=0x0;}function clearCampaigns(_0x304d53){if(!_[_0xdb9c('0x2f')](_0x304d53)){for(var _0x36d089 in _0x304d53){if(_0x304d53[_0xdb9c('0x27')](_0x36d089)){_0x304d53[_0x36d089][_0xdb9c('0x30')]=0x0;_0x304d53[_0x36d089][_0xdb9c('0x31')]=0x0;}}}}function clearVoiceQueues(_0x312cee){if(!_['isEmpty'](_0x312cee)){for(var _0x2731e2 in _0x312cee){if(_0x312cee[_0xdb9c('0x27')](_0x2731e2)){_0x312cee[_0x2731e2][_0xdb9c('0x2c')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x2d')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x32')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x33')]=0x0;_0x312cee[_0x2731e2]['sumHoldTime']=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x34')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x2e')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x35')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x36')]=0x0;_0x312cee[_0x2731e2]['outboundBusyCallsDay']=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x37')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x38')]=0x0;_0x312cee[_0x2731e2]['outboundUnknownCallsDay']=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x39')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3a')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3b')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3c')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3d')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3e')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x35')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x3f')]=0x0;_0x312cee[_0x2731e2][_0xdb9c('0x40')]=!![];}}}}Realtime['prototype'][_0xdb9c('0x41')]=function(_0xb69806,_0x391118){for(var _0x4c3d91 in _0x391118){if(_0xb69806[_0xdb9c('0x27')](_0x4c3d91)){_0xb69806[_0x4c3d91]=_0x391118[_0x4c3d91];}}};Realtime[_0xdb9c('0x42')][_0xdb9c('0x43')]=function(){var _0x44502c=this;return function(_0x1c63b0){if(_0x1c63b0){freeIsNotKeyAgent(_0x1c63b0,_0x44502c['agents']);for(var _0x1d2f68=0x0,_0x5aa33c={},_0xbfd331={};_0x1d2f68<_0x1c63b0[_0xdb9c('0x44')];_0x1d2f68+=0x1){_0x5aa33c=_0x1c63b0[_0x1d2f68];var _0x482dc8=_[_0xdb9c('0x2b')](_0x5aa33c[_0xdb9c('0x45')])?util[_0xdb9c('0x28')](_0xdb9c('0x29'),_0x5aa33c['name']):_0x5aa33c[_0xdb9c('0x45')];if(_[_0xdb9c('0x46')](_0x44502c['agents'][_0x482dc8])){_0x44502c['agents'][_0x482dc8]=new Agent(_0x5aa33c);}else{_0x44502c['mergeFromDatabase'](_0x44502c[_0xdb9c('0x11')][_0x482dc8],_0x5aa33c);}}}return _0x44502c[_0xdb9c('0x11')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x47')]=function(){var _0x1b7c69=this;return function(_0x3da607){if(_0x3da607){freeIsNotKeySip(_0x3da607,_0x1b7c69[_0xdb9c('0x12')]);for(var _0x455272=0x0,_0x442676={},_0x337fc0={};_0x455272<_0x3da607[_0xdb9c('0x44')];_0x455272+=0x1){_0x442676=_0x3da607[_0x455272];if(_[_0xdb9c('0x46')](_0x1b7c69[_0xdb9c('0x12')][util[_0xdb9c('0x28')]('SIP/%s',_0x442676['name'])])){_0x1b7c69['telephones'][util['format'](_0xdb9c('0x29'),_0x442676[_0xdb9c('0x2a')])]=new Telephone(_0x442676);}else{_0x1b7c69['mergeFromDatabase'](_0x1b7c69['telephones'][util[_0xdb9c('0x28')](_0xdb9c('0x29'),_0x442676[_0xdb9c('0x2a')])],_0x442676);}}}return _0x1b7c69[_0xdb9c('0x12')];};};Realtime['prototype']['initTrunks']=function(){var _0x4e4df4=this;return function(_0x49031c){if(_0x49031c){freeIsNotKeySip(_0x49031c,_0x4e4df4[_0xdb9c('0x13')]);for(var _0xc8497a=0x0,_0x43912e={},_0x3781fc={};_0xc8497a<_0x49031c[_0xdb9c('0x44')];_0xc8497a+=0x1){_0x43912e=_0x49031c[_0xc8497a];if(_[_0xdb9c('0x46')](_0x4e4df4[_0xdb9c('0x13')][util[_0xdb9c('0x28')](_0xdb9c('0x29'),_0x43912e['name'])])){_0x4e4df4[_0xdb9c('0x13')][util['format']('SIP/%s',_0x43912e[_0xdb9c('0x2a')])]=new Trunk(_0x43912e);}else{_0x4e4df4[_0xdb9c('0x41')](_0x4e4df4['trunks'][util['format'](_0xdb9c('0x29'),_0x43912e['name'])],_0x43912e);}}}return _0x4e4df4[_0xdb9c('0x13')];};};Realtime['prototype'][_0xdb9c('0x48')]=function(){var _0x193d7e=this;return function(_0x46a5f6){if(_0x46a5f6){freeIsNotKey(_0x46a5f6,_0x193d7e['voiceQueues'],_0xdb9c('0x2a'));for(var _0x12fd06=0x0,_0x332525={},_0x3b00f8={};_0x12fd06<_0x46a5f6[_0xdb9c('0x44')];_0x12fd06+=0x1){_0x332525=_0x46a5f6[_0x12fd06];if(_['isUndefined'](_0x193d7e[_0xdb9c('0x14')][_0x332525[_0xdb9c('0x2a')]])){_0x193d7e['voiceQueues'][_0x332525['name']]=new VoiceQueue(_0x332525);}else{_0x193d7e[_0xdb9c('0x41')](_0x193d7e[_0xdb9c('0x14')][_0x332525[_0xdb9c('0x2a')]],_0x332525);}}}return _0x193d7e[_0xdb9c('0x14')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x49')]=function(){var _0x1ccd29=this;return function(_0x549c1f){if(_0x549c1f){freeIsNotKey(_0x549c1f,_0x1ccd29[_0xdb9c('0x15')],'id');for(var _0x4c180a=0x0,_0x5b264c={},_0x2be0aa={};_0x4c180a<_0x549c1f[_0xdb9c('0x44')];_0x4c180a+=0x1){_0x5b264c=_0x549c1f[_0x4c180a];if(_[_0xdb9c('0x46')](_0x1ccd29[_0xdb9c('0x15')][_0x5b264c['id']])){_0x1ccd29[_0xdb9c('0x15')][_0x5b264c['id']]=new Trigger(_0x5b264c);}else{_0x1ccd29[_0xdb9c('0x41')](_0x1ccd29[_0xdb9c('0x15')][_0x5b264c['id']],_0x5b264c);}}}return _0x1ccd29[_0xdb9c('0x15')];};};Realtime['prototype'][_0xdb9c('0x4a')]=function(){var _0x3be84c=this;return function(_0x241456){if(_0x241456){freeIsNotKey(_0x241456,_0x3be84c[_0xdb9c('0x17')],'id');for(var _0x55b500=0x0,_0x55d97c={},_0x599a51={};_0x55b500<_0x241456['length'];_0x55b500+=0x1){_0x55d97c=_0x241456[_0x55b500];if(_[_0xdb9c('0x46')](_0x3be84c[_0xdb9c('0x17')][_0x55d97c['id']])){_0x3be84c[_0xdb9c('0x17')][_0x55d97c['id']]=new Template(_0x55d97c);}else{_0x3be84c[_0xdb9c('0x41')](_0x3be84c[_0xdb9c('0x17')][_0x55d97c['id']],_0x55d97c);}}}return _0x3be84c[_0xdb9c('0x17')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x346acd=this;return function(_0xb01c17){if(_0xb01c17){freeIsNotKey(_0xb01c17,_0x346acd[_0xdb9c('0x1c')],'id');for(var _0x73df61=0x0,_0x3c2d29={},_0x58f74b={};_0x73df61<_0xb01c17[_0xdb9c('0x44')];_0x73df61+=0x1){_0x3c2d29=_0xb01c17[_0x73df61];if(_[_0xdb9c('0x46')](_0x346acd['zendeskAccounts'][_0x3c2d29['id']])){_0x346acd[_0xdb9c('0x1c')][_0x3c2d29['id']]=new ZendeskAccount(_0x3c2d29);}else{_0x346acd[_0xdb9c('0x41')](_0x346acd[_0xdb9c('0x1c')][_0x3c2d29['id']],_0x3c2d29);}}}return _0x346acd[_0xdb9c('0x1c')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x4b')]=function(){var _0x5ce8f6=this;return function(_0x715d8d){if(_0x715d8d){freeIsNotKey(_0x715d8d,_0x5ce8f6[_0xdb9c('0x1d')],'id');for(var _0x246623=0x0,_0x4e553f={},_0x4c4fe2={};_0x246623<_0x715d8d[_0xdb9c('0x44')];_0x246623+=0x1){_0x4e553f=_0x715d8d[_0x246623];if(_[_0xdb9c('0x46')](_0x5ce8f6[_0xdb9c('0x1d')][_0x4e553f['id']])){_0x5ce8f6['salesforceAccounts'][_0x4e553f['id']]=new SalesforceAccount(_0x4e553f);}else{_0x5ce8f6[_0xdb9c('0x41')](_0x5ce8f6[_0xdb9c('0x1d')][_0x4e553f['id']],_0x4e553f);}}}return _0x5ce8f6[_0xdb9c('0x1d')];};};Realtime['prototype'][_0xdb9c('0x4c')]=function(){var _0x23e25a=this;return function(_0x24f3a3){if(_0x24f3a3){freeIsNotKey(_0x24f3a3,_0x23e25a[_0xdb9c('0x1e')],'id');for(var _0x28a10e=0x0,_0x5a0022={},_0x38b237={};_0x28a10e<_0x24f3a3[_0xdb9c('0x44')];_0x28a10e+=0x1){_0x5a0022=_0x24f3a3[_0x28a10e];if(_[_0xdb9c('0x46')](_0x23e25a[_0xdb9c('0x1e')][_0x5a0022['id']])){_0x23e25a[_0xdb9c('0x1e')][_0x5a0022['id']]=new FreshdeskAccount(_0x5a0022);}else{_0x23e25a['mergeFromDatabase'](_0x23e25a[_0xdb9c('0x1e')][_0x5a0022['id']],_0x5a0022);}}}return _0x23e25a[_0xdb9c('0x1e')];};};Realtime[_0xdb9c('0x42')]['initZohoAccounts']=function(){var _0x4117b2=this;return function(_0x57567b){if(_0x57567b){freeIsNotKey(_0x57567b,_0x4117b2[_0xdb9c('0x1f')],'id');for(var _0x409a92=0x0,_0x1ab6e4={},_0x36dcbd={};_0x409a92<_0x57567b[_0xdb9c('0x44')];_0x409a92+=0x1){_0x1ab6e4=_0x57567b[_0x409a92];if(_[_0xdb9c('0x46')](_0x4117b2['zohoAccounts'][_0x1ab6e4['id']])){_0x4117b2[_0xdb9c('0x1f')][_0x1ab6e4['id']]=new ZohoAccount(_0x1ab6e4);}else{_0x4117b2[_0xdb9c('0x41')](_0x4117b2[_0xdb9c('0x1f')][_0x1ab6e4['id']],_0x1ab6e4);}}}return _0x4117b2[_0xdb9c('0x1f')];};};Realtime['prototype'][_0xdb9c('0x4d')]=function(){var _0xa72e5a=this;return function(_0xe35c45){if(_0xe35c45){freeIsNotKey(_0xe35c45,_0xa72e5a[_0xdb9c('0x20')],'id');for(var _0x4a1f50=0x0,_0xa4d213={},_0x30fae6={};_0x4a1f50<_0xe35c45[_0xdb9c('0x44')];_0x4a1f50+=0x1){_0xa4d213=_0xe35c45[_0x4a1f50];if(_[_0xdb9c('0x46')](_0xa72e5a[_0xdb9c('0x20')][_0xa4d213['id']])){_0xa72e5a['deskAccounts'][_0xa4d213['id']]=new DeskAccount(_0xa4d213);}else{_0xa72e5a[_0xdb9c('0x41')](_0xa72e5a['deskAccounts'][_0xa4d213['id']],_0xa4d213);}}}return _0xa72e5a[_0xdb9c('0x20')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x4e')]=function(){var _0x16f7d0=this;return function(_0x17dd88){if(_0x17dd88){freeIsNotKey(_0x17dd88,_0x16f7d0[_0xdb9c('0x4f')],'id');for(var _0x516e87=0x0,_0x20f872={},_0x569b44={};_0x516e87<_0x17dd88[_0xdb9c('0x44')];_0x516e87+=0x1){_0x20f872=_0x17dd88[_0x516e87];if(_[_0xdb9c('0x46')](_0x16f7d0['sugarcrmAccounts'][_0x20f872['id']])){_0x16f7d0[_0xdb9c('0x4f')][_0x20f872['id']]=new SugarcrmAccount(_0x20f872);}else{_0x16f7d0['mergeFromDatabase'](_0x16f7d0['sugarcrmAccounts'][_0x20f872['id']],_0x20f872);}}}return _0x16f7d0[_0xdb9c('0x4f')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x50')]=function(){var _0x31f6b4=this;return function(_0x15ddad){if(_0x15ddad){freeIsNotKey(_0x15ddad,_0x31f6b4[_0xdb9c('0x21')],'id');for(var _0x42953b=0x0,_0xd61741={},_0x2d1339={};_0x42953b<_0x15ddad[_0xdb9c('0x44')];_0x42953b+=0x1){_0xd61741=_0x15ddad[_0x42953b];if(_['isUndefined'](_0x31f6b4[_0xdb9c('0x21')][_0xd61741['id']])){_0x31f6b4[_0xdb9c('0x21')][_0xd61741['id']]=new VtigerAccount(_0xd61741);}else{_0x31f6b4[_0xdb9c('0x41')](_0x31f6b4[_0xdb9c('0x21')][_0xd61741['id']],_0xd61741);}}}return _0x31f6b4[_0xdb9c('0x21')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x51')]=function(){var _0x5f03c5=this;return function(_0x204412){if(_0x204412){freeIsNotKey(_0x204412,_0x5f03c5[_0xdb9c('0x22')],'id');for(var _0x39f5da=0x0,_0x318d85={},_0x2de5a4={};_0x39f5da<_0x204412[_0xdb9c('0x44')];_0x39f5da+=0x1){_0x318d85=_0x204412[_0x39f5da];if(_[_0xdb9c('0x46')](_0x5f03c5[_0xdb9c('0x22')][_0x318d85['id']])){_0x5f03c5[_0xdb9c('0x22')][_0x318d85['id']]=new ServicenowAccount(_0x318d85);}else{_0x5f03c5[_0xdb9c('0x41')](_0x5f03c5[_0xdb9c('0x22')][_0x318d85['id']],_0x318d85);}}}return _0x5f03c5[_0xdb9c('0x22')];};};Realtime[_0xdb9c('0x42')]['initDynamics365Accounts']=function(){var _0x5fcd61=this;return function(_0x5355ca){if(_0x5355ca){freeIsNotKey(_0x5355ca,_0x5fcd61[_0xdb9c('0x23')],'id');for(var _0x33d672=0x0,_0x3da92e={},_0x52a363={};_0x33d672<_0x5355ca['length'];_0x33d672+=0x1){_0x3da92e=_0x5355ca[_0x33d672];if(_[_0xdb9c('0x46')](_0x5fcd61[_0xdb9c('0x23')][_0x3da92e['id']])){_0x5fcd61[_0xdb9c('0x23')][_0x3da92e['id']]=new Dynamics365Account(_0x3da92e);}else{_0x5fcd61[_0xdb9c('0x41')](_0x5fcd61[_0xdb9c('0x23')][_0x3da92e['id']],_0x3da92e);}}}return _0x5fcd61['dynamics365Accounts'];};};Realtime['prototype'][_0xdb9c('0x52')]=function(){var _0x1ac67c=this;return function(_0x11c0d3){if(_0x11c0d3){freeIsNotKey(_0x11c0d3,_0x1ac67c[_0xdb9c('0x24')],'id');for(var _0x472e22=0x0,_0x26f35b={},_0x3e9c1c={};_0x472e22<_0x11c0d3[_0xdb9c('0x44')];_0x472e22+=0x1){_0x26f35b=_0x11c0d3[_0x472e22];if(_[_0xdb9c('0x46')](_0x1ac67c[_0xdb9c('0x24')][_0x26f35b['id']])){_0x1ac67c[_0xdb9c('0x24')][_0x26f35b['id']]=new FreshsalesAccount(_0x26f35b);}else{_0x1ac67c['mergeFromDatabase'](_0x1ac67c[_0xdb9c('0x24')][_0x26f35b['id']],_0x26f35b);}}}return _0x1ac67c['freshsalesAccounts'];};};Realtime[_0xdb9c('0x42')]['initVoiceQueueHopperHistory']=function(){var _0x4b8a5d=this;return function(_0x2255e0){for(var _0x211a88=0x0;_0x211a88<_0x2255e0[_0xdb9c('0x44')];_0x211a88+=0x1){_['merge'](_0x4b8a5d[_0xdb9c('0x14')][_0x2255e0[_0x211a88]['name']],_0x2255e0[_0x211a88]);}return _0x4b8a5d[_0xdb9c('0x14')];};};Realtime[_0xdb9c('0x42')]['initVoiceQueueReports']=function(){var _0x985643=this;return function(_0x24d48a){clearVoiceQueues(_0x985643[_0xdb9c('0x14')]);if(_0x24d48a){_0x24d48a=_[_0xdb9c('0x53')](_0x24d48a,_0xdb9c('0x54'));for(var _0x233e85 in _0x24d48a){if(_0x24d48a[_0xdb9c('0x27')](_0x233e85)){var _0x9a38b3={};for(var _0x3e5895=0x0;_0x3e5895<_0x24d48a[_0x233e85][_0xdb9c('0x44')];_0x3e5895+=0x1){var _0x4e914e=_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x55')];if(_0x985643[_0xdb9c('0x14')][_0x4e914e]){if(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x56')]){_0x985643[_0xdb9c('0x14')][_0x4e914e]['unmanaged']+=0x1;}if(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x57')]){_0x985643[_0xdb9c('0x14')][_0x4e914e]['abandoned']+=0x1;}_0x985643[_0xdb9c('0x14')][_0x4e914e][_0xdb9c('0x58')]+=moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x59')])[_0xdb9c('0x5a')](moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5b')]),_0xdb9c('0x5c'))||0x0;if(_0x3e5895===_0x24d48a[_0x233e85][_0xdb9c('0x44')]-0x1){_0x985643['voiceQueues'][_0x4e914e][_0xdb9c('0x34')]+=moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5d')]||_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5e')]||_0x24d48a[_0x233e85][_0x3e5895]['queuecallerexitAt'])[_0xdb9c('0x5a')](moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5b')]),_0xdb9c('0x5c'))||0x0;_0x985643[_0xdb9c('0x14')][_0x4e914e][_0xdb9c('0x2c')]+=0x1;if(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5f')]){_0x985643['voiceQueues'][_0x4e914e][_0xdb9c('0x2d')]+=0x1;_0x985643[_0xdb9c('0x14')][_0x4e914e]['sumBillable']+=moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x5d')])[_0xdb9c('0x5a')](moment(_0x24d48a[_0x233e85][_0x3e5895][_0xdb9c('0x59')]),_0xdb9c('0x5c'))||0x0;}}else{_0x985643[_0xdb9c('0x14')][_0x4e914e][_0xdb9c('0x34')]+=_0x985643['voiceQueues'][_0x4e914e]['sumHoldTime']||0x0;}}}}}}return _0x985643[_0xdb9c('0x14')];};};Realtime[_0xdb9c('0x42')]['initVoiceCallReports']=function(){var _0x474dea=this;return function(_0x548e92){clearVoiceCallReports(_0x474dea[_0xdb9c('0x18')]);if(_0x548e92){for(var _0x36cfe9=0x0;_0x36cfe9<_0x548e92['length'];_0x36cfe9+=0x1){_0x474dea['outbound'][_0xdb9c('0x2c')]+=0x1;_0x474dea[_0xdb9c('0x18')]['sumDuration']+=_0x548e92[_0x36cfe9][_0xdb9c('0x60')];if(_0x548e92[_0x36cfe9][_0xdb9c('0x61')]==='ANSWERED'){_0x474dea[_0xdb9c('0x18')][_0xdb9c('0x2d')]+=0x1;_0x474dea['outbound'][_0xdb9c('0x58')]+=_0x548e92[_0x36cfe9][_0xdb9c('0x60')]-_0x548e92[_0x36cfe9][_0xdb9c('0x62')]||0x0;_0x474dea[_0xdb9c('0x18')][_0xdb9c('0x2e')]+=_0x548e92[_0x36cfe9][_0xdb9c('0x62')];}}}return _0x474dea[_0xdb9c('0x18')];};};Realtime['prototype']['initCampaigns']=function(){var _0x520fc5=this;return function(_0x147945){if(_0x147945){freeIsNotKey(_0x147945,_0x520fc5[_0xdb9c('0x16')],_0xdb9c('0x2a'));for(var _0x461313=0x0,_0x43230d={};_0x461313<_0x147945[_0xdb9c('0x44')];_0x461313+=0x1){_0x43230d=_0x147945[_0x461313];if(_['isUndefined'](_0x520fc5[_0xdb9c('0x16')][_0x43230d[_0xdb9c('0x2a')]])){_0x520fc5['campaigns'][_0x43230d['name']]=new Campaign(_0x43230d);}else{_0x520fc5[_0xdb9c('0x41')](_0x520fc5[_0xdb9c('0x16')][_0x43230d['name']],_0x43230d);_0x520fc5[_0xdb9c('0x16')][_0x43230d[_0xdb9c('0x2a')]][_0xdb9c('0x63')]=_0x43230d[_0xdb9c('0x64')]?_0x43230d[_0xdb9c('0x64')][_0xdb9c('0x2a')]:undefined;}}}return _0x520fc5[_0xdb9c('0x16')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0xfb7ba=this;return function(_0x1cc0b2){if(_0x1cc0b2){freeIsNotKey(_0x1cc0b2,_0xfb7ba[_0xdb9c('0x19')],'id');for(var _0x6563ba=0x0,_0x5ce178={};_0x6563ba<_0x1cc0b2[_0xdb9c('0x44')];_0x6563ba+=0x1){_0x5ce178=_0x1cc0b2[_0x6563ba];if(_[_0xdb9c('0x46')](_0xfb7ba[_0xdb9c('0x19')][_0x5ce178['id']])){_0xfb7ba[_0xdb9c('0x19')][_0x5ce178['id']]=new VoiceExtension(_0x5ce178);}else{_0xfb7ba['mergeFromDatabase'](_0xfb7ba[_0xdb9c('0x19')][_0x5ce178['id']],_0x5ce178);}}}return _0xfb7ba[_0xdb9c('0x19')];};};Realtime[_0xdb9c('0x42')]['initCampaignHopperHistory']=function(){var _0x205793=this;return function(_0x35ffe4){clearCampaigns(_0x205793[_0xdb9c('0x16')]);for(var _0x1d1624=0x0;_0x1d1624<_0x35ffe4[_0xdb9c('0x44')];_0x1d1624+=0x1){_[_0xdb9c('0x65')](_0x205793[_0xdb9c('0x16')][_0x35ffe4[_0x1d1624]['name']],_0x35ffe4[_0x1d1624]);}return _0x205793[_0xdb9c('0x16')];};};Realtime[_0xdb9c('0x42')][_0xdb9c('0x66')]=function(){var _0xebaf0=this;return function(_0xfb5ec2){if(_0xfb5ec2){freeIsNotKey(_0xfb5ec2,_0xebaf0[_0xdb9c('0x25')],'id');for(var _0x4cce33=0x0,_0x56d2bd={},_0x4312a9={};_0x4cce33<_0xfb5ec2[_0xdb9c('0x44')];_0x4cce33+=0x1){_0x56d2bd=_0xfb5ec2[_0x4cce33];if(_[_0xdb9c('0x46')](_0xebaf0[_0xdb9c('0x25')][_0x56d2bd['id']])){_0xebaf0['faxAccounts'][_0x56d2bd['id']]=new FaxAccount(_0x56d2bd);}else{_0xebaf0[_0xdb9c('0x41')](_0xebaf0[_0xdb9c('0x25')][_0x56d2bd['id']],_0x56d2bd);}}}return _0xebaf0[_0xdb9c('0x25')];};};module[_0xdb9c('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 00a554c..b317ec0 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 _0x7109=['indexOf','mobile','phone','lastIndexOf','membername','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','name','find','interface','format','SIP/%s','connectedlinenum','accountcode','assigned','isNil','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','exten','type','dialer','lastapplication','queue','callerid','context','from-sip','destination','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','length','monitorFilename','filename','createdAt','connectedlinename','voiceAgentReport','isArray','forEach','startsWith','Local','substring'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x7109,0x1be));var _0x9710=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x7109[_0x149083];return _0x4dc74e;};'use strict';var BPromise=require('bluebird');var _=require(_0x9710('0x0'));var moment=require(_0x9710('0x1'));var util=require(_0x9710('0x2'));var config=require(_0x9710('0x3'));var logger=require(_0x9710('0x4'))(_0x9710('0x5'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x9710('0x6'));var RpcVoiceDialReport=require(_0x9710('0x7'));var RpcMemberReport=require(_0x9710('0x8'));var RpcVoiceQueueReport=require(_0x9710('0x9'));var RpcVoiceRecording=require(_0x9710('0xa'));var RpcVoiceTransferReport=require(_0x9710('0xb'));var VoiceQueueReport=require(_0x9710('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x9710('0xd'));var UserReport=require(_0x9710('0xe'));function Report(_0x52377b){this[_0x9710('0xf')]=_0x52377b;this[_0x9710('0x10')]=_0x52377b[_0x9710('0x10')];this[_0x9710('0x11')]=_0x52377b[_0x9710('0x11')];}Report[_0x9710('0x12')][_0x9710('0x13')]=function(_0x3e174e){var _0x201cce=new VoiceQueueReport(this[_0x9710('0xf')]);var _0x2fc8d4=new VoiceAgentReport(this[_0x9710('0xf')]);var _0x178244=new VoiceDialReport(this[_0x9710('0xf')]);var _0x1a209d=new VoiceCallReport(this['realtime']);var _0x1ea111=new UserReport(this[_0x9710('0xf')]);if(config[_0x9710('0x14')]&&config['xdr']['disabled']){ami['on'](_0x9710('0x15'),this[_0x9710('0x16')][_0x9710('0x17')](this));ami['on'](_0x9710('0x18'),this[_0x9710('0x19')][_0x9710('0x17')](this));ami['on'](_0x9710('0x1a'),this['voiceAgentReport'][_0x9710('0x17')](this));ami['on'](_0x9710('0x1b'),this[_0x9710('0x1c')][_0x9710('0x17')](this));ami['on'](_0x9710('0x1d'),this[_0x9710('0x1e')][_0x9710('0x17')](this));ami['on'](_0x9710('0x1f'),this[_0x9710('0x20')][_0x9710('0x17')](this));}};Report[_0x9710('0x12')][_0x9710('0x21')]=function(_0x280b21){var _0x1b6eff=undefined;_0x1b6eff=_['find'](this['agents'],function(_0x3fb888){return _0x3fb888['accountcode']==_0x280b21||_0x3fb888[_0x9710('0x22')]==_0x280b21;});if(_['isNil'](_0x1b6eff)){var _0x65df5e=_[_0x9710('0x23')](this['telephones'],function(_0x2f55fc){return _0x2f55fc['accountcode']==_0x280b21||_0x2f55fc[_0x9710('0x22')]==_0x280b21;});if(_0x65df5e){_0x1b6eff=_['find'](this[_0x9710('0x10')],function(_0x1f9102){return _0x1f9102[_0x9710('0x24')]==util[_0x9710('0x25')](_0x9710('0x26'),_0x65df5e[_0x9710('0x22')]);});}}return _0x1b6eff;};Report[_0x9710('0x12')][_0x9710('0x16')]=function(_0x78bc76){for(var _0x3e61d4=0x0;_0x3e61d4<_0x78bc76['length'];_0x3e61d4+=0x1){var _0x7304c7=this[_0x9710('0x21')](_0x78bc76[_0x3e61d4][_0x9710('0x27')]);if(_0x7304c7){_0x78bc76[_0x3e61d4]['accountcode']=_0x7304c7[_0x9710('0x28')];_0x78bc76[_0x3e61d4][_0x9710('0x29')]=!![];_0x78bc76[_0x3e61d4]['lastAssignedTo']=_0x7304c7['name'];_0x78bc76[_0x3e61d4][_0x9710('0x24')]=_[_0x9710('0x2a')](_0x7304c7[_0x9710('0x24')])?util[_0x9710('0x25')](_0x9710('0x26'),_0x7304c7[_0x9710('0x22')]):_0x7304c7[_0x9710('0x24')];if(_0x78bc76[_0x3e61d4][_0x9710('0x2b')]){_0x78bc76[_0x3e61d4][_0x9710('0x2c')]=moment()[_0x9710('0x25')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x78bc76[_0x3e61d4][_0x9710('0x2d')]){_0x78bc76[_0x3e61d4][_0x9710('0x2e')]=moment()[_0x9710('0x25')](_0x9710('0x2f'));}RpcMemberReport['voiceQueueReport'](_0x78bc76[_0x3e61d4]);}RpcVoiceQueueReport[_0x9710('0x30')](_0x78bc76[_0x3e61d4]);}};function extractCalleridNumber(_0x1703da){var _0x41c0b2=_0x1703da[_0x9710('0x31')](/<(.*?)>/);return _0x41c0b2?_0x41c0b2[0x1]:_0x1703da;}Report[_0x9710('0x12')]['voiceCallReport']=function(_0x365567){_0x365567['destination']=_0x365567['destination']||_0x365567[_0x9710('0x32')];if(_0x365567[_0x9710('0x33')]==_0x9710('0x34')){_0x365567[_0x9710('0x35')]=_0x9710('0x36');_0x365567['lastdata']=_0x365567[_0x9710('0x36')];if(_0x365567['context']=='from-voip-provider'){_0x365567[_0x9710('0x28')]='';_0x365567['destination']=extractCalleridNumber(_0x365567[_0x9710('0x37')]);}else if(_0x365567[_0x9710('0x38')]==_0x9710('0x39')){if(_0x365567[_0x9710('0x3a')]==_0x9710('0x3b')){_0x365567['destination']=extractCalleridNumber(_0x365567[_0x9710('0x3c')]);_0x365567[_0x9710('0x3d')]=_0x365567[_0x9710('0x3e')];_0x365567[_0x9710('0x3f')]=[_0x365567[_0x9710('0x40')],_0x365567[_0x9710('0x40')]=_0x365567[_0x9710('0x3f')]][0x0];_0x365567[_0x9710('0x37')]=_0x365567[_0x9710('0x3c')];}else{_0x365567[_0x9710('0x3a')]=_0x365567['calleridnum'];_0x365567[_0x9710('0x3d')]=_0x365567[_0x9710('0x3e')];if(_0x365567[_0x9710('0x41')]==_0x9710('0x42')){_0x365567[_0x9710('0x28')]=_0x365567[_0x9710('0x27')];}else{_0x365567[_0x9710('0x28')]='';}}}}else{_0x365567[_0x9710('0x37')]=util[_0x9710('0x25')](_0x9710('0x43'),_0x365567[_0x9710('0x44')],_0x365567[_0x9710('0x3d')]);}RpcVoiceCallReport[_0x9710('0x30')](_0x365567);if(_0x365567[_0x9710('0x45')]){for(var _0x31bb74=0x0;_0x31bb74<_0x365567[_0x9710('0x46')][_0x9710('0x47')];_0x31bb74+=0x1){_0x365567[_0x9710('0x48')]=_0x365567[_0x9710('0x46')][_0x31bb74][_0x9710('0x49')];_0x365567[_0x9710('0x4a')]=_0x365567[_0x9710('0x46')][_0x31bb74]['createdAt'];if(_0x365567['exten']=='xcally-motion-preview'){_0x365567[_0x9710('0x3d')]=_0x365567[_0x9710('0x27')];_0x365567[_0x9710('0x44')]=_0x365567[_0x9710('0x4b')];_0x365567[_0x9710('0x27')]=_0x365567[_0x9710('0x28')];_0x365567['connectedlinename']=_0x365567['membername'];_0x365567[_0x9710('0x32')]=_0x365567[_0x9710('0x3e')];}else if(_0x365567[_0x9710('0x32')]=='xcally-motion-dialer'){_0x365567[_0x9710('0x3d')]=_0x365567[_0x9710('0x3a')];_0x365567['exten']=_0x365567[_0x9710('0x3e')];}RpcVoiceRecording['create'](_0x365567);}}};Report[_0x9710('0x12')][_0x9710('0x4c')]=function(_0x31916e){if(_[_0x9710('0x4d')](_0x31916e)){_0x31916e[_0x9710('0x4e')](function(_0x241e05){RpcVoiceAgentReport[_0x9710('0x30')](_0x241e05);});}else{RpcVoiceAgentReport['create'](_0x31916e);}};Report['prototype'][_0x9710('0x1c')]=function(_0x1d3dfd){RpcVoiceDialReport[_0x9710('0x30')](_0x1d3dfd);var _0x16f7c4=undefined;var _0x20c694=_0x1d3dfd['channel'];if(_[_0x9710('0x4f')](_0x20c694,_0x9710('0x50'))){var _0x3dde80=_0x20c694[_0x9710('0x51')](_0x20c694[_0x9710('0x52')]('/')+0x1,_0x20c694[_0x9710('0x52')]('@'));_0x16f7c4=_[_0x9710('0x23')](this['agents'],function(_0x214cdb){return _0x214cdb[_0x9710('0x53')]==_0x3dde80||_0x214cdb[_0x9710('0x54')]==_0x3dde80||_0x214cdb[_0x9710('0x28')]==_0x3dde80;});}else{var _0x3dde80=_0x20c694[_0x9710('0x51')](_0x20c694['indexOf']('/')+0x1,_0x20c694[_0x9710('0x55')]('-'));_0x16f7c4=this[_0x9710('0x21')](_0x3dde80);}if(_0x16f7c4){_0x1d3dfd[_0x9710('0x24')]=_[_0x9710('0x2a')](_0x16f7c4[_0x9710('0x24')])?util['format'](_0x9710('0x26'),_0x16f7c4[_0x9710('0x22')]):_0x16f7c4['interface'];_0x1d3dfd[_0x9710('0x56')]=_0x16f7c4['name'];_0x1d3dfd['accountcode']=_0x16f7c4[_0x9710('0x28')];RpcMemberReport[_0x9710('0x1c')](_0x1d3dfd);}};Report[_0x9710('0x12')]['blindTransfer']=function(_0x587327){RpcVoiceTransferReport[_0x9710('0x1e')](_0x587327);};Report['prototype'][_0x9710('0x20')]=function(_0x3e7824){RpcVoiceTransferReport[_0x9710('0x20')](_0x3e7824);};module[_0x9710('0x57')]=Report; \ No newline at end of file +var _0x6fe2=['dialer','lastapplication','queue','context','callerid','from-sip','calleridpreview','calleridnum','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','length','monitorFilename','filename','createdAt','exten','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','originatecalleridnum','isArray','forEach','voiceDialReport','channel','startsWith','substring','indexOf','lastIndexOf','bluebird','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','realtime','agents','telephones','xdr','disabled','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','interface','format','prototype','voiceQueueReport','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','type'];(function(_0x2ae241,_0x1dfb42){var _0x5b6d54=function(_0x2560c9){while(--_0x2560c9){_0x2ae241['push'](_0x2ae241['shift']());}};_0x5b6d54(++_0x1dfb42);}(_0x6fe2,0x1c5));var _0x26fe=function(_0x436825,_0x52a7c6){_0x436825=_0x436825-0x0;var _0x18bc61=_0x6fe2[_0x436825];return _0x18bc61;};'use strict';var BPromise=require(_0x26fe('0x0'));var _=require(_0x26fe('0x1'));var moment=require(_0x26fe('0x2'));var util=require(_0x26fe('0x3'));var config=require(_0x26fe('0x4'));var logger=require(_0x26fe('0x5'))(_0x26fe('0x6'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x26fe('0x7'));var RpcVoiceCallReport=require(_0x26fe('0x8'));var RpcVoiceDialReport=require(_0x26fe('0x9'));var RpcMemberReport=require(_0x26fe('0xa'));var RpcVoiceQueueReport=require(_0x26fe('0xb'));var RpcVoiceRecording=require(_0x26fe('0xc'));var RpcVoiceTransferReport=require(_0x26fe('0xd'));var VoiceQueueReport=require(_0x26fe('0xe'));var VoiceCallReport=require(_0x26fe('0xf'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x26fe('0x10'));var UserReport=require('./userReport');function Report(_0x20f0a6){this[_0x26fe('0x11')]=_0x20f0a6;this[_0x26fe('0x12')]=_0x20f0a6[_0x26fe('0x12')];this[_0x26fe('0x13')]=_0x20f0a6[_0x26fe('0x13')];}Report['prototype']['sync']=function(_0x20216e){var _0x5247b4=new VoiceQueueReport(this['realtime']);var _0x30059b=new VoiceAgentReport(this[_0x26fe('0x11')]);var _0x5eedf3=new VoiceDialReport(this[_0x26fe('0x11')]);var _0x1a7d47=new VoiceCallReport(this[_0x26fe('0x11')]);var _0x49955a=new UserReport(this['realtime']);if(config[_0x26fe('0x14')]&&config['xdr'][_0x26fe('0x15')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x26fe('0x16')](this));ami['on'](_0x26fe('0x17'),this['voiceCallReport'][_0x26fe('0x16')](this));ami['on'](_0x26fe('0x18'),this[_0x26fe('0x19')][_0x26fe('0x16')](this));ami['on'](_0x26fe('0x1a'),this['voiceDialReport']['bind'](this));ami['on'](_0x26fe('0x1b'),this[_0x26fe('0x1c')][_0x26fe('0x16')](this));ami['on'](_0x26fe('0x1d'),this[_0x26fe('0x1e')]['bind'](this));}};Report['prototype']['findAgent']=function(_0x2ff3f4){var _0x392d8c=undefined;_0x392d8c=_[_0x26fe('0x1f')](this[_0x26fe('0x12')],function(_0x1d4140){return _0x1d4140[_0x26fe('0x20')]==_0x2ff3f4||_0x1d4140[_0x26fe('0x21')]==_0x2ff3f4;});if(_[_0x26fe('0x22')](_0x392d8c)){var _0x3a1ff0=_['find'](this[_0x26fe('0x13')],function(_0x3f9546){return _0x3f9546['accountcode']==_0x2ff3f4||_0x3f9546[_0x26fe('0x21')]==_0x2ff3f4;});if(_0x3a1ff0){_0x392d8c=_[_0x26fe('0x1f')](this['agents'],function(_0xa1cb33){return _0xa1cb33[_0x26fe('0x23')]==util[_0x26fe('0x24')]('SIP/%s',_0x3a1ff0['name']);});}}return _0x392d8c;};Report[_0x26fe('0x25')][_0x26fe('0x26')]=function(_0x33d14c){for(var _0x2a9092=0x0;_0x2a9092<_0x33d14c['length'];_0x2a9092+=0x1){var _0x49daa9=this[_0x26fe('0x27')](_0x33d14c[_0x2a9092][_0x26fe('0x28')]);if(_0x49daa9){_0x33d14c[_0x2a9092][_0x26fe('0x20')]=_0x49daa9[_0x26fe('0x20')];_0x33d14c[_0x2a9092][_0x26fe('0x29')]=!![];_0x33d14c[_0x2a9092][_0x26fe('0x2a')]=_0x49daa9[_0x26fe('0x21')];_0x33d14c[_0x2a9092]['interface']=_[_0x26fe('0x22')](_0x49daa9[_0x26fe('0x23')])?util['format'](_0x26fe('0x2b'),_0x49daa9['name']):_0x49daa9[_0x26fe('0x23')];if(_0x33d14c[_0x2a9092][_0x26fe('0x2c')]){_0x33d14c[_0x2a9092]['queuecallercompleteAt']=moment()[_0x26fe('0x24')](_0x26fe('0x2d'));}if(_0x33d14c[_0x2a9092][_0x26fe('0x2e')]){_0x33d14c[_0x2a9092]['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x33d14c[_0x2a9092]);}RpcVoiceQueueReport[_0x26fe('0x2f')](_0x33d14c[_0x2a9092]);}};function extractCalleridNumber(_0x4cf6ba){var _0x2365bc=_0x4cf6ba[_0x26fe('0x30')](/<(.*?)>/);return _0x2365bc?_0x2365bc[0x1]:_0x4cf6ba;}Report[_0x26fe('0x25')]['voiceCallReport']=function(_0x17a75a){_0x17a75a[_0x26fe('0x31')]=_0x17a75a[_0x26fe('0x31')]||_0x17a75a['exten'];if(_0x17a75a[_0x26fe('0x32')]==_0x26fe('0x33')){_0x17a75a[_0x26fe('0x34')]=_0x26fe('0x35');_0x17a75a['lastdata']=_0x17a75a[_0x26fe('0x35')];if(_0x17a75a[_0x26fe('0x36')]=='from-voip-provider'){_0x17a75a['accountcode']='';_0x17a75a[_0x26fe('0x31')]=extractCalleridNumber(_0x17a75a[_0x26fe('0x37')]);}else if(_0x17a75a[_0x26fe('0x36')]==_0x26fe('0x38')){if(_0x17a75a['destination']=='xcally-motion-preview'){_0x17a75a[_0x26fe('0x31')]=extractCalleridNumber(_0x17a75a[_0x26fe('0x39')]);_0x17a75a[_0x26fe('0x3a')]=_0x17a75a['originatecalleridnum'];_0x17a75a[_0x26fe('0x3b')]=[_0x17a75a['channel'],_0x17a75a['channel']=_0x17a75a[_0x26fe('0x3b')]][0x0];_0x17a75a[_0x26fe('0x37')]=_0x17a75a['calleridpreview'];}else{_0x17a75a['destination']=_0x17a75a[_0x26fe('0x3a')];_0x17a75a[_0x26fe('0x3a')]=_0x17a75a['originatecalleridnum'];if(_0x17a75a[_0x26fe('0x3c')]==_0x26fe('0x3d')){_0x17a75a[_0x26fe('0x20')]=_0x17a75a[_0x26fe('0x28')];}else{_0x17a75a['accountcode']='';}}}}else{_0x17a75a[_0x26fe('0x37')]=util[_0x26fe('0x24')](_0x26fe('0x3e'),_0x17a75a[_0x26fe('0x3f')],_0x17a75a[_0x26fe('0x3a')]);}RpcVoiceCallReport[_0x26fe('0x2f')](_0x17a75a);if(_0x17a75a[_0x26fe('0x40')]){for(var _0x5e9536=0x0;_0x5e9536<_0x17a75a[_0x26fe('0x41')][_0x26fe('0x42')];_0x5e9536+=0x1){_0x17a75a[_0x26fe('0x43')]=_0x17a75a[_0x26fe('0x41')][_0x5e9536][_0x26fe('0x44')];_0x17a75a[_0x26fe('0x45')]=_0x17a75a['monitors'][_0x5e9536]['createdAt'];if(_0x17a75a[_0x26fe('0x46')]==_0x26fe('0x47')){_0x17a75a[_0x26fe('0x3a')]=_0x17a75a['connectedlinenum'];_0x17a75a[_0x26fe('0x3f')]=_0x17a75a[_0x26fe('0x48')];_0x17a75a[_0x26fe('0x28')]=_0x17a75a[_0x26fe('0x20')];_0x17a75a[_0x26fe('0x48')]=_0x17a75a[_0x26fe('0x49')];_0x17a75a[_0x26fe('0x46')]=_0x17a75a['originatecalleridnum'];}else if(_0x17a75a[_0x26fe('0x46')]==_0x26fe('0x4a')){_0x17a75a[_0x26fe('0x3a')]=_0x17a75a['destination'];_0x17a75a['exten']=_0x17a75a[_0x26fe('0x4b')];}RpcVoiceRecording[_0x26fe('0x2f')](_0x17a75a);}}};Report['prototype'][_0x26fe('0x19')]=function(_0x25af91){if(_[_0x26fe('0x4c')](_0x25af91)){_0x25af91[_0x26fe('0x4d')](function(_0x33a4e2){RpcVoiceAgentReport[_0x26fe('0x2f')](_0x33a4e2);});}else{RpcVoiceAgentReport[_0x26fe('0x2f')](_0x25af91);}};Report[_0x26fe('0x25')][_0x26fe('0x4e')]=function(_0x3ce632){RpcVoiceDialReport['create'](_0x3ce632);var _0x5dc27c=undefined;var _0x57ae90=_0x3ce632[_0x26fe('0x4f')];if(_[_0x26fe('0x50')](_0x57ae90,'Local')){var _0x7a6236=_0x57ae90[_0x26fe('0x51')](_0x57ae90[_0x26fe('0x52')]('/')+0x1,_0x57ae90[_0x26fe('0x52')]('@'));_0x5dc27c=_['find'](this[_0x26fe('0x12')],function(_0x5fc293){return _0x5fc293['mobile']==_0x7a6236||_0x5fc293['phone']==_0x7a6236||_0x5fc293['accountcode']==_0x7a6236;});}else{var _0x7a6236=_0x57ae90[_0x26fe('0x51')](_0x57ae90['indexOf']('/')+0x1,_0x57ae90[_0x26fe('0x53')]('-'));_0x5dc27c=this['findAgent'](_0x7a6236);}if(_0x5dc27c){_0x3ce632[_0x26fe('0x23')]=_['isNil'](_0x5dc27c['interface'])?util[_0x26fe('0x24')]('SIP/%s',_0x5dc27c[_0x26fe('0x21')]):_0x5dc27c[_0x26fe('0x23')];_0x3ce632[_0x26fe('0x49')]=_0x5dc27c[_0x26fe('0x21')];_0x3ce632[_0x26fe('0x20')]=_0x5dc27c[_0x26fe('0x20')];RpcMemberReport[_0x26fe('0x4e')](_0x3ce632);}};Report[_0x26fe('0x25')]['blindTransfer']=function(_0x57cc64){RpcVoiceTransferReport['blindTransfer'](_0x57cc64);};Report[_0x26fe('0x25')][_0x26fe('0x1e')]=function(_0x60eb5c){RpcVoiceTransferReport[_0x26fe('0x1e')](_0x60eb5c);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f763341..b4a9a80 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 _0x2a06=['lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','loopSyncRealTimeShow','then','actionDeviceStateList','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','inspect','prototype','resolve','actionSipShowRegistry','isNotNull','isUndefined','emit','find','username','stateRegistry','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','error','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','startsWith','Local','substring','mobile','accountcode','[syncDeviceState][UserReport]','syncPeerStatus','peer','peerstatus','registered','status','address','[syncPeerStatus][UserReport]','exports'];(function(_0x2c5e9b,_0xaec6b){var _0x15ec57=function(_0x547d7b){while(--_0x547d7b){_0x2c5e9b['push'](_0x2c5e9b['shift']());}};_0x15ec57(++_0xaec6b);}(_0x2a06,0x1e3));var _0x62a0=function(_0x3d9cfa,_0x596edc){_0x3d9cfa=_0x3d9cfa-0x0;var _0x21d89d=_0x2a06[_0x3d9cfa];return _0x21d89d;};'use strict';var _=require(_0x62a0('0x0'));var moment=require(_0x62a0('0x1'));var BPromise=require(_0x62a0('0x2'));var util=require(_0x62a0('0x3'));var Redis=require(_0x62a0('0x4'));var config=require(_0x62a0('0x5'));var logger=require(_0x62a0('0x6'))(_0x62a0('0x7'));var ami=require('../ami');config[_0x62a0('0x8')]=_[_0x62a0('0x9')](config['redis'],{'host':_0x62a0('0xa'),'port':0x18eb});var io=require(_0x62a0('0xb'))(new Redis(config[_0x62a0('0x8')]));function UserReport(_0x39ad66){this[_0x62a0('0xc')]=_0x39ad66[_0x62a0('0xc')];this[_0x62a0('0xd')]=_0x39ad66['agents'];this['telephones']=_0x39ad66[_0x62a0('0xe')];ami['on'](_0x62a0('0xf'),this[_0x62a0('0x10')]['bind'](this));ami['on']('registry',this[_0x62a0('0x10')][_0x62a0('0x11')](this));ami['on'](_0x62a0('0x12'),this[_0x62a0('0x13')][_0x62a0('0x11')](this));ami['on']('peerstatus',this['syncPeerStatus'][_0x62a0('0x11')](this));this[_0x62a0('0x14')]();return BPromise['resolve']()['then'](ami['actionSipShowRegistry']())[_0x62a0('0x15')](ami[_0x62a0('0x16')]())[_0x62a0('0x15')](ami[_0x62a0('0x17')]())[_0x62a0('0x18')](loggerCatch(_0x62a0('0x19')));}function loggerCatch(_0x355285){return function(_0x4e1939){logger['error'](_0x355285,util[_0x62a0('0x1a')](_0x4e1939,{'showHidden':![],'depth':null}));};}UserReport[_0x62a0('0x1b')][_0x62a0('0x14')]=function(){setInterval(function(){BPromise[_0x62a0('0x1c')]()[_0x62a0('0x15')](ami[_0x62a0('0x1d')]())[_0x62a0('0x15')](ami[_0x62a0('0x16')]())[_0x62a0('0x15')](ami['actionSipPeerStatus']())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0x62a0('0x1b')][_0x62a0('0x1e')]=function(_0x3cc1d9){return _0x3cc1d9!==null&&!_[_0x62a0('0x1f')](_0x3cc1d9);};UserReport['prototype'][_0x62a0('0x20')]=function(_0x4db416,_0x3fea81,_0x46148e){io['to'](_0x4db416)[_0x62a0('0x20')](_0x3fea81,_0x46148e);};UserReport[_0x62a0('0x1b')][_0x62a0('0x10')]=function(_0x5d5305){try{if(this['isNotNull'](_0x5d5305)){var _0x10f35d=_[_0x62a0('0x21')](this['trunks'],{'registry':_0x5d5305[_0x62a0('0x22')]});if(_0x10f35d){_0x5d5305[_0x62a0('0x23')]=_0x5d5305[_0x62a0('0x24')];_[_0x62a0('0x25')](_0x10f35d,_[_0x62a0('0x26')](_0x5d5305,[_0x62a0('0x27'),_0x62a0('0x28'),_0x62a0('0x22'),_0x62a0('0x24')]));this[_0x62a0('0x20')](util[_0x62a0('0x29')](_0x62a0('0x2a'),_0x10f35d[_0x62a0('0x2b')]),_0x62a0('0x2c'),_0x10f35d);}}}catch(_0x3f46b2){logger[_0x62a0('0x2d')]('[syncRegistry][UserReport]',util[_0x62a0('0x1a')](_0x3f46b2,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x62a0('0x13')]=function(_0x49faf9){try{if(this[_0x62a0('0x1e')](_0x49faf9)){if(this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]]){if(!this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x2f')]||_0x49faf9[_0x62a0('0x24')][_0x62a0('0x30')]()==_0x62a0('0x31')){this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x2f')]=![];if(this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x24')]!==_0x49faf9['state'][_0x62a0('0x30')]()){this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x32')]=_[_0x62a0('0x33')](moment()[_0x62a0('0x29')]('x'));}this[_0x62a0('0xd')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x24')]=_0x49faf9[_0x62a0('0x24')]['toLowerCase']();this['agents'][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x34')](_0x49faf9);}}else if(this[_0x62a0('0xe')][_0x49faf9['device']]){if(this[_0x62a0('0xe')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x24')]!==_0x49faf9[_0x62a0('0x24')]['toLowerCase']()){this['telephones'][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x32')]=_[_0x62a0('0x33')](moment()['format']('x'));}this[_0x62a0('0xe')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x24')]=_0x49faf9[_0x62a0('0x24')][_0x62a0('0x30')]();this[_0x62a0('0x20')](util[_0x62a0('0x29')](_0x62a0('0x35'),this[_0x62a0('0xe')][_0x49faf9['device']][_0x62a0('0x2b')]),_0x62a0('0x36'),this[_0x62a0('0xe')][_0x49faf9[_0x62a0('0x2e')]]);}else if(this[_0x62a0('0xc')][_0x49faf9[_0x62a0('0x2e')]]){if(this[_0x62a0('0xc')][_0x49faf9[_0x62a0('0x2e')]]['state']!==_0x49faf9[_0x62a0('0x24')]['toLowerCase']()){this[_0x62a0('0xc')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x32')]=_[_0x62a0('0x33')](moment()[_0x62a0('0x29')]('x'));}this['trunks'][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x24')]=_0x49faf9[_0x62a0('0x24')][_0x62a0('0x30')]();this[_0x62a0('0x20')](util['format'](_0x62a0('0x2a'),this[_0x62a0('0xc')][_0x49faf9[_0x62a0('0x2e')]][_0x62a0('0x2b')]),_0x62a0('0x2c'),this[_0x62a0('0xc')][_0x49faf9['device']]);}else if(_[_0x62a0('0x37')](_0x49faf9['device'],'Queue')){}else if(_[_0x62a0('0x37')](_0x49faf9['device'],_0x62a0('0x38'))){var _0x1bb9fb=_0x49faf9[_0x62a0('0x2e')];var _0x287244=_0x1bb9fb[_0x62a0('0x39')](_0x1bb9fb['indexOf']('/')+0x1,_0x1bb9fb['indexOf']('@'));var _0x3e2a92=_['find'](this[_0x62a0('0xd')],function(_0x4b0ec1){return _0x4b0ec1[_0x62a0('0x3a')]==_0x287244||_0x4b0ec1['phone']==_0x287244||_0x4b0ec1[_0x62a0('0x3b')]==_0x287244;});if(_0x3e2a92){if(_0x3e2a92[_0x62a0('0x24')]!==_0x49faf9['state'][_0x62a0('0x30')]()){_0x3e2a92['stateTime']=_[_0x62a0('0x33')](moment()[_0x62a0('0x29')]('x'));}_0x3e2a92['state']=_0x49faf9[_0x62a0('0x24')]['toLowerCase']();_0x3e2a92['local']=!![];_0x3e2a92[_0x62a0('0x34')](_0x49faf9);}}else{}}}catch(_0x3228e2){logger[_0x62a0('0x2d')](_0x62a0('0x3c'),util['inspect'](_0x3228e2,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x62a0('0x3d')]=function(_0x5d0120){try{if(this[_0x62a0('0x1e')](_0x5d0120)&&this['isNotNull'](_0x5d0120['peerstatus'])){if(this[_0x62a0('0xd')][_0x5d0120[_0x62a0('0x3e')]]){if(!this[_0x62a0('0xd')][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x2f')]||_0x5d0120[_0x62a0('0x3f')]['toLowerCase']()==_0x62a0('0x40')){this['agents'][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x2f')]=![];this[_0x62a0('0xd')][_0x5d0120['peer']][_0x62a0('0x41')]=_0x5d0120[_0x62a0('0x3f')]['toLowerCase']();this[_0x62a0('0xd')][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x42')]=_0x5d0120[_0x62a0('0x42')];this[_0x62a0('0xd')][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x34')](_0x5d0120);}}else if(this['telephones'][_0x5d0120[_0x62a0('0x3e')]]){this[_0x62a0('0xe')][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x41')]=_0x5d0120['peerstatus'][_0x62a0('0x30')]();this[_0x62a0('0xe')][_0x5d0120['peer']]['address']=_0x5d0120[_0x62a0('0x42')];this[_0x62a0('0x20')](util[_0x62a0('0x29')]('telephone:%s',this['telephones'][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x2b')]),_0x62a0('0x36'),this[_0x62a0('0xe')][_0x5d0120[_0x62a0('0x3e')]]);}else if(this[_0x62a0('0xc')][_0x5d0120[_0x62a0('0x3e')]]){this['trunks'][_0x5d0120['peer']][_0x62a0('0x41')]=_0x5d0120[_0x62a0('0x3f')][_0x62a0('0x30')]();this[_0x62a0('0xc')][_0x5d0120[_0x62a0('0x3e')]][_0x62a0('0x42')]=_0x5d0120['address'];this[_0x62a0('0x20')](util[_0x62a0('0x29')](_0x62a0('0x2a'),this[_0x62a0('0xc')][_0x5d0120['peer']]['name']),_0x62a0('0x2c'),this[_0x62a0('0xc')][_0x5d0120[_0x62a0('0x3e')]]);}else{}}}catch(_0x34421d){logger[_0x62a0('0x2d')](_0x62a0('0x43'),util['inspect'](_0x34421d,{'showHidden':![],'depth':null}));}};module[_0x62a0('0x44')]=UserReport; \ No newline at end of file +var _0x35c2=['toNumber','telephone:save','trunk:save','startsWith','Queue','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[syncDeviceState][UserReport]','peerstatus','peer','address','status','[syncPeerStatus][UserReport]','exports','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionDeviceStateList','catch','[loopSyncRealTimeShow]','inspect','prototype','loopSyncRealTimeShow','actionSipShowRegistry','actionSipPeerStatus','isNotNull','isUndefined','emit','find','username','stateRegistry','state','event','actionid','format','trunk:%s','name','error','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35c2,0x127));var _0x235c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x35c2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var moment=require(_0x235c('0x0'));var BPromise=require(_0x235c('0x1'));var util=require(_0x235c('0x2'));var Redis=require(_0x235c('0x3'));var config=require(_0x235c('0x4'));var logger=require(_0x235c('0x5'))('ami');var ami=require(_0x235c('0x6'));config['redis']=_[_0x235c('0x7')](config[_0x235c('0x8')],{'host':_0x235c('0x9'),'port':0x18eb});var io=require(_0x235c('0xa'))(new Redis(config[_0x235c('0x8')]));function UserReport(_0x5e63fa){this['trunks']=_0x5e63fa[_0x235c('0xb')];this[_0x235c('0xc')]=_0x5e63fa['agents'];this[_0x235c('0xd')]=_0x5e63fa[_0x235c('0xd')];ami['on'](_0x235c('0xe'),this[_0x235c('0xf')][_0x235c('0x10')](this));ami['on'](_0x235c('0x11'),this[_0x235c('0xf')]['bind'](this));ami['on'](_0x235c('0x12'),this[_0x235c('0x13')][_0x235c('0x10')](this));ami['on']('peerstatus',this[_0x235c('0x14')][_0x235c('0x10')](this));this['loopSyncRealTimeShow']();return BPromise[_0x235c('0x15')]()[_0x235c('0x16')](ami['actionSipShowRegistry']())[_0x235c('0x16')](ami[_0x235c('0x17')]())['then'](ami['actionSipPeerStatus']())[_0x235c('0x18')](loggerCatch(_0x235c('0x19')));}function loggerCatch(_0x7ffd68){return function(_0x4f4f6b){logger['error'](_0x7ffd68,util[_0x235c('0x1a')](_0x4f4f6b,{'showHidden':![],'depth':null}));};}UserReport[_0x235c('0x1b')][_0x235c('0x1c')]=function(){setInterval(function(){BPromise[_0x235c('0x15')]()[_0x235c('0x16')](ami[_0x235c('0x1d')]())['then'](ami[_0x235c('0x17')]())[_0x235c('0x16')](ami[_0x235c('0x1e')]())['catch'](loggerCatch(_0x235c('0x19')));},0x32c8);};UserReport[_0x235c('0x1b')][_0x235c('0x1f')]=function(_0x3764ef){return _0x3764ef!==null&&!_[_0x235c('0x20')](_0x3764ef);};UserReport[_0x235c('0x1b')][_0x235c('0x21')]=function(_0x32b19a,_0x2f47b8,_0x2cc3bb){io['to'](_0x32b19a)['emit'](_0x2f47b8,_0x2cc3bb);};UserReport[_0x235c('0x1b')][_0x235c('0xf')]=function(_0x2cedb7){try{if(this[_0x235c('0x1f')](_0x2cedb7)){var _0x4aff01=_[_0x235c('0x22')](this['trunks'],{'registry':_0x2cedb7[_0x235c('0x23')]});if(_0x4aff01){_0x2cedb7[_0x235c('0x24')]=_0x2cedb7[_0x235c('0x25')];_['merge'](_0x4aff01,_['omit'](_0x2cedb7,[_0x235c('0x26'),_0x235c('0x27'),_0x235c('0x23'),'state']));this[_0x235c('0x21')](util[_0x235c('0x28')](_0x235c('0x29'),_0x4aff01[_0x235c('0x2a')]),'trunk:save',_0x4aff01);}}}catch(_0x1ef6a9){logger[_0x235c('0x2b')](_0x235c('0x2c'),util[_0x235c('0x1a')](_0x1ef6a9,{'showHidden':![],'depth':null}));}};UserReport[_0x235c('0x1b')]['syncDeviceState']=function(_0x2f4c36){try{if(this[_0x235c('0x1f')](_0x2f4c36)){if(this['agents'][_0x2f4c36[_0x235c('0x2d')]]){if(!this[_0x235c('0xc')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x2e')]||_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]()==_0x235c('0x30')){this[_0x235c('0xc')][_0x2f4c36['device']]['local']=![];if(this[_0x235c('0xc')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x25')]!==_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]()){this['agents'][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x31')]=_[_0x235c('0x32')](moment()[_0x235c('0x28')]('x'));}this[_0x235c('0xc')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x25')]=_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]();this[_0x235c('0xc')][_0x2f4c36['device']]['updateStatusRealtime'](_0x2f4c36);}}else if(this[_0x235c('0xd')][_0x2f4c36['device']]){if(this[_0x235c('0xd')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x25')]!==_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]()){this[_0x235c('0xd')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x31')]=_[_0x235c('0x32')](moment()[_0x235c('0x28')]('x'));}this[_0x235c('0xd')][_0x2f4c36['device']]['state']=_0x2f4c36[_0x235c('0x25')]['toLowerCase']();this[_0x235c('0x21')](util[_0x235c('0x28')]('telephone:%s',this[_0x235c('0xd')][_0x2f4c36[_0x235c('0x2d')]]['name']),_0x235c('0x33'),this['telephones'][_0x2f4c36[_0x235c('0x2d')]]);}else if(this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]]){if(this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x25')]!==_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]()){this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x31')]=_['toNumber'](moment()[_0x235c('0x28')]('x'));}this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x25')]=_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]();this[_0x235c('0x21')](util[_0x235c('0x28')](_0x235c('0x29'),this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]][_0x235c('0x2a')]),_0x235c('0x34'),this[_0x235c('0xb')][_0x2f4c36[_0x235c('0x2d')]]);}else if(_[_0x235c('0x35')](_0x2f4c36['device'],_0x235c('0x36'))){}else if(_[_0x235c('0x35')](_0x2f4c36[_0x235c('0x2d')],_0x235c('0x37'))){var _0x8643ae=_0x2f4c36[_0x235c('0x2d')];var _0x29fd3a=_0x8643ae[_0x235c('0x38')](_0x8643ae[_0x235c('0x39')]('/')+0x1,_0x8643ae[_0x235c('0x39')]('@'));var _0x48eec7=_[_0x235c('0x22')](this[_0x235c('0xc')],function(_0x44bbcf){return _0x44bbcf[_0x235c('0x3a')]==_0x29fd3a||_0x44bbcf[_0x235c('0x3b')]==_0x29fd3a||_0x44bbcf[_0x235c('0x3c')]==_0x29fd3a;});if(_0x48eec7){if(_0x48eec7[_0x235c('0x25')]!==_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]()){_0x48eec7[_0x235c('0x31')]=_[_0x235c('0x32')](moment()[_0x235c('0x28')]('x'));}_0x48eec7[_0x235c('0x25')]=_0x2f4c36[_0x235c('0x25')][_0x235c('0x2f')]();_0x48eec7[_0x235c('0x2e')]=!![];_0x48eec7[_0x235c('0x3d')](_0x2f4c36);}}else{}}}catch(_0x2668b2){logger['error'](_0x235c('0x3e'),util[_0x235c('0x1a')](_0x2668b2,{'showHidden':![],'depth':null}));}};UserReport[_0x235c('0x1b')][_0x235c('0x14')]=function(_0x4f0816){try{if(this[_0x235c('0x1f')](_0x4f0816)&&this['isNotNull'](_0x4f0816[_0x235c('0x3f')])){if(this[_0x235c('0xc')][_0x4f0816[_0x235c('0x40')]]){if(!this['agents'][_0x4f0816[_0x235c('0x40')]][_0x235c('0x2e')]||_0x4f0816['peerstatus']['toLowerCase']()=='registered'){this['agents'][_0x4f0816[_0x235c('0x40')]][_0x235c('0x2e')]=![];this[_0x235c('0xc')][_0x4f0816[_0x235c('0x40')]]['status']=_0x4f0816[_0x235c('0x3f')][_0x235c('0x2f')]();this[_0x235c('0xc')][_0x4f0816[_0x235c('0x40')]][_0x235c('0x41')]=_0x4f0816[_0x235c('0x41')];this['agents'][_0x4f0816[_0x235c('0x40')]]['updateStatusRealtime'](_0x4f0816);}}else if(this[_0x235c('0xd')][_0x4f0816[_0x235c('0x40')]]){this[_0x235c('0xd')][_0x4f0816['peer']][_0x235c('0x42')]=_0x4f0816['peerstatus'][_0x235c('0x2f')]();this['telephones'][_0x4f0816[_0x235c('0x40')]][_0x235c('0x41')]=_0x4f0816[_0x235c('0x41')];this[_0x235c('0x21')](util[_0x235c('0x28')]('telephone:%s',this[_0x235c('0xd')][_0x4f0816[_0x235c('0x40')]][_0x235c('0x2a')]),_0x235c('0x33'),this['telephones'][_0x4f0816['peer']]);}else if(this['trunks'][_0x4f0816[_0x235c('0x40')]]){this[_0x235c('0xb')][_0x4f0816['peer']]['status']=_0x4f0816[_0x235c('0x3f')][_0x235c('0x2f')]();this['trunks'][_0x4f0816['peer']][_0x235c('0x41')]=_0x4f0816[_0x235c('0x41')];this['emit'](util[_0x235c('0x28')](_0x235c('0x29'),this[_0x235c('0xb')][_0x4f0816[_0x235c('0x40')]][_0x235c('0x2a')]),_0x235c('0x34'),this[_0x235c('0xb')][_0x4f0816['peer']]);}else{}}}catch(_0x167f13){logger[_0x235c('0x2b')](_0x235c('0x43'),util[_0x235c('0x1a')](_0x167f13,{'showHidden':![],'depth':null}));}};module[_0x235c('0x44')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 1f7fdfd..79b0364 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 _0x32ba=['inspect','syncAgentConnect','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','membername','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[syncAgentConnect][VoiceAgentReport]','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','transfer','agent','acw','agentacw','acwtime','acwTimeout','destconnectedlinenum','custom:agentcomplete','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','custom:voiceAgentReport','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','complete','diff','agentconnectAt','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','talktime','seconds','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','localhost','channels','agents','variables','syncAgentCalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','called','voiceQueues','queue','type','merge','omit','event','user:%s','user:called','error','[syncAgentCalled][VoiceAgentReport]'];(function(_0x4aa64d,_0x4bd080){var _0x4f0ad0=function(_0x3e223e){while(--_0x3e223e){_0x4aa64d['push'](_0x4aa64d['shift']());}};_0x4f0ad0(++_0x4bd080);}(_0x32ba,0x140));var _0xa32b=function(_0x470e67,_0x4a596d){_0x470e67=_0x470e67-0x0;var _0x28bbde=_0x32ba[_0x470e67];return _0x28bbde;};'use strict';var _=require(_0xa32b('0x0'));var moment=require(_0xa32b('0x1'));var util=require(_0xa32b('0x2'));var Redis=require(_0xa32b('0x3'));var config=require('../../../config/environment');var logger=require(_0xa32b('0x4'))(_0xa32b('0x5'));var ami=require(_0xa32b('0x6'));config['redis']=_[_0xa32b('0x7')](config[_0xa32b('0x8')],{'host':_0xa32b('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa32b('0x8')]));function VoiceAgentReport(_0x37b413){this[_0xa32b('0xa')]={};this['voiceQueues']=_0x37b413['voiceQueues'];this[_0xa32b('0xb')]=_0x37b413[_0xa32b('0xb')];this[_0xa32b('0xc')]={};ami['on']('agentcalled',this[_0xa32b('0xd')][_0xa32b('0xe')](this));ami['on'](_0xa32b('0xf'),this['syncAgentConnect'][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x10'),this[_0xa32b('0x11')][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x12'),this['syncQueueCallerAbandon'][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x13'),this[_0xa32b('0x14')]['bind'](this));ami['on'](_0xa32b('0x15'),this[_0xa32b('0x16')][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x17'),this[_0xa32b('0x18')][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x19'),this[_0xa32b('0x1a')][_0xa32b('0xe')](this));ami['on'](_0xa32b('0x1b'),this[_0xa32b('0x1c')][_0xa32b('0xe')](this));ami['on']('attendedtransfer',this[_0xa32b('0x1d')]['bind'](this));ami['on'](_0xa32b('0x1e'),this['syncBlindTransfer'][_0xa32b('0xe')](this));}VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x20')]=function(_0x56f95f,_0x3e89e1,_0x2955fd){io['to'](_0x56f95f)[_0xa32b('0x20')](_0x3e89e1,_0x2955fd);};VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x21')]=function(_0x1ac995){return _0x1ac995!==null&&!_[_0xa32b('0x22')](_0x1ac995);};VoiceAgentReport['prototype'][_0xa32b('0xd')]=function(_0x4465e4){try{if(this['isNotNull'](_0x4465e4)){if(_[_0xa32b('0x22')](this['channels'][_0x4465e4[_0xa32b('0x23')]])){this[_0xa32b('0xa')][_0x4465e4[_0xa32b('0x23')]]={};}if(_['isUndefined'](this[_0xa32b('0xa')][_0x4465e4['uniqueid']][_0x4465e4[_0xa32b('0x24')]])){this[_0xa32b('0xa')][_0x4465e4[_0xa32b('0x23')]][_0x4465e4[_0xa32b('0x24')]]={'agentcalledAt':moment()[_0xa32b('0x25')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xa32b('0x26'),'variables':this['variables'][_0x4465e4[_0xa32b('0x23')]],'type':this[_0xa32b('0x27')][_0x4465e4[_0xa32b('0x28')]]?this[_0xa32b('0x27')][_0x4465e4['queue']][_0xa32b('0x29')]||'inbound':'inbound'};}_[_0xa32b('0x2a')](this[_0xa32b('0xa')][_0x4465e4[_0xa32b('0x23')]][_0x4465e4[_0xa32b('0x24')]],_[_0xa32b('0x2b')](_0x4465e4,[_0xa32b('0x2c'),'privilege']));ami[_0xa32b('0x20')]('custom:agentcalled',this['channels'][_0x4465e4['uniqueid']][_0x4465e4['destuniqueid']]);this[_0xa32b('0x20')](util[_0xa32b('0x25')](_0xa32b('0x2d'),_0x4465e4['membername']),_0xa32b('0x2e'),this[_0xa32b('0xa')][_0x4465e4[_0xa32b('0x23')]][_0x4465e4[_0xa32b('0x24')]]);}}catch(_0x28b0e3){logger[_0xa32b('0x2f')](_0xa32b('0x30'),util[_0xa32b('0x31')](_0x28b0e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x32')]=function(_0x43fa1d){try{if(this['isNotNull'](_0x43fa1d)){if(this['channels'][_0x43fa1d[_0xa32b('0x23')]]){for(var _0x10c5e6 in this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]]){if(this[_0xa32b('0xa')][_0x43fa1d['uniqueid']][_0xa32b('0x33')](_0x10c5e6)){if(_0x43fa1d[_0xa32b('0x24')]===_0x10c5e6){this[_0xa32b('0xa')][_0x43fa1d['uniqueid']][_0x10c5e6]['agentconnectAt']=moment()[_0xa32b('0x25')](_0xa32b('0x34'));this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x35')]=_0xa32b('0x36');this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x37')]=_0x43fa1d[_0xa32b('0x37')];this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]['connectedlinenum']=_0x43fa1d[_0xa32b('0x38')];this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]['connectedlinename']=_0x43fa1d[_0xa32b('0x39')];this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]['destchannelstate']=_0x43fa1d[_0xa32b('0x3a')];this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x3b')]=_0x43fa1d['destchannelstatedesc'];_[_0xa32b('0x2a')](this[_0xa32b('0xb')][_0x43fa1d[_0xa32b('0x3c')]],_[_0xa32b('0x3d')](_0x43fa1d,[_0xa32b('0x28'),'destconnectedlinenum']));this[_0xa32b('0x20')](util[_0xa32b('0x25')]('user:%s',_0x43fa1d[_0xa32b('0x3e')]),_0xa32b('0x3f'),this['channels'][_0x43fa1d[_0xa32b('0x23')]][_0x43fa1d['destuniqueid']]);ami[_0xa32b('0x20')](_0xa32b('0x40'),this['channels'][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]);}else if(!this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x10')]&&!this[_0xa32b('0xa')][_0x43fa1d['uniqueid']][_0x10c5e6][_0xa32b('0x13')]){this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x10')]=!![];this['channels'][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x41')]=moment()[_0xa32b('0x25')](_0xa32b('0x34'));this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x42')]=_0xa32b('0x43');this['channels'][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]['lastevent']='answered_elsewhere';this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6][_0xa32b('0x44')]=_0x43fa1d[_0xa32b('0x24')];this[_0xa32b('0xa')][_0x43fa1d['uniqueid']][_0x10c5e6][_0xa32b('0x45')]=_0x43fa1d[_0xa32b('0x3e')];ami[_0xa32b('0x20')]('custom:agentansweredelsewhere',this[_0xa32b('0xa')][_0x43fa1d[_0xa32b('0x23')]][_0x10c5e6]);}}}}}}catch(_0x96da5f){logger[_0xa32b('0x2f')](_0xa32b('0x46'),util[_0xa32b('0x31')](_0x96da5f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x11')]=function(_0x4d70d2){try{if(this[_0xa32b('0x21')](_0x4d70d2)){if(this[_0xa32b('0xa')][_0x4d70d2['uniqueid']]&&this['channels'][_0x4d70d2[_0xa32b('0x23')]][_0x4d70d2[_0xa32b('0x24')]]){this[_0xa32b('0xa')][_0x4d70d2[_0xa32b('0x23')]][_0x4d70d2['destuniqueid']][_0xa32b('0x10')]=!![];this[_0xa32b('0xa')][_0x4d70d2[_0xa32b('0x23')]][_0x4d70d2[_0xa32b('0x24')]][_0xa32b('0x41')]=moment()[_0xa32b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa32b('0xa')][_0x4d70d2['uniqueid']][_0x4d70d2[_0xa32b('0x24')]]['reason']=_0xa32b('0x47');this[_0xa32b('0xa')][_0x4d70d2[_0xa32b('0x23')]][_0x4d70d2[_0xa32b('0x24')]][_0xa32b('0x35')]='rejected';ami['emit']('custom:agentringnoanswer',this[_0xa32b('0xa')][_0x4d70d2[_0xa32b('0x23')]][_0x4d70d2[_0xa32b('0x24')]]);}}}catch(_0x5c336a){logger[_0xa32b('0x2f')](_0xa32b('0x48'),util[_0xa32b('0x31')](_0x5c336a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')]['syncQueueCallerAbandon']=function(_0x4f098d){try{if(this['isNotNull'](_0x4f098d)){if(this['channels'][_0x4f098d['uniqueid']]){for(var _0x1c73bc in this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]]){if(this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0xa32b('0x33')](_0x1c73bc)&&!this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc]['agentringnoanswer']&&!this['channels'][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc]['agentcomplete']){this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc][_0xa32b('0x10')]=!![];this['channels'][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc][_0xa32b('0x41')]=moment()[_0xa32b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc][_0xa32b('0x42')]=_0xa32b('0x49');this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc][_0xa32b('0x35')]=_0xa32b('0x49');ami['emit'](_0xa32b('0x4a'),this[_0xa32b('0xa')][_0x4f098d[_0xa32b('0x23')]][_0x1c73bc]);}}}}}catch(_0xf9f379){logger[_0xa32b('0x2f')](_0xa32b('0x4b'),util['inspect'](_0xf9f379,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x14')]=function(_0x11972c){try{if(this[_0xa32b('0x21')](_0x11972c)){if(this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]]){for(var _0x40b42d in this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]]){if(this['channels'][_0x11972c[_0xa32b('0x23')]][_0xa32b('0x33')](_0x40b42d)){if(this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d]['agentconnectAt']&&!this['channels'][_0x11972c['uniqueid']][_0x40b42d][_0xa32b('0x13')]){this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d][_0xa32b('0x13')]=!![];this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d][_0xa32b('0x4c')]=moment()[_0xa32b('0x25')](_0xa32b('0x34'));this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d][_0xa32b('0x35')]='complete';this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d]['talktime']=_0x11972c['talktime'];this[_0xa32b('0xa')][_0x11972c['uniqueid']][_0x40b42d]['reason']=_0x11972c[_0xa32b('0x42')]==_0xa32b('0x4d')?_0xa32b('0x4e'):_0x11972c[_0xa32b('0x42')];if(this[_0xa32b('0x27')][_0x11972c[_0xa32b('0x28')]]&&this[_0xa32b('0x27')][_0x11972c[_0xa32b('0x28')]][_0xa32b('0x4f')]){this['channels'][_0x11972c[_0xa32b('0x23')]][_0x40b42d][_0xa32b('0x50')]=!![];this[_0xa32b('0xa')][_0x11972c['uniqueid']][_0x40b42d][_0xa32b('0x51')]=this[_0xa32b('0x27')][_0x11972c['queue']][_0xa32b('0x52')];}this[_0xa32b('0xb')][_0x11972c['interface']]=_[_0xa32b('0x2b')](this[_0xa32b('0xb')][_0x11972c[_0xa32b('0x3c')]],[_0xa32b('0x28'),_0xa32b('0x53')]);this[_0xa32b('0x20')](util[_0xa32b('0x25')](_0xa32b('0x2d'),_0x11972c[_0xa32b('0x3e')]),'user:agentcomplete',this[_0xa32b('0xa')][_0x11972c[_0xa32b('0x23')]][_0x40b42d]);ami[_0xa32b('0x20')](_0xa32b('0x54'),this['channels'][_0x11972c[_0xa32b('0x23')]][_0x40b42d]);}}}}}}catch(_0x438c69){logger[_0xa32b('0x2f')]('[syncAgentComplete][VoiceAgentReport]',util['inspect'](_0x438c69,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa32b('0x16')]=function(_0x388d10){try{if(this[_0xa32b('0x21')](_0x388d10)){this[_0xa32b('0x55')](_0x388d10['uniqueid'],_[_0xa32b('0x56')](_0x388d10[_0xa32b('0x57')])[0x0],_0x388d10[_0xa32b('0x58')]);if(this[_0xa32b('0xa')][_0x388d10['uniqueid']]){for(var _0x237919 in this['channels'][_0x388d10['uniqueid']]){if(this[_0xa32b('0xa')][_0x388d10[_0xa32b('0x23')]][_0xa32b('0x33')](_0x237919)){if(_[_0xa32b('0x22')](this[_0xa32b('0xa')][_0x388d10[_0xa32b('0x23')]][_0x237919][_0xa32b('0xc')])){this[_0xa32b('0xa')][_0x388d10[_0xa32b('0x23')]][_0x237919][_0xa32b('0xc')]={};}this[_0xa32b('0xa')][_0x388d10[_0xa32b('0x23')]][_0x237919][_0xa32b('0xc')]=this[_0xa32b('0xc')][_0x388d10[_0xa32b('0x23')]];}}}}}catch(_0x353831){logger[_0xa32b('0x2f')](_0xa32b('0x59'),util[_0xa32b('0x31')](_0x353831,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')]['addVariable']=function(_0x29f58f,_0x4d2326,_0x1d1366){var _0x3f2220=['rtpaudioqos','rtpaudioqosbridged',_0xa32b('0x5a'),_0xa32b('0x5b'),_0xa32b('0x5c'),_0xa32b('0x5d'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xa32b('0x5e'),'sipuri',_0xa32b('0x5f'),_0xa32b('0x60'),_0xa32b('0x61'),'memberdynamic',_0xa32b('0x62'),_0xa32b('0x63'),_0xa32b('0x3e'),_0xa32b('0x64'),_0xa32b('0x65')];if(!_[_0xa32b('0x66')](_0x4d2326)&&!_[_0xa32b('0x67')](_0x3f2220,_0x4d2326)){if(_[_0xa32b('0x22')](this['variables'][_0x29f58f])){this[_0xa32b('0xc')][_0x29f58f]={};}this[_0xa32b('0xc')][_0x29f58f][_0x4d2326]=_0x1d1366;}};VoiceAgentReport['prototype'][_0xa32b('0x18')]=function(_0x5e4c3d){try{if(this[_0xa32b('0x21')](_0x5e4c3d)){if(this[_0xa32b('0xa')][_0x5e4c3d[_0xa32b('0x23')]]){for(var _0x111b12 in this[_0xa32b('0xa')][_0x5e4c3d['uniqueid']]){if(this['channels'][_0x5e4c3d[_0xa32b('0x23')]][_0xa32b('0x33')](_0x111b12)){if(this[_0xa32b('0xa')][_0x5e4c3d[_0xa32b('0x23')]][_0x111b12][_0xa32b('0x42')]==_0xa32b('0x4d')&&this['channels'][_0x5e4c3d[_0xa32b('0x23')]][_0x111b12][_0xa32b('0x13')]){this[_0xa32b('0xa')][_0x5e4c3d[_0xa32b('0x23')]][_0x111b12][_0xa32b('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0xa32b('0x20')](_0xa32b('0x68'),_['values'](this[_0xa32b('0xa')][_0x5e4c3d[_0xa32b('0x23')]]));delete this[_0xa32b('0xa')][_0x5e4c3d[_0xa32b('0x23')]];}if(this[_0xa32b('0xc')][_0x5e4c3d[_0xa32b('0x23')]]){delete this[_0xa32b('0xc')][_0x5e4c3d[_0xa32b('0x23')]];}}}catch(_0xdd85f1){logger['error'](_0xa32b('0x69'),util[_0xa32b('0x31')](_0xdd85f1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')]['syncAttendedTransfer']=function(_0x1e2c26){try{if(this[_0xa32b('0x21')](_0x1e2c26)){if(this[_0xa32b('0xa')][_0x1e2c26['transfereeuniqueid']]){for(var _0x2b6f10 in this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]]){if(this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]]['hasOwnProperty'](_0x2b6f10)){if(_0x1e2c26[_0xa32b('0x6b')]===_0x2b6f10){var _0x260679=moment();this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]][_0x2b6f10][_0xa32b('0x13')]=!![];this[_0xa32b('0xa')][_0x1e2c26['transfereeuniqueid']][_0x2b6f10][_0xa32b('0x4c')]=moment()[_0xa32b('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]][_0x2b6f10][_0xa32b('0x42')]=_0xa32b('0x4d');this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]][_0x2b6f10]['lastevent']=_0xa32b('0x6c');this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]][_0x2b6f10]['talktime']=_0x260679[_0xa32b('0x6d')](this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]][_0x2b6f10][_0xa32b('0x6e')],'seconds');}}}}if(this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6f')]]){var _0x4350f2=this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6f')]];this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6f')]]=this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]];this[_0xa32b('0xa')][_0x1e2c26[_0xa32b('0x6a')]]=_0x4350f2;}}}catch(_0x69a4e6){logger[_0xa32b('0x2f')](_0xa32b('0x70'),util[_0xa32b('0x31')](_0x69a4e6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')]['syncBlindTransfer']=function(_0x40c022){try{if(this[_0xa32b('0x21')](_0x40c022)){if(this[_0xa32b('0xa')][_0x40c022[_0xa32b('0x6a')]]){for(var _0x305fd2 in this[_0xa32b('0xa')][_0x40c022[_0xa32b('0x6a')]]){if(this[_0xa32b('0xa')][_0x40c022['transfereeuniqueid']][_0xa32b('0x33')](_0x305fd2)){if(_0x40c022[_0xa32b('0x71')]===_0x305fd2){var _0x4f6e53=moment();this[_0xa32b('0xa')][_0x40c022['transfereeuniqueid']][_0x305fd2]['agentcomplete']=!![];this[_0xa32b('0xa')][_0x40c022['transfereeuniqueid']][_0x305fd2][_0xa32b('0x4c')]=_0x4f6e53;this[_0xa32b('0xa')][_0x40c022[_0xa32b('0x6a')]][_0x305fd2]['reason']=_0xa32b('0x4d');this['channels'][_0x40c022[_0xa32b('0x6a')]][_0x305fd2][_0xa32b('0x35')]=_0xa32b('0x6c');this['channels'][_0x40c022[_0xa32b('0x6a')]][_0x305fd2][_0xa32b('0x72')]=_0x4f6e53['diff'](this[_0xa32b('0xa')][_0x40c022[_0xa32b('0x6a')]][_0x305fd2][_0xa32b('0x6e')],_0xa32b('0x73'));}}}}}}catch(_0x5ac8bd){logger[_0xa32b('0x2f')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xa32b('0x31')](_0x5ac8bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xa32b('0x1a')]=function(_0x44f81b){var _0x4f52fb='';try{if(this[_0xa32b('0x21')](_0x44f81b)){if(_0x44f81b['channel']){_0x4f52fb=_0x44f81b[_0xa32b('0x74')][_0xa32b('0x75')](0x0,_0x44f81b[_0xa32b('0x74')]['lastIndexOf']('-'));if(this[_0xa32b('0xb')][_0x4f52fb]){this[_0xa32b('0xb')][_0x4f52fb][_0xa32b('0x76')]=!![];}}}}catch(_0x5d10a9){logger[_0xa32b('0x2f')](_0xa32b('0x77'),util['inspect'](_0x5d10a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xa32b('0x1f')][_0xa32b('0x1c')]=function(_0x204534){var _0x23e858='';try{if(this[_0xa32b('0x21')](_0x204534)){if(_0x204534['channel']){_0x23e858=_0x204534[_0xa32b('0x74')][_0xa32b('0x75')](0x0,_0x204534[_0xa32b('0x74')][_0xa32b('0x78')]('-'));if(this['agents'][_0x23e858]){this['agents'][_0x23e858][_0xa32b('0x76')]=![];}}}}catch(_0x5471c8){logger[_0xa32b('0x2f')](_0xa32b('0x79'),util['inspect'](_0x5471c8,{'showHidden':![],'depth':null}));}};module[_0xa32b('0x7a')]=VoiceAgentReport; \ No newline at end of file +var _0x4cf0=['type','inbound','merge','event','privilege','custom:agentcalled','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','syncAgentConnect','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','agentringnoanswer','agentcomplete','agentringnoanswerAt','reason','lastevent','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','syncAgentComplete','complete','talktime','transfer','agent','acw','acwtime','omit','[syncAgentComplete][VoiceAgentReport]','addVariable','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','syncMusicOnHoldStart','channel','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','voiceQueues','agents','variables','agentcalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','varset','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','channels','uniqueid','destuniqueid','format','called','queue'];(function(_0x2f2fd7,_0x48216b){var _0x54a629=function(_0x1d6817){while(--_0x1d6817){_0x2f2fd7['push'](_0x2f2fd7['shift']());}};_0x54a629(++_0x48216b);}(_0x4cf0,0x156));var _0x04cf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4cf0[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x04cf('0x0'));var moment=require(_0x04cf('0x1'));var util=require('util');var Redis=require(_0x04cf('0x2'));var config=require(_0x04cf('0x3'));var logger=require(_0x04cf('0x4'))(_0x04cf('0x5'));var ami=require(_0x04cf('0x6'));config[_0x04cf('0x7')]=_['defaults'](config[_0x04cf('0x7')],{'host':_0x04cf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x04cf('0x7')]));function VoiceAgentReport(_0x328114){this['channels']={};this[_0x04cf('0x9')]=_0x328114['voiceQueues'];this['agents']=_0x328114[_0x04cf('0xa')];this[_0x04cf('0xb')]={};ami['on'](_0x04cf('0xc'),this['syncAgentCalled'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0xe'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0xf'),this[_0x04cf('0x10')][_0x04cf('0xd')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0x11'),this[_0x04cf('0x12')][_0x04cf('0xd')](this));ami['on']('hangup',this[_0x04cf('0x13')][_0x04cf('0xd')](this));ami['on'](_0x04cf('0x14'),this['syncMusicOnHoldStart'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0x15'),this['syncMusicOnHoldStop'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0x16'),this['syncAttendedTransfer'][_0x04cf('0xd')](this));ami['on'](_0x04cf('0x17'),this[_0x04cf('0x18')]['bind'](this));}VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x1a')]=function(_0x358f1f,_0x18b4fe,_0x5d46b5){io['to'](_0x358f1f)[_0x04cf('0x1a')](_0x18b4fe,_0x5d46b5);};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x1b')]=function(_0x3841ef){return _0x3841ef!==null&&!_[_0x04cf('0x1c')](_0x3841ef);};VoiceAgentReport['prototype'][_0x04cf('0x1d')]=function(_0x5006e9){try{if(this[_0x04cf('0x1b')](_0x5006e9)){if(_[_0x04cf('0x1c')](this['channels'][_0x5006e9['uniqueid']])){this[_0x04cf('0x1e')][_0x5006e9[_0x04cf('0x1f')]]={};}if(_[_0x04cf('0x1c')](this['channels'][_0x5006e9[_0x04cf('0x1f')]][_0x5006e9[_0x04cf('0x20')]])){this['channels'][_0x5006e9['uniqueid']][_0x5006e9[_0x04cf('0x20')]]={'agentcalledAt':moment()[_0x04cf('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x04cf('0x22'),'variables':this[_0x04cf('0xb')][_0x5006e9[_0x04cf('0x1f')]],'type':this[_0x04cf('0x9')][_0x5006e9[_0x04cf('0x23')]]?this[_0x04cf('0x9')][_0x5006e9[_0x04cf('0x23')]][_0x04cf('0x24')]||_0x04cf('0x25'):_0x04cf('0x25')};}_[_0x04cf('0x26')](this[_0x04cf('0x1e')][_0x5006e9[_0x04cf('0x1f')]][_0x5006e9[_0x04cf('0x20')]],_['omit'](_0x5006e9,[_0x04cf('0x27'),_0x04cf('0x28')]));ami['emit'](_0x04cf('0x29'),this['channels'][_0x5006e9['uniqueid']][_0x5006e9['destuniqueid']]);this[_0x04cf('0x1a')](util[_0x04cf('0x21')](_0x04cf('0x2a'),_0x5006e9[_0x04cf('0x2b')]),_0x04cf('0x2c'),this[_0x04cf('0x1e')][_0x5006e9['uniqueid']][_0x5006e9[_0x04cf('0x20')]]);}}catch(_0x7b8f0e){logger[_0x04cf('0x2d')](_0x04cf('0x2e'),util[_0x04cf('0x2f')](_0x7b8f0e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x30')]=function(_0x43fc49){try{if(this[_0x04cf('0x1b')](_0x43fc49)){if(this[_0x04cf('0x1e')][_0x43fc49['uniqueid']]){for(var _0x5d98a8 in this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]]){if(this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x04cf('0x31')](_0x5d98a8)){if(_0x43fc49[_0x04cf('0x20')]===_0x5d98a8){this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x32')]=moment()[_0x04cf('0x21')](_0x04cf('0x33'));this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8]['lastevent']=_0x04cf('0x34');this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x35')]=_0x43fc49[_0x04cf('0x35')];this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x36')]=_0x43fc49[_0x04cf('0x36')];this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8]['connectedlinename']=_0x43fc49[_0x04cf('0x37')];this[_0x04cf('0x1e')][_0x43fc49['uniqueid']][_0x5d98a8][_0x04cf('0x38')]=_0x43fc49[_0x04cf('0x38')];this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x39')]=_0x43fc49[_0x04cf('0x39')];_[_0x04cf('0x26')](this[_0x04cf('0xa')][_0x43fc49[_0x04cf('0x3a')]],_[_0x04cf('0x3b')](_0x43fc49,[_0x04cf('0x23'),_0x04cf('0x3c')]));this['emit'](util[_0x04cf('0x21')](_0x04cf('0x2a'),_0x43fc49[_0x04cf('0x2b')]),_0x04cf('0x3d'),this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x43fc49[_0x04cf('0x20')]]);ami[_0x04cf('0x1a')]('custom:agentconnect',this['channels'][_0x43fc49['uniqueid']][_0x5d98a8]);}else if(!this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x3e')]&&!this[_0x04cf('0x1e')][_0x43fc49['uniqueid']][_0x5d98a8][_0x04cf('0x3f')]){this['channels'][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x3e')]=!![];this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x40')]=moment()[_0x04cf('0x21')](_0x04cf('0x33'));this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x41')]='answered_elsewhere';this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x42')]='answered_elsewhere';this[_0x04cf('0x1e')][_0x43fc49[_0x04cf('0x1f')]][_0x5d98a8][_0x04cf('0x43')]=_0x43fc49[_0x04cf('0x20')];this[_0x04cf('0x1e')][_0x43fc49['uniqueid']][_0x5d98a8][_0x04cf('0x44')]=_0x43fc49[_0x04cf('0x2b')];ami['emit'](_0x04cf('0x45'),this[_0x04cf('0x1e')][_0x43fc49['uniqueid']][_0x5d98a8]);}}}}}}catch(_0x5b15c4){logger[_0x04cf('0x2d')](_0x04cf('0x46'),util[_0x04cf('0x2f')](_0x5b15c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x47')]=function(_0x49204d){try{if(this[_0x04cf('0x1b')](_0x49204d)){if(this['channels'][_0x49204d[_0x04cf('0x1f')]]&&this[_0x04cf('0x1e')][_0x49204d[_0x04cf('0x1f')]][_0x49204d[_0x04cf('0x20')]]){this[_0x04cf('0x1e')][_0x49204d[_0x04cf('0x1f')]][_0x49204d['destuniqueid']]['agentringnoanswer']=!![];this[_0x04cf('0x1e')][_0x49204d[_0x04cf('0x1f')]][_0x49204d['destuniqueid']][_0x04cf('0x40')]=moment()['format'](_0x04cf('0x33'));this['channels'][_0x49204d[_0x04cf('0x1f')]][_0x49204d[_0x04cf('0x20')]][_0x04cf('0x41')]='rejected';this[_0x04cf('0x1e')][_0x49204d[_0x04cf('0x1f')]][_0x49204d[_0x04cf('0x20')]]['lastevent']=_0x04cf('0x48');ami['emit'](_0x04cf('0x49'),this[_0x04cf('0x1e')][_0x49204d[_0x04cf('0x1f')]][_0x49204d[_0x04cf('0x20')]]);}}}catch(_0x26768d){logger['error']('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x04cf('0x2f')](_0x26768d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x10')]=function(_0x431c4c){try{if(this[_0x04cf('0x1b')](_0x431c4c)){if(this['channels'][_0x431c4c[_0x04cf('0x1f')]]){for(var _0x25719b in this[_0x04cf('0x1e')][_0x431c4c[_0x04cf('0x1f')]]){if(this[_0x04cf('0x1e')][_0x431c4c['uniqueid']][_0x04cf('0x31')](_0x25719b)&&!this[_0x04cf('0x1e')][_0x431c4c[_0x04cf('0x1f')]][_0x25719b][_0x04cf('0x3e')]&&!this[_0x04cf('0x1e')][_0x431c4c[_0x04cf('0x1f')]][_0x25719b][_0x04cf('0x3f')]){this[_0x04cf('0x1e')][_0x431c4c['uniqueid']][_0x25719b][_0x04cf('0x3e')]=!![];this[_0x04cf('0x1e')][_0x431c4c['uniqueid']][_0x25719b][_0x04cf('0x40')]=moment()[_0x04cf('0x21')](_0x04cf('0x33'));this['channels'][_0x431c4c['uniqueid']][_0x25719b][_0x04cf('0x41')]=_0x04cf('0x4a');this[_0x04cf('0x1e')][_0x431c4c['uniqueid']][_0x25719b]['lastevent']=_0x04cf('0x4a');ami[_0x04cf('0x1a')](_0x04cf('0x4b'),this[_0x04cf('0x1e')][_0x431c4c[_0x04cf('0x1f')]][_0x25719b]);}}}}}catch(_0x3f4128){logger[_0x04cf('0x2d')](_0x04cf('0x4c'),util[_0x04cf('0x2f')](_0x3f4128,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x4d')]=function(_0x4d9917){try{if(this[_0x04cf('0x1b')](_0x4d9917)){if(this[_0x04cf('0x1e')][_0x4d9917[_0x04cf('0x1f')]]){for(var _0x1116a8 in this[_0x04cf('0x1e')][_0x4d9917['uniqueid']]){if(this['channels'][_0x4d9917['uniqueid']]['hasOwnProperty'](_0x1116a8)){if(this[_0x04cf('0x1e')][_0x4d9917['uniqueid']][_0x1116a8][_0x04cf('0x32')]&&!this['channels'][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8][_0x04cf('0x3f')]){this[_0x04cf('0x1e')][_0x4d9917['uniqueid']][_0x1116a8]['agentcomplete']=!![];this[_0x04cf('0x1e')][_0x4d9917['uniqueid']][_0x1116a8]['agentcompleteAt']=moment()[_0x04cf('0x21')](_0x04cf('0x33'));this[_0x04cf('0x1e')][_0x4d9917['uniqueid']][_0x1116a8][_0x04cf('0x42')]=_0x04cf('0x4e');this[_0x04cf('0x1e')][_0x4d9917['uniqueid']][_0x1116a8][_0x04cf('0x4f')]=_0x4d9917['talktime'];this[_0x04cf('0x1e')][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8][_0x04cf('0x41')]=_0x4d9917[_0x04cf('0x41')]==_0x04cf('0x50')?_0x04cf('0x51'):_0x4d9917[_0x04cf('0x41')];if(this['voiceQueues'][_0x4d9917[_0x04cf('0x23')]]&&this[_0x04cf('0x9')][_0x4d9917[_0x04cf('0x23')]][_0x04cf('0x52')]){this[_0x04cf('0x1e')][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8]['agentacw']=!![];this['channels'][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8][_0x04cf('0x53')]=this[_0x04cf('0x9')][_0x4d9917['queue']]['acwTimeout'];}this['agents'][_0x4d9917[_0x04cf('0x3a')]]=_[_0x04cf('0x54')](this[_0x04cf('0xa')][_0x4d9917[_0x04cf('0x3a')]],[_0x04cf('0x23'),'destconnectedlinenum']);this['emit'](util[_0x04cf('0x21')]('user:%s',_0x4d9917[_0x04cf('0x2b')]),'user:agentcomplete',this['channels'][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8]);ami[_0x04cf('0x1a')]('custom:agentcomplete',this['channels'][_0x4d9917[_0x04cf('0x1f')]][_0x1116a8]);}}}}}}catch(_0x14b93e){logger[_0x04cf('0x2d')](_0x04cf('0x55'),util['inspect'](_0x14b93e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x12')]=function(_0x32c6eb){try{if(this[_0x04cf('0x1b')](_0x32c6eb)){this[_0x04cf('0x56')](_0x32c6eb['uniqueid'],_['keys'](_0x32c6eb[_0x04cf('0x57')])[0x0],_0x32c6eb['value']);if(this['channels'][_0x32c6eb[_0x04cf('0x1f')]]){for(var _0x277058 in this['channels'][_0x32c6eb[_0x04cf('0x1f')]]){if(this['channels'][_0x32c6eb[_0x04cf('0x1f')]][_0x04cf('0x31')](_0x277058)){if(_[_0x04cf('0x1c')](this[_0x04cf('0x1e')][_0x32c6eb[_0x04cf('0x1f')]][_0x277058][_0x04cf('0xb')])){this[_0x04cf('0x1e')][_0x32c6eb[_0x04cf('0x1f')]][_0x277058][_0x04cf('0xb')]={};}this['channels'][_0x32c6eb['uniqueid']][_0x277058][_0x04cf('0xb')]=this[_0x04cf('0xb')][_0x32c6eb[_0x04cf('0x1f')]];}}}}}catch(_0x27cad8){logger['error'](_0x04cf('0x58'),util[_0x04cf('0x2f')](_0x27cad8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x56')]=function(_0x5000dc,_0xba7a38,_0x4a13e6){var _0x255d80=[_0x04cf('0x59'),_0x04cf('0x5a'),_0x04cf('0x5b'),_0x04cf('0x5c'),_0x04cf('0x5d'),_0x04cf('0x5e'),_0x04cf('0x5f'),_0x04cf('0x60'),'sipcallid',_0x04cf('0x61'),_0x04cf('0x62'),_0x04cf('0x63'),'membercalls',_0x04cf('0x64'),_0x04cf('0x65'),_0x04cf('0x66'),_0x04cf('0x2b'),_0x04cf('0x67'),_0x04cf('0x68')];if(!_['isNil'](_0xba7a38)&&!_[_0x04cf('0x69')](_0x255d80,_0xba7a38)){if(_[_0x04cf('0x1c')](this[_0x04cf('0xb')][_0x5000dc])){this[_0x04cf('0xb')][_0x5000dc]={};}this[_0x04cf('0xb')][_0x5000dc][_0xba7a38]=_0x4a13e6;}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x13')]=function(_0x3c7706){try{if(this[_0x04cf('0x1b')](_0x3c7706)){if(this[_0x04cf('0x1e')][_0x3c7706[_0x04cf('0x1f')]]){for(var _0x3acdec in this['channels'][_0x3c7706['uniqueid']]){if(this[_0x04cf('0x1e')][_0x3c7706[_0x04cf('0x1f')]]['hasOwnProperty'](_0x3acdec)){if(this[_0x04cf('0x1e')][_0x3c7706['uniqueid']][_0x3acdec][_0x04cf('0x41')]=='transfer'&&this[_0x04cf('0x1e')][_0x3c7706[_0x04cf('0x1f')]][_0x3acdec]['agentcomplete']){this[_0x04cf('0x1e')][_0x3c7706['uniqueid']][_0x3acdec][_0x04cf('0x6a')]=moment()['format'](_0x04cf('0x33'));}}}ami[_0x04cf('0x1a')](_0x04cf('0x6b'),_[_0x04cf('0x6c')](this[_0x04cf('0x1e')][_0x3c7706['uniqueid']]));delete this[_0x04cf('0x1e')][_0x3c7706[_0x04cf('0x1f')]];}if(this[_0x04cf('0xb')][_0x3c7706[_0x04cf('0x1f')]]){delete this[_0x04cf('0xb')][_0x3c7706[_0x04cf('0x1f')]];}}}catch(_0x5de826){logger['error'](_0x04cf('0x6d'),util[_0x04cf('0x2f')](_0x5de826,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x6e')]=function(_0x155f12){try{if(this[_0x04cf('0x1b')](_0x155f12)){if(this['channels'][_0x155f12[_0x04cf('0x6f')]]){for(var _0x2c5824 in this[_0x04cf('0x1e')][_0x155f12['transfereeuniqueid']]){if(this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]]['hasOwnProperty'](_0x2c5824)){if(_0x155f12[_0x04cf('0x70')]===_0x2c5824){var _0x468e2c=moment();this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]][_0x2c5824]['agentcomplete']=!![];this[_0x04cf('0x1e')][_0x155f12['transfereeuniqueid']][_0x2c5824][_0x04cf('0x6a')]=moment()[_0x04cf('0x21')](_0x04cf('0x33'));this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]][_0x2c5824][_0x04cf('0x41')]=_0x04cf('0x50');this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]][_0x2c5824][_0x04cf('0x42')]=_0x04cf('0x4e');this['channels'][_0x155f12[_0x04cf('0x6f')]][_0x2c5824]['talktime']=_0x468e2c[_0x04cf('0x71')](this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]][_0x2c5824][_0x04cf('0x32')],_0x04cf('0x72'));}}}}if(this['channels'][_0x155f12['secondtransfereruniqueid']]){var _0x305424=this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x73')]];this['channels'][_0x155f12[_0x04cf('0x73')]]=this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]];this[_0x04cf('0x1e')][_0x155f12[_0x04cf('0x6f')]]=_0x305424;}}}catch(_0x2b605e){logger[_0x04cf('0x2d')](_0x04cf('0x74'),util[_0x04cf('0x2f')](_0x2b605e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x18')]=function(_0x1fff1e){try{if(this[_0x04cf('0x1b')](_0x1fff1e)){if(this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]]){for(var _0x51ec0d in this['channels'][_0x1fff1e[_0x04cf('0x6f')]]){if(this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]][_0x04cf('0x31')](_0x51ec0d)){if(_0x1fff1e[_0x04cf('0x75')]===_0x51ec0d){var _0x33eea6=moment();this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]][_0x51ec0d][_0x04cf('0x3f')]=!![];this['channels'][_0x1fff1e['transfereeuniqueid']][_0x51ec0d][_0x04cf('0x6a')]=_0x33eea6;this['channels'][_0x1fff1e[_0x04cf('0x6f')]][_0x51ec0d][_0x04cf('0x41')]=_0x04cf('0x50');this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]][_0x51ec0d][_0x04cf('0x42')]=_0x04cf('0x4e');this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]][_0x51ec0d]['talktime']=_0x33eea6[_0x04cf('0x71')](this[_0x04cf('0x1e')][_0x1fff1e[_0x04cf('0x6f')]][_0x51ec0d][_0x04cf('0x32')],'seconds');}}}}}}catch(_0x218612){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x04cf('0x2f')](_0x218612,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x76')]=function(_0x2e363c){var _0x3a6d0a='';try{if(this[_0x04cf('0x1b')](_0x2e363c)){if(_0x2e363c[_0x04cf('0x77')]){_0x3a6d0a=_0x2e363c[_0x04cf('0x77')]['substring'](0x0,_0x2e363c[_0x04cf('0x77')][_0x04cf('0x78')]('-'));if(this[_0x04cf('0xa')][_0x3a6d0a]){this[_0x04cf('0xa')][_0x3a6d0a][_0x04cf('0x79')]=!![];}}}}catch(_0x1be385){logger[_0x04cf('0x2d')](_0x04cf('0x7a'),util[_0x04cf('0x2f')](_0x1be385,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x04cf('0x19')][_0x04cf('0x7b')]=function(_0xa4df9f){var _0xd9712e='';try{if(this[_0x04cf('0x1b')](_0xa4df9f)){if(_0xa4df9f['channel']){_0xd9712e=_0xa4df9f[_0x04cf('0x77')]['substring'](0x0,_0xa4df9f['channel'][_0x04cf('0x78')]('-'));if(this['agents'][_0xd9712e]){this[_0x04cf('0xa')][_0xd9712e][_0x04cf('0x79')]=![];}}}}catch(_0x586807){logger[_0x04cf('0x2d')](_0x04cf('0x7c'),util[_0x04cf('0x2f')](_0x586807,{'showHidden':![],'depth':null}));}};module[_0x04cf('0x7d')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 64dc287..e031560 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 _0x5e85=['calleridname','UserId','membername','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','syncVarSet','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','syncMixMonitorFilename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','billableseconds','omit','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','syncBlindTransfer','transfereecalleridnum','extension','syncHangup','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','answertime','[syncMusicOnHoldStart][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','path','../../../config/environment','../ami','../model/channel','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','prototype','isUndefined','emit','isNotNull','uniqueid','merge','[syncNewCallerId][VoiceCallReport]','inspect','linkedid','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','pick','context','from-sip','destconnectedlinenum','exten','user:%s','split','name','user:agentconnect','error','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','includes','lastdata','cdr(','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview'];(function(_0x160668,_0x48bd43){var _0x35e8bb=function(_0x258285){while(--_0x258285){_0x160668['push'](_0x160668['shift']());}};_0x35e8bb(++_0x48bd43);}(_0x5e85,0x161));var _0x55e8=function(_0xff03c2,_0x4ebb14){_0xff03c2=_0xff03c2-0x0;var _0x24ba74=_0x5e85[_0xff03c2];return _0x24ba74;};'use strict';var BPromise=require(_0x55e8('0x0'));var _=require(_0x55e8('0x1'));var moment=require('moment');var util=require('util');var path=require(_0x55e8('0x2'));var Redis=require('ioredis');var config=require(_0x55e8('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0x55e8('0x4'));var Channel=require(_0x55e8('0x5'));var statusDesc=['unknown',_0x55e8('0x6'),_0x55e8('0x7'),_0x55e8('0x8'),_0x55e8('0x9'),_0x55e8('0xa'),_0x55e8('0xb'),_0x55e8('0xc'),_0x55e8('0xd')];var applications=[_0x55e8('0xe'),_0x55e8('0xf'),_0x55e8('0x10'),'dial',_0x55e8('0x11'),_0x55e8('0x12')];var dispositions=[_0x55e8('0x13'),_0x55e8('0x14'),_0x55e8('0x14'),_0x55e8('0x13'),_0x55e8('0x13'),_0x55e8('0x13'),_0x55e8('0x15'),'BUSY',_0x55e8('0x14'),'FAILED','FAILED'];var actions={};config[_0x55e8('0x16')]=_[_0x55e8('0x17')](config[_0x55e8('0x16')],{'host':'localhost','port':0x18eb});var io=require(_0x55e8('0x18'))(new Redis(config[_0x55e8('0x16')]));function VoiceCallReport(_0x573a5a){this[_0x55e8('0x19')]=_0x573a5a[_0x55e8('0x19')];this[_0x55e8('0x1a')]=_0x573a5a[_0x55e8('0x1a')];ami['on']('coreshowchannel',this[_0x55e8('0x1b')][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x1d'),this[_0x55e8('0x1b')][_0x55e8('0x1c')](this));ami['on']('newchannel',this[_0x55e8('0x1e')][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x1f'),this[_0x55e8('0x20')][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x21'),this['syncVarSet'][_0x55e8('0x1c')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x55e8('0x22'),this[_0x55e8('0x23')][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x24'),this[_0x55e8('0x25')][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x26'),this['syncBlindTransfer']['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x55e8('0x1c')](this));ami['on'](_0x55e8('0x27'),this[_0x55e8('0x28')]['bind'](this));return BPromise[_0x55e8('0x29')]()[_0x55e8('0x2a')](ami[_0x55e8('0x2b')]())[_0x55e8('0x2c')](function(_0x415032){console['log'](_0x415032);});}VoiceCallReport[_0x55e8('0x2d')]['isNotNull']=function(_0x39bee5){return _0x39bee5!==null&&!_[_0x55e8('0x2e')](_0x39bee5);};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x2f')]=function(_0x41ff61,_0x1a7944,_0x1cf6d0){io['to'](_0x41ff61)[_0x55e8('0x2f')](_0x1a7944,_0x1cf6d0);};VoiceCallReport['prototype'][_0x55e8('0x23')]=function(_0xd89e38){try{if(this[_0x55e8('0x30')](_0xd89e38)){if(_0xd89e38[_0x55e8('0x31')]===_0xd89e38['linkedid']){if(!_[_0x55e8('0x2e')](this['channels'][_0xd89e38[_0x55e8('0x31')]])){_[_0x55e8('0x32')](this['channels'][_0xd89e38['uniqueid']],_['pick'](_0xd89e38,_['keys'](this['channels'][_0xd89e38['uniqueid']])));}}}}catch(_0x9371f1){logger['error'](_0x55e8('0x33'),util[_0x55e8('0x34')](_0x9371f1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x1e')]=function(_0x7c12b6){try{if(this[_0x55e8('0x30')](_0x7c12b6)){if(_0x7c12b6[_0x55e8('0x31')]===_0x7c12b6[_0x55e8('0x35')]&&_0x7c12b6[_0x55e8('0x36')]!=_0x55e8('0x37')){if(_[_0x55e8('0x2e')](this['channels'][_0x7c12b6['uniqueid']])){this['channels'][_0x7c12b6[_0x55e8('0x31')]]=new Channel();this[_0x55e8('0x19')][_0x7c12b6[_0x55e8('0x31')]][_0x55e8('0x38')]=moment()[_0x55e8('0x39')](_0x55e8('0x3a'));this[_0x55e8('0x19')][_0x7c12b6[_0x55e8('0x31')]][_0x55e8('0x3b')]=dispositions[_[_0x55e8('0x3c')](_0x7c12b6[_0x55e8('0x3d')])];_['merge'](this[_0x55e8('0x19')][_0x7c12b6[_0x55e8('0x31')]],_[_0x55e8('0x3e')](_0x7c12b6,_['keys'](this[_0x55e8('0x19')][_0x7c12b6['uniqueid']])));if(_0x7c12b6[_0x55e8('0x3f')]===_0x55e8('0x40')){if(this[_0x55e8('0x1a')][_0x7c12b6[_0x55e8('0x36')]['split']('-')[0x0]]){this[_0x55e8('0x1a')][_0x7c12b6[_0x55e8('0x36')]['split']('-')[0x0]][_0x55e8('0x41')]=_0x7c12b6[_0x55e8('0x42')];this['emit'](util['format'](_0x55e8('0x43'),this['agents'][_0x7c12b6[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]][_0x55e8('0x45')]),_0x55e8('0x46'),{'destaccountcode':this[_0x55e8('0x1a')][_0x7c12b6[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x7c12b6[_0x55e8('0x42')]});}}}}}}catch(_0x3a0062){logger[_0x55e8('0x47')]('[syncNewChannel][VoiceCallReport]',util[_0x55e8('0x34')](_0x3a0062,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x1b')]=function(_0x5d1484){try{if(this[_0x55e8('0x30')](_0x5d1484)){if(_0x5d1484['uniqueid']===_0x5d1484[_0x55e8('0x35')]&&_0x5d1484[_0x55e8('0x42')]!='h'&&_0x5d1484[_0x55e8('0x36')]!=_0x55e8('0x37')){_0x5d1484[_0x55e8('0x48')]=_0x5d1484[_0x55e8('0x48')][_0x55e8('0x49')]();_0x5d1484[_0x55e8('0x4a')]=(_0x5d1484[_0x55e8('0x4b')]||_0x5d1484[_0x55e8('0x4a')])[_0x55e8('0x49')]();if(_[_0x55e8('0x2e')](this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]])){this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]]=new Channel();this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]]['starttime']=_0x5d1484[_0x55e8('0x4c')]?moment()[_0x55e8('0x4d')](moment[_0x55e8('0x4c')](_0x5d1484[_0x55e8('0x4c')])[_0x55e8('0x4e')](),_0x55e8('0x4e'))[_0x55e8('0x39')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5d1484[_0x55e8('0x31')]][_0x55e8('0x3b')]=_0x55e8('0x13');}_[_0x55e8('0x32')](this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]],_[_0x55e8('0x3e')](_0x5d1484,_['keys'](this[_0x55e8('0x19')][_0x5d1484['uniqueid']])));if(_[_0x55e8('0x4f')](applications,_0x5d1484['application'])){this[_0x55e8('0x19')][_0x5d1484['uniqueid']]['lastapplication']=_0x5d1484[_0x55e8('0x48')];this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]][_0x55e8('0x50')]=_0x5d1484[_0x55e8('0x4a')];if(_0x5d1484['application']===_0x55e8('0xe')&&_['startsWith'](_0x5d1484['applicationdata'],_0x55e8('0x51'))){var _0x70e159=_0x5d1484[_0x55e8('0x4a')][_0x55e8('0x44')]('=');var _0x1f2d0f=_0x70e159[0x0]['match'](/cdr\((.*)\)/);if(_0x1f2d0f){this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]][_0x1f2d0f[0x1]]=_0x70e159[0x1];}}else if(_0x5d1484[_0x55e8('0x48')]===_0x55e8('0xf')){this[_0x55e8('0x19')][_0x5d1484[_0x55e8('0x31')]][_0x55e8('0xf')]=_0x5d1484[_0x55e8('0x4a')][_0x55e8('0x44')](',')[0x0];}}}}}catch(_0x599050){logger[_0x55e8('0x47')](_0x55e8('0x52'),util[_0x55e8('0x34')](_0x599050,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x20')]=function(_0x568a8e){try{if(this['isNotNull'](_0x568a8e)){if(_0x568a8e[_0x55e8('0x31')]!==_0x568a8e[_0x55e8('0x35')]){if(this[_0x55e8('0x19')][_0x568a8e['linkedid']]){if(_0x568a8e[_0x55e8('0x3d')]==='6'){if(!this['channels'][_0x568a8e[_0x55e8('0x35')]][_0x55e8('0x53')]){var _0x58cff0=moment();this[_0x55e8('0x19')][_0x568a8e['linkedid']][_0x55e8('0x53')]=!![];this[_0x55e8('0x19')][_0x568a8e['linkedid']]['answertime']=_0x58cff0[_0x55e8('0x39')](_0x55e8('0x3a'));if(this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]][_0x55e8('0x38')]){this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]][_0x55e8('0x54')]=_0x58cff0[_0x55e8('0x55')](this['channels'][_0x568a8e[_0x55e8('0x35')]][_0x55e8('0x38')],'seconds');}}this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]]['linkedid']=_0x568a8e[_0x55e8('0x31')];if(_0x568a8e[_0x55e8('0x56')]!==_0x55e8('0x57')){this[_0x55e8('0x19')][_0x568a8e['linkedid']]['connectedlinenum']=_0x568a8e['calleridnum'];}this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]]['connectedlinename']=_0x568a8e[_0x55e8('0x58')];this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]]['destinationchannel']=_0x568a8e[_0x55e8('0x36')];this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x35')]][_0x55e8('0x3b')]=dispositions[_[_0x55e8('0x3c')](_0x568a8e[_0x55e8('0x3d')])];if(this['agents'][_0x568a8e[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]]){this[_0x55e8('0x19')][_0x568a8e['linkedid']][_0x55e8('0x59')]=this[_0x55e8('0x1a')][_0x568a8e['channel']['split']('-')[0x0]]['id'];this[_0x55e8('0x19')][_0x568a8e['linkedid']][_0x55e8('0x5a')]=this[_0x55e8('0x1a')][_0x568a8e['channel']['split']('-')[0x0]][_0x55e8('0x45')];}}}}else{if(this[_0x55e8('0x19')][_0x568a8e['uniqueid']]){if(_0x568a8e['channelstate']==='6'){if(this['agents'][_0x568a8e[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]]){this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x31')]][_0x55e8('0x59')]=this[_0x55e8('0x1a')][_0x568a8e[_0x55e8('0x36')]['split']('-')[0x0]]['id'];this[_0x55e8('0x19')][_0x568a8e[_0x55e8('0x31')]][_0x55e8('0x5a')]=this[_0x55e8('0x1a')][_0x568a8e[_0x55e8('0x36')]['split']('-')[0x0]][_0x55e8('0x45')];}}}}}}catch(_0x2feeaa){logger[_0x55e8('0x47')]('[syncNewState][VoiceCallReport]',util[_0x55e8('0x34')](_0x2feeaa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')]['syncMixMonitorFilename']=function(_0x5c2ccc,_0x21eb6e){if(this[_0x55e8('0x19')][_0x5c2ccc]){this[_0x55e8('0x19')][_0x5c2ccc][_0x55e8('0x5b')]=!![];if(_[_0x55e8('0x5c')](_0x21eb6e,_0x55e8('0x5d'))){_0x21eb6e=_0x21eb6e[_0x55e8('0x5e')](_0x55e8('0x5d'),_0x55e8('0x5f'));}this[_0x55e8('0x19')][_0x5c2ccc][_0x55e8('0x60')]=_0x21eb6e;var _0x1f2cf1=_[_0x55e8('0x61')](this[_0x55e8('0x19')][_0x5c2ccc][_0x55e8('0x62')],{'filename':_0x21eb6e});if(_[_0x55e8('0x63')](_0x1f2cf1)){this[_0x55e8('0x19')][_0x5c2ccc][_0x55e8('0x62')][_0x55e8('0x64')]({'filename':_0x21eb6e,'createdAt':moment()[_0x55e8('0x39')](_0x55e8('0x3a')),'mixmonitorid':'','status':_0x55e8('0x65')});}}};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x66')]=function(_0x421891){try{if(this[_0x55e8('0x30')](_0x421891)){if(this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]]&&_0x421891[_0x55e8('0x36')]!=_0x55e8('0x37')){if(this['isNotNull'](_0x421891[_0x55e8('0x67')])){if(this['isNotNull'](_0x421891[_0x55e8('0x67')][_0x55e8('0x68')])){this['syncMixMonitorFilename'](_0x421891['uniqueid'],_0x421891[_0x55e8('0x69')]);}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x6a')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x56')]=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x6b')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x6c')]=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x6d')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x6e')]=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')]['xmd-queue'])){this['channels'][_0x421891[_0x55e8('0x31')]][_0x55e8('0xf')]=_0x421891[_0x55e8('0x69')][_0x55e8('0x44')](',')[0x0];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x6f')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x70')]=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x71')])){this[_0x55e8('0x19')][_0x421891['uniqueid']]['destination']=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891['variable']['xmd-callerid-preview'])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x72')]=_0x421891[_0x55e8('0x69')];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x73')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0xf')]=_0x421891['value'];}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x74')])){this[_0x55e8('0x19')][_0x421891[_0x55e8('0x31')]][_0x55e8('0x75')]=_0x421891[_0x55e8('0x69')];}}}else if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x68')])){if(_0x421891[_0x55e8('0x69')]){var _0x4fe417=path['parse'](_0x421891[_0x55e8('0x69')])[_0x55e8('0x45')];this[_0x55e8('0x76')](_0x4fe417,_0x421891[_0x55e8('0x69')]);}}else if(this['channels'][_0x421891['linkedid']]){if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')])){if(this[_0x55e8('0x30')](_0x421891[_0x55e8('0x67')][_0x55e8('0x74')])){this[_0x55e8('0x19')][_0x421891['linkedid']][_0x55e8('0x77')]=_0x421891[_0x55e8('0x69')];}}}}}catch(_0x1e4dc5){logger[_0x55e8('0x47')](_0x55e8('0x78'),util[_0x55e8('0x34')](_0x1e4dc5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncHangup']=function(_0x3af6b9){try{if(this['isNotNull'](_0x3af6b9)){if(this['channels'][_0x3af6b9['uniqueid']]){var _0x2420f6=moment();this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]][_0x55e8('0x79')]=_0x2420f6[_0x55e8('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]]['duration']=_0x2420f6[_0x55e8('0x55')](this[_0x55e8('0x19')][_0x3af6b9['uniqueid']][_0x55e8('0x38')],'seconds');if(this['channels'][_0x3af6b9['uniqueid']]['answered']){this['channels'][_0x3af6b9['uniqueid']][_0x55e8('0x7a')]=_0x2420f6[_0x55e8('0x55')](this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]]['answertime'],_0x55e8('0x4e'));this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]][_0x55e8('0x54')]=this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]]['duration']-this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]][_0x55e8('0x7a')];}if(_0x3af6b9[_0x55e8('0x3f')]===_0x55e8('0x40')){if(this[_0x55e8('0x1a')][_0x3af6b9[_0x55e8('0x36')]['split']('-')[0x0]]){this[_0x55e8('0x1a')][_0x3af6b9[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]]=_[_0x55e8('0x7b')](this['agents'][_0x3af6b9['channel'][_0x55e8('0x44')]('-')[0x0]],[_0x55e8('0x41')]);this['emit'](util[_0x55e8('0x39')](_0x55e8('0x43'),this[_0x55e8('0x1a')][_0x3af6b9[_0x55e8('0x36')][_0x55e8('0x44')]('-')[0x0]]['name']),'user:agentcomplete',{'destaccountcode':this[_0x55e8('0x1a')][_0x3af6b9[_0x55e8('0x36')]['split']('-')[0x0]]['accountcode']});}}ami['emit'](_0x55e8('0x7c'),this[_0x55e8('0x19')][_0x3af6b9[_0x55e8('0x31')]]);delete this[_0x55e8('0x19')][_0x3af6b9['uniqueid']];}}}catch(_0x473cb1){logger[_0x55e8('0x47')](_0x55e8('0x7d'),util[_0x55e8('0x34')](_0x473cb1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x55e8('0x25')]=function(_0x1a5739){try{if(this['isNotNull'](_0x1a5739)){if(this[_0x55e8('0x19')][_0x1a5739['transfereeuniqueid']]){this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x7e')]][_0x55e8('0x7f')]=_0x1a5739[_0x55e8('0x80')];this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x7e')]][_0x55e8('0x81')]=_0x1a5739['transfertargetcalleridnum'];if(this[_0x55e8('0x19')][_0x1a5739['secondtransfereruniqueid']]){var _0x5be7f8=this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x82')]];this[_0x55e8('0x19')][_0x1a5739['secondtransfereruniqueid']]=this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x7e')]];this[_0x55e8('0x19')][_0x1a5739['transfereeuniqueid']]=_0x5be7f8;}}else if(this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x83')]]){this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x83')]][_0x55e8('0x7f')]=_0x1a5739[_0x55e8('0x80')];this[_0x55e8('0x19')][_0x1a5739['transfertargetuniqueid']][_0x55e8('0x81')]=_0x1a5739[_0x55e8('0x84')];if(this[_0x55e8('0x19')][_0x1a5739[_0x55e8('0x85')]]){var _0x5be7f8=this[_0x55e8('0x19')][_0x1a5739['origtransfereruniqueid']];this['channels'][_0x1a5739[_0x55e8('0x85')]]=this['channels'][_0x1a5739[_0x55e8('0x83')]];this['channels'][_0x1a5739['transfertargetuniqueid']]=_0x5be7f8;}}}}catch(_0x1d52d4){logger[_0x55e8('0x47')]('[syncAttendedTransfer][VoiceCallReport]',util[_0x55e8('0x34')](_0x1d52d4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')][_0x55e8('0x86')]=function(_0x4f250f){try{if(this[_0x55e8('0x30')](_0x4f250f)){if(this[_0x55e8('0x19')][_0x4f250f[_0x55e8('0x7e')]]){this[_0x55e8('0x19')][_0x4f250f[_0x55e8('0x7e')]][_0x55e8('0x7f')]=_0x4f250f[_0x55e8('0x87')];this[_0x55e8('0x19')][_0x4f250f[_0x55e8('0x7e')]]['transferconnectedlinenum']=_0x4f250f[_0x55e8('0x88')];this[_0x55e8('0x89')]({'event':_0x55e8('0x8a'),'uniqueid':_0x4f250f[_0x55e8('0x7e')],'context':_0x4f250f[_0x55e8('0x3f')],'channel':_0x4f250f['transfererchannel']});}}}catch(_0x1ce5d0){logger[_0x55e8('0x47')](_0x55e8('0x8b'),util['inspect'](_0x1ce5d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')]['syncMusicOnHoldStart']=function(_0x582e42){try{if(this['isNotNull'](_0x582e42)){if(this[_0x55e8('0x19')][_0x582e42[_0x55e8('0x31')]]){if(!_['isNil'](this[_0x55e8('0x19')][_0x582e42['uniqueid']][_0x55e8('0x8c')])){this['channels'][_0x582e42['uniqueid']]['mohstarttime']=moment()[_0x55e8('0x39')](_0x55e8('0x3a'));}}}}catch(_0x59a13d){logger['error'](_0x55e8('0x8d'),util['inspect'](_0x59a13d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x55e8('0x2d')]['syncMusicOnHoldStop']=function(_0x583ccf){try{if(this[_0x55e8('0x30')](_0x583ccf)){if(this[_0x55e8('0x19')][_0x583ccf[_0x55e8('0x31')]]){if(!_[_0x55e8('0x63')](this['channels'][_0x583ccf[_0x55e8('0x31')]][_0x55e8('0x8e')])){this[_0x55e8('0x19')][_0x583ccf[_0x55e8('0x31')]][_0x55e8('0x8f')]+=moment()[_0x55e8('0x90')](0x0)['diff'](this[_0x55e8('0x19')][_0x583ccf[_0x55e8('0x31')]][_0x55e8('0x8e')],_0x55e8('0x4e'));delete this[_0x55e8('0x19')][_0x583ccf[_0x55e8('0x31')]][_0x55e8('0x8e')];}}}}catch(_0x5d30ce){logger[_0x55e8('0x47')](_0x55e8('0x91'),util[_0x55e8('0x34')](_0x5d30ce,{'showHidden':![],'depth':null}));}};module[_0x55e8('0x92')]=VoiceCallReport; \ No newline at end of file +var _0x5a1d=['rec','syncMixMonitorFilename','variable','xmd-phone','value','callerid','xmd-cdrtype','type','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','endtime','context','from-sip','omit','user:agentcomplete','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','exports','bluebird','lodash','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','busy','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','OutgoingSpoolFailed','starttime','toNumber','channelstate','split','destconnectedlinenum','exten','format','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','toLowerCase','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','set','startsWith','applicationdata','match','answered','answertime','diff','calleridnum','xcally-motion-preview','connectedlinename','calleridname','destinationchannel','disposition','monitor','endsWith','.wav49','replace','.WAV','find','push'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x5a1d,0xbf));var _0xd5a1=function(_0xfd5fca,_0x316b3b){_0xfd5fca=_0xfd5fca-0x0;var _0x3c0625=_0x5a1d[_0xfd5fca];return _0x3c0625;};'use strict';var BPromise=require(_0xd5a1('0x0'));var _=require(_0xd5a1('0x1'));var moment=require('moment');var util=require('util');var path=require(_0xd5a1('0x2'));var Redis=require(_0xd5a1('0x3'));var config=require(_0xd5a1('0x4'));var logger=require(_0xd5a1('0x5'))(_0xd5a1('0x6'));var ami=require(_0xd5a1('0x7'));var Channel=require(_0xd5a1('0x8'));var statusDesc=[_0xd5a1('0x9'),'not_inuse',_0xd5a1('0xa'),_0xd5a1('0xb'),'invalid','unavailable','ringing','ringinuse','onhold'];var applications=['set',_0xd5a1('0xc'),_0xd5a1('0xd'),_0xd5a1('0xe'),_0xd5a1('0xf'),_0xd5a1('0x10')];var dispositions=[_0xd5a1('0x11'),_0xd5a1('0x12'),_0xd5a1('0x12'),_0xd5a1('0x11'),'NO\x20ANSWER','NO\x20ANSWER',_0xd5a1('0x13'),_0xd5a1('0x14'),_0xd5a1('0x12'),_0xd5a1('0x12'),'FAILED'];var actions={};config[_0xd5a1('0x15')]=_[_0xd5a1('0x16')](config[_0xd5a1('0x15')],{'host':_0xd5a1('0x17'),'port':0x18eb});var io=require(_0xd5a1('0x18'))(new Redis(config['redis']));function VoiceCallReport(_0x440d61){this[_0xd5a1('0x19')]=_0x440d61[_0xd5a1('0x19')];this[_0xd5a1('0x1a')]=_0x440d61[_0xd5a1('0x1a')];ami['on'](_0xd5a1('0x1b'),this[_0xd5a1('0x1c')]['bind'](this));ami['on'](_0xd5a1('0x1d'),this[_0xd5a1('0x1c')][_0xd5a1('0x1e')](this));ami['on']('newchannel',this[_0xd5a1('0x1f')]['bind'](this));ami['on'](_0xd5a1('0x20'),this[_0xd5a1('0x21')][_0xd5a1('0x1e')](this));ami['on'](_0xd5a1('0x22'),this[_0xd5a1('0x23')][_0xd5a1('0x1e')](this));ami['on']('hangup',this[_0xd5a1('0x24')][_0xd5a1('0x1e')](this));ami['on']('newcallerid',this['syncNewCallerId'][_0xd5a1('0x1e')](this));ami['on'](_0xd5a1('0x25'),this['syncAttendedTransfer'][_0xd5a1('0x1e')](this));ami['on'](_0xd5a1('0x26'),this[_0xd5a1('0x27')][_0xd5a1('0x1e')](this));ami['on']('musiconholdstart',this[_0xd5a1('0x28')][_0xd5a1('0x1e')](this));ami['on'](_0xd5a1('0x29'),this[_0xd5a1('0x2a')]['bind'](this));return BPromise[_0xd5a1('0x2b')]()[_0xd5a1('0x2c')](ami[_0xd5a1('0x2d')]())[_0xd5a1('0x2e')](function(_0xe5e5b5){console[_0xd5a1('0x2f')](_0xe5e5b5);});}VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x31')]=function(_0x3e3934){return _0x3e3934!==null&&!_[_0xd5a1('0x32')](_0x3e3934);};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x33')]=function(_0x45584f,_0x191097,_0x1871ba){io['to'](_0x45584f)[_0xd5a1('0x33')](_0x191097,_0x1871ba);};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x34')]=function(_0x53bb27){try{if(this[_0xd5a1('0x31')](_0x53bb27)){if(_0x53bb27[_0xd5a1('0x35')]===_0x53bb27['linkedid']){if(!_['isUndefined'](this['channels'][_0x53bb27[_0xd5a1('0x35')]])){_[_0xd5a1('0x36')](this['channels'][_0x53bb27[_0xd5a1('0x35')]],_[_0xd5a1('0x37')](_0x53bb27,_[_0xd5a1('0x38')](this['channels'][_0x53bb27[_0xd5a1('0x35')]])));}}}}catch(_0x6c8d47){logger[_0xd5a1('0x39')](_0xd5a1('0x3a'),util['inspect'](_0x6c8d47,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x1f')]=function(_0x124cd9){try{if(this[_0xd5a1('0x31')](_0x124cd9)){if(_0x124cd9[_0xd5a1('0x35')]===_0x124cd9[_0xd5a1('0x3b')]&&_0x124cd9[_0xd5a1('0x3c')]!=_0xd5a1('0x3d')){if(_[_0xd5a1('0x32')](this[_0xd5a1('0x19')][_0x124cd9[_0xd5a1('0x35')]])){this[_0xd5a1('0x19')][_0x124cd9[_0xd5a1('0x35')]]=new Channel();this[_0xd5a1('0x19')][_0x124cd9[_0xd5a1('0x35')]][_0xd5a1('0x3e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xd5a1('0x19')][_0x124cd9['uniqueid']]['disposition']=dispositions[_[_0xd5a1('0x3f')](_0x124cd9[_0xd5a1('0x40')])];_[_0xd5a1('0x36')](this[_0xd5a1('0x19')][_0x124cd9[_0xd5a1('0x35')]],_[_0xd5a1('0x37')](_0x124cd9,_[_0xd5a1('0x38')](this[_0xd5a1('0x19')][_0x124cd9[_0xd5a1('0x35')]])));if(_0x124cd9['context']==='from-sip'){if(this[_0xd5a1('0x1a')][_0x124cd9[_0xd5a1('0x3c')]['split']('-')[0x0]]){this[_0xd5a1('0x1a')][_0x124cd9[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]][_0xd5a1('0x42')]=_0x124cd9[_0xd5a1('0x43')];this[_0xd5a1('0x33')](util[_0xd5a1('0x44')](_0xd5a1('0x45'),this['agents'][_0x124cd9[_0xd5a1('0x3c')]['split']('-')[0x0]][_0xd5a1('0x46')]),_0xd5a1('0x47'),{'destaccountcode':this[_0xd5a1('0x1a')][_0x124cd9[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]][_0xd5a1('0x48')],'destconnectedlinenum':_0x124cd9['exten']});}}}}}}catch(_0x32e5e5){logger[_0xd5a1('0x39')](_0xd5a1('0x49'),util[_0xd5a1('0x4a')](_0x32e5e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x1c')]=function(_0x5f3d46){try{if(this[_0xd5a1('0x31')](_0x5f3d46)){if(_0x5f3d46[_0xd5a1('0x35')]===_0x5f3d46['linkedid']&&_0x5f3d46[_0xd5a1('0x43')]!='h'&&_0x5f3d46[_0xd5a1('0x3c')]!='OutgoingSpoolFailed'){_0x5f3d46[_0xd5a1('0x4b')]=_0x5f3d46['application'][_0xd5a1('0x4c')]();_0x5f3d46['applicationdata']=(_0x5f3d46[_0xd5a1('0x4d')]||_0x5f3d46['applicationdata'])[_0xd5a1('0x4c')]();if(_[_0xd5a1('0x32')](this[_0xd5a1('0x19')][_0x5f3d46[_0xd5a1('0x35')]])){this[_0xd5a1('0x19')][_0x5f3d46[_0xd5a1('0x35')]]=new Channel();this['channels'][_0x5f3d46[_0xd5a1('0x35')]][_0xd5a1('0x3e')]=_0x5f3d46[_0xd5a1('0x4e')]?moment()[_0xd5a1('0x4f')](moment[_0xd5a1('0x4e')](_0x5f3d46['duration'])[_0xd5a1('0x50')](),_0xd5a1('0x50'))[_0xd5a1('0x44')](_0xd5a1('0x51')):moment()[_0xd5a1('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xd5a1('0x19')][_0x5f3d46[_0xd5a1('0x35')]]['disposition']=_0xd5a1('0x11');}_[_0xd5a1('0x36')](this[_0xd5a1('0x19')][_0x5f3d46['uniqueid']],_[_0xd5a1('0x37')](_0x5f3d46,_['keys'](this[_0xd5a1('0x19')][_0x5f3d46[_0xd5a1('0x35')]])));if(_[_0xd5a1('0x52')](applications,_0x5f3d46['application'])){this[_0xd5a1('0x19')][_0x5f3d46[_0xd5a1('0x35')]][_0xd5a1('0x53')]=_0x5f3d46['application'];this['channels'][_0x5f3d46[_0xd5a1('0x35')]][_0xd5a1('0x54')]=_0x5f3d46['applicationdata'];if(_0x5f3d46[_0xd5a1('0x4b')]===_0xd5a1('0x55')&&_[_0xd5a1('0x56')](_0x5f3d46[_0xd5a1('0x57')],'cdr(')){var _0x3315b3=_0x5f3d46[_0xd5a1('0x57')][_0xd5a1('0x41')]('=');var _0x12bf80=_0x3315b3[0x0][_0xd5a1('0x58')](/cdr\((.*)\)/);if(_0x12bf80){this['channels'][_0x5f3d46[_0xd5a1('0x35')]][_0x12bf80[0x1]]=_0x3315b3[0x1];}}else if(_0x5f3d46[_0xd5a1('0x4b')]==='queue'){this[_0xd5a1('0x19')][_0x5f3d46['uniqueid']]['queue']=_0x5f3d46[_0xd5a1('0x57')][_0xd5a1('0x41')](',')[0x0];}}}}}catch(_0x314d54){logger['error']('[syncNewExten][VoiceCallReport]',util[_0xd5a1('0x4a')](_0x314d54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x21')]=function(_0x15a895){try{if(this[_0xd5a1('0x31')](_0x15a895)){if(_0x15a895['uniqueid']!==_0x15a895[_0xd5a1('0x3b')]){if(this['channels'][_0x15a895['linkedid']]){if(_0x15a895['channelstate']==='6'){if(!this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]]['answered']){var _0x41cbe6=moment();this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]][_0xd5a1('0x59')]=!![];this['channels'][_0x15a895['linkedid']][_0xd5a1('0x5a')]=_0x41cbe6['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xd5a1('0x19')][_0x15a895['linkedid']]['starttime']){this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]]['holdtime']=_0x41cbe6[_0xd5a1('0x5b')](this[_0xd5a1('0x19')][_0x15a895['linkedid']][_0xd5a1('0x3e')],'seconds');}}this[_0xd5a1('0x19')][_0x15a895['linkedid']][_0xd5a1('0x3b')]=_0x15a895['uniqueid'];if(_0x15a895[_0xd5a1('0x5c')]!==_0xd5a1('0x5d')){this[_0xd5a1('0x19')][_0x15a895['linkedid']]['connectedlinenum']=_0x15a895[_0xd5a1('0x5c')];}this[_0xd5a1('0x19')][_0x15a895['linkedid']][_0xd5a1('0x5e')]=_0x15a895[_0xd5a1('0x5f')];this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]][_0xd5a1('0x60')]=_0x15a895[_0xd5a1('0x3c')];this[_0xd5a1('0x19')][_0x15a895['linkedid']][_0xd5a1('0x61')]=dispositions[_['toNumber'](_0x15a895[_0xd5a1('0x40')])];if(this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]]){this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]]['UserId']=this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]]['id'];this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x3b')]]['membername']=this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]][_0xd5a1('0x46')];}}}}else{if(this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x35')]]){if(_0x15a895[_0xd5a1('0x40')]==='6'){if(this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]]){this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x35')]]['UserId']=this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]]['id'];this[_0xd5a1('0x19')][_0x15a895[_0xd5a1('0x35')]]['membername']=this[_0xd5a1('0x1a')][_0x15a895[_0xd5a1('0x3c')][_0xd5a1('0x41')]('-')[0x0]]['name'];}}}}}}catch(_0x53d2d8){logger['error']('[syncNewState][VoiceCallReport]',util[_0xd5a1('0x4a')](_0x53d2d8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')]['syncMixMonitorFilename']=function(_0x167f0a,_0x6e9fc0){if(this['channels'][_0x167f0a]){this[_0xd5a1('0x19')][_0x167f0a][_0xd5a1('0x62')]=!![];if(_[_0xd5a1('0x63')](_0x6e9fc0,_0xd5a1('0x64'))){_0x6e9fc0=_0x6e9fc0[_0xd5a1('0x65')](_0xd5a1('0x64'),_0xd5a1('0x66'));}this[_0xd5a1('0x19')][_0x167f0a]['monitorFilename']=_0x6e9fc0;var _0x4feefd=_[_0xd5a1('0x67')](this[_0xd5a1('0x19')][_0x167f0a]['monitors'],{'filename':_0x6e9fc0});if(_['isNil'](_0x4feefd)){this[_0xd5a1('0x19')][_0x167f0a]['monitors'][_0xd5a1('0x68')]({'filename':_0x6e9fc0,'createdAt':moment()[_0xd5a1('0x44')](_0xd5a1('0x51')),'mixmonitorid':'','status':_0xd5a1('0x69')});}}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x23')]=function(_0x3fdc37){try{if(this[_0xd5a1('0x31')](_0x3fdc37)){if(this['channels'][_0x3fdc37[_0xd5a1('0x35')]]&&_0x3fdc37[_0xd5a1('0x3c')]!=_0xd5a1('0x3d')){if(this['isNotNull'](_0x3fdc37['variable'])){if(this['isNotNull'](_0x3fdc37['variable']['mixmonitor_filename'])){this[_0xd5a1('0x6a')](_0x3fdc37[_0xd5a1('0x35')],_0x3fdc37['value']);}else if(this['isNotNull'](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x6c')])){this['channels'][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x5c')]=_0x3fdc37[_0xd5a1('0x6d')];}else if(this['isNotNull'](_0x3fdc37[_0xd5a1('0x6b')]['xmd-callerid'])){this['channels'][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x6e')]=_0x3fdc37['value'];}else if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x6f')])){this['channels'][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x70')]=_0x3fdc37[_0xd5a1('0x6d')];}else if(this[_0xd5a1('0x31')](_0x3fdc37['variable']['xmd-queue'])){this[_0xd5a1('0x19')][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0xc')]=_0x3fdc37[_0xd5a1('0x6d')][_0xd5a1('0x41')](',')[0x0];}else if(this['isNotNull'](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x71')])){this['channels'][_0x3fdc37['uniqueid']][_0xd5a1('0x72')]=_0x3fdc37['value'];}else if(this['isNotNull'](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x73')])){this['channels'][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x74')]=_0x3fdc37[_0xd5a1('0x6d')];}else if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x75')])){this[_0xd5a1('0x19')][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x76')]=_0x3fdc37[_0xd5a1('0x6d')];}else if(this[_0xd5a1('0x31')](_0x3fdc37['variable'][_0xd5a1('0x77')])){this[_0xd5a1('0x19')][_0x3fdc37['uniqueid']][_0xd5a1('0xc')]=_0x3fdc37[_0xd5a1('0x6d')];}else if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')]['sipcallid'])){this[_0xd5a1('0x19')][_0x3fdc37[_0xd5a1('0x35')]][_0xd5a1('0x78')]=_0x3fdc37[_0xd5a1('0x6d')];}}}else if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x79')])){if(_0x3fdc37['value']){var _0xe30d6e=path[_0xd5a1('0x7a')](_0x3fdc37['value'])[_0xd5a1('0x46')];this[_0xd5a1('0x6a')](_0xe30d6e,_0x3fdc37[_0xd5a1('0x6d')]);}}else if(this[_0xd5a1('0x19')][_0x3fdc37[_0xd5a1('0x3b')]]){if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')])){if(this[_0xd5a1('0x31')](_0x3fdc37[_0xd5a1('0x6b')][_0xd5a1('0x7b')])){this['channels'][_0x3fdc37['linkedid']]['sipcalllinkedid']=_0x3fdc37['value'];}}}}}catch(_0x42ad42){logger[_0xd5a1('0x39')]('[syncVarSet][VoiceCallReport]',util['inspect'](_0x42ad42,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x24')]=function(_0x398db1){try{if(this[_0xd5a1('0x31')](_0x398db1)){if(this[_0xd5a1('0x19')][_0x398db1['uniqueid']]){var _0x483d09=moment();this['channels'][_0x398db1[_0xd5a1('0x35')]][_0xd5a1('0x7c')]=_0x483d09[_0xd5a1('0x44')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x398db1[_0xd5a1('0x35')]]['duration']=_0x483d09['diff'](this['channels'][_0x398db1[_0xd5a1('0x35')]][_0xd5a1('0x3e')],_0xd5a1('0x50'));if(this[_0xd5a1('0x19')][_0x398db1[_0xd5a1('0x35')]][_0xd5a1('0x59')]){this[_0xd5a1('0x19')][_0x398db1[_0xd5a1('0x35')]]['billableseconds']=_0x483d09[_0xd5a1('0x5b')](this['channels'][_0x398db1[_0xd5a1('0x35')]][_0xd5a1('0x5a')],'seconds');this[_0xd5a1('0x19')][_0x398db1[_0xd5a1('0x35')]]['holdtime']=this['channels'][_0x398db1[_0xd5a1('0x35')]][_0xd5a1('0x4e')]-this['channels'][_0x398db1[_0xd5a1('0x35')]]['billableseconds'];}if(_0x398db1[_0xd5a1('0x7d')]===_0xd5a1('0x7e')){if(this[_0xd5a1('0x1a')][_0x398db1[_0xd5a1('0x3c')]['split']('-')[0x0]]){this[_0xd5a1('0x1a')][_0x398db1['channel'][_0xd5a1('0x41')]('-')[0x0]]=_[_0xd5a1('0x7f')](this[_0xd5a1('0x1a')][_0x398db1['channel'][_0xd5a1('0x41')]('-')[0x0]],[_0xd5a1('0x42')]);this[_0xd5a1('0x33')](util[_0xd5a1('0x44')](_0xd5a1('0x45'),this['agents'][_0x398db1[_0xd5a1('0x3c')]['split']('-')[0x0]]['name']),_0xd5a1('0x80'),{'destaccountcode':this[_0xd5a1('0x1a')][_0x398db1['channel'][_0xd5a1('0x41')]('-')[0x0]][_0xd5a1('0x48')]});}}ami['emit']('custom:voiceCallReport',this[_0xd5a1('0x19')][_0x398db1['uniqueid']]);delete this['channels'][_0x398db1['uniqueid']];}}}catch(_0x48b479){logger[_0xd5a1('0x39')](_0xd5a1('0x81'),util[_0xd5a1('0x4a')](_0x48b479,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')]['syncAttendedTransfer']=function(_0x4d81da){try{if(this[_0xd5a1('0x31')](_0x4d81da)){if(this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x82')]]){this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x82')]]['transfercalleridnum']=_0x4d81da[_0xd5a1('0x83')];this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x82')]][_0xd5a1('0x84')]=_0x4d81da[_0xd5a1('0x85')];if(this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x86')]]){var _0x2b2d1b=this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x86')]];this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x86')]]=this[_0xd5a1('0x19')][_0x4d81da['transfereeuniqueid']];this['channels'][_0x4d81da[_0xd5a1('0x82')]]=_0x2b2d1b;}}else if(this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x87')]]){this['channels'][_0x4d81da[_0xd5a1('0x87')]][_0xd5a1('0x88')]=_0x4d81da[_0xd5a1('0x83')];this['channels'][_0x4d81da[_0xd5a1('0x87')]]['transferconnectedlinenum']=_0x4d81da[_0xd5a1('0x85')];if(this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x89')]]){var _0x2b2d1b=this[_0xd5a1('0x19')][_0x4d81da['origtransfereruniqueid']];this['channels'][_0x4d81da[_0xd5a1('0x89')]]=this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x87')]];this[_0xd5a1('0x19')][_0x4d81da[_0xd5a1('0x87')]]=_0x2b2d1b;}}}}catch(_0x488741){logger['error'](_0xd5a1('0x8a'),util[_0xd5a1('0x4a')](_0x488741,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd5a1('0x27')]=function(_0x18bd42){try{if(this[_0xd5a1('0x31')](_0x18bd42)){if(this['channels'][_0x18bd42[_0xd5a1('0x82')]]){this['channels'][_0x18bd42[_0xd5a1('0x82')]][_0xd5a1('0x88')]=_0x18bd42[_0xd5a1('0x8b')];this[_0xd5a1('0x19')][_0x18bd42[_0xd5a1('0x82')]][_0xd5a1('0x84')]=_0x18bd42[_0xd5a1('0x8c')];this[_0xd5a1('0x24')]({'event':_0xd5a1('0x8d'),'uniqueid':_0x18bd42[_0xd5a1('0x82')],'context':_0x18bd42[_0xd5a1('0x7d')],'channel':_0x18bd42[_0xd5a1('0x8e')]});}}}catch(_0x338f88){logger[_0xd5a1('0x39')]('[syncBlindTransfer][VoiceCallReport]',util[_0xd5a1('0x4a')](_0x338f88,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd5a1('0x28')]=function(_0x1de812){try{if(this[_0xd5a1('0x31')](_0x1de812)){if(this[_0xd5a1('0x19')][_0x1de812[_0xd5a1('0x35')]]){if(!_[_0xd5a1('0x8f')](this[_0xd5a1('0x19')][_0x1de812[_0xd5a1('0x35')]][_0xd5a1('0x5a')])){this[_0xd5a1('0x19')][_0x1de812['uniqueid']][_0xd5a1('0x90')]=moment()[_0xd5a1('0x44')](_0xd5a1('0x51'));}}}}catch(_0x1b1efe){logger[_0xd5a1('0x39')](_0xd5a1('0x91'),util[_0xd5a1('0x4a')](_0x1b1efe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd5a1('0x30')][_0xd5a1('0x2a')]=function(_0x457d06){try{if(this[_0xd5a1('0x31')](_0x457d06)){if(this[_0xd5a1('0x19')][_0x457d06['uniqueid']]){if(!_[_0xd5a1('0x8f')](this['channels'][_0x457d06[_0xd5a1('0x35')]][_0xd5a1('0x90')])){this[_0xd5a1('0x19')][_0x457d06[_0xd5a1('0x35')]][_0xd5a1('0x92')]+=moment()['milliseconds'](0x0)['diff'](this[_0xd5a1('0x19')][_0x457d06[_0xd5a1('0x35')]][_0xd5a1('0x90')],_0xd5a1('0x50'));delete this['channels'][_0x457d06['uniqueid']][_0xd5a1('0x90')];}}}}catch(_0x38bc50){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xd5a1('0x4a')](_0x38bc50,{'showHidden':![],'depth':null}));}};module[_0xd5a1('0x93')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 179591e..3f05514 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 _0x9a6a=['lastevent','complete','total','answertime','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','custom:voiceDialReport','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','emit','prototype','isNotNull','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','uniqueid','error','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','connect','[syncDialEnd][VoiceDialReport]','keys','variable','value','variables','[syncVarSet][VoiceDialReport]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','isUndefined','duration','endtime','starttime','seconds'];(function(_0x948249,_0x21f5cb){var _0x353677=function(_0x1be7b5){while(--_0x1be7b5){_0x948249['push'](_0x948249['shift']());}};_0x353677(++_0x21f5cb);}(_0x9a6a,0x110));var _0xa9a6=function(_0x29806f,_0x15672c){_0x29806f=_0x29806f-0x0;var _0x2e268d=_0x9a6a[_0x29806f];return _0x2e268d;};'use strict';var _=require(_0xa9a6('0x0'));var moment=require(_0xa9a6('0x1'));var util=require(_0xa9a6('0x2'));var Redis=require(_0xa9a6('0x3'));var config=require('../../../config/environment');var logger=require(_0xa9a6('0x4'))('ami');var ami=require(_0xa9a6('0x5'));config[_0xa9a6('0x6')]=_[_0xa9a6('0x7')](config['redis'],{'host':_0xa9a6('0x8'),'port':0x18eb});var io=require(_0xa9a6('0x9'))(new Redis(config[_0xa9a6('0x6')]));function VoiceDialReport(_0x41a962){this['channels']=_0x41a962[_0xa9a6('0xa')];this[_0xa9a6('0xb')]=_0x41a962['outbound'];this['variables']={};ami['on'](_0xa9a6('0xc'),this[_0xa9a6('0xd')][_0xa9a6('0xe')](this));ami['on'](_0xa9a6('0xf'),this[_0xa9a6('0x10')]['bind'](this));ami['on']('varset',this[_0xa9a6('0x11')][_0xa9a6('0xe')](this));ami['on'](_0xa9a6('0x12'),this[_0xa9a6('0x13')][_0xa9a6('0xe')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x444333){return _0x444333!==null&&!_['isUndefined'](_0x444333);};VoiceDialReport['prototype']['emit']=function(_0x19bda0,_0xdab49b,_0x36db27){io['to'](_0x19bda0)[_0xa9a6('0x14')](_0xdab49b,_0x36db27);};VoiceDialReport[_0xa9a6('0x15')][_0xa9a6('0xd')]=function(_0x2549a4){try{if(this[_0xa9a6('0x16')](_0x2549a4)){if(this[_0xa9a6('0x17')][_0x2549a4['uniqueid']]){_['merge'](this['channels'][_0x2549a4['uniqueid']],{'starttime':moment()[_0xa9a6('0x18')](_0xa9a6('0x19')),'lastevent':_0xa9a6('0x1a'),'interface':_0x2549a4[_0xa9a6('0x1b')][_0xa9a6('0x1c')](0x0,_0x2549a4[_0xa9a6('0x1b')][_0xa9a6('0x1d')]('-')),'membername':_0x2549a4[_0xa9a6('0x1b')][_0xa9a6('0x1c')](_0x2549a4[_0xa9a6('0x1b')][_0xa9a6('0x1d')]('/')+0x1,_0x2549a4[_0xa9a6('0x1b')][_0xa9a6('0x1d')]('-'))},_[_0xa9a6('0x1e')](_0x2549a4,[_0xa9a6('0x1f'),'privilege']));this[_0xa9a6('0x14')](_0xa9a6('0x20'),_0xa9a6('0x21'),this[_0xa9a6('0x17')][_0x2549a4[_0xa9a6('0x22')]]);ami['emit']('custom:dialbegin',this[_0xa9a6('0x17')][_0x2549a4[_0xa9a6('0x22')]]);}}}catch(_0x4c31d2){logger[_0xa9a6('0x23')]('[syncDialBegin][VoiceDialReport]',util[_0xa9a6('0x24')](_0x4c31d2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa9a6('0x15')][_0xa9a6('0x10')]=function(_0x4272ad){try{if(this[_0xa9a6('0x16')](_0x4272ad)){if(this[_0xa9a6('0x17')][_0x4272ad[_0xa9a6('0x22')]]){this[_0xa9a6('0x17')][_0x4272ad[_0xa9a6('0x22')]][_0xa9a6('0x25')]=_0x4272ad[_0xa9a6('0x25')];if(_0x4272ad[_0xa9a6('0x25')]===_0xa9a6('0x26')){this[_0xa9a6('0x17')][_0x4272ad[_0xa9a6('0x22')]][_0xa9a6('0x27')]=_0x4272ad[_0xa9a6('0x27')];this[_0xa9a6('0x17')][_0x4272ad[_0xa9a6('0x22')]]['connectedlinename']=_0x4272ad[_0xa9a6('0x28')];this['channels'][_0x4272ad[_0xa9a6('0x22')]]['answertime']=moment()[_0xa9a6('0x18')](_0xa9a6('0x19'));this[_0xa9a6('0x17')][_0x4272ad[_0xa9a6('0x22')]]['lastevent']=_0xa9a6('0x29');ami['emit']('custom:dialconnect',this[_0xa9a6('0x17')][_0x4272ad['uniqueid']]);}this['emit'](_0xa9a6('0x20'),'voice_outbound_channel:save',this[_0xa9a6('0x17')][_0x4272ad['uniqueid']]);}}}catch(_0x245576){logger[_0xa9a6('0x23')](_0xa9a6('0x2a'),util[_0xa9a6('0x24')](_0x245576,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa9a6('0x15')][_0xa9a6('0x11')]=function(_0x47957d){try{if(this[_0xa9a6('0x16')](_0x47957d)){this['addVariable'](_0x47957d[_0xa9a6('0x22')],_[_0xa9a6('0x2b')](_0x47957d[_0xa9a6('0x2c')])[0x0],_0x47957d['value']);if(this['isNotNull'](_0x47957d[_0xa9a6('0x2c')])&&this[_0xa9a6('0x16')](_0x47957d[_0xa9a6('0x2c')]['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x47957d[_0xa9a6('0x22')]])){this[_0xa9a6('0x17')][_0x47957d[_0xa9a6('0x22')]]={'routeId':_0x47957d[_0xa9a6('0x2d')],'variables':this[_0xa9a6('0x2e')][_0x47957d[_0xa9a6('0x22')]]};this['emit'](_0xa9a6('0x20'),_0xa9a6('0x21'),this['channels'][_0x47957d['uniqueid']]);}}}}catch(_0x2ce5f5){logger['error'](_0xa9a6('0x2f'),util[_0xa9a6('0x24')](_0x2ce5f5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa9a6('0x15')][_0xa9a6('0x30')]=function(_0x141f79,_0x1e1bf9,_0x105681){var _0x18f2af=[_0xa9a6('0x31'),'rtpaudioqosbridged',_0xa9a6('0x32'),'rtpaudioqosjitterbridged',_0xa9a6('0x33'),'rtpaudioqoslossbridged',_0xa9a6('0x34'),_0xa9a6('0x35'),'sipcallid','sipuri',_0xa9a6('0x36'),_0xa9a6('0x37'),_0xa9a6('0x38'),_0xa9a6('0x39'),'memberinterface',_0xa9a6('0x3a'),'membername',_0xa9a6('0x3b'),_0xa9a6('0x3c')];if(!_[_0xa9a6('0x3d')](_0x1e1bf9)&&!_[_0xa9a6('0x3e')](_0x18f2af,_0x1e1bf9)){if(_[_0xa9a6('0x3f')](this[_0xa9a6('0x2e')][_0x141f79])){this[_0xa9a6('0x2e')][_0x141f79]={};}this[_0xa9a6('0x2e')][_0x141f79][_0x1e1bf9]=_0x105681;}};VoiceDialReport[_0xa9a6('0x15')][_0xa9a6('0x13')]=function(_0x2a068f){try{if(this[_0xa9a6('0x16')](_0x2a068f)){if(this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]]){this[_0xa9a6('0x17')][_0x2a068f['uniqueid']]['endtime']=moment()[_0xa9a6('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x40')]=moment(this['channels'][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x41')])['diff'](this['channels'][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x42')],_0xa9a6('0x43'));this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x44')]=_0xa9a6('0x45');this['outbound'][_0xa9a6('0x46')]+=0x1;if(this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x47')]){this['outbound'][_0xa9a6('0x48')]+=0x1;this['channels'][_0x2a068f['uniqueid']][_0xa9a6('0x49')]=moment(this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]]['answertime'])[_0xa9a6('0x4a')](this['channels'][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x42')],_0xa9a6('0x43'));this['channels'][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x4b')]=moment(this[_0xa9a6('0x17')][_0x2a068f['uniqueid']][_0xa9a6('0x41')])[_0xa9a6('0x4a')](this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x47')],_0xa9a6('0x43'));this[_0xa9a6('0xb')][_0xa9a6('0x4c')]+=this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x49')]||0x0;this[_0xa9a6('0xb')][_0xa9a6('0x4d')]+=this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x4b')];}this['outbound']['sumDuration']+=this['channels'][_0x2a068f[_0xa9a6('0x22')]][_0xa9a6('0x40')];ami['emit'](_0xa9a6('0x4e'),this['channels'][_0x2a068f[_0xa9a6('0x22')]]);ami[_0xa9a6('0x14')](_0xa9a6('0x4f'),this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]]);this[_0xa9a6('0x14')](_0xa9a6('0x20'),_0xa9a6('0x50'),this['outbound']);logger['info'](_0xa9a6('0x51'),JSON[_0xa9a6('0x52')](this[_0xa9a6('0x17')][_0x2a068f['uniqueid']]));this[_0xa9a6('0x14')](_0xa9a6('0x20'),_0xa9a6('0x53'),this['channels'][_0x2a068f[_0xa9a6('0x22')]]);delete this[_0xa9a6('0x17')][_0x2a068f[_0xa9a6('0x22')]];}if(this[_0xa9a6('0x2e')][_0x2a068f[_0xa9a6('0x22')]]){delete this[_0xa9a6('0x2e')][_0x2a068f[_0xa9a6('0x22')]];}}}catch(_0x4b29b2){logger[_0xa9a6('0x23')]('[syncHangup][VoiceDialReport]',util[_0xa9a6('0x24')](_0x4b29b2,{'showHidden':![],'depth':null}));}};module[_0xa9a6('0x54')]=VoiceDialReport; \ No newline at end of file +var _0x6b6d=['sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','duration','endtime','starttime','seconds','complete','total','holdtime','diff','billableseconds','sumHoldTime','sumDuration','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','../../../config/environment','ami','defaults','redis','localhost','socket.io-emitter','outboundChannels','outbound','dialbegin','dialend','bind','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','channels','uniqueid','merge','format','called','channel','lastIndexOf','substring','omit','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','addVariable','keys','variable','value','outboundrouteid','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid'];(function(_0x5aeada,_0x22eb41){var _0xbadf1d=function(_0x2d7a63){while(--_0x2d7a63){_0x5aeada['push'](_0x5aeada['shift']());}};_0xbadf1d(++_0x22eb41);}(_0x6b6d,0x1d3));var _0xd6b6=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x6b6d[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require(_0xd6b6('0x0'));var logger=require('../../../config/logger')(_0xd6b6('0x1'));var ami=require('../ami');config['redis']=_[_0xd6b6('0x2')](config[_0xd6b6('0x3')],{'host':_0xd6b6('0x4'),'port':0x18eb});var io=require(_0xd6b6('0x5'))(new Redis(config[_0xd6b6('0x3')]));function VoiceDialReport(_0x335c1a){this['channels']=_0x335c1a[_0xd6b6('0x6')];this[_0xd6b6('0x7')]=_0x335c1a[_0xd6b6('0x7')];this['variables']={};ami['on'](_0xd6b6('0x8'),this['syncDialBegin']['bind'](this));ami['on'](_0xd6b6('0x9'),this['syncDialEnd'][_0xd6b6('0xa')](this));ami['on'](_0xd6b6('0xb'),this[_0xd6b6('0xc')][_0xd6b6('0xa')](this));ami['on']('hangup',this[_0xd6b6('0xd')]['bind'](this));}VoiceDialReport[_0xd6b6('0xe')][_0xd6b6('0xf')]=function(_0x78940b){return _0x78940b!==null&&!_[_0xd6b6('0x10')](_0x78940b);};VoiceDialReport['prototype'][_0xd6b6('0x11')]=function(_0x228166,_0x99e444,_0x5a1d21){io['to'](_0x228166)[_0xd6b6('0x11')](_0x99e444,_0x5a1d21);};VoiceDialReport['prototype'][_0xd6b6('0x12')]=function(_0x24683a){try{if(this[_0xd6b6('0xf')](_0x24683a)){if(this[_0xd6b6('0x13')][_0x24683a[_0xd6b6('0x14')]]){_[_0xd6b6('0x15')](this['channels'][_0x24683a[_0xd6b6('0x14')]],{'starttime':moment()[_0xd6b6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xd6b6('0x17'),'interface':_0x24683a[_0xd6b6('0x18')]['substring'](0x0,_0x24683a[_0xd6b6('0x18')][_0xd6b6('0x19')]('-')),'membername':_0x24683a[_0xd6b6('0x18')][_0xd6b6('0x1a')](_0x24683a[_0xd6b6('0x18')][_0xd6b6('0x19')]('/')+0x1,_0x24683a[_0xd6b6('0x18')]['lastIndexOf']('-'))},_[_0xd6b6('0x1b')](_0x24683a,[_0xd6b6('0x1c'),_0xd6b6('0x1d')]));this[_0xd6b6('0x11')](_0xd6b6('0x1e'),_0xd6b6('0x1f'),this[_0xd6b6('0x13')][_0x24683a[_0xd6b6('0x14')]]);ami[_0xd6b6('0x11')](_0xd6b6('0x20'),this[_0xd6b6('0x13')][_0x24683a['uniqueid']]);}}}catch(_0x3b92a7){logger[_0xd6b6('0x21')](_0xd6b6('0x22'),util[_0xd6b6('0x23')](_0x3b92a7,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd6b6('0x24')]=function(_0x2e6ce1){try{if(this['isNotNull'](_0x2e6ce1)){if(this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]]){this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]]['dialstatus']=_0x2e6ce1[_0xd6b6('0x25')];if(_0x2e6ce1[_0xd6b6('0x25')]===_0xd6b6('0x26')){this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]][_0xd6b6('0x27')]=_0x2e6ce1[_0xd6b6('0x27')];this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]][_0xd6b6('0x28')]=_0x2e6ce1['connectedlinename'];this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]][_0xd6b6('0x29')]=moment()[_0xd6b6('0x16')](_0xd6b6('0x2a'));this[_0xd6b6('0x13')][_0x2e6ce1['uniqueid']][_0xd6b6('0x2b')]=_0xd6b6('0x2c');ami[_0xd6b6('0x11')]('custom:dialconnect',this['channels'][_0x2e6ce1[_0xd6b6('0x14')]]);}this[_0xd6b6('0x11')](_0xd6b6('0x1e'),_0xd6b6('0x1f'),this[_0xd6b6('0x13')][_0x2e6ce1[_0xd6b6('0x14')]]);}}}catch(_0x4fd3d5){logger[_0xd6b6('0x21')]('[syncDialEnd][VoiceDialReport]',util['inspect'](_0x4fd3d5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd6b6('0xe')][_0xd6b6('0xc')]=function(_0x46f4ec){try{if(this[_0xd6b6('0xf')](_0x46f4ec)){this[_0xd6b6('0x2d')](_0x46f4ec['uniqueid'],_[_0xd6b6('0x2e')](_0x46f4ec[_0xd6b6('0x2f')])[0x0],_0x46f4ec[_0xd6b6('0x30')]);if(this[_0xd6b6('0xf')](_0x46f4ec['variable'])&&this['isNotNull'](_0x46f4ec['variable'][_0xd6b6('0x31')])){if(_[_0xd6b6('0x10')](this['channels'][_0x46f4ec[_0xd6b6('0x14')]])){this[_0xd6b6('0x13')][_0x46f4ec[_0xd6b6('0x14')]]={'routeId':_0x46f4ec[_0xd6b6('0x30')],'variables':this[_0xd6b6('0x32')][_0x46f4ec['uniqueid']]};this[_0xd6b6('0x11')](_0xd6b6('0x1e'),_0xd6b6('0x1f'),this['channels'][_0x46f4ec[_0xd6b6('0x14')]]);}}}}catch(_0x23a438){logger[_0xd6b6('0x21')](_0xd6b6('0x33'),util[_0xd6b6('0x23')](_0x23a438,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd6b6('0xe')]['addVariable']=function(_0x1e0575,_0x2cba03,_0x74ffe0){var _0x1cfcc5=[_0xd6b6('0x34'),_0xd6b6('0x35'),_0xd6b6('0x36'),_0xd6b6('0x37'),_0xd6b6('0x38'),_0xd6b6('0x39'),_0xd6b6('0x3a'),_0xd6b6('0x3b'),_0xd6b6('0x3c'),_0xd6b6('0x3d'),'bridgepeer',_0xd6b6('0x3e'),_0xd6b6('0x3f'),_0xd6b6('0x40'),'memberinterface',_0xd6b6('0x41'),_0xd6b6('0x42'),_0xd6b6('0x43'),_0xd6b6('0x44')];if(!_[_0xd6b6('0x45')](_0x2cba03)&&!_[_0xd6b6('0x46')](_0x1cfcc5,_0x2cba03)){if(_[_0xd6b6('0x10')](this[_0xd6b6('0x32')][_0x1e0575])){this[_0xd6b6('0x32')][_0x1e0575]={};}this[_0xd6b6('0x32')][_0x1e0575][_0x2cba03]=_0x74ffe0;}};VoiceDialReport[_0xd6b6('0xe')][_0xd6b6('0xd')]=function(_0x342758){try{if(this[_0xd6b6('0xf')](_0x342758)){if(this[_0xd6b6('0x13')][_0x342758['uniqueid']]){this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]]['endtime']=moment()[_0xd6b6('0x16')](_0xd6b6('0x2a'));this['channels'][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x47')]=moment(this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x48')])['diff'](this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x49')],_0xd6b6('0x4a'));this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x2b')]=_0xd6b6('0x4b');this[_0xd6b6('0x7')][_0xd6b6('0x4c')]+=0x1;if(this[_0xd6b6('0x13')][_0x342758['uniqueid']][_0xd6b6('0x29')]){this[_0xd6b6('0x7')]['answered']+=0x1;this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x4d')]=moment(this[_0xd6b6('0x13')][_0x342758['uniqueid']]['answertime'])[_0xd6b6('0x4e')](this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x49')],_0xd6b6('0x4a'));this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x4f')]=moment(this['channels'][_0x342758['uniqueid']][_0xd6b6('0x48')])['diff'](this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x29')],_0xd6b6('0x4a'));this[_0xd6b6('0x7')][_0xd6b6('0x50')]+=this[_0xd6b6('0x13')][_0x342758['uniqueid']][_0xd6b6('0x4d')]||0x0;this[_0xd6b6('0x7')]['sumBillable']+=this[_0xd6b6('0x13')][_0x342758['uniqueid']][_0xd6b6('0x4f')];}this['outbound'][_0xd6b6('0x51')]+=this['channels'][_0x342758[_0xd6b6('0x14')]][_0xd6b6('0x47')];ami['emit']('custom:voiceDialReport',this['channels'][_0x342758[_0xd6b6('0x14')]]);ami['emit']('custom:dialend',this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]]);this[_0xd6b6('0x11')](_0xd6b6('0x1e'),_0xd6b6('0x52'),this[_0xd6b6('0x7')]);logger[_0xd6b6('0x53')](_0xd6b6('0x54'),JSON['stringify'](this['channels'][_0x342758['uniqueid']]));this['emit'](_0xd6b6('0x1e'),_0xd6b6('0x55'),this['channels'][_0x342758['uniqueid']]);delete this[_0xd6b6('0x13')][_0x342758[_0xd6b6('0x14')]];}if(this['variables'][_0x342758[_0xd6b6('0x14')]]){delete this['variables'][_0x342758[_0xd6b6('0x14')]];}}}catch(_0x2070e9){logger[_0xd6b6('0x21')](_0xd6b6('0x56'),util[_0xd6b6('0x23')](_0x2070e9,{'showHidden':![],'depth':null}));}};module[_0xd6b6('0x57')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 20fb7c2..3baa744 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 _0x74e5=['tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','bind','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','prototype','clearZombieChannels','switch','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','voice:queue:%s','voice_queue_channel:save','emitVoiceQueueChannelRemove','info','stringify','format','type','inbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','waiting','Trunk','name','callerid','Interval','isNotNull','[queues]','flagQueueSummary','queuesummary','then','[queuesummary]','syncQueueSummary','queue','callers','toNumber','loggedin','emitVoiceQueueSummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','keys','push','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','transfertype','destexten','transferuniqueid','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','variable','queuestatus','CONTINUE','lastevent','value','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','length','diff','total','answered','custom:queuecallerunmanaged','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','milliseconds','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','moment','bluebird','util','md5','ioredis','../../../config/environment','ami','../ami','../model/queueReport','redis','defaults','localhost','socket.io-emitter','enqueue'];(function(_0x28988d,_0x54fa79){var _0x1660bd=function(_0x4f7859){while(--_0x4f7859){_0x28988d['push'](_0x28988d['shift']());}};_0x1660bd(++_0x54fa79);}(_0x74e5,0x181));var _0x574e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x74e5[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x574e('0x0'));var moment=require(_0x574e('0x1'));var BPromise=require(_0x574e('0x2'));var util=require(_0x574e('0x3'));var md5=require(_0x574e('0x4'));var Redis=require(_0x574e('0x5'));var config=require(_0x574e('0x6'));var logger=require('../../../config/logger')(_0x574e('0x7'));var ami=require(_0x574e('0x8'));var QueueReport=require(_0x574e('0x9'));config[_0x574e('0xa')]=_[_0x574e('0xb')](config[_0x574e('0xa')],{'host':_0x574e('0xc'),'port':0x18eb});var io=require(_0x574e('0xd'))(new Redis(config[_0x574e('0xa')]));var Sequence=function(){};Sequence['prototype'][_0x574e('0xe')]=function(_0x330551){this[_0x574e('0xf')]=this[_0x574e('0xf')]?this[_0x574e('0xf')][_0x574e('0x10')](_0x330551):_0x330551();};function VoiceQueueReport(_0x1e4196){this['sequence']=new Sequence();this[_0x574e('0x11')]={};this[_0x574e('0x12')]=_0x1e4196[_0x574e('0x12')];this[_0x574e('0x13')]=_0x1e4196[_0x574e('0x14')];this[_0x574e('0x15')]=_0x1e4196['voiceQueues'];this['flagQueueSummary']=!![];this[_0x574e('0x16')]=_0x1e4196['campaigns'];this[_0x574e('0x17')]={};ami['on']('queuesummary',this['syncQueueSummary']['bind'](this));ami['on'](_0x574e('0x18'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x574e('0x19'),this[_0x574e('0x1a')][_0x574e('0x1b')](this));ami['on'](_0x574e('0x1c'),this['syncQueueCallerAbandon'][_0x574e('0x1b')](this));ami['on'](_0x574e('0x1d'),this[_0x574e('0x1e')]['bind'](this));ami['on'](_0x574e('0x1f'),this[_0x574e('0x20')][_0x574e('0x1b')](this));ami['on'](_0x574e('0x21'),this['syncAgentConnect']['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x574e('0x22'),this[_0x574e('0x23')][_0x574e('0x1b')](this));ami['on'](_0x574e('0x24'),this[_0x574e('0x25')][_0x574e('0x1b')](this));ami['on']('musiconholdstart',this[_0x574e('0x26')][_0x574e('0x1b')](this));ami['on']('musiconholdstop',this[_0x574e('0x27')][_0x574e('0x1b')](this));ami['on'](_0x574e('0x28'),this[_0x574e('0x29')]['bind'](this));ami['on'](_0x574e('0x2a'),this[_0x574e('0x2b')][_0x574e('0x1b')](this));this[_0x574e('0x2c')]();this[_0x574e('0x2d')]();}function isNotNull(_0x5e63a8){return _0x5e63a8!==null&&!_[_0x574e('0x2e')](_0x5e63a8);}function clearChannels(_0xcaaf33){if(!_[_0x574e('0x2f')](_0xcaaf33)){for(var _0x3c8410 in _0xcaaf33){if(_0xcaaf33[_0x574e('0x30')](_0x3c8410)){delete _0xcaaf33[_0x3c8410];}}}}function clearCampaigns(_0xf18c53){if(!_['isEmpty'](_0xf18c53)){for(var _0x11058f in _0xf18c53){if(_0xf18c53[_0x574e('0x30')](_0x11058f)){_0xf18c53[_0x11058f][_0x574e('0x31')]=0x0;}}}}function clearVoiceQueues(_0x5affb8){if(!_[_0x574e('0x2f')](_0x5affb8)){for(var _0x432367 in _0x5affb8){if(_0x5affb8[_0x574e('0x30')](_0x432367)){_0x5affb8[_0x432367][_0x574e('0x31')]=0x0;_0x5affb8[_0x432367][_0x574e('0x32')]=0x0;_0x5affb8[_0x432367][_0x574e('0x33')]=0x0;_0x5affb8[_0x432367]['waiting']=0x0;_0x5affb8[_0x432367][_0x574e('0x34')]=!![];}}}}function clearAgentBooked(_0xdf1c1f){if(!_[_0x574e('0x2f')](_0xdf1c1f)){for(var _0x8a6fce in _0xdf1c1f){if(_0xdf1c1f[_0x574e('0x30')](_0x8a6fce)){_0xdf1c1f[_0x8a6fce][_0x574e('0x35')]=!![];}}}}VoiceQueueReport[_0x574e('0x36')][_0x574e('0x37')]=function(){var _0x557764=this;for(var _0xbad766 in this[_0x574e('0x13')]){if(this['channels'][_0x574e('0x30')](_0xbad766)&&!this['channels'][_0xbad766][_0x574e('0x38')]){this[_0x574e('0x39')][_0x574e('0xe')](function(){if(!_[_0x574e('0x3a')](_0x557764[_0x574e('0x13')][_0xbad766])){return ami[_0x574e('0x3b')]({'action':_0x574e('0x3c'),'channel':_0x557764['channels'][_0xbad766][_0x574e('0x3d')]})[_0x574e('0x3e')](function(_0x18fe17){if(_0x18fe17['message']===_0x574e('0x3f')){setTimeout(function(){if(_0x557764[_0x574e('0x13')][_0xbad766]){delete _0x557764[_0x574e('0x13')][_0xbad766];logger[_0x574e('0x40')]('[voiceQueueReport][checkChannel]',_0xbad766);}if(_0x557764[_0x574e('0x11')][_0xbad766]){delete _0x557764[_0x574e('0x11')][_0xbad766];logger[_0x574e('0x40')](_0x574e('0x41'),_0xbad766);}if(_0x557764[_0x574e('0x17')][_0xbad766]){delete _0x557764['variables'][_0xbad766];logger[_0x574e('0x40')](_0x574e('0x42'),_0xbad766);}},0x1f40);}});}});}}};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x25')]=function(){logger[_0x574e('0x40')](_0x574e('0x43'));clearChannels(this[_0x574e('0x13')]);this['clearQueueReport'](this[_0x574e('0x11')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x574e('0x15')]);clearCampaigns(this[_0x574e('0x16')]);};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x44')]=function(_0x4909be){var _0x5476a8=this;if(!_[_0x574e('0x2f')](_0x4909be)){for(var _0x4a3d44 in _0x4909be){if(_0x4909be[_0x574e('0x30')](_0x4a3d44)){_0x5476a8['emitVoiceQueueChannelRemove'](_0x4909be[_0x4a3d44]);delete _0x4909be[_0x4a3d44];}}}};function loggerCatch(_0x357921){return function(_0x298145){logger[_0x574e('0x40')](_0x357921,util[_0x574e('0x45')](_0x298145,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x574e('0x36')][_0x574e('0x46')]=function(_0x52d59f,_0x6a176b,_0x36b9b5){io['to'](_0x52d59f)[_0x574e('0x46')](_0x6a176b,_0x36b9b5);};VoiceQueueReport['prototype'][_0x574e('0x47')]=function(_0x2a5479){this[_0x574e('0x46')](util['format'](_0x574e('0x48'),_0x2a5479['name']),_0x574e('0x49'),_0x2a5479);};VoiceQueueReport['prototype'][_0x574e('0x4a')]=function(_0x1635d8){logger[_0x574e('0x4b')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x574e('0x4c')](_0x1635d8));this[_0x574e('0x46')](util[_0x574e('0x4d')](_0x574e('0x48'),_0x1635d8['name']),'voice_queue_channel:remove',_0x1635d8);};VoiceQueueReport[_0x574e('0x36')]['emitVoiceQueueSummary']=function(_0x51f5fa){if(_0x51f5fa[_0x574e('0x4e')]===_0x574e('0x4f')){var _0x44046e={'id':_0x51f5fa['id'],'name':_0x51f5fa['name'],'strategy':_0x51f5fa[_0x574e('0x50')],'answered':_0x51f5fa['answered'],'available':_0x51f5fa[_0x574e('0x51')],'loggedIn':_0x51f5fa[_0x574e('0x52')],'pTalking':_0x51f5fa['pTalking'],'sumBillable':_0x51f5fa[_0x574e('0x53')],'sumDuration':_0x51f5fa[_0x574e('0x54')],'sumHoldTime':_0x51f5fa[_0x574e('0x55')]||0x0,'talking':_0x51f5fa[_0x574e('0x32')],'total':_0x51f5fa['total'],'type':_0x51f5fa['type'],'unmanaged':_0x51f5fa[_0x574e('0x56')],'abandoned':_0x51f5fa[_0x574e('0x57')],'waiting':_0x51f5fa[_0x574e('0x58')]};if(_0x51f5fa['Trunk']){_0x44046e[_0x574e('0x59')]={'id':_0x51f5fa['Trunk']['id'],'name':_0x51f5fa['Trunk'][_0x574e('0x5a')],'active':_0x51f5fa[_0x574e('0x59')]['active'],'callerid':_0x51f5fa[_0x574e('0x59')][_0x574e('0x5b')]};}if(_0x51f5fa[_0x574e('0x5c')]){_0x44046e[_0x574e('0x5c')]={'id':_0x51f5fa[_0x574e('0x5c')]['id'],'name':_0x51f5fa[_0x574e('0x5c')][_0x574e('0x5a')]};}var _0x208726=md5(JSON[_0x574e('0x4c')](_0x44046e));if(_0x51f5fa[_0x574e('0x4')]!==_0x208726){_0x51f5fa[_0x574e('0x4')]=_0x208726;this[_0x574e('0x46')](util[_0x574e('0x4d')](_0x574e('0x48'),_0x44046e[_0x574e('0x5a')]),'voice_queue:save',_0x44046e);}}};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x5d')]=function(_0x413863){return _0x413863!==null&&!_[_0x574e('0x2e')](_0x413863);};VoiceQueueReport[_0x574e('0x36')]['loopQueueShow']=function(){var _0x29a9a6=this;setInterval(function(){_0x29a9a6[_0x574e('0x37')]();ami['Action']({'action':'queues'})['catch'](loggerCatch(_0x574e('0x5e')));},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x523ab7=this;setInterval(function(){if(_0x523ab7[_0x574e('0x5f')]){return ami[_0x574e('0x3b')]({'action':_0x574e('0x60')})[_0x574e('0x61')](function(_0x52dfa7){_0x523ab7['flagQueueSummary']=![];})['catch'](loggerCatch(_0x574e('0x62')));}},0x3e8);};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x63')]=function(_0x4e1386){try{if(this[_0x574e('0x5d')](_0x4e1386)&&this[_0x574e('0x5d')](_0x4e1386[_0x574e('0x64')])){if(this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]]){var _0xec8172=_['countBy'](this[_0x574e('0x13')],_0x574e('0x64'))[_0x4e1386[_0x574e('0x64')]]||0x0;var _0x170091=_0xec8172-_0x4e1386[_0x574e('0x65')];if(this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]]['waiting']!==_[_0x574e('0x66')](_0x4e1386['callers'])||this['voiceQueues'][_0x4e1386[_0x574e('0x64')]][_0x574e('0x52')]!==_[_0x574e('0x66')](_0x4e1386[_0x574e('0x67')])||this[_0x574e('0x15')][_0x4e1386['queue']][_0x574e('0x51')]!==_[_0x574e('0x66')](_0x4e1386['available'])||this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]][_0x574e('0x32')]!==_0x170091){this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]][_0x574e('0x58')]=_[_0x574e('0x66')](_0x4e1386[_0x574e('0x65')]);this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]][_0x574e('0x52')]=_[_0x574e('0x66')](_0x4e1386['loggedin']);this['voiceQueues'][_0x4e1386[_0x574e('0x64')]][_0x574e('0x51')]=_[_0x574e('0x66')](_0x4e1386[_0x574e('0x51')]);this[_0x574e('0x15')][_0x4e1386['queue']][_0x574e('0x32')]=_0x170091>0x0?_0x170091:0x0;this[_0x574e('0x15')][_0x4e1386['queue']][_0x574e('0x32')]=this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]][_0x574e('0x32')]>_[_0x574e('0x66')](_0x4e1386[_0x574e('0x67')])?_[_0x574e('0x66')](_0x4e1386['loggedin']):this['voiceQueues'][_0x4e1386[_0x574e('0x64')]]['talking'];this[_0x574e('0x68')](this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]]);}ami[_0x574e('0x46')]('custom:queuesummary',this[_0x574e('0x15')][_0x4e1386[_0x574e('0x64')]]);}}}catch(_0xf9b81){logger[_0x574e('0x40')](_0x574e('0x69'),util[_0x574e('0x45')](_0xf9b81,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x6a')]=function(_0x519dea){this[_0x574e('0x5f')]=!![];};VoiceQueueReport['prototype'][_0x574e('0x6b')]=function(_0x389807){};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x1a')]=function(_0x2f0aab){try{if(this[_0x574e('0x5d')](_0x2f0aab)){if(_[_0x574e('0x2e')](this[_0x574e('0x11')][_0x2f0aab[_0x574e('0x6c')]])){this[_0x574e('0x11')][_0x2f0aab['uniqueid']]=[];this[_0x574e('0x13')][_0x2f0aab[_0x574e('0x6c')]]={};}var _0x575886=new QueueReport();_0x575886[_0x574e('0x5a')]=_0x2f0aab[_0x574e('0x64')];_0x575886['type']=this[_0x574e('0x15')][_0x575886[_0x574e('0x5a')]]&&this['voiceQueues'][_0x575886[_0x574e('0x5a')]][_0x574e('0x4e')]?this[_0x574e('0x15')][_0x575886['name']][_0x574e('0x4e')]||'inbound':_0x574e('0x4f');_0x575886[_0x574e('0x64')]=_0x2f0aab[_0x574e('0x64')];_0x575886[_0x574e('0x6d')]=moment()[_0x574e('0x4d')](_0x574e('0x6e'));_0x575886[_0x574e('0x6f')]=_0x2f0aab[_0x574e('0x6f')];_0x575886['count']=_0x2f0aab[_0x574e('0x70')];_[_0x574e('0x71')](_0x575886,_['pick'](_0x2f0aab,_[_0x574e('0x72')](_0x575886)));this['queueReports'][_0x2f0aab[_0x574e('0x6c')]][_0x574e('0x73')](_0x575886);this[_0x574e('0x13')][_0x2f0aab[_0x574e('0x6c')]]=_0x575886;this[_0x574e('0x47')](_0x575886);}}catch(_0x1073fc){logger[_0x574e('0x40')](_0x574e('0x74'),util[_0x574e('0x45')](_0x1073fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x5bd75d){try{if(this[_0x574e('0x5d')](_0x5bd75d)){if(this[_0x574e('0x11')][_0x5bd75d[_0x574e('0x6c')]]){var _0x4159c6=_['last'](this[_0x574e('0x11')][_0x5bd75d['uniqueid']]);_0x4159c6[_0x574e('0x75')]=![];_0x4159c6[_0x574e('0x76')]=null;_0x4159c6['holdtime']=_0x5bd75d[_0x574e('0x77')];_0x4159c6[_0x574e('0x78')]=_0x5bd75d[_0x574e('0x78')];_0x4159c6['queuecallerabandon']=!![];_0x4159c6[_0x574e('0x79')]=moment()[_0x574e('0x4d')](_0x574e('0x6e'));_0x4159c6[_0x574e('0x7a')]='ABANDONED';_0x4159c6[_0x574e('0x7b')]=null;this['channels'][_0x5bd75d[_0x574e('0x6c')]]=_0x4159c6;this[_0x574e('0x4a')](_0x4159c6);}}}catch(_0x315984){logger[_0x574e('0x40')](_0x574e('0x7c'),util[_0x574e('0x45')](_0x315984,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x574e('0x36')]['syncQueueCallerLeave']=function(_0x909158){try{if(this[_0x574e('0x5d')](_0x909158)){if(this[_0x574e('0x11')][_0x909158[_0x574e('0x6c')]]){var _0x176846=_[_0x574e('0x7d')](this[_0x574e('0x11')][_0x909158[_0x574e('0x6c')]]);_0x176846[_0x574e('0x7e')]=moment()[_0x574e('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x176846[_0x574e('0x7f')]=_0x909158[_0x574e('0x7f')];_0x176846[_0x574e('0x80')]=_0x909158['connectedlinename'];this[_0x574e('0x13')][_0x909158[_0x574e('0x6c')]]=_0x176846;this['emitVoiceQueueChannelSave'](_0x176846);}}}catch(_0x1690a1){logger[_0x574e('0x40')](_0x574e('0x81'),util['inspect'](_0x1690a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x574e('0x82')]=function(_0x58ab73){try{if(this['isNotNull'](_0x58ab73)){if(this[_0x574e('0x11')][_0x58ab73['uniqueid']]){var _0xce6015=_[_0x574e('0x7d')](this[_0x574e('0x11')][_0x58ab73['uniqueid']]);_0xce6015[_0x574e('0x75')]=!![];_0xce6015['queuecallerexitreason']=_0x574e('0x83');}}}catch(_0x1e585c){logger[_0x574e('0x40')]('[syncAgentConnect][VoiceQueueReport]',util[_0x574e('0x45')](_0x1e585c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x574e('0x36')]['syncAgentComplete']=function(_0x2c45c5){try{if(this[_0x574e('0x5d')](_0x2c45c5)){if(this['queueReports'][_0x2c45c5[_0x574e('0x6c')]]){var _0x1d4e7d=_[_0x574e('0x7d')](this[_0x574e('0x11')][_0x2c45c5['uniqueid']]);_0x1d4e7d[_0x574e('0x1c')]=![];_0x1d4e7d[_0x574e('0x79')]=null;_0x1d4e7d['assigned']=!![];_0x1d4e7d[_0x574e('0x7b')]=_0x2c45c5[_0x574e('0x84')];_0x1d4e7d['holdtime']=_0x2c45c5[_0x574e('0x77')];_0x1d4e7d[_0x574e('0x75')]=!![];_0x1d4e7d[_0x574e('0x85')]=![];_0x1d4e7d[_0x574e('0x86')]=null;if(!_0x1d4e7d[_0x574e('0x87')]){if(_0x2c45c5[_0x574e('0x88')]==_0x574e('0x87')){_0x1d4e7d[_0x574e('0x7a')]=_0x574e('0x89');}else{if(_[_0x574e('0x8a')](_0x2c45c5[_0x574e('0x3d')][_0x574e('0x8b')](),_0x574e('0x8c'))){if(this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x8d')]]){var _0x3a9bcd=_['last'](this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x8d')]]);_0x3a9bcd[_0x574e('0x75')]=![];_0x3a9bcd[_0x574e('0x85')]=!![];_0x3a9bcd[_0x574e('0x86')]=moment(_0x1d4e7d[_0x574e('0x6d')])[_0x574e('0x8e')](_0x2c45c5[_0x574e('0x77')],_0x574e('0x8f'))[_0x574e('0x4d')](_0x574e('0x6e'));_0x3a9bcd['queuecallerexitreason']='FORWARDTRANSFER';_0x3a9bcd[_0x574e('0x87')]=!![];_0x3a9bcd[_0x574e('0x90')]='FORWARD';_0x3a9bcd['transferexten']=_0x2c45c5[_0x574e('0x91')];_0x3a9bcd[_0x574e('0x92')]=_0x2c45c5[_0x574e('0x6c')];var _0x2e9c32=this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x8d')]];this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x8d')]]=this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x6c')]];this[_0x574e('0x11')][_0x2c45c5[_0x574e('0x6c')]]=_0x2e9c32;}}else{_0x1d4e7d[_0x574e('0x7a')]='COMPLETEDBY'+_0x2c45c5[_0x574e('0x88')][_0x574e('0x93')]();}}}this[_0x574e('0x13')][_0x2c45c5[_0x574e('0x6c')]]=_0x1d4e7d;this[_0x574e('0x4a')](_0x1d4e7d);}}}catch(_0x49a20e){logger[_0x574e('0x40')](_0x574e('0x94'),util[_0x574e('0x45')](_0x49a20e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x574e('0x36')][_0x574e('0x95')]=function(_0x20bcbf){try{if(this[_0x574e('0x5d')](_0x20bcbf)){this['addVariable'](_0x20bcbf[_0x574e('0x6c')],_['keys'](_0x20bcbf[_0x574e('0x96')])[0x0],_0x20bcbf['value']);if(this[_0x574e('0x11')][_0x20bcbf[_0x574e('0x6c')]]){var _0xad60e2=_[_0x574e('0x7d')](this['queueReports'][_0x20bcbf[_0x574e('0x6c')]]);if(_0xad60e2){if(this[_0x574e('0x5d')](_0x20bcbf['variable'])&&this['isNotNull'](_0x20bcbf[_0x574e('0x96')][_0x574e('0x97')])){switch(_0x20bcbf['value']){case _0x574e('0x98'):_0xad60e2['queuecallerexit']=![];_0xad60e2[_0x574e('0x86')]=null;break;case'TIMEOUT':_0xad60e2[_0x574e('0x99')]='timeout';ami[_0x574e('0x46')]('custom:timeout',_0xad60e2);break;default:_0xad60e2[_0x574e('0x85')]=!![];_0xad60e2[_0x574e('0x86')]=moment()[_0x574e('0x4d')](_0x574e('0x6e'));_0xad60e2[_0x574e('0x7e')]=moment()[_0x574e('0x4d')](_0x574e('0x6e'));}_0xad60e2['queuecallerabandon']=![];_0xad60e2[_0x574e('0x79')]=null;_0xad60e2[_0x574e('0x7a')]=_0x20bcbf[_0x574e('0x9a')];this['channels'][_0x20bcbf[_0x574e('0x6c')]]=_0xad60e2;this[_0x574e('0x4a')](_0xad60e2);}else if(this[_0x574e('0x5d')](_0x20bcbf[_0x574e('0x96')])&&this[_0x574e('0x5d')](_0x20bcbf[_0x574e('0x96')][_0x574e('0x9b')])){if(!_0xad60e2[_0x574e('0x1c')]){_0xad60e2['queuecallerexit']=!![];_0xad60e2['queuecallerexitAt']=moment()[_0x574e('0x4d')](_0x574e('0x6e'));_0xad60e2[_0x574e('0x7a')]='EXITWITHKEY';_0xad60e2['queuecallerleaveAt']=moment()['format'](_0x574e('0x6e'));this[_0x574e('0x13')][_0x20bcbf[_0x574e('0x6c')]]=_0xad60e2;}}_0xad60e2['variables']=this['variables'][_0x20bcbf[_0x574e('0x6c')]];}}}}catch(_0x46d6e4){logger['error'](_0x574e('0x9c'),util['inspect'](_0x46d6e4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x574e('0x36')]['addVariable']=function(_0x10b648,_0x4a3dda,_0x5d79c6){var _0x4a3ac2=['rtpaudioqos',_0x574e('0x9d'),_0x574e('0x9e'),_0x574e('0x9f'),_0x574e('0xa0'),_0x574e('0xa1'),_0x574e('0xa2'),_0x574e('0xa3'),_0x574e('0xa4'),_0x574e('0xa5'),_0x574e('0xa6'),_0x574e('0xa7'),'membercalls',_0x574e('0xa8'),_0x574e('0xa9'),_0x574e('0xaa'),_0x574e('0x84'),_0x574e('0xab'),'memberrealtime'];if(!_[_0x574e('0x3a')](_0x4a3dda)&&!_[_0x574e('0xac')](_0x4a3ac2,_0x4a3dda)){if(_[_0x574e('0x2e')](this[_0x574e('0x17')][_0x10b648])){this[_0x574e('0x17')][_0x10b648]={};}this[_0x574e('0x17')][_0x10b648][_0x4a3dda]=_0x5d79c6;}};VoiceQueueReport['prototype'][_0x574e('0x23')]=function(_0x16f96e){try{if(this['isNotNull'](_0x16f96e)){if(this['queueReports'][_0x16f96e[_0x574e('0x6c')]]){for(var _0x575092=0x0,_0x2f9898={};_0x5750920x0?_0x3bf82e:0x0;this[_0x2664('0x14')][_0x22c82b[_0x2664('0x62')]]['talking']=this[_0x2664('0x14')][_0x22c82b[_0x2664('0x62')]]['talking']>_[_0x2664('0x64')](_0x22c82b[_0x2664('0x65')])?_['toNumber'](_0x22c82b[_0x2664('0x65')]):this[_0x2664('0x14')][_0x22c82b[_0x2664('0x62')]][_0x2664('0x31')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x22c82b[_0x2664('0x62')]]);}ami[_0x2664('0x44')](_0x2664('0x66'),this[_0x2664('0x14')][_0x22c82b['queue']]);}}}catch(_0x3ae537){logger[_0x2664('0x3c')](_0x2664('0x67'),util['inspect'](_0x3ae537,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x1a')]=function(_0x47a178){this[_0x2664('0x15')]=!![];};VoiceQueueReport[_0x2664('0xc')]['syncNewExten']=function(_0x8e929e){};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x4db222){try{if(this[_0x2664('0x5c')](_0x4db222)){if(_[_0x2664('0x5d')](this['queueReports'][_0x4db222[_0x2664('0x68')]])){this[_0x2664('0x11')][_0x4db222[_0x2664('0x68')]]=[];this[_0x2664('0x13')][_0x4db222[_0x2664('0x68')]]={};}var _0x4850d7=new QueueReport();_0x4850d7[_0x2664('0x47')]=_0x4db222[_0x2664('0x62')];_0x4850d7[_0x2664('0x54')]=this[_0x2664('0x14')][_0x4850d7[_0x2664('0x47')]]&&this[_0x2664('0x14')][_0x4850d7[_0x2664('0x47')]][_0x2664('0x54')]?this[_0x2664('0x14')][_0x4850d7[_0x2664('0x47')]][_0x2664('0x54')]||_0x2664('0x4a'):_0x2664('0x4a');_0x4850d7['queue']=_0x4db222[_0x2664('0x62')];_0x4850d7[_0x2664('0x69')]=moment()[_0x2664('0x46')](_0x2664('0x6a'));_0x4850d7[_0x2664('0x6b')]=_0x4db222[_0x2664('0x6b')];_0x4850d7[_0x2664('0x6c')]=_0x4db222[_0x2664('0x6c')];_[_0x2664('0x6d')](_0x4850d7,_[_0x2664('0x6e')](_0x4db222,_['keys'](_0x4850d7)));this[_0x2664('0x11')][_0x4db222[_0x2664('0x68')]]['push'](_0x4850d7);this[_0x2664('0x13')][_0x4db222[_0x2664('0x68')]]=_0x4850d7;this[_0x2664('0x45')](_0x4850d7);}}catch(_0x13cd04){logger[_0x2664('0x3c')](_0x2664('0x6f'),util[_0x2664('0x43')](_0x13cd04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x1e')]=function(_0x590308){try{if(this[_0x2664('0x5c')](_0x590308)){if(this[_0x2664('0x11')][_0x590308[_0x2664('0x68')]]){var _0x4ca034=_['last'](this['queueReports'][_0x590308[_0x2664('0x68')]]);_0x4ca034[_0x2664('0x70')]=![];_0x4ca034[_0x2664('0x71')]=null;_0x4ca034[_0x2664('0x72')]=_0x590308[_0x2664('0x72')];_0x4ca034[_0x2664('0x73')]=_0x590308[_0x2664('0x73')];_0x4ca034[_0x2664('0x1d')]=!![];_0x4ca034[_0x2664('0x74')]=moment()['format'](_0x2664('0x6a'));_0x4ca034[_0x2664('0x75')]=_0x2664('0x76');_0x4ca034[_0x2664('0x77')]=null;this['channels'][_0x590308[_0x2664('0x68')]]=_0x4ca034;this[_0x2664('0x42')](_0x4ca034);}}}catch(_0x806fc){logger[_0x2664('0x3c')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x2664('0x43')](_0x806fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')]['syncQueueCallerLeave']=function(_0x44fe06){try{if(this[_0x2664('0x5c')](_0x44fe06)){if(this[_0x2664('0x11')][_0x44fe06[_0x2664('0x68')]]){var _0x3bfd26=_[_0x2664('0x78')](this[_0x2664('0x11')][_0x44fe06[_0x2664('0x68')]]);_0x3bfd26['queuecallerleaveAt']=moment()[_0x2664('0x46')](_0x2664('0x6a'));_0x3bfd26[_0x2664('0x79')]=_0x44fe06['connectedlinenum'];_0x3bfd26['connectedlinename']=_0x44fe06[_0x2664('0x7a')];this[_0x2664('0x13')][_0x44fe06[_0x2664('0x68')]]=_0x3bfd26;this[_0x2664('0x45')](_0x3bfd26);}}}catch(_0x1d5ede){logger['error'](_0x2664('0x7b'),util[_0x2664('0x43')](_0x1d5ede,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x7c')]=function(_0x164c26){try{if(this['isNotNull'](_0x164c26)){if(this['queueReports'][_0x164c26[_0x2664('0x68')]]){var _0x4eeb2d=_[_0x2664('0x78')](this[_0x2664('0x11')][_0x164c26[_0x2664('0x68')]]);_0x4eeb2d[_0x2664('0x70')]=!![];_0x4eeb2d[_0x2664('0x75')]='COMPLETEDBYAGENT';}}}catch(_0x1bda67){logger[_0x2664('0x3c')](_0x2664('0x7d'),util[_0x2664('0x43')](_0x1bda67,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x7e')]=function(_0x588079){try{if(this[_0x2664('0x5c')](_0x588079)){if(this['queueReports'][_0x588079['uniqueid']]){var _0x4cff05=_[_0x2664('0x78')](this[_0x2664('0x11')][_0x588079[_0x2664('0x68')]]);_0x4cff05[_0x2664('0x1d')]=![];_0x4cff05[_0x2664('0x74')]=null;_0x4cff05[_0x2664('0x7f')]=!![];_0x4cff05[_0x2664('0x77')]=_0x588079[_0x2664('0x80')];_0x4cff05['holdtime']=_0x588079['holdtime'];_0x4cff05[_0x2664('0x70')]=!![];_0x4cff05['queuecallerexit']=![];_0x4cff05['queuecallerexitAt']=null;if(!_0x4cff05[_0x2664('0x81')]){if(_0x588079['reason']=='transfer'){_0x4cff05[_0x2664('0x75')]=_0x2664('0x82');}else{if(_[_0x2664('0x83')](_0x588079[_0x2664('0x84')][_0x2664('0x85')](),_0x2664('0x86'))){if(this[_0x2664('0x11')][_0x588079[_0x2664('0x87')]]){var _0x40502e=_[_0x2664('0x78')](this[_0x2664('0x11')][_0x588079[_0x2664('0x87')]]);_0x40502e[_0x2664('0x70')]=![];_0x40502e[_0x2664('0x88')]=!![];_0x40502e[_0x2664('0x89')]=moment(_0x4cff05['queuecallerjoinAt'])['add'](_0x588079['holdtime'],_0x2664('0x8a'))[_0x2664('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x40502e[_0x2664('0x75')]='FORWARDTRANSFER';_0x40502e[_0x2664('0x81')]=!![];_0x40502e[_0x2664('0x8b')]=_0x2664('0x8c');_0x40502e[_0x2664('0x8d')]=_0x588079['destexten'];_0x40502e[_0x2664('0x8e')]=_0x588079[_0x2664('0x68')];var _0x55aa31=this[_0x2664('0x11')][_0x588079[_0x2664('0x87')]];this[_0x2664('0x11')][_0x588079[_0x2664('0x87')]]=this[_0x2664('0x11')][_0x588079[_0x2664('0x68')]];this[_0x2664('0x11')][_0x588079[_0x2664('0x68')]]=_0x55aa31;}}else{_0x4cff05['queuecallerexitreason']='COMPLETEDBY'+_0x588079[_0x2664('0x8f')][_0x2664('0x90')]();}}}this[_0x2664('0x13')][_0x588079[_0x2664('0x68')]]=_0x4cff05;this[_0x2664('0x42')](_0x4cff05);}}}catch(_0x1f6bc3){logger[_0x2664('0x3c')](_0x2664('0x91'),util[_0x2664('0x43')](_0x1f6bc3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x22')]=function(_0x327983){try{if(this[_0x2664('0x5c')](_0x327983)){this[_0x2664('0x92')](_0x327983[_0x2664('0x68')],_[_0x2664('0x93')](_0x327983[_0x2664('0x94')])[0x0],_0x327983['value']);if(this[_0x2664('0x11')][_0x327983['uniqueid']]){var _0x575b55=_['last'](this['queueReports'][_0x327983['uniqueid']]);if(_0x575b55){if(this[_0x2664('0x5c')](_0x327983[_0x2664('0x94')])&&this[_0x2664('0x5c')](_0x327983[_0x2664('0x94')][_0x2664('0x95')])){switch(_0x327983[_0x2664('0x96')]){case _0x2664('0x97'):_0x575b55[_0x2664('0x88')]=![];_0x575b55[_0x2664('0x89')]=null;break;case _0x2664('0x98'):_0x575b55['lastevent']=_0x2664('0x99');ami[_0x2664('0x44')](_0x2664('0x9a'),_0x575b55);break;default:_0x575b55[_0x2664('0x88')]=!![];_0x575b55[_0x2664('0x89')]=moment()[_0x2664('0x46')](_0x2664('0x6a'));_0x575b55['queuecallerleaveAt']=moment()['format'](_0x2664('0x6a'));}_0x575b55['queuecallerabandon']=![];_0x575b55[_0x2664('0x74')]=null;_0x575b55['queuecallerexitreason']=_0x327983['value'];this[_0x2664('0x13')][_0x327983[_0x2664('0x68')]]=_0x575b55;this[_0x2664('0x42')](_0x575b55);}else if(this[_0x2664('0x5c')](_0x327983[_0x2664('0x94')])&&this[_0x2664('0x5c')](_0x327983[_0x2664('0x94')][_0x2664('0x9b')])){if(!_0x575b55[_0x2664('0x1d')]){_0x575b55[_0x2664('0x88')]=!![];_0x575b55['queuecallerexitAt']=moment()[_0x2664('0x46')](_0x2664('0x6a'));_0x575b55[_0x2664('0x75')]=_0x2664('0x9c');_0x575b55['queuecallerleaveAt']=moment()[_0x2664('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2664('0x13')][_0x327983['uniqueid']]=_0x575b55;}}_0x575b55[_0x2664('0x17')]=this[_0x2664('0x17')][_0x327983['uniqueid']];}}}}catch(_0x74241e){logger['error']('[syncVarSet][VoiceQueueReport]',util[_0x2664('0x43')](_0x74241e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2664('0xc')]['addVariable']=function(_0xd4ac8f,_0x199efe,_0x1b53ca){var _0x102a2c=['rtpaudioqos','rtpaudioqosbridged',_0x2664('0x9d'),_0x2664('0x9e'),_0x2664('0x9f'),_0x2664('0xa0'),_0x2664('0xa1'),_0x2664('0xa2'),_0x2664('0xa3'),_0x2664('0xa4'),_0x2664('0xa5'),_0x2664('0xa6'),'membercalls',_0x2664('0xa7'),_0x2664('0xa8'),_0x2664('0xa9'),_0x2664('0x80'),_0x2664('0xaa'),'memberrealtime'];if(!_['isNil'](_0x199efe)&&!_['includes'](_0x102a2c,_0x199efe)){if(_['isUndefined'](this[_0x2664('0x17')][_0xd4ac8f])){this[_0x2664('0x17')][_0xd4ac8f]={};}this[_0x2664('0x17')][_0xd4ac8f][_0x199efe]=_0x1b53ca;}};VoiceQueueReport[_0x2664('0xc')][_0x2664('0x24')]=function(_0x45fade){try{if(this['isNotNull'](_0x45fade)){if(this[_0x2664('0x11')][_0x45fade['uniqueid']]){for(var _0x49891e=0x0,_0x35a451={};_0x49891e=0x0?moment(_0x5b790b[_0xdc5f('0x14')])[_0xdc5f('0x16')](_0x5b790b[_0xdc5f('0x13')],_0xdc5f('0x15')):null,'data1':_0xdc5f('0x17'),'data2':_0x5b790b[_0xdc5f('0x10')],'data3':_0x5b790b[_0xdc5f('0x18')],'data4':_0x5b790b['dialstring']||null,'role':'agent','internal':_0x5b790b[_0xdc5f('0x10')]?_['toNumber'](_0x5b790b[_0xdc5f('0x10')]):undefined,'uniqueid':_0x5b790b['uniqueid']},'log':_0xdc5f('0x6')});}; \ No newline at end of file +var _0x9537=['isNil','format','SIP/%s','queuecallerleaveAt','diff','seconds','exten','queue','agent','accountcode','voice','interface','TALKING','starttime','endtime','outbound','dialstring','toNumber','uniqueid','moment','lodash','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo'];(function(_0x3b10df,_0x46d3ec){var _0x50501e=function(_0x28b8b5){while(--_0x28b8b5){_0x3b10df['push'](_0x3b10df['shift']());}};_0x50501e(++_0x46d3ec);}(_0x9537,0x83));var _0x7953=function(_0x5a4dcf,_0x1b2006){_0x5a4dcf=_0x5a4dcf-0x0;var _0xa1b977=_0x9537[_0x5a4dcf];return _0xa1b977;};'use strict';var moment=require(_0x7953('0x0'));var _=require(_0x7953('0x1'));var util=require(_0x7953('0x2'));var client=require('../client');exports[_0x7953('0x3')]=function(_0x491695){var _0x131423=_0x491695[_0x7953('0x4')]||_0x491695[_0x7953('0x5')];return client[_0x7953('0x6')](_0x7953('0x7'),{'body':{'channel':'voice','membername':_0x491695[_0x7953('0x8')],'interface':_[_0x7953('0x9')](_0x491695['interface'])?util[_0x7953('0xa')](_0x7953('0xb'),_0x491695[_0x7953('0x8')]):_0x491695['interface'],'type':'TALKING','enterAt':_0x491695[_0x7953('0xc')],'exitAt':_0x131423,'duration':moment(_0x131423)[_0x7953('0xd')](_0x491695[_0x7953('0xc')],_0x7953('0xe')),'data1':'inbound','data2':_0x491695['calleridnum'],'data3':_0x491695[_0x7953('0xf')],'data4':null,'data5':_0x491695[_0x7953('0x10')],'role':_0x7953('0x11'),'internal':_0x491695['accountcode']?_['toNumber'](_0x491695[_0x7953('0x12')]):undefined,'uniqueid':_0x491695['uniqueid']},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x1a3a19){return client[_0x7953('0x6')](_0x7953('0x7'),{'body':{'channel':_0x7953('0x13'),'membername':_0x1a3a19['membername'],'interface':_0x1a3a19[_0x7953('0x14')],'type':_0x7953('0x15'),'enterAt':_0x1a3a19[_0x7953('0x16')],'exitAt':_0x1a3a19[_0x7953('0x17')],'duration':moment(_0x1a3a19['endtime'])[_0x7953('0xd')](_0x1a3a19[_0x7953('0x16')],_0x7953('0xe'))>=0x0?moment(_0x1a3a19[_0x7953('0x17')])[_0x7953('0xd')](_0x1a3a19['starttime'],_0x7953('0xe')):null,'data1':_0x7953('0x18'),'data2':_0x1a3a19[_0x7953('0x12')],'data3':_0x1a3a19[_0x7953('0xf')],'data4':_0x1a3a19[_0x7953('0x19')]||null,'role':_0x7953('0x11'),'internal':_0x1a3a19[_0x7953('0x12')]?_[_0x7953('0x1a')](_0x1a3a19['accountcode']):undefined,'uniqueid':_0x1a3a19[_0x7953('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 458dda3..397bfcf 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 _0x1152=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0x1152,0x182));var _0x2115=function(_0x3a1953,_0x440442){_0x3a1953=_0x3a1953-0x0;var _0x51c757=_0x1152[_0x3a1953];return _0x51c757;};'use strict';var client=require(_0x2115('0x0'));exports[_0x2115('0x1')]=function(_0x190884){return function(_0x260dd2){return client[_0x2115('0x2')](_0x2115('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2115('0x4'),_0x2115('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xbaf0=['GetTemplate','name','getTemplates','Request'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x0baf('0x0')]=function(_0x2a3620){return function(_0x1e212d){return client[_0x0baf('0x1')](_0x0baf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0baf('0x3'),'html']},'log':_0x0baf('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 9e8b1ce..97dcd74 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 _0xbdc4=['status','Condition','AllConditions','operator','field','value','Action','Actions','action','data1','data2','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','channel'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbdc4,0xeb));var _0x4bdc=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0xbdc4[_0x1992f1];return _0x413dfe;};'use strict';var client=require(_0x4bdc('0x0'));exports[_0x4bdc('0x1')]=function(_0x5d19b1){return function(_0x1e83f5){return client[_0x4bdc('0x2')](_0x4bdc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x4bdc('0x4'),_0x4bdc('0x5')],'include':[{'model':_0x4bdc('0x6'),'as':_0x4bdc('0x7'),'attributes':['id','field',_0x4bdc('0x8'),'value']},{'model':_0x4bdc('0x6'),'as':'AnyConditions','attributes':['id',_0x4bdc('0x9'),'operator',_0x4bdc('0xa')]},{'model':_0x4bdc('0xb'),'as':_0x4bdc('0xc'),'attributes':['id',_0x4bdc('0xd'),_0x4bdc('0xe'),_0x4bdc('0xf'),_0x4bdc('0x10'),_0x4bdc('0x11'),_0x4bdc('0x12'),'data6',_0x4bdc('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x48b8=['Request','GetTrigger','name','channel','Condition','operator','value','AnyConditions','field','Action','Actions','action','data1','data2','data3','data5','data7','../client','getTriggers'];(function(_0x15fab0,_0x416c7d){var _0x1b41a8=function(_0x30d165){while(--_0x30d165){_0x15fab0['push'](_0x15fab0['shift']());}};_0x1b41a8(++_0x416c7d);}(_0x48b8,0x1ec));var _0x848b=function(_0x52107e,_0xc043c8){_0x52107e=_0x52107e-0x0;var _0x4fadd7=_0x48b8[_0x52107e];return _0x4fadd7;};'use strict';var client=require(_0x848b('0x0'));exports[_0x848b('0x1')]=function(_0x4b47aa){return function(_0x42b749){return client[_0x848b('0x2')](_0x848b('0x3'),{'options':{'raw':![],'attributes':['id',_0x848b('0x4'),_0x848b('0x5'),'status'],'include':[{'model':_0x848b('0x6'),'as':'AllConditions','attributes':['id','field',_0x848b('0x7'),_0x848b('0x8')]},{'model':_0x848b('0x6'),'as':_0x848b('0x9'),'attributes':['id',_0x848b('0xa'),_0x848b('0x7'),_0x848b('0x8')]},{'model':_0x848b('0xb'),'as':_0x848b('0xc'),'attributes':['id',_0x848b('0xd'),_0x848b('0xe'),_0x848b('0xf'),_0x848b('0x10'),'data4',_0x848b('0x11'),'data6',_0x848b('0x12')]}]},'log':_0x848b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index e5e5117..6ac3ffb 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 _0x3e06=['GetTrunk','../client','getTrunks','name','registry'];(function(_0x23d543,_0x4c0c56){var _0x299c68=function(_0x5ebbe5){while(--_0x5ebbe5){_0x23d543['push'](_0x23d543['shift']());}};_0x299c68(++_0x4c0c56);}(_0x3e06,0x10f));var _0x63e0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3e06[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x63e0('0x0'));exports[_0x63e0('0x1')]=function(_0x156f19){return function(_0x3b504b){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x63e0('0x2'),_0x63e0('0x3')]},'log':_0x63e0('0x4')});};}; \ No newline at end of file +var _0x154c=['getTrunks','Request','GetTrunk','name','registry','../client'];(function(_0x32a68a,_0x4a803b){var _0x2609a7=function(_0x52f575){while(--_0x52f575){_0x32a68a['push'](_0x32a68a['shift']());}};_0x2609a7(++_0x4a803b);}(_0x154c,0x131));var _0xc154=function(_0x1f4295,_0x5d0590){_0x1f4295=_0x1f4295-0x0;var _0x39070e=_0x154c[_0x1f4295];return _0x39070e;};'use strict';var client=require(_0xc154('0x0'));exports[_0xc154('0x1')]=function(_0x2dffcc){return function(_0xc0c04c){return client[_0xc154('0x2')](_0xc154('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc154('0x4'),_0xc154('0x5')]},'log':_0xc154('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index fb4138d..2969d5d 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 _0x2c6c=['pauseType','lastPauseAt','voicePause','phone','telephone','internal','getTelephones','savePause','Request','PauseUser','saveUnpause','getAgent','ShowUser','online','lastLoginAt','interface','../client','getAgents','GetUser','agent','name','email','accountcode','fullname'];(function(_0x39424e,_0x6c6f5b){var _0x126b81=function(_0x4491c3){while(--_0x4491c3){_0x39424e['push'](_0x39424e['shift']());}};_0x126b81(++_0x6c6f5b);}(_0x2c6c,0x1f0));var _0xc2c6=function(_0x148114,_0x519a3d){_0x148114=_0x148114-0x0;var _0x4a8153=_0x2c6c[_0x148114];return _0x4a8153;};'use strict';var client=require(_0xc2c6('0x0'));exports[_0xc2c6('0x1')]=function(){return function(){return client['Request'](_0xc2c6('0x2'),{'options':{'raw':![],'where':{'role':_0xc2c6('0x3')},'attributes':['id',_0xc2c6('0x4'),_0xc2c6('0x5'),_0xc2c6('0x6'),_0xc2c6('0x7'),'online','lastLoginAt',_0xc2c6('0x8'),_0xc2c6('0x9'),_0xc2c6('0xa'),_0xc2c6('0xb'),'mobile','interface']},'log':_0xc2c6('0x1')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xc2c6('0x2'),{'options':{'raw':!![],'where':{'role':_0xc2c6('0xc')},'attributes':['id','name','accountcode',_0xc2c6('0xd')]},'log':_0xc2c6('0xe')});};};exports[_0xc2c6('0xf')]=function(_0x4ebedc,_0x5f23ec,_0x374e14){return client[_0xc2c6('0x10')](_0xc2c6('0x11'),{'body':{'type':_0x5f23ec,'uniqueid':_0x374e14},'options':{'where':{'id':_0x4ebedc['id']}},'log':_0xc2c6('0xf')});};exports[_0xc2c6('0x12')]=function(_0x1e4e57){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1e4e57['id']}},'log':_0xc2c6('0xf')});};exports[_0xc2c6('0x13')]=function(_0x1c0317){return client['Request'](_0xc2c6('0x14'),{'options':{'raw':![],'where':{'role':_0xc2c6('0x3'),'id':_0x1c0317},'attributes':['id','name',_0xc2c6('0x5'),_0xc2c6('0x6'),_0xc2c6('0x7'),_0xc2c6('0x15'),_0xc2c6('0x16'),'pauseType',_0xc2c6('0x9'),_0xc2c6('0xa'),_0xc2c6('0x17')]},'log':_0xc2c6('0x13')});}; \ No newline at end of file +var _0x626f=['mobile','telephone','name','internal','getTelephones','savePause','PauseUser','agent','fullname','interface','getAgent','../client','Request','GetUser','email','accountcode','online','pauseType','lastPauseAt','voicePause','phone'];(function(_0x1c6139,_0x9b17c){var _0x1e219d=function(_0x36c15a){while(--_0x36c15a){_0x1c6139['push'](_0x1c6139['shift']());}};_0x1e219d(++_0x9b17c);}(_0x626f,0x19a));var _0xf626=function(_0x560950,_0x177fc){_0x560950=_0x560950-0x0;var _0xda727a=_0x626f[_0x560950];return _0xda727a;};'use strict';var client=require(_0xf626('0x0'));exports['getAgents']=function(){return function(){return client[_0xf626('0x1')](_0xf626('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name',_0xf626('0x3'),_0xf626('0x4'),'fullname',_0xf626('0x5'),'lastLoginAt',_0xf626('0x6'),_0xf626('0x7'),_0xf626('0x8'),_0xf626('0x9'),_0xf626('0xa'),'interface']},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0xf626('0xb')},'attributes':['id',_0xf626('0xc'),_0xf626('0x4'),_0xf626('0xd')]},'log':_0xf626('0xe')});};};exports[_0xf626('0xf')]=function(_0x247fe9,_0x17283e,_0x2d8e66){return client['Request'](_0xf626('0x10'),{'body':{'type':_0x17283e,'uniqueid':_0x2d8e66},'options':{'where':{'id':_0x247fe9['id']}},'log':_0xf626('0xf')});};exports['saveUnpause']=function(_0x1694db){return client[_0xf626('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1694db['id']}},'log':_0xf626('0xf')});};exports['getAgent']=function(_0x202b43){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0xf626('0x11'),'id':_0x202b43},'attributes':['id',_0xf626('0xc'),_0xf626('0x3'),_0xf626('0x4'),_0xf626('0x12'),_0xf626('0x5'),'lastLoginAt','pauseType','lastPauseAt',_0xf626('0x8'),_0xf626('0x13')]},'log':_0xf626('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4fec930..ad37cfe 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 _0xca2b=['../client','create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x1dfc36,_0x13e809){var _0xb244c2=function(_0x3385ee){while(--_0x3385ee){_0x1dfc36['push'](_0x1dfc36['shift']());}};_0xb244c2(++_0x13e809);}(_0xca2b,0x156));var _0xbca2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xca2b[_0x27af45];return _0x18df21;};'use strict';var client=require(_0xbca2('0x0'));exports[_0xbca2('0x1')]=function(_0x473cac){return client[_0xbca2('0x2')](_0xbca2('0x3'),{'body':_0x473cac,'log':_0xbca2('0x3')});};exports[_0xbca2('0x4')]=function(_0x180a93,_0x48a06a,_0x24af48){return client[_0xbca2('0x2')]('UpdateVoiceAgentReport',{'body':_0x180a93,'options':{'where':{'uniqueid':_0x48a06a,'interface':_0x24af48,'agentcomplete':!![]}},'log':_0xbca2('0x5')});}; \ No newline at end of file +var _0x6e9b=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x2a4712,_0x39e9e0){var _0x2838ae=function(_0x3be7d9){while(--_0x3be7d9){_0x2a4712['push'](_0x2a4712['shift']());}};_0x2838ae(++_0x39e9e0);}(_0x6e9b,0x1e4));var _0xb6e9=function(_0x4f2031,_0x37a74d){_0x4f2031=_0x4f2031-0x0;var _0x5984df=_0x6e9b[_0x4f2031];return _0x5984df;};'use strict';var client=require(_0xb6e9('0x0'));exports[_0xb6e9('0x1')]=function(_0x58b9a3){return client[_0xb6e9('0x2')](_0xb6e9('0x3'),{'body':_0x58b9a3,'log':_0xb6e9('0x3')});};exports[_0xb6e9('0x4')]=function(_0x24259f,_0x33f9d9,_0x247399){return client[_0xb6e9('0x2')](_0xb6e9('0x5'),{'body':_0x24259f,'options':{'where':{'uniqueid':_0x33f9d9,'interface':_0x247399,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 023b00c..05abbf0 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 _0x3e7d=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','format','endOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2acaa1,_0xda0033){var _0x1f4ea4=function(_0x3334ed){while(--_0x3334ed){_0x2acaa1['push'](_0x2acaa1['shift']());}};_0x1f4ea4(++_0xda0033);}(_0x3e7d,0x181));var _0xd3e7=function(_0x16e384,_0x54286a){_0x16e384=_0x16e384-0x0;var _0x20ea67=_0x3e7d[_0x16e384];return _0x20ea67;};'use strict';var moment=require(_0xd3e7('0x0'));var util=require(_0xd3e7('0x1'));var _=require(_0xd3e7('0x2'));var client=require(_0xd3e7('0x3'));exports['create']=function(_0x49cce8){return client[_0xd3e7('0x4')]('CreateVoiceCallReport',{'body':_[_0xd3e7('0x5')](_0x49cce8,{'source':_0x49cce8[_0xd3e7('0x6')],'destinationcontext':_0x49cce8[_0xd3e7('0x7')],'callerid':_0x49cce8[_0xd3e7('0x8')],'amaflags':_0xd3e7('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0xd3e7('0xa')]=function(){return function(){return client[_0xd3e7('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd3e7('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xd3e7('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xd3e7('0xd')]('day')['format'](_0xd3e7('0xe'))]}},'attributes':[_0xd3e7('0xf'),_0xd3e7('0x10'),_0xd3e7('0x11'),_0xd3e7('0x12')]},'log':_0xd3e7('0x13')});};}; \ No newline at end of file +var _0x5b1d=['getVoiceCallReports','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION'];(function(_0x15d046,_0x58e282){var _0x46cc7a=function(_0x155500){while(--_0x155500){_0x15d046['push'](_0x15d046['shift']());}};_0x46cc7a(++_0x58e282);}(_0x5b1d,0x1c2));var _0xd5b1=function(_0x5a4621,_0x2a7b43){_0x5a4621=_0x5a4621-0x0;var _0x4a8fd5=_0x5b1d[_0x5a4621];return _0x4a8fd5;};'use strict';var moment=require('moment');var util=require(_0xd5b1('0x0'));var _=require(_0xd5b1('0x1'));var client=require(_0xd5b1('0x2'));exports[_0xd5b1('0x3')]=function(_0x328ebd){return client[_0xd5b1('0x4')](_0xd5b1('0x5'),{'body':_[_0xd5b1('0x6')](_0x328ebd,{'source':_0x328ebd['calleridnum'],'destinationcontext':_0x328ebd[_0xd5b1('0x7')],'callerid':_0x328ebd[_0xd5b1('0x8')],'amaflags':_0xd5b1('0x9')}),'log':_0xd5b1('0x5')});};exports[_0xd5b1('0xa')]=function(){return function(){return client[_0xd5b1('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd5b1('0xb')],'createdAt':{'$between':[moment()[_0xd5b1('0xc')](_0xd5b1('0xd'))['format'](_0xd5b1('0xe')),moment()[_0xd5b1('0xf')](_0xd5b1('0xd'))[_0xd5b1('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xd5b1('0x11'),_0xd5b1('0x12'),'billableseconds']},'log':_0xd5b1('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1f70ea0..a2c611d 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 _0xb06b=['Request','CreateVoiceDialReport','../client'];(function(_0x3081fc,_0x125e97){var _0x465cdb=function(_0x27b116){while(--_0x27b116){_0x3081fc['push'](_0x3081fc['shift']());}};_0x465cdb(++_0x125e97);}(_0xb06b,0x10d));var _0xbb06=function(_0x2fea18,_0x155085){_0x2fea18=_0x2fea18-0x0;var _0x53a722=_0xb06b[_0x2fea18];return _0x53a722;};'use strict';var client=require(_0xbb06('0x0'));exports['create']=function(_0x26205e){return client[_0xbb06('0x1')](_0xbb06('0x2'),{'body':_0x26205e,'log':_0xbb06('0x2')});}; \ No newline at end of file +var _0xa522=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0xa522,0x1d3));var _0x2a52=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xa522[_0x286bfb];return _0x52b683;};'use strict';var client=require(_0x2a52('0x0'));exports[_0x2a52('0x1')]=function(_0x5bc519){return client[_0x2a52('0x2')](_0x2a52('0x3'),{'body':_0x5bc519,'log':_0x2a52('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 96ada9a..bb16d40 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 _0x5df3=['getVoiceExtensions','../client','GetVoiceExtension','exten','recordingFormat'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x5df3,0x15f));var _0x35df=function(_0x42f41b,_0x67e11f){_0x42f41b=_0x42f41b-0x0;var _0x4a4e89=_0x5df3[_0x42f41b];return _0x4a4e89;};'use strict';var client=require(_0x35df('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x35df('0x1'),{'options':{'raw':!![],'attributes':['id',_0x35df('0x2'),_0x35df('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x35df('0x4')});};}; \ No newline at end of file +var _0x236c=['Request','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client'];(function(_0x152007,_0x2436fe){var _0x322d31=function(_0x5d0e78){while(--_0x5d0e78){_0x152007['push'](_0x152007['shift']());}};_0x322d31(++_0x2436fe);}(_0x236c,0x155));var _0xc236=function(_0x751432,_0x835c92){_0x751432=_0x751432-0x0;var _0x27096e=_0x236c[_0x751432];return _0x27096e;};'use strict';var client=require(_0xc236('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xc236('0x1')](_0xc236('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc236('0x3'),_0xc236('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc236('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d19db64..cbd80ac 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 _0x4f20=['dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive'];(function(_0x11c1cd,_0x1a315a){var _0x51e917=function(_0x4eb6b7){while(--_0x4eb6b7){_0x11c1cd['push'](_0x11c1cd['shift']());}};_0x51e917(++_0x1a315a);}(_0x4f20,0x141));var _0x04f2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4f20[_0x397e5f];return _0x5302b8;};'use strict';var client=require(_0x04f2('0x0'));exports[_0x04f2('0x1')]=function(){return function(){return client['Request'](_0x04f2('0x2'),{'options':{'raw':![],'attributes':['id',_0x04f2('0x3'),_0x04f2('0x4'),_0x04f2('0x5'),_0x04f2('0x6'),_0x04f2('0x7'),_0x04f2('0x8'),_0x04f2('0x9'),_0x04f2('0xa'),'dialLimitChannel','dialLimitQueue',_0x04f2('0xb'),_0x04f2('0xc'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x04f2('0xd'),_0x04f2('0xe'),_0x04f2('0xf'),'dialQueueOptions',_0x04f2('0x10'),_0x04f2('0x11'),'dialCongestionMaxRetry',_0x04f2('0x12'),_0x04f2('0x13'),_0x04f2('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x04f2('0x15'),_0x04f2('0x16'),_0x04f2('0x17'),_0x04f2('0x18'),_0x04f2('0x19'),_0x04f2('0x1a'),_0x04f2('0x1b'),'dialAMDGreeting',_0x04f2('0x1c'),_0x04f2('0x1d'),'dialAMDMinWordLength',_0x04f2('0x1e'),_0x04f2('0x1f'),_0x04f2('0x20'),_0x04f2('0x21'),_0x04f2('0x22'),_0x04f2('0x23'),_0x04f2('0x24'),_0x04f2('0x25'),'dialAgiAfterHangupAgent',_0x04f2('0x26'),_0x04f2('0x27'),'monitor_format','strategy',_0x04f2('0x28'),'dialCutDigit',_0x04f2('0x29'),'dialNoSuchNumberRetryFrequency',_0x04f2('0x2a'),_0x04f2('0x2b'),'dialAbandonedMaxRetry',_0x04f2('0x2c'),_0x04f2('0x2d'),'dialMachineRetryFrequency',_0x04f2('0x2e'),_0x04f2('0x2f'),_0x04f2('0x30'),_0x04f2('0x31'),_0x04f2('0x32')],'include':[{'model':_0x04f2('0x33'),'as':_0x04f2('0x33'),'attributes':['id','name',_0x04f2('0x34'),_0x04f2('0x35')]},{'model':_0x04f2('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x04f2('0x3')]},{'model':'Trunk','as':_0x04f2('0x37'),'attributes':['id','name',_0x04f2('0x34'),_0x04f2('0x35')]},{'model':_0x04f2('0x38'),'as':_0x04f2('0x38'),'attributes':['id',_0x04f2('0x3')],'include':[{'model':_0x04f2('0x38'),'as':'Intervals','attributes':['id',_0x04f2('0x3'),_0x04f2('0x39')]}]}]},'log':_0x04f2('0x1')});};}; \ No newline at end of file +var _0x6245=['dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x450ceb,_0x5ae17c){var _0x21f906=function(_0x3a2007){while(--_0x3a2007){_0x450ceb['push'](_0x450ceb['shift']());}};_0x21f906(++_0x5ae17c);}(_0x6245,0xe6));var _0x5624=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x6245[_0x34eb31];return _0x254994;};'use strict';var client=require(_0x5624('0x0'));exports[_0x5624('0x1')]=function(){return function(){return client[_0x5624('0x2')](_0x5624('0x3'),{'options':{'raw':![],'attributes':['id',_0x5624('0x4'),_0x5624('0x5'),_0x5624('0x6'),_0x5624('0x7'),'monitor_format',_0x5624('0x8'),_0x5624('0x9'),_0x5624('0xa'),_0x5624('0xb'),_0x5624('0xc'),'dialPowerLevel',_0x5624('0xd'),_0x5624('0xe'),_0x5624('0xf'),_0x5624('0x10'),_0x5624('0x11'),_0x5624('0x12'),_0x5624('0x13'),_0x5624('0x14'),_0x5624('0x15'),_0x5624('0x16'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x5624('0x17'),'dialNoAnswerMaxRetry',_0x5624('0x18'),_0x5624('0x19'),_0x5624('0x1a'),_0x5624('0x1b'),_0x5624('0x1c'),_0x5624('0x1d'),_0x5624('0x1e'),_0x5624('0x1f'),_0x5624('0x20'),_0x5624('0x21'),_0x5624('0x22'),_0x5624('0x23'),'dialAMDBetweenWordsSilence',_0x5624('0x24'),_0x5624('0x25'),_0x5624('0x26'),_0x5624('0x27'),_0x5624('0x28'),_0x5624('0x29'),_0x5624('0x2a'),_0x5624('0x2b'),_0x5624('0x2c'),_0x5624('0x2d'),'monitor_format',_0x5624('0x2e'),_0x5624('0x2f'),_0x5624('0x30'),_0x5624('0x31'),_0x5624('0x32'),_0x5624('0x33'),'dialDropRetryFrequency',_0x5624('0x34'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x5624('0x35'),_0x5624('0x36'),_0x5624('0x37'),_0x5624('0x38'),_0x5624('0x39'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x5624('0x3a'),'attributes':['id',_0x5624('0x4'),_0x5624('0x3b'),_0x5624('0x3c')]},{'model':_0x5624('0x3d'),'as':'mandatoryDispositionPause','attributes':['id',_0x5624('0x4')]},{'model':_0x5624('0x3a'),'as':'TrunkBackup','attributes':['id',_0x5624('0x4'),_0x5624('0x3b'),'active']},{'model':_0x5624('0x3e'),'as':'Interval','attributes':['id',_0x5624('0x4')],'include':[{'model':'Interval','as':_0x5624('0x3f'),'attributes':['id',_0x5624('0x4'),'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 43da8d5..5585643 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 _0xdae5=['day','endOf','format','uniqueid','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','../client','create','CreateVoiceQueueReport','Request','GetVoiceQueueReport','startOf'];(function(_0x1cea92,_0x3a3293){var _0xdba51b=function(_0x1594fc){while(--_0x1594fc){_0x1cea92['push'](_0x1cea92['shift']());}};_0xdba51b(++_0x3a3293);}(_0xdae5,0x1e0));var _0x5dae=function(_0x6bcdb3,_0x1664ba){_0x6bcdb3=_0x6bcdb3-0x0;var _0x148c17=_0xdae5[_0x6bcdb3];return _0x148c17;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0x5dae('0x0'));exports[_0x5dae('0x1')]=function(_0x1ffe8d){return client['Request'](_0x5dae('0x2'),{'body':_0x1ffe8d,'log':_0x5dae('0x2')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x5dae('0x3')](_0x5dae('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5dae('0x5')](_0x5dae('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5dae('0x7')](_0x5dae('0x6'))[_0x5dae('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x5dae('0x9'),'queue',_0x5dae('0xa'),_0x5dae('0xb'),'queuecallercomplete',_0x5dae('0xc'),_0x5dae('0xd'),_0x5dae('0xe'),_0x5dae('0xf'),_0x5dae('0x10')]},'log':_0x5dae('0x11')});};}; \ No newline at end of file +var _0xd20c=['queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt'];(function(_0xb21fd5,_0x4dbca1){var _0x2ccc88=function(_0x308a9b){while(--_0x308a9b){_0xb21fd5['push'](_0xb21fd5['shift']());}};_0x2ccc88(++_0x4dbca1);}(_0xd20c,0x16b));var _0xcd20=function(_0x4ddb99,_0x3152bb){_0x4ddb99=_0x4ddb99-0x0;var _0x34fed2=_0xd20c[_0x4ddb99];return _0x34fed2;};'use strict';var moment=require(_0xcd20('0x0'));var _=require(_0xcd20('0x1'));var client=require(_0xcd20('0x2'));exports['create']=function(_0x336f02){return client[_0xcd20('0x3')](_0xcd20('0x4'),{'body':_0x336f02,'log':'CreateVoiceQueueReport'});};exports[_0xcd20('0x5')]=function(){return function(){return client[_0xcd20('0x3')](_0xcd20('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xcd20('0x7'))[_0xcd20('0x8')](_0xcd20('0x9')),moment()[_0xcd20('0xa')]('day')[_0xcd20('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xcd20('0xb'),_0xcd20('0xc'),_0xcd20('0xd'),_0xcd20('0xe'),_0xcd20('0xf'),'queuecallercompleteAt',_0xcd20('0x10'),_0xcd20('0x11'),_0xcd20('0x12'),_0xcd20('0x13')]},'log':_0xcd20('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 15ae00f..775090d 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 _0xe77d=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xe77d,0x1b0));var _0xde77=function(_0x42fcbe,_0x6b7373){_0x42fcbe=_0x42fcbe-0x0;var _0xc828ef=_0xe77d[_0x42fcbe];return _0xc828ef;};'use strict';var client=require('../client');exports[_0xde77('0x0')]=function(_0x259f99){return function(){return client[_0xde77('0x1')](_0xde77('0x2'),{'options':{'where':{'VoiceQueueId':_0x259f99,'paused':!![]},'raw':!![]},'log':_0xde77('0x0')});};}; \ No newline at end of file +var _0xc1d7=['GetVoiceQueueRtPauses','Request'];(function(_0x54672d,_0x2be3f9){var _0xeb2e0f=function(_0xd564af){while(--_0xd564af){_0x54672d['push'](_0x54672d['shift']());}};_0xeb2e0f(++_0x2be3f9);}(_0xc1d7,0x1ed));var _0x7c1d=function(_0x424329,_0x1a3e61){_0x424329=_0x424329-0x0;var _0x324625=_0xc1d7[_0x424329];return _0x324625;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0xd0cf){return function(){return client[_0x7c1d('0x0')](_0x7c1d('0x1'),{'options':{'where':{'VoiceQueueId':_0xd0cf,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index ac69d61..c1378c1 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 _0x914a=['monitorFilename','lodash','../client','create','CreateVoiceRecording','merge'];(function(_0x6b63f,_0x48b18d){var _0x34ba60=function(_0x2cbdbb){while(--_0x2cbdbb){_0x6b63f['push'](_0x6b63f['shift']());}};_0x34ba60(++_0x48b18d);}(_0x914a,0x11b));var _0xa914=function(_0x3ecf65,_0x3bac13){_0x3ecf65=_0x3ecf65-0x0;var _0x1907df=_0x914a[_0x3ecf65];return _0x1907df;};'use strict';var _=require(_0xa914('0x0'));var client=require(_0xa914('0x1'));exports[_0xa914('0x2')]=function(_0x19df6e){return client['Request'](_0xa914('0x3'),{'body':_[_0xa914('0x4')](_0x19df6e,{'value':_0x19df6e[_0xa914('0x5')]}),'log':_0xa914('0x3')});}; \ No newline at end of file +var _0x8780=['monitorFilename','Request','CreateVoiceRecording','merge'];(function(_0x80c6dd,_0xbb8ab1){var _0x1cf213=function(_0x3715e6){while(--_0x3715e6){_0x80c6dd['push'](_0x80c6dd['shift']());}};_0x1cf213(++_0xbb8ab1);}(_0x8780,0x1c1));var _0x0878=function(_0x216d8d,_0x35969c){_0x216d8d=_0x216d8d-0x0;var _0x547a5c=_0x8780[_0x216d8d];return _0x547a5c;};'use strict';var _=require('lodash');var client=require('../client');exports['create']=function(_0x6901ca){return client[_0x0878('0x0')](_0x0878('0x1'),{'body':_[_0x0878('0x2')](_0x6901ca,{'value':_0x6901ca[_0x0878('0x3')]}),'log':_0x0878('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index bc8e276..d0b21c4 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 _0x6bb5=['transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x571c47,_0x438835){var _0x3b2953=function(_0x5802b9){while(--_0x5802b9){_0x571c47['push'](_0x571c47['shift']());}};_0x3b2953(++_0x438835);}(_0x6bb5,0x1c8));var _0x56bb=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0x6bb5[_0x1af0e5];return _0x3c444a;};'use strict';var client=require(_0x56bb('0x0'));exports['blindTransfer']=function(_0x3f420e){return client[_0x56bb('0x1')](_0x56bb('0x2'),{'body':{'result':_0x3f420e[_0x56bb('0x3')],'transfererchannel':_0x3f420e['transfererchannel'],'transferercalleridnum':_0x3f420e[_0x56bb('0x4')],'transferercalleridname':_0x3f420e[_0x56bb('0x5')],'transfererconnectedlinenum':_0x3f420e[_0x56bb('0x6')],'transfererconnectedlinename':_0x3f420e[_0x56bb('0x7')],'transfereraccountcode':_0x3f420e['transfereraccountcode'],'transferercontext':_0x3f420e[_0x56bb('0x8')],'transfererexten':_0x3f420e['transfererexten'],'transfererlinkedid':_0x3f420e[_0x56bb('0x9')],'transfereechannel':_0x3f420e[_0x56bb('0xa')],'transfereecalleridnum':_0x3f420e[_0x56bb('0xb')],'transfereecalleridname':_0x3f420e[_0x56bb('0xc')],'transfereeconnectedlinenum':_0x3f420e[_0x56bb('0xd')],'transfereeconnectedlinename':_0x3f420e[_0x56bb('0xe')],'transfereeaccountcode':_0x3f420e[_0x56bb('0xf')],'transfereecontext':_0x3f420e[_0x56bb('0x10')],'transfereeexten':_0x3f420e[_0x56bb('0x11')],'transfereelinkedid':_0x3f420e[_0x56bb('0x12')],'isexternal':_0x3f420e['isexternal'],'context':_0x3f420e[_0x56bb('0x13')],'extension':_0x3f420e[_0x56bb('0x14')],'type':_0x56bb('0x15')},'log':_0x56bb('0x2')});};exports[_0x56bb('0x16')]=function(_0x50b7ad){return client[_0x56bb('0x1')](_0x56bb('0x2'),{'body':{'result':_0x50b7ad['result'],'transfererchannel':_0x50b7ad[_0x56bb('0x17')],'transferercalleridnum':_0x50b7ad[_0x56bb('0x18')],'transferercalleridname':_0x50b7ad[_0x56bb('0x19')],'transfererconnectedlinenum':_0x50b7ad[_0x56bb('0x1a')],'transfererconnectedlinename':_0x50b7ad[_0x56bb('0x1b')],'transfereraccountcode':_0x50b7ad[_0x56bb('0x1c')],'transferercontext':_0x50b7ad[_0x56bb('0x1d')],'transfererexten':_0x50b7ad['secondtransfererexten'],'transfererlinkedid':_0x50b7ad[_0x56bb('0x1e')],'transfereechannel':_0x50b7ad['transfertargetchannel'],'transfereecalleridnum':_0x50b7ad['transfertargetcalleridnum'],'transfereecalleridname':_0x50b7ad[_0x56bb('0x1f')],'transfereeconnectedlinenum':_0x50b7ad[_0x56bb('0x20')],'transfereeconnectedlinename':_0x50b7ad[_0x56bb('0x21')],'transfereeaccountcode':_0x50b7ad[_0x56bb('0x22')],'transfereecontext':_0x50b7ad[_0x56bb('0x23')],'transfereeexten':_0x50b7ad[_0x56bb('0x24')],'transfereelinkedid':_0x50b7ad[_0x56bb('0x25')],'isexternal':_0x50b7ad[_0x56bb('0x26')],'context':_0x50b7ad[_0x56bb('0x27')],'extension':_0x50b7ad['origtransfererexten'],'type':_0x56bb('0x28')},'log':_0x56bb('0x2')});}; \ No newline at end of file +var _0x5f3d=['transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename'];(function(_0x43b75f,_0x3cd90e){var _0x56d81e=function(_0x23d2a8){while(--_0x23d2a8){_0x43b75f['push'](_0x43b75f['shift']());}};_0x56d81e(++_0x3cd90e);}(_0x5f3d,0x1ec));var _0xd5f3=function(_0x47c1ec,_0x51bea0){_0x47c1ec=_0x47c1ec-0x0;var _0x510861=_0x5f3d[_0x47c1ec];return _0x510861;};'use strict';var client=require(_0xd5f3('0x0'));exports[_0xd5f3('0x1')]=function(_0x5408d0){return client[_0xd5f3('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x5408d0[_0xd5f3('0x3')],'transfererchannel':_0x5408d0[_0xd5f3('0x4')],'transferercalleridnum':_0x5408d0[_0xd5f3('0x5')],'transferercalleridname':_0x5408d0[_0xd5f3('0x6')],'transfererconnectedlinenum':_0x5408d0['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5408d0[_0xd5f3('0x7')],'transfereraccountcode':_0x5408d0[_0xd5f3('0x8')],'transferercontext':_0x5408d0[_0xd5f3('0x9')],'transfererexten':_0x5408d0[_0xd5f3('0xa')],'transfererlinkedid':_0x5408d0['transfererlinkedid'],'transfereechannel':_0x5408d0[_0xd5f3('0xb')],'transfereecalleridnum':_0x5408d0[_0xd5f3('0xc')],'transfereecalleridname':_0x5408d0[_0xd5f3('0xd')],'transfereeconnectedlinenum':_0x5408d0['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5408d0[_0xd5f3('0xe')],'transfereeaccountcode':_0x5408d0[_0xd5f3('0xf')],'transfereecontext':_0x5408d0[_0xd5f3('0x10')],'transfereeexten':_0x5408d0[_0xd5f3('0x11')],'transfereelinkedid':_0x5408d0[_0xd5f3('0x12')],'isexternal':_0x5408d0['isexternal'],'context':_0x5408d0[_0xd5f3('0x13')],'extension':_0x5408d0[_0xd5f3('0x14')],'type':_0xd5f3('0x15')},'log':_0xd5f3('0x16')});};exports['attendedTransfer']=function(_0x48d108){return client[_0xd5f3('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x48d108['result'],'transfererchannel':_0x48d108[_0xd5f3('0x17')],'transferercalleridnum':_0x48d108[_0xd5f3('0x18')],'transferercalleridname':_0x48d108['origtransferercalleridname'],'transfererconnectedlinenum':_0x48d108[_0xd5f3('0x19')],'transfererconnectedlinename':_0x48d108[_0xd5f3('0x1a')],'transfereraccountcode':_0x48d108[_0xd5f3('0x1b')],'transferercontext':_0x48d108['secondtransferercontext'],'transfererexten':_0x48d108['secondtransfererexten'],'transfererlinkedid':_0x48d108[_0xd5f3('0x1c')],'transfereechannel':_0x48d108[_0xd5f3('0x1d')],'transfereecalleridnum':_0x48d108[_0xd5f3('0x1e')],'transfereecalleridname':_0x48d108[_0xd5f3('0x1f')],'transfereeconnectedlinenum':_0x48d108[_0xd5f3('0x20')],'transfereeconnectedlinename':_0x48d108['transfertargetconnectedlinename'],'transfereeaccountcode':_0x48d108[_0xd5f3('0x21')],'transfereecontext':_0x48d108['transfertargetcontext'],'transfereeexten':_0x48d108['transfertargetexten'],'transfereelinkedid':_0x48d108[_0xd5f3('0x22')],'isexternal':_0x48d108[_0xd5f3('0x23')],'context':_0x48d108[_0xd5f3('0x24')],'extension':_0x48d108[_0xd5f3('0x25')],'type':_0xd5f3('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 66b41c1..2616097 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 _0x94b1=['startPredictive','startProgressive','Trunk','active','callerid','Interval','length','values','voicechannel','find','channels','uniqueid','channel','ai(mixmonitorid)','monitors','toLowerCase','isNil','push','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','StopMixMonitor','destinationchannel','status','filename','wav','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','run','event','Event\x20name\x20mandatory','emit','faxAccounts','send','checkAfterSend','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','validate','moment','../../../config/environment','../properties','listen','format','%s/%s','SIP','timers','timer','agents','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','module','action','Reload','Action','then','message','join','Command','content','catch','voiceQueues','hasOwnProperty','name','strategy','loggedIn','sumBillable','sumDuration','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x36fbd0,_0x4cb761){var _0x167f49=function(_0x4f64c5){while(--_0x4f64c5){_0x36fbd0['push'](_0x36fbd0['shift']());}};_0x167f49(++_0x4cb761);}(_0x94b1,0x137));var _0x194b=function(_0x56bf2d,_0x1f3ff9){_0x56bf2d=_0x56bf2d-0x0;var _0x30c29a=_0x94b1[_0x56bf2d];return _0x30c29a;};'use strict';var _=require(_0x194b('0x0'));var util=require(_0x194b('0x1'));var jayson=require('jayson/promise');var schema=require(_0x194b('0x2'));var BPromise=require('bluebird');var moment=require(_0x194b('0x3'));var config=require(_0x194b('0x4'));var properties=require(_0x194b('0x5'));var ami=require('../ami');exports[_0x194b('0x6')]=function(_0x1e568f,_0x3252e9,_0x30ec11){return new BPromise(function(_0x11b437,_0x12491f){var _0x2928fc={'QueuePause':function(_0xd435c5){return new Promise(function(_0x2313a3,_0x143b83){var _0x3954a7=util[_0x194b('0x7')](_0x194b('0x8'),_0x194b('0x9'),_0xd435c5['name']);if(_0x1e568f['timers']&&_0x1e568f['timers'][_0x3954a7]&&_0x1e568f[_0x194b('0xa')][_0x3954a7][_0x194b('0xb')]){_0x1e568f[_0x194b('0xa')][_0x3954a7]['updateAcw']();}if(_0x1e568f[_0x194b('0xc')][_0x3954a7]){_0x1e568f['agents'][_0x3954a7]['updateStatusRealtime']({'statePause':_0xd435c5['pause']?!![]:![]});}_0x2313a3({'code':0xc8,'message':_0x194b('0xd')});});},'Reload':function(_0x3672a3){var _0x371e2d=this;return new Promise(function(_0x3388de,_0xedbaf6){if(ami[_0x194b('0xe')]()==![]){return _0xedbaf6(_0x371e2d[_0x194b('0xf')](0x1f4,[config[_0x194b('0x10')]['ip'],config[_0x194b('0x10')][_0x194b('0x11')],_0x194b('0x12')]['join']('\x20')));}_0x3672a3=_['pick'](_0x3672a3,_['keys'](properties[_0x194b('0x13')]));_0x3672a3[_0x194b('0x14')]=_0x194b('0x15');return ami[_0x194b('0x16')](_0x3672a3)[_0x194b('0x17')](function(_0xa393a8){_0x3388de({'code':0xc8,'message':_0xa393a8['message']});})['catch'](function(_0x4e8dfd){_0xedbaf6(_0x371e2d[_0x194b('0xf')](0x1f5,_0x4e8dfd[_0x194b('0x18')]));});});},'Command':function(_0x709592){var _0x2962c5=this;return new Promise(function(_0x1f7e8c,_0x4d37a0){if(ami[_0x194b('0xe')]()==![]){return _0x4d37a0(_0x2962c5[_0x194b('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x194b('0x10')][_0x194b('0x11')],_0x194b('0x12')][_0x194b('0x19')]('\x20')));}_0x709592=_['pick'](_0x709592,'command');_0x709592['action']=_0x194b('0x1a');return ami['Action'](_0x709592)[_0x194b('0x17')](function(_0x59e84e){_0x1f7e8c({'code':0xc8,'message':_0x59e84e[_0x194b('0x1b')]});})[_0x194b('0x1c')](function(_0x3fef69){_0x4d37a0(_0x2962c5[_0x194b('0xf')](0x1f5,_0x3fef69[_0x194b('0x18')]));});});},'VoiceQueues':function(_0x4336b0){return new Promise(function(_0x21ea0f,_0x37a3c2){var _0x50a531=[];for(var _0x493149 in _0x1e568f[_0x194b('0x1d')]){if(_0x1e568f[_0x194b('0x1d')][_0x194b('0x1e')](_0x493149)){var _0x5ae2fc=_0x1e568f[_0x194b('0x1d')][_0x493149];var _0x1a059c={'id':_0x5ae2fc['id'],'name':_0x5ae2fc[_0x194b('0x1f')],'strategy':_0x5ae2fc[_0x194b('0x20')],'answered':_0x5ae2fc['answered'],'available':_0x5ae2fc['available'],'loggedIn':_0x5ae2fc[_0x194b('0x21')],'pTalking':_0x5ae2fc['pTalking'],'sumBillable':_0x5ae2fc[_0x194b('0x22')],'sumDuration':_0x5ae2fc[_0x194b('0x23')],'sumHoldTime':_0x5ae2fc['sumHoldTime']||0x0,'talking':_0x5ae2fc[_0x194b('0x24')],'total':_0x5ae2fc[_0x194b('0x25')],'type':_0x5ae2fc[_0x194b('0x26')],'unmanaged':_0x5ae2fc['unmanaged'],'abandoned':_0x5ae2fc[_0x194b('0x27')],'waiting':_0x5ae2fc[_0x194b('0x28')],'loggedInDb':_0x5ae2fc[_0x194b('0x29')]};if(_0x5ae2fc['type']==='outbound'){_0x1a059c['dialActive']=_0x5ae2fc[_0x194b('0x2a')];_0x1a059c[_0x194b('0x2b')]=_0x5ae2fc['dialMethod'];_0x1a059c['dialOriginateCallerIdName']=_0x5ae2fc['dialOriginateCallerIdName'];_0x1a059c[_0x194b('0x2c')]=_0x5ae2fc[_0x194b('0x2c')];_0x1a059c[_0x194b('0x2d')]=_0x5ae2fc[_0x194b('0x2d')];_0x1a059c[_0x194b('0x2e')]=_0x5ae2fc['dialPrefix'];_0x1a059c[_0x194b('0x2f')]=_0x5ae2fc['outboundAnswerAgiCallsDay'];_0x1a059c[_0x194b('0x30')]=_0x5ae2fc['outboundAnswerCallsDay'];_0x1a059c[_0x194b('0x31')]=_0x5ae2fc[_0x194b('0x31')];_0x1a059c[_0x194b('0x32')]=_0x5ae2fc[_0x194b('0x32')];_0x1a059c[_0x194b('0x33')]=_0x5ae2fc['outboundCongestionCallsDay'];_0x1a059c['outboundDropCallsDayACS']=_0x5ae2fc['outboundDropCallsDayACS'];_0x1a059c[_0x194b('0x34')]=_0x5ae2fc[_0x194b('0x34')];_0x1a059c[_0x194b('0x35')]=_0x5ae2fc[_0x194b('0x35')];_0x1a059c[_0x194b('0x36')]=_0x5ae2fc['outboundNoAnswerCallsDay'];_0x1a059c[_0x194b('0x37')]=_0x5ae2fc[_0x194b('0x37')];_0x1a059c[_0x194b('0x38')]=_0x5ae2fc[_0x194b('0x38')];_0x1a059c[_0x194b('0x39')]=_0x5ae2fc['outboundReCallsDay'];_0x1a059c[_0x194b('0x3a')]=_0x5ae2fc[_0x194b('0x3a')];_0x1a059c['outboundUnknownCallsDay']=_0x5ae2fc[_0x194b('0x3b')];_0x1a059c[_0x194b('0x3c')]=_0x5ae2fc[_0x194b('0x3c')];_0x1a059c[_0x194b('0x3d')]=_0x5ae2fc[_0x194b('0x3d')];_0x1a059c['predictiveIntervalAvgTalktime']=_0x5ae2fc[_0x194b('0x3e')];_0x1a059c[_0x194b('0x3f')]=_0x5ae2fc[_0x194b('0x3f')];_0x1a059c[_0x194b('0x40')]=_0x5ae2fc[_0x194b('0x40')];_0x1a059c[_0x194b('0x41')]=_0x5ae2fc[_0x194b('0x41')];_0x1a059c[_0x194b('0x42')]=_0x5ae2fc[_0x194b('0x42')];_0x1a059c[_0x194b('0x43')]=_0x5ae2fc[_0x194b('0x43')];_0x1a059c[_0x194b('0x44')]=_0x5ae2fc['predictiveIntervalMultiplicativeFactor'];_0x1a059c[_0x194b('0x45')]=_0x5ae2fc[_0x194b('0x45')];_0x1a059c[_0x194b('0x46')]=_0x5ae2fc['predictiveIntervalAvailable'];_0x1a059c[_0x194b('0x47')]=_0x5ae2fc['predictiveIntervalTotalCalls'];_0x1a059c['message']=_0x5ae2fc[_0x194b('0x18')];_0x1a059c[_0x194b('0x48')]=_0x5ae2fc[_0x194b('0x48')];_0x1a059c['erlangCalls']=_0x5ae2fc[_0x194b('0x49')];_0x1a059c[_0x194b('0x4a')]=_0x5ae2fc[_0x194b('0x4a')];_0x1a059c['erlangAbandonmentRate']=_0x5ae2fc[_0x194b('0x4b')];_0x1a059c['erlangBusyFactor']=_0x5ae2fc['erlangBusyFactor'];_0x1a059c[_0x194b('0x4c')]=_0x5ae2fc[_0x194b('0x4c')];_0x1a059c[_0x194b('0x4d')]=_0x5ae2fc['startProgressive'];}if(_0x5ae2fc['Trunk']){_0x1a059c[_0x194b('0x4e')]={'id':_0x5ae2fc[_0x194b('0x4e')]['id'],'name':_0x5ae2fc['Trunk']['name'],'active':_0x5ae2fc['Trunk'][_0x194b('0x4f')],'callerid':_0x5ae2fc[_0x194b('0x4e')][_0x194b('0x50')]};}if(_0x5ae2fc[_0x194b('0x51')]){_0x1a059c[_0x194b('0x51')]={'id':_0x5ae2fc[_0x194b('0x51')]['id'],'name':_0x5ae2fc[_0x194b('0x51')][_0x194b('0x1f')]};}_0x50a531['push'](_0x1a059c);}}_0x21ea0f({'count':_0x50a531[_0x194b('0x52')],'rows':_0x50a531});});},'VoiceChannels':function(_0x1223fa){return new Promise(function(_0x59c700,_0x27cd68){var _0x5bbe7f=_[_0x194b('0x53')](_0x1e568f['channels']);_0x59c700({'count':_0x5bbe7f[_0x194b('0x52')],'rows':_0x5bbe7f});});},'VoiceChannelMixMonitor':function(_0x19f28c){var _0x4349a0=this;return new Promise(function(_0x16bc74,_0x1cd991){if(ami[_0x194b('0xe')]()==![]){return _0x1cd991(_0x4349a0['error'](0x1f4,[config[_0x194b('0x10')]['ip'],config[_0x194b('0x10')]['username'],_0x194b('0x12')]['join']('\x20')));}var _0x143bb6=schema(properties[_0x194b('0x54')])[_0x194b('0x2')](_0x19f28c);if(_0x143bb6[_0x194b('0x52')]>0x0){return _0x1cd991(_0x4349a0[_0x194b('0xf')](0x1f4,_['map'](_0x143bb6,_0x194b('0x18'))[_0x194b('0x19')](',\x20')));}var _0x169602=_[_0x194b('0x55')](_0x1e568f[_0x194b('0x56')],{'uniqueid':_0x19f28c[_0x194b('0x57')]});if(_0x169602&&_0x169602[_0x194b('0x58')]){var _0x5f475a=util[_0x194b('0x7')]('%s.%s',_0x19f28c['filename']||_0x19f28c[_0x194b('0x57')],_0x19f28c[_0x194b('0x7')]||'wav');return ami['Action']({'action':'MixMonitor','channel':_0x169602[_0x194b('0x58')],'file':_0x5f475a,'options':_0x194b('0x59')})['then'](function(_0x977146){var _0x319f47=_[_0x194b('0x55')](_0x169602[_0x194b('0x5a')],{'filename':'/var/spool/asterisk/monitor/'+_0x5f475a[_0x194b('0x5b')]()});if(_[_0x194b('0x5c')](_0x319f47)){_0x169602['monitors'][_0x194b('0x5d')]({'filename':_0x194b('0x5e')+_0x5f475a[_0x194b('0x5b')](),'createdAt':moment()[_0x194b('0x7')](_0x194b('0x5f')),'mixmonitorid':_0x977146[_0x194b('0x60')],'status':'rec'});}else{_0x319f47[_0x194b('0x60')]=_0x977146[_0x194b('0x60')];_0x319f47['status']=_0x194b('0x61');}_0x16bc74({'code':0xc8,'message':[_0x19f28c['uniqueid'],_0x194b('0x62'),_0x977146[_0x194b('0x60')]]['join']('\x20'),'mixmonitorid':_0x977146[_0x194b('0x60')]});})[_0x194b('0x1c')](function(_0x5ae7d8){_0x1cd991(_0x4349a0[_0x194b('0xf')](0x1f5,[_0x19f28c[_0x194b('0x57')],_0x5ae7d8[_0x194b('0x18')][_0x194b('0x5b')]()][_0x194b('0x19')]('\x20')));});}else{return _0x1cd991(_0x4349a0['error'](0x1f5,_0x194b('0x63')));}});},'VoiceChannelStopMixMonitor':function(_0x11c8ae){var _0x3b5d06=this;return new Promise(function(_0x40315b,_0x422641){if(ami['isConnected']()==![]){return _0x422641(_0x3b5d06[_0x194b('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x194b('0x10')]['username'],_0x194b('0x12')][_0x194b('0x19')]('\x20')));}var _0x18a331=schema(properties['voicechannel'])['validate'](_0x11c8ae);if(_0x18a331['length']>0x0){return _0x422641(_0x3b5d06[_0x194b('0xf')](0x1f4,_[_0x194b('0x64')](_0x18a331,_0x194b('0x18'))[_0x194b('0x19')](',\x20')));}var _0x2b5ffc=_['find'](_0x1e568f[_0x194b('0x56')],{'uniqueid':_0x11c8ae[_0x194b('0x57')]});if(_0x2b5ffc){return BPromise['resolve']()[_0x194b('0x17')](function(){if(_0x2b5ffc[_0x194b('0x58')]){return ami[_0x194b('0x16')]({'action':_0x194b('0x65'),'channel':_0x2b5ffc[_0x194b('0x58')],'mixmonitorid':_0x11c8ae['mixmonitorid']})[_0x194b('0x1c')](function(_0x4b8994){});}})[_0x194b('0x17')](function(){if(_0x2b5ffc[_0x194b('0x66')]){return ami[_0x194b('0x16')]({'action':'StopMixMonitor','channel':_0x2b5ffc['destinationchannel'],'mixmonitorid':_0x11c8ae[_0x194b('0x60')]})[_0x194b('0x1c')](function(_0x2e0bd5){});}})[_0x194b('0x17')](function(_0x5e29e4){var _0x3aff08=_[_0x194b('0x55')](_0x2b5ffc[_0x194b('0x5a')],{'mixmonitorid':_0x11c8ae[_0x194b('0x60')]});if(_0x3aff08){_0x3aff08[_0x194b('0x67')]='stop';}})['then'](function(){var _0x39ef38=util['format']('%s.%s',_0x11c8ae[_0x194b('0x68')]||_0x11c8ae[_0x194b('0x57')],_0x11c8ae['format']||_0x194b('0x69'));var _0x15a92b=_[_0x194b('0x55')](_0x2b5ffc[_0x194b('0x5a')],{'filename':'/var/spool/asterisk/monitor/'+_0x39ef38[_0x194b('0x5b')]()});if(_0x15a92b){_0x15a92b[_0x194b('0x67')]=_0x194b('0x6a');}})['then'](function(){_0x40315b({'code':0xc8,'message':[_0x11c8ae['uniqueid'],'StopMixMonitor\x20Success'][_0x194b('0x19')]('\x20')});})[_0x194b('0x1c')](function(_0x4841d5){_0x422641(_0x3b5d06['error'](0x1f5,[_0x11c8ae[_0x194b('0x57')],_0x4841d5['message'][_0x194b('0x5b')]()][_0x194b('0x19')]('\x20')));});}else{return _0x422641(_0x3b5d06[_0x194b('0xf')](0x1f5,_0x194b('0x63')));}});},'VoiceQueuesChannels':function(_0xa6d684){return new Promise(function(_0x3c23da,_0x386d57){var _0x45e03a=_[_0x194b('0x53')](_0x1e568f[_0x194b('0x6b')]);_0x3c23da({'count':_0x45e03a['length'],'rows':_0x45e03a});});},'VoiceQueuesChannel':function(_0x1a9f63){var _0x2ab01a=this;return new Promise(function(_0x48460f,_0x3c31ae){var _0x3be995=schema(properties[_0x194b('0x6c')])[_0x194b('0x2')](_0x1a9f63);if(_0x3be995[_0x194b('0x52')]>0x0){return _0x3c31ae(_0x2ab01a[_0x194b('0xf')](0x1f4,_['map'](_0x3be995,_0x194b('0x18'))[_0x194b('0x19')](',\x20')));}var _0x3ca0bc=_['find'](_0x1e568f[_0x194b('0x6b')],{'uniqueid':_0x1a9f63['uniqueid']});if(_0x3ca0bc){_0x48460f(_0x3ca0bc);}else{return _0x3c31ae(_0x2ab01a[_0x194b('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x41e54a){var _0xe42684=this;return new Promise(function(_0x303a37,_0x377847){if(ami[_0x194b('0xe')]()==![]){return _0x377847(_0xe42684[_0x194b('0xf')](0x1f4,[config[_0x194b('0x10')]['ip'],config['asterisk'][_0x194b('0x11')],_0x194b('0x12')][_0x194b('0x19')]('\x20')));}var _0x29894=schema(properties[_0x194b('0x6d')])[_0x194b('0x2')](_0x41e54a);if(_0x29894[_0x194b('0x52')]>0x0){return _0x377847(_0xe42684['error'](0x1f4,_[_0x194b('0x64')](_0x29894,'message')[_0x194b('0x19')](',\x20')));}var _0x4bc921=_[_0x194b('0x55')](_0x1e568f[_0x194b('0x6b')],{'uniqueid':_0x41e54a[_0x194b('0x57')]});if(_0x4bc921&&_0x4bc921[_0x194b('0x58')]){return ami[_0x194b('0x16')]({'action':_0x194b('0x6e'),'channel':_0x4bc921[_0x194b('0x58')]})[_0x194b('0x17')](function(_0x4dc309){_0x303a37({'code':0xc8,'message':[_0x41e54a[_0x194b('0x57')],_0x4dc309[_0x194b('0x18')][_0x194b('0x5b')]()][_0x194b('0x19')]('\x20')});})[_0x194b('0x1c')](function(_0x5800bf){_0x377847(_0xe42684[_0x194b('0xf')](0x1f5,[_0x41e54a[_0x194b('0x57')],_0x5800bf[_0x194b('0x18')][_0x194b('0x5b')]()][_0x194b('0x19')]('\x20')));});}else{return _0x377847(_0xe42684[_0x194b('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3730ca){var _0x43e434=this;return new Promise(function(_0x1bbdf1,_0xc69a3e){if(ami['isConnected']()==![]){return _0xc69a3e(_0x43e434[_0x194b('0xf')](0x1f4,[config[_0x194b('0x10')]['ip'],config['asterisk'][_0x194b('0x11')],'ami\x20disconnected'][_0x194b('0x19')]('\x20')));}var _0x4bbdc0=schema(properties[_0x194b('0x6f')])[_0x194b('0x2')](_0x3730ca);if(_0x4bbdc0[_0x194b('0x52')]>0x0){return _0xc69a3e(_0x43e434[_0x194b('0xf')](0x1f4,_['map'](_0x4bbdc0,_0x194b('0x18'))['join'](',\x20')));}var _0x18f358=_[_0x194b('0x55')](_0x1e568f[_0x194b('0x6b')],{'uniqueid':_0x3730ca[_0x194b('0x57')]});if(_0x18f358&&_0x18f358[_0x194b('0x58')]){return ami[_0x194b('0x16')]({'action':_0x194b('0x70'),'channel':_0x18f358[_0x194b('0x58')],'exten':_0x3730ca[_0x194b('0x71')],'context':_0x3730ca['context']||_0x18f358[_0x194b('0x72')],'priority':0x1})['then'](function(_0x1d1630){_0x1bbdf1({'code':0xc8,'message':[_0x3730ca[_0x194b('0x57')],_0x1d1630[_0x194b('0x18')][_0x194b('0x5b')]()][_0x194b('0x19')]('\x20')});})[_0x194b('0x1c')](function(_0x4d57db){_0xc69a3e(_0x43e434['error'](0x1f5,[_0x3730ca[_0x194b('0x57')],_0x4d57db['message']['toLowerCase']()][_0x194b('0x19')]('\x20')));});}else{return _0xc69a3e(_0x43e434[_0x194b('0xf')](0x1f5,_0x194b('0x63')));}});},'Agents':function(_0x300bbf){return new Promise(function(_0x5e6bfb,_0x233ad7){var _0x347dfc=_[_0x194b('0x53')](_0x1e568f[_0x194b('0xc')]);_0x5e6bfb({'count':_0x347dfc[_0x194b('0x52')],'rows':_0x347dfc});});},'Telephones':function(_0x4216d0){return new Promise(function(_0x144761,_0x18e543){var _0x21666c=_[_0x194b('0x53')](_0x1e568f[_0x194b('0x73')]);_0x144761({'count':_0x21666c[_0x194b('0x52')],'rows':_0x21666c});});},'Trunks':function(_0x16ed44){return new Promise(function(_0x4c275a,_0x5c5f5c){var _0x3b76d6=_[_0x194b('0x53')](_0x1e568f[_0x194b('0x74')]);_0x4c275a({'count':_0x3b76d6['length'],'rows':_0x3b76d6});});},'OutboundChannels':function(_0x29d333){return new Promise(function(_0x57db5b,_0x23b45d){var _0x3d3140=_['values'](_0x1e568f['outboundChannels']);_0x57db5b({'count':_0x3d3140['length'],'rows':_0x3d3140});});},'Outbound':function(_0x281eab){return new Promise(function(_0x3a374a,_0x199d51){_0x3a374a(_0x1e568f['outbound']);});},'Campaigns':function(_0x43f007){return new Promise(function(_0x310d07,_0x1bb04e){var _0x3e8ef6=_[_0x194b('0x53')](_0x1e568f[_0x194b('0x75')]);_0x310d07({'count':_0x3e8ef6[_0x194b('0x52')],'rows':_0x3e8ef6});});},'VoiceQueuesPreview':function(_0x93d346){var _0x22631a=this;return new Promise(function(_0x26ab9d,_0x506173){_0x3252e9[_0x194b('0x76')](_0x93d346['id'])[_0x194b('0x17')](function(_0x3812fe){_0x26ab9d({'code':0xc8,'message':_0x3812fe[_0x194b('0x18')]});})[_0x194b('0x1c')](function(_0x4c1bef){_0x506173(_0x22631a[_0x194b('0xf')](0x1f4,_0x4c1bef[_0x194b('0x18')]));});});},'EventManager':function(_0x36f6fc){var _0x3d73bf=this;return new Promise(function(_0x527f09,_0x385358){if(!_0x36f6fc[_0x194b('0x77')]){return _0x385358(_0x3d73bf[_0x194b('0xf')](0x1f4,_0x194b('0x78')));}ami[_0x194b('0x79')]('custom:'+_0x36f6fc[_0x194b('0x77')],_0x36f6fc['message']);_0x527f09({'code':0xc8,'message':_0x36f6fc});});},'FaxAccounts':function(_0x2b4ac7){return new Promise(function(_0x4f6848,_0x14a8ab){var _0x2f5cf6=_['values'](_0x1e568f[_0x194b('0x7a')]);_0x4f6848({'count':_0x2f5cf6[_0x194b('0x52')],'rows':_0x2f5cf6});});},'SendFax':function(_0x2886ad){var _0x309af5=this;return new Promise(function(_0x4dfc90,_0x4f692e){_0x30ec11[_0x194b('0x7b')](_0x2886ad)[_0x194b('0x17')](function(_0xa295d5){_0x4dfc90({'code':0xc8,'message':_0xa295d5['message']});})['catch'](function(_0x1f32e0){_0x4f692e(_0x309af5[_0x194b('0xf')](0x1f4,_0x1f32e0[_0x194b('0x18')]));});});},'CheckAfterSend':function(_0x7c0dfa){var _0x24f0cf=this;return new Promise(function(_0xc9e8c1,_0x34b961){_0x30ec11[_0x194b('0x7c')](_0x7c0dfa)[_0x194b('0x17')](function(_0x2f5b38){_0xc9e8c1({'code':0xc8,'message':_0x2f5b38[_0x194b('0x18')]});})[_0x194b('0x1c')](function(_0x349d18){_0x34b961(_0x24f0cf[_0x194b('0xf')](0x1f4,_0x349d18[_0x194b('0x18')]));});});}};var _0x121f3f=jayson['server'](_0x2928fc)[_0x194b('0x7d')]();_0x121f3f['on'](_0x194b('0xf'),function(_0x48f439){return _0x12491f(_0x48f439);});_0x121f3f['listen'](0x232a,_0x194b('0x7e'),function(){console[_0x194b('0x7f')](_0x194b('0x80'),0x232a);return _0x11b437('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xb813=['uniqueid','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','agents','telephones','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','Reload','Action','then','message','catch','command','action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','length','map','find','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status'];(function(_0x5cb27b,_0x233c52){var _0x420b4d=function(_0x24005c){while(--_0x24005c){_0x5cb27b['push'](_0x5cb27b['shift']());}};_0x420b4d(++_0x233c52);}(_0xb813,0xa3));var _0x3b81=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xb813[_0x2df724];return _0x1b2504;};'use strict';var _=require('lodash');var util=require(_0x3b81('0x0'));var jayson=require(_0x3b81('0x1'));var schema=require(_0x3b81('0x2'));var BPromise=require(_0x3b81('0x3'));var moment=require(_0x3b81('0x4'));var config=require(_0x3b81('0x5'));var properties=require(_0x3b81('0x6'));var ami=require(_0x3b81('0x7'));exports[_0x3b81('0x8')]=function(_0x5f4d9c,_0x497088,_0x43af9c){return new BPromise(function(_0x393114,_0x2b7b70){var _0x320883={'QueuePause':function(_0x137e9d){return new Promise(function(_0x1975ea,_0x1a03dd){var _0x204b6a=util[_0x3b81('0x9')](_0x3b81('0xa'),_0x3b81('0xb'),_0x137e9d[_0x3b81('0xc')]);if(_0x5f4d9c[_0x3b81('0xd')]&&_0x5f4d9c[_0x3b81('0xd')][_0x204b6a]&&_0x5f4d9c[_0x3b81('0xd')][_0x204b6a][_0x3b81('0xe')]){_0x5f4d9c[_0x3b81('0xd')][_0x204b6a][_0x3b81('0xf')]();}if(_0x5f4d9c['agents'][_0x204b6a]){_0x5f4d9c['agents'][_0x204b6a][_0x3b81('0x10')]({'statePause':_0x137e9d[_0x3b81('0x11')]?!![]:![]});}_0x1975ea({'code':0xc8,'message':_0x3b81('0x12')});});},'Reload':function(_0x3c5c73){var _0x400838=this;return new Promise(function(_0x42c1fa,_0x208db4){if(ami[_0x3b81('0x13')]()==![]){return _0x208db4(_0x400838[_0x3b81('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x3b81('0x15')][_0x3b81('0x16')],_0x3b81('0x17')][_0x3b81('0x18')]('\x20')));}_0x3c5c73=_[_0x3b81('0x19')](_0x3c5c73,_[_0x3b81('0x1a')](properties['module']));_0x3c5c73['action']=_0x3b81('0x1b');return ami[_0x3b81('0x1c')](_0x3c5c73)[_0x3b81('0x1d')](function(_0x341296){_0x42c1fa({'code':0xc8,'message':_0x341296[_0x3b81('0x1e')]});})[_0x3b81('0x1f')](function(_0x4eba0e){_0x208db4(_0x400838[_0x3b81('0x14')](0x1f5,_0x4eba0e[_0x3b81('0x1e')]));});});},'Command':function(_0x46ee49){var _0x459165=this;return new Promise(function(_0x5f3f0f,_0x52cc1d){if(ami['isConnected']()==![]){return _0x52cc1d(_0x459165[_0x3b81('0x14')](0x1f4,[config[_0x3b81('0x15')]['ip'],config[_0x3b81('0x15')][_0x3b81('0x16')],_0x3b81('0x17')][_0x3b81('0x18')]('\x20')));}_0x46ee49=_[_0x3b81('0x19')](_0x46ee49,_0x3b81('0x20'));_0x46ee49[_0x3b81('0x21')]='Command';return ami[_0x3b81('0x1c')](_0x46ee49)['then'](function(_0xebe919){_0x5f3f0f({'code':0xc8,'message':_0xebe919['content']});})[_0x3b81('0x1f')](function(_0x37d1a4){_0x52cc1d(_0x459165[_0x3b81('0x14')](0x1f5,_0x37d1a4[_0x3b81('0x1e')]));});});},'VoiceQueues':function(_0x34aa71){return new Promise(function(_0x3b63f8,_0x55d15d){var _0x44188e=[];for(var _0x31b350 in _0x5f4d9c[_0x3b81('0x22')]){if(_0x5f4d9c[_0x3b81('0x22')][_0x3b81('0x23')](_0x31b350)){var _0x2bd008=_0x5f4d9c[_0x3b81('0x22')][_0x31b350];var _0x21d11a={'id':_0x2bd008['id'],'name':_0x2bd008[_0x3b81('0xc')],'strategy':_0x2bd008[_0x3b81('0x24')],'answered':_0x2bd008[_0x3b81('0x25')],'available':_0x2bd008[_0x3b81('0x26')],'loggedIn':_0x2bd008[_0x3b81('0x27')],'pTalking':_0x2bd008[_0x3b81('0x28')],'sumBillable':_0x2bd008[_0x3b81('0x29')],'sumDuration':_0x2bd008[_0x3b81('0x2a')],'sumHoldTime':_0x2bd008[_0x3b81('0x2b')]||0x0,'talking':_0x2bd008['talking'],'total':_0x2bd008[_0x3b81('0x2c')],'type':_0x2bd008[_0x3b81('0x2d')],'unmanaged':_0x2bd008[_0x3b81('0x2e')],'abandoned':_0x2bd008[_0x3b81('0x2f')],'waiting':_0x2bd008['waiting'],'loggedInDb':_0x2bd008[_0x3b81('0x30')]};if(_0x2bd008[_0x3b81('0x2d')]==='outbound'){_0x21d11a['dialActive']=_0x2bd008[_0x3b81('0x31')];_0x21d11a['dialMethod']=_0x2bd008['dialMethod'];_0x21d11a['dialOriginateCallerIdName']=_0x2bd008[_0x3b81('0x32')];_0x21d11a['dialOriginateCallerIdNumber']=_0x2bd008[_0x3b81('0x33')];_0x21d11a[_0x3b81('0x34')]=_0x2bd008[_0x3b81('0x34')];_0x21d11a[_0x3b81('0x35')]=_0x2bd008[_0x3b81('0x35')];_0x21d11a[_0x3b81('0x36')]=_0x2bd008[_0x3b81('0x36')];_0x21d11a[_0x3b81('0x37')]=_0x2bd008[_0x3b81('0x37')];_0x21d11a['outboundBlacklistCallsDay']=_0x2bd008[_0x3b81('0x38')];_0x21d11a[_0x3b81('0x39')]=_0x2bd008[_0x3b81('0x39')];_0x21d11a[_0x3b81('0x3a')]=_0x2bd008[_0x3b81('0x3a')];_0x21d11a[_0x3b81('0x3b')]=_0x2bd008[_0x3b81('0x3b')];_0x21d11a['outboundDropCallsDayCallersExit']=_0x2bd008[_0x3b81('0x3c')];_0x21d11a[_0x3b81('0x3d')]=_0x2bd008[_0x3b81('0x3d')];_0x21d11a[_0x3b81('0x3e')]=_0x2bd008[_0x3b81('0x3e')];_0x21d11a['outboundNoSuchCallsDay']=_0x2bd008['outboundNoSuchCallsDay'];_0x21d11a['outboundOriginateFailureCallsDay']=_0x2bd008[_0x3b81('0x3f')];_0x21d11a[_0x3b81('0x40')]=_0x2bd008[_0x3b81('0x40')];_0x21d11a[_0x3b81('0x41')]=_0x2bd008[_0x3b81('0x41')];_0x21d11a[_0x3b81('0x42')]=_0x2bd008[_0x3b81('0x42')];_0x21d11a[_0x3b81('0x43')]=_0x2bd008[_0x3b81('0x43')];_0x21d11a[_0x3b81('0x44')]=_0x2bd008['predictiveIntervalAvgHoldtime'];_0x21d11a['predictiveIntervalAvgTalktime']=_0x2bd008['predictiveIntervalAvgTalktime'];_0x21d11a[_0x3b81('0x45')]=_0x2bd008[_0x3b81('0x45')];_0x21d11a['predictiveIntervalDroppedCallsTimeout']=_0x2bd008[_0x3b81('0x46')];_0x21d11a[_0x3b81('0x47')]=_0x2bd008[_0x3b81('0x47')];_0x21d11a[_0x3b81('0x48')]=_0x2bd008['predictiveIntervalErlangCallsDroppedCalls'];_0x21d11a[_0x3b81('0x49')]=_0x2bd008[_0x3b81('0x49')];_0x21d11a[_0x3b81('0x4a')]=_0x2bd008[_0x3b81('0x4a')];_0x21d11a[_0x3b81('0x4b')]=_0x2bd008[_0x3b81('0x4b')];_0x21d11a[_0x3b81('0x4c')]=_0x2bd008['predictiveIntervalAvailable'];_0x21d11a[_0x3b81('0x4d')]=_0x2bd008[_0x3b81('0x4d')];_0x21d11a[_0x3b81('0x1e')]=_0x2bd008[_0x3b81('0x1e')];_0x21d11a[_0x3b81('0x4e')]=_0x2bd008[_0x3b81('0x4e')];_0x21d11a['erlangCalls']=_0x2bd008['erlangCalls'];_0x21d11a['erlangCallToSecond']=_0x2bd008['erlangCallToSecond'];_0x21d11a[_0x3b81('0x4f')]=_0x2bd008['erlangAbandonmentRate'];_0x21d11a[_0x3b81('0x50')]=_0x2bd008[_0x3b81('0x50')];_0x21d11a[_0x3b81('0x51')]=_0x2bd008[_0x3b81('0x51')];_0x21d11a[_0x3b81('0x52')]=_0x2bd008['startProgressive'];}if(_0x2bd008[_0x3b81('0x53')]){_0x21d11a['Trunk']={'id':_0x2bd008[_0x3b81('0x53')]['id'],'name':_0x2bd008[_0x3b81('0x53')][_0x3b81('0xc')],'active':_0x2bd008['Trunk'][_0x3b81('0x54')],'callerid':_0x2bd008[_0x3b81('0x53')][_0x3b81('0x55')]};}if(_0x2bd008[_0x3b81('0x56')]){_0x21d11a[_0x3b81('0x56')]={'id':_0x2bd008['Interval']['id'],'name':_0x2bd008['Interval'][_0x3b81('0xc')]};}_0x44188e[_0x3b81('0x57')](_0x21d11a);}}_0x3b63f8({'count':_0x44188e['length'],'rows':_0x44188e});});},'VoiceChannels':function(_0x3c29a6){return new Promise(function(_0x1c1378,_0x340963){var _0xc0aa00=_[_0x3b81('0x58')](_0x5f4d9c[_0x3b81('0x59')]);_0x1c1378({'count':_0xc0aa00['length'],'rows':_0xc0aa00});});},'VoiceChannelMixMonitor':function(_0x429aaa){var _0x595f2b=this;return new Promise(function(_0x244b24,_0x2e2385){if(ami[_0x3b81('0x13')]()==![]){return _0x2e2385(_0x595f2b[_0x3b81('0x14')](0x1f4,[config['asterisk']['ip'],config[_0x3b81('0x15')][_0x3b81('0x16')],_0x3b81('0x17')][_0x3b81('0x18')]('\x20')));}var _0x1a5bf9=schema(properties['voicechannel'])['validate'](_0x429aaa);if(_0x1a5bf9[_0x3b81('0x5a')]>0x0){return _0x2e2385(_0x595f2b[_0x3b81('0x14')](0x1f4,_[_0x3b81('0x5b')](_0x1a5bf9,_0x3b81('0x1e'))[_0x3b81('0x18')](',\x20')));}var _0x59a373=_[_0x3b81('0x5c')](_0x5f4d9c[_0x3b81('0x59')],{'uniqueid':_0x429aaa['uniqueid']});if(_0x59a373&&_0x59a373[_0x3b81('0x5d')]){var _0x481c6c=util[_0x3b81('0x9')](_0x3b81('0x5e'),_0x429aaa[_0x3b81('0x5f')]||_0x429aaa['uniqueid'],_0x429aaa[_0x3b81('0x9')]||_0x3b81('0x60'));return ami['Action']({'action':_0x3b81('0x61'),'channel':_0x59a373['channel'],'file':_0x481c6c,'options':_0x3b81('0x62')})['then'](function(_0x42fb42){var _0x37fcac=_[_0x3b81('0x5c')](_0x59a373[_0x3b81('0x63')],{'filename':_0x3b81('0x64')+_0x481c6c[_0x3b81('0x65')]()});if(_[_0x3b81('0x66')](_0x37fcac)){_0x59a373[_0x3b81('0x63')][_0x3b81('0x57')]({'filename':_0x3b81('0x64')+_0x481c6c[_0x3b81('0x65')](),'createdAt':moment()[_0x3b81('0x9')](_0x3b81('0x67')),'mixmonitorid':_0x42fb42[_0x3b81('0x68')],'status':_0x3b81('0x69')});}else{_0x37fcac['mixmonitorid']=_0x42fb42['mixmonitorid'];_0x37fcac[_0x3b81('0x6a')]=_0x3b81('0x69');}_0x244b24({'code':0xc8,'message':[_0x429aaa[_0x3b81('0x6b')],'MixMonitor\x20Success',_0x42fb42[_0x3b81('0x68')]][_0x3b81('0x18')]('\x20'),'mixmonitorid':_0x42fb42[_0x3b81('0x68')]});})[_0x3b81('0x1f')](function(_0xe3e43f){_0x2e2385(_0x595f2b[_0x3b81('0x14')](0x1f5,[_0x429aaa[_0x3b81('0x6b')],_0xe3e43f['message']['toLowerCase']()][_0x3b81('0x18')]('\x20')));});}else{return _0x2e2385(_0x595f2b['error'](0x1f5,_0x3b81('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x27550f){var _0x25ebb3=this;return new Promise(function(_0x3897bc,_0x4e8af9){if(ami['isConnected']()==![]){return _0x4e8af9(_0x25ebb3[_0x3b81('0x14')](0x1f4,[config[_0x3b81('0x15')]['ip'],config[_0x3b81('0x15')][_0x3b81('0x16')],'ami\x20disconnected'][_0x3b81('0x18')]('\x20')));}var _0x38a71a=schema(properties[_0x3b81('0x6d')])[_0x3b81('0x2')](_0x27550f);if(_0x38a71a['length']>0x0){return _0x4e8af9(_0x25ebb3[_0x3b81('0x14')](0x1f4,_[_0x3b81('0x5b')](_0x38a71a,_0x3b81('0x1e'))[_0x3b81('0x18')](',\x20')));}var _0xc22ae5=_[_0x3b81('0x5c')](_0x5f4d9c[_0x3b81('0x59')],{'uniqueid':_0x27550f[_0x3b81('0x6b')]});if(_0xc22ae5){return BPromise['resolve']()[_0x3b81('0x1d')](function(){if(_0xc22ae5['channel']){return ami[_0x3b81('0x1c')]({'action':_0x3b81('0x6e'),'channel':_0xc22ae5['channel'],'mixmonitorid':_0x27550f['mixmonitorid']})['catch'](function(_0x32b139){});}})[_0x3b81('0x1d')](function(){if(_0xc22ae5[_0x3b81('0x6f')]){return ami[_0x3b81('0x1c')]({'action':_0x3b81('0x6e'),'channel':_0xc22ae5['destinationchannel'],'mixmonitorid':_0x27550f[_0x3b81('0x68')]})[_0x3b81('0x1f')](function(_0x4ee79b){});}})[_0x3b81('0x1d')](function(_0x1f9715){var _0x14243a=_[_0x3b81('0x5c')](_0xc22ae5[_0x3b81('0x63')],{'mixmonitorid':_0x27550f[_0x3b81('0x68')]});if(_0x14243a){_0x14243a['status']=_0x3b81('0x70');}})['then'](function(){var _0x6cbbcd=util[_0x3b81('0x9')](_0x3b81('0x5e'),_0x27550f['filename']||_0x27550f['uniqueid'],_0x27550f[_0x3b81('0x9')]||_0x3b81('0x60'));var _0xd3c6f1=_[_0x3b81('0x5c')](_0xc22ae5[_0x3b81('0x63')],{'filename':_0x3b81('0x64')+_0x6cbbcd[_0x3b81('0x65')]()});if(_0xd3c6f1){_0xd3c6f1[_0x3b81('0x6a')]=_0x3b81('0x70');}})[_0x3b81('0x1d')](function(){_0x3897bc({'code':0xc8,'message':[_0x27550f['uniqueid'],_0x3b81('0x71')]['join']('\x20')});})[_0x3b81('0x1f')](function(_0xb27221){_0x4e8af9(_0x25ebb3[_0x3b81('0x14')](0x1f5,[_0x27550f[_0x3b81('0x6b')],_0xb27221[_0x3b81('0x1e')][_0x3b81('0x65')]()][_0x3b81('0x18')]('\x20')));});}else{return _0x4e8af9(_0x25ebb3['error'](0x1f5,_0x3b81('0x6c')));}});},'VoiceQueuesChannels':function(_0x258c24){return new Promise(function(_0x2fcb21,_0x2c3c11){var _0x47549f=_[_0x3b81('0x58')](_0x5f4d9c['queueChannels']);_0x2fcb21({'count':_0x47549f[_0x3b81('0x5a')],'rows':_0x47549f});});},'VoiceQueuesChannel':function(_0x344508){var _0x33769f=this;return new Promise(function(_0xb76c53,_0x5cf53b){var _0x5e1e7=schema(properties['voicequeuechannel'])['validate'](_0x344508);if(_0x5e1e7[_0x3b81('0x5a')]>0x0){return _0x5cf53b(_0x33769f['error'](0x1f4,_[_0x3b81('0x5b')](_0x5e1e7,_0x3b81('0x1e'))[_0x3b81('0x18')](',\x20')));}var _0x434288=_[_0x3b81('0x5c')](_0x5f4d9c['queueChannels'],{'uniqueid':_0x344508[_0x3b81('0x6b')]});if(_0x434288){_0xb76c53(_0x434288);}else{return _0x5cf53b(_0x33769f[_0x3b81('0x14')](0x1f5,_0x3b81('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0xbf3b5c){var _0x51958b=this;return new Promise(function(_0x4456d7,_0x307785){if(ami[_0x3b81('0x13')]()==![]){return _0x307785(_0x51958b[_0x3b81('0x14')](0x1f4,[config[_0x3b81('0x15')]['ip'],config['asterisk']['username'],_0x3b81('0x17')][_0x3b81('0x18')]('\x20')));}var _0x2d3070=schema(properties[_0x3b81('0x72')])[_0x3b81('0x2')](_0xbf3b5c);if(_0x2d3070['length']>0x0){return _0x307785(_0x51958b[_0x3b81('0x14')](0x1f4,_[_0x3b81('0x5b')](_0x2d3070,_0x3b81('0x1e'))[_0x3b81('0x18')](',\x20')));}var _0xb04bb6=_[_0x3b81('0x5c')](_0x5f4d9c[_0x3b81('0x73')],{'uniqueid':_0xbf3b5c[_0x3b81('0x6b')]});if(_0xb04bb6&&_0xb04bb6[_0x3b81('0x5d')]){return ami['Action']({'action':_0x3b81('0x74'),'channel':_0xb04bb6[_0x3b81('0x5d')]})[_0x3b81('0x1d')](function(_0x176063){_0x4456d7({'code':0xc8,'message':[_0xbf3b5c[_0x3b81('0x6b')],_0x176063[_0x3b81('0x1e')][_0x3b81('0x65')]()][_0x3b81('0x18')]('\x20')});})[_0x3b81('0x1f')](function(_0xcc168c){_0x307785(_0x51958b[_0x3b81('0x14')](0x1f5,[_0xbf3b5c[_0x3b81('0x6b')],_0xcc168c['message'][_0x3b81('0x65')]()]['join']('\x20')));});}else{return _0x307785(_0x51958b['error'](0x1f5,_0x3b81('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x145509){var _0x5f58e1=this;return new Promise(function(_0x383111,_0x2012c0){if(ami[_0x3b81('0x13')]()==![]){return _0x2012c0(_0x5f58e1[_0x3b81('0x14')](0x1f4,[config[_0x3b81('0x15')]['ip'],config[_0x3b81('0x15')]['username'],_0x3b81('0x17')][_0x3b81('0x18')]('\x20')));}var _0x3d4c7e=schema(properties[_0x3b81('0x75')])[_0x3b81('0x2')](_0x145509);if(_0x3d4c7e[_0x3b81('0x5a')]>0x0){return _0x2012c0(_0x5f58e1[_0x3b81('0x14')](0x1f4,_[_0x3b81('0x5b')](_0x3d4c7e,'message')['join'](',\x20')));}var _0x46ada1=_[_0x3b81('0x5c')](_0x5f4d9c[_0x3b81('0x73')],{'uniqueid':_0x145509['uniqueid']});if(_0x46ada1&&_0x46ada1['channel']){return ami[_0x3b81('0x1c')]({'action':_0x3b81('0x76'),'channel':_0x46ada1['channel'],'exten':_0x145509[_0x3b81('0x77')],'context':_0x145509[_0x3b81('0x78')]||_0x46ada1['context'],'priority':0x1})['then'](function(_0x431573){_0x383111({'code':0xc8,'message':[_0x145509['uniqueid'],_0x431573[_0x3b81('0x1e')][_0x3b81('0x65')]()][_0x3b81('0x18')]('\x20')});})[_0x3b81('0x1f')](function(_0x5cc033){_0x2012c0(_0x5f58e1[_0x3b81('0x14')](0x1f5,[_0x145509[_0x3b81('0x6b')],_0x5cc033[_0x3b81('0x1e')][_0x3b81('0x65')]()]['join']('\x20')));});}else{return _0x2012c0(_0x5f58e1['error'](0x1f5,_0x3b81('0x6c')));}});},'Agents':function(_0x2d1ca9){return new Promise(function(_0x357093,_0x54d37d){var _0x251cd9=_[_0x3b81('0x58')](_0x5f4d9c[_0x3b81('0x79')]);_0x357093({'count':_0x251cd9[_0x3b81('0x5a')],'rows':_0x251cd9});});},'Telephones':function(_0x3e2373){return new Promise(function(_0x26f0a4,_0x28e438){var _0x3e1c7b=_[_0x3b81('0x58')](_0x5f4d9c[_0x3b81('0x7a')]);_0x26f0a4({'count':_0x3e1c7b['length'],'rows':_0x3e1c7b});});},'Trunks':function(_0x1df6f7){return new Promise(function(_0x3f9575,_0x2200dd){var _0x2e3636=_['values'](_0x5f4d9c['trunks']);_0x3f9575({'count':_0x2e3636[_0x3b81('0x5a')],'rows':_0x2e3636});});},'OutboundChannels':function(_0x4321a1){return new Promise(function(_0x35b087,_0x23d53f){var _0x5713db=_[_0x3b81('0x58')](_0x5f4d9c['outboundChannels']);_0x35b087({'count':_0x5713db[_0x3b81('0x5a')],'rows':_0x5713db});});},'Outbound':function(_0x561b80){return new Promise(function(_0x3580e4,_0xae2cd){_0x3580e4(_0x5f4d9c[_0x3b81('0x7b')]);});},'Campaigns':function(_0x451c4c){return new Promise(function(_0x40cd56,_0x17da2c){var _0x3c4bcf=_[_0x3b81('0x58')](_0x5f4d9c[_0x3b81('0x7c')]);_0x40cd56({'count':_0x3c4bcf[_0x3b81('0x5a')],'rows':_0x3c4bcf});});},'VoiceQueuesPreview':function(_0x58d3fc){var _0x212f7f=this;return new Promise(function(_0x2152a0,_0x55bf84){_0x497088[_0x3b81('0x7d')](_0x58d3fc['id'])[_0x3b81('0x1d')](function(_0x5ed2d9){_0x2152a0({'code':0xc8,'message':_0x5ed2d9[_0x3b81('0x1e')]});})['catch'](function(_0x384649){_0x55bf84(_0x212f7f[_0x3b81('0x14')](0x1f4,_0x384649[_0x3b81('0x1e')]));});});},'EventManager':function(_0x36ffc7){var _0x5bff0c=this;return new Promise(function(_0x2025f9,_0x552442){if(!_0x36ffc7[_0x3b81('0x7e')]){return _0x552442(_0x5bff0c[_0x3b81('0x14')](0x1f4,_0x3b81('0x7f')));}ami[_0x3b81('0x80')](_0x3b81('0x81')+_0x36ffc7['event'],_0x36ffc7[_0x3b81('0x1e')]);_0x2025f9({'code':0xc8,'message':_0x36ffc7});});},'FaxAccounts':function(_0x3bbc50){return new Promise(function(_0x244fc8,_0x584477){var _0x6372d4=_[_0x3b81('0x58')](_0x5f4d9c['faxAccounts']);_0x244fc8({'count':_0x6372d4[_0x3b81('0x5a')],'rows':_0x6372d4});});},'SendFax':function(_0xff412f){var _0x2cd52c=this;return new Promise(function(_0x13414e,_0x4b0c65){_0x43af9c[_0x3b81('0x82')](_0xff412f)['then'](function(_0x28b986){_0x13414e({'code':0xc8,'message':_0x28b986[_0x3b81('0x1e')]});})[_0x3b81('0x1f')](function(_0x394674){_0x4b0c65(_0x2cd52c[_0x3b81('0x14')](0x1f4,_0x394674[_0x3b81('0x1e')]));});});},'CheckAfterSend':function(_0x32954f){var _0x3fa075=this;return new Promise(function(_0x5dddc1,_0x2c113b){_0x43af9c[_0x3b81('0x83')](_0x32954f)[_0x3b81('0x1d')](function(_0x350689){_0x5dddc1({'code':0xc8,'message':_0x350689[_0x3b81('0x1e')]});})[_0x3b81('0x1f')](function(_0x6abe35){_0x2c113b(_0x3fa075[_0x3b81('0x14')](0x1f4,_0x6abe35[_0x3b81('0x1e')]));});});}};var _0x500ca8=jayson['server'](_0x320883)[_0x3b81('0x84')]();_0x500ca8['on'](_0x3b81('0x14'),function(_0x483c1c){return _0x2b7b70(_0x483c1c);});_0x500ca8[_0x3b81('0x8')](0x232a,'127.0.0.1',function(){console['log'](_0x3b81('0x85'),0x232a);return _0x393114(_0x3b81('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 415bfce..7804e82 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 _0x7219=['[CM][%s][%s]\x20Contact\x20not\x20found','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','calleridname','','destcalleridname','format','user:%s','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','trigger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data2','isEmpty','xmd-contactid2','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map'];(function(_0x1ef7b2,_0x3b7399){var _0x3d09b5=function(_0x38e75d){while(--_0x38e75d){_0x1ef7b2['push'](_0x1ef7b2['shift']());}};_0x3d09b5(++_0x3b7399);}(_0x7219,0xd5));var _0x9721=function(_0x33ad5e,_0x1feeb7){_0x33ad5e=_0x33ad5e-0x0;var _0x558629=_0x7219[_0x33ad5e];return _0x558629;};'use strict';var _=require(_0x9721('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9721('0x1'));var util=require(_0x9721('0x2'));var config=require(_0x9721('0x3'));var logger=require('../../../../config/logger')(_0x9721('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x9721('0x5')]=_[_0x9721('0x6')](config[_0x9721('0x5')],{'host':_0x9721('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9721('0x5')]));function emit(_0x5cd754,_0x1713b3,_0x1c325f,_0x4e08e2,_0x59744d){logger[_0x9721('0x8')](_0x9721('0x9'),_0x5cd754,_0x1713b3['id'],_0x1c325f,_0x4e08e2,JSON[_0x9721('0xa')](_0x59744d));io['to'](_0x1c325f)[_0x9721('0xb')](_0x4e08e2,_0x59744d);}exports[_0x9721('0xc')]=function(_0x31a1ce,_0x2726c2,_0x112b14,_0x25fba8){var _0x2d53b4,_0x308fc2;var _0x1b6b7f={};var _0x38432c=Number(_0x112b14['data1']);var _0x28774a=_0x112b14['data2']?Boolean(Number(_0x112b14[_0x9721('0xd')])):![];if(_0x25fba8['xmd-contactid2']&&!_[_0x9721('0xe')](_0x25fba8[_0x9721('0xf')]))_0x1b6b7f['id']=_0x25fba8[_0x9721('0xf')];if(!_0x1b6b7f['id']){_0x1b6b7f[_0x9721('0x10')]=_0x38432c;var _0x5c3334=_0x112b14[_0x9721('0x11')]&&_0x112b14[_0x9721('0x11')]!=='0'?_0x112b14['data3'][_0x9721('0x12')](','):[_0x9721('0x13')];_0x1b6b7f[_0x9721('0x14')]=_['map'](_0x5c3334,function(_0x26d0e1){var _0x2b4a3d={};_0x2b4a3d[_0x26d0e1]=_0x25fba8[_0x9721('0x15')]?_0x25fba8[_0x9721('0x16')]:_0x25fba8[_0x9721('0x17')];return _0x2b4a3d;});}var _0x5dc8d3=['id',_0x9721('0x18'),'lastName',_0x9721('0x13'),_0x9721('0x19'),'fax',_0x9721('0x10'),'createdAt',_0x9721('0x1a'),_0x9721('0x1b')];var _0x3838b1=_[_0x9721('0x1c')](_0x5dc8d3,_0x5c3334);BPromise[_0x9721('0x1d')]()[_0x9721('0x1e')](cmContactRpc[_0x9721('0x1f')]({'attributes':_0x3838b1,'where':_0x1b6b7f}))['then'](function(_0x253e10){_0x308fc2=_0x253e10;if(!_[_0x9721('0xe')](_0x308fc2)){if(_0x308fc2[_0x9721('0x20')]===0x1){_0x2d53b4=_0x308fc2[0x0];logger[_0x9721('0x8')](_0x9721('0x21'),_0x25fba8[_0x9721('0x22')],_0x2726c2['id'],_0x2d53b4['id']);}else{logger[_0x9721('0x8')](_0x9721('0x23'),_0x25fba8['uniqueid'],_0x2726c2['id'],_[_0x9721('0x24')](_0x308fc2,'id')['join'](','));}return;}else{logger[_0x9721('0x8')](_0x9721('0x25'),_0x25fba8[_0x9721('0x22')],_0x2726c2['id']);if(_0x28774a){logger[_0x9721('0x8')](_0x9721('0x26'),_0x25fba8[_0x9721('0x22')],_0x2726c2['id']);var _0x182007=_0x112b14['data4']&&_0x112b14['data4']!=='0'?_0x112b14[_0x9721('0x27')]:_0x9721('0x13');var _0x19f3d7={'ListId':_0x38432c};_0x19f3d7[_0x182007]=_[_0x9721('0x28')](_0x25fba8[_0x9721('0x15')])?_0x25fba8[_0x9721('0x17')]:_0x25fba8[_0x9721('0x16')];if(_[_0x9721('0x28')](_0x25fba8[_0x9721('0x15')])){_0x19f3d7[_0x9721('0x18')]=_0x25fba8[_0x9721('0x29')]&&_0x25fba8[_0x9721('0x29')]!==_0x9721('0x2a')?_0x25fba8['calleridname']:'Unknown';}else{_0x19f3d7[_0x9721('0x18')]=_0x25fba8[_0x9721('0x2b')]&&_0x25fba8[_0x9721('0x2b')]!==_0x9721('0x2a')?_0x25fba8[_0x9721('0x2b')]:'Unknown';}return BPromise[_0x9721('0x1d')]()[_0x9721('0x1e')](cmContactRpc['createContact'](_0x19f3d7))[_0x9721('0x1e')](function(_0x5c8121){_0x2d53b4=_0x5c8121;if(_0x2d53b4){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x25fba8['uniqueid'],_0x2726c2['id'],_0x2d53b4['id']);}return;});}else{logger[_0x9721('0x8')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x25fba8['uniqueid'],_0x2726c2['id']);return;}}})['then'](function(){if(_0x31a1ce){emit(_0x25fba8[_0x9721('0x22')],_0x2726c2,util[_0x9721('0x2c')](_0x9721('0x2d'),_0x31a1ce['name']),util['format'](_0x9721('0x2e'),_0x112b14[_0x9721('0x2f')][_0x9721('0x30')]()),{'evt':_[_0x9721('0x31')](_0x25fba8,{'autoCreate':_0x28774a}),'contact':_0x2d53b4,'contacts':!_0x2d53b4?_0x308fc2:undefined});}});}; \ No newline at end of file +var _0x0a8b=['union','then','getContacts','length','info','[CM][%s][%s]\x20Contact\x20found:%s','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','[CM][%s][%s]\x20Autocreate\x20enabled','data4','isNil','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','name','format','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','exec','data1','data2','xmd-contactid2','isEmpty','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','ListId','createdAt','scheduledAt','updatedAt'];(function(_0x943866,_0x2b90c1){var _0x3117a1=function(_0x26abc4){while(--_0x26abc4){_0x943866['push'](_0x943866['shift']());}};_0x3117a1(++_0x2b90c1);}(_0x0a8b,0x18a));var _0xb0a8=function(_0x388f7d,_0x45305d){_0x388f7d=_0x388f7d-0x0;var _0x4f9210=_0x0a8b[_0x388f7d];return _0x4f9210;};'use strict';var _=require(_0xb0a8('0x0'));var BPromise=require(_0xb0a8('0x1'));var Redis=require(_0xb0a8('0x2'));var util=require(_0xb0a8('0x3'));var config=require('../../../../config/environment');var logger=require(_0xb0a8('0x4'))(_0xb0a8('0x5'));var cmContactRpc=require(_0xb0a8('0x6'));config[_0xb0a8('0x7')]=_[_0xb0a8('0x8')](config[_0xb0a8('0x7')],{'host':_0xb0a8('0x9'),'port':0x18eb});var io=require(_0xb0a8('0xa'))(new Redis(config[_0xb0a8('0x7')]));function emit(_0x3fd184,_0x2dc960,_0x330417,_0x2520f3,_0x5d5e35){logger['info']('[CM][%s][%s]',_0x3fd184,_0x2dc960['id'],_0x330417,_0x2520f3,JSON[_0xb0a8('0xb')](_0x5d5e35));io['to'](_0x330417)[_0xb0a8('0xc')](_0x2520f3,_0x5d5e35);}exports[_0xb0a8('0xd')]=function(_0x19e669,_0x25ca3e,_0x4cc250,_0x53cca4){var _0x2c95f4,_0x3e440c;var _0x34f49c={};var _0x526491=Number(_0x4cc250[_0xb0a8('0xe')]);var _0x35b478=_0x4cc250['data2']?Boolean(Number(_0x4cc250[_0xb0a8('0xf')])):![];if(_0x53cca4[_0xb0a8('0x10')]&&!_[_0xb0a8('0x11')](_0x53cca4[_0xb0a8('0x10')]))_0x34f49c['id']=_0x53cca4['xmd-contactid2'];if(!_0x34f49c['id']){_0x34f49c['ListId']=_0x526491;var _0x5e500d=_0x4cc250['data3']&&_0x4cc250[_0xb0a8('0x12')]!=='0'?_0x4cc250[_0xb0a8('0x12')]['split'](','):[_0xb0a8('0x13')];_0x34f49c[_0xb0a8('0x14')]=_[_0xb0a8('0x15')](_0x5e500d,function(_0x12dfe0){var _0x3fad59={};_0x3fad59[_0x12dfe0]=_0x53cca4['routeId']?_0x53cca4[_0xb0a8('0x16')]:_0x53cca4[_0xb0a8('0x17')];return _0x3fad59;});}var _0x3d9a0c=['id',_0xb0a8('0x18'),_0xb0a8('0x19'),_0xb0a8('0x13'),'mobile','fax',_0xb0a8('0x1a'),_0xb0a8('0x1b'),_0xb0a8('0x1c'),_0xb0a8('0x1d')];var _0x112ab4=_[_0xb0a8('0x1e')](_0x3d9a0c,_0x5e500d);BPromise['resolve']()[_0xb0a8('0x1f')](cmContactRpc[_0xb0a8('0x20')]({'attributes':_0x112ab4,'where':_0x34f49c}))[_0xb0a8('0x1f')](function(_0x3c04d2){_0x3e440c=_0x3c04d2;if(!_['isEmpty'](_0x3e440c)){if(_0x3e440c[_0xb0a8('0x21')]===0x1){_0x2c95f4=_0x3e440c[0x0];logger[_0xb0a8('0x22')](_0xb0a8('0x23'),_0x53cca4['uniqueid'],_0x25ca3e['id'],_0x2c95f4['id']);}else{logger[_0xb0a8('0x22')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x53cca4['uniqueid'],_0x25ca3e['id'],_[_0xb0a8('0x15')](_0x3e440c,'id')[_0xb0a8('0x24')](','));}return;}else{logger[_0xb0a8('0x22')](_0xb0a8('0x25'),_0x53cca4[_0xb0a8('0x26')],_0x25ca3e['id']);if(_0x35b478){logger[_0xb0a8('0x22')](_0xb0a8('0x27'),_0x53cca4['uniqueid'],_0x25ca3e['id']);var _0x1b5993=_0x4cc250[_0xb0a8('0x28')]&&_0x4cc250['data4']!=='0'?_0x4cc250[_0xb0a8('0x28')]:'phone';var _0x516935={'ListId':_0x526491};_0x516935[_0x1b5993]=_[_0xb0a8('0x29')](_0x53cca4['routeId'])?_0x53cca4[_0xb0a8('0x17')]:_0x53cca4[_0xb0a8('0x16')];if(_[_0xb0a8('0x29')](_0x53cca4['routeId'])){_0x516935['firstName']=_0x53cca4['calleridname']&&_0x53cca4[_0xb0a8('0x2a')]!==_0xb0a8('0x2b')?_0x53cca4[_0xb0a8('0x2a')]:_0xb0a8('0x2c');}else{_0x516935[_0xb0a8('0x18')]=_0x53cca4[_0xb0a8('0x2d')]&&_0x53cca4['destcalleridname']!==_0xb0a8('0x2b')?_0x53cca4[_0xb0a8('0x2d')]:_0xb0a8('0x2c');}return BPromise['resolve']()[_0xb0a8('0x1f')](cmContactRpc[_0xb0a8('0x2e')](_0x516935))[_0xb0a8('0x1f')](function(_0xe0f715){_0x2c95f4=_0xe0f715;if(_0x2c95f4){logger[_0xb0a8('0x22')](_0xb0a8('0x2f'),_0x53cca4[_0xb0a8('0x26')],_0x25ca3e['id'],_0x2c95f4['id']);}return;});}else{logger[_0xb0a8('0x22')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x53cca4[_0xb0a8('0x26')],_0x25ca3e['id']);return;}}})[_0xb0a8('0x1f')](function(){if(_0x19e669){emit(_0x53cca4[_0xb0a8('0x26')],_0x25ca3e,util['format']('user:%s',_0x19e669[_0xb0a8('0x30')]),util[_0xb0a8('0x31')](_0xb0a8('0x32'),_0x4cc250[_0xb0a8('0x33')][_0xb0a8('0x34')]()),{'evt':_['merge'](_0x53cca4,{'autoCreate':_0x35b478}),'contact':_0x2c95f4,'contacts':!_0x2c95f4?_0x3e440c:undefined});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index c731bda..8e44a36 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 _0xb49d=['clone','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','data2','html','render','templates','uri','isNil','data3','data4','location','data5','800','windowHeight','winArguments','format','user:%s','name','trigger:%s','exec','integration','urlforward','script','parse','query','replace','AllConditions','checkConditions','channel','some','AnyConditions','field','account','chat','operator','value','upperFirst','AccountId','interaction','message','event','queue','membername','lastevent','routeId','exports','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnoanswer','custom:agentreject','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','prototype','emit','info','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb49d,0x1f1));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0xdb49('0x0'));var url=require(_0xdb49('0x1'));var Mustache=require(_0xdb49('0x2'));var Redis=require(_0xdb49('0x3'));var urlforward=require(_0xdb49('0x4'));var integration=require('./integration');var cmContact=require(_0xdb49('0x5'));var script=require(_0xdb49('0x6'));var config=require(_0xdb49('0x7'));var logger=require(_0xdb49('0x8'))(_0xdb49('0x9'));var ami=require(_0xdb49('0xa'));config[_0xdb49('0xb')]=_[_0xdb49('0xc')](config[_0xdb49('0xb')],{'host':_0xdb49('0xd'),'port':0x18eb});var io=require(_0xdb49('0xe'))(new Redis(config[_0xdb49('0xb')]));var operators={'equals':function(_0xf9cd2e,_0x3d5dcd){return _0xf9cd2e==_0x3d5dcd;},'not_equals':function(_0x14c61b,_0x532155){return _0x14c61b!=_0x532155;}};var barAndWebActions=['popup',_0xdb49('0x1'),_0xdb49('0xf')];function Trigger(_0xae46a8){this[_0xdb49('0x10')]=_0xae46a8[_0xdb49('0x10')];this[_0xdb49('0x11')]=_0xae46a8['agents'];this[_0xdb49('0x12')]=_0xae46a8[_0xdb49('0x12')];this['templates']=_0xae46a8['templates'];this[_0xdb49('0x13')]=_0xae46a8[_0xdb49('0x13')];this[_0xdb49('0x14')]=_0xae46a8[_0xdb49('0x14')];this[_0xdb49('0x15')]=_0xae46a8[_0xdb49('0x15')];this[_0xdb49('0x16')]=_0xae46a8[_0xdb49('0x16')];this[_0xdb49('0x17')]=_0xae46a8['sugarcrmAccounts'];this[_0xdb49('0x18')]=_0xae46a8[_0xdb49('0x18')];this['deskAccounts']=_0xae46a8[_0xdb49('0x19')];this['vtigerAccounts']=_0xae46a8[_0xdb49('0x1a')];this[_0xdb49('0x1b')]=_0xae46a8[_0xdb49('0x1b')];this[_0xdb49('0x1c')]=_0xae46a8[_0xdb49('0x1c')];this[_0xdb49('0x1d')]=_0xae46a8[_0xdb49('0x1d')];this[_0xdb49('0x1e')]={'zendesk':this[_0xdb49('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0xdb49('0x15')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xdb49('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0xdb49('0x1a')],'dynamics365':this[_0xdb49('0x1c')],'freshsales':this[_0xdb49('0x1d')],'servicenow':this[_0xdb49('0x1b')]};ami['on'](_0xdb49('0x1f'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on']('custom:agentconnect',this[_0xdb49('0x20')]['bind'](this));ami['on']('custom:agentringnoanswer',this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on'](_0xdb49('0x22'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on']('custom:agentnosuchnumber',this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on'](_0xdb49('0x23'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on']('custom:agentbusy',this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on']('custom:agentcongestion',this[_0xdb49('0x20')]['bind'](this));ami['on'](_0xdb49('0x24'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on'](_0xdb49('0x25'),this['syncCustomEvent']['bind'](this));ami['on']('custom:timeout',this[_0xdb49('0x20')]['bind'](this));ami['on'](_0xdb49('0x26'),this['syncAgentDial']['bind'](this));ami['on'](_0xdb49('0x27'),this[_0xdb49('0x28')][_0xdb49('0x21')](this));ami['on']('custom:dialend',this[_0xdb49('0x28')]['bind'](this));ami['on'](_0xdb49('0x29'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on'](_0xdb49('0x2a'),this[_0xdb49('0x20')]['bind'](this));ami['on'](_0xdb49('0x2b'),this[_0xdb49('0x20')][_0xdb49('0x21')](this));ami['on']('custom:outgoingmessage',this[_0xdb49('0x20')]['bind'](this));ami['on']('custom:acceptmessage',this[_0xdb49('0x20')]['bind'](this));ami['on']('custom:rejectmessage',this['syncCustomEvent'][_0xdb49('0x21')](this));}Trigger[_0xdb49('0x2c')][_0xdb49('0x2d')]=function(_0x3a38a0,_0x550f70,_0x2b5e49){logger[_0xdb49('0x2e')](_0x3a38a0,_0x550f70,JSON[_0xdb49('0x2f')](_0x2b5e49));io['to'](_0x3a38a0)[_0xdb49('0x2d')](_0x550f70,_0x2b5e49);};Trigger[_0xdb49('0x2c')][_0xdb49('0x20')]=function(_0x5e2497){var _0x5dbcc3=_[_0xdb49('0x30')](_0x5e2497);this[_0xdb49('0x31')](_0x5dbcc3);};Trigger[_0xdb49('0x2c')]['syncAgentDial']=function(_0x21daaa){if(this[_0xdb49('0x11')][_0x21daaa[_0xdb49('0x32')]]){this[_0xdb49('0x20')](_0x21daaa);}};Trigger[_0xdb49('0x2c')][_0xdb49('0x31')]=function(_0x1891c1){var _0x4c8085;for(var _0x44221f in this['triggers']){if(this['triggers'][_0xdb49('0x33')](_0x44221f)){if(this['triggers'][_0x44221f][_0xdb49('0x34')]){_0x4c8085=this[_0xdb49('0x35')](this[_0xdb49('0x10')][_0x44221f],_0x1891c1);if(_0x4c8085){_[_0xdb49('0x36')](_0x1891c1,_0x1891c1[_0xdb49('0x37')]);for(var _0x2d1e45=0x0,_0x49d46d,_0x1fe491,_0x146f68;_0x2d1e450x0){_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(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 5d3aafc..957cd3b 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 _0x4b7d=['GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','queue','callDirection','headers','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','md5','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','clientId','remoteUri','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x4b7d,0x1df));var _0xd4b7=function(_0x4690c7,_0x532d86){_0x4690c7=_0x4690c7-0x0;var _0x4910f1=_0x4b7d[_0x4690c7];return _0x4910f1;};'use strict';var _=require(_0xd4b7('0x0'));var BPromise=require(_0xd4b7('0x1'));var rp=require(_0xd4b7('0x2'));var util=require(_0xd4b7('0x3'));var intUtil=require('./util');var md5=require(_0xd4b7('0x4'));var Redis=require('ioredis');var logger=require(_0xd4b7('0x5'))('dynamics365');var config=require(_0xd4b7('0x6'));config[_0xd4b7('0x7')]=_[_0xd4b7('0x8')](config[_0xd4b7('0x7')],{'host':_0xd4b7('0x9'),'port':0x18eb});var io=require(_0xd4b7('0xa'))(new Redis(config[_0xd4b7('0x7')]));function getAuthToken(_0x36593d,_0x2ca6d5,_0x318164){var _0x30a14c={'method':'POST','uri':_0x2ca6d5,'form':{'client_id':_0x36593d[_0xd4b7('0xb')],'resource':_0x36593d[_0xd4b7('0xc')],'username':_0x36593d['username'],'password':_0x36593d[_0xd4b7('0xd')],'grant_type':_0xd4b7('0xd'),'client_secret':_0x36593d['clientSecret']},'json':!![]};return rp(_0x30a14c)[_0xd4b7('0xe')](function(_0x425569){return _0x425569[_0xd4b7('0xf')];})[_0xd4b7('0x10')](function(_0x4ff5f7){logger[_0xd4b7('0x11')]('['+[_0x318164[_0xd4b7('0x12')]()]+_0xd4b7('0x13'));return _0x4ff5f7[_0xd4b7('0x14')];});}function getUser(_0x5602a2,_0x23efa8,_0x459452,_0x2fa0da,_0x782bdf,_0x4f0ca1){return new BPromise(function(_0x2cdec8,_0x37ee54){return getAuthToken(_0x23efa8,_0x2fa0da,_0x4f0ca1)[_0xd4b7('0xe')](function(_0x59ee41){var _0xee69dd={'method':_0xd4b7('0x15'),'uri':_0x782bdf+_0xd4b7('0x16'),'headers':{'Authorization':_0xd4b7('0x17')+_0x59ee41,'OData-Version':_0xd4b7('0x18')},'json':!![]};return rp(_0xee69dd);})['then'](function(_0x189727){var _0x1226f4=_0x189727[_0xd4b7('0x19')];var _0x5a72c2=![];var _0x5b750a=null;if(!_[_0xd4b7('0x1a')](_0x459452)){if(intUtil[_0xd4b7('0x1b')](_0x459452[_0xd4b7('0x1c')])){_0x5602a2['userEmail']=_0x459452[_0xd4b7('0x1c')];for(_0x5b750a=0x0;_0x5b750a<_0x1226f4['length'];_0x5b750a++){if(_0x1226f4[_0x5b750a][_0xd4b7('0x1d')]===_0x459452[_0xd4b7('0x1c')]&&!_0x1226f4[_0x5b750a][_0xd4b7('0x1e')]){_0x5a72c2=!![];logger[_0xd4b7('0x1f')]('['+[_0x4f0ca1[_0xd4b7('0x12')]()]+_0xd4b7('0x20')+_0x1226f4[_0x5b750a]['systemuserid']+'!');_0x5602a2[_0xd4b7('0x21')]=_0x1226f4[_0x5b750a][_0xd4b7('0x22')];}}}}if(!_0x5a72c2){logger[_0xd4b7('0x1f')]('['+[_0x4f0ca1[_0xd4b7('0x12')]()]+_0xd4b7('0x23'));_0x5602a2['userEmail']=_0x23efa8[_0xd4b7('0x24')];for(_0x5b750a=0x0;_0x5b750a<_0x1226f4[_0xd4b7('0x25')];_0x5b750a++){if(_0x1226f4[_0x5b750a][_0xd4b7('0x1d')]===_0x23efa8[_0xd4b7('0x24')]){_0x5602a2[_0xd4b7('0x21')]=_0x1226f4[_0x5b750a][_0xd4b7('0x22')];}}}_0x2cdec8(_0x5602a2);})[_0xd4b7('0x10')](function(_0x5476d5){_0x37ee54(_0x5476d5['message']);});});}function createEndUser(_0x37ca6b,_0xca9a66,_0x1d177f,_0x43afb6,_0x2ff045,_0xd13a9e){return new BPromise(function(_0x4e456a,_0x2c04ce){return getAuthToken(_0xca9a66,_0x1d177f,_0xd13a9e)[_0xd4b7('0xe')](function(_0x2957c1){var _0x22bb25=_0xd13a9e[_0xd4b7('0x26')]()===_0xd4b7('0x27')?_0x2ff045[_0xd4b7('0x28')]:_0x2ff045[_0xd4b7('0x29')];var _0x5d6053={'method':_0xd4b7('0x2a'),'uri':_0x43afb6+_0xd4b7('0x2b'),'body':{'telephone1':_0x22bb25,'fullname':_0x22bb25,'firstname':_0x22bb25,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd4b7('0x2c')+_0x37ca6b[_0xd4b7('0x21')]+')'},'headers':{'Authorization':_0xd4b7('0x17')+_0x2957c1,'OData-Version':_0xd4b7('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5d6053);})[_0xd4b7('0xe')](function(_0x456950){var _0x4b8338=_0x456950['headers'][_0xd4b7('0x2d')];var _0x2e53e8=_0x4b8338[_0xd4b7('0x2e')](_0x4b8338[_0xd4b7('0x2f')]('(')+0x1,_0x4b8338[_0xd4b7('0x2f')](')'));_0x37ca6b[_0xd4b7('0x30')]=_0x2e53e8;_0x4e456a(_0x37ca6b);})['catch'](function(_0x14a6cb){_0x2c04ce(_0x14a6cb[_0xd4b7('0x14')]);});});}function getEndUser(_0xe715a,_0x29e991,_0x401f32,_0x207f93,_0x39ca73,_0x24f3f6){return new BPromise(function(_0x3ff063,_0x3e04ad){return getAuthToken(_0x29e991,_0x401f32,_0x24f3f6)[_0xd4b7('0xe')](function(_0x49f32f){var _0x4f415f={'method':'GET','uri':_0x207f93+_0xd4b7('0x31'),'headers':{'Authorization':_0xd4b7('0x17')+_0x49f32f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4f415f);})['then'](function(_0x38766e){var _0x53387b=null;if(_0x38766e){var _0x5e6adf=_0x38766e['value'];var _0x444ad8=![];for(_0x53387b=0x0;_0x53387b<_0x5e6adf[_0xd4b7('0x25')];_0x53387b++){var _0x5a724c=_0x24f3f6[_0xd4b7('0x26')]()==='outbound'?_0x39ca73[_0xd4b7('0x28')]:_0x39ca73[_0xd4b7('0x29')];if(_0x5e6adf[_0x53387b]['telephone1']===_0x5a724c){_0x444ad8=!![];_0xe715a['enduserId']=_0x5e6adf[_0x53387b][_0xd4b7('0x32')];}}if(_0x444ad8){_0x3ff063(_0xe715a);}else{return createEndUser(_0xe715a,_0x29e991,_0x401f32,_0x207f93,_0x39ca73,_0x24f3f6)[_0xd4b7('0xe')](function(_0x25912a){logger[_0xd4b7('0x1f')]('['+[_0x24f3f6[_0xd4b7('0x12')]()]+_0xd4b7('0x33'),_0x25912a[_0xd4b7('0x30')]);_0x3ff063(_0x25912a);});}}else{return createEndUser(_0xe715a,_0x29e991,_0x401f32,_0x207f93,_0x39ca73,_0x24f3f6)[_0xd4b7('0xe')](function(_0x10e23c){logger[_0xd4b7('0x1f')]('['+[_0x24f3f6[_0xd4b7('0x12')]()]+']\x20Enduser\x20Created!',_0x10e23c[_0xd4b7('0x30')]);_0x3ff063(_0x10e23c);});}});});}function getCustomFields(_0x4bac24,_0x362a85,_0x354688){var _0x8be486={};if(_0x4bac24['length']>0x0){_[_0xd4b7('0x34')](_0x4bac24,function(_0x3e95a4){if(_0x3e95a4[_0xd4b7('0x35')]===_0xd4b7('0x36')&&_0x3e95a4[_0xd4b7('0x37')]&&!_0x3e95a4[_0xd4b7('0x38')]){var _0x49b99b=_0x3e95a4['idField'][_0xd4b7('0x26')]();var _0x126cb1=_0x49b99b[_0xd4b7('0x2e')](0x0,_0x49b99b[_0xd4b7('0x39')]('_'));var _0x2f3682=_0x49b99b['substring'](_0x49b99b[_0xd4b7('0x39')]('_')+0x1);if(_0x126cb1===_0x354688){_0x8be486[_0x2f3682]=_0x3e95a4[_0xd4b7('0x3a')];}}});}return _0x8be486;}function getTicket(_0xfe7c29,_0x4a3be4,_0x549579,_0x386202,_0x39a9b4,_0x11c2b2,_0xc38c37){return new BPromise(function(_0x12ccd1,_0x1438c1){var _0x4ed6e2;return getAuthToken(_0x4a3be4,_0x549579,_0xc38c37)[_0xd4b7('0xe')](function(_0x1fdf19){if(_0x11c2b2[_0xd4b7('0x3b')]===_0xd4b7('0x3c')){_0x4ed6e2={'method':'POST','uri':_0x386202+_0xd4b7('0x3d'),'body':Object[_0xd4b7('0x3e')]({},{'title':intUtil[_0xd4b7('0x3f')](_0x11c2b2[_0xd4b7('0x40')],_0x39a9b4,'\x20'),'description':intUtil[_0xd4b7('0x3f')](_0x11c2b2[_0xd4b7('0x41')],_0x39a9b4,'\x0a'),'customerid_contact@odata.bind':_0xd4b7('0x42')+_0xfe7c29[_0xd4b7('0x30')]+')','ownerid@odata.bind':_0xd4b7('0x2c')+_0xfe7c29[_0xd4b7('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x11c2b2[_0xd4b7('0x43')],_0x39a9b4,_0x11c2b2['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x1fdf19,'OData-Version':_0xd4b7('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x11c2b2[_0xd4b7('0x3b')]===_0xd4b7('0x44')){_0x4ed6e2={'method':_0xd4b7('0x2a'),'uri':_0x386202+_0xd4b7('0x45'),'body':Object[_0xd4b7('0x3e')]({},{'subject':intUtil[_0xd4b7('0x3f')](_0x11c2b2['Subjects'],_0x39a9b4,'\x20'),'phonenumber':String(_0x39a9b4['calleridnum']),'description':intUtil[_0xd4b7('0x3f')](_0x11c2b2['Descriptions'],_0x39a9b4,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd4b7('0x42')+_0xfe7c29[_0xd4b7('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0xfe7c29[_0xd4b7('0x21')]+')','directioncode':_0xfe7c29['callDirection']===_0xd4b7('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xd4b7('0x2c')+_0xfe7c29[_0xd4b7('0x21')]+')','participationtypemask':_0xfe7c29['callDirection']===_0xd4b7('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xd4b7('0x42')+_0xfe7c29[_0xd4b7('0x30')]+')','participationtypemask':_0xfe7c29[_0xd4b7('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x11c2b2[_0xd4b7('0x43')],_0x39a9b4,_0x11c2b2['ticketType'])),'headers':{'Authorization':_0xd4b7('0x17')+_0x1fdf19,'OData-Version':_0xd4b7('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4ed6e2);})['then'](function(_0x31f92e){var _0x115558=_0x31f92e[_0xd4b7('0x48')][_0xd4b7('0x2d')];var _0x5d3c0c=_0x115558['substring'](_0x115558[_0xd4b7('0x2f')]('(')+0x1,_0x115558['lastIndexOf'](')'));_0xfe7c29[_0xd4b7('0x49')]=_0x5d3c0c;_0x12ccd1(_0xfe7c29);})[_0xd4b7('0x10')](function(_0x50a4be){_0x1438c1(_0x50a4be['message']);});});}function emit(_0x16e208,_0x42ba57,_0x475ef9,_0x170e6d){var _0x5e605e={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x16e208,_0x475ef9,_0x170e6d)};io['to'](util[_0xd4b7('0x4a')]('user:%s',_0x42ba57))[_0xd4b7('0x4b')](_0xd4b7('0x4c'),_0x5e605e);}exports['cs']=function(_0x52203c,_0x5a66d6,_0x291df9,_0x39fc0d,_0x304310,_0x5f48c2,_0x1abf8d,_0x2b3894){var _0xb49ac={};_0x5f48c2[_0xd4b7('0xc')]=intUtil[_0xd4b7('0x4d')](_0x5f48c2['remoteUri']);_0x5f48c2['serverUrl']=intUtil['stripTrailingSlash'](_0x5f48c2[_0xd4b7('0x4e')]);_0xb49ac[_0xd4b7('0x47')]=_0x2b3894===_0xd4b7('0x46')||_0x2b3894===_0xd4b7('0x4f')?_0xd4b7('0x46'):_0xd4b7('0x27');var _0xce1264=util[_0xd4b7('0x4a')]('%s/api/data/v9.0/',_0x5f48c2[_0xd4b7('0xc')]);var _0x28d5a6=util[_0xd4b7('0x4a')]('https://login.microsoftonline.com/%s/oauth2/token',_0x5f48c2[_0xd4b7('0x50')]);var _0x2c4f63=util[_0xd4b7('0x4a')](_0xd4b7('0x51'),_0x5f48c2[_0xd4b7('0x4e')],_0x5a66d6['uniqueid'],md5(_0x5a66d6[_0xd4b7('0x52')]));if(_0x304310&&_0x304310[_0xd4b7('0x53')]){logger[_0xd4b7('0x1f')](_0xd4b7('0x54'),_0xd4b7('0x55'));_0x5a66d6[_0xd4b7('0x56')]=_0x2c4f63;}else if(_0x1abf8d&&_0x1abf8d[_0xd4b7('0x57')]&&_0x1abf8d['recordingFormat']!==_0xd4b7('0x58')){logger[_0xd4b7('0x1f')](_0xd4b7('0x59'),_0xd4b7('0x55'));_0x5a66d6['recordingURL']=_0x2c4f63;}else{_0x5a66d6[_0xd4b7('0x56')]='';}return getUser(_0xb49ac,_0x5f48c2,_0x39fc0d,_0x28d5a6,_0xce1264,_0x2b3894)[_0xd4b7('0xe')](function(_0x319385){logger[_0xd4b7('0x1f')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x5a'),_0x319385['userId']);logger[_0xd4b7('0x1f')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x5b'),_0x319385[_0xd4b7('0x5c')]);return getEndUser(_0x319385,_0x5f48c2,_0x28d5a6,_0xce1264,_0x5a66d6,_0x2b3894);})[_0xd4b7('0xe')](function(_0x411cd5){logger[_0xd4b7('0x1f')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x5d'),_0x411cd5[_0xd4b7('0x30')]);logger[_0xd4b7('0x1f')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x5e'),_0x5a66d6['calleridnum']);return getTicket(_0x411cd5,_0x5f48c2,_0x28d5a6,_0xce1264,_0x5a66d6,_0x291df9,_0x2b3894);})['then'](function(_0x45a307){logger[_0xd4b7('0x1f')](util[_0xd4b7('0x4a')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x5f'),_0x291df9['ticketType'],_0x45a307[_0xd4b7('0x49')]));logger[_0xd4b7('0x1f')](util['format']('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x60'),_0x2b3894));if(_0x2b3894!=='unmanaged'){logger[_0xd4b7('0x1f')]('['+_0x2b3894[_0xd4b7('0x12')]()+']',_0xd4b7('0x61'));emit(_0x5f48c2[_0xd4b7('0xc')],_0x39fc0d[_0xd4b7('0x62')],_0x291df9[_0xd4b7('0x3b')],_0x45a307[_0xd4b7('0x49')]);}})[_0xd4b7('0x10')](function(_0x1bec96){logger[_0xd4b7('0x11')]('['+_0x2b3894[_0xd4b7('0x12')]()+_0xd4b7('0x63'),util['inspect'](_0x1bec96,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd443=['content','ticketType','incident','incidents','assign','Subjects','Descriptions','/contacts(','Fields','phonecall','getString','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','idField','toLowerCase','indexOf'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xd443,0x8b));var _0x3d44=function(_0x81c63e,_0x75b1aa){_0x81c63e=_0x81c63e-0x0;var _0x521413=_0xd443[_0x81c63e];return _0x521413;};'use strict';var _=require('lodash');var BPromise=require(_0x3d44('0x0'));var rp=require(_0x3d44('0x1'));var util=require('util');var intUtil=require(_0x3d44('0x2'));var md5=require(_0x3d44('0x3'));var Redis=require(_0x3d44('0x4'));var logger=require(_0x3d44('0x5'))(_0x3d44('0x6'));var config=require(_0x3d44('0x7'));config[_0x3d44('0x8')]=_[_0x3d44('0x9')](config[_0x3d44('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x3d44('0xa'))(new Redis(config[_0x3d44('0x8')]));function getAuthToken(_0x1865e3,_0x3cce8d,_0x5ed66d){var _0x1d5279={'method':_0x3d44('0xb'),'uri':_0x3cce8d,'form':{'client_id':_0x1865e3[_0x3d44('0xc')],'resource':_0x1865e3[_0x3d44('0xd')],'username':_0x1865e3[_0x3d44('0xe')],'password':_0x1865e3[_0x3d44('0xf')],'grant_type':_0x3d44('0xf'),'client_secret':_0x1865e3[_0x3d44('0x10')]},'json':!![]};return rp(_0x1d5279)[_0x3d44('0x11')](function(_0x1f1826){return _0x1f1826['access_token'];})[_0x3d44('0x12')](function(_0x5061d3){logger['error']('['+[_0x5ed66d[_0x3d44('0x13')]()]+_0x3d44('0x14'));return _0x5061d3[_0x3d44('0x15')];});}function getUser(_0x1f459b,_0xe93792,_0x4f3333,_0x4505b3,_0x4eceb9,_0xb05484){return new BPromise(function(_0x5b9fc9,_0x12187a){return getAuthToken(_0xe93792,_0x4505b3,_0xb05484)[_0x3d44('0x11')](function(_0x2ee1c5){var _0x591023={'method':_0x3d44('0x16'),'uri':_0x4eceb9+_0x3d44('0x17'),'headers':{'Authorization':_0x3d44('0x18')+_0x2ee1c5,'OData-Version':'4.0'},'json':!![]};return rp(_0x591023);})[_0x3d44('0x11')](function(_0x35752d){var _0xf1e627=_0x35752d[_0x3d44('0x19')];var _0x304c25=![];var _0x427a92=null;if(!_[_0x3d44('0x1a')](_0x4f3333)){if(intUtil[_0x3d44('0x1b')](_0x4f3333[_0x3d44('0x1c')])){_0x1f459b[_0x3d44('0x1d')]=_0x4f3333[_0x3d44('0x1c')];for(_0x427a92=0x0;_0x427a92<_0xf1e627[_0x3d44('0x1e')];_0x427a92++){if(_0xf1e627[_0x427a92][_0x3d44('0x1f')]===_0x4f3333[_0x3d44('0x1c')]&&!_0xf1e627[_0x427a92][_0x3d44('0x20')]){_0x304c25=!![];logger[_0x3d44('0x21')]('['+[_0xb05484[_0x3d44('0x13')]()]+_0x3d44('0x22')+_0xf1e627[_0x427a92][_0x3d44('0x23')]+'!');_0x1f459b[_0x3d44('0x24')]=_0xf1e627[_0x427a92][_0x3d44('0x23')];}}}}if(!_0x304c25){logger[_0x3d44('0x21')]('['+[_0xb05484[_0x3d44('0x13')]()]+_0x3d44('0x25'));_0x1f459b['userEmail']=_0xe93792[_0x3d44('0xe')];for(_0x427a92=0x0;_0x427a92<_0xf1e627[_0x3d44('0x1e')];_0x427a92++){if(_0xf1e627[_0x427a92][_0x3d44('0x1f')]===_0xe93792[_0x3d44('0xe')]){_0x1f459b[_0x3d44('0x24')]=_0xf1e627[_0x427a92][_0x3d44('0x23')];}}}_0x5b9fc9(_0x1f459b);})[_0x3d44('0x12')](function(_0x797f6a){_0x12187a(_0x797f6a[_0x3d44('0x15')]);});});}function createEndUser(_0x2c2202,_0x2831ff,_0x5d39cb,_0x1a992c,_0xf1bedc,_0x27138d){return new BPromise(function(_0x287666,_0xafc453){return getAuthToken(_0x2831ff,_0x5d39cb,_0x27138d)[_0x3d44('0x11')](function(_0x5c95a3){var _0x3e3f0e=_0x27138d['toLowerCase']()===_0x3d44('0x26')?_0xf1bedc[_0x3d44('0x27')]:_0xf1bedc['calleridnum'];var _0x17ae72={'method':_0x3d44('0xb'),'uri':_0x1a992c+_0x3d44('0x28'),'body':{'telephone1':_0x3e3f0e,'fullname':_0x3e3f0e,'firstname':_0x3e3f0e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3d44('0x29')+_0x2c2202[_0x3d44('0x24')]+')'},'headers':{'Authorization':_0x3d44('0x18')+_0x5c95a3,'OData-Version':_0x3d44('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x17ae72);})[_0x3d44('0x11')](function(_0x26b2d7){var _0x3145d3=_0x26b2d7[_0x3d44('0x2b')][_0x3d44('0x2c')];var _0x48bacf=_0x3145d3[_0x3d44('0x2d')](_0x3145d3[_0x3d44('0x2e')]('(')+0x1,_0x3145d3[_0x3d44('0x2e')](')'));_0x2c2202[_0x3d44('0x2f')]=_0x48bacf;_0x287666(_0x2c2202);})[_0x3d44('0x12')](function(_0x4824f7){_0xafc453(_0x4824f7['message']);});});}function getEndUser(_0x566aa2,_0x2db51c,_0x17812b,_0x27a388,_0x123f7d,_0x54cd18){return new BPromise(function(_0x834943,_0x381048){return getAuthToken(_0x2db51c,_0x17812b,_0x54cd18)['then'](function(_0x529c7b){var _0x5acfa2={'method':_0x3d44('0x16'),'uri':_0x27a388+'contacts?$select=telephone1','headers':{'Authorization':_0x3d44('0x18')+_0x529c7b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5acfa2);})[_0x3d44('0x11')](function(_0x1bc1da){var _0x52d0ef=null;if(_0x1bc1da){var _0x4068a3=_0x1bc1da[_0x3d44('0x19')];var _0x2c2598=![];for(_0x52d0ef=0x0;_0x52d0ef<_0x4068a3[_0x3d44('0x1e')];_0x52d0ef++){var _0x42e90b=_0x54cd18['toLowerCase']()==='outbound'?_0x123f7d['destcalleridnum']:_0x123f7d[_0x3d44('0x30')];if(_0x4068a3[_0x52d0ef][_0x3d44('0x31')]===_0x42e90b){_0x2c2598=!![];_0x566aa2[_0x3d44('0x2f')]=_0x4068a3[_0x52d0ef][_0x3d44('0x32')];}}if(_0x2c2598){_0x834943(_0x566aa2);}else{return createEndUser(_0x566aa2,_0x2db51c,_0x17812b,_0x27a388,_0x123f7d,_0x54cd18)[_0x3d44('0x11')](function(_0x5a8fa3){logger['info']('['+[_0x54cd18['toUpperCase']()]+_0x3d44('0x33'),_0x5a8fa3[_0x3d44('0x2f')]);_0x834943(_0x5a8fa3);});}}else{return createEndUser(_0x566aa2,_0x2db51c,_0x17812b,_0x27a388,_0x123f7d,_0x54cd18)[_0x3d44('0x11')](function(_0x3a5ea1){logger[_0x3d44('0x21')]('['+[_0x54cd18[_0x3d44('0x13')]()]+']\x20Enduser\x20Created!',_0x3a5ea1[_0x3d44('0x2f')]);_0x834943(_0x3a5ea1);});}});});}function getCustomFields(_0xbc0d4b,_0x4716a3,_0x3fc9a7){var _0x2d3b8d={};if(_0xbc0d4b[_0x3d44('0x1e')]>0x0){_[_0x3d44('0x34')](_0xbc0d4b,function(_0x41eb85){if(_0x41eb85[_0x3d44('0x35')]==='string'&&_0x41eb85['nameField']&&!_0x41eb85['customField']){var _0x19198d=_0x41eb85[_0x3d44('0x36')][_0x3d44('0x37')]();var _0x487296=_0x19198d['substring'](0x0,_0x19198d[_0x3d44('0x38')]('_'));var _0x3a4e04=_0x19198d[_0x3d44('0x2d')](_0x19198d[_0x3d44('0x38')]('_')+0x1);if(_0x487296===_0x3fc9a7){_0x2d3b8d[_0x3a4e04]=_0x41eb85[_0x3d44('0x39')];}}});}return _0x2d3b8d;}function getTicket(_0x4df901,_0x5068b6,_0x4fe8bc,_0x5b0b74,_0x54826f,_0x33fe21,_0x11c97e){return new BPromise(function(_0x312621,_0x4ded82){var _0x461e74;return getAuthToken(_0x5068b6,_0x4fe8bc,_0x11c97e)['then'](function(_0x14b09c){if(_0x33fe21[_0x3d44('0x3a')]===_0x3d44('0x3b')){_0x461e74={'method':_0x3d44('0xb'),'uri':_0x5b0b74+_0x3d44('0x3c'),'body':Object[_0x3d44('0x3d')]({},{'title':intUtil['getString'](_0x33fe21[_0x3d44('0x3e')],_0x54826f,'\x20'),'description':intUtil['getString'](_0x33fe21[_0x3d44('0x3f')],_0x54826f,'\x0a'),'customerid_contact@odata.bind':_0x3d44('0x40')+_0x4df901[_0x3d44('0x2f')]+')','ownerid@odata.bind':_0x3d44('0x29')+_0x4df901[_0x3d44('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x33fe21[_0x3d44('0x41')],_0x54826f,_0x33fe21[_0x3d44('0x3a')])),'headers':{'Authorization':_0x3d44('0x18')+_0x14b09c,'OData-Version':_0x3d44('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x33fe21[_0x3d44('0x3a')]===_0x3d44('0x42')){_0x461e74={'method':'POST','uri':_0x5b0b74+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x3d44('0x43')](_0x33fe21[_0x3d44('0x3e')],_0x54826f,'\x20'),'phonenumber':String(_0x54826f['calleridnum']),'description':intUtil[_0x3d44('0x43')](_0x33fe21[_0x3d44('0x3f')],_0x54826f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3d44('0x40')+_0x4df901['enduserId']+')','ownerid@odata.bind':_0x3d44('0x29')+_0x4df901[_0x3d44('0x24')]+')','directioncode':_0x4df901[_0x3d44('0x44')]===_0x3d44('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3d44('0x29')+_0x4df901['userId']+')','participationtypemask':_0x4df901[_0x3d44('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x3d44('0x40')+_0x4df901['enduserId']+')','participationtypemask':_0x4df901[_0x3d44('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x33fe21['Fields'],_0x54826f,_0x33fe21[_0x3d44('0x3a')])),'headers':{'Authorization':_0x3d44('0x18')+_0x14b09c,'OData-Version':_0x3d44('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x461e74);})[_0x3d44('0x11')](function(_0x380454){var _0x2df1fe=_0x380454[_0x3d44('0x2b')][_0x3d44('0x2c')];var _0x5bbea7=_0x2df1fe[_0x3d44('0x2d')](_0x2df1fe[_0x3d44('0x2e')]('(')+0x1,_0x2df1fe[_0x3d44('0x2e')](')'));_0x4df901['ticketId']=_0x5bbea7;_0x312621(_0x4df901);})[_0x3d44('0x12')](function(_0x367eff){_0x4ded82(_0x367eff[_0x3d44('0x15')]);});});}function emit(_0x1434a1,_0x56652f,_0x3f96f0,_0x51b553){var _0x24a427={'uri':util[_0x3d44('0x46')](_0x3d44('0x47'),_0x1434a1,_0x3f96f0,_0x51b553)};io['to'](util[_0x3d44('0x46')]('user:%s',_0x56652f))[_0x3d44('0x48')](_0x3d44('0x49'),_0x24a427);}exports['cs']=function(_0x382d8a,_0x3add0f,_0x5d3a87,_0x2b8802,_0x1e426d,_0x97d034,_0x4fb50f,_0x44a8fc){var _0x982aab={};_0x97d034[_0x3d44('0xd')]=intUtil[_0x3d44('0x4a')](_0x97d034[_0x3d44('0xd')]);_0x97d034[_0x3d44('0x4b')]=intUtil[_0x3d44('0x4a')](_0x97d034[_0x3d44('0x4b')]);_0x982aab[_0x3d44('0x44')]=_0x44a8fc===_0x3d44('0x45')||_0x44a8fc===_0x3d44('0x4c')?_0x3d44('0x45'):_0x3d44('0x26');var _0x3c3055=util[_0x3d44('0x46')](_0x3d44('0x4d'),_0x97d034[_0x3d44('0xd')]);var _0x3467ee=util[_0x3d44('0x46')](_0x3d44('0x4e'),_0x97d034[_0x3d44('0x4f')]);var _0x203b25=util[_0x3d44('0x46')](_0x3d44('0x50'),_0x97d034[_0x3d44('0x4b')],_0x3add0f[_0x3d44('0x51')],md5(_0x3add0f[_0x3d44('0x51')]));if(_0x1e426d&&_0x1e426d['monitor_format']){logger[_0x3d44('0x21')](_0x3d44('0x52'),_0x3d44('0x53'));_0x3add0f['recordingURL']=_0x203b25;}else if(_0x4fb50f&&_0x4fb50f[_0x3d44('0x54')]&&_0x4fb50f['recordingFormat']!==_0x3d44('0x55')){logger[_0x3d44('0x21')]('[OUTBOUND]',_0x3d44('0x53'));_0x3add0f[_0x3d44('0x56')]=_0x203b25;}else{_0x3add0f['recordingURL']='';}return getUser(_0x982aab,_0x97d034,_0x2b8802,_0x3467ee,_0x3c3055,_0x44a8fc)[_0x3d44('0x11')](function(_0x538d48){logger[_0x3d44('0x21')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x57'),_0x538d48['userId']);logger[_0x3d44('0x21')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x58'),_0x538d48[_0x3d44('0x1d')]);return getEndUser(_0x538d48,_0x97d034,_0x3467ee,_0x3c3055,_0x3add0f,_0x44a8fc);})['then'](function(_0x3b9a3b){logger['info']('['+_0x44a8fc['toUpperCase']()+_0x3d44('0x59'),_0x3b9a3b[_0x3d44('0x2f')]);logger[_0x3d44('0x21')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x5a'),_0x3add0f[_0x3d44('0x30')]);return getTicket(_0x3b9a3b,_0x97d034,_0x3467ee,_0x3c3055,_0x3add0f,_0x5d3a87,_0x44a8fc);})[_0x3d44('0x11')](function(_0x43e6fc){logger[_0x3d44('0x21')](util[_0x3d44('0x46')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x5b'),_0x5d3a87['ticketType'],_0x43e6fc[_0x3d44('0x5c')]));logger[_0x3d44('0x21')](util[_0x3d44('0x46')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x5d'),_0x44a8fc));if(_0x44a8fc!=='unmanaged'){logger['info']('['+_0x44a8fc[_0x3d44('0x13')]()+']',_0x3d44('0x5e'));emit(_0x97d034[_0x3d44('0xd')],_0x2b8802['name'],_0x5d3a87['ticketType'],_0x43e6fc[_0x3d44('0x5c')]);}})['catch'](function(_0x928cba){logger[_0x3d44('0x5f')]('['+_0x44a8fc[_0x3d44('0x13')]()+_0x3d44('0x60'),util[_0x3d44('0x61')](_0x928cba,{'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 17f5363..9e91287 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 _0xfd1e=['content','string','idField','custom_fields','variable','push','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','keyBy','value','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','forEach','type','customField','nameField','toLowerCase'];(function(_0x222255,_0x2ad952){var _0x2ff33f=function(_0x1b4ac5){while(--_0x1b4ac5){_0x222255['push'](_0x222255['shift']());}};_0x2ff33f(++_0x2ad952);}(_0xfd1e,0x128));var _0xefd1=function(_0x32dff8,_0x16999d){_0x32dff8=_0x32dff8-0x0;var _0x475158=_0xfd1e[_0x32dff8];return _0x475158;};'use strict';var _=require(_0xefd1('0x0'));var rp=require(_0xefd1('0x1'));var md5=require(_0xefd1('0x2'));var util=require(_0xefd1('0x3'));var Redis=require(_0xefd1('0x4'));var intUtil=require(_0xefd1('0x5'));var config=require('../../../../config/environment');var logger=require(_0xefd1('0x6'))(_0xefd1('0x7'));config['redis']=_['defaults'](config[_0xefd1('0x8')],{'host':_0xefd1('0x9'),'port':0x18eb});var io=require(_0xefd1('0xa'))(new Redis(config[_0xefd1('0x8')]));var headers={'Content-Type':_0xefd1('0xb'),'Accept':_0xefd1('0xb')};function emit(_0x2c634f,_0x5d1833,_0x10d769){io['to'](_0x2c634f)[_0xefd1('0xc')](_0x5d1833,_0x10d769);}function getTicket(_0x2de3fb,_0xe75180,_0x58ebad,_0xf17c6,_0x45e166){logger['info'](_0xefd1('0xd'));var _0x2cf4e9=_['merge']({'responder_id':_0xe75180['id'],'requester_id':_0x58ebad['id'],'name':util[_0xefd1('0xe')](_0xefd1('0xf'),_0x45e166[_0xefd1('0x10')]),'phone':_0x45e166[_0xefd1('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xefd1('0x12')](_0xf17c6[_0xefd1('0x13')],_0x45e166,'\x20'),'description':intUtil[_0xefd1('0x12')](_0xf17c6[_0xefd1('0x14')],_0x45e166,_0xefd1('0x15')),'tags':getTags(_0xf17c6['Tags'],_0xefd1('0x16'))},getCustomFields(_0xf17c6[_0xefd1('0x17')],_0x45e166));_0x2cf4e9['custom_fields']=_['mapValues'](_[_0xefd1('0x18')](_0x2cf4e9['custom_fields'],'id'),_0xefd1('0x19'));return request({'uri':util['format']('%s/api/v2/tickets',_0x2de3fb[_0xefd1('0x1a')]),'method':_0xefd1('0x1b'),'body':_0x2cf4e9})[_0xefd1('0x1c')](function(_0x3becb2){logger[_0xefd1('0x1d')](_0xefd1('0x1e'));return _0x3becb2;});}function getUser(_0x1910f0,_0x31719b){if(intUtil[_0xefd1('0x1f')](_0x31719b)){return request({'uri':util[_0xefd1('0xe')](_0xefd1('0x20'),_0x1910f0['remoteUri']),'qs':{'email':_0x31719b}})[_0xefd1('0x1c')](function(_0x50a69b){if(_0x50a69b[_0xefd1('0x21')]){logger['info']('Agent\x20found!');return _[_0xefd1('0x22')](_0x50a69b,function(_0x175aa7){return _0x175aa7['contact'][_0xefd1('0x23')]===_0x31719b;});}else{logger['info'](_0xefd1('0x24'));return request({'uri':util[_0xefd1('0xe')](_0xefd1('0x25'),_0x1910f0[_0xefd1('0x1a')])})[_0xefd1('0x1c')](function(_0x1e4102){logger[_0xefd1('0x1d')](_0xefd1('0x26'));return _0x1e4102;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xefd1('0xe')](_0xefd1('0x25'),_0x1910f0['remoteUri'])})['then'](function(_0x47a69d){logger[_0xefd1('0x1d')](_0xefd1('0x26'));return _0x47a69d;});}}function getEndUser(_0x4d2b99,_0x4dc9e6,_0xde7419){logger['info']('Searching\x20enduser\x20with\x20phone',_0xde7419);return request({'uri':util[_0xefd1('0xe')]('%s/api/v2/contacts',_0x4d2b99[_0xefd1('0x1a')]),'qs':{'phone':_0xde7419}})[_0xefd1('0x1c')](function(_0x28a0ba){if(_0x28a0ba[_0xefd1('0x21')]){logger[_0xefd1('0x1d')]('Enduser\x20found!');return _[_0xefd1('0x22')](_0x28a0ba,{'phone':_0xde7419});}else{logger[_0xefd1('0x1d')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xefd1('0xe')]('%s/api/v2/contacts',_0x4d2b99['remoteUri']),'method':'POST','body':{'name':_0x4dc9e6,'phone':_0xde7419}})[_0xefd1('0x1c')](function(_0x5dc8e6){logger[_0xefd1('0x1d')](_0xefd1('0x27'));return _0x5dc8e6;});}});}function getAuth(_0x2bb17e){return util[_0xefd1('0xe')]('Basic\x20%s',new Buffer(_0x2bb17e[_0xefd1('0x28')]+':X')[_0xefd1('0x29')](_0xefd1('0x2a')));}function request(_0xbd2252){logger[_0xefd1('0x2b')](_0xefd1('0x2c'),JSON[_0xefd1('0x2d')](_0xbd2252));return rp(_[_0xefd1('0x2e')](_0xbd2252,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x50268e,_0xa9a009){var _0x2ac306=[];if(_0x50268e&&_0x50268e[_0xefd1('0x21')]>0x0){_0x2ac306=_['map'](_0x50268e,_0xa9a009);}return _0x2ac306;}function getCustomFields(_0x2bc9a9,_0x5a4e1a){var _0xc904c6=[];var _0x5c4d02={'custom_fields':[]};if(_0x2bc9a9[_0xefd1('0x21')]>0x0){_[_0xefd1('0x2f')](_0x2bc9a9,function(_0x16e228){if(_0x16e228[_0xefd1('0x30')]==='string'&&_0x16e228['nameField']&&!_0x16e228[_0xefd1('0x31')]){_0x5c4d02[_0x16e228[_0xefd1('0x32')][_0xefd1('0x33')]()]=_0x16e228[_0xefd1('0x34')][_0xefd1('0x29')]();}else if(_0x16e228[_0xefd1('0x30')]===_0xefd1('0x35')&&_0x16e228[_0xefd1('0x36')]&&_0x16e228['customField']){_0x5c4d02[_0xefd1('0x37')]['push']({'id':_0x16e228[_0xefd1('0x36')],'value':_0x16e228['content'][_0xefd1('0x29')]()});}else if(_0x16e228[_0xefd1('0x30')]===_0xefd1('0x38')&&_0x16e228['variableName']&&_0x16e228['idField']&&_0x16e228[_0xefd1('0x31')]){_0x5a4e1a[_0x16e228['variableName']]&&_0x5c4d02[_0xefd1('0x37')][_0xefd1('0x39')]({'id':_0x16e228[_0xefd1('0x36')],'value':_0x5a4e1a[_0x16e228['variableName']][_0xefd1('0x29')]()});}else if(_0x16e228[_0xefd1('0x30')]===_0xefd1('0x3a')&&_0x16e228[_0xefd1('0x3b')]&&_0x16e228[_0xefd1('0x3b')][_0xefd1('0x16')]&&_0x16e228['idField']&&_0x16e228[_0xefd1('0x31')]){_0x5a4e1a[_0x16e228['Variable'][_0xefd1('0x16')][_0xefd1('0x33')]()]&&_0x5c4d02[_0xefd1('0x37')][_0xefd1('0x39')]({'id':_0x16e228[_0xefd1('0x36')],'value':_0x5a4e1a[_0x16e228[_0xefd1('0x3b')][_0xefd1('0x16')][_0xefd1('0x33')]()]['toString']()});}});}return _0x5c4d02;}exports['queue']=function(_0xc0d514,_0x3d53bc,_0x262520,_0x354414,_0x5adebc,_0x1ba469){var _0x49e8fe,_0x207467;_0x1ba469[_0xefd1('0x1a')]=intUtil['stripTrailingSlash'](_0x1ba469[_0xefd1('0x1a')]);_0x1ba469[_0xefd1('0x3c')]=intUtil[_0xefd1('0x3d')](_0x1ba469[_0xefd1('0x3c')]);if(_0x5adebc&&_0x5adebc[_0xefd1('0x3e')]){logger[_0xefd1('0x1d')]('[QUEUE]',_0xefd1('0x3f'));_0x3d53bc[_0xefd1('0x40')]=util[_0xefd1('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ba469['serverUrl'],_0x3d53bc['uniqueid'],md5(_0x3d53bc[_0xefd1('0x41')]));}else{_0x3d53bc[_0xefd1('0x40')]='';}headers[_0xefd1('0x42')]=getAuth(_0x1ba469);return getUser(_0x1ba469,_0x354414[_0xefd1('0x23')])[_0xefd1('0x1c')](function(_0x1e0fc2){_0x49e8fe=_0x1e0fc2;logger[_0xefd1('0x1d')](_0xefd1('0x43'),_0x49e8fe['id']);return getEndUser(_0x1ba469,_0x3d53bc[_0xefd1('0x10')],_0x3d53bc[_0xefd1('0x11')]);})['then'](function(_0x4d4e40){_0x207467=_0x4d4e40;logger[_0xefd1('0x1d')](_0xefd1('0x44'),_0x207467['id']);return getTicket(_0x1ba469,_0x49e8fe,_0x207467,_0x262520,_0x3d53bc);})[_0xefd1('0x1c')](function(_0xade300){if(_0xade300&&_0xade300['id']){logger[_0xefd1('0x1d')](_0xefd1('0x1e'));logger[_0xefd1('0x1d')](_0xefd1('0x45'),_0xade300['id']);logger['info'](_0xefd1('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xefd1('0xe')](_0xefd1('0x47'),_0x354414['name']),_0xefd1('0x48'),{'uri':util[_0xefd1('0xe')](_0xefd1('0x49'),_0x1ba469[_0xefd1('0x1a')],_0xade300['id'])});}})[_0xefd1('0x4a')](function(_0x307252){logger[_0xefd1('0x4b')](_0xefd1('0x46'),JSON['stringify'](_0x307252));});};exports[_0xefd1('0x4c')]=function(_0x8414ed,_0x364651,_0x3d33b7,_0x226bb3,_0x4161e4,_0x270c18,_0x594719){var _0x42b6c7,_0x3dc660;_0x270c18[_0xefd1('0x1a')]=intUtil['stripTrailingSlash'](_0x270c18[_0xefd1('0x1a')]);_0x270c18[_0xefd1('0x3c')]=intUtil[_0xefd1('0x3d')](_0x270c18[_0xefd1('0x3c')]);if(_0x594719&&_0x594719[_0xefd1('0x4d')]&&_0x594719[_0xefd1('0x4d')]!==_0xefd1('0x4e')){logger[_0xefd1('0x1d')]('[OUTBOUND]',_0xefd1('0x3f'));_0x364651[_0xefd1('0x40')]=util[_0xefd1('0xe')](_0xefd1('0x4f'),_0x270c18[_0xefd1('0x3c')],_0x364651['uniqueid'],md5(_0x364651['uniqueid']));}headers[_0xefd1('0x42')]=getAuth(_0x270c18);return getUser(_0x270c18,_0x226bb3['email'])[_0xefd1('0x1c')](function(_0x419d5b){_0x42b6c7=_0x419d5b;logger[_0xefd1('0x1d')](_0xefd1('0x43'),_0x42b6c7['id']);return getEndUser(_0x270c18,_0x364651[_0xefd1('0x50')],_0x364651[_0xefd1('0x51')]);})['then'](function(_0x427963){_0x3dc660=_0x427963;logger[_0xefd1('0x1d')](_0xefd1('0x44'),_0x3dc660['id']);return getTicket(_0x270c18,_0x42b6c7,_0x3dc660,_0x3d33b7,_0x364651);})[_0xefd1('0x1c')](function(_0x20868c){if(_0x20868c&&_0x20868c['id']){logger[_0xefd1('0x1d')]('Ticket\x20created!');logger[_0xefd1('0x1d')](_0xefd1('0x45'),_0x20868c['id']);logger[_0xefd1('0x1d')](_0xefd1('0x52'),_0xefd1('0x53'));emit(util['format'](_0xefd1('0x47'),_0x226bb3['name']),_0xefd1('0x48'),{'uri':util[_0xefd1('0xe')](_0xefd1('0x49'),_0x270c18['remoteUri'],_0x20868c['id'])});}})[_0xefd1('0x4a')](function(_0xacb4e1){logger[_0xefd1('0x4b')](_0xefd1('0x52'),JSON[_0xefd1('0x2d')](_0xacb4e1));});};exports[_0xefd1('0x54')]=function(_0x54d575,_0xfbaed6,_0x17b230,_0x206ae1,_0x3dcca2,_0x3069b2){var _0x12f8d5,_0xc2092f;_0x3069b2[_0xefd1('0x1a')]=intUtil['stripTrailingSlash'](_0x3069b2[_0xefd1('0x1a')]);_0x3069b2[_0xefd1('0x3c')]=intUtil[_0xefd1('0x3d')](_0x3069b2[_0xefd1('0x3c')]);if(_0x3dcca2&&_0x3dcca2[_0xefd1('0x3e')]){logger[_0xefd1('0x1d')]('['+_0xfbaed6[_0xefd1('0x55')]['toUpperCase']()+']',_0xefd1('0x3f'));_0xfbaed6[_0xefd1('0x40')]=util[_0xefd1('0xe')](_0xefd1('0x4f'),_0x3069b2[_0xefd1('0x3c')],_0xfbaed6[_0xefd1('0x41')],md5(_0xfbaed6[_0xefd1('0x41')]));}else{_0xfbaed6[_0xefd1('0x40')]='';}headers[_0xefd1('0x42')]=getAuth(_0x3069b2);return getUser(_0x3069b2,'')[_0xefd1('0x1c')](function(_0x40380d){_0x12f8d5=_0x40380d;logger[_0xefd1('0x1d')]('The\x20User\x20ID\x20is:',_0x12f8d5['id']);return getEndUser(_0x3069b2,_0xfbaed6[_0xefd1('0x10')],_0xfbaed6[_0xefd1('0x11')]);})[_0xefd1('0x1c')](function(_0x4b58a6){_0xc2092f=_0x4b58a6;logger[_0xefd1('0x1d')](_0xefd1('0x44'),_0xc2092f['id']);return getTicket(_0x3069b2,_0x12f8d5,_0xc2092f,_0x17b230,_0xfbaed6);})[_0xefd1('0x1c')](function(_0x4f68b1){if(_0x4f68b1){logger[_0xefd1('0x1d')](_0xefd1('0x1e'));logger[_0xefd1('0x1d')]('The\x20Ticket\x20ID\x20is:',_0x4f68b1['id']);}})[_0xefd1('0x4a')](function(_0x28eaf1){logger[_0xefd1('0x4b')]('['+_0xfbaed6['lastevent'][_0xefd1('0x56')]()+']',JSON['stringify'](_0x28eaf1));});}; \ No newline at end of file +var _0xf713=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','The\x20User\x20ID\x20is:','destcalleridname','trigger:browser:url','%s/helpdesk/tickets/%d','[OUTBOUND]','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','calleridname','Subjects','getString','Descriptions','Tags','name','Fields','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','type','customField','toLowerCase','string','idField','push','content','variable','variableName','customVariable','Variable'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xf713,0x122));var _0x3f71=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0xf713[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x3f71('0x0'));var rp=require(_0x3f71('0x1'));var md5=require(_0x3f71('0x2'));var util=require(_0x3f71('0x3'));var Redis=require(_0x3f71('0x4'));var intUtil=require('./util');var config=require(_0x3f71('0x5'));var logger=require('../../../../config/logger')(_0x3f71('0x6'));config[_0x3f71('0x7')]=_[_0x3f71('0x8')](config[_0x3f71('0x7')],{'host':_0x3f71('0x9'),'port':0x18eb});var io=require(_0x3f71('0xa'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x3f71('0xb')};function emit(_0x1d427c,_0xaf18d1,_0x451d03){io['to'](_0x1d427c)[_0x3f71('0xc')](_0xaf18d1,_0x451d03);}function getTicket(_0xca1003,_0x57f956,_0x11f4fd,_0x21a3e4,_0xf865f5){logger[_0x3f71('0xd')](_0x3f71('0xe'));var _0x419c33=_[_0x3f71('0xf')]({'responder_id':_0x57f956['id'],'requester_id':_0x11f4fd['id'],'name':util[_0x3f71('0x10')]('Caller\x20-\x20%s',_0xf865f5[_0x3f71('0x11')]),'phone':_0xf865f5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x21a3e4[_0x3f71('0x12')],_0xf865f5,'\x20'),'description':intUtil[_0x3f71('0x13')](_0x21a3e4[_0x3f71('0x14')],_0xf865f5,'
'),'tags':getTags(_0x21a3e4[_0x3f71('0x15')],_0x3f71('0x16'))},getCustomFields(_0x21a3e4[_0x3f71('0x17')],_0xf865f5));_0x419c33['custom_fields']=_['mapValues'](_[_0x3f71('0x18')](_0x419c33[_0x3f71('0x19')],'id'),_0x3f71('0x1a'));return request({'uri':util[_0x3f71('0x10')](_0x3f71('0x1b'),_0xca1003[_0x3f71('0x1c')]),'method':_0x3f71('0x1d'),'body':_0x419c33})[_0x3f71('0x1e')](function(_0x23a45b){logger[_0x3f71('0xd')](_0x3f71('0x1f'));return _0x23a45b;});}function getUser(_0x7b6cf2,_0x1d9219){if(intUtil[_0x3f71('0x20')](_0x1d9219)){return request({'uri':util[_0x3f71('0x10')](_0x3f71('0x21'),_0x7b6cf2['remoteUri']),'qs':{'email':_0x1d9219}})['then'](function(_0xb98ed1){if(_0xb98ed1[_0x3f71('0x22')]){logger[_0x3f71('0xd')]('Agent\x20found!');return _['find'](_0xb98ed1,function(_0x1c5c47){return _0x1c5c47[_0x3f71('0x23')]['email']===_0x1d9219;});}else{logger[_0x3f71('0xd')](_0x3f71('0x24'));return request({'uri':util[_0x3f71('0x10')]('%s/api/v2/agents/me',_0x7b6cf2[_0x3f71('0x1c')])})[_0x3f71('0x1e')](function(_0x223170){logger[_0x3f71('0xd')]('Admin\x20account\x20selected.');return _0x223170;});}});}else{logger['info'](_0x3f71('0x25'));return request({'uri':util[_0x3f71('0x10')](_0x3f71('0x26'),_0x7b6cf2[_0x3f71('0x1c')])})[_0x3f71('0x1e')](function(_0x2dd860){logger[_0x3f71('0xd')](_0x3f71('0x27'));return _0x2dd860;});}}function getEndUser(_0x46fb02,_0x307239,_0x361aec){logger[_0x3f71('0xd')](_0x3f71('0x28'),_0x361aec);return request({'uri':util['format'](_0x3f71('0x29'),_0x46fb02[_0x3f71('0x1c')]),'qs':{'phone':_0x361aec}})[_0x3f71('0x1e')](function(_0x1e24d4){if(_0x1e24d4['length']){logger[_0x3f71('0xd')](_0x3f71('0x2a'));return _[_0x3f71('0x2b')](_0x1e24d4,{'phone':_0x361aec});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3f71('0x10')](_0x3f71('0x29'),_0x46fb02['remoteUri']),'method':_0x3f71('0x1d'),'body':{'name':_0x307239,'phone':_0x361aec}})[_0x3f71('0x1e')](function(_0x3c13b2){logger['info'](_0x3f71('0x2c'));return _0x3c13b2;});}});}function getAuth(_0x1e5087){return util[_0x3f71('0x10')](_0x3f71('0x2d'),new Buffer(_0x1e5087[_0x3f71('0x2e')]+':X')[_0x3f71('0x2f')]('base64'));}function request(_0x370440){logger[_0x3f71('0x30')](_0x3f71('0x31'),JSON[_0x3f71('0x32')](_0x370440));return rp(_[_0x3f71('0x8')](_0x370440,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x18f81f,_0xa7f651){var _0x37a360=[];if(_0x18f81f&&_0x18f81f[_0x3f71('0x22')]>0x0){_0x37a360=_['map'](_0x18f81f,_0xa7f651);}return _0x37a360;}function getCustomFields(_0x227106,_0x3fa635){var _0x334a6f=[];var _0x36b125={'custom_fields':[]};if(_0x227106[_0x3f71('0x22')]>0x0){_['forEach'](_0x227106,function(_0x5f3364){if(_0x5f3364[_0x3f71('0x33')]==='string'&&_0x5f3364['nameField']&&!_0x5f3364[_0x3f71('0x34')]){_0x36b125[_0x5f3364['nameField'][_0x3f71('0x35')]()]=_0x5f3364['content']['toString']();}else if(_0x5f3364[_0x3f71('0x33')]===_0x3f71('0x36')&&_0x5f3364[_0x3f71('0x37')]&&_0x5f3364[_0x3f71('0x34')]){_0x36b125[_0x3f71('0x19')][_0x3f71('0x38')]({'id':_0x5f3364['idField'],'value':_0x5f3364[_0x3f71('0x39')][_0x3f71('0x2f')]()});}else if(_0x5f3364[_0x3f71('0x33')]===_0x3f71('0x3a')&&_0x5f3364['variableName']&&_0x5f3364[_0x3f71('0x37')]&&_0x5f3364['customField']){_0x3fa635[_0x5f3364[_0x3f71('0x3b')]]&&_0x36b125[_0x3f71('0x19')]['push']({'id':_0x5f3364[_0x3f71('0x37')],'value':_0x3fa635[_0x5f3364['variableName']][_0x3f71('0x2f')]()});}else if(_0x5f3364['type']===_0x3f71('0x3c')&&_0x5f3364['Variable']&&_0x5f3364[_0x3f71('0x3d')]['name']&&_0x5f3364[_0x3f71('0x37')]&&_0x5f3364[_0x3f71('0x34')]){_0x3fa635[_0x5f3364['Variable'][_0x3f71('0x16')][_0x3f71('0x35')]()]&&_0x36b125['custom_fields'][_0x3f71('0x38')]({'id':_0x5f3364[_0x3f71('0x37')],'value':_0x3fa635[_0x5f3364[_0x3f71('0x3d')]['name'][_0x3f71('0x35')]()][_0x3f71('0x2f')]()});}});}return _0x36b125;}exports['queue']=function(_0x500add,_0x58bb58,_0x2422d1,_0x4b0881,_0x39aab9,_0x445f8f){var _0x2e33ed,_0x1b2487;_0x445f8f[_0x3f71('0x1c')]=intUtil[_0x3f71('0x3e')](_0x445f8f['remoteUri']);_0x445f8f['serverUrl']=intUtil['stripTrailingSlash'](_0x445f8f[_0x3f71('0x3f')]);if(_0x39aab9&&_0x39aab9[_0x3f71('0x40')]){logger['info'](_0x3f71('0x41'),_0x3f71('0x42'));_0x58bb58[_0x3f71('0x43')]=util[_0x3f71('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x445f8f[_0x3f71('0x3f')],_0x58bb58[_0x3f71('0x44')],md5(_0x58bb58['uniqueid']));}else{_0x58bb58[_0x3f71('0x43')]='';}headers[_0x3f71('0x45')]=getAuth(_0x445f8f);return getUser(_0x445f8f,_0x4b0881['email'])['then'](function(_0x304199){_0x2e33ed=_0x304199;logger['info']('The\x20User\x20ID\x20is:',_0x2e33ed['id']);return getEndUser(_0x445f8f,_0x58bb58[_0x3f71('0x11')],_0x58bb58['calleridnum']);})[_0x3f71('0x1e')](function(_0x78a09a){_0x1b2487=_0x78a09a;logger[_0x3f71('0xd')](_0x3f71('0x46'),_0x1b2487['id']);return getTicket(_0x445f8f,_0x2e33ed,_0x1b2487,_0x2422d1,_0x58bb58);})[_0x3f71('0x1e')](function(_0x227076){if(_0x227076&&_0x227076['id']){logger[_0x3f71('0xd')]('Ticket\x20created!');logger[_0x3f71('0xd')](_0x3f71('0x47'),_0x227076['id']);logger['info'](_0x3f71('0x41'),_0x3f71('0x48'));emit(util[_0x3f71('0x10')](_0x3f71('0x49'),_0x4b0881[_0x3f71('0x16')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x445f8f[_0x3f71('0x1c')],_0x227076['id'])});}})[_0x3f71('0x4a')](function(_0x3157c3){logger[_0x3f71('0x4b')](_0x3f71('0x41'),JSON[_0x3f71('0x32')](_0x3157c3));});};exports[_0x3f71('0x4c')]=function(_0x3b574e,_0x5b79a0,_0x7f09ae,_0x254af6,_0x24f645,_0xb48939,_0x311814){var _0x4d7a82,_0x25bc5a;_0xb48939[_0x3f71('0x1c')]=intUtil[_0x3f71('0x3e')](_0xb48939[_0x3f71('0x1c')]);_0xb48939['serverUrl']=intUtil['stripTrailingSlash'](_0xb48939[_0x3f71('0x3f')]);if(_0x311814&&_0x311814[_0x3f71('0x4d')]&&_0x311814[_0x3f71('0x4d')]!=='none'){logger[_0x3f71('0xd')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5b79a0[_0x3f71('0x43')]=util[_0x3f71('0x10')](_0x3f71('0x4e'),_0xb48939[_0x3f71('0x3f')],_0x5b79a0[_0x3f71('0x44')],md5(_0x5b79a0[_0x3f71('0x44')]));}headers['Authorization']=getAuth(_0xb48939);return getUser(_0xb48939,_0x254af6[_0x3f71('0x4f')])['then'](function(_0x2a9f53){_0x4d7a82=_0x2a9f53;logger[_0x3f71('0xd')](_0x3f71('0x50'),_0x4d7a82['id']);return getEndUser(_0xb48939,_0x5b79a0[_0x3f71('0x51')],_0x5b79a0['destcalleridnum']);})['then'](function(_0x3fa75d){_0x25bc5a=_0x3fa75d;logger['info'](_0x3f71('0x46'),_0x25bc5a['id']);return getTicket(_0xb48939,_0x4d7a82,_0x25bc5a,_0x7f09ae,_0x5b79a0);})[_0x3f71('0x1e')](function(_0x48e066){if(_0x48e066&&_0x48e066['id']){logger[_0x3f71('0xd')](_0x3f71('0x1f'));logger[_0x3f71('0xd')](_0x3f71('0x47'),_0x48e066['id']);logger[_0x3f71('0xd')]('[OUTBOUND]',_0x3f71('0x48'));emit(util[_0x3f71('0x10')]('user:%s',_0x254af6[_0x3f71('0x16')]),_0x3f71('0x52'),{'uri':util['format'](_0x3f71('0x53'),_0xb48939['remoteUri'],_0x48e066['id'])});}})['catch'](function(_0x5a8d04){logger[_0x3f71('0x4b')](_0x3f71('0x54'),JSON[_0x3f71('0x32')](_0x5a8d04));});};exports[_0x3f71('0x55')]=function(_0x3038ee,_0x2c42cf,_0x1dc84a,_0x3f77e6,_0x270aa1,_0x33f00c){var _0x338b18,_0x238f7e;_0x33f00c[_0x3f71('0x1c')]=intUtil[_0x3f71('0x3e')](_0x33f00c[_0x3f71('0x1c')]);_0x33f00c['serverUrl']=intUtil[_0x3f71('0x3e')](_0x33f00c['serverUrl']);if(_0x270aa1&&_0x270aa1['monitor_format']){logger['info']('['+_0x2c42cf[_0x3f71('0x56')][_0x3f71('0x57')]()+']',_0x3f71('0x42'));_0x2c42cf[_0x3f71('0x43')]=util[_0x3f71('0x10')](_0x3f71('0x4e'),_0x33f00c[_0x3f71('0x3f')],_0x2c42cf[_0x3f71('0x44')],md5(_0x2c42cf[_0x3f71('0x44')]));}else{_0x2c42cf[_0x3f71('0x43')]='';}headers[_0x3f71('0x45')]=getAuth(_0x33f00c);return getUser(_0x33f00c,'')['then'](function(_0x1ac88){_0x338b18=_0x1ac88;logger[_0x3f71('0xd')]('The\x20User\x20ID\x20is:',_0x338b18['id']);return getEndUser(_0x33f00c,_0x2c42cf[_0x3f71('0x11')],_0x2c42cf['calleridnum']);})[_0x3f71('0x1e')](function(_0x17e8e0){_0x238f7e=_0x17e8e0;logger[_0x3f71('0xd')](_0x3f71('0x46'),_0x238f7e['id']);return getTicket(_0x33f00c,_0x338b18,_0x238f7e,_0x1dc84a,_0x2c42cf);})[_0x3f71('0x1e')](function(_0xa99390){if(_0xa99390){logger[_0x3f71('0xd')](_0x3f71('0x1f'));logger[_0x3f71('0xd')]('The\x20Ticket\x20ID\x20is:',_0xa99390['id']);}})[_0x3f71('0x4a')](function(_0x453bea){logger[_0x3f71('0x4b')]('['+_0x2c42cf['lastevent']['toUpperCase']()+']',JSON[_0x3f71('0x32')](_0x453bea));});}; \ 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 91a1c2d..5d84fdd 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 _0xa40d=['bluebird','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','catch','/api/contacts/filters','then','filters','name','Getting\x20contact\x20list','contacts','find','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','Descriptions','Contact','add','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','format','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util'];(function(_0x268186,_0x4dc3e4){var _0x3c3d1a=function(_0x53055d){while(--_0x53055d){_0x268186['push'](_0x268186['shift']());}};_0x3c3d1a(++_0x4dc3e4);}(_0xa40d,0x140));var _0xda40=function(_0x1cfda3,_0x32e81){_0x1cfda3=_0x1cfda3-0x0;var _0x45a82f=_0xa40d[_0x1cfda3];return _0x45a82f;};'use strict';var _=require(_0xda40('0x0'));var rp=require(_0xda40('0x1'));var md5=require(_0xda40('0x2'));var util=require(_0xda40('0x3'));var moment=require('moment');var Promise=require(_0xda40('0x4'));var Redis=require(_0xda40('0x5'));var intUtil=require('./util');var config=require(_0xda40('0x6'));var logger=require(_0xda40('0x7'))('freshsales');config[_0xda40('0x8')]=_[_0xda40('0x9')](config[_0xda40('0x8')],{'host':_0xda40('0xa'),'port':0x18eb});var io=require(_0xda40('0xb'))(new Redis(config[_0xda40('0x8')]));function getAdminId(_0x38bfbc,_0x35b8bd,_0x145818,_0x3e92cb){return new Promise(function(_0x3ec55c,_0x87c09f){var _0x57e818=![];var _0x828ace={'method':_0xda40('0xc'),'uri':_0x3e92cb+_0xda40('0xd'),'json':!![]};_0x828ace[_0xda40('0xe')]=_0x145818;logger[_0xda40('0xf')](_0xda40('0x10'));return rp(_0x828ace)['then'](function(_0x2c5f8f){if(_0x2c5f8f){var _0x141612=_0x2c5f8f[_0xda40('0x11')];var _0x4816ee=null;for(_0x4816ee=0x0;_0x4816ee<_0x141612[_0xda40('0x12')];_0x4816ee++){if(_0x141612[_0x4816ee][_0xda40('0x13')]===_0x38bfbc[_0xda40('0x14')]){_0x38bfbc['adminId']=_0x141612[_0x4816ee]['id'];_0x57e818=!![];}}if(_0x57e818){logger[_0xda40('0xf')]('Admin\x20found:',_0x38bfbc[_0xda40('0x15')]);_0x3ec55c(_0x38bfbc);}else{_0x87c09f({'statusCode':0x194,'message':_0xda40('0x16')});}}else{_0x87c09f({'statusCode':0x194,'message':_0xda40('0x16')});}})['catch'](function(_0x3343ab){logger[_0xda40('0x17')]('['+[_0x35b8bd[_0xda40('0x18')]()]+']',_0x3343ab[_0xda40('0x19')]);_0x87c09f(_0x3343ab);});});}function getUser(_0x21e411,_0x382644,_0x57fe67){return function(_0x4faedc){return new Promise(function(_0x360284,_0x3db47f){var _0x188dc8={'method':_0xda40('0xc'),'uri':_0x57fe67+_0xda40('0xd'),'json':!![]};_0x188dc8[_0xda40('0xe')]=_0x382644;logger[_0xda40('0xf')](_0xda40('0x1a'));return rp(_0x188dc8)['then'](function(_0x289bd5){if(_0x289bd5){var _0x50eed8=_0x289bd5[_0xda40('0x11')];var _0x207410=![];var _0x1af179=null;if(_0x4faedc[_0xda40('0x1b')]!==null){logger[_0xda40('0xf')]('Getting\x20user\x20with\x20email',_0x4faedc[_0xda40('0x1b')]);_0x4faedc[_0xda40('0x1c')]=_0x4faedc[_0xda40('0x1b')];for(_0x1af179=0x0;_0x1af179<_0x50eed8['length'];_0x1af179++){if(_0x50eed8[_0x1af179][_0xda40('0x13')]===_0x4faedc[_0xda40('0x1b')]){_0x207410=!![];_0x4faedc[_0xda40('0x1d')]=_0x50eed8[_0x1af179]['id'];logger[_0xda40('0xf')](_0xda40('0x1e'),_0x4faedc[_0xda40('0x1d')]);}}}if(!_0x207410){logger[_0xda40('0xf')]('Admin\x20selected');_0x4faedc[_0xda40('0x1c')]=_0x4faedc[_0xda40('0x14')];_0x4faedc[_0xda40('0x1d')]=_0x4faedc['adminId'];_0x207410=!![];}if(_0x207410){_0x360284(_0x4faedc);}else{_0x3db47f({'statusCode':0x194,'message':_0xda40('0x16')});}}else{_0x3db47f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xda40('0x1f')](function(_0x30f1bc){logger[_0xda40('0x17')]('['+[_0x21e411['toUpperCase']()]+']',_0x30f1bc[_0xda40('0x19')]);_0x3db47f(_0x30f1bc);});});};}function getEndUser(_0x5820ce,_0x1ec044,_0x58d830){return function(_0x48869c){return new Promise(function(_0x340b82,_0x4ae972){var _0x3d6ad1=0x0;var _0x46943={'method':_0xda40('0xc'),'uri':_0x58d830+_0xda40('0x20'),'json':!![]};_0x46943[_0xda40('0xe')]=_0x1ec044;logger[_0xda40('0xf')]('Getting\x20contacts\x20filter');return rp(_0x46943)[_0xda40('0x21')](function(_0x565408){_0x565408[_0xda40('0x22')]['forEach'](function(_0x687718){if(_0x687718[_0xda40('0x23')]==='All\x20Contacts'){_0x3d6ad1=_0x687718['id'];}});})['then'](function(){logger[_0xda40('0xf')](_0xda40('0x24'));var _0x5507c6={'method':_0xda40('0xc'),'uri':_0x58d830+'/api/contacts/view/'+_0x3d6ad1,'json':!![]};_0x5507c6[_0xda40('0xe')]=_0x1ec044;return rp(_0x5507c6);})[_0xda40('0x21')](function(_0x4081c2){logger[_0xda40('0xf')]('Searching\x20contact\x20with\x20phone',_0x48869c['contactNumber']);if(_0x4081c2[_0xda40('0x25')]['length']>0x0){var _0x524bc6=_[_0xda40('0x26')](_0x4081c2[_0xda40('0x25')],function(_0x3a0a7a){if(_0x3a0a7a['work_number']===_0x48869c[_0xda40('0x27')]||_0x3a0a7a[_0xda40('0x28')]===_0x48869c[_0xda40('0x27')]){return _0x3a0a7a;}});if(_0x524bc6){_0x48869c[_0xda40('0x29')]=_0x524bc6['id'];logger[_0xda40('0xf')]('Contact\x20found:',_0x48869c[_0xda40('0x29')]);_0x340b82(_0x48869c);}else{return createEndUser(_0x48869c,_0x5820ce,_0x1ec044,_0x58d830)['then'](function(_0x418c9e){logger['info'](_0xda40('0x2a'),_0x48869c[_0xda40('0x29')]);_0x340b82(_0x418c9e);});}}else{return createEndUser(_0x48869c,_0x5820ce,_0x1ec044,_0x58d830)[_0xda40('0x21')](function(_0x3426ac){logger[_0xda40('0xf')](_0xda40('0x2a'),_0x48869c[_0xda40('0x29')]);_0x340b82(_0x3426ac);});}})[_0xda40('0x1f')](function(_0x3df63d){throw new Error(_0x3df63d[_0xda40('0x19')]);});});};}function createEndUser(_0x5bca37,_0x54a969,_0x162821,_0x28d55e){return new Promise(function(_0x1de837,_0x512e91){var _0x13be15=moment();var _0xf092c={'method':_0xda40('0x2b'),'uri':_0x28d55e+_0xda40('0x2c'),'body':{'contact':{'last_name':_0x5bca37[_0xda40('0x27')],'work_number':_0x5bca37[_0xda40('0x27')],'mobile_number':_0x5bca37[_0xda40('0x27')],'owner_id':_0x5bca37[_0xda40('0x1d')],'created_at':_0x13be15['format'](_0xda40('0x2d'))}},'json':!![]};_0xf092c[_0xda40('0xe')]=_0x162821;logger[_0xda40('0xf')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0xf092c)[_0xda40('0x21')](function(_0x579b21){_0x5bca37[_0xda40('0x29')]=_0x579b21[_0xda40('0x2e')]['id'];_0x1de837(_0x5bca37);})[_0xda40('0x1f')](function(_0x8fd477){logger['error']('['+[_0x54a969[_0xda40('0x18')]()]+']',_0x8fd477[_0xda40('0x19')]);_0x512e91(_0x8fd477[_0xda40('0x19')]);});});}function getTicket(_0x41e244,_0x18ebd4,_0x13119e,_0xf049d3,_0x5d1675){return function(_0x492502){logger[_0xda40('0xf')](_0xda40('0x2f'));return new Promise(function(_0x43752a,_0x421b4f){var _0xfa0414=moment();var _0x35e765={'method':'POST','uri':_0x13119e+'/api/tasks','body':{'title':intUtil[_0xda40('0x30')](_0xf049d3[_0xda40('0x31')],_0x5d1675,'\x20'),'description':intUtil['getString'](_0xf049d3[_0xda40('0x32')],_0x5d1675,'\x0a'),'owner_id':_0x492502[_0xda40('0x1d')],'creater_id':_0x492502[_0xda40('0x15')],'targetable_id':_0x492502['endUserId'],'targetable_type':_0xda40('0x33'),'created_at':_0xfa0414['format'](_0xda40('0x2d')),'due_date':_0xfa0414[_0xda40('0x34')](0x1e,'m')['format'](_0xda40('0x2d'))},'json':!![]};_0x35e765['headers']=_0x18ebd4;return rp(_0x35e765)[_0xda40('0x21')](function(_0x78e68a){_0x492502[_0xda40('0x35')]=_0x78e68a[_0xda40('0x36')]['id'];logger[_0xda40('0xf')]('Task\x20created:',_0x492502[_0xda40('0x35')]);_0x43752a(_0x492502);})[_0xda40('0x1f')](function(_0x52bf0f){logger[_0xda40('0x17')]('['+[_0x41e244[_0xda40('0x18')]()]+']',_0x52bf0f[_0xda40('0x19')]);_0x421b4f(_0x52bf0f['message']);});});};}function emit(_0x4f10d5,_0x437558,_0x4a13b4){var _0x1b4241={'uri':_0x4f10d5+_0xda40('0x37')+_0x4a13b4};io['to'](util['format']('user:%s',_0x437558))[_0xda40('0x38')](_0xda40('0x39'),_0x1b4241);}exports['cs']=function(_0x569639,_0x39ce17,_0x3e9215,_0x3a800a,_0x493c48,_0x536430,_0x2c183d,_0x32863f){var _0xb46739={};var _0xdc746b={'Authorization':_0xda40('0x3a')+_0x536430[_0xda40('0x3b')]};_0x536430[_0xda40('0x3c')]=intUtil['stripTrailingSlash'](_0x536430[_0xda40('0x3c')]);_0x536430[_0xda40('0x3d')]=intUtil[_0xda40('0x3e')](_0x536430[_0xda40('0x3d')]);var _0x560d7e=_0x536430[_0xda40('0x3c')];_0xb46739[_0xda40('0x14')]=_0x536430['username'];_0xb46739['contactNumber']=_0x32863f[_0xda40('0x3f')]()===_0xda40('0x40')?_0x39ce17[_0xda40('0x41')]:_0x39ce17[_0xda40('0x42')];_0xb46739[_0xda40('0x43')]=_0x32863f===_0xda40('0x44')||_0x32863f==='unmanaged'?'queue':_0xda40('0x40');if(_0x3a800a){_0xb46739[_0xda40('0x1b')]=_0x3a800a[_0xda40('0x13')];}var _0x269b7e=util[_0xda40('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x536430[_0xda40('0x3d')],_0x39ce17[_0xda40('0x46')],md5(_0x39ce17[_0xda40('0x46')]));if(_0x493c48&&_0x493c48[_0xda40('0x47')]){logger[_0xda40('0xf')]('[QUEUE]',_0xda40('0x48'));_0x39ce17[_0xda40('0x49')]=_0x269b7e;}else if(_0x2c183d&&_0x2c183d[_0xda40('0x4a')]&&_0x2c183d[_0xda40('0x4a')]!==_0xda40('0x4b')){logger[_0xda40('0xf')](_0xda40('0x4c'),_0xda40('0x48'));_0x39ce17['recordingURL']=_0x269b7e;}else{_0x39ce17[_0xda40('0x49')]='';}return getAdminId(_0xb46739,_0x32863f,_0xdc746b,_0x560d7e)['then'](getUser(_0x32863f,_0xdc746b,_0x560d7e))[_0xda40('0x21')](getEndUser(_0x32863f,_0xdc746b,_0x560d7e))['then'](getTicket(_0x32863f,_0xdc746b,_0x560d7e,_0x3e9215,_0x39ce17))['then'](function(_0x1721b5){logger[_0xda40('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x1721b5[_0xda40('0x35')]));if(_0x32863f!==_0xda40('0x4d')){logger['info']('['+[_0x32863f['toUpperCase']()]+']',_0xda40('0x4e'));emit(_0x560d7e,_0x3a800a[_0xda40('0x23')],_0x1721b5[_0xda40('0x29')]);}})['catch'](function(_0x59a9d0){logger['error']('['+[_0x32863f[_0xda40('0x18')]()]+_0xda40('0x4f'),util[_0xda40('0x50')](_0x59a9d0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9e65=['contactNumber','contacts','find','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','Contact','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','freshsales','redis','defaults','localhost','socket.io-emitter','GET','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','/api/selector/owners','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','error','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','/api/contacts/view/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e65,0x7e));var _0x59e6=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x9e65[_0x12aba8];return _0x2aac66;};'use strict';var _=require(_0x59e6('0x0'));var rp=require(_0x59e6('0x1'));var md5=require(_0x59e6('0x2'));var util=require(_0x59e6('0x3'));var moment=require(_0x59e6('0x4'));var Promise=require(_0x59e6('0x5'));var Redis=require(_0x59e6('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x59e6('0x7'));config[_0x59e6('0x8')]=_[_0x59e6('0x9')](config[_0x59e6('0x8')],{'host':_0x59e6('0xa'),'port':0x18eb});var io=require(_0x59e6('0xb'))(new Redis(config['redis']));function getAdminId(_0x5b2a9d,_0x4e5c9a,_0x546d79,_0x388d4c){return new Promise(function(_0x3ce6fd,_0x1ecbfb){var _0x3c70dd=![];var _0x4d61a7={'method':_0x59e6('0xc'),'uri':_0x388d4c+'/api/selector/owners','json':!![]};_0x4d61a7[_0x59e6('0xd')]=_0x546d79;logger[_0x59e6('0xe')]('Getting\x20admin\x20information');return rp(_0x4d61a7)[_0x59e6('0xf')](function(_0xdd427d){if(_0xdd427d){var _0xed4a6a=_0xdd427d[_0x59e6('0x10')];var _0x6ccc58=null;for(_0x6ccc58=0x0;_0x6ccc58<_0xed4a6a[_0x59e6('0x11')];_0x6ccc58++){if(_0xed4a6a[_0x6ccc58][_0x59e6('0x12')]===_0x5b2a9d[_0x59e6('0x13')]){_0x5b2a9d[_0x59e6('0x14')]=_0xed4a6a[_0x6ccc58]['id'];_0x3c70dd=!![];}}if(_0x3c70dd){logger[_0x59e6('0xe')](_0x59e6('0x15'),_0x5b2a9d['adminId']);_0x3ce6fd(_0x5b2a9d);}else{_0x1ecbfb({'statusCode':0x194,'message':_0x59e6('0x16')});}}else{_0x1ecbfb({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x59e6('0x17')](function(_0x249307){logger['error']('['+[_0x4e5c9a[_0x59e6('0x18')]()]+']',_0x249307[_0x59e6('0x19')]);_0x1ecbfb(_0x249307);});});}function getUser(_0x255672,_0x296dd4,_0x532fbb){return function(_0x364d2d){return new Promise(function(_0x259c25,_0x5db584){var _0x4e3120={'method':_0x59e6('0xc'),'uri':_0x532fbb+_0x59e6('0x1a'),'json':!![]};_0x4e3120['headers']=_0x296dd4;logger[_0x59e6('0xe')]('Getting\x20user\x20list');return rp(_0x4e3120)[_0x59e6('0xf')](function(_0x55be4e){if(_0x55be4e){var _0x33c6e2=_0x55be4e[_0x59e6('0x10')];var _0x6c5bca=![];var _0x2c3ac2=null;if(_0x364d2d[_0x59e6('0x1b')]!==null){logger[_0x59e6('0xe')](_0x59e6('0x1c'),_0x364d2d[_0x59e6('0x1b')]);_0x364d2d[_0x59e6('0x1d')]=_0x364d2d['agentEmail'];for(_0x2c3ac2=0x0;_0x2c3ac2<_0x33c6e2['length'];_0x2c3ac2++){if(_0x33c6e2[_0x2c3ac2][_0x59e6('0x12')]===_0x364d2d[_0x59e6('0x1b')]){_0x6c5bca=!![];_0x364d2d['userId']=_0x33c6e2[_0x2c3ac2]['id'];logger[_0x59e6('0xe')](_0x59e6('0x1e'),_0x364d2d[_0x59e6('0x1f')]);}}}if(!_0x6c5bca){logger['info'](_0x59e6('0x20'));_0x364d2d[_0x59e6('0x1d')]=_0x364d2d[_0x59e6('0x13')];_0x364d2d[_0x59e6('0x1f')]=_0x364d2d['adminId'];_0x6c5bca=!![];}if(_0x6c5bca){_0x259c25(_0x364d2d);}else{_0x5db584({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5db584({'statusCode':0x194,'message':_0x59e6('0x16')});}})['catch'](function(_0x39dcc6){logger[_0x59e6('0x21')]('['+[_0x255672[_0x59e6('0x18')]()]+']',_0x39dcc6[_0x59e6('0x19')]);_0x5db584(_0x39dcc6);});});};}function getEndUser(_0x1d902b,_0x28ac32,_0x1ed94f){return function(_0x51c3f0){return new Promise(function(_0x116acd,_0x2bbcc0){var _0x362cde=0x0;var _0xcede78={'method':'GET','uri':_0x1ed94f+'/api/contacts/filters','json':!![]};_0xcede78[_0x59e6('0xd')]=_0x28ac32;logger[_0x59e6('0xe')](_0x59e6('0x22'));return rp(_0xcede78)['then'](function(_0x36f0e7){_0x36f0e7[_0x59e6('0x23')][_0x59e6('0x24')](function(_0xa01d87){if(_0xa01d87[_0x59e6('0x25')]===_0x59e6('0x26')){_0x362cde=_0xa01d87['id'];}});})[_0x59e6('0xf')](function(){logger[_0x59e6('0xe')]('Getting\x20contact\x20list');var _0x33b2fd={'method':_0x59e6('0xc'),'uri':_0x1ed94f+_0x59e6('0x27')+_0x362cde,'json':!![]};_0x33b2fd[_0x59e6('0xd')]=_0x28ac32;return rp(_0x33b2fd);})[_0x59e6('0xf')](function(_0x5cda1d){logger[_0x59e6('0xe')]('Searching\x20contact\x20with\x20phone',_0x51c3f0[_0x59e6('0x28')]);if(_0x5cda1d[_0x59e6('0x29')]['length']>0x0){var _0x10d4fd=_[_0x59e6('0x2a')](_0x5cda1d[_0x59e6('0x29')],function(_0x470b95){if(_0x470b95['work_number']===_0x51c3f0[_0x59e6('0x28')]||_0x470b95[_0x59e6('0x2b')]===_0x51c3f0[_0x59e6('0x28')]){return _0x470b95;}});if(_0x10d4fd){_0x51c3f0[_0x59e6('0x2c')]=_0x10d4fd['id'];logger['info'](_0x59e6('0x2d'),_0x51c3f0[_0x59e6('0x2c')]);_0x116acd(_0x51c3f0);}else{return createEndUser(_0x51c3f0,_0x1d902b,_0x28ac32,_0x1ed94f)['then'](function(_0x2031e8){logger[_0x59e6('0xe')]('Contact\x20created:',_0x51c3f0['endUserId']);_0x116acd(_0x2031e8);});}}else{return createEndUser(_0x51c3f0,_0x1d902b,_0x28ac32,_0x1ed94f)['then'](function(_0x2b17a5){logger[_0x59e6('0xe')](_0x59e6('0x2e'),_0x51c3f0[_0x59e6('0x2c')]);_0x116acd(_0x2b17a5);});}})['catch'](function(_0x2a5af0){throw new Error(_0x2a5af0['message']);});});};}function createEndUser(_0x6b99d8,_0x45f175,_0x5eedb5,_0x48bde7){return new Promise(function(_0x2cf151,_0x4f0a86){var _0x262846=moment();var _0x4e3f64={'method':'POST','uri':_0x48bde7+_0x59e6('0x2f'),'body':{'contact':{'last_name':_0x6b99d8[_0x59e6('0x28')],'work_number':_0x6b99d8[_0x59e6('0x28')],'mobile_number':_0x6b99d8[_0x59e6('0x28')],'owner_id':_0x6b99d8['userId'],'created_at':_0x262846[_0x59e6('0x30')](_0x59e6('0x31'))}},'json':!![]};_0x4e3f64['headers']=_0x5eedb5;logger[_0x59e6('0xe')](_0x59e6('0x32'));return rp(_0x4e3f64)[_0x59e6('0xf')](function(_0x42f247){_0x6b99d8[_0x59e6('0x2c')]=_0x42f247[_0x59e6('0x33')]['id'];_0x2cf151(_0x6b99d8);})['catch'](function(_0x416fd6){logger[_0x59e6('0x21')]('['+[_0x45f175[_0x59e6('0x18')]()]+']',_0x416fd6[_0x59e6('0x19')]);_0x4f0a86(_0x416fd6[_0x59e6('0x19')]);});});}function getTicket(_0x22b5b0,_0x5b5366,_0x1d46a3,_0x4c148d,_0x3c395d){return function(_0x16b174){logger[_0x59e6('0xe')](_0x59e6('0x34'));return new Promise(function(_0x58ba2e,_0x4ef83b){var _0x293a7a=moment();var _0x12f321={'method':_0x59e6('0x35'),'uri':_0x1d46a3+_0x59e6('0x36'),'body':{'title':intUtil[_0x59e6('0x37')](_0x4c148d['Subjects'],_0x3c395d,'\x20'),'description':intUtil['getString'](_0x4c148d[_0x59e6('0x38')],_0x3c395d,'\x0a'),'owner_id':_0x16b174[_0x59e6('0x1f')],'creater_id':_0x16b174[_0x59e6('0x14')],'targetable_id':_0x16b174['endUserId'],'targetable_type':_0x59e6('0x39'),'created_at':_0x293a7a[_0x59e6('0x30')](_0x59e6('0x31')),'due_date':_0x293a7a[_0x59e6('0x3a')](0x1e,'m')[_0x59e6('0x30')](_0x59e6('0x31'))},'json':!![]};_0x12f321[_0x59e6('0xd')]=_0x5b5366;return rp(_0x12f321)[_0x59e6('0xf')](function(_0x52eca0){_0x16b174[_0x59e6('0x3b')]=_0x52eca0['task']['id'];logger[_0x59e6('0xe')](_0x59e6('0x3c'),_0x16b174[_0x59e6('0x3b')]);_0x58ba2e(_0x16b174);})[_0x59e6('0x17')](function(_0x1809e4){logger[_0x59e6('0x21')]('['+[_0x22b5b0[_0x59e6('0x18')]()]+']',_0x1809e4[_0x59e6('0x19')]);_0x4ef83b(_0x1809e4['message']);});});};}function emit(_0x2150f8,_0x34ca4a,_0x2f448d){var _0x48d7f1={'uri':_0x2150f8+_0x59e6('0x3d')+_0x2f448d};io['to'](util[_0x59e6('0x30')](_0x59e6('0x3e'),_0x34ca4a))[_0x59e6('0x3f')]('trigger:browser:url',_0x48d7f1);}exports['cs']=function(_0x411ea1,_0x3f2cd6,_0x507c31,_0x2bb167,_0x212a5d,_0x108a40,_0x438df8,_0x5ae07e){var _0x4dabdb={};var _0x2af44b={'Authorization':'Token\x20token='+_0x108a40[_0x59e6('0x40')]};_0x108a40[_0x59e6('0x41')]=intUtil[_0x59e6('0x42')](_0x108a40[_0x59e6('0x41')]);_0x108a40[_0x59e6('0x43')]=intUtil[_0x59e6('0x42')](_0x108a40['serverUrl']);var _0x1df74b=_0x108a40[_0x59e6('0x41')];_0x4dabdb[_0x59e6('0x13')]=_0x108a40[_0x59e6('0x44')];_0x4dabdb[_0x59e6('0x28')]=_0x5ae07e[_0x59e6('0x45')]()===_0x59e6('0x46')?_0x3f2cd6[_0x59e6('0x47')]:_0x3f2cd6[_0x59e6('0x48')];_0x4dabdb[_0x59e6('0x49')]=_0x5ae07e===_0x59e6('0x4a')||_0x5ae07e===_0x59e6('0x4b')?_0x59e6('0x4a'):_0x59e6('0x46');if(_0x2bb167){_0x4dabdb['agentEmail']=_0x2bb167[_0x59e6('0x12')];}var _0x4aefaa=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x108a40[_0x59e6('0x43')],_0x3f2cd6[_0x59e6('0x4c')],md5(_0x3f2cd6[_0x59e6('0x4c')]));if(_0x212a5d&&_0x212a5d['monitor_format']){logger[_0x59e6('0xe')]('[QUEUE]',_0x59e6('0x4d'));_0x3f2cd6[_0x59e6('0x4e')]=_0x4aefaa;}else if(_0x438df8&&_0x438df8[_0x59e6('0x4f')]&&_0x438df8[_0x59e6('0x4f')]!=='none'){logger[_0x59e6('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3f2cd6[_0x59e6('0x4e')]=_0x4aefaa;}else{_0x3f2cd6[_0x59e6('0x4e')]='';}return getAdminId(_0x4dabdb,_0x5ae07e,_0x2af44b,_0x1df74b)['then'](getUser(_0x5ae07e,_0x2af44b,_0x1df74b))[_0x59e6('0xf')](getEndUser(_0x5ae07e,_0x2af44b,_0x1df74b))['then'](getTicket(_0x5ae07e,_0x2af44b,_0x1df74b,_0x507c31,_0x3f2cd6))[_0x59e6('0xf')](function(_0x2c153e){logger['info'](util['format'](_0x59e6('0x50'),_0x2c153e[_0x59e6('0x3b')]));if(_0x5ae07e!==_0x59e6('0x4b')){logger[_0x59e6('0xe')]('['+[_0x5ae07e['toUpperCase']()]+']',_0x59e6('0x51'));emit(_0x1df74b,_0x2bb167[_0x59e6('0x25')],_0x2c153e[_0x59e6('0x2c')]);}})[_0x59e6('0x17')](function(_0x3e7bdb){logger[_0x59e6('0x21')]('['+[_0x5ae07e[_0x59e6('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x59e6('0x52')](_0x3e7bdb,{'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 4cf44d2..7683684 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 _0xd7d1=['desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','unmanaged','salesforce','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x53fe7e,_0x218421){_0x53fe7e=_0x53fe7e-0x0;var _0x4260e4=_0xd7d1[_0x53fe7e];return _0x4260e4;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var zendesk=require(_0x1d7d('0x2'));var salesforce=require(_0x1d7d('0x3'));var sugarcrm=require(_0x1d7d('0x4'));var freshdesk=require(_0x1d7d('0x5'));var zoho=require(_0x1d7d('0x6'));var desk=require(_0x1d7d('0x7'));var vtiger=require(_0x1d7d('0x8'));var servicenow=require(_0x1d7d('0x9'));var dynamics365=require(_0x1d7d('0xa'));var freshsales=require(_0x1d7d('0xb'));var integrations=[_0x1d7d('0xc'),'salesforce',_0x1d7d('0xd'),_0x1d7d('0xe'),_0x1d7d('0xf'),_0x1d7d('0x10'),_0x1d7d('0x11'),_0x1d7d('0x12'),_0x1d7d('0x13'),_0x1d7d('0x14')];exports[_0x1d7d('0x15')]=function(_0x8b258b,_0x2765fe,_0x547f7b,_0xe6b9eb,_0x4c6809,_0x3cbca9){if(_0x547f7b){if(_[_0x1d7d('0x16')](integrations,_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]())){try{var _0x5c7445=null;var _0x11b83f='';var _0x5ae1c9=_0x547f7b[_0x8b258b['data1'][_0x1d7d('0x18')]()];if(_0x5ae1c9){var _0x4049be=_0x5ae1c9[_0x8b258b['data2']];if(_0x4049be){var _0x55dba7=_[_0x1d7d('0x19')](_0x4049be[_0x1d7d('0x1a')],{'id':parseInt(_0x8b258b[_0x1d7d('0x1b')],0xa)});if(_0x55dba7){if(_0xe6b9eb){if(_0x4c6809&&_0x2765fe[_0x1d7d('0x1c')]){_0x11b83f=_0x1d7d('0x1c');}else if(_0x2765fe['routeId']){_0x11b83f=_0x1d7d('0x1d');}else{console[_0x1d7d('0x1e')]('EVENT\x20UNKNOWN',_0x2765fe);}}else{_0x11b83f=_0x1d7d('0x1f');}switch(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]()){case _0x1d7d('0xc'):zendesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x20'):salesforce[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'sugarcrm':sugarcrm[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xe'):freshdesk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0xf'):zoho[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'desk':desk[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case'vtiger':vtiger[_0x11b83f](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9);break;case _0x1d7d('0x13'):freshsales['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x14'):servicenow['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;case _0x1d7d('0x12'):dynamics365['cs'](_0x8b258b,_0x2765fe,_0x55dba7,_0xe6b9eb,_0x4c6809,_0x4049be,_0x3cbca9,_0x11b83f);break;default:console[_0x1d7d('0x1e')](_0x1d7d('0x21'));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b['data1'][_0x1d7d('0x18')]());_0x5c7445[_0x1d7d('0x23')](_0x1d7d('0x24'),util['format'](_0x1d7d('0x25'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b['data3']));}}else{_0x5c7445=require(_0x1d7d('0x22'))(_0x8b258b[_0x1d7d('0x17')][_0x1d7d('0x18')]());_0x5c7445['error'](_0x1d7d('0x24'),util[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x8b258b[_0x1d7d('0x17')]['toLowerCase'](),_0x8b258b[_0x1d7d('0x28')]));}}else{}}catch(_0x151198){console['error'](_0x151198);}}}}; \ No newline at end of file +var _0x9ffd=['unknown\x20integration','error','../../../../config/logger','[EXEC]','format','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','includes','data1','toLowerCase','data2','Configurations','data3','queue','unmanaged','servicenow','log'];(function(_0x248c90,_0x1ed333){var _0x449036=function(_0x54ed08){while(--_0x54ed08){_0x248c90['push'](_0x248c90['shift']());}};_0x449036(++_0x1ed333);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x20569b,_0x2e41dc){_0x20569b=_0x20569b-0x0;var _0x2ed188=_0x9ffd[_0x20569b];return _0x2ed188;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var zendesk=require(_0xd9ff('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd9ff('0x3'));var freshdesk=require(_0xd9ff('0x4'));var zoho=require(_0xd9ff('0x5'));var desk=require(_0xd9ff('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0xd9ff('0x7'));var dynamics365=require(_0xd9ff('0x8'));var freshsales=require('./freshsales');var integrations=[_0xd9ff('0x9'),_0xd9ff('0xa'),_0xd9ff('0xb'),_0xd9ff('0xc'),_0xd9ff('0xd'),_0xd9ff('0xe'),_0xd9ff('0xf'),_0xd9ff('0x10'),_0xd9ff('0x11'),'servicenow'];exports['exec']=function(_0x567f79,_0x5aa954,_0x2355ab,_0x2fd77a,_0x193537,_0x32b48f){if(_0x2355ab){if(_[_0xd9ff('0x12')](integrations,_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]())){try{var _0x1c2a16=null;var _0x47d842='';var _0x47b0d7=_0x2355ab[_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]()];if(_0x47b0d7){var _0x415c58=_0x47b0d7[_0x567f79[_0xd9ff('0x15')]];if(_0x415c58){var _0x12c39a=_['find'](_0x415c58[_0xd9ff('0x16')],{'id':parseInt(_0x567f79[_0xd9ff('0x17')],0xa)});if(_0x12c39a){if(_0x2fd77a){if(_0x193537&&_0x5aa954['queue']){_0x47d842=_0xd9ff('0x18');}else if(_0x5aa954['routeId']){_0x47d842='outbound';}else{console['log']('EVENT\x20UNKNOWN',_0x5aa954);}}else{_0x47d842=_0xd9ff('0x19');}switch(_0x567f79['data1'][_0xd9ff('0x14')]()){case _0xd9ff('0x9'):zendesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xa'):salesforce[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xb'):sugarcrm[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xc'):freshdesk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xd'):zoho[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xe'):desk[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0xf'):vtiger[_0x47d842](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f);break;case _0xd9ff('0x11'):freshsales['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x1a'):servicenow['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;case _0xd9ff('0x10'):dynamics365['cs'](_0x567f79,_0x5aa954,_0x12c39a,_0x2fd77a,_0x193537,_0x415c58,_0x32b48f,_0x47d842);break;default:console[_0xd9ff('0x1b')](_0xd9ff('0x1c'));}}else{_0x1c2a16=require('../../../../config/logger')(_0x567f79['data1'][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data3']));}}else{_0x1c2a16=require(_0xd9ff('0x1e'))(_0x567f79[_0xd9ff('0x13')][_0xd9ff('0x14')]());_0x1c2a16[_0xd9ff('0x1d')](_0xd9ff('0x1f'),util[_0xd9ff('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x567f79['data1'][_0xd9ff('0x14')](),_0x567f79['data2']));}}else{}}catch(_0x3ca906){console['error'](_0x3ca906);}}}}; \ 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 eabe000..63a6c10 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 _0xeedb=['trigger:browser:url','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','emit','Task','utc','Subjects','Descriptions','ticketType','Case','assign','getString','ContactId','sobject','create','isNil','validateEmail','User','find','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','execute','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','uniqueid','email','calleridname','calleridnum','[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.','catch','stringify','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xeedb,0xec));var _0xbeed=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xeedb[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xbeed('0x0'));var rp=require(_0xbeed('0x1'));var moment=require(_0xbeed('0x2'));var BPromise=require(_0xbeed('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0xbeed('0x4'));var Redis=require(_0xbeed('0x5'));var intUtil=require(_0xbeed('0x6'));var config=require(_0xbeed('0x7'));var logger=require(_0xbeed('0x8'))('salesforce');config[_0xbeed('0x9')]=_[_0xbeed('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbeed('0xb'))(new Redis(config[_0xbeed('0x9')]));function emit(_0x46aaec,_0x27f19b,_0x3cd226){io['to'](_0x46aaec)[_0xbeed('0xc')](_0x27f19b,_0x3cd226);}function getTicket(_0x2aeb34,_0x7d908b,_0x411d63,_0x455315,_0x10ccda,_0x56c99f,_0x412660,_0x473aa1){var _0x1f0877={};if(_0x455315['ticketType']===_0xbeed('0xd')){_0x1f0877=Object['assign']({},{'OwnerId':_0x7d908b['id'],'ActivityDate':moment[_0xbeed('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x455315[_0xbeed('0xf')],_0x10ccda,'\x20'),'Description':intUtil['getString'](_0x455315[_0xbeed('0x10')],_0x10ccda,'\x0a')},getCustomFields(_0x56c99f,_0x10ccda));if(_0x411d63){_0x1f0877['WhoId']=_0x411d63['id'];}}else if(_0x455315[_0xbeed('0x11')]===_0xbeed('0x12')){_0x1f0877=Object[_0xbeed('0x13')]({},{'OwnerId':_0x7d908b['id'],'Subject':intUtil[_0xbeed('0x14')](_0x455315['Subjects'],_0x10ccda,'\x20'),'Description':intUtil['getString'](_0x455315[_0xbeed('0x10')],_0x10ccda,'\x0a')},getCustomFields(_0x56c99f,_0x10ccda));if(_0x411d63){_0x1f0877[_0xbeed('0x15')]=_0x411d63['id'];}}return _0x412660[_0xbeed('0x16')](_0x455315[_0xbeed('0x11')])[_0xbeed('0x17')](_0x1f0877);}function getUser(_0x582695,_0x5e6ee1,_0x3aeccc){if(!_[_0xbeed('0x18')](_0x5e6ee1)&&intUtil[_0xbeed('0x19')](_0x5e6ee1)){var _0x3bb182={'Email':_0x5e6ee1};var _0x246aef={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3aeccc[_0xbeed('0x16')](_0xbeed('0x1a'))[_0xbeed('0x1b')](_0x3bb182,_0x246aef)['execute']()['then'](function(_0x278590){if(_0x278590[_0xbeed('0x1c')]){var _0x40517b=_[_0xbeed('0x1b')](_0x278590,function(_0x55ea5a){return _0x55ea5a[_0xbeed('0x1d')]===_0x5e6ee1;});if(_0x40517b){logger[_0xbeed('0x1e')](_0xbeed('0x1f'),_0x5e6ee1);return BPromise[_0xbeed('0x20')]({'id':_0x40517b['Id'],'name':_0x40517b[_0xbeed('0x21')]});}}else{logger[_0xbeed('0x1e')](_0xbeed('0x22'),_0x5e6ee1);return _0x3aeccc[_0xbeed('0x23')]()[_0xbeed('0x24')](function(_0x2e6570){return BPromise['resolve']({'id':_0x2e6570['user_id'],'name':_0x2e6570['display_name']});});}});}else{logger[_0xbeed('0x1e')](_0xbeed('0x22'),_0x5e6ee1);return _0x3aeccc[_0xbeed('0x23')]()[_0xbeed('0x24')](function(_0x803f5a){return BPromise[_0xbeed('0x20')]({'id':_0x803f5a[_0xbeed('0x25')],'name':_0x803f5a[_0xbeed('0x26')]});});}}function getEndUser(_0x411964,_0x3f3763,_0x44d1e4,_0x6741e,_0x2a1a6b){var _0x2cdd16={'Phone':_0x6741e};var _0x9d3e4c={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbeed('0x20')]()[_0xbeed('0x24')](function(){if(_0x3f3763[_0xbeed('0x11')]===_0xbeed('0xd')){logger['info'](_0xbeed('0x27'),_0x6741e,_0x3f3763[_0xbeed('0x28')]);switch(_0x3f3763[_0xbeed('0x28')]){case _0xbeed('0x29'):return _0x2a1a6b[_0xbeed('0x16')](_0xbeed('0x2a'))['find'](_0x2cdd16,_0x9d3e4c)['execute']()['then'](function(_0x5ab6cb){if(_0x5ab6cb&&_0x5ab6cb['length']){return _0x5ab6cb;}else{return _0x2a1a6b[_0xbeed('0x16')](_0xbeed('0x2b'))['find'](_0x2cdd16,_0x9d3e4c);}});case _0xbeed('0x2c'):return _0x2a1a6b[_0xbeed('0x16')](_0xbeed('0x2a'))[_0xbeed('0x1b')](_0x2cdd16,_0x9d3e4c)[_0xbeed('0x2d')]();case _0xbeed('0x2e'):return _0x2a1a6b['sobject']('Lead')[_0xbeed('0x1b')](_0x2cdd16,_0x9d3e4c);default:return null;}}else if(_0x3f3763[_0xbeed('0x11')]===_0xbeed('0x12')){logger[_0xbeed('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x6741e,_0xbeed('0x2c'));return _0x2a1a6b[_0xbeed('0x16')](_0xbeed('0x2a'))['find'](_0x2cdd16,_0x9d3e4c)[_0xbeed('0x2d')]();}})[_0xbeed('0x24')](function(_0xfa8424){if(_0xfa8424&&_0xfa8424[_0xbeed('0x1c')]){var _0x55b699=_['find'](_0xfa8424,function(_0x4093f1){return _0x4093f1[_0xbeed('0x2f')]===_0x6741e;});if(_0x55b699){return BPromise[_0xbeed('0x20')]({'id':_0x55b699['Id'],'name':_0x55b699[_0xbeed('0x21')],'phone':_0x55b699[_0xbeed('0x2f')]});}}})[_0xbeed('0x24')](function(_0x523de5){if(_0x523de5){logger[_0xbeed('0x1e')](_0xbeed('0x30'),_0x6741e);return BPromise[_0xbeed('0x20')](_0x523de5);}else{logger[_0xbeed('0x1e')](_0xbeed('0x31'),_0x6741e);var _0x14cddf={'LastName':_0x44d1e4!==_0xbeed('0x32')?_0x44d1e4:util[_0xbeed('0x33')](_0xbeed('0x34'),_0x6741e),'Phone':_0x6741e};if(_0x3f3763[_0xbeed('0x35')]){if(_0x3f3763['moduleCreate']===_0xbeed('0x2c')){logger[_0xbeed('0x1e')](_0xbeed('0x36'),_0x6741e,_0x3f3763[_0xbeed('0x35')]);}else if(_0x3f3763['moduleCreate']==='lead'&&_0x3f3763[_0xbeed('0x11')]===_0xbeed('0xd')){logger[_0xbeed('0x1e')](_0xbeed('0x36'),_0x6741e,_0x3f3763[_0xbeed('0x35')]);_0x14cddf[_0xbeed('0x37')]=_0xbeed('0x38');}else{return null;}}return _0x2a1a6b[_0xbeed('0x16')](_[_0xbeed('0x39')](_0x3f3763[_0xbeed('0x35')]))[_0xbeed('0x17')](_0x14cddf);}});}function getCustomFields(_0x353508,_0x28371b){var _0x1ef9dc={};if(_0x353508['length']>0x0){_[_0xbeed('0x3a')](_0x353508,function(_0xee0d05){if(_0xee0d05[_0xbeed('0x3b')]===_0xbeed('0x3c')&&_0xee0d05['idField']){_0x1ef9dc[_0xee0d05[_0xbeed('0x3d')]]=_0xee0d05[_0xbeed('0x3e')][_0xbeed('0x3f')]();}else if(_0xee0d05[_0xbeed('0x3b')]===_0xbeed('0x40')&&_0xee0d05[_0xbeed('0x41')]&&_0xee0d05[_0xbeed('0x3d')]){_0x28371b[_0xee0d05[_0xbeed('0x41')]]&&(_0x1ef9dc[_0xee0d05[_0xbeed('0x3d')]]=_0x28371b[_0xee0d05['variableName']][_0xbeed('0x3f')]());}else if(_0xee0d05[_0xbeed('0x3b')]===_0xbeed('0x42')&&_0xee0d05['Variable']&&_0xee0d05[_0xbeed('0x43')]['name']&&_0xee0d05[_0xbeed('0x3d')]){_0x28371b[_0xee0d05[_0xbeed('0x43')][_0xbeed('0x44')]['toLowerCase']()]&&(_0x1ef9dc[_0xee0d05[_0xbeed('0x3d')]]=_0x28371b[_0xee0d05[_0xbeed('0x43')]['name'][_0xbeed('0x45')]()][_0xbeed('0x3f')]());}});}return _0x1ef9dc;}function getConnection(_0x8487e3){var _0x5c4ebc=_0x8487e3[_0xbeed('0x46')][_0xbeed('0x47')](_0x8487e3['securityToken']);var _0x30fede=new jsforce['Connection']({'oauth2':{'loginUrl':_0x8487e3['remoteUri']||_0xbeed('0x48'),'clientId':_0x8487e3[_0xbeed('0x49')],'clientSecret':_0x8487e3[_0xbeed('0x4a')]}});return _0x30fede[_0xbeed('0x4b')](_0x8487e3['username'],_0x5c4ebc)[_0xbeed('0x24')](function(){logger[_0xbeed('0x1e')](_0xbeed('0x4c'));return _0x30fede;});}exports[_0xbeed('0x4d')]=function(_0xb4acf6,_0xf7d46a,_0x4f02d8,_0x22d442,_0x7fe423,_0x16d5f1){var _0x4a0889,_0x5b8fa2,_0x36ea49,_0x88b92d;_0x16d5f1[_0xbeed('0x4e')]=intUtil[_0xbeed('0x4f')](_0x16d5f1[_0xbeed('0x4e')]);_0x16d5f1[_0xbeed('0x50')]=intUtil[_0xbeed('0x4f')](_0x16d5f1[_0xbeed('0x50')]);if(_0x7fe423&&_0x7fe423[_0xbeed('0x51')]){logger[_0xbeed('0x1e')](_0xbeed('0x52'),'Recording\x20is\x20enabled!');_0xf7d46a[_0xbeed('0x53')]=util[_0xbeed('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x16d5f1[_0xbeed('0x4e')],_0xf7d46a[_0xbeed('0x54')],md5(_0xf7d46a[_0xbeed('0x54')]));}else{_0xf7d46a[_0xbeed('0x53')]='';}return getConnection(_0x16d5f1)[_0xbeed('0x24')](function(_0x24941f){_0x88b92d=_0x24941f;return getUser(_0x16d5f1,_0x22d442[_0xbeed('0x55')],_0x88b92d);})[_0xbeed('0x24')](function(_0x5ae647){_0x4a0889=_0x5ae647;return getEndUser(_0x16d5f1,_0x4f02d8,_0xf7d46a[_0xbeed('0x56')],_0xf7d46a[_0xbeed('0x57')],_0x88b92d);})[_0xbeed('0x24')](function(_0x1a889c){_0x5b8fa2=_0x1a889c;return getTicket(_0x16d5f1,_0x4a0889,_0x5b8fa2,_0x4f02d8,_0xf7d46a,_0x4f02d8['Fields'],_0x88b92d,_0xbeed('0x4d'));})[_0xbeed('0x24')](function(_0x256adf){_0x36ea49=_0x256adf;logger[_0xbeed('0x1e')](_0xbeed('0x58'),_0x36ea49['id']);logger[_0xbeed('0x1e')](_0xbeed('0x59'),_0x36ea49['id'],_0x22d442[_0xbeed('0x44')],_0x16d5f1[_0xbeed('0x3b')]);switch(_0x16d5f1[_0xbeed('0x3b')]){case _0xbeed('0x5a'):emit(util[_0xbeed('0x33')](_0xbeed('0x5b'),_0x22d442[_0xbeed('0x44')]),_0xbeed('0x5c'),{'recordId':_0x36ea49['id']});break;case _0xbeed('0x5d'):emit(util[_0xbeed('0x33')]('user:%s',_0x22d442[_0xbeed('0x44')]),'trigger:browser:url',{'uri':util[_0xbeed('0x33')](_0xbeed('0x5e'),_0x88b92d[_0xbeed('0x5f')],_0x36ea49['id'])});break;default:logger[_0xbeed('0x60')](_0xbeed('0x61'));}})[_0xbeed('0x62')](function(_0x1e5634){logger[_0xbeed('0x60')](_0xbeed('0x52'),JSON[_0xbeed('0x63')](_0x1e5634));});};exports[_0xbeed('0x64')]=function(_0x54be51,_0x507829,_0x11922f,_0x1785a4,_0x17fcac,_0x11539e,_0x25ef03){var _0x3c029b,_0x222c8e,_0x4ac5d7,_0x350676;_0x11539e[_0xbeed('0x4e')]=intUtil[_0xbeed('0x4f')](_0x11539e[_0xbeed('0x4e')]);_0x11539e[_0xbeed('0x50')]=intUtil['stripTrailingSlash'](_0x11539e[_0xbeed('0x50')]);if(_0x25ef03&&_0x25ef03['recordingFormat']&&_0x25ef03[_0xbeed('0x65')]!=='none'){logger['info'](_0xbeed('0x66'),_0xbeed('0x67'));_0x507829[_0xbeed('0x53')]=util[_0xbeed('0x33')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11539e[_0xbeed('0x4e')],_0x507829['uniqueid'],md5(_0x507829[_0xbeed('0x54')]));}return getConnection(_0x11539e)['then'](function(_0x1aa1e2){_0x350676=_0x1aa1e2;return getUser(_0x11539e,_0x1785a4[_0xbeed('0x55')],_0x350676);})[_0xbeed('0x24')](function(_0x559d26){_0x3c029b=_0x559d26;return getEndUser(_0x11539e,_0x11922f,_0x507829[_0xbeed('0x68')],_0x507829[_0xbeed('0x69')],_0x350676);})[_0xbeed('0x24')](function(_0x302570){_0x222c8e=_0x302570;return getTicket(_0x11539e,_0x3c029b,_0x222c8e,_0x11922f,_0x507829,_0x11922f[_0xbeed('0x6a')],_0x350676,'outbound');})[_0xbeed('0x24')](function(_0x46ace2){_0x4ac5d7=_0x46ace2;logger[_0xbeed('0x1e')](_0xbeed('0x6b'),_0x4ac5d7['id']);logger[_0xbeed('0x1e')](_0xbeed('0x6c'),_0x4ac5d7['id'],_0x1785a4[_0xbeed('0x44')],_0x11539e['type']);switch(_0x11539e[_0xbeed('0x3b')]){case _0xbeed('0x5a'):emit(util[_0xbeed('0x33')](_0xbeed('0x5b'),_0x1785a4[_0xbeed('0x44')]),'trigger:salesforce:display',{'recordId':_0x4ac5d7['id']});break;case _0xbeed('0x5d'):emit(util[_0xbeed('0x33')]('user:%s',_0x1785a4[_0xbeed('0x44')]),_0xbeed('0x6d'),{'uri':util[_0xbeed('0x33')](_0xbeed('0x5e'),_0x350676[_0xbeed('0x5f')],_0x4ac5d7['id'])});break;default:logger['error'](_0xbeed('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xbeed('0x62')](function(_0x43827c){logger[_0xbeed('0x60')](_0xbeed('0x66'),JSON[_0xbeed('0x63')](_0x43827c));});};exports['unmanaged']=function(_0x80c3bc,_0x264bc1,_0x528ab1,_0x4bc78c,_0x3b380a,_0x4d7488){var _0x52b6ca,_0x1ad1c2,_0x24db71,_0x560512;_0x4d7488['serverUrl']=intUtil[_0xbeed('0x4f')](_0x4d7488['serverUrl']);_0x4d7488[_0xbeed('0x50')]=intUtil['stripTrailingSlash'](_0x4d7488['remoteUri']);if(_0x3b380a&&_0x3b380a[_0xbeed('0x51')]){logger['info']('['+_0x264bc1['lastevent'][_0xbeed('0x6e')]()+']',_0xbeed('0x67'));_0x264bc1[_0xbeed('0x53')]=util['format'](_0xbeed('0x6f'),_0x4d7488[_0xbeed('0x4e')],_0x264bc1[_0xbeed('0x54')],md5(_0x264bc1[_0xbeed('0x54')]));}else{_0x264bc1[_0xbeed('0x53')]='';}return getConnection(_0x4d7488)[_0xbeed('0x24')](function(_0x57b7ac){_0x560512=_0x57b7ac;if(!_[_0xbeed('0x18')](_0x4bc78c)){return getUser(_0x4d7488,_0x4bc78c[_0xbeed('0x44')],_0x560512);}else{return getUser(_0x4d7488,null,_0x560512);}})[_0xbeed('0x24')](function(_0x3ef324){_0x52b6ca=_0x3ef324;return getEndUser(_0x4d7488,_0x528ab1,_0x264bc1[_0xbeed('0x56')],_0x264bc1[_0xbeed('0x57')],_0x560512);})[_0xbeed('0x24')](function(_0xe71883){_0x1ad1c2=_0xe71883;return getTicket(_0x4d7488,_0x52b6ca,_0x1ad1c2,_0x528ab1,_0x264bc1,_0x528ab1[_0xbeed('0x6a')],_0x560512);})[_0xbeed('0x24')](function(_0x26ce6b){_0x24db71=_0x26ce6b;logger['info']('['+_0x264bc1[_0xbeed('0x70')][_0xbeed('0x6e')]()+_0xbeed('0x71'),_0x24db71['id']);logger[_0xbeed('0x1e')]('['+_0x264bc1[_0xbeed('0x70')][_0xbeed('0x6e')]()+_0xbeed('0x72'),_0x4d7488[_0xbeed('0x3b')]);})['catch'](function(_0x4be491){logger['error']('['+_0x264bc1['lastevent']['toUpperCase']()+']',JSON[_0xbeed('0x63')](_0x4be491));});}; \ No newline at end of file +var _0x4e1d=['[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','stringify','unmanaged','monitor_format','lastevent','toUpperCase','isNil','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','localhost','redis','emit','ticketType','Task','assign','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','create','User','find','execute','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','length','Contact','lead','Lead','Case','contact','Phone','','format','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','string','idField','toString','type','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.'];(function(_0x59175f,_0x4f8dd5){var _0x522199=function(_0x1ca57f){while(--_0x1ca57f){_0x59175f['push'](_0x59175f['shift']());}};_0x522199(++_0x4f8dd5);}(_0x4e1d,0xe5));var _0xd4e1=function(_0x938426,_0x4700f8){_0x938426=_0x938426-0x0;var _0x5ceb72=_0x4e1d[_0x938426];return _0x5ceb72;};'use strict';var _=require(_0xd4e1('0x0'));var rp=require(_0xd4e1('0x1'));var moment=require(_0xd4e1('0x2'));var BPromise=require(_0xd4e1('0x3'));var md5=require(_0xd4e1('0x4'));var jsforce=require(_0xd4e1('0x5'));var util=require(_0xd4e1('0x6'));var Redis=require(_0xd4e1('0x7'));var intUtil=require(_0xd4e1('0x8'));var config=require(_0xd4e1('0x9'));var logger=require(_0xd4e1('0xa'))(_0xd4e1('0xb'));config['redis']=_[_0xd4e1('0xc')](config['redis'],{'host':_0xd4e1('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4e1('0xe')]));function emit(_0x545d43,_0x2145bb,_0x4095a6){io['to'](_0x545d43)[_0xd4e1('0xf')](_0x2145bb,_0x4095a6);}function getTicket(_0x2bb719,_0x574ba9,_0x1e621f,_0x5ed659,_0xd5589c,_0x1f08cb,_0x21f6b1,_0x4629c6){var _0x98b05f={};if(_0x5ed659[_0xd4e1('0x10')]===_0xd4e1('0x11')){_0x98b05f=Object[_0xd4e1('0x12')]({},{'OwnerId':_0x574ba9['id'],'ActivityDate':moment[_0xd4e1('0x13')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xd4e1('0x14')](_0x5ed659[_0xd4e1('0x15')],_0xd5589c,'\x20'),'Description':intUtil[_0xd4e1('0x14')](_0x5ed659[_0xd4e1('0x16')],_0xd5589c,'\x0a')},getCustomFields(_0x1f08cb,_0xd5589c));if(_0x1e621f){_0x98b05f[_0xd4e1('0x17')]=_0x1e621f['id'];}}else if(_0x5ed659['ticketType']==='Case'){_0x98b05f=Object[_0xd4e1('0x12')]({},{'OwnerId':_0x574ba9['id'],'Subject':intUtil['getString'](_0x5ed659[_0xd4e1('0x15')],_0xd5589c,'\x20'),'Description':intUtil[_0xd4e1('0x14')](_0x5ed659[_0xd4e1('0x16')],_0xd5589c,'\x0a')},getCustomFields(_0x1f08cb,_0xd5589c));if(_0x1e621f){_0x98b05f[_0xd4e1('0x18')]=_0x1e621f['id'];}}return _0x21f6b1[_0xd4e1('0x19')](_0x5ed659[_0xd4e1('0x10')])[_0xd4e1('0x1a')](_0x98b05f);}function getUser(_0x30e582,_0x347400,_0x423691){if(!_['isNil'](_0x347400)&&intUtil['validateEmail'](_0x347400)){var _0xd6e21b={'Email':_0x347400};var _0x4ffc37={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x423691[_0xd4e1('0x19')](_0xd4e1('0x1b'))[_0xd4e1('0x1c')](_0xd6e21b,_0x4ffc37)[_0xd4e1('0x1d')]()[_0xd4e1('0x1e')](function(_0x32e9f2){if(_0x32e9f2['length']){var _0x10cac6=_[_0xd4e1('0x1c')](_0x32e9f2,function(_0x5df63d){return _0x5df63d[_0xd4e1('0x1f')]===_0x347400;});if(_0x10cac6){logger[_0xd4e1('0x20')](_0xd4e1('0x21'),_0x347400);return BPromise[_0xd4e1('0x22')]({'id':_0x10cac6['Id'],'name':_0x10cac6[_0xd4e1('0x23')]});}}else{logger[_0xd4e1('0x20')](_0xd4e1('0x24'),_0x347400);return _0x423691[_0xd4e1('0x25')]()['then'](function(_0x3868d5){return BPromise['resolve']({'id':_0x3868d5[_0xd4e1('0x26')],'name':_0x3868d5['display_name']});});}});}else{logger[_0xd4e1('0x20')](_0xd4e1('0x24'),_0x347400);return _0x423691['identity']()[_0xd4e1('0x1e')](function(_0xb2ce15){return BPromise['resolve']({'id':_0xb2ce15[_0xd4e1('0x26')],'name':_0xb2ce15[_0xd4e1('0x27')]});});}}function getEndUser(_0x8c739a,_0x2fd046,_0x3add63,_0x18c8b2,_0x56984b){var _0x25db51={'Phone':_0x18c8b2};var _0x48f3a7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd4e1('0x22')]()[_0xd4e1('0x1e')](function(){if(_0x2fd046[_0xd4e1('0x10')]===_0xd4e1('0x11')){logger['info'](_0xd4e1('0x28'),_0x18c8b2,_0x2fd046['moduleSearch']);switch(_0x2fd046[_0xd4e1('0x29')]){case'contact_lead':return _0x56984b[_0xd4e1('0x19')]('Contact')[_0xd4e1('0x1c')](_0x25db51,_0x48f3a7)[_0xd4e1('0x1d')]()[_0xd4e1('0x1e')](function(_0x3ba012){if(_0x3ba012&&_0x3ba012[_0xd4e1('0x2a')]){return _0x3ba012;}else{return _0x56984b['sobject']('Lead')['find'](_0x25db51,_0x48f3a7);}});case'contact':return _0x56984b[_0xd4e1('0x19')](_0xd4e1('0x2b'))[_0xd4e1('0x1c')](_0x25db51,_0x48f3a7)['execute']();case _0xd4e1('0x2c'):return _0x56984b[_0xd4e1('0x19')](_0xd4e1('0x2d'))[_0xd4e1('0x1c')](_0x25db51,_0x48f3a7);default:return null;}}else if(_0x2fd046[_0xd4e1('0x10')]===_0xd4e1('0x2e')){logger[_0xd4e1('0x20')](_0xd4e1('0x28'),_0x18c8b2,_0xd4e1('0x2f'));return _0x56984b[_0xd4e1('0x19')]('Contact')[_0xd4e1('0x1c')](_0x25db51,_0x48f3a7)['execute']();}})[_0xd4e1('0x1e')](function(_0x5c9a20){if(_0x5c9a20&&_0x5c9a20['length']){var _0x5bcbe5=_[_0xd4e1('0x1c')](_0x5c9a20,function(_0x5e8693){return _0x5e8693[_0xd4e1('0x30')]===_0x18c8b2;});if(_0x5bcbe5){return BPromise[_0xd4e1('0x22')]({'id':_0x5bcbe5['Id'],'name':_0x5bcbe5[_0xd4e1('0x23')],'phone':_0x5bcbe5[_0xd4e1('0x30')]});}}})[_0xd4e1('0x1e')](function(_0xab3ac5){if(_0xab3ac5){logger[_0xd4e1('0x20')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x18c8b2);return BPromise[_0xd4e1('0x22')](_0xab3ac5);}else{logger[_0xd4e1('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x18c8b2);var _0x10ae58={'LastName':_0x3add63!==_0xd4e1('0x31')?_0x3add63:util[_0xd4e1('0x32')]('Caller\x20-\x20%s',_0x18c8b2),'Phone':_0x18c8b2};if(_0x2fd046[_0xd4e1('0x33')]){if(_0x2fd046[_0xd4e1('0x33')]===_0xd4e1('0x2f')){logger[_0xd4e1('0x20')](_0xd4e1('0x34'),_0x18c8b2,_0x2fd046[_0xd4e1('0x33')]);}else if(_0x2fd046['moduleCreate']==='lead'&&_0x2fd046['ticketType']==='Task'){logger[_0xd4e1('0x20')](_0xd4e1('0x34'),_0x18c8b2,_0x2fd046['moduleCreate']);_0x10ae58['Company']=_0xd4e1('0x35');}else{return null;}}return _0x56984b['sobject'](_[_0xd4e1('0x36')](_0x2fd046[_0xd4e1('0x33')]))[_0xd4e1('0x1a')](_0x10ae58);}});}function getCustomFields(_0x3a7770,_0x2b716d){var _0x3c40d0={};if(_0x3a7770[_0xd4e1('0x2a')]>0x0){_[_0xd4e1('0x37')](_0x3a7770,function(_0x1eb1e0){if(_0x1eb1e0['type']===_0xd4e1('0x38')&&_0x1eb1e0[_0xd4e1('0x39')]){_0x3c40d0[_0x1eb1e0[_0xd4e1('0x39')]]=_0x1eb1e0['content'][_0xd4e1('0x3a')]();}else if(_0x1eb1e0[_0xd4e1('0x3b')]==='variable'&&_0x1eb1e0[_0xd4e1('0x3c')]&&_0x1eb1e0['idField']){_0x2b716d[_0x1eb1e0[_0xd4e1('0x3c')]]&&(_0x3c40d0[_0x1eb1e0[_0xd4e1('0x39')]]=_0x2b716d[_0x1eb1e0[_0xd4e1('0x3c')]][_0xd4e1('0x3a')]());}else if(_0x1eb1e0[_0xd4e1('0x3b')]===_0xd4e1('0x3d')&&_0x1eb1e0[_0xd4e1('0x3e')]&&_0x1eb1e0['Variable'][_0xd4e1('0x3f')]&&_0x1eb1e0[_0xd4e1('0x39')]){_0x2b716d[_0x1eb1e0[_0xd4e1('0x3e')][_0xd4e1('0x3f')][_0xd4e1('0x40')]()]&&(_0x3c40d0[_0x1eb1e0[_0xd4e1('0x39')]]=_0x2b716d[_0x1eb1e0[_0xd4e1('0x3e')][_0xd4e1('0x3f')]['toLowerCase']()]['toString']());}});}return _0x3c40d0;}function getConnection(_0x4ba681){var _0x464bfa=_0x4ba681['password'][_0xd4e1('0x41')](_0x4ba681[_0xd4e1('0x42')]);var _0x21026f=new jsforce[(_0xd4e1('0x43'))]({'oauth2':{'loginUrl':_0x4ba681[_0xd4e1('0x44')]||'https://login.salesforce.com','clientId':_0x4ba681[_0xd4e1('0x45')],'clientSecret':_0x4ba681[_0xd4e1('0x46')]}});return _0x21026f['login'](_0x4ba681['username'],_0x464bfa)[_0xd4e1('0x1e')](function(){logger['info'](_0xd4e1('0x47'));return _0x21026f;});}exports[_0xd4e1('0x48')]=function(_0x28c3a3,_0x1690b8,_0xabbaa9,_0x1cf192,_0x5d373a,_0x587bd9){var _0x475722,_0x1a439e,_0x57c1fb,_0x3ec677;_0x587bd9[_0xd4e1('0x49')]=intUtil[_0xd4e1('0x4a')](_0x587bd9[_0xd4e1('0x49')]);_0x587bd9[_0xd4e1('0x44')]=intUtil[_0xd4e1('0x4a')](_0x587bd9[_0xd4e1('0x44')]);if(_0x5d373a&&_0x5d373a['monitor_format']){logger[_0xd4e1('0x20')](_0xd4e1('0x4b'),_0xd4e1('0x4c'));_0x1690b8[_0xd4e1('0x4d')]=util[_0xd4e1('0x32')](_0xd4e1('0x4e'),_0x587bd9[_0xd4e1('0x49')],_0x1690b8['uniqueid'],md5(_0x1690b8['uniqueid']));}else{_0x1690b8[_0xd4e1('0x4d')]='';}return getConnection(_0x587bd9)[_0xd4e1('0x1e')](function(_0x1c516a){_0x3ec677=_0x1c516a;return getUser(_0x587bd9,_0x1cf192['email'],_0x3ec677);})[_0xd4e1('0x1e')](function(_0xf05847){_0x475722=_0xf05847;return getEndUser(_0x587bd9,_0xabbaa9,_0x1690b8[_0xd4e1('0x4f')],_0x1690b8['calleridnum'],_0x3ec677);})[_0xd4e1('0x1e')](function(_0x32dc9f){_0x1a439e=_0x32dc9f;return getTicket(_0x587bd9,_0x475722,_0x1a439e,_0xabbaa9,_0x1690b8,_0xabbaa9[_0xd4e1('0x50')],_0x3ec677,_0xd4e1('0x48'));})['then'](function(_0x422ffc){_0x57c1fb=_0x422ffc;logger[_0xd4e1('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x57c1fb['id']);logger[_0xd4e1('0x20')](_0xd4e1('0x51'),_0x57c1fb['id'],_0x1cf192[_0xd4e1('0x3f')],_0x587bd9['type']);switch(_0x587bd9[_0xd4e1('0x3b')]){case _0xd4e1('0x52'):emit(util[_0xd4e1('0x32')](_0xd4e1('0x53'),_0x1cf192[_0xd4e1('0x3f')]),_0xd4e1('0x54'),{'recordId':_0x57c1fb['id']});break;case'newTab':emit(util[_0xd4e1('0x32')]('user:%s',_0x1cf192[_0xd4e1('0x3f')]),_0xd4e1('0x55'),{'uri':util[_0xd4e1('0x32')](_0xd4e1('0x56'),_0x3ec677[_0xd4e1('0x57')],_0x57c1fb['id'])});break;default:logger['error'](_0xd4e1('0x58'));}})[_0xd4e1('0x59')](function(_0x5249f6){logger[_0xd4e1('0x5a')](_0xd4e1('0x4b'),JSON['stringify'](_0x5249f6));});};exports[_0xd4e1('0x5b')]=function(_0x36ecea,_0x3f6960,_0x2204a2,_0x36b115,_0x138fc5,_0x250207,_0x3c56c1){var _0x150c8d,_0x56f9e3,_0x15a8fd,_0x578c4e;_0x250207[_0xd4e1('0x49')]=intUtil[_0xd4e1('0x4a')](_0x250207[_0xd4e1('0x49')]);_0x250207[_0xd4e1('0x44')]=intUtil['stripTrailingSlash'](_0x250207['remoteUri']);if(_0x3c56c1&&_0x3c56c1['recordingFormat']&&_0x3c56c1[_0xd4e1('0x5c')]!==_0xd4e1('0x5d')){logger['info'](_0xd4e1('0x5e'),'Recording\x20is\x20enabled!');_0x3f6960['recordingURL']=util[_0xd4e1('0x32')](_0xd4e1('0x4e'),_0x250207[_0xd4e1('0x49')],_0x3f6960[_0xd4e1('0x5f')],md5(_0x3f6960['uniqueid']));}return getConnection(_0x250207)['then'](function(_0x870e7b){_0x578c4e=_0x870e7b;return getUser(_0x250207,_0x36b115['email'],_0x578c4e);})[_0xd4e1('0x1e')](function(_0x4195da){_0x150c8d=_0x4195da;return getEndUser(_0x250207,_0x2204a2,_0x3f6960[_0xd4e1('0x60')],_0x3f6960['destcalleridnum'],_0x578c4e);})[_0xd4e1('0x1e')](function(_0x35a433){_0x56f9e3=_0x35a433;return getTicket(_0x250207,_0x150c8d,_0x56f9e3,_0x2204a2,_0x3f6960,_0x2204a2[_0xd4e1('0x50')],_0x578c4e,_0xd4e1('0x5b'));})['then'](function(_0x1f10ee){_0x15a8fd=_0x1f10ee;logger[_0xd4e1('0x20')](_0xd4e1('0x61'),_0x15a8fd['id']);logger['info'](_0xd4e1('0x62'),_0x15a8fd['id'],_0x36b115['name'],_0x250207['type']);switch(_0x250207[_0xd4e1('0x3b')]){case _0xd4e1('0x52'):emit(util[_0xd4e1('0x32')](_0xd4e1('0x53'),_0x36b115[_0xd4e1('0x3f')]),_0xd4e1('0x54'),{'recordId':_0x15a8fd['id']});break;case _0xd4e1('0x63'):emit(util[_0xd4e1('0x32')](_0xd4e1('0x53'),_0x36b115['name']),'trigger:browser:url',{'uri':util[_0xd4e1('0x32')](_0xd4e1('0x56'),_0x578c4e[_0xd4e1('0x57')],_0x15a8fd['id'])});break;default:logger[_0xd4e1('0x5a')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xd4e1('0x59')](function(_0x4a2fd2){logger[_0xd4e1('0x5a')](_0xd4e1('0x5e'),JSON[_0xd4e1('0x64')](_0x4a2fd2));});};exports[_0xd4e1('0x65')]=function(_0x36f24a,_0xcaaf76,_0x5363da,_0x1e1e6,_0x2bdb77,_0x1fd9d0){var _0x38a6f7,_0x2f7233,_0x52f9ff,_0x2b1f24;_0x1fd9d0[_0xd4e1('0x49')]=intUtil['stripTrailingSlash'](_0x1fd9d0[_0xd4e1('0x49')]);_0x1fd9d0['remoteUri']=intUtil['stripTrailingSlash'](_0x1fd9d0['remoteUri']);if(_0x2bdb77&&_0x2bdb77[_0xd4e1('0x66')]){logger[_0xd4e1('0x20')]('['+_0xcaaf76[_0xd4e1('0x67')][_0xd4e1('0x68')]()+']',_0xd4e1('0x4c'));_0xcaaf76[_0xd4e1('0x4d')]=util[_0xd4e1('0x32')](_0xd4e1('0x4e'),_0x1fd9d0[_0xd4e1('0x49')],_0xcaaf76['uniqueid'],md5(_0xcaaf76[_0xd4e1('0x5f')]));}else{_0xcaaf76['recordingURL']='';}return getConnection(_0x1fd9d0)[_0xd4e1('0x1e')](function(_0x2725d8){_0x2b1f24=_0x2725d8;if(!_[_0xd4e1('0x69')](_0x1e1e6)){return getUser(_0x1fd9d0,_0x1e1e6[_0xd4e1('0x3f')],_0x2b1f24);}else{return getUser(_0x1fd9d0,null,_0x2b1f24);}})['then'](function(_0x562b0a){_0x38a6f7=_0x562b0a;return getEndUser(_0x1fd9d0,_0x5363da,_0xcaaf76[_0xd4e1('0x4f')],_0xcaaf76[_0xd4e1('0x6a')],_0x2b1f24);})[_0xd4e1('0x1e')](function(_0x3cdd34){_0x2f7233=_0x3cdd34;return getTicket(_0x1fd9d0,_0x38a6f7,_0x2f7233,_0x5363da,_0xcaaf76,_0x5363da[_0xd4e1('0x50')],_0x2b1f24);})[_0xd4e1('0x1e')](function(_0x4bf381){_0x52f9ff=_0x4bf381;logger['info']('['+_0xcaaf76[_0xd4e1('0x67')][_0xd4e1('0x68')]()+_0xd4e1('0x6b'),_0x52f9ff['id']);logger['info']('['+_0xcaaf76['lastevent'][_0xd4e1('0x68')]()+_0xd4e1('0x6c'),_0x1fd9d0['type']);})[_0xd4e1('0x59')](function(_0x216e8d){logger[_0xd4e1('0x5a')]('['+_0xcaaf76[_0xd4e1('0x67')][_0xd4e1('0x68')]()+']',JSON[_0xd4e1('0x64')](_0x216e8d));});}; \ 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 fb77d68..6e6bdb5 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 _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(_0x39a626,_0x3acc19){var _0x50ef67=function(_0xaa386f){while(--_0xaa386f){_0x39a626['push'](_0x39a626['shift']());}};_0x50ef67(++_0x3acc19);}(_0x5fc3,0xa8));var _0x35fc=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0x5fc3[_0x555069];return _0x100af7;};'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 +var _0xc4aa=['all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','stripTrailingSlash','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','POST','ticketNumber','push'];(function(_0x149a0a,_0x20b4ec){var _0x54ad32=function(_0x50c46a){while(--_0x50c46a){_0x149a0a['push'](_0x149a0a['shift']());}};_0x54ad32(++_0x20b4ec);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc4aa[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xac4a('0x0'));var Promise=require(_0xac4a('0x1'));var rp=require(_0xac4a('0x2'));var util=require(_0xac4a('0x3'));var md5=require(_0xac4a('0x4'));var Redis=require(_0xac4a('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xac4a('0x6'));config[_0xac4a('0x7')]=_[_0xac4a('0x8')](config[_0xac4a('0x7')],{'host':_0xac4a('0x9'),'port':0x18eb});var io=require(_0xac4a('0xa'))(new Redis(config[_0xac4a('0x7')]));function getAdminUser(_0x10525b,_0x5c6179,_0x5b8339,_0x1aba6d,_0x2a4d53,_0x26ec84){return new Promise(function(_0x4f4146,_0x1d182e){var _0x3a82de={'method':_0xac4a('0xb'),'uri':_0x1aba6d+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2a4d53+'&'+_0x26ec84,'auth':_0x5c6179,'json':!![]};return rp(_0x3a82de)[_0xac4a('0xc')](function(_0x488e3c){if(_0x488e3c[_0xac4a('0xd')]['length']>0x0){_0x5b8339[_0xac4a('0xe')]=_0x488e3c[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}logger['info']('['+[_0x10525b[_0xac4a('0x10')]()]+_0xac4a('0x11'),_0x5b8339);_0x4f4146(_0x5b8339);})[_0xac4a('0x12')](function(_0x6e00d4){logger[_0xac4a('0x13')]('['+[_0x10525b[_0xac4a('0x10')]()]+']',_0x6e00d4[_0xac4a('0x14')]);_0x1d182e(_0x6e00d4[_0xac4a('0x14')]);});});}function getUser(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return function(_0x402fff){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x16'),_0x402fff);return new Promise(function(_0x3e88e3,_0x387a54){if(intUtil[_0xac4a('0x17')](_0x402fff[_0xac4a('0x18')])){var _0x546c5d={'method':'GET','uri':_0x11e101+_0xac4a('0x19')+_0x402fff[_0xac4a('0x18')]+'&'+_0x26dbb8+'&'+_0x4a2119,'auth':_0x42c7fc,'json':!![]};logger[_0xac4a('0x15')]('['+[_0x190418['toUpperCase']()]+_0xac4a('0x1a'),_0x546c5d);return rp(_0x546c5d)[_0xac4a('0xc')](function(_0x3752e4){logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x1b'),_0x3752e4);if(_0x3752e4[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0&&String(_0x3752e4['result'][0x0][_0xac4a('0x1d')])===_0xac4a('0x1e')){_0x402fff['userId']=_0x3752e4[_0xac4a('0xd')][0x0][_0xac4a('0xf')];}else{_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff['userEmail']=_0x402fff[_0xac4a('0x20')];}logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x21'),_0x402fff);_0x3e88e3(_0x402fff);})[_0xac4a('0x12')](function(_0x2b0dc2){logger[_0xac4a('0x13')]('['+[_0x190418[_0xac4a('0x10')]()]+']',_0x2b0dc2[_0xac4a('0x14')]);_0x387a54(_0x2b0dc2[_0xac4a('0x14')]);});}else{logger[_0xac4a('0x15')]('['+[_0x190418[_0xac4a('0x10')]()]+_0xac4a('0x22'));_0x402fff[_0xac4a('0x1f')]=_0x402fff[_0xac4a('0xe')];_0x402fff[_0xac4a('0x18')]=_0x402fff['adminEmail'];_0x3e88e3(_0x402fff);}});};}function createEndUser(_0x23b061,_0x267a22,_0x42a33c,_0x2772fe,_0x116700){logger['info']('['+[_0x23b061['toUpperCase']()]+_0xac4a('0x23'),_0x42a33c);return new Promise(function(_0x7a948b,_0x1f12d5){var _0x546b65={'method':'POST','uri':_0x2772fe+_0xac4a('0x24')+_0x116700,'body':{'user_name':_0x42a33c[_0xac4a('0x25')],'roles':_0xac4a('0x26'),'first_name':_0x42a33c[_0xac4a('0x25')],'active':_0xac4a('0x1e'),'date_format':'System','phone':_0x42a33c[_0xac4a('0x25')]},'auth':_0x267a22,'json':!![]};return rp(_0x546b65)['then'](function(_0x30364b){logger['info']('['+[_0x23b061[_0xac4a('0x10')]()]+_0xac4a('0x27'),_0x30364b[_0xac4a('0xd')]);_0x42a33c[_0xac4a('0x28')]=_0x30364b[_0xac4a('0xd')][_0xac4a('0xf')];_0x7a948b(_0x42a33c);})[_0xac4a('0x12')](function(_0x1f13f3){logger[_0xac4a('0x13')]('['+[_0x23b061[_0xac4a('0x10')]()]+']',_0x1f13f3[_0xac4a('0x14')]);_0x1f12d5(_0x1f13f3[_0xac4a('0x14')]);});});}function getEndUser(_0x1a9be2,_0x1a9d4e,_0x5634e2,_0x30442d,_0x1c41fb){return function(_0x5a4e2b){logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x5a4e2b);return new Promise(function(_0x58804b,_0x11f0be){var _0x1ba096={'method':_0xac4a('0xb'),'uri':_0x5634e2+_0xac4a('0x29')+_0x5a4e2b['endUserNumber']+'&'+_0x30442d+'&'+_0x1c41fb,'auth':_0x1a9d4e,'json':!![]};return rp(_0x1ba096)[_0xac4a('0xc')](function(_0x2e56c6){if(_0x2e56c6['result'][_0xac4a('0x1c')]>0x0){_0x5a4e2b[_0xac4a('0x28')]=_0x2e56c6[_0xac4a('0xd')][0x0]['sys_id'];logger[_0xac4a('0x15')]('['+[_0x1a9be2[_0xac4a('0x10')]()]+_0xac4a('0x2a'),_0x5a4e2b);_0x58804b(_0x5a4e2b);}else{return createEndUser(_0x1a9be2,_0x1a9d4e,_0x5a4e2b,_0x5634e2,_0x30442d)['then'](function(_0x35bc94){logger[_0xac4a('0x15')]('['+[_0x1a9be2['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x35bc94);_0x58804b(_0x35bc94);});}})[_0xac4a('0x12')](function(_0x5e0926){logger['error']('['+[_0x1a9be2['toUpperCase']()]+']',_0x5e0926['message']);_0x11f0be(_0x5e0926[_0xac4a('0x14')]);});});};}function getCustomFields(_0x2bf8e8,_0x37834b){var _0x472484={};if(_0x2bf8e8[_0xac4a('0x1c')]>0x0){_[_0xac4a('0x2b')](_0x2bf8e8,function(_0x4220e2){if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x2e')]&&!_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')]['toLowerCase']()]=_0x4220e2['content']['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x2d')&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x4220e2[_0xac4a('0x32')][_0xac4a('0x33')]();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x34')&&_0x4220e2['variableName']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x35')]]['toString']();}else if(_0x4220e2[_0xac4a('0x2c')]===_0xac4a('0x36')&&_0x4220e2['Variable']&&_0x4220e2[_0xac4a('0x37')]['name']&&_0x4220e2[_0xac4a('0x30')]&&_0x4220e2[_0xac4a('0x2f')]){_0x472484[_0x4220e2[_0xac4a('0x30')][_0xac4a('0x31')]()]=_0x37834b[_0x4220e2[_0xac4a('0x37')][_0xac4a('0x38')][_0xac4a('0x31')]()][_0xac4a('0x33')]();}});}return _0x472484;}function getTicket(_0x98e0c4,_0xcb002b,_0x4fa9eb,_0x3b68b3,_0x569812,_0x1646ea){return function(_0x41d11d){logger[_0xac4a('0x15')]('['+[_0x98e0c4['toUpperCase']()]+_0xac4a('0x39'),_0x41d11d);return new Promise(function(_0x19276e,_0x5f54ff){var _0x42969b=_0x98e0c4['toLowerCase']()===_0xac4a('0x3a')?_0x41d11d[_0xac4a('0x1f')]:_0x41d11d[_0xac4a('0x28')];var _0x5e3581={'method':'POST','uri':_0x4fa9eb+_0xac4a('0x3b')+'?'+_0x1646ea,'body':Object['assign']({},{'active':_0xac4a('0x1e'),'caller_id':_0x42969b,'assigned_to':_0x41d11d['userId'],'short_description':intUtil[_0xac4a('0x3c')](_0x3b68b3['Subjects'],_0x569812,'\x20'),'description':intUtil[_0xac4a('0x3c')](_0x3b68b3[_0xac4a('0x3d')],_0x569812,'\x0a')},getCustomFields(_0x3b68b3[_0xac4a('0x3e')],_0x569812)),'auth':_0xcb002b,'json':!![]};return rp(_0x5e3581)[_0xac4a('0xc')](function(_0x54782f){logger[_0xac4a('0x15')]('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x3f'),_0x54782f[_0xac4a('0xd')]);_0x41d11d[_0xac4a('0x40')]=_0x54782f[_0xac4a('0xd')][_0xac4a('0xf')];_0x41d11d['ticketNumber']=_0x54782f[_0xac4a('0xd')][_0xac4a('0x41')];logger['info']('['+[_0x98e0c4[_0xac4a('0x10')]()]+_0xac4a('0x42'),_0x41d11d);_0x19276e(_0x41d11d);})[_0xac4a('0x12')](function(_0x3ac36e){logger['error']('['+[_0x98e0c4[_0xac4a('0x10')]()]+']',_0x3ac36e[_0xac4a('0x14')]);_0x5f54ff(_0x3ac36e[_0xac4a('0x14')]);});});};}function createRemoteTag(_0x129d58,_0x890910,_0x49fbc3,_0x179373){return new Promise(function(_0x564b10,_0x307441){var _0x2c04af={'method':'POST','uri':_0x49fbc3+'label'+'?'+_0x179373,'body':{'short_description':_0x129d58,'global':!![],'active':!![],'name':_0x129d58},'auth':_0x890910,'json':!![]};return rp(_0x2c04af)[_0xac4a('0xc')](function(_0x70fdc3){var _0x4d448f=_0x70fdc3[_0xac4a('0xd')][_0xac4a('0xf')];_0x564b10(_0x4d448f);});});}function getRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6,_0x108f7c){return new Promise(function(_0xb43fdb,_0xb5897b){var _0xdc80e3={'method':_0xac4a('0xb'),'uri':_0x48900f+_0xac4a('0x43')+'?sysparm_query=name%3D'+_0x26b582+'&'+_0x3057d6,'auth':_0x103d05,'json':!![]};return rp(_0xdc80e3)[_0xac4a('0xc')](function(_0xef51d0){if(_0xef51d0[_0xac4a('0xd')][_0xac4a('0x1c')]>0x0){var _0x1b7231=_0xef51d0[_0xac4a('0xd')][0x0][_0xac4a('0xf')];_0xb43fdb(_0x1b7231);}else{return createRemoteTag(_0x26b582,_0x103d05,_0x48900f,_0x3057d6)[_0xac4a('0xc')](function(_0x159e43){_0xb43fdb(_0x159e43);});}});});}function assignTagToIncident(_0x786d9,_0x3b175a,_0x38dd4f,_0x400ac4,_0x2fe7df){return new Promise(function(_0x5222f3,_0x11c753){var _0x492aae={'method':_0xac4a('0x44'),'uri':_0x38dd4f+'label_entry'+'?'+_0x2fe7df,'body':{'label':_0x786d9,'table':_0xac4a('0x3b'),'id_type':'Incident','table_key':_0x400ac4[_0xac4a('0x40')],'title':'Incident\x20-\x20'+_0x400ac4[_0xac4a('0x45')],'id_display':_0x400ac4['ticketNumber']},'auth':_0x3b175a,'json':!![]};return rp(_0x492aae)['then'](function(_0x52c957){_0x5222f3();})[_0xac4a('0x12')](function(){_0x5222f3();});});}function manageTags(_0x3bcae2,_0x3c2f84,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa,_0x50dece){return new Promise(function(_0x34215e,_0x5d03e5){var _0x347880=[];_0x3c2f84[_0xac4a('0x2b')](function(_0x3da7e7){_0x347880[_0xac4a('0x46')](getRemoteTag(_0x3da7e7,_0x2f9940,_0xb7b884,_0x1e1ffa,_0x50dece));});return Promise[_0xac4a('0x47')](_0x347880)[_0xac4a('0xc')](function(_0x3abd57){if(_0x3abd57[_0xac4a('0x1c')]){logger[_0xac4a('0x15')]('['+[_0x3bcae2[_0xac4a('0x10')]()]+_0xac4a('0x48'),_0x3abd57);var _0x2498ad=[];_0x3abd57[_0xac4a('0x2b')](function(_0x2cc410){_0x2498ad[_0xac4a('0x46')](assignTagToIncident(_0x2cc410,_0x2f9940,_0xb7b884,_0x592a4b,_0x1e1ffa));});return Promise[_0xac4a('0x47')](_0x2498ad)[_0xac4a('0xc')](function(){_0x34215e();})['catch'](function(){_0x34215e();});}else{_0x34215e();}});});}function getTags(_0xa90d71,_0x1672c0,_0x4fb812,_0x3c3576,_0x34bd1c,_0x2d24c7){return function(_0x2b8562){return new Promise(function(_0x357cac,_0x4d1440){var _0x47c6d8=[];var _0x45f3c3=_0x3c3576[_0xac4a('0x49')];if(_0x45f3c3&&_0x45f3c3[_0xac4a('0x1c')]>0x0){_0x47c6d8=_[_0xac4a('0x4a')](_0x45f3c3,_0xac4a('0x38'));}if(_0x47c6d8[_0xac4a('0x1c')]>0x0){return manageTags(_0xa90d71,_0x47c6d8,_0x1672c0,_0x4fb812,_0x2b8562,_0x34bd1c,_0x2d24c7)[_0xac4a('0xc')](function(){_0x357cac(_0x2b8562);});}else{_0x357cac(_0x2b8562);}});};}function emit(_0x2988d7,_0x44c60b,_0x295f21){var _0x278c09='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xac4a('0x4b')+_0xac4a('0x4c');var _0x2954fc={'uri':_0x2988d7+_0xac4a('0x4d')+_0x295f21+_0x278c09};io['to'](util[_0xac4a('0x4e')](_0xac4a('0x4f'),_0x44c60b))[_0xac4a('0x50')](_0xac4a('0x51'),_0x2954fc);}exports['cs']=function(_0x453d62,_0x2a5acc,_0xb09b89,_0xb12cc5,_0x5f0173,_0x13c854,_0xc74ce8,_0x26bd31){var _0x231932={};var _0x513976={'user':_0x13c854[_0xac4a('0x52')],'pass':_0x13c854['password']};var _0xab4305=_0xac4a('0x53');var _0x499abc='sysparm_display_value=true';_0x13c854[_0xac4a('0x54')]=intUtil[_0xac4a('0x55')](_0x13c854[_0xac4a('0x54')]);_0x13c854['serverUrl']=intUtil[_0xac4a('0x55')](_0x13c854['serverUrl']);var _0x114b11=util['format']('%s/api/now/table/',_0x13c854[_0xac4a('0x54')]);_0x231932['userEmail']=!_[_0xac4a('0x56')](_0xb12cc5)?_0xb12cc5['email']:null;_0x231932[_0xac4a('0x20')]=_0x13c854[_0xac4a('0x57')];_0x231932['endUserNumber']=_0x26bd31[_0xac4a('0x31')]()==='outbound'?_0x2a5acc[_0xac4a('0x58')]:_0x2a5acc[_0xac4a('0x59')];_0x231932['callDirection']=_0x26bd31===_0xac4a('0x5a')||_0x26bd31==='unmanaged'?'queue':_0xac4a('0x3a');var _0x4e3129=util[_0xac4a('0x4e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13c854['serverUrl'],_0x2a5acc[_0xac4a('0x5b')],md5(_0x2a5acc[_0xac4a('0x5b')]));if(_0x5f0173&&_0x5f0173[_0xac4a('0x5c')]){logger['info']('[QUEUE]',_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else if(_0xc74ce8&&_0xc74ce8['recordingFormat']&&_0xc74ce8['recordingFormat']!==_0xac4a('0x5f')){logger[_0xac4a('0x15')](_0xac4a('0x60'),_0xac4a('0x5d'));_0x2a5acc[_0xac4a('0x5e')]=_0x4e3129;}else{_0x2a5acc[_0xac4a('0x5e')]='';}return getAdminUser(_0x26bd31,_0x513976,_0x231932,_0x114b11,_0x499abc,_0xab4305)[_0xac4a('0xc')](getUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getEndUser(_0x26bd31,_0x513976,_0x114b11,_0x499abc,_0xab4305))[_0xac4a('0xc')](getTicket(_0x26bd31,_0x513976,_0x114b11,_0xb09b89,_0x2a5acc,_0x499abc))['then'](function(_0x1201e8){logger[_0xac4a('0x15')](util[_0xac4a('0x4e')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1201e8[_0xac4a('0x40')]));logger[_0xac4a('0x15')](util[_0xac4a('0x4e')](_0xac4a('0x61'),_0x26bd31));if(_0x26bd31!==_0xac4a('0x62')){logger['info']('['+[_0x26bd31[_0xac4a('0x10')]()]+']',_0xac4a('0x63'));emit(_0x13c854[_0xac4a('0x54')],_0xb12cc5[_0xac4a('0x38')],_0x1201e8[_0xac4a('0x40')]);}})[_0xac4a('0x12')](function(_0xd7bdd6){logger['error']('['+[_0x26bd31[_0xac4a('0x10')]()]+_0xac4a('0x64'),util[_0xac4a('0x65')](_0xd7bdd6,{'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 bddf575..de1b2f4 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 _0xe574=['unmanaged','lastevent','toUpperCase','isNil','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','replace','duration_minutes','parent_id','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','custom_fields','content','variable','customVariable','Variable','toLowerCase','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Inbound','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s'];(function(_0x2700c5,_0x455b18){var _0x2d95a3=function(_0x67aa81){while(--_0x67aa81){_0x2700c5['push'](_0x2700c5['shift']());}};_0x2d95a3(++_0x455b18);}(_0xe574,0x100));var _0x4e57=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe574[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x4e57('0x0'));var rp=require('request-promise');var BPromise=require(_0x4e57('0x1'));var md5=require(_0x4e57('0x2'));var util=require(_0x4e57('0x3'));var Redis=require(_0x4e57('0x4'));var intUtil=require(_0x4e57('0x5'));var config=require(_0x4e57('0x6'));var logger=require(_0x4e57('0x7'))(_0x4e57('0x8'));config[_0x4e57('0x9')]=_[_0x4e57('0xa')](config[_0x4e57('0x9')],{'host':_0x4e57('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x4e57('0xc'),'json':!![]};function emit(_0x534df1,_0x5274e7,_0x846d2f){io['to'](_0x534df1)[_0x4e57('0xd')](_0x5274e7,_0x846d2f);}function getTicket(_0x3a8f52,_0x1a1afa,_0x26a43d,_0x53e34a,_0x251aac,_0x2dbdd5,_0x3393ce,_0x1e9cf8){logger[_0x4e57('0xe')](_0x4e57('0xf'));var _0x29bacb=new Date();var _0x21db21=[{'name':_0x4e57('0x10'),'value':intUtil[_0x4e57('0x11')](_0x53e34a[_0x4e57('0x12')],_0x251aac,'\x20')},{'name':_0x4e57('0x13'),'value':_0x1a1afa['id']},{'name':_0x4e57('0x14'),'value':_0x1a1afa['id']},{'name':_0x4e57('0x15'),'value':intUtil[_0x4e57('0x11')](_0x53e34a[_0x4e57('0x16')],_0x251aac,'\x0a')},{'name':'date_start','value':_0x29bacb[_0x4e57('0x17')]()['slice'](0x0,0x13)[_0x4e57('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4e57('0x19'),'value':'15'},{'name':_0x4e57('0x1a'),'value':_0x26a43d['id']},{'name':'parent_type','value':_0x4e57('0x1b')},{'name':_0x4e57('0x1c'),'value':_0x26a43d[_0x4e57('0x10')]},{'name':_0x4e57('0x1d'),'value':_0x1e9cf8}];if(_0x2dbdd5['length']){_[_0x4e57('0x1e')](_0x2dbdd5,function(_0xca7317){if(_0x251aac[_0xca7317[_0x4e57('0x1f')]]){_0x21db21[_0x4e57('0x20')]({'name':_0xca7317[_0x4e57('0x21')],'value':_0x251aac[_0xca7317['variableName']]});}});}return request({'form':{'method':_0x4e57('0x22'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'session':_0x3393ce['id'],'module_name':'Calls','name_value_list':_0x21db21})}});}function getAuth(_0x372295){return util['format'](_0x4e57('0x25'),new Buffer(_0x372295['apiKey']+':X')[_0x4e57('0x26')](_0x4e57('0x27')));}function getServerInfo(_0x427c6b){return request({'form':{'method':_0x4e57('0x28'),'input_type':_0x4e57('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x427c6b['id']})}});}function getUser(_0x17e309,_0x58d6ea,_0x315f7c){if(!_['isNil'](_0x58d6ea)){logger[_0x4e57('0xe')](_0x4e57('0x29'),_0x58d6ea);return request({'form':{'method':_0x4e57('0x2a'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'session':_0x315f7c['id'],'module_name':'Employees','query':util[_0x4e57('0x2b')](_0x4e57('0x2c'),_0x58d6ea),'order_by':'','offset':'0','select_fields':['id','name',_0x4e57('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4e57('0x2e')](function(_0x24b9b5){if(_0x24b9b5[_0x4e57('0x2f')][_0x4e57('0x30')]){var _0x26e851=_[_0x4e57('0x31')](_0x24b9b5['entry_list'],function(_0x1a26f6){return _0x1a26f6[_0x4e57('0x32')][_0x4e57('0x2d')][_0x4e57('0x33')]===_0x58d6ea;});if(_0x26e851){logger[_0x4e57('0xe')]('Agent\x20found!');return BPromise['resolve']({'id':_0x26e851[_0x4e57('0x32')]['id'][_0x4e57('0x33')],'name':_0x26e851[_0x4e57('0x32')][_0x4e57('0x10')]['value']});}}logger[_0x4e57('0xe')](_0x4e57('0x34'));return BPromise[_0x4e57('0x35')]({'id':_0x315f7c[_0x4e57('0x32')][_0x4e57('0x36')]['value'],'name':_0x315f7c[_0x4e57('0x32')][_0x4e57('0x2d')]['value']});});}else{logger[_0x4e57('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x315f7c[_0x4e57('0x32')][_0x4e57('0x36')][_0x4e57('0x33')],'name':_0x315f7c['name_value_list'][_0x4e57('0x2d')]['value']});}}function getEndUser(_0x292039,_0x1b2042,_0x22fcdf,_0x5a3da5){logger[_0x4e57('0xe')](_0x4e57('0x37'),_0x22fcdf);return request({'form':{'method':_0x4e57('0x2a'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'session':_0x5a3da5['id'],'module_name':_0x4e57('0x1b'),'query':util[_0x4e57('0x2b')](_0x4e57('0x38'),_0x22fcdf),'order_by':'','offset':'0','select_fields':['id',_0x4e57('0x10'),_0x4e57('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2f1a6e){if(_0x2f1a6e['entry_list'][_0x4e57('0x30')]){var _0x270d2a=_[_0x4e57('0x31')](_0x2f1a6e[_0x4e57('0x2f')],function(_0x5383b8){return _0x5383b8['name_value_list'][_0x4e57('0x39')][_0x4e57('0x33')]===_0x22fcdf;});if(_0x270d2a){logger[_0x4e57('0xe')](_0x4e57('0x3a'));return BPromise[_0x4e57('0x35')]({'id':_0x270d2a[_0x4e57('0x32')]['id'][_0x4e57('0x33')],'name':_0x270d2a[_0x4e57('0x32')][_0x4e57('0x10')]['value'],'phone':_0x270d2a[_0x4e57('0x32')]['phone_home'][_0x4e57('0x33')]});}}else{logger[_0x4e57('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x4e57('0x22'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'session':_0x5a3da5['id'],'module_name':_0x4e57('0x1b'),'name_value_list':[{'name':_0x4e57('0x3b'),'value':_0x1b2042!==_0x4e57('0x3c')?_0x1b2042:util['format'](_0x4e57('0x3d'),_0x22fcdf)},{'name':_0x4e57('0x39'),'value':_0x22fcdf}]})}})['then'](function(_0x354e59){logger[_0x4e57('0xe')](_0x4e57('0x3e'));return BPromise[_0x4e57('0x35')]({'id':_0x354e59['id'],'name':_0x354e59[_0x4e57('0x2f')][_0x4e57('0x3b')]['value'],'phone':_0x354e59[_0x4e57('0x2f')][_0x4e57('0x39')][_0x4e57('0x33')]});});}});}function request(_0x330da6){logger[_0x4e57('0x3f')](_0x4e57('0x40'),JSON[_0x4e57('0x24')](_0x330da6));return rp(_['merge'](def,_0x330da6));}function getTags(_0x4434ed,_0x3a86eb){var _0x97c403=[];if(_0x4434ed&&_0x4434ed[_0x4e57('0x30')]>0x0){_0x97c403=_[_0x4e57('0x41')](_0x4434ed,_0x3a86eb);}return _0x97c403;}function getCustomFields(_0x574bfd,_0x31ebda){var _0x68fc69=[];var _0x16c319={'custom_fields':[]};if(_0x574bfd[_0x4e57('0x30')]>0x0){_[_0x4e57('0x1e')](_0x574bfd,function(_0x468734){if(_0x468734[_0x4e57('0x42')]===_0x4e57('0x43')&&_0x468734[_0x4e57('0x44')]&&!_0x468734[_0x4e57('0x45')]){_0x16c319[_0x468734['nameField']['toLowerCase']()]=_0x468734['content'][_0x4e57('0x26')]();}else if(_0x468734[_0x4e57('0x42')]===_0x4e57('0x43')&&_0x468734[_0x4e57('0x21')]&&_0x468734[_0x4e57('0x45')]){_0x16c319[_0x4e57('0x46')][_0x4e57('0x20')]({'id':_0x468734[_0x4e57('0x21')],'value':_0x468734[_0x4e57('0x47')][_0x4e57('0x26')]()});}else if(_0x468734[_0x4e57('0x42')]===_0x4e57('0x48')&&_0x468734[_0x4e57('0x1f')]&&_0x468734['idField']&&_0x468734[_0x4e57('0x45')]){_0x31ebda[_0x468734[_0x4e57('0x1f')]]&&_0x16c319[_0x4e57('0x46')][_0x4e57('0x20')]({'id':_0x468734[_0x4e57('0x21')],'value':_0x31ebda[_0x468734[_0x4e57('0x1f')]]['toString']()});}else if(_0x468734[_0x4e57('0x42')]===_0x4e57('0x49')&&_0x468734[_0x4e57('0x4a')]&&_0x468734[_0x4e57('0x4a')][_0x4e57('0x10')]&&_0x468734[_0x4e57('0x21')]&&_0x468734[_0x4e57('0x45')]){_0x31ebda[_0x468734[_0x4e57('0x4a')]['name'][_0x4e57('0x4b')]()]&&_0x16c319['custom_fields'][_0x4e57('0x20')]({'id':_0x468734[_0x4e57('0x21')],'value':_0x31ebda[_0x468734[_0x4e57('0x4a')]['name'][_0x4e57('0x4b')]()]['toString']()});}});}return _0x16c319;}function getConnection(_0x99e283){return request({'method':_0x4e57('0xc'),'form':{'method':_0x4e57('0x4c'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'user_auth':{'user_name':_0x99e283[_0x4e57('0x4d')],'password':_0x99e283['password'],'encryption':'PLAIN'},'application':_0x4e57('0x4e')})}})[_0x4e57('0x2e')](function(_0x2fa5a2){var _0x487bd7=_0x2fa5a2;if(_0x487bd7['id']){def[_0x4e57('0x4f')]=_0x487bd7['id'];return BPromise[_0x4e57('0x35')](_0x487bd7);}else{throw new Error(util[_0x4e57('0x2b')](_0x4e57('0x50'),_0x99e283['id']));}});}function setRelationship(_0x5b6817,_0x418f3b,_0x5265c0,_0x56c9c8){return request({'form':{'method':_0x4e57('0x51'),'input_type':_0x4e57('0x23'),'response_type':_0x4e57('0x23'),'rest_data':JSON[_0x4e57('0x24')]({'session':_0x5b6817['id'],'module_name':_0x4e57('0x52'),'module_id':_0x5265c0['id'],'link_field_name':_0x56c9c8,'related_ids':[_0x418f3b['id']]})}});}exports[_0x4e57('0x53')]=function(_0x39fc1d,_0x1c0e45,_0x279383,_0x454d02,_0x3405cb,_0x2b9f6e){var _0x3bde0d,_0x5a3874,_0x2b0f76,_0x366c04;_0x2b9f6e[_0x4e57('0x54')]=intUtil['stripTrailingSlash'](_0x2b9f6e[_0x4e57('0x54')]);_0x2b9f6e[_0x4e57('0x55')]=intUtil[_0x4e57('0x56')](_0x2b9f6e[_0x4e57('0x55')]);def[_0x4e57('0x57')]=util[_0x4e57('0x2b')](_0x4e57('0x58'),_0x2b9f6e[_0x4e57('0x54')]);if(_0x3405cb&&_0x3405cb[_0x4e57('0x59')]){logger['info'](_0x4e57('0x5a'),_0x4e57('0x5b'));_0x1c0e45[_0x4e57('0x5c')]=util[_0x4e57('0x2b')](_0x4e57('0x5d'),_0x2b9f6e[_0x4e57('0x55')],_0x1c0e45['uniqueid'],md5(_0x1c0e45[_0x4e57('0x5e')]));}else{_0x1c0e45[_0x4e57('0x5c')]='';}return getConnection(_0x2b9f6e)[_0x4e57('0x2e')](function(_0x90e693){_0x366c04=_0x90e693;return getUser(_0x2b9f6e,_0x454d02[_0x4e57('0x10')],_0x366c04);})[_0x4e57('0x2e')](function(_0x464f6c){_0x3bde0d=_0x464f6c;logger[_0x4e57('0xe')]('The\x20User\x20ID\x20is:',_0x3bde0d['id']);return getEndUser(_0x2b9f6e,_0x1c0e45[_0x4e57('0x5f')],_0x1c0e45['calleridnum'],_0x366c04);})[_0x4e57('0x2e')](function(_0x3c8a3a){_0x5a3874=_0x3c8a3a;logger[_0x4e57('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5a3874['id']);return getTicket(_0x2b9f6e,_0x3bde0d,_0x5a3874,_0x279383,_0x1c0e45,_0x279383['Fields'],_0x366c04,_0x4e57('0x60'));})['then'](function(_0xb17d2){_0x2b0f76=_0xb17d2;logger[_0x4e57('0xe')]('Ticket\x20created!');logger[_0x4e57('0xe')](_0x4e57('0x61'),_0x2b0f76['id']);return setRelationship(_0x366c04,_0x3bde0d,_0x2b0f76,'users');})[_0x4e57('0x2e')](function(){return setRelationship(_0x366c04,_0x5a3874,_0x2b0f76,_0x4e57('0x62'));})['then'](function(){return getServerInfo(_0x366c04);})[_0x4e57('0x2e')](function(_0xaac36f){var _0x631f0b=parseInt(_0xaac36f[_0x4e57('0x63')][_0x4e57('0x64')](0x0));var _0xfa4dc0=util['format'](_0x4e57('0x65'),_0x2b9f6e['remoteUri'],_0x2b0f76['id']);if(_0x631f0b>0x6){_0xfa4dc0=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2b9f6e['remoteUri'],_0x2b0f76['id']);}logger[_0x4e57('0xe')](_0x4e57('0x5a'),_0x4e57('0x66'));emit(util[_0x4e57('0x2b')](_0x4e57('0x67'),_0x454d02[_0x4e57('0x10')]),_0x4e57('0x68'),{'uri':_0xfa4dc0});})[_0x4e57('0x69')](function(_0x31fe1a){logger[_0x4e57('0x6a')](_0x4e57('0x5a'),JSON['stringify'](_0x31fe1a));});};exports[_0x4e57('0x6b')]=function(_0x25b123,_0x3f8f1e,_0x102fd3,_0x2e74f0,_0x2a57e6,_0x4b47e2,_0x2a5cc5){var _0x36ac99,_0x5d82a2,_0x33476d,_0xf82214;_0x4b47e2[_0x4e57('0x54')]=intUtil[_0x4e57('0x56')](_0x4b47e2[_0x4e57('0x54')]);_0x4b47e2['serverUrl']=intUtil[_0x4e57('0x56')](_0x4b47e2[_0x4e57('0x55')]);def['uri']=util[_0x4e57('0x2b')](_0x4e57('0x58'),_0x4b47e2[_0x4e57('0x54')]);if(_0x2a5cc5&&_0x2a5cc5[_0x4e57('0x6c')]&&_0x2a5cc5[_0x4e57('0x6c')]!==_0x4e57('0x6d')){logger[_0x4e57('0xe')](_0x4e57('0x6e'),_0x4e57('0x5b'));_0x3f8f1e['recordingURL']=util[_0x4e57('0x2b')](_0x4e57('0x5d'),_0x4b47e2[_0x4e57('0x55')],_0x3f8f1e[_0x4e57('0x5e')],md5(_0x3f8f1e[_0x4e57('0x5e')]));}return getConnection(_0x4b47e2)[_0x4e57('0x2e')](function(_0x5b9e3c){_0xf82214=_0x5b9e3c;return getUser(_0x4b47e2,_0x2e74f0[_0x4e57('0x10')],_0xf82214);})['then'](function(_0x3957e1){_0x36ac99=_0x3957e1;logger[_0x4e57('0xe')]('The\x20User\x20ID\x20is:',_0x36ac99['id']);return getEndUser(_0x4b47e2,_0x3f8f1e[_0x4e57('0x6f')],_0x3f8f1e['destcalleridnum'],_0xf82214);})[_0x4e57('0x2e')](function(_0x5f1b0a){_0x5d82a2=_0x5f1b0a;logger[_0x4e57('0xe')](_0x4e57('0x70'),_0x5d82a2['id']);return getTicket(_0x4b47e2,_0x36ac99,_0x5d82a2,_0x102fd3,_0x3f8f1e,_0x102fd3['Fields'],_0xf82214,_0x4e57('0x71'));})[_0x4e57('0x2e')](function(_0x20f010){_0x33476d=_0x20f010;logger[_0x4e57('0xe')]('Ticket\x20created!');logger[_0x4e57('0xe')]('The\x20Ticket\x20ID\x20is:',_0x33476d['id']);return setRelationship(_0xf82214,_0x36ac99,_0x33476d,_0x4e57('0x72'));})['then'](function(){return setRelationship(_0xf82214,_0x5d82a2,_0x33476d,_0x4e57('0x62'));})[_0x4e57('0x2e')](function(){return getServerInfo(_0xf82214);})['then'](function(_0x2f6713){var _0x34e0aa=parseInt(_0x2f6713[_0x4e57('0x63')][_0x4e57('0x64')](0x0));var _0x3400fc=util['format'](_0x4e57('0x65'),_0x4b47e2[_0x4e57('0x54')],_0x33476d['id']);if(_0x34e0aa>0x6){_0x3400fc=util[_0x4e57('0x2b')](_0x4e57('0x73'),_0x4b47e2[_0x4e57('0x54')],_0x33476d['id']);}logger[_0x4e57('0xe')](_0x4e57('0x6e'),_0x4e57('0x66'));emit(util[_0x4e57('0x2b')](_0x4e57('0x67'),_0x2e74f0[_0x4e57('0x10')]),_0x4e57('0x68'),{'uri':_0x3400fc});})[_0x4e57('0x69')](function(_0x15c88a){logger[_0x4e57('0x6a')](_0x4e57('0x6e'),JSON[_0x4e57('0x24')](_0x15c88a));});};exports[_0x4e57('0x74')]=function(_0x9c03f2,_0x14d4c3,_0x23312e,_0x3bfb67,_0x4c48af,_0x56cc80){var _0x3050db,_0x3f089f,_0x10d456,_0x1a5f46;_0x56cc80[_0x4e57('0x54')]=intUtil[_0x4e57('0x56')](_0x56cc80[_0x4e57('0x54')]);_0x56cc80[_0x4e57('0x55')]=intUtil[_0x4e57('0x56')](_0x56cc80[_0x4e57('0x55')]);def['uri']=util['format'](_0x4e57('0x58'),_0x56cc80[_0x4e57('0x54')]);if(_0x4c48af&&_0x4c48af[_0x4e57('0x59')]){logger[_0x4e57('0xe')]('['+_0x14d4c3[_0x4e57('0x75')][_0x4e57('0x76')]()+']','Recording\x20is\x20enabled!');_0x14d4c3[_0x4e57('0x5c')]=util[_0x4e57('0x2b')](_0x4e57('0x5d'),_0x56cc80[_0x4e57('0x55')],_0x14d4c3[_0x4e57('0x5e')],md5(_0x14d4c3[_0x4e57('0x5e')]));}else{_0x14d4c3['recordingURL']='';}return getConnection(_0x56cc80)[_0x4e57('0x2e')](function(_0x2e1f49){_0x1a5f46=_0x2e1f49;if(!_[_0x4e57('0x77')](_0x3bfb67)){return getUser(_0x56cc80,_0x3bfb67[_0x4e57('0x10')],_0x1a5f46);}else{return getUser(_0x56cc80,null,_0x1a5f46);}})[_0x4e57('0x2e')](function(_0x4469d4){_0x3050db=_0x4469d4;logger[_0x4e57('0xe')](_0x4e57('0x78'),_0x3050db['id']);return getEndUser(_0x56cc80,_0x14d4c3[_0x4e57('0x5f')],_0x14d4c3[_0x4e57('0x79')],_0x1a5f46);})[_0x4e57('0x2e')](function(_0x52f55d){_0x3f089f=_0x52f55d;logger[_0x4e57('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3f089f['id']);return getTicket(_0x56cc80,_0x3050db,_0x3f089f,_0x23312e,_0x14d4c3,_0x23312e[_0x4e57('0x7a')],_0x1a5f46,_0x4e57('0x60'));})['then'](function(_0x19b419){_0x10d456=_0x19b419;logger[_0x4e57('0xe')](_0x4e57('0x7b'));logger[_0x4e57('0xe')](_0x4e57('0x61'),_0x10d456['id']);return setRelationship(_0x1a5f46,_0x3050db,_0x10d456,_0x4e57('0x72'));})['then'](function(){return setRelationship(_0x1a5f46,_0x3f089f,_0x10d456,'contacts');})['then'](function(){return getServerInfo(_0x1a5f46);})[_0x4e57('0x69')](function(_0x18d9df){logger[_0x4e57('0x6a')]('['+_0x14d4c3[_0x4e57('0x75')]['toUpperCase']()+']',JSON[_0x4e57('0x24')](_0x18d9df));});}; \ No newline at end of file +var _0x6cfd=['emit','info','Creating\x20new\x20ticket...','getString','Subjects','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','forEach','variableName','idField','set_entry','JSON','stringify','format','apiKey','toString','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','user_name','Agent\x20found!','name_value_list','value','name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','map','type','string','customField','nameField','toLowerCase','content','push','variable','custom_fields','customVariable','Variable','POST','login','username','PLAIN','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','lastevent','toUpperCase','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','localhost'];(function(_0x59e0ba,_0x58fbb9){var _0x41b10a=function(_0x3219bb){while(--_0x3219bb){_0x59e0ba['push'](_0x59e0ba['shift']());}};_0x41b10a(++_0x58fbb9);}(_0x6cfd,0x1b7));var _0xd6cf=function(_0x4fb6b4,_0x1814dd){_0x4fb6b4=_0x4fb6b4-0x0;var _0x960098=_0x6cfd[_0x4fb6b4];return _0x960098;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0xd6cf('0x0'));var md5=require(_0xd6cf('0x1'));var util=require(_0xd6cf('0x2'));var Redis=require(_0xd6cf('0x3'));var intUtil=require(_0xd6cf('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd6cf('0x5'))(_0xd6cf('0x6'));config[_0xd6cf('0x7')]=_['defaults'](config[_0xd6cf('0x7')],{'host':_0xd6cf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd6cf('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x362863,_0x2cfbf0,_0x44e077){io['to'](_0x362863)[_0xd6cf('0x9')](_0x2cfbf0,_0x44e077);}function getTicket(_0x367e5e,_0xd5929f,_0xa0ee7d,_0x2f638a,_0x2c99e8,_0x53528f,_0x45aea4,_0x527f5d){logger[_0xd6cf('0xa')](_0xd6cf('0xb'));var _0x2dfa66=new Date();var _0x3ab6b4=[{'name':'name','value':intUtil[_0xd6cf('0xc')](_0x2f638a[_0xd6cf('0xd')],_0x2c99e8,'\x20')},{'name':'assigned_user_id','value':_0xd5929f['id']},{'name':'created_by','value':_0xd5929f['id']},{'name':'description','value':intUtil[_0xd6cf('0xc')](_0x2f638a['Descriptions'],_0x2c99e8,'\x0a')},{'name':'date_start','value':_0x2dfa66[_0xd6cf('0xe')]()[_0xd6cf('0xf')](0x0,0x13)[_0xd6cf('0x10')]('T','\x20')},{'name':_0xd6cf('0x11'),'value':'0'},{'name':_0xd6cf('0x12'),'value':'15'},{'name':_0xd6cf('0x13'),'value':_0xa0ee7d['id']},{'name':_0xd6cf('0x14'),'value':_0xd6cf('0x15')},{'name':_0xd6cf('0x16'),'value':_0xa0ee7d['name']},{'name':'direction','value':_0x527f5d}];if(_0x53528f[_0xd6cf('0x17')]){_[_0xd6cf('0x18')](_0x53528f,function(_0x54b83a){if(_0x2c99e8[_0x54b83a[_0xd6cf('0x19')]]){_0x3ab6b4['push']({'name':_0x54b83a[_0xd6cf('0x1a')],'value':_0x2c99e8[_0x54b83a[_0xd6cf('0x19')]]});}});}return request({'form':{'method':_0xd6cf('0x1b'),'input_type':_0xd6cf('0x1c'),'response_type':'JSON','rest_data':JSON[_0xd6cf('0x1d')]({'session':_0x45aea4['id'],'module_name':'Calls','name_value_list':_0x3ab6b4})}});}function getAuth(_0x309d36){return util[_0xd6cf('0x1e')]('Basic\x20%s',new Buffer(_0x309d36[_0xd6cf('0x1f')]+':X')[_0xd6cf('0x20')]('base64'));}function getServerInfo(_0x5f1d27){return request({'form':{'method':_0xd6cf('0x21'),'input_type':_0xd6cf('0x1c'),'response_type':_0xd6cf('0x1c'),'rest_data':JSON[_0xd6cf('0x1d')]({'session':_0x5f1d27['id']})}});}function getUser(_0x3c98ce,_0x528793,_0x163abf){if(!_[_0xd6cf('0x22')](_0x528793)){logger[_0xd6cf('0xa')](_0xd6cf('0x23'),_0x528793);return request({'form':{'method':_0xd6cf('0x24'),'input_type':_0xd6cf('0x1c'),'response_type':_0xd6cf('0x1c'),'rest_data':JSON[_0xd6cf('0x1d')]({'session':_0x163abf['id'],'module_name':'Employees','query':util[_0xd6cf('0x1e')](_0xd6cf('0x25'),_0x528793),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x784f92){if(_0x784f92[_0xd6cf('0x26')][_0xd6cf('0x17')]){var _0x4bdc43=_['find'](_0x784f92[_0xd6cf('0x26')],function(_0x3483b7){return _0x3483b7['name_value_list'][_0xd6cf('0x27')]['value']===_0x528793;});if(_0x4bdc43){logger[_0xd6cf('0xa')](_0xd6cf('0x28'));return BPromise['resolve']({'id':_0x4bdc43[_0xd6cf('0x29')]['id'][_0xd6cf('0x2a')],'name':_0x4bdc43[_0xd6cf('0x29')][_0xd6cf('0x2b')][_0xd6cf('0x2a')]});}}logger['info'](_0xd6cf('0x2c'));return BPromise[_0xd6cf('0x2d')]({'id':_0x163abf['name_value_list']['user_id']['value'],'name':_0x163abf[_0xd6cf('0x29')][_0xd6cf('0x27')][_0xd6cf('0x2a')]});});}else{logger['info'](_0xd6cf('0x2e'));return BPromise[_0xd6cf('0x2d')]({'id':_0x163abf[_0xd6cf('0x29')][_0xd6cf('0x2f')][_0xd6cf('0x2a')],'name':_0x163abf[_0xd6cf('0x29')][_0xd6cf('0x27')][_0xd6cf('0x2a')]});}}function getEndUser(_0x37dc5b,_0x1e08e9,_0x371745,_0x3019d9){logger[_0xd6cf('0xa')](_0xd6cf('0x30'),_0x371745);return request({'form':{'method':_0xd6cf('0x24'),'input_type':_0xd6cf('0x1c'),'response_type':_0xd6cf('0x1c'),'rest_data':JSON[_0xd6cf('0x1d')]({'session':_0x3019d9['id'],'module_name':'Contacts','query':util[_0xd6cf('0x1e')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x371745),'order_by':'','offset':'0','select_fields':['id','name',_0xd6cf('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd6cf('0x32')](function(_0x27fd26){if(_0x27fd26['entry_list'][_0xd6cf('0x17')]){var _0x39ef1b=_[_0xd6cf('0x33')](_0x27fd26[_0xd6cf('0x26')],function(_0x3a4555){return _0x3a4555[_0xd6cf('0x29')]['phone_home']['value']===_0x371745;});if(_0x39ef1b){logger[_0xd6cf('0xa')](_0xd6cf('0x34'));return BPromise[_0xd6cf('0x2d')]({'id':_0x39ef1b['name_value_list']['id']['value'],'name':_0x39ef1b[_0xd6cf('0x29')][_0xd6cf('0x2b')][_0xd6cf('0x2a')],'phone':_0x39ef1b[_0xd6cf('0x29')][_0xd6cf('0x31')][_0xd6cf('0x2a')]});}}else{logger[_0xd6cf('0xa')](_0xd6cf('0x35'));return request({'form':{'method':_0xd6cf('0x1b'),'input_type':'JSON','response_type':_0xd6cf('0x1c'),'rest_data':JSON[_0xd6cf('0x1d')]({'session':_0x3019d9['id'],'module_name':_0xd6cf('0x15'),'name_value_list':[{'name':_0xd6cf('0x36'),'value':_0x1e08e9!==''?_0x1e08e9:util[_0xd6cf('0x1e')]('Caller\x20-\x20%s',_0x371745)},{'name':_0xd6cf('0x31'),'value':_0x371745}]})}})[_0xd6cf('0x32')](function(_0x4a7298){logger[_0xd6cf('0xa')](_0xd6cf('0x37'));return BPromise[_0xd6cf('0x2d')]({'id':_0x4a7298['id'],'name':_0x4a7298[_0xd6cf('0x26')]['first_name']['value'],'phone':_0x4a7298[_0xd6cf('0x26')][_0xd6cf('0x31')]['value']});});}});}function request(_0x53d9d5){logger[_0xd6cf('0x38')](_0xd6cf('0x39'),JSON[_0xd6cf('0x1d')](_0x53d9d5));return rp(_['merge'](def,_0x53d9d5));}function getTags(_0x52d417,_0x2f4934){var _0x37c3c8=[];if(_0x52d417&&_0x52d417[_0xd6cf('0x17')]>0x0){_0x37c3c8=_[_0xd6cf('0x3a')](_0x52d417,_0x2f4934);}return _0x37c3c8;}function getCustomFields(_0x34683b,_0x42f96d){var _0x58036b=[];var _0x3c6efc={'custom_fields':[]};if(_0x34683b[_0xd6cf('0x17')]>0x0){_['forEach'](_0x34683b,function(_0x18ead2){if(_0x18ead2[_0xd6cf('0x3b')]===_0xd6cf('0x3c')&&_0x18ead2['nameField']&&!_0x18ead2[_0xd6cf('0x3d')]){_0x3c6efc[_0x18ead2[_0xd6cf('0x3e')][_0xd6cf('0x3f')]()]=_0x18ead2[_0xd6cf('0x40')]['toString']();}else if(_0x18ead2['type']===_0xd6cf('0x3c')&&_0x18ead2[_0xd6cf('0x1a')]&&_0x18ead2[_0xd6cf('0x3d')]){_0x3c6efc['custom_fields'][_0xd6cf('0x41')]({'id':_0x18ead2[_0xd6cf('0x1a')],'value':_0x18ead2[_0xd6cf('0x40')][_0xd6cf('0x20')]()});}else if(_0x18ead2['type']===_0xd6cf('0x42')&&_0x18ead2['variableName']&&_0x18ead2[_0xd6cf('0x1a')]&&_0x18ead2[_0xd6cf('0x3d')]){_0x42f96d[_0x18ead2[_0xd6cf('0x19')]]&&_0x3c6efc[_0xd6cf('0x43')][_0xd6cf('0x41')]({'id':_0x18ead2[_0xd6cf('0x1a')],'value':_0x42f96d[_0x18ead2[_0xd6cf('0x19')]][_0xd6cf('0x20')]()});}else if(_0x18ead2['type']===_0xd6cf('0x44')&&_0x18ead2[_0xd6cf('0x45')]&&_0x18ead2[_0xd6cf('0x45')][_0xd6cf('0x2b')]&&_0x18ead2[_0xd6cf('0x1a')]&&_0x18ead2[_0xd6cf('0x3d')]){_0x42f96d[_0x18ead2['Variable'][_0xd6cf('0x2b')][_0xd6cf('0x3f')]()]&&_0x3c6efc[_0xd6cf('0x43')][_0xd6cf('0x41')]({'id':_0x18ead2[_0xd6cf('0x1a')],'value':_0x42f96d[_0x18ead2[_0xd6cf('0x45')][_0xd6cf('0x2b')][_0xd6cf('0x3f')]()][_0xd6cf('0x20')]()});}});}return _0x3c6efc;}function getConnection(_0x29b8ba){return request({'method':_0xd6cf('0x46'),'form':{'method':_0xd6cf('0x47'),'input_type':_0xd6cf('0x1c'),'response_type':_0xd6cf('0x1c'),'rest_data':JSON[_0xd6cf('0x1d')]({'user_auth':{'user_name':_0x29b8ba[_0xd6cf('0x48')],'password':_0x29b8ba['password'],'encryption':_0xd6cf('0x49')},'application':'xCALLY\x20Motion\x20integration'})}})[_0xd6cf('0x32')](function(_0x4775b7){var _0x56c45f=_0x4775b7;if(_0x56c45f['id']){def['sessionID']=_0x56c45f['id'];return BPromise[_0xd6cf('0x2d')](_0x56c45f);}else{throw new Error(util[_0xd6cf('0x1e')]('Account\x20%d\x20is\x20not\x20valid',_0x29b8ba['id']));}});}function setRelationship(_0x3260bb,_0x248716,_0x271f04,_0xc17895){return request({'form':{'method':_0xd6cf('0x4a'),'input_type':_0xd6cf('0x1c'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3260bb['id'],'module_name':'Calls','module_id':_0x271f04['id'],'link_field_name':_0xc17895,'related_ids':[_0x248716['id']]})}});}exports[_0xd6cf('0x4b')]=function(_0x47a2a7,_0x4166a1,_0x2c2142,_0x20f05d,_0x36800b,_0x515a19){var _0x11f618,_0x30cc7d,_0x2eaf12,_0x5b3ce9;_0x515a19[_0xd6cf('0x4c')]=intUtil['stripTrailingSlash'](_0x515a19[_0xd6cf('0x4c')]);_0x515a19[_0xd6cf('0x4d')]=intUtil[_0xd6cf('0x4e')](_0x515a19['serverUrl']);def[_0xd6cf('0x4f')]=util[_0xd6cf('0x1e')](_0xd6cf('0x50'),_0x515a19[_0xd6cf('0x4c')]);if(_0x36800b&&_0x36800b[_0xd6cf('0x51')]){logger[_0xd6cf('0xa')](_0xd6cf('0x52'),_0xd6cf('0x53'));_0x4166a1[_0xd6cf('0x54')]=util[_0xd6cf('0x1e')](_0xd6cf('0x55'),_0x515a19['serverUrl'],_0x4166a1[_0xd6cf('0x56')],md5(_0x4166a1[_0xd6cf('0x56')]));}else{_0x4166a1['recordingURL']='';}return getConnection(_0x515a19)[_0xd6cf('0x32')](function(_0x3e9162){_0x5b3ce9=_0x3e9162;return getUser(_0x515a19,_0x20f05d['name'],_0x5b3ce9);})[_0xd6cf('0x32')](function(_0xa109e4){_0x11f618=_0xa109e4;logger[_0xd6cf('0xa')](_0xd6cf('0x57'),_0x11f618['id']);return getEndUser(_0x515a19,_0x4166a1[_0xd6cf('0x58')],_0x4166a1[_0xd6cf('0x59')],_0x5b3ce9);})[_0xd6cf('0x32')](function(_0x468fa9){_0x30cc7d=_0x468fa9;logger[_0xd6cf('0xa')](_0xd6cf('0x5a'),_0x30cc7d['id']);return getTicket(_0x515a19,_0x11f618,_0x30cc7d,_0x2c2142,_0x4166a1,_0x2c2142[_0xd6cf('0x5b')],_0x5b3ce9,_0xd6cf('0x5c'));})[_0xd6cf('0x32')](function(_0x392a25){_0x2eaf12=_0x392a25;logger[_0xd6cf('0xa')](_0xd6cf('0x5d'));logger[_0xd6cf('0xa')](_0xd6cf('0x5e'),_0x2eaf12['id']);return setRelationship(_0x5b3ce9,_0x11f618,_0x2eaf12,_0xd6cf('0x5f'));})['then'](function(){return setRelationship(_0x5b3ce9,_0x30cc7d,_0x2eaf12,_0xd6cf('0x60'));})[_0xd6cf('0x32')](function(){return getServerInfo(_0x5b3ce9);})[_0xd6cf('0x32')](function(_0x512582){var _0x5c1308=parseInt(_0x512582[_0xd6cf('0x61')][_0xd6cf('0x62')](0x0));var _0x964fb2=util[_0xd6cf('0x1e')](_0xd6cf('0x63'),_0x515a19[_0xd6cf('0x4c')],_0x2eaf12['id']);if(_0x5c1308>0x6){_0x964fb2=util[_0xd6cf('0x1e')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x515a19[_0xd6cf('0x4c')],_0x2eaf12['id']);}logger['info'](_0xd6cf('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd6cf('0x64'),_0x20f05d[_0xd6cf('0x2b')]),'trigger:browser:url',{'uri':_0x964fb2});})['catch'](function(_0x235ea4){logger['error'](_0xd6cf('0x52'),JSON['stringify'](_0x235ea4));});};exports['outbound']=function(_0x2e6d10,_0x4b31ea,_0x3ae6a5,_0x43944e,_0x506b38,_0x304629,_0x3763f5){var _0x2d6160,_0x2fe1df,_0x175db1,_0x4040d6;_0x304629['remoteUri']=intUtil[_0xd6cf('0x4e')](_0x304629[_0xd6cf('0x4c')]);_0x304629[_0xd6cf('0x4d')]=intUtil[_0xd6cf('0x4e')](_0x304629[_0xd6cf('0x4d')]);def['uri']=util[_0xd6cf('0x1e')](_0xd6cf('0x50'),_0x304629['remoteUri']);if(_0x3763f5&&_0x3763f5[_0xd6cf('0x65')]&&_0x3763f5[_0xd6cf('0x65')]!==_0xd6cf('0x66')){logger[_0xd6cf('0xa')](_0xd6cf('0x67'),_0xd6cf('0x53'));_0x4b31ea['recordingURL']=util[_0xd6cf('0x1e')](_0xd6cf('0x55'),_0x304629[_0xd6cf('0x4d')],_0x4b31ea[_0xd6cf('0x56')],md5(_0x4b31ea[_0xd6cf('0x56')]));}return getConnection(_0x304629)[_0xd6cf('0x32')](function(_0x195998){_0x4040d6=_0x195998;return getUser(_0x304629,_0x43944e['name'],_0x4040d6);})['then'](function(_0x335e5d){_0x2d6160=_0x335e5d;logger[_0xd6cf('0xa')](_0xd6cf('0x57'),_0x2d6160['id']);return getEndUser(_0x304629,_0x4b31ea[_0xd6cf('0x68')],_0x4b31ea[_0xd6cf('0x69')],_0x4040d6);})[_0xd6cf('0x32')](function(_0x464337){_0x2fe1df=_0x464337;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2fe1df['id']);return getTicket(_0x304629,_0x2d6160,_0x2fe1df,_0x3ae6a5,_0x4b31ea,_0x3ae6a5['Fields'],_0x4040d6,'Outbound');})[_0xd6cf('0x32')](function(_0x3eda65){_0x175db1=_0x3eda65;logger['info'](_0xd6cf('0x5d'));logger[_0xd6cf('0xa')]('The\x20Ticket\x20ID\x20is:',_0x175db1['id']);return setRelationship(_0x4040d6,_0x2d6160,_0x175db1,'users');})['then'](function(){return setRelationship(_0x4040d6,_0x2fe1df,_0x175db1,'contacts');})[_0xd6cf('0x32')](function(){return getServerInfo(_0x4040d6);})['then'](function(_0x3c18a4){var _0x12e128=parseInt(_0x3c18a4[_0xd6cf('0x61')][_0xd6cf('0x62')](0x0));var _0x4ecb6c=util['format'](_0xd6cf('0x63'),_0x304629[_0xd6cf('0x4c')],_0x175db1['id']);if(_0x12e128>0x6){_0x4ecb6c=util[_0xd6cf('0x1e')](_0xd6cf('0x6a'),_0x304629['remoteUri'],_0x175db1['id']);}logger['info']('[OUTBOUND]',_0xd6cf('0x6b'));emit(util[_0xd6cf('0x1e')](_0xd6cf('0x64'),_0x43944e[_0xd6cf('0x2b')]),'trigger:browser:url',{'uri':_0x4ecb6c});})[_0xd6cf('0x6c')](function(_0x5b340d){logger[_0xd6cf('0x6d')](_0xd6cf('0x67'),JSON[_0xd6cf('0x1d')](_0x5b340d));});};exports['unmanaged']=function(_0x2a948c,_0x4b3917,_0x1547be,_0x277cad,_0x3a68da,_0x1ea0c0){var _0x27da22,_0x5ba1c0,_0x527ea8,_0x450617;_0x1ea0c0[_0xd6cf('0x4c')]=intUtil[_0xd6cf('0x4e')](_0x1ea0c0[_0xd6cf('0x4c')]);_0x1ea0c0[_0xd6cf('0x4d')]=intUtil[_0xd6cf('0x4e')](_0x1ea0c0[_0xd6cf('0x4d')]);def['uri']=util[_0xd6cf('0x1e')]('%s/service/v4_1/rest.php',_0x1ea0c0['remoteUri']);if(_0x3a68da&&_0x3a68da['monitor_format']){logger[_0xd6cf('0xa')]('['+_0x4b3917[_0xd6cf('0x6e')][_0xd6cf('0x6f')]()+']',_0xd6cf('0x53'));_0x4b3917[_0xd6cf('0x54')]=util[_0xd6cf('0x1e')](_0xd6cf('0x55'),_0x1ea0c0[_0xd6cf('0x4d')],_0x4b3917['uniqueid'],md5(_0x4b3917[_0xd6cf('0x56')]));}else{_0x4b3917[_0xd6cf('0x54')]='';}return getConnection(_0x1ea0c0)[_0xd6cf('0x32')](function(_0x39e51a){_0x450617=_0x39e51a;if(!_[_0xd6cf('0x22')](_0x277cad)){return getUser(_0x1ea0c0,_0x277cad[_0xd6cf('0x2b')],_0x450617);}else{return getUser(_0x1ea0c0,null,_0x450617);}})[_0xd6cf('0x32')](function(_0x34169e){_0x27da22=_0x34169e;logger['info'](_0xd6cf('0x57'),_0x27da22['id']);return getEndUser(_0x1ea0c0,_0x4b3917[_0xd6cf('0x58')],_0x4b3917[_0xd6cf('0x59')],_0x450617);})[_0xd6cf('0x32')](function(_0x392fdd){_0x5ba1c0=_0x392fdd;logger[_0xd6cf('0xa')]('The\x20Enduser\x20ID\x20is:',_0x5ba1c0['id']);return getTicket(_0x1ea0c0,_0x27da22,_0x5ba1c0,_0x1547be,_0x4b3917,_0x1547be[_0xd6cf('0x5b')],_0x450617,_0xd6cf('0x5c'));})[_0xd6cf('0x32')](function(_0x3c2823){_0x527ea8=_0x3c2823;logger[_0xd6cf('0xa')](_0xd6cf('0x5d'));logger[_0xd6cf('0xa')](_0xd6cf('0x5e'),_0x527ea8['id']);return setRelationship(_0x450617,_0x27da22,_0x527ea8,'users');})[_0xd6cf('0x32')](function(){return setRelationship(_0x450617,_0x5ba1c0,_0x527ea8,_0xd6cf('0x60'));})[_0xd6cf('0x32')](function(){return getServerInfo(_0x450617);})[_0xd6cf('0x6c')](function(_0x58cfd6){logger[_0xd6cf('0x6d')]('['+_0x4b3917[_0xd6cf('0x6e')][_0xd6cf('0x6f')]()+']',JSON[_0xd6cf('0x1d')](_0x58cfd6));});}; \ 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 17e4dbf..8d56aa8 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 _0x16c2=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','string','push','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s','key','keyContent','format'];(function(_0xe62132,_0x531f7f){var _0x217126=function(_0x362326){while(--_0x362326){_0xe62132['push'](_0xe62132['shift']());}};_0x217126(++_0x531f7f);}(_0x16c2,0xb0));var _0x216c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x216c('0x0'));var util=require(_0x216c('0x1'));exports[_0x216c('0x2')]=function(_0x3a9432,_0x519691,_0x2c7e54){var _0x7e701f=[];if(_0x3a9432[_0x216c('0x3')]>0x0){var _0x2d83ac=_['sortBy'](_0x3a9432,['id']);for(var _0x23711a=0x0;_0x23711a<_0x2d83ac['length'];_0x23711a++){var _0x4b7915=_0x2d83ac[_0x23711a];if(_0x4b7915['type']===_0x216c('0x4')){_0x7e701f[_0x216c('0x5')](_0x4b7915['content']);}else if(_0x4b7915[_0x216c('0x6')]===_0x216c('0x7')&&_0x4b7915[_0x216c('0x8')]){_0x519691[_0x4b7915['variableName']]&&_0x7e701f[_0x216c('0x5')](_0x519691[_0x4b7915[_0x216c('0x8')]][_0x216c('0x9')]());}else if(_0x4b7915['type']===_0x216c('0xa')&&_0x4b7915['Variable']&&_0x4b7915[_0x216c('0xb')][_0x216c('0xc')]){_0x519691[_0x4b7915['Variable']['name'][_0x216c('0xd')]()]&&_0x7e701f[_0x216c('0x5')](_0x519691[_0x4b7915['Variable']['name'][_0x216c('0xd')]()][_0x216c('0x9')]());}else if(_0x4b7915['type']===_0x216c('0xe')){if(_0x4b7915[_0x216c('0xf')]===_0x216c('0x4')&&_0x4b7915['key']){_0x7e701f['push'](util['format'](_0x216c('0x10'),_0x4b7915[_0x216c('0x11')],_0x4b7915[_0x216c('0x12')]));}else if(_0x4b7915[_0x216c('0xf')]===_0x216c('0x7')&&_0x4b7915['variableName']&&_0x4b7915[_0x216c('0x11')]){_0x519691[_0x4b7915['variableName']]&&_0x7e701f[_0x216c('0x5')](util[_0x216c('0x13')]('%s:\x20%s',_0x4b7915[_0x216c('0x11')],_0x519691[_0x4b7915[_0x216c('0x8')]]));}else if(_0x4b7915[_0x216c('0xf')]===_0x216c('0xa')&&_0x4b7915['Variable']&&_0x4b7915[_0x216c('0xb')][_0x216c('0xc')]&&_0x4b7915[_0x216c('0x11')]){_0x519691[_0x4b7915[_0x216c('0xb')][_0x216c('0xc')]['toLowerCase']()]&&_0x7e701f[_0x216c('0x5')](util[_0x216c('0x13')](_0x216c('0x10'),_0x4b7915['key'],_0x519691[_0x4b7915[_0x216c('0xb')]['name'][_0x216c('0xd')]()]));}}}}return _0x7e701f[_0x216c('0x14')](_0x2c7e54);};exports[_0x216c('0x15')]=function(_0x421b15){var _0x14d639=_0x421b15[_0x216c('0x16')](-0x1);if(_0x14d639==='/'){_0x421b15=_0x421b15[_0x216c('0x17')](0x0,_0x421b15[_0x216c('0x18')](_0x14d639));}return _0x421b15;};exports[_0x216c('0x19')]=function(_0x14f5b7){if(!_[_0x216c('0x1a')](_0x14f5b7)&&_0x14f5b7!==''){var _0x37dec4=/^(([^<>()\[\]\\.,;:\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 _0x37dec4[_0x216c('0x1b')](String(_0x14f5b7)[_0x216c('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x125c=['variable','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','util','getString','type','string','variableName','push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s'];(function(_0x2b924,_0x1caae5){var _0x33b129=function(_0xe49efc){while(--_0xe49efc){_0x2b924['push'](_0x2b924['shift']());}};_0x33b129(++_0x1caae5);}(_0x125c,0x177));var _0xc125=function(_0xade60d,_0x2173ed){_0xade60d=_0xade60d-0x0;var _0x2af52e=_0x125c[_0xade60d];return _0x2af52e;};'use strict';var _=require('lodash');var util=require(_0xc125('0x0'));exports[_0xc125('0x1')]=function(_0x259d09,_0x116298,_0x3f8f42){var _0x438a9a=[];if(_0x259d09['length']>0x0){var _0x237dff=_['sortBy'](_0x259d09,['id']);for(var _0x2962a0=0x0;_0x2962a0<_0x237dff['length'];_0x2962a0++){var _0x169db9=_0x237dff[_0x2962a0];if(_0x169db9[_0xc125('0x2')]===_0xc125('0x3')){_0x438a9a['push'](_0x169db9['content']);}else if(_0x169db9['type']==='variable'&&_0x169db9['variableName']){_0x116298[_0x169db9[_0xc125('0x4')]]&&_0x438a9a[_0xc125('0x5')](_0x116298[_0x169db9['variableName']][_0xc125('0x6')]());}else if(_0x169db9[_0xc125('0x2')]===_0xc125('0x7')&&_0x169db9[_0xc125('0x8')]&&_0x169db9[_0xc125('0x8')][_0xc125('0x9')]){_0x116298[_0x169db9[_0xc125('0x8')][_0xc125('0x9')][_0xc125('0xa')]()]&&_0x438a9a[_0xc125('0x5')](_0x116298[_0x169db9['Variable'][_0xc125('0x9')][_0xc125('0xa')]()][_0xc125('0x6')]());}else if(_0x169db9[_0xc125('0x2')]===_0xc125('0xb')){if(_0x169db9[_0xc125('0xc')]===_0xc125('0x3')&&_0x169db9[_0xc125('0xd')]){_0x438a9a[_0xc125('0x5')](util[_0xc125('0xe')](_0xc125('0xf'),_0x169db9[_0xc125('0xd')],_0x169db9['keyContent']));}else if(_0x169db9[_0xc125('0xc')]===_0xc125('0x10')&&_0x169db9['variableName']&&_0x169db9['key']){_0x116298[_0x169db9[_0xc125('0x4')]]&&_0x438a9a[_0xc125('0x5')](util[_0xc125('0xe')](_0xc125('0xf'),_0x169db9[_0xc125('0xd')],_0x116298[_0x169db9[_0xc125('0x4')]]));}else if(_0x169db9[_0xc125('0xc')]===_0xc125('0x7')&&_0x169db9['Variable']&&_0x169db9[_0xc125('0x8')]['name']&&_0x169db9[_0xc125('0xd')]){_0x116298[_0x169db9[_0xc125('0x8')][_0xc125('0x9')][_0xc125('0xa')]()]&&_0x438a9a[_0xc125('0x5')](util[_0xc125('0xe')]('%s:\x20%s',_0x169db9[_0xc125('0xd')],_0x116298[_0x169db9[_0xc125('0x8')][_0xc125('0x9')]['toLowerCase']()]));}}}}return _0x438a9a['join'](_0x3f8f42);};exports[_0xc125('0x11')]=function(_0xea191d){var _0x3ed354=_0xea191d[_0xc125('0x12')](-0x1);if(_0x3ed354==='/'){_0xea191d=_0xea191d['substring'](0x0,_0xea191d[_0xc125('0x13')](_0x3ed354));}return _0xea191d;};exports[_0xc125('0x14')]=function(_0x3b48e4){if(!_[_0xc125('0x15')](_0x3b48e4)&&_0x3b48e4!==''){var _0x2d0c7f=/^(([^<>()\[\]\\.,;:\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 _0x2d0c7f[_0xc125('0x16')](String(_0x3b48e4)[_0xc125('0xa')]());}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 59c8213..d732a38 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 _0x7237=['catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','info','GET','format','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','token','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','Fields','[OUTBOUND]','unmanaged','toUpperCase','calleridname','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','idField','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Normal','Open','getString','Subjects','Descriptions','POST','%s/webservice.php','remoteUri','create','username','sessionName','stringify','then','resolve','result','error'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0x7237,0x9a));var _0x7723=function(_0x3c60aa,_0x458925){_0x3c60aa=_0x3c60aa-0x0;var _0x514d8f=_0x7237[_0x3c60aa];return _0x514d8f;};'use strict';var _=require(_0x7723('0x0'));var rp=require(_0x7723('0x1'));var BPromise=require(_0x7723('0x2'));var md5=require(_0x7723('0x3'));var util=require(_0x7723('0x4'));var Redis=require(_0x7723('0x5'));var intUtil=require('./util');var config=require(_0x7723('0x6'));var logger=require('../../../../config/logger')(_0x7723('0x7'));config[_0x7723('0x8')]=_[_0x7723('0x9')](config['redis'],{'host':_0x7723('0xa'),'port':0x18eb});var io=require(_0x7723('0xb'))(new Redis(config[_0x7723('0x8')]));function emit(_0x3052d9,_0x1e8f03,_0xf1d1f){io['to'](_0x3052d9)[_0x7723('0xc')](_0x1e8f03,_0xf1d1f);}function getCustomFields(_0x59e8d0,_0x270259){var _0x346426={};if(_0x59e8d0[_0x7723('0xd')]>0x0){_['forEach'](_0x59e8d0,function(_0x35189d){if(_0x35189d['type']==='string'&&_0x35189d[_0x7723('0xe')]){_0x346426[_0x35189d[_0x7723('0xe')]]=_0x35189d['content'][_0x7723('0xf')]();}else if(_0x35189d[_0x7723('0x10')]===_0x7723('0x11')&&_0x35189d[_0x7723('0x12')]&&_0x35189d['idField']&&_0x270259[_0x35189d[_0x7723('0x12')]]){_0x346426[_0x35189d[_0x7723('0xe')]]=_0x270259[_0x35189d[_0x7723('0x12')]]['toString']();}else if(_0x35189d[_0x7723('0x10')]===_0x7723('0x13')&&_0x35189d[_0x7723('0x14')]&&_0x35189d[_0x7723('0x14')]['name']&&_0x35189d[_0x7723('0xe')]&&_0x270259[_0x35189d[_0x7723('0x14')][_0x7723('0x15')]['toLowerCase']()]){_0x346426[_0x35189d[_0x7723('0xe')]]=_0x270259[_0x35189d['Variable'][_0x7723('0x15')][_0x7723('0x16')]()][_0x7723('0xf')]();}});}return _0x346426;}function createTicket(_0x4b1ffb,_0x29e316,_0x4038ed,_0x511054,_0x57ffd5,_0x19e233,_0x3ecca2){logger['info'](_0x7723('0x17'));var _0x586ed3=_['merge']({'parent_id':'','assigned_user_id':_0x29e316['id'],'ticketpriorities':_0x7723('0x18'),'ticketstatus':_0x7723('0x19'),'ticket_title':intUtil[_0x7723('0x1a')](_0x511054[_0x7723('0x1b')],_0x57ffd5,'\x20'),'description':intUtil[_0x7723('0x1a')](_0x511054[_0x7723('0x1c')],_0x57ffd5,'\x0a'),'contact_id':_0x4038ed['id']},getCustomFields(_0x19e233,_0x57ffd5));var _0x4ceed7={'method':_0x7723('0x1d'),'uri':util['format'](_0x7723('0x1e'),_0x4b1ffb[_0x7723('0x1f')]),'form':{'operation':_0x7723('0x20'),'username':_0x4b1ffb[_0x7723('0x21')],'sessionName':_0x3ecca2[_0x7723('0x22')],'elementType':'HelpDesk','element':JSON[_0x7723('0x23')](_0x586ed3)},'json':!![]};return request(_0x4ceed7)[_0x7723('0x24')](function(_0xec2641){if(_0xec2641['success']){return BPromise[_0x7723('0x25')]({'id':_0xec2641[_0x7723('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x7723('0x23')](_0xec2641[_0x7723('0x27')])));}})[_0x7723('0x28')](function(_0x28435d){var _0x51ecf6=_0x28435d[_0x7723('0x29')]||0x1f4;logger[_0x7723('0x27')](_0x7723('0x2a'),'createTicket',_0x51ecf6,JSON[_0x7723('0x23')](_0x28435d));});}function getUser(_0x221d6a,_0x5a15ec,_0x22105e){if(intUtil[_0x7723('0x2b')](_0x5a15ec)){logger[_0x7723('0x2c')]('Getting\x20agent\x20with\x20email',_0x5a15ec);return request({'method':_0x7723('0x2d'),'uri':util[_0x7723('0x2e')]('%s/webservice.php',_0x221d6a[_0x7723('0x1f')]),'qs':{'operation':_0x7723('0x2f'),'username':_0x221d6a['username'],'sessionName':_0x22105e['sessionName'],'query':util[_0x7723('0x2e')](_0x7723('0x30'),_0x5a15ec)},'json':!![]})[_0x7723('0x24')](function(_0x12814c){if(_0x12814c[_0x7723('0x31')]&&_0x12814c[_0x7723('0x26')][_0x7723('0xd')]){logger[_0x7723('0x2c')](_0x7723('0x32'));return BPromise[_0x7723('0x25')]({'id':_0x12814c['result'][0x0]['id'],'email':_0x12814c[_0x7723('0x26')][0x0][_0x7723('0x33')],'name':_0x12814c[_0x7723('0x26')][0x0]['first_name']+'\x20'+_0x12814c['result'][_0x7723('0x34')]});}else{logger[_0x7723('0x2c')](_0x7723('0x35'));return BPromise[_0x7723('0x25')]({'id':_0x22105e[_0x7723('0x36')],'email':_0x221d6a[_0x7723('0x21')],'name':_0x7723('0x37')});}})['catch'](function(_0x689f5d){var _0x4da80f=_0x689f5d['statusCode']||0x1f4;logger[_0x7723('0x27')](_0x7723('0x2a'),'getUser',_0x4da80f,JSON[_0x7723('0x23')](_0x689f5d));});}else{logger[_0x7723('0x2c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x22105e[_0x7723('0x36')],'email':_0x221d6a[_0x7723('0x21')],'name':_0x7723('0x37')})['catch'](function(_0x5681fd){var _0x377b53=_0x5681fd['statusCode']||0x1f4;logger[_0x7723('0x27')](_0x7723('0x2a'),_0x7723('0x38'),_0x377b53,JSON[_0x7723('0x23')](_0x5681fd));});}}function getEndUser(_0x2e76fa,_0x2e6a66,_0x3c09c3,_0x1ab606){logger[_0x7723('0x2c')](_0x7723('0x39'),_0x3c09c3);return request({'method':_0x7723('0x2d'),'uri':util[_0x7723('0x2e')](_0x7723('0x1e'),_0x2e76fa[_0x7723('0x1f')]),'qs':{'operation':'query','username':_0x2e76fa[_0x7723('0x21')],'sessionName':_0x1ab606[_0x7723('0x22')],'query':util[_0x7723('0x2e')](_0x7723('0x3a'),_0x3c09c3,_0x3c09c3,_0x3c09c3,_0x3c09c3,_0x3c09c3)},'json':!![]})['then'](function(_0x346f72){if(_0x346f72[_0x7723('0x31')]&&_0x346f72[_0x7723('0x26')]['length']){logger['info'](_0x7723('0x3b'));return BPromise[_0x7723('0x25')]({'id':_0x346f72[_0x7723('0x26')][0x0]['id'],'name':_0x346f72[_0x7723('0x26')][0x0][_0x7723('0x3c')]+'\x20'+_0x346f72[_0x7723('0x26')][0x0][_0x7723('0x3d')],'phone':_0x3c09c3});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x7723('0x1d'),'uri':util['format'](_0x7723('0x1e'),_0x2e76fa[_0x7723('0x1f')]),'form':{'operation':_0x7723('0x20'),'sessionName':_0x1ab606[_0x7723('0x22')],'elementType':_0x7723('0x3e'),'element':JSON[_0x7723('0x23')]({'lastname':_0x2e6a66,'phone':_0x3c09c3,'assigned_user_id':'\x20'})},'json':!![]})[_0x7723('0x24')](function(_0x4d5daf){logger[_0x7723('0x2c')](_0x7723('0x3f'));return BPromise[_0x7723('0x25')]({'id':_0x4d5daf[_0x7723('0x26')]['id'],'name':_0x4d5daf[_0x7723('0x26')]['lastname'],'phone':_0x4d5daf[_0x7723('0x26')][_0x7723('0x40')]});})[_0x7723('0x28')](function(_0x13307d){var _0x1b2c81=_0x13307d[_0x7723('0x29')]||0x1f4;logger[_0x7723('0x27')](_0x7723('0x2a'),_0x7723('0x41'),_0x1b2c81,JSON[_0x7723('0x23')](_0x13307d));});}});}function getConnection(_0x39cea2){var _0x496a7b=_0x39cea2['username'];var _0x5bc006=_0x39cea2[_0x7723('0x42')];return request({'method':_0x7723('0x2d'),'uri':util['format'](_0x7723('0x1e'),_0x39cea2[_0x7723('0x1f')]),'qs':{'operation':_0x7723('0x43'),'username':_0x496a7b},'json':!![]})[_0x7723('0x24')](function(_0x5b312a){if(_0x5b312a[_0x7723('0x31')]){return request({'method':_0x7723('0x1d'),'uri':util[_0x7723('0x2e')](_0x7723('0x1e'),_0x39cea2[_0x7723('0x1f')]),'form':{'operation':'login','username':_0x496a7b,'accessKey':md5(_0x5b312a['result'][_0x7723('0x44')]+_0x5bc006)},'json':!![]});}})['then'](function(_0xb921a9){if(_0xb921a9[_0x7723('0x31')]){return BPromise['resolve'](_0xb921a9[_0x7723('0x26')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x39cea2['id']));}})[_0x7723('0x28')](function(_0x3e3448){var _0x2919d4=_0x3e3448[_0x7723('0x29')]||0x1f4;logger[_0x7723('0x27')](_0x7723('0x2a'),'getConnection',_0x2919d4,JSON[_0x7723('0x23')](_0x3e3448));});}function request(_0x2c0097){logger[_0x7723('0x2c')](_0x7723('0x45'),JSON[_0x7723('0x23')](_0x2c0097));return rp(_0x2c0097);}exports['queue']=function(_0x4e1751,_0x2e8d08,_0x120832,_0x5b14ff,_0x271528,_0x312a8f){var _0x28c023,_0x340487,_0x3664b4,_0x27b7a3;_0x312a8f[_0x7723('0x1f')]=intUtil[_0x7723('0x46')](_0x312a8f[_0x7723('0x1f')]);if(_0x271528&&_0x271528[_0x7723('0x47')]){logger['info'](_0x7723('0x48'),_0x7723('0x49'));_0x2e8d08['recordingURL']=util['format'](_0x7723('0x4a'),_0x312a8f[_0x7723('0x4b')],_0x2e8d08[_0x7723('0x4c')],md5(_0x2e8d08[_0x7723('0x4c')]));}else{_0x2e8d08['recordingURL']='';}return getConnection(_0x312a8f)[_0x7723('0x24')](function(_0xd0f141){_0x27b7a3=_0xd0f141;return getUser(_0x312a8f,_0x5b14ff[_0x7723('0x4d')],_0x27b7a3);})['then'](function(_0x36aa05){_0x28c023=_0x36aa05;logger[_0x7723('0x2c')]('The\x20User\x20ID\x20is:',_0x28c023['id']);return getEndUser(_0x312a8f,_0x2e8d08['calleridname'],_0x2e8d08['calleridnum'],_0x27b7a3);})[_0x7723('0x24')](function(_0x5a41cf){_0x340487=_0x5a41cf;logger[_0x7723('0x2c')](_0x7723('0x4e'),_0x340487['id']);return createTicket(_0x312a8f,_0x28c023,_0x340487,_0x120832,_0x2e8d08,_0x120832['Fields'],_0x27b7a3);})[_0x7723('0x24')](function(_0x368e67){_0x3664b4=_0x368e67;logger['info'](_0x7723('0x4f'));logger[_0x7723('0x2c')](_0x7723('0x50'),_0x3664b4['id']);var _0x53c51d=util['format'](_0x7723('0x51'),_0x312a8f[_0x7723('0x1f')],_[_0x7723('0x52')](_0x3664b4['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x7723('0x53'));emit(util[_0x7723('0x2e')](_0x7723('0x54'),_0x5b14ff[_0x7723('0x15')]),_0x7723('0x55'),{'uri':_0x53c51d});})[_0x7723('0x28')](function(_0x27cf05){logger[_0x7723('0x27')](_0x7723('0x48'),JSON[_0x7723('0x23')](_0x27cf05));});};exports[_0x7723('0x56')]=function(_0x1ffebd,_0x57be19,_0x3e2e11,_0x34cf88,_0x3e762f,_0x4a8bd7,_0x326cba){var _0x530d55,_0x4efdfa,_0x5cdc87,_0x59a20f;_0x4a8bd7[_0x7723('0x1f')]=intUtil['stripTrailingSlash'](_0x4a8bd7[_0x7723('0x1f')]);_0x4a8bd7['serverUrl']=intUtil['stripTrailingSlash'](_0x4a8bd7[_0x7723('0x4b')]);if(_0x326cba&&_0x326cba[_0x7723('0x57')]&&_0x326cba[_0x7723('0x57')]!==_0x7723('0x58')){logger[_0x7723('0x2c')]('[OUTBOUND]',_0x7723('0x49'));_0x57be19[_0x7723('0x59')]=util['format'](_0x7723('0x4a'),_0x4a8bd7[_0x7723('0x4b')],_0x57be19[_0x7723('0x4c')],md5(_0x57be19[_0x7723('0x4c')]));}return getConnection(_0x4a8bd7)[_0x7723('0x24')](function(_0x123745){_0x59a20f=_0x123745;return getUser(_0x4a8bd7,_0x34cf88[_0x7723('0x4d')],_0x59a20f);})[_0x7723('0x24')](function(_0x3a6136){_0x530d55=_0x3a6136;logger[_0x7723('0x2c')](_0x7723('0x5a'),_0x530d55['id']);return getEndUser(_0x4a8bd7,_0x57be19['destcalleridname'],_0x57be19['destcalleridnum'],_0x59a20f);})['then'](function(_0x5d54d1){_0x4efdfa=_0x5d54d1;logger['info'](_0x7723('0x4e'),_0x4efdfa['id']);return createTicket(_0x4a8bd7,_0x530d55,_0x4efdfa,_0x3e2e11,_0x57be19,_0x3e2e11[_0x7723('0x5b')],_0x59a20f);})['then'](function(_0x2df2fc){_0x5cdc87=_0x2df2fc;logger['info'](_0x7723('0x4f'));logger[_0x7723('0x2c')]('The\x20Ticket\x20ID\x20is:',_0x5cdc87['id']);var _0xaba0a6=util[_0x7723('0x2e')](_0x7723('0x51'),_0x4a8bd7[_0x7723('0x1f')],_[_0x7723('0x52')](_0x5cdc87['id'],'x')[0x1]);logger[_0x7723('0x2c')](_0x7723('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7723('0x2e')](_0x7723('0x54'),_0x34cf88['name']),_0x7723('0x55'),{'uri':_0xaba0a6});})[_0x7723('0x28')](function(_0x3dd16c){logger[_0x7723('0x27')](_0x7723('0x5c'),JSON[_0x7723('0x23')](_0x3dd16c));});};exports[_0x7723('0x5d')]=function(_0x5a371e,_0xe840a0,_0x13a604,_0x372972,_0x2d9a9b,_0xbf2cbb){var _0x4fe2a1,_0x3e8941,_0x27a396,_0xcdca6e;_0xbf2cbb[_0x7723('0x1f')]=intUtil[_0x7723('0x46')](_0xbf2cbb[_0x7723('0x1f')]);_0xbf2cbb[_0x7723('0x4b')]=intUtil[_0x7723('0x46')](_0xbf2cbb[_0x7723('0x4b')]);if(_0x2d9a9b&&_0x2d9a9b['monitor_format']){logger[_0x7723('0x2c')]('['+_0xe840a0['lastevent'][_0x7723('0x5e')]()+']','Recording\x20is\x20enabled!');_0xe840a0[_0x7723('0x59')]=util['format'](_0x7723('0x4a'),_0xbf2cbb[_0x7723('0x4b')],_0xe840a0[_0x7723('0x4c')],md5(_0xe840a0[_0x7723('0x4c')]));}else{_0xe840a0[_0x7723('0x59')]='';}return getConnection(_0xbf2cbb)[_0x7723('0x24')](function(_0x5ce904){_0xcdca6e=_0x5ce904;return getUser(_0xbf2cbb,'',_0xcdca6e);})[_0x7723('0x24')](function(_0x10904d){_0x4fe2a1=_0x10904d;logger[_0x7723('0x2c')](_0x7723('0x5a'),_0x4fe2a1['id']);return getEndUser(_0xbf2cbb,_0xe840a0[_0x7723('0x5f')],_0xe840a0[_0x7723('0x60')],_0xcdca6e);})['then'](function(_0x46854a){_0x3e8941=_0x46854a;logger['info'](_0x7723('0x4e'),_0x3e8941['id']);return createTicket(_0xbf2cbb,_0x4fe2a1,_0x3e8941,_0x13a604,_0xe840a0,_0x13a604[_0x7723('0x5b')],_0xcdca6e);})['then'](function(_0x2deffc){_0x27a396=_0x2deffc;logger[_0x7723('0x2c')]('Ticket\x20created!');logger[_0x7723('0x2c')](_0x7723('0x50'),_0x27a396['id']);})[_0x7723('0x28')](function(_0x5b5dcd){logger[_0x7723('0x27')]('['+_0xe840a0['lastevent'][_0x7723('0x5e')]()+']',JSON[_0x7723('0x23')](_0x5b5dcd));});}; \ No newline at end of file +var _0x0833=['bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','string','idField','toString','variable','variableName','Variable','name','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','username','HelpDesk','stringify','then','success','resolve','result','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','first_name','last_name','userId','admin','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20end\x20user\x20with\x20phone','query','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','none','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','[OUTBOUND]','unmanaged','stripTrailingSlash','lastevent','toUpperCase','lodash','request-promise'];(function(_0x487252,_0x51cd99){var _0x472e06=function(_0x221393){while(--_0x221393){_0x487252['push'](_0x487252['shift']());}};_0x472e06(++_0x51cd99);}(_0x0833,0xcc));var _0x3083=function(_0x2a2fb1,_0x47deef){_0x2a2fb1=_0x2a2fb1-0x0;var _0x48199b=_0x0833[_0x2a2fb1];return _0x48199b;};'use strict';var _=require(_0x3083('0x0'));var rp=require(_0x3083('0x1'));var BPromise=require(_0x3083('0x2'));var md5=require(_0x3083('0x3'));var util=require(_0x3083('0x4'));var Redis=require(_0x3083('0x5'));var intUtil=require('./util');var config=require(_0x3083('0x6'));var logger=require(_0x3083('0x7'))('vTiger');config[_0x3083('0x8')]=_[_0x3083('0x9')](config[_0x3083('0x8')],{'host':_0x3083('0xa'),'port':0x18eb});var io=require(_0x3083('0xb'))(new Redis(config[_0x3083('0x8')]));function emit(_0x496dae,_0x2d1086,_0x50b7cd){io['to'](_0x496dae)['emit'](_0x2d1086,_0x50b7cd);}function getCustomFields(_0x108a42,_0x88d778){var _0x59b344={};if(_0x108a42[_0x3083('0xc')]>0x0){_[_0x3083('0xd')](_0x108a42,function(_0x50a460){if(_0x50a460[_0x3083('0xe')]===_0x3083('0xf')&&_0x50a460['idField']){_0x59b344[_0x50a460[_0x3083('0x10')]]=_0x50a460['content'][_0x3083('0x11')]();}else if(_0x50a460['type']===_0x3083('0x12')&&_0x50a460[_0x3083('0x13')]&&_0x50a460[_0x3083('0x10')]&&_0x88d778[_0x50a460[_0x3083('0x13')]]){_0x59b344[_0x50a460[_0x3083('0x10')]]=_0x88d778[_0x50a460['variableName']][_0x3083('0x11')]();}else if(_0x50a460[_0x3083('0xe')]==='customVariable'&&_0x50a460[_0x3083('0x14')]&&_0x50a460[_0x3083('0x14')][_0x3083('0x15')]&&_0x50a460[_0x3083('0x10')]&&_0x88d778[_0x50a460[_0x3083('0x14')][_0x3083('0x15')]['toLowerCase']()]){_0x59b344[_0x50a460[_0x3083('0x10')]]=_0x88d778[_0x50a460[_0x3083('0x14')][_0x3083('0x15')]['toLowerCase']()][_0x3083('0x11')]();}});}return _0x59b344;}function createTicket(_0x48e23a,_0xe27398,_0x53cbee,_0x152a6c,_0xa2c239,_0x22ed6c,_0x445e3b){logger[_0x3083('0x16')](_0x3083('0x17'));var _0x41eb39=_[_0x3083('0x18')]({'parent_id':'','assigned_user_id':_0xe27398['id'],'ticketpriorities':_0x3083('0x19'),'ticketstatus':_0x3083('0x1a'),'ticket_title':intUtil[_0x3083('0x1b')](_0x152a6c['Subjects'],_0xa2c239,'\x20'),'description':intUtil[_0x3083('0x1b')](_0x152a6c[_0x3083('0x1c')],_0xa2c239,'\x0a'),'contact_id':_0x53cbee['id']},getCustomFields(_0x22ed6c,_0xa2c239));var _0x1c851c={'method':_0x3083('0x1d'),'uri':util[_0x3083('0x1e')](_0x3083('0x1f'),_0x48e23a[_0x3083('0x20')]),'form':{'operation':_0x3083('0x21'),'username':_0x48e23a[_0x3083('0x22')],'sessionName':_0x445e3b['sessionName'],'elementType':_0x3083('0x23'),'element':JSON[_0x3083('0x24')](_0x41eb39)},'json':!![]};return request(_0x1c851c)[_0x3083('0x25')](function(_0xd305ad){if(_0xd305ad[_0x3083('0x26')]){return BPromise[_0x3083('0x27')]({'id':_0xd305ad[_0x3083('0x28')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x3083('0x24')](_0xd305ad[_0x3083('0x29')])));}})[_0x3083('0x2a')](function(_0x123aec){var _0x2b6b81=_0x123aec[_0x3083('0x2b')]||0x1f4;logger['error'](_0x3083('0x2c'),_0x3083('0x2d'),_0x2b6b81,JSON[_0x3083('0x24')](_0x123aec));});}function getUser(_0x413b9b,_0x5542a8,_0x2bf023){if(intUtil[_0x3083('0x2e')](_0x5542a8)){logger[_0x3083('0x16')](_0x3083('0x2f'),_0x5542a8);return request({'method':_0x3083('0x30'),'uri':util['format'](_0x3083('0x1f'),_0x413b9b['remoteUri']),'qs':{'operation':'query','username':_0x413b9b[_0x3083('0x22')],'sessionName':_0x2bf023[_0x3083('0x31')],'query':util[_0x3083('0x1e')](_0x3083('0x32'),_0x5542a8)},'json':!![]})[_0x3083('0x25')](function(_0x7d554c){if(_0x7d554c[_0x3083('0x26')]&&_0x7d554c['result'][_0x3083('0xc')]){logger[_0x3083('0x16')](_0x3083('0x33'));return BPromise[_0x3083('0x27')]({'id':_0x7d554c[_0x3083('0x28')][0x0]['id'],'email':_0x7d554c[_0x3083('0x28')][0x0][_0x3083('0x34')],'name':_0x7d554c['result'][0x0][_0x3083('0x35')]+'\x20'+_0x7d554c[_0x3083('0x28')][_0x3083('0x36')]});}else{logger[_0x3083('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x3083('0x27')]({'id':_0x2bf023[_0x3083('0x37')],'email':_0x413b9b[_0x3083('0x22')],'name':_0x3083('0x38')});}})[_0x3083('0x2a')](function(_0x4ff2f9){var _0x515051=_0x4ff2f9[_0x3083('0x2b')]||0x1f4;logger[_0x3083('0x29')](_0x3083('0x2c'),_0x3083('0x39'),_0x515051,JSON['stringify'](_0x4ff2f9));});}else{logger[_0x3083('0x16')](_0x3083('0x3a'));return BPromise[_0x3083('0x27')]({'id':_0x2bf023[_0x3083('0x37')],'email':_0x413b9b['username'],'name':'admin'})[_0x3083('0x2a')](function(_0x1edd81){var _0x170fe1=_0x1edd81[_0x3083('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x3083('0x39'),_0x170fe1,JSON[_0x3083('0x24')](_0x1edd81));});}}function getEndUser(_0x4f819a,_0x1ee9b4,_0x5999a4,_0x2c251c){logger['info'](_0x3083('0x3b'),_0x5999a4);return request({'method':_0x3083('0x30'),'uri':util['format']('%s/webservice.php',_0x4f819a[_0x3083('0x20')]),'qs':{'operation':_0x3083('0x3c'),'username':_0x4f819a[_0x3083('0x22')],'sessionName':_0x2c251c['sessionName'],'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;',_0x5999a4,_0x5999a4,_0x5999a4,_0x5999a4,_0x5999a4)},'json':!![]})['then'](function(_0x4b7c1d){if(_0x4b7c1d[_0x3083('0x26')]&&_0x4b7c1d[_0x3083('0x28')][_0x3083('0xc')]){logger['info'](_0x3083('0x3d'));return BPromise[_0x3083('0x27')]({'id':_0x4b7c1d['result'][0x0]['id'],'name':_0x4b7c1d[_0x3083('0x28')][0x0][_0x3083('0x3e')]+'\x20'+_0x4b7c1d[_0x3083('0x28')][0x0][_0x3083('0x3f')],'phone':_0x5999a4});}else{logger[_0x3083('0x16')](_0x3083('0x40'));return request({'method':_0x3083('0x1d'),'uri':util[_0x3083('0x1e')](_0x3083('0x1f'),_0x4f819a[_0x3083('0x20')]),'form':{'operation':_0x3083('0x21'),'sessionName':_0x2c251c[_0x3083('0x31')],'elementType':_0x3083('0x41'),'element':JSON[_0x3083('0x24')]({'lastname':_0x1ee9b4,'phone':_0x5999a4,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x462e26){logger['info'](_0x3083('0x42'));return BPromise['resolve']({'id':_0x462e26[_0x3083('0x28')]['id'],'name':_0x462e26['result'][_0x3083('0x3f')],'phone':_0x462e26[_0x3083('0x28')][_0x3083('0x43')]});})[_0x3083('0x2a')](function(_0x8ca574){var _0x299d0a=_0x8ca574[_0x3083('0x2b')]||0x1f4;logger['error'](_0x3083('0x2c'),_0x3083('0x44'),_0x299d0a,JSON[_0x3083('0x24')](_0x8ca574));});}});}function getConnection(_0x5d2729){var _0x1b44fb=_0x5d2729[_0x3083('0x22')];var _0x451677=_0x5d2729[_0x3083('0x45')];return request({'method':_0x3083('0x30'),'uri':util[_0x3083('0x1e')]('%s/webservice.php',_0x5d2729[_0x3083('0x20')]),'qs':{'operation':'getchallenge','username':_0x1b44fb},'json':!![]})['then'](function(_0x4f293d){if(_0x4f293d['success']){return request({'method':_0x3083('0x1d'),'uri':util['format'](_0x3083('0x1f'),_0x5d2729[_0x3083('0x20')]),'form':{'operation':'login','username':_0x1b44fb,'accessKey':md5(_0x4f293d[_0x3083('0x28')][_0x3083('0x46')]+_0x451677)},'json':!![]});}})['then'](function(_0xc27894){if(_0xc27894[_0x3083('0x26')]){return BPromise[_0x3083('0x27')](_0xc27894[_0x3083('0x28')]);}else{throw new Error(util['format'](_0x3083('0x47'),_0x5d2729['id']));}})['catch'](function(_0x5b4af9){var _0x3f5fbd=_0x5b4af9['statusCode']||0x1f4;logger[_0x3083('0x29')](_0x3083('0x2c'),_0x3083('0x48'),_0x3f5fbd,JSON[_0x3083('0x24')](_0x5b4af9));});}function request(_0x108d72){logger[_0x3083('0x16')]('[HTTP]',JSON[_0x3083('0x24')](_0x108d72));return rp(_0x108d72);}exports[_0x3083('0x49')]=function(_0x4f7807,_0x422c82,_0x3dca68,_0x4d59c1,_0x33e156,_0x3aff13){var _0x24318b,_0x4999c0,_0xf092c9,_0x535146;_0x3aff13[_0x3083('0x20')]=intUtil['stripTrailingSlash'](_0x3aff13[_0x3083('0x20')]);if(_0x33e156&&_0x33e156[_0x3083('0x4a')]){logger[_0x3083('0x16')](_0x3083('0x4b'),_0x3083('0x4c'));_0x422c82[_0x3083('0x4d')]=util[_0x3083('0x1e')](_0x3083('0x4e'),_0x3aff13[_0x3083('0x4f')],_0x422c82[_0x3083('0x50')],md5(_0x422c82[_0x3083('0x50')]));}else{_0x422c82['recordingURL']='';}return getConnection(_0x3aff13)[_0x3083('0x25')](function(_0x13bee1){_0x535146=_0x13bee1;return getUser(_0x3aff13,_0x4d59c1['email'],_0x535146);})['then'](function(_0x2db5e9){_0x24318b=_0x2db5e9;logger[_0x3083('0x16')](_0x3083('0x51'),_0x24318b['id']);return getEndUser(_0x3aff13,_0x422c82[_0x3083('0x52')],_0x422c82[_0x3083('0x53')],_0x535146);})[_0x3083('0x25')](function(_0x1f6f4d){_0x4999c0=_0x1f6f4d;logger[_0x3083('0x16')]('The\x20Enduser\x20ID\x20is:',_0x4999c0['id']);return createTicket(_0x3aff13,_0x24318b,_0x4999c0,_0x3dca68,_0x422c82,_0x3dca68[_0x3083('0x54')],_0x535146);})['then'](function(_0x5c7358){_0xf092c9=_0x5c7358;logger[_0x3083('0x16')](_0x3083('0x55'));logger[_0x3083('0x16')](_0x3083('0x56'),_0xf092c9['id']);var _0x19e996=util['format'](_0x3083('0x57'),_0x3aff13[_0x3083('0x20')],_['split'](_0xf092c9['id'],'x')[0x1]);logger['info']('[QUEUE]',_0x3083('0x58'));emit(util[_0x3083('0x1e')](_0x3083('0x59'),_0x4d59c1['name']),_0x3083('0x5a'),{'uri':_0x19e996});})[_0x3083('0x2a')](function(_0x4a7180){logger[_0x3083('0x29')](_0x3083('0x4b'),JSON[_0x3083('0x24')](_0x4a7180));});};exports[_0x3083('0x5b')]=function(_0x181331,_0x2b6139,_0x13d56c,_0x29de93,_0x999b4,_0x4e4c52,_0x5803db){var _0x487d77,_0x21c990,_0x17dc92,_0x3bd959;_0x4e4c52[_0x3083('0x20')]=intUtil['stripTrailingSlash'](_0x4e4c52[_0x3083('0x20')]);_0x4e4c52[_0x3083('0x4f')]=intUtil['stripTrailingSlash'](_0x4e4c52[_0x3083('0x4f')]);if(_0x5803db&&_0x5803db['recordingFormat']&&_0x5803db['recordingFormat']!==_0x3083('0x5c')){logger[_0x3083('0x16')]('[OUTBOUND]',_0x3083('0x4c'));_0x2b6139[_0x3083('0x4d')]=util['format'](_0x3083('0x4e'),_0x4e4c52['serverUrl'],_0x2b6139[_0x3083('0x50')],md5(_0x2b6139[_0x3083('0x50')]));}return getConnection(_0x4e4c52)[_0x3083('0x25')](function(_0x28e469){_0x3bd959=_0x28e469;return getUser(_0x4e4c52,_0x29de93[_0x3083('0x5d')],_0x3bd959);})[_0x3083('0x25')](function(_0x5a4cfe){_0x487d77=_0x5a4cfe;logger[_0x3083('0x16')]('The\x20User\x20ID\x20is:',_0x487d77['id']);return getEndUser(_0x4e4c52,_0x2b6139[_0x3083('0x5e')],_0x2b6139[_0x3083('0x5f')],_0x3bd959);})[_0x3083('0x25')](function(_0x4d2412){_0x21c990=_0x4d2412;logger[_0x3083('0x16')](_0x3083('0x60'),_0x21c990['id']);return createTicket(_0x4e4c52,_0x487d77,_0x21c990,_0x13d56c,_0x2b6139,_0x13d56c['Fields'],_0x3bd959);})[_0x3083('0x25')](function(_0x1b9b90){_0x17dc92=_0x1b9b90;logger['info']('Ticket\x20created!');logger[_0x3083('0x16')](_0x3083('0x56'),_0x17dc92['id']);var _0x13a3e1=util[_0x3083('0x1e')](_0x3083('0x57'),_0x4e4c52[_0x3083('0x20')],_[_0x3083('0x61')](_0x17dc92['id'],'x')[0x1]);logger[_0x3083('0x16')](_0x3083('0x62'),_0x3083('0x58'));emit(util[_0x3083('0x1e')](_0x3083('0x59'),_0x29de93[_0x3083('0x15')]),_0x3083('0x5a'),{'uri':_0x13a3e1});})[_0x3083('0x2a')](function(_0x3f5805){logger['error']('[OUTBOUND]',JSON[_0x3083('0x24')](_0x3f5805));});};exports[_0x3083('0x63')]=function(_0x20137a,_0x2bf523,_0x5d095e,_0x409acf,_0x22a89,_0x532202){var _0x9d4697,_0x23c79b,_0x1e1bac,_0xe7ee75;_0x532202[_0x3083('0x20')]=intUtil[_0x3083('0x64')](_0x532202[_0x3083('0x20')]);_0x532202[_0x3083('0x4f')]=intUtil[_0x3083('0x64')](_0x532202[_0x3083('0x4f')]);if(_0x22a89&&_0x22a89[_0x3083('0x4a')]){logger[_0x3083('0x16')]('['+_0x2bf523[_0x3083('0x65')][_0x3083('0x66')]()+']','Recording\x20is\x20enabled!');_0x2bf523[_0x3083('0x4d')]=util['format'](_0x3083('0x4e'),_0x532202['serverUrl'],_0x2bf523[_0x3083('0x50')],md5(_0x2bf523[_0x3083('0x50')]));}else{_0x2bf523['recordingURL']='';}return getConnection(_0x532202)[_0x3083('0x25')](function(_0x5d6d9a){_0xe7ee75=_0x5d6d9a;return getUser(_0x532202,'',_0xe7ee75);})[_0x3083('0x25')](function(_0x20c8c8){_0x9d4697=_0x20c8c8;logger['info'](_0x3083('0x51'),_0x9d4697['id']);return getEndUser(_0x532202,_0x2bf523['calleridname'],_0x2bf523[_0x3083('0x53')],_0xe7ee75);})[_0x3083('0x25')](function(_0x4ec9c8){_0x23c79b=_0x4ec9c8;logger[_0x3083('0x16')](_0x3083('0x60'),_0x23c79b['id']);return createTicket(_0x532202,_0x9d4697,_0x23c79b,_0x5d095e,_0x2bf523,_0x5d095e['Fields'],_0xe7ee75);})[_0x3083('0x25')](function(_0x1cdd8a){_0x1e1bac=_0x1cdd8a;logger['info'](_0x3083('0x55'));logger['info'](_0x3083('0x56'),_0x1e1bac['id']);})[_0x3083('0x2a')](function(_0xb17c05){logger[_0x3083('0x29')]('['+_0x2bf523[_0x3083('0x65')][_0x3083('0x66')]()+']',JSON[_0x3083('0x24')](_0xb17c05));});}; \ 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 55f15ec..97be3d1 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 _0x268f=['Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','base64','debug','[HTTP]','defaults','GET','map','type','string','nameField','customField','toLowerCase','content','toString','idField','push','variable','custom_fields','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','none','email','destcalleridname','destcalleridnum','integrationTab','[OUTBOUND]','%s/agent/tickets/%s','replace','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','Recording\x20is\x20enabled!','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','%s/users/me.json','user','type:user\x20role:end-user\x20phone:%s','length','filter','results','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s'];(function(_0x1b75dc,_0x5da8c0){var _0x4c7ff0=function(_0x4b4b90){while(--_0x4b4b90){_0x1b75dc['push'](_0x1b75dc['shift']());}};_0x4c7ff0(++_0x5da8c0);}(_0x268f,0x196));var _0xf268=function(_0x22c054,_0x30514c){_0x22c054=_0x22c054-0x0;var _0x2a5ed6=_0x268f[_0x22c054];return _0x2a5ed6;};'use strict';var _=require(_0xf268('0x0'));var rp=require(_0xf268('0x1'));var md5=require(_0xf268('0x2'));var util=require(_0xf268('0x3'));var Redis=require('ioredis');var intUtil=require(_0xf268('0x4'));var config=require('../../../../config/environment');var logger=require(_0xf268('0x5'))(_0xf268('0x6'));config[_0xf268('0x7')]=_['defaults'](config[_0xf268('0x7')],{'host':_0xf268('0x8'),'port':0x18eb});var io=require(_0xf268('0x9'))(new Redis(config[_0xf268('0x7')]));function emit(_0x3101e3,_0x3b63b5,_0x56af74){io['to'](_0x3101e3)[_0xf268('0xa')](_0x3b63b5,_0x56af74);}var headers={'Content-Type':_0xf268('0xb'),'Accept':_0xf268('0xb')};function getTicket(_0x2ea277,_0xda3c22,_0x36ef00,_0xa416ff,_0x1f94de){logger[_0xf268('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xf268('0xd')](_0xf268('0xe'),_0x2ea277['remoteUri']),'method':_0xf268('0xf'),'body':{'ticket':_[_0xf268('0x10')]({'requester_id':_0x36ef00['id'],'submitter_id':_0xda3c22?_0xda3c22['id']:undefined,'assignee_id':_0xda3c22?_0xda3c22['id']:undefined,'tags':getTags(_0xa416ff[_0xf268('0x11')],'name'),'subject':intUtil['getString'](_0xa416ff[_0xf268('0x12')],_0x1f94de,'\x20'),'description':intUtil[_0xf268('0x13')](_0xa416ff[_0xf268('0x14')],_0x1f94de,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xa416ff['Descriptions'],_0x1f94de,'\x0a')}},getCustomFields(_0xa416ff[_0xf268('0x15')],_0x1f94de))}})[_0xf268('0x16')](function(_0x25b939){logger['info'](_0xf268('0x17'));return _0x25b939[_0xf268('0x18')];});}function getUser(_0x3a5a42,_0x573130){if(intUtil[_0xf268('0x19')](_0x573130)){logger[_0xf268('0xc')](_0xf268('0x1a'),_0x573130);return request({'uri':util[_0xf268('0xd')](_0xf268('0x1b'),_0x3a5a42['remoteUri']),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x573130)}})[_0xf268('0x16')](function(_0x416083){if(_0x416083[_0xf268('0x1c')]){logger[_0xf268('0xc')](_0xf268('0x1d'));return _[_0xf268('0x1e')](_0x416083['results'],{'email':_0x573130,'role':_0xf268('0x1f')});}else{logger[_0xf268('0xc')](_0xf268('0x20'));return request({'uri':util[_0xf268('0xd')]('%s/users/me.json',_0x3a5a42[_0xf268('0x21')])})[_0xf268('0x16')](function(_0x26b316){logger[_0xf268('0xc')](_0xf268('0x22'));return _0x26b316['user'];});}});}else{logger[_0xf268('0xc')](_0xf268('0x20'));return request({'uri':util[_0xf268('0xd')](_0xf268('0x23'),_0x3a5a42[_0xf268('0x21')])})[_0xf268('0x16')](function(_0x1b47af){logger[_0xf268('0xc')](_0xf268('0x22'));return _0x1b47af[_0xf268('0x24')];});}}function getEndUser(_0x44ec9c,_0xe04f2,_0x300e45){logger[_0xf268('0xc')]('Searching\x20enduser\x20with\x20phone',_0x300e45);return request({'uri':util['format']('%s/search.json',_0x44ec9c[_0xf268('0x21')]),'qs':{'query':util[_0xf268('0xd')](_0xf268('0x25'),_0x300e45)}})['then'](function(_0x9d157c){var _0x118b9c;if(_0x9d157c['results'][_0xf268('0x26')]){_0x9d157c['results']=_[_0xf268('0x27')](_0x9d157c[_0xf268('0x28')],{'suspended':![],'role':_0xf268('0x29')});if(_0x9d157c[_0xf268('0x28')][_0xf268('0x26')]){_0x118b9c=_[_0xf268('0x2a')](_0x9d157c[_0xf268('0x28')]);}}if(_0x118b9c){logger[_0xf268('0xc')]('Enduser\x20found!');return _0x118b9c;}else{logger[_0xf268('0xc')](_0xf268('0x2b'));return request({'uri':util[_0xf268('0xd')](_0xf268('0x2c'),_0x44ec9c[_0xf268('0x21')]),'method':_0xf268('0xf'),'body':{'user':{'role':_0xf268('0x29'),'name':util[_0xf268('0xd')](_0xf268('0x2d'),_0xe04f2||_0x300e45),'phone':_0x300e45}}})[_0xf268('0x16')](function(_0x4d452b){logger[_0xf268('0xc')](_0xf268('0x2e'));return _0x4d452b['user'];});}});}function getAuth(_0x81acf2){var _0x403ce5;if(_0x81acf2[_0xf268('0x2f')]===_0xf268('0x30')){_0x403ce5=util[_0xf268('0xd')](_0xf268('0x31'),_0x81acf2[_0xf268('0x32')],_0x81acf2[_0xf268('0x30')]);}else if(_0x81acf2['authType']==='token'){_0x403ce5=util[_0xf268('0xd')]('%s/token:%s',_0x81acf2[_0xf268('0x32')],_0x81acf2[_0xf268('0x33')]);}return util['format'](_0xf268('0x34'),new Buffer(_0x403ce5)['toString'](_0xf268('0x35')));}function request(_0x14b324){logger[_0xf268('0x36')](_0xf268('0x37'),JSON['stringify'](_0x14b324));return rp(_[_0xf268('0x38')](_0x14b324,{'method':_0xf268('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3fc0ea,_0x158bbb){var _0x2481ba=[];if(_0x3fc0ea&&_0x3fc0ea[_0xf268('0x26')]>0x0){_0x2481ba=_[_0xf268('0x3a')](_0x3fc0ea,_0x158bbb);}return _0x2481ba;}function getCustomFields(_0x26f679,_0x2e5274){var _0xcf25a=[];var _0x4d1da2={'custom_fields':[]};if(_0x26f679['length']>0x0){_['forEach'](_0x26f679,function(_0x184598){if(_0x184598[_0xf268('0x3b')]===_0xf268('0x3c')&&_0x184598[_0xf268('0x3d')]&&!_0x184598[_0xf268('0x3e')]){_0x4d1da2[_0x184598[_0xf268('0x3d')][_0xf268('0x3f')]()]=_0x184598[_0xf268('0x40')][_0xf268('0x41')]();}else if(_0x184598['type']===_0xf268('0x3c')&&_0x184598[_0xf268('0x42')]&&_0x184598[_0xf268('0x3e')]){_0x4d1da2['custom_fields'][_0xf268('0x43')]({'id':_0x184598[_0xf268('0x42')],'value':_0x184598[_0xf268('0x40')][_0xf268('0x41')]()});}else if(_0x184598[_0xf268('0x3b')]===_0xf268('0x44')&&_0x184598['variableName']&&_0x184598[_0xf268('0x42')]&&_0x184598[_0xf268('0x3e')]){_0x2e5274[_0x184598['variableName']]&&_0x4d1da2[_0xf268('0x45')]['push']({'id':_0x184598[_0xf268('0x42')],'value':_0x2e5274[_0x184598[_0xf268('0x46')]][_0xf268('0x41')]()});}else if(_0x184598[_0xf268('0x3b')]===_0xf268('0x47')&&_0x184598['Variable']&&_0x184598[_0xf268('0x48')][_0xf268('0x49')]&&_0x184598['idField']&&_0x184598['customField']){_0x2e5274[_0x184598['Variable'][_0xf268('0x49')][_0xf268('0x3f')]()]&&_0x4d1da2[_0xf268('0x45')][_0xf268('0x43')]({'id':_0x184598[_0xf268('0x42')],'value':_0x2e5274[_0x184598[_0xf268('0x48')][_0xf268('0x49')][_0xf268('0x3f')]()][_0xf268('0x41')]()});}});}return _0x4d1da2;}exports[_0xf268('0x4a')]=function(_0x3d13ce,_0x26a731,_0x5ace73,_0x4dcbda,_0x4bf6af,_0x44b598){var _0x116f19,_0x275110;_0x44b598[_0xf268('0x21')]=intUtil[_0xf268('0x4b')](_0x44b598[_0xf268('0x21')]);_0x44b598['serverUrl']=intUtil['stripTrailingSlash'](_0x44b598[_0xf268('0x4c')]);if(_0x4bf6af&&_0x4bf6af[_0xf268('0x4d')]){logger[_0xf268('0xc')](_0xf268('0x4e'),'Recording\x20is\x20enabled!');_0x26a731[_0xf268('0x4f')]=util[_0xf268('0xd')](_0xf268('0x50'),_0x44b598[_0xf268('0x4c')],_0x26a731['uniqueid'],md5(_0x26a731[_0xf268('0x51')]));}else{_0x26a731['recordingURL']='';}headers[_0xf268('0x52')]=getAuth(_0x44b598);return getUser(_0x44b598,_0x4dcbda['email'])[_0xf268('0x16')](function(_0x5db0d9){_0x116f19=_0x5db0d9;logger['info'](_0xf268('0x53'),_0x116f19['id']);return getEndUser(_0x44b598,_0x26a731[_0xf268('0x54')],_0x26a731[_0xf268('0x55')]);})[_0xf268('0x16')](function(_0x487595){_0x275110=_0x487595;logger[_0xf268('0xc')](_0xf268('0x56'),_0x275110['id']);return getTicket(_0x44b598,_0x116f19,_0x275110,_0x5ace73,_0x26a731);})['then'](function(_0x14a27c){if(_0x14a27c){logger[_0xf268('0xc')](_0xf268('0x57'),_0x14a27c['id']);switch(_0x44b598[_0xf268('0x3b')]){case'integrationTab':logger[_0xf268('0xc')]('[QUEUE]',_0xf268('0x58'));return request({'uri':util[_0xf268('0xd')](_0xf268('0x59'),_0x44b598[_0xf268('0x21')],_0x116f19['id'],_0x14a27c['id']),'method':_0xf268('0xf')});case _0xf268('0x5a'):logger[_0xf268('0xc')]('[QUEUE]',_0xf268('0x5b'));emit(util[_0xf268('0xd')](_0xf268('0x5c'),_0x4dcbda['name']),_0xf268('0x5d'),{'uri':util['format']('%s/agent/tickets/%s',_0x44b598[_0xf268('0x21')]['replace']('/api/v2',''),_0x14a27c['id'])});break;default:logger[_0xf268('0x5e')](_0xf268('0x4e'),_0xf268('0x5f'));}}})['catch'](function(_0x1e74be){logger[_0xf268('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1e74be,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x1cd806,_0x5156b9,_0x19d1fd,_0x208def,_0x21cbab,_0x305709,_0x14d90c){var _0x2a79c6,_0x4f74ec;_0x305709[_0xf268('0x21')]=intUtil['stripTrailingSlash'](_0x305709['remoteUri']);_0x305709[_0xf268('0x4c')]=intUtil['stripTrailingSlash'](_0x305709['serverUrl']);if(_0x14d90c&&_0x14d90c['recordingFormat']&&_0x14d90c['recordingFormat']!==_0xf268('0x60')){logger[_0xf268('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5156b9[_0xf268('0x4f')]=util[_0xf268('0xd')](_0xf268('0x50'),_0x305709['serverUrl'],_0x5156b9[_0xf268('0x51')],md5(_0x5156b9[_0xf268('0x51')]));}headers['Authorization']=getAuth(_0x305709);return getUser(_0x305709,_0x208def[_0xf268('0x61')])[_0xf268('0x16')](function(_0x505f2f){_0x2a79c6=_0x505f2f;logger[_0xf268('0xc')](_0xf268('0x53'),_0x2a79c6['id']);return getEndUser(_0x305709,_0x5156b9[_0xf268('0x62')],_0x5156b9[_0xf268('0x63')]);})[_0xf268('0x16')](function(_0x41c45a){_0x4f74ec=_0x41c45a;logger[_0xf268('0xc')](_0xf268('0x56'),_0x4f74ec['id']);return getTicket(_0x305709,_0x2a79c6,_0x4f74ec,_0x19d1fd,_0x5156b9);})['then'](function(_0x3282ba){if(_0x3282ba){logger[_0xf268('0xc')](_0xf268('0x57'),_0x3282ba['id']);switch(_0x305709[_0xf268('0x3b')]){case _0xf268('0x64'):logger['info'](_0xf268('0x65'),_0xf268('0x58'));return request({'uri':util[_0xf268('0xd')](_0xf268('0x59'),_0x305709['remoteUri'],_0x2a79c6['id'],_0x3282ba['id']),'method':_0xf268('0xf')});case _0xf268('0x5a'):logger[_0xf268('0xc')]('[OUTBOUND]',_0xf268('0x5b'));emit(util[_0xf268('0xd')]('user:%s',_0x208def[_0xf268('0x49')]),_0xf268('0x5d'),{'uri':util[_0xf268('0xd')](_0xf268('0x66'),_0x305709[_0xf268('0x21')][_0xf268('0x67')](_0xf268('0x68'),''),_0x3282ba['id'])});break;default:logger['error']('[OUTBOUND]',_0xf268('0x5f'));}}})[_0xf268('0x69')](function(_0x2e3b1e){logger[_0xf268('0x5e')](_0xf268('0x6a'),util[_0xf268('0x6b')](_0x2e3b1e,{'showHidden':!![],'depth':null}));});};exports[_0xf268('0x6c')]=function(_0x393009,_0x38074b,_0x21de2a,_0x15a5cf,_0x3f2837,_0x3d8280){var _0x2f4338,_0x4be4d7;_0x3d8280['remoteUri']=intUtil[_0xf268('0x4b')](_0x3d8280[_0xf268('0x21')]);_0x3d8280['serverUrl']=intUtil[_0xf268('0x4b')](_0x3d8280[_0xf268('0x4c')]);if(_0x3f2837&&_0x3f2837[_0xf268('0x4d')]){logger['info']('['+_0x38074b[_0xf268('0x6d')]['toUpperCase']()+']',_0xf268('0x6e'));_0x38074b['recordingURL']=util[_0xf268('0xd')](_0xf268('0x50'),_0x3d8280['serverUrl'],_0x38074b[_0xf268('0x51')],md5(_0x38074b[_0xf268('0x51')]));}else{_0x38074b[_0xf268('0x4f')]='';}headers['Authorization']=getAuth(_0x3d8280);return getUser(_0x3d8280)[_0xf268('0x16')](function(_0xafa75e){_0x2f4338=_0xafa75e;logger['info']('The\x20User\x20ID\x20is:',_0x2f4338['id']);return getEndUser(_0x3d8280,_0x38074b[_0xf268('0x54')],_0x38074b[_0xf268('0x55')]);})[_0xf268('0x16')](function(_0x52862c){_0x4be4d7=_0x52862c;logger[_0xf268('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4be4d7['id']);return getTicket(_0x3d8280,_0x2f4338,_0x4be4d7,_0x21de2a,_0x38074b);})[_0xf268('0x16')](function(_0x3f05c5){if(_0x3f05c5){logger['info'](_0xf268('0x57'),_0x3f05c5['id']);}})[_0xf268('0x69')](function(_0x5424f4){logger['error']('['+_0x38074b['lastevent'][_0xf268('0x6f')]()+']'+_0xf268('0x70'),util[_0xf268('0x6b')](_0x5424f4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0991=['[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','destcalleridname','[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','catch','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','zendesk','defaults','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','length','map','forEach','type','string','nameField','toLowerCase','content','idField','customField','custom_fields','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x0991,0x1bb));var _0x1099=function(_0x2127a8,_0x33f7a9){_0x2127a8=_0x2127a8-0x0;var _0x489f80=_0x0991[_0x2127a8];return _0x489f80;};'use strict';var _=require(_0x1099('0x0'));var rp=require(_0x1099('0x1'));var md5=require(_0x1099('0x2'));var util=require(_0x1099('0x3'));var Redis=require(_0x1099('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x1099('0x5'));config['redis']=_[_0x1099('0x6')](config[_0x1099('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1099('0x8'))(new Redis(config[_0x1099('0x7')]));function emit(_0x320584,_0x528258,_0x5171ed){io['to'](_0x320584)[_0x1099('0x9')](_0x528258,_0x5171ed);}var headers={'Content-Type':_0x1099('0xa'),'Accept':'application/json'};function getTicket(_0x62aee0,_0x24cf52,_0x2c3ff5,_0x408f0d,_0x1eabe8){logger[_0x1099('0xb')](_0x1099('0xc'));return request({'uri':util[_0x1099('0xd')](_0x1099('0xe'),_0x62aee0[_0x1099('0xf')]),'method':_0x1099('0x10'),'body':{'ticket':_[_0x1099('0x11')]({'requester_id':_0x2c3ff5['id'],'submitter_id':_0x24cf52?_0x24cf52['id']:undefined,'assignee_id':_0x24cf52?_0x24cf52['id']:undefined,'tags':getTags(_0x408f0d[_0x1099('0x12')],_0x1099('0x13')),'subject':intUtil[_0x1099('0x14')](_0x408f0d[_0x1099('0x15')],_0x1eabe8,'\x20'),'description':intUtil[_0x1099('0x14')](_0x408f0d[_0x1099('0x16')],_0x1eabe8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x1099('0x14')](_0x408f0d[_0x1099('0x16')],_0x1eabe8,'\x0a')}},getCustomFields(_0x408f0d[_0x1099('0x17')],_0x1eabe8))}})[_0x1099('0x18')](function(_0x1347b7){logger['info']('Ticket\x20created!');return _0x1347b7[_0x1099('0x19')];});}function getUser(_0x54e16e,_0x3fda02){if(intUtil['validateEmail'](_0x3fda02)){logger['info'](_0x1099('0x1a'),_0x3fda02);return request({'uri':util[_0x1099('0xd')](_0x1099('0x1b'),_0x54e16e[_0x1099('0xf')]),'qs':{'query':util[_0x1099('0xd')]('type:user\x20role:agent\x20email:%s',_0x3fda02)}})[_0x1099('0x18')](function(_0xab6e34){if(_0xab6e34['count']){logger['info'](_0x1099('0x1c'));return _['find'](_0xab6e34['results'],{'email':_0x3fda02,'role':_0x1099('0x1d')});}else{logger[_0x1099('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x1099('0x1e'),_0x54e16e[_0x1099('0xf')])})[_0x1099('0x18')](function(_0x8a16f3){logger[_0x1099('0xb')](_0x1099('0x1f'));return _0x8a16f3[_0x1099('0x20')];});}});}else{logger[_0x1099('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x1099('0xd')](_0x1099('0x1e'),_0x54e16e[_0x1099('0xf')])})[_0x1099('0x18')](function(_0x485abc){logger[_0x1099('0xb')](_0x1099('0x1f'));return _0x485abc[_0x1099('0x20')];});}}function getEndUser(_0x78f5e8,_0x559d98,_0x11ebe3){logger['info'](_0x1099('0x21'),_0x11ebe3);return request({'uri':util['format']('%s/search.json',_0x78f5e8[_0x1099('0xf')]),'qs':{'query':util[_0x1099('0xd')](_0x1099('0x22'),_0x11ebe3)}})['then'](function(_0xda4f7e){var _0x120a45;if(_0xda4f7e[_0x1099('0x23')]['length']){_0xda4f7e['results']=_['filter'](_0xda4f7e['results'],{'suspended':![],'role':'end-user'});if(_0xda4f7e[_0x1099('0x23')]['length']){_0x120a45=_[_0x1099('0x24')](_0xda4f7e[_0x1099('0x23')]);}}if(_0x120a45){logger[_0x1099('0xb')](_0x1099('0x25'));return _0x120a45;}else{logger['info'](_0x1099('0x26'));return request({'uri':util[_0x1099('0xd')](_0x1099('0x27'),_0x78f5e8['remoteUri']),'method':'POST','body':{'user':{'role':_0x1099('0x28'),'name':util[_0x1099('0xd')](_0x1099('0x29'),_0x559d98||_0x11ebe3),'phone':_0x11ebe3}}})['then'](function(_0x901fe8){logger[_0x1099('0xb')](_0x1099('0x2a'));return _0x901fe8[_0x1099('0x20')];});}});}function getAuth(_0x552060){var _0x11aec9;if(_0x552060[_0x1099('0x2b')]===_0x1099('0x2c')){_0x11aec9=util[_0x1099('0xd')](_0x1099('0x2d'),_0x552060['username'],_0x552060[_0x1099('0x2c')]);}else if(_0x552060['authType']===_0x1099('0x2e')){_0x11aec9=util[_0x1099('0xd')](_0x1099('0x2f'),_0x552060['username'],_0x552060['token']);}return util[_0x1099('0xd')](_0x1099('0x30'),new Buffer(_0x11aec9)[_0x1099('0x31')](_0x1099('0x32')));}function request(_0x540566){logger[_0x1099('0x33')]('[HTTP]',JSON['stringify'](_0x540566));return rp(_['defaults'](_0x540566,{'method':_0x1099('0x34'),'headers':headers,'json':!![]}));}function getTags(_0xf7244e,_0x3326da){var _0x4f0b35=[];if(_0xf7244e&&_0xf7244e[_0x1099('0x35')]>0x0){_0x4f0b35=_[_0x1099('0x36')](_0xf7244e,_0x3326da);}return _0x4f0b35;}function getCustomFields(_0x540db6,_0x469897){var _0x3bdfc3=[];var _0x1c58bd={'custom_fields':[]};if(_0x540db6[_0x1099('0x35')]>0x0){_[_0x1099('0x37')](_0x540db6,function(_0x2bd2ab){if(_0x2bd2ab[_0x1099('0x38')]===_0x1099('0x39')&&_0x2bd2ab['nameField']&&!_0x2bd2ab['customField']){_0x1c58bd[_0x2bd2ab[_0x1099('0x3a')][_0x1099('0x3b')]()]=_0x2bd2ab[_0x1099('0x3c')]['toString']();}else if(_0x2bd2ab[_0x1099('0x38')]==='string'&&_0x2bd2ab[_0x1099('0x3d')]&&_0x2bd2ab[_0x1099('0x3e')]){_0x1c58bd[_0x1099('0x3f')]['push']({'id':_0x2bd2ab[_0x1099('0x3d')],'value':_0x2bd2ab[_0x1099('0x3c')][_0x1099('0x31')]()});}else if(_0x2bd2ab[_0x1099('0x38')]==='variable'&&_0x2bd2ab['variableName']&&_0x2bd2ab['idField']&&_0x2bd2ab[_0x1099('0x3e')]){_0x469897[_0x2bd2ab[_0x1099('0x40')]]&&_0x1c58bd[_0x1099('0x3f')][_0x1099('0x41')]({'id':_0x2bd2ab[_0x1099('0x3d')],'value':_0x469897[_0x2bd2ab[_0x1099('0x40')]][_0x1099('0x31')]()});}else if(_0x2bd2ab['type']===_0x1099('0x42')&&_0x2bd2ab[_0x1099('0x43')]&&_0x2bd2ab[_0x1099('0x43')]['name']&&_0x2bd2ab['idField']&&_0x2bd2ab['customField']){_0x469897[_0x2bd2ab[_0x1099('0x43')][_0x1099('0x13')][_0x1099('0x3b')]()]&&_0x1c58bd[_0x1099('0x3f')][_0x1099('0x41')]({'id':_0x2bd2ab['idField'],'value':_0x469897[_0x2bd2ab[_0x1099('0x43')]['name']['toLowerCase']()][_0x1099('0x31')]()});}});}return _0x1c58bd;}exports['queue']=function(_0x9483b8,_0x562933,_0x32c1cb,_0x163101,_0x160013,_0x1af807){var _0x118ed4,_0x23c3bc;_0x1af807[_0x1099('0xf')]=intUtil[_0x1099('0x44')](_0x1af807['remoteUri']);_0x1af807[_0x1099('0x45')]=intUtil[_0x1099('0x44')](_0x1af807[_0x1099('0x45')]);if(_0x160013&&_0x160013[_0x1099('0x46')]){logger[_0x1099('0xb')]('[QUEUE]',_0x1099('0x47'));_0x562933[_0x1099('0x48')]=util[_0x1099('0xd')](_0x1099('0x49'),_0x1af807['serverUrl'],_0x562933['uniqueid'],md5(_0x562933[_0x1099('0x4a')]));}else{_0x562933['recordingURL']='';}headers[_0x1099('0x4b')]=getAuth(_0x1af807);return getUser(_0x1af807,_0x163101[_0x1099('0x4c')])[_0x1099('0x18')](function(_0x3c25a3){_0x118ed4=_0x3c25a3;logger['info'](_0x1099('0x4d'),_0x118ed4['id']);return getEndUser(_0x1af807,_0x562933[_0x1099('0x4e')],_0x562933['calleridnum']);})['then'](function(_0x5a57c7){_0x23c3bc=_0x5a57c7;logger[_0x1099('0xb')](_0x1099('0x4f'),_0x23c3bc['id']);return getTicket(_0x1af807,_0x118ed4,_0x23c3bc,_0x32c1cb,_0x562933);})[_0x1099('0x18')](function(_0x3cdf0d){if(_0x3cdf0d){logger[_0x1099('0xb')](_0x1099('0x50'),_0x3cdf0d['id']);switch(_0x1af807[_0x1099('0x38')]){case _0x1099('0x51'):logger['info'](_0x1099('0x52'),_0x1099('0x53'));return request({'uri':util[_0x1099('0xd')](_0x1099('0x54'),_0x1af807[_0x1099('0xf')],_0x118ed4['id'],_0x3cdf0d['id']),'method':_0x1099('0x10')});case _0x1099('0x55'):logger[_0x1099('0xb')](_0x1099('0x52'),_0x1099('0x56'));emit(util['format'](_0x1099('0x57'),_0x163101[_0x1099('0x13')]),_0x1099('0x58'),{'uri':util[_0x1099('0xd')]('%s/agent/tickets/%s',_0x1af807[_0x1099('0xf')][_0x1099('0x59')](_0x1099('0x5a'),''),_0x3cdf0d['id'])});break;default:logger[_0x1099('0x5b')](_0x1099('0x52'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x55f31b){logger[_0x1099('0x5b')](_0x1099('0x5c'),util[_0x1099('0x5d')](_0x55f31b,{'showHidden':!![],'depth':null}));});};exports[_0x1099('0x5e')]=function(_0x10d84c,_0xe53912,_0x20040f,_0x22da2e,_0x5e4151,_0x177a03,_0x1084d7){var _0x5742d8,_0x170714;_0x177a03[_0x1099('0xf')]=intUtil[_0x1099('0x44')](_0x177a03['remoteUri']);_0x177a03['serverUrl']=intUtil[_0x1099('0x44')](_0x177a03[_0x1099('0x45')]);if(_0x1084d7&&_0x1084d7[_0x1099('0x5f')]&&_0x1084d7[_0x1099('0x5f')]!=='none'){logger[_0x1099('0xb')]('[OUTBOUND]',_0x1099('0x47'));_0xe53912[_0x1099('0x48')]=util[_0x1099('0xd')](_0x1099('0x49'),_0x177a03[_0x1099('0x45')],_0xe53912[_0x1099('0x4a')],md5(_0xe53912[_0x1099('0x4a')]));}headers[_0x1099('0x4b')]=getAuth(_0x177a03);return getUser(_0x177a03,_0x22da2e[_0x1099('0x4c')])[_0x1099('0x18')](function(_0x5c41cb){_0x5742d8=_0x5c41cb;logger[_0x1099('0xb')](_0x1099('0x4d'),_0x5742d8['id']);return getEndUser(_0x177a03,_0xe53912[_0x1099('0x60')],_0xe53912['destcalleridnum']);})[_0x1099('0x18')](function(_0x259425){_0x170714=_0x259425;logger[_0x1099('0xb')]('The\x20Enduser\x20ID\x20is:',_0x170714['id']);return getTicket(_0x177a03,_0x5742d8,_0x170714,_0x20040f,_0xe53912);})[_0x1099('0x18')](function(_0x1450b4){if(_0x1450b4){logger[_0x1099('0xb')](_0x1099('0x50'),_0x1450b4['id']);switch(_0x177a03['type']){case _0x1099('0x51'):logger[_0x1099('0xb')](_0x1099('0x61'),_0x1099('0x53'));return request({'uri':util[_0x1099('0xd')](_0x1099('0x54'),_0x177a03[_0x1099('0xf')],_0x5742d8['id'],_0x1450b4['id']),'method':_0x1099('0x10')});case _0x1099('0x55'):logger[_0x1099('0xb')](_0x1099('0x61'),_0x1099('0x56'));emit(util[_0x1099('0xd')](_0x1099('0x57'),_0x22da2e['name']),'trigger:browser:url',{'uri':util[_0x1099('0xd')]('%s/agent/tickets/%s',_0x177a03[_0x1099('0xf')][_0x1099('0x59')](_0x1099('0x5a'),''),_0x1450b4['id'])});break;default:logger[_0x1099('0x5b')](_0x1099('0x61'),_0x1099('0x62'));}}})['catch'](function(_0x150ae9){logger[_0x1099('0x5b')](_0x1099('0x63'),util['inspect'](_0x150ae9,{'showHidden':!![],'depth':null}));});};exports[_0x1099('0x64')]=function(_0x5c56a5,_0x4374df,_0x233c62,_0xa8183b,_0x17c022,_0x3e45df){var _0x41d3a7,_0x488273;_0x3e45df[_0x1099('0xf')]=intUtil['stripTrailingSlash'](_0x3e45df[_0x1099('0xf')]);_0x3e45df[_0x1099('0x45')]=intUtil[_0x1099('0x44')](_0x3e45df[_0x1099('0x45')]);if(_0x17c022&&_0x17c022[_0x1099('0x46')]){logger[_0x1099('0xb')]('['+_0x4374df['lastevent'][_0x1099('0x65')]()+']',_0x1099('0x47'));_0x4374df[_0x1099('0x48')]=util[_0x1099('0xd')](_0x1099('0x49'),_0x3e45df[_0x1099('0x45')],_0x4374df[_0x1099('0x4a')],md5(_0x4374df[_0x1099('0x4a')]));}else{_0x4374df[_0x1099('0x48')]='';}headers['Authorization']=getAuth(_0x3e45df);return getUser(_0x3e45df)[_0x1099('0x18')](function(_0x1e5b01){_0x41d3a7=_0x1e5b01;logger[_0x1099('0xb')](_0x1099('0x4d'),_0x41d3a7['id']);return getEndUser(_0x3e45df,_0x4374df[_0x1099('0x4e')],_0x4374df['calleridnum']);})[_0x1099('0x18')](function(_0x3187ea){_0x488273=_0x3187ea;logger[_0x1099('0xb')](_0x1099('0x4f'),_0x488273['id']);return getTicket(_0x3e45df,_0x41d3a7,_0x488273,_0x233c62,_0x4374df);})['then'](function(_0x89cc5f){if(_0x89cc5f){logger[_0x1099('0xb')](_0x1099('0x50'),_0x89cc5f['id']);}})[_0x1099('0x66')](function(_0x28b838){logger[_0x1099('0x5b')]('['+_0x4374df[_0x1099('0x67')][_0x1099('0x65')]()+']'+_0x1099('0x68'),util[_0x1099('0x5d')](_0x28b838,{'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 50be62e..e856fb5 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 _0x94c9=['destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','lastevent','toUpperCase','./util','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','type','string','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken','clientSecret','refresh_token','add','expires_in','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','then','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Description','Who_Id','First_Name','Last_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','called','complete','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','email'];(function(_0x20187f,_0xbf67c9){var _0x398db5=function(_0x3b7ac2){while(--_0x3b7ac2){_0x20187f['push'](_0x20187f['shift']());}};_0x398db5(++_0xbf67c9);}(_0x94c9,0x1b5));var _0x994c=function(_0x47e750,_0x4d44ca){_0x47e750=_0x47e750-0x0;var _0xbc91aa=_0x94c9[_0x47e750];return _0xbc91aa;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0x994c('0x0'));var moment=require('moment');var Redis=require(_0x994c('0x1'));var BPromise=require(_0x994c('0x2'));var config=require(_0x994c('0x3'));var logger=require(_0x994c('0x4'))(_0x994c('0x5'));config[_0x994c('0x6')]=_['defaults'](config['redis'],{'host':_0x994c('0x7'),'port':0x18eb});var io=require(_0x994c('0x8'))(new Redis(config['redis']));function emit(_0x14559e,_0x1794cf,_0x5c3fa0){io['to'](_0x14559e)[_0x994c('0x9')](_0x1794cf,_0x5c3fa0);}function request(_0x1f7347){logger[_0x994c('0xa')](_0x994c('0xb'),JSON['stringify'](_0x1f7347));return rp(_0x1f7347);}function getCustomFields(_0x3a57be,_0x26fddf){var _0x2980ce={};if(_0x3a57be['length']>0x0){_['forEach'](_0x3a57be,function(_0x273cbc){if(_0x273cbc[_0x994c('0xc')]===_0x994c('0xd')&&_0x273cbc[_0x994c('0xe')]){_0x2980ce[_0x273cbc[_0x994c('0xe')]]=_0x273cbc[_0x994c('0xf')]['toString']();}else if(_0x273cbc[_0x994c('0xc')]==='variable'&&_0x273cbc[_0x994c('0x10')]&&_0x273cbc[_0x994c('0xe')]&&_0x26fddf[_0x273cbc[_0x994c('0x10')]]){_0x2980ce[_0x273cbc['idField']]=_0x26fddf[_0x273cbc['variableName']][_0x994c('0x11')]();}else if(_0x273cbc[_0x994c('0xc')]===_0x994c('0x12')&&_0x273cbc[_0x994c('0x13')]&&_0x273cbc[_0x994c('0x13')]['name']&&_0x273cbc[_0x994c('0xe')]&&_0x26fddf[_0x273cbc[_0x994c('0x13')][_0x994c('0x14')][_0x994c('0x15')]()]){_0x2980ce[_0x273cbc[_0x994c('0xe')]]=_0x26fddf[_0x273cbc[_0x994c('0x13')]['name'][_0x994c('0x15')]()][_0x994c('0x11')]();}});}return _0x2980ce;}function getName(_0x280d68){if(_0x280d68['indexOf']('\x20')>0x0){var _0x20c1d7=_0x280d68[_0x994c('0x16')](/ (.+)/);if(_0x20c1d7[0x1]){return _0x20c1d7;}}return[_0x280d68,_0x280d68];}var accountsTokens={};function getAccessToken(_0x59b26b){return new Promise(function(_0x49fa50,_0x508886){if(!_[_0x994c('0x17')](accountsTokens[_0x59b26b['id']])&&!_[_0x994c('0x17')](accountsTokens[_0x59b26b['id']][_0x994c('0x18')])){if(moment()['isBefore'](accountsTokens[_0x59b26b['id']]['expires_in'])){_0x49fa50(accountsTokens[_0x59b26b['id']][_0x994c('0x18')]);}}var _0x2403d2;switch(_0x59b26b[_0x994c('0x19')]){case'US':_0x2403d2='https://accounts.zoho.com';break;case'AU':_0x2403d2=_0x994c('0x1a');break;case'EU':_0x2403d2=_0x994c('0x1b');break;case'IN':_0x2403d2='https://accounts.zoho.in';break;case'CN':_0x2403d2='https://accounts.zoho.com.cn';break;default:_0x2403d2=_0x994c('0x1b');break;}var _0x128589={'method':_0x994c('0x1c'),'uri':_0x2403d2+'/oauth/v2/token','qs':{'refresh_token':_0x59b26b[_0x994c('0x1d')],'client_id':_0x59b26b['clientId'],'client_secret':_0x59b26b[_0x994c('0x1e')],'grant_type':_0x994c('0x1f')},'json':!![]};return rp(_0x128589)['then'](function(_0x43ac29){accountsTokens[_0x59b26b['id']]={'access_token':_0x43ac29[_0x994c('0x18')],'expires_in':moment()[_0x994c('0x20')](_0x43ac29[_0x994c('0x21')],_0x994c('0x22'))};_0x49fa50(_0x43ac29[_0x994c('0x18')]);})[_0x994c('0x23')](function(_0x285777){logger[_0x994c('0x24')](_0x994c('0x25'),_0x285777[_0x994c('0x26')]);_0x508886(_0x285777);});});}function getUser(_0x18014b,_0x58c71b,_0x41533b,_0x3cffb9){logger[_0x994c('0x27')](_0x994c('0x28'));return request({'method':_0x994c('0x29'),'uri':util[_0x994c('0x2a')](_0x994c('0x2b'),_0x58c71b),'qs':{'type':_0x994c('0x2c')},'headers':{'Authorization':_0x994c('0x2d')+_0x18014b},'json':!![]})[_0x994c('0x2e')](function(_0x238989){if(_0x238989[_0x994c('0x2f')]){var _0xf254dd=-0x1;if(_['isArrayLikeObject'](_0x238989['users'])){if(!_[_0x994c('0x17')](_0x3cffb9)){_0xf254dd=_[_0x994c('0x30')](_0x238989[_0x994c('0x2f')],function(_0xebfd68){return _0xebfd68['email']===_0x3cffb9;});}if(_0xf254dd>=0x0){logger[_0x994c('0x27')](_0x994c('0x31'));}else{logger[_0x994c('0x27')](_0x994c('0x32'));_0xf254dd=_[_0x994c('0x30')](_0x238989[_0x994c('0x2f')],function(_0x4ad932){return _0x4ad932[_0x994c('0x33')][_0x994c('0x14')]===_0x994c('0x34');});}return _0x238989[_0x994c('0x2f')][_0xf254dd];}else{if(_0x238989[_0x994c('0x35')][_0x994c('0x33')][_0x994c('0x14')]===_0x994c('0x34')){logger[_0x994c('0x27')](_0x994c('0x32'));user=_0x238989[_0x994c('0x35')];return user;}else{logger['error'](_0x994c('0x36'),JSON[_0x994c('0x37')](_0x238989));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x994c('0x37')](_0x238989));}}}else{logger[_0x994c('0x24')](_0x994c('0x36'),JSON['stringify'](_0x238989));throw new Error(_0x994c('0x38')+JSON[_0x994c('0x37')](_0x238989));}})[_0x994c('0x23')](function(_0x3dd911){console['error'](_0x3dd911);});}function getZohoUser(_0xf1d57e,_0x3b18a9){return new BPromise(function(_0x1dd8cd,_0x41cef9){request(_0xf1d57e)[_0x994c('0x2e')](function(_0x5ee588){var _0x2347ec=null;if(_0x5ee588){_0x2347ec=_0x5ee588[_0x994c('0x39')][0x0];_0x2347ec[_0x994c('0x3a')]=_0x3b18a9;}_0x1dd8cd(_0x2347ec);})[_0x994c('0x23')](function(_0x74ef48){_0x41cef9(_0x74ef48);});});}function createEndUser(_0x3c2d19,_0x36e600,_0x59875a,_0x4b9d6d,_0x121a60,_0x19b63d){var _0x59875a=getName(_0x59875a);return request({'method':_0x994c('0x1c'),'uri':_0x994c('0x3b')+_0x36e600+_0x994c('0x3c')+_[_0x994c('0x3d')](_0x19b63d[_0x994c('0x3e')])+'s','body':{'data':[{'Last_Name':_0x59875a[0x1],'First_Name':_0x59875a[0x0],'Phone':_0x4b9d6d,'Owner':{'name':!_[_0x994c('0x17')](_0x121a60['role'][_0x994c('0x14')])?_0x121a60[_0x994c('0x3f')][_0x994c('0x14')]:!_['isNil'](_0x121a60[_0x994c('0x40')])?_0x121a60['first_name']+'\x20'+_0x121a60[_0x994c('0x41')]:_0x121a60[_0x994c('0x41')],'id':_0x121a60['id']}}]},'headers':{'Authorization':_0x994c('0x2d')+_0x3c2d19},'json':!![]})[_0x994c('0x2e')](function(_0x2e3a2d){if(_0x2e3a2d&&_0x2e3a2d[_0x994c('0x39')][0x0][_0x994c('0x42')]===_0x994c('0x43')){var _0x5ae91d=_0x2e3a2d[_0x994c('0x39')][0x0][_0x994c('0x44')];_0x5ae91d[_0x994c('0x3a')]=_['startCase'](_0x19b63d[_0x994c('0x3e')])+'s';return _0x5ae91d;}logger[_0x994c('0x24')]('The\x20failing\x20result\x20is',JSON[_0x994c('0x37')](data));throw new Error('Error:\x20'+JSON[_0x994c('0x37')](data));})[_0x994c('0x23')](function(_0x5d42d5){console[_0x994c('0x45')](_0x994c('0x46'),_0x5d42d5);});}function getEndUser(_0x19c0f5,_0x1aea92,_0x5412bb,_0xc46318,_0x41bd34,_0x3a905c,_0x34cd3b){var _0x457f6b={'method':_0x994c('0x29'),'uri':'','headers':{'Authorization':_0x994c('0x2d')+_0x19c0f5},'json':!![]};switch(_0x34cd3b['moduleSearch']){case _0x994c('0x47'):_0x457f6b['uri']=_0x994c('0x3b')+_0x1aea92+_0x994c('0x48')+_0x41bd34+'))';return getZohoUser(_0x457f6b,_0x994c('0x49'))[_0x994c('0x2e')](function(_0x4842dd){if(_0x4842dd)return _0x4842dd;_0x457f6b[_0x994c('0x4a')]=_0x994c('0x3b')+_0x1aea92+_0x994c('0x4b')+_0x41bd34+'))';return getZohoUser(_0x457f6b,_0x994c('0x4c'))['then'](function(_0x33bc10){if(_0x33bc10)return _0x33bc10;if(_0x34cd3b[_0x994c('0x3e')]!=_0x994c('0x4d')){return createEndUser(_0x19c0f5,_0x1aea92,_0xc46318,_0x41bd34,_0x3a905c,_0x34cd3b);}else{return{};}});});break;case _0x994c('0x4e'):_0x457f6b[_0x994c('0x4a')]=_0x994c('0x3b')+_0x1aea92+_0x994c('0x48')+_0x41bd34+'))';return getZohoUser(_0x457f6b,_0x994c('0x49'))['then'](function(_0x29ca1c){if(_0x29ca1c)return _0x29ca1c;if(_0x34cd3b[_0x994c('0x3e')]!='nothing'){return createEndUser(_0x19c0f5,_0x1aea92,_0xc46318,_0x41bd34,_0x3a905c,_0x34cd3b);}else{return{};}});break;case _0x994c('0x4f'):_0x457f6b[_0x994c('0x4a')]=_0x994c('0x3b')+_0x1aea92+_0x994c('0x4b')+_0x41bd34+'))';return getZohoUser(_0x457f6b,_0x994c('0x4c'))[_0x994c('0x2e')](function(_0x1672f0){if(_0x1672f0)return _0x1672f0;if(_0x34cd3b['moduleCreate']!=_0x994c('0x4d')){return createEndUser(_0x19c0f5,_0x1aea92,_0xc46318,_0x41bd34,_0x3a905c,_0x34cd3b);}else{return{};}});break;}}function getCall(_0x1dc39f,_0x314b02,_0x5e02c5,_0x12fee4,_0x29366d,_0x43a8ec,_0x1a251b,_0x11e1cd){logger['info'](_0x994c('0x50'));var _0x5766b2={};_0x5766b2[_0x994c('0x51')]={'name':!_[_0x994c('0x17')](_0x12fee4[_0x994c('0x3f')]['name'])&&!_[_0x994c('0x17')](_0x12fee4['profile'][_0x994c('0x14')])&&_0x12fee4[_0x994c('0x33')][_0x994c('0x14')]===_0x994c('0x52')?_0x12fee4[_0x994c('0x3f')][_0x994c('0x14')]:!_[_0x994c('0x17')](_0x12fee4['first_name'])?_0x12fee4[_0x994c('0x40')]+'\x20'+_0x12fee4[_0x994c('0x41')]:_0x12fee4['last_name'],'id':_0x12fee4['id']};_0x5766b2[_0x994c('0x53')]=intUtil[_0x994c('0x54')](_0x43a8ec['Subjects'],_0x1a251b,'\x20');_0x5766b2[_0x994c('0x55')]=intUtil[_0x994c('0x54')](_0x43a8ec['Descriptions'],_0x1a251b,'\x0a');if(_0x29366d[_0x994c('0x3a')]===_0x994c('0x49')){_0x5766b2[_0x994c('0x56')]={'name':!_[_0x994c('0x17')](_0x29366d['Full_Name'])?_0x29366d['Full_Name']:!_[_0x994c('0x17')](_0x29366d[_0x994c('0x57')])?_0x29366d[_0x994c('0x57')]+'\x20'+_0x29366d[_0x994c('0x58')]:_0x29366d[_0x994c('0x58')],'id':_0x29366d['id']};}if(_0x29366d[_0x994c('0x3a')]==='Leads'){_0x5766b2['What_Id']={'name':!_[_0x994c('0x17')](_0x29366d['Full_Name'])?_0x29366d['Full_Name']:!_['isNil'](_0x29366d[_0x994c('0x57')])?_0x29366d['First_Name']+'\x20'+_0x29366d[_0x994c('0x58')]:_0x29366d[_0x994c('0x58')],'id':_0x29366d['id']};_0x5766b2[_0x994c('0x59')]=_[_0x994c('0x3d')](_0x29366d[_0x994c('0x3a')]);}if(_0x1a251b['talktime']){_0x5766b2[_0x994c('0x5a')]=moment[_0x994c('0x5b')](parseInt(_0x1a251b[_0x994c('0x5c')])*0x3e8)[_0x994c('0x2a')](_0x994c('0x5d'));}else if(_0x1a251b[_0x994c('0x5e')]&&_0x1a251b[_0x994c('0x5f')]){_0x5766b2[_0x994c('0x5a')]=moment[_0x994c('0x5b')](moment(_0x1a251b[_0x994c('0x5f')],_0x994c('0x60'))[_0x994c('0x61')](moment(_0x1a251b[_0x994c('0x62')],_0x994c('0x60'))))[_0x994c('0x2a')]('mm:ss');}switch(_0x1a251b['lastevent']){case _0x994c('0x63'):_0x5766b2['Call_Result']='Called';break;case _0x994c('0x64'):case'connect':_0x5766b2[_0x994c('0x65')]=_0x994c('0x66');break;case'rejected':_0x5766b2[_0x994c('0x65')]=_0x994c('0x67');break;case _0x994c('0x68'):_0x5766b2['Call_Result']=_0x994c('0x69');break;case _0x994c('0x6a'):_0x5766b2[_0x994c('0x65')]=_0x994c('0x6b');default:}_0x5766b2[_0x994c('0x6c')]=(_0x11e1cd===_0x994c('0x6d')?moment(_0x1a251b[_0x994c('0x62')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x1a251b['agentcalledAt'])[_0x994c('0x2a')](_0x994c('0x60')))||moment()[_0x994c('0x2a')]('YYYY-MM-DDTHH:mm:ss');_0x5766b2[_0x994c('0x6e')]=_0x11e1cd||_0x994c('0x6f');_0x5766b2=_['merge'](_0x5766b2,getCustomFields(_0x43a8ec['Fields'],_0x1a251b));return request({'method':_0x994c('0x1c'),'uri':_0x994c('0x3b')+_0x314b02+_0x994c('0x70'),'headers':{'Authorization':_0x994c('0x2d')+_0x1dc39f},'body':{'data':[_0x5766b2]},'json':!![]})[_0x994c('0x2e')](function(_0x840d3f){if(_0x840d3f&&_0x840d3f[_0x994c('0x39')][0x0][_0x994c('0x42')]===_0x994c('0x43')){logger['info'](_0x994c('0x71'));return{'id':_0x840d3f[_0x994c('0x39')][0x0][_0x994c('0x44')]['id']};}})[_0x994c('0x23')](function(_0x1b334e){logger[_0x994c('0x27')](_0x994c('0x72'),_0x1b334e[_0x994c('0x26')]);console[_0x994c('0x45')](_0x994c('0x72'),_0x1b334e);});}exports[_0x994c('0x73')]=function(_0x225762,_0x32657c,_0x3fdd8b,_0xe7e40c,_0x204ad0,_0x1c4b8e){var _0x27f766,_0x3eea61,_0x3d55a0;_0x1c4b8e[_0x994c('0x74')]=intUtil[_0x994c('0x75')](_0x1c4b8e[_0x994c('0x74')]);_0x1c4b8e[_0x994c('0x76')]=intUtil[_0x994c('0x75')](_0x1c4b8e[_0x994c('0x76')]);if(_0x204ad0&&_0x204ad0[_0x994c('0x77')]){logger[_0x994c('0x27')](_0x994c('0x78'),_0x994c('0x79'));_0x32657c[_0x994c('0x7a')]=_0x1c4b8e[_0x994c('0x76')]+_0x994c('0x7b')+_0x32657c['uniqueid']+_0x994c('0x7c')+md5(_0x32657c[_0x994c('0x7d')]);}else{_0x32657c[_0x994c('0x7a')]='';}var _0x1b8abe=_0x1c4b8e[_0x994c('0x74')]===_0x994c('0x7e')?'eu':_0x994c('0x7f');return getAccessToken(_0x1c4b8e)[_0x994c('0x2e')](function(_0x13410d){_0x3d55a0=_0x13410d;return getUser(_0x3d55a0,_0x1b8abe,_0x1c4b8e,_0xe7e40c['email']);})[_0x994c('0x2e')](function(_0x190a03){_0x27f766=_0x190a03;logger['info'](_0x994c('0x80'),_0x27f766['id']);return getEndUser(_0x3d55a0,_0x1b8abe,_0x1c4b8e,_0x32657c[_0x994c('0x81')],_0x32657c[_0x994c('0x82')],_0x27f766,_0x3fdd8b);})[_0x994c('0x2e')](function(_0xf8b1f3){_0x3eea61=_0xf8b1f3;return getCall(_0x3d55a0,_0x1b8abe,_0x1c4b8e,_0x27f766,_0x3eea61,_0x3fdd8b,_0x32657c,_0x994c('0x6f'));})[_0x994c('0x2e')](function(_0x356b7a){if(_0x356b7a){logger['info']('The\x20Call\x20ID\x20is:',_0x356b7a['id']);logger[_0x994c('0x27')](_0x994c('0x78'),_0x994c('0x83'));emit(util[_0x994c('0x2a')](_0x994c('0x84'),_0xe7e40c[_0x994c('0x14')]),_0x994c('0x85'),{'uri':_0x994c('0x86')+_0x1c4b8e[_0x994c('0x74')]+_0x994c('0x87')+_0x356b7a['id']});}})['catch'](function(_0x2e0ca9){logger[_0x994c('0x24')](_0x994c('0x78'),JSON[_0x994c('0x37')](_0x2e0ca9));});};exports['outbound']=function(_0x79e895,_0x505202,_0x2825ae,_0x3ae4f2,_0x34d39f,_0x1bb164,_0x1b9ae1){var _0x4f44bd,_0x349b52,_0x5e252d;_0x1bb164[_0x994c('0x74')]=intUtil[_0x994c('0x75')](_0x1bb164[_0x994c('0x74')]);_0x1bb164[_0x994c('0x76')]=intUtil[_0x994c('0x75')](_0x1bb164[_0x994c('0x76')]);if(_0x1b9ae1&&_0x1b9ae1[_0x994c('0x88')]&&_0x1b9ae1[_0x994c('0x88')]!==_0x994c('0x89')){logger['info']('[OUTBOUND]',_0x994c('0x79'));_0x505202[_0x994c('0x7a')]=_0x1bb164[_0x994c('0x76')]+_0x994c('0x7b')+_0x505202['uniqueid']+_0x994c('0x7c')+md5(_0x505202[_0x994c('0x7d')]);}var _0x5f55bf=_0x1bb164[_0x994c('0x74')]===_0x994c('0x7e')?'eu':'com';return getAccessToken(_0x1bb164)['then'](function(_0x4675d8){_0x5e252d=_0x4675d8;return getUser(_0x5e252d,_0x5f55bf,_0x1bb164,_0x3ae4f2[_0x994c('0x8a')]);})[_0x994c('0x2e')](function(_0xb54b9f){_0x4f44bd=_0xb54b9f;logger[_0x994c('0x27')](_0x994c('0x80'),_0x4f44bd['id']);return getEndUser(_0x5e252d,_0x5f55bf,_0x1bb164,_0x505202['destcalleridname'],_0x505202[_0x994c('0x8b')],_0x4f44bd,_0x2825ae);})[_0x994c('0x2e')](function(_0xf533eb){_0x349b52=_0xf533eb;return getCall(_0x5e252d,_0x5f55bf,_0x1bb164,_0x4f44bd,_0x349b52,_0x2825ae,_0x505202,'Outbound');})[_0x994c('0x2e')](function(_0x53d216){if(_0x53d216){logger[_0x994c('0x27')](_0x994c('0x8c'),_0x53d216['id']);logger['info'](_0x994c('0x8d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x994c('0x2a')]('user:%s',_0x3ae4f2['name']),_0x994c('0x85'),{'uri':_0x994c('0x86')+_0x1bb164[_0x994c('0x74')]+_0x994c('0x87')+_0x53d216['id']});}})[_0x994c('0x23')](function(_0x14e10d){logger[_0x994c('0x24')](_0x994c('0x8d'),JSON[_0x994c('0x37')](_0x14e10d));});};exports['unmanaged']=function(_0x7b35b8,_0x54ec87,_0x3ade44,_0x2db304,_0x171baf,_0x4443b4){var _0x53ad78,_0x1dc47b,_0x448914;_0x4443b4['host']=intUtil[_0x994c('0x75')](_0x4443b4[_0x994c('0x74')]);_0x4443b4[_0x994c('0x76')]=intUtil[_0x994c('0x75')](_0x4443b4['serverUrl']);if(_0x171baf&&_0x171baf[_0x994c('0x77')]){logger[_0x994c('0x27')]('['+_0x54ec87[_0x994c('0x8e')][_0x994c('0x8f')]()+']',_0x994c('0x79'));_0x54ec87['recordingURL']=_0x4443b4[_0x994c('0x76')]+_0x994c('0x7b')+_0x54ec87[_0x994c('0x7d')]+_0x994c('0x7c')+md5(_0x54ec87[_0x994c('0x7d')]);}else{_0x54ec87[_0x994c('0x7a')]='';}var _0x600dea=_0x4443b4[_0x994c('0x74')]===_0x994c('0x7e')?'eu':_0x994c('0x7f');return getAccessToken(_0x4443b4)['then'](function(_0x392b5a){_0x448914=_0x392b5a;return getUser(_0x448914,_0x600dea,_0x4443b4);})[_0x994c('0x2e')](function(_0x393146){_0x53ad78=_0x393146;logger[_0x994c('0x27')](_0x994c('0x80'),_0x53ad78['id']);return getEndUser(_0x448914,_0x600dea,_0x4443b4,_0x54ec87['calleridname'],_0x54ec87[_0x994c('0x82')],_0x53ad78,_0x3ade44);})[_0x994c('0x2e')](function(_0x435ee4){_0x1dc47b=_0x435ee4;return getCall(_0x448914,_0x600dea,_0x4443b4,_0x53ad78,_0x1dc47b,_0x3ade44,_0x54ec87,_0x994c('0x6f'));})[_0x994c('0x2e')](function(_0x48fbe8){if(_0x48fbe8){logger['info'](_0x994c('0x8c'),_0x48fbe8['id']);}})[_0x994c('0x23')](function(_0x3d35cf){logger['error']('['+_0x54ec87[_0x994c('0x8e')][_0x994c('0x8f')]()+']',JSON[_0x994c('0x37')](_0x3d35cf));});}; \ No newline at end of file +var _0x6df4=['isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','info','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','data','moduleCreate','Error:\x20','log','GET','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Owner','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','lastevent','called','Called','complete','Call_Result','Answered','Rejected','abandoned','Timeout','outbound','agentcalledAt','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','stack','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','destcalleridname','destcalleridnum','Outbound','unmanaged','lodash','md5','util','bluebird','redis','localhost','emit','debug','stringify','forEach','type','string','content','toString','variableName','idField','Variable','name','toLowerCase','split'];(function(_0x396130,_0x3678b6){var _0x458831=function(_0x58f9f9){while(--_0x58f9f9){_0x396130['push'](_0x396130['shift']());}};_0x458831(++_0x3678b6);}(_0x6df4,0x78));var _0x46df=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x6df4[_0x476b00];return _0x44ec8e;};'use strict';var _=require(_0x46df('0x0'));var rp=require('request-promise');var md5=require(_0x46df('0x1'));var util=require(_0x46df('0x2'));var intUtil=require('./util');var moment=require('moment');var Redis=require('ioredis');var BPromise=require(_0x46df('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0x46df('0x4')]=_['defaults'](config[_0x46df('0x4')],{'host':_0x46df('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46df('0x4')]));function emit(_0x5e14fb,_0x35ba3b,_0x3c3d61){io['to'](_0x5e14fb)[_0x46df('0x6')](_0x35ba3b,_0x3c3d61);}function request(_0x5b5052){logger[_0x46df('0x7')]('[HTTP]',JSON[_0x46df('0x8')](_0x5b5052));return rp(_0x5b5052);}function getCustomFields(_0x32b48d,_0x1d491e){var _0x893441={};if(_0x32b48d['length']>0x0){_[_0x46df('0x9')](_0x32b48d,function(_0x104ab3){if(_0x104ab3[_0x46df('0xa')]===_0x46df('0xb')&&_0x104ab3['idField']){_0x893441[_0x104ab3['idField']]=_0x104ab3[_0x46df('0xc')][_0x46df('0xd')]();}else if(_0x104ab3['type']==='variable'&&_0x104ab3['variableName']&&_0x104ab3['idField']&&_0x1d491e[_0x104ab3[_0x46df('0xe')]]){_0x893441[_0x104ab3[_0x46df('0xf')]]=_0x1d491e[_0x104ab3[_0x46df('0xe')]][_0x46df('0xd')]();}else if(_0x104ab3[_0x46df('0xa')]==='customVariable'&&_0x104ab3['Variable']&&_0x104ab3[_0x46df('0x10')]['name']&&_0x104ab3[_0x46df('0xf')]&&_0x1d491e[_0x104ab3[_0x46df('0x10')][_0x46df('0x11')][_0x46df('0x12')]()]){_0x893441[_0x104ab3['idField']]=_0x1d491e[_0x104ab3[_0x46df('0x10')]['name'][_0x46df('0x12')]()][_0x46df('0xd')]();}});}return _0x893441;}function getName(_0x30a437){if(_0x30a437['indexOf']('\x20')>0x0){var _0x40b82d=_0x30a437[_0x46df('0x13')](/ (.+)/);if(_0x40b82d[0x1]){return _0x40b82d;}}return[_0x30a437,_0x30a437];}var accountsTokens={};function getAccessToken(_0x51d6b6){return new Promise(function(_0x15956f,_0xc654f){if(!_[_0x46df('0x14')](accountsTokens[_0x51d6b6['id']])&&!_[_0x46df('0x14')](accountsTokens[_0x51d6b6['id']][_0x46df('0x15')])){if(moment()[_0x46df('0x16')](accountsTokens[_0x51d6b6['id']]['expires_in'])){_0x15956f(accountsTokens[_0x51d6b6['id']][_0x46df('0x15')]);}}var _0x320824;switch(_0x51d6b6['zone']){case'US':_0x320824=_0x46df('0x17');break;case'AU':_0x320824=_0x46df('0x18');break;case'EU':_0x320824='https://accounts.zoho.eu';break;case'IN':_0x320824='https://accounts.zoho.in';break;case'CN':_0x320824=_0x46df('0x19');break;default:_0x320824=_0x46df('0x1a');break;}var _0x9c27d7={'method':_0x46df('0x1b'),'uri':_0x320824+_0x46df('0x1c'),'qs':{'refresh_token':_0x51d6b6[_0x46df('0x1d')],'client_id':_0x51d6b6['clientId'],'client_secret':_0x51d6b6[_0x46df('0x1e')],'grant_type':_0x46df('0x1f')},'json':!![]};return rp(_0x9c27d7)[_0x46df('0x20')](function(_0x3e9240){accountsTokens[_0x51d6b6['id']]={'access_token':_0x3e9240['access_token'],'expires_in':moment()['add'](_0x3e9240[_0x46df('0x21')],_0x46df('0x22'))};_0x15956f(_0x3e9240['access_token']);})['catch'](function(_0x56f2a1){logger[_0x46df('0x23')](_0x46df('0x24'),_0x56f2a1['stack']);_0xc654f(_0x56f2a1);});});}function getUser(_0x2da249,_0x5185cf,_0x1af759,_0x52bed8){logger[_0x46df('0x25')]('Search\x20user');return request({'method':'GET','uri':util[_0x46df('0x26')]('https://www.zohoapis.%s/crm/v2/users',_0x5185cf),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x46df('0x27')+_0x2da249},'json':!![]})[_0x46df('0x20')](function(_0x131d15){if(_0x131d15[_0x46df('0x28')]){var _0x53a0ef=-0x1;if(_[_0x46df('0x29')](_0x131d15['users'])){if(!_[_0x46df('0x14')](_0x52bed8)){_0x53a0ef=_[_0x46df('0x2a')](_0x131d15['users'],function(_0x54ffff){return _0x54ffff[_0x46df('0x2b')]===_0x52bed8;});}if(_0x53a0ef>=0x0){logger['info'](_0x46df('0x2c'));}else{logger[_0x46df('0x25')](_0x46df('0x2d'));_0x53a0ef=_['findIndex'](_0x131d15[_0x46df('0x28')],function(_0x2a9a34){return _0x2a9a34['profile'][_0x46df('0x11')]===_0x46df('0x2e');});}return _0x131d15[_0x46df('0x28')][_0x53a0ef];}else{if(_0x131d15[_0x46df('0x2f')]['profile'][_0x46df('0x11')]===_0x46df('0x2e')){logger[_0x46df('0x25')]('Using\x20the\x20admin\x20account!');user=_0x131d15[_0x46df('0x2f')];return user;}else{logger[_0x46df('0x23')](_0x46df('0x30'),JSON[_0x46df('0x8')](_0x131d15));throw new Error(_0x46df('0x31')+JSON['stringify'](_0x131d15));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x131d15));throw new Error(_0x46df('0x31')+JSON[_0x46df('0x8')](_0x131d15));}})[_0x46df('0x32')](function(_0x4fa10b){console[_0x46df('0x23')](_0x4fa10b);});}function getZohoUser(_0x197d20,_0x4cee23){return new BPromise(function(_0x2f29a6,_0x11d9b4){request(_0x197d20)['then'](function(_0x312c99){var _0x30caec=null;if(_0x312c99){_0x30caec=_0x312c99['data'][0x0];_0x30caec[_0x46df('0x33')]=_0x4cee23;}_0x2f29a6(_0x30caec);})[_0x46df('0x32')](function(_0x37f586){_0x11d9b4(_0x37f586);});});}function createEndUser(_0xe91ee5,_0x21f336,_0x7211a5,_0x369416,_0x5153c5,_0x1e80d8){var _0x7211a5=getName(_0x7211a5);return request({'method':_0x46df('0x1b'),'uri':_0x46df('0x34')+_0x21f336+_0x46df('0x35')+_[_0x46df('0x36')](_0x1e80d8['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x7211a5[0x1],'First_Name':_0x7211a5[0x0],'Phone':_0x369416,'Owner':{'name':!_[_0x46df('0x14')](_0x5153c5[_0x46df('0x37')]['name'])?_0x5153c5[_0x46df('0x37')]['name']:!_[_0x46df('0x14')](_0x5153c5['first_name'])?_0x5153c5[_0x46df('0x38')]+'\x20'+_0x5153c5[_0x46df('0x39')]:_0x5153c5[_0x46df('0x39')],'id':_0x5153c5['id']}}]},'headers':{'Authorization':_0x46df('0x27')+_0xe91ee5},'json':!![]})[_0x46df('0x20')](function(_0x3cc15a){if(_0x3cc15a&&_0x3cc15a[_0x46df('0x3a')][0x0]['code']==='SUCCESS'){var _0x51f3ea=_0x3cc15a[_0x46df('0x3a')][0x0]['details'];_0x51f3ea[_0x46df('0x33')]=_[_0x46df('0x36')](_0x1e80d8[_0x46df('0x3b')])+'s';return _0x51f3ea;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x46df('0x8')](data));throw new Error(_0x46df('0x3c')+JSON[_0x46df('0x8')](data));})[_0x46df('0x32')](function(_0x54cb1e){console[_0x46df('0x3d')]('CREATE\x20ERROR',_0x54cb1e);});}function getEndUser(_0xf14acf,_0x1b43c1,_0x237103,_0x59d124,_0x2d0c43,_0x141ef6,_0x300528){var _0x10f0b9={'method':_0x46df('0x3e'),'uri':'','headers':{'Authorization':_0x46df('0x27')+_0xf14acf},'json':!![]};switch(_0x300528['moduleSearch']){case _0x46df('0x3f'):_0x10f0b9[_0x46df('0x40')]=_0x46df('0x34')+_0x1b43c1+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2d0c43+'))';return getZohoUser(_0x10f0b9,_0x46df('0x41'))[_0x46df('0x20')](function(_0x74a9c3){if(_0x74a9c3)return _0x74a9c3;_0x10f0b9['uri']=_0x46df('0x34')+_0x1b43c1+_0x46df('0x42')+_0x2d0c43+'))';return getZohoUser(_0x10f0b9,_0x46df('0x43'))[_0x46df('0x20')](function(_0x2327fd){if(_0x2327fd)return _0x2327fd;if(_0x300528[_0x46df('0x3b')]!='nothing'){return createEndUser(_0xf14acf,_0x1b43c1,_0x59d124,_0x2d0c43,_0x141ef6,_0x300528);}else{return{};}});});break;case'contact':_0x10f0b9[_0x46df('0x40')]=_0x46df('0x34')+_0x1b43c1+_0x46df('0x44')+_0x2d0c43+'))';return getZohoUser(_0x10f0b9,'Contacts')[_0x46df('0x20')](function(_0x726963){if(_0x726963)return _0x726963;if(_0x300528[_0x46df('0x3b')]!=_0x46df('0x45')){return createEndUser(_0xf14acf,_0x1b43c1,_0x59d124,_0x2d0c43,_0x141ef6,_0x300528);}else{return{};}});break;case _0x46df('0x46'):_0x10f0b9['uri']=_0x46df('0x34')+_0x1b43c1+_0x46df('0x42')+_0x2d0c43+'))';return getZohoUser(_0x10f0b9,'Leads')[_0x46df('0x20')](function(_0x3ffbc3){if(_0x3ffbc3)return _0x3ffbc3;if(_0x300528[_0x46df('0x3b')]!=_0x46df('0x45')){return createEndUser(_0xf14acf,_0x1b43c1,_0x59d124,_0x2d0c43,_0x141ef6,_0x300528);}else{return{};}});break;}}function getCall(_0x544d6a,_0x440a84,_0x28f17f,_0x40e9da,_0x1db9fe,_0x49a009,_0x2e8086,_0x55366f){logger[_0x46df('0x25')]('Creating\x20new\x20call...');var _0x4e422c={};_0x4e422c[_0x46df('0x47')]={'name':!_[_0x46df('0x14')](_0x40e9da[_0x46df('0x37')][_0x46df('0x11')])&&!_[_0x46df('0x14')](_0x40e9da[_0x46df('0x48')]['name'])&&_0x40e9da['profile'][_0x46df('0x11')]===_0x46df('0x49')?_0x40e9da['role'][_0x46df('0x11')]:!_[_0x46df('0x14')](_0x40e9da[_0x46df('0x38')])?_0x40e9da[_0x46df('0x38')]+'\x20'+_0x40e9da['last_name']:_0x40e9da['last_name'],'id':_0x40e9da['id']};_0x4e422c[_0x46df('0x4a')]=intUtil[_0x46df('0x4b')](_0x49a009[_0x46df('0x4c')],_0x2e8086,'\x20');_0x4e422c[_0x46df('0x4d')]=intUtil[_0x46df('0x4b')](_0x49a009[_0x46df('0x4e')],_0x2e8086,'\x0a');if(_0x1db9fe[_0x46df('0x33')]==='Contacts'){_0x4e422c[_0x46df('0x4f')]={'name':!_[_0x46df('0x14')](_0x1db9fe['Full_Name'])?_0x1db9fe[_0x46df('0x50')]:!_[_0x46df('0x14')](_0x1db9fe[_0x46df('0x51')])?_0x1db9fe['First_Name']+'\x20'+_0x1db9fe[_0x46df('0x52')]:_0x1db9fe[_0x46df('0x52')],'id':_0x1db9fe['id']};}if(_0x1db9fe['enduserType']===_0x46df('0x43')){_0x4e422c['What_Id']={'name':!_[_0x46df('0x14')](_0x1db9fe[_0x46df('0x50')])?_0x1db9fe['Full_Name']:!_[_0x46df('0x14')](_0x1db9fe[_0x46df('0x51')])?_0x1db9fe['First_Name']+'\x20'+_0x1db9fe['Last_Name']:_0x1db9fe[_0x46df('0x52')],'id':_0x1db9fe['id']};_0x4e422c[_0x46df('0x53')]=_['startCase'](_0x1db9fe[_0x46df('0x33')]);}if(_0x2e8086[_0x46df('0x54')]){_0x4e422c['Call_Duration']=moment[_0x46df('0x55')](parseInt(_0x2e8086[_0x46df('0x54')])*0x3e8)[_0x46df('0x26')]('mm:ss');}else if(_0x2e8086[_0x46df('0x56')]&&_0x2e8086[_0x46df('0x57')]){_0x4e422c['Call_Duration']=moment[_0x46df('0x55')](moment(_0x2e8086['endtime'],_0x46df('0x58'))[_0x46df('0x59')](moment(_0x2e8086[_0x46df('0x5a')],_0x46df('0x58'))))[_0x46df('0x26')](_0x46df('0x5b'));}switch(_0x2e8086[_0x46df('0x5c')]){case _0x46df('0x5d'):_0x4e422c['Call_Result']=_0x46df('0x5e');break;case _0x46df('0x5f'):case'connect':_0x4e422c[_0x46df('0x60')]=_0x46df('0x61');break;case'rejected':_0x4e422c[_0x46df('0x60')]=_0x46df('0x62');break;case _0x46df('0x63'):_0x4e422c['Call_Result']='Abandoned';break;case'timeout':_0x4e422c[_0x46df('0x60')]=_0x46df('0x64');default:}_0x4e422c['Call_Start_Time']=(_0x55366f===_0x46df('0x65')?moment(_0x2e8086['starttime'])[_0x46df('0x26')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x2e8086[_0x46df('0x66')])[_0x46df('0x26')](_0x46df('0x58')))||moment()[_0x46df('0x26')]('YYYY-MM-DDTHH:mm:ss');_0x4e422c['Call_Type']=_0x55366f||_0x46df('0x67');_0x4e422c=_[_0x46df('0x68')](_0x4e422c,getCustomFields(_0x49a009[_0x46df('0x69')],_0x2e8086));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x440a84+_0x46df('0x6a'),'headers':{'Authorization':_0x46df('0x27')+_0x544d6a},'body':{'data':[_0x4e422c]},'json':!![]})[_0x46df('0x20')](function(_0x25c727){if(_0x25c727&&_0x25c727['data'][0x0]['code']===_0x46df('0x6b')){logger[_0x46df('0x25')](_0x46df('0x6c'));return{'id':_0x25c727[_0x46df('0x3a')][0x0][_0x46df('0x6d')]['id']};}})['catch'](function(_0x4bde42){logger[_0x46df('0x25')](_0x46df('0x6e'),_0x4bde42[_0x46df('0x6f')]);console['log'](_0x46df('0x6e'),_0x4bde42);});}exports[_0x46df('0x70')]=function(_0x4712d3,_0x906377,_0x194545,_0x2a76a8,_0x2de686,_0x26b380){var _0xc9c11b,_0x58cf64,_0x59e62b;_0x26b380['host']=intUtil[_0x46df('0x71')](_0x26b380[_0x46df('0x72')]);_0x26b380[_0x46df('0x73')]=intUtil[_0x46df('0x71')](_0x26b380[_0x46df('0x73')]);if(_0x2de686&&_0x2de686[_0x46df('0x74')]){logger[_0x46df('0x25')](_0x46df('0x75'),_0x46df('0x76'));_0x906377[_0x46df('0x77')]=_0x26b380['serverUrl']+'/api/voice/recordings/'+_0x906377[_0x46df('0x78')]+_0x46df('0x79')+md5(_0x906377['uniqueid']);}else{_0x906377[_0x46df('0x77')]='';}var _0x39187e=_0x26b380['host']==='zoho.eu'?'eu':_0x46df('0x7a');return getAccessToken(_0x26b380)[_0x46df('0x20')](function(_0x234c78){_0x59e62b=_0x234c78;return getUser(_0x59e62b,_0x39187e,_0x26b380,_0x2a76a8[_0x46df('0x2b')]);})[_0x46df('0x20')](function(_0x2623af){_0xc9c11b=_0x2623af;logger['info'](_0x46df('0x7b'),_0xc9c11b['id']);return getEndUser(_0x59e62b,_0x39187e,_0x26b380,_0x906377['calleridname'],_0x906377[_0x46df('0x7c')],_0xc9c11b,_0x194545);})[_0x46df('0x20')](function(_0x1eab14){_0x58cf64=_0x1eab14;return getCall(_0x59e62b,_0x39187e,_0x26b380,_0xc9c11b,_0x58cf64,_0x194545,_0x906377,'Inbound');})[_0x46df('0x20')](function(_0x4d2d71){if(_0x4d2d71){logger[_0x46df('0x25')](_0x46df('0x7d'),_0x4d2d71['id']);logger[_0x46df('0x25')](_0x46df('0x75'),_0x46df('0x7e'));emit(util[_0x46df('0x26')](_0x46df('0x7f'),_0x2a76a8[_0x46df('0x11')]),_0x46df('0x80'),{'uri':_0x46df('0x81')+_0x26b380['host']+_0x46df('0x82')+_0x4d2d71['id']});}})[_0x46df('0x32')](function(_0x2298f8){logger[_0x46df('0x23')]('[QUEUE]',JSON['stringify'](_0x2298f8));});};exports[_0x46df('0x65')]=function(_0x4dd11d,_0x482de0,_0x528f0e,_0x531d3f,_0x52c7cd,_0x3496c4,_0x16a97d){var _0x119160,_0x15ae7f,_0x5ec37a;_0x3496c4[_0x46df('0x72')]=intUtil[_0x46df('0x71')](_0x3496c4['host']);_0x3496c4[_0x46df('0x73')]=intUtil[_0x46df('0x71')](_0x3496c4['serverUrl']);if(_0x16a97d&&_0x16a97d[_0x46df('0x83')]&&_0x16a97d[_0x46df('0x83')]!==_0x46df('0x84')){logger[_0x46df('0x25')](_0x46df('0x85'),_0x46df('0x76'));_0x482de0[_0x46df('0x77')]=_0x3496c4[_0x46df('0x73')]+_0x46df('0x86')+_0x482de0[_0x46df('0x78')]+'/downloads?type=uniqueid&token='+md5(_0x482de0[_0x46df('0x78')]);}var _0x40ffb9=_0x3496c4[_0x46df('0x72')]===_0x46df('0x87')?'eu':'com';return getAccessToken(_0x3496c4)[_0x46df('0x20')](function(_0x17a8fa){_0x5ec37a=_0x17a8fa;return getUser(_0x5ec37a,_0x40ffb9,_0x3496c4,_0x531d3f[_0x46df('0x2b')]);})[_0x46df('0x20')](function(_0x1911ec){_0x119160=_0x1911ec;logger[_0x46df('0x25')]('The\x20User\x20ID\x20is:',_0x119160['id']);return getEndUser(_0x5ec37a,_0x40ffb9,_0x3496c4,_0x482de0[_0x46df('0x88')],_0x482de0[_0x46df('0x89')],_0x119160,_0x528f0e);})[_0x46df('0x20')](function(_0x270874){_0x15ae7f=_0x270874;return getCall(_0x5ec37a,_0x40ffb9,_0x3496c4,_0x119160,_0x15ae7f,_0x528f0e,_0x482de0,_0x46df('0x8a'));})['then'](function(_0xc2f4f6){if(_0xc2f4f6){logger['info'](_0x46df('0x7d'),_0xc2f4f6['id']);logger[_0x46df('0x25')]('[OUTBOUND]',_0x46df('0x7e'));emit(util['format'](_0x46df('0x7f'),_0x531d3f[_0x46df('0x11')]),_0x46df('0x80'),{'uri':_0x46df('0x81')+_0x3496c4[_0x46df('0x72')]+_0x46df('0x82')+_0xc2f4f6['id']});}})[_0x46df('0x32')](function(_0x544c6c){logger['error']('[OUTBOUND]',JSON[_0x46df('0x8')](_0x544c6c));});};exports[_0x46df('0x8b')]=function(_0x263a12,_0x389505,_0x119933,_0x288b1b,_0x35efbe,_0x4a00f3){var _0xdece33,_0x8957eb,_0x13d745;_0x4a00f3[_0x46df('0x72')]=intUtil[_0x46df('0x71')](_0x4a00f3[_0x46df('0x72')]);_0x4a00f3[_0x46df('0x73')]=intUtil['stripTrailingSlash'](_0x4a00f3['serverUrl']);if(_0x35efbe&&_0x35efbe[_0x46df('0x74')]){logger[_0x46df('0x25')]('['+_0x389505[_0x46df('0x5c')]['toUpperCase']()+']',_0x46df('0x76'));_0x389505['recordingURL']=_0x4a00f3[_0x46df('0x73')]+_0x46df('0x86')+_0x389505[_0x46df('0x78')]+_0x46df('0x79')+md5(_0x389505[_0x46df('0x78')]);}else{_0x389505['recordingURL']='';}var _0x8400bd=_0x4a00f3[_0x46df('0x72')]==='zoho.eu'?'eu':_0x46df('0x7a');return getAccessToken(_0x4a00f3)[_0x46df('0x20')](function(_0x20e29e){_0x13d745=_0x20e29e;return getUser(_0x13d745,_0x8400bd,_0x4a00f3);})[_0x46df('0x20')](function(_0x4653a8){_0xdece33=_0x4653a8;logger['info']('The\x20User\x20ID\x20is:',_0xdece33['id']);return getEndUser(_0x13d745,_0x8400bd,_0x4a00f3,_0x389505['calleridname'],_0x389505[_0x46df('0x7c')],_0xdece33,_0x119933);})[_0x46df('0x20')](function(_0xf1f938){_0x8957eb=_0xf1f938;return getCall(_0x13d745,_0x8400bd,_0x4a00f3,_0xdece33,_0x8957eb,_0x119933,_0x389505,_0x46df('0x67'));})[_0x46df('0x20')](function(_0x47b78e){if(_0x47b78e){logger[_0x46df('0x25')](_0x46df('0x7d'),_0x47b78e['id']);}})[_0x46df('0x32')](function(_0x54eb2b){logger[_0x46df('0x23')]('['+_0x389505[_0x46df('0x5c')]['toUpperCase']()+']',JSON[_0x46df('0x8')](_0x54eb2b));});}; \ 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 f86db0b..94f46a8 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(_0x565b46,_0x438296){var _0x5898aa=function(_0x511052){while(--_0x511052){_0x565b46['push'](_0x565b46['shift']());}};_0x5898aa(++_0x438296);}(_0x7a54,0x106));var _0x47a5=function(_0x47e4ed,_0x4ed09e){_0x47e4ed=_0x47e4ed-0x0;var _0x2d8842=_0x7a54[_0x47e4ed];return _0x2d8842;};'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(_0x7a54fe,_0x350967){var _0x31ce14=function(_0xba7c9d){while(--_0xba7c9d){_0x7a54fe['push'](_0x7a54fe['shift']());}};_0x31ce14(++_0x350967);}(_0x7a54,0x106));var _0x47a5=function(_0x2bde10,_0x1c82e7){_0x2bde10=_0x2bde10-0x0;var _0x4312ac=_0x7a54[_0x2bde10];return _0x4312ac;};'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 5bcb559..812301d 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(_0x465409,_0x55ec94){var _0x29d20e=function(_0x2dfe74){while(--_0x2dfe74){_0x465409['push'](_0x465409['shift']());}};_0x29d20e(++_0x55ec94);}(_0x7a54,0x106));var _0x47a5=function(_0x4f3f3f,_0x2c9585){_0x4f3f3f=_0x4f3f3f-0x0;var _0x1646db=_0x7a54[_0x4f3f3f];return _0x1646db;};'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(_0x9b49d7,_0x1dc898){var _0x52c67b=function(_0x2152f3){while(--_0x2152f3){_0x9b49d7['push'](_0x9b49d7['shift']());}};_0x52c67b(++_0x1dc898);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1002b6,_0x3d48b6){_0x1002b6=_0x1002b6-0x0;var _0x53e752=_0x5f2f[_0x1002b6];return _0x53e752;};'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 3233e14..56948b4 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 _0x8b04=['error','rpc','message','result','exports','jayson/promise','bluebird','routing','http','Request','request','then','debug'];(function(_0x198a68,_0x1ab1cc){var _0x5f0d21=function(_0x2cf1d0){while(--_0x2cf1d0){_0x198a68['push'](_0x198a68['shift']());}};_0x5f0d21(++_0x1ab1cc);}(_0x8b04,0x130));var _0x48b0=function(_0x3061e8,_0x1fc126){_0x3061e8=_0x3061e8-0x0;var _0x3ef344=_0x8b04[_0x3061e8];return _0x3ef344;};'use strict';var jayson=require(_0x48b0('0x0'));var BPromise=require(_0x48b0('0x1'));var logger=require('../../config/logger')(_0x48b0('0x2'));var client=jayson['client'][_0x48b0('0x3')]({'port':0x2329});client[_0x48b0('0x4')]=function(_0xc0b19b,_0x468c90){return new BPromise(function(_0x423a40,_0x1f1bb2){return client[_0x48b0('0x5')](_0xc0b19b,_0x468c90)[_0x48b0('0x6')](function(_0x357849){logger[_0x48b0('0x7')]('rpc',_0x48b0('0x2'),_0xc0b19b,_0x468c90,_0x357849);if(_0x357849[_0x48b0('0x8')]){logger[_0x48b0('0x8')](_0x48b0('0x9'),_0x48b0('0x2'),_0xc0b19b,_0x357849[_0x48b0('0x8')][_0x48b0('0xa')],_0x468c90);return _0x1f1bb2(_0x357849['error'][_0x48b0('0xa')]);}else{return _0x423a40(_0x357849[_0x48b0('0xb')]);}})['catch'](function(_0x17da9c){logger[_0x48b0('0x8')]('rpc',_0x48b0('0x2'),_0xc0b19b,_0x17da9c,_0x468c90);return _0x1f1bb2(_0x17da9c);});});};module[_0x48b0('0xc')]=client; \ No newline at end of file +var _0x6b4e=['result','bluebird','Request','request','debug','rpc','routing','error','message'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x37db69,_0xb5a29b){_0x37db69=_0x37db69-0x0;var _0x30b43f=_0x6b4e[_0x37db69];return _0x30b43f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe6b4('0x0'));var logger=require('../../config/logger')('routing');var client=jayson['client']['http']({'port':0x2329});client[_0xe6b4('0x1')]=function(_0x3be9b1,_0x1aedc5){return new BPromise(function(_0x344db1,_0x436fc0){return client[_0xe6b4('0x2')](_0x3be9b1,_0x1aedc5)['then'](function(_0x29c81b){logger[_0xe6b4('0x3')](_0xe6b4('0x4'),_0xe6b4('0x5'),_0x3be9b1,_0x1aedc5,_0x29c81b);if(_0x29c81b[_0xe6b4('0x6')]){logger[_0xe6b4('0x6')](_0xe6b4('0x4'),_0xe6b4('0x5'),_0x3be9b1,_0x29c81b[_0xe6b4('0x6')][_0xe6b4('0x7')],_0x1aedc5);return _0x436fc0(_0x29c81b['error'][_0xe6b4('0x7')]);}else{return _0x344db1(_0x29c81b[_0xe6b4('0x8')]);}})['catch'](function(_0x5e8a99){logger['error'](_0xe6b4('0x4'),_0xe6b4('0x5'),_0x3be9b1,_0x5e8a99,_0x1aedc5);return _0x436fc0(_0x5e8a99);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index ce12912..91222ea 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 _0xfd8f=['./lib/email','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server'];(function(_0x556d6c,_0xdde346){var _0x2cf88c=function(_0x2b4ea6){while(--_0x2b4ea6){_0x556d6c['push'](_0x556d6c['shift']());}};_0x2cf88c(++_0xdde346);}(_0xfd8f,0xae));var _0xffd8=function(_0x1ff9b,_0x25e7f0){_0x1ff9b=_0x1ff9b-0x0;var _0x443f3d=_0xfd8f[_0x1ff9b];return _0x443f3d;};'use strict';var BPromise=require(_0xffd8('0x0'));var server=require(_0xffd8('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0xffd8('0x2'));var mailAccount=require(_0xffd8('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xffd8('0x4'))['db'];function initRealtime(){return BPromise[_0xffd8('0x5')]()['then'](mailAccount[_0xffd8('0x6')]())[_0xffd8('0x7')](realtime['initMailAccounts']())[_0xffd8('0x7')](function(){email[_0xffd8('0x8')](realtime[_0xffd8('0x9')]);return realtime;});}function main(){return server[_0xffd8('0xa')](realtime,email)[_0xffd8('0x7')](function(_0x254e4f){return initRealtime();})['then'](function(_0x1fb036){return db[_0xffd8('0xb')][_0xffd8('0xc')]({'attributes':['id',_0xffd8('0xd')],'raw':!![]});})['then'](function(_0x2dfb90){return setInterval(initRealtime,_0x2dfb90[_0xffd8('0xd')]*0x3e8);})[_0xffd8('0xe')](function(_0x681f3f){console[_0xffd8('0xf')](_0x681f3f);});}main(); \ No newline at end of file +var _0x8c79=['bluebird','./rpc/mailAccount','resolve','then','mailAccounts','findOne','loginMailFrequency','log'];(function(_0x5eeead,_0xff9318){var _0x2fea11=function(_0x4cfafc){while(--_0x4cfafc){_0x5eeead['push'](_0x5eeead['shift']());}};_0x2fea11(++_0xff9318);}(_0x8c79,0xa8));var _0x98c7=function(_0x2f194c,_0x1c005f){_0x2f194c=_0x2f194c-0x0;var _0x9039d2=_0x8c79[_0x2f194c];return _0x9039d2;};'use strict';var BPromise=require(_0x98c7('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x98c7('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0x98c7('0x2')]()[_0x98c7('0x3')](mailAccount['getMailAccounts']())[_0x98c7('0x3')](realtime['initMailAccounts']())['then'](function(){email['refresh'](realtime[_0x98c7('0x4')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x98c7('0x3')](function(_0x25dd4c){return initRealtime();})['then'](function(_0x538a81){return db['Setting'][_0x98c7('0x5')]({'attributes':['id',_0x98c7('0x6')],'raw':!![]});})[_0x98c7('0x3')](function(_0x592777){return setInterval(initRealtime,_0x592777[_0x98c7('0x6')]*0x3e8);})['catch'](function(_0x9e0c1a){console[_0x98c7('0x7')](_0x9e0c1a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 532c78a..ef44697 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 _0x921f=['total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','end','handleImapError','status','disabled','handleImapBox','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','Smtp','lastSync','verify','then','verified','exports','lodash','moment','bluebird','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus'];(function(_0x10b096,_0x42a48b){var _0x21933c=function(_0x1da228){while(--_0x1da228){_0x10b096['push'](_0x10b096['shift']());}};_0x21933c(++_0x42a48b);}(_0x921f,0x140));var _0xf921=function(_0x19ecc7,_0xe3a40e){_0x19ecc7=_0x19ecc7-0x0;var _0x3ab874=_0x921f[_0x19ecc7];return _0x3ab874;};'use strict';var _=require(_0xf921('0x0'));var moment=require(_0xf921('0x1'));var BPromise=require(_0xf921('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf921('0x3'))(_0xf921('0x4'));config[_0xf921('0x5')]=_[_0xf921('0x6')](config[_0xf921('0x5')],{'host':_0xf921('0x7'),'port':0x18eb});var io=require(_0xf921('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xf921('0x9'));var EmailSmtp=require(_0xf921('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x987f7d){logger['info'](_0xf921('0xb'));this[_0xf921('0xc')]=_0x987f7d[_0xf921('0xc')];this[_0xf921('0xd')]={};this[_0xf921('0xe')]=new EmailSmtp();}EmailChannel[_0xf921('0xf')][_0xf921('0x10')]=function(_0x50cd40){var _0x26c4a4=this[_0xf921('0xc')][_0x50cd40];var _0xaa587e={'id':_0x26c4a4['id'],'name':_0x26c4a4[_0xf921('0x11')],'key':_0x26c4a4[_0xf921('0x12')],'active':_0x26c4a4[_0xf921('0x13')],'Imap':{'status':_0x26c4a4[_0xf921('0x14')]['status'],'messageStatus':_0x26c4a4['Imap'][_0xf921('0x15')],'total':_0x26c4a4[_0xf921('0x14')][_0xf921('0x16')]}};if(_[_0xf921('0x17')](md5Accounts[_0x50cd40])){md5Accounts[_0x50cd40]={};}var _0x35d415=md5(JSON[_0xf921('0x18')](_0xaa587e));if(md5Accounts[_0x50cd40][_0xf921('0x19')]!==_0x35d415){md5Accounts[_0x50cd40][_0xf921('0x19')]=_0x35d415;io['emit'](_0xf921('0x1a'),_0xaa587e);}};EmailChannel[_0xf921('0xf')][_0xf921('0x1b')]=function(_0xe2958){for(var _0x5dc798 in _0xe2958){if(_0xe2958['hasOwnProperty'](_0x5dc798)){if(_0xe2958[_0x5dc798][_0xf921('0x14')]&&_0xe2958[_0x5dc798][_0xf921('0x13')]){var _0x4c0859=_0xe2958[_0x5dc798]['Imap'];if(!this[_0xf921('0xd')][_0xf921('0x1c')](_0x4c0859['id'])){this[_0xf921('0xd')][_0x4c0859['id']]=new EmailImap(_0x4c0859,_0xe2958[_0x5dc798][_0xf921('0x4')]);this[_0xf921('0xd')][_0x4c0859['id']]['on'](_0xf921('0x1d'),this['handleImapBox'][_0xf921('0x1e')](this,_0x5dc798));this[_0xf921('0xd')][_0x4c0859['id']]['on']('email',this[_0xf921('0x1f')][_0xf921('0x1e')](this,_0x5dc798));this[_0xf921('0xd')][_0x4c0859['id']]['on'](_0xf921('0x20'),this['handleImapEnd'][_0xf921('0x1e')](this,_0x5dc798));this[_0xf921('0xd')][_0x4c0859['id']]['on']('error',this[_0xf921('0x21')][_0xf921('0x1e')](this,_0x5dc798));}}else{if(_['isNil'](this[_0xf921('0xc')][_0x5dc798][_0xf921('0x14')])){this[_0xf921('0xc')][_0x5dc798]['Imap']={};}this['mailAccounts'][_0x5dc798][_0xf921('0x14')][_0xf921('0x22')]=_0xf921('0x23');this[_0xf921('0xc')][_0x5dc798][_0xf921('0x14')]['messageStatus']='';this[_0xf921('0x10')](_0x5dc798);}}}};EmailChannel[_0xf921('0xf')][_0xf921('0x24')]=function(_0x784113,_0x2cf132){if(this['mailAccounts'][_0x784113]){this[_0xf921('0xc')][_0x784113][_0xf921('0x14')]['status']=_0xf921('0x25');this[_0xf921('0xc')][_0x784113]['Imap'][_0xf921('0x15')]=_0x2cf132[_0xf921('0x11')];if(_0x2cf132[_0xf921('0x26')]){this['mailAccounts'][_0x784113][_0xf921('0x14')][_0xf921('0x16')]=_0x2cf132[_0xf921('0x26')][_0xf921('0x16')];}return this[_0xf921('0x10')](_0x784113);}};EmailChannel[_0xf921('0xf')][_0xf921('0x1f')]=function(_0xae03d0,_0x1aed8f){logger[_0xf921('0x27')](_0xf921('0x28'),_0x1aed8f[_0xf921('0x29')],_0x1aed8f[_0xf921('0x2a')],_0x1aed8f[_0xf921('0x2b')],_0xae03d0);if(this[_0xf921('0xc')][_0xae03d0]){return mailAccount['notify'](_0xae03d0,_0x1aed8f)['then'](function(_0x17ff96){if(_0x17ff96){logger[_0xf921('0x27')](_0xf921('0x2c'));}})[_0xf921('0x2d')](function(_0x1b94a1){logger[_0xf921('0x2e')](_0xf921('0x2f'),JSON['stringify'](_0x1b94a1));});}};EmailChannel[_0xf921('0xf')]['handleImapEnd']=function(_0x375b4b){if(this[_0xf921('0xc')][_0x375b4b]&&this[_0xf921('0xc')][_0x375b4b][_0xf921('0x14')]){if(this[_0xf921('0xd')][this[_0xf921('0xc')][_0x375b4b]['Imap']['id']]){delete this[_0xf921('0xd')][this[_0xf921('0xc')][_0x375b4b][_0xf921('0x14')]['id']];}this[_0xf921('0xc')][_0x375b4b]['Imap']['lastSync']=moment();this['emit'](_0x375b4b);}};EmailChannel[_0xf921('0xf')][_0xf921('0x21')]=function(_0x468002,_0x3bfe12){if(this[_0xf921('0xc')][_0x468002]){this[_0xf921('0xc')][_0x468002][_0xf921('0x14')][_0xf921('0x22')]=_0xf921('0x2e');this[_0xf921('0xc')][_0x468002][_0xf921('0x14')][_0xf921('0x15')]=_0x3bfe12;return this[_0xf921('0x10')](_0x468002);}};EmailChannel['prototype'][_0xf921('0x30')]=function(_0x5d41fc,_0x37cc93){return this[_0xf921('0xe')][_0xf921('0x31')](_0x5d41fc,_0x37cc93);};EmailChannel[_0xf921('0xf')][_0xf921('0x32')]=function(_0x3193f0){var _0x4d7b77=this;if(this[_0xf921('0xc')][_0x3193f0['id']]){if(_[_0xf921('0x17')](this['mailAccounts'][_0x3193f0['id']][_0xf921('0x33')])){this[_0xf921('0xc')][_0x3193f0['id']][_0xf921('0x33')]={};}this[_0xf921('0xc')][_0x3193f0['id']][_0xf921('0x33')][_0xf921('0x34')]=moment();return new BPromise(function(_0xb88c86,_0x2e54d0){return _0x4d7b77[_0xf921('0xe')][_0xf921('0x35')](_0x3193f0)[_0xf921('0x36')](function(_0x21c34a){_0x4d7b77[_0xf921('0xc')][_0x3193f0['id']][_0xf921('0x33')]['status']=_0xf921('0x37');_0x4d7b77[_0xf921('0xc')][_0x3193f0['id']]['Smtp'][_0xf921('0x15')]='';_0x4d7b77[_0xf921('0x10')](_0x3193f0['id']);_0xb88c86(_0x21c34a);})['catch'](function(_0x5e503d){_0x4d7b77[_0xf921('0xc')][_0x3193f0['id']]['Smtp']['status']=_0xf921('0x2e');_0x4d7b77[_0xf921('0xc')][_0x3193f0['id']][_0xf921('0x33')][_0xf921('0x15')]=_0x5e503d;_0x4d7b77['emit'](_0x3193f0['id']);_0x2e54d0(_0x5e503d);});});}return this[_0xf921('0xe')][_0xf921('0x35')](_0x3193f0);};module[_0xf921('0x38')]=EmailChannel; \ No newline at end of file +var _0xfe9f=['Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','email','box','handleImapBox','handleImapEmail','handleImapEnd','bind','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','error','send','verifySmtp','Smtp','verified','verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','defaults','redis','../rpc/mailAccount','info','start\x20email\x20channel','imapAccounts','smtp','prototype','emit','mailAccounts','name','key','active','status'];(function(_0x22ffc4,_0x3297d9){var _0x455220=function(_0x1fd6db){while(--_0x1fd6db){_0x22ffc4['push'](_0x22ffc4['shift']());}};_0x455220(++_0x3297d9);}(_0xfe9f,0x151));var _0xffe9=function(_0x2c1cd1,_0x7269b4){_0x2c1cd1=_0x2c1cd1-0x0;var _0x23b45c=_0xfe9f[_0x2c1cd1];return _0x23b45c;};'use strict';var _=require(_0xffe9('0x0'));var moment=require(_0xffe9('0x1'));var BPromise=require(_0xffe9('0x2'));var md5=require(_0xffe9('0x3'));var Redis=require(_0xffe9('0x4'));var config=require(_0xffe9('0x5'));var logger=require('../../../config/logger')('email');config['redis']=_[_0xffe9('0x6')](config[_0xffe9('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xffe9('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require(_0xffe9('0x8'));var md5Accounts={};function EmailChannel(_0x5d1092){logger[_0xffe9('0x9')](_0xffe9('0xa'));this['mailAccounts']=_0x5d1092['mailAccounts'];this[_0xffe9('0xb')]={};this[_0xffe9('0xc')]=new EmailSmtp();}EmailChannel[_0xffe9('0xd')][_0xffe9('0xe')]=function(_0x1e0007){var _0x3d366c=this[_0xffe9('0xf')][_0x1e0007];var _0x11d5e2={'id':_0x3d366c['id'],'name':_0x3d366c[_0xffe9('0x10')],'key':_0x3d366c[_0xffe9('0x11')],'active':_0x3d366c[_0xffe9('0x12')],'Imap':{'status':_0x3d366c['Imap'][_0xffe9('0x13')],'messageStatus':_0x3d366c[_0xffe9('0x14')][_0xffe9('0x15')],'total':_0x3d366c['Imap'][_0xffe9('0x16')]}};if(_[_0xffe9('0x17')](md5Accounts[_0x1e0007])){md5Accounts[_0x1e0007]={};}var _0x347402=md5(JSON[_0xffe9('0x18')](_0x11d5e2));if(md5Accounts[_0x1e0007][_0xffe9('0x3')]!==_0x347402){md5Accounts[_0x1e0007]['md5']=_0x347402;io['emit'](_0xffe9('0x19'),_0x11d5e2);}};EmailChannel[_0xffe9('0xd')][_0xffe9('0x1a')]=function(_0x158c6d){for(var _0x9ed22c in _0x158c6d){if(_0x158c6d[_0xffe9('0x1b')](_0x9ed22c)){if(_0x158c6d[_0x9ed22c]['Imap']&&_0x158c6d[_0x9ed22c][_0xffe9('0x12')]){var _0x88778f=_0x158c6d[_0x9ed22c][_0xffe9('0x14')];if(!this[_0xffe9('0xb')][_0xffe9('0x1b')](_0x88778f['id'])){this['imapAccounts'][_0x88778f['id']]=new EmailImap(_0x88778f,_0x158c6d[_0x9ed22c][_0xffe9('0x1c')]);this[_0xffe9('0xb')][_0x88778f['id']]['on'](_0xffe9('0x1d'),this[_0xffe9('0x1e')]['bind'](this,_0x9ed22c));this[_0xffe9('0xb')][_0x88778f['id']]['on'](_0xffe9('0x1c'),this[_0xffe9('0x1f')]['bind'](this,_0x9ed22c));this[_0xffe9('0xb')][_0x88778f['id']]['on']('end',this[_0xffe9('0x20')]['bind'](this,_0x9ed22c));this[_0xffe9('0xb')][_0x88778f['id']]['on']('error',this['handleImapError'][_0xffe9('0x21')](this,_0x9ed22c));}}else{if(_[_0xffe9('0x17')](this[_0xffe9('0xf')][_0x9ed22c]['Imap'])){this[_0xffe9('0xf')][_0x9ed22c][_0xffe9('0x14')]={};}this['mailAccounts'][_0x9ed22c][_0xffe9('0x14')]['status']=_0xffe9('0x22');this[_0xffe9('0xf')][_0x9ed22c][_0xffe9('0x14')]['messageStatus']='';this[_0xffe9('0xe')](_0x9ed22c);}}}};EmailChannel[_0xffe9('0xd')][_0xffe9('0x1e')]=function(_0x5a1b22,_0x26e681){if(this[_0xffe9('0xf')][_0x5a1b22]){this[_0xffe9('0xf')][_0x5a1b22][_0xffe9('0x14')][_0xffe9('0x13')]=_0xffe9('0x23');this[_0xffe9('0xf')][_0x5a1b22][_0xffe9('0x14')][_0xffe9('0x15')]=_0x26e681['name'];if(_0x26e681[_0xffe9('0x24')]){this['mailAccounts'][_0x5a1b22]['Imap'][_0xffe9('0x16')]=_0x26e681['messages'][_0xffe9('0x16')];}return this['emit'](_0x5a1b22);}};EmailChannel[_0xffe9('0xd')]['handleImapEmail']=function(_0x529e76,_0x22fe69){logger['info'](_0xffe9('0x25'),_0x22fe69['firstName'],_0x22fe69[_0xffe9('0x26')],_0x22fe69[_0xffe9('0x27')],_0x529e76);if(this[_0xffe9('0xf')][_0x529e76]){return mailAccount[_0xffe9('0x28')](_0x529e76,_0x22fe69)[_0xffe9('0x29')](function(_0x40df35){if(_0x40df35){logger['info']('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x26c587){logger['error'](_0xffe9('0x2a'),JSON['stringify'](_0x26c587));});}};EmailChannel[_0xffe9('0xd')][_0xffe9('0x20')]=function(_0x329f32){if(this[_0xffe9('0xf')][_0x329f32]&&this[_0xffe9('0xf')][_0x329f32][_0xffe9('0x14')]){if(this[_0xffe9('0xb')][this['mailAccounts'][_0x329f32][_0xffe9('0x14')]['id']]){delete this['imapAccounts'][this[_0xffe9('0xf')][_0x329f32][_0xffe9('0x14')]['id']];}this['mailAccounts'][_0x329f32][_0xffe9('0x14')][_0xffe9('0x2b')]=moment();this[_0xffe9('0xe')](_0x329f32);}};EmailChannel[_0xffe9('0xd')][_0xffe9('0x2c')]=function(_0x513222,_0x427a82){if(this['mailAccounts'][_0x513222]){this[_0xffe9('0xf')][_0x513222]['Imap'][_0xffe9('0x13')]=_0xffe9('0x2d');this[_0xffe9('0xf')][_0x513222][_0xffe9('0x14')][_0xffe9('0x15')]=_0x427a82;return this[_0xffe9('0xe')](_0x513222);}};EmailChannel[_0xffe9('0xd')]['sendMail']=function(_0x102f95,_0x174732){return this[_0xffe9('0xc')][_0xffe9('0x2e')](_0x102f95,_0x174732);};EmailChannel[_0xffe9('0xd')][_0xffe9('0x2f')]=function(_0x3f4563){var _0x46a17c=this;if(this[_0xffe9('0xf')][_0x3f4563['id']]){if(_['isNil'](this['mailAccounts'][_0x3f4563['id']][_0xffe9('0x30')])){this[_0xffe9('0xf')][_0x3f4563['id']][_0xffe9('0x30')]={};}this['mailAccounts'][_0x3f4563['id']][_0xffe9('0x30')][_0xffe9('0x2b')]=moment();return new BPromise(function(_0xbc675,_0x2bd8c6){return _0x46a17c['smtp']['verify'](_0x3f4563)[_0xffe9('0x29')](function(_0x562a60){_0x46a17c[_0xffe9('0xf')][_0x3f4563['id']][_0xffe9('0x30')]['status']=_0xffe9('0x31');_0x46a17c['mailAccounts'][_0x3f4563['id']][_0xffe9('0x30')]['messageStatus']='';_0x46a17c[_0xffe9('0xe')](_0x3f4563['id']);_0xbc675(_0x562a60);})['catch'](function(_0x49f4f0){_0x46a17c[_0xffe9('0xf')][_0x3f4563['id']][_0xffe9('0x30')][_0xffe9('0x13')]=_0xffe9('0x2d');_0x46a17c[_0xffe9('0xf')][_0x3f4563['id']][_0xffe9('0x30')][_0xffe9('0x15')]=_0x49f4f0;_0x46a17c[_0xffe9('0xe')](_0x3f4563['id']);_0x2bd8c6(_0x49f4f0);});});}return this[_0xffe9('0xc')][_0xffe9('0x32')](_0x3f4563);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 63c40b4..3fbf3d2 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 _0x1a61=['connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','service','handleOpenBox','handleError','box','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','closeBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','emit','email','handleFetchEnd','error','textCode','hasOwnProperty','upperFirst','exports','lodash','randomstring','mailparser','simpleParser','../../../config/logger','mailbox','INBOX','account','getAccount','imap','ready','handleReady','once','handleEnd','bind','connect','inherits','prototype'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1a61,0x11a));var _0x11a6=function(_0x140c71,_0x2d6aa9){_0x140c71=_0x140c71-0x0;var _0xf93e34=_0x1a61[_0x140c71];return _0xf93e34;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require('imap');var _=require(_0x11a6('0x0'));var rs=require(_0x11a6('0x1'));var simpleParser=require(_0x11a6('0x2'))[_0x11a6('0x3')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0x11a6('0x4'))('email');function EmailImap(_0x44fec5,_0x39f908){this[_0x11a6('0x5')]=_0x11a6('0x6');this[_0x11a6('0x7')]=this[_0x11a6('0x8')](_0x44fec5,_0x39f908);this[_0x11a6('0x9')]=new Imap(this[_0x11a6('0x7')]);this[_0x11a6('0x9')]['once'](_0x11a6('0xa'),this[_0x11a6('0xb')]['bind'](this));this[_0x11a6('0x9')][_0x11a6('0xc')]('end',this[_0x11a6('0xd')][_0x11a6('0xe')](this));this[_0x11a6('0x9')]['on']('error',this['handleError'][_0x11a6('0xe')](this));this[_0x11a6('0x9')][_0x11a6('0xf')]();}util[_0x11a6('0x10')](EmailImap,EventEmitter);EmailImap[_0x11a6('0x11')]['getAccount']=function(_0x49e2fa,_0x50755d){var _0x423ccd={'connTimeout':_0x49e2fa[_0x11a6('0x12')]?_0x49e2fa[_0x11a6('0x12')]*0x3e8:0x2710,'authTimeout':_0x49e2fa[_0x11a6('0x13')]?_0x49e2fa['authTimeout']*0x3e8:0x1388};if(_[_0x11a6('0x14')](_0x49e2fa['service'])){if(_0x49e2fa[_0x11a6('0x15')]){_0x423ccd['user']=_0x49e2fa[_0x11a6('0x16')];_0x423ccd[_0x11a6('0x17')]=_0x49e2fa[_0x11a6('0x17')];}_0x423ccd['host']=_0x49e2fa[_0x11a6('0x18')];_0x423ccd[_0x11a6('0x19')]=_0x49e2fa['port']||0x3e1;if(_0x49e2fa[_0x11a6('0x1a')]){_0x423ccd[_0x11a6('0x1a')]=!![];}else{_0x423ccd['tls']=![];_0x423ccd['autotls']=_0x11a6('0x1b');}}else{_0x423ccd[_0x11a6('0x16')]=_0x49e2fa[_0x11a6('0x16')];_0x423ccd[_0x11a6('0x17')]=_0x49e2fa['password'];_0x423ccd[_0x11a6('0x18')]=utils[_0x11a6('0x1c')](_0x49e2fa[_0x11a6('0x1d')]);_0x423ccd['port']=0x3e1;_0x423ccd['tls']=!![];}_0x423ccd['email']=_0x50755d||_0x49e2fa[_0x11a6('0x16')]||'anonymous@xcally.com';return _0x423ccd;};EmailImap[_0x11a6('0x11')][_0x11a6('0xb')]=function(){this[_0x11a6('0x9')]['openBox'](this[_0x11a6('0x5')],![],this[_0x11a6('0x1e')]['bind'](this));};EmailImap[_0x11a6('0x11')][_0x11a6('0x1e')]=function(_0x547964,_0x2426c2){if(_0x547964){this[_0x11a6('0x1f')](_0x547964,!![]);}else{this['emit'](_0x11a6('0x20'),_0x2426c2);this['readUnseen']();}};EmailImap['prototype'][_0x11a6('0x21')]=function(_0x59f088){if(_0x59f088){this[_0x11a6('0x1f')](_0x59f088,!![]);}else{this['imap'][_0x11a6('0x22')]();}};EmailImap[_0x11a6('0x11')][_0x11a6('0x23')]=function(){this['imap'][_0x11a6('0x24')]([_0x11a6('0x25')],this[_0x11a6('0x26')][_0x11a6('0xe')](this));};EmailImap[_0x11a6('0x11')][_0x11a6('0x26')]=function(_0x1aa196,_0x469e18){if(_0x1aa196){this['handleError'](_0x1aa196,!![]);}else{if(_0x469e18[_0x11a6('0x27')]){try{var _0x28bcce=this[_0x11a6('0x9')][_0x11a6('0x28')](_0x469e18,{'bodies':'','markSeen':!![]});_0x28bcce['on'](_0x11a6('0x29'),this[_0x11a6('0x2a')][_0x11a6('0xe')](this));_0x28bcce[_0x11a6('0xc')]('error',this[_0x11a6('0x2b')][_0x11a6('0xe')](this));_0x28bcce['once'](_0x11a6('0x22'),this['handleFetchEnd'][_0x11a6('0xe')](this));}catch(_0x540fdd){logger['error'](_0x540fdd);}}else{this[_0x11a6('0x9')][_0x11a6('0x2c')](!![],this[_0x11a6('0x21')]['bind'](this));}}};EmailImap[_0x11a6('0x11')][_0x11a6('0x2a')]=function(_0x189e7d,_0x51f652){_0x189e7d['on'](_0x11a6('0x2d'),this['handleMessageBody']['bind'](this));_0x189e7d[_0x11a6('0xc')](_0x11a6('0x2e'),this[_0x11a6('0x2f')][_0x11a6('0xe')](this));_0x189e7d[_0x11a6('0xc')](_0x11a6('0x22'),this['handleMessageEnd'][_0x11a6('0xe')](this));};EmailImap[_0x11a6('0x11')][_0x11a6('0x30')]=function(_0x3171d2,_0x2a246d){simpleParser(_0x3171d2,{'Iconv':Iconv},this[_0x11a6('0x31')][_0x11a6('0xe')](this));};EmailImap['prototype'][_0x11a6('0x2f')]=function(_0x8f9258){};EmailImap[_0x11a6('0x11')][_0x11a6('0x32')]=function(){};EmailImap[_0x11a6('0x11')][_0x11a6('0x31')]=function(_0x244ce3,_0x928bf0){if(_0x244ce3){logger['error'](_0x244ce3);}else{var _0xcb561=this;utils[_0x11a6('0x33')](this[_0x11a6('0x7')],_0x928bf0,function(_0x29068f){_0xcb561[_0x11a6('0x34')](_0x11a6('0x35'),_0x29068f);});}};EmailImap['prototype'][_0x11a6('0x36')]=function(){this[_0x11a6('0x9')][_0x11a6('0x2c')](!![],this[_0x11a6('0x21')][_0x11a6('0xe')](this));};EmailImap['prototype']['handleFetchError']=function(_0x3fdfd7){this['handleError'](_0x3fdfd7);this[_0x11a6('0x9')][_0x11a6('0x2c')](!![],this[_0x11a6('0x21')][_0x11a6('0xe')](this));};EmailImap[_0x11a6('0x11')][_0x11a6('0xd')]=function(){this['emit'](_0x11a6('0x22'));};EmailImap[_0x11a6('0x11')][_0x11a6('0x1f')]=function(_0x1d1089,_0x1421ca){logger[_0x11a6('0x37')]('handleError',this[_0x11a6('0x7')][_0x11a6('0x35')],JSON['stringify'](_0x1d1089));var _0x11cac2='';if(_0x1d1089){if(_0x1d1089[_0x11a6('0x38')]){_0x11cac2=_0x1d1089[_0x11a6('0x38')];}else{for(var _0x56e7e5 in _0x1d1089){if(_0x1d1089[_0x11a6('0x39')](_0x56e7e5)){_0x11cac2+=_[_0x11a6('0x3a')](_0x56e7e5)+':\x20'+_0x1d1089[_0x56e7e5]+'\x0a';}}}}if(_0x1421ca){this['imap'][_0x11a6('0x22')]();}else{this[_0x11a6('0x34')]('error',_0x11cac2);this[_0x11a6('0x34')](_0x11a6('0x22'));}};module[_0x11a6('0x3b')]=EmailImap; \ No newline at end of file +var _0x089c=['password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','parser','textCode','upperFirst','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','events','./utils','email','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','connect','prototype','connTimeout','authTimeout','isNil','service','authentication','user'];(function(_0x2d6150,_0x52d373){var _0x213b61=function(_0x579fd7){while(--_0x579fd7){_0x2d6150['push'](_0x2d6150['shift']());}};_0x213b61(++_0x52d373);}(_0x089c,0x1d3));var _0xc089=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x089c[_0x2b9b7f];return _0x4ed19a;};'use strict';var fs=require('fs');var path=require(_0xc089('0x0'));var util=require(_0xc089('0x1'));var Imap=require(_0xc089('0x2'));var _=require(_0xc089('0x3'));var rs=require(_0xc089('0x4'));var simpleParser=require('mailparser')[_0xc089('0x5')];var Iconv=require(_0xc089('0x6'))[_0xc089('0x7')];var EventEmitter=require(_0xc089('0x8'))['EventEmitter'];var utils=require(_0xc089('0x9'));var logger=require('../../../config/logger')(_0xc089('0xa'));function EmailImap(_0x56766e,_0x5d4105){this[_0xc089('0xb')]='INBOX';this[_0xc089('0xc')]=this[_0xc089('0xd')](_0x56766e,_0x5d4105);this[_0xc089('0x2')]=new Imap(this[_0xc089('0xc')]);this[_0xc089('0x2')]['once'](_0xc089('0xe'),this[_0xc089('0xf')][_0xc089('0x10')](this));this[_0xc089('0x2')][_0xc089('0x11')](_0xc089('0x12'),this[_0xc089('0x13')]['bind'](this));this[_0xc089('0x2')]['on']('error',this[_0xc089('0x14')][_0xc089('0x10')](this));this['imap'][_0xc089('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc089('0x16')][_0xc089('0xd')]=function(_0x13d988,_0x381365){var _0x2543e6={'connTimeout':_0x13d988['connTimeout']?_0x13d988[_0xc089('0x17')]*0x3e8:0x2710,'authTimeout':_0x13d988[_0xc089('0x18')]?_0x13d988['authTimeout']*0x3e8:0x1388};if(_[_0xc089('0x19')](_0x13d988[_0xc089('0x1a')])){if(_0x13d988[_0xc089('0x1b')]){_0x2543e6[_0xc089('0x1c')]=_0x13d988[_0xc089('0x1c')];_0x2543e6[_0xc089('0x1d')]=_0x13d988[_0xc089('0x1d')];}_0x2543e6[_0xc089('0x1e')]=_0x13d988['host'];_0x2543e6[_0xc089('0x1f')]=_0x13d988[_0xc089('0x1f')]||0x3e1;if(_0x13d988[_0xc089('0x20')]){_0x2543e6[_0xc089('0x20')]=!![];}else{_0x2543e6[_0xc089('0x20')]=![];_0x2543e6[_0xc089('0x21')]=_0xc089('0x22');}}else{_0x2543e6[_0xc089('0x1c')]=_0x13d988[_0xc089('0x1c')];_0x2543e6[_0xc089('0x1d')]=_0x13d988[_0xc089('0x1d')];_0x2543e6['host']=utils[_0xc089('0x23')](_0x13d988[_0xc089('0x1a')]);_0x2543e6['port']=0x3e1;_0x2543e6[_0xc089('0x20')]=!![];}_0x2543e6[_0xc089('0xa')]=_0x381365||_0x13d988['user']||_0xc089('0x24');return _0x2543e6;};EmailImap[_0xc089('0x16')][_0xc089('0xf')]=function(){this[_0xc089('0x2')][_0xc089('0x25')](this[_0xc089('0xb')],![],this[_0xc089('0x26')]['bind'](this));};EmailImap[_0xc089('0x16')][_0xc089('0x26')]=function(_0x4a9680,_0xaf9442){if(_0x4a9680){this[_0xc089('0x14')](_0x4a9680,!![]);}else{this[_0xc089('0x27')](_0xc089('0x28'),_0xaf9442);this[_0xc089('0x29')]();}};EmailImap[_0xc089('0x16')][_0xc089('0x2a')]=function(_0x46c77a){if(_0x46c77a){this[_0xc089('0x14')](_0x46c77a,!![]);}else{this[_0xc089('0x2')]['end']();}};EmailImap['prototype']['readUnseen']=function(){this[_0xc089('0x2')][_0xc089('0x2b')]([_0xc089('0x2c')],this[_0xc089('0x2d')]['bind'](this));};EmailImap[_0xc089('0x16')][_0xc089('0x2d')]=function(_0x535a99,_0x2a7d47){if(_0x535a99){this['handleError'](_0x535a99,!![]);}else{if(_0x2a7d47[_0xc089('0x2e')]){try{var _0x16bc83=this[_0xc089('0x2')][_0xc089('0x2f')](_0x2a7d47,{'bodies':'','markSeen':!![]});_0x16bc83['on'](_0xc089('0x30'),this[_0xc089('0x31')][_0xc089('0x10')](this));_0x16bc83[_0xc089('0x11')](_0xc089('0x32'),this[_0xc089('0x33')]['bind'](this));_0x16bc83[_0xc089('0x11')](_0xc089('0x12'),this[_0xc089('0x34')][_0xc089('0x10')](this));}catch(_0x1d3a61){logger['error'](_0x1d3a61);}}else{this['imap'][_0xc089('0x35')](!![],this['handleCloseBox']['bind'](this));}}};EmailImap[_0xc089('0x16')][_0xc089('0x31')]=function(_0x2f0fc3,_0x364567){_0x2f0fc3['on'](_0xc089('0x36'),this[_0xc089('0x37')][_0xc089('0x10')](this));_0x2f0fc3[_0xc089('0x11')](_0xc089('0x38'),this[_0xc089('0x39')][_0xc089('0x10')](this));_0x2f0fc3['once'](_0xc089('0x12'),this[_0xc089('0x3a')]['bind'](this));};EmailImap[_0xc089('0x16')][_0xc089('0x37')]=function(_0x5b05b0,_0x5c5931){simpleParser(_0x5b05b0,{'Iconv':Iconv},this['handleSimpleParser'][_0xc089('0x10')](this));};EmailImap['prototype'][_0xc089('0x39')]=function(_0x34fdeb){};EmailImap[_0xc089('0x16')]['handleMessageEnd']=function(){};EmailImap[_0xc089('0x16')]['handleSimpleParser']=function(_0xb82f6d,_0x1c6ba){if(_0xb82f6d){logger[_0xc089('0x32')](_0xb82f6d);}else{var _0x3d9c2e=this;utils[_0xc089('0x3b')](this[_0xc089('0xc')],_0x1c6ba,function(_0x136b4c){_0x3d9c2e[_0xc089('0x27')](_0xc089('0xa'),_0x136b4c);});}};EmailImap[_0xc089('0x16')]['handleFetchEnd']=function(){this['imap'][_0xc089('0x35')](!![],this[_0xc089('0x2a')][_0xc089('0x10')](this));};EmailImap[_0xc089('0x16')]['handleFetchError']=function(_0x9b60f7){this[_0xc089('0x14')](_0x9b60f7);this[_0xc089('0x2')][_0xc089('0x35')](!![],this['handleCloseBox'][_0xc089('0x10')](this));};EmailImap['prototype'][_0xc089('0x13')]=function(){this['emit']('end');};EmailImap['prototype']['handleError']=function(_0x4adbbf,_0x59edb5){logger['error'](_0xc089('0x14'),this[_0xc089('0xc')][_0xc089('0xa')],JSON['stringify'](_0x4adbbf));var _0x2a6d7f='';if(_0x4adbbf){if(_0x4adbbf[_0xc089('0x3c')]){_0x2a6d7f=_0x4adbbf[_0xc089('0x3c')];}else{for(var _0xe8b267 in _0x4adbbf){if(_0x4adbbf['hasOwnProperty'](_0xe8b267)){_0x2a6d7f+=_[_0xc089('0x3d')](_0xe8b267)+':\x20'+_0x4adbbf[_0xe8b267]+'\x0a';}}}}if(_0x59edb5){this[_0xc089('0x2')][_0xc089('0x12')]();}else{this[_0xc089('0x27')](_0xc089('0x32'),_0x2a6d7f);this['emit'](_0xc089('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8789384..39bbbf6 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 _0xd542=['toString','verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail'];(function(_0x3f286b,_0x510a01){var _0x2ff82f=function(_0x4ceb2f){while(--_0x4ceb2f){_0x3f286b['push'](_0x3f286b['shift']());}};_0x2ff82f(++_0x510a01);}(_0xd542,0x106));var _0x2d54=function(_0x221902,_0x40758e){_0x221902=_0x221902-0x0;var _0x30f252=_0xd542[_0x221902];return _0x30f252;};'use strict';var nodemailer=require(_0x2d54('0x0'));var BPromise=require(_0x2d54('0x1'));var inlineBase64=require(_0x2d54('0x2'));function EmailSmtp(){}EmailSmtp[_0x2d54('0x3')][_0x2d54('0x4')]=function(_0x383b51,_0x4c7968){return new BPromise(function(_0x4e74b1,_0x526e48){var _0x382bbb=nodemailer['createTransport'](_0x383b51);_0x382bbb[_0x2d54('0x5')](_0x2d54('0x6'),inlineBase64());_0x382bbb[_0x2d54('0x7')](_0x4c7968,function(_0x161938,_0x5edd55){if(_0x161938){_0x526e48(_0x161938[_0x2d54('0x8')]());}else{_0x4e74b1(_0x5edd55);}});});};EmailSmtp[_0x2d54('0x3')][_0x2d54('0x9')]=function(_0x32a6e2){return new BPromise(function(_0x39ad20,_0x17ab51){var _0x4e8f77=nodemailer['createTransport'](_0x32a6e2);_0x4e8f77[_0x2d54('0x9')](function(_0x597e17,_0xd94331){if(_0x597e17){_0x17ab51(_0x597e17[_0x2d54('0x8')]());}else{if(_0xd94331){_0x39ad20(_0xd94331);}else{_0x17ab51('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xacb8=['verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','sendMail','toString'];(function(_0x40fcdf,_0x3ec4f0){var _0x4a0aee=function(_0x4a0bef){while(--_0x4a0bef){_0x40fcdf['push'](_0x40fcdf['shift']());}};_0x4a0aee(++_0x3ec4f0);}(_0xacb8,0xd1));var _0x8acb=function(_0x5fd04,_0x5d6fff){_0x5fd04=_0x5fd04-0x0;var _0x48c27b=_0xacb8[_0x5fd04];return _0x48c27b;};'use strict';var nodemailer=require(_0x8acb('0x0'));var BPromise=require(_0x8acb('0x1'));var inlineBase64=require(_0x8acb('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x8acb('0x3')]=function(_0x14caee,_0x4b7cc9){return new BPromise(function(_0x5c821d,_0x3c3234){var _0x268c5e=nodemailer[_0x8acb('0x4')](_0x14caee);_0x268c5e['use']('compile',inlineBase64());_0x268c5e[_0x8acb('0x5')](_0x4b7cc9,function(_0xdcc79d,_0x1c0005){if(_0xdcc79d){_0x3c3234(_0xdcc79d[_0x8acb('0x6')]());}else{_0x5c821d(_0x1c0005);}});});};EmailSmtp['prototype'][_0x8acb('0x7')]=function(_0x3e7cac){return new BPromise(function(_0x97e8ec,_0xdb826c){var _0x28c4e7=nodemailer[_0x8acb('0x4')](_0x3e7cac);_0x28c4e7[_0x8acb('0x7')](function(_0x546e99,_0x5d642c){if(_0x546e99){_0xdb826c(_0x546e99['toString']());}else{if(_0x5d642c){_0x97e8ec(_0x5d642c);}else{_0xdb826c('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d04cf42..07445ec 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 _0xbda7=['%s-%s','now','root','writeFileSync','content','contentType','from','subject','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','push','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','randomstring','path','util','../../../config/logger','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','body','textAsHtml','0x1?_0x3801eb[_0x7bda('0x11')]():'';}return'';}function getMails(_0x221094,_0x2551f2){var _0x57c93e='';for(var _0x284d74=0x0;_0x284d74<_0x2551f2[_0x7bda('0x5')][_0x7bda('0xd')];_0x284d74+=0x1){if(_0x2551f2[_0x7bda('0x5')][_0x284d74]['address']!==_0x221094){if(!_[_0x7bda('0x12')](_0x57c93e)){_0x57c93e+=',';}_0x57c93e+=_0x2551f2[_0x7bda('0x5')][_0x284d74][_0x7bda('0xb')]||_0x2551f2[_0x7bda('0x5')][_0x284d74][_0x7bda('0x6')]||'';_0x57c93e+='\x20<';_0x57c93e+=_0x2551f2[_0x7bda('0x5')][_0x284d74][_0x7bda('0x6')]?_0x2551f2['value'][_0x284d74][_0x7bda('0x6')]:'anonymous'+random['generate'](0x6)+_0x7bda('0x9');_0x57c93e+='>';}}return _0x57c93e;}function parseEmail(_0x328e64,_0x415921,_0x5d97e7){if(_0x415921[_0x7bda('0x13')]){var _0x2e2e3f=/)<[^<]*)*<\/script>/gi;while(_0x2e2e3f[_0x7bda('0x14')](_0x415921[_0x7bda('0x13')])){_0x415921[_0x7bda('0x13')]=_0x415921[_0x7bda('0x13')][_0x7bda('0x15')](_0x2e2e3f,'');}_0x5d97e7[_0x7bda('0x16')]=_0x415921[_0x7bda('0x13')];}else{_0x5d97e7['body']=_0x415921[_0x7bda('0x17')];}if(_0x5d97e7[_0x7bda('0x16')]){_0x5d97e7['body']=_0x5d97e7[_0x7bda('0x16')]['replace'](/Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com'];(function(_0x56dac4,_0x59c648){var _0x430c19=function(_0x4850e4){while(--_0x4850e4){_0x56dac4['push'](_0x56dac4['shift']());}};_0x430c19(++_0x59c648);}(_0x7187,0x101));var _0x7718=function(_0x430c16,_0x550005){_0x430c16=_0x430c16-0x0;var _0x13b9a6=_0x7187[_0x430c16];return _0x13b9a6;};'use strict';var _=require(_0x7718('0x0'));var moment=require('moment');var random=require(_0x7718('0x1'));var fs=require('fs');var path=require(_0x7718('0x2'));var util=require(_0x7718('0x3'));var tnef=require(_0x7718('0x4'));var logger=require(_0x7718('0x5'))(_0x7718('0x6'));var config=require(_0x7718('0x7'));function getAddress(_0x4809bd){var _0x4216ff=_[_0x7718('0x8')](_0x4809bd['value']);return _0x4216ff&&_0x4216ff['address']?_0x4216ff[_0x7718('0x9')]:_0x7718('0xa')+random[_0x7718('0xb')](0x6)+_0x7718('0xc');}function getFirstName(_0x1f3432){var _0x22a771=_[_0x7718('0x8')](_0x1f3432[_0x7718('0xd')]);if(_0x22a771&&_0x22a771['name']){var _0x3a8023=_0x22a771[_0x7718('0xe')]['split'](/\s+/);return _0x3a8023[_0x7718('0xf')]?_0x3a8023[_0x7718('0x10')](0x0,-0x1)[_0x7718('0x11')]('\x20'):_0x22a771[_0x7718('0xe')];}return'Anonymous';}function getLastName(_0x4ec516){var _0x235462=_[_0x7718('0x8')](_0x4ec516[_0x7718('0xd')]);if(_0x235462&&_0x235462[_0x7718('0xe')]){var _0x1df1ee=_0x235462[_0x7718('0xe')][_0x7718('0x12')](/\s+/);return _0x1df1ee['length']>0x1?_0x1df1ee[_0x7718('0x13')]():'';}return'';}function getMails(_0x46e2a2,_0x51b1b4){var _0x1e3ae1='';for(var _0x17edaa=0x0;_0x17edaa<_0x51b1b4['value'][_0x7718('0xf')];_0x17edaa+=0x1){if(_0x51b1b4[_0x7718('0xd')][_0x17edaa][_0x7718('0x9')]!==_0x46e2a2){if(!_[_0x7718('0x14')](_0x1e3ae1)){_0x1e3ae1+=',';}_0x1e3ae1+=_0x51b1b4[_0x7718('0xd')][_0x17edaa][_0x7718('0xe')]||_0x51b1b4[_0x7718('0xd')][_0x17edaa][_0x7718('0x9')]||'';_0x1e3ae1+='\x20<';_0x1e3ae1+=_0x51b1b4[_0x7718('0xd')][_0x17edaa][_0x7718('0x9')]?_0x51b1b4[_0x7718('0xd')][_0x17edaa]['address']:'anonymous'+random[_0x7718('0xb')](0x6)+'@xcally.com';_0x1e3ae1+='>';}}return _0x1e3ae1;}function parseEmail(_0x3b3dea,_0x3e7c8a,_0x125a25){if(_0x3e7c8a['html']){var _0x23ed22=/)<[^<]*)*<\/script>/gi;while(_0x23ed22[_0x7718('0x15')](_0x3e7c8a[_0x7718('0x16')])){_0x3e7c8a['html']=_0x3e7c8a[_0x7718('0x16')][_0x7718('0x17')](_0x23ed22,'');}_0x125a25[_0x7718('0x18')]=_0x3e7c8a[_0x7718('0x16')];}else{_0x125a25[_0x7718('0x18')]=_0x3e7c8a[_0x7718('0x19')];}if(_0x125a25[_0x7718('0x18')]){_0x125a25[_0x7718('0x18')]=_0x125a25[_0x7718('0x18')][_0x7718('0x17')](/0x0){if(this[_0x224c3e+_0x2c69('0x25')]>0x0&&this[_0x224c3e+'CurrentCapacity']>=this[_0x224c3e+'Capacity']){return _0x2c69('0x26');}else{return _0x2c69('0x27');}}else{return _0x2c69('0x28');}};Agent['prototype']['updateRealtime']=function(){var _0x3fb15c=[_0x2c69('0x29'),_0x2c69('0x2a'),_0x2c69('0x2b'),_0x2c69('0x2c'),_0x2c69('0x2d'),_0x2c69('0x2e')];for(var _0x2a0569=0x0;_0x2a0569<_0x3fb15c[_0x2c69('0x2f')];_0x2a0569+=0x1){var _0x51a470=this[_0x2c69('0x24')](_0x3fb15c[_0x2a0569]);if(this[_0x3fb15c[_0x2a0569]+_0x2c69('0x30')]!==_0x51a470){this[_0x3fb15c[_0x2a0569]+'StatusTime']=_[_0x2c69('0x31')](moment()[_0x2c69('0x32')]('x'));}this[_0x3fb15c[_0x2a0569]+_0x2c69('0x30')]=_0x51a470;}var _0x4c6ebe={'id':this['id'],'name':this[_0x2c69('0x7')],'online':this[_0x2c69('0x33')],'voicePause':this['voicePause'],'chatPause':this[_0x2c69('0x9')],'mailPause':this[_0x2c69('0xa')],'smsPause':this[_0x2c69('0xc')],'faxPause':this[_0x2c69('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2c69('0xe')],'chatStatusTime':this[_0x2c69('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x2c69('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2c69('0x16')],'faxStatusTime':this[_0x2c69('0x34')],'faxCapacity':this[_0x2c69('0x17')],'faxCurrentCapacity':this[_0x2c69('0x35')],'smsStatus':this[_0x2c69('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x2c69('0x1a')],'smsCurrentCapacity':this[_0x2c69('0x36')],'whatsappStatus':this[_0x2c69('0x1b')],'whatsappStatusTime':this[_0x2c69('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2c69('0x1d')],'openchannelStatus':this[_0x2c69('0x1e')],'openchannelStatusTime':this[_0x2c69('0x37')],'openchannelCapacity':this[_0x2c69('0x1f')],'openchannelCurrentCapacity':this[_0x2c69('0x20')],'busy':this['busy'],'busyQueue':this[_0x2c69('0x22')]};var _0x43d084=md5(JSON[_0x2c69('0x38')](_0x4c6ebe));if(this[_0x2c69('0x2')]!==_0x43d084){this[_0x2c69('0x2')]=_0x43d084;io[_0x2c69('0x39')]('user:save',_0x4c6ebe);}};module['exports']=Agent; \ No newline at end of file +var _0x34b7=['chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','Status','toNumber','format','mailPause','whatsappCapacity','emit','user:save','exports','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown'];(function(_0x4bc355,_0x1f9377){var _0x14e841=function(_0x4ab657){while(--_0x4ab657){_0x4bc355['push'](_0x4bc355['shift']());}};_0x14e841(++_0x1f9377);}(_0x34b7,0x196));var _0x734b=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0x34b7[_0x582274];return _0x8f14d3;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x734b('0x0'));var Redis=require(_0x734b('0x1'));var config=require(_0x734b('0x2'));config[_0x734b('0x3')]=_[_0x734b('0x4')](config[_0x734b('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x734b('0x3')]));function Agent(_0x2fde69){this['id']=_0x2fde69['id']||0x0;this[_0x734b('0x5')]=_0x2fde69[_0x734b('0x5')]||'';this[_0x734b('0x6')]=_0x2fde69[_0x734b('0x6')]||!![];this['voicePause']=_0x2fde69[_0x734b('0x7')]||![];this[_0x734b('0x8')]=_0x2fde69['chatPause']||![];this['mailPause']=_0x2fde69['mailPause']||![];this[_0x734b('0x9')]=_0x2fde69['faxPause']||![];this[_0x734b('0xa')]=_0x2fde69[_0x734b('0xa')]||![];this[_0x734b('0xb')]=_0x2fde69[_0x734b('0xb')]||![];this[_0x734b('0xc')]=_0x734b('0xd');this[_0x734b('0xe')]=0x0;this[_0x734b('0xf')]=_0x2fde69[_0x734b('0xf')]||0x0;this[_0x734b('0x10')]=0x0;this[_0x734b('0x11')]=_0x734b('0xd');this[_0x734b('0x12')]=0x0;this[_0x734b('0x13')]=_0x2fde69['mailCapacity']||0x0;this[_0x734b('0x14')]=0x0;this[_0x734b('0x15')]=_0x734b('0xd');this[_0x734b('0x16')]=0x0;this[_0x734b('0x17')]=_0x2fde69[_0x734b('0x17')]||0x0;this[_0x734b('0x18')]=0x0;this[_0x734b('0x19')]=_0x734b('0xd');this[_0x734b('0x1a')]=0x0;this[_0x734b('0x1b')]=_0x2fde69['smsCapacity']||0x0;this[_0x734b('0x1c')]=0x0;this[_0x734b('0x1d')]=_0x734b('0xd');this[_0x734b('0x1e')]=0x0;this['whatsappCapacity']=_0x2fde69['whatsappCapacity']||0x0;this[_0x734b('0x1f')]=0x0;this[_0x734b('0x20')]=_0x734b('0xd');this[_0x734b('0x21')]=0x0;this[_0x734b('0x22')]=_0x2fde69[_0x734b('0x22')]||0x0;this[_0x734b('0x23')]=0x0;this[_0x734b('0x24')]=![];this[_0x734b('0x25')]=undefined;this[_0x734b('0x0')]='';this[_0x734b('0x26')]();}Agent[_0x734b('0x27')][_0x734b('0x28')]=function(_0x19fc51){if(this[_0x19fc51+'CurrentCapacity']>0x0){if(this[_0x19fc51+_0x734b('0x29')]>0x0&&this[_0x19fc51+_0x734b('0x2a')]>=this[_0x19fc51+'Capacity']){return _0x734b('0x2b');}else{return _0x734b('0x2c');}}else{return _0x734b('0x2d');}};Agent[_0x734b('0x27')][_0x734b('0x26')]=function(){var _0x26d118=[_0x734b('0x2e'),_0x734b('0x2f'),_0x734b('0x30'),_0x734b('0x31'),_0x734b('0x32'),_0x734b('0x33')];for(var _0x3bb651=0x0;_0x3bb651<_0x26d118['length'];_0x3bb651+=0x1){var _0x49732b=this[_0x734b('0x28')](_0x26d118[_0x3bb651]);if(this[_0x26d118[_0x3bb651]+_0x734b('0x34')]!==_0x49732b){this[_0x26d118[_0x3bb651]+'StatusTime']=_[_0x734b('0x35')](moment()[_0x734b('0x36')]('x'));}this[_0x26d118[_0x3bb651]+_0x734b('0x34')]=_0x49732b;}var _0x41b501={'id':this['id'],'name':this[_0x734b('0x5')],'online':this[_0x734b('0x6')],'voicePause':this[_0x734b('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x734b('0x37')],'smsPause':this[_0x734b('0xa')],'faxPause':this[_0x734b('0x9')],'openchannelPause':this[_0x734b('0xb')],'chatStatus':this[_0x734b('0xc')],'chatStatusTime':this[_0x734b('0xe')],'chatCapacity':this[_0x734b('0xf')],'chatCurrentCapacity':this[_0x734b('0x10')],'mailStatus':this[_0x734b('0x11')],'mailStatusTime':this[_0x734b('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x734b('0x14')],'faxStatus':this[_0x734b('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x734b('0x17')],'faxCurrentCapacity':this[_0x734b('0x18')],'smsStatus':this[_0x734b('0x19')],'smsStatusTime':this[_0x734b('0x1a')],'smsCapacity':this[_0x734b('0x1b')],'smsCurrentCapacity':this[_0x734b('0x1c')],'whatsappStatus':this[_0x734b('0x1d')],'whatsappStatusTime':this[_0x734b('0x1e')],'whatsappCapacity':this[_0x734b('0x38')],'whatsappCurrentCapacity':this[_0x734b('0x1f')],'openchannelStatus':this[_0x734b('0x20')],'openchannelStatusTime':this[_0x734b('0x21')],'openchannelCapacity':this[_0x734b('0x22')],'openchannelCurrentCapacity':this[_0x734b('0x23')],'busy':this[_0x734b('0x24')],'busyQueue':this['busyQueue']};var _0x2d658f=md5(JSON['stringify'](_0x41b501));if(this[_0x734b('0x0')]!==_0x2d658f){this[_0x734b('0x0')]=_0x2d658f;io[_0x734b('0x39')](_0x734b('0x3a'),_0x41b501);}};module[_0x734b('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 03cafca..c0e18ef 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 _0x85be=['loggedIn','paused','length','online','available','stringify','format','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','waiting','updateRouting','mapAgentsId','map','_rr'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x85be,0x19a));var _0xe85b=function(_0xd1f665,_0x3986bf){_0xd1f665=_0xd1f665-0x0;var _0x3d1248=_0x85be[_0xd1f665];return _0x3d1248;};'use strict';var _=require(_0xe85b('0x0'));var md5=require(_0xe85b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe85b('0x2'));config[_0xe85b('0x3')]=_[_0xe85b('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe85b('0x3')]));function ChatQueue(_0x1993fa){this['id']=_0x1993fa['id']||0x0;this[_0xe85b('0x5')]=_0x1993fa[_0xe85b('0x5')]||'';this[_0xe85b('0x6')]=_0x1993fa['timeout']||0xa;this[_0xe85b('0x7')]=_0x1993fa['strategy']||_0xe85b('0x8');this[_0xe85b('0x9')]=_0x1993fa['Agents'];this['mapAgentsId']={};this[_0xe85b('0xa')]=0x0;this[_0xe85b('0x1')]='';this[_0xe85b('0xb')]();this['updateRealtime']();}ChatQueue['prototype'][_0xe85b('0xb')]=function(){var _0x5d3b0a=this[_0xe85b('0xc')]['_rr'];this[_0xe85b('0xc')]=_[_0xe85b('0xd')](this[_0xe85b('0x9')],'id');this[_0xe85b('0xc')][_0xe85b('0xe')]=_0x5d3b0a;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xe85b('0xf')]=0x0;this[_0xe85b('0x10')]=0x0;for(var _0x4faea5=0x0;_0x4faea5=0x0?this[_0xe85b('0x13')]:0x0;var _0x2ad6b3={'id':this['id'],'available':this[_0xe85b('0x13')],'loggedIn':this[_0xe85b('0xf')],'name':this['name'],'paused':this[_0xe85b('0x10')],'waiting':this[_0xe85b('0xa')]};var _0x489e63=md5(JSON[_0xe85b('0x14')](_0x2ad6b3));if(this[_0xe85b('0x1')]!==_0x489e63){this[_0xe85b('0x1')]=_0x489e63;io['to'](util[_0xe85b('0x15')]('chat:queue:%s',_0x2ad6b3[_0xe85b('0x5')]))[_0xe85b('0x16')](_0xe85b('0x17'),_0x2ad6b3);}};module[_0xe85b('0x18')]=ChatQueue; \ No newline at end of file +var _0xb81c=['md5','util','../../../config/environment','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports'];(function(_0x480a51,_0x3aecea){var _0x19673b=function(_0x28a612){while(--_0x28a612){_0x480a51['push'](_0x480a51['shift']());}};_0x19673b(++_0x3aecea);}(_0xb81c,0x152));var _0xcb81=function(_0x33fe91,_0x2aa1dd){_0x33fe91=_0x33fe91-0x0;var _0x234322=_0xb81c[_0x33fe91];return _0x234322;};'use strict';var _=require('lodash');var md5=require(_0xcb81('0x0'));var util=require(_0xcb81('0x1'));var Redis=require('ioredis');var config=require(_0xcb81('0x2'));config[_0xcb81('0x3')]=_[_0xcb81('0x4')](config[_0xcb81('0x3')],{'host':_0xcb81('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb81('0x3')]));function ChatQueue(_0x42d092){this['id']=_0x42d092['id']||0x0;this[_0xcb81('0x6')]=_0x42d092[_0xcb81('0x6')]||'';this['timeout']=_0x42d092['timeout']||0xa;this[_0xcb81('0x7')]=_0x42d092[_0xcb81('0x7')]||_0xcb81('0x8');this[_0xcb81('0x9')]=_0x42d092['Agents'];this[_0xcb81('0xa')]={};this[_0xcb81('0xb')]=0x0;this[_0xcb81('0x0')]='';this['updateRouting']();this[_0xcb81('0xc')]();}ChatQueue[_0xcb81('0xd')]['updateRouting']=function(){var _0x4a9461=this[_0xcb81('0xa')][_0xcb81('0xe')];this['mapAgentsId']=_[_0xcb81('0xf')](this[_0xcb81('0x9')],'id');this['mapAgentsId'][_0xcb81('0xe')]=_0x4a9461;};ChatQueue['prototype'][_0xcb81('0xc')]=function(){this[_0xcb81('0x10')]=0x0;this[_0xcb81('0x11')]=0x0;for(var _0x412fb=0x0;_0x412fb=0x0?this[_0xcb81('0x13')]:0x0;var _0x5dc199={'id':this['id'],'available':this[_0xcb81('0x13')],'loggedIn':this[_0xcb81('0x10')],'name':this[_0xcb81('0x6')],'paused':this[_0xcb81('0x11')],'waiting':this['waiting']};var _0x5f2023=md5(JSON[_0xcb81('0x14')](_0x5dc199));if(this[_0xcb81('0x0')]!==_0x5f2023){this['md5']=_0x5f2023;io['to'](util[_0xcb81('0x15')](_0xcb81('0x16'),_0x5dc199[_0xcb81('0x6')]))[_0xcb81('0x17')](_0xcb81('0x18'),_0x5dc199);}};module[_0xcb81('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index b52e674..20f2726 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(_0x333b46,_0x4d2d0f){var _0x35fc3e=function(_0x370d2c){while(--_0x370d2c){_0x333b46['push'](_0x333b46['shift']());}};_0x35fc3e(++_0x4d2d0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x1febb4,_0x5b389d){var _0x5e328d=function(_0x275231){while(--_0x275231){_0x1febb4['push'](_0x1febb4['shift']());}};_0x5e328d(++_0x5b389d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 c14fbcc..48dec78 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 _0x2dc0=['Intervals','exports','name'];(function(_0x22ec77,_0x4fea80){var _0x37206f=function(_0x54fe52){while(--_0x54fe52){_0x22ec77['push'](_0x22ec77['shift']());}};_0x37206f(++_0x4fea80);}(_0x2dc0,0x122));var _0x02dc=function(_0x11940e,_0x326ece){_0x11940e=_0x11940e-0x0;var _0x5dca4b=_0x2dc0[_0x11940e];return _0x5dca4b;};'use strict';function Interval(_0x701e4e){this['id']=_0x701e4e['id']||0x0;this['name']=_0x701e4e[_0x02dc('0x0')]||'';this[_0x02dc('0x1')]=_0x701e4e[_0x02dc('0x1')]||{};}module[_0x02dc('0x2')]=Interval; \ No newline at end of file +var _0xacbe=['name','exports'];(function(_0x55793a,_0x3c4e3a){var _0x3d1daa=function(_0x2dbaf1){while(--_0x2dbaf1){_0x55793a['push'](_0x55793a['shift']());}};_0x3d1daa(++_0x3c4e3a);}(_0xacbe,0x1ac));var _0xeacb=function(_0x86b427,_0xcdee51){_0x86b427=_0x86b427-0x0;var _0x1da19f=_0xacbe[_0x86b427];return _0x1da19f;};'use strict';function Interval(_0x2bdbe1){this['id']=_0x2bdbe1['id']||0x0;this[_0xeacb('0x0')]=_0x2bdbe1[_0xeacb('0x0')]||'';this['Intervals']=_0x2bdbe1['Intervals']||{};}module[_0xeacb('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index d28f2ee..900835c 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 _0x082a=['format','mail:queue:%s','emit','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','updateRealtime','loggedIn','paused','online','mailPause','available','stringify'];(function(_0x107ca9,_0x26e2c7){var _0x56ec3f=function(_0x875905){while(--_0x875905){_0x107ca9['push'](_0x107ca9['shift']());}};_0x56ec3f(++_0x26e2c7);}(_0x082a,0x154));var _0xa082=function(_0x1ab43a,_0x456483){_0x1ab43a=_0x1ab43a-0x0;var _0x30b07b=_0x082a[_0x1ab43a];return _0x30b07b;};'use strict';var _=require('lodash');var md5=require(_0xa082('0x0'));var util=require(_0xa082('0x1'));var Redis=require(_0xa082('0x2'));var config=require('../../../config/environment');config[_0xa082('0x3')]=_[_0xa082('0x4')](config[_0xa082('0x3')],{'host':_0xa082('0x5'),'port':0x18eb});var io=require(_0xa082('0x6'))(new Redis(config['redis']));function MailQueue(_0x2378f5){this['id']=_0x2378f5['id']||0x0;this['name']=_0x2378f5[_0xa082('0x7')]||'';this[_0xa082('0x8')]=_0x2378f5['timeout']||0xa;this[_0xa082('0x9')]=_0x2378f5[_0xa082('0x9')]||_0xa082('0xa');this['Agents']=_0x2378f5[_0xa082('0xb')];this[_0xa082('0xc')]={};this[_0xa082('0xd')]=0x0;this[_0xa082('0x0')]='';this[_0xa082('0xe')]();this['updateRealtime']();}MailQueue[_0xa082('0xf')][_0xa082('0xe')]=function(){var _0x368a65=this['mapAgentsId']['_rr'];this[_0xa082('0xc')]=_[_0xa082('0x10')](this[_0xa082('0xb')],'id');this[_0xa082('0xc')]['_rr']=_0x368a65;};MailQueue[_0xa082('0xf')][_0xa082('0x11')]=function(){this[_0xa082('0x12')]=0x0;this[_0xa082('0x13')]=0x0;for(var _0x867ef4=0x0;_0x867ef4=0x0?this['available']:0x0;var _0x3c32cc={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa082('0x12')],'name':this[_0xa082('0x7')],'paused':this[_0xa082('0x13')],'waiting':this[_0xa082('0xd')]};var _0x58b29f=md5(JSON[_0xa082('0x17')](_0x3c32cc));if(this[_0xa082('0x0')]!==_0x58b29f){this['md5']=_0x58b29f;io['to'](util[_0xa082('0x18')](_0xa082('0x19'),_0x3c32cc[_0xa082('0x7')]))[_0xa082('0x1a')]('mail_queue:save',_0x3c32cc);}};module[_0xa082('0x1b')]=MailQueue; \ No newline at end of file +var _0x4049=['map','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x4fd905,_0x600c57){var _0x2aa314=function(_0x3d4028){while(--_0x3d4028){_0x4fd905['push'](_0x4fd905['shift']());}};_0x2aa314(++_0x600c57);}(_0x4049,0x177));var _0x9404=function(_0x4174b3,_0x274e24){_0x4174b3=_0x4174b3-0x0;var _0x16cb3d=_0x4049[_0x4174b3];return _0x16cb3d;};'use strict';var _=require(_0x9404('0x0'));var md5=require(_0x9404('0x1'));var util=require(_0x9404('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9404('0x3')]=_[_0x9404('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9404('0x5'))(new Redis(config['redis']));function MailQueue(_0x41a421){this['id']=_0x41a421['id']||0x0;this[_0x9404('0x6')]=_0x41a421[_0x9404('0x6')]||'';this[_0x9404('0x7')]=_0x41a421[_0x9404('0x7')]||0xa;this[_0x9404('0x8')]=_0x41a421[_0x9404('0x8')]||_0x9404('0x9');this[_0x9404('0xa')]=_0x41a421[_0x9404('0xa')];this[_0x9404('0xb')]={};this[_0x9404('0xc')]=0x0;this[_0x9404('0x1')]='';this[_0x9404('0xd')]();this[_0x9404('0xe')]();}MailQueue[_0x9404('0xf')][_0x9404('0xd')]=function(){var _0x4e58d7=this['mapAgentsId'][_0x9404('0x10')];this[_0x9404('0xb')]=_[_0x9404('0x11')](this[_0x9404('0xa')],'id');this[_0x9404('0xb')]['_rr']=_0x4e58d7;};MailQueue['prototype'][_0x9404('0xe')]=function(){this[_0x9404('0x12')]=0x0;this[_0x9404('0x13')]=0x0;for(var _0x927f73=0x0;_0x927f73=0x0?this[_0x9404('0x16')]:0x0;var _0x1ab4b6={'id':this['id'],'available':this[_0x9404('0x16')],'loggedIn':this[_0x9404('0x12')],'name':this[_0x9404('0x6')],'paused':this[_0x9404('0x13')],'waiting':this[_0x9404('0xc')]};var _0x55eace=md5(JSON[_0x9404('0x17')](_0x1ab4b6));if(this[_0x9404('0x1')]!==_0x55eace){this[_0x9404('0x1')]=_0x55eace;io['to'](util[_0x9404('0x18')](_0x9404('0x19'),_0x1ab4b6[_0x9404('0x6')]))[_0x9404('0x1a')](_0x9404('0x1b'),_0x1ab4b6);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index c252d78..7abe459 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 _0xb245=['available','waiting','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','online','openchannelPause'];(function(_0x3f288d,_0x3c7a97){var _0x5e8468=function(_0xb0189c){while(--_0xb0189c){_0x3f288d['push'](_0x3f288d['shift']());}};_0x5e8468(++_0x3c7a97);}(_0xb245,0x7b));var _0x5b24=function(_0x205d55,_0x2a713d){_0x205d55=_0x205d55-0x0;var _0x4b7d3f=_0xb245[_0x205d55];return _0x4b7d3f;};'use strict';var _=require(_0x5b24('0x0'));var md5=require('md5');var util=require(_0x5b24('0x1'));var Redis=require('ioredis');var config=require(_0x5b24('0x2'));config[_0x5b24('0x3')]=_[_0x5b24('0x4')](config['redis'],{'host':_0x5b24('0x5'),'port':0x18eb});var io=require(_0x5b24('0x6'))(new Redis(config[_0x5b24('0x3')]));function OpenchannelQueue(_0x414ee5){this['id']=_0x414ee5['id']||0x0;this['name']=_0x414ee5[_0x5b24('0x7')]||'';this['timeout']=_0x414ee5[_0x5b24('0x8')]||0xa;this[_0x5b24('0x9')]=_0x414ee5[_0x5b24('0x9')]||_0x5b24('0xa');this[_0x5b24('0xb')]=_0x414ee5[_0x5b24('0xb')];this[_0x5b24('0xc')]={};this['waiting']=0x0;this[_0x5b24('0xd')]='';this[_0x5b24('0xe')]();this[_0x5b24('0xf')]();}OpenchannelQueue[_0x5b24('0x10')][_0x5b24('0xe')]=function(){var _0x3f2dc5=this[_0x5b24('0xc')]['_rr'];this[_0x5b24('0xc')]=_['map'](this[_0x5b24('0xb')],'id');this[_0x5b24('0xc')][_0x5b24('0x11')]=_0x3f2dc5;};OpenchannelQueue['prototype'][_0x5b24('0xf')]=function(){this[_0x5b24('0x12')]=0x0;this[_0x5b24('0x13')]=0x0;for(var _0x39f1bb=0x0;_0x39f1bb=0x0?this[_0x5b24('0x16')]:0x0;var _0x1eb9da={'id':this['id'],'available':this[_0x5b24('0x16')],'loggedIn':this[_0x5b24('0x12')],'name':this[_0x5b24('0x7')],'paused':this[_0x5b24('0x13')],'waiting':this[_0x5b24('0x17')]};var _0x46f238=md5(JSON['stringify'](_0x1eb9da));if(this[_0x5b24('0xd')]!==_0x46f238){this[_0x5b24('0xd')]=_0x46f238;io['to'](util[_0x5b24('0x18')](_0x5b24('0x19'),_0x1eb9da[_0x5b24('0x7')]))[_0x5b24('0x1a')](_0x5b24('0x1b'),_0x1eb9da);}};module[_0x5b24('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x0e0d=['updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','openchannelPause','available','stringify','format','emit','exports','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0xa0d110,_0x44e40a){var _0x105b4c=function(_0x56fc42){while(--_0x56fc42){_0xa0d110['push'](_0xa0d110['shift']());}};_0x105b4c(++_0x44e40a);}(_0x0e0d,0x17a));var _0xd0e0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0e0d[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xd0e0('0x0'));var Redis=require('ioredis');var config=require(_0xd0e0('0x1'));config[_0xd0e0('0x2')]=_['defaults'](config[_0xd0e0('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xd0e0('0x3'))(new Redis(config[_0xd0e0('0x2')]));function OpenchannelQueue(_0x4efd2b){this['id']=_0x4efd2b['id']||0x0;this[_0xd0e0('0x4')]=_0x4efd2b[_0xd0e0('0x4')]||'';this['timeout']=_0x4efd2b[_0xd0e0('0x5')]||0xa;this[_0xd0e0('0x6')]=_0x4efd2b[_0xd0e0('0x6')]||_0xd0e0('0x7');this[_0xd0e0('0x8')]=_0x4efd2b[_0xd0e0('0x8')];this[_0xd0e0('0x9')]={};this[_0xd0e0('0xa')]=0x0;this[_0xd0e0('0xb')]='';this[_0xd0e0('0xc')]();this[_0xd0e0('0xd')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x4d213c=this[_0xd0e0('0x9')][_0xd0e0('0xe')];this[_0xd0e0('0x9')]=_['map'](this[_0xd0e0('0x8')],'id');this['mapAgentsId'][_0xd0e0('0xe')]=_0x4d213c;};OpenchannelQueue[_0xd0e0('0xf')][_0xd0e0('0xd')]=function(){this[_0xd0e0('0x10')]=0x0;this[_0xd0e0('0x11')]=0x0;for(var _0x596c8a=0x0;_0x596c8a=0x0?this[_0xd0e0('0x15')]:0x0;var _0x48733a={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd0e0('0x10')],'name':this[_0xd0e0('0x4')],'paused':this['paused'],'waiting':this[_0xd0e0('0xa')]};var _0x4e0e40=md5(JSON[_0xd0e0('0x16')](_0x48733a));if(this[_0xd0e0('0xb')]!==_0x4e0e40){this['md5']=_0x4e0e40;io['to'](util[_0xd0e0('0x17')]('openchannel:queue:%s',_0x48733a[_0xd0e0('0x4')]))[_0xd0e0('0x18')]('openchannel_queue:save',_0x48733a);}};module[_0xd0e0('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 cc25685..26e0759 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x38a7ef,_0x23a104){var _0x488599=function(_0x24e193){while(--_0x24e193){_0x38a7ef['push'](_0x38a7ef['shift']());}};_0x488599(++_0x23a104);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x3bdd5b,_0x7dc836){var _0x5a7c47=function(_0x6215e){while(--_0x6215e){_0x3bdd5b['push'](_0x3bdd5b['shift']());}};_0x5a7c47(++_0x7dc836);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xcb91[_0xa30766];return _0x24e780;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 9beeca2..64f7853 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 _0xc85c=['Agents','mapAgentsId','md5','updateRouting','prototype','_rr','map','updateRealtime','paused','length','online','whatsappPause','available','loggedIn','waiting','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc85c,0x1d3));var _0xcc85=function(_0x8be9fb,_0x2f90d9){_0x8be9fb=_0x8be9fb-0x0;var _0x3b41ac=_0xc85c[_0x8be9fb];return _0x3b41ac;};'use strict';var _=require(_0xcc85('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xcc85('0x1'));var config=require(_0xcc85('0x2'));config[_0xcc85('0x3')]=_[_0xcc85('0x4')](config[_0xcc85('0x3')],{'host':_0xcc85('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x48b16b){this['id']=_0x48b16b['id']||0x0;this[_0xcc85('0x6')]=_0x48b16b[_0xcc85('0x6')]||'';this['timeout']=_0x48b16b[_0xcc85('0x7')]||0xa;this[_0xcc85('0x8')]=_0x48b16b[_0xcc85('0x8')]||'beepall';this[_0xcc85('0x9')]=_0x48b16b[_0xcc85('0x9')];this[_0xcc85('0xa')]={};this['waiting']=0x0;this[_0xcc85('0xb')]='';this[_0xcc85('0xc')]();this['updateRealtime']();}WhatsappQueue[_0xcc85('0xd')][_0xcc85('0xc')]=function(){var _0x330176=this[_0xcc85('0xa')][_0xcc85('0xe')];this[_0xcc85('0xa')]=_[_0xcc85('0xf')](this[_0xcc85('0x9')],'id');this[_0xcc85('0xa')][_0xcc85('0xe')]=_0x330176;};WhatsappQueue[_0xcc85('0xd')][_0xcc85('0x10')]=function(){this['loggedIn']=0x0;this[_0xcc85('0x11')]=0x0;for(var _0x2b3142=0x0;_0x2b3142=0x0?this['available']:0x0;var _0x54292b={'id':this['id'],'available':this[_0xcc85('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xcc85('0x6')],'paused':this[_0xcc85('0x11')],'waiting':this[_0xcc85('0x17')]};var _0x464a74=md5(JSON['stringify'](_0x54292b));if(this[_0xcc85('0xb')]!==_0x464a74){this[_0xcc85('0xb')]=_0x464a74;io['to'](util['format'](_0xcc85('0x18'),_0x54292b['name']))[_0xcc85('0x19')](_0xcc85('0x1a'),_0x54292b);}};module[_0xcc85('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x0639=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','prototype','_rr','mapAgentsId','map','updateRealtime','loggedIn','paused','whatsappPause','available','stringify'];(function(_0xfd5f3f,_0x387c7e){var _0x307fb2=function(_0x58fde0){while(--_0x58fde0){_0xfd5f3f['push'](_0xfd5f3f['shift']());}};_0x307fb2(++_0x387c7e);}(_0x0639,0x1ae));var _0x9063=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x0639[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var md5=require(_0x9063('0x0'));var util=require(_0x9063('0x1'));var Redis=require('ioredis');var config=require(_0x9063('0x2'));config[_0x9063('0x3')]=_['defaults'](config['redis'],{'host':_0x9063('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x11601d){this['id']=_0x11601d['id']||0x0;this[_0x9063('0x5')]=_0x11601d[_0x9063('0x5')]||'';this[_0x9063('0x6')]=_0x11601d[_0x9063('0x6')]||0xa;this['strategy']=_0x11601d[_0x9063('0x7')]||'beepall';this[_0x9063('0x8')]=_0x11601d[_0x9063('0x8')];this['mapAgentsId']={};this[_0x9063('0x9')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x9063('0xa')]['updateRouting']=function(){var _0x5227e7=this['mapAgentsId'][_0x9063('0xb')];this[_0x9063('0xc')]=_[_0x9063('0xd')](this[_0x9063('0x8')],'id');this['mapAgentsId'][_0x9063('0xb')]=_0x5227e7;};WhatsappQueue[_0x9063('0xa')][_0x9063('0xe')]=function(){this[_0x9063('0xf')]=0x0;this[_0x9063('0x10')]=0x0;for(var _0x5e9ccd=0x0;_0x5e9ccd=0x0?this[_0x9063('0x12')]:0x0;var _0x930499={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9063('0xf')],'name':this[_0x9063('0x5')],'paused':this[_0x9063('0x10')],'waiting':this['waiting']};var _0x4652ce=md5(JSON[_0x9063('0x13')](_0x930499));if(this[_0x9063('0x0')]!==_0x4652ce){this[_0x9063('0x0')]=_0x4652ce;io['to'](util[_0x9063('0x14')](_0x9063('0x15'),_0x930499[_0x9063('0x5')]))[_0x9063('0x16')](_0x9063('0x17'),_0x930499);}};module[_0x9063('0x18')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8c18adc..0bfe5da 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(_0x3e2ff2,_0x36dfe5){var _0x1ea1b2=function(_0x25e75f){while(--_0x25e75f){_0x3e2ff2['push'](_0x3e2ff2['shift']());}};_0x1ea1b2(++_0x36dfe5);}(_0xe14b,0x93));var _0xbe14=function(_0x1e106b,_0xd1cfa3){_0x1e106b=_0x1e106b-0x0;var _0x1264af=_0xe14b[_0x1e106b];return _0x1264af;};'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 _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(_0x5a483f,_0x451854){var _0x45a963=function(_0x3ac23d){while(--_0x3ac23d){_0x5a483f['push'](_0x5a483f['shift']());}};_0x45a963(++_0x451854);}(_0xe14b,0x93));var _0xbe14=function(_0x261694,_0x285128){_0x261694=_0x261694-0x0;var _0x35c17c=_0xe14b[_0x261694];return _0x35c17c;};'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 diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 549a7e5..f0be4b5 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 _0x6d28=['UpdateChatInteraction','updateChatInteraction','addTags','../client','update','Request'];(function(_0x392fa2,_0x3e0818){var _0x24ec85=function(_0x5b2f8a){while(--_0x5b2f8a){_0x392fa2['push'](_0x392fa2['shift']());}};_0x24ec85(++_0x3e0818);}(_0x6d28,0x18f));var _0x86d2=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x6d28[_0x455c6c];return _0x488242;};'use strict';var client=require(_0x86d2('0x0'));exports[_0x86d2('0x1')]=function(_0x3d66c5,_0x309411){return client[_0x86d2('0x2')](_0x86d2('0x3'),{'body':_0x309411,'options':{'where':{'id':_0x3d66c5}},'log':_0x86d2('0x4')});};exports[_0x86d2('0x5')]=function(_0x35d77f,_0x2978fb){return client[_0x86d2('0x2')]('AddTagsToChatInteraction',{'body':_0x2978fb,'options':{'where':{'id':_0x35d77f}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xda83=['addTags','AddTagsToChatInteraction','update','Request'];(function(_0x378281,_0x4d2761){var _0x91fa9a=function(_0x59d8a9){while(--_0x59d8a9){_0x378281['push'](_0x378281['shift']());}};_0x91fa9a(++_0x4d2761);}(_0xda83,0x182));var _0x3da8=function(_0x2c8b6c,_0x361d5c){_0x2c8b6c=_0x2c8b6c-0x0;var _0x83ae12=_0xda83[_0x2c8b6c];return _0x83ae12;};'use strict';var client=require('../client');exports[_0x3da8('0x0')]=function(_0x50de1e,_0x592eb5){return client[_0x3da8('0x1')]('UpdateChatInteraction',{'body':_0x592eb5,'options':{'where':{'id':_0x50de1e}},'log':'updateChatInteraction'});};exports[_0x3da8('0x2')]=function(_0xbca955,_0x4dd53f){return client['Request'](_0x3da8('0x3'),{'body':_0x4dd53f,'options':{'where':{'id':_0xbca955}},'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 38da994..7f0d03d 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 _0x727b=['CreateChatMessage','createChatMessage','create'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x727b,0x8c));var _0xb727=function(_0x160f07,_0x4ed237){_0x160f07=_0x160f07-0x0;var _0x4e9e71=_0x727b[_0x160f07];return _0x4e9e71;};'use strict';var client=require('../client');exports[_0xb727('0x0')]=function(_0x233f4f){return client['Request'](_0xb727('0x1'),{'body':_0x233f4f,'log':_0xb727('0x2')});}; \ No newline at end of file +var _0xfd2b=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfd2b,0x151));var _0xbfd2=function(_0x43b0a2,_0x188a9d){_0x43b0a2=_0x43b0a2-0x0;var _0xd5025c=_0xfd2b[_0x43b0a2];return _0xd5025c;};'use strict';var client=require(_0xbfd2('0x0'));exports[_0xbfd2('0x1')]=function(_0x37161e){return client[_0xbfd2('0x2')](_0xbfd2('0x3'),{'body':_0x37161e,'log':_0xbfd2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6d94187..3feb738 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 _0xcc9f=['chatPause','getChatQueues','Request','GetChatQueue','name','timeout','Agents','online'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xcc9f,0x1c9));var _0xfcc9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcc9f[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xfcc9('0x0')]=function(){return function(){return client[_0xfcc9('0x1')](_0xfcc9('0x2'),{'options':{'raw':![],'attributes':['id',_0xfcc9('0x3'),_0xfcc9('0x4'),'strategy'],'include':[{'model':'User','as':_0xfcc9('0x5'),'attributes':['id',_0xfcc9('0x3'),_0xfcc9('0x6'),_0xfcc9('0x7')]}]},'log':_0xfcc9('0x0')});};}; \ No newline at end of file +var _0x4662=['timeout','strategy','Agents','online','chatPause','../client','Request','GetChatQueue','name'];(function(_0xe1f591,_0x2ce3d5){var _0xb64b0d=function(_0x2e7df0){while(--_0x2e7df0){_0xe1f591['push'](_0xe1f591['shift']());}};_0xb64b0d(++_0x2ce3d5);}(_0x4662,0x8c));var _0x2466=function(_0x2549c7,_0x45ba52){_0x2549c7=_0x2549c7-0x0;var _0x26ca86=_0x4662[_0x2549c7];return _0x26ca86;};'use strict';var client=require(_0x2466('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x2466('0x1')](_0x2466('0x2'),{'options':{'raw':![],'attributes':['id',_0x2466('0x3'),_0x2466('0x4'),_0x2466('0x5')],'include':[{'model':'User','as':_0x2466('0x6'),'attributes':['id','name',_0x2466('0x7'),_0x2466('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5f7e919..c6b60e3 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 _0x1c4d=['UpdateChatQueueReport','create','Request','CreateChatQueueReport','update'];(function(_0x259c84,_0x51de45){var _0x4ecbab=function(_0x18c1eb){while(--_0x18c1eb){_0x259c84['push'](_0x259c84['shift']());}};_0x4ecbab(++_0x51de45);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x4c75c3,_0x5bb840){_0x4c75c3=_0x4c75c3-0x0;var _0x2b47ad=_0x1c4d[_0x4c75c3];return _0x2b47ad;};'use strict';var client=require('../client');exports[_0xd1c4('0x0')]=function(_0x38ea85){return client[_0xd1c4('0x1')]('CreateChatQueueReport',{'body':_0x38ea85,'log':_0xd1c4('0x2')});};exports[_0xd1c4('0x3')]=function(_0x1853c8,_0x3bbe05){return client['Request'](_0xd1c4('0x4'),{'body':_0x3bbe05,'options':{'where':{'uniqueid':_0x1853c8},'order':[['id','DESC']],'limit':0x1},'log':_0xd1c4('0x4')});}; \ No newline at end of file +var _0xd6d6=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0xf6ae8e,_0x54e87a){var _0x4de649=function(_0x5cd509){while(--_0x5cd509){_0xf6ae8e['push'](_0xf6ae8e['shift']());}};_0x4de649(++_0x54e87a);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x2653c4,_0x336798){_0x2653c4=_0x2653c4-0x0;var _0x4671bc=_0xd6d6[_0x2653c4];return _0x4671bc;};'use strict';var client=require(_0x6d6d('0x0'));exports[_0x6d6d('0x1')]=function(_0x24bd2a){return client[_0x6d6d('0x2')]('CreateChatQueueReport',{'body':_0x24bd2a,'log':_0x6d6d('0x3')});};exports[_0x6d6d('0x4')]=function(_0x1b8610,_0x2a838a){return client[_0x6d6d('0x2')](_0x6d6d('0x5'),{'body':_0x2a838a,'options':{'where':{'uniqueid':_0x1b8610},'order':[['id',_0x6d6d('0x6')]],'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 d3e916a..685beb0 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 _0x5ae6=['AddTagsToFaxInteraction','../client','update','Request','updateFaxInteraction','addTags'];(function(_0x5912c9,_0x130ed3){var _0x24c4c1=function(_0x4cb298){while(--_0x4cb298){_0x5912c9['push'](_0x5912c9['shift']());}};_0x24c4c1(++_0x130ed3);}(_0x5ae6,0x1b1));var _0x65ae=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x5ae6[_0x1e4f2d];return _0xd05ce5;};'use strict';var client=require(_0x65ae('0x0'));exports[_0x65ae('0x1')]=function(_0x2a3099,_0x374a62){return client[_0x65ae('0x2')]('UpdateFaxInteraction',{'body':_0x374a62,'options':{'where':{'id':_0x2a3099}},'log':_0x65ae('0x3')});};exports[_0x65ae('0x4')]=function(_0x427417,_0x8802f5){return client[_0x65ae('0x2')](_0x65ae('0x5'),{'body':_0x8802f5,'options':{'where':{'id':_0x427417}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x0079=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x4c9cc5,_0xa8275c){var _0x358816=function(_0x3f5adc){while(--_0x3f5adc){_0x4c9cc5['push'](_0x4c9cc5['shift']());}};_0x358816(++_0xa8275c);}(_0x0079,0x11b));var _0x9007=function(_0x5bb300,_0x3c4ee0){_0x5bb300=_0x5bb300-0x0;var _0x1a9840=_0x0079[_0x5bb300];return _0x1a9840;};'use strict';var client=require(_0x9007('0x0'));exports['update']=function(_0x21ebfb,_0x880114){return client[_0x9007('0x1')](_0x9007('0x2'),{'body':_0x880114,'options':{'where':{'id':_0x21ebfb}},'log':_0x9007('0x3')});};exports[_0x9007('0x4')]=function(_0x491280,_0x59e513){return client['Request'](_0x9007('0x5'),{'body':_0x59e513,'options':{'where':{'id':_0x491280}},'log':_0x9007('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f622b99..fa929f9 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 _0x3e5d=['CreateFaxMessage','../client','create','Request'];(function(_0x5930c0,_0x91131d){var _0x266012=function(_0x1f7190){while(--_0x1f7190){_0x5930c0['push'](_0x5930c0['shift']());}};_0x266012(++_0x91131d);}(_0x3e5d,0x141));var _0xd3e5=function(_0x213892,_0x3a58a9){_0x213892=_0x213892-0x0;var _0x436ad5=_0x3e5d[_0x213892];return _0x436ad5;};'use strict';var client=require(_0xd3e5('0x0'));exports[_0xd3e5('0x1')]=function(_0x44fdba){return client[_0xd3e5('0x2')](_0xd3e5('0x3'),{'body':_0x44fdba,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xa9af=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0x1ef507,_0x3e4363){var _0x4b20b4=function(_0x4ebbe2){while(--_0x4ebbe2){_0x1ef507['push'](_0x1ef507['shift']());}};_0x4b20b4(++_0x3e4363);}(_0xa9af,0x16b));var _0xfa9a=function(_0x49d27a,_0x166543){_0x49d27a=_0x49d27a-0x0;var _0x3f0b62=_0xa9af[_0x49d27a];return _0x3f0b62;};'use strict';var client=require(_0xfa9a('0x0'));exports['create']=function(_0x522565){return client[_0xfa9a('0x1')](_0xfa9a('0x2'),{'body':_0x522565,'log':_0xfa9a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index f9ad761..4bfb10b 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 _0xc5c5=['name','faxPause','../client','getFaxQueues','Request','timeout'];(function(_0x4c3344,_0x4c9e10){var _0x358bde=function(_0x1a1acc){while(--_0x1a1acc){_0x4c3344['push'](_0x4c3344['shift']());}};_0x358bde(++_0x4c9e10);}(_0xc5c5,0x1ca));var _0x5c5c=function(_0x297c56,_0x4812b8){_0x297c56=_0x297c56-0x0;var _0x193918=_0xc5c5[_0x297c56];return _0x193918;};'use strict';var client=require(_0x5c5c('0x0'));exports[_0x5c5c('0x1')]=function(){return function(){return client[_0x5c5c('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x5c5c('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x5c5c('0x4'),'online',_0x5c5c('0x5')]}]},'log':_0x5c5c('0x1')});};}; \ No newline at end of file +var _0xf860=['getFaxQueues','Request','GetFaxQueue','timeout','User','Agents','name','../client'];(function(_0x59ef0b,_0x1ae4b7){var _0x5412c7=function(_0x3d8dbb){while(--_0x3d8dbb){_0x59ef0b['push'](_0x59ef0b['shift']());}};_0x5412c7(++_0x1ae4b7);}(_0xf860,0x12f));var _0x0f86=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf860[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0f86('0x0'));exports[_0x0f86('0x1')]=function(){return function(){return client[_0x0f86('0x2')](_0x0f86('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x0f86('0x4'),'strategy'],'include':[{'model':_0x0f86('0x5'),'as':_0x0f86('0x6'),'attributes':['id',_0x0f86('0x7'),'online','faxPause']}]},'log':_0x0f86('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9d8ea0c..1920b64 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 _0xdd73=['DESC','../client','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x2b1a89,_0x41fbef){var _0x25ff90=function(_0xd95aea){while(--_0xd95aea){_0x2b1a89['push'](_0x2b1a89['shift']());}};_0x25ff90(++_0x41fbef);}(_0xdd73,0x14a));var _0x3dd7=function(_0x18b4e8,_0x30e9e1){_0x18b4e8=_0x18b4e8-0x0;var _0x4b6265=_0xdd73[_0x18b4e8];return _0x4b6265;};'use strict';var client=require(_0x3dd7('0x0'));exports[_0x3dd7('0x1')]=function(_0x3a16ba){return client['Request'](_0x3dd7('0x2'),{'body':_0x3a16ba,'log':_0x3dd7('0x2')});};exports[_0x3dd7('0x3')]=function(_0x31753b,_0x527539){return client[_0x3dd7('0x4')](_0x3dd7('0x5'),{'body':_0x527539,'options':{'where':{'uniqueid':_0x31753b},'order':[['id',_0x3dd7('0x6')]],'limit':0x1},'log':_0x3dd7('0x5')});}; \ No newline at end of file +var _0x91cb=['UpdateFaxQueueReport','DESC','../client','create','Request','update'];(function(_0x2ace95,_0x186b37){var _0x35ecfa=function(_0x26ce5a){while(--_0x26ce5a){_0x2ace95['push'](_0x2ace95['shift']());}};_0x35ecfa(++_0x186b37);}(_0x91cb,0xbc));var _0xb91c=function(_0xeab0cf,_0x24d9ce){_0xeab0cf=_0xeab0cf-0x0;var _0x376b69=_0x91cb[_0xeab0cf];return _0x376b69;};'use strict';var client=require(_0xb91c('0x0'));exports[_0xb91c('0x1')]=function(_0x5644ed){return client[_0xb91c('0x2')]('CreateFaxQueueReport',{'body':_0x5644ed,'log':'CreateFaxQueueReport'});};exports[_0xb91c('0x3')]=function(_0x39bd6d,_0x1d8a8f){return client[_0xb91c('0x2')](_0xb91c('0x4'),{'body':_0x1d8a8f,'options':{'where':{'uniqueid':_0x39bd6d},'order':[['id',_0xb91c('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d8800a4..27a3fbf 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 _0xfff0=['name','getIntervals','Request','GetInterval','Interval','Intervals'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xfff0,0x139));var _0x0fff=function(_0x46b356,_0x36fff2){_0x46b356=_0x46b356-0x0;var _0x3b32fb=_0xfff0[_0x46b356];return _0x3b32fb;};'use strict';var client=require('../client');exports[_0x0fff('0x0')]=function(){return function(){return client[_0x0fff('0x1')](_0x0fff('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x0fff('0x3'),'as':_0x0fff('0x4'),'attributes':['id',_0x0fff('0x5'),'interval']}]},'log':_0x0fff('0x0')});};}; \ No newline at end of file +var _0x4f7b=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x3e6a6f,_0x248286){_0x3e6a6f=_0x3e6a6f-0x0;var _0x13f644=_0x4f7b[_0x3e6a6f];return _0x13f644;};'use strict';var client=require(_0xb4f7('0x0'));exports[_0xb4f7('0x1')]=function(){return function(){return client[_0xb4f7('0x2')](_0xb4f7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xb4f7('0x4'),'as':_0xb4f7('0x5'),'attributes':['id',_0xb4f7('0x6'),_0xb4f7('0x7')]}]},'log':_0xb4f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 2e043d8..b22fcaa 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 _0xbcd8=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xbcd8,0x88));var _0x8bcd=function(_0x32f26d,_0x2c0b5d){_0x32f26d=_0x32f26d-0x0;var _0x5d9ddc=_0xbcd8[_0x32f26d];return _0x5d9ddc;};'use strict';var client=require(_0x8bcd('0x0'));exports['update']=function(_0x3fad9d,_0x1eee52){return client[_0x8bcd('0x1')]('UpdateMailInteraction',{'body':_0x1eee52,'options':{'where':{'id':_0x3fad9d}},'log':_0x8bcd('0x2')});};exports[_0x8bcd('0x3')]=function(_0x5a56d0,_0x1f1738){return client[_0x8bcd('0x1')](_0x8bcd('0x4'),{'body':_0x1f1738,'options':{'where':{'id':_0x5a56d0}},'log':_0x8bcd('0x5')});}; \ No newline at end of file +var _0xf65b=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction'];(function(_0x4d5b68,_0xd75824){var _0x128e97=function(_0x546115){while(--_0x546115){_0x4d5b68['push'](_0x4d5b68['shift']());}};_0x128e97(++_0xd75824);}(_0xf65b,0x15a));var _0xbf65=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf65b[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xbf65('0x0')]=function(_0x2d56ba,_0x30902a){return client['Request'](_0xbf65('0x1'),{'body':_0x30902a,'options':{'where':{'id':_0x2d56ba}},'log':_0xbf65('0x2')});};exports[_0xbf65('0x3')]=function(_0x349068,_0x960c90){return client['Request'](_0xbf65('0x4'),{'body':_0x960c90,'options':{'where':{'id':_0x349068}},'log':_0xbf65('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 316032a..f357cbc 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 _0x9fe4=['../client','create','Request','createMailMessage'];(function(_0x91709,_0x536a5c){var _0x29157c=function(_0x261552){while(--_0x261552){_0x91709['push'](_0x91709['shift']());}};_0x29157c(++_0x536a5c);}(_0x9fe4,0x17c));var _0x49fe=function(_0x408f5c,_0x1136c7){_0x408f5c=_0x408f5c-0x0;var _0x4bab6f=_0x9fe4[_0x408f5c];return _0x4bab6f;};'use strict';var client=require(_0x49fe('0x0'));exports[_0x49fe('0x1')]=function(_0x5f0af6){return client[_0x49fe('0x2')]('CreateMailMessage',{'body':_0x5f0af6,'log':_0x49fe('0x3')});}; \ No newline at end of file +var _0xe10b=['create','Request','CreateMailMessage','../client'];(function(_0x43ca8b,_0x40fb2f){var _0x227779=function(_0x2a0410){while(--_0x2a0410){_0x43ca8b['push'](_0x43ca8b['shift']());}};_0x227779(++_0x40fb2f);}(_0xe10b,0x6b));var _0xbe10=function(_0x32c915,_0x49ff1b){_0x32c915=_0x32c915-0x0;var _0x44cc53=_0xe10b[_0x32c915];return _0x44cc53;};'use strict';var client=require(_0xbe10('0x0'));exports[_0xbe10('0x1')]=function(_0x49e28a){return client[_0xbe10('0x2')](_0xbe10('0x3'),{'body':_0x49e28a,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index e20c513..c348d50 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 _0xc212=['online','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x4d7777,_0x2ab8cf){var _0x431a5c=function(_0x433109){while(--_0x433109){_0x4d7777['push'](_0x4d7777['shift']());}};_0x431a5c(++_0x2ab8cf);}(_0xc212,0x1e8));var _0x2c21=function(_0x1b7e9c,_0xb9f770){_0x1b7e9c=_0x1b7e9c-0x0;var _0x6be060=_0xc212[_0x1b7e9c];return _0x6be060;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x2c21('0x0')](_0x2c21('0x1'),{'options':{'raw':![],'attributes':['id',_0x2c21('0x2'),_0x2c21('0x3'),_0x2c21('0x4')],'include':[{'model':_0x2c21('0x5'),'as':_0x2c21('0x6'),'attributes':['id',_0x2c21('0x2'),_0x2c21('0x7'),'mailPause']}]},'log':_0x2c21('0x8')});};}; \ No newline at end of file +var _0x332f=['name','mailPause','../client','getMailQueues','Request','strategy'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x332f,0x10a));var _0xf332=function(_0x1e299a,_0x1a177b){_0x1e299a=_0x1e299a-0x0;var _0x1f4a6a=_0x332f[_0x1e299a];return _0x1f4a6a;};'use strict';var client=require(_0xf332('0x0'));exports[_0xf332('0x1')]=function(){return function(){return client[_0xf332('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xf332('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xf332('0x4'),'online',_0xf332('0x5')]}]},'log':_0xf332('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 82b3028..9aafa56 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 _0x2bf1=['../client','create','Request','CreateMailQueueReport','update','DESC','UpdateMailQueueReport'];(function(_0x10653c,_0xb6c8ed){var _0xacc32=function(_0x24bf8a){while(--_0x24bf8a){_0x10653c['push'](_0x10653c['shift']());}};_0xacc32(++_0xb6c8ed);}(_0x2bf1,0x11f));var _0x12bf=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x2bf1[_0x55e08b];return _0xd1a7ff;};'use strict';var client=require(_0x12bf('0x0'));exports[_0x12bf('0x1')]=function(_0xd8a041){return client[_0x12bf('0x2')]('CreateMailQueueReport',{'body':_0xd8a041,'log':_0x12bf('0x3')});};exports[_0x12bf('0x4')]=function(_0x3c34ba,_0x158b89){return client[_0x12bf('0x2')]('UpdateMailQueueReport',{'body':_0x158b89,'options':{'where':{'uniqueid':_0x3c34ba},'order':[['id',_0x12bf('0x5')]],'limit':0x1},'log':_0x12bf('0x6')});}; \ No newline at end of file +var _0x4ce7=['../client','create','Request','UpdateMailQueueReport'];(function(_0x2a9b6c,_0x2b8227){var _0x1cfc26=function(_0x556bda){while(--_0x556bda){_0x2a9b6c['push'](_0x2a9b6c['shift']());}};_0x1cfc26(++_0x2b8227);}(_0x4ce7,0x1e0));var _0x74ce=function(_0x13a5a1,_0x442241){_0x13a5a1=_0x13a5a1-0x0;var _0x75abc8=_0x4ce7[_0x13a5a1];return _0x75abc8;};'use strict';var client=require(_0x74ce('0x0'));exports[_0x74ce('0x1')]=function(_0x57a6d3){return client[_0x74ce('0x2')]('CreateMailQueueReport',{'body':_0x57a6d3,'log':'CreateMailQueueReport'});};exports['update']=function(_0x4b9bd8,_0x92e0fe){return client[_0x74ce('0x2')](_0x74ce('0x3'),{'body':_0x92e0fe,'options':{'where':{'uniqueid':_0x4b9bd8},'order':[['id','DESC']],'limit':0x1},'log':_0x74ce('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c5cd707..b6a3462 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 _0x77a2=['update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x77a2,0x156));var _0x277a=function(_0x1bf59b,_0x243b3e){_0x1bf59b=_0x1bf59b-0x0;var _0x5ccb3d=_0x77a2[_0x1bf59b];return _0x5ccb3d;};'use strict';var client=require(_0x277a('0x0'));exports[_0x277a('0x1')]=function(_0x1514d8,_0xabae26){return client[_0x277a('0x2')](_0x277a('0x3'),{'body':_0xabae26,'options':{'where':{'id':_0x1514d8}},'log':'updateOpenchannelInteraction'});};exports[_0x277a('0x4')]=function(_0x25b02f,_0xff71df){return client['Request'](_0x277a('0x5'),{'body':_0xff71df,'options':{'where':{'id':_0x25b02f}},'log':_0x277a('0x6')});}; \ No newline at end of file +var _0x3ae5=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','../client'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ae5,0x1eb));var _0x53ae=function(_0x20fee8,_0x56ec42){_0x20fee8=_0x20fee8-0x0;var _0x23cf13=_0x3ae5[_0x20fee8];return _0x23cf13;};'use strict';var client=require(_0x53ae('0x0'));exports[_0x53ae('0x1')]=function(_0x1b93cb,_0x5f5960){return client['Request'](_0x53ae('0x2'),{'body':_0x5f5960,'options':{'where':{'id':_0x1b93cb}},'log':_0x53ae('0x3')});};exports['addTags']=function(_0x131304,_0x130d5f){return client[_0x53ae('0x4')](_0x53ae('0x5'),{'body':_0x130d5f,'options':{'where':{'id':_0x131304}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e199ed0..b4e78b1 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 _0x9f62=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x511114,_0x4385a8){var _0x1c3bad=function(_0x5269aa){while(--_0x5269aa){_0x511114['push'](_0x511114['shift']());}};_0x1c3bad(++_0x4385a8);}(_0x9f62,0x154));var _0x29f6=function(_0x329786,_0x310cae){_0x329786=_0x329786-0x0;var _0x20a392=_0x9f62[_0x329786];return _0x20a392;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0x4ce7cb,'log':_0x29f6('0x3')});}; \ No newline at end of file +var _0xf109=['../client','create'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xf109,0xce));var _0x9f10=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf109[_0xef8146];return _0x5a6cb0;};'use strict';var client=require(_0x9f10('0x0'));exports[_0x9f10('0x1')]=function(_0x44c4f2){return client['Request']('CreateOpenchannelMessage',{'body':_0x44c4f2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 003a19a..0571c41 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 _0x9fa9=['Request','name','timeout','strategy','User','Agents','online','../client','getOpenchannelQueues'];(function(_0x21aff6,_0x562983){var _0x58036d=function(_0x5739cc){while(--_0x5739cc){_0x21aff6['push'](_0x21aff6['shift']());}};_0x58036d(++_0x562983);}(_0x9fa9,0xdf));var _0x99fa=function(_0x4aa71c,_0x41fd75){_0x4aa71c=_0x4aa71c-0x0;var _0x6afd3a=_0x9fa9[_0x4aa71c];return _0x6afd3a;};'use strict';var client=require(_0x99fa('0x0'));exports[_0x99fa('0x1')]=function(){return function(){return client[_0x99fa('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x99fa('0x3'),_0x99fa('0x4'),_0x99fa('0x5')],'include':[{'model':_0x99fa('0x6'),'as':_0x99fa('0x7'),'attributes':['id','name',_0x99fa('0x8'),'openchannelPause']}]},'log':_0x99fa('0x1')});};}; \ No newline at end of file +var _0xd980=['strategy','User','Agents','online','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0xc2f7f4,_0x2de0fe){var _0x559fe6=function(_0x5c9233){while(--_0x5c9233){_0xc2f7f4['push'](_0xc2f7f4['shift']());}};_0x559fe6(++_0x2de0fe);}(_0xd980,0xdc));var _0x0d98=function(_0x41f884,_0x185b87){_0x41f884=_0x41f884-0x0;var _0x6a81e5=_0xd980[_0x41f884];return _0x6a81e5;};'use strict';var client=require('../client');exports[_0x0d98('0x0')]=function(){return function(){return client[_0x0d98('0x1')](_0x0d98('0x2'),{'options':{'raw':![],'attributes':['id',_0x0d98('0x3'),_0x0d98('0x4'),_0x0d98('0x5')],'include':[{'model':_0x0d98('0x6'),'as':_0x0d98('0x7'),'attributes':['id',_0x0d98('0x3'),_0x0d98('0x8'),'openchannelPause']}]},'log':_0x0d98('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c8d80bd..655c855 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 _0x16c5=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','Request'];(function(_0x187756,_0x1173de){var _0x25afec=function(_0x28033b){while(--_0x28033b){_0x187756['push'](_0x187756['shift']());}};_0x25afec(++_0x1173de);}(_0x16c5,0x1a3));var _0x516c=function(_0x241e3b,_0x232d52){_0x241e3b=_0x241e3b-0x0;var _0x536655=_0x16c5[_0x241e3b];return _0x536655;};'use strict';var client=require('../client');exports['create']=function(_0xe1dd9d){return client[_0x516c('0x0')](_0x516c('0x1'),{'body':_0xe1dd9d,'log':_0x516c('0x1')});};exports['update']=function(_0x3fb5be,_0x3b1042){return client[_0x516c('0x0')](_0x516c('0x2'),{'body':_0x3b1042,'options':{'where':{'uniqueid':_0x3fb5be},'order':[['id',_0x516c('0x3')]],'limit':0x1},'log':_0x516c('0x2')});}; \ No newline at end of file +var _0xd1c7=['UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport'];(function(_0x45d7bf,_0x5745e9){var _0x1b5884=function(_0x3ff744){while(--_0x3ff744){_0x45d7bf['push'](_0x45d7bf['shift']());}};_0x1b5884(++_0x5745e9);}(_0xd1c7,0xc1));var _0x7d1c=function(_0x5a494d,_0x44100b){_0x5a494d=_0x5a494d-0x0;var _0x3c8a70=_0xd1c7[_0x5a494d];return _0x3c8a70;};'use strict';var client=require(_0x7d1c('0x0'));exports['create']=function(_0x50ae64){return client['Request'](_0x7d1c('0x1'),{'body':_0x50ae64,'log':_0x7d1c('0x1')});};exports['update']=function(_0x3963a5,_0x412cb6){return client['Request'](_0x7d1c('0x2'),{'body':_0x412cb6,'options':{'where':{'uniqueid':_0x3963a5},'order':[['id','DESC']],'limit':0x1},'log':_0x7d1c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 0c0647b..bb3a375 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 _0x2dbb=['Request','UpdateSmsInteraction','updateSmsInteraction','../client'];(function(_0x22e133,_0x527287){var _0x3455ca=function(_0x50084b){while(--_0x50084b){_0x22e133['push'](_0x22e133['shift']());}};_0x3455ca(++_0x527287);}(_0x2dbb,0x9b));var _0xb2db=function(_0x437ffb,_0x2a7ea1){_0x437ffb=_0x437ffb-0x0;var _0x4cfe65=_0x2dbb[_0x437ffb];return _0x4cfe65;};'use strict';var client=require(_0xb2db('0x0'));exports['update']=function(_0x4b10f7,_0x4671fc){return client[_0xb2db('0x1')](_0xb2db('0x2'),{'body':_0x4671fc,'options':{'where':{'id':_0x4b10f7}},'log':_0xb2db('0x3')});};exports['addTags']=function(_0x726035,_0xc934ec){return client[_0xb2db('0x1')]('AddTagsToSmsInteraction',{'body':_0xc934ec,'options':{'where':{'id':_0x726035}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x9155=['AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x1d5f5f,_0x52c30c){var _0x5277d0=function(_0x40a0a3){while(--_0x40a0a3){_0x1d5f5f['push'](_0x1d5f5f['shift']());}};_0x5277d0(++_0x52c30c);}(_0x9155,0x1ab));var _0x5915=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0x9155[_0x136a0d];return _0x212ea5;};'use strict';var client=require('../client');exports[_0x5915('0x0')]=function(_0x36cf38,_0x133db5){return client[_0x5915('0x1')](_0x5915('0x2'),{'body':_0x133db5,'options':{'where':{'id':_0x36cf38}},'log':_0x5915('0x3')});};exports[_0x5915('0x4')]=function(_0x1ba2e2,_0x1f47c5){return client['Request'](_0x5915('0x5'),{'body':_0x1f47c5,'options':{'where':{'id':_0x1ba2e2}},'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 fa9bcce..21ede1e 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 _0xcd18=['../client','create','Request','CreateSmsMessage'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0xcd18,0xb4));var _0x8cd1=function(_0x39928b,_0x4959f7){_0x39928b=_0x39928b-0x0;var _0x5dc23d=_0xcd18[_0x39928b];return _0x5dc23d;};'use strict';var client=require(_0x8cd1('0x0'));exports[_0x8cd1('0x1')]=function(_0x59e631){return client[_0x8cd1('0x2')](_0x8cd1('0x3'),{'body':_0x59e631,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x8124=['CreateSmsMessage','../client','create','Request'];(function(_0x3386e0,_0x1158e0){var _0x89b4bd=function(_0x1f2dbd){while(--_0x1f2dbd){_0x3386e0['push'](_0x3386e0['shift']());}};_0x89b4bd(++_0x1158e0);}(_0x8124,0x1b9));var _0x4812=function(_0x11a871,_0x24b28b){_0x11a871=_0x11a871-0x0;var _0x4d5b5c=_0x8124[_0x11a871];return _0x4d5b5c;};'use strict';var client=require(_0x4812('0x0'));exports[_0x4812('0x1')]=function(_0x1ba76b){return client[_0x4812('0x2')](_0x4812('0x3'),{'body':_0x1ba76b,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index fbb9e99..d47483a 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 _0x71fa=['Request','GetSmsQueue','timeout','strategy','User','Agents','smsPause','../client','getSmsQueues'];(function(_0x54dd9e,_0x1bf428){var _0x3db1e1=function(_0x5265df){while(--_0x5265df){_0x54dd9e['push'](_0x54dd9e['shift']());}};_0x3db1e1(++_0x1bf428);}(_0x71fa,0x166));var _0xa71f=function(_0xa2ca3c,_0x23f382){_0xa2ca3c=_0xa2ca3c-0x0;var _0xdcaa1=_0x71fa[_0xa2ca3c];return _0xdcaa1;};'use strict';var client=require(_0xa71f('0x0'));exports[_0xa71f('0x1')]=function(){return function(){return client[_0xa71f('0x2')](_0xa71f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xa71f('0x4'),_0xa71f('0x5')],'include':[{'model':_0xa71f('0x6'),'as':_0xa71f('0x7'),'attributes':['id','name','online',_0xa71f('0x8')]}]},'log':_0xa71f('0x1')});};}; \ No newline at end of file +var _0xda5b=['../client','getSmsQueues','GetSmsQueue','name','strategy','Agents','online','smsPause'];(function(_0x6eff5b,_0x3976fa){var _0x40af9f=function(_0x43f5d9){while(--_0x43f5d9){_0x6eff5b['push'](_0x6eff5b['shift']());}};_0x40af9f(++_0x3976fa);}(_0xda5b,0xc8));var _0xbda5=function(_0x4e9adc,_0x24386d){_0x4e9adc=_0x4e9adc-0x0;var _0x4dd205=_0xda5b[_0x4e9adc];return _0x4dd205;};'use strict';var client=require(_0xbda5('0x0'));exports[_0xbda5('0x1')]=function(){return function(){return client['Request'](_0xbda5('0x2'),{'options':{'raw':![],'attributes':['id',_0xbda5('0x3'),'timeout',_0xbda5('0x4')],'include':[{'model':'User','as':_0xbda5('0x5'),'attributes':['id',_0xbda5('0x3'),_0xbda5('0x6'),_0xbda5('0x7')]}]},'log':_0xbda5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 6723919..87c58bc 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 _0xac80=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x4caee7,_0x3bdb3c){var _0x549d2b=function(_0x2835ff){while(--_0x2835ff){_0x4caee7['push'](_0x4caee7['shift']());}};_0x549d2b(++_0x3bdb3c);}(_0xac80,0x163));var _0x0ac8=function(_0x4d3dae,_0x464ef3){_0x4d3dae=_0x4d3dae-0x0;var _0x5da56b=_0xac80[_0x4d3dae];return _0x5da56b;};'use strict';var client=require(_0x0ac8('0x0'));exports[_0x0ac8('0x1')]=function(_0x109463){return client[_0x0ac8('0x2')](_0x0ac8('0x3'),{'body':_0x109463,'log':_0x0ac8('0x3')});};exports[_0x0ac8('0x4')]=function(_0x591c5f,_0x3f76e4){return client[_0x0ac8('0x2')](_0x0ac8('0x5'),{'body':_0x3f76e4,'options':{'where':{'uniqueid':_0x591c5f},'order':[['id',_0x0ac8('0x6')]],'limit':0x1},'log':_0x0ac8('0x5')});}; \ No newline at end of file +var _0x0344=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x5bfd98,_0x5d896b){var _0x155bbc=function(_0x3cd534){while(--_0x3cd534){_0x5bfd98['push'](_0x5bfd98['shift']());}};_0x155bbc(++_0x5d896b);}(_0x0344,0x14b));var _0x4034=function(_0x26b2a8,_0x564c42){_0x26b2a8=_0x26b2a8-0x0;var _0x46c36a=_0x0344[_0x26b2a8];return _0x46c36a;};'use strict';var client=require(_0x4034('0x0'));exports[_0x4034('0x1')]=function(_0x4d41c5){return client[_0x4034('0x2')](_0x4034('0x3'),{'body':_0x4d41c5,'log':_0x4034('0x3')});};exports[_0x4034('0x4')]=function(_0x5456c6,_0x23760f){return client['Request'](_0x4034('0x5'),{'body':_0x23760f,'options':{'where':{'uniqueid':_0x5456c6},'order':[['id',_0x4034('0x6')]],'limit':0x1},'log':_0x4034('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4e1c1b6..c2cdd42 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 _0x5efe=['chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','openchannelPause'];(function(_0x59dc07,_0x13221a){var _0x14e62b=function(_0x4a79cc){while(--_0x4a79cc){_0x59dc07['push'](_0x59dc07['shift']());}};_0x14e62b(++_0x13221a);}(_0x5efe,0xc4));var _0xe5ef=function(_0x46913e,_0x5c0d8c){_0x46913e=_0x46913e-0x0;var _0x298564=_0x5efe[_0x46913e];return _0x298564;};'use strict';var client=require(_0xe5ef('0x0'));exports['getAgents']=function(){return function(){return client[_0xe5ef('0x1')](_0xe5ef('0x2'),{'options':{'raw':!![],'where':{'role':_0xe5ef('0x3')},'attributes':['id',_0xe5ef('0x4'),_0xe5ef('0x5'),_0xe5ef('0x6'),_0xe5ef('0x7'),'voicePause',_0xe5ef('0x8'),_0xe5ef('0x9'),_0xe5ef('0xa'),_0xe5ef('0xb'),'whatsappPause',_0xe5ef('0xc'),_0xe5ef('0xd'),'mailCapacity',_0xe5ef('0xe'),_0xe5ef('0xf'),_0xe5ef('0x10'),_0xe5ef('0x11')]},'log':_0xe5ef('0x12')});};}; \ No newline at end of file +var _0x47fa=['mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','whatsappCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x43d701,_0x4bb2e9){var _0x2ec4c6=function(_0x4d9765){while(--_0x4d9765){_0x43d701['push'](_0x43d701['shift']());}};_0x2ec4c6(++_0x4bb2e9);}(_0x47fa,0x1b0));var _0xa47f=function(_0x232e7a,_0x19997){_0x232e7a=_0x232e7a-0x0;var _0x445ddd=_0x47fa[_0x232e7a];return _0x445ddd;};'use strict';var client=require(_0xa47f('0x0'));exports[_0xa47f('0x1')]=function(){return function(){return client[_0xa47f('0x2')](_0xa47f('0x3'),{'options':{'raw':!![],'where':{'role':_0xa47f('0x4')},'attributes':['id',_0xa47f('0x5'),'online',_0xa47f('0x6'),_0xa47f('0x7'),_0xa47f('0x8'),_0xa47f('0x9'),_0xa47f('0xa'),'faxPause',_0xa47f('0xb'),_0xa47f('0xc'),_0xa47f('0xd'),_0xa47f('0xe'),_0xa47f('0xf'),'faxCapacity','smsCapacity',_0xa47f('0x10'),'openchannelCapacity']},'log':_0xa47f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 62ac76b..d11594e 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 _0x3164=['addTagsToWhatsappInteraction','../client','update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x51f524,_0x7996b){var _0x2f1ad9=function(_0x3951b8){while(--_0x3951b8){_0x51f524['push'](_0x51f524['shift']());}};_0x2f1ad9(++_0x7996b);}(_0x3164,0x182));var _0x4316=function(_0x3a4e77,_0x3349ba){_0x3a4e77=_0x3a4e77-0x0;var _0x35a151=_0x3164[_0x3a4e77];return _0x35a151;};'use strict';var client=require(_0x4316('0x0'));exports[_0x4316('0x1')]=function(_0x33848d,_0x1738ab){return client[_0x4316('0x2')]('UpdateWhatsappInteraction',{'body':_0x1738ab,'options':{'where':{'id':_0x33848d}},'log':_0x4316('0x3')});};exports[_0x4316('0x4')]=function(_0x1235d9,_0x56124c){return client['Request'](_0x4316('0x5'),{'body':_0x56124c,'options':{'where':{'id':_0x1235d9}},'log':_0x4316('0x6')});}; \ No newline at end of file +var _0x3351=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x3351,0x1b4));var _0x1335=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x3351[_0x363ef8];return _0x148822;};'use strict';var client=require(_0x1335('0x0'));exports['update']=function(_0x5a075d,_0x2bf4df){return client[_0x1335('0x1')](_0x1335('0x2'),{'body':_0x2bf4df,'options':{'where':{'id':_0x5a075d}},'log':_0x1335('0x3')});};exports[_0x1335('0x4')]=function(_0x173f26,_0x1f635d){return client['Request'](_0x1335('0x5'),{'body':_0x1f635d,'options':{'where':{'id':_0x173f26}},'log':_0x1335('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 4795313..bfbbd67 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 _0x2ae8=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x4a6102,_0xedf422){var _0x416650=function(_0x4be9ec){while(--_0x4be9ec){_0x4a6102['push'](_0x4a6102['shift']());}};_0x416650(++_0xedf422);}(_0x2ae8,0xd2));var _0x82ae=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x2ae8[_0x46698a];return _0x356db0;};'use strict';var client=require(_0x82ae('0x0'));exports['create']=function(_0x290543){return client['Request'](_0x82ae('0x1'),{'body':_0x290543,'log':_0x82ae('0x2')});}; \ No newline at end of file +var _0x4df7=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x3718ef,_0x1256af){var _0x11d974=function(_0x4bac0d){while(--_0x4bac0d){_0x3718ef['push'](_0x3718ef['shift']());}};_0x11d974(++_0x1256af);}(_0x4df7,0x145));var _0x74df=function(_0x554d9b,_0x2ff157){_0x554d9b=_0x554d9b-0x0;var _0x24c6dd=_0x4df7[_0x554d9b];return _0x24c6dd;};'use strict';var client=require(_0x74df('0x0'));exports[_0x74df('0x1')]=function(_0x4bc509){return client['Request'](_0x74df('0x2'),{'body':_0x4bc509,'log':_0x74df('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 732f2e5..4366263 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 _0x750a=['getWhatsappQueues','name','timeout','strategy','User','Agents','online','whatsappPause'];(function(_0x4bff6b,_0x6a9c22){var _0x401b04=function(_0x4e449c){while(--_0x4e449c){_0x4bff6b['push'](_0x4bff6b['shift']());}};_0x401b04(++_0x6a9c22);}(_0x750a,0x140));var _0xa750=function(_0x935fc8,_0x2e6376){_0x935fc8=_0x935fc8-0x0;var _0x2bd2e4=_0x750a[_0x935fc8];return _0x2bd2e4;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2'),_0xa750('0x3')],'include':[{'model':_0xa750('0x4'),'as':_0xa750('0x5'),'attributes':['id',_0xa750('0x1'),_0xa750('0x6'),_0xa750('0x7')]}]},'log':_0xa750('0x0')});};}; \ No newline at end of file +var _0xdc9b=['../client','getWhatsappQueues','Request','name','timeout','Agents','whatsappPause'];(function(_0x4270de,_0x1ebcc6){var _0x5043c2=function(_0x50f2e2){while(--_0x50f2e2){_0x4270de['push'](_0x4270de['shift']());}};_0x5043c2(++_0x1ebcc6);}(_0xdc9b,0x70));var _0xbdc9=function(_0x2d9b66,_0x538fb5){_0x2d9b66=_0x2d9b66-0x0;var _0x1c0edf=_0xdc9b[_0x2d9b66];return _0x1c0edf;};'use strict';var client=require(_0xbdc9('0x0'));exports[_0xbdc9('0x1')]=function(){return function(){return client[_0xbdc9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbdc9('0x3'),_0xbdc9('0x4'),'strategy'],'include':[{'model':'User','as':_0xbdc9('0x5'),'attributes':['id',_0xbdc9('0x3'),'online',_0xbdc9('0x6')]}]},'log':_0xbdc9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 06999dc..3d9ad58 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 _0x2133=['update','UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0x2133,0x10b));var _0x3213=function(_0x398b70,_0x4d8932){_0x398b70=_0x398b70-0x0;var _0x5cc113=_0x2133[_0x398b70];return _0x5cc113;};'use strict';var client=require(_0x3213('0x0'));exports['create']=function(_0x6905c0){return client[_0x3213('0x1')](_0x3213('0x2'),{'body':_0x6905c0,'log':_0x3213('0x2')});};exports[_0x3213('0x3')]=function(_0x157d94,_0x2066f0){return client['Request'](_0x3213('0x4'),{'body':_0x2066f0,'options':{'where':{'uniqueid':_0x157d94},'order':[['id',_0x3213('0x5')]],'limit':0x1},'log':_0x3213('0x4')});}; \ No newline at end of file +var _0x8fa7=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x33e7ee,_0x4c1ae5){var _0x1a1058=function(_0x58118e){while(--_0x58118e){_0x33e7ee['push'](_0x33e7ee['shift']());}};_0x1a1058(++_0x4c1ae5);}(_0x8fa7,0x163));var _0x78fa=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x8fa7[_0x33032e];return _0x13316b;};'use strict';var client=require(_0x78fa('0x0'));exports[_0x78fa('0x1')]=function(_0x110811){return client['Request'](_0x78fa('0x2'),{'body':_0x110811,'log':_0x78fa('0x2')});};exports[_0x78fa('0x3')]=function(_0x33e44e,_0x4012dc){return client[_0x78fa('0x4')](_0x78fa('0x5'),{'body':_0x4012dc,'options':{'where':{'uniqueid':_0x33e44e},'order':[['id',_0x78fa('0x6')]],'limit':0x1},'log':_0x78fa('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 f400679..f535b01 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 _0xa520=['number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','[%s][AGENT]\x20%s','map','message','stop','find','timeout','atimeout','channel','START:%s','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string'];(function(_0x1bd655,_0x568614){var _0x4040e4=function(_0x2c6944){while(--_0x2c6944){_0x1bd655['push'](_0x1bd655['shift']());}};_0x4040e4(++_0x568614);}(_0xa520,0xf5));var _0x0a52=function(_0x384055,_0x14ac05){_0x384055=_0x384055-0x0;var _0x10f5f0=_0xa520[_0x384055];return _0x10f5f0;};'use strict';var schema=require('validate');var _=require(_0x0a52('0x0'));var util=require(_0x0a52('0x1'));var seqqueue=require(_0x0a52('0x2'));var logger=require(_0x0a52('0x3'))(_0x0a52('0x4'));var strategy=require(_0x0a52('0x5'));var queue=schema({'name':{'type':_0x0a52('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0a52('0x7'),'message':_0x0a52('0x8')}});function writeLog(_0x5549e3,_0x1e19af,_0x3aebc0){return logger['info'](util[_0x0a52('0x9')](_0x0a52('0xa'),_0x5549e3,_0x1e19af[_0x0a52('0xb')],_0x3aebc0));}function handleFindAgent(_0x2de45e){return function(_0x3ef161){return _0x3ef161[_0x0a52('0xb')][_0x0a52('0xc')]()===_0x2de45e[_0x0a52('0xc')]();};}exports[_0x0a52('0xd')]=function(_0x35421b,_0x3e9664,_0x59a22f,_0x13155c){return function(_0x1c337d){try{var _0x530cb1={'name':_0x3e9664[0x0],'timeout':_0x3e9664[0x1]};var _0x243161=queue[_0x0a52('0xe')](_0x530cb1,{'typecast':!![]});if(_0x243161[_0x0a52('0xf')]){logger['error'](_0x0a52('0x10'),_0x35421b,_[_0x0a52('0x11')](_0x243161,_0x0a52('0x12'))['join'](',\x20'));_0x1c337d[_0x0a52('0x13')]();}else{var _0x45c5f4=_[_0x0a52('0x14')](_0x59a22f['agents'],handleFindAgent(_0x530cb1[_0x0a52('0xb')]));if(_0x45c5f4){var _0x3ab839=(_0x530cb1[_0x0a52('0x15')]||0xa)*0x3e8;var _0x24cf5f,_0x2a3140;var _0x3e2d0b=seqqueue['createQueue'](_0x3ab839);_0x3e2d0b['id']=_0x35421b;_0x3e2d0b[_0x0a52('0x16')]=_0x3ab839;_0x3e2d0b[_0x0a52('0x17')]=_0x13155c['channel'];writeLog(_0x35421b,_0x45c5f4,util[_0x0a52('0x9')](_0x0a52('0x18'),_0x3ab839));_0x59a22f[_0x0a52('0x19')][_0x35421b]['on']('end',function(){logger[_0x0a52('0x1a')](_0x0a52('0x1b'),_0x35421b);clearTimeout(_0x2a3140);_0x2a3140=undefined;_0x3e2d0b['close']();if(_0x59a22f[_0x0a52('0x19')][_0x35421b]){delete _0x59a22f[_0x0a52('0x19')][_0x35421b];}_0x1c337d[_0x0a52('0x13')]();});_0x59a22f[_0x0a52('0x19')][_0x35421b]['on'](_0x0a52('0x1c'),function(){if(_0x59a22f[_0x0a52('0x19')][_0x35421b]){delete _0x59a22f[_0x0a52('0x19')][_0x35421b];}});_0x2a3140=setTimeout(function(){logger['info'](_0x0a52('0x1d'),_0x35421b);clearTimeout(_0x2a3140);_0x3e2d0b['close']();_0x1c337d[_0x0a52('0x1e')]();},_0x3ab839);strategy[_0x0a52('0x1f')](_0x3e2d0b,_0x45c5f4,_0x59a22f,_0x13155c);}else{logger[_0x0a52('0x20')](_0x0a52('0x21'),_0x35421b,_0x530cb1[_0x0a52('0xb')]);_0x1c337d[_0x0a52('0x13')]();}}}catch(_0x11f5c0){console[_0x0a52('0x22')](_0x11f5c0);logger['error'](_0x0a52('0x23'),_0x35421b,_0x11f5c0['stack']);_0x1c337d[_0x0a52('0x13')]();}};}; \ No newline at end of file +var _0xee89=['complete','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','timeout','atimeout','channel','format','START:%s','end','close','rules'];(function(_0x5778db,_0x360ebe){var _0x22079d=function(_0x30041c){while(--_0x30041c){_0x5778db['push'](_0x5778db['shift']());}};_0x22079d(++_0x360ebe);}(_0xee89,0x14b));var _0x9ee8=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xee89[_0x37bd26];return _0xe83dc4;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x9ee8('0x0'));var seqqueue=require('seq-queue');var logger=require(_0x9ee8('0x1'))(_0x9ee8('0x2'));var strategy=require(_0x9ee8('0x3'));var queue=schema({'name':{'type':_0x9ee8('0x4'),'required':!![],'message':_0x9ee8('0x5')},'timeout':{'type':_0x9ee8('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1e42fb,_0x571971,_0x53d712){return logger[_0x9ee8('0x7')](util['format'](_0x9ee8('0x8'),_0x1e42fb,_0x571971[_0x9ee8('0x9')],_0x53d712));}function handleFindAgent(_0x3d3455){return function(_0xa76ae2){return _0xa76ae2[_0x9ee8('0x9')][_0x9ee8('0xa')]()===_0x3d3455['toLowerCase']();};}exports[_0x9ee8('0xb')]=function(_0x581c38,_0x2d61b5,_0x2b74ec,_0x4d9d91){return function(_0x438230){try{var _0x7c466b={'name':_0x2d61b5[0x0],'timeout':_0x2d61b5[0x1]};var _0x15339c=queue[_0x9ee8('0xc')](_0x7c466b,{'typecast':!![]});if(_0x15339c[_0x9ee8('0xd')]){logger[_0x9ee8('0xe')](_0x9ee8('0xf'),_0x581c38,_['map'](_0x15339c,_0x9ee8('0x10'))[_0x9ee8('0x11')](',\x20'));_0x438230[_0x9ee8('0x12')]();}else{var _0x967af6=_[_0x9ee8('0x13')](_0x2b74ec[_0x9ee8('0x14')],handleFindAgent(_0x7c466b[_0x9ee8('0x9')]));if(_0x967af6){var _0x143358=(_0x7c466b[_0x9ee8('0x15')]||0xa)*0x3e8;var _0x29ea40,_0x12e9a2;var _0x56e4b9=seqqueue['createQueue'](_0x143358);_0x56e4b9['id']=_0x581c38;_0x56e4b9[_0x9ee8('0x16')]=_0x143358;_0x56e4b9['channel']=_0x4d9d91[_0x9ee8('0x17')];writeLog(_0x581c38,_0x967af6,util[_0x9ee8('0x18')](_0x9ee8('0x19'),_0x143358));_0x2b74ec['rules'][_0x581c38]['on'](_0x9ee8('0x1a'),function(){logger[_0x9ee8('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x581c38);clearTimeout(_0x12e9a2);_0x12e9a2=undefined;_0x56e4b9[_0x9ee8('0x1b')]();if(_0x2b74ec[_0x9ee8('0x1c')][_0x581c38]){delete _0x2b74ec[_0x9ee8('0x1c')][_0x581c38];}_0x438230['stop']();});_0x2b74ec['rules'][_0x581c38]['on'](_0x9ee8('0x1d'),function(){if(_0x2b74ec[_0x9ee8('0x1c')][_0x581c38]){delete _0x2b74ec[_0x9ee8('0x1c')][_0x581c38];}});_0x12e9a2=setTimeout(function(){logger[_0x9ee8('0x7')](_0x9ee8('0x1e'),_0x581c38);clearTimeout(_0x12e9a2);_0x56e4b9[_0x9ee8('0x1b')]();_0x438230[_0x9ee8('0x1f')]();},_0x143358);strategy['agent'](_0x56e4b9,_0x967af6,_0x2b74ec,_0x4d9d91);}else{logger[_0x9ee8('0xe')](_0x9ee8('0x20'),_0x581c38,_0x7c466b['name']);_0x438230[_0x9ee8('0x12')]();}}}catch(_0x3c645a){console[_0x9ee8('0x21')](_0x3c645a);logger[_0x9ee8('0xe')](_0x9ee8('0x22'),_0x581c38,_0x3c645a[_0x9ee8('0x23')]);_0x438230[_0x9ee8('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 6761f12..6d9bf9b 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 _0xda19=['../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','error','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','dialogState','Failed','stringify','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x358300,_0x2aef2d){var _0x53833b=function(_0x4e499b){while(--_0x4e499b){_0x358300['push'](_0x358300['shift']());}};_0x53833b(++_0x2aef2d);}(_0xda19,0xd5));var _0x9da1=function(_0x2dedef,_0x32f281){_0x2dedef=_0x2dedef-0x0;var _0x29e43b=_0xda19[_0x2dedef];return _0x29e43b;};'use strict';var _=require('lodash');var moment=require(_0x9da1('0x0'));var AWS=require(_0x9da1('0x1'));var utils=require('./utils');var logger=require(_0x9da1('0x2'))('routing');var rpc={'chatMessage':require(_0x9da1('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9da1('0x4')),'smsMessage':require(_0x9da1('0x5')),'faxMessage':require(_0x9da1('0x6')),'whatsappMessage':require(_0x9da1('0x7'))};exports[_0x9da1('0x8')]=function(_0x2dcbc6,_0x23e4f7){return function(_0x2c3cdd){try{if(!_[_0x9da1('0x9')](this[_0x9da1('0xa')]['UserId'])){logger['info']('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x9da1('0xb'));return _0x2c3cdd['next']();}var _0x33cfe5={'ContactId':this[_0x9da1('0xc')]['id'],'sentAt':moment()[_0x9da1('0xd')](_0x9da1('0xe')),'direction':_0x9da1('0xf')};var _0x396e23=this[_0x9da1('0x10')];if(_0x396e23==='chat'){_0x33cfe5['ChatWebsiteId']=this[_0x9da1('0x11')]['id'];}else{_0x33cfe5[_['upperFirst'](_0x396e23)+_0x9da1('0x12')]=this[_0x9da1('0x11')]['id'];}_0x33cfe5[_[_0x9da1('0x13')](_0x396e23)+_0x9da1('0x14')]=this['interaction']['id'];if(this[_0x9da1('0xa')]['created']){var _0x4d17e1=_0x23e4f7[0x4];if(!_[_0x9da1('0x15')](_0x4d17e1)){_0x33cfe5['body']=utils[_0x9da1('0x16')](_0x4d17e1,this);return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)[_0x9da1('0x19')](function(_0x7f1a64){logger['info'](_0x9da1('0x1a'),_0x2dcbc6,_0x33cfe5[_0x9da1('0x1b')]);})[_0x9da1('0x1c')](function(_0x77347a){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x77347a));})['finally'](function(){logger[_0x9da1('0x1e')](_0x9da1('0x1f'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();});}else{logger[_0x9da1('0x1e')](_0x9da1('0x21'),_0x2dcbc6);_0x2c3cdd[_0x9da1('0x20')]();}}else{var _0xe56279=this;var _0x47e5cf=new AWS[(_0x9da1('0x22'))]({'accessKeyId':_0x23e4f7[0x0],'secretAccessKey':_0x23e4f7[0x1],'region':_0x23e4f7[0x2]});var _0x554845={'botAlias':_0x9da1('0x23'),'botName':_0x23e4f7[0x3],'inputText':this[_0x9da1('0x24')][_0x9da1('0x1b')],'userId':this['channel']+':'+this['interaction']['id'][_0x9da1('0x25')]()};_0x47e5cf[_0x9da1('0x26')](_0x554845,function(_0x16ee0c,_0x330219){if(_0x16ee0c){logger[_0x9da1('0x1d')](_0x9da1('0x1a'),_0x2dcbc6,_0x16ee0c['message']);_0x2c3cdd[_0x9da1('0x27')]();}else if(_0x330219&&_0x330219[_0x9da1('0x24')]){_0xe56279['body'][_0x9da1('0x28')]=_0x330219;_0x33cfe5[_0x9da1('0x1b')]=_0x330219['message'];return rpc[_0x396e23+_0x9da1('0x17')][_0x9da1('0x18')](_0x33cfe5)['then'](function(_0x36b87a){logger[_0x9da1('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x2dcbc6,_0x33cfe5['body']);if(_0x330219[_0x9da1('0x29')]==_0x9da1('0x2a')){_0x2c3cdd['next']();}else{_0x2c3cdd[_0x9da1('0x20')]();}})['catch'](function(_0x5a6f2d){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON[_0x9da1('0x2b')](_0x5a6f2d));_0x2c3cdd[_0x9da1('0x27')]();});}else{_0x2c3cdd[_0x9da1('0x27')]();}});}}catch(_0x140c6c){logger['error'](_0x9da1('0x1a'),_0x2dcbc6,JSON['stringify'](_0x140c6c));_0x2c3cdd[_0x9da1('0x20')]();}};}; \ No newline at end of file +var _0x5fab=['message','toString','postText','next','amazonlex','Message','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','body','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x21be0e,_0xc791d){var _0x4f4456=function(_0x367432){while(--_0x367432){_0x21be0e['push'](_0x21be0e['shift']());}};_0x4f4456(++_0xc791d);}(_0x5fab,0x177));var _0xb5fa=function(_0x53ec91,_0x7eb7bb){_0x53ec91=_0x53ec91-0x0;var _0x36d102=_0x5fab[_0x53ec91];return _0x36d102;};'use strict';var _=require(_0xb5fa('0x0'));var moment=require(_0xb5fa('0x1'));var AWS=require('aws-sdk');var utils=require(_0xb5fa('0x2'));var logger=require(_0xb5fa('0x3'))(_0xb5fa('0x4'));var rpc={'chatMessage':require(_0xb5fa('0x5')),'openchannelMessage':require(_0xb5fa('0x6')),'mailMessage':require(_0xb5fa('0x7')),'smsMessage':require(_0xb5fa('0x8')),'faxMessage':require(_0xb5fa('0x9')),'whatsappMessage':require(_0xb5fa('0xa'))};exports[_0xb5fa('0xb')]=function(_0x4a0249,_0x5d70f6){return function(_0x2e3804){try{if(!_[_0xb5fa('0xc')](this[_0xb5fa('0xd')]['UserId'])){logger[_0xb5fa('0xe')](_0xb5fa('0xf'),_0x4a0249,_0xb5fa('0x10'));return _0x2e3804['next']();}var _0x5b5ea8={'ContactId':this[_0xb5fa('0x11')]['id'],'sentAt':moment()[_0xb5fa('0x12')](_0xb5fa('0x13')),'direction':_0xb5fa('0x14')};var _0x35ad13=this[_0xb5fa('0x15')];if(_0x35ad13===_0xb5fa('0x16')){_0x5b5ea8[_0xb5fa('0x17')]=this[_0xb5fa('0x18')]['id'];}else{_0x5b5ea8[_['upperFirst'](_0x35ad13)+_0xb5fa('0x19')]=this[_0xb5fa('0x18')]['id'];}_0x5b5ea8[_['upperFirst'](_0x35ad13)+_0xb5fa('0x1a')]=this['interaction']['id'];if(this[_0xb5fa('0xd')][_0xb5fa('0x1b')]){var _0x40c914=_0x5d70f6[0x4];if(!_[_0xb5fa('0x1c')](_0x40c914)){_0x5b5ea8[_0xb5fa('0x1d')]=utils['getMustacheRender'](_0x40c914,this);return rpc[_0x35ad13+'Message'][_0xb5fa('0x1e')](_0x5b5ea8)[_0xb5fa('0x1f')](function(_0x31f252){logger[_0xb5fa('0xe')]('[%s][AMAZONLEX]\x20%s',_0x4a0249,_0x5b5ea8['body']);})[_0xb5fa('0x20')](function(_0x1f7f05){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x1f7f05));})[_0xb5fa('0x23')](function(){logger[_0xb5fa('0xe')](_0xb5fa('0x24'),_0x4a0249);_0x2e3804[_0xb5fa('0x25')]();});}else{logger[_0xb5fa('0xe')](_0xb5fa('0x26'),_0x4a0249);_0x2e3804[_0xb5fa('0x25')]();}}else{var _0x5cd822=this;var _0x432bfa=new AWS['LexRuntime']({'accessKeyId':_0x5d70f6[0x0],'secretAccessKey':_0x5d70f6[0x1],'region':_0x5d70f6[0x2]});var _0x37ae06={'botAlias':'$LATEST','botName':_0x5d70f6[0x3],'inputText':this[_0xb5fa('0x27')][_0xb5fa('0x1d')],'userId':this['channel']+':'+this[_0xb5fa('0xd')]['id'][_0xb5fa('0x28')]()};_0x432bfa[_0xb5fa('0x29')](_0x37ae06,function(_0x47f71a,_0x32a85c){if(_0x47f71a){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,_0x47f71a['message']);_0x2e3804[_0xb5fa('0x2a')]();}else if(_0x32a85c&&_0x32a85c['message']){_0x5cd822[_0xb5fa('0x1d')][_0xb5fa('0x2b')]=_0x32a85c;_0x5b5ea8[_0xb5fa('0x1d')]=_0x32a85c[_0xb5fa('0x27')];return rpc[_0x35ad13+_0xb5fa('0x2c')][_0xb5fa('0x1e')](_0x5b5ea8)[_0xb5fa('0x1f')](function(_0x20d649){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4a0249,_0x5b5ea8['body']);if(_0x32a85c['dialogState']==_0xb5fa('0x2d')){_0x2e3804[_0xb5fa('0x2a')]();}else{_0x2e3804[_0xb5fa('0x25')]();}})[_0xb5fa('0x20')](function(_0x534884){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x534884));_0x2e3804[_0xb5fa('0x2a')]();});}else{_0x2e3804[_0xb5fa('0x2a')]();}});}}catch(_0x142bfa){logger[_0xb5fa('0x21')](_0xb5fa('0xf'),_0x4a0249,JSON[_0xb5fa('0x22')](_0x142bfa));_0x2e3804[_0xb5fa('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index eeba4ba..7cd0eca 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 _0xe79a=['','sendMailMessage','then','info','create','catch','error','finally','next','stringify','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','interaction','created','[%s][AUTOREPLY]\x20%s','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','pass','inReplyTo','messageId','html','body',''+_['replace'](_0x117557[_0xae79('0x27')],'','replace','body','','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','error','[%s][AUTOREPLY]\x20%s','stringify','stop','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb680,0x1b1));var _0x0b68=function(_0x3d7de8,_0x2a2ec4){_0x3d7de8=_0x3d7de8-0x0;var _0x5e9a0c=_0xb680[_0x3d7de8];return _0x5e9a0c;};'use strict';var _=require(_0x0b68('0x0'));var moment=require(_0x0b68('0x1'));var utils=require('./utils');var logger=require(_0x0b68('0x2'))(_0x0b68('0x3'));var rpc={'chatMessage':require(_0x0b68('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0b68('0x5')),'smsMessage':require(_0x0b68('0x6')),'faxMessage':require(_0x0b68('0x7')),'whatsappMessage':require(_0x0b68('0x8'))};var mailRpc=require(_0x0b68('0x9'));exports['consequence']=function(_0x984e23,_0x1f3bda){return function(_0x2140c1){try{if(_0x1f3bda[0x0]==='1'&&(_['isNil'](this[_0x0b68('0xa')][_0x0b68('0xb')])||!this['interaction'][_0x0b68('0xb')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x984e23,_0x0b68('0xc'));return _0x2140c1[_0x0b68('0xd')]();}var _0x14e0d8=this[_0x0b68('0xe')];var _0x429066={'body':utils[_0x0b68('0xf')](_0x1f3bda[0x1],this),'ContactId':this[_0x0b68('0x10')]['id'],'sentAt':moment()['format'](_0x0b68('0x11')),'direction':_0x0b68('0x12')};if(this['message']){_0x429066['to']=this['message'][_0x0b68('0x13')]||'';_0x429066['cc']=this[_0x0b68('0x14')]['cc']||'';_0x429066['from']=this[_0x0b68('0x14')]['to']||'';_0x429066[_0x0b68('0x15')]=this['message']['phone']||'';_0x429066[_0x0b68('0x16')]=!![];if(this['message']['subject']){_0x429066[_0x0b68('0x17')]='';_0x429066[_0x0b68('0x17')]+=_['startsWith'](this[_0x0b68('0x14')][_0x0b68('0x17')],_0x0b68('0x18'))?'':'Re:\x20';_0x429066['subject']+=this[_0x0b68('0x14')][_0x0b68('0x17')];}}if(this[_0x0b68('0xe')]===_0x0b68('0x19')){_0x429066[_0x0b68('0x1a')]=this[_0x0b68('0x1b')]['id'];}else{_0x429066[_[_0x0b68('0x1c')](this['channel'])+_0x0b68('0x1d')]=this['account']['id'];}_0x429066[_[_0x0b68('0x1c')](this[_0x0b68('0xe')])+_0x0b68('0x1e')]=this[_0x0b68('0xa')]['id'];if(rpc[this[_0x0b68('0xe')]+_0x0b68('0x1f')]){if(this['channel']===_0x0b68('0x20')){var _0x5be8c4={'tls':{'rejectUnauthorized':![]}};if(this[_0x0b68('0x1b')][_0x0b68('0x21')][_0x0b68('0x22')]){_0x5be8c4[_0x0b68('0x22')]=this[_0x0b68('0x1b')]['Smtp'][_0x0b68('0x22')];}else{_0x5be8c4[_0x0b68('0x23')]=this[_0x0b68('0x1b')]['Smtp'][_0x0b68('0x23')];_0x5be8c4[_0x0b68('0x24')]=this[_0x0b68('0x1b')][_0x0b68('0x21')][_0x0b68('0x24')];_0x5be8c4[_0x0b68('0x25')]=this['account'][_0x0b68('0x21')]['secure'];}if(this['account'][_0x0b68('0x21')][_0x0b68('0x26')]){_0x5be8c4[_0x0b68('0x27')]={'user':this['account']['Smtp'][_0x0b68('0x28')],'pass':this[_0x0b68('0x1b')][_0x0b68('0x21')][_0x0b68('0x29')]};}_0x429066[_0x0b68('0x2a')]=this[_0x0b68('0x14')][_0x0b68('0x2b')];_0x429066['html']=_0x0b68('0x2c')+_[_0x0b68('0x2d')](_0x429066[_0x0b68('0x2e')],_0x0b68('0x2f'),_0x0b68('0x30'))+_0x0b68('0x31');return mailRpc[_0x0b68('0x32')](_0x5be8c4,_0x429066)[_0x0b68('0x33')](function(_0x36eec7){logger[_0x0b68('0x34')](_0x0b68('0x35'),_0x984e23);_0x429066['messageId']=_0x36eec7['message'][_0x0b68('0x2b')];return rpc[_0x14e0d8+_0x0b68('0x1f')][_0x0b68('0x36')](_0x429066);})[_0x0b68('0x33')](function(_0x1c8f8a){logger[_0x0b68('0x34')]('[%s][AUTOREPLY]\x20%s',_0x984e23,JSON['stringify'](_0x1c8f8a));})[_0x0b68('0x37')](function(_0x48fe4d){logger['error'](_0x0b68('0x38'),_0x984e23,JSON['stringify'](_0x48fe4d));})[_0x0b68('0x39')](function(){_0x2140c1['next']();});}else{return rpc[this['channel']+'Message'][_0x0b68('0x36')](_0x429066)[_0x0b68('0x33')](function(_0x4759ee){logger[_0x0b68('0x34')]('[%s][AUTOREPLY]\x20%s',_0x984e23,_0x429066[_0x0b68('0x2e')]);})[_0x0b68('0x37')](function(_0x4b3097){logger[_0x0b68('0x3a')](_0x0b68('0x3b'),_0x984e23,JSON[_0x0b68('0x3c')](_0x4b3097));})[_0x0b68('0x39')](function(){_0x2140c1[_0x0b68('0xd')]();});}}}catch(_0xe96bec){logger[_0x0b68('0x3a')](_0x0b68('0x3b'),_0x984e23,JSON[_0x0b68('0x3c')](_0xe96bec));_0x2140c1[_0x0b68('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 91c690c..22f3c77 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x720b=['system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x53e06e,_0x3d4f1a){var _0x468aee=function(_0x1de94d){while(--_0x1de94d){_0x53e06e['push'](_0x53e06e['shift']());}};_0x468aee(++_0x3d4f1a);}(_0x720b,0x1d8));var _0xb720=function(_0x42b3e3,_0x1dd25a){_0x42b3e3=_0x42b3e3-0x0;var _0xc59650=_0x720b[_0x42b3e3];return _0xc59650;};'use strict';var moment=require(_0xb720('0x0'));var logger=require(_0xb720('0x1'))(_0xb720('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb720('0x3')),'smsInteraction':require(_0xb720('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb720('0x5')),'whatsappInteraction':require(_0xb720('0x6'))};exports[_0xb720('0x7')]=function(_0x4ddff9,_0x71f1e,_0xa46698,_0x2f3125){return function(_0x19d0ba){try{logger[_0xb720('0x8')]('[%s][CLOSE]\x20reason\x20%s',_0x4ddff9,_0x71f1e[0x0]);var _0x5a97b8={'closed':0x1,'closedAt':moment()[_0xb720('0x9')](_0xb720('0xa')),'closeReason':_0xb720('0xb'),'disposition':_0x71f1e[0x0]};if(rpc[_0x2f3125[_0xb720('0xc')]+_0xb720('0xd')]){rpc[_0x2f3125[_0xb720('0xc')]+_0xb720('0xd')][_0xb720('0xe')](_0x2f3125['interaction']['id'],_0x5a97b8)[_0xb720('0xf')](function(_0x3a3810){logger['info'](_0xb720('0x10'),_0x4ddff9,_0x2f3125['interaction']['id']);})[_0xb720('0x11')](function(_0x4ab352){logger[_0xb720('0x12')](_0xb720('0x13'),_0x4ddff9,JSON[_0xb720('0x14')](_0x4ab352));})[_0xb720('0x15')](function(){_0x19d0ba[_0xb720('0x16')]();});}}catch(_0x30a5dd){logger[_0xb720('0x12')](_0xb720('0x13'),_0x4ddff9,JSON['stringify'](_0x30a5dd));_0x19d0ba[_0xb720('0x16')]();}};}; \ No newline at end of file +var _0x13f5=['Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0x13f5,0xc3));var _0x513f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x13f5[_0x4e676e];return _0x336a3c;};'use strict';var moment=require(_0x513f('0x0'));var logger=require(_0x513f('0x1'))(_0x513f('0x2'));var rpc={'chatInteraction':require(_0x513f('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x513f('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x513f('0x5'))};exports[_0x513f('0x6')]=function(_0x3a9531,_0x3a6320,_0x8d019b,_0x579681){return function(_0x2be368){try{logger[_0x513f('0x7')](_0x513f('0x8'),_0x3a9531,_0x3a6320[0x0]);var _0x42951f={'closed':0x1,'closedAt':moment()[_0x513f('0x9')](_0x513f('0xa')),'closeReason':'system','disposition':_0x3a6320[0x0]};if(rpc[_0x579681[_0x513f('0xb')]+_0x513f('0xc')]){rpc[_0x579681[_0x513f('0xb')]+_0x513f('0xc')][_0x513f('0xd')](_0x579681['interaction']['id'],_0x42951f)[_0x513f('0xe')](function(_0x821fe3){logger['info'](_0x513f('0xf'),_0x3a9531,_0x579681[_0x513f('0x10')]['id']);})[_0x513f('0x11')](function(_0x5f1f37){logger[_0x513f('0x12')](_0x513f('0x13'),_0x3a9531,JSON[_0x513f('0x14')](_0x5f1f37));})[_0x513f('0x15')](function(){_0x2be368[_0x513f('0x16')]();});}}catch(_0x2356ab){logger[_0x513f('0x12')](_0x513f('0x13'),_0x3a9531,JSON[_0x513f('0x14')](_0x2356ab));_0x2be368[_0x513f('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 3c7dc07..2c89921 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e98=['getMustacheRender','Message','create','then','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','body','dialogflow','result','speech','metadata','stringify','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','isEmpty'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8e98,0x92));var _0x88e9=function(_0x3658f3,_0x78ad94){_0x3658f3=_0x3658f3-0x0;var _0x41683d=_0x8e98[_0x3658f3];return _0x41683d;};'use strict';var _=require('lodash');var moment=require(_0x88e9('0x0'));var apiai=require(_0x88e9('0x1'));var md5=require(_0x88e9('0x2'));var utils=require(_0x88e9('0x3'));var logger=require(_0x88e9('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x88e9('0x5')),'mailMessage':require(_0x88e9('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x88e9('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x88e9('0x8')]=function(_0x486df9,_0x4fc004){return function(_0x4338e3){try{if(!_[_0x88e9('0x9')](this['interaction'][_0x88e9('0xa')])){logger[_0x88e9('0xb')](_0x88e9('0xc'),_0x486df9,_0x88e9('0xd'));return _0x4338e3[_0x88e9('0xe')]();}var _0x50e66f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x88e9('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x88e9('0x10')};var _0x34b76c=this[_0x88e9('0x11')];if(_0x34b76c===_0x88e9('0x12')){_0x50e66f[_0x88e9('0x13')]=this[_0x88e9('0x14')]['id'];}else{_0x50e66f[_['upperFirst'](_0x34b76c)+_0x88e9('0x15')]=this['account']['id'];}_0x50e66f[_[_0x88e9('0x16')](_0x34b76c)+_0x88e9('0x17')]=this[_0x88e9('0x18')]['id'];if(this[_0x88e9('0x18')]['created']){var _0x5381ac=_0x4fc004[0x2];if(!_[_0x88e9('0x19')](_0x5381ac)){_0x50e66f['body']=utils[_0x88e9('0x1a')](_0x5381ac,this);return rpc[_0x34b76c+_0x88e9('0x1b')][_0x88e9('0x1c')](_0x50e66f)[_0x88e9('0x1d')](function(_0x39040a){logger[_0x88e9('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x486df9,_0x50e66f['body']);})[_0x88e9('0x1e')](function(_0x2f4440){logger[_0x88e9('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x486df9,JSON['stringify'](_0x2f4440));})['finally'](function(){logger[_0x88e9('0xb')](_0x88e9('0x20'),_0x486df9);_0x4338e3['stop']();});}else{logger[_0x88e9('0xb')](_0x88e9('0x21'),_0x486df9);_0x4338e3[_0x88e9('0x22')]();}}else{var _0x47b940=this;var _0x1c3a6d=apiai(_0x4fc004[0x0],{'language':_0x4fc004[0x1]||'en'});return _0x1c3a6d[_0x88e9('0x23')](this[_0x88e9('0x24')][_0x88e9('0x25')],{'sessionId':md5(this['interaction']['id'])})[_0x88e9('0x1d')](function(_0x34192d){_0x47b940['body'][_0x88e9('0x26')]=_0x34192d;_0x50e66f['body']=_0x34192d[_0x88e9('0x27')]['fulfillment'][_0x88e9('0x28')];return rpc[_0x34b76c+_0x88e9('0x1b')][_0x88e9('0x1c')](_0x50e66f)[_0x88e9('0x1d')](function(_0x4cadbe){logger[_0x88e9('0xb')](_0x88e9('0xc'),_0x486df9,_0x50e66f[_0x88e9('0x25')]);if(_0x34192d[_0x88e9('0x27')][_0x88e9('0x29')]['endConversation']){_0x4338e3[_0x88e9('0xe')]();}else{_0x4338e3[_0x88e9('0x22')]();}})['catch'](function(_0x126dfa){logger[_0x88e9('0x1f')](_0x88e9('0xc'),_0x486df9,JSON[_0x88e9('0x2a')](_0x126dfa));_0x4338e3[_0x88e9('0xe')]();});})[_0x88e9('0x1e')](function(_0x25134b){logger[_0x88e9('0x1f')](_0x88e9('0xc'),_0x486df9,_0x25134b[_0x88e9('0x24')]);_0x4338e3['next']();});}}catch(_0x97f8bd){logger[_0x88e9('0x1f')](_0x88e9('0xc'),_0x486df9,JSON[_0x88e9('0x2a')](_0x97f8bd));_0x4338e3['stop']();}};}; \ No newline at end of file +var _0x5973=['created','isEmpty','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message','body','dialogflow','result','fulfillment','speech','metadata','endConversation','next','catch','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5973,0xa5));var _0x3597=function(_0x15beb8,_0x4a1367){_0x15beb8=_0x15beb8-0x0;var _0x4c2646=_0x5973[_0x15beb8];return _0x4c2646;};'use strict';var _=require('lodash');var moment=require(_0x3597('0x0'));var apiai=require(_0x3597('0x1'));var md5=require(_0x3597('0x2'));var utils=require(_0x3597('0x3'));var logger=require(_0x3597('0x4'))(_0x3597('0x5'));var rpc={'chatMessage':require(_0x3597('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3597('0x7')),'whatsappMessage':require(_0x3597('0x8'))};exports[_0x3597('0x9')]=function(_0x375917,_0x435ca8){return function(_0x39dfd1){try{if(!_[_0x3597('0xa')](this['interaction'][_0x3597('0xb')])){logger[_0x3597('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x375917,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x39dfd1['next']();}var _0x4831cf={'ContactId':this['contact']['id'],'sentAt':moment()[_0x3597('0xd')](_0x3597('0xe')),'direction':_0x3597('0xf')};var _0x44b6d3=this[_0x3597('0x10')];if(_0x44b6d3==='chat'){_0x4831cf[_0x3597('0x11')]=this[_0x3597('0x12')]['id'];}else{_0x4831cf[_['upperFirst'](_0x44b6d3)+_0x3597('0x13')]=this[_0x3597('0x12')]['id'];}_0x4831cf[_[_0x3597('0x14')](_0x44b6d3)+_0x3597('0x15')]=this[_0x3597('0x16')]['id'];if(this[_0x3597('0x16')][_0x3597('0x17')]){var _0x3243b9=_0x435ca8[0x2];if(!_[_0x3597('0x18')](_0x3243b9)){_0x4831cf['body']=utils[_0x3597('0x19')](_0x3243b9,this);return rpc[_0x44b6d3+_0x3597('0x1a')][_0x3597('0x1b')](_0x4831cf)[_0x3597('0x1c')](function(_0x9d043a){logger['info'](_0x3597('0x1d'),_0x375917,_0x4831cf['body']);})['catch'](function(_0x3de9d9){logger[_0x3597('0x1e')](_0x3597('0x1d'),_0x375917,JSON[_0x3597('0x1f')](_0x3de9d9));})[_0x3597('0x20')](function(){logger[_0x3597('0xc')](_0x3597('0x21'),_0x375917);_0x39dfd1['stop']();});}else{logger[_0x3597('0xc')](_0x3597('0x22'),_0x375917);_0x39dfd1[_0x3597('0x23')]();}}else{var _0x2024ea=this;var _0x48355f=apiai(_0x435ca8[0x0],{'language':_0x435ca8[0x1]||'en'});return _0x48355f[_0x3597('0x24')](this[_0x3597('0x25')][_0x3597('0x26')],{'sessionId':md5(this[_0x3597('0x16')]['id'])})[_0x3597('0x1c')](function(_0x324fc8){_0x2024ea['body'][_0x3597('0x27')]=_0x324fc8;_0x4831cf['body']=_0x324fc8[_0x3597('0x28')][_0x3597('0x29')][_0x3597('0x2a')];return rpc[_0x44b6d3+'Message'][_0x3597('0x1b')](_0x4831cf)['then'](function(_0x1c91ae){logger[_0x3597('0xc')](_0x3597('0x1d'),_0x375917,_0x4831cf[_0x3597('0x26')]);if(_0x324fc8[_0x3597('0x28')][_0x3597('0x2b')][_0x3597('0x2c')]){_0x39dfd1['next']();}else{_0x39dfd1[_0x3597('0x23')]();}})['catch'](function(_0x5527e4){logger[_0x3597('0x1e')](_0x3597('0x1d'),_0x375917,JSON[_0x3597('0x1f')](_0x5527e4));_0x39dfd1[_0x3597('0x2d')]();});})[_0x3597('0x2e')](function(_0x4853a0){logger[_0x3597('0x1e')](_0x3597('0x1d'),_0x375917,_0x4853a0[_0x3597('0x25')]);_0x39dfd1[_0x3597('0x2d')]();});}}catch(_0x36fe48){logger[_0x3597('0x1e')](_0x3597('0x1d'),_0x375917,JSON[_0x3597('0x1f')](_0x36fe48));_0x39dfd1[_0x3597('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 33c310f..46e3976 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1783=['error','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length'];(function(_0x40cdd4,_0x342ed1){var _0x301a31=function(_0x111603){while(--_0x111603){_0x40cdd4['push'](_0x40cdd4['shift']());}};_0x301a31(++_0x342ed1);}(_0x1783,0xe6));var _0x3178=function(_0x2d2c58,_0x5b50c5){_0x2d2c58=_0x2d2c58-0x0;var _0x122006=_0x1783[_0x2d2c58];return _0x122006;};'use strict';var schema=require(_0x3178('0x0'));var _=require(_0x3178('0x1'));var htmlToText=require(_0x3178('0x2'));var utils=require(_0x3178('0x3'));var logger=require(_0x3178('0x4'))(_0x3178('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x3178('0x6')},'priorityTrue':{'type':_0x3178('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x3178('0x7'),'message':_0x3178('0x8')}});exports[_0x3178('0x9')]=function(_0x5f1d32,_0x2d54d3){return function(_0x360cd9){try{var _0xe205ef={'condition':htmlToText['fromString'](utils[_0x3178('0xa')](_0x2d54d3[0x0],this),{'wordwrap':![]})[_0x3178('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d54d3[0x1],'priorityFalse':_0x2d54d3[0x2]};var _0x2cb3f6=gotoif['validate'](_0xe205ef,{'typecast':!![]});if(_0x2cb3f6[_0x3178('0xc')]){logger[_0x3178('0xd')]('[%s][GOTOIF]\x20%s',_0x5f1d32,_[_0x3178('0xe')](_0x2cb3f6,_0x3178('0xf'))[_0x3178('0x10')](',\x20'));_0x360cd9[_0x3178('0x11')]();}else{try{var _0x1450a7=eval('('+_0xe205ef[_0x3178('0x12')]+')');var _0x433c0a=_0x1450a7?_0xe205ef['priorityTrue']:_0xe205ef[_0x3178('0x13')];logger[_0x3178('0x14')](_0x3178('0x15'),_0x5f1d32,_0xe205ef[_0x3178('0x12')],_0x1450a7,_0x433c0a||'next');if(_0x433c0a){var _0x1137d7=_[_0x3178('0x16')](_0x360cd9[_0x3178('0x17')](),{'p':_0x433c0a});if(_0x1137d7>=0x0){logger[_0x3178('0x14')](_0x3178('0x18'),_0x5f1d32,_0x433c0a||_0x3178('0x19'),_0x1137d7);_0x360cd9[_0x3178('0x19')](_0x1137d7);}else{logger[_0x3178('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5f1d32,_0x433c0a||_0x3178('0x19'));_0x360cd9[_0x3178('0x11')]();}}else{_0x360cd9[_0x3178('0x19')]();}}catch(_0x561665){logger[_0x3178('0xd')](_0x3178('0x1a'),_0x5f1d32,_0x561665[_0x3178('0xf')]);_0x360cd9[_0x3178('0x11')]();}}}catch(_0x319099){logger[_0x3178('0xd')]('[%s][GOTOIF]\x20%s',_0x5f1d32,JSON['stringify'](_0x319099));_0x360cd9[_0x3178('0x11')]();}};}; \ No newline at end of file +var _0xb741=['number','consequence','fromString','getMustacheRender','replace','validate','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0xb741,0x1e9));var _0x1b74=function(_0xff0523,_0x4473ce){_0xff0523=_0xff0523-0x0;var _0x57f5a4=_0xb741[_0xff0523];return _0x57f5a4;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x1b74('0x0'));var utils=require(_0x1b74('0x1'));var logger=require(_0x1b74('0x2'))(_0x1b74('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x1b74('0x4')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x1b74('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x1b74('0x6')]=function(_0x336566,_0xa49c88){return function(_0x3e1741){try{var _0xda2bc7={'condition':htmlToText[_0x1b74('0x7')](utils[_0x1b74('0x8')](_0xa49c88[0x0],this),{'wordwrap':![]})[_0x1b74('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xa49c88[0x1],'priorityFalse':_0xa49c88[0x2]};var _0x3510fa=gotoif[_0x1b74('0xa')](_0xda2bc7,{'typecast':!![]});if(_0x3510fa['length']){logger['error'](_0x1b74('0xb'),_0x336566,_[_0x1b74('0xc')](_0x3510fa,_0x1b74('0xd'))['join'](',\x20'));_0x3e1741[_0x1b74('0xe')]();}else{try{var _0x58f780=eval('('+_0xda2bc7[_0x1b74('0xf')]+')');var _0x1dd149=_0x58f780?_0xda2bc7[_0x1b74('0x10')]:_0xda2bc7[_0x1b74('0x11')];logger[_0x1b74('0x12')](_0x1b74('0x13'),_0x336566,_0xda2bc7[_0x1b74('0xf')],_0x58f780,_0x1dd149||_0x1b74('0x14'));if(_0x1dd149){var _0x464bba=_[_0x1b74('0x15')](_0x3e1741[_0x1b74('0x16')](),{'p':_0x1dd149});if(_0x464bba>=0x0){logger[_0x1b74('0x12')](_0x1b74('0x17'),_0x336566,_0x1dd149||_0x1b74('0x14'),_0x464bba);_0x3e1741[_0x1b74('0x14')](_0x464bba);}else{logger[_0x1b74('0x12')](_0x1b74('0x18'),_0x336566,_0x1dd149||_0x1b74('0x14'));_0x3e1741[_0x1b74('0xe')]();}}else{_0x3e1741['next']();}}catch(_0x32b49f){logger[_0x1b74('0x19')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x336566,_0x32b49f['message']);_0x3e1741['stop']();}}}catch(_0x3a5524){logger['error']('[%s][GOTOIF]\x20%s',_0x336566,JSON['stringify'](_0x3a5524));_0x3e1741['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index c3e59bc..995f108 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 _0x9b5c=['[%s][GOTOP]\x20%s','message','join','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','info','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','stop','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x56dbac,_0x47b42b){var _0x509f0d=function(_0x33ce60){while(--_0x33ce60){_0x56dbac['push'](_0x56dbac['shift']());}};_0x509f0d(++_0x47b42b);}(_0x9b5c,0x1c6));var _0xc9b5=function(_0x54f5d8,_0x5edb6e){_0x54f5d8=_0x54f5d8-0x0;var _0x57addd=_0x9b5c[_0x54f5d8];return _0x57addd;};'use strict';var schema=require(_0xc9b5('0x0'));var _=require(_0xc9b5('0x1'));var logger=require(_0xc9b5('0x2'))(_0xc9b5('0x3'));var gotop=schema({'priority':{'type':_0xc9b5('0x4'),'required':!![],'message':_0xc9b5('0x5')}});exports[_0xc9b5('0x6')]=function(_0xb32254,_0x316000){return function(_0x44a216){try{var _0x5bb0f1={'priority':_0x316000[0x0]};var _0x1216eb=gotop[_0xc9b5('0x0')](_0x5bb0f1,{'typecast':!![]});if(_0x1216eb[_0xc9b5('0x7')]){logger['error'](_0xc9b5('0x8'),_0xb32254,_['map'](_0x1216eb,_0xc9b5('0x9'))[_0xc9b5('0xa')](',\x20'));_0x44a216['stop']();}else{logger['info'](_0xc9b5('0xb'),_0xb32254,_0x5bb0f1[_0xc9b5('0xc')]);if(_0x5bb0f1['priority']){var _0x50e3c0=_['findIndex'](_0x44a216[_0xc9b5('0xd')](),{'p':_0x5bb0f1[_0xc9b5('0xc')]});if(_0x50e3c0>=0x0){logger['info'](_0xc9b5('0xe'),_0xb32254,_0x5bb0f1[_0xc9b5('0xc')]||_0xc9b5('0xf'),_0x50e3c0);_0x44a216[_0xc9b5('0xf')](_0x50e3c0);}else{logger[_0xc9b5('0x10')](_0xc9b5('0x11'),_0xb32254,_0x5bb0f1[_0xc9b5('0xc')]||_0xc9b5('0xf'));_0x44a216['stop']();}}else{_0x44a216['next']();}}}catch(_0x2cd0cd){logger[_0xc9b5('0x12')](_0xc9b5('0x8'),_0xb32254,JSON[_0xc9b5('0x13')](_0x2cd0cd));_0x44a216[_0xc9b5('0x14')]();}};}; \ No newline at end of file +var _0x3d41=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x388c29,_0x1ae5b2){var _0x1d218e=function(_0x4484af){while(--_0x4484af){_0x388c29['push'](_0x388c29['shift']());}};_0x1d218e(++_0x1ae5b2);}(_0x3d41,0xa5));var _0x13d4=function(_0x44c768,_0x552a5e){_0x44c768=_0x44c768-0x0;var _0x55daf5=_0x3d41[_0x44c768];return _0x55daf5;};'use strict';var schema=require(_0x13d4('0x0'));var _=require(_0x13d4('0x1'));var logger=require(_0x13d4('0x2'))(_0x13d4('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x13d4('0x4')}});exports[_0x13d4('0x5')]=function(_0x34f70b,_0x5e710e){return function(_0xe2edb9){try{var _0xcbe013={'priority':_0x5e710e[0x0]};var _0x360751=gotop[_0x13d4('0x0')](_0xcbe013,{'typecast':!![]});if(_0x360751['length']){logger[_0x13d4('0x6')](_0x13d4('0x7'),_0x34f70b,_[_0x13d4('0x8')](_0x360751,'message')[_0x13d4('0x9')](',\x20'));_0xe2edb9[_0x13d4('0xa')]();}else{logger[_0x13d4('0xb')](_0x13d4('0xc'),_0x34f70b,_0xcbe013['priority']);if(_0xcbe013[_0x13d4('0xd')]){var _0x4b6804=_[_0x13d4('0xe')](_0xe2edb9[_0x13d4('0xf')](),{'p':_0xcbe013[_0x13d4('0xd')]});if(_0x4b6804>=0x0){logger[_0x13d4('0xb')](_0x13d4('0x10'),_0x34f70b,_0xcbe013[_0x13d4('0xd')]||_0x13d4('0x11'),_0x4b6804);_0xe2edb9[_0x13d4('0x11')](_0x4b6804);}else{logger[_0x13d4('0xb')](_0x13d4('0x12'),_0x34f70b,_0xcbe013[_0x13d4('0xd')]||_0x13d4('0x11'));_0xe2edb9[_0x13d4('0xa')]();}}else{_0xe2edb9['next']();}}}catch(_0x184930){logger[_0x13d4('0x6')](_0x13d4('0x7'),_0x34f70b,JSON[_0x13d4('0x13')](_0x184930));_0xe2edb9['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 3d1e37d..94e49ba 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 _0xcbfa=['getMustacheRender','contact','channel','chat','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xcbfa,0xa2));var _0xacbf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcbfa[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var utils=require(_0xacbf('0x0'));var logger=require(_0xacbf('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xacbf('0x2')),'smsMessage':require(_0xacbf('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xacbf('0x4'))};exports[_0xacbf('0x5')]=function(_0x85e046,_0x2ccc22){return function(_0x343e12){try{var _0x547cec={'body':utils[_0xacbf('0x6')](_0x2ccc22[0x0],this),'ContactId':this[_0xacbf('0x7')]['id']};if(this[_0xacbf('0x8')]===_0xacbf('0x9')){_0x547cec['ChatWebsiteId']=this['account']['id'];}else{_0x547cec[_[_0xacbf('0xa')](this['channel'])+_0xacbf('0xb')]=this['account']['id'];}_0x547cec[_[_0xacbf('0xa')](this[_0xacbf('0x8')])+'InteractionId']=this[_0xacbf('0xc')]['id'];if(rpc[this['channel']+_0xacbf('0xd')]){return rpc[this['channel']+'Message'][_0xacbf('0xe')](_0x547cec)[_0xacbf('0xf')](function(_0x4b4787){logger[_0xacbf('0x10')](_0xacbf('0x11'),_0x85e046,_0x547cec[_0xacbf('0x12')]);_0x343e12[_0xacbf('0x13')]();})[_0xacbf('0x14')](function(_0xa6b0e8){logger[_0xacbf('0x15')](_0xacbf('0x11'),_0x85e046,JSON[_0xacbf('0x16')](_0xa6b0e8));_0x343e12[_0xacbf('0x17')]();});}}catch(_0x1c7db2){logger['error'](_0xacbf('0x11'),_0x85e046,JSON[_0xacbf('0x16')](_0x1c7db2));_0x343e12[_0xacbf('0x17')]();}};}; \ No newline at end of file +var _0x9e82=['InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','./utils','../../../../config/logger','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x9e82,0x12c));var _0x29e8=function(_0x55262d,_0x1a676b){_0x55262d=_0x55262d-0x0;var _0xadf2ce=_0x9e82[_0x55262d];return _0xadf2ce;};'use strict';var _=require('lodash');var utils=require(_0x29e8('0x0'));var logger=require(_0x29e8('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x29e8('0x2')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x29e8('0x3'))};exports['consequence']=function(_0x20a30b,_0x45dcf6){return function(_0x1dbff3){try{var _0x5d8a3f={'body':utils[_0x29e8('0x4')](_0x45dcf6[0x0],this),'ContactId':this[_0x29e8('0x5')]['id']};if(this[_0x29e8('0x6')]===_0x29e8('0x7')){_0x5d8a3f[_0x29e8('0x8')]=this[_0x29e8('0x9')]['id'];}else{_0x5d8a3f[_[_0x29e8('0xa')](this['channel'])+_0x29e8('0xb')]=this[_0x29e8('0x9')]['id'];}_0x5d8a3f[_['upperFirst'](this[_0x29e8('0x6')])+_0x29e8('0xc')]=this[_0x29e8('0xd')]['id'];if(rpc[this[_0x29e8('0x6')]+_0x29e8('0xe')]){return rpc[this[_0x29e8('0x6')]+_0x29e8('0xe')][_0x29e8('0xf')](_0x5d8a3f)[_0x29e8('0x10')](function(_0x2b1a48){logger[_0x29e8('0x11')](_0x29e8('0x12'),_0x20a30b,_0x5d8a3f[_0x29e8('0x13')]);_0x1dbff3['next']();})[_0x29e8('0x14')](function(_0x4fab18){logger[_0x29e8('0x15')](_0x29e8('0x12'),_0x20a30b,JSON[_0x29e8('0x16')](_0x4fab18));_0x1dbff3[_0x29e8('0x17')]();});}}catch(_0x9fc32a){logger[_0x29e8('0x15')]('[%s][MESSAGE]\x20%s',_0x20a30b,JSON[_0x29e8('0x16')](_0x9fc32a));_0x1dbff3[_0x29e8('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 ea225cf..94925bb 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 _0xbdb7=['routing','consequence','info','[%s][NOOP]\x20%s','next','stringify','./utils','../../../../config/logger'];(function(_0xe64a64,_0x26b796){var _0xef0be4=function(_0x2915c3){while(--_0x2915c3){_0xe64a64['push'](_0xe64a64['shift']());}};_0xef0be4(++_0x26b796);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5201a7,_0x21f8bf){_0x5201a7=_0x5201a7-0x0;var _0x435d26=_0xbdb7[_0x5201a7];return _0x435d26;};'use strict';var utils=require(_0x7bdb('0x0'));var logger=require(_0x7bdb('0x1'))(_0x7bdb('0x2'));exports[_0x7bdb('0x3')]=function(_0x23c326,_0x433850){return function(_0x4496ac){try{logger[_0x7bdb('0x4')](_0x7bdb('0x5'),_0x23c326,utils['getMustacheRender'](_0x433850[0x0],this));_0x4496ac[_0x7bdb('0x6')]();}catch(_0x4fd1ad){logger['error'](_0x7bdb('0x5'),_0x23c326,JSON[_0x7bdb('0x7')](_0x4fd1ad));_0x4496ac['stop']();}};}; \ No newline at end of file +var _0xeda0=['./utils','../../../../config/logger','routing','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop'];(function(_0x434d5e,_0x2baf1d){var _0x59643c=function(_0x383efd){while(--_0x383efd){_0x434d5e['push'](_0x434d5e['shift']());}};_0x59643c(++_0x2baf1d);}(_0xeda0,0x1d8));var _0x0eda=function(_0x5195f8,_0x107e2c){_0x5195f8=_0x5195f8-0x0;var _0x2dd6f1=_0xeda0[_0x5195f8];return _0x2dd6f1;};'use strict';var utils=require(_0x0eda('0x0'));var logger=require(_0x0eda('0x1'))(_0x0eda('0x2'));exports['consequence']=function(_0x3d0375,_0x1e09d5){return function(_0x567142){try{logger['info'](_0x0eda('0x3'),_0x3d0375,utils[_0x0eda('0x4')](_0x1e09d5[0x0],this));_0x567142['next']();}catch(_0x3f4911){logger[_0x0eda('0x5')](_0x0eda('0x3'),_0x3d0375,JSON[_0x0eda('0x6')](_0x3f4911));_0x567142[_0x0eda('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 1b9b31c..aaebb86 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(_0x1b47ee,_0x2aef91){var _0x1167bb=function(_0x59b723){while(--_0x59b723){_0x1b47ee['push'](_0x1b47ee['shift']());}};_0x1167bb(++_0x2aef91);}(_0x008c,0x188));var _0xc008=function(_0x568ec8,_0x1e0f23){_0x568ec8=_0x568ec8-0x0;var _0x52b2be=_0x008c[_0x568ec8];return _0x52b2be;};'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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x3e74,0x175));var _0x43e7=function(_0x21e529,_0x4edb8e){_0x21e529=_0x21e529-0x0;var _0x5b3d43=_0x3e74[_0x21e529];return _0x5b3d43;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ 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 50c6760..c5d27a2 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 _0x37ea=['squeue','push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','info','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','TIMEOUT','exports','lodash','uuid','./util','routing'];(function(_0x29c9fc,_0xc00fdd){var _0x3fc0ed=function(_0x582d8f){while(--_0x582d8f){_0x29c9fc['push'](_0x29c9fc['shift']());}};_0x3fc0ed(++_0xc00fdd);}(_0x37ea,0xe3));var _0xa37e=function(_0x4c175c,_0x408ea6){_0x4c175c=_0x4c175c-0x0;var _0x58e4b9=_0x37ea[_0x4c175c];return _0x58e4b9;};'use strict';var _=require(_0xa37e('0x0'));var uuid=require(_0xa37e('0x1'));var util=require(_0xa37e('0x2'));var logger=require('../../../../../config/logger')(_0xa37e('0x3'));var Agent=function(_0x2d14f4,_0x167531,_0x495375,_0x22764b){this['notificationId']=uuid['v4']();this[_0xa37e('0x4')]=_0x2d14f4;this['agent']=_0x167531;this['realtime']=_0x495375;this[_0xa37e('0x3')]=_0x22764b;this['squeue'][_0xa37e('0x5')](this['handleRun'][_0xa37e('0x6')](this),this[_0xa37e('0x7')][_0xa37e('0x6')](this));this[_0xa37e('0x4')]['on'](_0xa37e('0x8'),this['handleTimeout']['bind'](this));this[_0xa37e('0x4')]['on']('drained',this[_0xa37e('0x9')]['bind'](this));};Agent[_0xa37e('0xa')][_0xa37e('0x5')]=function(){this['squeue'][_0xa37e('0x5')](this[_0xa37e('0xb')]['bind'](this),this['handleTimeout'][_0xa37e('0x6')](this));};Agent['prototype'][_0xa37e('0x9')]=function(){this[_0xa37e('0x7')](!![]);};Agent[_0xa37e('0xa')][_0xa37e('0xb')]=function(_0x302f2c){logger['info'](_0xa37e('0xc'),this[_0xa37e('0x4')]['id'],this[_0xa37e('0xd')]['id']);if(_[_0xa37e('0xe')](this[_0xa37e('0xf')][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']])){logger[_0xa37e('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa37e('0x4')]['id'],this[_0xa37e('0xd')]['id']);setTimeout(this[_0xa37e('0x5')][_0xa37e('0x6')](this),0x3e8);}else{if(this[_0xa37e('0x3')][_0xa37e('0x12')]||util[_0xa37e('0x13')](this[_0xa37e('0x4')]['id'],this[_0xa37e('0xf')][_0xa37e('0x10')][this['agent']['id']],this[_0xa37e('0x4')]['channel'],![])){this[_0xa37e('0xf')]['agents'][this['agent']['id']][_0xa37e('0x14')]=!![];this[_0xa37e('0xf')]['agents'][this['agent']['id']][_0xa37e('0x15')]=undefined;util[_0xa37e('0x16')](this[_0xa37e('0x17')],this[_0xa37e('0x4')]['id'],this[_0xa37e('0xf')][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']],null,this[_0xa37e('0x3')]);util[_0xa37e('0x18')](this[_0xa37e('0x4')]['id'],this['realtime'][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']],_0xa37e('0x19')+(this[_0xa37e('0x3')]['forcedOwnership']?_0xa37e('0x1a'):''));}else{logger[_0xa37e('0x11')](_0xa37e('0x1b'),this[_0xa37e('0x4')]['id'],this[_0xa37e('0xd')]['id']);setTimeout(this[_0xa37e('0x5')][_0xa37e('0x6')](this),0x3e8);}}};Agent[_0xa37e('0xa')][_0xa37e('0x7')]=function(_0x3c4d64){if(_[_0xa37e('0xe')](this[_0xa37e('0xf')][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']])){return logger[_0xa37e('0x11')](_0xa37e('0x1c'),this['squeue']['id'],this[_0xa37e('0xd')]['id']);}else{logger[_0xa37e('0x11')](_0xa37e('0x1d'),this['squeue']['id'],this[_0xa37e('0xd')]['id']);util['hideNotification'](this[_0xa37e('0x17')],this[_0xa37e('0x4')]['id'],this[_0xa37e('0xf')][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']],null,this[_0xa37e('0x3')]);this['realtime'][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']][_0xa37e('0x14')]=![];this[_0xa37e('0xf')][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']][_0xa37e('0x15')]=undefined;util[_0xa37e('0x18')](this[_0xa37e('0x4')]['id'],this['realtime'][_0xa37e('0x10')][this[_0xa37e('0xd')]['id']],_0x3c4d64?_0xa37e('0x1e'):_0xa37e('0x1f'));}if(!_0x3c4d64){setTimeout(this[_0xa37e('0x5')][_0xa37e('0x6')](this),0x3e8);}};function agent(_0x3fa715,_0x597bff,_0x5da948,_0xcb9c00){return new Agent(_0x3fa715,_0x597bff,_0x5da948,_0xcb9c00);}module[_0xa37e('0x20')]=agent; \ No newline at end of file +var _0x5615=['[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','isAgentAvailable','busy','showNotification','writeLog','RINGING',':FORCED','hideNotification','busyQueue','STOP','exports','lodash','uuid','routing','notificationId','squeue','realtime','push','bind','timeout','handleTimeout','handleDrained','prototype','handleRun','info'];(function(_0x22b95b,_0x2c695e){var _0x32728b=function(_0x434be1){while(--_0x434be1){_0x22b95b['push'](_0x22b95b['shift']());}};_0x32728b(++_0x2c695e);}(_0x5615,0xa0));var _0x5561=function(_0x59c055,_0x101c93){_0x59c055=_0x59c055-0x0;var _0x15f6d2=_0x5615[_0x59c055];return _0x15f6d2;};'use strict';var _=require(_0x5561('0x0'));var uuid=require(_0x5561('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x5561('0x2'));var Agent=function(_0x1817b9,_0x397210,_0x57a5fb,_0x401236){this[_0x5561('0x3')]=uuid['v4']();this[_0x5561('0x4')]=_0x1817b9;this['agent']=_0x397210;this[_0x5561('0x5')]=_0x57a5fb;this[_0x5561('0x2')]=_0x401236;this[_0x5561('0x4')][_0x5561('0x6')](this['handleRun'][_0x5561('0x7')](this),this['handleTimeout'][_0x5561('0x7')](this));this['squeue']['on'](_0x5561('0x8'),this[_0x5561('0x9')][_0x5561('0x7')](this));this[_0x5561('0x4')]['on']('drained',this[_0x5561('0xa')]['bind'](this));};Agent[_0x5561('0xb')]['push']=function(){this[_0x5561('0x4')][_0x5561('0x6')](this[_0x5561('0xc')][_0x5561('0x7')](this),this[_0x5561('0x9')][_0x5561('0x7')](this));};Agent[_0x5561('0xb')][_0x5561('0xa')]=function(){this[_0x5561('0x9')](!![]);};Agent[_0x5561('0xb')]['handleRun']=function(_0x28d580){logger[_0x5561('0xd')](_0x5561('0xe'),this[_0x5561('0x4')]['id'],this['agent']['id']);if(_[_0x5561('0xf')](this[_0x5561('0x5')][_0x5561('0x10')][this['agent']['id']])){logger['info'](_0x5561('0x11'),this[_0x5561('0x4')]['id'],this[_0x5561('0x12')]['id']);setTimeout(this[_0x5561('0x6')][_0x5561('0x7')](this),0x3e8);}else{if(this[_0x5561('0x2')]['forcedOwnership']||util[_0x5561('0x13')](this[_0x5561('0x4')]['id'],this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']],this[_0x5561('0x4')]['channel'],![])){this['realtime'][_0x5561('0x10')][this[_0x5561('0x12')]['id']][_0x5561('0x14')]=!![];this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']]['busyQueue']=undefined;util[_0x5561('0x15')](this[_0x5561('0x3')],this[_0x5561('0x4')]['id'],this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']],null,this['routing']);util[_0x5561('0x16')](this[_0x5561('0x4')]['id'],this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']],_0x5561('0x17')+(this['routing']['forcedOwnership']?_0x5561('0x18'):''));}else{logger[_0x5561('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x5561('0x4')]['id'],this[_0x5561('0x12')]['id']);setTimeout(this[_0x5561('0x6')]['bind'](this),0x3e8);}}};Agent[_0x5561('0xb')][_0x5561('0x9')]=function(_0x19b216){if(_[_0x5561('0xf')](this[_0x5561('0x5')][_0x5561('0x10')][this['agent']['id']])){return logger[_0x5561('0xd')](_0x5561('0x11'),this['squeue']['id'],this[_0x5561('0x12')]['id']);}else{logger[_0x5561('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x5561('0x4')]['id'],this[_0x5561('0x12')]['id']);util[_0x5561('0x19')](this[_0x5561('0x3')],this['squeue']['id'],this['realtime'][_0x5561('0x10')][this['agent']['id']],null,this[_0x5561('0x2')]);this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']][_0x5561('0x14')]=![];this[_0x5561('0x5')][_0x5561('0x10')][this[_0x5561('0x12')]['id']][_0x5561('0x1a')]=undefined;util[_0x5561('0x16')](this[_0x5561('0x4')]['id'],this['realtime'][_0x5561('0x10')][this[_0x5561('0x12')]['id']],_0x19b216?_0x5561('0x1b'):'TIMEOUT');}if(!_0x19b216){setTimeout(this[_0x5561('0x6')][_0x5561('0x7')](this),0x3e8);}};function agent(_0x51fe76,_0x320a9d,_0x57af2d,_0x59bc5f){return new Agent(_0x51fe76,_0x320a9d,_0x57af2d,_0x59bc5f);}module[_0x5561('0x1c')]=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 bb69ce3..bf94f5f 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 _0x6402=['notificationId','queue','squeue','handleRun','bind','timeout','drained','handleDrained','prototype','push','handleTimeout','isNil','Agents','length','realtime','agents','info','isAgentAvailable','busy','busyQueue','name','showNotification','hideNotification','writeLog','STOP','exports','lodash','uuid','../../../../../config/logger','routing'];(function(_0x2a1cc2,_0x15fea0){var _0x20f8c4=function(_0x514fb0){while(--_0x514fb0){_0x2a1cc2['push'](_0x2a1cc2['shift']());}};_0x20f8c4(++_0x15fea0);}(_0x6402,0xb0));var _0x2640=function(_0x55645e,_0x2680c3){_0x55645e=_0x55645e-0x0;var _0x37be78=_0x6402[_0x55645e];return _0x37be78;};'use strict';var _=require(_0x2640('0x0'));var uuid=require(_0x2640('0x1'));var util=require('./util');var logger=require(_0x2640('0x2'))(_0x2640('0x3'));var Beepall=function(_0x59c0c3,_0x22a057,_0x159c5e,_0x16f39d){this[_0x2640('0x4')]=uuid['v4']();this['squeue']=_0x59c0c3;this[_0x2640('0x5')]=_0x22a057;this['realtime']=_0x159c5e;this[_0x2640('0x3')]=_0x16f39d;this[_0x2640('0x6')]['push'](this[_0x2640('0x7')][_0x2640('0x8')](this),this['handleTimeout'][_0x2640('0x8')](this));this[_0x2640('0x6')]['on'](_0x2640('0x9'),this['handleTimeout'][_0x2640('0x8')](this));this[_0x2640('0x6')]['on'](_0x2640('0xa'),this[_0x2640('0xb')][_0x2640('0x8')](this));};Beepall[_0x2640('0xc')][_0x2640('0xd')]=function(){this[_0x2640('0x6')]['push'](this[_0x2640('0x7')][_0x2640('0x8')](this),this[_0x2640('0xe')][_0x2640('0x8')](this));};Beepall[_0x2640('0xc')][_0x2640('0xb')]=function(_0x1955f3){this[_0x2640('0xe')](!![]);};Beepall[_0x2640('0xc')][_0x2640('0x7')]=function(_0x3b5397){var _0x149c6d=!![];if(!_[_0x2640('0xf')](this[_0x2640('0x5')])&&!_[_0x2640('0xf')](this[_0x2640('0x5')][_0x2640('0x10')])&&this[_0x2640('0x5')][_0x2640('0x10')][_0x2640('0x11')]>0x0){for(var _0x3caf5a=0x0,_0xd4b531;_0x3caf5a0x0){for(var _0x4048fd=0x0,_0x3139a8;_0x4048fd0x0&&_0x59dec4[_0x33dec5+_0x5f48('0x22')]>=_0x59dec4[_0x33dec5+_0x5f48('0x23')]){writeLog(_0x196c72,_0x59dec4,_0x33dec5[_0x5f48('0x24')]()+_0x5f48('0x25'));return![];}}return!![];};exports[_0x5f48('0x26')]=function(_0x12009d,_0x2e438e,_0x2831c8,_0x16a0cd,_0x4731ab){return sendNotification(!![],_0x12009d,_0x2e438e,_0x2831c8,_0x16a0cd,_0x4731ab);};exports[_0x5f48('0x27')]=function(_0x246600,_0x5a5bbc,_0x2174ab,_0x5b1e38,_0x376c4b){return sendNotification(![],_0x246600,_0x5a5bbc,_0x2174ab,_0x5b1e38,_0x376c4b);};exports[_0x5f48('0x28')]=writeLog; \ No newline at end of file +var _0x0e21=['redis','localhost','socket.io-emitter','emit','format','user:%s','split','\x20interaction','name','account','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','info','isAgentAvailable','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','writeLog','util','../utils','mustache','../../../../../config/environment','../../../../../config/logger','routing'];(function(_0x377e9b,_0xbe4154){var _0x4f2516=function(_0x27a0ac){while(--_0x27a0ac){_0x377e9b['push'](_0x377e9b['shift']());}};_0x4f2516(++_0xbe4154);}(_0x0e21,0xe8));var _0x10e2=function(_0x3046ba,_0x58b3da){_0x3046ba=_0x3046ba-0x0;var _0x5145a0=_0x0e21[_0x3046ba];return _0x5145a0;};'use strict';var _=require('lodash');var util=require(_0x10e2('0x0'));var utils=require(_0x10e2('0x1'));var Mustache=require(_0x10e2('0x2'));var Redis=require('ioredis');var config=require(_0x10e2('0x3'));var logger=require(_0x10e2('0x4'))(_0x10e2('0x5'));config['redis']=_['defaults'](config[_0x10e2('0x6')],{'host':_0x10e2('0x7'),'port':0x18eb});var io=require(_0x10e2('0x8'))(new Redis(config[_0x10e2('0x6')]));function emit(_0x4e1687,_0x219fc6,_0x121894){io['to'](_0x4e1687)[_0x10e2('0x9')](_0x219fc6,_0x121894);}function sendNotification(_0x375bbc,_0x50c758,_0x3594c4,_0x52ef03,_0x559b78,_0x5ac29c){io['to'](util[_0x10e2('0xa')](_0x10e2('0xb'),_0x52ef03['name']))[_0x10e2('0x9')]('user:save',_0x52ef03);var _0x1b5934=_0x5ac29c||{};var _0x435c67=_0x3594c4[_0x10e2('0xc')]('.');var _0x56db90={'uniqueid':_0x50c758,'channel':_0x435c67[0x0],'id':_0x435c67[0x1],'title':_0x435c67[0x0]+_0x10e2('0xd'),'interactionId':_0x435c67[0x2],'queue':_0x559b78?_0x559b78[_0x10e2('0xe')]:null,'sound':_0x1b5934[_0x10e2('0xf')]['notificationSound'],'shake':_0x1b5934['account']['notificationShake']};try{if(!_0x1b5934['body']){_0x1b5934[_0x10e2('0x10')]={};}if(_0x559b78){_0x1b5934[_0x10e2('0x10')][_0x10e2('0x11')]=_0x559b78;}else if(_0x1b5934['body'][_0x10e2('0x11')]){delete _0x1b5934[_0x10e2('0x10')][_0x10e2('0x11')];}_0x56db90[_0x10e2('0x12')]=utils[_0x10e2('0x13')](_0x1b5934[_0x10e2('0xf')]['notificationTemplate'],_0x1b5934);}catch(_0x2fd6a7){_0x56db90[_0x10e2('0x12')]=_0x10e2('0x14');logger[_0x10e2('0x15')](util[_0x10e2('0xa')](_0x10e2('0x16'),_0x50c758,_0x2fd6a7[_0x10e2('0x17')]));}io['to'](util[_0x10e2('0xa')]('user:%s',_0x52ef03[_0x10e2('0xe')]))[_0x10e2('0x9')](util[_0x10e2('0xa')](_0x10e2('0x18'),_0x375bbc?'save':'remove'),_0x56db90);}function writeLog(_0x3da283,_0x232d22,_0x269bba){return logger[_0x10e2('0x19')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3da283,_0x232d22[_0x10e2('0xe')],_0x269bba));}exports[_0x10e2('0x1a')]=function(_0x2521d8,_0x17abe3,_0x40fe48,_0x3ebb5a){if(_0x17abe3['busy']){writeLog(_0x2521d8,_0x17abe3,_0x10e2('0x1b'));return![];}if(!_0x17abe3[_0x10e2('0x1c')]){writeLog(_0x2521d8,_0x17abe3,_0x10e2('0x1d'));return![];}if(_0x17abe3[_0x40fe48+_0x10e2('0x1e')]){writeLog(_0x2521d8,_0x17abe3,_0x10e2('0x1f'));return![];}if(_0x3ebb5a&&_0x17abe3[_0x10e2('0x20')](_0x40fe48+'Capacity')&&_0x17abe3[_0x10e2('0x20')](_0x40fe48+'CurrentCapacity')){if(_0x17abe3[_0x40fe48+'Capacity']>0x0&&_0x17abe3[_0x40fe48+'CurrentCapacity']>=_0x17abe3[_0x40fe48+'Capacity']){writeLog(_0x2521d8,_0x17abe3,_0x40fe48['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x4f5177,_0x569c77,_0x18b72c,_0xd98e96,_0x30e4be){return sendNotification(!![],_0x4f5177,_0x569c77,_0x18b72c,_0xd98e96,_0x30e4be);};exports['hideNotification']=function(_0x12f96d,_0x2c03ad,_0x26c98c,_0x1a56b8,_0x147640){return sendNotification(![],_0x12f96d,_0x2c03ad,_0x26c98c,_0x1a56b8,_0x147640);};exports[_0x10e2('0x21')]=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 bb62869..940016d 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 _0x65c6=['length','error','[%s][SYSTEM]\x20%s','map','message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence'];(function(_0x395a03,_0x362943){var _0x8de6f=function(_0x56ae29){while(--_0x56ae29){_0x395a03['push'](_0x395a03['shift']());}};_0x8de6f(++_0x362943);}(_0x65c6,0xe8));var _0x665c=function(_0x5ec71e,_0x5e64e5){_0x5ec71e=_0x5ec71e-0x0;var _0x1b7edd=_0x65c6[_0x5ec71e];return _0x1b7edd;};'use strict';var schema=require(_0x665c('0x0'));var sh=require(_0x665c('0x1'));var _=require(_0x665c('0x2'));var utils=require(_0x665c('0x3'));var logger=require(_0x665c('0x4'))(_0x665c('0x5'));var system=schema({'command':{'type':_0x665c('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x665c('0x7')]=function(_0x23d579,_0x16e50d){return function(_0x4aed29){try{var _0x51e3e5={'command':_0x16e50d[0x0]};var _0x12861e=system[_0x665c('0x0')](_0x51e3e5,{'typecast':!![]});if(_0x12861e[_0x665c('0x8')]){logger[_0x665c('0x9')](_0x665c('0xa'),_0x23d579,_[_0x665c('0xb')](_0x12861e,_0x665c('0xc'))['join'](',\x20'));logger[_0x665c('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x23d579);_0x4aed29[_0x665c('0xe')]();}else{var _0x42f245=this;var _0x1e52e5=utils[_0x665c('0xf')](_0x16e50d[0x0],this);logger[_0x665c('0xd')](_0x665c('0x10'),_0x23d579,_0x1e52e5);sh[_0x665c('0x11')](_['trim'](_0x1e52e5),function(_0x56875e,_0x39a39b){logger[_0x665c('0xd')](_0x665c('0x12'),_0x23d579,_0x56875e);if(_0x56875e==0x0){var _0x5bcd8d=_0x39a39b[_0x665c('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x665c('0x14')](_0x16e50d[0x1])||_['isEmpty'](_0x16e50d[0x1])){logger[_0x665c('0xd')](_0x665c('0x15'),_0x23d579);_0x42f245[_0x665c('0x16')][_0x16e50d[0x1]]=_0x5bcd8d;}else{logger[_0x665c('0xd')](_0x665c('0x17'),_0x23d579,_0x16e50d[0x1],_0x5bcd8d);_0x42f245[_0x665c('0x16')][_0x16e50d[0x1]]=_0x5bcd8d;}}_0x4aed29[_0x665c('0xe')]();});}}catch(_0x2dad76){logger[_0x665c('0x9')](_0x665c('0xa'),_0x23d579,_['isObject'](_0x2dad76)?JSON['stringify'](_0x2dad76):_0x2dad76);logger[_0x665c('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x23d579);_0x4aed29['next']();}};}; \ No newline at end of file +var _0xb3a7=['replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xb3a7,0xcb));var _0x7b3a=function(_0x471460,_0x4663da){_0x471460=_0x471460-0x0;var _0xb28983=_0xb3a7[_0x471460];return _0xb28983;};'use strict';var schema=require(_0x7b3a('0x0'));var sh=require(_0x7b3a('0x1'));var _=require(_0x7b3a('0x2'));var utils=require(_0x7b3a('0x3'));var logger=require('../../../../config/logger')(_0x7b3a('0x4'));var system=schema({'command':{'type':_0x7b3a('0x5'),'required':!![],'message':_0x7b3a('0x6')}});exports[_0x7b3a('0x7')]=function(_0x48bab7,_0x5bc059){return function(_0x26192c){try{var _0x449bf8={'command':_0x5bc059[0x0]};var _0x59df14=system[_0x7b3a('0x0')](_0x449bf8,{'typecast':!![]});if(_0x59df14[_0x7b3a('0x8')]){logger[_0x7b3a('0x9')](_0x7b3a('0xa'),_0x48bab7,_[_0x7b3a('0xb')](_0x59df14,_0x7b3a('0xc'))[_0x7b3a('0xd')](',\x20'));logger[_0x7b3a('0xe')](_0x7b3a('0xf'),_0x48bab7);_0x26192c['next']();}else{var _0x553cee=this;var _0x11e4a4=utils[_0x7b3a('0x10')](_0x5bc059[0x0],this);logger['info'](_0x7b3a('0x11'),_0x48bab7,_0x11e4a4);sh[_0x7b3a('0x12')](_[_0x7b3a('0x13')](_0x11e4a4),function(_0x55d1c3,_0x19ee47){logger[_0x7b3a('0xe')](_0x7b3a('0x14'),_0x48bab7,_0x55d1c3);if(_0x55d1c3==0x0){var _0x31413d=_0x19ee47[_0x7b3a('0x15')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x5bc059[0x1])||_[_0x7b3a('0x16')](_0x5bc059[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x48bab7);_0x553cee[_0x7b3a('0x17')][_0x5bc059[0x1]]=_0x31413d;}else{logger['info'](_0x7b3a('0x18'),_0x48bab7,_0x5bc059[0x1],_0x31413d);_0x553cee[_0x7b3a('0x17')][_0x5bc059[0x1]]=_0x31413d;}}_0x26192c[_0x7b3a('0x19')]();});}}catch(_0xe2fa05){logger[_0x7b3a('0x9')](_0x7b3a('0xa'),_0x48bab7,_[_0x7b3a('0x1a')](_0xe2fa05)?JSON[_0x7b3a('0x1b')](_0xe2fa05):_0xe2fa05);logger[_0x7b3a('0xe')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x48bab7);_0x26192c['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index a5bdecc..51b3c68 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 _0xf3f0=['../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','error','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','interaction','catch','[%s][TAG]\x20%s','isObject','stringify','validate','../../rpc/openchannelInteraction'];(function(_0xff2c75,_0x2c8ae0){var _0x25f817=function(_0x16b3cf){while(--_0x16b3cf){_0xff2c75['push'](_0xff2c75['shift']());}};_0x25f817(++_0x2c8ae0);}(_0xf3f0,0x1f2));var _0x0f3f=function(_0x935e4,_0x478ff6){_0x935e4=_0x935e4-0x0;var _0x9e5aba=_0xf3f0[_0x935e4];return _0x9e5aba;};'use strict';var schema=require(_0x0f3f('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0f3f('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x0f3f('0x2'))};var logger=require(_0x0f3f('0x3'))('routing');var tag=schema({'tag':{'type':_0x0f3f('0x4'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x0f3f('0x5')]=function(_0x3ecf7f,_0x501ca0,_0x156ed1,_0x280296){return function(_0x28bba4){try{var _0x164a27={'tag':_0x501ca0[0x0]};var _0x211819=tag['validate'](_0x164a27,{'typecast':!![]});if(_0x211819['length']){logger[_0x0f3f('0x6')]('[%s][TAG]\x20%s',_0x3ecf7f,_['map'](_0x211819,'message')[_0x0f3f('0x7')](',\x20'));logger[_0x0f3f('0x8')](_0x0f3f('0x9'),_0x3ecf7f);_0x28bba4[_0x0f3f('0xa')]();}else{var _0x46e435={'ids':[_0x501ca0[0x0]]};if(rpc[_0x280296['channel']+_0x0f3f('0xb')]){rpc[_0x280296['channel']+_0x0f3f('0xb')][_0x0f3f('0xc')](_0x280296['interaction']['id'],_0x46e435)['then'](function(_0x347257){logger['info'](_0x0f3f('0xd'),_0x3ecf7f,_0x501ca0[0x1],_0x280296[_0x0f3f('0xe')],_0x280296[_0x0f3f('0xf')]['id']);})[_0x0f3f('0x10')](function(_0x26a5f6){logger[_0x0f3f('0x6')](_0x0f3f('0x11'),_0x3ecf7f,JSON['stringify'](_0x26a5f6));logger[_0x0f3f('0x8')](_0x0f3f('0x9'),_0x3ecf7f);})['finally'](function(){_0x28bba4[_0x0f3f('0xa')]();});}}}catch(_0x2b0435){logger['error'](_0x0f3f('0x11'),_0x3ecf7f,_[_0x0f3f('0x12')](_0x2b0435)?JSON[_0x0f3f('0x13')](_0x2b0435):_0x2b0435);logger[_0x0f3f('0x8')](_0x0f3f('0x9'),_0x3ecf7f);_0x28bba4[_0x0f3f('0xa')]();}};}; \ No newline at end of file +var _0x6b69=['channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x304320,_0x232a69){var _0xe607da=function(_0x2eb451){while(--_0x2eb451){_0x304320['push'](_0x304320['shift']());}};_0xe607da(++_0x232a69);}(_0x6b69,0xd5));var _0x96b6=function(_0x1ac609,_0x3ee19c){_0x1ac609=_0x1ac609-0x0;var _0x5ccf7e=_0x6b69[_0x1ac609];return _0x5ccf7e;};'use strict';var schema=require(_0x96b6('0x0'));var _=require(_0x96b6('0x1'));var rpc={'chatInteraction':require(_0x96b6('0x2')),'openchannelInteraction':require(_0x96b6('0x3')),'smsInteraction':require(_0x96b6('0x4')),'mailInteraction':require(_0x96b6('0x5')),'faxInteraction':require(_0x96b6('0x6')),'whatsappInteraction':require(_0x96b6('0x7'))};var logger=require(_0x96b6('0x8'))('routing');var tag=schema({'tag':{'type':_0x96b6('0x9'),'required':!![],'message':_0x96b6('0xa')}});exports[_0x96b6('0xb')]=function(_0x515f7d,_0x52b3a1,_0x16f8a0,_0x4c6b44){return function(_0x241120){try{var _0x21d4f9={'tag':_0x52b3a1[0x0]};var _0x17dbcb=tag['validate'](_0x21d4f9,{'typecast':!![]});if(_0x17dbcb[_0x96b6('0xc')]){logger['error'](_0x96b6('0xd'),_0x515f7d,_[_0x96b6('0xe')](_0x17dbcb,_0x96b6('0xf'))[_0x96b6('0x10')](',\x20'));logger[_0x96b6('0x11')](_0x96b6('0x12'),_0x515f7d);_0x241120['next']();}else{var _0x363c72={'ids':[_0x52b3a1[0x0]]};if(rpc[_0x4c6b44[_0x96b6('0x13')]+_0x96b6('0x14')]){rpc[_0x4c6b44[_0x96b6('0x13')]+_0x96b6('0x14')][_0x96b6('0x15')](_0x4c6b44['interaction']['id'],_0x363c72)['then'](function(_0x40b596){logger[_0x96b6('0x11')](_0x96b6('0x16'),_0x515f7d,_0x52b3a1[0x1],_0x4c6b44[_0x96b6('0x13')],_0x4c6b44['interaction']['id']);})[_0x96b6('0x17')](function(_0x1f2716){logger[_0x96b6('0x18')](_0x96b6('0xd'),_0x515f7d,JSON[_0x96b6('0x19')](_0x1f2716));logger[_0x96b6('0x11')](_0x96b6('0x12'),_0x515f7d);})[_0x96b6('0x1a')](function(){_0x241120[_0x96b6('0x1b')]();});}}}catch(_0x1e94c8){logger[_0x96b6('0x18')](_0x96b6('0xd'),_0x515f7d,_[_0x96b6('0x1c')](_0x1e94c8)?JSON['stringify'](_0x1e94c8):_0x1e94c8);logger[_0x96b6('0x11')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x515f7d);_0x241120['next']();}};}; \ 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 bf87eb9..f7fa521 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 _0x0207=['body','contact','message','account','lodash','render','merge'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x0207,0x162));var _0x7020=function(_0x571e40,_0x509406){_0x571e40=_0x571e40-0x0;var _0x10a95c=_0x0207[_0x571e40];return _0x10a95c;};'use strict';var Mustache=require('mustache');var _=require(_0x7020('0x0'));module['exports']={'getMustacheRender':function(_0x49775a,_0x1a481c){return Mustache[_0x7020('0x1')](_0x49775a,_[_0x7020('0x2')](_0x1a481c[_0x7020('0x3')],{'contact':_0x1a481c[_0x7020('0x4')],'message':_0x1a481c[_0x7020('0x5')],'account':_0x1a481c[_0x7020('0x6')],'interaction':_0x1a481c['interaction'],'list':_0x1a481c['list']}))||'';}}; \ No newline at end of file +var _0x84e1=['body','contact','message','account','interaction','list','mustache','lodash','exports','render'];(function(_0x119af6,_0x443ff5){var _0x14d28e=function(_0x1577f9){while(--_0x1577f9){_0x119af6['push'](_0x119af6['shift']());}};_0x14d28e(++_0x443ff5);}(_0x84e1,0x1dc));var _0x184e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x84e1[_0x4b055c];return _0x4b62bb;};'use strict';var Mustache=require(_0x184e('0x0'));var _=require(_0x184e('0x1'));module[_0x184e('0x2')]={'getMustacheRender':function(_0x1e7e1f,_0x324aaa){return Mustache[_0x184e('0x3')](_0x1e7e1f,_['merge'](_0x324aaa[_0x184e('0x4')],{'contact':_0x324aaa[_0x184e('0x5')],'message':_0x324aaa[_0x184e('0x6')],'account':_0x324aaa[_0x184e('0x7')],'interaction':_0x324aaa[_0x184e('0x8')],'list':_0x324aaa[_0x184e('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 982205a..e192b21 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 _0x4453=['QueueReport','update','catch','message\x20is\x20empty','agent','agents','busyQueue','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','hasOwnProperty','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','join','.js','app','toLowerCase','split','push','slice','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','end'];(function(_0x4ce637,_0x463346){var _0x2e9cba=function(_0x11f3d1){while(--_0x11f3d1){_0x4ce637['push'](_0x4ce637['shift']());}};_0x2e9cba(++_0x463346);}(_0x4453,0xd5));var _0x3445=function(_0x8fba1a,_0x274189){_0x8fba1a=_0x8fba1a-0x0;var _0x2f5c2d=_0x4453[_0x8fba1a];return _0x2f5c2d;};'use strict';var _=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var path=require(_0x3445('0x2'));var fs=require('fs');var jayson=require(_0x3445('0x3'));var BPromise=require(_0x3445('0x4'));var uuid=require(_0x3445('0x5'));var config=require(_0x3445('0x6'));var logger=require(_0x3445('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x3445('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x3445('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3445('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x5500a4,_0x1aba0a,_0x302191){return util[_0x3445('0xb')](_0x3445('0xc'),_0x5500a4,_0x1aba0a||0x0,_0x302191||0x0);}function getIntervals(_0xcd825a,_0x4c838c){var _0x44b512=[];if(!_[_0x3445('0xd')](_0x4c838c[_0x3445('0xe')])&&!_['isNil'](_0xcd825a[_0x4c838c[_0x3445('0xe')]])&&!_[_0x3445('0xd')](_0xcd825a[_0x4c838c[_0x3445('0xe')]][_0x3445('0xf')])){_0x44b512=_[_0x3445('0x10')](_0xcd825a[_0x4c838c[_0x3445('0xe')]][_0x3445('0xf')],_0x3445('0x11'));}else if(!_['isNil'](_0x4c838c['interval'])){_0x44b512=[_0x4c838c['interval']];}return _0x44b512;}exports[_0x3445('0x12')]=function(_0x281c47){_0x281c47[_0x3445('0x13')]={};return new BPromise(function(_0x21b269,_0x577446){var _0x54b0c8={'Start':function(_0x6a9ba7){var _0x2b4984=this;return new Promise(function(_0x33f0d0,_0x3477e2){if(_0x6a9ba7){try{var _0x112c39=[];var _0x231ca6=getId(_0x6a9ba7[_0x3445('0x14')],_0x6a9ba7[_0x3445('0x15')]?_0x6a9ba7[_0x3445('0x15')]['id']:0x0,_0x6a9ba7[_0x3445('0x16')]?_0x6a9ba7[_0x3445('0x16')]['id']:0x0);if(_0x6a9ba7['applications']&&_[_0x3445('0x17')](_0x6a9ba7[_0x3445('0x18')])&&_0x6a9ba7[_0x3445('0x18')][_0x3445('0x19')]){for(var _0x439f8a=0x0;_0x439f8a<_0x6a9ba7[_0x3445('0x18')]['length'];_0x439f8a+=0x1){var _0x1a6a89=_0x6a9ba7['applications'][_0x439f8a];if(fs['existsSync'](path[_0x3445('0x1a')](__dirname,_0x3445('0x18'),_0x1a6a89['app']+_0x3445('0x1b')))){var _0x3fbc91=[];switch(_0x1a6a89[_0x3445('0x1c')][_0x3445('0x1d')]()){case'autoreply':var _0x2f89a4=_0x1a6a89['appdata'][_0x3445('0x1e')](',');_0x3fbc91[_0x3445('0x1f')](_0x2f89a4[0x0]);_0x3fbc91['push'](_0x2f89a4[_0x3445('0x20')](0x1,_0x2f89a4[_0x3445('0x19')])[_0x3445('0x1a')](','));break;case _0x3445('0x21'):var _0x26f78f=_0x1a6a89[_0x3445('0x22')][_0x3445('0x1e')](',');_0x3fbc91[_0x3445('0x1f')](_0x26f78f[0x0]);_0x3fbc91[_0x3445('0x1f')](_0x26f78f[0x1]);_0x3fbc91[_0x3445('0x1f')](_0x26f78f[_0x3445('0x20')](0x2,_0x26f78f[_0x3445('0x19')])[_0x3445('0x1a')](','));break;case _0x3445('0x23'):var _0x138986=_0x1a6a89[_0x3445('0x22')][_0x3445('0x1e')](',');_0x3fbc91[_0x3445('0x1f')](_0x138986[0x0]);_0x3fbc91[_0x3445('0x1f')](_0x138986[0x1]);_0x3fbc91['push'](_0x138986[0x2]);_0x3fbc91[_0x3445('0x1f')](_0x138986[0x3]);_0x3fbc91[_0x3445('0x1f')](_0x138986[_0x3445('0x20')](0x4,_0x138986['length'])[_0x3445('0x1a')](','));break;case _0x3445('0x15'):_0x3fbc91[_0x3445('0x1f')](_0x1a6a89[_0x3445('0x22')]);break;case _0x3445('0x24'):_0x3fbc91['push'](_0x1a6a89[_0x3445('0x25')]);_0x3fbc91[_0x3445('0x1f')](_0x1a6a89[_0x3445('0x22')]);break;default:_0x3fbc91=_[_0x3445('0xd')](_0x1a6a89['appdata'])?[]:_0x1a6a89[_0x3445('0x22')]['split'](',');}var _0xecdbc3={'id':util[_0x3445('0xb')](_0x3445('0x26'),_0x231ca6,_0x1a6a89['id'],_0x1a6a89[_0x3445('0x1c')]),'condition':require(_0x3445('0x27'))['condition'](_0x231ca6,getIntervals(_0x281c47[_0x3445('0x28')],_0x1a6a89),_0x281c47),'consequence':require(_0x3445('0x29')+_0x1a6a89[_0x3445('0x1c')])[_0x3445('0x2a')](_0x231ca6,_0x3fbc91,_0x281c47,_0x6a9ba7),'p':_0x1a6a89[_0x3445('0x2b')]||0x0};logger['info'](_0x3445('0x2c'),_0xecdbc3['id'],'on\x20interval',getIntervals(_0x281c47[_0x3445('0x28')],_0x1a6a89)[_0x3445('0x1a')](_0x3445('0x2d')));_0x112c39[_0x3445('0x1f')](_0xecdbc3);}else{logger[_0x3445('0x2e')](_0x3445('0x2f'),path[_0x3445('0x1a')](__dirname,'applications',_0x1a6a89[_0x3445('0x1c')]+_0x3445('0x1b')));}}_0x281c47[_0x3445('0x13')][_0x231ca6]=new RuleEngine(_0x112c39);_0x281c47[_0x3445('0x13')][_0x231ca6][_0x3445('0x30')](_0x6a9ba7,function(_0x2cd73d){logger[_0x3445('0x31')](_0x3445('0x32'),JSON[_0x3445('0x33')](_0x2cd73d['matchPath']));if(_0x281c47[_0x3445('0x13')][_0x231ca6]){_0x281c47[_0x3445('0x13')][_0x231ca6][_0x3445('0x34')](_0x3445('0x35'));}});return _0x33f0d0({'code':0xc8,'message':_0x6a9ba7});}else{logger[_0x3445('0x31')](_0x3445('0x36'));return _0x33f0d0({'code':0xc8,'message':_0x6a9ba7});}}catch(_0x53174f){logger[_0x3445('0x2e')](_0x53174f[_0x3445('0x37')]);return _0x3477e2(_0x2b4984[_0x3445('0x2e')](0x1f4,_0x53174f));}}return _0x3477e2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5bd2ac){var _0x33b477=this;return new Promise(function(_0x2fe917,_0x50ed63){if(_0x5bd2ac[_0x3445('0x15')]&&_0x5bd2ac['message']['id']){try{var _0x37b6f1=getId(_0x5bd2ac[_0x3445('0x14')],_0x5bd2ac[_0x3445('0x15')]?_0x5bd2ac[_0x3445('0x15')]['id']:0x0,_0x5bd2ac[_0x3445('0x16')]?_0x5bd2ac[_0x3445('0x16')]['id']:0x0);if(_0x281c47['rules'][_0x37b6f1]){_0x281c47[_0x3445('0x13')][_0x37b6f1][_0x3445('0x34')](_0x3445('0x38'));if(rpc[_0x5bd2ac[_0x3445('0x14')]+'QueueReport']){rpc[_0x5bd2ac[_0x3445('0x14')]+_0x3445('0x39')][_0x3445('0x3a')](_0x37b6f1,{'UserId':_0x5bd2ac['message']['UserId']})[_0x3445('0x3b')](function(_0x1f6404){logger['error']('error\x20update\x20queue\x20report');});}}return _0x2fe917({'code':0xc8,'message':_0x5bd2ac});}catch(_0x295f86){logger[_0x3445('0x2e')](_0x295f86[_0x3445('0x37')]);return _0x50ed63(_0x33b477[_0x3445('0x2e')](0x1f4,_0x295f86));}}logger[_0x3445('0x2e')](_0x3445('0x3c'));return _0x50ed63(_0x33b477['error'](0x1f4,_0x3445('0x3c')));});},'RejectMessage':function(_0x115d77){var _0x1c7a19=this;return new Promise(function(_0x38c4b5,_0x43402a){if(_0x115d77[_0x3445('0x3d')]&&_0x115d77[_0x3445('0x3d')]['id']){try{if(_0x281c47['agents'][_0x115d77[_0x3445('0x3d')]['id']]){_0x281c47[_0x3445('0x3e')][_0x115d77[_0x3445('0x3d')]['id']]['busy']=![];_0x281c47[_0x3445('0x3e')][_0x115d77[_0x3445('0x3d')]['id']][_0x3445('0x3f')]=undefined;}return _0x38c4b5({'code':0xc8,'message':_0x115d77});}catch(_0x4799f5){logger[_0x3445('0x2e')](_0x4799f5[_0x3445('0x37')]);return _0x43402a(_0x1c7a19[_0x3445('0x2e')](0x1f4,_0x4799f5));}}logger[_0x3445('0x2e')](_0x3445('0x3c'));return _0x43402a(_0x1c7a19[_0x3445('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3099ff){var _0x4c547e=this;return new Promise(function(_0x3aeead,_0x27bb9d){if(_0x3099ff[_0x3445('0x14')]&&_0x3099ff[_0x3445('0x16')]&&_0x3099ff[_0x3445('0x16')]['id']){try{var _0x44792f=getId(_0x3099ff[_0x3445('0x14')],_0x3099ff[_0x3445('0x15')]?_0x3099ff[_0x3445('0x15')]['id']:0x0,_0x3099ff[_0x3445('0x16')]?_0x3099ff['interaction']['id']:0x0);if(_0x281c47['rules'][_0x44792f]){_0x281c47[_0x3445('0x13')][_0x44792f][_0x3445('0x34')](_0x3445('0x38'));}return _0x3aeead({'code':0xc8,'message':_0x3099ff});}catch(_0x4ab00c){logger['error'](_0x4ab00c[_0x3445('0x37')]);return _0x27bb9d(_0x4c547e[_0x3445('0x2e')](0x1f4,_0x4ab00c));}}logger['error']('message\x20is\x20empty');return _0x27bb9d(_0x4c547e[_0x3445('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x5b42ac){var _0x18ec15=this;return new Promise(function(_0x4e5646,_0x5ac383){if(_0x281c47[_0x3445('0x3e')]['hasOwnProperty'](_0x5b42ac['id'])){for(var _0x2ab30b in _0x5b42ac[_0x3445('0x40')]){if(_0x5b42ac[_0x3445('0x40')]['hasOwnProperty'](_0x2ab30b)){if(_0x281c47['agents'][_0x5b42ac['id']]['hasOwnProperty'](_0x2ab30b+_0x3445('0x41'))){_0x281c47['agents'][_0x5b42ac['id']][_0x2ab30b+_0x3445('0x41')]=parseInt(_0x5b42ac[_0x3445('0x40')][_0x2ab30b],0xa);}}}_0x281c47[_0x3445('0x3e')][_0x5b42ac['id']][_0x3445('0x42')]();return _0x4e5646({'code':0xc8,'message':_0x281c47['agents'][_0x5b42ac['id']]});}else{return _0x5ac383(_0x18ec15[_0x3445('0x2e')](0x1f4,_0x3445('0x43')));}});},'Agents':function(_0x25dac8){return new Promise(function(_0x47b0b5,_0xdfc894){var _0x3b92ad=_[_0x3445('0x44')](_0x281c47[_0x3445('0x3e')]);_0x47b0b5({'count':_0x3b92ad[_0x3445('0x19')],'rows':_0x3b92ad});});},'ChatQueues':function(_0x3bfe58){return new Promise(function(_0x19cf61,_0x5c2a11){var _0x2a7672=[];for(var _0x2f9796 in _0x281c47[_0x3445('0x45')]){if(_0x281c47[_0x3445('0x45')][_0x3445('0x46')](_0x2f9796)){var _0x24d80a=_0x281c47[_0x3445('0x45')][_0x2f9796];var _0x4f7bac={'id':_0x24d80a['id'],'available':_0x24d80a['available'],'loggedIn':_0x24d80a[_0x3445('0x47')],'name':_0x24d80a[_0x3445('0x48')],'paused':_0x24d80a[_0x3445('0x49')],'waiting':_0x24d80a[_0x3445('0x4a')]};_0x2a7672['push'](_0x4f7bac);}}_0x19cf61({'count':_0x2a7672['length'],'rows':_0x2a7672});});},'MailQueues':function(_0x4edc6d){return new Promise(function(_0xee9991,_0x3fdcb7){var _0x44b0d4=[];for(var _0x289407 in _0x281c47['mailQueues']){if(_0x281c47[_0x3445('0x4b')][_0x3445('0x46')](_0x289407)){var _0x41d264=_0x281c47[_0x3445('0x4b')][_0x289407];var _0x3df19d={'id':_0x41d264['id'],'available':_0x41d264['available'],'loggedIn':_0x41d264[_0x3445('0x47')],'name':_0x41d264[_0x3445('0x48')],'paused':_0x41d264[_0x3445('0x49')],'waiting':_0x41d264[_0x3445('0x4a')]};_0x44b0d4[_0x3445('0x1f')](_0x3df19d);}}_0xee9991({'count':_0x44b0d4['length'],'rows':_0x44b0d4});});},'OpenchannelQueues':function(_0x2ebcc6){return new Promise(function(_0x3ba3c1,_0x84fe15){var _0x1ec055=[];for(var _0x1fd776 in _0x281c47[_0x3445('0x4c')]){if(_0x281c47[_0x3445('0x4c')]['hasOwnProperty'](_0x1fd776)){var _0x344633=_0x281c47[_0x3445('0x4c')][_0x1fd776];var _0x568eb8={'id':_0x344633['id'],'available':_0x344633[_0x3445('0x4d')],'loggedIn':_0x344633['loggedIn'],'name':_0x344633['name'],'paused':_0x344633[_0x3445('0x49')],'waiting':_0x344633[_0x3445('0x4a')]};_0x1ec055[_0x3445('0x1f')](_0x568eb8);}}_0x3ba3c1({'count':_0x1ec055[_0x3445('0x19')],'rows':_0x1ec055});});},'SmsQueues':function(_0x4f2db4){return new Promise(function(_0x4ab090,_0x373c2a){var _0x571eb4=[];for(var _0x11e74a in _0x281c47[_0x3445('0x4e')]){if(_0x281c47[_0x3445('0x4e')][_0x3445('0x46')](_0x11e74a)){var _0x5a586a=_0x281c47[_0x3445('0x4e')][_0x11e74a];var _0x1600b3={'id':_0x5a586a['id'],'available':_0x5a586a['available'],'loggedIn':_0x5a586a['loggedIn'],'name':_0x5a586a[_0x3445('0x48')],'paused':_0x5a586a[_0x3445('0x49')],'waiting':_0x5a586a[_0x3445('0x4a')]};_0x571eb4[_0x3445('0x1f')](_0x1600b3);}}_0x4ab090({'count':_0x571eb4[_0x3445('0x19')],'rows':_0x571eb4});});},'FaxQueues':function(_0x1bc832){return new Promise(function(_0x54d221,_0x38e6d5){var _0x298ea0=[];for(var _0x2aa136 in _0x281c47[_0x3445('0x4f')]){if(_0x281c47[_0x3445('0x4f')]['hasOwnProperty'](_0x2aa136)){var _0x36214d=_0x281c47[_0x3445('0x4f')][_0x2aa136];var _0x4a5e13={'id':_0x36214d['id'],'available':_0x36214d[_0x3445('0x4d')],'loggedIn':_0x36214d[_0x3445('0x47')],'name':_0x36214d[_0x3445('0x48')],'paused':_0x36214d['paused'],'waiting':_0x36214d[_0x3445('0x4a')]};_0x298ea0[_0x3445('0x1f')](_0x4a5e13);}}_0x54d221({'count':_0x298ea0[_0x3445('0x19')],'rows':_0x298ea0});});},'WhatsappQueues':function(_0x2e1196){return new Promise(function(_0x59609f,_0x438d9d){var _0x3e7787=[];for(var _0x519fb2 in _0x281c47[_0x3445('0x50')]){if(_0x281c47[_0x3445('0x50')]['hasOwnProperty'](_0x519fb2)){var _0x3f10ed=_0x281c47[_0x3445('0x50')][_0x519fb2];var _0x22d08a={'id':_0x3f10ed['id'],'available':_0x3f10ed[_0x3445('0x4d')],'loggedIn':_0x3f10ed['loggedIn'],'name':_0x3f10ed[_0x3445('0x48')],'paused':_0x3f10ed['paused'],'waiting':_0x3f10ed[_0x3445('0x4a')]};_0x3e7787[_0x3445('0x1f')](_0x22d08a);}}_0x59609f({'count':_0x3e7787['length'],'rows':_0x3e7787});});},'ChatQueuesWaitingInteractions':function(_0x52436f){return new Promise(function(_0x270aee,_0x3e02ee){var _0x3bca72=_['values'](_0x281c47[_0x3445('0x51')]);_0x270aee({'count':_0x3bca72[_0x3445('0x19')],'rows':_0x3bca72});});},'MailQueuesWaitingInteractions':function(_0x49c8d7){return new Promise(function(_0x5459d4,_0x311ba1){var _0x2b02e1=_[_0x3445('0x44')](_0x281c47['mailQueuesWaitingInteractions']);_0x5459d4({'count':_0x2b02e1[_0x3445('0x19')],'rows':_0x2b02e1});});},'OpenchannelQueuesWaitingInteractions':function(_0xeb1182){return new Promise(function(_0x4390c1,_0x4834c3){var _0x35ec6f=_[_0x3445('0x44')](_0x281c47[_0x3445('0x52')]);_0x4390c1({'count':_0x35ec6f[_0x3445('0x19')],'rows':_0x35ec6f});});},'SmsQueuesWaitingInteractions':function(_0x35161d){return new Promise(function(_0x2713d1,_0x42126a){var _0x46176d=_['values'](_0x281c47[_0x3445('0x53')]);_0x2713d1({'count':_0x46176d[_0x3445('0x19')],'rows':_0x46176d});});},'FaxQueuesWaitingInteractions':function(_0x477030){return new Promise(function(_0x5c5283,_0x5dcefc){var _0x5bdffb=_[_0x3445('0x44')](_0x281c47[_0x3445('0x54')]);_0x5c5283({'count':_0x5bdffb[_0x3445('0x19')],'rows':_0x5bdffb});});},'WhatsappQueuesWaitingInteractions':function(_0x4f75fb){return new Promise(function(_0x49859f,_0x3ee081){var _0x129159=_[_0x3445('0x44')](_0x281c47['whatsappQueuesWaitingInteractions']);_0x49859f({'count':_0x129159[_0x3445('0x19')],'rows':_0x129159});});}};var _0x875fd3=jayson[_0x3445('0x55')](_0x54b0c8)[_0x3445('0x56')]();_0x875fd3['on'](_0x3445('0x2e'),function(_0x397c54){logger[_0x3445('0x2e')](JSON[_0x3445('0x33')](_0x397c54));return _0x577446(_0x397c54);});_0x875fd3['listen'](0x232c,_0x3445('0x57'),function(){console[_0x3445('0x58')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x21b269(_0x3445('0x59')+0x232c);});});}; \ No newline at end of file +var _0x921d=['UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','appdata','split','push','slice','join','dialogflow','amazonlex','%s:%s:%s','./interval','intervals','consequence','priority','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','channel','end','QueueReport','update'];(function(_0x57cb4f,_0x29cd98){var _0x5852a5=function(_0x32975a){while(--_0x32975a){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x5852a5(++_0x29cd98);}(_0x921d,0x18a));var _0xd921=function(_0x4318f0,_0xbc6b08){_0x4318f0=_0x4318f0-0x0;var _0x2fb9b4=_0x921d[_0x4318f0];return _0x2fb9b4;};'use strict';var _=require('lodash');var util=require(_0xd921('0x0'));var path=require(_0xd921('0x1'));var fs=require('fs');var jayson=require(_0xd921('0x2'));var BPromise=require(_0xd921('0x3'));var uuid=require(_0xd921('0x4'));var config=require('../../../config/environment');var logger=require(_0xd921('0x5'))(_0xd921('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xd921('0x7')),'chatQueueReport':require(_0xd921('0x8')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xd921('0x9')),'whatsappQueueReport':require(_0xd921('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xe32f20,_0x32df71,_0x4b9f06){return util[_0xd921('0xb')](_0xd921('0xc'),_0xe32f20,_0x32df71||0x0,_0x4b9f06||0x0);}function getIntervals(_0x5cec12,_0x48690b){var _0xfd2b15=[];if(!_[_0xd921('0xd')](_0x48690b[_0xd921('0xe')])&&!_['isNil'](_0x5cec12[_0x48690b[_0xd921('0xe')]])&&!_[_0xd921('0xd')](_0x5cec12[_0x48690b[_0xd921('0xe')]][_0xd921('0xf')])){_0xfd2b15=_[_0xd921('0x10')](_0x5cec12[_0x48690b[_0xd921('0xe')]][_0xd921('0xf')],_0xd921('0x11'));}else if(!_[_0xd921('0xd')](_0x48690b['interval'])){_0xfd2b15=[_0x48690b['interval']];}return _0xfd2b15;}exports[_0xd921('0x12')]=function(_0x216b02){_0x216b02[_0xd921('0x13')]={};return new BPromise(function(_0x5df2f9,_0x4aab67){var _0x54531d={'Start':function(_0x162b88){var _0x3c4716=this;return new Promise(function(_0xf7c975,_0xaa99cc){if(_0x162b88){try{var _0x33b25f=[];var _0x43bf6b=getId(_0x162b88['channel'],_0x162b88[_0xd921('0x14')]?_0x162b88[_0xd921('0x14')]['id']:0x0,_0x162b88[_0xd921('0x15')]?_0x162b88[_0xd921('0x15')]['id']:0x0);if(_0x162b88[_0xd921('0x16')]&&_[_0xd921('0x17')](_0x162b88[_0xd921('0x16')])&&_0x162b88['applications']['length']){for(var _0x22e5db=0x0;_0x22e5db<_0x162b88[_0xd921('0x16')][_0xd921('0x18')];_0x22e5db+=0x1){var _0x4527ee=_0x162b88[_0xd921('0x16')][_0x22e5db];if(fs[_0xd921('0x19')](path['join'](__dirname,_0xd921('0x16'),_0x4527ee[_0xd921('0x1a')]+_0xd921('0x1b')))){var _0x5c417d=[];switch(_0x4527ee[_0xd921('0x1a')][_0xd921('0x1c')]()){case'autoreply':var _0x3dd114=_0x4527ee[_0xd921('0x1d')][_0xd921('0x1e')](',');_0x5c417d[_0xd921('0x1f')](_0x3dd114[0x0]);_0x5c417d[_0xd921('0x1f')](_0x3dd114[_0xd921('0x20')](0x1,_0x3dd114[_0xd921('0x18')])[_0xd921('0x21')](','));break;case _0xd921('0x22'):var _0x3f77dc=_0x4527ee[_0xd921('0x1d')][_0xd921('0x1e')](',');_0x5c417d['push'](_0x3f77dc[0x0]);_0x5c417d[_0xd921('0x1f')](_0x3f77dc[0x1]);_0x5c417d[_0xd921('0x1f')](_0x3f77dc['slice'](0x2,_0x3f77dc[_0xd921('0x18')])[_0xd921('0x21')](','));break;case _0xd921('0x23'):var _0x4bfedf=_0x4527ee[_0xd921('0x1d')]['split'](',');_0x5c417d[_0xd921('0x1f')](_0x4bfedf[0x0]);_0x5c417d['push'](_0x4bfedf[0x1]);_0x5c417d['push'](_0x4bfedf[0x2]);_0x5c417d['push'](_0x4bfedf[0x3]);_0x5c417d['push'](_0x4bfedf['slice'](0x4,_0x4bfedf['length'])[_0xd921('0x21')](','));break;case _0xd921('0x14'):_0x5c417d[_0xd921('0x1f')](_0x4527ee[_0xd921('0x1d')]);break;case'tag':_0x5c417d[_0xd921('0x1f')](_0x4527ee['TagId']);_0x5c417d[_0xd921('0x1f')](_0x4527ee['appdata']);break;default:_0x5c417d=_[_0xd921('0xd')](_0x4527ee[_0xd921('0x1d')])?[]:_0x4527ee[_0xd921('0x1d')][_0xd921('0x1e')](',');}var _0x5c1e3b={'id':util[_0xd921('0xb')](_0xd921('0x24'),_0x43bf6b,_0x4527ee['id'],_0x4527ee[_0xd921('0x1a')]),'condition':require(_0xd921('0x25'))['condition'](_0x43bf6b,getIntervals(_0x216b02[_0xd921('0x26')],_0x4527ee),_0x216b02),'consequence':require('./applications/'+_0x4527ee[_0xd921('0x1a')])[_0xd921('0x27')](_0x43bf6b,_0x5c417d,_0x216b02,_0x162b88),'p':_0x4527ee[_0xd921('0x28')]||0x0};logger[_0xd921('0x29')](_0xd921('0x2a'),_0x5c1e3b['id'],'on\x20interval',getIntervals(_0x216b02[_0xd921('0x26')],_0x4527ee)[_0xd921('0x21')]('\x20|\x20'));_0x33b25f['push'](_0x5c1e3b);}else{logger[_0xd921('0x2b')](_0xd921('0x2c'),path['join'](__dirname,_0xd921('0x16'),_0x4527ee['app']+_0xd921('0x1b')));}}_0x216b02[_0xd921('0x13')][_0x43bf6b]=new RuleEngine(_0x33b25f);_0x216b02[_0xd921('0x13')][_0x43bf6b][_0xd921('0x2d')](_0x162b88,function(_0x10c1e8){logger[_0xd921('0x29')](_0xd921('0x2e'),JSON[_0xd921('0x2f')](_0x10c1e8[_0xd921('0x30')]));if(_0x216b02[_0xd921('0x13')][_0x43bf6b]){_0x216b02[_0xd921('0x13')][_0x43bf6b][_0xd921('0x31')](_0xd921('0x32'));}});return _0xf7c975({'code':0xc8,'message':_0x162b88});}else{logger[_0xd921('0x29')](_0xd921('0x33'));return _0xf7c975({'code':0xc8,'message':_0x162b88});}}catch(_0x276040){logger[_0xd921('0x2b')](_0x276040['stack']);return _0xaa99cc(_0x3c4716['error'](0x1f4,_0x276040));}}return _0xaa99cc('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5a4dfd){var _0x3d70f6=this;return new Promise(function(_0x58f3a9,_0x518aac){if(_0x5a4dfd[_0xd921('0x14')]&&_0x5a4dfd[_0xd921('0x14')]['id']){try{var _0x2156fa=getId(_0x5a4dfd[_0xd921('0x34')],_0x5a4dfd[_0xd921('0x14')]?_0x5a4dfd[_0xd921('0x14')]['id']:0x0,_0x5a4dfd[_0xd921('0x15')]?_0x5a4dfd[_0xd921('0x15')]['id']:0x0);if(_0x216b02[_0xd921('0x13')][_0x2156fa]){_0x216b02[_0xd921('0x13')][_0x2156fa][_0xd921('0x31')](_0xd921('0x35'));if(rpc[_0x5a4dfd[_0xd921('0x34')]+'QueueReport']){rpc[_0x5a4dfd['channel']+_0xd921('0x36')][_0xd921('0x37')](_0x2156fa,{'UserId':_0x5a4dfd[_0xd921('0x14')][_0xd921('0x38')]})[_0xd921('0x39')](function(_0x237c6c){logger['error'](_0xd921('0x3a'));});}}return _0x58f3a9({'code':0xc8,'message':_0x5a4dfd});}catch(_0xdd22a4){logger[_0xd921('0x2b')](_0xdd22a4[_0xd921('0x3b')]);return _0x518aac(_0x3d70f6[_0xd921('0x2b')](0x1f4,_0xdd22a4));}}logger[_0xd921('0x2b')](_0xd921('0x3c'));return _0x518aac(_0x3d70f6[_0xd921('0x2b')](0x1f4,_0xd921('0x3c')));});},'RejectMessage':function(_0x501b58){var _0x41dd63=this;return new Promise(function(_0x1202b3,_0x24edca){if(_0x501b58[_0xd921('0x3d')]&&_0x501b58['agent']['id']){try{if(_0x216b02[_0xd921('0x3e')][_0x501b58[_0xd921('0x3d')]['id']]){_0x216b02[_0xd921('0x3e')][_0x501b58['agent']['id']][_0xd921('0x3f')]=![];_0x216b02[_0xd921('0x3e')][_0x501b58[_0xd921('0x3d')]['id']][_0xd921('0x40')]=undefined;}return _0x1202b3({'code':0xc8,'message':_0x501b58});}catch(_0x325987){logger[_0xd921('0x2b')](_0x325987[_0xd921('0x3b')]);return _0x24edca(_0x41dd63[_0xd921('0x2b')](0x1f4,_0x325987));}}logger[_0xd921('0x2b')](_0xd921('0x3c'));return _0x24edca(_0x41dd63[_0xd921('0x2b')](0x1f4,_0xd921('0x3c')));});},'AbandonInteraction':function(_0x2afb1b){var _0x1cbd8c=this;return new Promise(function(_0x544a47,_0x3fc571){if(_0x2afb1b[_0xd921('0x34')]&&_0x2afb1b[_0xd921('0x15')]&&_0x2afb1b['interaction']['id']){try{var _0x2374f9=getId(_0x2afb1b[_0xd921('0x34')],_0x2afb1b[_0xd921('0x14')]?_0x2afb1b['message']['id']:0x0,_0x2afb1b[_0xd921('0x15')]?_0x2afb1b[_0xd921('0x15')]['id']:0x0);if(_0x216b02[_0xd921('0x13')][_0x2374f9]){_0x216b02[_0xd921('0x13')][_0x2374f9][_0xd921('0x31')](_0xd921('0x35'));}return _0x544a47({'code':0xc8,'message':_0x2afb1b});}catch(_0x2ae643){logger['error'](_0x2ae643['stack']);return _0x3fc571(_0x1cbd8c[_0xd921('0x2b')](0x1f4,_0x2ae643));}}logger['error'](_0xd921('0x3c'));return _0x3fc571(_0x1cbd8c[_0xd921('0x2b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x369f61){var _0xd18106=this;return new Promise(function(_0x379bfe,_0x1de800){if(_0x216b02[_0xd921('0x3e')]['hasOwnProperty'](_0x369f61['id'])){for(var _0xa429dd in _0x369f61[_0xd921('0x41')]){if(_0x369f61[_0xd921('0x41')][_0xd921('0x42')](_0xa429dd)){if(_0x216b02['agents'][_0x369f61['id']]['hasOwnProperty'](_0xa429dd+'CurrentCapacity')){_0x216b02['agents'][_0x369f61['id']][_0xa429dd+_0xd921('0x43')]=parseInt(_0x369f61[_0xd921('0x41')][_0xa429dd],0xa);}}}_0x216b02[_0xd921('0x3e')][_0x369f61['id']][_0xd921('0x44')]();return _0x379bfe({'code':0xc8,'message':_0x216b02['agents'][_0x369f61['id']]});}else{return _0x1de800(_0xd18106['error'](0x1f4,_0xd921('0x45')));}});},'Agents':function(_0x56be2f){return new Promise(function(_0x3cc824,_0x257216){var _0x558a92=_[_0xd921('0x46')](_0x216b02[_0xd921('0x3e')]);_0x3cc824({'count':_0x558a92['length'],'rows':_0x558a92});});},'ChatQueues':function(_0x417485){return new Promise(function(_0xd68b56,_0x378089){var _0x742ac5=[];for(var _0x5a115a in _0x216b02['chatQueues']){if(_0x216b02['chatQueues'][_0xd921('0x42')](_0x5a115a)){var _0x23ded4=_0x216b02[_0xd921('0x47')][_0x5a115a];var _0x182743={'id':_0x23ded4['id'],'available':_0x23ded4['available'],'loggedIn':_0x23ded4[_0xd921('0x48')],'name':_0x23ded4[_0xd921('0x49')],'paused':_0x23ded4[_0xd921('0x4a')],'waiting':_0x23ded4[_0xd921('0x4b')]};_0x742ac5[_0xd921('0x1f')](_0x182743);}}_0xd68b56({'count':_0x742ac5['length'],'rows':_0x742ac5});});},'MailQueues':function(_0x187728){return new Promise(function(_0x4a17f0,_0xbf846f){var _0x36299d=[];for(var _0x4694eb in _0x216b02[_0xd921('0x4c')]){if(_0x216b02[_0xd921('0x4c')][_0xd921('0x42')](_0x4694eb)){var _0x144e12=_0x216b02[_0xd921('0x4c')][_0x4694eb];var _0x290361={'id':_0x144e12['id'],'available':_0x144e12[_0xd921('0x4d')],'loggedIn':_0x144e12['loggedIn'],'name':_0x144e12[_0xd921('0x49')],'paused':_0x144e12[_0xd921('0x4a')],'waiting':_0x144e12[_0xd921('0x4b')]};_0x36299d['push'](_0x290361);}}_0x4a17f0({'count':_0x36299d['length'],'rows':_0x36299d});});},'OpenchannelQueues':function(_0x5ef3f6){return new Promise(function(_0x4d68b1,_0x18aeb9){var _0x67a29b=[];for(var _0x5124fa in _0x216b02['openchannelQueues']){if(_0x216b02[_0xd921('0x4e')][_0xd921('0x42')](_0x5124fa)){var _0x3de4a4=_0x216b02[_0xd921('0x4e')][_0x5124fa];var _0x1472b8={'id':_0x3de4a4['id'],'available':_0x3de4a4[_0xd921('0x4d')],'loggedIn':_0x3de4a4[_0xd921('0x48')],'name':_0x3de4a4[_0xd921('0x49')],'paused':_0x3de4a4[_0xd921('0x4a')],'waiting':_0x3de4a4[_0xd921('0x4b')]};_0x67a29b[_0xd921('0x1f')](_0x1472b8);}}_0x4d68b1({'count':_0x67a29b[_0xd921('0x18')],'rows':_0x67a29b});});},'SmsQueues':function(_0x17a92f){return new Promise(function(_0x268d70,_0x57ba71){var _0x3ef4a3=[];for(var _0x523552 in _0x216b02[_0xd921('0x4f')]){if(_0x216b02['smsQueues'][_0xd921('0x42')](_0x523552)){var _0x3dd034=_0x216b02[_0xd921('0x4f')][_0x523552];var _0x3411f9={'id':_0x3dd034['id'],'available':_0x3dd034[_0xd921('0x4d')],'loggedIn':_0x3dd034[_0xd921('0x48')],'name':_0x3dd034[_0xd921('0x49')],'paused':_0x3dd034[_0xd921('0x4a')],'waiting':_0x3dd034[_0xd921('0x4b')]};_0x3ef4a3[_0xd921('0x1f')](_0x3411f9);}}_0x268d70({'count':_0x3ef4a3[_0xd921('0x18')],'rows':_0x3ef4a3});});},'FaxQueues':function(_0x396f6a){return new Promise(function(_0x45c317,_0x393b3b){var _0x19fce3=[];for(var _0x435239 in _0x216b02['faxQueues']){if(_0x216b02[_0xd921('0x50')][_0xd921('0x42')](_0x435239)){var _0x4b37c1=_0x216b02['faxQueues'][_0x435239];var _0x2f6b52={'id':_0x4b37c1['id'],'available':_0x4b37c1[_0xd921('0x4d')],'loggedIn':_0x4b37c1[_0xd921('0x48')],'name':_0x4b37c1[_0xd921('0x49')],'paused':_0x4b37c1[_0xd921('0x4a')],'waiting':_0x4b37c1[_0xd921('0x4b')]};_0x19fce3[_0xd921('0x1f')](_0x2f6b52);}}_0x45c317({'count':_0x19fce3[_0xd921('0x18')],'rows':_0x19fce3});});},'WhatsappQueues':function(_0x435435){return new Promise(function(_0x3ee3ae,_0x4ae380){var _0x1fead3=[];for(var _0x53edb7 in _0x216b02[_0xd921('0x51')]){if(_0x216b02[_0xd921('0x51')]['hasOwnProperty'](_0x53edb7)){var _0x1a3098=_0x216b02['whatsappQueues'][_0x53edb7];var _0x10aeee={'id':_0x1a3098['id'],'available':_0x1a3098[_0xd921('0x4d')],'loggedIn':_0x1a3098['loggedIn'],'name':_0x1a3098['name'],'paused':_0x1a3098[_0xd921('0x4a')],'waiting':_0x1a3098[_0xd921('0x4b')]};_0x1fead3[_0xd921('0x1f')](_0x10aeee);}}_0x3ee3ae({'count':_0x1fead3[_0xd921('0x18')],'rows':_0x1fead3});});},'ChatQueuesWaitingInteractions':function(_0x1c59fd){return new Promise(function(_0x5cf305,_0x51a44b){var _0x4d3458=_[_0xd921('0x46')](_0x216b02[_0xd921('0x52')]);_0x5cf305({'count':_0x4d3458[_0xd921('0x18')],'rows':_0x4d3458});});},'MailQueuesWaitingInteractions':function(_0xc653b7){return new Promise(function(_0x5ce698,_0x11618f){var _0x21ff9c=_[_0xd921('0x46')](_0x216b02['mailQueuesWaitingInteractions']);_0x5ce698({'count':_0x21ff9c[_0xd921('0x18')],'rows':_0x21ff9c});});},'OpenchannelQueuesWaitingInteractions':function(_0x43f214){return new Promise(function(_0x62c3f7,_0x206716){var _0x43c22a=_[_0xd921('0x46')](_0x216b02[_0xd921('0x53')]);_0x62c3f7({'count':_0x43c22a[_0xd921('0x18')],'rows':_0x43c22a});});},'SmsQueuesWaitingInteractions':function(_0x241c9a){return new Promise(function(_0x6a2196,_0x2016df){var _0x405e4a=_['values'](_0x216b02[_0xd921('0x54')]);_0x6a2196({'count':_0x405e4a[_0xd921('0x18')],'rows':_0x405e4a});});},'FaxQueuesWaitingInteractions':function(_0x2e8ff4){return new Promise(function(_0x3e571e,_0x5ee0c5){var _0x296d45=_[_0xd921('0x46')](_0x216b02[_0xd921('0x55')]);_0x3e571e({'count':_0x296d45['length'],'rows':_0x296d45});});},'WhatsappQueuesWaitingInteractions':function(_0x460c48){return new Promise(function(_0x552554,_0x19ab02){var _0x56349c=_['values'](_0x216b02[_0xd921('0x56')]);_0x552554({'count':_0x56349c[_0xd921('0x18')],'rows':_0x56349c});});}};var _0x57192d=jayson['server'](_0x54531d)[_0xd921('0x57')]();_0x57192d['on']('error',function(_0x2aa31e){logger[_0xd921('0x2b')](JSON[_0xd921('0x2f')](_0x2aa31e));return _0x4aab67(_0x2aa31e);});_0x57192d[_0xd921('0x12')](0x232c,_0xd921('0x58'),function(){console['log'](_0xd921('0x59'),0x232c);return _0x5df2f9('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 69f7dcc..fd09529 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 _0xb920=['bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','message','result','catch','condition','rules','info','stop','push','Command','format','iftime\x20%s','true','[%s][INTERVAL]\x20%s','all','when','log','join','stack'];(function(_0x82ddc9,_0x4d4c90){var _0x3946bd=function(_0x593733){while(--_0x593733){_0x82ddc9['push'](_0x82ddc9['shift']());}};_0x3946bd(++_0x4d4c90);}(_0xb920,0xa2));var _0x0b92=function(_0x2a32e1,_0x2dd0ff){_0x2a32e1=_0x2a32e1-0x0;var _0x1691d2=_0xb920[_0x2a32e1];return _0x1691d2;};'use strict';var util=require('util');var BPromise=require(_0x0b92('0x0'));var jayson=require(_0x0b92('0x1'));var _=require(_0x0b92('0x2'));var logger=require(_0x0b92('0x3'))(_0x0b92('0x4'));var client=jayson[_0x0b92('0x5')][_0x0b92('0x6')]({'port':0x232a});function request(_0x1ba2ef,_0x21eb7b){return new BPromise(function(_0x3df110,_0x2dd1a7){return client['request'](_0x1ba2ef,_0x21eb7b)[_0x0b92('0x7')](function(_0x52c45f){if(_0x52c45f[_0x0b92('0x8')]){return _0x2dd1a7(_0x52c45f[_0x0b92('0x8')][_0x0b92('0x9')]);}else{return _0x3df110(_0x52c45f[_0x0b92('0xa')]);}})[_0x0b92('0xb')](function(_0x3fa4a4){return _0x2dd1a7(_0x3fa4a4);});});}exports[_0x0b92('0xc')]=function(_0x5668ce,_0x566a0a,_0x3d5aa1){return function(_0x2acec6){if(_0x3d5aa1['rules']&&!_0x3d5aa1[_0x0b92('0xd')][_0x5668ce]){logger[_0x0b92('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5668ce);return _0x2acec6[_0x0b92('0xf')]();}var _0x4cca12=[];for(var _0x42d5d9=0x0;_0x42d5d9<_0x566a0a['length'];_0x42d5d9+=0x1){_0x4cca12[_0x0b92('0x10')](request(_0x0b92('0x11'),{'command':util[_0x0b92('0x12')](_0x0b92('0x13'),_0x566a0a[_0x42d5d9])})[_0x0b92('0x7')](function(_0x4d0b85){return _0x4d0b85&&_0x4d0b85[_0x0b92('0x9')]&&_0x4d0b85[_0x0b92('0x9')]['indexOf'](_0x0b92('0x14'))>=0x0?!![]:![];})['catch'](function(_0x1f2585){logger[_0x0b92('0x8')](_0x0b92('0x15'),_0x5668ce,_0x566a0a[_0x42d5d9]);}));}BPromise[_0x0b92('0x16')](_0x4cca12)[_0x0b92('0x7')](function(_0x297b6f){var _0x1862bf=_['some'](_0x297b6f);logger[_0x0b92('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x5668ce,_0x566a0a['join']('\x20|\x20'),_0x1862bf);_0x2acec6[_0x0b92('0x17')](_0x1862bf);})[_0x0b92('0xb')](function(_0x5f595e){console[_0x0b92('0x18')](_0x5f595e);logger[_0x0b92('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x5668ce,_0x566a0a[_0x0b92('0x19')]('\x20|\x20'),_0x5f595e[_0x0b92('0x1a')]);_0x2acec6[_0x0b92('0xf')]();});};}; \ No newline at end of file +var _0x9f61=['indexOf','true','error','[%s][INTERVAL]\x20%s','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','then'];(function(_0x4bde34,_0xaa7b76){var _0x57ef23=function(_0x371c99){while(--_0x371c99){_0x4bde34['push'](_0x4bde34['shift']());}};_0x57ef23(++_0xaa7b76);}(_0x9f61,0x1e5));var _0x19f6=function(_0x48b089,_0x47de29){_0x48b089=_0x48b089-0x0;var _0x25a802=_0x9f61[_0x48b089];return _0x25a802;};'use strict';var util=require('util');var BPromise=require(_0x19f6('0x0'));var jayson=require(_0x19f6('0x1'));var _=require(_0x19f6('0x2'));var logger=require(_0x19f6('0x3'))(_0x19f6('0x4'));var client=jayson[_0x19f6('0x5')][_0x19f6('0x6')]({'port':0x232a});function request(_0x19d2a1,_0x2c48e5){return new BPromise(function(_0x20cf50,_0x2ebe7e){return client['request'](_0x19d2a1,_0x2c48e5)['then'](function(_0x1de269){if(_0x1de269['error']){return _0x2ebe7e(_0x1de269['error'][_0x19f6('0x7')]);}else{return _0x20cf50(_0x1de269[_0x19f6('0x8')]);}})[_0x19f6('0x9')](function(_0x32e9be){return _0x2ebe7e(_0x32e9be);});});}exports[_0x19f6('0xa')]=function(_0xcd17d6,_0x1fb504,_0xb3da12){return function(_0x272e14){if(_0xb3da12[_0x19f6('0xb')]&&!_0xb3da12['rules'][_0xcd17d6]){logger[_0x19f6('0xc')](_0x19f6('0xd'),_0xcd17d6);return _0x272e14[_0x19f6('0xe')]();}var _0x2b53ba=[];for(var _0x53abcd=0x0;_0x53abcd<_0x1fb504[_0x19f6('0xf')];_0x53abcd+=0x1){_0x2b53ba[_0x19f6('0x10')](request(_0x19f6('0x11'),{'command':util['format']('iftime\x20%s',_0x1fb504[_0x53abcd])})[_0x19f6('0x12')](function(_0x5f2a09){return _0x5f2a09&&_0x5f2a09['message']&&_0x5f2a09['message'][_0x19f6('0x13')](_0x19f6('0x14'))>=0x0?!![]:![];})['catch'](function(_0x208662){logger[_0x19f6('0x15')](_0x19f6('0x16'),_0xcd17d6,_0x1fb504[_0x53abcd]);}));}BPromise['all'](_0x2b53ba)[_0x19f6('0x12')](function(_0x4a23ab){var _0x41b475=_['some'](_0x4a23ab);logger[_0x19f6('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0xcd17d6,_0x1fb504[_0x19f6('0x17')](_0x19f6('0x18')),_0x41b475);_0x272e14['when'](_0x41b475);})[_0x19f6('0x9')](function(_0x5649d8){console[_0x19f6('0x19')](_0x5649d8);logger[_0x19f6('0x15')](_0x19f6('0x1a'),_0xcd17d6,_0x1fb504['join']('\x20|\x20'),_0x5649d8[_0x19f6('0x1b')]);_0x272e14[_0x19f6('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index efa84d6..1d9e3a2 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 _0xd246=['connectedlinename','error','stack','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','forIn','includes','abandoned','holdtime','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','agentconnectAt','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','rejected','indexOf','agent','complete','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','membername','interface','connectedlinenum','lastevent','queue','then','type','agentcomplete','acw','acwtime','agentacw','CreateVoiceAgentReport','request','uniqueid','destuniqueid','agentcalled','agentcalledAt','now'];(function(_0x409fb8,_0x5ab3d3){var _0x278270=function(_0x58849c){while(--_0x58849c){_0x409fb8['push'](_0x409fb8['shift']());}};_0x278270(++_0x5ab3d3);}(_0xd246,0xfc));var _0x6d24=function(_0x3888ae,_0x5c8de7){_0x3888ae=_0x3888ae-0x0;var _0x2e8ad7=_0xd246[_0x3888ae];return _0x2e8ad7;};'use strict';var _=require(_0x6d24('0x0'));var util=require(_0x6d24('0x1'));var utils=require(_0x6d24('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x37ffb5,_0x49d321){utils['info'](util[_0x6d24('0x3')](_0x6d24('0x4'),_0x37ffb5['uniqueid'],_0x37ffb5[_0x6d24('0x5')],_0x37ffb5['queue'],_0x37ffb5[_0x6d24('0x6')],_0x37ffb5[_0x6d24('0x7')],_0x37ffb5['calleridnum'],_0x37ffb5[_0x6d24('0x8')],_0x37ffb5[_0x6d24('0x9')]));if(_0x37ffb5[_0x6d24('0xa')]){utils['getVoiceQueueByName'](_0x37ffb5[_0x6d24('0xa')])[_0x6d24('0xb')](function(_0x1bb94c){if(_0x1bb94c){_0x37ffb5['type']=_0x1bb94c[_0x6d24('0xc')];_0x37ffb5['agentacw']=_0x37ffb5[_0x6d24('0xd')]?_0x1bb94c[_0x6d24('0xe')]:![];_0x37ffb5[_0x6d24('0xf')]=_0x37ffb5[_0x6d24('0x10')]?_0x1bb94c['acwTimeout']:0x0;}utils['request'](_0x6d24('0x11'),_0x37ffb5);});}else{utils[_0x6d24('0x12')]('CreateVoiceAgentReport',_0x37ffb5);}if(_0x49d321){delete transfers[_0x37ffb5[_0x6d24('0x13')]];}else{delete agents[_0x37ffb5[_0x6d24('0x14')]];}}exports[_0x6d24('0x15')]=function(_0x29f513){try{agents[_0x29f513[_0x6d24('0x14')]]=_0x29f513;agents[_0x29f513[_0x6d24('0x14')]][_0x6d24('0x16')]=utils[_0x6d24('0x17')]();agents[_0x29f513[_0x6d24('0x14')]][_0x6d24('0x9')]='called';agents[_0x29f513[_0x6d24('0x14')]][_0x6d24('0x8')]=null;agents[_0x29f513['destuniqueid']][_0x6d24('0x18')]=null;}catch(_0x5c5a62){utils[_0x6d24('0x19')](_0x5c5a62[_0x6d24('0x1a')]);}};exports[_0x6d24('0x1b')]=function(_0x2b76ca){try{if(!_[_0x6d24('0x1c')](agents[_0x2b76ca[_0x6d24('0x14')]])){agents[_0x2b76ca[_0x6d24('0x14')]][_0x6d24('0x1b')]=!![];agents[_0x2b76ca[_0x6d24('0x14')]][_0x6d24('0x1d')]=utils[_0x6d24('0x17')]();agents[_0x2b76ca[_0x6d24('0x14')]][_0x6d24('0x9')]=_0x6d24('0x1e');agents[_0x2b76ca['destuniqueid']][_0x6d24('0x1f')]=_0x6d24('0x1e');agents[_0x2b76ca[_0x6d24('0x14')]]['holdtime']=_0x2b76ca['ringtime']?parseInt(_0x2b76ca[_0x6d24('0x20')])/0x3e8:0x0;agents[_0x2b76ca[_0x6d24('0x14')]][_0x6d24('0x21')]=0x0;unanswered[_0x6d24('0x22')](_0x2b76ca['destuniqueid']);}}catch(_0x21d87d){utils['error'](_0x21d87d[_0x6d24('0x1a')]);}};exports['queuecallerabandon']=function(_0x5bf483){try{_[_0x6d24('0x23')](agents,function(_0xd0f9ff,_0x5d8496){if(_0xd0f9ff[_0x6d24('0x13')]==_0x5bf483[_0x6d24('0x13')]&&!_[_0x6d24('0x24')](unanswered,_0xd0f9ff[_0x6d24('0x14')])){_0xd0f9ff[_0x6d24('0x1b')]=!![];_0xd0f9ff['agentringnoanswerAt']=utils[_0x6d24('0x17')]();_0xd0f9ff['lastevent']=_0x6d24('0x25');_0xd0f9ff[_0x6d24('0x1f')]=_0x6d24('0x25');_0xd0f9ff['holdtime']=_0x5bf483['holdtime'];_0xd0f9ff['talktime']=0x0;writeDB(_0xd0f9ff);}});}catch(_0x5b106b){utils[_0x6d24('0x19')](_0x5b106b[_0x6d24('0x1a')]);}};exports['agentconnect']=function(_0x2ff257){try{if(agents[_0x2ff257[_0x6d24('0x14')]]){agents[_0x2ff257['destuniqueid']]['agentconnectAt']=utils[_0x6d24('0x17')]();agents[_0x2ff257[_0x6d24('0x14')]][_0x6d24('0x8')]=_0x2ff257[_0x6d24('0x8')];agents[_0x2ff257[_0x6d24('0x14')]]['connectedlinename']=_0x2ff257['connectedlinename'];agents[_0x2ff257[_0x6d24('0x14')]][_0x6d24('0x26')]=_0x2ff257['ringtime'];agents[_0x2ff257['destuniqueid']][_0x6d24('0x9')]=_0x6d24('0x27');_[_0x6d24('0x23')](agents,function(_0x196980,_0x3335df){if(_0x196980[_0x6d24('0x14')]!=_0x2ff257['destuniqueid']&&_0x196980['uniqueid']==_0x2ff257[_0x6d24('0x13')]){_0x196980[_0x6d24('0x21')]=0x0;_0x196980[_0x6d24('0x26')]=_0x2ff257[_0x6d24('0x20')];_0x196980[_0x6d24('0x1b')]=!![];_0x196980[_0x6d24('0x1d')]=utils[_0x6d24('0x17')]();_0x196980[_0x6d24('0x9')]='answered_elsewhere';_0x196980[_0x6d24('0x1f')]=_0x6d24('0x28');_0x196980['answeredelsewheredestinationuniqueid']=_0x2ff257['destuniqueid'];_0x196980[_0x6d24('0x29')]=_0x2ff257['membername'];writeDB(_0x196980);}});}}catch(_0x47895e){utils[_0x6d24('0x19')](_0x47895e[_0x6d24('0x1a')]);}};exports[_0x6d24('0xd')]=function(_0x2bf94b){try{if(!_[_0x6d24('0x1c')](agents[_0x2bf94b[_0x6d24('0x14')]])){agents[_0x2bf94b[_0x6d24('0x14')]]['agentcomplete']=!![];agents[_0x2bf94b[_0x6d24('0x14')]][_0x6d24('0x2a')]=utils[_0x6d24('0x17')]();agents[_0x2bf94b[_0x6d24('0x14')]]['talktime']=utils[_0x6d24('0x2b')](agents[_0x2bf94b['destuniqueid']][_0x6d24('0x2a')],agents[_0x2bf94b['destuniqueid']][_0x6d24('0x2c')]);agents[_0x2bf94b[_0x6d24('0x14')]][_0x6d24('0x1f')]=_0x2bf94b[_0x6d24('0x1f')];agents[_0x2bf94b[_0x6d24('0x14')]][_0x6d24('0x9')]='complete';writeDB(agents[_0x2bf94b[_0x6d24('0x14')]]);}}catch(_0x292ecb){utils[_0x6d24('0x19')](_0x292ecb[_0x6d24('0x1a')]);}};exports[_0x6d24('0x2d')]=function(_0xf5974b){try{if(!_[_0x6d24('0x1c')](agents[_0xf5974b[_0x6d24('0x2e')]])){agents[_0xf5974b[_0x6d24('0x2e')]][_0x6d24('0x2f')]=!![];agents[_0xf5974b['transfereruniqueid']][_0x6d24('0x30')]=_0x6d24('0x31');agents[_0xf5974b[_0x6d24('0x2e')]][_0x6d24('0x32')]=_0xf5974b['extension'];agents[_0xf5974b[_0x6d24('0x2e')]][_0x6d24('0x33')]=agents[_0xf5974b['transfereruniqueid']]['uniqueid'];}}catch(_0x50d5f7){utils[_0x6d24('0x19')](_0x50d5f7[_0x6d24('0x1a')]);}};exports['attendedtransfer']=function(_0x2adc74){try{if(_0x2adc74[_0x6d24('0x34')]==_0x2adc74['origtransfererlinkedid']){if(!_[_0x6d24('0x1c')](agents[_0x2adc74[_0x6d24('0x35')]])){agents[_0x2adc74[_0x6d24('0x35')]][_0x6d24('0x2f')]=!![];agents[_0x2adc74['secondtransfereruniqueid']][_0x6d24('0x30')]=_0x6d24('0x36');agents[_0x2adc74[_0x6d24('0x35')]]['transferexten']=_0x2adc74[_0x6d24('0x37')];agents[_0x2adc74[_0x6d24('0x35')]]['transferuniqueid']=_0x2adc74[_0x6d24('0x34')];}if(_0x2adc74[_0x6d24('0x38')]&&agents[_0x2adc74['transfereeuniqueid']]){agents[_0x2adc74[_0x6d24('0x38')]][_0x6d24('0x39')]=0x1;transfers[_0x2adc74[_0x6d24('0x38')]]=_[_0x6d24('0x3a')](agents[_0x2adc74['transfereeuniqueid']]);transfers[_0x2adc74['transfereeuniqueid']][_0x6d24('0x3b')]=agents[_0x2adc74['secondtransfereruniqueid']][_0x6d24('0x3b')];transfers[_0x2adc74[_0x6d24('0x38')]][_0x6d24('0x3c')]=agents[_0x2adc74['secondtransfereruniqueid']][_0x6d24('0x3c')];transfers[_0x2adc74[_0x6d24('0x38')]][_0x6d24('0x16')]=utils[_0x6d24('0x17')]();transfers[_0x2adc74[_0x6d24('0x38')]]['agentconnectAt']=utils[_0x6d24('0x17')]();transfers[_0x2adc74[_0x6d24('0x38')]][_0x6d24('0x26')]=0x0;transfers[_0x2adc74[_0x6d24('0x38')]]['agententerreason']=0x2;}}else if(_0x2adc74[_0x6d24('0x35')]==_0x2adc74[_0x6d24('0x3d')]){if(!_[_0x6d24('0x1c')](agents[_0x2adc74['origtransfereruniqueid']])){agents[_0x2adc74[_0x6d24('0x34')]]['transfer']=!![];agents[_0x2adc74['origtransfereruniqueid']]['transfertype']=_0x6d24('0x36');agents[_0x2adc74[_0x6d24('0x34')]]['transferexten']=_0x2adc74[_0x6d24('0x3e')];agents[_0x2adc74[_0x6d24('0x34')]][_0x6d24('0x33')]=_0x2adc74[_0x6d24('0x35')];}if(_0x2adc74[_0x6d24('0x3f')]&&agents[_0x2adc74[_0x6d24('0x3f')]]){agents[_0x2adc74[_0x6d24('0x3f')]][_0x6d24('0x39')]=0x1;transfers[_0x2adc74['transfertargetuniqueid']]=_[_0x6d24('0x3a')](agents[_0x2adc74['transfertargetuniqueid']]);transfers[_0x2adc74[_0x6d24('0x3f')]]['calleridnum']=agents[_0x2adc74['origtransfereruniqueid']][_0x6d24('0x3b')];transfers[_0x2adc74[_0x6d24('0x3f')]][_0x6d24('0x3c')]=agents[_0x2adc74[_0x6d24('0x34')]][_0x6d24('0x3c')];transfers[_0x2adc74['transfertargetuniqueid']][_0x6d24('0x16')]=utils[_0x6d24('0x17')]();transfers[_0x2adc74[_0x6d24('0x3f')]][_0x6d24('0x2c')]=utils[_0x6d24('0x17')]();transfers[_0x2adc74[_0x6d24('0x3f')]]['holdtime']=0x0;transfers[_0x2adc74[_0x6d24('0x3f')]][_0x6d24('0x39')]=0x2;}}}catch(_0x276817){utils[_0x6d24('0x19')](_0x276817[_0x6d24('0x1a')]);}};exports[_0x6d24('0x40')]=function(_0x24721f){try{if(agents[_0x24721f[_0x6d24('0x13')]]&&agents[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x1f')]==='timeout'){if(_0x24721f['cause']==='21'){agents[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x1f')]='rejected';agents[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x9')]=_0x6d24('0x41');}writeDB(agents[_0x24721f[_0x6d24('0x13')]]);var _0x550ece=unanswered[_0x6d24('0x42')](_0x24721f[_0x6d24('0x13')]);if(_0x550ece>-0x1)unanswered['splice'](_0x550ece,0x1);}if(transfers[_0x24721f[_0x6d24('0x13')]]){transfers[_0x24721f[_0x6d24('0x13')]]['agentcomplete']=!![];transfers[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x2a')]=utils[_0x6d24('0x17')]();transfers[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x21')]=utils[_0x6d24('0x2b')](transfers[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x2a')],transfers[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x2c')]);transfers[_0x24721f['uniqueid']][_0x6d24('0x1f')]=_0x6d24('0x43');transfers[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x9')]=_0x6d24('0x44');writeDB(transfers[_0x24721f[_0x6d24('0x13')]],!![]);}if(agents[_0x24721f[_0x6d24('0x13')]]&&agents[_0x24721f['uniqueid']][_0x6d24('0x2c')]){agents[_0x24721f['uniqueid']][_0x6d24('0xd')]=!![];agents[_0x24721f['uniqueid']][_0x6d24('0x2a')]=utils[_0x6d24('0x17')]();agents[_0x24721f['uniqueid']]['talktime']=utils[_0x6d24('0x2b')](agents[_0x24721f[_0x6d24('0x13')]]['agentcompleteAt'],agents[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x2c')]);agents[_0x24721f['uniqueid']]['reason']=agents[_0x24721f[_0x6d24('0x13')]][_0x6d24('0x2f')]?'transfer':'agent';agents[_0x24721f['uniqueid']][_0x6d24('0x9')]=_0x6d24('0x44');writeDB(agents[_0x24721f[_0x6d24('0x13')]]);}}catch(_0x46521d){utils[_0x6d24('0x19')](_0x46521d[_0x6d24('0x1a')]);}}; \ No newline at end of file +var _0x161c=['talktime','queuecallerabandon','forIn','abandoned','agentconnect','connect','answered_elsewhere','agentcomplete','isNil','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','clone','hangup','cause','rejected','indexOf','splice','agent','util','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','called','connectedlinename','error','stack','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','holdtime','ringtime'];(function(_0x2e256c,_0x3bf922){var _0x2cafe8=function(_0x29bd7e){while(--_0x29bd7e){_0x2e256c['push'](_0x2e256c['shift']());}};_0x2cafe8(++_0x3bf922);}(_0x161c,0xb7));var _0xc161=function(_0x111535,_0x420284){_0x111535=_0x111535-0x0;var _0x5aaacc=_0x161c[_0x111535];return _0x5aaacc;};'use strict';var _=require('lodash');var util=require(_0xc161('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3e775e,_0x517dc1){utils[_0xc161('0x1')](util['format'](_0xc161('0x2'),_0x3e775e[_0xc161('0x3')],_0x3e775e[_0xc161('0x4')],_0x3e775e[_0xc161('0x5')],_0x3e775e[_0xc161('0x6')],_0x3e775e[_0xc161('0x7')],_0x3e775e[_0xc161('0x8')],_0x3e775e[_0xc161('0x9')],_0x3e775e[_0xc161('0xa')]));if(_0x3e775e[_0xc161('0x5')]){utils[_0xc161('0xb')](_0x3e775e[_0xc161('0x5')])['then'](function(_0x5000ec){if(_0x5000ec){_0x3e775e[_0xc161('0xc')]=_0x5000ec[_0xc161('0xc')];_0x3e775e[_0xc161('0xd')]=_0x3e775e['agentcomplete']?_0x5000ec[_0xc161('0xe')]:![];_0x3e775e[_0xc161('0xf')]=_0x3e775e['agentacw']?_0x5000ec[_0xc161('0x10')]:0x0;}utils[_0xc161('0x11')](_0xc161('0x12'),_0x3e775e);});}else{utils[_0xc161('0x11')](_0xc161('0x12'),_0x3e775e);}if(_0x517dc1){delete transfers[_0x3e775e[_0xc161('0x3')]];}else{delete agents[_0x3e775e['destuniqueid']];}}exports[_0xc161('0x13')]=function(_0x379616){try{agents[_0x379616['destuniqueid']]=_0x379616;agents[_0x379616[_0xc161('0x14')]][_0xc161('0x15')]=utils['now']();agents[_0x379616[_0xc161('0x14')]][_0xc161('0xa')]=_0xc161('0x16');agents[_0x379616[_0xc161('0x14')]][_0xc161('0x9')]=null;agents[_0x379616[_0xc161('0x14')]][_0xc161('0x17')]=null;}catch(_0x5e375b){utils[_0xc161('0x18')](_0x5e375b[_0xc161('0x19')]);}};exports['agentringnoanswer']=function(_0x15b032){try{if(!_['isNil'](agents[_0x15b032[_0xc161('0x14')]])){agents[_0x15b032[_0xc161('0x14')]][_0xc161('0x1a')]=!![];agents[_0x15b032['destuniqueid']][_0xc161('0x1b')]=utils[_0xc161('0x1c')]();agents[_0x15b032[_0xc161('0x14')]][_0xc161('0xa')]=_0xc161('0x1d');agents[_0x15b032['destuniqueid']][_0xc161('0x1e')]='timeout';agents[_0x15b032[_0xc161('0x14')]][_0xc161('0x1f')]=_0x15b032[_0xc161('0x20')]?parseInt(_0x15b032[_0xc161('0x20')])/0x3e8:0x0;agents[_0x15b032[_0xc161('0x14')]][_0xc161('0x21')]=0x0;unanswered['push'](_0x15b032[_0xc161('0x14')]);}}catch(_0x586cdd){utils['error'](_0x586cdd[_0xc161('0x19')]);}};exports[_0xc161('0x22')]=function(_0x27e322){try{_[_0xc161('0x23')](agents,function(_0x18d04b,_0x2f05ed){if(_0x18d04b[_0xc161('0x3')]==_0x27e322['uniqueid']&&!_['includes'](unanswered,_0x18d04b['destuniqueid'])){_0x18d04b[_0xc161('0x1a')]=!![];_0x18d04b[_0xc161('0x1b')]=utils[_0xc161('0x1c')]();_0x18d04b[_0xc161('0xa')]='abandoned';_0x18d04b['reason']=_0xc161('0x24');_0x18d04b[_0xc161('0x1f')]=_0x27e322[_0xc161('0x1f')];_0x18d04b[_0xc161('0x21')]=0x0;writeDB(_0x18d04b);}});}catch(_0x1b1b83){utils[_0xc161('0x18')](_0x1b1b83['stack']);}};exports[_0xc161('0x25')]=function(_0x125459){try{if(agents[_0x125459['destuniqueid']]){agents[_0x125459[_0xc161('0x14')]]['agentconnectAt']=utils[_0xc161('0x1c')]();agents[_0x125459[_0xc161('0x14')]][_0xc161('0x9')]=_0x125459[_0xc161('0x9')];agents[_0x125459[_0xc161('0x14')]][_0xc161('0x17')]=_0x125459[_0xc161('0x17')];agents[_0x125459['destuniqueid']][_0xc161('0x1f')]=_0x125459['ringtime'];agents[_0x125459['destuniqueid']][_0xc161('0xa')]=_0xc161('0x26');_['forIn'](agents,function(_0x22c810,_0x26259b){if(_0x22c810[_0xc161('0x14')]!=_0x125459[_0xc161('0x14')]&&_0x22c810[_0xc161('0x3')]==_0x125459['uniqueid']){_0x22c810['talktime']=0x0;_0x22c810[_0xc161('0x1f')]=_0x125459[_0xc161('0x20')];_0x22c810[_0xc161('0x1a')]=!![];_0x22c810[_0xc161('0x1b')]=utils[_0xc161('0x1c')]();_0x22c810[_0xc161('0xa')]=_0xc161('0x27');_0x22c810[_0xc161('0x1e')]=_0xc161('0x27');_0x22c810['answeredelsewheredestinationuniqueid']=_0x125459['destuniqueid'];_0x22c810['answeredelsewheremembername']=_0x125459[_0xc161('0x6')];writeDB(_0x22c810);}});}}catch(_0x501984){utils[_0xc161('0x18')](_0x501984[_0xc161('0x19')]);}};exports[_0xc161('0x28')]=function(_0x5d8e52){try{if(!_[_0xc161('0x29')](agents[_0x5d8e52[_0xc161('0x14')]])){agents[_0x5d8e52['destuniqueid']]['agentcomplete']=!![];agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0x2a')]=utils[_0xc161('0x1c')]();agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0x21')]=utils[_0xc161('0x2b')](agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0x2a')],agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0x2c')]);agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0x1e')]=_0x5d8e52[_0xc161('0x1e')];agents[_0x5d8e52[_0xc161('0x14')]][_0xc161('0xa')]=_0xc161('0x2d');writeDB(agents[_0x5d8e52['destuniqueid']]);}}catch(_0x546fa7){utils[_0xc161('0x18')](_0x546fa7['stack']);}};exports[_0xc161('0x2e')]=function(_0x1ccbb5){try{if(!_[_0xc161('0x29')](agents[_0x1ccbb5[_0xc161('0x2f')]])){agents[_0x1ccbb5['transfereruniqueid']][_0xc161('0x30')]=!![];agents[_0x1ccbb5[_0xc161('0x2f')]][_0xc161('0x31')]=_0xc161('0x32');agents[_0x1ccbb5['transfereruniqueid']][_0xc161('0x33')]=_0x1ccbb5[_0xc161('0x34')];agents[_0x1ccbb5['transfereruniqueid']][_0xc161('0x35')]=agents[_0x1ccbb5[_0xc161('0x2f')]][_0xc161('0x3')];}}catch(_0x2d53dc){utils[_0xc161('0x18')](_0x2d53dc[_0xc161('0x19')]);}};exports[_0xc161('0x36')]=function(_0x2db85c){try{if(_0x2db85c[_0xc161('0x37')]==_0x2db85c['origtransfererlinkedid']){if(!_['isNil'](agents[_0x2db85c[_0xc161('0x38')]])){agents[_0x2db85c[_0xc161('0x38')]][_0xc161('0x30')]=!![];agents[_0x2db85c['secondtransfereruniqueid']][_0xc161('0x31')]='ATTENDED';agents[_0x2db85c[_0xc161('0x38')]][_0xc161('0x33')]=_0x2db85c[_0xc161('0x39')];agents[_0x2db85c['secondtransfereruniqueid']][_0xc161('0x35')]=_0x2db85c[_0xc161('0x37')];}if(_0x2db85c[_0xc161('0x3a')]&&agents[_0x2db85c['transfereeuniqueid']]){agents[_0x2db85c[_0xc161('0x3a')]][_0xc161('0x3b')]=0x1;transfers[_0x2db85c[_0xc161('0x3a')]]=_['clone'](agents[_0x2db85c[_0xc161('0x3a')]]);transfers[_0x2db85c[_0xc161('0x3a')]]['calleridnum']=agents[_0x2db85c[_0xc161('0x38')]][_0xc161('0x8')];transfers[_0x2db85c['transfereeuniqueid']][_0xc161('0x3c')]=agents[_0x2db85c[_0xc161('0x38')]][_0xc161('0x3c')];transfers[_0x2db85c[_0xc161('0x3a')]][_0xc161('0x15')]=utils[_0xc161('0x1c')]();transfers[_0x2db85c[_0xc161('0x3a')]][_0xc161('0x2c')]=utils[_0xc161('0x1c')]();transfers[_0x2db85c['transfereeuniqueid']][_0xc161('0x1f')]=0x0;transfers[_0x2db85c[_0xc161('0x3a')]][_0xc161('0x3b')]=0x2;}}else if(_0x2db85c['secondtransfereruniqueid']==_0x2db85c[_0xc161('0x3d')]){if(!_[_0xc161('0x29')](agents[_0x2db85c[_0xc161('0x37')]])){agents[_0x2db85c[_0xc161('0x37')]]['transfer']=!![];agents[_0x2db85c[_0xc161('0x37')]][_0xc161('0x31')]=_0xc161('0x3e');agents[_0x2db85c[_0xc161('0x37')]][_0xc161('0x33')]=_0x2db85c[_0xc161('0x3f')];agents[_0x2db85c['origtransfereruniqueid']]['transferuniqueid']=_0x2db85c[_0xc161('0x38')];}if(_0x2db85c['transfertargetuniqueid']&&agents[_0x2db85c['transfertargetuniqueid']]){agents[_0x2db85c[_0xc161('0x40')]][_0xc161('0x3b')]=0x1;transfers[_0x2db85c['transfertargetuniqueid']]=_[_0xc161('0x41')](agents[_0x2db85c[_0xc161('0x40')]]);transfers[_0x2db85c[_0xc161('0x40')]][_0xc161('0x8')]=agents[_0x2db85c[_0xc161('0x37')]][_0xc161('0x8')];transfers[_0x2db85c[_0xc161('0x40')]][_0xc161('0x3c')]=agents[_0x2db85c[_0xc161('0x37')]][_0xc161('0x3c')];transfers[_0x2db85c[_0xc161('0x40')]][_0xc161('0x15')]=utils[_0xc161('0x1c')]();transfers[_0x2db85c['transfertargetuniqueid']][_0xc161('0x2c')]=utils['now']();transfers[_0x2db85c[_0xc161('0x40')]][_0xc161('0x1f')]=0x0;transfers[_0x2db85c[_0xc161('0x40')]][_0xc161('0x3b')]=0x2;}}}catch(_0x5f0ba5){utils[_0xc161('0x18')](_0x5f0ba5[_0xc161('0x19')]);}};exports[_0xc161('0x42')]=function(_0xfc63de){try{if(agents[_0xfc63de[_0xc161('0x3')]]&&agents[_0xfc63de['uniqueid']][_0xc161('0x1e')]==='timeout'){if(_0xfc63de[_0xc161('0x43')]==='21'){agents[_0xfc63de['uniqueid']][_0xc161('0x1e')]=_0xc161('0x44');agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0xa')]='rejected';}writeDB(agents[_0xfc63de[_0xc161('0x3')]]);var _0x26378e=unanswered[_0xc161('0x45')](_0xfc63de[_0xc161('0x3')]);if(_0x26378e>-0x1)unanswered[_0xc161('0x46')](_0x26378e,0x1);}if(transfers[_0xfc63de['uniqueid']]){transfers[_0xfc63de[_0xc161('0x3')]][_0xc161('0x28')]=!![];transfers[_0xfc63de['uniqueid']][_0xc161('0x2a')]=utils['now']();transfers[_0xfc63de['uniqueid']][_0xc161('0x21')]=utils[_0xc161('0x2b')](transfers[_0xfc63de[_0xc161('0x3')]][_0xc161('0x2a')],transfers[_0xfc63de[_0xc161('0x3')]][_0xc161('0x2c')]);transfers[_0xfc63de[_0xc161('0x3')]][_0xc161('0x1e')]=_0xc161('0x47');transfers[_0xfc63de['uniqueid']][_0xc161('0xa')]=_0xc161('0x2d');writeDB(transfers[_0xfc63de[_0xc161('0x3')]],!![]);}if(agents[_0xfc63de[_0xc161('0x3')]]&&agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x2c')]){agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x28')]=!![];agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x2a')]=utils['now']();agents[_0xfc63de['uniqueid']][_0xc161('0x21')]=utils[_0xc161('0x2b')](agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x2a')],agents[_0xfc63de['uniqueid']][_0xc161('0x2c')]);agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x1e')]=agents[_0xfc63de[_0xc161('0x3')]][_0xc161('0x30')]?'transfer':_0xc161('0x47');agents[_0xfc63de[_0xc161('0x3')]]['lastevent']='complete';writeDB(agents[_0xfc63de[_0xc161('0x3')]]);}}catch(_0x11f10c){utils['error'](_0x11f10c[_0xc161('0x19')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9cf9c94..6844ca7 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 _0x899d=['answertime','toNumber','hangup','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','secondtransfererchannel','transfertargetchannel','userfield','musiconholdstart','musiconholdstartAt','musiconholdstop','variable','xmd-originatecalleridnum','value','\x22\x20<','xmd-callerid','xmd-queue','lastapplication','queue','xmd-contactid','ContactId','xmd-cdrtype','sipcallid','newexten','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','execif','application','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','request','CreateVoiceCallReport','uniqueid','newchannel','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','stack','newstate','isNil','channelstate','systemanswertime','linkedid','destinationchannel'];(function(_0xc70a49,_0x45a5a5){var _0x518e51=function(_0x287d2d){while(--_0x287d2d){_0xc70a49['push'](_0xc70a49['shift']());}};_0x518e51(++_0x45a5a5);}(_0x899d,0x77));var _0xd899=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x899d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd899('0x0'));var util=require(_0xd899('0x1'));var utils=require(_0xd899('0x2'));var dispositions=['NO\x20ANSWER',_0xd899('0x3'),_0xd899('0x3'),_0xd899('0x4'),_0xd899('0x4'),'NO\x20ANSWER',_0xd899('0x5'),_0xd899('0x6'),_0xd899('0x3'),_0xd899('0x3'),_0xd899('0x3')];var channels={};function writeDB(_0x2b0e9b){utils[_0xd899('0x7')](util[_0xd899('0x8')](_0xd899('0x9'),_0x2b0e9b['uniqueid'],_0x2b0e9b[_0xd899('0xa')],_0x2b0e9b[_0xd899('0xb')],_0x2b0e9b[_0xd899('0xc')],_0x2b0e9b[_0xd899('0xd')],_0x2b0e9b[_0xd899('0xe')],_0x2b0e9b[_0xd899('0xf')],_0x2b0e9b[_0xd899('0x10')]));if(_0x2b0e9b[_0xd899('0xc')]){utils[_0xd899('0x11')](_0x2b0e9b[_0xd899('0xc')])[_0xd899('0x12')](function(_0xeb4276){if(_0xeb4276){_0x2b0e9b['UserId']=_0xeb4276['id'];}utils[_0xd899('0x13')](_0xd899('0x14'),_0x2b0e9b);});}else{utils[_0xd899('0x13')](_0xd899('0x14'),_0x2b0e9b);}if(channels[_0x2b0e9b[_0xd899('0x15')]]){delete channels[_0x2b0e9b[_0xd899('0x15')]];}}exports[_0xd899('0x16')]=function(_0x4d1000){try{if(_0x4d1000['uniqueid']==_0x4d1000['linkedid']&&_0x4d1000[_0xd899('0xa')]!=_0xd899('0x17')){channels[_0x4d1000['uniqueid']]={'uniqueid':_0x4d1000[_0xd899('0x15')],'accountcode':_0x4d1000[_0xd899('0xc')],'source':_0x4d1000[_0xd899('0x18')],'destination':_0x4d1000[_0xd899('0x19')],'destinationcontext':_0x4d1000[_0xd899('0x1a')],'channel':_0x4d1000['channel'],'starttime':utils[_0xd899('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xd899('0x1c')};}}catch(_0x14948b){utils[_0xd899('0x1d')](_0x14948b[_0xd899('0x1e')]);}};exports[_0xd899('0x1f')]=function(_0xe38ced){try{if(!_[_0xd899('0x20')](channels[_0xe38ced[_0xd899('0x15')]])&&_0xe38ced[_0xd899('0x21')]==0x6){if(_['isNil'](channels[_0xe38ced['uniqueid']][_0xd899('0x22')])){channels[_0xe38ced[_0xd899('0x15')]]['systemanswertime']=utils['now']();}}else if(!_[_0xd899('0x20')](channels[_0xe38ced[_0xd899('0x23')]])&&_0xe38ced['channelstate']==0x6&&_0xe38ced['context']!='transfer'){channels[_0xe38ced[_0xd899('0x23')]][_0xd899('0xc')]=_0xe38ced[_0xd899('0xc')];channels[_0xe38ced[_0xd899('0x23')]][_0xd899('0x24')]=_0xe38ced[_0xd899('0xa')];if(_[_0xd899('0x20')](channels[_0xe38ced['linkedid']][_0xd899('0x25')])){channels[_0xe38ced['linkedid']][_0xd899('0x25')]=utils[_0xd899('0x1b')]();}channels[_0xe38ced[_0xd899('0x23')]][_0xd899('0x10')]=dispositions[_[_0xd899('0x26')](_0xe38ced[_0xd899('0x21')])]||_0xd899('0x5');}}catch(_0x130e6f){utils[_0xd899('0x1d')](_0x130e6f['stack']);}};exports[_0xd899('0x27')]=function(_0x58bf1f){try{if(!_[_0xd899('0x20')](channels[_0x58bf1f[_0xd899('0x15')]])){if(_['isNil'](channels[_0x58bf1f['uniqueid']][_0xd899('0xf')])){channels[_0x58bf1f[_0xd899('0x15')]]['callerid']=_0x58bf1f[_0xd899('0x28')]+'\x20<'+_0x58bf1f[_0xd899('0x18')]+'>';}channels[_0x58bf1f[_0xd899('0x15')]][_0xd899('0x29')]=utils[_0xd899('0x1b')]();channels[_0x58bf1f[_0xd899('0x15')]][_0xd899('0x2a')]=utils[_0xd899('0x2b')](channels[_0x58bf1f[_0xd899('0x15')]]['endtime'],channels[_0x58bf1f['uniqueid']][_0xd899('0x2c')]);channels[_0x58bf1f[_0xd899('0x15')]]['billableseconds']=channels[_0x58bf1f[_0xd899('0x15')]][_0xd899('0x25')]?utils[_0xd899('0x2b')](channels[_0x58bf1f['uniqueid']]['endtime'],channels[_0x58bf1f[_0xd899('0x15')]][_0xd899('0x25')]):0x0;writeDB(channels[_0x58bf1f['uniqueid']]);}}catch(_0x3f020f){utils[_0xd899('0x1d')](_0x3f020f[_0xd899('0x1e')]);}};exports[_0xd899('0x2d')]=function(_0x46e549){try{if(!_[_0xd899('0x20')](channels[_0x46e549[_0xd899('0x2e')]])){if(channels[_0x46e549[_0xd899('0x2e')]][_0xd899('0xa')]==_0x46e549['transfereechannel']){channels[_0x46e549[_0xd899('0x2e')]]['destinationchannel']=_0x46e549[_0xd899('0x2f')];channels[_0x46e549[_0xd899('0x2e')]]['userfield']='_attended';}else if(channels[_0x46e549['localtwolinkedid']][_0xd899('0xa')]=_0x46e549[_0xd899('0x30')]){channels[_0x46e549['localtwolinkedid']]['destinationchannel']=_0x46e549['origtransfererchannel'];channels[_0x46e549['localtwolinkedid']][_0xd899('0x31')]='_attended';}}}catch(_0x3fb303){utils[_0xd899('0x1d')](_0x3fb303[_0xd899('0x1e')]);}};exports[_0xd899('0x32')]=function(_0x21ec4a){try{if(!_[_0xd899('0x20')](channels[_0x21ec4a['uniqueid']])){channels[_0x21ec4a['uniqueid']][_0xd899('0x33')]=utils[_0xd899('0x1b')]();}}catch(_0x5692d5){utils[_0xd899('0x1d')](_0x5692d5['stack']);}};exports[_0xd899('0x34')]=function(_0x1311c8){try{if(!_[_0xd899('0x20')](channels[_0x1311c8[_0xd899('0x15')]])){if(!_[_0xd899('0x20')](channels[_0x1311c8['uniqueid']][_0xd899('0x33')])){channels[_0x1311c8['uniqueid']]['mohtime']+=utils[_0xd899('0x2b')](utils[_0xd899('0x1b')](),channels[_0x1311c8[_0xd899('0x15')]]['musiconholdstartAt']);delete channels[_0x1311c8['uniqueid']]['musiconholdstartAt'];}}}catch(_0x5acfd4){utils[_0xd899('0x1d')](_0x5acfd4[_0xd899('0x1e')]);}};exports['varset']=function(_0x231437){try{if(!_[_0xd899('0x20')](channels[_0x231437['uniqueid']])){if(!_[_0xd899('0x20')](_0x231437[_0xd899('0x35')][_0xd899('0x36')])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0xd')]=_0x231437[_0xd899('0x37')];}if(!_[_0xd899('0x20')](_0x231437['variable']['xmd-phone'])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0xe')]=_0x231437['value'];channels[_0x231437['uniqueid']]['callerid']='\x22'+_0x231437[_0xd899('0x37')]+_0xd899('0x38')+_0x231437[_0xd899('0x37')]+'>';}if(!_[_0xd899('0x20')](_0x231437[_0xd899('0x35')]['xmd-callerid-preview'])||!_['isNil'](_0x231437['variable'][_0xd899('0x39')])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0xf')]=_0x231437[_0xd899('0x37')];}if(!_[_0xd899('0x20')](_0x231437[_0xd899('0x35')][_0xd899('0x3a')])||!_[_0xd899('0x20')](_0x231437['variable']['xmcs-queue'])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0x3b')]='Queue';channels[_0x231437[_0xd899('0x15')]]['lastdata']=_0x231437[_0xd899('0x37')];channels[_0x231437[_0xd899('0x15')]][_0xd899('0x3c')]=!![];}if(!_[_0xd899('0x20')](_0x231437[_0xd899('0x35')][_0xd899('0x3d')])){channels[_0x231437['uniqueid']][_0xd899('0x3e')]=_0x231437['value'];}if(!_[_0xd899('0x20')](_0x231437[_0xd899('0x35')][_0xd899('0x3f')])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0xb')]=_0x231437[_0xd899('0x37')];}if(!_['isNil'](_0x231437['variable']['outboundrouteid'])){channels[_0x231437['uniqueid']]['routeid']=_0x231437['value'];}if(!_['isNil'](_0x231437[_0xd899('0x35')][_0xd899('0x40')])){channels[_0x231437[_0xd899('0x15')]][_0xd899('0x40')]=_0x231437[_0xd899('0x37')];}}}catch(_0x4f407f){utils['error'](_0x4f407f[_0xd899('0x1e')]);}};exports[_0xd899('0x41')]=function(_0x41aac4){try{if(!_[_0xd899('0x20')](channels[_0x41aac4['uniqueid']])){if(_0x41aac4['application'][_0xd899('0x42')]()==_0xd899('0x43')&&_[_0xd899('0x44')](_0x41aac4[_0xd899('0x45')]['toLowerCase'](),_0xd899('0x46'))){var _0x1452ac=_0x41aac4[_0xd899('0x45')][_0xd899('0x47')]('=');var _0x4dcf7d=_0x1452ac[0x0][_0xd899('0x48')](_0x1452ac[0x0]['lastIndexOf']('(')+0x1,_0x1452ac[0x0][_0xd899('0x49')](')'));var _0x31844c=_0x1452ac[0x1];channels[_0x41aac4[_0xd899('0x15')]][_0x4dcf7d]=_0x31844c;}if(!_[_0xd899('0x4a')](['hangup','noop',_0xd899('0x4b'),'set','gotoif'],_0x41aac4[_0xd899('0x4c')][_0xd899('0x42')]())){channels[_0x41aac4[_0xd899('0x15')]][_0xd899('0x3b')]=_0x41aac4[_0xd899('0x4c')];channels[_0x41aac4[_0xd899('0x15')]][_0xd899('0x4d')]=_0x41aac4[_0xd899('0x45')];}}}catch(_0x5899cf){utils[_0xd899('0x1d')](_0x5899cf[_0xd899('0x1e')]);}}; \ No newline at end of file +var _0xec25=['gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','callerid','disposition','then','UserId','request','CreateVoiceCallReport','newchannel','OutgoingSpoolFailed','calleridnum','context','now','DOCUMENTATION','stack','newstate','isNil','channelstate','systemanswertime','linkedid','transfer','destinationchannel','answertime','toNumber','hangup','calleridname','duration','diffTime','starttime','billableseconds','endtime','error','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','source','value','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','xmcs-queue','lastapplication','Queue','queue','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','application','toLowerCase','set','startsWith','appdata','cdr','split','includes','noop'];(function(_0x5cf52b,_0x2e5d72){var _0x4af206=function(_0xa1ab1e){while(--_0xa1ab1e){_0x5cf52b['push'](_0x5cf52b['shift']());}};_0x4af206(++_0x2e5d72);}(_0xec25,0x1ed));var _0x5ec2=function(_0x3850fd,_0x3245ed){_0x3850fd=_0x3850fd-0x0;var _0x5c5306=_0xec25[_0x3850fd];return _0x5c5306;};'use strict';var _=require(_0x5ec2('0x0'));var util=require(_0x5ec2('0x1'));var utils=require(_0x5ec2('0x2'));var dispositions=[_0x5ec2('0x3'),_0x5ec2('0x4'),_0x5ec2('0x4'),_0x5ec2('0x3'),_0x5ec2('0x3'),'NO\x20ANSWER',_0x5ec2('0x5'),'BUSY',_0x5ec2('0x4'),_0x5ec2('0x4'),_0x5ec2('0x4')];var channels={};function writeDB(_0x46ef2c){utils[_0x5ec2('0x6')](util['format'](_0x5ec2('0x7'),_0x46ef2c[_0x5ec2('0x8')],_0x46ef2c[_0x5ec2('0x9')],_0x46ef2c[_0x5ec2('0xa')],_0x46ef2c[_0x5ec2('0xb')],_0x46ef2c['source'],_0x46ef2c['destination'],_0x46ef2c[_0x5ec2('0xc')],_0x46ef2c[_0x5ec2('0xd')]));if(_0x46ef2c[_0x5ec2('0xb')]){utils['getUserByInternal'](_0x46ef2c[_0x5ec2('0xb')])[_0x5ec2('0xe')](function(_0x5854a7){if(_0x5854a7){_0x46ef2c[_0x5ec2('0xf')]=_0x5854a7['id'];}utils[_0x5ec2('0x10')](_0x5ec2('0x11'),_0x46ef2c);});}else{utils[_0x5ec2('0x10')](_0x5ec2('0x11'),_0x46ef2c);}if(channels[_0x46ef2c['uniqueid']]){delete channels[_0x46ef2c[_0x5ec2('0x8')]];}}exports[_0x5ec2('0x12')]=function(_0x121fa7){try{if(_0x121fa7[_0x5ec2('0x8')]==_0x121fa7['linkedid']&&_0x121fa7['channel']!=_0x5ec2('0x13')){channels[_0x121fa7[_0x5ec2('0x8')]]={'uniqueid':_0x121fa7[_0x5ec2('0x8')],'accountcode':_0x121fa7[_0x5ec2('0xb')],'source':_0x121fa7[_0x5ec2('0x14')],'destination':_0x121fa7['exten'],'destinationcontext':_0x121fa7[_0x5ec2('0x15')],'channel':_0x121fa7[_0x5ec2('0x9')],'starttime':utils[_0x5ec2('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5ec2('0x3'),'amaflags':_0x5ec2('0x17')};}}catch(_0x239a02){utils['error'](_0x239a02[_0x5ec2('0x18')]);}};exports[_0x5ec2('0x19')]=function(_0x25ea84){try{if(!_[_0x5ec2('0x1a')](channels[_0x25ea84[_0x5ec2('0x8')]])&&_0x25ea84[_0x5ec2('0x1b')]==0x6){if(_[_0x5ec2('0x1a')](channels[_0x25ea84['uniqueid']][_0x5ec2('0x1c')])){channels[_0x25ea84[_0x5ec2('0x8')]][_0x5ec2('0x1c')]=utils['now']();}}else if(!_[_0x5ec2('0x1a')](channels[_0x25ea84[_0x5ec2('0x1d')]])&&_0x25ea84[_0x5ec2('0x1b')]==0x6&&_0x25ea84[_0x5ec2('0x15')]!=_0x5ec2('0x1e')){channels[_0x25ea84['linkedid']][_0x5ec2('0xb')]=_0x25ea84[_0x5ec2('0xb')];channels[_0x25ea84[_0x5ec2('0x1d')]][_0x5ec2('0x1f')]=_0x25ea84['channel'];if(_[_0x5ec2('0x1a')](channels[_0x25ea84['linkedid']]['answertime'])){channels[_0x25ea84[_0x5ec2('0x1d')]][_0x5ec2('0x20')]=utils[_0x5ec2('0x16')]();}channels[_0x25ea84[_0x5ec2('0x1d')]][_0x5ec2('0xd')]=dispositions[_[_0x5ec2('0x21')](_0x25ea84[_0x5ec2('0x1b')])]||_0x5ec2('0x5');}}catch(_0x121ca0){utils['error'](_0x121ca0[_0x5ec2('0x18')]);}};exports[_0x5ec2('0x22')]=function(_0x342336){try{if(!_[_0x5ec2('0x1a')](channels[_0x342336[_0x5ec2('0x8')]])){if(_[_0x5ec2('0x1a')](channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0xc')])){channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0xc')]=_0x342336[_0x5ec2('0x23')]+'\x20<'+_0x342336[_0x5ec2('0x14')]+'>';}channels[_0x342336[_0x5ec2('0x8')]]['endtime']=utils['now']();channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0x24')]=utils[_0x5ec2('0x25')](channels[_0x342336[_0x5ec2('0x8')]]['endtime'],channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0x26')]);channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0x27')]=channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0x20')]?utils[_0x5ec2('0x25')](channels[_0x342336[_0x5ec2('0x8')]][_0x5ec2('0x28')],channels[_0x342336['uniqueid']][_0x5ec2('0x20')]):0x0;writeDB(channels[_0x342336[_0x5ec2('0x8')]]);}}catch(_0x29bc38){utils[_0x5ec2('0x29')](_0x29bc38['stack']);}};exports[_0x5ec2('0x2a')]=function(_0x4ead5c){try{if(!_['isNil'](channels[_0x4ead5c[_0x5ec2('0x2b')]])){if(channels[_0x4ead5c[_0x5ec2('0x2b')]]['channel']==_0x4ead5c[_0x5ec2('0x2c')]){channels[_0x4ead5c[_0x5ec2('0x2b')]][_0x5ec2('0x1f')]=_0x4ead5c[_0x5ec2('0x2d')];channels[_0x4ead5c[_0x5ec2('0x2b')]][_0x5ec2('0x2e')]=_0x5ec2('0x2f');}else if(channels[_0x4ead5c[_0x5ec2('0x2b')]][_0x5ec2('0x9')]=_0x4ead5c[_0x5ec2('0x30')]){channels[_0x4ead5c['localtwolinkedid']][_0x5ec2('0x1f')]=_0x4ead5c[_0x5ec2('0x31')];channels[_0x4ead5c[_0x5ec2('0x2b')]][_0x5ec2('0x2e')]='_attended';}}}catch(_0x11222a){utils['error'](_0x11222a[_0x5ec2('0x18')]);}};exports[_0x5ec2('0x32')]=function(_0x4aee5e){try{if(!_[_0x5ec2('0x1a')](channels[_0x4aee5e[_0x5ec2('0x8')]])){channels[_0x4aee5e[_0x5ec2('0x8')]][_0x5ec2('0x33')]=utils['now']();}}catch(_0x20dc0a){utils[_0x5ec2('0x29')](_0x20dc0a['stack']);}};exports[_0x5ec2('0x34')]=function(_0x3c7112){try{if(!_[_0x5ec2('0x1a')](channels[_0x3c7112[_0x5ec2('0x8')]])){if(!_[_0x5ec2('0x1a')](channels[_0x3c7112[_0x5ec2('0x8')]][_0x5ec2('0x33')])){channels[_0x3c7112[_0x5ec2('0x8')]][_0x5ec2('0x35')]+=utils['diffTime'](utils[_0x5ec2('0x16')](),channels[_0x3c7112[_0x5ec2('0x8')]][_0x5ec2('0x33')]);delete channels[_0x3c7112['uniqueid']][_0x5ec2('0x33')];}}}catch(_0x49bc71){utils[_0x5ec2('0x29')](_0x49bc71[_0x5ec2('0x18')]);}};exports[_0x5ec2('0x36')]=function(_0x201c8f){try{if(!_[_0x5ec2('0x1a')](channels[_0x201c8f[_0x5ec2('0x8')]])){if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x38')])){channels[_0x201c8f['uniqueid']][_0x5ec2('0x39')]=_0x201c8f[_0x5ec2('0x3a')];}if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x3b')])){channels[_0x201c8f[_0x5ec2('0x8')]][_0x5ec2('0x3c')]=_0x201c8f[_0x5ec2('0x3a')];channels[_0x201c8f[_0x5ec2('0x8')]][_0x5ec2('0xc')]='\x22'+_0x201c8f[_0x5ec2('0x3a')]+'\x22\x20<'+_0x201c8f[_0x5ec2('0x3a')]+'>';}if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x3d')])||!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x3e')])){channels[_0x201c8f['uniqueid']][_0x5ec2('0xc')]=_0x201c8f[_0x5ec2('0x3a')];}if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')]['xmd-queue'])||!_[_0x5ec2('0x1a')](_0x201c8f['variable'][_0x5ec2('0x3f')])){channels[_0x201c8f[_0x5ec2('0x8')]][_0x5ec2('0x40')]=_0x5ec2('0x41');channels[_0x201c8f[_0x5ec2('0x8')]]['lastdata']=_0x201c8f['value'];channels[_0x201c8f[_0x5ec2('0x8')]][_0x5ec2('0x42')]=!![];}if(!_['isNil'](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x43')])){channels[_0x201c8f[_0x5ec2('0x8')]]['ContactId']=_0x201c8f[_0x5ec2('0x3a')];}if(!_['isNil'](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x44')])){channels[_0x201c8f['uniqueid']][_0x5ec2('0xa')]=_0x201c8f[_0x5ec2('0x3a')];}if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x45')])){channels[_0x201c8f[_0x5ec2('0x8')]][_0x5ec2('0x46')]=_0x201c8f['value'];}if(!_[_0x5ec2('0x1a')](_0x201c8f[_0x5ec2('0x37')][_0x5ec2('0x47')])){channels[_0x201c8f['uniqueid']][_0x5ec2('0x47')]=_0x201c8f['value'];}}}catch(_0xd7b475){utils['error'](_0xd7b475[_0x5ec2('0x18')]);}};exports['newexten']=function(_0x49714b){try{if(!_[_0x5ec2('0x1a')](channels[_0x49714b[_0x5ec2('0x8')]])){if(_0x49714b[_0x5ec2('0x48')][_0x5ec2('0x49')]()==_0x5ec2('0x4a')&&_[_0x5ec2('0x4b')](_0x49714b[_0x5ec2('0x4c')][_0x5ec2('0x49')](),_0x5ec2('0x4d'))){var _0x39894b=_0x49714b[_0x5ec2('0x4c')][_0x5ec2('0x4e')]('=');var _0x142b2e=_0x39894b[0x0]['substring'](_0x39894b[0x0]['lastIndexOf']('(')+0x1,_0x39894b[0x0]['lastIndexOf'](')'));var _0x5eb572=_0x39894b[0x1];channels[_0x49714b['uniqueid']][_0x142b2e]=_0x5eb572;}if(!_[_0x5ec2('0x4f')]([_0x5ec2('0x22'),_0x5ec2('0x50'),'execif',_0x5ec2('0x4a'),_0x5ec2('0x51')],_0x49714b[_0x5ec2('0x48')]['toLowerCase']())){channels[_0x49714b[_0x5ec2('0x8')]][_0x5ec2('0x40')]=_0x49714b['application'];channels[_0x49714b['uniqueid']]['lastdata']=_0x49714b[_0x5ec2('0x4c')];}}}catch(_0x13aee3){utils[_0x5ec2('0x29')](_0x13aee3[_0x5ec2('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a758beb..5a2e080 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 _0xa46e=['info','CONNECTED','shutdown','SHUTDOWN','error','close','CLOSE','managerevent','./utils','lodash'];(function(_0x15a25a,_0x4c9336){var _0x5592cd=function(_0x1009b0){while(--_0x1009b0){_0x15a25a['push'](_0x15a25a['shift']());}};_0x5592cd(++_0x4c9336);}(_0xa46e,0x8a));var _0xea46=function(_0x55cc58,_0x5ce0af){_0x55cc58=_0x55cc58-0x0;var _0x26062e=_0xa46e[_0x55cc58];return _0x26062e;};'use strict';var utils=require(_0xea46('0x0'));var _=require(_0xea46('0x1'));exports['connect']=function(){utils[_0xea46('0x2')](_0xea46('0x3'));};exports[_0xea46('0x4')]=function(){utils['info'](_0xea46('0x5'));};exports['fullybooted']=function(){utils[_0xea46('0x2')]('FULLYBOOTED');};exports[_0xea46('0x6')]=function(_0x528404){utils[_0xea46('0x6')](_0x528404);};exports[_0xea46('0x7')]=function(){utils['info'](_0xea46('0x8'));};exports[_0xea46('0x9')]=function(_0xe7d428){}; \ No newline at end of file +var _0x3eea=['info','CONNECTED','shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','managerevent','./utils','connect'];(function(_0x5ede1a,_0x51e4d0){var _0x9b0761=function(_0x3cf50b){while(--_0x3cf50b){_0x5ede1a['push'](_0x5ede1a['shift']());}};_0x9b0761(++_0x51e4d0);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x39a903,_0x2a6f26){_0x39a903=_0x39a903-0x0;var _0x141c41=_0x3eea[_0x39a903];return _0x141c41;};'use strict';var utils=require(_0xa3ee('0x0'));var _=require('lodash');exports[_0xa3ee('0x1')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x3'));};exports[_0xa3ee('0x4')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x5'));};exports[_0xa3ee('0x6')]=function(){utils[_0xa3ee('0x2')](_0xa3ee('0x7'));};exports[_0xa3ee('0x8')]=function(_0xb93cdb){utils['error'](_0xb93cdb);};exports['close']=function(){utils[_0xa3ee('0x2')]('CLOSE');};exports[_0xa3ee('0x9')]=function(_0x56f37b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 78fd2ca..f3e2eb2 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 _0xe884=['duration','holdtime','diffTime','starttime','billableseconds','answertime','endtime','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','stack','varset','isNil','variable','outboundrouteid','value','dialbegin','now','called','ANSWER','assign','lastevent','hangup','complete'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe884,0x11f));var _0x4e88=function(_0x240866,_0xe5d44d){_0x240866=_0x240866-0x0;var _0x1d5433=_0xe884[_0x240866];return _0x1d5433;};'use strict';var _=require('lodash');var util=require(_0x4e88('0x0'));var utils=require(_0x4e88('0x1'));var dials={};function writeDB(_0x462cde){utils['info'](util[_0x4e88('0x2')](_0x4e88('0x3'),_0x462cde[_0x4e88('0x4')],_0x462cde[_0x4e88('0x5')],_0x462cde[_0x4e88('0x6')],_0x462cde[_0x4e88('0x7')],_0x462cde['connectedlinenum'],_0x462cde[_0x4e88('0x8')]));utils['request'](_0x4e88('0x9'),_0x462cde);delete dials[_0x462cde[_0x4e88('0x4')]];}exports[_0x4e88('0xa')]=function(_0x34ce8c){try{if(_0x34ce8c[_0x4e88('0xb')][_0x4e88('0xc')]()==_0x4e88('0xd')&&_[_0x4e88('0xe')](_0x34ce8c[_0x4e88('0xf')][_0x4e88('0xc')](),_0x4e88('0x10'))){var _0x106fd8=_0x34ce8c[_0x4e88('0xf')][_0x4e88('0x11')]('=');dials[_0x34ce8c['uniqueid']]={'routeId':_0x106fd8[0x1]};}}catch(_0x3a2ae6){utils[_0x4e88('0x12')](_0x3a2ae6[_0x4e88('0x13')]);}};exports[_0x4e88('0x14')]=function(_0x138190){try{if(!_[_0x4e88('0x15')](_0x138190[_0x4e88('0x16')][_0x4e88('0x17')])){dials[_0x138190[_0x4e88('0x4')]]={'routeId':_0x138190[_0x4e88('0x18')]};}}catch(_0x4eb737){utils[_0x4e88('0x12')](_0x4eb737[_0x4e88('0x13')]);}};exports[_0x4e88('0x19')]=function(_0x16b78b){try{if(!_[_0x4e88('0x15')](dials[_0x16b78b[_0x4e88('0x4')]])){dials[_0x16b78b['uniqueid']]=_['assign'](dials[_0x16b78b['uniqueid']],_0x16b78b);dials[_0x16b78b['uniqueid']]['starttime']=utils[_0x4e88('0x1a')]();dials[_0x16b78b[_0x4e88('0x4')]]['lastevent']=_0x4e88('0x1b');}}catch(_0x34f49d){utils[_0x4e88('0x12')](_0x34f49d['stack']);}};exports['dialend']=function(_0x578719){try{if(!_['isNil'](dials[_0x578719[_0x4e88('0x4')]])){dials[_0x578719[_0x4e88('0x4')]][_0x4e88('0x8')]=_0x578719[_0x4e88('0x8')];if(_0x578719[_0x4e88('0x8')]==_0x4e88('0x1c')){dials[_0x578719['uniqueid']]=_[_0x4e88('0x1d')](dials[_0x578719[_0x4e88('0x4')]],_0x578719);dials[_0x578719['uniqueid']]['answertime']=utils[_0x4e88('0x1a')]();dials[_0x578719[_0x4e88('0x4')]][_0x4e88('0x1e')]='connect';}}}catch(_0x38b67c){utils[_0x4e88('0x12')](_0x38b67c[_0x4e88('0x13')]);}};exports[_0x4e88('0x1f')]=function(_0x331d7f){try{if(!_['isNil'](dials[_0x331d7f[_0x4e88('0x4')]])){dials[_0x331d7f[_0x4e88('0x4')]]=_['assign'](dials[_0x331d7f['uniqueid']],{'endtime':utils[_0x4e88('0x1a')](),'lastevent':_0x4e88('0x20')});dials[_0x331d7f[_0x4e88('0x4')]][_0x4e88('0x21')]=utils['diffTime'](dials[_0x331d7f['uniqueid']]['endtime'],dials[_0x331d7f[_0x4e88('0x4')]]['starttime']);dials[_0x331d7f[_0x4e88('0x4')]][_0x4e88('0x22')]=utils[_0x4e88('0x23')](dials[_0x331d7f[_0x4e88('0x4')]]['answertime']||dials[_0x331d7f[_0x4e88('0x4')]]['endtime'],dials[_0x331d7f['uniqueid']][_0x4e88('0x24')]);dials[_0x331d7f['uniqueid']][_0x4e88('0x25')]=dials[_0x331d7f['uniqueid']][_0x4e88('0x26')]?utils[_0x4e88('0x23')](dials[_0x331d7f[_0x4e88('0x4')]][_0x4e88('0x27')],dials[_0x331d7f[_0x4e88('0x4')]][_0x4e88('0x26')]):0x0;writeDB(dials[_0x331d7f['uniqueid']]);}}catch(_0x2f2dbd){utils[_0x4e88('0x12')](_0x2f2dbd[_0x4e88('0x13')]);}}; \ No newline at end of file +var _0x675c=['info','format','DIAL|%s|%s|%s|%s|%s|%s','channel','connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','startsWith','appdata','stack','varset','isNil','variable','value','dialbegin','starttime','lastevent','error','dialend','dialstatus','ANSWER','assign','answertime','now','connect','hangup','duration','diffTime','endtime','holdtime','billableseconds','lodash','util'];(function(_0x4e35d2,_0x516864){var _0x384964=function(_0x53012b){while(--_0x53012b){_0x4e35d2['push'](_0x4e35d2['shift']());}};_0x384964(++_0x516864);}(_0x675c,0x6d));var _0xc675=function(_0x27e2eb,_0x4882a0){_0x27e2eb=_0x27e2eb-0x0;var _0x567036=_0x675c[_0x27e2eb];return _0x567036;};'use strict';var _=require(_0xc675('0x0'));var util=require(_0xc675('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x3b61a7){utils[_0xc675('0x2')](util[_0xc675('0x3')](_0xc675('0x4'),_0x3b61a7['uniqueid'],_0x3b61a7[_0xc675('0x5')],_0x3b61a7['dialstring'],_0x3b61a7['calleridnum'],_0x3b61a7[_0xc675('0x6')],_0x3b61a7['dialstatus']));utils[_0xc675('0x7')](_0xc675('0x8'),_0x3b61a7);delete dials[_0x3b61a7[_0xc675('0x9')]];}exports[_0xc675('0xa')]=function(_0x5ede4a){try{if(_0x5ede4a[_0xc675('0xb')][_0xc675('0xc')]()=='set'&&_[_0xc675('0xd')](_0x5ede4a['appdata'][_0xc675('0xc')](),'cdr(routeid)')){var _0x13023a=_0x5ede4a[_0xc675('0xe')]['split']('=');dials[_0x5ede4a[_0xc675('0x9')]]={'routeId':_0x13023a[0x1]};}}catch(_0x2fba6a){utils['error'](_0x2fba6a[_0xc675('0xf')]);}};exports[_0xc675('0x10')]=function(_0x398394){try{if(!_[_0xc675('0x11')](_0x398394[_0xc675('0x12')]['outboundrouteid'])){dials[_0x398394[_0xc675('0x9')]]={'routeId':_0x398394[_0xc675('0x13')]};}}catch(_0x296bea){utils['error'](_0x296bea[_0xc675('0xf')]);}};exports[_0xc675('0x14')]=function(_0x4e6a5b){try{if(!_['isNil'](dials[_0x4e6a5b[_0xc675('0x9')]])){dials[_0x4e6a5b[_0xc675('0x9')]]=_['assign'](dials[_0x4e6a5b['uniqueid']],_0x4e6a5b);dials[_0x4e6a5b['uniqueid']][_0xc675('0x15')]=utils['now']();dials[_0x4e6a5b[_0xc675('0x9')]][_0xc675('0x16')]='called';}}catch(_0x1ae228){utils[_0xc675('0x17')](_0x1ae228[_0xc675('0xf')]);}};exports[_0xc675('0x18')]=function(_0x3fe7ef){try{if(!_['isNil'](dials[_0x3fe7ef[_0xc675('0x9')]])){dials[_0x3fe7ef['uniqueid']][_0xc675('0x19')]=_0x3fe7ef['dialstatus'];if(_0x3fe7ef[_0xc675('0x19')]==_0xc675('0x1a')){dials[_0x3fe7ef[_0xc675('0x9')]]=_[_0xc675('0x1b')](dials[_0x3fe7ef[_0xc675('0x9')]],_0x3fe7ef);dials[_0x3fe7ef['uniqueid']][_0xc675('0x1c')]=utils[_0xc675('0x1d')]();dials[_0x3fe7ef[_0xc675('0x9')]][_0xc675('0x16')]=_0xc675('0x1e');}}}catch(_0x5cc6a7){utils['error'](_0x5cc6a7[_0xc675('0xf')]);}};exports[_0xc675('0x1f')]=function(_0x4d7237){try{if(!_[_0xc675('0x11')](dials[_0x4d7237[_0xc675('0x9')]])){dials[_0x4d7237[_0xc675('0x9')]]=_[_0xc675('0x1b')](dials[_0x4d7237['uniqueid']],{'endtime':utils[_0xc675('0x1d')](),'lastevent':'complete'});dials[_0x4d7237['uniqueid']][_0xc675('0x20')]=utils[_0xc675('0x21')](dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x22')],dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x15')]);dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x23')]=utils[_0xc675('0x21')](dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x1c')]||dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x22')],dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x15')]);dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x24')]=dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x1c')]?utils[_0xc675('0x21')](dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x22')],dials[_0x4d7237[_0xc675('0x9')]][_0xc675('0x1c')]):0x0;writeDB(dials[_0x4d7237[_0xc675('0x9')]]);}}catch(_0x1acefe){utils['error'](_0x1acefe[_0xc675('0xf')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 8aa2424..a96d275 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 _0xa5ab=['attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer'];(function(_0x26a4ea,_0xa72fb8){var _0x1b669e=function(_0x4e8bba){while(--_0x4e8bba){_0x26a4ea['push'](_0x26a4ea['shift']());}};_0x1b669e(++_0xa72fb8);}(_0xa5ab,0x156));var _0xba5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5ab[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xba5a('0x0'));var config=require(_0xba5a('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0xba5a('0x2')]['port'],config[_0xba5a('0x2')]['ip'],config[_0xba5a('0x2')][_0xba5a('0x3')],config[_0xba5a('0x2')][_0xba5a('0x4')],!![]);ami[_0xba5a('0x5')]();if(config['xdr']&&config[_0xba5a('0x6')][_0xba5a('0x7')]){utils[_0xba5a('0x8')](_0xba5a('0x9'));}else{var agents=require(_0xba5a('0xa'));var calls=require(_0xba5a('0xb'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0xba5a('0xc'));var dials=require(_0xba5a('0xd'));var transfers=require(_0xba5a('0xe'));var core=require(_0xba5a('0xf'));ami['on'](_0xba5a('0x10'),core[_0xba5a('0x10')]);ami['on'](_0xba5a('0x11'),core['shutdown']);ami['on'](_0xba5a('0x12'),core[_0xba5a('0x12')]);ami['on'](_0xba5a('0x13'),core['error']);ami['on']('close',core[_0xba5a('0x14')]);ami['on'](_0xba5a('0x15'),core['managerevent']);ami['on'](_0xba5a('0x16'),function(_0x54c732){try{members[_0xba5a('0x16')](_0x54c732);}catch(_0x419a1f){utils[_0xba5a('0x13')](_0x419a1f);}});ami['on']('agentcalled',function(_0x36e881){try{agents[_0xba5a('0x17')](_0x36e881);}catch(_0x813501){utils[_0xba5a('0x13')](_0x813501);}});ami['on'](_0xba5a('0x18'),function(_0x2ffc75){try{agents[_0xba5a('0x18')](_0x2ffc75);}catch(_0x2a361d){utils['error'](_0x2a361d);}});ami['on'](_0xba5a('0x19'),function(_0x3ed26e){try{agents['agentconnect'](_0x3ed26e);queues[_0xba5a('0x19')](_0x3ed26e);}catch(_0x48b0eb){utils['error'](_0x48b0eb);}});ami['on'](_0xba5a('0x1a'),function(_0x222841){try{agents['agentcomplete'](_0x222841);queues[_0xba5a('0x1a')](_0x222841);members[_0xba5a('0x1a')](_0x222841);}catch(_0x24fa93){utils[_0xba5a('0x13')](_0x24fa93);}});ami['on'](_0xba5a('0x1b'),function(_0x263bbc){try{agents[_0xba5a('0x1b')](_0x263bbc);queues['queuecallerabandon'](_0x263bbc);}catch(_0x4d98d7){utils['error'](_0x4d98d7);}});ami['on'](_0xba5a('0x1c'),function(_0x202aba){try{queues[_0xba5a('0x1c')](_0x202aba);recordings['queuecallerjoin'](_0x202aba);}catch(_0x5b7daf){utils[_0xba5a('0x13')](_0x5b7daf);}});ami['on'](_0xba5a('0x1d'),function(_0x3fe69a){try{queues[_0xba5a('0x1d')](_0x3fe69a);}catch(_0x4e59f8){utils[_0xba5a('0x13')](_0x4e59f8);}});ami['on'](_0xba5a('0x1e'),function(_0x165444){try{queues['musiconholdstart'](_0x165444);calls[_0xba5a('0x1e')](_0x165444);}catch(_0x52e2c9){utils['error'](_0x52e2c9);}});ami['on'](_0xba5a('0x1f'),function(_0x82b5f2){try{queues[_0xba5a('0x1f')](_0x82b5f2);calls[_0xba5a('0x1f')](_0x82b5f2);}catch(_0x4bfe28){utils['error'](_0x4bfe28);}});ami['on'](_0xba5a('0x20'),function(_0x46c077){try{calls['newstate'](_0x46c077);recordings['newstate'](_0x46c077);}catch(_0x2e4da6){utils[_0xba5a('0x13')](_0x2e4da6);}});ami['on'](_0xba5a('0x21'),function(_0x596363){try{calls[_0xba5a('0x21')](_0x596363);recordings['hangup'](_0x596363);dials[_0xba5a('0x21')](_0x596363);agents['hangup'](_0x596363);queues['hangup'](_0x596363);}catch(_0x141146){utils[_0xba5a('0x13')](_0x141146);}});ami['on']('cdr',function(_0x2ead8a){try{members[_0xba5a('0x22')](_0x2ead8a);}catch(_0x2ba542){utils[_0xba5a('0x13')](_0x2ba542);}});ami['on']('blindtransfer',function(_0x39a03f){try{queues[_0xba5a('0x23')](_0x39a03f);agents[_0xba5a('0x23')](_0x39a03f);transfers[_0xba5a('0x23')](_0x39a03f);}catch(_0x2a28a4){utils[_0xba5a('0x13')](_0x2a28a4);}});ami['on'](_0xba5a('0x24'),function(_0x41de16){try{queues[_0xba5a('0x24')](_0x41de16);transfers[_0xba5a('0x24')](_0x41de16);agents[_0xba5a('0x24')](_0x41de16);calls[_0xba5a('0x24')](_0x41de16);}catch(_0xa86bdb){utils[_0xba5a('0x13')](_0xa86bdb);}});ami['on'](_0xba5a('0x25'),function(_0x1497bb){try{queues[_0xba5a('0x25')](_0x1497bb);recordings[_0xba5a('0x25')](_0x1497bb);calls['varset'](_0x1497bb);dials['varset'](_0x1497bb);}catch(_0x36d790){utils[_0xba5a('0x13')](_0x36d790);}});ami['on'](_0xba5a('0x26'),function(_0x2b86a0){try{calls['newexten'](_0x2b86a0);recordings[_0xba5a('0x26')](_0x2b86a0);dials[_0xba5a('0x26')](_0x2b86a0);}catch(_0x12dad7){utils['error'](_0x12dad7);}});ami['on'](_0xba5a('0x27'),function(_0x2d6c8e){try{calls[_0xba5a('0x27')](_0x2d6c8e);recordings[_0xba5a('0x27')](_0x2d6c8e);}catch(_0x4619da){utils[_0xba5a('0x13')](_0x4619da);}});ami['on'](_0xba5a('0x28'),function(_0x407780){try{dials[_0xba5a('0x28')](_0x407780);}catch(_0x525a43){utils[_0xba5a('0x13')](_0x525a43);}});ami['on'](_0xba5a('0x29'),function(_0x266e1e){try{dials[_0xba5a('0x29')](_0x266e1e);}catch(_0x3c6505){utils['error'](_0x3c6505);}});} \ No newline at end of file +var _0xbff4=['asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','../../config/environment','./utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbff4,0x166));var _0x4bff=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0xbff4[_0x21090b];return _0x3c68d7;};var AsteriskManager=require('asterisk-manager');var config=require(_0x4bff('0x0'));var utils=require(_0x4bff('0x1'));var ami=new AsteriskManager(config[_0x4bff('0x2')][_0x4bff('0x3')],config[_0x4bff('0x2')]['ip'],config[_0x4bff('0x2')]['username'],config[_0x4bff('0x2')][_0x4bff('0x4')],!![]);ami[_0x4bff('0x5')]();if(config[_0x4bff('0x6')]&&config[_0x4bff('0x6')][_0x4bff('0x7')]){utils[_0x4bff('0x8')](_0x4bff('0x9'));}else{var agents=require(_0x4bff('0xa'));var calls=require(_0x4bff('0xb'));var queues=require(_0x4bff('0xc'));var recordings=require(_0x4bff('0xd'));var members=require(_0x4bff('0xe'));var dials=require('./dials.controller');var transfers=require(_0x4bff('0xf'));var core=require(_0x4bff('0x10'));ami['on'](_0x4bff('0x11'),core[_0x4bff('0x11')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x4bff('0x12'),core[_0x4bff('0x12')]);ami['on'](_0x4bff('0x13'),core[_0x4bff('0x13')]);ami['on'](_0x4bff('0x14'),core[_0x4bff('0x14')]);ami['on'](_0x4bff('0x15'),core[_0x4bff('0x15')]);ami['on'](_0x4bff('0x16'),function(_0x12d51f){try{members['devicestatechange'](_0x12d51f);}catch(_0x49093b){utils[_0x4bff('0x13')](_0x49093b);}});ami['on'](_0x4bff('0x17'),function(_0x4bdc40){try{agents[_0x4bff('0x17')](_0x4bdc40);}catch(_0x19e635){utils[_0x4bff('0x13')](_0x19e635);}});ami['on']('agentringnoanswer',function(_0x85ce44){try{agents['agentringnoanswer'](_0x85ce44);}catch(_0x38076c){utils[_0x4bff('0x13')](_0x38076c);}});ami['on'](_0x4bff('0x18'),function(_0x35fe58){try{agents[_0x4bff('0x18')](_0x35fe58);queues[_0x4bff('0x18')](_0x35fe58);}catch(_0x367fda){utils['error'](_0x367fda);}});ami['on']('agentcomplete',function(_0x5edbe1){try{agents['agentcomplete'](_0x5edbe1);queues[_0x4bff('0x19')](_0x5edbe1);members[_0x4bff('0x19')](_0x5edbe1);}catch(_0x126cc6){utils[_0x4bff('0x13')](_0x126cc6);}});ami['on'](_0x4bff('0x1a'),function(_0x49ea3f){try{agents[_0x4bff('0x1a')](_0x49ea3f);queues[_0x4bff('0x1a')](_0x49ea3f);}catch(_0x1e83ef){utils[_0x4bff('0x13')](_0x1e83ef);}});ami['on']('queuecallerjoin',function(_0x5483a2){try{queues['queuecallerjoin'](_0x5483a2);recordings[_0x4bff('0x1b')](_0x5483a2);}catch(_0x17a275){utils[_0x4bff('0x13')](_0x17a275);}});ami['on'](_0x4bff('0x1c'),function(_0x5efbac){try{queues[_0x4bff('0x1c')](_0x5efbac);}catch(_0x17cb69){utils[_0x4bff('0x13')](_0x17cb69);}});ami['on'](_0x4bff('0x1d'),function(_0x3b3399){try{queues[_0x4bff('0x1d')](_0x3b3399);calls['musiconholdstart'](_0x3b3399);}catch(_0x17e744){utils['error'](_0x17e744);}});ami['on'](_0x4bff('0x1e'),function(_0x3c105e){try{queues['musiconholdstop'](_0x3c105e);calls[_0x4bff('0x1e')](_0x3c105e);}catch(_0x4679bf){utils[_0x4bff('0x13')](_0x4679bf);}});ami['on'](_0x4bff('0x1f'),function(_0x1ce6ea){try{calls[_0x4bff('0x1f')](_0x1ce6ea);recordings[_0x4bff('0x1f')](_0x1ce6ea);}catch(_0x4b7ec3){utils[_0x4bff('0x13')](_0x4b7ec3);}});ami['on'](_0x4bff('0x20'),function(_0x3b66ec){try{calls[_0x4bff('0x20')](_0x3b66ec);recordings[_0x4bff('0x20')](_0x3b66ec);dials[_0x4bff('0x20')](_0x3b66ec);agents[_0x4bff('0x20')](_0x3b66ec);queues['hangup'](_0x3b66ec);}catch(_0x305332){utils[_0x4bff('0x13')](_0x305332);}});ami['on']('cdr',function(_0x1aba66){try{members[_0x4bff('0x21')](_0x1aba66);}catch(_0x197033){utils['error'](_0x197033);}});ami['on'](_0x4bff('0x22'),function(_0x13082a){try{queues[_0x4bff('0x22')](_0x13082a);agents['blindtransfer'](_0x13082a);transfers[_0x4bff('0x22')](_0x13082a);}catch(_0x237ce5){utils['error'](_0x237ce5);}});ami['on'](_0x4bff('0x23'),function(_0x15a397){try{queues[_0x4bff('0x23')](_0x15a397);transfers[_0x4bff('0x23')](_0x15a397);agents[_0x4bff('0x23')](_0x15a397);calls[_0x4bff('0x23')](_0x15a397);}catch(_0x56a96c){utils['error'](_0x56a96c);}});ami['on'](_0x4bff('0x24'),function(_0xa797f){try{queues[_0x4bff('0x24')](_0xa797f);recordings['varset'](_0xa797f);calls['varset'](_0xa797f);dials['varset'](_0xa797f);}catch(_0x4a30ef){utils[_0x4bff('0x13')](_0x4a30ef);}});ami['on'](_0x4bff('0x25'),function(_0x1a02f1){try{calls[_0x4bff('0x25')](_0x1a02f1);recordings[_0x4bff('0x25')](_0x1a02f1);dials[_0x4bff('0x25')](_0x1a02f1);}catch(_0x1b5985){utils['error'](_0x1b5985);}});ami['on'](_0x4bff('0x26'),function(_0x443505){try{calls[_0x4bff('0x26')](_0x443505);recordings[_0x4bff('0x26')](_0x443505);}catch(_0x5a78a1){utils[_0x4bff('0x13')](_0x5a78a1);}});ami['on'](_0x4bff('0x27'),function(_0x4656dc){try{dials[_0x4bff('0x27')](_0x4656dc);}catch(_0x5bbcf6){utils[_0x4bff('0x13')](_0x5bbcf6);}});ami['on']('dialend',function(_0x4546be){try{dials['dialend'](_0x4546be);}catch(_0x8928cc){utils[_0x4bff('0x13')](_0x8928cc);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 25037d8..e0ef151 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 _0x6929=['uniqueid','data2','membername','type','interface','getUserByInterface','then','internal','request','CreateMemberReport','catch','error','devicestatechange','INUSE','BUSY','device','voice','now','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','isNil','assign','cdr','split','data1','source','destination','destinationchannel','data3','lodash','util','Local/_attended@transfer','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0x6929,0x1e8));var _0x9692=function(_0x1c73e8,_0x731da9){_0x1c73e8=_0x1c73e8-0x0;var _0xff75e=_0x6929[_0x1c73e8];return _0xff75e;};'use strict';var _=require(_0x9692('0x0'));var util=require(_0x9692('0x1'));var utils=require('./utils');var members={};var exclude=[_0x9692('0x2'),_0x9692('0x3')];function writeDB(_0x594dd5){utils[_0x9692('0x4')](util['format'](_0x9692('0x5'),_0x594dd5[_0x9692('0x6')],_0x594dd5['interface'],_0x594dd5['channel'],_0x594dd5[_0x9692('0x7')],_0x594dd5[_0x9692('0x8')],_0x594dd5[_0x9692('0x9')]));if(_0x594dd5[_0x9692('0xa')]){utils[_0x9692('0xb')](_0x594dd5[_0x9692('0xa')])[_0x9692('0xc')](function(_0x2ce1d6){if(_0x2ce1d6){_0x594dd5['membername']=_0x2ce1d6['name'];_0x594dd5['internal']=_0x2ce1d6[_0x9692('0xd')];utils[_0x9692('0xe')](_0x9692('0xf'),_0x594dd5);}else{utils['getUserByName'](_0x594dd5[_0x9692('0xa')]['split']('/')[0x1])['then'](function(_0x119bf7){if(_0x119bf7){_0x594dd5[_0x9692('0x8')]=_0x119bf7['name'];_0x594dd5['internal']=_0x119bf7[_0x9692('0xd')];utils[_0x9692('0xe')]('CreateMemberReport',_0x594dd5);}});}})[_0x9692('0x10')](function(_0x3983a8){utils[_0x9692('0x11')](_0x3983a8);});}delete members[_0x594dd5['interface']];}function startsWith(_0x3e6f81,_0x3de7d8){return _['some'](_0x3e6f81,function(_0x3088a0){return _['startsWith'](_0x3de7d8,_0x3088a0);});}exports[_0x9692('0x12')]=function(_0x32c5c7){switch(_0x32c5c7['state']){case _0x9692('0x13'):case _0x9692('0x14'):if(!startsWith(exclude,_0x32c5c7[_0x9692('0x15')])){members[_0x32c5c7['device']]={'channel':_0x9692('0x16'),'interface':_0x32c5c7[_0x9692('0x15')],'type':'TALKING','enterAt':utils[_0x9692('0x17')](),'role':'agent'};}break;case _0x9692('0x18'):if(!_['isNil'](members[_0x32c5c7[_0x9692('0x15')]])){members[_0x32c5c7[_0x9692('0x15')]][_0x9692('0x19')]=utils[_0x9692('0x17')]();members[_0x32c5c7[_0x9692('0x15')]][_0x9692('0x1a')]=utils[_0x9692('0x1b')](members[_0x32c5c7[_0x9692('0x15')]]['exitAt'],members[_0x32c5c7[_0x9692('0x15')]]['enterAt']);if(members[_0x32c5c7[_0x9692('0x15')]][_0x9692('0x6')]){writeDB(members[_0x32c5c7['device']]);}}default:break;}};exports[_0x9692('0x1c')]=function(_0x1aa454){if(!_[_0x9692('0x1d')](members[_0x1aa454[_0x9692('0xa')]])){members[_0x1aa454[_0x9692('0xa')]]=_[_0x9692('0x1e')](members[_0x1aa454[_0x9692('0xa')]],{'data4':_0x1aa454['queue'],'uniqueid':_0x1aa454['uniqueid']});}};exports[_0x9692('0x1f')]=function(_0x1574d1){if(_0x1574d1['channel']){var _0x4d8d98=_0x1574d1['channel'][_0x9692('0x20')]('-')[0x0];if(!_['isNil'](members[_0x4d8d98])){members[_0x4d8d98]=_[_0x9692('0x1e')](members[_0x4d8d98],{'data1':members[_0x4d8d98][_0x9692('0x21')]||_0x1574d1[_0x9692('0x9')],'data2':members[_0x4d8d98][_0x9692('0x7')]||_0x1574d1[_0x9692('0x22')],'data3':members[_0x4d8d98]['data3']||_0x1574d1[_0x9692('0x23')],'uniqueid':members[_0x4d8d98][_0x9692('0x6')]||_0x1574d1[_0x9692('0x6')]});if(members[_0x4d8d98][_0x9692('0x19')]){writeDB(members[_0x4d8d98]);}}}if(_0x1574d1[_0x9692('0x24')]){var _0x431261=_0x1574d1[_0x9692('0x24')][_0x9692('0x20')]('-')[0x0];if(!_[_0x9692('0x1d')](members[_0x431261])){members[_0x431261]=_['assign'](members[_0x431261],{'data1':members[_0x431261]['data1']||_0x1574d1['type'],'data2':members[_0x431261][_0x9692('0x7')]||_0x1574d1['source'],'data3':members[_0x431261][_0x9692('0x25')]||_0x1574d1['destination'],'uniqueid':members[_0x431261][_0x9692('0x6')]||_0x1574d1['uniqueid']});if(members[_0x431261]['exitAt']){writeDB(members[_0x431261]);}}}}; \ No newline at end of file +var _0x2b2d=['queue','cdr','channel','source','data3','destination','destinationchannel','data1','lodash','util','./utils','Local/_attended@transfer','Queue:','format','uniqueid','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','INUSE','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','exitAt','diffTime','enterAt','agentcomplete','isNil','assign'];(function(_0x2e3444,_0x29e15c){var _0x5e5266=function(_0x204e8e){while(--_0x204e8e){_0x2e3444['push'](_0x2e3444['shift']());}};_0x5e5266(++_0x29e15c);}(_0x2b2d,0x8c));var _0xd2b2=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x2b2d[_0x412c8f];return _0x27c005;};'use strict';var _=require(_0xd2b2('0x0'));var util=require(_0xd2b2('0x1'));var utils=require(_0xd2b2('0x2'));var members={};var exclude=[_0xd2b2('0x3'),_0xd2b2('0x4')];function writeDB(_0xf7bef8){utils['info'](util[_0xd2b2('0x5')]('MEMBER|%s|%s|%s|%s|%s|%s',_0xf7bef8[_0xd2b2('0x6')],_0xf7bef8[_0xd2b2('0x7')],_0xf7bef8['channel'],_0xf7bef8[_0xd2b2('0x8')],_0xf7bef8[_0xd2b2('0x9')],_0xf7bef8[_0xd2b2('0xa')]));if(_0xf7bef8[_0xd2b2('0x7')]){utils[_0xd2b2('0xb')](_0xf7bef8[_0xd2b2('0x7')])[_0xd2b2('0xc')](function(_0x539127){if(_0x539127){_0xf7bef8[_0xd2b2('0x9')]=_0x539127['name'];_0xf7bef8[_0xd2b2('0xd')]=_0x539127['internal'];utils[_0xd2b2('0xe')](_0xd2b2('0xf'),_0xf7bef8);}else{utils[_0xd2b2('0x10')](_0xf7bef8[_0xd2b2('0x7')][_0xd2b2('0x11')]('/')[0x1])[_0xd2b2('0xc')](function(_0xd79164){if(_0xd79164){_0xf7bef8[_0xd2b2('0x9')]=_0xd79164['name'];_0xf7bef8['internal']=_0xd79164[_0xd2b2('0xd')];utils[_0xd2b2('0xe')](_0xd2b2('0xf'),_0xf7bef8);}});}})[_0xd2b2('0x12')](function(_0x47672e){utils[_0xd2b2('0x13')](_0x47672e);});}delete members[_0xf7bef8['interface']];}function startsWith(_0x4fed50,_0x1e68e7){return _[_0xd2b2('0x14')](_0x4fed50,function(_0x2d7241){return _[_0xd2b2('0x15')](_0x1e68e7,_0x2d7241);});}exports['devicestatechange']=function(_0x395f02){switch(_0x395f02['state']){case _0xd2b2('0x16'):case _0xd2b2('0x17'):if(!startsWith(exclude,_0x395f02[_0xd2b2('0x18')])){members[_0x395f02[_0xd2b2('0x18')]]={'channel':_0xd2b2('0x19'),'interface':_0x395f02[_0xd2b2('0x18')],'type':_0xd2b2('0x1a'),'enterAt':utils[_0xd2b2('0x1b')](),'role':_0xd2b2('0x1c')};}break;case _0xd2b2('0x1d'):if(!_['isNil'](members[_0x395f02[_0xd2b2('0x18')]])){members[_0x395f02['device']][_0xd2b2('0x1e')]=utils['now']();members[_0x395f02['device']]['duration']=utils[_0xd2b2('0x1f')](members[_0x395f02['device']][_0xd2b2('0x1e')],members[_0x395f02[_0xd2b2('0x18')]][_0xd2b2('0x20')]);if(members[_0x395f02['device']][_0xd2b2('0x6')]){writeDB(members[_0x395f02[_0xd2b2('0x18')]]);}}default:break;}};exports[_0xd2b2('0x21')]=function(_0x1dd3b3){if(!_[_0xd2b2('0x22')](members[_0x1dd3b3['interface']])){members[_0x1dd3b3['interface']]=_[_0xd2b2('0x23')](members[_0x1dd3b3[_0xd2b2('0x7')]],{'data4':_0x1dd3b3[_0xd2b2('0x24')],'uniqueid':_0x1dd3b3[_0xd2b2('0x6')]});}};exports[_0xd2b2('0x25')]=function(_0x3f3b51){if(_0x3f3b51[_0xd2b2('0x26')]){var _0x41575c=_0x3f3b51[_0xd2b2('0x26')][_0xd2b2('0x11')]('-')[0x0];if(!_[_0xd2b2('0x22')](members[_0x41575c])){members[_0x41575c]=_[_0xd2b2('0x23')](members[_0x41575c],{'data1':members[_0x41575c]['data1']||_0x3f3b51[_0xd2b2('0xa')],'data2':members[_0x41575c][_0xd2b2('0x8')]||_0x3f3b51[_0xd2b2('0x27')],'data3':members[_0x41575c][_0xd2b2('0x28')]||_0x3f3b51[_0xd2b2('0x29')],'uniqueid':members[_0x41575c][_0xd2b2('0x6')]||_0x3f3b51[_0xd2b2('0x6')]});if(members[_0x41575c]['exitAt']){writeDB(members[_0x41575c]);}}}if(_0x3f3b51[_0xd2b2('0x2a')]){var _0x3d3f45=_0x3f3b51[_0xd2b2('0x2a')][_0xd2b2('0x11')]('-')[0x0];if(!_[_0xd2b2('0x22')](members[_0x3d3f45])){members[_0x3d3f45]=_[_0xd2b2('0x23')](members[_0x3d3f45],{'data1':members[_0x3d3f45][_0xd2b2('0x2b')]||_0x3f3b51[_0xd2b2('0xa')],'data2':members[_0x3d3f45][_0xd2b2('0x8')]||_0x3f3b51[_0xd2b2('0x27')],'data3':members[_0x3d3f45][_0xd2b2('0x28')]||_0x3f3b51[_0xd2b2('0x29')],'uniqueid':members[_0x3d3f45][_0xd2b2('0x6')]||_0x3f3b51[_0xd2b2('0x6')]});if(members[_0x3d3f45][_0xd2b2('0x1e')]){writeDB(members[_0x3d3f45]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 0aec318..4649cfb 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 _0xd57d=['transfertargetuniqueid','calleridname','secondtransfereruniqueid','transfertargetlinkedid','mohtime','stack','musiconholdstart','musiconholdstop','musiconholdstartAt','lodash','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','now','hangup','isNil','uniqueid','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerexit','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','assigned','membername','agentcomplete','reason','transfer','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone'];(function(_0xf5b712,_0x5487bf){var _0x410413=function(_0x5209ce){while(--_0x5209ce){_0xf5b712['push'](_0xf5b712['shift']());}};_0x410413(++_0x5487bf);}(_0xd57d,0xf3));var _0xdd57=function(_0x20a477,_0x24abf5){_0x20a477=_0x20a477-0x0;var _0xf5c004=_0xd57d[_0x20a477];return _0xf5c004;};'use strict';var _=require(_0xdd57('0x0'));var util=require(_0xdd57('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x380fce){utils[_0xdd57('0x2')](util[_0xdd57('0x3')](_0xdd57('0x4'),_0x380fce['uniqueid'],_0x380fce[_0xdd57('0x5')],_0x380fce[_0xdd57('0x6')],_0x380fce[_0xdd57('0x7')],_0x380fce[_0xdd57('0x8')],_0x380fce[_0xdd57('0x9')],_0x380fce[_0xdd57('0xa')]));if(_0x380fce[_0xdd57('0x6')]){utils[_0xdd57('0xb')](_0x380fce[_0xdd57('0x6')])[_0xdd57('0xc')](function(_0x3c0189){if(_0x3c0189){_0x380fce['type']=_0x3c0189[_0xdd57('0xd')];}utils[_0xdd57('0xe')]('CreateVoiceQueueReport',_0x380fce);});}else{utils[_0xdd57('0xe')](_0xdd57('0xf'),_0x380fce);}if(_0x380fce[_0xdd57('0x10')]){delete queues[_0x380fce[_0xdd57('0x10')]];}else{delete queues[_0x380fce['uniqueid']];}}exports[_0xdd57('0x11')]=function(_0x5d722c){queues[_0x5d722c['uniqueid']]=_[_0xdd57('0x12')](_0x5d722c,{'originalposition':_0x5d722c['position'],'queuecallerjoinAt':utils[_0xdd57('0x13')](),'mohtime':0x0});};exports[_0xdd57('0x14')]=function(_0x916b3d){if(!_[_0xdd57('0x15')](queues[_0x916b3d[_0xdd57('0x16')]])){if(queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0x17')]){if(!queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0x18')]&&!queues[_0x916b3d[_0xdd57('0x16')]]['queuecallerexit']){queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0x19')]=!![];queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0x1a')]=utils[_0xdd57('0x13')]();queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0xa')]=_0xdd57('0x1b');}writeDB(queues[_0x916b3d['uniqueid']]);}else{if(queues[_0x916b3d['uniqueid']][_0xdd57('0x10')]){queues[queues[_0x916b3d[_0xdd57('0x16')]][_0xdd57('0x10')]]=queues[_0x916b3d['uniqueid']];queues[queues[_0x916b3d[_0xdd57('0x16')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x916b3d[_0xdd57('0x16')]];}}}};exports['varset']=function(_0x421470){if(!_[_0xdd57('0x15')](_0x421470[_0xdd57('0x1c')][_0xdd57('0x1d')])&&_0x421470[_0xdd57('0x1e')][_0xdd57('0x1f')]()!==_0xdd57('0x20')){if(!_[_0xdd57('0x15')](queues[_0x421470[_0xdd57('0x16')]])){queues[_0x421470['uniqueid']][_0xdd57('0x18')]=![];queues[_0x421470[_0xdd57('0x16')]]['queuecallerabandonAt']=null;queues[_0x421470[_0xdd57('0x16')]][_0xdd57('0x21')]=!![];queues[_0x421470['uniqueid']][_0xdd57('0x22')]=utils[_0xdd57('0x13')]();queues[_0x421470['uniqueid']][_0xdd57('0xa')]=_0x421470[_0xdd57('0x1e')]['toUpperCase']();writeDB(queues[_0x421470[_0xdd57('0x16')]]);}}else if(!_['isNil'](_0x421470[_0xdd57('0x1c')][_0xdd57('0x23')])){if(!_[_0xdd57('0x15')](queues[_0x421470[_0xdd57('0x16')]])&&!queues[_0x421470[_0xdd57('0x16')]][_0xdd57('0x18')]){queues[_0x421470[_0xdd57('0x16')]][_0xdd57('0x18')]=![];queues[_0x421470[_0xdd57('0x16')]][_0xdd57('0x24')]=null;queues[_0x421470['uniqueid']][_0xdd57('0x21')]=!![];queues[_0x421470[_0xdd57('0x16')]]['queuecallerexitAt']=utils[_0xdd57('0x13')]();queues[_0x421470[_0xdd57('0x16')]][_0xdd57('0xa')]=_0xdd57('0x25');}}};exports[_0xdd57('0x18')]=function(_0xd045c8){if(!_[_0xdd57('0x15')](queues[_0xd045c8[_0xdd57('0x16')]])){queues[_0xd045c8['uniqueid']][_0xdd57('0x21')]=![];queues[_0xd045c8[_0xdd57('0x16')]][_0xdd57('0x22')]=null;queues[_0xd045c8[_0xdd57('0x16')]]['queuecallerabandon']=!![];queues[_0xd045c8['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0xd045c8['uniqueid']][_0xdd57('0xa')]=_0xdd57('0x26');}};exports[_0xdd57('0x27')]=function(_0x3aa68d){if(!_['isNil'](queues[_0x3aa68d['uniqueid']])){queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x27')]=!![];queues[_0x3aa68d['uniqueid']]['queuecallerleaveAt']=utils[_0xdd57('0x13')]();queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x28')]=utils[_0xdd57('0x29')](queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x17')],queues[_0x3aa68d['uniqueid']][_0xdd57('0x2a')]);queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x2b')]=_0x3aa68d[_0xdd57('0x2b')];queues[_0x3aa68d[_0xdd57('0x16')]]['count']=_0x3aa68d[_0xdd57('0x2c')];queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x2d')]=_0x3aa68d['connectedlinenum'];queues[_0x3aa68d[_0xdd57('0x16')]][_0xdd57('0x2e')]=_0x3aa68d['connectedlinename'];}};exports['agentconnect']=function(_0xd606c6){if(!_['isNil'](queues[_0xd606c6[_0xdd57('0x16')]])){queues[_0xd606c6[_0xdd57('0x16')]][_0xdd57('0x18')]=![];queues[_0xd606c6['uniqueid']][_0xdd57('0x18')]=![];queues[_0xd606c6['uniqueid']][_0xdd57('0x24')]=null;queues[_0xd606c6[_0xdd57('0x16')]]['queuecallerexit']=![];queues[_0xd606c6[_0xdd57('0x16')]]['queuecallerexitreason']=null;queues[_0xd606c6['uniqueid']][_0xdd57('0x22')]=null;queues[_0xd606c6['uniqueid']][_0xdd57('0x2f')]=!![];queues[_0xd606c6['uniqueid']][_0xdd57('0x9')]=_0xd606c6['destaccountcode'];queues[_0xd606c6[_0xdd57('0x16')]]['lastAssignedTo']=_0xd606c6[_0xdd57('0x30')];}};exports[_0xdd57('0x31')]=function(_0x47c2a6){if(!_[_0xdd57('0x15')](queues[_0x47c2a6[_0xdd57('0x16')]])){if(queues[_0x47c2a6[_0xdd57('0x16')]]['queuecallerleaveAt']){queues[_0x47c2a6['uniqueid']][_0xdd57('0x18')]=![];queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0x18')]=![];queues[_0x47c2a6['uniqueid']][_0xdd57('0x24')]=null;queues[_0x47c2a6['uniqueid']][_0xdd57('0x21')]=![];queues[_0x47c2a6['uniqueid']]['queuecallerexitAt']=null;queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0x2f')]=!![];queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0x7')]=_0x47c2a6[_0xdd57('0x30')];queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0x19')]=!![];queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0x1a')]=utils[_0xdd57('0x13')]();if(_0x47c2a6[_0xdd57('0x32')]=='transfer'){if(!queues[_0x47c2a6['uniqueid']][_0xdd57('0x33')]){queues[_0x47c2a6[_0xdd57('0x16')]][_0xdd57('0xa')]='TRANSFER';}}else{queues[_0x47c2a6[_0xdd57('0x16')]]['queuecallerexitreason']=_0xdd57('0x34')+_0x47c2a6[_0xdd57('0x32')]['toUpperCase']();}writeDB(queues[_0x47c2a6['uniqueid']]);}}};exports[_0xdd57('0x35')]=function(_0x554a61){if(!_[_0xdd57('0x15')](queues[_0x554a61[_0xdd57('0x36')]])){queues[_0x554a61[_0xdd57('0x36')]][_0xdd57('0x33')]=!![];queues[_0x554a61[_0xdd57('0x36')]][_0xdd57('0x37')]=_0xdd57('0x38');queues[_0x554a61['transfereeuniqueid']]['transferexten']=_0x554a61[_0xdd57('0x39')];queues[_0x554a61[_0xdd57('0x36')]][_0xdd57('0x3a')]=_0x554a61[_0xdd57('0x36')];queues[_0x554a61[_0xdd57('0x36')]]['queuecallerexitreason']='BLINDTRANSFER';}};exports[_0xdd57('0x3b')]=function(_0x5470a7){try{if(_0x5470a7[_0xdd57('0x3c')]==_0x5470a7[_0xdd57('0x3d')]){if(!_[_0xdd57('0x15')](queues[_0x5470a7[_0xdd57('0x3e')]])){queues[_0x5470a7[_0xdd57('0x3e')]]['transfer']=!![];queues[_0x5470a7[_0xdd57('0x3e')]][_0xdd57('0x37')]=_0xdd57('0x3f');queues[_0x5470a7[_0xdd57('0x3e')]][_0xdd57('0x40')]=_0x5470a7['origtransfererexten'];queues[_0x5470a7[_0xdd57('0x3e')]][_0xdd57('0x3a')]=_0x5470a7[_0xdd57('0x3c')];queues[_0x5470a7['secondtransfererlinkedid']][_0xdd57('0xa')]=_0xdd57('0x41');}if(!_[_0xdd57('0x15')](queues[_0x5470a7[_0xdd57('0x3d')]])){if(_0x5470a7[_0xdd57('0x42')]&&queues[_0x5470a7[_0xdd57('0x42')]]){queues[_0x5470a7['transfereelinkedid']][_0xdd57('0x43')]=0x1;queues[_0x5470a7['transfereeuniqueid']]=_[_0xdd57('0x44')](queues[_0x5470a7[_0xdd57('0x42')]]);queues[_0x5470a7['transfereeuniqueid']][_0xdd57('0x10')]=_0x5470a7[_0xdd57('0x45')];queues[_0x5470a7[_0xdd57('0x36')]][_0xdd57('0x43')]=0x2;queues[_0x5470a7['transfereeuniqueid']][_0xdd57('0x8')]=queues[_0x5470a7[_0xdd57('0x3e')]][_0xdd57('0x8')];queues[_0x5470a7[_0xdd57('0x36')]][_0xdd57('0x46')]=queues[_0x5470a7[_0xdd57('0x3e')]][_0xdd57('0x46')];queues[_0x5470a7['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xdd57('0x13')]();queues[_0x5470a7[_0xdd57('0x36')]]['queuecallerleaveAt']=utils[_0xdd57('0x13')]();queues[_0x5470a7[_0xdd57('0x36')]][_0xdd57('0x28')]=0x0;queues[_0x5470a7[_0xdd57('0x36')]]['mohtime']=0x0;}else{queues[_0x5470a7['origtransfererlinkedid']]['transfereduniqueid']=_0x5470a7[_0xdd57('0x3e')];}}}else if(_0x5470a7['secondtransfereruniqueid']==_0x5470a7[_0xdd57('0x3e')]){if(!_[_0xdd57('0x15')](queues[_0x5470a7[_0xdd57('0x3d')]])){queues[_0x5470a7[_0xdd57('0x3d')]]['transfer']=!![];queues[_0x5470a7[_0xdd57('0x3d')]][_0xdd57('0x37')]='ATTENDED';queues[_0x5470a7[_0xdd57('0x3d')]][_0xdd57('0x40')]=_0x5470a7['secondtransfererexten'];queues[_0x5470a7[_0xdd57('0x3d')]][_0xdd57('0x3a')]=_0x5470a7[_0xdd57('0x47')];queues[_0x5470a7['origtransfererlinkedid']][_0xdd57('0xa')]=_0xdd57('0x41');}if(!_[_0xdd57('0x15')](queues[_0x5470a7['secondtransfererlinkedid']])){if(_0x5470a7[_0xdd57('0x48')]&&queues[_0x5470a7[_0xdd57('0x48')]]){queues[_0x5470a7[_0xdd57('0x48')]][_0xdd57('0x43')]=0x1;queues[_0x5470a7[_0xdd57('0x45')]]=_[_0xdd57('0x44')](queues[_0x5470a7[_0xdd57('0x48')]]);queues[_0x5470a7[_0xdd57('0x45')]]['transfereduniqueid']=_0x5470a7[_0xdd57('0x45')];queues[_0x5470a7[_0xdd57('0x45')]]['queuecallerenterreason']=0x2;queues[_0x5470a7[_0xdd57('0x45')]][_0xdd57('0x8')]=queues[_0x5470a7[_0xdd57('0x3d')]][_0xdd57('0x8')];queues[_0x5470a7[_0xdd57('0x45')]][_0xdd57('0x46')]=queues[_0x5470a7[_0xdd57('0x3d')]][_0xdd57('0x46')];queues[_0x5470a7[_0xdd57('0x45')]][_0xdd57('0x2a')]=utils[_0xdd57('0x13')]();queues[_0x5470a7[_0xdd57('0x45')]]['queuecallerleaveAt']=utils[_0xdd57('0x13')]();queues[_0x5470a7[_0xdd57('0x45')]][_0xdd57('0x28')]=0x0;queues[_0x5470a7[_0xdd57('0x45')]][_0xdd57('0x49')]=0x0;}else{queues[_0x5470a7['secondtransfererlinkedid']][_0xdd57('0x10')]=_0x5470a7[_0xdd57('0x3d')];}}}}catch(_0x5f1d8c){utils['error'](_0x5f1d8c[_0xdd57('0x4a')]);}};exports[_0xdd57('0x4b')]=function(_0xbf5b07){if(!_[_0xdd57('0x15')](queues[_0xbf5b07[_0xdd57('0x16')]])){queues[_0xbf5b07['uniqueid']]['musiconholdstartAt']=utils[_0xdd57('0x13')]();}};exports[_0xdd57('0x4c')]=function(_0x26debd){if(!_['isNil'](queues[_0x26debd[_0xdd57('0x16')]])){if(!_[_0xdd57('0x15')](queues[_0x26debd[_0xdd57('0x16')]][_0xdd57('0x4d')])){queues[_0x26debd[_0xdd57('0x16')]][_0xdd57('0x49')]+=utils[_0xdd57('0x29')](utils[_0xdd57('0x13')](),queues[_0x26debd[_0xdd57('0x16')]][_0xdd57('0x4d')]);delete queues[_0x26debd[_0xdd57('0x16')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0x1588=['transfereelinkedid','calleridname','mohtime','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','position','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','COMPLETEDBYAGENT','queuecallerenterreason','varset','toUpperCase','queuecallerabandonAt','queuecallerexitAt','value','queueposition','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','agentcomplete','membername','queuecallercomplete','transfer','COMPLETEDBY','reason','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER'];(function(_0x4fa998,_0x2b158e){var _0x56b6cb=function(_0x58d8f4){while(--_0x58d8f4){_0x4fa998['push'](_0x4fa998['shift']());}};_0x56b6cb(++_0x2b158e);}(_0x1588,0xee));var _0x8158=function(_0x5c2e65,_0x271182){_0x5c2e65=_0x5c2e65-0x0;var _0x4241c1=_0x1588[_0x5c2e65];return _0x4241c1;};'use strict';var _=require(_0x8158('0x0'));var util=require('util');var utils=require(_0x8158('0x1'));var queues={};function writeDB(_0xbbecc7){utils[_0x8158('0x2')](util[_0x8158('0x3')](_0x8158('0x4'),_0xbbecc7[_0x8158('0x5')],_0xbbecc7['channel'],_0xbbecc7[_0x8158('0x6')],_0xbbecc7[_0x8158('0x7')],_0xbbecc7[_0x8158('0x8')],_0xbbecc7['accountcode'],_0xbbecc7[_0x8158('0x9')]));if(_0xbbecc7[_0x8158('0x6')]){utils[_0x8158('0xa')](_0xbbecc7[_0x8158('0x6')])['then'](function(_0x115b86){if(_0x115b86){_0xbbecc7[_0x8158('0xb')]=_0x115b86[_0x8158('0xb')];}utils[_0x8158('0xc')](_0x8158('0xd'),_0xbbecc7);});}else{utils['request']('CreateVoiceQueueReport',_0xbbecc7);}if(_0xbbecc7[_0x8158('0xe')]){delete queues[_0xbbecc7[_0x8158('0xe')]];}else{delete queues[_0xbbecc7[_0x8158('0x5')]];}}exports['queuecallerjoin']=function(_0x3c8326){queues[_0x3c8326[_0x8158('0x5')]]=_['assign'](_0x3c8326,{'originalposition':_0x3c8326[_0x8158('0xf')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x8158('0x10')]=function(_0x27663a){if(!_[_0x8158('0x11')](queues[_0x27663a['uniqueid']])){if(queues[_0x27663a[_0x8158('0x5')]][_0x8158('0x12')]){if(!queues[_0x27663a[_0x8158('0x5')]][_0x8158('0x13')]&&!queues[_0x27663a['uniqueid']][_0x8158('0x14')]){queues[_0x27663a[_0x8158('0x5')]]['queuecallercomplete']=!![];queues[_0x27663a[_0x8158('0x5')]][_0x8158('0x15')]=utils[_0x8158('0x16')]();queues[_0x27663a[_0x8158('0x5')]][_0x8158('0x9')]=_0x8158('0x17');}writeDB(queues[_0x27663a[_0x8158('0x5')]]);}else{if(queues[_0x27663a[_0x8158('0x5')]][_0x8158('0xe')]){queues[queues[_0x27663a[_0x8158('0x5')]][_0x8158('0xe')]]=queues[_0x27663a[_0x8158('0x5')]];queues[queues[_0x27663a[_0x8158('0x5')]][_0x8158('0xe')]][_0x8158('0x18')]=0x2;delete queues[_0x27663a[_0x8158('0x5')]];}}}};exports[_0x8158('0x19')]=function(_0x56cd41){if(!_[_0x8158('0x11')](_0x56cd41['variable']['queuestatus'])&&_0x56cd41['value'][_0x8158('0x1a')]()!=='CONTINUE'){if(!_[_0x8158('0x11')](queues[_0x56cd41[_0x8158('0x5')]])){queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x13')]=![];queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x1b')]=null;queues[_0x56cd41['uniqueid']][_0x8158('0x14')]=!![];queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x1c')]=utils[_0x8158('0x16')]();queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x9')]=_0x56cd41[_0x8158('0x1d')]['toUpperCase']();writeDB(queues[_0x56cd41[_0x8158('0x5')]]);}}else if(!_[_0x8158('0x11')](_0x56cd41['variable'][_0x8158('0x1e')])){if(!_[_0x8158('0x11')](queues[_0x56cd41['uniqueid']])&&!queues[_0x56cd41['uniqueid']][_0x8158('0x13')]){queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x13')]=![];queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x1b')]=null;queues[_0x56cd41['uniqueid']][_0x8158('0x14')]=!![];queues[_0x56cd41[_0x8158('0x5')]]['queuecallerexitAt']=utils[_0x8158('0x16')]();queues[_0x56cd41[_0x8158('0x5')]][_0x8158('0x9')]=_0x8158('0x1f');}}};exports[_0x8158('0x13')]=function(_0x302b2c){if(!_[_0x8158('0x11')](queues[_0x302b2c[_0x8158('0x5')]])){queues[_0x302b2c[_0x8158('0x5')]][_0x8158('0x14')]=![];queues[_0x302b2c[_0x8158('0x5')]]['queuecallerexitAt']=null;queues[_0x302b2c['uniqueid']][_0x8158('0x13')]=!![];queues[_0x302b2c[_0x8158('0x5')]][_0x8158('0x1b')]=utils[_0x8158('0x16')]();queues[_0x302b2c['uniqueid']]['queuecallerexitreason']='ABANDONED';}};exports[_0x8158('0x20')]=function(_0x2f8fe9){if(!_['isNil'](queues[_0x2f8fe9[_0x8158('0x5')]])){queues[_0x2f8fe9[_0x8158('0x5')]][_0x8158('0x20')]=!![];queues[_0x2f8fe9[_0x8158('0x5')]][_0x8158('0x12')]=utils['now']();queues[_0x2f8fe9[_0x8158('0x5')]][_0x8158('0x21')]=utils[_0x8158('0x22')](queues[_0x2f8fe9[_0x8158('0x5')]]['queuecallerleaveAt'],queues[_0x2f8fe9[_0x8158('0x5')]][_0x8158('0x23')]);queues[_0x2f8fe9['uniqueid']]['position']=_0x2f8fe9[_0x8158('0xf')];queues[_0x2f8fe9[_0x8158('0x5')]][_0x8158('0x24')]=_0x2f8fe9['count'];queues[_0x2f8fe9['uniqueid']]['connectedlinenum']=_0x2f8fe9[_0x8158('0x25')];queues[_0x2f8fe9[_0x8158('0x5')]]['connectedlinename']=_0x2f8fe9[_0x8158('0x26')];}};exports[_0x8158('0x27')]=function(_0x122e10){if(!_[_0x8158('0x11')](queues[_0x122e10['uniqueid']])){queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x13')]=![];queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x13')]=![];queues[_0x122e10[_0x8158('0x5')]]['queuecallerabandonAt']=null;queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x14')]=![];queues[_0x122e10[_0x8158('0x5')]]['queuecallerexitreason']=null;queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x1c')]=null;queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x28')]=!![];queues[_0x122e10['uniqueid']][_0x8158('0x29')]=_0x122e10[_0x8158('0x2a')];queues[_0x122e10[_0x8158('0x5')]][_0x8158('0x7')]=_0x122e10['membername'];}};exports[_0x8158('0x2b')]=function(_0x1f3312){if(!_[_0x8158('0x11')](queues[_0x1f3312[_0x8158('0x5')]])){if(queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x12')]){queues[_0x1f3312[_0x8158('0x5')]]['queuecallerabandon']=![];queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x13')]=![];queues[_0x1f3312['uniqueid']][_0x8158('0x1b')]=null;queues[_0x1f3312['uniqueid']]['queuecallerexit']=![];queues[_0x1f3312['uniqueid']][_0x8158('0x1c')]=null;queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x28')]=!![];queues[_0x1f3312['uniqueid']][_0x8158('0x7')]=_0x1f3312[_0x8158('0x2c')];queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x2d')]=!![];queues[_0x1f3312['uniqueid']]['queuecallercompleteAt']=utils['now']();if(_0x1f3312['reason']==_0x8158('0x2e')){if(!queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x2e')]){queues[_0x1f3312[_0x8158('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x1f3312[_0x8158('0x5')]][_0x8158('0x9')]=_0x8158('0x2f')+_0x1f3312[_0x8158('0x30')][_0x8158('0x1a')]();}writeDB(queues[_0x1f3312[_0x8158('0x5')]]);}}};exports[_0x8158('0x31')]=function(_0x2560d8){if(!_[_0x8158('0x11')](queues[_0x2560d8[_0x8158('0x32')]])){queues[_0x2560d8[_0x8158('0x32')]]['transfer']=!![];queues[_0x2560d8[_0x8158('0x32')]][_0x8158('0x33')]=_0x8158('0x34');queues[_0x2560d8[_0x8158('0x32')]][_0x8158('0x35')]=_0x2560d8['extension'];queues[_0x2560d8[_0x8158('0x32')]]['transferuniqueid']=_0x2560d8[_0x8158('0x32')];queues[_0x2560d8[_0x8158('0x32')]][_0x8158('0x9')]=_0x8158('0x36');}};exports['attendedtransfer']=function(_0x5eb3bd){try{if(_0x5eb3bd[_0x8158('0x37')]==_0x5eb3bd[_0x8158('0x38')]){if(!_[_0x8158('0x11')](queues[_0x5eb3bd[_0x8158('0x39')]])){queues[_0x5eb3bd['secondtransfererlinkedid']][_0x8158('0x2e')]=!![];queues[_0x5eb3bd[_0x8158('0x39')]][_0x8158('0x33')]=_0x8158('0x3a');queues[_0x5eb3bd[_0x8158('0x39')]][_0x8158('0x35')]=_0x5eb3bd[_0x8158('0x3b')];queues[_0x5eb3bd[_0x8158('0x39')]][_0x8158('0x3c')]=_0x5eb3bd[_0x8158('0x37')];queues[_0x5eb3bd[_0x8158('0x39')]][_0x8158('0x9')]=_0x8158('0x3d');}if(!_[_0x8158('0x11')](queues[_0x5eb3bd[_0x8158('0x38')]])){if(_0x5eb3bd[_0x8158('0x3e')]&&queues[_0x5eb3bd[_0x8158('0x3e')]]){queues[_0x5eb3bd[_0x8158('0x3e')]]['queuecallerenterreason']=0x1;queues[_0x5eb3bd[_0x8158('0x32')]]=_['clone'](queues[_0x5eb3bd[_0x8158('0x3e')]]);queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0xe')]=_0x5eb3bd['transfertargetuniqueid'];queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x18')]=0x2;queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x8')]=queues[_0x5eb3bd[_0x8158('0x39')]][_0x8158('0x8')];queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x3f')]=queues[_0x5eb3bd[_0x8158('0x39')]]['calleridname'];queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x23')]=utils[_0x8158('0x16')]();queues[_0x5eb3bd['transfereeuniqueid']][_0x8158('0x12')]=utils[_0x8158('0x16')]();queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x21')]=0x0;queues[_0x5eb3bd[_0x8158('0x32')]][_0x8158('0x40')]=0x0;}else{queues[_0x5eb3bd[_0x8158('0x38')]]['transfereduniqueid']=_0x5eb3bd[_0x8158('0x39')];}}}else if(_0x5eb3bd[_0x8158('0x41')]==_0x5eb3bd['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x5eb3bd[_0x8158('0x38')]])){queues[_0x5eb3bd[_0x8158('0x38')]][_0x8158('0x2e')]=!![];queues[_0x5eb3bd[_0x8158('0x38')]][_0x8158('0x33')]=_0x8158('0x3a');queues[_0x5eb3bd[_0x8158('0x38')]][_0x8158('0x35')]=_0x5eb3bd[_0x8158('0x42')];queues[_0x5eb3bd[_0x8158('0x38')]][_0x8158('0x3c')]=_0x5eb3bd[_0x8158('0x41')];queues[_0x5eb3bd['origtransfererlinkedid']][_0x8158('0x9')]=_0x8158('0x3d');}if(!_[_0x8158('0x11')](queues[_0x5eb3bd[_0x8158('0x39')]])){if(_0x5eb3bd[_0x8158('0x43')]&&queues[_0x5eb3bd[_0x8158('0x43')]]){queues[_0x5eb3bd['transfertargetlinkedid']][_0x8158('0x18')]=0x1;queues[_0x5eb3bd[_0x8158('0x44')]]=_[_0x8158('0x45')](queues[_0x5eb3bd[_0x8158('0x43')]]);queues[_0x5eb3bd[_0x8158('0x44')]]['transfereduniqueid']=_0x5eb3bd[_0x8158('0x44')];queues[_0x5eb3bd[_0x8158('0x44')]][_0x8158('0x18')]=0x2;queues[_0x5eb3bd[_0x8158('0x44')]][_0x8158('0x8')]=queues[_0x5eb3bd[_0x8158('0x38')]][_0x8158('0x8')];queues[_0x5eb3bd['transfertargetuniqueid']][_0x8158('0x3f')]=queues[_0x5eb3bd['origtransfererlinkedid']][_0x8158('0x3f')];queues[_0x5eb3bd[_0x8158('0x44')]][_0x8158('0x23')]=utils['now']();queues[_0x5eb3bd[_0x8158('0x44')]][_0x8158('0x12')]=utils[_0x8158('0x16')]();queues[_0x5eb3bd['transfertargetuniqueid']][_0x8158('0x21')]=0x0;queues[_0x5eb3bd['transfertargetuniqueid']][_0x8158('0x40')]=0x0;}else{queues[_0x5eb3bd['secondtransfererlinkedid']][_0x8158('0xe')]=_0x5eb3bd[_0x8158('0x38')];}}}}catch(_0x4c45ea){utils[_0x8158('0x46')](_0x4c45ea[_0x8158('0x47')]);}};exports[_0x8158('0x48')]=function(_0x582865){if(!_[_0x8158('0x11')](queues[_0x582865['uniqueid']])){queues[_0x582865[_0x8158('0x5')]][_0x8158('0x49')]=utils['now']();}};exports[_0x8158('0x4a')]=function(_0x32d44a){if(!_['isNil'](queues[_0x32d44a['uniqueid']])){if(!_['isNil'](queues[_0x32d44a[_0x8158('0x5')]][_0x8158('0x49')])){queues[_0x32d44a['uniqueid']][_0x8158('0x40')]+=utils['diffTime'](utils['now'](),queues[_0x32d44a[_0x8158('0x5')]]['musiconholdstartAt']);delete queues[_0x32d44a[_0x8158('0x5')]][_0x8158('0x49')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 96744f1..5434d13 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x5c1920,_0x4381f6){var _0x1001aa=function(_0xb3d635){while(--_0xb3d635){_0x5c1920['push'](_0x5c1920['shift']());}};_0x1001aa(++_0x4381f6);}(_0xe706,0xa3));var _0x6e70=function(_0x570016,_0x111cb9){_0x570016=_0x570016-0x0;var _0x3b4176=_0xe706[_0x570016];return _0x3b4176;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file +var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x4a5612,_0x185cc1){var _0x5e2485=function(_0x27e8e1){while(--_0x27e8e1){_0x4a5612['push'](_0x4a5612['shift']());}};_0x5e2485(++_0x185cc1);}(_0xe706,0xa3));var _0x6e70=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0xe706[_0x10a889];return _0x3b5ed3;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8cbd130..6cc81fa 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 _0x31c2=['type','request','CreateVoiceTransferReport','blindtransfer','blind','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','stack','lodash','info','TRANSFER|%s'];(function(_0xddfcda,_0x4f654f){var _0x2e8021=function(_0x6fefcb){while(--_0x6fefcb){_0xddfcda['push'](_0xddfcda['shift']());}};_0x2e8021(++_0x4f654f);}(_0x31c2,0x98));var _0x231c=function(_0x9b5fe4,_0x3d2acd){_0x9b5fe4=_0x9b5fe4-0x0;var _0x32864a=_0x31c2[_0x9b5fe4];return _0x32864a;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x473c0d){utils[_0x231c('0x1')](util['format'](_0x231c('0x2'),_0x473c0d[_0x231c('0x3')]));utils[_0x231c('0x4')](_0x231c('0x5'),_0x473c0d);}exports[_0x231c('0x6')]=function(_0x243f47){try{_0x243f47[_0x231c('0x3')]=_0x231c('0x7');writeDB(_0x243f47);}catch(_0x5afc76){utils[_0x231c('0x8')](_0x5afc76['stack']);}};exports[_0x231c('0x9')]=function(_0x396da8){try{_0x396da8=_[_0x231c('0xa')](_0x396da8,{'transfererchannel':_0x396da8[_0x231c('0xb')],'transferercalleridnum':_0x396da8['origtransferercalleridnum'],'transferercalleridname':_0x396da8[_0x231c('0xc')],'transfererconnectedlinenum':_0x396da8[_0x231c('0xd')],'transfererconnectedlinename':_0x396da8[_0x231c('0xe')],'transfereraccountcode':_0x396da8[_0x231c('0xf')],'transferercontext':_0x396da8[_0x231c('0x10')],'transfererexten':_0x396da8[_0x231c('0x11')],'transfererlinkedid':_0x396da8['origtransfererlinkedid'],'context':_0x396da8['origtransferercontext'],'extension':_0x396da8['origtransfererexten'],'type':_0x231c('0x12')});if(_[_0x231c('0x13')](_0x396da8[_0x231c('0x14')])){_0x396da8=_[_0x231c('0xa')](_0x396da8,{'transfereechannel':_0x396da8[_0x231c('0x15')],'transfereecalleridnum':_0x396da8[_0x231c('0x16')],'transfereecalleridname':_0x396da8[_0x231c('0x17')],'transfereeconnectedlinenum':_0x396da8[_0x231c('0x18')],'transfereeconnectedlinename':_0x396da8[_0x231c('0x19')],'transfereeaccountcode':_0x396da8[_0x231c('0x1a')],'transfereecontext':_0x396da8[_0x231c('0x1b')],'transfereeexten':_0x396da8[_0x231c('0x1c')],'transfereelinkedid':_0x396da8[_0x231c('0x1d')]});}writeDB(_0x396da8);}catch(_0x35bc87){utils['error'](_0x35bc87[_0x231c('0x1e')]);}}; \ No newline at end of file +var _0xa7d8=['blindtransfer','error','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','stack','lodash','./utils','info','format','type','request','CreateVoiceTransferReport'];(function(_0x590381,_0x5c3948){var _0xe300df=function(_0x148e67){while(--_0x148e67){_0x590381['push'](_0x590381['shift']());}};_0xe300df(++_0x5c3948);}(_0xa7d8,0x94));var _0x8a7d=function(_0x2c84a0,_0x3e8584){_0x2c84a0=_0x2c84a0-0x0;var _0x1592e6=_0xa7d8[_0x2c84a0];return _0x1592e6;};'use strict';var _=require(_0x8a7d('0x0'));var util=require('util');var utils=require(_0x8a7d('0x1'));function writeDB(_0x5c0012){utils[_0x8a7d('0x2')](util[_0x8a7d('0x3')]('TRANSFER|%s',_0x5c0012[_0x8a7d('0x4')]));utils[_0x8a7d('0x5')](_0x8a7d('0x6'),_0x5c0012);}exports[_0x8a7d('0x7')]=function(_0x447dc2){try{_0x447dc2[_0x8a7d('0x4')]='blind';writeDB(_0x447dc2);}catch(_0x3821fb){utils[_0x8a7d('0x8')](_0x3821fb['stack']);}};exports[_0x8a7d('0x9')]=function(_0x5f5d25){try{_0x5f5d25=_[_0x8a7d('0xa')](_0x5f5d25,{'transfererchannel':_0x5f5d25[_0x8a7d('0xb')],'transferercalleridnum':_0x5f5d25[_0x8a7d('0xc')],'transferercalleridname':_0x5f5d25[_0x8a7d('0xd')],'transfererconnectedlinenum':_0x5f5d25[_0x8a7d('0xe')],'transfererconnectedlinename':_0x5f5d25['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5f5d25[_0x8a7d('0xf')],'transferercontext':_0x5f5d25['secondtransferercontext'],'transfererexten':_0x5f5d25[_0x8a7d('0x10')],'transfererlinkedid':_0x5f5d25[_0x8a7d('0x11')],'context':_0x5f5d25[_0x8a7d('0x12')],'extension':_0x5f5d25[_0x8a7d('0x13')],'type':'attended'});if(_[_0x8a7d('0x14')](_0x5f5d25[_0x8a7d('0x15')])){_0x5f5d25=_[_0x8a7d('0xa')](_0x5f5d25,{'transfereechannel':_0x5f5d25[_0x8a7d('0x16')],'transfereecalleridnum':_0x5f5d25['transfertargetcalleridnum'],'transfereecalleridname':_0x5f5d25[_0x8a7d('0x17')],'transfereeconnectedlinenum':_0x5f5d25[_0x8a7d('0x18')],'transfereeconnectedlinename':_0x5f5d25[_0x8a7d('0x19')],'transfereeaccountcode':_0x5f5d25[_0x8a7d('0x1a')],'transfereecontext':_0x5f5d25[_0x8a7d('0x1b')],'transfereeexten':_0x5f5d25[_0x8a7d('0x1c')],'transfereelinkedid':_0x5f5d25[_0x8a7d('0x1d')]});}writeDB(_0x5f5d25);}catch(_0x3b0f40){utils[_0x8a7d('0x8')](_0x3b0f40[_0x8a7d('0x1e')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 38f5a08..9c57688 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 _0x6216=['jayson/promise','moment','bluebird','client','http','../../config/logger','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','name','interface','GETUSER|','result','FOUND','NOTFOUND','length','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','isBefore'];(function(_0x36f19e,_0x78c651){var _0x592e4e=function(_0x53af38){while(--_0x53af38){_0x36f19e['push'](_0x36f19e['shift']());}};_0x592e4e(++_0x78c651);}(_0x6216,0x130));var _0x6621=function(_0x5e62e9,_0x2772ea){_0x5e62e9=_0x5e62e9-0x0;var _0x592200=_0x6216[_0x5e62e9];return _0x592200;};'use strict';var jayson=require(_0x6621('0x0'));var moment=require(_0x6621('0x1'));var BPromise=require(_0x6621('0x2'));var client=jayson[_0x6621('0x3')][_0x6621('0x4')]({'port':0x2329});var logger=require(_0x6621('0x5'))('xdr');exports['info']=function(_0x5e60ef){logger[_0x6621('0x6')](_0x5e60ef);};exports[_0x6621('0x7')]=function(_0x347f6f){logger[_0x6621('0x7')](JSON[_0x6621('0x8')](_0x347f6f));};exports[_0x6621('0x9')]=function(_0x973084){logger['error'](_0x973084[_0x6621('0xa')]);};exports[_0x6621('0xb')]=function(_0x2282ec,_0xd4ca63){return client[_0x6621('0xb')](_0x2282ec,{'body':_0xd4ca63})[_0x6621('0xc')](function(_0x1cc99e){logger['debug'](JSON[_0x6621('0x8')](_0x1cc99e));})[_0x6621('0xd')](function(_0x5aa9fe){logger['error'](_0x5aa9fe[_0x6621('0xa')]);});};function getUser(_0x86cb86){return client['request'](_0x6621('0xe'),{'options':{'raw':!![],'attributes':['id',_0x6621('0xf'),_0x6621('0x10'),_0x6621('0x11')],'where':_0x86cb86,'limit':0x1}})[_0x6621('0xc')](function(_0x13a572){logger[_0x6621('0x6')](_0x6621('0x12')+JSON[_0x6621('0x8')](_0x86cb86)+'|'+(_0x13a572[_0x6621('0x13')]['length']?_0x6621('0x14'):_0x6621('0x15')));return _0x13a572[_0x6621('0x13')][_0x6621('0x16')]?_0x13a572[_0x6621('0x13')][0x0]:null;});}exports[_0x6621('0x17')]=function(_0x1005a4){return new BPromise(function(_0x49d859,_0x531555){if(_0x1005a4){return getUser({'internal':_0x1005a4})[_0x6621('0xc')](function(_0x43b7e6){return _0x49d859(_0x43b7e6);})['catch'](function(_0x354880){logger[_0x6621('0x9')](_0x354880[_0x6621('0xa')]);return _0x49d859(null);});}else{return _0x49d859(null);}});};exports[_0x6621('0x18')]=function(_0x5b1f0b){return new BPromise(function(_0xf53ed6,_0x537431){if(_0x5b1f0b){return getUser({'interface':_0x5b1f0b})[_0x6621('0xc')](function(_0x3cd38e){return _0xf53ed6(_0x3cd38e);})['catch'](function(_0x41d7ba){logger['error'](_0x41d7ba['stack']);return _0xf53ed6(null);});}else{return _0xf53ed6(null);}});};exports[_0x6621('0x19')]=function(_0x110c5c){return new BPromise(function(_0x5a48ce,_0x1924e9){if(_0x110c5c){return getUser({'name':_0x110c5c})[_0x6621('0xc')](function(_0x14424e){return _0x5a48ce(_0x14424e);})[_0x6621('0xd')](function(_0x203eb1){logger[_0x6621('0x9')](_0x203eb1['stack']);return _0x5a48ce(null);});}else{return _0x5a48ce(null);}});};exports[_0x6621('0x1a')]=function(_0x4a56c3){return new BPromise(function(_0x180c90,_0x395be9){if(_0x4a56c3){return client[_0x6621('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x6621('0x10'),_0x6621('0x1b'),_0x6621('0x1c'),_0x6621('0x1d')],'where':{'name':_0x4a56c3},'limit':0x1}})['then'](function(_0x21a3fb){logger[_0x6621('0x6')](_0x6621('0x1e')+_0x4a56c3+'|'+(_0x21a3fb[_0x6621('0x13')][_0x6621('0x16')]?_0x6621('0x14'):_0x6621('0x15')));return _0x180c90(_0x21a3fb['result']['length']?_0x21a3fb[_0x6621('0x13')][0x0]:null);})[_0x6621('0xd')](function(_0x4cc69d){logger[_0x6621('0x9')](_0x4cc69d[_0x6621('0xa')]);return _0x180c90(null);});}else{return _0x180c90(null);}});};exports['addTime']=function(_0x19dfcb,_0x5a8231){return moment(_0x19dfcb)['add'](_0x5a8231,_0x6621('0x1f'))[_0x6621('0x20')](_0x6621('0x21'));};exports[_0x6621('0x22')]=function(_0x27309c,_0x527930){return moment(_0x27309c)[_0x6621('0x23')](_0x527930,'seconds')[_0x6621('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x88dad5,_0x39d6c0){return moment(_0x88dad5)[_0x6621('0x24')](moment(_0x39d6c0),_0x6621('0x1f'));};exports['sumTime']=function(_0x4c80d9,_0x4bcb42){return parseInt(_0x4c80d9,0xa)+parseInt(_0x4bcb42,0xa);};exports['now']=function(){return moment()[_0x6621('0x20')](_0x6621('0x21'));};exports['isAfter']=function(_0x2522e6,_0x1471c2){if(_0x1471c2){return moment(_0x2522e6)['isAfter'](_0x1471c2);}else{return!![];}};exports['isBefore']=function(_0x580674,_0x1b9595){if(_0x1b9595){return moment(_0x580674)[_0x6621('0x25')](_0x1b9595);}else if(_0x580674){return!![];}else{return![];}}; \ No newline at end of file +var _0x58ff=['format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','GetUser','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','catch','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','addTime','seconds'];(function(_0x213fb7,_0x3ac709){var _0xcc4fd5=function(_0x1a0ab0){while(--_0x1a0ab0){_0x213fb7['push'](_0x213fb7['shift']());}};_0xcc4fd5(++_0x3ac709);}(_0x58ff,0x128));var _0xf58f=function(_0x113b2a,_0x53c30f){_0x113b2a=_0x113b2a-0x0;var _0x15b43a=_0x58ff[_0x113b2a];return _0x15b43a;};'use strict';var jayson=require(_0xf58f('0x0'));var moment=require(_0xf58f('0x1'));var BPromise=require('bluebird');var client=jayson['client'][_0xf58f('0x2')]({'port':0x2329});var logger=require(_0xf58f('0x3'))(_0xf58f('0x4'));exports[_0xf58f('0x5')]=function(_0x36c5c6){logger['info'](_0x36c5c6);};exports[_0xf58f('0x6')]=function(_0x592ba6){logger[_0xf58f('0x6')](JSON[_0xf58f('0x7')](_0x592ba6));};exports[_0xf58f('0x8')]=function(_0x3cdd90){logger[_0xf58f('0x8')](_0x3cdd90[_0xf58f('0x9')]);};exports[_0xf58f('0xa')]=function(_0x19a1ce,_0x35d54c){return client['request'](_0x19a1ce,{'body':_0x35d54c})[_0xf58f('0xb')](function(_0x532f25){logger[_0xf58f('0x6')](JSON[_0xf58f('0x7')](_0x532f25));})['catch'](function(_0x17b351){logger['error'](_0x17b351[_0xf58f('0x9')]);});};function getUser(_0x1367af){return client[_0xf58f('0xa')](_0xf58f('0xc'),{'options':{'raw':!![],'attributes':['id',_0xf58f('0xd'),_0xf58f('0xe'),_0xf58f('0xf')],'where':_0x1367af,'limit':0x1}})[_0xf58f('0xb')](function(_0x46ddba){logger[_0xf58f('0x5')](_0xf58f('0x10')+JSON[_0xf58f('0x7')](_0x1367af)+'|'+(_0x46ddba[_0xf58f('0x11')][_0xf58f('0x12')]?_0xf58f('0x13'):_0xf58f('0x14')));return _0x46ddba[_0xf58f('0x11')][_0xf58f('0x12')]?_0x46ddba['result'][0x0]:null;});}exports[_0xf58f('0x15')]=function(_0x11862c){return new BPromise(function(_0x1cfb49,_0x2c2782){if(_0x11862c){return getUser({'internal':_0x11862c})[_0xf58f('0xb')](function(_0xe23254){return _0x1cfb49(_0xe23254);})[_0xf58f('0x16')](function(_0x2f236a){logger[_0xf58f('0x8')](_0x2f236a[_0xf58f('0x9')]);return _0x1cfb49(null);});}else{return _0x1cfb49(null);}});};exports['getUserByInterface']=function(_0x1208f2){return new BPromise(function(_0x1a507e,_0x5824f3){if(_0x1208f2){return getUser({'interface':_0x1208f2})[_0xf58f('0xb')](function(_0x5dd16a){return _0x1a507e(_0x5dd16a);})[_0xf58f('0x16')](function(_0x4a40ec){logger[_0xf58f('0x8')](_0x4a40ec[_0xf58f('0x9')]);return _0x1a507e(null);});}else{return _0x1a507e(null);}});};exports[_0xf58f('0x17')]=function(_0x538251){return new BPromise(function(_0x2cef62,_0x484764){if(_0x538251){return getUser({'name':_0x538251})[_0xf58f('0xb')](function(_0x3572df){return _0x2cef62(_0x3572df);})['catch'](function(_0x331db7){logger[_0xf58f('0x8')](_0x331db7[_0xf58f('0x9')]);return _0x2cef62(null);});}else{return _0x2cef62(null);}});};exports[_0xf58f('0x18')]=function(_0x16717b){return new BPromise(function(_0x3d0756,_0x54bfd9){if(_0x16717b){return client[_0xf58f('0xa')](_0xf58f('0x19'),{'options':{'raw':!![],'attributes':['id',_0xf58f('0xe'),_0xf58f('0x1a'),_0xf58f('0x1b'),_0xf58f('0x1c')],'where':{'name':_0x16717b},'limit':0x1}})[_0xf58f('0xb')](function(_0xead432){logger[_0xf58f('0x5')](_0xf58f('0x1d')+_0x16717b+'|'+(_0xead432[_0xf58f('0x11')]['length']?'FOUND':_0xf58f('0x14')));return _0x3d0756(_0xead432[_0xf58f('0x11')]['length']?_0xead432[_0xf58f('0x11')][0x0]:null);})[_0xf58f('0x16')](function(_0x24d387){logger[_0xf58f('0x8')](_0x24d387[_0xf58f('0x9')]);return _0x3d0756(null);});}else{return _0x3d0756(null);}});};exports[_0xf58f('0x1e')]=function(_0x3840fe,_0x509a86){return moment(_0x3840fe)['add'](_0x509a86,_0xf58f('0x1f'))[_0xf58f('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xf58f('0x21')]=function(_0x3db743,_0x137237){return moment(_0x3db743)['subtract'](_0x137237,_0xf58f('0x1f'))[_0xf58f('0x20')](_0xf58f('0x22'));};exports[_0xf58f('0x23')]=function(_0x191c5c,_0x13cd65){return moment(_0x191c5c)[_0xf58f('0x24')](moment(_0x13cd65),_0xf58f('0x1f'));};exports[_0xf58f('0x25')]=function(_0x39d544,_0x34998a){return parseInt(_0x39d544,0xa)+parseInt(_0x34998a,0xa);};exports[_0xf58f('0x26')]=function(){return moment()[_0xf58f('0x20')](_0xf58f('0x22'));};exports[_0xf58f('0x27')]=function(_0x31d6bb,_0x513a60){if(_0x513a60){return moment(_0x31d6bb)[_0xf58f('0x27')](_0x513a60);}else{return!![];}};exports[_0xf58f('0x28')]=function(_0x1ea3f0,_0x360eb5){if(_0x360eb5){return moment(_0x1ea3f0)[_0xf58f('0x28')](_0x360eb5);}else if(_0x1ea3f0){return!![];}else{return![];}}; \ No newline at end of file